From: Andrea Bianco Date: Sun, 9 May 2021 09:52:36 +0000 (+0200) Subject: Built motion from commit (unavailable).|2.5.27 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22javascript:void%28%27%7BtitleJs%7D%27%29/%22%22%29%20%27?a=commitdiff_plain;h=4e0b73e06d7042ced04e80d6415b01527473ed91;p=motion2.git Built motion from commit (unavailable).|2.5.27 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 8fda92a..3f230d1 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1,6 +1,6 @@ define({ "name": "xCALLY Motion API", - "version": "2.5.26", + "version": "2.5.27", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-05-07T09:05:38.915Z", + "time": "2021-05-09T09:43:58.957Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index e43659a..bb2aece 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1,6 +1,6 @@ { "name": "xCALLY Motion API", - "version": "2.5.26", + "version": "2.5.27", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-05-07T09:05:38.915Z", + "time": "2021-05-09T09:43:58.957Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/package.json b/package.json index 4458090..fa4bbbb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.5.26", + "version": "2.5.27", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "main": "server/app.js", "engines": { @@ -12,22 +12,23 @@ }, "author": "xCALLY Team", "contributors": [ - "Giuseppe Careri ", + "Giuseppe Careri ", "Daniele Cinti ", "Innocenzo Biondo ", - "Massimiliano Bungaro ", - "Andrea Bianco ", - "Fabio Lodato ", - "Andrea Cuccaro ", + "Massimiliano Bungaro ", + "Andrea Bianco ", + "Fabio Lodato ", + "Andrea Cuccaro ", "Donatella Soldi ", "Afnan Imtiaz ", "Cristian Di Sclafani ", "Marco Giraldi ", "Giulia Trombin ", - "Cristopher Fasolin ", - "Marco Messina ", - "Vito Macchia ", - "Marco Lecce " + "Cristopher Fasolin ", + "Marco Messina ", + "Vito Macchia ", + "Marco Lecce ", + "Rodolfo Bevione " ], "private": true, "license": "EULA", @@ -61,6 +62,7 @@ "express-winston": "2.6.0", "extract-zip": "1.7.0", "fast-json-patch": "1.2.2", + "fs-extra": "1.0.0", "google-tts-api": "github:xmdevelop/google-tts", "grpc": "1.24.6", "html-to-pdfmake": "^2.1.7", diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 65f0b83..c880747 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 _0xa3fb=['STRING','contactManager','integration','motionbar','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]','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x4fb789,_0x6b8092){var _0x49b5e4=function(_0x256537){while(--_0x256537){_0x4fb789['push'](_0x4fb789['shift']());}};_0x49b5e4(++_0x6b8092);}(_0xa3fb,0xb7));var _0xba3f=function(_0x5ac95d,_0x4526db){_0x5ac95d=_0x5ac95d-0x0;var _0x17005b=_0xa3fb[_0x5ac95d];return _0x17005b;};'use strict';var Sequelize=require(_0xba3f('0x0'));module[_0xba3f('0x1')]={'name':{'type':Sequelize[_0xba3f('0x2')],'get':function(_0x7b1667){return this[_0xba3f('0x3')]('action');}},'action':{'type':Sequelize[_0xba3f('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xba3f('0x5'),_0xba3f('0x6'),_0xba3f('0x7'),_0xba3f('0x8'),_0xba3f('0x9'),_0xba3f('0xa'),_0xba3f('0xb'),_0xba3f('0xc')]],'msg':_0xba3f('0xd')}},'comment':_0xba3f('0xd')},'data1':{'type':Sequelize[_0xba3f('0x4')](0x1000),'comment':_0xba3f('0xe')},'data2':{'type':Sequelize[_0xba3f('0x4')](0x1000),'comment':_0xba3f('0xf')},'data3':{'type':Sequelize[_0xba3f('0x4')](0x1000),'comment':_0xba3f('0x10')},'data4':{'type':Sequelize[_0xba3f('0x4')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0xba3f('0x4')]},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xeeef=['script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','integration','motionbar','jscripty','urlForward','browser'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xeeef,0x1d4));var _0xfeee=function(_0x43ba33,_0x1fa01d){_0x43ba33=_0x43ba33-0x0;var _0x4b8c7b=_0xeeef[_0x43ba33];return _0x4b8c7b;};'use strict';var Sequelize=require(_0xfeee('0x0'));module[_0xfeee('0x1')]={'name':{'type':Sequelize[_0xfeee('0x2')],'get':function(_0x153c30){return this['getDataValue']('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xfeee('0x3'),_0xfeee('0x4'),_0xfeee('0x5'),_0xfeee('0x6'),_0xfeee('0x7'),'bot',_0xfeee('0x8')]],'msg':_0xfeee('0x9')}},'comment':_0xfeee('0x9')},'data1':{'type':Sequelize[_0xfeee('0xa')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xfeee('0xb')},'data3':{'type':Sequelize[_0xfeee('0xa')](0x1000),'comment':_0xfeee('0xc')},'data4':{'type':Sequelize[_0xfeee('0xa')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0xfeee('0xa')]},'data7':{'type':Sequelize[_0xfeee('0xd')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 9706c05..237a2b3 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 _0x5ae0=['reject','update','destroy','then','sendStatus','error','stack','name','body','Action','find','params','catch','rimraf','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','apply'];(function(_0x2fe319,_0x5b32c9){var _0xaf1ab2=function(_0x24db69){while(--_0x24db69){_0x2fe319['push'](_0x2fe319['shift']());}};_0xaf1ab2(++_0x5b32c9);}(_0x5ae0,0xf8));var _0x05ae=function(_0x3d4842,_0xc92a24){_0x3d4842=_0x3d4842-0x0;var _0x2d3c6d=_0x5ae0[_0x3d4842];return _0x2d3c6d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x05ae('0x0'));var zipdir=require(_0x05ae('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05ae('0x2'));var moment=require(_0x05ae('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x05ae('0x4'));var util=require(_0x05ae('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x05ae('0x6'));var ejs=require(_0x05ae('0x7'));var fs=require('fs');var fs_extra=require(_0x05ae('0x8'));var _=require('lodash');var squel=require(_0x05ae('0x9'));var crypto=require(_0x05ae('0xa'));var jsforce=require(_0x05ae('0xb'));var deskjs=require(_0x05ae('0xc'));var toCsv=require(_0x05ae('0x6'));var querystring=require(_0x05ae('0xd'));var Papa=require(_0x05ae('0xe'));var Redis=require(_0x05ae('0xf'));var authService=require(_0x05ae('0x10'));var qs=require(_0x05ae('0x11'));var as=require(_0x05ae('0x12'));var hardwareService=require(_0x05ae('0x13'));var logger=require(_0x05ae('0x14'))(_0x05ae('0x15'));var utils=require(_0x05ae('0x16'));var config=require(_0x05ae('0x17'));var licenseUtil=require(_0x05ae('0x18'));var db=require(_0x05ae('0x19'))['db'];function respondWithStatusCode(_0x38c11e,_0x5b0218){_0x5b0218=_0x5b0218||0xcc;return function(_0x48e02c){if(_0x48e02c){return _0x38c11e['sendStatus'](_0x5b0218);}return _0x38c11e['status'](_0x5b0218)[_0x05ae('0x1a')]();};}function respondWithResult(_0x22fd17,_0x59e280){_0x59e280=_0x59e280||0xc8;return function(_0xd86c16){if(_0xd86c16){return _0x22fd17[_0x05ae('0x1b')](_0x59e280)[_0x05ae('0x1c')](_0xd86c16);}};}function respondWithFilteredResult(_0x329796,_0x3de84b){return function(_0xf8a649){if(_0xf8a649){var _0x566f4d=_0xf8a649[_0x05ae('0x1d')],_0x237a99=_0x3de84b[_0x05ae('0x1e')],_0x38edee=_0x3de84b[_0x05ae('0x1e')]+_0x3de84b[_0x05ae('0x1f')],_0xc1eb63;if(_0x38edee>=_0x566f4d){_0x38edee=_0x566f4d;_0xc1eb63=0xc8;}else{_0xc1eb63=0xce;}_0x329796[_0x05ae('0x1b')](_0xc1eb63);return _0x329796[_0x05ae('0x20')]('Content-Range',_0x237a99+'-'+_0x38edee+'/'+_0x566f4d)[_0x05ae('0x1c')](_0xf8a649);}return null;};}function patchUpdates(_0x17ee83){return function(_0x5a6fe6){try{jsonpatch[_0x05ae('0x21')](_0x5a6fe6,_0x17ee83,!![]);}catch(_0x39f0ce){return BPromise[_0x05ae('0x22')](_0x39f0ce);}return _0x5a6fe6['save']();};}function saveUpdates(_0x37c018,_0x3c23f9){return function(_0x4a2a42){if(_0x4a2a42){return _0x4a2a42[_0x05ae('0x23')](_0x37c018)['then'](function(_0x1e58e3){return _0x1e58e3;});}return null;};}function removeEntity(_0x1241da,_0x2051c0){return function(_0x48de5a){if(_0x48de5a){return _0x48de5a[_0x05ae('0x24')]()[_0x05ae('0x25')](function(){_0x1241da['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39d71c,_0x5ddaab){return function(_0x20df1e){if(!_0x20df1e){_0x39d71c[_0x05ae('0x26')](0x194);}return _0x20df1e;};}function handleError(_0x80e099,_0x5b78f3){_0x5b78f3=_0x5b78f3||0x1f4;return function(_0x5604fd){logger[_0x05ae('0x27')](_0x5604fd[_0x05ae('0x28')]);if(_0x5604fd[_0x05ae('0x29')]){delete _0x5604fd[_0x05ae('0x29')];}_0x80e099[_0x05ae('0x1b')](_0x5b78f3)['send'](_0x5604fd);};}exports[_0x05ae('0x23')]=function(_0x547253,_0xa1bc99){if(_0x547253[_0x05ae('0x2a')]['id']){delete _0x547253['body']['id'];}return db[_0x05ae('0x2b')][_0x05ae('0x2c')]({'where':{'id':_0x547253[_0x05ae('0x2d')]['id']}})[_0x05ae('0x25')](handleEntityNotFound(_0xa1bc99,null))['then'](saveUpdates(_0x547253[_0x05ae('0x2a')],null))[_0x05ae('0x25')](respondWithResult(_0xa1bc99,null))[_0x05ae('0x2e')](handleError(_0xa1bc99,null));};exports['destroy']=function(_0x108bd8,_0x42a645){return db[_0x05ae('0x2b')][_0x05ae('0x2c')]({'where':{'id':_0x108bd8[_0x05ae('0x2d')]['id']}})[_0x05ae('0x25')](handleEntityNotFound(_0x42a645,null))[_0x05ae('0x25')](removeEntity(_0x42a645,null))[_0x05ae('0x2e')](handleError(_0x42a645,null));}; \ No newline at end of file +var _0xcaaf=['offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','find','params','body','catch','Action','eml-format','zip-dir','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xcaaf,0x66));var _0xfcaa=function(_0x71e9d9,_0x4a1711){_0x71e9d9=_0x71e9d9-0x0;var _0x4d59f0=_0xcaaf[_0x71e9d9];return _0x4d59f0;};'use strict';var emlformat=require(_0xfcaa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfcaa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfcaa('0x2'));var BPromise=require(_0xfcaa('0x3'));var Mustache=require('mustache');var util=require(_0xfcaa('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xfcaa('0x5'));var ejs=require(_0xfcaa('0x6'));var fs=require('fs');var fs_extra=require(_0xfcaa('0x7'));var _=require(_0xfcaa('0x8'));var squel=require(_0xfcaa('0x9'));var crypto=require(_0xfcaa('0xa'));var jsforce=require(_0xfcaa('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfcaa('0x5'));var querystring=require('querystring');var Papa=require(_0xfcaa('0xc'));var Redis=require('ioredis');var authService=require(_0xfcaa('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcaa('0xe'));var logger=require('../../config/logger')(_0xfcaa('0xf'));var utils=require(_0xfcaa('0x10'));var config=require(_0xfcaa('0x11'));var licenseUtil=require(_0xfcaa('0x12'));var db=require(_0xfcaa('0x13'))['db'];function respondWithStatusCode(_0x33664f,_0x1f26e3){_0x1f26e3=_0x1f26e3||0xcc;return function(_0xc03e64){if(_0xc03e64){return _0x33664f['sendStatus'](_0x1f26e3);}return _0x33664f[_0xfcaa('0x14')](_0x1f26e3)[_0xfcaa('0x15')]();};}function respondWithResult(_0x129b69,_0x46181e){_0x46181e=_0x46181e||0xc8;return function(_0x521fff){if(_0x521fff){return _0x129b69[_0xfcaa('0x14')](_0x46181e)[_0xfcaa('0x16')](_0x521fff);}};}function respondWithFilteredResult(_0x27ab5c,_0xf49a9b){return function(_0x54f7f5){if(_0x54f7f5){var _0x10e7e7=_0x54f7f5[_0xfcaa('0x17')],_0x2dbc14=_0xf49a9b[_0xfcaa('0x18')],_0x218c64=_0xf49a9b['offset']+_0xf49a9b[_0xfcaa('0x19')],_0x580335;if(_0x218c64>=_0x10e7e7){_0x218c64=_0x10e7e7;_0x580335=0xc8;}else{_0x580335=0xce;}_0x27ab5c['status'](_0x580335);return _0x27ab5c['set'](_0xfcaa('0x1a'),_0x2dbc14+'-'+_0x218c64+'/'+_0x10e7e7)[_0xfcaa('0x16')](_0x54f7f5);}return null;};}function patchUpdates(_0x416132){return function(_0xa4df1){try{jsonpatch[_0xfcaa('0x1b')](_0xa4df1,_0x416132,!![]);}catch(_0x4566e1){return BPromise[_0xfcaa('0x1c')](_0x4566e1);}return _0xa4df1[_0xfcaa('0x1d')]();};}function saveUpdates(_0x1a975f,_0x7aa3eb){return function(_0x55ec08){if(_0x55ec08){return _0x55ec08[_0xfcaa('0x1e')](_0x1a975f)[_0xfcaa('0x1f')](function(_0x233a73){return _0x233a73;});}return null;};}function removeEntity(_0xc7622,_0xcc1c83){return function(_0x4416ed){if(_0x4416ed){return _0x4416ed[_0xfcaa('0x20')]()[_0xfcaa('0x1f')](function(){_0xc7622[_0xfcaa('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x415bce,_0x1526d9){return function(_0x43da7f){if(!_0x43da7f){_0x415bce['sendStatus'](0x194);}return _0x43da7f;};}function handleError(_0x1d8e09,_0x59c206){_0x59c206=_0x59c206||0x1f4;return function(_0x4642bb){logger[_0xfcaa('0x21')](_0x4642bb[_0xfcaa('0x22')]);if(_0x4642bb[_0xfcaa('0x23')]){delete _0x4642bb[_0xfcaa('0x23')];}_0x1d8e09[_0xfcaa('0x14')](_0x59c206)[_0xfcaa('0x24')](_0x4642bb);};}exports[_0xfcaa('0x1e')]=function(_0x3ba17e,_0x55e09a){if(_0x3ba17e['body']['id']){delete _0x3ba17e['body']['id'];}return db['Action'][_0xfcaa('0x25')]({'where':{'id':_0x3ba17e[_0xfcaa('0x26')]['id']}})['then'](handleEntityNotFound(_0x55e09a,null))[_0xfcaa('0x1f')](saveUpdates(_0x3ba17e[_0xfcaa('0x27')],null))['then'](respondWithResult(_0x55e09a,null))[_0xfcaa('0x28')](handleError(_0x55e09a,null));};exports['destroy']=function(_0x4e135a,_0x137877){return db[_0xfcaa('0x29')][_0xfcaa('0x25')]({'where':{'id':_0x4e135a[_0xfcaa('0x26')]['id']}})['then'](handleEntityNotFound(_0x137877,null))[_0xfcaa('0x1f')](removeEntity(_0x137877,null))[_0xfcaa('0x28')](handleError(_0x137877,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 915452c..0e28af0 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 _0xa1ee=['define','Action','tools_actions','util','../../config/logger','api','moment','bluebird','path','rimraf','./action.attributes','exports'];(function(_0x349635,_0x1d4f03){var _0x3f8a08=function(_0x46be12){while(--_0x46be12){_0x349635['push'](_0x349635['shift']());}};_0x3f8a08(++_0x1d4f03);}(_0xa1ee,0x1ef));var _0xea1e=function(_0x3a16d4,_0x23ecda){_0x3a16d4=_0x3a16d4-0x0;var _0x31ea9c=_0xa1ee[_0x3a16d4];return _0x31ea9c;};'use strict';var _=require('lodash');var util=require(_0xea1e('0x0'));var logger=require(_0xea1e('0x1'))(_0xea1e('0x2'));var moment=require(_0xea1e('0x3'));var BPromise=require(_0xea1e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea1e('0x5'));var rimraf=require(_0xea1e('0x6'));var config=require('../../config/environment');var attributes=require(_0xea1e('0x7'));module[_0xea1e('0x8')]=function(_0x5f018b,_0x184344){return _0x5f018b[_0xea1e('0x9')](_0xea1e('0xa'),attributes,{'tableName':_0xea1e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1abe=['path','../../config/environment','exports','define','Action','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x1abe,0x1b2));var _0xe1ab=function(_0x399c5a,_0x2a50a7){_0x399c5a=_0x399c5a-0x0;var _0x2d2aaa=_0x1abe[_0x399c5a];return _0x2d2aaa;};'use strict';var _=require(_0xe1ab('0x0'));var util=require(_0xe1ab('0x1'));var logger=require('../../config/logger')(_0xe1ab('0x2'));var moment=require(_0xe1ab('0x3'));var BPromise=require(_0xe1ab('0x4'));var rp=require(_0xe1ab('0x5'));var fs=require('fs');var path=require(_0xe1ab('0x6'));var rimraf=require('rimraf');var config=require(_0xe1ab('0x7'));var attributes=require('./action.attributes');module[_0xe1ab('0x8')]=function(_0x5c2400,_0x588ea3){return _0x5c2400[_0xe1ab('0x9')](_0xe1ab('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 8d963e1..786887f 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 _0x0713=['Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1ee592,_0x7050c4){var _0x5999f7=function(_0x1d5d3d){while(--_0x1d5d3d){_0x1ee592['push'](_0x1ee592['shift']());}};_0x5999f7(++_0x7050c4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +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(_0xbb9dbf,_0x5dafa4){var _0x30223c=function(_0xaa9ca){while(--_0xaa9ca){_0xbb9dbf['push'](_0xbb9dbf['shift']());}};_0x30223c(++_0x5dafa4);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'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 diff --git a/server/api/action/index.js b/server/api/action/index.js index faeb108..30d95fb 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 _0x6817=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','util','path','connect-timeout','express'];(function(_0x338ce5,_0x122094){var _0x195189=function(_0x41f00b){while(--_0x41f00b){_0x338ce5['push'](_0x338ce5['shift']());}};_0x195189(++_0x122094);}(_0x6817,0xf8));var _0x7681=function(_0x189077,_0x5d9f45){_0x189077=_0x189077-0x0;var _0x190aea=_0x6817[_0x189077];return _0x190aea;};'use strict';var multer=require('multer');var util=require(_0x7681('0x0'));var path=require(_0x7681('0x1'));var timeout=require(_0x7681('0x2'));var express=require(_0x7681('0x3'));var router=express[_0x7681('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7681('0x5'));var interaction=require(_0x7681('0x6'));var config=require(_0x7681('0x7'));var controller=require(_0x7681('0x8'));router[_0x7681('0x9')](_0x7681('0xa'),auth[_0x7681('0xb')](),controller[_0x7681('0xc')]);router[_0x7681('0xd')](_0x7681('0xa'),auth[_0x7681('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf7a8=['../../components/interaction/service','../../config/environment','./action.controller','isAuthenticated','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x83986d,_0x8749f8){var _0x24f41b=function(_0xc93079){while(--_0xc93079){_0x83986d['push'](_0x83986d['shift']());}};_0x24f41b(++_0x8749f8);}(_0xf7a8,0x157));var _0x8f7a=function(_0x20142a,_0x10fb3c){_0x20142a=_0x20142a-0x0;var _0x2026e1=_0xf7a8[_0x20142a];return _0x2026e1;};'use strict';var multer=require(_0x8f7a('0x0'));var util=require(_0x8f7a('0x1'));var path=require(_0x8f7a('0x2'));var timeout=require('connect-timeout');var express=require(_0x8f7a('0x3'));var router=express[_0x8f7a('0x4')]();var fs_extra=require(_0x8f7a('0x5'));var auth=require(_0x8f7a('0x6'));var interaction=require(_0x8f7a('0x7'));var config=require(_0x8f7a('0x8'));var controller=require(_0x8f7a('0x9'));router['put']('/:id',auth[_0x8f7a('0xa')](),controller[_0x8f7a('0xb')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8f7a('0xc')]);module[_0x8f7a('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 2637027..936773b 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 _0xbabb=['TEXT','exports','STRING'];(function(_0x4e7aa9,_0x10406e){var _0x202fa7=function(_0x42c6cf){while(--_0x42c6cf){_0x4e7aa9['push'](_0x4e7aa9['shift']());}};_0x202fa7(++_0x10406e);}(_0xbabb,0x1a2));var _0xbbab=function(_0x39039b,_0x5e0a86){_0x39039b=_0x39039b-0x0;var _0x260d03=_0xbabb[_0x39039b];return _0x260d03;};'use strict';var Sequelize=require('sequelize');module[_0xbbab('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xbbab('0x1')]},'parent':{'type':Sequelize[_0xbbab('0x1')]},'table':{'type':Sequelize[_0xbbab('0x1')]},'conditions':{'type':Sequelize[_0xbbab('0x2')]},'joins':{'type':Sequelize[_0xbbab('0x2')]}}; \ No newline at end of file +var _0x5b10=['exports','STRING','TEXT','sequelize'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x5b10,0x87));var _0x05b1=function(_0x521555,_0x2a40ab){_0x521555=_0x521555-0x0;var _0x2134b6=_0x5b10[_0x521555];return _0x2134b6;};'use strict';var Sequelize=require(_0x05b1('0x0'));module[_0x05b1('0x1')]={'name':{'type':Sequelize[_0x05b1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x05b1('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x05b1('0x2')]},'conditions':{'type':Sequelize[_0x05b1('0x3')]},'joins':{'type':Sequelize[_0x05b1('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index f063713..1bba3dd 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 _0x5a54=['AnalyticMetric','keyBy','select','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','order','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','cross_join','SUM(%s)','DATE(%s)','Sequelize','output','web','fullPath','%s-%s.%s','randomstring','generate','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','../../files/reports','savename','countTable','COUNT(*)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','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/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','end','stack','name','send','AnalyticCustomReport','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x5a54,0xd9));var _0x45a5=function(_0x45c81f,_0x25461f){_0x45c81f=_0x45c81f-0x0;var _0x544b41=_0x5a54[_0x45c81f];return _0x544b41;};'use strict';var emlformat=require(_0x45a5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x45a5('0x1'));var jsonpatch=require(_0x45a5('0x2'));var rp=require(_0x45a5('0x3'));var moment=require(_0x45a5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x45a5('0x5'));var sox=require(_0x45a5('0x6'));var csv=require('to-csv');var ejs=require(_0x45a5('0x7'));var fs=require('fs');var fs_extra=require(_0x45a5('0x8'));var _=require(_0x45a5('0x9'));var squel=require(_0x45a5('0xa'));var crypto=require(_0x45a5('0xb'));var jsforce=require(_0x45a5('0xc'));var deskjs=require(_0x45a5('0xd'));var toCsv=require(_0x45a5('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x45a5('0xf'));var authService=require(_0x45a5('0x10'));var qs=require(_0x45a5('0x11'));var as=require(_0x45a5('0x12'));var hardwareService=require(_0x45a5('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x45a5('0x14'));var config=require(_0x45a5('0x15'));var licenseUtil=require(_0x45a5('0x16'));var db=require(_0x45a5('0x17'))['db'];var dbH=require(_0x45a5('0x17'))[_0x45a5('0x18')];function respondWithStatusCode(_0x4b64b3,_0x3ee3e3){_0x3ee3e3=_0x3ee3e3||0xcc;return function(_0x24c05c){if(_0x24c05c){return _0x4b64b3[_0x45a5('0x19')](_0x3ee3e3);}return _0x4b64b3[_0x45a5('0x1a')](_0x3ee3e3)['end']();};}function respondWithResult(_0x308798,_0x2f8b5c){_0x2f8b5c=_0x2f8b5c||0xc8;return function(_0x106a65){if(_0x106a65){return _0x308798['status'](_0x2f8b5c)['json'](_0x106a65);}};}function respondWithFilteredResult(_0x4d159d,_0x30ba48){return function(_0x26057e){if(_0x26057e){var _0x5dbe94=_0x26057e[_0x45a5('0x1b')],_0x406e87=_0x30ba48[_0x45a5('0x1c')],_0x15c08a=_0x30ba48[_0x45a5('0x1c')]+_0x30ba48[_0x45a5('0x1d')],_0x30d422;if(_0x15c08a>=_0x5dbe94){_0x15c08a=_0x5dbe94;_0x30d422=0xc8;}else{_0x30d422=0xce;}_0x4d159d[_0x45a5('0x1a')](_0x30d422);return _0x4d159d['set'](_0x45a5('0x1e'),_0x406e87+'-'+_0x15c08a+'/'+_0x5dbe94)['json'](_0x26057e);}return null;};}function patchUpdates(_0x117eaf){return function(_0xd43c48){try{jsonpatch[_0x45a5('0x1f')](_0xd43c48,_0x117eaf,!![]);}catch(_0x3a2929){return BPromise[_0x45a5('0x20')](_0x3a2929);}return _0xd43c48[_0x45a5('0x21')]();};}function saveUpdates(_0x5c2dbe,_0xbaa0aa){return function(_0x2e4000){if(_0x2e4000){return _0x2e4000[_0x45a5('0x22')](_0x5c2dbe)[_0x45a5('0x23')](function(_0x41e741){return _0x41e741;});}return null;};}function removeEntity(_0x185fa7,_0x5e4c9d){return function(_0x5a94d3){if(_0x5a94d3){return _0x5a94d3[_0x45a5('0x24')]()[_0x45a5('0x23')](function(){var _0x518ab3=_0x5a94d3[_0x45a5('0x25')]({'plain':!![]});var _0x16d4d0=_0x45a5('0x26');return db[_0x45a5('0x27')][_0x45a5('0x24')]({'where':{'type':_0x16d4d0,'resourceId':_0x518ab3['id']}})[_0x45a5('0x23')](function(){return _0x5a94d3;});})['then'](function(){_0x185fa7[_0x45a5('0x1a')](0xcc)[_0x45a5('0x28')]();});}};}function handleEntityNotFound(_0x41d266,_0x52dc6e){return function(_0x4946c9){if(!_0x4946c9){_0x41d266[_0x45a5('0x19')](0x194);}return _0x4946c9;};}function handleError(_0x1350bc,_0x270fa5){_0x270fa5=_0x270fa5||0x1f4;return function(_0x5d9752){logger['error'](_0x5d9752[_0x45a5('0x29')]);if(_0x5d9752[_0x45a5('0x2a')]){delete _0x5d9752[_0x45a5('0x2a')];}_0x1350bc['status'](_0x270fa5)[_0x45a5('0x2b')](_0x5d9752);};}exports['index']=function(_0x201754,_0x3dbab9){var _0xd8a2b9={},_0x5b7682={},_0x53b30b={'count':0x0,'rows':[]};var _0xb2b1b4=_['map'](db[_0x45a5('0x2c')]['rawAttributes'],function(_0x1b322b){return{'name':_0x1b322b['fieldName'],'type':_0x1b322b['type'][_0x45a5('0x2d')]};});_0x5b7682['model']=_['map'](_0xb2b1b4,'name');_0x5b7682[_0x45a5('0x2e')]=_[_0x45a5('0x2f')](_0x201754['query']);_0x5b7682[_0x45a5('0x30')]=_[_0x45a5('0x31')](_0x5b7682[_0x45a5('0x32')],_0x5b7682[_0x45a5('0x2e')]);_0xd8a2b9[_0x45a5('0x33')]=_[_0x45a5('0x31')](_0x5b7682[_0x45a5('0x32')],qs[_0x45a5('0x34')](_0x201754[_0x45a5('0x2e')]['fields']));_0xd8a2b9[_0x45a5('0x33')]=_0xd8a2b9[_0x45a5('0x33')][_0x45a5('0x35')]?_0xd8a2b9['attributes']:_0x5b7682['model'];if(!_0x201754[_0x45a5('0x2e')][_0x45a5('0x36')]('nolimit')){_0xd8a2b9['limit']=qs[_0x45a5('0x1d')](_0x201754[_0x45a5('0x2e')][_0x45a5('0x1d')]);_0xd8a2b9[_0x45a5('0x1c')]=qs['offset'](_0x201754['query']['offset']);}_0xd8a2b9['order']=qs[_0x45a5('0x37')](_0x201754[_0x45a5('0x2e')][_0x45a5('0x37')]);_0xd8a2b9[_0x45a5('0x38')]=qs[_0x45a5('0x30')](_[_0x45a5('0x39')](_0x201754['query'],_0x5b7682[_0x45a5('0x30')]),_0xb2b1b4);if(_0x201754[_0x45a5('0x2e')][_0x45a5('0x3a')]){_0xd8a2b9[_0x45a5('0x38')]=_[_0x45a5('0x3b')](_0xd8a2b9[_0x45a5('0x38')],{'$or':_[_0x45a5('0x3c')](_0xb2b1b4,function(_0x29491e){if(_0x29491e[_0x45a5('0x3d')]!==_0x45a5('0x3e')){var _0x510982={};_0x510982[_0x29491e[_0x45a5('0x2a')]]={'$like':'%'+_0x201754[_0x45a5('0x2e')][_0x45a5('0x3a')]+'%'};return _0x510982;}})});}_0xd8a2b9=_[_0x45a5('0x3b')]({},_0xd8a2b9,_0x201754[_0x45a5('0x3f')]);var _0x577ca8={'where':_0xd8a2b9[_0x45a5('0x38')]};return db[_0x45a5('0x2c')]['count'](_0x577ca8)[_0x45a5('0x23')](function(_0x15045b){_0x53b30b[_0x45a5('0x1b')]=_0x15045b;if(_0x201754[_0x45a5('0x2e')][_0x45a5('0x40')]){_0xd8a2b9[_0x45a5('0x41')]=[{'all':!![]}];}return db[_0x45a5('0x2c')][_0x45a5('0x42')](_0xd8a2b9);})[_0x45a5('0x23')](function(_0x3bd8c2){_0x53b30b[_0x45a5('0x43')]=_0x3bd8c2;return _0x53b30b;})['then'](respondWithFilteredResult(_0x3dbab9,_0xd8a2b9))[_0x45a5('0x44')](handleError(_0x3dbab9,null));};exports[_0x45a5('0x45')]=function(_0x3d6410,_0x4b879f){var _0x4b5a13={'raw':![],'where':{'id':_0x3d6410[_0x45a5('0x46')]['id']}},_0x64bd53={};_0x64bd53[_0x45a5('0x32')]=_[_0x45a5('0x2f')](db[_0x45a5('0x2c')][_0x45a5('0x47')]);_0x64bd53[_0x45a5('0x2e')]=_[_0x45a5('0x2f')](_0x3d6410['query']);_0x64bd53[_0x45a5('0x30')]=_[_0x45a5('0x31')](_0x64bd53[_0x45a5('0x32')],_0x64bd53[_0x45a5('0x2e')]);_0x4b5a13[_0x45a5('0x33')]=_[_0x45a5('0x31')](_0x64bd53[_0x45a5('0x32')],qs[_0x45a5('0x34')](_0x3d6410[_0x45a5('0x2e')][_0x45a5('0x34')]));_0x4b5a13[_0x45a5('0x33')]=_0x4b5a13[_0x45a5('0x33')]['length']?_0x4b5a13[_0x45a5('0x33')]:_0x64bd53[_0x45a5('0x32')];if(_0x3d6410['query'][_0x45a5('0x40')]){_0x4b5a13['include']=[{'all':!![]}];}_0x4b5a13=_[_0x45a5('0x3b')]({},_0x4b5a13,_0x3d6410[_0x45a5('0x3f')]);return db['AnalyticCustomReport']['find'](_0x4b5a13)['then'](handleEntityNotFound(_0x4b879f,null))[_0x45a5('0x23')](respondWithResult(_0x4b879f,null))[_0x45a5('0x44')](handleError(_0x4b879f,null));};exports[_0x45a5('0x48')]=function(_0x453bde,_0x176712){return db['AnalyticCustomReport']['create'](_0x453bde['body'],{})[_0x45a5('0x23')](function(_0x7e6caa){var _0x2729d4=_0x453bde[_0x45a5('0x49')][_0x45a5('0x25')]({'plain':!![]});if(!_0x2729d4)throw new Error(_0x45a5('0x4a'));if(_0x2729d4[_0x45a5('0x4b')]===_0x45a5('0x49')){var _0x2feb52=_0x7e6caa[_0x45a5('0x25')]({'plain':!![]});var _0x3ff055=_0x45a5('0x4c');return db[_0x45a5('0x4d')]['find']({'where':{'name':_0x3ff055,'userProfileId':_0x2729d4[_0x45a5('0x4e')]},'raw':!![]})[_0x45a5('0x23')](function(_0x51f31e){if(_0x51f31e&&_0x51f31e[_0x45a5('0x4f')]===0x0){return db[_0x45a5('0x27')][_0x45a5('0x48')]({'name':_0x2feb52[_0x45a5('0x2a')],'resourceId':_0x2feb52['id'],'type':_0x45a5('0x26'),'sectionId':_0x51f31e['id']},{})[_0x45a5('0x23')](function(){return _0x7e6caa;});}else{return _0x7e6caa;}})[_0x45a5('0x44')](function(_0x1b2af9){logger['error'](_0x45a5('0x50'),_0x1b2af9);throw _0x1b2af9;});}return _0x7e6caa;})[_0x45a5('0x23')](respondWithResult(_0x176712,0xc9))[_0x45a5('0x44')](handleError(_0x176712,null));};exports[_0x45a5('0x22')]=function(_0x1b8ebf,_0xb7ea14){if(_0x1b8ebf[_0x45a5('0x51')]['id']){delete _0x1b8ebf[_0x45a5('0x51')]['id'];}return db[_0x45a5('0x2c')][_0x45a5('0x52')]({'where':{'id':_0x1b8ebf[_0x45a5('0x46')]['id']}})[_0x45a5('0x23')](handleEntityNotFound(_0xb7ea14,null))['then'](saveUpdates(_0x1b8ebf[_0x45a5('0x51')],null))[_0x45a5('0x23')](respondWithResult(_0xb7ea14,null))[_0x45a5('0x44')](handleError(_0xb7ea14,null));};exports[_0x45a5('0x24')]=function(_0x2efb7a,_0x40f503){return db['AnalyticCustomReport'][_0x45a5('0x52')]({'where':{'id':_0x2efb7a[_0x45a5('0x46')]['id']}})[_0x45a5('0x23')](handleEntityNotFound(_0x40f503,null))[_0x45a5('0x23')](removeEntity(_0x40f503,null))['catch'](handleError(_0x40f503,null));};exports['preview']=function(_0x4fe190,_0x167428){var _0x1339c3=0xa;var _0x429f4c=[_0x45a5('0x53'),'left_join',_0x45a5('0x54'),'cross_join'];var _0x50ca7e={'SUM':'SUM(%s)','COUNT':_0x45a5('0x55'),'COUNT DISTINCT':_0x45a5('0x56'),'MAX':_0x45a5('0x57'),'MIN':_0x45a5('0x58'),'AVG':_0x45a5('0x59'),'GROUP_CONCAT':_0x45a5('0x5a'),'GROUP_CONCAT ASC':_0x45a5('0x5b'),'GROUP_CONCAT DESC':_0x45a5('0x5c')};var _0x358859={'SEC_TO_TIME':_0x45a5('0x5d'),'DATE':'DATE(%s)','HOUR':_0x45a5('0x5e'),'ROUND':_0x45a5('0x5f'),'UNIX_TIMESTAMP':_0x45a5('0x60')};var _0x2dc233=function(_0x594639){return!_[_0x45a5('0x61')]([_0x45a5('0x62'),_0x45a5('0x63'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x594639);};var _0x6fde26=function(_0x3a8e8f){if(!_0x3a8e8f||!_0x3a8e8f[_0x45a5('0x64')][_0x45a5('0x35')]){return'';}for(var _0x1c6633='(',_0x4b68ce=0x0;_0x4b68ce<_0x3a8e8f[_0x45a5('0x64')][_0x45a5('0x35')];_0x4b68ce+=0x1){_0x4b68ce>0x0&&(_0x1c6633+='\x20'+_0x3a8e8f[_0x45a5('0x65')]+'\x20');_0x1c6633+=_0x3a8e8f[_0x45a5('0x64')][_0x4b68ce][_0x45a5('0x66')]?_0x6fde26(_0x3a8e8f['rules'][_0x4b68ce][_0x45a5('0x66')]):_0x3a8e8f['rules'][_0x4b68ce][_0x45a5('0x67')]+'\x20'+_0x3a8e8f['rules'][_0x4b68ce][_0x45a5('0x68')]+(_0x2dc233(_0x3a8e8f['rules'][_0x4b68ce][_0x45a5('0x68')])?'\x20'+_0x3a8e8f['rules'][_0x4b68ce][_0x45a5('0x69')]:'');}return _0x1c6633+')';};var _0x380bad={'where':{'id':_0x4fe190[_0x45a5('0x46')]['id']}},_0x4d9d02,_0xcee4f2,_0x14f353,_0x1d6a6e,_0x2d6831;_0x380bad=_[_0x45a5('0x3b')]({},_0x380bad,_0x4fe190[_0x45a5('0x3f')]);return db[_0x45a5('0x2c')][_0x45a5('0x52')](_0x380bad)[_0x45a5('0x23')](function(_0xbafa56){if(_0xbafa56){_0x4d9d02=_0xbafa56;return _0xbafa56[_0x45a5('0x6a')]();}return null;})[_0x45a5('0x23')](function(_0x36cecf){if(_0x36cecf){if(!_0x36cecf[_0x45a5('0x35')]){throw new db['Sequelize'][(_0x45a5('0x6b'))](_0x45a5('0x6c'),0x193);}_0xcee4f2=_0x36cecf;return db[_0x45a5('0x6d')][_0x45a5('0x42')]({'raw':!![]});}return null;})['then'](function(_0x3d12c2){if(_0x3d12c2){_0x14f353=_[_0x45a5('0x6e')](_0x3d12c2,'id');var _0x2e1cf8;var _0x1e9c1b=squel[_0x45a5('0x6f')]();_0x1e9c1b[_0x45a5('0x70')](_0x4d9d02[_0x45a5('0x71')]);for(var _0x22ca15=0x0;_0x22ca15<_0xcee4f2[_0x45a5('0x35')];_0x22ca15+=0x1){_0x2e1cf8=_0xcee4f2[_0x22ca15][_0x45a5('0x72')]?_0x14f353[_0xcee4f2[_0x22ca15][_0x45a5('0x72')]][_0x45a5('0x73')]:_0xcee4f2[_0x22ca15][_0x45a5('0x67')];_0x2e1cf8=_0xcee4f2[_0x22ca15]['function']?_[_0x45a5('0x74')](_0x50ca7e[_0xcee4f2[_0x22ca15][_0x45a5('0x75')]],'%s',_0x2e1cf8):_0x2e1cf8;_0x2e1cf8=_0xcee4f2[_0x22ca15]['format']?_[_0x45a5('0x74')](_0x358859[_0xcee4f2[_0x22ca15][_0x45a5('0x76')]],'%s',_0x2e1cf8):_0x2e1cf8;if(_0xcee4f2[_0x22ca15][_0x45a5('0x77')]){_0x1e9c1b[_0x45a5('0x66')](_0x2e1cf8);}_0xcee4f2[_0x22ca15][_0x45a5('0x78')]&&_0x1e9c1b[_0x45a5('0x79')](_0x2e1cf8,_0xcee4f2[_0x22ca15][_0x45a5('0x78')]===_0x45a5('0x7a')?![]:!![]);_0x1e9c1b['field'](_0x2e1cf8,_0xcee4f2[_0x22ca15][_0x45a5('0x7b')]||_0x2e1cf8);}if(_0x4d9d02['joins']){_0x4d9d02[_0x45a5('0x7c')]=JSON['parse'](_0x4d9d02[_0x45a5('0x7c')]);for(var _0x1731a8=0x0;_0x1731a8<_0x4d9d02[_0x45a5('0x7c')]['length'];_0x1731a8+=0x1){if(_0x4d9d02[_0x45a5('0x7c')][_0x1731a8][_0x45a5('0x3d')]&&_[_0x45a5('0x61')](_0x429f4c,_0x4d9d02['joins'][_0x1731a8]['type'])&&_0x4d9d02['joins'][_0x1731a8][_0x45a5('0x7d')]&&_0x4d9d02[_0x45a5('0x7c')][_0x1731a8][_0x45a5('0x7e')]&&_0x4d9d02[_0x45a5('0x7c')][_0x1731a8][_0x45a5('0x7f')]){_0x1e9c1b[_0x4d9d02[_0x45a5('0x7c')][_0x1731a8]['type']](_0x4d9d02[_0x45a5('0x7c')][_0x1731a8][_0x45a5('0x7e')],null,util['format'](_0x45a5('0x80'),_0x4d9d02[_0x45a5('0x71')],_0x4d9d02[_0x45a5('0x7c')][_0x1731a8][_0x45a5('0x7d')],_0x4d9d02[_0x45a5('0x7c')][_0x1731a8][_0x45a5('0x7e')],_0x4d9d02[_0x45a5('0x7c')][_0x1731a8]['foreignKey']));}}}if(_0x4d9d02[_0x45a5('0x81')]){_0x4d9d02[_0x45a5('0x81')]=JSON[_0x45a5('0x82')](_0x4d9d02['conditions']);_0x1e9c1b[_0x45a5('0x38')](_0x6fde26(_0x4d9d02[_0x45a5('0x81')][_0x45a5('0x66')]));}_0x2d6831=_0x1e9c1b[_0x45a5('0x83')]();_0x1e9c1b[_0x45a5('0x1d')](_0x1339c3);_0x1e9c1b[_0x45a5('0x1c')](0x0);logger[_0x45a5('0x84')](_0x45a5('0x85'),_0x1e9c1b[_0x45a5('0x86')]());return dbH[_0x45a5('0x87')][_0x45a5('0x2e')](_0x1e9c1b[_0x45a5('0x86')](),{'type':dbH[_0x45a5('0x87')][_0x45a5('0x88')][_0x45a5('0x89')]});}})['then'](respondWithResult(_0x167428,null))['catch'](handleError(_0x167428,null));};function runReport(_0xec59e2,_0x1533b0,_0x17d8df){var _0x2bd895=_0x1533b0['name'];var _0x17f088=0xa;var _0xfc2b71=[_0x45a5('0x53'),_0x45a5('0x8a'),_0x45a5('0x54'),_0x45a5('0x8b')];var _0xa0cd9d={'SUM':_0x45a5('0x8c'),'COUNT':_0x45a5('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x45a5('0x57'),'MIN':_0x45a5('0x58'),'AVG':_0x45a5('0x59'),'GROUP_CONCAT':_0x45a5('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x45a5('0x5c')};var _0x4e83dd={'SEC_TO_TIME':_0x45a5('0x5d'),'DATE':_0x45a5('0x8d'),'HOUR':_0x45a5('0x5e'),'ROUND':_0x45a5('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1ccfd6=function(_0xe05883){return!_['includes'](['IS\x20NULL',_0x45a5('0x63'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xe05883);};var _0x28a7ef=function(_0x5e4069){if(!_0x5e4069||!_0x5e4069[_0x45a5('0x64')][_0x45a5('0x35')]){return'';}for(var _0x5aa395='(',_0x1e523b=0x0;_0x1e523b<_0x5e4069['rules'][_0x45a5('0x35')];_0x1e523b+=0x1){_0x1e523b>0x0&&(_0x5aa395+='\x20'+_0x5e4069[_0x45a5('0x65')]+'\x20');_0x5aa395+=_0x5e4069[_0x45a5('0x64')][_0x1e523b][_0x45a5('0x66')]?_0x28a7ef(_0x5e4069[_0x45a5('0x64')][_0x1e523b][_0x45a5('0x66')]):_0x5e4069[_0x45a5('0x64')][_0x1e523b][_0x45a5('0x67')]+'\x20'+_0x5e4069[_0x45a5('0x64')][_0x1e523b][_0x45a5('0x68')]+(_0x1ccfd6(_0x5e4069[_0x45a5('0x64')][_0x1e523b][_0x45a5('0x68')])?'\x20'+_0x5e4069['rules'][_0x1e523b]['value']:'');}return _0x5aa395+')';};var _0x1b4c1a={'where':{'id':_0xec59e2['id']}},_0x5f52d5,_0x178c9a,_0x1d4fa6,_0x153221,_0x189893;_0x1b4c1a=_[_0x45a5('0x3b')]({},_0x1b4c1a,_0x17d8df);return db['AnalyticCustomReport']['find'](_0x1b4c1a)[_0x45a5('0x23')](function(_0x3132f5){if(_0x3132f5){_0x5f52d5=_0x3132f5;return _0x3132f5[_0x45a5('0x6a')]();}return null;})[_0x45a5('0x23')](function(_0x34651c){if(_0x34651c){if(!_0x34651c[_0x45a5('0x35')]){throw new db[(_0x45a5('0x8e'))][(_0x45a5('0x6b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x178c9a=_0x34651c;return db[_0x45a5('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x45a5('0x23')](function(_0x34050f){if(_0x34050f){_0x1d4fa6=_[_0x45a5('0x6e')](_0x34050f,'id');var _0x3922ec;var _0x3d8ea6=squel[_0x45a5('0x6f')]();_0x3d8ea6[_0x45a5('0x70')](_0x5f52d5['table']);for(var _0x5cb1c1=0x0;_0x5cb1c1<_0x178c9a[_0x45a5('0x35')];_0x5cb1c1+=0x1){_0x3922ec=_0x178c9a[_0x5cb1c1]['MetricId']?_0x1d4fa6[_0x178c9a[_0x5cb1c1]['MetricId']][_0x45a5('0x73')]:_0x178c9a[_0x5cb1c1][_0x45a5('0x67')];_0x3922ec=_0x178c9a[_0x5cb1c1][_0x45a5('0x75')]?_[_0x45a5('0x74')](_0xa0cd9d[_0x178c9a[_0x5cb1c1][_0x45a5('0x75')]],'%s',_0x3922ec):_0x3922ec;_0x3922ec=_0x178c9a[_0x5cb1c1][_0x45a5('0x76')]?_['replace'](_0x4e83dd[_0x178c9a[_0x5cb1c1][_0x45a5('0x76')]],'%s',_0x3922ec):_0x3922ec;if(_0x178c9a[_0x5cb1c1][_0x45a5('0x77')]){_0x3d8ea6[_0x45a5('0x66')](_0x3922ec);}_0x178c9a[_0x5cb1c1][_0x45a5('0x78')]&&_0x3d8ea6[_0x45a5('0x79')](_0x3922ec,_0x178c9a[_0x5cb1c1][_0x45a5('0x78')]===_0x45a5('0x7a')?![]:!![]);_0x3d8ea6['field'](_0x3922ec,_0x178c9a[_0x5cb1c1][_0x45a5('0x7b')]||_0x3922ec);}if(_0x5f52d5[_0x45a5('0x7c')]){_0x5f52d5['joins']=JSON[_0x45a5('0x82')](_0x5f52d5[_0x45a5('0x7c')]);for(var _0x2c44c5=0x0;_0x2c44c5<_0x5f52d5[_0x45a5('0x7c')][_0x45a5('0x35')];_0x2c44c5+=0x1){if(_0x5f52d5[_0x45a5('0x7c')][_0x2c44c5][_0x45a5('0x3d')]&&_[_0x45a5('0x61')](_0xfc2b71,_0x5f52d5[_0x45a5('0x7c')][_0x2c44c5][_0x45a5('0x3d')])&&_0x5f52d5[_0x45a5('0x7c')][_0x2c44c5]['parentKey']&&_0x5f52d5[_0x45a5('0x7c')][_0x2c44c5][_0x45a5('0x7e')]&&_0x5f52d5[_0x45a5('0x7c')][_0x2c44c5][_0x45a5('0x7f')]){_0x3d8ea6[_0x5f52d5[_0x45a5('0x7c')][_0x2c44c5][_0x45a5('0x3d')]](_0x5f52d5[_0x45a5('0x7c')][_0x2c44c5][_0x45a5('0x7e')],null,util[_0x45a5('0x76')]('%s.%s\x20=\x20%s.%s',_0x5f52d5[_0x45a5('0x71')],_0x5f52d5[_0x45a5('0x7c')][_0x2c44c5][_0x45a5('0x7d')],_0x5f52d5[_0x45a5('0x7c')][_0x2c44c5][_0x45a5('0x7e')],_0x5f52d5[_0x45a5('0x7c')][_0x2c44c5][_0x45a5('0x7f')]));}}}if(_0x5f52d5[_0x45a5('0x81')]){_0x5f52d5['conditions']=JSON['parse'](_0x5f52d5[_0x45a5('0x81')]);_0x3d8ea6[_0x45a5('0x38')](_0x28a7ef(_0x5f52d5[_0x45a5('0x81')][_0x45a5('0x66')]));}_0x189893=_0x3d8ea6[_0x45a5('0x83')]();_0x3d8ea6[_0x45a5('0x1d')](_0x17f088);_0x3d8ea6[_0x45a5('0x1c')](0x0);return;}})['then'](function(){if(_0x1533b0[_0x45a5('0x8f')]===_0x45a5('0x90')){return null;}var _0x2b8976=_[_0x45a5('0x3b')](_0x1533b0,{'name':_0x1533b0[_0x45a5('0x91')]||_0x1533b0[_0x45a5('0x2a')]||_0x5f52d5['name'],'basename':_0x2bd895,'savename':util[_0x45a5('0x76')](_0x45a5('0x92'),_0x1533b0['name']||_0x5f52d5[_0x45a5('0x2a')],require(_0x45a5('0x93'))[_0x45a5('0x94')](0x4),_0x1533b0['output']||'csv'),'reportId':_0x5f52d5['id'],'reportType':_0x45a5('0x95')});return db[_0x45a5('0x96')][_0x45a5('0x48')](_0x2b8976,{'raw':!![]});})[_0x45a5('0x23')](function(_0x4800b3){if(_0x5f52d5['table']===_0x45a5('0x97')){_0x189893[_0x45a5('0x38')](_0x5f52d5[_0x45a5('0x71')]+_0x45a5('0x98'),_0x1533b0[_0x45a5('0x99')],_0x1533b0['endDate']);}else{_0x189893[_0x45a5('0x38')](_0x5f52d5['table']+_0x45a5('0x9a'),_0x1533b0[_0x45a5('0x99')],_0x1533b0[_0x45a5('0x9b')]);}if(_0x4800b3){logger['info'](_0x45a5('0x9c'),_0x189893[_0x45a5('0x86')]());require('child_process')['fork'](path[_0x45a5('0x53')](__dirname,'../../components/export/',_0x4800b3[_0x45a5('0x8f')]),[_0x4800b3['id'],_0x189893[_0x45a5('0x86')](),path[_0x45a5('0x53')](__dirname,_0x45a5('0x9d'),_0x4800b3[_0x45a5('0x9e')]),_0x2bd895]);return _0x4800b3;}else{var _0x5ae384=squel[_0x45a5('0x6f')]();_0x5ae384['from']('('+_0x189893[_0x45a5('0x86')]()+')',_0x45a5('0x9f'));_0x5ae384[_0x45a5('0x67')](_0x45a5('0xa0'),'count');_0x189893[_0x45a5('0x1d')](_0x1533b0['limit']||_0x17f088);_0x189893[_0x45a5('0x1c')](_0x1533b0[_0x45a5('0x1c')]||0x0);return dbH[_0x45a5('0x87')]['query'](_0x5ae384[_0x45a5('0x86')](),{'type':dbH[_0x45a5('0x87')]['QueryTypes'][_0x45a5('0x89')]})[_0x45a5('0x23')](function(_0x4e5a2e){if(!_0x4e5a2e[_0x45a5('0x35')]){_0x153221=0x0;}else{_0x153221=_0x4e5a2e[0x0][_0x45a5('0x1b')]||0x0;}return dbH[_0x45a5('0x87')][_0x45a5('0x2e')](_0x189893[_0x45a5('0x86')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0x45a5('0x23')](function(_0x5bf5e9){return{'rows':_0x5bf5e9||[],'count':_0x153221};});}});}exports['run']=function(_0x199070,_0x4b461c){return runReport(_0x199070[_0x45a5('0x46')],_0x199070['query'],_0x199070['options'])[_0x45a5('0x23')](respondWithResult(_0x4b461c,null))[_0x45a5('0x44')](handleError(_0x4b461c,null));};exports['runReport']=runReport;exports[_0x45a5('0x2e')]=function(_0x29e899,_0x4e630a){var _0x3060d1=0xa;var _0x2ac664=['join','left_join',_0x45a5('0x54'),'cross_join'];var _0x56c2d1={'SUM':_0x45a5('0x8c'),'COUNT':_0x45a5('0x55'),'COUNT DISTINCT':_0x45a5('0x56'),'MAX':_0x45a5('0x57'),'MIN':'MIN(%s)','AVG':_0x45a5('0x59'),'GROUP_CONCAT':_0x45a5('0x5a'),'GROUP_CONCAT ASC':_0x45a5('0x5b'),'GROUP_CONCAT DESC':_0x45a5('0x5c')};var _0x3b5394={'SEC_TO_TIME':_0x45a5('0x5d'),'DATE':_0x45a5('0x8d'),'HOUR':_0x45a5('0x5e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x45a5('0x60')};var _0x42aa2c=function(_0x5696c0){return!_[_0x45a5('0x61')]([_0x45a5('0x62'),'IS\x20NOT\x20NULL',_0x45a5('0xa1'),_0x45a5('0xa2')],_0x5696c0);};var _0x356561=function(_0x1bc2dc){if(!_0x1bc2dc||!_0x1bc2dc[_0x45a5('0x64')][_0x45a5('0x35')]){return'';}for(var _0x337272='(',_0x335a66=0x0;_0x335a66<_0x1bc2dc[_0x45a5('0x64')][_0x45a5('0x35')];_0x335a66+=0x1){_0x335a66>0x0&&(_0x337272+='\x20'+_0x1bc2dc[_0x45a5('0x65')]+'\x20');_0x337272+=_0x1bc2dc[_0x45a5('0x64')][_0x335a66][_0x45a5('0x66')]?_0x356561(_0x1bc2dc[_0x45a5('0x64')][_0x335a66][_0x45a5('0x66')]):_0x1bc2dc['rules'][_0x335a66]['field']+'\x20'+_0x1bc2dc['rules'][_0x335a66]['condition']+(_0x42aa2c(_0x1bc2dc[_0x45a5('0x64')][_0x335a66][_0x45a5('0x68')])?'\x20'+_0x1bc2dc[_0x45a5('0x64')][_0x335a66][_0x45a5('0x69')]:'');}return _0x337272+')';};var _0x1c7fbe={'where':{'id':_0x29e899[_0x45a5('0x46')]['id']}},_0x2e5651,_0x808186,_0x481085,_0x54dc5a,_0x585785;_0x1c7fbe=_['merge']({},_0x1c7fbe,_0x29e899[_0x45a5('0x3f')]);return db['AnalyticCustomReport'][_0x45a5('0x52')](_0x1c7fbe)[_0x45a5('0x23')](function(_0x44b5a9){if(_0x44b5a9){_0x2e5651=_0x44b5a9;return _0x44b5a9[_0x45a5('0x6a')]();}return null;})[_0x45a5('0x23')](function(_0x1a1fbf){if(_0x1a1fbf){if(!_0x1a1fbf[_0x45a5('0x35')]){throw new db[(_0x45a5('0x8e'))][(_0x45a5('0x6b'))](_0x45a5('0x6c'),0x193);}_0x808186=_0x1a1fbf;return db[_0x45a5('0x6d')][_0x45a5('0x42')]({'raw':!![]});}return null;})[_0x45a5('0x23')](function(_0x4e398a){if(_0x4e398a){_0x481085=_[_0x45a5('0x6e')](_0x4e398a,'id');var _0xbae0a2;var _0xbde6e=squel['select']();_0xbde6e['from'](_0x2e5651[_0x45a5('0x71')]);for(var _0x4576fc=0x0;_0x4576fc<_0x808186[_0x45a5('0x35')];_0x4576fc+=0x1){_0xbae0a2=_0x808186[_0x4576fc][_0x45a5('0x72')]?_0x481085[_0x808186[_0x4576fc][_0x45a5('0x72')]][_0x45a5('0x73')]:_0x808186[_0x4576fc]['field'];_0xbae0a2=_0x808186[_0x4576fc][_0x45a5('0x75')]?_['replace'](_0x56c2d1[_0x808186[_0x4576fc]['function']],'%s',_0xbae0a2):_0xbae0a2;_0xbae0a2=_0x808186[_0x4576fc][_0x45a5('0x76')]?_[_0x45a5('0x74')](_0x3b5394[_0x808186[_0x4576fc][_0x45a5('0x76')]],'%s',_0xbae0a2):_0xbae0a2;if(_0x808186[_0x4576fc][_0x45a5('0x77')]){_0xbde6e['group'](_0xbae0a2);}_0x808186[_0x4576fc]['orderBy']&&_0xbde6e[_0x45a5('0x79')](_0xbae0a2,_0x808186[_0x4576fc][_0x45a5('0x78')]===_0x45a5('0x7a')?![]:!![]);_0xbde6e['field'](_0xbae0a2,_0x808186[_0x4576fc][_0x45a5('0x7b')]||_0xbae0a2);}if(_0x2e5651[_0x45a5('0x7c')]){_0x2e5651[_0x45a5('0x7c')]=JSON['parse'](_0x2e5651[_0x45a5('0x7c')]);for(var _0x4bfeb4=0x0;_0x4bfeb4<_0x2e5651[_0x45a5('0x7c')][_0x45a5('0x35')];_0x4bfeb4+=0x1){if(_0x2e5651[_0x45a5('0x7c')][_0x4bfeb4]['type']&&_['includes'](_0x2ac664,_0x2e5651['joins'][_0x4bfeb4][_0x45a5('0x3d')])&&_0x2e5651[_0x45a5('0x7c')][_0x4bfeb4][_0x45a5('0x7d')]&&_0x2e5651[_0x45a5('0x7c')][_0x4bfeb4][_0x45a5('0x7e')]&&_0x2e5651['joins'][_0x4bfeb4]['foreignKey']){_0xbde6e[_0x2e5651['joins'][_0x4bfeb4]['type']](_0x2e5651[_0x45a5('0x7c')][_0x4bfeb4]['foreignTable'],null,util[_0x45a5('0x76')](_0x45a5('0x80'),_0x2e5651[_0x45a5('0x71')],_0x2e5651[_0x45a5('0x7c')][_0x4bfeb4]['parentKey'],_0x2e5651['joins'][_0x4bfeb4][_0x45a5('0x7e')],_0x2e5651['joins'][_0x4bfeb4]['foreignKey']));}}}if(_0x2e5651[_0x45a5('0x81')]){_0x2e5651['conditions']=JSON['parse'](_0x2e5651[_0x45a5('0x81')]);_0xbde6e[_0x45a5('0x38')](_0x356561(_0x2e5651[_0x45a5('0x81')][_0x45a5('0x66')]));}_0x585785=_0xbde6e[_0x45a5('0x83')]();_0xbde6e[_0x45a5('0x1d')](_0x3060d1);_0xbde6e['offset'](0x0);logger[_0x45a5('0x84')](_0x45a5('0x85'),_0xbde6e['toString']());return dbH[_0x45a5('0x87')][_0x45a5('0x2e')](_0xbde6e[_0x45a5('0x86')](),{'type':dbH['sequelize'][_0x45a5('0x88')][_0x45a5('0x89')]});}})[_0x45a5('0x23')](function(){return{'sql':_0x585785[_0x45a5('0x86')]()};})[_0x45a5('0x23')](respondWithResult(_0x4e630a,null))['catch'](handleError(_0x4e630a,null));}; \ No newline at end of file +var _0xf809=['offset','set','Content-Range','apply','reject','save','update','then','get','CustomReports','UserProfileResource','destroy','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','catch','show','params','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','MetricId','metric','function','format','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','sequelize','toString','QueryTypes','SELECT','left_join','cross_join','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','IS\x20NULL','IS\x20EMPTY','groupBy','alias','clone','output','randomstring','generate','csv','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','from','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','replace','debug','Limited\x20Query:','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status'];(function(_0x11adfa,_0x36ea57){var _0x1e68a9=function(_0x165ca8){while(--_0x165ca8){_0x11adfa['push'](_0x11adfa['shift']());}};_0x1e68a9(++_0x36ea57);}(_0xf809,0x87));var _0x9f80=function(_0x267c3c,_0x278e46){_0x267c3c=_0x267c3c-0x0;var _0x1f9cad=_0xf809[_0x267c3c];return _0x1f9cad;};'use strict';var emlformat=require(_0x9f80('0x0'));var rimraf=require(_0x9f80('0x1'));var zipdir=require(_0x9f80('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9f80('0x3'));var moment=require('moment');var BPromise=require(_0x9f80('0x4'));var Mustache=require(_0x9f80('0x5'));var util=require(_0x9f80('0x6'));var path=require(_0x9f80('0x7'));var sox=require(_0x9f80('0x8'));var csv=require(_0x9f80('0x9'));var ejs=require(_0x9f80('0xa'));var fs=require('fs');var fs_extra=require(_0x9f80('0xb'));var _=require(_0x9f80('0xc'));var squel=require(_0x9f80('0xd'));var crypto=require('crypto');var jsforce=require(_0x9f80('0xe'));var deskjs=require(_0x9f80('0xf'));var toCsv=require(_0x9f80('0x9'));var querystring=require(_0x9f80('0x10'));var Papa=require(_0x9f80('0x11'));var Redis=require(_0x9f80('0x12'));var authService=require(_0x9f80('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9f80('0x14'));var hardwareService=require(_0x9f80('0x15'));var logger=require(_0x9f80('0x16'))(_0x9f80('0x17'));var utils=require('../../config/utils');var config=require(_0x9f80('0x18'));var licenseUtil=require(_0x9f80('0x19'));var db=require(_0x9f80('0x1a'))['db'];var dbH=require(_0x9f80('0x1a'))[_0x9f80('0x1b')];function respondWithStatusCode(_0x261190,_0x1885c1){_0x1885c1=_0x1885c1||0xcc;return function(_0x569b01){if(_0x569b01){return _0x261190[_0x9f80('0x1c')](_0x1885c1);}return _0x261190[_0x9f80('0x1d')](_0x1885c1)['end']();};}function respondWithResult(_0x142bf8,_0x43f5d0){_0x43f5d0=_0x43f5d0||0xc8;return function(_0x59c994){if(_0x59c994){return _0x142bf8[_0x9f80('0x1d')](_0x43f5d0)['json'](_0x59c994);}};}function respondWithFilteredResult(_0x58c15f,_0x3a010e){return function(_0x1075da){if(_0x1075da){var _0x39deae=_0x1075da['count'],_0x39de75=_0x3a010e[_0x9f80('0x1e')],_0x671af0=_0x3a010e[_0x9f80('0x1e')]+_0x3a010e['limit'],_0x3877fb;if(_0x671af0>=_0x39deae){_0x671af0=_0x39deae;_0x3877fb=0xc8;}else{_0x3877fb=0xce;}_0x58c15f[_0x9f80('0x1d')](_0x3877fb);return _0x58c15f[_0x9f80('0x1f')](_0x9f80('0x20'),_0x39de75+'-'+_0x671af0+'/'+_0x39deae)['json'](_0x1075da);}return null;};}function patchUpdates(_0x496f45){return function(_0x159900){try{jsonpatch[_0x9f80('0x21')](_0x159900,_0x496f45,!![]);}catch(_0x1de27d){return BPromise[_0x9f80('0x22')](_0x1de27d);}return _0x159900[_0x9f80('0x23')]();};}function saveUpdates(_0x572701,_0x2f9de5){return function(_0x3bfdd0){if(_0x3bfdd0){return _0x3bfdd0[_0x9f80('0x24')](_0x572701)[_0x9f80('0x25')](function(_0x3d5381){return _0x3d5381;});}return null;};}function removeEntity(_0x50555b,_0x2bedbc){return function(_0x37244c){if(_0x37244c){return _0x37244c['destroy']()['then'](function(){var _0x301492=_0x37244c[_0x9f80('0x26')]({'plain':!![]});var _0x44640c=_0x9f80('0x27');return db[_0x9f80('0x28')][_0x9f80('0x29')]({'where':{'type':_0x44640c,'resourceId':_0x301492['id']}})['then'](function(){return _0x37244c;});})['then'](function(){_0x50555b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3925de,_0x3c98ca){return function(_0x45559c){if(!_0x45559c){_0x3925de[_0x9f80('0x1c')](0x194);}return _0x45559c;};}function handleError(_0x310688,_0x29c1a0){_0x29c1a0=_0x29c1a0||0x1f4;return function(_0x2a3c9e){logger['error'](_0x2a3c9e[_0x9f80('0x2a')]);if(_0x2a3c9e[_0x9f80('0x2b')]){delete _0x2a3c9e[_0x9f80('0x2b')];}_0x310688[_0x9f80('0x1d')](_0x29c1a0)[_0x9f80('0x2c')](_0x2a3c9e);};}exports[_0x9f80('0x2d')]=function(_0x3d8718,_0x172a36){var _0x412a07={},_0x44f041={},_0x38daa3={'count':0x0,'rows':[]};var _0x2f81c6=_[_0x9f80('0x2e')](db[_0x9f80('0x2f')][_0x9f80('0x30')],function(_0x43cff6){return{'name':_0x43cff6[_0x9f80('0x31')],'type':_0x43cff6[_0x9f80('0x32')][_0x9f80('0x33')]};});_0x44f041[_0x9f80('0x34')]=_[_0x9f80('0x2e')](_0x2f81c6,_0x9f80('0x2b'));_0x44f041[_0x9f80('0x35')]=_[_0x9f80('0x36')](_0x3d8718[_0x9f80('0x35')]);_0x44f041['filters']=_[_0x9f80('0x37')](_0x44f041[_0x9f80('0x34')],_0x44f041['query']);_0x412a07[_0x9f80('0x38')]=_[_0x9f80('0x37')](_0x44f041['model'],qs[_0x9f80('0x39')](_0x3d8718[_0x9f80('0x35')][_0x9f80('0x39')]));_0x412a07[_0x9f80('0x38')]=_0x412a07[_0x9f80('0x38')]['length']?_0x412a07[_0x9f80('0x38')]:_0x44f041[_0x9f80('0x34')];if(!_0x3d8718[_0x9f80('0x35')][_0x9f80('0x3a')](_0x9f80('0x3b'))){_0x412a07[_0x9f80('0x3c')]=qs['limit'](_0x3d8718['query'][_0x9f80('0x3c')]);_0x412a07[_0x9f80('0x1e')]=qs[_0x9f80('0x1e')](_0x3d8718['query'][_0x9f80('0x1e')]);}_0x412a07[_0x9f80('0x3d')]=qs[_0x9f80('0x3e')](_0x3d8718[_0x9f80('0x35')]['sort']);_0x412a07[_0x9f80('0x3f')]=qs[_0x9f80('0x40')](_[_0x9f80('0x41')](_0x3d8718[_0x9f80('0x35')],_0x44f041['filters']),_0x2f81c6);if(_0x3d8718[_0x9f80('0x35')]['filter']){_0x412a07[_0x9f80('0x3f')]=_[_0x9f80('0x42')](_0x412a07[_0x9f80('0x3f')],{'$or':_[_0x9f80('0x2e')](_0x2f81c6,function(_0x497d9f){if(_0x497d9f[_0x9f80('0x32')]!==_0x9f80('0x43')){var _0x591b8c={};_0x591b8c[_0x497d9f[_0x9f80('0x2b')]]={'$like':'%'+_0x3d8718[_0x9f80('0x35')][_0x9f80('0x44')]+'%'};return _0x591b8c;}})});}_0x412a07=_[_0x9f80('0x42')]({},_0x412a07,_0x3d8718[_0x9f80('0x45')]);var _0x543fd4={'where':_0x412a07['where']};return db[_0x9f80('0x2f')]['count'](_0x543fd4)['then'](function(_0x52cc7a){_0x38daa3[_0x9f80('0x46')]=_0x52cc7a;if(_0x3d8718[_0x9f80('0x35')][_0x9f80('0x47')]){_0x412a07[_0x9f80('0x48')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x9f80('0x49')](_0x412a07);})[_0x9f80('0x25')](function(_0x3ff5ab){_0x38daa3['rows']=_0x3ff5ab;return _0x38daa3;})[_0x9f80('0x25')](respondWithFilteredResult(_0x172a36,_0x412a07))[_0x9f80('0x4a')](handleError(_0x172a36,null));};exports[_0x9f80('0x4b')]=function(_0x1505ac,_0x1ccbbe){var _0x222209={'raw':![],'where':{'id':_0x1505ac[_0x9f80('0x4c')]['id']}},_0x3b2bb9={};_0x3b2bb9[_0x9f80('0x34')]=_[_0x9f80('0x36')](db[_0x9f80('0x2f')][_0x9f80('0x30')]);_0x3b2bb9['query']=_[_0x9f80('0x36')](_0x1505ac[_0x9f80('0x35')]);_0x3b2bb9[_0x9f80('0x40')]=_[_0x9f80('0x37')](_0x3b2bb9[_0x9f80('0x34')],_0x3b2bb9[_0x9f80('0x35')]);_0x222209[_0x9f80('0x38')]=_[_0x9f80('0x37')](_0x3b2bb9[_0x9f80('0x34')],qs[_0x9f80('0x39')](_0x1505ac[_0x9f80('0x35')][_0x9f80('0x39')]));_0x222209[_0x9f80('0x38')]=_0x222209[_0x9f80('0x38')][_0x9f80('0x4d')]?_0x222209[_0x9f80('0x38')]:_0x3b2bb9[_0x9f80('0x34')];if(_0x1505ac[_0x9f80('0x35')][_0x9f80('0x47')]){_0x222209[_0x9f80('0x48')]=[{'all':!![]}];}_0x222209=_[_0x9f80('0x42')]({},_0x222209,_0x1505ac['options']);return db[_0x9f80('0x2f')][_0x9f80('0x4e')](_0x222209)[_0x9f80('0x25')](handleEntityNotFound(_0x1ccbbe,null))['then'](respondWithResult(_0x1ccbbe,null))[_0x9f80('0x4a')](handleError(_0x1ccbbe,null));};exports[_0x9f80('0x4f')]=function(_0x549811,_0x52f1dc){return db[_0x9f80('0x2f')][_0x9f80('0x4f')](_0x549811['body'],{})[_0x9f80('0x25')](function(_0x1c9383){var _0x1fb4d8=_0x549811['user'][_0x9f80('0x26')]({'plain':!![]});if(!_0x1fb4d8)throw new Error(_0x9f80('0x50'));if(_0x1fb4d8[_0x9f80('0x51')]==='user'){var _0x6c32d1=_0x1c9383[_0x9f80('0x26')]({'plain':!![]});var _0x168951=_0x9f80('0x52');return db[_0x9f80('0x53')][_0x9f80('0x4e')]({'where':{'name':_0x168951,'userProfileId':_0x1fb4d8[_0x9f80('0x54')]},'raw':!![]})[_0x9f80('0x25')](function(_0x49472a){if(_0x49472a&&_0x49472a[_0x9f80('0x55')]===0x0){return db[_0x9f80('0x28')][_0x9f80('0x4f')]({'name':_0x6c32d1[_0x9f80('0x2b')],'resourceId':_0x6c32d1['id'],'type':_0x9f80('0x27'),'sectionId':_0x49472a['id']},{})[_0x9f80('0x25')](function(){return _0x1c9383;});}else{return _0x1c9383;}})[_0x9f80('0x4a')](function(_0x234c88){logger[_0x9f80('0x56')](_0x9f80('0x57'),_0x234c88);throw _0x234c88;});}return _0x1c9383;})[_0x9f80('0x25')](respondWithResult(_0x52f1dc,0xc9))[_0x9f80('0x4a')](handleError(_0x52f1dc,null));};exports[_0x9f80('0x24')]=function(_0x14abb0,_0x29d07b){if(_0x14abb0[_0x9f80('0x58')]['id']){delete _0x14abb0['body']['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x14abb0['params']['id']}})[_0x9f80('0x25')](handleEntityNotFound(_0x29d07b,null))['then'](saveUpdates(_0x14abb0[_0x9f80('0x58')],null))[_0x9f80('0x25')](respondWithResult(_0x29d07b,null))['catch'](handleError(_0x29d07b,null));};exports[_0x9f80('0x29')]=function(_0x2a9640,_0x59ba33){return db['AnalyticCustomReport'][_0x9f80('0x4e')]({'where':{'id':_0x2a9640[_0x9f80('0x4c')]['id']}})[_0x9f80('0x25')](handleEntityNotFound(_0x59ba33,null))[_0x9f80('0x25')](removeEntity(_0x59ba33,null))[_0x9f80('0x4a')](handleError(_0x59ba33,null));};exports['preview']=function(_0x17e599,_0x3f1958){var _0x5c1b94=0xa;var _0x23ca1a=[_0x9f80('0x59'),'left_join',_0x9f80('0x5a'),'cross_join'];var _0x39dfc3={'SUM':_0x9f80('0x5b'),'COUNT':_0x9f80('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9f80('0x5d'),'MIN':_0x9f80('0x5e'),'AVG':_0x9f80('0x5f'),'GROUP_CONCAT':_0x9f80('0x60'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2b8b1f={'SEC_TO_TIME':_0x9f80('0x61'),'DATE':_0x9f80('0x62'),'HOUR':'HOUR(%s)','ROUND':_0x9f80('0x63'),'UNIX_TIMESTAMP':_0x9f80('0x64')};var _0x16e07c=function(_0x2a2d0d){return!_[_0x9f80('0x65')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x9f80('0x66')],_0x2a2d0d);};var _0x55731f=function(_0x24a3c2){if(!_0x24a3c2||!_0x24a3c2[_0x9f80('0x67')][_0x9f80('0x4d')]){return'';}for(var _0x4659c8='(',_0x534286=0x0;_0x534286<_0x24a3c2['rules'][_0x9f80('0x4d')];_0x534286+=0x1){_0x534286>0x0&&(_0x4659c8+='\x20'+_0x24a3c2[_0x9f80('0x68')]+'\x20');_0x4659c8+=_0x24a3c2['rules'][_0x534286][_0x9f80('0x69')]?_0x55731f(_0x24a3c2[_0x9f80('0x67')][_0x534286]['group']):_0x24a3c2[_0x9f80('0x67')][_0x534286][_0x9f80('0x6a')]+'\x20'+_0x24a3c2[_0x9f80('0x67')][_0x534286][_0x9f80('0x6b')]+(_0x16e07c(_0x24a3c2[_0x9f80('0x67')][_0x534286]['condition'])?'\x20'+_0x24a3c2['rules'][_0x534286][_0x9f80('0x6c')]:'');}return _0x4659c8+')';};var _0x447c0a={'where':{'id':_0x17e599[_0x9f80('0x4c')]['id']}},_0x4c899e,_0x3b34bc,_0x3a6f47,_0x659e8a,_0x5d7723;_0x447c0a=_[_0x9f80('0x42')]({},_0x447c0a,_0x17e599[_0x9f80('0x45')]);return db['AnalyticCustomReport'][_0x9f80('0x4e')](_0x447c0a)['then'](function(_0x18c7e7){if(_0x18c7e7){_0x4c899e=_0x18c7e7;return _0x18c7e7[_0x9f80('0x6d')]();}return null;})[_0x9f80('0x25')](function(_0x1ced07){if(_0x1ced07){if(!_0x1ced07[_0x9f80('0x4d')]){throw new db[(_0x9f80('0x6e'))]['ValidationErrorItem'](_0x9f80('0x6f'),0x193);}_0x3b34bc=_0x1ced07;return db[_0x9f80('0x70')][_0x9f80('0x49')]({'raw':!![]});}return null;})[_0x9f80('0x25')](function(_0xa2c3dd){if(_0xa2c3dd){_0x3a6f47=_[_0x9f80('0x71')](_0xa2c3dd,'id');var _0x148d16;var _0x1d5fcd=squel[_0x9f80('0x72')]();_0x1d5fcd['from'](_0x4c899e['table']);for(var _0x4767a3=0x0;_0x4767a3<_0x3b34bc[_0x9f80('0x4d')];_0x4767a3+=0x1){_0x148d16=_0x3b34bc[_0x4767a3][_0x9f80('0x73')]?_0x3a6f47[_0x3b34bc[_0x4767a3][_0x9f80('0x73')]][_0x9f80('0x74')]:_0x3b34bc[_0x4767a3]['field'];_0x148d16=_0x3b34bc[_0x4767a3][_0x9f80('0x75')]?_['replace'](_0x39dfc3[_0x3b34bc[_0x4767a3]['function']],'%s',_0x148d16):_0x148d16;_0x148d16=_0x3b34bc[_0x4767a3][_0x9f80('0x76')]?_['replace'](_0x2b8b1f[_0x3b34bc[_0x4767a3][_0x9f80('0x76')]],'%s',_0x148d16):_0x148d16;if(_0x3b34bc[_0x4767a3]['groupBy']){_0x1d5fcd[_0x9f80('0x69')](_0x148d16);}_0x3b34bc[_0x4767a3][_0x9f80('0x77')]&&_0x1d5fcd[_0x9f80('0x3d')](_0x148d16,_0x3b34bc[_0x4767a3][_0x9f80('0x77')]===_0x9f80('0x78')?![]:!![]);_0x1d5fcd[_0x9f80('0x6a')](_0x148d16,_0x3b34bc[_0x4767a3]['alias']||_0x148d16);}if(_0x4c899e[_0x9f80('0x79')]){_0x4c899e[_0x9f80('0x79')]=JSON[_0x9f80('0x7a')](_0x4c899e['joins']);for(var _0x16280f=0x0;_0x16280f<_0x4c899e[_0x9f80('0x79')]['length'];_0x16280f+=0x1){if(_0x4c899e['joins'][_0x16280f][_0x9f80('0x32')]&&_['includes'](_0x23ca1a,_0x4c899e[_0x9f80('0x79')][_0x16280f][_0x9f80('0x32')])&&_0x4c899e[_0x9f80('0x79')][_0x16280f][_0x9f80('0x7b')]&&_0x4c899e[_0x9f80('0x79')][_0x16280f][_0x9f80('0x7c')]&&_0x4c899e[_0x9f80('0x79')][_0x16280f][_0x9f80('0x7d')]){_0x1d5fcd[_0x4c899e[_0x9f80('0x79')][_0x16280f]['type']](_0x4c899e[_0x9f80('0x79')][_0x16280f][_0x9f80('0x7c')],null,util['format'](_0x9f80('0x7e'),_0x4c899e[_0x9f80('0x7f')],_0x4c899e[_0x9f80('0x79')][_0x16280f]['parentKey'],_0x4c899e[_0x9f80('0x79')][_0x16280f]['foreignTable'],_0x4c899e[_0x9f80('0x79')][_0x16280f][_0x9f80('0x7d')]));}}}if(_0x4c899e[_0x9f80('0x80')]){_0x4c899e['conditions']=JSON[_0x9f80('0x7a')](_0x4c899e['conditions']);_0x1d5fcd['where'](_0x55731f(_0x4c899e[_0x9f80('0x80')]['group']));}_0x5d7723=_0x1d5fcd['clone']();_0x1d5fcd[_0x9f80('0x3c')](_0x5c1b94);_0x1d5fcd[_0x9f80('0x1e')](0x0);logger['debug']('Limited\x20Query:',_0x1d5fcd['toString']());return dbH[_0x9f80('0x81')][_0x9f80('0x35')](_0x1d5fcd[_0x9f80('0x82')](),{'type':dbH[_0x9f80('0x81')][_0x9f80('0x83')][_0x9f80('0x84')]});}})[_0x9f80('0x25')](respondWithResult(_0x3f1958,null))[_0x9f80('0x4a')](handleError(_0x3f1958,null));};function runReport(_0x2f0180,_0x4a1da6,_0xa3f131){var _0x2b4a4f=_0x4a1da6[_0x9f80('0x2b')];var _0x4e30b3=0xa;var _0x31d70d=['join',_0x9f80('0x85'),_0x9f80('0x5a'),_0x9f80('0x86')];var _0x4d6273={'SUM':_0x9f80('0x5b'),'COUNT':_0x9f80('0x5c'),'COUNT DISTINCT':_0x9f80('0x87'),'MAX':'MAX(%s)','MIN':_0x9f80('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x9f80('0x60'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9f80('0x88')};var _0x3cf1d6={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9f80('0x62'),'HOUR':_0x9f80('0x89'),'ROUND':_0x9f80('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4cb224=function(_0x20bc30){return!_[_0x9f80('0x65')]([_0x9f80('0x8a'),'IS\x20NOT\x20NULL',_0x9f80('0x8b'),_0x9f80('0x66')],_0x20bc30);};var _0x5bc272=function(_0x70ba94){if(!_0x70ba94||!_0x70ba94[_0x9f80('0x67')][_0x9f80('0x4d')]){return'';}for(var _0x317734='(',_0x4af875=0x0;_0x4af875<_0x70ba94['rules']['length'];_0x4af875+=0x1){_0x4af875>0x0&&(_0x317734+='\x20'+_0x70ba94[_0x9f80('0x68')]+'\x20');_0x317734+=_0x70ba94['rules'][_0x4af875][_0x9f80('0x69')]?_0x5bc272(_0x70ba94[_0x9f80('0x67')][_0x4af875][_0x9f80('0x69')]):_0x70ba94[_0x9f80('0x67')][_0x4af875][_0x9f80('0x6a')]+'\x20'+_0x70ba94[_0x9f80('0x67')][_0x4af875][_0x9f80('0x6b')]+(_0x4cb224(_0x70ba94['rules'][_0x4af875][_0x9f80('0x6b')])?'\x20'+_0x70ba94['rules'][_0x4af875][_0x9f80('0x6c')]:'');}return _0x317734+')';};var _0x46ba0f={'where':{'id':_0x2f0180['id']}},_0x2e2979,_0xd65266,_0x2ea330,_0x4a10af,_0x3ffc1a;_0x46ba0f=_[_0x9f80('0x42')]({},_0x46ba0f,_0xa3f131);return db[_0x9f80('0x2f')]['find'](_0x46ba0f)[_0x9f80('0x25')](function(_0x14fcb7){if(_0x14fcb7){_0x2e2979=_0x14fcb7;return _0x14fcb7[_0x9f80('0x6d')]();}return null;})[_0x9f80('0x25')](function(_0x3f09db){if(_0x3f09db){if(!_0x3f09db[_0x9f80('0x4d')]){throw new db[(_0x9f80('0x6e'))]['ValidationErrorItem'](_0x9f80('0x6f'),0x193);}_0xd65266=_0x3f09db;return db[_0x9f80('0x70')][_0x9f80('0x49')]({'raw':!![]});}return null;})[_0x9f80('0x25')](function(_0x26920e){if(_0x26920e){_0x2ea330=_[_0x9f80('0x71')](_0x26920e,'id');var _0x3a563d;var _0x5aaa24=squel[_0x9f80('0x72')]();_0x5aaa24['from'](_0x2e2979[_0x9f80('0x7f')]);for(var _0x287d75=0x0;_0x287d75<_0xd65266['length'];_0x287d75+=0x1){_0x3a563d=_0xd65266[_0x287d75][_0x9f80('0x73')]?_0x2ea330[_0xd65266[_0x287d75][_0x9f80('0x73')]][_0x9f80('0x74')]:_0xd65266[_0x287d75]['field'];_0x3a563d=_0xd65266[_0x287d75]['function']?_['replace'](_0x4d6273[_0xd65266[_0x287d75][_0x9f80('0x75')]],'%s',_0x3a563d):_0x3a563d;_0x3a563d=_0xd65266[_0x287d75]['format']?_['replace'](_0x3cf1d6[_0xd65266[_0x287d75][_0x9f80('0x76')]],'%s',_0x3a563d):_0x3a563d;if(_0xd65266[_0x287d75][_0x9f80('0x8c')]){_0x5aaa24[_0x9f80('0x69')](_0x3a563d);}_0xd65266[_0x287d75][_0x9f80('0x77')]&&_0x5aaa24[_0x9f80('0x3d')](_0x3a563d,_0xd65266[_0x287d75][_0x9f80('0x77')]===_0x9f80('0x78')?![]:!![]);_0x5aaa24[_0x9f80('0x6a')](_0x3a563d,_0xd65266[_0x287d75][_0x9f80('0x8d')]||_0x3a563d);}if(_0x2e2979[_0x9f80('0x79')]){_0x2e2979['joins']=JSON[_0x9f80('0x7a')](_0x2e2979[_0x9f80('0x79')]);for(var _0x3bf481=0x0;_0x3bf481<_0x2e2979[_0x9f80('0x79')][_0x9f80('0x4d')];_0x3bf481+=0x1){if(_0x2e2979[_0x9f80('0x79')][_0x3bf481][_0x9f80('0x32')]&&_[_0x9f80('0x65')](_0x31d70d,_0x2e2979['joins'][_0x3bf481][_0x9f80('0x32')])&&_0x2e2979[_0x9f80('0x79')][_0x3bf481][_0x9f80('0x7b')]&&_0x2e2979[_0x9f80('0x79')][_0x3bf481]['foreignTable']&&_0x2e2979['joins'][_0x3bf481][_0x9f80('0x7d')]){_0x5aaa24[_0x2e2979[_0x9f80('0x79')][_0x3bf481]['type']](_0x2e2979[_0x9f80('0x79')][_0x3bf481][_0x9f80('0x7c')],null,util[_0x9f80('0x76')]('%s.%s\x20=\x20%s.%s',_0x2e2979[_0x9f80('0x7f')],_0x2e2979[_0x9f80('0x79')][_0x3bf481][_0x9f80('0x7b')],_0x2e2979[_0x9f80('0x79')][_0x3bf481][_0x9f80('0x7c')],_0x2e2979['joins'][_0x3bf481]['foreignKey']));}}}if(_0x2e2979[_0x9f80('0x80')]){_0x2e2979['conditions']=JSON['parse'](_0x2e2979[_0x9f80('0x80')]);_0x5aaa24[_0x9f80('0x3f')](_0x5bc272(_0x2e2979[_0x9f80('0x80')][_0x9f80('0x69')]));}_0x3ffc1a=_0x5aaa24[_0x9f80('0x8e')]();_0x5aaa24[_0x9f80('0x3c')](_0x4e30b3);_0x5aaa24['offset'](0x0);return;}})[_0x9f80('0x25')](function(){if(_0x4a1da6[_0x9f80('0x8f')]==='web'){return null;}var _0x1a5da2=_[_0x9f80('0x42')](_0x4a1da6,{'name':_0x4a1da6['fullPath']||_0x4a1da6[_0x9f80('0x2b')]||_0x2e2979[_0x9f80('0x2b')],'basename':_0x2b4a4f,'savename':util['format']('%s-%s.%s',_0x4a1da6[_0x9f80('0x2b')]||_0x2e2979[_0x9f80('0x2b')],require(_0x9f80('0x90'))[_0x9f80('0x91')](0x4),_0x4a1da6[_0x9f80('0x8f')]||_0x9f80('0x92')),'reportId':_0x2e2979['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0x9f80('0x4f')](_0x1a5da2,{'raw':!![]});})[_0x9f80('0x25')](function(_0x116d3b){if(_0x2e2979['table']===_0x9f80('0x93')){_0x3ffc1a['where'](_0x2e2979['table']+_0x9f80('0x94'),_0x4a1da6['startDate'],_0x4a1da6[_0x9f80('0x95')]);}else{_0x3ffc1a['where'](_0x2e2979[_0x9f80('0x7f')]+_0x9f80('0x96'),_0x4a1da6['startDate'],_0x4a1da6['endDate']);}if(_0x116d3b){logger[_0x9f80('0x97')](_0x9f80('0x98'),_0x3ffc1a[_0x9f80('0x82')]());require(_0x9f80('0x99'))[_0x9f80('0x9a')](path[_0x9f80('0x59')](__dirname,'../../components/export/',_0x116d3b[_0x9f80('0x8f')]),[_0x116d3b['id'],_0x3ffc1a[_0x9f80('0x82')](),path[_0x9f80('0x59')](__dirname,_0x9f80('0x9b'),_0x116d3b['savename']),_0x2b4a4f]);return _0x116d3b;}else{var _0x1ee93f=squel[_0x9f80('0x72')]();_0x1ee93f[_0x9f80('0x9c')]('('+_0x3ffc1a[_0x9f80('0x82')]()+')',_0x9f80('0x9d'));_0x1ee93f['field'](_0x9f80('0x9e'),_0x9f80('0x46'));_0x3ffc1a[_0x9f80('0x3c')](_0x4a1da6[_0x9f80('0x3c')]||_0x4e30b3);_0x3ffc1a['offset'](_0x4a1da6[_0x9f80('0x1e')]||0x0);return dbH['sequelize'][_0x9f80('0x35')](_0x1ee93f['toString'](),{'type':dbH[_0x9f80('0x81')]['QueryTypes']['SELECT']})['then'](function(_0x40572b){if(!_0x40572b['length']){_0x4a10af=0x0;}else{_0x4a10af=_0x40572b[0x0][_0x9f80('0x46')]||0x0;}return dbH[_0x9f80('0x81')][_0x9f80('0x35')](_0x3ffc1a[_0x9f80('0x82')](),{'type':dbH['sequelize'][_0x9f80('0x83')][_0x9f80('0x84')]});})[_0x9f80('0x25')](function(_0x349f83){return{'rows':_0x349f83||[],'count':_0x4a10af};});}});}exports[_0x9f80('0x9f')]=function(_0x3d30f0,_0x2f5f13){return runReport(_0x3d30f0[_0x9f80('0x4c')],_0x3d30f0['query'],_0x3d30f0[_0x9f80('0x45')])[_0x9f80('0x25')](respondWithResult(_0x2f5f13,null))[_0x9f80('0x4a')](handleError(_0x2f5f13,null));};exports[_0x9f80('0xa0')]=runReport;exports['query']=function(_0x3d6d8c,_0x2f27bb){var _0x20602f=0xa;var _0x198334=['join',_0x9f80('0x85'),'right_join','cross_join'];var _0x31c803={'SUM':_0x9f80('0x5b'),'COUNT':_0x9f80('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x9f80('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x9f80('0x60'),'GROUP_CONCAT ASC':_0x9f80('0xa1'),'GROUP_CONCAT DESC':_0x9f80('0x88')};var _0x43af07={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x9f80('0x89'),'ROUND':_0x9f80('0x63'),'UNIX_TIMESTAMP':_0x9f80('0x64')};var _0x41e54a=function(_0x36abea){return!_[_0x9f80('0x65')]([_0x9f80('0x8a'),'IS\x20NOT\x20NULL',_0x9f80('0x8b'),_0x9f80('0x66')],_0x36abea);};var _0x573710=function(_0x420267){if(!_0x420267||!_0x420267[_0x9f80('0x67')][_0x9f80('0x4d')]){return'';}for(var _0x510aa7='(',_0xbc2851=0x0;_0xbc2851<_0x420267[_0x9f80('0x67')][_0x9f80('0x4d')];_0xbc2851+=0x1){_0xbc2851>0x0&&(_0x510aa7+='\x20'+_0x420267[_0x9f80('0x68')]+'\x20');_0x510aa7+=_0x420267[_0x9f80('0x67')][_0xbc2851]['group']?_0x573710(_0x420267[_0x9f80('0x67')][_0xbc2851][_0x9f80('0x69')]):_0x420267[_0x9f80('0x67')][_0xbc2851][_0x9f80('0x6a')]+'\x20'+_0x420267[_0x9f80('0x67')][_0xbc2851]['condition']+(_0x41e54a(_0x420267[_0x9f80('0x67')][_0xbc2851][_0x9f80('0x6b')])?'\x20'+_0x420267[_0x9f80('0x67')][_0xbc2851]['value']:'');}return _0x510aa7+')';};var _0x475392={'where':{'id':_0x3d6d8c[_0x9f80('0x4c')]['id']}},_0x2d5c17,_0x3c0830,_0x23eb4e,_0x28f56e,_0x2060dd;_0x475392=_['merge']({},_0x475392,_0x3d6d8c[_0x9f80('0x45')]);return db['AnalyticCustomReport'][_0x9f80('0x4e')](_0x475392)[_0x9f80('0x25')](function(_0x99393a){if(_0x99393a){_0x2d5c17=_0x99393a;return _0x99393a[_0x9f80('0x6d')]();}return null;})[_0x9f80('0x25')](function(_0x349707){if(_0x349707){if(!_0x349707[_0x9f80('0x4d')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3c0830=_0x349707;return db[_0x9f80('0x70')]['findAll']({'raw':!![]});}return null;})[_0x9f80('0x25')](function(_0x206e9e){if(_0x206e9e){_0x23eb4e=_[_0x9f80('0x71')](_0x206e9e,'id');var _0x12c181;var _0x1d8c4c=squel[_0x9f80('0x72')]();_0x1d8c4c['from'](_0x2d5c17[_0x9f80('0x7f')]);for(var _0x485441=0x0;_0x485441<_0x3c0830[_0x9f80('0x4d')];_0x485441+=0x1){_0x12c181=_0x3c0830[_0x485441]['MetricId']?_0x23eb4e[_0x3c0830[_0x485441]['MetricId']][_0x9f80('0x74')]:_0x3c0830[_0x485441][_0x9f80('0x6a')];_0x12c181=_0x3c0830[_0x485441][_0x9f80('0x75')]?_['replace'](_0x31c803[_0x3c0830[_0x485441][_0x9f80('0x75')]],'%s',_0x12c181):_0x12c181;_0x12c181=_0x3c0830[_0x485441]['format']?_[_0x9f80('0xa2')](_0x43af07[_0x3c0830[_0x485441]['format']],'%s',_0x12c181):_0x12c181;if(_0x3c0830[_0x485441][_0x9f80('0x8c')]){_0x1d8c4c[_0x9f80('0x69')](_0x12c181);}_0x3c0830[_0x485441][_0x9f80('0x77')]&&_0x1d8c4c[_0x9f80('0x3d')](_0x12c181,_0x3c0830[_0x485441][_0x9f80('0x77')]==='DESC'?![]:!![]);_0x1d8c4c[_0x9f80('0x6a')](_0x12c181,_0x3c0830[_0x485441]['alias']||_0x12c181);}if(_0x2d5c17[_0x9f80('0x79')]){_0x2d5c17[_0x9f80('0x79')]=JSON['parse'](_0x2d5c17[_0x9f80('0x79')]);for(var _0x1fbf8a=0x0;_0x1fbf8a<_0x2d5c17['joins']['length'];_0x1fbf8a+=0x1){if(_0x2d5c17[_0x9f80('0x79')][_0x1fbf8a][_0x9f80('0x32')]&&_['includes'](_0x198334,_0x2d5c17['joins'][_0x1fbf8a][_0x9f80('0x32')])&&_0x2d5c17['joins'][_0x1fbf8a][_0x9f80('0x7b')]&&_0x2d5c17[_0x9f80('0x79')][_0x1fbf8a][_0x9f80('0x7c')]&&_0x2d5c17[_0x9f80('0x79')][_0x1fbf8a][_0x9f80('0x7d')]){_0x1d8c4c[_0x2d5c17[_0x9f80('0x79')][_0x1fbf8a][_0x9f80('0x32')]](_0x2d5c17[_0x9f80('0x79')][_0x1fbf8a]['foreignTable'],null,util['format'](_0x9f80('0x7e'),_0x2d5c17[_0x9f80('0x7f')],_0x2d5c17['joins'][_0x1fbf8a][_0x9f80('0x7b')],_0x2d5c17[_0x9f80('0x79')][_0x1fbf8a][_0x9f80('0x7c')],_0x2d5c17[_0x9f80('0x79')][_0x1fbf8a]['foreignKey']));}}}if(_0x2d5c17[_0x9f80('0x80')]){_0x2d5c17[_0x9f80('0x80')]=JSON['parse'](_0x2d5c17[_0x9f80('0x80')]);_0x1d8c4c[_0x9f80('0x3f')](_0x573710(_0x2d5c17['conditions']['group']));}_0x2060dd=_0x1d8c4c[_0x9f80('0x8e')]();_0x1d8c4c[_0x9f80('0x3c')](_0x20602f);_0x1d8c4c[_0x9f80('0x1e')](0x0);logger[_0x9f80('0xa3')](_0x9f80('0xa4'),_0x1d8c4c[_0x9f80('0x82')]());return dbH['sequelize']['query'](_0x1d8c4c[_0x9f80('0x82')](),{'type':dbH['sequelize'][_0x9f80('0x83')]['SELECT']});}})[_0x9f80('0x25')](function(){return{'sql':_0x2060dd[_0x9f80('0x82')]()};})['then'](respondWithResult(_0x2f27bb,null))[_0x9f80('0x4a')](handleError(_0x2f27bb,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index ddad665..0c533a1 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 _0xb282=['rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x29f941,_0x2d3ec6){var _0x44ddd7=function(_0x3efcaf){while(--_0x3efcaf){_0x29f941['push'](_0x29f941['shift']());}};_0x44ddd7(++_0x2d3ec6);}(_0xb282,0xa2));var _0x2b28=function(_0x1937c8,_0x5a1f28){_0x1937c8=_0x1937c8-0x0;var _0x48bedf=_0xb282[_0x1937c8];return _0x48bedf;};'use strict';var _=require(_0x2b28('0x0'));var util=require(_0x2b28('0x1'));var logger=require(_0x2b28('0x2'))(_0x2b28('0x3'));var moment=require(_0x2b28('0x4'));var BPromise=require(_0x2b28('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2b28('0x6'));var config=require(_0x2b28('0x7'));var attributes=require(_0x2b28('0x8'));module[_0x2b28('0x9')]=function(_0x470002,_0x513b81){return _0x470002[_0x2b28('0xa')]('AnalyticCustomReport',attributes,{'tableName':_0x2b28('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cb8=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','define','analytics_custom_reports','lodash','../../config/logger','api','moment'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x0cb8,0x1e8));var _0x80cb=function(_0x2c6b2e,_0x48c4b7){_0x2c6b2e=_0x2c6b2e-0x0;var _0x13334b=_0x0cb8[_0x2c6b2e];return _0x13334b;};'use strict';var _=require(_0x80cb('0x0'));var util=require('util');var logger=require(_0x80cb('0x1'))(_0x80cb('0x2'));var moment=require(_0x80cb('0x3'));var BPromise=require(_0x80cb('0x4'));var rp=require(_0x80cb('0x5'));var fs=require('fs');var path=require(_0x80cb('0x6'));var rimraf=require(_0x80cb('0x7'));var config=require(_0x80cb('0x8'));var attributes=require(_0x80cb('0x9'));module['exports']=function(_0x5b7ebb,_0x22cc46){return _0x5b7ebb[_0x80cb('0xa')]('AnalyticCustomReport',attributes,{'tableName':_0x80cb('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 9517fc5..e1cb394 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 _0x2218=['message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x2cc711,_0x300328){var _0x31a52e=function(_0x588378){while(--_0x588378){_0x2cc711['push'](_0x2cc711['shift']());}};_0x31a52e(++_0x300328);}(_0x2218,0xd5));var _0x8221=function(_0x4a93bb,_0x495404){_0x4a93bb=_0x4a93bb-0x0;var _0x208468=_0x2218[_0x4a93bb];return _0x208468;};'use strict';var _=require(_0x8221('0x0'));var util=require(_0x8221('0x1'));var moment=require(_0x8221('0x2'));var BPromise=require('bluebird');var rs=require(_0x8221('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8221('0x4'))['db'];var utils=require(_0x8221('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x8221('0x6'));var jayson=require(_0x8221('0x7'));var client=jayson['client'][_0x8221('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a8c2f,_0x1e55e9,_0x868b3d){return new BPromise(function(_0x580d88,_0x16f9f8){return client[_0x8221('0x9')](_0x2a8c2f,_0x868b3d)['then'](function(_0x59fe00){logger[_0x8221('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1e55e9,_0x8221('0xb'));logger[_0x8221('0xc')](_0x8221('0xd'),_0x1e55e9,_0x8221('0xb'),JSON[_0x8221('0xe')](_0x59fe00));if(_0x59fe00['error']){if(_0x59fe00[_0x8221('0xf')][_0x8221('0x10')]===0x1f4){logger[_0x8221('0xf')](_0x8221('0x11'),_0x1e55e9,_0x59fe00[_0x8221('0xf')][_0x8221('0x12')]);return _0x16f9f8(_0x59fe00['error'][_0x8221('0x12')]);}logger[_0x8221('0xf')](_0x8221('0x11'),_0x1e55e9,_0x59fe00['error'][_0x8221('0x12')]);return _0x580d88(_0x59fe00[_0x8221('0xf')][_0x8221('0x12')]);}else{logger[_0x8221('0xa')](_0x8221('0x11'),_0x1e55e9,_0x8221('0xb'));_0x580d88(_0x59fe00[_0x8221('0x13')][_0x8221('0x12')]);}})[_0x8221('0x14')](function(_0x27b7bc){logger[_0x8221('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1e55e9,_0x27b7bc);_0x16f9f8(_0x27b7bc);});});} \ No newline at end of file +var _0xabe3=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash'];(function(_0x50fc35,_0x82b3c6){var _0x4e7e3b=function(_0x4853f9){while(--_0x4853f9){_0x50fc35['push'](_0x50fc35['shift']());}};_0x4e7e3b(++_0x82b3c6);}(_0xabe3,0x179));var _0x3abe=function(_0x50e35a,_0x411d04){_0x50e35a=_0x50e35a-0x0;var _0x11f81c=_0xabe3[_0x50e35a];return _0x11f81c;};'use strict';var _=require(_0x3abe('0x0'));var util=require('util');var moment=require(_0x3abe('0x1'));var BPromise=require(_0x3abe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3abe('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3abe('0x4'));var logger=require(_0x3abe('0x5'))(_0x3abe('0x6'));var config=require('../../config/environment');var jayson=require(_0x3abe('0x7'));var client=jayson[_0x3abe('0x8')][_0x3abe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5353e7,_0x1fa945,_0x27d115){return new BPromise(function(_0x48d11f,_0x57cd7a){return client[_0x3abe('0xa')](_0x5353e7,_0x27d115)[_0x3abe('0xb')](function(_0x33a5b0){logger[_0x3abe('0xc')](_0x3abe('0xd'),_0x1fa945,_0x3abe('0xe'));logger[_0x3abe('0xf')](_0x3abe('0x10'),_0x1fa945,_0x3abe('0xe'),JSON['stringify'](_0x33a5b0));if(_0x33a5b0['error']){if(_0x33a5b0[_0x3abe('0x11')]['code']===0x1f4){logger['error'](_0x3abe('0xd'),_0x1fa945,_0x33a5b0['error'][_0x3abe('0x12')]);return _0x57cd7a(_0x33a5b0[_0x3abe('0x11')][_0x3abe('0x12')]);}logger['error'](_0x3abe('0xd'),_0x1fa945,_0x33a5b0[_0x3abe('0x11')][_0x3abe('0x12')]);return _0x48d11f(_0x33a5b0['error']['message']);}else{logger[_0x3abe('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1fa945,_0x3abe('0xe'));_0x48d11f(_0x33a5b0[_0x3abe('0x13')][_0x3abe('0x12')]);}})[_0x3abe('0x14')](function(_0x47fa6d){logger[_0x3abe('0x11')](_0x3abe('0xd'),_0x1fa945,_0x47fa6d);_0x57cd7a(_0x47fa6d);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 8caf7b5..81452f5 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 _0xa8e2=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','update','exports','multer','path'];(function(_0x4a96ca,_0x13754e){var _0x2aed48=function(_0x361330){while(--_0x361330){_0x4a96ca['push'](_0x4a96ca['shift']());}};_0x2aed48(++_0x13754e);}(_0xa8e2,0x14e));var _0x2a8e=function(_0x149c38,_0x500868){_0x149c38=_0x149c38-0x0;var _0x698e2b=_0xa8e2[_0x149c38];return _0x698e2b;};'use strict';var multer=require(_0x2a8e('0x0'));var util=require('util');var path=require(_0x2a8e('0x1'));var timeout=require(_0x2a8e('0x2'));var express=require(_0x2a8e('0x3'));var router=express[_0x2a8e('0x4')]();var fs_extra=require(_0x2a8e('0x5'));var auth=require(_0x2a8e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2a8e('0x7'));var controller=require(_0x2a8e('0x8'));router[_0x2a8e('0x9')]('/',auth[_0x2a8e('0xa')](),controller[_0x2a8e('0xb')]);router[_0x2a8e('0x9')](_0x2a8e('0xc'),auth[_0x2a8e('0xa')](),controller[_0x2a8e('0xd')]);router['get'](_0x2a8e('0xe'),auth['isAuthenticated'](),controller[_0x2a8e('0xf')]);router[_0x2a8e('0x9')](_0x2a8e('0x10'),auth['isAuthenticated'](),controller[_0x2a8e('0x11')]);router['get'](_0x2a8e('0x12'),auth['isAuthenticated'](),controller[_0x2a8e('0x13')]);router[_0x2a8e('0x14')]('/',auth[_0x2a8e('0xa')](),controller[_0x2a8e('0x15')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2a8e('0x16')]);router['delete'](_0x2a8e('0xc'),auth[_0x2a8e('0xa')](),controller['destroy']);module[_0x2a8e('0x17')]=router; \ No newline at end of file +var _0xd2fd=['create','put','update','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','/:id/query','post'];(function(_0x423c1f,_0x4c42ee){var _0x28350f=function(_0x92ea1f){while(--_0x92ea1f){_0x423c1f['push'](_0x423c1f['shift']());}};_0x28350f(++_0x4c42ee);}(_0xd2fd,0x145));var _0xdd2f=function(_0x52b43b,_0x54c708){_0x52b43b=_0x52b43b-0x0;var _0x4e2b86=_0xd2fd[_0x52b43b];return _0x4e2b86;};'use strict';var multer=require(_0xdd2f('0x0'));var util=require('util');var path=require(_0xdd2f('0x1'));var timeout=require('connect-timeout');var express=require(_0xdd2f('0x2'));var router=express[_0xdd2f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdd2f('0x4'));var interaction=require(_0xdd2f('0x5'));var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router[_0xdd2f('0x6')]('/',auth[_0xdd2f('0x7')](),controller[_0xdd2f('0x8')]);router['get'](_0xdd2f('0x9'),auth[_0xdd2f('0x7')](),controller[_0xdd2f('0xa')]);router['get'](_0xdd2f('0xb'),auth[_0xdd2f('0x7')](),controller['preview']);router[_0xdd2f('0x6')](_0xdd2f('0xc'),auth[_0xdd2f('0x7')](),controller['run']);router[_0xdd2f('0x6')](_0xdd2f('0xd'),auth['isAuthenticated'](),controller['query']);router[_0xdd2f('0xe')]('/',auth[_0xdd2f('0x7')](),controller[_0xdd2f('0xf')]);router[_0xdd2f('0x10')](_0xdd2f('0x9'),auth[_0xdd2f('0x7')](),controller[_0xdd2f('0x11')]);router['delete'](_0xdd2f('0x9'),auth['isAuthenticated'](),controller[_0xdd2f('0x12')]);module[_0xdd2f('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index be1a58c..ea6f018 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 _0xda74=['exports','STRING','TEXT','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xda74,0x10f));var _0x4da7=function(_0x1b054b,_0x7b351c){_0x1b054b=_0x1b054b-0x0;var _0x12d3fd=_0xda74[_0x1b054b];return _0x12d3fd;};'use strict';var Sequelize=require(_0x4da7('0x0'));module[_0x4da7('0x1')]={'name':{'type':Sequelize[_0x4da7('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4da7('0x2')]},'parent':{'type':Sequelize[_0x4da7('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x4da7('0x3')]},'joins':{'type':Sequelize[_0x4da7('0x3')]}}; \ No newline at end of file +var _0x3541=['sequelize','exports','STRING','TEXT'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x3541,0x148));var _0x1354=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x3541[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x1354('0x0'));module[_0x1354('0x1')]={'name':{'type':Sequelize[_0x1354('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1354('0x2')]},'parent':{'type':Sequelize[_0x1354('0x2')]},'table':{'type':Sequelize[_0x1354('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x1354('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 6db54cb..b664c77 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 _0x3e69=['error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Reports','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','left_join','right_join','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','order','DESC','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','SUM(%s)','COUNT(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','AnalyticMetric','metric','alias','output','web','%s-%s.%s','randomstring','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','COUNT(DISTINCT\x20%s)','IS\x20EMPTY','debug','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','UserProfileResource'];(function(_0x30caf2,_0x2a3393){var _0x41be98=function(_0x1abc7f){while(--_0x1abc7f){_0x30caf2['push'](_0x30caf2['shift']());}};_0x41be98(++_0x2a3393);}(_0x3e69,0x127));var _0x93e6=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0x3e69[_0x26b80e];return _0x84a8a8;};'use strict';var emlformat=require(_0x93e6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x93e6('0x1'));var jsonpatch=require(_0x93e6('0x2'));var rp=require(_0x93e6('0x3'));var moment=require(_0x93e6('0x4'));var BPromise=require(_0x93e6('0x5'));var Mustache=require(_0x93e6('0x6'));var util=require(_0x93e6('0x7'));var path=require(_0x93e6('0x8'));var sox=require(_0x93e6('0x9'));var csv=require(_0x93e6('0xa'));var ejs=require(_0x93e6('0xb'));var fs=require('fs');var fs_extra=require(_0x93e6('0xc'));var _=require(_0x93e6('0xd'));var squel=require(_0x93e6('0xe'));var crypto=require(_0x93e6('0xf'));var jsforce=require(_0x93e6('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x93e6('0xa'));var querystring=require(_0x93e6('0x11'));var Papa=require('papaparse');var Redis=require(_0x93e6('0x12'));var authService=require(_0x93e6('0x13'));var qs=require(_0x93e6('0x14'));var as=require(_0x93e6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x93e6('0x16'))(_0x93e6('0x17'));var utils=require('../../config/utils');var config=require(_0x93e6('0x18'));var licenseUtil=require(_0x93e6('0x19'));var db=require(_0x93e6('0x1a'))['db'];var dbH=require('../../mysqldb')[_0x93e6('0x1b')];function respondWithStatusCode(_0x28547e,_0x4131d5){_0x4131d5=_0x4131d5||0xcc;return function(_0x307026){if(_0x307026){return _0x28547e[_0x93e6('0x1c')](_0x4131d5);}return _0x28547e[_0x93e6('0x1d')](_0x4131d5)[_0x93e6('0x1e')]();};}function respondWithResult(_0x37bd5c,_0x312713){_0x312713=_0x312713||0xc8;return function(_0x106f67){if(_0x106f67){return _0x37bd5c[_0x93e6('0x1d')](_0x312713)[_0x93e6('0x1f')](_0x106f67);}};}function respondWithFilteredResult(_0xdec86d,_0x170ae1){return function(_0x519a70){if(_0x519a70){var _0x99da14=_0x519a70[_0x93e6('0x20')],_0x1d4dac=_0x170ae1[_0x93e6('0x21')],_0x17cf34=_0x170ae1[_0x93e6('0x21')]+_0x170ae1[_0x93e6('0x22')],_0x4db659;if(_0x17cf34>=_0x99da14){_0x17cf34=_0x99da14;_0x4db659=0xc8;}else{_0x4db659=0xce;}_0xdec86d['status'](_0x4db659);return _0xdec86d[_0x93e6('0x23')](_0x93e6('0x24'),_0x1d4dac+'-'+_0x17cf34+'/'+_0x99da14)['json'](_0x519a70);}return null;};}function patchUpdates(_0x5444ff){return function(_0x15524c){try{jsonpatch[_0x93e6('0x25')](_0x15524c,_0x5444ff,!![]);}catch(_0xf41ade){return BPromise[_0x93e6('0x26')](_0xf41ade);}return _0x15524c['save']();};}function saveUpdates(_0x137e5a,_0x26556b){return function(_0x507390){if(_0x507390){return _0x507390[_0x93e6('0x27')](_0x137e5a)[_0x93e6('0x28')](function(_0x4e8c2a){return _0x4e8c2a;});}return null;};}function removeEntity(_0x498175,_0x3e8311){return function(_0x39648f){if(_0x39648f){return _0x39648f[_0x93e6('0x29')]()['then'](function(){var _0x37cfe1=_0x39648f['get']({'plain':!![]});var _0x1ebc21='DefaultReports';return db[_0x93e6('0x2a')][_0x93e6('0x29')]({'where':{'type':_0x1ebc21,'resourceId':_0x37cfe1['id']}})[_0x93e6('0x28')](function(){return _0x39648f;});})[_0x93e6('0x28')](function(){_0x498175[_0x93e6('0x1d')](0xcc)[_0x93e6('0x1e')]();});}};}function handleEntityNotFound(_0x26b9ef,_0x3032b9){return function(_0x4d0618){if(!_0x4d0618){_0x26b9ef[_0x93e6('0x1c')](0x194);}return _0x4d0618;};}function handleError(_0x478f72,_0x4b3278){_0x4b3278=_0x4b3278||0x1f4;return function(_0x2fa744){logger[_0x93e6('0x2b')](_0x2fa744[_0x93e6('0x2c')]);if(_0x2fa744[_0x93e6('0x2d')]){delete _0x2fa744[_0x93e6('0x2d')];}_0x478f72[_0x93e6('0x1d')](_0x4b3278)[_0x93e6('0x2e')](_0x2fa744);};}exports[_0x93e6('0x2f')]=function(_0x135bc5,_0x7deeca){var _0x44fa26={},_0x148a0c={},_0x4af489={'count':0x0,'rows':[]};var _0x2a0f7a=_[_0x93e6('0x30')](db[_0x93e6('0x31')][_0x93e6('0x32')],function(_0x445c74){return{'name':_0x445c74[_0x93e6('0x33')],'type':_0x445c74[_0x93e6('0x34')][_0x93e6('0x35')]};});_0x148a0c['model']=_[_0x93e6('0x30')](_0x2a0f7a,_0x93e6('0x2d'));_0x148a0c[_0x93e6('0x36')]=_[_0x93e6('0x37')](_0x135bc5[_0x93e6('0x36')]);_0x148a0c['filters']=_['intersection'](_0x148a0c[_0x93e6('0x38')],_0x148a0c['query']);_0x44fa26['attributes']=_[_0x93e6('0x39')](_0x148a0c[_0x93e6('0x38')],qs[_0x93e6('0x3a')](_0x135bc5[_0x93e6('0x36')]['fields']));_0x44fa26[_0x93e6('0x3b')]=_0x44fa26[_0x93e6('0x3b')][_0x93e6('0x3c')]?_0x44fa26['attributes']:_0x148a0c[_0x93e6('0x38')];if(!_0x135bc5[_0x93e6('0x36')][_0x93e6('0x3d')](_0x93e6('0x3e'))){_0x44fa26[_0x93e6('0x22')]=qs[_0x93e6('0x22')](_0x135bc5['query'][_0x93e6('0x22')]);_0x44fa26[_0x93e6('0x21')]=qs[_0x93e6('0x21')](_0x135bc5[_0x93e6('0x36')]['offset']);}_0x44fa26['order']=qs[_0x93e6('0x3f')](_0x135bc5[_0x93e6('0x36')]['sort']);_0x44fa26[_0x93e6('0x40')]=qs[_0x93e6('0x41')](_[_0x93e6('0x42')](_0x135bc5[_0x93e6('0x36')],_0x148a0c['filters']),_0x2a0f7a);if(_0x135bc5[_0x93e6('0x36')][_0x93e6('0x43')]){_0x44fa26[_0x93e6('0x40')]=_[_0x93e6('0x44')](_0x44fa26[_0x93e6('0x40')],{'$or':_['map'](_0x2a0f7a,function(_0x17ca19){if(_0x17ca19['type']!==_0x93e6('0x45')){var _0x384d1a={};_0x384d1a[_0x17ca19[_0x93e6('0x2d')]]={'$like':'%'+_0x135bc5[_0x93e6('0x36')][_0x93e6('0x43')]+'%'};return _0x384d1a;}})});}_0x44fa26=_['merge']({},_0x44fa26,_0x135bc5[_0x93e6('0x46')]);var _0xb908b0={'where':_0x44fa26['where']};return db[_0x93e6('0x31')][_0x93e6('0x20')](_0xb908b0)[_0x93e6('0x28')](function(_0x376c21){_0x4af489[_0x93e6('0x20')]=_0x376c21;if(_0x135bc5[_0x93e6('0x36')][_0x93e6('0x47')]){_0x44fa26['include']=[{'all':!![]}];}return db[_0x93e6('0x31')][_0x93e6('0x48')](_0x44fa26);})[_0x93e6('0x28')](function(_0x4c88f7){_0x4af489['rows']=_0x4c88f7;return _0x4af489;})[_0x93e6('0x28')](respondWithFilteredResult(_0x7deeca,_0x44fa26))['catch'](handleError(_0x7deeca,null));};exports[_0x93e6('0x49')]=function(_0x11422a,_0x3f90f2){var _0x3047ba={'raw':!![],'where':{'id':_0x11422a[_0x93e6('0x4a')]['id']}},_0x3d121b={};_0x3d121b['model']=_[_0x93e6('0x37')](db[_0x93e6('0x31')][_0x93e6('0x32')]);_0x3d121b['query']=_[_0x93e6('0x37')](_0x11422a[_0x93e6('0x36')]);_0x3d121b[_0x93e6('0x41')]=_[_0x93e6('0x39')](_0x3d121b[_0x93e6('0x38')],_0x3d121b[_0x93e6('0x36')]);_0x3047ba['attributes']=_[_0x93e6('0x39')](_0x3d121b['model'],qs[_0x93e6('0x3a')](_0x11422a['query'][_0x93e6('0x3a')]));_0x3047ba[_0x93e6('0x3b')]=_0x3047ba[_0x93e6('0x3b')][_0x93e6('0x3c')]?_0x3047ba[_0x93e6('0x3b')]:_0x3d121b[_0x93e6('0x38')];if(_0x11422a[_0x93e6('0x36')]['includeAll']){_0x3047ba[_0x93e6('0x4b')]=[{'all':!![]}];}_0x3047ba=_[_0x93e6('0x44')]({},_0x3047ba,_0x11422a[_0x93e6('0x46')]);return db[_0x93e6('0x31')]['find'](_0x3047ba)[_0x93e6('0x28')](handleEntityNotFound(_0x3f90f2,null))[_0x93e6('0x28')](respondWithResult(_0x3f90f2,null))['catch'](handleError(_0x3f90f2,null));};exports[_0x93e6('0x4c')]=function(_0x61416b,_0x536060){return db[_0x93e6('0x31')][_0x93e6('0x4c')](_0x61416b[_0x93e6('0x4d')],{})['then'](function(_0x59e716){var _0x2fbc9a=_0x61416b['user']['get']({'plain':!![]});if(!_0x2fbc9a)throw new Error(_0x93e6('0x4e'));if(_0x2fbc9a[_0x93e6('0x4f')]==='user'){var _0x446ec8=_0x59e716[_0x93e6('0x50')]({'plain':!![]});var _0x1eb90a=_0x93e6('0x51');return db[_0x93e6('0x52')][_0x93e6('0x53')]({'where':{'name':_0x1eb90a,'userProfileId':_0x2fbc9a[_0x93e6('0x54')]},'raw':!![]})[_0x93e6('0x28')](function(_0x5a633a){if(_0x5a633a&&_0x5a633a['autoAssociation']===0x0){return db[_0x93e6('0x2a')][_0x93e6('0x4c')]({'name':_0x446ec8[_0x93e6('0x2d')],'resourceId':_0x446ec8['id'],'type':'DefaultReports','sectionId':_0x5a633a['id']},{})[_0x93e6('0x28')](function(){return _0x59e716;});}else{return _0x59e716;}})['catch'](function(_0x5547da){logger['error'](_0x93e6('0x55'),_0x5547da);throw _0x5547da;});}return _0x59e716;})[_0x93e6('0x28')](respondWithResult(_0x536060,0xc9))[_0x93e6('0x56')](handleError(_0x536060,null));};exports[_0x93e6('0x27')]=function(_0x5b9ee0,_0x55ecda){if(_0x5b9ee0[_0x93e6('0x4d')]['id']){delete _0x5b9ee0[_0x93e6('0x4d')]['id'];}return db['AnalyticDefaultReport'][_0x93e6('0x53')]({'where':{'id':_0x5b9ee0[_0x93e6('0x4a')]['id']}})[_0x93e6('0x28')](handleEntityNotFound(_0x55ecda,null))[_0x93e6('0x28')](saveUpdates(_0x5b9ee0[_0x93e6('0x4d')],null))[_0x93e6('0x28')](respondWithResult(_0x55ecda,null))[_0x93e6('0x56')](handleError(_0x55ecda,null));};exports[_0x93e6('0x29')]=function(_0x58ac5f,_0x17dcc7){return db['AnalyticDefaultReport']['find']({'where':{'id':_0x58ac5f[_0x93e6('0x4a')]['id']}})[_0x93e6('0x28')](handleEntityNotFound(_0x17dcc7,null))[_0x93e6('0x28')](removeEntity(_0x17dcc7,null))['catch'](handleError(_0x17dcc7,null));};exports['preview']=function(_0x365a17,_0x2c0ab6){var _0x3d4802=0xa;var _0x12b252=['join',_0x93e6('0x57'),_0x93e6('0x58'),'cross_join'];var _0x459ad1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x93e6('0x59'),'MIN':_0x93e6('0x5a'),'AVG':_0x93e6('0x5b'),'GROUP_CONCAT':_0x93e6('0x5c'),'GROUP_CONCAT ASC':_0x93e6('0x5d'),'GROUP_CONCAT DESC':_0x93e6('0x5e')};var _0x1101e3={'SEC_TO_TIME':_0x93e6('0x5f'),'DATE':_0x93e6('0x60'),'HOUR':_0x93e6('0x61'),'ROUND':_0x93e6('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2bee2d=function(_0x28d42e){return!_[_0x93e6('0x63')]([_0x93e6('0x64'),_0x93e6('0x65'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x28d42e);};var _0xbc21d2=function(_0x497730){if(!_0x497730||!_0x497730[_0x93e6('0x66')][_0x93e6('0x3c')]){return'';}for(var _0x25b67c='(',_0x47f6c7=0x0;_0x47f6c7<_0x497730[_0x93e6('0x66')]['length'];_0x47f6c7+=0x1){_0x47f6c7>0x0&&(_0x25b67c+='\x20'+_0x497730[_0x93e6('0x67')]+'\x20');_0x25b67c+=_0x497730[_0x93e6('0x66')][_0x47f6c7][_0x93e6('0x68')]?_0xbc21d2(_0x497730[_0x93e6('0x66')][_0x47f6c7]['group']):_0x497730[_0x93e6('0x66')][_0x47f6c7][_0x93e6('0x69')]+'\x20'+_0x497730[_0x93e6('0x66')][_0x47f6c7][_0x93e6('0x6a')]+(_0x2bee2d(_0x497730[_0x93e6('0x66')][_0x47f6c7][_0x93e6('0x6a')])?'\x20'+_0x497730['rules'][_0x47f6c7][_0x93e6('0x6b')]:'');}return _0x25b67c+')';};var _0x2cb581={'where':{'id':_0x365a17[_0x93e6('0x4a')]['id']}},_0x2e547b,_0x299d5c,_0x19ee80,_0x2cbe47,_0x160782;_0x2cb581=_[_0x93e6('0x44')]({},_0x2cb581,_0x365a17[_0x93e6('0x46')]);return db[_0x93e6('0x31')]['find'](_0x2cb581)[_0x93e6('0x28')](function(_0x1f9609){if(_0x1f9609){_0x2e547b=_0x1f9609;return _0x1f9609[_0x93e6('0x6c')]();}return null;})['then'](function(_0xd59d2c){if(_0xd59d2c){if(!_0xd59d2c[_0x93e6('0x3c')]){throw new db[(_0x93e6('0x6d'))][(_0x93e6('0x6e'))](_0x93e6('0x6f'),0x193);}_0x299d5c=_0xd59d2c;return db['AnalyticMetric'][_0x93e6('0x48')]({'raw':!![]});}return null;})[_0x93e6('0x28')](function(_0x3fd632){if(_0x3fd632){_0x19ee80=_[_0x93e6('0x70')](_0x3fd632,'id');var _0x5235c0;var _0x3bd064=squel[_0x93e6('0x71')]();_0x3bd064[_0x93e6('0x72')](_0x2e547b[_0x93e6('0x73')]);for(var _0xa8b018=0x0;_0xa8b018<_0x299d5c[_0x93e6('0x3c')];_0xa8b018+=0x1){_0x5235c0=_0x299d5c[_0xa8b018][_0x93e6('0x74')]?_0x19ee80[_0x299d5c[_0xa8b018][_0x93e6('0x74')]]['metric']:_0x299d5c[_0xa8b018][_0x93e6('0x69')];_0x5235c0=_0x299d5c[_0xa8b018][_0x93e6('0x75')]?_[_0x93e6('0x76')](_0x459ad1[_0x299d5c[_0xa8b018][_0x93e6('0x75')]],'%s',_0x5235c0):_0x5235c0;_0x5235c0=_0x299d5c[_0xa8b018][_0x93e6('0x77')]?_[_0x93e6('0x76')](_0x1101e3[_0x299d5c[_0xa8b018][_0x93e6('0x77')]],'%s',_0x5235c0):_0x5235c0;if(_0x299d5c[_0xa8b018][_0x93e6('0x78')]){_0x3bd064[_0x93e6('0x68')](_0x5235c0);}_0x299d5c[_0xa8b018][_0x93e6('0x79')]&&_0x3bd064[_0x93e6('0x7a')](_0x5235c0,_0x299d5c[_0xa8b018][_0x93e6('0x79')]===_0x93e6('0x7b')?![]:!![]);_0x3bd064[_0x93e6('0x69')](_0x5235c0,_0x299d5c[_0xa8b018]['alias']||_0x5235c0);}if(_0x2e547b[_0x93e6('0x7c')]){_0x2e547b[_0x93e6('0x7c')]=JSON['parse'](_0x2e547b[_0x93e6('0x7c')]);for(var _0x1c6546=0x0;_0x1c6546<_0x2e547b[_0x93e6('0x7c')][_0x93e6('0x3c')];_0x1c6546+=0x1){if(_0x2e547b['joins'][_0x1c6546]['type']&&_['includes'](_0x12b252,_0x2e547b[_0x93e6('0x7c')][_0x1c6546][_0x93e6('0x34')])&&_0x2e547b[_0x93e6('0x7c')][_0x1c6546][_0x93e6('0x7d')]&&_0x2e547b[_0x93e6('0x7c')][_0x1c6546][_0x93e6('0x7e')]&&_0x2e547b['joins'][_0x1c6546][_0x93e6('0x7f')]){_0x3bd064[_0x2e547b[_0x93e6('0x7c')][_0x1c6546][_0x93e6('0x34')]](_0x2e547b['joins'][_0x1c6546]['foreignTable'],null,util['format'](_0x93e6('0x80'),_0x2e547b['table'],_0x2e547b['joins'][_0x1c6546][_0x93e6('0x7d')],_0x2e547b[_0x93e6('0x7c')][_0x1c6546]['foreignTable'],_0x2e547b['joins'][_0x1c6546][_0x93e6('0x7f')]));}}}if(_0x2e547b[_0x93e6('0x81')]){_0x2e547b[_0x93e6('0x81')]=JSON[_0x93e6('0x82')](_0x2e547b[_0x93e6('0x81')]);_0x3bd064[_0x93e6('0x40')](_0xbc21d2(_0x2e547b[_0x93e6('0x81')]['group']));}_0x160782=_0x3bd064[_0x93e6('0x83')]();_0x3bd064[_0x93e6('0x22')](_0x3d4802);_0x3bd064[_0x93e6('0x21')](0x0);logger['debug'](_0x93e6('0x84'),_0x3bd064[_0x93e6('0x85')]());return dbH['sequelize']['query'](_0x3bd064[_0x93e6('0x85')](),{'type':dbH[_0x93e6('0x86')][_0x93e6('0x87')][_0x93e6('0x88')]});}})[_0x93e6('0x28')](respondWithResult(_0x2c0ab6,null))[_0x93e6('0x56')](handleError(_0x2c0ab6,null));};function runReport(_0x3cdf9f,_0x4f6048,_0x5741a3){var _0x4e9e92=_0x4f6048[_0x93e6('0x2d')];var _0x1cf807=0xa;var _0x1de0c9=[_0x93e6('0x89'),'left_join',_0x93e6('0x58'),'cross_join'];var _0x4eded6={'SUM':_0x93e6('0x8a'),'COUNT':_0x93e6('0x8b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x93e6('0x59'),'MIN':_0x93e6('0x5a'),'AVG':_0x93e6('0x5b'),'GROUP_CONCAT':_0x93e6('0x5c'),'GROUP_CONCAT ASC':_0x93e6('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x529642={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x93e6('0x61'),'ROUND':_0x93e6('0x62'),'UNIX_TIMESTAMP':_0x93e6('0x8c')};var _0x4e220c=function(_0xb5f88e){return!_[_0x93e6('0x63')]([_0x93e6('0x64'),_0x93e6('0x65'),'IS\x20EMPTY',_0x93e6('0x8d')],_0xb5f88e);};var _0x439c93=function(_0x36ed2c){if(!_0x36ed2c||!_0x36ed2c[_0x93e6('0x66')][_0x93e6('0x3c')]){return'';}for(var _0x4fa751='(',_0x47bd0c=0x0;_0x47bd0c<_0x36ed2c[_0x93e6('0x66')]['length'];_0x47bd0c+=0x1){_0x47bd0c>0x0&&(_0x4fa751+='\x20'+_0x36ed2c[_0x93e6('0x67')]+'\x20');_0x4fa751+=_0x36ed2c['rules'][_0x47bd0c]['group']?_0x439c93(_0x36ed2c[_0x93e6('0x66')][_0x47bd0c][_0x93e6('0x68')]):_0x36ed2c[_0x93e6('0x66')][_0x47bd0c][_0x93e6('0x69')]+'\x20'+_0x36ed2c[_0x93e6('0x66')][_0x47bd0c][_0x93e6('0x6a')]+(_0x4e220c(_0x36ed2c[_0x93e6('0x66')][_0x47bd0c]['condition'])?'\x20'+_0x36ed2c[_0x93e6('0x66')][_0x47bd0c]['value']:'');}return _0x4fa751+')';};var _0x27a61e={'where':{'id':_0x3cdf9f['id']}},_0xcdbf83,_0x21c957,_0x19cf63,_0x107b35,_0x3a0aba;_0x27a61e=_[_0x93e6('0x44')]({},_0x27a61e,_0x5741a3);return db['AnalyticDefaultReport'][_0x93e6('0x53')](_0x27a61e)[_0x93e6('0x28')](function(_0x59f931){if(_0x59f931){_0xcdbf83=_0x59f931;return _0x59f931['getFields']();}return null;})[_0x93e6('0x28')](function(_0x94393e){if(_0x94393e){if(!_0x94393e[_0x93e6('0x3c')]){throw new db[(_0x93e6('0x6d'))][(_0x93e6('0x6e'))](_0x93e6('0x6f'),0x193);}_0x21c957=_0x94393e;return db[_0x93e6('0x8e')][_0x93e6('0x48')]({'raw':!![]});}return null;})['then'](function(_0x258fc0){if(_0x258fc0){_0x19cf63=_[_0x93e6('0x70')](_0x258fc0,'id');var _0x45c7a3;var _0x41ec13=squel[_0x93e6('0x71')]();_0x41ec13[_0x93e6('0x72')](_0xcdbf83[_0x93e6('0x73')]);for(var _0x75fb1d=0x0;_0x75fb1d<_0x21c957[_0x93e6('0x3c')];_0x75fb1d+=0x1){_0x45c7a3=_0x21c957[_0x75fb1d]['MetricId']?_0x19cf63[_0x21c957[_0x75fb1d][_0x93e6('0x74')]][_0x93e6('0x8f')]:_0x21c957[_0x75fb1d][_0x93e6('0x69')];_0x45c7a3=_0x21c957[_0x75fb1d][_0x93e6('0x75')]?_[_0x93e6('0x76')](_0x4eded6[_0x21c957[_0x75fb1d]['function']],'%s',_0x45c7a3):_0x45c7a3;_0x45c7a3=_0x21c957[_0x75fb1d][_0x93e6('0x77')]?_[_0x93e6('0x76')](_0x529642[_0x21c957[_0x75fb1d][_0x93e6('0x77')]],'%s',_0x45c7a3):_0x45c7a3;if(_0x21c957[_0x75fb1d][_0x93e6('0x78')]){_0x41ec13[_0x93e6('0x68')](_0x45c7a3);}_0x21c957[_0x75fb1d][_0x93e6('0x79')]&&_0x41ec13[_0x93e6('0x7a')](_0x45c7a3,_0x21c957[_0x75fb1d]['orderBy']===_0x93e6('0x7b')?![]:!![]);_0x41ec13[_0x93e6('0x69')](_0x45c7a3,_0x21c957[_0x75fb1d][_0x93e6('0x90')]||_0x45c7a3);}if(_0xcdbf83[_0x93e6('0x7c')]){_0xcdbf83[_0x93e6('0x7c')]=JSON[_0x93e6('0x82')](_0xcdbf83[_0x93e6('0x7c')]);for(var _0x3b1ba3=0x0;_0x3b1ba3<_0xcdbf83[_0x93e6('0x7c')][_0x93e6('0x3c')];_0x3b1ba3+=0x1){if(_0xcdbf83[_0x93e6('0x7c')][_0x3b1ba3][_0x93e6('0x34')]&&_['includes'](_0x1de0c9,_0xcdbf83[_0x93e6('0x7c')][_0x3b1ba3][_0x93e6('0x34')])&&_0xcdbf83['joins'][_0x3b1ba3][_0x93e6('0x7d')]&&_0xcdbf83['joins'][_0x3b1ba3]['foreignTable']&&_0xcdbf83['joins'][_0x3b1ba3][_0x93e6('0x7f')]){_0x41ec13[_0xcdbf83['joins'][_0x3b1ba3]['type']](_0xcdbf83['joins'][_0x3b1ba3][_0x93e6('0x7e')],null,util[_0x93e6('0x77')]('%s.%s\x20=\x20%s.%s',_0xcdbf83['table'],_0xcdbf83[_0x93e6('0x7c')][_0x3b1ba3]['parentKey'],_0xcdbf83[_0x93e6('0x7c')][_0x3b1ba3][_0x93e6('0x7e')],_0xcdbf83[_0x93e6('0x7c')][_0x3b1ba3][_0x93e6('0x7f')]));}}}if(_0xcdbf83[_0x93e6('0x81')]){_0xcdbf83[_0x93e6('0x81')]=JSON[_0x93e6('0x82')](_0xcdbf83[_0x93e6('0x81')]);_0x41ec13[_0x93e6('0x40')](_0x439c93(_0xcdbf83[_0x93e6('0x81')][_0x93e6('0x68')]));}_0x3a0aba=_0x41ec13[_0x93e6('0x83')]();_0x41ec13[_0x93e6('0x22')](_0x1cf807);_0x41ec13[_0x93e6('0x21')](0x0);return;}})[_0x93e6('0x28')](function(){if(_0x4f6048[_0x93e6('0x91')]===_0x93e6('0x92')){return null;}var _0x509332=_['merge'](_0x4f6048,{'name':_0x4f6048['fullPath']||_0x4f6048[_0x93e6('0x2d')]||_0xcdbf83[_0x93e6('0x2d')],'basename':_0x4e9e92,'savename':util[_0x93e6('0x77')](_0x93e6('0x93'),_0x4f6048[_0x93e6('0x2d')]||_0xcdbf83['name'],require(_0x93e6('0x94'))['generate'](0x4),_0x4f6048[_0x93e6('0x91')]||'csv'),'reportId':_0xcdbf83['id'],'reportType':_0x93e6('0x95')});return db[_0x93e6('0x96')][_0x93e6('0x4c')](_0x509332,{'raw':!![]});})['then'](function(_0x38b8a0){if(_0xcdbf83[_0x93e6('0x73')]===_0x93e6('0x97')){_0x3a0aba[_0x93e6('0x40')](_0xcdbf83[_0x93e6('0x73')]+_0x93e6('0x98'),_0x4f6048['startDate'],_0x4f6048[_0x93e6('0x99')]);}else{_0x3a0aba[_0x93e6('0x40')](_0xcdbf83[_0x93e6('0x73')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4f6048[_0x93e6('0x9a')],_0x4f6048[_0x93e6('0x99')]);}if(_0x38b8a0){logger[_0x93e6('0x9b')](_0x93e6('0x9c'),_0x3a0aba['toString']());require(_0x93e6('0x9d'))[_0x93e6('0x9e')](path[_0x93e6('0x89')](__dirname,_0x93e6('0x9f'),_0x38b8a0[_0x93e6('0x91')]),[_0x38b8a0['id'],_0x3a0aba[_0x93e6('0x85')](),path[_0x93e6('0x89')](__dirname,_0x93e6('0xa0'),_0x38b8a0[_0x93e6('0xa1')]),_0x4e9e92]);return _0x38b8a0;}else{var _0xfe05b3=squel[_0x93e6('0x71')]();_0xfe05b3[_0x93e6('0x72')]('('+_0x3a0aba['toString']()+')',_0x93e6('0xa2'));_0xfe05b3['field'](_0x93e6('0xa3'),'count');_0x3a0aba[_0x93e6('0x22')](_0x4f6048['limit']||_0x1cf807);_0x3a0aba[_0x93e6('0x21')](_0x4f6048[_0x93e6('0x21')]||0x0);return dbH[_0x93e6('0x86')][_0x93e6('0x36')](_0xfe05b3[_0x93e6('0x85')](),{'type':dbH['sequelize'][_0x93e6('0x87')][_0x93e6('0x88')]})[_0x93e6('0x28')](function(_0x27f1c9){if(!_0x27f1c9['length']){_0x107b35=0x0;}else{_0x107b35=_0x27f1c9[0x0][_0x93e6('0x20')]||0x0;}return dbH[_0x93e6('0x86')][_0x93e6('0x36')](_0x3a0aba[_0x93e6('0x85')](),{'type':dbH['sequelize'][_0x93e6('0x87')][_0x93e6('0x88')]});})[_0x93e6('0x28')](function(_0x384160){return{'rows':_0x384160||[],'count':_0x107b35};});}});}exports[_0x93e6('0xa4')]=function(_0x3d9fc9,_0x15d4d4){return runReport(_0x3d9fc9[_0x93e6('0x4a')],_0x3d9fc9['query'],_0x3d9fc9[_0x93e6('0x46')])[_0x93e6('0x28')](respondWithResult(_0x15d4d4,null))[_0x93e6('0x56')](handleError(_0x15d4d4,null));};exports[_0x93e6('0xa5')]=runReport;exports[_0x93e6('0x36')]=function(_0xa2c319,_0x387a9d){var _0x10c026=0xa;var _0x5dfb83=[_0x93e6('0x89'),_0x93e6('0x57'),_0x93e6('0x58'),'cross_join'];var _0x210213={'SUM':_0x93e6('0x8a'),'COUNT':_0x93e6('0x8b'),'COUNT DISTINCT':_0x93e6('0xa6'),'MAX':_0x93e6('0x59'),'MIN':_0x93e6('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x93e6('0x5d'),'GROUP_CONCAT DESC':_0x93e6('0x5e')};var _0x1b5f66={'SEC_TO_TIME':_0x93e6('0x5f'),'DATE':_0x93e6('0x60'),'HOUR':_0x93e6('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x93e6('0x8c')};var _0x5c96b8=function(_0x11665c){return!_['includes']([_0x93e6('0x64'),_0x93e6('0x65'),_0x93e6('0xa7'),_0x93e6('0x8d')],_0x11665c);};var _0x2997e8=function(_0x220734){if(!_0x220734||!_0x220734['rules']['length']){return'';}for(var _0x4e0e46='(',_0x3e2574=0x0;_0x3e2574<_0x220734[_0x93e6('0x66')][_0x93e6('0x3c')];_0x3e2574+=0x1){_0x3e2574>0x0&&(_0x4e0e46+='\x20'+_0x220734[_0x93e6('0x67')]+'\x20');_0x4e0e46+=_0x220734['rules'][_0x3e2574][_0x93e6('0x68')]?_0x2997e8(_0x220734['rules'][_0x3e2574][_0x93e6('0x68')]):_0x220734[_0x93e6('0x66')][_0x3e2574][_0x93e6('0x69')]+'\x20'+_0x220734[_0x93e6('0x66')][_0x3e2574][_0x93e6('0x6a')]+(_0x5c96b8(_0x220734[_0x93e6('0x66')][_0x3e2574][_0x93e6('0x6a')])?'\x20'+_0x220734[_0x93e6('0x66')][_0x3e2574][_0x93e6('0x6b')]:'');}return _0x4e0e46+')';};var _0x3f4aee={'where':{'id':_0xa2c319['params']['id']}},_0x2bd635,_0x15cf9e,_0x1e8265,_0x1d4f72,_0x231d29;_0x3f4aee=_[_0x93e6('0x44')]({},_0x3f4aee,_0xa2c319['options']);return db[_0x93e6('0x31')]['find'](_0x3f4aee)[_0x93e6('0x28')](function(_0x357216){if(_0x357216){_0x2bd635=_0x357216;return _0x357216[_0x93e6('0x6c')]();}return null;})[_0x93e6('0x28')](function(_0x87b04f){if(_0x87b04f){if(!_0x87b04f[_0x93e6('0x3c')]){throw new db[(_0x93e6('0x6d'))][(_0x93e6('0x6e'))](_0x93e6('0x6f'),0x193);}_0x15cf9e=_0x87b04f;return db[_0x93e6('0x8e')]['findAll']({'raw':!![]});}return null;})[_0x93e6('0x28')](function(_0x21a926){if(_0x21a926){_0x1e8265=_[_0x93e6('0x70')](_0x21a926,'id');var _0x559545;var _0x16ba37=squel[_0x93e6('0x71')]();_0x16ba37[_0x93e6('0x72')](_0x2bd635[_0x93e6('0x73')]);for(var _0x5035a5=0x0;_0x5035a5<_0x15cf9e['length'];_0x5035a5+=0x1){_0x559545=_0x15cf9e[_0x5035a5][_0x93e6('0x74')]?_0x1e8265[_0x15cf9e[_0x5035a5][_0x93e6('0x74')]][_0x93e6('0x8f')]:_0x15cf9e[_0x5035a5][_0x93e6('0x69')];_0x559545=_0x15cf9e[_0x5035a5][_0x93e6('0x75')]?_['replace'](_0x210213[_0x15cf9e[_0x5035a5][_0x93e6('0x75')]],'%s',_0x559545):_0x559545;_0x559545=_0x15cf9e[_0x5035a5][_0x93e6('0x77')]?_[_0x93e6('0x76')](_0x1b5f66[_0x15cf9e[_0x5035a5]['format']],'%s',_0x559545):_0x559545;if(_0x15cf9e[_0x5035a5][_0x93e6('0x78')]){_0x16ba37[_0x93e6('0x68')](_0x559545);}_0x15cf9e[_0x5035a5]['orderBy']&&_0x16ba37[_0x93e6('0x7a')](_0x559545,_0x15cf9e[_0x5035a5][_0x93e6('0x79')]===_0x93e6('0x7b')?![]:!![]);_0x16ba37[_0x93e6('0x69')](_0x559545,_0x15cf9e[_0x5035a5][_0x93e6('0x90')]||_0x559545);}if(_0x2bd635[_0x93e6('0x7c')]){_0x2bd635[_0x93e6('0x7c')]=JSON['parse'](_0x2bd635[_0x93e6('0x7c')]);for(var _0x2cda3b=0x0;_0x2cda3b<_0x2bd635[_0x93e6('0x7c')]['length'];_0x2cda3b+=0x1){if(_0x2bd635[_0x93e6('0x7c')][_0x2cda3b][_0x93e6('0x34')]&&_[_0x93e6('0x63')](_0x5dfb83,_0x2bd635['joins'][_0x2cda3b][_0x93e6('0x34')])&&_0x2bd635[_0x93e6('0x7c')][_0x2cda3b]['parentKey']&&_0x2bd635[_0x93e6('0x7c')][_0x2cda3b]['foreignTable']&&_0x2bd635['joins'][_0x2cda3b][_0x93e6('0x7f')]){_0x16ba37[_0x2bd635['joins'][_0x2cda3b][_0x93e6('0x34')]](_0x2bd635[_0x93e6('0x7c')][_0x2cda3b][_0x93e6('0x7e')],null,util[_0x93e6('0x77')]('%s.%s\x20=\x20%s.%s',_0x2bd635[_0x93e6('0x73')],_0x2bd635[_0x93e6('0x7c')][_0x2cda3b][_0x93e6('0x7d')],_0x2bd635['joins'][_0x2cda3b][_0x93e6('0x7e')],_0x2bd635['joins'][_0x2cda3b][_0x93e6('0x7f')]));}}}if(_0x2bd635['conditions']){_0x2bd635['conditions']=JSON[_0x93e6('0x82')](_0x2bd635[_0x93e6('0x81')]);_0x16ba37[_0x93e6('0x40')](_0x2997e8(_0x2bd635['conditions'][_0x93e6('0x68')]));}_0x231d29=_0x16ba37[_0x93e6('0x83')]();_0x16ba37['limit'](_0x10c026);_0x16ba37['offset'](0x0);logger[_0x93e6('0xa8')](_0x93e6('0x84'),_0x16ba37[_0x93e6('0x85')]());return dbH['sequelize']['query'](_0x16ba37[_0x93e6('0x85')](),{'type':dbH[_0x93e6('0x86')]['QueryTypes'][_0x93e6('0x88')]});}})[_0x93e6('0x28')](function(){return{'sql':_0x231d29['toString']()};})[_0x93e6('0x28')](respondWithResult(_0x387a9d,null))[_0x93e6('0x56')](handleError(_0x387a9d,null));}; \ No newline at end of file +var _0x71b0=['destroy','get','UserProfileResource','error','stack','name','send','AnalyticDefaultReport','type','key','map','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','includeAll','find','create','body','user','role','autoAssociation','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','MetricId','function','replace','groupBy','orderBy','DESC','alias','joins','parse','includes','foreignTable','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','cross_join','IS\x20NOT\x20EMPTY','Please\x20insert\x20at\x20least\x20one\x20field','from','format','foreignKey','output','web','fullPath','%s-%s.%s','generate','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','run','runReport','right_join','UNIX_TIMESTAMP(%s)','metric','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','count','offset','set','Content-Range','json','reject','save','update','then'];(function(_0x55d4cc,_0x32ba7c){var _0x2ed472=function(_0x2ffdac){while(--_0x2ffdac){_0x55d4cc['push'](_0x55d4cc['shift']());}};_0x2ed472(++_0x32ba7c);}(_0x71b0,0x1c2));var _0x071b=function(_0x515de7,_0x3338af){_0x515de7=_0x515de7-0x0;var _0x47ff49=_0x71b0[_0x515de7];return _0x47ff49;};'use strict';var emlformat=require(_0x071b('0x0'));var rimraf=require(_0x071b('0x1'));var zipdir=require(_0x071b('0x2'));var jsonpatch=require(_0x071b('0x3'));var rp=require('request-promise');var moment=require(_0x071b('0x4'));var BPromise=require(_0x071b('0x5'));var Mustache=require(_0x071b('0x6'));var util=require(_0x071b('0x7'));var path=require('path');var sox=require(_0x071b('0x8'));var csv=require('to-csv');var ejs=require(_0x071b('0x9'));var fs=require('fs');var fs_extra=require(_0x071b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x071b('0xb'));var jsforce=require(_0x071b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x071b('0xd'));var Papa=require('papaparse');var Redis=require(_0x071b('0xe'));var authService=require(_0x071b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x071b('0x10'));var hardwareService=require(_0x071b('0x11'));var logger=require('../../config/logger')(_0x071b('0x12'));var utils=require(_0x071b('0x13'));var config=require(_0x071b('0x14'));var licenseUtil=require(_0x071b('0x15'));var db=require(_0x071b('0x16'))['db'];var dbH=require('../../mysqldb')[_0x071b('0x17')];function respondWithStatusCode(_0x29dfec,_0x5e303f){_0x5e303f=_0x5e303f||0xcc;return function(_0x3951d4){if(_0x3951d4){return _0x29dfec[_0x071b('0x18')](_0x5e303f);}return _0x29dfec[_0x071b('0x19')](_0x5e303f)[_0x071b('0x1a')]();};}function respondWithResult(_0x593cc5,_0x416eea){_0x416eea=_0x416eea||0xc8;return function(_0x4ff057){if(_0x4ff057){return _0x593cc5[_0x071b('0x19')](_0x416eea)['json'](_0x4ff057);}};}function respondWithFilteredResult(_0x1ed56f,_0x228d84){return function(_0x20b663){if(_0x20b663){var _0x1e26ba=_0x20b663[_0x071b('0x1b')],_0x18ee17=_0x228d84['offset'],_0x10f3bb=_0x228d84[_0x071b('0x1c')]+_0x228d84['limit'],_0x3634c1;if(_0x10f3bb>=_0x1e26ba){_0x10f3bb=_0x1e26ba;_0x3634c1=0xc8;}else{_0x3634c1=0xce;}_0x1ed56f[_0x071b('0x19')](_0x3634c1);return _0x1ed56f[_0x071b('0x1d')](_0x071b('0x1e'),_0x18ee17+'-'+_0x10f3bb+'/'+_0x1e26ba)[_0x071b('0x1f')](_0x20b663);}return null;};}function patchUpdates(_0x3d3601){return function(_0x5d725b){try{jsonpatch['apply'](_0x5d725b,_0x3d3601,!![]);}catch(_0x118c77){return BPromise[_0x071b('0x20')](_0x118c77);}return _0x5d725b[_0x071b('0x21')]();};}function saveUpdates(_0x581e9b,_0x229cf1){return function(_0x37cfb5){if(_0x37cfb5){return _0x37cfb5[_0x071b('0x22')](_0x581e9b)[_0x071b('0x23')](function(_0x26288a){return _0x26288a;});}return null;};}function removeEntity(_0xc8948d,_0xb6d48b){return function(_0x5c5ecb){if(_0x5c5ecb){return _0x5c5ecb[_0x071b('0x24')]()['then'](function(){var _0x4dcb5e=_0x5c5ecb[_0x071b('0x25')]({'plain':!![]});var _0x22bf99='DefaultReports';return db[_0x071b('0x26')][_0x071b('0x24')]({'where':{'type':_0x22bf99,'resourceId':_0x4dcb5e['id']}})['then'](function(){return _0x5c5ecb;});})[_0x071b('0x23')](function(){_0xc8948d[_0x071b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf0da98,_0x143f51){return function(_0x4db3a7){if(!_0x4db3a7){_0xf0da98[_0x071b('0x18')](0x194);}return _0x4db3a7;};}function handleError(_0x460847,_0x31bf56){_0x31bf56=_0x31bf56||0x1f4;return function(_0x11b493){logger[_0x071b('0x27')](_0x11b493[_0x071b('0x28')]);if(_0x11b493[_0x071b('0x29')]){delete _0x11b493[_0x071b('0x29')];}_0x460847[_0x071b('0x19')](_0x31bf56)[_0x071b('0x2a')](_0x11b493);};}exports['index']=function(_0x1f3aaf,_0x60d361){var _0xc0b397={},_0x4fe4cf={},_0x26ed49={'count':0x0,'rows':[]};var _0x5c1d7e=_['map'](db[_0x071b('0x2b')]['rawAttributes'],function(_0x4dde0d){return{'name':_0x4dde0d['fieldName'],'type':_0x4dde0d[_0x071b('0x2c')][_0x071b('0x2d')]};});_0x4fe4cf['model']=_[_0x071b('0x2e')](_0x5c1d7e,_0x071b('0x29'));_0x4fe4cf[_0x071b('0x2f')]=_['keys'](_0x1f3aaf['query']);_0x4fe4cf[_0x071b('0x30')]=_[_0x071b('0x31')](_0x4fe4cf['model'],_0x4fe4cf[_0x071b('0x2f')]);_0xc0b397[_0x071b('0x32')]=_[_0x071b('0x31')](_0x4fe4cf[_0x071b('0x33')],qs['fields'](_0x1f3aaf[_0x071b('0x2f')][_0x071b('0x34')]));_0xc0b397[_0x071b('0x32')]=_0xc0b397[_0x071b('0x32')][_0x071b('0x35')]?_0xc0b397['attributes']:_0x4fe4cf[_0x071b('0x33')];if(!_0x1f3aaf[_0x071b('0x2f')][_0x071b('0x36')](_0x071b('0x37'))){_0xc0b397[_0x071b('0x38')]=qs[_0x071b('0x38')](_0x1f3aaf[_0x071b('0x2f')][_0x071b('0x38')]);_0xc0b397[_0x071b('0x1c')]=qs['offset'](_0x1f3aaf[_0x071b('0x2f')][_0x071b('0x1c')]);}_0xc0b397[_0x071b('0x39')]=qs[_0x071b('0x3a')](_0x1f3aaf['query'][_0x071b('0x3a')]);_0xc0b397[_0x071b('0x3b')]=qs[_0x071b('0x30')](_[_0x071b('0x3c')](_0x1f3aaf[_0x071b('0x2f')],_0x4fe4cf[_0x071b('0x30')]),_0x5c1d7e);if(_0x1f3aaf[_0x071b('0x2f')][_0x071b('0x3d')]){_0xc0b397[_0x071b('0x3b')]=_[_0x071b('0x3e')](_0xc0b397['where'],{'$or':_['map'](_0x5c1d7e,function(_0x5234c5){if(_0x5234c5['type']!==_0x071b('0x3f')){var _0x4b3026={};_0x4b3026[_0x5234c5['name']]={'$like':'%'+_0x1f3aaf[_0x071b('0x2f')][_0x071b('0x3d')]+'%'};return _0x4b3026;}})});}_0xc0b397=_['merge']({},_0xc0b397,_0x1f3aaf[_0x071b('0x40')]);var _0x1d56db={'where':_0xc0b397[_0x071b('0x3b')]};return db[_0x071b('0x2b')][_0x071b('0x1b')](_0x1d56db)[_0x071b('0x23')](function(_0x1cc669){_0x26ed49['count']=_0x1cc669;if(_0x1f3aaf['query']['includeAll']){_0xc0b397[_0x071b('0x41')]=[{'all':!![]}];}return db[_0x071b('0x2b')][_0x071b('0x42')](_0xc0b397);})[_0x071b('0x23')](function(_0x568f80){_0x26ed49['rows']=_0x568f80;return _0x26ed49;})['then'](respondWithFilteredResult(_0x60d361,_0xc0b397))[_0x071b('0x43')](handleError(_0x60d361,null));};exports[_0x071b('0x44')]=function(_0x4c4169,_0x173a2d){var _0x219373={'raw':!![],'where':{'id':_0x4c4169[_0x071b('0x45')]['id']}},_0x4985f9={};_0x4985f9[_0x071b('0x33')]=_[_0x071b('0x46')](db[_0x071b('0x2b')]['rawAttributes']);_0x4985f9[_0x071b('0x2f')]=_['keys'](_0x4c4169[_0x071b('0x2f')]);_0x4985f9[_0x071b('0x30')]=_[_0x071b('0x31')](_0x4985f9[_0x071b('0x33')],_0x4985f9[_0x071b('0x2f')]);_0x219373[_0x071b('0x32')]=_[_0x071b('0x31')](_0x4985f9['model'],qs[_0x071b('0x34')](_0x4c4169['query'][_0x071b('0x34')]));_0x219373['attributes']=_0x219373[_0x071b('0x32')][_0x071b('0x35')]?_0x219373[_0x071b('0x32')]:_0x4985f9['model'];if(_0x4c4169[_0x071b('0x2f')][_0x071b('0x47')]){_0x219373[_0x071b('0x41')]=[{'all':!![]}];}_0x219373=_['merge']({},_0x219373,_0x4c4169[_0x071b('0x40')]);return db['AnalyticDefaultReport'][_0x071b('0x48')](_0x219373)[_0x071b('0x23')](handleEntityNotFound(_0x173a2d,null))[_0x071b('0x23')](respondWithResult(_0x173a2d,null))['catch'](handleError(_0x173a2d,null));};exports[_0x071b('0x49')]=function(_0x58bc24,_0x141433){return db[_0x071b('0x2b')][_0x071b('0x49')](_0x58bc24[_0x071b('0x4a')],{})[_0x071b('0x23')](function(_0x510c77){var _0x189a2b=_0x58bc24[_0x071b('0x4b')][_0x071b('0x25')]({'plain':!![]});if(!_0x189a2b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x189a2b[_0x071b('0x4c')]===_0x071b('0x4b')){var _0x598d4a=_0x510c77[_0x071b('0x25')]({'plain':!![]});var _0x2081f9='Reports';return db['UserProfileSection']['find']({'where':{'name':_0x2081f9,'userProfileId':_0x189a2b['userProfileId']},'raw':!![]})[_0x071b('0x23')](function(_0x7390c1){if(_0x7390c1&&_0x7390c1[_0x071b('0x4d')]===0x0){return db['UserProfileResource'][_0x071b('0x49')]({'name':_0x598d4a[_0x071b('0x29')],'resourceId':_0x598d4a['id'],'type':_0x071b('0x4e'),'sectionId':_0x7390c1['id']},{})[_0x071b('0x23')](function(){return _0x510c77;});}else{return _0x510c77;}})[_0x071b('0x43')](function(_0x4a2462){logger['error'](_0x071b('0x4f'),_0x4a2462);throw _0x4a2462;});}return _0x510c77;})[_0x071b('0x23')](respondWithResult(_0x141433,0xc9))[_0x071b('0x43')](handleError(_0x141433,null));};exports[_0x071b('0x22')]=function(_0x519d3f,_0x227bfa){if(_0x519d3f[_0x071b('0x4a')]['id']){delete _0x519d3f[_0x071b('0x4a')]['id'];}return db['AnalyticDefaultReport'][_0x071b('0x48')]({'where':{'id':_0x519d3f[_0x071b('0x45')]['id']}})['then'](handleEntityNotFound(_0x227bfa,null))['then'](saveUpdates(_0x519d3f[_0x071b('0x4a')],null))[_0x071b('0x23')](respondWithResult(_0x227bfa,null))[_0x071b('0x43')](handleError(_0x227bfa,null));};exports[_0x071b('0x24')]=function(_0x3d890f,_0x56d022){return db[_0x071b('0x2b')][_0x071b('0x48')]({'where':{'id':_0x3d890f['params']['id']}})[_0x071b('0x23')](handleEntityNotFound(_0x56d022,null))[_0x071b('0x23')](removeEntity(_0x56d022,null))[_0x071b('0x43')](handleError(_0x56d022,null));};exports[_0x071b('0x50')]=function(_0x4aab0a,_0x582fc6){var _0x5c3b4f=0xa;var _0x14fcc3=[_0x071b('0x51'),_0x071b('0x52'),'right_join','cross_join'];var _0x19804a={'SUM':'SUM(%s)','COUNT':_0x071b('0x53'),'COUNT DISTINCT':_0x071b('0x54'),'MAX':_0x071b('0x55'),'MIN':_0x071b('0x56'),'AVG':_0x071b('0x57'),'GROUP_CONCAT':_0x071b('0x58'),'GROUP_CONCAT ASC':_0x071b('0x59'),'GROUP_CONCAT DESC':_0x071b('0x5a')};var _0xbf2dc7={'SEC_TO_TIME':_0x071b('0x5b'),'DATE':_0x071b('0x5c'),'HOUR':_0x071b('0x5d'),'ROUND':_0x071b('0x5e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x324049=function(_0xa79531){return!_['includes']([_0x071b('0x5f'),_0x071b('0x60'),_0x071b('0x61'),'IS\x20NOT\x20EMPTY'],_0xa79531);};var _0x460e9c=function(_0x597715){if(!_0x597715||!_0x597715['rules']['length']){return'';}for(var _0x462b77='(',_0x343624=0x0;_0x343624<_0x597715[_0x071b('0x62')][_0x071b('0x35')];_0x343624+=0x1){_0x343624>0x0&&(_0x462b77+='\x20'+_0x597715[_0x071b('0x63')]+'\x20');_0x462b77+=_0x597715[_0x071b('0x62')][_0x343624][_0x071b('0x64')]?_0x460e9c(_0x597715[_0x071b('0x62')][_0x343624][_0x071b('0x64')]):_0x597715[_0x071b('0x62')][_0x343624][_0x071b('0x65')]+'\x20'+_0x597715[_0x071b('0x62')][_0x343624]['condition']+(_0x324049(_0x597715['rules'][_0x343624][_0x071b('0x66')])?'\x20'+_0x597715['rules'][_0x343624][_0x071b('0x67')]:'');}return _0x462b77+')';};var _0x4893b4={'where':{'id':_0x4aab0a['params']['id']}},_0x1f8b51,_0x48e0b8,_0x168e6b,_0x2c6f04,_0x46d63f;_0x4893b4=_[_0x071b('0x3e')]({},_0x4893b4,_0x4aab0a[_0x071b('0x40')]);return db[_0x071b('0x2b')][_0x071b('0x48')](_0x4893b4)['then'](function(_0x4d31ff){if(_0x4d31ff){_0x1f8b51=_0x4d31ff;return _0x4d31ff[_0x071b('0x68')]();}return null;})['then'](function(_0x3736cb){if(_0x3736cb){if(!_0x3736cb[_0x071b('0x35')]){throw new db[(_0x071b('0x69'))][(_0x071b('0x6a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x48e0b8=_0x3736cb;return db[_0x071b('0x6b')][_0x071b('0x42')]({'raw':!![]});}return null;})['then'](function(_0x45a31){if(_0x45a31){_0x168e6b=_[_0x071b('0x6c')](_0x45a31,'id');var _0x4a6c33;var _0x1bb917=squel[_0x071b('0x6d')]();_0x1bb917['from'](_0x1f8b51['table']);for(var _0x41844a=0x0;_0x41844a<_0x48e0b8[_0x071b('0x35')];_0x41844a+=0x1){_0x4a6c33=_0x48e0b8[_0x41844a]['MetricId']?_0x168e6b[_0x48e0b8[_0x41844a][_0x071b('0x6e')]]['metric']:_0x48e0b8[_0x41844a][_0x071b('0x65')];_0x4a6c33=_0x48e0b8[_0x41844a][_0x071b('0x6f')]?_[_0x071b('0x70')](_0x19804a[_0x48e0b8[_0x41844a][_0x071b('0x6f')]],'%s',_0x4a6c33):_0x4a6c33;_0x4a6c33=_0x48e0b8[_0x41844a]['format']?_[_0x071b('0x70')](_0xbf2dc7[_0x48e0b8[_0x41844a]['format']],'%s',_0x4a6c33):_0x4a6c33;if(_0x48e0b8[_0x41844a][_0x071b('0x71')]){_0x1bb917[_0x071b('0x64')](_0x4a6c33);}_0x48e0b8[_0x41844a][_0x071b('0x72')]&&_0x1bb917['order'](_0x4a6c33,_0x48e0b8[_0x41844a][_0x071b('0x72')]===_0x071b('0x73')?![]:!![]);_0x1bb917['field'](_0x4a6c33,_0x48e0b8[_0x41844a][_0x071b('0x74')]||_0x4a6c33);}if(_0x1f8b51[_0x071b('0x75')]){_0x1f8b51[_0x071b('0x75')]=JSON[_0x071b('0x76')](_0x1f8b51['joins']);for(var _0x7b017b=0x0;_0x7b017b<_0x1f8b51[_0x071b('0x75')][_0x071b('0x35')];_0x7b017b+=0x1){if(_0x1f8b51[_0x071b('0x75')][_0x7b017b]['type']&&_[_0x071b('0x77')](_0x14fcc3,_0x1f8b51[_0x071b('0x75')][_0x7b017b]['type'])&&_0x1f8b51[_0x071b('0x75')][_0x7b017b]['parentKey']&&_0x1f8b51['joins'][_0x7b017b][_0x071b('0x78')]&&_0x1f8b51[_0x071b('0x75')][_0x7b017b]['foreignKey']){_0x1bb917[_0x1f8b51['joins'][_0x7b017b][_0x071b('0x2c')]](_0x1f8b51['joins'][_0x7b017b][_0x071b('0x78')],null,util['format'](_0x071b('0x79'),_0x1f8b51[_0x071b('0x7a')],_0x1f8b51[_0x071b('0x75')][_0x7b017b][_0x071b('0x7b')],_0x1f8b51[_0x071b('0x75')][_0x7b017b][_0x071b('0x78')],_0x1f8b51[_0x071b('0x75')][_0x7b017b]['foreignKey']));}}}if(_0x1f8b51['conditions']){_0x1f8b51[_0x071b('0x7c')]=JSON[_0x071b('0x76')](_0x1f8b51['conditions']);_0x1bb917[_0x071b('0x3b')](_0x460e9c(_0x1f8b51[_0x071b('0x7c')][_0x071b('0x64')]));}_0x46d63f=_0x1bb917[_0x071b('0x7d')]();_0x1bb917[_0x071b('0x38')](_0x5c3b4f);_0x1bb917[_0x071b('0x1c')](0x0);logger[_0x071b('0x7e')](_0x071b('0x7f'),_0x1bb917[_0x071b('0x80')]());return dbH[_0x071b('0x81')][_0x071b('0x2f')](_0x1bb917[_0x071b('0x80')](),{'type':dbH[_0x071b('0x81')]['QueryTypes'][_0x071b('0x82')]});}})[_0x071b('0x23')](respondWithResult(_0x582fc6,null))[_0x071b('0x43')](handleError(_0x582fc6,null));};function runReport(_0x470ace,_0x219592,_0x29123c){var _0x49ae4d=_0x219592[_0x071b('0x29')];var _0x220d62=0xa;var _0x3e36c3=['join',_0x071b('0x52'),'right_join',_0x071b('0x83')];var _0x486e61={'SUM':'SUM(%s)','COUNT':_0x071b('0x53'),'COUNT DISTINCT':_0x071b('0x54'),'MAX':_0x071b('0x55'),'MIN':_0x071b('0x56'),'AVG':_0x071b('0x57'),'GROUP_CONCAT':_0x071b('0x58'),'GROUP_CONCAT ASC':_0x071b('0x59'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x209be4={'SEC_TO_TIME':_0x071b('0x5b'),'DATE':_0x071b('0x5c'),'HOUR':_0x071b('0x5d'),'ROUND':_0x071b('0x5e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xd3c6d0=function(_0xca1b69){return!_[_0x071b('0x77')]([_0x071b('0x5f'),_0x071b('0x60'),_0x071b('0x61'),_0x071b('0x84')],_0xca1b69);};var _0x2448ea=function(_0x6a5e3f){if(!_0x6a5e3f||!_0x6a5e3f['rules']['length']){return'';}for(var _0x1ad17d='(',_0x4e4235=0x0;_0x4e4235<_0x6a5e3f[_0x071b('0x62')][_0x071b('0x35')];_0x4e4235+=0x1){_0x4e4235>0x0&&(_0x1ad17d+='\x20'+_0x6a5e3f[_0x071b('0x63')]+'\x20');_0x1ad17d+=_0x6a5e3f[_0x071b('0x62')][_0x4e4235][_0x071b('0x64')]?_0x2448ea(_0x6a5e3f['rules'][_0x4e4235][_0x071b('0x64')]):_0x6a5e3f[_0x071b('0x62')][_0x4e4235][_0x071b('0x65')]+'\x20'+_0x6a5e3f[_0x071b('0x62')][_0x4e4235][_0x071b('0x66')]+(_0xd3c6d0(_0x6a5e3f[_0x071b('0x62')][_0x4e4235][_0x071b('0x66')])?'\x20'+_0x6a5e3f[_0x071b('0x62')][_0x4e4235][_0x071b('0x67')]:'');}return _0x1ad17d+')';};var _0x1f7f78={'where':{'id':_0x470ace['id']}},_0x4acc6a,_0x529e96,_0x25f9af,_0x3efae7,_0x49938f;_0x1f7f78=_[_0x071b('0x3e')]({},_0x1f7f78,_0x29123c);return db['AnalyticDefaultReport']['find'](_0x1f7f78)[_0x071b('0x23')](function(_0x233731){if(_0x233731){_0x4acc6a=_0x233731;return _0x233731[_0x071b('0x68')]();}return null;})['then'](function(_0x3648c7){if(_0x3648c7){if(!_0x3648c7['length']){throw new db[(_0x071b('0x69'))]['ValidationErrorItem'](_0x071b('0x85'),0x193);}_0x529e96=_0x3648c7;return db[_0x071b('0x6b')]['findAll']({'raw':!![]});}return null;})[_0x071b('0x23')](function(_0x53eecb){if(_0x53eecb){_0x25f9af=_[_0x071b('0x6c')](_0x53eecb,'id');var _0x59828f;var _0x3a6d31=squel[_0x071b('0x6d')]();_0x3a6d31[_0x071b('0x86')](_0x4acc6a[_0x071b('0x7a')]);for(var _0x570ccb=0x0;_0x570ccb<_0x529e96[_0x071b('0x35')];_0x570ccb+=0x1){_0x59828f=_0x529e96[_0x570ccb][_0x071b('0x6e')]?_0x25f9af[_0x529e96[_0x570ccb]['MetricId']]['metric']:_0x529e96[_0x570ccb][_0x071b('0x65')];_0x59828f=_0x529e96[_0x570ccb]['function']?_[_0x071b('0x70')](_0x486e61[_0x529e96[_0x570ccb][_0x071b('0x6f')]],'%s',_0x59828f):_0x59828f;_0x59828f=_0x529e96[_0x570ccb]['format']?_[_0x071b('0x70')](_0x209be4[_0x529e96[_0x570ccb][_0x071b('0x87')]],'%s',_0x59828f):_0x59828f;if(_0x529e96[_0x570ccb][_0x071b('0x71')]){_0x3a6d31[_0x071b('0x64')](_0x59828f);}_0x529e96[_0x570ccb][_0x071b('0x72')]&&_0x3a6d31['order'](_0x59828f,_0x529e96[_0x570ccb][_0x071b('0x72')]===_0x071b('0x73')?![]:!![]);_0x3a6d31[_0x071b('0x65')](_0x59828f,_0x529e96[_0x570ccb][_0x071b('0x74')]||_0x59828f);}if(_0x4acc6a[_0x071b('0x75')]){_0x4acc6a[_0x071b('0x75')]=JSON[_0x071b('0x76')](_0x4acc6a[_0x071b('0x75')]);for(var _0x18ce79=0x0;_0x18ce79<_0x4acc6a['joins'][_0x071b('0x35')];_0x18ce79+=0x1){if(_0x4acc6a['joins'][_0x18ce79][_0x071b('0x2c')]&&_[_0x071b('0x77')](_0x3e36c3,_0x4acc6a[_0x071b('0x75')][_0x18ce79]['type'])&&_0x4acc6a[_0x071b('0x75')][_0x18ce79][_0x071b('0x7b')]&&_0x4acc6a['joins'][_0x18ce79][_0x071b('0x78')]&&_0x4acc6a[_0x071b('0x75')][_0x18ce79][_0x071b('0x88')]){_0x3a6d31[_0x4acc6a[_0x071b('0x75')][_0x18ce79][_0x071b('0x2c')]](_0x4acc6a['joins'][_0x18ce79][_0x071b('0x78')],null,util[_0x071b('0x87')](_0x071b('0x79'),_0x4acc6a[_0x071b('0x7a')],_0x4acc6a[_0x071b('0x75')][_0x18ce79][_0x071b('0x7b')],_0x4acc6a[_0x071b('0x75')][_0x18ce79][_0x071b('0x78')],_0x4acc6a[_0x071b('0x75')][_0x18ce79][_0x071b('0x88')]));}}}if(_0x4acc6a['conditions']){_0x4acc6a[_0x071b('0x7c')]=JSON['parse'](_0x4acc6a['conditions']);_0x3a6d31[_0x071b('0x3b')](_0x2448ea(_0x4acc6a[_0x071b('0x7c')][_0x071b('0x64')]));}_0x49938f=_0x3a6d31[_0x071b('0x7d')]();_0x3a6d31[_0x071b('0x38')](_0x220d62);_0x3a6d31[_0x071b('0x1c')](0x0);return;}})['then'](function(){if(_0x219592[_0x071b('0x89')]===_0x071b('0x8a')){return null;}var _0x57cc63=_[_0x071b('0x3e')](_0x219592,{'name':_0x219592[_0x071b('0x8b')]||_0x219592[_0x071b('0x29')]||_0x4acc6a[_0x071b('0x29')],'basename':_0x49ae4d,'savename':util[_0x071b('0x87')](_0x071b('0x8c'),_0x219592[_0x071b('0x29')]||_0x4acc6a[_0x071b('0x29')],require('randomstring')[_0x071b('0x8d')](0x4),_0x219592[_0x071b('0x89')]||'csv'),'reportId':_0x4acc6a['id'],'reportType':_0x071b('0x8e')});return db[_0x071b('0x8f')][_0x071b('0x49')](_0x57cc63,{'raw':!![]});})[_0x071b('0x23')](function(_0x29f7e2){if(_0x4acc6a[_0x071b('0x7a')]===_0x071b('0x90')){_0x49938f['where'](_0x4acc6a[_0x071b('0x7a')]+_0x071b('0x91'),_0x219592['startDate'],_0x219592[_0x071b('0x92')]);}else{_0x49938f[_0x071b('0x3b')](_0x4acc6a[_0x071b('0x7a')]+_0x071b('0x93'),_0x219592['startDate'],_0x219592[_0x071b('0x92')]);}if(_0x29f7e2){logger[_0x071b('0x94')](_0x071b('0x95'),_0x49938f[_0x071b('0x80')]());require(_0x071b('0x96'))[_0x071b('0x97')](path['join'](__dirname,'../../components/export/',_0x29f7e2[_0x071b('0x89')]),[_0x29f7e2['id'],_0x49938f[_0x071b('0x80')](),path[_0x071b('0x51')](__dirname,_0x071b('0x98'),_0x29f7e2[_0x071b('0x99')]),_0x49ae4d]);return _0x29f7e2;}else{var _0x597f7e=squel[_0x071b('0x6d')]();_0x597f7e[_0x071b('0x86')]('('+_0x49938f[_0x071b('0x80')]()+')',_0x071b('0x9a'));_0x597f7e[_0x071b('0x65')](_0x071b('0x9b'),_0x071b('0x1b'));_0x49938f[_0x071b('0x38')](_0x219592[_0x071b('0x38')]||_0x220d62);_0x49938f[_0x071b('0x1c')](_0x219592[_0x071b('0x1c')]||0x0);return dbH[_0x071b('0x81')][_0x071b('0x2f')](_0x597f7e[_0x071b('0x80')](),{'type':dbH[_0x071b('0x81')][_0x071b('0x9c')][_0x071b('0x82')]})[_0x071b('0x23')](function(_0x2a62f1){if(!_0x2a62f1[_0x071b('0x35')]){_0x3efae7=0x0;}else{_0x3efae7=_0x2a62f1[0x0][_0x071b('0x1b')]||0x0;}return dbH['sequelize']['query'](_0x49938f[_0x071b('0x80')](),{'type':dbH[_0x071b('0x81')]['QueryTypes'][_0x071b('0x82')]});})[_0x071b('0x23')](function(_0x4db412){return{'rows':_0x4db412||[],'count':_0x3efae7};});}});}exports[_0x071b('0x9d')]=function(_0x44f376,_0x251939){return runReport(_0x44f376[_0x071b('0x45')],_0x44f376[_0x071b('0x2f')],_0x44f376[_0x071b('0x40')])[_0x071b('0x23')](respondWithResult(_0x251939,null))['catch'](handleError(_0x251939,null));};exports[_0x071b('0x9e')]=runReport;exports[_0x071b('0x2f')]=function(_0x27aa5b,_0x1893a2){var _0x32cea3=0xa;var _0x315f18=[_0x071b('0x51'),'left_join',_0x071b('0x9f'),_0x071b('0x83')];var _0x20af17={'SUM':'SUM(%s)','COUNT':_0x071b('0x53'),'COUNT DISTINCT':_0x071b('0x54'),'MAX':_0x071b('0x55'),'MIN':_0x071b('0x56'),'AVG':_0x071b('0x57'),'GROUP_CONCAT':_0x071b('0x58'),'GROUP_CONCAT ASC':_0x071b('0x59'),'GROUP_CONCAT DESC':_0x071b('0x5a')};var _0x334a70={'SEC_TO_TIME':_0x071b('0x5b'),'DATE':_0x071b('0x5c'),'HOUR':_0x071b('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x071b('0xa0')};var _0x45363f=function(_0x469e88){return!_[_0x071b('0x77')]([_0x071b('0x5f'),'IS\x20NOT\x20NULL',_0x071b('0x61'),_0x071b('0x84')],_0x469e88);};var _0x5810c1=function(_0x1cc475){if(!_0x1cc475||!_0x1cc475['rules'][_0x071b('0x35')]){return'';}for(var _0x24a893='(',_0x6a9be9=0x0;_0x6a9be9<_0x1cc475['rules']['length'];_0x6a9be9+=0x1){_0x6a9be9>0x0&&(_0x24a893+='\x20'+_0x1cc475[_0x071b('0x63')]+'\x20');_0x24a893+=_0x1cc475[_0x071b('0x62')][_0x6a9be9][_0x071b('0x64')]?_0x5810c1(_0x1cc475[_0x071b('0x62')][_0x6a9be9][_0x071b('0x64')]):_0x1cc475['rules'][_0x6a9be9][_0x071b('0x65')]+'\x20'+_0x1cc475[_0x071b('0x62')][_0x6a9be9][_0x071b('0x66')]+(_0x45363f(_0x1cc475['rules'][_0x6a9be9][_0x071b('0x66')])?'\x20'+_0x1cc475[_0x071b('0x62')][_0x6a9be9][_0x071b('0x67')]:'');}return _0x24a893+')';};var _0x2020e7={'where':{'id':_0x27aa5b[_0x071b('0x45')]['id']}},_0x1a3c10,_0x2c3e18,_0x2c601e,_0x1c3b10,_0xbc8451;_0x2020e7=_[_0x071b('0x3e')]({},_0x2020e7,_0x27aa5b[_0x071b('0x40')]);return db[_0x071b('0x2b')][_0x071b('0x48')](_0x2020e7)[_0x071b('0x23')](function(_0x2d42a1){if(_0x2d42a1){_0x1a3c10=_0x2d42a1;return _0x2d42a1['getFields']();}return null;})[_0x071b('0x23')](function(_0x210b19){if(_0x210b19){if(!_0x210b19['length']){throw new db['Sequelize']['ValidationErrorItem'](_0x071b('0x85'),0x193);}_0x2c3e18=_0x210b19;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x17a8fe){if(_0x17a8fe){_0x2c601e=_['keyBy'](_0x17a8fe,'id');var _0x2feda5;var _0x1afe79=squel[_0x071b('0x6d')]();_0x1afe79['from'](_0x1a3c10['table']);for(var _0xd3414b=0x0;_0xd3414b<_0x2c3e18[_0x071b('0x35')];_0xd3414b+=0x1){_0x2feda5=_0x2c3e18[_0xd3414b][_0x071b('0x6e')]?_0x2c601e[_0x2c3e18[_0xd3414b][_0x071b('0x6e')]][_0x071b('0xa1')]:_0x2c3e18[_0xd3414b]['field'];_0x2feda5=_0x2c3e18[_0xd3414b]['function']?_[_0x071b('0x70')](_0x20af17[_0x2c3e18[_0xd3414b][_0x071b('0x6f')]],'%s',_0x2feda5):_0x2feda5;_0x2feda5=_0x2c3e18[_0xd3414b][_0x071b('0x87')]?_[_0x071b('0x70')](_0x334a70[_0x2c3e18[_0xd3414b]['format']],'%s',_0x2feda5):_0x2feda5;if(_0x2c3e18[_0xd3414b][_0x071b('0x71')]){_0x1afe79['group'](_0x2feda5);}_0x2c3e18[_0xd3414b]['orderBy']&&_0x1afe79[_0x071b('0x39')](_0x2feda5,_0x2c3e18[_0xd3414b]['orderBy']===_0x071b('0x73')?![]:!![]);_0x1afe79['field'](_0x2feda5,_0x2c3e18[_0xd3414b][_0x071b('0x74')]||_0x2feda5);}if(_0x1a3c10[_0x071b('0x75')]){_0x1a3c10[_0x071b('0x75')]=JSON[_0x071b('0x76')](_0x1a3c10[_0x071b('0x75')]);for(var _0x42b2f2=0x0;_0x42b2f2<_0x1a3c10[_0x071b('0x75')][_0x071b('0x35')];_0x42b2f2+=0x1){if(_0x1a3c10[_0x071b('0x75')][_0x42b2f2]['type']&&_[_0x071b('0x77')](_0x315f18,_0x1a3c10['joins'][_0x42b2f2][_0x071b('0x2c')])&&_0x1a3c10['joins'][_0x42b2f2][_0x071b('0x7b')]&&_0x1a3c10[_0x071b('0x75')][_0x42b2f2]['foreignTable']&&_0x1a3c10[_0x071b('0x75')][_0x42b2f2]['foreignKey']){_0x1afe79[_0x1a3c10['joins'][_0x42b2f2][_0x071b('0x2c')]](_0x1a3c10[_0x071b('0x75')][_0x42b2f2][_0x071b('0x78')],null,util[_0x071b('0x87')]('%s.%s\x20=\x20%s.%s',_0x1a3c10[_0x071b('0x7a')],_0x1a3c10[_0x071b('0x75')][_0x42b2f2][_0x071b('0x7b')],_0x1a3c10[_0x071b('0x75')][_0x42b2f2][_0x071b('0x78')],_0x1a3c10[_0x071b('0x75')][_0x42b2f2][_0x071b('0x88')]));}}}if(_0x1a3c10[_0x071b('0x7c')]){_0x1a3c10[_0x071b('0x7c')]=JSON[_0x071b('0x76')](_0x1a3c10[_0x071b('0x7c')]);_0x1afe79['where'](_0x5810c1(_0x1a3c10[_0x071b('0x7c')]['group']));}_0xbc8451=_0x1afe79[_0x071b('0x7d')]();_0x1afe79['limit'](_0x32cea3);_0x1afe79[_0x071b('0x1c')](0x0);logger[_0x071b('0x7e')]('Limited\x20Query:',_0x1afe79[_0x071b('0x80')]());return dbH[_0x071b('0x81')][_0x071b('0x2f')](_0x1afe79[_0x071b('0x80')](),{'type':dbH[_0x071b('0x81')][_0x071b('0x9c')][_0x071b('0x82')]});}})['then'](function(){return{'sql':_0xbc8451[_0x071b('0x80')]()};})[_0x071b('0x23')](respondWithResult(_0x1893a2,null))['catch'](handleError(_0x1893a2,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 5cd0460..5c02cf3 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 _0x7290=['../../config/environment','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x422711,_0x378994){var _0x34da3f=function(_0x18ee13){while(--_0x18ee13){_0x422711['push'](_0x422711['shift']());}};_0x34da3f(++_0x378994);}(_0x7290,0x184));var _0x0729=function(_0x28e5ef,_0x4e406f){_0x28e5ef=_0x28e5ef-0x0;var _0x128683=_0x7290[_0x28e5ef];return _0x128683;};'use strict';var _=require(_0x0729('0x0'));var util=require(_0x0729('0x1'));var logger=require(_0x0729('0x2'))(_0x0729('0x3'));var moment=require(_0x0729('0x4'));var BPromise=require(_0x0729('0x5'));var rp=require(_0x0729('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0729('0x7'));var config=require(_0x0729('0x8'));var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0x452cdc,_0x1cdf1f){return _0x452cdc[_0x0729('0x9')](_0x0729('0xa'),attributes,{'tableName':_0x0729('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf675=['AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./analyticDefaultReport.attributes','exports'];(function(_0x2a4c87,_0x6a425e){var _0x2933f2=function(_0x26a4f0){while(--_0x26a4f0){_0x2a4c87['push'](_0x2a4c87['shift']());}};_0x2933f2(++_0x6a425e);}(_0xf675,0x199));var _0x5f67=function(_0x367995,_0x129ae2){_0x367995=_0x367995-0x0;var _0x22daa8=_0xf675[_0x367995];return _0x22daa8;};'use strict';var _=require(_0x5f67('0x0'));var util=require(_0x5f67('0x1'));var logger=require(_0x5f67('0x2'))('api');var moment=require(_0x5f67('0x3'));var BPromise=require('bluebird');var rp=require(_0x5f67('0x4'));var fs=require('fs');var path=require(_0x5f67('0x5'));var rimraf=require(_0x5f67('0x6'));var config=require('../../config/environment');var attributes=require(_0x5f67('0x7'));module[_0x5f67('0x8')]=function(_0x2919cc,_0xd4b727){return _0x2919cc['define'](_0x5f67('0x9'),attributes,{'tableName':_0x5f67('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index e39350e..d658d38 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 _0x8109=['result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x8109,0xa9));var _0x9810=function(_0x223428,_0x2cc00a){_0x223428=_0x223428-0x0;var _0x4cd557=_0x8109[_0x223428];return _0x4cd557;};'use strict';var _=require(_0x9810('0x0'));var util=require('util');var moment=require(_0x9810('0x1'));var BPromise=require(_0x9810('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9810('0x3'));var db=require(_0x9810('0x4'))['db'];var utils=require(_0x9810('0x5'));var logger=require(_0x9810('0x6'))(_0x9810('0x7'));var config=require(_0x9810('0x8'));var jayson=require(_0x9810('0x9'));var client=jayson[_0x9810('0xa')][_0x9810('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x150e3f,_0x3f65e3,_0x5e367b){return new BPromise(function(_0x3b0e0d,_0xafe932){return client[_0x9810('0xc')](_0x150e3f,_0x5e367b)[_0x9810('0xd')](function(_0xd9e6d){logger['info'](_0x9810('0xe'),_0x3f65e3,_0x9810('0xf'));logger[_0x9810('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x3f65e3,_0x9810('0xf'),JSON['stringify'](_0xd9e6d));if(_0xd9e6d['error']){if(_0xd9e6d[_0x9810('0x11')][_0x9810('0x12')]===0x1f4){logger[_0x9810('0x11')](_0x9810('0xe'),_0x3f65e3,_0xd9e6d[_0x9810('0x11')][_0x9810('0x13')]);return _0xafe932(_0xd9e6d['error'][_0x9810('0x13')]);}logger[_0x9810('0x11')](_0x9810('0xe'),_0x3f65e3,_0xd9e6d[_0x9810('0x11')][_0x9810('0x13')]);return _0x3b0e0d(_0xd9e6d[_0x9810('0x11')][_0x9810('0x13')]);}else{logger['info'](_0x9810('0xe'),_0x3f65e3,_0x9810('0xf'));_0x3b0e0d(_0xd9e6d[_0x9810('0x14')][_0x9810('0x13')]);}})['catch'](function(_0x549cd8){logger[_0x9810('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3f65e3,_0x549cd8);_0xafe932(_0x549cd8);});});} \ No newline at end of file +var _0x05e3=['result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x167010,_0x5c8129){var _0xa943=function(_0x402050){while(--_0x402050){_0x167010['push'](_0x167010['shift']());}};_0xa943(++_0x5c8129);}(_0x05e3,0x86));var _0x305e=function(_0x77a0c1,_0x400923){_0x77a0c1=_0x77a0c1-0x0;var _0x1db8b8=_0x05e3[_0x77a0c1];return _0x1db8b8;};'use strict';var _=require(_0x305e('0x0'));var util=require(_0x305e('0x1'));var moment=require(_0x305e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x305e('0x3'));var db=require(_0x305e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x305e('0x5'))(_0x305e('0x6'));var config=require('../../config/environment');var jayson=require(_0x305e('0x7'));var client=jayson[_0x305e('0x8')][_0x305e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x143428,_0x72ac4b,_0x22b00b){return new BPromise(function(_0x86ade0,_0x952a5e){return client['request'](_0x143428,_0x22b00b)[_0x305e('0xa')](function(_0x4a66fd){logger[_0x305e('0xb')](_0x305e('0xc'),_0x72ac4b,'request\x20sent');logger[_0x305e('0xd')](_0x305e('0xe'),_0x72ac4b,_0x305e('0xf'),JSON[_0x305e('0x10')](_0x4a66fd));if(_0x4a66fd[_0x305e('0x11')]){if(_0x4a66fd[_0x305e('0x11')][_0x305e('0x12')]===0x1f4){logger[_0x305e('0x11')](_0x305e('0xc'),_0x72ac4b,_0x4a66fd[_0x305e('0x11')][_0x305e('0x13')]);return _0x952a5e(_0x4a66fd[_0x305e('0x11')]['message']);}logger[_0x305e('0x11')](_0x305e('0xc'),_0x72ac4b,_0x4a66fd['error'][_0x305e('0x13')]);return _0x86ade0(_0x4a66fd[_0x305e('0x11')][_0x305e('0x13')]);}else{logger[_0x305e('0xb')](_0x305e('0xc'),_0x72ac4b,_0x305e('0xf'));_0x86ade0(_0x4a66fd[_0x305e('0x14')]['message']);}})[_0x305e('0x15')](function(_0x455e78){logger['error'](_0x305e('0xc'),_0x72ac4b,_0x455e78);_0x952a5e(_0x455e78);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 87f6e9c..e9f1397 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 _0x73df=['./analyticDefaultReport.controller','get','/:id','isAuthenticated','show','preview','/:id/run','run','/:id/query','query','post','create','put','delete','exports','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1dcadb,_0x32f369){var _0x3b1cdc=function(_0x2e5d4d){while(--_0x2e5d4d){_0x1dcadb['push'](_0x1dcadb['shift']());}};_0x3b1cdc(++_0x32f369);}(_0x73df,0x9b));var _0xf73d=function(_0x4a471e,_0x3c45d0){_0x4a471e=_0x4a471e-0x0;var _0x5d3508=_0x73df[_0x4a471e];return _0x5d3508;};'use strict';var multer=require('multer');var util=require(_0xf73d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf73d('0x1')]();var fs_extra=require(_0xf73d('0x2'));var auth=require(_0xf73d('0x3'));var interaction=require(_0xf73d('0x4'));var config=require('../../config/environment');var controller=require(_0xf73d('0x5'));router[_0xf73d('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf73d('0x7'),auth[_0xf73d('0x8')](),controller[_0xf73d('0x9')]);router[_0xf73d('0x6')]('/:id/preview',auth[_0xf73d('0x8')](),controller[_0xf73d('0xa')]);router[_0xf73d('0x6')](_0xf73d('0xb'),auth['isAuthenticated'](),controller[_0xf73d('0xc')]);router[_0xf73d('0x6')](_0xf73d('0xd'),auth[_0xf73d('0x8')](),controller[_0xf73d('0xe')]);router[_0xf73d('0xf')]('/',auth[_0xf73d('0x8')](),controller[_0xf73d('0x10')]);router[_0xf73d('0x11')](_0xf73d('0x7'),auth[_0xf73d('0x8')](),controller['update']);router[_0xf73d('0x12')](_0xf73d('0x7'),auth[_0xf73d('0x8')](),controller['destroy']);module[_0xf73d('0x13')]=router; \ No newline at end of file +var _0x9a95=['/:id/query','query','post','put','update','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/preview','preview'];(function(_0x53707c,_0x314341){var _0x5b1796=function(_0x49c726){while(--_0x49c726){_0x53707c['push'](_0x53707c['shift']());}};_0x5b1796(++_0x314341);}(_0x9a95,0x1bf));var _0x59a9=function(_0x2dbb6f,_0x4b8197){_0x2dbb6f=_0x2dbb6f-0x0;var _0x1cc1be=_0x9a95[_0x2dbb6f];return _0x1cc1be;};'use strict';var multer=require(_0x59a9('0x0'));var util=require('util');var path=require(_0x59a9('0x1'));var timeout=require(_0x59a9('0x2'));var express=require(_0x59a9('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x59a9('0x4'));var interaction=require(_0x59a9('0x5'));var config=require(_0x59a9('0x6'));var controller=require('./analyticDefaultReport.controller');router[_0x59a9('0x7')]('/',auth[_0x59a9('0x8')](),controller[_0x59a9('0x9')]);router[_0x59a9('0x7')](_0x59a9('0xa'),auth[_0x59a9('0x8')](),controller['show']);router[_0x59a9('0x7')](_0x59a9('0xb'),auth['isAuthenticated'](),controller[_0x59a9('0xc')]);router['get']('/:id/run',auth['isAuthenticated'](),controller['run']);router[_0x59a9('0x7')](_0x59a9('0xd'),auth['isAuthenticated'](),controller[_0x59a9('0xe')]);router[_0x59a9('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x59a9('0x10')]('/:id',auth[_0x59a9('0x8')](),controller[_0x59a9('0x11')]);router[_0x59a9('0x12')](_0x59a9('0xa'),auth['isAuthenticated'](),controller[_0x59a9('0x13')]);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 4890adc..e762280 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 _0x98f6=['DATE','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','pdf','xlsx','csv'];(function(_0x489c95,_0x53159c){var _0x10e7a7=function(_0xcb4342){while(--_0xcb4342){_0x489c95['push'](_0x489c95['shift']());}};_0x10e7a7(++_0x53159c);}(_0x98f6,0x94));var _0x698f=function(_0x59710f,_0x44c7f0){_0x59710f=_0x59710f-0x0;var _0xaae66a=_0x98f6[_0x59710f];return _0xaae66a;};'use strict';var Sequelize=require(_0x698f('0x0'));var moment=require(_0x698f('0x1'));module[_0x698f('0x2')]={'name':{'type':Sequelize[_0x698f('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x698f('0x4')]('csv',_0x698f('0x5'),_0x698f('0x6')),'allowNull':![],'defaultValue':_0x698f('0x7')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x698f('0x8')]},'endDate':{'type':Sequelize[_0x698f('0x8')]},'status':{'type':Sequelize[_0x698f('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x698f('0x4')](_0x698f('0x9'),_0x698f('0xa')),'allowNull':![],'defaultValue':_0x698f('0x9')},'reportId':{'type':Sequelize[_0x698f('0xb')](0xb)[_0x698f('0xc')]},'reportType':{'type':Sequelize[_0x698f('0x3')]}}; \ No newline at end of file +var _0x9c10=['pdf','xlsx','DATE','Loading','manual','scheduled','sequelize','moment','exports','STRING','ENUM','csv'];(function(_0x163a52,_0x512f07){var _0x275a0c=function(_0x2fb6df){while(--_0x2fb6df){_0x163a52['push'](_0x163a52['shift']());}};_0x275a0c(++_0x512f07);}(_0x9c10,0x162));var _0x09c1=function(_0x17b9e2,_0x3921fa){_0x17b9e2=_0x17b9e2-0x0;var _0x4335d2=_0x9c10[_0x17b9e2];return _0x4335d2;};'use strict';var Sequelize=require(_0x09c1('0x0'));var moment=require(_0x09c1('0x1'));module[_0x09c1('0x2')]={'name':{'type':Sequelize[_0x09c1('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x09c1('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x09c1('0x4')](_0x09c1('0x5'),_0x09c1('0x6'),_0x09c1('0x7')),'allowNull':![],'defaultValue':_0x09c1('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x09c1('0x8')]},'endDate':{'type':Sequelize[_0x09c1('0x8')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x09c1('0x9')},'type':{'type':Sequelize[_0x09c1('0x4')](_0x09c1('0xa'),_0x09c1('0xb')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 1efe82f..c5b10b5 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 _0xb9a7=['rows','catch','show','length','create','body','user','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','savename','output','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','basename','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','ExtractedReports','UserProfileResource','sendStatus','name','send','AnalyticExtractedReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','count','includeAll'];(function(_0xa3d8b6,_0x10dc1e){var _0x4d3101=function(_0x2ed16c){while(--_0x2ed16c){_0xa3d8b6['push'](_0xa3d8b6['shift']());}};_0x4d3101(++_0x10dc1e);}(_0xb9a7,0x112));var _0x7b9a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xb9a7[_0x5d2803];return _0xdcad2c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b9a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7b9a('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x7b9a('0x2'));var util=require(_0x7b9a('0x3'));var path=require(_0x7b9a('0x4'));var sox=require(_0x7b9a('0x5'));var csv=require(_0x7b9a('0x6'));var ejs=require(_0x7b9a('0x7'));var fs=require('fs');var fs_extra=require(_0x7b9a('0x8'));var _=require(_0x7b9a('0x9'));var squel=require(_0x7b9a('0xa'));var crypto=require(_0x7b9a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7b9a('0xc'));var toCsv=require(_0x7b9a('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7b9a('0xd'));var qs=require(_0x7b9a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b9a('0xf'));var logger=require('../../config/logger')(_0x7b9a('0x10'));var utils=require('../../config/utils');var config=require(_0x7b9a('0x11'));var licenseUtil=require(_0x7b9a('0x12'));var db=require(_0x7b9a('0x13'))['db'];function respondWithStatusCode(_0x5948ca,_0x32f616){_0x32f616=_0x32f616||0xcc;return function(_0xec5949){if(_0xec5949){return _0x5948ca['sendStatus'](_0x32f616);}return _0x5948ca[_0x7b9a('0x14')](_0x32f616)[_0x7b9a('0x15')]();};}function respondWithResult(_0x4b7ec0,_0xb157e5){_0xb157e5=_0xb157e5||0xc8;return function(_0xde180d){if(_0xde180d){return _0x4b7ec0[_0x7b9a('0x14')](_0xb157e5)[_0x7b9a('0x16')](_0xde180d);}};}function respondWithFilteredResult(_0x344fa7,_0x346daa){return function(_0x22a7e4){if(_0x22a7e4){var _0x35e602=_0x22a7e4['count'],_0x2f1899=_0x346daa[_0x7b9a('0x17')],_0x4996f1=_0x346daa[_0x7b9a('0x17')]+_0x346daa[_0x7b9a('0x18')],_0x34a82d;if(_0x4996f1>=_0x35e602){_0x4996f1=_0x35e602;_0x34a82d=0xc8;}else{_0x34a82d=0xce;}_0x344fa7[_0x7b9a('0x14')](_0x34a82d);return _0x344fa7[_0x7b9a('0x19')](_0x7b9a('0x1a'),_0x2f1899+'-'+_0x4996f1+'/'+_0x35e602)[_0x7b9a('0x16')](_0x22a7e4);}return null;};}function patchUpdates(_0x283cc3){return function(_0x2064a0){try{jsonpatch[_0x7b9a('0x1b')](_0x2064a0,_0x283cc3,!![]);}catch(_0x39a5a9){return BPromise[_0x7b9a('0x1c')](_0x39a5a9);}return _0x2064a0[_0x7b9a('0x1d')]();};}function saveUpdates(_0x58aed7,_0x993048){return function(_0x59a64d){if(_0x59a64d){return _0x59a64d[_0x7b9a('0x1e')](_0x58aed7)['then'](function(_0x744887){return _0x744887;});}return null;};}function removeEntity(_0x331ae6,_0x23d812){return function(_0x54fda7){if(_0x54fda7){return _0x54fda7[_0x7b9a('0x1f')]()[_0x7b9a('0x20')](function(){var _0x5705b2=_0x54fda7[_0x7b9a('0x21')]({'plain':!![]});var _0x374dca=_0x7b9a('0x22');return db[_0x7b9a('0x23')][_0x7b9a('0x1f')]({'where':{'type':_0x374dca,'resourceId':_0x5705b2['id']}})['then'](function(){return _0x54fda7;});})[_0x7b9a('0x20')](function(){_0x331ae6[_0x7b9a('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39b7ec,_0x4fa111){return function(_0x31eb67){if(!_0x31eb67){_0x39b7ec[_0x7b9a('0x24')](0x194);}return _0x31eb67;};}function handleError(_0x4c2271,_0x55d01c){_0x55d01c=_0x55d01c||0x1f4;return function(_0x24d886){logger['error'](_0x24d886['stack']);if(_0x24d886[_0x7b9a('0x25')]){delete _0x24d886['name'];}_0x4c2271['status'](_0x55d01c)[_0x7b9a('0x26')](_0x24d886);};}exports['index']=function(_0x5c89b6,_0x314b6d){var _0x4fee38={},_0x1553ae={},_0x2e6144={'count':0x0,'rows':[]};var _0xd35ce7=_['map'](db[_0x7b9a('0x27')][_0x7b9a('0x28')],function(_0x181e9c){return{'name':_0x181e9c[_0x7b9a('0x29')],'type':_0x181e9c[_0x7b9a('0x2a')][_0x7b9a('0x2b')]};});_0x1553ae['model']=_['map'](_0xd35ce7,_0x7b9a('0x25'));_0x1553ae[_0x7b9a('0x2c')]=_[_0x7b9a('0x2d')](_0x5c89b6['query']);_0x1553ae[_0x7b9a('0x2e')]=_[_0x7b9a('0x2f')](_0x1553ae['model'],_0x1553ae['query']);_0x4fee38[_0x7b9a('0x30')]=_[_0x7b9a('0x2f')](_0x1553ae['model'],qs[_0x7b9a('0x31')](_0x5c89b6[_0x7b9a('0x2c')][_0x7b9a('0x31')]));_0x4fee38[_0x7b9a('0x30')]=_0x4fee38[_0x7b9a('0x30')]['length']?_0x4fee38[_0x7b9a('0x30')]:_0x1553ae[_0x7b9a('0x32')];if(!_0x5c89b6[_0x7b9a('0x2c')][_0x7b9a('0x33')](_0x7b9a('0x34'))){_0x4fee38[_0x7b9a('0x18')]=qs['limit'](_0x5c89b6['query'][_0x7b9a('0x18')]);_0x4fee38[_0x7b9a('0x17')]=qs['offset'](_0x5c89b6[_0x7b9a('0x2c')][_0x7b9a('0x17')]);}_0x4fee38[_0x7b9a('0x35')]=qs['sort'](_0x5c89b6[_0x7b9a('0x2c')][_0x7b9a('0x36')]);_0x4fee38['where']=qs['filters'](_[_0x7b9a('0x37')](_0x5c89b6[_0x7b9a('0x2c')],_0x1553ae[_0x7b9a('0x2e')]),_0xd35ce7);if(_0x5c89b6[_0x7b9a('0x2c')][_0x7b9a('0x38')]){_0x4fee38[_0x7b9a('0x39')]=_[_0x7b9a('0x3a')](_0x4fee38[_0x7b9a('0x39')],{'$or':_['map'](_0xd35ce7,function(_0x366b62){if(_0x366b62['type']!==_0x7b9a('0x3b')){var _0x157ca8={};_0x157ca8[_0x366b62[_0x7b9a('0x25')]]={'$like':'%'+_0x5c89b6[_0x7b9a('0x2c')][_0x7b9a('0x38')]+'%'};return _0x157ca8;}})});}_0x4fee38=_[_0x7b9a('0x3a')]({},_0x4fee38,_0x5c89b6['options']);var _0x34eebe={'where':_0x4fee38[_0x7b9a('0x39')]};return db[_0x7b9a('0x27')][_0x7b9a('0x3c')](_0x34eebe)['then'](function(_0x44e18e){_0x2e6144[_0x7b9a('0x3c')]=_0x44e18e;if(_0x5c89b6[_0x7b9a('0x2c')][_0x7b9a('0x3d')]){_0x4fee38['include']=[{'all':!![]}];}return db[_0x7b9a('0x27')]['findAll'](_0x4fee38);})[_0x7b9a('0x20')](function(_0x230c97){_0x2e6144[_0x7b9a('0x3e')]=_0x230c97;return _0x2e6144;})[_0x7b9a('0x20')](respondWithFilteredResult(_0x314b6d,_0x4fee38))[_0x7b9a('0x3f')](handleError(_0x314b6d,null));};exports[_0x7b9a('0x40')]=function(_0x56e274,_0x33edc6){var _0x85770={'raw':!![],'where':{'id':_0x56e274['params']['id']}},_0x34fb57={};_0x34fb57['model']=_[_0x7b9a('0x2d')](db[_0x7b9a('0x27')][_0x7b9a('0x28')]);_0x34fb57[_0x7b9a('0x2c')]=_[_0x7b9a('0x2d')](_0x56e274[_0x7b9a('0x2c')]);_0x34fb57['filters']=_['intersection'](_0x34fb57['model'],_0x34fb57[_0x7b9a('0x2c')]);_0x85770[_0x7b9a('0x30')]=_['intersection'](_0x34fb57[_0x7b9a('0x32')],qs[_0x7b9a('0x31')](_0x56e274[_0x7b9a('0x2c')]['fields']));_0x85770[_0x7b9a('0x30')]=_0x85770['attributes'][_0x7b9a('0x41')]?_0x85770[_0x7b9a('0x30')]:_0x34fb57[_0x7b9a('0x32')];if(_0x56e274[_0x7b9a('0x2c')][_0x7b9a('0x3d')]){_0x85770['include']=[{'all':!![]}];}_0x85770=_[_0x7b9a('0x3a')]({},_0x85770,_0x56e274['options']);return db[_0x7b9a('0x27')]['find'](_0x85770)['then'](handleEntityNotFound(_0x33edc6,null))[_0x7b9a('0x20')](respondWithResult(_0x33edc6,null))[_0x7b9a('0x3f')](handleError(_0x33edc6,null));};exports[_0x7b9a('0x42')]=function(_0x43cba,_0x1cbd5a){return db[_0x7b9a('0x27')][_0x7b9a('0x42')](_0x43cba[_0x7b9a('0x43')],{})[_0x7b9a('0x20')](function(_0x5088c7){var _0x1d7957=_0x43cba[_0x7b9a('0x44')]['get']({'plain':!![]});if(!_0x1d7957)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d7957['role']===_0x7b9a('0x44')){var _0x30296e=_0x5088c7[_0x7b9a('0x21')]({'plain':!![]});var _0x17f84d='ExtractedReports';return db[_0x7b9a('0x45')][_0x7b9a('0x46')]({'where':{'name':_0x17f84d,'userProfileId':_0x1d7957[_0x7b9a('0x47')]},'raw':!![]})[_0x7b9a('0x20')](function(_0x2d083b){if(_0x2d083b&&_0x2d083b['autoAssociation']===0x0){return db[_0x7b9a('0x23')]['create']({'name':_0x30296e[_0x7b9a('0x25')],'resourceId':_0x30296e['id'],'type':_0x2d083b[_0x7b9a('0x25')],'sectionId':_0x2d083b['id']},{})[_0x7b9a('0x20')](function(){return _0x5088c7;});}else{return _0x5088c7;}})[_0x7b9a('0x3f')](function(_0x52f2ca){logger[_0x7b9a('0x48')](_0x7b9a('0x49'),_0x52f2ca);throw _0x52f2ca;});}return _0x5088c7;})[_0x7b9a('0x20')](respondWithResult(_0x1cbd5a,0xc9))[_0x7b9a('0x3f')](handleError(_0x1cbd5a,null));};exports[_0x7b9a('0x1e')]=function(_0x3e2f1b,_0x41a002){if(_0x3e2f1b['body']['id']){delete _0x3e2f1b['body']['id'];}return db['AnalyticExtractedReport'][_0x7b9a('0x46')]({'where':{'id':_0x3e2f1b[_0x7b9a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x41a002,null))['then'](saveUpdates(_0x3e2f1b['body'],null))['then'](respondWithResult(_0x41a002,null))[_0x7b9a('0x3f')](handleError(_0x41a002,null));};exports[_0x7b9a('0x1f')]=function(_0x18bfb6,_0x957418){return db[_0x7b9a('0x27')][_0x7b9a('0x46')]({'where':{'id':_0x18bfb6[_0x7b9a('0x4a')]['id']}})[_0x7b9a('0x20')](handleEntityNotFound(_0x957418,null))['then'](removeEntity(_0x957418,null))[_0x7b9a('0x3f')](handleError(_0x957418,null));};exports['download']=function(_0x23a0cb,_0xe97e8b,_0x3c40ad){return db[_0x7b9a('0x27')][_0x7b9a('0x46')]({'where':{'id':_0x23a0cb['params']['id']},'attributes':[_0x7b9a('0x25'),'basename',_0x7b9a('0x4b'),_0x7b9a('0x4c')],'raw':!![]})[_0x7b9a('0x20')](handleEntityNotFound(_0xe97e8b,null))['then'](function(_0x50c289){if(_0x50c289){if(!fs['existsSync'](path['join'](config[_0x7b9a('0x4d')],_0x7b9a('0x4e'),_0x50c289[_0x7b9a('0x4b')]))){throw new db['Sequelize'][(_0x7b9a('0x4f'))](_0x7b9a('0x50'));}if(_0x23a0cb[_0x7b9a('0x2c')][_0x7b9a('0x51')]){return _0xe97e8b[_0x7b9a('0x24')](0xc8);}return _0xe97e8b['download'](path[_0x7b9a('0x52')](config[_0x7b9a('0x4d')],_0x7b9a('0x4e'),_0x50c289['savename']),util['format']('%s.%s',_0x50c289[_0x7b9a('0x53')]||_0x50c289[_0x7b9a('0x25')],_0x50c289[_0x7b9a('0x4c')]['toLowerCase']()));}})[_0x7b9a('0x3f')](handleError(_0xe97e8b,null));}; \ No newline at end of file +var _0x44a3=['update','then','destroy','get','ExtractedReports','UserProfileResource','error','name','send','index','map','AnalyticExtractedReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','rawAttributes','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','body','download','basename','savename','output','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','join','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x5093e9,_0x5154d0){var _0x4c9a22=function(_0x15176d){while(--_0x15176d){_0x5093e9['push'](_0x5093e9['shift']());}};_0x4c9a22(++_0x5154d0);}(_0x44a3,0x1a9));var _0x344a=function(_0x505088,_0x23a321){_0x505088=_0x505088-0x0;var _0x3eb2c9=_0x44a3[_0x505088];return _0x3eb2c9;};'use strict';var emlformat=require(_0x344a('0x0'));var rimraf=require(_0x344a('0x1'));var zipdir=require(_0x344a('0x2'));var jsonpatch=require(_0x344a('0x3'));var rp=require(_0x344a('0x4'));var moment=require(_0x344a('0x5'));var BPromise=require(_0x344a('0x6'));var Mustache=require(_0x344a('0x7'));var util=require('util');var path=require(_0x344a('0x8'));var sox=require(_0x344a('0x9'));var csv=require(_0x344a('0xa'));var ejs=require(_0x344a('0xb'));var fs=require('fs');var fs_extra=require(_0x344a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x344a('0xd'));var toCsv=require(_0x344a('0xa'));var querystring=require(_0x344a('0xe'));var Papa=require(_0x344a('0xf'));var Redis=require(_0x344a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x344a('0x11'));var as=require(_0x344a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x344a('0x13'))('api');var utils=require(_0x344a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x344a('0x15'));var db=require(_0x344a('0x16'))['db'];function respondWithStatusCode(_0x57e42e,_0x4a69ea){_0x4a69ea=_0x4a69ea||0xcc;return function(_0x304b70){if(_0x304b70){return _0x57e42e[_0x344a('0x17')](_0x4a69ea);}return _0x57e42e[_0x344a('0x18')](_0x4a69ea)[_0x344a('0x19')]();};}function respondWithResult(_0x5a0df6,_0x133ad4){_0x133ad4=_0x133ad4||0xc8;return function(_0x4ee562){if(_0x4ee562){return _0x5a0df6[_0x344a('0x18')](_0x133ad4)[_0x344a('0x1a')](_0x4ee562);}};}function respondWithFilteredResult(_0xce0f65,_0x6e1639){return function(_0x58c8cd){if(_0x58c8cd){var _0x54a643=_0x58c8cd[_0x344a('0x1b')],_0x3609ce=_0x6e1639['offset'],_0x1aad46=_0x6e1639[_0x344a('0x1c')]+_0x6e1639[_0x344a('0x1d')],_0x36227e;if(_0x1aad46>=_0x54a643){_0x1aad46=_0x54a643;_0x36227e=0xc8;}else{_0x36227e=0xce;}_0xce0f65['status'](_0x36227e);return _0xce0f65[_0x344a('0x1e')](_0x344a('0x1f'),_0x3609ce+'-'+_0x1aad46+'/'+_0x54a643)[_0x344a('0x1a')](_0x58c8cd);}return null;};}function patchUpdates(_0x45a827){return function(_0x13b382){try{jsonpatch[_0x344a('0x20')](_0x13b382,_0x45a827,!![]);}catch(_0x36e332){return BPromise[_0x344a('0x21')](_0x36e332);}return _0x13b382[_0x344a('0x22')]();};}function saveUpdates(_0x450922,_0x4b3552){return function(_0x16c0fe){if(_0x16c0fe){return _0x16c0fe[_0x344a('0x23')](_0x450922)[_0x344a('0x24')](function(_0x21216d){return _0x21216d;});}return null;};}function removeEntity(_0x240be3,_0x80ae12){return function(_0x185303){if(_0x185303){return _0x185303[_0x344a('0x25')]()[_0x344a('0x24')](function(){var _0x27f527=_0x185303[_0x344a('0x26')]({'plain':!![]});var _0x3b2ab9=_0x344a('0x27');return db[_0x344a('0x28')]['destroy']({'where':{'type':_0x3b2ab9,'resourceId':_0x27f527['id']}})[_0x344a('0x24')](function(){return _0x185303;});})['then'](function(){_0x240be3[_0x344a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c920,_0x8bf0b0){return function(_0x2ebae9){if(!_0x2ebae9){_0x36c920[_0x344a('0x17')](0x194);}return _0x2ebae9;};}function handleError(_0x26f059,_0x28749b){_0x28749b=_0x28749b||0x1f4;return function(_0x229ccd){logger[_0x344a('0x29')](_0x229ccd['stack']);if(_0x229ccd[_0x344a('0x2a')]){delete _0x229ccd[_0x344a('0x2a')];}_0x26f059[_0x344a('0x18')](_0x28749b)[_0x344a('0x2b')](_0x229ccd);};}exports[_0x344a('0x2c')]=function(_0x2d72c9,_0x5b877d){var _0x3d25fe={},_0x49bbf8={},_0x593cf6={'count':0x0,'rows':[]};var _0x24965d=_[_0x344a('0x2d')](db[_0x344a('0x2e')]['rawAttributes'],function(_0x5cd9c6){return{'name':_0x5cd9c6['fieldName'],'type':_0x5cd9c6[_0x344a('0x2f')][_0x344a('0x30')]};});_0x49bbf8[_0x344a('0x31')]=_['map'](_0x24965d,_0x344a('0x2a'));_0x49bbf8[_0x344a('0x32')]=_[_0x344a('0x33')](_0x2d72c9[_0x344a('0x32')]);_0x49bbf8[_0x344a('0x34')]=_[_0x344a('0x35')](_0x49bbf8[_0x344a('0x31')],_0x49bbf8['query']);_0x3d25fe[_0x344a('0x36')]=_['intersection'](_0x49bbf8['model'],qs['fields'](_0x2d72c9[_0x344a('0x32')][_0x344a('0x37')]));_0x3d25fe[_0x344a('0x36')]=_0x3d25fe[_0x344a('0x36')][_0x344a('0x38')]?_0x3d25fe[_0x344a('0x36')]:_0x49bbf8['model'];if(!_0x2d72c9[_0x344a('0x32')][_0x344a('0x39')](_0x344a('0x3a'))){_0x3d25fe['limit']=qs[_0x344a('0x1d')](_0x2d72c9[_0x344a('0x32')][_0x344a('0x1d')]);_0x3d25fe[_0x344a('0x1c')]=qs[_0x344a('0x1c')](_0x2d72c9['query'][_0x344a('0x1c')]);}_0x3d25fe[_0x344a('0x3b')]=qs[_0x344a('0x3c')](_0x2d72c9[_0x344a('0x32')][_0x344a('0x3c')]);_0x3d25fe['where']=qs[_0x344a('0x34')](_[_0x344a('0x3d')](_0x2d72c9[_0x344a('0x32')],_0x49bbf8[_0x344a('0x34')]),_0x24965d);if(_0x2d72c9[_0x344a('0x32')]['filter']){_0x3d25fe[_0x344a('0x3e')]=_[_0x344a('0x3f')](_0x3d25fe[_0x344a('0x3e')],{'$or':_[_0x344a('0x2d')](_0x24965d,function(_0x13bf76){if(_0x13bf76[_0x344a('0x2f')]!==_0x344a('0x40')){var _0x339fcc={};_0x339fcc[_0x13bf76['name']]={'$like':'%'+_0x2d72c9[_0x344a('0x32')][_0x344a('0x41')]+'%'};return _0x339fcc;}})});}_0x3d25fe=_[_0x344a('0x3f')]({},_0x3d25fe,_0x2d72c9[_0x344a('0x42')]);var _0x2fc05f={'where':_0x3d25fe['where']};return db[_0x344a('0x2e')][_0x344a('0x1b')](_0x2fc05f)[_0x344a('0x24')](function(_0x1fb4f5){_0x593cf6[_0x344a('0x1b')]=_0x1fb4f5;if(_0x2d72c9[_0x344a('0x32')][_0x344a('0x43')]){_0x3d25fe[_0x344a('0x44')]=[{'all':!![]}];}return db[_0x344a('0x2e')]['findAll'](_0x3d25fe);})[_0x344a('0x24')](function(_0x1bad44){_0x593cf6[_0x344a('0x45')]=_0x1bad44;return _0x593cf6;})[_0x344a('0x24')](respondWithFilteredResult(_0x5b877d,_0x3d25fe))['catch'](handleError(_0x5b877d,null));};exports[_0x344a('0x46')]=function(_0x3069ca,_0x2b0ee9){var _0x41f25b={'raw':!![],'where':{'id':_0x3069ca[_0x344a('0x47')]['id']}},_0x1513d5={};_0x1513d5[_0x344a('0x31')]=_[_0x344a('0x33')](db[_0x344a('0x2e')][_0x344a('0x48')]);_0x1513d5[_0x344a('0x32')]=_['keys'](_0x3069ca[_0x344a('0x32')]);_0x1513d5[_0x344a('0x34')]=_['intersection'](_0x1513d5[_0x344a('0x31')],_0x1513d5[_0x344a('0x32')]);_0x41f25b['attributes']=_[_0x344a('0x35')](_0x1513d5[_0x344a('0x31')],qs['fields'](_0x3069ca[_0x344a('0x32')][_0x344a('0x37')]));_0x41f25b[_0x344a('0x36')]=_0x41f25b['attributes'][_0x344a('0x38')]?_0x41f25b['attributes']:_0x1513d5[_0x344a('0x31')];if(_0x3069ca[_0x344a('0x32')][_0x344a('0x43')]){_0x41f25b[_0x344a('0x44')]=[{'all':!![]}];}_0x41f25b=_['merge']({},_0x41f25b,_0x3069ca['options']);return db[_0x344a('0x2e')][_0x344a('0x49')](_0x41f25b)[_0x344a('0x24')](handleEntityNotFound(_0x2b0ee9,null))[_0x344a('0x24')](respondWithResult(_0x2b0ee9,null))[_0x344a('0x4a')](handleError(_0x2b0ee9,null));};exports[_0x344a('0x4b')]=function(_0x44962b,_0x23c214){return db[_0x344a('0x2e')][_0x344a('0x4b')](_0x44962b['body'],{})[_0x344a('0x24')](function(_0x2d9858){var _0x6fad37=_0x44962b[_0x344a('0x4c')]['get']({'plain':!![]});if(!_0x6fad37)throw new Error(_0x344a('0x4d'));if(_0x6fad37['role']==='user'){var _0xa6b6b5=_0x2d9858[_0x344a('0x26')]({'plain':!![]});var _0x5917cc=_0x344a('0x27');return db[_0x344a('0x4e')][_0x344a('0x49')]({'where':{'name':_0x5917cc,'userProfileId':_0x6fad37[_0x344a('0x4f')]},'raw':!![]})['then'](function(_0x225fce){if(_0x225fce&&_0x225fce[_0x344a('0x50')]===0x0){return db[_0x344a('0x28')][_0x344a('0x4b')]({'name':_0xa6b6b5[_0x344a('0x2a')],'resourceId':_0xa6b6b5['id'],'type':_0x225fce[_0x344a('0x2a')],'sectionId':_0x225fce['id']},{})[_0x344a('0x24')](function(){return _0x2d9858;});}else{return _0x2d9858;}})[_0x344a('0x4a')](function(_0x292357){logger[_0x344a('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x292357);throw _0x292357;});}return _0x2d9858;})[_0x344a('0x24')](respondWithResult(_0x23c214,0xc9))['catch'](handleError(_0x23c214,null));};exports[_0x344a('0x23')]=function(_0xb744c6,_0x1d2f7a){if(_0xb744c6['body']['id']){delete _0xb744c6[_0x344a('0x51')]['id'];}return db[_0x344a('0x2e')][_0x344a('0x49')]({'where':{'id':_0xb744c6[_0x344a('0x47')]['id']}})[_0x344a('0x24')](handleEntityNotFound(_0x1d2f7a,null))[_0x344a('0x24')](saveUpdates(_0xb744c6[_0x344a('0x51')],null))[_0x344a('0x24')](respondWithResult(_0x1d2f7a,null))[_0x344a('0x4a')](handleError(_0x1d2f7a,null));};exports['destroy']=function(_0x2f828e,_0x311a39){return db[_0x344a('0x2e')][_0x344a('0x49')]({'where':{'id':_0x2f828e[_0x344a('0x47')]['id']}})['then'](handleEntityNotFound(_0x311a39,null))[_0x344a('0x24')](removeEntity(_0x311a39,null))[_0x344a('0x4a')](handleError(_0x311a39,null));};exports[_0x344a('0x52')]=function(_0x34d8c7,_0x493926,_0x1b981f){return db[_0x344a('0x2e')]['find']({'where':{'id':_0x34d8c7[_0x344a('0x47')]['id']},'attributes':[_0x344a('0x2a'),_0x344a('0x53'),_0x344a('0x54'),_0x344a('0x55')],'raw':!![]})[_0x344a('0x24')](handleEntityNotFound(_0x493926,null))[_0x344a('0x24')](function(_0x4b6eb2){if(_0x4b6eb2){if(!fs['existsSync'](path['join'](config[_0x344a('0x56')],_0x344a('0x57'),_0x4b6eb2[_0x344a('0x54')]))){throw new db[(_0x344a('0x58'))]['ValidationError'](_0x344a('0x59'));}if(_0x34d8c7['query']['exists']){return _0x493926['sendStatus'](0xc8);}return _0x493926['download'](path[_0x344a('0x5a')](config[_0x344a('0x56')],_0x344a('0x57'),_0x4b6eb2[_0x344a('0x54')]),util['format']('%s.%s',_0x4b6eb2['basename']||_0x4b6eb2[_0x344a('0x2a')],_0x4b6eb2[_0x344a('0x55')][_0x344a('0x5b')]()));}})[_0x344a('0x4a')](handleError(_0x493926,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 25e0093..9787979 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 _0xbc56=['rimraf','../../config/environment','exports','define','AnalyticExtractedReport','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x413d74,_0x5bab1b){var _0x177f90=function(_0x15e9de){while(--_0x15e9de){_0x413d74['push'](_0x413d74['shift']());}};_0x177f90(++_0x5bab1b);}(_0xbc56,0x185));var _0x6bc5=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbc56[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x6bc5('0x0'));var logger=require(_0x6bc5('0x1'))(_0x6bc5('0x2'));var moment=require(_0x6bc5('0x3'));var BPromise=require(_0x6bc5('0x4'));var rp=require(_0x6bc5('0x5'));var fs=require('fs');var path=require(_0x6bc5('0x6'));var rimraf=require(_0x6bc5('0x7'));var config=require(_0x6bc5('0x8'));var attributes=require('./analyticExtractedReport.attributes');module[_0x6bc5('0x9')]=function(_0x27fc40,_0x56a049){return _0x27fc40[_0x6bc5('0xa')](_0x6bc5('0xb'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd540=['./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xe229ca,_0xd415b9){var _0x3f6157=function(_0x2b1542){while(--_0x2b1542){_0xe229ca['push'](_0xe229ca['shift']());}};_0x3f6157(++_0xd415b9);}(_0xd540,0x1a3));var _0x0d54=function(_0x38941a,_0x390672){_0x38941a=_0x38941a-0x0;var _0x468c42=_0xd540[_0x38941a];return _0x468c42;};'use strict';var _=require(_0x0d54('0x0'));var util=require(_0x0d54('0x1'));var logger=require(_0x0d54('0x2'))(_0x0d54('0x3'));var moment=require(_0x0d54('0x4'));var BPromise=require(_0x0d54('0x5'));var rp=require(_0x0d54('0x6'));var fs=require('fs');var path=require(_0x0d54('0x7'));var rimraf=require(_0x0d54('0x8'));var config=require(_0x0d54('0x9'));var attributes=require(_0x0d54('0xa'));module[_0x0d54('0xb')]=function(_0x55a9c3,_0x148190){return _0x55a9c3['define'](_0x0d54('0xc'),attributes,{'tableName':'analytics_extracted_reports','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 dc91cb1..e029392 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 _0xa24e=['code','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2c0c66,_0x400cb4){var _0x26a228=function(_0x1c1f79){while(--_0x1c1f79){_0x2c0c66['push'](_0x2c0c66['shift']());}};_0x26a228(++_0x400cb4);}(_0xa24e,0x154));var _0xea24=function(_0x5023cb,_0x5ae9a6){_0x5023cb=_0x5023cb-0x0;var _0x52c5d6=_0xa24e[_0x5023cb];return _0x52c5d6;};'use strict';var _=require('lodash');var util=require(_0xea24('0x0'));var moment=require(_0xea24('0x1'));var BPromise=require(_0xea24('0x2'));var rs=require(_0xea24('0x3'));var fs=require('fs');var Redis=require(_0xea24('0x4'));var db=require(_0xea24('0x5'))['db'];var utils=require(_0xea24('0x6'));var logger=require(_0xea24('0x7'))(_0xea24('0x8'));var config=require(_0xea24('0x9'));var jayson=require(_0xea24('0xa'));var client=jayson[_0xea24('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d7ea8,_0x8f6e51,_0x379871){return new BPromise(function(_0x3af3e9,_0x2d8882){return client[_0xea24('0xc')](_0x4d7ea8,_0x379871)[_0xea24('0xd')](function(_0x3d58bc){logger[_0xea24('0xe')](_0xea24('0xf'),_0x8f6e51,_0xea24('0x10'));logger[_0xea24('0x11')](_0xea24('0x12'),_0x8f6e51,_0xea24('0x10'),JSON[_0xea24('0x13')](_0x3d58bc));if(_0x3d58bc['error']){if(_0x3d58bc['error'][_0xea24('0x14')]===0x1f4){logger[_0xea24('0x15')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x8f6e51,_0x3d58bc['error'][_0xea24('0x16')]);return _0x2d8882(_0x3d58bc[_0xea24('0x15')][_0xea24('0x16')]);}logger[_0xea24('0x15')](_0xea24('0xf'),_0x8f6e51,_0x3d58bc[_0xea24('0x15')][_0xea24('0x16')]);return _0x3af3e9(_0x3d58bc[_0xea24('0x15')]['message']);}else{logger[_0xea24('0xe')](_0xea24('0xf'),_0x8f6e51,_0xea24('0x10'));_0x3af3e9(_0x3d58bc[_0xea24('0x17')][_0xea24('0x16')]);}})['catch'](function(_0x3e0f05){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x8f6e51,_0x3e0f05);_0x2d8882(_0x3e0f05);});});} \ No newline at end of file +var _0x6fce=['AnalyticExtractedReport,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','info'];(function(_0xf428f2,_0x409ca6){var _0x3a9541=function(_0x1433bc){while(--_0x1433bc){_0xf428f2['push'](_0xf428f2['shift']());}};_0x3a9541(++_0x409ca6);}(_0x6fce,0x67));var _0xe6fc=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x6fce[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xe6fc('0x0'));var util=require(_0xe6fc('0x1'));var moment=require('moment');var BPromise=require(_0xe6fc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe6fc('0x3'));var db=require(_0xe6fc('0x4'))['db'];var utils=require(_0xe6fc('0x5'));var logger=require('../../config/logger')(_0xe6fc('0x6'));var config=require(_0xe6fc('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1cce09,_0x4686ee,_0x5e5c8c){return new BPromise(function(_0x2d7c51,_0x1d7bd6){return client[_0xe6fc('0x8')](_0x1cce09,_0x5e5c8c)[_0xe6fc('0x9')](function(_0x25858d){logger[_0xe6fc('0xa')](_0xe6fc('0xb'),_0x4686ee,'request\x20sent');logger[_0xe6fc('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x4686ee,'request\x20sent',JSON['stringify'](_0x25858d));if(_0x25858d['error']){if(_0x25858d[_0xe6fc('0xd')][_0xe6fc('0xe')]===0x1f4){logger['error'](_0xe6fc('0xb'),_0x4686ee,_0x25858d[_0xe6fc('0xd')][_0xe6fc('0xf')]);return _0x1d7bd6(_0x25858d['error'][_0xe6fc('0xf')]);}logger[_0xe6fc('0xd')](_0xe6fc('0xb'),_0x4686ee,_0x25858d[_0xe6fc('0xd')]['message']);return _0x2d7c51(_0x25858d[_0xe6fc('0xd')]['message']);}else{logger[_0xe6fc('0xa')](_0xe6fc('0xb'),_0x4686ee,_0xe6fc('0x10'));_0x2d7c51(_0x25858d[_0xe6fc('0x11')][_0xe6fc('0xf')]);}})[_0xe6fc('0x12')](function(_0x1e1e0b){logger[_0xe6fc('0xd')](_0xe6fc('0xb'),_0x4686ee,_0x1e1e0b);_0x1d7bd6(_0x1e1e0b);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 56c883a..9165379 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 _0xb37f=['Router','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x239dba,_0x309e95){var _0x1ceb11=function(_0x14efe6){while(--_0x14efe6){_0x239dba['push'](_0x239dba['shift']());}};_0x1ceb11(++_0x309e95);}(_0xb37f,0x199));var _0xfb37=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xb37f[_0x12fc8d];return _0x3f9d04;};'use strict';var multer=require(_0xfb37('0x0'));var util=require(_0xfb37('0x1'));var path=require(_0xfb37('0x2'));var timeout=require(_0xfb37('0x3'));var express=require(_0xfb37('0x4'));var router=express[_0xfb37('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfb37('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfb37('0x7'));var controller=require(_0xfb37('0x8'));router[_0xfb37('0x9')]('/',auth[_0xfb37('0xa')](),controller[_0xfb37('0xb')]);router[_0xfb37('0x9')](_0xfb37('0xc'),auth[_0xfb37('0xa')](),controller[_0xfb37('0xd')]);router[_0xfb37('0x9')](_0xfb37('0xe'),auth['isAuthenticated'](),controller[_0xfb37('0xf')]);router[_0xfb37('0x10')]('/',auth[_0xfb37('0xa')](),controller[_0xfb37('0x11')]);router[_0xfb37('0x12')](_0xfb37('0xc'),auth[_0xfb37('0xa')](),controller[_0xfb37('0x13')]);router[_0xfb37('0x14')](_0xfb37('0xc'),auth[_0xfb37('0xa')](),controller[_0xfb37('0x15')]);module[_0xfb37('0x16')]=router; \ No newline at end of file +var _0x12f1=['index','/:id/download','create','put','/:id','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated'];(function(_0x481560,_0x511c60){var _0x52c8aa=function(_0x547f28){while(--_0x547f28){_0x481560['push'](_0x481560['shift']());}};_0x52c8aa(++_0x511c60);}(_0x12f1,0xec));var _0x112f=function(_0x54e374,_0x5d5cd9){_0x54e374=_0x54e374-0x0;var _0x23f522=_0x12f1[_0x54e374];return _0x23f522;};'use strict';var multer=require(_0x112f('0x0'));var util=require(_0x112f('0x1'));var path=require(_0x112f('0x2'));var timeout=require('connect-timeout');var express=require(_0x112f('0x3'));var router=express[_0x112f('0x4')]();var fs_extra=require(_0x112f('0x5'));var auth=require(_0x112f('0x6'));var interaction=require(_0x112f('0x7'));var config=require('../../config/environment');var controller=require(_0x112f('0x8'));router[_0x112f('0x9')]('/',auth[_0x112f('0xa')](),controller[_0x112f('0xb')]);router['get']('/:id',auth[_0x112f('0xa')](),controller['show']);router[_0x112f('0x9')](_0x112f('0xc'),auth[_0x112f('0xa')](),controller['download']);router['post']('/',auth[_0x112f('0xa')](),controller[_0x112f('0xd')]);router[_0x112f('0xe')](_0x112f('0xf'),auth[_0x112f('0xa')](),controller[_0x112f('0x10')]);router['delete'](_0x112f('0xf'),auth['isAuthenticated'](),controller[_0x112f('0x11')]);module[_0x112f('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index e8d9303..0e2e54c 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 _0x326f=['STRING','BOOLEAN','sequelize'];(function(_0x3afc75,_0x32dc5b){var _0x16f415=function(_0x405862){while(--_0x405862){_0x3afc75['push'](_0x3afc75['shift']());}};_0x16f415(++_0x32dc5b);}(_0x326f,0xd1));var _0xf326=function(_0x4255d5,_0x5b9e5f){_0x4255d5=_0x4255d5-0x0;var _0x46064=_0x326f[_0x4255d5];return _0x46064;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xf326('0x1')]},'function':{'type':Sequelize[_0xf326('0x1')]},'format':{'type':Sequelize[_0xf326('0x1')]},'groupBy':{'type':Sequelize[_0xf326('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xf326('0x1')]},'custom':{'type':Sequelize[_0xf326('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xc4aa=['exports','TEXT','STRING','sequelize'];(function(_0x3671d7,_0x586bbc){var _0xf9f6e6=function(_0x80d81){while(--_0x80d81){_0x3671d7['push'](_0x3671d7['shift']());}};_0xf9f6e6(++_0x586bbc);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xc4aa[_0x465a0c];return _0x1e202e;};'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 diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index fc1304c..7455eb9 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 _0x4483=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','error','stack','name','send','map','AnalyticFieldReport','fieldName','type','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','create','bulkCreate','body','find','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x4483,0x1a3));var _0x3448=function(_0x2f551b,_0x232bf8){_0x2f551b=_0x2f551b-0x0;var _0x3ee6f9=_0x4483[_0x2f551b];return _0x3ee6f9;};'use strict';var emlformat=require(_0x3448('0x0'));var rimraf=require(_0x3448('0x1'));var zipdir=require(_0x3448('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3448('0x3'));var moment=require(_0x3448('0x4'));var BPromise=require(_0x3448('0x5'));var Mustache=require(_0x3448('0x6'));var util=require(_0x3448('0x7'));var path=require('path');var sox=require(_0x3448('0x8'));var csv=require(_0x3448('0x9'));var ejs=require(_0x3448('0xa'));var fs=require('fs');var fs_extra=require(_0x3448('0xb'));var _=require(_0x3448('0xc'));var squel=require(_0x3448('0xd'));var crypto=require(_0x3448('0xe'));var jsforce=require(_0x3448('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3448('0x10'));var Papa=require(_0x3448('0x11'));var Redis=require(_0x3448('0x12'));var authService=require(_0x3448('0x13'));var qs=require(_0x3448('0x14'));var as=require(_0x3448('0x15'));var hardwareService=require(_0x3448('0x16'));var logger=require(_0x3448('0x17'))(_0x3448('0x18'));var utils=require(_0x3448('0x19'));var config=require(_0x3448('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x298ae6,_0x38fbb1){_0x38fbb1=_0x38fbb1||0xcc;return function(_0x5f52bd){if(_0x5f52bd){return _0x298ae6[_0x3448('0x1b')](_0x38fbb1);}return _0x298ae6[_0x3448('0x1c')](_0x38fbb1)[_0x3448('0x1d')]();};}function respondWithResult(_0x549306,_0x14104c){_0x14104c=_0x14104c||0xc8;return function(_0x2952a6){if(_0x2952a6){return _0x549306['status'](_0x14104c)[_0x3448('0x1e')](_0x2952a6);}};}function respondWithFilteredResult(_0x2c2da6,_0x46784f){return function(_0x4fc70f){if(_0x4fc70f){var _0x472518=_0x4fc70f[_0x3448('0x1f')],_0x28f5b9=_0x46784f[_0x3448('0x20')],_0x13610a=_0x46784f[_0x3448('0x20')]+_0x46784f[_0x3448('0x21')],_0x30f8dd;if(_0x13610a>=_0x472518){_0x13610a=_0x472518;_0x30f8dd=0xc8;}else{_0x30f8dd=0xce;}_0x2c2da6['status'](_0x30f8dd);return _0x2c2da6[_0x3448('0x22')]('Content-Range',_0x28f5b9+'-'+_0x13610a+'/'+_0x472518)['json'](_0x4fc70f);}return null;};}function patchUpdates(_0x53f8e7){return function(_0x1e9774){try{jsonpatch[_0x3448('0x23')](_0x1e9774,_0x53f8e7,!![]);}catch(_0xda4040){return BPromise['reject'](_0xda4040);}return _0x1e9774[_0x3448('0x24')]();};}function saveUpdates(_0x392c8d,_0x317de6){return function(_0x18608e){if(_0x18608e){return _0x18608e[_0x3448('0x25')](_0x392c8d)[_0x3448('0x26')](function(_0x5db78f){return _0x5db78f;});}return null;};}function removeEntity(_0x54c7ee,_0x4e6716){return function(_0x1b3d5a){if(_0x1b3d5a){return _0x1b3d5a[_0x3448('0x27')]()['then'](function(){_0x54c7ee['status'](0xcc)[_0x3448('0x1d')]();});}};}function handleEntityNotFound(_0x4371d6,_0x22ad5c){return function(_0x4368c7){if(!_0x4368c7){_0x4371d6[_0x3448('0x1b')](0x194);}return _0x4368c7;};}function handleError(_0x566ff5,_0x229ce7){_0x229ce7=_0x229ce7||0x1f4;return function(_0x1b5c49){logger[_0x3448('0x28')](_0x1b5c49[_0x3448('0x29')]);if(_0x1b5c49[_0x3448('0x2a')]){delete _0x1b5c49['name'];}_0x566ff5[_0x3448('0x1c')](_0x229ce7)[_0x3448('0x2b')](_0x1b5c49);};}exports['index']=function(_0x19a479,_0x12c22d){var _0x310912={},_0x1bd34c={},_0x38fab2={'count':0x0,'rows':[]};var _0x35f026=_[_0x3448('0x2c')](db[_0x3448('0x2d')]['rawAttributes'],function(_0x3307dc){return{'name':_0x3307dc[_0x3448('0x2e')],'type':_0x3307dc[_0x3448('0x2f')]['key']};});_0x1bd34c[_0x3448('0x30')]=_['map'](_0x35f026,'name');_0x1bd34c['query']=_[_0x3448('0x31')](_0x19a479[_0x3448('0x32')]);_0x1bd34c['filters']=_['intersection'](_0x1bd34c[_0x3448('0x30')],_0x1bd34c[_0x3448('0x32')]);_0x310912[_0x3448('0x33')]=_[_0x3448('0x34')](_0x1bd34c['model'],qs[_0x3448('0x35')](_0x19a479[_0x3448('0x32')][_0x3448('0x35')]));_0x310912['attributes']=_0x310912[_0x3448('0x33')][_0x3448('0x36')]?_0x310912['attributes']:_0x1bd34c['model'];if(!_0x19a479[_0x3448('0x32')][_0x3448('0x37')](_0x3448('0x38'))){_0x310912[_0x3448('0x21')]=qs['limit'](_0x19a479[_0x3448('0x32')][_0x3448('0x21')]);_0x310912[_0x3448('0x20')]=qs[_0x3448('0x20')](_0x19a479['query'][_0x3448('0x20')]);}_0x310912[_0x3448('0x39')]=qs['sort'](_0x19a479[_0x3448('0x32')][_0x3448('0x3a')]);_0x310912[_0x3448('0x3b')]=qs[_0x3448('0x3c')](_[_0x3448('0x3d')](_0x19a479[_0x3448('0x32')],_0x1bd34c[_0x3448('0x3c')]),_0x35f026);if(_0x19a479[_0x3448('0x32')][_0x3448('0x3e')]){_0x310912['where']=_['merge'](_0x310912[_0x3448('0x3b')],{'$or':_['map'](_0x35f026,function(_0x22bb31){if(_0x22bb31[_0x3448('0x2f')]!==_0x3448('0x3f')){var _0xf26d4e={};_0xf26d4e[_0x22bb31['name']]={'$like':'%'+_0x19a479[_0x3448('0x32')][_0x3448('0x3e')]+'%'};return _0xf26d4e;}})});}_0x310912=_[_0x3448('0x40')]({},_0x310912,_0x19a479[_0x3448('0x41')]);var _0x2e83c6={'where':_0x310912[_0x3448('0x3b')]};return db[_0x3448('0x2d')][_0x3448('0x1f')](_0x2e83c6)[_0x3448('0x26')](function(_0x5a58c5){_0x38fab2[_0x3448('0x1f')]=_0x5a58c5;if(_0x19a479[_0x3448('0x32')][_0x3448('0x42')]){_0x310912[_0x3448('0x43')]=[{'all':!![]}];}return db[_0x3448('0x2d')]['findAll'](_0x310912);})[_0x3448('0x26')](function(_0x1b7284){_0x38fab2[_0x3448('0x44')]=_0x1b7284;return _0x38fab2;})[_0x3448('0x26')](respondWithFilteredResult(_0x12c22d,_0x310912))[_0x3448('0x45')](handleError(_0x12c22d,null));};exports[_0x3448('0x46')]=function(_0x415985,_0x3db5f1){var _0x4a8f80={'raw':![],'where':{'id':_0x415985[_0x3448('0x47')]['id']}},_0x399246={};_0x399246[_0x3448('0x30')]=_['keys'](db[_0x3448('0x2d')][_0x3448('0x48')]);_0x399246[_0x3448('0x32')]=_[_0x3448('0x31')](_0x415985[_0x3448('0x32')]);_0x399246[_0x3448('0x3c')]=_[_0x3448('0x34')](_0x399246['model'],_0x399246[_0x3448('0x32')]);_0x4a8f80[_0x3448('0x33')]=_[_0x3448('0x34')](_0x399246[_0x3448('0x30')],qs[_0x3448('0x35')](_0x415985[_0x3448('0x32')]['fields']));_0x4a8f80[_0x3448('0x33')]=_0x4a8f80['attributes']['length']?_0x4a8f80[_0x3448('0x33')]:_0x399246[_0x3448('0x30')];if(_0x415985['query'][_0x3448('0x42')]){_0x4a8f80[_0x3448('0x43')]=[{'all':!![]}];}_0x4a8f80=_['merge']({},_0x4a8f80,_0x415985[_0x3448('0x41')]);return db[_0x3448('0x2d')]['find'](_0x4a8f80)[_0x3448('0x26')](handleEntityNotFound(_0x3db5f1,null))[_0x3448('0x26')](respondWithResult(_0x3db5f1,null))[_0x3448('0x45')](handleError(_0x3db5f1,null));};exports[_0x3448('0x49')]=function(_0x34d19e,_0x3e3208){return db[_0x3448('0x2d')]['create'](_0x34d19e['body'],{})[_0x3448('0x26')](respondWithResult(_0x3e3208,0xc9))[_0x3448('0x45')](handleError(_0x3e3208,null));};exports[_0x3448('0x4a')]=function(_0x3f48e3,_0x527259){return db[_0x3448('0x2d')][_0x3448('0x4a')](_0x3f48e3[_0x3448('0x4b')],{'raw':![],'individualHooks':!![]})[_0x3448('0x26')](respondWithResult(_0x527259,0xc9))[_0x3448('0x45')](handleError(_0x527259,null));};exports['update']=function(_0x3edd60,_0x5636ab){if(_0x3edd60[_0x3448('0x4b')]['id']){delete _0x3edd60[_0x3448('0x4b')]['id'];}return db['AnalyticFieldReport'][_0x3448('0x4c')]({'where':{'id':_0x3edd60[_0x3448('0x47')]['id']}})[_0x3448('0x26')](handleEntityNotFound(_0x5636ab,null))[_0x3448('0x26')](saveUpdates(_0x3edd60[_0x3448('0x4b')],null))[_0x3448('0x26')](respondWithResult(_0x5636ab,null))[_0x3448('0x45')](handleError(_0x5636ab,null));};exports['destroy']=function(_0x23dbda,_0x9fbee8){return db['AnalyticFieldReport']['find']({'where':{'id':_0x23dbda[_0x3448('0x47')]['id']}})[_0x3448('0x26')](handleEntityNotFound(_0x9fbee8,null))['then'](removeEntity(_0x9fbee8,null))['catch'](handleError(_0x9fbee8,null));};exports[_0x3448('0x4d')]=function(_0xb6c293,_0x2f795d){return db[_0x3448('0x2d')][_0x3448('0x27')]({'where':{'id':_0xb6c293[_0x3448('0x32')][_0x3448('0x4e')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2f795d,0xcc))['catch'](handleError(_0x2f795d,null));};exports['addFields']=function(_0xab2c58,_0x3c734a,_0x5cf3fe){return db[_0x3448('0x4f')][_0x3448('0x50')]({'where':{'id':_0xab2c58['params']['id']}})[_0x3448('0x26')](handleEntityNotFound(_0x3c734a,null))[_0x3448('0x26')](function(_0x492713){if(_0x492713){return db[_0x3448('0x51')][_0x3448('0x52')](function(_0x1bfa93){return db[_0x3448('0x2d')][_0x3448('0x27')]({'where':{'CustomReportId':_0xab2c58[_0x3448('0x47')]['id']},'transaction':_0x1bfa93})[_0x3448('0x26')](function(_0x1b7d87){var _0x4520a1=_['map'](_0xab2c58[_0x3448('0x4b')],function(_0x5f358e){delete _0x5f358e['id'];_0x5f358e[_0x3448('0x53')]=_0xab2c58[_0x3448('0x47')]['id'];return _0x5f358e;});return db[_0x3448('0x2d')][_0x3448('0x4a')](_0x4520a1,{'transaction':_0x1bfa93});});})[_0x3448('0x26')](function(){return db[_0x3448('0x2d')]['findAll']({'where':{'CustomReportId':_0xab2c58[_0x3448('0x47')]['id']}});});}})['then'](respondWithResult(_0x3c734a,null))[_0x3448('0x45')](handleError(_0x3c734a,null));}; \ No newline at end of file +var _0xcb91=['reject','update','then','destroy','error','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','key','query','keys','filters','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','fields','find','catch','create','body','bulkCreate','bulkDestroy','addFields','findOne','sequelize','CustomReportId','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','count','offset','limit','Content-Range','apply'];(function(_0x4d9403,_0x33c5f0){var _0x5eef11=function(_0x50bb5c){while(--_0x50bb5c){_0x4d9403['push'](_0x4d9403['shift']());}};_0x5eef11(++_0x33c5f0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x57474e,_0x4178b8){_0x57474e=_0x57474e-0x0;var _0xfaae8c=_0xcb91[_0x57474e];return _0xfaae8c;};'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=_0x5806d8[_0x1cb9('0x1a')],_0xd446a3=_0x3e2d11[_0x1cb9('0x1b')],_0x3cc765=_0x3e2d11[_0x1cb9('0x1b')]+_0x3e2d11[_0x1cb9('0x1c')],_0x3904b7;if(_0x3cc765>=_0x5572cb){_0x3cc765=_0x5572cb;_0x3904b7=0xc8;}else{_0x3904b7=0xce;}_0x8dfa55['status'](_0x3904b7);return _0x8dfa55['set'](_0x1cb9('0x1d'),_0xd446a3+'-'+_0x3cc765+'/'+_0x5572cb)[_0x1cb9('0x19')](_0x5806d8);}return null;};}function patchUpdates(_0x2b2669){return function(_0x31481a){try{jsonpatch[_0x1cb9('0x1e')](_0x31481a,_0x2b2669,!![]);}catch(_0x4014de){return BPromise[_0x1cb9('0x1f')](_0x4014de);}return _0x31481a['save']();};}function saveUpdates(_0x559bcc,_0x1a5a72){return function(_0x5dbfae){if(_0x5dbfae){return _0x5dbfae[_0x1cb9('0x20')](_0x559bcc)[_0x1cb9('0x21')](function(_0x523b26){return _0x523b26;});}return null;};}function removeEntity(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x22')]()[_0x1cb9('0x21')](function(){_0x599275[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x59ebea,_0x55b232){return function(_0x6c6f61){if(!_0x6c6f61){_0x59ebea['sendStatus'](0x194);}return _0x6c6f61;};}function handleError(_0x10a419,_0x2b1275){_0x2b1275=_0x2b1275||0x1f4;return function(_0x69b4c8){logger[_0x1cb9('0x23')](_0x69b4c8[_0x1cb9('0x24')]);if(_0x69b4c8['name']){delete _0x69b4c8[_0x1cb9('0x25')];}_0x10a419[_0x1cb9('0x17')](_0x2b1275)['send'](_0x69b4c8);};}exports[_0x1cb9('0x26')]=function(_0x21effa,_0x41a9a0){var _0x1804fd={},_0x406821={},_0x21d6f5={'count':0x0,'rows':[]};var _0x2e28fe=_[_0x1cb9('0x27')](db[_0x1cb9('0x28')][_0x1cb9('0x29')],function(_0x48888d){return{'name':_0x48888d[_0x1cb9('0x2a')],'type':_0x48888d['type'][_0x1cb9('0x2b')]};});_0x406821['model']=_[_0x1cb9('0x27')](_0x2e28fe,_0x1cb9('0x25'));_0x406821[_0x1cb9('0x2c')]=_[_0x1cb9('0x2d')](_0x21effa['query']);_0x406821[_0x1cb9('0x2e')]=_['intersection'](_0x406821[_0x1cb9('0x2f')],_0x406821[_0x1cb9('0x2c')]);_0x1804fd[_0x1cb9('0x30')]=_['intersection'](_0x406821[_0x1cb9('0x2f')],qs['fields'](_0x21effa[_0x1cb9('0x2c')]['fields']));_0x1804fd[_0x1cb9('0x30')]=_0x1804fd[_0x1cb9('0x30')][_0x1cb9('0x31')]?_0x1804fd[_0x1cb9('0x30')]:_0x406821['model'];if(!_0x21effa[_0x1cb9('0x2c')][_0x1cb9('0x32')](_0x1cb9('0x33'))){_0x1804fd[_0x1cb9('0x1c')]=qs[_0x1cb9('0x1c')](_0x21effa[_0x1cb9('0x2c')][_0x1cb9('0x1c')]);_0x1804fd[_0x1cb9('0x1b')]=qs[_0x1cb9('0x1b')](_0x21effa[_0x1cb9('0x2c')][_0x1cb9('0x1b')]);}_0x1804fd[_0x1cb9('0x34')]=qs[_0x1cb9('0x35')](_0x21effa['query']['sort']);_0x1804fd[_0x1cb9('0x36')]=qs[_0x1cb9('0x2e')](_[_0x1cb9('0x37')](_0x21effa[_0x1cb9('0x2c')],_0x406821[_0x1cb9('0x2e')]),_0x2e28fe);if(_0x21effa[_0x1cb9('0x2c')][_0x1cb9('0x38')]){_0x1804fd[_0x1cb9('0x36')]=_['merge'](_0x1804fd[_0x1cb9('0x36')],{'$or':_[_0x1cb9('0x27')](_0x2e28fe,function(_0xefe136){if(_0xefe136['type']!==_0x1cb9('0x39')){var _0x5c7cd0={};_0x5c7cd0[_0xefe136[_0x1cb9('0x25')]]={'$like':'%'+_0x21effa['query'][_0x1cb9('0x38')]+'%'};return _0x5c7cd0;}})});}_0x1804fd=_[_0x1cb9('0x3a')]({},_0x1804fd,_0x21effa[_0x1cb9('0x3b')]);var _0x2bcacd={'where':_0x1804fd[_0x1cb9('0x36')]};return db[_0x1cb9('0x28')][_0x1cb9('0x1a')](_0x2bcacd)['then'](function(_0x4ca19e){_0x21d6f5[_0x1cb9('0x1a')]=_0x4ca19e;if(_0x21effa[_0x1cb9('0x2c')][_0x1cb9('0x3c')]){_0x1804fd[_0x1cb9('0x3d')]=[{'all':!![]}];}return db[_0x1cb9('0x28')][_0x1cb9('0x3e')](_0x1804fd);})[_0x1cb9('0x21')](function(_0x4a670c){_0x21d6f5[_0x1cb9('0x3f')]=_0x4a670c;return _0x21d6f5;})['then'](respondWithFilteredResult(_0x41a9a0,_0x1804fd))['catch'](handleError(_0x41a9a0,null));};exports['show']=function(_0x409c62,_0x397ff9){var _0x1bf51c={'raw':![],'where':{'id':_0x409c62[_0x1cb9('0x40')]['id']}},_0x2e3cf3={};_0x2e3cf3['model']=_[_0x1cb9('0x2d')](db['AnalyticFieldReport'][_0x1cb9('0x29')]);_0x2e3cf3[_0x1cb9('0x2c')]=_[_0x1cb9('0x2d')](_0x409c62['query']);_0x2e3cf3[_0x1cb9('0x2e')]=_['intersection'](_0x2e3cf3[_0x1cb9('0x2f')],_0x2e3cf3[_0x1cb9('0x2c')]);_0x1bf51c['attributes']=_['intersection'](_0x2e3cf3[_0x1cb9('0x2f')],qs[_0x1cb9('0x41')](_0x409c62[_0x1cb9('0x2c')][_0x1cb9('0x41')]));_0x1bf51c[_0x1cb9('0x30')]=_0x1bf51c['attributes'][_0x1cb9('0x31')]?_0x1bf51c['attributes']:_0x2e3cf3['model'];if(_0x409c62['query'][_0x1cb9('0x3c')]){_0x1bf51c[_0x1cb9('0x3d')]=[{'all':!![]}];}_0x1bf51c=_[_0x1cb9('0x3a')]({},_0x1bf51c,_0x409c62[_0x1cb9('0x3b')]);return db[_0x1cb9('0x28')][_0x1cb9('0x42')](_0x1bf51c)[_0x1cb9('0x21')](handleEntityNotFound(_0x397ff9,null))[_0x1cb9('0x21')](respondWithResult(_0x397ff9,null))[_0x1cb9('0x43')](handleError(_0x397ff9,null));};exports[_0x1cb9('0x44')]=function(_0x3ea88c,_0x4ce899){return db[_0x1cb9('0x28')][_0x1cb9('0x44')](_0x3ea88c[_0x1cb9('0x45')],{})['then'](respondWithResult(_0x4ce899,0xc9))[_0x1cb9('0x43')](handleError(_0x4ce899,null));};exports[_0x1cb9('0x46')]=function(_0x3c6044,_0x2efdbb){return db[_0x1cb9('0x28')]['bulkCreate'](_0x3c6044[_0x1cb9('0x45')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2efdbb,0xc9))[_0x1cb9('0x43')](handleError(_0x2efdbb,null));};exports['update']=function(_0x1cf2ee,_0x3aed49){if(_0x1cf2ee[_0x1cb9('0x45')]['id']){delete _0x1cf2ee[_0x1cb9('0x45')]['id'];}return db['AnalyticFieldReport'][_0x1cb9('0x42')]({'where':{'id':_0x1cf2ee[_0x1cb9('0x40')]['id']}})[_0x1cb9('0x21')](handleEntityNotFound(_0x3aed49,null))[_0x1cb9('0x21')](saveUpdates(_0x1cf2ee[_0x1cb9('0x45')],null))[_0x1cb9('0x21')](respondWithResult(_0x3aed49,null))[_0x1cb9('0x43')](handleError(_0x3aed49,null));};exports[_0x1cb9('0x22')]=function(_0xbb500e,_0x17f10e){return db['AnalyticFieldReport']['find']({'where':{'id':_0xbb500e[_0x1cb9('0x40')]['id']}})[_0x1cb9('0x21')](handleEntityNotFound(_0x17f10e,null))[_0x1cb9('0x21')](removeEntity(_0x17f10e,null))[_0x1cb9('0x43')](handleError(_0x17f10e,null));};exports[_0x1cb9('0x47')]=function(_0x2d076b,_0x367dd7){return db[_0x1cb9('0x28')][_0x1cb9('0x22')]({'where':{'id':_0x2d076b[_0x1cb9('0x2c')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x1cb9('0x21')](respondWithResult(_0x367dd7,0xcc))['catch'](handleError(_0x367dd7,null));};exports[_0x1cb9('0x48')]=function(_0x5201e8,_0x135795,_0x53c002){return db['AnalyticCustomReport'][_0x1cb9('0x49')]({'where':{'id':_0x5201e8[_0x1cb9('0x40')]['id']}})[_0x1cb9('0x21')](handleEntityNotFound(_0x135795,null))['then'](function(_0x3c157f){if(_0x3c157f){return db[_0x1cb9('0x4a')]['transaction'](function(_0x571b33){return db[_0x1cb9('0x28')][_0x1cb9('0x22')]({'where':{'CustomReportId':_0x5201e8[_0x1cb9('0x40')]['id']},'transaction':_0x571b33})[_0x1cb9('0x21')](function(_0x3de325){var _0x310d6d=_[_0x1cb9('0x27')](_0x5201e8['body'],function(_0x345ddd){delete _0x345ddd['id'];_0x345ddd[_0x1cb9('0x4b')]=_0x5201e8[_0x1cb9('0x40')]['id'];return _0x345ddd;});return db['AnalyticFieldReport'][_0x1cb9('0x46')](_0x310d6d,{'transaction':_0x571b33});});})[_0x1cb9('0x21')](function(){return db[_0x1cb9('0x28')][_0x1cb9('0x3e')]({'where':{'CustomReportId':_0x5201e8[_0x1cb9('0x40')]['id']}});});}})[_0x1cb9('0x21')](respondWithResult(_0x135795,null))['catch'](handleError(_0x135795,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index ef3df7c..eb27643 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 _0x3995=['util','api','moment','bluebird','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3995,0x178));var _0x5399=function(_0x20e75e,_0x421a74){_0x20e75e=_0x20e75e-0x0;var _0x549de7=_0x3995[_0x20e75e];return _0x549de7;};'use strict';var _=require(_0x5399('0x0'));var util=require(_0x5399('0x1'));var logger=require('../../config/logger')(_0x5399('0x2'));var moment=require(_0x5399('0x3'));var BPromise=require(_0x5399('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5399('0x5'));var rimraf=require(_0x5399('0x6'));var config=require(_0x5399('0x7'));var attributes=require(_0x5399('0x8'));module[_0x5399('0x9')]=function(_0x4b411f,_0x11fe3d){return _0x4b411f[_0x5399('0xa')](_0x5399('0xb'),attributes,{'tableName':_0x5399('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x669a=['AnalyticFieldReport','analytics_report_fields','util','../../config/logger','bluebird','path','../../config/environment','exports','define'];(function(_0x471fcd,_0x153a44){var _0x4b716b=function(_0xddc14e){while(--_0xddc14e){_0x471fcd['push'](_0x471fcd['shift']());}};_0x4b716b(++_0x153a44);}(_0x669a,0x173));var _0xa669=function(_0x1ad948,_0x510b3f){_0x1ad948=_0x1ad948-0x0;var _0x20174b=_0x669a[_0x1ad948];return _0x20174b;};'use strict';var _=require('lodash');var util=require(_0xa669('0x0'));var logger=require(_0xa669('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa669('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa669('0x3'));var rimraf=require('rimraf');var config=require(_0xa669('0x4'));var attributes=require('./analyticFieldReport.attributes');module[_0xa669('0x5')]=function(_0x149a0c,_0x3e7afa){return _0x149a0c[_0xa669('0x6')](_0xa669('0x7'),attributes,{'tableName':_0xa669('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 152a020..2343bf1 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 _0xae7b=['AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3c8499,_0x1e052e){var _0x51d346=function(_0x311729){while(--_0x311729){_0x3c8499['push'](_0x3c8499['shift']());}};_0x51d346(++_0x1e052e);}(_0xae7b,0x13c));var _0xbae7=function(_0x5cd70a,_0x51f70a){_0x5cd70a=_0x5cd70a-0x0;var _0x28d47e=_0xae7b[_0x5cd70a];return _0x28d47e;};'use strict';var _=require(_0xbae7('0x0'));var util=require(_0xbae7('0x1'));var moment=require(_0xbae7('0x2'));var BPromise=require(_0xbae7('0x3'));var rs=require(_0xbae7('0x4'));var fs=require('fs');var Redis=require(_0xbae7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbae7('0x6'));var logger=require('../../config/logger')(_0xbae7('0x7'));var config=require(_0xbae7('0x8'));var jayson=require(_0xbae7('0x9'));var client=jayson[_0xbae7('0xa')][_0xbae7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d63a9,_0x590ce0,_0x3117e9){return new BPromise(function(_0x4b4358,_0x4614d4){return client[_0xbae7('0xc')](_0x3d63a9,_0x3117e9)[_0xbae7('0xd')](function(_0x40652a){logger['info'](_0xbae7('0xe'),_0x590ce0,_0xbae7('0xf'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x590ce0,_0xbae7('0xf'),JSON[_0xbae7('0x10')](_0x40652a));if(_0x40652a[_0xbae7('0x11')]){if(_0x40652a[_0xbae7('0x11')]['code']===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x590ce0,_0x40652a['error'][_0xbae7('0x12')]);return _0x4614d4(_0x40652a[_0xbae7('0x11')]['message']);}logger[_0xbae7('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x590ce0,_0x40652a[_0xbae7('0x11')][_0xbae7('0x12')]);return _0x4b4358(_0x40652a[_0xbae7('0x11')]['message']);}else{logger[_0xbae7('0x13')](_0xbae7('0xe'),_0x590ce0,'request\x20sent');_0x4b4358(_0x40652a[_0xbae7('0x14')][_0xbae7('0x12')]);}})[_0xbae7('0x15')](function(_0x3af6ef){logger[_0xbae7('0x11')](_0xbae7('0xe'),_0x590ce0,_0x3af6ef);_0x4614d4(_0x3af6ef);});});} \ No newline at end of file +var _0x1f64=['debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','AnalyticFieldReport,\x20%s,\x20%s'];(function(_0x2f3d29,_0x150e7b){var _0x53d69d=function(_0x45f6ec){while(--_0x45f6ec){_0x2f3d29['push'](_0x2f3d29['shift']());}};_0x53d69d(++_0x150e7b);}(_0x1f64,0x15c));var _0x41f6=function(_0x47c83c,_0x19f3f7){_0x47c83c=_0x47c83c-0x0;var _0xeed78c=_0x1f64[_0x47c83c];return _0xeed78c;};'use strict';var _=require(_0x41f6('0x0'));var util=require(_0x41f6('0x1'));var moment=require(_0x41f6('0x2'));var BPromise=require('bluebird');var rs=require(_0x41f6('0x3'));var fs=require('fs');var Redis=require(_0x41f6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x41f6('0x5'));var logger=require(_0x41f6('0x6'))(_0x41f6('0x7'));var config=require(_0x41f6('0x8'));var jayson=require(_0x41f6('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39e757,_0x265043,_0x3e5f9b){return new BPromise(function(_0x2e655a,_0x136032){return client[_0x41f6('0xa')](_0x39e757,_0x3e5f9b)['then'](function(_0xb3c367){logger['info'](_0x41f6('0xb'),_0x265043,'request\x20sent');logger[_0x41f6('0xc')](_0x41f6('0xd'),_0x265043,'request\x20sent',JSON[_0x41f6('0xe')](_0xb3c367));if(_0xb3c367[_0x41f6('0xf')]){if(_0xb3c367[_0x41f6('0xf')][_0x41f6('0x10')]===0x1f4){logger[_0x41f6('0xf')](_0x41f6('0xb'),_0x265043,_0xb3c367[_0x41f6('0xf')][_0x41f6('0x11')]);return _0x136032(_0xb3c367['error']['message']);}logger[_0x41f6('0xf')](_0x41f6('0xb'),_0x265043,_0xb3c367[_0x41f6('0xf')][_0x41f6('0x11')]);return _0x2e655a(_0xb3c367[_0x41f6('0xf')]['message']);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x265043,_0x41f6('0x12'));_0x2e655a(_0xb3c367['result'][_0x41f6('0x11')]);}})[_0x41f6('0x13')](function(_0x2f2959){logger['error'](_0x41f6('0xb'),_0x265043,_0x2f2959);_0x136032(_0x2f2959);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index fd85218..2b0cb28 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 _0x47ed=['Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','show','post','isAuthenticated','create','/create_many','bulkCreate','/:id/create_many','addFields','put','/:id','update','/destroy_many','bulkDestroy','delete','multer','util','connect-timeout','express'];(function(_0x3776b4,_0xbf61f4){var _0x2bd258=function(_0x15215c){while(--_0x15215c){_0x3776b4['push'](_0x3776b4['shift']());}};_0x2bd258(++_0xbf61f4);}(_0x47ed,0x1be));var _0xd47e=function(_0x425036,_0x39bebc){_0x425036=_0x425036-0x0;var _0x7fc880=_0x47ed[_0x425036];return _0x7fc880;};'use strict';var multer=require(_0xd47e('0x0'));var util=require(_0xd47e('0x1'));var path=require('path');var timeout=require(_0xd47e('0x2'));var express=require(_0xd47e('0x3'));var router=express[_0xd47e('0x4')]();var fs_extra=require(_0xd47e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd47e('0x6'));var config=require(_0xd47e('0x7'));var controller=require(_0xd47e('0x8'));router[_0xd47e('0x9')]('/',auth['isAuthenticated'](),controller[_0xd47e('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd47e('0xb')]);router[_0xd47e('0xc')]('/',auth[_0xd47e('0xd')](),controller[_0xd47e('0xe')]);router[_0xd47e('0xc')](_0xd47e('0xf'),auth['isAuthenticated'](),controller[_0xd47e('0x10')]);router['post'](_0xd47e('0x11'),auth[_0xd47e('0xd')](),controller[_0xd47e('0x12')]);router[_0xd47e('0x13')](_0xd47e('0x14'),auth[_0xd47e('0xd')](),controller[_0xd47e('0x15')]);router['delete'](_0xd47e('0x16'),auth[_0xd47e('0xd')](),controller[_0xd47e('0x17')]);router[_0xd47e('0x18')](_0xd47e('0x14'),auth[_0xd47e('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa042=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./analyticFieldReport.controller','isAuthenticated','index','get','/:id','show','post','create','/create_many','bulkCreate','addFields','put','update','delete','/destroy_many','bulkDestroy','exports','multer','util'];(function(_0xa4f636,_0xaca1b6){var _0x37e02a=function(_0x49bd47){while(--_0x49bd47){_0xa4f636['push'](_0xa4f636['shift']());}};_0x37e02a(++_0xaca1b6);}(_0xa042,0x7b));var _0x2a04=function(_0x921c13,_0x22719e){_0x921c13=_0x921c13-0x0;var _0x18d1a0=_0xa042[_0x921c13];return _0x18d1a0;};'use strict';var multer=require(_0x2a04('0x0'));var util=require(_0x2a04('0x1'));var path=require(_0x2a04('0x2'));var timeout=require(_0x2a04('0x3'));var express=require(_0x2a04('0x4'));var router=express['Router']();var fs_extra=require(_0x2a04('0x5'));var auth=require(_0x2a04('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2a04('0x7'));var controller=require(_0x2a04('0x8'));router['get']('/',auth[_0x2a04('0x9')](),controller[_0x2a04('0xa')]);router[_0x2a04('0xb')](_0x2a04('0xc'),auth['isAuthenticated'](),controller[_0x2a04('0xd')]);router[_0x2a04('0xe')]('/',auth[_0x2a04('0x9')](),controller[_0x2a04('0xf')]);router['post'](_0x2a04('0x10'),auth[_0x2a04('0x9')](),controller[_0x2a04('0x11')]);router[_0x2a04('0xe')]('/:id/create_many',auth['isAuthenticated'](),controller[_0x2a04('0x12')]);router[_0x2a04('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x2a04('0x14')]);router[_0x2a04('0x15')](_0x2a04('0x16'),auth[_0x2a04('0x9')](),controller[_0x2a04('0x17')]);router['delete'](_0x2a04('0xc'),auth[_0x2a04('0x9')](),controller['destroy']);module[_0x2a04('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index ce6f050..955ec5c 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 _0x5881=['name','TEXT','exports','STRING'];(function(_0x211cdd,_0x4f0a49){var _0x59e0a9=function(_0x272b75){while(--_0x272b75){_0x211cdd['push'](_0x211cdd['shift']());}};_0x59e0a9(++_0x4f0a49);}(_0x5881,0x1f2));var _0x1588=function(_0x138de6,_0x5d0c19){_0x138de6=_0x138de6-0x0;var _0x35f7fe=_0x5881[_0x138de6];return _0x35f7fe;};'use strict';var Sequelize=require('sequelize');module[_0x1588('0x0')]={'name':{'type':Sequelize[_0x1588('0x1')],'allowNull':![],'unique':_0x1588('0x2')},'table':{'type':Sequelize[_0x1588('0x1')]},'metric':{'type':Sequelize[_0x1588('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x49db=['name','sequelize','exports','STRING'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0x49db,0xc5));var _0xb49d=function(_0x2fce93,_0x1d4d2e){_0x2fce93=_0x2fce93-0x0;var _0x4b3380=_0x49db[_0x2fce93];return _0x4b3380;};'use strict';var Sequelize=require(_0xb49d('0x0'));module[_0xb49d('0x1')]={'name':{'type':Sequelize[_0xb49d('0x2')],'allowNull':![],'unique':_0xb49d('0x3')},'table':{'type':Sequelize[_0xb49d('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xb49d('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 25e955c..9d62753 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 _0x7e80=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','count','offset','limit','status','set','json','reject','save','update','then','destroy','get','Metrics','UserProfileResource','error','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','include','rows','catch','params','keys','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','util','path','ejs','fs-extra','lodash','squel'];(function(_0x422e1f,_0x27dae5){var _0x55f806=function(_0x272920){while(--_0x272920){_0x422e1f['push'](_0x422e1f['shift']());}};_0x55f806(++_0x27dae5);}(_0x7e80,0x9b));var _0x07e8=function(_0x27d0ad,_0x3f8bef){_0x27d0ad=_0x27d0ad-0x0;var _0x4eec43=_0x7e80[_0x27d0ad];return _0x4eec43;};'use strict';var emlformat=require(_0x07e8('0x0'));var rimraf=require(_0x07e8('0x1'));var zipdir=require(_0x07e8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x07e8('0x3'));var path=require(_0x07e8('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x07e8('0x5'));var fs=require('fs');var fs_extra=require(_0x07e8('0x6'));var _=require(_0x07e8('0x7'));var squel=require(_0x07e8('0x8'));var crypto=require(_0x07e8('0x9'));var jsforce=require(_0x07e8('0xa'));var deskjs=require(_0x07e8('0xb'));var toCsv=require(_0x07e8('0xc'));var querystring=require(_0x07e8('0xd'));var Papa=require(_0x07e8('0xe'));var Redis=require(_0x07e8('0xf'));var authService=require(_0x07e8('0x10'));var qs=require(_0x07e8('0x11'));var as=require(_0x07e8('0x12'));var hardwareService=require(_0x07e8('0x13'));var logger=require(_0x07e8('0x14'))(_0x07e8('0x15'));var utils=require(_0x07e8('0x16'));var config=require(_0x07e8('0x17'));var licenseUtil=require(_0x07e8('0x18'));var db=require(_0x07e8('0x19'))['db'];function respondWithStatusCode(_0x281436,_0x2bdcbb){_0x2bdcbb=_0x2bdcbb||0xcc;return function(_0x52e76d){if(_0x52e76d){return _0x281436[_0x07e8('0x1a')](_0x2bdcbb);}return _0x281436['status'](_0x2bdcbb)[_0x07e8('0x1b')]();};}function respondWithResult(_0x56f009,_0x229b32){_0x229b32=_0x229b32||0xc8;return function(_0x2ef955){if(_0x2ef955){return _0x56f009['status'](_0x229b32)['json'](_0x2ef955);}};}function respondWithFilteredResult(_0xc008a1,_0x54a507){return function(_0x3bbcc5){if(_0x3bbcc5){var _0x5ab106=_0x3bbcc5[_0x07e8('0x1c')],_0x57cf6a=_0x54a507[_0x07e8('0x1d')],_0x341040=_0x54a507['offset']+_0x54a507[_0x07e8('0x1e')],_0xef6c4;if(_0x341040>=_0x5ab106){_0x341040=_0x5ab106;_0xef6c4=0xc8;}else{_0xef6c4=0xce;}_0xc008a1[_0x07e8('0x1f')](_0xef6c4);return _0xc008a1[_0x07e8('0x20')]('Content-Range',_0x57cf6a+'-'+_0x341040+'/'+_0x5ab106)[_0x07e8('0x21')](_0x3bbcc5);}return null;};}function patchUpdates(_0x559c10){return function(_0x56bad3){try{jsonpatch['apply'](_0x56bad3,_0x559c10,!![]);}catch(_0x28f299){return BPromise[_0x07e8('0x22')](_0x28f299);}return _0x56bad3[_0x07e8('0x23')]();};}function saveUpdates(_0x42c779,_0x2c7666){return function(_0x3e2b73){if(_0x3e2b73){return _0x3e2b73[_0x07e8('0x24')](_0x42c779)[_0x07e8('0x25')](function(_0x514dd3){return _0x514dd3;});}return null;};}function removeEntity(_0x47ac7e,_0x2081ac){return function(_0x3bb201){if(_0x3bb201){return _0x3bb201[_0x07e8('0x26')]()[_0x07e8('0x25')](function(){var _0x3a13a8=_0x3bb201[_0x07e8('0x27')]({'plain':!![]});var _0x176c10=_0x07e8('0x28');return db[_0x07e8('0x29')][_0x07e8('0x26')]({'where':{'type':_0x176c10,'resourceId':_0x3a13a8['id']}})[_0x07e8('0x25')](function(){return _0x3bb201;});})[_0x07e8('0x25')](function(){_0x47ac7e[_0x07e8('0x1f')](0xcc)[_0x07e8('0x1b')]();});}};}function handleEntityNotFound(_0x1ce826,_0x2b03af){return function(_0x3d4c06){if(!_0x3d4c06){_0x1ce826['sendStatus'](0x194);}return _0x3d4c06;};}function handleError(_0x392eeb,_0x4ef8b5){_0x4ef8b5=_0x4ef8b5||0x1f4;return function(_0x5794cb){logger[_0x07e8('0x2a')](_0x5794cb[_0x07e8('0x2b')]);if(_0x5794cb['name']){delete _0x5794cb[_0x07e8('0x2c')];}_0x392eeb[_0x07e8('0x1f')](_0x4ef8b5)[_0x07e8('0x2d')](_0x5794cb);};}exports['index']=function(_0x261b44,_0x3efbe9){var _0x58084a={},_0x853250={},_0xdeb66d={'count':0x0,'rows':[]};var _0x5e474c=_[_0x07e8('0x2e')](db[_0x07e8('0x2f')][_0x07e8('0x30')],function(_0x1d94a5){return{'name':_0x1d94a5[_0x07e8('0x31')],'type':_0x1d94a5[_0x07e8('0x32')][_0x07e8('0x33')]};});_0x853250[_0x07e8('0x34')]=_[_0x07e8('0x2e')](_0x5e474c,_0x07e8('0x2c'));_0x853250[_0x07e8('0x35')]=_['keys'](_0x261b44[_0x07e8('0x35')]);_0x853250[_0x07e8('0x36')]=_[_0x07e8('0x37')](_0x853250[_0x07e8('0x34')],_0x853250[_0x07e8('0x35')]);_0x58084a[_0x07e8('0x38')]=_[_0x07e8('0x37')](_0x853250[_0x07e8('0x34')],qs[_0x07e8('0x39')](_0x261b44[_0x07e8('0x35')][_0x07e8('0x39')]));_0x58084a[_0x07e8('0x38')]=_0x58084a[_0x07e8('0x38')][_0x07e8('0x3a')]?_0x58084a[_0x07e8('0x38')]:_0x853250[_0x07e8('0x34')];if(!_0x261b44[_0x07e8('0x35')][_0x07e8('0x3b')](_0x07e8('0x3c'))){_0x58084a[_0x07e8('0x1e')]=qs['limit'](_0x261b44[_0x07e8('0x35')][_0x07e8('0x1e')]);_0x58084a[_0x07e8('0x1d')]=qs['offset'](_0x261b44[_0x07e8('0x35')][_0x07e8('0x1d')]);}_0x58084a[_0x07e8('0x3d')]=qs[_0x07e8('0x3e')](_0x261b44[_0x07e8('0x35')][_0x07e8('0x3e')]);_0x58084a['where']=qs[_0x07e8('0x36')](_['pick'](_0x261b44[_0x07e8('0x35')],_0x853250[_0x07e8('0x36')]),_0x5e474c);if(_0x261b44[_0x07e8('0x35')][_0x07e8('0x3f')]){_0x58084a['where']=_['merge'](_0x58084a[_0x07e8('0x40')],{'$or':_[_0x07e8('0x2e')](_0x5e474c,function(_0x2e5a58){if(_0x2e5a58['type']!=='VIRTUAL'){var _0x41ef8e={};_0x41ef8e[_0x2e5a58[_0x07e8('0x2c')]]={'$like':'%'+_0x261b44[_0x07e8('0x35')][_0x07e8('0x3f')]+'%'};return _0x41ef8e;}})});}_0x58084a=_[_0x07e8('0x41')]({},_0x58084a,_0x261b44['options']);var _0x22049f={'where':_0x58084a[_0x07e8('0x40')]};return db[_0x07e8('0x2f')][_0x07e8('0x1c')](_0x22049f)[_0x07e8('0x25')](function(_0x160f56){_0xdeb66d[_0x07e8('0x1c')]=_0x160f56;if(_0x261b44[_0x07e8('0x35')]['includeAll']){_0x58084a[_0x07e8('0x42')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x58084a);})[_0x07e8('0x25')](function(_0xb48230){_0xdeb66d[_0x07e8('0x43')]=_0xb48230;return _0xdeb66d;})[_0x07e8('0x25')](respondWithFilteredResult(_0x3efbe9,_0x58084a))[_0x07e8('0x44')](handleError(_0x3efbe9,null));};exports['show']=function(_0x4edaf6,_0xe92455){var _0x38bb58={'raw':!![],'where':{'id':_0x4edaf6[_0x07e8('0x45')]['id']}},_0x590987={};_0x590987[_0x07e8('0x34')]=_[_0x07e8('0x46')](db[_0x07e8('0x2f')][_0x07e8('0x30')]);_0x590987[_0x07e8('0x35')]=_['keys'](_0x4edaf6[_0x07e8('0x35')]);_0x590987['filters']=_[_0x07e8('0x37')](_0x590987[_0x07e8('0x34')],_0x590987[_0x07e8('0x35')]);_0x38bb58[_0x07e8('0x38')]=_[_0x07e8('0x37')](_0x590987[_0x07e8('0x34')],qs[_0x07e8('0x39')](_0x4edaf6[_0x07e8('0x35')][_0x07e8('0x39')]));_0x38bb58[_0x07e8('0x38')]=_0x38bb58[_0x07e8('0x38')][_0x07e8('0x3a')]?_0x38bb58[_0x07e8('0x38')]:_0x590987['model'];if(_0x4edaf6[_0x07e8('0x35')][_0x07e8('0x47')]){_0x38bb58['include']=[{'all':!![]}];}_0x38bb58=_[_0x07e8('0x41')]({},_0x38bb58,_0x4edaf6[_0x07e8('0x48')]);return db[_0x07e8('0x2f')][_0x07e8('0x49')](_0x38bb58)[_0x07e8('0x25')](handleEntityNotFound(_0xe92455,null))[_0x07e8('0x25')](respondWithResult(_0xe92455,null))[_0x07e8('0x44')](handleError(_0xe92455,null));};exports[_0x07e8('0x4a')]=function(_0x23ab19,_0x2d530d){return db[_0x07e8('0x2f')][_0x07e8('0x4a')](_0x23ab19[_0x07e8('0x4b')],{})[_0x07e8('0x25')](function(_0x104c0c){var _0x1a09f2=_0x23ab19['user'][_0x07e8('0x27')]({'plain':!![]});if(!_0x1a09f2)throw new Error(_0x07e8('0x4c'));if(_0x1a09f2[_0x07e8('0x4d')]===_0x07e8('0x4e')){var _0x2dc0a8=_0x104c0c[_0x07e8('0x27')]({'plain':!![]});var _0x54c37f=_0x07e8('0x28');return db[_0x07e8('0x4f')]['find']({'where':{'name':_0x54c37f,'userProfileId':_0x1a09f2[_0x07e8('0x50')]},'raw':!![]})[_0x07e8('0x25')](function(_0x7db79e){if(_0x7db79e&&_0x7db79e[_0x07e8('0x51')]===0x0){return db[_0x07e8('0x29')][_0x07e8('0x4a')]({'name':_0x2dc0a8['name'],'resourceId':_0x2dc0a8['id'],'type':_0x7db79e[_0x07e8('0x2c')],'sectionId':_0x7db79e['id']},{})['then'](function(){return _0x104c0c;});}else{return _0x104c0c;}})[_0x07e8('0x44')](function(_0x381a11){logger[_0x07e8('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x381a11);throw _0x381a11;});}return _0x104c0c;})[_0x07e8('0x25')](respondWithResult(_0x2d530d,0xc9))[_0x07e8('0x44')](handleError(_0x2d530d,null));};exports[_0x07e8('0x24')]=function(_0x402b80,_0x2b9a8a){if(_0x402b80[_0x07e8('0x4b')]['id']){delete _0x402b80[_0x07e8('0x4b')]['id'];}return db[_0x07e8('0x2f')][_0x07e8('0x49')]({'where':{'id':_0x402b80[_0x07e8('0x45')]['id']}})['then'](handleEntityNotFound(_0x2b9a8a,null))['then'](saveUpdates(_0x402b80['body'],null))[_0x07e8('0x25')](respondWithResult(_0x2b9a8a,null))['catch'](handleError(_0x2b9a8a,null));};exports['destroy']=function(_0x5d2903,_0x47e3a1){return db['AnalyticMetric'][_0x07e8('0x49')]({'where':{'id':_0x5d2903[_0x07e8('0x45')]['id']}})[_0x07e8('0x25')](handleEntityNotFound(_0x47e3a1,null))['then'](removeEntity(_0x47e3a1,null))[_0x07e8('0x44')](handleError(_0x47e3a1,null));}; \ No newline at end of file +var _0xd015=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','user'];(function(_0x369b02,_0x39f4b2){var _0x1a252b=function(_0x59e1f1){while(--_0x59e1f1){_0x369b02['push'](_0x369b02['shift']());}};_0x1a252b(++_0x39f4b2);}(_0xd015,0x1e1));var _0x5d01=function(_0x3358f1,_0x5d740){_0x3358f1=_0x3358f1-0x0;var _0x15bfd5=_0xd015[_0x3358f1];return _0x15bfd5;};'use strict';var emlformat=require(_0x5d01('0x0'));var rimraf=require(_0x5d01('0x1'));var zipdir=require(_0x5d01('0x2'));var jsonpatch=require(_0x5d01('0x3'));var rp=require('request-promise');var moment=require(_0x5d01('0x4'));var BPromise=require(_0x5d01('0x5'));var Mustache=require(_0x5d01('0x6'));var util=require(_0x5d01('0x7'));var path=require(_0x5d01('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5d01('0x9'));var fs=require('fs');var fs_extra=require(_0x5d01('0xa'));var _=require(_0x5d01('0xb'));var squel=require('squel');var crypto=require(_0x5d01('0xc'));var jsforce=require(_0x5d01('0xd'));var deskjs=require(_0x5d01('0xe'));var toCsv=require(_0x5d01('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5d01('0x10'));var qs=require(_0x5d01('0x11'));var as=require(_0x5d01('0x12'));var hardwareService=require(_0x5d01('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x5d01('0x14'));var config=require(_0x5d01('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1334f3,_0x14bb70){_0x14bb70=_0x14bb70||0xcc;return function(_0x38a258){if(_0x38a258){return _0x1334f3[_0x5d01('0x16')](_0x14bb70);}return _0x1334f3[_0x5d01('0x17')](_0x14bb70)[_0x5d01('0x18')]();};}function respondWithResult(_0x1c2fb4,_0x2575fb){_0x2575fb=_0x2575fb||0xc8;return function(_0x380bbb){if(_0x380bbb){return _0x1c2fb4['status'](_0x2575fb)[_0x5d01('0x19')](_0x380bbb);}};}function respondWithFilteredResult(_0x37bcaf,_0xe12429){return function(_0x24efd9){if(_0x24efd9){var _0x1e9231=_0x24efd9[_0x5d01('0x1a')],_0x4a7a81=_0xe12429[_0x5d01('0x1b')],_0x237965=_0xe12429[_0x5d01('0x1b')]+_0xe12429['limit'],_0x43c597;if(_0x237965>=_0x1e9231){_0x237965=_0x1e9231;_0x43c597=0xc8;}else{_0x43c597=0xce;}_0x37bcaf['status'](_0x43c597);return _0x37bcaf['set']('Content-Range',_0x4a7a81+'-'+_0x237965+'/'+_0x1e9231)[_0x5d01('0x19')](_0x24efd9);}return null;};}function patchUpdates(_0x20375b){return function(_0x491295){try{jsonpatch[_0x5d01('0x1c')](_0x491295,_0x20375b,!![]);}catch(_0x3aff00){return BPromise[_0x5d01('0x1d')](_0x3aff00);}return _0x491295[_0x5d01('0x1e')]();};}function saveUpdates(_0x593bb2,_0x1b1e11){return function(_0x259f2a){if(_0x259f2a){return _0x259f2a[_0x5d01('0x1f')](_0x593bb2)[_0x5d01('0x20')](function(_0x586325){return _0x586325;});}return null;};}function removeEntity(_0x1c4750,_0x2c52dd){return function(_0x4bd1ce){if(_0x4bd1ce){return _0x4bd1ce[_0x5d01('0x21')]()[_0x5d01('0x20')](function(){var _0x1da87e=_0x4bd1ce[_0x5d01('0x22')]({'plain':!![]});var _0x27a953=_0x5d01('0x23');return db['UserProfileResource'][_0x5d01('0x21')]({'where':{'type':_0x27a953,'resourceId':_0x1da87e['id']}})[_0x5d01('0x20')](function(){return _0x4bd1ce;});})[_0x5d01('0x20')](function(){_0x1c4750[_0x5d01('0x17')](0xcc)[_0x5d01('0x18')]();});}};}function handleEntityNotFound(_0x3237b6,_0x300b13){return function(_0x4ced2f){if(!_0x4ced2f){_0x3237b6[_0x5d01('0x16')](0x194);}return _0x4ced2f;};}function handleError(_0xc8c180,_0x59c768){_0x59c768=_0x59c768||0x1f4;return function(_0x35554c){logger[_0x5d01('0x24')](_0x35554c[_0x5d01('0x25')]);if(_0x35554c[_0x5d01('0x26')]){delete _0x35554c[_0x5d01('0x26')];}_0xc8c180[_0x5d01('0x17')](_0x59c768)['send'](_0x35554c);};}exports[_0x5d01('0x27')]=function(_0x5e4c10,_0x12a71d){var _0x3e99e2={},_0x3aff6e={},_0x4d6934={'count':0x0,'rows':[]};var _0x148417=_[_0x5d01('0x28')](db[_0x5d01('0x29')]['rawAttributes'],function(_0x3d1a9b){return{'name':_0x3d1a9b[_0x5d01('0x2a')],'type':_0x3d1a9b[_0x5d01('0x2b')][_0x5d01('0x2c')]};});_0x3aff6e[_0x5d01('0x2d')]=_[_0x5d01('0x28')](_0x148417,_0x5d01('0x26'));_0x3aff6e[_0x5d01('0x2e')]=_[_0x5d01('0x2f')](_0x5e4c10[_0x5d01('0x2e')]);_0x3aff6e[_0x5d01('0x30')]=_[_0x5d01('0x31')](_0x3aff6e[_0x5d01('0x2d')],_0x3aff6e[_0x5d01('0x2e')]);_0x3e99e2[_0x5d01('0x32')]=_[_0x5d01('0x31')](_0x3aff6e['model'],qs[_0x5d01('0x33')](_0x5e4c10[_0x5d01('0x2e')]['fields']));_0x3e99e2[_0x5d01('0x32')]=_0x3e99e2[_0x5d01('0x32')][_0x5d01('0x34')]?_0x3e99e2[_0x5d01('0x32')]:_0x3aff6e[_0x5d01('0x2d')];if(!_0x5e4c10[_0x5d01('0x2e')][_0x5d01('0x35')](_0x5d01('0x36'))){_0x3e99e2[_0x5d01('0x37')]=qs[_0x5d01('0x37')](_0x5e4c10[_0x5d01('0x2e')][_0x5d01('0x37')]);_0x3e99e2['offset']=qs[_0x5d01('0x1b')](_0x5e4c10[_0x5d01('0x2e')]['offset']);}_0x3e99e2[_0x5d01('0x38')]=qs['sort'](_0x5e4c10[_0x5d01('0x2e')][_0x5d01('0x39')]);_0x3e99e2[_0x5d01('0x3a')]=qs[_0x5d01('0x30')](_[_0x5d01('0x3b')](_0x5e4c10['query'],_0x3aff6e[_0x5d01('0x30')]),_0x148417);if(_0x5e4c10['query'][_0x5d01('0x3c')]){_0x3e99e2[_0x5d01('0x3a')]=_[_0x5d01('0x3d')](_0x3e99e2[_0x5d01('0x3a')],{'$or':_['map'](_0x148417,function(_0x54358b){if(_0x54358b['type']!==_0x5d01('0x3e')){var _0x1f9b04={};_0x1f9b04[_0x54358b[_0x5d01('0x26')]]={'$like':'%'+_0x5e4c10[_0x5d01('0x2e')]['filter']+'%'};return _0x1f9b04;}})});}_0x3e99e2=_[_0x5d01('0x3d')]({},_0x3e99e2,_0x5e4c10[_0x5d01('0x3f')]);var _0x2434ec={'where':_0x3e99e2['where']};return db['AnalyticMetric'][_0x5d01('0x1a')](_0x2434ec)[_0x5d01('0x20')](function(_0x3cd441){_0x4d6934[_0x5d01('0x1a')]=_0x3cd441;if(_0x5e4c10['query'][_0x5d01('0x40')]){_0x3e99e2[_0x5d01('0x41')]=[{'all':!![]}];}return db[_0x5d01('0x29')][_0x5d01('0x42')](_0x3e99e2);})[_0x5d01('0x20')](function(_0x5e6f26){_0x4d6934['rows']=_0x5e6f26;return _0x4d6934;})['then'](respondWithFilteredResult(_0x12a71d,_0x3e99e2))[_0x5d01('0x43')](handleError(_0x12a71d,null));};exports[_0x5d01('0x44')]=function(_0x35993d,_0xd85986){var _0x202b3d={'raw':!![],'where':{'id':_0x35993d['params']['id']}},_0x511736={};_0x511736[_0x5d01('0x2d')]=_[_0x5d01('0x2f')](db['AnalyticMetric']['rawAttributes']);_0x511736[_0x5d01('0x2e')]=_[_0x5d01('0x2f')](_0x35993d[_0x5d01('0x2e')]);_0x511736[_0x5d01('0x30')]=_[_0x5d01('0x31')](_0x511736[_0x5d01('0x2d')],_0x511736[_0x5d01('0x2e')]);_0x202b3d[_0x5d01('0x32')]=_[_0x5d01('0x31')](_0x511736[_0x5d01('0x2d')],qs[_0x5d01('0x33')](_0x35993d[_0x5d01('0x2e')]['fields']));_0x202b3d[_0x5d01('0x32')]=_0x202b3d[_0x5d01('0x32')][_0x5d01('0x34')]?_0x202b3d['attributes']:_0x511736[_0x5d01('0x2d')];if(_0x35993d[_0x5d01('0x2e')]['includeAll']){_0x202b3d[_0x5d01('0x41')]=[{'all':!![]}];}_0x202b3d=_['merge']({},_0x202b3d,_0x35993d[_0x5d01('0x3f')]);return db['AnalyticMetric'][_0x5d01('0x45')](_0x202b3d)['then'](handleEntityNotFound(_0xd85986,null))[_0x5d01('0x20')](respondWithResult(_0xd85986,null))[_0x5d01('0x43')](handleError(_0xd85986,null));};exports['create']=function(_0x5c8999,_0x114285){return db[_0x5d01('0x29')][_0x5d01('0x46')](_0x5c8999['body'],{})['then'](function(_0x4cb0fe){var _0xad674d=_0x5c8999[_0x5d01('0x47')][_0x5d01('0x22')]({'plain':!![]});if(!_0xad674d)throw new Error(_0x5d01('0x48'));if(_0xad674d[_0x5d01('0x49')]==='user'){var _0x3c6d84=_0x4cb0fe[_0x5d01('0x22')]({'plain':!![]});var _0x1f340f='Metrics';return db[_0x5d01('0x4a')]['find']({'where':{'name':_0x1f340f,'userProfileId':_0xad674d[_0x5d01('0x4b')]},'raw':!![]})[_0x5d01('0x20')](function(_0x2497f2){if(_0x2497f2&&_0x2497f2[_0x5d01('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x3c6d84['name'],'resourceId':_0x3c6d84['id'],'type':_0x2497f2[_0x5d01('0x26')],'sectionId':_0x2497f2['id']},{})[_0x5d01('0x20')](function(){return _0x4cb0fe;});}else{return _0x4cb0fe;}})[_0x5d01('0x43')](function(_0x2a44cd){logger[_0x5d01('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a44cd);throw _0x2a44cd;});}return _0x4cb0fe;})['then'](respondWithResult(_0x114285,0xc9))[_0x5d01('0x43')](handleError(_0x114285,null));};exports[_0x5d01('0x1f')]=function(_0x2d2e3a,_0x1ef98f){if(_0x2d2e3a[_0x5d01('0x4d')]['id']){delete _0x2d2e3a['body']['id'];}return db[_0x5d01('0x29')][_0x5d01('0x45')]({'where':{'id':_0x2d2e3a[_0x5d01('0x4e')]['id']}})[_0x5d01('0x20')](handleEntityNotFound(_0x1ef98f,null))['then'](saveUpdates(_0x2d2e3a[_0x5d01('0x4d')],null))[_0x5d01('0x20')](respondWithResult(_0x1ef98f,null))[_0x5d01('0x43')](handleError(_0x1ef98f,null));};exports['destroy']=function(_0x5763f4,_0x78849){return db[_0x5d01('0x29')][_0x5d01('0x45')]({'where':{'id':_0x5763f4[_0x5d01('0x4e')]['id']}})[_0x5d01('0x20')](handleEntityNotFound(_0x78849,null))[_0x5d01('0x20')](removeEntity(_0x78849,null))['catch'](handleError(_0x78849,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index ce3c539..ff016a7 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 _0x95a4=['path','rimraf','../../config/environment','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x14662f,_0x141b70){var _0x28bee7=function(_0x32e5db){while(--_0x32e5db){_0x14662f['push'](_0x14662f['shift']());}};_0x28bee7(++_0x141b70);}(_0x95a4,0x10b));var _0x495a=function(_0xf6021,_0x10c394){_0xf6021=_0xf6021-0x0;var _0x41662d=_0x95a4[_0xf6021];return _0x41662d;};'use strict';var _=require(_0x495a('0x0'));var util=require(_0x495a('0x1'));var logger=require(_0x495a('0x2'))(_0x495a('0x3'));var moment=require(_0x495a('0x4'));var BPromise=require('bluebird');var rp=require(_0x495a('0x5'));var fs=require('fs');var path=require(_0x495a('0x6'));var rimraf=require(_0x495a('0x7'));var config=require(_0x495a('0x8'));var attributes=require(_0x495a('0x9'));module['exports']=function(_0x2089cb,_0x115824){return _0x2089cb[_0x495a('0xa')](_0x495a('0xb'),attributes,{'tableName':_0x495a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x090b=['lodash','api','request-promise','path','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics'];(function(_0x1ce3f0,_0x4bcfa8){var _0x31b9dd=function(_0x44fa7c){while(--_0x44fa7c){_0x1ce3f0['push'](_0x1ce3f0['shift']());}};_0x31b9dd(++_0x4bcfa8);}(_0x090b,0x120));var _0xb090=function(_0x15b887,_0x544016){_0x15b887=_0x15b887-0x0;var _0x29de2a=_0x090b[_0x15b887];return _0x29de2a;};'use strict';var _=require(_0xb090('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb090('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb090('0x2'));var fs=require('fs');var path=require(_0xb090('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb090('0x4'));module[_0xb090('0x5')]=function(_0x49126d,_0x2957a2){return _0x49126d[_0xb090('0x6')](_0xb090('0x7'),attributes,{'tableName':_0xb090('0x8'),'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 439da41..48a848c 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 _0xbd28=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xbd28,0xa6));var _0x8bd2=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xbd28[_0x474bc0];return _0x4b24cf;};'use strict';var _=require('lodash');var util=require(_0x8bd2('0x0'));var moment=require(_0x8bd2('0x1'));var BPromise=require(_0x8bd2('0x2'));var rs=require(_0x8bd2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bd2('0x4'))['db'];var utils=require(_0x8bd2('0x5'));var logger=require('../../config/logger')(_0x8bd2('0x6'));var config=require(_0x8bd2('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8bd2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x363665,_0x993128,_0x54d617){return new BPromise(function(_0x1d2b04,_0x139ba9){return client[_0x8bd2('0x9')](_0x363665,_0x54d617)[_0x8bd2('0xa')](function(_0x5ab7f3){logger[_0x8bd2('0xb')](_0x8bd2('0xc'),_0x993128,_0x8bd2('0xd'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x993128,'request\x20sent',JSON[_0x8bd2('0xe')](_0x5ab7f3));if(_0x5ab7f3[_0x8bd2('0xf')]){if(_0x5ab7f3[_0x8bd2('0xf')][_0x8bd2('0x10')]===0x1f4){logger['error'](_0x8bd2('0xc'),_0x993128,_0x5ab7f3['error']['message']);return _0x139ba9(_0x5ab7f3[_0x8bd2('0xf')]['message']);}logger[_0x8bd2('0xf')](_0x8bd2('0xc'),_0x993128,_0x5ab7f3[_0x8bd2('0xf')][_0x8bd2('0x11')]);return _0x1d2b04(_0x5ab7f3[_0x8bd2('0xf')]['message']);}else{logger['info'](_0x8bd2('0xc'),_0x993128,_0x8bd2('0xd'));_0x1d2b04(_0x5ab7f3[_0x8bd2('0x12')]['message']);}})[_0x8bd2('0x13')](function(_0x2cfaf9){logger['error'](_0x8bd2('0xc'),_0x993128,_0x2cfaf9);_0x139ba9(_0x2cfaf9);});});} \ No newline at end of file +var _0xcc8d=['ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x5dd879,_0x5e049b){var _0x475efa=function(_0x53d1a7){while(--_0x53d1a7){_0x5dd879['push'](_0x5dd879['shift']());}};_0x475efa(++_0x5e049b);}(_0xcc8d,0x74));var _0xdcc8=function(_0x456a84,_0x46bc0b){_0x456a84=_0x456a84-0x0;var _0x1117d6=_0xcc8d[_0x456a84];return _0x1117d6;};'use strict';var _=require(_0xdcc8('0x0'));var util=require(_0xdcc8('0x1'));var moment=require(_0xdcc8('0x2'));var BPromise=require(_0xdcc8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdcc8('0x4'));var db=require(_0xdcc8('0x5'))['db'];var utils=require(_0xdcc8('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xdcc8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdcc8('0x8')][_0xdcc8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e0dda,_0x1c4470,_0x273c84){return new BPromise(function(_0x451b33,_0x5efcfd){return client['request'](_0x5e0dda,_0x273c84)[_0xdcc8('0xa')](function(_0x3b423f){logger[_0xdcc8('0xb')](_0xdcc8('0xc'),_0x1c4470,_0xdcc8('0xd'));logger[_0xdcc8('0xe')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x1c4470,_0xdcc8('0xd'),JSON[_0xdcc8('0xf')](_0x3b423f));if(_0x3b423f[_0xdcc8('0x10')]){if(_0x3b423f[_0xdcc8('0x10')]['code']===0x1f4){logger[_0xdcc8('0x10')](_0xdcc8('0xc'),_0x1c4470,_0x3b423f[_0xdcc8('0x10')][_0xdcc8('0x11')]);return _0x5efcfd(_0x3b423f['error']['message']);}logger[_0xdcc8('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x1c4470,_0x3b423f['error'][_0xdcc8('0x11')]);return _0x451b33(_0x3b423f[_0xdcc8('0x10')][_0xdcc8('0x11')]);}else{logger[_0xdcc8('0xb')](_0xdcc8('0xc'),_0x1c4470,_0xdcc8('0xd'));_0x451b33(_0x3b423f[_0xdcc8('0x12')][_0xdcc8('0x11')]);}})[_0xdcc8('0x13')](function(_0xb679b8){logger[_0xdcc8('0x10')](_0xdcc8('0xc'),_0x1c4470,_0xb679b8);_0x5efcfd(_0xb679b8);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 7e37c9a..fc1197e 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 _0x5c00=['delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0xb006a,_0x658f){var _0x3b8a14=function(_0x354d36){while(--_0x354d36){_0xb006a['push'](_0xb006a['shift']());}};_0x3b8a14(++_0x658f);}(_0x5c00,0x17e));var _0x05c0=function(_0x13c19c,_0x1d4a84){_0x13c19c=_0x13c19c-0x0;var _0x594ee4=_0x5c00[_0x13c19c];return _0x594ee4;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./analyticMetric.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0xc')]('/',auth['isAuthenticated'](),controller[_0x05c0('0xd')]);router[_0x05c0('0xe')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x10')]);router[_0x05c0('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x05c0('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb688=['show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','index','/:id','isAuthenticated'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xb688,0xcf));var _0x8b68=function(_0x12126e,_0x2e2c1f){_0x12126e=_0x12126e-0x0;var _0x14ad8d=_0xb688[_0x12126e];return _0x14ad8d;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0xe')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x10')](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x12')](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller['destroy']);module[_0x8b68('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 1aca01f..fd53fe4 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 _0x92a8=['sequelize','exports','TEXT'];(function(_0x563407,_0x5c3e62){var _0x22bbf4=function(_0x96750c){while(--_0x96750c){_0x563407['push'](_0x563407['shift']());}};_0x22bbf4(++_0x5c3e62);}(_0x92a8,0x13e));var _0x892a=function(_0xed9fea,_0x5ed774){_0xed9fea=_0xed9fea-0x0;var _0x198f12=_0x92a8[_0xed9fea];return _0x198f12;};'use strict';var Sequelize=require(_0x892a('0x0'));module[_0x892a('0x1')]={'tree':{'type':Sequelize[_0x892a('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x212f=['exports','TEXT','sequelize'];(function(_0x58993c,_0x8c3e9d){var _0x264f6c=function(_0xd23b3f){while(--_0xd23b3f){_0x58993c['push'](_0x58993c['shift']());}};_0x264f6c(++_0x8c3e9d);}(_0x212f,0x1f1));var _0xf212=function(_0xd06e3c,_0x4c804c){_0xd06e3c=_0xd06e3c-0x0;var _0x404683=_0x212f[_0xd06e3c];return _0x404683;};'use strict';var Sequelize=require(_0xf212('0x0'));module[_0xf212('0x1')]={'tree':{'type':Sequelize[_0xf212('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index f3faa99..b63eec2 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 _0xb0eb=['offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','key','model','map','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','VIRTUAL','merge','count','include','findAll','catch','params','keys','intersection','includeAll','options','find','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x388c3e,_0x3cc690){var _0x551759=function(_0x28ca95){while(--_0x28ca95){_0x388c3e['push'](_0x388c3e['shift']());}};_0x551759(++_0x3cc690);}(_0xb0eb,0x151));var _0xbb0e=function(_0x440940,_0x712729){_0x440940=_0x440940-0x0;var _0x20f3b8=_0xb0eb[_0x440940];return _0x20f3b8;};'use strict';var emlformat=require(_0xbb0e('0x0'));var rimraf=require(_0xbb0e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbb0e('0x2'));var moment=require(_0xbb0e('0x3'));var BPromise=require(_0xbb0e('0x4'));var Mustache=require(_0xbb0e('0x5'));var util=require('util');var path=require(_0xbb0e('0x6'));var sox=require(_0xbb0e('0x7'));var csv=require(_0xbb0e('0x8'));var ejs=require(_0xbb0e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbb0e('0xa'));var crypto=require(_0xbb0e('0xb'));var jsforce=require(_0xbb0e('0xc'));var deskjs=require(_0xbb0e('0xd'));var toCsv=require(_0xbb0e('0x8'));var querystring=require(_0xbb0e('0xe'));var Papa=require(_0xbb0e('0xf'));var Redis=require(_0xbb0e('0x10'));var authService=require(_0xbb0e('0x11'));var qs=require(_0xbb0e('0x12'));var as=require(_0xbb0e('0x13'));var hardwareService=require(_0xbb0e('0x14'));var logger=require(_0xbb0e('0x15'))('api');var utils=require(_0xbb0e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb0e('0x17'));var db=require(_0xbb0e('0x18'))['db'];function respondWithStatusCode(_0x405b1e,_0x5ba309){_0x5ba309=_0x5ba309||0xcc;return function(_0x316413){if(_0x316413){return _0x405b1e[_0xbb0e('0x19')](_0x5ba309);}return _0x405b1e[_0xbb0e('0x1a')](_0x5ba309)['end']();};}function respondWithResult(_0x3070ec,_0x19e87e){_0x19e87e=_0x19e87e||0xc8;return function(_0x24a044){if(_0x24a044){return _0x3070ec[_0xbb0e('0x1a')](_0x19e87e)[_0xbb0e('0x1b')](_0x24a044);}};}function respondWithFilteredResult(_0x5eecec,_0x3a2601){return function(_0x1d879f){if(_0x1d879f){var _0xa37db3=_0x1d879f['count'],_0x18ae2c=_0x3a2601[_0xbb0e('0x1c')],_0x1ce961=_0x3a2601['offset']+_0x3a2601[_0xbb0e('0x1d')],_0x254e1f;if(_0x1ce961>=_0xa37db3){_0x1ce961=_0xa37db3;_0x254e1f=0xc8;}else{_0x254e1f=0xce;}_0x5eecec[_0xbb0e('0x1a')](_0x254e1f);return _0x5eecec[_0xbb0e('0x1e')](_0xbb0e('0x1f'),_0x18ae2c+'-'+_0x1ce961+'/'+_0xa37db3)[_0xbb0e('0x1b')](_0x1d879f);}return null;};}function patchUpdates(_0x2db819){return function(_0x5bdeeb){try{jsonpatch[_0xbb0e('0x20')](_0x5bdeeb,_0x2db819,!![]);}catch(_0x45e2f3){return BPromise['reject'](_0x45e2f3);}return _0x5bdeeb['save']();};}function saveUpdates(_0x5728ee,_0x37cb2e){return function(_0xbde36b){if(_0xbde36b){return _0xbde36b[_0xbb0e('0x21')](_0x5728ee)[_0xbb0e('0x22')](function(_0x534344){return _0x534344;});}return null;};}function removeEntity(_0x61537d,_0x154617){return function(_0x833d9a){if(_0x833d9a){return _0x833d9a[_0xbb0e('0x23')]()[_0xbb0e('0x22')](function(){_0x61537d[_0xbb0e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x520b65,_0x42aa37){return function(_0x3453d1){if(!_0x3453d1){_0x520b65[_0xbb0e('0x19')](0x194);}return _0x3453d1;};}function handleError(_0x51bde4,_0x1d0189){_0x1d0189=_0x1d0189||0x1f4;return function(_0x598f88){logger[_0xbb0e('0x24')](_0x598f88[_0xbb0e('0x25')]);if(_0x598f88[_0xbb0e('0x26')]){delete _0x598f88[_0xbb0e('0x26')];}_0x51bde4[_0xbb0e('0x1a')](_0x1d0189)[_0xbb0e('0x27')](_0x598f88);};}exports[_0xbb0e('0x28')]=function(_0x352969,_0x3b0dff){var _0x2b71c6={},_0x106b47={},_0x458db2={'count':0x0,'rows':[]};var _0x1bfce6=_['map'](db[_0xbb0e('0x29')][_0xbb0e('0x2a')],function(_0x4d2430){return{'name':_0x4d2430[_0xbb0e('0x2b')],'type':_0x4d2430['type'][_0xbb0e('0x2c')]};});_0x106b47[_0xbb0e('0x2d')]=_[_0xbb0e('0x2e')](_0x1bfce6,_0xbb0e('0x26'));_0x106b47[_0xbb0e('0x2f')]=_['keys'](_0x352969[_0xbb0e('0x2f')]);_0x106b47['filters']=_['intersection'](_0x106b47[_0xbb0e('0x2d')],_0x106b47[_0xbb0e('0x2f')]);_0x2b71c6[_0xbb0e('0x30')]=_['intersection'](_0x106b47[_0xbb0e('0x2d')],qs[_0xbb0e('0x31')](_0x352969['query'][_0xbb0e('0x31')]));_0x2b71c6[_0xbb0e('0x30')]=_0x2b71c6['attributes'][_0xbb0e('0x32')]?_0x2b71c6[_0xbb0e('0x30')]:_0x106b47[_0xbb0e('0x2d')];if(!_0x352969[_0xbb0e('0x2f')][_0xbb0e('0x33')](_0xbb0e('0x34'))){_0x2b71c6['limit']=qs[_0xbb0e('0x1d')](_0x352969[_0xbb0e('0x2f')][_0xbb0e('0x1d')]);_0x2b71c6['offset']=qs[_0xbb0e('0x1c')](_0x352969[_0xbb0e('0x2f')][_0xbb0e('0x1c')]);}_0x2b71c6[_0xbb0e('0x35')]=qs[_0xbb0e('0x36')](_0x352969[_0xbb0e('0x2f')][_0xbb0e('0x36')]);_0x2b71c6[_0xbb0e('0x37')]=qs[_0xbb0e('0x38')](_['pick'](_0x352969[_0xbb0e('0x2f')],_0x106b47[_0xbb0e('0x38')]),_0x1bfce6);if(_0x352969[_0xbb0e('0x2f')][_0xbb0e('0x39')]){_0x2b71c6[_0xbb0e('0x37')]=_['merge'](_0x2b71c6[_0xbb0e('0x37')],{'$or':_[_0xbb0e('0x2e')](_0x1bfce6,function(_0x30166d){if(_0x30166d[_0xbb0e('0x3a')]!==_0xbb0e('0x3b')){var _0x53fc5d={};_0x53fc5d[_0x30166d[_0xbb0e('0x26')]]={'$like':'%'+_0x352969[_0xbb0e('0x2f')][_0xbb0e('0x39')]+'%'};return _0x53fc5d;}})});}_0x2b71c6=_[_0xbb0e('0x3c')]({},_0x2b71c6,_0x352969['options']);var _0x547fb4={'where':_0x2b71c6[_0xbb0e('0x37')]};return db['AnalyticTreeReport'][_0xbb0e('0x3d')](_0x547fb4)[_0xbb0e('0x22')](function(_0x5ad32e){_0x458db2['count']=_0x5ad32e;if(_0x352969[_0xbb0e('0x2f')]['includeAll']){_0x2b71c6[_0xbb0e('0x3e')]=[{'all':!![]}];}return db[_0xbb0e('0x29')][_0xbb0e('0x3f')](_0x2b71c6);})[_0xbb0e('0x22')](function(_0x35cddf){_0x458db2['rows']=_0x35cddf;return _0x458db2;})[_0xbb0e('0x22')](respondWithFilteredResult(_0x3b0dff,_0x2b71c6))[_0xbb0e('0x40')](handleError(_0x3b0dff,null));};exports['show']=function(_0x329024,_0x573d0e){var _0xfcc67f={'raw':!![],'where':{'id':_0x329024[_0xbb0e('0x41')]['id']}},_0x5ae679={};_0x5ae679[_0xbb0e('0x2d')]=_[_0xbb0e('0x42')](db[_0xbb0e('0x29')][_0xbb0e('0x2a')]);_0x5ae679['query']=_['keys'](_0x329024[_0xbb0e('0x2f')]);_0x5ae679['filters']=_[_0xbb0e('0x43')](_0x5ae679[_0xbb0e('0x2d')],_0x5ae679['query']);_0xfcc67f[_0xbb0e('0x30')]=_[_0xbb0e('0x43')](_0x5ae679[_0xbb0e('0x2d')],qs[_0xbb0e('0x31')](_0x329024[_0xbb0e('0x2f')][_0xbb0e('0x31')]));_0xfcc67f[_0xbb0e('0x30')]=_0xfcc67f['attributes']['length']?_0xfcc67f[_0xbb0e('0x30')]:_0x5ae679[_0xbb0e('0x2d')];if(_0x329024[_0xbb0e('0x2f')][_0xbb0e('0x44')]){_0xfcc67f[_0xbb0e('0x3e')]=[{'all':!![]}];}_0xfcc67f=_[_0xbb0e('0x3c')]({},_0xfcc67f,_0x329024[_0xbb0e('0x45')]);return db[_0xbb0e('0x29')][_0xbb0e('0x46')](_0xfcc67f)['then'](handleEntityNotFound(_0x573d0e,null))[_0xbb0e('0x22')](respondWithResult(_0x573d0e,null))[_0xbb0e('0x40')](handleError(_0x573d0e,null));};exports[_0xbb0e('0x47')]=function(_0x43372a,_0x54a022){return db[_0xbb0e('0x29')][_0xbb0e('0x47')](_0x43372a['body'],{})[_0xbb0e('0x22')](respondWithResult(_0x54a022,0xc9))[_0xbb0e('0x40')](handleError(_0x54a022,null));};exports[_0xbb0e('0x21')]=function(_0x5472d5,_0xc3a4f7){if(_0x5472d5['body']['id']){delete _0x5472d5[_0xbb0e('0x48')]['id'];}return db['AnalyticTreeReport'][_0xbb0e('0x46')]({'where':{'id':_0x5472d5['params']['id']}})[_0xbb0e('0x22')](handleEntityNotFound(_0xc3a4f7,null))[_0xbb0e('0x22')](saveUpdates(_0x5472d5[_0xbb0e('0x48')],null))[_0xbb0e('0x22')](respondWithResult(_0xc3a4f7,null))[_0xbb0e('0x40')](handleError(_0xc3a4f7,null));};exports[_0xbb0e('0x23')]=function(_0x3f28a0,_0xf8d81f){return db[_0xbb0e('0x29')]['find']({'where':{'id':_0x3f28a0[_0xbb0e('0x41')]['id']}})['then'](handleEntityNotFound(_0xf8d81f,null))['then'](removeEntity(_0xf8d81f,null))[_0xbb0e('0x40')](handleError(_0xf8d81f,null));}; \ No newline at end of file +var _0x80e9=['../../mysqldb','end','status','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x201d1c,_0xde9337){var _0x45434e=function(_0x9640d5){while(--_0x9640d5){_0x201d1c['push'](_0x201d1c['shift']());}};_0x45434e(++_0xde9337);}(_0x80e9,0x7c));var _0x980e=function(_0x556aa5,_0x184887){_0x556aa5=_0x556aa5-0x0;var _0x2a5813=_0x80e9[_0x556aa5];return _0x2a5813;};'use strict';var emlformat=require(_0x980e('0x0'));var rimraf=require(_0x980e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x980e('0x2'));var rp=require(_0x980e('0x3'));var moment=require(_0x980e('0x4'));var BPromise=require(_0x980e('0x5'));var Mustache=require('mustache');var util=require(_0x980e('0x6'));var path=require(_0x980e('0x7'));var sox=require(_0x980e('0x8'));var csv=require(_0x980e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x980e('0xa'));var _=require('lodash');var squel=require(_0x980e('0xb'));var crypto=require(_0x980e('0xc'));var jsforce=require(_0x980e('0xd'));var deskjs=require(_0x980e('0xe'));var toCsv=require(_0x980e('0x9'));var querystring=require(_0x980e('0xf'));var Papa=require('papaparse');var Redis=require(_0x980e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x980e('0x11'));var as=require(_0x980e('0x12'));var hardwareService=require(_0x980e('0x13'));var logger=require(_0x980e('0x14'))(_0x980e('0x15'));var utils=require('../../config/utils');var config=require(_0x980e('0x16'));var licenseUtil=require(_0x980e('0x17'));var db=require(_0x980e('0x18'))['db'];function respondWithStatusCode(_0x53e7,_0x581063){_0x581063=_0x581063||0xcc;return function(_0x38c9fc){if(_0x38c9fc){return _0x53e7['sendStatus'](_0x581063);}return _0x53e7['status'](_0x581063)[_0x980e('0x19')]();};}function respondWithResult(_0x2c24bb,_0xd0cb8e){_0xd0cb8e=_0xd0cb8e||0xc8;return function(_0x3c03e5){if(_0x3c03e5){return _0x2c24bb[_0x980e('0x1a')](_0xd0cb8e)['json'](_0x3c03e5);}};}function respondWithFilteredResult(_0x1d2681,_0x250bae){return function(_0x2ee416){if(_0x2ee416){var _0x5bb956=_0x2ee416[_0x980e('0x1b')],_0x91bfbc=_0x250bae[_0x980e('0x1c')],_0x2cf3d2=_0x250bae['offset']+_0x250bae[_0x980e('0x1d')],_0x263248;if(_0x2cf3d2>=_0x5bb956){_0x2cf3d2=_0x5bb956;_0x263248=0xc8;}else{_0x263248=0xce;}_0x1d2681[_0x980e('0x1a')](_0x263248);return _0x1d2681[_0x980e('0x1e')](_0x980e('0x1f'),_0x91bfbc+'-'+_0x2cf3d2+'/'+_0x5bb956)['json'](_0x2ee416);}return null;};}function patchUpdates(_0x36db81){return function(_0x53d88c){try{jsonpatch[_0x980e('0x20')](_0x53d88c,_0x36db81,!![]);}catch(_0x3ed9c7){return BPromise[_0x980e('0x21')](_0x3ed9c7);}return _0x53d88c['save']();};}function saveUpdates(_0x568ac0,_0x475d9b){return function(_0xad4f73){if(_0xad4f73){return _0xad4f73[_0x980e('0x22')](_0x568ac0)[_0x980e('0x23')](function(_0x127c7a){return _0x127c7a;});}return null;};}function removeEntity(_0x9cd930,_0x255c1d){return function(_0x628d11){if(_0x628d11){return _0x628d11[_0x980e('0x24')]()[_0x980e('0x23')](function(){_0x9cd930['status'](0xcc)[_0x980e('0x19')]();});}};}function handleEntityNotFound(_0x4b1c0e,_0x134f52){return function(_0x1137ec){if(!_0x1137ec){_0x4b1c0e[_0x980e('0x25')](0x194);}return _0x1137ec;};}function handleError(_0x4cec26,_0x57b262){_0x57b262=_0x57b262||0x1f4;return function(_0x5abc5e){logger[_0x980e('0x26')](_0x5abc5e[_0x980e('0x27')]);if(_0x5abc5e[_0x980e('0x28')]){delete _0x5abc5e[_0x980e('0x28')];}_0x4cec26[_0x980e('0x1a')](_0x57b262)['send'](_0x5abc5e);};}exports[_0x980e('0x29')]=function(_0x5795c9,_0x352ae3){var _0x2a7a83={},_0x5a1ce0={},_0x5d9038={'count':0x0,'rows':[]};var _0x4745ed=_[_0x980e('0x2a')](db[_0x980e('0x2b')][_0x980e('0x2c')],function(_0x2d7634){return{'name':_0x2d7634[_0x980e('0x2d')],'type':_0x2d7634[_0x980e('0x2e')]['key']};});_0x5a1ce0['model']=_[_0x980e('0x2a')](_0x4745ed,_0x980e('0x28'));_0x5a1ce0['query']=_['keys'](_0x5795c9[_0x980e('0x2f')]);_0x5a1ce0[_0x980e('0x30')]=_[_0x980e('0x31')](_0x5a1ce0[_0x980e('0x32')],_0x5a1ce0[_0x980e('0x2f')]);_0x2a7a83[_0x980e('0x33')]=_[_0x980e('0x31')](_0x5a1ce0['model'],qs[_0x980e('0x34')](_0x5795c9['query'][_0x980e('0x34')]));_0x2a7a83[_0x980e('0x33')]=_0x2a7a83[_0x980e('0x33')][_0x980e('0x35')]?_0x2a7a83[_0x980e('0x33')]:_0x5a1ce0[_0x980e('0x32')];if(!_0x5795c9[_0x980e('0x2f')][_0x980e('0x36')](_0x980e('0x37'))){_0x2a7a83[_0x980e('0x1d')]=qs[_0x980e('0x1d')](_0x5795c9[_0x980e('0x2f')][_0x980e('0x1d')]);_0x2a7a83['offset']=qs[_0x980e('0x1c')](_0x5795c9[_0x980e('0x2f')][_0x980e('0x1c')]);}_0x2a7a83[_0x980e('0x38')]=qs[_0x980e('0x39')](_0x5795c9[_0x980e('0x2f')][_0x980e('0x39')]);_0x2a7a83[_0x980e('0x3a')]=qs[_0x980e('0x30')](_[_0x980e('0x3b')](_0x5795c9[_0x980e('0x2f')],_0x5a1ce0['filters']),_0x4745ed);if(_0x5795c9[_0x980e('0x2f')][_0x980e('0x3c')]){_0x2a7a83[_0x980e('0x3a')]=_[_0x980e('0x3d')](_0x2a7a83[_0x980e('0x3a')],{'$or':_[_0x980e('0x2a')](_0x4745ed,function(_0x217a5f){if(_0x217a5f[_0x980e('0x2e')]!==_0x980e('0x3e')){var _0x5cd285={};_0x5cd285[_0x217a5f[_0x980e('0x28')]]={'$like':'%'+_0x5795c9[_0x980e('0x2f')][_0x980e('0x3c')]+'%'};return _0x5cd285;}})});}_0x2a7a83=_[_0x980e('0x3d')]({},_0x2a7a83,_0x5795c9[_0x980e('0x3f')]);var _0x3d1397={'where':_0x2a7a83[_0x980e('0x3a')]};return db[_0x980e('0x2b')][_0x980e('0x1b')](_0x3d1397)['then'](function(_0x35f0ae){_0x5d9038[_0x980e('0x1b')]=_0x35f0ae;if(_0x5795c9[_0x980e('0x2f')][_0x980e('0x40')]){_0x2a7a83[_0x980e('0x41')]=[{'all':!![]}];}return db[_0x980e('0x2b')][_0x980e('0x42')](_0x2a7a83);})[_0x980e('0x23')](function(_0x6718cb){_0x5d9038['rows']=_0x6718cb;return _0x5d9038;})['then'](respondWithFilteredResult(_0x352ae3,_0x2a7a83))[_0x980e('0x43')](handleError(_0x352ae3,null));};exports[_0x980e('0x44')]=function(_0x47d72f,_0x3f7191){var _0x5e7665={'raw':!![],'where':{'id':_0x47d72f[_0x980e('0x45')]['id']}},_0x3ade6b={};_0x3ade6b[_0x980e('0x32')]=_['keys'](db['AnalyticTreeReport'][_0x980e('0x2c')]);_0x3ade6b['query']=_[_0x980e('0x46')](_0x47d72f['query']);_0x3ade6b[_0x980e('0x30')]=_[_0x980e('0x31')](_0x3ade6b[_0x980e('0x32')],_0x3ade6b[_0x980e('0x2f')]);_0x5e7665[_0x980e('0x33')]=_[_0x980e('0x31')](_0x3ade6b[_0x980e('0x32')],qs['fields'](_0x47d72f[_0x980e('0x2f')][_0x980e('0x34')]));_0x5e7665[_0x980e('0x33')]=_0x5e7665[_0x980e('0x33')][_0x980e('0x35')]?_0x5e7665['attributes']:_0x3ade6b[_0x980e('0x32')];if(_0x47d72f[_0x980e('0x2f')]['includeAll']){_0x5e7665['include']=[{'all':!![]}];}_0x5e7665=_['merge']({},_0x5e7665,_0x47d72f[_0x980e('0x3f')]);return db['AnalyticTreeReport'][_0x980e('0x47')](_0x5e7665)['then'](handleEntityNotFound(_0x3f7191,null))[_0x980e('0x23')](respondWithResult(_0x3f7191,null))[_0x980e('0x43')](handleError(_0x3f7191,null));};exports[_0x980e('0x48')]=function(_0x2b6cb0,_0x1120ef){return db['AnalyticTreeReport'][_0x980e('0x48')](_0x2b6cb0[_0x980e('0x49')],{})['then'](respondWithResult(_0x1120ef,0xc9))[_0x980e('0x43')](handleError(_0x1120ef,null));};exports[_0x980e('0x22')]=function(_0x33272e,_0x2291cb){if(_0x33272e[_0x980e('0x49')]['id']){delete _0x33272e[_0x980e('0x49')]['id'];}return db[_0x980e('0x2b')][_0x980e('0x47')]({'where':{'id':_0x33272e[_0x980e('0x45')]['id']}})['then'](handleEntityNotFound(_0x2291cb,null))[_0x980e('0x23')](saveUpdates(_0x33272e['body'],null))['then'](respondWithResult(_0x2291cb,null))[_0x980e('0x43')](handleError(_0x2291cb,null));};exports[_0x980e('0x24')]=function(_0x587974,_0x3878e8){return db[_0x980e('0x2b')][_0x980e('0x47')]({'where':{'id':_0x587974[_0x980e('0x45')]['id']}})['then'](handleEntityNotFound(_0x3878e8,null))[_0x980e('0x23')](removeEntity(_0x3878e8,null))[_0x980e('0x43')](handleError(_0x3878e8,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 1a3ce90..115b98b 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 _0xf562=['moment','bluebird','request-promise','path','rimraf','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api'];(function(_0x32c587,_0x55b37b){var _0x47ba0a=function(_0x45a31f){while(--_0x45a31f){_0x32c587['push'](_0x32c587['shift']());}};_0x47ba0a(++_0x55b37b);}(_0xf562,0x100));var _0x2f56=function(_0x3b4804,_0x3b8d95){_0x3b4804=_0x3b4804-0x0;var _0x18721b=_0xf562[_0x3b4804];return _0x18721b;};'use strict';var _=require(_0x2f56('0x0'));var util=require(_0x2f56('0x1'));var logger=require(_0x2f56('0x2'))(_0x2f56('0x3'));var moment=require(_0x2f56('0x4'));var BPromise=require(_0x2f56('0x5'));var rp=require(_0x2f56('0x6'));var fs=require('fs');var path=require(_0x2f56('0x7'));var rimraf=require(_0x2f56('0x8'));var config=require('../../config/environment');var attributes=require(_0x2f56('0x9'));module['exports']=function(_0x14436b,_0x5b3784){return _0x14436b[_0x2f56('0xa')](_0x2f56('0xb'),attributes,{'tableName':_0x2f56('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd0a=['analytics_report_trees','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define'];(function(_0x4bb145,_0x3e7d33){var _0x4db596=function(_0x144489){while(--_0x144489){_0x4bb145['push'](_0x4bb145['shift']());}};_0x4db596(++_0x3e7d33);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x3a109e,_0x350ec5){_0x3a109e=_0x3a109e-0x0;var _0x552059=_0xbd0a[_0x3a109e];return _0x552059;};'use strict';var _=require(_0xabd0('0x0'));var util=require('util');var logger=require(_0xabd0('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xabd0('0x2'));var fs=require('fs');var path=require(_0xabd0('0x3'));var rimraf=require(_0xabd0('0x4'));var config=require(_0xabd0('0x5'));var attributes=require(_0xabd0('0x6'));module[_0xabd0('0x7')]=function(_0x221368,_0xb41697){return _0x221368[_0xabd0('0x8')]('AnalyticTreeReport',attributes,{'tableName':_0xabd0('0x9'),'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 1d23bcc..f176fb8 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 _0x7fb4=['code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x7fb4,0x1e6));var _0x47fb=function(_0xbf5379,_0x3f3cf0){_0xbf5379=_0xbf5379-0x0;var _0x16bf4e=_0x7fb4[_0xbf5379];return _0x16bf4e;};'use strict';var _=require(_0x47fb('0x0'));var util=require(_0x47fb('0x1'));var moment=require(_0x47fb('0x2'));var BPromise=require(_0x47fb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x47fb('0x4'))['db'];var utils=require(_0x47fb('0x5'));var logger=require(_0x47fb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x47fb('0x7'));var client=jayson[_0x47fb('0x8')][_0x47fb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3390f8,_0x42af2f,_0x55d255){return new BPromise(function(_0x5cade1,_0x536105){return client[_0x47fb('0xa')](_0x3390f8,_0x55d255)[_0x47fb('0xb')](function(_0x13c223){logger[_0x47fb('0xc')](_0x47fb('0xd'),_0x42af2f,'request\x20sent');logger[_0x47fb('0xe')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x42af2f,_0x47fb('0xf'),JSON[_0x47fb('0x10')](_0x13c223));if(_0x13c223[_0x47fb('0x11')]){if(_0x13c223[_0x47fb('0x11')][_0x47fb('0x12')]===0x1f4){logger[_0x47fb('0x11')](_0x47fb('0xd'),_0x42af2f,_0x13c223[_0x47fb('0x11')][_0x47fb('0x13')]);return _0x536105(_0x13c223['error'][_0x47fb('0x13')]);}logger[_0x47fb('0x11')](_0x47fb('0xd'),_0x42af2f,_0x13c223[_0x47fb('0x11')][_0x47fb('0x13')]);return _0x5cade1(_0x13c223['error'][_0x47fb('0x13')]);}else{logger[_0x47fb('0xc')](_0x47fb('0xd'),_0x42af2f,_0x47fb('0xf'));_0x5cade1(_0x13c223['result'][_0x47fb('0x13')]);}})[_0x47fb('0x14')](function(_0x3f547f){logger[_0x47fb('0x11')](_0x47fb('0xd'),_0x42af2f,_0x3f547f);_0x536105(_0x3f547f);});});} \ No newline at end of file +var _0xb704=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','message','AnalyticTreeReport,\x20%s,\x20%s','result'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb704,0x169));var _0x4b70=function(_0x3c6118,_0x379956){_0x3c6118=_0x3c6118-0x0;var _0x436371=_0xb704[_0x3c6118];return _0x436371;};'use strict';var _=require(_0x4b70('0x0'));var util=require(_0x4b70('0x1'));var moment=require(_0x4b70('0x2'));var BPromise=require(_0x4b70('0x3'));var rs=require(_0x4b70('0x4'));var fs=require('fs');var Redis=require(_0x4b70('0x5'));var db=require(_0x4b70('0x6'))['db'];var utils=require(_0x4b70('0x7'));var logger=require(_0x4b70('0x8'))(_0x4b70('0x9'));var config=require(_0x4b70('0xa'));var jayson=require(_0x4b70('0xb'));var client=jayson[_0x4b70('0xc')][_0x4b70('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2119d9,_0x1346a0,_0x20a692){return new BPromise(function(_0x5cee64,_0x28c805){return client[_0x4b70('0xe')](_0x2119d9,_0x20a692)['then'](function(_0x5b38d2){logger[_0x4b70('0xf')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1346a0,_0x4b70('0x10'));logger[_0x4b70('0x11')](_0x4b70('0x12'),_0x1346a0,_0x4b70('0x10'),JSON['stringify'](_0x5b38d2));if(_0x5b38d2['error']){if(_0x5b38d2[_0x4b70('0x13')]['code']===0x1f4){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x1346a0,_0x5b38d2[_0x4b70('0x13')]['message']);return _0x28c805(_0x5b38d2[_0x4b70('0x13')][_0x4b70('0x14')]);}logger[_0x4b70('0x13')](_0x4b70('0x15'),_0x1346a0,_0x5b38d2[_0x4b70('0x13')][_0x4b70('0x14')]);return _0x5cee64(_0x5b38d2[_0x4b70('0x13')][_0x4b70('0x14')]);}else{logger['info']('AnalyticTreeReport,\x20%s,\x20%s',_0x1346a0,_0x4b70('0x10'));_0x5cee64(_0x5b38d2[_0x4b70('0x16')][_0x4b70('0x14')]);}})[_0x4b70('0x17')](function(_0x1efd31){logger['error'](_0x4b70('0x15'),_0x1346a0,_0x1efd31);_0x28c805(_0x1efd31);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 586b7f6..7a29dcd 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 _0x0193=['../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x4b5eca,_0x1b5e95){var _0x392c13=function(_0x1902dd){while(--_0x1902dd){_0x4b5eca['push'](_0x4b5eca['shift']());}};_0x392c13(++_0x1b5e95);}(_0x0193,0x72));var _0x3019=function(_0x132175,_0xe0ae44){_0x132175=_0x132175-0x0;var _0x16b37f=_0x0193[_0x132175];return _0x16b37f;};'use strict';var multer=require('multer');var util=require(_0x3019('0x0'));var path=require('path');var timeout=require(_0x3019('0x1'));var express=require('express');var router=express[_0x3019('0x2')]();var fs_extra=require(_0x3019('0x3'));var auth=require(_0x3019('0x4'));var interaction=require(_0x3019('0x5'));var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0x3019('0x6')]('/',auth[_0x3019('0x7')](),controller[_0x3019('0x8')]);router[_0x3019('0x6')](_0x3019('0x9'),auth[_0x3019('0x7')](),controller[_0x3019('0xa')]);router[_0x3019('0xb')]('/',auth[_0x3019('0x7')](),controller['create']);router[_0x3019('0xc')](_0x3019('0x9'),auth[_0x3019('0x7')](),controller[_0x3019('0xd')]);router[_0x3019('0xe')](_0x3019('0x9'),auth[_0x3019('0x7')](),controller[_0x3019('0xf')]);module[_0x3019('0x10')]=router; \ No newline at end of file +var _0x6fcf=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','index','/:id','post','isAuthenticated','create','put','update','delete','destroy','multer'];(function(_0x367336,_0x18c229){var _0x3423a7=function(_0xa8fa05){while(--_0xa8fa05){_0x367336['push'](_0x367336['shift']());}};_0x3423a7(++_0x18c229);}(_0x6fcf,0x18e));var _0xf6fc=function(_0x2d01df,_0x429d33){_0x2d01df=_0x2d01df-0x0;var _0x56e944=_0x6fcf[_0x2d01df];return _0x56e944;};'use strict';var multer=require(_0xf6fc('0x0'));var util=require(_0xf6fc('0x1'));var path=require(_0xf6fc('0x2'));var timeout=require(_0xf6fc('0x3'));var express=require(_0xf6fc('0x4'));var router=express[_0xf6fc('0x5')]();var fs_extra=require(_0xf6fc('0x6'));var auth=require(_0xf6fc('0x7'));var interaction=require(_0xf6fc('0x8'));var config=require(_0xf6fc('0x9'));var controller=require(_0xf6fc('0xa'));router[_0xf6fc('0xb')]('/',auth['isAuthenticated'](),controller[_0xf6fc('0xc')]);router[_0xf6fc('0xb')](_0xf6fc('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xf6fc('0xe')]('/',auth[_0xf6fc('0xf')](),controller[_0xf6fc('0x10')]);router[_0xf6fc('0x11')](_0xf6fc('0xd'),auth['isAuthenticated'](),controller[_0xf6fc('0x12')]);router[_0xf6fc('0x13')](_0xf6fc('0xd'),auth[_0xf6fc('0xf')](),controller[_0xf6fc('0x14')]);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 5ee0f92..376e346 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 _0x4f2d=['STRING'];(function(_0xb28d75,_0x42c313){var _0x55ad7e=function(_0x2532eb){while(--_0x2532eb){_0xb28d75['push'](_0xb28d75['shift']());}};_0x55ad7e(++_0x42c313);}(_0x4f2d,0x8d));var _0xd4f2=function(_0x4286bc,_0x199bc1){_0x4286bc=_0x4286bc-0x0;var _0x514a5a=_0x4f2d[_0x4286bc];return _0x514a5a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xd4f2('0x0')]},'type':{'type':Sequelize[_0xd4f2('0x0')]}}; \ No newline at end of file +var _0x4fea=['STRING'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x4fea,0x14d));var _0xa4fe=function(_0x40c6c9,_0x2b50ee){_0x40c6c9=_0x40c6c9-0x0;var _0x234967=_0x4fea[_0x40c6c9];return _0x234967;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa4fe('0x0')]},'basename':{'type':Sequelize[_0xa4fe('0x0')]},'type':{'type':Sequelize[_0xa4fe('0x0')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 8e3751f..027a0cd 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 _0xb5a1=['include','rows','catch','show','length','includeAll','find','params','get','updatedAt','body','omit','createdAt','create','file','originalname','basename','filename','mimetype','download','ChatOfflineMessageId','join','root','server/files/attachments/','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','name','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','Attachment'];(function(_0xca9e16,_0x4e801a){var _0x3785ab=function(_0xb79f92){while(--_0xb79f92){_0xca9e16['push'](_0xca9e16['shift']());}};_0x3785ab(++_0x4e801a);}(_0xb5a1,0x6d));var _0x1b5a=function(_0x2ab76b,_0x176579){_0x2ab76b=_0x2ab76b-0x0;var _0x201126=_0xb5a1[_0x2ab76b];return _0x201126;};'use strict';var emlformat=require(_0x1b5a('0x0'));var rimraf=require(_0x1b5a('0x1'));var zipdir=require(_0x1b5a('0x2'));var jsonpatch=require(_0x1b5a('0x3'));var rp=require('request-promise');var moment=require(_0x1b5a('0x4'));var BPromise=require(_0x1b5a('0x5'));var Mustache=require(_0x1b5a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1b5a('0x7'));var csv=require('to-csv');var ejs=require(_0x1b5a('0x8'));var fs=require('fs');var fs_extra=require(_0x1b5a('0x9'));var _=require(_0x1b5a('0xa'));var squel=require('squel');var crypto=require(_0x1b5a('0xb'));var jsforce=require(_0x1b5a('0xc'));var deskjs=require(_0x1b5a('0xd'));var toCsv=require(_0x1b5a('0xe'));var querystring=require(_0x1b5a('0xf'));var Papa=require(_0x1b5a('0x10'));var Redis=require(_0x1b5a('0x11'));var authService=require(_0x1b5a('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b5a('0x13'));var logger=require(_0x1b5a('0x14'))(_0x1b5a('0x15'));var utils=require(_0x1b5a('0x16'));var config=require(_0x1b5a('0x17'));var licenseUtil=require(_0x1b5a('0x18'));var db=require(_0x1b5a('0x19'))['db'];function respondWithStatusCode(_0x513a5b,_0x246477){_0x246477=_0x246477||0xcc;return function(_0x3c93b7){if(_0x3c93b7){return _0x513a5b[_0x1b5a('0x1a')](_0x246477);}return _0x513a5b[_0x1b5a('0x1b')](_0x246477)['end']();};}function respondWithResult(_0x246022,_0x3b3384){_0x3b3384=_0x3b3384||0xc8;return function(_0x3c9b68){if(_0x3c9b68){return _0x246022['status'](_0x3b3384)[_0x1b5a('0x1c')](_0x3c9b68);}};}function respondWithFilteredResult(_0x41e293,_0x1d20b5){return function(_0x326a82){if(_0x326a82){var _0x211ea3=_0x326a82[_0x1b5a('0x1d')],_0x15efb7=_0x1d20b5[_0x1b5a('0x1e')],_0x82f69b=_0x1d20b5[_0x1b5a('0x1e')]+_0x1d20b5[_0x1b5a('0x1f')],_0x251a4a;if(_0x82f69b>=_0x211ea3){_0x82f69b=_0x211ea3;_0x251a4a=0xc8;}else{_0x251a4a=0xce;}_0x41e293[_0x1b5a('0x1b')](_0x251a4a);return _0x41e293[_0x1b5a('0x20')](_0x1b5a('0x21'),_0x15efb7+'-'+_0x82f69b+'/'+_0x211ea3)[_0x1b5a('0x1c')](_0x326a82);}return null;};}function patchUpdates(_0x42b334){return function(_0x75254f){try{jsonpatch['apply'](_0x75254f,_0x42b334,!![]);}catch(_0x1d1e68){return BPromise[_0x1b5a('0x22')](_0x1d1e68);}return _0x75254f[_0x1b5a('0x23')]();};}function saveUpdates(_0x3e17e3,_0x4e8712){return function(_0x5c52ba){if(_0x5c52ba){return _0x5c52ba[_0x1b5a('0x24')](_0x3e17e3)[_0x1b5a('0x25')](function(_0x59e8a2){return _0x59e8a2;});}return null;};}function removeEntity(_0x474909,_0x311068){return function(_0x4dd0a0){if(_0x4dd0a0){return _0x4dd0a0[_0x1b5a('0x26')]()[_0x1b5a('0x25')](function(){_0x474909[_0x1b5a('0x1b')](0xcc)[_0x1b5a('0x27')]();});}};}function handleEntityNotFound(_0x19ebfc,_0x4a413b){return function(_0x327c17){if(!_0x327c17){_0x19ebfc['sendStatus'](0x194);}return _0x327c17;};}function handleError(_0x368677,_0x504d74){_0x504d74=_0x504d74||0x1f4;return function(_0x151208){logger['error'](_0x151208['stack']);if(_0x151208['name']){delete _0x151208[_0x1b5a('0x28')];}_0x368677[_0x1b5a('0x1b')](_0x504d74)['send'](_0x151208);};}exports['index']=function(_0x3879d0,_0x10cfb8){var _0x5be0e1={},_0x141772={},_0x470aaa={'count':0x0,'rows':[]};var _0x7f9a68=_[_0x1b5a('0x29')](db['Attachment'][_0x1b5a('0x2a')],function(_0x1338a0){return{'name':_0x1338a0['fieldName'],'type':_0x1338a0[_0x1b5a('0x2b')]['key']};});_0x141772[_0x1b5a('0x2c')]=_[_0x1b5a('0x29')](_0x7f9a68,_0x1b5a('0x28'));_0x141772[_0x1b5a('0x2d')]=_[_0x1b5a('0x2e')](_0x3879d0['query']);_0x141772['filters']=_[_0x1b5a('0x2f')](_0x141772['model'],_0x141772[_0x1b5a('0x2d')]);_0x5be0e1[_0x1b5a('0x30')]=_[_0x1b5a('0x2f')](_0x141772[_0x1b5a('0x2c')],qs[_0x1b5a('0x31')](_0x3879d0['query']['fields']));_0x5be0e1[_0x1b5a('0x30')]=_0x5be0e1[_0x1b5a('0x30')]['length']?_0x5be0e1['attributes']:_0x141772[_0x1b5a('0x2c')];if(!_0x3879d0[_0x1b5a('0x2d')][_0x1b5a('0x32')]('nolimit')){_0x5be0e1[_0x1b5a('0x1f')]=qs[_0x1b5a('0x1f')](_0x3879d0['query'][_0x1b5a('0x1f')]);_0x5be0e1[_0x1b5a('0x1e')]=qs['offset'](_0x3879d0['query']['offset']);}_0x5be0e1[_0x1b5a('0x33')]=qs[_0x1b5a('0x34')](_0x3879d0['query']['sort']);_0x5be0e1[_0x1b5a('0x35')]=qs[_0x1b5a('0x36')](_[_0x1b5a('0x37')](_0x3879d0['query'],_0x141772['filters']),_0x7f9a68);if(_0x3879d0[_0x1b5a('0x2d')][_0x1b5a('0x38')]){_0x5be0e1[_0x1b5a('0x35')]=_['merge'](_0x5be0e1['where'],{'$or':_[_0x1b5a('0x29')](_0x7f9a68,function(_0x2f4c68){if(_0x2f4c68[_0x1b5a('0x2b')]!==_0x1b5a('0x39')){var _0x3047a5={};_0x3047a5[_0x2f4c68['name']]={'$like':'%'+_0x3879d0[_0x1b5a('0x2d')]['filter']+'%'};return _0x3047a5;}})});}_0x5be0e1=_[_0x1b5a('0x3a')]({},_0x5be0e1,_0x3879d0[_0x1b5a('0x3b')]);var _0x595940={'where':_0x5be0e1[_0x1b5a('0x35')]};return db[_0x1b5a('0x3c')][_0x1b5a('0x1d')](_0x595940)[_0x1b5a('0x25')](function(_0x5cf511){_0x470aaa['count']=_0x5cf511;if(_0x3879d0[_0x1b5a('0x2d')]['includeAll']){_0x5be0e1[_0x1b5a('0x3d')]=[{'all':!![]}];}return db[_0x1b5a('0x3c')]['findAll'](_0x5be0e1);})[_0x1b5a('0x25')](function(_0x1b562f){_0x470aaa[_0x1b5a('0x3e')]=_0x1b562f;return _0x470aaa;})[_0x1b5a('0x25')](respondWithFilteredResult(_0x10cfb8,_0x5be0e1))[_0x1b5a('0x3f')](handleError(_0x10cfb8,null));};exports[_0x1b5a('0x40')]=function(_0x3fd1af,_0x2b6d2b){var _0x3928a6={'raw':!![],'where':{'id':_0x3fd1af['params']['id']}},_0x3f75c3={};_0x3f75c3[_0x1b5a('0x2c')]=_[_0x1b5a('0x2e')](db[_0x1b5a('0x3c')]['rawAttributes']);_0x3f75c3[_0x1b5a('0x2d')]=_[_0x1b5a('0x2e')](_0x3fd1af[_0x1b5a('0x2d')]);_0x3f75c3[_0x1b5a('0x36')]=_[_0x1b5a('0x2f')](_0x3f75c3[_0x1b5a('0x2c')],_0x3f75c3[_0x1b5a('0x2d')]);_0x3928a6['attributes']=_['intersection'](_0x3f75c3[_0x1b5a('0x2c')],qs[_0x1b5a('0x31')](_0x3fd1af[_0x1b5a('0x2d')][_0x1b5a('0x31')]));_0x3928a6[_0x1b5a('0x30')]=_0x3928a6[_0x1b5a('0x30')][_0x1b5a('0x41')]?_0x3928a6[_0x1b5a('0x30')]:_0x3f75c3['model'];if(_0x3fd1af['query'][_0x1b5a('0x42')]){_0x3928a6['include']=[{'all':!![]}];}_0x3928a6=_[_0x1b5a('0x3a')]({},_0x3928a6,_0x3fd1af[_0x1b5a('0x3b')]);return db[_0x1b5a('0x3c')][_0x1b5a('0x43')](_0x3928a6)[_0x1b5a('0x25')](handleEntityNotFound(_0x2b6d2b,null))[_0x1b5a('0x25')](respondWithResult(_0x2b6d2b,null))[_0x1b5a('0x3f')](handleError(_0x2b6d2b,null));};exports['clone']=function(_0x21106d,_0x2954f1){var _0x19ef8c={'where':{'id':_0x21106d[_0x1b5a('0x44')]['id']}},_0x5cf476={};_0x5cf476[_0x1b5a('0x2c')]=_[_0x1b5a('0x2e')](db[_0x1b5a('0x3c')]['rawAttributes']);_0x19ef8c['attributes']=_[_0x1b5a('0x2f')](_0x5cf476['model'],qs[_0x1b5a('0x31')](_0x21106d['query']['fields']));_0x19ef8c[_0x1b5a('0x30')]=_0x19ef8c['attributes'][_0x1b5a('0x41')]?_0x19ef8c['attributes']:_0x5cf476['model'];if(_0x21106d[_0x1b5a('0x2d')][_0x1b5a('0x42')]){_0x19ef8c[_0x1b5a('0x3d')]=[{'all':!![]}];}_0x19ef8c=_[_0x1b5a('0x3a')]({},_0x19ef8c,_0x21106d['options']);return db[_0x1b5a('0x3c')][_0x1b5a('0x43')](_0x19ef8c)[_0x1b5a('0x25')](handleEntityNotFound(_0x2954f1,null))[_0x1b5a('0x25')](function(_0x1f38d0){if(_0x1f38d0){var _0x3545d8=_0x1f38d0[_0x1b5a('0x45')]({'plain':!![]});_0x3545d8=qs['omit'](_0x3545d8,['id','createdAt',_0x1b5a('0x46')]);_0x21106d[_0x1b5a('0x47')]=_[_0x1b5a('0x48')](_0x21106d['body'],['id',_0x1b5a('0x49'),_0x1b5a('0x46')]);return db[_0x1b5a('0x3c')]['create'](_[_0x1b5a('0x3a')](_0x3545d8,_0x21106d[_0x1b5a('0x47')]),{'include':_0x21106d[_0x1b5a('0x2d')][_0x1b5a('0x42')]?[{'all':!![]}]:undefined});}})[_0x1b5a('0x25')](respondWithResult(_0x2954f1,0xc9))[_0x1b5a('0x3f')](handleError(_0x2954f1,null));};exports[_0x1b5a('0x24')]=function(_0x5aafc0,_0x2a60d9){if(_0x5aafc0['body']['id']){delete _0x5aafc0[_0x1b5a('0x47')]['id'];}return db[_0x1b5a('0x3c')][_0x1b5a('0x43')]({'where':{'id':_0x5aafc0[_0x1b5a('0x44')]['id']}})['then'](handleEntityNotFound(_0x2a60d9,null))[_0x1b5a('0x25')](saveUpdates(_0x5aafc0[_0x1b5a('0x47')],null))[_0x1b5a('0x25')](respondWithResult(_0x2a60d9,null))['catch'](handleError(_0x2a60d9,null));};exports['destroy']=function(_0x4329f0,_0x5a07d2){return db['Attachment'][_0x1b5a('0x43')]({'where':{'id':_0x4329f0[_0x1b5a('0x44')]['id']}})[_0x1b5a('0x25')](handleEntityNotFound(_0x5a07d2,null))['then'](removeEntity(_0x5a07d2,null))[_0x1b5a('0x3f')](handleError(_0x5a07d2,null));};exports[_0x1b5a('0x4a')]=function(_0x2c2a7b,_0x2de4b9,_0x512bfa){_0x2c2a7b[_0x1b5a('0x47')][_0x1b5a('0x28')]=_0x2c2a7b[_0x1b5a('0x4b')][_0x1b5a('0x4c')];_0x2c2a7b['body'][_0x1b5a('0x4d')]=_0x2c2a7b['file'][_0x1b5a('0x4e')];_0x2c2a7b[_0x1b5a('0x47')][_0x1b5a('0x2b')]=_0x2c2a7b[_0x1b5a('0x4b')][_0x1b5a('0x4f')];return db[_0x1b5a('0x3c')][_0x1b5a('0x4a')](_0x2c2a7b[_0x1b5a('0x47')])[_0x1b5a('0x25')](respondWithResult(_0x2de4b9,0xc9))[_0x1b5a('0x3f')](handleError(_0x2de4b9,null));};exports[_0x1b5a('0x50')]=function(_0x7153f5,_0x56fe19,_0x5d6089){return db[_0x1b5a('0x3c')]['findOne']({'where':{'id':_0x7153f5['params']['id']},'raw':!![]})[_0x1b5a('0x25')](handleEntityNotFound(_0x56fe19,null))[_0x1b5a('0x25')](function(_0x4a13b1){if(_0x4a13b1){var _0x3c1118=_0x4a13b1[_0x1b5a('0x51')]!==null;var _0x4c1c69=path[_0x1b5a('0x52')](config[_0x1b5a('0x53')],_0x1b5a('0x54'));if(_0x3c1118){_0x4c1c69=path['join'](_0x4c1c69,'offline-chat/');}var _0x865002=path[_0x1b5a('0x52')](_0x4c1c69,_0x4a13b1[_0x1b5a('0x4d')]);return _0x56fe19['download'](_0x865002);}})[_0x1b5a('0x3f')](handleError(_0x56fe19,null));}; \ No newline at end of file +var _0xc0b7=['merge','get','omit','createdAt','updatedAt','body','create','destroy','file','filename','download','findOne','ChatOfflineMessageId','join','root','offline-chat/','basename','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','save','update','then','sendStatus','error','stack','name','index','map','rawAttributes','type','key','query','keys','filters','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','attributes','intersection','find','clone','Attachment'];(function(_0x3026cf,_0x4717b3){var _0x5bb000=function(_0x1f4996){while(--_0x1f4996){_0x3026cf['push'](_0x3026cf['shift']());}};_0x5bb000(++_0x4717b3);}(_0xc0b7,0x171));var _0x7c0b=function(_0x74f20e,_0x2fc090){_0x74f20e=_0x74f20e-0x0;var _0x4161dd=_0xc0b7[_0x74f20e];return _0x4161dd;};'use strict';var emlformat=require(_0x7c0b('0x0'));var rimraf=require(_0x7c0b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7c0b('0x2'));var rp=require(_0x7c0b('0x3'));var moment=require('moment');var BPromise=require(_0x7c0b('0x4'));var Mustache=require(_0x7c0b('0x5'));var util=require(_0x7c0b('0x6'));var path=require(_0x7c0b('0x7'));var sox=require('sox');var csv=require(_0x7c0b('0x8'));var ejs=require(_0x7c0b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c0b('0xa'));var squel=require(_0x7c0b('0xb'));var crypto=require(_0x7c0b('0xc'));var jsforce=require(_0x7c0b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7c0b('0x8'));var querystring=require(_0x7c0b('0xe'));var Papa=require(_0x7c0b('0xf'));var Redis=require(_0x7c0b('0x10'));var authService=require(_0x7c0b('0x11'));var qs=require(_0x7c0b('0x12'));var as=require(_0x7c0b('0x13'));var hardwareService=require(_0x7c0b('0x14'));var logger=require(_0x7c0b('0x15'))('api');var utils=require(_0x7c0b('0x16'));var config=require(_0x7c0b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7c0b('0x18'))['db'];function respondWithStatusCode(_0x2efe8c,_0x31784a){_0x31784a=_0x31784a||0xcc;return function(_0x57e72e){if(_0x57e72e){return _0x2efe8c['sendStatus'](_0x31784a);}return _0x2efe8c[_0x7c0b('0x19')](_0x31784a)[_0x7c0b('0x1a')]();};}function respondWithResult(_0x3ae20a,_0x41d730){_0x41d730=_0x41d730||0xc8;return function(_0x4f5787){if(_0x4f5787){return _0x3ae20a[_0x7c0b('0x19')](_0x41d730)['json'](_0x4f5787);}};}function respondWithFilteredResult(_0x287307,_0x1eeec2){return function(_0x16a0e8){if(_0x16a0e8){var _0x302938=_0x16a0e8[_0x7c0b('0x1b')],_0x58f72b=_0x1eeec2[_0x7c0b('0x1c')],_0x4ade16=_0x1eeec2[_0x7c0b('0x1c')]+_0x1eeec2[_0x7c0b('0x1d')],_0x2137a2;if(_0x4ade16>=_0x302938){_0x4ade16=_0x302938;_0x2137a2=0xc8;}else{_0x2137a2=0xce;}_0x287307[_0x7c0b('0x19')](_0x2137a2);return _0x287307[_0x7c0b('0x1e')](_0x7c0b('0x1f'),_0x58f72b+'-'+_0x4ade16+'/'+_0x302938)[_0x7c0b('0x20')](_0x16a0e8);}return null;};}function patchUpdates(_0x1c192c){return function(_0x604e8){try{jsonpatch['apply'](_0x604e8,_0x1c192c,!![]);}catch(_0x3d3ada){return BPromise['reject'](_0x3d3ada);}return _0x604e8[_0x7c0b('0x21')]();};}function saveUpdates(_0x371639,_0x2f03e2){return function(_0x9d0dd3){if(_0x9d0dd3){return _0x9d0dd3[_0x7c0b('0x22')](_0x371639)['then'](function(_0x40d7f0){return _0x40d7f0;});}return null;};}function removeEntity(_0x3126f3,_0x47c743){return function(_0x4cd12e){if(_0x4cd12e){return _0x4cd12e['destroy']()[_0x7c0b('0x23')](function(){_0x3126f3['status'](0xcc)[_0x7c0b('0x1a')]();});}};}function handleEntityNotFound(_0xb49c0c,_0x3ffe90){return function(_0x3bc7c8){if(!_0x3bc7c8){_0xb49c0c[_0x7c0b('0x24')](0x194);}return _0x3bc7c8;};}function handleError(_0x2b72f2,_0x188820){_0x188820=_0x188820||0x1f4;return function(_0xec8898){logger[_0x7c0b('0x25')](_0xec8898[_0x7c0b('0x26')]);if(_0xec8898['name']){delete _0xec8898[_0x7c0b('0x27')];}_0x2b72f2[_0x7c0b('0x19')](_0x188820)['send'](_0xec8898);};}exports[_0x7c0b('0x28')]=function(_0x1a5d6f,_0x261154){var _0x41bbf8={},_0x52eb73={},_0xb956c8={'count':0x0,'rows':[]};var _0x4d72b7=_[_0x7c0b('0x29')](db['Attachment'][_0x7c0b('0x2a')],function(_0x5e32ca){return{'name':_0x5e32ca['fieldName'],'type':_0x5e32ca[_0x7c0b('0x2b')][_0x7c0b('0x2c')]};});_0x52eb73['model']=_[_0x7c0b('0x29')](_0x4d72b7,_0x7c0b('0x27'));_0x52eb73[_0x7c0b('0x2d')]=_[_0x7c0b('0x2e')](_0x1a5d6f[_0x7c0b('0x2d')]);_0x52eb73[_0x7c0b('0x2f')]=_['intersection'](_0x52eb73[_0x7c0b('0x30')],_0x52eb73[_0x7c0b('0x2d')]);_0x41bbf8['attributes']=_['intersection'](_0x52eb73['model'],qs[_0x7c0b('0x31')](_0x1a5d6f['query'][_0x7c0b('0x31')]));_0x41bbf8['attributes']=_0x41bbf8['attributes'][_0x7c0b('0x32')]?_0x41bbf8['attributes']:_0x52eb73['model'];if(!_0x1a5d6f[_0x7c0b('0x2d')][_0x7c0b('0x33')]('nolimit')){_0x41bbf8[_0x7c0b('0x1d')]=qs['limit'](_0x1a5d6f[_0x7c0b('0x2d')][_0x7c0b('0x1d')]);_0x41bbf8[_0x7c0b('0x1c')]=qs[_0x7c0b('0x1c')](_0x1a5d6f[_0x7c0b('0x2d')][_0x7c0b('0x1c')]);}_0x41bbf8[_0x7c0b('0x34')]=qs[_0x7c0b('0x35')](_0x1a5d6f[_0x7c0b('0x2d')][_0x7c0b('0x35')]);_0x41bbf8[_0x7c0b('0x36')]=qs[_0x7c0b('0x2f')](_[_0x7c0b('0x37')](_0x1a5d6f['query'],_0x52eb73[_0x7c0b('0x2f')]),_0x4d72b7);if(_0x1a5d6f[_0x7c0b('0x2d')][_0x7c0b('0x38')]){_0x41bbf8[_0x7c0b('0x36')]=_['merge'](_0x41bbf8['where'],{'$or':_[_0x7c0b('0x29')](_0x4d72b7,function(_0x31075c){if(_0x31075c[_0x7c0b('0x2b')]!==_0x7c0b('0x39')){var _0x203368={};_0x203368[_0x31075c[_0x7c0b('0x27')]]={'$like':'%'+_0x1a5d6f[_0x7c0b('0x2d')]['filter']+'%'};return _0x203368;}})});}_0x41bbf8=_['merge']({},_0x41bbf8,_0x1a5d6f[_0x7c0b('0x3a')]);var _0x155fa0={'where':_0x41bbf8[_0x7c0b('0x36')]};return db['Attachment'][_0x7c0b('0x1b')](_0x155fa0)[_0x7c0b('0x23')](function(_0x316c98){_0xb956c8[_0x7c0b('0x1b')]=_0x316c98;if(_0x1a5d6f[_0x7c0b('0x2d')][_0x7c0b('0x3b')]){_0x41bbf8[_0x7c0b('0x3c')]=[{'all':!![]}];}return db['Attachment'][_0x7c0b('0x3d')](_0x41bbf8);})[_0x7c0b('0x23')](function(_0x22ebac){_0xb956c8[_0x7c0b('0x3e')]=_0x22ebac;return _0xb956c8;})[_0x7c0b('0x23')](respondWithFilteredResult(_0x261154,_0x41bbf8))[_0x7c0b('0x3f')](handleError(_0x261154,null));};exports[_0x7c0b('0x40')]=function(_0x37e5de,_0x2cb2a7){var _0x310238={'raw':!![],'where':{'id':_0x37e5de[_0x7c0b('0x41')]['id']}},_0x5b1410={};_0x5b1410[_0x7c0b('0x30')]=_['keys'](db['Attachment'][_0x7c0b('0x2a')]);_0x5b1410[_0x7c0b('0x2d')]=_['keys'](_0x37e5de[_0x7c0b('0x2d')]);_0x5b1410[_0x7c0b('0x2f')]=_['intersection'](_0x5b1410[_0x7c0b('0x30')],_0x5b1410[_0x7c0b('0x2d')]);_0x310238[_0x7c0b('0x42')]=_[_0x7c0b('0x43')](_0x5b1410[_0x7c0b('0x30')],qs[_0x7c0b('0x31')](_0x37e5de[_0x7c0b('0x2d')][_0x7c0b('0x31')]));_0x310238['attributes']=_0x310238['attributes'][_0x7c0b('0x32')]?_0x310238[_0x7c0b('0x42')]:_0x5b1410[_0x7c0b('0x30')];if(_0x37e5de['query'][_0x7c0b('0x3b')]){_0x310238[_0x7c0b('0x3c')]=[{'all':!![]}];}_0x310238=_['merge']({},_0x310238,_0x37e5de[_0x7c0b('0x3a')]);return db['Attachment'][_0x7c0b('0x44')](_0x310238)[_0x7c0b('0x23')](handleEntityNotFound(_0x2cb2a7,null))[_0x7c0b('0x23')](respondWithResult(_0x2cb2a7,null))[_0x7c0b('0x3f')](handleError(_0x2cb2a7,null));};exports[_0x7c0b('0x45')]=function(_0x4418eb,_0x37a9f4){var _0x307813={'where':{'id':_0x4418eb[_0x7c0b('0x41')]['id']}},_0x264e71={};_0x264e71['model']=_[_0x7c0b('0x2e')](db[_0x7c0b('0x46')][_0x7c0b('0x2a')]);_0x307813[_0x7c0b('0x42')]=_[_0x7c0b('0x43')](_0x264e71['model'],qs[_0x7c0b('0x31')](_0x4418eb[_0x7c0b('0x2d')][_0x7c0b('0x31')]));_0x307813[_0x7c0b('0x42')]=_0x307813[_0x7c0b('0x42')][_0x7c0b('0x32')]?_0x307813['attributes']:_0x264e71['model'];if(_0x4418eb['query'][_0x7c0b('0x3b')]){_0x307813['include']=[{'all':!![]}];}_0x307813=_[_0x7c0b('0x47')]({},_0x307813,_0x4418eb[_0x7c0b('0x3a')]);return db[_0x7c0b('0x46')][_0x7c0b('0x44')](_0x307813)[_0x7c0b('0x23')](handleEntityNotFound(_0x37a9f4,null))['then'](function(_0x4e6706){if(_0x4e6706){var _0x4559aa=_0x4e6706[_0x7c0b('0x48')]({'plain':!![]});_0x4559aa=qs[_0x7c0b('0x49')](_0x4559aa,['id',_0x7c0b('0x4a'),_0x7c0b('0x4b')]);_0x4418eb[_0x7c0b('0x4c')]=_[_0x7c0b('0x49')](_0x4418eb[_0x7c0b('0x4c')],['id',_0x7c0b('0x4a'),_0x7c0b('0x4b')]);return db[_0x7c0b('0x46')][_0x7c0b('0x4d')](_['merge'](_0x4559aa,_0x4418eb[_0x7c0b('0x4c')]),{'include':_0x4418eb['query'][_0x7c0b('0x3b')]?[{'all':!![]}]:undefined});}})[_0x7c0b('0x23')](respondWithResult(_0x37a9f4,0xc9))[_0x7c0b('0x3f')](handleError(_0x37a9f4,null));};exports[_0x7c0b('0x22')]=function(_0x254d67,_0x27991f){if(_0x254d67[_0x7c0b('0x4c')]['id']){delete _0x254d67[_0x7c0b('0x4c')]['id'];}return db[_0x7c0b('0x46')][_0x7c0b('0x44')]({'where':{'id':_0x254d67[_0x7c0b('0x41')]['id']}})[_0x7c0b('0x23')](handleEntityNotFound(_0x27991f,null))[_0x7c0b('0x23')](saveUpdates(_0x254d67[_0x7c0b('0x4c')],null))[_0x7c0b('0x23')](respondWithResult(_0x27991f,null))[_0x7c0b('0x3f')](handleError(_0x27991f,null));};exports[_0x7c0b('0x4e')]=function(_0x57097a,_0x307053){return db['Attachment']['find']({'where':{'id':_0x57097a[_0x7c0b('0x41')]['id']}})[_0x7c0b('0x23')](handleEntityNotFound(_0x307053,null))[_0x7c0b('0x23')](removeEntity(_0x307053,null))[_0x7c0b('0x3f')](handleError(_0x307053,null));};exports['create']=function(_0x1bcee1,_0xe68238,_0x533147){_0x1bcee1[_0x7c0b('0x4c')]['name']=_0x1bcee1['file']['originalname'];_0x1bcee1['body']['basename']=_0x1bcee1[_0x7c0b('0x4f')][_0x7c0b('0x50')];_0x1bcee1[_0x7c0b('0x4c')][_0x7c0b('0x2b')]=_0x1bcee1['file']['mimetype'];return db[_0x7c0b('0x46')][_0x7c0b('0x4d')](_0x1bcee1[_0x7c0b('0x4c')])[_0x7c0b('0x23')](respondWithResult(_0xe68238,0xc9))[_0x7c0b('0x3f')](handleError(_0xe68238,null));};exports[_0x7c0b('0x51')]=function(_0x427766,_0x25cfcb,_0x446bb1){return db[_0x7c0b('0x46')][_0x7c0b('0x52')]({'where':{'id':_0x427766[_0x7c0b('0x41')]['id']},'raw':!![]})[_0x7c0b('0x23')](handleEntityNotFound(_0x25cfcb,null))[_0x7c0b('0x23')](function(_0x31c686){if(_0x31c686){var _0x22d0f9=_0x31c686[_0x7c0b('0x53')]!==null;var _0x967caf=path[_0x7c0b('0x54')](config[_0x7c0b('0x55')],'server/files/attachments/');if(_0x22d0f9){_0x967caf=path['join'](_0x967caf,_0x7c0b('0x56'));}var _0x5ed41d=path[_0x7c0b('0x54')](_0x967caf,_0x31c686[_0x7c0b('0x57')]);return _0x25cfcb['download'](_0x5ed41d);}})[_0x7c0b('0x3f')](handleError(_0x25cfcb,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index b3b2be1..60a975b 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 _0xcaef=['api','moment','request-promise','rimraf','../../config/environment','exports','define','util','../../config/logger'];(function(_0x4f6b60,_0x47c449){var _0x406f77=function(_0x2f48aa){while(--_0x2f48aa){_0x4f6b60['push'](_0x4f6b60['shift']());}};_0x406f77(++_0x47c449);}(_0xcaef,0x1c9));var _0xfcae=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0xcaef[_0x5a79e2];return _0x266c45;};'use strict';var _=require('lodash');var util=require(_0xfcae('0x0'));var logger=require(_0xfcae('0x1'))(_0xfcae('0x2'));var moment=require(_0xfcae('0x3'));var BPromise=require('bluebird');var rp=require(_0xfcae('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfcae('0x5'));var config=require(_0xfcae('0x6'));var attributes=require('./attachment.attributes');module[_0xfcae('0x7')]=function(_0x19dd62,_0x4e8311){return _0x19dd62[_0xfcae('0x8')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2fc9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','Attachment','attachments','util'];(function(_0x491589,_0x2a0169){var _0x5b903c=function(_0x4416ab){while(--_0x4416ab){_0x491589['push'](_0x491589['shift']());}};_0x5b903c(++_0x2a0169);}(_0x2fc9,0xc2));var _0x92fc=function(_0x540dcb,_0x4eacb6){_0x540dcb=_0x540dcb-0x0;var _0x49353c=_0x2fc9[_0x540dcb];return _0x49353c;};'use strict';var _=require('lodash');var util=require(_0x92fc('0x0'));var logger=require(_0x92fc('0x1'))(_0x92fc('0x2'));var moment=require(_0x92fc('0x3'));var BPromise=require(_0x92fc('0x4'));var rp=require(_0x92fc('0x5'));var fs=require('fs');var path=require(_0x92fc('0x6'));var rimraf=require(_0x92fc('0x7'));var config=require(_0x92fc('0x8'));var attributes=require(_0x92fc('0x9'));module[_0x92fc('0xa')]=function(_0x5d492e,_0x580d4a){return _0x5d492e['define'](_0x92fc('0xb'),attributes,{'tableName':_0x92fc('0xc'),'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 f854d14..bf7cb21 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 _0x1ac4=['Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','body','options','raw','CreateAttachment','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x35ef47,_0x452872){var _0x534061=function(_0x4a24d2){while(--_0x4a24d2){_0x35ef47['push'](_0x35ef47['shift']());}};_0x534061(++_0x452872);}(_0x1ac4,0x1a1));var _0x41ac=function(_0x3692e5,_0x25869e){_0x3692e5=_0x3692e5-0x0;var _0x339657=_0x1ac4[_0x3692e5];return _0x339657;};'use strict';var _=require(_0x41ac('0x0'));var util=require(_0x41ac('0x1'));var moment=require('moment');var BPromise=require(_0x41ac('0x2'));var rs=require(_0x41ac('0x3'));var fs=require('fs');var Redis=require(_0x41ac('0x4'));var db=require(_0x41ac('0x5'))['db'];var utils=require(_0x41ac('0x6'));var logger=require(_0x41ac('0x7'))(_0x41ac('0x8'));var config=require(_0x41ac('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x41ac('0xa')][_0x41ac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x477888,_0x25b25e,_0x5cba87){return new BPromise(function(_0x183246,_0x482e8a){return client[_0x41ac('0xc')](_0x477888,_0x5cba87)[_0x41ac('0xd')](function(_0x5271a5){logger[_0x41ac('0xe')](_0x41ac('0xf'),_0x25b25e,_0x41ac('0x10'));logger['debug'](_0x41ac('0x11'),_0x25b25e,_0x41ac('0x10'),JSON[_0x41ac('0x12')](_0x5271a5));if(_0x5271a5[_0x41ac('0x13')]){if(_0x5271a5[_0x41ac('0x13')][_0x41ac('0x14')]===0x1f4){logger[_0x41ac('0x13')](_0x41ac('0xf'),_0x25b25e,_0x5271a5[_0x41ac('0x13')][_0x41ac('0x15')]);return _0x482e8a(_0x5271a5[_0x41ac('0x13')]['message']);}logger[_0x41ac('0x13')](_0x41ac('0xf'),_0x25b25e,_0x5271a5[_0x41ac('0x13')][_0x41ac('0x15')]);return _0x183246(_0x5271a5[_0x41ac('0x13')][_0x41ac('0x15')]);}else{logger[_0x41ac('0xe')](_0x41ac('0xf'),_0x25b25e,_0x41ac('0x10'));_0x183246(_0x5271a5['result'][_0x41ac('0x15')]);}})[_0x41ac('0x16')](function(_0x499421){logger[_0x41ac('0x13')](_0x41ac('0xf'),_0x25b25e,_0x499421);_0x482e8a(_0x499421);});});}exports['CreateAttachment']=function(_0xe0d9c3){var _0x5848a0=this;return new Promise(function(_0x159847,_0x57c6d9){return db['Attachment']['create'](_0xe0d9c3[_0x41ac('0x17')],{'raw':_0xe0d9c3['options']?_0xe0d9c3[_0x41ac('0x18')][_0x41ac('0x19')]===undefined?!![]:![]:!![]})[_0x41ac('0xd')](function(_0x29c467){logger[_0x41ac('0xe')]('CreateAttachment',_0xe0d9c3);logger['debug'](_0x41ac('0x1a'),_0xe0d9c3,JSON[_0x41ac('0x12')](_0x29c467));_0x159847(_0x29c467);})['catch'](function(_0x3589b1){logger['error']('CreateAttachment',_0x3589b1[_0x41ac('0x15')],_0xe0d9c3);_0x57c6d9(_0x5848a0[_0x41ac('0x13')](0x1f4,_0x3589b1[_0x41ac('0x15')]));});});}; \ No newline at end of file +var _0x5140=['body','options','raw','CreateAttachment','stringify','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','create'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x5140,0x1d1));var _0x0514=function(_0x2d0d81,_0x41e51b){_0x2d0d81=_0x2d0d81-0x0;var _0xe9fcad=_0x5140[_0x2d0d81];return _0xe9fcad;};'use strict';var _=require(_0x0514('0x0'));var util=require(_0x0514('0x1'));var moment=require(_0x0514('0x2'));var BPromise=require(_0x0514('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0514('0x4'));var db=require(_0x0514('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0514('0x6'))(_0x0514('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0514('0x8')][_0x0514('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27d8cb,_0x582ad6,_0x1d38ef){return new BPromise(function(_0x3a2495,_0x12de7a){return client['request'](_0x27d8cb,_0x1d38ef)[_0x0514('0xa')](function(_0x2145e5){logger[_0x0514('0xb')](_0x0514('0xc'),_0x582ad6,_0x0514('0xd'));logger[_0x0514('0xe')](_0x0514('0xf'),_0x582ad6,_0x0514('0xd'),JSON['stringify'](_0x2145e5));if(_0x2145e5[_0x0514('0x10')]){if(_0x2145e5['error'][_0x0514('0x11')]===0x1f4){logger[_0x0514('0x10')]('Attachment,\x20%s,\x20%s',_0x582ad6,_0x2145e5[_0x0514('0x10')]['message']);return _0x12de7a(_0x2145e5['error'][_0x0514('0x12')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x582ad6,_0x2145e5[_0x0514('0x10')][_0x0514('0x12')]);return _0x3a2495(_0x2145e5[_0x0514('0x10')]['message']);}else{logger['info'](_0x0514('0xc'),_0x582ad6,_0x0514('0xd'));_0x3a2495(_0x2145e5[_0x0514('0x13')][_0x0514('0x12')]);}})['catch'](function(_0x528fdf){logger[_0x0514('0x10')](_0x0514('0xc'),_0x582ad6,_0x528fdf);_0x12de7a(_0x528fdf);});});}exports['CreateAttachment']=function(_0x2e4200){var _0x3596ac=this;return new Promise(function(_0x35ad19,_0x44b0a8){return db['Attachment'][_0x0514('0x14')](_0x2e4200[_0x0514('0x15')],{'raw':_0x2e4200[_0x0514('0x16')]?_0x2e4200[_0x0514('0x16')][_0x0514('0x17')]===undefined?!![]:![]:!![]})[_0x0514('0xa')](function(_0x43d10e){logger['info'](_0x0514('0x18'),_0x2e4200);logger[_0x0514('0xe')](_0x0514('0x18'),_0x2e4200,JSON[_0x0514('0x19')](_0x43d10e));_0x35ad19(_0x43d10e);})[_0x0514('0x1a')](function(_0x1b4c65){logger['error'](_0x0514('0x18'),_0x1b4c65[_0x0514('0x12')],_0x2e4200);_0x44b0a8(_0x3596ac[_0x0514('0x10')](0x1f4,_0x1b4c65[_0x0514('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index dbdc58b..f29418c 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 _0x00b3=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','%s-%s','now','originalname','create','put','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./attachment.controller','get','isAuthenticated','index','/:id/download','download'];(function(_0x1338e2,_0x574a8a){var _0x538596=function(_0x4265c9){while(--_0x4265c9){_0x1338e2['push'](_0x1338e2['shift']());}};_0x538596(++_0x574a8a);}(_0x00b3,0x17a));var _0x300b=function(_0x3185ad,_0x5a2a1f){_0x3185ad=_0x3185ad-0x0;var _0x5afcaf=_0x00b3[_0x3185ad];return _0x5afcaf;};'use strict';var multer=require('multer');var util=require(_0x300b('0x0'));var path=require(_0x300b('0x1'));var timeout=require(_0x300b('0x2'));var express=require(_0x300b('0x3'));var router=express['Router']();var fs_extra=require(_0x300b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x300b('0x5'));var config=require('../../config/environment');var controller=require(_0x300b('0x6'));router[_0x300b('0x7')]('/',auth[_0x300b('0x8')](),controller[_0x300b('0x9')]);router['get']('/:id',auth[_0x300b('0x8')](),controller['show']);router['get'](_0x300b('0xa'),auth[_0x300b('0x8')](),controller[_0x300b('0xb')]);router['post'](_0x300b('0xc'),auth[_0x300b('0x8')](),controller[_0x300b('0xd')]);var upload=multer({'storage':multer[_0x300b('0xe')]({'destination':function(_0x566fb9,_0x1a96aa,_0x2eeb2d){_0x2eeb2d(null,path[_0x300b('0xf')](config['root'],_0x300b('0x10')));},'filename':function(_0xea95bb,_0x138efb,_0x40c03b){_0x40c03b(null,util[_0x300b('0x11')](_0x300b('0x12'),Date[_0x300b('0x13')](),_0x138efb[_0x300b('0x14')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload['single']('file'),controller[_0x300b('0x15')]);router[_0x300b('0x16')](_0x300b('0x17'),auth[_0x300b('0x8')](),controller['update']);router['delete'](_0x300b('0x17'),auth[_0x300b('0x8')](),controller[_0x300b('0x18')]);module[_0x300b('0x19')]=router; \ No newline at end of file +var _0xdc9b=['Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/download','download','post','/:id/clone','clone','diskStorage','join','root','server/files/attachments/','format','now','single','create','put','/:id','update','delete','destroy','exports','multer','util','path','express'];(function(_0x276c47,_0xb9d4de){var _0x3e839b=function(_0x11580a){while(--_0x11580a){_0x276c47['push'](_0x276c47['shift']());}};_0x3e839b(++_0xb9d4de);}(_0xdc9b,0x70));var _0xbdc9=function(_0x16999e,_0x3db761){_0x16999e=_0x16999e-0x0;var _0x16f4dc=_0xdc9b[_0x16999e];return _0x16f4dc;};'use strict';var multer=require(_0xbdc9('0x0'));var util=require(_0xbdc9('0x1'));var path=require(_0xbdc9('0x2'));var timeout=require('connect-timeout');var express=require(_0xbdc9('0x3'));var router=express[_0xbdc9('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbdc9('0x5'));var config=require(_0xbdc9('0x6'));var controller=require('./attachment.controller');router[_0xbdc9('0x7')]('/',auth[_0xbdc9('0x8')](),controller['index']);router[_0xbdc9('0x7')]('/:id',auth[_0xbdc9('0x8')](),controller[_0xbdc9('0x9')]);router[_0xbdc9('0x7')](_0xbdc9('0xa'),auth[_0xbdc9('0x8')](),controller[_0xbdc9('0xb')]);router[_0xbdc9('0xc')](_0xbdc9('0xd'),auth[_0xbdc9('0x8')](),controller[_0xbdc9('0xe')]);var upload=multer({'storage':multer[_0xbdc9('0xf')]({'destination':function(_0x1f950a,_0x19fe9d,_0xb5a15b){_0xb5a15b(null,path[_0xbdc9('0x10')](config[_0xbdc9('0x11')],_0xbdc9('0x12')));},'filename':function(_0x465acf,_0x12a807,_0x2784c1){_0x2784c1(null,util[_0xbdc9('0x13')]('%s-%s',Date[_0xbdc9('0x14')](),_0x12a807['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbdc9('0xc')]('/',upload[_0xbdc9('0x15')]('file'),controller[_0xbdc9('0x16')]);router[_0xbdc9('0x17')](_0xbdc9('0x18'),auth[_0xbdc9('0x8')](),controller[_0xbdc9('0x19')]);router[_0xbdc9('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0xbdc9('0x1b')]);module[_0xbdc9('0x1c')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 5a01352..d9eeafe 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 _0x2497=['clientSecret','secret','callbackURL','allowedLoginAttempts','User','emails','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','blockDuration','minutes','clearBlockUser','then','getLicense','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','../../config/utils','login','authenticate','google','/login','callback','use','clientID'];(function(_0x41c44d,_0x31d1eb){var _0x5e00f5=function(_0x235c98){while(--_0x235c98){_0x41c44d['push'](_0x41c44d['shift']());}};_0x5e00f5(++_0x31d1eb);}(_0x2497,0x101));var _0x7249=function(_0x20264d,_0x552ea5){_0x20264d=_0x20264d-0x0;var _0x4056f1=_0x2497[_0x20264d];return _0x4056f1;};'use strict';var _=require('lodash');var passport=require(_0x7249('0x0'));var GoogleStrategy=require(_0x7249('0x1'))[_0x7249('0x2')];var moment=require(_0x7249('0x3'));var db=require(_0x7249('0x4'))['db'];var config=require(_0x7249('0x5'));var signToken=require(_0x7249('0x6'))['signToken'];var utils=require(_0x7249('0x7'));exports[_0x7249('0x8')]=passport[_0x7249('0x9')](_0x7249('0xa'),{'failureRedirect':_0x7249('0xb'),'scope':['profile','email'],'session':![]});exports[_0x7249('0xc')]=passport['authenticate']('google',{'failureRedirect':_0x7249('0xb'),'session':![]});passport[_0x7249('0xd')](new GoogleStrategy({'clientID':config['google']?config[_0x7249('0xa')][_0x7249('0xe')]:'id','clientSecret':config[_0x7249('0xa')]?config['google'][_0x7249('0xf')]:_0x7249('0x10'),'callbackURL':config[_0x7249('0xa')]?config['google'][_0x7249('0x11')]:''},function(_0x268661,_0x1a731e,_0x313003,_0x241fa0){var _0x45df2e,_0x5ad818;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x7249('0x12'),'blockDuration'],'raw':!![]})['then'](function(_0x23e5af){_0x45df2e=_0x23e5af;return db[_0x7249('0x13')]['find']({'where':{'email':_['map'](_0x313003[_0x7249('0x14')],_0x7249('0x15')),'role':{'$or':[_0x7249('0x16'),_0x7249('0x17'),_0x7249('0x18')]}}});})['then'](function(_0x5cd17c){_0x5ad818=_0x5cd17c;if(_0x5ad818){if(_0x5ad818['disabled']){return _0x241fa0(_0x7249('0x19'));}else if(_0x45df2e['blockDuration']>0x0){if(_0x5ad818[_0x7249('0x1a')]){if(moment(_0x5ad818[_0x7249('0x1b')])[_0x7249('0x1c')](_0x45df2e[_0x7249('0x1d')],_0x7249('0x1e'))>moment()){return _0x241fa0(_0x7249('0x19'));}else{return utils[_0x7249('0x1f')](_0x5ad818,0x0,![],null)['then'](function(){return utils['getLicense'](_0x5ad818);})[_0x7249('0x20')](function(){return _0x241fa0(null,_0x5ad818);});}}else{return utils[_0x7249('0x21')](_0x5ad818)[_0x7249('0x20')](function(){return _0x241fa0(null,_0x5ad818);});}}else{return utils[_0x7249('0x21')](_0x5ad818)[_0x7249('0x20')](function(){return _0x241fa0(null,_0x5ad818);});}}return _0x241fa0('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})['catch'](function(_0x2ccfd9){_0x241fa0(_0x2ccfd9);});})); \ No newline at end of file +var _0x0255=['map','value','user','blockDuration','blocked','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','Strategy','moment','../../mysqldb','../../components/auth/service','signToken','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','secret','callbackURL','findOne','allowedLoginAttempts','then','User'];(function(_0x51d71a,_0x596fda){var _0xff01f1=function(_0x30480f){while(--_0x30480f){_0x51d71a['push'](_0x51d71a['shift']());}};_0xff01f1(++_0x596fda);}(_0x0255,0xcb));var _0x5025=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0255[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5025('0x0'));var passport=require('passport');var GoogleStrategy=require('passport-google-oauth20')[_0x5025('0x1')];var moment=require(_0x5025('0x2'));var db=require(_0x5025('0x3'))['db'];var config=require('../../config/environment');var signToken=require(_0x5025('0x4'))[_0x5025('0x5')];var utils=require(_0x5025('0x6'));exports[_0x5025('0x7')]=passport['authenticate'](_0x5025('0x8'),{'failureRedirect':_0x5025('0x9'),'scope':[_0x5025('0xa'),_0x5025('0xb')],'session':![]});exports[_0x5025('0xc')]=passport[_0x5025('0xd')](_0x5025('0x8'),{'failureRedirect':_0x5025('0x9'),'session':![]});passport[_0x5025('0xe')](new GoogleStrategy({'clientID':config[_0x5025('0x8')]?config['google']['clientID']:'id','clientSecret':config[_0x5025('0x8')]?config[_0x5025('0x8')]['clientSecret']:_0x5025('0xf'),'callbackURL':config[_0x5025('0x8')]?config[_0x5025('0x8')][_0x5025('0x10')]:''},function(_0x16a9f2,_0x1aaa26,_0x5947b0,_0x5f13a8){var _0x22e41d,_0x35e7ec;return db['Setting'][_0x5025('0x11')]({'where':{'id':0x1},'attributes':[_0x5025('0x12'),'blockDuration'],'raw':!![]})[_0x5025('0x13')](function(_0x249323){_0x22e41d=_0x249323;return db[_0x5025('0x14')]['find']({'where':{'email':_[_0x5025('0x15')](_0x5947b0['emails'],_0x5025('0x16')),'role':{'$or':['admin',_0x5025('0x17'),'agent']}}});})['then'](function(_0x536d81){_0x35e7ec=_0x536d81;if(_0x35e7ec){if(_0x35e7ec['disabled']){return _0x5f13a8('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x22e41d[_0x5025('0x18')]>0x0){if(_0x35e7ec[_0x5025('0x19')]){if(moment(_0x35e7ec['blockedAt'])[_0x5025('0x1a')](_0x22e41d[_0x5025('0x18')],_0x5025('0x1b'))>moment()){return _0x5f13a8(_0x5025('0x1c'));}else{return utils[_0x5025('0x1d')](_0x35e7ec,0x0,![],null)[_0x5025('0x13')](function(){return utils[_0x5025('0x1e')](_0x35e7ec);})['then'](function(){return _0x5f13a8(null,_0x35e7ec);});}}else{return utils[_0x5025('0x1e')](_0x35e7ec)[_0x5025('0x13')](function(){return _0x5f13a8(null,_0x35e7ec);});}}else{return utils[_0x5025('0x1e')](_0x35e7ec)[_0x5025('0x13')](function(){return _0x5f13a8(null,_0x35e7ec);});}}return _0x5f13a8(_0x5025('0x1c'));})[_0x5025('0x1f')](function(_0x5d12a1){_0x5f13a8(_0x5d12a1);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 9193c09..a5045c1 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 _0x87df=['passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','setTokenCookie','express'];(function(_0x4d5bdc,_0x120b9e){var _0x3ada94=function(_0x1ae34e){while(--_0x1ae34e){_0x4d5bdc['push'](_0x4d5bdc['shift']());}};_0x3ada94(++_0x120b9e);}(_0x87df,0x167));var _0xf87d=function(_0x119629,_0x246787){_0x119629=_0x119629-0x0;var _0x49a771=_0x87df[_0x119629];return _0x49a771;};'use strict';var express=require(_0xf87d('0x0'));var passport=require(_0xf87d('0x1'));var router=express[_0xf87d('0x2')]();var controller=require(_0xf87d('0x3'));var userController=require(_0xf87d('0x4'));var authService=require(_0xf87d('0x5'));router[_0xf87d('0x6')]('/',controller[_0xf87d('0x7')]);router[_0xf87d('0x6')](_0xf87d('0x8'),controller['callback'],authService['isMiddleware'],userController[_0xf87d('0x7')],authService[_0xf87d('0x9')]);module['exports']=router; \ No newline at end of file +var _0x83f1=['callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','login','get','/callback'];(function(_0x5685c9,_0x4f8459){var _0x24a2c0=function(_0x779b15){while(--_0x779b15){_0x5685c9['push'](_0x5685c9['shift']());}};_0x24a2c0(++_0x4f8459);}(_0x83f1,0x1cc));var _0x183f=function(_0x2f704e,_0x352341){_0x2f704e=_0x2f704e-0x0;var _0x5534c1=_0x83f1[_0x2f704e];return _0x5534c1;};'use strict';var express=require(_0x183f('0x0'));var passport=require(_0x183f('0x1'));var router=express[_0x183f('0x2')]();var controller=require(_0x183f('0x3'));var userController=require(_0x183f('0x4'));var authService=require('../../components/auth/service');router['get']('/',controller[_0x183f('0x5')]);router[_0x183f('0x6')](_0x183f('0x7'),controller[_0x183f('0x8')],authService[_0x183f('0x9')],userController['login'],authService[_0x183f('0xa')]);module[_0x183f('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 4f03007..8053e98 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 _0x741c=['SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','generate','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','minutes','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','save','Password\x20reset!','util','passport','passport-local','Strategy','jayson/promise','lodash','../../mysqldb','../../config/utils','client','http','Setting','allowedLoginAttempts','findOne','name','password','salt','role','disabled','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','loginAttempts','blocked','blockedAt','add','clearBlockUser','blockDuration','getLicense','catch','MailAccount','find','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error'];(function(_0x4953c6,_0x10c99a){var _0x3759e5=function(_0xb642a0){while(--_0xb642a0){_0x4953c6['push'](_0x4953c6['shift']());}};_0x3759e5(++_0x10c99a);}(_0x741c,0x196));var _0xc741=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x741c[_0x42cae2];return _0x5f256f;};'use strict';var util=require(_0xc741('0x0'));var passport=require(_0xc741('0x1'));var LocalStrategy=require(_0xc741('0x2'))[_0xc741('0x3')];var jayson=require(_0xc741('0x4'));var _=require(_0xc741('0x5'));var rs=require('randomstring');var moment=require('moment');var db=require(_0xc741('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xc741('0x7'));var client=jayson[_0xc741('0x8')][_0xc741('0x9')]({'port':0x232b});function localAuthenticate(_0x133bc4,_0x3f3d82,_0x216e60,_0x46b743){var _0x598ead,_0x1ad6d9;return db[_0xc741('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0xc741('0xb'),'blockDuration'],'raw':!![]})['then'](function(_0x286e7d){_0x598ead=_0x286e7d;return _0x133bc4[_0xc741('0xc')]({'attributes':['id',_0xc741('0xd'),_0xc741('0xe'),_0xc741('0xf'),_0xc741('0x10'),_0xc741('0x11'),'blocked','blockedAt','loginAttempts'],'where':{'name':_0x3f3d82,'role':{'$or':[_0xc741('0x12'),_0xc741('0x13'),_0xc741('0x14')]}}});})[_0xc741('0x15')](function(_0x1b4442){if(!_0x1b4442||_0x1b4442&&_0x1b4442['name']!==_0x3f3d82){throw new Error(_0xc741('0x16'));}else{_0x1ad6d9=_0x1b4442;return _0x1ad6d9;}})[_0xc741('0x15')](function(){_0x1ad6d9['authenticate'](_0x216e60,function(_0xc0383,_0x3c7569){var _0xd92df7=_0x1ad6d9[_0xc741('0x17')]+0x1;if(_0xc0383){return _0x46b743(_0xc0383);}else if(!_0x3c7569){if(_0x1ad6d9[_0xc741('0x11')]){return _0x46b743(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x598ead['allowedLoginAttempts']>0x0){if(_0x1ad6d9[_0xc741('0x18')]){if(_0x598ead['blockDuration']>0x0){if(moment(_0x1ad6d9[_0xc741('0x19')])[_0xc741('0x1a')](_0x598ead['blockDuration'],'minutes')>moment()){return _0x46b743(null,![],{'message':_0xc741('0x16')});}else{return utils[_0xc741('0x1b')](_0x1ad6d9,_0xd92df7,![],null)[_0xc741('0x15')](function(){return _0x46b743(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x46b743(null,![],{'message':_0xc741('0x16')});}}else{if(_0xd92df7>=_0x598ead[_0xc741('0xb')]){return utils[_0xc741('0x1b')](_0x1ad6d9,0x0,!![],moment())[_0xc741('0x15')](function(){return _0x46b743(null,![],{'message':_0xc741('0x16')});});}else{return utils[_0xc741('0x1b')](_0x1ad6d9,_0xd92df7,![],null)[_0xc741('0x15')](function(){return _0x46b743(null,![],{'message':_0xc741('0x16')});});}}}else{return _0x46b743(null,![],{'message':_0xc741('0x16')});}}else{if(_0x1ad6d9['disabled']){return _0x46b743(null,![],{'message':_0xc741('0x16')});}else if(_0x598ead['allowedLoginAttempts']>0x0){if(_0x1ad6d9[_0xc741('0x18')]){if(_0x598ead['blockDuration']>0x0){if(moment(_0x1ad6d9[_0xc741('0x19')])[_0xc741('0x1a')](_0x598ead[_0xc741('0x1c')],'minutes')>moment()){return _0x46b743(null,![],{'message':_0xc741('0x16')});}else{return utils['clearBlockUser'](_0x1ad6d9,0x0,![],null)[_0xc741('0x15')](function(){return utils[_0xc741('0x1d')](_0x1ad6d9);})[_0xc741('0x15')](function(){return _0x46b743(null,_0x1ad6d9);});}}else{return _0x46b743(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x1ad6d9,0x0,![],null)['then'](function(){return utils[_0xc741('0x1d')](_0x1ad6d9);})[_0xc741('0x15')](function(){return _0x46b743(null,_0x1ad6d9);})[_0xc741('0x1e')](function(_0x3f6940){return _0x46b743(null,![],_0x3f6940);});}}else{if(_0x1ad6d9[_0xc741('0x18')]){return _0x46b743(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x1ad6d9)[_0xc741('0x15')](function(){return _0x46b743(null,_0x1ad6d9);});}}}});})[_0xc741('0x1e')](function(_0x102408){return _0x46b743(null,![],_0x102408);});}function sendServiceMail(_0x328793){return db[_0xc741('0x1f')][_0xc741('0x20')]({'where':{'service':!![]},'attributes':['id','name',_0xc741('0x21')],'include':[{'model':db[_0xc741('0x22')],'as':'Smtp'}]})[_0xc741('0x15')](function(_0x314fc2){if(!_0x314fc2){throw new Error(_0xc741('0x23'));}var _0x1ce361={'tls':{'rejectUnauthorized':![]}};if(_0x314fc2[_0xc741('0x24')][_0xc741('0x25')]){_0x1ce361[_0xc741('0x25')]=_0x314fc2[_0xc741('0x24')][_0xc741('0x25')];}else{_0x1ce361['host']=_0x314fc2[_0xc741('0x24')]['host'];_0x1ce361[_0xc741('0x26')]=_0x314fc2['Smtp']['port'];_0x1ce361[_0xc741('0x27')]=_0x314fc2[_0xc741('0x24')][_0xc741('0x27')];}if(_0x314fc2['Smtp'][_0xc741('0x28')]){_0x1ce361[_0xc741('0x29')]={'user':_0x314fc2[_0xc741('0x24')]['user'],'pass':_0x314fc2[_0xc741('0x24')][_0xc741('0x2a')]};}var _0x308f01={'account':_0x1ce361,'message':_[_0xc741('0x2b')]({'from':util[_0xc741('0x2c')](_0xc741('0x2d'),_0x314fc2[_0xc741('0xd')],_0x314fc2['email']||_0x314fc2['Smtp'][_0xc741('0x13')])},_0x328793)};return client[_0xc741('0x2e')](_0xc741('0x2f'),_0x308f01);})[_0xc741('0x15')](function(_0xf7953e){if(_0xf7953e[_0xc741('0x30')]){throw new Error(util['format'](_0xc741('0x31'),_0xf7953e[_0xc741('0x30')]['message']||JSON[_0xc741('0x32')](_0xf7953e[_0xc741('0x30')])));}return!![];});}function handleError(_0x7321b9,_0x560e85,_0xff5e23){return _0x7321b9[_0xc741('0x33')](_0x560e85||0x1f4)[_0xc741('0x34')]({'message':_0xff5e23?_0xff5e23[_0xc741('0x35')]||_0xff5e23:''});}exports[_0xc741('0x36')]=function(_0x823009,_0x177db8,_0x5e390d){passport[_0xc741('0x37')](_0xc741('0x38'),function(_0x2e9b96,_0x1ae74d,_0x1e4433){var _0x76288a=_0x2e9b96||_0x1e4433;if(_0x76288a){return handleError(_0x177db8,0x191,_0x76288a);}if(!_0x1ae74d){return handleError(_0x177db8,0x194,{'message':_0xc741('0x39')});}else{var _0x207fcc={'payload':{'id':_0x1ae74d['id'],'role':_0x1ae74d['role']},'options':{'expiresIn':0x15180}};return authService[_0xc741('0x3a')](_0x207fcc)[_0xc741('0x15')](function(_0x29bc62){_0x177db8[_0xc741('0x3b')]({'id':_0x1ae74d['id'],'token':_0x29bc62,'statusCall':'','isAlreadyLogged':_0x1ae74d['online']});});}})(_0x823009,_0x177db8,_0x5e390d);};exports[_0xc741('0x3c')]=function(_0x51ba7a,_0x904dd4,_0x2fe60a){if(!_0x51ba7a[_0xc741('0x3d')]['email']){return handleError(_0x904dd4,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x3686b2=rs[_0xc741('0x3e')]();_0x51ba7a[_0xc741('0x3d')][_0xc741('0x21')]=_0x51ba7a[_0xc741('0x3d')][_0xc741('0x21')][_0xc741('0x3f')]()[_0xc741('0x40')]();var _0x149a5e;return db[_0xc741('0xa')][_0xc741('0xc')]({'where':{'id':0x1},'attributes':[_0xc741('0xb'),_0xc741('0x1c')],'raw':!![]})[_0xc741('0x15')](function(_0x339b5f){_0x149a5e=_0x339b5f;return db[_0xc741('0x41')][_0xc741('0x20')]({'where':{'email':_0x51ba7a['body'][_0xc741('0x21')]}});})['then'](function(_0xb425c){if(!_0xb425c){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0xb425c[_0xc741('0x11')]){throw new Error(_0xc741('0x42'));}if(_0xb425c['blocked']){if(moment(_0xb425c[_0xc741('0x19')])[_0xc741('0x1a')](_0x149a5e['blockDuration'],_0xc741('0x43'))>moment()){throw new Error(_0xc741('0x44'));}else{_0xb425c[_0xc741('0x18')]=![];_0xb425c[_0xc741('0x19')]=null;}}_0xb425c[_0xc741('0x45')]=_0x3686b2;_0xb425c[_0xc741('0x46')]=Date[_0xc741('0x47')]()+0x36ee80;return _0xb425c['save']();})[_0xc741('0x15')](function(){return sendServiceMail({'to':_0x51ba7a['body']['email'],'subject':_0xc741('0x48'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xc741('0x49')+_0xc741('0x4a')+_0x51ba7a[_0xc741('0x4b')][_0xc741('0x4c')]+_0xc741('0x4d')+_0x3686b2+'\x0a\x0a'+_0xc741('0x4e')});})[_0xc741('0x15')](function(){_0x904dd4[_0xc741('0x33')](0xc8)[_0xc741('0x34')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x12dde4){return handleError(_0x904dd4,0x1f4,_0x12dde4);});};exports[_0xc741('0x4f')]=function(_0x319198,_0x4414db,_0x4cec0b){return db[_0xc741('0x41')]['find']({'where':{'resetPasswordToken':_0x319198[_0xc741('0x50')][_0xc741('0x51')],'resetPasswordExpires':{'$gt':Date[_0xc741('0x47')]()}}})[_0xc741('0x15')](function(_0x2a390b){if(!_0x2a390b){throw new Error(_0xc741('0x52'));}return db[_0xc741('0xa')][_0xc741('0xc')]({'attributes':['id',_0xc741('0x53'),_0xc741('0x54'),_0xc741('0x55')]})[_0xc741('0x15')](function(_0x510db2){if(_0x510db2[_0xc741('0x53')])authService[_0xc741('0x56')](_0x319198[_0xc741('0x3d')]['password']);if(!_0x510db2[_0xc741('0x54')]||!_0x2a390b[_0xc741('0x57')])return _0x2a390b;authService[_0xc741('0x58')](_0x319198[_0xc741('0x3d')]['password'],_0x2a390b[_0xc741('0x57')],_0x510db2[_0xc741('0x55')]);return _0x2a390b;})[_0xc741('0x15')](function(){_0x2a390b[_0xc741('0xe')]=_0x319198['body'][_0xc741('0xe')];_0x2a390b['resetPasswordToken']=null;_0x2a390b[_0xc741('0x46')]=null;return _0x2a390b[_0xc741('0x59')]();});})[_0xc741('0x15')](function(){_0x4414db[_0xc741('0x33')](0xc8)[_0xc741('0x34')]({'message':_0xc741('0x5a')});})['catch'](function(_0x30a4f6){return handleError(_0x4414db,0x1f4,_0x30a4f6);});};passport['use'](new LocalStrategy({'usernameField':_0xc741('0xd'),'passwordField':_0xc741('0xe')},function(_0x70eaca,_0x1d15f9,_0x168076){return localAuthenticate(db['User'],_0x70eaca,_0x1d15f9,_0x168076);})); \ No newline at end of file +var _0x8f9d=['catch','find','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','port','secure','auth','merge','format','\x22%s\x22\x20<%s>','request','error','stringify','send','message','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','email','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','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','status','Reset\x20Email\x20sent!','reset','params','token','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','validatePasswordHistory','previousPasswords','Password\x20reset!','use','util','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','allowedLoginAttempts','findOne','name','password','salt','role','disabled','blockedAt','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','loginAttempts','add','minutes','clearBlockUser','blocked','blockDuration','getLicense'];(function(_0xe16025,_0x154f45){var _0x213442=function(_0x4c174d){while(--_0x4c174d){_0xe16025['push'](_0xe16025['shift']());}};_0x213442(++_0x154f45);}(_0x8f9d,0x93));var _0xd8f9=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x8f9d[_0xfae23b];return _0x200640;};'use strict';var util=require(_0xd8f9('0x0'));var passport=require('passport');var LocalStrategy=require(_0xd8f9('0x1'))['Strategy'];var jayson=require(_0xd8f9('0x2'));var _=require(_0xd8f9('0x3'));var rs=require(_0xd8f9('0x4'));var moment=require(_0xd8f9('0x5'));var db=require(_0xd8f9('0x6'))['db'];var authService=require(_0xd8f9('0x7'));var utils=require(_0xd8f9('0x8'));var client=jayson['client'][_0xd8f9('0x9')]({'port':0x232b});function localAuthenticate(_0x24dd1e,_0x25d417,_0x241aaa,_0xf6105){var _0x5c410f,_0x46babd;return db[_0xd8f9('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0xd8f9('0xb'),'blockDuration'],'raw':!![]})['then'](function(_0x421aca){_0x5c410f=_0x421aca;return _0x24dd1e[_0xd8f9('0xc')]({'attributes':['id',_0xd8f9('0xd'),_0xd8f9('0xe'),_0xd8f9('0xf'),_0xd8f9('0x10'),_0xd8f9('0x11'),'blocked',_0xd8f9('0x12'),'loginAttempts'],'where':{'name':_0x25d417,'role':{'$or':[_0xd8f9('0x13'),_0xd8f9('0x14'),_0xd8f9('0x15')]}}});})['then'](function(_0x46468b){if(!_0x46468b||_0x46468b&&_0x46468b[_0xd8f9('0xd')]!==_0x25d417){throw new Error(_0xd8f9('0x16'));}else{_0x46babd=_0x46468b;return _0x46babd;}})[_0xd8f9('0x17')](function(){_0x46babd['authenticate'](_0x241aaa,function(_0x3529e9,_0x1525d6){var _0x234901=_0x46babd[_0xd8f9('0x18')]+0x1;if(_0x3529e9){return _0xf6105(_0x3529e9);}else if(!_0x1525d6){if(_0x46babd[_0xd8f9('0x11')]){return _0xf6105(null,![],{'message':_0xd8f9('0x16')});}else if(_0x5c410f[_0xd8f9('0xb')]>0x0){if(_0x46babd['blocked']){if(_0x5c410f['blockDuration']>0x0){if(moment(_0x46babd[_0xd8f9('0x12')])[_0xd8f9('0x19')](_0x5c410f['blockDuration'],_0xd8f9('0x1a'))>moment()){return _0xf6105(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xd8f9('0x1b')](_0x46babd,_0x234901,![],null)['then'](function(){return _0xf6105(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0xf6105(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x234901>=_0x5c410f[_0xd8f9('0xb')]){return utils['clearBlockUser'](_0x46babd,0x0,!![],moment())[_0xd8f9('0x17')](function(){return _0xf6105(null,![],{'message':_0xd8f9('0x16')});});}else{return utils[_0xd8f9('0x1b')](_0x46babd,_0x234901,![],null)[_0xd8f9('0x17')](function(){return _0xf6105(null,![],{'message':_0xd8f9('0x16')});});}}}else{return _0xf6105(null,![],{'message':_0xd8f9('0x16')});}}else{if(_0x46babd['disabled']){return _0xf6105(null,![],{'message':_0xd8f9('0x16')});}else if(_0x5c410f[_0xd8f9('0xb')]>0x0){if(_0x46babd[_0xd8f9('0x1c')]){if(_0x5c410f[_0xd8f9('0x1d')]>0x0){if(moment(_0x46babd[_0xd8f9('0x12')])[_0xd8f9('0x19')](_0x5c410f['blockDuration'],_0xd8f9('0x1a'))>moment()){return _0xf6105(null,![],{'message':_0xd8f9('0x16')});}else{return utils[_0xd8f9('0x1b')](_0x46babd,0x0,![],null)[_0xd8f9('0x17')](function(){return utils[_0xd8f9('0x1e')](_0x46babd);})['then'](function(){return _0xf6105(null,_0x46babd);});}}else{return _0xf6105(null,![],{'message':_0xd8f9('0x16')});}}else{return utils[_0xd8f9('0x1b')](_0x46babd,0x0,![],null)[_0xd8f9('0x17')](function(){return utils[_0xd8f9('0x1e')](_0x46babd);})[_0xd8f9('0x17')](function(){return _0xf6105(null,_0x46babd);})[_0xd8f9('0x1f')](function(_0x175123){return _0xf6105(null,![],_0x175123);});}}else{if(_0x46babd[_0xd8f9('0x1c')]){return _0xf6105(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xd8f9('0x1e')](_0x46babd)[_0xd8f9('0x17')](function(){return _0xf6105(null,_0x46babd);});}}}});})[_0xd8f9('0x1f')](function(_0x58a3ca){return _0xf6105(null,![],_0x58a3ca);});}function sendServiceMail(_0x5bd32e){return db['MailAccount'][_0xd8f9('0x20')]({'where':{'service':!![]},'attributes':['id',_0xd8f9('0xd'),'email'],'include':[{'model':db[_0xd8f9('0x21')],'as':_0xd8f9('0x22')}]})['then'](function(_0x4b0de7){if(!_0x4b0de7){throw new Error(_0xd8f9('0x23'));}var _0x2786db={'tls':{'rejectUnauthorized':![]}};if(_0x4b0de7['Smtp'][_0xd8f9('0x24')]){_0x2786db['service']=_0x4b0de7[_0xd8f9('0x22')][_0xd8f9('0x24')];}else{_0x2786db['host']=_0x4b0de7[_0xd8f9('0x22')]['host'];_0x2786db[_0xd8f9('0x25')]=_0x4b0de7[_0xd8f9('0x22')][_0xd8f9('0x25')];_0x2786db[_0xd8f9('0x26')]=_0x4b0de7[_0xd8f9('0x22')][_0xd8f9('0x26')];}if(_0x4b0de7[_0xd8f9('0x22')]['authentication']){_0x2786db[_0xd8f9('0x27')]={'user':_0x4b0de7['Smtp']['user'],'pass':_0x4b0de7['Smtp']['pass']};}var _0x3690d7={'account':_0x2786db,'message':_[_0xd8f9('0x28')]({'from':util[_0xd8f9('0x29')](_0xd8f9('0x2a'),_0x4b0de7[_0xd8f9('0xd')],_0x4b0de7['email']||_0x4b0de7['Smtp'][_0xd8f9('0x14')])},_0x5bd32e)};return client[_0xd8f9('0x2b')]('SendMail',_0x3690d7);})[_0xd8f9('0x17')](function(_0x204ead){if(_0x204ead[_0xd8f9('0x2c')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x204ead['error']['message']||JSON[_0xd8f9('0x2d')](_0x204ead[_0xd8f9('0x2c')])));}return!![];});}function handleError(_0x324541,_0x219c5f,_0x1d41e2){return _0x324541['status'](_0x219c5f||0x1f4)[_0xd8f9('0x2e')]({'message':_0x1d41e2?_0x1d41e2[_0xd8f9('0x2f')]||_0x1d41e2:''});}exports[_0xd8f9('0x30')]=function(_0xb9ba18,_0x2758e8,_0x16e1f8){passport[_0xd8f9('0x31')](_0xd8f9('0x32'),function(_0x36aa04,_0x1953af,_0x2a94d6){var _0x5d16b8=_0x36aa04||_0x2a94d6;if(_0x5d16b8){return handleError(_0x2758e8,0x191,_0x5d16b8);}if(!_0x1953af){return handleError(_0x2758e8,0x194,{'message':_0xd8f9('0x33')});}else{var _0x3cfd69={'payload':{'id':_0x1953af['id'],'role':_0x1953af[_0xd8f9('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0xd8f9('0x34')](_0x3cfd69)['then'](function(_0x157dfd){_0x2758e8[_0xd8f9('0x35')]({'id':_0x1953af['id'],'token':_0x157dfd,'statusCall':'','isAlreadyLogged':_0x1953af[_0xd8f9('0x36')]});});}})(_0xb9ba18,_0x2758e8,_0x16e1f8);};exports[_0xd8f9('0x37')]=function(_0x1ab301,_0x23330a,_0x597357){if(!_0x1ab301['body']['email']){return handleError(_0x23330a,0x1f4,{'message':_0xd8f9('0x38')});}var _0x293179=rs[_0xd8f9('0x39')]();_0x1ab301[_0xd8f9('0x3a')][_0xd8f9('0x3b')]=_0x1ab301[_0xd8f9('0x3a')][_0xd8f9('0x3b')][_0xd8f9('0x3c')]()[_0xd8f9('0x3d')]();var _0x5ed1b7;return db['Setting'][_0xd8f9('0xc')]({'where':{'id':0x1},'attributes':[_0xd8f9('0xb'),_0xd8f9('0x1d')],'raw':!![]})['then'](function(_0x5ad80d){_0x5ed1b7=_0x5ad80d;return db[_0xd8f9('0x3e')][_0xd8f9('0x20')]({'where':{'email':_0x1ab301[_0xd8f9('0x3a')]['email']}});})[_0xd8f9('0x17')](function(_0x388188){if(!_0x388188){throw new Error(_0xd8f9('0x3f'));}if(_0x388188[_0xd8f9('0x11')]){throw new Error(_0xd8f9('0x40'));}if(_0x388188[_0xd8f9('0x1c')]){if(moment(_0x388188[_0xd8f9('0x12')])[_0xd8f9('0x19')](_0x5ed1b7[_0xd8f9('0x1d')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x388188['blocked']=![];_0x388188[_0xd8f9('0x12')]=null;}}_0x388188[_0xd8f9('0x41')]=_0x293179;_0x388188[_0xd8f9('0x42')]=Date[_0xd8f9('0x43')]()+0x36ee80;return _0x388188[_0xd8f9('0x44')]();})[_0xd8f9('0x17')](function(){return sendServiceMail({'to':_0x1ab301[_0xd8f9('0x3a')][_0xd8f9('0x3b')],'subject':_0xd8f9('0x45'),'text':_0xd8f9('0x46')+_0xd8f9('0x47')+_0xd8f9('0x48')+_0x1ab301[_0xd8f9('0x49')]['host']+_0xd8f9('0x4a')+_0x293179+'\x0a\x0a'+_0xd8f9('0x4b')});})[_0xd8f9('0x17')](function(){_0x23330a[_0xd8f9('0x4c')](0xc8)['send']({'message':_0xd8f9('0x4d')});})['catch'](function(_0x59952e){return handleError(_0x23330a,0x1f4,_0x59952e);});};exports[_0xd8f9('0x4e')]=function(_0x14e622,_0x1614aa,_0x1361c4){return db[_0xd8f9('0x3e')][_0xd8f9('0x20')]({'where':{'resetPasswordToken':_0x14e622[_0xd8f9('0x4f')][_0xd8f9('0x50')],'resetPasswordExpires':{'$gt':Date[_0xd8f9('0x43')]()}}})[_0xd8f9('0x17')](function(_0x54b5d4){if(!_0x54b5d4){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0xd8f9('0xc')]({'attributes':['id',_0xd8f9('0x51'),'enforcePasswordHistory',_0xd8f9('0x52')]})[_0xd8f9('0x17')](function(_0x1101ce){if(_0x1101ce[_0xd8f9('0x51')])authService[_0xd8f9('0x53')](_0x14e622[_0xd8f9('0x3a')][_0xd8f9('0xe')]);if(!_0x1101ce[_0xd8f9('0x54')]||!_0x54b5d4['previousPasswords'])return _0x54b5d4;authService[_0xd8f9('0x55')](_0x14e622[_0xd8f9('0x3a')][_0xd8f9('0xe')],_0x54b5d4[_0xd8f9('0x56')],_0x1101ce[_0xd8f9('0x52')]);return _0x54b5d4;})[_0xd8f9('0x17')](function(){_0x54b5d4[_0xd8f9('0xe')]=_0x14e622[_0xd8f9('0x3a')][_0xd8f9('0xe')];_0x54b5d4[_0xd8f9('0x41')]=null;_0x54b5d4[_0xd8f9('0x42')]=null;return _0x54b5d4['save']();});})[_0xd8f9('0x17')](function(){_0x1614aa[_0xd8f9('0x4c')](0xc8)[_0xd8f9('0x2e')]({'message':_0xd8f9('0x57')});})['catch'](function(_0x2de50d){return handleError(_0x1614aa,0x1f4,_0x2de50d);});};passport[_0xd8f9('0x58')](new LocalStrategy({'usernameField':_0xd8f9('0xd'),'passwordField':'password'},function(_0x101bd3,_0x195a46,_0x2218da){return localAuthenticate(db[_0xd8f9('0x3e')],_0x101bd3,_0x195a46,_0x2218da);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 70d398c..9f24e6e 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 _0xefdf=['forgot','/reset/:token','reset','exports','express','./authLocal.controller','post','/forgot'];(function(_0x252fb8,_0x1dcf7c){var _0x1f0c15=function(_0x1d2f06){while(--_0x1d2f06){_0x252fb8['push'](_0x252fb8['shift']());}};_0x1f0c15(++_0x1dcf7c);}(_0xefdf,0x15c));var _0xfefd=function(_0x2545d0,_0x397e79){_0x2545d0=_0x2545d0-0x0;var _0x10111b=_0xefdf[_0x2545d0];return _0x10111b;};'use strict';var express=require(_0xfefd('0x0'));var router=express['Router']();var controller=require(_0xfefd('0x1'));router[_0xfefd('0x2')]('/',controller['login']);router[_0xfefd('0x2')](_0xfefd('0x3'),controller[_0xfefd('0x4')]);router[_0xfefd('0x2')](_0xfefd('0x5'),controller[_0xfefd('0x6')]);module[_0xfefd('0x7')]=router; \ No newline at end of file +var _0x5c27=['exports','express','Router','./authLocal.controller','post','login','forgot','/reset/:token','reset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c27,0x13c));var _0x75c2=function(_0x58c239,_0x1788bc){_0x58c239=_0x58c239-0x0;var _0x1cd7cb=_0x5c27[_0x58c239];return _0x1cd7cb;};'use strict';var express=require(_0x75c2('0x0'));var router=express[_0x75c2('0x1')]();var controller=require(_0x75c2('0x2'));router[_0x75c2('0x3')]('/',controller[_0x75c2('0x4')]);router[_0x75c2('0x3')]('/forgot',controller[_0x75c2('0x5')]);router[_0x75c2('0x3')](_0x75c2('0x6'),controller[_0x75c2('0x7')]);module[_0x75c2('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 43e298e..70b44e5 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 _0x9cd1=['sequelize','STRING','BOOLEAN','INTEGER'];(function(_0xb95586,_0x47fe9f){var _0x29a9d2=function(_0x12f8dc){while(--_0x12f8dc){_0xb95586['push'](_0xb95586['shift']());}};_0x29a9d2(++_0x47fe9f);}(_0x9cd1,0xac));var _0x19cd=function(_0x5ab1ec,_0x33e892){_0x5ab1ec=_0x5ab1ec-0x0;var _0xf1a432=_0x9cd1[_0x5ab1ec];return _0xf1a432;};'use strict';var Sequelize=require(_0x19cd('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x19cd('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x19cd('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x19cd('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x91d5=['STRING'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x91d5,0x16d));var _0x591d=function(_0x200941,_0x3234d9){_0x200941=_0x200941-0x0;var _0x391186=_0x91d5[_0x200941];return _0x391186;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x591d('0x0')],'allowNull':![]},'channel':{'type':Sequelize[_0x591d('0x0')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'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 f265d1e..fd6199a 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 _0x0fbf=['sort','where','pick','merge','type','VIRTUAL','name','filter','options','includeAll','findAll','rows','show','include','find','catch','create','body','params','addConditions','Condition','ids','omit','getConditions','findOne','addActions','Action','getActions','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','send','index','map','Automation','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0x46c443,_0xf4a763){var _0x87a3bb=function(_0x247643){while(--_0x247643){_0x46c443['push'](_0x46c443['shift']());}};_0x87a3bb(++_0xf4a763);}(_0x0fbf,0xc6));var _0xf0fb=function(_0x507c4e,_0x2bef11){_0x507c4e=_0x507c4e-0x0;var _0x99651d=_0x0fbf[_0x507c4e];return _0x99651d;};'use strict';var emlformat=require(_0xf0fb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf0fb('0x1'));var rp=require(_0xf0fb('0x2'));var moment=require(_0xf0fb('0x3'));var BPromise=require(_0xf0fb('0x4'));var Mustache=require('mustache');var util=require(_0xf0fb('0x5'));var path=require('path');var sox=require(_0xf0fb('0x6'));var csv=require(_0xf0fb('0x7'));var ejs=require(_0xf0fb('0x8'));var fs=require('fs');var fs_extra=require(_0xf0fb('0x9'));var _=require(_0xf0fb('0xa'));var squel=require('squel');var crypto=require(_0xf0fb('0xb'));var jsforce=require(_0xf0fb('0xc'));var deskjs=require(_0xf0fb('0xd'));var toCsv=require(_0xf0fb('0x7'));var querystring=require(_0xf0fb('0xe'));var Papa=require(_0xf0fb('0xf'));var Redis=require('ioredis');var authService=require(_0xf0fb('0x10'));var qs=require(_0xf0fb('0x11'));var as=require(_0xf0fb('0x12'));var hardwareService=require(_0xf0fb('0x13'));var logger=require('../../config/logger')(_0xf0fb('0x14'));var utils=require(_0xf0fb('0x15'));var config=require(_0xf0fb('0x16'));var licenseUtil=require(_0xf0fb('0x17'));var db=require(_0xf0fb('0x18'))['db'];function respondWithStatusCode(_0x2ffc43,_0x11170b){_0x11170b=_0x11170b||0xcc;return function(_0x2ab9c3){if(_0x2ab9c3){return _0x2ffc43[_0xf0fb('0x19')](_0x11170b);}return _0x2ffc43[_0xf0fb('0x1a')](_0x11170b)['end']();};}function respondWithResult(_0x9cd09c,_0x37e3cb){_0x37e3cb=_0x37e3cb||0xc8;return function(_0x36fcaf){if(_0x36fcaf){return _0x9cd09c[_0xf0fb('0x1a')](_0x37e3cb)['json'](_0x36fcaf);}};}function respondWithFilteredResult(_0x2cb89b,_0x44d61c){return function(_0x21cb6e){if(_0x21cb6e){var _0x2eae34=_0x21cb6e[_0xf0fb('0x1b')],_0x2c218a=_0x44d61c['offset'],_0x325cd1=_0x44d61c[_0xf0fb('0x1c')]+_0x44d61c['limit'],_0x21139f;if(_0x325cd1>=_0x2eae34){_0x325cd1=_0x2eae34;_0x21139f=0xc8;}else{_0x21139f=0xce;}_0x2cb89b[_0xf0fb('0x1a')](_0x21139f);return _0x2cb89b[_0xf0fb('0x1d')](_0xf0fb('0x1e'),_0x2c218a+'-'+_0x325cd1+'/'+_0x2eae34)[_0xf0fb('0x1f')](_0x21cb6e);}return null;};}function patchUpdates(_0x1d4b61){return function(_0x171f99){try{jsonpatch[_0xf0fb('0x20')](_0x171f99,_0x1d4b61,!![]);}catch(_0xab592f){return BPromise[_0xf0fb('0x21')](_0xab592f);}return _0x171f99['save']();};}function saveUpdates(_0x4773c7,_0x3509b3){return function(_0x49f0c4){if(_0x49f0c4){return _0x49f0c4[_0xf0fb('0x22')](_0x4773c7)[_0xf0fb('0x23')](function(_0x2d4349){return _0x2d4349;});}return null;};}function removeEntity(_0x255a48,_0x2d4723){return function(_0x39511c){if(_0x39511c){return _0x39511c[_0xf0fb('0x24')]()[_0xf0fb('0x23')](function(){_0x255a48['status'](0xcc)[_0xf0fb('0x25')]();});}};}function handleEntityNotFound(_0x455c23,_0x37dcf9){return function(_0x53e618){if(!_0x53e618){_0x455c23[_0xf0fb('0x19')](0x194);}return _0x53e618;};}function handleError(_0x414821,_0x1e7e30){_0x1e7e30=_0x1e7e30||0x1f4;return function(_0x43d0e1){logger[_0xf0fb('0x26')](_0x43d0e1[_0xf0fb('0x27')]);if(_0x43d0e1['name']){delete _0x43d0e1['name'];}_0x414821[_0xf0fb('0x1a')](_0x1e7e30)[_0xf0fb('0x28')](_0x43d0e1);};}exports[_0xf0fb('0x29')]=function(_0x22ec6b,_0x3d3bca){var _0x83b144={},_0x54487d={},_0x4b5580={'count':0x0,'rows':[]};var _0x37268a=_[_0xf0fb('0x2a')](db[_0xf0fb('0x2b')][_0xf0fb('0x2c')],function(_0x4332a9){return{'name':_0x4332a9['fieldName'],'type':_0x4332a9['type']['key']};});_0x54487d[_0xf0fb('0x2d')]=_[_0xf0fb('0x2a')](_0x37268a,'name');_0x54487d[_0xf0fb('0x2e')]=_[_0xf0fb('0x2f')](_0x22ec6b[_0xf0fb('0x2e')]);_0x54487d[_0xf0fb('0x30')]=_[_0xf0fb('0x31')](_0x54487d[_0xf0fb('0x2d')],_0x54487d[_0xf0fb('0x2e')]);_0x83b144[_0xf0fb('0x32')]=_[_0xf0fb('0x31')](_0x54487d[_0xf0fb('0x2d')],qs[_0xf0fb('0x33')](_0x22ec6b[_0xf0fb('0x2e')][_0xf0fb('0x33')]));_0x83b144[_0xf0fb('0x32')]=_0x83b144['attributes'][_0xf0fb('0x34')]?_0x83b144[_0xf0fb('0x32')]:_0x54487d[_0xf0fb('0x2d')];if(!_0x22ec6b[_0xf0fb('0x2e')][_0xf0fb('0x35')](_0xf0fb('0x36'))){_0x83b144[_0xf0fb('0x37')]=qs[_0xf0fb('0x37')](_0x22ec6b[_0xf0fb('0x2e')][_0xf0fb('0x37')]);_0x83b144[_0xf0fb('0x1c')]=qs['offset'](_0x22ec6b[_0xf0fb('0x2e')][_0xf0fb('0x1c')]);}_0x83b144[_0xf0fb('0x38')]=qs[_0xf0fb('0x39')](_0x22ec6b[_0xf0fb('0x2e')]['sort']);_0x83b144[_0xf0fb('0x3a')]=qs[_0xf0fb('0x30')](_[_0xf0fb('0x3b')](_0x22ec6b['query'],_0x54487d['filters']),_0x37268a);if(_0x22ec6b[_0xf0fb('0x2e')]['filter']){_0x83b144[_0xf0fb('0x3a')]=_[_0xf0fb('0x3c')](_0x83b144[_0xf0fb('0x3a')],{'$or':_[_0xf0fb('0x2a')](_0x37268a,function(_0x1498ae){if(_0x1498ae[_0xf0fb('0x3d')]!==_0xf0fb('0x3e')){var _0x3c4845={};_0x3c4845[_0x1498ae[_0xf0fb('0x3f')]]={'$like':'%'+_0x22ec6b[_0xf0fb('0x2e')][_0xf0fb('0x40')]+'%'};return _0x3c4845;}})});}_0x83b144=_['merge']({},_0x83b144,_0x22ec6b[_0xf0fb('0x41')]);var _0x53edb2={'where':_0x83b144[_0xf0fb('0x3a')]};return db[_0xf0fb('0x2b')][_0xf0fb('0x1b')](_0x53edb2)[_0xf0fb('0x23')](function(_0x408ec1){_0x4b5580[_0xf0fb('0x1b')]=_0x408ec1;if(_0x22ec6b['query'][_0xf0fb('0x42')]){_0x83b144['include']=[{'all':!![]}];}return db['Automation'][_0xf0fb('0x43')](_0x83b144);})['then'](function(_0x496fa3){_0x4b5580[_0xf0fb('0x44')]=_0x496fa3;return _0x4b5580;})[_0xf0fb('0x23')](respondWithFilteredResult(_0x3d3bca,_0x83b144))['catch'](handleError(_0x3d3bca,null));};exports[_0xf0fb('0x45')]=function(_0x29ec5c,_0x2ee941){var _0x296abf={'raw':![],'where':{'id':_0x29ec5c['params']['id']}},_0x259e3a={};_0x259e3a[_0xf0fb('0x2d')]=_[_0xf0fb('0x2f')](db['Automation']['rawAttributes']);_0x259e3a['query']=_[_0xf0fb('0x2f')](_0x29ec5c[_0xf0fb('0x2e')]);_0x259e3a[_0xf0fb('0x30')]=_[_0xf0fb('0x31')](_0x259e3a['model'],_0x259e3a['query']);_0x296abf['attributes']=_['intersection'](_0x259e3a[_0xf0fb('0x2d')],qs[_0xf0fb('0x33')](_0x29ec5c[_0xf0fb('0x2e')][_0xf0fb('0x33')]));_0x296abf[_0xf0fb('0x32')]=_0x296abf['attributes'][_0xf0fb('0x34')]?_0x296abf[_0xf0fb('0x32')]:_0x259e3a[_0xf0fb('0x2d')];if(_0x29ec5c[_0xf0fb('0x2e')][_0xf0fb('0x42')]){_0x296abf[_0xf0fb('0x46')]=[{'all':!![]}];}_0x296abf=_['merge']({},_0x296abf,_0x29ec5c[_0xf0fb('0x41')]);return db[_0xf0fb('0x2b')][_0xf0fb('0x47')](_0x296abf)[_0xf0fb('0x23')](handleEntityNotFound(_0x2ee941,null))[_0xf0fb('0x23')](respondWithResult(_0x2ee941,null))[_0xf0fb('0x48')](handleError(_0x2ee941,null));};exports[_0xf0fb('0x49')]=function(_0x24f265,_0x5069b2){return db[_0xf0fb('0x2b')][_0xf0fb('0x49')](_0x24f265['body'],{})[_0xf0fb('0x23')](respondWithResult(_0x5069b2,0xc9))[_0xf0fb('0x48')](handleError(_0x5069b2,null));};exports[_0xf0fb('0x22')]=function(_0x301754,_0x4dee33){if(_0x301754[_0xf0fb('0x4a')]['id']){delete _0x301754[_0xf0fb('0x4a')]['id'];}return db['Automation'][_0xf0fb('0x47')]({'where':{'id':_0x301754[_0xf0fb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4dee33,null))[_0xf0fb('0x23')](saveUpdates(_0x301754[_0xf0fb('0x4a')],null))['then'](respondWithResult(_0x4dee33,null))['catch'](handleError(_0x4dee33,null));};exports[_0xf0fb('0x24')]=function(_0x4f9f81,_0x1338f2){return db[_0xf0fb('0x2b')]['find']({'where':{'id':_0x4f9f81[_0xf0fb('0x4b')]['id']}})[_0xf0fb('0x23')](handleEntityNotFound(_0x1338f2,null))['then'](removeEntity(_0x1338f2,null))['catch'](handleError(_0x1338f2,null));};exports[_0xf0fb('0x4c')]=function(_0x23ea24,_0x50c271,_0x5c397b){return db[_0xf0fb('0x4d')][_0xf0fb('0x47')]({'where':{'id':_0x23ea24[_0xf0fb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x50c271,null))['then'](function(_0x16b289){if(_0x16b289){return _0x16b289['addConditions'](_0x23ea24[_0xf0fb('0x4a')][_0xf0fb('0x4e')],_[_0xf0fb('0x4f')](_0x23ea24[_0xf0fb('0x4a')],['ids','id'])||{});}})[_0xf0fb('0x23')](respondWithResult(_0x50c271,null))[_0xf0fb('0x48')](handleError(_0x50c271,null));};exports[_0xf0fb('0x50')]=function(_0x2f3756,_0x13eda9,_0x47ca31){var _0x3917c4={};var _0x22f02a={};var _0x4d3b4b;var _0x614d15;return db[_0xf0fb('0x2b')][_0xf0fb('0x51')]({'where':{'id':_0x2f3756[_0xf0fb('0x4b')]['id']}})[_0xf0fb('0x23')](handleEntityNotFound(_0x13eda9,null))['then'](function(_0x8e5954){if(_0x8e5954){_0x4d3b4b=_0x8e5954;_0x22f02a[_0xf0fb('0x2d')]=_[_0xf0fb('0x2f')](db['Condition'][_0xf0fb('0x2c')]);_0x22f02a['query']=_[_0xf0fb('0x2f')](_0x2f3756[_0xf0fb('0x2e')]);_0x22f02a[_0xf0fb('0x30')]=_['intersection'](_0x22f02a[_0xf0fb('0x2d')],_0x22f02a['query']);_0x3917c4[_0xf0fb('0x32')]=_['intersection'](_0x22f02a[_0xf0fb('0x2d')],qs['fields'](_0x2f3756[_0xf0fb('0x2e')][_0xf0fb('0x33')]));_0x3917c4[_0xf0fb('0x32')]=_0x3917c4['attributes'][_0xf0fb('0x34')]?_0x3917c4['attributes']:_0x22f02a[_0xf0fb('0x2d')];_0x3917c4['order']=qs[_0xf0fb('0x39')](_0x2f3756[_0xf0fb('0x2e')][_0xf0fb('0x39')]);_0x3917c4[_0xf0fb('0x3a')]=qs['filters'](_[_0xf0fb('0x3b')](_0x2f3756[_0xf0fb('0x2e')],_0x22f02a['filters']));if(_0x2f3756['query'][_0xf0fb('0x40')]){_0x3917c4[_0xf0fb('0x3a')]=_[_0xf0fb('0x3c')](_0x3917c4[_0xf0fb('0x3a')],{'$or':_[_0xf0fb('0x2a')](_0x3917c4['attributes'],function(_0x46518a){var _0x53ac8e={};_0x53ac8e[_0x46518a]={'$like':'%'+_0x2f3756[_0xf0fb('0x2e')][_0xf0fb('0x40')]+'%'};return _0x53ac8e;})});}_0x3917c4=_['merge']({},_0x3917c4,_0x2f3756[_0xf0fb('0x41')]);return _0x4d3b4b[_0xf0fb('0x50')](_0x3917c4);}})[_0xf0fb('0x23')](function(_0x380396){if(_0x380396){_0x614d15=_0x380396['length'];if(!_0x2f3756[_0xf0fb('0x2e')][_0xf0fb('0x35')]('nolimit')){_0x3917c4[_0xf0fb('0x37')]=qs[_0xf0fb('0x37')](_0x2f3756[_0xf0fb('0x2e')][_0xf0fb('0x37')]);_0x3917c4[_0xf0fb('0x1c')]=qs[_0xf0fb('0x1c')](_0x2f3756[_0xf0fb('0x2e')][_0xf0fb('0x1c')]);}return _0x4d3b4b[_0xf0fb('0x50')](_0x3917c4);}})[_0xf0fb('0x23')](function(_0x2c8638){if(_0x2c8638){return _0x2c8638?{'count':_0x614d15,'rows':_0x2c8638}:null;}})['then'](respondWithResult(_0x13eda9,null))[_0xf0fb('0x48')](handleError(_0x13eda9,null));};exports[_0xf0fb('0x52')]=function(_0x3aaf90,_0x5cf282,_0x45aea0){return db[_0xf0fb('0x53')]['find']({'where':{'id':_0x3aaf90[_0xf0fb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5cf282,null))[_0xf0fb('0x23')](function(_0x2a58a6){if(_0x2a58a6){return _0x2a58a6[_0xf0fb('0x52')](_0x3aaf90[_0xf0fb('0x4a')][_0xf0fb('0x4e')],_[_0xf0fb('0x4f')](_0x3aaf90['body'],['ids','id'])||{});}})[_0xf0fb('0x23')](respondWithResult(_0x5cf282,null))[_0xf0fb('0x48')](handleError(_0x5cf282,null));};exports['getActions']=function(_0xb0ba6f,_0xac698,_0x254ee1){var _0xeef54a={};var _0x206575={};var _0x90c5c3;var _0x373813;return db['Automation']['findOne']({'where':{'id':_0xb0ba6f['params']['id']}})[_0xf0fb('0x23')](handleEntityNotFound(_0xac698,null))[_0xf0fb('0x23')](function(_0xa79280){if(_0xa79280){_0x90c5c3=_0xa79280;_0x206575[_0xf0fb('0x2d')]=_[_0xf0fb('0x2f')](db[_0xf0fb('0x53')]['rawAttributes']);_0x206575['query']=_[_0xf0fb('0x2f')](_0xb0ba6f[_0xf0fb('0x2e')]);_0x206575['filters']=_[_0xf0fb('0x31')](_0x206575[_0xf0fb('0x2d')],_0x206575[_0xf0fb('0x2e')]);_0xeef54a[_0xf0fb('0x32')]=_[_0xf0fb('0x31')](_0x206575[_0xf0fb('0x2d')],qs[_0xf0fb('0x33')](_0xb0ba6f[_0xf0fb('0x2e')][_0xf0fb('0x33')]));_0xeef54a[_0xf0fb('0x32')]=_0xeef54a[_0xf0fb('0x32')][_0xf0fb('0x34')]?_0xeef54a[_0xf0fb('0x32')]:_0x206575['model'];_0xeef54a[_0xf0fb('0x38')]=qs[_0xf0fb('0x39')](_0xb0ba6f[_0xf0fb('0x2e')]['sort']);_0xeef54a['where']=qs[_0xf0fb('0x30')](_[_0xf0fb('0x3b')](_0xb0ba6f['query'],_0x206575['filters']));if(_0xb0ba6f[_0xf0fb('0x2e')][_0xf0fb('0x40')]){_0xeef54a[_0xf0fb('0x3a')]=_['merge'](_0xeef54a[_0xf0fb('0x3a')],{'$or':_['map'](_0xeef54a[_0xf0fb('0x32')],function(_0xb81c75){var _0x3708af={};_0x3708af[_0xb81c75]={'$like':'%'+_0xb0ba6f[_0xf0fb('0x2e')]['filter']+'%'};return _0x3708af;})});}_0xeef54a=_['merge']({},_0xeef54a,_0xb0ba6f[_0xf0fb('0x41')]);return _0x90c5c3[_0xf0fb('0x54')](_0xeef54a);}})[_0xf0fb('0x23')](function(_0x51d662){if(_0x51d662){_0x373813=_0x51d662[_0xf0fb('0x34')];if(!_0xb0ba6f['query'][_0xf0fb('0x35')](_0xf0fb('0x36'))){_0xeef54a[_0xf0fb('0x37')]=qs[_0xf0fb('0x37')](_0xb0ba6f[_0xf0fb('0x2e')][_0xf0fb('0x37')]);_0xeef54a[_0xf0fb('0x1c')]=qs['offset'](_0xb0ba6f['query'][_0xf0fb('0x1c')]);}return _0x90c5c3[_0xf0fb('0x54')](_0xeef54a);}})[_0xf0fb('0x23')](function(_0x17a42d){if(_0x17a42d){return _0x17a42d?{'count':_0x373813,'rows':_0x17a42d}:null;}})[_0xf0fb('0x23')](respondWithResult(_0xac698,null))[_0xf0fb('0x48')](handleError(_0xac698,null));}; \ No newline at end of file +var _0xe8bc=['index','Automation','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','body','addConditions','Condition','omit','ids','getConditions','hasOwnProperty','addActions','Action','getActions','findOne','eml-format','zip-dir','moment','bluebird','mustache','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/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0xe8bc,0xc8));var _0xce8b=function(_0x399130,_0x5cb872){_0x399130=_0x399130-0x0;var _0x5dd1e7=_0xe8bc[_0x399130];return _0x5dd1e7;};'use strict';var emlformat=require(_0xce8b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce8b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xce8b('0x2'));var BPromise=require(_0xce8b('0x3'));var Mustache=require(_0xce8b('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xce8b('0x5'));var _=require(_0xce8b('0x6'));var squel=require(_0xce8b('0x7'));var crypto=require(_0xce8b('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xce8b('0x9'));var toCsv=require(_0xce8b('0xa'));var querystring=require(_0xce8b('0xb'));var Papa=require(_0xce8b('0xc'));var Redis=require(_0xce8b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xce8b('0xe'));var as=require(_0xce8b('0xf'));var hardwareService=require(_0xce8b('0x10'));var logger=require(_0xce8b('0x11'))(_0xce8b('0x12'));var utils=require(_0xce8b('0x13'));var config=require(_0xce8b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xce8b('0x15'))['db'];function respondWithStatusCode(_0xdcb985,_0x537159){_0x537159=_0x537159||0xcc;return function(_0x1b9e85){if(_0x1b9e85){return _0xdcb985[_0xce8b('0x16')](_0x537159);}return _0xdcb985[_0xce8b('0x17')](_0x537159)[_0xce8b('0x18')]();};}function respondWithResult(_0xbe4adf,_0x19e65f){_0x19e65f=_0x19e65f||0xc8;return function(_0x14039f){if(_0x14039f){return _0xbe4adf['status'](_0x19e65f)[_0xce8b('0x19')](_0x14039f);}};}function respondWithFilteredResult(_0xd9a8b2,_0x463f0e){return function(_0xdec3e9){if(_0xdec3e9){var _0x3ece01=_0xdec3e9[_0xce8b('0x1a')],_0x5538d9=_0x463f0e[_0xce8b('0x1b')],_0x248196=_0x463f0e[_0xce8b('0x1b')]+_0x463f0e[_0xce8b('0x1c')],_0xd4486c;if(_0x248196>=_0x3ece01){_0x248196=_0x3ece01;_0xd4486c=0xc8;}else{_0xd4486c=0xce;}_0xd9a8b2[_0xce8b('0x17')](_0xd4486c);return _0xd9a8b2[_0xce8b('0x1d')](_0xce8b('0x1e'),_0x5538d9+'-'+_0x248196+'/'+_0x3ece01)[_0xce8b('0x19')](_0xdec3e9);}return null;};}function patchUpdates(_0x191fc0){return function(_0xbfbf9d){try{jsonpatch[_0xce8b('0x1f')](_0xbfbf9d,_0x191fc0,!![]);}catch(_0x141de6){return BPromise[_0xce8b('0x20')](_0x141de6);}return _0xbfbf9d[_0xce8b('0x21')]();};}function saveUpdates(_0x46cd3d,_0x319673){return function(_0x599cfd){if(_0x599cfd){return _0x599cfd[_0xce8b('0x22')](_0x46cd3d)[_0xce8b('0x23')](function(_0xeb6356){return _0xeb6356;});}return null;};}function removeEntity(_0x13ad88,_0x444c50){return function(_0x3b3af2){if(_0x3b3af2){return _0x3b3af2[_0xce8b('0x24')]()[_0xce8b('0x23')](function(){_0x13ad88[_0xce8b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x597256,_0x58da48){return function(_0x889602){if(!_0x889602){_0x597256[_0xce8b('0x16')](0x194);}return _0x889602;};}function handleError(_0x29b148,_0x4aaa9d){_0x4aaa9d=_0x4aaa9d||0x1f4;return function(_0x187fa0){logger[_0xce8b('0x25')](_0x187fa0['stack']);if(_0x187fa0[_0xce8b('0x26')]){delete _0x187fa0[_0xce8b('0x26')];}_0x29b148[_0xce8b('0x17')](_0x4aaa9d)[_0xce8b('0x27')](_0x187fa0);};}exports[_0xce8b('0x28')]=function(_0x5c31ed,_0x3f140b){var _0xaf513={},_0x2e7d4b={},_0x1ceac5={'count':0x0,'rows':[]};var _0x5d7570=_['map'](db[_0xce8b('0x29')][_0xce8b('0x2a')],function(_0x48f30e){return{'name':_0x48f30e[_0xce8b('0x2b')],'type':_0x48f30e[_0xce8b('0x2c')]['key']};});_0x2e7d4b[_0xce8b('0x2d')]=_[_0xce8b('0x2e')](_0x5d7570,'name');_0x2e7d4b[_0xce8b('0x2f')]=_[_0xce8b('0x30')](_0x5c31ed[_0xce8b('0x2f')]);_0x2e7d4b[_0xce8b('0x31')]=_['intersection'](_0x2e7d4b[_0xce8b('0x2d')],_0x2e7d4b[_0xce8b('0x2f')]);_0xaf513['attributes']=_[_0xce8b('0x32')](_0x2e7d4b[_0xce8b('0x2d')],qs[_0xce8b('0x33')](_0x5c31ed['query'][_0xce8b('0x33')]));_0xaf513[_0xce8b('0x34')]=_0xaf513[_0xce8b('0x34')][_0xce8b('0x35')]?_0xaf513[_0xce8b('0x34')]:_0x2e7d4b[_0xce8b('0x2d')];if(!_0x5c31ed['query']['hasOwnProperty'](_0xce8b('0x36'))){_0xaf513[_0xce8b('0x1c')]=qs[_0xce8b('0x1c')](_0x5c31ed['query'][_0xce8b('0x1c')]);_0xaf513['offset']=qs['offset'](_0x5c31ed[_0xce8b('0x2f')][_0xce8b('0x1b')]);}_0xaf513[_0xce8b('0x37')]=qs[_0xce8b('0x38')](_0x5c31ed[_0xce8b('0x2f')][_0xce8b('0x38')]);_0xaf513[_0xce8b('0x39')]=qs[_0xce8b('0x31')](_['pick'](_0x5c31ed[_0xce8b('0x2f')],_0x2e7d4b[_0xce8b('0x31')]),_0x5d7570);if(_0x5c31ed[_0xce8b('0x2f')]['filter']){_0xaf513[_0xce8b('0x39')]=_[_0xce8b('0x3a')](_0xaf513[_0xce8b('0x39')],{'$or':_['map'](_0x5d7570,function(_0x27272f){if(_0x27272f[_0xce8b('0x2c')]!==_0xce8b('0x3b')){var _0x2b1654={};_0x2b1654[_0x27272f[_0xce8b('0x26')]]={'$like':'%'+_0x5c31ed[_0xce8b('0x2f')][_0xce8b('0x3c')]+'%'};return _0x2b1654;}})});}_0xaf513=_[_0xce8b('0x3a')]({},_0xaf513,_0x5c31ed[_0xce8b('0x3d')]);var _0xd85b59={'where':_0xaf513[_0xce8b('0x39')]};return db[_0xce8b('0x29')][_0xce8b('0x1a')](_0xd85b59)['then'](function(_0x3131e9){_0x1ceac5[_0xce8b('0x1a')]=_0x3131e9;if(_0x5c31ed[_0xce8b('0x2f')][_0xce8b('0x3e')]){_0xaf513[_0xce8b('0x3f')]=[{'all':!![]}];}return db[_0xce8b('0x29')]['findAll'](_0xaf513);})[_0xce8b('0x23')](function(_0x350501){_0x1ceac5[_0xce8b('0x40')]=_0x350501;return _0x1ceac5;})[_0xce8b('0x23')](respondWithFilteredResult(_0x3f140b,_0xaf513))[_0xce8b('0x41')](handleError(_0x3f140b,null));};exports[_0xce8b('0x42')]=function(_0x512263,_0x175a35){var _0x293974={'raw':![],'where':{'id':_0x512263[_0xce8b('0x43')]['id']}},_0x12a461={};_0x12a461['model']=_[_0xce8b('0x30')](db[_0xce8b('0x29')]['rawAttributes']);_0x12a461['query']=_[_0xce8b('0x30')](_0x512263[_0xce8b('0x2f')]);_0x12a461[_0xce8b('0x31')]=_[_0xce8b('0x32')](_0x12a461['model'],_0x12a461[_0xce8b('0x2f')]);_0x293974[_0xce8b('0x34')]=_[_0xce8b('0x32')](_0x12a461[_0xce8b('0x2d')],qs[_0xce8b('0x33')](_0x512263[_0xce8b('0x2f')]['fields']));_0x293974[_0xce8b('0x34')]=_0x293974[_0xce8b('0x34')]['length']?_0x293974[_0xce8b('0x34')]:_0x12a461[_0xce8b('0x2d')];if(_0x512263[_0xce8b('0x2f')][_0xce8b('0x3e')]){_0x293974[_0xce8b('0x3f')]=[{'all':!![]}];}_0x293974=_[_0xce8b('0x3a')]({},_0x293974,_0x512263[_0xce8b('0x3d')]);return db[_0xce8b('0x29')][_0xce8b('0x44')](_0x293974)[_0xce8b('0x23')](handleEntityNotFound(_0x175a35,null))[_0xce8b('0x23')](respondWithResult(_0x175a35,null))['catch'](handleError(_0x175a35,null));};exports['create']=function(_0x216aac,_0x439fef){return db[_0xce8b('0x29')]['create'](_0x216aac[_0xce8b('0x45')],{})[_0xce8b('0x23')](respondWithResult(_0x439fef,0xc9))[_0xce8b('0x41')](handleError(_0x439fef,null));};exports[_0xce8b('0x22')]=function(_0x42f3da,_0x498b22){if(_0x42f3da[_0xce8b('0x45')]['id']){delete _0x42f3da[_0xce8b('0x45')]['id'];}return db['Automation'][_0xce8b('0x44')]({'where':{'id':_0x42f3da[_0xce8b('0x43')]['id']}})[_0xce8b('0x23')](handleEntityNotFound(_0x498b22,null))[_0xce8b('0x23')](saveUpdates(_0x42f3da[_0xce8b('0x45')],null))[_0xce8b('0x23')](respondWithResult(_0x498b22,null))['catch'](handleError(_0x498b22,null));};exports['destroy']=function(_0x31e65a,_0x4dcf6d){return db[_0xce8b('0x29')][_0xce8b('0x44')]({'where':{'id':_0x31e65a[_0xce8b('0x43')]['id']}})['then'](handleEntityNotFound(_0x4dcf6d,null))[_0xce8b('0x23')](removeEntity(_0x4dcf6d,null))[_0xce8b('0x41')](handleError(_0x4dcf6d,null));};exports[_0xce8b('0x46')]=function(_0x210032,_0x51b478,_0xf29ce0){return db[_0xce8b('0x47')][_0xce8b('0x44')]({'where':{'id':_0x210032[_0xce8b('0x43')]['id']}})['then'](handleEntityNotFound(_0x51b478,null))[_0xce8b('0x23')](function(_0x486b7f){if(_0x486b7f){return _0x486b7f[_0xce8b('0x46')](_0x210032['body']['ids'],_[_0xce8b('0x48')](_0x210032[_0xce8b('0x45')],[_0xce8b('0x49'),'id'])||{});}})[_0xce8b('0x23')](respondWithResult(_0x51b478,null))[_0xce8b('0x41')](handleError(_0x51b478,null));};exports['getConditions']=function(_0x322356,_0x2ff051,_0x44c752){var _0x3af937={};var _0x610579={};var _0x1590d1;var _0x567e24;return db[_0xce8b('0x29')]['findOne']({'where':{'id':_0x322356['params']['id']}})[_0xce8b('0x23')](handleEntityNotFound(_0x2ff051,null))[_0xce8b('0x23')](function(_0x3a68f6){if(_0x3a68f6){_0x1590d1=_0x3a68f6;_0x610579['model']=_[_0xce8b('0x30')](db[_0xce8b('0x47')][_0xce8b('0x2a')]);_0x610579[_0xce8b('0x2f')]=_[_0xce8b('0x30')](_0x322356[_0xce8b('0x2f')]);_0x610579['filters']=_['intersection'](_0x610579[_0xce8b('0x2d')],_0x610579[_0xce8b('0x2f')]);_0x3af937[_0xce8b('0x34')]=_[_0xce8b('0x32')](_0x610579['model'],qs[_0xce8b('0x33')](_0x322356['query']['fields']));_0x3af937[_0xce8b('0x34')]=_0x3af937[_0xce8b('0x34')][_0xce8b('0x35')]?_0x3af937['attributes']:_0x610579[_0xce8b('0x2d')];_0x3af937[_0xce8b('0x37')]=qs[_0xce8b('0x38')](_0x322356[_0xce8b('0x2f')][_0xce8b('0x38')]);_0x3af937['where']=qs[_0xce8b('0x31')](_['pick'](_0x322356[_0xce8b('0x2f')],_0x610579[_0xce8b('0x31')]));if(_0x322356[_0xce8b('0x2f')]['filter']){_0x3af937[_0xce8b('0x39')]=_[_0xce8b('0x3a')](_0x3af937['where'],{'$or':_[_0xce8b('0x2e')](_0x3af937[_0xce8b('0x34')],function(_0x4df791){var _0xd91fde={};_0xd91fde[_0x4df791]={'$like':'%'+_0x322356['query'][_0xce8b('0x3c')]+'%'};return _0xd91fde;})});}_0x3af937=_[_0xce8b('0x3a')]({},_0x3af937,_0x322356['options']);return _0x1590d1[_0xce8b('0x4a')](_0x3af937);}})[_0xce8b('0x23')](function(_0x114882){if(_0x114882){_0x567e24=_0x114882['length'];if(!_0x322356[_0xce8b('0x2f')][_0xce8b('0x4b')](_0xce8b('0x36'))){_0x3af937[_0xce8b('0x1c')]=qs[_0xce8b('0x1c')](_0x322356[_0xce8b('0x2f')][_0xce8b('0x1c')]);_0x3af937[_0xce8b('0x1b')]=qs['offset'](_0x322356[_0xce8b('0x2f')][_0xce8b('0x1b')]);}return _0x1590d1[_0xce8b('0x4a')](_0x3af937);}})['then'](function(_0x344e93){if(_0x344e93){return _0x344e93?{'count':_0x567e24,'rows':_0x344e93}:null;}})['then'](respondWithResult(_0x2ff051,null))[_0xce8b('0x41')](handleError(_0x2ff051,null));};exports[_0xce8b('0x4c')]=function(_0x1702e6,_0x4bf341,_0x10fc3f){return db[_0xce8b('0x4d')][_0xce8b('0x44')]({'where':{'id':_0x1702e6[_0xce8b('0x43')]['id']}})[_0xce8b('0x23')](handleEntityNotFound(_0x4bf341,null))[_0xce8b('0x23')](function(_0x2a24f6){if(_0x2a24f6){return _0x2a24f6['addActions'](_0x1702e6[_0xce8b('0x45')][_0xce8b('0x49')],_['omit'](_0x1702e6[_0xce8b('0x45')],[_0xce8b('0x49'),'id'])||{});}})[_0xce8b('0x23')](respondWithResult(_0x4bf341,null))[_0xce8b('0x41')](handleError(_0x4bf341,null));};exports[_0xce8b('0x4e')]=function(_0x2d27fb,_0x45ee73,_0x4cb903){var _0x5e671a={};var _0xdb20b8={};var _0x11b392;var _0x2e903b;return db['Automation'][_0xce8b('0x4f')]({'where':{'id':_0x2d27fb[_0xce8b('0x43')]['id']}})[_0xce8b('0x23')](handleEntityNotFound(_0x45ee73,null))[_0xce8b('0x23')](function(_0x519026){if(_0x519026){_0x11b392=_0x519026;_0xdb20b8[_0xce8b('0x2d')]=_['keys'](db['Action'][_0xce8b('0x2a')]);_0xdb20b8[_0xce8b('0x2f')]=_['keys'](_0x2d27fb[_0xce8b('0x2f')]);_0xdb20b8['filters']=_[_0xce8b('0x32')](_0xdb20b8[_0xce8b('0x2d')],_0xdb20b8[_0xce8b('0x2f')]);_0x5e671a[_0xce8b('0x34')]=_[_0xce8b('0x32')](_0xdb20b8['model'],qs[_0xce8b('0x33')](_0x2d27fb[_0xce8b('0x2f')][_0xce8b('0x33')]));_0x5e671a[_0xce8b('0x34')]=_0x5e671a[_0xce8b('0x34')][_0xce8b('0x35')]?_0x5e671a['attributes']:_0xdb20b8[_0xce8b('0x2d')];_0x5e671a[_0xce8b('0x37')]=qs[_0xce8b('0x38')](_0x2d27fb[_0xce8b('0x2f')][_0xce8b('0x38')]);_0x5e671a[_0xce8b('0x39')]=qs[_0xce8b('0x31')](_['pick'](_0x2d27fb[_0xce8b('0x2f')],_0xdb20b8[_0xce8b('0x31')]));if(_0x2d27fb[_0xce8b('0x2f')][_0xce8b('0x3c')]){_0x5e671a['where']=_[_0xce8b('0x3a')](_0x5e671a[_0xce8b('0x39')],{'$or':_[_0xce8b('0x2e')](_0x5e671a[_0xce8b('0x34')],function(_0x1c88c2){var _0xdc087={};_0xdc087[_0x1c88c2]={'$like':'%'+_0x2d27fb[_0xce8b('0x2f')]['filter']+'%'};return _0xdc087;})});}_0x5e671a=_[_0xce8b('0x3a')]({},_0x5e671a,_0x2d27fb[_0xce8b('0x3d')]);return _0x11b392[_0xce8b('0x4e')](_0x5e671a);}})[_0xce8b('0x23')](function(_0x2362c7){if(_0x2362c7){_0x2e903b=_0x2362c7['length'];if(!_0x2d27fb[_0xce8b('0x2f')][_0xce8b('0x4b')](_0xce8b('0x36'))){_0x5e671a[_0xce8b('0x1c')]=qs[_0xce8b('0x1c')](_0x2d27fb['query'][_0xce8b('0x1c')]);_0x5e671a[_0xce8b('0x1b')]=qs[_0xce8b('0x1b')](_0x2d27fb['query'][_0xce8b('0x1b')]);}return _0x11b392[_0xce8b('0x4e')](_0x5e671a);}})[_0xce8b('0x23')](function(_0x8ba759){if(_0x8ba759){return _0x8ba759?{'count':_0x2e903b,'rows':_0x8ba759}:null;}})[_0xce8b('0x23')](respondWithResult(_0x45ee73,null))[_0xce8b('0x41')](handleError(_0x45ee73,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 656286c..ce5b1db 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 _0xef38=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./automation.attributes','Automation','tools_automations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef38,0x122));var _0x8ef3=function(_0x5c0165,_0x587802){_0x5c0165=_0x5c0165-0x0;var _0x1a3d29=_0xef38[_0x5c0165];return _0x1a3d29;};'use strict';var _=require('lodash');var util=require(_0x8ef3('0x0'));var logger=require(_0x8ef3('0x1'))(_0x8ef3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8ef3('0x3'));var fs=require('fs');var path=require(_0x8ef3('0x4'));var rimraf=require(_0x8ef3('0x5'));var config=require(_0x8ef3('0x6'));var attributes=require(_0x8ef3('0x7'));module['exports']=function(_0x142b71,_0x25d6ca){return _0x142b71['define'](_0x8ef3('0x8'),attributes,{'tableName':_0x8ef3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53d6=['../../config/logger','api','moment','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','util'];(function(_0x83cac2,_0xca4af1){var _0x28a715=function(_0x19d98a){while(--_0x19d98a){_0x83cac2['push'](_0x83cac2['shift']());}};_0x28a715(++_0xca4af1);}(_0x53d6,0x113));var _0x653d=function(_0x458c52,_0x5e3fb4){_0x458c52=_0x458c52-0x0;var _0x43f43b=_0x53d6[_0x458c52];return _0x43f43b;};'use strict';var _=require('lodash');var util=require(_0x653d('0x0'));var logger=require(_0x653d('0x1'))(_0x653d('0x2'));var moment=require(_0x653d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x653d('0x4'));var rimraf=require(_0x653d('0x5'));var config=require(_0x653d('0x6'));var attributes=require(_0x653d('0x7'));module[_0x653d('0x8')]=function(_0x116e97,_0x365e69){return _0x116e97[_0x653d('0x9')](_0x653d('0xa'),attributes,{'tableName':_0x653d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 466f253..31ae9ab 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 _0xa022=['Automation,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','request','then','info'];(function(_0x4ca7c7,_0x5d16ee){var _0x456a87=function(_0x11c8fc){while(--_0x11c8fc){_0x4ca7c7['push'](_0x4ca7c7['shift']());}};_0x456a87(++_0x5d16ee);}(_0xa022,0x1e7));var _0x2a02=function(_0x3beef5,_0x5c99ff){_0x3beef5=_0x3beef5-0x0;var _0x4c6999=_0xa022[_0x3beef5];return _0x4c6999;};'use strict';var _=require(_0x2a02('0x0'));var util=require(_0x2a02('0x1'));var moment=require(_0x2a02('0x2'));var BPromise=require(_0x2a02('0x3'));var rs=require(_0x2a02('0x4'));var fs=require('fs');var Redis=require(_0x2a02('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2a02('0x6'))(_0x2a02('0x7'));var config=require('../../config/environment');var jayson=require(_0x2a02('0x8'));var client=jayson['client'][_0x2a02('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1853ee,_0xfcfa50,_0x16647d){return new BPromise(function(_0x54e5fb,_0x20959d){return client[_0x2a02('0xa')](_0x1853ee,_0x16647d)[_0x2a02('0xb')](function(_0x5c700e){logger[_0x2a02('0xc')](_0x2a02('0xd'),_0xfcfa50,_0x2a02('0xe'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0xfcfa50,_0x2a02('0xe'),JSON[_0x2a02('0xf')](_0x5c700e));if(_0x5c700e[_0x2a02('0x10')]){if(_0x5c700e[_0x2a02('0x10')][_0x2a02('0x11')]===0x1f4){logger['error'](_0x2a02('0xd'),_0xfcfa50,_0x5c700e[_0x2a02('0x10')][_0x2a02('0x12')]);return _0x20959d(_0x5c700e[_0x2a02('0x10')][_0x2a02('0x12')]);}logger[_0x2a02('0x10')]('Automation,\x20%s,\x20%s',_0xfcfa50,_0x5c700e[_0x2a02('0x10')][_0x2a02('0x12')]);return _0x54e5fb(_0x5c700e[_0x2a02('0x10')][_0x2a02('0x12')]);}else{logger[_0x2a02('0xc')](_0x2a02('0xd'),_0xfcfa50,_0x2a02('0xe'));_0x54e5fb(_0x5c700e[_0x2a02('0x13')][_0x2a02('0x12')]);}})['catch'](function(_0x570e89){logger[_0x2a02('0x10')](_0x2a02('0xd'),_0xfcfa50,_0x570e89);_0x20959d(_0x570e89);});});} \ No newline at end of file +var _0x6d33=['rpc','../../config/environment','jayson/promise','client','request','info','Automation,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6d33,0x80));var _0x36d3=function(_0x37c8ef,_0x334449){_0x37c8ef=_0x37c8ef-0x0;var _0x5eaee9=_0x6d33[_0x37c8ef];return _0x5eaee9;};'use strict';var _=require('lodash');var util=require(_0x36d3('0x0'));var moment=require(_0x36d3('0x1'));var BPromise=require('bluebird');var rs=require(_0x36d3('0x2'));var fs=require('fs');var Redis=require(_0x36d3('0x3'));var db=require(_0x36d3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x36d3('0x5'));var config=require(_0x36d3('0x6'));var jayson=require(_0x36d3('0x7'));var client=jayson[_0x36d3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ba011,_0x598b9b,_0x375c63){return new BPromise(function(_0xf8bcfa,_0x3baf32){return client[_0x36d3('0x9')](_0x4ba011,_0x375c63)['then'](function(_0x226fb0){logger[_0x36d3('0xa')](_0x36d3('0xb'),_0x598b9b,'request\x20sent');logger[_0x36d3('0xc')]('Automation,\x20%s,\x20%s,\x20%s',_0x598b9b,'request\x20sent',JSON[_0x36d3('0xd')](_0x226fb0));if(_0x226fb0['error']){if(_0x226fb0[_0x36d3('0xe')][_0x36d3('0xf')]===0x1f4){logger[_0x36d3('0xe')](_0x36d3('0xb'),_0x598b9b,_0x226fb0[_0x36d3('0xe')][_0x36d3('0x10')]);return _0x3baf32(_0x226fb0['error'][_0x36d3('0x10')]);}logger[_0x36d3('0xe')]('Automation,\x20%s,\x20%s',_0x598b9b,_0x226fb0[_0x36d3('0xe')][_0x36d3('0x10')]);return _0xf8bcfa(_0x226fb0[_0x36d3('0xe')]['message']);}else{logger[_0x36d3('0xa')]('Automation,\x20%s,\x20%s',_0x598b9b,'request\x20sent');_0xf8bcfa(_0x226fb0[_0x36d3('0x11')][_0x36d3('0x10')]);}})[_0x36d3('0x12')](function(_0x4dcbe6){logger['error'](_0x36d3('0xb'),_0x598b9b,_0x4dcbe6);_0x3baf32(_0x4dcbe6);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 723c6a3..fc757c3 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 _0x3f40=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/conditions','/:id/actions','getActions','post','create','addConditions','addActions','put','delete','destroy','exports','multer','util','path','express','fs-extra'];(function(_0x4a9d4b,_0x470313){var _0x47d79e=function(_0x576f3f){while(--_0x576f3f){_0x4a9d4b['push'](_0x4a9d4b['shift']());}};_0x47d79e(++_0x470313);}(_0x3f40,0xbb));var _0x03f4=function(_0x6c5bce,_0x1d20da){_0x6c5bce=_0x6c5bce-0x0;var _0x527cf3=_0x3f40[_0x6c5bce];return _0x527cf3;};'use strict';var multer=require(_0x03f4('0x0'));var util=require(_0x03f4('0x1'));var path=require(_0x03f4('0x2'));var timeout=require('connect-timeout');var express=require(_0x03f4('0x3'));var router=express['Router']();var fs_extra=require(_0x03f4('0x4'));var auth=require(_0x03f4('0x5'));var interaction=require(_0x03f4('0x6'));var config=require(_0x03f4('0x7'));var controller=require('./automation.controller');router[_0x03f4('0x8')]('/',auth[_0x03f4('0x9')](),controller[_0x03f4('0xa')]);router[_0x03f4('0x8')](_0x03f4('0xb'),auth[_0x03f4('0x9')](),controller[_0x03f4('0xc')]);router['get'](_0x03f4('0xd'),auth[_0x03f4('0x9')](),controller['getConditions']);router['get'](_0x03f4('0xe'),auth[_0x03f4('0x9')](),controller[_0x03f4('0xf')]);router[_0x03f4('0x10')]('/',auth[_0x03f4('0x9')](),controller[_0x03f4('0x11')]);router[_0x03f4('0x10')]('/:id/conditions',auth[_0x03f4('0x9')](),controller[_0x03f4('0x12')]);router[_0x03f4('0x10')]('/:id/actions',auth[_0x03f4('0x9')](),controller[_0x03f4('0x13')]);router[_0x03f4('0x14')](_0x03f4('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x03f4('0x15')](_0x03f4('0xb'),auth[_0x03f4('0x9')](),controller[_0x03f4('0x16')]);module[_0x03f4('0x17')]=router; \ No newline at end of file +var _0x843b=['post','create','/:id/actions','addActions','put','/:id','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id/conditions','getConditions','getActions'];(function(_0x3e10b6,_0x4cce32){var _0x469b0e=function(_0x3d054f){while(--_0x3d054f){_0x3e10b6['push'](_0x3e10b6['shift']());}};_0x469b0e(++_0x4cce32);}(_0x843b,0x143));var _0xb843=function(_0x3c35c3,_0x5322e5){_0x3c35c3=_0x3c35c3-0x0;var _0x1748e4=_0x843b[_0x3c35c3];return _0x1748e4;};'use strict';var multer=require(_0xb843('0x0'));var util=require(_0xb843('0x1'));var path=require('path');var timeout=require(_0xb843('0x2'));var express=require('express');var router=express[_0xb843('0x3')]();var fs_extra=require(_0xb843('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb843('0x5'));var config=require(_0xb843('0x6'));var controller=require(_0xb843('0x7'));router[_0xb843('0x8')]('/',auth[_0xb843('0x9')](),controller['index']);router[_0xb843('0x8')]('/:id',auth[_0xb843('0x9')](),controller['show']);router[_0xb843('0x8')](_0xb843('0xa'),auth[_0xb843('0x9')](),controller[_0xb843('0xb')]);router['get']('/:id/actions',auth[_0xb843('0x9')](),controller[_0xb843('0xc')]);router[_0xb843('0xd')]('/',auth['isAuthenticated'](),controller[_0xb843('0xe')]);router[_0xb843('0xd')](_0xb843('0xa'),auth[_0xb843('0x9')](),controller['addConditions']);router[_0xb843('0xd')](_0xb843('0xf'),auth['isAuthenticated'](),controller[_0xb843('0x10')]);router[_0xb843('0x11')](_0xb843('0x12'),auth[_0xb843('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb843('0x13')]);module[_0xb843('0x14')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 1e53bdb..cc1b6e8 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 _0xe1c3=['STRING','name','ENUM','ivr','Max\x20200\x20calls.','INTEGER','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','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)','sequelize','exports'];(function(_0x69ede,_0x3f8e97){var _0x13e7e1=function(_0x314100){while(--_0x314100){_0x69ede['push'](_0x69ede['shift']());}};_0x13e7e1(++_0x3f8e97);}(_0xe1c3,0x12b));var _0x3e1c=function(_0x2d7607,_0x218161){_0x2d7607=_0x2d7607-0x0;var _0x328803=_0xe1c3[_0x2d7607];return _0x328803;};'use strict';var Sequelize=require(_0x3e1c('0x0'));module[_0x3e1c('0x1')]={'name':{'type':Sequelize[_0x3e1c('0x2')],'unique':_0x3e1c('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x3e1c('0x4')](_0x3e1c('0x5')),'allowNull':![],'defaultValue':_0x3e1c('0x5')},'description':{'type':Sequelize[_0x3e1c('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x3e1c('0x6')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3e1c('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x3e1c('0x7')](0x3)[_0x3e1c('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x3e1c('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3e1c('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3e1c('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3e1c('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x3e1c('0x7')](0x3)[_0x3e1c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3e1c('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x3e1c('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3e1c('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x3e1c('0x7')](0x3)[_0x3e1c('0x8')],'defaultValue':0x3,'comment':_0x3e1c('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x3e1c('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3e1c('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3e1c('0xe')},'dialTimezone':{'type':Sequelize[_0x3e1c('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x3e1c('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x3e1c('0x4')](_0x3e1c('0x10'),_0x3e1c('0x11'),_0x3e1c('0x12')),'defaultValue':_0x3e1c('0x10')},'dialAMDActive':{'type':Sequelize[_0x3e1c('0x13')],'defaultValue':0x0,'comment':_0x3e1c('0x14')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x3e1c('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x3e1c('0x15')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x3e1c('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x3e1c('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x3e1c('0x7')](0x9)[_0x3e1c('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x3e1c('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x3e1c('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3e1c('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0x3e1c('0x7')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3e1c('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x3e1c('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3e1c('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x3e1c('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x3e1c('0x1b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3e1c('0x7')](0x5)[_0x3e1c('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x3e1c('0x1c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3e1c('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3e1c('0x1d')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3e1c('0x4')](_0x3e1c('0x1e'),_0x3e1c('0x1f')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x3e1c('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3e1c('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3e1c('0x20')},'dialCutDigit':{'type':Sequelize[_0x3e1c('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3e1c('0x21')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3e1c('0x7')](0x3)[_0x3e1c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3e1c('0x22')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3e1c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3e1c('0x23')},'dialDropMaxRetry':{'type':Sequelize[_0x3e1c('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3e1c('0x24')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3e1c('0x25')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x3e1c('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3e1c('0x26')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x3e1c('0x7')](0x5)[_0x3e1c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x3e1c('0x7')](0x3)[_0x3e1c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3e1c('0x27')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3e1c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3e1c('0x28')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x3e1c('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3e1c('0x29')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x3e1c('0x7')](0x5)[_0x3e1c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3e1c('0x2a')}}; \ No newline at end of file +var _0xdc3f=['sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','ENUM','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xdc3f,0x1ce));var _0xfdc3=function(_0x5a14d9,_0x59a19f){_0x5a14d9=_0x5a14d9-0x0;var _0x113c70=_0xdc3f[_0x5a14d9];return _0x113c70;};'use strict';var Sequelize=require(_0xfdc3('0x0'));module[_0xfdc3('0x1')]={'name':{'type':Sequelize[_0xfdc3('0x2')],'unique':_0xfdc3('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xfdc3('0x4')),'allowNull':![],'defaultValue':_0xfdc3('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xfdc3('0x5')],'defaultValue':0x0,'comment':_0xfdc3('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xfdc3('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xfdc3('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xfdc3('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfdc3('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xfdc3('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfdc3('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfdc3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfdc3('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfdc3('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xfdc3('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfdc3('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfdc3('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xfdc3('0x9')](0x5)[_0xfdc3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfdc3('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0xfdc3('0x9')](0x3)[_0xfdc3('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xfdc3('0x2')],'defaultValue':_0xfdc3('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xfdc3('0xf')](_0xfdc3('0x10'),'never','onlyIfOpen'),'defaultValue':_0xfdc3('0x10')},'dialAMDActive':{'type':Sequelize[_0xfdc3('0x5')],'defaultValue':0x0,'comment':_0xfdc3('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0xfdc3('0x9')](0x9)[_0xfdc3('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xfdc3('0x9')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xfdc3('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xfdc3('0x9')](0x9)[_0xfdc3('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfdc3('0x13')},'dialAMDMinWordLength':{'type':Sequelize[_0xfdc3('0x9')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xfdc3('0x9')](0x9)[_0xfdc3('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xfdc3('0x9')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xfdc3('0x14')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xfdc3('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xfdc3('0x15')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xfdc3('0x9')](0x9)[_0xfdc3('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xfdc3('0x16'),_0xfdc3('0x17')),'defaultValue':_0xfdc3('0x16')},'dialPrefix':{'type':Sequelize[_0xfdc3('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xfdc3('0x9')](0x3)[_0xfdc3('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xfdc3('0x9')](0x3)[_0xfdc3('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xfdc3('0x9')](0x3)[_0xfdc3('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfdc3('0x18')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xfdc3('0x9')](0x5)[_0xfdc3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfdc3('0x19')},'dialDropMaxRetry':{'type':Sequelize[_0xfdc3('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfdc3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfdc3('0x1a')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xfdc3('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfdc3('0x1b')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xfdc3('0x9')](0x5)[_0xfdc3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfdc3('0x1c')},'dialMachineMaxRetry':{'type':Sequelize[_0xfdc3('0x9')](0x3)[_0xfdc3('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfdc3('0x1d')},'dialMachineRetryFrequency':{'type':Sequelize[_0xfdc3('0x9')](0x5)[_0xfdc3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfdc3('0x1e')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfdc3('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfdc3('0x1f')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xfdc3('0x9')](0x5)[_0xfdc3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfdc3('0x20')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index b6c728e..624e0d0 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 _0x1171=['role','IvrCampaigns','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','CmHopper','CmHopperHistory','hasOwnProperty','CampaignId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','ids','dialCheckDuplicateType','always','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','insert','into','cm_contacts','phone\x20IS\x20NOT\x20NULL','push','sequelize','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','all','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','apply','reject','update','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','Campaign','findAll','rows','show','params','rawAttributes','intersection','include','find','catch','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt'];(function(_0x121737,_0x37e36b){var _0x5f4d4b=function(_0x14182a){while(--_0x14182a){_0x121737['push'](_0x121737['shift']());}};_0x5f4d4b(++_0x37e36b);}(_0x1171,0xbc));var _0x1117=function(_0x457e92,_0x3b624b){_0x457e92=_0x457e92-0x0;var _0x4fc1b8=_0x1171[_0x457e92];return _0x4fc1b8;};'use strict';var emlformat=require(_0x1117('0x0'));var rimraf=require(_0x1117('0x1'));var zipdir=require(_0x1117('0x2'));var jsonpatch=require(_0x1117('0x3'));var rp=require(_0x1117('0x4'));var moment=require(_0x1117('0x5'));var BPromise=require(_0x1117('0x6'));var Mustache=require(_0x1117('0x7'));var util=require('util');var path=require(_0x1117('0x8'));var sox=require(_0x1117('0x9'));var csv=require(_0x1117('0xa'));var ejs=require(_0x1117('0xb'));var fs=require('fs');var fs_extra=require(_0x1117('0xc'));var _=require(_0x1117('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1117('0xe'));var deskjs=require(_0x1117('0xf'));var toCsv=require(_0x1117('0xa'));var querystring=require(_0x1117('0x10'));var Papa=require(_0x1117('0x11'));var Redis=require(_0x1117('0x12'));var authService=require(_0x1117('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1117('0x14'));var hardwareService=require(_0x1117('0x15'));var logger=require(_0x1117('0x16'))(_0x1117('0x17'));var utils=require(_0x1117('0x18'));var config=require(_0x1117('0x19'));var licenseUtil=require(_0x1117('0x1a'));var db=require(_0x1117('0x1b'))['db'];function respondWithStatusCode(_0x1fa026,_0x35a0b9){_0x35a0b9=_0x35a0b9||0xcc;return function(_0x4ed7b2){if(_0x4ed7b2){return _0x1fa026['sendStatus'](_0x35a0b9);}return _0x1fa026['status'](_0x35a0b9)['end']();};}function respondWithResult(_0x14403b,_0x466b16){_0x466b16=_0x466b16||0xc8;return function(_0x5d0525){if(_0x5d0525){return _0x14403b[_0x1117('0x1c')](_0x466b16)[_0x1117('0x1d')](_0x5d0525);}};}function respondWithFilteredResult(_0x4ae931,_0x2ab78e){return function(_0x70c27a){if(_0x70c27a){var _0xbe42f9=_0x70c27a[_0x1117('0x1e')],_0x509926=_0x2ab78e[_0x1117('0x1f')],_0x5718a9=_0x2ab78e[_0x1117('0x1f')]+_0x2ab78e[_0x1117('0x20')],_0x1deff8;if(_0x5718a9>=_0xbe42f9){_0x5718a9=_0xbe42f9;_0x1deff8=0xc8;}else{_0x1deff8=0xce;}_0x4ae931[_0x1117('0x1c')](_0x1deff8);return _0x4ae931[_0x1117('0x21')]('Content-Range',_0x509926+'-'+_0x5718a9+'/'+_0xbe42f9)[_0x1117('0x1d')](_0x70c27a);}return null;};}function patchUpdates(_0x1d4690){return function(_0x24a6ce){try{jsonpatch[_0x1117('0x22')](_0x24a6ce,_0x1d4690,!![]);}catch(_0x530ff8){return BPromise[_0x1117('0x23')](_0x530ff8);}return _0x24a6ce['save']();};}function saveUpdates(_0x3e070a,_0x4ebf75){return function(_0x51ef8a){if(_0x51ef8a){return _0x51ef8a[_0x1117('0x24')](_0x3e070a)[_0x1117('0x25')](function(_0xad7a4f){return _0xad7a4f;});}return null;};}function removeEntity(_0x49e79e,_0x33b845){return function(_0x58e8bd){if(_0x58e8bd){return _0x58e8bd[_0x1117('0x26')]()[_0x1117('0x25')](function(){var _0x469ea=_0x58e8bd['get']({'plain':!![]});var _0xefd9a2='IvrCampaigns';return db[_0x1117('0x27')]['destroy']({'where':{'type':_0xefd9a2,'resourceId':_0x469ea['id']}})[_0x1117('0x25')](function(){return _0x58e8bd;});})[_0x1117('0x25')](function(){_0x49e79e[_0x1117('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d167d,_0x4d7983){return function(_0x57e619){if(!_0x57e619){_0x3d167d[_0x1117('0x28')](0x194);}return _0x57e619;};}function handleError(_0x5d4dec,_0x40e9b5){_0x40e9b5=_0x40e9b5||0x1f4;return function(_0x259914){logger[_0x1117('0x29')](_0x259914[_0x1117('0x2a')]);if(_0x259914[_0x1117('0x2b')]){delete _0x259914[_0x1117('0x2b')];}_0x5d4dec[_0x1117('0x1c')](_0x40e9b5)[_0x1117('0x2c')](_0x259914);};}exports[_0x1117('0x2d')]=function(_0x5b6c1a,_0x32eff1){var _0x156bb8={},_0x4fa250={},_0x5ec1f6={'count':0x0,'rows':[]};var _0x2fe27a=_[_0x1117('0x2e')](db['Campaign']['rawAttributes'],function(_0x49d417){return{'name':_0x49d417[_0x1117('0x2f')],'type':_0x49d417[_0x1117('0x30')][_0x1117('0x31')]};});_0x4fa250['model']=_[_0x1117('0x2e')](_0x2fe27a,_0x1117('0x2b'));_0x4fa250[_0x1117('0x32')]=_[_0x1117('0x33')](_0x5b6c1a[_0x1117('0x32')]);_0x4fa250[_0x1117('0x34')]=_['intersection'](_0x4fa250[_0x1117('0x35')],_0x4fa250[_0x1117('0x32')]);_0x156bb8[_0x1117('0x36')]=_['intersection'](_0x4fa250[_0x1117('0x35')],qs['fields'](_0x5b6c1a[_0x1117('0x32')][_0x1117('0x37')]));_0x156bb8[_0x1117('0x36')]=_0x156bb8[_0x1117('0x36')][_0x1117('0x38')]?_0x156bb8[_0x1117('0x36')]:_0x4fa250[_0x1117('0x35')];if(!_0x5b6c1a['query']['hasOwnProperty'](_0x1117('0x39'))){_0x156bb8[_0x1117('0x20')]=qs[_0x1117('0x20')](_0x5b6c1a[_0x1117('0x32')][_0x1117('0x20')]);_0x156bb8[_0x1117('0x1f')]=qs[_0x1117('0x1f')](_0x5b6c1a[_0x1117('0x32')][_0x1117('0x1f')]);}_0x156bb8[_0x1117('0x3a')]=qs[_0x1117('0x3b')](_0x5b6c1a[_0x1117('0x32')]['sort']);_0x156bb8[_0x1117('0x3c')]=qs[_0x1117('0x34')](_[_0x1117('0x3d')](_0x5b6c1a['query'],_0x4fa250[_0x1117('0x34')]),_0x2fe27a);if(_0x5b6c1a[_0x1117('0x32')]['filter']){_0x156bb8[_0x1117('0x3c')]=_[_0x1117('0x3e')](_0x156bb8[_0x1117('0x3c')],{'$or':_[_0x1117('0x2e')](_0x2fe27a,function(_0x26d93f){if(_0x26d93f[_0x1117('0x30')]!=='VIRTUAL'){var _0x3838ef={};_0x3838ef[_0x26d93f[_0x1117('0x2b')]]={'$like':'%'+_0x5b6c1a[_0x1117('0x32')][_0x1117('0x3f')]+'%'};return _0x3838ef;}})});}_0x156bb8=_['merge']({},_0x156bb8,_0x5b6c1a[_0x1117('0x40')]);var _0x31e8d9={'where':_0x156bb8[_0x1117('0x3c')]};return db['Campaign']['count'](_0x31e8d9)[_0x1117('0x25')](function(_0x366ab3){_0x5ec1f6[_0x1117('0x1e')]=_0x366ab3;if(_0x5b6c1a['query'][_0x1117('0x41')]){_0x156bb8['include']=[{'all':!![]}];}return db[_0x1117('0x42')][_0x1117('0x43')](_0x156bb8);})[_0x1117('0x25')](function(_0x4bf118){_0x5ec1f6[_0x1117('0x44')]=_0x4bf118;return _0x5ec1f6;})[_0x1117('0x25')](respondWithFilteredResult(_0x32eff1,_0x156bb8))['catch'](handleError(_0x32eff1,null));};exports[_0x1117('0x45')]=function(_0x81deb4,_0x56a801){var _0x305a73={'raw':![],'where':{'id':_0x81deb4[_0x1117('0x46')]['id']}},_0x4c55b5={};_0x4c55b5['model']=_[_0x1117('0x33')](db[_0x1117('0x42')][_0x1117('0x47')]);_0x4c55b5['query']=_[_0x1117('0x33')](_0x81deb4[_0x1117('0x32')]);_0x4c55b5[_0x1117('0x34')]=_[_0x1117('0x48')](_0x4c55b5[_0x1117('0x35')],_0x4c55b5[_0x1117('0x32')]);_0x305a73[_0x1117('0x36')]=_[_0x1117('0x48')](_0x4c55b5[_0x1117('0x35')],qs[_0x1117('0x37')](_0x81deb4[_0x1117('0x32')][_0x1117('0x37')]));_0x305a73[_0x1117('0x36')]=_0x305a73[_0x1117('0x36')][_0x1117('0x38')]?_0x305a73[_0x1117('0x36')]:_0x4c55b5['model'];if(_0x81deb4[_0x1117('0x32')][_0x1117('0x41')]){_0x305a73[_0x1117('0x49')]=[{'all':!![]}];}_0x305a73=_[_0x1117('0x3e')]({},_0x305a73,_0x81deb4['options']);return db['Campaign'][_0x1117('0x4a')](_0x305a73)[_0x1117('0x25')](handleEntityNotFound(_0x56a801,null))['then'](respondWithResult(_0x56a801,null))[_0x1117('0x4b')](handleError(_0x56a801,null));};exports['create']=function(_0x112efa,_0x28dbcb){return db[_0x1117('0x42')]['create'](_0x112efa[_0x1117('0x4c')],{})['then'](function(_0x371e0b){var _0xbaaa6e=_0x112efa[_0x1117('0x4d')][_0x1117('0x4e')]({'plain':!![]});if(!_0xbaaa6e)throw new Error(_0x1117('0x4f'));if(_0xbaaa6e['role']===_0x1117('0x4d')){var _0x2dda2a=_0x371e0b[_0x1117('0x4e')]({'plain':!![]});var _0x472541='IvrCampaigns';return db['UserProfileSection'][_0x1117('0x4a')]({'where':{'name':_0x472541,'userProfileId':_0xbaaa6e[_0x1117('0x50')]},'raw':!![]})[_0x1117('0x25')](function(_0xda94ab){if(_0xda94ab&&_0xda94ab[_0x1117('0x51')]===0x0){return db[_0x1117('0x27')]['create']({'name':_0x2dda2a[_0x1117('0x2b')],'resourceId':_0x2dda2a['id'],'type':_0xda94ab[_0x1117('0x2b')],'sectionId':_0xda94ab['id']},{})[_0x1117('0x25')](function(){return _0x371e0b;});}else{return _0x371e0b;}})['catch'](function(_0x520d1c){logger[_0x1117('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x520d1c);throw _0x520d1c;});}return _0x371e0b;})['then'](respondWithResult(_0x28dbcb,0xc9))[_0x1117('0x4b')](handleError(_0x28dbcb,null));};exports[_0x1117('0x52')]=function(_0x3cc6ac,_0x4a3a99){var _0x968182={'where':{'id':_0x3cc6ac['params']['id']}},_0x368ccc={};_0x368ccc['model']=_['keys'](db['Campaign'][_0x1117('0x47')]);_0x968182[_0x1117('0x36')]=_[_0x1117('0x48')](_0x368ccc[_0x1117('0x35')],qs[_0x1117('0x37')](_0x3cc6ac[_0x1117('0x32')][_0x1117('0x37')]));_0x968182[_0x1117('0x36')]=_0x968182['attributes'][_0x1117('0x38')]?_0x968182[_0x1117('0x36')]:_0x368ccc[_0x1117('0x35')];if(_0x3cc6ac[_0x1117('0x32')]['includeAll']){_0x968182[_0x1117('0x49')]=[{'all':!![]}];}_0x968182=_['merge']({},_0x968182,_0x3cc6ac['options']);return db[_0x1117('0x42')][_0x1117('0x4a')](_0x968182)[_0x1117('0x25')](handleEntityNotFound(_0x4a3a99,null))[_0x1117('0x25')](function(_0x3bdc13){if(_0x3bdc13){var _0x30e4ad=_0x3bdc13[_0x1117('0x4e')]({'plain':!![]});_0x30e4ad=qs[_0x1117('0x53')](_0x30e4ad,['id',_0x1117('0x54'),_0x1117('0x55')]);_0x3cc6ac[_0x1117('0x4c')]=_[_0x1117('0x53')](_0x3cc6ac[_0x1117('0x4c')],['id',_0x1117('0x54'),_0x1117('0x55')]);return db[_0x1117('0x42')]['create'](_['merge'](_0x30e4ad,_0x3cc6ac['body']),{'include':_0x3cc6ac[_0x1117('0x32')][_0x1117('0x41')]?[{'all':!![]}]:undefined})[_0x1117('0x25')](function(_0x209c66){var _0x5c48ab=_0x3cc6ac[_0x1117('0x4d')]['get']({'plain':!![]});if(!_0x5c48ab)throw new Error(_0x1117('0x4f'));if(_0x5c48ab[_0x1117('0x56')]===_0x1117('0x4d')){var _0x2ec1ff=_0x209c66[_0x1117('0x4e')]({'plain':!![]});var _0x518f6e=_0x1117('0x57');return db['UserProfileSection'][_0x1117('0x4a')]({'where':{'name':_0x518f6e,'userProfileId':_0x5c48ab[_0x1117('0x50')]},'raw':!![]})[_0x1117('0x25')](function(_0x3893fc){if(_0x3893fc&&_0x3893fc['autoAssociation']===0x0){return db[_0x1117('0x27')][_0x1117('0x58')]({'name':_0x2ec1ff[_0x1117('0x2b')],'resourceId':_0x2ec1ff['id'],'type':_0x3893fc[_0x1117('0x2b')],'sectionId':_0x3893fc['id']},{})[_0x1117('0x25')](function(){return _0x209c66;});}else{return _0x209c66;}})['catch'](function(_0x7d68f0){logger['error'](_0x1117('0x59'),_0x7d68f0);throw _0x7d68f0;});}return _0x209c66;});}})[_0x1117('0x25')](respondWithResult(_0x4a3a99,0xc9))[_0x1117('0x4b')](handleError(_0x4a3a99,null));};exports[_0x1117('0x24')]=function(_0x8dbe3c,_0x54dcd8){if(_0x8dbe3c[_0x1117('0x4c')]['id']){delete _0x8dbe3c['body']['id'];}return db[_0x1117('0x42')]['find']({'where':{'id':_0x8dbe3c[_0x1117('0x46')]['id']}})['then'](handleEntityNotFound(_0x54dcd8,null))[_0x1117('0x25')](saveUpdates(_0x8dbe3c[_0x1117('0x4c')],null))[_0x1117('0x25')](respondWithResult(_0x54dcd8,null))[_0x1117('0x4b')](handleError(_0x54dcd8,null));};exports['destroy']=function(_0x4d4eb6,_0x569725){return db[_0x1117('0x42')][_0x1117('0x4a')]({'where':{'id':_0x4d4eb6[_0x1117('0x46')]['id']}})[_0x1117('0x25')](handleEntityNotFound(_0x569725,null))[_0x1117('0x25')](removeEntity(_0x569725,null))[_0x1117('0x4b')](handleError(_0x569725,null));};exports['getHoppers']=function(_0x1a5997,_0x5482ca,_0x7407f5){var _0x52d4f4={'raw':!![],'where':{}};var _0xf772d5={};var _0x56f528={'count':0x0,'rows':[]};return db[_0x1117('0x42')][_0x1117('0x5a')]({'where':{'id':_0x1a5997[_0x1117('0x46')]['id']}})[_0x1117('0x25')](handleEntityNotFound(_0x5482ca,null))['then'](function(_0x576099){if(_0x576099){_0xf772d5[_0x1117('0x35')]=_[_0x1117('0x33')](db[_0x1117('0x5b')]['rawAttributes']);_0xf772d5[_0x1117('0x32')]=_['keys'](_0x1a5997[_0x1117('0x32')]);_0xf772d5[_0x1117('0x34')]=_[_0x1117('0x48')](_0xf772d5['model'],_0xf772d5[_0x1117('0x32')]);_0x52d4f4[_0x1117('0x36')]=_[_0x1117('0x48')](_0xf772d5[_0x1117('0x35')],qs[_0x1117('0x37')](_0x1a5997[_0x1117('0x32')][_0x1117('0x37')]));_0x52d4f4[_0x1117('0x36')]=_0x52d4f4[_0x1117('0x36')][_0x1117('0x38')]?_0x52d4f4[_0x1117('0x36')]:_0xf772d5[_0x1117('0x35')];if(!_0x1a5997[_0x1117('0x32')]['hasOwnProperty'](_0x1117('0x39'))){_0x52d4f4['limit']=qs[_0x1117('0x20')](_0x1a5997[_0x1117('0x32')]['limit']);_0x52d4f4[_0x1117('0x1f')]=qs[_0x1117('0x1f')](_0x1a5997[_0x1117('0x32')][_0x1117('0x1f')]);}_0x52d4f4[_0x1117('0x3a')]=qs[_0x1117('0x3b')](_0x1a5997[_0x1117('0x32')][_0x1117('0x3b')]);_0x52d4f4[_0x1117('0x3c')]=qs['filters'](_[_0x1117('0x3d')](_0x1a5997[_0x1117('0x32')],_0xf772d5[_0x1117('0x34')]));_0x52d4f4[_0x1117('0x3c')]['CampaignId']=_0x576099['id'];if(_0x1a5997[_0x1117('0x32')][_0x1117('0x3f')]){_0x52d4f4[_0x1117('0x3c')]=_[_0x1117('0x3e')](_0x52d4f4[_0x1117('0x3c')],{'$or':_[_0x1117('0x2e')](_0x52d4f4[_0x1117('0x36')],function(_0x14bdb3){var _0x418325={};_0x418325[_0x14bdb3]={'$like':'%'+_0x1a5997[_0x1117('0x32')][_0x1117('0x3f')]+'%'};return _0x418325;})});}_0x52d4f4=_['merge']({},_0x52d4f4,_0x1a5997['options']);return db[_0x1117('0x5b')]['count']({'where':_0x52d4f4[_0x1117('0x3c')]})[_0x1117('0x25')](function(_0xf7a04f){_0x56f528[_0x1117('0x1e')]=_0xf7a04f;if(_0x1a5997[_0x1117('0x32')][_0x1117('0x41')]){_0x52d4f4['include']=[{'all':!![]}];}return db[_0x1117('0x5b')][_0x1117('0x43')](_0x52d4f4);})['then'](function(_0x19d4a1){_0x56f528['rows']=_0x19d4a1;return _0x56f528;});}})['then'](respondWithFilteredResult(_0x5482ca,_0x52d4f4))[_0x1117('0x4b')](handleError(_0x5482ca,null));};exports['getHopperHistories']=function(_0x3bd65b,_0x1152cf,_0x3422d5){var _0x2bda15={'raw':!![],'where':{}};var _0x36e6f0={};var _0x534a9c={'count':0x0,'rows':[]};return db[_0x1117('0x42')][_0x1117('0x5a')]({'where':{'id':_0x3bd65b[_0x1117('0x46')]['id']}})[_0x1117('0x25')](handleEntityNotFound(_0x1152cf,null))[_0x1117('0x25')](function(_0xebe44b){if(_0xebe44b){_0x36e6f0['model']=_[_0x1117('0x33')](db[_0x1117('0x5c')][_0x1117('0x47')]);_0x36e6f0['query']=_['keys'](_0x3bd65b[_0x1117('0x32')]);_0x36e6f0['filters']=_[_0x1117('0x48')](_0x36e6f0['model'],_0x36e6f0[_0x1117('0x32')]);_0x2bda15[_0x1117('0x36')]=_[_0x1117('0x48')](_0x36e6f0[_0x1117('0x35')],qs['fields'](_0x3bd65b['query']['fields']));_0x2bda15[_0x1117('0x36')]=_0x2bda15[_0x1117('0x36')]['length']?_0x2bda15[_0x1117('0x36')]:_0x36e6f0['model'];if(!_0x3bd65b[_0x1117('0x32')][_0x1117('0x5d')](_0x1117('0x39'))){_0x2bda15[_0x1117('0x20')]=qs['limit'](_0x3bd65b[_0x1117('0x32')][_0x1117('0x20')]);_0x2bda15[_0x1117('0x1f')]=qs[_0x1117('0x1f')](_0x3bd65b['query'][_0x1117('0x1f')]);}_0x2bda15['order']=qs[_0x1117('0x3b')](_0x3bd65b[_0x1117('0x32')][_0x1117('0x3b')]);_0x2bda15[_0x1117('0x3c')]=qs[_0x1117('0x34')](_[_0x1117('0x3d')](_0x3bd65b['query'],_0x36e6f0['filters']));_0x2bda15[_0x1117('0x3c')][_0x1117('0x5e')]=_0xebe44b['id'];if(_0x3bd65b[_0x1117('0x32')][_0x1117('0x3f')]){_0x2bda15[_0x1117('0x3c')]=_[_0x1117('0x3e')](_0x2bda15['where'],{'$or':_['map'](_0x2bda15[_0x1117('0x36')],function(_0x23c43f){var _0x51e7b3={};_0x51e7b3[_0x23c43f]={'$like':'%'+_0x3bd65b[_0x1117('0x32')][_0x1117('0x3f')]+'%'};return _0x51e7b3;})});}_0x2bda15=_[_0x1117('0x3e')]({},_0x2bda15,_0x3bd65b['options']);return db['CmHopperHistory'][_0x1117('0x1e')]({'where':_0x2bda15['where']})[_0x1117('0x25')](function(_0x57a3cf){_0x534a9c[_0x1117('0x1e')]=_0x57a3cf;if(_0x3bd65b[_0x1117('0x32')][_0x1117('0x41')]){_0x2bda15[_0x1117('0x49')]=[{'all':!![]}];}return db[_0x1117('0x5c')][_0x1117('0x43')](_0x2bda15);})['then'](function(_0x4edcb1){_0x534a9c[_0x1117('0x44')]=_0x4edcb1;return _0x534a9c;});}})['then'](respondWithFilteredResult(_0x1152cf,_0x2bda15))[_0x1117('0x4b')](handleError(_0x1152cf,null));};exports[_0x1117('0x5f')]=function(_0x3314a5,_0x1fe5a8,_0x425a75){var _0x18d5c8={'raw':!![],'where':{}};var _0x4fadec={};var _0x2ce4fc={'count':0x0,'rows':[]};return db['Campaign'][_0x1117('0x5a')]({'where':{'id':_0x3314a5[_0x1117('0x46')]['id']}})[_0x1117('0x25')](handleEntityNotFound(_0x1fe5a8,null))[_0x1117('0x25')](function(_0x49478f){if(_0x49478f){_0x4fadec[_0x1117('0x35')]=_[_0x1117('0x33')](db[_0x1117('0x60')][_0x1117('0x47')]);_0x4fadec[_0x1117('0x32')]=_[_0x1117('0x33')](_0x3314a5[_0x1117('0x32')]);_0x4fadec['filters']=_[_0x1117('0x48')](_0x4fadec['model'],_0x4fadec[_0x1117('0x32')]);_0x18d5c8[_0x1117('0x36')]=_[_0x1117('0x48')](_0x4fadec[_0x1117('0x35')],qs[_0x1117('0x37')](_0x3314a5['query'][_0x1117('0x37')]));_0x18d5c8['attributes']=_0x18d5c8[_0x1117('0x36')]['length']?_0x18d5c8['attributes']:_0x4fadec[_0x1117('0x35')];if(!_0x3314a5[_0x1117('0x32')][_0x1117('0x5d')]('nolimit')){_0x18d5c8['limit']=qs[_0x1117('0x20')](_0x3314a5['query'][_0x1117('0x20')]);_0x18d5c8['offset']=qs[_0x1117('0x1f')](_0x3314a5[_0x1117('0x32')][_0x1117('0x1f')]);}_0x18d5c8['order']=qs[_0x1117('0x3b')](_0x3314a5[_0x1117('0x32')][_0x1117('0x3b')]);_0x18d5c8[_0x1117('0x3c')]=qs[_0x1117('0x34')](_['pick'](_0x3314a5[_0x1117('0x32')],_0x4fadec[_0x1117('0x34')]));_0x18d5c8[_0x1117('0x3c')][_0x1117('0x5e')]=_0x49478f['id'];if(_0x3314a5[_0x1117('0x32')][_0x1117('0x3f')]){_0x18d5c8['where']=_[_0x1117('0x3e')](_0x18d5c8['where'],{'$or':_['map'](_0x18d5c8[_0x1117('0x36')],function(_0x20051f){var _0x1760c6={};_0x1760c6[_0x20051f]={'$like':'%'+_0x3314a5[_0x1117('0x32')]['filter']+'%'};return _0x1760c6;})});}_0x18d5c8=_[_0x1117('0x3e')]({},_0x18d5c8,_0x3314a5[_0x1117('0x40')]);return db[_0x1117('0x60')][_0x1117('0x1e')]({'where':_0x18d5c8[_0x1117('0x3c')]})[_0x1117('0x25')](function(_0x3b0017){_0x2ce4fc['count']=_0x3b0017;if(_0x3314a5['query'][_0x1117('0x41')]){_0x18d5c8['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x18d5c8);})[_0x1117('0x25')](function(_0x254198){_0x2ce4fc[_0x1117('0x44')]=_0x254198;return _0x2ce4fc;});}})[_0x1117('0x25')](respondWithFilteredResult(_0x1fe5a8,_0x18d5c8))['catch'](handleError(_0x1fe5a8,null));};exports[_0x1117('0x61')]=function(_0x9a1ed7,_0x40fa82,_0x373fcd){var _0xa336ae={'raw':!![],'where':{}};var _0x311349={};var _0x319288={'count':0x0,'rows':[]};return db[_0x1117('0x42')]['findOne']({'where':{'id':_0x9a1ed7['params']['id']}})['then'](handleEntityNotFound(_0x40fa82,null))['then'](function(_0x3ce8ba){if(_0x3ce8ba){_0x311349['model']=_[_0x1117('0x33')](db['CmHopperBlack']['rawAttributes']);_0x311349['query']=_[_0x1117('0x33')](_0x9a1ed7[_0x1117('0x32')]);_0x311349[_0x1117('0x34')]=_[_0x1117('0x48')](_0x311349[_0x1117('0x35')],_0x311349[_0x1117('0x32')]);_0xa336ae[_0x1117('0x36')]=_[_0x1117('0x48')](_0x311349['model'],qs[_0x1117('0x37')](_0x9a1ed7['query'][_0x1117('0x37')]));_0xa336ae[_0x1117('0x36')]=_0xa336ae[_0x1117('0x36')][_0x1117('0x38')]?_0xa336ae[_0x1117('0x36')]:_0x311349['model'];if(!_0x9a1ed7[_0x1117('0x32')][_0x1117('0x5d')](_0x1117('0x39'))){_0xa336ae['limit']=qs[_0x1117('0x20')](_0x9a1ed7['query'][_0x1117('0x20')]);_0xa336ae[_0x1117('0x1f')]=qs['offset'](_0x9a1ed7[_0x1117('0x32')]['offset']);}_0xa336ae['order']=qs[_0x1117('0x3b')](_0x9a1ed7[_0x1117('0x32')][_0x1117('0x3b')]);_0xa336ae[_0x1117('0x3c')]=qs[_0x1117('0x34')](_[_0x1117('0x3d')](_0x9a1ed7[_0x1117('0x32')],_0x311349[_0x1117('0x34')]));_0xa336ae[_0x1117('0x3c')][_0x1117('0x5e')]=_0x3ce8ba['id'];if(_0x9a1ed7[_0x1117('0x32')][_0x1117('0x3f')]){_0xa336ae['where']=_[_0x1117('0x3e')](_0xa336ae['where'],{'$or':_[_0x1117('0x2e')](_0xa336ae['attributes'],function(_0x14db80){var _0x137542={};_0x137542[_0x14db80]={'$like':'%'+_0x9a1ed7['query'][_0x1117('0x3f')]+'%'};return _0x137542;})});}_0xa336ae=_[_0x1117('0x3e')]({},_0xa336ae,_0x9a1ed7['options']);return db[_0x1117('0x62')][_0x1117('0x1e')]({'where':_0xa336ae[_0x1117('0x3c')]})['then'](function(_0x497b0a){_0x319288[_0x1117('0x1e')]=_0x497b0a;if(_0x9a1ed7[_0x1117('0x32')]['includeAll']){_0xa336ae[_0x1117('0x49')]=[{'all':!![]}];}return db[_0x1117('0x62')][_0x1117('0x43')](_0xa336ae);})[_0x1117('0x25')](function(_0x376e8e){_0x319288[_0x1117('0x44')]=_0x376e8e;return _0x319288;});}})[_0x1117('0x25')](respondWithFilteredResult(_0x40fa82,_0xa336ae))[_0x1117('0x4b')](handleError(_0x40fa82,null));};exports['getLists']=function(_0x3ac1ef,_0x22da74,_0x3c9850){var _0x3d69a7={};var _0x375a80={};var _0x282721;var _0x569655;return db[_0x1117('0x42')][_0x1117('0x5a')]({'where':{'id':_0x3ac1ef[_0x1117('0x46')]['id']}})[_0x1117('0x25')](handleEntityNotFound(_0x22da74,null))[_0x1117('0x25')](function(_0xe58184){if(_0xe58184){_0x282721=_0xe58184;_0x375a80[_0x1117('0x35')]=_['keys'](db[_0x1117('0x63')][_0x1117('0x47')]);_0x375a80['query']=_['keys'](_0x3ac1ef[_0x1117('0x32')]);_0x375a80[_0x1117('0x34')]=_['intersection'](_0x375a80[_0x1117('0x35')],_0x375a80[_0x1117('0x32')]);_0x3d69a7[_0x1117('0x36')]=_[_0x1117('0x48')](_0x375a80[_0x1117('0x35')],qs['fields'](_0x3ac1ef[_0x1117('0x32')][_0x1117('0x37')]));_0x3d69a7[_0x1117('0x36')]=_0x3d69a7[_0x1117('0x36')]['length']?_0x3d69a7[_0x1117('0x36')]:_0x375a80['model'];_0x3d69a7[_0x1117('0x3a')]=qs['sort'](_0x3ac1ef['query']['sort']);_0x3d69a7[_0x1117('0x3c')]=qs[_0x1117('0x34')](_[_0x1117('0x3d')](_0x3ac1ef[_0x1117('0x32')],_0x375a80[_0x1117('0x34')]));if(_0x3ac1ef[_0x1117('0x32')][_0x1117('0x3f')]){_0x3d69a7[_0x1117('0x3c')]=_[_0x1117('0x3e')](_0x3d69a7[_0x1117('0x3c')],{'$or':_['map'](_0x3d69a7['attributes'],function(_0x1f01d5){var _0x251201={};_0x251201[_0x1f01d5]={'$like':'%'+_0x3ac1ef['query']['filter']+'%'};return _0x251201;})});}_0x3d69a7=_['merge']({},_0x3d69a7,_0x3ac1ef[_0x1117('0x40')]);return _0x282721['getLists'](_0x3d69a7);}})[_0x1117('0x25')](function(_0x1de11a){if(_0x1de11a){_0x569655=_0x1de11a[_0x1117('0x38')];if(!_0x3ac1ef[_0x1117('0x32')][_0x1117('0x5d')](_0x1117('0x39'))){_0x3d69a7[_0x1117('0x20')]=qs[_0x1117('0x20')](_0x3ac1ef[_0x1117('0x32')][_0x1117('0x20')]);_0x3d69a7[_0x1117('0x1f')]=qs[_0x1117('0x1f')](_0x3ac1ef[_0x1117('0x32')][_0x1117('0x1f')]);}return _0x282721[_0x1117('0x64')](_0x3d69a7);}})['then'](function(_0xc6c39b){if(_0xc6c39b){return _0xc6c39b?{'count':_0x569655,'rows':_0xc6c39b}:null;}})[_0x1117('0x25')](respondWithResult(_0x22da74,null))[_0x1117('0x4b')](handleError(_0x22da74,null));};exports[_0x1117('0x65')]=function(_0xce031,_0x408e51,_0x2a8d37){var _0x1724a1,_0x31ee50;return db[_0x1117('0x42')][_0x1117('0x4a')]({'where':{'id':_0xce031['params']['id']}})[_0x1117('0x25')](handleEntityNotFound(_0x408e51,null))[_0x1117('0x25')](function(_0x3bb7bb){if(_0x3bb7bb){_0x31ee50=_0x3bb7bb;return _0x3bb7bb['addLists'](_0xce031[_0x1117('0x4c')][_0x1117('0x66')],_[_0x1117('0x53')](_0xce031[_0x1117('0x4c')],[_0x1117('0x66'),'id'])||{});}return null;})['spread'](function(_0x526b7f){var _0x43e928;_0x1724a1=_0x526b7f||[];var _0xb6603a=[];if(_0x526b7f){for(var _0x30273a=0x0;_0x30273a<_0x526b7f[_0x1117('0x38')];_0x30273a+=0x1){var _0x503bfb=_0x526b7f[_0x30273a][_0x1117('0x4e')]({'plain':!![]});_0x31ee50[_0x1117('0x67')]=_0xce031[_0x1117('0x4c')][_0x1117('0x67')]?_0xce031['body'][_0x1117('0x67')]:_0x31ee50['dialCheckDuplicateType'];switch(_0x31ee50['dialCheckDuplicateType']){case _0x1117('0x68'):_0x43e928=squel['insert']()['into'](_0x1117('0x69'))[_0x1117('0x6a')]([_0x1117('0x6b'),_0x1117('0x6c'),_0x1117('0x6d'),_0x1117('0x6e'),'CampaignId',_0x1117('0x54'),'updatedAt'],squel[_0x1117('0x6f')]()[_0x1117('0x70')]('phone','phone')[_0x1117('0x70')](_0x1117('0x71'),_0x1117('0x6c'))['field']('id','ContactId')[_0x1117('0x70')](_0x503bfb[_0x1117('0x72')]['toString'](),'ListId')[_0x1117('0x70')](_0xce031['params']['id']['toString'](),_0x1117('0x5e'))[_0x1117('0x70')](_0x1117('0x71'),'createdAt')[_0x1117('0x70')](_0x1117('0x71'),'updatedAt')[_0x1117('0x73')]('cm_contacts')[_0x1117('0x3c')](_0x1117('0x74'))[_0x1117('0x3c')](_0x1117('0x75'),_0x503bfb[_0x1117('0x72')][_0x1117('0x76')]())[_0x1117('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x1117('0x3c')](_0x1117('0x77'),squel[_0x1117('0x6f')]()['field'](_0x1117('0x78'))['from'](_0x1117('0x79'))[_0x1117('0x3c')](_0x1117('0x7a'),_0xce031[_0x1117('0x46')]['id']['toString']()))[_0x1117('0x3c')](_0x1117('0x77'),squel['select']()[_0x1117('0x70')](_0x1117('0x7b'))['from'](_0x1117('0x69'))['where'](_0x1117('0x7a'),_0xce031[_0x1117('0x46')]['id'][_0x1117('0x76')]())))[_0x1117('0x76')]();break;case'onlyIfOpen':_0x43e928=squel[_0x1117('0x7c')]()[_0x1117('0x7d')](_0x1117('0x69'))['fromQuery']([_0x1117('0x6b'),_0x1117('0x6c'),_0x1117('0x6d'),'ListId',_0x1117('0x5e'),_0x1117('0x54'),'updatedAt'],squel[_0x1117('0x6f')]()[_0x1117('0x70')]('phone',_0x1117('0x6b'))[_0x1117('0x70')]('NOW()','scheduledAt')[_0x1117('0x70')]('id',_0x1117('0x6d'))[_0x1117('0x70')](_0x503bfb[_0x1117('0x72')]['toString'](),_0x1117('0x6e'))[_0x1117('0x70')](_0xce031[_0x1117('0x46')]['id'][_0x1117('0x76')](),'CampaignId')[_0x1117('0x70')](_0x1117('0x71'),'createdAt')['field'](_0x1117('0x71'),_0x1117('0x55'))[_0x1117('0x73')](_0x1117('0x7e'))[_0x1117('0x3c')]('deletedAt\x20IS\x20NULL')[_0x1117('0x3c')]('ListId\x20=\x20?',_0x503bfb[_0x1117('0x72')][_0x1117('0x76')]())[_0x1117('0x3c')](_0x1117('0x7f'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x1117('0x6f')]()[_0x1117('0x70')]('COALESCE(phone,\x27\x27)')[_0x1117('0x73')]('cm_hopper')[_0x1117('0x3c')](_0x1117('0x7a'),_0xce031[_0x1117('0x46')]['id']['toString']())))[_0x1117('0x76')]();break;default:_0x43e928=squel[_0x1117('0x7c')]()[_0x1117('0x7d')](_0x1117('0x69'))[_0x1117('0x6a')]([_0x1117('0x6b'),_0x1117('0x6c'),_0x1117('0x6d'),_0x1117('0x6e'),_0x1117('0x5e'),_0x1117('0x54'),_0x1117('0x55')],squel['select']()[_0x1117('0x70')]('phone','phone')[_0x1117('0x70')]('NOW()',_0x1117('0x6c'))['field']('id','ContactId')[_0x1117('0x70')](_0x503bfb[_0x1117('0x72')][_0x1117('0x76')](),'ListId')[_0x1117('0x70')](_0xce031[_0x1117('0x46')]['id'][_0x1117('0x76')](),'CampaignId')[_0x1117('0x70')](_0x1117('0x71'),_0x1117('0x54'))['field'](_0x1117('0x71'),_0x1117('0x55'))['from'](_0x1117('0x7e'))[_0x1117('0x3c')](_0x1117('0x74'))[_0x1117('0x3c')](_0x1117('0x75'),_0x503bfb[_0x1117('0x72')][_0x1117('0x76')]())[_0x1117('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0x1117('0x76')]();}_0xb6603a[_0x1117('0x80')](db[_0x1117('0x81')]['query'](_0x43e928));}return BPromise['all'](_0xb6603a);}})[_0x1117('0x25')](function(){return _0x1724a1;})['then'](respondWithResult(_0x408e51,null))[_0x1117('0x4b')](handleError(_0x408e51,null));};exports[_0x1117('0x82')]=function(_0x59f319,_0xdb3521,_0x12ab0d){return db['Campaign'][_0x1117('0x4a')]({'where':{'id':_0x59f319[_0x1117('0x46')]['id']}})['then'](handleEntityNotFound(_0xdb3521,null))[_0x1117('0x25')](function(_0xb081be){if(_0xb081be){return _0xb081be[_0x1117('0x82')](_0x59f319[_0x1117('0x32')]['ids']);}})[_0x1117('0x25')](function(_0x20cfa7){if(_0x20cfa7){return db[_0x1117('0x5b')]['destroy']({'where':{'ListId':_0x59f319[_0x1117('0x32')]['ids'],'CampaignId':_0x59f319[_0x1117('0x46')]['id']}})['then'](function(){return _0x20cfa7;});}})[_0x1117('0x25')](respondWithStatusCode(_0xdb3521,null))[_0x1117('0x4b')](handleError(_0xdb3521,null));};exports[_0x1117('0x83')]=function(_0x136a48,_0x34d140,_0x3c367f){var _0x39bc8e={};var _0x2c514e={};var _0x3d8ad1;var _0x2764d2;return db[_0x1117('0x42')][_0x1117('0x5a')]({'where':{'id':_0x136a48[_0x1117('0x46')]['id']}})[_0x1117('0x25')](handleEntityNotFound(_0x34d140,null))[_0x1117('0x25')](function(_0x3d0309){if(_0x3d0309){_0x3d8ad1=_0x3d0309;_0x2c514e[_0x1117('0x35')]=_['keys'](db[_0x1117('0x63')]['rawAttributes']);_0x2c514e[_0x1117('0x32')]=_[_0x1117('0x33')](_0x136a48[_0x1117('0x32')]);_0x2c514e[_0x1117('0x34')]=_[_0x1117('0x48')](_0x2c514e[_0x1117('0x35')],_0x2c514e[_0x1117('0x32')]);_0x39bc8e[_0x1117('0x36')]=_[_0x1117('0x48')](_0x2c514e[_0x1117('0x35')],qs[_0x1117('0x37')](_0x136a48['query'][_0x1117('0x37')]));_0x39bc8e[_0x1117('0x36')]=_0x39bc8e[_0x1117('0x36')]['length']?_0x39bc8e[_0x1117('0x36')]:_0x2c514e[_0x1117('0x35')];_0x39bc8e[_0x1117('0x3a')]=qs['sort'](_0x136a48[_0x1117('0x32')][_0x1117('0x3b')]);_0x39bc8e[_0x1117('0x3c')]=qs[_0x1117('0x34')](_[_0x1117('0x3d')](_0x136a48[_0x1117('0x32')],_0x2c514e[_0x1117('0x34')]));if(_0x136a48['query']['filter']){_0x39bc8e[_0x1117('0x3c')]=_[_0x1117('0x3e')](_0x39bc8e[_0x1117('0x3c')],{'$or':_['map'](_0x39bc8e['attributes'],function(_0x170046){var _0x3a3bac={};_0x3a3bac[_0x170046]={'$like':'%'+_0x136a48['query']['filter']+'%'};return _0x3a3bac;})});}_0x39bc8e=_[_0x1117('0x3e')]({},_0x39bc8e,_0x136a48[_0x1117('0x40')]);return _0x3d8ad1[_0x1117('0x83')](_0x39bc8e);}})[_0x1117('0x25')](function(_0x2cfaa5){if(_0x2cfaa5){_0x2764d2=_0x2cfaa5[_0x1117('0x38')];if(!_0x136a48[_0x1117('0x32')][_0x1117('0x5d')](_0x1117('0x39'))){_0x39bc8e[_0x1117('0x20')]=qs['limit'](_0x136a48['query'][_0x1117('0x20')]);_0x39bc8e[_0x1117('0x1f')]=qs[_0x1117('0x1f')](_0x136a48[_0x1117('0x32')][_0x1117('0x1f')]);}return _0x3d8ad1['getBlackLists'](_0x39bc8e);}})['then'](function(_0x1e5deb){if(_0x1e5deb){return _0x1e5deb?{'count':_0x2764d2,'rows':_0x1e5deb}:null;}})[_0x1117('0x25')](respondWithResult(_0x34d140,null))['catch'](handleError(_0x34d140,null));};exports['addBlackLists']=function(_0x1e38ec,_0x1aa2d4,_0x564fa5){var _0x1f9fba,_0x44a488;return db[_0x1117('0x42')][_0x1117('0x4a')]({'where':{'id':_0x1e38ec['params']['id']}})[_0x1117('0x25')](handleEntityNotFound(_0x1aa2d4,null))['then'](function(_0x5a4168){if(_0x5a4168){_0x44a488=_0x5a4168;return _0x5a4168[_0x1117('0x84')](_0x1e38ec[_0x1117('0x4c')][_0x1117('0x66')],_['omit'](_0x1e38ec[_0x1117('0x4c')],['ids','id'])||{});}return null;})[_0x1117('0x85')](function(_0x3d18f6){var _0x7715a5;_0x1f9fba=_0x3d18f6||[];var _0x425fcb=[];if(_0x3d18f6){for(var _0x3568a3=0x0;_0x3568a3<_0x3d18f6['length'];_0x3568a3+=0x1){var _0x18ac59=_0x3d18f6[_0x3568a3][_0x1117('0x4e')]({'plain':!![]});_0x7715a5=squel['insert']()[_0x1117('0x7d')](_0x1117('0x86'))['fromQuery']([_0x1117('0x6b'),_0x1117('0x6d'),_0x1117('0x6e'),_0x1117('0x5e'),_0x1117('0x54'),'updatedAt'],squel[_0x1117('0x6f')]()[_0x1117('0x70')]('phone','phone')[_0x1117('0x70')]('id',_0x1117('0x6d'))[_0x1117('0x70')](_0x18ac59[_0x1117('0x72')]['toString'](),_0x1117('0x6e'))['field'](_0x1e38ec['params']['id']['toString'](),_0x1117('0x5e'))[_0x1117('0x70')](_0x1117('0x71'),_0x1117('0x54'))[_0x1117('0x70')](_0x1117('0x71'),_0x1117('0x55'))[_0x1117('0x73')]('cm_contacts')[_0x1117('0x3c')](_0x1117('0x74'))[_0x1117('0x3c')]('ListId\x20=\x20?',_0x18ac59[_0x1117('0x72')][_0x1117('0x76')]())[_0x1117('0x3c')](_0x1117('0x7f')))[_0x1117('0x76')]();_0x425fcb[_0x1117('0x80')](db[_0x1117('0x81')][_0x1117('0x32')](_0x7715a5));}return BPromise[_0x1117('0x87')](_0x425fcb);}})[_0x1117('0x25')](function(){return _0x1f9fba;})[_0x1117('0x25')](respondWithResult(_0x1aa2d4,null))['catch'](handleError(_0x1aa2d4,null));};exports[_0x1117('0x88')]=function(_0x448bf0,_0x245c46,_0x2f3375){return db[_0x1117('0x42')][_0x1117('0x4a')]({'where':{'id':_0x448bf0[_0x1117('0x46')]['id']}})['then'](handleEntityNotFound(_0x245c46,null))[_0x1117('0x25')](function(_0x4916ac){if(_0x4916ac){return _0x4916ac[_0x1117('0x88')](_0x448bf0['query']['ids']);}})[_0x1117('0x25')](function(_0x4b0267){if(_0x4b0267){return db[_0x1117('0x62')][_0x1117('0x26')]({'where':{'ListId':_0x448bf0[_0x1117('0x32')][_0x1117('0x66')],'CampaignId':_0x448bf0[_0x1117('0x46')]['id']}})['then'](function(){return _0x4b0267;});}})[_0x1117('0x25')](respondWithStatusCode(_0x245c46,null))[_0x1117('0x4b')](handleError(_0x245c46,null));}; \ No newline at end of file +var _0x7c9d=['cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','limit','Content-Range','apply','reject','save','update','then','destroy','IvrCampaigns','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','offset','order','sort','where','pick','filter','merge','options','Campaign','includeAll','include','findAll','rows','catch','show','params','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','createdAt','userProfileId','getHoppers','findOne','CmHopper','nolimit','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','hasOwnProperty','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from'];(function(_0x1d76dc,_0x66bf80){var _0x371f49=function(_0x37f0e7){while(--_0x37f0e7){_0x1d76dc['push'](_0x1d76dc['shift']());}};_0x371f49(++_0x66bf80);}(_0x7c9d,0x9b));var _0xd7c9=function(_0x1a6947,_0x55ad73){_0x1a6947=_0x1a6947-0x0;var _0x4a0946=_0x7c9d[_0x1a6947];return _0x4a0946;};'use strict';var emlformat=require(_0xd7c9('0x0'));var rimraf=require(_0xd7c9('0x1'));var zipdir=require(_0xd7c9('0x2'));var jsonpatch=require(_0xd7c9('0x3'));var rp=require(_0xd7c9('0x4'));var moment=require(_0xd7c9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd7c9('0x6'));var util=require(_0xd7c9('0x7'));var path=require(_0xd7c9('0x8'));var sox=require(_0xd7c9('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd7c9('0xa'));var _=require(_0xd7c9('0xb'));var squel=require(_0xd7c9('0xc'));var crypto=require(_0xd7c9('0xd'));var jsforce=require(_0xd7c9('0xe'));var deskjs=require(_0xd7c9('0xf'));var toCsv=require(_0xd7c9('0x10'));var querystring=require(_0xd7c9('0x11'));var Papa=require(_0xd7c9('0x12'));var Redis=require(_0xd7c9('0x13'));var authService=require(_0xd7c9('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xd7c9('0x15'));var hardwareService=require(_0xd7c9('0x16'));var logger=require(_0xd7c9('0x17'))(_0xd7c9('0x18'));var utils=require('../../config/utils');var config=require(_0xd7c9('0x19'));var licenseUtil=require(_0xd7c9('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe6b923,_0x5017a4){_0x5017a4=_0x5017a4||0xcc;return function(_0x526656){if(_0x526656){return _0xe6b923[_0xd7c9('0x1b')](_0x5017a4);}return _0xe6b923[_0xd7c9('0x1c')](_0x5017a4)[_0xd7c9('0x1d')]();};}function respondWithResult(_0x55b2c2,_0x4abe21){_0x4abe21=_0x4abe21||0xc8;return function(_0x5abb31){if(_0x5abb31){return _0x55b2c2[_0xd7c9('0x1c')](_0x4abe21)[_0xd7c9('0x1e')](_0x5abb31);}};}function respondWithFilteredResult(_0x39ae62,_0x228188){return function(_0x287069){if(_0x287069){var _0x515b0c=_0x287069[_0xd7c9('0x1f')],_0x59f49d=_0x228188['offset'],_0x527d9e=_0x228188['offset']+_0x228188[_0xd7c9('0x20')],_0x344764;if(_0x527d9e>=_0x515b0c){_0x527d9e=_0x515b0c;_0x344764=0xc8;}else{_0x344764=0xce;}_0x39ae62['status'](_0x344764);return _0x39ae62['set'](_0xd7c9('0x21'),_0x59f49d+'-'+_0x527d9e+'/'+_0x515b0c)[_0xd7c9('0x1e')](_0x287069);}return null;};}function patchUpdates(_0x96e066){return function(_0x228a61){try{jsonpatch[_0xd7c9('0x22')](_0x228a61,_0x96e066,!![]);}catch(_0x1b2a95){return BPromise[_0xd7c9('0x23')](_0x1b2a95);}return _0x228a61[_0xd7c9('0x24')]();};}function saveUpdates(_0x509c00,_0x3efaed){return function(_0x5b900b){if(_0x5b900b){return _0x5b900b[_0xd7c9('0x25')](_0x509c00)[_0xd7c9('0x26')](function(_0x4dc753){return _0x4dc753;});}return null;};}function removeEntity(_0x176883,_0x457eb6){return function(_0x2ec835){if(_0x2ec835){return _0x2ec835[_0xd7c9('0x27')]()['then'](function(){var _0x3ae743=_0x2ec835['get']({'plain':!![]});var _0x4176e7=_0xd7c9('0x28');return db['UserProfileResource'][_0xd7c9('0x27')]({'where':{'type':_0x4176e7,'resourceId':_0x3ae743['id']}})[_0xd7c9('0x26')](function(){return _0x2ec835;});})[_0xd7c9('0x26')](function(){_0x176883['status'](0xcc)[_0xd7c9('0x1d')]();});}};}function handleEntityNotFound(_0x5c657b,_0x511f99){return function(_0x36287c){if(!_0x36287c){_0x5c657b['sendStatus'](0x194);}return _0x36287c;};}function handleError(_0x2e55ec,_0xc124e1){_0xc124e1=_0xc124e1||0x1f4;return function(_0x34643a){logger[_0xd7c9('0x29')](_0x34643a[_0xd7c9('0x2a')]);if(_0x34643a[_0xd7c9('0x2b')]){delete _0x34643a[_0xd7c9('0x2b')];}_0x2e55ec[_0xd7c9('0x1c')](_0xc124e1)[_0xd7c9('0x2c')](_0x34643a);};}exports[_0xd7c9('0x2d')]=function(_0xa79bc4,_0x52a4c8){var _0xc231a0={},_0x1f1fbf={},_0x7f6aab={'count':0x0,'rows':[]};var _0xe17762=_[_0xd7c9('0x2e')](db['Campaign'][_0xd7c9('0x2f')],function(_0x3e3e17){return{'name':_0x3e3e17[_0xd7c9('0x30')],'type':_0x3e3e17['type'][_0xd7c9('0x31')]};});_0x1f1fbf['model']=_[_0xd7c9('0x2e')](_0xe17762,_0xd7c9('0x2b'));_0x1f1fbf[_0xd7c9('0x32')]=_[_0xd7c9('0x33')](_0xa79bc4[_0xd7c9('0x32')]);_0x1f1fbf[_0xd7c9('0x34')]=_[_0xd7c9('0x35')](_0x1f1fbf[_0xd7c9('0x36')],_0x1f1fbf[_0xd7c9('0x32')]);_0xc231a0['attributes']=_[_0xd7c9('0x35')](_0x1f1fbf[_0xd7c9('0x36')],qs['fields'](_0xa79bc4[_0xd7c9('0x32')][_0xd7c9('0x37')]));_0xc231a0['attributes']=_0xc231a0[_0xd7c9('0x38')][_0xd7c9('0x39')]?_0xc231a0[_0xd7c9('0x38')]:_0x1f1fbf['model'];if(!_0xa79bc4['query']['hasOwnProperty']('nolimit')){_0xc231a0[_0xd7c9('0x20')]=qs[_0xd7c9('0x20')](_0xa79bc4[_0xd7c9('0x32')][_0xd7c9('0x20')]);_0xc231a0['offset']=qs['offset'](_0xa79bc4['query'][_0xd7c9('0x3a')]);}_0xc231a0[_0xd7c9('0x3b')]=qs['sort'](_0xa79bc4[_0xd7c9('0x32')][_0xd7c9('0x3c')]);_0xc231a0[_0xd7c9('0x3d')]=qs[_0xd7c9('0x34')](_[_0xd7c9('0x3e')](_0xa79bc4['query'],_0x1f1fbf[_0xd7c9('0x34')]),_0xe17762);if(_0xa79bc4['query'][_0xd7c9('0x3f')]){_0xc231a0[_0xd7c9('0x3d')]=_[_0xd7c9('0x40')](_0xc231a0[_0xd7c9('0x3d')],{'$or':_['map'](_0xe17762,function(_0x159cf4){if(_0x159cf4['type']!=='VIRTUAL'){var _0x259221={};_0x259221[_0x159cf4[_0xd7c9('0x2b')]]={'$like':'%'+_0xa79bc4[_0xd7c9('0x32')][_0xd7c9('0x3f')]+'%'};return _0x259221;}})});}_0xc231a0=_['merge']({},_0xc231a0,_0xa79bc4[_0xd7c9('0x41')]);var _0x3e423d={'where':_0xc231a0[_0xd7c9('0x3d')]};return db[_0xd7c9('0x42')][_0xd7c9('0x1f')](_0x3e423d)[_0xd7c9('0x26')](function(_0x970c23){_0x7f6aab['count']=_0x970c23;if(_0xa79bc4[_0xd7c9('0x32')][_0xd7c9('0x43')]){_0xc231a0[_0xd7c9('0x44')]=[{'all':!![]}];}return db[_0xd7c9('0x42')][_0xd7c9('0x45')](_0xc231a0);})[_0xd7c9('0x26')](function(_0x46adbd){_0x7f6aab[_0xd7c9('0x46')]=_0x46adbd;return _0x7f6aab;})[_0xd7c9('0x26')](respondWithFilteredResult(_0x52a4c8,_0xc231a0))[_0xd7c9('0x47')](handleError(_0x52a4c8,null));};exports[_0xd7c9('0x48')]=function(_0x3d9a21,_0x476bc0){var _0x4eeb42={'raw':![],'where':{'id':_0x3d9a21[_0xd7c9('0x49')]['id']}},_0x47deab={};_0x47deab[_0xd7c9('0x36')]=_[_0xd7c9('0x33')](db[_0xd7c9('0x42')]['rawAttributes']);_0x47deab[_0xd7c9('0x32')]=_[_0xd7c9('0x33')](_0x3d9a21[_0xd7c9('0x32')]);_0x47deab[_0xd7c9('0x34')]=_[_0xd7c9('0x35')](_0x47deab[_0xd7c9('0x36')],_0x47deab[_0xd7c9('0x32')]);_0x4eeb42[_0xd7c9('0x38')]=_[_0xd7c9('0x35')](_0x47deab[_0xd7c9('0x36')],qs[_0xd7c9('0x37')](_0x3d9a21[_0xd7c9('0x32')]['fields']));_0x4eeb42['attributes']=_0x4eeb42[_0xd7c9('0x38')][_0xd7c9('0x39')]?_0x4eeb42['attributes']:_0x47deab['model'];if(_0x3d9a21[_0xd7c9('0x32')][_0xd7c9('0x43')]){_0x4eeb42['include']=[{'all':!![]}];}_0x4eeb42=_[_0xd7c9('0x40')]({},_0x4eeb42,_0x3d9a21['options']);return db['Campaign']['find'](_0x4eeb42)['then'](handleEntityNotFound(_0x476bc0,null))[_0xd7c9('0x26')](respondWithResult(_0x476bc0,null))[_0xd7c9('0x47')](handleError(_0x476bc0,null));};exports[_0xd7c9('0x4a')]=function(_0x4615ca,_0x5819ed){return db[_0xd7c9('0x42')]['create'](_0x4615ca['body'],{})[_0xd7c9('0x26')](function(_0x5bad88){var _0x285873=_0x4615ca[_0xd7c9('0x4b')][_0xd7c9('0x4c')]({'plain':!![]});if(!_0x285873)throw new Error(_0xd7c9('0x4d'));if(_0x285873[_0xd7c9('0x4e')]==='user'){var _0x46faec=_0x5bad88['get']({'plain':!![]});var _0x27b4e0=_0xd7c9('0x28');return db[_0xd7c9('0x4f')][_0xd7c9('0x50')]({'where':{'name':_0x27b4e0,'userProfileId':_0x285873['userProfileId']},'raw':!![]})[_0xd7c9('0x26')](function(_0x246a90){if(_0x246a90&&_0x246a90[_0xd7c9('0x51')]===0x0){return db[_0xd7c9('0x52')][_0xd7c9('0x4a')]({'name':_0x46faec[_0xd7c9('0x2b')],'resourceId':_0x46faec['id'],'type':_0x246a90[_0xd7c9('0x2b')],'sectionId':_0x246a90['id']},{})[_0xd7c9('0x26')](function(){return _0x5bad88;});}else{return _0x5bad88;}})[_0xd7c9('0x47')](function(_0x4482a1){logger[_0xd7c9('0x29')](_0xd7c9('0x53'),_0x4482a1);throw _0x4482a1;});}return _0x5bad88;})[_0xd7c9('0x26')](respondWithResult(_0x5819ed,0xc9))['catch'](handleError(_0x5819ed,null));};exports[_0xd7c9('0x54')]=function(_0x26c4f6,_0x324f8d){var _0x20430={'where':{'id':_0x26c4f6[_0xd7c9('0x49')]['id']}},_0x51e613={};_0x51e613['model']=_[_0xd7c9('0x33')](db[_0xd7c9('0x42')][_0xd7c9('0x2f')]);_0x20430[_0xd7c9('0x38')]=_[_0xd7c9('0x35')](_0x51e613[_0xd7c9('0x36')],qs[_0xd7c9('0x37')](_0x26c4f6[_0xd7c9('0x32')]['fields']));_0x20430[_0xd7c9('0x38')]=_0x20430[_0xd7c9('0x38')][_0xd7c9('0x39')]?_0x20430[_0xd7c9('0x38')]:_0x51e613['model'];if(_0x26c4f6[_0xd7c9('0x32')][_0xd7c9('0x43')]){_0x20430[_0xd7c9('0x44')]=[{'all':!![]}];}_0x20430=_['merge']({},_0x20430,_0x26c4f6[_0xd7c9('0x41')]);return db[_0xd7c9('0x42')][_0xd7c9('0x50')](_0x20430)[_0xd7c9('0x26')](handleEntityNotFound(_0x324f8d,null))[_0xd7c9('0x26')](function(_0x3a6d53){if(_0x3a6d53){var _0x43ad28=_0x3a6d53[_0xd7c9('0x4c')]({'plain':!![]});_0x43ad28=qs[_0xd7c9('0x55')](_0x43ad28,['id','createdAt',_0xd7c9('0x56')]);_0x26c4f6[_0xd7c9('0x57')]=_['omit'](_0x26c4f6[_0xd7c9('0x57')],['id',_0xd7c9('0x58'),_0xd7c9('0x56')]);return db[_0xd7c9('0x42')]['create'](_['merge'](_0x43ad28,_0x26c4f6[_0xd7c9('0x57')]),{'include':_0x26c4f6[_0xd7c9('0x32')][_0xd7c9('0x43')]?[{'all':!![]}]:undefined})[_0xd7c9('0x26')](function(_0x372de3){var _0x50d625=_0x26c4f6[_0xd7c9('0x4b')][_0xd7c9('0x4c')]({'plain':!![]});if(!_0x50d625)throw new Error(_0xd7c9('0x4d'));if(_0x50d625['role']==='user'){var _0x4a11a9=_0x372de3[_0xd7c9('0x4c')]({'plain':!![]});var _0x368ccb=_0xd7c9('0x28');return db[_0xd7c9('0x4f')][_0xd7c9('0x50')]({'where':{'name':_0x368ccb,'userProfileId':_0x50d625[_0xd7c9('0x59')]},'raw':!![]})[_0xd7c9('0x26')](function(_0x436745){if(_0x436745&&_0x436745[_0xd7c9('0x51')]===0x0){return db[_0xd7c9('0x52')]['create']({'name':_0x4a11a9[_0xd7c9('0x2b')],'resourceId':_0x4a11a9['id'],'type':_0x436745[_0xd7c9('0x2b')],'sectionId':_0x436745['id']},{})[_0xd7c9('0x26')](function(){return _0x372de3;});}else{return _0x372de3;}})[_0xd7c9('0x47')](function(_0x20e31e){logger[_0xd7c9('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20e31e);throw _0x20e31e;});}return _0x372de3;});}})[_0xd7c9('0x26')](respondWithResult(_0x324f8d,0xc9))[_0xd7c9('0x47')](handleError(_0x324f8d,null));};exports[_0xd7c9('0x25')]=function(_0x3fdf83,_0x1acc02){if(_0x3fdf83[_0xd7c9('0x57')]['id']){delete _0x3fdf83[_0xd7c9('0x57')]['id'];}return db['Campaign'][_0xd7c9('0x50')]({'where':{'id':_0x3fdf83[_0xd7c9('0x49')]['id']}})[_0xd7c9('0x26')](handleEntityNotFound(_0x1acc02,null))['then'](saveUpdates(_0x3fdf83[_0xd7c9('0x57')],null))['then'](respondWithResult(_0x1acc02,null))['catch'](handleError(_0x1acc02,null));};exports[_0xd7c9('0x27')]=function(_0xf01884,_0x45e88f){return db[_0xd7c9('0x42')]['find']({'where':{'id':_0xf01884['params']['id']}})[_0xd7c9('0x26')](handleEntityNotFound(_0x45e88f,null))[_0xd7c9('0x26')](removeEntity(_0x45e88f,null))[_0xd7c9('0x47')](handleError(_0x45e88f,null));};exports[_0xd7c9('0x5a')]=function(_0x6ea635,_0x38916f,_0x20ebf8){var _0x1025c8={'raw':!![],'where':{}};var _0x2defa4={};var _0x2680d4={'count':0x0,'rows':[]};return db[_0xd7c9('0x42')][_0xd7c9('0x5b')]({'where':{'id':_0x6ea635[_0xd7c9('0x49')]['id']}})[_0xd7c9('0x26')](handleEntityNotFound(_0x38916f,null))[_0xd7c9('0x26')](function(_0x53106f){if(_0x53106f){_0x2defa4[_0xd7c9('0x36')]=_[_0xd7c9('0x33')](db[_0xd7c9('0x5c')][_0xd7c9('0x2f')]);_0x2defa4[_0xd7c9('0x32')]=_[_0xd7c9('0x33')](_0x6ea635[_0xd7c9('0x32')]);_0x2defa4[_0xd7c9('0x34')]=_[_0xd7c9('0x35')](_0x2defa4['model'],_0x2defa4[_0xd7c9('0x32')]);_0x1025c8['attributes']=_[_0xd7c9('0x35')](_0x2defa4[_0xd7c9('0x36')],qs['fields'](_0x6ea635[_0xd7c9('0x32')]['fields']));_0x1025c8[_0xd7c9('0x38')]=_0x1025c8[_0xd7c9('0x38')]['length']?_0x1025c8[_0xd7c9('0x38')]:_0x2defa4[_0xd7c9('0x36')];if(!_0x6ea635[_0xd7c9('0x32')]['hasOwnProperty'](_0xd7c9('0x5d'))){_0x1025c8[_0xd7c9('0x20')]=qs[_0xd7c9('0x20')](_0x6ea635[_0xd7c9('0x32')][_0xd7c9('0x20')]);_0x1025c8['offset']=qs['offset'](_0x6ea635[_0xd7c9('0x32')]['offset']);}_0x1025c8['order']=qs[_0xd7c9('0x3c')](_0x6ea635['query']['sort']);_0x1025c8[_0xd7c9('0x3d')]=qs[_0xd7c9('0x34')](_[_0xd7c9('0x3e')](_0x6ea635[_0xd7c9('0x32')],_0x2defa4[_0xd7c9('0x34')]));_0x1025c8[_0xd7c9('0x3d')][_0xd7c9('0x5e')]=_0x53106f['id'];if(_0x6ea635[_0xd7c9('0x32')]['filter']){_0x1025c8[_0xd7c9('0x3d')]=_[_0xd7c9('0x40')](_0x1025c8[_0xd7c9('0x3d')],{'$or':_[_0xd7c9('0x2e')](_0x1025c8[_0xd7c9('0x38')],function(_0x35a1d8){var _0x5ca2fa={};_0x5ca2fa[_0x35a1d8]={'$like':'%'+_0x6ea635['query']['filter']+'%'};return _0x5ca2fa;})});}_0x1025c8=_['merge']({},_0x1025c8,_0x6ea635[_0xd7c9('0x41')]);return db['CmHopper'][_0xd7c9('0x1f')]({'where':_0x1025c8[_0xd7c9('0x3d')]})[_0xd7c9('0x26')](function(_0x1e3fcb){_0x2680d4['count']=_0x1e3fcb;if(_0x6ea635[_0xd7c9('0x32')][_0xd7c9('0x43')]){_0x1025c8[_0xd7c9('0x44')]=[{'all':!![]}];}return db['CmHopper'][_0xd7c9('0x45')](_0x1025c8);})[_0xd7c9('0x26')](function(_0x248ca4){_0x2680d4[_0xd7c9('0x46')]=_0x248ca4;return _0x2680d4;});}})[_0xd7c9('0x26')](respondWithFilteredResult(_0x38916f,_0x1025c8))[_0xd7c9('0x47')](handleError(_0x38916f,null));};exports[_0xd7c9('0x5f')]=function(_0x29f231,_0x3f3832,_0x272447){var _0x425150={'raw':!![],'where':{}};var _0x3cc5d8={};var _0x3d220a={'count':0x0,'rows':[]};return db[_0xd7c9('0x42')][_0xd7c9('0x5b')]({'where':{'id':_0x29f231[_0xd7c9('0x49')]['id']}})[_0xd7c9('0x26')](handleEntityNotFound(_0x3f3832,null))[_0xd7c9('0x26')](function(_0xf76dee){if(_0xf76dee){_0x3cc5d8['model']=_[_0xd7c9('0x33')](db['CmHopperHistory'][_0xd7c9('0x2f')]);_0x3cc5d8[_0xd7c9('0x32')]=_[_0xd7c9('0x33')](_0x29f231['query']);_0x3cc5d8[_0xd7c9('0x34')]=_['intersection'](_0x3cc5d8[_0xd7c9('0x36')],_0x3cc5d8[_0xd7c9('0x32')]);_0x425150[_0xd7c9('0x38')]=_['intersection'](_0x3cc5d8[_0xd7c9('0x36')],qs['fields'](_0x29f231[_0xd7c9('0x32')][_0xd7c9('0x37')]));_0x425150[_0xd7c9('0x38')]=_0x425150[_0xd7c9('0x38')]['length']?_0x425150[_0xd7c9('0x38')]:_0x3cc5d8[_0xd7c9('0x36')];if(!_0x29f231[_0xd7c9('0x32')]['hasOwnProperty'](_0xd7c9('0x5d'))){_0x425150[_0xd7c9('0x20')]=qs[_0xd7c9('0x20')](_0x29f231[_0xd7c9('0x32')][_0xd7c9('0x20')]);_0x425150[_0xd7c9('0x3a')]=qs[_0xd7c9('0x3a')](_0x29f231[_0xd7c9('0x32')][_0xd7c9('0x3a')]);}_0x425150[_0xd7c9('0x3b')]=qs['sort'](_0x29f231[_0xd7c9('0x32')][_0xd7c9('0x3c')]);_0x425150[_0xd7c9('0x3d')]=qs[_0xd7c9('0x34')](_[_0xd7c9('0x3e')](_0x29f231['query'],_0x3cc5d8[_0xd7c9('0x34')]));_0x425150[_0xd7c9('0x3d')]['CampaignId']=_0xf76dee['id'];if(_0x29f231[_0xd7c9('0x32')][_0xd7c9('0x3f')]){_0x425150[_0xd7c9('0x3d')]=_['merge'](_0x425150[_0xd7c9('0x3d')],{'$or':_[_0xd7c9('0x2e')](_0x425150['attributes'],function(_0x219f01){var _0x41bc6b={};_0x41bc6b[_0x219f01]={'$like':'%'+_0x29f231[_0xd7c9('0x32')]['filter']+'%'};return _0x41bc6b;})});}_0x425150=_[_0xd7c9('0x40')]({},_0x425150,_0x29f231[_0xd7c9('0x41')]);return db[_0xd7c9('0x60')]['count']({'where':_0x425150[_0xd7c9('0x3d')]})[_0xd7c9('0x26')](function(_0x312c33){_0x3d220a[_0xd7c9('0x1f')]=_0x312c33;if(_0x29f231[_0xd7c9('0x32')]['includeAll']){_0x425150[_0xd7c9('0x44')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xd7c9('0x45')](_0x425150);})['then'](function(_0x498b27){_0x3d220a['rows']=_0x498b27;return _0x3d220a;});}})[_0xd7c9('0x26')](respondWithFilteredResult(_0x3f3832,_0x425150))[_0xd7c9('0x47')](handleError(_0x3f3832,null));};exports[_0xd7c9('0x61')]=function(_0x105ad1,_0x70f9d7,_0x1fdaa7){var _0x2ffadc={'raw':!![],'where':{}};var _0x237d53={};var _0x38698e={'count':0x0,'rows':[]};return db['Campaign'][_0xd7c9('0x5b')]({'where':{'id':_0x105ad1['params']['id']}})[_0xd7c9('0x26')](handleEntityNotFound(_0x70f9d7,null))['then'](function(_0x4065ab){if(_0x4065ab){_0x237d53[_0xd7c9('0x36')]=_[_0xd7c9('0x33')](db[_0xd7c9('0x62')]['rawAttributes']);_0x237d53[_0xd7c9('0x32')]=_['keys'](_0x105ad1['query']);_0x237d53[_0xd7c9('0x34')]=_[_0xd7c9('0x35')](_0x237d53[_0xd7c9('0x36')],_0x237d53[_0xd7c9('0x32')]);_0x2ffadc[_0xd7c9('0x38')]=_[_0xd7c9('0x35')](_0x237d53[_0xd7c9('0x36')],qs[_0xd7c9('0x37')](_0x105ad1[_0xd7c9('0x32')]['fields']));_0x2ffadc[_0xd7c9('0x38')]=_0x2ffadc[_0xd7c9('0x38')][_0xd7c9('0x39')]?_0x2ffadc['attributes']:_0x237d53[_0xd7c9('0x36')];if(!_0x105ad1[_0xd7c9('0x32')]['hasOwnProperty'](_0xd7c9('0x5d'))){_0x2ffadc[_0xd7c9('0x20')]=qs[_0xd7c9('0x20')](_0x105ad1[_0xd7c9('0x32')][_0xd7c9('0x20')]);_0x2ffadc[_0xd7c9('0x3a')]=qs[_0xd7c9('0x3a')](_0x105ad1[_0xd7c9('0x32')][_0xd7c9('0x3a')]);}_0x2ffadc['order']=qs[_0xd7c9('0x3c')](_0x105ad1['query'][_0xd7c9('0x3c')]);_0x2ffadc[_0xd7c9('0x3d')]=qs[_0xd7c9('0x34')](_[_0xd7c9('0x3e')](_0x105ad1[_0xd7c9('0x32')],_0x237d53[_0xd7c9('0x34')]));_0x2ffadc[_0xd7c9('0x3d')][_0xd7c9('0x5e')]=_0x4065ab['id'];if(_0x105ad1[_0xd7c9('0x32')]['filter']){_0x2ffadc[_0xd7c9('0x3d')]=_[_0xd7c9('0x40')](_0x2ffadc[_0xd7c9('0x3d')],{'$or':_['map'](_0x2ffadc[_0xd7c9('0x38')],function(_0xebb581){var _0x960e71={};_0x960e71[_0xebb581]={'$like':'%'+_0x105ad1[_0xd7c9('0x32')][_0xd7c9('0x3f')]+'%'};return _0x960e71;})});}_0x2ffadc=_[_0xd7c9('0x40')]({},_0x2ffadc,_0x105ad1[_0xd7c9('0x41')]);return db[_0xd7c9('0x62')][_0xd7c9('0x1f')]({'where':_0x2ffadc['where']})[_0xd7c9('0x26')](function(_0x3455c5){_0x38698e[_0xd7c9('0x1f')]=_0x3455c5;if(_0x105ad1[_0xd7c9('0x32')][_0xd7c9('0x43')]){_0x2ffadc['include']=[{'all':!![]}];}return db[_0xd7c9('0x62')]['findAll'](_0x2ffadc);})[_0xd7c9('0x26')](function(_0x55a75e){_0x38698e[_0xd7c9('0x46')]=_0x55a75e;return _0x38698e;});}})[_0xd7c9('0x26')](respondWithFilteredResult(_0x70f9d7,_0x2ffadc))[_0xd7c9('0x47')](handleError(_0x70f9d7,null));};exports[_0xd7c9('0x63')]=function(_0x3fd89f,_0x3f6d97,_0xf78b22){var _0x20be6d={'raw':!![],'where':{}};var _0x4024e9={};var _0x54f546={'count':0x0,'rows':[]};return db[_0xd7c9('0x42')]['findOne']({'where':{'id':_0x3fd89f[_0xd7c9('0x49')]['id']}})[_0xd7c9('0x26')](handleEntityNotFound(_0x3f6d97,null))[_0xd7c9('0x26')](function(_0x3f8915){if(_0x3f8915){_0x4024e9[_0xd7c9('0x36')]=_[_0xd7c9('0x33')](db[_0xd7c9('0x64')][_0xd7c9('0x2f')]);_0x4024e9[_0xd7c9('0x32')]=_[_0xd7c9('0x33')](_0x3fd89f[_0xd7c9('0x32')]);_0x4024e9[_0xd7c9('0x34')]=_[_0xd7c9('0x35')](_0x4024e9['model'],_0x4024e9[_0xd7c9('0x32')]);_0x20be6d[_0xd7c9('0x38')]=_[_0xd7c9('0x35')](_0x4024e9[_0xd7c9('0x36')],qs[_0xd7c9('0x37')](_0x3fd89f['query'][_0xd7c9('0x37')]));_0x20be6d[_0xd7c9('0x38')]=_0x20be6d[_0xd7c9('0x38')]['length']?_0x20be6d['attributes']:_0x4024e9[_0xd7c9('0x36')];if(!_0x3fd89f[_0xd7c9('0x32')]['hasOwnProperty'](_0xd7c9('0x5d'))){_0x20be6d[_0xd7c9('0x20')]=qs[_0xd7c9('0x20')](_0x3fd89f['query'][_0xd7c9('0x20')]);_0x20be6d[_0xd7c9('0x3a')]=qs[_0xd7c9('0x3a')](_0x3fd89f[_0xd7c9('0x32')]['offset']);}_0x20be6d[_0xd7c9('0x3b')]=qs[_0xd7c9('0x3c')](_0x3fd89f[_0xd7c9('0x32')][_0xd7c9('0x3c')]);_0x20be6d['where']=qs[_0xd7c9('0x34')](_[_0xd7c9('0x3e')](_0x3fd89f[_0xd7c9('0x32')],_0x4024e9[_0xd7c9('0x34')]));_0x20be6d[_0xd7c9('0x3d')][_0xd7c9('0x5e')]=_0x3f8915['id'];if(_0x3fd89f[_0xd7c9('0x32')][_0xd7c9('0x3f')]){_0x20be6d[_0xd7c9('0x3d')]=_['merge'](_0x20be6d[_0xd7c9('0x3d')],{'$or':_['map'](_0x20be6d[_0xd7c9('0x38')],function(_0xcfe359){var _0xbae2b={};_0xbae2b[_0xcfe359]={'$like':'%'+_0x3fd89f[_0xd7c9('0x32')][_0xd7c9('0x3f')]+'%'};return _0xbae2b;})});}_0x20be6d=_[_0xd7c9('0x40')]({},_0x20be6d,_0x3fd89f[_0xd7c9('0x41')]);return db[_0xd7c9('0x64')][_0xd7c9('0x1f')]({'where':_0x20be6d['where']})['then'](function(_0x532fe7){_0x54f546[_0xd7c9('0x1f')]=_0x532fe7;if(_0x3fd89f[_0xd7c9('0x32')][_0xd7c9('0x43')]){_0x20be6d[_0xd7c9('0x44')]=[{'all':!![]}];}return db[_0xd7c9('0x64')][_0xd7c9('0x45')](_0x20be6d);})[_0xd7c9('0x26')](function(_0x22063e){_0x54f546[_0xd7c9('0x46')]=_0x22063e;return _0x54f546;});}})[_0xd7c9('0x26')](respondWithFilteredResult(_0x3f6d97,_0x20be6d))[_0xd7c9('0x47')](handleError(_0x3f6d97,null));};exports['getLists']=function(_0x3a6f03,_0x1f14f3,_0x52eec2){var _0x5d1988={};var _0x4eddac={};var _0x1aa650;var _0xa51687;return db[_0xd7c9('0x42')][_0xd7c9('0x5b')]({'where':{'id':_0x3a6f03['params']['id']}})[_0xd7c9('0x26')](handleEntityNotFound(_0x1f14f3,null))[_0xd7c9('0x26')](function(_0x2a80ad){if(_0x2a80ad){_0x1aa650=_0x2a80ad;_0x4eddac[_0xd7c9('0x36')]=_[_0xd7c9('0x33')](db['CmList']['rawAttributes']);_0x4eddac['query']=_[_0xd7c9('0x33')](_0x3a6f03[_0xd7c9('0x32')]);_0x4eddac[_0xd7c9('0x34')]=_[_0xd7c9('0x35')](_0x4eddac[_0xd7c9('0x36')],_0x4eddac[_0xd7c9('0x32')]);_0x5d1988[_0xd7c9('0x38')]=_[_0xd7c9('0x35')](_0x4eddac['model'],qs[_0xd7c9('0x37')](_0x3a6f03['query']['fields']));_0x5d1988[_0xd7c9('0x38')]=_0x5d1988[_0xd7c9('0x38')][_0xd7c9('0x39')]?_0x5d1988[_0xd7c9('0x38')]:_0x4eddac[_0xd7c9('0x36')];_0x5d1988[_0xd7c9('0x3b')]=qs[_0xd7c9('0x3c')](_0x3a6f03[_0xd7c9('0x32')][_0xd7c9('0x3c')]);_0x5d1988[_0xd7c9('0x3d')]=qs[_0xd7c9('0x34')](_[_0xd7c9('0x3e')](_0x3a6f03[_0xd7c9('0x32')],_0x4eddac[_0xd7c9('0x34')]));if(_0x3a6f03[_0xd7c9('0x32')][_0xd7c9('0x3f')]){_0x5d1988[_0xd7c9('0x3d')]=_[_0xd7c9('0x40')](_0x5d1988['where'],{'$or':_[_0xd7c9('0x2e')](_0x5d1988[_0xd7c9('0x38')],function(_0x443f99){var _0x25e9ab={};_0x25e9ab[_0x443f99]={'$like':'%'+_0x3a6f03['query'][_0xd7c9('0x3f')]+'%'};return _0x25e9ab;})});}_0x5d1988=_[_0xd7c9('0x40')]({},_0x5d1988,_0x3a6f03[_0xd7c9('0x41')]);return _0x1aa650[_0xd7c9('0x65')](_0x5d1988);}})[_0xd7c9('0x26')](function(_0x165517){if(_0x165517){_0xa51687=_0x165517[_0xd7c9('0x39')];if(!_0x3a6f03[_0xd7c9('0x32')][_0xd7c9('0x66')](_0xd7c9('0x5d'))){_0x5d1988['limit']=qs[_0xd7c9('0x20')](_0x3a6f03[_0xd7c9('0x32')][_0xd7c9('0x20')]);_0x5d1988[_0xd7c9('0x3a')]=qs[_0xd7c9('0x3a')](_0x3a6f03['query'][_0xd7c9('0x3a')]);}return _0x1aa650[_0xd7c9('0x65')](_0x5d1988);}})['then'](function(_0x1d30ac){if(_0x1d30ac){return _0x1d30ac?{'count':_0xa51687,'rows':_0x1d30ac}:null;}})[_0xd7c9('0x26')](respondWithResult(_0x1f14f3,null))['catch'](handleError(_0x1f14f3,null));};exports[_0xd7c9('0x67')]=function(_0x34bbf9,_0x3e2456,_0x20b4e7){var _0x40db21,_0x4d6b87;return db[_0xd7c9('0x42')][_0xd7c9('0x50')]({'where':{'id':_0x34bbf9[_0xd7c9('0x49')]['id']}})[_0xd7c9('0x26')](handleEntityNotFound(_0x3e2456,null))[_0xd7c9('0x26')](function(_0x4e3de4){if(_0x4e3de4){_0x4d6b87=_0x4e3de4;return _0x4e3de4[_0xd7c9('0x67')](_0x34bbf9[_0xd7c9('0x57')][_0xd7c9('0x68')],_[_0xd7c9('0x55')](_0x34bbf9[_0xd7c9('0x57')],[_0xd7c9('0x68'),'id'])||{});}return null;})[_0xd7c9('0x69')](function(_0x5b3418){var _0xd2c9cf;_0x40db21=_0x5b3418||[];var _0x49da18=[];if(_0x5b3418){for(var _0x22e168=0x0;_0x22e168<_0x5b3418[_0xd7c9('0x39')];_0x22e168+=0x1){var _0x3b2d0b=_0x5b3418[_0x22e168][_0xd7c9('0x4c')]({'plain':!![]});_0x4d6b87['dialCheckDuplicateType']=_0x34bbf9[_0xd7c9('0x57')][_0xd7c9('0x6a')]?_0x34bbf9[_0xd7c9('0x57')]['dialCheckDuplicateType']:_0x4d6b87[_0xd7c9('0x6a')];switch(_0x4d6b87['dialCheckDuplicateType']){case _0xd7c9('0x6b'):_0xd2c9cf=squel[_0xd7c9('0x6c')]()[_0xd7c9('0x6d')]('cm_hopper')[_0xd7c9('0x6e')]([_0xd7c9('0x6f'),_0xd7c9('0x70'),_0xd7c9('0x71'),_0xd7c9('0x72'),'CampaignId',_0xd7c9('0x58'),_0xd7c9('0x56')],squel[_0xd7c9('0x73')]()[_0xd7c9('0x74')]('phone','phone')[_0xd7c9('0x74')](_0xd7c9('0x75'),_0xd7c9('0x70'))[_0xd7c9('0x74')]('id',_0xd7c9('0x71'))[_0xd7c9('0x74')](_0x3b2d0b[_0xd7c9('0x76')][_0xd7c9('0x77')](),_0xd7c9('0x72'))[_0xd7c9('0x74')](_0x34bbf9['params']['id'][_0xd7c9('0x77')](),'CampaignId')[_0xd7c9('0x74')](_0xd7c9('0x75'),_0xd7c9('0x58'))[_0xd7c9('0x74')]('NOW()',_0xd7c9('0x56'))[_0xd7c9('0x78')](_0xd7c9('0x79'))['where'](_0xd7c9('0x7a'))[_0xd7c9('0x3d')]('ListId\x20=\x20?',_0x3b2d0b[_0xd7c9('0x76')][_0xd7c9('0x77')]())[_0xd7c9('0x3d')](_0xd7c9('0x7b'))[_0xd7c9('0x3d')](_0xd7c9('0x7c'),squel[_0xd7c9('0x73')]()[_0xd7c9('0x74')](_0xd7c9('0x7d'))[_0xd7c9('0x78')](_0xd7c9('0x7e'))[_0xd7c9('0x3d')](_0xd7c9('0x7f'),_0x34bbf9[_0xd7c9('0x49')]['id'][_0xd7c9('0x77')]()))['where'](_0xd7c9('0x7c'),squel['select']()[_0xd7c9('0x74')](_0xd7c9('0x80'))[_0xd7c9('0x78')]('cm_hopper')[_0xd7c9('0x3d')](_0xd7c9('0x7f'),_0x34bbf9['params']['id'][_0xd7c9('0x77')]())))[_0xd7c9('0x77')]();break;case'onlyIfOpen':_0xd2c9cf=squel[_0xd7c9('0x6c')]()[_0xd7c9('0x6d')](_0xd7c9('0x81'))['fromQuery']([_0xd7c9('0x6f'),_0xd7c9('0x70'),_0xd7c9('0x71'),_0xd7c9('0x72'),_0xd7c9('0x5e'),_0xd7c9('0x58'),_0xd7c9('0x56')],squel[_0xd7c9('0x73')]()['field'](_0xd7c9('0x6f'),_0xd7c9('0x6f'))[_0xd7c9('0x74')](_0xd7c9('0x75'),_0xd7c9('0x70'))['field']('id','ContactId')['field'](_0x3b2d0b[_0xd7c9('0x76')][_0xd7c9('0x77')](),_0xd7c9('0x72'))[_0xd7c9('0x74')](_0x34bbf9[_0xd7c9('0x49')]['id'][_0xd7c9('0x77')](),'CampaignId')[_0xd7c9('0x74')]('NOW()',_0xd7c9('0x58'))[_0xd7c9('0x74')]('NOW()','updatedAt')[_0xd7c9('0x78')](_0xd7c9('0x79'))[_0xd7c9('0x3d')](_0xd7c9('0x7a'))[_0xd7c9('0x3d')]('ListId\x20=\x20?',_0x3b2d0b[_0xd7c9('0x76')][_0xd7c9('0x77')]())[_0xd7c9('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0xd7c9('0x3d')](_0xd7c9('0x7c'),squel[_0xd7c9('0x73')]()[_0xd7c9('0x74')](_0xd7c9('0x80'))[_0xd7c9('0x78')](_0xd7c9('0x81'))['where'](_0xd7c9('0x7f'),_0x34bbf9[_0xd7c9('0x49')]['id'][_0xd7c9('0x77')]())))[_0xd7c9('0x77')]();break;default:_0xd2c9cf=squel[_0xd7c9('0x6c')]()['into'](_0xd7c9('0x81'))[_0xd7c9('0x6e')](['phone',_0xd7c9('0x70'),_0xd7c9('0x71'),'ListId',_0xd7c9('0x5e'),_0xd7c9('0x58'),_0xd7c9('0x56')],squel['select']()[_0xd7c9('0x74')]('phone',_0xd7c9('0x6f'))['field'](_0xd7c9('0x75'),_0xd7c9('0x70'))[_0xd7c9('0x74')]('id',_0xd7c9('0x71'))[_0xd7c9('0x74')](_0x3b2d0b[_0xd7c9('0x76')][_0xd7c9('0x77')](),_0xd7c9('0x72'))[_0xd7c9('0x74')](_0x34bbf9[_0xd7c9('0x49')]['id'][_0xd7c9('0x77')](),_0xd7c9('0x5e'))[_0xd7c9('0x74')]('NOW()','createdAt')['field'](_0xd7c9('0x75'),_0xd7c9('0x56'))[_0xd7c9('0x78')](_0xd7c9('0x79'))['where']('deletedAt\x20IS\x20NULL')[_0xd7c9('0x3d')]('ListId\x20=\x20?',_0x3b2d0b[_0xd7c9('0x76')][_0xd7c9('0x77')]())[_0xd7c9('0x3d')](_0xd7c9('0x7b')))[_0xd7c9('0x77')]();}_0x49da18[_0xd7c9('0x82')](db[_0xd7c9('0x83')][_0xd7c9('0x32')](_0xd2c9cf));}return BPromise[_0xd7c9('0x84')](_0x49da18);}})[_0xd7c9('0x26')](function(){return _0x40db21;})[_0xd7c9('0x26')](respondWithResult(_0x3e2456,null))['catch'](handleError(_0x3e2456,null));};exports['removeLists']=function(_0x189176,_0x4871e3,_0x4043c6){return db[_0xd7c9('0x42')][_0xd7c9('0x50')]({'where':{'id':_0x189176[_0xd7c9('0x49')]['id']}})['then'](handleEntityNotFound(_0x4871e3,null))[_0xd7c9('0x26')](function(_0x1c11a5){if(_0x1c11a5){return _0x1c11a5[_0xd7c9('0x85')](_0x189176[_0xd7c9('0x32')][_0xd7c9('0x68')]);}})[_0xd7c9('0x26')](function(_0x4c1484){if(_0x4c1484){return db[_0xd7c9('0x5c')][_0xd7c9('0x27')]({'where':{'ListId':_0x189176[_0xd7c9('0x32')][_0xd7c9('0x68')],'CampaignId':_0x189176[_0xd7c9('0x49')]['id']}})['then'](function(){return _0x4c1484;});}})[_0xd7c9('0x26')](respondWithStatusCode(_0x4871e3,null))[_0xd7c9('0x47')](handleError(_0x4871e3,null));};exports[_0xd7c9('0x86')]=function(_0x42b761,_0x8fc2bc,_0x383e1d){var _0x507223={};var _0x4e64be={};var _0x57f708;var _0x4b5707;return db[_0xd7c9('0x42')]['findOne']({'where':{'id':_0x42b761[_0xd7c9('0x49')]['id']}})['then'](handleEntityNotFound(_0x8fc2bc,null))[_0xd7c9('0x26')](function(_0x2b4813){if(_0x2b4813){_0x57f708=_0x2b4813;_0x4e64be[_0xd7c9('0x36')]=_[_0xd7c9('0x33')](db['CmList']['rawAttributes']);_0x4e64be[_0xd7c9('0x32')]=_[_0xd7c9('0x33')](_0x42b761[_0xd7c9('0x32')]);_0x4e64be['filters']=_[_0xd7c9('0x35')](_0x4e64be[_0xd7c9('0x36')],_0x4e64be[_0xd7c9('0x32')]);_0x507223[_0xd7c9('0x38')]=_[_0xd7c9('0x35')](_0x4e64be[_0xd7c9('0x36')],qs[_0xd7c9('0x37')](_0x42b761[_0xd7c9('0x32')][_0xd7c9('0x37')]));_0x507223[_0xd7c9('0x38')]=_0x507223[_0xd7c9('0x38')][_0xd7c9('0x39')]?_0x507223['attributes']:_0x4e64be[_0xd7c9('0x36')];_0x507223['order']=qs['sort'](_0x42b761[_0xd7c9('0x32')][_0xd7c9('0x3c')]);_0x507223[_0xd7c9('0x3d')]=qs['filters'](_[_0xd7c9('0x3e')](_0x42b761['query'],_0x4e64be['filters']));if(_0x42b761[_0xd7c9('0x32')][_0xd7c9('0x3f')]){_0x507223[_0xd7c9('0x3d')]=_['merge'](_0x507223[_0xd7c9('0x3d')],{'$or':_['map'](_0x507223[_0xd7c9('0x38')],function(_0x55b01f){var _0x2da488={};_0x2da488[_0x55b01f]={'$like':'%'+_0x42b761[_0xd7c9('0x32')]['filter']+'%'};return _0x2da488;})});}_0x507223=_[_0xd7c9('0x40')]({},_0x507223,_0x42b761[_0xd7c9('0x41')]);return _0x57f708['getBlackLists'](_0x507223);}})[_0xd7c9('0x26')](function(_0x1684a7){if(_0x1684a7){_0x4b5707=_0x1684a7[_0xd7c9('0x39')];if(!_0x42b761['query']['hasOwnProperty'](_0xd7c9('0x5d'))){_0x507223[_0xd7c9('0x20')]=qs[_0xd7c9('0x20')](_0x42b761[_0xd7c9('0x32')][_0xd7c9('0x20')]);_0x507223[_0xd7c9('0x3a')]=qs[_0xd7c9('0x3a')](_0x42b761[_0xd7c9('0x32')][_0xd7c9('0x3a')]);}return _0x57f708[_0xd7c9('0x86')](_0x507223);}})[_0xd7c9('0x26')](function(_0x1391da){if(_0x1391da){return _0x1391da?{'count':_0x4b5707,'rows':_0x1391da}:null;}})[_0xd7c9('0x26')](respondWithResult(_0x8fc2bc,null))[_0xd7c9('0x47')](handleError(_0x8fc2bc,null));};exports['addBlackLists']=function(_0x5b2d08,_0x4eaf81,_0x4f2812){var _0x3a0f65,_0x3a1e09;return db[_0xd7c9('0x42')]['find']({'where':{'id':_0x5b2d08[_0xd7c9('0x49')]['id']}})[_0xd7c9('0x26')](handleEntityNotFound(_0x4eaf81,null))[_0xd7c9('0x26')](function(_0x468d23){if(_0x468d23){_0x3a1e09=_0x468d23;return _0x468d23[_0xd7c9('0x87')](_0x5b2d08[_0xd7c9('0x57')][_0xd7c9('0x68')],_['omit'](_0x5b2d08['body'],[_0xd7c9('0x68'),'id'])||{});}return null;})['spread'](function(_0x52da50){var _0x162b12;_0x3a0f65=_0x52da50||[];var _0x46ef78=[];if(_0x52da50){for(var _0x53272b=0x0;_0x53272b<_0x52da50[_0xd7c9('0x39')];_0x53272b+=0x1){var _0x5e9f5c=_0x52da50[_0x53272b][_0xd7c9('0x4c')]({'plain':!![]});_0x162b12=squel['insert']()[_0xd7c9('0x6d')](_0xd7c9('0x88'))[_0xd7c9('0x6e')]([_0xd7c9('0x6f'),'ContactId',_0xd7c9('0x72'),_0xd7c9('0x5e'),_0xd7c9('0x58'),'updatedAt'],squel[_0xd7c9('0x73')]()[_0xd7c9('0x74')](_0xd7c9('0x6f'),_0xd7c9('0x6f'))[_0xd7c9('0x74')]('id',_0xd7c9('0x71'))[_0xd7c9('0x74')](_0x5e9f5c['CmListId'][_0xd7c9('0x77')](),'ListId')['field'](_0x5b2d08[_0xd7c9('0x49')]['id'][_0xd7c9('0x77')](),_0xd7c9('0x5e'))[_0xd7c9('0x74')]('NOW()','createdAt')[_0xd7c9('0x74')](_0xd7c9('0x75'),_0xd7c9('0x56'))[_0xd7c9('0x78')]('cm_contacts')['where'](_0xd7c9('0x7a'))[_0xd7c9('0x3d')]('ListId\x20=\x20?',_0x5e9f5c['CmListId'][_0xd7c9('0x77')]())[_0xd7c9('0x3d')](_0xd7c9('0x7b')))[_0xd7c9('0x77')]();_0x46ef78[_0xd7c9('0x82')](db[_0xd7c9('0x83')][_0xd7c9('0x32')](_0x162b12));}return BPromise['all'](_0x46ef78);}})[_0xd7c9('0x26')](function(){return _0x3a0f65;})[_0xd7c9('0x26')](respondWithResult(_0x4eaf81,null))[_0xd7c9('0x47')](handleError(_0x4eaf81,null));};exports['removeBlackLists']=function(_0x1eba6e,_0x54198b,_0x125725){return db[_0xd7c9('0x42')][_0xd7c9('0x50')]({'where':{'id':_0x1eba6e[_0xd7c9('0x49')]['id']}})[_0xd7c9('0x26')](handleEntityNotFound(_0x54198b,null))[_0xd7c9('0x26')](function(_0x35e702){if(_0x35e702){return _0x35e702[_0xd7c9('0x89')](_0x1eba6e[_0xd7c9('0x32')][_0xd7c9('0x68')]);}})['then'](function(_0x4f987d){if(_0x4f987d){return db[_0xd7c9('0x64')][_0xd7c9('0x27')]({'where':{'ListId':_0x1eba6e[_0xd7c9('0x32')][_0xd7c9('0x68')],'CampaignId':_0x1eba6e[_0xd7c9('0x49')]['id']}})['then'](function(){return _0x4f987d;});}})[_0xd7c9('0x26')](respondWithStatusCode(_0x54198b,null))[_0xd7c9('0x47')](handleError(_0x54198b,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index d83d9fb..ecda943 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 _0x8b70=['exports','define','Campaign','campaigns','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./campaign.attributes'];(function(_0x414166,_0x5e87f3){var _0x373505=function(_0x1cd5b1){while(--_0x1cd5b1){_0x414166['push'](_0x414166['shift']());}};_0x373505(++_0x5e87f3);}(_0x8b70,0x1c0));var _0x08b7=function(_0x5b2865,_0x3b814b){_0x5b2865=_0x5b2865-0x0;var _0x3cb4c6=_0x8b70[_0x5b2865];return _0x3cb4c6;};'use strict';var _=require(_0x08b7('0x0'));var util=require('util');var logger=require(_0x08b7('0x1'))(_0x08b7('0x2'));var moment=require('moment');var BPromise=require(_0x08b7('0x3'));var rp=require(_0x08b7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x08b7('0x5'));var config=require(_0x08b7('0x6'));var attributes=require(_0x08b7('0x7'));module[_0x08b7('0x8')]=function(_0xd2f508,_0xb0bad5){return _0xd2f508[_0x08b7('0x9')](_0x08b7('0xa'),attributes,{'tableName':_0x08b7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4cd5=['path','rimraf','exports','campaigns','lodash','util','../../config/logger','moment','bluebird'];(function(_0x5f0465,_0x41cbeb){var _0x2cfe91=function(_0x394b68){while(--_0x394b68){_0x5f0465['push'](_0x5f0465['shift']());}};_0x2cfe91(++_0x41cbeb);}(_0x4cd5,0x1ab));var _0x54cd=function(_0x160393,_0x4e2ea7){_0x160393=_0x160393-0x0;var _0x39865d=_0x4cd5[_0x160393];return _0x39865d;};'use strict';var _=require(_0x54cd('0x0'));var util=require(_0x54cd('0x1'));var logger=require(_0x54cd('0x2'))('api');var moment=require(_0x54cd('0x3'));var BPromise=require(_0x54cd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x54cd('0x5'));var rimraf=require(_0x54cd('0x6'));var config=require('../../config/environment');var attributes=require('./campaign.attributes');module[_0x54cd('0x7')]=function(_0x3ad688,_0x2c298e){return _0x3ad688['define']('Campaign',attributes,{'tableName':_0x54cd('0x8'),'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 49f1e66..4c51907 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 _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(_0x56a08d,_0x423e65){var _0x5a1e57=function(_0x8da505){while(--_0x8da505){_0x56a08d['push'](_0x56a08d['shift']());}};_0x5a1e57(++_0x423e65);}(_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 +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(_0x426778,_0x17681a){var _0xad9bfe=function(_0x500c13){while(--_0x500c13){_0x426778['push'](_0x426778['shift']());}};_0xad9bfe(++_0x17681a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index e2f172a..41b7cbc 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 _0xb726=['post','addLists','addBlackLists','put','update','delete','removeLists','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','create'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb726,0xbc));var _0x6b72=function(_0x2402cf,_0x1dfd43){_0x2402cf=_0x2402cf-0x0;var _0x4a789a=_0xb726[_0x2402cf];return _0x4a789a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b72('0x0'));var router=express[_0x6b72('0x1')]();var fs_extra=require(_0x6b72('0x2'));var auth=require(_0x6b72('0x3'));var interaction=require(_0x6b72('0x4'));var config=require(_0x6b72('0x5'));var controller=require('./campaign.controller');router[_0x6b72('0x6')]('/',auth[_0x6b72('0x7')](),controller[_0x6b72('0x8')]);router['get'](_0x6b72('0x9'),auth[_0x6b72('0x7')](),controller[_0x6b72('0xa')]);router['get']('/:id/hoppers',auth['isAuthenticated'](),controller[_0x6b72('0xb')]);router[_0x6b72('0x6')](_0x6b72('0xc'),auth[_0x6b72('0x7')](),controller[_0x6b72('0xd')]);router[_0x6b72('0x6')](_0x6b72('0xe'),auth[_0x6b72('0x7')](),controller[_0x6b72('0xf')]);router[_0x6b72('0x6')](_0x6b72('0x10'),auth[_0x6b72('0x7')](),controller[_0x6b72('0x11')]);router['get']('/:id/lists',auth[_0x6b72('0x7')](),controller[_0x6b72('0x12')]);router[_0x6b72('0x6')](_0x6b72('0x13'),auth[_0x6b72('0x7')](),controller[_0x6b72('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6b72('0x15')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0x6b72('0x16')]('/:id/lists',auth[_0x6b72('0x7')](),controller[_0x6b72('0x17')]);router[_0x6b72('0x16')](_0x6b72('0x13'),auth[_0x6b72('0x7')](),controller[_0x6b72('0x18')]);router[_0x6b72('0x19')](_0x6b72('0x9'),auth[_0x6b72('0x7')](),controller[_0x6b72('0x1a')]);router[_0x6b72('0x1b')](_0x6b72('0x9'),auth[_0x6b72('0x7')](),controller['destroy']);router[_0x6b72('0x1b')]('/:id/lists',auth[_0x6b72('0x7')](),controller[_0x6b72('0x1c')]);router[_0x6b72('0x1b')](_0x6b72('0x13'),auth[_0x6b72('0x7')](),controller['removeBlackLists']);module[_0x6b72('0x1d')]=router; \ No newline at end of file +var _0xda73=['../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','put','/:id','destroy','delete','removeLists','exports','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x8b5d15,_0x27b4c0){var _0x4ba000=function(_0x436298){while(--_0x436298){_0x8b5d15['push'](_0x8b5d15['shift']());}};_0x4ba000(++_0x27b4c0);}(_0xda73,0x1d7));var _0x3da7=function(_0x550f96,_0x17b89d){_0x550f96=_0x550f96-0x0;var _0x150e15=_0xda73[_0x550f96];return _0x150e15;};'use strict';var multer=require(_0x3da7('0x0'));var util=require('util');var path=require(_0x3da7('0x1'));var timeout=require(_0x3da7('0x2'));var express=require('express');var router=express[_0x3da7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3da7('0x4'));var interaction=require(_0x3da7('0x5'));var config=require(_0x3da7('0x6'));var controller=require(_0x3da7('0x7'));router[_0x3da7('0x8')]('/',auth[_0x3da7('0x9')](),controller['index']);router[_0x3da7('0x8')]('/:id',auth[_0x3da7('0x9')](),controller[_0x3da7('0xa')]);router[_0x3da7('0x8')](_0x3da7('0xb'),auth[_0x3da7('0x9')](),controller[_0x3da7('0xc')]);router[_0x3da7('0x8')]('/:id/hopper_histories',auth[_0x3da7('0x9')](),controller[_0x3da7('0xd')]);router[_0x3da7('0x8')](_0x3da7('0xe'),auth[_0x3da7('0x9')](),controller[_0x3da7('0xf')]);router[_0x3da7('0x8')](_0x3da7('0x10'),auth['isAuthenticated'](),controller[_0x3da7('0x11')]);router['get'](_0x3da7('0x12'),auth[_0x3da7('0x9')](),controller[_0x3da7('0x13')]);router[_0x3da7('0x8')](_0x3da7('0x14'),auth[_0x3da7('0x9')](),controller[_0x3da7('0x15')]);router[_0x3da7('0x16')]('/',auth[_0x3da7('0x9')](),controller[_0x3da7('0x17')]);router[_0x3da7('0x16')](_0x3da7('0x18'),auth[_0x3da7('0x9')](),controller[_0x3da7('0x19')]);router[_0x3da7('0x16')](_0x3da7('0x12'),auth[_0x3da7('0x9')](),controller[_0x3da7('0x1a')]);router[_0x3da7('0x16')](_0x3da7('0x14'),auth[_0x3da7('0x9')](),controller[_0x3da7('0x1b')]);router[_0x3da7('0x1c')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x3da7('0x1d'),auth[_0x3da7('0x9')](),controller[_0x3da7('0x1e')]);router[_0x3da7('0x1f')](_0x3da7('0x12'),auth['isAuthenticated'](),controller[_0x3da7('0x20')]);router['delete'](_0x3da7('0x14'),auth[_0x3da7('0x9')](),controller['removeBlackLists']);module[_0x3da7('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index d8a40e2..1265d9e 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 _0xcfc9=['key','sequelize','STRING','TEXT','getDataValue'];(function(_0x3f72c1,_0x979a0d){var _0x9dd0ce=function(_0x1c1142){while(--_0x1c1142){_0x3f72c1['push'](_0x3f72c1['shift']());}};_0x9dd0ce(++_0x979a0d);}(_0xcfc9,0xdd));var _0x9cfc=function(_0x332d74,_0x216152){_0x332d74=_0x332d74-0x0;var _0x2a2f1b=_0xcfc9[_0x332d74];return _0x2a2f1b;};'use strict';var Sequelize=require(_0x9cfc('0x0'));module['exports']={'key':{'type':Sequelize[_0x9cfc('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x9cfc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9cfc('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x9cfc('0x3')](_0x9cfc('0x4'));}}}; \ No newline at end of file +var _0xe738=['sequelize','exports','TEXT','STRING','VIRTUAL','getDataValue','key'];(function(_0xce63fa,_0x415771){var _0x114eb1=function(_0x53c393){while(--_0x53c393){_0xce63fa['push'](_0xce63fa['shift']());}};_0x114eb1(++_0x415771);}(_0xe738,0xa1));var _0x8e73=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xe738[_0x346737];return _0x1ade2e;};'use strict';var Sequelize=require(_0x8e73('0x0'));module[_0x8e73('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x8e73('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8e73('0x3')]},'name':{'type':Sequelize[_0x8e73('0x4')],'get':function(){return this[_0x8e73('0x5')](_0x8e73('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 6cb4164..3015e69 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 _0xa958=['status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','CannedAnswers','UserProfileResource','error','name','send','map','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','CannedAnswer','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','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','../../mysqldb'];(function(_0x46fd7d,_0x2fa147){var _0x3d64aa=function(_0x5da960){while(--_0x5da960){_0x46fd7d['push'](_0x46fd7d['shift']());}};_0x3d64aa(++_0x2fa147);}(_0xa958,0x94));var _0x8a95=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xa958[_0x3511d3];return _0x5d6321;};'use strict';var emlformat=require(_0x8a95('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8a95('0x1'));var jsonpatch=require(_0x8a95('0x2'));var rp=require(_0x8a95('0x3'));var moment=require(_0x8a95('0x4'));var BPromise=require(_0x8a95('0x5'));var Mustache=require(_0x8a95('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8a95('0x7'));var csv=require(_0x8a95('0x8'));var ejs=require(_0x8a95('0x9'));var fs=require('fs');var fs_extra=require(_0x8a95('0xa'));var _=require(_0x8a95('0xb'));var squel=require(_0x8a95('0xc'));var crypto=require(_0x8a95('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8a95('0xe'));var toCsv=require(_0x8a95('0x8'));var querystring=require(_0x8a95('0xf'));var Papa=require(_0x8a95('0x10'));var Redis=require(_0x8a95('0x11'));var authService=require(_0x8a95('0x12'));var qs=require(_0x8a95('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a95('0x14'));var logger=require(_0x8a95('0x15'))('api');var utils=require(_0x8a95('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8a95('0x17'))['db'];function respondWithStatusCode(_0x4cb5a5,_0x2fdf66){_0x2fdf66=_0x2fdf66||0xcc;return function(_0x1579cd){if(_0x1579cd){return _0x4cb5a5['sendStatus'](_0x2fdf66);}return _0x4cb5a5[_0x8a95('0x18')](_0x2fdf66)[_0x8a95('0x19')]();};}function respondWithResult(_0x59c5cc,_0x25e4bd){_0x25e4bd=_0x25e4bd||0xc8;return function(_0x19caf2){if(_0x19caf2){return _0x59c5cc[_0x8a95('0x18')](_0x25e4bd)[_0x8a95('0x1a')](_0x19caf2);}};}function respondWithFilteredResult(_0x4528b2,_0x341c72){return function(_0x13922b){if(_0x13922b){var _0x52e3d9=_0x13922b['count'],_0x1d08bf=_0x341c72[_0x8a95('0x1b')],_0x556592=_0x341c72[_0x8a95('0x1b')]+_0x341c72[_0x8a95('0x1c')],_0x334b18;if(_0x556592>=_0x52e3d9){_0x556592=_0x52e3d9;_0x334b18=0xc8;}else{_0x334b18=0xce;}_0x4528b2[_0x8a95('0x18')](_0x334b18);return _0x4528b2[_0x8a95('0x1d')](_0x8a95('0x1e'),_0x1d08bf+'-'+_0x556592+'/'+_0x52e3d9)[_0x8a95('0x1a')](_0x13922b);}return null;};}function patchUpdates(_0x35566f){return function(_0x2b0eaf){try{jsonpatch[_0x8a95('0x1f')](_0x2b0eaf,_0x35566f,!![]);}catch(_0x39d371){return BPromise[_0x8a95('0x20')](_0x39d371);}return _0x2b0eaf[_0x8a95('0x21')]();};}function saveUpdates(_0x361804,_0xbcb93e){return function(_0xfb6dd9){if(_0xfb6dd9){return _0xfb6dd9[_0x8a95('0x22')](_0x361804)['then'](function(_0x5df2cf){return _0x5df2cf;});}return null;};}function removeEntity(_0x476c2c,_0x25e5a7){return function(_0x1d53ac){if(_0x1d53ac){return _0x1d53ac[_0x8a95('0x23')]()[_0x8a95('0x24')](function(){var _0xfc238=_0x1d53ac['get']({'plain':!![]});var _0x5a3320=_0x8a95('0x25');return db[_0x8a95('0x26')][_0x8a95('0x23')]({'where':{'type':_0x5a3320,'resourceId':_0xfc238['id']}})[_0x8a95('0x24')](function(){return _0x1d53ac;});})[_0x8a95('0x24')](function(){_0x476c2c[_0x8a95('0x18')](0xcc)[_0x8a95('0x19')]();});}};}function handleEntityNotFound(_0x171b58,_0x3e880b){return function(_0x22a1fb){if(!_0x22a1fb){_0x171b58['sendStatus'](0x194);}return _0x22a1fb;};}function handleError(_0x1a98e0,_0x57d711){_0x57d711=_0x57d711||0x1f4;return function(_0x5544b8){logger[_0x8a95('0x27')](_0x5544b8['stack']);if(_0x5544b8['name']){delete _0x5544b8[_0x8a95('0x28')];}_0x1a98e0['status'](_0x57d711)[_0x8a95('0x29')](_0x5544b8);};}exports['index']=function(_0x136188,_0x18b287){var _0x341b0e={},_0x13e2ed={},_0x251b54={'count':0x0,'rows':[]};var _0x599977=_[_0x8a95('0x2a')](db['CannedAnswer']['rawAttributes'],function(_0x26fac7){return{'name':_0x26fac7['fieldName'],'type':_0x26fac7['type'][_0x8a95('0x2b')]};});_0x13e2ed[_0x8a95('0x2c')]=_[_0x8a95('0x2a')](_0x599977,_0x8a95('0x28'));_0x13e2ed[_0x8a95('0x2d')]=_[_0x8a95('0x2e')](_0x136188[_0x8a95('0x2d')]);_0x13e2ed[_0x8a95('0x2f')]=_[_0x8a95('0x30')](_0x13e2ed[_0x8a95('0x2c')],_0x13e2ed[_0x8a95('0x2d')]);_0x341b0e[_0x8a95('0x31')]=_[_0x8a95('0x30')](_0x13e2ed['model'],qs[_0x8a95('0x32')](_0x136188[_0x8a95('0x2d')]['fields']));_0x341b0e[_0x8a95('0x31')]=_0x341b0e[_0x8a95('0x31')][_0x8a95('0x33')]?_0x341b0e['attributes']:_0x13e2ed[_0x8a95('0x2c')];if(!_0x136188[_0x8a95('0x2d')][_0x8a95('0x34')](_0x8a95('0x35'))){_0x341b0e[_0x8a95('0x1c')]=qs[_0x8a95('0x1c')](_0x136188[_0x8a95('0x2d')]['limit']);_0x341b0e[_0x8a95('0x1b')]=qs['offset'](_0x136188['query']['offset']);}_0x341b0e['order']=qs['sort'](_0x136188['query'][_0x8a95('0x36')]);_0x341b0e[_0x8a95('0x37')]=qs[_0x8a95('0x2f')](_[_0x8a95('0x38')](_0x136188[_0x8a95('0x2d')],_0x13e2ed[_0x8a95('0x2f')]),_0x599977);if(_0x136188[_0x8a95('0x2d')][_0x8a95('0x39')]){_0x341b0e['where']=_[_0x8a95('0x3a')](_0x341b0e['where'],{'$or':_[_0x8a95('0x2a')](_0x599977,function(_0x2abede){if(_0x2abede[_0x8a95('0x3b')]!==_0x8a95('0x3c')){var _0x1e7592={};_0x1e7592[_0x2abede[_0x8a95('0x28')]]={'$like':'%'+_0x136188[_0x8a95('0x2d')][_0x8a95('0x39')]+'%'};return _0x1e7592;}})});}_0x341b0e=_[_0x8a95('0x3a')]({},_0x341b0e,_0x136188[_0x8a95('0x3d')]);var _0x1aba8d={'where':_0x341b0e['where']};return db[_0x8a95('0x3e')]['count'](_0x1aba8d)[_0x8a95('0x24')](function(_0x597492){_0x251b54['count']=_0x597492;if(_0x136188[_0x8a95('0x2d')][_0x8a95('0x3f')]){_0x341b0e[_0x8a95('0x40')]=[{'all':!![]}];}return db[_0x8a95('0x3e')][_0x8a95('0x41')](_0x341b0e);})[_0x8a95('0x24')](function(_0x5eee1b){_0x251b54[_0x8a95('0x42')]=_0x5eee1b;return _0x251b54;})[_0x8a95('0x24')](respondWithFilteredResult(_0x18b287,_0x341b0e))['catch'](handleError(_0x18b287,null));};exports[_0x8a95('0x43')]=function(_0x3edbe9,_0xff9088){var _0x2e983a={'raw':!![],'where':{'id':_0x3edbe9[_0x8a95('0x44')]['id']}},_0x2729db={};_0x2729db['model']=_[_0x8a95('0x2e')](db['CannedAnswer'][_0x8a95('0x45')]);_0x2729db[_0x8a95('0x2d')]=_[_0x8a95('0x2e')](_0x3edbe9['query']);_0x2729db[_0x8a95('0x2f')]=_[_0x8a95('0x30')](_0x2729db['model'],_0x2729db['query']);_0x2e983a[_0x8a95('0x31')]=_['intersection'](_0x2729db[_0x8a95('0x2c')],qs[_0x8a95('0x32')](_0x3edbe9['query'][_0x8a95('0x32')]));_0x2e983a[_0x8a95('0x31')]=_0x2e983a[_0x8a95('0x31')][_0x8a95('0x33')]?_0x2e983a[_0x8a95('0x31')]:_0x2729db['model'];if(_0x3edbe9['query'][_0x8a95('0x3f')]){_0x2e983a['include']=[{'all':!![]}];}_0x2e983a=_[_0x8a95('0x3a')]({},_0x2e983a,_0x3edbe9[_0x8a95('0x3d')]);return db[_0x8a95('0x3e')][_0x8a95('0x46')](_0x2e983a)['then'](handleEntityNotFound(_0xff9088,null))[_0x8a95('0x24')](respondWithResult(_0xff9088,null))[_0x8a95('0x47')](handleError(_0xff9088,null));};exports[_0x8a95('0x22')]=function(_0x137c62,_0x1d3115){if(_0x137c62[_0x8a95('0x48')]['id']){delete _0x137c62[_0x8a95('0x48')]['id'];}return db[_0x8a95('0x3e')]['find']({'where':{'id':_0x137c62[_0x8a95('0x44')]['id']}})['then'](handleEntityNotFound(_0x1d3115,null))[_0x8a95('0x24')](saveUpdates(_0x137c62[_0x8a95('0x48')],null))[_0x8a95('0x24')](respondWithResult(_0x1d3115,null))[_0x8a95('0x47')](handleError(_0x1d3115,null));};exports['destroy']=function(_0x541438,_0x40280b){return db['CannedAnswer'][_0x8a95('0x46')]({'where':{'id':_0x541438[_0x8a95('0x44')]['id']}})[_0x8a95('0x24')](handleEntityNotFound(_0x40280b,null))['then'](removeEntity(_0x40280b,null))[_0x8a95('0x47')](handleError(_0x40280b,null));};exports[_0x8a95('0x49')]=function(_0x28d163,_0x1460c7){var _0x2aef95={'key':_0x28d163[_0x8a95('0x48')][_0x8a95('0x2b')]};if(_0x28d163[_0x8a95('0x48')][_0x8a95('0x4a')]){_0x2aef95['MailAccountId']=_0x28d163[_0x8a95('0x48')][_0x8a95('0x4a')];}else if(_0x28d163[_0x8a95('0x48')]['SmsAccountId']){_0x2aef95[_0x8a95('0x4b')]=_0x28d163[_0x8a95('0x48')][_0x8a95('0x4b')];}else if(_0x28d163['body'][_0x8a95('0x4c')]){_0x2aef95[_0x8a95('0x4c')]=_0x28d163[_0x8a95('0x48')]['OpenchannelAccountId'];}else if(_0x28d163[_0x8a95('0x48')][_0x8a95('0x4d')]){_0x2aef95['ChatWebsiteId']=_0x28d163[_0x8a95('0x48')][_0x8a95('0x4d')];}return db[_0x8a95('0x3e')]['find']({'where':_0x2aef95})[_0x8a95('0x24')](function(_0x47bb7f){if(_0x47bb7f){throw new db[(_0x8a95('0x4e'))][(_0x8a95('0x4f'))](_0x8a95('0x50'));}return db['CannedAnswer'][_0x8a95('0x49')](_0x28d163[_0x8a95('0x48')]);})[_0x8a95('0x24')](function(_0x2c8b24){var _0x18d867=_0x28d163[_0x8a95('0x51')]['get']({'plain':!![]});if(!_0x18d867)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18d867[_0x8a95('0x52')]==='user'){var _0x1db297=_0x2c8b24['get']({'plain':!![]});return db[_0x8a95('0x53')][_0x8a95('0x46')]({'where':{'name':_0x8a95('0x25'),'userProfileId':_0x18d867[_0x8a95('0x54')]},'raw':!![]})[_0x8a95('0x24')](function(_0x4923d1){if(_0x4923d1&&_0x4923d1[_0x8a95('0x55')]===0x0){return db['UserProfileResource'][_0x8a95('0x49')]({'name':_0x1db297[_0x8a95('0x28')],'resourceId':_0x1db297['id'],'type':_0x4923d1['name'],'sectionId':_0x4923d1['id']},{})[_0x8a95('0x24')](function(){return _0x2c8b24;});}else{return _0x2c8b24;}})[_0x8a95('0x47')](function(_0x54c8db){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54c8db);throw _0x54c8db;});}return _0x2c8b24;})[_0x8a95('0x24')](respondWithResult(_0x1460c7,0xc9))[_0x8a95('0x47')](handleError(_0x1460c7,null));}; \ No newline at end of file +var _0xb8a0=['length','includeAll','options','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','CannedAnswers','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','CannedAnswer','fieldName','key','model','query','filters','intersection','fields','attributes','nolimit','limit','order','sort','where','pick','merge','type','VIRTUAL','count','include','findAll','rows','catch','params','keys','rawAttributes'];(function(_0x532244,_0x8f53fe){var _0x1491ef=function(_0x23aa09){while(--_0x23aa09){_0x532244['push'](_0x532244['shift']());}};_0x1491ef(++_0x8f53fe);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0x3ee8a0,_0x2d4799){_0x3ee8a0=_0x3ee8a0-0x0;var _0x1a0f7a=_0xb8a0[_0x3ee8a0];return _0x1a0f7a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0b8a('0x0'));var jsonpatch=require(_0x0b8a('0x1'));var rp=require('request-promise');var moment=require(_0x0b8a('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0b8a('0x3'));var csv=require(_0x0b8a('0x4'));var ejs=require(_0x0b8a('0x5'));var fs=require('fs');var fs_extra=require(_0x0b8a('0x6'));var _=require(_0x0b8a('0x7'));var squel=require(_0x0b8a('0x8'));var crypto=require(_0x0b8a('0x9'));var jsforce=require(_0x0b8a('0xa'));var deskjs=require(_0x0b8a('0xb'));var toCsv=require(_0x0b8a('0x4'));var querystring=require(_0x0b8a('0xc'));var Papa=require(_0x0b8a('0xd'));var Redis=require(_0x0b8a('0xe'));var authService=require(_0x0b8a('0xf'));var qs=require(_0x0b8a('0x10'));var as=require(_0x0b8a('0x11'));var hardwareService=require(_0x0b8a('0x12'));var logger=require(_0x0b8a('0x13'))(_0x0b8a('0x14'));var utils=require(_0x0b8a('0x15'));var config=require(_0x0b8a('0x16'));var licenseUtil=require(_0x0b8a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43aaa3,_0x2f7f7b){_0x2f7f7b=_0x2f7f7b||0xcc;return function(_0x3c96c9){if(_0x3c96c9){return _0x43aaa3[_0x0b8a('0x18')](_0x2f7f7b);}return _0x43aaa3[_0x0b8a('0x19')](_0x2f7f7b)[_0x0b8a('0x1a')]();};}function respondWithResult(_0x12838b,_0x4066ef){_0x4066ef=_0x4066ef||0xc8;return function(_0x1313d1){if(_0x1313d1){return _0x12838b['status'](_0x4066ef)[_0x0b8a('0x1b')](_0x1313d1);}};}function respondWithFilteredResult(_0x318983,_0x233a61){return function(_0x554237){if(_0x554237){var _0x1afb89=_0x554237['count'],_0x2f9867=_0x233a61['offset'],_0x1c5ac2=_0x233a61[_0x0b8a('0x1c')]+_0x233a61['limit'],_0x5a2623;if(_0x1c5ac2>=_0x1afb89){_0x1c5ac2=_0x1afb89;_0x5a2623=0xc8;}else{_0x5a2623=0xce;}_0x318983[_0x0b8a('0x19')](_0x5a2623);return _0x318983[_0x0b8a('0x1d')](_0x0b8a('0x1e'),_0x2f9867+'-'+_0x1c5ac2+'/'+_0x1afb89)[_0x0b8a('0x1b')](_0x554237);}return null;};}function patchUpdates(_0x3862bc){return function(_0x39da01){try{jsonpatch[_0x0b8a('0x1f')](_0x39da01,_0x3862bc,!![]);}catch(_0x13182e){return BPromise[_0x0b8a('0x20')](_0x13182e);}return _0x39da01[_0x0b8a('0x21')]();};}function saveUpdates(_0x313612,_0x568e89){return function(_0x57285b){if(_0x57285b){return _0x57285b[_0x0b8a('0x22')](_0x313612)['then'](function(_0x43ec10){return _0x43ec10;});}return null;};}function removeEntity(_0x1adeb4,_0xba351e){return function(_0x344653){if(_0x344653){return _0x344653['destroy']()[_0x0b8a('0x23')](function(){var _0x48e7dd=_0x344653[_0x0b8a('0x24')]({'plain':!![]});var _0x29dbf3='CannedAnswers';return db[_0x0b8a('0x25')][_0x0b8a('0x26')]({'where':{'type':_0x29dbf3,'resourceId':_0x48e7dd['id']}})[_0x0b8a('0x23')](function(){return _0x344653;});})['then'](function(){_0x1adeb4[_0x0b8a('0x19')](0xcc)[_0x0b8a('0x1a')]();});}};}function handleEntityNotFound(_0x34c83c,_0x4af078){return function(_0x37f47b){if(!_0x37f47b){_0x34c83c['sendStatus'](0x194);}return _0x37f47b;};}function handleError(_0x1ed000,_0x3e5e38){_0x3e5e38=_0x3e5e38||0x1f4;return function(_0x3d08c8){logger[_0x0b8a('0x27')](_0x3d08c8[_0x0b8a('0x28')]);if(_0x3d08c8[_0x0b8a('0x29')]){delete _0x3d08c8[_0x0b8a('0x29')];}_0x1ed000[_0x0b8a('0x19')](_0x3e5e38)[_0x0b8a('0x2a')](_0x3d08c8);};}exports[_0x0b8a('0x2b')]=function(_0x1e61f4,_0x20b16d){var _0x4b56fc={},_0x28ab04={},_0x223fdb={'count':0x0,'rows':[]};var _0x944638=_[_0x0b8a('0x2c')](db[_0x0b8a('0x2d')]['rawAttributes'],function(_0x2e9d5b){return{'name':_0x2e9d5b[_0x0b8a('0x2e')],'type':_0x2e9d5b['type'][_0x0b8a('0x2f')]};});_0x28ab04[_0x0b8a('0x30')]=_[_0x0b8a('0x2c')](_0x944638,_0x0b8a('0x29'));_0x28ab04[_0x0b8a('0x31')]=_['keys'](_0x1e61f4[_0x0b8a('0x31')]);_0x28ab04[_0x0b8a('0x32')]=_[_0x0b8a('0x33')](_0x28ab04[_0x0b8a('0x30')],_0x28ab04[_0x0b8a('0x31')]);_0x4b56fc['attributes']=_[_0x0b8a('0x33')](_0x28ab04[_0x0b8a('0x30')],qs['fields'](_0x1e61f4[_0x0b8a('0x31')][_0x0b8a('0x34')]));_0x4b56fc[_0x0b8a('0x35')]=_0x4b56fc[_0x0b8a('0x35')]['length']?_0x4b56fc[_0x0b8a('0x35')]:_0x28ab04[_0x0b8a('0x30')];if(!_0x1e61f4['query']['hasOwnProperty'](_0x0b8a('0x36'))){_0x4b56fc[_0x0b8a('0x37')]=qs[_0x0b8a('0x37')](_0x1e61f4[_0x0b8a('0x31')]['limit']);_0x4b56fc[_0x0b8a('0x1c')]=qs[_0x0b8a('0x1c')](_0x1e61f4[_0x0b8a('0x31')]['offset']);}_0x4b56fc[_0x0b8a('0x38')]=qs[_0x0b8a('0x39')](_0x1e61f4[_0x0b8a('0x31')][_0x0b8a('0x39')]);_0x4b56fc[_0x0b8a('0x3a')]=qs[_0x0b8a('0x32')](_[_0x0b8a('0x3b')](_0x1e61f4[_0x0b8a('0x31')],_0x28ab04[_0x0b8a('0x32')]),_0x944638);if(_0x1e61f4[_0x0b8a('0x31')]['filter']){_0x4b56fc[_0x0b8a('0x3a')]=_[_0x0b8a('0x3c')](_0x4b56fc[_0x0b8a('0x3a')],{'$or':_[_0x0b8a('0x2c')](_0x944638,function(_0x43ae2a){if(_0x43ae2a[_0x0b8a('0x3d')]!==_0x0b8a('0x3e')){var _0x42a780={};_0x42a780[_0x43ae2a['name']]={'$like':'%'+_0x1e61f4[_0x0b8a('0x31')]['filter']+'%'};return _0x42a780;}})});}_0x4b56fc=_[_0x0b8a('0x3c')]({},_0x4b56fc,_0x1e61f4['options']);var _0x384f7a={'where':_0x4b56fc[_0x0b8a('0x3a')]};return db['CannedAnswer'][_0x0b8a('0x3f')](_0x384f7a)[_0x0b8a('0x23')](function(_0x49a8e0){_0x223fdb[_0x0b8a('0x3f')]=_0x49a8e0;if(_0x1e61f4[_0x0b8a('0x31')]['includeAll']){_0x4b56fc[_0x0b8a('0x40')]=[{'all':!![]}];}return db[_0x0b8a('0x2d')][_0x0b8a('0x41')](_0x4b56fc);})['then'](function(_0x2ce77d){_0x223fdb[_0x0b8a('0x42')]=_0x2ce77d;return _0x223fdb;})['then'](respondWithFilteredResult(_0x20b16d,_0x4b56fc))[_0x0b8a('0x43')](handleError(_0x20b16d,null));};exports['show']=function(_0x47f9f1,_0x56a6ba){var _0x2bc3b7={'raw':!![],'where':{'id':_0x47f9f1[_0x0b8a('0x44')]['id']}},_0x2d3769={};_0x2d3769[_0x0b8a('0x30')]=_[_0x0b8a('0x45')](db[_0x0b8a('0x2d')][_0x0b8a('0x46')]);_0x2d3769[_0x0b8a('0x31')]=_[_0x0b8a('0x45')](_0x47f9f1['query']);_0x2d3769[_0x0b8a('0x32')]=_['intersection'](_0x2d3769['model'],_0x2d3769['query']);_0x2bc3b7['attributes']=_[_0x0b8a('0x33')](_0x2d3769[_0x0b8a('0x30')],qs[_0x0b8a('0x34')](_0x47f9f1[_0x0b8a('0x31')][_0x0b8a('0x34')]));_0x2bc3b7[_0x0b8a('0x35')]=_0x2bc3b7['attributes'][_0x0b8a('0x47')]?_0x2bc3b7['attributes']:_0x2d3769[_0x0b8a('0x30')];if(_0x47f9f1['query'][_0x0b8a('0x48')]){_0x2bc3b7[_0x0b8a('0x40')]=[{'all':!![]}];}_0x2bc3b7=_[_0x0b8a('0x3c')]({},_0x2bc3b7,_0x47f9f1[_0x0b8a('0x49')]);return db[_0x0b8a('0x2d')][_0x0b8a('0x4a')](_0x2bc3b7)['then'](handleEntityNotFound(_0x56a6ba,null))[_0x0b8a('0x23')](respondWithResult(_0x56a6ba,null))[_0x0b8a('0x43')](handleError(_0x56a6ba,null));};exports[_0x0b8a('0x22')]=function(_0x17d12c,_0x224b28){if(_0x17d12c[_0x0b8a('0x4b')]['id']){delete _0x17d12c[_0x0b8a('0x4b')]['id'];}return db[_0x0b8a('0x2d')][_0x0b8a('0x4a')]({'where':{'id':_0x17d12c[_0x0b8a('0x44')]['id']}})[_0x0b8a('0x23')](handleEntityNotFound(_0x224b28,null))[_0x0b8a('0x23')](saveUpdates(_0x17d12c['body'],null))[_0x0b8a('0x23')](respondWithResult(_0x224b28,null))[_0x0b8a('0x43')](handleError(_0x224b28,null));};exports[_0x0b8a('0x26')]=function(_0x5c465f,_0x2f13f5){return db[_0x0b8a('0x2d')][_0x0b8a('0x4a')]({'where':{'id':_0x5c465f['params']['id']}})['then'](handleEntityNotFound(_0x2f13f5,null))[_0x0b8a('0x23')](removeEntity(_0x2f13f5,null))['catch'](handleError(_0x2f13f5,null));};exports[_0x0b8a('0x4c')]=function(_0x3d98bb,_0x29e853){var _0x2e9472={'key':_0x3d98bb[_0x0b8a('0x4b')][_0x0b8a('0x2f')]};if(_0x3d98bb['body']['MailAccountId']){_0x2e9472[_0x0b8a('0x4d')]=_0x3d98bb[_0x0b8a('0x4b')][_0x0b8a('0x4d')];}else if(_0x3d98bb[_0x0b8a('0x4b')]['SmsAccountId']){_0x2e9472[_0x0b8a('0x4e')]=_0x3d98bb[_0x0b8a('0x4b')][_0x0b8a('0x4e')];}else if(_0x3d98bb[_0x0b8a('0x4b')][_0x0b8a('0x4f')]){_0x2e9472['OpenchannelAccountId']=_0x3d98bb[_0x0b8a('0x4b')][_0x0b8a('0x4f')];}else if(_0x3d98bb[_0x0b8a('0x4b')][_0x0b8a('0x50')]){_0x2e9472[_0x0b8a('0x50')]=_0x3d98bb[_0x0b8a('0x4b')][_0x0b8a('0x50')];}return db[_0x0b8a('0x2d')][_0x0b8a('0x4a')]({'where':_0x2e9472})[_0x0b8a('0x23')](function(_0x19822b){if(_0x19822b){throw new db[(_0x0b8a('0x51'))]['ValidationError'](_0x0b8a('0x52'));}return db[_0x0b8a('0x2d')]['create'](_0x3d98bb[_0x0b8a('0x4b')]);})[_0x0b8a('0x23')](function(_0x271dae){var _0x5648b1=_0x3d98bb['user'][_0x0b8a('0x24')]({'plain':!![]});if(!_0x5648b1)throw new Error(_0x0b8a('0x53'));if(_0x5648b1[_0x0b8a('0x54')]===_0x0b8a('0x55')){var _0x24a2cf=_0x271dae[_0x0b8a('0x24')]({'plain':!![]});return db[_0x0b8a('0x56')][_0x0b8a('0x4a')]({'where':{'name':_0x0b8a('0x57'),'userProfileId':_0x5648b1['userProfileId']},'raw':!![]})['then'](function(_0x28ce9f){if(_0x28ce9f&&_0x28ce9f[_0x0b8a('0x58')]===0x0){return db['UserProfileResource'][_0x0b8a('0x4c')]({'name':_0x24a2cf[_0x0b8a('0x29')],'resourceId':_0x24a2cf['id'],'type':_0x28ce9f[_0x0b8a('0x29')],'sectionId':_0x28ce9f['id']},{})[_0x0b8a('0x23')](function(){return _0x271dae;});}else{return _0x271dae;}})[_0x0b8a('0x43')](function(_0x4afcb1){logger[_0x0b8a('0x27')](_0x0b8a('0x59'),_0x4afcb1);throw _0x4afcb1;});}return _0x271dae;})['then'](respondWithResult(_0x29e853,0xc9))[_0x0b8a('0x43')](handleError(_0x29e853,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index e76fe6b..f9cd5c7 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 _0xc5e3=['request-promise','path','../../config/environment','./cannedAnswer.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x582974,_0x5968cb){var _0x364d64=function(_0xb2ac45){while(--_0xb2ac45){_0x582974['push'](_0x582974['shift']());}};_0x364d64(++_0x5968cb);}(_0xc5e3,0x10c));var _0x3c5e=function(_0x126ed0,_0x4d23e1){_0x126ed0=_0x126ed0-0x0;var _0x3ad298=_0xc5e3[_0x126ed0];return _0x3ad298;};'use strict';var _=require(_0x3c5e('0x0'));var util=require(_0x3c5e('0x1'));var logger=require(_0x3c5e('0x2'))(_0x3c5e('0x3'));var moment=require('moment');var BPromise=require(_0x3c5e('0x4'));var rp=require(_0x3c5e('0x5'));var fs=require('fs');var path=require(_0x3c5e('0x6'));var rimraf=require('rimraf');var config=require(_0x3c5e('0x7'));var attributes=require(_0x3c5e('0x8'));module[_0x3c5e('0x9')]=function(_0x33ed4d,_0x1cde99){return _0x33ed4d[_0x3c5e('0xa')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3c5e('0xb'),'collate':_0x3c5e('0xc')});}; \ No newline at end of file +var _0x1a72=['define','CannedAnswer','tools_canned_answers','lodash','util','api','moment','request-promise','rimraf','./cannedAnswer.attributes'];(function(_0x54f978,_0x3a6b7e){var _0x5d40b3=function(_0x44b545){while(--_0x44b545){_0x54f978['push'](_0x54f978['shift']());}};_0x5d40b3(++_0x3a6b7e);}(_0x1a72,0xad));var _0x21a7=function(_0xf92a92,_0x2111e4){_0xf92a92=_0xf92a92-0x0;var _0x546a0e=_0x1a72[_0xf92a92];return _0x546a0e;};'use strict';var _=require(_0x21a7('0x0'));var util=require(_0x21a7('0x1'));var logger=require('../../config/logger')(_0x21a7('0x2'));var moment=require(_0x21a7('0x3'));var BPromise=require('bluebird');var rp=require(_0x21a7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x21a7('0x5'));var config=require('../../config/environment');var attributes=require(_0x21a7('0x6'));module['exports']=function(_0x212fdb,_0x19a830){return _0x212fdb[_0x21a7('0x7')](_0x21a7('0x8'),attributes,{'tableName':_0x21a7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index eeec13f..e36e745 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 _0x1f8a=['ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring'];(function(_0x460dae,_0x3a907f){var _0x36e6d0=function(_0x447057){while(--_0x447057){_0x460dae['push'](_0x460dae['shift']());}};_0x36e6d0(++_0x3a907f);}(_0x1f8a,0x137));var _0xa1f8=function(_0x13d42a,_0x11d7e7){_0x13d42a=_0x13d42a-0x0;var _0x2f87f0=_0x1f8a[_0x13d42a];return _0x2f87f0;};'use strict';var _=require(_0xa1f8('0x0'));var util=require(_0xa1f8('0x1'));var moment=require(_0xa1f8('0x2'));var BPromise=require('bluebird');var rs=require(_0xa1f8('0x3'));var fs=require('fs');var Redis=require(_0xa1f8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa1f8('0x5'))('rpc');var config=require(_0xa1f8('0x6'));var jayson=require(_0xa1f8('0x7'));var client=jayson[_0xa1f8('0x8')][_0xa1f8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1973f2,_0x40d83f,_0x5be3c1){return new BPromise(function(_0x446146,_0xdbc954){return client[_0xa1f8('0xa')](_0x1973f2,_0x5be3c1)[_0xa1f8('0xb')](function(_0x46699b){logger[_0xa1f8('0xc')](_0xa1f8('0xd'),_0x40d83f,_0xa1f8('0xe'));logger[_0xa1f8('0xf')](_0xa1f8('0x10'),_0x40d83f,_0xa1f8('0xe'),JSON[_0xa1f8('0x11')](_0x46699b));if(_0x46699b[_0xa1f8('0x12')]){if(_0x46699b[_0xa1f8('0x12')]['code']===0x1f4){logger[_0xa1f8('0x12')](_0xa1f8('0xd'),_0x40d83f,_0x46699b[_0xa1f8('0x12')][_0xa1f8('0x13')]);return _0xdbc954(_0x46699b[_0xa1f8('0x12')][_0xa1f8('0x13')]);}logger[_0xa1f8('0x12')](_0xa1f8('0xd'),_0x40d83f,_0x46699b[_0xa1f8('0x12')][_0xa1f8('0x13')]);return _0x446146(_0x46699b['error'][_0xa1f8('0x13')]);}else{logger[_0xa1f8('0xc')](_0xa1f8('0xd'),_0x40d83f,_0xa1f8('0xe'));_0x446146(_0x46699b['result']['message']);}})[_0xa1f8('0x14')](function(_0x5884a2){logger[_0xa1f8('0x12')](_0xa1f8('0xd'),_0x40d83f,_0x5884a2);_0xdbc954(_0x5884a2);});});} \ No newline at end of file +var _0xad08=['bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','then','info','CannedAnswer,\x20%s,\x20%s','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0xad08,0x18c));var _0x8ad0=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xad08[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x8ad0('0x0'));var util=require(_0x8ad0('0x1'));var moment=require(_0x8ad0('0x2'));var BPromise=require(_0x8ad0('0x3'));var rs=require(_0x8ad0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ad0('0x5'))['db'];var utils=require(_0x8ad0('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8ad0('0x7'));var client=jayson[_0x8ad0('0x8')][_0x8ad0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24675d,_0xb46154,_0x336380){return new BPromise(function(_0x1e0771,_0x45a728){return client['request'](_0x24675d,_0x336380)[_0x8ad0('0xa')](function(_0x598c9b){logger[_0x8ad0('0xb')](_0x8ad0('0xc'),_0xb46154,'request\x20sent');logger[_0x8ad0('0xd')](_0x8ad0('0xe'),_0xb46154,_0x8ad0('0xf'),JSON[_0x8ad0('0x10')](_0x598c9b));if(_0x598c9b[_0x8ad0('0x11')]){if(_0x598c9b['error'][_0x8ad0('0x12')]===0x1f4){logger[_0x8ad0('0x11')](_0x8ad0('0xc'),_0xb46154,_0x598c9b[_0x8ad0('0x11')][_0x8ad0('0x13')]);return _0x45a728(_0x598c9b[_0x8ad0('0x11')][_0x8ad0('0x13')]);}logger['error'](_0x8ad0('0xc'),_0xb46154,_0x598c9b['error'][_0x8ad0('0x13')]);return _0x1e0771(_0x598c9b['error'][_0x8ad0('0x13')]);}else{logger[_0x8ad0('0xb')]('CannedAnswer,\x20%s,\x20%s',_0xb46154,_0x8ad0('0xf'));_0x1e0771(_0x598c9b['result'][_0x8ad0('0x13')]);}})[_0x8ad0('0x14')](function(_0x3692d3){logger[_0x8ad0('0x11')](_0x8ad0('0xc'),_0xb46154,_0x3692d3);_0x45a728(_0x3692d3);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 9808c62..9ce7f6c 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 _0x80d5=['../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x49857a,_0x2f6d60){var _0x39f0f4=function(_0x2d062a){while(--_0x2d062a){_0x49857a['push'](_0x49857a['shift']());}};_0x39f0f4(++_0x2f6d60);}(_0x80d5,0xae));var _0x580d=function(_0x31dc99,_0xad6537){_0x31dc99=_0x31dc99-0x0;var _0x33ee63=_0x80d5[_0x31dc99];return _0x33ee63;};'use strict';var multer=require(_0x580d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x580d('0x1'));var express=require(_0x580d('0x2'));var router=express[_0x580d('0x3')]();var fs_extra=require(_0x580d('0x4'));var auth=require(_0x580d('0x5'));var interaction=require(_0x580d('0x6'));var config=require(_0x580d('0x7'));var controller=require(_0x580d('0x8'));router[_0x580d('0x9')]('/',auth['isAuthenticated'](),controller[_0x580d('0xa')]);router[_0x580d('0x9')](_0x580d('0xb'),auth[_0x580d('0xc')](),controller[_0x580d('0xd')]);router[_0x580d('0xe')]('/',auth[_0x580d('0xc')](),controller['create']);router[_0x580d('0xf')](_0x580d('0xb'),auth['isAuthenticated'](),controller[_0x580d('0x10')]);router[_0x580d('0x11')](_0x580d('0xb'),auth['isAuthenticated'](),controller[_0x580d('0x12')]);module[_0x580d('0x13')]=router; \ No newline at end of file +var _0x36f3=['../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1ea73c,_0x33624c){var _0x55b879=function(_0x47aa84){while(--_0x47aa84){_0x1ea73c['push'](_0x1ea73c['shift']());}};_0x55b879(++_0x33624c);}(_0x36f3,0xf2));var _0x336f=function(_0x52fc4c,_0x4d5093){_0x52fc4c=_0x52fc4c-0x0;var _0x159b18=_0x36f3[_0x52fc4c];return _0x159b18;};'use strict';var multer=require(_0x336f('0x0'));var util=require(_0x336f('0x1'));var path=require(_0x336f('0x2'));var timeout=require(_0x336f('0x3'));var express=require(_0x336f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x336f('0x5'));var interaction=require(_0x336f('0x6'));var config=require('../../config/environment');var controller=require(_0x336f('0x7'));router[_0x336f('0x8')]('/',auth[_0x336f('0x9')](),controller[_0x336f('0xa')]);router[_0x336f('0x8')](_0x336f('0xb'),auth[_0x336f('0x9')](),controller[_0x336f('0xc')]);router['post']('/',auth[_0x336f('0x9')](),controller[_0x336f('0xd')]);router[_0x336f('0xe')](_0x336f('0xb'),auth[_0x336f('0x9')](),controller[_0x336f('0xf')]);router[_0x336f('0x10')](_0x336f('0xb'),auth[_0x336f('0x9')](),controller[_0x336f('0x11')]);module[_0x336f('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index b872603..5418848 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 _0x67b3=['STRING','INTEGER'];(function(_0x36a3c8,_0x538cb2){var _0x5618ad=function(_0x4a7f0e){while(--_0x4a7f0e){_0x36a3c8['push'](_0x36a3c8['shift']());}};_0x5618ad(++_0x538cb2);}(_0x67b3,0xbc));var _0x367b=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x67b3[_0x2283dc];return _0x16db90;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x367b('0x0')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x367b('0x0')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x367b('0x0')]},'dstchannel':{'type':Sequelize[_0x367b('0x0')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x367b('0x1')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x367b('0x1')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x367b('0x0')]},'amaflags':{'type':Sequelize[_0x367b('0x1')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x367b('0x0')]},'userfield':{'type':Sequelize[_0x367b('0x0')]},'uniqueid':{'type':Sequelize[_0x367b('0x0')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x367b('0x0')]},'type':{'type':Sequelize[_0x367b('0x0')]},'tag':{'type':Sequelize[_0x367b('0x0')]}}; \ No newline at end of file +var _0x7ebd=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports','DATE'];(function(_0x2269c9,_0x296d28){var _0x5c16c3=function(_0xd35d4b){while(--_0xd35d4b){_0x2269c9['push'](_0x2269c9['shift']());}};_0x5c16c3(++_0x296d28);}(_0x7ebd,0xed));var _0xd7eb=function(_0x36b7cb,_0x5b5642){_0x36b7cb=_0x36b7cb-0x0;var _0x295514=_0x7ebd[_0x36b7cb];return _0x295514;};'use strict';var Sequelize=require(_0xd7eb('0x0'));module[_0xd7eb('0x1')]={'calldate':{'type':Sequelize[_0xd7eb('0x2')],'allowNull':![],'defaultValue':_0xd7eb('0x3')},'clid':{'type':Sequelize[_0xd7eb('0x4')]},'src':{'type':Sequelize[_0xd7eb('0x4')]},'dst':{'type':Sequelize[_0xd7eb('0x4')]},'dcontext':{'type':Sequelize[_0xd7eb('0x4')]},'channel':{'type':Sequelize[_0xd7eb('0x4')]},'dstchannel':{'type':Sequelize[_0xd7eb('0x4')]},'lastapp':{'type':Sequelize[_0xd7eb('0x4')]},'lastdata':{'type':Sequelize[_0xd7eb('0x4')]},'duration':{'type':Sequelize[_0xd7eb('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xd7eb('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd7eb('0x4')]},'amaflags':{'type':Sequelize[_0xd7eb('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xd7eb('0x4')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd7eb('0x4')]},'linkedid':{'type':Sequelize[_0xd7eb('0x4')]},'sequence':{'type':Sequelize[_0xd7eb('0x4')]},'peeraccount':{'type':Sequelize[_0xd7eb('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xd7eb('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 3247ee3..978b669 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 _0xab5b=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','Cdr','fieldName','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xab5b,0x11a));var _0xbab5=function(_0x1bf221,_0x21940d){_0x1bf221=_0x1bf221-0x0;var _0x59c8bb=_0xab5b[_0x1bf221];return _0x59c8bb;};'use strict';var emlformat=require(_0xbab5('0x0'));var rimraf=require(_0xbab5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbab5('0x2'));var rp=require(_0xbab5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbab5('0x4'));var util=require('util');var path=require(_0xbab5('0x5'));var sox=require(_0xbab5('0x6'));var csv=require(_0xbab5('0x7'));var ejs=require(_0xbab5('0x8'));var fs=require('fs');var fs_extra=require(_0xbab5('0x9'));var _=require('lodash');var squel=require(_0xbab5('0xa'));var crypto=require(_0xbab5('0xb'));var jsforce=require(_0xbab5('0xc'));var deskjs=require(_0xbab5('0xd'));var toCsv=require(_0xbab5('0x7'));var querystring=require('querystring');var Papa=require(_0xbab5('0xe'));var Redis=require(_0xbab5('0xf'));var authService=require(_0xbab5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbab5('0x11'));var hardwareService=require(_0xbab5('0x12'));var logger=require('../../config/logger')(_0xbab5('0x13'));var utils=require(_0xbab5('0x14'));var config=require(_0xbab5('0x15'));var licenseUtil=require(_0xbab5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x219f81,_0x51e348){_0x51e348=_0x51e348||0xcc;return function(_0x332b0e){if(_0x332b0e){return _0x219f81[_0xbab5('0x17')](_0x51e348);}return _0x219f81[_0xbab5('0x18')](_0x51e348)[_0xbab5('0x19')]();};}function respondWithResult(_0x40c9e1,_0x51acbc){_0x51acbc=_0x51acbc||0xc8;return function(_0x360b72){if(_0x360b72){return _0x40c9e1[_0xbab5('0x18')](_0x51acbc)[_0xbab5('0x1a')](_0x360b72);}};}function respondWithFilteredResult(_0x39e802,_0x21b818){return function(_0xea96d){if(_0xea96d){var _0xdfd788=_0xea96d[_0xbab5('0x1b')],_0x1afef5=_0x21b818[_0xbab5('0x1c')],_0x27b2fe=_0x21b818[_0xbab5('0x1c')]+_0x21b818['limit'],_0x59b10e;if(_0x27b2fe>=_0xdfd788){_0x27b2fe=_0xdfd788;_0x59b10e=0xc8;}else{_0x59b10e=0xce;}_0x39e802['status'](_0x59b10e);return _0x39e802[_0xbab5('0x1d')](_0xbab5('0x1e'),_0x1afef5+'-'+_0x27b2fe+'/'+_0xdfd788)[_0xbab5('0x1a')](_0xea96d);}return null;};}function patchUpdates(_0x1dd0b2){return function(_0x1d70a1){try{jsonpatch[_0xbab5('0x1f')](_0x1d70a1,_0x1dd0b2,!![]);}catch(_0x1dc646){return BPromise['reject'](_0x1dc646);}return _0x1d70a1[_0xbab5('0x20')]();};}function saveUpdates(_0x176be1,_0x5ebeea){return function(_0x4d0891){if(_0x4d0891){return _0x4d0891[_0xbab5('0x21')](_0x176be1)[_0xbab5('0x22')](function(_0x124e64){return _0x124e64;});}return null;};}function removeEntity(_0x33e40e,_0x24a1ff){return function(_0xbc2989){if(_0xbc2989){return _0xbc2989[_0xbab5('0x23')]()[_0xbab5('0x22')](function(){_0x33e40e[_0xbab5('0x18')](0xcc)[_0xbab5('0x19')]();});}};}function handleEntityNotFound(_0x27e76f,_0x58ba05){return function(_0x14ed3a){if(!_0x14ed3a){_0x27e76f[_0xbab5('0x17')](0x194);}return _0x14ed3a;};}function handleError(_0x1bc672,_0x14e649){_0x14e649=_0x14e649||0x1f4;return function(_0x229d82){logger['error'](_0x229d82[_0xbab5('0x24')]);if(_0x229d82[_0xbab5('0x25')]){delete _0x229d82[_0xbab5('0x25')];}_0x1bc672['status'](_0x14e649)[_0xbab5('0x26')](_0x229d82);};}exports[_0xbab5('0x27')]=function(_0x168d75,_0xaac42){var _0x194e60={},_0x1437fd={},_0x1cfd89={'count':0x0,'rows':[]};var _0x1e1b2e=_['map'](db[_0xbab5('0x28')]['rawAttributes'],function(_0x2ed82c){return{'name':_0x2ed82c[_0xbab5('0x29')],'type':_0x2ed82c['type'][_0xbab5('0x2a')]};});_0x1437fd[_0xbab5('0x2b')]=_[_0xbab5('0x2c')](_0x1e1b2e,_0xbab5('0x25'));_0x1437fd[_0xbab5('0x2d')]=_[_0xbab5('0x2e')](_0x168d75[_0xbab5('0x2d')]);_0x1437fd['filters']=_['intersection'](_0x1437fd[_0xbab5('0x2b')],_0x1437fd['query']);_0x194e60[_0xbab5('0x2f')]=_[_0xbab5('0x30')](_0x1437fd['model'],qs[_0xbab5('0x31')](_0x168d75[_0xbab5('0x2d')][_0xbab5('0x31')]));_0x194e60[_0xbab5('0x2f')]=_0x194e60[_0xbab5('0x2f')][_0xbab5('0x32')]?_0x194e60[_0xbab5('0x2f')]:_0x1437fd['model'];if(!_0x168d75[_0xbab5('0x2d')][_0xbab5('0x33')](_0xbab5('0x34'))){_0x194e60[_0xbab5('0x35')]=qs[_0xbab5('0x35')](_0x168d75[_0xbab5('0x2d')][_0xbab5('0x35')]);_0x194e60['offset']=qs[_0xbab5('0x1c')](_0x168d75[_0xbab5('0x2d')][_0xbab5('0x1c')]);}_0x194e60['order']=qs[_0xbab5('0x36')](_0x168d75[_0xbab5('0x2d')]['sort']);_0x194e60[_0xbab5('0x37')]=qs[_0xbab5('0x38')](_[_0xbab5('0x39')](_0x168d75[_0xbab5('0x2d')],_0x1437fd[_0xbab5('0x38')]),_0x1e1b2e);if(_0x168d75[_0xbab5('0x2d')][_0xbab5('0x3a')]){_0x194e60[_0xbab5('0x37')]=_[_0xbab5('0x3b')](_0x194e60[_0xbab5('0x37')],{'$or':_[_0xbab5('0x2c')](_0x1e1b2e,function(_0x16ec7a){if(_0x16ec7a[_0xbab5('0x3c')]!==_0xbab5('0x3d')){var _0x17d4fc={};_0x17d4fc[_0x16ec7a[_0xbab5('0x25')]]={'$like':'%'+_0x168d75['query'][_0xbab5('0x3a')]+'%'};return _0x17d4fc;}})});}_0x194e60=_['merge']({},_0x194e60,_0x168d75[_0xbab5('0x3e')]);var _0x4dd39b={'where':_0x194e60['where']};return db[_0xbab5('0x28')][_0xbab5('0x1b')](_0x4dd39b)[_0xbab5('0x22')](function(_0x5eaeb4){_0x1cfd89[_0xbab5('0x1b')]=_0x5eaeb4;if(_0x168d75['query'][_0xbab5('0x3f')]){_0x194e60[_0xbab5('0x40')]=[{'all':!![]}];}return db[_0xbab5('0x28')]['findAll'](_0x194e60);})[_0xbab5('0x22')](function(_0x489c8f){_0x1cfd89[_0xbab5('0x41')]=_0x489c8f;return _0x1cfd89;})[_0xbab5('0x22')](respondWithFilteredResult(_0xaac42,_0x194e60))[_0xbab5('0x42')](handleError(_0xaac42,null));};exports[_0xbab5('0x43')]=function(_0x4ce5be,_0x40505f){var _0x36bcaf={'raw':!![],'where':{'id':_0x4ce5be[_0xbab5('0x44')]['id']}},_0x508e61={};_0x508e61[_0xbab5('0x2b')]=_[_0xbab5('0x2e')](db[_0xbab5('0x28')][_0xbab5('0x45')]);_0x508e61[_0xbab5('0x2d')]=_[_0xbab5('0x2e')](_0x4ce5be[_0xbab5('0x2d')]);_0x508e61[_0xbab5('0x38')]=_['intersection'](_0x508e61[_0xbab5('0x2b')],_0x508e61[_0xbab5('0x2d')]);_0x36bcaf[_0xbab5('0x2f')]=_[_0xbab5('0x30')](_0x508e61[_0xbab5('0x2b')],qs[_0xbab5('0x31')](_0x4ce5be[_0xbab5('0x2d')][_0xbab5('0x31')]));_0x36bcaf[_0xbab5('0x2f')]=_0x36bcaf[_0xbab5('0x2f')]['length']?_0x36bcaf[_0xbab5('0x2f')]:_0x508e61['model'];if(_0x4ce5be[_0xbab5('0x2d')]['includeAll']){_0x36bcaf[_0xbab5('0x40')]=[{'all':!![]}];}_0x36bcaf=_[_0xbab5('0x3b')]({},_0x36bcaf,_0x4ce5be[_0xbab5('0x3e')]);return db[_0xbab5('0x28')]['find'](_0x36bcaf)['then'](handleEntityNotFound(_0x40505f,null))[_0xbab5('0x22')](respondWithResult(_0x40505f,null))[_0xbab5('0x42')](handleError(_0x40505f,null));};exports[_0xbab5('0x46')]=function(_0x43d630,_0x126455){return db[_0xbab5('0x28')]['create'](_0x43d630[_0xbab5('0x47')],{})[_0xbab5('0x22')](respondWithResult(_0x126455,0xc9))[_0xbab5('0x42')](handleError(_0x126455,null));};exports['update']=function(_0x24aa49,_0x351b9d){if(_0x24aa49[_0xbab5('0x47')]['id']){delete _0x24aa49[_0xbab5('0x47')]['id'];}return db[_0xbab5('0x28')][_0xbab5('0x48')]({'where':{'id':_0x24aa49[_0xbab5('0x44')]['id']}})[_0xbab5('0x22')](handleEntityNotFound(_0x351b9d,null))[_0xbab5('0x22')](saveUpdates(_0x24aa49['body'],null))[_0xbab5('0x22')](respondWithResult(_0x351b9d,null))['catch'](handleError(_0x351b9d,null));};exports[_0xbab5('0x23')]=function(_0x47446b,_0x246b7a){return db[_0xbab5('0x28')][_0xbab5('0x48')]({'where':{'id':_0x47446b[_0xbab5('0x44')]['id']}})[_0xbab5('0x22')](handleEntityNotFound(_0x246b7a,null))['then'](removeEntity(_0x246b7a,null))[_0xbab5('0x42')](handleError(_0x246b7a,null));};exports['describe']=function(_0xa1b143,_0x1e68a7){return db['Cdr'][_0xbab5('0x49')]()[_0xbab5('0x22')](respondWithResult(_0x1e68a7,null))['catch'](handleError(_0x1e68a7,null));}; \ No newline at end of file +var _0xc73e=['includeAll','include','create','body','params','find','eml-format','rimraf','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','Cdr','rows','catch','show'];(function(_0x147e56,_0x2efae8){var _0x40c49c=function(_0x380aaa){while(--_0x380aaa){_0x147e56['push'](_0x147e56['shift']());}};_0x40c49c(++_0x2efae8);}(_0xc73e,0x1e9));var _0xec73=function(_0x81c2a8,_0x467017){_0x81c2a8=_0x81c2a8-0x0;var _0x72c044=_0xc73e[_0x81c2a8];return _0x72c044;};'use strict';var emlformat=require(_0xec73('0x0'));var rimraf=require(_0xec73('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xec73('0x2'));var rp=require(_0xec73('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xec73('0x4'));var path=require(_0xec73('0x5'));var sox=require('sox');var csv=require(_0xec73('0x6'));var ejs=require(_0xec73('0x7'));var fs=require('fs');var fs_extra=require(_0xec73('0x8'));var _=require(_0xec73('0x9'));var squel=require('squel');var crypto=require(_0xec73('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xec73('0xb'));var toCsv=require(_0xec73('0x6'));var querystring=require(_0xec73('0xc'));var Papa=require(_0xec73('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xec73('0xe'));var as=require(_0xec73('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xec73('0x10'));var utils=require(_0xec73('0x11'));var config=require(_0xec73('0x12'));var licenseUtil=require(_0xec73('0x13'));var db=require(_0xec73('0x14'))['db'];function respondWithStatusCode(_0x19d0f2,_0x1e67ac){_0x1e67ac=_0x1e67ac||0xcc;return function(_0x5f5594){if(_0x5f5594){return _0x19d0f2[_0xec73('0x15')](_0x1e67ac);}return _0x19d0f2['status'](_0x1e67ac)[_0xec73('0x16')]();};}function respondWithResult(_0x4be73c,_0x10f003){_0x10f003=_0x10f003||0xc8;return function(_0x1e4869){if(_0x1e4869){return _0x4be73c[_0xec73('0x17')](_0x10f003)[_0xec73('0x18')](_0x1e4869);}};}function respondWithFilteredResult(_0x3690c3,_0x2a3296){return function(_0x35be28){if(_0x35be28){var _0x2b4e70=_0x35be28[_0xec73('0x19')],_0x5de659=_0x2a3296[_0xec73('0x1a')],_0x308eb4=_0x2a3296[_0xec73('0x1a')]+_0x2a3296[_0xec73('0x1b')],_0x418770;if(_0x308eb4>=_0x2b4e70){_0x308eb4=_0x2b4e70;_0x418770=0xc8;}else{_0x418770=0xce;}_0x3690c3['status'](_0x418770);return _0x3690c3[_0xec73('0x1c')](_0xec73('0x1d'),_0x5de659+'-'+_0x308eb4+'/'+_0x2b4e70)[_0xec73('0x18')](_0x35be28);}return null;};}function patchUpdates(_0x506772){return function(_0x57ac66){try{jsonpatch[_0xec73('0x1e')](_0x57ac66,_0x506772,!![]);}catch(_0x32899b){return BPromise[_0xec73('0x1f')](_0x32899b);}return _0x57ac66[_0xec73('0x20')]();};}function saveUpdates(_0x1169c4,_0x5d4c7c){return function(_0x519813){if(_0x519813){return _0x519813[_0xec73('0x21')](_0x1169c4)[_0xec73('0x22')](function(_0x30c236){return _0x30c236;});}return null;};}function removeEntity(_0x60bfec,_0x451715){return function(_0x4a862b){if(_0x4a862b){return _0x4a862b[_0xec73('0x23')]()['then'](function(){_0x60bfec[_0xec73('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4df08e,_0x490ee2){return function(_0x12b865){if(!_0x12b865){_0x4df08e[_0xec73('0x15')](0x194);}return _0x12b865;};}function handleError(_0x2caf6b,_0xffc1af){_0xffc1af=_0xffc1af||0x1f4;return function(_0x3df864){logger['error'](_0x3df864['stack']);if(_0x3df864[_0xec73('0x24')]){delete _0x3df864[_0xec73('0x24')];}_0x2caf6b['status'](_0xffc1af)[_0xec73('0x25')](_0x3df864);};}exports[_0xec73('0x26')]=function(_0x3bf259,_0x4dc430){var _0x23ff51={},_0x2e671c={},_0x370e7a={'count':0x0,'rows':[]};var _0x28361e=_['map'](db['Cdr'][_0xec73('0x27')],function(_0x2af2db){return{'name':_0x2af2db[_0xec73('0x28')],'type':_0x2af2db[_0xec73('0x29')]['key']};});_0x2e671c[_0xec73('0x2a')]=_[_0xec73('0x2b')](_0x28361e,_0xec73('0x24'));_0x2e671c[_0xec73('0x2c')]=_[_0xec73('0x2d')](_0x3bf259[_0xec73('0x2c')]);_0x2e671c['filters']=_[_0xec73('0x2e')](_0x2e671c[_0xec73('0x2a')],_0x2e671c[_0xec73('0x2c')]);_0x23ff51[_0xec73('0x2f')]=_[_0xec73('0x2e')](_0x2e671c[_0xec73('0x2a')],qs['fields'](_0x3bf259[_0xec73('0x2c')][_0xec73('0x30')]));_0x23ff51[_0xec73('0x2f')]=_0x23ff51[_0xec73('0x2f')][_0xec73('0x31')]?_0x23ff51[_0xec73('0x2f')]:_0x2e671c[_0xec73('0x2a')];if(!_0x3bf259['query'][_0xec73('0x32')]('nolimit')){_0x23ff51[_0xec73('0x1b')]=qs[_0xec73('0x1b')](_0x3bf259[_0xec73('0x2c')][_0xec73('0x1b')]);_0x23ff51[_0xec73('0x1a')]=qs[_0xec73('0x1a')](_0x3bf259[_0xec73('0x2c')][_0xec73('0x1a')]);}_0x23ff51[_0xec73('0x33')]=qs['sort'](_0x3bf259['query'][_0xec73('0x34')]);_0x23ff51[_0xec73('0x35')]=qs[_0xec73('0x36')](_[_0xec73('0x37')](_0x3bf259[_0xec73('0x2c')],_0x2e671c[_0xec73('0x36')]),_0x28361e);if(_0x3bf259[_0xec73('0x2c')][_0xec73('0x38')]){_0x23ff51['where']=_[_0xec73('0x39')](_0x23ff51[_0xec73('0x35')],{'$or':_[_0xec73('0x2b')](_0x28361e,function(_0x56c0d4){if(_0x56c0d4['type']!=='VIRTUAL'){var _0x174f05={};_0x174f05[_0x56c0d4['name']]={'$like':'%'+_0x3bf259[_0xec73('0x2c')]['filter']+'%'};return _0x174f05;}})});}_0x23ff51=_['merge']({},_0x23ff51,_0x3bf259[_0xec73('0x3a')]);var _0x59cceb={'where':_0x23ff51[_0xec73('0x35')]};return db['Cdr'][_0xec73('0x19')](_0x59cceb)['then'](function(_0x3a971e){_0x370e7a[_0xec73('0x19')]=_0x3a971e;if(_0x3bf259['query']['includeAll']){_0x23ff51['include']=[{'all':!![]}];}return db[_0xec73('0x3b')]['findAll'](_0x23ff51);})[_0xec73('0x22')](function(_0x10e388){_0x370e7a[_0xec73('0x3c')]=_0x10e388;return _0x370e7a;})['then'](respondWithFilteredResult(_0x4dc430,_0x23ff51))[_0xec73('0x3d')](handleError(_0x4dc430,null));};exports[_0xec73('0x3e')]=function(_0x12bb46,_0x1c5e2b){var _0x1b7b30={'raw':!![],'where':{'id':_0x12bb46['params']['id']}},_0x4f65d4={};_0x4f65d4[_0xec73('0x2a')]=_[_0xec73('0x2d')](db[_0xec73('0x3b')][_0xec73('0x27')]);_0x4f65d4[_0xec73('0x2c')]=_[_0xec73('0x2d')](_0x12bb46[_0xec73('0x2c')]);_0x4f65d4[_0xec73('0x36')]=_[_0xec73('0x2e')](_0x4f65d4[_0xec73('0x2a')],_0x4f65d4[_0xec73('0x2c')]);_0x1b7b30[_0xec73('0x2f')]=_[_0xec73('0x2e')](_0x4f65d4[_0xec73('0x2a')],qs['fields'](_0x12bb46['query'][_0xec73('0x30')]));_0x1b7b30[_0xec73('0x2f')]=_0x1b7b30[_0xec73('0x2f')][_0xec73('0x31')]?_0x1b7b30[_0xec73('0x2f')]:_0x4f65d4[_0xec73('0x2a')];if(_0x12bb46[_0xec73('0x2c')][_0xec73('0x3f')]){_0x1b7b30[_0xec73('0x40')]=[{'all':!![]}];}_0x1b7b30=_['merge']({},_0x1b7b30,_0x12bb46['options']);return db[_0xec73('0x3b')]['find'](_0x1b7b30)[_0xec73('0x22')](handleEntityNotFound(_0x1c5e2b,null))['then'](respondWithResult(_0x1c5e2b,null))[_0xec73('0x3d')](handleError(_0x1c5e2b,null));};exports[_0xec73('0x41')]=function(_0x30feaf,_0x21174b){return db[_0xec73('0x3b')]['create'](_0x30feaf[_0xec73('0x42')],{})[_0xec73('0x22')](respondWithResult(_0x21174b,0xc9))['catch'](handleError(_0x21174b,null));};exports[_0xec73('0x21')]=function(_0x290938,_0x44a5ef){if(_0x290938[_0xec73('0x42')]['id']){delete _0x290938[_0xec73('0x42')]['id'];}return db['Cdr']['find']({'where':{'id':_0x290938[_0xec73('0x43')]['id']}})[_0xec73('0x22')](handleEntityNotFound(_0x44a5ef,null))[_0xec73('0x22')](saveUpdates(_0x290938['body'],null))[_0xec73('0x22')](respondWithResult(_0x44a5ef,null))['catch'](handleError(_0x44a5ef,null));};exports[_0xec73('0x23')]=function(_0x990149,_0x101c94){return db[_0xec73('0x3b')][_0xec73('0x44')]({'where':{'id':_0x990149[_0xec73('0x43')]['id']}})['then'](handleEntityNotFound(_0x101c94,null))['then'](removeEntity(_0x101c94,null))[_0xec73('0x3d')](handleError(_0x101c94,null));};exports['describe']=function(_0x3d7d1a,_0xde7373){return db[_0xec73('0x3b')]['describe']()[_0xec73('0x22')](respondWithResult(_0xde7373,null))[_0xec73('0x3d')](handleError(_0xde7373,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 3c3740f..cb9bd28 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 _0x1261=['src','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','define','cdr','accountcode','calldate','disposition','dst'];(function(_0x295a3d,_0x56d487){var _0x23a732=function(_0x15cfc2){while(--_0x15cfc2){_0x295a3d['push'](_0x295a3d['shift']());}};_0x23a732(++_0x56d487);}(_0x1261,0x144));var _0x1126=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0x1261[_0x4bd06e];return _0x85ebb;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('Cdr',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]},{'name':_0x1126('0xd'),'fields':[_0x1126('0xd')]},{'name':'disposition','fields':[_0x1126('0xe')]},{'name':_0x1126('0xf'),'fields':[_0x1126('0xf')]},{'name':'src','fields':[_0x1126('0x10')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':![]});}; \ No newline at end of file +var _0x7880=['accountcode','calldate','disposition','dst','src','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cdr.attributes','exports','define','Cdr','cdr'];(function(_0x20a68a,_0x54502e){var _0x56c5d4=function(_0x4ace56){while(--_0x4ace56){_0x20a68a['push'](_0x20a68a['shift']());}};_0x56c5d4(++_0x54502e);}(_0x7880,0x1f4));var _0x0788=function(_0xca1091,_0x539dbf){_0xca1091=_0xca1091-0x0;var _0xd3019c=_0x7880[_0xca1091];return _0xd3019c;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var logger=require(_0x0788('0x1'))(_0x0788('0x2'));var moment=require(_0x0788('0x3'));var BPromise=require(_0x0788('0x4'));var rp=require(_0x0788('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var attributes=require(_0x0788('0x8'));module[_0x0788('0x9')]=function(_0x262f5c,_0x775629){return _0x262f5c[_0x0788('0xa')](_0x0788('0xb'),attributes,{'tableName':_0x0788('0xc'),'paranoid':![],'indexes':[{'name':_0x0788('0xd'),'fields':['accountcode']},{'name':_0x0788('0xe'),'fields':['calldate']},{'name':_0x0788('0xf'),'fields':['disposition']},{'name':_0x0788('0x10'),'fields':[_0x0788('0x10')]},{'name':_0x0788('0x11'),'fields':[_0x0788('0x11')]},{'name':_0x0788('0x12'),'fields':['uniqueid']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 9bf56e1..41b4f1a 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 _0xc59b=['stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x16771d,_0x224c60){var _0x386f11=function(_0x3d7a87){while(--_0x3d7a87){_0x16771d['push'](_0x16771d['shift']());}};_0x386f11(++_0x224c60);}(_0xc59b,0x131));var _0xbc59=function(_0x2d4310,_0x2c4294){_0x2d4310=_0x2d4310-0x0;var _0x52099f=_0xc59b[_0x2d4310];return _0x52099f;};'use strict';var _=require(_0xbc59('0x0'));var util=require(_0xbc59('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbc59('0x2'));var fs=require('fs');var Redis=require(_0xbc59('0x3'));var db=require(_0xbc59('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbc59('0x5'));var config=require(_0xbc59('0x6'));var jayson=require(_0xbc59('0x7'));var client=jayson[_0xbc59('0x8')][_0xbc59('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f258e,_0x3a2593,_0x20564a){return new BPromise(function(_0x527423,_0x705cbf){return client[_0xbc59('0xa')](_0x2f258e,_0x20564a)['then'](function(_0xdf4b8b){logger[_0xbc59('0xb')](_0xbc59('0xc'),_0x3a2593,_0xbc59('0xd'));logger[_0xbc59('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x3a2593,_0xbc59('0xd'),JSON[_0xbc59('0xf')](_0xdf4b8b));if(_0xdf4b8b[_0xbc59('0x10')]){if(_0xdf4b8b[_0xbc59('0x10')]['code']===0x1f4){logger[_0xbc59('0x10')]('Cdr,\x20%s,\x20%s',_0x3a2593,_0xdf4b8b[_0xbc59('0x10')]['message']);return _0x705cbf(_0xdf4b8b[_0xbc59('0x10')][_0xbc59('0x11')]);}logger[_0xbc59('0x10')](_0xbc59('0xc'),_0x3a2593,_0xdf4b8b['error'][_0xbc59('0x11')]);return _0x527423(_0xdf4b8b[_0xbc59('0x10')][_0xbc59('0x11')]);}else{logger[_0xbc59('0xb')](_0xbc59('0xc'),_0x3a2593,_0xbc59('0xd'));_0x527423(_0xdf4b8b[_0xbc59('0x12')]['message']);}})[_0xbc59('0x13')](function(_0x556400){logger['error']('Cdr,\x20%s,\x20%s',_0x3a2593,_0x556400);_0x705cbf(_0x556400);});});} \ No newline at end of file +var _0xcfe8=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','lodash','util','moment','bluebird'];(function(_0x58ccaf,_0x55b8b6){var _0x32d94c=function(_0x22cc71){while(--_0x22cc71){_0x58ccaf['push'](_0x58ccaf['shift']());}};_0x32d94c(++_0x55b8b6);}(_0xcfe8,0x65));var _0x8cfe=function(_0x5ab374,_0x41bd90){_0x5ab374=_0x5ab374-0x0;var _0x4fb419=_0xcfe8[_0x5ab374];return _0x4fb419;};'use strict';var _=require(_0x8cfe('0x0'));var util=require(_0x8cfe('0x1'));var moment=require(_0x8cfe('0x2'));var BPromise=require(_0x8cfe('0x3'));var rs=require(_0x8cfe('0x4'));var fs=require('fs');var Redis=require(_0x8cfe('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8cfe('0x6'));var logger=require(_0x8cfe('0x7'))(_0x8cfe('0x8'));var config=require('../../config/environment');var jayson=require(_0x8cfe('0x9'));var client=jayson[_0x8cfe('0xa')][_0x8cfe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44e5e8,_0x545e42,_0x3eb913){return new BPromise(function(_0x1b34d2,_0x40b535){return client[_0x8cfe('0xc')](_0x44e5e8,_0x3eb913)['then'](function(_0xb5b086){logger['info'](_0x8cfe('0xd'),_0x545e42,_0x8cfe('0xe'));logger[_0x8cfe('0xf')]('Cdr,\x20%s,\x20%s,\x20%s',_0x545e42,'request\x20sent',JSON[_0x8cfe('0x10')](_0xb5b086));if(_0xb5b086[_0x8cfe('0x11')]){if(_0xb5b086[_0x8cfe('0x11')]['code']===0x1f4){logger[_0x8cfe('0x11')](_0x8cfe('0xd'),_0x545e42,_0xb5b086[_0x8cfe('0x11')]['message']);return _0x40b535(_0xb5b086[_0x8cfe('0x11')][_0x8cfe('0x12')]);}logger[_0x8cfe('0x11')](_0x8cfe('0xd'),_0x545e42,_0xb5b086[_0x8cfe('0x11')]['message']);return _0x1b34d2(_0xb5b086['error'][_0x8cfe('0x12')]);}else{logger[_0x8cfe('0x13')](_0x8cfe('0xd'),_0x545e42,_0x8cfe('0xe'));_0x1b34d2(_0xb5b086['result'][_0x8cfe('0x12')]);}})[_0x8cfe('0x14')](function(_0x372ba6){logger['error'](_0x8cfe('0xd'),_0x545e42,_0x372ba6);_0x40b535(_0x372ba6);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index b77d501..9d20854 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 _0x69d7=['index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cdr.controller','get','isAuthenticated'];(function(_0x5779be,_0x52d30d){var _0x28e499=function(_0x3e0aab){while(--_0x3e0aab){_0x5779be['push'](_0x5779be['shift']());}};_0x28e499(++_0x52d30d);}(_0x69d7,0x14e));var _0x769d=function(_0x18b1c8,_0x4205e2){_0x18b1c8=_0x18b1c8-0x0;var _0x484756=_0x69d7[_0x18b1c8];return _0x484756;};'use strict';var multer=require(_0x769d('0x0'));var util=require(_0x769d('0x1'));var path=require(_0x769d('0x2'));var timeout=require(_0x769d('0x3'));var express=require('express');var router=express[_0x769d('0x4')]();var fs_extra=require(_0x769d('0x5'));var auth=require(_0x769d('0x6'));var interaction=require(_0x769d('0x7'));var config=require('../../config/environment');var controller=require(_0x769d('0x8'));router[_0x769d('0x9')]('/',auth[_0x769d('0xa')](),controller[_0x769d('0xb')]);router[_0x769d('0x9')](_0x769d('0xc'),auth[_0x769d('0xa')](),controller[_0x769d('0xd')]);router[_0x769d('0x9')](_0x769d('0xe'),auth[_0x769d('0xa')](),controller[_0x769d('0xf')]);router[_0x769d('0x10')]('/',auth[_0x769d('0xa')](),controller[_0x769d('0x11')]);router[_0x769d('0x12')](_0x769d('0xe'),auth[_0x769d('0xa')](),controller[_0x769d('0x13')]);router[_0x769d('0x14')]('/:id',auth[_0x769d('0xa')](),controller[_0x769d('0x15')]);module[_0x769d('0x16')]=router; \ No newline at end of file +var _0xccc4=['put','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./cdr.controller','isAuthenticated','index','get','describe','/:id','post','create'];(function(_0x23fcde,_0x300120){var _0x242954=function(_0x141ed5){while(--_0x141ed5){_0x23fcde['push'](_0x23fcde['shift']());}};_0x242954(++_0x300120);}(_0xccc4,0x9b));var _0x4ccc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xccc4[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x4ccc('0x0'));var util=require(_0x4ccc('0x1'));var path=require('path');var timeout=require(_0x4ccc('0x2'));var express=require('express');var router=express[_0x4ccc('0x3')]();var fs_extra=require(_0x4ccc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4ccc('0x5'));var config=require(_0x4ccc('0x6'));var controller=require(_0x4ccc('0x7'));router['get']('/',auth[_0x4ccc('0x8')](),controller[_0x4ccc('0x9')]);router[_0x4ccc('0xa')]('/describe',auth[_0x4ccc('0x8')](),controller[_0x4ccc('0xb')]);router['get'](_0x4ccc('0xc'),auth[_0x4ccc('0x8')](),controller['show']);router[_0x4ccc('0xd')]('/',auth['isAuthenticated'](),controller[_0x4ccc('0xe')]);router[_0x4ccc('0xf')](_0x4ccc('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x4ccc('0xc'),auth[_0x4ccc('0x8')](),controller['destroy']);module[_0x4ccc('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 1c46800..9e857c7 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 _0x78ee=['sequelize','exports','noop','TEXT','STRING','*,*,*,*'];(function(_0x18b6a6,_0xe0ee41){var _0x109350=function(_0x5dac09){while(--_0x5dac09){_0x18b6a6['push'](_0x18b6a6['shift']());}};_0x109350(++_0xe0ee41);}(_0x78ee,0x1ec));var _0xe78e=function(_0x47280a,_0x541f81){_0x47280a=_0x47280a-0x0;var _0x1c893c=_0x78ee[_0x47280a];return _0x1c893c;};'use strict';var Sequelize=require(_0xe78e('0x0'));module[_0xe78e('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe78e('0x2')},'appdata':{'type':Sequelize[_0xe78e('0x3')]()},'description':{'type':Sequelize[_0xe78e('0x4')]},'interval':{'type':Sequelize[_0xe78e('0x4')],'defaultValue':_0xe78e('0x5')}}; \ No newline at end of file +var _0x95c2=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x201817,_0x5e8cd6){var _0x20a5e2=function(_0xb6fb2c){while(--_0xb6fb2c){_0x201817['push'](_0x201817['shift']());}};_0x20a5e2(++_0x5e8cd6);}(_0x95c2,0x1bc));var _0x295c=function(_0x17c870,_0x44538d){_0x17c870=_0x17c870-0x0;var _0x329b96=_0x95c2[_0x17c870];return _0x329b96;};'use strict';var Sequelize=require(_0x295c('0x0'));module[_0x295c('0x1')]={'priority':{'type':Sequelize[_0x295c('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x295c('0x3')},'appdata':{'type':Sequelize[_0x295c('0x4')]()},'description':{'type':Sequelize[_0x295c('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x295c('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index b62c5ce..9acae41 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 _0x1295=['save','update','then','destroy','error','stack','send','show','params','keys','ChatApplication','rawAttributes','query','filters','intersection','model','attributes','fields','includeAll','include','body','catch','find','eml-format','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','set','apply','reject'];(function(_0x30c7c5,_0x168208){var _0x29e24e=function(_0x427d3e){while(--_0x427d3e){_0x30c7c5['push'](_0x30c7c5['shift']());}};_0x29e24e(++_0x168208);}(_0x1295,0x191));var _0x5129=function(_0x42b005,_0x58973a){_0x42b005=_0x42b005-0x0;var _0x33f71b=_0x1295[_0x42b005];return _0x33f71b;};'use strict';var emlformat=require(_0x5129('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5129('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5129('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5129('0x3'));var util=require(_0x5129('0x4'));var path=require(_0x5129('0x5'));var sox=require(_0x5129('0x6'));var csv=require(_0x5129('0x7'));var ejs=require(_0x5129('0x8'));var fs=require('fs');var fs_extra=require(_0x5129('0x9'));var _=require(_0x5129('0xa'));var squel=require(_0x5129('0xb'));var crypto=require(_0x5129('0xc'));var jsforce=require(_0x5129('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5129('0xe'));var Papa=require(_0x5129('0xf'));var Redis=require(_0x5129('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5129('0x11'));var as=require(_0x5129('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5129('0x13'))(_0x5129('0x14'));var utils=require(_0x5129('0x15'));var config=require(_0x5129('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5129('0x17'))['db'];function respondWithStatusCode(_0xcb11c6,_0x350507){_0x350507=_0x350507||0xcc;return function(_0x2774bf){if(_0x2774bf){return _0xcb11c6[_0x5129('0x18')](_0x350507);}return _0xcb11c6[_0x5129('0x19')](_0x350507)[_0x5129('0x1a')]();};}function respondWithResult(_0x23457f,_0x5e9a46){_0x5e9a46=_0x5e9a46||0xc8;return function(_0x2b9d65){if(_0x2b9d65){return _0x23457f[_0x5129('0x19')](_0x5e9a46)['json'](_0x2b9d65);}};}function respondWithFilteredResult(_0x1a6dd8,_0x2fefda){return function(_0xb47643){if(_0xb47643){var _0x36a5c6=_0xb47643['count'],_0x183807=_0x2fefda[_0x5129('0x1b')],_0x10a38f=_0x2fefda['offset']+_0x2fefda['limit'],_0x3f98d1;if(_0x10a38f>=_0x36a5c6){_0x10a38f=_0x36a5c6;_0x3f98d1=0xc8;}else{_0x3f98d1=0xce;}_0x1a6dd8[_0x5129('0x19')](_0x3f98d1);return _0x1a6dd8[_0x5129('0x1c')]('Content-Range',_0x183807+'-'+_0x10a38f+'/'+_0x36a5c6)['json'](_0xb47643);}return null;};}function patchUpdates(_0x4b50fe){return function(_0x1288d5){try{jsonpatch[_0x5129('0x1d')](_0x1288d5,_0x4b50fe,!![]);}catch(_0x1999df){return BPromise[_0x5129('0x1e')](_0x1999df);}return _0x1288d5[_0x5129('0x1f')]();};}function saveUpdates(_0x272202,_0x32a0be){return function(_0x139e71){if(_0x139e71){return _0x139e71[_0x5129('0x20')](_0x272202)[_0x5129('0x21')](function(_0x3fc4d8){return _0x3fc4d8;});}return null;};}function removeEntity(_0x191e6f,_0x295c11){return function(_0x210f1d){if(_0x210f1d){return _0x210f1d[_0x5129('0x22')]()[_0x5129('0x21')](function(){_0x191e6f['status'](0xcc)[_0x5129('0x1a')]();});}};}function handleEntityNotFound(_0x3f54b9,_0x2f1114){return function(_0x31f59b){if(!_0x31f59b){_0x3f54b9['sendStatus'](0x194);}return _0x31f59b;};}function handleError(_0x181fb9,_0x2e64e4){_0x2e64e4=_0x2e64e4||0x1f4;return function(_0x1b2509){logger[_0x5129('0x23')](_0x1b2509[_0x5129('0x24')]);if(_0x1b2509['name']){delete _0x1b2509['name'];}_0x181fb9[_0x5129('0x19')](_0x2e64e4)[_0x5129('0x25')](_0x1b2509);};}exports[_0x5129('0x26')]=function(_0x317c9d,_0x3e87df){var _0x2db994={'raw':!![],'where':{'id':_0x317c9d[_0x5129('0x27')]['id']}},_0x179021={};_0x179021['model']=_[_0x5129('0x28')](db[_0x5129('0x29')][_0x5129('0x2a')]);_0x179021['query']=_[_0x5129('0x28')](_0x317c9d[_0x5129('0x2b')]);_0x179021[_0x5129('0x2c')]=_[_0x5129('0x2d')](_0x179021[_0x5129('0x2e')],_0x179021[_0x5129('0x2b')]);_0x2db994[_0x5129('0x2f')]=_[_0x5129('0x2d')](_0x179021[_0x5129('0x2e')],qs[_0x5129('0x30')](_0x317c9d[_0x5129('0x2b')][_0x5129('0x30')]));_0x2db994['attributes']=_0x2db994[_0x5129('0x2f')]['length']?_0x2db994[_0x5129('0x2f')]:_0x179021[_0x5129('0x2e')];if(_0x317c9d['query'][_0x5129('0x31')]){_0x2db994[_0x5129('0x32')]=[{'all':!![]}];}_0x2db994=_['merge']({},_0x2db994,_0x317c9d['options']);return db[_0x5129('0x29')]['find'](_0x2db994)[_0x5129('0x21')](handleEntityNotFound(_0x3e87df,null))[_0x5129('0x21')](respondWithResult(_0x3e87df,null))['catch'](handleError(_0x3e87df,null));};exports[_0x5129('0x20')]=function(_0x169053,_0x47d852){if(_0x169053['body']['id']){delete _0x169053[_0x5129('0x33')]['id'];}return db[_0x5129('0x29')]['find']({'where':{'id':_0x169053[_0x5129('0x27')]['id']}})[_0x5129('0x21')](handleEntityNotFound(_0x47d852,null))[_0x5129('0x21')](saveUpdates(_0x169053['body'],null))[_0x5129('0x21')](respondWithResult(_0x47d852,null))[_0x5129('0x34')](handleError(_0x47d852,null));};exports[_0x5129('0x22')]=function(_0x30eea4,_0x1c1f53){return db['ChatApplication'][_0x5129('0x35')]({'where':{'id':_0x30eea4['params']['id']}})[_0x5129('0x21')](handleEntityNotFound(_0x1c1f53,null))[_0x5129('0x21')](removeEntity(_0x1c1f53,null))[_0x5129('0x34')](handleError(_0x1c1f53,null));}; \ No newline at end of file +var _0xb689=['fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','end','error','name','send','show','model','keys','ChatApplication','rawAttributes','query','intersection','attributes','fields','length','includeAll','merge','options','catch','body','find','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x23672f,_0x1a829e){var _0x245ad4=function(_0x381fee){while(--_0x381fee){_0x23672f['push'](_0x23672f['shift']());}};_0x245ad4(++_0x1a829e);}(_0xb689,0x6f));var _0x9b68=function(_0x4e7103,_0x2833f4){_0x4e7103=_0x4e7103-0x0;var _0x1eb67a=_0xb689[_0x4e7103];return _0x1eb67a;};'use strict';var emlformat=require(_0x9b68('0x0'));var rimraf=require(_0x9b68('0x1'));var zipdir=require(_0x9b68('0x2'));var jsonpatch=require(_0x9b68('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9b68('0x4'));var Mustache=require(_0x9b68('0x5'));var util=require(_0x9b68('0x6'));var path=require(_0x9b68('0x7'));var sox=require(_0x9b68('0x8'));var csv=require(_0x9b68('0x9'));var ejs=require(_0x9b68('0xa'));var fs=require('fs');var fs_extra=require(_0x9b68('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9b68('0xc'));var jsforce=require(_0x9b68('0xd'));var deskjs=require(_0x9b68('0xe'));var toCsv=require(_0x9b68('0x9'));var querystring=require(_0x9b68('0xf'));var Papa=require(_0x9b68('0x10'));var Redis=require(_0x9b68('0x11'));var authService=require(_0x9b68('0x12'));var qs=require(_0x9b68('0x13'));var as=require(_0x9b68('0x14'));var hardwareService=require(_0x9b68('0x15'));var logger=require(_0x9b68('0x16'))(_0x9b68('0x17'));var utils=require(_0x9b68('0x18'));var config=require(_0x9b68('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b68('0x1a'))['db'];function respondWithStatusCode(_0x3c5b2e,_0x55d3d0){_0x55d3d0=_0x55d3d0||0xcc;return function(_0x5af163){if(_0x5af163){return _0x3c5b2e['sendStatus'](_0x55d3d0);}return _0x3c5b2e[_0x9b68('0x1b')](_0x55d3d0)['end']();};}function respondWithResult(_0x4b63e7,_0x477954){_0x477954=_0x477954||0xc8;return function(_0x59c753){if(_0x59c753){return _0x4b63e7[_0x9b68('0x1b')](_0x477954)['json'](_0x59c753);}};}function respondWithFilteredResult(_0x1485a3,_0x15fabf){return function(_0x31b0f4){if(_0x31b0f4){var _0x4adac2=_0x31b0f4[_0x9b68('0x1c')],_0x10612d=_0x15fabf['offset'],_0x565ed8=_0x15fabf[_0x9b68('0x1d')]+_0x15fabf[_0x9b68('0x1e')],_0x1c4b81;if(_0x565ed8>=_0x4adac2){_0x565ed8=_0x4adac2;_0x1c4b81=0xc8;}else{_0x1c4b81=0xce;}_0x1485a3[_0x9b68('0x1b')](_0x1c4b81);return _0x1485a3[_0x9b68('0x1f')](_0x9b68('0x20'),_0x10612d+'-'+_0x565ed8+'/'+_0x4adac2)[_0x9b68('0x21')](_0x31b0f4);}return null;};}function patchUpdates(_0x5c3dea){return function(_0x159c44){try{jsonpatch[_0x9b68('0x22')](_0x159c44,_0x5c3dea,!![]);}catch(_0x1bdb41){return BPromise[_0x9b68('0x23')](_0x1bdb41);}return _0x159c44[_0x9b68('0x24')]();};}function saveUpdates(_0x1607e2,_0x14165e){return function(_0x314103){if(_0x314103){return _0x314103[_0x9b68('0x25')](_0x1607e2)[_0x9b68('0x26')](function(_0x5ed449){return _0x5ed449;});}return null;};}function removeEntity(_0x380ea4,_0x217f19){return function(_0xab9dad){if(_0xab9dad){return _0xab9dad['destroy']()[_0x9b68('0x26')](function(){_0x380ea4[_0x9b68('0x1b')](0xcc)[_0x9b68('0x27')]();});}};}function handleEntityNotFound(_0x571f4f,_0x57420f){return function(_0x4a60ed){if(!_0x4a60ed){_0x571f4f['sendStatus'](0x194);}return _0x4a60ed;};}function handleError(_0x5772ad,_0x1cefa1){_0x1cefa1=_0x1cefa1||0x1f4;return function(_0x4c7a7d){logger[_0x9b68('0x28')](_0x4c7a7d['stack']);if(_0x4c7a7d[_0x9b68('0x29')]){delete _0x4c7a7d[_0x9b68('0x29')];}_0x5772ad[_0x9b68('0x1b')](_0x1cefa1)[_0x9b68('0x2a')](_0x4c7a7d);};}exports[_0x9b68('0x2b')]=function(_0x2a67cf,_0x5c75f4){var _0x214e81={'raw':!![],'where':{'id':_0x2a67cf['params']['id']}},_0x4249b4={};_0x4249b4[_0x9b68('0x2c')]=_[_0x9b68('0x2d')](db[_0x9b68('0x2e')][_0x9b68('0x2f')]);_0x4249b4[_0x9b68('0x30')]=_[_0x9b68('0x2d')](_0x2a67cf['query']);_0x4249b4['filters']=_[_0x9b68('0x31')](_0x4249b4[_0x9b68('0x2c')],_0x4249b4[_0x9b68('0x30')]);_0x214e81[_0x9b68('0x32')]=_[_0x9b68('0x31')](_0x4249b4[_0x9b68('0x2c')],qs[_0x9b68('0x33')](_0x2a67cf[_0x9b68('0x30')][_0x9b68('0x33')]));_0x214e81[_0x9b68('0x32')]=_0x214e81['attributes'][_0x9b68('0x34')]?_0x214e81[_0x9b68('0x32')]:_0x4249b4[_0x9b68('0x2c')];if(_0x2a67cf['query'][_0x9b68('0x35')]){_0x214e81['include']=[{'all':!![]}];}_0x214e81=_[_0x9b68('0x36')]({},_0x214e81,_0x2a67cf[_0x9b68('0x37')]);return db[_0x9b68('0x2e')]['find'](_0x214e81)['then'](handleEntityNotFound(_0x5c75f4,null))['then'](respondWithResult(_0x5c75f4,null))[_0x9b68('0x38')](handleError(_0x5c75f4,null));};exports[_0x9b68('0x25')]=function(_0x3fec87,_0x49765d){if(_0x3fec87['body']['id']){delete _0x3fec87[_0x9b68('0x39')]['id'];}return db[_0x9b68('0x2e')][_0x9b68('0x3a')]({'where':{'id':_0x3fec87[_0x9b68('0x3b')]['id']}})['then'](handleEntityNotFound(_0x49765d,null))[_0x9b68('0x26')](saveUpdates(_0x3fec87['body'],null))[_0x9b68('0x26')](respondWithResult(_0x49765d,null))['catch'](handleError(_0x49765d,null));};exports[_0x9b68('0x3c')]=function(_0x3487dd,_0x107291){return db['ChatApplication'][_0x9b68('0x3a')]({'where':{'id':_0x3487dd[_0x9b68('0x3b')]['id']}})[_0x9b68('0x26')](handleEntityNotFound(_0x107291,null))[_0x9b68('0x26')](removeEntity(_0x107291,null))[_0x9b68('0x38')](handleError(_0x107291,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 0af3f7f..858569a 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 e17bb03..a292e30 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 _0x01d1=['code','message','info','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5ebf3b,_0x134b74){var _0x2b0982=function(_0x6f3963){while(--_0x6f3963){_0x5ebf3b['push'](_0x5ebf3b['shift']());}};_0x2b0982(++_0x134b74);}(_0x01d1,0x14e));var _0x101d=function(_0xf70dcd,_0x4548e0){_0xf70dcd=_0xf70dcd-0x0;var _0x54ad43=_0x01d1[_0xf70dcd];return _0x54ad43;};'use strict';var _=require(_0x101d('0x0'));var util=require(_0x101d('0x1'));var moment=require(_0x101d('0x2'));var BPromise=require('bluebird');var rs=require(_0x101d('0x3'));var fs=require('fs');var Redis=require(_0x101d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x101d('0x5'));var logger=require(_0x101d('0x6'))(_0x101d('0x7'));var config=require('../../config/environment');var jayson=require(_0x101d('0x8'));var client=jayson[_0x101d('0x9')][_0x101d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e495e,_0x49025e,_0x93e282){return new BPromise(function(_0x14c4aa,_0x2f52c4){return client['request'](_0x4e495e,_0x93e282)[_0x101d('0xb')](function(_0x2ef45a){logger['info'](_0x101d('0xc'),_0x49025e,_0x101d('0xd'));logger[_0x101d('0xe')](_0x101d('0xf'),_0x49025e,_0x101d('0xd'),JSON[_0x101d('0x10')](_0x2ef45a));if(_0x2ef45a['error']){if(_0x2ef45a[_0x101d('0x11')][_0x101d('0x12')]===0x1f4){logger[_0x101d('0x11')](_0x101d('0xc'),_0x49025e,_0x2ef45a[_0x101d('0x11')][_0x101d('0x13')]);return _0x2f52c4(_0x2ef45a['error']['message']);}logger[_0x101d('0x11')](_0x101d('0xc'),_0x49025e,_0x2ef45a[_0x101d('0x11')][_0x101d('0x13')]);return _0x14c4aa(_0x2ef45a[_0x101d('0x11')][_0x101d('0x13')]);}else{logger[_0x101d('0x14')]('ChatApplication,\x20%s,\x20%s',_0x49025e,'request\x20sent');_0x14c4aa(_0x2ef45a['result'][_0x101d('0x13')]);}})[_0x101d('0x15')](function(_0x34f2c6){logger[_0x101d('0x11')](_0x101d('0xc'),_0x49025e,_0x34f2c6);_0x2f52c4(_0x34f2c6);});});} \ No newline at end of file +var _0x0a57=['info','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3d4320,_0x31b6e5){var _0x3ef70e=function(_0x136c29){while(--_0x136c29){_0x3d4320['push'](_0x3d4320['shift']());}};_0x3ef70e(++_0x31b6e5);}(_0x0a57,0x137));var _0x70a5=function(_0x10975f,_0x470dd3){_0x10975f=_0x10975f-0x0;var _0x306a16=_0x0a57[_0x10975f];return _0x306a16;};'use strict';var _=require('lodash');var util=require(_0x70a5('0x0'));var moment=require(_0x70a5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x70a5('0x2'));var db=require(_0x70a5('0x3'))['db'];var utils=require(_0x70a5('0x4'));var logger=require(_0x70a5('0x5'))(_0x70a5('0x6'));var config=require(_0x70a5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x70a5('0x8')][_0x70a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24cb82,_0x3a0fce,_0x289934){return new BPromise(function(_0x385b03,_0x3db1ea){return client[_0x70a5('0xa')](_0x24cb82,_0x289934)[_0x70a5('0xb')](function(_0x44a2dc){logger['info'](_0x70a5('0xc'),_0x3a0fce,_0x70a5('0xd'));logger[_0x70a5('0xe')](_0x70a5('0xf'),_0x3a0fce,_0x70a5('0xd'),JSON[_0x70a5('0x10')](_0x44a2dc));if(_0x44a2dc['error']){if(_0x44a2dc[_0x70a5('0x11')]['code']===0x1f4){logger[_0x70a5('0x11')]('ChatApplication,\x20%s,\x20%s',_0x3a0fce,_0x44a2dc[_0x70a5('0x11')]['message']);return _0x3db1ea(_0x44a2dc[_0x70a5('0x11')][_0x70a5('0x12')]);}logger[_0x70a5('0x11')](_0x70a5('0xc'),_0x3a0fce,_0x44a2dc['error'][_0x70a5('0x12')]);return _0x385b03(_0x44a2dc[_0x70a5('0x11')]['message']);}else{logger[_0x70a5('0x13')](_0x70a5('0xc'),_0x3a0fce,_0x70a5('0xd'));_0x385b03(_0x44a2dc[_0x70a5('0x14')][_0x70a5('0x12')]);}})[_0x70a5('0x15')](function(_0xea87fd){logger[_0x70a5('0x11')](_0x70a5('0xc'),_0x3a0fce,_0xea87fd);_0x3db1ea(_0xea87fd);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 7f1c0ea..b632e5a 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 _0xa8d5=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','put','destroy','exports','multer','path','connect-timeout'];(function(_0x193339,_0x283492){var _0x3fa73b=function(_0x1ab212){while(--_0x1ab212){_0x193339['push'](_0x193339['shift']());}};_0x3fa73b(++_0x283492);}(_0xa8d5,0x66));var _0x5a8d=function(_0x4f4578,_0x24a469){_0x4f4578=_0x4f4578-0x0;var _0xe169f6=_0xa8d5[_0x4f4578];return _0xe169f6;};'use strict';var multer=require(_0x5a8d('0x0'));var util=require('util');var path=require(_0x5a8d('0x1'));var timeout=require(_0x5a8d('0x2'));var express=require(_0x5a8d('0x3'));var router=express[_0x5a8d('0x4')]();var fs_extra=require(_0x5a8d('0x5'));var auth=require(_0x5a8d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5a8d('0x7'));var controller=require('./chatApplication.controller');router[_0x5a8d('0x8')](_0x5a8d('0x9'),auth[_0x5a8d('0xa')](),controller[_0x5a8d('0xb')]);router[_0x5a8d('0xc')](_0x5a8d('0x9'),auth[_0x5a8d('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5a8d('0xd')]);module[_0x5a8d('0xe')]=router; \ No newline at end of file +var _0x6834=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','show','put','isAuthenticated','update','delete','destroy','exports','multer','connect-timeout','Router'];(function(_0x141fcc,_0x35e4db){var _0x51d10e=function(_0x247793){while(--_0x247793){_0x141fcc['push'](_0x141fcc['shift']());}};_0x51d10e(++_0x35e4db);}(_0x6834,0x156));var _0x4683=function(_0x51c27d,_0x3feea2){_0x51c27d=_0x51c27d-0x0;var _0x342e05=_0x6834[_0x51c27d];return _0x342e05;};'use strict';var multer=require(_0x4683('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4683('0x1'));var express=require('express');var router=express[_0x4683('0x2')]();var fs_extra=require(_0x4683('0x3'));var auth=require(_0x4683('0x4'));var interaction=require(_0x4683('0x5'));var config=require(_0x4683('0x6'));var controller=require('./chatApplication.controller');router['get'](_0x4683('0x7'),auth['isAuthenticated'](),controller[_0x4683('0x8')]);router[_0x4683('0x9')](_0x4683('0x7'),auth[_0x4683('0xa')](),controller[_0x4683('0xb')]);router[_0x4683('0xc')](_0x4683('0x7'),auth['isAuthenticated'](),controller[_0x4683('0xd')]);module[_0x4683('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 19c8655..a10c590 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 _0x5200=['BOOLEAN','sequelize','exports','STRING'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x5200,0xbd));var _0x0520=function(_0x28c4f5,_0x483592){_0x28c4f5=_0x28c4f5-0x0;var _0x296953=_0x5200[_0x28c4f5];return _0x296953;};'use strict';var Sequelize=require(_0x0520('0x0'));module[_0x0520('0x1')]={'name':{'type':Sequelize[_0x0520('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x0520('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2ebe=['sequelize','BOOLEAN'];(function(_0x1f1a97,_0xadfc15){var _0x29fc6a=function(_0x38c180){while(--_0x38c180){_0x1f1a97['push'](_0x1f1a97['shift']());}};_0x29fc6a(++_0xadfc15);}(_0x2ebe,0xd8));var _0xe2eb=function(_0xc36836,_0x58812e){_0xc36836=_0xc36836-0x0;var _0x5bad55=_0x2ebe[_0xc36836];return _0x5bad55;};'use strict';var Sequelize=require(_0xe2eb('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xe2eb('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 1d85d53..5237a18 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 _0x7cfe=['YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','request','then','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatGroup,\x20%s,\x20%s','info','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','update','end','stack','name','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','describe','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','User','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','findOne','order','$gte','format'];(function(_0xd13ec3,_0x3dd124){var _0x4e79e9=function(_0x1b68cf){while(--_0x1b68cf){_0xd13ec3['push'](_0xd13ec3['shift']());}};_0x4e79e9(++_0x3dd124);}(_0x7cfe,0xd9));var _0xe7cf=function(_0x3ad133,_0x53bc68){_0x3ad133=_0x3ad133-0x0;var _0x8120f9=_0x7cfe[_0x3ad133];return _0x8120f9;};'use strict';var emlformat=require(_0xe7cf('0x0'));var rimraf=require(_0xe7cf('0x1'));var zipdir=require(_0xe7cf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe7cf('0x3'));var moment=require(_0xe7cf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe7cf('0x5'));var util=require('util');var path=require(_0xe7cf('0x6'));var sox=require('sox');var csv=require(_0xe7cf('0x7'));var ejs=require(_0xe7cf('0x8'));var fs=require('fs');var fs_extra=require(_0xe7cf('0x9'));var _=require(_0xe7cf('0xa'));var squel=require(_0xe7cf('0xb'));var crypto=require(_0xe7cf('0xc'));var jsforce=require(_0xe7cf('0xd'));var deskjs=require(_0xe7cf('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe7cf('0xf'));var Papa=require('papaparse');var Redis=require(_0xe7cf('0x10'));var authService=require(_0xe7cf('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe7cf('0x12'));var hardwareService=require(_0xe7cf('0x13'));var logger=require('../../config/logger')(_0xe7cf('0x14'));var utils=require(_0xe7cf('0x15'));var config=require(_0xe7cf('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe7cf('0x17'))['db'];config['redis']=_['defaults'](config[_0xe7cf('0x18')],{'host':_0xe7cf('0x19'),'port':0x18eb});var socket=require(_0xe7cf('0x1a'))(new Redis(config[_0xe7cf('0x18')]));require('./chatGroup.socket')[_0xe7cf('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe7cf('0x1c')][_0xe7cf('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5e84d8,_0x280824,_0xbb52c8,_0x2e34a5){return new BPromise(function(_0x311696,_0x54ab0a){var _0x39d0c0=_0x2e34a5||client;return _0x39d0c0[_0xe7cf('0x1e')](_0x5e84d8,_0xbb52c8)[_0xe7cf('0x1f')](function(_0x57721c){logger['info']('ChatGroup,\x20%s,\x20%s',_0x280824,_0xe7cf('0x20'));logger[_0xe7cf('0x21')](_0xe7cf('0x22'),_0x280824,_0xe7cf('0x20'),JSON[_0xe7cf('0x23')](_0x57721c));if(_0x57721c['error']){if(_0x57721c[_0xe7cf('0x24')][_0xe7cf('0x25')]===0x1f4){logger[_0xe7cf('0x24')]('ChatGroup,\x20%s,\x20%s',_0x280824,_0x57721c[_0xe7cf('0x24')][_0xe7cf('0x26')]);return _0x54ab0a(_0x57721c['error'][_0xe7cf('0x26')]);}logger[_0xe7cf('0x24')](_0xe7cf('0x27'),_0x280824,_0x57721c[_0xe7cf('0x24')]['message']);return _0x311696(_0x57721c[_0xe7cf('0x24')][_0xe7cf('0x26')]);}else{logger[_0xe7cf('0x28')](_0xe7cf('0x27'),_0x280824,_0xe7cf('0x20'));_0x311696(_0x57721c['result'][_0xe7cf('0x26')]);}})['catch'](function(_0x3954f6){logger[_0xe7cf('0x24')](_0xe7cf('0x27'),_0x280824,_0x3954f6);_0x54ab0a(_0x3954f6);});});}function respondWithStatusCode(_0x3d670e,_0x5e24c8){_0x5e24c8=_0x5e24c8||0xcc;return function(_0x461c76){if(_0x461c76){return _0x3d670e[_0xe7cf('0x29')](_0x5e24c8);}return _0x3d670e[_0xe7cf('0x2a')](_0x5e24c8)['end']();};}function respondWithResult(_0x38cd7c,_0x538f17){_0x538f17=_0x538f17||0xc8;return function(_0x115a12){if(_0x115a12){return _0x38cd7c[_0xe7cf('0x2a')](_0x538f17)['json'](_0x115a12);}};}function respondWithFilteredResult(_0x28ac76,_0x58ec15){return function(_0x2431ad){if(_0x2431ad){var _0xce8f32=_0x2431ad[_0xe7cf('0x2b')],_0x398c4a=_0x58ec15[_0xe7cf('0x2c')],_0x28ae60=_0x58ec15[_0xe7cf('0x2c')]+_0x58ec15['limit'],_0x3d60f1;if(_0x28ae60>=_0xce8f32){_0x28ae60=_0xce8f32;_0x3d60f1=0xc8;}else{_0x3d60f1=0xce;}_0x28ac76[_0xe7cf('0x2a')](_0x3d60f1);return _0x28ac76[_0xe7cf('0x2d')](_0xe7cf('0x2e'),_0x398c4a+'-'+_0x28ae60+'/'+_0xce8f32)[_0xe7cf('0x2f')](_0x2431ad);}return null;};}function patchUpdates(_0x409081){return function(_0x56ad2c){try{jsonpatch[_0xe7cf('0x30')](_0x56ad2c,_0x409081,!![]);}catch(_0x571e75){return BPromise[_0xe7cf('0x31')](_0x571e75);}return _0x56ad2c[_0xe7cf('0x32')]();};}function saveUpdates(_0x53555a,_0xfaab88){return function(_0x3cf55c){if(_0x3cf55c){return _0x3cf55c[_0xe7cf('0x33')](_0x53555a)[_0xe7cf('0x1f')](function(_0x141e83){return _0x141e83;});}return null;};}function removeEntity(_0x26b5e4,_0x4aedfe){return function(_0x1442b5){if(_0x1442b5){return _0x1442b5['destroy']()[_0xe7cf('0x1f')](function(){_0x26b5e4[_0xe7cf('0x2a')](0xcc)[_0xe7cf('0x34')]();});}};}function handleEntityNotFound(_0x1f124f,_0x1de38a){return function(_0x1e0cdb){if(!_0x1e0cdb){_0x1f124f['sendStatus'](0x194);}return _0x1e0cdb;};}function handleError(_0x54ae53,_0x5c8d75){_0x5c8d75=_0x5c8d75||0x1f4;return function(_0x5388bc){logger[_0xe7cf('0x24')](_0x5388bc[_0xe7cf('0x35')]);if(_0x5388bc[_0xe7cf('0x36')]){delete _0x5388bc[_0xe7cf('0x36')];}_0x54ae53[_0xe7cf('0x2a')](_0x5c8d75)['send'](_0x5388bc);};}exports[_0xe7cf('0x37')]=function(_0x2ad4ad,_0x2c6a3d){var _0xecfdbf={},_0x132591={},_0x17d4db={'count':0x0,'rows':[]};var _0x455a7c=_[_0xe7cf('0x38')](db[_0xe7cf('0x39')][_0xe7cf('0x3a')],function(_0x1b6732){return{'name':_0x1b6732[_0xe7cf('0x3b')],'type':_0x1b6732[_0xe7cf('0x3c')][_0xe7cf('0x3d')]};});_0x132591[_0xe7cf('0x3e')]=_[_0xe7cf('0x38')](_0x455a7c,_0xe7cf('0x36'));_0x132591[_0xe7cf('0x3f')]=_[_0xe7cf('0x40')](_0x2ad4ad[_0xe7cf('0x3f')]);_0x132591['filters']=_[_0xe7cf('0x41')](_0x132591[_0xe7cf('0x3e')],_0x132591[_0xe7cf('0x3f')]);_0xecfdbf['attributes']=_[_0xe7cf('0x41')](_0x132591[_0xe7cf('0x3e')],qs['fields'](_0x2ad4ad['query'][_0xe7cf('0x42')]));_0xecfdbf[_0xe7cf('0x43')]=_0xecfdbf[_0xe7cf('0x43')][_0xe7cf('0x44')]?_0xecfdbf[_0xe7cf('0x43')]:_0x132591['model'];if(!_0x2ad4ad[_0xe7cf('0x3f')][_0xe7cf('0x45')]('nolimit')){_0xecfdbf[_0xe7cf('0x46')]=qs[_0xe7cf('0x46')](_0x2ad4ad[_0xe7cf('0x3f')]['limit']);_0xecfdbf[_0xe7cf('0x2c')]=qs[_0xe7cf('0x2c')](_0x2ad4ad['query']['offset']);}_0xecfdbf['order']=qs[_0xe7cf('0x47')](_0x2ad4ad[_0xe7cf('0x3f')]['sort']);_0xecfdbf[_0xe7cf('0x48')]=qs['filters'](_[_0xe7cf('0x49')](_0x2ad4ad[_0xe7cf('0x3f')],_0x132591[_0xe7cf('0x4a')]),_0x455a7c);if(_0x2ad4ad[_0xe7cf('0x3f')][_0xe7cf('0x4b')]){_0xecfdbf[_0xe7cf('0x48')]=_[_0xe7cf('0x4c')](_0xecfdbf[_0xe7cf('0x48')],{'$or':_['map'](_0x455a7c,function(_0x25e421){if(_0x25e421[_0xe7cf('0x3c')]!==_0xe7cf('0x4d')){var _0x452453={};_0x452453[_0x25e421[_0xe7cf('0x36')]]={'$like':'%'+_0x2ad4ad[_0xe7cf('0x3f')][_0xe7cf('0x4b')]+'%'};return _0x452453;}})});}_0xecfdbf=_['merge']({},_0xecfdbf,_0x2ad4ad[_0xe7cf('0x4e')]);var _0x1e858a={'where':_0xecfdbf[_0xe7cf('0x48')]};return db[_0xe7cf('0x39')][_0xe7cf('0x2b')](_0x1e858a)['then'](function(_0x1b647b){_0x17d4db[_0xe7cf('0x2b')]=_0x1b647b;if(_0x2ad4ad[_0xe7cf('0x3f')][_0xe7cf('0x4f')]){_0xecfdbf[_0xe7cf('0x50')]=[{'all':!![]}];}return db[_0xe7cf('0x39')][_0xe7cf('0x51')](_0xecfdbf);})[_0xe7cf('0x1f')](function(_0x43b45c){_0x17d4db[_0xe7cf('0x52')]=_0x43b45c;return _0x17d4db;})[_0xe7cf('0x1f')](respondWithFilteredResult(_0x2c6a3d,_0xecfdbf))[_0xe7cf('0x53')](handleError(_0x2c6a3d,null));};exports[_0xe7cf('0x54')]=function(_0x2a33cd,_0x764cca){var _0x5cb430={'raw':!![],'where':{'id':_0x2a33cd['params']['id']}},_0x502ec3={};_0x502ec3[_0xe7cf('0x3e')]=_['keys'](db[_0xe7cf('0x39')][_0xe7cf('0x3a')]);_0x502ec3[_0xe7cf('0x3f')]=_[_0xe7cf('0x40')](_0x2a33cd[_0xe7cf('0x3f')]);_0x502ec3[_0xe7cf('0x4a')]=_[_0xe7cf('0x41')](_0x502ec3[_0xe7cf('0x3e')],_0x502ec3[_0xe7cf('0x3f')]);_0x5cb430[_0xe7cf('0x43')]=_[_0xe7cf('0x41')](_0x502ec3['model'],qs[_0xe7cf('0x42')](_0x2a33cd['query'][_0xe7cf('0x42')]));_0x5cb430[_0xe7cf('0x43')]=_0x5cb430[_0xe7cf('0x43')][_0xe7cf('0x44')]?_0x5cb430['attributes']:_0x502ec3[_0xe7cf('0x3e')];if(_0x2a33cd[_0xe7cf('0x3f')]['includeAll']){_0x5cb430[_0xe7cf('0x50')]=[{'all':!![]}];}_0x5cb430=_[_0xe7cf('0x4c')]({},_0x5cb430,_0x2a33cd['options']);return db[_0xe7cf('0x39')][_0xe7cf('0x55')](_0x5cb430)['then'](handleEntityNotFound(_0x764cca,null))[_0xe7cf('0x1f')](respondWithResult(_0x764cca,null))['catch'](handleError(_0x764cca,null));};exports[_0xe7cf('0x56')]=function(_0x57c37d,_0x2136fe){return db[_0xe7cf('0x39')][_0xe7cf('0x56')](_0x57c37d['body'],{})[_0xe7cf('0x1f')](respondWithResult(_0x2136fe,0xc9))[_0xe7cf('0x53')](handleError(_0x2136fe,null));};exports[_0xe7cf('0x33')]=function(_0x1d1b68,_0x74e91c){if(_0x1d1b68[_0xe7cf('0x57')]['id']){delete _0x1d1b68['body']['id'];}return db[_0xe7cf('0x39')][_0xe7cf('0x55')]({'where':{'id':_0x1d1b68[_0xe7cf('0x58')]['id']}})[_0xe7cf('0x1f')](handleEntityNotFound(_0x74e91c,null))[_0xe7cf('0x1f')](saveUpdates(_0x1d1b68[_0xe7cf('0x57')],null))[_0xe7cf('0x1f')](respondWithResult(_0x74e91c,null))[_0xe7cf('0x53')](handleError(_0x74e91c,null));};exports[_0xe7cf('0x59')]=function(_0x15c30d,_0x2e9668){return db['ChatGroup'][_0xe7cf('0x55')]({'where':{'id':_0x15c30d[_0xe7cf('0x58')]['id']}})[_0xe7cf('0x1f')](handleEntityNotFound(_0x2e9668,null))['then'](removeEntity(_0x2e9668,null))[_0xe7cf('0x53')](handleError(_0x2e9668,null));};exports[_0xe7cf('0x5a')]=function(_0x1be84b,_0x701ea){return db[_0xe7cf('0x39')][_0xe7cf('0x5a')]()[_0xe7cf('0x1f')](respondWithResult(_0x701ea,null))[_0xe7cf('0x53')](handleError(_0x701ea,null));};exports['getUnread']=function(_0x3ce70e,_0x1ff79c,_0x5356aa){return db[_0xe7cf('0x5b')]['count']({'where':{'ChatGroupId':_0x3ce70e[_0xe7cf('0x58')]['id'],'ToId':_0x3ce70e[_0xe7cf('0x5c')]['id'],'read':![]}})[_0xe7cf('0x1f')](function(_0x3bcc6d){return{'id':_[_0xe7cf('0x5d')](_0x3ce70e[_0xe7cf('0x58')]['id']),'count':_0x3bcc6d};})[_0xe7cf('0x1f')](respondWithResult(_0x1ff79c,null))[_0xe7cf('0x53')](handleError(_0x1ff79c,null));};exports['addMembers']=function(_0xb005c6,_0x31c1a4,_0x2f4f6f){return db[_0xe7cf('0x39')][_0xe7cf('0x55')]({'where':{'id':_0xb005c6[_0xe7cf('0x58')]['id']}})[_0xe7cf('0x1f')](handleEntityNotFound(_0x31c1a4,null))[_0xe7cf('0x1f')](function(_0xbb3669){if(_0xbb3669){return _0xbb3669[_0xe7cf('0x5e')](_0xb005c6['body'][_0xe7cf('0x5f')],_['omit'](_0xb005c6[_0xe7cf('0x57')],[_0xe7cf('0x5f'),'id'])||{});}})['then'](respondWithResult(_0x31c1a4,null))[_0xe7cf('0x53')](handleError(_0x31c1a4,null));};exports[_0xe7cf('0x60')]=function(_0x1cae6f,_0x5109ea,_0x482c80){var _0x19ad9e={};var _0x38a152={};var _0x492d3b;var _0x4984a3;return db[_0xe7cf('0x39')]['findOne']({'where':{'id':_0x1cae6f['params']['id']}})['then'](handleEntityNotFound(_0x5109ea,null))[_0xe7cf('0x1f')](function(_0x218180){if(_0x218180){_0x492d3b=_0x218180;_0x38a152[_0xe7cf('0x3e')]=_[_0xe7cf('0x40')](db[_0xe7cf('0x61')]['rawAttributes']);_0x38a152[_0xe7cf('0x3f')]=_['keys'](_0x1cae6f[_0xe7cf('0x3f')]);_0x38a152[_0xe7cf('0x4a')]=_['intersection'](_0x38a152[_0xe7cf('0x3e')],_0x38a152[_0xe7cf('0x3f')]);_0x19ad9e['attributes']=_[_0xe7cf('0x41')](_0x38a152['model'],qs[_0xe7cf('0x42')](_0x1cae6f[_0xe7cf('0x3f')][_0xe7cf('0x42')]));_0x19ad9e[_0xe7cf('0x43')]=_0x19ad9e[_0xe7cf('0x43')][_0xe7cf('0x44')]?_0x19ad9e['attributes']:_0x38a152['model'];_0x19ad9e['order']=qs[_0xe7cf('0x47')](_0x1cae6f[_0xe7cf('0x3f')][_0xe7cf('0x47')]);_0x19ad9e[_0xe7cf('0x48')]=qs[_0xe7cf('0x4a')](_[_0xe7cf('0x49')](_0x1cae6f[_0xe7cf('0x3f')],_0x38a152[_0xe7cf('0x4a')]));if(_0x1cae6f['query'][_0xe7cf('0x4b')]){_0x19ad9e[_0xe7cf('0x48')]=_['merge'](_0x19ad9e[_0xe7cf('0x48')],{'$or':_['map'](_0x19ad9e[_0xe7cf('0x43')],function(_0x2d9708){var _0x3f9b25={};_0x3f9b25[_0x2d9708]={'$like':'%'+_0x1cae6f[_0xe7cf('0x3f')][_0xe7cf('0x4b')]+'%'};return _0x3f9b25;})});}_0x19ad9e=_[_0xe7cf('0x4c')]({},_0x19ad9e,_0x1cae6f[_0xe7cf('0x4e')]);return _0x492d3b[_0xe7cf('0x60')](_0x19ad9e);}})['then'](function(_0x791fbc){if(_0x791fbc){_0x4984a3=_0x791fbc[_0xe7cf('0x44')];if(!_0x1cae6f['query'][_0xe7cf('0x45')](_0xe7cf('0x62'))){_0x19ad9e['limit']=qs[_0xe7cf('0x46')](_0x1cae6f[_0xe7cf('0x3f')][_0xe7cf('0x46')]);_0x19ad9e[_0xe7cf('0x2c')]=qs[_0xe7cf('0x2c')](_0x1cae6f[_0xe7cf('0x3f')]['offset']);}return _0x492d3b[_0xe7cf('0x60')](_0x19ad9e);}})[_0xe7cf('0x1f')](function(_0x1222af){if(_0x1222af){return _0x1222af?{'count':_0x4984a3,'rows':_0x1222af}:null;}})[_0xe7cf('0x1f')](respondWithResult(_0x5109ea,null))[_0xe7cf('0x53')](handleError(_0x5109ea,null));};exports['removeMembers']=function(_0x1d9381,_0x1d2b1f,_0x5de265){return db['ChatGroup'][_0xe7cf('0x55')]({'where':{'id':_0x1d9381[_0xe7cf('0x58')]['id']}})['then'](handleEntityNotFound(_0x1d2b1f,null))['then'](function(_0x11eac0){if(_0x11eac0){return _0x11eac0[_0xe7cf('0x63')](_0x1d9381[_0xe7cf('0x3f')][_0xe7cf('0x5f')]);}})[_0xe7cf('0x1f')](respondWithStatusCode(_0x1d2b1f,null))[_0xe7cf('0x53')](handleError(_0x1d2b1f,null));};exports[_0xe7cf('0x64')]=function(_0x4fc3a9,_0x192fad,_0x871d6d){if(_0x4fc3a9['body']['id']){delete _0x4fc3a9[_0xe7cf('0x57')]['id'];}return db[_0xe7cf('0x39')][_0xe7cf('0x55')]({'where':{'id':_0x4fc3a9[_0xe7cf('0x58')]['id']}})[_0xe7cf('0x1f')](handleEntityNotFound(_0x192fad,null))[_0xe7cf('0x1f')](function(_0x1da1df){if(_0x1da1df){_0x4fc3a9[_0xe7cf('0x57')][_0xe7cf('0x65')]=_0x1da1df['id'];return db['ChatInternalMessage'][_0xe7cf('0x56')](_0x4fc3a9['body']);}})[_0xe7cf('0x1f')](respondWithResult(_0x192fad,null))[_0xe7cf('0x53')](handleError(_0x192fad,null));};exports[_0xe7cf('0x66')]=function(_0x380948,_0x39d572,_0x64bda3){var _0x3a19d2={};var _0x551485={};var _0x37eeeb;var _0x586320;return db[_0xe7cf('0x39')][_0xe7cf('0x67')]({'where':{'id':_0x380948[_0xe7cf('0x58')]['id']}})['then'](handleEntityNotFound(_0x39d572,null))[_0xe7cf('0x1f')](function(_0x3ea542){if(_0x3ea542){_0x37eeeb=_0x3ea542;_0x551485[_0xe7cf('0x3e')]=_[_0xe7cf('0x40')](db[_0xe7cf('0x5b')][_0xe7cf('0x3a')]);_0x551485['query']=_[_0xe7cf('0x40')](_0x380948[_0xe7cf('0x3f')]);_0x551485['filters']=_[_0xe7cf('0x41')](_0x551485[_0xe7cf('0x3e')],_0x551485[_0xe7cf('0x3f')]);_0x3a19d2[_0xe7cf('0x43')]=_[_0xe7cf('0x41')](_0x551485[_0xe7cf('0x3e')],qs[_0xe7cf('0x42')](_0x380948['query'][_0xe7cf('0x42')]));_0x3a19d2[_0xe7cf('0x43')]=_0x3a19d2['attributes']['length']?_0x3a19d2[_0xe7cf('0x43')]:_0x551485['model'];_0x3a19d2[_0xe7cf('0x68')]=qs[_0xe7cf('0x47')](_0x380948[_0xe7cf('0x3f')][_0xe7cf('0x47')]);_0x3a19d2[_0xe7cf('0x48')]=qs[_0xe7cf('0x4a')](_[_0xe7cf('0x49')](_0x380948[_0xe7cf('0x3f')],_0x551485[_0xe7cf('0x4a')]));if(_0x380948[_0xe7cf('0x3f')][_0xe7cf('0x4b')]){_0x3a19d2[_0xe7cf('0x48')]=_[_0xe7cf('0x4c')](_0x3a19d2[_0xe7cf('0x48')],{'$or':_[_0xe7cf('0x38')](_0x3a19d2[_0xe7cf('0x43')],function(_0x51355a){var _0x47de37={};_0x47de37[_0x51355a]={'$like':'%'+_0x380948[_0xe7cf('0x3f')][_0xe7cf('0x4b')]+'%'};return _0x47de37;})});}if(_0x380948[_0xe7cf('0x3f')][_0xe7cf('0x69')]){var _0x2a2d37=_0x380948['query'][_0xe7cf('0x69')]['split'](',');var _0x16bcf1={};_0x16bcf1[_0x2a2d37[0x0]]={'$gte':moment(_0x2a2d37[0x1])[_0xe7cf('0x6a')](_0xe7cf('0x6b'))};_0x3a19d2[_0xe7cf('0x48')]=_[_0xe7cf('0x4c')](_0x3a19d2['where'],_0x16bcf1);}_0x3a19d2=_[_0xe7cf('0x4c')]({},_0x3a19d2,_0x380948[_0xe7cf('0x4e')]);return _0x37eeeb[_0xe7cf('0x66')](_0x3a19d2);}})[_0xe7cf('0x1f')](function(_0xcdacb8){if(_0xcdacb8){_0x586320=_0xcdacb8[_0xe7cf('0x44')];if(!_0x380948[_0xe7cf('0x3f')][_0xe7cf('0x45')](_0xe7cf('0x62'))){_0x3a19d2[_0xe7cf('0x46')]=qs[_0xe7cf('0x46')](_0x380948['query'][_0xe7cf('0x46')]);_0x3a19d2[_0xe7cf('0x2c')]=qs[_0xe7cf('0x2c')](_0x380948['query'][_0xe7cf('0x2c')]);}return _0x37eeeb[_0xe7cf('0x66')](_0x3a19d2);}})[_0xe7cf('0x1f')](function(_0x3e2937){if(_0x3e2937){return _0x3e2937?{'count':_0x586320,'rows':_0x3e2937}:null;}})[_0xe7cf('0x1f')](respondWithResult(_0x39d572,null))[_0xe7cf('0x53')](handleError(_0x39d572,null));}; \ No newline at end of file +var _0x595e=['VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','length','find','create','body','update','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','hasOwnProperty','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','ChatGroup,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','destroy','end','stack','name','map','ChatGroup','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','order','sort','where','filters','pick','filter','merge'];(function(_0x509a6a,_0x53e73d){var _0x2d989d=function(_0xccce0e){while(--_0xccce0e){_0x509a6a['push'](_0x509a6a['shift']());}};_0x2d989d(++_0x53e73d);}(_0x595e,0x91));var _0xe595=function(_0x6e7d56,_0x5d9b0a){_0x6e7d56=_0x6e7d56-0x0;var _0x249c38=_0x595e[_0x6e7d56];return _0x249c38;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe595('0x0'));var zipdir=require(_0xe595('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe595('0x2'));var BPromise=require(_0xe595('0x3'));var Mustache=require('mustache');var util=require(_0xe595('0x4'));var path=require(_0xe595('0x5'));var sox=require(_0xe595('0x6'));var csv=require(_0xe595('0x7'));var ejs=require(_0xe595('0x8'));var fs=require('fs');var fs_extra=require(_0xe595('0x9'));var _=require('lodash');var squel=require(_0xe595('0xa'));var crypto=require(_0xe595('0xb'));var jsforce=require(_0xe595('0xc'));var deskjs=require(_0xe595('0xd'));var toCsv=require(_0xe595('0x7'));var querystring=require(_0xe595('0xe'));var Papa=require(_0xe595('0xf'));var Redis=require(_0xe595('0x10'));var authService=require(_0xe595('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe595('0x12'));var logger=require(_0xe595('0x13'))(_0xe595('0x14'));var utils=require(_0xe595('0x15'));var config=require(_0xe595('0x16'));var licenseUtil=require(_0xe595('0x17'));var db=require(_0xe595('0x18'))['db'];config[_0xe595('0x19')]=_['defaults'](config[_0xe595('0x19')],{'host':_0xe595('0x1a'),'port':0x18eb});var socket=require(_0xe595('0x1b'))(new Redis(config[_0xe595('0x19')]));require(_0xe595('0x1c'))[_0xe595('0x1d')](socket);var jayson=require(_0xe595('0x1e'));var client=jayson[_0xe595('0x1f')][_0xe595('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x35f5cd,_0x54fde4,_0x240067,_0x36325e){return new BPromise(function(_0x21ce53,_0x5be777){var _0x17fc3d=_0x36325e||client;return _0x17fc3d[_0xe595('0x21')](_0x35f5cd,_0x240067)[_0xe595('0x22')](function(_0x3e2a00){logger['info']('ChatGroup,\x20%s,\x20%s',_0x54fde4,_0xe595('0x23'));logger[_0xe595('0x24')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x54fde4,_0xe595('0x23'),JSON[_0xe595('0x25')](_0x3e2a00));if(_0x3e2a00[_0xe595('0x26')]){if(_0x3e2a00[_0xe595('0x26')]['code']===0x1f4){logger['error'](_0xe595('0x27'),_0x54fde4,_0x3e2a00['error']['message']);return _0x5be777(_0x3e2a00[_0xe595('0x26')][_0xe595('0x28')]);}logger[_0xe595('0x26')](_0xe595('0x27'),_0x54fde4,_0x3e2a00[_0xe595('0x26')]['message']);return _0x21ce53(_0x3e2a00[_0xe595('0x26')][_0xe595('0x28')]);}else{logger[_0xe595('0x29')]('ChatGroup,\x20%s,\x20%s',_0x54fde4,_0xe595('0x23'));_0x21ce53(_0x3e2a00[_0xe595('0x2a')][_0xe595('0x28')]);}})[_0xe595('0x2b')](function(_0x2a1104){logger[_0xe595('0x26')](_0xe595('0x27'),_0x54fde4,_0x2a1104);_0x5be777(_0x2a1104);});});}function respondWithStatusCode(_0x367955,_0x366872){_0x366872=_0x366872||0xcc;return function(_0x24f363){if(_0x24f363){return _0x367955[_0xe595('0x2c')](_0x366872);}return _0x367955[_0xe595('0x2d')](_0x366872)['end']();};}function respondWithResult(_0x182d3f,_0x1fe754){_0x1fe754=_0x1fe754||0xc8;return function(_0x3ea336){if(_0x3ea336){return _0x182d3f[_0xe595('0x2d')](_0x1fe754)[_0xe595('0x2e')](_0x3ea336);}};}function respondWithFilteredResult(_0x31e0e6,_0x3cc3bb){return function(_0x52b710){if(_0x52b710){var _0x4fb6fc=_0x52b710['count'],_0xd12344=_0x3cc3bb[_0xe595('0x2f')],_0x897ede=_0x3cc3bb[_0xe595('0x2f')]+_0x3cc3bb[_0xe595('0x30')],_0x354065;if(_0x897ede>=_0x4fb6fc){_0x897ede=_0x4fb6fc;_0x354065=0xc8;}else{_0x354065=0xce;}_0x31e0e6[_0xe595('0x2d')](_0x354065);return _0x31e0e6['set'](_0xe595('0x31'),_0xd12344+'-'+_0x897ede+'/'+_0x4fb6fc)[_0xe595('0x2e')](_0x52b710);}return null;};}function patchUpdates(_0x386fe4){return function(_0x51da6e){try{jsonpatch[_0xe595('0x32')](_0x51da6e,_0x386fe4,!![]);}catch(_0x18e2b7){return BPromise[_0xe595('0x33')](_0x18e2b7);}return _0x51da6e[_0xe595('0x34')]();};}function saveUpdates(_0x2c732d,_0x3c2d0f){return function(_0x2a3115){if(_0x2a3115){return _0x2a3115['update'](_0x2c732d)[_0xe595('0x22')](function(_0xa0f88f){return _0xa0f88f;});}return null;};}function removeEntity(_0x3fe0b9,_0x5e5fb2){return function(_0x1f58c8){if(_0x1f58c8){return _0x1f58c8[_0xe595('0x35')]()['then'](function(){_0x3fe0b9[_0xe595('0x2d')](0xcc)[_0xe595('0x36')]();});}};}function handleEntityNotFound(_0x1df5ef,_0x267fea){return function(_0x23c960){if(!_0x23c960){_0x1df5ef[_0xe595('0x2c')](0x194);}return _0x23c960;};}function handleError(_0x361872,_0x452d93){_0x452d93=_0x452d93||0x1f4;return function(_0x56ec68){logger[_0xe595('0x26')](_0x56ec68[_0xe595('0x37')]);if(_0x56ec68['name']){delete _0x56ec68[_0xe595('0x38')];}_0x361872[_0xe595('0x2d')](_0x452d93)['send'](_0x56ec68);};}exports['index']=function(_0x20fd38,_0x31043a){var _0x50a662={},_0x5eb3f8={},_0x3618b0={'count':0x0,'rows':[]};var _0xbe26a1=_[_0xe595('0x39')](db[_0xe595('0x3a')][_0xe595('0x3b')],function(_0x26e0f6){return{'name':_0x26e0f6[_0xe595('0x3c')],'type':_0x26e0f6[_0xe595('0x3d')]['key']};});_0x5eb3f8[_0xe595('0x3e')]=_[_0xe595('0x39')](_0xbe26a1,_0xe595('0x38'));_0x5eb3f8[_0xe595('0x3f')]=_[_0xe595('0x40')](_0x20fd38[_0xe595('0x3f')]);_0x5eb3f8['filters']=_[_0xe595('0x41')](_0x5eb3f8[_0xe595('0x3e')],_0x5eb3f8[_0xe595('0x3f')]);_0x50a662[_0xe595('0x42')]=_[_0xe595('0x41')](_0x5eb3f8['model'],qs[_0xe595('0x43')](_0x20fd38[_0xe595('0x3f')][_0xe595('0x43')]));_0x50a662[_0xe595('0x42')]=_0x50a662[_0xe595('0x42')]['length']?_0x50a662[_0xe595('0x42')]:_0x5eb3f8[_0xe595('0x3e')];if(!_0x20fd38['query']['hasOwnProperty']('nolimit')){_0x50a662[_0xe595('0x30')]=qs[_0xe595('0x30')](_0x20fd38[_0xe595('0x3f')][_0xe595('0x30')]);_0x50a662[_0xe595('0x2f')]=qs[_0xe595('0x2f')](_0x20fd38[_0xe595('0x3f')][_0xe595('0x2f')]);}_0x50a662[_0xe595('0x44')]=qs[_0xe595('0x45')](_0x20fd38[_0xe595('0x3f')][_0xe595('0x45')]);_0x50a662[_0xe595('0x46')]=qs[_0xe595('0x47')](_[_0xe595('0x48')](_0x20fd38[_0xe595('0x3f')],_0x5eb3f8[_0xe595('0x47')]),_0xbe26a1);if(_0x20fd38[_0xe595('0x3f')][_0xe595('0x49')]){_0x50a662[_0xe595('0x46')]=_[_0xe595('0x4a')](_0x50a662[_0xe595('0x46')],{'$or':_['map'](_0xbe26a1,function(_0x21a5ad){if(_0x21a5ad['type']!==_0xe595('0x4b')){var _0x3a2b40={};_0x3a2b40[_0x21a5ad[_0xe595('0x38')]]={'$like':'%'+_0x20fd38[_0xe595('0x3f')][_0xe595('0x49')]+'%'};return _0x3a2b40;}})});}_0x50a662=_[_0xe595('0x4a')]({},_0x50a662,_0x20fd38[_0xe595('0x4c')]);var _0x4c6f3={'where':_0x50a662['where']};return db['ChatGroup'][_0xe595('0x4d')](_0x4c6f3)['then'](function(_0x4a4261){_0x3618b0[_0xe595('0x4d')]=_0x4a4261;if(_0x20fd38['query'][_0xe595('0x4e')]){_0x50a662[_0xe595('0x4f')]=[{'all':!![]}];}return db[_0xe595('0x3a')][_0xe595('0x50')](_0x50a662);})['then'](function(_0x347172){_0x3618b0[_0xe595('0x51')]=_0x347172;return _0x3618b0;})[_0xe595('0x22')](respondWithFilteredResult(_0x31043a,_0x50a662))[_0xe595('0x2b')](handleError(_0x31043a,null));};exports[_0xe595('0x52')]=function(_0x154232,_0x1d1254){var _0x3ba62e={'raw':!![],'where':{'id':_0x154232[_0xe595('0x53')]['id']}},_0x203ecc={};_0x203ecc[_0xe595('0x3e')]=_['keys'](db[_0xe595('0x3a')][_0xe595('0x3b')]);_0x203ecc[_0xe595('0x3f')]=_[_0xe595('0x40')](_0x154232['query']);_0x203ecc[_0xe595('0x47')]=_[_0xe595('0x41')](_0x203ecc[_0xe595('0x3e')],_0x203ecc[_0xe595('0x3f')]);_0x3ba62e['attributes']=_['intersection'](_0x203ecc[_0xe595('0x3e')],qs[_0xe595('0x43')](_0x154232[_0xe595('0x3f')]['fields']));_0x3ba62e[_0xe595('0x42')]=_0x3ba62e[_0xe595('0x42')][_0xe595('0x54')]?_0x3ba62e[_0xe595('0x42')]:_0x203ecc[_0xe595('0x3e')];if(_0x154232['query'][_0xe595('0x4e')]){_0x3ba62e[_0xe595('0x4f')]=[{'all':!![]}];}_0x3ba62e=_[_0xe595('0x4a')]({},_0x3ba62e,_0x154232['options']);return db[_0xe595('0x3a')][_0xe595('0x55')](_0x3ba62e)[_0xe595('0x22')](handleEntityNotFound(_0x1d1254,null))[_0xe595('0x22')](respondWithResult(_0x1d1254,null))[_0xe595('0x2b')](handleError(_0x1d1254,null));};exports[_0xe595('0x56')]=function(_0xd1e2c4,_0x28d3a9){return db['ChatGroup'][_0xe595('0x56')](_0xd1e2c4[_0xe595('0x57')],{})['then'](respondWithResult(_0x28d3a9,0xc9))['catch'](handleError(_0x28d3a9,null));};exports[_0xe595('0x58')]=function(_0x7ddcaa,_0x3e912b){if(_0x7ddcaa[_0xe595('0x57')]['id']){delete _0x7ddcaa[_0xe595('0x57')]['id'];}return db[_0xe595('0x3a')][_0xe595('0x55')]({'where':{'id':_0x7ddcaa[_0xe595('0x53')]['id']}})[_0xe595('0x22')](handleEntityNotFound(_0x3e912b,null))[_0xe595('0x22')](saveUpdates(_0x7ddcaa[_0xe595('0x57')],null))[_0xe595('0x22')](respondWithResult(_0x3e912b,null))[_0xe595('0x2b')](handleError(_0x3e912b,null));};exports[_0xe595('0x35')]=function(_0x10b9ff,_0x55e68b){return db['ChatGroup']['find']({'where':{'id':_0x10b9ff[_0xe595('0x53')]['id']}})['then'](handleEntityNotFound(_0x55e68b,null))['then'](removeEntity(_0x55e68b,null))[_0xe595('0x2b')](handleError(_0x55e68b,null));};exports[_0xe595('0x59')]=function(_0x50c673,_0x4a4ee){return db['ChatGroup'][_0xe595('0x59')]()[_0xe595('0x22')](respondWithResult(_0x4a4ee,null))[_0xe595('0x2b')](handleError(_0x4a4ee,null));};exports[_0xe595('0x5a')]=function(_0xa3e42a,_0xc07b26,_0x536472){return db[_0xe595('0x5b')][_0xe595('0x4d')]({'where':{'ChatGroupId':_0xa3e42a[_0xe595('0x53')]['id'],'ToId':_0xa3e42a[_0xe595('0x5c')]['id'],'read':![]}})['then'](function(_0x548800){return{'id':_[_0xe595('0x5d')](_0xa3e42a['params']['id']),'count':_0x548800};})['then'](respondWithResult(_0xc07b26,null))[_0xe595('0x2b')](handleError(_0xc07b26,null));};exports[_0xe595('0x5e')]=function(_0x14fc27,_0xb573cc,_0x13da89){return db['ChatGroup']['find']({'where':{'id':_0x14fc27[_0xe595('0x53')]['id']}})[_0xe595('0x22')](handleEntityNotFound(_0xb573cc,null))[_0xe595('0x22')](function(_0x3effbb){if(_0x3effbb){return _0x3effbb['addMembers'](_0x14fc27['body'][_0xe595('0x5f')],_[_0xe595('0x60')](_0x14fc27['body'],[_0xe595('0x5f'),'id'])||{});}})[_0xe595('0x22')](respondWithResult(_0xb573cc,null))[_0xe595('0x2b')](handleError(_0xb573cc,null));};exports[_0xe595('0x61')]=function(_0x1e6407,_0x18cb51,_0x138825){var _0x26bfce={};var _0x570ed8={};var _0x1741f3;var _0x50fdbb;return db['ChatGroup'][_0xe595('0x62')]({'where':{'id':_0x1e6407[_0xe595('0x53')]['id']}})[_0xe595('0x22')](handleEntityNotFound(_0x18cb51,null))[_0xe595('0x22')](function(_0x23f867){if(_0x23f867){_0x1741f3=_0x23f867;_0x570ed8[_0xe595('0x3e')]=_[_0xe595('0x40')](db[_0xe595('0x63')][_0xe595('0x3b')]);_0x570ed8[_0xe595('0x3f')]=_['keys'](_0x1e6407['query']);_0x570ed8[_0xe595('0x47')]=_['intersection'](_0x570ed8[_0xe595('0x3e')],_0x570ed8[_0xe595('0x3f')]);_0x26bfce['attributes']=_['intersection'](_0x570ed8[_0xe595('0x3e')],qs[_0xe595('0x43')](_0x1e6407[_0xe595('0x3f')][_0xe595('0x43')]));_0x26bfce[_0xe595('0x42')]=_0x26bfce['attributes'][_0xe595('0x54')]?_0x26bfce[_0xe595('0x42')]:_0x570ed8['model'];_0x26bfce['order']=qs[_0xe595('0x45')](_0x1e6407[_0xe595('0x3f')][_0xe595('0x45')]);_0x26bfce['where']=qs[_0xe595('0x47')](_['pick'](_0x1e6407[_0xe595('0x3f')],_0x570ed8[_0xe595('0x47')]));if(_0x1e6407[_0xe595('0x3f')]['filter']){_0x26bfce[_0xe595('0x46')]=_['merge'](_0x26bfce[_0xe595('0x46')],{'$or':_[_0xe595('0x39')](_0x26bfce['attributes'],function(_0xa76e61){var _0x5ae30f={};_0x5ae30f[_0xa76e61]={'$like':'%'+_0x1e6407[_0xe595('0x3f')][_0xe595('0x49')]+'%'};return _0x5ae30f;})});}_0x26bfce=_[_0xe595('0x4a')]({},_0x26bfce,_0x1e6407[_0xe595('0x4c')]);return _0x1741f3['getMembers'](_0x26bfce);}})[_0xe595('0x22')](function(_0x1f133c){if(_0x1f133c){_0x50fdbb=_0x1f133c[_0xe595('0x54')];if(!_0x1e6407[_0xe595('0x3f')][_0xe595('0x64')](_0xe595('0x65'))){_0x26bfce[_0xe595('0x30')]=qs[_0xe595('0x30')](_0x1e6407['query'][_0xe595('0x30')]);_0x26bfce[_0xe595('0x2f')]=qs[_0xe595('0x2f')](_0x1e6407['query'][_0xe595('0x2f')]);}return _0x1741f3[_0xe595('0x61')](_0x26bfce);}})[_0xe595('0x22')](function(_0x27521c){if(_0x27521c){return _0x27521c?{'count':_0x50fdbb,'rows':_0x27521c}:null;}})[_0xe595('0x22')](respondWithResult(_0x18cb51,null))[_0xe595('0x2b')](handleError(_0x18cb51,null));};exports['removeMembers']=function(_0x21ec00,_0x55a4a1,_0x4d81cc){return db[_0xe595('0x3a')][_0xe595('0x55')]({'where':{'id':_0x21ec00[_0xe595('0x53')]['id']}})[_0xe595('0x22')](handleEntityNotFound(_0x55a4a1,null))['then'](function(_0x5351dc){if(_0x5351dc){return _0x5351dc[_0xe595('0x66')](_0x21ec00[_0xe595('0x3f')][_0xe595('0x5f')]);}})[_0xe595('0x22')](respondWithStatusCode(_0x55a4a1,null))['catch'](handleError(_0x55a4a1,null));};exports[_0xe595('0x67')]=function(_0x16e5bf,_0x50c7f1,_0x70c006){if(_0x16e5bf['body']['id']){delete _0x16e5bf['body']['id'];}return db[_0xe595('0x3a')]['find']({'where':{'id':_0x16e5bf[_0xe595('0x53')]['id']}})[_0xe595('0x22')](handleEntityNotFound(_0x50c7f1,null))['then'](function(_0x160148){if(_0x160148){_0x16e5bf[_0xe595('0x57')][_0xe595('0x68')]=_0x160148['id'];return db[_0xe595('0x5b')]['create'](_0x16e5bf[_0xe595('0x57')]);}})[_0xe595('0x22')](respondWithResult(_0x50c7f1,null))[_0xe595('0x2b')](handleError(_0x50c7f1,null));};exports[_0xe595('0x69')]=function(_0x440d55,_0x59ffb5,_0x2a15eb){var _0x3177b7={};var _0x177b51={};var _0x27e2a2;var _0x11b81f;return db['ChatGroup'][_0xe595('0x62')]({'where':{'id':_0x440d55[_0xe595('0x53')]['id']}})['then'](handleEntityNotFound(_0x59ffb5,null))[_0xe595('0x22')](function(_0x3316c2){if(_0x3316c2){_0x27e2a2=_0x3316c2;_0x177b51[_0xe595('0x3e')]=_[_0xe595('0x40')](db[_0xe595('0x5b')][_0xe595('0x3b')]);_0x177b51[_0xe595('0x3f')]=_[_0xe595('0x40')](_0x440d55[_0xe595('0x3f')]);_0x177b51[_0xe595('0x47')]=_[_0xe595('0x41')](_0x177b51[_0xe595('0x3e')],_0x177b51['query']);_0x3177b7[_0xe595('0x42')]=_[_0xe595('0x41')](_0x177b51['model'],qs['fields'](_0x440d55[_0xe595('0x3f')][_0xe595('0x43')]));_0x3177b7['attributes']=_0x3177b7[_0xe595('0x42')][_0xe595('0x54')]?_0x3177b7[_0xe595('0x42')]:_0x177b51[_0xe595('0x3e')];_0x3177b7[_0xe595('0x44')]=qs[_0xe595('0x45')](_0x440d55[_0xe595('0x3f')][_0xe595('0x45')]);_0x3177b7[_0xe595('0x46')]=qs['filters'](_[_0xe595('0x48')](_0x440d55['query'],_0x177b51[_0xe595('0x47')]));if(_0x440d55[_0xe595('0x3f')][_0xe595('0x49')]){_0x3177b7[_0xe595('0x46')]=_[_0xe595('0x4a')](_0x3177b7['where'],{'$or':_[_0xe595('0x39')](_0x3177b7['attributes'],function(_0x45b5d8){var _0xcd33ea={};_0xcd33ea[_0x45b5d8]={'$like':'%'+_0x440d55[_0xe595('0x3f')][_0xe595('0x49')]+'%'};return _0xcd33ea;})});}if(_0x440d55[_0xe595('0x3f')]['$gte']){var _0x4da3bf=_0x440d55[_0xe595('0x3f')][_0xe595('0x6a')][_0xe595('0x6b')](',');var _0x5dcb20={};_0x5dcb20[_0x4da3bf[0x0]]={'$gte':moment(_0x4da3bf[0x1])[_0xe595('0x6c')](_0xe595('0x6d'))};_0x3177b7['where']=_[_0xe595('0x4a')](_0x3177b7[_0xe595('0x46')],_0x5dcb20);}_0x3177b7=_[_0xe595('0x4a')]({},_0x3177b7,_0x440d55['options']);return _0x27e2a2['getMessages'](_0x3177b7);}})['then'](function(_0x42ed3c){if(_0x42ed3c){_0x11b81f=_0x42ed3c[_0xe595('0x54')];if(!_0x440d55['query'][_0xe595('0x64')](_0xe595('0x65'))){_0x3177b7[_0xe595('0x30')]=qs[_0xe595('0x30')](_0x440d55[_0xe595('0x3f')][_0xe595('0x30')]);_0x3177b7[_0xe595('0x2f')]=qs[_0xe595('0x2f')](_0x440d55[_0xe595('0x3f')][_0xe595('0x2f')]);}return _0x27e2a2[_0xe595('0x69')](_0x3177b7);}})[_0xe595('0x22')](function(_0x463d11){if(_0x463d11){return _0x463d11?{'count':_0x11b81f,'rows':_0x463d11}:null;}})[_0xe595('0x22')](respondWithResult(_0x59ffb5,null))[_0xe595('0x2b')](handleError(_0x59ffb5,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index f0fdc8a..3d0fe24 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x413206,_0x541645){var _0x2675c4=function(_0x1cbe17){while(--_0x1cbe17){_0x413206['push'](_0x413206['shift']());}};_0x2675c4(++_0x541645);}(_0x5f2f,0x73));var _0xf5f2=function(_0x47decd,_0x57e643){_0x47decd=_0x47decd-0x0;var _0xdea891=_0x5f2f[_0x47decd];return _0xdea891;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatGroup=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatGroupEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatGroupEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatGroup[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatGroupEvents; \ No newline at end of file +var _0x2032=['exports','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0x2032,0xd9));var _0x2203=function(_0x47f601,_0x5ed63b){_0x47f601=_0x47f601-0x0;var _0x263aec=_0x2032[_0x47f601];return _0x263aec;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];ChatGroup[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index cd3fca9..e3f09fd 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 _0xd0bb=['ChatGroup','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define'];(function(_0x26183d,_0x247e2c){var _0x4dd8c8=function(_0xa36b5b){while(--_0xa36b5b){_0x26183d['push'](_0x26183d['shift']());}};_0x4dd8c8(++_0x247e2c);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x4c4fbe,_0x483482){_0x4c4fbe=_0x4c4fbe-0x0;var _0x39b3b9=_0xd0bb[_0x4c4fbe];return _0x39b3b9;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var logger=require(_0xbd0b('0x2'))('api');var moment=require(_0xbd0b('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd0b('0x4'));var fs=require('fs');var path=require(_0xbd0b('0x5'));var rimraf=require('rimraf');var config=require(_0xbd0b('0x6'));var attributes=require('./chatGroup.attributes');module[_0xbd0b('0x7')]=function(_0x1b2499,_0x158b5c){return _0x1b2499[_0xbd0b('0x8')](_0xbd0b('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe22=['../../config/environment','./chatGroup.attributes','exports','ChatGroup','chat_groups','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x36acb3,_0x204e94){var _0x13976c=function(_0x4371dd){while(--_0x4371dd){_0x36acb3['push'](_0x36acb3['shift']());}};_0x13976c(++_0x204e94);}(_0xbe22,0x1c1));var _0x2be2=function(_0x33fbc3,_0x3d7b54){_0x33fbc3=_0x33fbc3-0x0;var _0x170d16=_0xbe22[_0x33fbc3];return _0x170d16;};'use strict';var _=require(_0x2be2('0x0'));var util=require(_0x2be2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2be2('0x2'));var BPromise=require(_0x2be2('0x3'));var rp=require(_0x2be2('0x4'));var fs=require('fs');var path=require(_0x2be2('0x5'));var rimraf=require(_0x2be2('0x6'));var config=require(_0x2be2('0x7'));var attributes=require(_0x2be2('0x8'));module[_0x2be2('0x9')]=function(_0x1b3bde,_0x3a4d77){return _0x1b3bde['define'](_0x2be2('0xa'),attributes,{'tableName':_0x2be2('0xb'),'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 a18c5cb..992b2dc 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 _0x86e5=['moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatGroup.socket','register','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','util'];(function(_0x144d87,_0x5f119f){var _0x4c65a2=function(_0x47e97f){while(--_0x47e97f){_0x144d87['push'](_0x144d87['shift']());}};_0x4c65a2(++_0x5f119f);}(_0x86e5,0xe5));var _0x586e=function(_0x485e18,_0x8792ff){_0x485e18=_0x485e18-0x0;var _0x193f49=_0x86e5[_0x485e18];return _0x193f49;};'use strict';var _=require('lodash');var util=require(_0x586e('0x0'));var moment=require(_0x586e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x586e('0x2'));var db=require(_0x586e('0x3'))['db'];var utils=require(_0x586e('0x4'));var logger=require('../../config/logger')(_0x586e('0x5'));var config=require(_0x586e('0x6'));var jayson=require(_0x586e('0x7'));var client=jayson['client'][_0x586e('0x8')]({'port':0x232a});config[_0x586e('0x9')]=_[_0x586e('0xa')](config[_0x586e('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x586e('0xb'))(new Redis(config[_0x586e('0x9')]));require(_0x586e('0xc'))[_0x586e('0xd')](socket);function respondWithRpcPromise(_0x192736,_0x3bf7c2,_0x2296ae){return new BPromise(function(_0x261320,_0x5bc30b){return client['request'](_0x192736,_0x2296ae)['then'](function(_0x51ba91){logger[_0x586e('0xe')](_0x586e('0xf'),_0x3bf7c2,'request\x20sent');logger[_0x586e('0x10')](_0x586e('0x11'),_0x3bf7c2,_0x586e('0x12'),JSON['stringify'](_0x51ba91));if(_0x51ba91[_0x586e('0x13')]){if(_0x51ba91[_0x586e('0x13')][_0x586e('0x14')]===0x1f4){logger[_0x586e('0x13')](_0x586e('0xf'),_0x3bf7c2,_0x51ba91[_0x586e('0x13')][_0x586e('0x15')]);return _0x5bc30b(_0x51ba91['error'][_0x586e('0x15')]);}logger[_0x586e('0x13')](_0x586e('0xf'),_0x3bf7c2,_0x51ba91[_0x586e('0x13')][_0x586e('0x15')]);return _0x261320(_0x51ba91[_0x586e('0x13')]['message']);}else{logger['info'](_0x586e('0xf'),_0x3bf7c2,_0x586e('0x12'));_0x261320(_0x51ba91[_0x586e('0x16')]['message']);}})['catch'](function(_0x44eafe){logger[_0x586e('0x13')](_0x586e('0xf'),_0x3bf7c2,_0x44eafe);_0x5bc30b(_0x44eafe);});});} \ No newline at end of file +var _0xe9ed=['request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','info','ChatGroup,\x20%s,\x20%s'];(function(_0x2d608d,_0x5746dd){var _0x323097=function(_0x35eb8b){while(--_0x35eb8b){_0x2d608d['push'](_0x2d608d['shift']());}};_0x323097(++_0x5746dd);}(_0xe9ed,0x171));var _0xde9e=function(_0x17b253,_0x649956){_0x17b253=_0x17b253-0x0;var _0xe3fef0=_0xe9ed[_0x17b253];return _0xe3fef0;};'use strict';var _=require(_0xde9e('0x0'));var util=require('util');var moment=require(_0xde9e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde9e('0x2'));var db=require(_0xde9e('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xde9e('0x4'));var config=require(_0xde9e('0x5'));var jayson=require(_0xde9e('0x6'));var client=jayson[_0xde9e('0x7')]['http']({'port':0x232a});config[_0xde9e('0x8')]=_[_0xde9e('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xde9e('0xa'))(new Redis(config[_0xde9e('0x8')]));require('./chatGroup.socket')[_0xde9e('0xb')](socket);function respondWithRpcPromise(_0x1c9dd0,_0x4d7bf7,_0x5c4a59){return new BPromise(function(_0xfe0696,_0x1bb59c){return client[_0xde9e('0xc')](_0x1c9dd0,_0x5c4a59)['then'](function(_0x34db26){logger[_0xde9e('0xd')](_0xde9e('0xe'),_0x4d7bf7,_0xde9e('0xf'));logger[_0xde9e('0x10')](_0xde9e('0x11'),_0x4d7bf7,_0xde9e('0xf'),JSON[_0xde9e('0x12')](_0x34db26));if(_0x34db26[_0xde9e('0x13')]){if(_0x34db26[_0xde9e('0x13')][_0xde9e('0x14')]===0x1f4){logger[_0xde9e('0x13')]('ChatGroup,\x20%s,\x20%s',_0x4d7bf7,_0x34db26['error'][_0xde9e('0x15')]);return _0x1bb59c(_0x34db26[_0xde9e('0x13')][_0xde9e('0x15')]);}logger[_0xde9e('0x13')](_0xde9e('0xe'),_0x4d7bf7,_0x34db26['error'][_0xde9e('0x15')]);return _0xfe0696(_0x34db26[_0xde9e('0x13')][_0xde9e('0x15')]);}else{logger[_0xde9e('0xd')](_0xde9e('0xe'),_0x4d7bf7,_0xde9e('0xf'));_0xfe0696(_0x34db26[_0xde9e('0x16')][_0xde9e('0x15')]);}})[_0xde9e('0x17')](function(_0x2f06ce){logger[_0xde9e('0x13')](_0xde9e('0xe'),_0x4d7bf7,_0x2f06ce);_0x1bb59c(_0x2f06ce);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index cc63a0a..28c7711 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 _0x1e8c=['emit','removeListener','register','length','./chatGroup.events','remove','update'];(function(_0x4e12ee,_0x3675a8){var _0x54ab8f=function(_0x352cec){while(--_0x352cec){_0x4e12ee['push'](_0x4e12ee['shift']());}};_0x54ab8f(++_0x3675a8);}(_0x1e8c,0x1af));var _0xc1e8=function(_0x164ef5,_0xba6238){_0x164ef5=_0x164ef5-0x0;var _0x2d60c5=_0x1e8c[_0x164ef5];return _0x2d60c5;};'use strict';var ChatGroupEvents=require(_0xc1e8('0x0'));var events=['save',_0xc1e8('0x1'),_0xc1e8('0x2')];function createListener(_0x95e457,_0x4c22cc){return function(_0x5a69db){_0x4c22cc[_0xc1e8('0x3')](_0x95e457,_0x5a69db);};}function removeListener(_0x572118,_0x108c6e){return function(){ChatGroupEvents[_0xc1e8('0x4')](_0x572118,_0x108c6e);};}exports[_0xc1e8('0x5')]=function(_0x1d4f32){for(var _0x103880=0x0,_0x4004ae=events[_0xc1e8('0x6')];_0x103880<_0x4004ae;_0x103880++){var _0x21a4f5=events[_0x103880];var _0x1933e1=createListener('chatGroup:'+_0x21a4f5,_0x1d4f32);ChatGroupEvents['on'](_0x21a4f5,_0x1933e1);}}; \ No newline at end of file +var _0xfb72=['chatGroup:','./chatGroup.events','remove','update','emit','removeListener','register','length'];(function(_0x472fbc,_0x441a89){var _0x27a335=function(_0x675cd7){while(--_0x675cd7){_0x472fbc['push'](_0x472fbc['shift']());}};_0x27a335(++_0x441a89);}(_0xfb72,0xb1));var _0x2fb7=function(_0x4b8968,_0x5c9b44){_0x4b8968=_0x4b8968-0x0;var _0x3a0ab7=_0xfb72[_0x4b8968];return _0x3a0ab7;};'use strict';var ChatGroupEvents=require(_0x2fb7('0x0'));var events=['save',_0x2fb7('0x1'),_0x2fb7('0x2')];function createListener(_0xfaa86d,_0x31bbb8){return function(_0x3dd985){_0x31bbb8[_0x2fb7('0x3')](_0xfaa86d,_0x3dd985);};}function removeListener(_0x47bd0e,_0x66c98){return function(){ChatGroupEvents[_0x2fb7('0x4')](_0x47bd0e,_0x66c98);};}exports[_0x2fb7('0x5')]=function(_0x42d562){for(var _0x1e0e92=0x0,_0x47d6e8=events[_0x2fb7('0x6')];_0x1e0e92<_0x47d6e8;_0x1e0e92++){var _0x3efd5c=events[_0x1e0e92];var _0x5a6677=createListener(_0x2fb7('0x7')+_0x3efd5c,_0x42d562);ChatGroupEvents['on'](_0x3efd5c,_0x5a6677);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 86c10d9..0727ed1 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 _0x8e7a=['../../components/interaction/service','../../config/environment','./chatGroup.controller','get','/describe','/:id','isAuthenticated','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','create','addMembers','addMessage','put','update','delete','destroy','removeMembers','exports','util','path','express','Router'];(function(_0x4cec8d,_0x1dd165){var _0x5da9a7=function(_0x15c527){while(--_0x15c527){_0x4cec8d['push'](_0x4cec8d['shift']());}};_0x5da9a7(++_0x1dd165);}(_0x8e7a,0x1ac));var _0xa8e7=function(_0x519438,_0x24027d){_0x519438=_0x519438-0x0;var _0x324200=_0x8e7a[_0x519438];return _0x324200;};'use strict';var multer=require('multer');var util=require(_0xa8e7('0x0'));var path=require(_0xa8e7('0x1'));var timeout=require('connect-timeout');var express=require(_0xa8e7('0x2'));var router=express[_0xa8e7('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa8e7('0x4'));var config=require(_0xa8e7('0x5'));var controller=require(_0xa8e7('0x6'));router[_0xa8e7('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa8e7('0x7')](_0xa8e7('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0xa8e7('0x7')](_0xa8e7('0x9'),auth[_0xa8e7('0xa')](),controller[_0xa8e7('0xb')]);router['get'](_0xa8e7('0xc'),auth[_0xa8e7('0xa')](),controller[_0xa8e7('0xd')]);router[_0xa8e7('0x7')](_0xa8e7('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0xa8e7('0x7')](_0xa8e7('0xf'),auth[_0xa8e7('0xa')](),controller[_0xa8e7('0x10')]);router[_0xa8e7('0x11')]('/',auth['isAuthenticated'](),controller[_0xa8e7('0x12')]);router['post']('/:id/members',auth['isAuthenticated'](),controller[_0xa8e7('0x13')]);router[_0xa8e7('0x11')](_0xa8e7('0xf'),auth[_0xa8e7('0xa')](),controller[_0xa8e7('0x14')]);router[_0xa8e7('0x15')](_0xa8e7('0x9'),auth[_0xa8e7('0xa')](),controller[_0xa8e7('0x16')]);router[_0xa8e7('0x17')](_0xa8e7('0x9'),auth[_0xa8e7('0xa')](),controller[_0xa8e7('0x18')]);router[_0xa8e7('0x17')](_0xa8e7('0xe'),auth[_0xa8e7('0xa')](),controller[_0xa8e7('0x19')]);module[_0xa8e7('0x1a')]=router; \ No newline at end of file +var _0x1642=['getMembers','/:id/messages','getMessages','post','/:id/members','addMembers','addMessage','put','update','delete','destroy','removeMembers','exports','path','connect-timeout','../../components/auth/service','../../config/environment','./chatGroup.controller','/describe','isAuthenticated','describe','get','/:id','/:id/unread','getUnread'];(function(_0x1b65fa,_0x525365){var _0x2e3e6b=function(_0x2affef){while(--_0x2affef){_0x1b65fa['push'](_0x1b65fa['shift']());}};_0x2e3e6b(++_0x525365);}(_0x1642,0x1e8));var _0x2164=function(_0x123700,_0x3760c1){_0x123700=_0x123700-0x0;var _0x2d6bcf=_0x1642[_0x123700];return _0x2d6bcf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2164('0x0'));var timeout=require(_0x2164('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2164('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x2164('0x3'));var controller=require(_0x2164('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2164('0x5'),auth[_0x2164('0x6')](),controller[_0x2164('0x7')]);router[_0x2164('0x8')](_0x2164('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x2164('0x8')](_0x2164('0xa'),auth[_0x2164('0x6')](),controller[_0x2164('0xb')]);router[_0x2164('0x8')]('/:id/members',auth[_0x2164('0x6')](),controller[_0x2164('0xc')]);router[_0x2164('0x8')](_0x2164('0xd'),auth[_0x2164('0x6')](),controller[_0x2164('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2164('0xf')](_0x2164('0x10'),auth['isAuthenticated'](),controller[_0x2164('0x11')]);router[_0x2164('0xf')]('/:id/messages',auth['isAuthenticated'](),controller[_0x2164('0x12')]);router[_0x2164('0x13')]('/:id',auth[_0x2164('0x6')](),controller[_0x2164('0x14')]);router[_0x2164('0x15')](_0x2164('0x9'),auth[_0x2164('0x6')](),controller[_0x2164('0x16')]);router[_0x2164('0x15')](_0x2164('0x10'),auth[_0x2164('0x6')](),controller[_0x2164('0x17')]);module[_0x2164('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index a5f1ef1..7f1598f 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 _0x51a2=['out','exports','BOOLEAN','ENUM','star','TEXT','STRING','DATE','long'];(function(_0x507527,_0x3d1f6e){var _0x2dec80=function(_0x5c1e5f){while(--_0x5c1e5f){_0x507527['push'](_0x507527['shift']());}};_0x2dec80(++_0x3d1f6e);}(_0x51a2,0x76));var _0x251a=function(_0x299995,_0x54a9c4){_0x299995=_0x299995-0x0;var _0x2cc68b=_0x51a2[_0x299995];return _0x2cc68b;};'use strict';var Sequelize=require('sequelize');module[_0x251a('0x0')]={'closed':{'type':Sequelize[_0x251a('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x251a('0x2')](_0x251a('0x3'),'thumb'),'defaultValue':_0x251a('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x251a('0x4')]},'mailTranscript':{'type':Sequelize[_0x251a('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x251a('0x6')]},'disposition':{'type':Sequelize[_0x251a('0x5')]},'secondDisposition':{'type':Sequelize[_0x251a('0x5')]},'thirdDisposition':{'type':Sequelize[_0x251a('0x5')]},'note':{'type':Sequelize[_0x251a('0x5')]},'browserName':{'type':Sequelize[_0x251a('0x5')]},'browserVersion':{'type':Sequelize[_0x251a('0x5')]},'osName':{'type':Sequelize[_0x251a('0x5')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x251a('0x5')]},'deviceType':{'type':Sequelize[_0x251a('0x5')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x251a('0x5')]},'formData':{'type':Sequelize[_0x251a('0x4')](_0x251a('0x7'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x251a('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x251a('0x2')]('in',_0x251a('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x251a('0x5')]},'customerPort':{'type':Sequelize[_0x251a('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x251a('0x4')]}}; \ No newline at end of file +var _0x3b93=['DATE','long','out','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING'];(function(_0x5fb102,_0x50bc80){var _0x485417=function(_0x3064f7){while(--_0x3064f7){_0x5fb102['push'](_0x5fb102['shift']());}};_0x485417(++_0x50bc80);}(_0x3b93,0x92));var _0x33b9=function(_0x501f04,_0x2d4092){_0x501f04=_0x501f04-0x0;var _0x3d0924=_0x3b93[_0x501f04];return _0x3d0924;};'use strict';var Sequelize=require('sequelize');module[_0x33b9('0x0')]={'closed':{'type':Sequelize[_0x33b9('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x33b9('0x2')]},'ratingType':{'type':Sequelize[_0x33b9('0x3')](_0x33b9('0x4'),_0x33b9('0x5')),'defaultValue':_0x33b9('0x4')},'ratingMessage':{'type':Sequelize[_0x33b9('0x6')]},'pathTranscript':{'type':Sequelize[_0x33b9('0x6')]},'mailTranscript':{'type':Sequelize[_0x33b9('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x33b9('0x8')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x33b9('0x7')]},'thirdDisposition':{'type':Sequelize[_0x33b9('0x7')]},'note':{'type':Sequelize[_0x33b9('0x7')]},'browserName':{'type':Sequelize[_0x33b9('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x33b9('0x7')]},'osVersion':{'type':Sequelize[_0x33b9('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x33b9('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x33b9('0x6')]},'customerIp':{'type':Sequelize[_0x33b9('0x7')]},'formData':{'type':Sequelize[_0x33b9('0x6')](_0x33b9('0x9'))},'read1stAt':{'type':Sequelize[_0x33b9('0x8')]},'lastMsgAt':{'type':Sequelize[_0x33b9('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x33b9('0x3')]('in',_0x33b9('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x33b9('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x33b9('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 9ab7026..b737bf5 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 _0x1d24=['options','create','destroy','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','download','close','mailTranscript','root','format','now','pathTranscript','Messages','agentAlias','System','%s%d','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','appendFileSync','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','getMessages','merge','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','secret','includeAgent','setTags','spread','chatInteractionTags:save','removeTags','unix','files','tmp','server','attachments','CmContact','firstName','lastName','direction','Account','get','mkdirSync','Chat','Owner','N.A.','closedAt','disposition','browserName','osName','customerIp','customerPort','existsSync','createReadStream','pipe','createWriteStream','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','http','client','request','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','sendStatus','stack','name','Users','map','fullname','Tags','split','forEach','index','ChatInteraction','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_messages','me.ChatInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','Tag','union','User','operator','UserId','buildExpression','text','start','body','keys','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','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','contactName','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ChatInteractionId','push','all','show','params','includeAll','include'];(function(_0x417a22,_0x588555){var _0x569b43=function(_0x23c332){while(--_0x23c332){_0x417a22['push'](_0x417a22['shift']());}};_0x569b43(++_0x588555);}(_0x1d24,0x75));var _0x41d2=function(_0x3c77f9,_0x2abb07){_0x3c77f9=_0x3c77f9-0x0;var _0x41790a=_0x1d24[_0x3c77f9];return _0x41790a;};'use strict';var emlformat=require(_0x41d2('0x0'));var rimraf=require(_0x41d2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x41d2('0x2'));var rp=require(_0x41d2('0x3'));var moment=require(_0x41d2('0x4'));var BPromise=require(_0x41d2('0x5'));var Mustache=require(_0x41d2('0x6'));var util=require(_0x41d2('0x7'));var path=require(_0x41d2('0x8'));var sox=require(_0x41d2('0x9'));var csv=require(_0x41d2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x41d2('0xb'));var squel=require(_0x41d2('0xc'));var crypto=require('crypto');var jsforce=require(_0x41d2('0xd'));var deskjs=require(_0x41d2('0xe'));var toCsv=require(_0x41d2('0xa'));var querystring=require(_0x41d2('0xf'));var Papa=require(_0x41d2('0x10'));var Redis=require(_0x41d2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x41d2('0x12'));var as=require(_0x41d2('0x13'));var pdf=require(_0x41d2('0x14'));var hardwareService=require(_0x41d2('0x15'));var logger=require(_0x41d2('0x16'))(_0x41d2('0x17'));var utils=require(_0x41d2('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x41d2('0x19'))['db'];config['redis']=_[_0x41d2('0x1a')](config[_0x41d2('0x1b')],{'host':_0x41d2('0x1c'),'port':0x18eb});var socket=require(_0x41d2('0x1d'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0x41d2('0x1e')](socket);var jayson=require(_0x41d2('0x1f'));var client=jayson['client'][_0x41d2('0x20')]({'port':0x232b});var client9004=jayson[_0x41d2('0x21')][_0x41d2('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x59eee3,_0x46d471,_0x31521b,_0x5aece9){return new BPromise(function(_0x54ac4e,_0x4643aa){var _0x325c1b=_0x5aece9||client;return _0x325c1b[_0x41d2('0x22')](_0x59eee3,_0x31521b)['then'](function(_0x561071){logger['info'](_0x41d2('0x23'),_0x46d471,'request\x20sent');logger[_0x41d2('0x24')](_0x41d2('0x25'),_0x46d471,'request\x20sent',JSON[_0x41d2('0x26')](_0x561071));if(_0x561071[_0x41d2('0x27')]){if(_0x561071[_0x41d2('0x27')]['code']===0x1f4){logger[_0x41d2('0x27')](_0x41d2('0x23'),_0x46d471,_0x561071[_0x41d2('0x27')][_0x41d2('0x28')]);return _0x4643aa(_0x561071[_0x41d2('0x27')][_0x41d2('0x28')]);}logger['error'](_0x41d2('0x23'),_0x46d471,_0x561071['error']['message']);return _0x54ac4e(_0x561071[_0x41d2('0x27')][_0x41d2('0x28')]);}else{logger[_0x41d2('0x29')](_0x41d2('0x23'),_0x46d471,_0x41d2('0x2a'));_0x54ac4e(_0x561071[_0x41d2('0x2b')]['message']);}})[_0x41d2('0x2c')](function(_0x38d9be){logger['error'](_0x41d2('0x23'),_0x46d471,_0x38d9be);_0x4643aa(_0x38d9be);});});}function respondWithStatusCode(_0x4bf3f2,_0x4a952d){_0x4a952d=_0x4a952d||0xcc;return function(_0x2cec87){if(_0x2cec87){return _0x4bf3f2['sendStatus'](_0x4a952d);}return _0x4bf3f2[_0x41d2('0x2d')](_0x4a952d)[_0x41d2('0x2e')]();};}function respondWithResult(_0x545fa6,_0x9c7498){_0x9c7498=_0x9c7498||0xc8;return function(_0x121b56){if(_0x121b56){return _0x545fa6[_0x41d2('0x2d')](_0x9c7498)[_0x41d2('0x2f')](_0x121b56);}};}function respondWithFilteredResult(_0x38102e,_0x5bf5a3){return function(_0xa7f22a){if(_0xa7f22a){var _0x427835=_0xa7f22a[_0x41d2('0x30')],_0x272b38=_0x5bf5a3[_0x41d2('0x31')],_0x4122e5=_0x5bf5a3[_0x41d2('0x31')]+_0x5bf5a3[_0x41d2('0x32')],_0x2cc99c;if(_0x4122e5>=_0x427835){_0x4122e5=_0x427835;_0x2cc99c=0xc8;}else{_0x2cc99c=0xce;}_0x38102e[_0x41d2('0x2d')](_0x2cc99c);return _0x38102e[_0x41d2('0x33')](_0x41d2('0x34'),_0x272b38+'-'+_0x4122e5+'/'+_0x427835)[_0x41d2('0x2f')](_0xa7f22a);}return null;};}function patchUpdates(_0x4258fe){return function(_0x4b5753){try{jsonpatch['apply'](_0x4b5753,_0x4258fe,!![]);}catch(_0x2e51f0){return BPromise[_0x41d2('0x35')](_0x2e51f0);}return _0x4b5753[_0x41d2('0x36')]();};}function saveUpdates(_0x10762b,_0x3e6fb5){return function(_0x77940b){if(_0x77940b){return _0x77940b[_0x41d2('0x37')](_0x10762b)[_0x41d2('0x38')](function(_0x3e82db){return _0x3e82db;});}return null;};}function removeEntity(_0x3b4edc,_0xd15f11){return function(_0x5f1838){if(_0x5f1838){return _0x5f1838['destroy']()['then'](function(){_0x3b4edc[_0x41d2('0x2d')](0xcc)[_0x41d2('0x2e')]();});}};}function handleEntityNotFound(_0x53fa5f,_0x520261){return function(_0x38293c){if(!_0x38293c){_0x53fa5f[_0x41d2('0x39')](0x194);}return _0x38293c;};}function handleError(_0x277cc8,_0xe504dc){_0xe504dc=_0xe504dc||0x1f4;return function(_0x20773d){logger[_0x41d2('0x27')](_0x20773d[_0x41d2('0x3a')]);if(_0x20773d[_0x41d2('0x3b')]){delete _0x20773d[_0x41d2('0x3b')];}_0x277cc8['status'](_0xe504dc)['send'](_0x20773d);};}function getInteractionUsers(_0x1b66b,_0x2315b1){return new BPromise(function(_0x1c41c4,_0x312424){try{if(_0x2315b1[_0x1b66b['id']]){_0x1b66b[_0x41d2('0x3c')]=_[_0x41d2('0x3d')](_0x2315b1[_0x1b66b['id']],function(_0x45891d){return{'id':_0x45891d['id'],'fullname':_0x45891d[_0x41d2('0x3e')]};});}}catch(_0x45042e){_0x312424(_0x45042e);}_0x1c41c4(_0x1b66b);});}function getInteractionTags(_0x16f70c,_0xa4ef53){return new BPromise(function(_0x3cd719,_0x165613){try{if(_0x16f70c['TagIds']){_0x16f70c[_0x41d2('0x3f')]=[];_0x16f70c['TagIds'][_0x41d2('0x40')](',')[_0x41d2('0x41')](function(_0x3879a7){_0x16f70c['Tags']['push'](_0xa4ef53[_0x3879a7]);});}delete _0x16f70c['TagIds'];}catch(_0x10049d){_0x165613(_0x10049d);}_0x3cd719(_0x16f70c);});}function updateChatInteraction(_0x54d72f,_0x2af5df,_0x86f802){return new BPromise(function(_0x18d157,_0x2ac394){return getInteractionUsers(_0x54d72f,_0x86f802)[_0x41d2('0x38')](function(_0x660c9f){return getInteractionTags(_0x660c9f,_0x2af5df);})[_0x41d2('0x38')](function(_0xdd270d){_0x18d157(_0xdd270d);})['catch'](function(_0x546754){_0x2ac394(_0x546754);});});}exports[_0x41d2('0x42')]=function(_0x5c1dbe,_0x4a9157){var _0x39a885={},_0x3da08c={},_0x498308={'count':0x0,'rows':[]};var _0x2e43d3=_[_0x41d2('0x3d')](db[_0x41d2('0x43')][_0x41d2('0x44')],function(_0x4b5ef5){return{'name':_0x4b5ef5[_0x41d2('0x45')],'type':_0x4b5ef5['type']['key']};});_0x3da08c[_0x41d2('0x46')]=_[_0x41d2('0x3d')](_0x2e43d3,_0x41d2('0x3b'));_0x3da08c[_0x41d2('0x47')]=_['keys'](_0x5c1dbe[_0x41d2('0x47')]);_0x3da08c['filters']=_[_0x41d2('0x48')](_0x3da08c[_0x41d2('0x46')],_0x3da08c['query']);_0x39a885[_0x41d2('0x49')]=_[_0x41d2('0x48')](_0x3da08c['model'],qs[_0x41d2('0x4a')](_0x5c1dbe[_0x41d2('0x47')]['fields']));_0x39a885[_0x41d2('0x49')]=_0x39a885[_0x41d2('0x49')][_0x41d2('0x4b')]?_0x39a885[_0x41d2('0x49')]:_0x3da08c[_0x41d2('0x46')];if(!_0x5c1dbe[_0x41d2('0x47')][_0x41d2('0x4c')](_0x41d2('0x4d'))){_0x39a885[_0x41d2('0x32')]=qs[_0x41d2('0x32')](_0x5c1dbe['query'][_0x41d2('0x32')]);_0x39a885[_0x41d2('0x31')]=qs[_0x41d2('0x31')](_0x5c1dbe[_0x41d2('0x47')][_0x41d2('0x31')]);}_0x39a885['order']=qs['sort'](_0x5c1dbe[_0x41d2('0x47')][_0x41d2('0x4e')]);_0x39a885[_0x41d2('0x4f')]=qs['filters'](_[_0x41d2('0x50')](_0x5c1dbe[_0x41d2('0x47')],_0x3da08c[_0x41d2('0x51')]),_0x2e43d3);var _0x1b65a0=[];var _0x209701=squel[_0x41d2('0x52')]()[_0x41d2('0x53')]('id')[_0x41d2('0x53')]('name')[_0x41d2('0x53')](_0x41d2('0x54'))[_0x41d2('0x55')](_0x41d2('0x56'));var _0x4be4ef=squel[_0x41d2('0x52')]()[_0x41d2('0x53')](_0x41d2('0x57'))[_0x41d2('0x53')](_0x41d2('0x58'))['field'](_0x41d2('0x59'))[_0x41d2('0x55')]('user_has_chat_interactions','ui')[_0x41d2('0x5a')](_0x41d2('0x5b'),'u',_0x41d2('0x5c'));var _0x358027=squel[_0x41d2('0x52')]()[_0x41d2('0x55')](_0x41d2('0x5d'),'i')[_0x41d2('0x5a')](_0x41d2('0x5e'),'c',_0x41d2('0x5f'))[_0x41d2('0x5a')](_0x41d2('0x5b'),'o',_0x41d2('0x60'))[_0x41d2('0x5a')]('chat_websites','a','a.id\x20=\x20i.ChatWebsiteId')['left_join'](_0x41d2('0x61'),'me',_0x41d2('0x62'))['left_join']('chat_interaction_has_tags','it','it.ChatInteractionId\x20=\x20i.id')['left_join'](_0x41d2('0x56'),'t','t.id\x20=\x20it.TagId');var _0x3291fd=squel[_0x41d2('0x63')]();var _0x5868e0=[];var _0x30ac5d=squel[_0x41d2('0x63')]();var _0x1f191c;if(_0x5c1dbe[_0x41d2('0x47')][_0x41d2('0x64')]){_0x1f191c=as[_0x41d2('0x65')](_0x5c1dbe[_0x41d2('0x47')][_0x41d2('0x64')]);var _0x2ccf68=_0x1f191c[_0x41d2('0x66')];for(var _0x2cddbb=0x0;_0x2cddbb<_0x1f191c[_0x41d2('0x67')][_0x41d2('0x4b')];_0x2cddbb++){var _0x43cad4=_0x1f191c[_0x41d2('0x67')][_0x2cddbb];var _0x59da53='i';var _0x546915=_[_0x41d2('0x68')](_0x2e43d3,[_0x41d2('0x3b'),_0x43cad4[_0x41d2('0x53')]]);if(!_0x546915){switch(_0x43cad4['field']){case _0x41d2('0x69'):if(_0x43cad4[_0x41d2('0x6a')]==0x1){_0x358027[_0x41d2('0x6b')]('`'+_0x43cad4[_0x41d2('0x53')]+_0x41d2('0x6c'));}else{_0x358027[_0x41d2('0x6b')]('`'+_0x43cad4[_0x41d2('0x53')]+_0x41d2('0x6d'));}break;case _0x41d2('0x6e'):if(_0x43cad4['operator']===_0x41d2('0x6f')){if(_0x43cad4[_0x41d2('0x6a')][_0x41d2('0x40')]('\x20')[_0x41d2('0x4b')]>0x1){_0x3291fd[_0x2ccf68](_0x41d2('0x70'),qs[_0x41d2('0x71')](_0x43cad4['value']),null);}else{var _0x3526a3='%'+_0x43cad4[_0x41d2('0x6a')]+'%';_0x3291fd[_0x2ccf68](_0x41d2('0x72'),_0x3526a3,_0x3526a3,_0x3526a3);}}else{_0x546915=_['find'](_0x2e43d3,['name',_0x41d2('0x73')]);_0x43cad4['field']=_0x41d2('0x73');_0x5e2358=as['buildExpression'](_0x59da53,_0x546915[_0x41d2('0x74')],_0x43cad4);_0x3291fd[_0x2ccf68](_0x5e2358['text'],_0x5e2358[_0x41d2('0x6a')]['start'],_0x5e2358[_0x41d2('0x6a')][_0x41d2('0x2e')]);}break;case _0x41d2('0x75'):var _0x10e967=_0x43cad4[_0x41d2('0x6a')][_0x41d2('0x40')](',')[_0x41d2('0x3d')](function(_0x248f71){return Number(_0x248f71);});_0x10e967[_0x41d2('0x41')](function(_0x1bb8fd){_0x30ac5d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1bb8fd+',%');});_0x5868e0=_[_0x41d2('0x76')](_0x5868e0,_0x10e967);break;case _0x41d2('0x77'):if(_0x43cad4[_0x41d2('0x78')]===_0x41d2('0x6f')){_0x3291fd[_0x2ccf68]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x43cad4[_0x41d2('0x6a')]+'%',null);}else{_0x546915=_[_0x41d2('0x68')](_0x2e43d3,[_0x41d2('0x3b'),_0x41d2('0x79')]);_0x43cad4['field']='UserId';_0x5e2358=as[_0x41d2('0x7a')](_0x59da53,_0x546915[_0x41d2('0x74')],_0x43cad4);_0x3291fd[_0x2ccf68](_0x5e2358[_0x41d2('0x7b')],_0x5e2358[_0x41d2('0x6a')][_0x41d2('0x7c')],_0x5e2358[_0x41d2('0x6a')][_0x41d2('0x2e')]);}break;case _0x41d2('0x7d'):_0x5e2358=as[_0x41d2('0x7a')]('me',null,_0x43cad4);_0x3291fd[_0x2ccf68](_0x5e2358[_0x41d2('0x7b')],_0x5e2358[_0x41d2('0x6a')][_0x41d2('0x7c')],_0x5e2358['value']['end']);break;}}else{var _0x5e2358=as[_0x41d2('0x7a')](_0x59da53,_0x546915[_0x41d2('0x74')],_0x43cad4);_0x3291fd[_0x2ccf68](_0x5e2358[_0x41d2('0x7b')],_0x5e2358['value'][_0x41d2('0x7c')],_0x5e2358['value'][_0x41d2('0x2e')]);}}}else{var _0x2d7702=_(_0x5c1dbe[_0x41d2('0x47')])[_0x41d2('0x7e')]()[_0x41d2('0x3d')](function(_0x15c65c){return _[_0x41d2('0x7f')](_0x2e43d3,[_0x41d2('0x3b'),_0x15c65c])?_0x15c65c:undefined;})[_0x41d2('0x80')]()['value']();if(!_[_0x41d2('0x81')](_0x2d7702)){_0x2d7702[_0x41d2('0x41')](function(_0x2a45c5){if(_0x2a45c5===_0x41d2('0x82')){_0x358027[_0x41d2('0x4f')](_0x41d2('0x83'),[][_0x41d2('0x84')](_0x5c1dbe[_0x41d2('0x47')][_0x2a45c5]));}else if(_0x2a45c5==='createdAt'){var _0x579ca3=JSON[_0x41d2('0x85')](_0x5c1dbe[_0x41d2('0x47')][_0x2a45c5])[_0x41d2('0x86')];var _0x3a54aa=JSON[_0x41d2('0x85')](_0x5c1dbe[_0x41d2('0x47')][_0x2a45c5])[_0x41d2('0x87')];_0x358027[_0x41d2('0x4f')](_0x41d2('0x88'),_0x579ca3,_0x3a54aa);}else{if(_0x5c1dbe[_0x41d2('0x47')][_0x2a45c5]===_0x41d2('0x89')){_0x358027[_0x41d2('0x4f')]('i.'+_0x2a45c5+_0x41d2('0x8a'));}else{_0x358027[_0x41d2('0x4f')]('i.'+_0x2a45c5+_0x41d2('0x8b'),_0x5c1dbe[_0x41d2('0x47')][_0x2a45c5]);}}});}if(_0x5c1dbe['query'][_0x41d2('0x8c')]){if(_0x5c1dbe[_0x41d2('0x47')]['read']==0x1){_0x358027[_0x41d2('0x6b')](_0x41d2('0x8d'));}else{_0x358027['having'](_0x41d2('0x8e'));}}if(_0x5c1dbe[_0x41d2('0x47')][_0x41d2('0x8f')]){_0x5868e0=_['isArray'](_0x5c1dbe[_0x41d2('0x47')][_0x41d2('0x8f')])?_0x5c1dbe[_0x41d2('0x47')][_0x41d2('0x8f')]:new Array(_0x5c1dbe[_0x41d2('0x47')][_0x41d2('0x8f')]);_0x5868e0[_0x41d2('0x41')](function(_0xee2f31){_0x30ac5d['or'](_0x41d2('0x90'),'%,'+_0xee2f31+',%');});}if(_0x5c1dbe[_0x41d2('0x47')][_0x41d2('0x91')]){var _0x1a0ffd=_0x5c1dbe['query'][_0x41d2('0x91')]['replace']('\x5c','\x5c\x5c')[_0x41d2('0x92')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1a0ffd)){_0x3291fd['or'](_0x41d2('0x93'),_0x1a0ffd+'%');}else{_0x3291fd['or'](_0x41d2('0x94'),qs[_0x41d2('0x71')](_0x1a0ffd))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1a0ffd+'%');}}}_0x358027[_0x41d2('0x4f')](_0x3291fd);_0x358027[_0x41d2('0x95')](_0x41d2('0x96'));var _0x5de4a9={'type':db[_0x41d2('0x97')][_0x41d2('0x98')][_0x41d2('0x99')],'raw':!![]};var _0x16a58a=_0x358027[_0x41d2('0x9a')]();_0x16a58a['field'](_0x41d2('0x96'));_0x16a58a['field'](_0x41d2('0x9b'),'unreadMessages');if(_0x39a885[_0x41d2('0x9c')]){_0x39a885[_0x41d2('0x9c')][_0x41d2('0x41')](function(_0x5d9b7e){var _0x1acf59=_0x5d9b7e[0x0]==='contactName'?_0x5d9b7e[0x0]:'i.'+_0x5d9b7e[0x0];_0x358027[_0x41d2('0x9c')](_0x1acf59,_0x5d9b7e[0x1]==='DESC'?![]:!![]);});}if(!_[_0x41d2('0x81')](_0x5868e0)){_0x358027[_0x41d2('0x6b')](_0x30ac5d);_0x16a58a[_0x41d2('0x4f')]('t.id\x20IN\x20?',_0x5868e0);}BPromise[_0x41d2('0x9d')]()['then'](function(){if(!_0x1f191c){if(_0x5c1dbe[_0x41d2('0x47')][_0x41d2('0x82')])return;_0x16a58a['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x358027[_0x41d2('0x4f')](_0x41d2('0x9e'));return;}if(_0x5c1dbe[_0x41d2('0x9f')][_0x41d2('0xa0')]!==_0x41d2('0xa1'))return;return _0x5c1dbe[_0x41d2('0x9f')][_0x41d2('0xa2')]({'attributes':['id'],'raw':!![]})[_0x41d2('0x38')](function(_0x601d72){if(_[_0x41d2('0x81')](_0x601d72)){_0x16a58a[_0x41d2('0x4f')]('i.ChatWebsiteId\x20IS\x20NULL');_0x358027[_0x41d2('0x4f')](_0x41d2('0xa3'));}else{_0x16a58a[_0x41d2('0x4f')](_0x41d2('0x83'),_[_0x41d2('0x3d')](_0x601d72,'id'));_0x358027['where'](_0x41d2('0x83'),_[_0x41d2('0x3d')](_0x601d72,'id'));}});})['then'](function(){if(_0x5c1dbe[_0x41d2('0x9f')][_0x41d2('0xa0')]==='agent'&&!_0x1f191c&&!_0x5c1dbe[_0x41d2('0x47')]['ChatWebsiteId'])return[];return db[_0x41d2('0xa4')][_0x41d2('0x47')](_0x16a58a['toString'](),_0x5de4a9);})[_0x41d2('0x38')](function(_0x2a2a47){_0x498308[_0x41d2('0x30')]=_0x2a2a47[_0x41d2('0x4b')];if(_0x498308[_0x41d2('0x30')]===0x0)return[];return db[_0x41d2('0xa4')][_0x41d2('0x47')](_0x209701[_0x41d2('0xa5')](),_0x5de4a9)[_0x41d2('0x38')](function(_0x59c814){_0x1b65a0=_[_0x41d2('0xa6')](_0x59c814,'id');_0x5de4a9=_['merge'](_0x5de4a9,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5c1dbe[_0x41d2('0x47')][_0x41d2('0x4a')]){_0x39a885['attributes'][_0x41d2('0x41')](function(_0x263157){_0x358027[_0x41d2('0x53')]('i.'+_0x263157);});}else{_0x358027[_0x41d2('0x53')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x41d2('0x69'));_0x358027[_0x41d2('0x53')]('a.key',_0x41d2('0xa7'));_0x358027[_0x41d2('0x53')](_0x41d2('0xa8'),_0x41d2('0xa9'));_0x358027[_0x41d2('0x53')](_0x41d2('0xaa'),_0x41d2('0xab'));_0x358027['field'](_0x41d2('0xac'));_0x358027['field'](_0x41d2('0xad'),_0x41d2('0xae'));_0x358027[_0x41d2('0x53')]('c.lastName',_0x41d2('0xaf'));_0x358027[_0x41d2('0x53')](_0x41d2('0xb0'),'Contact.email');_0x358027[_0x41d2('0x53')](_0x41d2('0xb1'),'Contact.phone');_0x358027[_0x41d2('0x53')](_0x41d2('0xb2'),_0x41d2('0xb3'));_0x358027[_0x41d2('0x53')](_0x41d2('0xb4'),_0x41d2('0xb5'));_0x358027['field']('o.fullname',_0x41d2('0xb6'));_0x358027[_0x41d2('0x53')](_0x41d2('0xb7'),'Owner.internal');_0x358027[_0x41d2('0x53')](_0x41d2('0xb8'),'TagIds');}if(_0x39a885['limit'])_0x358027['limit'](_0x39a885['limit']);if(_0x39a885['offset'])_0x358027['offset'](_0x39a885['offset']);return db['sequelize'][_0x41d2('0x47')](_0x358027[_0x41d2('0xa5')](),_0x5de4a9);})[_0x41d2('0x38')](function(_0x29be02){_0x4be4ef[_0x41d2('0x4f')]('ui.ChatInteractionId\x20IN\x20?',_['map'](_0x29be02,'id'));return db[_0x41d2('0xa4')][_0x41d2('0x47')](_0x4be4ef[_0x41d2('0xa5')](),_0x5de4a9)['then'](function(_0x5e01b4){var _0x14cff7=_['groupBy'](_0x5e01b4,_0x41d2('0xb9'));var _0x5cdd3d=[];_0x29be02[_0x41d2('0x41')](function(_0x3f7597){_0x5cdd3d[_0x41d2('0xba')](updateChatInteraction(_0x3f7597,_0x1b65a0,_0x14cff7));});return BPromise[_0x41d2('0xbb')](_0x5cdd3d);});});})[_0x41d2('0x38')](function(_0x59856a){_0x498308['rows']=_0x59856a;return _0x498308;})[_0x41d2('0x38')](respondWithFilteredResult(_0x4a9157,_0x39a885))['catch'](handleError(_0x4a9157,null));};exports[_0x41d2('0xbc')]=function(_0x1221a0,_0x1d250d){var _0x592a04={'raw':![],'where':{'id':_0x1221a0[_0x41d2('0xbd')]['id']}},_0x45fff6={};_0x45fff6['model']=_[_0x41d2('0x7e')](db[_0x41d2('0x43')][_0x41d2('0x44')]);_0x45fff6['query']=_['keys'](_0x1221a0[_0x41d2('0x47')]);_0x45fff6[_0x41d2('0x51')]=_[_0x41d2('0x48')](_0x45fff6[_0x41d2('0x46')],_0x45fff6[_0x41d2('0x47')]);_0x592a04[_0x41d2('0x49')]=_['intersection'](_0x45fff6['model'],qs['fields'](_0x1221a0[_0x41d2('0x47')][_0x41d2('0x4a')]));_0x592a04[_0x41d2('0x49')]=_0x592a04[_0x41d2('0x49')]['length']?_0x592a04['attributes']:_0x45fff6[_0x41d2('0x46')];if(_0x1221a0[_0x41d2('0x47')][_0x41d2('0xbe')]){_0x592a04[_0x41d2('0xbf')]=[{'all':!![]}];}_0x592a04=_['merge']({},_0x592a04,_0x1221a0[_0x41d2('0xc0')]);return db['ChatInteraction'][_0x41d2('0x68')](_0x592a04)[_0x41d2('0x38')](handleEntityNotFound(_0x1d250d,null))[_0x41d2('0x38')](respondWithResult(_0x1d250d,null))['catch'](handleError(_0x1d250d,null));};exports[_0x41d2('0xc1')]=function(_0x1722dc,_0x45034c){return db[_0x41d2('0x43')]['create'](_0x1722dc[_0x41d2('0x7d')],{})['then'](respondWithResult(_0x45034c,0xc9))['catch'](handleError(_0x45034c,null));};exports[_0x41d2('0x37')]=function(_0x5ce1d9,_0xe103f){if(_0x5ce1d9[_0x41d2('0x7d')]['id']){delete _0x5ce1d9[_0x41d2('0x7d')]['id'];}return db[_0x41d2('0x43')]['find']({'where':{'id':_0x5ce1d9[_0x41d2('0xbd')]['id']}})[_0x41d2('0x38')](handleEntityNotFound(_0xe103f,null))[_0x41d2('0x38')](saveUpdates(_0x5ce1d9[_0x41d2('0x7d')],null))[_0x41d2('0x38')](respondWithResult(_0xe103f,null))[_0x41d2('0x2c')](handleError(_0xe103f,null));};exports[_0x41d2('0xc2')]=function(_0x1b1be5,_0x3b8ac9){return db[_0x41d2('0x43')][_0x41d2('0x68')]({'where':{'id':_0x1b1be5['params']['id']}})[_0x41d2('0x38')](handleEntityNotFound(_0x3b8ac9,null))[_0x41d2('0x38')](removeEntity(_0x3b8ac9,null))[_0x41d2('0x2c')](handleError(_0x3b8ac9,null));};exports['describe']=function(_0x1d4a41,_0x566214){return db[_0x41d2('0x43')][_0x41d2('0xc3')]()[_0x41d2('0x38')](respondWithResult(_0x566214,null))[_0x41d2('0x2c')](handleError(_0x566214,null));};exports[_0x41d2('0xc4')]=function(_0x2fba4c,_0x14b414){var _0x38c99f=_0x2fba4c['params']['id'];var _0x1e4665;var _0x4eb5d7;var _0x4400ec;return db[_0x41d2('0x43')][_0x41d2('0xc5')]({'where':{'id':_0x38c99f}})[_0x41d2('0x38')](function(_0x40bacf){_0x1e4665=_0x40bacf;return db['ChatWebsite'][_0x41d2('0xc5')]({'where':{'id':_0x40bacf[_0x41d2('0x82')]},'attributes':['id',_0x41d2('0xc6'),'vidaooEscalation'],'raw':!![]});})[_0x41d2('0x38')](function(_0x2efcea){if(_0x2efcea&&_0x2efcea[_0x41d2('0xc6')]&&_0x2efcea[_0x41d2('0xc7')]){_0x4eb5d7=_0x2efcea;var _0x1abb65={'rejectUnauthorized':![],'method':'POST','uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x2efcea['vidaooApiKey']},'body':{'name':_0x41d2('0xc8')+_0x38c99f},'redirect':_0x41d2('0xc9'),'json':!![]};return rp(_0x1abb65);}else{throw new db[(_0x41d2('0x97'))][(_0x41d2('0xca'))](_0x41d2('0xcb'));}})[_0x41d2('0x38')](function(_0x438a6b){_0x4400ec=_0x438a6b;if(_0x4400ec['id']){var _0x4d9b2b={'body':_0x4400ec[_0x41d2('0xcc')],'ChatWebsiteId':_0x4eb5d7['id'],'ChatInteractionId':_0x1e4665['id'],'direction':_0x41d2('0xcd'),'UserId':_0x2fba4c[_0x41d2('0x9f')]['id']};return db[_0x41d2('0xce')][_0x41d2('0xc1')](_0x4d9b2b,{});}else{throw new db['Sequelize'][(_0x41d2('0xca'))](_0x41d2('0xcf'));}})['then'](function(){return _0x1e4665[_0x41d2('0xd0')]({'vidaooSessionId':_0x4400ec['id']});})[_0x41d2('0x38')](respondWithResult(_0x14b414,null))[_0x41d2('0x2c')](handleError(_0x14b414,null));};exports[_0x41d2('0xd1')]=function(_0x1de97f,_0x391121){if(_0x1de97f[_0x41d2('0x7d')]['id']){delete _0x1de97f[_0x41d2('0x7d')]['id'];}return db[_0x41d2('0x43')][_0x41d2('0x68')]({'where':{'id':_0x1de97f['params']['id']},'include':[{'model':db['CmContact'],'as':_0x41d2('0x6e')}]})[_0x41d2('0x38')](handleEntityNotFound(_0x391121,null))[_0x41d2('0x38')](saveUpdates(_0x1de97f[_0x41d2('0x7d')],null))[_0x41d2('0x38')](respondWithResult(_0x391121,null))[_0x41d2('0x2c')](handleError(_0x391121,null));};exports[_0x41d2('0xd2')]=function(_0x4eacb3,_0x287bf6,_0x13b506){if(_0x4eacb3['body']['id']){delete _0x4eacb3[_0x41d2('0x7d')]['id'];}return db[_0x41d2('0x43')][_0x41d2('0x68')]({'where':{'id':_0x4eacb3[_0x41d2('0xbd')]['id']}})['then'](function(_0x120e97){if(!_0x120e97){logger[_0x41d2('0x27')](_0x41d2('0xd3'),_0x41d2('0xd2'),0x194,_0x41d2('0xd4'));_0x287bf6[_0x41d2('0x39')](0x194);}else{if(_0x120e97[_0x41d2('0x79')]){throw new db[(_0x41d2('0x97'))][(_0x41d2('0xca'))](_0x41d2('0xd5'));}}return _0x120e97;})[_0x41d2('0x38')](function(_0x1dd09f){if(_0x1dd09f){return _0x1dd09f[_0x41d2('0x37')]({'closed':_0x4eacb3['body'][_0x41d2('0xd6')],'disposition':_0x4eacb3[_0x41d2('0x7d')]['disposition']})[_0x41d2('0x38')](function(_0x5ec55e){return _0x5ec55e;});}})[_0x41d2('0x38')](function(_0x1ee257){return respondWithRpcPromise(_0x41d2('0xd7'),'abandon',_0x4eacb3[_0x41d2('0x7d')],client9004);})[_0x41d2('0x38')](respondWithResult(_0x287bf6,null))['catch'](handleError(_0x287bf6,null));};exports[_0x41d2('0xd8')]=function(_0x4b8df2,_0x536e08,_0x3cc30b){_0x4b8df2[_0x41d2('0x7d')][_0x41d2('0x3b')]=_0x4b8df2[_0x41d2('0xd9')][_0x41d2('0xda')];_0x4b8df2['body'][_0x41d2('0xdb')]=_0x4b8df2[_0x41d2('0xd9')][_0x41d2('0xdc')];_0x4b8df2['body'][_0x41d2('0x74')]=_0x4b8df2['file'][_0x41d2('0xdd')];return db[_0x41d2('0xde')][_0x41d2('0xc1')](_0x4b8df2['body'])[_0x41d2('0x38')](respondWithResult(_0x536e08,0xc9))[_0x41d2('0x2c')](handleError(_0x536e08,null));};exports[_0x41d2('0xdf')]=function(_0x327b98,_0x1528c2,_0x3bd65b){return db[_0x41d2('0x43')][_0x41d2('0xc5')]({'where':{'id':_0x327b98['params']['id']},'raw':!![]})[_0x41d2('0x38')](handleEntityNotFound(_0x1528c2,null))[_0x41d2('0x38')](function(_0x400991){if(_0x400991){if(_0x400991[_0x41d2('0xd6')]){return _0x1528c2[_0x41d2('0x2d')](0x193)[_0x41d2('0x2f')]({'status':0x193,'message':'Unauthorized'});}return db[_0x41d2('0xde')][_0x41d2('0xc5')]({'where':{'id':_0x327b98[_0x41d2('0x47')]['attachId']},'raw':!![]})[_0x41d2('0x38')](handleEntityNotFound(_0x1528c2,null));}})[_0x41d2('0x38')](function(_0x3d7f89){if(_0x3d7f89){var _0x17b7d5=_0x3d7f89[_0x41d2('0xe0')]!==null;var _0x27e06e=path[_0x41d2('0xe1')](config['root'],_0x41d2('0xe2'));if(_0x17b7d5){_0x27e06e=path[_0x41d2('0xe1')](_0x27e06e,_0x41d2('0xe3'));}var _0x52a3bf=path[_0x41d2('0xe1')](_0x27e06e,_0x3d7f89['basename']);return _0x1528c2[_0x41d2('0xe4')](_0x52a3bf);}})[_0x41d2('0x2c')](handleError(_0x1528c2,null));};exports[_0x41d2('0xe5')]=function(_0x28ce28,_0x18dff1){var _0x1c8db3=null;var _0x45d57d=null;var _0x52952d=null;var _0x3565a7=null;if(_0x28ce28[_0x41d2('0x7d')]['id']){delete _0x28ce28['body']['id'];}if(_0x28ce28[_0x41d2('0x7d')][_0x41d2('0xe6')]){_0x3565a7=path[_0x41d2('0xe1')](config[_0x41d2('0xe7')],'server/files/chat/upload/',util[_0x41d2('0xe8')]('transcript-%s.txt',Date[_0x41d2('0xe9')]()));_0x28ce28[_0x41d2('0x7d')][_0x41d2('0xea')]=_0x3565a7;}return db[_0x41d2('0x43')][_0x41d2('0x68')]({'where':{'id':_0x28ce28[_0x41d2('0xbd')]['id']},'include':[{'model':db[_0x41d2('0xce')],'as':'Messages','include':[{'model':db[_0x41d2('0x77')],'as':_0x41d2('0x77')}]}]})[_0x41d2('0x38')](handleEntityNotFound(_0x18dff1,null))[_0x41d2('0x38')](saveUpdates(_0x28ce28[_0x41d2('0x7d')],null))[_0x41d2('0x38')](function(_0x56f884){if(_0x56f884){_0x1c8db3=_0x56f884;return db['ChatWebsite']['find']({'where':{'id':_0x1c8db3[_0x41d2('0x82')]}});}})[_0x41d2('0x38')](function(_0x469e8b){if(_0x469e8b){_0x52952d=_0x469e8b;return db['CmContact'][_0x41d2('0x68')]({'where':{'id':_0x1c8db3[_0x41d2('0x73')]}});}})[_0x41d2('0x38')](function(_0x47f18d){if(_0x47f18d){_0x45d57d=_0x47f18d;if(_0x3565a7){var _0x2ee23c=null;for(var _0x4fe573=0x1;_0x4fe573<_0x1c8db3[_0x41d2('0xeb')][_0x41d2('0x4b')];++_0x4fe573){_0x2ee23c=_0x1c8db3[_0x41d2('0xeb')][_0x4fe573];var _0x50b242=_0x2ee23c['UserId']?util[_0x41d2('0xe8')]('%s%d',_0x52952d[_0x41d2('0xec')],_0x2ee23c[_0x41d2('0x79')]):_0x41d2('0xed');var _0x3323ad=_0x28ce28[_0x41d2('0x7d')]['customer']||util['format'](_0x41d2('0xee'),_0x41d2('0xef'),_0x2ee23c['ContactId']);switch(_0x52952d[_0x41d2('0xf0')]){case _0x41d2('0xf1'):_0x50b242=_0x2ee23c[_0x41d2('0x79')]?util[_0x41d2('0xe8')]('%s%d',_0x52952d[_0x41d2('0xec')],_0x2ee23c['UserId']):_0x41d2('0xed');break;case _0x41d2('0xf2'):_0x50b242=_0x2ee23c[_0x41d2('0x79')]?_0x2ee23c[_0x41d2('0x77')][_0x41d2('0xf3')]||_0x2ee23c['User'][_0x41d2('0x3e')]:'System';break;case _0x41d2('0xf4'):_0x50b242=_0x2ee23c[_0x41d2('0x79')]?_0x2ee23c[_0x41d2('0x77')][_0x41d2('0x3e')]:_0x41d2('0xed');break;default:_0x50b242=_0x2ee23c[_0x41d2('0x79')]?util[_0x41d2('0xe8')](_0x41d2('0xee'),_0x52952d['agentAlias'],_0x2ee23c[_0x41d2('0x79')]):_0x41d2('0xed');}var _0x586117=util['format'](_0x41d2('0xf5'),moment(_0x2ee23c[_0x41d2('0xf6')])[_0x41d2('0xe8')]('MM/DD/YYYY\x20HH:mm:ss'),_0x2ee23c['direction']==='in'?_0x3323ad:_0x50b242,_0x2ee23c[_0x41d2('0x7d')]);if(!_0x2ee23c['secret']){fs[_0x41d2('0xf7')](_0x3565a7,_0x586117);}}return db['MailAccount'][_0x41d2('0xc5')]({'where':{'service':!![]},'include':[{'model':db[_0x41d2('0xf8')],'as':_0x41d2('0xf9'),'raw':!![]}]});}}})[_0x41d2('0x38')](function(_0x4e2301){if(_0x4e2301&&_0x4e2301[_0x41d2('0xf9')]&&_0x28ce28[_0x41d2('0x7d')]){var _0x35dfaa={'tls':{'rejectUnauthorized':![]}};if(_0x4e2301['Smtp'][_0x41d2('0xfa')]){_0x35dfaa[_0x41d2('0xfa')]=_0x4e2301[_0x41d2('0xf9')][_0x41d2('0xfa')];}else{_0x35dfaa[_0x41d2('0xfb')]=_0x4e2301[_0x41d2('0xf9')][_0x41d2('0xfb')];_0x35dfaa[_0x41d2('0xfc')]=_0x4e2301[_0x41d2('0xf9')]['port'];_0x35dfaa[_0x41d2('0xfd')]=_0x4e2301[_0x41d2('0xf9')][_0x41d2('0xfd')];}if(_0x4e2301['Smtp'][_0x41d2('0xfe')]){_0x35dfaa[_0x41d2('0xff')]={'user':_0x4e2301['Smtp']['user'],'pass':_0x4e2301[_0x41d2('0xf9')][_0x41d2('0x100')]};}return respondWithRpcPromise(_0x41d2('0x101'),'sendMail',{'account':_0x35dfaa,'message':{'from':util[_0x41d2('0xe8')](_0x41d2('0x102'),_0x4e2301[_0x41d2('0x3b')],_0x4e2301[_0x41d2('0x103')]||_0x4e2301[_0x41d2('0xf9')][_0x41d2('0x9f')]),'to':_0x28ce28['body'][_0x41d2('0xe6')],'subject':_0x41d2('0x104'),'text':util[_0x41d2('0xe8')](_0x41d2('0x105'),_0x28ce28['body'][_0x41d2('0xe6')]),'attachments':[{'path':_0x3565a7}]}})[_0x41d2('0x38')](function(){return _0x1c8db3;})['catch'](function(_0x466f7b){console[_0x41d2('0x27')](_0x466f7b);});}else{return _0x1c8db3;}})[_0x41d2('0x38')](respondWithStatusCode(_0x18dff1,0xc8))['catch'](handleError(_0x18dff1,null));};exports[_0x41d2('0x106')]=function(_0x20d6ae,_0x32fa58,_0x234cab){return db[_0x41d2('0xce')][_0x41d2('0x68')]({'where':{'id':_0x20d6ae[_0x41d2('0xbd')]['id']}})[_0x41d2('0x38')](handleEntityNotFound(_0x32fa58,null))[_0x41d2('0x38')](function(_0x1c3ffd){if(_0x1c3ffd){return _0x1c3ffd[_0x41d2('0x106')](_0x20d6ae[_0x41d2('0x7d')]['ids'],_[_0x41d2('0x107')](_0x20d6ae[_0x41d2('0x7d')],[_0x41d2('0x108'),'id'])||{});}})[_0x41d2('0x38')](respondWithResult(_0x32fa58,null))[_0x41d2('0x2c')](handleError(_0x32fa58,null));};exports[_0x41d2('0x109')]=function(_0x424b3f,_0x55fe2e,_0x8c5f81){var _0x2a3c7f={'raw':![],'where':{}};var _0x35616c={};var _0x159dcf={'count':0x0,'rows':[]};return db[_0x41d2('0x43')][_0x41d2('0xc5')]({'where':{'id':_0x424b3f[_0x41d2('0xbd')]['id']}})[_0x41d2('0x38')](handleEntityNotFound(_0x55fe2e,null))[_0x41d2('0x38')](function(_0x53bdd2){if(_0x53bdd2){_0x35616c['model']=_['keys'](db[_0x41d2('0xce')][_0x41d2('0x44')]);_0x35616c[_0x41d2('0x47')]=_[_0x41d2('0x7e')](_0x424b3f[_0x41d2('0x47')]);_0x35616c[_0x41d2('0x51')]=_['intersection'](_0x35616c[_0x41d2('0x46')],_0x35616c[_0x41d2('0x47')]);_0x2a3c7f[_0x41d2('0x49')]=_[_0x41d2('0x48')](_0x35616c[_0x41d2('0x46')],qs[_0x41d2('0x4a')](_0x424b3f[_0x41d2('0x47')][_0x41d2('0x4a')]));_0x2a3c7f[_0x41d2('0x49')]=_0x2a3c7f[_0x41d2('0x49')][_0x41d2('0x4b')]?_0x2a3c7f[_0x41d2('0x49')]:_0x35616c[_0x41d2('0x46')];if(!_0x424b3f[_0x41d2('0x47')][_0x41d2('0x4c')](_0x41d2('0x4d'))){_0x2a3c7f['limit']=qs[_0x41d2('0x32')](_0x424b3f[_0x41d2('0x47')][_0x41d2('0x32')]);_0x2a3c7f[_0x41d2('0x31')]=qs['offset'](_0x424b3f[_0x41d2('0x47')][_0x41d2('0x31')]);}_0x2a3c7f[_0x41d2('0x9c')]=qs[_0x41d2('0x4e')](_0x424b3f[_0x41d2('0x47')][_0x41d2('0x4e')]);_0x2a3c7f[_0x41d2('0x4f')]=qs[_0x41d2('0x51')](_[_0x41d2('0x50')](_0x424b3f[_0x41d2('0x47')],_0x35616c[_0x41d2('0x51')]));_0x2a3c7f[_0x41d2('0x4f')]['ChatInteractionId']=_0x53bdd2['id'];if(_0x424b3f[_0x41d2('0x47')][_0x41d2('0x91')]){_0x2a3c7f[_0x41d2('0x4f')]=_[_0x41d2('0x10a')](_0x2a3c7f[_0x41d2('0x4f')],{'$or':_[_0x41d2('0x3d')](_0x2a3c7f[_0x41d2('0x49')],function(_0x5d8b0b){var _0x46cede={};_0x46cede[_0x5d8b0b]={'$like':'%'+_0x424b3f[_0x41d2('0x47')][_0x41d2('0x91')]+'%'};return _0x46cede;})});}if(_0x424b3f[_0x41d2('0x47')][_0x41d2('0x86')]){var _0x442bb7=_0x424b3f[_0x41d2('0x47')][_0x41d2('0x86')][_0x41d2('0x40')](',');var _0x17eaeb={};_0x17eaeb[_0x442bb7[0x0]]={'$gte':moment(_0x442bb7[0x1])[_0x41d2('0xe8')](_0x41d2('0x10b'))};_0x2a3c7f[_0x41d2('0x4f')]=_[_0x41d2('0x10a')](_0x2a3c7f[_0x41d2('0x4f')],_0x17eaeb);}_0x2a3c7f=_['merge']({},_0x2a3c7f,_0x424b3f[_0x41d2('0xc0')]);return db['ChatMessage'][_0x41d2('0x30')]({'where':_0x2a3c7f[_0x41d2('0x4f')]})[_0x41d2('0x38')](function(_0x1f9ac1){_0x159dcf[_0x41d2('0x30')]=_0x1f9ac1;if(_0x424b3f[_0x41d2('0x47')][_0x41d2('0xbe')]){_0x2a3c7f['include']=[{'all':!![]}];}return db[_0x41d2('0xce')][_0x41d2('0x10c')](_0x2a3c7f);})[_0x41d2('0x38')](function(_0x250461){_0x159dcf[_0x41d2('0x10d')]=_0x250461;return _0x159dcf;});}})[_0x41d2('0x38')](respondWithFilteredResult(_0x55fe2e,_0x2a3c7f))[_0x41d2('0x2c')](handleError(_0x55fe2e,null));};exports[_0x41d2('0x10e')]=function(_0x47388d,_0x1eb46c,_0x34baae){var _0x40726e={'where':{}},_0x17220c={},_0x5aced6={'count':0x0,'rows':[]};return db[_0x41d2('0x43')][_0x41d2('0xc5')]({'where':{'id':_0x47388d[_0x41d2('0xbd')]['id']}})[_0x41d2('0x38')](handleEntityNotFound(_0x1eb46c,null))[_0x41d2('0x38')](function(_0x2220ef){if(_0x2220ef){_0x17220c[_0x41d2('0x46')]=_[_0x41d2('0x7e')](db['ChatMessage']['rawAttributes']);_0x17220c[_0x41d2('0x47')]=_[_0x41d2('0x7e')](_0x47388d[_0x41d2('0x47')]);_0x17220c['filters']=_[_0x41d2('0x48')](_0x17220c['model'],_0x17220c['query']);_0x40726e[_0x41d2('0x49')]=_[_0x41d2('0x48')](_0x17220c[_0x41d2('0x46')],qs[_0x41d2('0x4a')](_0x47388d[_0x41d2('0x47')][_0x41d2('0x4a')]));_0x40726e['attributes']=_0x40726e[_0x41d2('0x49')][_0x41d2('0x4b')]?_0x40726e[_0x41d2('0x49')]:_0x17220c[_0x41d2('0x46')];if(!_0x47388d['query'][_0x41d2('0x4c')](_0x41d2('0x4d'))){_0x40726e['limit']=qs['limit'](_0x47388d[_0x41d2('0x47')][_0x41d2('0x32')]);_0x40726e[_0x41d2('0x31')]=qs['offset'](_0x47388d['query'][_0x41d2('0x31')]);}_0x40726e['order']=qs[_0x41d2('0x4e')](_0x47388d[_0x41d2('0x47')]['sort']);_0x40726e[_0x41d2('0x4f')]=qs[_0x41d2('0x51')](_[_0x41d2('0x50')](_0x47388d[_0x41d2('0x47')],_0x17220c['filters']));_0x40726e[_0x41d2('0x4f')][_0x41d2('0xb9')]=_0x2220ef['id'];if(_0x47388d[_0x41d2('0x47')]['filter']){_0x40726e[_0x41d2('0x4f')]=_[_0x41d2('0x10a')](_0x40726e[_0x41d2('0x4f')],{'$or':_[_0x41d2('0x3d')](_0x40726e['attributes'],function(_0x2da5d3){var _0x2c384f={};_0x2c384f[_0x2da5d3]={'$like':'%'+_0x47388d[_0x41d2('0x47')][_0x41d2('0x91')]+'%'};return _0x2c384f;})});}_0x40726e[_0x41d2('0x4f')][_0x41d2('0x10f')]=![];if(_0x47388d['query']['id']){_0x40726e['where']['id']={'$gt':_0x47388d[_0x41d2('0x47')]['id']};}_0x40726e=_['merge']({},_0x40726e,_0x47388d['options']);return db['ChatMessage'][_0x41d2('0x30')]({'where':_0x40726e[_0x41d2('0x4f')]})[_0x41d2('0x38')](function(_0x5a640a){_0x5aced6[_0x41d2('0x30')]=_0x5a640a;_0x40726e['include']=[];if(_0x47388d[_0x41d2('0x47')][_0x41d2('0x110')]){_0x40726e[_0x41d2('0xbf')][_0x41d2('0xba')]({'model':db['User'],'as':_0x41d2('0x77'),'attributes':['id','fullname',_0x41d2('0xf3')]});}if(_0x47388d['query'][_0x41d2('0xbe')]){_0x40726e[_0x41d2('0xbf')]=[{'all':!![]}];}return db[_0x41d2('0xce')][_0x41d2('0x10c')](_0x40726e);})[_0x41d2('0x38')](function(_0x282ec3){_0x5aced6['rows']=_0x282ec3;return _0x5aced6;});}})[_0x41d2('0x38')](respondWithFilteredResult(_0x1eb46c,_0x40726e))['catch'](handleError(_0x1eb46c,null));};exports['addTags']=function(_0x48f9c6,_0x409b89,_0x18e92a){return db[_0x41d2('0x43')][_0x41d2('0x68')]({'where':{'id':_0x48f9c6[_0x41d2('0xbd')]['id']}})[_0x41d2('0x38')](handleEntityNotFound(_0x409b89,null))['then'](function(_0x488d58){if(_0x488d58){return _0x488d58[_0x41d2('0x111')](_0x48f9c6[_0x41d2('0x7d')]['ids'],_[_0x41d2('0x107')](_0x48f9c6[_0x41d2('0x7d')],['ids','id'])||{})[_0x41d2('0x112')](function(){return db['Tag'][_0x41d2('0x10c')]({'attributes':['id','name',_0x41d2('0x54')],'where':{'id':_0x48f9c6[_0x41d2('0x7d')][_0x41d2('0x108')]}});})[_0x41d2('0x38')](function(_0x4de22f){socket['emit'](_0x41d2('0x113'),{'id':Number(_0x48f9c6[_0x41d2('0xbd')]['id']),'tags':_0x4de22f||[]});return{'id':Number(_0x48f9c6['params']['id']),'tags':_0x4de22f||[]};});}})['then'](respondWithResult(_0x409b89,null))[_0x41d2('0x2c')](handleError(_0x409b89,null));};exports[_0x41d2('0x114')]=function(_0x3ee253,_0x2a6812,_0x1cf3cc){return db[_0x41d2('0x43')][_0x41d2('0x68')]({'where':{'id':_0x3ee253[_0x41d2('0xbd')]['id']}})[_0x41d2('0x38')](handleEntityNotFound(_0x2a6812,null))[_0x41d2('0x38')](function(_0x3d4a5e){if(_0x3d4a5e){return _0x3d4a5e[_0x41d2('0x114')](_0x3ee253[_0x41d2('0x47')][_0x41d2('0x108')]);}})[_0x41d2('0x38')](respondWithStatusCode(_0x2a6812,null))[_0x41d2('0x2c')](handleError(_0x2a6812,null));};exports[_0x41d2('0xe4')]=function(_0x269a13,_0x3afa63){var _0x31edb5=moment()[_0x41d2('0x115')]()['toString']();var _0x438537=path[_0x41d2('0xe1')](config[_0x41d2('0xe7')],'server',_0x41d2('0x116'),_0x41d2('0x117'));var _0x4cc45a=path[_0x41d2('0xe1')](config['root'],_0x41d2('0x118'),'files',_0x41d2('0x119'));var _0x460ddb=path[_0x41d2('0xe1')](_0x438537,_0x31edb5);var _0x4d60a1=util[_0x41d2('0xe8')]('transcript-%d-%s.zip',_0x269a13[_0x41d2('0xbd')]['id'],_0x31edb5);var _0x3ad6a4=path[_0x41d2('0xe1')](_0x438537,_0x4d60a1);var _0x2cc667=[];_0x2cc667['push']({'model':db[_0x41d2('0x77')],'as':_0x41d2('0x77'),'attributes':['id','fullname'],'raw':!![]});_0x2cc667['push']({'model':db[_0x41d2('0x11a')],'as':_0x41d2('0x6e'),'attributes':['id',_0x41d2('0x11b'),_0x41d2('0x11c')],'raw':!![]});if(_0x269a13[_0x41d2('0x47')]['attachments']){_0x2cc667['push']({'model':db[_0x41d2('0xde')],'as':_0x41d2('0xde'),'raw':!![]});}var _0x506504=[{'model':db['ChatMessage'],'as':_0x41d2('0xeb'),'attributes':['id','body',_0x41d2('0xf6'),_0x41d2('0x11d'),_0x41d2('0x10f'),_0x41d2('0x8c')],'include':_0x2cc667}];_0x506504[_0x41d2('0xba')]({'model':db['ChatWebsite'],'as':_0x41d2('0x11e'),'attributes':['id',_0x41d2('0x3b')]});_0x506504[_0x41d2('0xba')]({'model':db[_0x41d2('0x77')],'as':'Owner','attributes':['id','fullname']});return db['ChatInteraction']['find']({'where':{'id':_0x269a13['params']['id']},'include':_0x506504})[_0x41d2('0x38')](handleEntityNotFound(_0x3afa63,null))['then'](function(_0x3cae90){if(_0x3cae90){var _0x5affc9=_0x3cae90[_0x41d2('0x11f')]({'plain':!![]});fs[_0x41d2('0x120')](_0x460ddb);var _0x2ba4cf={'channel':_0x41d2('0x121'),'account':_0x5affc9['Account'][_0x41d2('0x3b')],'agent':_0x5affc9[_0x41d2('0x122')]?_0x5affc9[_0x41d2('0x122')][_0x41d2('0x3e')]:_0x41d2('0x123'),'createdAt':moment(_0x5affc9[_0x41d2('0xf6')])['format'](_0x41d2('0x10b'))['toString'](),'closedAt':_0x5affc9['closed']?moment(_0x5affc9[_0x41d2('0x124')])['format'](_0x41d2('0x10b'))['toString']():'','disposition':_0x5affc9[_0x41d2('0x125')],'chatInfo':{'browser':_0x5affc9[_0x41d2('0x126')],'os':_0x5affc9[_0x41d2('0x127')],'referer':_0x5affc9['referer'],'customerIp':_0x5affc9[_0x41d2('0x128')],'customerPort':_0x5affc9[_0x41d2('0x129')]?_0x5affc9[_0x41d2('0x129')]:_0x41d2('0x123')},'messages':_(_0x5affc9['Messages'])['tail']()['filter']({'secret':![]})[_0x41d2('0x3d')](function(_0x1791f4){if(_0x1791f4[_0x41d2('0xde')]){var _0x534795=path['join'](_0x4cc45a,_0x1791f4[_0x41d2('0xde')]['basename']);if(fs[_0x41d2('0x12a')](_0x534795)){fs[_0x41d2('0x12b')](_0x534795)[_0x41d2('0x12c')](fs[_0x41d2('0x12d')](path['join'](_0x460ddb,_0x1791f4['Attachment'][_0x41d2('0xdb')])));}}return{'date':moment(_0x1791f4[_0x41d2('0xf6')])[_0x41d2('0xe8')](_0x41d2('0x10b'))[_0x41d2('0xa5')](),'sender':_0x1791f4['direction']===_0x41d2('0xcd')?_0x1791f4['User']?_0x1791f4[_0x41d2('0x77')][_0x41d2('0x3e')]:_0x41d2('0xed'):_0x1791f4[_0x41d2('0x6e')]['firstName']+(_0x1791f4[_0x41d2('0x6e')]['lastName']?'\x20'+_0x1791f4[_0x41d2('0x6e')][_0x41d2('0x11c')]:''),'body':_0x1791f4[_0x41d2('0xde')]?_0x1791f4[_0x41d2('0xde')][_0x41d2('0xdb')]:_0x1791f4['body'],'direction':_0x1791f4[_0x41d2('0x11d')]===_0x41d2('0xcd')?'A':'C','secret':_0x1791f4[_0x41d2('0x10f')],'read':_0x1791f4[_0x41d2('0x8c')],'attachment':_0x1791f4[_0x41d2('0xde')]};})[_0x41d2('0x6a')]()};return ejs[_0x41d2('0x12e')](path[_0x41d2('0xe1')](config[_0x41d2('0xe7')],_0x41d2('0x118'),_0x41d2('0x12f'),'downloadInteraction.html'),{'interaction':_0x2ba4cf})[_0x41d2('0x38')](function(_0x4d73ef){var _0x34422d=path[_0x41d2('0xe1')](_0x460ddb,_0x41d2('0x130')+_0x5affc9['id']+'-'+_0x31edb5+_0x41d2('0x131'));var _0x40f26c={'path':_0x34422d,'channel':_0x41d2('0x121'),'interactionId':_0x5affc9['id']};return pdf[_0x41d2('0x132')](_0x4d73ef,_0x40f26c);})['then'](function(){return new BPromise(function(_0x1e846c,_0x30a268){zipdir(_0x460ddb,{'saveTo':_0x3ad6a4},function(_0x3c9789,_0x512cc5){if(_0x3c9789)return _0x30a268(_0x3c9789);return _0x1e846c(_0x512cc5);});})[_0x41d2('0x38')](function(){return new BPromise(function(_0x26ce6a,_0x4e5810){rimraf(_0x460ddb,function(_0x4a209c){if(_0x4a209c)_0x4e5810(_0x4a209c);return _0x26ce6a();});});})['then'](function(){return _0x3afa63[_0x41d2('0xe4')](_0x3ad6a4,_0x4d60a1,function(_0x3fc418){if(_0x3fc418){console[_0x41d2('0x133')]('err',_0x3fc418);}else{fs[_0x41d2('0x134')](_0x3ad6a4);}});});});}else{return _0x3afa63[_0x41d2('0x39')](0xc8);}})['catch'](handleError(_0x3afa63,null));}; \ No newline at end of file +var _0x5cc1=['compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','Account.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','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','push','all','rows','show','params','includeAll','include','create','body','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','entity\x20not\x20found','closed','disposition','AbandonInteraction','file','originalname','basename','Attachment','attachmentDownload','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailServerOut','Smtp','service','host','port','secure','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','options','findAll','getMyMessages','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','firstName','direction','Account','Owner','get','N.A.','closedAt','browserName','osName','referer','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','lastName','views','downloadInteraction.html','transcript-','Chat','createPdfFromHTML','err','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','end','status','count','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','stack','name','send','Users','map','fullname','TagIds','Tags','split','index','ChatInteraction','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','select','field','color','from','tools_tags','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','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','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','type','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some'];(function(_0x1ac37a,_0x5e59e2){var _0x248e71=function(_0x2e4aee){while(--_0x2e4aee){_0x1ac37a['push'](_0x1ac37a['shift']());}};_0x248e71(++_0x5e59e2);}(_0x5cc1,0x1f3));var _0x15cc=function(_0x4017ba,_0x111e95){_0x4017ba=_0x4017ba-0x0;var _0x44a80e=_0x5cc1[_0x4017ba];return _0x44a80e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x15cc('0x0'));var jsonpatch=require(_0x15cc('0x1'));var rp=require('request-promise');var moment=require(_0x15cc('0x2'));var BPromise=require(_0x15cc('0x3'));var Mustache=require(_0x15cc('0x4'));var util=require('util');var path=require('path');var sox=require(_0x15cc('0x5'));var csv=require(_0x15cc('0x6'));var ejs=require(_0x15cc('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x15cc('0x8'));var squel=require(_0x15cc('0x9'));var crypto=require(_0x15cc('0xa'));var jsforce=require(_0x15cc('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x15cc('0xc'));var Papa=require(_0x15cc('0xd'));var Redis=require(_0x15cc('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x15cc('0xf'));var as=require(_0x15cc('0x10'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x15cc('0x11'));var logger=require(_0x15cc('0x12'))(_0x15cc('0x13'));var utils=require(_0x15cc('0x14'));var config=require(_0x15cc('0x15'));var licenseUtil=require(_0x15cc('0x16'));var db=require(_0x15cc('0x17'))['db'];config[_0x15cc('0x18')]=_[_0x15cc('0x19')](config[_0x15cc('0x18')],{'host':_0x15cc('0x1a'),'port':0x18eb});var socket=require(_0x15cc('0x1b'))(new Redis(config[_0x15cc('0x18')]));require(_0x15cc('0x1c'))[_0x15cc('0x1d')](socket);var jayson=require(_0x15cc('0x1e'));var client=jayson[_0x15cc('0x1f')][_0x15cc('0x20')]({'port':0x232b});var client9004=jayson[_0x15cc('0x1f')][_0x15cc('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x249a07,_0x42c14f,_0x1f5e1d,_0x463d0f){return new BPromise(function(_0xf44d11,_0x5d0254){var _0x2bc280=_0x463d0f||client;return _0x2bc280[_0x15cc('0x21')](_0x249a07,_0x1f5e1d)['then'](function(_0x1a2b22){logger[_0x15cc('0x22')](_0x15cc('0x23'),_0x42c14f,_0x15cc('0x24'));logger[_0x15cc('0x25')](_0x15cc('0x26'),_0x42c14f,_0x15cc('0x24'),JSON[_0x15cc('0x27')](_0x1a2b22));if(_0x1a2b22[_0x15cc('0x28')]){if(_0x1a2b22[_0x15cc('0x28')][_0x15cc('0x29')]===0x1f4){logger[_0x15cc('0x28')](_0x15cc('0x23'),_0x42c14f,_0x1a2b22[_0x15cc('0x28')][_0x15cc('0x2a')]);return _0x5d0254(_0x1a2b22[_0x15cc('0x28')][_0x15cc('0x2a')]);}logger[_0x15cc('0x28')](_0x15cc('0x23'),_0x42c14f,_0x1a2b22[_0x15cc('0x28')][_0x15cc('0x2a')]);return _0xf44d11(_0x1a2b22['error'][_0x15cc('0x2a')]);}else{logger[_0x15cc('0x22')](_0x15cc('0x23'),_0x42c14f,_0x15cc('0x24'));_0xf44d11(_0x1a2b22['result'][_0x15cc('0x2a')]);}})[_0x15cc('0x2b')](function(_0x5f0f84){logger[_0x15cc('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x42c14f,_0x5f0f84);_0x5d0254(_0x5f0f84);});});}function respondWithStatusCode(_0x408899,_0x10de3c){_0x10de3c=_0x10de3c||0xcc;return function(_0x25264a){if(_0x25264a){return _0x408899['sendStatus'](_0x10de3c);}return _0x408899['status'](_0x10de3c)[_0x15cc('0x2c')]();};}function respondWithResult(_0x56eb51,_0x54df69){_0x54df69=_0x54df69||0xc8;return function(_0x40afa2){if(_0x40afa2){return _0x56eb51[_0x15cc('0x2d')](_0x54df69)['json'](_0x40afa2);}};}function respondWithFilteredResult(_0x761a66,_0xd34f9b){return function(_0x45b9cf){if(_0x45b9cf){var _0x130d35=_0x45b9cf[_0x15cc('0x2e')],_0x2ce269=_0xd34f9b['offset'],_0x555835=_0xd34f9b['offset']+_0xd34f9b['limit'],_0x493eca;if(_0x555835>=_0x130d35){_0x555835=_0x130d35;_0x493eca=0xc8;}else{_0x493eca=0xce;}_0x761a66[_0x15cc('0x2d')](_0x493eca);return _0x761a66[_0x15cc('0x2f')](_0x15cc('0x30'),_0x2ce269+'-'+_0x555835+'/'+_0x130d35)[_0x15cc('0x31')](_0x45b9cf);}return null;};}function patchUpdates(_0x553409){return function(_0x100cb7){try{jsonpatch['apply'](_0x100cb7,_0x553409,!![]);}catch(_0x944f1f){return BPromise[_0x15cc('0x32')](_0x944f1f);}return _0x100cb7[_0x15cc('0x33')]();};}function saveUpdates(_0x4e0d30,_0x5d6bf9){return function(_0x1e01aa){if(_0x1e01aa){return _0x1e01aa[_0x15cc('0x34')](_0x4e0d30)[_0x15cc('0x35')](function(_0x4e03ed){return _0x4e03ed;});}return null;};}function removeEntity(_0x1a1f92,_0x3d35c6){return function(_0x36f696){if(_0x36f696){return _0x36f696[_0x15cc('0x36')]()[_0x15cc('0x35')](function(){_0x1a1f92['status'](0xcc)[_0x15cc('0x2c')]();});}};}function handleEntityNotFound(_0x446c33,_0x3d6b54){return function(_0x5c4577){if(!_0x5c4577){_0x446c33[_0x15cc('0x37')](0x194);}return _0x5c4577;};}function handleError(_0x2674c4,_0xb7e409){_0xb7e409=_0xb7e409||0x1f4;return function(_0x248335){logger[_0x15cc('0x28')](_0x248335[_0x15cc('0x38')]);if(_0x248335[_0x15cc('0x39')]){delete _0x248335[_0x15cc('0x39')];}_0x2674c4[_0x15cc('0x2d')](_0xb7e409)[_0x15cc('0x3a')](_0x248335);};}function getInteractionUsers(_0x1a0377,_0x411533){return new BPromise(function(_0x1e5f41,_0x22a3c0){try{if(_0x411533[_0x1a0377['id']]){_0x1a0377[_0x15cc('0x3b')]=_[_0x15cc('0x3c')](_0x411533[_0x1a0377['id']],function(_0x59d02d){return{'id':_0x59d02d['id'],'fullname':_0x59d02d[_0x15cc('0x3d')]};});}}catch(_0xf293cc){_0x22a3c0(_0xf293cc);}_0x1e5f41(_0x1a0377);});}function getInteractionTags(_0x21af8c,_0x49fe93){return new BPromise(function(_0x15fe70,_0x35c4c5){try{if(_0x21af8c[_0x15cc('0x3e')]){_0x21af8c[_0x15cc('0x3f')]=[];_0x21af8c[_0x15cc('0x3e')][_0x15cc('0x40')](',')['forEach'](function(_0x3b7356){_0x21af8c['Tags']['push'](_0x49fe93[_0x3b7356]);});}delete _0x21af8c['TagIds'];}catch(_0x56cb7c){_0x35c4c5(_0x56cb7c);}_0x15fe70(_0x21af8c);});}function updateChatInteraction(_0x42a8d0,_0xcd0047,_0x50a8bb){return new BPromise(function(_0x47d911,_0x396fa0){return getInteractionUsers(_0x42a8d0,_0x50a8bb)[_0x15cc('0x35')](function(_0x2e959e){return getInteractionTags(_0x2e959e,_0xcd0047);})['then'](function(_0xf02d41){_0x47d911(_0xf02d41);})['catch'](function(_0x2ca396){_0x396fa0(_0x2ca396);});});}exports[_0x15cc('0x41')]=function(_0x515829,_0x53c2f3){var _0x26fe19={},_0x40c67c={},_0x4aad83={'count':0x0,'rows':[]};var _0x5f4660=_[_0x15cc('0x3c')](db[_0x15cc('0x42')][_0x15cc('0x43')],function(_0x400e93){return{'name':_0x400e93[_0x15cc('0x44')],'type':_0x400e93['type'][_0x15cc('0x45')]};});_0x40c67c[_0x15cc('0x46')]=_[_0x15cc('0x3c')](_0x5f4660,_0x15cc('0x39'));_0x40c67c[_0x15cc('0x47')]=_[_0x15cc('0x48')](_0x515829[_0x15cc('0x47')]);_0x40c67c[_0x15cc('0x49')]=_['intersection'](_0x40c67c[_0x15cc('0x46')],_0x40c67c['query']);_0x26fe19[_0x15cc('0x4a')]=_[_0x15cc('0x4b')](_0x40c67c[_0x15cc('0x46')],qs[_0x15cc('0x4c')](_0x515829['query'][_0x15cc('0x4c')]));_0x26fe19[_0x15cc('0x4a')]=_0x26fe19[_0x15cc('0x4a')][_0x15cc('0x4d')]?_0x26fe19[_0x15cc('0x4a')]:_0x40c67c[_0x15cc('0x46')];if(!_0x515829[_0x15cc('0x47')][_0x15cc('0x4e')](_0x15cc('0x4f'))){_0x26fe19[_0x15cc('0x50')]=qs['limit'](_0x515829[_0x15cc('0x47')]['limit']);_0x26fe19[_0x15cc('0x51')]=qs[_0x15cc('0x51')](_0x515829['query']['offset']);}_0x26fe19[_0x15cc('0x52')]=qs['sort'](_0x515829[_0x15cc('0x47')][_0x15cc('0x53')]);_0x26fe19[_0x15cc('0x54')]=qs[_0x15cc('0x49')](_[_0x15cc('0x55')](_0x515829['query'],_0x40c67c[_0x15cc('0x49')]),_0x5f4660);var _0x58f95e=[];var _0x362346=squel[_0x15cc('0x56')]()['field']('id')[_0x15cc('0x57')](_0x15cc('0x39'))['field'](_0x15cc('0x58'))[_0x15cc('0x59')](_0x15cc('0x5a'));var _0x2e911e=squel[_0x15cc('0x56')]()[_0x15cc('0x57')]('u.id')[_0x15cc('0x57')](_0x15cc('0x5b'))[_0x15cc('0x57')](_0x15cc('0x5c'))[_0x15cc('0x59')](_0x15cc('0x5d'),'ui')[_0x15cc('0x5e')]('users','u',_0x15cc('0x5f'));var _0x476ff3=squel['select']()[_0x15cc('0x59')](_0x15cc('0x60'),'i')[_0x15cc('0x5e')](_0x15cc('0x61'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x15cc('0x62'),'o',_0x15cc('0x63'))[_0x15cc('0x5e')]('chat_websites','a',_0x15cc('0x64'))[_0x15cc('0x5e')](_0x15cc('0x65'),'me','me.ChatInteractionId\x20=\x20i.id')[_0x15cc('0x5e')](_0x15cc('0x66'),'it',_0x15cc('0x67'))[_0x15cc('0x5e')]('tools_tags','t',_0x15cc('0x68'));var _0x415cc4=squel[_0x15cc('0x69')]();var _0x2e3016=[];var _0x44b18e=squel[_0x15cc('0x69')]();var _0x162997;if(_0x515829[_0x15cc('0x47')][_0x15cc('0x6a')]){_0x162997=as[_0x15cc('0x6b')](_0x515829[_0x15cc('0x47')][_0x15cc('0x6a')]);var _0x1107b1=_0x162997[_0x15cc('0x6c')];for(var _0x41950c=0x0;_0x41950c<_0x162997[_0x15cc('0x6d')][_0x15cc('0x4d')];_0x41950c++){var _0x165f00=_0x162997[_0x15cc('0x6d')][_0x41950c];var _0x302acd='i';var _0x3659fc=_[_0x15cc('0x6e')](_0x5f4660,['name',_0x165f00['field']]);if(!_0x3659fc){switch(_0x165f00['field']){case _0x15cc('0x6f'):if(_0x165f00[_0x15cc('0x70')]==0x1){_0x476ff3[_0x15cc('0x71')]('`'+_0x165f00[_0x15cc('0x57')]+'`\x20=\x200');}else{_0x476ff3[_0x15cc('0x71')]('`'+_0x165f00[_0x15cc('0x57')]+_0x15cc('0x72'));}break;case _0x15cc('0x73'):if(_0x165f00[_0x15cc('0x74')]===_0x15cc('0x75')){if(_0x165f00['value'][_0x15cc('0x40')]('\x20')[_0x15cc('0x4d')]>0x1){_0x415cc4[_0x1107b1](_0x15cc('0x76'),qs[_0x15cc('0x77')](_0x165f00[_0x15cc('0x70')]),null);}else{var _0x2fe091='%'+_0x165f00[_0x15cc('0x70')]+'%';_0x415cc4[_0x1107b1](_0x15cc('0x78'),_0x2fe091,_0x2fe091,_0x2fe091);}}else{_0x3659fc=_['find'](_0x5f4660,['name',_0x15cc('0x79')]);_0x165f00[_0x15cc('0x57')]=_0x15cc('0x79');_0x52021e=as[_0x15cc('0x7a')](_0x302acd,_0x3659fc[_0x15cc('0x7b')],_0x165f00);_0x415cc4[_0x1107b1](_0x52021e[_0x15cc('0x7c')],_0x52021e[_0x15cc('0x70')][_0x15cc('0x7d')],_0x52021e[_0x15cc('0x70')]['end']);}break;case _0x15cc('0x7e'):var _0x3bc152=_0x165f00[_0x15cc('0x70')][_0x15cc('0x40')](',')[_0x15cc('0x3c')](function(_0x1595cd){return Number(_0x1595cd);});_0x3bc152[_0x15cc('0x7f')](function(_0x47b8f9){_0x44b18e['or'](_0x15cc('0x80'),'%,'+_0x47b8f9+',%');});_0x2e3016=_['union'](_0x2e3016,_0x3bc152);break;case _0x15cc('0x81'):if(_0x165f00['operator']==='$substring'){_0x415cc4[_0x1107b1](_0x15cc('0x82'),'%'+_0x165f00[_0x15cc('0x70')]+'%',null);}else{_0x3659fc=_[_0x15cc('0x6e')](_0x5f4660,[_0x15cc('0x39'),_0x15cc('0x83')]);_0x165f00['field']='UserId';_0x52021e=as[_0x15cc('0x7a')](_0x302acd,_0x3659fc[_0x15cc('0x7b')],_0x165f00);_0x415cc4[_0x1107b1](_0x52021e['text'],_0x52021e[_0x15cc('0x70')][_0x15cc('0x7d')],_0x52021e[_0x15cc('0x70')][_0x15cc('0x2c')]);}break;case'body':_0x52021e=as[_0x15cc('0x7a')]('me',null,_0x165f00);_0x415cc4[_0x1107b1](_0x52021e[_0x15cc('0x7c')],_0x52021e[_0x15cc('0x70')][_0x15cc('0x7d')],_0x52021e[_0x15cc('0x70')][_0x15cc('0x2c')]);break;}}else{var _0x52021e=as[_0x15cc('0x7a')](_0x302acd,_0x3659fc[_0x15cc('0x7b')],_0x165f00);_0x415cc4[_0x1107b1](_0x52021e['text'],_0x52021e[_0x15cc('0x70')][_0x15cc('0x7d')],_0x52021e[_0x15cc('0x70')][_0x15cc('0x2c')]);}}}else{var _0x50f204=_(_0x515829['query'])['keys']()[_0x15cc('0x3c')](function(_0x18f0bb){return _[_0x15cc('0x84')](_0x5f4660,[_0x15cc('0x39'),_0x18f0bb])?_0x18f0bb:undefined;})[_0x15cc('0x85')]()[_0x15cc('0x70')]();if(!_[_0x15cc('0x86')](_0x50f204)){_0x50f204[_0x15cc('0x7f')](function(_0x1f7b92){if(_0x1f7b92===_0x15cc('0x87')){_0x476ff3[_0x15cc('0x54')](_0x15cc('0x88'),[]['concat'](_0x515829['query'][_0x1f7b92]));}else if(_0x1f7b92===_0x15cc('0x89')){var _0x23a64a=JSON[_0x15cc('0x8a')](_0x515829[_0x15cc('0x47')][_0x1f7b92])[_0x15cc('0x8b')];var _0x59dd36=JSON[_0x15cc('0x8a')](_0x515829[_0x15cc('0x47')][_0x1f7b92])[_0x15cc('0x8c')];_0x476ff3[_0x15cc('0x54')](_0x15cc('0x8d'),_0x23a64a,_0x59dd36);}else{if(_0x515829['query'][_0x1f7b92]===_0x15cc('0x8e')){_0x476ff3[_0x15cc('0x54')]('i.'+_0x1f7b92+_0x15cc('0x8f'));}else{_0x476ff3[_0x15cc('0x54')]('i.'+_0x1f7b92+_0x15cc('0x90'),_0x515829['query'][_0x1f7b92]);}}});}if(_0x515829['query'][_0x15cc('0x91')]){if(_0x515829[_0x15cc('0x47')][_0x15cc('0x91')]==0x1){_0x476ff3['having'](_0x15cc('0x92'));}else{_0x476ff3[_0x15cc('0x71')](_0x15cc('0x93'));}}if(_0x515829['query'][_0x15cc('0x94')]){_0x2e3016=_[_0x15cc('0x95')](_0x515829[_0x15cc('0x47')]['tag'])?_0x515829[_0x15cc('0x47')]['tag']:new Array(_0x515829[_0x15cc('0x47')][_0x15cc('0x94')]);_0x2e3016[_0x15cc('0x7f')](function(_0x58c9e0){_0x44b18e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x58c9e0+',%');});}if(_0x515829[_0x15cc('0x47')]['filter']){var _0x363539=_0x515829[_0x15cc('0x47')][_0x15cc('0x96')][_0x15cc('0x97')]('\x5c','\x5c\x5c')[_0x15cc('0x97')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x363539)){_0x415cc4['or'](_0x15cc('0x98'),_0x363539+'%');}else{_0x415cc4['or'](_0x15cc('0x99'),qs[_0x15cc('0x77')](_0x363539))['or'](_0x15cc('0x9a'),_0x363539+'%');}}}_0x476ff3[_0x15cc('0x54')](_0x415cc4);_0x476ff3[_0x15cc('0x9b')](_0x15cc('0x9c'));var _0x2cbf18={'type':db['Sequelize'][_0x15cc('0x9d')]['SELECT'],'raw':!![]};var _0x3b1041=_0x476ff3['clone']();_0x3b1041[_0x15cc('0x57')](_0x15cc('0x9c'));_0x3b1041[_0x15cc('0x57')](_0x15cc('0x9e'),_0x15cc('0x6f'));if(_0x26fe19['order']){_0x26fe19['order'][_0x15cc('0x7f')](function(_0x22bbd2){var _0x45f247=_0x22bbd2[0x0]===_0x15cc('0x9f')?_0x22bbd2[0x0]:'i.'+_0x22bbd2[0x0];_0x476ff3[_0x15cc('0x52')](_0x45f247,_0x22bbd2[0x1]===_0x15cc('0xa0')?![]:!![]);});}if(!_[_0x15cc('0x86')](_0x2e3016)){_0x476ff3[_0x15cc('0x71')](_0x44b18e);_0x3b1041[_0x15cc('0x54')](_0x15cc('0xa1'),_0x2e3016);}BPromise[_0x15cc('0xa2')]()[_0x15cc('0x35')](function(){if(!_0x162997){if(_0x515829[_0x15cc('0x47')][_0x15cc('0x87')])return;_0x3b1041[_0x15cc('0x54')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x476ff3['where'](_0x15cc('0xa3'));return;}if(_0x515829[_0x15cc('0xa4')][_0x15cc('0xa5')]!==_0x15cc('0xa6'))return;return _0x515829['user'][_0x15cc('0xa7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x309f2e){if(_['isEmpty'](_0x309f2e)){_0x3b1041[_0x15cc('0x54')]('i.ChatWebsiteId\x20IS\x20NULL');_0x476ff3[_0x15cc('0x54')](_0x15cc('0xa8'));}else{_0x3b1041[_0x15cc('0x54')](_0x15cc('0x88'),_['map'](_0x309f2e,'id'));_0x476ff3[_0x15cc('0x54')](_0x15cc('0x88'),_[_0x15cc('0x3c')](_0x309f2e,'id'));}});})[_0x15cc('0x35')](function(){if(_0x515829['user']['role']==='agent'&&!_0x162997&&!_0x515829[_0x15cc('0x47')][_0x15cc('0x87')])return[];return db['sequelize'][_0x15cc('0x47')](_0x3b1041[_0x15cc('0xa9')](),_0x2cbf18);})['then'](function(_0x1a0206){_0x4aad83[_0x15cc('0x2e')]=_0x1a0206[_0x15cc('0x4d')];if(_0x4aad83['count']===0x0)return[];return db[_0x15cc('0xaa')][_0x15cc('0x47')](_0x362346['toString'](),_0x2cbf18)['then'](function(_0x21af41){_0x58f95e=_[_0x15cc('0xab')](_0x21af41,'id');_0x2cbf18=_[_0x15cc('0xac')](_0x2cbf18,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x515829[_0x15cc('0x47')][_0x15cc('0x4c')]){_0x26fe19[_0x15cc('0x4a')][_0x15cc('0x7f')](function(_0x4cff1e){_0x476ff3['field']('i.'+_0x4cff1e);});}else{_0x476ff3['field'](_0x15cc('0x9e'),_0x15cc('0x6f'));_0x476ff3['field'](_0x15cc('0xad'),_0x15cc('0xae'));_0x476ff3['field']('a.mandatoryDisposition',_0x15cc('0xaf'));_0x476ff3[_0x15cc('0x57')](_0x15cc('0xb0'),'contactName');_0x476ff3[_0x15cc('0x57')]('i.*');_0x476ff3[_0x15cc('0x57')](_0x15cc('0xb1'),_0x15cc('0xb2'));_0x476ff3[_0x15cc('0x57')](_0x15cc('0xb3'),'Contact.lastName');_0x476ff3[_0x15cc('0x57')](_0x15cc('0xb4'),_0x15cc('0xb5'));_0x476ff3[_0x15cc('0x57')]('c.phone',_0x15cc('0xb6'));_0x476ff3['field'](_0x15cc('0xb7'),_0x15cc('0xb8'));_0x476ff3[_0x15cc('0x57')](_0x15cc('0xb9'),_0x15cc('0xba'));_0x476ff3[_0x15cc('0x57')](_0x15cc('0xbb'),_0x15cc('0xbc'));_0x476ff3[_0x15cc('0x57')](_0x15cc('0xbd'),_0x15cc('0xbe'));_0x476ff3['field'](_0x15cc('0xbf'),'TagIds');}if(_0x26fe19['limit'])_0x476ff3['limit'](_0x26fe19[_0x15cc('0x50')]);if(_0x26fe19[_0x15cc('0x51')])_0x476ff3[_0x15cc('0x51')](_0x26fe19[_0x15cc('0x51')]);return db['sequelize'][_0x15cc('0x47')](_0x476ff3[_0x15cc('0xa9')](),_0x2cbf18);})[_0x15cc('0x35')](function(_0x48ac9d){_0x2e911e['where'](_0x15cc('0xc0'),_[_0x15cc('0x3c')](_0x48ac9d,'id'));return db[_0x15cc('0xaa')][_0x15cc('0x47')](_0x2e911e[_0x15cc('0xa9')](),_0x2cbf18)[_0x15cc('0x35')](function(_0x201144){var _0x33da92=_[_0x15cc('0xc1')](_0x201144,_0x15cc('0xc2'));var _0x4c1cbb=[];_0x48ac9d[_0x15cc('0x7f')](function(_0x129c6f){_0x4c1cbb[_0x15cc('0xc3')](updateChatInteraction(_0x129c6f,_0x58f95e,_0x33da92));});return BPromise[_0x15cc('0xc4')](_0x4c1cbb);});});})[_0x15cc('0x35')](function(_0x488bb1){_0x4aad83[_0x15cc('0xc5')]=_0x488bb1;return _0x4aad83;})['then'](respondWithFilteredResult(_0x53c2f3,_0x26fe19))[_0x15cc('0x2b')](handleError(_0x53c2f3,null));};exports[_0x15cc('0xc6')]=function(_0x40eedf,_0x273e93){var _0x244c39={'raw':![],'where':{'id':_0x40eedf[_0x15cc('0xc7')]['id']}},_0x1e0c3e={};_0x1e0c3e[_0x15cc('0x46')]=_[_0x15cc('0x48')](db[_0x15cc('0x42')][_0x15cc('0x43')]);_0x1e0c3e[_0x15cc('0x47')]=_[_0x15cc('0x48')](_0x40eedf[_0x15cc('0x47')]);_0x1e0c3e[_0x15cc('0x49')]=_[_0x15cc('0x4b')](_0x1e0c3e[_0x15cc('0x46')],_0x1e0c3e[_0x15cc('0x47')]);_0x244c39['attributes']=_[_0x15cc('0x4b')](_0x1e0c3e[_0x15cc('0x46')],qs['fields'](_0x40eedf[_0x15cc('0x47')][_0x15cc('0x4c')]));_0x244c39[_0x15cc('0x4a')]=_0x244c39[_0x15cc('0x4a')]['length']?_0x244c39[_0x15cc('0x4a')]:_0x1e0c3e[_0x15cc('0x46')];if(_0x40eedf[_0x15cc('0x47')][_0x15cc('0xc8')]){_0x244c39[_0x15cc('0xc9')]=[{'all':!![]}];}_0x244c39=_['merge']({},_0x244c39,_0x40eedf['options']);return db[_0x15cc('0x42')][_0x15cc('0x6e')](_0x244c39)[_0x15cc('0x35')](handleEntityNotFound(_0x273e93,null))['then'](respondWithResult(_0x273e93,null))[_0x15cc('0x2b')](handleError(_0x273e93,null));};exports[_0x15cc('0xca')]=function(_0x3bb012,_0x19abe3){return db[_0x15cc('0x42')][_0x15cc('0xca')](_0x3bb012[_0x15cc('0xcb')],{})['then'](respondWithResult(_0x19abe3,0xc9))[_0x15cc('0x2b')](handleError(_0x19abe3,null));};exports[_0x15cc('0x34')]=function(_0x190318,_0x19281c){if(_0x190318['body']['id']){delete _0x190318['body']['id'];}return db[_0x15cc('0x42')][_0x15cc('0x6e')]({'where':{'id':_0x190318[_0x15cc('0xc7')]['id']}})['then'](handleEntityNotFound(_0x19281c,null))[_0x15cc('0x35')](saveUpdates(_0x190318[_0x15cc('0xcb')],null))['then'](respondWithResult(_0x19281c,null))['catch'](handleError(_0x19281c,null));};exports['destroy']=function(_0x4cee4b,_0x3b0d65){return db['ChatInteraction'][_0x15cc('0x6e')]({'where':{'id':_0x4cee4b[_0x15cc('0xc7')]['id']}})['then'](handleEntityNotFound(_0x3b0d65,null))['then'](removeEntity(_0x3b0d65,null))[_0x15cc('0x2b')](handleError(_0x3b0d65,null));};exports[_0x15cc('0xcc')]=function(_0xe255ce,_0x49f73e){return db[_0x15cc('0x42')]['describe']()[_0x15cc('0x35')](respondWithResult(_0x49f73e,null))['catch'](handleError(_0x49f73e,null));};exports[_0x15cc('0xcd')]=function(_0xfe1f0a,_0xba51f7){var _0x134360=_0xfe1f0a[_0x15cc('0xc7')]['id'];var _0x3fa979;var _0x252dc0;var _0x4fb915;return db['ChatInteraction'][_0x15cc('0xce')]({'where':{'id':_0x134360}})[_0x15cc('0x35')](function(_0x3d973c){_0x3fa979=_0x3d973c;return db[_0x15cc('0xcf')][_0x15cc('0xce')]({'where':{'id':_0x3d973c[_0x15cc('0x87')]},'attributes':['id',_0x15cc('0xd0'),_0x15cc('0xd1')],'raw':!![]});})['then'](function(_0x38c2c5){if(_0x38c2c5&&_0x38c2c5[_0x15cc('0xd0')]&&_0x38c2c5[_0x15cc('0xd1')]){_0x252dc0=_0x38c2c5;var _0x5c82f6={'rejectUnauthorized':![],'method':_0x15cc('0xd2'),'uri':_0x15cc('0xd3'),'headers':{'X-APIKEY':_0x38c2c5[_0x15cc('0xd0')]},'body':{'name':_0x15cc('0xd4')+_0x134360},'redirect':_0x15cc('0xd5'),'json':!![]};return rp(_0x5c82f6);}else{throw new db[(_0x15cc('0xd6'))][(_0x15cc('0xd7'))](_0x15cc('0xd8'));}})['then'](function(_0x4f0517){_0x4fb915=_0x4f0517;if(_0x4fb915['id']){var _0x47b2f8={'body':_0x4fb915[_0x15cc('0xd9')],'ChatWebsiteId':_0x252dc0['id'],'ChatInteractionId':_0x3fa979['id'],'direction':_0x15cc('0xda'),'UserId':_0xfe1f0a[_0x15cc('0xa4')]['id']};return db[_0x15cc('0xdb')][_0x15cc('0xca')](_0x47b2f8,{});}else{throw new db[(_0x15cc('0xd6'))]['ValidationError'](_0x15cc('0xdc'));}})[_0x15cc('0x35')](function(){return _0x3fa979[_0x15cc('0xdd')]({'vidaooSessionId':_0x4fb915['id']});})['then'](respondWithResult(_0xba51f7,null))[_0x15cc('0x2b')](handleError(_0xba51f7,null));};exports[_0x15cc('0xde')]=function(_0x379cab,_0xf30e95){if(_0x379cab[_0x15cc('0xcb')]['id']){delete _0x379cab[_0x15cc('0xcb')]['id'];}return db['ChatInteraction'][_0x15cc('0x6e')]({'where':{'id':_0x379cab[_0x15cc('0xc7')]['id']},'include':[{'model':db[_0x15cc('0xdf')],'as':_0x15cc('0x73')}]})[_0x15cc('0x35')](handleEntityNotFound(_0xf30e95,null))[_0x15cc('0x35')](saveUpdates(_0x379cab[_0x15cc('0xcb')],null))[_0x15cc('0x35')](respondWithResult(_0xf30e95,null))[_0x15cc('0x2b')](handleError(_0xf30e95,null));};exports[_0x15cc('0xe0')]=function(_0x17dd54,_0x5018aa,_0x3f18a7){if(_0x17dd54[_0x15cc('0xcb')]['id']){delete _0x17dd54[_0x15cc('0xcb')]['id'];}return db['ChatInteraction'][_0x15cc('0x6e')]({'where':{'id':_0x17dd54[_0x15cc('0xc7')]['id']}})['then'](function(_0x389874){if(!_0x389874){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x15cc('0xe0'),0x194,_0x15cc('0xe1'));_0x5018aa[_0x15cc('0x37')](0x194);}else{if(_0x389874[_0x15cc('0x83')]){throw new db['Sequelize'][(_0x15cc('0xd7'))]('Interaction\x20already\x20assigned');}}return _0x389874;})[_0x15cc('0x35')](function(_0x2cb599){if(_0x2cb599){return _0x2cb599['update']({'closed':_0x17dd54[_0x15cc('0xcb')][_0x15cc('0xe2')],'disposition':_0x17dd54[_0x15cc('0xcb')][_0x15cc('0xe3')]})['then'](function(_0x9bd614){return _0x9bd614;});}})['then'](function(_0x1da5b5){return respondWithRpcPromise(_0x15cc('0xe4'),_0x15cc('0xe0'),_0x17dd54['body'],client9004);})[_0x15cc('0x35')](respondWithResult(_0x5018aa,null))[_0x15cc('0x2b')](handleError(_0x5018aa,null));};exports['attachmentUpload']=function(_0xae1745,_0x4a7a03,_0xeecddc){_0xae1745[_0x15cc('0xcb')][_0x15cc('0x39')]=_0xae1745[_0x15cc('0xe5')][_0x15cc('0xe6')];_0xae1745['body'][_0x15cc('0xe7')]=_0xae1745[_0x15cc('0xe5')]['filename'];_0xae1745[_0x15cc('0xcb')][_0x15cc('0x7b')]=_0xae1745[_0x15cc('0xe5')]['mimetype'];return db[_0x15cc('0xe8')][_0x15cc('0xca')](_0xae1745['body'])[_0x15cc('0x35')](respondWithResult(_0x4a7a03,0xc9))[_0x15cc('0x2b')](handleError(_0x4a7a03,null));};exports[_0x15cc('0xe9')]=function(_0x4cfdcc,_0x3c0581,_0x3e0420){return db['ChatInteraction'][_0x15cc('0xce')]({'where':{'id':_0x4cfdcc[_0x15cc('0xc7')]['id']},'raw':!![]})[_0x15cc('0x35')](handleEntityNotFound(_0x3c0581,null))['then'](function(_0x2a6302){if(_0x2a6302){if(_0x2a6302['closed']){return _0x3c0581[_0x15cc('0x2d')](0x193)[_0x15cc('0x31')]({'status':0x193,'message':'Unauthorized'});}return db[_0x15cc('0xe8')][_0x15cc('0xce')]({'where':{'id':_0x4cfdcc[_0x15cc('0x47')][_0x15cc('0xea')]},'raw':!![]})[_0x15cc('0x35')](handleEntityNotFound(_0x3c0581,null));}})['then'](function(_0x2a06d9){if(_0x2a06d9){var _0x3ed841=_0x2a06d9[_0x15cc('0xeb')]!==null;var _0x1188fe=path[_0x15cc('0xec')](config[_0x15cc('0xed')],'server/files/attachments/');if(_0x3ed841){_0x1188fe=path['join'](_0x1188fe,_0x15cc('0xee'));}var _0x1e6c34=path[_0x15cc('0xec')](_0x1188fe,_0x2a06d9[_0x15cc('0xe7')]);return _0x3c0581[_0x15cc('0xef')](_0x1e6c34);}})[_0x15cc('0x2b')](handleError(_0x3c0581,null));};exports[_0x15cc('0xf0')]=function(_0x4437e1,_0xf793e4){var _0x3fa331=null;var _0x551dcb=null;var _0x2ddf3f=null;var _0x4a91dc=null;if(_0x4437e1[_0x15cc('0xcb')]['id']){delete _0x4437e1[_0x15cc('0xcb')]['id'];}if(_0x4437e1[_0x15cc('0xcb')][_0x15cc('0xf1')]){_0x4a91dc=path[_0x15cc('0xec')](config[_0x15cc('0xed')],_0x15cc('0xf2'),util[_0x15cc('0xf3')](_0x15cc('0xf4'),Date['now']()));_0x4437e1[_0x15cc('0xcb')][_0x15cc('0xf5')]=_0x4a91dc;}return db['ChatInteraction'][_0x15cc('0x6e')]({'where':{'id':_0x4437e1[_0x15cc('0xc7')]['id']},'include':[{'model':db[_0x15cc('0xdb')],'as':_0x15cc('0xf6'),'include':[{'model':db['User'],'as':_0x15cc('0x81')}]}]})[_0x15cc('0x35')](handleEntityNotFound(_0xf793e4,null))[_0x15cc('0x35')](saveUpdates(_0x4437e1[_0x15cc('0xcb')],null))[_0x15cc('0x35')](function(_0xf99bbb){if(_0xf99bbb){_0x3fa331=_0xf99bbb;return db[_0x15cc('0xcf')][_0x15cc('0x6e')]({'where':{'id':_0x3fa331[_0x15cc('0x87')]}});}})[_0x15cc('0x35')](function(_0x2f417a){if(_0x2f417a){_0x2ddf3f=_0x2f417a;return db[_0x15cc('0xdf')]['find']({'where':{'id':_0x3fa331['ContactId']}});}})[_0x15cc('0x35')](function(_0x550d63){if(_0x550d63){_0x551dcb=_0x550d63;if(_0x4a91dc){var _0x29dc0e=null;for(var _0x175b87=0x1;_0x175b87<_0x3fa331[_0x15cc('0xf6')]['length'];++_0x175b87){_0x29dc0e=_0x3fa331[_0x15cc('0xf6')][_0x175b87];var _0x4dc110=_0x29dc0e['UserId']?util['format'](_0x15cc('0xf7'),_0x2ddf3f[_0x15cc('0xf8')],_0x29dc0e[_0x15cc('0x83')]):_0x15cc('0xf9');var _0x1ead7b=_0x4437e1[_0x15cc('0xcb')][_0x15cc('0xfa')]||util['format']('%s%d',_0x15cc('0xfb'),_0x29dc0e[_0x15cc('0x79')]);switch(_0x2ddf3f[_0x15cc('0xfc')]){case'website_alias':_0x4dc110=_0x29dc0e[_0x15cc('0x83')]?util[_0x15cc('0xf3')](_0x15cc('0xf7'),_0x2ddf3f[_0x15cc('0xf8')],_0x29dc0e[_0x15cc('0x83')]):_0x15cc('0xf9');break;case _0x15cc('0xfd'):_0x4dc110=_0x29dc0e['UserId']?_0x29dc0e[_0x15cc('0x81')][_0x15cc('0xfe')]||_0x29dc0e[_0x15cc('0x81')][_0x15cc('0x3d')]:_0x15cc('0xf9');break;case _0x15cc('0xff'):_0x4dc110=_0x29dc0e[_0x15cc('0x83')]?_0x29dc0e[_0x15cc('0x81')][_0x15cc('0x3d')]:_0x15cc('0xf9');break;default:_0x4dc110=_0x29dc0e['UserId']?util[_0x15cc('0xf3')](_0x15cc('0xf7'),_0x2ddf3f[_0x15cc('0xf8')],_0x29dc0e[_0x15cc('0x83')]):_0x15cc('0xf9');}var _0x1745ee=util[_0x15cc('0xf3')](_0x15cc('0x100'),moment(_0x29dc0e[_0x15cc('0x89')])[_0x15cc('0xf3')](_0x15cc('0x101')),_0x29dc0e['direction']==='in'?_0x1ead7b:_0x4dc110,_0x29dc0e[_0x15cc('0xcb')]);if(!_0x29dc0e[_0x15cc('0x102')]){fs[_0x15cc('0x103')](_0x4a91dc,_0x1745ee);}}return db['MailAccount'][_0x15cc('0xce')]({'where':{'service':!![]},'include':[{'model':db[_0x15cc('0x104')],'as':_0x15cc('0x105'),'raw':!![]}]});}}})[_0x15cc('0x35')](function(_0x3e5af0){if(_0x3e5af0&&_0x3e5af0[_0x15cc('0x105')]&&_0x4437e1['body']){var _0x34db5a={'tls':{'rejectUnauthorized':![]}};if(_0x3e5af0[_0x15cc('0x105')]['service']){_0x34db5a[_0x15cc('0x106')]=_0x3e5af0[_0x15cc('0x105')][_0x15cc('0x106')];}else{_0x34db5a[_0x15cc('0x107')]=_0x3e5af0[_0x15cc('0x105')]['host'];_0x34db5a[_0x15cc('0x108')]=_0x3e5af0['Smtp'][_0x15cc('0x108')];_0x34db5a[_0x15cc('0x109')]=_0x3e5af0['Smtp']['secure'];}if(_0x3e5af0[_0x15cc('0x105')]['authentication']){_0x34db5a[_0x15cc('0x10a')]={'user':_0x3e5af0[_0x15cc('0x105')][_0x15cc('0xa4')],'pass':_0x3e5af0[_0x15cc('0x105')][_0x15cc('0x10b')]};}return respondWithRpcPromise(_0x15cc('0x10c'),_0x15cc('0x10d'),{'account':_0x34db5a,'message':{'from':util[_0x15cc('0xf3')](_0x15cc('0x10e'),_0x3e5af0[_0x15cc('0x39')],_0x3e5af0[_0x15cc('0x10f')]||_0x3e5af0[_0x15cc('0x105')][_0x15cc('0xa4')]),'to':_0x4437e1[_0x15cc('0xcb')][_0x15cc('0xf1')],'subject':_0x15cc('0x110'),'text':util[_0x15cc('0xf3')](_0x15cc('0x111'),_0x4437e1['body'][_0x15cc('0xf1')]),'attachments':[{'path':_0x4a91dc}]}})[_0x15cc('0x35')](function(){return _0x3fa331;})[_0x15cc('0x2b')](function(_0x4b788c){console['error'](_0x4b788c);});}else{return _0x3fa331;}})[_0x15cc('0x35')](respondWithStatusCode(_0xf793e4,0xc8))[_0x15cc('0x2b')](handleError(_0xf793e4,null));};exports[_0x15cc('0x112')]=function(_0x146967,_0x30c961,_0x4dbe99){return db[_0x15cc('0xdb')][_0x15cc('0x6e')]({'where':{'id':_0x146967[_0x15cc('0xc7')]['id']}})['then'](handleEntityNotFound(_0x30c961,null))[_0x15cc('0x35')](function(_0x934537){if(_0x934537){return _0x934537[_0x15cc('0x112')](_0x146967[_0x15cc('0xcb')][_0x15cc('0x113')],_[_0x15cc('0x114')](_0x146967['body'],[_0x15cc('0x113'),'id'])||{});}})['then'](respondWithResult(_0x30c961,null))[_0x15cc('0x2b')](handleError(_0x30c961,null));};exports[_0x15cc('0x115')]=function(_0x261a6c,_0x26ab78,_0x4760e7){var _0x528459={'raw':![],'where':{}};var _0x150cf9={};var _0x5b7b9e={'count':0x0,'rows':[]};return db[_0x15cc('0x42')][_0x15cc('0xce')]({'where':{'id':_0x261a6c[_0x15cc('0xc7')]['id']}})['then'](handleEntityNotFound(_0x26ab78,null))[_0x15cc('0x35')](function(_0x11028f){if(_0x11028f){_0x150cf9[_0x15cc('0x46')]=_[_0x15cc('0x48')](db['ChatMessage'][_0x15cc('0x43')]);_0x150cf9[_0x15cc('0x47')]=_['keys'](_0x261a6c['query']);_0x150cf9[_0x15cc('0x49')]=_[_0x15cc('0x4b')](_0x150cf9[_0x15cc('0x46')],_0x150cf9[_0x15cc('0x47')]);_0x528459[_0x15cc('0x4a')]=_['intersection'](_0x150cf9['model'],qs[_0x15cc('0x4c')](_0x261a6c['query'][_0x15cc('0x4c')]));_0x528459['attributes']=_0x528459[_0x15cc('0x4a')][_0x15cc('0x4d')]?_0x528459['attributes']:_0x150cf9[_0x15cc('0x46')];if(!_0x261a6c[_0x15cc('0x47')]['hasOwnProperty'](_0x15cc('0x4f'))){_0x528459[_0x15cc('0x50')]=qs[_0x15cc('0x50')](_0x261a6c[_0x15cc('0x47')][_0x15cc('0x50')]);_0x528459[_0x15cc('0x51')]=qs[_0x15cc('0x51')](_0x261a6c[_0x15cc('0x47')][_0x15cc('0x51')]);}_0x528459['order']=qs[_0x15cc('0x53')](_0x261a6c['query']['sort']);_0x528459['where']=qs[_0x15cc('0x49')](_[_0x15cc('0x55')](_0x261a6c['query'],_0x150cf9[_0x15cc('0x49')]));_0x528459['where'][_0x15cc('0xc2')]=_0x11028f['id'];if(_0x261a6c[_0x15cc('0x47')][_0x15cc('0x96')]){_0x528459[_0x15cc('0x54')]=_[_0x15cc('0xac')](_0x528459['where'],{'$or':_[_0x15cc('0x3c')](_0x528459[_0x15cc('0x4a')],function(_0x45bdd7){var _0x172936={};_0x172936[_0x45bdd7]={'$like':'%'+_0x261a6c[_0x15cc('0x47')]['filter']+'%'};return _0x172936;})});}if(_0x261a6c[_0x15cc('0x47')][_0x15cc('0x8b')]){var _0xcefcc2=_0x261a6c[_0x15cc('0x47')]['$gte'][_0x15cc('0x40')](',');var _0x494d82={};_0x494d82[_0xcefcc2[0x0]]={'$gte':moment(_0xcefcc2[0x1])[_0x15cc('0xf3')](_0x15cc('0x116'))};_0x528459[_0x15cc('0x54')]=_[_0x15cc('0xac')](_0x528459[_0x15cc('0x54')],_0x494d82);}_0x528459=_[_0x15cc('0xac')]({},_0x528459,_0x261a6c[_0x15cc('0x117')]);return db[_0x15cc('0xdb')][_0x15cc('0x2e')]({'where':_0x528459[_0x15cc('0x54')]})[_0x15cc('0x35')](function(_0xa61511){_0x5b7b9e['count']=_0xa61511;if(_0x261a6c[_0x15cc('0x47')][_0x15cc('0xc8')]){_0x528459[_0x15cc('0xc9')]=[{'all':!![]}];}return db[_0x15cc('0xdb')][_0x15cc('0x118')](_0x528459);})[_0x15cc('0x35')](function(_0x54517d){_0x5b7b9e[_0x15cc('0xc5')]=_0x54517d;return _0x5b7b9e;});}})[_0x15cc('0x35')](respondWithFilteredResult(_0x26ab78,_0x528459))[_0x15cc('0x2b')](handleError(_0x26ab78,null));};exports[_0x15cc('0x119')]=function(_0x3e793e,_0x2795f9,_0x4d1ebf){var _0x4d887d={'where':{}},_0x461e95={},_0x21b15e={'count':0x0,'rows':[]};return db[_0x15cc('0x42')]['findOne']({'where':{'id':_0x3e793e[_0x15cc('0xc7')]['id']}})[_0x15cc('0x35')](handleEntityNotFound(_0x2795f9,null))[_0x15cc('0x35')](function(_0x521e28){if(_0x521e28){_0x461e95[_0x15cc('0x46')]=_['keys'](db[_0x15cc('0xdb')]['rawAttributes']);_0x461e95[_0x15cc('0x47')]=_[_0x15cc('0x48')](_0x3e793e[_0x15cc('0x47')]);_0x461e95[_0x15cc('0x49')]=_[_0x15cc('0x4b')](_0x461e95['model'],_0x461e95[_0x15cc('0x47')]);_0x4d887d[_0x15cc('0x4a')]=_[_0x15cc('0x4b')](_0x461e95[_0x15cc('0x46')],qs['fields'](_0x3e793e[_0x15cc('0x47')][_0x15cc('0x4c')]));_0x4d887d['attributes']=_0x4d887d[_0x15cc('0x4a')][_0x15cc('0x4d')]?_0x4d887d[_0x15cc('0x4a')]:_0x461e95[_0x15cc('0x46')];if(!_0x3e793e[_0x15cc('0x47')][_0x15cc('0x4e')](_0x15cc('0x4f'))){_0x4d887d[_0x15cc('0x50')]=qs[_0x15cc('0x50')](_0x3e793e['query'][_0x15cc('0x50')]);_0x4d887d[_0x15cc('0x51')]=qs[_0x15cc('0x51')](_0x3e793e[_0x15cc('0x47')]['offset']);}_0x4d887d[_0x15cc('0x52')]=qs[_0x15cc('0x53')](_0x3e793e[_0x15cc('0x47')][_0x15cc('0x53')]);_0x4d887d[_0x15cc('0x54')]=qs['filters'](_[_0x15cc('0x55')](_0x3e793e[_0x15cc('0x47')],_0x461e95[_0x15cc('0x49')]));_0x4d887d['where'][_0x15cc('0xc2')]=_0x521e28['id'];if(_0x3e793e[_0x15cc('0x47')]['filter']){_0x4d887d['where']=_[_0x15cc('0xac')](_0x4d887d[_0x15cc('0x54')],{'$or':_[_0x15cc('0x3c')](_0x4d887d['attributes'],function(_0x2c438f){var _0x135c4a={};_0x135c4a[_0x2c438f]={'$like':'%'+_0x3e793e[_0x15cc('0x47')][_0x15cc('0x96')]+'%'};return _0x135c4a;})});}_0x4d887d[_0x15cc('0x54')][_0x15cc('0x102')]=![];if(_0x3e793e[_0x15cc('0x47')]['id']){_0x4d887d[_0x15cc('0x54')]['id']={'$gt':_0x3e793e[_0x15cc('0x47')]['id']};}_0x4d887d=_[_0x15cc('0xac')]({},_0x4d887d,_0x3e793e[_0x15cc('0x117')]);return db[_0x15cc('0xdb')]['count']({'where':_0x4d887d[_0x15cc('0x54')]})[_0x15cc('0x35')](function(_0x507c8d){_0x21b15e[_0x15cc('0x2e')]=_0x507c8d;_0x4d887d['include']=[];if(_0x3e793e[_0x15cc('0x47')]['includeAgent']){_0x4d887d[_0x15cc('0xc9')][_0x15cc('0xc3')]({'model':db[_0x15cc('0x81')],'as':_0x15cc('0x81'),'attributes':['id',_0x15cc('0x3d'),_0x15cc('0xfe')]});}if(_0x3e793e[_0x15cc('0x47')][_0x15cc('0xc8')]){_0x4d887d['include']=[{'all':!![]}];}return db['ChatMessage'][_0x15cc('0x118')](_0x4d887d);})[_0x15cc('0x35')](function(_0x10d8b7){_0x21b15e[_0x15cc('0xc5')]=_0x10d8b7;return _0x21b15e;});}})[_0x15cc('0x35')](respondWithFilteredResult(_0x2795f9,_0x4d887d))[_0x15cc('0x2b')](handleError(_0x2795f9,null));};exports[_0x15cc('0x11a')]=function(_0xa92a0b,_0x3f37a1,_0x427a82){return db[_0x15cc('0x42')][_0x15cc('0x6e')]({'where':{'id':_0xa92a0b[_0x15cc('0xc7')]['id']}})['then'](handleEntityNotFound(_0x3f37a1,null))['then'](function(_0x3daeaa){if(_0x3daeaa){return _0x3daeaa[_0x15cc('0x11b')](_0xa92a0b['body'][_0x15cc('0x113')],_[_0x15cc('0x114')](_0xa92a0b[_0x15cc('0xcb')],['ids','id'])||{})[_0x15cc('0x11c')](function(){return db[_0x15cc('0x7e')][_0x15cc('0x118')]({'attributes':['id','name',_0x15cc('0x58')],'where':{'id':_0xa92a0b['body']['ids']}});})[_0x15cc('0x35')](function(_0x139013){socket[_0x15cc('0x11d')](_0x15cc('0x11e'),{'id':Number(_0xa92a0b[_0x15cc('0xc7')]['id']),'tags':_0x139013||[]});return{'id':Number(_0xa92a0b['params']['id']),'tags':_0x139013||[]};});}})['then'](respondWithResult(_0x3f37a1,null))[_0x15cc('0x2b')](handleError(_0x3f37a1,null));};exports[_0x15cc('0x11f')]=function(_0x2d0f34,_0x4b1e76,_0x265713){return db[_0x15cc('0x42')][_0x15cc('0x6e')]({'where':{'id':_0x2d0f34['params']['id']}})[_0x15cc('0x35')](handleEntityNotFound(_0x4b1e76,null))[_0x15cc('0x35')](function(_0x589160){if(_0x589160){return _0x589160[_0x15cc('0x11f')](_0x2d0f34[_0x15cc('0x47')][_0x15cc('0x113')]);}})[_0x15cc('0x35')](respondWithStatusCode(_0x4b1e76,null))[_0x15cc('0x2b')](handleError(_0x4b1e76,null));};exports[_0x15cc('0xef')]=function(_0x2ef957,_0x12a0d1){var _0x5b948d=moment()[_0x15cc('0x120')]()[_0x15cc('0xa9')]();var _0x4d4128=path[_0x15cc('0xec')](config[_0x15cc('0xed')],_0x15cc('0x121'),_0x15cc('0x122'),_0x15cc('0x123'));var _0x2e92ea=path[_0x15cc('0xec')](config[_0x15cc('0xed')],_0x15cc('0x121'),_0x15cc('0x122'),_0x15cc('0x124'));var _0x526ead=path['join'](_0x4d4128,_0x5b948d);var _0x2f5b9a=util[_0x15cc('0xf3')]('transcript-%d-%s.zip',_0x2ef957[_0x15cc('0xc7')]['id'],_0x5b948d);var _0x56246e=path[_0x15cc('0xec')](_0x4d4128,_0x2f5b9a);var _0x519c98=[];_0x519c98[_0x15cc('0xc3')]({'model':db[_0x15cc('0x81')],'as':_0x15cc('0x81'),'attributes':['id',_0x15cc('0x3d')],'raw':!![]});_0x519c98[_0x15cc('0xc3')]({'model':db[_0x15cc('0xdf')],'as':_0x15cc('0x73'),'attributes':['id',_0x15cc('0x125'),'lastName'],'raw':!![]});if(_0x2ef957[_0x15cc('0x47')][_0x15cc('0x124')]){_0x519c98[_0x15cc('0xc3')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x50e346=[{'model':db['ChatMessage'],'as':_0x15cc('0xf6'),'attributes':['id','body',_0x15cc('0x89'),_0x15cc('0x126'),_0x15cc('0x102'),_0x15cc('0x91')],'include':_0x519c98}];_0x50e346[_0x15cc('0xc3')]({'model':db[_0x15cc('0xcf')],'as':_0x15cc('0x127'),'attributes':['id',_0x15cc('0x39')]});_0x50e346['push']({'model':db[_0x15cc('0x81')],'as':_0x15cc('0x128'),'attributes':['id',_0x15cc('0x3d')]});return db[_0x15cc('0x42')][_0x15cc('0x6e')]({'where':{'id':_0x2ef957[_0x15cc('0xc7')]['id']},'include':_0x50e346})[_0x15cc('0x35')](handleEntityNotFound(_0x12a0d1,null))[_0x15cc('0x35')](function(_0x4b2980){if(_0x4b2980){var _0x1aa0e4=_0x4b2980[_0x15cc('0x129')]({'plain':!![]});fs['mkdirSync'](_0x526ead);var _0x42669d={'channel':'Chat','account':_0x1aa0e4[_0x15cc('0x127')][_0x15cc('0x39')],'agent':_0x1aa0e4[_0x15cc('0x128')]?_0x1aa0e4[_0x15cc('0x128')]['fullname']:_0x15cc('0x12a'),'createdAt':moment(_0x1aa0e4[_0x15cc('0x89')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x1aa0e4[_0x15cc('0xe2')]?moment(_0x1aa0e4[_0x15cc('0x12b')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x1aa0e4[_0x15cc('0xe3')],'chatInfo':{'browser':_0x1aa0e4[_0x15cc('0x12c')],'os':_0x1aa0e4[_0x15cc('0x12d')],'referer':_0x1aa0e4[_0x15cc('0x12e')],'customerIp':_0x1aa0e4['customerIp'],'customerPort':_0x1aa0e4[_0x15cc('0x12f')]?_0x1aa0e4['customerPort']:_0x15cc('0x12a')},'messages':_(_0x1aa0e4['Messages'])[_0x15cc('0x130')]()['filter']({'secret':![]})[_0x15cc('0x3c')](function(_0x31a0d3){if(_0x31a0d3[_0x15cc('0xe8')]){var _0x32ae91=path['join'](_0x2e92ea,_0x31a0d3['Attachment']['basename']);if(fs[_0x15cc('0x131')](_0x32ae91)){fs[_0x15cc('0x132')](_0x32ae91)[_0x15cc('0x133')](fs[_0x15cc('0x134')](path['join'](_0x526ead,_0x31a0d3[_0x15cc('0xe8')][_0x15cc('0xe7')])));}}return{'date':moment(_0x31a0d3['createdAt'])[_0x15cc('0xf3')](_0x15cc('0x116'))['toString'](),'sender':_0x31a0d3['direction']===_0x15cc('0xda')?_0x31a0d3['User']?_0x31a0d3[_0x15cc('0x81')]['fullname']:_0x15cc('0xf9'):_0x31a0d3[_0x15cc('0x73')]['firstName']+(_0x31a0d3[_0x15cc('0x73')][_0x15cc('0x135')]?'\x20'+_0x31a0d3[_0x15cc('0x73')][_0x15cc('0x135')]:''),'body':_0x31a0d3[_0x15cc('0xe8')]?_0x31a0d3['Attachment']['basename']:_0x31a0d3['body'],'direction':_0x31a0d3[_0x15cc('0x126')]===_0x15cc('0xda')?'A':'C','secret':_0x31a0d3[_0x15cc('0x102')],'read':_0x31a0d3[_0x15cc('0x91')],'attachment':_0x31a0d3[_0x15cc('0xe8')]};})[_0x15cc('0x70')]()};return ejs['renderFile'](path[_0x15cc('0xec')](config[_0x15cc('0xed')],_0x15cc('0x121'),_0x15cc('0x136'),_0x15cc('0x137')),{'interaction':_0x42669d})[_0x15cc('0x35')](function(_0xfa11a0){var _0x41796f=path[_0x15cc('0xec')](_0x526ead,_0x15cc('0x138')+_0x1aa0e4['id']+'-'+_0x5b948d+'.pdf');var _0x197eff={'path':_0x41796f,'channel':_0x15cc('0x139'),'interactionId':_0x1aa0e4['id']};return pdf[_0x15cc('0x13a')](_0xfa11a0,_0x197eff);})[_0x15cc('0x35')](function(){return new BPromise(function(_0x126247,_0x9d2cf7){zipdir(_0x526ead,{'saveTo':_0x56246e},function(_0xcbe1b9,_0x3a3efd){if(_0xcbe1b9)return _0x9d2cf7(_0xcbe1b9);return _0x126247(_0x3a3efd);});})[_0x15cc('0x35')](function(){return new BPromise(function(_0x3fe961,_0x1aa699){rimraf(_0x526ead,function(_0x1aceb9){if(_0x1aceb9)_0x1aa699(_0x1aceb9);return _0x3fe961();});});})['then'](function(){return _0x12a0d1[_0x15cc('0xef')](_0x56246e,_0x2f5b9a,function(_0x53c367){if(_0x53c367){console['log'](_0x15cc('0x13b'),_0x53c367);}else{fs['unlinkSync'](_0x56246e);}});});});}else{return _0x12a0d1[_0x15cc('0x37')](0xc8);}})[_0x15cc('0x2b')](handleError(_0x12a0d1,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 116b563..ee12c9c 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 _0x2854=['remove','then','setDataValue','map','unreadMessages','length','emit','catch','hook','exports','events','ChatInteraction','ChatMessage','setMaxListeners','save','update'];(function(_0x30eb76,_0xd96c8){var _0x348568=function(_0x24599f){while(--_0x24599f){_0x30eb76['push'](_0x30eb76['shift']());}};_0x348568(++_0xd96c8);}(_0x2854,0xaa));var _0x4285=function(_0x5374f6,_0x5e963b){_0x5374f6=_0x5374f6-0x0;var _0x5dbdc6=_0x2854[_0x5374f6];return _0x5dbdc6;};'use strict';var EventEmitter=require(_0x4285('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x4285('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0x4285('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x4285('0x3')](0x0);var events={'afterCreate':_0x4285('0x4'),'afterUpdate':_0x4285('0x5'),'afterDestroy':_0x4285('0x6')};function emitEvent(_0x22b4a1){return function(_0x140897,_0x5bdca0,_0x4be056){_0x140897['getUsers']({'attributes':['id'],'raw':!![]})[_0x4285('0x7')](function(_0x317416){_0x140897[_0x4285('0x8')]('Users',_0x317416[_0x4285('0x9')](function(_0xa41538){return{'id':_0xa41538['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x140897['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4285('0x7')](function(_0x440880){_0x140897[_0x4285('0x8')](_0x4285('0xa'),_0x440880[_0x4285('0xb')]);ChatInteractionEvents[_0x4285('0xc')](_0x22b4a1+':'+_0x140897['id'],_0x140897);ChatInteractionEvents[_0x4285('0xc')](_0x22b4a1,_0x140897);_0x4be056(null);})[_0x4285('0xd')](_0x4be056(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x4285('0xe')](e,emitEvent(event));}}module[_0x4285('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0xd237=['remove','then','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','setMaxListeners','update'];(function(_0x2e8418,_0x58c529){var _0x548fe6=function(_0x2b2877){while(--_0x2b2877){_0x2e8418['push'](_0x2e8418['shift']());}};_0x548fe6(++_0x58c529);}(_0xd237,0x12b));var _0x7d23=function(_0x316fd2,_0x23f025){_0x316fd2=_0x316fd2-0x0;var _0x6b8f86=_0xd237[_0x316fd2];return _0x6b8f86;};'use strict';var EventEmitter=require(_0x7d23('0x0'));var ChatInteraction=require(_0x7d23('0x1'))['db'][_0x7d23('0x2')];var ChatMessage=require(_0x7d23('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x7d23('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7d23('0x4'),'afterDestroy':_0x7d23('0x5')};function emitEvent(_0x2bc609){return function(_0x39ec94,_0x1975bb,_0x5f2a3e){_0x39ec94['getUsers']({'attributes':['id'],'raw':!![]})[_0x7d23('0x6')](function(_0x219ca4){_0x39ec94['setDataValue'](_0x7d23('0x7'),_0x219ca4[_0x7d23('0x8')](function(_0x1cf1a2){return{'id':_0x1cf1a2['id']};}));return ChatMessage[_0x7d23('0x9')]({'where':{'ChatInteractionId':_0x39ec94['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7d23('0x6')](function(_0x1d6f29){_0x39ec94['setDataValue'](_0x7d23('0xa'),_0x1d6f29[_0x7d23('0xb')]);ChatInteractionEvents[_0x7d23('0xc')](_0x2bc609+':'+_0x39ec94['id'],_0x39ec94);ChatInteractionEvents[_0x7d23('0xc')](_0x2bc609,_0x39ec94);_0x5f2a3e(null);})['catch'](_0x5f2a3e(null));};}for(var e in events){if(events[_0x7d23('0xd')](e)){var event=events[e];ChatInteraction[_0x7d23('0xe')](e,emitEvent(event));}}module[_0x7d23('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 4f18aa0..d1ede0e 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 _0xb46e=['bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','util','../../config/logger','api'];(function(_0x15fa77,_0x93eaff){var _0x1385ff=function(_0x165e02){while(--_0x165e02){_0x15fa77['push'](_0x15fa77['shift']());}};_0x1385ff(++_0x93eaff);}(_0xb46e,0x1bd));var _0xeb46=function(_0x110f07,_0x523a8d){_0x110f07=_0x110f07-0x0;var _0x390dec=_0xb46e[_0x110f07];return _0x390dec;};'use strict';var _=require('lodash');var util=require(_0xeb46('0x0'));var logger=require(_0xeb46('0x1'))(_0xeb46('0x2'));var moment=require('moment');var BPromise=require(_0xeb46('0x3'));var rp=require(_0xeb46('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb46('0x5'));var config=require(_0xeb46('0x6'));var attributes=require(_0xeb46('0x7'));module['exports']=function(_0x1b499c,_0xe90dbd){return _0x1b499c[_0xeb46('0x8')](_0xeb46('0x9'),attributes,{'tableName':_0xeb46('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1d8c80,_0x7672cd,_0x37255f){if(_0x1d8c80['changed'](_0xeb46('0xb'))){_0x1d8c80[_0xeb46('0xc')]=moment()[_0xeb46('0xd')](_0xeb46('0xe'));}_0x37255f(null,_0x1d8c80);}},'charset':_0xeb46('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6322=['moment','request-promise','path','rimraf','exports','define','ChatInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0x6322,0xed));var _0x2632=function(_0x317a71,_0x144975){_0x317a71=_0x317a71-0x0;var _0x48a19b=_0x6322[_0x317a71];return _0x48a19b;};'use strict';var _=require(_0x2632('0x0'));var util=require(_0x2632('0x1'));var logger=require(_0x2632('0x2'))('api');var moment=require(_0x2632('0x3'));var BPromise=require('bluebird');var rp=require(_0x2632('0x4'));var fs=require('fs');var path=require(_0x2632('0x5'));var rimraf=require(_0x2632('0x6'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module[_0x2632('0x7')]=function(_0x582eb2,_0x27b864){return _0x582eb2[_0x2632('0x8')](_0x2632('0x9'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x36ab24,_0x4da80d,_0x324ce9){if(_0x36ab24[_0x2632('0xa')](_0x2632('0xb'))){_0x36ab24[_0x2632('0xc')]=moment()['format'](_0x2632('0xd'));}_0x324ce9(null,_0x36ab24);}},'charset':'utf8mb4','collate':_0x2632('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index e3c0fe7..cb4bfbc 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 _0x6c69=['limit','UpdateChatInteraction','stringify','AddTagsToChatInteraction','omit','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ChatInteraction','body','options','raw','where','attributes'];(function(_0x58b1fe,_0x14831e){var _0x552550=function(_0x491ad6){while(--_0x491ad6){_0x58b1fe['push'](_0x58b1fe['shift']());}};_0x552550(++_0x14831e);}(_0x6c69,0xfe));var _0x96c6=function(_0x4fab3f,_0x5b0e8a){_0x4fab3f=_0x4fab3f-0x0;var _0x27364e=_0x6c69[_0x4fab3f];return _0x27364e;};'use strict';var _=require(_0x96c6('0x0'));var util=require(_0x96c6('0x1'));var moment=require('moment');var BPromise=require(_0x96c6('0x2'));var rs=require(_0x96c6('0x3'));var fs=require('fs');var Redis=require(_0x96c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x96c6('0x5'));var logger=require(_0x96c6('0x6'))(_0x96c6('0x7'));var config=require('../../config/environment');var jayson=require(_0x96c6('0x8'));var client=jayson['client'][_0x96c6('0x9')]({'port':0x232a});config[_0x96c6('0xa')]=_[_0x96c6('0xb')](config[_0x96c6('0xa')],{'host':_0x96c6('0xc'),'port':0x18eb});var socket=require(_0x96c6('0xd'))(new Redis(config[_0x96c6('0xa')]));require(_0x96c6('0xe'))[_0x96c6('0xf')](socket);function respondWithRpcPromise(_0x5066bb,_0x2db2fb,_0x5c6a32){return new BPromise(function(_0x6f5f9b,_0x5b2ec0){return client['request'](_0x5066bb,_0x5c6a32)[_0x96c6('0x10')](function(_0x46598d){logger[_0x96c6('0x11')](_0x96c6('0x12'),_0x2db2fb,_0x96c6('0x13'));logger[_0x96c6('0x14')](_0x96c6('0x15'),_0x2db2fb,_0x96c6('0x13'),JSON['stringify'](_0x46598d));if(_0x46598d[_0x96c6('0x16')]){if(_0x46598d[_0x96c6('0x16')][_0x96c6('0x17')]===0x1f4){logger['error'](_0x96c6('0x12'),_0x2db2fb,_0x46598d['error']['message']);return _0x5b2ec0(_0x46598d[_0x96c6('0x16')][_0x96c6('0x18')]);}logger[_0x96c6('0x16')](_0x96c6('0x12'),_0x2db2fb,_0x46598d['error']['message']);return _0x6f5f9b(_0x46598d['error']['message']);}else{logger[_0x96c6('0x11')](_0x96c6('0x12'),_0x2db2fb,_0x96c6('0x13'));_0x6f5f9b(_0x46598d[_0x96c6('0x19')]['message']);}})[_0x96c6('0x1a')](function(_0x108051){logger[_0x96c6('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x2db2fb,_0x108051);_0x5b2ec0(_0x108051);});});}exports['UpdateChatInteraction']=function(_0x183cf6){var _0x3305a1=this;return new Promise(function(_0x56aca6,_0x117a18){return db[_0x96c6('0x1b')]['update'](_0x183cf6[_0x96c6('0x1c')],{'raw':_0x183cf6[_0x96c6('0x1d')]?_0x183cf6[_0x96c6('0x1d')][_0x96c6('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x183cf6['options']?_0x183cf6['options'][_0x96c6('0x1f')]||null:null,'attributes':_0x183cf6['options']?_0x183cf6[_0x96c6('0x1d')][_0x96c6('0x20')]||null:null,'limit':_0x183cf6[_0x96c6('0x1d')]?_0x183cf6[_0x96c6('0x1d')][_0x96c6('0x21')]||null:null})[_0x96c6('0x10')](function(_0x1506d9){logger[_0x96c6('0x11')](_0x96c6('0x22'),_0x183cf6);logger[_0x96c6('0x14')](_0x96c6('0x22'),_0x183cf6,JSON[_0x96c6('0x23')](_0x1506d9));_0x56aca6(_0x1506d9);})[_0x96c6('0x1a')](function(_0x1d2919){logger['error'](_0x96c6('0x22'),_0x1d2919[_0x96c6('0x18')],_0x183cf6);_0x117a18(_0x3305a1[_0x96c6('0x16')](0x1f4,_0x1d2919[_0x96c6('0x18')]));});});};exports[_0x96c6('0x24')]=function(_0x41b4d3){return new Promise(function(_0x1b8ed9,_0x53e25f){return db[_0x96c6('0x1b')]['find']({'where':_0x41b4d3[_0x96c6('0x1d')]?_0x41b4d3[_0x96c6('0x1d')][_0x96c6('0x1f')]||null:null})[_0x96c6('0x10')](function(_0xe91e23){if(_0xe91e23){return _0xe91e23['addTags'](_0x41b4d3[_0x96c6('0x1c')]['ids'],_[_0x96c6('0x25')](_0x41b4d3[_0x96c6('0x1c')],[_0x96c6('0x26'),'id'])||{});}})[_0x96c6('0x27')](function(_0x1da85e){logger[_0x96c6('0x11')](_0x96c6('0x28'),_0x41b4d3);logger['debug'](_0x96c6('0x28'),_0x41b4d3,JSON[_0x96c6('0x23')](_0x1da85e));_0x1b8ed9(_0x1da85e);})['catch'](function(_0x481ebd){logger[_0x96c6('0x16')](_0x96c6('0x28'),_0x481ebd[_0x96c6('0x18')],_0x41b4d3);_0x53e25f(_this[_0x96c6('0x16')](0x1f4,_0x481ebd['message']));});});}; \ No newline at end of file +var _0x009e=['rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','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','body','options','raw','attributes','limit','AddTagsToChatInteraction','find','where','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x009e,0x1e4));var _0xe009=function(_0x5a9767,_0x5c008d){_0x5a9767=_0x5a9767-0x0;var _0x2d1a96=_0x009e[_0x5a9767];return _0x2d1a96;};'use strict';var _=require(_0xe009('0x0'));var util=require(_0xe009('0x1'));var moment=require('moment');var BPromise=require(_0xe009('0x2'));var rs=require(_0xe009('0x3'));var fs=require('fs');var Redis=require(_0xe009('0x4'));var db=require(_0xe009('0x5'))['db'];var utils=require(_0xe009('0x6'));var logger=require(_0xe009('0x7'))(_0xe009('0x8'));var config=require('../../config/environment');var jayson=require(_0xe009('0x9'));var client=jayson[_0xe009('0xa')][_0xe009('0xb')]({'port':0x232a});config['redis']=_[_0xe009('0xc')](config[_0xe009('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xe009('0xe'))(new Redis(config[_0xe009('0xd')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x37dcb5,_0x39d5a,_0x3affc6){return new BPromise(function(_0x4c426d,_0x390716){return client[_0xe009('0xf')](_0x37dcb5,_0x3affc6)[_0xe009('0x10')](function(_0x19168c){logger['info'](_0xe009('0x11'),_0x39d5a,_0xe009('0x12'));logger[_0xe009('0x13')](_0xe009('0x14'),_0x39d5a,'request\x20sent',JSON[_0xe009('0x15')](_0x19168c));if(_0x19168c['error']){if(_0x19168c[_0xe009('0x16')][_0xe009('0x17')]===0x1f4){logger[_0xe009('0x16')](_0xe009('0x11'),_0x39d5a,_0x19168c[_0xe009('0x16')][_0xe009('0x18')]);return _0x390716(_0x19168c['error'][_0xe009('0x18')]);}logger[_0xe009('0x16')](_0xe009('0x11'),_0x39d5a,_0x19168c['error']['message']);return _0x4c426d(_0x19168c[_0xe009('0x16')][_0xe009('0x18')]);}else{logger[_0xe009('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x39d5a,_0xe009('0x12'));_0x4c426d(_0x19168c[_0xe009('0x1a')]['message']);}})[_0xe009('0x1b')](function(_0xf1c1a3){logger[_0xe009('0x16')](_0xe009('0x11'),_0x39d5a,_0xf1c1a3);_0x390716(_0xf1c1a3);});});}exports[_0xe009('0x1c')]=function(_0x370297){var _0x2df869=this;return new Promise(function(_0x12446e,_0x2d9f0f){return db[_0xe009('0x1d')]['update'](_0x370297[_0xe009('0x1e')],{'raw':_0x370297[_0xe009('0x1f')]?_0x370297[_0xe009('0x1f')][_0xe009('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x370297['options']?_0x370297[_0xe009('0x1f')]['where']||null:null,'attributes':_0x370297['options']?_0x370297[_0xe009('0x1f')][_0xe009('0x21')]||null:null,'limit':_0x370297[_0xe009('0x1f')]?_0x370297[_0xe009('0x1f')][_0xe009('0x22')]||null:null})[_0xe009('0x10')](function(_0x49f39d){logger[_0xe009('0x19')]('UpdateChatInteraction',_0x370297);logger[_0xe009('0x13')](_0xe009('0x1c'),_0x370297,JSON[_0xe009('0x15')](_0x49f39d));_0x12446e(_0x49f39d);})[_0xe009('0x1b')](function(_0x4e3d5c){logger[_0xe009('0x16')]('UpdateChatInteraction',_0x4e3d5c[_0xe009('0x18')],_0x370297);_0x2d9f0f(_0x2df869[_0xe009('0x16')](0x1f4,_0x4e3d5c[_0xe009('0x18')]));});});};exports[_0xe009('0x23')]=function(_0x415759){return new Promise(function(_0x4e21cd,_0x381f60){return db[_0xe009('0x1d')][_0xe009('0x24')]({'where':_0x415759[_0xe009('0x1f')]?_0x415759[_0xe009('0x1f')][_0xe009('0x25')]||null:null})[_0xe009('0x10')](function(_0x4c4ebb){if(_0x4c4ebb){return _0x4c4ebb['addTags'](_0x415759[_0xe009('0x1e')][_0xe009('0x26')],_['omit'](_0x415759[_0xe009('0x1e')],['ids','id'])||{});}})[_0xe009('0x27')](function(_0xaea05e){logger['info'](_0xe009('0x28'),_0x415759);logger[_0xe009('0x13')](_0xe009('0x28'),_0x415759,JSON[_0xe009('0x15')](_0xaea05e));_0x4e21cd(_0xaea05e);})[_0xe009('0x1b')](function(_0x12bb89){logger[_0xe009('0x16')](_0xe009('0x28'),_0x12bb89[_0xe009('0x18')],_0x415759);_0x381f60(_this[_0xe009('0x16')](0x1f4,_0x12bb89['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index a1d7f83..43b3d80 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 _0x9b82=['register','./chatInteraction.events','save','remove'];(function(_0x4545e9,_0x156fbc){var _0x2e47da=function(_0x43ff31){while(--_0x43ff31){_0x4545e9['push'](_0x4545e9['shift']());}};_0x2e47da(++_0x156fbc);}(_0x9b82,0x111));var _0x29b8=function(_0x56da40,_0x29651a){_0x56da40=_0x56da40-0x0;var _0x3aea2b=_0x9b82[_0x56da40];return _0x3aea2b;};'use strict';var ChatInteractionEvents=require(_0x29b8('0x0'));var events=[_0x29b8('0x1'),_0x29b8('0x2'),'update'];function createListener(_0x2c83ed,_0x21a159){return function(_0x4ba660){_0x21a159['emit'](_0x2c83ed,_0x4ba660);};}function removeListener(_0x4ced74,_0x47ddaf){return function(){ChatInteractionEvents['removeListener'](_0x4ced74,_0x47ddaf);};}exports[_0x29b8('0x3')]=function(_0x6eaff1){for(var _0x12dede=0x0,_0x328c07=events['length'];_0x12dede<_0x328c07;_0x12dede++){var _0x26fd58=events[_0x12dede];var _0x38eae9=createListener('chatInteraction:'+_0x26fd58,_0x6eaff1);ChatInteractionEvents['on'](_0x26fd58,_0x38eae9);}}; \ No newline at end of file +var _0x6048=['emit','removeListener','length','./chatInteraction.events','save','update'];(function(_0x15d2dc,_0x20a220){var _0x31d8b7=function(_0x23400d){while(--_0x23400d){_0x15d2dc['push'](_0x15d2dc['shift']());}};_0x31d8b7(++_0x20a220);}(_0x6048,0x19b));var _0x8604=function(_0x3fbf3d,_0x3a80f4){_0x3fbf3d=_0x3fbf3d-0x0;var _0x2ff7a8=_0x6048[_0x3fbf3d];return _0x2ff7a8;};'use strict';var ChatInteractionEvents=require(_0x8604('0x0'));var events=[_0x8604('0x1'),'remove',_0x8604('0x2')];function createListener(_0xb69c08,_0x2789e8){return function(_0x749c6c){_0x2789e8[_0x8604('0x3')](_0xb69c08,_0x749c6c);};}function removeListener(_0x59fa0a,_0x4ad36c){return function(){ChatInteractionEvents[_0x8604('0x4')](_0x59fa0a,_0x4ad36c);};}exports['register']=function(_0xe42d77){for(var _0x3a3e37=0x0,_0x34cd7f=events[_0x8604('0x5')];_0x3a3e37<_0x34cd7f;_0x3a3e37++){var _0x5ca559=events[_0x3a3e37];var _0x774fe4=createListener('chatInteraction:'+_0x5ca559,_0xe42d77);ChatInteractionEvents['on'](_0x5ca559,_0x774fe4);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 38c692d..b991489 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 _0x342f=['index','get','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','/:id/vidaoo','join','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','attachmentUpload','post','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','/:id','update','/:id/abandon','abandon','/:id/close','close','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated'];(function(_0x1a5b50,_0x178c12){var _0x1c325f=function(_0x21cc07){while(--_0x21cc07){_0x1a5b50['push'](_0x1a5b50['shift']());}};_0x1c325f(++_0x178c12);}(_0x342f,0x1b7));var _0xf342=function(_0x35d968,_0x13060f){_0x35d968=_0x35d968-0x0;var _0x4bec61=_0x342f[_0x35d968];return _0x4bec61;};'use strict';var multer=require(_0xf342('0x0'));var util=require(_0xf342('0x1'));var path=require(_0xf342('0x2'));var timeout=require(_0xf342('0x3'));var express=require('express');var router=express[_0xf342('0x4')]();var fs_extra=require(_0xf342('0x5'));var auth=require(_0xf342('0x6'));var interaction=require(_0xf342('0x7'));var config=require(_0xf342('0x8'));var controller=require(_0xf342('0x9'));router['get']('/',auth[_0xf342('0xa')](),controller[_0xf342('0xb')]);router[_0xf342('0xc')]('/describe',auth[_0xf342('0xa')](),controller['describe']);router[_0xf342('0xc')]('/:id',auth[_0xf342('0xd')](),controller[_0xf342('0xe')]);router[_0xf342('0xc')](_0xf342('0xf'),auth['isChatInteractionAuthorized'](),controller[_0xf342('0x10')]);router['get'](_0xf342('0x11'),auth[_0xf342('0xa')](),controller[_0xf342('0x12')]);router['get'](_0xf342('0x13'),auth[_0xf342('0xd')](),controller[_0xf342('0x14')]);router['get'](_0xf342('0x15'),auth[_0xf342('0xa')](),controller['download']);router['post']('/',auth[_0xf342('0xa')](),controller['create']);router['post'](_0xf342('0x16'),auth[_0xf342('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x56ea2c,_0x1231f7,_0x425055){_0x425055(null,path[_0xf342('0x17')](config['root'],'server/files/attachments/'));},'filename':function(_0x325ccf,_0x5b2946,_0x4765aa){_0x4765aa(null,util[_0xf342('0x18')](_0xf342('0x19'),Date[_0xf342('0x1a')](),_0x5b2946[_0xf342('0x1b')][_0xf342('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xf342('0x1d'),upload[_0xf342('0x1e')]('file'),controller[_0xf342('0x1f')]);router[_0xf342('0x20')](_0xf342('0x11'),auth[_0xf342('0xd')](),controller[_0xf342('0x21')]);router[_0xf342('0x20')](_0xf342('0x22'),auth['isAuthenticated'](),interaction[_0xf342('0x23')](_0xf342('0x24'),_0xf342('0x25')),controller[_0xf342('0x26')]);router[_0xf342('0x27')](_0xf342('0x28'),auth[_0xf342('0xa')](),interaction[_0xf342('0x23')](_0xf342('0x24'),'chatinteraction:update'),controller[_0xf342('0x29')]);router[_0xf342('0x27')]('/:id/custom_update',controller['customUpdate']);router['put'](_0xf342('0x2a'),auth[_0xf342('0xd')](),controller[_0xf342('0x2b')]);router[_0xf342('0x27')](_0xf342('0x2c'),controller[_0xf342('0x2d')]);router[_0xf342('0x2e')](_0xf342('0x28'),auth['isAuthenticated'](),interaction[_0xf342('0x23')]('chat','chatinteraction:destroy'),controller[_0xf342('0x2f')]);router[_0xf342('0x2e')](_0xf342('0x22'),auth[_0xf342('0xa')](),controller[_0xf342('0x30')]);module[_0xf342('0x31')]=router; \ No newline at end of file +var _0x8697=['attachmentDownload','/:id/messages','getMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','attachmentUpload','addMessage','/:id/tags','tracked','addTags','put','chat','/:id/custom_update','abandon','/:id/close','close','delete','destroy','removeTags','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download'];(function(_0x31dde9,_0x12e816){var _0x1fbf2d=function(_0x1d1bf6){while(--_0x1d1bf6){_0x31dde9['push'](_0x31dde9['shift']());}};_0x1fbf2d(++_0x12e816);}(_0x8697,0x1d9));var _0x7869=function(_0x945d28,_0x552708){_0x945d28=_0x945d28-0x0;var _0x341b16=_0x8697[_0x945d28];return _0x341b16;};'use strict';var multer=require(_0x7869('0x0'));var util=require(_0x7869('0x1'));var path=require(_0x7869('0x2'));var timeout=require(_0x7869('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7869('0x4'));var auth=require(_0x7869('0x5'));var interaction=require(_0x7869('0x6'));var config=require('../../config/environment');var controller=require(_0x7869('0x7'));router['get']('/',auth[_0x7869('0x8')](),controller[_0x7869('0x9')]);router[_0x7869('0xa')](_0x7869('0xb'),auth[_0x7869('0x8')](),controller[_0x7869('0xc')]);router[_0x7869('0xa')](_0x7869('0xd'),auth[_0x7869('0xe')](),controller[_0x7869('0xf')]);router[_0x7869('0xa')](_0x7869('0x10'),auth[_0x7869('0xe')](),controller[_0x7869('0x11')]);router[_0x7869('0xa')](_0x7869('0x12'),auth[_0x7869('0x8')](),controller[_0x7869('0x13')]);router[_0x7869('0xa')]('/:id/my_messages',auth[_0x7869('0xe')](),controller['getMyMessages']);router['get'](_0x7869('0x14'),auth[_0x7869('0x8')](),controller[_0x7869('0x15')]);router[_0x7869('0x16')]('/',auth[_0x7869('0x8')](),controller[_0x7869('0x17')]);router[_0x7869('0x16')](_0x7869('0x18'),auth['isAuthenticated'](),controller[_0x7869('0x19')]);var upload=multer({'storage':multer[_0x7869('0x1a')]({'destination':function(_0x4464fe,_0x486d8b,_0x1d9d68){_0x1d9d68(null,path[_0x7869('0x1b')](config[_0x7869('0x1c')],_0x7869('0x1d')));},'filename':function(_0x196e11,_0x381f94,_0x2e249c){_0x2e249c(null,util[_0x7869('0x1e')](_0x7869('0x1f'),Date[_0x7869('0x20')](),_0x381f94[_0x7869('0x21')][_0x7869('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x7869('0x16')]('/:id/attachment_upload',upload['single']('file'),controller[_0x7869('0x23')]);router['post']('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0x7869('0x24')]);router[_0x7869('0x16')](_0x7869('0x25'),auth['isAuthenticated'](),interaction[_0x7869('0x26')]('chat','chatinteraction:addtags'),controller[_0x7869('0x27')]);router[_0x7869('0x28')]('/:id',auth[_0x7869('0x8')](),interaction[_0x7869('0x26')](_0x7869('0x29'),'chatinteraction:update'),controller['update']);router['put'](_0x7869('0x2a'),controller['customUpdate']);router[_0x7869('0x28')]('/:id/abandon',auth[_0x7869('0xe')](),controller[_0x7869('0x2b')]);router['put'](_0x7869('0x2c'),controller[_0x7869('0x2d')]);router[_0x7869('0x2e')](_0x7869('0xd'),auth[_0x7869('0x8')](),interaction[_0x7869('0x26')](_0x7869('0x29'),'chatinteraction:destroy'),controller[_0x7869('0x2f')]);router[_0x7869('0x2e')](_0x7869('0x25'),auth['isAuthenticated'](),controller[_0x7869('0x30')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 16ef467..24db6e7 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 _0x2ef3=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x1a4695,_0x688546){var _0x1eb46a=function(_0x9017c7){while(--_0x9017c7){_0x1a4695['push'](_0x1a4695['shift']());}};_0x1eb46a(++_0x688546);}(_0x2ef3,0xba));var _0x32ef=function(_0x50ff53,_0x2ab801){_0x50ff53=_0x50ff53-0x0;var _0x57febd=_0x2ef3[_0x50ff53];return _0x57febd;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'body':{'type':Sequelize[_0x32ef('0x2')](_0x32ef('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x32ef('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x32ef('0x5')]}}; \ No newline at end of file +var _0x66fa=['exports','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x3780ee,_0xd73246){var _0x1573df=function(_0x61a1c1){while(--_0x61a1c1){_0x3780ee['push'](_0x3780ee['shift']());}};_0x1573df(++_0xd73246);}(_0x66fa,0x117));var _0xa66f=function(_0xbfa11d,_0x1ecfd9){_0xbfa11d=_0xbfa11d-0x0;var _0x46e57e=_0x66fa[_0xbfa11d];return _0x46e57e;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'body':{'type':Sequelize['TEXT'](_0xa66f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa66f('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa66f('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 6714749..909f6c1 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 _0x2786=['YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','fullname','role','userpic','online','allowmessenger','VoiceQueue','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','resourceId','push','createdAt','FromId','read','-createdAt','all','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','limit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','describe','get','messages','lastMessageAt','format'];(function(_0x34ba37,_0x4b8d89){var _0x54f273=function(_0x474cff){while(--_0x474cff){_0x34ba37['push'](_0x34ba37['shift']());}};_0x54f273(++_0x4b8d89);}(_0x2786,0x1c4));var _0x6278=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2786[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6278('0x0'));var zipdir=require(_0x6278('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6278('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6278('0x3'));var util=require(_0x6278('0x4'));var path=require(_0x6278('0x5'));var sox=require(_0x6278('0x6'));var csv=require(_0x6278('0x7'));var ejs=require(_0x6278('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6278('0x9'));var squel=require(_0x6278('0xa'));var crypto=require(_0x6278('0xb'));var jsforce=require(_0x6278('0xc'));var deskjs=require(_0x6278('0xd'));var toCsv=require(_0x6278('0x7'));var querystring=require(_0x6278('0xe'));var Papa=require(_0x6278('0xf'));var Redis=require(_0x6278('0x10'));var authService=require(_0x6278('0x11'));var qs=require(_0x6278('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6278('0x13'));var logger=require(_0x6278('0x14'))(_0x6278('0x15'));var utils=require('../../config/utils');var config=require(_0x6278('0x16'));var licenseUtil=require(_0x6278('0x17'));var db=require('../../mysqldb')['db'];config[_0x6278('0x18')]=_[_0x6278('0x19')](config['redis'],{'host':_0x6278('0x1a'),'port':0x18eb});var socket=require(_0x6278('0x1b'))(new Redis(config[_0x6278('0x18')]));require(_0x6278('0x1c'))['register'](socket);function respondWithStatusCode(_0x4f658e,_0xaf7f78){_0xaf7f78=_0xaf7f78||0xcc;return function(_0x3c923f){if(_0x3c923f){return _0x4f658e['sendStatus'](_0xaf7f78);}return _0x4f658e[_0x6278('0x1d')](_0xaf7f78)[_0x6278('0x1e')]();};}function respondWithResult(_0x29dab5,_0x583219){_0x583219=_0x583219||0xc8;return function(_0x2cb892){if(_0x2cb892){return _0x29dab5[_0x6278('0x1d')](_0x583219)[_0x6278('0x1f')](_0x2cb892);}};}function respondWithFilteredResult(_0x3830c9,_0x27979e){return function(_0x1bd87f){if(_0x1bd87f){var _0x298fda=_0x1bd87f[_0x6278('0x20')],_0x22ead3=_0x27979e[_0x6278('0x21')],_0x126dcb=_0x27979e[_0x6278('0x21')]+_0x27979e['limit'],_0x28f537;if(_0x126dcb>=_0x298fda){_0x126dcb=_0x298fda;_0x28f537=0xc8;}else{_0x28f537=0xce;}_0x3830c9[_0x6278('0x1d')](_0x28f537);return _0x3830c9[_0x6278('0x22')](_0x6278('0x23'),_0x22ead3+'-'+_0x126dcb+'/'+_0x298fda)[_0x6278('0x1f')](_0x1bd87f);}return null;};}function patchUpdates(_0x1b29e9){return function(_0x3cea21){try{jsonpatch[_0x6278('0x24')](_0x3cea21,_0x1b29e9,!![]);}catch(_0x3d5bac){return BPromise[_0x6278('0x25')](_0x3d5bac);}return _0x3cea21[_0x6278('0x26')]();};}function saveUpdates(_0x395c9f,_0x4ed32d){return function(_0x2c43e1){if(_0x2c43e1){return _0x2c43e1[_0x6278('0x27')](_0x395c9f)[_0x6278('0x28')](function(_0x23a3c8){return _0x23a3c8;});}return null;};}function removeEntity(_0x23ff09,_0x55bb43){return function(_0x2cffb6){if(_0x2cffb6){return _0x2cffb6['destroy']()[_0x6278('0x28')](function(){_0x23ff09[_0x6278('0x1d')](0xcc)[_0x6278('0x1e')]();});}};}function handleEntityNotFound(_0x28a583,_0x5a4e15){return function(_0x192a59){if(!_0x192a59){_0x28a583[_0x6278('0x29')](0x194);}return _0x192a59;};}function handleError(_0x345954,_0x4b437e){_0x4b437e=_0x4b437e||0x1f4;return function(_0x521a37){logger[_0x6278('0x2a')](_0x521a37[_0x6278('0x2b')]);if(_0x521a37['name']){delete _0x521a37[_0x6278('0x2c')];}_0x345954['status'](_0x4b437e)[_0x6278('0x2d')](_0x521a37);};}exports[_0x6278('0x2e')]=function(_0x5e7751,_0x5585ff){var _0x2d7a37={},_0x2611cd={},_0x16a78a={'count':0x0,'rows':[]};var _0x124e10=_[_0x6278('0x2f')](db[_0x6278('0x30')][_0x6278('0x31')],function(_0x27f967){return{'name':_0x27f967[_0x6278('0x32')],'type':_0x27f967[_0x6278('0x33')][_0x6278('0x34')]};});_0x2611cd['model']=_[_0x6278('0x2f')](_0x124e10,'name');_0x2611cd[_0x6278('0x35')]=_[_0x6278('0x36')](_0x5e7751['query']);_0x2611cd[_0x6278('0x37')]=_[_0x6278('0x38')](_0x2611cd[_0x6278('0x39')],_0x2611cd[_0x6278('0x35')]);_0x2d7a37[_0x6278('0x3a')]=_[_0x6278('0x38')](_0x2611cd[_0x6278('0x39')],qs[_0x6278('0x3b')](_0x5e7751[_0x6278('0x35')][_0x6278('0x3b')]));_0x2d7a37[_0x6278('0x3a')]=_0x2d7a37[_0x6278('0x3a')][_0x6278('0x3c')]?_0x2d7a37['attributes']:_0x2611cd[_0x6278('0x39')];if(!_0x5e7751['query']['hasOwnProperty']('nolimit')){_0x2d7a37[_0x6278('0x3d')]=qs[_0x6278('0x3d')](_0x5e7751[_0x6278('0x35')]['limit']);_0x2d7a37[_0x6278('0x21')]=qs[_0x6278('0x21')](_0x5e7751[_0x6278('0x35')]['offset']);}_0x2d7a37[_0x6278('0x3e')]=qs[_0x6278('0x3f')](_0x5e7751[_0x6278('0x35')][_0x6278('0x3f')]);_0x2d7a37['where']=qs[_0x6278('0x37')](_['pick'](_0x5e7751[_0x6278('0x35')],_0x2611cd[_0x6278('0x37')]),_0x124e10);if(_0x5e7751[_0x6278('0x35')][_0x6278('0x40')]){_0x2d7a37[_0x6278('0x41')]=_[_0x6278('0x42')](_0x2d7a37[_0x6278('0x41')],{'$or':_[_0x6278('0x2f')](_0x124e10,function(_0x186c0a){if(_0x186c0a[_0x6278('0x33')]!=='VIRTUAL'){var _0x18f860={};_0x18f860[_0x186c0a['name']]={'$like':'%'+_0x5e7751['query'][_0x6278('0x40')]+'%'};return _0x18f860;}})});}_0x2d7a37=_[_0x6278('0x42')]({},_0x2d7a37,_0x5e7751[_0x6278('0x43')]);var _0x2a210e={'where':_0x2d7a37['where']};return db['ChatInternalMessage'][_0x6278('0x20')](_0x2a210e)['then'](function(_0x3a532d){_0x16a78a[_0x6278('0x20')]=_0x3a532d;if(_0x5e7751[_0x6278('0x35')][_0x6278('0x44')]){_0x2d7a37[_0x6278('0x45')]=[{'all':!![]}];}return db[_0x6278('0x30')][_0x6278('0x46')](_0x2d7a37);})[_0x6278('0x28')](function(_0x383d34){_0x16a78a[_0x6278('0x47')]=_0x383d34;return _0x16a78a;})[_0x6278('0x28')](respondWithFilteredResult(_0x5585ff,_0x2d7a37))[_0x6278('0x48')](handleError(_0x5585ff,null));};exports['show']=function(_0x4e4a5e,_0xd41ad2){var _0x17a416={'raw':!![],'where':{'id':_0x4e4a5e[_0x6278('0x49')]['id']}},_0x1fcb61={};_0x1fcb61[_0x6278('0x39')]=_[_0x6278('0x36')](db[_0x6278('0x30')][_0x6278('0x31')]);_0x1fcb61['query']=_['keys'](_0x4e4a5e[_0x6278('0x35')]);_0x1fcb61[_0x6278('0x37')]=_[_0x6278('0x38')](_0x1fcb61[_0x6278('0x39')],_0x1fcb61[_0x6278('0x35')]);_0x17a416[_0x6278('0x3a')]=_[_0x6278('0x38')](_0x1fcb61['model'],qs['fields'](_0x4e4a5e[_0x6278('0x35')][_0x6278('0x3b')]));_0x17a416['attributes']=_0x17a416[_0x6278('0x3a')][_0x6278('0x3c')]?_0x17a416[_0x6278('0x3a')]:_0x1fcb61[_0x6278('0x39')];if(_0x4e4a5e[_0x6278('0x35')][_0x6278('0x44')]){_0x17a416[_0x6278('0x45')]=[{'all':!![]}];}_0x17a416=_[_0x6278('0x42')]({},_0x17a416,_0x4e4a5e['options']);return db[_0x6278('0x30')][_0x6278('0x4a')](_0x17a416)[_0x6278('0x28')](handleEntityNotFound(_0xd41ad2,null))[_0x6278('0x28')](respondWithResult(_0xd41ad2,null))['catch'](handleError(_0xd41ad2,null));};exports[_0x6278('0x4b')]=function(_0x4ae9ca,_0x5ce215){return db[_0x6278('0x30')][_0x6278('0x4b')](_0x4ae9ca[_0x6278('0x4c')],{})[_0x6278('0x28')](respondWithResult(_0x5ce215,0xc9))['catch'](handleError(_0x5ce215,null));};exports[_0x6278('0x27')]=function(_0x175c6e,_0x5c83e5){if(_0x175c6e[_0x6278('0x4c')]['id']){delete _0x175c6e[_0x6278('0x4c')]['id'];}return db['ChatInternalMessage'][_0x6278('0x4a')]({'where':{'id':_0x175c6e[_0x6278('0x49')]['id']}})[_0x6278('0x28')](handleEntityNotFound(_0x5c83e5,null))[_0x6278('0x28')](saveUpdates(_0x175c6e[_0x6278('0x4c')],null))['then'](respondWithResult(_0x5c83e5,null))['catch'](handleError(_0x5c83e5,null));};exports[_0x6278('0x4d')]=function(_0x5859f8,_0x3f9cb1){return db['ChatInternalMessage'][_0x6278('0x4a')]({'where':{'id':_0x5859f8[_0x6278('0x49')]['id']}})['then'](handleEntityNotFound(_0x3f9cb1,null))[_0x6278('0x28')](removeEntity(_0x3f9cb1,null))[_0x6278('0x48')](handleError(_0x3f9cb1,null));};exports[_0x6278('0x4e')]=function(_0x2befd7,_0x526cc5){return db[_0x6278('0x30')][_0x6278('0x4e')]()['then'](respondWithResult(_0x526cc5,null))[_0x6278('0x48')](handleError(_0x526cc5,null));};function wrapUser(_0x39620f){return function(_0x4cb796){var _0x447b58=_0x39620f[_0x6278('0x4f')]({'plain':!![]});_0x447b58[_0x6278('0x50')]=[];if(_0x4cb796){_0x447b58[_0x6278('0x51')]=_0x4cb796['createdAt'];_0x447b58['lastMessage']=_0x4cb796;}else{_0x447b58['lastMessageAt']=moment(0x0)[_0x6278('0x52')](_0x6278('0x53'));_0x447b58['lastMessage']={};}return _0x447b58;};}exports[_0x6278('0x54')]=function(_0x565325,_0x2a580b,_0x2b7448){var _0x48cfdd=[];return db[_0x6278('0x55')]['findAll']({'where':{'role':[_0x6278('0x56'),'admin','user']},'attributes':['id',_0x6278('0x57'),_0x6278('0x2c'),_0x6278('0x58'),_0x6278('0x59'),'internal',_0x6278('0x5a'),'lastLoginAt',_0x6278('0x5b'),'showWebBar'],'order':qs[_0x6278('0x3f')]('-online'),'include':[{'model':db[_0x6278('0x5c')],'as':'VoiceQueues','attributes':['id','name',_0x6278('0x33')],'through':{'attributes':[]}}]})['then'](function(_0xa661e){if(_0xa661e){var _0x24e500=_0x565325[_0x6278('0x5d')]['get']({'plain':!![]});if(!_0x24e500)throw new Error(_0x6278('0x5e'));if(_0x24e500[_0x6278('0x58')]===_0x6278('0x5d')){return db[_0x6278('0x5f')]['find']({'where':{'name':_0x6278('0x60'),'userProfileId':_0x24e500[_0x6278('0x61')]},'raw':!![]})['then'](function(_0x10e3d5){if(_0x10e3d5){if(_0x10e3d5[_0x6278('0x62')]===0x0){return db['UserProfileResource'][_0x6278('0x46')]({'where':{'sectionId':_0x10e3d5['id']},'raw':!![]})[_0x6278('0x28')](function(_0x512498){var _0x263ff7=[];if(_[_0x6278('0x63')](_0x512498)){_0x263ff7=_[_0x6278('0x40')](_0xa661e,function(_0x4dae93){if(_0x4dae93[_0x6278('0x58')]!=='agent'){return _0x4dae93;}});return _0x263ff7;}else{for(var _0x3646b6=0x0;_0x3646b6<_0xa661e[_0x6278('0x3c')];_0x3646b6++){var _0x3b65df=_0xa661e[_0x3646b6];if(_0x3b65df['role']==='agent'){var _0x35fa9d=_[_0x6278('0x4a')](_0x512498,function(_0x3509a5){return _0x3509a5[_0x6278('0x64')]===_0x3b65df['id'];});if(_0x35fa9d)_0x263ff7[_0x6278('0x65')](_0x3b65df);}else{_0x263ff7[_0x6278('0x65')](_0x3b65df);}}return _0x263ff7;}});}else{return _0xa661e;}}else{var _0x52add3=_[_0x6278('0x40')](_0xa661e,function(_0x3db8aa){if(_0x3db8aa[_0x6278('0x58')]!=='agent'){return _0x3db8aa;}});return _0x52add3;}});}else{return _0xa661e;}}})[_0x6278('0x28')](function(_0x34f64a){var _0x406b2b=[];if(_0x34f64a){_0x48cfdd=_0x34f64a;for(var _0x3c3467=0x0;_0x3c3467<_0x34f64a['length'];_0x3c3467+=0x1){_0x48cfdd[_0x3c3467][_0x6278('0x50')]=[];_0x406b2b['push'](db[_0x6278('0x30')][_0x6278('0x4a')]({'where':{'FromId':[_0x565325['user']['id'],_0x34f64a[_0x3c3467]['id']],'ToId':[_0x565325[_0x6278('0x5d')]['id'],_0x34f64a[_0x3c3467]['id']],'ChatGroupId':null},'attributes':['id',_0x6278('0x66'),_0x6278('0x67'),'ToId',_0x6278('0x68'),'body'],'order':qs[_0x6278('0x3f')](_0x6278('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x34f64a[_0x3c3467])));}return BPromise[_0x6278('0x6a')](_0x406b2b);}return[];})[_0x6278('0x28')](function(_0x25653e){return{'rows':_0x25653e,'count':_0x25653e[_0x6278('0x3c')]};})[_0x6278('0x28')](respondWithResult(_0x2a580b,null))[_0x6278('0x48')](handleError(_0x2a580b,null));}; \ No newline at end of file +var _0xa59c=['request-promise','moment','bluebird','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./chatInternalMessage.socket','register','sendStatus','status','count','offset','limit','Content-Range','json','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','ChatInternalMessage','includeAll','findAll','rows','params','include','find','catch','create','body','describe','get','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','userpic','internal','online','lastLoginAt','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','messages','user','FromId','ToId','read','-createdAt','all','eml-format','rimraf','fast-json-patch'];(function(_0x4c81b6,_0x589386){var _0x41058a=function(_0x1bb599){while(--_0x1bb599){_0x4c81b6['push'](_0x4c81b6['shift']());}};_0x41058a(++_0x589386);}(_0xa59c,0x13e));var _0xca59=function(_0x18958a,_0x1d1e33){_0x18958a=_0x18958a-0x0;var _0x583740=_0xa59c[_0x18958a];return _0x583740;};'use strict';var emlformat=require(_0xca59('0x0'));var rimraf=require(_0xca59('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xca59('0x2'));var rp=require(_0xca59('0x3'));var moment=require(_0xca59('0x4'));var BPromise=require(_0xca59('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xca59('0x6'));var csv=require('to-csv');var ejs=require(_0xca59('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xca59('0x8'));var squel=require(_0xca59('0x9'));var crypto=require('crypto');var jsforce=require(_0xca59('0xa'));var deskjs=require(_0xca59('0xb'));var toCsv=require(_0xca59('0xc'));var querystring=require(_0xca59('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xca59('0xe'));var as=require(_0xca59('0xf'));var hardwareService=require(_0xca59('0x10'));var logger=require('../../config/logger')(_0xca59('0x11'));var utils=require(_0xca59('0x12'));var config=require(_0xca59('0x13'));var licenseUtil=require(_0xca59('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xca59('0x15')](config[_0xca59('0x16')],{'host':_0xca59('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xca59('0x16')]));require(_0xca59('0x18'))[_0xca59('0x19')](socket);function respondWithStatusCode(_0xf71ce6,_0x3aa2b5){_0x3aa2b5=_0x3aa2b5||0xcc;return function(_0x4d3bea){if(_0x4d3bea){return _0xf71ce6[_0xca59('0x1a')](_0x3aa2b5);}return _0xf71ce6['status'](_0x3aa2b5)['end']();};}function respondWithResult(_0x4138fc,_0x32f93d){_0x32f93d=_0x32f93d||0xc8;return function(_0x2cc2e2){if(_0x2cc2e2){return _0x4138fc[_0xca59('0x1b')](_0x32f93d)['json'](_0x2cc2e2);}};}function respondWithFilteredResult(_0x501107,_0x433aaf){return function(_0x3bee48){if(_0x3bee48){var _0x3af1a3=_0x3bee48[_0xca59('0x1c')],_0x592fcb=_0x433aaf[_0xca59('0x1d')],_0x3624cd=_0x433aaf[_0xca59('0x1d')]+_0x433aaf[_0xca59('0x1e')],_0x365fd2;if(_0x3624cd>=_0x3af1a3){_0x3624cd=_0x3af1a3;_0x365fd2=0xc8;}else{_0x365fd2=0xce;}_0x501107[_0xca59('0x1b')](_0x365fd2);return _0x501107['set'](_0xca59('0x1f'),_0x592fcb+'-'+_0x3624cd+'/'+_0x3af1a3)[_0xca59('0x20')](_0x3bee48);}return null;};}function patchUpdates(_0x5571df){return function(_0x4ca849){try{jsonpatch['apply'](_0x4ca849,_0x5571df,!![]);}catch(_0x50c31d){return BPromise['reject'](_0x50c31d);}return _0x4ca849[_0xca59('0x21')]();};}function saveUpdates(_0x110d56,_0x52f314){return function(_0x418f33){if(_0x418f33){return _0x418f33[_0xca59('0x22')](_0x110d56)[_0xca59('0x23')](function(_0x4e4d80){return _0x4e4d80;});}return null;};}function removeEntity(_0x50254c,_0x23d648){return function(_0xac0eda){if(_0xac0eda){return _0xac0eda[_0xca59('0x24')]()[_0xca59('0x23')](function(){_0x50254c[_0xca59('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35b0a2,_0x412e6c){return function(_0x413547){if(!_0x413547){_0x35b0a2['sendStatus'](0x194);}return _0x413547;};}function handleError(_0x28ba8b,_0x540ccb){_0x540ccb=_0x540ccb||0x1f4;return function(_0x45aec4){logger[_0xca59('0x25')](_0x45aec4[_0xca59('0x26')]);if(_0x45aec4['name']){delete _0x45aec4[_0xca59('0x27')];}_0x28ba8b[_0xca59('0x1b')](_0x540ccb)[_0xca59('0x28')](_0x45aec4);};}exports[_0xca59('0x29')]=function(_0x2f6bdf,_0x5da5fd){var _0x4be1e8={},_0x5f0906={},_0x446557={'count':0x0,'rows':[]};var _0x257c2d=_[_0xca59('0x2a')](db['ChatInternalMessage'][_0xca59('0x2b')],function(_0x515eb3){return{'name':_0x515eb3[_0xca59('0x2c')],'type':_0x515eb3[_0xca59('0x2d')][_0xca59('0x2e')]};});_0x5f0906['model']=_[_0xca59('0x2a')](_0x257c2d,_0xca59('0x27'));_0x5f0906[_0xca59('0x2f')]=_[_0xca59('0x30')](_0x2f6bdf[_0xca59('0x2f')]);_0x5f0906['filters']=_[_0xca59('0x31')](_0x5f0906[_0xca59('0x32')],_0x5f0906[_0xca59('0x2f')]);_0x4be1e8['attributes']=_['intersection'](_0x5f0906['model'],qs[_0xca59('0x33')](_0x2f6bdf['query'][_0xca59('0x33')]));_0x4be1e8[_0xca59('0x34')]=_0x4be1e8[_0xca59('0x34')][_0xca59('0x35')]?_0x4be1e8['attributes']:_0x5f0906[_0xca59('0x32')];if(!_0x2f6bdf[_0xca59('0x2f')][_0xca59('0x36')]('nolimit')){_0x4be1e8[_0xca59('0x1e')]=qs[_0xca59('0x1e')](_0x2f6bdf['query']['limit']);_0x4be1e8[_0xca59('0x1d')]=qs['offset'](_0x2f6bdf[_0xca59('0x2f')][_0xca59('0x1d')]);}_0x4be1e8[_0xca59('0x37')]=qs['sort'](_0x2f6bdf[_0xca59('0x2f')][_0xca59('0x38')]);_0x4be1e8['where']=qs[_0xca59('0x39')](_[_0xca59('0x3a')](_0x2f6bdf[_0xca59('0x2f')],_0x5f0906[_0xca59('0x39')]),_0x257c2d);if(_0x2f6bdf[_0xca59('0x2f')][_0xca59('0x3b')]){_0x4be1e8['where']=_['merge'](_0x4be1e8[_0xca59('0x3c')],{'$or':_[_0xca59('0x2a')](_0x257c2d,function(_0x2fd494){if(_0x2fd494[_0xca59('0x2d')]!=='VIRTUAL'){var _0x5d90e1={};_0x5d90e1[_0x2fd494['name']]={'$like':'%'+_0x2f6bdf[_0xca59('0x2f')][_0xca59('0x3b')]+'%'};return _0x5d90e1;}})});}_0x4be1e8=_[_0xca59('0x3d')]({},_0x4be1e8,_0x2f6bdf[_0xca59('0x3e')]);var _0x3ec087={'where':_0x4be1e8['where']};return db[_0xca59('0x3f')][_0xca59('0x1c')](_0x3ec087)[_0xca59('0x23')](function(_0x2d70f4){_0x446557[_0xca59('0x1c')]=_0x2d70f4;if(_0x2f6bdf['query'][_0xca59('0x40')]){_0x4be1e8['include']=[{'all':!![]}];}return db[_0xca59('0x3f')][_0xca59('0x41')](_0x4be1e8);})[_0xca59('0x23')](function(_0x3320d1){_0x446557[_0xca59('0x42')]=_0x3320d1;return _0x446557;})[_0xca59('0x23')](respondWithFilteredResult(_0x5da5fd,_0x4be1e8))['catch'](handleError(_0x5da5fd,null));};exports['show']=function(_0x444734,_0x4d2968){var _0x24542a={'raw':!![],'where':{'id':_0x444734[_0xca59('0x43')]['id']}},_0x3b9746={};_0x3b9746[_0xca59('0x32')]=_[_0xca59('0x30')](db[_0xca59('0x3f')]['rawAttributes']);_0x3b9746[_0xca59('0x2f')]=_['keys'](_0x444734['query']);_0x3b9746[_0xca59('0x39')]=_[_0xca59('0x31')](_0x3b9746[_0xca59('0x32')],_0x3b9746[_0xca59('0x2f')]);_0x24542a['attributes']=_[_0xca59('0x31')](_0x3b9746[_0xca59('0x32')],qs[_0xca59('0x33')](_0x444734[_0xca59('0x2f')]['fields']));_0x24542a['attributes']=_0x24542a['attributes']['length']?_0x24542a[_0xca59('0x34')]:_0x3b9746['model'];if(_0x444734['query'][_0xca59('0x40')]){_0x24542a[_0xca59('0x44')]=[{'all':!![]}];}_0x24542a=_[_0xca59('0x3d')]({},_0x24542a,_0x444734[_0xca59('0x3e')]);return db['ChatInternalMessage'][_0xca59('0x45')](_0x24542a)[_0xca59('0x23')](handleEntityNotFound(_0x4d2968,null))[_0xca59('0x23')](respondWithResult(_0x4d2968,null))[_0xca59('0x46')](handleError(_0x4d2968,null));};exports[_0xca59('0x47')]=function(_0x2f02a1,_0x4935b3){return db[_0xca59('0x3f')][_0xca59('0x47')](_0x2f02a1[_0xca59('0x48')],{})[_0xca59('0x23')](respondWithResult(_0x4935b3,0xc9))['catch'](handleError(_0x4935b3,null));};exports[_0xca59('0x22')]=function(_0x911145,_0x2eeae6){if(_0x911145[_0xca59('0x48')]['id']){delete _0x911145[_0xca59('0x48')]['id'];}return db['ChatInternalMessage'][_0xca59('0x45')]({'where':{'id':_0x911145[_0xca59('0x43')]['id']}})[_0xca59('0x23')](handleEntityNotFound(_0x2eeae6,null))[_0xca59('0x23')](saveUpdates(_0x911145[_0xca59('0x48')],null))[_0xca59('0x23')](respondWithResult(_0x2eeae6,null))[_0xca59('0x46')](handleError(_0x2eeae6,null));};exports[_0xca59('0x24')]=function(_0x59fb66,_0xc820fc){return db[_0xca59('0x3f')][_0xca59('0x45')]({'where':{'id':_0x59fb66[_0xca59('0x43')]['id']}})['then'](handleEntityNotFound(_0xc820fc,null))[_0xca59('0x23')](removeEntity(_0xc820fc,null))['catch'](handleError(_0xc820fc,null));};exports[_0xca59('0x49')]=function(_0x39a7fa,_0x491ac4){return db[_0xca59('0x3f')][_0xca59('0x49')]()[_0xca59('0x23')](respondWithResult(_0x491ac4,null))[_0xca59('0x46')](handleError(_0x491ac4,null));};function wrapUser(_0x444ed8){return function(_0x11db31){var _0x15f303=_0x444ed8[_0xca59('0x4a')]({'plain':!![]});_0x15f303['messages']=[];if(_0x11db31){_0x15f303[_0xca59('0x4b')]=_0x11db31[_0xca59('0x4c')];_0x15f303[_0xca59('0x4d')]=_0x11db31;}else{_0x15f303[_0xca59('0x4b')]=moment(0x0)[_0xca59('0x4e')](_0xca59('0x4f'));_0x15f303[_0xca59('0x4d')]={};}return _0x15f303;};}exports[_0xca59('0x50')]=function(_0x305d7c,_0x4f5182,_0x28e085){var _0x4f8c72=[];return db[_0xca59('0x51')][_0xca59('0x41')]({'where':{'role':[_0xca59('0x52'),_0xca59('0x53'),'user']},'attributes':['id','fullname',_0xca59('0x27'),'role',_0xca59('0x54'),_0xca59('0x55'),_0xca59('0x56'),_0xca59('0x57'),'allowmessenger','showWebBar'],'order':qs[_0xca59('0x38')](_0xca59('0x58')),'include':[{'model':db[_0xca59('0x59')],'as':_0xca59('0x5a'),'attributes':['id','name',_0xca59('0x2d')],'through':{'attributes':[]}}]})['then'](function(_0x25c0d5){if(_0x25c0d5){var _0x1d79b1=_0x305d7c['user'][_0xca59('0x4a')]({'plain':!![]});if(!_0x1d79b1)throw new Error(_0xca59('0x5b'));if(_0x1d79b1[_0xca59('0x5c')]==='user'){return db['UserProfileSection']['find']({'where':{'name':_0xca59('0x5d'),'userProfileId':_0x1d79b1[_0xca59('0x5e')]},'raw':!![]})[_0xca59('0x23')](function(_0x41bb4c){if(_0x41bb4c){if(_0x41bb4c[_0xca59('0x5f')]===0x0){return db[_0xca59('0x60')][_0xca59('0x41')]({'where':{'sectionId':_0x41bb4c['id']},'raw':!![]})['then'](function(_0x2ac441){var _0x525cf9=[];if(_[_0xca59('0x61')](_0x2ac441)){_0x525cf9=_[_0xca59('0x3b')](_0x25c0d5,function(_0x57585e){if(_0x57585e[_0xca59('0x5c')]!=='agent'){return _0x57585e;}});return _0x525cf9;}else{for(var _0x20458a=0x0;_0x20458a<_0x25c0d5[_0xca59('0x35')];_0x20458a++){var _0x37d83f=_0x25c0d5[_0x20458a];if(_0x37d83f[_0xca59('0x5c')]===_0xca59('0x52')){var _0x21d229=_['find'](_0x2ac441,function(_0x320c61){return _0x320c61[_0xca59('0x62')]===_0x37d83f['id'];});if(_0x21d229)_0x525cf9[_0xca59('0x63')](_0x37d83f);}else{_0x525cf9[_0xca59('0x63')](_0x37d83f);}}return _0x525cf9;}});}else{return _0x25c0d5;}}else{var _0x130186=_[_0xca59('0x3b')](_0x25c0d5,function(_0x243323){if(_0x243323[_0xca59('0x5c')]!==_0xca59('0x52')){return _0x243323;}});return _0x130186;}});}else{return _0x25c0d5;}}})[_0xca59('0x23')](function(_0x33635f){var _0x17a138=[];if(_0x33635f){_0x4f8c72=_0x33635f;for(var _0x656fe4=0x0;_0x656fe4<_0x33635f['length'];_0x656fe4+=0x1){_0x4f8c72[_0x656fe4][_0xca59('0x64')]=[];_0x17a138['push'](db['ChatInternalMessage'][_0xca59('0x45')]({'where':{'FromId':[_0x305d7c[_0xca59('0x65')]['id'],_0x33635f[_0x656fe4]['id']],'ToId':[_0x305d7c[_0xca59('0x65')]['id'],_0x33635f[_0x656fe4]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xca59('0x66'),_0xca59('0x67'),_0xca59('0x68'),_0xca59('0x48')],'order':qs[_0xca59('0x38')](_0xca59('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xca59('0x23')](wrapUser(_0x33635f[_0x656fe4])));}return BPromise[_0xca59('0x6a')](_0x17a138);}return[];})[_0xca59('0x23')](function(_0x47bec4){return{'rows':_0x47bec4,'count':_0x47bec4[_0xca59('0x35')]};})['then'](respondWithResult(_0x4f5182,null))[_0xca59('0x46')](handleError(_0x4f5182,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 55c532b..6934ad6 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 _0x1cc7=['emit','hook','exports','events','../../mysqldb','ChatInternalMessage','remove'];(function(_0x386a04,_0x4b8694){var _0x433782=function(_0x5dd051){while(--_0x5dd051){_0x386a04['push'](_0x386a04['shift']());}};_0x433782(++_0x4b8694);}(_0x1cc7,0x15a));var _0x71cc=function(_0x4b4eb4,_0x21d7af){_0x4b4eb4=_0x4b4eb4-0x0;var _0xe9260c=_0x1cc7[_0x4b4eb4];return _0xe9260c;};'use strict';var EventEmitter=require(_0x71cc('0x0'));var ChatInternalMessage=require(_0x71cc('0x1'))['db'][_0x71cc('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x71cc('0x3')};function emitEvent(_0x1fac93){return function(_0x402191,_0x5431e1,_0x5dfed9){ChatInternalMessageEvents['emit'](_0x1fac93+':'+_0x402191['id'],_0x402191);ChatInternalMessageEvents[_0x71cc('0x4')](_0x1fac93,_0x402191);_0x5dfed9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x71cc('0x5')](e,emitEvent(event));}}module[_0x71cc('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x24cd=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x57933c,_0x361c10){var _0xdf54c1=function(_0xa47f25){while(--_0xa47f25){_0x57933c['push'](_0x57933c['shift']());}};_0xdf54c1(++_0x361c10);}(_0x24cd,0x83));var _0xd24c=function(_0x4221f6,_0x2ecdcd){_0x4221f6=_0x4221f6-0x0;var _0x5ebe92=_0x24cd[_0x4221f6];return _0x5ebe92;};'use strict';var EventEmitter=require(_0xd24c('0x0'));var ChatInternalMessage=require(_0xd24c('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xd24c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd24c('0x3'),'afterDestroy':_0xd24c('0x4')};function emitEvent(_0x3bd534){return function(_0x4d515c,_0x21a58c,_0x32001a){ChatInternalMessageEvents['emit'](_0x3bd534+':'+_0x4d515c['id'],_0x4d515c);ChatInternalMessageEvents[_0xd24c('0x5')](_0x3bd534,_0x4d515c);_0x32001a(null);};}for(var e in events){if(events[_0xd24c('0x6')](e)){var event=events[e];ChatInternalMessage[_0xd24c('0x7')](e,emitEvent(event));}}module[_0xd24c('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 3a25fad..68ff7e9 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 _0xb7e7=['ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','define'];(function(_0x35841f,_0x3c96c7){var _0x1604ad=function(_0x4a9a57){while(--_0x4a9a57){_0x35841f['push'](_0x35841f['shift']());}};_0x1604ad(++_0x3c96c7);}(_0xb7e7,0x121));var _0x7b7e=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0xb7e7[_0x186376];return _0x2dbdd9;};'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':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7b7e('0x9'),'collate':_0x7b7e('0xa')});}; \ No newline at end of file +var _0x0713=['../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x582f72,_0x886d8){var _0x4cd5fe=function(_0x4ac1c7){while(--_0x4ac1c7){_0x582f72['push'](_0x582f72['shift']());}};_0x4cd5fe(++_0x886d8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3071('0xc'),'collate':_0x3071('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 3440787..db3b59c 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 _0x540a=['ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./chatInternalMessage.socket','register','request','then','info'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x540a,0xa4));var _0xa540=function(_0x4b03e1,_0x25768f){_0x4b03e1=_0x4b03e1-0x0;var _0x41cbe6=_0x540a[_0x4b03e1];return _0x41cbe6;};'use strict';var _=require(_0xa540('0x0'));var util=require(_0xa540('0x1'));var moment=require(_0xa540('0x2'));var BPromise=require(_0xa540('0x3'));var rs=require(_0xa540('0x4'));var fs=require('fs');var Redis=require(_0xa540('0x5'));var db=require(_0xa540('0x6'))['db'];var utils=require(_0xa540('0x7'));var logger=require('../../config/logger')(_0xa540('0x8'));var config=require(_0xa540('0x9'));var jayson=require(_0xa540('0xa'));var client=jayson[_0xa540('0xb')][_0xa540('0xc')]({'port':0x232a});config['redis']=_[_0xa540('0xd')](config['redis'],{'host':_0xa540('0xe'),'port':0x18eb});var socket=require(_0xa540('0xf'))(new Redis(config[_0xa540('0x10')]));require(_0xa540('0x11'))[_0xa540('0x12')](socket);function respondWithRpcPromise(_0x2b9dc4,_0x146d91,_0x185e24){return new BPromise(function(_0x4db462,_0x426353){return client[_0xa540('0x13')](_0x2b9dc4,_0x185e24)[_0xa540('0x14')](function(_0x49e108){logger[_0xa540('0x15')](_0xa540('0x16'),_0x146d91,_0xa540('0x17'));logger[_0xa540('0x18')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x146d91,_0xa540('0x17'),JSON[_0xa540('0x19')](_0x49e108));if(_0x49e108[_0xa540('0x1a')]){if(_0x49e108['error'][_0xa540('0x1b')]===0x1f4){logger['error'](_0xa540('0x16'),_0x146d91,_0x49e108[_0xa540('0x1a')][_0xa540('0x1c')]);return _0x426353(_0x49e108[_0xa540('0x1a')][_0xa540('0x1c')]);}logger[_0xa540('0x1a')](_0xa540('0x16'),_0x146d91,_0x49e108[_0xa540('0x1a')][_0xa540('0x1c')]);return _0x4db462(_0x49e108['error']['message']);}else{logger[_0xa540('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x146d91,'request\x20sent');_0x4db462(_0x49e108[_0xa540('0x1d')]['message']);}})[_0xa540('0x1e')](function(_0x4b7b3d){logger['error'](_0xa540('0x16'),_0x146d91,_0x4b7b3d);_0x426353(_0x4b7b3d);});});} \ No newline at end of file +var _0x5fb2=['then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','register','request'];(function(_0x56331d,_0x25548c){var _0x2249fc=function(_0xf90453){while(--_0xf90453){_0x56331d['push'](_0x56331d['shift']());}};_0x2249fc(++_0x25548c);}(_0x5fb2,0x96));var _0x25fb=function(_0x4cadd2,_0x33c671){_0x4cadd2=_0x4cadd2-0x0;var _0x147334=_0x5fb2[_0x4cadd2];return _0x147334;};'use strict';var _=require('lodash');var util=require(_0x25fb('0x0'));var moment=require(_0x25fb('0x1'));var BPromise=require(_0x25fb('0x2'));var rs=require(_0x25fb('0x3'));var fs=require('fs');var Redis=require(_0x25fb('0x4'));var db=require(_0x25fb('0x5'))['db'];var utils=require(_0x25fb('0x6'));var logger=require(_0x25fb('0x7'))(_0x25fb('0x8'));var config=require(_0x25fb('0x9'));var jayson=require(_0x25fb('0xa'));var client=jayson[_0x25fb('0xb')][_0x25fb('0xc')]({'port':0x232a});config['redis']=_[_0x25fb('0xd')](config['redis'],{'host':_0x25fb('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x25fb('0xf')]));require('./chatInternalMessage.socket')[_0x25fb('0x10')](socket);function respondWithRpcPromise(_0x2a6d51,_0xd7051d,_0x398719){return new BPromise(function(_0x135e47,_0x3a3aec){return client[_0x25fb('0x11')](_0x2a6d51,_0x398719)[_0x25fb('0x12')](function(_0x21621c){logger[_0x25fb('0x13')](_0x25fb('0x14'),_0xd7051d,_0x25fb('0x15'));logger[_0x25fb('0x16')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0xd7051d,_0x25fb('0x15'),JSON[_0x25fb('0x17')](_0x21621c));if(_0x21621c['error']){if(_0x21621c[_0x25fb('0x18')][_0x25fb('0x19')]===0x1f4){logger[_0x25fb('0x18')](_0x25fb('0x14'),_0xd7051d,_0x21621c['error'][_0x25fb('0x1a')]);return _0x3a3aec(_0x21621c['error'][_0x25fb('0x1a')]);}logger[_0x25fb('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0xd7051d,_0x21621c[_0x25fb('0x18')][_0x25fb('0x1a')]);return _0x135e47(_0x21621c[_0x25fb('0x18')][_0x25fb('0x1a')]);}else{logger[_0x25fb('0x13')](_0x25fb('0x14'),_0xd7051d,_0x25fb('0x15'));_0x135e47(_0x21621c['result'][_0x25fb('0x1a')]);}})[_0x25fb('0x1b')](function(_0x34bea8){logger[_0x25fb('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0xd7051d,_0x34bea8);_0x3a3aec(_0x34bea8);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 6f175f1..27d121a 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 _0x4d9e=['removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','update','emit'];(function(_0x3ad63f,_0x57c4d5){var _0x2ff1f5=function(_0x1854c9){while(--_0x1854c9){_0x3ad63f['push'](_0x3ad63f['shift']());}};_0x2ff1f5(++_0x57c4d5);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x4724c2,_0x154258){_0x4724c2=_0x4724c2-0x0;var _0x3f6ea1=_0x4d9e[_0x4724c2];return _0x3f6ea1;};'use strict';var ChatInternalMessageEvents=require(_0xe4d9('0x0'));var events=['save','remove',_0xe4d9('0x1')];function createListener(_0x574c1d,_0x36adac){return function(_0x4d7687){_0x36adac[_0xe4d9('0x2')](_0x574c1d,_0x4d7687);};}function removeListener(_0x2deaef,_0x47a09f){return function(){ChatInternalMessageEvents[_0xe4d9('0x3')](_0x2deaef,_0x47a09f);};}exports[_0xe4d9('0x4')]=function(_0x278035){for(var _0x34c2a2=0x0,_0x125dbc=events[_0xe4d9('0x5')];_0x34c2a2<_0x125dbc;_0x34c2a2++){var _0x54a63a=events[_0x34c2a2];var _0x36316f=createListener(_0xe4d9('0x6')+_0x54a63a,_0x278035);ChatInternalMessageEvents['on'](_0x54a63a,_0x36316f);}}; \ No newline at end of file +var _0xdfcc=['chatInternalMessage:','./chatInternalMessage.events','save','remove','length'];(function(_0x55054d,_0x35adc6){var _0x5324fa=function(_0x348b0c){while(--_0x348b0c){_0x55054d['push'](_0x55054d['shift']());}};_0x5324fa(++_0x35adc6);}(_0xdfcc,0x8d));var _0xcdfc=function(_0x296897,_0x4d23ea){_0x296897=_0x296897-0x0;var _0x2b44ab=_0xdfcc[_0x296897];return _0x2b44ab;};'use strict';var ChatInternalMessageEvents=require(_0xcdfc('0x0'));var events=[_0xcdfc('0x1'),_0xcdfc('0x2'),'update'];function createListener(_0x133c72,_0x851248){return function(_0x54bd16){_0x851248['emit'](_0x133c72,_0x54bd16);};}function removeListener(_0x468275,_0x4e9e63){return function(){ChatInternalMessageEvents['removeListener'](_0x468275,_0x4e9e63);};}exports['register']=function(_0xa928f6){for(var _0x155d4c=0x0,_0x4f942c=events[_0xcdfc('0x3')];_0x155d4c<_0x4f942c;_0x155d4c++){var _0x35a524=events[_0x155d4c];var _0x462f04=createListener(_0xcdfc('0x4')+_0x35a524,_0xa928f6);ChatInternalMessageEvents['on'](_0x35a524,_0x462f04);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index d9dbf0f..ac27413 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 _0xf44a=['../../config/environment','get','isAuthenticated','/describe','/users','getUsers','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf44a,0xcc));var _0xaf44=function(_0xc87f63,_0x451f43){_0xc87f63=_0xc87f63-0x0;var _0x551bbe=_0xf44a[_0xc87f63];return _0x551bbe;};'use strict';var multer=require(_0xaf44('0x0'));var util=require(_0xaf44('0x1'));var path=require(_0xaf44('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf44('0x3'));var router=express[_0xaf44('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaf44('0x5'));var controller=require('./chatInternalMessage.controller');router[_0xaf44('0x6')]('/',auth[_0xaf44('0x7')](),controller['index']);router['get'](_0xaf44('0x8'),auth[_0xaf44('0x7')](),controller['describe']);router[_0xaf44('0x6')](_0xaf44('0x9'),auth[_0xaf44('0x7')](),controller[_0xaf44('0xa')]);router[_0xaf44('0x6')]('/:id',auth[_0xaf44('0x7')](),controller['show']);router[_0xaf44('0xb')]('/',auth[_0xaf44('0x7')](),controller[_0xaf44('0xc')]);router[_0xaf44('0xd')](_0xaf44('0xe'),controller[_0xaf44('0xf')]);router[_0xaf44('0x10')](_0xaf44('0xe'),auth['isAuthenticated'](),controller[_0xaf44('0x11')]);module[_0xaf44('0x12')]=router; \ No newline at end of file +var _0x149e=['../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','getUsers','show','post','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x149e,0x9b));var _0xe149=function(_0x156c68,_0x3885f6){_0x156c68=_0x156c68-0x0;var _0x559146=_0x149e[_0x156c68];return _0x559146;};'use strict';var multer=require(_0xe149('0x0'));var util=require(_0xe149('0x1'));var path=require('path');var timeout=require(_0xe149('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe149('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe149('0x4'));var config=require(_0xe149('0x5'));var controller=require(_0xe149('0x6'));router[_0xe149('0x7')]('/',auth[_0xe149('0x8')](),controller[_0xe149('0x9')]);router['get'](_0xe149('0xa'),auth[_0xe149('0x8')](),controller['describe']);router['get']('/users',auth[_0xe149('0x8')](),controller[_0xe149('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe149('0xc')]);router[_0xe149('0xd')]('/',auth[_0xe149('0x8')](),controller[_0xe149('0xe')]);router[_0xe149('0xf')](_0xe149('0x10'),controller[_0xe149('0x11')]);router['delete']('/:id',auth[_0xe149('0x8')](),controller[_0xe149('0x12')]);module[_0xe149('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 295a848..d079525 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 _0xf3f9=['DATE','STRING','sequelize','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x482f10,_0xe1c841){var _0x42e031=function(_0x15b381){while(--_0x15b381){_0x482f10['push'](_0x482f10['shift']());}};_0x42e031(++_0xe1c841);}(_0xf3f9,0x162));var _0x9f3f=function(_0x1826a9,_0x5703f){_0x1826a9=_0x1826a9-0x0;var _0x4bc0e6=_0xf3f9[_0x1826a9];return _0x4bc0e6;};'use strict';var Sequelize=require(_0x9f3f('0x0'));module['exports']={'body':{'type':Sequelize[_0x9f3f('0x1')](_0x9f3f('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x9f3f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9f3f('0x4')]('in','out'),'defaultValue':_0x9f3f('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x9f3f('0x6')]},'providerName':{'type':Sequelize[_0x9f3f('0x7')]},'providerResponse':{'type':Sequelize[_0x9f3f('0x1')]}}; \ No newline at end of file +var _0x2f4d=['TEXT','BOOLEAN','out','STRING','sequelize'];(function(_0x273252,_0x24ba17){var _0x47d3ce=function(_0x54c538){while(--_0x54c538){_0x273252['push'](_0x273252['shift']());}};_0x47d3ce(++_0x24ba17);}(_0x2f4d,0xcc));var _0xd2f4=function(_0x19772d,_0x2d0b4c){_0x19772d=_0x19772d-0x0;var _0x290f70=_0x2f4d[_0x19772d];return _0x290f70;};'use strict';var Sequelize=require(_0xd2f4('0x0'));module['exports']={'body':{'type':Sequelize[_0xd2f4('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xd2f4('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd2f4('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xd2f4('0x4')]},'providerResponse':{'type':Sequelize[_0xd2f4('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 898d4a1..d8bd227 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 _0x7584=['YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','ChatInteraction','update','isNil','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','stringify','null','AcceptMessage','SIP/%s','channel','event','EventManager','reject','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','interface','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','status','end','offset','limit','Content-Range','json','apply','save','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','count','include','ChatMessage','findAll','rows','params','includeAll','options','find','create','body','destroy','describe','../../config/logger','chat-interactions','accept','chat','read','readAt','format'];(function(_0x56e9fb,_0x11b179){var _0x3008a4=function(_0xaa7a00){while(--_0xaa7a00){_0x56e9fb['push'](_0x56e9fb['shift']());}};_0x3008a4(++_0x11b179);}(_0x7584,0x10e));var _0x4758=function(_0x17896e,_0x37e540){_0x17896e=_0x17896e-0x0;var _0x5562e6=_0x7584[_0x17896e];return _0x5562e6;};'use strict';var emlformat=require(_0x4758('0x0'));var rimraf=require(_0x4758('0x1'));var zipdir=require(_0x4758('0x2'));var jsonpatch=require(_0x4758('0x3'));var rp=require(_0x4758('0x4'));var moment=require(_0x4758('0x5'));var BPromise=require(_0x4758('0x6'));var Mustache=require(_0x4758('0x7'));var util=require(_0x4758('0x8'));var path=require(_0x4758('0x9'));var sox=require('sox');var csv=require(_0x4758('0xa'));var ejs=require(_0x4758('0xb'));var fs=require('fs');var fs_extra=require(_0x4758('0xc'));var _=require('lodash');var squel=require(_0x4758('0xd'));var crypto=require(_0x4758('0xe'));var jsforce=require(_0x4758('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4758('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4758('0x10'));var as=require(_0x4758('0x11'));var hardwareService=require(_0x4758('0x12'));var logger=require('../../config/logger')(_0x4758('0x13'));var utils=require('../../config/utils');var config=require(_0x4758('0x14'));var licenseUtil=require(_0x4758('0x15'));var db=require(_0x4758('0x16'))['db'];config[_0x4758('0x17')]=_[_0x4758('0x18')](config[_0x4758('0x17')],{'host':_0x4758('0x19'),'port':0x18eb});var socket=require(_0x4758('0x1a'))(new Redis(config[_0x4758('0x17')]));require(_0x4758('0x1b'))[_0x4758('0x1c')](socket);var jayson=require(_0x4758('0x1d'));var client=jayson[_0x4758('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x4758('0x1e')][_0x4758('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1b7a3c,_0x1abdd0,_0x5124fc,_0x3d5780){return new BPromise(function(_0x36347e,_0x26400a){var _0x110207=_0x3d5780||client;return _0x110207[_0x4758('0x20')](_0x1b7a3c,_0x5124fc)[_0x4758('0x21')](function(_0x5a0edf){logger[_0x4758('0x22')]('ChatMessage,\x20%s,\x20%s',_0x1abdd0,_0x4758('0x23'));logger[_0x4758('0x24')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x1abdd0,_0x4758('0x23'),JSON['stringify'](_0x5a0edf));if(_0x5a0edf[_0x4758('0x25')]){if(_0x5a0edf[_0x4758('0x25')][_0x4758('0x26')]===0x1f4){logger[_0x4758('0x25')](_0x4758('0x27'),_0x1abdd0,_0x5a0edf[_0x4758('0x25')]['message']);return _0x26400a(_0x5a0edf['error'][_0x4758('0x28')]);}logger[_0x4758('0x25')]('ChatMessage,\x20%s,\x20%s',_0x1abdd0,_0x5a0edf[_0x4758('0x25')][_0x4758('0x28')]);return _0x36347e(_0x5a0edf[_0x4758('0x25')][_0x4758('0x28')]);}else{logger[_0x4758('0x22')](_0x4758('0x27'),_0x1abdd0,'request\x20sent');_0x36347e(_0x5a0edf[_0x4758('0x29')][_0x4758('0x28')]);}})[_0x4758('0x2a')](function(_0x532cc5){logger[_0x4758('0x25')]('ChatMessage,\x20%s,\x20%s',_0x1abdd0,_0x532cc5);_0x26400a(_0x532cc5);});});}function respondWithStatusCode(_0x2f8924,_0x1f3469){_0x1f3469=_0x1f3469||0xcc;return function(_0x27233d){if(_0x27233d){return _0x2f8924['sendStatus'](_0x1f3469);}return _0x2f8924[_0x4758('0x2b')](_0x1f3469)[_0x4758('0x2c')]();};}function respondWithResult(_0xfdafe2,_0x38ab22){_0x38ab22=_0x38ab22||0xc8;return function(_0x2287b5){if(_0x2287b5){return _0xfdafe2[_0x4758('0x2b')](_0x38ab22)['json'](_0x2287b5);}};}function respondWithFilteredResult(_0x390b9f,_0x43c3e8){return function(_0x255c88){if(_0x255c88){var _0x755de0=_0x255c88['count'],_0x43365e=_0x43c3e8['offset'],_0x4867d0=_0x43c3e8[_0x4758('0x2d')]+_0x43c3e8[_0x4758('0x2e')],_0x105039;if(_0x4867d0>=_0x755de0){_0x4867d0=_0x755de0;_0x105039=0xc8;}else{_0x105039=0xce;}_0x390b9f[_0x4758('0x2b')](_0x105039);return _0x390b9f['set'](_0x4758('0x2f'),_0x43365e+'-'+_0x4867d0+'/'+_0x755de0)[_0x4758('0x30')](_0x255c88);}return null;};}function patchUpdates(_0x505467){return function(_0x420449){try{jsonpatch[_0x4758('0x31')](_0x420449,_0x505467,!![]);}catch(_0x4d850d){return BPromise['reject'](_0x4d850d);}return _0x420449[_0x4758('0x32')]();};}function saveUpdates(_0x1ce7f9,_0x65a90d){return function(_0x502705){if(_0x502705){return _0x502705['update'](_0x1ce7f9)['then'](function(_0x3a6c44){return _0x3a6c44;});}return null;};}function removeEntity(_0x36cc27,_0x55c54f){return function(_0x262f64){if(_0x262f64){return _0x262f64['destroy']()[_0x4758('0x21')](function(){_0x36cc27[_0x4758('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10d749,_0x5760fa){return function(_0x4408ee){if(!_0x4408ee){_0x10d749[_0x4758('0x33')](0x194);}return _0x4408ee;};}function handleError(_0x4e1a52,_0x42f032){_0x42f032=_0x42f032||0x1f4;return function(_0xd69a92){logger[_0x4758('0x25')](_0xd69a92[_0x4758('0x34')]);if(_0xd69a92[_0x4758('0x35')]){delete _0xd69a92[_0x4758('0x35')];}_0x4e1a52[_0x4758('0x2b')](_0x42f032)[_0x4758('0x36')](_0xd69a92);};}exports[_0x4758('0x37')]=function(_0x2d6063,_0x56716d){var _0xc73574={},_0x2a3516={},_0x4d1143={'count':0x0,'rows':[]};var _0x5de4d6=_['map'](db['ChatMessage'][_0x4758('0x38')],function(_0x4b778c){return{'name':_0x4b778c[_0x4758('0x39')],'type':_0x4b778c[_0x4758('0x3a')]['key']};});_0x2a3516[_0x4758('0x3b')]=_[_0x4758('0x3c')](_0x5de4d6,'name');_0x2a3516[_0x4758('0x3d')]=_[_0x4758('0x3e')](_0x2d6063[_0x4758('0x3d')]);_0x2a3516[_0x4758('0x3f')]=_[_0x4758('0x40')](_0x2a3516[_0x4758('0x3b')],_0x2a3516[_0x4758('0x3d')]);_0xc73574[_0x4758('0x41')]=_['intersection'](_0x2a3516[_0x4758('0x3b')],qs[_0x4758('0x42')](_0x2d6063['query'][_0x4758('0x42')]));_0xc73574[_0x4758('0x41')]=_0xc73574[_0x4758('0x41')][_0x4758('0x43')]?_0xc73574['attributes']:_0x2a3516[_0x4758('0x3b')];if(!_0x2d6063['query'][_0x4758('0x44')](_0x4758('0x45'))){_0xc73574[_0x4758('0x2e')]=qs[_0x4758('0x2e')](_0x2d6063[_0x4758('0x3d')]['limit']);_0xc73574['offset']=qs[_0x4758('0x2d')](_0x2d6063[_0x4758('0x3d')][_0x4758('0x2d')]);}_0xc73574[_0x4758('0x46')]=qs[_0x4758('0x47')](_0x2d6063[_0x4758('0x3d')][_0x4758('0x47')]);_0xc73574[_0x4758('0x48')]=qs[_0x4758('0x3f')](_['pick'](_0x2d6063['query'],_0x2a3516[_0x4758('0x3f')]),_0x5de4d6);if(_0x2d6063[_0x4758('0x3d')][_0x4758('0x49')]){_0xc73574[_0x4758('0x48')]=_[_0x4758('0x4a')](_0xc73574[_0x4758('0x48')],{'$or':_[_0x4758('0x3c')](_0x5de4d6,function(_0x44035d){if(_0x44035d[_0x4758('0x3a')]!==_0x4758('0x4b')){var _0x12cbab={};_0x12cbab[_0x44035d['name']]={'$like':'%'+_0x2d6063[_0x4758('0x3d')][_0x4758('0x49')]+'%'};return _0x12cbab;}})});}_0xc73574=_[_0x4758('0x4a')]({},_0xc73574,_0x2d6063['options']);var _0x2bf84e={'where':_0xc73574[_0x4758('0x48')]};return db['ChatMessage']['count'](_0x2bf84e)[_0x4758('0x21')](function(_0x320e9c){_0x4d1143[_0x4758('0x4c')]=_0x320e9c;if(_0x2d6063['query']['includeAll']){_0xc73574[_0x4758('0x4d')]=[{'all':!![]}];}return db[_0x4758('0x4e')][_0x4758('0x4f')](_0xc73574);})[_0x4758('0x21')](function(_0x285498){_0x4d1143[_0x4758('0x50')]=_0x285498;return _0x4d1143;})[_0x4758('0x21')](respondWithFilteredResult(_0x56716d,_0xc73574))[_0x4758('0x2a')](handleError(_0x56716d,null));};exports['show']=function(_0x8fe42,_0x3b3e26){var _0x3e4e62={'raw':!![],'where':{'id':_0x8fe42[_0x4758('0x51')]['id']}},_0x35be8a={};_0x35be8a[_0x4758('0x3b')]=_[_0x4758('0x3e')](db['ChatMessage'][_0x4758('0x38')]);_0x35be8a[_0x4758('0x3d')]=_['keys'](_0x8fe42[_0x4758('0x3d')]);_0x35be8a[_0x4758('0x3f')]=_[_0x4758('0x40')](_0x35be8a['model'],_0x35be8a['query']);_0x3e4e62['attributes']=_[_0x4758('0x40')](_0x35be8a[_0x4758('0x3b')],qs[_0x4758('0x42')](_0x8fe42['query'][_0x4758('0x42')]));_0x3e4e62['attributes']=_0x3e4e62[_0x4758('0x41')][_0x4758('0x43')]?_0x3e4e62['attributes']:_0x35be8a[_0x4758('0x3b')];if(_0x8fe42[_0x4758('0x3d')][_0x4758('0x52')]){_0x3e4e62['include']=[{'all':!![]}];}_0x3e4e62=_[_0x4758('0x4a')]({},_0x3e4e62,_0x8fe42[_0x4758('0x53')]);return db[_0x4758('0x4e')][_0x4758('0x54')](_0x3e4e62)[_0x4758('0x21')](handleEntityNotFound(_0x3b3e26,null))[_0x4758('0x21')](respondWithResult(_0x3b3e26,null))['catch'](handleError(_0x3b3e26,null));};exports[_0x4758('0x55')]=function(_0x214fa7,_0xb9e05a){return db[_0x4758('0x4e')][_0x4758('0x55')](_0x214fa7[_0x4758('0x56')],{})[_0x4758('0x21')](respondWithResult(_0xb9e05a,0xc9))[_0x4758('0x2a')](handleError(_0xb9e05a,null));};exports['update']=function(_0xc15123,_0x4e57a3){if(_0xc15123[_0x4758('0x56')]['id']){delete _0xc15123['body']['id'];}return db['ChatMessage'][_0x4758('0x54')]({'where':{'id':_0xc15123[_0x4758('0x51')]['id']}})[_0x4758('0x21')](handleEntityNotFound(_0x4e57a3,null))[_0x4758('0x21')](saveUpdates(_0xc15123['body'],null))['then'](respondWithResult(_0x4e57a3,null))['catch'](handleError(_0x4e57a3,null));};exports[_0x4758('0x57')]=function(_0x1a9450,_0x507611){return db['ChatMessage'][_0x4758('0x54')]({'where':{'id':_0x1a9450[_0x4758('0x51')]['id']}})['then'](handleEntityNotFound(_0x507611,null))[_0x4758('0x21')](removeEntity(_0x507611,null))[_0x4758('0x2a')](handleError(_0x507611,null));};exports[_0x4758('0x58')]=function(_0x311baf,_0x2632e7){return db[_0x4758('0x4e')][_0x4758('0x58')]()[_0x4758('0x21')](respondWithResult(_0x2632e7,null))[_0x4758('0x2a')](handleError(_0x2632e7,null));};var interaction_log=require(_0x4758('0x59'))(_0x4758('0x5a'));exports[_0x4758('0x5b')]=function(_0x4c5151,_0x42a15b,_0x2dbf30){var _0x2f516a={'agent':{},'channel':_0x4758('0x5c')};if(_0x4c5151['body']['id']){delete _0x4c5151[_0x4758('0x56')]['id'];}_0x4c5151[_0x4758('0x56')][_0x4758('0x5d')]=!![];_0x4c5151[_0x4758('0x56')][_0x4758('0x5e')]=moment()[_0x4758('0x5f')](_0x4758('0x60'));_0x4c5151['body'][_0x4758('0x61')]=_0x4c5151[_0x4758('0x56')][_0x4758('0x61')]||_0x4c5151[_0x4758('0x62')]['id'];_0x2f516a['agent']['id']=_0x4c5151[_0x4758('0x56')]['UserId'];return db[_0x4758('0x4e')][_0x4758('0x54')]({'where':{'id':_0x4c5151[_0x4758('0x51')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x4758('0x63')}]})[_0x4758('0x21')](handleEntityNotFound(_0x42a15b,null))[_0x4758('0x21')](saveUpdates(_0x4c5151[_0x4758('0x56')],null))[_0x4758('0x21')](function(_0x49935e){if(_0x49935e){_0x2f516a['message']=_0x49935e[_0x4758('0x64')]({'plain':!![]});return db[_0x4758('0x65')]['find']({'where':{'id':_0x49935e['ChatInteractionId']}});}return null;})[_0x4758('0x21')](handleEntityNotFound(_0x42a15b,null))[_0x4758('0x21')](function(_0xe9a5c6){if(_0xe9a5c6){return _0xe9a5c6[_0x4758('0x66')]({'UserId':_0x4c5151[_0x4758('0x56')][_0x4758('0x61')],'read1stAt':_[_0x4758('0x67')](_0xe9a5c6[_0x4758('0x68')])?moment()[_0x4758('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x4758('0x21')](function(_0x5c8821){if(_0x5c8821){_0x2f516a['interaction']=_0x5c8821[_0x4758('0x64')]({'plain':!![]});interaction_log['info'](_0x4758('0x69'),_0x4c5151[_0x4758('0x62')]['id'],_0x4c5151['user'][_0x4758('0x35')],_0x4c5151[_0x4758('0x62')]['role'],_0x2f516a[_0x4758('0x6a')]['id'],_0x4c5151[_0x4758('0x56')]?JSON[_0x4758('0x6b')](_0x4c5151[_0x4758('0x56')]):_0x4758('0x6c'));return respondWithRpcPromise(_0x4758('0x6d'),'acceptMessage',_0x2f516a);}return null;})['then'](function(_0x177c56){if(_0x177c56){if(_0x4c5151[_0x4758('0x56')]['manual']){_0x2f516a[_0x4758('0x28')]['interface']=util[_0x4758('0x5f')](_0x4758('0x6e'),_0x4c5151[_0x4758('0x62')][_0x4758('0x35')]);_0x2f516a[_0x4758('0x28')][_0x4758('0x6f')]=_0x2f516a['channel'];_0x2f516a['message'][_0x4758('0x70')]=_0x4758('0x5b');return respondWithRpcPromise(_0x4758('0x71'),_0x4758('0x71'),{'event':'acceptmessage','message':_[_0x4758('0x4a')](_0x2f516a['message'],JSON['parse'](_0x2f516a[_0x4758('0x6a')]['formData']))},client9002)[_0x4758('0x21')](function(){return _0x2f516a;});}return _0x2f516a;}return null;})[_0x4758('0x21')](respondWithResult(_0x42a15b,null))[_0x4758('0x2a')](handleError(_0x42a15b,null));};var interaction_log=require(_0x4758('0x59'))(_0x4758('0x5a'));exports[_0x4758('0x72')]=function(_0x57d405,_0x3e093d,_0x579185){var _0x94b7c5={'agent':{},'channel':_0x4758('0x5c')};if(_0x57d405[_0x4758('0x56')]['id']){delete _0x57d405[_0x4758('0x56')]['id'];}_0x57d405[_0x4758('0x56')]['UserId']=_0x57d405[_0x4758('0x56')][_0x4758('0x61')]||_0x57d405[_0x4758('0x62')]['id'];_0x94b7c5[_0x4758('0x73')]['id']=_0x57d405[_0x4758('0x56')][_0x4758('0x61')];return db['ChatMessage'][_0x4758('0x54')]({'where':{'id':_0x57d405[_0x4758('0x51')]['id'],'UserId':null}})[_0x4758('0x21')](handleEntityNotFound(_0x3e093d,null))[_0x4758('0x21')](function(_0xe306a4){if(_0xe306a4){_0x94b7c5[_0x4758('0x28')]=_0xe306a4[_0x4758('0x64')]({'plain':!![]});return db[_0x4758('0x65')]['find']({'where':{'id':_0xe306a4['ChatInteractionId']}});}return null;})[_0x4758('0x21')](handleEntityNotFound(_0x3e093d,null))['then'](function(_0x4ab45d){if(_0x4ab45d){_0x94b7c5[_0x4758('0x6a')]=_0x4ab45d['get']({'plain':!![]});interaction_log[_0x4758('0x22')](_0x4758('0x74'),_0x57d405['user']['id'],_0x57d405[_0x4758('0x62')][_0x4758('0x35')],_0x57d405[_0x4758('0x62')][_0x4758('0x75')],_0x94b7c5[_0x4758('0x6a')]['id'],_0x57d405['body']?JSON[_0x4758('0x6b')](_0x57d405['body']):_0x4758('0x6c'));return respondWithRpcPromise(_0x4758('0x76'),_0x4758('0x77'),_0x94b7c5);}return null;})['then'](function(_0x31ddf3){if(_0x31ddf3){_0x31ddf3[_0x4758('0x28')][_0x4758('0x78')]=util[_0x4758('0x5f')](_0x4758('0x6e'),_0x57d405['user'][_0x4758('0x35')]);_0x31ddf3[_0x4758('0x28')][_0x4758('0x6f')]=_0x94b7c5[_0x4758('0x6f')];_0x31ddf3[_0x4758('0x28')][_0x4758('0x70')]=_0x4758('0x72');respondWithRpcPromise(_0x4758('0x71'),_0x4758('0x71'),{'event':_0x4758('0x79'),'message':_0x31ddf3[_0x4758('0x28')]},client9002);return _0x94b7c5;}return null;})['then'](respondWithResult(_0x3e093d,null))['catch'](handleError(_0x3e093d,null));}; \ No newline at end of file +var _0x77a4=['set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','map','ChatMessage','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','params','find','create','body','describe','chat-interactions','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','ChatInteractionId','isNil','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','formData','ChatInteraction','RejectMessage','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','status','end','json','count','offset','limit'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x77a4,0xc3));var _0x477a=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0x77a4[_0x35007a];return _0x574f68;};'use strict';var emlformat=require(_0x477a('0x0'));var rimraf=require(_0x477a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x477a('0x2'));var rp=require(_0x477a('0x3'));var moment=require(_0x477a('0x4'));var BPromise=require(_0x477a('0x5'));var Mustache=require(_0x477a('0x6'));var util=require(_0x477a('0x7'));var path=require(_0x477a('0x8'));var sox=require(_0x477a('0x9'));var csv=require(_0x477a('0xa'));var ejs=require(_0x477a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x477a('0xc'));var crypto=require('crypto');var jsforce=require(_0x477a('0xd'));var deskjs=require(_0x477a('0xe'));var toCsv=require(_0x477a('0xa'));var querystring=require(_0x477a('0xf'));var Papa=require('papaparse');var Redis=require(_0x477a('0x10'));var authService=require(_0x477a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x477a('0x12'));var hardwareService=require(_0x477a('0x13'));var logger=require(_0x477a('0x14'))(_0x477a('0x15'));var utils=require(_0x477a('0x16'));var config=require(_0x477a('0x17'));var licenseUtil=require(_0x477a('0x18'));var db=require(_0x477a('0x19'))['db'];config[_0x477a('0x1a')]=_[_0x477a('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x477a('0x1c'))(new Redis(config[_0x477a('0x1a')]));require(_0x477a('0x1d'))[_0x477a('0x1e')](socket);var jayson=require(_0x477a('0x1f'));var client=jayson[_0x477a('0x20')][_0x477a('0x21')]({'port':0x232c});var client9002=jayson[_0x477a('0x20')][_0x477a('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x141f60,_0x51bb32,_0x58ba80,_0x4b741a){return new BPromise(function(_0x504757,_0x4d94b4){var _0x4503b4=_0x4b741a||client;return _0x4503b4[_0x477a('0x22')](_0x141f60,_0x58ba80)[_0x477a('0x23')](function(_0x2394bb){logger['info'](_0x477a('0x24'),_0x51bb32,_0x477a('0x25'));logger[_0x477a('0x26')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x51bb32,_0x477a('0x25'),JSON[_0x477a('0x27')](_0x2394bb));if(_0x2394bb[_0x477a('0x28')]){if(_0x2394bb[_0x477a('0x28')]['code']===0x1f4){logger[_0x477a('0x28')](_0x477a('0x24'),_0x51bb32,_0x2394bb[_0x477a('0x28')][_0x477a('0x29')]);return _0x4d94b4(_0x2394bb[_0x477a('0x28')][_0x477a('0x29')]);}logger['error'](_0x477a('0x24'),_0x51bb32,_0x2394bb['error']['message']);return _0x504757(_0x2394bb[_0x477a('0x28')]['message']);}else{logger[_0x477a('0x2a')](_0x477a('0x24'),_0x51bb32,_0x477a('0x25'));_0x504757(_0x2394bb[_0x477a('0x2b')][_0x477a('0x29')]);}})[_0x477a('0x2c')](function(_0x4ab2f7){logger[_0x477a('0x28')]('ChatMessage,\x20%s,\x20%s',_0x51bb32,_0x4ab2f7);_0x4d94b4(_0x4ab2f7);});});}function respondWithStatusCode(_0x2265ab,_0x1973d0){_0x1973d0=_0x1973d0||0xcc;return function(_0x2587c3){if(_0x2587c3){return _0x2265ab['sendStatus'](_0x1973d0);}return _0x2265ab[_0x477a('0x2d')](_0x1973d0)[_0x477a('0x2e')]();};}function respondWithResult(_0x43fc61,_0x204e93){_0x204e93=_0x204e93||0xc8;return function(_0x26aa55){if(_0x26aa55){return _0x43fc61[_0x477a('0x2d')](_0x204e93)[_0x477a('0x2f')](_0x26aa55);}};}function respondWithFilteredResult(_0x10e1ea,_0x53dc50){return function(_0x54b2a3){if(_0x54b2a3){var _0x290ee5=_0x54b2a3[_0x477a('0x30')],_0x411f9a=_0x53dc50[_0x477a('0x31')],_0x2222b0=_0x53dc50[_0x477a('0x31')]+_0x53dc50[_0x477a('0x32')],_0x287079;if(_0x2222b0>=_0x290ee5){_0x2222b0=_0x290ee5;_0x287079=0xc8;}else{_0x287079=0xce;}_0x10e1ea[_0x477a('0x2d')](_0x287079);return _0x10e1ea[_0x477a('0x33')](_0x477a('0x34'),_0x411f9a+'-'+_0x2222b0+'/'+_0x290ee5)[_0x477a('0x2f')](_0x54b2a3);}return null;};}function patchUpdates(_0x6014bb){return function(_0x2564ee){try{jsonpatch[_0x477a('0x35')](_0x2564ee,_0x6014bb,!![]);}catch(_0x1675f3){return BPromise[_0x477a('0x36')](_0x1675f3);}return _0x2564ee[_0x477a('0x37')]();};}function saveUpdates(_0x4dd4de,_0x13e8be){return function(_0x554df5){if(_0x554df5){return _0x554df5[_0x477a('0x38')](_0x4dd4de)['then'](function(_0x17d670){return _0x17d670;});}return null;};}function removeEntity(_0x38321a,_0x363105){return function(_0x349633){if(_0x349633){return _0x349633[_0x477a('0x39')]()[_0x477a('0x23')](function(){_0x38321a[_0x477a('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22f039,_0x3ec34c){return function(_0x318053){if(!_0x318053){_0x22f039[_0x477a('0x3a')](0x194);}return _0x318053;};}function handleError(_0x3a4644,_0x8dfcab){_0x8dfcab=_0x8dfcab||0x1f4;return function(_0x12556d){logger[_0x477a('0x28')](_0x12556d[_0x477a('0x3b')]);if(_0x12556d[_0x477a('0x3c')]){delete _0x12556d[_0x477a('0x3c')];}_0x3a4644[_0x477a('0x2d')](_0x8dfcab)[_0x477a('0x3d')](_0x12556d);};}exports['index']=function(_0x1fc8ec,_0x3d31ae){var _0x351a8c={},_0x18bd6c={},_0x1074ba={'count':0x0,'rows':[]};var _0x119616=_[_0x477a('0x3e')](db[_0x477a('0x3f')][_0x477a('0x40')],function(_0x1c0ef3){return{'name':_0x1c0ef3['fieldName'],'type':_0x1c0ef3[_0x477a('0x41')][_0x477a('0x42')]};});_0x18bd6c[_0x477a('0x43')]=_[_0x477a('0x3e')](_0x119616,_0x477a('0x3c'));_0x18bd6c[_0x477a('0x44')]=_[_0x477a('0x45')](_0x1fc8ec[_0x477a('0x44')]);_0x18bd6c[_0x477a('0x46')]=_['intersection'](_0x18bd6c[_0x477a('0x43')],_0x18bd6c['query']);_0x351a8c[_0x477a('0x47')]=_[_0x477a('0x48')](_0x18bd6c[_0x477a('0x43')],qs[_0x477a('0x49')](_0x1fc8ec[_0x477a('0x44')]['fields']));_0x351a8c[_0x477a('0x47')]=_0x351a8c[_0x477a('0x47')][_0x477a('0x4a')]?_0x351a8c['attributes']:_0x18bd6c[_0x477a('0x43')];if(!_0x1fc8ec[_0x477a('0x44')][_0x477a('0x4b')](_0x477a('0x4c'))){_0x351a8c['limit']=qs[_0x477a('0x32')](_0x1fc8ec[_0x477a('0x44')][_0x477a('0x32')]);_0x351a8c[_0x477a('0x31')]=qs[_0x477a('0x31')](_0x1fc8ec['query'][_0x477a('0x31')]);}_0x351a8c[_0x477a('0x4d')]=qs['sort'](_0x1fc8ec[_0x477a('0x44')][_0x477a('0x4e')]);_0x351a8c[_0x477a('0x4f')]=qs[_0x477a('0x46')](_['pick'](_0x1fc8ec[_0x477a('0x44')],_0x18bd6c['filters']),_0x119616);if(_0x1fc8ec[_0x477a('0x44')]['filter']){_0x351a8c[_0x477a('0x4f')]=_['merge'](_0x351a8c[_0x477a('0x4f')],{'$or':_[_0x477a('0x3e')](_0x119616,function(_0x460161){if(_0x460161['type']!=='VIRTUAL'){var _0x506030={};_0x506030[_0x460161[_0x477a('0x3c')]]={'$like':'%'+_0x1fc8ec[_0x477a('0x44')][_0x477a('0x50')]+'%'};return _0x506030;}})});}_0x351a8c=_[_0x477a('0x51')]({},_0x351a8c,_0x1fc8ec[_0x477a('0x52')]);var _0x33c07a={'where':_0x351a8c[_0x477a('0x4f')]};return db[_0x477a('0x3f')]['count'](_0x33c07a)[_0x477a('0x23')](function(_0x4ab1f0){_0x1074ba['count']=_0x4ab1f0;if(_0x1fc8ec[_0x477a('0x44')][_0x477a('0x53')]){_0x351a8c[_0x477a('0x54')]=[{'all':!![]}];}return db[_0x477a('0x3f')][_0x477a('0x55')](_0x351a8c);})[_0x477a('0x23')](function(_0x358f12){_0x1074ba[_0x477a('0x56')]=_0x358f12;return _0x1074ba;})[_0x477a('0x23')](respondWithFilteredResult(_0x3d31ae,_0x351a8c))[_0x477a('0x2c')](handleError(_0x3d31ae,null));};exports['show']=function(_0x2d4dc8,_0x5382a9){var _0x5e0083={'raw':!![],'where':{'id':_0x2d4dc8[_0x477a('0x57')]['id']}},_0x3eaf62={};_0x3eaf62[_0x477a('0x43')]=_[_0x477a('0x45')](db[_0x477a('0x3f')][_0x477a('0x40')]);_0x3eaf62[_0x477a('0x44')]=_[_0x477a('0x45')](_0x2d4dc8[_0x477a('0x44')]);_0x3eaf62[_0x477a('0x46')]=_[_0x477a('0x48')](_0x3eaf62['model'],_0x3eaf62['query']);_0x5e0083['attributes']=_['intersection'](_0x3eaf62[_0x477a('0x43')],qs['fields'](_0x2d4dc8[_0x477a('0x44')][_0x477a('0x49')]));_0x5e0083['attributes']=_0x5e0083[_0x477a('0x47')][_0x477a('0x4a')]?_0x5e0083[_0x477a('0x47')]:_0x3eaf62[_0x477a('0x43')];if(_0x2d4dc8['query']['includeAll']){_0x5e0083[_0x477a('0x54')]=[{'all':!![]}];}_0x5e0083=_[_0x477a('0x51')]({},_0x5e0083,_0x2d4dc8[_0x477a('0x52')]);return db[_0x477a('0x3f')][_0x477a('0x58')](_0x5e0083)['then'](handleEntityNotFound(_0x5382a9,null))[_0x477a('0x23')](respondWithResult(_0x5382a9,null))['catch'](handleError(_0x5382a9,null));};exports[_0x477a('0x59')]=function(_0xa8e3bb,_0x6ad8b5){return db[_0x477a('0x3f')]['create'](_0xa8e3bb[_0x477a('0x5a')],{})[_0x477a('0x23')](respondWithResult(_0x6ad8b5,0xc9))[_0x477a('0x2c')](handleError(_0x6ad8b5,null));};exports[_0x477a('0x38')]=function(_0xfb03e8,_0x35da28){if(_0xfb03e8['body']['id']){delete _0xfb03e8[_0x477a('0x5a')]['id'];}return db[_0x477a('0x3f')][_0x477a('0x58')]({'where':{'id':_0xfb03e8[_0x477a('0x57')]['id']}})[_0x477a('0x23')](handleEntityNotFound(_0x35da28,null))['then'](saveUpdates(_0xfb03e8['body'],null))['then'](respondWithResult(_0x35da28,null))[_0x477a('0x2c')](handleError(_0x35da28,null));};exports[_0x477a('0x39')]=function(_0x1f5ac1,_0x2104ea){return db[_0x477a('0x3f')][_0x477a('0x58')]({'where':{'id':_0x1f5ac1[_0x477a('0x57')]['id']}})[_0x477a('0x23')](handleEntityNotFound(_0x2104ea,null))[_0x477a('0x23')](removeEntity(_0x2104ea,null))[_0x477a('0x2c')](handleError(_0x2104ea,null));};exports[_0x477a('0x5b')]=function(_0x3f6a31,_0x492c44){return db['ChatMessage']['describe']()[_0x477a('0x23')](respondWithResult(_0x492c44,null))[_0x477a('0x2c')](handleError(_0x492c44,null));};var interaction_log=require(_0x477a('0x14'))(_0x477a('0x5c'));exports['accept']=function(_0xd73371,_0x3aea97,_0x360176){var _0x44afb0={'agent':{},'channel':_0x477a('0x5d')};if(_0xd73371[_0x477a('0x5a')]['id']){delete _0xd73371[_0x477a('0x5a')]['id'];}_0xd73371[_0x477a('0x5a')]['read']=!![];_0xd73371[_0x477a('0x5a')][_0x477a('0x5e')]=moment()[_0x477a('0x5f')](_0x477a('0x60'));_0xd73371[_0x477a('0x5a')][_0x477a('0x61')]=_0xd73371[_0x477a('0x5a')][_0x477a('0x61')]||_0xd73371[_0x477a('0x62')]['id'];_0x44afb0[_0x477a('0x63')]['id']=_0xd73371['body'][_0x477a('0x61')];return db[_0x477a('0x3f')]['find']({'where':{'id':_0xd73371[_0x477a('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x477a('0x64')],'as':_0x477a('0x65')}]})['then'](handleEntityNotFound(_0x3aea97,null))[_0x477a('0x23')](saveUpdates(_0xd73371['body'],null))['then'](function(_0x4e5fc4){if(_0x4e5fc4){_0x44afb0[_0x477a('0x29')]=_0x4e5fc4['get']({'plain':!![]});return db['ChatInteraction'][_0x477a('0x58')]({'where':{'id':_0x4e5fc4[_0x477a('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x3aea97,null))['then'](function(_0x1bffc4){if(_0x1bffc4){return _0x1bffc4[_0x477a('0x38')]({'UserId':_0xd73371[_0x477a('0x5a')][_0x477a('0x61')],'read1stAt':_[_0x477a('0x67')](_0x1bffc4[_0x477a('0x68')])?moment()[_0x477a('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x477a('0x23')](function(_0x312bd2){if(_0x312bd2){_0x44afb0[_0x477a('0x69')]=_0x312bd2[_0x477a('0x6a')]({'plain':!![]});interaction_log['info'](_0x477a('0x6b'),_0xd73371[_0x477a('0x62')]['id'],_0xd73371[_0x477a('0x62')][_0x477a('0x3c')],_0xd73371['user'][_0x477a('0x6c')],_0x44afb0[_0x477a('0x69')]['id'],_0xd73371[_0x477a('0x5a')]?JSON[_0x477a('0x27')](_0xd73371['body']):_0x477a('0x6d'));return respondWithRpcPromise('AcceptMessage',_0x477a('0x6e'),_0x44afb0);}return null;})[_0x477a('0x23')](function(_0x1517e5){if(_0x1517e5){if(_0xd73371[_0x477a('0x5a')][_0x477a('0x6f')]){_0x44afb0[_0x477a('0x29')][_0x477a('0x70')]=util['format'](_0x477a('0x71'),_0xd73371[_0x477a('0x62')][_0x477a('0x3c')]);_0x44afb0[_0x477a('0x29')]['channel']=_0x44afb0[_0x477a('0x72')];_0x44afb0[_0x477a('0x29')][_0x477a('0x73')]=_0x477a('0x74');return respondWithRpcPromise(_0x477a('0x75'),_0x477a('0x75'),{'event':_0x477a('0x76'),'message':_[_0x477a('0x51')](_0x44afb0['message'],JSON['parse'](_0x44afb0[_0x477a('0x69')][_0x477a('0x77')]))},client9002)[_0x477a('0x23')](function(){return _0x44afb0;});}return _0x44afb0;}return null;})[_0x477a('0x23')](respondWithResult(_0x3aea97,null))[_0x477a('0x2c')](handleError(_0x3aea97,null));};var interaction_log=require('../../config/logger')(_0x477a('0x5c'));exports['reject']=function(_0x6363e4,_0x4c60ed,_0x67ae12){var _0x5798c4={'agent':{},'channel':'chat'};if(_0x6363e4[_0x477a('0x5a')]['id']){delete _0x6363e4[_0x477a('0x5a')]['id'];}_0x6363e4[_0x477a('0x5a')][_0x477a('0x61')]=_0x6363e4['body'][_0x477a('0x61')]||_0x6363e4[_0x477a('0x62')]['id'];_0x5798c4[_0x477a('0x63')]['id']=_0x6363e4[_0x477a('0x5a')][_0x477a('0x61')];return db['ChatMessage']['find']({'where':{'id':_0x6363e4[_0x477a('0x57')]['id'],'UserId':null}})[_0x477a('0x23')](handleEntityNotFound(_0x4c60ed,null))[_0x477a('0x23')](function(_0x1f4f68){if(_0x1f4f68){_0x5798c4[_0x477a('0x29')]=_0x1f4f68[_0x477a('0x6a')]({'plain':!![]});return db[_0x477a('0x78')][_0x477a('0x58')]({'where':{'id':_0x1f4f68[_0x477a('0x66')]}});}return null;})[_0x477a('0x23')](handleEntityNotFound(_0x4c60ed,null))['then'](function(_0x50a78b){if(_0x50a78b){_0x5798c4[_0x477a('0x69')]=_0x50a78b['get']({'plain':!![]});interaction_log[_0x477a('0x2a')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x6363e4[_0x477a('0x62')]['id'],_0x6363e4['user'][_0x477a('0x3c')],_0x6363e4[_0x477a('0x62')]['role'],_0x5798c4[_0x477a('0x69')]['id'],_0x6363e4[_0x477a('0x5a')]?JSON['stringify'](_0x6363e4[_0x477a('0x5a')]):_0x477a('0x6d'));return respondWithRpcPromise(_0x477a('0x79'),'rejectMessage',_0x5798c4);}return null;})['then'](function(_0x37039c){if(_0x37039c){_0x37039c[_0x477a('0x29')][_0x477a('0x70')]=util['format'](_0x477a('0x71'),_0x6363e4['user'][_0x477a('0x3c')]);_0x37039c[_0x477a('0x29')]['channel']=_0x5798c4['channel'];_0x37039c[_0x477a('0x29')][_0x477a('0x73')]=_0x477a('0x36');respondWithRpcPromise(_0x477a('0x75'),'EventManager',{'event':_0x477a('0x7a'),'message':_0x37039c[_0x477a('0x29')]},client9002);return _0x5798c4;}return null;})[_0x477a('0x23')](respondWithResult(_0x4c60ed,null))[_0x477a('0x2c')](handleError(_0x4c60ed,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 4d24b5b..e922337 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 _0xd02b=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xd02b,0x148));var _0xbd02=function(_0x5ecf3a,_0x2efd35){_0x5ecf3a=_0x5ecf3a-0x0;var _0x176611=_0xd02b[_0x5ecf3a];return _0x176611;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xbd02('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xbd02('0x1')](0x0);var events={'afterCreate':_0xbd02('0x2'),'afterUpdate':_0xbd02('0x3'),'afterDestroy':_0xbd02('0x4')};function emitEvent(_0x22ee4d){return function(_0x12f1b5,_0x472b19,_0x301249){ChatMessageEvents[_0xbd02('0x5')](_0x22ee4d+':'+_0x12f1b5['id'],_0x12f1b5);ChatMessageEvents[_0xbd02('0x5')](_0x22ee4d,_0x12f1b5);_0x301249(null);};}for(var e in events){if(events[_0xbd02('0x6')](e)){var event=events[e];ChatMessage[_0xbd02('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0xf241=['exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5657c1,_0x11a1fd){var _0x890744=function(_0x30ac4e){while(--_0x30ac4e){_0x5657c1['push'](_0x5657c1['shift']());}};_0x890744(++_0x11a1fd);}(_0xf241,0x14b));var _0x1f24=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf241[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0x1f24('0x0'));var ChatMessage=require(_0x1f24('0x1'))['db'][_0x1f24('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x1f24('0x3')](0x0);var events={'afterCreate':_0x1f24('0x4'),'afterUpdate':_0x1f24('0x5'),'afterDestroy':_0x1f24('0x6')};function emitEvent(_0x54f3ed){return function(_0x338f6f,_0x4f5dba,_0x529894){ChatMessageEvents[_0x1f24('0x7')](_0x54f3ed+':'+_0x338f6f['id'],_0x338f6f);ChatMessageEvents['emit'](_0x54f3ed,_0x338f6f);_0x529894(null);};}for(var e in events){if(events[_0x1f24('0x8')](e)){var event=events[e];ChatMessage[_0x1f24('0x9')](e,emitEvent(event));}}module[_0x1f24('0xa')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 5e46355..fd1965c 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 _0xf006=['utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','bluebird','path','./chatMessage.attributes','exports','define','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','then','update','createdAt','catch','error'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xf006,0x146));var _0x6f00=function(_0x5ccb93,_0x2455a5){_0x5ccb93=_0x5ccb93-0x0;var _0x7cbacf=_0xf006[_0x5ccb93];return _0x7cbacf;};'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')]('ChatMessage',attributes,{'tableName':_0x6f00('0x7'),'paranoid':![],'indexes':[{'name':_0x6f00('0x8'),'fields':[_0x6f00('0x9')],'type':_0x6f00('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x286d32,_0x3001c6,_0x44b63c){var _0x1e0720=_0x141e71[_0x6f00('0xb')];var _0x3e6a41=_0x286d32[_0x6f00('0xc')]({'plain':!![]});if(_0x3e6a41[_0x6f00('0xd')][_0x6f00('0xe')]()==='in'||_0x3e6a41['direction'][_0x6f00('0xe')]()===_0x6f00('0xf')&&!_0x3e6a41[_0x6f00('0x10')]&&!_[_0x6f00('0x11')](_0x3e6a41[_0x6f00('0x12')])){_0x1e0720['ChatInteraction'][_0x6f00('0x13')]({'where':{'id':_0x3e6a41['ChatInteractionId']}})[_0x6f00('0x14')](function(_0x5047f5){if(_0x5047f5){_0x5047f5[_0x6f00('0x15')]({'lastMsgAt':_0x3e6a41[_0x6f00('0x16')],'lastMsgDirection':_0x3e6a41[_0x6f00('0xd')][_0x6f00('0xe')]()});}})[_0x6f00('0x17')](function(_0x411203){console[_0x6f00('0x18')](_0x411203);});}_0x44b63c();}},'charset':_0x6f00('0x19'),'collate':_0x6f00('0x1a')});}; \ No newline at end of file +var _0x5fd1=['fti_chat_messages','body','FULLTEXT','models','toLowerCase','direction','out','secret','isNil','UserId','ChatInteraction','findOne','update','createdAt','catch','error','utf8mb4','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','ChatMessage'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5fd1,0x155));var _0x15fd=function(_0x2e71df,_0xe3a95e){_0x2e71df=_0x2e71df-0x0;var _0x257fe6=_0x5fd1[_0x2e71df];return _0x257fe6;};'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('./chatMessage.attributes');module[_0x15fd('0x7')]=function(_0x386441,_0x18450c){return _0x386441[_0x15fd('0x8')](_0x15fd('0x9'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x15fd('0xa'),'fields':[_0x15fd('0xb')],'type':_0x15fd('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4c861f,_0x2d2fbb,_0x5c9c63){var _0x3dfdbb=_0x386441[_0x15fd('0xd')];var _0x4c226a=_0x4c861f['get']({'plain':!![]});if(_0x4c226a['direction'][_0x15fd('0xe')]()==='in'||_0x4c226a[_0x15fd('0xf')][_0x15fd('0xe')]()===_0x15fd('0x10')&&!_0x4c226a[_0x15fd('0x11')]&&!_[_0x15fd('0x12')](_0x4c226a[_0x15fd('0x13')])){_0x3dfdbb[_0x15fd('0x14')][_0x15fd('0x15')]({'where':{'id':_0x4c226a['ChatInteractionId']}})['then'](function(_0x5784a3){if(_0x5784a3){_0x5784a3[_0x15fd('0x16')]({'lastMsgAt':_0x4c226a[_0x15fd('0x17')],'lastMsgDirection':_0x4c226a[_0x15fd('0xf')][_0x15fd('0xe')]()});}})[_0x15fd('0x18')](function(_0x2ffa03){console[_0x15fd('0x19')](_0x2ffa03);});}_0x5c9c63();}},'charset':_0x15fd('0x1a'),'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 6ce9ef2..2abf0ae 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 _0x5b69=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','then','info','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','ChatMessage,\x20%s,\x20%s','result','catch','CreateChatMessage','ChatMessage','body','options','raw','stringify','lodash','util','bluebird'];(function(_0x5ce2b9,_0x31f8ff){var _0x70b5c1=function(_0x2058a4){while(--_0x2058a4){_0x5ce2b9['push'](_0x5ce2b9['shift']());}};_0x70b5c1(++_0x31f8ff);}(_0x5b69,0x15b));var _0x95b6=function(_0xe2c665,_0x5467a0){_0xe2c665=_0xe2c665-0x0;var _0x5bcbb7=_0x5b69[_0xe2c665];return _0x5bcbb7;};'use strict';var _=require(_0x95b6('0x0'));var util=require(_0x95b6('0x1'));var moment=require('moment');var BPromise=require(_0x95b6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95b6('0x3'));var db=require(_0x95b6('0x4'))['db'];var utils=require(_0x95b6('0x5'));var logger=require(_0x95b6('0x6'))(_0x95b6('0x7'));var config=require(_0x95b6('0x8'));var jayson=require(_0x95b6('0x9'));var client=jayson[_0x95b6('0xa')][_0x95b6('0xb')]({'port':0x232a});config['redis']=_[_0x95b6('0xc')](config[_0x95b6('0xd')],{'host':_0x95b6('0xe'),'port':0x18eb});var socket=require(_0x95b6('0xf'))(new Redis(config[_0x95b6('0xd')]));require(_0x95b6('0x10'))[_0x95b6('0x11')](socket);function respondWithRpcPromise(_0x253f22,_0x3e9f7e,_0x44209d){return new BPromise(function(_0x185df9,_0x36a44b){return client['request'](_0x253f22,_0x44209d)[_0x95b6('0x12')](function(_0x4483a7){logger[_0x95b6('0x13')]('ChatMessage,\x20%s,\x20%s',_0x3e9f7e,'request\x20sent');logger[_0x95b6('0x14')](_0x95b6('0x15'),_0x3e9f7e,_0x95b6('0x16'),JSON['stringify'](_0x4483a7));if(_0x4483a7[_0x95b6('0x17')]){if(_0x4483a7[_0x95b6('0x17')][_0x95b6('0x18')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x3e9f7e,_0x4483a7['error'][_0x95b6('0x19')]);return _0x36a44b(_0x4483a7[_0x95b6('0x17')][_0x95b6('0x19')]);}logger[_0x95b6('0x17')](_0x95b6('0x1a'),_0x3e9f7e,_0x4483a7[_0x95b6('0x17')]['message']);return _0x185df9(_0x4483a7[_0x95b6('0x17')][_0x95b6('0x19')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x3e9f7e,'request\x20sent');_0x185df9(_0x4483a7[_0x95b6('0x1b')][_0x95b6('0x19')]);}})[_0x95b6('0x1c')](function(_0xeaab74){logger[_0x95b6('0x17')](_0x95b6('0x1a'),_0x3e9f7e,_0xeaab74);_0x36a44b(_0xeaab74);});});}exports[_0x95b6('0x1d')]=function(_0x353355){var _0x404981=this;return new Promise(function(_0x1dfe00,_0x5f29ad){return db[_0x95b6('0x1e')]['create'](_0x353355[_0x95b6('0x1f')],{'raw':_0x353355[_0x95b6('0x20')]?_0x353355[_0x95b6('0x20')][_0x95b6('0x21')]===undefined?!![]:![]:!![]})[_0x95b6('0x12')](function(_0x4fbe8a){logger[_0x95b6('0x13')]('CreateChatMessage',_0x353355);logger['debug'](_0x95b6('0x1d'),_0x353355,JSON[_0x95b6('0x22')](_0x4fbe8a));_0x1dfe00(_0x4fbe8a);})[_0x95b6('0x1c')](function(_0x3b31ae){logger[_0x95b6('0x17')]('CreateChatMessage',_0x3b31ae['message'],_0x353355);_0x5f29ad(_0x404981[_0x95b6('0x17')](0x1f4,_0x3b31ae['message']));});});}; \ No newline at end of file +var _0x1e63=['ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ChatMessage','body','options','raw','then','CreateChatMessage','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','info'];(function(_0x27cbfc,_0x20c4d5){var _0x4616c6=function(_0x15b5c8){while(--_0x15b5c8){_0x27cbfc['push'](_0x27cbfc['shift']());}};_0x4616c6(++_0x20c4d5);}(_0x1e63,0xb0));var _0x31e6=function(_0x29da65,_0xdcbf95){_0x29da65=_0x29da65-0x0;var _0x241a9b=_0x1e63[_0x29da65];return _0x241a9b;};'use strict';var _=require('lodash');var util=require(_0x31e6('0x0'));var moment=require('moment');var BPromise=require(_0x31e6('0x1'));var rs=require(_0x31e6('0x2'));var fs=require('fs');var Redis=require(_0x31e6('0x3'));var db=require(_0x31e6('0x4'))['db'];var utils=require(_0x31e6('0x5'));var logger=require(_0x31e6('0x6'))('rpc');var config=require(_0x31e6('0x7'));var jayson=require(_0x31e6('0x8'));var client=jayson['client'][_0x31e6('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x31e6('0xa')],{'host':_0x31e6('0xb'),'port':0x18eb});var socket=require(_0x31e6('0xc'))(new Redis(config[_0x31e6('0xa')]));require(_0x31e6('0xd'))[_0x31e6('0xe')](socket);function respondWithRpcPromise(_0x3db954,_0xb7bb5d,_0x46b814){return new BPromise(function(_0xffadd8,_0x4c360e){return client['request'](_0x3db954,_0x46b814)['then'](function(_0x1896da){logger[_0x31e6('0xf')](_0x31e6('0x10'),_0xb7bb5d,'request\x20sent');logger[_0x31e6('0x11')](_0x31e6('0x12'),_0xb7bb5d,_0x31e6('0x13'),JSON['stringify'](_0x1896da));if(_0x1896da['error']){if(_0x1896da[_0x31e6('0x14')][_0x31e6('0x15')]===0x1f4){logger[_0x31e6('0x14')](_0x31e6('0x10'),_0xb7bb5d,_0x1896da[_0x31e6('0x14')][_0x31e6('0x16')]);return _0x4c360e(_0x1896da[_0x31e6('0x14')][_0x31e6('0x16')]);}logger[_0x31e6('0x14')](_0x31e6('0x10'),_0xb7bb5d,_0x1896da[_0x31e6('0x14')]['message']);return _0xffadd8(_0x1896da[_0x31e6('0x14')][_0x31e6('0x16')]);}else{logger['info'](_0x31e6('0x10'),_0xb7bb5d,_0x31e6('0x13'));_0xffadd8(_0x1896da[_0x31e6('0x17')]['message']);}})[_0x31e6('0x18')](function(_0x5b9850){logger[_0x31e6('0x14')]('ChatMessage,\x20%s,\x20%s',_0xb7bb5d,_0x5b9850);_0x4c360e(_0x5b9850);});});}exports['CreateChatMessage']=function(_0x1538a7){var _0x35fd53=this;return new Promise(function(_0x24a378,_0x565ace){return db[_0x31e6('0x19')]['create'](_0x1538a7[_0x31e6('0x1a')],{'raw':_0x1538a7[_0x31e6('0x1b')]?_0x1538a7[_0x31e6('0x1b')][_0x31e6('0x1c')]===undefined?!![]:![]:!![]})[_0x31e6('0x1d')](function(_0x4b89d6){logger['info'](_0x31e6('0x1e'),_0x1538a7);logger['debug'](_0x31e6('0x1e'),_0x1538a7,JSON[_0x31e6('0x1f')](_0x4b89d6));_0x24a378(_0x4b89d6);})[_0x31e6('0x18')](function(_0x307983){logger[_0x31e6('0x14')](_0x31e6('0x1e'),_0x307983[_0x31e6('0x16')],_0x1538a7);_0x565ace(_0x35fd53['error'](0x1f4,_0x307983[_0x31e6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 93a5fa1..d36d128 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 _0xd8fb=['./chatMessage.events','save','remove','update','emit','removeListener','register','length','chatMessage:'];(function(_0xebe37,_0x1ef514){var _0x1e492f=function(_0x4ad8cd){while(--_0x4ad8cd){_0xebe37['push'](_0xebe37['shift']());}};_0x1e492f(++_0x1ef514);}(_0xd8fb,0x99));var _0xbd8f=function(_0x111da3,_0x15faec){_0x111da3=_0x111da3-0x0;var _0x2c74c1=_0xd8fb[_0x111da3];return _0x2c74c1;};'use strict';var ChatMessageEvents=require(_0xbd8f('0x0'));var events=[_0xbd8f('0x1'),_0xbd8f('0x2'),_0xbd8f('0x3')];function createListener(_0x52724c,_0x5ea933){return function(_0x4e9545){_0x5ea933[_0xbd8f('0x4')](_0x52724c,_0x4e9545);};}function removeListener(_0x43d177,_0x53cccc){return function(){ChatMessageEvents[_0xbd8f('0x5')](_0x43d177,_0x53cccc);};}exports[_0xbd8f('0x6')]=function(_0x5543b2){for(var _0x33d541=0x0,_0x4e97cf=events[_0xbd8f('0x7')];_0x33d541<_0x4e97cf;_0x33d541++){var _0x578499=events[_0x33d541];var _0x197827=createListener(_0xbd8f('0x8')+_0x578499,_0x5543b2);ChatMessageEvents['on'](_0x578499,_0x197827);}}; \ No newline at end of file +var _0xba34=['chatMessage:','./chatMessage.events','save','remove','update','removeListener','register'];(function(_0x58cbb9,_0x57ad6b){var _0x433c53=function(_0x4be101){while(--_0x4be101){_0x58cbb9['push'](_0x58cbb9['shift']());}};_0x433c53(++_0x57ad6b);}(_0xba34,0x119));var _0x4ba3=function(_0x4c4b4d,_0x459430){_0x4c4b4d=_0x4c4b4d-0x0;var _0xccfb6c=_0xba34[_0x4c4b4d];return _0xccfb6c;};'use strict';var ChatMessageEvents=require(_0x4ba3('0x0'));var events=[_0x4ba3('0x1'),_0x4ba3('0x2'),_0x4ba3('0x3')];function createListener(_0xeb0ac4,_0x4d6e75){return function(_0x5aa88e){_0x4d6e75['emit'](_0xeb0ac4,_0x5aa88e);};}function removeListener(_0x4592fc,_0x2947f2){return function(){ChatMessageEvents[_0x4ba3('0x4')](_0x4592fc,_0x2947f2);};}exports[_0x4ba3('0x5')]=function(_0x3590a1){for(var _0xb88621=0x0,_0xe5f99a=events['length'];_0xb88621<_0xe5f99a;_0xb88621++){var _0x6254fb=events[_0xb88621];var _0x368eee=createListener(_0x4ba3('0x6')+_0x6254fb,_0x3590a1);ChatMessageEvents['on'](_0x6254fb,_0x368eee);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 37304bd..4158c1b 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 _0x878f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','/describe','/:id','post','isAuthenticated','tracked','chatmessage:create','create','put','/:id/accept','/:id/reject','delete','util','path','connect-timeout'];(function(_0x38662b,_0x207ae1){var _0x55f4d7=function(_0x37b7c9){while(--_0x37b7c9){_0x38662b['push'](_0x38662b['shift']());}};_0x55f4d7(++_0x207ae1);}(_0x878f,0x173));var _0xf878=function(_0x5487bb,_0x117bd7){_0x5487bb=_0x5487bb-0x0;var _0x3b929e=_0x878f[_0x5487bb];return _0x3b929e;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var fs_extra=require(_0xf878('0x5'));var auth=require(_0xf878('0x6'));var interaction=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var controller=require(_0xf878('0x9'));router[_0xf878('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf878('0xa')](_0xf878('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xf878('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf878('0xd')]('/',auth[_0xf878('0xe')](),interaction[_0xf878('0xf')]('chat',_0xf878('0x10')),controller[_0xf878('0x11')]);router['put'](_0xf878('0xc'),controller['update']);router[_0xf878('0x12')](_0xf878('0x13'),auth[_0xf878('0xe')](),controller['accept']);router[_0xf878('0x12')](_0xf878('0x14'),auth[_0xf878('0xe')](),controller['reject']);router[_0xf878('0x15')](_0xf878('0xc'),auth[_0xf878('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0db9=['/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','express','Router','../../components/auth/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put'];(function(_0x4614e8,_0x6ff01f){var _0xbc235d=function(_0x222d05){while(--_0x222d05){_0x4614e8['push'](_0x4614e8['shift']());}};_0xbc235d(++_0x6ff01f);}(_0x0db9,0xa3));var _0x90db=function(_0x289a67,_0x1e5a3c){_0x289a67=_0x289a67-0x0;var _0x572b49=_0x0db9[_0x289a67];return _0x572b49;};'use strict';var multer=require(_0x90db('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x90db('0x1'));var router=express[_0x90db('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x90db('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x90db('0x4'));var controller=require(_0x90db('0x5'));router['get']('/',auth[_0x90db('0x6')](),controller[_0x90db('0x7')]);router[_0x90db('0x8')](_0x90db('0x9'),auth[_0x90db('0x6')](),controller[_0x90db('0xa')]);router['get'](_0x90db('0xb'),auth[_0x90db('0x6')](),controller[_0x90db('0xc')]);router[_0x90db('0xd')]('/',auth[_0x90db('0x6')](),interaction[_0x90db('0xe')](_0x90db('0xf'),_0x90db('0x10')),controller[_0x90db('0x11')]);router[_0x90db('0x12')](_0x90db('0xb'),controller['update']);router[_0x90db('0x12')](_0x90db('0x13'),auth[_0x90db('0x6')](),controller[_0x90db('0x14')]);router[_0x90db('0x12')](_0x90db('0x15'),auth[_0x90db('0x6')](),controller[_0x90db('0x16')]);router[_0x90db('0x17')](_0x90db('0xb'),auth[_0x90db('0x6')](),controller[_0x90db('0x18')]);module[_0x90db('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 902759d..527a768 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 _0x49cf=['exports','medium'];(function(_0x368bba,_0x1f625b){var _0x409f8f=function(_0x463373){while(--_0x463373){_0x368bba['push'](_0x368bba['shift']());}};_0x409f8f(++_0x1f625b);}(_0x49cf,0x134));var _0xf49c=function(_0x5179a9,_0x113275){_0x5179a9=_0x5179a9-0x0;var _0x2a6a02=_0x49cf[_0x5179a9];return _0x2a6a02;};'use strict';var Sequelize=require('sequelize');module[_0xf49c('0x0')]={'body':{'type':Sequelize['TEXT'](_0xf49c('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x3833=['sequelize','TEXT','medium'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x3833,0xd2));var _0x3383=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x3833[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require(_0x3383('0x0'));module['exports']={'body':{'type':Sequelize[_0x3383('0x1')](_0x3383('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 18932ae..668a1cd 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 _0x043b=['destroy','sendStatus','error','name','send','index','map','ChatOfflineMessage','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','length','include','create','body','Attachment','findAll','forEach','join','files','attachments','offline-chat','basename','existsSync','remove','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','count','offset','limit','Content-Range','json','apply','reject','update','then'];(function(_0x52fb98,_0x53e6f4){var _0x5e1098=function(_0x28ef9b){while(--_0x28ef9b){_0x52fb98['push'](_0x52fb98['shift']());}};_0x5e1098(++_0x53e6f4);}(_0x043b,0xd5));var _0xb043=function(_0x1d9b95,_0x19918e){_0x1d9b95=_0x1d9b95-0x0;var _0x53321d=_0x043b[_0x1d9b95];return _0x53321d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb043('0x0'));var zipdir=require(_0xb043('0x1'));var jsonpatch=require(_0xb043('0x2'));var rp=require(_0xb043('0x3'));var moment=require(_0xb043('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb043('0x5'));var util=require(_0xb043('0x6'));var path=require(_0xb043('0x7'));var sox=require(_0xb043('0x8'));var csv=require('to-csv');var ejs=require(_0xb043('0x9'));var fs=require('fs');var fs_extra=require(_0xb043('0xa'));var _=require(_0xb043('0xb'));var squel=require(_0xb043('0xc'));var crypto=require(_0xb043('0xd'));var jsforce=require(_0xb043('0xe'));var deskjs=require(_0xb043('0xf'));var toCsv=require(_0xb043('0x10'));var querystring=require(_0xb043('0x11'));var Papa=require(_0xb043('0x12'));var Redis=require('ioredis');var authService=require(_0xb043('0x13'));var qs=require(_0xb043('0x14'));var as=require(_0xb043('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb043('0x16'))(_0xb043('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb043('0x18'));var db=require(_0xb043('0x19'))['db'];function respondWithStatusCode(_0x4dc147,_0x14cfd1){_0x14cfd1=_0x14cfd1||0xcc;return function(_0x2977be){if(_0x2977be){return _0x4dc147['sendStatus'](_0x14cfd1);}return _0x4dc147['status'](_0x14cfd1)['end']();};}function respondWithResult(_0x1f1c16,_0x2b0aa3){_0x2b0aa3=_0x2b0aa3||0xc8;return function(_0x3dc40f){if(_0x3dc40f){return _0x1f1c16[_0xb043('0x1a')](_0x2b0aa3)['json'](_0x3dc40f);}};}function respondWithFilteredResult(_0x50505a,_0x2ee63a){return function(_0x25b38d){if(_0x25b38d){var _0x20faee=_0x25b38d[_0xb043('0x1b')],_0x1f9f0d=_0x2ee63a[_0xb043('0x1c')],_0x67af5=_0x2ee63a[_0xb043('0x1c')]+_0x2ee63a[_0xb043('0x1d')],_0x3f6d55;if(_0x67af5>=_0x20faee){_0x67af5=_0x20faee;_0x3f6d55=0xc8;}else{_0x3f6d55=0xce;}_0x50505a['status'](_0x3f6d55);return _0x50505a['set'](_0xb043('0x1e'),_0x1f9f0d+'-'+_0x67af5+'/'+_0x20faee)[_0xb043('0x1f')](_0x25b38d);}return null;};}function patchUpdates(_0x23e39a){return function(_0x11c4ed){try{jsonpatch[_0xb043('0x20')](_0x11c4ed,_0x23e39a,!![]);}catch(_0xbac9f7){return BPromise[_0xb043('0x21')](_0xbac9f7);}return _0x11c4ed['save']();};}function saveUpdates(_0xd6ec0c,_0x3ce815){return function(_0x4719ca){if(_0x4719ca){return _0x4719ca[_0xb043('0x22')](_0xd6ec0c)[_0xb043('0x23')](function(_0x40a10b){return _0x40a10b;});}return null;};}function removeEntity(_0x3d200d,_0x4f11d4){return function(_0x5c558c){if(_0x5c558c){return _0x5c558c[_0xb043('0x24')]()[_0xb043('0x23')](function(){_0x3d200d[_0xb043('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26a777,_0x5029da){return function(_0x1c1e18){if(!_0x1c1e18){_0x26a777[_0xb043('0x25')](0x194);}return _0x1c1e18;};}function handleError(_0x47efe4,_0x484581){_0x484581=_0x484581||0x1f4;return function(_0x47e8d3){logger[_0xb043('0x26')](_0x47e8d3['stack']);if(_0x47e8d3[_0xb043('0x27')]){delete _0x47e8d3['name'];}_0x47efe4[_0xb043('0x1a')](_0x484581)[_0xb043('0x28')](_0x47e8d3);};}exports[_0xb043('0x29')]=function(_0x5a8bf8,_0x4570b4){var _0x3cc770={},_0x1aea1f={},_0x278f4f={'count':0x0,'rows':[]};var _0x479e25=_[_0xb043('0x2a')](db[_0xb043('0x2b')]['rawAttributes'],function(_0x2d5d83){return{'name':_0x2d5d83[_0xb043('0x2c')],'type':_0x2d5d83[_0xb043('0x2d')][_0xb043('0x2e')]};});_0x1aea1f[_0xb043('0x2f')]=_[_0xb043('0x2a')](_0x479e25,_0xb043('0x27'));_0x1aea1f[_0xb043('0x30')]=_[_0xb043('0x31')](_0x5a8bf8[_0xb043('0x30')]);_0x1aea1f[_0xb043('0x32')]=_['intersection'](_0x1aea1f[_0xb043('0x2f')],_0x1aea1f[_0xb043('0x30')]);_0x3cc770[_0xb043('0x33')]=_[_0xb043('0x34')](_0x1aea1f[_0xb043('0x2f')],qs[_0xb043('0x35')](_0x5a8bf8[_0xb043('0x30')]['fields']));_0x3cc770[_0xb043('0x33')]=_0x3cc770[_0xb043('0x33')]['length']?_0x3cc770[_0xb043('0x33')]:_0x1aea1f[_0xb043('0x2f')];if(!_0x5a8bf8[_0xb043('0x30')][_0xb043('0x36')](_0xb043('0x37'))){_0x3cc770['limit']=qs[_0xb043('0x1d')](_0x5a8bf8[_0xb043('0x30')]['limit']);_0x3cc770[_0xb043('0x1c')]=qs[_0xb043('0x1c')](_0x5a8bf8[_0xb043('0x30')][_0xb043('0x1c')]);}_0x3cc770['order']=qs[_0xb043('0x38')](_0x5a8bf8['query']['sort']);_0x3cc770[_0xb043('0x39')]=qs[_0xb043('0x32')](_[_0xb043('0x3a')](_0x5a8bf8[_0xb043('0x30')],_0x1aea1f[_0xb043('0x32')]),_0x479e25);if(_0x5a8bf8[_0xb043('0x30')][_0xb043('0x3b')]){_0x3cc770['where']=_[_0xb043('0x3c')](_0x3cc770[_0xb043('0x39')],{'$or':_[_0xb043('0x2a')](_0x479e25,function(_0x293fbd){if(_0x293fbd[_0xb043('0x2d')]!==_0xb043('0x3d')){var _0x2246f6={};_0x2246f6[_0x293fbd['name']]={'$like':'%'+_0x5a8bf8['query'][_0xb043('0x3b')]+'%'};return _0x2246f6;}})});}_0x3cc770=_[_0xb043('0x3c')]({},_0x3cc770,_0x5a8bf8[_0xb043('0x3e')]);var _0x1de540={'where':_0x3cc770[_0xb043('0x39')]};return db['ChatOfflineMessage']['count'](_0x1de540)[_0xb043('0x23')](function(_0x3723e3){_0x278f4f[_0xb043('0x1b')]=_0x3723e3;if(_0x5a8bf8['query'][_0xb043('0x3f')]){_0x3cc770['include']=[{'all':!![]}];}return db['ChatOfflineMessage']['findAll'](_0x3cc770);})[_0xb043('0x23')](function(_0x3ed9d2){_0x278f4f[_0xb043('0x40')]=_0x3ed9d2;return _0x278f4f;})[_0xb043('0x23')](respondWithFilteredResult(_0x4570b4,_0x3cc770))[_0xb043('0x41')](handleError(_0x4570b4,null));};exports[_0xb043('0x42')]=function(_0x25d19a,_0x77fd6b){var _0x3ce0fa={'raw':!![],'where':{'id':_0x25d19a[_0xb043('0x43')]['id']}},_0x17e5ef={};_0x17e5ef[_0xb043('0x2f')]=_['keys'](db[_0xb043('0x2b')]['rawAttributes']);_0x17e5ef[_0xb043('0x30')]=_[_0xb043('0x31')](_0x25d19a['query']);_0x17e5ef[_0xb043('0x32')]=_[_0xb043('0x34')](_0x17e5ef[_0xb043('0x2f')],_0x17e5ef[_0xb043('0x30')]);_0x3ce0fa[_0xb043('0x33')]=_[_0xb043('0x34')](_0x17e5ef[_0xb043('0x2f')],qs['fields'](_0x25d19a[_0xb043('0x30')][_0xb043('0x35')]));_0x3ce0fa['attributes']=_0x3ce0fa['attributes'][_0xb043('0x44')]?_0x3ce0fa[_0xb043('0x33')]:_0x17e5ef[_0xb043('0x2f')];if(_0x25d19a[_0xb043('0x30')][_0xb043('0x3f')]){_0x3ce0fa[_0xb043('0x45')]=[{'all':!![]}];}_0x3ce0fa=_[_0xb043('0x3c')]({},_0x3ce0fa,_0x25d19a[_0xb043('0x3e')]);return db['ChatOfflineMessage']['find'](_0x3ce0fa)[_0xb043('0x23')](handleEntityNotFound(_0x77fd6b,null))[_0xb043('0x23')](respondWithResult(_0x77fd6b,null))[_0xb043('0x41')](handleError(_0x77fd6b,null));};exports[_0xb043('0x46')]=function(_0x1c7c81,_0x35a872){return db['ChatOfflineMessage'][_0xb043('0x46')](_0x1c7c81[_0xb043('0x47')],{})[_0xb043('0x23')](respondWithResult(_0x35a872,0xc9))[_0xb043('0x41')](handleError(_0x35a872,null));};exports[_0xb043('0x22')]=function(_0x193ad8,_0x36c129){if(_0x193ad8[_0xb043('0x47')]['id']){delete _0x193ad8[_0xb043('0x47')]['id'];}return db['ChatOfflineMessage']['find']({'where':{'id':_0x193ad8[_0xb043('0x43')]['id']}})[_0xb043('0x23')](handleEntityNotFound(_0x36c129,null))[_0xb043('0x23')](saveUpdates(_0x193ad8['body'],null))['then'](respondWithResult(_0x36c129,null))[_0xb043('0x41')](handleError(_0x36c129,null));};exports[_0xb043('0x24')]=function(_0xff007e,_0x4c8958){return db[_0xb043('0x48')][_0xb043('0x49')]({'where':{'ChatOfflineMessageId':_0xff007e['params']['id']},'raw':!![]})[_0xb043('0x23')](function(_0x4c435a){_0x4c435a[_0xb043('0x4a')](function(_0x41ffde){var _0x67586e=path[_0xb043('0x4b')](config['root'],'server',_0xb043('0x4c'),_0xb043('0x4d'),_0xb043('0x4e'),_0x41ffde[_0xb043('0x4f')]);var _0x4d93bb=fs[_0xb043('0x50')](_0x67586e);if(_0x4d93bb)fs_extra[_0xb043('0x51')](_0x67586e);});})['then'](function(){return db[_0xb043('0x2b')]['find']({'where':{'id':_0xff007e[_0xb043('0x43')]['id']},'individualHooks':!![]});})[_0xb043('0x23')](handleEntityNotFound(_0x4c8958,null))[_0xb043('0x23')](removeEntity(_0x4c8958,null))[_0xb043('0x41')](handleError(_0x4c8958,null));};exports['describe']=function(_0x5c729e,_0x22df01){return db[_0xb043('0x2b')][_0xb043('0x52')]()[_0xb043('0x23')](respondWithResult(_0x22df01,null))['catch'](handleError(_0x22df01,null));}; \ No newline at end of file +var _0x2b43=['options','includeAll','include','findAll','show','params','catch','create','body','find','Attachment','forEach','join','root','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','map','ChatOfflineMessage','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','sort','where','filters','pick','filter','merge','VIRTUAL'];(function(_0x48a2e2,_0x46d3a5){var _0xcc3349=function(_0x232fa0){while(--_0x232fa0){_0x48a2e2['push'](_0x48a2e2['shift']());}};_0xcc3349(++_0x46d3a5);}(_0x2b43,0x66));var _0x32b4=function(_0x3199af,_0x339560){_0x3199af=_0x3199af-0x0;var _0x5aa4d0=_0x2b43[_0x3199af];return _0x5aa4d0;};'use strict';var emlformat=require(_0x32b4('0x0'));var rimraf=require(_0x32b4('0x1'));var zipdir=require(_0x32b4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x32b4('0x3'));var moment=require(_0x32b4('0x4'));var BPromise=require(_0x32b4('0x5'));var Mustache=require(_0x32b4('0x6'));var util=require('util');var path=require(_0x32b4('0x7'));var sox=require(_0x32b4('0x8'));var csv=require('to-csv');var ejs=require(_0x32b4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x32b4('0xa'));var crypto=require(_0x32b4('0xb'));var jsforce=require(_0x32b4('0xc'));var deskjs=require(_0x32b4('0xd'));var toCsv=require(_0x32b4('0xe'));var querystring=require('querystring');var Papa=require(_0x32b4('0xf'));var Redis=require(_0x32b4('0x10'));var authService=require(_0x32b4('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32b4('0x12'));var logger=require(_0x32b4('0x13'))(_0x32b4('0x14'));var utils=require(_0x32b4('0x15'));var config=require(_0x32b4('0x16'));var licenseUtil=require(_0x32b4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2dec51,_0x6c18e4){_0x6c18e4=_0x6c18e4||0xcc;return function(_0x1e26d1){if(_0x1e26d1){return _0x2dec51[_0x32b4('0x18')](_0x6c18e4);}return _0x2dec51[_0x32b4('0x19')](_0x6c18e4)[_0x32b4('0x1a')]();};}function respondWithResult(_0xb1f5fc,_0x46c198){_0x46c198=_0x46c198||0xc8;return function(_0x5a95aa){if(_0x5a95aa){return _0xb1f5fc[_0x32b4('0x19')](_0x46c198)[_0x32b4('0x1b')](_0x5a95aa);}};}function respondWithFilteredResult(_0x3550fb,_0x28fc8c){return function(_0x4836db){if(_0x4836db){var _0x1c5f5b=_0x4836db[_0x32b4('0x1c')],_0x14a1c8=_0x28fc8c['offset'],_0x653d81=_0x28fc8c['offset']+_0x28fc8c['limit'],_0x4e7fb6;if(_0x653d81>=_0x1c5f5b){_0x653d81=_0x1c5f5b;_0x4e7fb6=0xc8;}else{_0x4e7fb6=0xce;}_0x3550fb['status'](_0x4e7fb6);return _0x3550fb[_0x32b4('0x1d')](_0x32b4('0x1e'),_0x14a1c8+'-'+_0x653d81+'/'+_0x1c5f5b)[_0x32b4('0x1b')](_0x4836db);}return null;};}function patchUpdates(_0x59fe9e){return function(_0x4e8277){try{jsonpatch[_0x32b4('0x1f')](_0x4e8277,_0x59fe9e,!![]);}catch(_0x407138){return BPromise[_0x32b4('0x20')](_0x407138);}return _0x4e8277[_0x32b4('0x21')]();};}function saveUpdates(_0xb870f8,_0x14ad4e){return function(_0x2ef9ec){if(_0x2ef9ec){return _0x2ef9ec[_0x32b4('0x22')](_0xb870f8)[_0x32b4('0x23')](function(_0x7e06a7){return _0x7e06a7;});}return null;};}function removeEntity(_0x2b7a77,_0x4803cd){return function(_0x428d3b){if(_0x428d3b){return _0x428d3b[_0x32b4('0x24')]()[_0x32b4('0x23')](function(){_0x2b7a77['status'](0xcc)[_0x32b4('0x1a')]();});}};}function handleEntityNotFound(_0x55e9db,_0x1eb951){return function(_0x541be6){if(!_0x541be6){_0x55e9db[_0x32b4('0x18')](0x194);}return _0x541be6;};}function handleError(_0x49159f,_0x25a92e){_0x25a92e=_0x25a92e||0x1f4;return function(_0x5dc045){logger['error'](_0x5dc045[_0x32b4('0x25')]);if(_0x5dc045[_0x32b4('0x26')]){delete _0x5dc045[_0x32b4('0x26')];}_0x49159f['status'](_0x25a92e)['send'](_0x5dc045);};}exports['index']=function(_0x583cc8,_0x4cba31){var _0x136382={},_0x5b0087={},_0x2b7624={'count':0x0,'rows':[]};var _0x55c878=_[_0x32b4('0x27')](db[_0x32b4('0x28')][_0x32b4('0x29')],function(_0x38bfa4){return{'name':_0x38bfa4['fieldName'],'type':_0x38bfa4[_0x32b4('0x2a')][_0x32b4('0x2b')]};});_0x5b0087['model']=_[_0x32b4('0x27')](_0x55c878,'name');_0x5b0087[_0x32b4('0x2c')]=_[_0x32b4('0x2d')](_0x583cc8['query']);_0x5b0087['filters']=_[_0x32b4('0x2e')](_0x5b0087[_0x32b4('0x2f')],_0x5b0087[_0x32b4('0x2c')]);_0x136382[_0x32b4('0x30')]=_[_0x32b4('0x2e')](_0x5b0087[_0x32b4('0x2f')],qs[_0x32b4('0x31')](_0x583cc8[_0x32b4('0x2c')][_0x32b4('0x31')]));_0x136382[_0x32b4('0x30')]=_0x136382['attributes'][_0x32b4('0x32')]?_0x136382['attributes']:_0x5b0087['model'];if(!_0x583cc8[_0x32b4('0x2c')][_0x32b4('0x33')](_0x32b4('0x34'))){_0x136382[_0x32b4('0x35')]=qs[_0x32b4('0x35')](_0x583cc8[_0x32b4('0x2c')][_0x32b4('0x35')]);_0x136382[_0x32b4('0x36')]=qs['offset'](_0x583cc8['query'][_0x32b4('0x36')]);}_0x136382['order']=qs[_0x32b4('0x37')](_0x583cc8[_0x32b4('0x2c')][_0x32b4('0x37')]);_0x136382[_0x32b4('0x38')]=qs[_0x32b4('0x39')](_[_0x32b4('0x3a')](_0x583cc8[_0x32b4('0x2c')],_0x5b0087[_0x32b4('0x39')]),_0x55c878);if(_0x583cc8[_0x32b4('0x2c')][_0x32b4('0x3b')]){_0x136382[_0x32b4('0x38')]=_[_0x32b4('0x3c')](_0x136382[_0x32b4('0x38')],{'$or':_[_0x32b4('0x27')](_0x55c878,function(_0x41c47c){if(_0x41c47c[_0x32b4('0x2a')]!==_0x32b4('0x3d')){var _0x4f38b3={};_0x4f38b3[_0x41c47c[_0x32b4('0x26')]]={'$like':'%'+_0x583cc8[_0x32b4('0x2c')][_0x32b4('0x3b')]+'%'};return _0x4f38b3;}})});}_0x136382=_['merge']({},_0x136382,_0x583cc8[_0x32b4('0x3e')]);var _0x583111={'where':_0x136382[_0x32b4('0x38')]};return db[_0x32b4('0x28')]['count'](_0x583111)['then'](function(_0xaa2a2f){_0x2b7624[_0x32b4('0x1c')]=_0xaa2a2f;if(_0x583cc8['query'][_0x32b4('0x3f')]){_0x136382[_0x32b4('0x40')]=[{'all':!![]}];}return db[_0x32b4('0x28')][_0x32b4('0x41')](_0x136382);})[_0x32b4('0x23')](function(_0x54a434){_0x2b7624['rows']=_0x54a434;return _0x2b7624;})[_0x32b4('0x23')](respondWithFilteredResult(_0x4cba31,_0x136382))['catch'](handleError(_0x4cba31,null));};exports[_0x32b4('0x42')]=function(_0x56698d,_0xba7648){var _0x2a48aa={'raw':!![],'where':{'id':_0x56698d[_0x32b4('0x43')]['id']}},_0x566ac1={};_0x566ac1[_0x32b4('0x2f')]=_[_0x32b4('0x2d')](db['ChatOfflineMessage'][_0x32b4('0x29')]);_0x566ac1[_0x32b4('0x2c')]=_[_0x32b4('0x2d')](_0x56698d[_0x32b4('0x2c')]);_0x566ac1[_0x32b4('0x39')]=_[_0x32b4('0x2e')](_0x566ac1[_0x32b4('0x2f')],_0x566ac1['query']);_0x2a48aa[_0x32b4('0x30')]=_[_0x32b4('0x2e')](_0x566ac1[_0x32b4('0x2f')],qs[_0x32b4('0x31')](_0x56698d[_0x32b4('0x2c')][_0x32b4('0x31')]));_0x2a48aa['attributes']=_0x2a48aa[_0x32b4('0x30')][_0x32b4('0x32')]?_0x2a48aa['attributes']:_0x566ac1[_0x32b4('0x2f')];if(_0x56698d[_0x32b4('0x2c')][_0x32b4('0x3f')]){_0x2a48aa[_0x32b4('0x40')]=[{'all':!![]}];}_0x2a48aa=_[_0x32b4('0x3c')]({},_0x2a48aa,_0x56698d[_0x32b4('0x3e')]);return db[_0x32b4('0x28')]['find'](_0x2a48aa)[_0x32b4('0x23')](handleEntityNotFound(_0xba7648,null))[_0x32b4('0x23')](respondWithResult(_0xba7648,null))[_0x32b4('0x44')](handleError(_0xba7648,null));};exports[_0x32b4('0x45')]=function(_0x7b4e4b,_0x5f3ce1){return db['ChatOfflineMessage'][_0x32b4('0x45')](_0x7b4e4b['body'],{})[_0x32b4('0x23')](respondWithResult(_0x5f3ce1,0xc9))[_0x32b4('0x44')](handleError(_0x5f3ce1,null));};exports[_0x32b4('0x22')]=function(_0x3acabb,_0x220b2b){if(_0x3acabb['body']['id']){delete _0x3acabb[_0x32b4('0x46')]['id'];}return db[_0x32b4('0x28')][_0x32b4('0x47')]({'where':{'id':_0x3acabb[_0x32b4('0x43')]['id']}})[_0x32b4('0x23')](handleEntityNotFound(_0x220b2b,null))['then'](saveUpdates(_0x3acabb[_0x32b4('0x46')],null))[_0x32b4('0x23')](respondWithResult(_0x220b2b,null))[_0x32b4('0x44')](handleError(_0x220b2b,null));};exports['destroy']=function(_0x1b6db0,_0x1b301b){return db[_0x32b4('0x48')]['findAll']({'where':{'ChatOfflineMessageId':_0x1b6db0[_0x32b4('0x43')]['id']},'raw':!![]})[_0x32b4('0x23')](function(_0x1d3e76){_0x1d3e76[_0x32b4('0x49')](function(_0xf7885c){var _0x45f333=path[_0x32b4('0x4a')](config[_0x32b4('0x4b')],'server',_0x32b4('0x4c'),_0x32b4('0x4d'),'offline-chat',_0xf7885c[_0x32b4('0x4e')]);var _0x425c2c=fs[_0x32b4('0x4f')](_0x45f333);if(_0x425c2c)fs_extra[_0x32b4('0x50')](_0x45f333);});})['then'](function(){return db['ChatOfflineMessage'][_0x32b4('0x47')]({'where':{'id':_0x1b6db0['params']['id']},'individualHooks':!![]});})[_0x32b4('0x23')](handleEntityNotFound(_0x1b301b,null))[_0x32b4('0x23')](removeEntity(_0x1b301b,null))['catch'](handleError(_0x1b301b,null));};exports[_0x32b4('0x51')]=function(_0x3d7952,_0x578fa0){return db['ChatOfflineMessage'][_0x32b4('0x51')]()['then'](respondWithResult(_0x578fa0,null))[_0x32b4('0x44')](handleError(_0x578fa0,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index a60f364..33aedc6 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 _0x524a=['./chatOfflineMessage.attributes','exports','define','chat_offline_messages','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x126eeb,_0x2608d7){var _0x5e0435=function(_0x69056e){while(--_0x69056e){_0x126eeb['push'](_0x126eeb['shift']());}};_0x5e0435(++_0x2608d7);}(_0x524a,0xf5));var _0xa524=function(_0x3ae7b9,_0xfcf3e0){_0x3ae7b9=_0x3ae7b9-0x0;var _0x1b8b39=_0x524a[_0x3ae7b9];return _0x1b8b39;};'use strict';var _=require(_0xa524('0x0'));var util=require(_0xa524('0x1'));var logger=require(_0xa524('0x2'))(_0xa524('0x3'));var moment=require('moment');var BPromise=require(_0xa524('0x4'));var rp=require(_0xa524('0x5'));var fs=require('fs');var path=require(_0xa524('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa524('0x7'));module[_0xa524('0x8')]=function(_0x16227b,_0x5f472f){return _0x16227b[_0xa524('0x9')]('ChatOfflineMessage',attributes,{'tableName':_0xa524('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa524('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2123=['bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x25da3c,_0x249618){var _0x3e61a2=function(_0x252963){while(--_0x252963){_0x25da3c['push'](_0x25da3c['shift']());}};_0x3e61a2(++_0x249618);}(_0x2123,0x190));var _0x3212=function(_0xd099b9,_0x1ae821){_0xd099b9=_0xd099b9-0x0;var _0x12a5bb=_0x2123[_0xd099b9];return _0x12a5bb;};'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'));module[_0x3212('0xb')]=function(_0x5d9d36,_0x3859e4){return _0x5d9d36[_0x3212('0xc')](_0x3212('0xd'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3212('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index e2ed7fd..d7d16e8 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 _0xe7b4=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0xa1b5fb,_0x41a2bd){var _0x123597=function(_0x1b3157){while(--_0x1b3157){_0xa1b5fb['push'](_0xa1b5fb['shift']());}};_0x123597(++_0x41a2bd);}(_0xe7b4,0x11f));var _0x4e7b=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xe7b4[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x4e7b('0x0'));var util=require(_0x4e7b('0x1'));var moment=require(_0x4e7b('0x2'));var BPromise=require(_0x4e7b('0x3'));var rs=require(_0x4e7b('0x4'));var fs=require('fs');var Redis=require(_0x4e7b('0x5'));var db=require(_0x4e7b('0x6'))['db'];var utils=require(_0x4e7b('0x7'));var logger=require(_0x4e7b('0x8'))(_0x4e7b('0x9'));var config=require(_0x4e7b('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x4e7b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x148146,_0x5417bb,_0x494d1c){return new BPromise(function(_0x566b2c,_0x224dc1){return client[_0x4e7b('0xc')](_0x148146,_0x494d1c)['then'](function(_0x374532){logger['info'](_0x4e7b('0xd'),_0x5417bb,_0x4e7b('0xe'));logger[_0x4e7b('0xf')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x5417bb,_0x4e7b('0xe'),JSON[_0x4e7b('0x10')](_0x374532));if(_0x374532[_0x4e7b('0x11')]){if(_0x374532[_0x4e7b('0x11')][_0x4e7b('0x12')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x5417bb,_0x374532[_0x4e7b('0x11')]['message']);return _0x224dc1(_0x374532[_0x4e7b('0x11')][_0x4e7b('0x13')]);}logger[_0x4e7b('0x11')](_0x4e7b('0xd'),_0x5417bb,_0x374532[_0x4e7b('0x11')][_0x4e7b('0x13')]);return _0x566b2c(_0x374532[_0x4e7b('0x11')][_0x4e7b('0x13')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x5417bb,_0x4e7b('0xe'));_0x566b2c(_0x374532[_0x4e7b('0x14')][_0x4e7b('0x13')]);}})[_0x4e7b('0x15')](function(_0x305567){logger['error'](_0x4e7b('0xd'),_0x5417bb,_0x305567);_0x224dc1(_0x305567);});});} \ No newline at end of file +var _0x9868=['../../mysqldb','../../config/utils','../../config/logger','client','request','then','info','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring'];(function(_0x39bfb6,_0x4272c8){var _0x23fef9=function(_0x5f83c1){while(--_0x5f83c1){_0x39bfb6['push'](_0x39bfb6['shift']());}};_0x23fef9(++_0x4272c8);}(_0x9868,0x178));var _0x8986=function(_0x3c7e64,_0x2edef3){_0x3c7e64=_0x3c7e64-0x0;var _0x268b16=_0x9868[_0x3c7e64];return _0x268b16;};'use strict';var _=require(_0x8986('0x0'));var util=require(_0x8986('0x1'));var moment=require('moment');var BPromise=require(_0x8986('0x2'));var rs=require(_0x8986('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8986('0x4'))['db'];var utils=require(_0x8986('0x5'));var logger=require(_0x8986('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8986('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25b204,_0x143b21,_0x3e5c2e){return new BPromise(function(_0x42c04b,_0x550509){return client[_0x8986('0x8')](_0x25b204,_0x3e5c2e)[_0x8986('0x9')](function(_0x214c46){logger[_0x8986('0xa')]('ChatOfflineMessage,\x20%s,\x20%s',_0x143b21,'request\x20sent');logger[_0x8986('0xb')](_0x8986('0xc'),_0x143b21,_0x8986('0xd'),JSON[_0x8986('0xe')](_0x214c46));if(_0x214c46[_0x8986('0xf')]){if(_0x214c46[_0x8986('0xf')][_0x8986('0x10')]===0x1f4){logger[_0x8986('0xf')](_0x8986('0x11'),_0x143b21,_0x214c46[_0x8986('0xf')][_0x8986('0x12')]);return _0x550509(_0x214c46[_0x8986('0xf')]['message']);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x143b21,_0x214c46[_0x8986('0xf')][_0x8986('0x12')]);return _0x42c04b(_0x214c46['error'][_0x8986('0x12')]);}else{logger[_0x8986('0xa')](_0x8986('0x11'),_0x143b21,_0x8986('0xd'));_0x42c04b(_0x214c46[_0x8986('0x13')]['message']);}})['catch'](function(_0xba2428){logger[_0x8986('0xf')](_0x8986('0x11'),_0x143b21,_0xba2428);_0x550509(_0xba2428);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index d356256..469d750 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 _0x4212=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','delete','multer','util'];(function(_0x590382,_0x4b7279){var _0x329c42=function(_0x26752c){while(--_0x26752c){_0x590382['push'](_0x590382['shift']());}};_0x329c42(++_0x4b7279);}(_0x4212,0x1ae));var _0x2421=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x4212[_0x42245d];return _0x4b211a;};'use strict';var multer=require(_0x2421('0x0'));var util=require(_0x2421('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2421('0x2'));var router=express['Router']();var fs_extra=require(_0x2421('0x3'));var auth=require(_0x2421('0x4'));var interaction=require(_0x2421('0x5'));var config=require('../../config/environment');var controller=require(_0x2421('0x6'));router[_0x2421('0x7')]('/',auth[_0x2421('0x8')](),controller[_0x2421('0x9')]);router[_0x2421('0x7')](_0x2421('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x2421('0x7')](_0x2421('0xb'),auth[_0x2421('0x8')](),controller['show']);router[_0x2421('0xc')]('/',auth[_0x2421('0x8')](),controller[_0x2421('0xd')]);router[_0x2421('0xe')](_0x2421('0xb'),auth[_0x2421('0x8')](),controller['update']);router[_0x2421('0xf')](_0x2421('0xb'),auth[_0x2421('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4604=['Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x227c59,_0x575c83){var _0x35aeac=function(_0x477179){while(--_0x477179){_0x227c59['push'](_0x227c59['shift']());}};_0x35aeac(++_0x575c83);}(_0x4604,0x1e1));var _0x4460=function(_0xea37f7,_0x1c492b){_0xea37f7=_0xea37f7-0x0;var _0x2f14d5=_0x4604[_0xea37f7];return _0x2f14d5;};'use strict';var multer=require(_0x4460('0x0'));var util=require(_0x4460('0x1'));var path=require(_0x4460('0x2'));var timeout=require(_0x4460('0x3'));var express=require(_0x4460('0x4'));var router=express[_0x4460('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4460('0x6'));var config=require(_0x4460('0x7'));var controller=require('./chatOfflineMessage.controller');router[_0x4460('0x8')]('/',auth[_0x4460('0x9')](),controller[_0x4460('0xa')]);router[_0x4460('0x8')]('/describe',auth[_0x4460('0x9')](),controller['describe']);router[_0x4460('0x8')](_0x4460('0xb'),auth[_0x4460('0x9')](),controller[_0x4460('0xc')]);router[_0x4460('0xd')]('/',auth[_0x4460('0x9')](),controller[_0x4460('0xe')]);router[_0x4460('0xf')](_0x4460('0xb'),auth[_0x4460('0x9')](),controller['update']);router[_0x4460('0x10')](_0x4460('0xb'),auth['isAuthenticated'](),controller[_0x4460('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index fa38f6b..d5dc183 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 _0x5990=['ENUM','mouseOver','timeout','INTEGER','sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5990,0x107));var _0x0599=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5990[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x0599('0x0'));module[_0x0599('0x1')]={'name':{'type':Sequelize[_0x0599('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0599('0x3')](_0x0599('0x4'),_0x0599('0x5')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x0599('0x2')]},'timeout':{'type':Sequelize[_0x0599('0x6')]}}; \ No newline at end of file +var _0x8724=['mouseOver','timeout','INTEGER','exports','STRING','ENUM'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8724,0x8d));var _0x4872=function(_0x49710d,_0x527bd4){_0x49710d=_0x49710d-0x0;var _0x3ffb4b=_0x8724[_0x49710d];return _0x3ffb4b;};'use strict';var Sequelize=require('sequelize');module[_0x4872('0x0')]={'name':{'type':Sequelize[_0x4872('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x4872('0x2')](_0x4872('0x3'),_0x4872('0x4')),'defaultValue':_0x4872('0x3')},'selector':{'type':Sequelize[_0x4872('0x1')]},'timeout':{'type':Sequelize[_0x4872('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index f15d199..c5730fc 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 _0x1836=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','status','count','offset','limit','Content-Range','json','reject','update','destroy','then','sendStatus','stack','name','model','keys','ChatProactiveAction','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse'];(function(_0x4e3079,_0x2e48ea){var _0x4356fb=function(_0x3f31e0){while(--_0x3f31e0){_0x4e3079['push'](_0x4e3079['shift']());}};_0x4356fb(++_0x2e48ea);}(_0x1836,0x126));var _0x6183=function(_0x1c0bae,_0x575469){_0x1c0bae=_0x1c0bae-0x0;var _0x1a70e1=_0x1836[_0x1c0bae];return _0x1a70e1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6183('0x0'));var zipdir=require(_0x6183('0x1'));var jsonpatch=require(_0x6183('0x2'));var rp=require(_0x6183('0x3'));var moment=require(_0x6183('0x4'));var BPromise=require(_0x6183('0x5'));var Mustache=require(_0x6183('0x6'));var util=require(_0x6183('0x7'));var path=require('path');var sox=require(_0x6183('0x8'));var csv=require('to-csv');var ejs=require(_0x6183('0x9'));var fs=require('fs');var fs_extra=require(_0x6183('0xa'));var _=require(_0x6183('0xb'));var squel=require(_0x6183('0xc'));var crypto=require(_0x6183('0xd'));var jsforce=require(_0x6183('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6183('0xf'));var querystring=require(_0x6183('0x10'));var Papa=require(_0x6183('0x11'));var Redis=require(_0x6183('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6183('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6183('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x6183('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f1635,_0x361be4){_0x361be4=_0x361be4||0xcc;return function(_0x38e4dc){if(_0x38e4dc){return _0x3f1635['sendStatus'](_0x361be4);}return _0x3f1635[_0x6183('0x16')](_0x361be4)['end']();};}function respondWithResult(_0x297099,_0x140f87){_0x140f87=_0x140f87||0xc8;return function(_0x17cebd){if(_0x17cebd){return _0x297099['status'](_0x140f87)['json'](_0x17cebd);}};}function respondWithFilteredResult(_0x4f3ed1,_0xafd1ad){return function(_0x24a146){if(_0x24a146){var _0x580a5a=_0x24a146[_0x6183('0x17')],_0x55d867=_0xafd1ad[_0x6183('0x18')],_0x19e5d3=_0xafd1ad[_0x6183('0x18')]+_0xafd1ad[_0x6183('0x19')],_0x40a69f;if(_0x19e5d3>=_0x580a5a){_0x19e5d3=_0x580a5a;_0x40a69f=0xc8;}else{_0x40a69f=0xce;}_0x4f3ed1[_0x6183('0x16')](_0x40a69f);return _0x4f3ed1['set'](_0x6183('0x1a'),_0x55d867+'-'+_0x19e5d3+'/'+_0x580a5a)[_0x6183('0x1b')](_0x24a146);}return null;};}function patchUpdates(_0x5190bb){return function(_0x28973c){try{jsonpatch['apply'](_0x28973c,_0x5190bb,!![]);}catch(_0x3b8b1b){return BPromise[_0x6183('0x1c')](_0x3b8b1b);}return _0x28973c['save']();};}function saveUpdates(_0x55ef71,_0x3ee5d2){return function(_0x227254){if(_0x227254){return _0x227254[_0x6183('0x1d')](_0x55ef71)['then'](function(_0x339ae5){return _0x339ae5;});}return null;};}function removeEntity(_0x397d65,_0x1bb37d){return function(_0x217517){if(_0x217517){return _0x217517[_0x6183('0x1e')]()[_0x6183('0x1f')](function(){_0x397d65['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a2286,_0x5e8b07){return function(_0x61858b){if(!_0x61858b){_0x5a2286[_0x6183('0x20')](0x194);}return _0x61858b;};}function handleError(_0x6e4edf,_0x596334){_0x596334=_0x596334||0x1f4;return function(_0x431246){logger['error'](_0x431246[_0x6183('0x21')]);if(_0x431246['name']){delete _0x431246[_0x6183('0x22')];}_0x6e4edf[_0x6183('0x16')](_0x596334)['send'](_0x431246);};}exports['show']=function(_0xa0d49e,_0x53baab){var _0xd35f17={'raw':!![],'where':{'id':_0xa0d49e['params']['id']}},_0x177511={};_0x177511[_0x6183('0x23')]=_[_0x6183('0x24')](db[_0x6183('0x25')]['rawAttributes']);_0x177511['query']=_[_0x6183('0x24')](_0xa0d49e[_0x6183('0x26')]);_0x177511[_0x6183('0x27')]=_[_0x6183('0x28')](_0x177511[_0x6183('0x23')],_0x177511[_0x6183('0x26')]);_0xd35f17[_0x6183('0x29')]=_[_0x6183('0x28')](_0x177511[_0x6183('0x23')],qs[_0x6183('0x2a')](_0xa0d49e[_0x6183('0x26')][_0x6183('0x2a')]));_0xd35f17[_0x6183('0x29')]=_0xd35f17[_0x6183('0x29')][_0x6183('0x2b')]?_0xd35f17[_0x6183('0x29')]:_0x177511['model'];if(_0xa0d49e['query'][_0x6183('0x2c')]){_0xd35f17['include']=[{'all':!![]}];}_0xd35f17=_[_0x6183('0x2d')]({},_0xd35f17,_0xa0d49e[_0x6183('0x2e')]);return db['ChatProactiveAction'][_0x6183('0x2f')](_0xd35f17)['then'](handleEntityNotFound(_0x53baab,null))[_0x6183('0x1f')](respondWithResult(_0x53baab,null))[_0x6183('0x30')](handleError(_0x53baab,null));};exports[_0x6183('0x31')]=function(_0x1de353,_0xa4260d){return db['ChatProactiveAction'][_0x6183('0x31')](_0x1de353[_0x6183('0x32')],{})[_0x6183('0x1f')](respondWithResult(_0xa4260d,0xc9))[_0x6183('0x30')](handleError(_0xa4260d,null));};exports[_0x6183('0x1d')]=function(_0x2f1b5b,_0x45711){if(_0x2f1b5b['body']['id']){delete _0x2f1b5b[_0x6183('0x32')]['id'];}return db['ChatProactiveAction'][_0x6183('0x2f')]({'where':{'id':_0x2f1b5b[_0x6183('0x33')]['id']}})['then'](handleEntityNotFound(_0x45711,null))['then'](saveUpdates(_0x2f1b5b[_0x6183('0x32')],null))[_0x6183('0x1f')](respondWithResult(_0x45711,null))[_0x6183('0x30')](handleError(_0x45711,null));};exports[_0x6183('0x1e')]=function(_0x175192,_0x45a889){return db[_0x6183('0x25')][_0x6183('0x2f')]({'where':{'id':_0x175192['params']['id']}})['then'](handleEntityNotFound(_0x45a889,null))[_0x6183('0x1f')](removeEntity(_0x45a889,null))[_0x6183('0x30')](handleError(_0x45a889,null));}; \ No newline at end of file +var _0x1c46=['send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','merge','options','find','create','catch','update','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','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','sendStatus','status','end','json','offset','set','apply','reject','save','then','destroy','error','name'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0x1c46,0x141));var _0x61c4=function(_0x1070b2,_0x37176e){_0x1070b2=_0x1070b2-0x0;var _0x184baa=_0x1c46[_0x1070b2];return _0x184baa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x61c4('0x0'));var zipdir=require(_0x61c4('0x1'));var jsonpatch=require(_0x61c4('0x2'));var rp=require(_0x61c4('0x3'));var moment=require(_0x61c4('0x4'));var BPromise=require(_0x61c4('0x5'));var Mustache=require(_0x61c4('0x6'));var util=require(_0x61c4('0x7'));var path=require(_0x61c4('0x8'));var sox=require('sox');var csv=require(_0x61c4('0x9'));var ejs=require(_0x61c4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x61c4('0xb'));var squel=require(_0x61c4('0xc'));var crypto=require(_0x61c4('0xd'));var jsforce=require(_0x61c4('0xe'));var deskjs=require(_0x61c4('0xf'));var toCsv=require('to-csv');var querystring=require(_0x61c4('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x61c4('0x11'));var qs=require(_0x61c4('0x12'));var as=require(_0x61c4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61c4('0x14'))(_0x61c4('0x15'));var utils=require(_0x61c4('0x16'));var config=require(_0x61c4('0x17'));var licenseUtil=require(_0x61c4('0x18'));var db=require(_0x61c4('0x19'))['db'];function respondWithStatusCode(_0x17b4ad,_0x2ec76c){_0x2ec76c=_0x2ec76c||0xcc;return function(_0x212573){if(_0x212573){return _0x17b4ad[_0x61c4('0x1a')](_0x2ec76c);}return _0x17b4ad[_0x61c4('0x1b')](_0x2ec76c)[_0x61c4('0x1c')]();};}function respondWithResult(_0x3580d7,_0x4a2440){_0x4a2440=_0x4a2440||0xc8;return function(_0x471cdc){if(_0x471cdc){return _0x3580d7[_0x61c4('0x1b')](_0x4a2440)[_0x61c4('0x1d')](_0x471cdc);}};}function respondWithFilteredResult(_0x584c5c,_0x394f87){return function(_0x3dd7e2){if(_0x3dd7e2){var _0x153076=_0x3dd7e2['count'],_0x2ff79e=_0x394f87[_0x61c4('0x1e')],_0x430338=_0x394f87[_0x61c4('0x1e')]+_0x394f87['limit'],_0x98ed95;if(_0x430338>=_0x153076){_0x430338=_0x153076;_0x98ed95=0xc8;}else{_0x98ed95=0xce;}_0x584c5c[_0x61c4('0x1b')](_0x98ed95);return _0x584c5c[_0x61c4('0x1f')]('Content-Range',_0x2ff79e+'-'+_0x430338+'/'+_0x153076)[_0x61c4('0x1d')](_0x3dd7e2);}return null;};}function patchUpdates(_0x5c3875){return function(_0x26fcd1){try{jsonpatch[_0x61c4('0x20')](_0x26fcd1,_0x5c3875,!![]);}catch(_0x269470){return BPromise[_0x61c4('0x21')](_0x269470);}return _0x26fcd1[_0x61c4('0x22')]();};}function saveUpdates(_0x33fe34,_0x17f24b){return function(_0x3a2212){if(_0x3a2212){return _0x3a2212['update'](_0x33fe34)[_0x61c4('0x23')](function(_0x5e5515){return _0x5e5515;});}return null;};}function removeEntity(_0x280409,_0x2711ba){return function(_0x1613ef){if(_0x1613ef){return _0x1613ef[_0x61c4('0x24')]()[_0x61c4('0x23')](function(){_0x280409[_0x61c4('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ebd60,_0x107e55){return function(_0x1c2bd8){if(!_0x1c2bd8){_0x5ebd60[_0x61c4('0x1a')](0x194);}return _0x1c2bd8;};}function handleError(_0x93bbd7,_0x186e24){_0x186e24=_0x186e24||0x1f4;return function(_0x5b02ec){logger[_0x61c4('0x25')](_0x5b02ec['stack']);if(_0x5b02ec[_0x61c4('0x26')]){delete _0x5b02ec['name'];}_0x93bbd7[_0x61c4('0x1b')](_0x186e24)[_0x61c4('0x27')](_0x5b02ec);};}exports[_0x61c4('0x28')]=function(_0x145a93,_0x5d6fb3){var _0x44b17f={'raw':!![],'where':{'id':_0x145a93[_0x61c4('0x29')]['id']}},_0x16267c={};_0x16267c[_0x61c4('0x2a')]=_[_0x61c4('0x2b')](db[_0x61c4('0x2c')][_0x61c4('0x2d')]);_0x16267c[_0x61c4('0x2e')]=_[_0x61c4('0x2b')](_0x145a93['query']);_0x16267c[_0x61c4('0x2f')]=_[_0x61c4('0x30')](_0x16267c[_0x61c4('0x2a')],_0x16267c['query']);_0x44b17f['attributes']=_['intersection'](_0x16267c[_0x61c4('0x2a')],qs[_0x61c4('0x31')](_0x145a93[_0x61c4('0x2e')][_0x61c4('0x31')]));_0x44b17f[_0x61c4('0x32')]=_0x44b17f['attributes'][_0x61c4('0x33')]?_0x44b17f[_0x61c4('0x32')]:_0x16267c[_0x61c4('0x2a')];if(_0x145a93[_0x61c4('0x2e')][_0x61c4('0x34')]){_0x44b17f['include']=[{'all':!![]}];}_0x44b17f=_[_0x61c4('0x35')]({},_0x44b17f,_0x145a93[_0x61c4('0x36')]);return db[_0x61c4('0x2c')][_0x61c4('0x37')](_0x44b17f)['then'](handleEntityNotFound(_0x5d6fb3,null))[_0x61c4('0x23')](respondWithResult(_0x5d6fb3,null))['catch'](handleError(_0x5d6fb3,null));};exports[_0x61c4('0x38')]=function(_0x1abbce,_0x5beb94){return db[_0x61c4('0x2c')][_0x61c4('0x38')](_0x1abbce['body'],{})[_0x61c4('0x23')](respondWithResult(_0x5beb94,0xc9))[_0x61c4('0x39')](handleError(_0x5beb94,null));};exports[_0x61c4('0x3a')]=function(_0x4c4a7f,_0x31cd5f){if(_0x4c4a7f[_0x61c4('0x3b')]['id']){delete _0x4c4a7f[_0x61c4('0x3b')]['id'];}return db[_0x61c4('0x2c')][_0x61c4('0x37')]({'where':{'id':_0x4c4a7f['params']['id']}})[_0x61c4('0x23')](handleEntityNotFound(_0x31cd5f,null))['then'](saveUpdates(_0x4c4a7f[_0x61c4('0x3b')],null))[_0x61c4('0x23')](respondWithResult(_0x31cd5f,null))[_0x61c4('0x39')](handleError(_0x31cd5f,null));};exports['destroy']=function(_0x31278c,_0x1d529a){return db[_0x61c4('0x2c')][_0x61c4('0x37')]({'where':{'id':_0x31278c[_0x61c4('0x29')]['id']}})['then'](handleEntityNotFound(_0x1d529a,null))[_0x61c4('0x23')](removeEntity(_0x1d529a,null))[_0x61c4('0x39')](handleError(_0x1d529a,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index e681ae1..c63769a 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 _0x0fdc=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction'];(function(_0x5bb3a0,_0x3fd23a){var _0x1469dd=function(_0x23f9f4){while(--_0x23f9f4){_0x5bb3a0['push'](_0x5bb3a0['shift']());}};_0x1469dd(++_0x3fd23a);}(_0x0fdc,0xfc));var _0xc0fd=function(_0x519380,_0x7f196){_0x519380=_0x519380-0x0;var _0x60ba2c=_0x0fdc[_0x519380];return _0x60ba2c;};'use strict';var _=require(_0xc0fd('0x0'));var util=require(_0xc0fd('0x1'));var logger=require('../../config/logger')(_0xc0fd('0x2'));var moment=require(_0xc0fd('0x3'));var BPromise=require(_0xc0fd('0x4'));var rp=require(_0xc0fd('0x5'));var fs=require('fs');var path=require(_0xc0fd('0x6'));var rimraf=require('rimraf');var config=require(_0xc0fd('0x7'));var attributes=require(_0xc0fd('0x8'));module[_0xc0fd('0x9')]=function(_0x301ffd,_0x46e077){return _0x301ffd[_0xc0fd('0xa')](_0xc0fd('0xb'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4061=['chat_proactive_actions','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x54912e,_0x3c3a9b){var _0x49d10f=function(_0x412e41){while(--_0x412e41){_0x54912e['push'](_0x54912e['shift']());}};_0x49d10f(++_0x3c3a9b);}(_0x4061,0x16c));var _0x1406=function(_0xa6d4a5,_0x19825b){_0xa6d4a5=_0xa6d4a5-0x0;var _0x3f47aa=_0x4061[_0xa6d4a5];return _0x3f47aa;};'use strict';var _=require(_0x1406('0x0'));var util=require(_0x1406('0x1'));var logger=require('../../config/logger')(_0x1406('0x2'));var moment=require(_0x1406('0x3'));var BPromise=require(_0x1406('0x4'));var rp=require(_0x1406('0x5'));var fs=require('fs');var path=require(_0x1406('0x6'));var rimraf=require(_0x1406('0x7'));var config=require(_0x1406('0x8'));var attributes=require('./chatProactiveAction.attributes');module[_0x1406('0x9')]=function(_0x28bdf4,_0xb381ba){return _0x28bdf4['define']('ChatProactiveAction',attributes,{'tableName':_0x1406('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 2ae71b2..bea8368 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 _0xe3da=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','lodash'];(function(_0x150529,_0x1d08fc){var _0x21115f=function(_0x4d8002){while(--_0x4d8002){_0x150529['push'](_0x150529['shift']());}};_0x21115f(++_0x1d08fc);}(_0xe3da,0xfc));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require(_0xae3d('0x2'));var BPromise=require(_0xae3d('0x3'));var rs=require(_0xae3d('0x4'));var fs=require('fs');var Redis=require(_0xae3d('0x5'));var db=require(_0xae3d('0x6'))['db'];var utils=require(_0xae3d('0x7'));var logger=require(_0xae3d('0x8'))(_0xae3d('0x9'));var config=require(_0xae3d('0xa'));var jayson=require(_0xae3d('0xb'));var client=jayson[_0xae3d('0xc')][_0xae3d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x380152,_0x33866a,_0x349b04){return new BPromise(function(_0x1f4981,_0x27ce59){return client[_0xae3d('0xe')](_0x380152,_0x349b04)['then'](function(_0x395c8b){logger[_0xae3d('0xf')](_0xae3d('0x10'),_0x33866a,_0xae3d('0x11'));logger[_0xae3d('0x12')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x33866a,_0xae3d('0x11'),JSON['stringify'](_0x395c8b));if(_0x395c8b['error']){if(_0x395c8b['error'][_0xae3d('0x13')]===0x1f4){logger[_0xae3d('0x14')]('ChatProactiveAction,\x20%s,\x20%s',_0x33866a,_0x395c8b[_0xae3d('0x14')][_0xae3d('0x15')]);return _0x27ce59(_0x395c8b[_0xae3d('0x14')][_0xae3d('0x15')]);}logger[_0xae3d('0x14')](_0xae3d('0x10'),_0x33866a,_0x395c8b[_0xae3d('0x14')][_0xae3d('0x15')]);return _0x1f4981(_0x395c8b['error'][_0xae3d('0x15')]);}else{logger[_0xae3d('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x33866a,_0xae3d('0x11'));_0x1f4981(_0x395c8b[_0xae3d('0x16')][_0xae3d('0x15')]);}})['catch'](function(_0x144028){logger['error'](_0xae3d('0x10'),_0x33866a,_0x144028);_0x27ce59(_0x144028);});});} \ No newline at end of file +var _0xf474=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x7ad554,_0x34f47d){var _0x4563f5=function(_0x5a8a75){while(--_0x5a8a75){_0x7ad554['push'](_0x7ad554['shift']());}};_0x4563f5(++_0x34f47d);}(_0xf474,0x115));var _0x4f47=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xf474[_0x45783c];return _0x1161da;};'use strict';var _=require(_0x4f47('0x0'));var util=require(_0x4f47('0x1'));var moment=require(_0x4f47('0x2'));var BPromise=require(_0x4f47('0x3'));var rs=require(_0x4f47('0x4'));var fs=require('fs');var Redis=require(_0x4f47('0x5'));var db=require(_0x4f47('0x6'))['db'];var utils=require(_0x4f47('0x7'));var logger=require(_0x4f47('0x8'))(_0x4f47('0x9'));var config=require(_0x4f47('0xa'));var jayson=require(_0x4f47('0xb'));var client=jayson[_0x4f47('0xc')][_0x4f47('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x252264,_0x27135e,_0x1a67a9){return new BPromise(function(_0x516f14,_0x435e99){return client[_0x4f47('0xe')](_0x252264,_0x1a67a9)['then'](function(_0x7c0db8){logger[_0x4f47('0xf')](_0x4f47('0x10'),_0x27135e,_0x4f47('0x11'));logger[_0x4f47('0x12')](_0x4f47('0x13'),_0x27135e,'request\x20sent',JSON[_0x4f47('0x14')](_0x7c0db8));if(_0x7c0db8[_0x4f47('0x15')]){if(_0x7c0db8[_0x4f47('0x15')][_0x4f47('0x16')]===0x1f4){logger['error'](_0x4f47('0x10'),_0x27135e,_0x7c0db8[_0x4f47('0x15')][_0x4f47('0x17')]);return _0x435e99(_0x7c0db8[_0x4f47('0x15')][_0x4f47('0x17')]);}logger[_0x4f47('0x15')]('ChatProactiveAction,\x20%s,\x20%s',_0x27135e,_0x7c0db8[_0x4f47('0x15')][_0x4f47('0x17')]);return _0x516f14(_0x7c0db8[_0x4f47('0x15')]['message']);}else{logger['info'](_0x4f47('0x10'),_0x27135e,_0x4f47('0x11'));_0x516f14(_0x7c0db8[_0x4f47('0x18')][_0x4f47('0x17')]);}})['catch'](function(_0x5a5cba){logger[_0x4f47('0x15')](_0x4f47('0x10'),_0x27135e,_0x5a5cba);_0x435e99(_0x5a5cba);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index cc64318..7753686 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 _0x3212=['./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x596172,_0x334e5c){var _0x492815=function(_0x252774){while(--_0x252774){_0x596172['push'](_0x596172['shift']());}};_0x492815(++_0x334e5c);}(_0x3212,0x1e5));var _0x2321=function(_0x10a4e8,_0x5c47aa){_0x10a4e8=_0x10a4e8-0x0;var _0x21e006=_0x3212[_0x10a4e8];return _0x21e006;};'use strict';var multer=require(_0x2321('0x0'));var util=require(_0x2321('0x1'));var path=require(_0x2321('0x2'));var timeout=require(_0x2321('0x3'));var express=require(_0x2321('0x4'));var router=express['Router']();var fs_extra=require(_0x2321('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2321('0x6'));var config=require(_0x2321('0x7'));var controller=require(_0x2321('0x8'));router[_0x2321('0x9')](_0x2321('0xa'),auth[_0x2321('0xb')](),controller[_0x2321('0xc')]);router[_0x2321('0xd')]('/',auth[_0x2321('0xb')](),controller[_0x2321('0xe')]);router[_0x2321('0xf')](_0x2321('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x2321('0xb')](),controller[_0x2321('0x10')]);module['exports']=router; \ No newline at end of file +var _0xcc39=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','delete'];(function(_0x337d86,_0x12d2d4){var _0x22fd02=function(_0x1834a9){while(--_0x1834a9){_0x337d86['push'](_0x337d86['shift']());}};_0x22fd02(++_0x12d2d4);}(_0xcc39,0x17e));var _0x9cc3=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xcc39[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x9cc3('0x0'));var util=require(_0x9cc3('0x1'));var path=require(_0x9cc3('0x2'));var timeout=require(_0x9cc3('0x3'));var express=require(_0x9cc3('0x4'));var router=express[_0x9cc3('0x5')]();var fs_extra=require(_0x9cc3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9cc3('0x7'));var config=require(_0x9cc3('0x8'));var controller=require(_0x9cc3('0x9'));router[_0x9cc3('0xa')](_0x9cc3('0xb'),auth[_0x9cc3('0xc')](),controller[_0x9cc3('0xd')]);router[_0x9cc3('0xe')]('/',auth[_0x9cc3('0xc')](),controller[_0x9cc3('0xf')]);router[_0x9cc3('0x10')](_0x9cc3('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x9cc3('0x11')](_0x9cc3('0xb'),auth['isAuthenticated'](),controller[_0x9cc3('0x12')]);module[_0x9cc3('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index f6b1550..2b3cd38 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 _0xfd56=['rrmemory','sequelize','STRING','name','ENUM'];(function(_0x23add2,_0x442f0b){var _0x78e09f=function(_0x4c46f4){while(--_0x4c46f4){_0x23add2['push'](_0x23add2['shift']());}};_0x78e09f(++_0x442f0b);}(_0xfd56,0x146));var _0x6fd5=function(_0xa2a482,_0x50d26c){_0xa2a482=_0xa2a482-0x0;var _0x5b883e=_0xfd56[_0xa2a482];return _0x5b883e;};'use strict';var Sequelize=require(_0x6fd5('0x0'));module['exports']={'name':{'type':Sequelize[_0x6fd5('0x1')],'unique':_0x6fd5('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6fd5('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6fd5('0x3')](_0x6fd5('0x4'),'beepall','roundrobin')}}; \ No newline at end of file +var _0xb9b8=['sequelize','STRING','name','INTEGER','ENUM','beepall'];(function(_0x49ce48,_0x4469be){var _0x496f5f=function(_0xa3fc6c){while(--_0xa3fc6c){_0x49ce48['push'](_0x49ce48['shift']());}};_0x496f5f(++_0x4469be);}(_0xb9b8,0x1ce));var _0x8b9b=function(_0x46428c,_0x20ab75){_0x46428c=_0x46428c-0x0;var _0x16a677=_0xb9b8[_0x46428c];return _0x16a677;};'use strict';var Sequelize=require(_0x8b9b('0x0'));module['exports']={'name':{'type':Sequelize[_0x8b9b('0x1')],'unique':_0x8b9b('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8b9b('0x1')]},'timeout':{'type':Sequelize[_0x8b9b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8b9b('0x4')]('rrmemory',_0x8b9b('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 416610f..0b05e7f 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 _0x941c=['lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','jayson/promise','http','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','get','UserProfileResource','stack','name','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','include','rows','show','params','keys','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','destroy','describe','getMembers','UserChatQueue','ChatQueueId','findAll','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','chatPause','getTeams','findOne','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','getAgents','order','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra'];(function(_0x2bd2c,_0x4d02ea){var _0x332dbc=function(_0x57bdf7){while(--_0x57bdf7){_0x2bd2c['push'](_0x2bd2c['shift']());}};_0x332dbc(++_0x4d02ea);}(_0x941c,0x11d));var _0xc941=function(_0x1f9890,_0x2c4706){_0x1f9890=_0x1f9890-0x0;var _0x3e798c=_0x941c[_0x1f9890];return _0x3e798c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc941('0x0'));var jsonpatch=require(_0xc941('0x1'));var rp=require(_0xc941('0x2'));var moment=require(_0xc941('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc941('0x4'));var path=require(_0xc941('0x5'));var sox=require('sox');var csv=require(_0xc941('0x6'));var ejs=require(_0xc941('0x7'));var fs=require('fs');var fs_extra=require(_0xc941('0x8'));var _=require(_0xc941('0x9'));var squel=require(_0xc941('0xa'));var crypto=require(_0xc941('0xb'));var jsforce=require(_0xc941('0xc'));var deskjs=require(_0xc941('0xd'));var toCsv=require(_0xc941('0x6'));var querystring=require('querystring');var Papa=require(_0xc941('0xe'));var Redis=require(_0xc941('0xf'));var authService=require(_0xc941('0x10'));var qs=require(_0xc941('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc941('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xc941('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc941('0x14'))['db'];config['redis']=_[_0xc941('0x15')](config[_0xc941('0x16')],{'host':_0xc941('0x17'),'port':0x18eb});var socket=require(_0xc941('0x18'))(new Redis(config[_0xc941('0x16')]));require(_0xc941('0x19'))['register'](socket);var jayson=require(_0xc941('0x1a'));var client=jayson['client'][_0xc941('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x14a4e3,_0x1db38f,_0x344a22,_0x569e54){return new BPromise(function(_0x316cdc,_0x450dd9){var _0x46a8e0=_0x569e54||client;return _0x46a8e0[_0xc941('0x1c')](_0x14a4e3,_0x344a22)[_0xc941('0x1d')](function(_0x1cbb21){logger['info'](_0xc941('0x1e'),_0x1db38f,_0xc941('0x1f'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x1db38f,'request\x20sent',JSON[_0xc941('0x20')](_0x1cbb21));if(_0x1cbb21['error']){if(_0x1cbb21[_0xc941('0x21')]['code']===0x1f4){logger[_0xc941('0x21')](_0xc941('0x1e'),_0x1db38f,_0x1cbb21['error'][_0xc941('0x22')]);return _0x450dd9(_0x1cbb21[_0xc941('0x21')][_0xc941('0x22')]);}logger[_0xc941('0x21')](_0xc941('0x1e'),_0x1db38f,_0x1cbb21[_0xc941('0x21')][_0xc941('0x22')]);return _0x316cdc(_0x1cbb21[_0xc941('0x21')][_0xc941('0x22')]);}else{logger[_0xc941('0x23')](_0xc941('0x1e'),_0x1db38f,_0xc941('0x1f'));_0x316cdc(_0x1cbb21[_0xc941('0x24')][_0xc941('0x22')]);}})[_0xc941('0x25')](function(_0x372641){logger[_0xc941('0x21')](_0xc941('0x1e'),_0x1db38f,_0x372641);_0x450dd9(_0x372641);});});}function respondWithStatusCode(_0x3652a6,_0x2cddc1){_0x2cddc1=_0x2cddc1||0xcc;return function(_0x21ee61){if(_0x21ee61){return _0x3652a6[_0xc941('0x26')](_0x2cddc1);}return _0x3652a6[_0xc941('0x27')](_0x2cddc1)[_0xc941('0x28')]();};}function respondWithResult(_0x40cc2f,_0x33ccab){_0x33ccab=_0x33ccab||0xc8;return function(_0x346407){if(_0x346407){return _0x40cc2f['status'](_0x33ccab)[_0xc941('0x29')](_0x346407);}};}function respondWithFilteredResult(_0x1771f4,_0x12e6e8){return function(_0x58bec6){if(_0x58bec6){var _0x137339=_0x58bec6[_0xc941('0x2a')],_0xcee080=_0x12e6e8[_0xc941('0x2b')],_0x1f64a=_0x12e6e8[_0xc941('0x2b')]+_0x12e6e8['limit'],_0x58d97a;if(_0x1f64a>=_0x137339){_0x1f64a=_0x137339;_0x58d97a=0xc8;}else{_0x58d97a=0xce;}_0x1771f4[_0xc941('0x27')](_0x58d97a);return _0x1771f4[_0xc941('0x2c')](_0xc941('0x2d'),_0xcee080+'-'+_0x1f64a+'/'+_0x137339)['json'](_0x58bec6);}return null;};}function patchUpdates(_0x4bebdf){return function(_0x1a16f2){try{jsonpatch[_0xc941('0x2e')](_0x1a16f2,_0x4bebdf,!![]);}catch(_0x3d7b0d){return BPromise['reject'](_0x3d7b0d);}return _0x1a16f2['save']();};}function saveUpdates(_0x205d2d,_0x3cd4e8){return function(_0x4f553d){if(_0x4f553d){return _0x4f553d['update'](_0x205d2d)[_0xc941('0x1d')](function(_0x44385d){return _0x44385d;});}return null;};}function removeEntity(_0x4fa72f,_0x418eaf){return function(_0x95b278){if(_0x95b278){return _0x95b278['destroy']()[_0xc941('0x1d')](function(){var _0x148562=_0x95b278[_0xc941('0x2f')]({'plain':!![]});var _0x550afb='ChatQueues';return db[_0xc941('0x30')]['destroy']({'where':{'type':_0x550afb,'resourceId':_0x148562['id']}})[_0xc941('0x1d')](function(){return _0x95b278;});})[_0xc941('0x1d')](function(){_0x4fa72f[_0xc941('0x27')](0xcc)[_0xc941('0x28')]();});}};}function handleEntityNotFound(_0x48c331,_0x27e981){return function(_0x26f194){if(!_0x26f194){_0x48c331[_0xc941('0x26')](0x194);}return _0x26f194;};}function handleError(_0x139395,_0x29a2f3){_0x29a2f3=_0x29a2f3||0x1f4;return function(_0x38aea9){logger[_0xc941('0x21')](_0x38aea9[_0xc941('0x31')]);if(_0x38aea9['name']){delete _0x38aea9[_0xc941('0x32')];}_0x139395[_0xc941('0x27')](_0x29a2f3)['send'](_0x38aea9);};}exports[_0xc941('0x33')]=function(_0x656200,_0xac9a9b){var _0x52255d={},_0x200930={},_0x176897={'count':0x0,'rows':[]};var _0x1e0cb3=_[_0xc941('0x34')](db[_0xc941('0x35')][_0xc941('0x36')],function(_0x3ae39a){return{'name':_0x3ae39a[_0xc941('0x37')],'type':_0x3ae39a[_0xc941('0x38')][_0xc941('0x39')]};});_0x200930[_0xc941('0x3a')]=_[_0xc941('0x34')](_0x1e0cb3,'name');_0x200930[_0xc941('0x3b')]=_['keys'](_0x656200['query']);_0x200930[_0xc941('0x3c')]=_[_0xc941('0x3d')](_0x200930['model'],_0x200930[_0xc941('0x3b')]);_0x52255d[_0xc941('0x3e')]=_[_0xc941('0x3d')](_0x200930['model'],qs[_0xc941('0x3f')](_0x656200['query'][_0xc941('0x3f')]));_0x52255d[_0xc941('0x3e')]=_0x52255d[_0xc941('0x3e')][_0xc941('0x40')]?_0x52255d[_0xc941('0x3e')]:_0x200930[_0xc941('0x3a')];if(!_0x656200[_0xc941('0x3b')][_0xc941('0x41')](_0xc941('0x42'))){_0x52255d['limit']=qs[_0xc941('0x43')](_0x656200[_0xc941('0x3b')][_0xc941('0x43')]);_0x52255d['offset']=qs[_0xc941('0x2b')](_0x656200[_0xc941('0x3b')][_0xc941('0x2b')]);}_0x52255d['order']=qs[_0xc941('0x44')](_0x656200[_0xc941('0x3b')]['sort']);_0x52255d['where']=qs['filters'](_[_0xc941('0x45')](_0x656200[_0xc941('0x3b')],_0x200930['filters']),_0x1e0cb3);if(_0x656200[_0xc941('0x3b')][_0xc941('0x46')]){_0x52255d[_0xc941('0x47')]=_[_0xc941('0x48')](_0x52255d[_0xc941('0x47')],{'$or':_[_0xc941('0x34')](_0x1e0cb3,function(_0xcc0f6b){if(_0xcc0f6b[_0xc941('0x38')]!==_0xc941('0x49')){var _0x51af1e={};_0x51af1e[_0xcc0f6b[_0xc941('0x32')]]={'$like':'%'+_0x656200['query'][_0xc941('0x46')]+'%'};return _0x51af1e;}})});}_0x52255d=_[_0xc941('0x48')]({},_0x52255d,_0x656200['options']);var _0x3c0613={'where':_0x52255d[_0xc941('0x47')]};return db[_0xc941('0x35')][_0xc941('0x2a')](_0x3c0613)[_0xc941('0x1d')](function(_0x3ba506){_0x176897['count']=_0x3ba506;if(_0x656200['query']['includeAll']){_0x52255d[_0xc941('0x4a')]=[{'all':!![]}];}return db[_0xc941('0x35')]['findAll'](_0x52255d);})[_0xc941('0x1d')](function(_0x38eb97){_0x176897[_0xc941('0x4b')]=_0x38eb97;return _0x176897;})[_0xc941('0x1d')](respondWithFilteredResult(_0xac9a9b,_0x52255d))[_0xc941('0x25')](handleError(_0xac9a9b,null));};exports[_0xc941('0x4c')]=function(_0x16bb20,_0x30e32d){var _0x2448ae={'raw':!![],'where':{'id':_0x16bb20[_0xc941('0x4d')]['id']}},_0x39546b={};_0x39546b['model']=_['keys'](db[_0xc941('0x35')][_0xc941('0x36')]);_0x39546b[_0xc941('0x3b')]=_[_0xc941('0x4e')](_0x16bb20[_0xc941('0x3b')]);_0x39546b[_0xc941('0x3c')]=_[_0xc941('0x3d')](_0x39546b[_0xc941('0x3a')],_0x39546b[_0xc941('0x3b')]);_0x2448ae['attributes']=_['intersection'](_0x39546b[_0xc941('0x3a')],qs[_0xc941('0x3f')](_0x16bb20['query'][_0xc941('0x3f')]));_0x2448ae[_0xc941('0x3e')]=_0x2448ae[_0xc941('0x3e')][_0xc941('0x40')]?_0x2448ae['attributes']:_0x39546b[_0xc941('0x3a')];if(_0x16bb20[_0xc941('0x3b')]['includeAll']){_0x2448ae[_0xc941('0x4a')]=[{'all':!![]}];}_0x2448ae=_[_0xc941('0x48')]({},_0x2448ae,_0x16bb20[_0xc941('0x4f')]);return db[_0xc941('0x35')]['find'](_0x2448ae)[_0xc941('0x1d')](handleEntityNotFound(_0x30e32d,null))[_0xc941('0x1d')](respondWithResult(_0x30e32d,null))[_0xc941('0x25')](handleError(_0x30e32d,null));};exports[_0xc941('0x50')]=function(_0x386e7e,_0x2f3a3f){return db[_0xc941('0x35')][_0xc941('0x50')](_0x386e7e['body'],{})[_0xc941('0x1d')](function(_0x104265){var _0xf96759=_0x386e7e[_0xc941('0x51')][_0xc941('0x2f')]({'plain':!![]});if(!_0xf96759)throw new Error(_0xc941('0x52'));if(_0xf96759[_0xc941('0x53')]==='user'){var _0x41d412=_0x104265[_0xc941('0x2f')]({'plain':!![]});var _0x3e7dd4='ChatQueues';return db[_0xc941('0x54')]['find']({'where':{'name':_0x3e7dd4,'userProfileId':_0xf96759[_0xc941('0x55')]},'raw':!![]})[_0xc941('0x1d')](function(_0x4f7f54){if(_0x4f7f54&&_0x4f7f54[_0xc941('0x56')]===0x0){return db['UserProfileResource'][_0xc941('0x50')]({'name':_0x41d412[_0xc941('0x32')],'resourceId':_0x41d412['id'],'type':_0x4f7f54[_0xc941('0x32')],'sectionId':_0x4f7f54['id']},{})[_0xc941('0x1d')](function(){return _0x104265;});}else{return _0x104265;}})[_0xc941('0x25')](function(_0x5f1b75){logger[_0xc941('0x21')](_0xc941('0x57'),_0x5f1b75);throw _0x5f1b75;});}return _0x104265;})['then'](respondWithResult(_0x2f3a3f,0xc9))[_0xc941('0x25')](handleError(_0x2f3a3f,null));};exports[_0xc941('0x58')]=function(_0xf709a9,_0x5360e3){if(_0xf709a9[_0xc941('0x59')]['id']){delete _0xf709a9[_0xc941('0x59')]['id'];}return db[_0xc941('0x35')][_0xc941('0x5a')]({'where':{'id':_0xf709a9[_0xc941('0x4d')]['id']}})[_0xc941('0x1d')](handleEntityNotFound(_0x5360e3,null))[_0xc941('0x1d')](saveUpdates(_0xf709a9['body'],null))['then'](respondWithResult(_0x5360e3,null))[_0xc941('0x25')](handleError(_0x5360e3,null));};exports[_0xc941('0x5b')]=function(_0x1e3a7a,_0x1671e8){return db[_0xc941('0x35')][_0xc941('0x5a')]({'where':{'id':_0x1e3a7a['params']['id']}})[_0xc941('0x1d')](handleEntityNotFound(_0x1671e8,null))[_0xc941('0x1d')](removeEntity(_0x1671e8,null))[_0xc941('0x25')](handleError(_0x1671e8,null));};exports[_0xc941('0x5c')]=function(_0x50312a,_0x233fa8){return db[_0xc941('0x35')][_0xc941('0x5c')]()[_0xc941('0x1d')](respondWithResult(_0x233fa8,null))[_0xc941('0x25')](handleError(_0x233fa8,null));};exports[_0xc941('0x5d')]=function(_0x5c955f,_0x18fcc9,_0x235bad){var _0x5ce469={'raw':!![],'where':{}},_0x5116c2={},_0x564542;return db[_0xc941('0x35')]['findOne']({'where':{'id':_0x5c955f['params']['id']}})[_0xc941('0x1d')](handleEntityNotFound(_0x18fcc9,null))[_0xc941('0x1d')](function(_0x4cd8d8){if(_0x4cd8d8){_0x564542=_0x4cd8d8[_0xc941('0x2f')]({'plain':!![]});_0x5116c2[_0xc941('0x3a')]=_[_0xc941('0x4e')](db[_0xc941('0x5e')][_0xc941('0x36')]);_0x5116c2[_0xc941('0x3b')]=_['keys'](_0x5c955f['query']);_0x5116c2[_0xc941('0x3c')]=_[_0xc941('0x3d')](_0x5116c2[_0xc941('0x3a')],_0x5116c2[_0xc941('0x3b')]);_0x5ce469['attributes']=_['intersection'](_0x5116c2['model'],qs[_0xc941('0x3f')](_0x5c955f[_0xc941('0x3b')]['fields']));_0x5ce469[_0xc941('0x3e')]=_0x5ce469[_0xc941('0x3e')][_0xc941('0x40')]?_0x5ce469[_0xc941('0x3e')]:_0x5116c2[_0xc941('0x3a')];if(!_0x5c955f[_0xc941('0x3b')][_0xc941('0x41')](_0xc941('0x42'))){_0x5ce469[_0xc941('0x43')]=qs[_0xc941('0x43')](_0x5c955f[_0xc941('0x3b')][_0xc941('0x43')]);_0x5ce469[_0xc941('0x2b')]=qs['offset'](_0x5c955f[_0xc941('0x3b')][_0xc941('0x2b')]);}_0x5ce469['order']=qs[_0xc941('0x44')](_0x5c955f['query'][_0xc941('0x44')]);_0x5ce469[_0xc941('0x47')]=qs[_0xc941('0x3c')](_['pick'](_0x5c955f[_0xc941('0x3b')],_0x5116c2[_0xc941('0x3c')]));_0x5ce469[_0xc941('0x47')][_0xc941('0x5f')]=_0x4cd8d8['id'];if(_0x5c955f['query'][_0xc941('0x46')]){_0x5ce469[_0xc941('0x47')]=_[_0xc941('0x48')](_0x5ce469['where'],{'$or':_['map'](_0x5ce469[_0xc941('0x3e')],function(_0x30bd93){var _0x2d87f0={};_0x2d87f0[_0x30bd93]={'$like':'%'+_0x5c955f[_0xc941('0x3b')][_0xc941('0x46')]+'%'};return _0x2d87f0;})});}_0x5ce469=_[_0xc941('0x48')]({},_0x5ce469,_0x5c955f[_0xc941('0x4f')]);return db[_0xc941('0x5e')][_0xc941('0x60')](_0x5ce469);}})[_0xc941('0x1d')](function(_0x594f1a){if(_0x594f1a){return db[_0xc941('0x61')][_0xc941('0x62')]({'where':{'id':_[_0xc941('0x34')](_0x594f1a,_0xc941('0x63')),'role':'agent'},'attributes':['id',_0xc941('0x32'),'chatPause',_0xc941('0x64'),_0xc941('0x65')]});}})['then'](function(_0x1fe848){if(_0x1fe848){return{'count':_0x1fe848[_0xc941('0x2a')],'rows':_[_0xc941('0x34')](_0x1fe848['rows'],function(_0x1336f4){return{'membername':_0x1336f4[_0xc941('0x32')],'UserId':_0x1336f4['id'],'queue_name':_0x564542['name'],'ChatQueueId':_0x564542['id'],'interface':util[_0xc941('0x66')](_0xc941('0x67'),'SIP',_0x1336f4['name']),'penalty':0x0,'paused':_0x1336f4[_0xc941('0x68')],'createdAt':_0x1336f4[_0xc941('0x65')],'updatedAt':_0x1336f4[_0xc941('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc941('0x1d')](respondWithFilteredResult(_0x18fcc9,_0x5ce469))[_0xc941('0x25')](handleError(_0x18fcc9,null));};exports[_0xc941('0x69')]=function(_0x2ce4ac,_0x365ab5,_0x471f9b){var _0x4efa08={};var _0x5305a2={};var _0x18a653;var _0x15a69d;return db[_0xc941('0x35')][_0xc941('0x6a')]({'where':{'id':_0x2ce4ac[_0xc941('0x4d')]['id']}})['then'](handleEntityNotFound(_0x365ab5,null))['then'](function(_0x53a02a){if(_0x53a02a){_0x18a653=_0x53a02a;_0x5305a2[_0xc941('0x3a')]=_[_0xc941('0x4e')](db['Team'][_0xc941('0x36')]);_0x5305a2[_0xc941('0x3b')]=_[_0xc941('0x4e')](_0x2ce4ac[_0xc941('0x3b')]);_0x5305a2[_0xc941('0x3c')]=_[_0xc941('0x3d')](_0x5305a2['model'],_0x5305a2['query']);_0x4efa08[_0xc941('0x3e')]=_['intersection'](_0x5305a2[_0xc941('0x3a')],qs[_0xc941('0x3f')](_0x2ce4ac[_0xc941('0x3b')][_0xc941('0x3f')]));_0x4efa08[_0xc941('0x3e')]=_0x4efa08[_0xc941('0x3e')][_0xc941('0x40')]?_0x4efa08['attributes']:_0x5305a2[_0xc941('0x3a')];_0x4efa08['order']=qs[_0xc941('0x44')](_0x2ce4ac[_0xc941('0x3b')]['sort']);_0x4efa08[_0xc941('0x47')]=qs[_0xc941('0x3c')](_[_0xc941('0x45')](_0x2ce4ac['query'],_0x5305a2[_0xc941('0x3c')]));if(_0x2ce4ac['query'][_0xc941('0x46')]){_0x4efa08[_0xc941('0x47')]=_[_0xc941('0x48')](_0x4efa08['where'],{'$or':_[_0xc941('0x34')](_0x4efa08[_0xc941('0x3e')],function(_0x40e2c2){var _0x5ee394={};_0x5ee394[_0x40e2c2]={'$like':'%'+_0x2ce4ac[_0xc941('0x3b')][_0xc941('0x46')]+'%'};return _0x5ee394;})});}_0x4efa08=_[_0xc941('0x48')]({},_0x4efa08,_0x2ce4ac[_0xc941('0x4f')]);return _0x18a653['getTeams'](_0x4efa08);}})[_0xc941('0x1d')](function(_0x4f954c){if(_0x4f954c){_0x15a69d=_0x4f954c[_0xc941('0x40')];if(!_0x2ce4ac[_0xc941('0x3b')]['hasOwnProperty'](_0xc941('0x42'))){_0x4efa08[_0xc941('0x43')]=qs[_0xc941('0x43')](_0x2ce4ac[_0xc941('0x3b')]['limit']);_0x4efa08[_0xc941('0x2b')]=qs[_0xc941('0x2b')](_0x2ce4ac[_0xc941('0x3b')][_0xc941('0x2b')]);}return _0x18a653[_0xc941('0x69')](_0x4efa08);}})['then'](function(_0x4ddc5c){if(_0x4ddc5c){return _0x4ddc5c?{'count':_0x15a69d,'rows':_0x4ddc5c}:null;}})[_0xc941('0x1d')](respondWithResult(_0x365ab5,null))[_0xc941('0x25')](handleError(_0x365ab5,null));};exports[_0xc941('0x6b')]=function(_0x1cfa99,_0x2fa5ac,_0x4423a9){var _0x1ec8f0=_0x1cfa99[_0xc941('0x59')][_0xc941('0x6c')];return db[_0xc941('0x6d')]['findAll']({'where':{'id':_0x1ec8f0},'attributes':['id'],'include':[{'model':db[_0xc941('0x61')],'as':_0xc941('0x6e'),'attributes':['id',_0xc941('0x32'),_0xc941('0x6f'),_0xc941('0x70'),_0xc941('0x71')],'raw':!![]}]})[_0xc941('0x1d')](function(_0x18711a){if(_0x18711a){var _0x1ca580=_[_0xc941('0x72')](_0x18711a,function(_0x5ae9c3){var _0xacce6c=_0x5ae9c3[_0xc941('0x2f')]({'plain':!![]});return _0xacce6c[_0xc941('0x6e')];});return db[_0xc941('0x35')][_0xc941('0x5a')]({'where':{'id':_0x1cfa99['params']['id']}})[_0xc941('0x1d')](function(_0x168046){return db[_0xc941('0x73')][_0xc941('0x74')](function(_0x38b682){return _0x168046[_0xc941('0x6b')](_0x1ec8f0,{'transaction':_0x38b682})[_0xc941('0x1d')](function(){return BPromise[_0xc941('0x75')](_0x1ca580,function(_0x2a2662){return db['UserChatQueue'][_0xc941('0x76')]({'where':{'UserId':_0x2a2662['id'],'ChatQueueId':_0x1cfa99[_0xc941('0x4d')]['id']},'transaction':_0x38b682});});})['then'](function(){_0x1ca580[_0xc941('0x77')](function(_0x5d4f30){socket[_0xc941('0x78')]('userChatQueue:save',{'UserId':_0x5d4f30['id'],'ChatQueueId':_0x168046['id']});});});});});}})[_0xc941('0x1d')](respondWithStatusCode(_0x2fa5ac,null))[_0xc941('0x25')](handleError(_0x2fa5ac,null));};exports[_0xc941('0x79')]=function(_0x406a02,_0x4cb9ca,_0x462374){return db[_0xc941('0x6d')][_0xc941('0x60')]({'where':{'id':_0x406a02[_0xc941('0x3b')][_0xc941('0x6c')]},'attributes':['id'],'include':[{'model':db[_0xc941('0x61')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc941('0x1d')](handleEntityNotFound(_0x4cb9ca,null))[_0xc941('0x1d')](function(_0x3e5edb){var _0x41f23a=_[_0xc941('0x34')](_0x3e5edb,'id');var _0x590618=[];var _0x47cb5c=[];var _0x443213=squel[_0xc941('0x7a')]();_0x443213[_0xc941('0x7b')](_0xc941('0x7c'))[_0xc941('0x7d')]('team_has_chat_queues','tq')[_0xc941('0x7e')](_0xc941('0x7f'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc941('0x47')]('ChatQueueId\x20=\x20?',_0x406a02[_0xc941('0x4d')]['id']);for(var _0x1bab1c=0x0;_0x1bab1c<_0x3e5edb[_0xc941('0x40')];_0x1bab1c+=0x1){let _0x237ff7=_0x3e5edb[_0x1bab1c];for(var _0x21b709=0x0;_0x21b709<_0x237ff7[_0xc941('0x6e')][_0xc941('0x40')];_0x21b709+=0x1){let _0x48e381=_0x237ff7[_0xc941('0x6e')][_0x21b709];var _0x3d1b25=_0x443213['clone']();_0x3d1b25[_0xc941('0x47')](_0xc941('0x80'),_0x48e381['id']);_0x47cb5c[_0xc941('0x81')](db[_0xc941('0x73')][_0xc941('0x3b')](_0x3d1b25[_0xc941('0x82')](),{'type':db['sequelize'][_0xc941('0x83')]['SELECT']})[_0xc941('0x1d')](function(_0x53e615){if(_0x53e615[_0xc941('0x40')]===0x1){return _0x48e381['id'];}else{var _0x3de5de=_[_0xc941('0x84')](_[_0xc941('0x34')](_0x53e615,_0xc941('0x85')),function(_0x2c11c7){return _[_0xc941('0x86')](_0x41f23a,_0x2c11c7);});if(_0x3de5de){return _0x48e381['id'];}}}));}}return BPromise[_0xc941('0x87')](_0x47cb5c)[_0xc941('0x1d')](function(_0x204143){_0x590618=_(_0x590618)[_0xc941('0x88')](_0x204143)[_0xc941('0x89')]()['value']();return db[_0xc941('0x35')]['find']({'where':{'id':_0x406a02[_0xc941('0x4d')]['id']}})[_0xc941('0x1d')](function(_0x1a4288){return db[_0xc941('0x73')][_0xc941('0x74')](function(_0x1b7adf){return _0x1a4288[_0xc941('0x79')](_0x406a02[_0xc941('0x3b')][_0xc941('0x6c')],{'transaction':_0x1b7adf})[_0xc941('0x1d')](function(){if(!_[_0xc941('0x8a')](_0x590618)){return _0x1a4288[_0xc941('0x8b')](_0x590618,{'transaction':_0x1b7adf});}})[_0xc941('0x1d')](function(){_0x590618[_0xc941('0x77')](function(_0x26d2cf){socket[_0xc941('0x78')](_0xc941('0x8c'),{'UserId':_0x26d2cf,'ChatQueueId':_0x1a4288['id']});});});});});});})[_0xc941('0x1d')](respondWithStatusCode(_0x4cb9ca,null))[_0xc941('0x25')](handleError(_0x4cb9ca,null));};exports[_0xc941('0x8d')]=function(_0x287335,_0x214572,_0x539581){return db[_0xc941('0x35')][_0xc941('0x5a')]({'where':{'id':_0x287335[_0xc941('0x4d')]['id']}})['then'](handleEntityNotFound(_0x214572,null))[_0xc941('0x1d')](function(_0x2e35b0){if(_0x2e35b0){return _0x2e35b0[_0xc941('0x8d')](_0x287335['body'][_0xc941('0x6c')],_[_0xc941('0x8e')](_0x287335[_0xc941('0x59')],[_0xc941('0x6c'),'id'])||{})[_0xc941('0x8f')](function(_0x99fdc2){for(var _0x134078=0x0;_0x134078<_0x287335[_0xc941('0x59')][_0xc941('0x6c')][_0xc941('0x40')];_0x134078+=0x1){socket[_0xc941('0x78')](_0xc941('0x90'),{'UserId':_0x287335['body'][_0xc941('0x6c')][_0x134078],'ChatQueueId':_0x287335[_0xc941('0x4d')]['id']});}return _0x99fdc2;});}})['then'](respondWithResult(_0x214572,null))['catch'](handleError(_0x214572,null));};exports[_0xc941('0x8b')]=function(_0x24d274,_0x579d26,_0x4307c1){return db[_0xc941('0x35')][_0xc941('0x5a')]({'where':{'id':_0x24d274['params']['id']}})[_0xc941('0x1d')](handleEntityNotFound(_0x579d26,null))[_0xc941('0x1d')](function(_0x12de26){if(_0x12de26){return _0x12de26[_0xc941('0x8b')](_0x24d274[_0xc941('0x3b')][_0xc941('0x6c')])[_0xc941('0x1d')](function(){if(_['isArray'](_0x24d274[_0xc941('0x3b')]['ids'])){for(var _0x345e45=0x0;_0x345e45<_0x24d274['query'][_0xc941('0x6c')][_0xc941('0x40')];_0x345e45+=0x1){socket['emit'](_0xc941('0x8c'),{'UserId':Number(_0x24d274[_0xc941('0x3b')][_0xc941('0x6c')][_0x345e45]),'ChatQueueId':Number(_0x24d274[_0xc941('0x4d')]['id'])});}}else{socket[_0xc941('0x78')](_0xc941('0x8c'),{'UserId':Number(_0x24d274[_0xc941('0x3b')][_0xc941('0x6c')]),'ChatQueueId':Number(_0x24d274[_0xc941('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x579d26,null))['catch'](handleError(_0x579d26,null));};exports[_0xc941('0x91')]=function(_0xd25083,_0x147c5d,_0x402c95){var _0x1f1402={};var _0x130871={};var _0xd8f451;var _0x1da491;return db[_0xc941('0x35')]['findOne']({'where':{'id':_0xd25083[_0xc941('0x4d')]['id']}})[_0xc941('0x1d')](handleEntityNotFound(_0x147c5d,null))[_0xc941('0x1d')](function(_0x2df37b){if(_0x2df37b){_0xd8f451=_0x2df37b;_0x130871[_0xc941('0x3a')]=_['keys'](db[_0xc941('0x61')]['rawAttributes']);_0x130871[_0xc941('0x3b')]=_[_0xc941('0x4e')](_0xd25083[_0xc941('0x3b')]);_0x130871['filters']=_[_0xc941('0x3d')](_0x130871[_0xc941('0x3a')],_0x130871[_0xc941('0x3b')]);_0x1f1402[_0xc941('0x3e')]=_['intersection'](_0x130871[_0xc941('0x3a')],qs[_0xc941('0x3f')](_0xd25083[_0xc941('0x3b')][_0xc941('0x3f')]));_0x1f1402[_0xc941('0x3e')]=_0x1f1402[_0xc941('0x3e')][_0xc941('0x40')]?_0x1f1402['attributes']:_0x130871['model'];_0x1f1402[_0xc941('0x92')]=qs[_0xc941('0x44')](_0xd25083[_0xc941('0x3b')][_0xc941('0x44')]);_0x1f1402[_0xc941('0x47')]=qs[_0xc941('0x3c')](_[_0xc941('0x45')](_0xd25083[_0xc941('0x3b')],_0x130871[_0xc941('0x3c')]));if(_0xd25083[_0xc941('0x3b')][_0xc941('0x46')]){_0x1f1402[_0xc941('0x47')]=_[_0xc941('0x48')](_0x1f1402[_0xc941('0x47')],{'$or':_['map'](_0x1f1402[_0xc941('0x3e')],function(_0x459c96){var _0xb829a7={};_0xb829a7[_0x459c96]={'$like':'%'+_0xd25083['query'][_0xc941('0x46')]+'%'};return _0xb829a7;})});}_0x1f1402=_[_0xc941('0x48')]({},_0x1f1402,_0xd25083[_0xc941('0x4f')]);return _0xd8f451['getAgents'](_0x1f1402);}})[_0xc941('0x1d')](function(_0x29f715){if(_0x29f715){_0x1da491=_0x29f715[_0xc941('0x40')];if(!_0xd25083[_0xc941('0x3b')][_0xc941('0x41')](_0xc941('0x42'))){_0x1f1402[_0xc941('0x43')]=qs['limit'](_0xd25083['query'][_0xc941('0x43')]);_0x1f1402[_0xc941('0x2b')]=qs['offset'](_0xd25083[_0xc941('0x3b')][_0xc941('0x2b')]);}return _0xd8f451[_0xc941('0x91')](_0x1f1402);}})['then'](function(_0x2fc551){if(_0x2fc551){return _0x2fc551?{'count':_0x1da491,'rows':_0x2fc551}:null;}})[_0xc941('0x1d')](respondWithResult(_0x147c5d,null))[_0xc941('0x25')](handleError(_0x147c5d,null));}; \ No newline at end of file +var _0x70a5=['bluebird','mustache','util','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','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','update','destroy','get','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','keys','find','create','body','user','role','ChatQueues','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','nolimit','order','findAndCountAll','UserId','agent','chatPause','updatedAt','format','%s/%s','Team','getTeams','addTeams','ids','Agents','voicePause','flatMap','sequelize','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','User','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','transaction','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x1581bb,_0x5d0157){var _0x2e032d=function(_0x5e3d1f){while(--_0x5e3d1f){_0x1581bb['push'](_0x1581bb['shift']());}};_0x2e032d(++_0x5d0157);}(_0x70a5,0x1c8));var _0x570a=function(_0x4a7189,_0x2f2adf){_0x4a7189=_0x4a7189-0x0;var _0x7229f=_0x70a5[_0x4a7189];return _0x7229f;};'use strict';var emlformat=require(_0x570a('0x0'));var rimraf=require(_0x570a('0x1'));var zipdir=require(_0x570a('0x2'));var jsonpatch=require(_0x570a('0x3'));var rp=require(_0x570a('0x4'));var moment=require(_0x570a('0x5'));var BPromise=require(_0x570a('0x6'));var Mustache=require(_0x570a('0x7'));var util=require(_0x570a('0x8'));var path=require('path');var sox=require(_0x570a('0x9'));var csv=require(_0x570a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x570a('0xb'));var _=require(_0x570a('0xc'));var squel=require('squel');var crypto=require(_0x570a('0xd'));var jsforce=require(_0x570a('0xe'));var deskjs=require(_0x570a('0xf'));var toCsv=require(_0x570a('0xa'));var querystring=require(_0x570a('0x10'));var Papa=require(_0x570a('0x11'));var Redis=require(_0x570a('0x12'));var authService=require(_0x570a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x570a('0x14'));var hardwareService=require(_0x570a('0x15'));var logger=require(_0x570a('0x16'))(_0x570a('0x17'));var utils=require(_0x570a('0x18'));var config=require(_0x570a('0x19'));var licenseUtil=require(_0x570a('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x570a('0x1b')],{'host':_0x570a('0x1c'),'port':0x18eb});var socket=require(_0x570a('0x1d'))(new Redis(config[_0x570a('0x1b')]));require(_0x570a('0x1e'))[_0x570a('0x1f')](socket);var jayson=require(_0x570a('0x20'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x193b41,_0x15302c,_0x5a0458,_0x1aa7b9){return new BPromise(function(_0x206922,_0x21309b){var _0xc5e1a4=_0x1aa7b9||client;return _0xc5e1a4[_0x570a('0x21')](_0x193b41,_0x5a0458)[_0x570a('0x22')](function(_0x2d86a1){logger[_0x570a('0x23')]('ChatQueue,\x20%s,\x20%s',_0x15302c,_0x570a('0x24'));logger[_0x570a('0x25')](_0x570a('0x26'),_0x15302c,'request\x20sent',JSON[_0x570a('0x27')](_0x2d86a1));if(_0x2d86a1[_0x570a('0x28')]){if(_0x2d86a1[_0x570a('0x28')][_0x570a('0x29')]===0x1f4){logger['error'](_0x570a('0x2a'),_0x15302c,_0x2d86a1[_0x570a('0x28')][_0x570a('0x2b')]);return _0x21309b(_0x2d86a1['error'][_0x570a('0x2b')]);}logger[_0x570a('0x28')](_0x570a('0x2a'),_0x15302c,_0x2d86a1[_0x570a('0x28')][_0x570a('0x2b')]);return _0x206922(_0x2d86a1['error']['message']);}else{logger[_0x570a('0x23')](_0x570a('0x2a'),_0x15302c,'request\x20sent');_0x206922(_0x2d86a1[_0x570a('0x2c')]['message']);}})[_0x570a('0x2d')](function(_0x2574a9){logger[_0x570a('0x28')](_0x570a('0x2a'),_0x15302c,_0x2574a9);_0x21309b(_0x2574a9);});});}function respondWithStatusCode(_0xbabd2,_0x5e1921){_0x5e1921=_0x5e1921||0xcc;return function(_0x1d9d46){if(_0x1d9d46){return _0xbabd2[_0x570a('0x2e')](_0x5e1921);}return _0xbabd2[_0x570a('0x2f')](_0x5e1921)['end']();};}function respondWithResult(_0x516acd,_0x588407){_0x588407=_0x588407||0xc8;return function(_0x1fef5b){if(_0x1fef5b){return _0x516acd[_0x570a('0x2f')](_0x588407)[_0x570a('0x30')](_0x1fef5b);}};}function respondWithFilteredResult(_0x4129ce,_0x515e65){return function(_0x4c8dc5){if(_0x4c8dc5){var _0x3190a9=_0x4c8dc5['count'],_0x1d0f70=_0x515e65[_0x570a('0x31')],_0x1cf971=_0x515e65[_0x570a('0x31')]+_0x515e65[_0x570a('0x32')],_0xdb93ca;if(_0x1cf971>=_0x3190a9){_0x1cf971=_0x3190a9;_0xdb93ca=0xc8;}else{_0xdb93ca=0xce;}_0x4129ce[_0x570a('0x2f')](_0xdb93ca);return _0x4129ce[_0x570a('0x33')](_0x570a('0x34'),_0x1d0f70+'-'+_0x1cf971+'/'+_0x3190a9)['json'](_0x4c8dc5);}return null;};}function patchUpdates(_0x2bf7c6){return function(_0x277265){try{jsonpatch[_0x570a('0x35')](_0x277265,_0x2bf7c6,!![]);}catch(_0x38e60e){return BPromise['reject'](_0x38e60e);}return _0x277265[_0x570a('0x36')]();};}function saveUpdates(_0x136cd7,_0x3017ed){return function(_0x5d2b89){if(_0x5d2b89){return _0x5d2b89[_0x570a('0x37')](_0x136cd7)['then'](function(_0x2e1684){return _0x2e1684;});}return null;};}function removeEntity(_0x2ea5b8,_0x557f96){return function(_0x1c1d2b){if(_0x1c1d2b){return _0x1c1d2b[_0x570a('0x38')]()[_0x570a('0x22')](function(){var _0x446aa7=_0x1c1d2b[_0x570a('0x39')]({'plain':!![]});var _0x316ea1='ChatQueues';return db['UserProfileResource'][_0x570a('0x38')]({'where':{'type':_0x316ea1,'resourceId':_0x446aa7['id']}})['then'](function(){return _0x1c1d2b;});})[_0x570a('0x22')](function(){_0x2ea5b8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x37915e,_0x20f1f2){return function(_0x413ca0){if(!_0x413ca0){_0x37915e[_0x570a('0x2e')](0x194);}return _0x413ca0;};}function handleError(_0x52c35f,_0x4641e1){_0x4641e1=_0x4641e1||0x1f4;return function(_0xe4f4f3){logger[_0x570a('0x28')](_0xe4f4f3[_0x570a('0x3a')]);if(_0xe4f4f3['name']){delete _0xe4f4f3[_0x570a('0x3b')];}_0x52c35f[_0x570a('0x2f')](_0x4641e1)[_0x570a('0x3c')](_0xe4f4f3);};}exports[_0x570a('0x3d')]=function(_0x10a983,_0x31e96a){var _0x11dbbe={},_0x53e226={},_0x3e5591={'count':0x0,'rows':[]};var _0xc6b02f=_[_0x570a('0x3e')](db[_0x570a('0x3f')][_0x570a('0x40')],function(_0x77224e){return{'name':_0x77224e[_0x570a('0x41')],'type':_0x77224e[_0x570a('0x42')][_0x570a('0x43')]};});_0x53e226['model']=_['map'](_0xc6b02f,'name');_0x53e226[_0x570a('0x44')]=_['keys'](_0x10a983[_0x570a('0x44')]);_0x53e226[_0x570a('0x45')]=_[_0x570a('0x46')](_0x53e226[_0x570a('0x47')],_0x53e226[_0x570a('0x44')]);_0x11dbbe[_0x570a('0x48')]=_[_0x570a('0x46')](_0x53e226['model'],qs[_0x570a('0x49')](_0x10a983[_0x570a('0x44')][_0x570a('0x49')]));_0x11dbbe[_0x570a('0x48')]=_0x11dbbe[_0x570a('0x48')][_0x570a('0x4a')]?_0x11dbbe[_0x570a('0x48')]:_0x53e226['model'];if(!_0x10a983[_0x570a('0x44')]['hasOwnProperty']('nolimit')){_0x11dbbe[_0x570a('0x32')]=qs[_0x570a('0x32')](_0x10a983[_0x570a('0x44')]['limit']);_0x11dbbe[_0x570a('0x31')]=qs['offset'](_0x10a983['query']['offset']);}_0x11dbbe['order']=qs['sort'](_0x10a983['query'][_0x570a('0x4b')]);_0x11dbbe[_0x570a('0x4c')]=qs[_0x570a('0x45')](_[_0x570a('0x4d')](_0x10a983[_0x570a('0x44')],_0x53e226[_0x570a('0x45')]),_0xc6b02f);if(_0x10a983[_0x570a('0x44')][_0x570a('0x4e')]){_0x11dbbe[_0x570a('0x4c')]=_[_0x570a('0x4f')](_0x11dbbe['where'],{'$or':_[_0x570a('0x3e')](_0xc6b02f,function(_0x489a9d){if(_0x489a9d[_0x570a('0x42')]!==_0x570a('0x50')){var _0x3bcdc6={};_0x3bcdc6[_0x489a9d[_0x570a('0x3b')]]={'$like':'%'+_0x10a983[_0x570a('0x44')]['filter']+'%'};return _0x3bcdc6;}})});}_0x11dbbe=_[_0x570a('0x4f')]({},_0x11dbbe,_0x10a983[_0x570a('0x51')]);var _0x51f53c={'where':_0x11dbbe[_0x570a('0x4c')]};return db[_0x570a('0x3f')][_0x570a('0x52')](_0x51f53c)[_0x570a('0x22')](function(_0x5403b7){_0x3e5591[_0x570a('0x52')]=_0x5403b7;if(_0x10a983[_0x570a('0x44')][_0x570a('0x53')]){_0x11dbbe[_0x570a('0x54')]=[{'all':!![]}];}return db['ChatQueue'][_0x570a('0x55')](_0x11dbbe);})[_0x570a('0x22')](function(_0x1fd67d){_0x3e5591[_0x570a('0x56')]=_0x1fd67d;return _0x3e5591;})['then'](respondWithFilteredResult(_0x31e96a,_0x11dbbe))[_0x570a('0x2d')](handleError(_0x31e96a,null));};exports[_0x570a('0x57')]=function(_0x1e7a02,_0x117159){var _0x21c90a={'raw':!![],'where':{'id':_0x1e7a02['params']['id']}},_0x3c1351={};_0x3c1351[_0x570a('0x47')]=_[_0x570a('0x58')](db[_0x570a('0x3f')]['rawAttributes']);_0x3c1351[_0x570a('0x44')]=_[_0x570a('0x58')](_0x1e7a02[_0x570a('0x44')]);_0x3c1351[_0x570a('0x45')]=_[_0x570a('0x46')](_0x3c1351[_0x570a('0x47')],_0x3c1351[_0x570a('0x44')]);_0x21c90a[_0x570a('0x48')]=_[_0x570a('0x46')](_0x3c1351[_0x570a('0x47')],qs[_0x570a('0x49')](_0x1e7a02[_0x570a('0x44')][_0x570a('0x49')]));_0x21c90a[_0x570a('0x48')]=_0x21c90a[_0x570a('0x48')][_0x570a('0x4a')]?_0x21c90a[_0x570a('0x48')]:_0x3c1351[_0x570a('0x47')];if(_0x1e7a02[_0x570a('0x44')][_0x570a('0x53')]){_0x21c90a[_0x570a('0x54')]=[{'all':!![]}];}_0x21c90a=_[_0x570a('0x4f')]({},_0x21c90a,_0x1e7a02[_0x570a('0x51')]);return db['ChatQueue'][_0x570a('0x59')](_0x21c90a)['then'](handleEntityNotFound(_0x117159,null))['then'](respondWithResult(_0x117159,null))[_0x570a('0x2d')](handleError(_0x117159,null));};exports[_0x570a('0x5a')]=function(_0x323a2c,_0x141f9f){return db[_0x570a('0x3f')][_0x570a('0x5a')](_0x323a2c[_0x570a('0x5b')],{})[_0x570a('0x22')](function(_0x1e59fd){var _0x15d08b=_0x323a2c[_0x570a('0x5c')][_0x570a('0x39')]({'plain':!![]});if(!_0x15d08b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15d08b[_0x570a('0x5d')]===_0x570a('0x5c')){var _0x11759a=_0x1e59fd[_0x570a('0x39')]({'plain':!![]});var _0x20e83a=_0x570a('0x5e');return db[_0x570a('0x5f')][_0x570a('0x59')]({'where':{'name':_0x20e83a,'userProfileId':_0x15d08b['userProfileId']},'raw':!![]})[_0x570a('0x22')](function(_0x438998){if(_0x438998&&_0x438998['autoAssociation']===0x0){return db[_0x570a('0x60')]['create']({'name':_0x11759a['name'],'resourceId':_0x11759a['id'],'type':_0x438998['name'],'sectionId':_0x438998['id']},{})[_0x570a('0x22')](function(){return _0x1e59fd;});}else{return _0x1e59fd;}})[_0x570a('0x2d')](function(_0x461079){logger[_0x570a('0x28')](_0x570a('0x61'),_0x461079);throw _0x461079;});}return _0x1e59fd;})[_0x570a('0x22')](respondWithResult(_0x141f9f,0xc9))[_0x570a('0x2d')](handleError(_0x141f9f,null));};exports[_0x570a('0x37')]=function(_0x5aa832,_0x2252f6){if(_0x5aa832[_0x570a('0x5b')]['id']){delete _0x5aa832[_0x570a('0x5b')]['id'];}return db['ChatQueue'][_0x570a('0x59')]({'where':{'id':_0x5aa832[_0x570a('0x62')]['id']}})[_0x570a('0x22')](handleEntityNotFound(_0x2252f6,null))['then'](saveUpdates(_0x5aa832['body'],null))['then'](respondWithResult(_0x2252f6,null))['catch'](handleError(_0x2252f6,null));};exports[_0x570a('0x38')]=function(_0x485786,_0xd3f486){return db[_0x570a('0x3f')]['find']({'where':{'id':_0x485786['params']['id']}})[_0x570a('0x22')](handleEntityNotFound(_0xd3f486,null))[_0x570a('0x22')](removeEntity(_0xd3f486,null))[_0x570a('0x2d')](handleError(_0xd3f486,null));};exports['describe']=function(_0x353baf,_0x28db4a){return db[_0x570a('0x3f')][_0x570a('0x63')]()[_0x570a('0x22')](respondWithResult(_0x28db4a,null))[_0x570a('0x2d')](handleError(_0x28db4a,null));};exports[_0x570a('0x64')]=function(_0x5d762e,_0x8fb996,_0x3c0053){var _0x4969d0={'raw':!![],'where':{}},_0x5390d2={},_0x28b89c;return db['ChatQueue'][_0x570a('0x65')]({'where':{'id':_0x5d762e[_0x570a('0x62')]['id']}})['then'](handleEntityNotFound(_0x8fb996,null))[_0x570a('0x22')](function(_0x2a0081){if(_0x2a0081){_0x28b89c=_0x2a0081['get']({'plain':!![]});_0x5390d2[_0x570a('0x47')]=_[_0x570a('0x58')](db[_0x570a('0x66')]['rawAttributes']);_0x5390d2[_0x570a('0x44')]=_['keys'](_0x5d762e[_0x570a('0x44')]);_0x5390d2[_0x570a('0x45')]=_[_0x570a('0x46')](_0x5390d2[_0x570a('0x47')],_0x5390d2['query']);_0x4969d0[_0x570a('0x48')]=_['intersection'](_0x5390d2['model'],qs[_0x570a('0x49')](_0x5d762e[_0x570a('0x44')][_0x570a('0x49')]));_0x4969d0[_0x570a('0x48')]=_0x4969d0[_0x570a('0x48')]['length']?_0x4969d0[_0x570a('0x48')]:_0x5390d2[_0x570a('0x47')];if(!_0x5d762e['query'][_0x570a('0x67')](_0x570a('0x68'))){_0x4969d0['limit']=qs['limit'](_0x5d762e[_0x570a('0x44')]['limit']);_0x4969d0[_0x570a('0x31')]=qs[_0x570a('0x31')](_0x5d762e[_0x570a('0x44')]['offset']);}_0x4969d0[_0x570a('0x69')]=qs[_0x570a('0x4b')](_0x5d762e['query']['sort']);_0x4969d0[_0x570a('0x4c')]=qs[_0x570a('0x45')](_[_0x570a('0x4d')](_0x5d762e[_0x570a('0x44')],_0x5390d2[_0x570a('0x45')]));_0x4969d0[_0x570a('0x4c')]['ChatQueueId']=_0x2a0081['id'];if(_0x5d762e[_0x570a('0x44')][_0x570a('0x4e')]){_0x4969d0['where']=_['merge'](_0x4969d0['where'],{'$or':_[_0x570a('0x3e')](_0x4969d0[_0x570a('0x48')],function(_0x2dd917){var _0x1209b4={};_0x1209b4[_0x2dd917]={'$like':'%'+_0x5d762e[_0x570a('0x44')][_0x570a('0x4e')]+'%'};return _0x1209b4;})});}_0x4969d0=_[_0x570a('0x4f')]({},_0x4969d0,_0x5d762e[_0x570a('0x51')]);return db['UserChatQueue']['findAll'](_0x4969d0);}})[_0x570a('0x22')](function(_0x3eb550){if(_0x3eb550){return db['User'][_0x570a('0x6a')]({'where':{'id':_[_0x570a('0x3e')](_0x3eb550,_0x570a('0x6b')),'role':_0x570a('0x6c')},'attributes':['id',_0x570a('0x3b'),_0x570a('0x6d'),_0x570a('0x6e'),'createdAt']});}})['then'](function(_0x3984bb){if(_0x3984bb){return{'count':_0x3984bb[_0x570a('0x52')],'rows':_[_0x570a('0x3e')](_0x3984bb[_0x570a('0x56')],function(_0x1f5acb){return{'membername':_0x1f5acb['name'],'UserId':_0x1f5acb['id'],'queue_name':_0x28b89c[_0x570a('0x3b')],'ChatQueueId':_0x28b89c['id'],'interface':util[_0x570a('0x6f')](_0x570a('0x70'),'SIP',_0x1f5acb[_0x570a('0x3b')]),'penalty':0x0,'paused':_0x1f5acb[_0x570a('0x6d')],'createdAt':_0x1f5acb['createdAt'],'updatedAt':_0x1f5acb[_0x570a('0x6e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x8fb996,_0x4969d0))[_0x570a('0x2d')](handleError(_0x8fb996,null));};exports['getTeams']=function(_0x22c11c,_0x2b1e80,_0x3c6cab){var _0xe64b7a={};var _0x3101a8={};var _0xfb45e7;var _0x52861e;return db['ChatQueue'][_0x570a('0x65')]({'where':{'id':_0x22c11c[_0x570a('0x62')]['id']}})[_0x570a('0x22')](handleEntityNotFound(_0x2b1e80,null))[_0x570a('0x22')](function(_0x51348a){if(_0x51348a){_0xfb45e7=_0x51348a;_0x3101a8[_0x570a('0x47')]=_[_0x570a('0x58')](db[_0x570a('0x71')]['rawAttributes']);_0x3101a8[_0x570a('0x44')]=_[_0x570a('0x58')](_0x22c11c['query']);_0x3101a8[_0x570a('0x45')]=_[_0x570a('0x46')](_0x3101a8[_0x570a('0x47')],_0x3101a8[_0x570a('0x44')]);_0xe64b7a['attributes']=_[_0x570a('0x46')](_0x3101a8[_0x570a('0x47')],qs[_0x570a('0x49')](_0x22c11c['query'][_0x570a('0x49')]));_0xe64b7a[_0x570a('0x48')]=_0xe64b7a[_0x570a('0x48')][_0x570a('0x4a')]?_0xe64b7a['attributes']:_0x3101a8['model'];_0xe64b7a[_0x570a('0x69')]=qs['sort'](_0x22c11c[_0x570a('0x44')][_0x570a('0x4b')]);_0xe64b7a['where']=qs[_0x570a('0x45')](_[_0x570a('0x4d')](_0x22c11c[_0x570a('0x44')],_0x3101a8[_0x570a('0x45')]));if(_0x22c11c[_0x570a('0x44')]['filter']){_0xe64b7a[_0x570a('0x4c')]=_[_0x570a('0x4f')](_0xe64b7a[_0x570a('0x4c')],{'$or':_[_0x570a('0x3e')](_0xe64b7a[_0x570a('0x48')],function(_0x5e7086){var _0x365dc7={};_0x365dc7[_0x5e7086]={'$like':'%'+_0x22c11c[_0x570a('0x44')][_0x570a('0x4e')]+'%'};return _0x365dc7;})});}_0xe64b7a=_[_0x570a('0x4f')]({},_0xe64b7a,_0x22c11c['options']);return _0xfb45e7[_0x570a('0x72')](_0xe64b7a);}})[_0x570a('0x22')](function(_0x48d346){if(_0x48d346){_0x52861e=_0x48d346[_0x570a('0x4a')];if(!_0x22c11c[_0x570a('0x44')]['hasOwnProperty']('nolimit')){_0xe64b7a[_0x570a('0x32')]=qs[_0x570a('0x32')](_0x22c11c[_0x570a('0x44')][_0x570a('0x32')]);_0xe64b7a[_0x570a('0x31')]=qs[_0x570a('0x31')](_0x22c11c[_0x570a('0x44')][_0x570a('0x31')]);}return _0xfb45e7[_0x570a('0x72')](_0xe64b7a);}})[_0x570a('0x22')](function(_0xb407){if(_0xb407){return _0xb407?{'count':_0x52861e,'rows':_0xb407}:null;}})['then'](respondWithResult(_0x2b1e80,null))[_0x570a('0x2d')](handleError(_0x2b1e80,null));};exports[_0x570a('0x73')]=function(_0x2e9014,_0x3cc64f,_0x5eaee9){var _0xa083f=_0x2e9014[_0x570a('0x5b')][_0x570a('0x74')];return db['Team'][_0x570a('0x55')]({'where':{'id':_0xa083f},'attributes':['id'],'include':[{'model':db['User'],'as':_0x570a('0x75'),'attributes':['id',_0x570a('0x3b'),'online',_0x570a('0x76'),'interface'],'raw':!![]}]})[_0x570a('0x22')](function(_0xc70ca2){if(_0xc70ca2){var _0x404f96=_[_0x570a('0x77')](_0xc70ca2,function(_0x24eded){var _0x11933c=_0x24eded[_0x570a('0x39')]({'plain':!![]});return _0x11933c['Agents'];});return db[_0x570a('0x3f')][_0x570a('0x59')]({'where':{'id':_0x2e9014[_0x570a('0x62')]['id']}})[_0x570a('0x22')](function(_0x4eaed8){return db[_0x570a('0x78')]['transaction'](function(_0x57781f){return _0x4eaed8[_0x570a('0x73')](_0xa083f,{'transaction':_0x57781f})[_0x570a('0x22')](function(){return BPromise[_0x570a('0x79')](_0x404f96,function(_0x4c29a1){return db[_0x570a('0x66')][_0x570a('0x7a')]({'where':{'UserId':_0x4c29a1['id'],'ChatQueueId':_0x2e9014[_0x570a('0x62')]['id']},'transaction':_0x57781f});});})['then'](function(){_0x404f96[_0x570a('0x7b')](function(_0x1d7528){socket[_0x570a('0x7c')](_0x570a('0x7d'),{'UserId':_0x1d7528['id'],'ChatQueueId':_0x4eaed8['id']});});});});});}})[_0x570a('0x22')](respondWithStatusCode(_0x3cc64f,null))[_0x570a('0x2d')](handleError(_0x3cc64f,null));};exports[_0x570a('0x7e')]=function(_0x857812,_0x1faa72,_0xb6b9ca){return db[_0x570a('0x71')][_0x570a('0x55')]({'where':{'id':_0x857812['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x570a('0x7f')],'as':_0x570a('0x75'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1faa72,null))[_0x570a('0x22')](function(_0x9d3aa3){var _0x4d6f01=_[_0x570a('0x3e')](_0x9d3aa3,'id');var _0x801005=[];var _0x14aecd=[];var _0x568b08=squel[_0x570a('0x80')]();_0x568b08[_0x570a('0x81')](_0x570a('0x82'))[_0x570a('0x83')]('team_has_chat_queues','tq')[_0x570a('0x84')]('user_has_teams','ut',_0x570a('0x85'))['where'](_0x570a('0x86'),_0x857812[_0x570a('0x62')]['id']);for(var _0x58f96f=0x0;_0x58f96f<_0x9d3aa3[_0x570a('0x4a')];_0x58f96f+=0x1){let _0x2dff99=_0x9d3aa3[_0x58f96f];for(var _0x452db9=0x0;_0x452db9<_0x2dff99['Agents']['length'];_0x452db9+=0x1){let _0x146742=_0x2dff99[_0x570a('0x75')][_0x452db9];var _0xb02baa=_0x568b08[_0x570a('0x87')]();_0xb02baa[_0x570a('0x4c')](_0x570a('0x88'),_0x146742['id']);_0x14aecd[_0x570a('0x89')](db['sequelize'][_0x570a('0x44')](_0xb02baa[_0x570a('0x8a')](),{'type':db[_0x570a('0x78')][_0x570a('0x8b')][_0x570a('0x8c')]})[_0x570a('0x22')](function(_0x2d788d){if(_0x2d788d['length']===0x1){return _0x146742['id'];}else{var _0x4689e3=_[_0x570a('0x8d')](_[_0x570a('0x3e')](_0x2d788d,_0x570a('0x8e')),function(_0x113516){return _['includes'](_0x4d6f01,_0x113516);});if(_0x4689e3){return _0x146742['id'];}}}));}}return BPromise[_0x570a('0x8f')](_0x14aecd)[_0x570a('0x22')](function(_0x3ed6c6){_0x801005=_(_0x801005)['union'](_0x3ed6c6)[_0x570a('0x90')]()[_0x570a('0x91')]();return db[_0x570a('0x3f')]['find']({'where':{'id':_0x857812[_0x570a('0x62')]['id']}})[_0x570a('0x22')](function(_0x39ee5b){return db['sequelize'][_0x570a('0x92')](function(_0x57faf7){return _0x39ee5b['removeTeams'](_0x857812['query'][_0x570a('0x74')],{'transaction':_0x57faf7})['then'](function(){if(!_[_0x570a('0x93')](_0x801005)){return _0x39ee5b[_0x570a('0x94')](_0x801005,{'transaction':_0x57faf7});}})[_0x570a('0x22')](function(){_0x801005[_0x570a('0x7b')](function(_0x1bb985){socket[_0x570a('0x7c')](_0x570a('0x95'),{'UserId':_0x1bb985,'ChatQueueId':_0x39ee5b['id']});});});});});});})['then'](respondWithStatusCode(_0x1faa72,null))[_0x570a('0x2d')](handleError(_0x1faa72,null));};exports[_0x570a('0x96')]=function(_0x41a27a,_0x5c8096,_0x300987){return db[_0x570a('0x3f')][_0x570a('0x59')]({'where':{'id':_0x41a27a[_0x570a('0x62')]['id']}})['then'](handleEntityNotFound(_0x5c8096,null))[_0x570a('0x22')](function(_0x46907c){if(_0x46907c){return _0x46907c[_0x570a('0x96')](_0x41a27a[_0x570a('0x5b')]['ids'],_[_0x570a('0x97')](_0x41a27a[_0x570a('0x5b')],['ids','id'])||{})[_0x570a('0x98')](function(_0xaf35cf){for(var _0x5532fa=0x0;_0x5532fa<_0x41a27a[_0x570a('0x5b')][_0x570a('0x74')][_0x570a('0x4a')];_0x5532fa+=0x1){socket[_0x570a('0x7c')]('userChatQueue:save',{'UserId':_0x41a27a['body']['ids'][_0x5532fa],'ChatQueueId':_0x41a27a['params']['id']});}return _0xaf35cf;});}})[_0x570a('0x22')](respondWithResult(_0x5c8096,null))[_0x570a('0x2d')](handleError(_0x5c8096,null));};exports['removeAgents']=function(_0xd69485,_0x181c09,_0xc0ceef){return db[_0x570a('0x3f')]['find']({'where':{'id':_0xd69485[_0x570a('0x62')]['id']}})[_0x570a('0x22')](handleEntityNotFound(_0x181c09,null))['then'](function(_0x26a0f7){if(_0x26a0f7){return _0x26a0f7[_0x570a('0x94')](_0xd69485[_0x570a('0x44')][_0x570a('0x74')])['then'](function(){if(_[_0x570a('0x99')](_0xd69485['query'][_0x570a('0x74')])){for(var _0x216b42=0x0;_0x216b42<_0xd69485[_0x570a('0x44')]['ids'][_0x570a('0x4a')];_0x216b42+=0x1){socket[_0x570a('0x7c')](_0x570a('0x95'),{'UserId':Number(_0xd69485['query'][_0x570a('0x74')][_0x216b42]),'ChatQueueId':Number(_0xd69485[_0x570a('0x62')]['id'])});}}else{socket['emit'](_0x570a('0x95'),{'UserId':Number(_0xd69485[_0x570a('0x44')]['ids']),'ChatQueueId':Number(_0xd69485[_0x570a('0x62')]['id'])});}});}})['then'](respondWithStatusCode(_0x181c09,null))[_0x570a('0x2d')](handleError(_0x181c09,null));};exports['getAgents']=function(_0x586426,_0x5ee794,_0x52b461){var _0x4e378e={};var _0x496053={};var _0x1e3dea;var _0x40ee7c;return db[_0x570a('0x3f')][_0x570a('0x65')]({'where':{'id':_0x586426[_0x570a('0x62')]['id']}})['then'](handleEntityNotFound(_0x5ee794,null))[_0x570a('0x22')](function(_0x8c329c){if(_0x8c329c){_0x1e3dea=_0x8c329c;_0x496053['model']=_[_0x570a('0x58')](db[_0x570a('0x7f')]['rawAttributes']);_0x496053[_0x570a('0x44')]=_['keys'](_0x586426[_0x570a('0x44')]);_0x496053['filters']=_[_0x570a('0x46')](_0x496053[_0x570a('0x47')],_0x496053['query']);_0x4e378e[_0x570a('0x48')]=_[_0x570a('0x46')](_0x496053[_0x570a('0x47')],qs[_0x570a('0x49')](_0x586426['query']['fields']));_0x4e378e['attributes']=_0x4e378e[_0x570a('0x48')][_0x570a('0x4a')]?_0x4e378e[_0x570a('0x48')]:_0x496053[_0x570a('0x47')];_0x4e378e[_0x570a('0x69')]=qs[_0x570a('0x4b')](_0x586426[_0x570a('0x44')][_0x570a('0x4b')]);_0x4e378e[_0x570a('0x4c')]=qs['filters'](_[_0x570a('0x4d')](_0x586426[_0x570a('0x44')],_0x496053[_0x570a('0x45')]));if(_0x586426[_0x570a('0x44')][_0x570a('0x4e')]){_0x4e378e[_0x570a('0x4c')]=_[_0x570a('0x4f')](_0x4e378e[_0x570a('0x4c')],{'$or':_[_0x570a('0x3e')](_0x4e378e['attributes'],function(_0x1376be){var _0x4cc9f3={};_0x4cc9f3[_0x1376be]={'$like':'%'+_0x586426[_0x570a('0x44')][_0x570a('0x4e')]+'%'};return _0x4cc9f3;})});}_0x4e378e=_[_0x570a('0x4f')]({},_0x4e378e,_0x586426['options']);return _0x1e3dea['getAgents'](_0x4e378e);}})['then'](function(_0x4799d5){if(_0x4799d5){_0x40ee7c=_0x4799d5['length'];if(!_0x586426[_0x570a('0x44')][_0x570a('0x67')](_0x570a('0x68'))){_0x4e378e[_0x570a('0x32')]=qs[_0x570a('0x32')](_0x586426[_0x570a('0x44')][_0x570a('0x32')]);_0x4e378e[_0x570a('0x31')]=qs['offset'](_0x586426[_0x570a('0x44')][_0x570a('0x31')]);}return _0x1e3dea['getAgents'](_0x4e378e);}})[_0x570a('0x22')](function(_0x138974){if(_0x138974){return _0x138974?{'count':_0x40ee7c,'rows':_0x138974}:null;}})[_0x570a('0x22')](respondWithResult(_0x5ee794,null))[_0x570a('0x2d')](handleError(_0x5ee794,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 241e0f1..7c23753 100644 --- a/server/api/chatQueue/chatQueue.events.js +++ b/server/api/chatQueue/chatQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x524499,_0x1c48e9){var _0xeecf1=function(_0x44b4c5){while(--_0x44b4c5){_0x524499['push'](_0x524499['shift']());}};_0xeecf1(++_0x1c48e9);}(_0xb10b,0x12a));var _0xbb10=function(_0x34501b,_0x264e47){_0x34501b=_0x34501b-0x0;var _0xdcbacd=_0xb10b[_0x34501b];return _0xdcbacd;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x2f0be9,_0x5bd044){var _0x6d42d6=function(_0x4bb895){while(--_0x4bb895){_0x2f0be9['push'](_0x2f0be9['shift']());}};_0x6d42d6(++_0x5bd044);}(_0xb10b,0x12a));var _0xbb10=function(_0xf64e53,_0x4db24b){_0xf64e53=_0xf64e53-0x0;var _0x1e185e=_0xb10b[_0xf64e53];return _0x1e185e;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 50c2280..2c34fcf 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 _0xaa0c=['define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports'];(function(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0xaa0c,0xff));var _0xcaa0=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xaa0c[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0xcaa0('0x0'));var util=require(_0xcaa0('0x1'));var logger=require(_0xcaa0('0x2'))(_0xcaa0('0x3'));var moment=require('moment');var BPromise=require(_0xcaa0('0x4'));var rp=require(_0xcaa0('0x5'));var fs=require('fs');var path=require(_0xcaa0('0x6'));var rimraf=require(_0xcaa0('0x7'));var config=require(_0xcaa0('0x8'));var attributes=require(_0xcaa0('0x9'));module[_0xcaa0('0xa')]=function(_0x1a3010,_0x14b3c1){return _0x1a3010[_0xcaa0('0xb')](_0xcaa0('0xc'),attributes,{'tableName':_0xcaa0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84a1=['chat_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatQueue.attributes','define','ChatQueue'];(function(_0x215393,_0x4c406d){var _0x595198=function(_0x5d641f){while(--_0x5d641f){_0x215393['push'](_0x215393['shift']());}};_0x595198(++_0x4c406d);}(_0x84a1,0xe5));var _0x184a=function(_0x444b1a,_0x539cee){_0x444b1a=_0x444b1a-0x0;var _0x5c4412=_0x84a1[_0x444b1a];return _0x5c4412;};'use strict';var _=require(_0x184a('0x0'));var util=require('util');var logger=require(_0x184a('0x1'))(_0x184a('0x2'));var moment=require(_0x184a('0x3'));var BPromise=require(_0x184a('0x4'));var rp=require(_0x184a('0x5'));var fs=require('fs');var path=require(_0x184a('0x6'));var rimraf=require(_0x184a('0x7'));var config=require('../../config/environment');var attributes=require(_0x184a('0x8'));module['exports']=function(_0x9e256d,_0x100bb5){return _0x9e256d[_0x184a('0x9')](_0x184a('0xa'),attributes,{'tableName':_0x184a('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 a3e4ecd..fb20f86 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 _0x4910=['GetChatQueue','stringify','catch','ShowChatQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','findAll','options','raw','where','attributes','limit','include','model','map'];(function(_0x503564,_0x55867e){var _0x4be9fd=function(_0x41c543){while(--_0x41c543){_0x503564['push'](_0x503564['shift']());}};_0x4be9fd(++_0x55867e);}(_0x4910,0x1d9));var _0x0491=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4910[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x0491('0x0'));var util=require(_0x0491('0x1'));var moment=require(_0x0491('0x2'));var BPromise=require('bluebird');var rs=require(_0x0491('0x3'));var fs=require('fs');var Redis=require(_0x0491('0x4'));var db=require(_0x0491('0x5'))['db'];var utils=require(_0x0491('0x6'));var logger=require(_0x0491('0x7'))('rpc');var config=require(_0x0491('0x8'));var jayson=require(_0x0491('0x9'));var client=jayson[_0x0491('0xa')][_0x0491('0xb')]({'port':0x232a});config[_0x0491('0xc')]=_['defaults'](config[_0x0491('0xc')],{'host':_0x0491('0xd'),'port':0x18eb});var socket=require(_0x0491('0xe'))(new Redis(config[_0x0491('0xc')]));require(_0x0491('0xf'))['register'](socket);function respondWithRpcPromise(_0x1a4359,_0x51bd65,_0x39bafa){return new BPromise(function(_0x1b57a1,_0x3ff9c6){return client[_0x0491('0x10')](_0x1a4359,_0x39bafa)[_0x0491('0x11')](function(_0x12ab48){logger[_0x0491('0x12')](_0x0491('0x13'),_0x51bd65,_0x0491('0x14'));logger[_0x0491('0x15')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x51bd65,_0x0491('0x14'),JSON['stringify'](_0x12ab48));if(_0x12ab48[_0x0491('0x16')]){if(_0x12ab48['error']['code']===0x1f4){logger[_0x0491('0x16')](_0x0491('0x13'),_0x51bd65,_0x12ab48[_0x0491('0x16')][_0x0491('0x17')]);return _0x3ff9c6(_0x12ab48[_0x0491('0x16')][_0x0491('0x17')]);}logger[_0x0491('0x16')](_0x0491('0x13'),_0x51bd65,_0x12ab48[_0x0491('0x16')][_0x0491('0x17')]);return _0x1b57a1(_0x12ab48['error'][_0x0491('0x17')]);}else{logger[_0x0491('0x12')](_0x0491('0x13'),_0x51bd65,_0x0491('0x14'));_0x1b57a1(_0x12ab48[_0x0491('0x18')][_0x0491('0x17')]);}})['catch'](function(_0x1a924b){logger[_0x0491('0x16')]('ChatQueue,\x20%s,\x20%s',_0x51bd65,_0x1a924b);_0x3ff9c6(_0x1a924b);});});}exports['GetChatQueue']=function(_0x1ba594){var _0x52b6cc=this;return new Promise(function(_0x6f8139,_0x431782){return db['ChatQueue'][_0x0491('0x19')]({'raw':_0x1ba594[_0x0491('0x1a')]?_0x1ba594[_0x0491('0x1a')][_0x0491('0x1b')]===undefined?!![]:![]:!![],'where':_0x1ba594['options']?_0x1ba594[_0x0491('0x1a')][_0x0491('0x1c')]||null:null,'attributes':_0x1ba594[_0x0491('0x1a')]?_0x1ba594['options'][_0x0491('0x1d')]||null:null,'limit':_0x1ba594[_0x0491('0x1a')]?_0x1ba594[_0x0491('0x1a')][_0x0491('0x1e')]||null:null,'include':_0x1ba594[_0x0491('0x1a')]?_0x1ba594[_0x0491('0x1a')][_0x0491('0x1f')]?_['map'](_0x1ba594[_0x0491('0x1a')][_0x0491('0x1f')],function(_0xc0c021){return{'model':db[_0xc0c021[_0x0491('0x20')]],'as':_0xc0c021['as'],'attributes':_0xc0c021[_0x0491('0x1d')],'include':_0xc0c021['include']?_[_0x0491('0x21')](_0xc0c021[_0x0491('0x1f')],function(_0x59beec){return{'model':db[_0x59beec[_0x0491('0x20')]],'as':_0x59beec['as'],'attributes':_0x59beec[_0x0491('0x1d')],'include':_0x59beec[_0x0491('0x1f')]?_[_0x0491('0x21')](_0x59beec[_0x0491('0x1f')],function(_0x38b4b8){return{'model':db[_0x38b4b8[_0x0491('0x20')]],'as':_0x38b4b8['as'],'attributes':_0x38b4b8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5daa56){logger['info'](_0x0491('0x22'),_0x1ba594);logger['debug'](_0x0491('0x22'),_0x1ba594,JSON[_0x0491('0x23')](_0x5daa56));_0x6f8139(_0x5daa56);})[_0x0491('0x24')](function(_0x7d4feb){logger[_0x0491('0x16')](_0x0491('0x22'),_0x7d4feb[_0x0491('0x17')],_0x1ba594);_0x431782(_0x52b6cc['error'](0x1f4,_0x7d4feb[_0x0491('0x17')]));});});};exports[_0x0491('0x25')]=function(_0x9b11c2){var _0x5cb278=this;return new Promise(function(_0x4c2a8e,_0x57103a){return db['ChatQueue'][_0x0491('0x26')]({'raw':_0x9b11c2['options']?_0x9b11c2[_0x0491('0x1a')][_0x0491('0x1b')]===undefined?!![]:![]:!![],'where':_0x9b11c2[_0x0491('0x1a')]?_0x9b11c2[_0x0491('0x1a')][_0x0491('0x1c')]||null:null,'attributes':_0x9b11c2[_0x0491('0x1a')]?_0x9b11c2[_0x0491('0x1a')][_0x0491('0x1d')]||null:null,'include':_0x9b11c2['options']?_0x9b11c2[_0x0491('0x1a')]['include']?_[_0x0491('0x21')](_0x9b11c2[_0x0491('0x1a')]['include'],function(_0x20e036){return{'model':db[_0x20e036['model']],'as':_0x20e036['as'],'attributes':_0x20e036[_0x0491('0x1d')],'include':_0x20e036[_0x0491('0x1f')]?_[_0x0491('0x21')](_0x20e036[_0x0491('0x1f')],function(_0x52a51a){return{'model':db[_0x52a51a['model']],'as':_0x52a51a['as'],'attributes':_0x52a51a[_0x0491('0x1d')],'include':_0x52a51a[_0x0491('0x1f')]?_[_0x0491('0x21')](_0x52a51a['include'],function(_0x18c2e7){return{'model':db[_0x18c2e7['model']],'as':_0x18c2e7['as'],'attributes':_0x18c2e7[_0x0491('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4145fe){logger[_0x0491('0x12')](_0x0491('0x25'),_0x9b11c2);logger['debug']('ShowChatQueue',_0x9b11c2,JSON[_0x0491('0x23')](_0x4145fe));_0x4c2a8e(_0x4145fe);})[_0x0491('0x24')](function(_0x459df1){logger['error']('ShowChatQueue',_0x459df1[_0x0491('0x17')],_0x9b11c2);_0x57103a(_0x5cb278[_0x0491('0x16')](0x1f4,_0x459df1[_0x0491('0x17')]));});});}; \ No newline at end of file +var _0x0caf=['randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','info','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','attributes','limit','include','map','model','then','debug','ShowChatQueue','find','where','bluebird'];(function(_0x1916ea,_0x3068d6){var _0x829e5f=function(_0x3ed76f){while(--_0x3ed76f){_0x1916ea['push'](_0x1916ea['shift']());}};_0x829e5f(++_0x3068d6);}(_0x0caf,0x9f));var _0xf0ca=function(_0x4178f0,_0x5f1a50){_0x4178f0=_0x4178f0-0x0;var _0x39a16c=_0x0caf[_0x4178f0];return _0x39a16c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf0ca('0x0'));var rs=require(_0xf0ca('0x1'));var fs=require('fs');var Redis=require(_0xf0ca('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf0ca('0x3'))(_0xf0ca('0x4'));var config=require('../../config/environment');var jayson=require(_0xf0ca('0x5'));var client=jayson[_0xf0ca('0x6')][_0xf0ca('0x7')]({'port':0x232a});config['redis']=_[_0xf0ca('0x8')](config[_0xf0ca('0x9')],{'host':_0xf0ca('0xa'),'port':0x18eb});var socket=require(_0xf0ca('0xb'))(new Redis(config[_0xf0ca('0x9')]));require(_0xf0ca('0xc'))[_0xf0ca('0xd')](socket);function respondWithRpcPromise(_0x5bbec7,_0x11aa70,_0x78f205){return new BPromise(function(_0x1542b6,_0xa3f45){return client[_0xf0ca('0xe')](_0x5bbec7,_0x78f205)['then'](function(_0x49aa3d){logger[_0xf0ca('0xf')]('ChatQueue,\x20%s,\x20%s',_0x11aa70,_0xf0ca('0x10'));logger['debug'](_0xf0ca('0x11'),_0x11aa70,_0xf0ca('0x10'),JSON[_0xf0ca('0x12')](_0x49aa3d));if(_0x49aa3d[_0xf0ca('0x13')]){if(_0x49aa3d[_0xf0ca('0x13')][_0xf0ca('0x14')]===0x1f4){logger['error'](_0xf0ca('0x15'),_0x11aa70,_0x49aa3d['error']['message']);return _0xa3f45(_0x49aa3d[_0xf0ca('0x13')][_0xf0ca('0x16')]);}logger[_0xf0ca('0x13')](_0xf0ca('0x15'),_0x11aa70,_0x49aa3d[_0xf0ca('0x13')]['message']);return _0x1542b6(_0x49aa3d['error'][_0xf0ca('0x16')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x11aa70,_0xf0ca('0x10'));_0x1542b6(_0x49aa3d[_0xf0ca('0x17')][_0xf0ca('0x16')]);}})[_0xf0ca('0x18')](function(_0x3a1466){logger[_0xf0ca('0x13')]('ChatQueue,\x20%s,\x20%s',_0x11aa70,_0x3a1466);_0xa3f45(_0x3a1466);});});}exports[_0xf0ca('0x19')]=function(_0x58bed2){var _0x10bd95=this;return new Promise(function(_0x1409c4,_0x50f742){return db[_0xf0ca('0x1a')][_0xf0ca('0x1b')]({'raw':_0x58bed2[_0xf0ca('0x1c')]?_0x58bed2[_0xf0ca('0x1c')][_0xf0ca('0x1d')]===undefined?!![]:![]:!![],'where':_0x58bed2[_0xf0ca('0x1c')]?_0x58bed2[_0xf0ca('0x1c')]['where']||null:null,'attributes':_0x58bed2[_0xf0ca('0x1c')]?_0x58bed2[_0xf0ca('0x1c')][_0xf0ca('0x1e')]||null:null,'limit':_0x58bed2[_0xf0ca('0x1c')]?_0x58bed2[_0xf0ca('0x1c')][_0xf0ca('0x1f')]||null:null,'include':_0x58bed2['options']?_0x58bed2['options'][_0xf0ca('0x20')]?_[_0xf0ca('0x21')](_0x58bed2[_0xf0ca('0x1c')][_0xf0ca('0x20')],function(_0x106f8e){return{'model':db[_0x106f8e[_0xf0ca('0x22')]],'as':_0x106f8e['as'],'attributes':_0x106f8e[_0xf0ca('0x1e')],'include':_0x106f8e[_0xf0ca('0x20')]?_['map'](_0x106f8e['include'],function(_0x22c0f0){return{'model':db[_0x22c0f0[_0xf0ca('0x22')]],'as':_0x22c0f0['as'],'attributes':_0x22c0f0['attributes'],'include':_0x22c0f0[_0xf0ca('0x20')]?_[_0xf0ca('0x21')](_0x22c0f0[_0xf0ca('0x20')],function(_0x2aaae9){return{'model':db[_0x2aaae9['model']],'as':_0x2aaae9['as'],'attributes':_0x2aaae9[_0xf0ca('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf0ca('0x23')](function(_0x35b78c){logger[_0xf0ca('0xf')](_0xf0ca('0x19'),_0x58bed2);logger[_0xf0ca('0x24')](_0xf0ca('0x19'),_0x58bed2,JSON['stringify'](_0x35b78c));_0x1409c4(_0x35b78c);})[_0xf0ca('0x18')](function(_0x4ba8ac){logger[_0xf0ca('0x13')]('GetChatQueue',_0x4ba8ac[_0xf0ca('0x16')],_0x58bed2);_0x50f742(_0x10bd95[_0xf0ca('0x13')](0x1f4,_0x4ba8ac[_0xf0ca('0x16')]));});});};exports[_0xf0ca('0x25')]=function(_0x35bcd7){var _0x2c39f3=this;return new Promise(function(_0x108281,_0x3be90c){return db[_0xf0ca('0x1a')][_0xf0ca('0x26')]({'raw':_0x35bcd7[_0xf0ca('0x1c')]?_0x35bcd7[_0xf0ca('0x1c')][_0xf0ca('0x1d')]===undefined?!![]:![]:!![],'where':_0x35bcd7[_0xf0ca('0x1c')]?_0x35bcd7['options'][_0xf0ca('0x27')]||null:null,'attributes':_0x35bcd7[_0xf0ca('0x1c')]?_0x35bcd7[_0xf0ca('0x1c')][_0xf0ca('0x1e')]||null:null,'include':_0x35bcd7['options']?_0x35bcd7[_0xf0ca('0x1c')]['include']?_[_0xf0ca('0x21')](_0x35bcd7['options'][_0xf0ca('0x20')],function(_0x2c218b){return{'model':db[_0x2c218b['model']],'as':_0x2c218b['as'],'attributes':_0x2c218b[_0xf0ca('0x1e')],'include':_0x2c218b['include']?_['map'](_0x2c218b[_0xf0ca('0x20')],function(_0x459169){return{'model':db[_0x459169[_0xf0ca('0x22')]],'as':_0x459169['as'],'attributes':_0x459169[_0xf0ca('0x1e')],'include':_0x459169[_0xf0ca('0x20')]?_['map'](_0x459169[_0xf0ca('0x20')],function(_0x448969){return{'model':db[_0x448969[_0xf0ca('0x22')]],'as':_0x448969['as'],'attributes':_0x448969[_0xf0ca('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf0ca('0x23')](function(_0x46219a){logger['info'](_0xf0ca('0x25'),_0x35bcd7);logger[_0xf0ca('0x24')](_0xf0ca('0x25'),_0x35bcd7,JSON[_0xf0ca('0x12')](_0x46219a));_0x108281(_0x46219a);})['catch'](function(_0x206df2){logger['error'](_0xf0ca('0x25'),_0x206df2[_0xf0ca('0x16')],_0x35bcd7);_0x3be90c(_0x2c39f3[_0xf0ca('0x13')](0x1f4,_0x206df2[_0xf0ca('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 2792abc..ed6a9b2 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 _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x46939d,_0xc1b36d){var _0x5105e8=function(_0x536281){while(--_0x536281){_0x46939d['push'](_0x46939d['shift']());}};_0x5105e8(++_0xc1b36d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x23dc5b,_0x15a5d4){_0x23dc5b=_0x23dc5b-0x0;var _0x7e075d=_0x5f2f[_0x23dc5b];return _0x7e075d;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatQueue:','./chatQueue.events','remove','update'];(function(_0x1633e9,_0x50a939){var _0x549ace=function(_0x15a157){while(--_0x15a157){_0x1633e9['push'](_0x1633e9['shift']());}};_0x549ace(++_0x50a939);}(_0xb10b,0x12a));var _0xbb10=function(_0x49c54c,_0x54a647){_0x49c54c=_0x49c54c-0x0;var _0x446225=_0xb10b[_0x49c54c];return _0x446225;};'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 diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 94ef285..482d4bc 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 _0xc5bd=['../../components/interaction/service','../../config/environment','get','/describe','/:id','isAuthenticated','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc5bd,0x9a));var _0xdc5b=function(_0xcbf120,_0x3c423f){_0xcbf120=_0xcbf120-0x0;var _0x573bea=_0xc5bd[_0xcbf120];return _0x573bea;};'use strict';var multer=require(_0xdc5b('0x0'));var util=require(_0xdc5b('0x1'));var path=require(_0xdc5b('0x2'));var timeout=require(_0xdc5b('0x3'));var express=require(_0xdc5b('0x4'));var router=express[_0xdc5b('0x5')]();var fs_extra=require(_0xdc5b('0x6'));var auth=require(_0xdc5b('0x7'));var interaction=require(_0xdc5b('0x8'));var config=require(_0xdc5b('0x9'));var controller=require('./chatQueue.controller');router[_0xdc5b('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdc5b('0xa')](_0xdc5b('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xdc5b('0xa')](_0xdc5b('0xc'),auth[_0xdc5b('0xd')](),controller[_0xdc5b('0xe')]);router[_0xdc5b('0xa')]('/:id/members',auth[_0xdc5b('0xd')](),controller[_0xdc5b('0xf')]);router['get'](_0xdc5b('0x10'),auth['isAuthenticated'](),controller[_0xdc5b('0x11')]);router[_0xdc5b('0xa')](_0xdc5b('0x12'),auth['isAuthenticated'](),controller[_0xdc5b('0x13')]);router[_0xdc5b('0x14')]('/',auth[_0xdc5b('0xd')](),controller[_0xdc5b('0x15')]);router['post'](_0xdc5b('0x10'),auth['isAuthenticated'](),controller['addTeams']);router[_0xdc5b('0x14')](_0xdc5b('0x12'),auth['isAuthenticated'](),controller[_0xdc5b('0x16')]);router[_0xdc5b('0x17')](_0xdc5b('0xc'),auth[_0xdc5b('0xd')](),controller['update']);router[_0xdc5b('0x18')]('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xdc5b('0x10'),auth[_0xdc5b('0xd')](),controller['removeTeams']);router[_0xdc5b('0x18')](_0xdc5b('0x12'),auth[_0xdc5b('0xd')](),controller[_0xdc5b('0x19')]);module[_0xdc5b('0x1a')]=router; \ No newline at end of file +var _0x0a68=['fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','update','delete','removeTeams','exports','multer','path','connect-timeout','express','Router'];(function(_0x1afd7b,_0x45a10c){var _0x2b571e=function(_0x5307cf){while(--_0x5307cf){_0x1afd7b['push'](_0x1afd7b['shift']());}};_0x2b571e(++_0x45a10c);}(_0x0a68,0x12f));var _0x80a6=function(_0x566d78,_0x56249b){_0x566d78=_0x566d78-0x0;var _0x1f2375=_0x0a68[_0x566d78];return _0x1f2375;};'use strict';var multer=require(_0x80a6('0x0'));var util=require('util');var path=require(_0x80a6('0x1'));var timeout=require(_0x80a6('0x2'));var express=require(_0x80a6('0x3'));var router=express[_0x80a6('0x4')]();var fs_extra=require(_0x80a6('0x5'));var auth=require(_0x80a6('0x6'));var interaction=require(_0x80a6('0x7'));var config=require('../../config/environment');var controller=require(_0x80a6('0x8'));router[_0x80a6('0x9')]('/',auth[_0x80a6('0xa')](),controller['index']);router['get'](_0x80a6('0xb'),auth[_0x80a6('0xa')](),controller[_0x80a6('0xc')]);router['get'](_0x80a6('0xd'),auth[_0x80a6('0xa')](),controller[_0x80a6('0xe')]);router[_0x80a6('0x9')](_0x80a6('0xf'),auth[_0x80a6('0xa')](),controller[_0x80a6('0x10')]);router[_0x80a6('0x9')](_0x80a6('0x11'),auth[_0x80a6('0xa')](),controller[_0x80a6('0x12')]);router['get'](_0x80a6('0x13'),auth[_0x80a6('0xa')](),controller[_0x80a6('0x14')]);router[_0x80a6('0x15')]('/',auth[_0x80a6('0xa')](),controller[_0x80a6('0x16')]);router['post']('/:id/teams',auth[_0x80a6('0xa')](),controller['addTeams']);router[_0x80a6('0x15')](_0x80a6('0x13'),auth[_0x80a6('0xa')](),controller['addAgents']);router[_0x80a6('0x17')](_0x80a6('0xd'),auth['isAuthenticated'](),controller[_0x80a6('0x18')]);router[_0x80a6('0x19')](_0x80a6('0xd'),auth[_0x80a6('0xa')](),controller['destroy']);router[_0x80a6('0x19')](_0x80a6('0x11'),auth[_0x80a6('0xa')](),controller[_0x80a6('0x1a')]);router['delete'](_0x80a6('0x13'),auth[_0x80a6('0xa')](),controller['removeAgents']);module[_0x80a6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 07e0fb6..430fc5e 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 _0x93c3=['DATE','sequelize','exports','STRING'];(function(_0x3a546d,_0x1af719){var _0x3dd350=function(_0x5c3eff){while(--_0x5c3eff){_0x3a546d['push'](_0x3a546d['shift']());}};_0x3dd350(++_0x1af719);}(_0x93c3,0x199));var _0x393c=function(_0x99eded,_0x5c1e54){_0x99eded=_0x99eded-0x0;var _0x2b1dee=_0x93c3[_0x99eded];return _0x2b1dee;};'use strict';var moment=require('moment');var Sequelize=require(_0x393c('0x0'));module[_0x393c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x393c('0x2')]},'joinAt':{'type':Sequelize[_0x393c('0x3')]},'leaveAt':{'type':Sequelize[_0x393c('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x393c('0x3')]},'reason':{'type':Sequelize[_0x393c('0x2')]}}; \ No newline at end of file +var _0xcdac=['exports','STRING','DATE','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcdac,0x9f));var _0xccda=function(_0x188daa,_0x3c2307){_0x188daa=_0x188daa-0x0;var _0x42f44d=_0xcdac[_0x188daa];return _0x42f44d;};'use strict';var moment=require(_0xccda('0x0'));var Sequelize=require('sequelize');module[_0xccda('0x1')]={'uniqueid':{'type':Sequelize[_0xccda('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xccda('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xccda('0x3')]},'acceptAt':{'type':Sequelize[_0xccda('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xccda('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 216da12..2fbbefa 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 _0x035c=['path','sox','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/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','reject','save','update','then','destroy','error','stack','name','index','ChatQueueReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','describe','eml-format','rimraf','request-promise','moment','util'];(function(_0x5bb710,_0x2f29f4){var _0x40ed91=function(_0x111bcb){while(--_0x111bcb){_0x5bb710['push'](_0x5bb710['shift']());}};_0x40ed91(++_0x2f29f4);}(_0x035c,0x87));var _0xc035=function(_0x2d583d,_0x37a6b4){_0x2d583d=_0x2d583d-0x0;var _0xadc0fa=_0x035c[_0x2d583d];return _0xadc0fa;};'use strict';var emlformat=require(_0xc035('0x0'));var rimraf=require(_0xc035('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc035('0x2'));var moment=require(_0xc035('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc035('0x4'));var path=require(_0xc035('0x5'));var sox=require(_0xc035('0x6'));var csv=require('to-csv');var ejs=require(_0xc035('0x7'));var fs=require('fs');var fs_extra=require(_0xc035('0x8'));var _=require(_0xc035('0x9'));var squel=require('squel');var crypto=require(_0xc035('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc035('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc035('0xc'));var Papa=require('papaparse');var Redis=require(_0xc035('0xd'));var authService=require(_0xc035('0xe'));var qs=require(_0xc035('0xf'));var as=require(_0xc035('0x10'));var hardwareService=require(_0xc035('0x11'));var logger=require(_0xc035('0x12'))(_0xc035('0x13'));var utils=require(_0xc035('0x14'));var config=require(_0xc035('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc035('0x16'))['db'];function respondWithStatusCode(_0x426247,_0x5cf929){_0x5cf929=_0x5cf929||0xcc;return function(_0x548e55){if(_0x548e55){return _0x426247[_0xc035('0x17')](_0x5cf929);}return _0x426247['status'](_0x5cf929)[_0xc035('0x18')]();};}function respondWithResult(_0x1163e5,_0x3c08ff){_0x3c08ff=_0x3c08ff||0xc8;return function(_0x483399){if(_0x483399){return _0x1163e5[_0xc035('0x19')](_0x3c08ff)[_0xc035('0x1a')](_0x483399);}};}function respondWithFilteredResult(_0xb55d6d,_0x5b17c9){return function(_0x135420){if(_0x135420){var _0x2254df=_0x135420['count'],_0x231c7a=_0x5b17c9[_0xc035('0x1b')],_0x3fb66a=_0x5b17c9['offset']+_0x5b17c9[_0xc035('0x1c')],_0x325284;if(_0x3fb66a>=_0x2254df){_0x3fb66a=_0x2254df;_0x325284=0xc8;}else{_0x325284=0xce;}_0xb55d6d[_0xc035('0x19')](_0x325284);return _0xb55d6d[_0xc035('0x1d')]('Content-Range',_0x231c7a+'-'+_0x3fb66a+'/'+_0x2254df)['json'](_0x135420);}return null;};}function patchUpdates(_0x203d1b){return function(_0x829aaa){try{jsonpatch['apply'](_0x829aaa,_0x203d1b,!![]);}catch(_0x2bbe65){return BPromise[_0xc035('0x1e')](_0x2bbe65);}return _0x829aaa[_0xc035('0x1f')]();};}function saveUpdates(_0x34a4a5,_0xa23408){return function(_0x546d54){if(_0x546d54){return _0x546d54[_0xc035('0x20')](_0x34a4a5)[_0xc035('0x21')](function(_0x1ebfee){return _0x1ebfee;});}return null;};}function removeEntity(_0x1992f2,_0x51da76){return function(_0x55583b){if(_0x55583b){return _0x55583b[_0xc035('0x22')]()[_0xc035('0x21')](function(){_0x1992f2[_0xc035('0x19')](0xcc)[_0xc035('0x18')]();});}};}function handleEntityNotFound(_0xb6667e,_0x1051b6){return function(_0x4c0047){if(!_0x4c0047){_0xb6667e[_0xc035('0x17')](0x194);}return _0x4c0047;};}function handleError(_0x1c4483,_0x5b702e){_0x5b702e=_0x5b702e||0x1f4;return function(_0x115a09){logger[_0xc035('0x23')](_0x115a09[_0xc035('0x24')]);if(_0x115a09[_0xc035('0x25')]){delete _0x115a09[_0xc035('0x25')];}_0x1c4483[_0xc035('0x19')](_0x5b702e)['send'](_0x115a09);};}exports[_0xc035('0x26')]=function(_0x361dfe,_0x4c4cc9){var _0x3e0bcc={},_0x2cf553={},_0x2b4e6a={'count':0x0,'rows':[]};var _0x228720=_['map'](db[_0xc035('0x27')]['rawAttributes'],function(_0x49178f){return{'name':_0x49178f[_0xc035('0x28')],'type':_0x49178f[_0xc035('0x29')][_0xc035('0x2a')]};});_0x2cf553[_0xc035('0x2b')]=_['map'](_0x228720,_0xc035('0x25'));_0x2cf553[_0xc035('0x2c')]=_[_0xc035('0x2d')](_0x361dfe[_0xc035('0x2c')]);_0x2cf553[_0xc035('0x2e')]=_['intersection'](_0x2cf553['model'],_0x2cf553['query']);_0x3e0bcc[_0xc035('0x2f')]=_[_0xc035('0x30')](_0x2cf553[_0xc035('0x2b')],qs[_0xc035('0x31')](_0x361dfe['query'][_0xc035('0x31')]));_0x3e0bcc[_0xc035('0x2f')]=_0x3e0bcc[_0xc035('0x2f')]['length']?_0x3e0bcc[_0xc035('0x2f')]:_0x2cf553[_0xc035('0x2b')];if(!_0x361dfe[_0xc035('0x2c')][_0xc035('0x32')](_0xc035('0x33'))){_0x3e0bcc['limit']=qs['limit'](_0x361dfe[_0xc035('0x2c')][_0xc035('0x1c')]);_0x3e0bcc[_0xc035('0x1b')]=qs[_0xc035('0x1b')](_0x361dfe['query']['offset']);}_0x3e0bcc['order']=qs['sort'](_0x361dfe[_0xc035('0x2c')]['sort']);_0x3e0bcc[_0xc035('0x34')]=qs['filters'](_[_0xc035('0x35')](_0x361dfe['query'],_0x2cf553[_0xc035('0x2e')]),_0x228720);if(_0x361dfe[_0xc035('0x2c')]['filter']){_0x3e0bcc['where']=_[_0xc035('0x36')](_0x3e0bcc[_0xc035('0x34')],{'$or':_['map'](_0x228720,function(_0x2efd3a){if(_0x2efd3a[_0xc035('0x29')]!==_0xc035('0x37')){var _0x46eb18={};_0x46eb18[_0x2efd3a[_0xc035('0x25')]]={'$like':'%'+_0x361dfe['query'][_0xc035('0x38')]+'%'};return _0x46eb18;}})});}_0x3e0bcc=_['merge']({},_0x3e0bcc,_0x361dfe['options']);var _0x59c4e7={'where':_0x3e0bcc[_0xc035('0x34')]};return db[_0xc035('0x27')]['count'](_0x59c4e7)[_0xc035('0x21')](function(_0x33199a){_0x2b4e6a['count']=_0x33199a;if(_0x361dfe[_0xc035('0x2c')]['includeAll']){_0x3e0bcc[_0xc035('0x39')]=[{'all':!![]}];}return db[_0xc035('0x27')][_0xc035('0x3a')](_0x3e0bcc);})[_0xc035('0x21')](function(_0x225169){_0x2b4e6a[_0xc035('0x3b')]=_0x225169;return _0x2b4e6a;})[_0xc035('0x21')](respondWithFilteredResult(_0x4c4cc9,_0x3e0bcc))[_0xc035('0x3c')](handleError(_0x4c4cc9,null));};exports[_0xc035('0x3d')]=function(_0x391e43,_0x2449f0){var _0x506130={'raw':!![],'where':{'id':_0x391e43[_0xc035('0x3e')]['id']}},_0x1eac6a={};_0x1eac6a['model']=_[_0xc035('0x2d')](db[_0xc035('0x27')][_0xc035('0x3f')]);_0x1eac6a[_0xc035('0x2c')]=_[_0xc035('0x2d')](_0x391e43[_0xc035('0x2c')]);_0x1eac6a[_0xc035('0x2e')]=_[_0xc035('0x30')](_0x1eac6a[_0xc035('0x2b')],_0x1eac6a[_0xc035('0x2c')]);_0x506130[_0xc035('0x2f')]=_[_0xc035('0x30')](_0x1eac6a[_0xc035('0x2b')],qs['fields'](_0x391e43[_0xc035('0x2c')][_0xc035('0x31')]));_0x506130['attributes']=_0x506130[_0xc035('0x2f')][_0xc035('0x40')]?_0x506130[_0xc035('0x2f')]:_0x1eac6a[_0xc035('0x2b')];if(_0x391e43[_0xc035('0x2c')][_0xc035('0x41')]){_0x506130[_0xc035('0x39')]=[{'all':!![]}];}_0x506130=_[_0xc035('0x36')]({},_0x506130,_0x391e43['options']);return db[_0xc035('0x27')][_0xc035('0x42')](_0x506130)[_0xc035('0x21')](handleEntityNotFound(_0x2449f0,null))[_0xc035('0x21')](respondWithResult(_0x2449f0,null))[_0xc035('0x3c')](handleError(_0x2449f0,null));};exports[_0xc035('0x43')]=function(_0x12b5b5,_0x1a3944){return db['ChatQueueReport'][_0xc035('0x43')](_0x12b5b5[_0xc035('0x44')],{})[_0xc035('0x21')](respondWithResult(_0x1a3944,0xc9))[_0xc035('0x3c')](handleError(_0x1a3944,null));};exports[_0xc035('0x20')]=function(_0x57b470,_0xe5eb80){if(_0x57b470[_0xc035('0x44')]['id']){delete _0x57b470[_0xc035('0x44')]['id'];}return db[_0xc035('0x27')][_0xc035('0x42')]({'where':{'id':_0x57b470[_0xc035('0x3e')]['id']}})[_0xc035('0x21')](handleEntityNotFound(_0xe5eb80,null))[_0xc035('0x21')](saveUpdates(_0x57b470[_0xc035('0x44')],null))['then'](respondWithResult(_0xe5eb80,null))[_0xc035('0x3c')](handleError(_0xe5eb80,null));};exports[_0xc035('0x22')]=function(_0x35b507,_0x4cc05e){return db[_0xc035('0x27')]['find']({'where':{'id':_0x35b507[_0xc035('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4cc05e,null))[_0xc035('0x21')](removeEntity(_0x4cc05e,null))['catch'](handleError(_0x4cc05e,null));};exports[_0xc035('0x45')]=function(_0x4886f3,_0x44ff0e){return db[_0xc035('0x27')]['describe']()[_0xc035('0x21')](respondWithResult(_0x44ff0e,null))[_0xc035('0x3c')](handleError(_0x44ff0e,null));}; \ No newline at end of file +var _0xbf11=['then','error','stack','name','send','index','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','sort','pick','filter','merge','where','VIRTUAL','options','include','ChatQueueReport','findAll','rows','show','params','rawAttributes','length','includeAll','catch','create','body','describe','rimraf','fast-json-patch','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','set','apply','reject','save','update','destroy'];(function(_0x41c66d,_0x512755){var _0x4b3302=function(_0x5e6307){while(--_0x5e6307){_0x41c66d['push'](_0x41c66d['shift']());}};_0x4b3302(++_0x512755);}(_0xbf11,0x14d));var _0x1bf1=function(_0x2e2720,_0x1ae995){_0x2e2720=_0x2e2720-0x0;var _0x3f9d2d=_0xbf11[_0x2e2720];return _0x3f9d2d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1bf1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1bf1('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1bf1('0x2'));var util=require(_0x1bf1('0x3'));var path=require(_0x1bf1('0x4'));var sox=require('sox');var csv=require(_0x1bf1('0x5'));var ejs=require(_0x1bf1('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1bf1('0x7'));var squel=require('squel');var crypto=require(_0x1bf1('0x8'));var jsforce=require(_0x1bf1('0x9'));var deskjs=require(_0x1bf1('0xa'));var toCsv=require(_0x1bf1('0x5'));var querystring=require('querystring');var Papa=require(_0x1bf1('0xb'));var Redis=require(_0x1bf1('0xc'));var authService=require(_0x1bf1('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x1bf1('0xe'));var hardwareService=require(_0x1bf1('0xf'));var logger=require(_0x1bf1('0x10'))(_0x1bf1('0x11'));var utils=require(_0x1bf1('0x12'));var config=require(_0x1bf1('0x13'));var licenseUtil=require(_0x1bf1('0x14'));var db=require(_0x1bf1('0x15'))['db'];function respondWithStatusCode(_0x1ec305,_0x2618a1){_0x2618a1=_0x2618a1||0xcc;return function(_0xc486c4){if(_0xc486c4){return _0x1ec305[_0x1bf1('0x16')](_0x2618a1);}return _0x1ec305[_0x1bf1('0x17')](_0x2618a1)['end']();};}function respondWithResult(_0x441a94,_0x23cc86){_0x23cc86=_0x23cc86||0xc8;return function(_0xb17274){if(_0xb17274){return _0x441a94[_0x1bf1('0x17')](_0x23cc86)[_0x1bf1('0x18')](_0xb17274);}};}function respondWithFilteredResult(_0x502b98,_0x47660f){return function(_0x5c05fc){if(_0x5c05fc){var _0x22d356=_0x5c05fc[_0x1bf1('0x19')],_0x391cbc=_0x47660f['offset'],_0x1d2183=_0x47660f['offset']+_0x47660f['limit'],_0x46d8b6;if(_0x1d2183>=_0x22d356){_0x1d2183=_0x22d356;_0x46d8b6=0xc8;}else{_0x46d8b6=0xce;}_0x502b98[_0x1bf1('0x17')](_0x46d8b6);return _0x502b98[_0x1bf1('0x1a')]('Content-Range',_0x391cbc+'-'+_0x1d2183+'/'+_0x22d356)[_0x1bf1('0x18')](_0x5c05fc);}return null;};}function patchUpdates(_0x1dfeee){return function(_0x309221){try{jsonpatch[_0x1bf1('0x1b')](_0x309221,_0x1dfeee,!![]);}catch(_0x403b9c){return BPromise[_0x1bf1('0x1c')](_0x403b9c);}return _0x309221[_0x1bf1('0x1d')]();};}function saveUpdates(_0x377f51,_0x3776bd){return function(_0x5cd95f){if(_0x5cd95f){return _0x5cd95f[_0x1bf1('0x1e')](_0x377f51)['then'](function(_0x3045bd){return _0x3045bd;});}return null;};}function removeEntity(_0x42c45a,_0x2a4603){return function(_0x19cc86){if(_0x19cc86){return _0x19cc86[_0x1bf1('0x1f')]()[_0x1bf1('0x20')](function(){_0x42c45a[_0x1bf1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x204911,_0x3cd5c6){return function(_0xf63cac){if(!_0xf63cac){_0x204911[_0x1bf1('0x16')](0x194);}return _0xf63cac;};}function handleError(_0x4b2f45,_0x8418c5){_0x8418c5=_0x8418c5||0x1f4;return function(_0x49cbce){logger[_0x1bf1('0x21')](_0x49cbce[_0x1bf1('0x22')]);if(_0x49cbce[_0x1bf1('0x23')]){delete _0x49cbce[_0x1bf1('0x23')];}_0x4b2f45[_0x1bf1('0x17')](_0x8418c5)[_0x1bf1('0x24')](_0x49cbce);};}exports[_0x1bf1('0x25')]=function(_0x4b4557,_0x4c2adf){var _0x22aca0={},_0x4fc14c={},_0x39beeb={'count':0x0,'rows':[]};var _0x9c614e=_['map'](db['ChatQueueReport']['rawAttributes'],function(_0x2bd077){return{'name':_0x2bd077[_0x1bf1('0x26')],'type':_0x2bd077[_0x1bf1('0x27')][_0x1bf1('0x28')]};});_0x4fc14c[_0x1bf1('0x29')]=_[_0x1bf1('0x2a')](_0x9c614e,_0x1bf1('0x23'));_0x4fc14c['query']=_[_0x1bf1('0x2b')](_0x4b4557[_0x1bf1('0x2c')]);_0x4fc14c[_0x1bf1('0x2d')]=_[_0x1bf1('0x2e')](_0x4fc14c[_0x1bf1('0x29')],_0x4fc14c[_0x1bf1('0x2c')]);_0x22aca0[_0x1bf1('0x2f')]=_[_0x1bf1('0x2e')](_0x4fc14c[_0x1bf1('0x29')],qs[_0x1bf1('0x30')](_0x4b4557['query'][_0x1bf1('0x30')]));_0x22aca0[_0x1bf1('0x2f')]=_0x22aca0[_0x1bf1('0x2f')]['length']?_0x22aca0[_0x1bf1('0x2f')]:_0x4fc14c[_0x1bf1('0x29')];if(!_0x4b4557[_0x1bf1('0x2c')][_0x1bf1('0x31')](_0x1bf1('0x32'))){_0x22aca0[_0x1bf1('0x33')]=qs[_0x1bf1('0x33')](_0x4b4557['query'][_0x1bf1('0x33')]);_0x22aca0[_0x1bf1('0x34')]=qs[_0x1bf1('0x34')](_0x4b4557[_0x1bf1('0x2c')][_0x1bf1('0x34')]);}_0x22aca0['order']=qs['sort'](_0x4b4557[_0x1bf1('0x2c')][_0x1bf1('0x35')]);_0x22aca0['where']=qs[_0x1bf1('0x2d')](_[_0x1bf1('0x36')](_0x4b4557['query'],_0x4fc14c[_0x1bf1('0x2d')]),_0x9c614e);if(_0x4b4557[_0x1bf1('0x2c')][_0x1bf1('0x37')]){_0x22aca0['where']=_[_0x1bf1('0x38')](_0x22aca0[_0x1bf1('0x39')],{'$or':_[_0x1bf1('0x2a')](_0x9c614e,function(_0xd1531d){if(_0xd1531d['type']!==_0x1bf1('0x3a')){var _0x460ba8={};_0x460ba8[_0xd1531d[_0x1bf1('0x23')]]={'$like':'%'+_0x4b4557[_0x1bf1('0x2c')]['filter']+'%'};return _0x460ba8;}})});}_0x22aca0=_['merge']({},_0x22aca0,_0x4b4557[_0x1bf1('0x3b')]);var _0x4c8719={'where':_0x22aca0['where']};return db['ChatQueueReport'][_0x1bf1('0x19')](_0x4c8719)[_0x1bf1('0x20')](function(_0x5b9857){_0x39beeb[_0x1bf1('0x19')]=_0x5b9857;if(_0x4b4557['query']['includeAll']){_0x22aca0[_0x1bf1('0x3c')]=[{'all':!![]}];}return db[_0x1bf1('0x3d')][_0x1bf1('0x3e')](_0x22aca0);})[_0x1bf1('0x20')](function(_0x4f1180){_0x39beeb[_0x1bf1('0x3f')]=_0x4f1180;return _0x39beeb;})[_0x1bf1('0x20')](respondWithFilteredResult(_0x4c2adf,_0x22aca0))['catch'](handleError(_0x4c2adf,null));};exports[_0x1bf1('0x40')]=function(_0x5ee29c,_0x37189b){var _0x1f2641={'raw':!![],'where':{'id':_0x5ee29c[_0x1bf1('0x41')]['id']}},_0x52de2d={};_0x52de2d[_0x1bf1('0x29')]=_[_0x1bf1('0x2b')](db[_0x1bf1('0x3d')][_0x1bf1('0x42')]);_0x52de2d[_0x1bf1('0x2c')]=_[_0x1bf1('0x2b')](_0x5ee29c[_0x1bf1('0x2c')]);_0x52de2d[_0x1bf1('0x2d')]=_[_0x1bf1('0x2e')](_0x52de2d[_0x1bf1('0x29')],_0x52de2d[_0x1bf1('0x2c')]);_0x1f2641[_0x1bf1('0x2f')]=_['intersection'](_0x52de2d[_0x1bf1('0x29')],qs[_0x1bf1('0x30')](_0x5ee29c[_0x1bf1('0x2c')][_0x1bf1('0x30')]));_0x1f2641[_0x1bf1('0x2f')]=_0x1f2641['attributes'][_0x1bf1('0x43')]?_0x1f2641['attributes']:_0x52de2d[_0x1bf1('0x29')];if(_0x5ee29c['query'][_0x1bf1('0x44')]){_0x1f2641[_0x1bf1('0x3c')]=[{'all':!![]}];}_0x1f2641=_['merge']({},_0x1f2641,_0x5ee29c['options']);return db[_0x1bf1('0x3d')]['find'](_0x1f2641)[_0x1bf1('0x20')](handleEntityNotFound(_0x37189b,null))['then'](respondWithResult(_0x37189b,null))[_0x1bf1('0x45')](handleError(_0x37189b,null));};exports[_0x1bf1('0x46')]=function(_0xa7bf4a,_0x5703b5){return db[_0x1bf1('0x3d')]['create'](_0xa7bf4a[_0x1bf1('0x47')],{})[_0x1bf1('0x20')](respondWithResult(_0x5703b5,0xc9))[_0x1bf1('0x45')](handleError(_0x5703b5,null));};exports[_0x1bf1('0x1e')]=function(_0x28e3ce,_0x522a02){if(_0x28e3ce[_0x1bf1('0x47')]['id']){delete _0x28e3ce[_0x1bf1('0x47')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x28e3ce[_0x1bf1('0x41')]['id']}})[_0x1bf1('0x20')](handleEntityNotFound(_0x522a02,null))[_0x1bf1('0x20')](saveUpdates(_0x28e3ce[_0x1bf1('0x47')],null))[_0x1bf1('0x20')](respondWithResult(_0x522a02,null))['catch'](handleError(_0x522a02,null));};exports['destroy']=function(_0x2a4032,_0x33ff4a){return db[_0x1bf1('0x3d')]['find']({'where':{'id':_0x2a4032['params']['id']}})[_0x1bf1('0x20')](handleEntityNotFound(_0x33ff4a,null))['then'](removeEntity(_0x33ff4a,null))[_0x1bf1('0x45')](handleError(_0x33ff4a,null));};exports[_0x1bf1('0x48')]=function(_0xa5e83e,_0x2b0feb){return db['ChatQueueReport'][_0x1bf1('0x48')]()[_0x1bf1('0x20')](respondWithResult(_0x2b0feb,null))[_0x1bf1('0x45')](handleError(_0x2b0feb,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index c83837c..daa35db 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 _0xffb3=['request-promise','path','rimraf','exports','define','ChatQueueReport','uniqueid','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xffb3,0xcf));var _0x3ffb=function(_0x41e94f,_0x264b17){_0x41e94f=_0x41e94f-0x0;var _0x399443=_0xffb3[_0x41e94f];return _0x399443;};'use strict';var _=require(_0x3ffb('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3ffb('0x1'));var fs=require('fs');var path=require(_0x3ffb('0x2'));var rimraf=require(_0x3ffb('0x3'));var config=require('../../config/environment');var attributes=require('./chatQueueReport.attributes');module[_0x3ffb('0x4')]=function(_0x20cd15,_0x3d357a){return _0x20cd15[_0x3ffb('0x5')](_0x3ffb('0x6'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x3ffb('0x7'),'fields':[_0x3ffb('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe852=['request-promise','path','rimraf','./chatQueueReport.attributes','ChatQueueReport','report_chat_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x410d65,_0x132b7f){var _0x36b2a1=function(_0x177938){while(--_0x177938){_0x410d65['push'](_0x410d65['shift']());}};_0x36b2a1(++_0x132b7f);}(_0xe852,0x1c3));var _0x2e85=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xe852[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x2e85('0x0'));var util=require(_0x2e85('0x1'));var logger=require(_0x2e85('0x2'))('api');var moment=require(_0x2e85('0x3'));var BPromise=require(_0x2e85('0x4'));var rp=require(_0x2e85('0x5'));var fs=require('fs');var path=require(_0x2e85('0x6'));var rimraf=require(_0x2e85('0x7'));var config=require('../../config/environment');var attributes=require(_0x2e85('0x8'));module['exports']=function(_0x2c69ca,_0x28fb86){return _0x2c69ca['define'](_0x2e85('0x9'),attributes,{'tableName':_0x2e85('0xa'),'paranoid':![],'indexes':[{'name':_0x2e85('0xb'),'fields':[_0x2e85('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 0ff4096..6d2fca1 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 _0x598f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','CreateChatQueueReport','create','options','raw','catch','update','body','attributes','limit','then','UpdateChatQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x132aed,_0x2eaf18){var _0x5ece16=function(_0x2988cf){while(--_0x2988cf){_0x132aed['push'](_0x132aed['shift']());}};_0x5ece16(++_0x2eaf18);}(_0x598f,0x164));var _0xf598=function(_0x9f4379,_0x140019){_0x9f4379=_0x9f4379-0x0;var _0x291cd8=_0x598f[_0x9f4379];return _0x291cd8;};'use strict';var _=require(_0xf598('0x0'));var util=require('util');var moment=require(_0xf598('0x1'));var BPromise=require(_0xf598('0x2'));var rs=require(_0xf598('0x3'));var fs=require('fs');var Redis=require(_0xf598('0x4'));var db=require(_0xf598('0x5'))['db'];var utils=require(_0xf598('0x6'));var logger=require(_0xf598('0x7'))(_0xf598('0x8'));var config=require(_0xf598('0x9'));var jayson=require(_0xf598('0xa'));var client=jayson[_0xf598('0xb')][_0xf598('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe4d58,_0x4a0408,_0x2f2786){return new BPromise(function(_0x10e30f,_0x5cb85a){return client[_0xf598('0xd')](_0xe4d58,_0x2f2786)['then'](function(_0x3e9e8c){logger[_0xf598('0xe')](_0xf598('0xf'),_0x4a0408,_0xf598('0x10'));logger[_0xf598('0x11')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x4a0408,'request\x20sent',JSON[_0xf598('0x12')](_0x3e9e8c));if(_0x3e9e8c[_0xf598('0x13')]){if(_0x3e9e8c[_0xf598('0x13')]['code']===0x1f4){logger[_0xf598('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x4a0408,_0x3e9e8c[_0xf598('0x13')][_0xf598('0x14')]);return _0x5cb85a(_0x3e9e8c[_0xf598('0x13')][_0xf598('0x14')]);}logger[_0xf598('0x13')](_0xf598('0xf'),_0x4a0408,_0x3e9e8c['error'][_0xf598('0x14')]);return _0x10e30f(_0x3e9e8c['error'][_0xf598('0x14')]);}else{logger[_0xf598('0xe')](_0xf598('0xf'),_0x4a0408,_0xf598('0x10'));_0x10e30f(_0x3e9e8c[_0xf598('0x15')][_0xf598('0x14')]);}})['catch'](function(_0x571e2f){logger[_0xf598('0x13')](_0xf598('0xf'),_0x4a0408,_0x571e2f);_0x5cb85a(_0x571e2f);});});}exports[_0xf598('0x16')]=function(_0x5a367e){var _0x3dc18a=this;return new Promise(function(_0x73a4f,_0x3b066f){return db['ChatQueueReport'][_0xf598('0x17')](_0x5a367e['body'],{'raw':_0x5a367e[_0xf598('0x18')]?_0x5a367e[_0xf598('0x18')][_0xf598('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x472d30){logger[_0xf598('0xe')]('CreateChatQueueReport',_0x5a367e);logger['debug'](_0xf598('0x16'),_0x5a367e,JSON[_0xf598('0x12')](_0x472d30));_0x73a4f(_0x472d30);})[_0xf598('0x1a')](function(_0x432483){logger[_0xf598('0x13')](_0xf598('0x16'),_0x432483[_0xf598('0x14')],_0x5a367e);_0x3b066f(_0x3dc18a[_0xf598('0x13')](0x1f4,_0x432483['message']));});});};exports['UpdateChatQueueReport']=function(_0x4d9549){var _0x14fd16=this;return new Promise(function(_0x5405ee,_0x409104){return db['ChatQueueReport'][_0xf598('0x1b')](_0x4d9549[_0xf598('0x1c')],{'raw':_0x4d9549[_0xf598('0x18')]?_0x4d9549[_0xf598('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d9549[_0xf598('0x18')]?_0x4d9549['options']['where']||null:null,'attributes':_0x4d9549['options']?_0x4d9549[_0xf598('0x18')][_0xf598('0x1d')]||null:null,'limit':_0x4d9549[_0xf598('0x18')]?_0x4d9549[_0xf598('0x18')][_0xf598('0x1e')]||null:null})[_0xf598('0x1f')](function(_0x4f469e){logger[_0xf598('0xe')](_0xf598('0x20'),_0x4d9549);logger[_0xf598('0x11')](_0xf598('0x20'),_0x4d9549,JSON[_0xf598('0x12')](_0x4f469e));_0x5405ee(_0x4f469e);})[_0xf598('0x1a')](function(_0x20753a){logger['error'](_0xf598('0x20'),_0x20753a['message'],_0x4d9549);_0x409104(_0x14fd16[_0xf598('0x13')](0x1f4,_0x20753a[_0xf598('0x14')]));});});}; \ No newline at end of file +var _0x9634=['where','attributes','limit','UpdateChatQueueReport','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','body','options','raw','ChatQueueReport','update'];(function(_0xc7ec9d,_0x21a74c){var _0xdded82=function(_0x4cf4c0){while(--_0x4cf4c0){_0xc7ec9d['push'](_0xc7ec9d['shift']());}};_0xdded82(++_0x21a74c);}(_0x9634,0x88));var _0x4963=function(_0x18fce3,_0x26b8fc){_0x18fce3=_0x18fce3-0x0;var _0x35427e=_0x9634[_0x18fce3];return _0x35427e;};'use strict';var _=require(_0x4963('0x0'));var util=require('util');var moment=require(_0x4963('0x1'));var BPromise=require(_0x4963('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4963('0x3'));var db=require(_0x4963('0x4'))['db'];var utils=require(_0x4963('0x5'));var logger=require(_0x4963('0x6'))('rpc');var config=require(_0x4963('0x7'));var jayson=require(_0x4963('0x8'));var client=jayson[_0x4963('0x9')][_0x4963('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x119b15,_0x2cd19c,_0xeac37b){return new BPromise(function(_0x368daf,_0x1dbb8d){return client['request'](_0x119b15,_0xeac37b)[_0x4963('0xb')](function(_0x561b94){logger[_0x4963('0xc')](_0x4963('0xd'),_0x2cd19c,_0x4963('0xe'));logger[_0x4963('0xf')](_0x4963('0x10'),_0x2cd19c,_0x4963('0xe'),JSON[_0x4963('0x11')](_0x561b94));if(_0x561b94[_0x4963('0x12')]){if(_0x561b94[_0x4963('0x12')][_0x4963('0x13')]===0x1f4){logger[_0x4963('0x12')](_0x4963('0xd'),_0x2cd19c,_0x561b94['error'][_0x4963('0x14')]);return _0x1dbb8d(_0x561b94[_0x4963('0x12')][_0x4963('0x14')]);}logger[_0x4963('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x2cd19c,_0x561b94[_0x4963('0x12')][_0x4963('0x14')]);return _0x368daf(_0x561b94[_0x4963('0x12')][_0x4963('0x14')]);}else{logger['info'](_0x4963('0xd'),_0x2cd19c,_0x4963('0xe'));_0x368daf(_0x561b94[_0x4963('0x15')]['message']);}})[_0x4963('0x16')](function(_0x2a7595){logger[_0x4963('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x2cd19c,_0x2a7595);_0x1dbb8d(_0x2a7595);});});}exports[_0x4963('0x17')]=function(_0x369f0e){var _0x30d0c7=this;return new Promise(function(_0x3e6fee,_0xd76b9c){return db['ChatQueueReport']['create'](_0x369f0e[_0x4963('0x18')],{'raw':_0x369f0e['options']?_0x369f0e[_0x4963('0x19')][_0x4963('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1f2dac){logger[_0x4963('0xc')](_0x4963('0x17'),_0x369f0e);logger[_0x4963('0xf')]('CreateChatQueueReport',_0x369f0e,JSON['stringify'](_0x1f2dac));_0x3e6fee(_0x1f2dac);})[_0x4963('0x16')](function(_0x4ab8e7){logger[_0x4963('0x12')](_0x4963('0x17'),_0x4ab8e7[_0x4963('0x14')],_0x369f0e);_0xd76b9c(_0x30d0c7[_0x4963('0x12')](0x1f4,_0x4ab8e7['message']));});});};exports['UpdateChatQueueReport']=function(_0xf1e29a){var _0x265a8d=this;return new Promise(function(_0x4dfe4f,_0x181d1c){return db[_0x4963('0x1b')][_0x4963('0x1c')](_0xf1e29a['body'],{'raw':_0xf1e29a[_0x4963('0x19')]?_0xf1e29a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf1e29a['options']?_0xf1e29a[_0x4963('0x19')][_0x4963('0x1d')]||null:null,'attributes':_0xf1e29a[_0x4963('0x19')]?_0xf1e29a[_0x4963('0x19')][_0x4963('0x1e')]||null:null,'limit':_0xf1e29a['options']?_0xf1e29a[_0x4963('0x19')][_0x4963('0x1f')]||null:null})[_0x4963('0xb')](function(_0xc59249){logger[_0x4963('0xc')](_0x4963('0x20'),_0xf1e29a);logger[_0x4963('0xf')](_0x4963('0x20'),_0xf1e29a,JSON[_0x4963('0x11')](_0xc59249));_0x4dfe4f(_0xc59249);})['catch'](function(_0x3fcc52){logger['error'](_0x4963('0x20'),_0x3fcc52['message'],_0xf1e29a);_0x181d1c(_0x265a8d[_0x4963('0x12')](0x1f4,_0x3fcc52[_0x4963('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index b914696..25a1aa9 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(_0x312272,_0x48dfd5){var _0x54300d=function(_0x4fea05){while(--_0x4fea05){_0x312272['push'](_0x312272['shift']());}};_0x54300d(++_0x48dfd5);}(_0x2ef3,0xba));var _0x32ef=function(_0x5e0d11,_0x252719){_0x5e0d11=_0x5e0d11-0x0;var _0x4539a6=_0x2ef3[_0x5e0d11];return _0x4539a6;};'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 _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','delete'];(function(_0x553ff1,_0x2db566){var _0x217cb3=function(_0x4334c3){while(--_0x4334c3){_0x553ff1['push'](_0x553ff1['shift']());}};_0x217cb3(++_0x2db566);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc4aa[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index d830479..cd2327d 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 _0xebb3=['queue','DATE','NOW','sequelize','exports','STRING','ENUM','account','agent'];(function(_0x316b2d,_0x460caa){var _0x34d4e5=function(_0x534e56){while(--_0x534e56){_0x316b2d['push'](_0x316b2d['shift']());}};_0x34d4e5(++_0x460caa);}(_0xebb3,0x1e9));var _0x3ebb=function(_0x39d9d7,_0xb6691){_0x39d9d7=_0x39d9d7-0x0;var _0x3b1c1d=_0xebb3[_0x39d9d7];return _0x3b1c1d;};'use strict';var moment=require('moment');var Sequelize=require(_0x3ebb('0x0'));module[_0x3ebb('0x1')]={'uniqueid':{'type':Sequelize[_0x3ebb('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3ebb('0x3')](_0x3ebb('0x4'),_0x3ebb('0x5'),_0x3ebb('0x6')),'allowNull':![],'defaultValue':_0x3ebb('0x6')},'transferredAt':{'type':Sequelize[_0x3ebb('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x3ebb('0x8')]}}; \ No newline at end of file +var _0x4939=['queue','NOW','moment','exports','ENUM','account','agent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4939,0x1ec));var _0x9493=function(_0xb67a96,_0x11dd77){_0xb67a96=_0xb67a96-0x0;var _0x598250=_0x4939[_0xb67a96];return _0x598250;};'use strict';var moment=require(_0x9493('0x0'));var Sequelize=require('sequelize');module[_0x9493('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x9493('0x2')](_0x9493('0x3'),_0x9493('0x4'),_0x9493('0x5')),'allowNull':![],'defaultValue':_0x9493('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9493('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index da67a6d..d9bff1f 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 _0x5f66=['crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','error','stack','send','index','map','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ChatTransferReport','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','params','destroy','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel'];(function(_0x2f8aa5,_0x2cf56a){var _0x5800c=function(_0x54c4ca){while(--_0x54c4ca){_0x2f8aa5['push'](_0x2f8aa5['shift']());}};_0x5800c(++_0x2cf56a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=_0x19b9ff[_0x65f6('0x18')],_0x5dd324=_0x59154e[_0x65f6('0x19')],_0x1693e6=_0x59154e[_0x65f6('0x19')]+_0x59154e[_0x65f6('0x1a')],_0x5c69f8;if(_0x1693e6>=_0x49a913){_0x1693e6=_0x49a913;_0x5c69f8=0xc8;}else{_0x5c69f8=0xce;}_0x3440af[_0x65f6('0x15')](_0x5c69f8);return _0x3440af[_0x65f6('0x1b')]('Content-Range',_0x5dd324+'-'+_0x1693e6+'/'+_0x49a913)['json'](_0x19b9ff);}return null;};}function patchUpdates(_0x2d538c){return function(_0x5b4055){try{jsonpatch['apply'](_0x5b4055,_0x2d538c,!![]);}catch(_0x5c5b91){return BPromise[_0x65f6('0x1c')](_0x5c5b91);}return _0x5b4055[_0x65f6('0x1d')]();};}function saveUpdates(_0x5114a4,_0x39e19f){return function(_0x270893){if(_0x270893){return _0x270893[_0x65f6('0x1e')](_0x5114a4)[_0x65f6('0x1f')](function(_0x219ab2){return _0x219ab2;});}return null;};}function removeEntity(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['destroy']()['then'](function(){_0xc139c2[_0x65f6('0x15')](0xcc)[_0x65f6('0x16')]();});}};}function handleEntityNotFound(_0x524e42,_0x1eeaaa){return function(_0x471a33){if(!_0x471a33){_0x524e42[_0x65f6('0x14')](0x194);}return _0x471a33;};}function handleError(_0x2774a1,_0x4f5a69){_0x4f5a69=_0x4f5a69||0x1f4;return function(_0x9d7bb0){logger[_0x65f6('0x20')](_0x9d7bb0[_0x65f6('0x21')]);if(_0x9d7bb0['name']){delete _0x9d7bb0['name'];}_0x2774a1['status'](_0x4f5a69)[_0x65f6('0x22')](_0x9d7bb0);};}exports[_0x65f6('0x23')]=function(_0x4b2292,_0x296cd9){var _0x28f710={},_0x52277c={},_0x325cb4={'count':0x0,'rows':[]};var _0x2bff2b=_[_0x65f6('0x24')](db['ChatTransferReport']['rawAttributes'],function(_0x488d36){return{'name':_0x488d36[_0x65f6('0x25')],'type':_0x488d36[_0x65f6('0x26')][_0x65f6('0x27')]};});_0x52277c[_0x65f6('0x28')]=_[_0x65f6('0x24')](_0x2bff2b,_0x65f6('0x29'));_0x52277c[_0x65f6('0x2a')]=_['keys'](_0x4b2292['query']);_0x52277c[_0x65f6('0x2b')]=_[_0x65f6('0x2c')](_0x52277c['model'],_0x52277c['query']);_0x28f710[_0x65f6('0x2d')]=_[_0x65f6('0x2c')](_0x52277c[_0x65f6('0x28')],qs[_0x65f6('0x2e')](_0x4b2292[_0x65f6('0x2a')][_0x65f6('0x2e')]));_0x28f710['attributes']=_0x28f710[_0x65f6('0x2d')][_0x65f6('0x2f')]?_0x28f710[_0x65f6('0x2d')]:_0x52277c['model'];if(!_0x4b2292[_0x65f6('0x2a')][_0x65f6('0x30')](_0x65f6('0x31'))){_0x28f710[_0x65f6('0x1a')]=qs[_0x65f6('0x1a')](_0x4b2292[_0x65f6('0x2a')]['limit']);_0x28f710[_0x65f6('0x19')]=qs[_0x65f6('0x19')](_0x4b2292['query'][_0x65f6('0x19')]);}_0x28f710['order']=qs[_0x65f6('0x32')](_0x4b2292['query'][_0x65f6('0x32')]);_0x28f710[_0x65f6('0x33')]=qs['filters'](_[_0x65f6('0x34')](_0x4b2292[_0x65f6('0x2a')],_0x52277c[_0x65f6('0x2b')]),_0x2bff2b);if(_0x4b2292['query']['filter']){_0x28f710[_0x65f6('0x33')]=_['merge'](_0x28f710[_0x65f6('0x33')],{'$or':_['map'](_0x2bff2b,function(_0x22d760){if(_0x22d760[_0x65f6('0x26')]!=='VIRTUAL'){var _0x44b809={};_0x44b809[_0x22d760['name']]={'$like':'%'+_0x4b2292['query'][_0x65f6('0x35')]+'%'};return _0x44b809;}})});}_0x28f710=_[_0x65f6('0x36')]({},_0x28f710,_0x4b2292[_0x65f6('0x37')]);var _0x313be5={'where':_0x28f710[_0x65f6('0x33')]};return db[_0x65f6('0x38')][_0x65f6('0x18')](_0x313be5)[_0x65f6('0x1f')](function(_0x4f933b){_0x325cb4[_0x65f6('0x18')]=_0x4f933b;if(_0x4b2292['query'][_0x65f6('0x39')]){_0x28f710[_0x65f6('0x3a')]=[{'all':!![]}];}return db[_0x65f6('0x38')][_0x65f6('0x3b')](_0x28f710);})['then'](function(_0x32148f){_0x325cb4[_0x65f6('0x3c')]=_0x32148f;return _0x325cb4;})[_0x65f6('0x1f')](respondWithFilteredResult(_0x296cd9,_0x28f710))[_0x65f6('0x3d')](handleError(_0x296cd9,null));};exports[_0x65f6('0x3e')]=function(_0x3f6103,_0xed4c96){var _0x2acca5={'raw':!![],'where':{'id':_0x3f6103['params']['id']}},_0x35c195={};_0x35c195[_0x65f6('0x28')]=_[_0x65f6('0x3f')](db[_0x65f6('0x38')][_0x65f6('0x40')]);_0x35c195[_0x65f6('0x2a')]=_[_0x65f6('0x3f')](_0x3f6103[_0x65f6('0x2a')]);_0x35c195[_0x65f6('0x2b')]=_[_0x65f6('0x2c')](_0x35c195[_0x65f6('0x28')],_0x35c195[_0x65f6('0x2a')]);_0x2acca5[_0x65f6('0x2d')]=_[_0x65f6('0x2c')](_0x35c195[_0x65f6('0x28')],qs[_0x65f6('0x2e')](_0x3f6103[_0x65f6('0x2a')]['fields']));_0x2acca5[_0x65f6('0x2d')]=_0x2acca5[_0x65f6('0x2d')][_0x65f6('0x2f')]?_0x2acca5[_0x65f6('0x2d')]:_0x35c195['model'];if(_0x3f6103[_0x65f6('0x2a')][_0x65f6('0x39')]){_0x2acca5[_0x65f6('0x3a')]=[{'all':!![]}];}_0x2acca5=_['merge']({},_0x2acca5,_0x3f6103[_0x65f6('0x37')]);return db[_0x65f6('0x38')][_0x65f6('0x41')](_0x2acca5)[_0x65f6('0x1f')](handleEntityNotFound(_0xed4c96,null))['then'](respondWithResult(_0xed4c96,null))[_0x65f6('0x3d')](handleError(_0xed4c96,null));};exports['create']=function(_0x3f1baa,_0x6968b){return db['ChatTransferReport'][_0x65f6('0x42')](_0x3f1baa['body'],{})[_0x65f6('0x1f')](respondWithResult(_0x6968b,0xc9))[_0x65f6('0x3d')](handleError(_0x6968b,null));};exports[_0x65f6('0x1e')]=function(_0xc0db01,_0x3ec18f){if(_0xc0db01[_0x65f6('0x43')]['id']){delete _0xc0db01['body']['id'];}return db['ChatTransferReport'][_0x65f6('0x41')]({'where':{'id':_0xc0db01[_0x65f6('0x44')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x3ec18f,null))[_0x65f6('0x1f')](saveUpdates(_0xc0db01[_0x65f6('0x43')],null))[_0x65f6('0x1f')](respondWithResult(_0x3ec18f,null))[_0x65f6('0x3d')](handleError(_0x3ec18f,null));};exports[_0x65f6('0x45')]=function(_0x414f49,_0x517a47){return db[_0x65f6('0x38')][_0x65f6('0x41')]({'where':{'id':_0x414f49[_0x65f6('0x44')]['id']}})['then'](handleEntityNotFound(_0x517a47,null))[_0x65f6('0x1f')](removeEntity(_0x517a47,null))[_0x65f6('0x3d')](handleError(_0x517a47,null));};exports['describe']=function(_0x22d745,_0x253d52){return db['ChatTransferReport'][_0x65f6('0x46')]()['then'](respondWithResult(_0x253d52,null))[_0x65f6('0x3d')](handleError(_0x253d52,null));}; \ No newline at end of file +var _0x5f66=['crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','error','stack','send','index','map','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ChatTransferReport','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','params','destroy','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel'];(function(_0x5f4f6e,_0x525be4){var _0x27224b=function(_0x3024af){while(--_0x3024af){_0x5f4f6e['push'](_0x5f4f6e['shift']());}};_0x27224b(++_0x525be4);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=_0x19b9ff[_0x65f6('0x18')],_0x5dd324=_0x59154e[_0x65f6('0x19')],_0x1693e6=_0x59154e[_0x65f6('0x19')]+_0x59154e[_0x65f6('0x1a')],_0x5c69f8;if(_0x1693e6>=_0x49a913){_0x1693e6=_0x49a913;_0x5c69f8=0xc8;}else{_0x5c69f8=0xce;}_0x3440af[_0x65f6('0x15')](_0x5c69f8);return _0x3440af[_0x65f6('0x1b')]('Content-Range',_0x5dd324+'-'+_0x1693e6+'/'+_0x49a913)['json'](_0x19b9ff);}return null;};}function patchUpdates(_0x2d538c){return function(_0x5b4055){try{jsonpatch['apply'](_0x5b4055,_0x2d538c,!![]);}catch(_0x5c5b91){return BPromise[_0x65f6('0x1c')](_0x5c5b91);}return _0x5b4055[_0x65f6('0x1d')]();};}function saveUpdates(_0x5114a4,_0x39e19f){return function(_0x270893){if(_0x270893){return _0x270893[_0x65f6('0x1e')](_0x5114a4)[_0x65f6('0x1f')](function(_0x219ab2){return _0x219ab2;});}return null;};}function removeEntity(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['destroy']()['then'](function(){_0xc139c2[_0x65f6('0x15')](0xcc)[_0x65f6('0x16')]();});}};}function handleEntityNotFound(_0x524e42,_0x1eeaaa){return function(_0x471a33){if(!_0x471a33){_0x524e42[_0x65f6('0x14')](0x194);}return _0x471a33;};}function handleError(_0x2774a1,_0x4f5a69){_0x4f5a69=_0x4f5a69||0x1f4;return function(_0x9d7bb0){logger[_0x65f6('0x20')](_0x9d7bb0[_0x65f6('0x21')]);if(_0x9d7bb0['name']){delete _0x9d7bb0['name'];}_0x2774a1['status'](_0x4f5a69)[_0x65f6('0x22')](_0x9d7bb0);};}exports[_0x65f6('0x23')]=function(_0x4b2292,_0x296cd9){var _0x28f710={},_0x52277c={},_0x325cb4={'count':0x0,'rows':[]};var _0x2bff2b=_[_0x65f6('0x24')](db['ChatTransferReport']['rawAttributes'],function(_0x488d36){return{'name':_0x488d36[_0x65f6('0x25')],'type':_0x488d36[_0x65f6('0x26')][_0x65f6('0x27')]};});_0x52277c[_0x65f6('0x28')]=_[_0x65f6('0x24')](_0x2bff2b,_0x65f6('0x29'));_0x52277c[_0x65f6('0x2a')]=_['keys'](_0x4b2292['query']);_0x52277c[_0x65f6('0x2b')]=_[_0x65f6('0x2c')](_0x52277c['model'],_0x52277c['query']);_0x28f710[_0x65f6('0x2d')]=_[_0x65f6('0x2c')](_0x52277c[_0x65f6('0x28')],qs[_0x65f6('0x2e')](_0x4b2292[_0x65f6('0x2a')][_0x65f6('0x2e')]));_0x28f710['attributes']=_0x28f710[_0x65f6('0x2d')][_0x65f6('0x2f')]?_0x28f710[_0x65f6('0x2d')]:_0x52277c['model'];if(!_0x4b2292[_0x65f6('0x2a')][_0x65f6('0x30')](_0x65f6('0x31'))){_0x28f710[_0x65f6('0x1a')]=qs[_0x65f6('0x1a')](_0x4b2292[_0x65f6('0x2a')]['limit']);_0x28f710[_0x65f6('0x19')]=qs[_0x65f6('0x19')](_0x4b2292['query'][_0x65f6('0x19')]);}_0x28f710['order']=qs[_0x65f6('0x32')](_0x4b2292['query'][_0x65f6('0x32')]);_0x28f710[_0x65f6('0x33')]=qs['filters'](_[_0x65f6('0x34')](_0x4b2292[_0x65f6('0x2a')],_0x52277c[_0x65f6('0x2b')]),_0x2bff2b);if(_0x4b2292['query']['filter']){_0x28f710[_0x65f6('0x33')]=_['merge'](_0x28f710[_0x65f6('0x33')],{'$or':_['map'](_0x2bff2b,function(_0x22d760){if(_0x22d760[_0x65f6('0x26')]!=='VIRTUAL'){var _0x44b809={};_0x44b809[_0x22d760['name']]={'$like':'%'+_0x4b2292['query'][_0x65f6('0x35')]+'%'};return _0x44b809;}})});}_0x28f710=_[_0x65f6('0x36')]({},_0x28f710,_0x4b2292[_0x65f6('0x37')]);var _0x313be5={'where':_0x28f710[_0x65f6('0x33')]};return db[_0x65f6('0x38')][_0x65f6('0x18')](_0x313be5)[_0x65f6('0x1f')](function(_0x4f933b){_0x325cb4[_0x65f6('0x18')]=_0x4f933b;if(_0x4b2292['query'][_0x65f6('0x39')]){_0x28f710[_0x65f6('0x3a')]=[{'all':!![]}];}return db[_0x65f6('0x38')][_0x65f6('0x3b')](_0x28f710);})['then'](function(_0x32148f){_0x325cb4[_0x65f6('0x3c')]=_0x32148f;return _0x325cb4;})[_0x65f6('0x1f')](respondWithFilteredResult(_0x296cd9,_0x28f710))[_0x65f6('0x3d')](handleError(_0x296cd9,null));};exports[_0x65f6('0x3e')]=function(_0x3f6103,_0xed4c96){var _0x2acca5={'raw':!![],'where':{'id':_0x3f6103['params']['id']}},_0x35c195={};_0x35c195[_0x65f6('0x28')]=_[_0x65f6('0x3f')](db[_0x65f6('0x38')][_0x65f6('0x40')]);_0x35c195[_0x65f6('0x2a')]=_[_0x65f6('0x3f')](_0x3f6103[_0x65f6('0x2a')]);_0x35c195[_0x65f6('0x2b')]=_[_0x65f6('0x2c')](_0x35c195[_0x65f6('0x28')],_0x35c195[_0x65f6('0x2a')]);_0x2acca5[_0x65f6('0x2d')]=_[_0x65f6('0x2c')](_0x35c195[_0x65f6('0x28')],qs[_0x65f6('0x2e')](_0x3f6103[_0x65f6('0x2a')]['fields']));_0x2acca5[_0x65f6('0x2d')]=_0x2acca5[_0x65f6('0x2d')][_0x65f6('0x2f')]?_0x2acca5[_0x65f6('0x2d')]:_0x35c195['model'];if(_0x3f6103[_0x65f6('0x2a')][_0x65f6('0x39')]){_0x2acca5[_0x65f6('0x3a')]=[{'all':!![]}];}_0x2acca5=_['merge']({},_0x2acca5,_0x3f6103[_0x65f6('0x37')]);return db[_0x65f6('0x38')][_0x65f6('0x41')](_0x2acca5)[_0x65f6('0x1f')](handleEntityNotFound(_0xed4c96,null))['then'](respondWithResult(_0xed4c96,null))[_0x65f6('0x3d')](handleError(_0xed4c96,null));};exports['create']=function(_0x3f1baa,_0x6968b){return db['ChatTransferReport'][_0x65f6('0x42')](_0x3f1baa['body'],{})[_0x65f6('0x1f')](respondWithResult(_0x6968b,0xc9))[_0x65f6('0x3d')](handleError(_0x6968b,null));};exports[_0x65f6('0x1e')]=function(_0xc0db01,_0x3ec18f){if(_0xc0db01[_0x65f6('0x43')]['id']){delete _0xc0db01['body']['id'];}return db['ChatTransferReport'][_0x65f6('0x41')]({'where':{'id':_0xc0db01[_0x65f6('0x44')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x3ec18f,null))[_0x65f6('0x1f')](saveUpdates(_0xc0db01[_0x65f6('0x43')],null))[_0x65f6('0x1f')](respondWithResult(_0x3ec18f,null))[_0x65f6('0x3d')](handleError(_0x3ec18f,null));};exports[_0x65f6('0x45')]=function(_0x414f49,_0x517a47){return db[_0x65f6('0x38')][_0x65f6('0x41')]({'where':{'id':_0x414f49[_0x65f6('0x44')]['id']}})['then'](handleEntityNotFound(_0x517a47,null))[_0x65f6('0x1f')](removeEntity(_0x517a47,null))[_0x65f6('0x3d')](handleError(_0x517a47,null));};exports['describe']=function(_0x22d745,_0x253d52){return db['ChatTransferReport'][_0x65f6('0x46')]()['then'](respondWithResult(_0x253d52,null))[_0x65f6('0x3d')](handleError(_0x253d52,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 16515bb..d7aad18 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 _0xcbdb=['ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define'];(function(_0xfc67b8,_0x32eab0){var _0x4d113d=function(_0xbab5d3){while(--_0xbab5d3){_0xfc67b8['push'](_0xfc67b8['shift']());}};_0x4d113d(++_0x32eab0);}(_0xcbdb,0x6b));var _0xbcbd=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xcbdb[_0x33032e];return _0x13316b;};'use strict';var _=require(_0xbcbd('0x0'));var util=require(_0xbcbd('0x1'));var logger=require(_0xbcbd('0x2'))(_0xbcbd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbcbd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbcbd('0x5'));var config=require(_0xbcbd('0x6'));var attributes=require(_0xbcbd('0x7'));module[_0xbcbd('0x8')]=function(_0x18b045,_0x771491){return _0x18b045[_0xbcbd('0x9')](_0xbcbd('0xa'),attributes,{'tableName':_0xbcbd('0xb'),'paranoid':![],'indexes':[{'name':_0xbcbd('0xc'),'fields':[_0xbcbd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1f61=['uniqueid','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer'];(function(_0x3b827f,_0x5d7cd6){var _0x5f05d3=function(_0x51cb83){while(--_0x51cb83){_0x3b827f['push'](_0x3b827f['shift']());}};_0x5f05d3(++_0x5d7cd6);}(_0x1f61,0x83));var _0x11f6=function(_0x26ce99,_0x51c44a){_0x26ce99=_0x26ce99-0x0;var _0x69dd3d=_0x1f61[_0x26ce99];return _0x69dd3d;};'use strict';var _=require(_0x11f6('0x0'));var util=require(_0x11f6('0x1'));var logger=require('../../config/logger')(_0x11f6('0x2'));var moment=require(_0x11f6('0x3'));var BPromise=require(_0x11f6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x11f6('0x5'));var config=require(_0x11f6('0x6'));var attributes=require(_0x11f6('0x7'));module[_0x11f6('0x8')]=function(_0x51900d,_0x1550ce){return _0x51900d[_0x11f6('0x9')](_0x11f6('0xa'),attributes,{'tableName':_0x11f6('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x11f6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index cbdc4da..0c9cb2c 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 _0x6ec7=['catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x107fd,_0x638b31){var _0x29df88=function(_0x5995d8){while(--_0x5995d8){_0x107fd['push'](_0x107fd['shift']());}};_0x29df88(++_0x638b31);}(_0x6ec7,0x8d));var _0x76ec=function(_0xa98fb3,_0x503b17){_0xa98fb3=_0xa98fb3-0x0;var _0x22751a=_0x6ec7[_0xa98fb3];return _0x22751a;};'use strict';var _=require(_0x76ec('0x0'));var util=require('util');var moment=require(_0x76ec('0x1'));var BPromise=require(_0x76ec('0x2'));var rs=require(_0x76ec('0x3'));var fs=require('fs');var Redis=require(_0x76ec('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76ec('0x5'));var logger=require('../../config/logger')(_0x76ec('0x6'));var config=require(_0x76ec('0x7'));var jayson=require(_0x76ec('0x8'));var client=jayson[_0x76ec('0x9')][_0x76ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15c407,_0x55de0f,_0x5c8c75){return new BPromise(function(_0x4c82dc,_0x271c0a){return client['request'](_0x15c407,_0x5c8c75)[_0x76ec('0xb')](function(_0x185546){logger[_0x76ec('0xc')](_0x76ec('0xd'),_0x55de0f,_0x76ec('0xe'));logger['debug'](_0x76ec('0xf'),_0x55de0f,_0x76ec('0xe'),JSON['stringify'](_0x185546));if(_0x185546['error']){if(_0x185546[_0x76ec('0x10')]['code']===0x1f4){logger[_0x76ec('0x10')](_0x76ec('0xd'),_0x55de0f,_0x185546['error'][_0x76ec('0x11')]);return _0x271c0a(_0x185546[_0x76ec('0x10')][_0x76ec('0x11')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x55de0f,_0x185546[_0x76ec('0x10')][_0x76ec('0x11')]);return _0x4c82dc(_0x185546[_0x76ec('0x10')][_0x76ec('0x11')]);}else{logger[_0x76ec('0xc')](_0x76ec('0xd'),_0x55de0f,_0x76ec('0xe'));_0x4c82dc(_0x185546[_0x76ec('0x12')][_0x76ec('0x11')]);}})[_0x76ec('0x13')](function(_0xe3abeb){logger[_0x76ec('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x55de0f,_0xe3abeb);_0x271c0a(_0xe3abeb);});});} \ No newline at end of file +var _0xc5c6=['rpc','../../config/environment','jayson/promise','request','then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2e3766,_0x249b8d){var _0x428561=function(_0x2f401a){while(--_0x2f401a){_0x2e3766['push'](_0x2e3766['shift']());}};_0x428561(++_0x249b8d);}(_0xc5c6,0x8d));var _0x6c5c=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xc5c6[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0x6c5c('0x0'));var util=require(_0x6c5c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6c5c('0x2'));var fs=require('fs');var Redis=require(_0x6c5c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c5c('0x4'));var logger=require(_0x6c5c('0x5'))(_0x6c5c('0x6'));var config=require(_0x6c5c('0x7'));var jayson=require(_0x6c5c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x55008c,_0x3f039a,_0x10b6ee){return new BPromise(function(_0x53ed8e,_0x248cef){return client[_0x6c5c('0x9')](_0x55008c,_0x10b6ee)[_0x6c5c('0xa')](function(_0x30f7ea){logger[_0x6c5c('0xb')](_0x6c5c('0xc'),_0x3f039a,'request\x20sent');logger[_0x6c5c('0xd')](_0x6c5c('0xe'),_0x3f039a,_0x6c5c('0xf'),JSON[_0x6c5c('0x10')](_0x30f7ea));if(_0x30f7ea[_0x6c5c('0x11')]){if(_0x30f7ea['error'][_0x6c5c('0x12')]===0x1f4){logger[_0x6c5c('0x11')](_0x6c5c('0xc'),_0x3f039a,_0x30f7ea[_0x6c5c('0x11')][_0x6c5c('0x13')]);return _0x248cef(_0x30f7ea[_0x6c5c('0x11')][_0x6c5c('0x13')]);}logger[_0x6c5c('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x3f039a,_0x30f7ea[_0x6c5c('0x11')][_0x6c5c('0x13')]);return _0x53ed8e(_0x30f7ea[_0x6c5c('0x11')]['message']);}else{logger[_0x6c5c('0xb')](_0x6c5c('0xc'),_0x3f039a,'request\x20sent');_0x53ed8e(_0x30f7ea['result']['message']);}})[_0x6c5c('0x14')](function(_0x3c3e94){logger[_0x6c5c('0x11')](_0x6c5c('0xc'),_0x3f039a,_0x3c3e94);_0x248cef(_0x3c3e94);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 49aa4fd..3ff16e1 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 _0x2c4c=['delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put'];(function(_0x49892d,_0x497f14){var _0x4e3e3f=function(_0x2ad008){while(--_0x2ad008){_0x49892d['push'](_0x49892d['shift']());}};_0x4e3e3f(++_0x497f14);}(_0x2c4c,0x1d7));var _0xc2c4=function(_0x4a397d,_0x5bab1f){_0x4a397d=_0x4a397d-0x0;var _0x316571=_0x2c4c[_0x4a397d];return _0x316571;};'use strict';var multer=require(_0xc2c4('0x0'));var util=require('util');var path=require(_0xc2c4('0x1'));var timeout=require('connect-timeout');var express=require(_0xc2c4('0x2'));var router=express['Router']();var fs_extra=require(_0xc2c4('0x3'));var auth=require(_0xc2c4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc2c4('0x5'));var controller=require(_0xc2c4('0x6'));router[_0xc2c4('0x7')]('/',auth[_0xc2c4('0x8')](),controller['index']);router[_0xc2c4('0x7')](_0xc2c4('0x9'),auth['isAuthenticated'](),controller[_0xc2c4('0xa')]);router[_0xc2c4('0x7')](_0xc2c4('0xb'),auth['isAuthenticated'](),controller[_0xc2c4('0xc')]);router[_0xc2c4('0xd')]('/',auth[_0xc2c4('0x8')](),controller['create']);router[_0xc2c4('0xe')]('/:id',auth[_0xc2c4('0x8')](),controller['update']);router[_0xc2c4('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc2c4('0x10')]);module[_0xc2c4('0x11')]=router; \ No newline at end of file +var _0xf364=['/:id','show','post','create','put','update','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x11f893,_0x259935){var _0x400fa8=function(_0x25933b){while(--_0x25933b){_0x11f893['push'](_0x11f893['shift']());}};_0x400fa8(++_0x259935);}(_0xf364,0x194));var _0x4f36=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xf364[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x4f36('0x0'));var util=require('util');var path=require(_0x4f36('0x1'));var timeout=require('connect-timeout');var express=require(_0x4f36('0x2'));var router=express[_0x4f36('0x3')]();var fs_extra=require(_0x4f36('0x4'));var auth=require(_0x4f36('0x5'));var interaction=require(_0x4f36('0x6'));var config=require(_0x4f36('0x7'));var controller=require(_0x4f36('0x8'));router[_0x4f36('0x9')]('/',auth[_0x4f36('0xa')](),controller[_0x4f36('0xb')]);router['get'](_0x4f36('0xc'),auth[_0x4f36('0xa')](),controller[_0x4f36('0xd')]);router['get'](_0x4f36('0xe'),auth[_0x4f36('0xa')](),controller[_0x4f36('0xf')]);router[_0x4f36('0x10')]('/',auth[_0x4f36('0xa')](),controller[_0x4f36('0x11')]);router[_0x4f36('0x12')](_0x4f36('0xe'),auth[_0x4f36('0xa')](),controller[_0x4f36('0x13')]);router[_0x4f36('0x14')](_0x4f36('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x4f36('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index d7aa7b5..cc446b8 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 _0x008c=['email','Agent','#011F6A','INTEGER','squared','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Note','Type\x20a\x20message','Skip','ENUM','stringify','input','name','text','onlineForm','parse','getDataValue','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING'];(function(_0x343003,_0x404558){var _0x407574=function(_0x4fd0ff){while(--_0x4fd0ff){_0x343003['push'](_0x343003['shift']());}};_0x407574(++_0x404558);}(_0x008c,0x188));var _0xc008=function(_0x4326eb,_0x1801c5){_0x4326eb=_0x4326eb-0x0;var _0x2735a3=_0x008c[_0x4326eb];return _0x2735a3;};'use strict';var Sequelize=require(_0xc008('0x0'));var rs=require(_0xc008('0x1'));module[_0xc008('0x2')]={'name':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xc008('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xc008('0x3')]},'mapKey':{'type':Sequelize[_0xc008('0x3')],'defaultValue':_0xc008('0x4')},'mapKeyOffline':{'type':Sequelize[_0xc008('0x3')],'defaultValue':_0xc008('0x4')},'key':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xc008('0x3')],'defaultValue':_0xc008('0x5')},'customerAlias':{'type':Sequelize[_0xc008('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc008('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc008('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xc008('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xc008('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0xc008('0x8')),'defaultValue':_0xc008('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xc008('0xa')},'start_chat_button':{'type':Sequelize[_0xc008('0x3')],'defaultValue':_0xc008('0xb')},'offline_chat_button':{'type':Sequelize[_0xc008('0x3')],'defaultValue':_0xc008('0xc')},'header_offline':{'type':Sequelize[_0xc008('0x3')],'defaultValue':_0xc008('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xc008('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xc008('0xe')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xc008('0xf')]},'closingQuestion':{'type':Sequelize[_0xc008('0x3')],'defaultValue':_0xc008('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xc008('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xc008('0x3')],'defaultValue':_0xc008('0x11')},'placeholderMessage':{'type':Sequelize[_0xc008('0x3')],'defaultValue':_0xc008('0x12')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xc008('0x3')],'defaultValue':_0xc008('0x13')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xc008('0xe')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xc008('0x14')]('star','thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xc008('0x15')]({'items':[{'type':_0xc008('0x16'),'variable':null,'config':{'placeholder':_0xc008('0x17'),'type':_0xc008('0x18'),'required':!![]},'props':{'title':_0xc008('0x17'),'helpText':''}},{'type':_0xc008('0x16'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xc008('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xc008('0x19'))?JSON[_0xc008('0x1a')](this[_0xc008('0x1b')](_0xc008('0x19'))):{};},'set':function(_0x5410f5){return this['setDataValue']('onlineForm',JSON[_0xc008('0x15')](_0x5410f5));}},'offlineForm':{'type':Sequelize[_0xc008('0xf')],'defaultValue':function(){return JSON[_0xc008('0x15')]({'items':[{'type':_0xc008('0x16'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0xc008('0x1c'),'helpText':_0xc008('0x1d')}}],'fromKey':0x0});},'get':function(){return this[_0xc008('0x1b')]('offlineForm')?JSON[_0xc008('0x1a')](this[_0xc008('0x1b')](_0xc008('0x1e'))):{};},'set':function(_0x2a7d4f){return this['setDataValue'](_0xc008('0x1e'),JSON[_0xc008('0x15')](_0x2a7d4f));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xc008('0xe')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xc008('0xe')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xc008('0x3')]},'forwardOffline':{'type':Sequelize[_0xc008('0xe')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xc008('0x3')]},'waitingTitle':{'type':Sequelize[_0xc008('0x3')],'defaultValue':_0xc008('0x1f')},'waitingMessage':{'type':Sequelize[_0xc008('0x3')],'defaultValue':_0xc008('0x20')},'offlineMessageSubject':{'type':Sequelize[_0xc008('0x3')],'defaultValue':_0xc008('0x21')},'offlineMessageBody':{'type':Sequelize[_0xc008('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xc008('0xe')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xc008('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xc008('0x3')],'defaultValue':_0xc008('0x13')},'sendUnmanaged':{'type':Sequelize[_0xc008('0x3')],'defaultValue':_0xc008('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xc008('0xe')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xc008('0xe')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xc008('0xf')]},'showAgentAvatar':{'type':Sequelize[_0xc008('0xe')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xc008('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xc008('0x22');}},'notificationSound':{'type':Sequelize[_0xc008('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc008('0xe')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xc008('0xe')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xc008('0x3')],'defaultValue':_0xc008('0x23')},'waitForTheAssignedAgent':{'type':Sequelize[_0xc008('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xc008('0x24')},'verticalAlignment':{'type':Sequelize[_0xc008('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xc008('0x25')},'defaultTitle':{'type':Sequelize[_0xc008('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xc008('0xe')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xc008('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xc008('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc008('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xc008('0x3')],'defaultValue':_0xc008('0x26')},'systemAvatar':{'type':Sequelize[_0xc008('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc008('0x7')],'comment':_0xc008('0x27')},'mandatoryDisposition':{'type':Sequelize[_0xc008('0xe')],'defaultValue':![],'comment':_0xc008('0x28'),'set':function(_0x35b496){if(!_0x35b496)this[_0xc008('0x29')](_0xc008('0x2a'),null);this[_0xc008('0x29')](_0xc008('0x2b'),_0x35b496);}},'vidaooEscalation':{'type':Sequelize[_0xc008('0xe')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xc008('0x3')],'defaultValue':![]},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xc008('0xf')]}}; \ No newline at end of file +var _0x44e8=['name','text','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Send','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Feedback','ENUM','star','stringify','input'];(function(_0x179733,_0x457dfc){var _0x370b8b=function(_0x40b3b4){while(--_0x40b3b4){_0x179733['push'](_0x179733['shift']());}};_0x370b8b(++_0x457dfc);}(_0x44e8,0xd7));var _0x844e=function(_0x112ea7,_0x33698b){_0x112ea7=_0x112ea7-0x0;var _0x194fb8=_0x44e8[_0x112ea7];return _0x194fb8;};'use strict';var Sequelize=require(_0x844e('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x844e('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x844e('0x1')],'allowNull':![],'unique':_0x844e('0x2')},'description':{'type':Sequelize[_0x844e('0x1')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x844e('0x3')},'mapKeyOffline':{'type':Sequelize[_0x844e('0x1')],'defaultValue':_0x844e('0x3')},'key':{'type':Sequelize[_0x844e('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x844e('0x4')},'customerAlias':{'type':Sequelize[_0x844e('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x844e('0x1')],'allowNull':![],'defaultValue':_0x844e('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x844e('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x844e('0x1')],'allowNull':![],'defaultValue':_0x844e('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x844e('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x844e('0x1')]},'animation':{'type':Sequelize[_0x844e('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x844e('0x9'),_0x844e('0xa')),'defaultValue':_0x844e('0x9')},'header_online':{'type':Sequelize[_0x844e('0x1')],'defaultValue':_0x844e('0xb')},'start_chat_button':{'type':Sequelize[_0x844e('0x1')],'defaultValue':_0x844e('0xc')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x844e('0xd')},'header_offline':{'type':Sequelize[_0x844e('0x1')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x844e('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x844e('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x844e('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x844e('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x844e('0xf')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x844e('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x844e('0x1')],'defaultValue':_0x844e('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x844e('0x1')],'defaultValue':_0x844e('0x12')},'noteTitle':{'type':Sequelize[_0x844e('0x1')],'defaultValue':_0x844e('0x13')},'placeholderMessage':{'type':Sequelize[_0x844e('0x1')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x844e('0x1')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x844e('0x1')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x844e('0x1')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x844e('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x844e('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x844e('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x844e('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x844e('0x1')],'defaultValue':_0x844e('0x14')},'ratingType':{'type':Sequelize[_0x844e('0x15')](_0x844e('0x16'),'thumb'),'defaultValue':_0x844e('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x844e('0x17')]({'items':[{'type':_0x844e('0x18'),'variable':null,'config':{'placeholder':_0x844e('0x19'),'type':_0x844e('0x1a'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x844e('0x18'),'props':{'title':_0x844e('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x844e('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x844e('0x1b')](_0x844e('0x1c'))?JSON[_0x844e('0x1d')](this[_0x844e('0x1b')](_0x844e('0x1c'))):{};},'set':function(_0x498ae0){return this[_0x844e('0x1e')](_0x844e('0x1c'),JSON[_0x844e('0x17')](_0x498ae0));}},'offlineForm':{'type':Sequelize[_0x844e('0xf')],'defaultValue':function(){return JSON[_0x844e('0x17')]({'items':[{'type':'input','props':{'title':_0x844e('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':_0x844e('0x1f'),'config':{'placeholder':_0x844e('0x20')},'props':{'title':_0x844e('0x20'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x844e('0x1b')](_0x844e('0x21'))?JSON[_0x844e('0x1d')](this['getDataValue'](_0x844e('0x21'))):{};},'set':function(_0x81d4de){return this[_0x844e('0x1e')](_0x844e('0x21'),JSON[_0x844e('0x17')](_0x81d4de));}},'token':{'type':Sequelize[_0x844e('0x1')],'defaultValue':function(){return rs[_0x844e('0x22')]();}},'autoclose':{'type':Sequelize[_0x844e('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x844e('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x844e('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x844e('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x844e('0x1')]},'waitingTitle':{'type':Sequelize[_0x844e('0x1')],'defaultValue':_0x844e('0x23')},'waitingMessage':{'type':Sequelize[_0x844e('0x1')],'defaultValue':_0x844e('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x844e('0x1')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x844e('0x1')],'defaultValue':_0x844e('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0x844e('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x844e('0x26')},'skipUnmanaged':{'type':Sequelize[_0x844e('0x1')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x844e('0x1')],'defaultValue':_0x844e('0xd')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x844e('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x844e('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x844e('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x844e('0x1')]},'notificationTemplate':{'type':Sequelize[_0x844e('0xf')],'defaultValue':function(){return _0x844e('0x27');}},'notificationSound':{'type':Sequelize[_0x844e('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x844e('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x844e('0x1')],'defaultValue':_0x844e('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x844e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x844e('0x1')],'defaultValue':_0x844e('0x29')},'verticalAlignment':{'type':Sequelize[_0x844e('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x844e('0x1')],'defaultValue':_0x844e('0x2a')},'defaultTitle':{'type':Sequelize[_0x844e('0x1')]},'customerAvatar':{'type':Sequelize[_0x844e('0xf')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x844e('0x1')],'allowNull':![],'defaultValue':_0x844e('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x844e('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x844e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x844e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x844e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x844e('0x1')],'defaultValue':_0x844e('0x2c')},'systemAvatar':{'type':Sequelize[_0x844e('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x844e('0x2d')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x844e('0x2e'),'set':function(_0x535e21){if(!_0x535e21)this[_0x844e('0x1e')]('mandatoryDispositionPauseId',null);this[_0x844e('0x1e')](_0x844e('0x2f'),_0x535e21);}},'vidaooEscalation':{'type':Sequelize[_0x844e('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x844e('0x1')],'defaultValue':![]},'openNewInteraction':{'type':Sequelize[_0x844e('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x844e('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 77d30be..8916f44 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 _0x5301=['iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','Interval','Intervals','getLicense','virtual','chatLicenseExceeded','all','some','server/files/chat/iframe.js','remote','x-real-ip','connection','alignment','textColor','color_button','backgroundColor','addApplications','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','getFields','false','offlineForm','items','fromKey','getOfflineMessages','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','register','jayson/promise','client','http','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','apply','save','then','destroy','ChatWebsites','stack','name','mandatoryDispositionPause','ChatWebsite','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','filters','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','Pause','rawAttributes','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','getDispositions','findOne','order','sort','ChatWebsiteId','rows','removeDispositions','ids','CannedAnswer','removeAnswers','sitepic','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','server/files/images/logos/default_logo.svg','existsSync','root','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','isNil','agentAvatar','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','ListId','from','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','CmList','Contacts','ChatApplication','Applications','account','applications','List','priority','asc','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','forcedOwnership','Start','startRouting','EventManager','no\x20available\x20attributes','CompanyId','send','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','files','attachments','basename','sequelize','transaction','Attachment','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','openNewInteraction','MailAccountId','toPairsIn','subjectOffline','NotifyMailAccount','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone'];(function(_0x5826c4,_0x5061e6){var _0x4a8f6e=function(_0x54577f){while(--_0x54577f){_0x5826c4['push'](_0x5826c4['shift']());}};_0x4a8f6e(++_0x5061e6);}(_0x5301,0x157));var _0x1530=function(_0x216d62,_0xd392){_0x216d62=_0x216d62-0x0;var _0x8b2feb=_0x5301[_0x216d62];return _0x8b2feb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1530('0x0'));var zipdir=require(_0x1530('0x1'));var jsonpatch=require(_0x1530('0x2'));var rp=require(_0x1530('0x3'));var moment=require(_0x1530('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1530('0x5'));var util=require(_0x1530('0x6'));var path=require(_0x1530('0x7'));var sox=require(_0x1530('0x8'));var csv=require('to-csv');var ejs=require(_0x1530('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1530('0xa'));var squel=require('squel');var crypto=require(_0x1530('0xb'));var jsforce=require(_0x1530('0xc'));var deskjs=require(_0x1530('0xd'));var toCsv=require(_0x1530('0xe'));var querystring=require(_0x1530('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1530('0x10'));var qs=require(_0x1530('0x11'));var as=require(_0x1530('0x12'));var hardwareService=require(_0x1530('0x13'));var logger=require('../../config/logger')(_0x1530('0x14'));var utils=require(_0x1530('0x15'));var config=require(_0x1530('0x16'));var licenseUtil=require(_0x1530('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x1530('0x18')](config[_0x1530('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x1530('0x1a'))(new Redis(config[_0x1530('0x19')]));require('./chatWebsite.socket')[_0x1530('0x1b')](socket);var jayson=require(_0x1530('0x1c'));var client=jayson[_0x1530('0x1d')][_0x1530('0x1e')]({'port':0x232c});var client9002=jayson[_0x1530('0x1d')][_0x1530('0x1e')]({'port':0x232a});var client9003=jayson[_0x1530('0x1d')][_0x1530('0x1e')]({'port':0x232b});var client9001=jayson[_0x1530('0x1d')][_0x1530('0x1e')]({'port':0x2329});function respondWithRpcPromise(_0x3c5eb3,_0xe0f8a0,_0x4da2b1,_0x1b8e27){return new BPromise(function(_0x164f5f,_0x4b2d5f){var _0x4b9006=_0x1b8e27||client;return _0x4b9006['request'](_0x3c5eb3,_0x4da2b1)['then'](function(_0x44027d){logger[_0x1530('0x1f')](_0x1530('0x20'),_0xe0f8a0,'request\x20sent');logger[_0x1530('0x21')](_0x1530('0x22'),_0xe0f8a0,'request\x20sent',JSON[_0x1530('0x23')](_0x44027d));if(_0x44027d[_0x1530('0x24')]){if(_0x44027d[_0x1530('0x24')][_0x1530('0x25')]===0x1f4){logger[_0x1530('0x24')]('ChatWebsite,\x20%s,\x20%s',_0xe0f8a0,_0x44027d[_0x1530('0x24')][_0x1530('0x26')]);return _0x4b2d5f(_0x44027d['error'][_0x1530('0x26')]);}logger[_0x1530('0x24')](_0x1530('0x20'),_0xe0f8a0,_0x44027d[_0x1530('0x24')][_0x1530('0x26')]);return _0x164f5f(_0x44027d[_0x1530('0x24')][_0x1530('0x26')]);}else{logger[_0x1530('0x1f')](_0x1530('0x20'),_0xe0f8a0,_0x1530('0x27'));_0x164f5f(_0x44027d['result'][_0x1530('0x26')]);}})[_0x1530('0x28')](function(_0xebb344){logger[_0x1530('0x24')]('ChatWebsite,\x20%s,\x20%s',_0xe0f8a0,_0xebb344);_0x4b2d5f(_0xebb344);});});}function respondWithStatusCode(_0x3d4844,_0x33f342){_0x33f342=_0x33f342||0xcc;return function(_0x3e1cd6){if(_0x3e1cd6){return _0x3d4844[_0x1530('0x29')](_0x33f342);}return _0x3d4844[_0x1530('0x2a')](_0x33f342)[_0x1530('0x2b')]();};}function respondWithResult(_0x265892,_0x4fe3ad){_0x4fe3ad=_0x4fe3ad||0xc8;return function(_0x703f85){if(_0x703f85){return _0x265892['status'](_0x4fe3ad)[_0x1530('0x2c')](_0x703f85);}};}function respondWithFilteredResult(_0xf96c11,_0x56f441){return function(_0x40346d){if(_0x40346d){var _0x33e4da=_0x40346d['count'],_0x34dea8=_0x56f441[_0x1530('0x2d')],_0x5815f6=_0x56f441[_0x1530('0x2d')]+_0x56f441[_0x1530('0x2e')],_0x2e75bc;if(_0x5815f6>=_0x33e4da){_0x5815f6=_0x33e4da;_0x2e75bc=0xc8;}else{_0x2e75bc=0xce;}_0xf96c11[_0x1530('0x2a')](_0x2e75bc);return _0xf96c11[_0x1530('0x2f')]('Content-Range',_0x34dea8+'-'+_0x5815f6+'/'+_0x33e4da)['json'](_0x40346d);}return null;};}function patchUpdates(_0x5b9137){return function(_0x5222b5){try{jsonpatch[_0x1530('0x30')](_0x5222b5,_0x5b9137,!![]);}catch(_0x501713){return BPromise['reject'](_0x501713);}return _0x5222b5[_0x1530('0x31')]();};}function saveUpdates(_0x2143d1,_0x4dc21a){return function(_0x464220){if(_0x464220){return _0x464220['update'](_0x2143d1)[_0x1530('0x32')](function(_0x453fbe){return _0x453fbe;});}return null;};}function removeEntity(_0x3295a7,_0x58c9f9){return function(_0x23209c){if(_0x23209c){return _0x23209c[_0x1530('0x33')]()['then'](function(){var _0x37713d=_0x23209c['get']({'plain':!![]});var _0x3d3454=_0x1530('0x34');return db['UserProfileResource'][_0x1530('0x33')]({'where':{'type':_0x3d3454,'resourceId':_0x37713d['id']}})[_0x1530('0x32')](function(){return _0x23209c;});})[_0x1530('0x32')](function(){_0x3295a7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa352be,_0x587bff){return function(_0x3525b2){if(!_0x3525b2){_0xa352be[_0x1530('0x29')](0x194);}return _0x3525b2;};}function handleError(_0x42dff9,_0x39f7fc){_0x39f7fc=_0x39f7fc||0x1f4;return function(_0x162e04){logger[_0x1530('0x24')](_0x162e04[_0x1530('0x35')]);if(_0x162e04[_0x1530('0x36')]){delete _0x162e04['name'];}_0x42dff9[_0x1530('0x2a')](_0x39f7fc)['send'](_0x162e04);};}exports['index']=function(_0x431e40,_0x52a019){var _0x192dd7={'include':[{'model':db['Pause'],'as':_0x1530('0x37')}]},_0x504fc2={},_0x42dc75={'count':0x0,'rows':[]};var _0x4d78b6=_['map'](db[_0x1530('0x38')]['rawAttributes'],function(_0x55171b){return{'name':_0x55171b[_0x1530('0x39')],'type':_0x55171b[_0x1530('0x3a')][_0x1530('0x3b')]};});_0x504fc2['model']=_[_0x1530('0x3c')](_0x4d78b6,'name');_0x504fc2[_0x1530('0x3d')]=_[_0x1530('0x3e')](_0x431e40['query']);_0x504fc2['filters']=_[_0x1530('0x3f')](_0x504fc2[_0x1530('0x40')],_0x504fc2[_0x1530('0x3d')]);_0x192dd7[_0x1530('0x41')]=_[_0x1530('0x3f')](_0x504fc2[_0x1530('0x40')],qs[_0x1530('0x42')](_0x431e40['query']['fields']));_0x192dd7['attributes']=_0x192dd7['attributes'][_0x1530('0x43')]?_0x192dd7[_0x1530('0x41')]:_0x504fc2[_0x1530('0x40')];if(!_0x431e40[_0x1530('0x3d')][_0x1530('0x44')](_0x1530('0x45'))){_0x192dd7[_0x1530('0x2e')]=qs[_0x1530('0x2e')](_0x431e40[_0x1530('0x3d')][_0x1530('0x2e')]);_0x192dd7[_0x1530('0x2d')]=qs[_0x1530('0x2d')](_0x431e40[_0x1530('0x3d')][_0x1530('0x2d')]);}_0x192dd7['order']=qs['sort'](_0x431e40[_0x1530('0x3d')]['sort']);_0x192dd7['where']=qs[_0x1530('0x46')](_[_0x1530('0x47')](_0x431e40[_0x1530('0x3d')],_0x504fc2[_0x1530('0x46')]),_0x4d78b6);if(_0x431e40['query'][_0x1530('0x48')]){_0x192dd7[_0x1530('0x49')]=_[_0x1530('0x4a')](_0x192dd7[_0x1530('0x49')],{'$or':_[_0x1530('0x3c')](_0x4d78b6,function(_0x32ae26){if(_0x32ae26[_0x1530('0x3a')]!==_0x1530('0x4b')){var _0x1e06d2={};_0x1e06d2[_0x32ae26[_0x1530('0x36')]]={'$like':'%'+_0x431e40[_0x1530('0x3d')][_0x1530('0x48')]+'%'};return _0x1e06d2;}})});}_0x192dd7=_[_0x1530('0x4a')]({},_0x192dd7,_0x431e40[_0x1530('0x4c')]);var _0x45896d={'where':_0x192dd7[_0x1530('0x49')]};return db['ChatWebsite']['count'](_0x45896d)[_0x1530('0x32')](function(_0x32840e){_0x42dc75[_0x1530('0x4d')]=_0x32840e;if(_0x431e40[_0x1530('0x3d')][_0x1530('0x4e')]){_0x192dd7[_0x1530('0x4f')]=[{'all':!![]}];}return db[_0x1530('0x38')][_0x1530('0x50')](_0x192dd7);})[_0x1530('0x32')](function(_0x4416fc){_0x42dc75['rows']=_0x4416fc;return _0x42dc75;})['then'](respondWithFilteredResult(_0x52a019,_0x192dd7))['catch'](handleError(_0x52a019,null));};exports[_0x1530('0x51')]=function(_0x58ba60,_0x191104){var _0x3472b3={'raw':![],'where':{'id':_0x58ba60[_0x1530('0x52')]['id']},'include':[{'model':db[_0x1530('0x53')],'as':_0x1530('0x37')}]},_0x4c31bb={};_0x4c31bb[_0x1530('0x40')]=_[_0x1530('0x3e')](db['ChatWebsite'][_0x1530('0x54')]);_0x4c31bb[_0x1530('0x3d')]=_[_0x1530('0x3e')](_0x58ba60['query']);_0x4c31bb['filters']=_[_0x1530('0x3f')](_0x4c31bb[_0x1530('0x40')],_0x4c31bb[_0x1530('0x3d')]);_0x3472b3[_0x1530('0x41')]=_[_0x1530('0x3f')](_0x4c31bb[_0x1530('0x40')],qs[_0x1530('0x42')](_0x58ba60['query'][_0x1530('0x42')]));_0x3472b3[_0x1530('0x41')]=_0x3472b3[_0x1530('0x41')][_0x1530('0x43')]?_0x3472b3[_0x1530('0x41')]:_0x4c31bb[_0x1530('0x40')];if(_0x58ba60['query'][_0x1530('0x4e')]){_0x3472b3[_0x1530('0x4f')]=[{'all':!![]}];}_0x3472b3=_[_0x1530('0x4a')]({},_0x3472b3,_0x58ba60[_0x1530('0x4c')]);return db['ChatWebsite']['find'](_0x3472b3)[_0x1530('0x32')](handleEntityNotFound(_0x191104,null))[_0x1530('0x32')](respondWithResult(_0x191104,null))[_0x1530('0x28')](handleError(_0x191104,null));};exports['create']=function(_0xe631f1,_0x2f6b9f){return db['ChatWebsite'][_0x1530('0x55')](_0xe631f1[_0x1530('0x56')],{})['then'](function(_0x25fa7b){var _0x49dc03=_0xe631f1[_0x1530('0x57')][_0x1530('0x58')]({'plain':!![]});if(!_0x49dc03)throw new Error(_0x1530('0x59'));if(_0x49dc03[_0x1530('0x5a')]==='user'){var _0x34ddf5=_0x25fa7b['get']({'plain':!![]});var _0x211fe7=_0x1530('0x34');return db[_0x1530('0x5b')][_0x1530('0x5c')]({'where':{'name':_0x211fe7,'userProfileId':_0x49dc03[_0x1530('0x5d')]},'raw':!![]})[_0x1530('0x32')](function(_0x5240fd){if(_0x5240fd&&_0x5240fd['autoAssociation']===0x0){return db[_0x1530('0x5e')]['create']({'name':_0x34ddf5[_0x1530('0x36')],'resourceId':_0x34ddf5['id'],'type':_0x5240fd[_0x1530('0x36')],'sectionId':_0x5240fd['id']},{})[_0x1530('0x32')](function(){return _0x25fa7b;});}else{return _0x25fa7b;}})['catch'](function(_0x4c2d1d){logger['error'](_0x1530('0x5f'),_0x4c2d1d);throw _0x4c2d1d;});}return _0x25fa7b;})[_0x1530('0x32')](respondWithResult(_0x2f6b9f,0xc9))[_0x1530('0x28')](handleError(_0x2f6b9f,null));};exports[_0x1530('0x60')]=function(_0x35aed7,_0x494982){if(_0x35aed7[_0x1530('0x56')]['id']){delete _0x35aed7[_0x1530('0x56')]['id'];}return db[_0x1530('0x38')]['find']({'where':{'id':_0x35aed7[_0x1530('0x52')]['id']},'include':[{'model':db[_0x1530('0x53')],'as':_0x1530('0x37')}]})[_0x1530('0x32')](handleEntityNotFound(_0x494982,null))['then'](saveUpdates(_0x35aed7[_0x1530('0x56')],null))[_0x1530('0x32')](respondWithResult(_0x494982,null))[_0x1530('0x28')](handleError(_0x494982,null));};exports[_0x1530('0x33')]=function(_0x2c442f,_0x55bbd9){return db[_0x1530('0x38')][_0x1530('0x5c')]({'where':{'id':_0x2c442f[_0x1530('0x52')]['id']}})[_0x1530('0x32')](handleEntityNotFound(_0x55bbd9,null))[_0x1530('0x32')](removeEntity(_0x55bbd9,null))['catch'](handleError(_0x55bbd9,null));};exports[_0x1530('0x61')]=function(_0x2c70ce,_0x396ea3){return db[_0x1530('0x38')][_0x1530('0x61')]()['then'](respondWithResult(_0x396ea3,null))[_0x1530('0x28')](handleError(_0x396ea3,null));};exports[_0x1530('0x62')]=function(_0x13c3f4,_0x5e41b5,_0x21efe7){if(_0x13c3f4[_0x1530('0x56')]['id']){delete _0x13c3f4[_0x1530('0x56')]['id'];}return db[_0x1530('0x38')][_0x1530('0x5c')]({'where':{'id':_0x13c3f4[_0x1530('0x52')]['id']}})[_0x1530('0x32')](handleEntityNotFound(_0x5e41b5,null))[_0x1530('0x32')](function(_0x52ab6f){if(_0x52ab6f){_0x13c3f4['body']['ChatWebsiteId']=_0x52ab6f['id'];return db[_0x1530('0x63')][_0x1530('0x55')](_0x13c3f4['body']);}})[_0x1530('0x32')](respondWithResult(_0x5e41b5,null))[_0x1530('0x28')](handleError(_0x5e41b5,null));};exports[_0x1530('0x64')]=function(_0x2824ff,_0x1bcc24,_0xb37b9f){var _0x2a0dc4={'raw':![],'where':{}};var _0x4fa799={};var _0x1e7daf={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x1530('0x65')]({'where':{'id':_0x2824ff[_0x1530('0x52')]['id']}})[_0x1530('0x32')](handleEntityNotFound(_0x1bcc24,null))[_0x1530('0x32')](function(_0x4b8ff4){if(_0x4b8ff4){_0x4fa799['model']=_[_0x1530('0x3e')](db['Disposition']['rawAttributes']);_0x4fa799[_0x1530('0x3d')]=_[_0x1530('0x3e')](_0x2824ff[_0x1530('0x3d')]);_0x4fa799[_0x1530('0x46')]=_[_0x1530('0x3f')](_0x4fa799[_0x1530('0x40')],_0x4fa799[_0x1530('0x3d')]);_0x2a0dc4[_0x1530('0x41')]=_[_0x1530('0x3f')](_0x4fa799[_0x1530('0x40')],qs['fields'](_0x2824ff['query'][_0x1530('0x42')]));_0x2a0dc4['attributes']=_0x2a0dc4[_0x1530('0x41')][_0x1530('0x43')]?_0x2a0dc4[_0x1530('0x41')]:_0x4fa799[_0x1530('0x40')];if(!_0x2824ff[_0x1530('0x3d')][_0x1530('0x44')]('nolimit')){_0x2a0dc4[_0x1530('0x2e')]=qs[_0x1530('0x2e')](_0x2824ff[_0x1530('0x3d')][_0x1530('0x2e')]);_0x2a0dc4[_0x1530('0x2d')]=qs[_0x1530('0x2d')](_0x2824ff[_0x1530('0x3d')]['offset']);}_0x2a0dc4[_0x1530('0x66')]=qs['sort'](_0x2824ff[_0x1530('0x3d')][_0x1530('0x67')]);_0x2a0dc4[_0x1530('0x49')]=qs[_0x1530('0x46')](_[_0x1530('0x47')](_0x2824ff[_0x1530('0x3d')],_0x4fa799['filters']));_0x2a0dc4[_0x1530('0x49')][_0x1530('0x68')]=_0x4b8ff4['id'];if(_0x2824ff[_0x1530('0x3d')][_0x1530('0x48')]){_0x2a0dc4[_0x1530('0x49')]=_[_0x1530('0x4a')](_0x2a0dc4[_0x1530('0x49')],{'$or':_[_0x1530('0x3c')](_0x2a0dc4['attributes'],function(_0x212053){var _0x530118={};_0x530118[_0x212053]={'$like':'%'+_0x2824ff['query'][_0x1530('0x48')]+'%'};return _0x530118;})});}_0x2a0dc4=_['merge']({},_0x2a0dc4,_0x2824ff['options']);return db[_0x1530('0x63')][_0x1530('0x4d')]({'where':_0x2a0dc4[_0x1530('0x49')]})[_0x1530('0x32')](function(_0x38f64b){_0x1e7daf[_0x1530('0x4d')]=_0x38f64b;if(_0x2824ff[_0x1530('0x3d')][_0x1530('0x4e')]){_0x2a0dc4[_0x1530('0x4f')]=[{'all':!![]}];}return db['Disposition'][_0x1530('0x50')](_0x2a0dc4);})[_0x1530('0x32')](function(_0x1edb36){_0x1e7daf[_0x1530('0x69')]=_0x1edb36;return _0x1e7daf;});}})['then'](respondWithFilteredResult(_0x1bcc24,_0x2a0dc4))[_0x1530('0x28')](handleError(_0x1bcc24,null));};exports['removeDispositions']=function(_0x4865ae,_0x50afb3,_0x1fc684){return db[_0x1530('0x38')][_0x1530('0x5c')]({'where':{'id':_0x4865ae[_0x1530('0x52')]['id']}})[_0x1530('0x32')](handleEntityNotFound(_0x50afb3,null))[_0x1530('0x32')](function(_0x581b93){if(_0x581b93){return _0x581b93[_0x1530('0x6a')](_0x4865ae[_0x1530('0x3d')][_0x1530('0x6b')]);}})[_0x1530('0x32')](respondWithStatusCode(_0x50afb3,null))[_0x1530('0x28')](handleError(_0x50afb3,null));};exports['addAnswer']=function(_0x273a48,_0x26c936,_0x5252d9){if(_0x273a48[_0x1530('0x56')]['id']){delete _0x273a48[_0x1530('0x56')]['id'];}return db['ChatWebsite'][_0x1530('0x5c')]({'where':{'id':_0x273a48[_0x1530('0x52')]['id']}})[_0x1530('0x32')](handleEntityNotFound(_0x26c936,null))['then'](function(_0x29e7f0){if(_0x29e7f0){_0x273a48[_0x1530('0x56')][_0x1530('0x68')]=_0x29e7f0['id'];return db[_0x1530('0x6c')][_0x1530('0x55')](_0x273a48['body']);}})['then'](respondWithResult(_0x26c936,null))['catch'](handleError(_0x26c936,null));};exports['getAnswers']=function(_0x52ed90,_0x5ae5c6,_0x3a7c81){var _0x3dc170={'raw':![],'where':{}};var _0x25eda1={};var _0x2b8115={'count':0x0,'rows':[]};return db[_0x1530('0x38')][_0x1530('0x65')]({'where':{'id':_0x52ed90[_0x1530('0x52')]['id']}})['then'](handleEntityNotFound(_0x5ae5c6,null))[_0x1530('0x32')](function(_0x446d0f){if(_0x446d0f){_0x25eda1[_0x1530('0x40')]=_[_0x1530('0x3e')](db['CannedAnswer']['rawAttributes']);_0x25eda1[_0x1530('0x3d')]=_[_0x1530('0x3e')](_0x52ed90[_0x1530('0x3d')]);_0x25eda1[_0x1530('0x46')]=_[_0x1530('0x3f')](_0x25eda1[_0x1530('0x40')],_0x25eda1[_0x1530('0x3d')]);_0x3dc170['attributes']=_[_0x1530('0x3f')](_0x25eda1[_0x1530('0x40')],qs[_0x1530('0x42')](_0x52ed90['query'][_0x1530('0x42')]));_0x3dc170[_0x1530('0x41')]=_0x3dc170[_0x1530('0x41')][_0x1530('0x43')]?_0x3dc170['attributes']:_0x25eda1[_0x1530('0x40')];if(!_0x52ed90[_0x1530('0x3d')][_0x1530('0x44')](_0x1530('0x45'))){_0x3dc170['limit']=qs['limit'](_0x52ed90[_0x1530('0x3d')]['limit']);_0x3dc170[_0x1530('0x2d')]=qs['offset'](_0x52ed90[_0x1530('0x3d')]['offset']);}_0x3dc170[_0x1530('0x66')]=qs[_0x1530('0x67')](_0x52ed90[_0x1530('0x3d')][_0x1530('0x67')]);_0x3dc170[_0x1530('0x49')]=qs[_0x1530('0x46')](_[_0x1530('0x47')](_0x52ed90['query'],_0x25eda1[_0x1530('0x46')]));_0x3dc170[_0x1530('0x49')][_0x1530('0x68')]=_0x446d0f['id'];if(_0x52ed90[_0x1530('0x3d')][_0x1530('0x48')]){_0x3dc170['where']=_[_0x1530('0x4a')](_0x3dc170['where'],{'$or':_[_0x1530('0x3c')](_0x3dc170[_0x1530('0x41')],function(_0x1e67ac){var _0x7b5440={};_0x7b5440[_0x1e67ac]={'$like':'%'+_0x52ed90[_0x1530('0x3d')]['filter']+'%'};return _0x7b5440;})});}_0x3dc170=_[_0x1530('0x4a')]({},_0x3dc170,_0x52ed90[_0x1530('0x4c')]);return db['CannedAnswer'][_0x1530('0x4d')]({'where':_0x3dc170[_0x1530('0x49')]})[_0x1530('0x32')](function(_0x28715b){_0x2b8115[_0x1530('0x4d')]=_0x28715b;if(_0x52ed90['query'][_0x1530('0x4e')]){_0x3dc170[_0x1530('0x4f')]=[{'all':!![]}];}return db[_0x1530('0x6c')][_0x1530('0x50')](_0x3dc170);})['then'](function(_0x146696){_0x2b8115[_0x1530('0x69')]=_0x146696;return _0x2b8115;});}})[_0x1530('0x32')](respondWithFilteredResult(_0x5ae5c6,_0x3dc170))[_0x1530('0x28')](handleError(_0x5ae5c6,null));};exports[_0x1530('0x6d')]=function(_0x4f3aa4,_0x322216,_0x50dcdc){return db[_0x1530('0x38')][_0x1530('0x5c')]({'where':{'id':_0x4f3aa4[_0x1530('0x52')]['id']}})[_0x1530('0x32')](handleEntityNotFound(_0x322216,null))[_0x1530('0x32')](function(_0x25dfa0){if(_0x25dfa0){return _0x25dfa0[_0x1530('0x6d')](_0x4f3aa4[_0x1530('0x3d')][_0x1530('0x6b')]);}})['then'](respondWithStatusCode(_0x322216,null))['catch'](handleError(_0x322216,null));};exports['addLogo']=function(_0x4184c8,_0x34c6ca,_0x5aabc2){_0x4184c8[_0x1530('0x56')][_0x1530('0x6e')]=_0x4184c8[_0x1530('0x6f')][_0x1530('0x70')];return db[_0x1530('0x38')][_0x1530('0x5c')]({'where':{'id':_0x4184c8['params']['id']}})[_0x1530('0x32')](handleEntityNotFound(_0x34c6ca,null))[_0x1530('0x32')](saveUpdates(_0x4184c8['body'],null))['then'](respondWithResult(_0x34c6ca,null))[_0x1530('0x28')](handleError(_0x34c6ca,null));};exports[_0x1530('0x71')]=function(_0x3ba6fe,_0x451148,_0x3e3bb8){_0x3ba6fe[_0x1530('0x56')]['agentAvatar']=_0x3ba6fe[_0x1530('0x6f')][_0x1530('0x70')];return db[_0x1530('0x38')][_0x1530('0x5c')]({'where':{'id':_0x3ba6fe[_0x1530('0x52')]['id']}})['then'](handleEntityNotFound(_0x451148,null))[_0x1530('0x32')](saveUpdates(_0x3ba6fe[_0x1530('0x56')],null))[_0x1530('0x32')](respondWithResult(_0x451148,null))[_0x1530('0x28')](handleError(_0x451148,null));};exports[_0x1530('0x72')]=function(_0x135054,_0x54240f,_0x30b290){_0x135054[_0x1530('0x56')][_0x1530('0x73')]=_0x135054[_0x1530('0x6f')]['filename'];return db[_0x1530('0x38')][_0x1530('0x5c')]({'where':{'id':_0x135054['params']['id']}})[_0x1530('0x32')](handleEntityNotFound(_0x54240f,null))[_0x1530('0x32')](saveUpdates(_0x135054[_0x1530('0x56')],null))[_0x1530('0x32')](respondWithResult(_0x54240f,null))['catch'](handleError(_0x54240f,null));};exports[_0x1530('0x74')]=function(_0x5f4ab7,_0x5931f9,_0x1616ee){_0x5f4ab7[_0x1530('0x56')][_0x1530('0x75')]=_0x5f4ab7[_0x1530('0x6f')]['filename'];return db[_0x1530('0x38')][_0x1530('0x5c')]({'where':{'id':_0x5f4ab7[_0x1530('0x52')]['id']}})[_0x1530('0x32')](handleEntityNotFound(_0x5931f9,null))['then'](saveUpdates(_0x5f4ab7[_0x1530('0x56')],null))['then'](respondWithResult(_0x5931f9,null))[_0x1530('0x28')](handleError(_0x5931f9,null));};exports['getLogo']=function(_0x92f10a,_0x2ed85d,_0x2fbf16){var _0x3a4c75=path[_0x1530('0x76')](config['root'],_0x1530('0x77'));var _0x175333={'where':{'id':_0x92f10a['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x5815cb=![];return require(_0x1530('0x17'))['getLicense']()[_0x1530('0x32')](function(_0x1b39d5){if(_0x1b39d5){_0x5815cb=_0x1b39d5['custom'];}})[_0x1530('0x32')](function(){return db[_0x1530('0x38')][_0x1530('0x5c')](_0x175333);})[_0x1530('0x32')](handleEntityNotFound(_0x2ed85d,null))['then'](function(_0x5eefb9){if(_0x5eefb9){if(!_['isNil'](_0x5eefb9[_0x1530('0x6e')])){if(fs[_0x1530('0x78')](path[_0x1530('0x76')](config[_0x1530('0x79')],_0x1530('0x7a'),_0x5eefb9[_0x1530('0x6e')]))&&_0x5815cb){_0x3a4c75=path[_0x1530('0x76')](config[_0x1530('0x79')],_0x1530('0x7a'),_0x5eefb9[_0x1530('0x6e')]);}}return _0x2ed85d['download'](_0x3a4c75);}})[_0x1530('0x28')](handleError(_0x2ed85d,null));};exports[_0x1530('0x7b')]=function(_0x89ee73,_0x32fedf,_0x1e5891){var _0x949ea=path[_0x1530('0x76')](config[_0x1530('0x79')],_0x1530('0x7c'));var _0x33c561={'where':{'id':_0x89ee73[_0x1530('0x52')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x1530('0x38')][_0x1530('0x5c')](_0x33c561)[_0x1530('0x32')](handleEntityNotFound(_0x32fedf,null))['then'](function(_0x1ade31){if(_0x1ade31){if(!_[_0x1530('0x7d')](_0x1ade31[_0x1530('0x7e')])){if(fs[_0x1530('0x78')](path[_0x1530('0x76')](config[_0x1530('0x79')],'server/files/images/avatars/',_0x1ade31[_0x1530('0x7e')]))){_0x949ea=path['join'](config[_0x1530('0x79')],_0x1530('0x7f'),_0x1ade31[_0x1530('0x7e')]);}}return _0x32fedf[_0x1530('0x80')](_0x949ea);}})[_0x1530('0x28')](handleError(_0x32fedf,null));};exports[_0x1530('0x81')]=function(_0x4f461d,_0x889d9c,_0x30d15e){var _0x2f92db=path[_0x1530('0x76')](config['root'],_0x1530('0x82'));var _0x4cd309={'where':{'id':_0x4f461d['params']['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db[_0x1530('0x38')][_0x1530('0x5c')](_0x4cd309)[_0x1530('0x32')](handleEntityNotFound(_0x889d9c,null))[_0x1530('0x32')](function(_0x20c25b){if(_0x20c25b){if(!_[_0x1530('0x7d')](_0x20c25b['customerAvatar'])){if(fs[_0x1530('0x78')](path['join'](config[_0x1530('0x79')],'server/files/images/avatars/',_0x20c25b[_0x1530('0x73')]))&&_0x20c25b[_0x1530('0x83')]){_0x2f92db=path[_0x1530('0x76')](config[_0x1530('0x79')],_0x1530('0x7f'),_0x20c25b[_0x1530('0x73')]);}}return _0x889d9c[_0x1530('0x80')](_0x2f92db);}})[_0x1530('0x28')](handleError(_0x889d9c,null));};exports['getSystemAvatar']=function(_0x2cda74,_0x4ba4d2,_0x15df56){var _0x14080b=path[_0x1530('0x76')](config[_0x1530('0x79')],_0x1530('0x84'));var _0x56bf39={'where':{'id':_0x2cda74[_0x1530('0x52')]['id']},'attributes':['id',_0x1530('0x75')],'raw':!![]};return db[_0x1530('0x38')]['find'](_0x56bf39)[_0x1530('0x32')](handleEntityNotFound(_0x4ba4d2,null))[_0x1530('0x32')](function(_0x41a7a8){if(_0x41a7a8){if(!_[_0x1530('0x7d')](_0x41a7a8[_0x1530('0x75')])){if(fs[_0x1530('0x78')](path[_0x1530('0x76')](config[_0x1530('0x79')],'server/files/images/avatars/',_0x41a7a8[_0x1530('0x75')]))){_0x14080b=path[_0x1530('0x76')](config[_0x1530('0x79')],_0x1530('0x7f'),_0x41a7a8['systemAvatar']);}}return _0x4ba4d2['download'](_0x14080b);}})[_0x1530('0x28')](handleError(_0x4ba4d2,null));};exports[_0x1530('0x85')]=function(_0x4ae342,_0x5c8342,_0x446154){var _0x4ca40c=require('user-agent-parser');var _0x250112=new _0x4ca40c();var _0x5b730b=_0x250112[_0x1530('0x86')](_0x4ae342[_0x1530('0x87')][_0x1530('0x88')])[_0x1530('0x89')]();var _0x39abba={'body':_0x4ae342[_0x1530('0x56')],'channel':_0x1530('0x8a')};var _0x3a7805=[];var _0x2c187b=[];var _0x4217d5={};var _0x6b4871=![];return db[_0x1530('0x8b')]['describe']()[_0x1530('0x32')](function(_0x41d182){if(!_0x41d182){throw new db[(_0x1530('0x8c'))][(_0x1530('0x8d'))]('no\x20available\x20attributes');}_0x3a7805=_[_0x1530('0x8e')](_[_0x1530('0x3e')](_0x41d182),[_0x1530('0x8f'),_0x1530('0x90')]);_0x2c187b=_[_0x1530('0x8e')](_[_0x1530('0x3e')](_0x41d182),[_0x1530('0x8f'),_0x1530('0x90'),'CompanyId',_0x1530('0x91')]);if(_0x4ae342[_0x1530('0x56')]['id']){delete _0x4ae342[_0x1530('0x56')]['id'];}if(_[_0x1530('0x7d')](_0x4ae342[_0x1530('0x56')][_0x1530('0x92')])){throw new db[(_0x1530('0x8c'))][(_0x1530('0x8d'))]('from\x20is\x20mandatory');}if(_[_0x1530('0x7d')](_0x4ae342[_0x1530('0x56')][_0x1530('0x56')])||_0x4ae342[_0x1530('0x56')][_0x1530('0x56')]===''){throw new db[(_0x1530('0x8c'))][(_0x1530('0x8d'))](_0x1530('0x93'));}if(_[_0x1530('0x7d')](_0x4ae342['body']['mapKey'])){throw new db[(_0x1530('0x8c'))][(_0x1530('0x8d'))](_0x1530('0x94')+_0x2c187b);}if(!_[_0x1530('0x95')](_0x2c187b,_0x4ae342[_0x1530('0x56')][_0x1530('0x96')])){throw new db[(_0x1530('0x8c'))][(_0x1530('0x8d'))](_0x1530('0x97')+_0x2c187b);}_0x4217d5[_0x4ae342[_0x1530('0x56')][_0x1530('0x96')]]=_0x4ae342[_0x1530('0x56')][_0x1530('0x92')];})[_0x1530('0x32')](function(){return db['ChatWebsite'][_0x1530('0x5c')]({'where':{'id':_0x4ae342['params']['id']},'include':[{'model':db[_0x1530('0x98')],'as':'List','include':[{'model':db['CmContact'],'as':_0x1530('0x99'),'where':_0x4217d5,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x1530('0x9a')],'as':_0x1530('0x9b')}]});})[_0x1530('0x32')](handleEntityNotFound(_0x5c8342,null))['then'](function(_0x34c2e4){if(_0x34c2e4&&_0x34c2e4['List']){_0x39abba[_0x1530('0x9c')]=_0x34c2e4;_0x39abba[_0x1530('0x9d')]=_0x34c2e4[_0x1530('0x9b')];_0x39abba['list']=_0x34c2e4[_0x1530('0x9e')];_0x39abba[_0x1530('0x9d')]=_['orderBy'](_0x39abba[_0x1530('0x9d')],[_0x1530('0x9f')],[_0x1530('0xa0')]);if(_0x39abba[_0x1530('0x9c')][_0x1530('0x9b')]){delete _0x39abba['account'][_0x1530('0x9b')];}if(_0x39abba[_0x1530('0x9c')][_0x1530('0x9e')]&&_0x39abba[_0x1530('0x9c')][_0x1530('0x9e')]['Contacts'][_0x1530('0x43')]){return _0x39abba[_0x1530('0x9c')]['List'][_0x1530('0x99')][0x0];}var _0x3f70f0=_['defaults'](_0x4ae342['body'],{'firstName':_0x4ae342[_0x1530('0x56')][_0x1530('0x92')],'ListId':_0x34c2e4['ListId']});_0x3f70f0[_0x4ae342[_0x1530('0x56')][_0x1530('0x96')]]=_0x4ae342[_0x1530('0x56')][_0x1530('0x92')];return db['CmContact'][_0x1530('0x55')](_0x3f70f0,{'fields':_0x3a7805,'raw':!![]});}})['then'](handleEntityNotFound(_0x5c8342,null))[_0x1530('0x32')](function(_0x3c9049){_0x39abba[_0x1530('0xa1')]=_0x3c9049;var _0x90b048=_0x4ae342[_0x1530('0x56')][_0x1530('0xa2')];if(_0x4ae342[_0x1530('0x87')][_0x1530('0xa3')]){_0x90b048=_0x4ae342[_0x1530('0x87')][_0x1530('0xa3')];}else if(_0x4ae342[_0x1530('0x87')]['x-forwarded-for']){_0x90b048=_[_0x1530('0xa4')](_0x4ae342[_0x1530('0x87')][_0x1530('0xa5')][_0x1530('0xa6')](','));}if(_0x3c9049){var _0x2c83ee={'ContactId':_0x3c9049['id'],'ChatWebsiteId':_0x4ae342[_0x1530('0x52')]['id'],'from':(_0x3c9049[_0x1530('0xa7')]||'')+'\x20'+(_0x3c9049[_0x1530('0xa8')]||''),'customerIp':_0x90b048,'customerPort':_0x4ae342[_0x1530('0x87')][_0x1530('0xa9')]?_0x4ae342[_0x1530('0x87')]['x-real-port']:null,'referer':_0x4ae342['body'][_0x1530('0xaa')],'browserName':_0x5b730b[_0x1530('0xab')][_0x1530('0x36')]&&_0x5b730b['browser'][_0x1530('0xac')]?util[_0x1530('0xad')](_0x1530('0xae'),_0x5b730b[_0x1530('0xab')][_0x1530('0x36')],_0x5b730b[_0x1530('0xab')][_0x1530('0xac')]):_0x1530('0xaf'),'browserVersion':_0x5b730b[_0x1530('0xab')][_0x1530('0xac')]||_0x1530('0xaf'),'osName':util[_0x1530('0xad')](_0x1530('0xae'),_0x5b730b['os'][_0x1530('0x36')],_0x5b730b['os'][_0x1530('0xac')]),'osVersion':_0x5b730b['os'][_0x1530('0xac')],'deviceModel':_0x5b730b[_0x1530('0xb0')][_0x1530('0x40')]&&_0x5b730b[_0x1530('0xb0')]['vendor']?util[_0x1530('0xad')](_0x1530('0xb1'),_0x5b730b['device'][_0x1530('0x40')],_0x5b730b['device'][_0x1530('0xb2')],_0x5b730b[_0x1530('0xb0')][_0x1530('0x3a')]):null,'deviceVendor':_0x5b730b['device'][_0x1530('0xb2')],'deviceType':_0x5b730b[_0x1530('0xb0')][_0x1530('0x3a')],'formData':JSON['stringify'](_0x4ae342[_0x1530('0x56')])};var _0x445491={'ChatWebsiteId':_0x4ae342['params']['id'],'closed':![]};if(_0x4ae342['body']['threadId']){_0x445491[_0x1530('0xb3')]=_0x4ae342[_0x1530('0x56')][_0x1530('0xb3')];return db[_0x1530('0xb4')]['find']({'where':_0x445491})[_0x1530('0x32')](function(_0x4ab771){if(_0x4ab771){return[_0x4ab771,![]];}_0x2c83ee['threadId']=_0x4ae342[_0x1530('0x56')][_0x1530('0xb3')];_0x2c83ee['externalUrl']=_0x4ae342[_0x1530('0x56')][_0x1530('0xb5')];return db['ChatInteraction'][_0x1530('0x55')](_0x2c83ee)[_0x1530('0x32')](function(_0x35d37b){return[_0x35d37b,!![]];});});}_0x445491[_0x1530('0xb6')]=_0x3c9049['id'];if(_0x4ae342['body'][_0x1530('0xb7')]&&_0x4ae342[_0x1530('0x56')][_0x1530('0xb7')]['id']){_0x445491['id']=_0x4ae342[_0x1530('0x56')][_0x1530('0xb7')]['id'];return db[_0x1530('0xb4')][_0x1530('0x5c')]({'where':_0x445491})[_0x1530('0x32')](function(_0xfaa7ae){if(_0xfaa7ae){return[_0xfaa7ae,![]];}return db[_0x1530('0xb4')]['create'](_0x2c83ee)['then'](function(_0x3434d2){return[_0x3434d2,!![]];});});}return db['ChatInteraction'][_0x1530('0x55')](_0x2c83ee)[_0x1530('0x32')](function(_0x3ed04f){return[_0x3ed04f,!![]];});}})[_0x1530('0xb8')](function(_0x278f93,_0x37cbc8){if(_0x278f93){_0x6b4871=_0x37cbc8;if(!_0x37cbc8){var _0x15e6b5={'from':(_0x39abba['contact']['firstName']||'')+'\x20'+(_0x39abba['contact'][_0x1530('0xa8')]||'')};if(_0x4ae342[_0x1530('0x56')][_0x1530('0xb3')]&&_0x4ae342['body']['messageId']&&_0x4ae342[_0x1530('0x56')][_0x1530('0xb3')]!=_0x4ae342[_0x1530('0x56')][_0x1530('0xb9')]){_0x15e6b5['threadId']=_0x4ae342['body'][_0x1530('0xb9')];}return _0x278f93[_0x1530('0x60')](_0x15e6b5);}else{return _0x278f93;}}})[_0x1530('0x32')](function(_0x38a12c){_0x39abba[_0x1530('0xb7')]=_0x38a12c[_0x1530('0x58')]({'plain':!![]});_0x39abba[_0x1530('0xb7')]['created']=_0x6b4871;if(_0x39abba[_0x1530('0xb7')][_0x1530('0xba')]){if(_0x39abba[_0x1530('0x9c')]['autoclose']){_0x39abba[_0x1530('0x9d')][_0x1530('0xbb')]({'id':0x0,'priority':_0x39abba['applications']['length']+0x1,'app':_0x1530('0xbc'),'appdata':_0x1530('0xbd'),'interval':_0x1530('0xbe')});}}return db['ChatMessage'][_0x1530('0x55')]({'body':_0x4ae342[_0x1530('0x56')]['body'],'ChatWebsiteId':_0x4ae342['params']['id'],'ChatInteractionId':_0x38a12c['id'],'direction':'in','ContactId':_0x39abba[_0x1530('0xa1')]['id'],'AttachmentId':_0x4ae342[_0x1530('0x56')][_0x1530('0xbf')]});})[_0x1530('0x32')](function(_0x359bb3){_0x39abba[_0x1530('0x26')]=_0x359bb3;if(_0x39abba[_0x1530('0xb7')]['UserId']){return db['User'][_0x1530('0x5c')]({'attributes':['id',_0x1530('0x36')],'where':{'id':_0x39abba['interaction'][_0x1530('0xc0')]}})['then'](function(_0xcae1d0){if(_0xcae1d0){_0x39abba[_0x1530('0x9d')][_0x1530('0xc1')]({'id':0x0,'priority':0x0,'app':_0x1530('0xc2'),'appdata':_0xcae1d0[_0x1530('0x36')]+','+(_0x39abba[_0x1530('0x9c')]['waitForTheAssignedAgent']||0xa),'interval':_0x1530('0xbe')});_0x39abba[_0x1530('0xc3')]=!![];}return respondWithRpcPromise(_0x1530('0xc4'),_0x1530('0xc5'),_0x39abba);});}return respondWithRpcPromise('Start',_0x1530('0xc5'),_0x39abba);})[_0x1530('0x32')](function(_0x4c7e76){respondWithRpcPromise(_0x1530('0xc6'),_0x1530('0xc6'),{'event':_0x1530('0x85'),'message':_0x4c7e76},client9002);return _0x4c7e76;})[_0x1530('0x32')](respondWithResult(_0x5c8342,null))['catch'](handleError(_0x5c8342,null));};exports['offline']=function(_0x4d2af1,_0x4c44df,_0x414999){var _0x478258,_0x506707,_0xda7c56;var _0x5696ec=[];var _0x449edb=[];var _0x7cc728={};var _0x104752=_0x4d2af1['files']||[];var _0x51979e=[];var _0x2eb630;return db[_0x1530('0x8b')][_0x1530('0x61')]()['then'](function(_0x16a9b9){if(!_0x16a9b9){throw new db[(_0x1530('0x8c'))][(_0x1530('0x8d'))](_0x1530('0xc7'));}_0x449edb=_[_0x1530('0x8e')](_[_0x1530('0x3e')](_0x16a9b9),[_0x1530('0x8f'),_0x1530('0x90')]);_0x5696ec=_[_0x1530('0x8e')](_[_0x1530('0x3e')](_0x16a9b9),[_0x1530('0x8f'),_0x1530('0x90'),_0x1530('0xc8'),_0x1530('0x91')]);if(_0x4d2af1['body']['id']){delete _0x4d2af1[_0x1530('0x56')]['id'];}if(_[_0x1530('0x7d')](_0x4d2af1[_0x1530('0x56')][_0x1530('0x92')])){throw _0x4c44df[_0x1530('0x2a')](0x1f4)[_0x1530('0xc9')](new db[(_0x1530('0x8c'))][(_0x1530('0x8d'))](_0x1530('0xca')));}if(_[_0x1530('0x7d')](_0x4d2af1[_0x1530('0x56')][_0x1530('0x56')])||_0x4d2af1[_0x1530('0x56')][_0x1530('0x56')]===''){throw _0x4c44df[_0x1530('0x2a')](0x1f4)[_0x1530('0xc9')](new db[(_0x1530('0x8c'))][(_0x1530('0x8d'))](_0x1530('0x93')));}if(_[_0x1530('0x7d')](_0x4d2af1[_0x1530('0x56')][_0x1530('0xcb')])){throw _0x4c44df[_0x1530('0x2a')](0x1f4)[_0x1530('0xc9')](new db['Sequelize'][(_0x1530('0x8d'))](_0x1530('0xcc')+_0x5696ec));}if(!_[_0x1530('0x95')](_0x5696ec,_0x4d2af1[_0x1530('0x56')][_0x1530('0xcb')])){throw _0x4c44df['status'](0x1f4)['send'](new db[(_0x1530('0x8c'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5696ec));}_0x7cc728[_0x4d2af1[_0x1530('0x56')][_0x1530('0xcb')]]=_0x4d2af1['body']['from'];})[_0x1530('0x32')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x4d2af1['params']['id']},'include':[{'model':db[_0x1530('0x98')],'as':'List'},{'model':db['MailAccount'],'as':_0x1530('0xcd')}]});})[_0x1530('0x32')](handleEntityNotFound(_0x4c44df,null))[_0x1530('0x32')](function(_0xfc791f){if(_0xfc791f&&_0xfc791f[_0x1530('0x9e')]){_0x506707=_0xfc791f;var _0x41a7bf=_[_0x1530('0x18')](_0x4d2af1[_0x1530('0x56')],{'firstName':_0x4d2af1['body'][_0x1530('0x92')],'phone':_0x4d2af1['body'][_0x1530('0x92')],'ListId':_0xfc791f[_0x1530('0x91')]});_0x41a7bf[_0x4d2af1[_0x1530('0x56')]['mapKeyOffline']]=_0x4d2af1[_0x1530('0x56')][_0x1530('0x92')];return db[_0x1530('0x8b')]['findOrCreate']({'where':_0x7cc728,'defaults':_0x41a7bf});}})[_0x1530('0xb8')](function(_0x4dc4f6){if(_0x4dc4f6){_0xda7c56=_0x4dc4f6;var _0x298e46=fs[_0x1530('0xce')](path['join'](config[_0x1530('0x79')],_0x1530('0xcf')),_0x1530('0xd0'));var _0xc00f54=ejs[_0x1530('0xd1')](_0x298e46,{'body':_[_0x1530('0xd2')](_0x4d2af1[_0x1530('0x56')][_0x1530('0x56')]),'bodyTitle':_0x506707[_0x1530('0xd3')]});return db[_0x1530('0xd4')][_0x1530('0x55')]({'body':_0xc00f54,'ContactId':_0x4dc4f6['id'],'ChatWebsiteId':_0x506707['id']});}})[_0x1530('0x32')](function(_0x569e97){_0x2eb630=_0x569e97;if(_0x104752[_0x1530('0x43')]){var _0x1e08d2=_0x104752[_0x1530('0x3c')](function(_0x3dfe67){return{'name':_0x3dfe67[_0x1530('0xd5')],'basename':_0x3dfe67['filename'],'type':_0x3dfe67[_0x1530('0xd6')],'ChatOfflineMessageId':_0x569e97['id']};});_0x51979e=_0x1e08d2['map'](_0x433212=>{var _0xc5fd0a={'filename':_0x433212[_0x1530('0x36')],'path':path[_0x1530('0x76')](config[_0x1530('0x79')],_0x1530('0xd7'),_0x1530('0xd8'),_0x1530('0xd9'),'offline-chat',_0x433212[_0x1530('0xda')])};return _0xc5fd0a;});if(!_0x506707['openNewInteraction']){return db[_0x1530('0xdb')][_0x1530('0xdc')](function(_0x1322d2){return db[_0x1530('0xdd')]['bulkCreate'](_0x1e08d2,{'transaction':_0x1322d2});});}}})[_0x1530('0x32')](function(){if(_0x2eb630){_0x478258=_0x2eb630;return db[_0x1530('0xcd')][_0x1530('0x65')]({'where':{'active':!![]},'include':[{'model':db[_0x1530('0xde')],'as':_0x1530('0xdf'),'raw':!![]}]});}})[_0x1530('0x32')](function(_0x2a0160){if(_0x2a0160&&_0x2a0160[_0x1530('0xdf')]&&_0x506707[_0x1530('0xe0')]&&_0x506707[_0x1530('0xe1')]){var _0x24b181={'tls':{'rejectUnauthorized':![]}};if(_0x2a0160[_0x1530('0xdf')][_0x1530('0xe2')]){_0x24b181[_0x1530('0xe2')]=_0x2a0160[_0x1530('0xdf')]['service'];}else{_0x24b181[_0x1530('0xe3')]=_0x2a0160[_0x1530('0xdf')][_0x1530('0xe3')];_0x24b181[_0x1530('0xe4')]=_0x2a0160[_0x1530('0xdf')][_0x1530('0xe4')];_0x24b181[_0x1530('0xe5')]=_0x2a0160[_0x1530('0xdf')][_0x1530('0xe5')];}if(_0x2a0160[_0x1530('0xdf')][_0x1530('0xe6')]){_0x24b181[_0x1530('0xe7')]={'user':_0x2a0160['Smtp'][_0x1530('0x57')],'pass':_0x2a0160[_0x1530('0xdf')][_0x1530('0xe8')]};}return respondWithRpcPromise(_0x1530('0xe9'),_0x1530('0xea'),{'account':_0x24b181,'message':{'from':util['format'](_0x1530('0xeb'),_0x2a0160[_0x1530('0x36')],_0x2a0160[_0x1530('0xec')]||_0x2a0160[_0x1530('0xdf')][_0x1530('0x57')]),'to':_0x506707[_0x1530('0xe1')],'subject':_0x506707[_0x1530('0xed')],'text':_0x478258['body'],'attachments':_0x51979e}},client9003)['then'](function(){return _0x478258;})[_0x1530('0x28')](function(_0x469943){console['error'](_0x469943);});}})[_0x1530('0x32')](function(){if(_0x506707&&_0x506707[_0x1530('0xee')]&&_0x506707[_0x1530('0xef')]){var _0x19381f=[];if(_0x104752[_0x1530('0x43')]){_0x19381f=_0x104752[_0x1530('0x3c')](function(_0x48bcfa){return{'name':_0x48bcfa[_0x1530('0xd5')],'basename':_0x48bcfa[_0x1530('0x70')],'type':_0x48bcfa[_0x1530('0xd6')],'ChatOfflineMessageId':_0x2eb630['id']};});}var _0x5e3486;if(!_[_0x1530('0x7d')](_0x506707['subjectOffline'])){var _0xa9fbf9=_['map'](_0x4d2af1['body'],function(_0x3bdc03){return _0x3bdc03;});var _0xefea53=_[_0x1530('0xf0')](_0xa9fbf9)[0x0];var _0x5c819a=_['mapValues'](_0xefea53,function(_0x3dbc9a){return _0x3dbc9a;});_0x5e3486=_0x5c819a[0x1][_0x506707[_0x1530('0xf1')]];}var _0x9ca03a={'from':_0xda7c56[_0x1530('0xec')],'firstName':_0xda7c56[_0x1530('0xa7')],'lastName':_0xda7c56[_0x1530('0xa8')],'mapKey':_0x1530('0xec'),'message':{'from':_0xda7c56[_0x1530('0xec')],'to':_0x506707['MailAccount']['email'],'cc':'','subject':_[_0x1530('0x7d')](_0x5e3486)?_0x506707[_0x1530('0xed')]:_0x5e3486,'messageId':'','sentAt':new Date(),'attach':_0x19381f[_0x1530('0x43')],'attachments':_0x19381f,'originChannel':'Chat','ChatWebsiteId':_0x506707['id'],'ChatOfflineMessageId':_0x478258['id'],'originTo':_0x506707[_0x1530('0xcd')][_0x1530('0xec')]},'body':_0x478258[_0x1530('0x56')]};var _0x3ea4f6={'account':{'id':_0x506707['MailAccountId']},'body':_0x9ca03a,'log':_0x1530('0xf2')};return respondWithRpcPromise(_0x1530('0xf2'),_0x1530('0xf3'),_0x3ea4f6,client9001)['then'](function(){return _0x478258;})['catch'](function(_0x54e775){console[_0x1530('0x24')](_0x54e775);});}return;})[_0x1530('0x32')](function(){if(_0x478258){return _0x478258;}})[_0x1530('0x32')](respondWithResult(_0x4c44df,null))['catch'](function(_0x28d185){console[_0x1530('0x24')](_0x1530('0x28'),_0x28d185);for(var _0xf540e2 of _0x104752){var _0xc943c=path[_0x1530('0x76')](config[_0x1530('0x79')],'server','files',_0x1530('0xd9'),_0x1530('0xf4'),_0xf540e2[_0x1530('0x70')]);fs_extra[_0x1530('0xf5')](_0xc943c)[_0x1530('0x28')](function(_0x3eed23){console['error'](_0x1530('0xf6'),_0xc943c,_0x3eed23);});}});};exports[_0x1530('0xf7')]=function(_0x4217a2,_0x1756a6,_0x305581){return db[_0x1530('0xb4')][_0x1530('0x5c')]({'where':{'id':_0x4217a2[_0x1530('0x52')]['id']}})[_0x1530('0x32')](handleEntityNotFound(_0x1756a6,null))[_0x1530('0x32')](function(_0x2418f2){if(_0x2418f2){return _0x2418f2[_0x1530('0xf7')](_0x4217a2['body']['ids'],_[_0x1530('0xf8')](_0x4217a2[_0x1530('0x56')],[_0x1530('0x6b'),'id'])||{});}})[_0x1530('0x32')](respondWithResult(_0x1756a6,null))[_0x1530('0x28')](handleError(_0x1756a6,null));};exports['getInteractions']=function(_0x573f68,_0x1d34eb,_0xf24d5e){var _0xd76ab5={'raw':![],'where':{}};var _0x3d5e9={};var _0x4b218d={'count':0x0,'rows':[]};return db[_0x1530('0x38')]['findOne']({'where':{'id':_0x573f68[_0x1530('0x52')]['id']}})[_0x1530('0x32')](handleEntityNotFound(_0x1d34eb,null))[_0x1530('0x32')](function(_0x193589){if(_0x193589){_0x3d5e9[_0x1530('0x40')]=_[_0x1530('0x3e')](db[_0x1530('0xb4')][_0x1530('0x54')]);_0x3d5e9[_0x1530('0x3d')]=_[_0x1530('0x3e')](_0x573f68['query']);_0x3d5e9[_0x1530('0x46')]=_[_0x1530('0x3f')](_0x3d5e9[_0x1530('0x40')],_0x3d5e9[_0x1530('0x3d')]);_0xd76ab5[_0x1530('0x41')]=_[_0x1530('0x3f')](_0x3d5e9[_0x1530('0x40')],qs['fields'](_0x573f68['query']['fields']));_0xd76ab5['attributes']=_0xd76ab5[_0x1530('0x41')][_0x1530('0x43')]?_0xd76ab5[_0x1530('0x41')]:_0x3d5e9[_0x1530('0x40')];if(!_0x573f68['query'][_0x1530('0x44')]('nolimit')){_0xd76ab5[_0x1530('0x2e')]=qs['limit'](_0x573f68[_0x1530('0x3d')][_0x1530('0x2e')]);_0xd76ab5[_0x1530('0x2d')]=qs['offset'](_0x573f68[_0x1530('0x3d')][_0x1530('0x2d')]);}_0xd76ab5[_0x1530('0x66')]=qs[_0x1530('0x67')](_0x573f68[_0x1530('0x3d')]['sort']);_0xd76ab5['where']=qs[_0x1530('0x46')](_[_0x1530('0x47')](_0x573f68[_0x1530('0x3d')],_0x3d5e9[_0x1530('0x46')]));_0xd76ab5['where'][_0x1530('0x68')]=_0x193589['id'];if(_0x573f68[_0x1530('0x3d')][_0x1530('0x48')]){_0xd76ab5[_0x1530('0x49')]=_[_0x1530('0x4a')](_0xd76ab5['where'],{'$or':_['map'](_0xd76ab5[_0x1530('0x41')],function(_0x28dd22){var _0x1f09f2={};_0x1f09f2[_0x28dd22]={'$like':'%'+_0x573f68[_0x1530('0x3d')][_0x1530('0x48')]+'%'};return _0x1f09f2;})});}_0xd76ab5=_[_0x1530('0x4a')]({},_0xd76ab5,_0x573f68[_0x1530('0x4c')]);return db[_0x1530('0xb4')]['count']({'where':_0xd76ab5[_0x1530('0x49')]})['then'](function(_0x702a85){_0x4b218d[_0x1530('0x4d')]=_0x702a85;if(_0x573f68[_0x1530('0x3d')]['includeAll']){_0xd76ab5[_0x1530('0x4f')]=[{'model':db[_0x1530('0x8b')],'as':_0x1530('0xf9'),'required':![]},{'model':db[_0x1530('0xfa')],'as':_0x1530('0xfb'),'attributes':[_0x1530('0x36'),_0x1530('0xfc'),_0x1530('0xfd')],'required':![]},{'model':db[_0x1530('0xfe')],'as':_0x1530('0xff'),'attributes':['id',_0x1530('0x36'),_0x1530('0x100')],'where':_0x573f68[_0x1530('0x3d')]['tag']?{'id':_0x573f68['query'][_0x1530('0x101')]}:undefined,'required':_0x573f68['query'][_0x1530('0x101')]?!![]:![]}];}return db['ChatInteraction'][_0x1530('0x50')](_0xd76ab5);})[_0x1530('0x32')](function(_0x2f00e4){_0x4b218d['rows']=_0x2f00e4;return _0x4b218d;});}})[_0x1530('0x32')](respondWithFilteredResult(_0x1d34eb,_0xd76ab5))[_0x1530('0x28')](handleError(_0x1d34eb,null));};function iftimePromise(_0x3283e6,_0x161136){return respondWithRpcPromise(_0x1530('0x102'),_0x1530('0x103'),{'command':_0x161136[_0x1530('0x104')]?util[_0x1530('0xad')](_0x1530('0x105'),_0x3283e6[_0x1530('0x106')],_0x161136[_0x1530('0x104')]):util[_0x1530('0xad')]('iftime\x20%s',_0x3283e6['interval'])},client9002)[_0x1530('0x32')](function(_0x1f498f){var _0x570262=_0x1f498f&&_0x1f498f[_0x1530('0x107')](_0x1530('0x108'))>=0x0?!![]:![];logger[_0x1530('0x1f')](_0x1530('0x109'),_0x161136['id'],_0x3283e6['id'],_0x3283e6[_0x1530('0x106')],_0x570262?_0x1530('0x10a'):'OFFLINE',_0x161136[_0x1530('0x104')]?_0x161136['timezone']:_0x1530('0x10b'));return _0x570262;})[_0x1530('0x28')](function(_0x1e9076){logger[_0x1530('0x24')](_0x1530('0x109'),_0x161136['id'],_0x3283e6['id'],_0x3283e6[_0x1530('0x106')],util[_0x1530('0x10c')](_0x1e9076,{'showHidden':![],'depth':null}),_0x161136[_0x1530('0x104')]?_0x161136[_0x1530('0x104')]:'No\x20timezone');return![];});}exports[_0x1530('0x103')]=function(_0x18926f,_0xa0013d,_0x16c00d){var _0x40d682=0x0;var _0x49fcb2=0x0;var _0x5e49da=![];var _0x1cc7c6;var _0x21b00a;return db[_0x1530('0x38')][_0x1530('0x5c')]({'where':{'id':_0x18926f[_0x1530('0x52')]['id']},'include':[{'model':db[_0x1530('0x10d')],'as':_0x1530('0x10d'),'include':[{'model':db[_0x1530('0x10d')],'as':_0x1530('0x10e'),'attributes':['id',_0x1530('0x106')],'raw':!![]}]}]})[_0x1530('0x32')](handleEntityNotFound(_0xa0013d,null))['then'](function(_0x48f38e){if(_0x48f38e){_0x1cc7c6=_0x48f38e;return _0x48f38e['getProactiveActions']({'raw':!![]});}})['then'](function(_0x3a4554){if(_0x1cc7c6){if(_0x3a4554){_0x21b00a=_0x3a4554;}}return require(_0x1530('0x17'))[_0x1530('0x10f')]();})[_0x1530('0x32')](function(_0x4dfa90){if(_0x4dfa90){_0x49fcb2=_0x4dfa90[_0x1530('0x110')];_0x5e49da=_0x4dfa90['custom'];}})[_0x1530('0x32')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0x1530('0x32')](function(_0x2fd3ee){_0x40d682=_0x2fd3ee;if(_0x49fcb2&&_0x2fd3ee>_0x49fcb2){return db['License'][_0x1530('0x65')]({'where':{'id':0x1}})[_0x1530('0x32')](function(_0xd819f2){if(_0xd819f2){_0xd819f2['increment'](_0x1530('0x111'));}});}})[_0x1530('0x32')](function(){if(_0x1cc7c6[_0x1530('0x10d')]&&_0x1cc7c6[_0x1530('0x10d')][_0x1530('0x10e')]){var _0x299a8b=[];for(var _0x48b738=0x0;_0x48b738<_0x1cc7c6['Interval']['Intervals'][_0x1530('0x43')];_0x48b738++){var _0x4c828a=_0x1cc7c6[_0x1530('0x10d')][_0x1530('0x10e')][_0x48b738][_0x1530('0x58')]({'plain':!![]});_0x299a8b[_0x1530('0xbb')](iftimePromise(_0x4c828a,_0x1cc7c6));}return BPromise[_0x1530('0x112')](_0x299a8b)[_0x1530('0x32')](function(_0x4cd746){return _[_0x1530('0x113')](_0x4cd746);});}else{return!![];}})[_0x1530('0x32')](function(_0x4e2f6c){var _0x524af8=fs[_0x1530('0xce')](path[_0x1530('0x76')](config['root'],_0x1530('0x114')),_0x1530('0xd0'));var _0x54116d={'remote':_0x1cc7c6[_0x1530('0x115')],'query':querystring[_0x1530('0x23')](_[_0x1530('0x4a')](_0x1cc7c6[_0x1530('0x58')]({'plain':!![]}),{'customerIp':_0x18926f[_0x1530('0x87')][_0x1530('0xa5')]||_0x18926f['headers'][_0x1530('0x116')]||_0x18926f[_0x1530('0x117')]['remoteAddress']||_0x18926f['ip'],'referer':_0x18926f[_0x1530('0x87')][_0x1530('0xaa')],'openedInteractions':_0x40d682,'maxInteractions':_0x49fcb2,'virtual':_0x5e49da[_0x1530('0x110')],'online':_0x4e2f6c,'custom':_0x5e49da}))['replace'](/'/g,'\x5c\x27')};_0xa0013d[_0x1530('0xc9')](ejs['render'](Mustache[_0x1530('0xd1')](_0x524af8,_0x54116d),{'proactiveActions':_0x21b00a,'alignment':_0x1cc7c6[_0x1530('0x118')],'verticalAlignment':_0x1cc7c6['verticalAlignment'],'div_color':_0x1cc7c6[_0x1530('0x100')],'text_color':_0x1cc7c6[_0x1530('0x119')],'button_color':_0x1cc7c6[_0x1530('0x11a')],'background_color':_0x1cc7c6[_0x1530('0x11b')]}));})[_0x1530('0x28')](handleError(_0xa0013d,null));};exports[_0x1530('0x11c')]=function(_0x368f5b,_0x1f42bc,_0x4c9032){return db[_0x1530('0x38')][_0x1530('0x65')]({'where':{'id':_0x368f5b[_0x1530('0x52')]['id']}})[_0x1530('0x32')](handleEntityNotFound(_0x1f42bc,null))['then'](function(_0x75e7b9){if(_0x75e7b9){return db[_0x1530('0xdb')]['transaction'](function(_0x2a1a69){return db[_0x1530('0x9a')][_0x1530('0x33')]({'where':{'ChatWebsiteId':_0x368f5b[_0x1530('0x52')]['id']},'transaction':_0x2a1a69})['then'](function(_0x465186){var _0x3470f9=_[_0x1530('0x3c')](_0x368f5b[_0x1530('0x56')],function(_0x259010){_0x259010[_0x1530('0x68')]=_0x368f5b[_0x1530('0x52')]['id'];return _0x259010;});return db['ChatApplication']['bulkCreate'](_0x3470f9,{'transaction':_0x2a1a69});});})['then'](function(){return db[_0x1530('0x9a')][_0x1530('0x11d')]({'where':{'ChatWebsiteId':_0x368f5b[_0x1530('0x52')]['id']},'order':'priority'});});}})[_0x1530('0x32')](respondWithResult(_0x1f42bc,null))[_0x1530('0x28')](handleError(_0x1f42bc,null));};exports[_0x1530('0x11e')]=function(_0x2e108f,_0x38a787,_0x30e0b7){var _0x202c1d={};var _0x50458b={};var _0x3e7e77;var _0x32e3ef;return db['ChatWebsite']['findOne']({'where':{'id':_0x2e108f[_0x1530('0x52')]['id']}})[_0x1530('0x32')](handleEntityNotFound(_0x38a787,null))[_0x1530('0x32')](function(_0x33363c){if(_0x33363c){_0x3e7e77=_0x33363c;_0x50458b['model']=_[_0x1530('0x3e')](db[_0x1530('0x9a')][_0x1530('0x54')]);_0x50458b[_0x1530('0x3d')]=_[_0x1530('0x3e')](_0x2e108f[_0x1530('0x3d')]);_0x50458b[_0x1530('0x46')]=_[_0x1530('0x3f')](_0x50458b[_0x1530('0x40')],_0x50458b['query']);_0x202c1d['attributes']=_['intersection'](_0x50458b[_0x1530('0x40')],qs[_0x1530('0x42')](_0x2e108f['query'][_0x1530('0x42')]));_0x202c1d['attributes']=_0x202c1d[_0x1530('0x41')][_0x1530('0x43')]?_0x202c1d[_0x1530('0x41')]:_0x50458b['model'];_0x202c1d[_0x1530('0x66')]=qs['sort'](_0x2e108f[_0x1530('0x3d')][_0x1530('0x67')]);_0x202c1d['where']=qs['filters'](_[_0x1530('0x47')](_0x2e108f[_0x1530('0x3d')],_0x50458b['filters']));if(_0x2e108f[_0x1530('0x3d')][_0x1530('0x48')]){_0x202c1d[_0x1530('0x49')]=_['merge'](_0x202c1d[_0x1530('0x49')],{'$or':_[_0x1530('0x3c')](_0x202c1d['attributes'],function(_0x516ce0){var _0x14f4db={};_0x14f4db[_0x516ce0]={'$like':'%'+_0x2e108f['query']['filter']+'%'};return _0x14f4db;})});}_0x202c1d=_[_0x1530('0x4a')]({},_0x202c1d,_0x2e108f[_0x1530('0x4c')]);return _0x3e7e77[_0x1530('0x11e')](_0x202c1d);}})['then'](function(_0xfd6952){if(_0xfd6952){_0x32e3ef=_0xfd6952[_0x1530('0x43')];if(!_0x2e108f[_0x1530('0x3d')][_0x1530('0x44')](_0x1530('0x45'))){_0x202c1d[_0x1530('0x2e')]=qs[_0x1530('0x2e')](_0x2e108f[_0x1530('0x3d')][_0x1530('0x2e')]);_0x202c1d[_0x1530('0x2d')]=qs[_0x1530('0x2d')](_0x2e108f[_0x1530('0x3d')]['offset']);}return _0x3e7e77['getApplications'](_0x202c1d);}})['then'](function(_0x7b128c){if(_0x7b128c){return _0x7b128c?{'count':_0x32e3ef,'rows':_0x7b128c}:null;}})['then'](respondWithResult(_0x38a787,null))[_0x1530('0x28')](handleError(_0x38a787,null));};exports[_0x1530('0x11f')]=function(_0x4cc55a,_0x1e8bc0,_0x13cadf){return db[_0x1530('0x120')][_0x1530('0x5c')]({'where':{'id':_0x4cc55a[_0x1530('0x52')]['id']}})[_0x1530('0x32')](handleEntityNotFound(_0x1e8bc0,null))[_0x1530('0x32')](function(_0x15c037){if(_0x15c037){return _0x15c037[_0x1530('0x11f')](_0x4cc55a[_0x1530('0x56')][_0x1530('0x6b')],_['omit'](_0x4cc55a[_0x1530('0x56')],[_0x1530('0x6b'),'id'])||{});}})[_0x1530('0x32')](respondWithResult(_0x1e8bc0,null))[_0x1530('0x28')](handleError(_0x1e8bc0,null));};exports[_0x1530('0x121')]=function(_0x3d0ced,_0x898092,_0x58c112){var _0x2859fd={};var _0x22ef5d={};var _0x28d607;var _0x580d76;return db[_0x1530('0x38')]['findOne']({'where':{'id':_0x3d0ced['params']['id']}})[_0x1530('0x32')](handleEntityNotFound(_0x898092,null))[_0x1530('0x32')](function(_0x50deda){if(_0x50deda){_0x28d607=_0x50deda;_0x22ef5d[_0x1530('0x40')]=_[_0x1530('0x3e')](db['ChatProactiveAction'][_0x1530('0x54')]);_0x22ef5d[_0x1530('0x3d')]=_[_0x1530('0x3e')](_0x3d0ced['query']);_0x22ef5d['filters']=_[_0x1530('0x3f')](_0x22ef5d['model'],_0x22ef5d[_0x1530('0x3d')]);_0x2859fd[_0x1530('0x41')]=_[_0x1530('0x3f')](_0x22ef5d[_0x1530('0x40')],qs[_0x1530('0x42')](_0x3d0ced[_0x1530('0x3d')][_0x1530('0x42')]));_0x2859fd['attributes']=_0x2859fd['attributes'][_0x1530('0x43')]?_0x2859fd[_0x1530('0x41')]:_0x22ef5d[_0x1530('0x40')];_0x2859fd[_0x1530('0x66')]=qs['sort'](_0x3d0ced[_0x1530('0x3d')][_0x1530('0x67')]);_0x2859fd[_0x1530('0x49')]=qs[_0x1530('0x46')](_['pick'](_0x3d0ced[_0x1530('0x3d')],_0x22ef5d[_0x1530('0x46')]));if(_0x3d0ced[_0x1530('0x3d')][_0x1530('0x48')]){_0x2859fd['where']=_[_0x1530('0x4a')](_0x2859fd[_0x1530('0x49')],{'$or':_[_0x1530('0x3c')](_0x2859fd[_0x1530('0x41')],function(_0x48de70){var _0x391952={};_0x391952[_0x48de70]={'$like':'%'+_0x3d0ced[_0x1530('0x3d')][_0x1530('0x48')]+'%'};return _0x391952;})});}_0x2859fd=_[_0x1530('0x4a')]({},_0x2859fd,_0x3d0ced[_0x1530('0x4c')]);return _0x28d607[_0x1530('0x121')](_0x2859fd);}})[_0x1530('0x32')](function(_0x35fd80){if(_0x35fd80){_0x580d76=_0x35fd80[_0x1530('0x43')];if(!_0x3d0ced[_0x1530('0x3d')][_0x1530('0x44')](_0x1530('0x45'))){_0x2859fd[_0x1530('0x2e')]=qs[_0x1530('0x2e')](_0x3d0ced['query'][_0x1530('0x2e')]);_0x2859fd[_0x1530('0x2d')]=qs[_0x1530('0x2d')](_0x3d0ced['query'][_0x1530('0x2d')]);}return _0x28d607[_0x1530('0x121')](_0x2859fd);}})[_0x1530('0x32')](function(_0x130d5f){if(_0x130d5f){return _0x130d5f?{'count':_0x580d76,'rows':_0x130d5f}:null;}})[_0x1530('0x32')](respondWithResult(_0x898092,null))[_0x1530('0x28')](handleError(_0x898092,null));};exports[_0x1530('0x122')]=function(_0x2159ff,_0x1dea55,_0x5b166f){var _0x5ea2ba=_0x2159ff[_0x1530('0x3d')]['online']===_0x1530('0x123')?_0x1530('0x124'):'onlineForm';return db[_0x1530('0x38')]['find']({'attributes':['id',_0x5ea2ba],'where':{'id':_0x2159ff[_0x1530('0x52')]['id']}})[_0x1530('0x32')](handleEntityNotFound(_0x1dea55,null))[_0x1530('0x32')](function(_0x3cc2cb){if(_0x3cc2cb){var _0x397be6=_0x3cc2cb[_0x5ea2ba];var _0x1a51cc=_0x397be6&&_0x397be6[_0x1530('0x125')]?_0x397be6[_0x1530('0x125')]:[];_0x1dea55[_0x1530('0xc9')]({'fromKey':_['isNil'](_0x397be6[_0x1530('0x126')])?undefined:_0x397be6[_0x1530('0x126')],'count':_0x1a51cc['length'],'rows':_0x1a51cc});}})[_0x1530('0x28')](handleError(_0x1dea55,null));};exports[_0x1530('0x127')]=function(_0x334220,_0x567a1e,_0x40dba6){var _0x37432b={'raw':![],'where':{}};var _0x4a554e={};var _0x3e3557={'count':0x0,'rows':[]};return db[_0x1530('0x38')][_0x1530('0x65')]({'where':{'id':_0x334220[_0x1530('0x52')]['id']}})['then'](handleEntityNotFound(_0x567a1e,null))[_0x1530('0x32')](function(_0x121da7){if(_0x121da7){_0x4a554e[_0x1530('0x40')]=_[_0x1530('0x3e')](db[_0x1530('0xd4')]['rawAttributes']);_0x4a554e[_0x1530('0x3d')]=_[_0x1530('0x3e')](_0x334220[_0x1530('0x3d')]);_0x4a554e[_0x1530('0x46')]=_[_0x1530('0x3f')](_0x4a554e[_0x1530('0x40')],_0x4a554e[_0x1530('0x3d')]);_0x37432b[_0x1530('0x41')]=_['intersection'](_0x4a554e[_0x1530('0x40')],qs['fields'](_0x334220[_0x1530('0x3d')][_0x1530('0x42')]));_0x37432b[_0x1530('0x41')]=_0x37432b[_0x1530('0x41')][_0x1530('0x43')]?_0x37432b[_0x1530('0x41')]:_0x4a554e['model'];if(!_0x334220['query'][_0x1530('0x44')](_0x1530('0x45'))){_0x37432b[_0x1530('0x2e')]=qs['limit'](_0x334220['query'][_0x1530('0x2e')]);_0x37432b[_0x1530('0x2d')]=qs['offset'](_0x334220[_0x1530('0x3d')][_0x1530('0x2d')]);}_0x37432b[_0x1530('0x66')]=qs['sort'](_0x334220['query']['sort']);_0x37432b[_0x1530('0x49')]=qs[_0x1530('0x46')](_[_0x1530('0x47')](_0x334220[_0x1530('0x3d')],_0x4a554e['filters']));_0x37432b[_0x1530('0x49')][_0x1530('0x68')]=_0x121da7['id'];if(_0x334220['query'][_0x1530('0x48')]){_0x37432b[_0x1530('0x49')]=_[_0x1530('0x4a')](_0x37432b[_0x1530('0x49')],{'$or':_[_0x1530('0x3c')](_0x37432b['attributes'],function(_0x5d42e5){var _0x2b4c54={};_0x2b4c54[_0x5d42e5]={'$like':'%'+_0x334220[_0x1530('0x3d')][_0x1530('0x48')]+'%'};return _0x2b4c54;})});}_0x37432b=_[_0x1530('0x4a')]({},_0x37432b,_0x334220['options']);return db[_0x1530('0xd4')][_0x1530('0x4d')]({'where':_0x37432b[_0x1530('0x49')]})[_0x1530('0x32')](function(_0x5429db){_0x3e3557['count']=_0x5429db;if(_0x334220[_0x1530('0x3d')][_0x1530('0x4e')]){_0x37432b['include']=[{'all':!![]}];}else{_0x37432b[_0x1530('0x4f')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db[_0x1530('0xd4')]['findAll'](_0x37432b);})[_0x1530('0x32')](function(_0x227f0a){_0x3e3557[_0x1530('0x69')]=_0x227f0a;return _0x3e3557;});}})['then'](respondWithFilteredResult(_0x567a1e,_0x37432b))['catch'](handleError(_0x567a1e,null));};exports['addAgents']=function(_0x5e9359,_0x3f76fe,_0x979b65){return db[_0x1530('0x38')][_0x1530('0x5c')]({'where':{'id':_0x5e9359[_0x1530('0x52')]['id']}})[_0x1530('0x32')](handleEntityNotFound(_0x3f76fe,null))[_0x1530('0x32')](function(_0x2d9ff4){if(_0x2d9ff4){return _0x2d9ff4['addAgents'](_0x5e9359[_0x1530('0x56')][_0x1530('0x6b')],_['omit'](_0x5e9359[_0x1530('0x56')],[_0x1530('0x6b'),'id'])||{})[_0x1530('0xb8')](function(_0x3c3c6d){for(var _0xc7d98d=0x0;_0xc7d98d<_0x5e9359['body'][_0x1530('0x6b')][_0x1530('0x43')];_0xc7d98d+=0x1){socket[_0x1530('0x128')](_0x1530('0x129'),{'UserId':_0x5e9359[_0x1530('0x56')][_0x1530('0x6b')][_0xc7d98d],'ChatWebsiteId':_0x5e9359[_0x1530('0x52')]['id']});}return _0x3c3c6d;});}})[_0x1530('0x32')](respondWithResult(_0x3f76fe,null))[_0x1530('0x28')](handleError(_0x3f76fe,null));};exports[_0x1530('0x12a')]=function(_0x12a662,_0x1cd05b,_0x38a6ee){return db['ChatWebsite']['find']({'where':{'id':_0x12a662[_0x1530('0x52')]['id']}})[_0x1530('0x32')](handleEntityNotFound(_0x1cd05b,null))[_0x1530('0x32')](function(_0x27b362){if(_0x27b362){return _0x27b362['removeAgents'](_0x12a662['query'][_0x1530('0x6b')])[_0x1530('0x32')](function(){if(_[_0x1530('0x12b')](_0x12a662['query'][_0x1530('0x6b')])){for(var _0x5cb12f=0x0;_0x5cb12f<_0x12a662[_0x1530('0x3d')][_0x1530('0x6b')]['length'];_0x5cb12f+=0x1){socket[_0x1530('0x128')](_0x1530('0x12c'),{'UserId':Number(_0x12a662[_0x1530('0x3d')][_0x1530('0x6b')][_0x5cb12f]),'ChatWebsiteId':Number(_0x12a662[_0x1530('0x52')]['id'])});}}else{socket[_0x1530('0x128')](_0x1530('0x12c'),{'UserId':Number(_0x12a662[_0x1530('0x3d')][_0x1530('0x6b')]),'ChatWebsiteId':Number(_0x12a662[_0x1530('0x52')]['id'])});}});}})[_0x1530('0x32')](respondWithStatusCode(_0x1cd05b,null))[_0x1530('0x28')](handleError(_0x1cd05b,null));};exports[_0x1530('0x12d')]=function(_0x5782d6,_0x31beea,_0xddd988){var _0x56e905={};var _0x2519ed={};var _0xdc2346;var _0x884e57;return db[_0x1530('0x38')][_0x1530('0x65')]({'where':{'id':_0x5782d6[_0x1530('0x52')]['id']}})[_0x1530('0x32')](handleEntityNotFound(_0x31beea,null))[_0x1530('0x32')](function(_0x2c8e4f){if(_0x2c8e4f){_0xdc2346=_0x2c8e4f;_0x2519ed[_0x1530('0x40')]=_[_0x1530('0x3e')](db[_0x1530('0xfa')][_0x1530('0x54')]);_0x2519ed[_0x1530('0x3d')]=_['keys'](_0x5782d6[_0x1530('0x3d')]);_0x2519ed[_0x1530('0x46')]=_[_0x1530('0x3f')](_0x2519ed[_0x1530('0x40')],_0x2519ed['query']);_0x56e905[_0x1530('0x41')]=_[_0x1530('0x3f')](_0x2519ed[_0x1530('0x40')],qs[_0x1530('0x42')](_0x5782d6[_0x1530('0x3d')][_0x1530('0x42')]));_0x56e905[_0x1530('0x41')]=_0x56e905[_0x1530('0x41')][_0x1530('0x43')]?_0x56e905[_0x1530('0x41')]:_0x2519ed['model'];_0x56e905[_0x1530('0x66')]=qs[_0x1530('0x67')](_0x5782d6[_0x1530('0x3d')][_0x1530('0x67')]);_0x56e905[_0x1530('0x49')]=qs[_0x1530('0x46')](_[_0x1530('0x47')](_0x5782d6[_0x1530('0x3d')],_0x2519ed['filters']));if(_0x5782d6['query'][_0x1530('0x48')]){_0x56e905['where']=_[_0x1530('0x4a')](_0x56e905[_0x1530('0x49')],{'$or':_['map'](_0x56e905[_0x1530('0x41')],function(_0x647be7){var _0x28c143={};_0x28c143[_0x647be7]={'$like':'%'+_0x5782d6['query']['filter']+'%'};return _0x28c143;})});}_0x56e905=_['merge']({},_0x56e905,_0x5782d6[_0x1530('0x4c')]);return _0xdc2346[_0x1530('0x12d')](_0x56e905);}})[_0x1530('0x32')](function(_0x2929ee){if(_0x2929ee){_0x884e57=_0x2929ee[_0x1530('0x43')];if(!_0x5782d6[_0x1530('0x3d')][_0x1530('0x44')]('nolimit')){_0x56e905[_0x1530('0x2e')]=qs[_0x1530('0x2e')](_0x5782d6[_0x1530('0x3d')]['limit']);_0x56e905[_0x1530('0x2d')]=qs[_0x1530('0x2d')](_0x5782d6[_0x1530('0x3d')][_0x1530('0x2d')]);}return _0xdc2346[_0x1530('0x12d')](_0x56e905);}})['then'](function(_0x5e5f09){if(_0x5e5f09){return _0x5e5f09?{'count':_0x884e57,'rows':_0x5e5f09}:null;}})['then'](respondWithResult(_0x31beea,null))['catch'](handleError(_0x31beea,null));}; \ No newline at end of file +var _0xa8a8=['send','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','type','model','keys','query','filters','intersection','fields','length','attributes','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','body','describe','addDisposition','ChatWebsiteId','Disposition','findOne','rawAttributes','removeDispositions','getAnswers','CannedAnswer','hasOwnProperty','removeAnswers','ids','addLogo','sitepic','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','getLicense','custom','join','getAvatar','agentAvatar','isNil','existsSync','server/files/images/avatars/','download','getCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','getResult','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','account','applications','list','orderBy','priority','asc','contact','headers','cf-connecting-ip','x-forwarded-for','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','server','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','pass','SendMail','sendMail','email','MailAccountId','subjectOffline','mapValues','firstName','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','attachments','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','internal','Tag','Tags','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','inspect','Interval','Intervals','virtual','License','increment','chatLicenseExceeded','push','all','some','readFileSync','server/files/chat/iframe.js','x-real-ip','connection','replace','alignment','color','color_button','addApplications','ChatApplication','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','getFields','online','false','offlineForm','items','Contact','Attachments','addAgents','emit','userChatWebsite:save','isArray','userChatWebsite:remove','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','register','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','count','offset','Content-Range','apply','reject','save','update','destroy','get','ChatWebsites','UserProfileResource','end','stack','name'];(function(_0x4db62f,_0x15a206){var _0xbedd45=function(_0x368276){while(--_0x368276){_0x4db62f['push'](_0x4db62f['shift']());}};_0xbedd45(++_0x15a206);}(_0xa8a8,0xec));var _0x8a8a=function(_0x24351b,_0x217d26){_0x24351b=_0x24351b-0x0;var _0xfe4d80=_0xa8a8[_0x24351b];return _0xfe4d80;};'use strict';var emlformat=require(_0x8a8a('0x0'));var rimraf=require(_0x8a8a('0x1'));var zipdir=require(_0x8a8a('0x2'));var jsonpatch=require(_0x8a8a('0x3'));var rp=require('request-promise');var moment=require(_0x8a8a('0x4'));var BPromise=require(_0x8a8a('0x5'));var Mustache=require(_0x8a8a('0x6'));var util=require(_0x8a8a('0x7'));var path=require(_0x8a8a('0x8'));var sox=require(_0x8a8a('0x9'));var csv=require(_0x8a8a('0xa'));var ejs=require(_0x8a8a('0xb'));var fs=require('fs');var fs_extra=require(_0x8a8a('0xc'));var _=require(_0x8a8a('0xd'));var squel=require(_0x8a8a('0xe'));var crypto=require(_0x8a8a('0xf'));var jsforce=require(_0x8a8a('0x10'));var deskjs=require(_0x8a8a('0x11'));var toCsv=require(_0x8a8a('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8a8a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8a8a('0x13'));var as=require(_0x8a8a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a8a('0x15'))(_0x8a8a('0x16'));var utils=require(_0x8a8a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8a8a('0x18'));var db=require(_0x8a8a('0x19'))['db'];config[_0x8a8a('0x1a')]=_[_0x8a8a('0x1b')](config['redis'],{'host':_0x8a8a('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8a8a('0x1a')]));require(_0x8a8a('0x1d'))[_0x8a8a('0x1e')](socket);var jayson=require(_0x8a8a('0x1f'));var client=jayson[_0x8a8a('0x20')][_0x8a8a('0x21')]({'port':0x232c});var client9002=jayson[_0x8a8a('0x20')]['http']({'port':0x232a});var client9003=jayson[_0x8a8a('0x20')]['http']({'port':0x232b});var client9001=jayson[_0x8a8a('0x20')][_0x8a8a('0x21')]({'port':0x2329});function respondWithRpcPromise(_0x46a4f4,_0x4291e9,_0x42e8b6,_0x5dd616){return new BPromise(function(_0x9d55f9,_0x3d165c){var _0x262ca9=_0x5dd616||client;return _0x262ca9[_0x8a8a('0x22')](_0x46a4f4,_0x42e8b6)[_0x8a8a('0x23')](function(_0x22e611){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x4291e9,'request\x20sent');logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4291e9,_0x8a8a('0x24'),JSON[_0x8a8a('0x25')](_0x22e611));if(_0x22e611[_0x8a8a('0x26')]){if(_0x22e611[_0x8a8a('0x26')][_0x8a8a('0x27')]===0x1f4){logger[_0x8a8a('0x26')](_0x8a8a('0x28'),_0x4291e9,_0x22e611[_0x8a8a('0x26')][_0x8a8a('0x29')]);return _0x3d165c(_0x22e611[_0x8a8a('0x26')][_0x8a8a('0x29')]);}logger[_0x8a8a('0x26')](_0x8a8a('0x28'),_0x4291e9,_0x22e611[_0x8a8a('0x26')][_0x8a8a('0x29')]);return _0x9d55f9(_0x22e611['error'][_0x8a8a('0x29')]);}else{logger[_0x8a8a('0x2a')](_0x8a8a('0x28'),_0x4291e9,_0x8a8a('0x24'));_0x9d55f9(_0x22e611[_0x8a8a('0x2b')][_0x8a8a('0x29')]);}})[_0x8a8a('0x2c')](function(_0x5f4dcc){logger[_0x8a8a('0x26')](_0x8a8a('0x28'),_0x4291e9,_0x5f4dcc);_0x3d165c(_0x5f4dcc);});});}function respondWithStatusCode(_0x2e217a,_0x54ff7e){_0x54ff7e=_0x54ff7e||0xcc;return function(_0x58f42b){if(_0x58f42b){return _0x2e217a[_0x8a8a('0x2d')](_0x54ff7e);}return _0x2e217a[_0x8a8a('0x2e')](_0x54ff7e)['end']();};}function respondWithResult(_0x4d8760,_0x4b3bc5){_0x4b3bc5=_0x4b3bc5||0xc8;return function(_0x78fd48){if(_0x78fd48){return _0x4d8760['status'](_0x4b3bc5)[_0x8a8a('0x2f')](_0x78fd48);}};}function respondWithFilteredResult(_0xdd6221,_0x49ea81){return function(_0x36c7f8){if(_0x36c7f8){var _0x2c8f27=_0x36c7f8[_0x8a8a('0x30')],_0x250852=_0x49ea81[_0x8a8a('0x31')],_0x8df0cb=_0x49ea81[_0x8a8a('0x31')]+_0x49ea81['limit'],_0x41802e;if(_0x8df0cb>=_0x2c8f27){_0x8df0cb=_0x2c8f27;_0x41802e=0xc8;}else{_0x41802e=0xce;}_0xdd6221['status'](_0x41802e);return _0xdd6221['set'](_0x8a8a('0x32'),_0x250852+'-'+_0x8df0cb+'/'+_0x2c8f27)[_0x8a8a('0x2f')](_0x36c7f8);}return null;};}function patchUpdates(_0x5f301e){return function(_0x2b5dc9){try{jsonpatch[_0x8a8a('0x33')](_0x2b5dc9,_0x5f301e,!![]);}catch(_0x481e92){return BPromise[_0x8a8a('0x34')](_0x481e92);}return _0x2b5dc9[_0x8a8a('0x35')]();};}function saveUpdates(_0x63b9be,_0x49e287){return function(_0x5bee53){if(_0x5bee53){return _0x5bee53[_0x8a8a('0x36')](_0x63b9be)['then'](function(_0x2a3198){return _0x2a3198;});}return null;};}function removeEntity(_0x3a4aa6,_0x3ecbca){return function(_0x196698){if(_0x196698){return _0x196698[_0x8a8a('0x37')]()[_0x8a8a('0x23')](function(){var _0x37ce45=_0x196698[_0x8a8a('0x38')]({'plain':!![]});var _0x320398=_0x8a8a('0x39');return db[_0x8a8a('0x3a')][_0x8a8a('0x37')]({'where':{'type':_0x320398,'resourceId':_0x37ce45['id']}})[_0x8a8a('0x23')](function(){return _0x196698;});})[_0x8a8a('0x23')](function(){_0x3a4aa6[_0x8a8a('0x2e')](0xcc)[_0x8a8a('0x3b')]();});}};}function handleEntityNotFound(_0x8e3017,_0x29d187){return function(_0x4c8003){if(!_0x4c8003){_0x8e3017['sendStatus'](0x194);}return _0x4c8003;};}function handleError(_0x53da01,_0x34db33){_0x34db33=_0x34db33||0x1f4;return function(_0x9e0128){logger[_0x8a8a('0x26')](_0x9e0128[_0x8a8a('0x3c')]);if(_0x9e0128[_0x8a8a('0x3d')]){delete _0x9e0128['name'];}_0x53da01['status'](_0x34db33)[_0x8a8a('0x3e')](_0x9e0128);};}exports['index']=function(_0x41a4c4,_0x5c210e){var _0x52811b={'include':[{'model':db[_0x8a8a('0x3f')],'as':_0x8a8a('0x40')}]},_0x1b33eb={},_0x1ac761={'count':0x0,'rows':[]};var _0x31307c=_[_0x8a8a('0x41')](db[_0x8a8a('0x42')]['rawAttributes'],function(_0x40d509){return{'name':_0x40d509[_0x8a8a('0x43')],'type':_0x40d509[_0x8a8a('0x44')]['key']};});_0x1b33eb[_0x8a8a('0x45')]=_[_0x8a8a('0x41')](_0x31307c,_0x8a8a('0x3d'));_0x1b33eb['query']=_[_0x8a8a('0x46')](_0x41a4c4[_0x8a8a('0x47')]);_0x1b33eb[_0x8a8a('0x48')]=_[_0x8a8a('0x49')](_0x1b33eb[_0x8a8a('0x45')],_0x1b33eb[_0x8a8a('0x47')]);_0x52811b['attributes']=_['intersection'](_0x1b33eb[_0x8a8a('0x45')],qs['fields'](_0x41a4c4[_0x8a8a('0x47')][_0x8a8a('0x4a')]));_0x52811b['attributes']=_0x52811b['attributes'][_0x8a8a('0x4b')]?_0x52811b[_0x8a8a('0x4c')]:_0x1b33eb[_0x8a8a('0x45')];if(!_0x41a4c4[_0x8a8a('0x47')]['hasOwnProperty'](_0x8a8a('0x4d'))){_0x52811b['limit']=qs[_0x8a8a('0x4e')](_0x41a4c4[_0x8a8a('0x47')]['limit']);_0x52811b[_0x8a8a('0x31')]=qs[_0x8a8a('0x31')](_0x41a4c4[_0x8a8a('0x47')]['offset']);}_0x52811b[_0x8a8a('0x4f')]=qs[_0x8a8a('0x50')](_0x41a4c4[_0x8a8a('0x47')]['sort']);_0x52811b['where']=qs[_0x8a8a('0x48')](_[_0x8a8a('0x51')](_0x41a4c4[_0x8a8a('0x47')],_0x1b33eb['filters']),_0x31307c);if(_0x41a4c4[_0x8a8a('0x47')][_0x8a8a('0x52')]){_0x52811b[_0x8a8a('0x53')]=_[_0x8a8a('0x54')](_0x52811b[_0x8a8a('0x53')],{'$or':_[_0x8a8a('0x41')](_0x31307c,function(_0x13c233){if(_0x13c233[_0x8a8a('0x44')]!==_0x8a8a('0x55')){var _0x229751={};_0x229751[_0x13c233[_0x8a8a('0x3d')]]={'$like':'%'+_0x41a4c4['query'][_0x8a8a('0x52')]+'%'};return _0x229751;}})});}_0x52811b=_[_0x8a8a('0x54')]({},_0x52811b,_0x41a4c4[_0x8a8a('0x56')]);var _0x386e1c={'where':_0x52811b[_0x8a8a('0x53')]};return db[_0x8a8a('0x42')]['count'](_0x386e1c)[_0x8a8a('0x23')](function(_0x396ffd){_0x1ac761[_0x8a8a('0x30')]=_0x396ffd;if(_0x41a4c4[_0x8a8a('0x47')]['includeAll']){_0x52811b[_0x8a8a('0x57')]=[{'all':!![]}];}return db[_0x8a8a('0x42')][_0x8a8a('0x58')](_0x52811b);})['then'](function(_0x4fa5a9){_0x1ac761[_0x8a8a('0x59')]=_0x4fa5a9;return _0x1ac761;})[_0x8a8a('0x23')](respondWithFilteredResult(_0x5c210e,_0x52811b))[_0x8a8a('0x2c')](handleError(_0x5c210e,null));};exports[_0x8a8a('0x5a')]=function(_0x393a4a,_0x20efe1){var _0x1d1b5c={'raw':![],'where':{'id':_0x393a4a[_0x8a8a('0x5b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x35464a={};_0x35464a[_0x8a8a('0x45')]=_[_0x8a8a('0x46')](db['ChatWebsite']['rawAttributes']);_0x35464a[_0x8a8a('0x47')]=_['keys'](_0x393a4a[_0x8a8a('0x47')]);_0x35464a['filters']=_[_0x8a8a('0x49')](_0x35464a[_0x8a8a('0x45')],_0x35464a[_0x8a8a('0x47')]);_0x1d1b5c[_0x8a8a('0x4c')]=_[_0x8a8a('0x49')](_0x35464a[_0x8a8a('0x45')],qs[_0x8a8a('0x4a')](_0x393a4a[_0x8a8a('0x47')][_0x8a8a('0x4a')]));_0x1d1b5c[_0x8a8a('0x4c')]=_0x1d1b5c['attributes'][_0x8a8a('0x4b')]?_0x1d1b5c[_0x8a8a('0x4c')]:_0x35464a[_0x8a8a('0x45')];if(_0x393a4a[_0x8a8a('0x47')][_0x8a8a('0x5c')]){_0x1d1b5c['include']=[{'all':!![]}];}_0x1d1b5c=_[_0x8a8a('0x54')]({},_0x1d1b5c,_0x393a4a[_0x8a8a('0x56')]);return db['ChatWebsite']['find'](_0x1d1b5c)[_0x8a8a('0x23')](handleEntityNotFound(_0x20efe1,null))[_0x8a8a('0x23')](respondWithResult(_0x20efe1,null))[_0x8a8a('0x2c')](handleError(_0x20efe1,null));};exports[_0x8a8a('0x5d')]=function(_0x265e98,_0x2dc4e8){return db['ChatWebsite']['create'](_0x265e98['body'],{})[_0x8a8a('0x23')](function(_0x54d848){var _0x3984dd=_0x265e98[_0x8a8a('0x5e')]['get']({'plain':!![]});if(!_0x3984dd)throw new Error(_0x8a8a('0x5f'));if(_0x3984dd[_0x8a8a('0x60')]===_0x8a8a('0x5e')){var _0x119fb5=_0x54d848['get']({'plain':!![]});var _0x12e040='ChatWebsites';return db[_0x8a8a('0x61')][_0x8a8a('0x62')]({'where':{'name':_0x12e040,'userProfileId':_0x3984dd['userProfileId']},'raw':!![]})[_0x8a8a('0x23')](function(_0x101543){if(_0x101543&&_0x101543[_0x8a8a('0x63')]===0x0){return db[_0x8a8a('0x3a')]['create']({'name':_0x119fb5[_0x8a8a('0x3d')],'resourceId':_0x119fb5['id'],'type':_0x101543[_0x8a8a('0x3d')],'sectionId':_0x101543['id']},{})[_0x8a8a('0x23')](function(){return _0x54d848;});}else{return _0x54d848;}})['catch'](function(_0x4fe07d){logger[_0x8a8a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fe07d);throw _0x4fe07d;});}return _0x54d848;})['then'](respondWithResult(_0x2dc4e8,0xc9))['catch'](handleError(_0x2dc4e8,null));};exports[_0x8a8a('0x36')]=function(_0x7d79a4,_0x5bdbd3){if(_0x7d79a4[_0x8a8a('0x64')]['id']){delete _0x7d79a4['body']['id'];}return db['ChatWebsite'][_0x8a8a('0x62')]({'where':{'id':_0x7d79a4[_0x8a8a('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0x8a8a('0x40')}]})[_0x8a8a('0x23')](handleEntityNotFound(_0x5bdbd3,null))[_0x8a8a('0x23')](saveUpdates(_0x7d79a4[_0x8a8a('0x64')],null))[_0x8a8a('0x23')](respondWithResult(_0x5bdbd3,null))[_0x8a8a('0x2c')](handleError(_0x5bdbd3,null));};exports['destroy']=function(_0x3ca3d6,_0x402b5f){return db['ChatWebsite'][_0x8a8a('0x62')]({'where':{'id':_0x3ca3d6[_0x8a8a('0x5b')]['id']}})[_0x8a8a('0x23')](handleEntityNotFound(_0x402b5f,null))[_0x8a8a('0x23')](removeEntity(_0x402b5f,null))[_0x8a8a('0x2c')](handleError(_0x402b5f,null));};exports[_0x8a8a('0x65')]=function(_0x81c1dd,_0x34a079){return db[_0x8a8a('0x42')][_0x8a8a('0x65')]()['then'](respondWithResult(_0x34a079,null))[_0x8a8a('0x2c')](handleError(_0x34a079,null));};exports[_0x8a8a('0x66')]=function(_0x521883,_0x334eb3,_0x1f90af){if(_0x521883[_0x8a8a('0x64')]['id']){delete _0x521883[_0x8a8a('0x64')]['id'];}return db[_0x8a8a('0x42')]['find']({'where':{'id':_0x521883[_0x8a8a('0x5b')]['id']}})[_0x8a8a('0x23')](handleEntityNotFound(_0x334eb3,null))[_0x8a8a('0x23')](function(_0x2984eb){if(_0x2984eb){_0x521883[_0x8a8a('0x64')][_0x8a8a('0x67')]=_0x2984eb['id'];return db[_0x8a8a('0x68')]['create'](_0x521883[_0x8a8a('0x64')]);}})[_0x8a8a('0x23')](respondWithResult(_0x334eb3,null))[_0x8a8a('0x2c')](handleError(_0x334eb3,null));};exports['getDispositions']=function(_0x2f5ef0,_0x54c7c1,_0x15b2e7){var _0x27a8bc={'raw':![],'where':{}};var _0x571d8b={};var _0x82b378={'count':0x0,'rows':[]};return db[_0x8a8a('0x42')][_0x8a8a('0x69')]({'where':{'id':_0x2f5ef0[_0x8a8a('0x5b')]['id']}})[_0x8a8a('0x23')](handleEntityNotFound(_0x54c7c1,null))[_0x8a8a('0x23')](function(_0xaac98f){if(_0xaac98f){_0x571d8b[_0x8a8a('0x45')]=_[_0x8a8a('0x46')](db[_0x8a8a('0x68')][_0x8a8a('0x6a')]);_0x571d8b[_0x8a8a('0x47')]=_[_0x8a8a('0x46')](_0x2f5ef0[_0x8a8a('0x47')]);_0x571d8b[_0x8a8a('0x48')]=_[_0x8a8a('0x49')](_0x571d8b[_0x8a8a('0x45')],_0x571d8b[_0x8a8a('0x47')]);_0x27a8bc['attributes']=_[_0x8a8a('0x49')](_0x571d8b['model'],qs[_0x8a8a('0x4a')](_0x2f5ef0[_0x8a8a('0x47')][_0x8a8a('0x4a')]));_0x27a8bc['attributes']=_0x27a8bc['attributes'][_0x8a8a('0x4b')]?_0x27a8bc[_0x8a8a('0x4c')]:_0x571d8b[_0x8a8a('0x45')];if(!_0x2f5ef0['query']['hasOwnProperty'](_0x8a8a('0x4d'))){_0x27a8bc[_0x8a8a('0x4e')]=qs[_0x8a8a('0x4e')](_0x2f5ef0[_0x8a8a('0x47')][_0x8a8a('0x4e')]);_0x27a8bc[_0x8a8a('0x31')]=qs[_0x8a8a('0x31')](_0x2f5ef0[_0x8a8a('0x47')]['offset']);}_0x27a8bc[_0x8a8a('0x4f')]=qs[_0x8a8a('0x50')](_0x2f5ef0['query'][_0x8a8a('0x50')]);_0x27a8bc[_0x8a8a('0x53')]=qs[_0x8a8a('0x48')](_[_0x8a8a('0x51')](_0x2f5ef0[_0x8a8a('0x47')],_0x571d8b[_0x8a8a('0x48')]));_0x27a8bc['where'][_0x8a8a('0x67')]=_0xaac98f['id'];if(_0x2f5ef0[_0x8a8a('0x47')][_0x8a8a('0x52')]){_0x27a8bc[_0x8a8a('0x53')]=_[_0x8a8a('0x54')](_0x27a8bc['where'],{'$or':_[_0x8a8a('0x41')](_0x27a8bc[_0x8a8a('0x4c')],function(_0x34d140){var _0x3d9511={};_0x3d9511[_0x34d140]={'$like':'%'+_0x2f5ef0[_0x8a8a('0x47')][_0x8a8a('0x52')]+'%'};return _0x3d9511;})});}_0x27a8bc=_[_0x8a8a('0x54')]({},_0x27a8bc,_0x2f5ef0[_0x8a8a('0x56')]);return db[_0x8a8a('0x68')][_0x8a8a('0x30')]({'where':_0x27a8bc['where']})[_0x8a8a('0x23')](function(_0x20b40e){_0x82b378[_0x8a8a('0x30')]=_0x20b40e;if(_0x2f5ef0[_0x8a8a('0x47')][_0x8a8a('0x5c')]){_0x27a8bc['include']=[{'all':!![]}];}return db['Disposition'][_0x8a8a('0x58')](_0x27a8bc);})[_0x8a8a('0x23')](function(_0x3d63be){_0x82b378['rows']=_0x3d63be;return _0x82b378;});}})[_0x8a8a('0x23')](respondWithFilteredResult(_0x54c7c1,_0x27a8bc))[_0x8a8a('0x2c')](handleError(_0x54c7c1,null));};exports[_0x8a8a('0x6b')]=function(_0x7e73d1,_0x5675ec,_0x13504b){return db[_0x8a8a('0x42')][_0x8a8a('0x62')]({'where':{'id':_0x7e73d1['params']['id']}})['then'](handleEntityNotFound(_0x5675ec,null))['then'](function(_0x350183){if(_0x350183){return _0x350183['removeDispositions'](_0x7e73d1[_0x8a8a('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x5675ec,null))[_0x8a8a('0x2c')](handleError(_0x5675ec,null));};exports['addAnswer']=function(_0x554bd8,_0x47cc51,_0x4463c2){if(_0x554bd8['body']['id']){delete _0x554bd8['body']['id'];}return db[_0x8a8a('0x42')]['find']({'where':{'id':_0x554bd8[_0x8a8a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x47cc51,null))[_0x8a8a('0x23')](function(_0x27c4ba){if(_0x27c4ba){_0x554bd8[_0x8a8a('0x64')][_0x8a8a('0x67')]=_0x27c4ba['id'];return db['CannedAnswer'][_0x8a8a('0x5d')](_0x554bd8[_0x8a8a('0x64')]);}})['then'](respondWithResult(_0x47cc51,null))[_0x8a8a('0x2c')](handleError(_0x47cc51,null));};exports[_0x8a8a('0x6c')]=function(_0x913e4c,_0x468669,_0x50a275){var _0x4ef4b8={'raw':![],'where':{}};var _0x1fd850={};var _0x1ee082={'count':0x0,'rows':[]};return db[_0x8a8a('0x42')]['findOne']({'where':{'id':_0x913e4c[_0x8a8a('0x5b')]['id']}})[_0x8a8a('0x23')](handleEntityNotFound(_0x468669,null))[_0x8a8a('0x23')](function(_0x4acabe){if(_0x4acabe){_0x1fd850[_0x8a8a('0x45')]=_[_0x8a8a('0x46')](db[_0x8a8a('0x6d')][_0x8a8a('0x6a')]);_0x1fd850[_0x8a8a('0x47')]=_['keys'](_0x913e4c[_0x8a8a('0x47')]);_0x1fd850[_0x8a8a('0x48')]=_[_0x8a8a('0x49')](_0x1fd850[_0x8a8a('0x45')],_0x1fd850[_0x8a8a('0x47')]);_0x4ef4b8[_0x8a8a('0x4c')]=_[_0x8a8a('0x49')](_0x1fd850['model'],qs['fields'](_0x913e4c[_0x8a8a('0x47')][_0x8a8a('0x4a')]));_0x4ef4b8[_0x8a8a('0x4c')]=_0x4ef4b8['attributes'][_0x8a8a('0x4b')]?_0x4ef4b8[_0x8a8a('0x4c')]:_0x1fd850[_0x8a8a('0x45')];if(!_0x913e4c[_0x8a8a('0x47')][_0x8a8a('0x6e')](_0x8a8a('0x4d'))){_0x4ef4b8[_0x8a8a('0x4e')]=qs[_0x8a8a('0x4e')](_0x913e4c[_0x8a8a('0x47')][_0x8a8a('0x4e')]);_0x4ef4b8['offset']=qs[_0x8a8a('0x31')](_0x913e4c[_0x8a8a('0x47')][_0x8a8a('0x31')]);}_0x4ef4b8['order']=qs[_0x8a8a('0x50')](_0x913e4c[_0x8a8a('0x47')][_0x8a8a('0x50')]);_0x4ef4b8['where']=qs['filters'](_[_0x8a8a('0x51')](_0x913e4c[_0x8a8a('0x47')],_0x1fd850[_0x8a8a('0x48')]));_0x4ef4b8[_0x8a8a('0x53')]['ChatWebsiteId']=_0x4acabe['id'];if(_0x913e4c[_0x8a8a('0x47')][_0x8a8a('0x52')]){_0x4ef4b8[_0x8a8a('0x53')]=_[_0x8a8a('0x54')](_0x4ef4b8['where'],{'$or':_['map'](_0x4ef4b8[_0x8a8a('0x4c')],function(_0x300948){var _0x87ebeb={};_0x87ebeb[_0x300948]={'$like':'%'+_0x913e4c['query'][_0x8a8a('0x52')]+'%'};return _0x87ebeb;})});}_0x4ef4b8=_[_0x8a8a('0x54')]({},_0x4ef4b8,_0x913e4c[_0x8a8a('0x56')]);return db[_0x8a8a('0x6d')][_0x8a8a('0x30')]({'where':_0x4ef4b8['where']})[_0x8a8a('0x23')](function(_0x5d727e){_0x1ee082[_0x8a8a('0x30')]=_0x5d727e;if(_0x913e4c[_0x8a8a('0x47')][_0x8a8a('0x5c')]){_0x4ef4b8[_0x8a8a('0x57')]=[{'all':!![]}];}return db[_0x8a8a('0x6d')][_0x8a8a('0x58')](_0x4ef4b8);})['then'](function(_0x1ec034){_0x1ee082[_0x8a8a('0x59')]=_0x1ec034;return _0x1ee082;});}})['then'](respondWithFilteredResult(_0x468669,_0x4ef4b8))['catch'](handleError(_0x468669,null));};exports[_0x8a8a('0x6f')]=function(_0x15eb58,_0x526ccd,_0x41748f){return db['ChatWebsite']['find']({'where':{'id':_0x15eb58[_0x8a8a('0x5b')]['id']}})[_0x8a8a('0x23')](handleEntityNotFound(_0x526ccd,null))[_0x8a8a('0x23')](function(_0x4a8702){if(_0x4a8702){return _0x4a8702[_0x8a8a('0x6f')](_0x15eb58[_0x8a8a('0x47')][_0x8a8a('0x70')]);}})[_0x8a8a('0x23')](respondWithStatusCode(_0x526ccd,null))[_0x8a8a('0x2c')](handleError(_0x526ccd,null));};exports[_0x8a8a('0x71')]=function(_0x5e0c7e,_0x595809,_0x482cce){_0x5e0c7e[_0x8a8a('0x64')][_0x8a8a('0x72')]=_0x5e0c7e[_0x8a8a('0x73')][_0x8a8a('0x74')];return db[_0x8a8a('0x42')][_0x8a8a('0x62')]({'where':{'id':_0x5e0c7e[_0x8a8a('0x5b')]['id']}})[_0x8a8a('0x23')](handleEntityNotFound(_0x595809,null))[_0x8a8a('0x23')](saveUpdates(_0x5e0c7e['body'],null))[_0x8a8a('0x23')](respondWithResult(_0x595809,null))[_0x8a8a('0x2c')](handleError(_0x595809,null));};exports[_0x8a8a('0x75')]=function(_0x6c6aae,_0x40b73c,_0xce1136){_0x6c6aae['body']['agentAvatar']=_0x6c6aae['file'][_0x8a8a('0x74')];return db['ChatWebsite'][_0x8a8a('0x62')]({'where':{'id':_0x6c6aae['params']['id']}})[_0x8a8a('0x23')](handleEntityNotFound(_0x40b73c,null))['then'](saveUpdates(_0x6c6aae[_0x8a8a('0x64')],null))[_0x8a8a('0x23')](respondWithResult(_0x40b73c,null))['catch'](handleError(_0x40b73c,null));};exports[_0x8a8a('0x76')]=function(_0x4a53d4,_0x48c4a8,_0xf071aa){_0x4a53d4['body'][_0x8a8a('0x77')]=_0x4a53d4['file'][_0x8a8a('0x74')];return db['ChatWebsite'][_0x8a8a('0x62')]({'where':{'id':_0x4a53d4[_0x8a8a('0x5b')]['id']}})[_0x8a8a('0x23')](handleEntityNotFound(_0x48c4a8,null))[_0x8a8a('0x23')](saveUpdates(_0x4a53d4['body'],null))[_0x8a8a('0x23')](respondWithResult(_0x48c4a8,null))[_0x8a8a('0x2c')](handleError(_0x48c4a8,null));};exports[_0x8a8a('0x78')]=function(_0x33ac80,_0x515328,_0x19804c){_0x33ac80[_0x8a8a('0x64')][_0x8a8a('0x79')]=_0x33ac80['file'][_0x8a8a('0x74')];return db[_0x8a8a('0x42')][_0x8a8a('0x62')]({'where':{'id':_0x33ac80[_0x8a8a('0x5b')]['id']}})[_0x8a8a('0x23')](handleEntityNotFound(_0x515328,null))['then'](saveUpdates(_0x33ac80['body'],null))[_0x8a8a('0x23')](respondWithResult(_0x515328,null))[_0x8a8a('0x2c')](handleError(_0x515328,null));};exports[_0x8a8a('0x7a')]=function(_0x4a3a13,_0x5a0a1,_0x122f4f){var _0x559f13=path['join'](config[_0x8a8a('0x7b')],_0x8a8a('0x7c'));var _0x144e48={'where':{'id':_0x4a3a13['params']['id']},'attributes':['id',_0x8a8a('0x72')],'raw':!![]};var _0x2f3aa6=![];return require('../../config/license/util')[_0x8a8a('0x7d')]()[_0x8a8a('0x23')](function(_0x5ab942){if(_0x5ab942){_0x2f3aa6=_0x5ab942[_0x8a8a('0x7e')];}})['then'](function(){return db[_0x8a8a('0x42')][_0x8a8a('0x62')](_0x144e48);})['then'](handleEntityNotFound(_0x5a0a1,null))[_0x8a8a('0x23')](function(_0x35cf74){if(_0x35cf74){if(!_['isNil'](_0x35cf74[_0x8a8a('0x72')])){if(fs['existsSync'](path[_0x8a8a('0x7f')](config[_0x8a8a('0x7b')],'server/files/images/logos/',_0x35cf74[_0x8a8a('0x72')]))&&_0x2f3aa6){_0x559f13=path[_0x8a8a('0x7f')](config[_0x8a8a('0x7b')],'server/files/images/logos/',_0x35cf74[_0x8a8a('0x72')]);}}return _0x5a0a1['download'](_0x559f13);}})[_0x8a8a('0x2c')](handleError(_0x5a0a1,null));};exports[_0x8a8a('0x80')]=function(_0x3197a7,_0x409210,_0x122b8d){var _0x54ad37=path[_0x8a8a('0x7f')](config[_0x8a8a('0x7b')],'server/files/images/avatars/default_avatar.png');var _0x31f30a={'where':{'id':_0x3197a7[_0x8a8a('0x5b')]['id']},'attributes':['id',_0x8a8a('0x81')],'raw':!![]};return db['ChatWebsite']['find'](_0x31f30a)[_0x8a8a('0x23')](handleEntityNotFound(_0x409210,null))[_0x8a8a('0x23')](function(_0x279002){if(_0x279002){if(!_[_0x8a8a('0x82')](_0x279002[_0x8a8a('0x81')])){if(fs[_0x8a8a('0x83')](path[_0x8a8a('0x7f')](config['root'],'server/files/images/avatars/',_0x279002['agentAvatar']))){_0x54ad37=path[_0x8a8a('0x7f')](config[_0x8a8a('0x7b')],_0x8a8a('0x84'),_0x279002['agentAvatar']);}}return _0x409210[_0x8a8a('0x85')](_0x54ad37);}})[_0x8a8a('0x2c')](handleError(_0x409210,null));};exports[_0x8a8a('0x86')]=function(_0x19c264,_0x3154ee,_0x545699){var _0x14bcab=path[_0x8a8a('0x7f')](config[_0x8a8a('0x7b')],'server/files/images/avatars/customer_avatar.png');var _0x913a2f={'where':{'id':_0x19c264[_0x8a8a('0x5b')]['id']},'attributes':['id',_0x8a8a('0x77'),'showCustomerAvatar'],'raw':!![]};return db['ChatWebsite'][_0x8a8a('0x62')](_0x913a2f)[_0x8a8a('0x23')](handleEntityNotFound(_0x3154ee,null))[_0x8a8a('0x23')](function(_0x59a37a){if(_0x59a37a){if(!_[_0x8a8a('0x82')](_0x59a37a[_0x8a8a('0x77')])){if(fs['existsSync'](path[_0x8a8a('0x7f')](config[_0x8a8a('0x7b')],'server/files/images/avatars/',_0x59a37a[_0x8a8a('0x77')]))&&_0x59a37a['showCustomerAvatar']){_0x14bcab=path['join'](config[_0x8a8a('0x7b')],_0x8a8a('0x84'),_0x59a37a['customerAvatar']);}}return _0x3154ee['download'](_0x14bcab);}})['catch'](handleError(_0x3154ee,null));};exports[_0x8a8a('0x87')]=function(_0x55bec7,_0x57a937,_0xc0fb22){var _0x69e16=path['join'](config[_0x8a8a('0x7b')],_0x8a8a('0x88'));var _0x1c2ff0={'where':{'id':_0x55bec7[_0x8a8a('0x5b')]['id']},'attributes':['id',_0x8a8a('0x79')],'raw':!![]};return db['ChatWebsite'][_0x8a8a('0x62')](_0x1c2ff0)['then'](handleEntityNotFound(_0x57a937,null))[_0x8a8a('0x23')](function(_0x9fa66d){if(_0x9fa66d){if(!_[_0x8a8a('0x82')](_0x9fa66d[_0x8a8a('0x79')])){if(fs['existsSync'](path['join'](config[_0x8a8a('0x7b')],_0x8a8a('0x84'),_0x9fa66d['systemAvatar']))){_0x69e16=path[_0x8a8a('0x7f')](config[_0x8a8a('0x7b')],'server/files/images/avatars/',_0x9fa66d[_0x8a8a('0x79')]);}}return _0x57a937[_0x8a8a('0x85')](_0x69e16);}})[_0x8a8a('0x2c')](handleError(_0x57a937,null));};exports['notify']=function(_0x5544fa,_0x83f17d,_0x4d9d70){var _0x46aff7=require('user-agent-parser');var _0xca927d=new _0x46aff7();var _0x545e06=_0xca927d['setUA'](_0x5544fa['headers']['user-agent'])[_0x8a8a('0x89')]();var _0xe65a6d={'body':_0x5544fa[_0x8a8a('0x64')],'channel':'chat'};var _0x32eb6b=[];var _0x16b941=[];var _0x128bb3={};var _0x2a8177=![];return db[_0x8a8a('0x8a')][_0x8a8a('0x65')]()[_0x8a8a('0x23')](function(_0x586686){if(!_0x586686){throw new db['Sequelize'][(_0x8a8a('0x8b'))](_0x8a8a('0x8c'));}_0x32eb6b=_[_0x8a8a('0x8d')](_['keys'](_0x586686),[_0x8a8a('0x8e'),_0x8a8a('0x8f')]);_0x16b941=_[_0x8a8a('0x8d')](_[_0x8a8a('0x46')](_0x586686),['createdAt','updatedAt',_0x8a8a('0x90'),_0x8a8a('0x91')]);if(_0x5544fa[_0x8a8a('0x64')]['id']){delete _0x5544fa[_0x8a8a('0x64')]['id'];}if(_[_0x8a8a('0x82')](_0x5544fa[_0x8a8a('0x64')][_0x8a8a('0x92')])){throw new db[(_0x8a8a('0x93'))][(_0x8a8a('0x8b'))](_0x8a8a('0x94'));}if(_[_0x8a8a('0x82')](_0x5544fa['body'][_0x8a8a('0x64')])||_0x5544fa[_0x8a8a('0x64')][_0x8a8a('0x64')]===''){throw new db[(_0x8a8a('0x93'))][(_0x8a8a('0x8b'))](_0x8a8a('0x95'));}if(_[_0x8a8a('0x82')](_0x5544fa[_0x8a8a('0x64')][_0x8a8a('0x96')])){throw new db[(_0x8a8a('0x93'))][(_0x8a8a('0x8b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x16b941);}if(!_[_0x8a8a('0x97')](_0x16b941,_0x5544fa[_0x8a8a('0x64')][_0x8a8a('0x96')])){throw new db[(_0x8a8a('0x93'))]['ValidationError'](_0x8a8a('0x98')+_0x16b941);}_0x128bb3[_0x5544fa[_0x8a8a('0x64')][_0x8a8a('0x96')]]=_0x5544fa[_0x8a8a('0x64')][_0x8a8a('0x92')];})[_0x8a8a('0x23')](function(){return db['ChatWebsite'][_0x8a8a('0x62')]({'where':{'id':_0x5544fa[_0x8a8a('0x5b')]['id']},'include':[{'model':db[_0x8a8a('0x99')],'as':_0x8a8a('0x9a'),'include':[{'model':db[_0x8a8a('0x8a')],'as':_0x8a8a('0x9b'),'where':_0x128bb3,'limit':0x1,'order':[[_0x8a8a('0x8f'),_0x8a8a('0x9c')]]}]},{'model':db['ChatApplication'],'as':_0x8a8a('0x9d')}]});})[_0x8a8a('0x23')](handleEntityNotFound(_0x83f17d,null))[_0x8a8a('0x23')](function(_0x60df5e){if(_0x60df5e&&_0x60df5e[_0x8a8a('0x9a')]){_0xe65a6d[_0x8a8a('0x9e')]=_0x60df5e;_0xe65a6d[_0x8a8a('0x9f')]=_0x60df5e[_0x8a8a('0x9d')];_0xe65a6d[_0x8a8a('0xa0')]=_0x60df5e['List'];_0xe65a6d[_0x8a8a('0x9f')]=_[_0x8a8a('0xa1')](_0xe65a6d[_0x8a8a('0x9f')],[_0x8a8a('0xa2')],[_0x8a8a('0xa3')]);if(_0xe65a6d['account'][_0x8a8a('0x9d')]){delete _0xe65a6d[_0x8a8a('0x9e')][_0x8a8a('0x9d')];}if(_0xe65a6d[_0x8a8a('0x9e')][_0x8a8a('0x9a')]&&_0xe65a6d['account']['List']['Contacts'][_0x8a8a('0x4b')]){return _0xe65a6d[_0x8a8a('0x9e')][_0x8a8a('0x9a')][_0x8a8a('0x9b')][0x0];}var _0x3bf9a3=_[_0x8a8a('0x1b')](_0x5544fa['body'],{'firstName':_0x5544fa[_0x8a8a('0x64')][_0x8a8a('0x92')],'ListId':_0x60df5e[_0x8a8a('0x91')]});_0x3bf9a3[_0x5544fa['body'][_0x8a8a('0x96')]]=_0x5544fa[_0x8a8a('0x64')][_0x8a8a('0x92')];return db['CmContact'][_0x8a8a('0x5d')](_0x3bf9a3,{'fields':_0x32eb6b,'raw':!![]});}})[_0x8a8a('0x23')](handleEntityNotFound(_0x83f17d,null))['then'](function(_0x4f1f13){_0xe65a6d[_0x8a8a('0xa4')]=_0x4f1f13;var _0x5887fe=_0x5544fa['body']['customerIp'];if(_0x5544fa[_0x8a8a('0xa5')][_0x8a8a('0xa6')]){_0x5887fe=_0x5544fa[_0x8a8a('0xa5')][_0x8a8a('0xa6')];}else if(_0x5544fa['headers'][_0x8a8a('0xa7')]){_0x5887fe=_['first'](_0x5544fa[_0x8a8a('0xa5')][_0x8a8a('0xa7')]['split'](','));}if(_0x4f1f13){var _0x423270={'ContactId':_0x4f1f13['id'],'ChatWebsiteId':_0x5544fa[_0x8a8a('0x5b')]['id'],'from':(_0x4f1f13['firstName']||'')+'\x20'+(_0x4f1f13[_0x8a8a('0xa8')]||''),'customerIp':_0x5887fe,'customerPort':_0x5544fa[_0x8a8a('0xa5')]['x-real-port']?_0x5544fa[_0x8a8a('0xa5')][_0x8a8a('0xa9')]:null,'referer':_0x5544fa[_0x8a8a('0x64')][_0x8a8a('0xaa')],'browserName':_0x545e06[_0x8a8a('0xab')]['name']&&_0x545e06['browser'][_0x8a8a('0xac')]?util[_0x8a8a('0xad')]('%s\x20%s',_0x545e06[_0x8a8a('0xab')][_0x8a8a('0x3d')],_0x545e06[_0x8a8a('0xab')][_0x8a8a('0xac')]):_0x8a8a('0xae'),'browserVersion':_0x545e06[_0x8a8a('0xab')][_0x8a8a('0xac')]||_0x8a8a('0xae'),'osName':util[_0x8a8a('0xad')](_0x8a8a('0xaf'),_0x545e06['os'][_0x8a8a('0x3d')],_0x545e06['os'][_0x8a8a('0xac')]),'osVersion':_0x545e06['os'][_0x8a8a('0xac')],'deviceModel':_0x545e06['device'][_0x8a8a('0x45')]&&_0x545e06[_0x8a8a('0xb0')][_0x8a8a('0xb1')]?util['format'](_0x8a8a('0xb2'),_0x545e06[_0x8a8a('0xb0')][_0x8a8a('0x45')],_0x545e06[_0x8a8a('0xb0')][_0x8a8a('0xb1')],_0x545e06[_0x8a8a('0xb0')][_0x8a8a('0x44')]):null,'deviceVendor':_0x545e06[_0x8a8a('0xb0')][_0x8a8a('0xb1')],'deviceType':_0x545e06[_0x8a8a('0xb0')][_0x8a8a('0x44')],'formData':JSON['stringify'](_0x5544fa[_0x8a8a('0x64')])};var _0x35d518={'ChatWebsiteId':_0x5544fa[_0x8a8a('0x5b')]['id'],'closed':![]};if(_0x5544fa[_0x8a8a('0x64')][_0x8a8a('0xb3')]){_0x35d518[_0x8a8a('0xb3')]=_0x5544fa[_0x8a8a('0x64')]['threadId'];return db[_0x8a8a('0xb4')][_0x8a8a('0x62')]({'where':_0x35d518})['then'](function(_0x2a9c1d){if(_0x2a9c1d){return[_0x2a9c1d,![]];}_0x423270['threadId']=_0x5544fa[_0x8a8a('0x64')][_0x8a8a('0xb3')];_0x423270['externalUrl']=_0x5544fa[_0x8a8a('0x64')][_0x8a8a('0xb5')];return db['ChatInteraction'][_0x8a8a('0x5d')](_0x423270)[_0x8a8a('0x23')](function(_0x536fdd){return[_0x536fdd,!![]];});});}_0x35d518[_0x8a8a('0xb6')]=_0x4f1f13['id'];if(_0x5544fa['body'][_0x8a8a('0xb7')]&&_0x5544fa[_0x8a8a('0x64')][_0x8a8a('0xb7')]['id']){_0x35d518['id']=_0x5544fa['body']['interaction']['id'];return db[_0x8a8a('0xb4')]['find']({'where':_0x35d518})[_0x8a8a('0x23')](function(_0x5c904c){if(_0x5c904c){return[_0x5c904c,![]];}return db['ChatInteraction'][_0x8a8a('0x5d')](_0x423270)['then'](function(_0x4a837b){return[_0x4a837b,!![]];});});}return db[_0x8a8a('0xb4')][_0x8a8a('0x5d')](_0x423270)[_0x8a8a('0x23')](function(_0x477825){return[_0x477825,!![]];});}})[_0x8a8a('0xb8')](function(_0x4cb1da,_0x3d757a){if(_0x4cb1da){_0x2a8177=_0x3d757a;if(!_0x3d757a){var _0x1d8381={'from':(_0xe65a6d[_0x8a8a('0xa4')]['firstName']||'')+'\x20'+(_0xe65a6d[_0x8a8a('0xa4')]['lastName']||'')};if(_0x5544fa['body']['threadId']&&_0x5544fa[_0x8a8a('0x64')]['messageId']&&_0x5544fa['body']['threadId']!=_0x5544fa[_0x8a8a('0x64')][_0x8a8a('0xb9')]){_0x1d8381[_0x8a8a('0xb3')]=_0x5544fa[_0x8a8a('0x64')]['messageId'];}return _0x4cb1da[_0x8a8a('0x36')](_0x1d8381);}else{return _0x4cb1da;}}})[_0x8a8a('0x23')](function(_0x45e383){_0xe65a6d['interaction']=_0x45e383[_0x8a8a('0x38')]({'plain':!![]});_0xe65a6d['interaction']['created']=_0x2a8177;if(_0xe65a6d[_0x8a8a('0xb7')][_0x8a8a('0xba')]){if(_0xe65a6d[_0x8a8a('0x9e')][_0x8a8a('0xbb')]){_0xe65a6d[_0x8a8a('0x9f')]['push']({'id':0x0,'priority':_0xe65a6d[_0x8a8a('0x9f')][_0x8a8a('0x4b')]+0x1,'app':_0x8a8a('0xbc'),'appdata':_0x8a8a('0xbd'),'interval':_0x8a8a('0xbe')});}}return db[_0x8a8a('0xbf')][_0x8a8a('0x5d')]({'body':_0x5544fa[_0x8a8a('0x64')][_0x8a8a('0x64')],'ChatWebsiteId':_0x5544fa['params']['id'],'ChatInteractionId':_0x45e383['id'],'direction':'in','ContactId':_0xe65a6d[_0x8a8a('0xa4')]['id'],'AttachmentId':_0x5544fa['body'][_0x8a8a('0xc0')]});})[_0x8a8a('0x23')](function(_0x52dac4){_0xe65a6d['message']=_0x52dac4;if(_0xe65a6d[_0x8a8a('0xb7')][_0x8a8a('0xc1')]){return db[_0x8a8a('0xc2')][_0x8a8a('0x62')]({'attributes':['id',_0x8a8a('0x3d')],'where':{'id':_0xe65a6d[_0x8a8a('0xb7')][_0x8a8a('0xc1')]}})[_0x8a8a('0x23')](function(_0x12fa35){if(_0x12fa35){_0xe65a6d[_0x8a8a('0x9f')][_0x8a8a('0xc3')]({'id':0x0,'priority':0x0,'app':_0x8a8a('0xc4'),'appdata':_0x12fa35[_0x8a8a('0x3d')]+','+(_0xe65a6d['account'][_0x8a8a('0xc5')]||0xa),'interval':_0x8a8a('0xbe')});_0xe65a6d[_0x8a8a('0xc6')]=!![];}return respondWithRpcPromise(_0x8a8a('0xc7'),_0x8a8a('0xc8'),_0xe65a6d);});}return respondWithRpcPromise(_0x8a8a('0xc7'),_0x8a8a('0xc8'),_0xe65a6d);})[_0x8a8a('0x23')](function(_0x120aa7){respondWithRpcPromise(_0x8a8a('0xc9'),_0x8a8a('0xc9'),{'event':_0x8a8a('0xca'),'message':_0x120aa7},client9002);return _0x120aa7;})[_0x8a8a('0x23')](respondWithResult(_0x83f17d,null))[_0x8a8a('0x2c')](handleError(_0x83f17d,null));};exports[_0x8a8a('0xcb')]=function(_0x19e4e7,_0x3a97c8,_0x3408e9){var _0x29e08e,_0x183423,_0x206b39;var _0x3e60fa=[];var _0x3dbe8b=[];var _0x433051={};var _0x3f064c=_0x19e4e7[_0x8a8a('0xcc')]||[];var _0x32374c=[];var _0x12ecd7;return db[_0x8a8a('0x8a')][_0x8a8a('0x65')]()[_0x8a8a('0x23')](function(_0x500ad7){if(!_0x500ad7){throw new db['Sequelize'][(_0x8a8a('0x8b'))]('no\x20available\x20attributes');}_0x3dbe8b=_[_0x8a8a('0x8d')](_[_0x8a8a('0x46')](_0x500ad7),[_0x8a8a('0x8e'),_0x8a8a('0x8f')]);_0x3e60fa=_['difference'](_[_0x8a8a('0x46')](_0x500ad7),[_0x8a8a('0x8e'),_0x8a8a('0x8f'),_0x8a8a('0x90'),_0x8a8a('0x91')]);if(_0x19e4e7[_0x8a8a('0x64')]['id']){delete _0x19e4e7[_0x8a8a('0x64')]['id'];}if(_[_0x8a8a('0x82')](_0x19e4e7[_0x8a8a('0x64')][_0x8a8a('0x92')])){throw _0x3a97c8[_0x8a8a('0x2e')](0x1f4)['send'](new db[(_0x8a8a('0x93'))][(_0x8a8a('0x8b'))](_0x8a8a('0x94')));}if(_[_0x8a8a('0x82')](_0x19e4e7[_0x8a8a('0x64')][_0x8a8a('0x64')])||_0x19e4e7[_0x8a8a('0x64')][_0x8a8a('0x64')]===''){throw _0x3a97c8[_0x8a8a('0x2e')](0x1f4)[_0x8a8a('0x3e')](new db[(_0x8a8a('0x93'))]['ValidationError'](_0x8a8a('0x95')));}if(_[_0x8a8a('0x82')](_0x19e4e7[_0x8a8a('0x64')][_0x8a8a('0xcd')])){throw _0x3a97c8[_0x8a8a('0x2e')](0x1f4)['send'](new db['Sequelize'][(_0x8a8a('0x8b'))](_0x8a8a('0xce')+_0x3e60fa));}if(!_[_0x8a8a('0x97')](_0x3e60fa,_0x19e4e7[_0x8a8a('0x64')][_0x8a8a('0xcd')])){throw _0x3a97c8['status'](0x1f4)[_0x8a8a('0x3e')](new db[(_0x8a8a('0x93'))][(_0x8a8a('0x8b'))](_0x8a8a('0xcf')+_0x3e60fa));}_0x433051[_0x19e4e7[_0x8a8a('0x64')][_0x8a8a('0xcd')]]=_0x19e4e7[_0x8a8a('0x64')]['from'];})[_0x8a8a('0x23')](function(){return db[_0x8a8a('0x42')][_0x8a8a('0x62')]({'where':{'id':_0x19e4e7[_0x8a8a('0x5b')]['id']},'include':[{'model':db[_0x8a8a('0x99')],'as':_0x8a8a('0x9a')},{'model':db[_0x8a8a('0xd0')],'as':_0x8a8a('0xd0')}]});})[_0x8a8a('0x23')](handleEntityNotFound(_0x3a97c8,null))[_0x8a8a('0x23')](function(_0x4596c9){if(_0x4596c9&&_0x4596c9['List']){_0x183423=_0x4596c9;var _0x461c49=_[_0x8a8a('0x1b')](_0x19e4e7[_0x8a8a('0x64')],{'firstName':_0x19e4e7[_0x8a8a('0x64')][_0x8a8a('0x92')],'phone':_0x19e4e7['body']['from'],'ListId':_0x4596c9[_0x8a8a('0x91')]});_0x461c49[_0x19e4e7[_0x8a8a('0x64')]['mapKeyOffline']]=_0x19e4e7[_0x8a8a('0x64')][_0x8a8a('0x92')];return db['CmContact'][_0x8a8a('0xd1')]({'where':_0x433051,'defaults':_0x461c49});}})[_0x8a8a('0xb8')](function(_0x460f8c){if(_0x460f8c){_0x206b39=_0x460f8c;var _0x17d76c=fs['readFileSync'](path[_0x8a8a('0x7f')](config[_0x8a8a('0x7b')],_0x8a8a('0xd2')),_0x8a8a('0xd3'));var _0x4fc860=ejs[_0x8a8a('0xd4')](_0x17d76c,{'body':_[_0x8a8a('0xd5')](_0x19e4e7['body'][_0x8a8a('0x64')]),'bodyTitle':_0x183423[_0x8a8a('0xd6')]});return db[_0x8a8a('0xd7')][_0x8a8a('0x5d')]({'body':_0x4fc860,'ContactId':_0x460f8c['id'],'ChatWebsiteId':_0x183423['id']});}})[_0x8a8a('0x23')](function(_0x93fd84){_0x12ecd7=_0x93fd84;if(_0x3f064c[_0x8a8a('0x4b')]){var _0x2c8a9a=_0x3f064c[_0x8a8a('0x41')](function(_0x30ee47){return{'name':_0x30ee47[_0x8a8a('0xd8')],'basename':_0x30ee47[_0x8a8a('0x74')],'type':_0x30ee47['mimetype'],'ChatOfflineMessageId':_0x93fd84['id']};});_0x32374c=_0x2c8a9a[_0x8a8a('0x41')](_0x4d3ecf=>{var _0x2f1516={'filename':_0x4d3ecf['name'],'path':path[_0x8a8a('0x7f')](config[_0x8a8a('0x7b')],_0x8a8a('0xd9'),_0x8a8a('0xcc'),'attachments',_0x8a8a('0xda'),_0x4d3ecf['basename'])};return _0x2f1516;});if(!_0x183423[_0x8a8a('0xdb')]){return db[_0x8a8a('0xdc')][_0x8a8a('0xdd')](function(_0x110d8a){return db[_0x8a8a('0xde')][_0x8a8a('0xdf')](_0x2c8a9a,{'transaction':_0x110d8a});});}}})[_0x8a8a('0x23')](function(){if(_0x12ecd7){_0x29e08e=_0x12ecd7;return db[_0x8a8a('0xd0')]['findOne']({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':_0x8a8a('0xe0'),'raw':!![]}]});}})[_0x8a8a('0x23')](function(_0xb02292){if(_0xb02292&&_0xb02292[_0x8a8a('0xe0')]&&_0x183423[_0x8a8a('0xe1')]&&_0x183423[_0x8a8a('0xe2')]){var _0x2d6c27={'tls':{'rejectUnauthorized':![]}};if(_0xb02292[_0x8a8a('0xe0')][_0x8a8a('0xe3')]){_0x2d6c27[_0x8a8a('0xe3')]=_0xb02292['Smtp']['service'];}else{_0x2d6c27[_0x8a8a('0xe4')]=_0xb02292[_0x8a8a('0xe0')]['host'];_0x2d6c27[_0x8a8a('0xe5')]=_0xb02292[_0x8a8a('0xe0')][_0x8a8a('0xe5')];_0x2d6c27['secure']=_0xb02292[_0x8a8a('0xe0')][_0x8a8a('0xe6')];}if(_0xb02292[_0x8a8a('0xe0')]['authentication']){_0x2d6c27['auth']={'user':_0xb02292[_0x8a8a('0xe0')][_0x8a8a('0x5e')],'pass':_0xb02292[_0x8a8a('0xe0')][_0x8a8a('0xe7')]};}return respondWithRpcPromise(_0x8a8a('0xe8'),_0x8a8a('0xe9'),{'account':_0x2d6c27,'message':{'from':util[_0x8a8a('0xad')]('\x22%s\x22\x20<%s>',_0xb02292['name'],_0xb02292[_0x8a8a('0xea')]||_0xb02292[_0x8a8a('0xe0')]['user']),'to':_0x183423[_0x8a8a('0xe2')],'subject':_0x183423['offlineMessageSubject'],'text':_0x29e08e['body'],'attachments':_0x32374c}},client9003)['then'](function(){return _0x29e08e;})[_0x8a8a('0x2c')](function(_0x3eeb40){console[_0x8a8a('0x26')](_0x3eeb40);});}})[_0x8a8a('0x23')](function(){if(_0x183423&&_0x183423[_0x8a8a('0xdb')]&&_0x183423[_0x8a8a('0xeb')]){var _0x52328d=[];if(_0x3f064c['length']){_0x52328d=_0x3f064c['map'](function(_0x192040){return{'name':_0x192040[_0x8a8a('0xd8')],'basename':_0x192040[_0x8a8a('0x74')],'type':_0x192040['mimetype'],'ChatOfflineMessageId':_0x12ecd7['id']};});}var _0x4de15b;if(!_['isNil'](_0x183423[_0x8a8a('0xec')])){var _0x5168b5=_[_0x8a8a('0x41')](_0x19e4e7[_0x8a8a('0x64')],function(_0x51c6f8){return _0x51c6f8;});var _0x1bea69=_['toPairsIn'](_0x5168b5)[0x0];var _0x51744a=_[_0x8a8a('0xed')](_0x1bea69,function(_0x3f3b09){return _0x3f3b09;});_0x4de15b=_0x51744a[0x1][_0x183423[_0x8a8a('0xec')]];}var _0x4a4566={'from':_0x206b39[_0x8a8a('0xea')],'firstName':_0x206b39[_0x8a8a('0xee')],'lastName':_0x206b39['lastName'],'mapKey':_0x8a8a('0xea'),'message':{'from':_0x206b39[_0x8a8a('0xea')],'to':_0x183423[_0x8a8a('0xd0')][_0x8a8a('0xea')],'cc':'','subject':_[_0x8a8a('0x82')](_0x4de15b)?_0x183423[_0x8a8a('0xef')]:_0x4de15b,'messageId':'','sentAt':new Date(),'attach':_0x52328d['length'],'attachments':_0x52328d,'originChannel':_0x8a8a('0xf0'),'ChatWebsiteId':_0x183423['id'],'ChatOfflineMessageId':_0x29e08e['id'],'originTo':_0x183423[_0x8a8a('0xd0')][_0x8a8a('0xea')]},'body':_0x29e08e[_0x8a8a('0x64')]};var _0x144320={'account':{'id':_0x183423['MailAccountId']},'body':_0x4a4566,'log':_0x8a8a('0xf1')};return respondWithRpcPromise('NotifyMailAccount',_0x8a8a('0xf2'),_0x144320,client9001)[_0x8a8a('0x23')](function(){return _0x29e08e;})[_0x8a8a('0x2c')](function(_0x42c547){console[_0x8a8a('0x26')](_0x42c547);});}return;})[_0x8a8a('0x23')](function(){if(_0x29e08e){return _0x29e08e;}})['then'](respondWithResult(_0x3a97c8,null))['catch'](function(_0x3fa786){console[_0x8a8a('0x26')](_0x8a8a('0x2c'),_0x3fa786);for(var _0x20f945 of _0x3f064c){var _0x1baed2=path[_0x8a8a('0x7f')](config[_0x8a8a('0x7b')],_0x8a8a('0xd9'),_0x8a8a('0xcc'),_0x8a8a('0xf3'),_0x8a8a('0xda'),_0x20f945[_0x8a8a('0x74')]);fs_extra['remove'](_0x1baed2)[_0x8a8a('0x2c')](function(_0x4f31a2){console[_0x8a8a('0x26')](_0x8a8a('0xf4'),_0x1baed2,_0x4f31a2);});}});};exports[_0x8a8a('0xf5')]=function(_0x203707,_0x3cdc0a,_0x1d36eb){return db[_0x8a8a('0xb4')]['find']({'where':{'id':_0x203707[_0x8a8a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3cdc0a,null))[_0x8a8a('0x23')](function(_0x5efce4){if(_0x5efce4){return _0x5efce4[_0x8a8a('0xf5')](_0x203707[_0x8a8a('0x64')][_0x8a8a('0x70')],_[_0x8a8a('0xf6')](_0x203707['body'],['ids','id'])||{});}})[_0x8a8a('0x23')](respondWithResult(_0x3cdc0a,null))[_0x8a8a('0x2c')](handleError(_0x3cdc0a,null));};exports['getInteractions']=function(_0x15b30c,_0x59022b,_0x577662){var _0x24f65a={'raw':![],'where':{}};var _0x44eca1={};var _0x293bf4={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x8a8a('0x69')]({'where':{'id':_0x15b30c[_0x8a8a('0x5b')]['id']}})[_0x8a8a('0x23')](handleEntityNotFound(_0x59022b,null))['then'](function(_0x1be060){if(_0x1be060){_0x44eca1[_0x8a8a('0x45')]=_['keys'](db['ChatInteraction'][_0x8a8a('0x6a')]);_0x44eca1[_0x8a8a('0x47')]=_[_0x8a8a('0x46')](_0x15b30c[_0x8a8a('0x47')]);_0x44eca1[_0x8a8a('0x48')]=_['intersection'](_0x44eca1[_0x8a8a('0x45')],_0x44eca1['query']);_0x24f65a['attributes']=_[_0x8a8a('0x49')](_0x44eca1[_0x8a8a('0x45')],qs[_0x8a8a('0x4a')](_0x15b30c[_0x8a8a('0x47')][_0x8a8a('0x4a')]));_0x24f65a[_0x8a8a('0x4c')]=_0x24f65a['attributes'][_0x8a8a('0x4b')]?_0x24f65a[_0x8a8a('0x4c')]:_0x44eca1[_0x8a8a('0x45')];if(!_0x15b30c[_0x8a8a('0x47')][_0x8a8a('0x6e')]('nolimit')){_0x24f65a[_0x8a8a('0x4e')]=qs['limit'](_0x15b30c[_0x8a8a('0x47')]['limit']);_0x24f65a['offset']=qs[_0x8a8a('0x31')](_0x15b30c[_0x8a8a('0x47')][_0x8a8a('0x31')]);}_0x24f65a['order']=qs[_0x8a8a('0x50')](_0x15b30c['query'][_0x8a8a('0x50')]);_0x24f65a[_0x8a8a('0x53')]=qs[_0x8a8a('0x48')](_[_0x8a8a('0x51')](_0x15b30c[_0x8a8a('0x47')],_0x44eca1[_0x8a8a('0x48')]));_0x24f65a[_0x8a8a('0x53')][_0x8a8a('0x67')]=_0x1be060['id'];if(_0x15b30c[_0x8a8a('0x47')][_0x8a8a('0x52')]){_0x24f65a[_0x8a8a('0x53')]=_['merge'](_0x24f65a['where'],{'$or':_[_0x8a8a('0x41')](_0x24f65a[_0x8a8a('0x4c')],function(_0x2e6741){var _0x50b445={};_0x50b445[_0x2e6741]={'$like':'%'+_0x15b30c['query'][_0x8a8a('0x52')]+'%'};return _0x50b445;})});}_0x24f65a=_[_0x8a8a('0x54')]({},_0x24f65a,_0x15b30c['options']);return db['ChatInteraction'][_0x8a8a('0x30')]({'where':_0x24f65a[_0x8a8a('0x53')]})['then'](function(_0x5e618d){_0x293bf4[_0x8a8a('0x30')]=_0x5e618d;if(_0x15b30c['query'][_0x8a8a('0x5c')]){_0x24f65a['include']=[{'model':db[_0x8a8a('0x8a')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x8a8a('0x3d'),'fullname',_0x8a8a('0xf7')],'required':![]},{'model':db[_0x8a8a('0xf8')],'as':_0x8a8a('0xf9'),'attributes':['id','name','color'],'where':_0x15b30c[_0x8a8a('0x47')][_0x8a8a('0xfa')]?{'id':_0x15b30c[_0x8a8a('0x47')]['tag']}:undefined,'required':_0x15b30c[_0x8a8a('0x47')][_0x8a8a('0xfa')]?!![]:![]}];}return db[_0x8a8a('0xb4')]['findAll'](_0x24f65a);})['then'](function(_0x4a68f4){_0x293bf4['rows']=_0x4a68f4;return _0x293bf4;});}})[_0x8a8a('0x23')](respondWithFilteredResult(_0x59022b,_0x24f65a))[_0x8a8a('0x2c')](handleError(_0x59022b,null));};function iftimePromise(_0x3fd5b2,_0x6120b4){return respondWithRpcPromise(_0x8a8a('0xfb'),_0x8a8a('0xfc'),{'command':_0x6120b4[_0x8a8a('0xfd')]?util['format'](_0x8a8a('0xfe'),_0x3fd5b2[_0x8a8a('0xff')],_0x6120b4[_0x8a8a('0xfd')]):util['format'](_0x8a8a('0x100'),_0x3fd5b2[_0x8a8a('0xff')])},client9002)[_0x8a8a('0x23')](function(_0x5174f0){var _0x36eadb=_0x5174f0&&_0x5174f0[_0x8a8a('0x101')](_0x8a8a('0x102'))>=0x0?!![]:![];logger[_0x8a8a('0x2a')](_0x8a8a('0x103'),_0x6120b4['id'],_0x3fd5b2['id'],_0x3fd5b2[_0x8a8a('0xff')],_0x36eadb?'ONLINE':_0x8a8a('0x104'),_0x6120b4[_0x8a8a('0xfd')]?_0x6120b4[_0x8a8a('0xfd')]:_0x8a8a('0x105'));return _0x36eadb;})[_0x8a8a('0x2c')](function(_0x3138f3){logger[_0x8a8a('0x26')](_0x8a8a('0x103'),_0x6120b4['id'],_0x3fd5b2['id'],_0x3fd5b2[_0x8a8a('0xff')],util[_0x8a8a('0x106')](_0x3138f3,{'showHidden':![],'depth':null}),_0x6120b4[_0x8a8a('0xfd')]?_0x6120b4[_0x8a8a('0xfd')]:_0x8a8a('0x105'));return![];});}exports[_0x8a8a('0xfc')]=function(_0x3a60dc,_0x289424,_0x2d39a8){var _0x1f882e=0x0;var _0x2e7ad3=0x0;var _0x270117=![];var _0x6b0f5e;var _0x90b1cb;return db[_0x8a8a('0x42')][_0x8a8a('0x62')]({'where':{'id':_0x3a60dc['params']['id']},'include':[{'model':db['Interval'],'as':_0x8a8a('0x107'),'include':[{'model':db[_0x8a8a('0x107')],'as':_0x8a8a('0x108'),'attributes':['id',_0x8a8a('0xff')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x289424,null))[_0x8a8a('0x23')](function(_0x3265d7){if(_0x3265d7){_0x6b0f5e=_0x3265d7;return _0x3265d7['getProactiveActions']({'raw':!![]});}})[_0x8a8a('0x23')](function(_0x6a2caf){if(_0x6b0f5e){if(_0x6a2caf){_0x90b1cb=_0x6a2caf;}}return require(_0x8a8a('0x18'))[_0x8a8a('0x7d')]();})['then'](function(_0x3fe97e){if(_0x3fe97e){_0x2e7ad3=_0x3fe97e[_0x8a8a('0x109')];_0x270117=_0x3fe97e[_0x8a8a('0x7e')];}})[_0x8a8a('0x23')](function(){return db[_0x8a8a('0xb4')][_0x8a8a('0x30')]({'where':{'closed':![]}});})[_0x8a8a('0x23')](function(_0x1db5e4){_0x1f882e=_0x1db5e4;if(_0x2e7ad3&&_0x1db5e4>_0x2e7ad3){return db[_0x8a8a('0x10a')][_0x8a8a('0x69')]({'where':{'id':0x1}})[_0x8a8a('0x23')](function(_0x4f2cbb){if(_0x4f2cbb){_0x4f2cbb[_0x8a8a('0x10b')](_0x8a8a('0x10c'));}});}})[_0x8a8a('0x23')](function(){if(_0x6b0f5e['Interval']&&_0x6b0f5e[_0x8a8a('0x107')][_0x8a8a('0x108')]){var _0x2501de=[];for(var _0x2badfa=0x0;_0x2badfa<_0x6b0f5e[_0x8a8a('0x107')]['Intervals'][_0x8a8a('0x4b')];_0x2badfa++){var _0x54314d=_0x6b0f5e[_0x8a8a('0x107')][_0x8a8a('0x108')][_0x2badfa][_0x8a8a('0x38')]({'plain':!![]});_0x2501de[_0x8a8a('0x10d')](iftimePromise(_0x54314d,_0x6b0f5e));}return BPromise[_0x8a8a('0x10e')](_0x2501de)[_0x8a8a('0x23')](function(_0x15b524){return _[_0x8a8a('0x10f')](_0x15b524);});}else{return!![];}})[_0x8a8a('0x23')](function(_0x3f51dc){var _0x17fa4c=fs[_0x8a8a('0x110')](path[_0x8a8a('0x7f')](config['root'],_0x8a8a('0x111')),_0x8a8a('0xd3'));var _0x35a036={'remote':_0x6b0f5e['remote'],'query':querystring[_0x8a8a('0x25')](_[_0x8a8a('0x54')](_0x6b0f5e[_0x8a8a('0x38')]({'plain':!![]}),{'customerIp':_0x3a60dc[_0x8a8a('0xa5')]['x-forwarded-for']||_0x3a60dc['headers'][_0x8a8a('0x112')]||_0x3a60dc[_0x8a8a('0x113')]['remoteAddress']||_0x3a60dc['ip'],'referer':_0x3a60dc[_0x8a8a('0xa5')][_0x8a8a('0xaa')],'openedInteractions':_0x1f882e,'maxInteractions':_0x2e7ad3,'virtual':_0x270117[_0x8a8a('0x109')],'online':_0x3f51dc,'custom':_0x270117}))[_0x8a8a('0x114')](/'/g,'\x5c\x27')};_0x289424['send'](ejs[_0x8a8a('0xd4')](Mustache[_0x8a8a('0xd4')](_0x17fa4c,_0x35a036),{'proactiveActions':_0x90b1cb,'alignment':_0x6b0f5e[_0x8a8a('0x115')],'verticalAlignment':_0x6b0f5e['verticalAlignment'],'div_color':_0x6b0f5e[_0x8a8a('0x116')],'text_color':_0x6b0f5e['textColor'],'button_color':_0x6b0f5e[_0x8a8a('0x117')],'background_color':_0x6b0f5e['backgroundColor']}));})['catch'](handleError(_0x289424,null));};exports[_0x8a8a('0x118')]=function(_0x487ac2,_0x11b8e5,_0x300627){return db[_0x8a8a('0x42')][_0x8a8a('0x69')]({'where':{'id':_0x487ac2[_0x8a8a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x11b8e5,null))[_0x8a8a('0x23')](function(_0x3c5d4d){if(_0x3c5d4d){return db[_0x8a8a('0xdc')][_0x8a8a('0xdd')](function(_0x2b3f58){return db[_0x8a8a('0x119')]['destroy']({'where':{'ChatWebsiteId':_0x487ac2[_0x8a8a('0x5b')]['id']},'transaction':_0x2b3f58})[_0x8a8a('0x23')](function(_0x450d64){var _0x30fe79=_[_0x8a8a('0x41')](_0x487ac2[_0x8a8a('0x64')],function(_0x38c688){_0x38c688[_0x8a8a('0x67')]=_0x487ac2[_0x8a8a('0x5b')]['id'];return _0x38c688;});return db[_0x8a8a('0x119')][_0x8a8a('0xdf')](_0x30fe79,{'transaction':_0x2b3f58});});})['then'](function(){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x487ac2[_0x8a8a('0x5b')]['id']},'order':_0x8a8a('0xa2')});});}})[_0x8a8a('0x23')](respondWithResult(_0x11b8e5,null))['catch'](handleError(_0x11b8e5,null));};exports['getApplications']=function(_0x2211a0,_0x54c285,_0x4b93b2){var _0x4f6f49={};var _0x2e2ffb={};var _0x4f9afe;var _0x1bd107;return db[_0x8a8a('0x42')][_0x8a8a('0x69')]({'where':{'id':_0x2211a0[_0x8a8a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x54c285,null))[_0x8a8a('0x23')](function(_0x4262ff){if(_0x4262ff){_0x4f9afe=_0x4262ff;_0x2e2ffb['model']=_['keys'](db[_0x8a8a('0x119')][_0x8a8a('0x6a')]);_0x2e2ffb[_0x8a8a('0x47')]=_['keys'](_0x2211a0[_0x8a8a('0x47')]);_0x2e2ffb[_0x8a8a('0x48')]=_[_0x8a8a('0x49')](_0x2e2ffb[_0x8a8a('0x45')],_0x2e2ffb[_0x8a8a('0x47')]);_0x4f6f49[_0x8a8a('0x4c')]=_[_0x8a8a('0x49')](_0x2e2ffb[_0x8a8a('0x45')],qs[_0x8a8a('0x4a')](_0x2211a0[_0x8a8a('0x47')][_0x8a8a('0x4a')]));_0x4f6f49['attributes']=_0x4f6f49[_0x8a8a('0x4c')]['length']?_0x4f6f49[_0x8a8a('0x4c')]:_0x2e2ffb['model'];_0x4f6f49['order']=qs[_0x8a8a('0x50')](_0x2211a0['query']['sort']);_0x4f6f49['where']=qs['filters'](_[_0x8a8a('0x51')](_0x2211a0[_0x8a8a('0x47')],_0x2e2ffb[_0x8a8a('0x48')]));if(_0x2211a0[_0x8a8a('0x47')][_0x8a8a('0x52')]){_0x4f6f49[_0x8a8a('0x53')]=_[_0x8a8a('0x54')](_0x4f6f49[_0x8a8a('0x53')],{'$or':_[_0x8a8a('0x41')](_0x4f6f49[_0x8a8a('0x4c')],function(_0x366e2f){var _0x5b09ff={};_0x5b09ff[_0x366e2f]={'$like':'%'+_0x2211a0[_0x8a8a('0x47')]['filter']+'%'};return _0x5b09ff;})});}_0x4f6f49=_[_0x8a8a('0x54')]({},_0x4f6f49,_0x2211a0[_0x8a8a('0x56')]);return _0x4f9afe[_0x8a8a('0x11a')](_0x4f6f49);}})[_0x8a8a('0x23')](function(_0x2a13fc){if(_0x2a13fc){_0x1bd107=_0x2a13fc[_0x8a8a('0x4b')];if(!_0x2211a0[_0x8a8a('0x47')][_0x8a8a('0x6e')](_0x8a8a('0x4d'))){_0x4f6f49[_0x8a8a('0x4e')]=qs[_0x8a8a('0x4e')](_0x2211a0['query']['limit']);_0x4f6f49['offset']=qs[_0x8a8a('0x31')](_0x2211a0['query'][_0x8a8a('0x31')]);}return _0x4f9afe[_0x8a8a('0x11a')](_0x4f6f49);}})[_0x8a8a('0x23')](function(_0xcd7d40){if(_0xcd7d40){return _0xcd7d40?{'count':_0x1bd107,'rows':_0xcd7d40}:null;}})[_0x8a8a('0x23')](respondWithResult(_0x54c285,null))['catch'](handleError(_0x54c285,null));};exports[_0x8a8a('0x11b')]=function(_0x5e7499,_0x1684dc,_0x47ee6b){return db[_0x8a8a('0x11c')][_0x8a8a('0x62')]({'where':{'id':_0x5e7499[_0x8a8a('0x5b')]['id']}})[_0x8a8a('0x23')](handleEntityNotFound(_0x1684dc,null))[_0x8a8a('0x23')](function(_0x43bfeb){if(_0x43bfeb){return _0x43bfeb[_0x8a8a('0x11b')](_0x5e7499['body'][_0x8a8a('0x70')],_['omit'](_0x5e7499['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x1684dc,null))['catch'](handleError(_0x1684dc,null));};exports[_0x8a8a('0x11d')]=function(_0x3cff27,_0x374b3f,_0x1ba68b){var _0x3bb91f={};var _0x86982b={};var _0x247ad7;var _0x4c512b;return db['ChatWebsite']['findOne']({'where':{'id':_0x3cff27[_0x8a8a('0x5b')]['id']}})[_0x8a8a('0x23')](handleEntityNotFound(_0x374b3f,null))[_0x8a8a('0x23')](function(_0x5204d2){if(_0x5204d2){_0x247ad7=_0x5204d2;_0x86982b[_0x8a8a('0x45')]=_[_0x8a8a('0x46')](db['ChatProactiveAction'][_0x8a8a('0x6a')]);_0x86982b[_0x8a8a('0x47')]=_[_0x8a8a('0x46')](_0x3cff27['query']);_0x86982b[_0x8a8a('0x48')]=_[_0x8a8a('0x49')](_0x86982b[_0x8a8a('0x45')],_0x86982b['query']);_0x3bb91f[_0x8a8a('0x4c')]=_[_0x8a8a('0x49')](_0x86982b[_0x8a8a('0x45')],qs[_0x8a8a('0x4a')](_0x3cff27[_0x8a8a('0x47')][_0x8a8a('0x4a')]));_0x3bb91f[_0x8a8a('0x4c')]=_0x3bb91f[_0x8a8a('0x4c')]['length']?_0x3bb91f['attributes']:_0x86982b[_0x8a8a('0x45')];_0x3bb91f['order']=qs['sort'](_0x3cff27['query']['sort']);_0x3bb91f['where']=qs['filters'](_['pick'](_0x3cff27[_0x8a8a('0x47')],_0x86982b['filters']));if(_0x3cff27[_0x8a8a('0x47')][_0x8a8a('0x52')]){_0x3bb91f[_0x8a8a('0x53')]=_['merge'](_0x3bb91f[_0x8a8a('0x53')],{'$or':_[_0x8a8a('0x41')](_0x3bb91f[_0x8a8a('0x4c')],function(_0x204077){var _0x52ec71={};_0x52ec71[_0x204077]={'$like':'%'+_0x3cff27['query'][_0x8a8a('0x52')]+'%'};return _0x52ec71;})});}_0x3bb91f=_[_0x8a8a('0x54')]({},_0x3bb91f,_0x3cff27['options']);return _0x247ad7[_0x8a8a('0x11d')](_0x3bb91f);}})['then'](function(_0x1a403e){if(_0x1a403e){_0x4c512b=_0x1a403e[_0x8a8a('0x4b')];if(!_0x3cff27['query'][_0x8a8a('0x6e')]('nolimit')){_0x3bb91f[_0x8a8a('0x4e')]=qs[_0x8a8a('0x4e')](_0x3cff27[_0x8a8a('0x47')][_0x8a8a('0x4e')]);_0x3bb91f[_0x8a8a('0x31')]=qs['offset'](_0x3cff27[_0x8a8a('0x47')][_0x8a8a('0x31')]);}return _0x247ad7[_0x8a8a('0x11d')](_0x3bb91f);}})[_0x8a8a('0x23')](function(_0x3826f6){if(_0x3826f6){return _0x3826f6?{'count':_0x4c512b,'rows':_0x3826f6}:null;}})[_0x8a8a('0x23')](respondWithResult(_0x374b3f,null))[_0x8a8a('0x2c')](handleError(_0x374b3f,null));};exports[_0x8a8a('0x11e')]=function(_0x246301,_0x59f9a2,_0x2810fc){var _0x3e8ddf=_0x246301[_0x8a8a('0x47')][_0x8a8a('0x11f')]===_0x8a8a('0x120')?_0x8a8a('0x121'):'onlineForm';return db[_0x8a8a('0x42')][_0x8a8a('0x62')]({'attributes':['id',_0x3e8ddf],'where':{'id':_0x246301['params']['id']}})[_0x8a8a('0x23')](handleEntityNotFound(_0x59f9a2,null))[_0x8a8a('0x23')](function(_0x2f5102){if(_0x2f5102){var _0x51dc09=_0x2f5102[_0x3e8ddf];var _0x48676a=_0x51dc09&&_0x51dc09['items']?_0x51dc09[_0x8a8a('0x122')]:[];_0x59f9a2[_0x8a8a('0x3e')]({'fromKey':_[_0x8a8a('0x82')](_0x51dc09['fromKey'])?undefined:_0x51dc09['fromKey'],'count':_0x48676a[_0x8a8a('0x4b')],'rows':_0x48676a});}})[_0x8a8a('0x2c')](handleError(_0x59f9a2,null));};exports['getOfflineMessages']=function(_0xdf8449,_0x43668c,_0x32d1bc){var _0x25f94c={'raw':![],'where':{}};var _0x44c9da={};var _0x5c3f9b={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0xdf8449[_0x8a8a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x43668c,null))[_0x8a8a('0x23')](function(_0x368bcc){if(_0x368bcc){_0x44c9da[_0x8a8a('0x45')]=_[_0x8a8a('0x46')](db[_0x8a8a('0xd7')]['rawAttributes']);_0x44c9da[_0x8a8a('0x47')]=_[_0x8a8a('0x46')](_0xdf8449['query']);_0x44c9da[_0x8a8a('0x48')]=_[_0x8a8a('0x49')](_0x44c9da[_0x8a8a('0x45')],_0x44c9da[_0x8a8a('0x47')]);_0x25f94c[_0x8a8a('0x4c')]=_[_0x8a8a('0x49')](_0x44c9da['model'],qs['fields'](_0xdf8449[_0x8a8a('0x47')][_0x8a8a('0x4a')]));_0x25f94c['attributes']=_0x25f94c[_0x8a8a('0x4c')][_0x8a8a('0x4b')]?_0x25f94c[_0x8a8a('0x4c')]:_0x44c9da[_0x8a8a('0x45')];if(!_0xdf8449[_0x8a8a('0x47')][_0x8a8a('0x6e')](_0x8a8a('0x4d'))){_0x25f94c[_0x8a8a('0x4e')]=qs['limit'](_0xdf8449['query']['limit']);_0x25f94c[_0x8a8a('0x31')]=qs[_0x8a8a('0x31')](_0xdf8449[_0x8a8a('0x47')][_0x8a8a('0x31')]);}_0x25f94c[_0x8a8a('0x4f')]=qs['sort'](_0xdf8449[_0x8a8a('0x47')][_0x8a8a('0x50')]);_0x25f94c['where']=qs[_0x8a8a('0x48')](_[_0x8a8a('0x51')](_0xdf8449[_0x8a8a('0x47')],_0x44c9da[_0x8a8a('0x48')]));_0x25f94c[_0x8a8a('0x53')]['ChatWebsiteId']=_0x368bcc['id'];if(_0xdf8449[_0x8a8a('0x47')][_0x8a8a('0x52')]){_0x25f94c[_0x8a8a('0x53')]=_[_0x8a8a('0x54')](_0x25f94c['where'],{'$or':_[_0x8a8a('0x41')](_0x25f94c['attributes'],function(_0x3807c8){var _0x32d528={};_0x32d528[_0x3807c8]={'$like':'%'+_0xdf8449[_0x8a8a('0x47')][_0x8a8a('0x52')]+'%'};return _0x32d528;})});}_0x25f94c=_[_0x8a8a('0x54')]({},_0x25f94c,_0xdf8449['options']);return db[_0x8a8a('0xd7')]['count']({'where':_0x25f94c[_0x8a8a('0x53')]})['then'](function(_0x4b44b9){_0x5c3f9b[_0x8a8a('0x30')]=_0x4b44b9;if(_0xdf8449[_0x8a8a('0x47')][_0x8a8a('0x5c')]){_0x25f94c[_0x8a8a('0x57')]=[{'all':!![]}];}else{_0x25f94c[_0x8a8a('0x57')]=[{'model':db[_0x8a8a('0x8a')],'as':_0x8a8a('0x123'),'required':![]},{'model':db[_0x8a8a('0xde')],'as':_0x8a8a('0x124'),'required':![]}];}return db[_0x8a8a('0xd7')][_0x8a8a('0x58')](_0x25f94c);})[_0x8a8a('0x23')](function(_0x11cf94){_0x5c3f9b[_0x8a8a('0x59')]=_0x11cf94;return _0x5c3f9b;});}})[_0x8a8a('0x23')](respondWithFilteredResult(_0x43668c,_0x25f94c))[_0x8a8a('0x2c')](handleError(_0x43668c,null));};exports[_0x8a8a('0x125')]=function(_0x3436c8,_0x2e7c3a,_0x4447dc){return db[_0x8a8a('0x42')][_0x8a8a('0x62')]({'where':{'id':_0x3436c8['params']['id']}})['then'](handleEntityNotFound(_0x2e7c3a,null))[_0x8a8a('0x23')](function(_0x156ebd){if(_0x156ebd){return _0x156ebd[_0x8a8a('0x125')](_0x3436c8[_0x8a8a('0x64')]['ids'],_[_0x8a8a('0xf6')](_0x3436c8['body'],[_0x8a8a('0x70'),'id'])||{})[_0x8a8a('0xb8')](function(_0x1d221f){for(var _0x37cc3b=0x0;_0x37cc3b<_0x3436c8[_0x8a8a('0x64')][_0x8a8a('0x70')][_0x8a8a('0x4b')];_0x37cc3b+=0x1){socket[_0x8a8a('0x126')](_0x8a8a('0x127'),{'UserId':_0x3436c8[_0x8a8a('0x64')][_0x8a8a('0x70')][_0x37cc3b],'ChatWebsiteId':_0x3436c8['params']['id']});}return _0x1d221f;});}})[_0x8a8a('0x23')](respondWithResult(_0x2e7c3a,null))[_0x8a8a('0x2c')](handleError(_0x2e7c3a,null));};exports['removeAgents']=function(_0x469830,_0x4676bb,_0x537af6){return db[_0x8a8a('0x42')][_0x8a8a('0x62')]({'where':{'id':_0x469830['params']['id']}})[_0x8a8a('0x23')](handleEntityNotFound(_0x4676bb,null))[_0x8a8a('0x23')](function(_0x3d62d4){if(_0x3d62d4){return _0x3d62d4['removeAgents'](_0x469830['query']['ids'])['then'](function(){if(_[_0x8a8a('0x128')](_0x469830[_0x8a8a('0x47')][_0x8a8a('0x70')])){for(var _0x2a1e52=0x0;_0x2a1e52<_0x469830['query'][_0x8a8a('0x70')][_0x8a8a('0x4b')];_0x2a1e52+=0x1){socket[_0x8a8a('0x126')](_0x8a8a('0x129'),{'UserId':Number(_0x469830[_0x8a8a('0x47')][_0x8a8a('0x70')][_0x2a1e52]),'ChatWebsiteId':Number(_0x469830[_0x8a8a('0x5b')]['id'])});}}else{socket[_0x8a8a('0x126')](_0x8a8a('0x129'),{'UserId':Number(_0x469830[_0x8a8a('0x47')][_0x8a8a('0x70')]),'ChatWebsiteId':Number(_0x469830[_0x8a8a('0x5b')]['id'])});}});}})[_0x8a8a('0x23')](respondWithStatusCode(_0x4676bb,null))[_0x8a8a('0x2c')](handleError(_0x4676bb,null));};exports['getAgents']=function(_0x14c83f,_0x3c38ca,_0x2fdf21){var _0x67ad3d={};var _0x45aad5={};var _0x221ac6;var _0x3a3c70;return db[_0x8a8a('0x42')]['findOne']({'where':{'id':_0x14c83f[_0x8a8a('0x5b')]['id']}})[_0x8a8a('0x23')](handleEntityNotFound(_0x3c38ca,null))['then'](function(_0x541289){if(_0x541289){_0x221ac6=_0x541289;_0x45aad5['model']=_['keys'](db[_0x8a8a('0xc2')]['rawAttributes']);_0x45aad5[_0x8a8a('0x47')]=_[_0x8a8a('0x46')](_0x14c83f[_0x8a8a('0x47')]);_0x45aad5['filters']=_[_0x8a8a('0x49')](_0x45aad5['model'],_0x45aad5['query']);_0x67ad3d[_0x8a8a('0x4c')]=_['intersection'](_0x45aad5[_0x8a8a('0x45')],qs[_0x8a8a('0x4a')](_0x14c83f[_0x8a8a('0x47')]['fields']));_0x67ad3d['attributes']=_0x67ad3d[_0x8a8a('0x4c')][_0x8a8a('0x4b')]?_0x67ad3d['attributes']:_0x45aad5[_0x8a8a('0x45')];_0x67ad3d['order']=qs[_0x8a8a('0x50')](_0x14c83f[_0x8a8a('0x47')]['sort']);_0x67ad3d['where']=qs[_0x8a8a('0x48')](_[_0x8a8a('0x51')](_0x14c83f[_0x8a8a('0x47')],_0x45aad5[_0x8a8a('0x48')]));if(_0x14c83f[_0x8a8a('0x47')][_0x8a8a('0x52')]){_0x67ad3d[_0x8a8a('0x53')]=_['merge'](_0x67ad3d[_0x8a8a('0x53')],{'$or':_[_0x8a8a('0x41')](_0x67ad3d['attributes'],function(_0x48112d){var _0x34df1f={};_0x34df1f[_0x48112d]={'$like':'%'+_0x14c83f[_0x8a8a('0x47')]['filter']+'%'};return _0x34df1f;})});}_0x67ad3d=_[_0x8a8a('0x54')]({},_0x67ad3d,_0x14c83f[_0x8a8a('0x56')]);return _0x221ac6['getAgents'](_0x67ad3d);}})[_0x8a8a('0x23')](function(_0x543cf4){if(_0x543cf4){_0x3a3c70=_0x543cf4[_0x8a8a('0x4b')];if(!_0x14c83f[_0x8a8a('0x47')][_0x8a8a('0x6e')]('nolimit')){_0x67ad3d[_0x8a8a('0x4e')]=qs['limit'](_0x14c83f[_0x8a8a('0x47')][_0x8a8a('0x4e')]);_0x67ad3d[_0x8a8a('0x31')]=qs['offset'](_0x14c83f['query'][_0x8a8a('0x31')]);}return _0x221ac6['getAgents'](_0x67ad3d);}})['then'](function(_0x5ef38d){if(_0x5ef38d){return _0x5ef38d?{'count':_0x3a3c70,'rows':_0x5ef38d}:null;}})[_0x8a8a('0x23')](respondWithResult(_0x3c38ca,null))[_0x8a8a('0x2c')](handleError(_0x3c38ca,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 6038819..ce8e415 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 _0xe14d=['ChatWebsite','setMaxListeners','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0xad9d4d,_0x5bf432){var _0x195e72=function(_0x1d2e78){while(--_0x1d2e78){_0xad9d4d['push'](_0xad9d4d['shift']());}};_0x195e72(++_0x5bf432);}(_0xe14d,0x1ee));var _0xde14=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0xe14d[_0x20c9b2];return _0x2c6030;};'use strict';var EventEmitter=require(_0xde14('0x0'));var ChatWebsite=require(_0xde14('0x1'))['db'][_0xde14('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xde14('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xde14('0x4'),'afterDestroy':_0xde14('0x5')};function emitEvent(_0x4b20e2){return function(_0x1c3e94,_0x13c24e,_0x3280b9){ChatWebsiteEvents[_0xde14('0x6')](_0x4b20e2+':'+_0x1c3e94['id'],_0x1c3e94);ChatWebsiteEvents[_0xde14('0x6')](_0x4b20e2,_0x1c3e94);_0x3280b9(null);};}for(var e in events){if(events[_0xde14('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x5f10=['emit','hasOwnProperty','hook','events','../../mysqldb','update','remove'];(function(_0x9620ac,_0x1dd664){var _0x561bd9=function(_0xfd8ffb){while(--_0xfd8ffb){_0x9620ac['push'](_0x9620ac['shift']());}};_0x561bd9(++_0x1dd664);}(_0x5f10,0xd5));var _0x05f1=function(_0x2c40bf,_0x5ce37a){_0x2c40bf=_0x2c40bf-0x0;var _0x31ab19=_0x5f10[_0x2c40bf];return _0x31ab19;};'use strict';var EventEmitter=require(_0x05f1('0x0'));var ChatWebsite=require(_0x05f1('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x05f1('0x2'),'afterDestroy':_0x05f1('0x3')};function emitEvent(_0x2eaff1){return function(_0xcb88e1,_0xa8d3b9,_0x23747b){ChatWebsiteEvents['emit'](_0x2eaff1+':'+_0xcb88e1['id'],_0xcb88e1);ChatWebsiteEvents[_0x05f1('0x4')](_0x2eaff1,_0xcb88e1);_0x23747b(null);};}for(var e in events){if(events[_0x05f1('0x5')](e)){var event=events[e];ChatWebsite[_0x05f1('0x6')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 36ef22d..9d6e87c 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 _0x4746=['rimraf','../../config/environment','exports','define','ChatWebsite','chat_websites','lodash','util','api','bluebird','request-promise','path'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x4746,0xc6));var _0x6474=function(_0x32db1b,_0x141891){_0x32db1b=_0x32db1b-0x0;var _0x2d461f=_0x4746[_0x32db1b];return _0x2d461f;};'use strict';var _=require(_0x6474('0x0'));var util=require(_0x6474('0x1'));var logger=require('../../config/logger')(_0x6474('0x2'));var moment=require('moment');var BPromise=require(_0x6474('0x3'));var rp=require(_0x6474('0x4'));var fs=require('fs');var path=require(_0x6474('0x5'));var rimraf=require(_0x6474('0x6'));var config=require(_0x6474('0x7'));var attributes=require('./chatWebsite.attributes');module[_0x6474('0x8')]=function(_0x2bcf7c,_0x4cadd7){return _0x2bcf7c[_0x6474('0x9')](_0x6474('0xa'),attributes,{'tableName':_0x6474('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f2f=['chat_websites','lodash','util','bluebird','rimraf','../../config/environment','./chatWebsite.attributes','define','ChatWebsite'];(function(_0x44f88c,_0x2d8439){var _0x43998a=function(_0x4b4389){while(--_0x4b4389){_0x44f88c['push'](_0x44f88c['shift']());}};_0x43998a(++_0x2d8439);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x6f2f[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0xf6f2('0x0'));var util=require(_0xf6f2('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf6f2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf6f2('0x3'));var config=require(_0xf6f2('0x4'));var attributes=require(_0xf6f2('0x5'));module['exports']=function(_0x5c540a,_0x1123bb){return _0x5c540a[_0xf6f2('0x6')](_0xf6f2('0x7'),attributes,{'tableName':_0xf6f2('0x8'),'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 db79a7b..303709c 100644 --- a/server/api/chatWebsite/chatWebsite.rpc.js +++ b/server/api/chatWebsite/chatWebsite.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd943=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','localhost','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x198ef9,_0x5927bf){var _0x561a00=function(_0x332e5e){while(--_0x332e5e){_0x198ef9['push'](_0x198ef9['shift']());}};_0x561a00(++_0x5927bf);}(_0xd943,0x15d));var _0x3d94=function(_0x32d586,_0x216783){_0x32d586=_0x32d586-0x0;var _0xdecece=_0xd943[_0x32d586];return _0xdecece;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x3d94('0xa')],{'host':_0x3d94('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3d94('0xc'))[_0x3d94('0xd')](socket);function respondWithRpcPromise(_0x1cc58c,_0x5908a7,_0x182066){return new BPromise(function(_0x4ac968,_0x39e2fa){return client[_0x3d94('0xe')](_0x1cc58c,_0x182066)['then'](function(_0x1897de){logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));logger[_0x3d94('0x12')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5908a7,_0x3d94('0x11'),JSON[_0x3d94('0x13')](_0x1897de));if(_0x1897de[_0x3d94('0x14')]){if(_0x1897de['error'][_0x3d94('0x15')]===0x1f4){logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de['error'][_0x3d94('0x16')]);return _0x39e2fa(_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);}logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);return _0x4ac968(_0x1897de[_0x3d94('0x14')]['message']);}else{logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));_0x4ac968(_0x1897de[_0x3d94('0x17')][_0x3d94('0x16')]);}})[_0x3d94('0x18')](function(_0xef8b3){logger['error'](_0x3d94('0x10'),_0x5908a7,_0xef8b3);_0x39e2fa(_0xef8b3);});});} \ No newline at end of file +var _0x7880=['defaults','localhost','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7880,0x1f4));var _0x0788=function(_0x4ca796,_0x10dc47){_0x4ca796=_0x4ca796-0x0;var _0x171f87=_0x7880[_0x4ca796];return _0x171f87;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});config[_0x0788('0xc')]=_[_0x0788('0xd')](config[_0x0788('0xc')],{'host':_0x0788('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0788('0xc')]));require('./chatWebsite.socket')[_0x0788('0xf')](socket);function respondWithRpcPromise(_0x53b2f2,_0x433c26,_0x3c6d18){return new BPromise(function(_0x1f9ff6,_0xee8670){return client[_0x0788('0x10')](_0x53b2f2,_0x3c6d18)['then'](function(_0x1920b3){logger[_0x0788('0x11')](_0x0788('0x12'),_0x433c26,_0x0788('0x13'));logger[_0x0788('0x14')](_0x0788('0x15'),_0x433c26,_0x0788('0x13'),JSON['stringify'](_0x1920b3));if(_0x1920b3[_0x0788('0x16')]){if(_0x1920b3[_0x0788('0x16')][_0x0788('0x17')]===0x1f4){logger[_0x0788('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x433c26,_0x1920b3[_0x0788('0x16')]['message']);return _0xee8670(_0x1920b3[_0x0788('0x16')][_0x0788('0x18')]);}logger[_0x0788('0x16')](_0x0788('0x12'),_0x433c26,_0x1920b3[_0x0788('0x16')][_0x0788('0x18')]);return _0x1f9ff6(_0x1920b3['error']['message']);}else{logger[_0x0788('0x11')](_0x0788('0x12'),_0x433c26,'request\x20sent');_0x1f9ff6(_0x1920b3[_0x0788('0x19')][_0x0788('0x18')]);}})[_0x0788('0x1a')](function(_0x52c339){logger[_0x0788('0x16')](_0x0788('0x12'),_0x433c26,_0x52c339);_0xee8670(_0x52c339);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index cd9e8d8..64d1290 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0xe70371,_0x50e364){var _0xe65a58=function(_0x254c44){while(--_0x254c44){_0xe70371['push'](_0xe70371['shift']());}};_0xe65a58(++_0x50e364);}(_0x7a54,0x106));var _0x47a5=function(_0x3a4b7e,_0x2383e0){_0x3a4b7e=_0x3a4b7e-0x0;var _0x138384=_0x7a54[_0x3a4b7e];return _0x138384;};'use strict';var ChatWebsiteEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){ChatWebsiteEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);ChatWebsiteEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x40602e,_0x2e735f){var _0x2544c3=function(_0x108654){while(--_0x108654){_0x40602e['push'](_0x40602e['shift']());}};_0x2544c3(++_0x2e735f);}(_0x7a54,0x106));var _0x47a5=function(_0xfdabc9,_0x5dba88){_0xfdabc9=_0xfdabc9-0x0;var _0x1f64f2=_0x7a54[_0xfdabc9];return _0x1f64f2;};'use strict';var ChatWebsiteEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){ChatWebsiteEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);ChatWebsiteEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 55ef877..f5781ea 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 _0xa9e0=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','format','%s-%s','originalname','file','addLogo','now','single','addAvatar','server/files/images/avatars/','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','notify','attachments','offline-chat','extname','replace','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','/:id','update','delete','destroy','removeAnswers','removeAgents','multer'];(function(_0x29375a,_0x301c00){var _0x5082ad=function(_0x59e522){while(--_0x59e522){_0x29375a['push'](_0x29375a['shift']());}};_0x5082ad(++_0x301c00);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x8')]('/:id/customer_avatar',controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x8')](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['get'](_0x0a9e('0x18'),controller['getSnippet']);router[_0x0a9e('0x8')](_0x0a9e('0x19'),auth['isAuthenticated'](),controller[_0x0a9e('0x1a')]);router['get'](_0x0a9e('0x1b'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x8')](_0x0a9e('0x1d'),controller[_0x0a9e('0x1e')]);router[_0x0a9e('0x8')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x8')](_0x0a9e('0x21'),auth['isAuthenticated'](),controller[_0x0a9e('0x22')]);router[_0x0a9e('0x23')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['post']('/:id/dispositions',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x23')](_0x0a9e('0x26'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);var upload=multer({'storage':multer[_0x0a9e('0x28')]({'destination':function(_0x3b45bc,_0x4d00e6,_0x370d86){_0x370d86(null,path[_0x0a9e('0x29')](config[_0x0a9e('0x2a')],'server/files/images/logos/'));},'filename':function(_0x59181e,_0x197ec0,_0x3a8e58){_0x3a8e58(null,util[_0x0a9e('0x2b')](_0x0a9e('0x2c'),Date['now'](),_0x197ec0[_0x0a9e('0x2d')]));}})});router['post'](_0x0a9e('0xf'),upload['single'](_0x0a9e('0x2e')),controller[_0x0a9e('0x2f')]);var upload=multer({'storage':multer[_0x0a9e('0x28')]({'destination':function(_0x14433c,_0x140511,_0x1538a4){_0x1538a4(null,path[_0x0a9e('0x29')](config[_0x0a9e('0x2a')],'server/files/images/avatars/'));},'filename':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,util[_0x0a9e('0x2b')]('%s-%s',Date[_0x0a9e('0x30')](),_0x468813[_0x0a9e('0x2d')]));}})});router[_0x0a9e('0x23')](_0x0a9e('0x11'),upload[_0x0a9e('0x31')](_0x0a9e('0x2e')),controller[_0x0a9e('0x32')]);var upload=multer({'storage':multer[_0x0a9e('0x28')]({'destination':function(_0x1dbde2,_0x540530,_0x426950){_0x426950(null,path['join'](config[_0x0a9e('0x2a')],_0x0a9e('0x33')));},'filename':function(_0x1122db,_0x33bdb7,_0x25ce3a){_0x25ce3a(null,util['format'](_0x0a9e('0x2c'),Date[_0x0a9e('0x30')](),_0x33bdb7[_0x0a9e('0x2d')]));}})});router[_0x0a9e('0x23')](_0x0a9e('0x34'),upload[_0x0a9e('0x31')](_0x0a9e('0x2e')),controller[_0x0a9e('0x35')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x44295a,_0x5e7238,_0x2cc7a0){_0x2cc7a0(null,path[_0x0a9e('0x29')](config[_0x0a9e('0x2a')],_0x0a9e('0x33')));},'filename':function(_0x567193,_0x191e91,_0xd1836d){_0xd1836d(null,util[_0x0a9e('0x2b')](_0x0a9e('0x2c'),Date['now'](),_0x191e91['originalname']));}})});router[_0x0a9e('0x23')]('/:id/system_avatar',upload[_0x0a9e('0x31')](_0x0a9e('0x2e')),controller[_0x0a9e('0x36')]);router[_0x0a9e('0x23')]('/:id/notify',controller[_0x0a9e('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0x0a9e('0x28')]({'destination':function(_0x3cae,_0x533942,_0x1dbf74){const _0x1a180b=path[_0x0a9e('0x29')](config['root'],'server/files',_0x0a9e('0x38'),_0x0a9e('0x39'));fs_extra['ensureDir'](_0x1a180b,function(){_0x1dbf74(null,_0x1a180b);});},'filename':function(_0x2b814e,_0x419125,_0x2e1b3a){const _0x148f55=_0x419125['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x15e37d=path[_0x0a9e('0x3a')](_0x148f55);const _0x53f3ee=Date[_0x0a9e('0x30')]()+'-'+_0x148f55[_0x0a9e('0x3b')](_0x15e37d,'')+_0x15e37d;_0x2e1b3a(null,_0x53f3ee);}})});router[_0x0a9e('0x23')]('/:id/offline',offlineUploadMulter[_0x0a9e('0x3c')](),controller[_0x0a9e('0x3d')]);router[_0x0a9e('0x23')](_0x0a9e('0x16'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x3e')]);router[_0x0a9e('0x23')](_0x0a9e('0x19'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x3f')]);router[_0x0a9e('0x23')](_0x0a9e('0x1b'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x40')]);router[_0x0a9e('0x23')]('/:id/users',auth['isAuthenticated'](),controller[_0x0a9e('0x41')]);router[_0x0a9e('0x42')](_0x0a9e('0x43'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x44')]);router[_0x0a9e('0x45')](_0x0a9e('0x43'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x46')]);router[_0x0a9e('0x45')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller['removeDispositions']);router[_0x0a9e('0x45')](_0x0a9e('0x26'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x47')]);router[_0x0a9e('0x45')](_0x0a9e('0x21'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x48')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','format','%s-%s','originalname','file','addLogo','now','single','addAvatar','server/files/images/avatars/','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','notify','attachments','offline-chat','extname','replace','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','/:id','update','delete','destroy','removeAnswers','removeAgents','multer'];(function(_0x14b484,_0x4a7c9b){var _0x5c977d=function(_0x26b180){while(--_0x26b180){_0x14b484['push'](_0x14b484['shift']());}};_0x5c977d(++_0x4a7c9b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x8')]('/:id/customer_avatar',controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x8')](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['get'](_0x0a9e('0x18'),controller['getSnippet']);router[_0x0a9e('0x8')](_0x0a9e('0x19'),auth['isAuthenticated'](),controller[_0x0a9e('0x1a')]);router['get'](_0x0a9e('0x1b'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x8')](_0x0a9e('0x1d'),controller[_0x0a9e('0x1e')]);router[_0x0a9e('0x8')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x8')](_0x0a9e('0x21'),auth['isAuthenticated'](),controller[_0x0a9e('0x22')]);router[_0x0a9e('0x23')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['post']('/:id/dispositions',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x23')](_0x0a9e('0x26'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);var upload=multer({'storage':multer[_0x0a9e('0x28')]({'destination':function(_0x3b45bc,_0x4d00e6,_0x370d86){_0x370d86(null,path[_0x0a9e('0x29')](config[_0x0a9e('0x2a')],'server/files/images/logos/'));},'filename':function(_0x59181e,_0x197ec0,_0x3a8e58){_0x3a8e58(null,util[_0x0a9e('0x2b')](_0x0a9e('0x2c'),Date['now'](),_0x197ec0[_0x0a9e('0x2d')]));}})});router['post'](_0x0a9e('0xf'),upload['single'](_0x0a9e('0x2e')),controller[_0x0a9e('0x2f')]);var upload=multer({'storage':multer[_0x0a9e('0x28')]({'destination':function(_0x14433c,_0x140511,_0x1538a4){_0x1538a4(null,path[_0x0a9e('0x29')](config[_0x0a9e('0x2a')],'server/files/images/avatars/'));},'filename':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,util[_0x0a9e('0x2b')]('%s-%s',Date[_0x0a9e('0x30')](),_0x468813[_0x0a9e('0x2d')]));}})});router[_0x0a9e('0x23')](_0x0a9e('0x11'),upload[_0x0a9e('0x31')](_0x0a9e('0x2e')),controller[_0x0a9e('0x32')]);var upload=multer({'storage':multer[_0x0a9e('0x28')]({'destination':function(_0x1dbde2,_0x540530,_0x426950){_0x426950(null,path['join'](config[_0x0a9e('0x2a')],_0x0a9e('0x33')));},'filename':function(_0x1122db,_0x33bdb7,_0x25ce3a){_0x25ce3a(null,util['format'](_0x0a9e('0x2c'),Date[_0x0a9e('0x30')](),_0x33bdb7[_0x0a9e('0x2d')]));}})});router[_0x0a9e('0x23')](_0x0a9e('0x34'),upload[_0x0a9e('0x31')](_0x0a9e('0x2e')),controller[_0x0a9e('0x35')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x44295a,_0x5e7238,_0x2cc7a0){_0x2cc7a0(null,path[_0x0a9e('0x29')](config[_0x0a9e('0x2a')],_0x0a9e('0x33')));},'filename':function(_0x567193,_0x191e91,_0xd1836d){_0xd1836d(null,util[_0x0a9e('0x2b')](_0x0a9e('0x2c'),Date['now'](),_0x191e91['originalname']));}})});router[_0x0a9e('0x23')]('/:id/system_avatar',upload[_0x0a9e('0x31')](_0x0a9e('0x2e')),controller[_0x0a9e('0x36')]);router[_0x0a9e('0x23')]('/:id/notify',controller[_0x0a9e('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0x0a9e('0x28')]({'destination':function(_0x3cae,_0x533942,_0x1dbf74){const _0x1a180b=path[_0x0a9e('0x29')](config['root'],'server/files',_0x0a9e('0x38'),_0x0a9e('0x39'));fs_extra['ensureDir'](_0x1a180b,function(){_0x1dbf74(null,_0x1a180b);});},'filename':function(_0x2b814e,_0x419125,_0x2e1b3a){const _0x148f55=_0x419125['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x15e37d=path[_0x0a9e('0x3a')](_0x148f55);const _0x53f3ee=Date[_0x0a9e('0x30')]()+'-'+_0x148f55[_0x0a9e('0x3b')](_0x15e37d,'')+_0x15e37d;_0x2e1b3a(null,_0x53f3ee);}})});router[_0x0a9e('0x23')]('/:id/offline',offlineUploadMulter[_0x0a9e('0x3c')](),controller[_0x0a9e('0x3d')]);router[_0x0a9e('0x23')](_0x0a9e('0x16'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x3e')]);router[_0x0a9e('0x23')](_0x0a9e('0x19'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x3f')]);router[_0x0a9e('0x23')](_0x0a9e('0x1b'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x40')]);router[_0x0a9e('0x23')]('/:id/users',auth['isAuthenticated'](),controller[_0x0a9e('0x41')]);router[_0x0a9e('0x42')](_0x0a9e('0x43'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x44')]);router[_0x0a9e('0x45')](_0x0a9e('0x43'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x46')]);router[_0x0a9e('0x45')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller['removeDispositions']);router[_0x0a9e('0x45')](_0x0a9e('0x26'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x47')]);router[_0x0a9e('0x45')](_0x0a9e('0x21'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x48')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index b2ac574..546aebb 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 _0x326f=['ENUM','AmazonAWS','Google','STRING','sequelize'];(function(_0x4641a5,_0x4a0da6){var _0x5de47d=function(_0x52bdc7){while(--_0x52bdc7){_0x4641a5['push'](_0x4641a5['shift']());}};_0x5de47d(++_0x4a0da6);}(_0x326f,0xd1));var _0xf326=function(_0x38f6f2,_0x5279a5){_0x38f6f2=_0x38f6f2-0x0;var _0x8b7e32=_0x326f[_0x38f6f2];return _0x8b7e32;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xf326('0x1')](_0xf326('0x2'),_0xf326('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xf326('0x4')]},'data2':{'type':Sequelize[_0xf326('0x4')]}}; \ No newline at end of file +var _0x0a6b=['AmazonAWS','STRING','sequelize'];(function(_0x2e26eb,_0x49afba){var _0x432e15=function(_0x30fcec){while(--_0x30fcec){_0x2e26eb['push'](_0x2e26eb['shift']());}};_0x432e15(++_0x49afba);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x1b6c2d,_0xf82360){_0x1b6c2d=_0x1b6c2d-0x0;var _0x513c25=_0x0a6b[_0x1b6c2d];return _0x513c25;};'use strict';var Sequelize=require(_0xb0a6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xb0a6('0x1'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xb0a6('0x2')]},'data2':{'type':Sequelize[_0xb0a6('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 9fef5fe..6571245 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 _0xd675=['../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','rawAttributes','fieldName','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','CloudProvider','includeAll','include','findAll','rows','catch','show','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x44d37e,_0x3596a1){var _0x2f6e50=function(_0x1fdf8e){while(--_0x1fdf8e){_0x44d37e['push'](_0x44d37e['shift']());}};_0x2f6e50(++_0x3596a1);}(_0xd675,0xbd));var _0x5d67=function(_0x26dd05,_0x135f80){_0x26dd05=_0x26dd05-0x0;var _0x5da547=_0xd675[_0x26dd05];return _0x5da547;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5d67('0x0'));var zipdir=require(_0x5d67('0x1'));var jsonpatch=require(_0x5d67('0x2'));var rp=require(_0x5d67('0x3'));var moment=require(_0x5d67('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5d67('0x5'));var util=require(_0x5d67('0x6'));var path=require(_0x5d67('0x7'));var sox=require(_0x5d67('0x8'));var csv=require(_0x5d67('0x9'));var ejs=require(_0x5d67('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5d67('0xb'));var squel=require(_0x5d67('0xc'));var crypto=require(_0x5d67('0xd'));var jsforce=require(_0x5d67('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5d67('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5d67('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5d67('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d67('0x11'))(_0x5d67('0x12'));var utils=require(_0x5d67('0x13'));var config=require(_0x5d67('0x14'));var licenseUtil=require(_0x5d67('0x15'));var db=require(_0x5d67('0x16'))['db'];function respondWithStatusCode(_0x328257,_0x1b970a){_0x1b970a=_0x1b970a||0xcc;return function(_0x2975fa){if(_0x2975fa){return _0x328257[_0x5d67('0x17')](_0x1b970a);}return _0x328257[_0x5d67('0x18')](_0x1b970a)['end']();};}function respondWithResult(_0x7de609,_0x106821){_0x106821=_0x106821||0xc8;return function(_0x3e16e4){if(_0x3e16e4){return _0x7de609[_0x5d67('0x18')](_0x106821)[_0x5d67('0x19')](_0x3e16e4);}};}function respondWithFilteredResult(_0x584e09,_0x2851ad){return function(_0x3e72eb){if(_0x3e72eb){var _0x40aba9=_0x3e72eb[_0x5d67('0x1a')],_0x2d79cb=_0x2851ad[_0x5d67('0x1b')],_0x2c8f82=_0x2851ad['offset']+_0x2851ad[_0x5d67('0x1c')],_0x41820e;if(_0x2c8f82>=_0x40aba9){_0x2c8f82=_0x40aba9;_0x41820e=0xc8;}else{_0x41820e=0xce;}_0x584e09[_0x5d67('0x18')](_0x41820e);return _0x584e09[_0x5d67('0x1d')](_0x5d67('0x1e'),_0x2d79cb+'-'+_0x2c8f82+'/'+_0x40aba9)[_0x5d67('0x19')](_0x3e72eb);}return null;};}function patchUpdates(_0x3ccd1c){return function(_0x1c9074){try{jsonpatch['apply'](_0x1c9074,_0x3ccd1c,!![]);}catch(_0x40297b){return BPromise[_0x5d67('0x1f')](_0x40297b);}return _0x1c9074[_0x5d67('0x20')]();};}function saveUpdates(_0x573904,_0x340637){return function(_0x2ffb13){if(_0x2ffb13){return _0x2ffb13['update'](_0x573904)[_0x5d67('0x21')](function(_0x57c6d0){return _0x57c6d0;});}return null;};}function removeEntity(_0x4312f7,_0x21f151){return function(_0x1d8e3d){if(_0x1d8e3d){return _0x1d8e3d[_0x5d67('0x22')]()[_0x5d67('0x21')](function(){_0x4312f7[_0x5d67('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46cf97,_0x47936c){return function(_0x46a099){if(!_0x46a099){_0x46cf97[_0x5d67('0x17')](0x194);}return _0x46a099;};}function handleError(_0x57b484,_0x494279){_0x494279=_0x494279||0x1f4;return function(_0x2a65f2){logger[_0x5d67('0x23')](_0x2a65f2[_0x5d67('0x24')]);if(_0x2a65f2[_0x5d67('0x25')]){delete _0x2a65f2['name'];}_0x57b484[_0x5d67('0x18')](_0x494279)[_0x5d67('0x26')](_0x2a65f2);};}exports['index']=function(_0x61f176,_0xf8f999){var _0x527d35={},_0x31ab45={},_0x11417e={'count':0x0,'rows':[]};var _0x2e9959=_['map'](db['CloudProvider'][_0x5d67('0x27')],function(_0x75e92b){return{'name':_0x75e92b[_0x5d67('0x28')],'type':_0x75e92b['type']['key']};});_0x31ab45[_0x5d67('0x29')]=_[_0x5d67('0x2a')](_0x2e9959,_0x5d67('0x25'));_0x31ab45['query']=_[_0x5d67('0x2b')](_0x61f176[_0x5d67('0x2c')]);_0x31ab45[_0x5d67('0x2d')]=_[_0x5d67('0x2e')](_0x31ab45[_0x5d67('0x29')],_0x31ab45['query']);_0x527d35[_0x5d67('0x2f')]=_[_0x5d67('0x2e')](_0x31ab45[_0x5d67('0x29')],qs[_0x5d67('0x30')](_0x61f176[_0x5d67('0x2c')][_0x5d67('0x30')]));_0x527d35['attributes']=_0x527d35['attributes'][_0x5d67('0x31')]?_0x527d35[_0x5d67('0x2f')]:_0x31ab45[_0x5d67('0x29')];if(!_0x61f176[_0x5d67('0x2c')]['hasOwnProperty'](_0x5d67('0x32'))){_0x527d35[_0x5d67('0x1c')]=qs['limit'](_0x61f176['query'][_0x5d67('0x1c')]);_0x527d35[_0x5d67('0x1b')]=qs['offset'](_0x61f176[_0x5d67('0x2c')][_0x5d67('0x1b')]);}_0x527d35[_0x5d67('0x33')]=qs[_0x5d67('0x34')](_0x61f176['query']['sort']);_0x527d35[_0x5d67('0x35')]=qs['filters'](_[_0x5d67('0x36')](_0x61f176[_0x5d67('0x2c')],_0x31ab45[_0x5d67('0x2d')]),_0x2e9959);if(_0x61f176['query'][_0x5d67('0x37')]){_0x527d35[_0x5d67('0x35')]=_['merge'](_0x527d35[_0x5d67('0x35')],{'$or':_['map'](_0x2e9959,function(_0x72027d){if(_0x72027d[_0x5d67('0x38')]!==_0x5d67('0x39')){var _0x35aa60={};_0x35aa60[_0x72027d[_0x5d67('0x25')]]={'$like':'%'+_0x61f176[_0x5d67('0x2c')][_0x5d67('0x37')]+'%'};return _0x35aa60;}})});}_0x527d35=_['merge']({},_0x527d35,_0x61f176[_0x5d67('0x3a')]);var _0x5cd829={'where':_0x527d35[_0x5d67('0x35')]};return db[_0x5d67('0x3b')][_0x5d67('0x1a')](_0x5cd829)[_0x5d67('0x21')](function(_0x48f8c7){_0x11417e[_0x5d67('0x1a')]=_0x48f8c7;if(_0x61f176[_0x5d67('0x2c')][_0x5d67('0x3c')]){_0x527d35[_0x5d67('0x3d')]=[{'all':!![]}];}return db[_0x5d67('0x3b')][_0x5d67('0x3e')](_0x527d35);})[_0x5d67('0x21')](function(_0x240d0e){_0x11417e[_0x5d67('0x3f')]=_0x240d0e;return _0x11417e;})[_0x5d67('0x21')](respondWithFilteredResult(_0xf8f999,_0x527d35))[_0x5d67('0x40')](handleError(_0xf8f999,null));};exports[_0x5d67('0x41')]=function(_0x477f2f,_0x11b5b3){var _0x387c4b={'raw':!![],'where':{'id':_0x477f2f['params']['id']}},_0xae732f={};_0xae732f[_0x5d67('0x29')]=_[_0x5d67('0x2b')](db['CloudProvider'][_0x5d67('0x27')]);_0xae732f['query']=_[_0x5d67('0x2b')](_0x477f2f[_0x5d67('0x2c')]);_0xae732f['filters']=_[_0x5d67('0x2e')](_0xae732f[_0x5d67('0x29')],_0xae732f[_0x5d67('0x2c')]);_0x387c4b['attributes']=_[_0x5d67('0x2e')](_0xae732f[_0x5d67('0x29')],qs[_0x5d67('0x30')](_0x477f2f[_0x5d67('0x2c')][_0x5d67('0x30')]));_0x387c4b[_0x5d67('0x2f')]=_0x387c4b[_0x5d67('0x2f')][_0x5d67('0x31')]?_0x387c4b[_0x5d67('0x2f')]:_0xae732f[_0x5d67('0x29')];if(_0x477f2f[_0x5d67('0x2c')]['includeAll']){_0x387c4b[_0x5d67('0x3d')]=[{'all':!![]}];}_0x387c4b=_['merge']({},_0x387c4b,_0x477f2f[_0x5d67('0x3a')]);return db[_0x5d67('0x3b')][_0x5d67('0x42')](_0x387c4b)['then'](handleEntityNotFound(_0x11b5b3,null))[_0x5d67('0x21')](respondWithResult(_0x11b5b3,null))[_0x5d67('0x40')](handleError(_0x11b5b3,null));};exports[_0x5d67('0x43')]=function(_0x5a37ce,_0x467ce8){return db[_0x5d67('0x3b')][_0x5d67('0x43')](_0x5a37ce[_0x5d67('0x44')],{})[_0x5d67('0x21')](respondWithResult(_0x467ce8,0xc9))['catch'](handleError(_0x467ce8,null));};exports['update']=function(_0x371d32,_0x3b92cb){if(_0x371d32[_0x5d67('0x44')]['id']){delete _0x371d32[_0x5d67('0x44')]['id'];}return db[_0x5d67('0x3b')]['find']({'where':{'id':_0x371d32['params']['id']}})[_0x5d67('0x21')](handleEntityNotFound(_0x3b92cb,null))['then'](saveUpdates(_0x371d32[_0x5d67('0x44')],null))[_0x5d67('0x21')](respondWithResult(_0x3b92cb,null))[_0x5d67('0x40')](handleError(_0x3b92cb,null));};exports[_0x5d67('0x22')]=function(_0x2fe821,_0x4947f1){return db['CloudProvider'][_0x5d67('0x42')]({'where':{'id':_0x2fe821[_0x5d67('0x45')]['id']}})[_0x5d67('0x21')](handleEntityNotFound(_0x4947f1,null))[_0x5d67('0x21')](removeEntity(_0x4947f1,null))[_0x5d67('0x40')](handleError(_0x4947f1,null));}; \ No newline at end of file +var _0x5a1a=['count','offset','limit','set','apply','reject','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filter','merge','options','CloudProvider','includeAll','include','findAll','catch','params','length','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x5a1a,0x6f));var _0xa5a1=function(_0x58952f,_0xeed25f){_0x58952f=_0x58952f-0x0;var _0x3217ca=_0x5a1a[_0x58952f];return _0x3217ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa5a1('0x0'));var zipdir=require(_0xa5a1('0x1'));var jsonpatch=require(_0xa5a1('0x2'));var rp=require(_0xa5a1('0x3'));var moment=require(_0xa5a1('0x4'));var BPromise=require(_0xa5a1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa5a1('0x6'));var csv=require('to-csv');var ejs=require(_0xa5a1('0x7'));var fs=require('fs');var fs_extra=require(_0xa5a1('0x8'));var _=require(_0xa5a1('0x9'));var squel=require(_0xa5a1('0xa'));var crypto=require(_0xa5a1('0xb'));var jsforce=require(_0xa5a1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa5a1('0xd'));var querystring=require(_0xa5a1('0xe'));var Papa=require(_0xa5a1('0xf'));var Redis=require(_0xa5a1('0x10'));var authService=require(_0xa5a1('0x11'));var qs=require(_0xa5a1('0x12'));var as=require(_0xa5a1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa5a1('0x14'))(_0xa5a1('0x15'));var utils=require(_0xa5a1('0x16'));var config=require(_0xa5a1('0x17'));var licenseUtil=require(_0xa5a1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2456d2,_0x384f5b){_0x384f5b=_0x384f5b||0xcc;return function(_0x3000c8){if(_0x3000c8){return _0x2456d2[_0xa5a1('0x19')](_0x384f5b);}return _0x2456d2[_0xa5a1('0x1a')](_0x384f5b)[_0xa5a1('0x1b')]();};}function respondWithResult(_0x31e31a,_0x2f7295){_0x2f7295=_0x2f7295||0xc8;return function(_0x10bd92){if(_0x10bd92){return _0x31e31a['status'](_0x2f7295)[_0xa5a1('0x1c')](_0x10bd92);}};}function respondWithFilteredResult(_0x35ceea,_0x1369ab){return function(_0x1711ca){if(_0x1711ca){var _0xda3387=_0x1711ca[_0xa5a1('0x1d')],_0x19bd00=_0x1369ab[_0xa5a1('0x1e')],_0x454c1c=_0x1369ab[_0xa5a1('0x1e')]+_0x1369ab[_0xa5a1('0x1f')],_0x36bbf6;if(_0x454c1c>=_0xda3387){_0x454c1c=_0xda3387;_0x36bbf6=0xc8;}else{_0x36bbf6=0xce;}_0x35ceea['status'](_0x36bbf6);return _0x35ceea[_0xa5a1('0x20')]('Content-Range',_0x19bd00+'-'+_0x454c1c+'/'+_0xda3387)['json'](_0x1711ca);}return null;};}function patchUpdates(_0x492447){return function(_0x2bdd52){try{jsonpatch[_0xa5a1('0x21')](_0x2bdd52,_0x492447,!![]);}catch(_0x4790b5){return BPromise[_0xa5a1('0x22')](_0x4790b5);}return _0x2bdd52['save']();};}function saveUpdates(_0x3837e9,_0x3d056e){return function(_0x4e24c2){if(_0x4e24c2){return _0x4e24c2['update'](_0x3837e9)[_0xa5a1('0x23')](function(_0x4b1e30){return _0x4b1e30;});}return null;};}function removeEntity(_0x261112,_0x344e66){return function(_0x3692ac){if(_0x3692ac){return _0x3692ac[_0xa5a1('0x24')]()['then'](function(){_0x261112[_0xa5a1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1676d3,_0x362d09){return function(_0x1b06ad){if(!_0x1b06ad){_0x1676d3[_0xa5a1('0x19')](0x194);}return _0x1b06ad;};}function handleError(_0x4ea899,_0x3b9bd3){_0x3b9bd3=_0x3b9bd3||0x1f4;return function(_0xe7b5de){logger[_0xa5a1('0x25')](_0xe7b5de['stack']);if(_0xe7b5de[_0xa5a1('0x26')]){delete _0xe7b5de[_0xa5a1('0x26')];}_0x4ea899['status'](_0x3b9bd3)[_0xa5a1('0x27')](_0xe7b5de);};}exports[_0xa5a1('0x28')]=function(_0x4c5e10,_0x48f9a6){var _0x3f3652={},_0x5f456b={},_0x392581={'count':0x0,'rows':[]};var _0x487528=_[_0xa5a1('0x29')](db['CloudProvider'][_0xa5a1('0x2a')],function(_0x272dc0){return{'name':_0x272dc0[_0xa5a1('0x2b')],'type':_0x272dc0[_0xa5a1('0x2c')][_0xa5a1('0x2d')]};});_0x5f456b[_0xa5a1('0x2e')]=_['map'](_0x487528,_0xa5a1('0x26'));_0x5f456b[_0xa5a1('0x2f')]=_[_0xa5a1('0x30')](_0x4c5e10[_0xa5a1('0x2f')]);_0x5f456b[_0xa5a1('0x31')]=_[_0xa5a1('0x32')](_0x5f456b[_0xa5a1('0x2e')],_0x5f456b[_0xa5a1('0x2f')]);_0x3f3652[_0xa5a1('0x33')]=_['intersection'](_0x5f456b['model'],qs[_0xa5a1('0x34')](_0x4c5e10[_0xa5a1('0x2f')][_0xa5a1('0x34')]));_0x3f3652[_0xa5a1('0x33')]=_0x3f3652['attributes']['length']?_0x3f3652[_0xa5a1('0x33')]:_0x5f456b[_0xa5a1('0x2e')];if(!_0x4c5e10['query'][_0xa5a1('0x35')](_0xa5a1('0x36'))){_0x3f3652[_0xa5a1('0x1f')]=qs['limit'](_0x4c5e10[_0xa5a1('0x2f')][_0xa5a1('0x1f')]);_0x3f3652[_0xa5a1('0x1e')]=qs[_0xa5a1('0x1e')](_0x4c5e10['query'][_0xa5a1('0x1e')]);}_0x3f3652[_0xa5a1('0x37')]=qs['sort'](_0x4c5e10[_0xa5a1('0x2f')]['sort']);_0x3f3652[_0xa5a1('0x38')]=qs[_0xa5a1('0x31')](_['pick'](_0x4c5e10[_0xa5a1('0x2f')],_0x5f456b[_0xa5a1('0x31')]),_0x487528);if(_0x4c5e10[_0xa5a1('0x2f')][_0xa5a1('0x39')]){_0x3f3652[_0xa5a1('0x38')]=_['merge'](_0x3f3652[_0xa5a1('0x38')],{'$or':_[_0xa5a1('0x29')](_0x487528,function(_0x2436e5){if(_0x2436e5[_0xa5a1('0x2c')]!=='VIRTUAL'){var _0x392d6b={};_0x392d6b[_0x2436e5[_0xa5a1('0x26')]]={'$like':'%'+_0x4c5e10['query'][_0xa5a1('0x39')]+'%'};return _0x392d6b;}})});}_0x3f3652=_[_0xa5a1('0x3a')]({},_0x3f3652,_0x4c5e10[_0xa5a1('0x3b')]);var _0x550cc9={'where':_0x3f3652[_0xa5a1('0x38')]};return db[_0xa5a1('0x3c')][_0xa5a1('0x1d')](_0x550cc9)['then'](function(_0x2d0520){_0x392581[_0xa5a1('0x1d')]=_0x2d0520;if(_0x4c5e10[_0xa5a1('0x2f')][_0xa5a1('0x3d')]){_0x3f3652[_0xa5a1('0x3e')]=[{'all':!![]}];}return db['CloudProvider'][_0xa5a1('0x3f')](_0x3f3652);})[_0xa5a1('0x23')](function(_0x29a1a9){_0x392581['rows']=_0x29a1a9;return _0x392581;})[_0xa5a1('0x23')](respondWithFilteredResult(_0x48f9a6,_0x3f3652))[_0xa5a1('0x40')](handleError(_0x48f9a6,null));};exports['show']=function(_0x3c1c4b,_0x2de5ec){var _0x4ef97c={'raw':!![],'where':{'id':_0x3c1c4b[_0xa5a1('0x41')]['id']}},_0x5b93a6={};_0x5b93a6['model']=_['keys'](db['CloudProvider']['rawAttributes']);_0x5b93a6[_0xa5a1('0x2f')]=_[_0xa5a1('0x30')](_0x3c1c4b['query']);_0x5b93a6[_0xa5a1('0x31')]=_[_0xa5a1('0x32')](_0x5b93a6[_0xa5a1('0x2e')],_0x5b93a6['query']);_0x4ef97c[_0xa5a1('0x33')]=_[_0xa5a1('0x32')](_0x5b93a6[_0xa5a1('0x2e')],qs['fields'](_0x3c1c4b[_0xa5a1('0x2f')][_0xa5a1('0x34')]));_0x4ef97c[_0xa5a1('0x33')]=_0x4ef97c[_0xa5a1('0x33')][_0xa5a1('0x42')]?_0x4ef97c[_0xa5a1('0x33')]:_0x5b93a6[_0xa5a1('0x2e')];if(_0x3c1c4b[_0xa5a1('0x2f')]['includeAll']){_0x4ef97c[_0xa5a1('0x3e')]=[{'all':!![]}];}_0x4ef97c=_['merge']({},_0x4ef97c,_0x3c1c4b[_0xa5a1('0x3b')]);return db['CloudProvider']['find'](_0x4ef97c)[_0xa5a1('0x23')](handleEntityNotFound(_0x2de5ec,null))[_0xa5a1('0x23')](respondWithResult(_0x2de5ec,null))[_0xa5a1('0x40')](handleError(_0x2de5ec,null));};exports[_0xa5a1('0x43')]=function(_0xeeb38b,_0x3d44a0){return db[_0xa5a1('0x3c')][_0xa5a1('0x43')](_0xeeb38b['body'],{})[_0xa5a1('0x23')](respondWithResult(_0x3d44a0,0xc9))['catch'](handleError(_0x3d44a0,null));};exports['update']=function(_0x4f0041,_0x21e4b1){if(_0x4f0041[_0xa5a1('0x44')]['id']){delete _0x4f0041['body']['id'];}return db[_0xa5a1('0x3c')]['find']({'where':{'id':_0x4f0041['params']['id']}})[_0xa5a1('0x23')](handleEntityNotFound(_0x21e4b1,null))[_0xa5a1('0x23')](saveUpdates(_0x4f0041['body'],null))[_0xa5a1('0x23')](respondWithResult(_0x21e4b1,null))[_0xa5a1('0x40')](handleError(_0x21e4b1,null));};exports[_0xa5a1('0x24')]=function(_0xfb161a,_0x273025){return db[_0xa5a1('0x3c')][_0xa5a1('0x45')]({'where':{'id':_0xfb161a[_0xa5a1('0x41')]['id']}})[_0xa5a1('0x23')](handleEntityNotFound(_0x273025,null))['then'](removeEntity(_0x273025,null))[_0xa5a1('0x40')](handleError(_0x273025,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 7163112..29a6848 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 _0xbfea=['CloudProvider','cloud_providers','api','moment','path','rimraf','../../config/environment','./cloudProvider.attributes','define'];(function(_0x54ea7a,_0x19df9b){var _0x65a10d=function(_0x1bf936){while(--_0x1bf936){_0x54ea7a['push'](_0x54ea7a['shift']());}};_0x65a10d(++_0x19df9b);}(_0xbfea,0x77));var _0xabfe=function(_0x428553,_0x3411b6){_0x428553=_0x428553-0x0;var _0x2a3fc7=_0xbfea[_0x428553];return _0x2a3fc7;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xabfe('0x0'));var moment=require(_0xabfe('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xabfe('0x2'));var rimraf=require(_0xabfe('0x3'));var config=require(_0xabfe('0x4'));var attributes=require(_0xabfe('0x5'));module['exports']=function(_0x5555d7,_0x19eb7a){return _0x5555d7[_0xabfe('0x6')](_0xabfe('0x7'),attributes,{'tableName':_0xabfe('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71a9=['define','CloudProvider','cloud_providers','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cloudProvider.attributes','exports'];(function(_0x47c958,_0x3cfe09){var _0x573eab=function(_0x380ec6){while(--_0x380ec6){_0x47c958['push'](_0x47c958['shift']());}};_0x573eab(++_0x3cfe09);}(_0x71a9,0x1b3));var _0x971a=function(_0x59400c,_0x364897){_0x59400c=_0x59400c-0x0;var _0x51508d=_0x71a9[_0x59400c];return _0x51508d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x971a('0x0'))(_0x971a('0x1'));var moment=require(_0x971a('0x2'));var BPromise=require(_0x971a('0x3'));var rp=require(_0x971a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x971a('0x5'));var config=require(_0x971a('0x6'));var attributes=require(_0x971a('0x7'));module[_0x971a('0x8')]=function(_0x7fe8e3,_0xec8c9f){return _0x7fe8e3[_0x971a('0x9')](_0x971a('0xa'),attributes,{'tableName':_0x971a('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 6ea48f3..abced48 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 _0x7584=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','request\x20sent','error','code','message','CloudProvider,\x20%s,\x20%s','result','catch'];(function(_0x2a1ff8,_0x1e6efe){var _0x5dadad=function(_0x50d293){while(--_0x50d293){_0x2a1ff8['push'](_0x2a1ff8['shift']());}};_0x5dadad(++_0x1e6efe);}(_0x7584,0xd1));var _0x4758=function(_0x22434b,_0x4f0f71){_0x22434b=_0x22434b-0x0;var _0x23b28d=_0x7584[_0x22434b];return _0x23b28d;};'use strict';var _=require(_0x4758('0x0'));var util=require(_0x4758('0x1'));var moment=require(_0x4758('0x2'));var BPromise=require(_0x4758('0x3'));var rs=require(_0x4758('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4758('0x5'))['db'];var utils=require(_0x4758('0x6'));var logger=require(_0x4758('0x7'))(_0x4758('0x8'));var config=require('../../config/environment');var jayson=require(_0x4758('0x9'));var client=jayson[_0x4758('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5086c0,_0x263990,_0xed9855){return new BPromise(function(_0x4491a6,_0x1b6d0f){return client['request'](_0x5086c0,_0xed9855)['then'](function(_0xf0b91){logger[_0x4758('0xb')]('CloudProvider,\x20%s,\x20%s',_0x263990,_0x4758('0xc'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x263990,'request\x20sent',JSON['stringify'](_0xf0b91));if(_0xf0b91[_0x4758('0xd')]){if(_0xf0b91[_0x4758('0xd')][_0x4758('0xe')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x263990,_0xf0b91[_0x4758('0xd')][_0x4758('0xf')]);return _0x1b6d0f(_0xf0b91['error']['message']);}logger[_0x4758('0xd')](_0x4758('0x10'),_0x263990,_0xf0b91['error']['message']);return _0x4491a6(_0xf0b91['error'][_0x4758('0xf')]);}else{logger[_0x4758('0xb')]('CloudProvider,\x20%s,\x20%s',_0x263990,_0x4758('0xc'));_0x4491a6(_0xf0b91[_0x4758('0x11')][_0x4758('0xf')]);}})[_0x4758('0x12')](function(_0x2bdb59){logger[_0x4758('0xd')](_0x4758('0x10'),_0x263990,_0x2bdb59);_0x1b6d0f(_0x2bdb59);});});} \ No newline at end of file +var _0x41a7=['message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x1ab245,_0x51dc80){var _0x41c28e=function(_0xcc1dc1){while(--_0xcc1dc1){_0x1ab245['push'](_0x1ab245['shift']());}};_0x41c28e(++_0x51dc80);}(_0x41a7,0x13e));var _0x741a=function(_0x40a8a8,_0x1b7a07){_0x40a8a8=_0x40a8a8-0x0;var _0x343249=_0x41a7[_0x40a8a8];return _0x343249;};'use strict';var _=require('lodash');var util=require(_0x741a('0x0'));var moment=require('moment');var BPromise=require(_0x741a('0x1'));var rs=require(_0x741a('0x2'));var fs=require('fs');var Redis=require(_0x741a('0x3'));var db=require(_0x741a('0x4'))['db'];var utils=require(_0x741a('0x5'));var logger=require(_0x741a('0x6'))(_0x741a('0x7'));var config=require(_0x741a('0x8'));var jayson=require(_0x741a('0x9'));var client=jayson[_0x741a('0xa')][_0x741a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x229fb7,_0x1d2646,_0xb805a5){return new BPromise(function(_0x16cea6,_0x71063a){return client['request'](_0x229fb7,_0xb805a5)[_0x741a('0xc')](function(_0x56dc13){logger[_0x741a('0xd')](_0x741a('0xe'),_0x1d2646,_0x741a('0xf'));logger[_0x741a('0x10')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x1d2646,_0x741a('0xf'),JSON['stringify'](_0x56dc13));if(_0x56dc13['error']){if(_0x56dc13[_0x741a('0x11')]['code']===0x1f4){logger[_0x741a('0x11')](_0x741a('0xe'),_0x1d2646,_0x56dc13['error'][_0x741a('0x12')]);return _0x71063a(_0x56dc13['error'][_0x741a('0x12')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x1d2646,_0x56dc13[_0x741a('0x11')]['message']);return _0x16cea6(_0x56dc13[_0x741a('0x11')][_0x741a('0x12')]);}else{logger[_0x741a('0xd')](_0x741a('0xe'),_0x1d2646,_0x741a('0xf'));_0x16cea6(_0x56dc13[_0x741a('0x13')][_0x741a('0x12')]);}})[_0x741a('0x14')](function(_0x2f915d){logger[_0x741a('0x11')](_0x741a('0xe'),_0x1d2646,_0x2f915d);_0x71063a(_0x2f915d);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 39b80dd..daf1ce5 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 _0x2bf4=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','create','put','delete','destroy','exports','multer','path'];(function(_0x56f01f,_0x2fc484){var _0x589fde=function(_0x295527){while(--_0x295527){_0x56f01f['push'](_0x56f01f['shift']());}};_0x589fde(++_0x2fc484);}(_0x2bf4,0x1da));var _0x42bf=function(_0x28ad8b,_0x47975a){_0x28ad8b=_0x28ad8b-0x0;var _0x30d0b9=_0x2bf4[_0x28ad8b];return _0x30d0b9;};'use strict';var multer=require(_0x42bf('0x0'));var util=require('util');var path=require(_0x42bf('0x1'));var timeout=require('connect-timeout');var express=require(_0x42bf('0x2'));var router=express[_0x42bf('0x3')]();var fs_extra=require(_0x42bf('0x4'));var auth=require(_0x42bf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x42bf('0x6'));var controller=require(_0x42bf('0x7'));router[_0x42bf('0x8')]('/',auth[_0x42bf('0x9')](),controller[_0x42bf('0xa')]);router[_0x42bf('0x8')](_0x42bf('0xb'),auth[_0x42bf('0x9')](),controller['show']);router['post']('/',auth[_0x42bf('0x9')](),controller[_0x42bf('0xc')]);router[_0x42bf('0xd')]('/:id',auth[_0x42bf('0x9')](),controller['update']);router[_0x42bf('0xe')](_0x42bf('0xb'),auth[_0x42bf('0x9')](),controller[_0x42bf('0xf')]);module[_0x42bf('0x10')]=router; \ No newline at end of file +var _0x3e1d=['delete','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','index','/:id','show','post','put','isAuthenticated'];(function(_0x4f38b4,_0x757c26){var _0x137f2c=function(_0x387b05){while(--_0x387b05){_0x4f38b4['push'](_0x4f38b4['shift']());}};_0x137f2c(++_0x757c26);}(_0x3e1d,0x91));var _0xd3e1=function(_0x55f122,_0x56edaf){_0x55f122=_0x55f122-0x0;var _0x1a28d6=_0x3e1d[_0x55f122];return _0x1a28d6;};'use strict';var multer=require(_0xd3e1('0x0'));var util=require(_0xd3e1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd3e1('0x2'));var router=express[_0xd3e1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd3e1('0x4'));var interaction=require(_0xd3e1('0x5'));var config=require(_0xd3e1('0x6'));var controller=require(_0xd3e1('0x7'));router[_0xd3e1('0x8')]('/',auth['isAuthenticated'](),controller[_0xd3e1('0x9')]);router[_0xd3e1('0x8')](_0xd3e1('0xa'),auth['isAuthenticated'](),controller[_0xd3e1('0xb')]);router[_0xd3e1('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd3e1('0xd')]('/:id',auth[_0xd3e1('0xe')](),controller['update']);router[_0xd3e1('0xf')](_0xd3e1('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index d461e09..3933fdd 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 _0x430c=['name','sequelize','STRING'];(function(_0x29aa2b,_0xc881f8){var _0x119039=function(_0x1cbf22){while(--_0x1cbf22){_0x29aa2b['push'](_0x29aa2b['shift']());}};_0x119039(++_0xc881f8);}(_0x430c,0x1de));var _0xc430=function(_0x562faa,_0x23adc7){_0x562faa=_0x562faa-0x0;var _0xc70f59=_0x430c[_0x562faa];return _0xc70f59;};'use strict';var Sequelize=require(_0xc430('0x0'));module['exports']={'name':{'type':Sequelize[_0xc430('0x1')],'unique':_0xc430('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xc430('0x1')]},'companyId':{'type':Sequelize[_0xc430('0x1')]},'website':{'type':Sequelize[_0xc430('0x1')]},'phone':{'type':Sequelize[_0xc430('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc430('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xc430('0x1')]},'country':{'type':Sequelize[_0xc430('0x1')]},'email':{'type':Sequelize[_0xc430('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xc430('0x1')]},'sStreet':{'type':Sequelize[_0xc430('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xc430('0x1')]},'sCountry':{'type':Sequelize[_0xc430('0x1')]},'description':{'type':Sequelize[_0xc430('0x1')]}}; \ No newline at end of file +var _0xa2b3=['name','sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa2b3,0x1c5));var _0x3a2b=function(_0x3d1b4a,_0x5d749){_0x3d1b4a=_0x3d1b4a-0x0;var _0x6f80bc=_0xa2b3[_0x3d1b4a];return _0x6f80bc;};'use strict';var Sequelize=require(_0x3a2b('0x0'));module[_0x3a2b('0x1')]={'name':{'type':Sequelize[_0x3a2b('0x2')],'unique':_0x3a2b('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x3a2b('0x2')]},'website':{'type':Sequelize[_0x3a2b('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3a2b('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x3a2b('0x2')]},'city':{'type':Sequelize[_0x3a2b('0x2')]},'country':{'type':Sequelize[_0x3a2b('0x2')]},'email':{'type':Sequelize[_0x3a2b('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x3a2b('0x2')]},'sStreet':{'type':Sequelize[_0x3a2b('0x2')]},'sPostalCode':{'type':Sequelize[_0x3a2b('0x2')]},'sCity':{'type':Sequelize[_0x3a2b('0x2')]},'sCountry':{'type':Sequelize[_0x3a2b('0x2')]},'description':{'type':Sequelize[_0x3a2b('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 8582acb..0062894 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 _0xba0d=['request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','apply','reject','save','update','then','get','Companies','UserProfileResource','destroy','sendStatus','error','name','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','map','options','count','includeAll','include','findAll','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','omit','getContacts','rawAttributes','rimraf','zip-dir','fast-json-patch'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0xba0d,0x1a1));var _0xdba0=function(_0x2571f3,_0x117742){_0x2571f3=_0x2571f3-0x0;var _0xeddb4a=_0xba0d[_0x2571f3];return _0xeddb4a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdba0('0x0'));var zipdir=require(_0xdba0('0x1'));var jsonpatch=require(_0xdba0('0x2'));var rp=require(_0xdba0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdba0('0x4'));var util=require(_0xdba0('0x5'));var path=require(_0xdba0('0x6'));var sox=require(_0xdba0('0x7'));var csv=require('to-csv');var ejs=require(_0xdba0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdba0('0x9'));var squel=require(_0xdba0('0xa'));var crypto=require(_0xdba0('0xb'));var jsforce=require(_0xdba0('0xc'));var deskjs=require(_0xdba0('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdba0('0xe'));var Papa=require(_0xdba0('0xf'));var Redis=require(_0xdba0('0x10'));var authService=require(_0xdba0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdba0('0x12'));var hardwareService=require(_0xdba0('0x13'));var logger=require(_0xdba0('0x14'))('api');var utils=require(_0xdba0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdba0('0x16'));var db=require(_0xdba0('0x17'))['db'];function respondWithStatusCode(_0xe1eabb,_0x3d36d9){_0x3d36d9=_0x3d36d9||0xcc;return function(_0x380694){if(_0x380694){return _0xe1eabb['sendStatus'](_0x3d36d9);}return _0xe1eabb[_0xdba0('0x18')](_0x3d36d9)[_0xdba0('0x19')]();};}function respondWithResult(_0x34c271,_0x1ea4f2){_0x1ea4f2=_0x1ea4f2||0xc8;return function(_0x261c2c){if(_0x261c2c){return _0x34c271[_0xdba0('0x18')](_0x1ea4f2)[_0xdba0('0x1a')](_0x261c2c);}};}function respondWithFilteredResult(_0x36ff52,_0x176c8c){return function(_0x1942a9){if(_0x1942a9){var _0x25ce54=_0x1942a9['count'],_0x5d6b58=_0x176c8c[_0xdba0('0x1b')],_0x5e078=_0x176c8c[_0xdba0('0x1b')]+_0x176c8c[_0xdba0('0x1c')],_0x129cff;if(_0x5e078>=_0x25ce54){_0x5e078=_0x25ce54;_0x129cff=0xc8;}else{_0x129cff=0xce;}_0x36ff52['status'](_0x129cff);return _0x36ff52[_0xdba0('0x1d')]('Content-Range',_0x5d6b58+'-'+_0x5e078+'/'+_0x25ce54)['json'](_0x1942a9);}return null;};}function patchUpdates(_0x2b03dd){return function(_0x20fd27){try{jsonpatch[_0xdba0('0x1e')](_0x20fd27,_0x2b03dd,!![]);}catch(_0x58ea85){return BPromise[_0xdba0('0x1f')](_0x58ea85);}return _0x20fd27[_0xdba0('0x20')]();};}function saveUpdates(_0x481fef,_0x226ac5){return function(_0x9424d8){if(_0x9424d8){return _0x9424d8[_0xdba0('0x21')](_0x481fef)[_0xdba0('0x22')](function(_0x142f95){return _0x142f95;});}return null;};}function removeEntity(_0x319302,_0x5ed621){return function(_0x1d7ebf){if(_0x1d7ebf){return _0x1d7ebf['destroy']()[_0xdba0('0x22')](function(){var _0x43233f=_0x1d7ebf[_0xdba0('0x23')]({'plain':!![]});var _0x4d0d56=_0xdba0('0x24');return db[_0xdba0('0x25')][_0xdba0('0x26')]({'where':{'type':_0x4d0d56,'resourceId':_0x43233f['id']}})[_0xdba0('0x22')](function(){return _0x1d7ebf;});})[_0xdba0('0x22')](function(){_0x319302[_0xdba0('0x18')](0xcc)[_0xdba0('0x19')]();});}};}function handleEntityNotFound(_0x25248e,_0x230a80){return function(_0x2aafb2){if(!_0x2aafb2){_0x25248e[_0xdba0('0x27')](0x194);}return _0x2aafb2;};}function handleError(_0x1431de,_0x234af4){_0x234af4=_0x234af4||0x1f4;return function(_0x45155f){logger[_0xdba0('0x28')](_0x45155f['stack']);if(_0x45155f[_0xdba0('0x29')]){delete _0x45155f[_0xdba0('0x29')];}_0x1431de[_0xdba0('0x18')](_0x234af4)['send'](_0x45155f);};}exports[_0xdba0('0x2a')]=function(_0xedd271,_0x1591b0){var _0x3bc196={},_0x1d15ba={},_0x5c6a30={'count':0x0,'rows':[]};return db[_0xdba0('0x2b')][_0xdba0('0x2c')]()['then'](function(_0x5636b){_0x1d15ba[_0xdba0('0x2d')]=_[_0xdba0('0x2e')](_0x5636b);_0x1d15ba['query']=_['keys'](_0xedd271[_0xdba0('0x2f')]);_0x1d15ba[_0xdba0('0x30')]=_[_0xdba0('0x31')](_0x1d15ba[_0xdba0('0x2d')],_0x1d15ba[_0xdba0('0x2f')]);_0x3bc196[_0xdba0('0x32')]=_['intersection'](_0x1d15ba[_0xdba0('0x2d')],qs[_0xdba0('0x33')](_0xedd271[_0xdba0('0x2f')][_0xdba0('0x33')]));_0x3bc196[_0xdba0('0x32')]=_0x3bc196[_0xdba0('0x32')][_0xdba0('0x34')]?_0x3bc196[_0xdba0('0x32')]:_0x1d15ba[_0xdba0('0x2d')];if(!_0xedd271[_0xdba0('0x2f')][_0xdba0('0x35')](_0xdba0('0x36'))){_0x3bc196[_0xdba0('0x1c')]=qs[_0xdba0('0x1c')](_0xedd271[_0xdba0('0x2f')][_0xdba0('0x1c')]);_0x3bc196[_0xdba0('0x1b')]=qs['offset'](_0xedd271[_0xdba0('0x2f')][_0xdba0('0x1b')]);}_0x3bc196[_0xdba0('0x37')]=qs[_0xdba0('0x38')](_0xedd271[_0xdba0('0x2f')][_0xdba0('0x38')]);_0x3bc196['where']=qs[_0xdba0('0x30')](_[_0xdba0('0x39')](_0xedd271[_0xdba0('0x2f')],_0x1d15ba[_0xdba0('0x30')]),_0x5636b);if(_0xedd271[_0xdba0('0x2f')][_0xdba0('0x3a')]){_0x3bc196['where']=_[_0xdba0('0x3b')](_0x3bc196[_0xdba0('0x3c')],{'$or':_[_0xdba0('0x3d')](_0x3bc196[_0xdba0('0x32')],function(_0x55a05b){var _0x3558dd={};_0x3558dd[_0x55a05b]={'$like':'%'+_0xedd271[_0xdba0('0x2f')][_0xdba0('0x3a')]+'%'};return _0x3558dd;})});}_0x3bc196=_[_0xdba0('0x3b')]({},_0x3bc196,_0xedd271[_0xdba0('0x3e')]);var _0x1d74ca={'where':_0x3bc196['where']};return db['CmCompany']['count'](_0x1d74ca)[_0xdba0('0x22')](function(_0x304d93){_0x5c6a30[_0xdba0('0x3f')]=_0x304d93;if(_0xedd271['query'][_0xdba0('0x40')]){_0x3bc196[_0xdba0('0x41')]=[{'all':!![]}];}return db['CmCompany'][_0xdba0('0x42')](_0x3bc196);})[_0xdba0('0x22')](function(_0xf07d4f){_0x5c6a30['rows']=_0xf07d4f;return _0x5c6a30;})['then'](respondWithFilteredResult(_0x1591b0,_0x3bc196))[_0xdba0('0x43')](handleError(_0x1591b0,null));})[_0xdba0('0x43')](handleError(_0x1591b0,null));};exports['show']=function(_0xfc6bce,_0x6758f3){var _0x42eeb6={'raw':![],'where':{'id':_0xfc6bce[_0xdba0('0x44')]['id']}},_0x2083c6={};_0x2083c6[_0xdba0('0x2d')]=_[_0xdba0('0x2e')](db['CmCompany']['rawAttributes']);_0x2083c6['query']=_['keys'](_0xfc6bce[_0xdba0('0x2f')]);_0x2083c6[_0xdba0('0x30')]=_['intersection'](_0x2083c6[_0xdba0('0x2d')],_0x2083c6['query']);_0x42eeb6[_0xdba0('0x32')]=_[_0xdba0('0x31')](_0x2083c6[_0xdba0('0x2d')],qs['fields'](_0xfc6bce[_0xdba0('0x2f')][_0xdba0('0x33')]));_0x42eeb6['attributes']=_0x42eeb6['attributes']['length']?_0x42eeb6[_0xdba0('0x32')]:_0x2083c6[_0xdba0('0x2d')];if(_0xfc6bce['query'][_0xdba0('0x40')]){_0x42eeb6[_0xdba0('0x41')]=[{'all':!![]}];}_0x42eeb6=_[_0xdba0('0x3b')]({},_0x42eeb6,_0xfc6bce[_0xdba0('0x3e')]);return db[_0xdba0('0x2b')][_0xdba0('0x45')](_0x42eeb6)[_0xdba0('0x22')](handleEntityNotFound(_0x6758f3,null))[_0xdba0('0x22')](respondWithResult(_0x6758f3,null))['catch'](handleError(_0x6758f3,null));};exports['create']=function(_0x163414,_0x1532b7){return db[_0xdba0('0x2b')][_0xdba0('0x46')](_0x163414[_0xdba0('0x47')],{})['then'](function(_0x26aeb2){var _0x321f7a=_0x163414[_0xdba0('0x48')]['get']({'plain':!![]});if(!_0x321f7a)throw new Error(_0xdba0('0x49'));if(_0x321f7a[_0xdba0('0x4a')]===_0xdba0('0x48')){var _0xcfd732=_0x26aeb2['get']({'plain':!![]});var _0x1be591='Companies';return db[_0xdba0('0x4b')][_0xdba0('0x45')]({'where':{'name':_0x1be591,'userProfileId':_0x321f7a[_0xdba0('0x4c')]},'raw':!![]})['then'](function(_0x2f737c){if(_0x2f737c&&_0x2f737c[_0xdba0('0x4d')]===0x0){return db[_0xdba0('0x25')][_0xdba0('0x46')]({'name':_0xcfd732[_0xdba0('0x29')],'resourceId':_0xcfd732['id'],'type':_0x2f737c[_0xdba0('0x29')],'sectionId':_0x2f737c['id']},{})[_0xdba0('0x22')](function(){return _0x26aeb2;});}else{return _0x26aeb2;}})['catch'](function(_0x1ca4fd){logger[_0xdba0('0x28')](_0xdba0('0x4e'),_0x1ca4fd);throw _0x1ca4fd;});}return _0x26aeb2;})[_0xdba0('0x22')](respondWithResult(_0x1532b7,0xc9))[_0xdba0('0x43')](handleError(_0x1532b7,null));};exports[_0xdba0('0x21')]=function(_0x4170e6,_0x3dec92){if(_0x4170e6[_0xdba0('0x47')]['id']){delete _0x4170e6[_0xdba0('0x47')]['id'];}return db['CmCompany'][_0xdba0('0x45')]({'where':{'id':_0x4170e6[_0xdba0('0x44')]['id']}})[_0xdba0('0x22')](handleEntityNotFound(_0x3dec92,null))[_0xdba0('0x22')](saveUpdates(_0x4170e6[_0xdba0('0x47')],null))[_0xdba0('0x22')](respondWithResult(_0x3dec92,null))['catch'](handleError(_0x3dec92,null));};exports[_0xdba0('0x26')]=function(_0x5dfd0b,_0x5ef4a9){return db[_0xdba0('0x2b')][_0xdba0('0x45')]({'where':{'id':_0x5dfd0b[_0xdba0('0x44')]['id']}})[_0xdba0('0x22')](handleEntityNotFound(_0x5ef4a9,null))[_0xdba0('0x22')](removeEntity(_0x5ef4a9,null))[_0xdba0('0x43')](handleError(_0x5ef4a9,null));};exports[_0xdba0('0x2c')]=function(_0x2370ec,_0x1f0d7f){return db[_0xdba0('0x2b')][_0xdba0('0x2c')]()[_0xdba0('0x22')](respondWithResult(_0x1f0d7f,null))['catch'](handleError(_0x1f0d7f,null));};exports[_0xdba0('0x4f')]=function(_0x3acff5,_0x4573ef,_0x595f11){return db['CmContact'][_0xdba0('0x45')]({'where':{'id':_0x3acff5[_0xdba0('0x44')]['id']}})[_0xdba0('0x22')](handleEntityNotFound(_0x4573ef,null))[_0xdba0('0x22')](function(_0x2ba5de){if(_0x2ba5de){return _0x2ba5de[_0xdba0('0x4f')](_0x3acff5[_0xdba0('0x47')][_0xdba0('0x50')],_[_0xdba0('0x51')](_0x3acff5[_0xdba0('0x47')],['ids','id'])||{});}})[_0xdba0('0x22')](respondWithResult(_0x4573ef,null))[_0xdba0('0x43')](handleError(_0x4573ef,null));};exports[_0xdba0('0x52')]=function(_0x3c5088,_0xf8aa8,_0x4f7d90){var _0x64166c={};var _0x39beb8={};var _0x5e1425;var _0x49af0f;return db[_0xdba0('0x2b')]['findOne']({'where':{'id':_0x3c5088['params']['id']}})[_0xdba0('0x22')](handleEntityNotFound(_0xf8aa8,null))[_0xdba0('0x22')](function(_0x4b2163){if(_0x4b2163){_0x5e1425=_0x4b2163;_0x39beb8[_0xdba0('0x2d')]=_[_0xdba0('0x2e')](db['CmContact'][_0xdba0('0x53')]);_0x39beb8['query']=_[_0xdba0('0x2e')](_0x3c5088[_0xdba0('0x2f')]);_0x39beb8['filters']=_[_0xdba0('0x31')](_0x39beb8[_0xdba0('0x2d')],_0x39beb8['query']);_0x64166c[_0xdba0('0x32')]=_[_0xdba0('0x31')](_0x39beb8[_0xdba0('0x2d')],qs[_0xdba0('0x33')](_0x3c5088[_0xdba0('0x2f')][_0xdba0('0x33')]));_0x64166c['attributes']=_0x64166c['attributes'][_0xdba0('0x34')]?_0x64166c[_0xdba0('0x32')]:_0x39beb8[_0xdba0('0x2d')];_0x64166c['order']=qs[_0xdba0('0x38')](_0x3c5088[_0xdba0('0x2f')]['sort']);_0x64166c[_0xdba0('0x3c')]=qs[_0xdba0('0x30')](_[_0xdba0('0x39')](_0x3c5088[_0xdba0('0x2f')],_0x39beb8[_0xdba0('0x30')]));if(_0x3c5088[_0xdba0('0x2f')]['filter']){_0x64166c['where']=_[_0xdba0('0x3b')](_0x64166c[_0xdba0('0x3c')],{'$or':_[_0xdba0('0x3d')](_0x64166c[_0xdba0('0x32')],function(_0x57246a){var _0x858254={};_0x858254[_0x57246a]={'$like':'%'+_0x3c5088[_0xdba0('0x2f')][_0xdba0('0x3a')]+'%'};return _0x858254;})});}_0x64166c=_[_0xdba0('0x3b')]({},_0x64166c,_0x3c5088[_0xdba0('0x3e')]);return _0x5e1425[_0xdba0('0x52')](_0x64166c);}})[_0xdba0('0x22')](function(_0x1c647f){if(_0x1c647f){_0x49af0f=_0x1c647f['length'];if(!_0x3c5088[_0xdba0('0x2f')]['hasOwnProperty'](_0xdba0('0x36'))){_0x64166c['limit']=qs[_0xdba0('0x1c')](_0x3c5088[_0xdba0('0x2f')]['limit']);_0x64166c['offset']=qs[_0xdba0('0x1b')](_0x3c5088[_0xdba0('0x2f')][_0xdba0('0x1b')]);}return _0x5e1425['getContacts'](_0x64166c);}})['then'](function(_0x137e7c){if(_0x137e7c){return _0x137e7c?{'count':_0x49af0f,'rows':_0x137e7c}:null;}})[_0xdba0('0x22')](respondWithResult(_0xf8aa8,null))[_0xdba0('0x43')](handleError(_0xf8aa8,null));}; \ No newline at end of file +var _0x6c21=['mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','omit','ids','getContacts','findOne','CmContact','where','pick','map','options','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x6c21,0x1b2));var _0x16c2=function(_0x3783f3,_0x12ba60){_0x3783f3=_0x3783f3-0x0;var _0xaf8ccd=_0x6c21[_0x3783f3];return _0xaf8ccd;};'use strict';var emlformat=require(_0x16c2('0x0'));var rimraf=require(_0x16c2('0x1'));var zipdir=require(_0x16c2('0x2'));var jsonpatch=require(_0x16c2('0x3'));var rp=require('request-promise');var moment=require(_0x16c2('0x4'));var BPromise=require(_0x16c2('0x5'));var Mustache=require(_0x16c2('0x6'));var util=require(_0x16c2('0x7'));var path=require(_0x16c2('0x8'));var sox=require('sox');var csv=require(_0x16c2('0x9'));var ejs=require(_0x16c2('0xa'));var fs=require('fs');var fs_extra=require(_0x16c2('0xb'));var _=require(_0x16c2('0xc'));var squel=require(_0x16c2('0xd'));var crypto=require(_0x16c2('0xe'));var jsforce=require(_0x16c2('0xf'));var deskjs=require(_0x16c2('0x10'));var toCsv=require(_0x16c2('0x9'));var querystring=require(_0x16c2('0x11'));var Papa=require(_0x16c2('0x12'));var Redis=require(_0x16c2('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x16c2('0x14'));var as=require(_0x16c2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x16c2('0x16'))(_0x16c2('0x17'));var utils=require(_0x16c2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x16c2('0x19'));var db=require(_0x16c2('0x1a'))['db'];function respondWithStatusCode(_0x4f1417,_0x21fa12){_0x21fa12=_0x21fa12||0xcc;return function(_0x1eaad4){if(_0x1eaad4){return _0x4f1417[_0x16c2('0x1b')](_0x21fa12);}return _0x4f1417['status'](_0x21fa12)[_0x16c2('0x1c')]();};}function respondWithResult(_0xd1de9e,_0x394eac){_0x394eac=_0x394eac||0xc8;return function(_0x49ab49){if(_0x49ab49){return _0xd1de9e[_0x16c2('0x1d')](_0x394eac)[_0x16c2('0x1e')](_0x49ab49);}};}function respondWithFilteredResult(_0x33bf40,_0x4f5d6b){return function(_0x5e21e4){if(_0x5e21e4){var _0x37e54f=_0x5e21e4['count'],_0x44bfba=_0x4f5d6b[_0x16c2('0x1f')],_0x48fdd1=_0x4f5d6b[_0x16c2('0x1f')]+_0x4f5d6b[_0x16c2('0x20')],_0x3a7fd1;if(_0x48fdd1>=_0x37e54f){_0x48fdd1=_0x37e54f;_0x3a7fd1=0xc8;}else{_0x3a7fd1=0xce;}_0x33bf40[_0x16c2('0x1d')](_0x3a7fd1);return _0x33bf40[_0x16c2('0x21')]('Content-Range',_0x44bfba+'-'+_0x48fdd1+'/'+_0x37e54f)[_0x16c2('0x1e')](_0x5e21e4);}return null;};}function patchUpdates(_0x14bdf9){return function(_0x1c19e6){try{jsonpatch['apply'](_0x1c19e6,_0x14bdf9,!![]);}catch(_0x334b82){return BPromise['reject'](_0x334b82);}return _0x1c19e6[_0x16c2('0x22')]();};}function saveUpdates(_0x49b0c7,_0x451360){return function(_0x4bef48){if(_0x4bef48){return _0x4bef48[_0x16c2('0x23')](_0x49b0c7)[_0x16c2('0x24')](function(_0x32deaf){return _0x32deaf;});}return null;};}function removeEntity(_0x1ad9b5,_0x5a28a5){return function(_0x1e193e){if(_0x1e193e){return _0x1e193e[_0x16c2('0x25')]()[_0x16c2('0x24')](function(){var _0x3c3f4c=_0x1e193e[_0x16c2('0x26')]({'plain':!![]});var _0x41b63d=_0x16c2('0x27');return db[_0x16c2('0x28')]['destroy']({'where':{'type':_0x41b63d,'resourceId':_0x3c3f4c['id']}})[_0x16c2('0x24')](function(){return _0x1e193e;});})[_0x16c2('0x24')](function(){_0x1ad9b5[_0x16c2('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38787c,_0x4ab0dc){return function(_0x39374a){if(!_0x39374a){_0x38787c[_0x16c2('0x1b')](0x194);}return _0x39374a;};}function handleError(_0x5024f2,_0x41935b){_0x41935b=_0x41935b||0x1f4;return function(_0x293e32){logger[_0x16c2('0x29')](_0x293e32[_0x16c2('0x2a')]);if(_0x293e32[_0x16c2('0x2b')]){delete _0x293e32[_0x16c2('0x2b')];}_0x5024f2[_0x16c2('0x1d')](_0x41935b)[_0x16c2('0x2c')](_0x293e32);};}exports[_0x16c2('0x2d')]=function(_0x219196,_0x17b00e){var _0x3f0beb={},_0x46b362={},_0x2287f7={'count':0x0,'rows':[]};return db[_0x16c2('0x2e')]['describe']()[_0x16c2('0x24')](function(_0x319a91){_0x46b362[_0x16c2('0x2f')]=_['keys'](_0x319a91);_0x46b362[_0x16c2('0x30')]=_[_0x16c2('0x31')](_0x219196[_0x16c2('0x30')]);_0x46b362['filters']=_['intersection'](_0x46b362[_0x16c2('0x2f')],_0x46b362[_0x16c2('0x30')]);_0x3f0beb[_0x16c2('0x32')]=_[_0x16c2('0x33')](_0x46b362['model'],qs['fields'](_0x219196['query'][_0x16c2('0x34')]));_0x3f0beb[_0x16c2('0x32')]=_0x3f0beb['attributes'][_0x16c2('0x35')]?_0x3f0beb[_0x16c2('0x32')]:_0x46b362['model'];if(!_0x219196[_0x16c2('0x30')][_0x16c2('0x36')](_0x16c2('0x37'))){_0x3f0beb[_0x16c2('0x20')]=qs[_0x16c2('0x20')](_0x219196['query']['limit']);_0x3f0beb[_0x16c2('0x1f')]=qs[_0x16c2('0x1f')](_0x219196[_0x16c2('0x30')][_0x16c2('0x1f')]);}_0x3f0beb[_0x16c2('0x38')]=qs[_0x16c2('0x39')](_0x219196[_0x16c2('0x30')][_0x16c2('0x39')]);_0x3f0beb['where']=qs[_0x16c2('0x3a')](_['pick'](_0x219196[_0x16c2('0x30')],_0x46b362['filters']),_0x319a91);if(_0x219196[_0x16c2('0x30')][_0x16c2('0x3b')]){_0x3f0beb['where']=_['merge'](_0x3f0beb['where'],{'$or':_['map'](_0x3f0beb[_0x16c2('0x32')],function(_0x4af1a5){var _0x4578ff={};_0x4578ff[_0x4af1a5]={'$like':'%'+_0x219196[_0x16c2('0x30')]['filter']+'%'};return _0x4578ff;})});}_0x3f0beb=_[_0x16c2('0x3c')]({},_0x3f0beb,_0x219196['options']);var _0x3897e2={'where':_0x3f0beb['where']};return db['CmCompany'][_0x16c2('0x3d')](_0x3897e2)[_0x16c2('0x24')](function(_0x62d523){_0x2287f7[_0x16c2('0x3d')]=_0x62d523;if(_0x219196[_0x16c2('0x30')][_0x16c2('0x3e')]){_0x3f0beb[_0x16c2('0x3f')]=[{'all':!![]}];}return db[_0x16c2('0x2e')][_0x16c2('0x40')](_0x3f0beb);})[_0x16c2('0x24')](function(_0x2e9dec){_0x2287f7[_0x16c2('0x41')]=_0x2e9dec;return _0x2287f7;})[_0x16c2('0x24')](respondWithFilteredResult(_0x17b00e,_0x3f0beb))[_0x16c2('0x42')](handleError(_0x17b00e,null));})[_0x16c2('0x42')](handleError(_0x17b00e,null));};exports[_0x16c2('0x43')]=function(_0x4b6ee4,_0x5d840c){var _0x5177d8={'raw':![],'where':{'id':_0x4b6ee4[_0x16c2('0x44')]['id']}},_0x3961af={};_0x3961af[_0x16c2('0x2f')]=_[_0x16c2('0x31')](db[_0x16c2('0x2e')][_0x16c2('0x45')]);_0x3961af['query']=_['keys'](_0x4b6ee4[_0x16c2('0x30')]);_0x3961af[_0x16c2('0x3a')]=_[_0x16c2('0x33')](_0x3961af[_0x16c2('0x2f')],_0x3961af[_0x16c2('0x30')]);_0x5177d8['attributes']=_[_0x16c2('0x33')](_0x3961af[_0x16c2('0x2f')],qs['fields'](_0x4b6ee4[_0x16c2('0x30')][_0x16c2('0x34')]));_0x5177d8[_0x16c2('0x32')]=_0x5177d8[_0x16c2('0x32')][_0x16c2('0x35')]?_0x5177d8[_0x16c2('0x32')]:_0x3961af['model'];if(_0x4b6ee4[_0x16c2('0x30')][_0x16c2('0x3e')]){_0x5177d8[_0x16c2('0x3f')]=[{'all':!![]}];}_0x5177d8=_[_0x16c2('0x3c')]({},_0x5177d8,_0x4b6ee4['options']);return db[_0x16c2('0x2e')][_0x16c2('0x46')](_0x5177d8)[_0x16c2('0x24')](handleEntityNotFound(_0x5d840c,null))[_0x16c2('0x24')](respondWithResult(_0x5d840c,null))[_0x16c2('0x42')](handleError(_0x5d840c,null));};exports[_0x16c2('0x47')]=function(_0x1a0fdb,_0x54f8c1){return db[_0x16c2('0x2e')]['create'](_0x1a0fdb[_0x16c2('0x48')],{})[_0x16c2('0x24')](function(_0xd6c660){var _0x5926bc=_0x1a0fdb[_0x16c2('0x49')][_0x16c2('0x26')]({'plain':!![]});if(!_0x5926bc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5926bc['role']==='user'){var _0x3e02e3=_0xd6c660[_0x16c2('0x26')]({'plain':!![]});var _0x4940b5=_0x16c2('0x27');return db[_0x16c2('0x4a')]['find']({'where':{'name':_0x4940b5,'userProfileId':_0x5926bc['userProfileId']},'raw':!![]})[_0x16c2('0x24')](function(_0x3bb07e){if(_0x3bb07e&&_0x3bb07e[_0x16c2('0x4b')]===0x0){return db[_0x16c2('0x28')]['create']({'name':_0x3e02e3[_0x16c2('0x2b')],'resourceId':_0x3e02e3['id'],'type':_0x3bb07e['name'],'sectionId':_0x3bb07e['id']},{})[_0x16c2('0x24')](function(){return _0xd6c660;});}else{return _0xd6c660;}})[_0x16c2('0x42')](function(_0x3feabb){logger[_0x16c2('0x29')](_0x16c2('0x4c'),_0x3feabb);throw _0x3feabb;});}return _0xd6c660;})[_0x16c2('0x24')](respondWithResult(_0x54f8c1,0xc9))[_0x16c2('0x42')](handleError(_0x54f8c1,null));};exports[_0x16c2('0x23')]=function(_0x422039,_0x2be596){if(_0x422039[_0x16c2('0x48')]['id']){delete _0x422039[_0x16c2('0x48')]['id'];}return db[_0x16c2('0x2e')][_0x16c2('0x46')]({'where':{'id':_0x422039[_0x16c2('0x44')]['id']}})[_0x16c2('0x24')](handleEntityNotFound(_0x2be596,null))[_0x16c2('0x24')](saveUpdates(_0x422039[_0x16c2('0x48')],null))['then'](respondWithResult(_0x2be596,null))['catch'](handleError(_0x2be596,null));};exports[_0x16c2('0x25')]=function(_0x6ffab8,_0x2cb5c4){return db[_0x16c2('0x2e')][_0x16c2('0x46')]({'where':{'id':_0x6ffab8['params']['id']}})[_0x16c2('0x24')](handleEntityNotFound(_0x2cb5c4,null))[_0x16c2('0x24')](removeEntity(_0x2cb5c4,null))[_0x16c2('0x42')](handleError(_0x2cb5c4,null));};exports['describe']=function(_0x44ea07,_0x55c281){return db[_0x16c2('0x2e')][_0x16c2('0x4d')]()[_0x16c2('0x24')](respondWithResult(_0x55c281,null))['catch'](handleError(_0x55c281,null));};exports[_0x16c2('0x4e')]=function(_0x2f214d,_0x239ae6,_0x510e61){return db['CmContact'][_0x16c2('0x46')]({'where':{'id':_0x2f214d[_0x16c2('0x44')]['id']}})[_0x16c2('0x24')](handleEntityNotFound(_0x239ae6,null))[_0x16c2('0x24')](function(_0x29c7d8){if(_0x29c7d8){return _0x29c7d8[_0x16c2('0x4e')](_0x2f214d[_0x16c2('0x48')]['ids'],_[_0x16c2('0x4f')](_0x2f214d[_0x16c2('0x48')],[_0x16c2('0x50'),'id'])||{});}})[_0x16c2('0x24')](respondWithResult(_0x239ae6,null))[_0x16c2('0x42')](handleError(_0x239ae6,null));};exports[_0x16c2('0x51')]=function(_0x4aba08,_0x1da5ce,_0x37044e){var _0x450019={};var _0x4c472b={};var _0x4aab7b;var _0x52cac5;return db['CmCompany'][_0x16c2('0x52')]({'where':{'id':_0x4aba08['params']['id']}})['then'](handleEntityNotFound(_0x1da5ce,null))[_0x16c2('0x24')](function(_0x22d9c6){if(_0x22d9c6){_0x4aab7b=_0x22d9c6;_0x4c472b[_0x16c2('0x2f')]=_['keys'](db[_0x16c2('0x53')][_0x16c2('0x45')]);_0x4c472b['query']=_['keys'](_0x4aba08[_0x16c2('0x30')]);_0x4c472b[_0x16c2('0x3a')]=_[_0x16c2('0x33')](_0x4c472b[_0x16c2('0x2f')],_0x4c472b['query']);_0x450019[_0x16c2('0x32')]=_[_0x16c2('0x33')](_0x4c472b[_0x16c2('0x2f')],qs[_0x16c2('0x34')](_0x4aba08[_0x16c2('0x30')][_0x16c2('0x34')]));_0x450019[_0x16c2('0x32')]=_0x450019[_0x16c2('0x32')][_0x16c2('0x35')]?_0x450019['attributes']:_0x4c472b[_0x16c2('0x2f')];_0x450019[_0x16c2('0x38')]=qs[_0x16c2('0x39')](_0x4aba08[_0x16c2('0x30')][_0x16c2('0x39')]);_0x450019[_0x16c2('0x54')]=qs[_0x16c2('0x3a')](_[_0x16c2('0x55')](_0x4aba08['query'],_0x4c472b[_0x16c2('0x3a')]));if(_0x4aba08[_0x16c2('0x30')][_0x16c2('0x3b')]){_0x450019[_0x16c2('0x54')]=_[_0x16c2('0x3c')](_0x450019[_0x16c2('0x54')],{'$or':_[_0x16c2('0x56')](_0x450019[_0x16c2('0x32')],function(_0x136e4b){var _0x40953d={};_0x40953d[_0x136e4b]={'$like':'%'+_0x4aba08[_0x16c2('0x30')][_0x16c2('0x3b')]+'%'};return _0x40953d;})});}_0x450019=_[_0x16c2('0x3c')]({},_0x450019,_0x4aba08[_0x16c2('0x57')]);return _0x4aab7b[_0x16c2('0x51')](_0x450019);}})[_0x16c2('0x24')](function(_0x48be53){if(_0x48be53){_0x52cac5=_0x48be53[_0x16c2('0x35')];if(!_0x4aba08[_0x16c2('0x30')][_0x16c2('0x36')](_0x16c2('0x37'))){_0x450019[_0x16c2('0x20')]=qs['limit'](_0x4aba08[_0x16c2('0x30')][_0x16c2('0x20')]);_0x450019[_0x16c2('0x1f')]=qs[_0x16c2('0x1f')](_0x4aba08[_0x16c2('0x30')]['offset']);}return _0x4aab7b['getContacts'](_0x450019);}})[_0x16c2('0x24')](function(_0x439ffd){if(_0x439ffd){return _0x439ffd?{'count':_0x52cac5,'rows':_0x439ffd}:null;}})[_0x16c2('0x24')](respondWithResult(_0x1da5ce,null))[_0x16c2('0x42')](handleError(_0x1da5ce,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index b9e21fb..00615b8 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 _0x0689=['define','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x0689,0x161));var _0x9068=function(_0x4eb8e1,_0x52fb85){_0x4eb8e1=_0x4eb8e1-0x0;var _0x3a9f0a=_0x0689[_0x4eb8e1];return _0x3a9f0a;};'use strict';var _=require('lodash');var util=require(_0x9068('0x0'));var logger=require('../../config/logger')(_0x9068('0x1'));var moment=require(_0x9068('0x2'));var BPromise=require(_0x9068('0x3'));var rp=require(_0x9068('0x4'));var fs=require('fs');var path=require(_0x9068('0x5'));var rimraf=require(_0x9068('0x6'));var config=require(_0x9068('0x7'));var attributes=require(_0x9068('0x8'));module[_0x9068('0x9')]=function(_0x287846,_0x5ce5a7){return _0x287846[_0x9068('0xa')]('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7aaf=['./cmCompany.attributes','exports','CmCompany','lodash','../../config/logger','api','request-promise','rimraf'];(function(_0x2cb4d2,_0x395aea){var _0x17f6f4=function(_0x51e03e){while(--_0x51e03e){_0x2cb4d2['push'](_0x2cb4d2['shift']());}};_0x17f6f4(++_0x395aea);}(_0x7aaf,0x1eb));var _0xf7aa=function(_0x167307,_0x182379){_0x167307=_0x167307-0x0;var _0x44911a=_0x7aaf[_0x167307];return _0x44911a;};'use strict';var _=require(_0xf7aa('0x0'));var util=require('util');var logger=require(_0xf7aa('0x1'))(_0xf7aa('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf7aa('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf7aa('0x4'));var config=require('../../config/environment');var attributes=require(_0xf7aa('0x5'));module[_0xf7aa('0x6')]=function(_0x1babcd,_0xf02ed5){return _0x1babcd['define'](_0xf7aa('0x7'),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 b4e3581..9cafc39 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 _0x9839=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9839,0xa0));var _0x9983=function(_0x1140e5,_0x56a491){_0x1140e5=_0x1140e5-0x0;var _0x1a9a62=_0x9839[_0x1140e5];return _0x1a9a62;};'use strict';var _=require(_0x9983('0x0'));var util=require(_0x9983('0x1'));var moment=require(_0x9983('0x2'));var BPromise=require(_0x9983('0x3'));var rs=require(_0x9983('0x4'));var fs=require('fs');var Redis=require(_0x9983('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9983('0x6'));var logger=require(_0x9983('0x7'))(_0x9983('0x8'));var config=require(_0x9983('0x9'));var jayson=require(_0x9983('0xa'));var client=jayson[_0x9983('0xb')][_0x9983('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1c4e44,_0x28b5f4,_0x56b3c5){return new BPromise(function(_0x9f562e,_0x2957d6){return client[_0x9983('0xd')](_0x1c4e44,_0x56b3c5)[_0x9983('0xe')](function(_0x2a3f92){logger[_0x9983('0xf')](_0x9983('0x10'),_0x28b5f4,_0x9983('0x11'));logger[_0x9983('0x12')](_0x9983('0x13'),_0x28b5f4,_0x9983('0x11'),JSON[_0x9983('0x14')](_0x2a3f92));if(_0x2a3f92[_0x9983('0x15')]){if(_0x2a3f92[_0x9983('0x15')][_0x9983('0x16')]===0x1f4){logger[_0x9983('0x15')](_0x9983('0x10'),_0x28b5f4,_0x2a3f92[_0x9983('0x15')][_0x9983('0x17')]);return _0x2957d6(_0x2a3f92[_0x9983('0x15')][_0x9983('0x17')]);}logger[_0x9983('0x15')]('CmCompany,\x20%s,\x20%s',_0x28b5f4,_0x2a3f92[_0x9983('0x15')]['message']);return _0x9f562e(_0x2a3f92[_0x9983('0x15')][_0x9983('0x17')]);}else{logger[_0x9983('0xf')]('CmCompany,\x20%s,\x20%s',_0x28b5f4,_0x9983('0x11'));_0x9f562e(_0x2a3f92[_0x9983('0x18')][_0x9983('0x17')]);}})[_0x9983('0x19')](function(_0x14b1e8){logger[_0x9983('0x15')](_0x9983('0x10'),_0x28b5f4,_0x14b1e8);_0x2957d6(_0x14b1e8);});});} \ No newline at end of file +var _0xa8bb=['request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x22cd75,_0x3bc137){var _0x1db0cc=function(_0x429a4a){while(--_0x429a4a){_0x22cd75['push'](_0x22cd75['shift']());}};_0x1db0cc(++_0x3bc137);}(_0xa8bb,0x131));var _0xba8b=function(_0x34fee5,_0x1de058){_0x34fee5=_0x34fee5-0x0;var _0x4993b2=_0xa8bb[_0x34fee5];return _0x4993b2;};'use strict';var _=require(_0xba8b('0x0'));var util=require(_0xba8b('0x1'));var moment=require(_0xba8b('0x2'));var BPromise=require(_0xba8b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba8b('0x4'));var db=require(_0xba8b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xba8b('0x6'));var config=require(_0xba8b('0x7'));var jayson=require(_0xba8b('0x8'));var client=jayson[_0xba8b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25566e,_0x1ef0e7,_0x3c462e){return new BPromise(function(_0x529d19,_0xddc0cc){return client[_0xba8b('0xa')](_0x25566e,_0x3c462e)[_0xba8b('0xb')](function(_0x20c793){logger[_0xba8b('0xc')](_0xba8b('0xd'),_0x1ef0e7,_0xba8b('0xe'));logger[_0xba8b('0xf')](_0xba8b('0x10'),_0x1ef0e7,'request\x20sent',JSON[_0xba8b('0x11')](_0x20c793));if(_0x20c793[_0xba8b('0x12')]){if(_0x20c793[_0xba8b('0x12')]['code']===0x1f4){logger[_0xba8b('0x12')](_0xba8b('0xd'),_0x1ef0e7,_0x20c793[_0xba8b('0x12')]['message']);return _0xddc0cc(_0x20c793['error'][_0xba8b('0x13')]);}logger[_0xba8b('0x12')](_0xba8b('0xd'),_0x1ef0e7,_0x20c793[_0xba8b('0x12')][_0xba8b('0x13')]);return _0x529d19(_0x20c793['error']['message']);}else{logger[_0xba8b('0xc')]('CmCompany,\x20%s,\x20%s',_0x1ef0e7,_0xba8b('0xe'));_0x529d19(_0x20c793['result'][_0xba8b('0x13')]);}})[_0xba8b('0x14')](function(_0x38bc83){logger[_0xba8b('0x12')](_0xba8b('0xd'),_0x1ef0e7,_0x38bc83);_0xddc0cc(_0x38bc83);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 2b4af13..f749c6d 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 _0x0d99=['show','/:id/contacts','isAuthenticated','getContacts','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','/describe','describe','/:id'];(function(_0x2cba48,_0x72499){var _0x11db2e=function(_0x351e9a){while(--_0x351e9a){_0x2cba48['push'](_0x2cba48['shift']());}};_0x11db2e(++_0x72499);}(_0x0d99,0x1a7));var _0x90d9=function(_0x2ba271,_0x459df0){_0x2ba271=_0x2ba271-0x0;var _0x21e60d=_0x0d99[_0x2ba271];return _0x21e60d;};'use strict';var multer=require(_0x90d9('0x0'));var util=require(_0x90d9('0x1'));var path=require(_0x90d9('0x2'));var timeout=require(_0x90d9('0x3'));var express=require(_0x90d9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90d9('0x5'));var interaction=require(_0x90d9('0x6'));var config=require(_0x90d9('0x7'));var controller=require(_0x90d9('0x8'));router[_0x90d9('0x9')]('/',auth['isAuthenticated'](),controller[_0x90d9('0xa')]);router[_0x90d9('0x9')](_0x90d9('0xb'),auth['isAuthenticated'](),controller[_0x90d9('0xc')]);router[_0x90d9('0x9')](_0x90d9('0xd'),auth['isAuthenticated'](),controller[_0x90d9('0xe')]);router[_0x90d9('0x9')](_0x90d9('0xf'),auth[_0x90d9('0x10')](),controller[_0x90d9('0x11')]);router[_0x90d9('0x12')]('/',auth[_0x90d9('0x10')](),controller['create']);router['post'](_0x90d9('0xf'),auth['isAuthenticated'](),controller['addContacts']);router[_0x90d9('0x13')]('/:id',auth[_0x90d9('0x10')](),controller[_0x90d9('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x90d9('0x15')]);module[_0x90d9('0x16')]=router; \ No newline at end of file +var _0x647d=['/:id','update','delete','destroy','exports','connect-timeout','Router','fs-extra','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','show','/:id/contacts','post','create','addContacts','put'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x647d,0x101));var _0xd647=function(_0x400cfc,_0x5c7111){_0x400cfc=_0x400cfc-0x0;var _0x12bf74=_0x647d[_0x400cfc];return _0x12bf74;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd647('0x0'));var express=require('express');var router=express[_0xd647('0x1')]();var fs_extra=require(_0xd647('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd647('0x3'));var controller=require(_0xd647('0x4'));router[_0xd647('0x5')]('/',auth[_0xd647('0x6')](),controller[_0xd647('0x7')]);router[_0xd647('0x5')](_0xd647('0x8'),auth['isAuthenticated'](),controller[_0xd647('0x9')]);router[_0xd647('0x5')]('/:id',auth[_0xd647('0x6')](),controller[_0xd647('0xa')]);router[_0xd647('0x5')](_0xd647('0xb'),auth[_0xd647('0x6')](),controller['getContacts']);router[_0xd647('0xc')]('/',auth['isAuthenticated'](),controller[_0xd647('0xd')]);router[_0xd647('0xc')](_0xd647('0xb'),auth[_0xd647('0x6')](),controller[_0xd647('0xe')]);router[_0xd647('0xf')](_0xd647('0x10'),auth[_0xd647('0x6')](),controller[_0xd647('0x11')]);router[_0xd647('0x12')](_0xd647('0x10'),auth['isAuthenticated'](),controller[_0xd647('0x13')]);module[_0xd647('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 11a20b2..813f8ca 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 _0x72ce=['NOW','lodash','sequelize','exports','STRING','INTEGER','UNSIGNED','DATE'];(function(_0x32512c,_0x4957b3){var _0x2778c1=function(_0x17445f){while(--_0x17445f){_0x32512c['push'](_0x32512c['shift']());}};_0x2778c1(++_0x4957b3);}(_0x72ce,0x1f1));var _0xe72c=function(_0x18a30c,_0x362d2e){_0x18a30c=_0x18a30c-0x0;var _0x16b964=_0x72ce[_0x18a30c];return _0x16b964;};'use strict';var _=require(_0xe72c('0x0'));var Sequelize=require(_0xe72c('0x1'));module[_0xe72c('0x2')]={'firstName':{'type':Sequelize[_0xe72c('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xe72c('0x3')]},'street':{'type':Sequelize[_0xe72c('0x3')]},'postalCode':{'type':Sequelize[_0xe72c('0x3')]},'city':{'type':Sequelize[_0xe72c('0x3')]},'country':{'type':Sequelize[_0xe72c('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xe72c('0x3')]},'mobile':{'type':Sequelize[_0xe72c('0x3')]},'fax':{'type':Sequelize[_0xe72c('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xe72c('0x3')]},'fb_data':{'type':Sequelize[_0xe72c('0x3')]},'twitter':{'type':Sequelize[_0xe72c('0x3')]},'skype':{'type':Sequelize[_0xe72c('0x3')]},'teams':{'type':Sequelize[_0xe72c('0x3')]},'viber':{'type':Sequelize[_0xe72c('0x3')]},'line':{'type':Sequelize[_0xe72c('0x3')]},'wechat':{'type':Sequelize[_0xe72c('0x3')]},'telegram':{'type':Sequelize[_0xe72c('0x3')]},'UserId':{'type':Sequelize[_0xe72c('0x4')]},'priority':{'type':Sequelize[_0xe72c('0x4')](0x2)[_0xe72c('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe72c('0x6')],'defaultValue':Sequelize[_0xe72c('0x7')]}}; \ No newline at end of file +var _0xce33=['lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW'];(function(_0x5918e7,_0xe7ea50){var _0x167b79=function(_0x5a5bb5){while(--_0x5a5bb5){_0x5918e7['push'](_0x5918e7['shift']());}};_0x167b79(++_0xe7ea50);}(_0xce33,0x171));var _0x3ce3=function(_0x16ce60,_0x1fb180){_0x16ce60=_0x16ce60-0x0;var _0x2c7947=_0xce33[_0x16ce60];return _0x2c7947;};'use strict';var _=require(_0x3ce3('0x0'));var Sequelize=require(_0x3ce3('0x1'));module[_0x3ce3('0x2')]={'firstName':{'type':Sequelize[_0x3ce3('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x3ce3('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x3ce3('0x3')]},'country':{'type':Sequelize[_0x3ce3('0x3')]},'dateOfBirth':{'type':Sequelize[_0x3ce3('0x3')]},'description':{'type':Sequelize[_0x3ce3('0x4')]},'phone':{'type':Sequelize[_0x3ce3('0x3')]},'mobile':{'type':Sequelize[_0x3ce3('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3ce3('0x3')]},'url':{'type':Sequelize[_0x3ce3('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x3ce3('0x3')]},'twitter':{'type':Sequelize[_0x3ce3('0x3')]},'skype':{'type':Sequelize[_0x3ce3('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x3ce3('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x3ce3('0x3')]},'telegram':{'type':Sequelize[_0x3ce3('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x3ce3('0x5')](0x2)[_0x3ce3('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x3ce3('0x7')],'defaultValue':Sequelize[_0x3ce3('0x8')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index e93631a..44566fe 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 _0x7b83=['castTo','DATE','buildExpression','text','start','hasOwnProperty','filter','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','\x20=\x20?','tag','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','QueryTypes','SELECT','order','DESC','having','resolve','user','role','agent','some','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','c.firstName','c.lastName','c.phone','c.email','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','params','tags','findAll','displayName','alias','custom','columnName','body','get','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','bulkCreate','each','duplicates','$or','findOrCreate','spread','error','color','$and','omit','format','cf_%d','cm_contacts','setFields','phone','rawAttributes','options','getTags','nolimit','setTags','ids','includeAll','include','ContactId','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','send','upload','createReadStream','path','meta','import','binding','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','exit','error\x20child\x20process','mail','chat','fax','whatsapp','voice','-createdAt','toLowerCase','Invalid\x20channel','channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','User','fullname','startCase','Account','closed','closedAt','secondDisposition','thirdDisposition','Owner','browserName','deviceModel','ratingType','ratingValue','referer','substatus','openchannel','externalUrl','threadId','Interaction','findAndCountAll','flatten','reverse','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./cmContact.socket','register','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','CmContact','describe','length','keys','startsWith','cf_','push','CmCustomField','findOne','trimStart','all','fieldType','type','model','query','attributes','intersection','fields','sort','where','filters','pick','field','from','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','tools_tags','expr','conditions','find','Tag','value','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','and','uc.UserId\x20=\x20?','dateOfBirth','datetime'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7b83,0x1e7));var _0x37b8=function(_0x512e41,_0x4a7db2){_0x512e41=_0x512e41-0x0;var _0x5aa4c0=_0x7b83[_0x512e41];return _0x5aa4c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x37b8('0x0'));var zipdir=require(_0x37b8('0x1'));var jsonpatch=require(_0x37b8('0x2'));var rp=require(_0x37b8('0x3'));var moment=require('moment');var BPromise=require(_0x37b8('0x4'));var Mustache=require('mustache');var util=require(_0x37b8('0x5'));var path=require('path');var sox=require(_0x37b8('0x6'));var csv=require(_0x37b8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x37b8('0x8'));var _=require(_0x37b8('0x9'));var squel=require('squel');var crypto=require(_0x37b8('0xa'));var jsforce=require(_0x37b8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x37b8('0x7'));var querystring=require('querystring');var Papa=require(_0x37b8('0xc'));var Redis=require(_0x37b8('0xd'));var authService=require(_0x37b8('0xe'));var qs=require(_0x37b8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x37b8('0x10'))(_0x37b8('0x11'));var utils=require('../../config/utils');var config=require(_0x37b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x37b8('0x13'))['db'];config[_0x37b8('0x14')]=_['defaults'](config[_0x37b8('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x37b8('0x15'))(new Redis(config[_0x37b8('0x14')]));require(_0x37b8('0x16'))[_0x37b8('0x17')](socket);function respondWithStatusCode(_0x3e9f60,_0x5552ea){_0x5552ea=_0x5552ea||0xcc;return function(_0x19d3b8){if(_0x19d3b8){return _0x3e9f60[_0x37b8('0x18')](_0x5552ea);}return _0x3e9f60[_0x37b8('0x19')](_0x5552ea)['end']();};}function respondWithResult(_0x4cc55b,_0x30831f){_0x30831f=_0x30831f||0xc8;return function(_0x5db765){if(_0x5db765){return _0x4cc55b['status'](_0x30831f)[_0x37b8('0x1a')](_0x5db765);}};}function respondWithFilteredResult(_0x1ac6ea,_0x1d0a04){return function(_0x312427){if(_0x312427){var _0x2eda04=_0x312427['count'],_0x2d09ad=_0x1d0a04[_0x37b8('0x1b')],_0x27adb4=_0x1d0a04[_0x37b8('0x1b')]+_0x1d0a04[_0x37b8('0x1c')],_0x47c462;if(_0x27adb4>=_0x2eda04){_0x27adb4=_0x2eda04;_0x47c462=0xc8;}else{_0x47c462=0xce;}_0x1ac6ea[_0x37b8('0x19')](_0x47c462);return _0x1ac6ea[_0x37b8('0x1d')](_0x37b8('0x1e'),_0x2d09ad+'-'+_0x27adb4+'/'+_0x2eda04)[_0x37b8('0x1a')](_0x312427);}return null;};}function patchUpdates(_0x2f3408){return function(_0x272d50){try{jsonpatch[_0x37b8('0x1f')](_0x272d50,_0x2f3408,!![]);}catch(_0x433db9){return BPromise[_0x37b8('0x20')](_0x433db9);}return _0x272d50[_0x37b8('0x21')]();};}function saveUpdates(_0x41cff9,_0x2d1ce8){return function(_0x497a8e){if(_0x497a8e){return _0x497a8e[_0x37b8('0x22')](_0x41cff9)[_0x37b8('0x23')](function(_0x1f3e3b){return _0x1f3e3b;});}return null;};}function removeEntity(_0x1e609f,_0x572b5e){return function(_0x354a2f){if(_0x354a2f){return _0x354a2f[_0x37b8('0x24')]()['then'](function(){_0x1e609f[_0x37b8('0x19')](0xcc)[_0x37b8('0x25')]();});}};}function handleEntityNotFound(_0x4c070b,_0x132d96){return function(_0x314aa7){if(!_0x314aa7){_0x4c070b['sendStatus'](0x194);}return _0x314aa7;};}function handleError(_0xe11957,_0x166e7c){_0x166e7c=_0x166e7c||0x1f4;return function(_0x1a06fc){logger['error'](_0x1a06fc[_0x37b8('0x26')]);if(_0x1a06fc[_0x37b8('0x27')]){delete _0x1a06fc[_0x37b8('0x27')];}_0xe11957[_0x37b8('0x19')](_0x166e7c)['send'](_0x1a06fc);};}exports['index']=function(_0x1060c8,_0x26a1d0){var _0x3ecf87={},_0x4750c7={},_0x105c36={'count':0x0,'rows':[]};return db[_0x37b8('0x28')][_0x37b8('0x29')]()['then'](function(_0xfec98e){var _0x32f8d5=[];for(var _0x27a779=0x0;_0x27a7790x1){_0x25dee2['or'](_0x37b8('0x63'),qs[_0x37b8('0x64')](_0x18c1ca),null);}else{if(qs[_0x37b8('0x65')](_0x18c1ca)){_0x25dee2['or'](_0x37b8('0x66'),_0x18c1ca+'%');_0x25dee2['or']('c.phone\x20LIKE\x20?',_0x18c1ca+'%');_0x25dee2['or'](_0x37b8('0x67'),_0x18c1ca+'%');_0x25dee2['or'](_0x37b8('0x68'),_0x18c1ca+'%');}else if(qs[_0x37b8('0x69')](_0x18c1ca)){_0x25dee2['or'](_0x37b8('0x6a'),_0x18c1ca+'%');}else{_0x25dee2['or'](_0x37b8('0x6b'),'%'+_0x18c1ca+'%');_0x25dee2['or'](_0x37b8('0x6c'),'%'+_0x18c1ca+'%');_0x25dee2['or'](_0x37b8('0x6a'),'%'+_0x18c1ca+'%');}}}}_0x3382b6[_0x37b8('0x3b')](_0x25dee2);_0x3382b6[_0x37b8('0x6d')](_0x37b8('0x6e'));var _0xac2d5b={'type':db['Sequelize'][_0x37b8('0x6f')][_0x37b8('0x70')],'raw':!![]};var _0x523092=_0x3382b6['clone']()[_0x37b8('0x3e')](_0x37b8('0x6e'));if(_0x3ecf87[_0x37b8('0x71')]){_0x3ecf87[_0x37b8('0x71')][_0x37b8('0x4c')](function(_0x3b05e5){_0x3382b6[_0x37b8('0x71')]('c.'+_0x3b05e5[0x0],_0x3b05e5[0x1]===_0x37b8('0x72')?![]:!![]);});}if(!_[_0x37b8('0x5c')](_0x45b13e)){_0x3382b6[_0x37b8('0x73')](_0x86ef44);_0x523092[_0x37b8('0x3b')]('t.id\x20IN\x20?',_0x45b13e);}BPromise[_0x37b8('0x74')]()[_0x37b8('0x23')](function(){if(!_0x4cc43c)return;if(_0x1060c8[_0x37b8('0x75')][_0x37b8('0x76')]!==_0x37b8('0x77'))return;if(!_[_0x37b8('0x78')](_0x4cc43c[_0x37b8('0x47')],[_0x37b8('0x3e'),'User'])){return _0x1060c8[_0x37b8('0x75')][_0x37b8('0x79')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3be9ed){if(_['isEmpty'](_0x3be9ed)){_0x523092[_0x37b8('0x3b')](_0x37b8('0x7a'));_0x3382b6[_0x37b8('0x3b')](_0x37b8('0x7a'));}else{_0x523092[_0x37b8('0x3b')](_0x37b8('0x5e'),_['map'](_0x3be9ed,'id'));_0x3382b6[_0x37b8('0x3b')]('c.ListId\x20IN\x20?',_[_0x37b8('0x4b')](_0x3be9ed,'id'));}});}})[_0x37b8('0x23')](function(){if(_0x1060c8[_0x37b8('0x75')]['role']===_0x37b8('0x77')&&!_0x4cc43c&&!_0x1060c8[_0x37b8('0x36')]['ListId'])return[];return db[_0x37b8('0x7b')][_0x37b8('0x36')](_0x523092[_0x37b8('0x7c')](),_0xac2d5b);})[_0x37b8('0x23')](function(_0x100522){_0x105c36[_0x37b8('0x7d')]=_0x100522[_0x37b8('0x2a')];if(_0x105c36['count']===0x0)return[];return db[_0x37b8('0x7b')]['query'](_0x596104[_0x37b8('0x7c')](),_0xac2d5b)[_0x37b8('0x23')](function(_0x615ff1){_0x144f98=_[_0x37b8('0x7e')](_0x615ff1,'id');_0xac2d5b=_[_0x37b8('0x7f')](_0xac2d5b,{'model':db[_0x37b8('0x28')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1060c8[_0x37b8('0x36')]['fields']){_0x3ecf87['attributes'][_0x37b8('0x4c')](function(_0x54de7f){_0x3382b6[_0x37b8('0x3e')]('c.'+_0x54de7f);});}else{_0x3382b6['field'](_0x37b8('0x6e'));_0x3382b6['field'](_0x37b8('0x80'));_0x3382b6[_0x37b8('0x3e')](_0x37b8('0x81'));_0x3382b6['field'](_0x37b8('0x82'));_0x3382b6[_0x37b8('0x3e')]('c.mobile');_0x3382b6[_0x37b8('0x3e')]('c.fax');_0x3382b6[_0x37b8('0x3e')](_0x37b8('0x83'));_0x3382b6[_0x37b8('0x3e')]('c.ListId');_0x3382b6['field'](_0x37b8('0x84'));_0x3382b6[_0x37b8('0x3e')](_0x37b8('0x85'));_0x3382b6[_0x37b8('0x3e')](_0x37b8('0x86'));_0x3382b6[_0x37b8('0x3e')](_0x37b8('0x87'),_0x37b8('0x88'));}if(_0x3ecf87[_0x37b8('0x1c')])_0x3382b6['limit'](_0x3ecf87['limit']);if(_0x3ecf87[_0x37b8('0x1b')])_0x3382b6['offset'](_0x3ecf87[_0x37b8('0x1b')]);return db[_0x37b8('0x7b')][_0x37b8('0x36')](_0x3382b6[_0x37b8('0x7c')](),_0xac2d5b);});})['then'](function(_0x2b802a){_0x2b802a[_0x37b8('0x4c')](function(_0x271935){if(_0x271935['TagIds']){_0x271935[_0x37b8('0x89')]=[];_0x271935['TagIds'][_0x37b8('0x62')](',')[_0x37b8('0x4c')](function(_0xd93bc4){_0x271935[_0x37b8('0x89')]['push'](_0x144f98[_0xd93bc4]);});}delete _0x271935[_0x37b8('0x88')];});_0x105c36[_0x37b8('0x8a')]=_0x2b802a;return _0x105c36;})[_0x37b8('0x23')](respondWithFilteredResult(_0x26a1d0,_0x3ecf87));})[_0x37b8('0x8b')](handleError(_0x26a1d0,null));};exports[_0x37b8('0x24')]=function(_0x471557,_0x3118cf){return db['CmContact']['find']({'where':{'id':_0x471557[_0x37b8('0x8c')]['id']}})[_0x37b8('0x23')](handleEntityNotFound(_0x3118cf,null))[_0x37b8('0x23')](removeEntity(_0x3118cf,null))['catch'](handleError(_0x3118cf,null));};exports[_0x37b8('0x29')]=function(_0x4aece5,_0x5a261f){return db['CmContact'][_0x37b8('0x29')]()[_0x37b8('0x23')](function(_0x462a1f){delete _0x462a1f[_0x37b8('0x8d')];for(var _0x509241=0x0;_0x509241=_0x36291b){_0x5f2906=_0x36291b;_0x4c51da=0xc8;}else{_0x4c51da=0xce;}_0x8d77c4[_0x732f('0x20')](_0x4c51da);return _0x8d77c4['set'](_0x732f('0x24'),_0x43228b+'-'+_0x5f2906+'/'+_0x36291b)[_0x732f('0x22')](_0x56cdfb);}return null;};}function patchUpdates(_0x4055b8){return function(_0x3bcc54){try{jsonpatch[_0x732f('0x25')](_0x3bcc54,_0x4055b8,!![]);}catch(_0xfdb14a){return BPromise[_0x732f('0x26')](_0xfdb14a);}return _0x3bcc54[_0x732f('0x27')]();};}function saveUpdates(_0x1aec3a,_0x107e20){return function(_0x1bc283){if(_0x1bc283){return _0x1bc283['update'](_0x1aec3a)[_0x732f('0x28')](function(_0x3e750c){return _0x3e750c;});}return null;};}function removeEntity(_0x202724,_0x369ca1){return function(_0x42568a){if(_0x42568a){return _0x42568a[_0x732f('0x29')]()[_0x732f('0x28')](function(){_0x202724[_0x732f('0x20')](0xcc)[_0x732f('0x21')]();});}};}function handleEntityNotFound(_0x5d7209,_0x1341b5){return function(_0x5c1f7d){if(!_0x5c1f7d){_0x5d7209['sendStatus'](0x194);}return _0x5c1f7d;};}function handleError(_0x17bad2,_0x390e31){_0x390e31=_0x390e31||0x1f4;return function(_0x445278){logger['error'](_0x445278['stack']);if(_0x445278[_0x732f('0x2a')]){delete _0x445278[_0x732f('0x2a')];}_0x17bad2[_0x732f('0x20')](_0x390e31)[_0x732f('0x2b')](_0x445278);};}exports[_0x732f('0x2c')]=function(_0x4bfaf4,_0x430e44){var _0x5ed949={},_0xfd3732={},_0x48a46e={'count':0x0,'rows':[]};return db[_0x732f('0x2d')][_0x732f('0x2e')]()[_0x732f('0x28')](function(_0x26e031){var _0x41d5ef=[];for(var _0x1992ae=0x0;_0x1992ae0x1){_0x1d6e39['or'](_0x732f('0x6c'),qs[_0x732f('0x6d')](_0xe57670),null);}else{if(qs[_0x732f('0x6e')](_0xe57670)){_0x1d6e39['or'](_0x732f('0x6f'),_0xe57670+'%');_0x1d6e39['or'](_0x732f('0x70'),_0xe57670+'%');_0x1d6e39['or'](_0x732f('0x71'),_0xe57670+'%');_0x1d6e39['or'](_0x732f('0x72'),_0xe57670+'%');}else if(qs[_0x732f('0x73')](_0xe57670)){_0x1d6e39['or'](_0x732f('0x74'),_0xe57670+'%');}else{_0x1d6e39['or'](_0x732f('0x75'),'%'+_0xe57670+'%');_0x1d6e39['or'](_0x732f('0x76'),'%'+_0xe57670+'%');_0x1d6e39['or'](_0x732f('0x74'),'%'+_0xe57670+'%');}}}}_0x491880[_0x732f('0x3e')](_0x1d6e39);_0x491880['group'](_0x732f('0x77'));var _0x4993f4={'type':db[_0x732f('0x78')]['QueryTypes'][_0x732f('0x79')],'raw':!![]};var _0x2dfdd9=_0x491880[_0x732f('0x7a')]()[_0x732f('0x42')]('c.id');if(_0x5ed949[_0x732f('0x7b')]){_0x5ed949[_0x732f('0x7b')]['forEach'](function(_0x1fc752){_0x491880['order']('c.'+_0x1fc752[0x0],_0x1fc752[0x1]===_0x732f('0x7c')?![]:!![]);});}if(!_['isEmpty'](_0x63b351)){_0x491880[_0x732f('0x7d')](_0x396575);_0x2dfdd9[_0x732f('0x3e')](_0x732f('0x7e'),_0x63b351);}BPromise[_0x732f('0x7f')]()['then'](function(){if(!_0xe6e9a1)return;if(_0x4bfaf4['user'][_0x732f('0x80')]!==_0x732f('0x81'))return;if(!_[_0x732f('0x82')](_0xe6e9a1['conditions'],[_0x732f('0x42'),_0x732f('0x55')])){return _0x4bfaf4[_0x732f('0x83')][_0x732f('0x84')]({'attributes':['id'],'raw':!![]})[_0x732f('0x28')](function(_0x10feff){if(_[_0x732f('0x62')](_0x10feff)){_0x2dfdd9['where'](_0x732f('0x85'));_0x491880[_0x732f('0x3e')](_0x732f('0x85'));}else{_0x2dfdd9[_0x732f('0x3e')]('c.ListId\x20IN\x20?',_[_0x732f('0x53')](_0x10feff,'id'));_0x491880[_0x732f('0x3e')](_0x732f('0x64'),_[_0x732f('0x53')](_0x10feff,'id'));}});}})[_0x732f('0x28')](function(){if(_0x4bfaf4[_0x732f('0x83')][_0x732f('0x80')]===_0x732f('0x81')&&!_0xe6e9a1&&!_0x4bfaf4[_0x732f('0x36')][_0x732f('0x63')])return[];return db['sequelize'][_0x732f('0x36')](_0x2dfdd9[_0x732f('0x86')](),_0x4993f4);})['then'](function(_0x52d078){_0x48a46e[_0x732f('0x87')]=_0x52d078[_0x732f('0x30')];if(_0x48a46e[_0x732f('0x87')]===0x0)return[];return db[_0x732f('0x88')][_0x732f('0x36')](_0x1fe7a2[_0x732f('0x86')](),_0x4993f4)[_0x732f('0x28')](function(_0x369684){_0x49eb6a=_[_0x732f('0x89')](_0x369684,'id');_0x4993f4=_[_0x732f('0x8a')](_0x4993f4,{'model':db[_0x732f('0x2d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4bfaf4['query']['fields']){_0x5ed949['attributes'][_0x732f('0x54')](function(_0x486c7f){_0x491880['field']('c.'+_0x486c7f);});}else{_0x491880[_0x732f('0x42')](_0x732f('0x77'));_0x491880['field']('c.firstName');_0x491880[_0x732f('0x42')]('c.lastName');_0x491880[_0x732f('0x42')]('c.phone');_0x491880['field']('c.mobile');_0x491880[_0x732f('0x42')](_0x732f('0x8b'));_0x491880[_0x732f('0x42')](_0x732f('0x8c'));_0x491880[_0x732f('0x42')](_0x732f('0x8d'));_0x491880[_0x732f('0x42')](_0x732f('0x8e'));_0x491880['field']('c.deletedAt');_0x491880[_0x732f('0x42')](_0x732f('0x8f'));_0x491880['field'](_0x732f('0x90'),'TagIds');}if(_0x5ed949['limit'])_0x491880[_0x732f('0x3c')](_0x5ed949[_0x732f('0x3c')]);if(_0x5ed949['offset'])_0x491880[_0x732f('0x23')](_0x5ed949[_0x732f('0x23')]);return db[_0x732f('0x88')][_0x732f('0x36')](_0x491880['toString'](),_0x4993f4);});})[_0x732f('0x28')](function(_0x3569fd){_0x3569fd[_0x732f('0x54')](function(_0x30e83c){if(_0x30e83c[_0x732f('0x91')]){_0x30e83c['Tags']=[];_0x30e83c[_0x732f('0x91')][_0x732f('0x52')](',')['forEach'](function(_0x490fd7){_0x30e83c['Tags'][_0x732f('0x31')](_0x49eb6a[_0x490fd7]);});}delete _0x30e83c['TagIds'];});_0x48a46e[_0x732f('0x92')]=_0x3569fd;return _0x48a46e;})[_0x732f('0x28')](respondWithFilteredResult(_0x430e44,_0x5ed949));})[_0x732f('0x93')](handleError(_0x430e44,null));};exports[_0x732f('0x29')]=function(_0x1c169a,_0x5d0133){return db['CmContact'][_0x732f('0x4f')]({'where':{'id':_0x1c169a[_0x732f('0x94')]['id']}})[_0x732f('0x28')](handleEntityNotFound(_0x5d0133,null))[_0x732f('0x28')](removeEntity(_0x5d0133,null))['catch'](handleError(_0x5d0133,null));};exports[_0x732f('0x2e')]=function(_0x5c2a42,_0x2cbf8e){return db[_0x732f('0x2d')][_0x732f('0x2e')]()[_0x732f('0x28')](function(_0x319719){delete _0x319719['tags'];for(var _0x51ebae=0x0;_0x51ebae{}\s\\|]/g,'-');_0x16d5c6(null,util[_0x9ee4('0x24')]('%s-%s%s',path[_0x9ee4('0x25')](_0x388536[_0x9ee4('0x23')],path[_0x9ee4('0x26')](_0x388536[_0x9ee4('0x23')])),Date['now'](),path[_0x9ee4('0x26')](_0x388536[_0x9ee4('0x23')])));}})});router[_0x9ee4('0x17')](_0x9ee4('0x27'),upload[_0x9ee4('0x28')](_0x9ee4('0x29')),controller[_0x9ee4('0x2a')]);var upload=multer({'storage':multer[_0x9ee4('0x1f')]({'destination':function(_0x2243e4,_0x26b5c8,_0x1d3fe8){_0x1d3fe8(null,path[_0x9ee4('0x20')](config[_0x9ee4('0x21')],_0x9ee4('0x22')));},'filename':function(_0x19b553,_0x212b9f,_0x28eec3){_0x212b9f[_0x9ee4('0x23')]=_0x212b9f[_0x9ee4('0x23')][_0x9ee4('0x2b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x28eec3(null,util['format'](_0x9ee4('0x2c'),path[_0x9ee4('0x25')](_0x212b9f['originalname'],path[_0x9ee4('0x26')](_0x212b9f[_0x9ee4('0x23')])),Date[_0x9ee4('0x2d')](),path['extname'](_0x212b9f[_0x9ee4('0x23')])));}})});router[_0x9ee4('0x17')](_0x9ee4('0x2e'),upload[_0x9ee4('0x28')](_0x9ee4('0x29')),controller[_0x9ee4('0x2f')]);router[_0x9ee4('0x17')](_0x9ee4('0x30'),auth[_0x9ee4('0x9')](),controller[_0x9ee4('0x31')]);router[_0x9ee4('0x32')](_0x9ee4('0xd'),auth['isAuthenticated'](),controller[_0x9ee4('0x33')]);router[_0x9ee4('0x34')](_0x9ee4('0xd'),auth[_0x9ee4('0x9')](),controller[_0x9ee4('0x35')]);module[_0x9ee4('0x36')]=router; \ No newline at end of file +var _0xff50=['/describe','describe','/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','setTags','join','server/files/tmp','originalname','replace','format','basename','now','extname','/csv','single','file','uploadCsv','diskStorage','root','%s-%s%s','/upload','/upload/:id','put','update','delete','destroy','util','Router','fs-extra','../../components/auth/service','../../config/environment','./cmContact.controller','get','isAuthenticated'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xff50,0x112));var _0x0ff5=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0xff50[_0x2d89ce];return _0x3fad10;};'use strict';var multer=require('multer');var util=require(_0x0ff5('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0ff5('0x1')]();var fs_extra=require(_0x0ff5('0x2'));var auth=require(_0x0ff5('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0ff5('0x4'));var controller=require(_0x0ff5('0x5'));router[_0x0ff5('0x6')]('/',auth[_0x0ff5('0x7')](),controller['index']);router[_0x0ff5('0x6')](_0x0ff5('0x8'),auth['isAuthenticated'](),controller[_0x0ff5('0x9')]);router[_0x0ff5('0x6')](_0x0ff5('0xa'),auth[_0x0ff5('0x7')](),controller[_0x0ff5('0xb')]);router[_0x0ff5('0x6')](_0x0ff5('0xc'),auth[_0x0ff5('0x7')](),controller[_0x0ff5('0xd')]);router['get'](_0x0ff5('0xe'),auth[_0x0ff5('0x7')](),controller[_0x0ff5('0xf')]);router[_0x0ff5('0x6')](_0x0ff5('0x10'),auth[_0x0ff5('0x7')](),controller['getHopperHistories']);router['get'](_0x0ff5('0x11'),auth[_0x0ff5('0x7')](),controller[_0x0ff5('0x12')]);router[_0x0ff5('0x6')]('/:id/jscripty_sessions',auth[_0x0ff5('0x7')](),controller[_0x0ff5('0x13')]);router[_0x0ff5('0x6')](_0x0ff5('0x14'),auth[_0x0ff5('0x7')](),controller[_0x0ff5('0x15')]);router[_0x0ff5('0x16')]('/merge',auth[_0x0ff5('0x7')](),controller['merge']);router[_0x0ff5('0x16')]('/',auth[_0x0ff5('0x7')](),controller[_0x0ff5('0x17')]);router['post'](_0x0ff5('0x18'),auth[_0x0ff5('0x7')](),controller['bulkCreate']);router['post']('/:id/tags',auth['isAuthenticated'](),controller[_0x0ff5('0x19')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x32c972,_0x298566,_0x4e37a5){_0x4e37a5(null,path[_0x0ff5('0x1a')](config['root'],_0x0ff5('0x1b')));},'filename':function(_0x198634,_0xaf4771,_0x3292bc){_0xaf4771[_0x0ff5('0x1c')]=_0xaf4771['originalname'][_0x0ff5('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3292bc(null,util[_0x0ff5('0x1e')]('%s-%s%s',path[_0x0ff5('0x1f')](_0xaf4771[_0x0ff5('0x1c')],path['extname'](_0xaf4771['originalname'])),Date[_0x0ff5('0x20')](),path[_0x0ff5('0x21')](_0xaf4771[_0x0ff5('0x1c')])));}})});router[_0x0ff5('0x16')](_0x0ff5('0x22'),upload[_0x0ff5('0x23')](_0x0ff5('0x24')),controller[_0x0ff5('0x25')]);var upload=multer({'storage':multer[_0x0ff5('0x26')]({'destination':function(_0x58d43b,_0xb71aa2,_0x286bd2){_0x286bd2(null,path[_0x0ff5('0x1a')](config[_0x0ff5('0x27')],_0x0ff5('0x1b')));},'filename':function(_0x4c6c8d,_0x4b037e,_0x4ca536){_0x4b037e[_0x0ff5('0x1c')]=_0x4b037e[_0x0ff5('0x1c')][_0x0ff5('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4ca536(null,util[_0x0ff5('0x1e')](_0x0ff5('0x28'),path[_0x0ff5('0x1f')](_0x4b037e[_0x0ff5('0x1c')],path[_0x0ff5('0x21')](_0x4b037e[_0x0ff5('0x1c')])),Date['now'](),path[_0x0ff5('0x21')](_0x4b037e[_0x0ff5('0x1c')])));}})});router[_0x0ff5('0x16')](_0x0ff5('0x29'),upload[_0x0ff5('0x23')](_0x0ff5('0x24')),controller['upload']);router[_0x0ff5('0x16')](_0x0ff5('0x2a'),auth['isAuthenticated'](),controller['import']);router[_0x0ff5('0x2b')](_0x0ff5('0xa'),auth[_0x0ff5('0x7')](),controller[_0x0ff5('0x2c')]);router[_0x0ff5('0x2d')]('/:id',auth[_0x0ff5('0x7')](),controller[_0x0ff5('0x2e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 463c691..f336df7 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 _0xe647=['select','parse','values','stringify','BOOLEAN','sequelize','lodash','VIRTUAL','getDataValue','setDataValue','alias','name','TEXT','long','type'];(function(_0x4d196a,_0x1ae495){var _0x8eac53=function(_0x10d975){while(--_0x10d975){_0x4d196a['push'](_0x4d196a['shift']());}};_0x8eac53(++_0x1ae495);}(_0xe647,0x16d));var _0x7e64=function(_0x12d736,_0x148e84){_0x12d736=_0x12d736-0x0;var _0x28a5a7=_0xe647[_0x12d736];return _0x28a5a7;};'use strict';var Sequelize=require(_0x7e64('0x0'));var _=require(_0x7e64('0x1'));module['exports']={'name':{'type':Sequelize[_0x7e64('0x2')],'get':function(_0x3b3e4f){return this[_0x7e64('0x3')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x7ed710){this[_0x7e64('0x4')](_0x7e64('0x5'),_0x7ed710?_0x7ed710:this[_0x7e64('0x3')](_0x7e64('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x7e64('0x7')](_0x7e64('0x8')),'get':function(){if(this[_0x7e64('0x3')](_0x7e64('0x9'))===_0x7e64('0xa')){return JSON[_0x7e64('0xb')](this[_0x7e64('0x3')](_0x7e64('0xc')));}else{return this[_0x7e64('0x3')](_0x7e64('0xc'));}},'set':function(_0x55b588){if(Array['isArray'](_0x55b588)){this['setDataValue'](_0x7e64('0xc'),JSON[_0x7e64('0xd')](_0x55b588));}else{this[_0x7e64('0x4')]('values',_0x55b588);}}},'required':{'type':Sequelize[_0x7e64('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x7e64('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file +var _0x7d86=['voice','sequelize','exports','VIRTUAL','getDataValue','alias','STRING','name','TEXT','long','type','select','parse','values','isArray','setDataValue','stringify','BOOLEAN','ENUM'];(function(_0x3b77cb,_0x29d1ff){var _0x1549e4=function(_0x155a3b){while(--_0x155a3b){_0x3b77cb['push'](_0x3b77cb['shift']());}};_0x1549e4(++_0x29d1ff);}(_0x7d86,0x86));var _0x67d8=function(_0x59fad0,_0x395d80){_0x59fad0=_0x59fad0-0x0;var _0x19dd50=_0x7d86[_0x59fad0];return _0x19dd50;};'use strict';var Sequelize=require(_0x67d8('0x0'));var _=require('lodash');module[_0x67d8('0x1')]={'name':{'type':Sequelize[_0x67d8('0x2')],'get':function(_0x1f833f){return this[_0x67d8('0x3')](_0x67d8('0x4'));}},'alias':{'type':Sequelize[_0x67d8('0x5')],'allowNull':![],'set':function(_0x3f58a1){this['setDataValue'](_0x67d8('0x4'),_0x3f58a1?_0x3f58a1:this[_0x67d8('0x3')](_0x67d8('0x6')));}},'type':{'type':Sequelize[_0x67d8('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x67d8('0x7')](_0x67d8('0x8')),'get':function(){if(this[_0x67d8('0x3')](_0x67d8('0x9'))===_0x67d8('0xa')){return JSON[_0x67d8('0xb')](this[_0x67d8('0x3')](_0x67d8('0xc')));}else{return this[_0x67d8('0x3')](_0x67d8('0xc'));}},'set':function(_0x2b1fe6){if(Array[_0x67d8('0xd')](_0x2b1fe6)){this[_0x67d8('0xe')](_0x67d8('0xc'),JSON[_0x67d8('0xf')](_0x2b1fe6));}else{this[_0x67d8('0xe')](_0x67d8('0xc'),_0x2b1fe6);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x67d8('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x67d8('0x11')](_0x67d8('0x12'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 9d1aa47..e27a1fd 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 _0x483f=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','CmCustomField','rawAttributes','fieldName','key','model','differenceBy','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','count','includeAll','include','rows','catch','show','keys','find','body','params','create','transaction','Sequelize','TEXT','INTEGER','BOOLEAN','defaultValue','sequelize','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x376a9b,_0xedcbfd){var _0x2b6262=function(_0x249ff4){while(--_0x249ff4){_0x376a9b['push'](_0x376a9b['shift']());}};_0x2b6262(++_0xedcbfd);}(_0x483f,0x9a));var _0xf483=function(_0xd95e52,_0x305400){_0xd95e52=_0xd95e52-0x0;var _0x26584e=_0x483f[_0xd95e52];return _0x26584e;};'use strict';var emlformat=require(_0xf483('0x0'));var rimraf=require(_0xf483('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf483('0x2'));var rp=require(_0xf483('0x3'));var moment=require(_0xf483('0x4'));var BPromise=require(_0xf483('0x5'));var Mustache=require(_0xf483('0x6'));var util=require(_0xf483('0x7'));var path=require(_0xf483('0x8'));var sox=require('sox');var csv=require(_0xf483('0x9'));var ejs=require(_0xf483('0xa'));var fs=require('fs');var fs_extra=require(_0xf483('0xb'));var _=require('lodash');var squel=require(_0xf483('0xc'));var crypto=require(_0xf483('0xd'));var jsforce=require(_0xf483('0xe'));var deskjs=require(_0xf483('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf483('0x10'));var Papa=require('papaparse');var Redis=require(_0xf483('0x11'));var authService=require(_0xf483('0x12'));var qs=require(_0xf483('0x13'));var as=require(_0xf483('0x14'));var hardwareService=require(_0xf483('0x15'));var logger=require('../../config/logger')(_0xf483('0x16'));var utils=require('../../config/utils');var config=require(_0xf483('0x17'));var licenseUtil=require(_0xf483('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30a130,_0x539aaa){_0x539aaa=_0x539aaa||0xcc;return function(_0x57a259){if(_0x57a259){return _0x30a130[_0xf483('0x19')](_0x539aaa);}return _0x30a130['status'](_0x539aaa)[_0xf483('0x1a')]();};}function respondWithResult(_0xa1a26c,_0x3054aa){_0x3054aa=_0x3054aa||0xc8;return function(_0x423b4b){if(_0x423b4b){return _0xa1a26c[_0xf483('0x1b')](_0x3054aa)[_0xf483('0x1c')](_0x423b4b);}};}function respondWithFilteredResult(_0x173ca2,_0x53562e){return function(_0x16b069){if(_0x16b069){var _0x209c99=_0x16b069['count'],_0x44da16=_0x53562e[_0xf483('0x1d')],_0x5f390b=_0x53562e[_0xf483('0x1d')]+_0x53562e[_0xf483('0x1e')],_0xe4237d;if(_0x5f390b>=_0x209c99){_0x5f390b=_0x209c99;_0xe4237d=0xc8;}else{_0xe4237d=0xce;}_0x173ca2[_0xf483('0x1b')](_0xe4237d);return _0x173ca2['set'](_0xf483('0x1f'),_0x44da16+'-'+_0x5f390b+'/'+_0x209c99)['json'](_0x16b069);}return null;};}function patchUpdates(_0x972cae){return function(_0x1862aa){try{jsonpatch[_0xf483('0x20')](_0x1862aa,_0x972cae,!![]);}catch(_0xaa6087){return BPromise[_0xf483('0x21')](_0xaa6087);}return _0x1862aa[_0xf483('0x22')]();};}function saveUpdates(_0x220603,_0x2e91aa){return function(_0xc37f25){if(_0xc37f25){return _0xc37f25[_0xf483('0x23')](_0x220603)[_0xf483('0x24')](function(_0x25f854){return _0x25f854;});}return null;};}function removeEntity(_0xc7f4b7,_0x5b557e){return function(_0x59c8f3){if(_0x59c8f3){return _0x59c8f3[_0xf483('0x25')]()[_0xf483('0x24')](function(){_0xc7f4b7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6618f6,_0x594887){return function(_0x216594){if(!_0x216594){_0x6618f6[_0xf483('0x19')](0x194);}return _0x216594;};}function handleError(_0x3e0e0f,_0x3d411f){_0x3d411f=_0x3d411f||0x1f4;return function(_0x23bd7b){logger['error'](_0x23bd7b['stack']);if(_0x23bd7b[_0xf483('0x26')]){delete _0x23bd7b[_0xf483('0x26')];}_0x3e0e0f[_0xf483('0x1b')](_0x3d411f)[_0xf483('0x27')](_0x23bd7b);};}exports[_0xf483('0x28')]=function(_0xf6312e,_0x21802c){var _0x93d9ef={},_0x2603f4={},_0x373a5e={'count':0x0,'rows':[]};var _0x2f8fef=_[_0xf483('0x29')](db[_0xf483('0x2a')][_0xf483('0x2b')],function(_0x587cc1){return{'name':_0x587cc1[_0xf483('0x2c')],'type':_0x587cc1['type'][_0xf483('0x2d')]};});_0x2603f4[_0xf483('0x2e')]=_[_0xf483('0x2f')](_[_0xf483('0x29')](_0x2f8fef,_0xf483('0x26')),[_0xf483('0x26')]);_0x2603f4[_0xf483('0x30')]=_['keys'](_0xf6312e[_0xf483('0x30')]);_0x2603f4[_0xf483('0x31')]=_[_0xf483('0x32')](_0x2603f4[_0xf483('0x2e')],_0x2603f4[_0xf483('0x30')]);_0x93d9ef[_0xf483('0x33')]=_[_0xf483('0x32')](_0x2603f4[_0xf483('0x2e')],qs[_0xf483('0x34')](_0xf6312e['query'][_0xf483('0x34')]));_0x93d9ef[_0xf483('0x33')]=_0x93d9ef[_0xf483('0x33')][_0xf483('0x35')]?_0x93d9ef[_0xf483('0x33')]:_0x2603f4['model'];if(!_0xf6312e[_0xf483('0x30')]['hasOwnProperty'](_0xf483('0x36'))){_0x93d9ef[_0xf483('0x1e')]=qs[_0xf483('0x1e')](_0xf6312e[_0xf483('0x30')][_0xf483('0x1e')]);_0x93d9ef[_0xf483('0x1d')]=qs[_0xf483('0x1d')](_0xf6312e[_0xf483('0x30')][_0xf483('0x1d')]);}_0x93d9ef[_0xf483('0x37')]=qs[_0xf483('0x38')](_0xf6312e[_0xf483('0x30')][_0xf483('0x38')]);_0x93d9ef[_0xf483('0x39')]=qs['filters'](_[_0xf483('0x3a')](_0xf6312e[_0xf483('0x30')],_0x2603f4['filters']),_0x2f8fef);if(_0xf6312e[_0xf483('0x30')]['filter']){_0x93d9ef['where']=_[_0xf483('0x3b')](_0x93d9ef[_0xf483('0x39')],{'$or':_['map'](_0x2f8fef,function(_0x815ee3){if(_0x815ee3[_0xf483('0x3c')]!==_0xf483('0x3d')){var _0x3ee774={};_0x3ee774[_0x815ee3[_0xf483('0x26')]]={'$like':'%'+_0xf6312e[_0xf483('0x30')][_0xf483('0x3e')]+'%'};return _0x3ee774;}})});}_0x93d9ef=_[_0xf483('0x3b')]({},_0x93d9ef,_0xf6312e[_0xf483('0x3f')]);var _0x28e191={'where':_0x93d9ef['where']};return db[_0xf483('0x2a')][_0xf483('0x40')](_0x28e191)[_0xf483('0x24')](function(_0x22aed8){_0x373a5e[_0xf483('0x40')]=_0x22aed8;if(_0xf6312e[_0xf483('0x30')][_0xf483('0x41')]){_0x93d9ef[_0xf483('0x42')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x93d9ef);})[_0xf483('0x24')](function(_0x2c28c5){_0x373a5e[_0xf483('0x43')]=_0x2c28c5;return _0x373a5e;})[_0xf483('0x24')](respondWithFilteredResult(_0x21802c,_0x93d9ef))[_0xf483('0x44')](handleError(_0x21802c,null));};exports[_0xf483('0x45')]=function(_0x48754c,_0x56a0c2){var _0x2e6b37={'raw':!![],'where':{'id':_0x48754c['params']['id']}},_0x37e03c={};_0x37e03c[_0xf483('0x2e')]=_['keys'](db[_0xf483('0x2a')]['rawAttributes']);_0x37e03c[_0xf483('0x30')]=_[_0xf483('0x46')](_0x48754c[_0xf483('0x30')]);_0x37e03c[_0xf483('0x31')]=_[_0xf483('0x32')](_0x37e03c[_0xf483('0x2e')],_0x37e03c[_0xf483('0x30')]);_0x2e6b37[_0xf483('0x33')]=_[_0xf483('0x32')](_0x37e03c[_0xf483('0x2e')],qs[_0xf483('0x34')](_0x48754c[_0xf483('0x30')][_0xf483('0x34')]));_0x2e6b37[_0xf483('0x33')]=_0x2e6b37['attributes'][_0xf483('0x35')]?_0x2e6b37[_0xf483('0x33')]:_0x37e03c[_0xf483('0x2e')];if(_0x48754c['query'][_0xf483('0x41')]){_0x2e6b37[_0xf483('0x42')]=[{'all':!![]}];}_0x2e6b37=_[_0xf483('0x3b')]({},_0x2e6b37,_0x48754c['options']);return db[_0xf483('0x2a')][_0xf483('0x47')](_0x2e6b37)[_0xf483('0x24')](handleEntityNotFound(_0x56a0c2,null))[_0xf483('0x24')](respondWithResult(_0x56a0c2,null))[_0xf483('0x44')](handleError(_0x56a0c2,null));};exports[_0xf483('0x23')]=function(_0x45f22f,_0x45b2db){if(_0x45f22f[_0xf483('0x48')]['id']){delete _0x45f22f[_0xf483('0x48')]['id'];}return db[_0xf483('0x2a')][_0xf483('0x47')]({'where':{'id':_0x45f22f[_0xf483('0x49')]['id']}})[_0xf483('0x24')](handleEntityNotFound(_0x45b2db,null))['then'](saveUpdates(_0x45f22f['body'],null))[_0xf483('0x24')](respondWithResult(_0x45b2db,null))['catch'](handleError(_0x45b2db,null));};exports[_0xf483('0x25')]=function(_0x1061d6,_0x26adc1){return db[_0xf483('0x2a')]['find']({'where':{'id':_0x1061d6[_0xf483('0x49')]['id']}})[_0xf483('0x24')](handleEntityNotFound(_0x26adc1,null))['then'](removeEntity(_0x26adc1,null))[_0xf483('0x44')](handleError(_0x26adc1,null));};exports[_0xf483('0x4a')]=function(_0x244531,_0x1546b1){var _0x2c1441;return db['sequelize'][_0xf483('0x4b')](function(_0x51dbe6){return db['CmCustomField'][_0xf483('0x4a')](_0x244531[_0xf483('0x48')],{'transaction':_0x51dbe6})['then'](function(_0xa9cd8){_0x2c1441=_0xa9cd8;var _0x325c7f={'type':db[_0xf483('0x4c')][_0xf483('0x4d')],'transaction':_0x51dbe6};switch(_0x244531['body'][_0xf483('0x3c')]){case'text':_0x325c7f[_0xf483('0x3c')]=db[_0xf483('0x4c')][_0xf483('0x4d')];break;case'number':_0x325c7f[_0xf483('0x3c')]=db[_0xf483('0x4c')][_0xf483('0x4e')];break;case'switch':_0x325c7f[_0xf483('0x3c')]=db[_0xf483('0x4c')][_0xf483('0x4f')];_0x325c7f[_0xf483('0x50')]=![];break;default:}return db[_0xf483('0x51')]['queryInterface'][_0xf483('0x52')](_0xf483('0x53'),util[_0xf483('0x54')](_0xf483('0x55'),_0x2c1441['id']),_0x325c7f);})[_0xf483('0x24')](function(){return _0x2c1441;});})['then'](respondWithResult(_0x1546b1,0xc9))['catch'](handleError(_0x1546b1,null));}; \ No newline at end of file +var _0xc099=['eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','CmCustomField','rawAttributes','type','key','model','differenceBy','keys','query','filters','attributes','intersection','fields','length','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','update','body','destroy','find','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','addColumn','cm_contacts','format'];(function(_0x574d22,_0xd51b0f){var _0x183700=function(_0x325383){while(--_0x325383){_0x574d22['push'](_0x574d22['shift']());}};_0x183700(++_0xd51b0f);}(_0xc099,0x1ae));var _0x9c09=function(_0x136301,_0x49547c){_0x136301=_0x136301-0x0;var _0x3503ef=_0xc099[_0x136301];return _0x3503ef;};'use strict';var emlformat=require(_0x9c09('0x0'));var rimraf=require(_0x9c09('0x1'));var zipdir=require(_0x9c09('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9c09('0x3'));var Mustache=require(_0x9c09('0x4'));var util=require(_0x9c09('0x5'));var path=require(_0x9c09('0x6'));var sox=require(_0x9c09('0x7'));var csv=require(_0x9c09('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c09('0x9'));var _=require('lodash');var squel=require(_0x9c09('0xa'));var crypto=require(_0x9c09('0xb'));var jsforce=require(_0x9c09('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9c09('0x8'));var querystring=require(_0x9c09('0xd'));var Papa=require(_0x9c09('0xe'));var Redis=require(_0x9c09('0xf'));var authService=require(_0x9c09('0x10'));var qs=require(_0x9c09('0x11'));var as=require(_0x9c09('0x12'));var hardwareService=require(_0x9c09('0x13'));var logger=require(_0x9c09('0x14'))(_0x9c09('0x15'));var utils=require(_0x9c09('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9c09('0x17'));var db=require(_0x9c09('0x18'))['db'];function respondWithStatusCode(_0x897d89,_0x264a2f){_0x264a2f=_0x264a2f||0xcc;return function(_0x24df84){if(_0x24df84){return _0x897d89[_0x9c09('0x19')](_0x264a2f);}return _0x897d89[_0x9c09('0x1a')](_0x264a2f)[_0x9c09('0x1b')]();};}function respondWithResult(_0x7c2423,_0x1ad52a){_0x1ad52a=_0x1ad52a||0xc8;return function(_0x1a0b2c){if(_0x1a0b2c){return _0x7c2423[_0x9c09('0x1a')](_0x1ad52a)[_0x9c09('0x1c')](_0x1a0b2c);}};}function respondWithFilteredResult(_0x23fb3f,_0x59cfa1){return function(_0x5ad223){if(_0x5ad223){var _0xd3c9c7=_0x5ad223[_0x9c09('0x1d')],_0x45aa7b=_0x59cfa1[_0x9c09('0x1e')],_0x17c707=_0x59cfa1[_0x9c09('0x1e')]+_0x59cfa1[_0x9c09('0x1f')],_0x217e54;if(_0x17c707>=_0xd3c9c7){_0x17c707=_0xd3c9c7;_0x217e54=0xc8;}else{_0x217e54=0xce;}_0x23fb3f[_0x9c09('0x1a')](_0x217e54);return _0x23fb3f[_0x9c09('0x20')](_0x9c09('0x21'),_0x45aa7b+'-'+_0x17c707+'/'+_0xd3c9c7)[_0x9c09('0x1c')](_0x5ad223);}return null;};}function patchUpdates(_0x26ac8e){return function(_0x2cd1a2){try{jsonpatch[_0x9c09('0x22')](_0x2cd1a2,_0x26ac8e,!![]);}catch(_0x17e87d){return BPromise[_0x9c09('0x23')](_0x17e87d);}return _0x2cd1a2[_0x9c09('0x24')]();};}function saveUpdates(_0x1239c1,_0x3c4b67){return function(_0x2f6d25){if(_0x2f6d25){return _0x2f6d25['update'](_0x1239c1)[_0x9c09('0x25')](function(_0x4c2fda){return _0x4c2fda;});}return null;};}function removeEntity(_0x1c8fd0,_0x4d9502){return function(_0x14a47d){if(_0x14a47d){return _0x14a47d['destroy']()[_0x9c09('0x25')](function(){_0x1c8fd0['status'](0xcc)[_0x9c09('0x1b')]();});}};}function handleEntityNotFound(_0xd8dc55,_0x5cd527){return function(_0x33705c){if(!_0x33705c){_0xd8dc55[_0x9c09('0x19')](0x194);}return _0x33705c;};}function handleError(_0x39a2ce,_0x79d984){_0x79d984=_0x79d984||0x1f4;return function(_0x205438){logger[_0x9c09('0x26')](_0x205438[_0x9c09('0x27')]);if(_0x205438[_0x9c09('0x28')]){delete _0x205438[_0x9c09('0x28')];}_0x39a2ce['status'](_0x79d984)[_0x9c09('0x29')](_0x205438);};}exports[_0x9c09('0x2a')]=function(_0x1bf7d9,_0x378930){var _0x4cd4e9={},_0x443d51={},_0x11a181={'count':0x0,'rows':[]};var _0x2323b9=_[_0x9c09('0x2b')](db[_0x9c09('0x2c')][_0x9c09('0x2d')],function(_0x2795b2){return{'name':_0x2795b2['fieldName'],'type':_0x2795b2[_0x9c09('0x2e')][_0x9c09('0x2f')]};});_0x443d51[_0x9c09('0x30')]=_[_0x9c09('0x31')](_[_0x9c09('0x2b')](_0x2323b9,_0x9c09('0x28')),['name']);_0x443d51['query']=_[_0x9c09('0x32')](_0x1bf7d9[_0x9c09('0x33')]);_0x443d51[_0x9c09('0x34')]=_['intersection'](_0x443d51[_0x9c09('0x30')],_0x443d51[_0x9c09('0x33')]);_0x4cd4e9[_0x9c09('0x35')]=_[_0x9c09('0x36')](_0x443d51[_0x9c09('0x30')],qs[_0x9c09('0x37')](_0x1bf7d9[_0x9c09('0x33')][_0x9c09('0x37')]));_0x4cd4e9[_0x9c09('0x35')]=_0x4cd4e9[_0x9c09('0x35')][_0x9c09('0x38')]?_0x4cd4e9[_0x9c09('0x35')]:_0x443d51[_0x9c09('0x30')];if(!_0x1bf7d9['query']['hasOwnProperty']('nolimit')){_0x4cd4e9[_0x9c09('0x1f')]=qs['limit'](_0x1bf7d9[_0x9c09('0x33')][_0x9c09('0x1f')]);_0x4cd4e9['offset']=qs[_0x9c09('0x1e')](_0x1bf7d9[_0x9c09('0x33')][_0x9c09('0x1e')]);}_0x4cd4e9['order']=qs['sort'](_0x1bf7d9['query']['sort']);_0x4cd4e9[_0x9c09('0x39')]=qs[_0x9c09('0x34')](_[_0x9c09('0x3a')](_0x1bf7d9[_0x9c09('0x33')],_0x443d51[_0x9c09('0x34')]),_0x2323b9);if(_0x1bf7d9['query']['filter']){_0x4cd4e9['where']=_[_0x9c09('0x3b')](_0x4cd4e9[_0x9c09('0x39')],{'$or':_['map'](_0x2323b9,function(_0x5775d4){if(_0x5775d4[_0x9c09('0x2e')]!==_0x9c09('0x3c')){var _0x301cd4={};_0x301cd4[_0x5775d4['name']]={'$like':'%'+_0x1bf7d9[_0x9c09('0x33')][_0x9c09('0x3d')]+'%'};return _0x301cd4;}})});}_0x4cd4e9=_[_0x9c09('0x3b')]({},_0x4cd4e9,_0x1bf7d9[_0x9c09('0x3e')]);var _0x14ad21={'where':_0x4cd4e9[_0x9c09('0x39')]};return db['CmCustomField']['count'](_0x14ad21)['then'](function(_0x4f8454){_0x11a181[_0x9c09('0x1d')]=_0x4f8454;if(_0x1bf7d9[_0x9c09('0x33')][_0x9c09('0x3f')]){_0x4cd4e9[_0x9c09('0x40')]=[{'all':!![]}];}return db[_0x9c09('0x2c')][_0x9c09('0x41')](_0x4cd4e9);})[_0x9c09('0x25')](function(_0x50c05b){_0x11a181[_0x9c09('0x42')]=_0x50c05b;return _0x11a181;})[_0x9c09('0x25')](respondWithFilteredResult(_0x378930,_0x4cd4e9))[_0x9c09('0x43')](handleError(_0x378930,null));};exports[_0x9c09('0x44')]=function(_0x1bdac1,_0xac4521){var _0x2438db={'raw':!![],'where':{'id':_0x1bdac1[_0x9c09('0x45')]['id']}},_0x3cb925={};_0x3cb925[_0x9c09('0x30')]=_[_0x9c09('0x32')](db[_0x9c09('0x2c')][_0x9c09('0x2d')]);_0x3cb925[_0x9c09('0x33')]=_[_0x9c09('0x32')](_0x1bdac1[_0x9c09('0x33')]);_0x3cb925['filters']=_[_0x9c09('0x36')](_0x3cb925[_0x9c09('0x30')],_0x3cb925[_0x9c09('0x33')]);_0x2438db[_0x9c09('0x35')]=_[_0x9c09('0x36')](_0x3cb925[_0x9c09('0x30')],qs[_0x9c09('0x37')](_0x1bdac1[_0x9c09('0x33')][_0x9c09('0x37')]));_0x2438db[_0x9c09('0x35')]=_0x2438db[_0x9c09('0x35')][_0x9c09('0x38')]?_0x2438db[_0x9c09('0x35')]:_0x3cb925[_0x9c09('0x30')];if(_0x1bdac1[_0x9c09('0x33')][_0x9c09('0x3f')]){_0x2438db[_0x9c09('0x40')]=[{'all':!![]}];}_0x2438db=_[_0x9c09('0x3b')]({},_0x2438db,_0x1bdac1['options']);return db[_0x9c09('0x2c')]['find'](_0x2438db)[_0x9c09('0x25')](handleEntityNotFound(_0xac4521,null))[_0x9c09('0x25')](respondWithResult(_0xac4521,null))[_0x9c09('0x43')](handleError(_0xac4521,null));};exports[_0x9c09('0x46')]=function(_0x4a127a,_0x406b0d){if(_0x4a127a[_0x9c09('0x47')]['id']){delete _0x4a127a[_0x9c09('0x47')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x4a127a[_0x9c09('0x45')]['id']}})['then'](handleEntityNotFound(_0x406b0d,null))[_0x9c09('0x25')](saveUpdates(_0x4a127a[_0x9c09('0x47')],null))[_0x9c09('0x25')](respondWithResult(_0x406b0d,null))[_0x9c09('0x43')](handleError(_0x406b0d,null));};exports[_0x9c09('0x48')]=function(_0x4ef3bc,_0x1c13b5){return db['CmCustomField'][_0x9c09('0x49')]({'where':{'id':_0x4ef3bc[_0x9c09('0x45')]['id']}})[_0x9c09('0x25')](handleEntityNotFound(_0x1c13b5,null))[_0x9c09('0x25')](removeEntity(_0x1c13b5,null))[_0x9c09('0x43')](handleError(_0x1c13b5,null));};exports[_0x9c09('0x4a')]=function(_0x2574b9,_0x3f9fb4){var _0x53f1fa;return db[_0x9c09('0x4b')][_0x9c09('0x4c')](function(_0x2f1593){return db[_0x9c09('0x2c')][_0x9c09('0x4a')](_0x2574b9[_0x9c09('0x47')],{'transaction':_0x2f1593})[_0x9c09('0x25')](function(_0x4e9f07){_0x53f1fa=_0x4e9f07;var _0x31de7f={'type':db[_0x9c09('0x4d')][_0x9c09('0x4e')],'transaction':_0x2f1593};switch(_0x2574b9[_0x9c09('0x47')]['type']){case _0x9c09('0x4f'):_0x31de7f[_0x9c09('0x2e')]=db[_0x9c09('0x4d')][_0x9c09('0x4e')];break;case _0x9c09('0x50'):_0x31de7f[_0x9c09('0x2e')]=db[_0x9c09('0x4d')][_0x9c09('0x51')];break;case _0x9c09('0x52'):_0x31de7f[_0x9c09('0x2e')]=db[_0x9c09('0x4d')]['BOOLEAN'];_0x31de7f['defaultValue']=![];break;default:}return db[_0x9c09('0x4b')]['queryInterface'][_0x9c09('0x53')](_0x9c09('0x54'),util[_0x9c09('0x55')]('cf_%d',_0x53f1fa['id']),_0x31de7f);})[_0x9c09('0x25')](function(){return _0x53f1fa;});})[_0x9c09('0x25')](respondWithResult(_0x3f9fb4,0xc9))[_0x9c09('0x43')](handleError(_0x3f9fb4,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 534d568..51c7e5e 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 _0x678e=['util','../../config/logger','api','request-promise','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','lodash'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x678e,0x153));var _0xe678=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x678e[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xe678('0x0'));var util=require(_0xe678('0x1'));var logger=require(_0xe678('0x2'))(_0xe678('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe678('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe678('0x5'));var attributes=require(_0xe678('0x6'));module[_0xe678('0x7')]=function(_0x3c8d8d,_0x56194f){return _0x3c8d8d[_0xe678('0x8')](_0xe678('0x9'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7925=['CmCustomField','cm_custom_fields','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports'];(function(_0x564945,_0xe354bb){var _0x356a3e=function(_0x3622d8){while(--_0x3622d8){_0x564945['push'](_0x564945['shift']());}};_0x356a3e(++_0xe354bb);}(_0x7925,0xe6));var _0x5792=function(_0x3b638e,_0x1ccce9){_0x3b638e=_0x3b638e-0x0;var _0x437d5c=_0x7925[_0x3b638e];return _0x437d5c;};'use strict';var _=require('lodash');var util=require(_0x5792('0x0'));var logger=require(_0x5792('0x1'))('api');var moment=require(_0x5792('0x2'));var BPromise=require(_0x5792('0x3'));var rp=require(_0x5792('0x4'));var fs=require('fs');var path=require(_0x5792('0x5'));var rimraf=require(_0x5792('0x6'));var config=require(_0x5792('0x7'));var attributes=require(_0x5792('0x8'));module[_0x5792('0x9')]=function(_0x2e6f7b,_0x5bb20f){return _0x2e6f7b['define'](_0x5792('0xa'),attributes,{'tableName':_0x5792('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index fc2c558..147f925 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 _0x5b02=['client','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0x5b02,0xe9));var _0x25b0=function(_0x253a0d,_0x1427d6){_0x253a0d=_0x253a0d-0x0;var _0x30dfc9=_0x5b02[_0x253a0d];return _0x30dfc9;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var moment=require(_0x25b0('0x2'));var BPromise=require(_0x25b0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x25b0('0x5'))(_0x25b0('0x6'));var config=require(_0x25b0('0x7'));var jayson=require(_0x25b0('0x8'));var client=jayson[_0x25b0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d82c6,_0xd8276d,_0x49ef3a){return new BPromise(function(_0x412954,_0x4d3e71){return client['request'](_0x1d82c6,_0x49ef3a)[_0x25b0('0xa')](function(_0x45429b){logger[_0x25b0('0xb')]('CmCustomField,\x20%s,\x20%s',_0xd8276d,_0x25b0('0xc'));logger[_0x25b0('0xd')](_0x25b0('0xe'),_0xd8276d,_0x25b0('0xc'),JSON[_0x25b0('0xf')](_0x45429b));if(_0x45429b[_0x25b0('0x10')]){if(_0x45429b[_0x25b0('0x10')][_0x25b0('0x11')]===0x1f4){logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);return _0x4d3e71(_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);}logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);return _0x412954(_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);}else{logger[_0x25b0('0xb')]('CmCustomField,\x20%s,\x20%s',_0xd8276d,'request\x20sent');_0x412954(_0x45429b[_0x25b0('0x14')]['message']);}})[_0x25b0('0x15')](function(_0x1d009f){logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x1d009f);_0x4d3e71(_0x1d009f);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','CmCustomField,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x525be3,_0x203bc2){var _0x5b16d9=function(_0x333b79){while(--_0x333b79){_0x525be3['push'](_0x525be3['shift']());}};_0x5b16d9(++_0x203bc2);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('CmCustomField,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('CmCustomField,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('CmCustomField,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 30a04a8..3c844d4 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 _0xd24f=['post','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x28563d,_0x36e17e){var _0x491cfb=function(_0x3fd595){while(--_0x3fd595){_0x28563d['push'](_0x28563d['shift']());}};_0x491cfb(++_0x36e17e);}(_0xd24f,0x122));var _0xfd24=function(_0x348652,_0x1ab849){_0x348652=_0x348652-0x0;var _0x18a9ea=_0xd24f[_0x348652];return _0x18a9ea;};'use strict';var multer=require(_0xfd24('0x0'));var util=require(_0xfd24('0x1'));var path=require('path');var timeout=require(_0xfd24('0x2'));var express=require(_0xfd24('0x3'));var router=express['Router']();var fs_extra=require(_0xfd24('0x4'));var auth=require(_0xfd24('0x5'));var interaction=require(_0xfd24('0x6'));var config=require(_0xfd24('0x7'));var controller=require(_0xfd24('0x8'));router[_0xfd24('0x9')]('/',auth[_0xfd24('0xa')](),controller[_0xfd24('0xb')]);router['get'](_0xfd24('0xc'),auth[_0xfd24('0xa')](),controller[_0xfd24('0xd')]);router[_0xfd24('0xe')]('/',auth[_0xfd24('0xa')](),controller['create']);router[_0xfd24('0xf')](_0xfd24('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xfd24('0x10')](_0xfd24('0xc'),auth['isAuthenticated'](),controller[_0xfd24('0x11')]);module[_0xfd24('0x12')]=router; \ No newline at end of file +var _0x2373=['fs-extra','../../components/interaction/service','./cmCustomField.controller','isAuthenticated','index','get','/:id','show','post','create','put','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2e607c,_0x18109a){var _0x4df1c7=function(_0x48c270){while(--_0x48c270){_0x2e607c['push'](_0x2e607c['shift']());}};_0x4df1c7(++_0x18109a);}(_0x2373,0xc0));var _0x3237=function(_0xd55a78,_0x5ce747){_0xd55a78=_0xd55a78-0x0;var _0x4832c7=_0x2373[_0xd55a78];return _0x4832c7;};'use strict';var multer=require(_0x3237('0x0'));var util=require(_0x3237('0x1'));var path=require(_0x3237('0x2'));var timeout=require(_0x3237('0x3'));var express=require(_0x3237('0x4'));var router=express[_0x3237('0x5')]();var fs_extra=require(_0x3237('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3237('0x7'));var config=require('../../config/environment');var controller=require(_0x3237('0x8'));router['get']('/',auth[_0x3237('0x9')](),controller[_0x3237('0xa')]);router[_0x3237('0xb')](_0x3237('0xc'),auth[_0x3237('0x9')](),controller[_0x3237('0xd')]);router[_0x3237('0xe')]('/',auth[_0x3237('0x9')](),controller[_0x3237('0xf')]);router[_0x3237('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x3237('0xc'),auth[_0x3237('0x9')](),controller['destroy']);module[_0x3237('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 40fe972..a3704a9 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 _0x950a=['INTEGER','BOOLEAN','contactListQueue','moment','sequelize','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x950a,0x111));var _0xa950=function(_0x42c4ba,_0x204d3f){_0x42c4ba=_0x42c4ba-0x0;var _0x591417=_0x950a[_0x42c4ba];return _0x591417;};'use strict';var moment=require(_0xa950('0x0'));var Sequelize=require(_0xa950('0x1'));module[_0xa950('0x2')]={'phone':{'type':Sequelize[_0xa950('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa950('0x4')],'defaultValue':moment()[_0xa950('0x5')](_0xa950('0x6'))},'countbusyretry':{'type':Sequelize[_0xa950('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa950('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa950('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa950('0x4')]},'priority':{'type':Sequelize[_0xa950('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa950('0x7')],'unique':_0xa950('0x9')},'ListId':{'type':Sequelize[_0xa950('0x7')],'unique':_0xa950('0x9')},'UserId':{'type':Sequelize[_0xa950('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xa950('0x7')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa950('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa950('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa950('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb66c=['DATE','format','INTEGER','UNSIGNED','contactListQueue','moment','exports','BOOLEAN'];(function(_0x4d2993,_0x1c9473){var _0x427374=function(_0x149dfd){while(--_0x149dfd){_0x4d2993['push'](_0x4d2993['shift']());}};_0x427374(++_0x1c9473);}(_0xb66c,0x175));var _0xcb66=function(_0x24771e,_0x243b3e){_0x24771e=_0x24771e-0x0;var _0x4740e5=_0xb66c[_0x24771e];return _0x4740e5;};'use strict';var moment=require(_0xcb66('0x0'));var Sequelize=require('sequelize');module[_0xcb66('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xcb66('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xcb66('0x3')],'defaultValue':moment()[_0xcb66('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xcb66('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xcb66('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcb66('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xcb66('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xcb66('0x5')](0x2)[_0xcb66('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xcb66('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xcb66('0x5')],'unique':_0xcb66('0x7')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xcb66('0x7')},'UserId':{'type':Sequelize[_0xcb66('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xcb66('0x5')],'unique':_0xcb66('0x7')},'CampaignId':{'type':Sequelize[_0xcb66('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcb66('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcb66('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xcb66('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcb66('0x5')],'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 007c21c..fb5b0c6 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 _0x4ff1=['campaigntype','queue','ContactId','lastName','isNil','firstName','calleridname','finally','CmContact','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','prev','hopperIds','priority','scheduledAt','ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue','getOpenContacts','getVoiceQueues','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','concat','$and','$gte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','attributes','fields','hasOwnProperty','offset','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','include','CmHopper','findAll','rows','catch','show','length','options','find','create','params','body','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','format','calleridnum','phone'];(function(_0x5a62f4,_0x57f22b){var _0x9034db=function(_0x525846){while(--_0x525846){_0x5a62f4['push'](_0x5a62f4['shift']());}};_0x9034db(++_0x57f22b);}(_0x4ff1,0x151));var _0x14ff=function(_0x286c4a,_0x3d559d){_0x286c4a=_0x286c4a-0x0;var _0x476a25=_0x4ff1[_0x286c4a];return _0x476a25;};'use strict';var emlformat=require(_0x14ff('0x0'));var rimraf=require(_0x14ff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x14ff('0x2'));var rp=require(_0x14ff('0x3'));var moment=require(_0x14ff('0x4'));var BPromise=require(_0x14ff('0x5'));var Mustache=require(_0x14ff('0x6'));var util=require(_0x14ff('0x7'));var path=require(_0x14ff('0x8'));var sox=require(_0x14ff('0x9'));var csv=require(_0x14ff('0xa'));var ejs=require(_0x14ff('0xb'));var fs=require('fs');var fs_extra=require(_0x14ff('0xc'));var _=require(_0x14ff('0xd'));var squel=require('squel');var crypto=require(_0x14ff('0xe'));var jsforce=require(_0x14ff('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x14ff('0xa'));var querystring=require(_0x14ff('0x10'));var Papa=require(_0x14ff('0x11'));var Redis=require(_0x14ff('0x12'));var authService=require(_0x14ff('0x13'));var qs=require(_0x14ff('0x14'));var as=require(_0x14ff('0x15'));var hardwareService=require(_0x14ff('0x16'));var logger=require(_0x14ff('0x17'))(_0x14ff('0x18'));var utils=require(_0x14ff('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x14ff('0x1a'));var db=require(_0x14ff('0x1b'))['db'];function respondWithStatusCode(_0x2eb4f7,_0x274c23){_0x274c23=_0x274c23||0xcc;return function(_0x377e23){if(_0x377e23){return _0x2eb4f7[_0x14ff('0x1c')](_0x274c23);}return _0x2eb4f7[_0x14ff('0x1d')](_0x274c23)[_0x14ff('0x1e')]();};}function respondWithResult(_0x15adad,_0x584962){_0x584962=_0x584962||0xc8;return function(_0x4deefa){if(_0x4deefa){return _0x15adad['status'](_0x584962)[_0x14ff('0x1f')](_0x4deefa);}};}function respondWithFilteredResult(_0x1128a0,_0x5008eb){return function(_0xbbc48){if(_0xbbc48){var _0xeeac9b=_0xbbc48['count'],_0x371952=_0x5008eb['offset'],_0x3c758e=_0x5008eb['offset']+_0x5008eb[_0x14ff('0x20')],_0x4b6431;if(_0x3c758e>=_0xeeac9b){_0x3c758e=_0xeeac9b;_0x4b6431=0xc8;}else{_0x4b6431=0xce;}_0x1128a0[_0x14ff('0x1d')](_0x4b6431);return _0x1128a0[_0x14ff('0x21')](_0x14ff('0x22'),_0x371952+'-'+_0x3c758e+'/'+_0xeeac9b)[_0x14ff('0x1f')](_0xbbc48);}return null;};}function patchUpdates(_0x345ed2){return function(_0x27f361){try{jsonpatch[_0x14ff('0x23')](_0x27f361,_0x345ed2,!![]);}catch(_0x20971b){return BPromise[_0x14ff('0x24')](_0x20971b);}return _0x27f361[_0x14ff('0x25')]();};}function saveUpdates(_0xf20364,_0x2c831b){return function(_0x3170ed){if(_0x3170ed){return _0x3170ed[_0x14ff('0x26')](_0xf20364)[_0x14ff('0x27')](function(_0x4d4f52){return _0x4d4f52;});}return null;};}function removeEntity(_0x34b99f,_0x422d45){return function(_0x14cf71){if(_0x14cf71){return _0x14cf71[_0x14ff('0x28')]()[_0x14ff('0x27')](function(){_0x34b99f[_0x14ff('0x1d')](0xcc)[_0x14ff('0x1e')]();});}};}function handleEntityNotFound(_0x1bf6bb,_0x555323){return function(_0x1aee0e){if(!_0x1aee0e){_0x1bf6bb[_0x14ff('0x1c')](0x194);}return _0x1aee0e;};}function handleError(_0x46c507,_0x39730c){_0x39730c=_0x39730c||0x1f4;return function(_0x4a59e4){logger[_0x14ff('0x29')](_0x4a59e4['stack']);if(_0x4a59e4['name']){delete _0x4a59e4[_0x14ff('0x2a')];}_0x46c507[_0x14ff('0x1d')](_0x39730c)[_0x14ff('0x2b')](_0x4a59e4);};}exports[_0x14ff('0x2c')]=function(_0x2f1891,_0x3e115d){var _0x7487b5={},_0x3e0966={},_0x1d5d92={'count':0x0,'rows':[]};var _0x5672bb=_[_0x14ff('0x2d')](db['CmHopper'][_0x14ff('0x2e')],function(_0x3eb451){return{'name':_0x3eb451[_0x14ff('0x2f')],'type':_0x3eb451[_0x14ff('0x30')]['key']};});_0x3e0966['model']=_['map'](_0x5672bb,_0x14ff('0x2a'));_0x3e0966[_0x14ff('0x31')]=_[_0x14ff('0x32')](_0x2f1891['query']);_0x3e0966[_0x14ff('0x33')]=_[_0x14ff('0x34')](_0x3e0966[_0x14ff('0x35')],_0x3e0966['query']);_0x3e0966[_0x14ff('0x33')]=_[_0x14ff('0x36')](_0x3e0966['filters'],[_0x14ff('0x37'),'$or','$gt',_0x14ff('0x38'),'$lt','$lte',_0x14ff('0x39'),_0x14ff('0x3a'),_0x14ff('0x3b'),_0x14ff('0x3c'),_0x14ff('0x3d'),_0x14ff('0x3e'),_0x14ff('0x3f'),_0x14ff('0x40'),_0x14ff('0x41'),_0x14ff('0x42'),_0x14ff('0x43'),'$like','$overlap',_0x14ff('0x44'),_0x14ff('0x45'),'$any']);_0x7487b5[_0x14ff('0x46')]=_['intersection'](_0x3e0966[_0x14ff('0x35')],qs[_0x14ff('0x47')](_0x2f1891['query'][_0x14ff('0x47')]));_0x7487b5[_0x14ff('0x46')]=_0x7487b5['attributes']['length']?_0x7487b5[_0x14ff('0x46')]:_0x3e0966[_0x14ff('0x35')];if(!_0x2f1891[_0x14ff('0x31')][_0x14ff('0x48')]('nolimit')){_0x7487b5[_0x14ff('0x20')]=qs['limit'](_0x2f1891['query'][_0x14ff('0x20')]);_0x7487b5[_0x14ff('0x49')]=qs[_0x14ff('0x49')](_0x2f1891[_0x14ff('0x31')][_0x14ff('0x49')]);}_0x7487b5['order']=qs[_0x14ff('0x4a')](_0x2f1891['query'][_0x14ff('0x4a')]);_0x7487b5[_0x14ff('0x4b')]=qs['filters'](_[_0x14ff('0x4c')](_0x2f1891[_0x14ff('0x31')],_0x3e0966[_0x14ff('0x33')]),_0x5672bb);if(_0x2f1891[_0x14ff('0x31')][_0x14ff('0x4d')]){_0x7487b5[_0x14ff('0x4b')]=_['merge'](_0x7487b5[_0x14ff('0x4b')],{'$or':_[_0x14ff('0x2d')](_0x5672bb,function(_0x1b3a1b){if(_0x1b3a1b[_0x14ff('0x30')]!==_0x14ff('0x4e')){var _0xb49cc1={};_0xb49cc1[_0x1b3a1b[_0x14ff('0x2a')]]={'$like':'%'+_0x2f1891[_0x14ff('0x31')][_0x14ff('0x4d')]+'%'};return _0xb49cc1;}})});}_0x7487b5=_[_0x14ff('0x4f')]({},_0x7487b5,_0x2f1891['options']);var _0x2313f4={'where':_0x7487b5['where']};return db['CmHopper'][_0x14ff('0x50')](_0x2313f4)[_0x14ff('0x27')](function(_0x1738e0){_0x1d5d92[_0x14ff('0x50')]=_0x1738e0;if(_0x2f1891[_0x14ff('0x31')][_0x14ff('0x51')]){_0x7487b5[_0x14ff('0x52')]=[{'all':!![]}];}return db[_0x14ff('0x53')][_0x14ff('0x54')](_0x7487b5);})[_0x14ff('0x27')](function(_0xb13cbc){_0x1d5d92[_0x14ff('0x55')]=_0xb13cbc;return _0x1d5d92;})[_0x14ff('0x27')](respondWithFilteredResult(_0x3e115d,_0x7487b5))[_0x14ff('0x56')](handleError(_0x3e115d,null));};exports[_0x14ff('0x57')]=function(_0x4c46b6,_0x5065cc){var _0x617c43={'raw':!![],'where':{'id':_0x4c46b6['params']['id']}},_0x243577={};_0x243577[_0x14ff('0x35')]=_['keys'](db[_0x14ff('0x53')][_0x14ff('0x2e')]);_0x243577[_0x14ff('0x31')]=_['keys'](_0x4c46b6['query']);_0x243577[_0x14ff('0x33')]=_['intersection'](_0x243577[_0x14ff('0x35')],_0x243577['query']);_0x617c43[_0x14ff('0x46')]=_[_0x14ff('0x34')](_0x243577[_0x14ff('0x35')],qs[_0x14ff('0x47')](_0x4c46b6[_0x14ff('0x31')]['fields']));_0x617c43[_0x14ff('0x46')]=_0x617c43[_0x14ff('0x46')][_0x14ff('0x58')]?_0x617c43[_0x14ff('0x46')]:_0x243577[_0x14ff('0x35')];if(_0x4c46b6[_0x14ff('0x31')][_0x14ff('0x51')]){_0x617c43[_0x14ff('0x52')]=[{'all':!![]}];}_0x617c43=_[_0x14ff('0x4f')]({},_0x617c43,_0x4c46b6[_0x14ff('0x59')]);return db[_0x14ff('0x53')][_0x14ff('0x5a')](_0x617c43)['then'](handleEntityNotFound(_0x5065cc,null))[_0x14ff('0x27')](respondWithResult(_0x5065cc,null))[_0x14ff('0x56')](handleError(_0x5065cc,null));};exports['create']=function(_0x5c490e,_0x27c77b){return db[_0x14ff('0x53')][_0x14ff('0x5b')](_0x5c490e['body'],{})[_0x14ff('0x27')](respondWithResult(_0x27c77b,0xc9))[_0x14ff('0x56')](handleError(_0x27c77b,null));};exports[_0x14ff('0x26')]=function(_0x28b1e5,_0x122d20){if(_0x28b1e5['body']['id']){delete _0x28b1e5['body']['id'];}return db[_0x14ff('0x53')][_0x14ff('0x5a')]({'where':{'id':_0x28b1e5[_0x14ff('0x5c')]['id']}})[_0x14ff('0x27')](handleEntityNotFound(_0x122d20,null))[_0x14ff('0x27')](saveUpdates(_0x28b1e5[_0x14ff('0x5d')],null))[_0x14ff('0x27')](respondWithResult(_0x122d20,null))[_0x14ff('0x56')](handleError(_0x122d20,null));};exports[_0x14ff('0x5e')]=function(_0x2f4762,_0x338bdb){return db['CmHopper'][_0x14ff('0x5e')]()['then'](respondWithResult(_0x338bdb,null))[_0x14ff('0x56')](handleError(_0x338bdb,null));};exports['destroy']=function(_0x1d52ce,_0x3b2840){var _0x1af071;return db[_0x14ff('0x53')][_0x14ff('0x5a')]({'where':{'id':_0x1d52ce['params']['id']}})[_0x14ff('0x27')](handleEntityNotFound(_0x3b2840,null))['then'](function(_0x2bda11){if(_0x2bda11){return _0x2bda11[_0x14ff('0x28')]()[_0x14ff('0x27')](function(_0x438f49){return _0x438f49;});}})[_0x14ff('0x27')](function(_0xf0eddf){_0x1af071=_0xf0eddf;if(_0xf0eddf){if(_0xf0eddf['VoiceQueueId']||_0xf0eddf['CampaignId']){return db[_0xf0eddf[_0x14ff('0x5f')]?_0x14ff('0x60'):_0x14ff('0x61')]['find']({'where':{'id':_0xf0eddf[_0x14ff('0x5f')]?_0xf0eddf[_0x14ff('0x5f')]:_0xf0eddf[_0x14ff('0x62')]},'attributes':['id','name'],'raw':!![]});}}})[_0x14ff('0x27')](function(_0x21f8cd){var _0x4d1592={};if(_0x21f8cd){_['merge'](_0x4d1592,_[_0x14ff('0x63')](_0x1af071[_0x14ff('0x64')],[_0x14ff('0x65'),_0x14ff('0x66'),'id']));_0x4d1592[_0x14ff('0x67')]=0x15;_0x4d1592[_0x14ff('0x68')]=_0x14ff('0x69');_0x4d1592[_0x14ff('0x6a')]=_0x21f8cd[_0x14ff('0x2a')];_0x4d1592[_0x14ff('0x6b')]=_0x1d52ce[_0x14ff('0x6c')][_0x14ff('0x2a')];_0x4d1592[_0x14ff('0x6d')]=_0x1d52ce['user']['id'];_0x4d1592[_0x14ff('0x69')]=!![];_0x4d1592['deletedat']=moment()[_0x14ff('0x6e')]('YYYY-MM-DD\x20HH:mm:ss');_0x4d1592[_0x14ff('0x6f')]=_0x1af071[_0x14ff('0x70')];_0x4d1592[_0x14ff('0x71')]=_0x1af071['VoiceQueueId']?_0x14ff('0x72'):'ivr';return db['CmContact'][_0x14ff('0x5a')]({'where':{'id':_0x4d1592[_0x14ff('0x73')]},'attributes':['firstName',_0x14ff('0x74')]})[_0x14ff('0x27')](function(_0x3fe103){if(!_[_0x14ff('0x75')](_0x3b2840)&&!_[_0x14ff('0x75')](_0x3fe103[_0x14ff('0x76')])){_0x4d1592[_0x14ff('0x77')]=_0x3fe103[_0x14ff('0x76')];if(!_[_0x14ff('0x75')](_0x3fe103[_0x14ff('0x74')])){_0x4d1592[_0x14ff('0x77')]+='\x20'+_0x3fe103[_0x14ff('0x74')];}}})[_0x14ff('0x78')](function(){return db['CmHopperFinal'][_0x14ff('0x5b')](_0x4d1592);});}})['then'](function(){return _0x3b2840[_0x14ff('0x1d')](0xcc)['end']();})[_0x14ff('0x56')](handleError(_0x3b2840,null));};exports['getPreview']=function(_0x17b1f6,_0x2eb469,_0x5178e3){var _0x15d187=[];return db[_0x14ff('0x79')]['describe']()[_0x14ff('0x27')](function(_0x21ac84){_0x15d187=_[_0x14ff('0x32')](_0x21ac84);return _0x17b1f6[_0x14ff('0x6c')]['getVoiceQueues']({'where':{'type':_0x14ff('0x7a'),'dialActive':!![],'dialMethod':_0x14ff('0x7b')},'attributes':['id',_0x14ff('0x7c')],'raw':!![]});})['then'](function(_0x2e4d39){if(_0x2e4d39&&_0x2e4d39[_0x14ff('0x58')]){return db[_0x14ff('0x7d')][_0x14ff('0x7e')](function(_0x4dabf6){var _0x1c2846={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x14ff('0x7f'))},'VoiceQueueId':{'$in':_['map'](_0x2e4d39,'id')},'$or':[{'UserId':null},{'UserId':_0x17b1f6[_0x14ff('0x6c')]['id']}]};var _0x2dfee0=[];if(_0x17b1f6[_0x14ff('0x5d')]['direction']&&_0x17b1f6[_0x14ff('0x5d')]['direction']===_0x14ff('0x80')){if(!_['isEmpty'](_0x17b1f6[_0x14ff('0x5d')][_0x14ff('0x81')])){_0x1c2846['id']={'$in':_0x17b1f6[_0x14ff('0x5d')]['hopperIds']};}_0x2dfee0=[[_0x14ff('0x82'),'ASC'],[_0x14ff('0x83'),_0x2e4d39[0x0][_0x14ff('0x7c')]===_0x14ff('0x84')?'DESC':_0x14ff('0x84')],db[_0x14ff('0x7d')][_0x14ff('0x85')](_0x14ff('0x86')),['id',_0x14ff('0x87')]];}else{if(!_[_0x14ff('0x88')](_0x17b1f6[_0x14ff('0x5d')][_0x14ff('0x81')])){_0x1c2846['id']={'$notIn':_0x17b1f6[_0x14ff('0x5d')][_0x14ff('0x81')]};}_0x2dfee0=[[_0x14ff('0x82'),_0x14ff('0x87')],['scheduledAt',_0x2e4d39[0x0][_0x14ff('0x7c')]],db[_0x14ff('0x7d')]['literal'](_0x14ff('0x89')),['id',_0x14ff('0x84')]];}return db['CmHopper'][_0x14ff('0x8a')]({'attributes':['id','scheduledat'],'where':_0x1c2846,'order':_0x2dfee0,'transaction':_0x4dabf6,'lock':_0x4dabf6[_0x14ff('0x8b')][_0x14ff('0x8c')],'include':[{'model':db[_0x14ff('0x79')],'as':_0x14ff('0x8d'),'attributes':_0x15d187,'include':[{'model':db[_0x14ff('0x8e')],'as':'Company','attributes':['id',_0x14ff('0x2a')]}]},{'model':db[_0x14ff('0x8f')],'as':_0x14ff('0x90'),'attributes':['id',_0x14ff('0x2a')]},{'model':db[_0x14ff('0x60')],'as':_0x14ff('0x91'),'attributes':['id','name','dialActive']}]})[_0x14ff('0x27')](function(_0x30e77e){if(_0x30e77e){return _0x30e77e[_0x14ff('0x26')]({'UserId':_0x17b1f6[_0x14ff('0x6c')]['id']},{'transaction':_0x4dabf6});}});});}})['then'](handleEntityNotFound(_0x2eb469,null))[_0x14ff('0x27')](respondWithResult(_0x2eb469,null))['catch'](handleError(_0x2eb469,null));};exports[_0x14ff('0x92')]=function(_0x4edb23,_0x3c5126,_0x340691){return _0x4edb23['user'][_0x14ff('0x93')]({'where':{'type':_0x14ff('0x7a'),'dialActive':!![],'dialMethod':_0x14ff('0x7b')},'attributes':['id'],'raw':!![]})[_0x14ff('0x27')](function(_0x51b683){if(_0x51b683&&_0x51b683['length']){return db[_0x14ff('0x53')][_0x14ff('0x50')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x14ff('0x6e')](_0x14ff('0x7f'))},'VoiceQueueId':{'$in':_[_0x14ff('0x2d')](_0x51b683,'id')},'$or':[{'UserId':null},{'UserId':_0x4edb23[_0x14ff('0x6c')]['id']}]}});}return 0x0;})[_0x14ff('0x27')](function(_0x481f72){if(!_[_0x14ff('0x75')](_0x481f72)&&_['isNumber'](_0x481f72)){return _0x3c5126[_0x14ff('0x1d')](0xc8)[_0x14ff('0x1f')]({'contacts':_0x481f72});}else{logger[_0x14ff('0x29')](_0x14ff('0x94'),_0x14ff('0x92'),0x194,_0x14ff('0x95'));_0x3c5126[_0x14ff('0x1c')](0x194);}})['catch'](handleError(_0x3c5126,null));}; \ No newline at end of file +var _0x1547=['campaign','membername','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','ivr','CmContact','lastName','isNil','firstName','calleridname','CmHopperFinal','end','keys','outbound','dialOrderByScheduledAt','length','sequelize','transaction','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','UPDATE','Contact','CmCompany','CmList','List','Queue','dialActive','user','getOpenContacts','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','CmHopper','rawAttributes','fieldName','type','key','model','map','query','intersection','filters','$and','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$contains','$contained','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','includeAll','include','findAll','catch','params','options','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','state','deleted'];(function(_0x19e56d,_0x36abb6){var _0x47c266=function(_0x53b17d){while(--_0x53b17d){_0x19e56d['push'](_0x19e56d['shift']());}};_0x47c266(++_0x36abb6);}(_0x1547,0xbb));var _0x7154=function(_0x496637,_0x2a6ae2){_0x496637=_0x496637-0x0;var _0x22971=_0x1547[_0x496637];return _0x22971;};'use strict';var emlformat=require(_0x7154('0x0'));var rimraf=require(_0x7154('0x1'));var zipdir=require(_0x7154('0x2'));var jsonpatch=require(_0x7154('0x3'));var rp=require(_0x7154('0x4'));var moment=require(_0x7154('0x5'));var BPromise=require(_0x7154('0x6'));var Mustache=require(_0x7154('0x7'));var util=require(_0x7154('0x8'));var path=require(_0x7154('0x9'));var sox=require('sox');var csv=require(_0x7154('0xa'));var ejs=require(_0x7154('0xb'));var fs=require('fs');var fs_extra=require(_0x7154('0xc'));var _=require(_0x7154('0xd'));var squel=require(_0x7154('0xe'));var crypto=require(_0x7154('0xf'));var jsforce=require(_0x7154('0x10'));var deskjs=require(_0x7154('0x11'));var toCsv=require('to-csv');var querystring=require(_0x7154('0x12'));var Papa=require(_0x7154('0x13'));var Redis=require(_0x7154('0x14'));var authService=require(_0x7154('0x15'));var qs=require(_0x7154('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7154('0x17'));var logger=require(_0x7154('0x18'))(_0x7154('0x19'));var utils=require(_0x7154('0x1a'));var config=require(_0x7154('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x7154('0x1c'))['db'];function respondWithStatusCode(_0x18dd0a,_0x27706b){_0x27706b=_0x27706b||0xcc;return function(_0x1263a1){if(_0x1263a1){return _0x18dd0a['sendStatus'](_0x27706b);}return _0x18dd0a[_0x7154('0x1d')](_0x27706b)['end']();};}function respondWithResult(_0xdddf98,_0x57e626){_0x57e626=_0x57e626||0xc8;return function(_0x74d793){if(_0x74d793){return _0xdddf98['status'](_0x57e626)[_0x7154('0x1e')](_0x74d793);}};}function respondWithFilteredResult(_0x4c482c,_0x3a292a){return function(_0xc19a1f){if(_0xc19a1f){var _0x48f7ca=_0xc19a1f[_0x7154('0x1f')],_0x26aa0e=_0x3a292a[_0x7154('0x20')],_0x55409d=_0x3a292a[_0x7154('0x20')]+_0x3a292a[_0x7154('0x21')],_0x3b7501;if(_0x55409d>=_0x48f7ca){_0x55409d=_0x48f7ca;_0x3b7501=0xc8;}else{_0x3b7501=0xce;}_0x4c482c[_0x7154('0x1d')](_0x3b7501);return _0x4c482c[_0x7154('0x22')]('Content-Range',_0x26aa0e+'-'+_0x55409d+'/'+_0x48f7ca)[_0x7154('0x1e')](_0xc19a1f);}return null;};}function patchUpdates(_0x318014){return function(_0x34f98d){try{jsonpatch[_0x7154('0x23')](_0x34f98d,_0x318014,!![]);}catch(_0x1d6eeb){return BPromise[_0x7154('0x24')](_0x1d6eeb);}return _0x34f98d['save']();};}function saveUpdates(_0x4e89d7,_0x54077c){return function(_0x600e0f){if(_0x600e0f){return _0x600e0f[_0x7154('0x25')](_0x4e89d7)[_0x7154('0x26')](function(_0x28e7a7){return _0x28e7a7;});}return null;};}function removeEntity(_0x417a96,_0x545a4b){return function(_0x341bba){if(_0x341bba){return _0x341bba[_0x7154('0x27')]()[_0x7154('0x26')](function(){_0x417a96[_0x7154('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1994a1,_0x4dd229){return function(_0x244459){if(!_0x244459){_0x1994a1[_0x7154('0x28')](0x194);}return _0x244459;};}function handleError(_0x3d8378,_0x448909){_0x448909=_0x448909||0x1f4;return function(_0x1ebc0b){logger[_0x7154('0x29')](_0x1ebc0b[_0x7154('0x2a')]);if(_0x1ebc0b[_0x7154('0x2b')]){delete _0x1ebc0b[_0x7154('0x2b')];}_0x3d8378[_0x7154('0x1d')](_0x448909)['send'](_0x1ebc0b);};}exports[_0x7154('0x2c')]=function(_0x459402,_0x5b275c){var _0x4fddd3={},_0x51a52d={},_0x1687ac={'count':0x0,'rows':[]};var _0xf35404=_['map'](db[_0x7154('0x2d')][_0x7154('0x2e')],function(_0x1db9d6){return{'name':_0x1db9d6[_0x7154('0x2f')],'type':_0x1db9d6[_0x7154('0x30')][_0x7154('0x31')]};});_0x51a52d[_0x7154('0x32')]=_[_0x7154('0x33')](_0xf35404,_0x7154('0x2b'));_0x51a52d[_0x7154('0x34')]=_['keys'](_0x459402[_0x7154('0x34')]);_0x51a52d['filters']=_[_0x7154('0x35')](_0x51a52d[_0x7154('0x32')],_0x51a52d[_0x7154('0x34')]);_0x51a52d['filters']=_['concat'](_0x51a52d[_0x7154('0x36')],[_0x7154('0x37'),'$or','$gt',_0x7154('0x38'),_0x7154('0x39'),_0x7154('0x3a'),_0x7154('0x3b'),'$eq',_0x7154('0x3c'),_0x7154('0x3d'),_0x7154('0x3e'),_0x7154('0x3f'),'$notIn',_0x7154('0x40'),_0x7154('0x41'),_0x7154('0x42'),_0x7154('0x43'),'$like','$overlap',_0x7154('0x44'),_0x7154('0x45'),'$any']);_0x4fddd3[_0x7154('0x46')]=_[_0x7154('0x35')](_0x51a52d['model'],qs[_0x7154('0x47')](_0x459402['query'][_0x7154('0x47')]));_0x4fddd3[_0x7154('0x46')]=_0x4fddd3[_0x7154('0x46')]['length']?_0x4fddd3[_0x7154('0x46')]:_0x51a52d[_0x7154('0x32')];if(!_0x459402[_0x7154('0x34')][_0x7154('0x48')](_0x7154('0x49'))){_0x4fddd3[_0x7154('0x21')]=qs['limit'](_0x459402[_0x7154('0x34')]['limit']);_0x4fddd3['offset']=qs[_0x7154('0x20')](_0x459402[_0x7154('0x34')]['offset']);}_0x4fddd3['order']=qs[_0x7154('0x4a')](_0x459402['query'][_0x7154('0x4a')]);_0x4fddd3[_0x7154('0x4b')]=qs[_0x7154('0x36')](_['pick'](_0x459402[_0x7154('0x34')],_0x51a52d[_0x7154('0x36')]),_0xf35404);if(_0x459402['query'][_0x7154('0x4c')]){_0x4fddd3[_0x7154('0x4b')]=_[_0x7154('0x4d')](_0x4fddd3[_0x7154('0x4b')],{'$or':_[_0x7154('0x33')](_0xf35404,function(_0x42266c){if(_0x42266c[_0x7154('0x30')]!=='VIRTUAL'){var _0x3c7f6d={};_0x3c7f6d[_0x42266c[_0x7154('0x2b')]]={'$like':'%'+_0x459402[_0x7154('0x34')]['filter']+'%'};return _0x3c7f6d;}})});}_0x4fddd3=_['merge']({},_0x4fddd3,_0x459402['options']);var _0x5173f7={'where':_0x4fddd3[_0x7154('0x4b')]};return db[_0x7154('0x2d')][_0x7154('0x1f')](_0x5173f7)[_0x7154('0x26')](function(_0x4cbcc5){_0x1687ac[_0x7154('0x1f')]=_0x4cbcc5;if(_0x459402[_0x7154('0x34')][_0x7154('0x4e')]){_0x4fddd3[_0x7154('0x4f')]=[{'all':!![]}];}return db[_0x7154('0x2d')][_0x7154('0x50')](_0x4fddd3);})[_0x7154('0x26')](function(_0x5ac730){_0x1687ac['rows']=_0x5ac730;return _0x1687ac;})[_0x7154('0x26')](respondWithFilteredResult(_0x5b275c,_0x4fddd3))[_0x7154('0x51')](handleError(_0x5b275c,null));};exports['show']=function(_0x18dfc5,_0x545788){var _0x3a7067={'raw':!![],'where':{'id':_0x18dfc5[_0x7154('0x52')]['id']}},_0x1f2707={};_0x1f2707[_0x7154('0x32')]=_['keys'](db[_0x7154('0x2d')][_0x7154('0x2e')]);_0x1f2707[_0x7154('0x34')]=_['keys'](_0x18dfc5['query']);_0x1f2707[_0x7154('0x36')]=_['intersection'](_0x1f2707[_0x7154('0x32')],_0x1f2707['query']);_0x3a7067['attributes']=_[_0x7154('0x35')](_0x1f2707['model'],qs['fields'](_0x18dfc5['query'][_0x7154('0x47')]));_0x3a7067[_0x7154('0x46')]=_0x3a7067[_0x7154('0x46')]['length']?_0x3a7067[_0x7154('0x46')]:_0x1f2707[_0x7154('0x32')];if(_0x18dfc5[_0x7154('0x34')]['includeAll']){_0x3a7067[_0x7154('0x4f')]=[{'all':!![]}];}_0x3a7067=_[_0x7154('0x4d')]({},_0x3a7067,_0x18dfc5[_0x7154('0x53')]);return db[_0x7154('0x2d')][_0x7154('0x54')](_0x3a7067)[_0x7154('0x26')](handleEntityNotFound(_0x545788,null))['then'](respondWithResult(_0x545788,null))[_0x7154('0x51')](handleError(_0x545788,null));};exports['create']=function(_0x3abdcf,_0x4d7a6a){return db[_0x7154('0x2d')][_0x7154('0x55')](_0x3abdcf[_0x7154('0x56')],{})[_0x7154('0x26')](respondWithResult(_0x4d7a6a,0xc9))[_0x7154('0x51')](handleError(_0x4d7a6a,null));};exports[_0x7154('0x25')]=function(_0x316dd,_0x51a5eb){if(_0x316dd[_0x7154('0x56')]['id']){delete _0x316dd[_0x7154('0x56')]['id'];}return db[_0x7154('0x2d')][_0x7154('0x54')]({'where':{'id':_0x316dd['params']['id']}})['then'](handleEntityNotFound(_0x51a5eb,null))[_0x7154('0x26')](saveUpdates(_0x316dd['body'],null))[_0x7154('0x26')](respondWithResult(_0x51a5eb,null))[_0x7154('0x51')](handleError(_0x51a5eb,null));};exports[_0x7154('0x57')]=function(_0x1efe68,_0x8f59ac){return db[_0x7154('0x2d')]['describe']()[_0x7154('0x26')](respondWithResult(_0x8f59ac,null))[_0x7154('0x51')](handleError(_0x8f59ac,null));};exports[_0x7154('0x27')]=function(_0x3bdf35,_0x45ad4a){var _0x169a7d;return db[_0x7154('0x2d')][_0x7154('0x54')]({'where':{'id':_0x3bdf35['params']['id']}})[_0x7154('0x26')](handleEntityNotFound(_0x45ad4a,null))['then'](function(_0x19678d){if(_0x19678d){return _0x19678d['destroy']()[_0x7154('0x26')](function(_0x95dcfb){return _0x95dcfb;});}})['then'](function(_0xfa2457){_0x169a7d=_0xfa2457;if(_0xfa2457){if(_0xfa2457[_0x7154('0x58')]||_0xfa2457[_0x7154('0x59')]){return db[_0xfa2457[_0x7154('0x58')]?_0x7154('0x5a'):_0x7154('0x5b')]['find']({'where':{'id':_0xfa2457[_0x7154('0x58')]?_0xfa2457[_0x7154('0x58')]:_0xfa2457[_0x7154('0x59')]},'attributes':['id','name'],'raw':!![]});}}})[_0x7154('0x26')](function(_0x2a2acf){var _0x488470={};if(_0x2a2acf){_[_0x7154('0x4d')](_0x488470,_[_0x7154('0x5c')](_0x169a7d[_0x7154('0x5d')],[_0x7154('0x5e'),'updatedAt','id']));_0x488470[_0x7154('0x5f')]=0x15;_0x488470['statedesc']=_0x7154('0x60');_0x488470[_0x7154('0x61')]=_0x2a2acf[_0x7154('0x2b')];_0x488470[_0x7154('0x62')]=_0x3bdf35['user'][_0x7154('0x2b')];_0x488470[_0x7154('0x63')]=_0x3bdf35['user']['id'];_0x488470[_0x7154('0x60')]=!![];_0x488470[_0x7154('0x64')]=moment()[_0x7154('0x65')](_0x7154('0x66'));_0x488470[_0x7154('0x67')]=_0x169a7d[_0x7154('0x68')];_0x488470['campaigntype']=_0x169a7d[_0x7154('0x58')]?'queue':_0x7154('0x69');return db[_0x7154('0x6a')][_0x7154('0x54')]({'where':{'id':_0x488470['ContactId']},'attributes':['firstName',_0x7154('0x6b')]})[_0x7154('0x26')](function(_0x6615f9){if(!_[_0x7154('0x6c')](_0x45ad4a)&&!_[_0x7154('0x6c')](_0x6615f9[_0x7154('0x6d')])){_0x488470[_0x7154('0x6e')]=_0x6615f9['firstName'];if(!_[_0x7154('0x6c')](_0x6615f9[_0x7154('0x6b')])){_0x488470['calleridname']+='\x20'+_0x6615f9['lastName'];}}})['finally'](function(){return db[_0x7154('0x6f')][_0x7154('0x55')](_0x488470);});}})['then'](function(){return _0x45ad4a[_0x7154('0x1d')](0xcc)[_0x7154('0x70')]();})[_0x7154('0x51')](handleError(_0x45ad4a,null));};exports['getPreview']=function(_0x528b4d,_0x1847ca,_0x5748cf){var _0x38d532=[];return db[_0x7154('0x6a')]['describe']()[_0x7154('0x26')](function(_0x22f8cf){_0x38d532=_[_0x7154('0x71')](_0x22f8cf);return _0x528b4d['user']['getVoiceQueues']({'where':{'type':_0x7154('0x72'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x7154('0x73')],'raw':!![]});})['then'](function(_0xfefbb2){if(_0xfefbb2&&_0xfefbb2[_0x7154('0x74')]){return db[_0x7154('0x75')][_0x7154('0x76')](function(_0x35abb2){var _0x32e234={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7154('0x65')](_0x7154('0x66'))},'VoiceQueueId':{'$in':_[_0x7154('0x33')](_0xfefbb2,'id')},'$or':[{'UserId':null},{'UserId':_0x528b4d['user']['id']}]};var _0x2e7001=[];if(_0x528b4d[_0x7154('0x56')][_0x7154('0x77')]&&_0x528b4d[_0x7154('0x56')][_0x7154('0x77')]===_0x7154('0x78')){if(!_[_0x7154('0x79')](_0x528b4d[_0x7154('0x56')][_0x7154('0x7a')])){_0x32e234['id']={'$in':_0x528b4d['body'][_0x7154('0x7a')]};}_0x2e7001=[['priority',_0x7154('0x7b')],[_0x7154('0x7c'),_0xfefbb2[0x0][_0x7154('0x73')]==='ASC'?_0x7154('0x7d'):_0x7154('0x7b')],db[_0x7154('0x75')][_0x7154('0x7e')](_0x7154('0x7f')),['id',_0x7154('0x7d')]];}else{if(!_[_0x7154('0x79')](_0x528b4d[_0x7154('0x56')][_0x7154('0x7a')])){_0x32e234['id']={'$notIn':_0x528b4d[_0x7154('0x56')]['hopperIds']};}_0x2e7001=[['priority',_0x7154('0x7d')],[_0x7154('0x7c'),_0xfefbb2[0x0][_0x7154('0x73')]],db[_0x7154('0x75')]['literal'](_0x7154('0x80')),['id',_0x7154('0x7b')]];}return db[_0x7154('0x2d')]['findOne']({'attributes':['id','scheduledat'],'where':_0x32e234,'order':_0x2e7001,'transaction':_0x35abb2,'lock':_0x35abb2['LOCK'][_0x7154('0x81')],'include':[{'model':db[_0x7154('0x6a')],'as':_0x7154('0x82'),'attributes':_0x38d532,'include':[{'model':db[_0x7154('0x83')],'as':'Company','attributes':['id','name']}]},{'model':db[_0x7154('0x84')],'as':_0x7154('0x85'),'attributes':['id',_0x7154('0x2b')]},{'model':db[_0x7154('0x5a')],'as':_0x7154('0x86'),'attributes':['id','name',_0x7154('0x87')]}]})['then'](function(_0x45f85c){if(_0x45f85c){return _0x45f85c[_0x7154('0x25')]({'UserId':_0x528b4d[_0x7154('0x88')]['id']},{'transaction':_0x35abb2});}});});}})[_0x7154('0x26')](handleEntityNotFound(_0x1847ca,null))['then'](respondWithResult(_0x1847ca,null))[_0x7154('0x51')](handleError(_0x1847ca,null));};exports[_0x7154('0x89')]=function(_0x1d6ae8,_0x51ac08,_0x42fd38){return _0x1d6ae8['user'][_0x7154('0x8a')]({'where':{'type':_0x7154('0x72'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x7154('0x26')](function(_0x526cb0){if(_0x526cb0&&_0x526cb0[_0x7154('0x74')]){return db[_0x7154('0x2d')][_0x7154('0x1f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7154('0x65')](_0x7154('0x66'))},'VoiceQueueId':{'$in':_[_0x7154('0x33')](_0x526cb0,'id')},'$or':[{'UserId':null},{'UserId':_0x1d6ae8[_0x7154('0x88')]['id']}]}});}return 0x0;})[_0x7154('0x26')](function(_0x3e32c8){if(!_[_0x7154('0x6c')](_0x3e32c8)&&_[_0x7154('0x8b')](_0x3e32c8)){return _0x51ac08[_0x7154('0x1d')](0xc8)['json']({'contacts':_0x3e32c8});}else{logger['error'](_0x7154('0x8c'),_0x7154('0x89'),0x194,_0x7154('0x8d'));_0x51ac08[_0x7154('0x28')](0x194);}})[_0x7154('0x51')](handleError(_0x51ac08,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index debd24b..a87b1c3 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 _0xe7ba=['./cmHopper.attributes','exports','define','CmHopper','cm_hopper','phone','priority','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x21b757,_0x5d1f1e){var _0x1b5ad0=function(_0x47f180){while(--_0x47f180){_0x21b757['push'](_0x21b757['shift']());}};_0x1b5ad0(++_0x5d1f1e);}(_0xe7ba,0x70));var _0xae7b=function(_0x2f9c4b,_0x5f2503){_0x2f9c4b=_0x2f9c4b-0x0;var _0xf075df=_0xe7ba[_0x2f9c4b];return _0xf075df;};'use strict';var _=require(_0xae7b('0x0'));var util=require(_0xae7b('0x1'));var logger=require(_0xae7b('0x2'))(_0xae7b('0x3'));var moment=require(_0xae7b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xae7b('0x5'));var rimraf=require(_0xae7b('0x6'));var config=require(_0xae7b('0x7'));var attributes=require(_0xae7b('0x8'));module[_0xae7b('0x9')]=function(_0x98add0,_0x248d5b){return _0x98add0[_0xae7b('0xa')](_0xae7b('0xb'),attributes,{'tableName':_0xae7b('0xc'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':['scheduledat']},{'name':_0xae7b('0xd'),'fields':['phone']},{'name':'priority','fields':[_0xae7b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9b72=['lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define','CmHopper','cm_hopper','scheduledat','phone'];(function(_0x14f6f7,_0x2c18b8){var _0x1e6846=function(_0x51b38e){while(--_0x51b38e){_0x14f6f7['push'](_0x14f6f7['shift']());}};_0x1e6846(++_0x2c18b8);}(_0x9b72,0x1e1));var _0x29b7=function(_0x57e5e8,_0x4176ee){_0x57e5e8=_0x57e5e8-0x0;var _0x33201f=_0x9b72[_0x57e5e8];return _0x33201f;};'use strict';var _=require(_0x29b7('0x0'));var util=require(_0x29b7('0x1'));var logger=require(_0x29b7('0x2'))('api');var moment=require(_0x29b7('0x3'));var BPromise=require('bluebird');var rp=require(_0x29b7('0x4'));var fs=require('fs');var path=require(_0x29b7('0x5'));var rimraf=require('rimraf');var config=require(_0x29b7('0x6'));var attributes=require('./cmHopper.attributes');module[_0x29b7('0x7')]=function(_0x31e412,_0xa47365){return _0x31e412[_0x29b7('0x8')](_0x29b7('0x9'),attributes,{'tableName':_0x29b7('0xa'),'paranoid':![],'indexes':[{'name':_0x29b7('0xb'),'fields':['scheduledat']},{'name':_0x29b7('0xc'),'fields':[_0x29b7('0xc')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 7d52614..84f0a74 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 _0x19e9=['then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','map','model','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','update','limit','DestroyCmHopper','destroy','CmContact','describe','transaction','LOCK','UPDATE','Contact','User','Agent','name','voicePause','length','includes','UserId','push','all','GetContactDialer','MoveContactManagedDialer','sequelize','CmHopperFinal','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','GetCmHopperPreview','keys','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x56a577,_0x28b5ac){var _0x5f0e52=function(_0x7cafcb){while(--_0x7cafcb){_0x56a577['push'](_0x56a577['shift']());}};_0x5f0e52(++_0x28b5ac);}(_0x19e9,0x1ab));var _0x919e=function(_0x5ea333,_0x45c783){_0x5ea333=_0x5ea333-0x0;var _0x137870=_0x19e9[_0x5ea333];return _0x137870;};'use strict';var _=require(_0x919e('0x0'));var util=require(_0x919e('0x1'));var moment=require(_0x919e('0x2'));var BPromise=require('bluebird');var rs=require(_0x919e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x919e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x919e('0x5'))('rpc');var config=require(_0x919e('0x6'));var jayson=require(_0x919e('0x7'));var client=jayson[_0x919e('0x8')][_0x919e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a7436,_0x5becb1,_0x6c1f0f){return new BPromise(function(_0x2335d8,_0x2fcf0d){return client[_0x919e('0xa')](_0x5a7436,_0x6c1f0f)[_0x919e('0xb')](function(_0x5b7ee5){logger[_0x919e('0xc')](_0x919e('0xd'),_0x5becb1,_0x919e('0xe'));logger[_0x919e('0xf')](_0x919e('0x10'),_0x5becb1,_0x919e('0xe'),JSON[_0x919e('0x11')](_0x5b7ee5));if(_0x5b7ee5[_0x919e('0x12')]){if(_0x5b7ee5[_0x919e('0x12')]['code']===0x1f4){logger[_0x919e('0x12')](_0x919e('0xd'),_0x5becb1,_0x5b7ee5['error'][_0x919e('0x13')]);return _0x2fcf0d(_0x5b7ee5[_0x919e('0x12')][_0x919e('0x13')]);}logger[_0x919e('0x12')](_0x919e('0xd'),_0x5becb1,_0x5b7ee5[_0x919e('0x12')][_0x919e('0x13')]);return _0x2335d8(_0x5b7ee5['error']['message']);}else{logger[_0x919e('0xc')](_0x919e('0xd'),_0x5becb1,_0x919e('0xe'));_0x2335d8(_0x5b7ee5[_0x919e('0x14')][_0x919e('0x13')]);}})[_0x919e('0x15')](function(_0x3c57a2){logger['error']('CmHopper,\x20%s,\x20%s',_0x5becb1,_0x3c57a2);_0x2fcf0d(_0x3c57a2);});});}exports[_0x919e('0x16')]=function(_0x3643c6){var _0x3ffc3e=this;return new Promise(function(_0x38b6a5,_0x511638){return db[_0x919e('0x17')][_0x919e('0x18')]({'raw':_0x3643c6[_0x919e('0x19')]?_0x3643c6[_0x919e('0x19')][_0x919e('0x1a')]===undefined?!![]:![]:!![],'where':_0x3643c6[_0x919e('0x19')]?_0x3643c6[_0x919e('0x19')][_0x919e('0x1b')]||null:null,'attributes':_0x3643c6[_0x919e('0x19')]?_0x3643c6['options'][_0x919e('0x1c')]||null:null,'limit':_0x3643c6['options']?_0x3643c6[_0x919e('0x19')]['limit']||null:null,'include':_0x3643c6[_0x919e('0x19')]?_0x3643c6[_0x919e('0x19')][_0x919e('0x1d')]?_[_0x919e('0x1e')](_0x3643c6[_0x919e('0x19')][_0x919e('0x1d')],function(_0x4fde0f){return{'model':db[_0x4fde0f[_0x919e('0x1f')]],'as':_0x4fde0f['as'],'attributes':_0x4fde0f['attributes'],'include':_0x4fde0f[_0x919e('0x1d')]?_[_0x919e('0x1e')](_0x4fde0f[_0x919e('0x1d')],function(_0x58ec0e){return{'model':db[_0x58ec0e[_0x919e('0x1f')]],'as':_0x58ec0e['as'],'attributes':_0x58ec0e['attributes'],'include':_0x58ec0e[_0x919e('0x1d')]?_[_0x919e('0x1e')](_0x58ec0e[_0x919e('0x1d')],function(_0x1f9e90){return{'model':db[_0x1f9e90['model']],'as':_0x1f9e90['as'],'attributes':_0x1f9e90[_0x919e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x919e('0xb')](function(_0xd8b1c4){logger['info'](_0x919e('0x16'),_0x3643c6);logger[_0x919e('0xf')](_0x919e('0x16'),_0x3643c6,JSON[_0x919e('0x11')](_0xd8b1c4));_0x38b6a5(_0xd8b1c4);})[_0x919e('0x15')](function(_0x229d61){logger[_0x919e('0x12')]('GetCmHopper',_0x229d61[_0x919e('0x13')],_0x3643c6);_0x511638(_0x3ffc3e[_0x919e('0x12')](0x1f4,_0x229d61[_0x919e('0x13')]));});});};exports[_0x919e('0x20')]=function(_0x56cb7b){var _0xae2fd0=this;return new Promise(function(_0x312ea0,_0x59725f){return db['CmHopper'][_0x919e('0x21')]({'raw':_0x56cb7b[_0x919e('0x19')]?_0x56cb7b[_0x919e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x56cb7b[_0x919e('0x19')]?_0x56cb7b['options'][_0x919e('0x1b')]||null:null,'attributes':_0x56cb7b[_0x919e('0x19')]?_0x56cb7b[_0x919e('0x19')][_0x919e('0x1c')]||null:null,'include':_0x56cb7b[_0x919e('0x19')]?_0x56cb7b[_0x919e('0x19')]['include']?_[_0x919e('0x1e')](_0x56cb7b[_0x919e('0x19')][_0x919e('0x1d')],function(_0xdc8ddd){return{'model':db[_0xdc8ddd[_0x919e('0x1f')]],'as':_0xdc8ddd['as'],'attributes':_0xdc8ddd['attributes'],'include':_0xdc8ddd[_0x919e('0x1d')]?_[_0x919e('0x1e')](_0xdc8ddd[_0x919e('0x1d')],function(_0x1ad4da){return{'model':db[_0x1ad4da['model']],'as':_0x1ad4da['as'],'attributes':_0x1ad4da['attributes'],'include':_0x1ad4da[_0x919e('0x1d')]?_[_0x919e('0x1e')](_0x1ad4da[_0x919e('0x1d')],function(_0x53e7ab){return{'model':db[_0x53e7ab[_0x919e('0x1f')]],'as':_0x53e7ab['as'],'attributes':_0x53e7ab[_0x919e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x919e('0xb')](function(_0x3a9aed){logger[_0x919e('0xc')]('ShowCmHopper',_0x56cb7b);logger[_0x919e('0xf')](_0x919e('0x20'),_0x56cb7b,JSON[_0x919e('0x11')](_0x3a9aed));_0x312ea0(_0x3a9aed);})[_0x919e('0x15')](function(_0x373d9c){logger[_0x919e('0x12')](_0x919e('0x20'),_0x373d9c['message'],_0x56cb7b);_0x59725f(_0xae2fd0[_0x919e('0x12')](0x1f4,_0x373d9c[_0x919e('0x13')]));});});};exports[_0x919e('0x22')]=function(_0x1c87b7){var _0x23302f=this;return new Promise(function(_0x440195,_0x3dad85){return db[_0x919e('0x17')][_0x919e('0x23')](_0x1c87b7[_0x919e('0x24')],{'raw':_0x1c87b7[_0x919e('0x19')]?_0x1c87b7[_0x919e('0x19')][_0x919e('0x1a')]===undefined?!![]:![]:!![]})[_0x919e('0xb')](function(_0xf867d1){logger[_0x919e('0xc')](_0x919e('0x22'),_0x1c87b7);logger['debug'](_0x919e('0x22'),_0x1c87b7,JSON[_0x919e('0x11')](_0xf867d1));_0x440195(_0xf867d1);})[_0x919e('0x15')](function(_0x8bdc5a){logger[_0x919e('0x12')](_0x919e('0x22'),_0x8bdc5a['message'],_0x1c87b7);_0x3dad85(_0x23302f[_0x919e('0x12')](0x1f4,_0x8bdc5a['message']));});});};exports[_0x919e('0x25')]=function(_0x13b10f){var _0x1a00c4=this;return new Promise(function(_0x1b21b2,_0x1c02b1){return db[_0x919e('0x17')][_0x919e('0x26')](_0x13b10f[_0x919e('0x24')],{'raw':_0x13b10f[_0x919e('0x19')]?_0x13b10f['options'][_0x919e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13b10f[_0x919e('0x19')]?_0x13b10f[_0x919e('0x19')][_0x919e('0x1b')]||null:null,'attributes':_0x13b10f[_0x919e('0x19')]?_0x13b10f[_0x919e('0x19')][_0x919e('0x1c')]||null:null,'limit':_0x13b10f[_0x919e('0x19')]?_0x13b10f[_0x919e('0x19')][_0x919e('0x27')]||null:null})[_0x919e('0xb')](function(_0x22d61b){logger['info']('UpdateCmHopper',_0x13b10f);logger[_0x919e('0xf')](_0x919e('0x25'),_0x13b10f,JSON[_0x919e('0x11')](_0x22d61b));_0x1b21b2(_0x22d61b);})['catch'](function(_0x3d3f2c){logger[_0x919e('0x12')](_0x919e('0x25'),_0x3d3f2c[_0x919e('0x13')],_0x13b10f);_0x1c02b1(_0x1a00c4[_0x919e('0x12')](0x1f4,_0x3d3f2c['message']));});});};exports[_0x919e('0x28')]=function(_0xe9b6b6){var _0x2454fa=this;return new Promise(function(_0xfaf695,_0xfd785e){return db[_0x919e('0x17')][_0x919e('0x29')]({'where':_0xe9b6b6['options']?_0xe9b6b6['options']['where']||null:null})[_0x919e('0xb')](function(_0x9d4fcb){logger[_0x919e('0xc')]('DestroyCmHopper',_0xe9b6b6);logger['debug'](_0x919e('0x28'),_0xe9b6b6,JSON[_0x919e('0x11')](_0x9d4fcb));_0xfaf695(_0x9d4fcb);})[_0x919e('0x15')](function(_0x5f2951){logger[_0x919e('0x12')](_0x919e('0x28'),_0x5f2951[_0x919e('0x13')],_0xe9b6b6);_0xfd785e(_0x2454fa['error'](0x1f4,_0x5f2951[_0x919e('0x13')]));});});};exports['GetContactDialer']=function(_0x20fe08){var _0x554146=this;return new Promise(function(_0x4ebdc4,_0x156e35){return db[_0x919e('0x2a')][_0x919e('0x2b')]()[_0x919e('0xb')](function(_0x40794d){return db['sequelize'][_0x919e('0x2c')](function(_0x41b026){return db['CmHopper'][_0x919e('0x18')]({'where':_0x20fe08[_0x919e('0x19')]?_0x20fe08[_0x919e('0x19')]['where']||null:null,'attributes':_0x20fe08['options']?_0x20fe08['options'][_0x919e('0x1c')]||null:null,'limit':_0x20fe08[_0x919e('0x19')]?_0x20fe08['options'][_0x919e('0x27')]||null:null,'order':_0x20fe08[_0x919e('0x19')]?_0x20fe08[_0x919e('0x19')]['order']||null:null,'transaction':_0x41b026,'lock':_0x41b026[_0x919e('0x2d')][_0x919e('0x2e')],'include':[{'model':db[_0x919e('0x2a')],'as':_0x919e('0x2f'),'attributes':_['keys'](_0x40794d)},{'model':db[_0x919e('0x30')],'as':_0x919e('0x31'),'attributes':['id',_0x919e('0x32'),_0x919e('0x33')]}]})['then'](function(_0x13bc1c){var _0x40e2e2=[];var _0x1f34de=[];for(var _0x41af3e=0x0;_0x41af3e<_0x13bc1c[_0x919e('0x34')];_0x41af3e+=0x1){if(!_0x1f34de[_0x919e('0x35')](_0x13bc1c[_0x41af3e][_0x919e('0x36')])){_0x1f34de[_0x919e('0x37')](_0x13bc1c[_0x41af3e]['UserId']);_0x40e2e2[_0x919e('0x37')](_0x13bc1c[_0x41af3e][_0x919e('0x26')](_0x20fe08[_0x919e('0x24')],{'transaction':_0x41b026}));}}return BPromise[_0x919e('0x38')](_0x40e2e2);});})['then'](function(_0x39c007){logger[_0x919e('0xc')](_0x919e('0x39'),_0x20fe08);logger[_0x919e('0xf')](_0x919e('0x39'),_0x20fe08,JSON[_0x919e('0x11')](_0x39c007));_0x4ebdc4(_0x39c007);})[_0x919e('0x15')](function(_0x180339){logger[_0x919e('0x12')](_0x919e('0x39'),_0x180339[_0x919e('0x13')],_0x20fe08);_0x156e35(_0x554146[_0x919e('0x12')](0x1f4,_0x180339[_0x919e('0x13')]));});});});};exports[_0x919e('0x3a')]=function(_0x6e70ec){var _0x9d6f92=this;return new Promise(function(_0x4d59c6,_0x5e3a9c){return db[_0x919e('0x3b')][_0x919e('0x2c')](function(_0x27a084){return db[_0x919e('0x3c')][_0x919e('0x23')](_0x6e70ec['body'],{'raw':_0x6e70ec['options']?_0x6e70ec[_0x919e('0x19')][_0x919e('0x1a')]===undefined?!![]:![]:!![],'transaction':_0x27a084})[_0x919e('0xb')](function(){return db['CmHopper']['destroy']({'where':_0x6e70ec[_0x919e('0x19')]?_0x6e70ec[_0x919e('0x19')][_0x919e('0x1b')]||null:null,'transaction':_0x27a084});});})[_0x919e('0xb')](function(_0x576e1a){logger[_0x919e('0xc')](_0x919e('0x3a'),_0x6e70ec);logger[_0x919e('0xf')](_0x919e('0x3a'),_0x6e70ec,JSON[_0x919e('0x11')](_0x576e1a));_0x4d59c6(_0x576e1a);})[_0x919e('0x15')](function(_0x3a0a9b){logger[_0x919e('0x12')](_0x919e('0x3a'),_0x3a0a9b['message'],_0x6e70ec);_0x5e3a9c(_0x9d6f92[_0x919e('0x12')](0x1f4,_0x3a0a9b[_0x919e('0x13')]));});});};exports['CountReScheduled']=function(_0x4e350c){var _0x5b8936=this;return new Promise(function(_0x1d4031,_0x5e0d41){return db[_0x919e('0x17')][_0x919e('0x18')]({'raw':_0x4e350c[_0x919e('0x19')]?_0x4e350c['options'][_0x919e('0x1a')]===undefined?!![]:![]:!![],'where':_0x4e350c[_0x919e('0x19')]?_0x4e350c['options'][_0x919e('0x1b')]||null:null,'attributes':[[db['sequelize']['fn'](_0x919e('0x3d'),db['sequelize']['fn']('IF',db[_0x919e('0x3b')][_0x919e('0x3e')](_0x919e('0x3f')+util[_0x919e('0x40')](_0x919e('0x41'),moment()[_0x919e('0x40')](_0x919e('0x42')))+_0x919e('0x43')))),_0x919e('0x44')]]})[_0x919e('0xb')](function(_0x4ed024){logger[_0x919e('0xc')]('CountReScheduled',_0x4e350c);logger[_0x919e('0xf')](_0x919e('0x45'),_0x4e350c,JSON[_0x919e('0x11')](_0x4ed024));_0x1d4031(_0x4ed024);})['catch'](function(_0x134d89){logger[_0x919e('0x12')]('CountReScheduled',_0x134d89['message'],_0x4e350c);_0x5e0d41(_0x5b8936[_0x919e('0x12')](0x1f4,_0x134d89['message']));});});};exports[_0x919e('0x46')]=function(_0x1befc5){var _0x43b883=this;return new Promise(function(_0x3a4677,_0x45ee68){return db[_0x919e('0x2a')][_0x919e('0x2b')]()[_0x919e('0xb')](function(_0x2952d9){return db[_0x919e('0x3b')][_0x919e('0x2c')](function(_0x331011){return db['CmHopper']['findAll']({'where':_0x1befc5['options']?_0x1befc5[_0x919e('0x19')][_0x919e('0x1b')]||null:null,'attributes':_0x1befc5[_0x919e('0x19')]?_0x1befc5[_0x919e('0x19')]['attributes']||null:null,'limit':0x1,'order':_0x1befc5[_0x919e('0x19')]?_0x1befc5['options']['order']||null:null,'group':db[_0x919e('0x17')][_0x919e('0x36')],'transaction':_0x331011,'lock':_0x331011[_0x919e('0x2d')][_0x919e('0x2e')],'include':_0x1befc5['options']?_0x1befc5[_0x919e('0x19')][_0x919e('0x1d')]?_[_0x919e('0x1e')](_0x1befc5['options'][_0x919e('0x1d')],function(_0x369255){return{'model':db[_0x369255['model']],'as':_0x369255['as'],'attributes':_0x369255['attributes'],'include':_0x369255['include']?_[_0x919e('0x1e')](_0x369255[_0x919e('0x1d')],function(_0x57c9d9){return{'model':db[_0x57c9d9[_0x919e('0x1f')]],'as':_0x57c9d9['as'],'attributes':_0x57c9d9[_0x919e('0x1c')],'include':_0x57c9d9[_0x919e('0x1d')]?_[_0x919e('0x1e')](_0x57c9d9['include'],function(_0x4d4429){return{'model':db[_0x4d4429['model']],'as':_0x4d4429['as'],'attributes':_0x4d4429[_0x919e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x919e('0xb')](function(_0x12f003){var _0x30c1ab=[];for(var _0x570cdc=0x0;_0x570cdc<_0x12f003[_0x919e('0x34')];_0x570cdc+=0x1){_0x30c1ab[_0x919e('0x37')](_0x12f003[_0x570cdc][_0x919e('0x26')](_0x1befc5[_0x919e('0x24')],{'transaction':_0x331011}));}return BPromise['all'](_0x30c1ab);});})[_0x919e('0xb')](function(_0x2dbe26){logger[_0x919e('0xc')](_0x919e('0x46'),_0x1befc5);logger[_0x919e('0xf')](_0x919e('0x46'),_0x1befc5,JSON[_0x919e('0x11')](_0x2dbe26));_0x3a4677(_0x2dbe26);})[_0x919e('0x15')](function(_0xe70ba4){logger[_0x919e('0x12')](_0x919e('0x46'),_0xe70ba4[_0x919e('0x13')],_0x1befc5);_0x45ee68(_0x43b883[_0x919e('0x12')](0x1f4,_0xe70ba4['message']));});});});};exports[_0x919e('0x47')]=function(_0x38191a){var _0x6c670d=this;return new Promise(function(_0x5859c2,_0x2920e4){db[_0x919e('0x2a')]['describe']()['then'](function(_0x18c3d6){return db[_0x919e('0x17')][_0x919e('0x18')]({'raw':_0x38191a[_0x919e('0x19')]?_0x38191a[_0x919e('0x19')][_0x919e('0x1a')]===undefined?!![]:![]:!![],'where':_0x38191a[_0x919e('0x19')]?_0x38191a['options'][_0x919e('0x1b')]||null:null,'attributes':_0x38191a[_0x919e('0x19')]?_0x38191a['options'][_0x919e('0x1c')]||null:null,'limit':_0x38191a[_0x919e('0x19')]?_0x38191a[_0x919e('0x19')][_0x919e('0x27')]||null:null,'include':_0x38191a['options']?_0x38191a[_0x919e('0x19')][_0x919e('0x1d')]?_[_0x919e('0x1e')](_0x38191a['options'][_0x919e('0x1d')],function(_0x2fef9e){return{'model':db[_0x2fef9e['model']],'as':_0x2fef9e['as'],'attributes':_0x2fef9e['as']===_0x919e('0x2f')?_[_0x919e('0x48')](_0x18c3d6):_0x2fef9e[_0x919e('0x1c')],'include':_0x2fef9e['include']?_['map'](_0x2fef9e[_0x919e('0x1d')],function(_0x49a793){return{'model':db[_0x49a793[_0x919e('0x1f')]],'as':_0x49a793['as'],'attributes':_0x49a793[_0x919e('0x1c')],'include':_0x49a793[_0x919e('0x1d')]?_[_0x919e('0x1e')](_0x49a793[_0x919e('0x1d')],function(_0x6e90e2){return{'model':db[_0x6e90e2[_0x919e('0x1f')]],'as':_0x6e90e2['as'],'attributes':_0x6e90e2[_0x919e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x919e('0xb')](function(_0x277d32){logger[_0x919e('0xc')](_0x919e('0x16'),_0x38191a);logger[_0x919e('0xf')](_0x919e('0x16'),_0x38191a,JSON[_0x919e('0x11')](_0x277d32));_0x5859c2(_0x277d32);})['catch'](function(_0x48d6e8){logger[_0x919e('0x12')]('GetCmHopper',_0x48d6e8[_0x919e('0x13')],_0x38191a);_0x2920e4(_0x6c670d[_0x919e('0x12')](0x1f4,_0x48d6e8['message']));});});});}; \ No newline at end of file +var _0x1205=['literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowCmHopper','find','CreateCmHopper','create','UpdateCmHopper','body','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','Contact','keys','Agent','length','includes','UserId','push','update','all','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1205,0xd4));var _0x5120=function(_0x265e9c,_0x1dfde9){_0x265e9c=_0x265e9c-0x0;var _0x4d62c1=_0x1205[_0x265e9c];return _0x4d62c1;};'use strict';var _=require('lodash');var util=require(_0x5120('0x0'));var moment=require('moment');var BPromise=require(_0x5120('0x1'));var rs=require(_0x5120('0x2'));var fs=require('fs');var Redis=require(_0x5120('0x3'));var db=require(_0x5120('0x4'))['db'];var utils=require(_0x5120('0x5'));var logger=require(_0x5120('0x6'))('rpc');var config=require(_0x5120('0x7'));var jayson=require(_0x5120('0x8'));var client=jayson[_0x5120('0x9')][_0x5120('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x597d53,_0x5aa99c,_0x5eab9f){return new BPromise(function(_0x1de6e8,_0x3374ff){return client['request'](_0x597d53,_0x5eab9f)['then'](function(_0x2648f2){logger[_0x5120('0xb')](_0x5120('0xc'),_0x5aa99c,_0x5120('0xd'));logger[_0x5120('0xe')](_0x5120('0xf'),_0x5aa99c,_0x5120('0xd'),JSON[_0x5120('0x10')](_0x2648f2));if(_0x2648f2[_0x5120('0x11')]){if(_0x2648f2[_0x5120('0x11')][_0x5120('0x12')]===0x1f4){logger['error'](_0x5120('0xc'),_0x5aa99c,_0x2648f2[_0x5120('0x11')][_0x5120('0x13')]);return _0x3374ff(_0x2648f2[_0x5120('0x11')][_0x5120('0x13')]);}logger[_0x5120('0x11')](_0x5120('0xc'),_0x5aa99c,_0x2648f2[_0x5120('0x11')][_0x5120('0x13')]);return _0x1de6e8(_0x2648f2[_0x5120('0x11')][_0x5120('0x13')]);}else{logger[_0x5120('0xb')](_0x5120('0xc'),_0x5aa99c,_0x5120('0xd'));_0x1de6e8(_0x2648f2['result'][_0x5120('0x13')]);}})[_0x5120('0x14')](function(_0x10f6fd){logger['error']('CmHopper,\x20%s,\x20%s',_0x5aa99c,_0x10f6fd);_0x3374ff(_0x10f6fd);});});}exports[_0x5120('0x15')]=function(_0x3c3260){var _0x15fddf=this;return new Promise(function(_0x1a80d9,_0x356c06){return db[_0x5120('0x16')][_0x5120('0x17')]({'raw':_0x3c3260[_0x5120('0x18')]?_0x3c3260[_0x5120('0x18')][_0x5120('0x19')]===undefined?!![]:![]:!![],'where':_0x3c3260['options']?_0x3c3260[_0x5120('0x18')][_0x5120('0x1a')]||null:null,'attributes':_0x3c3260['options']?_0x3c3260['options'][_0x5120('0x1b')]||null:null,'limit':_0x3c3260['options']?_0x3c3260['options'][_0x5120('0x1c')]||null:null,'include':_0x3c3260['options']?_0x3c3260[_0x5120('0x18')][_0x5120('0x1d')]?_[_0x5120('0x1e')](_0x3c3260[_0x5120('0x18')][_0x5120('0x1d')],function(_0x356db6){return{'model':db[_0x356db6['model']],'as':_0x356db6['as'],'attributes':_0x356db6['attributes'],'include':_0x356db6[_0x5120('0x1d')]?_[_0x5120('0x1e')](_0x356db6[_0x5120('0x1d')],function(_0x477bba){return{'model':db[_0x477bba[_0x5120('0x1f')]],'as':_0x477bba['as'],'attributes':_0x477bba[_0x5120('0x1b')],'include':_0x477bba[_0x5120('0x1d')]?_['map'](_0x477bba[_0x5120('0x1d')],function(_0x38cc0d){return{'model':db[_0x38cc0d['model']],'as':_0x38cc0d['as'],'attributes':_0x38cc0d[_0x5120('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5120('0x20')](function(_0x13c694){logger['info'](_0x5120('0x15'),_0x3c3260);logger['debug'](_0x5120('0x15'),_0x3c3260,JSON['stringify'](_0x13c694));_0x1a80d9(_0x13c694);})[_0x5120('0x14')](function(_0x50229f){logger[_0x5120('0x11')]('GetCmHopper',_0x50229f['message'],_0x3c3260);_0x356c06(_0x15fddf[_0x5120('0x11')](0x1f4,_0x50229f[_0x5120('0x13')]));});});};exports[_0x5120('0x21')]=function(_0x44616e){var _0x2ddc4a=this;return new Promise(function(_0x39dc27,_0x1d8224){return db[_0x5120('0x16')][_0x5120('0x22')]({'raw':_0x44616e[_0x5120('0x18')]?_0x44616e[_0x5120('0x18')][_0x5120('0x19')]===undefined?!![]:![]:!![],'where':_0x44616e[_0x5120('0x18')]?_0x44616e[_0x5120('0x18')][_0x5120('0x1a')]||null:null,'attributes':_0x44616e['options']?_0x44616e['options'][_0x5120('0x1b')]||null:null,'include':_0x44616e['options']?_0x44616e[_0x5120('0x18')]['include']?_[_0x5120('0x1e')](_0x44616e[_0x5120('0x18')]['include'],function(_0x9ed8b2){return{'model':db[_0x9ed8b2[_0x5120('0x1f')]],'as':_0x9ed8b2['as'],'attributes':_0x9ed8b2[_0x5120('0x1b')],'include':_0x9ed8b2['include']?_[_0x5120('0x1e')](_0x9ed8b2[_0x5120('0x1d')],function(_0x6d204e){return{'model':db[_0x6d204e[_0x5120('0x1f')]],'as':_0x6d204e['as'],'attributes':_0x6d204e[_0x5120('0x1b')],'include':_0x6d204e[_0x5120('0x1d')]?_[_0x5120('0x1e')](_0x6d204e[_0x5120('0x1d')],function(_0x3f0bd1){return{'model':db[_0x3f0bd1['model']],'as':_0x3f0bd1['as'],'attributes':_0x3f0bd1[_0x5120('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5120('0x20')](function(_0x584c60){logger[_0x5120('0xb')](_0x5120('0x21'),_0x44616e);logger['debug']('ShowCmHopper',_0x44616e,JSON['stringify'](_0x584c60));_0x39dc27(_0x584c60);})[_0x5120('0x14')](function(_0xe15213){logger[_0x5120('0x11')](_0x5120('0x21'),_0xe15213[_0x5120('0x13')],_0x44616e);_0x1d8224(_0x2ddc4a[_0x5120('0x11')](0x1f4,_0xe15213['message']));});});};exports[_0x5120('0x23')]=function(_0x257c00){var _0x2a89a7=this;return new Promise(function(_0x5405da,_0x5ae4ad){return db[_0x5120('0x16')][_0x5120('0x24')](_0x257c00['body'],{'raw':_0x257c00[_0x5120('0x18')]?_0x257c00['options'][_0x5120('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x280118){logger['info'](_0x5120('0x23'),_0x257c00);logger['debug']('CreateCmHopper',_0x257c00,JSON[_0x5120('0x10')](_0x280118));_0x5405da(_0x280118);})[_0x5120('0x14')](function(_0x355dcd){logger['error']('CreateCmHopper',_0x355dcd[_0x5120('0x13')],_0x257c00);_0x5ae4ad(_0x2a89a7[_0x5120('0x11')](0x1f4,_0x355dcd[_0x5120('0x13')]));});});};exports[_0x5120('0x25')]=function(_0x320587){var _0x10e128=this;return new Promise(function(_0x2ee922,_0x36b8cf){return db[_0x5120('0x16')]['update'](_0x320587[_0x5120('0x26')],{'raw':_0x320587['options']?_0x320587[_0x5120('0x18')][_0x5120('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x320587[_0x5120('0x18')]?_0x320587[_0x5120('0x18')][_0x5120('0x1a')]||null:null,'attributes':_0x320587[_0x5120('0x18')]?_0x320587[_0x5120('0x18')]['attributes']||null:null,'limit':_0x320587[_0x5120('0x18')]?_0x320587[_0x5120('0x18')][_0x5120('0x1c')]||null:null})[_0x5120('0x20')](function(_0x38d315){logger[_0x5120('0xb')](_0x5120('0x25'),_0x320587);logger[_0x5120('0xe')](_0x5120('0x25'),_0x320587,JSON['stringify'](_0x38d315));_0x2ee922(_0x38d315);})[_0x5120('0x14')](function(_0x574bfb){logger['error']('UpdateCmHopper',_0x574bfb['message'],_0x320587);_0x36b8cf(_0x10e128[_0x5120('0x11')](0x1f4,_0x574bfb[_0x5120('0x13')]));});});};exports[_0x5120('0x27')]=function(_0x1436ad){var _0x1fdf93=this;return new Promise(function(_0x23e2be,_0x5c89c1){return db[_0x5120('0x16')][_0x5120('0x28')]({'where':_0x1436ad[_0x5120('0x18')]?_0x1436ad[_0x5120('0x18')][_0x5120('0x1a')]||null:null})[_0x5120('0x20')](function(_0x1f1e3a){logger[_0x5120('0xb')](_0x5120('0x27'),_0x1436ad);logger[_0x5120('0xe')](_0x5120('0x27'),_0x1436ad,JSON[_0x5120('0x10')](_0x1f1e3a));_0x23e2be(_0x1f1e3a);})[_0x5120('0x14')](function(_0x9ba2c){logger[_0x5120('0x11')](_0x5120('0x27'),_0x9ba2c[_0x5120('0x13')],_0x1436ad);_0x5c89c1(_0x1fdf93[_0x5120('0x11')](0x1f4,_0x9ba2c['message']));});});};exports[_0x5120('0x29')]=function(_0x2a15db){var _0x5b1555=this;return new Promise(function(_0x34da4b,_0xdbf39a){return db[_0x5120('0x2a')][_0x5120('0x2b')]()['then'](function(_0x3b0c6d){return db[_0x5120('0x2c')][_0x5120('0x2d')](function(_0x1a59f8){return db[_0x5120('0x16')]['findAll']({'where':_0x2a15db[_0x5120('0x18')]?_0x2a15db[_0x5120('0x18')]['where']||null:null,'attributes':_0x2a15db[_0x5120('0x18')]?_0x2a15db[_0x5120('0x18')]['attributes']||null:null,'limit':_0x2a15db[_0x5120('0x18')]?_0x2a15db[_0x5120('0x18')]['limit']||null:null,'order':_0x2a15db[_0x5120('0x18')]?_0x2a15db[_0x5120('0x18')][_0x5120('0x2e')]||null:null,'transaction':_0x1a59f8,'lock':_0x1a59f8['LOCK']['UPDATE'],'include':[{'model':db[_0x5120('0x2a')],'as':_0x5120('0x2f'),'attributes':_[_0x5120('0x30')](_0x3b0c6d)},{'model':db['User'],'as':_0x5120('0x31'),'attributes':['id','name','voicePause']}]})['then'](function(_0x27dc6d){var _0x450b38=[];var _0x438120=[];for(var _0x5dde32=0x0;_0x5dde32<_0x27dc6d[_0x5120('0x32')];_0x5dde32+=0x1){if(!_0x438120[_0x5120('0x33')](_0x27dc6d[_0x5dde32][_0x5120('0x34')])){_0x438120[_0x5120('0x35')](_0x27dc6d[_0x5dde32][_0x5120('0x34')]);_0x450b38['push'](_0x27dc6d[_0x5dde32][_0x5120('0x36')](_0x2a15db['body'],{'transaction':_0x1a59f8}));}}return BPromise[_0x5120('0x37')](_0x450b38);});})['then'](function(_0x1e8bdd){logger['info'](_0x5120('0x29'),_0x2a15db);logger[_0x5120('0xe')](_0x5120('0x29'),_0x2a15db,JSON[_0x5120('0x10')](_0x1e8bdd));_0x34da4b(_0x1e8bdd);})[_0x5120('0x14')](function(_0x352ab2){logger[_0x5120('0x11')](_0x5120('0x29'),_0x352ab2[_0x5120('0x13')],_0x2a15db);_0xdbf39a(_0x5b1555[_0x5120('0x11')](0x1f4,_0x352ab2[_0x5120('0x13')]));});});});};exports[_0x5120('0x38')]=function(_0x2595e9){var _0x2e1ebd=this;return new Promise(function(_0x45a459,_0x49a482){return db[_0x5120('0x2c')][_0x5120('0x2d')](function(_0x45f95f){return db[_0x5120('0x39')][_0x5120('0x24')](_0x2595e9['body'],{'raw':_0x2595e9[_0x5120('0x18')]?_0x2595e9['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x45f95f})[_0x5120('0x20')](function(){return db[_0x5120('0x16')]['destroy']({'where':_0x2595e9[_0x5120('0x18')]?_0x2595e9[_0x5120('0x18')]['where']||null:null,'transaction':_0x45f95f});});})[_0x5120('0x20')](function(_0x278b2c){logger['info'](_0x5120('0x38'),_0x2595e9);logger['debug'](_0x5120('0x38'),_0x2595e9,JSON[_0x5120('0x10')](_0x278b2c));_0x45a459(_0x278b2c);})['catch'](function(_0x5c6662){logger[_0x5120('0x11')]('MoveContactManagedDialer',_0x5c6662[_0x5120('0x13')],_0x2595e9);_0x49a482(_0x2e1ebd['error'](0x1f4,_0x5c6662[_0x5120('0x13')]));});});};exports[_0x5120('0x3a')]=function(_0x19343f){var _0x4b653e=this;return new Promise(function(_0x3d7157,_0x5cfc64){return db[_0x5120('0x16')][_0x5120('0x17')]({'raw':_0x19343f[_0x5120('0x18')]?_0x19343f[_0x5120('0x18')][_0x5120('0x19')]===undefined?!![]:![]:!![],'where':_0x19343f[_0x5120('0x18')]?_0x19343f[_0x5120('0x18')][_0x5120('0x1a')]||null:null,'attributes':[[db[_0x5120('0x2c')]['fn'](_0x5120('0x3b'),db[_0x5120('0x2c')]['fn']('IF',db['sequelize'][_0x5120('0x3c')](_0x5120('0x3d')+util[_0x5120('0x3e')](_0x5120('0x3f'),moment()['format'](_0x5120('0x40')))+_0x5120('0x41')))),_0x5120('0x42')]]})['then'](function(_0x31ab30){logger['info'](_0x5120('0x3a'),_0x19343f);logger[_0x5120('0xe')]('CountReScheduled',_0x19343f,JSON['stringify'](_0x31ab30));_0x3d7157(_0x31ab30);})['catch'](function(_0x22f78c){logger['error'](_0x5120('0x3a'),_0x22f78c['message'],_0x19343f);_0x5cfc64(_0x4b653e[_0x5120('0x11')](0x1f4,_0x22f78c['message']));});});};exports[_0x5120('0x43')]=function(_0x2a50d8){var _0x5e5f9e=this;return new Promise(function(_0x4f61e1,_0x150761){return db[_0x5120('0x2a')]['describe']()[_0x5120('0x20')](function(_0x574730){return db[_0x5120('0x2c')][_0x5120('0x2d')](function(_0x48cbac){return db[_0x5120('0x16')][_0x5120('0x17')]({'where':_0x2a50d8[_0x5120('0x18')]?_0x2a50d8[_0x5120('0x18')][_0x5120('0x1a')]||null:null,'attributes':_0x2a50d8['options']?_0x2a50d8[_0x5120('0x18')]['attributes']||null:null,'limit':0x1,'order':_0x2a50d8[_0x5120('0x18')]?_0x2a50d8['options'][_0x5120('0x2e')]||null:null,'group':db['CmHopper'][_0x5120('0x34')],'transaction':_0x48cbac,'lock':_0x48cbac['LOCK']['UPDATE'],'include':_0x2a50d8[_0x5120('0x18')]?_0x2a50d8[_0x5120('0x18')][_0x5120('0x1d')]?_['map'](_0x2a50d8['options'][_0x5120('0x1d')],function(_0x2001e0){return{'model':db[_0x2001e0[_0x5120('0x1f')]],'as':_0x2001e0['as'],'attributes':_0x2001e0[_0x5120('0x1b')],'include':_0x2001e0[_0x5120('0x1d')]?_[_0x5120('0x1e')](_0x2001e0[_0x5120('0x1d')],function(_0x2c0e11){return{'model':db[_0x2c0e11[_0x5120('0x1f')]],'as':_0x2c0e11['as'],'attributes':_0x2c0e11[_0x5120('0x1b')],'include':_0x2c0e11[_0x5120('0x1d')]?_[_0x5120('0x1e')](_0x2c0e11[_0x5120('0x1d')],function(_0x5db0a4){return{'model':db[_0x5db0a4[_0x5120('0x1f')]],'as':_0x5db0a4['as'],'attributes':_0x5db0a4[_0x5120('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5120('0x20')](function(_0x54d2d2){var _0x13aa27=[];for(var _0x4ad877=0x0;_0x4ad877<_0x54d2d2[_0x5120('0x32')];_0x4ad877+=0x1){_0x13aa27[_0x5120('0x35')](_0x54d2d2[_0x4ad877]['update'](_0x2a50d8['body'],{'transaction':_0x48cbac}));}return BPromise[_0x5120('0x37')](_0x13aa27);});})[_0x5120('0x20')](function(_0x7957dc){logger[_0x5120('0xb')](_0x5120('0x43'),_0x2a50d8);logger[_0x5120('0xe')](_0x5120('0x43'),_0x2a50d8,JSON[_0x5120('0x10')](_0x7957dc));_0x4f61e1(_0x7957dc);})['catch'](function(_0x3f004b){logger[_0x5120('0x11')](_0x5120('0x43'),_0x3f004b[_0x5120('0x13')],_0x2a50d8);_0x150761(_0x5e5f9e[_0x5120('0x11')](0x1f4,_0x3f004b['message']));});});});};exports['GetCmHopperPreview']=function(_0x20c91b){var _0x1efc04=this;return new Promise(function(_0x474052,_0x2c5b86){db[_0x5120('0x2a')][_0x5120('0x2b')]()[_0x5120('0x20')](function(_0x32631f){return db['CmHopper'][_0x5120('0x17')]({'raw':_0x20c91b['options']?_0x20c91b[_0x5120('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x20c91b[_0x5120('0x18')]?_0x20c91b[_0x5120('0x18')]['where']||null:null,'attributes':_0x20c91b[_0x5120('0x18')]?_0x20c91b[_0x5120('0x18')][_0x5120('0x1b')]||null:null,'limit':_0x20c91b[_0x5120('0x18')]?_0x20c91b[_0x5120('0x18')][_0x5120('0x1c')]||null:null,'include':_0x20c91b[_0x5120('0x18')]?_0x20c91b[_0x5120('0x18')][_0x5120('0x1d')]?_[_0x5120('0x1e')](_0x20c91b[_0x5120('0x18')][_0x5120('0x1d')],function(_0x18cae9){return{'model':db[_0x18cae9[_0x5120('0x1f')]],'as':_0x18cae9['as'],'attributes':_0x18cae9['as']==='Contact'?_[_0x5120('0x30')](_0x32631f):_0x18cae9[_0x5120('0x1b')],'include':_0x18cae9[_0x5120('0x1d')]?_['map'](_0x18cae9[_0x5120('0x1d')],function(_0x4dbe89){return{'model':db[_0x4dbe89[_0x5120('0x1f')]],'as':_0x4dbe89['as'],'attributes':_0x4dbe89[_0x5120('0x1b')],'include':_0x4dbe89[_0x5120('0x1d')]?_['map'](_0x4dbe89[_0x5120('0x1d')],function(_0x5ed7ac){return{'model':db[_0x5ed7ac[_0x5120('0x1f')]],'as':_0x5ed7ac['as'],'attributes':_0x5ed7ac[_0x5120('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5120('0x20')](function(_0x3e807e){logger['info'](_0x5120('0x15'),_0x20c91b);logger[_0x5120('0xe')](_0x5120('0x15'),_0x20c91b,JSON[_0x5120('0x10')](_0x3e807e));_0x474052(_0x3e807e);})[_0x5120('0x14')](function(_0x327f53){logger[_0x5120('0x11')](_0x5120('0x15'),_0x327f53['message'],_0x20c91b);_0x2c5b86(_0x1efc04['error'](0x1f4,_0x327f53[_0x5120('0x13')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index fb4a5ec..ae7af79 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 _0x946e=['/opencontacts','isAuthenticated','create','getPreview','/:id','update','delete','destroy','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','index','/describe','describe'];(function(_0x171b2f,_0x337677){var _0x4678d8=function(_0x160fce){while(--_0x160fce){_0x171b2f['push'](_0x171b2f['shift']());}};_0x4678d8(++_0x337677);}(_0x946e,0x1d0));var _0xe946=function(_0xe18712,_0x44b4bb){_0xe18712=_0xe18712-0x0;var _0x4effee=_0x946e[_0xe18712];return _0x4effee;};'use strict';var multer=require(_0xe946('0x0'));var util=require('util');var path=require(_0xe946('0x1'));var timeout=require('connect-timeout');var express=require(_0xe946('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe946('0x3'));var interaction=require(_0xe946('0x4'));var config=require(_0xe946('0x5'));var controller=require(_0xe946('0x6'));router[_0xe946('0x7')]('/',auth['isAuthenticated'](),controller[_0xe946('0x8')]);router[_0xe946('0x7')](_0xe946('0x9'),auth['isAuthenticated'](),controller[_0xe946('0xa')]);router['get'](_0xe946('0xb'),auth[_0xe946('0xc')](),controller['getOpenContacts']);router['get']('/:id',auth[_0xe946('0xc')](),controller['show']);router['post']('/',auth[_0xe946('0xc')](),controller[_0xe946('0xd')]);router['post']('/preview',auth[_0xe946('0xc')](),controller[_0xe946('0xe')]);router['put'](_0xe946('0xf'),auth[_0xe946('0xc')](),controller[_0xe946('0x10')]);router[_0xe946('0x11')](_0xe946('0xf'),auth[_0xe946('0xc')](),controller[_0xe946('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe644=['../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','/describe','getOpenContacts','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1cb62d,_0x5ec83a){var _0x2b9388=function(_0x40dd1d){while(--_0x40dd1d){_0x1cb62d['push'](_0x1cb62d['shift']());}};_0x2b9388(++_0x5ec83a);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4e64('0x0'));var util=require(_0x4e64('0x1'));var path=require(_0x4e64('0x2'));var timeout=require(_0x4e64('0x3'));var express=require(_0x4e64('0x4'));var router=express[_0x4e64('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4e64('0x6'));var interaction=require(_0x4e64('0x7'));var config=require(_0x4e64('0x8'));var controller=require(_0x4e64('0x9'));router[_0x4e64('0xa')]('/',auth[_0x4e64('0xb')](),controller['index']);router[_0x4e64('0xa')](_0x4e64('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x4e64('0xa')]('/opencontacts',auth['isAuthenticated'](),controller[_0x4e64('0xd')]);router[_0x4e64('0xa')](_0x4e64('0xe'),auth[_0x4e64('0xb')](),controller[_0x4e64('0xf')]);router[_0x4e64('0x10')]('/',auth['isAuthenticated'](),controller[_0x4e64('0x11')]);router[_0x4e64('0x10')]('/preview',auth[_0x4e64('0xb')](),controller['getPreview']);router['put'](_0x4e64('0xe'),auth['isAuthenticated'](),controller[_0x4e64('0x12')]);router[_0x4e64('0x13')](_0x4e64('0xe'),auth[_0x4e64('0xb')](),controller[_0x4e64('0x14')]);module[_0x4e64('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index ad2b38c..03afac1 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 _0xb97d=['INTEGER','contactListQueue','sequelize','exports','STRING'];(function(_0x1a72b8,_0x1e4f4b){var _0x39f72d=function(_0x35aef1){while(--_0x35aef1){_0x1a72b8['push'](_0x1a72b8['shift']());}};_0x39f72d(++_0x1e4f4b);}(_0xb97d,0x165));var _0xdb97=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xb97d[_0x3c2a69];return _0x596bc8;};'use strict';var moment=require('moment');var Sequelize=require(_0xdb97('0x0'));module[_0xdb97('0x1')]={'phone':{'type':Sequelize[_0xdb97('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xdb97('0x3')],'unique':_0xdb97('0x4')},'ListId':{'type':Sequelize[_0xdb97('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xdb97('0x4')}}; \ No newline at end of file +var _0xf8d9=['contactListQueue','moment','sequelize','exports','INTEGER'];(function(_0x30dc46,_0x52bf27){var _0x1de097=function(_0x51b05f){while(--_0x51b05f){_0x30dc46['push'](_0x30dc46['shift']());}};_0x1de097(++_0x52bf27);}(_0xf8d9,0x1c3));var _0x9f8d=function(_0x5a636f,_0x3fec2b){_0x5a636f=_0x5a636f-0x0;var _0x6a8cfb=_0xf8d9[_0x5a636f];return _0x6a8cfb;};'use strict';var moment=require(_0x9f8d('0x0'));var Sequelize=require(_0x9f8d('0x1'));module[_0x9f8d('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x9f8d('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x9f8d('0x3')],'unique':_0x9f8d('0x4')},'VoiceQueueId':{'type':Sequelize[_0x9f8d('0x3')],'unique':_0x9f8d('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 1b25819..39ae268 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 _0x6849=['count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','CmHopperBlack','includeAll','findAll','then','rows','catch','show','params','include','options','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x845505,_0x19e5f3){var _0x2513b9=function(_0x10e7af){while(--_0x10e7af){_0x845505['push'](_0x845505['shift']());}};_0x2513b9(++_0x19e5f3);}(_0x6849,0x7e));var _0x9684=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x6849[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x9684('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9684('0x1'));var jsonpatch=require(_0x9684('0x2'));var rp=require(_0x9684('0x3'));var moment=require(_0x9684('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9684('0x5'));var util=require(_0x9684('0x6'));var path=require('path');var sox=require(_0x9684('0x7'));var csv=require(_0x9684('0x8'));var ejs=require(_0x9684('0x9'));var fs=require('fs');var fs_extra=require(_0x9684('0xa'));var _=require(_0x9684('0xb'));var squel=require('squel');var crypto=require(_0x9684('0xc'));var jsforce=require(_0x9684('0xd'));var deskjs=require(_0x9684('0xe'));var toCsv=require(_0x9684('0x8'));var querystring=require(_0x9684('0xf'));var Papa=require(_0x9684('0x10'));var Redis=require(_0x9684('0x11'));var authService=require(_0x9684('0x12'));var qs=require(_0x9684('0x13'));var as=require(_0x9684('0x14'));var hardwareService=require(_0x9684('0x15'));var logger=require(_0x9684('0x16'))(_0x9684('0x17'));var utils=require(_0x9684('0x18'));var config=require(_0x9684('0x19'));var licenseUtil=require(_0x9684('0x1a'));var db=require(_0x9684('0x1b'))['db'];function respondWithStatusCode(_0x4d24a0,_0xfdfa37){_0xfdfa37=_0xfdfa37||0xcc;return function(_0x1e9759){if(_0x1e9759){return _0x4d24a0[_0x9684('0x1c')](_0xfdfa37);}return _0x4d24a0[_0x9684('0x1d')](_0xfdfa37)[_0x9684('0x1e')]();};}function respondWithResult(_0x107991,_0x45478c){_0x45478c=_0x45478c||0xc8;return function(_0x172841){if(_0x172841){return _0x107991[_0x9684('0x1d')](_0x45478c)[_0x9684('0x1f')](_0x172841);}};}function respondWithFilteredResult(_0x4072bf,_0x3789a7){return function(_0x3d38f6){if(_0x3d38f6){var _0x30ac6f=_0x3d38f6[_0x9684('0x20')],_0x1de19e=_0x3789a7[_0x9684('0x21')],_0x57b911=_0x3789a7[_0x9684('0x21')]+_0x3789a7[_0x9684('0x22')],_0x57b6b5;if(_0x57b911>=_0x30ac6f){_0x57b911=_0x30ac6f;_0x57b6b5=0xc8;}else{_0x57b6b5=0xce;}_0x4072bf[_0x9684('0x1d')](_0x57b6b5);return _0x4072bf[_0x9684('0x23')](_0x9684('0x24'),_0x1de19e+'-'+_0x57b911+'/'+_0x30ac6f)[_0x9684('0x1f')](_0x3d38f6);}return null;};}function patchUpdates(_0x3dc9fb){return function(_0x510cc9){try{jsonpatch[_0x9684('0x25')](_0x510cc9,_0x3dc9fb,!![]);}catch(_0x2da68f){return BPromise[_0x9684('0x26')](_0x2da68f);}return _0x510cc9[_0x9684('0x27')]();};}function saveUpdates(_0x3e397e,_0x356684){return function(_0x230f84){if(_0x230f84){return _0x230f84[_0x9684('0x28')](_0x3e397e)['then'](function(_0x15779a){return _0x15779a;});}return null;};}function removeEntity(_0x219f77,_0x1f94ca){return function(_0x4f0d04){if(_0x4f0d04){return _0x4f0d04[_0x9684('0x29')]()['then'](function(){_0x219f77[_0x9684('0x1d')](0xcc)[_0x9684('0x1e')]();});}};}function handleEntityNotFound(_0x4313fd,_0x2a68d5){return function(_0x53cf12){if(!_0x53cf12){_0x4313fd['sendStatus'](0x194);}return _0x53cf12;};}function handleError(_0x487fb8,_0x592af3){_0x592af3=_0x592af3||0x1f4;return function(_0x302143){logger[_0x9684('0x2a')](_0x302143[_0x9684('0x2b')]);if(_0x302143[_0x9684('0x2c')]){delete _0x302143[_0x9684('0x2c')];}_0x487fb8[_0x9684('0x1d')](_0x592af3)[_0x9684('0x2d')](_0x302143);};}exports[_0x9684('0x2e')]=function(_0x2e830a,_0x38a3f7){var _0x23449c={},_0x3751b3={},_0x10a576={'count':0x0,'rows':[]};var _0x6499c2=_[_0x9684('0x2f')](db['CmHopperBlack'][_0x9684('0x30')],function(_0x4b3147){return{'name':_0x4b3147['fieldName'],'type':_0x4b3147[_0x9684('0x31')]['key']};});_0x3751b3[_0x9684('0x32')]=_[_0x9684('0x2f')](_0x6499c2,_0x9684('0x2c'));_0x3751b3[_0x9684('0x33')]=_[_0x9684('0x34')](_0x2e830a['query']);_0x3751b3[_0x9684('0x35')]=_[_0x9684('0x36')](_0x3751b3[_0x9684('0x32')],_0x3751b3['query']);_0x23449c[_0x9684('0x37')]=_['intersection'](_0x3751b3['model'],qs[_0x9684('0x38')](_0x2e830a['query'][_0x9684('0x38')]));_0x23449c[_0x9684('0x37')]=_0x23449c[_0x9684('0x37')][_0x9684('0x39')]?_0x23449c[_0x9684('0x37')]:_0x3751b3[_0x9684('0x32')];if(!_0x2e830a[_0x9684('0x33')]['hasOwnProperty'](_0x9684('0x3a'))){_0x23449c[_0x9684('0x22')]=qs[_0x9684('0x22')](_0x2e830a[_0x9684('0x33')][_0x9684('0x22')]);_0x23449c[_0x9684('0x21')]=qs[_0x9684('0x21')](_0x2e830a['query'][_0x9684('0x21')]);}_0x23449c[_0x9684('0x3b')]=qs[_0x9684('0x3c')](_0x2e830a[_0x9684('0x33')][_0x9684('0x3c')]);_0x23449c['where']=qs['filters'](_[_0x9684('0x3d')](_0x2e830a[_0x9684('0x33')],_0x3751b3[_0x9684('0x35')]),_0x6499c2);if(_0x2e830a[_0x9684('0x33')]['filter']){_0x23449c[_0x9684('0x3e')]=_[_0x9684('0x3f')](_0x23449c[_0x9684('0x3e')],{'$or':_['map'](_0x6499c2,function(_0x2b1ca0){if(_0x2b1ca0[_0x9684('0x31')]!==_0x9684('0x40')){var _0x1295c7={};_0x1295c7[_0x2b1ca0[_0x9684('0x2c')]]={'$like':'%'+_0x2e830a[_0x9684('0x33')][_0x9684('0x41')]+'%'};return _0x1295c7;}})});}_0x23449c=_[_0x9684('0x3f')]({},_0x23449c,_0x2e830a['options']);var _0x17910d={'where':_0x23449c['where']};return db[_0x9684('0x42')][_0x9684('0x20')](_0x17910d)['then'](function(_0x340edc){_0x10a576[_0x9684('0x20')]=_0x340edc;if(_0x2e830a[_0x9684('0x33')][_0x9684('0x43')]){_0x23449c['include']=[{'all':!![]}];}return db[_0x9684('0x42')][_0x9684('0x44')](_0x23449c);})[_0x9684('0x45')](function(_0x47dab4){_0x10a576[_0x9684('0x46')]=_0x47dab4;return _0x10a576;})['then'](respondWithFilteredResult(_0x38a3f7,_0x23449c))[_0x9684('0x47')](handleError(_0x38a3f7,null));};exports[_0x9684('0x48')]=function(_0x487ea9,_0xc57250){var _0x1cb8f6={'raw':!![],'where':{'id':_0x487ea9[_0x9684('0x49')]['id']}},_0x12b7db={};_0x12b7db['model']=_['keys'](db['CmHopperBlack'][_0x9684('0x30')]);_0x12b7db[_0x9684('0x33')]=_[_0x9684('0x34')](_0x487ea9['query']);_0x12b7db[_0x9684('0x35')]=_[_0x9684('0x36')](_0x12b7db[_0x9684('0x32')],_0x12b7db[_0x9684('0x33')]);_0x1cb8f6['attributes']=_[_0x9684('0x36')](_0x12b7db[_0x9684('0x32')],qs['fields'](_0x487ea9[_0x9684('0x33')]['fields']));_0x1cb8f6[_0x9684('0x37')]=_0x1cb8f6['attributes'][_0x9684('0x39')]?_0x1cb8f6[_0x9684('0x37')]:_0x12b7db[_0x9684('0x32')];if(_0x487ea9[_0x9684('0x33')][_0x9684('0x43')]){_0x1cb8f6[_0x9684('0x4a')]=[{'all':!![]}];}_0x1cb8f6=_['merge']({},_0x1cb8f6,_0x487ea9[_0x9684('0x4b')]);return db[_0x9684('0x42')]['find'](_0x1cb8f6)[_0x9684('0x45')](handleEntityNotFound(_0xc57250,null))[_0x9684('0x45')](respondWithResult(_0xc57250,null))[_0x9684('0x47')](handleError(_0xc57250,null));};exports[_0x9684('0x28')]=function(_0x53f89c,_0x4e4984){if(_0x53f89c['body']['id']){delete _0x53f89c['body']['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0x53f89c[_0x9684('0x49')]['id']}})['then'](handleEntityNotFound(_0x4e4984,null))[_0x9684('0x45')](saveUpdates(_0x53f89c[_0x9684('0x4c')],null))['then'](respondWithResult(_0x4e4984,null))['catch'](handleError(_0x4e4984,null));};exports[_0x9684('0x29')]=function(_0x3b106f,_0x39587c){return db['CmHopperBlack'][_0x9684('0x4d')]({'where':{'id':_0x3b106f[_0x9684('0x49')]['id']}})[_0x9684('0x45')](handleEntityNotFound(_0x39587c,null))[_0x9684('0x45')](removeEntity(_0x39587c,null))[_0x9684('0x47')](handleError(_0x39587c,null));};exports[_0x9684('0x4e')]=function(_0x1d3fa5,_0x889598){return db[_0x9684('0x42')][_0x9684('0x4e')]()[_0x9684('0x45')](respondWithResult(_0x889598,null))[_0x9684('0x47')](handleError(_0x889598,null));}; \ No newline at end of file +var _0xc7ca=['nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','CmHopperBlack','includeAll','findAll','rows','catch','show','params','fields','include','options','find','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','type','model','map','query','keys','intersection','attributes','length'];(function(_0x24b0e5,_0x5f3710){var _0x20378b=function(_0x144f47){while(--_0x144f47){_0x24b0e5['push'](_0x24b0e5['shift']());}};_0x20378b(++_0x5f3710);}(_0xc7ca,0x146));var _0xac7c=function(_0x443239,_0x4a4f31){_0x443239=_0x443239-0x0;var _0x2dd150=_0xc7ca[_0x443239];return _0x2dd150;};'use strict';var emlformat=require(_0xac7c('0x0'));var rimraf=require(_0xac7c('0x1'));var zipdir=require(_0xac7c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac7c('0x3'));var moment=require(_0xac7c('0x4'));var BPromise=require(_0xac7c('0x5'));var Mustache=require('mustache');var util=require(_0xac7c('0x6'));var path=require(_0xac7c('0x7'));var sox=require(_0xac7c('0x8'));var csv=require(_0xac7c('0x9'));var ejs=require(_0xac7c('0xa'));var fs=require('fs');var fs_extra=require(_0xac7c('0xb'));var _=require('lodash');var squel=require(_0xac7c('0xc'));var crypto=require(_0xac7c('0xd'));var jsforce=require(_0xac7c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xac7c('0x9'));var querystring=require(_0xac7c('0xf'));var Papa=require('papaparse');var Redis=require(_0xac7c('0x10'));var authService=require(_0xac7c('0x11'));var qs=require(_0xac7c('0x12'));var as=require(_0xac7c('0x13'));var hardwareService=require(_0xac7c('0x14'));var logger=require(_0xac7c('0x15'))(_0xac7c('0x16'));var utils=require(_0xac7c('0x17'));var config=require(_0xac7c('0x18'));var licenseUtil=require(_0xac7c('0x19'));var db=require(_0xac7c('0x1a'))['db'];function respondWithStatusCode(_0x131c90,_0x3572e0){_0x3572e0=_0x3572e0||0xcc;return function(_0xd0606b){if(_0xd0606b){return _0x131c90[_0xac7c('0x1b')](_0x3572e0);}return _0x131c90[_0xac7c('0x1c')](_0x3572e0)[_0xac7c('0x1d')]();};}function respondWithResult(_0xf82456,_0xa4bc99){_0xa4bc99=_0xa4bc99||0xc8;return function(_0x29b7a8){if(_0x29b7a8){return _0xf82456[_0xac7c('0x1c')](_0xa4bc99)['json'](_0x29b7a8);}};}function respondWithFilteredResult(_0x2f1b73,_0x5c648f){return function(_0x5f3ee5){if(_0x5f3ee5){var _0xd887b6=_0x5f3ee5[_0xac7c('0x1e')],_0x31a421=_0x5c648f[_0xac7c('0x1f')],_0x180d2c=_0x5c648f[_0xac7c('0x1f')]+_0x5c648f[_0xac7c('0x20')],_0x266bc8;if(_0x180d2c>=_0xd887b6){_0x180d2c=_0xd887b6;_0x266bc8=0xc8;}else{_0x266bc8=0xce;}_0x2f1b73['status'](_0x266bc8);return _0x2f1b73['set'](_0xac7c('0x21'),_0x31a421+'-'+_0x180d2c+'/'+_0xd887b6)[_0xac7c('0x22')](_0x5f3ee5);}return null;};}function patchUpdates(_0x5301d0){return function(_0x17cdbf){try{jsonpatch[_0xac7c('0x23')](_0x17cdbf,_0x5301d0,!![]);}catch(_0xdfcf74){return BPromise[_0xac7c('0x24')](_0xdfcf74);}return _0x17cdbf[_0xac7c('0x25')]();};}function saveUpdates(_0x52dfc8,_0x1102d7){return function(_0x4f0fbc){if(_0x4f0fbc){return _0x4f0fbc[_0xac7c('0x26')](_0x52dfc8)[_0xac7c('0x27')](function(_0x1dfdbd){return _0x1dfdbd;});}return null;};}function removeEntity(_0x4e7310,_0x27f967){return function(_0x19b2cb){if(_0x19b2cb){return _0x19b2cb[_0xac7c('0x28')]()[_0xac7c('0x27')](function(){_0x4e7310[_0xac7c('0x1c')](0xcc)[_0xac7c('0x1d')]();});}};}function handleEntityNotFound(_0x4b6741,_0x55c9dc){return function(_0x48a5a9){if(!_0x48a5a9){_0x4b6741[_0xac7c('0x1b')](0x194);}return _0x48a5a9;};}function handleError(_0x5d9390,_0x5443b6){_0x5443b6=_0x5443b6||0x1f4;return function(_0xc4db79){logger[_0xac7c('0x29')](_0xc4db79[_0xac7c('0x2a')]);if(_0xc4db79[_0xac7c('0x2b')]){delete _0xc4db79['name'];}_0x5d9390[_0xac7c('0x1c')](_0x5443b6)['send'](_0xc4db79);};}exports[_0xac7c('0x2c')]=function(_0x28f4bf,_0x122000){var _0x18a93d={},_0xb5f883={},_0x47a947={'count':0x0,'rows':[]};var _0x38f973=_['map'](db['CmHopperBlack'][_0xac7c('0x2d')],function(_0x37c44e){return{'name':_0x37c44e['fieldName'],'type':_0x37c44e[_0xac7c('0x2e')]['key']};});_0xb5f883[_0xac7c('0x2f')]=_[_0xac7c('0x30')](_0x38f973,_0xac7c('0x2b'));_0xb5f883[_0xac7c('0x31')]=_[_0xac7c('0x32')](_0x28f4bf[_0xac7c('0x31')]);_0xb5f883['filters']=_[_0xac7c('0x33')](_0xb5f883['model'],_0xb5f883[_0xac7c('0x31')]);_0x18a93d[_0xac7c('0x34')]=_['intersection'](_0xb5f883['model'],qs['fields'](_0x28f4bf[_0xac7c('0x31')]['fields']));_0x18a93d['attributes']=_0x18a93d[_0xac7c('0x34')][_0xac7c('0x35')]?_0x18a93d['attributes']:_0xb5f883[_0xac7c('0x2f')];if(!_0x28f4bf[_0xac7c('0x31')]['hasOwnProperty'](_0xac7c('0x36'))){_0x18a93d[_0xac7c('0x20')]=qs[_0xac7c('0x20')](_0x28f4bf[_0xac7c('0x31')]['limit']);_0x18a93d[_0xac7c('0x1f')]=qs[_0xac7c('0x1f')](_0x28f4bf['query'][_0xac7c('0x1f')]);}_0x18a93d[_0xac7c('0x37')]=qs[_0xac7c('0x38')](_0x28f4bf['query'][_0xac7c('0x38')]);_0x18a93d[_0xac7c('0x39')]=qs[_0xac7c('0x3a')](_[_0xac7c('0x3b')](_0x28f4bf[_0xac7c('0x31')],_0xb5f883[_0xac7c('0x3a')]),_0x38f973);if(_0x28f4bf[_0xac7c('0x31')][_0xac7c('0x3c')]){_0x18a93d['where']=_[_0xac7c('0x3d')](_0x18a93d[_0xac7c('0x39')],{'$or':_[_0xac7c('0x30')](_0x38f973,function(_0x364039){if(_0x364039['type']!==_0xac7c('0x3e')){var _0x3509bd={};_0x3509bd[_0x364039['name']]={'$like':'%'+_0x28f4bf[_0xac7c('0x31')][_0xac7c('0x3c')]+'%'};return _0x3509bd;}})});}_0x18a93d=_['merge']({},_0x18a93d,_0x28f4bf['options']);var _0x51c1a7={'where':_0x18a93d['where']};return db[_0xac7c('0x3f')][_0xac7c('0x1e')](_0x51c1a7)['then'](function(_0x10f5ac){_0x47a947[_0xac7c('0x1e')]=_0x10f5ac;if(_0x28f4bf[_0xac7c('0x31')][_0xac7c('0x40')]){_0x18a93d['include']=[{'all':!![]}];}return db[_0xac7c('0x3f')][_0xac7c('0x41')](_0x18a93d);})[_0xac7c('0x27')](function(_0x4303b6){_0x47a947[_0xac7c('0x42')]=_0x4303b6;return _0x47a947;})[_0xac7c('0x27')](respondWithFilteredResult(_0x122000,_0x18a93d))[_0xac7c('0x43')](handleError(_0x122000,null));};exports[_0xac7c('0x44')]=function(_0x2dab52,_0x3ed1a2){var _0x44696d={'raw':!![],'where':{'id':_0x2dab52[_0xac7c('0x45')]['id']}},_0x5765b={};_0x5765b[_0xac7c('0x2f')]=_[_0xac7c('0x32')](db[_0xac7c('0x3f')][_0xac7c('0x2d')]);_0x5765b[_0xac7c('0x31')]=_[_0xac7c('0x32')](_0x2dab52[_0xac7c('0x31')]);_0x5765b[_0xac7c('0x3a')]=_[_0xac7c('0x33')](_0x5765b[_0xac7c('0x2f')],_0x5765b[_0xac7c('0x31')]);_0x44696d['attributes']=_[_0xac7c('0x33')](_0x5765b[_0xac7c('0x2f')],qs[_0xac7c('0x46')](_0x2dab52[_0xac7c('0x31')][_0xac7c('0x46')]));_0x44696d[_0xac7c('0x34')]=_0x44696d[_0xac7c('0x34')][_0xac7c('0x35')]?_0x44696d[_0xac7c('0x34')]:_0x5765b['model'];if(_0x2dab52[_0xac7c('0x31')][_0xac7c('0x40')]){_0x44696d[_0xac7c('0x47')]=[{'all':!![]}];}_0x44696d=_['merge']({},_0x44696d,_0x2dab52[_0xac7c('0x48')]);return db[_0xac7c('0x3f')][_0xac7c('0x49')](_0x44696d)[_0xac7c('0x27')](handleEntityNotFound(_0x3ed1a2,null))[_0xac7c('0x27')](respondWithResult(_0x3ed1a2,null))[_0xac7c('0x43')](handleError(_0x3ed1a2,null));};exports[_0xac7c('0x26')]=function(_0x30c697,_0x5cb16e){if(_0x30c697[_0xac7c('0x4a')]['id']){delete _0x30c697[_0xac7c('0x4a')]['id'];}return db[_0xac7c('0x3f')]['find']({'where':{'id':_0x30c697[_0xac7c('0x45')]['id']}})[_0xac7c('0x27')](handleEntityNotFound(_0x5cb16e,null))[_0xac7c('0x27')](saveUpdates(_0x30c697[_0xac7c('0x4a')],null))[_0xac7c('0x27')](respondWithResult(_0x5cb16e,null))[_0xac7c('0x43')](handleError(_0x5cb16e,null));};exports[_0xac7c('0x28')]=function(_0x57b2e5,_0x16bbc4){return db['CmHopperBlack'][_0xac7c('0x49')]({'where':{'id':_0x57b2e5[_0xac7c('0x45')]['id']}})[_0xac7c('0x27')](handleEntityNotFound(_0x16bbc4,null))[_0xac7c('0x27')](removeEntity(_0x16bbc4,null))['catch'](handleError(_0x16bbc4,null));};exports[_0xac7c('0x4b')]=function(_0x599e53,_0x20ebbe){return db['CmHopperBlack'][_0xac7c('0x4b')]()['then'](respondWithResult(_0x20ebbe,null))['catch'](handleError(_0x20ebbe,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 2cb0d05..d93b878 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 _0xa881=['rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x105793,_0x3f9bdd){var _0x2acc9a=function(_0x1ff232){while(--_0x1ff232){_0x105793['push'](_0x105793['shift']());}};_0x2acc9a(++_0x3f9bdd);}(_0xa881,0x96));var _0x1a88=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa881[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x1a88('0x0'));var util=require(_0x1a88('0x1'));var logger=require(_0x1a88('0x2'))(_0x1a88('0x3'));var moment=require('moment');var BPromise=require(_0x1a88('0x4'));var rp=require(_0x1a88('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1a88('0x6'));var config=require('../../config/environment');var attributes=require(_0x1a88('0x7'));module[_0x1a88('0x8')]=function(_0x5a6654,_0x2fba5c){return _0x5a6654[_0x1a88('0x9')](_0x1a88('0xa'),attributes,{'tableName':_0x1a88('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2d6=['define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x397eda,_0x2439bd){var _0xe600c0=function(_0x209641){while(--_0x209641){_0x397eda['push'](_0x397eda['shift']());}};_0xe600c0(++_0x2439bd);}(_0xd2d6,0x1bb));var _0x6d2d=function(_0x26959c,_0x5e361f){_0x26959c=_0x26959c-0x0;var _0x5297e3=_0xd2d6[_0x26959c];return _0x5297e3;};'use strict';var _=require(_0x6d2d('0x0'));var util=require(_0x6d2d('0x1'));var logger=require(_0x6d2d('0x2'))(_0x6d2d('0x3'));var moment=require(_0x6d2d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d2d('0x5'));var rimraf=require(_0x6d2d('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0x33ee71,_0x31c007){return _0x33ee71[_0x6d2d('0x7')](_0x6d2d('0x8'),attributes,{'tableName':_0x6d2d('0x9'),'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 2457a9b..d8d5362 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 _0x0ecb=['request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','result','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','stringify','UpdateCmHopperBlack','catch','DestroyCmHopperBlack','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0x0ecb,0xf4));var _0xb0ec=function(_0x3bad26,_0x1cf013){_0x3bad26=_0x3bad26-0x0;var _0x42e1ff=_0x0ecb[_0x3bad26];return _0x42e1ff;};'use strict';var _=require(_0xb0ec('0x0'));var util=require(_0xb0ec('0x1'));var moment=require('moment');var BPromise=require(_0xb0ec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb0ec('0x3'));var db=require(_0xb0ec('0x4'))['db'];var utils=require(_0xb0ec('0x5'));var logger=require('../../config/logger')(_0xb0ec('0x6'));var config=require(_0xb0ec('0x7'));var jayson=require(_0xb0ec('0x8'));var client=jayson[_0xb0ec('0x9')][_0xb0ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x459d06,_0x2cd306,_0x5b0c5f){return new BPromise(function(_0x577b18,_0x38fa9e){return client[_0xb0ec('0xb')](_0x459d06,_0x5b0c5f)[_0xb0ec('0xc')](function(_0x8a0939){logger[_0xb0ec('0xd')](_0xb0ec('0xe'),_0x2cd306,_0xb0ec('0xf'));logger[_0xb0ec('0x10')](_0xb0ec('0x11'),_0x2cd306,_0xb0ec('0xf'),JSON['stringify'](_0x8a0939));if(_0x8a0939[_0xb0ec('0x12')]){if(_0x8a0939[_0xb0ec('0x12')][_0xb0ec('0x13')]===0x1f4){logger[_0xb0ec('0x12')](_0xb0ec('0xe'),_0x2cd306,_0x8a0939[_0xb0ec('0x12')][_0xb0ec('0x14')]);return _0x38fa9e(_0x8a0939[_0xb0ec('0x12')][_0xb0ec('0x14')]);}logger[_0xb0ec('0x12')](_0xb0ec('0xe'),_0x2cd306,_0x8a0939['error']['message']);return _0x577b18(_0x8a0939[_0xb0ec('0x12')][_0xb0ec('0x14')]);}else{logger[_0xb0ec('0xd')](_0xb0ec('0xe'),_0x2cd306,_0xb0ec('0xf'));_0x577b18(_0x8a0939[_0xb0ec('0x15')][_0xb0ec('0x14')]);}})['catch'](function(_0x3844c8){logger[_0xb0ec('0x12')](_0xb0ec('0xe'),_0x2cd306,_0x3844c8);_0x38fa9e(_0x3844c8);});});}exports[_0xb0ec('0x16')]=function(_0x3bd228){var _0x35fd8c=this;return new Promise(function(_0xd98dca,_0x2a3de5){return db[_0xb0ec('0x17')][_0xb0ec('0x18')]({'raw':_0x3bd228[_0xb0ec('0x19')]?_0x3bd228[_0xb0ec('0x19')][_0xb0ec('0x1a')]===undefined?!![]:![]:!![],'where':_0x3bd228['options']?_0x3bd228['options'][_0xb0ec('0x1b')]||null:null,'attributes':_0x3bd228[_0xb0ec('0x19')]?_0x3bd228['options'][_0xb0ec('0x1c')]||null:null,'limit':_0x3bd228[_0xb0ec('0x19')]?_0x3bd228[_0xb0ec('0x19')][_0xb0ec('0x1d')]||null:null,'include':_0x3bd228[_0xb0ec('0x19')]?_0x3bd228[_0xb0ec('0x19')][_0xb0ec('0x1e')]?_[_0xb0ec('0x1f')](_0x3bd228['options'][_0xb0ec('0x1e')],function(_0x289dfe){return{'model':db[_0x289dfe[_0xb0ec('0x20')]],'as':_0x289dfe['as'],'attributes':_0x289dfe[_0xb0ec('0x1c')],'include':_0x289dfe['include']?_['map'](_0x289dfe[_0xb0ec('0x1e')],function(_0x45e4d6){return{'model':db[_0x45e4d6[_0xb0ec('0x20')]],'as':_0x45e4d6['as'],'attributes':_0x45e4d6[_0xb0ec('0x1c')],'include':_0x45e4d6[_0xb0ec('0x1e')]?_[_0xb0ec('0x1f')](_0x45e4d6['include'],function(_0x357346){return{'model':db[_0x357346[_0xb0ec('0x20')]],'as':_0x357346['as'],'attributes':_0x357346[_0xb0ec('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb0ec('0xc')](function(_0x33c13a){logger[_0xb0ec('0xd')]('GetCmHopperBlack',_0x3bd228);logger['debug'](_0xb0ec('0x16'),_0x3bd228,JSON[_0xb0ec('0x21')](_0x33c13a));_0xd98dca(_0x33c13a);})['catch'](function(_0x1fc1cb){logger[_0xb0ec('0x12')](_0xb0ec('0x16'),_0x1fc1cb[_0xb0ec('0x14')],_0x3bd228);_0x2a3de5(_0x35fd8c[_0xb0ec('0x12')](0x1f4,_0x1fc1cb[_0xb0ec('0x14')]));});});};exports[_0xb0ec('0x22')]=function(_0x385910){var _0x220115=this;return new Promise(function(_0x3d7cce,_0x50a10e){return db[_0xb0ec('0x17')]['update'](_0x385910['body'],{'raw':_0x385910['options']?_0x385910[_0xb0ec('0x19')][_0xb0ec('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x385910['options']?_0x385910[_0xb0ec('0x19')][_0xb0ec('0x1b')]||null:null,'attributes':_0x385910[_0xb0ec('0x19')]?_0x385910[_0xb0ec('0x19')]['attributes']||null:null,'limit':_0x385910['options']?_0x385910[_0xb0ec('0x19')]['limit']||null:null})[_0xb0ec('0xc')](function(_0x241ec6){logger[_0xb0ec('0xd')]('UpdateCmHopperBlack',_0x385910);logger[_0xb0ec('0x10')]('UpdateCmHopperBlack',_0x385910,JSON[_0xb0ec('0x21')](_0x241ec6));_0x3d7cce(_0x241ec6);})[_0xb0ec('0x23')](function(_0x381eb6){logger['error'](_0xb0ec('0x22'),_0x381eb6[_0xb0ec('0x14')],_0x385910);_0x50a10e(_0x220115[_0xb0ec('0x12')](0x1f4,_0x381eb6[_0xb0ec('0x14')]));});});};exports['DestroyCmHopperBlack']=function(_0x4a29f2){var _0x34f877=this;return new Promise(function(_0x4d50ea,_0x440d6b){return db[_0xb0ec('0x17')]['destroy']({'where':_0x4a29f2[_0xb0ec('0x19')]?_0x4a29f2[_0xb0ec('0x19')][_0xb0ec('0x1b')]||null:null})[_0xb0ec('0xc')](function(_0x5050a6){logger[_0xb0ec('0xd')](_0xb0ec('0x24'),_0x4a29f2);logger['debug'](_0xb0ec('0x24'),_0x4a29f2,JSON[_0xb0ec('0x21')](_0x5050a6));_0x4d50ea(_0x5050a6);})[_0xb0ec('0x23')](function(_0x516ac9){logger[_0xb0ec('0x12')]('DestroyCmHopperBlack',_0x516ac9[_0xb0ec('0x14')],_0x4a29f2);_0x440d6b(_0x34f877[_0xb0ec('0x12')](0x1f4,_0x516ac9['message']));});});}; \ No newline at end of file +var _0x5318=['where','attributes','limit','include','model','map','then','debug','stringify','UpdateCmHopperBlack','update','raw','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','request\x20sent','error','code','CmHopperBlack,\x20%s,\x20%s','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options'];(function(_0xa6a3b1,_0x5ccc11){var _0x4054ff=function(_0x4e55f4){while(--_0x4e55f4){_0xa6a3b1['push'](_0xa6a3b1['shift']());}};_0x4054ff(++_0x5ccc11);}(_0x5318,0x110));var _0x8531=function(_0x40bc32,_0x428c83){_0x40bc32=_0x40bc32-0x0;var _0x2351e3=_0x5318[_0x40bc32];return _0x2351e3;};'use strict';var _=require(_0x8531('0x0'));var util=require(_0x8531('0x1'));var moment=require(_0x8531('0x2'));var BPromise=require(_0x8531('0x3'));var rs=require(_0x8531('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8531('0x5'))['db'];var utils=require(_0x8531('0x6'));var logger=require('../../config/logger')(_0x8531('0x7'));var config=require(_0x8531('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8531('0x9')][_0x8531('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41696d,_0x4f78a9,_0x15cc1a){return new BPromise(function(_0x2812fe,_0x250573){return client[_0x8531('0xb')](_0x41696d,_0x15cc1a)['then'](function(_0x3616be){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x4f78a9,_0x8531('0xc'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x4f78a9,_0x8531('0xc'),JSON['stringify'](_0x3616be));if(_0x3616be[_0x8531('0xd')]){if(_0x3616be[_0x8531('0xd')][_0x8531('0xe')]===0x1f4){logger['error'](_0x8531('0xf'),_0x4f78a9,_0x3616be[_0x8531('0xd')][_0x8531('0x10')]);return _0x250573(_0x3616be[_0x8531('0xd')][_0x8531('0x10')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x4f78a9,_0x3616be[_0x8531('0xd')][_0x8531('0x10')]);return _0x2812fe(_0x3616be[_0x8531('0xd')][_0x8531('0x10')]);}else{logger[_0x8531('0x11')](_0x8531('0xf'),_0x4f78a9,_0x8531('0xc'));_0x2812fe(_0x3616be[_0x8531('0x12')]['message']);}})[_0x8531('0x13')](function(_0x54494e){logger[_0x8531('0xd')](_0x8531('0xf'),_0x4f78a9,_0x54494e);_0x250573(_0x54494e);});});}exports[_0x8531('0x14')]=function(_0x57741f){var _0xc2ec3b=this;return new Promise(function(_0xd6e2a7,_0x2e612e){return db[_0x8531('0x15')][_0x8531('0x16')]({'raw':_0x57741f['options']?_0x57741f['options']['raw']===undefined?!![]:![]:!![],'where':_0x57741f[_0x8531('0x17')]?_0x57741f[_0x8531('0x17')][_0x8531('0x18')]||null:null,'attributes':_0x57741f['options']?_0x57741f[_0x8531('0x17')][_0x8531('0x19')]||null:null,'limit':_0x57741f[_0x8531('0x17')]?_0x57741f[_0x8531('0x17')][_0x8531('0x1a')]||null:null,'include':_0x57741f[_0x8531('0x17')]?_0x57741f[_0x8531('0x17')][_0x8531('0x1b')]?_['map'](_0x57741f['options']['include'],function(_0x1ece1e){return{'model':db[_0x1ece1e[_0x8531('0x1c')]],'as':_0x1ece1e['as'],'attributes':_0x1ece1e['attributes'],'include':_0x1ece1e[_0x8531('0x1b')]?_[_0x8531('0x1d')](_0x1ece1e['include'],function(_0x1e8c3e){return{'model':db[_0x1e8c3e['model']],'as':_0x1e8c3e['as'],'attributes':_0x1e8c3e[_0x8531('0x19')],'include':_0x1e8c3e['include']?_[_0x8531('0x1d')](_0x1e8c3e[_0x8531('0x1b')],function(_0x564fbd){return{'model':db[_0x564fbd['model']],'as':_0x564fbd['as'],'attributes':_0x564fbd[_0x8531('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8531('0x1e')](function(_0x4e9632){logger[_0x8531('0x11')](_0x8531('0x14'),_0x57741f);logger[_0x8531('0x1f')](_0x8531('0x14'),_0x57741f,JSON[_0x8531('0x20')](_0x4e9632));_0xd6e2a7(_0x4e9632);})[_0x8531('0x13')](function(_0x3d46bf){logger[_0x8531('0xd')](_0x8531('0x14'),_0x3d46bf[_0x8531('0x10')],_0x57741f);_0x2e612e(_0xc2ec3b[_0x8531('0xd')](0x1f4,_0x3d46bf['message']));});});};exports[_0x8531('0x21')]=function(_0x24130b){var _0x2e160d=this;return new Promise(function(_0x3e7e43,_0x52c49){return db[_0x8531('0x15')][_0x8531('0x22')](_0x24130b['body'],{'raw':_0x24130b[_0x8531('0x17')]?_0x24130b[_0x8531('0x17')][_0x8531('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24130b[_0x8531('0x17')]?_0x24130b['options'][_0x8531('0x18')]||null:null,'attributes':_0x24130b[_0x8531('0x17')]?_0x24130b[_0x8531('0x17')]['attributes']||null:null,'limit':_0x24130b[_0x8531('0x17')]?_0x24130b['options']['limit']||null:null})[_0x8531('0x1e')](function(_0x52d8f3){logger['info']('UpdateCmHopperBlack',_0x24130b);logger[_0x8531('0x1f')](_0x8531('0x21'),_0x24130b,JSON[_0x8531('0x20')](_0x52d8f3));_0x3e7e43(_0x52d8f3);})[_0x8531('0x13')](function(_0x1a8a04){logger['error'](_0x8531('0x21'),_0x1a8a04[_0x8531('0x10')],_0x24130b);_0x52c49(_0x2e160d[_0x8531('0xd')](0x1f4,_0x1a8a04['message']));});});};exports['DestroyCmHopperBlack']=function(_0x4cbb42){var _0x2f102f=this;return new Promise(function(_0x5a329b,_0xd87753){return db[_0x8531('0x15')]['destroy']({'where':_0x4cbb42[_0x8531('0x17')]?_0x4cbb42[_0x8531('0x17')][_0x8531('0x18')]||null:null})['then'](function(_0x219402){logger[_0x8531('0x11')](_0x8531('0x24'),_0x4cbb42);logger[_0x8531('0x1f')](_0x8531('0x24'),_0x4cbb42,JSON[_0x8531('0x20')](_0x219402));_0x5a329b(_0x219402);})[_0x8531('0x13')](function(_0x729847){logger[_0x8531('0xd')](_0x8531('0x24'),_0x729847['message'],_0x4cbb42);_0xd87753(_0x2f102f['error'](0x1f4,_0x729847['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 1903d75..ff1a1f1 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 _0xfd20=['/:id','show','put','update','destroy','exports','util','express','Router','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','describe'];(function(_0x30f910,_0x8e3a23){var _0x836515=function(_0x1742eb){while(--_0x1742eb){_0x30f910['push'](_0x30f910['shift']());}};_0x836515(++_0x8e3a23);}(_0xfd20,0x66));var _0x0fd2=function(_0x3f0bfc,_0x104792){_0x3f0bfc=_0x3f0bfc-0x0;var _0x52b0c3=_0xfd20[_0x3f0bfc];return _0x52b0c3;};'use strict';var multer=require('multer');var util=require(_0x0fd2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0fd2('0x1'));var router=express[_0x0fd2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0fd2('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0fd2('0x4'));var controller=require(_0x0fd2('0x5'));router[_0x0fd2('0x6')]('/',auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x8')]);router['get']('/describe',auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x9')]);router[_0x0fd2('0x6')](_0x0fd2('0xa'),auth[_0x0fd2('0x7')](),controller[_0x0fd2('0xb')]);router[_0x0fd2('0xc')]('/:id',auth[_0x0fd2('0x7')](),controller[_0x0fd2('0xd')]);router['delete'](_0x0fd2('0xa'),auth['isAuthenticated'](),controller[_0x0fd2('0xe')]);module[_0x0fd2('0xf')]=router; \ No newline at end of file +var _0xef17=['show','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','isAuthenticated','get','describe'];(function(_0x1df245,_0x43a7b3){var _0x49bb17=function(_0x41a4db){while(--_0x41a4db){_0x1df245['push'](_0x1df245['shift']());}};_0x49bb17(++_0x43a7b3);}(_0xef17,0x136));var _0x7ef1=function(_0x3025b6,_0x48d407){_0x3025b6=_0x3025b6-0x0;var _0x53eae5=_0xef17[_0x3025b6];return _0x53eae5;};'use strict';var multer=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var path=require(_0x7ef1('0x2'));var timeout=require(_0x7ef1('0x3'));var express=require(_0x7ef1('0x4'));var router=express[_0x7ef1('0x5')]();var fs_extra=require(_0x7ef1('0x6'));var auth=require(_0x7ef1('0x7'));var interaction=require(_0x7ef1('0x8'));var config=require('../../config/environment');var controller=require(_0x7ef1('0x9'));router['get']('/',auth[_0x7ef1('0xa')](),controller['index']);router[_0x7ef1('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x7ef1('0xc')]);router[_0x7ef1('0xb')]('/:id',auth[_0x7ef1('0xa')](),controller[_0x7ef1('0xd')]);router[_0x7ef1('0xe')](_0x7ef1('0xf'),auth[_0x7ef1('0xa')](),controller[_0x7ef1('0x10')]);router[_0x7ef1('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x7ef1('0x12')]);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 7a61ab3..e47a095 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 _0x5d60=['endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5d60,0x126));var _0x05d6=function(_0x5600ea,_0x2867e8){_0x5600ea=_0x5600ea-0x0;var _0x40b5fd=_0x5d60[_0x5600ea];return _0x40b5fd;};'use strict';var Sequelize=require(_0x05d6('0x0'));var moment=require(_0x05d6('0x1'));module[_0x05d6('0x2')]={'state':{'type':Sequelize[_0x05d6('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x05d6('0x4')]},'scheduledat':{'type':Sequelize[_0x05d6('0x5')]},'countbusyretry':{'type':Sequelize[_0x05d6('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x05d6('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x05d6('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x05d6('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x05d6('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x05d6('0x4')]},'calleridname':{'type':Sequelize[_0x05d6('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x05d6('0x5')]},'answertime':{'type':Sequelize[_0x05d6('0x5')]},'droptime':{'type':Sequelize[_0x05d6('0x5')]},'endtime':{'type':Sequelize[_0x05d6('0x5')]},'ringtime':{'type':Sequelize[_0x05d6('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x05d6('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x05d6('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x05d6('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x05d6('0x4')]},'campaign':{'type':Sequelize[_0x05d6('0x4')]},'campaigntype':{'type':Sequelize[_0x05d6('0x4')]},'membername':{'type':Sequelize[_0x05d6('0x4')]},'reason':{'type':Sequelize[_0x05d6('0x4')]},'disposition':{'type':Sequelize[_0x05d6('0x4')]},'secondDisposition':{'type':Sequelize[_0x05d6('0x4')]},'thirdDisposition':{'type':Sequelize[_0x05d6('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x169ff8){var _0x21963c=this['getDataValue'](_0x05d6('0x6'));if(_0x21963c&&_0x169ff8){this[_0x05d6('0x7')](_0x05d6('0x8'),moment(_0x169ff8)[_0x05d6('0x9')](moment(_0x21963c),_0x05d6('0xa')));}return this[_0x05d6('0x7')]('dispositionat',_0x169ff8);}},'amd':{'type':Sequelize[_0x05d6('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x05d6('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x05d6('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x05d6('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x05d6('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x05d6('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x05d6('0x5')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x05d6('0x5')]},'recallme':{'type':Sequelize[_0x05d6('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x05d6('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x05d6('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x05d6('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x05d6('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x05d6('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x667d=['followuptime','diff','setDataValue','dispositionat','BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','getDataValue','endtime'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x667d,0x1b5));var _0xd667=function(_0x3a2aa1,_0x56afcb){_0x3a2aa1=_0x3a2aa1-0x0;var _0x15c7ea=_0x667d[_0x3a2aa1];return _0x15c7ea;};'use strict';var Sequelize=require(_0xd667('0x0'));var moment=require(_0xd667('0x1'));module['exports']={'state':{'type':Sequelize[_0xd667('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xd667('0x3')]},'scheduledat':{'type':Sequelize[_0xd667('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd667('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd667('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd667('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xd667('0x3')]},'originatecalleridname':{'type':Sequelize[_0xd667('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd667('0x3')]},'starttime':{'type':Sequelize[_0xd667('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xd667('0x4')]},'droptime':{'type':Sequelize[_0xd667('0x4')]},'endtime':{'type':Sequelize[_0xd667('0x4')]},'ringtime':{'type':Sequelize[_0xd667('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd667('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd667('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd667('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd667('0x3')]},'campaign':{'type':Sequelize[_0xd667('0x3')]},'campaigntype':{'type':Sequelize[_0xd667('0x3')]},'membername':{'type':Sequelize[_0xd667('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xd667('0x3')]},'secondDisposition':{'type':Sequelize[_0xd667('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd667('0x3')]},'dispositionat':{'type':Sequelize[_0xd667('0x4')],'set':function(_0x9139b7){var _0x3166f6=this[_0xd667('0x5')](_0xd667('0x6'));if(_0x3166f6&&_0x9139b7){this['setDataValue'](_0xd667('0x7'),moment(_0x9139b7)[_0xd667('0x8')](moment(_0x3166f6),'seconds'));}return this[_0xd667('0x9')](_0xd667('0xa'),_0x9139b7);}},'amd':{'type':Sequelize[_0xd667('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xd667('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xd667('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xd667('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xd667('0x4')]},'callback':{'type':Sequelize[_0xd667('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd667('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xd667('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xd667('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xd667('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd667('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd667('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd667('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index e9b1c9b..d020037 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 _0x4e7c=['`state`\x20=\x2022,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x208,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','fromQuery','phone','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','from','cm_hopper','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','into','CampaignId','ANY_VALUE(calleridnum)','scheduledAt','ANY_VALUE(CampaignId)','calleridnum','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','sendStatus','stack','name','send','index','CmHopperFinal','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','length','find','catch','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4e7c,0x1a8));var _0xc4e7=function(_0x30fa50,_0x13155b){_0x30fa50=_0x30fa50-0x0;var _0x59d856=_0x4e7c[_0x30fa50];return _0x59d856;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc4e7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc4e7('0x1'));var BPromise=require(_0xc4e7('0x2'));var Mustache=require('mustache');var util=require(_0xc4e7('0x3'));var path=require(_0xc4e7('0x4'));var sox=require(_0xc4e7('0x5'));var csv=require(_0xc4e7('0x6'));var ejs=require(_0xc4e7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc4e7('0x8'));var squel=require('squel');var crypto=require(_0xc4e7('0x9'));var jsforce=require(_0xc4e7('0xa'));var deskjs=require(_0xc4e7('0xb'));var toCsv=require(_0xc4e7('0x6'));var querystring=require(_0xc4e7('0xc'));var Papa=require(_0xc4e7('0xd'));var Redis=require('ioredis');var authService=require(_0xc4e7('0xe'));var qs=require(_0xc4e7('0xf'));var as=require(_0xc4e7('0x10'));var hardwareService=require(_0xc4e7('0x11'));var logger=require('../../config/logger')(_0xc4e7('0x12'));var utils=require(_0xc4e7('0x13'));var config=require(_0xc4e7('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fe03d,_0x2b8bab){_0x2b8bab=_0x2b8bab||0xcc;return function(_0x2a3937){if(_0x2a3937){return _0x3fe03d['sendStatus'](_0x2b8bab);}return _0x3fe03d[_0xc4e7('0x15')](_0x2b8bab)[_0xc4e7('0x16')]();};}function respondWithResult(_0x504beb,_0x26eb3a){_0x26eb3a=_0x26eb3a||0xc8;return function(_0x372c4a){if(_0x372c4a){return _0x504beb[_0xc4e7('0x15')](_0x26eb3a)[_0xc4e7('0x17')](_0x372c4a);}};}function respondWithFilteredResult(_0x20d148,_0xf0b130){return function(_0x307cb3){if(_0x307cb3){var _0x539ffc=_0x307cb3[_0xc4e7('0x18')],_0x16c99a=_0xf0b130[_0xc4e7('0x19')],_0x5efe31=_0xf0b130[_0xc4e7('0x19')]+_0xf0b130[_0xc4e7('0x1a')],_0x4a147a;if(_0x5efe31>=_0x539ffc){_0x5efe31=_0x539ffc;_0x4a147a=0xc8;}else{_0x4a147a=0xce;}_0x20d148[_0xc4e7('0x15')](_0x4a147a);return _0x20d148[_0xc4e7('0x1b')](_0xc4e7('0x1c'),_0x16c99a+'-'+_0x5efe31+'/'+_0x539ffc)['json'](_0x307cb3);}return null;};}function patchUpdates(_0x3c19f1){return function(_0x38ce77){try{jsonpatch['apply'](_0x38ce77,_0x3c19f1,!![]);}catch(_0x382b48){return BPromise[_0xc4e7('0x1d')](_0x382b48);}return _0x38ce77['save']();};}function saveUpdates(_0x994a4e,_0x16e388){return function(_0x51094f){if(_0x51094f){return _0x51094f[_0xc4e7('0x1e')](_0x994a4e)[_0xc4e7('0x1f')](function(_0x3650ac){return _0x3650ac;});}return null;};}function removeEntity(_0x108f5d,_0x6f41c2){return function(_0x34012b){if(_0x34012b){return _0x34012b[_0xc4e7('0x20')]()[_0xc4e7('0x1f')](function(){_0x108f5d['status'](0xcc)[_0xc4e7('0x16')]();});}};}function handleEntityNotFound(_0xd59c92,_0xd44e8c){return function(_0x24bc46){if(!_0x24bc46){_0xd59c92[_0xc4e7('0x21')](0x194);}return _0x24bc46;};}function handleError(_0x2e03c2,_0x3ed9e8){_0x3ed9e8=_0x3ed9e8||0x1f4;return function(_0x322020){logger['error'](_0x322020[_0xc4e7('0x22')]);if(_0x322020[_0xc4e7('0x23')]){delete _0x322020['name'];}_0x2e03c2[_0xc4e7('0x15')](_0x3ed9e8)[_0xc4e7('0x24')](_0x322020);};}exports[_0xc4e7('0x25')]=function(_0x5e9831,_0x166019){var _0x272d5a={},_0x4f0e48={},_0x592bb8={'count':0x0,'rows':[]};var _0x428f4e=_['map'](db[_0xc4e7('0x26')]['rawAttributes'],function(_0x456192){return{'name':_0x456192[_0xc4e7('0x27')],'type':_0x456192['type'][_0xc4e7('0x28')]};});_0x4f0e48[_0xc4e7('0x29')]=_[_0xc4e7('0x2a')](_0x428f4e,_0xc4e7('0x23'));_0x4f0e48[_0xc4e7('0x2b')]=_[_0xc4e7('0x2c')](_0x5e9831[_0xc4e7('0x2b')]);_0x4f0e48[_0xc4e7('0x2d')]=_['intersection'](_0x4f0e48['model'],_0x4f0e48[_0xc4e7('0x2b')]);_0x272d5a[_0xc4e7('0x2e')]=_[_0xc4e7('0x2f')](_0x4f0e48['model'],qs['fields'](_0x5e9831[_0xc4e7('0x2b')][_0xc4e7('0x30')]));_0x272d5a[_0xc4e7('0x2e')]=_0x272d5a[_0xc4e7('0x2e')]['length']?_0x272d5a[_0xc4e7('0x2e')]:_0x4f0e48[_0xc4e7('0x29')];if(!_0x5e9831[_0xc4e7('0x2b')][_0xc4e7('0x31')](_0xc4e7('0x32'))){_0x272d5a['limit']=qs['limit'](_0x5e9831[_0xc4e7('0x2b')]['limit']);_0x272d5a[_0xc4e7('0x19')]=qs[_0xc4e7('0x19')](_0x5e9831['query']['offset']);}_0x272d5a['order']=qs[_0xc4e7('0x33')](_0x5e9831['query']['sort']);_0x272d5a[_0xc4e7('0x34')]=qs[_0xc4e7('0x2d')](_[_0xc4e7('0x35')](_0x5e9831[_0xc4e7('0x2b')],_0x4f0e48[_0xc4e7('0x2d')]),_0x428f4e);if(_0x5e9831['query']['filter']){_0x272d5a[_0xc4e7('0x34')]=_[_0xc4e7('0x36')](_0x272d5a[_0xc4e7('0x34')],{'$or':_['map'](_0x428f4e,function(_0x8c6248){if(_0x8c6248['type']!==_0xc4e7('0x37')){var _0x104af4={};_0x104af4[_0x8c6248[_0xc4e7('0x23')]]={'$like':'%'+_0x5e9831[_0xc4e7('0x2b')][_0xc4e7('0x38')]+'%'};return _0x104af4;}})});}_0x272d5a=_['merge']({},_0x272d5a,_0x5e9831[_0xc4e7('0x39')]);var _0x561981={'where':_0x272d5a[_0xc4e7('0x34')]};return db[_0xc4e7('0x26')][_0xc4e7('0x18')](_0x561981)[_0xc4e7('0x1f')](function(_0x4e2661){_0x592bb8[_0xc4e7('0x18')]=_0x4e2661;if(_0x5e9831[_0xc4e7('0x2b')][_0xc4e7('0x3a')]){_0x272d5a[_0xc4e7('0x3b')]=[{'all':!![]}];}return db[_0xc4e7('0x26')]['findAll'](_0x272d5a);})[_0xc4e7('0x1f')](function(_0x5dd8d4){_0x592bb8[_0xc4e7('0x3c')]=_0x5dd8d4;return _0x592bb8;})['then'](respondWithFilteredResult(_0x166019,_0x272d5a))['catch'](handleError(_0x166019,null));};exports[_0xc4e7('0x3d')]=function(_0x1d1ab3,_0x39a3c2){var _0x2255db={'raw':!![],'where':{'id':_0x1d1ab3[_0xc4e7('0x3e')]['id']}},_0x2c8236={};_0x2c8236[_0xc4e7('0x29')]=_[_0xc4e7('0x2c')](db[_0xc4e7('0x26')]['rawAttributes']);_0x2c8236['query']=_[_0xc4e7('0x2c')](_0x1d1ab3['query']);_0x2c8236[_0xc4e7('0x2d')]=_['intersection'](_0x2c8236[_0xc4e7('0x29')],_0x2c8236[_0xc4e7('0x2b')]);_0x2255db[_0xc4e7('0x2e')]=_[_0xc4e7('0x2f')](_0x2c8236[_0xc4e7('0x29')],qs['fields'](_0x1d1ab3[_0xc4e7('0x2b')][_0xc4e7('0x30')]));_0x2255db[_0xc4e7('0x2e')]=_0x2255db[_0xc4e7('0x2e')][_0xc4e7('0x3f')]?_0x2255db[_0xc4e7('0x2e')]:_0x2c8236[_0xc4e7('0x29')];if(_0x1d1ab3[_0xc4e7('0x2b')][_0xc4e7('0x3a')]){_0x2255db['include']=[{'all':!![]}];}_0x2255db=_['merge']({},_0x2255db,_0x1d1ab3['options']);return db[_0xc4e7('0x26')][_0xc4e7('0x40')](_0x2255db)['then'](handleEntityNotFound(_0x39a3c2,null))['then'](respondWithResult(_0x39a3c2,null))[_0xc4e7('0x41')](handleError(_0x39a3c2,null));};exports['describe']=function(_0x2c4df4,_0xabf4d){return db[_0xc4e7('0x26')]['describe']()[_0xc4e7('0x1f')](respondWithResult(_0xabf4d,null))[_0xc4e7('0x41')](handleError(_0xabf4d,null));};exports['update']=function(_0x51bacb,_0x1abddd){if(_0x51bacb[_0xc4e7('0x42')][_0xc4e7('0x43')]){delete _0x51bacb['body'][_0xc4e7('0x43')];}return db[_0xc4e7('0x26')]['find']({'where':{'uniqueid':_0x51bacb[_0xc4e7('0x3e')]['id']}})[_0xc4e7('0x1f')](handleEntityNotFound(_0x1abddd,null))[_0xc4e7('0x1f')](saveUpdates(_0x51bacb[_0xc4e7('0x42')],null))[_0xc4e7('0x1f')](respondWithResult(_0x1abddd,null))[_0xc4e7('0x41')](handleError(_0x1abddd,null));};exports[_0xc4e7('0x44')]=function(_0x2c9529,_0x3acd6c,_0x5ec65a){return db[_0xc4e7('0x26')][_0xc4e7('0x45')]({'raw':![],'where':{'VoiceQueueId':_0x2c9529[_0xc4e7('0x3e')]['id']},'attributes':[[db[_0xc4e7('0x46')]['fn'](_0xc4e7('0x47'),db[_0xc4e7('0x46')]['fn']('IF',db[_0xc4e7('0x46')]['literal'](_0xc4e7('0x48')))),_0xc4e7('0x49')],[db[_0xc4e7('0x46')]['fn'](_0xc4e7('0x47'),db['sequelize']['fn']('IF',db[_0xc4e7('0x46')][_0xc4e7('0x4a')](_0xc4e7('0x4b')))),_0xc4e7('0x4c')],[db['sequelize']['fn'](_0xc4e7('0x47'),db['sequelize']['fn']('IF',db[_0xc4e7('0x46')][_0xc4e7('0x4a')](_0xc4e7('0x4d')))),_0xc4e7('0x4e')],[db[_0xc4e7('0x46')]['fn'](_0xc4e7('0x47'),db['sequelize']['fn']('IF',db[_0xc4e7('0x46')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xc4e7('0x4f')],[db[_0xc4e7('0x46')]['fn'](_0xc4e7('0x47'),db[_0xc4e7('0x46')]['fn']('IF',db[_0xc4e7('0x46')]['literal'](_0xc4e7('0x50')))),_0xc4e7('0x51')],[db['sequelize']['fn'](_0xc4e7('0x47'),db[_0xc4e7('0x46')]['fn']('IF',db[_0xc4e7('0x46')][_0xc4e7('0x4a')](_0xc4e7('0x52')))),_0xc4e7('0x53')],[db[_0xc4e7('0x46')]['fn'](_0xc4e7('0x47'),db[_0xc4e7('0x46')]['fn']('IF',db[_0xc4e7('0x46')]['literal'](_0xc4e7('0x54')))),'reCallContacts'],[db[_0xc4e7('0x46')]['fn'](_0xc4e7('0x47'),db[_0xc4e7('0x46')]['fn']('IF',db[_0xc4e7('0x46')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0xc4e7('0x55')]]})[_0xc4e7('0x1f')](handleEntityNotFound(_0x3acd6c,null))[_0xc4e7('0x1f')](respondWithResult(_0x3acd6c,null))['catch'](handleError(_0x3acd6c,null));};exports[_0xc4e7('0x56')]=function(_0x24c746,_0x4f428f,_0x3f7f46){return db[_0xc4e7('0x26')]['findAll']({'raw':![],'where':{'CampaignId':_0x24c746[_0xc4e7('0x3e')]['id']},'attributes':[[db[_0xc4e7('0x46')]['fn'](_0xc4e7('0x47'),db['sequelize']['fn']('IF',db[_0xc4e7('0x46')][_0xc4e7('0x4a')](_0xc4e7('0x48')))),_0xc4e7('0x49')],[db['sequelize']['fn'](_0xc4e7('0x47'),db['sequelize']['fn']('IF',db[_0xc4e7('0x46')][_0xc4e7('0x4a')]('`state`\x20=\x203,\x201,\x20null'))),_0xc4e7('0x4c')],[db[_0xc4e7('0x46')]['fn']('COUNT',db[_0xc4e7('0x46')]['fn']('IF',db[_0xc4e7('0x46')][_0xc4e7('0x4a')](_0xc4e7('0x4d')))),_0xc4e7('0x4e')],[db[_0xc4e7('0x46')]['fn'](_0xc4e7('0x47'),db[_0xc4e7('0x46')]['fn']('IF',db['sequelize'][_0xc4e7('0x4a')](_0xc4e7('0x57')))),'congestionContacts'],[db[_0xc4e7('0x46')]['fn']('COUNT',db[_0xc4e7('0x46')]['fn']('IF',db[_0xc4e7('0x46')][_0xc4e7('0x4a')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xc4e7('0x51')],[db['sequelize']['fn'](_0xc4e7('0x47'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xc4e7('0x52')))),_0xc4e7('0x53')],[db[_0xc4e7('0x46')]['fn'](_0xc4e7('0x47'),db['sequelize']['fn']('IF',db[_0xc4e7('0x46')][_0xc4e7('0x4a')](_0xc4e7('0x54')))),_0xc4e7('0x58')],[db[_0xc4e7('0x46')]['fn'](_0xc4e7('0x47'),db[_0xc4e7('0x46')]['fn']('IF',db[_0xc4e7('0x46')][_0xc4e7('0x4a')](_0xc4e7('0x59')))),'answeringMachine']]})[_0xc4e7('0x1f')](handleEntityNotFound(_0x4f428f,null))[_0xc4e7('0x1f')](respondWithResult(_0x4f428f,null))[_0xc4e7('0x41')](handleError(_0x4f428f,null));};exports[_0xc4e7('0x5a')]=function(_0x2e0433,_0x50db01,_0x183cc7){return db[_0xc4e7('0x5b')][_0xc4e7('0x40')]({'where':{'id':_0x2e0433[_0xc4e7('0x3e')]['id']}})[_0xc4e7('0x1f')](handleEntityNotFound(_0x50db01,null))['then'](function(_0x4f0e54){var _0xa07c97;if(_0x4f0e54){_0xa07c97=squel['insert']()['into']('cm_hopper')[_0xc4e7('0x5c')]([_0xc4e7('0x5d'),'scheduledAt',_0xc4e7('0x5e'),_0xc4e7('0x5f'),_0xc4e7('0x60'),_0xc4e7('0x61'),_0xc4e7('0x62')],squel[_0xc4e7('0x63')]()[_0xc4e7('0x64')]('ANY_VALUE(calleridnum)',_0xc4e7('0x5d'))[_0xc4e7('0x64')](_0xc4e7('0x65'),'scheduledAt')['field'](_0xc4e7('0x66'),'ContactId')[_0xc4e7('0x64')](_0xc4e7('0x67'),'ListId')[_0xc4e7('0x64')](_0xc4e7('0x68'),_0xc4e7('0x60'))['field']('NOW()',_0xc4e7('0x61'))[_0xc4e7('0x64')](_0xc4e7('0x65'),_0xc4e7('0x62'))['from'](_0xc4e7('0x69'))[_0xc4e7('0x34')](_0xc4e7('0x6a'),_0x2e0433[_0xc4e7('0x3e')]['id'][_0xc4e7('0x6b')]())[_0xc4e7('0x34')](_0xc4e7('0x6c'),_0x2e0433[_0xc4e7('0x42')][_0xc4e7('0x6d')]['toString']())[_0xc4e7('0x34')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xc4e7('0x34')](_0xc4e7('0x6e'),squel['select']()[_0xc4e7('0x64')](_0xc4e7('0x5d'))[_0xc4e7('0x6f')](_0xc4e7('0x70'))[_0xc4e7('0x34')]('VoiceQueueId\x20=\x20?',_0x2e0433[_0xc4e7('0x3e')]['id'][_0xc4e7('0x6b')]()))[_0xc4e7('0x34')](_0xc4e7('0x6e'),squel['select']()[_0xc4e7('0x64')]('calleridnum')['from'](_0xc4e7('0x69'))[_0xc4e7('0x34')](_0xc4e7('0x6a'),_0x2e0433['params']['id']['toString']())['where'](_0xc4e7('0x71')))[_0xc4e7('0x72')](_0xc4e7('0x5e')))[_0xc4e7('0x6b')]();return db[_0xc4e7('0x46')][_0xc4e7('0x2b')](_0xa07c97);}return[];})[_0xc4e7('0x1f')](respondWithResult(_0x50db01,null))[_0xc4e7('0x41')](handleError(_0x50db01,null));};exports[_0xc4e7('0x73')]=function(_0x5e94a5,_0x578817,_0x5985ac){return db['Campaign'][_0xc4e7('0x40')]({'where':{'id':_0x5e94a5['params']['id']}})['then'](handleEntityNotFound(_0x578817,null))['then'](function(_0x3b323c){var _0x4a7b5c;if(_0x3b323c){_0x4a7b5c=squel[_0xc4e7('0x74')]()[_0xc4e7('0x75')](_0xc4e7('0x70'))[_0xc4e7('0x5c')]([_0xc4e7('0x5d'),'scheduledAt',_0xc4e7('0x5e'),_0xc4e7('0x5f'),_0xc4e7('0x76'),_0xc4e7('0x61'),_0xc4e7('0x62')],squel[_0xc4e7('0x63')]()[_0xc4e7('0x64')](_0xc4e7('0x77'),_0xc4e7('0x5d'))['field'](_0xc4e7('0x65'),_0xc4e7('0x78'))[_0xc4e7('0x64')](_0xc4e7('0x66'),_0xc4e7('0x5e'))[_0xc4e7('0x64')](_0xc4e7('0x67'),'ListId')[_0xc4e7('0x64')](_0xc4e7('0x79'),_0xc4e7('0x76'))[_0xc4e7('0x64')](_0xc4e7('0x65'),_0xc4e7('0x61'))[_0xc4e7('0x64')](_0xc4e7('0x65'),_0xc4e7('0x62'))[_0xc4e7('0x6f')]('cm_hopper_final')[_0xc4e7('0x34')]('CampaignId\x20=\x20?',_0x5e94a5[_0xc4e7('0x3e')]['id'][_0xc4e7('0x6b')]())[_0xc4e7('0x34')](_0xc4e7('0x6c'),_0x5e94a5[_0xc4e7('0x42')][_0xc4e7('0x6d')][_0xc4e7('0x6b')]())[_0xc4e7('0x34')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0xc4e7('0x6e'),squel[_0xc4e7('0x63')]()[_0xc4e7('0x64')](_0xc4e7('0x5d'))[_0xc4e7('0x6f')](_0xc4e7('0x70'))[_0xc4e7('0x34')]('CampaignId\x20=\x20?',_0x5e94a5[_0xc4e7('0x3e')]['id'][_0xc4e7('0x6b')]()))[_0xc4e7('0x34')](_0xc4e7('0x6e'),squel[_0xc4e7('0x63')]()['field'](_0xc4e7('0x7a'))[_0xc4e7('0x6f')](_0xc4e7('0x69'))[_0xc4e7('0x34')](_0xc4e7('0x7b'),_0x5e94a5[_0xc4e7('0x3e')]['id'][_0xc4e7('0x6b')]())[_0xc4e7('0x34')]('state\x20=\x204'))[_0xc4e7('0x72')](_0xc4e7('0x5e')))['toString']();return db[_0xc4e7('0x46')][_0xc4e7('0x2b')](_0x4a7b5c);}return[];})['then'](respondWithResult(_0x578817,null))[_0xc4e7('0x41')](handleError(_0x578817,null));};exports[_0xc4e7('0x7c')]=function(_0x4afda9,_0xc6b138,_0x29b3fc){return db[_0xc4e7('0x7d')][_0xc4e7('0x7e')]({'where':{'VoiceQueueId':_0x4afda9[_0xc4e7('0x42')]['VoiceQueueId'],'CampaignId':_0x4afda9[_0xc4e7('0x42')][_0xc4e7('0x76')],'ContactId':_0x4afda9['body'][_0xc4e7('0x5e')]}})[_0xc4e7('0x1f')](handleEntityNotFound(_0xc6b138,null))[_0xc4e7('0x1f')](function(_0x314c04){if(_0x314c04){return _0x314c04;}return null;})['then'](respondWithResult(_0xc6b138,null))[_0xc4e7('0x41')](handleError(_0xc6b138,null));}; \ No newline at end of file +var _0x4ffc=['`state`\x20=\x203,\x201,\x20null','`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','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','fromQuery','phone','ListId','VoiceQueueId','createdAt','updatedAt','field','scheduledAt','ContactId','ANY_VALUE(VoiceQueueId)','NOW()','from','VoiceQueueId\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','cm_hopper','cm_hopper_final','state\x20=\x204','Campaign','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','CampaignId\x20=\x20?','state\x20=\x20?','state','calleridnum','CmHopper','findOne','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','count','findAll','params','includeAll','include','find','catch','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','noSuchContacts'];(function(_0x332e95,_0x3dcf3c){var _0x37841f=function(_0x5289a3){while(--_0x5289a3){_0x332e95['push'](_0x332e95['shift']());}};_0x37841f(++_0x3dcf3c);}(_0x4ffc,0x124));var _0xc4ff=function(_0x411299,_0x515d3c){_0x411299=_0x411299-0x0;var _0x136efc=_0x4ffc[_0x411299];return _0x136efc;};'use strict';var emlformat=require(_0xc4ff('0x0'));var rimraf=require(_0xc4ff('0x1'));var zipdir=require(_0xc4ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc4ff('0x3'));var BPromise=require(_0xc4ff('0x4'));var Mustache=require(_0xc4ff('0x5'));var util=require(_0xc4ff('0x6'));var path=require('path');var sox=require(_0xc4ff('0x7'));var csv=require(_0xc4ff('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc4ff('0x9'));var _=require(_0xc4ff('0xa'));var squel=require(_0xc4ff('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc4ff('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc4ff('0xd'));var Papa=require(_0xc4ff('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc4ff('0xf'));var as=require(_0xc4ff('0x10'));var hardwareService=require(_0xc4ff('0x11'));var logger=require(_0xc4ff('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc4ff('0x13'));var db=require(_0xc4ff('0x14'))['db'];function respondWithStatusCode(_0x1b0f25,_0x38627a){_0x38627a=_0x38627a||0xcc;return function(_0x5058e8){if(_0x5058e8){return _0x1b0f25[_0xc4ff('0x15')](_0x38627a);}return _0x1b0f25['status'](_0x38627a)[_0xc4ff('0x16')]();};}function respondWithResult(_0x30b906,_0x1c60c4){_0x1c60c4=_0x1c60c4||0xc8;return function(_0x1014e6){if(_0x1014e6){return _0x30b906[_0xc4ff('0x17')](_0x1c60c4)[_0xc4ff('0x18')](_0x1014e6);}};}function respondWithFilteredResult(_0x4c9112,_0x260061){return function(_0x49c6c9){if(_0x49c6c9){var _0x458db8=_0x49c6c9['count'],_0x259619=_0x260061[_0xc4ff('0x19')],_0x3c08f2=_0x260061[_0xc4ff('0x19')]+_0x260061[_0xc4ff('0x1a')],_0x52e11a;if(_0x3c08f2>=_0x458db8){_0x3c08f2=_0x458db8;_0x52e11a=0xc8;}else{_0x52e11a=0xce;}_0x4c9112[_0xc4ff('0x17')](_0x52e11a);return _0x4c9112[_0xc4ff('0x1b')]('Content-Range',_0x259619+'-'+_0x3c08f2+'/'+_0x458db8)['json'](_0x49c6c9);}return null;};}function patchUpdates(_0x4aae3e){return function(_0x3ac9bc){try{jsonpatch[_0xc4ff('0x1c')](_0x3ac9bc,_0x4aae3e,!![]);}catch(_0x366ff4){return BPromise[_0xc4ff('0x1d')](_0x366ff4);}return _0x3ac9bc[_0xc4ff('0x1e')]();};}function saveUpdates(_0x25f0f4,_0x357335){return function(_0x26e983){if(_0x26e983){return _0x26e983[_0xc4ff('0x1f')](_0x25f0f4)[_0xc4ff('0x20')](function(_0x2a0134){return _0x2a0134;});}return null;};}function removeEntity(_0xd225d7,_0x3c858e){return function(_0x5dc24b){if(_0x5dc24b){return _0x5dc24b[_0xc4ff('0x21')]()['then'](function(){_0xd225d7[_0xc4ff('0x17')](0xcc)[_0xc4ff('0x16')]();});}};}function handleEntityNotFound(_0x1b27a2,_0x513cf3){return function(_0x172db){if(!_0x172db){_0x1b27a2[_0xc4ff('0x15')](0x194);}return _0x172db;};}function handleError(_0x17993d,_0x4a825f){_0x4a825f=_0x4a825f||0x1f4;return function(_0x38269e){logger[_0xc4ff('0x22')](_0x38269e[_0xc4ff('0x23')]);if(_0x38269e[_0xc4ff('0x24')]){delete _0x38269e[_0xc4ff('0x24')];}_0x17993d['status'](_0x4a825f)[_0xc4ff('0x25')](_0x38269e);};}exports[_0xc4ff('0x26')]=function(_0x4c8ffd,_0x433ace){var _0x203cf3={},_0x2eac7b={},_0x49dc5e={'count':0x0,'rows':[]};var _0x20a0e3=_[_0xc4ff('0x27')](db[_0xc4ff('0x28')][_0xc4ff('0x29')],function(_0x3aed41){return{'name':_0x3aed41['fieldName'],'type':_0x3aed41[_0xc4ff('0x2a')][_0xc4ff('0x2b')]};});_0x2eac7b[_0xc4ff('0x2c')]=_[_0xc4ff('0x27')](_0x20a0e3,_0xc4ff('0x24'));_0x2eac7b[_0xc4ff('0x2d')]=_[_0xc4ff('0x2e')](_0x4c8ffd['query']);_0x2eac7b[_0xc4ff('0x2f')]=_[_0xc4ff('0x30')](_0x2eac7b[_0xc4ff('0x2c')],_0x2eac7b[_0xc4ff('0x2d')]);_0x203cf3[_0xc4ff('0x31')]=_['intersection'](_0x2eac7b['model'],qs[_0xc4ff('0x32')](_0x4c8ffd[_0xc4ff('0x2d')][_0xc4ff('0x32')]));_0x203cf3[_0xc4ff('0x31')]=_0x203cf3[_0xc4ff('0x31')][_0xc4ff('0x33')]?_0x203cf3[_0xc4ff('0x31')]:_0x2eac7b['model'];if(!_0x4c8ffd[_0xc4ff('0x2d')][_0xc4ff('0x34')](_0xc4ff('0x35'))){_0x203cf3['limit']=qs[_0xc4ff('0x1a')](_0x4c8ffd[_0xc4ff('0x2d')][_0xc4ff('0x1a')]);_0x203cf3[_0xc4ff('0x19')]=qs[_0xc4ff('0x19')](_0x4c8ffd[_0xc4ff('0x2d')]['offset']);}_0x203cf3['order']=qs[_0xc4ff('0x36')](_0x4c8ffd[_0xc4ff('0x2d')][_0xc4ff('0x36')]);_0x203cf3['where']=qs[_0xc4ff('0x2f')](_['pick'](_0x4c8ffd[_0xc4ff('0x2d')],_0x2eac7b[_0xc4ff('0x2f')]),_0x20a0e3);if(_0x4c8ffd[_0xc4ff('0x2d')][_0xc4ff('0x37')]){_0x203cf3[_0xc4ff('0x38')]=_[_0xc4ff('0x39')](_0x203cf3[_0xc4ff('0x38')],{'$or':_[_0xc4ff('0x27')](_0x20a0e3,function(_0x5860dc){if(_0x5860dc['type']!==_0xc4ff('0x3a')){var _0x424ec0={};_0x424ec0[_0x5860dc[_0xc4ff('0x24')]]={'$like':'%'+_0x4c8ffd[_0xc4ff('0x2d')]['filter']+'%'};return _0x424ec0;}})});}_0x203cf3=_[_0xc4ff('0x39')]({},_0x203cf3,_0x4c8ffd[_0xc4ff('0x3b')]);var _0x2cd213={'where':_0x203cf3['where']};return db['CmHopperFinal'][_0xc4ff('0x3c')](_0x2cd213)[_0xc4ff('0x20')](function(_0x2a4224){_0x49dc5e[_0xc4ff('0x3c')]=_0x2a4224;if(_0x4c8ffd[_0xc4ff('0x2d')]['includeAll']){_0x203cf3['include']=[{'all':!![]}];}return db[_0xc4ff('0x28')][_0xc4ff('0x3d')](_0x203cf3);})[_0xc4ff('0x20')](function(_0x223686){_0x49dc5e['rows']=_0x223686;return _0x49dc5e;})[_0xc4ff('0x20')](respondWithFilteredResult(_0x433ace,_0x203cf3))['catch'](handleError(_0x433ace,null));};exports['show']=function(_0x556ff6,_0xfbdcc3){var _0x4da71a={'raw':!![],'where':{'id':_0x556ff6[_0xc4ff('0x3e')]['id']}},_0xb88603={};_0xb88603[_0xc4ff('0x2c')]=_[_0xc4ff('0x2e')](db[_0xc4ff('0x28')][_0xc4ff('0x29')]);_0xb88603['query']=_[_0xc4ff('0x2e')](_0x556ff6['query']);_0xb88603[_0xc4ff('0x2f')]=_[_0xc4ff('0x30')](_0xb88603[_0xc4ff('0x2c')],_0xb88603[_0xc4ff('0x2d')]);_0x4da71a[_0xc4ff('0x31')]=_[_0xc4ff('0x30')](_0xb88603[_0xc4ff('0x2c')],qs['fields'](_0x556ff6[_0xc4ff('0x2d')][_0xc4ff('0x32')]));_0x4da71a['attributes']=_0x4da71a[_0xc4ff('0x31')][_0xc4ff('0x33')]?_0x4da71a[_0xc4ff('0x31')]:_0xb88603[_0xc4ff('0x2c')];if(_0x556ff6[_0xc4ff('0x2d')][_0xc4ff('0x3f')]){_0x4da71a[_0xc4ff('0x40')]=[{'all':!![]}];}_0x4da71a=_[_0xc4ff('0x39')]({},_0x4da71a,_0x556ff6[_0xc4ff('0x3b')]);return db[_0xc4ff('0x28')][_0xc4ff('0x41')](_0x4da71a)[_0xc4ff('0x20')](handleEntityNotFound(_0xfbdcc3,null))[_0xc4ff('0x20')](respondWithResult(_0xfbdcc3,null))[_0xc4ff('0x42')](handleError(_0xfbdcc3,null));};exports['describe']=function(_0x1ef0df,_0x3e4e42){return db[_0xc4ff('0x28')]['describe']()[_0xc4ff('0x20')](respondWithResult(_0x3e4e42,null))[_0xc4ff('0x42')](handleError(_0x3e4e42,null));};exports['update']=function(_0x24e418,_0x4285b6){if(_0x24e418[_0xc4ff('0x43')][_0xc4ff('0x44')]){delete _0x24e418[_0xc4ff('0x43')]['uniqueid'];}return db[_0xc4ff('0x28')][_0xc4ff('0x41')]({'where':{'uniqueid':_0x24e418['params']['id']}})['then'](handleEntityNotFound(_0x4285b6,null))[_0xc4ff('0x20')](saveUpdates(_0x24e418[_0xc4ff('0x43')],null))[_0xc4ff('0x20')](respondWithResult(_0x4285b6,null))[_0xc4ff('0x42')](handleError(_0x4285b6,null));};exports[_0xc4ff('0x45')]=function(_0x43e44f,_0x16d362,_0x3c4395){return db['CmHopperFinal'][_0xc4ff('0x3d')]({'raw':![],'where':{'VoiceQueueId':_0x43e44f[_0xc4ff('0x3e')]['id']},'attributes':[[db['sequelize']['fn'](_0xc4ff('0x46'),db['sequelize']['fn']('IF',db[_0xc4ff('0x47')][_0xc4ff('0x48')]('`state`\x20=\x200,\x201,\x20null'))),_0xc4ff('0x49')],[db[_0xc4ff('0x47')]['fn'](_0xc4ff('0x46'),db['sequelize']['fn']('IF',db['sequelize'][_0xc4ff('0x48')](_0xc4ff('0x4a')))),'noAnswerContacts'],[db[_0xc4ff('0x47')]['fn'](_0xc4ff('0x46'),db[_0xc4ff('0x47')]['fn']('IF',db[_0xc4ff('0x47')][_0xc4ff('0x48')](_0xc4ff('0x4b')))),'busyContacts'],[db[_0xc4ff('0x47')]['fn'](_0xc4ff('0x46'),db[_0xc4ff('0x47')]['fn']('IF',db[_0xc4ff('0x47')][_0xc4ff('0x48')](_0xc4ff('0x4c')))),_0xc4ff('0x4d')],[db[_0xc4ff('0x47')]['fn'](_0xc4ff('0x46'),db['sequelize']['fn']('IF',db['sequelize'][_0xc4ff('0x48')](_0xc4ff('0x4e')))),_0xc4ff('0x4f')],[db[_0xc4ff('0x47')]['fn'](_0xc4ff('0x46'),db[_0xc4ff('0x47')]['fn']('IF',db[_0xc4ff('0x47')][_0xc4ff('0x48')](_0xc4ff('0x50')))),_0xc4ff('0x51')],[db[_0xc4ff('0x47')]['fn'](_0xc4ff('0x46'),db[_0xc4ff('0x47')]['fn']('IF',db['sequelize'][_0xc4ff('0x48')]('`state`\x20=\x2022,\x201,\x20null'))),_0xc4ff('0x52')],[db[_0xc4ff('0x47')]['fn']('COUNT',db[_0xc4ff('0x47')]['fn']('IF',db[_0xc4ff('0x47')][_0xc4ff('0x48')](_0xc4ff('0x53')))),_0xc4ff('0x54')]]})['then'](handleEntityNotFound(_0x16d362,null))[_0xc4ff('0x20')](respondWithResult(_0x16d362,null))[_0xc4ff('0x42')](handleError(_0x16d362,null));};exports[_0xc4ff('0x55')]=function(_0x6eea3a,_0xb0acb7,_0x501b0f){return db[_0xc4ff('0x28')]['findAll']({'raw':![],'where':{'CampaignId':_0x6eea3a[_0xc4ff('0x3e')]['id']},'attributes':[[db[_0xc4ff('0x47')]['fn'](_0xc4ff('0x46'),db[_0xc4ff('0x47')]['fn']('IF',db[_0xc4ff('0x47')][_0xc4ff('0x48')](_0xc4ff('0x56')))),'noSuchContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xc4ff('0x47')][_0xc4ff('0x48')](_0xc4ff('0x4a')))),'noAnswerContacts'],[db[_0xc4ff('0x47')]['fn']('COUNT',db[_0xc4ff('0x47')]['fn']('IF',db['sequelize'][_0xc4ff('0x48')](_0xc4ff('0x4b')))),'busyContacts'],[db[_0xc4ff('0x47')]['fn'](_0xc4ff('0x46'),db['sequelize']['fn']('IF',db['sequelize'][_0xc4ff('0x48')](_0xc4ff('0x4c')))),_0xc4ff('0x4d')],[db[_0xc4ff('0x47')]['fn']('COUNT',db[_0xc4ff('0x47')]['fn']('IF',db[_0xc4ff('0x47')]['literal'](_0xc4ff('0x4e')))),_0xc4ff('0x4f')],[db[_0xc4ff('0x47')]['fn'](_0xc4ff('0x46'),db[_0xc4ff('0x47')]['fn']('IF',db[_0xc4ff('0x47')][_0xc4ff('0x48')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xc4ff('0x51')],[db[_0xc4ff('0x47')]['fn'](_0xc4ff('0x46'),db[_0xc4ff('0x47')]['fn']('IF',db[_0xc4ff('0x47')][_0xc4ff('0x48')](_0xc4ff('0x57')))),_0xc4ff('0x52')],[db['sequelize']['fn'](_0xc4ff('0x46'),db[_0xc4ff('0x47')]['fn']('IF',db[_0xc4ff('0x47')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0xc4ff('0x54')]]})[_0xc4ff('0x20')](handleEntityNotFound(_0xb0acb7,null))['then'](respondWithResult(_0xb0acb7,null))[_0xc4ff('0x42')](handleError(_0xb0acb7,null));};exports[_0xc4ff('0x58')]=function(_0x355046,_0x1112a7,_0x45a9fe){return db['VoiceQueue']['find']({'where':{'id':_0x355046['params']['id']}})[_0xc4ff('0x20')](handleEntityNotFound(_0x1112a7,null))[_0xc4ff('0x20')](function(_0x2015d0){var _0x49e196;if(_0x2015d0){_0x49e196=squel[_0xc4ff('0x59')]()[_0xc4ff('0x5a')]('cm_hopper')[_0xc4ff('0x5b')]([_0xc4ff('0x5c'),'scheduledAt','ContactId',_0xc4ff('0x5d'),_0xc4ff('0x5e'),_0xc4ff('0x5f'),_0xc4ff('0x60')],squel['select']()[_0xc4ff('0x61')]('ANY_VALUE(calleridnum)',_0xc4ff('0x5c'))['field']('NOW()',_0xc4ff('0x62'))[_0xc4ff('0x61')]('ANY_VALUE(ContactId)',_0xc4ff('0x63'))[_0xc4ff('0x61')]('ANY_VALUE(ListId)',_0xc4ff('0x5d'))[_0xc4ff('0x61')](_0xc4ff('0x64'),'VoiceQueueId')[_0xc4ff('0x61')](_0xc4ff('0x65'),_0xc4ff('0x5f'))[_0xc4ff('0x61')]('NOW()',_0xc4ff('0x60'))[_0xc4ff('0x66')]('cm_hopper_final')[_0xc4ff('0x38')](_0xc4ff('0x67'),_0x355046['params']['id'][_0xc4ff('0x68')]())[_0xc4ff('0x38')]('state\x20=\x20?',_0x355046['body']['state'][_0xc4ff('0x68')]())['where'](_0xc4ff('0x69'))[_0xc4ff('0x38')](_0xc4ff('0x6a'),squel[_0xc4ff('0x6b')]()['field'](_0xc4ff('0x5c'))[_0xc4ff('0x66')](_0xc4ff('0x6c'))[_0xc4ff('0x38')](_0xc4ff('0x67'),_0x355046[_0xc4ff('0x3e')]['id'][_0xc4ff('0x68')]()))[_0xc4ff('0x38')](_0xc4ff('0x6a'),squel[_0xc4ff('0x6b')]()['field']('calleridnum')[_0xc4ff('0x66')](_0xc4ff('0x6d'))['where'](_0xc4ff('0x67'),_0x355046[_0xc4ff('0x3e')]['id'][_0xc4ff('0x68')]())[_0xc4ff('0x38')](_0xc4ff('0x6e')))['group'](_0xc4ff('0x63')))['toString']();return db[_0xc4ff('0x47')][_0xc4ff('0x2d')](_0x49e196);}return[];})[_0xc4ff('0x20')](respondWithResult(_0x1112a7,null))[_0xc4ff('0x42')](handleError(_0x1112a7,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x5aba37,_0x52688a,_0x29bbaa){return db[_0xc4ff('0x6f')][_0xc4ff('0x41')]({'where':{'id':_0x5aba37[_0xc4ff('0x3e')]['id']}})[_0xc4ff('0x20')](handleEntityNotFound(_0x52688a,null))[_0xc4ff('0x20')](function(_0x141c82){var _0x430484;if(_0x141c82){_0x430484=squel[_0xc4ff('0x59')]()[_0xc4ff('0x5a')]('cm_hopper')[_0xc4ff('0x5b')]([_0xc4ff('0x5c'),_0xc4ff('0x62'),'ContactId',_0xc4ff('0x5d'),_0xc4ff('0x70'),'createdAt',_0xc4ff('0x60')],squel['select']()['field'](_0xc4ff('0x71'),_0xc4ff('0x5c'))[_0xc4ff('0x61')](_0xc4ff('0x65'),_0xc4ff('0x62'))[_0xc4ff('0x61')](_0xc4ff('0x72'),_0xc4ff('0x63'))[_0xc4ff('0x61')](_0xc4ff('0x73'),_0xc4ff('0x5d'))[_0xc4ff('0x61')]('ANY_VALUE(CampaignId)',_0xc4ff('0x70'))[_0xc4ff('0x61')](_0xc4ff('0x65'),_0xc4ff('0x5f'))[_0xc4ff('0x61')]('NOW()',_0xc4ff('0x60'))['from'](_0xc4ff('0x6d'))[_0xc4ff('0x38')](_0xc4ff('0x74'),_0x5aba37[_0xc4ff('0x3e')]['id'][_0xc4ff('0x68')]())[_0xc4ff('0x38')](_0xc4ff('0x75'),_0x5aba37[_0xc4ff('0x43')][_0xc4ff('0x76')]['toString']())[_0xc4ff('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0xc4ff('0x6a'),squel[_0xc4ff('0x6b')]()[_0xc4ff('0x61')](_0xc4ff('0x5c'))[_0xc4ff('0x66')](_0xc4ff('0x6c'))[_0xc4ff('0x38')]('CampaignId\x20=\x20?',_0x5aba37[_0xc4ff('0x3e')]['id']['toString']()))[_0xc4ff('0x38')](_0xc4ff('0x6a'),squel[_0xc4ff('0x6b')]()[_0xc4ff('0x61')](_0xc4ff('0x77'))[_0xc4ff('0x66')](_0xc4ff('0x6d'))[_0xc4ff('0x38')]('CampaignId\x20=\x20?',_0x5aba37['params']['id'][_0xc4ff('0x68')]())[_0xc4ff('0x38')]('state\x20=\x204'))['group'](_0xc4ff('0x63')))[_0xc4ff('0x68')]();return db[_0xc4ff('0x47')][_0xc4ff('0x2d')](_0x430484);}return[];})['then'](respondWithResult(_0x52688a,null))[_0xc4ff('0x42')](handleError(_0x52688a,null));};exports['checkContactHopper']=function(_0x1b09a4,_0xf6b54,_0x7e10f1){return db[_0xc4ff('0x78')][_0xc4ff('0x79')]({'where':{'VoiceQueueId':_0x1b09a4[_0xc4ff('0x43')][_0xc4ff('0x5e')],'CampaignId':_0x1b09a4['body'][_0xc4ff('0x70')],'ContactId':_0x1b09a4[_0xc4ff('0x43')][_0xc4ff('0x63')]}})[_0xc4ff('0x20')](handleEntityNotFound(_0xf6b54,null))[_0xc4ff('0x20')](function(_0x56c762){if(_0x56c762){return _0x56c762;}return null;})[_0xc4ff('0x20')](respondWithResult(_0xf6b54,null))[_0xc4ff('0x42')](handleError(_0xf6b54,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 7f27c72..77018c5 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 _0xa530=['../../config/logger','api','moment','request-promise','path','rimraf','./cmHopperFinal.attributes','define','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x1fb4e1,_0x3d4ce6){var _0x22d1b0=function(_0x553822){while(--_0x553822){_0x1fb4e1['push'](_0x1fb4e1['shift']());}};_0x22d1b0(++_0x3d4ce6);}(_0xa530,0xa7));var _0x0a53=function(_0x54a761,_0x431fd4){_0x54a761=_0x54a761-0x0;var _0x37d1da=_0xa530[_0x54a761];return _0x37d1da;};'use strict';var _=require(_0x0a53('0x0'));var util=require('util');var logger=require(_0x0a53('0x1'))(_0x0a53('0x2'));var moment=require(_0x0a53('0x3'));var BPromise=require('bluebird');var rp=require(_0x0a53('0x4'));var fs=require('fs');var path=require(_0x0a53('0x5'));var rimraf=require(_0x0a53('0x6'));var config=require('../../config/environment');var attributes=require(_0x0a53('0x7'));module['exports']=function(_0x1d1815,_0x249f12){return _0x1d1815[_0x0a53('0x8')]('CmHopperFinal',attributes,{'tableName':_0x0a53('0x9'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x0a53('0xa')]},{'name':_0x0a53('0xb'),'fields':[_0x0a53('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6a8d=['cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal'];(function(_0xbc208e,_0x473eff){var _0x454ced=function(_0x360876){while(--_0x360876){_0xbc208e['push'](_0xbc208e['shift']());}};_0x454ced(++_0x473eff);}(_0x6a8d,0xff));var _0xd6a8=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x6a8d[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0xd6a8('0x0'));var util=require(_0xd6a8('0x1'));var logger=require(_0xd6a8('0x2'))('api');var moment=require(_0xd6a8('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6a8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd6a8('0x5'));var config=require(_0xd6a8('0x6'));var attributes=require(_0xd6a8('0x7'));module[_0xd6a8('0x8')]=function(_0xc38404,_0xd05557){return _0xc38404[_0xd6a8('0x9')](_0xd6a8('0xa'),attributes,{'tableName':_0xd6a8('0xb'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xd6a8('0xc')]},{'name':_0xd6a8('0xd'),'fields':[_0xd6a8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index e191113..5a5fdb8 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 _0xaef6=['error','code','message','info','request\x20sent','result','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','CmHopperFinal,\x20%s,\x20%s','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x971a7d,_0x1d8235){var _0xc7b4a3=function(_0x1727b8){while(--_0x1727b8){_0x971a7d['push'](_0x971a7d['shift']());}};_0xc7b4a3(++_0x1d8235);}(_0xaef6,0xe4));var _0x6aef=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xaef6[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x6aef('0x0'));var util=require(_0x6aef('0x1'));var moment=require('moment');var BPromise=require(_0x6aef('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6aef('0x3'));var db=require(_0x6aef('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6aef('0x5'))(_0x6aef('0x6'));var config=require('../../config/environment');var jayson=require(_0x6aef('0x7'));var client=jayson['client'][_0x6aef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a1048,_0x2effe3,_0x14455a){return new BPromise(function(_0x4426b9,_0x506ef0){return client[_0x6aef('0x9')](_0x4a1048,_0x14455a)[_0x6aef('0xa')](function(_0x4a8f0c){logger['info'](_0x6aef('0xb'),_0x2effe3,'request\x20sent');logger[_0x6aef('0xc')](_0x6aef('0xd'),_0x2effe3,'request\x20sent',JSON[_0x6aef('0xe')](_0x4a8f0c));if(_0x4a8f0c[_0x6aef('0xf')]){if(_0x4a8f0c[_0x6aef('0xf')][_0x6aef('0x10')]===0x1f4){logger['error'](_0x6aef('0xb'),_0x2effe3,_0x4a8f0c['error']['message']);return _0x506ef0(_0x4a8f0c[_0x6aef('0xf')][_0x6aef('0x11')]);}logger[_0x6aef('0xf')](_0x6aef('0xb'),_0x2effe3,_0x4a8f0c['error']['message']);return _0x4426b9(_0x4a8f0c[_0x6aef('0xf')][_0x6aef('0x11')]);}else{logger[_0x6aef('0x12')](_0x6aef('0xb'),_0x2effe3,_0x6aef('0x13'));_0x4426b9(_0x4a8f0c[_0x6aef('0x14')][_0x6aef('0x11')]);}})[_0x6aef('0x15')](function(_0x118801){logger['error'](_0x6aef('0xb'),_0x2effe3,_0x118801);_0x506ef0(_0x118801);});});}exports[_0x6aef('0x16')]=function(_0x43601f){var _0x28a3e5=this;return new Promise(function(_0x1b8ad0,_0x393e6c){return db[_0x6aef('0x17')][_0x6aef('0x18')](_0x43601f[_0x6aef('0x19')],{'raw':_0x43601f[_0x6aef('0x1a')]?_0x43601f[_0x6aef('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1ff4a7){logger['info'](_0x6aef('0x16'),_0x43601f);logger[_0x6aef('0xc')]('CreateCmHopperFinal',_0x43601f,JSON[_0x6aef('0xe')](_0x1ff4a7));_0x1b8ad0(_0x1ff4a7);})['catch'](function(_0x54fed9){logger[_0x6aef('0xf')](_0x6aef('0x16'),_0x54fed9['message'],_0x43601f);_0x393e6c(_0x28a3e5[_0x6aef('0xf')](0x1f4,_0x54fed9[_0x6aef('0x11')]));});});}; \ No newline at end of file +var _0x7faf=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','CmHopperFinal,\x20%s,\x20%s','message','info','catch','CreateCmHopperFinal','CmHopperFinal','body','options','raw','stringify','lodash','util','moment'];(function(_0x11180d,_0x50559b){var _0x146c73=function(_0x52c9e7){while(--_0x52c9e7){_0x11180d['push'](_0x11180d['shift']());}};_0x146c73(++_0x50559b);}(_0x7faf,0x1d9));var _0xf7fa=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7faf[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xf7fa('0x0'));var util=require(_0xf7fa('0x1'));var moment=require(_0xf7fa('0x2'));var BPromise=require(_0xf7fa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf7fa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf7fa('0x5'));var logger=require(_0xf7fa('0x6'))(_0xf7fa('0x7'));var config=require(_0xf7fa('0x8'));var jayson=require(_0xf7fa('0x9'));var client=jayson[_0xf7fa('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d7d23,_0x45fa97,_0x17ebef){return new BPromise(function(_0x4b143d,_0x29d5e9){return client[_0xf7fa('0xb')](_0x3d7d23,_0x17ebef)[_0xf7fa('0xc')](function(_0x1c1404){logger['info']('CmHopperFinal,\x20%s,\x20%s',_0x45fa97,'request\x20sent');logger[_0xf7fa('0xd')](_0xf7fa('0xe'),_0x45fa97,_0xf7fa('0xf'),JSON['stringify'](_0x1c1404));if(_0x1c1404[_0xf7fa('0x10')]){if(_0x1c1404[_0xf7fa('0x10')][_0xf7fa('0x11')]===0x1f4){logger[_0xf7fa('0x10')](_0xf7fa('0x12'),_0x45fa97,_0x1c1404[_0xf7fa('0x10')][_0xf7fa('0x13')]);return _0x29d5e9(_0x1c1404[_0xf7fa('0x10')][_0xf7fa('0x13')]);}logger['error'](_0xf7fa('0x12'),_0x45fa97,_0x1c1404['error']['message']);return _0x4b143d(_0x1c1404[_0xf7fa('0x10')][_0xf7fa('0x13')]);}else{logger[_0xf7fa('0x14')](_0xf7fa('0x12'),_0x45fa97,_0xf7fa('0xf'));_0x4b143d(_0x1c1404['result'][_0xf7fa('0x13')]);}})[_0xf7fa('0x15')](function(_0x17088e){logger[_0xf7fa('0x10')](_0xf7fa('0x12'),_0x45fa97,_0x17088e);_0x29d5e9(_0x17088e);});});}exports[_0xf7fa('0x16')]=function(_0x2d68e5){var _0x3865d7=this;return new Promise(function(_0x5849d6,_0x25ae44){return db[_0xf7fa('0x17')]['create'](_0x2d68e5[_0xf7fa('0x18')],{'raw':_0x2d68e5[_0xf7fa('0x19')]?_0x2d68e5['options'][_0xf7fa('0x1a')]===undefined?!![]:![]:!![]})[_0xf7fa('0xc')](function(_0x4ba8e6){logger[_0xf7fa('0x14')](_0xf7fa('0x16'),_0x2d68e5);logger[_0xf7fa('0xd')]('CreateCmHopperFinal',_0x2d68e5,JSON[_0xf7fa('0x1b')](_0x4ba8e6));_0x5849d6(_0x4ba8e6);})['catch'](function(_0x2134a9){logger[_0xf7fa('0x10')](_0xf7fa('0x16'),_0x2134a9['message'],_0x2d68e5);_0x25ae44(_0x3865d7[_0xf7fa('0x10')](0x1f4,_0x2134a9[_0xf7fa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 6386e18..9210a56 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 _0xf547=['./cmHopperFinal.controller','get','isAuthenticated','index','/describe','/:id','show','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf547,0x1d4));var _0x7f54=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xf547[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x7f54('0x0'));var util=require(_0x7f54('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7f54('0x2')]();var fs_extra=require(_0x7f54('0x3'));var auth=require(_0x7f54('0x4'));var interaction=require(_0x7f54('0x5'));var config=require(_0x7f54('0x6'));var controller=require(_0x7f54('0x7'));router[_0x7f54('0x8')]('/',auth[_0x7f54('0x9')](),controller[_0x7f54('0xa')]);router[_0x7f54('0x8')](_0x7f54('0xb'),auth[_0x7f54('0x9')](),controller['describe']);router[_0x7f54('0x8')](_0x7f54('0xc'),auth[_0x7f54('0x9')](),controller[_0x7f54('0xd')]);router['get']('/voice/queue/countAttributes/:id',auth[_0x7f54('0x9')](),controller[_0x7f54('0xe')]);router['get']('/campaign/countAttributes/:id',auth[_0x7f54('0x9')](),controller[_0x7f54('0xf')]);router['post'](_0x7f54('0x10'),auth[_0x7f54('0x9')](),controller[_0x7f54('0x11')]);router[_0x7f54('0x12')](_0x7f54('0x13'),auth[_0x7f54('0x9')](),controller[_0x7f54('0x14')]);router[_0x7f54('0x12')](_0x7f54('0x15'),auth[_0x7f54('0x9')](),controller[_0x7f54('0x16')]);router['put'](_0x7f54('0xc'),auth[_0x7f54('0x9')](),controller[_0x7f54('0x17')]);module[_0x7f54('0x18')]=router; \ No newline at end of file +var _0xe38c=['/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','/voice/queue/moveContacts/:id','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','index','/describe','describe','/:id','isAuthenticated'];(function(_0x177a13,_0x16d039){var _0x582206=function(_0x3f9468){while(--_0x3f9468){_0x177a13['push'](_0x177a13['shift']());}};_0x582206(++_0x16d039);}(_0xe38c,0xbb));var _0xce38=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xe38c[_0x42245d];return _0x4b211a;};'use strict';var multer=require(_0xce38('0x0'));var util=require('util');var path=require(_0xce38('0x1'));var timeout=require(_0xce38('0x2'));var express=require('express');var router=express[_0xce38('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xce38('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xce38('0x5'));var controller=require(_0xce38('0x6'));router[_0xce38('0x7')]('/',auth['isAuthenticated'](),controller[_0xce38('0x8')]);router[_0xce38('0x7')](_0xce38('0x9'),auth['isAuthenticated'](),controller[_0xce38('0xa')]);router[_0xce38('0x7')](_0xce38('0xb'),auth[_0xce38('0xc')](),controller['show']);router[_0xce38('0x7')](_0xce38('0xd'),auth[_0xce38('0xc')](),controller[_0xce38('0xe')]);router['get'](_0xce38('0xf'),auth[_0xce38('0xc')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0xce38('0x10'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xce38('0x11')](_0xce38('0x12'),auth[_0xce38('0xc')](),controller[_0xce38('0x13')]);router[_0xce38('0x11')](_0xce38('0x14'),auth[_0xce38('0xc')](),controller[_0xce38('0x15')]);router[_0xce38('0x16')](_0xce38('0xb'),auth[_0xce38('0xc')](),controller[_0xce38('0x17')]);module[_0xce38('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 dd3128d..8c62726 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 _0x976a=['STRING','BOOLEAN','sequelize','exports','INTEGER','DATE'];(function(_0x266018,_0x3d47e0){var _0x56c1bb=function(_0x3160cd){while(--_0x3160cd){_0x266018['push'](_0x266018['shift']());}};_0x56c1bb(++_0x3d47e0);}(_0x976a,0xf2));var _0xa976=function(_0x2ce286,_0x4104e4){_0x2ce286=_0x2ce286-0x0;var _0x4c471f=_0x976a[_0x2ce286];return _0x4c471f;};'use strict';var Sequelize=require(_0xa976('0x0'));module[_0xa976('0x1')]={'state':{'type':Sequelize[_0xa976('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xa976('0x3')]},'countbusyretry':{'type':Sequelize[_0xa976('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa976('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa976('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xa976('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa976('0x4')]},'calleridname':{'type':Sequelize[_0xa976('0x4')]},'starttime':{'type':Sequelize[_0xa976('0x3')]},'responsetime':{'type':Sequelize[_0xa976('0x3')]},'answertime':{'type':Sequelize[_0xa976('0x3')]},'droptime':{'type':Sequelize[_0xa976('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xa976('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xa976('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa976('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa976('0x4')]},'campaign':{'type':Sequelize[_0xa976('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xa976('0x4')]},'amd':{'type':Sequelize[_0xa976('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xa976('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa976('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa976('0x3')]},'recallme':{'type':Sequelize[_0xa976('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xa976('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa976('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa976('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x903d=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0xf35d35,_0x99583d){var _0x12d874=function(_0x42caec){while(--_0x42caec){_0xf35d35['push'](_0xf35d35['shift']());}};_0x12d874(++_0x99583d);}(_0x903d,0x12c));var _0xd903=function(_0x59975b,_0x16f962){_0x59975b=_0x59975b-0x0;var _0x50daa2=_0x903d[_0x59975b];return _0x50daa2;};'use strict';var Sequelize=require(_0xd903('0x0'));module[_0xd903('0x1')]={'state':{'type':Sequelize[_0xd903('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xd903('0x3')]},'scheduledat':{'type':Sequelize[_0xd903('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd903('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd903('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd903('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xd903('0x3')]},'originatecalleridname':{'type':Sequelize[_0xd903('0x3')]},'calleridnum':{'type':Sequelize[_0xd903('0x3')]},'calleridname':{'type':Sequelize[_0xd903('0x3')]},'starttime':{'type':Sequelize[_0xd903('0x4')]},'responsetime':{'type':Sequelize[_0xd903('0x4')]},'answertime':{'type':Sequelize[_0xd903('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd903('0x4')]},'ringtime':{'type':Sequelize[_0xd903('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd903('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd903('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xd903('0x3')]},'campaigntype':{'type':Sequelize[_0xd903('0x3')]},'membername':{'type':Sequelize[_0xd903('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xd903('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xd903('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xd903('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd903('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd903('0x4')]},'recallme':{'type':Sequelize[_0xd903('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xd903('0x4')]},'edited':{'type':Sequelize[_0xd903('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xd903('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd903('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd903('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd903('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd903('0x2')],'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 d326050..6e30877 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 _0xb706=['sox','to-csv','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','CmHopperHistory','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','intersection','find','create','body','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xb706,0x172));var _0x6b70=function(_0x402ef0,_0x79385c){_0x402ef0=_0x402ef0-0x0;var _0x15100a=_0xb706[_0x402ef0];return _0x15100a;};'use strict';var emlformat=require(_0x6b70('0x0'));var rimraf=require(_0x6b70('0x1'));var zipdir=require(_0x6b70('0x2'));var jsonpatch=require(_0x6b70('0x3'));var rp=require(_0x6b70('0x4'));var moment=require(_0x6b70('0x5'));var BPromise=require(_0x6b70('0x6'));var Mustache=require(_0x6b70('0x7'));var util=require(_0x6b70('0x8'));var path=require(_0x6b70('0x9'));var sox=require(_0x6b70('0xa'));var csv=require(_0x6b70('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b70('0xc'));var squel=require('squel');var crypto=require(_0x6b70('0xd'));var jsforce=require(_0x6b70('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6b70('0xf'));var authService=require(_0x6b70('0x10'));var qs=require(_0x6b70('0x11'));var as=require(_0x6b70('0x12'));var hardwareService=require(_0x6b70('0x13'));var logger=require(_0x6b70('0x14'))(_0x6b70('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6b70('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x138797,_0x26c7a7){_0x26c7a7=_0x26c7a7||0xcc;return function(_0x2caa6b){if(_0x2caa6b){return _0x138797[_0x6b70('0x17')](_0x26c7a7);}return _0x138797['status'](_0x26c7a7)[_0x6b70('0x18')]();};}function respondWithResult(_0x4420ca,_0x582332){_0x582332=_0x582332||0xc8;return function(_0x2bf898){if(_0x2bf898){return _0x4420ca[_0x6b70('0x19')](_0x582332)['json'](_0x2bf898);}};}function respondWithFilteredResult(_0x337c9b,_0x346e0b){return function(_0x1f93fd){if(_0x1f93fd){var _0x52fd20=_0x1f93fd[_0x6b70('0x1a')],_0x42499e=_0x346e0b['offset'],_0x470c8f=_0x346e0b[_0x6b70('0x1b')]+_0x346e0b[_0x6b70('0x1c')],_0x5d3eca;if(_0x470c8f>=_0x52fd20){_0x470c8f=_0x52fd20;_0x5d3eca=0xc8;}else{_0x5d3eca=0xce;}_0x337c9b[_0x6b70('0x19')](_0x5d3eca);return _0x337c9b['set'](_0x6b70('0x1d'),_0x42499e+'-'+_0x470c8f+'/'+_0x52fd20)[_0x6b70('0x1e')](_0x1f93fd);}return null;};}function patchUpdates(_0x24a1d4){return function(_0x4ebd5b){try{jsonpatch[_0x6b70('0x1f')](_0x4ebd5b,_0x24a1d4,!![]);}catch(_0x5d456b){return BPromise[_0x6b70('0x20')](_0x5d456b);}return _0x4ebd5b[_0x6b70('0x21')]();};}function saveUpdates(_0x11650a,_0x3a9599){return function(_0x31ed7a){if(_0x31ed7a){return _0x31ed7a['update'](_0x11650a)[_0x6b70('0x22')](function(_0x53dc22){return _0x53dc22;});}return null;};}function removeEntity(_0x27e650,_0x28fa39){return function(_0x16d311){if(_0x16d311){return _0x16d311[_0x6b70('0x23')]()[_0x6b70('0x22')](function(){_0x27e650['status'](0xcc)[_0x6b70('0x18')]();});}};}function handleEntityNotFound(_0xac78d3,_0x3a17e4){return function(_0x5e0e1e){if(!_0x5e0e1e){_0xac78d3['sendStatus'](0x194);}return _0x5e0e1e;};}function handleError(_0x5728ad,_0x728557){_0x728557=_0x728557||0x1f4;return function(_0x26a817){logger[_0x6b70('0x24')](_0x26a817[_0x6b70('0x25')]);if(_0x26a817[_0x6b70('0x26')]){delete _0x26a817[_0x6b70('0x26')];}_0x5728ad[_0x6b70('0x19')](_0x728557)[_0x6b70('0x27')](_0x26a817);};}exports[_0x6b70('0x28')]=function(_0x137b45,_0xc74e08){var _0x42992e={},_0x140dc4={},_0x222a71={'count':0x0,'rows':[]};var _0x42ed0a=_['map'](db[_0x6b70('0x29')][_0x6b70('0x2a')],function(_0xf2f118){return{'name':_0xf2f118[_0x6b70('0x2b')],'type':_0xf2f118[_0x6b70('0x2c')][_0x6b70('0x2d')]};});_0x140dc4[_0x6b70('0x2e')]=_[_0x6b70('0x2f')](_0x42ed0a,'name');_0x140dc4[_0x6b70('0x30')]=_[_0x6b70('0x31')](_0x137b45['query']);_0x140dc4[_0x6b70('0x32')]=_['intersection'](_0x140dc4[_0x6b70('0x2e')],_0x140dc4[_0x6b70('0x30')]);_0x42992e[_0x6b70('0x33')]=_['intersection'](_0x140dc4[_0x6b70('0x2e')],qs[_0x6b70('0x34')](_0x137b45['query'][_0x6b70('0x34')]));_0x42992e[_0x6b70('0x33')]=_0x42992e[_0x6b70('0x33')][_0x6b70('0x35')]?_0x42992e['attributes']:_0x140dc4[_0x6b70('0x2e')];if(!_0x137b45[_0x6b70('0x30')]['hasOwnProperty'](_0x6b70('0x36'))){_0x42992e[_0x6b70('0x1c')]=qs['limit'](_0x137b45[_0x6b70('0x30')][_0x6b70('0x1c')]);_0x42992e[_0x6b70('0x1b')]=qs[_0x6b70('0x1b')](_0x137b45['query'][_0x6b70('0x1b')]);}_0x42992e[_0x6b70('0x37')]=qs['sort'](_0x137b45[_0x6b70('0x30')][_0x6b70('0x38')]);_0x42992e[_0x6b70('0x39')]=qs[_0x6b70('0x32')](_[_0x6b70('0x3a')](_0x137b45['query'],_0x140dc4[_0x6b70('0x32')]),_0x42ed0a);if(_0x137b45['query'][_0x6b70('0x3b')]){_0x42992e[_0x6b70('0x39')]=_[_0x6b70('0x3c')](_0x42992e['where'],{'$or':_[_0x6b70('0x2f')](_0x42ed0a,function(_0x356f2c){if(_0x356f2c[_0x6b70('0x2c')]!==_0x6b70('0x3d')){var _0x2e39ff={};_0x2e39ff[_0x356f2c['name']]={'$like':'%'+_0x137b45['query'][_0x6b70('0x3b')]+'%'};return _0x2e39ff;}})});}_0x42992e=_['merge']({},_0x42992e,_0x137b45[_0x6b70('0x3e')]);var _0x5e7939={'where':_0x42992e[_0x6b70('0x39')]};return db[_0x6b70('0x29')][_0x6b70('0x1a')](_0x5e7939)[_0x6b70('0x22')](function(_0x1285b1){_0x222a71[_0x6b70('0x1a')]=_0x1285b1;if(_0x137b45[_0x6b70('0x30')][_0x6b70('0x3f')]){_0x42992e[_0x6b70('0x40')]=[{'all':!![]}];}return db[_0x6b70('0x29')][_0x6b70('0x41')](_0x42992e);})[_0x6b70('0x22')](function(_0x16b0c7){_0x222a71['rows']=_0x16b0c7;return _0x222a71;})['then'](respondWithFilteredResult(_0xc74e08,_0x42992e))[_0x6b70('0x42')](handleError(_0xc74e08,null));};exports[_0x6b70('0x43')]=function(_0x2675b6,_0x7a0eec){var _0x4b6de3={'raw':!![],'where':{'id':_0x2675b6[_0x6b70('0x44')]['id']}},_0x1bea4c={};_0x1bea4c[_0x6b70('0x2e')]=_[_0x6b70('0x31')](db['CmHopperHistory'][_0x6b70('0x2a')]);_0x1bea4c[_0x6b70('0x30')]=_[_0x6b70('0x31')](_0x2675b6[_0x6b70('0x30')]);_0x1bea4c[_0x6b70('0x32')]=_[_0x6b70('0x45')](_0x1bea4c['model'],_0x1bea4c[_0x6b70('0x30')]);_0x4b6de3[_0x6b70('0x33')]=_[_0x6b70('0x45')](_0x1bea4c['model'],qs[_0x6b70('0x34')](_0x2675b6[_0x6b70('0x30')][_0x6b70('0x34')]));_0x4b6de3[_0x6b70('0x33')]=_0x4b6de3[_0x6b70('0x33')][_0x6b70('0x35')]?_0x4b6de3[_0x6b70('0x33')]:_0x1bea4c[_0x6b70('0x2e')];if(_0x2675b6[_0x6b70('0x30')]['includeAll']){_0x4b6de3[_0x6b70('0x40')]=[{'all':!![]}];}_0x4b6de3=_[_0x6b70('0x3c')]({},_0x4b6de3,_0x2675b6['options']);return db['CmHopperHistory'][_0x6b70('0x46')](_0x4b6de3)[_0x6b70('0x22')](handleEntityNotFound(_0x7a0eec,null))[_0x6b70('0x22')](respondWithResult(_0x7a0eec,null))['catch'](handleError(_0x7a0eec,null));};exports[_0x6b70('0x47')]=function(_0x1a51bc,_0x469828){return db[_0x6b70('0x29')][_0x6b70('0x47')](_0x1a51bc[_0x6b70('0x48')],{})[_0x6b70('0x22')](respondWithResult(_0x469828,0xc9))[_0x6b70('0x42')](handleError(_0x469828,null));};exports[_0x6b70('0x49')]=function(_0x1cc1f1,_0x509232){return db[_0x6b70('0x29')][_0x6b70('0x49')]()[_0x6b70('0x22')](respondWithResult(_0x509232,null))[_0x6b70('0x42')](handleError(_0x509232,null));};exports[_0x6b70('0x4a')]=function(_0x10cc71,_0x58ff25){if(_0x10cc71[_0x6b70('0x48')][_0x6b70('0x4b')]){delete _0x10cc71[_0x6b70('0x48')][_0x6b70('0x4b')];}return db[_0x6b70('0x29')][_0x6b70('0x46')]({'where':{'uniqueid':_0x10cc71['params']['id']}})['then'](handleEntityNotFound(_0x58ff25,null))[_0x6b70('0x22')](saveUpdates(_0x10cc71[_0x6b70('0x48')],null))['then'](respondWithResult(_0x58ff25,null))[_0x6b70('0x42')](handleError(_0x58ff25,null));}; \ No newline at end of file +var _0x3789=['map','CmHopperHistory','rawAttributes','fieldName','key','model','keys','filters','query','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','count','includeAll','include','then','catch','params','fields','length','options','find','body','describe','uniqueid','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','json','offset','limit','status','apply','reject','save','update','destroy','error','stack','name','send','index'];(function(_0x2586d9,_0x117299){var _0x218c88=function(_0x351e3f){while(--_0x351e3f){_0x2586d9['push'](_0x2586d9['shift']());}};_0x218c88(++_0x117299);}(_0x3789,0x6c));var _0x9378=function(_0x4a5b46,_0x178c4b){_0x4a5b46=_0x4a5b46-0x0;var _0x2ef0ef=_0x3789[_0x4a5b46];return _0x2ef0ef;};'use strict';var emlformat=require(_0x9378('0x0'));var rimraf=require(_0x9378('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9378('0x2'));var BPromise=require(_0x9378('0x3'));var Mustache=require(_0x9378('0x4'));var util=require(_0x9378('0x5'));var path=require(_0x9378('0x6'));var sox=require(_0x9378('0x7'));var csv=require(_0x9378('0x8'));var ejs=require(_0x9378('0x9'));var fs=require('fs');var fs_extra=require(_0x9378('0xa'));var _=require(_0x9378('0xb'));var squel=require(_0x9378('0xc'));var crypto=require(_0x9378('0xd'));var jsforce=require(_0x9378('0xe'));var deskjs=require(_0x9378('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9378('0x10'));var Papa=require(_0x9378('0x11'));var Redis=require('ioredis');var authService=require(_0x9378('0x12'));var qs=require(_0x9378('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9378('0x14'));var logger=require(_0x9378('0x15'))(_0x9378('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9378('0x17'))['db'];function respondWithStatusCode(_0x5c68fe,_0x18b17e){_0x18b17e=_0x18b17e||0xcc;return function(_0x1d6099){if(_0x1d6099){return _0x5c68fe[_0x9378('0x18')](_0x18b17e);}return _0x5c68fe['status'](_0x18b17e)[_0x9378('0x19')]();};}function respondWithResult(_0x44a946,_0x2d7859){_0x2d7859=_0x2d7859||0xc8;return function(_0x35820c){if(_0x35820c){return _0x44a946['status'](_0x2d7859)[_0x9378('0x1a')](_0x35820c);}};}function respondWithFilteredResult(_0x5aca6c,_0x4ba741){return function(_0x10d4f1){if(_0x10d4f1){var _0x367a98=_0x10d4f1['count'],_0x3045c3=_0x4ba741[_0x9378('0x1b')],_0x3af768=_0x4ba741[_0x9378('0x1b')]+_0x4ba741[_0x9378('0x1c')],_0x4ecb6b;if(_0x3af768>=_0x367a98){_0x3af768=_0x367a98;_0x4ecb6b=0xc8;}else{_0x4ecb6b=0xce;}_0x5aca6c[_0x9378('0x1d')](_0x4ecb6b);return _0x5aca6c['set']('Content-Range',_0x3045c3+'-'+_0x3af768+'/'+_0x367a98)[_0x9378('0x1a')](_0x10d4f1);}return null;};}function patchUpdates(_0x46b422){return function(_0x62b986){try{jsonpatch[_0x9378('0x1e')](_0x62b986,_0x46b422,!![]);}catch(_0x1a0901){return BPromise[_0x9378('0x1f')](_0x1a0901);}return _0x62b986[_0x9378('0x20')]();};}function saveUpdates(_0x144fc3,_0x9537aa){return function(_0x59f6c2){if(_0x59f6c2){return _0x59f6c2[_0x9378('0x21')](_0x144fc3)['then'](function(_0xa32930){return _0xa32930;});}return null;};}function removeEntity(_0x4d1a45,_0x495bf0){return function(_0x58bb89){if(_0x58bb89){return _0x58bb89[_0x9378('0x22')]()['then'](function(){_0x4d1a45['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18946c,_0xeac4c7){return function(_0x4ce2f0){if(!_0x4ce2f0){_0x18946c['sendStatus'](0x194);}return _0x4ce2f0;};}function handleError(_0x5a61d1,_0x15e617){_0x15e617=_0x15e617||0x1f4;return function(_0x5b2e8f){logger[_0x9378('0x23')](_0x5b2e8f[_0x9378('0x24')]);if(_0x5b2e8f[_0x9378('0x25')]){delete _0x5b2e8f['name'];}_0x5a61d1['status'](_0x15e617)[_0x9378('0x26')](_0x5b2e8f);};}exports[_0x9378('0x27')]=function(_0x5bde68,_0x11b3e0){var _0x17136f={},_0x4e14ed={},_0x459577={'count':0x0,'rows':[]};var _0x35cdd1=_[_0x9378('0x28')](db[_0x9378('0x29')][_0x9378('0x2a')],function(_0x3d304e){return{'name':_0x3d304e[_0x9378('0x2b')],'type':_0x3d304e['type'][_0x9378('0x2c')]};});_0x4e14ed[_0x9378('0x2d')]=_['map'](_0x35cdd1,_0x9378('0x25'));_0x4e14ed['query']=_[_0x9378('0x2e')](_0x5bde68['query']);_0x4e14ed[_0x9378('0x2f')]=_['intersection'](_0x4e14ed[_0x9378('0x2d')],_0x4e14ed[_0x9378('0x30')]);_0x17136f[_0x9378('0x31')]=_[_0x9378('0x32')](_0x4e14ed[_0x9378('0x2d')],qs['fields'](_0x5bde68['query']['fields']));_0x17136f[_0x9378('0x31')]=_0x17136f[_0x9378('0x31')]['length']?_0x17136f[_0x9378('0x31')]:_0x4e14ed[_0x9378('0x2d')];if(!_0x5bde68[_0x9378('0x30')][_0x9378('0x33')](_0x9378('0x34'))){_0x17136f[_0x9378('0x1c')]=qs['limit'](_0x5bde68[_0x9378('0x30')]['limit']);_0x17136f['offset']=qs[_0x9378('0x1b')](_0x5bde68[_0x9378('0x30')][_0x9378('0x1b')]);}_0x17136f[_0x9378('0x35')]=qs[_0x9378('0x36')](_0x5bde68[_0x9378('0x30')][_0x9378('0x36')]);_0x17136f[_0x9378('0x37')]=qs[_0x9378('0x2f')](_[_0x9378('0x38')](_0x5bde68[_0x9378('0x30')],_0x4e14ed[_0x9378('0x2f')]),_0x35cdd1);if(_0x5bde68['query']['filter']){_0x17136f[_0x9378('0x37')]=_[_0x9378('0x39')](_0x17136f[_0x9378('0x37')],{'$or':_[_0x9378('0x28')](_0x35cdd1,function(_0x3320c3){if(_0x3320c3[_0x9378('0x3a')]!==_0x9378('0x3b')){var _0x372f85={};_0x372f85[_0x3320c3['name']]={'$like':'%'+_0x5bde68[_0x9378('0x30')][_0x9378('0x3c')]+'%'};return _0x372f85;}})});}_0x17136f=_['merge']({},_0x17136f,_0x5bde68['options']);var _0x4c67fe={'where':_0x17136f[_0x9378('0x37')]};return db['CmHopperHistory'][_0x9378('0x3d')](_0x4c67fe)['then'](function(_0x4deea5){_0x459577[_0x9378('0x3d')]=_0x4deea5;if(_0x5bde68[_0x9378('0x30')][_0x9378('0x3e')]){_0x17136f[_0x9378('0x3f')]=[{'all':!![]}];}return db[_0x9378('0x29')]['findAll'](_0x17136f);})[_0x9378('0x40')](function(_0x347f57){_0x459577['rows']=_0x347f57;return _0x459577;})[_0x9378('0x40')](respondWithFilteredResult(_0x11b3e0,_0x17136f))[_0x9378('0x41')](handleError(_0x11b3e0,null));};exports['show']=function(_0x403f53,_0xa92447){var _0x463afd={'raw':!![],'where':{'id':_0x403f53[_0x9378('0x42')]['id']}},_0x16b2cc={};_0x16b2cc[_0x9378('0x2d')]=_[_0x9378('0x2e')](db['CmHopperHistory']['rawAttributes']);_0x16b2cc[_0x9378('0x30')]=_['keys'](_0x403f53[_0x9378('0x30')]);_0x16b2cc[_0x9378('0x2f')]=_[_0x9378('0x32')](_0x16b2cc[_0x9378('0x2d')],_0x16b2cc[_0x9378('0x30')]);_0x463afd[_0x9378('0x31')]=_[_0x9378('0x32')](_0x16b2cc[_0x9378('0x2d')],qs[_0x9378('0x43')](_0x403f53[_0x9378('0x30')][_0x9378('0x43')]));_0x463afd[_0x9378('0x31')]=_0x463afd[_0x9378('0x31')][_0x9378('0x44')]?_0x463afd[_0x9378('0x31')]:_0x16b2cc[_0x9378('0x2d')];if(_0x403f53[_0x9378('0x30')][_0x9378('0x3e')]){_0x463afd['include']=[{'all':!![]}];}_0x463afd=_[_0x9378('0x39')]({},_0x463afd,_0x403f53[_0x9378('0x45')]);return db[_0x9378('0x29')][_0x9378('0x46')](_0x463afd)[_0x9378('0x40')](handleEntityNotFound(_0xa92447,null))[_0x9378('0x40')](respondWithResult(_0xa92447,null))[_0x9378('0x41')](handleError(_0xa92447,null));};exports['create']=function(_0x491c3b,_0x52adc9){return db[_0x9378('0x29')]['create'](_0x491c3b[_0x9378('0x47')],{})[_0x9378('0x40')](respondWithResult(_0x52adc9,0xc9))['catch'](handleError(_0x52adc9,null));};exports[_0x9378('0x48')]=function(_0x3ead24,_0x2f1f28){return db[_0x9378('0x29')][_0x9378('0x48')]()['then'](respondWithResult(_0x2f1f28,null))[_0x9378('0x41')](handleError(_0x2f1f28,null));};exports['update']=function(_0x4c8fc9,_0x45cfba){if(_0x4c8fc9[_0x9378('0x47')][_0x9378('0x49')]){delete _0x4c8fc9['body']['uniqueid'];}return db[_0x9378('0x29')][_0x9378('0x46')]({'where':{'uniqueid':_0x4c8fc9[_0x9378('0x42')]['id']}})[_0x9378('0x40')](handleEntityNotFound(_0x45cfba,null))[_0x9378('0x40')](saveUpdates(_0x4c8fc9[_0x9378('0x47')],null))['then'](respondWithResult(_0x45cfba,null))[_0x9378('0x41')](handleError(_0x45cfba,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index b3797e2..5ef5780 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 _0x1a2f=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','CmHopperHistory','endtime','uniqueid'];(function(_0x182be1,_0x2a511f){var _0x4fb9f1=function(_0x3ca430){while(--_0x3ca430){_0x182be1['push'](_0x182be1['shift']());}};_0x4fb9f1(++_0x2a511f);}(_0x1a2f,0x16c));var _0xf1a2=function(_0x3abfb4,_0x158dba){_0x3abfb4=_0x3abfb4-0x0;var _0x314530=_0x1a2f[_0x3abfb4];return _0x314530;};'use strict';var _=require(_0xf1a2('0x0'));var util=require(_0xf1a2('0x1'));var logger=require(_0xf1a2('0x2'))(_0xf1a2('0x3'));var moment=require('moment');var BPromise=require(_0xf1a2('0x4'));var rp=require(_0xf1a2('0x5'));var fs=require('fs');var path=require(_0xf1a2('0x6'));var rimraf=require('rimraf');var config=require(_0xf1a2('0x7'));var attributes=require('./cmHopperHistory.attributes');module[_0xf1a2('0x8')]=function(_0x5d2fe5,_0x1970fb){return _0x5d2fe5[_0xf1a2('0x9')](_0xf1a2('0xa'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xf1a2('0xb'),'fields':[_0xf1a2('0xb')]},{'name':_0xf1a2('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6450=['path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','uniqueid','lodash','util','moment','bluebird','request-promise'];(function(_0x5b8e76,_0xc97cca){var _0x5debc4=function(_0x59053f){while(--_0x59053f){_0x5b8e76['push'](_0x5b8e76['shift']());}};_0x5debc4(++_0xc97cca);}(_0x6450,0x113));var _0x0645=function(_0x204498,_0xd27c1e){_0x204498=_0x204498-0x0;var _0x31d56e=_0x6450[_0x204498];return _0x31d56e;};'use strict';var _=require(_0x0645('0x0'));var util=require(_0x0645('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0645('0x2'));var BPromise=require(_0x0645('0x3'));var rp=require(_0x0645('0x4'));var fs=require('fs');var path=require(_0x0645('0x5'));var rimraf=require(_0x0645('0x6'));var config=require(_0x0645('0x7'));var attributes=require(_0x0645('0x8'));module[_0x0645('0x9')]=function(_0x45d5a4,_0xc74c6){return _0x45d5a4[_0x0645('0xa')](_0x0645('0xb'),attributes,{'tableName':_0x0645('0xc'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':'uniqueid','fields':[_0x0645('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index f5d6fa0..f58a8f3 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 _0xe0ee=['ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','create','body','options','then','CreateCmHopperHistory','CmHopperHistory','findAll','raw','where','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory'];(function(_0x328c90,_0x2e4215){var _0x29a6d7=function(_0x11e2cd){while(--_0x11e2cd){_0x328c90['push'](_0x328c90['shift']());}};_0x29a6d7(++_0x2e4215);}(_0xe0ee,0x98));var _0xee0e=function(_0x2e19ab,_0x4d527f){_0x2e19ab=_0x2e19ab-0x0;var _0x510981=_0xe0ee[_0x2e19ab];return _0x510981;};'use strict';var _=require(_0xee0e('0x0'));var util=require(_0xee0e('0x1'));var moment=require(_0xee0e('0x2'));var BPromise=require(_0xee0e('0x3'));var rs=require(_0xee0e('0x4'));var fs=require('fs');var Redis=require(_0xee0e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xee0e('0x6'));var logger=require(_0xee0e('0x7'))(_0xee0e('0x8'));var config=require(_0xee0e('0x9'));var jayson=require(_0xee0e('0xa'));var client=jayson[_0xee0e('0xb')][_0xee0e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3cbc8c,_0x468b9b,_0x455de4){return new BPromise(function(_0x16a53c,_0x2a925f){return client[_0xee0e('0xd')](_0x3cbc8c,_0x455de4)['then'](function(_0x46f0b4){logger[_0xee0e('0xe')](_0xee0e('0xf'),_0x468b9b,_0xee0e('0x10'));logger[_0xee0e('0x11')](_0xee0e('0x12'),_0x468b9b,_0xee0e('0x10'),JSON[_0xee0e('0x13')](_0x46f0b4));if(_0x46f0b4[_0xee0e('0x14')]){if(_0x46f0b4[_0xee0e('0x14')]['code']===0x1f4){logger['error'](_0xee0e('0xf'),_0x468b9b,_0x46f0b4[_0xee0e('0x14')][_0xee0e('0x15')]);return _0x2a925f(_0x46f0b4[_0xee0e('0x14')][_0xee0e('0x15')]);}logger['error'](_0xee0e('0xf'),_0x468b9b,_0x46f0b4['error'][_0xee0e('0x15')]);return _0x16a53c(_0x46f0b4[_0xee0e('0x14')]['message']);}else{logger[_0xee0e('0xe')](_0xee0e('0xf'),_0x468b9b,'request\x20sent');_0x16a53c(_0x46f0b4[_0xee0e('0x16')][_0xee0e('0x15')]);}})[_0xee0e('0x17')](function(_0x338bd1){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x468b9b,_0x338bd1);_0x2a925f(_0x338bd1);});});}exports['CreateCmHopperHistory']=function(_0x25159d){var _0x5f1b16=this;return new Promise(function(_0x209e54,_0x22eecf){return db['CmHopperHistory'][_0xee0e('0x18')](_0x25159d[_0xee0e('0x19')],{'raw':_0x25159d['options']?_0x25159d[_0xee0e('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xee0e('0x1b')](function(_0x4b7cf7){logger[_0xee0e('0xe')](_0xee0e('0x1c'),_0x25159d);logger['debug'](_0xee0e('0x1c'),_0x25159d,JSON[_0xee0e('0x13')](_0x4b7cf7));_0x209e54(_0x4b7cf7);})[_0xee0e('0x17')](function(_0x46a089){logger[_0xee0e('0x14')](_0xee0e('0x1c'),_0x46a089[_0xee0e('0x15')],_0x25159d);_0x22eecf(_0x5f1b16[_0xee0e('0x14')](0x1f4,_0x46a089[_0xee0e('0x15')]));});});};exports['AvgHandleTime']=function(_0x20ae98){var _0x13c264=this;return new Promise(function(_0x3e4d15,_0x84e51){return db[_0xee0e('0x1d')][_0xee0e('0x1e')]({'raw':_0x20ae98[_0xee0e('0x1a')]?_0x20ae98[_0xee0e('0x1a')][_0xee0e('0x1f')]===undefined?!![]:![]:!![],'where':_0x20ae98['options']?_0x20ae98[_0xee0e('0x1a')][_0xee0e('0x20')]||null:null,'attributes':[[db['sequelize']['fn'](_0xee0e('0x21'),db[_0xee0e('0x22')][_0xee0e('0x23')]('id')),_0xee0e('0x24')],[db['sequelize']['fn'](_0xee0e('0x21'),db[_0xee0e('0x22')]['fn']('IF',db[_0xee0e('0x22')][_0xee0e('0x25')](_0xee0e('0x26')))),_0xee0e('0x27')],[db[_0xee0e('0x22')]['fn'](_0xee0e('0x21'),db['sequelize']['fn']('IF',db[_0xee0e('0x22')][_0xee0e('0x25')](_0xee0e('0x28')))),_0xee0e('0x29')],[db[_0xee0e('0x22')]['fn'](_0xee0e('0x21'),db[_0xee0e('0x22')]['fn']('IF',db[_0xee0e('0x22')][_0xee0e('0x25')](_0xee0e('0x2a')))),_0xee0e('0x2b')],[db[_0xee0e('0x22')]['fn'](_0xee0e('0x2c'),db[_0xee0e('0x22')]['fn']('IF',db[_0xee0e('0x22')][_0xee0e('0x25')](_0xee0e('0x2d')))),_0xee0e('0x2e')],[db[_0xee0e('0x22')]['fn'](_0xee0e('0x2c'),db[_0xee0e('0x22')]['fn']('IF',db[_0xee0e('0x22')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xee0e('0x2f')]]})[_0xee0e('0x1b')](function(_0x5b6ede){logger[_0xee0e('0xe')](_0xee0e('0x30'),_0x20ae98);logger[_0xee0e('0x11')]('AvgHandleTime',_0x20ae98,JSON[_0xee0e('0x13')](_0x5b6ede));_0x3e4d15(_0x5b6ede);})[_0xee0e('0x17')](function(_0x349e7b){logger[_0xee0e('0x14')](_0xee0e('0x30'),_0x349e7b[_0xee0e('0x15')],_0x20ae98);_0x84e51(_0x13c264[_0xee0e('0x14')](0x1f4,_0x349e7b['message']));});});};exports[_0xee0e('0x31')]=function(_0x55a291){var _0xc7e1c9=this;return new Promise(function(_0x4f1e6a,_0x317393){return db[_0xee0e('0x1d')][_0xee0e('0x1e')]({'raw':_0x55a291[_0xee0e('0x1a')]?_0x55a291['options'][_0xee0e('0x1f')]===undefined?!![]:![]:!![],'where':_0x55a291[_0xee0e('0x1a')]?_0x55a291[_0xee0e('0x1a')][_0xee0e('0x20')]||null:null,'attributes':[[_0xee0e('0x32'),_0xee0e('0x33')],[db['sequelize']['fn'](_0xee0e('0x21'),db[_0xee0e('0x22')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xee0e('0x34')],[db[_0xee0e('0x22')]['fn'](_0xee0e('0x21'),db[_0xee0e('0x22')]['fn']('IF',db[_0xee0e('0x22')]['literal'](_0xee0e('0x35')))),_0xee0e('0x36')],[db['sequelize']['fn']('COUNT',db[_0xee0e('0x22')]['fn']('IF',db[_0xee0e('0x22')][_0xee0e('0x25')](_0xee0e('0x26')))),_0xee0e('0x37')],[db[_0xee0e('0x22')]['fn'](_0xee0e('0x21'),db[_0xee0e('0x22')]['fn']('IF',db[_0xee0e('0x22')][_0xee0e('0x25')](_0xee0e('0x38')))),_0xee0e('0x39')],[db[_0xee0e('0x22')]['fn']('COUNT',db[_0xee0e('0x22')]['fn']('IF',db[_0xee0e('0x22')][_0xee0e('0x25')](_0xee0e('0x3a')))),'outboundCongestionCallsDay'],[db[_0xee0e('0x22')]['fn'](_0xee0e('0x21'),db[_0xee0e('0x22')]['fn']('IF',db[_0xee0e('0x22')]['literal'](_0xee0e('0x3b')))),'outboundDropCallsDayTimeout'],[db[_0xee0e('0x22')]['fn'](_0xee0e('0x21'),db['sequelize']['fn']('IF',db[_0xee0e('0x22')][_0xee0e('0x25')](_0xee0e('0x3c')))),_0xee0e('0x3d')],[db['sequelize']['fn'](_0xee0e('0x21'),db['sequelize']['fn']('IF',db[_0xee0e('0x22')][_0xee0e('0x25')](_0xee0e('0x3e')))),_0xee0e('0x3f')],[db[_0xee0e('0x22')]['fn'](_0xee0e('0x21'),db[_0xee0e('0x22')]['fn']('IF',db[_0xee0e('0x22')][_0xee0e('0x25')](_0xee0e('0x40')))),_0xee0e('0x41')],[db[_0xee0e('0x22')]['fn'](_0xee0e('0x21'),db[_0xee0e('0x22')]['fn']('IF',db['sequelize'][_0xee0e('0x25')]('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db[_0xee0e('0x22')]['fn'](_0xee0e('0x21'),db['sequelize']['fn']('IF',db[_0xee0e('0x22')][_0xee0e('0x25')](_0xee0e('0x42')))),_0xee0e('0x43')],[db[_0xee0e('0x22')]['fn']('COUNT',db[_0xee0e('0x22')]['fn']('IF',db[_0xee0e('0x22')][_0xee0e('0x25')](_0xee0e('0x44')))),_0xee0e('0x45')],[db[_0xee0e('0x22')]['fn'](_0xee0e('0x21'),db[_0xee0e('0x22')]['fn']('IF',db[_0xee0e('0x22')]['literal'](_0xee0e('0x46')))),_0xee0e('0x43')],[db[_0xee0e('0x22')]['fn'](_0xee0e('0x21'),db[_0xee0e('0x22')]['fn']('IF',db[_0xee0e('0x22')][_0xee0e('0x25')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xee0e('0x47')]],'group':[_0xee0e('0x32')]})[_0xee0e('0x1b')](function(_0x51ab50){logger['info'](_0xee0e('0x31'),_0x55a291);logger[_0xee0e('0x11')](_0xee0e('0x31'),_0x55a291,JSON[_0xee0e('0x13')](_0x51ab50));_0x4f1e6a(_0x51ab50);})[_0xee0e('0x17')](function(_0x39d034){logger['error'](_0xee0e('0x31'),_0x39d034[_0xee0e('0x15')],_0x55a291);_0x317393(_0xc7e1c9[_0xee0e('0x14')](0x1f4,_0x39d034[_0xee0e('0x15')]));});});};exports[_0xee0e('0x48')]=function(_0x4935c8){var _0x205eac=this;return new Promise(function(_0x1120f3,_0x1496cc){return db[_0xee0e('0x1d')]['findAll']({'raw':_0x4935c8['options']?_0x4935c8[_0xee0e('0x1a')][_0xee0e('0x1f')]===undefined?!![]:![]:!![],'where':_0x4935c8[_0xee0e('0x1a')]?_0x4935c8[_0xee0e('0x1a')][_0xee0e('0x20')]||null:null,'attributes':[[_0xee0e('0x32'),_0xee0e('0x33')],[db['sequelize']['fn'](_0xee0e('0x21'),db[_0xee0e('0x22')][_0xee0e('0x23')]('id')),_0xee0e('0x49')],[db[_0xee0e('0x22')]['fn'](_0xee0e('0x21'),db[_0xee0e('0x22')]['fn']('IF',db[_0xee0e('0x22')][_0xee0e('0x25')]('`state`\x20=\x204,\x201,\x20null'))),_0xee0e('0x4a')]],'group':[_0xee0e('0x32')]})[_0xee0e('0x1b')](function(_0x3db1f5){logger['info'](_0xee0e('0x48'),_0x4935c8);logger[_0xee0e('0x11')](_0xee0e('0x48'),_0x4935c8,JSON[_0xee0e('0x13')](_0x3db1f5));_0x1120f3(_0x3db1f5);})[_0xee0e('0x17')](function(_0x5a14e4){logger[_0xee0e('0x14')](_0xee0e('0x48'),_0x5a14e4['message'],_0x4935c8);_0x1496cc(_0x205eac[_0xee0e('0x14')](0x1f4,_0x5a14e4['message']));});});}; \ No newline at end of file +var _0xa477=['`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','col','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','stringify','error','CmHopperHistory,\x20%s,\x20%s','message','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','then','AvgHandleTime','sequelize','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','where','campaign','name','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit'];(function(_0x498fe6,_0x3a49b5){var _0x4f26be=function(_0x274e3d){while(--_0x274e3d){_0x498fe6['push'](_0x498fe6['shift']());}};_0x4f26be(++_0x3a49b5);}(_0xa477,0x127));var _0x7a47=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xa477[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x7a47('0x0'));var util=require('util');var moment=require(_0x7a47('0x1'));var BPromise=require('bluebird');var rs=require(_0x7a47('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a47('0x3'))['db'];var utils=require(_0x7a47('0x4'));var logger=require(_0x7a47('0x5'))(_0x7a47('0x6'));var config=require(_0x7a47('0x7'));var jayson=require(_0x7a47('0x8'));var client=jayson['client'][_0x7a47('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9cce25,_0x4552a1,_0x304233){return new BPromise(function(_0x235a79,_0x47540b){return client[_0x7a47('0xa')](_0x9cce25,_0x304233)['then'](function(_0xba1b0f){logger[_0x7a47('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x4552a1,_0x7a47('0xc'));logger[_0x7a47('0xd')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x4552a1,_0x7a47('0xc'),JSON[_0x7a47('0xe')](_0xba1b0f));if(_0xba1b0f[_0x7a47('0xf')]){if(_0xba1b0f[_0x7a47('0xf')]['code']===0x1f4){logger['error'](_0x7a47('0x10'),_0x4552a1,_0xba1b0f[_0x7a47('0xf')][_0x7a47('0x11')]);return _0x47540b(_0xba1b0f[_0x7a47('0xf')]['message']);}logger['error'](_0x7a47('0x10'),_0x4552a1,_0xba1b0f['error'][_0x7a47('0x11')]);return _0x235a79(_0xba1b0f[_0x7a47('0xf')][_0x7a47('0x11')]);}else{logger[_0x7a47('0xb')](_0x7a47('0x10'),_0x4552a1,_0x7a47('0xc'));_0x235a79(_0xba1b0f['result']['message']);}})[_0x7a47('0x12')](function(_0x70f088){logger['error'](_0x7a47('0x10'),_0x4552a1,_0x70f088);_0x47540b(_0x70f088);});});}exports[_0x7a47('0x13')]=function(_0x4ec5b5){var _0x27d72c=this;return new Promise(function(_0x16c75e,_0x273266){return db[_0x7a47('0x14')]['create'](_0x4ec5b5[_0x7a47('0x15')],{'raw':_0x4ec5b5['options']?_0x4ec5b5[_0x7a47('0x16')][_0x7a47('0x17')]===undefined?!![]:![]:!![]})[_0x7a47('0x18')](function(_0x2cb7aa){logger[_0x7a47('0xb')]('CreateCmHopperHistory',_0x4ec5b5);logger[_0x7a47('0xd')](_0x7a47('0x13'),_0x4ec5b5,JSON['stringify'](_0x2cb7aa));_0x16c75e(_0x2cb7aa);})[_0x7a47('0x12')](function(_0x340d18){logger[_0x7a47('0xf')]('CreateCmHopperHistory',_0x340d18['message'],_0x4ec5b5);_0x273266(_0x27d72c[_0x7a47('0xf')](0x1f4,_0x340d18['message']));});});};exports[_0x7a47('0x19')]=function(_0x32aa6d){var _0x477823=this;return new Promise(function(_0x4951ff,_0x5705cd){return db[_0x7a47('0x14')]['findAll']({'raw':_0x32aa6d[_0x7a47('0x16')]?_0x32aa6d[_0x7a47('0x16')][_0x7a47('0x17')]===undefined?!![]:![]:!![],'where':_0x32aa6d[_0x7a47('0x16')]?_0x32aa6d[_0x7a47('0x16')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x7a47('0x1a')]['col']('id')),_0x7a47('0x1b')],[db['sequelize']['fn'](_0x7a47('0x1c'),db['sequelize']['fn']('IF',db['sequelize'][_0x7a47('0x1d')](_0x7a47('0x1e')))),_0x7a47('0x1f')],[db[_0x7a47('0x1a')]['fn'](_0x7a47('0x1c'),db[_0x7a47('0x1a')]['fn']('IF',db[_0x7a47('0x1a')]['literal'](_0x7a47('0x20')))),_0x7a47('0x21')],[db[_0x7a47('0x1a')]['fn'](_0x7a47('0x1c'),db['sequelize']['fn']('IF',db[_0x7a47('0x1a')][_0x7a47('0x1d')](_0x7a47('0x22')))),_0x7a47('0x23')],[db[_0x7a47('0x1a')]['fn'](_0x7a47('0x24'),db[_0x7a47('0x1a')]['fn']('IF',db['sequelize'][_0x7a47('0x1d')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x7a47('0x25')],[db['sequelize']['fn']('AVG',db[_0x7a47('0x1a')]['fn']('IF',db[_0x7a47('0x1a')][_0x7a47('0x1d')](_0x7a47('0x26')))),_0x7a47('0x27')]]})[_0x7a47('0x18')](function(_0x2b03d4){logger[_0x7a47('0xb')](_0x7a47('0x19'),_0x32aa6d);logger[_0x7a47('0xd')](_0x7a47('0x19'),_0x32aa6d,JSON[_0x7a47('0xe')](_0x2b03d4));_0x4951ff(_0x2b03d4);})[_0x7a47('0x12')](function(_0x38ecdb){logger['error'](_0x7a47('0x19'),_0x38ecdb[_0x7a47('0x11')],_0x32aa6d);_0x5705cd(_0x477823[_0x7a47('0xf')](0x1f4,_0x38ecdb[_0x7a47('0x11')]));});});};exports[_0x7a47('0x28')]=function(_0xc2c73d){var _0x28460f=this;return new Promise(function(_0x65bdc8,_0x498a20){return db[_0x7a47('0x14')][_0x7a47('0x29')]({'raw':_0xc2c73d[_0x7a47('0x16')]?_0xc2c73d[_0x7a47('0x16')][_0x7a47('0x17')]===undefined?!![]:![]:!![],'where':_0xc2c73d[_0x7a47('0x16')]?_0xc2c73d[_0x7a47('0x16')][_0x7a47('0x2a')]||null:null,'attributes':[[_0x7a47('0x2b'),_0x7a47('0x2c')],[db[_0x7a47('0x1a')]['fn'](_0x7a47('0x1c'),db[_0x7a47('0x1a')]['fn']('IF',db['sequelize'][_0x7a47('0x1d')]('`state`\x20=\x200,\x201,\x20null'))),_0x7a47('0x2d')],[db[_0x7a47('0x1a')]['fn'](_0x7a47('0x1c'),db[_0x7a47('0x1a')]['fn']('IF',db[_0x7a47('0x1a')][_0x7a47('0x1d')]('`state`\x20=\x203,\x201,\x20null'))),_0x7a47('0x2e')],[db[_0x7a47('0x1a')]['fn'](_0x7a47('0x1c'),db['sequelize']['fn']('IF',db['sequelize'][_0x7a47('0x1d')]('`state`\x20=\x204,\x201,\x20null'))),_0x7a47('0x2f')],[db[_0x7a47('0x1a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x7a47('0x1d')](_0x7a47('0x30')))),_0x7a47('0x31')],[db[_0x7a47('0x1a')]['fn'](_0x7a47('0x1c'),db[_0x7a47('0x1a')]['fn']('IF',db[_0x7a47('0x1a')][_0x7a47('0x1d')](_0x7a47('0x32')))),_0x7a47('0x33')],[db['sequelize']['fn'](_0x7a47('0x1c'),db[_0x7a47('0x1a')]['fn']('IF',db['sequelize']['literal'](_0x7a47('0x34')))),_0x7a47('0x35')],[db[_0x7a47('0x1a')]['fn'](_0x7a47('0x1c'),db[_0x7a47('0x1a')]['fn']('IF',db[_0x7a47('0x1a')][_0x7a47('0x1d')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x7a47('0x36')],[db[_0x7a47('0x1a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7a47('0x1a')]['literal'](_0x7a47('0x37')))),_0x7a47('0x38')],[db[_0x7a47('0x1a')]['fn'](_0x7a47('0x1c'),db[_0x7a47('0x1a')]['fn']('IF',db[_0x7a47('0x1a')][_0x7a47('0x1d')]('`state`\x20=\x2013,\x201,\x20null'))),_0x7a47('0x39')],[db['sequelize']['fn'](_0x7a47('0x1c'),db[_0x7a47('0x1a')]['fn']('IF',db[_0x7a47('0x1a')][_0x7a47('0x1d')](_0x7a47('0x3a')))),'outboundOriginateFailureCallsDay'],[db[_0x7a47('0x1a')]['fn'](_0x7a47('0x1c'),db[_0x7a47('0x1a')]['fn']('IF',db[_0x7a47('0x1a')][_0x7a47('0x1d')](_0x7a47('0x3b')))),'outboundRejectCallsDay'],[db[_0x7a47('0x1a')]['fn'](_0x7a47('0x1c'),db[_0x7a47('0x1a')]['fn']('IF',db[_0x7a47('0x1a')][_0x7a47('0x1d')](_0x7a47('0x3c')))),_0x7a47('0x3d')],[db[_0x7a47('0x1a')]['fn'](_0x7a47('0x1c'),db['sequelize']['fn']('IF',db[_0x7a47('0x1a')][_0x7a47('0x1d')](_0x7a47('0x3e')))),_0x7a47('0x3f')],[db[_0x7a47('0x1a')]['fn'](_0x7a47('0x1c'),db[_0x7a47('0x1a')]['fn']('IF',db[_0x7a47('0x1a')]['literal'](_0x7a47('0x40')))),_0x7a47('0x41')]],'group':[_0x7a47('0x2b')]})[_0x7a47('0x18')](function(_0x4a50b0){logger['info'](_0x7a47('0x28'),_0xc2c73d);logger[_0x7a47('0xd')](_0x7a47('0x28'),_0xc2c73d,JSON['stringify'](_0x4a50b0));_0x65bdc8(_0x4a50b0);})[_0x7a47('0x12')](function(_0x4126e0){logger[_0x7a47('0xf')](_0x7a47('0x28'),_0x4126e0[_0x7a47('0x11')],_0xc2c73d);_0x498a20(_0x28460f[_0x7a47('0xf')](0x1f4,_0x4126e0[_0x7a47('0x11')]));});});};exports[_0x7a47('0x42')]=function(_0x168c24){var _0x2633df=this;return new Promise(function(_0xe6050b,_0x2a3716){return db['CmHopperHistory'][_0x7a47('0x29')]({'raw':_0x168c24[_0x7a47('0x16')]?_0x168c24[_0x7a47('0x16')][_0x7a47('0x17')]===undefined?!![]:![]:!![],'where':_0x168c24[_0x7a47('0x16')]?_0x168c24[_0x7a47('0x16')][_0x7a47('0x2a')]||null:null,'attributes':[[_0x7a47('0x2b'),'name'],[db[_0x7a47('0x1a')]['fn'](_0x7a47('0x1c'),db[_0x7a47('0x1a')][_0x7a47('0x43')]('id')),_0x7a47('0x44')],[db[_0x7a47('0x1a')]['fn'](_0x7a47('0x1c'),db[_0x7a47('0x1a')]['fn']('IF',db[_0x7a47('0x1a')][_0x7a47('0x1d')](_0x7a47('0x1e')))),_0x7a47('0x45')]],'group':['campaign']})[_0x7a47('0x18')](function(_0x5abe81){logger[_0x7a47('0xb')](_0x7a47('0x42'),_0x168c24);logger['debug'](_0x7a47('0x42'),_0x168c24,JSON[_0x7a47('0xe')](_0x5abe81));_0xe6050b(_0x5abe81);})[_0x7a47('0x12')](function(_0x26bc2d){logger[_0x7a47('0xf')](_0x7a47('0x42'),_0x26bc2d[_0x7a47('0x11')],_0x168c24);_0x2a3716(_0x2633df[_0x7a47('0xf')](0x1f4,_0x26bc2d['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 945d101..8dbeada 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 _0x282c=['../../config/environment','./cmHopperHistory.controller','isAuthenticated','get','/describe','describe','/:id','show','create','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x155786,_0x106f61){var _0x26c4c5=function(_0x1fca27){while(--_0x1fca27){_0x155786['push'](_0x155786['shift']());}};_0x26c4c5(++_0x106f61);}(_0x282c,0x14c));var _0xc282=function(_0x17df19,_0x4f305c){_0x17df19=_0x17df19-0x0;var _0x4fed44=_0x282c[_0x17df19];return _0x4fed44;};'use strict';var multer=require(_0xc282('0x0'));var util=require(_0xc282('0x1'));var path=require('path');var timeout=require(_0xc282('0x2'));var express=require(_0xc282('0x3'));var router=express[_0xc282('0x4')]();var fs_extra=require(_0xc282('0x5'));var auth=require(_0xc282('0x6'));var interaction=require(_0xc282('0x7'));var config=require(_0xc282('0x8'));var controller=require(_0xc282('0x9'));router['get']('/',auth[_0xc282('0xa')](),controller['index']);router[_0xc282('0xb')](_0xc282('0xc'),auth[_0xc282('0xa')](),controller[_0xc282('0xd')]);router[_0xc282('0xb')](_0xc282('0xe'),auth['isAuthenticated'](),controller[_0xc282('0xf')]);router['post']('/',auth[_0xc282('0xa')](),controller[_0xc282('0x10')]);router[_0xc282('0x11')]('/:id',auth[_0xc282('0xa')](),controller[_0xc282('0x12')]);module[_0xc282('0x13')]=router; \ No newline at end of file +var _0x58a1=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe','post','create','put','/:id','update','exports','multer','util','path','connect-timeout'];(function(_0x56e32e,_0x9eb2f6){var _0x2a757b=function(_0x50b7bc){while(--_0x50b7bc){_0x56e32e['push'](_0x56e32e['shift']());}};_0x2a757b(++_0x9eb2f6);}(_0x58a1,0x12c));var _0x158a=function(_0x5f5c59,_0x169b7c){_0x5f5c59=_0x5f5c59-0x0;var _0x5a5f48=_0x58a1[_0x5f5c59];return _0x5a5f48;};'use strict';var multer=require(_0x158a('0x0'));var util=require(_0x158a('0x1'));var path=require(_0x158a('0x2'));var timeout=require(_0x158a('0x3'));var express=require(_0x158a('0x4'));var router=express[_0x158a('0x5')]();var fs_extra=require(_0x158a('0x6'));var auth=require(_0x158a('0x7'));var interaction=require(_0x158a('0x8'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0x158a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x158a('0x9')](_0x158a('0xa'),auth[_0x158a('0xb')](),controller[_0x158a('0xc')]);router[_0x158a('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x158a('0xd')]('/',auth[_0x158a('0xb')](),controller[_0x158a('0xe')]);router[_0x158a('0xf')](_0x158a('0x10'),auth[_0x158a('0xb')](),controller[_0x158a('0x11')]);module[_0x158a('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 607122f..03a4440 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 _0x4cae=['sequelize','exports','STRING'];(function(_0x16ba78,_0x1dcb13){var _0x445c21=function(_0x3ea464){while(--_0x3ea464){_0x16ba78['push'](_0x16ba78['shift']());}};_0x445c21(++_0x1dcb13);}(_0x4cae,0x1ce));var _0xe4ca=function(_0x4507aa,_0x5e2248){_0x4507aa=_0x4507aa-0x0;var _0x4858e3=_0x4cae[_0x4507aa];return _0x4858e3;};'use strict';var Sequelize=require(_0xe4ca('0x0'));module[_0xe4ca('0x1')]={'name':{'type':Sequelize[_0xe4ca('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe4ca('0x2')]},'dialPrefix':{'type':Sequelize[_0xe4ca('0x2')]}}; \ No newline at end of file +var _0xb638=['sequelize','exports','STRING','name'];(function(_0x1dd697,_0x5c704f){var _0x565e7b=function(_0x4f6ce0){while(--_0x4f6ce0){_0x1dd697['push'](_0x1dd697['shift']());}};_0x565e7b(++_0x5c704f);}(_0xb638,0x7c));var _0x8b63=function(_0x2debb9,_0x3994a3){_0x2debb9=_0x2debb9-0x0;var _0x491130=_0xb638[_0x2debb9];return _0x491130;};'use strict';var Sequelize=require(_0x8b63('0x0'));module[_0x8b63('0x1')]={'name':{'type':Sequelize[_0x8b63('0x2')],'unique':_0x8b63('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8b63('0x2')]},'dialPrefix':{'type':Sequelize[_0x8b63('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 608c0bd..077958b 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 _0xb570=['spread','emit','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','map','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','CmList','findAll','catch','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','describe','addDisposition','ListId','Disposition','findOne','filter','rows','removeDispositions','ids','CmContact','isArray','tags','join','push','each','omit','dataValues','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','format','raw','cf_%d','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','Sequelize','TEXT','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cf_%s','getCustomFields','addAgents'];(function(_0x5a0779,_0x3eebaa){var _0x19d5c6=function(_0x27fcf7){while(--_0x27fcf7){_0x5a0779['push'](_0x5a0779['shift']());}};_0x19d5c6(++_0x3eebaa);}(_0xb570,0x11c));var _0x0b57=function(_0x337cc6,_0x572d90){_0x337cc6=_0x337cc6-0x0;var _0x397f82=_0xb570[_0x337cc6];return _0x397f82;};'use strict';var emlformat=require(_0x0b57('0x0'));var rimraf=require(_0x0b57('0x1'));var zipdir=require(_0x0b57('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0b57('0x3'));var BPromise=require(_0x0b57('0x4'));var Mustache=require(_0x0b57('0x5'));var util=require('util');var path=require(_0x0b57('0x6'));var sox=require(_0x0b57('0x7'));var csv=require('to-csv');var ejs=require(_0x0b57('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b57('0x9'));var squel=require(_0x0b57('0xa'));var crypto=require('crypto');var jsforce=require(_0x0b57('0xb'));var deskjs=require(_0x0b57('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0b57('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0b57('0xe'));var qs=require(_0x0b57('0xf'));var as=require(_0x0b57('0x10'));var hardwareService=require(_0x0b57('0x11'));var logger=require(_0x0b57('0x12'))(_0x0b57('0x13'));var utils=require(_0x0b57('0x14'));var config=require(_0x0b57('0x15'));var licenseUtil=require(_0x0b57('0x16'));var db=require('../../mysqldb')['db'];config[_0x0b57('0x17')]=_[_0x0b57('0x18')](config[_0x0b57('0x17')],{'host':_0x0b57('0x19'),'port':0x18eb});var socket=require(_0x0b57('0x1a'))(new Redis(config[_0x0b57('0x17')]));require(_0x0b57('0x1b'))[_0x0b57('0x1c')](socket);function respondWithStatusCode(_0x5a3a0c,_0x4b15e3){_0x4b15e3=_0x4b15e3||0xcc;return function(_0xb721c2){if(_0xb721c2){return _0x5a3a0c[_0x0b57('0x1d')](_0x4b15e3);}return _0x5a3a0c[_0x0b57('0x1e')](_0x4b15e3)[_0x0b57('0x1f')]();};}function respondWithResult(_0x42c62d,_0x417811){_0x417811=_0x417811||0xc8;return function(_0x1895e6){if(_0x1895e6){return _0x42c62d[_0x0b57('0x1e')](_0x417811)['json'](_0x1895e6);}};}function respondWithFilteredResult(_0xd4d10e,_0x1b0f10){return function(_0x5715f7){if(_0x5715f7){var _0x404158=_0x5715f7[_0x0b57('0x20')],_0x36f4b7=_0x1b0f10[_0x0b57('0x21')],_0x2a038c=_0x1b0f10[_0x0b57('0x21')]+_0x1b0f10[_0x0b57('0x22')],_0x56ea36;if(_0x2a038c>=_0x404158){_0x2a038c=_0x404158;_0x56ea36=0xc8;}else{_0x56ea36=0xce;}_0xd4d10e[_0x0b57('0x1e')](_0x56ea36);return _0xd4d10e['set'](_0x0b57('0x23'),_0x36f4b7+'-'+_0x2a038c+'/'+_0x404158)[_0x0b57('0x24')](_0x5715f7);}return null;};}function patchUpdates(_0x3ec1a7){return function(_0xa39017){try{jsonpatch[_0x0b57('0x25')](_0xa39017,_0x3ec1a7,!![]);}catch(_0x57fa2e){return BPromise[_0x0b57('0x26')](_0x57fa2e);}return _0xa39017[_0x0b57('0x27')]();};}function saveUpdates(_0x3583de,_0x1b8eaa){return function(_0x2ca149){if(_0x2ca149){return _0x2ca149[_0x0b57('0x28')](_0x3583de)[_0x0b57('0x29')](function(_0x2d8ebd){return _0x2d8ebd;});}return null;};}function removeEntity(_0x498cac,_0x3b315a){return function(_0xd9479a){if(_0xd9479a){return _0xd9479a[_0x0b57('0x2a')]()['then'](function(){var _0x5f421d=_0xd9479a[_0x0b57('0x2b')]({'plain':!![]});var _0x581a99=_0x0b57('0x2c');return db[_0x0b57('0x2d')][_0x0b57('0x2a')]({'where':{'type':_0x581a99,'resourceId':_0x5f421d['id']}})[_0x0b57('0x29')](function(){return _0xd9479a;});})[_0x0b57('0x29')](function(){_0x498cac[_0x0b57('0x1e')](0xcc)[_0x0b57('0x1f')]();});}};}function handleEntityNotFound(_0x5a36e7,_0x49542d){return function(_0x13fc5a){if(!_0x13fc5a){_0x5a36e7[_0x0b57('0x1d')](0x194);}return _0x13fc5a;};}function handleError(_0x16f94b,_0x565f46){_0x565f46=_0x565f46||0x1f4;return function(_0x547fad){logger[_0x0b57('0x2e')](_0x547fad[_0x0b57('0x2f')]);if(_0x547fad['name']){delete _0x547fad[_0x0b57('0x30')];}_0x16f94b[_0x0b57('0x1e')](_0x565f46)[_0x0b57('0x31')](_0x547fad);};}exports[_0x0b57('0x32')]=function(_0x4552f7,_0x1bba72){var _0x444f49={},_0x1267ba={},_0x33c0b4={'count':0x0,'rows':[]};var _0x5e28cf=_[_0x0b57('0x33')](db['CmList']['rawAttributes'],function(_0x313d6a){return{'name':_0x313d6a[_0x0b57('0x34')],'type':_0x313d6a[_0x0b57('0x35')]['key']};});_0x1267ba[_0x0b57('0x36')]=_[_0x0b57('0x33')](_0x5e28cf,'name');_0x1267ba['query']=_[_0x0b57('0x37')](_0x4552f7[_0x0b57('0x38')]);_0x1267ba[_0x0b57('0x39')]=_['intersection'](_0x1267ba[_0x0b57('0x36')],_0x1267ba[_0x0b57('0x38')]);_0x444f49[_0x0b57('0x3a')]=_[_0x0b57('0x3b')](_0x1267ba[_0x0b57('0x36')],qs[_0x0b57('0x3c')](_0x4552f7[_0x0b57('0x38')][_0x0b57('0x3c')]));_0x444f49[_0x0b57('0x3a')]=_0x444f49['attributes'][_0x0b57('0x3d')]?_0x444f49['attributes']:_0x1267ba['model'];if(!_0x4552f7['query'][_0x0b57('0x3e')](_0x0b57('0x3f'))){_0x444f49[_0x0b57('0x22')]=qs[_0x0b57('0x22')](_0x4552f7[_0x0b57('0x38')][_0x0b57('0x22')]);_0x444f49[_0x0b57('0x21')]=qs['offset'](_0x4552f7['query'][_0x0b57('0x21')]);}_0x444f49[_0x0b57('0x40')]=qs[_0x0b57('0x41')](_0x4552f7[_0x0b57('0x38')]['sort']);_0x444f49[_0x0b57('0x42')]=qs['filters'](_[_0x0b57('0x43')](_0x4552f7[_0x0b57('0x38')],_0x1267ba[_0x0b57('0x39')]),_0x5e28cf);if(_0x4552f7[_0x0b57('0x38')]['filter']){_0x444f49['where']=_[_0x0b57('0x44')](_0x444f49[_0x0b57('0x42')],{'$or':_[_0x0b57('0x33')](_0x5e28cf,function(_0x467d52){if(_0x467d52[_0x0b57('0x35')]!==_0x0b57('0x45')){var _0xe3d2ca={};_0xe3d2ca[_0x467d52['name']]={'$like':'%'+_0x4552f7[_0x0b57('0x38')]['filter']+'%'};return _0xe3d2ca;}})});}_0x444f49=_[_0x0b57('0x44')]({},_0x444f49,_0x4552f7[_0x0b57('0x46')]);var _0x325edd={'where':_0x444f49[_0x0b57('0x42')]};return db['CmList'][_0x0b57('0x20')](_0x325edd)[_0x0b57('0x29')](function(_0x2545ff){_0x33c0b4[_0x0b57('0x20')]=_0x2545ff;if(_0x4552f7[_0x0b57('0x38')]['includeAll']){_0x444f49[_0x0b57('0x47')]=[{'all':!![]}];}return db[_0x0b57('0x48')][_0x0b57('0x49')](_0x444f49);})[_0x0b57('0x29')](function(_0x2c557f){_0x33c0b4['rows']=_0x2c557f;return _0x33c0b4;})[_0x0b57('0x29')](respondWithFilteredResult(_0x1bba72,_0x444f49))[_0x0b57('0x4a')](handleError(_0x1bba72,null));};exports['show']=function(_0x3e8191,_0x3fcad4){var _0x5cb1b9={'raw':![],'where':{'id':_0x3e8191['params']['id']}},_0xf983dc={};_0xf983dc['model']=_[_0x0b57('0x37')](db[_0x0b57('0x48')][_0x0b57('0x4b')]);_0xf983dc['query']=_['keys'](_0x3e8191['query']);_0xf983dc[_0x0b57('0x39')]=_[_0x0b57('0x3b')](_0xf983dc[_0x0b57('0x36')],_0xf983dc[_0x0b57('0x38')]);_0x5cb1b9[_0x0b57('0x3a')]=_['intersection'](_0xf983dc['model'],qs[_0x0b57('0x3c')](_0x3e8191[_0x0b57('0x38')][_0x0b57('0x3c')]));_0x5cb1b9[_0x0b57('0x3a')]=_0x5cb1b9[_0x0b57('0x3a')]['length']?_0x5cb1b9['attributes']:_0xf983dc[_0x0b57('0x36')];if(_0x3e8191[_0x0b57('0x38')]['includeAll']){_0x5cb1b9[_0x0b57('0x47')]=[{'all':!![]}];}_0x5cb1b9=_[_0x0b57('0x44')]({},_0x5cb1b9,_0x3e8191[_0x0b57('0x46')]);return db[_0x0b57('0x48')]['find'](_0x5cb1b9)['then'](handleEntityNotFound(_0x3fcad4,null))[_0x0b57('0x29')](respondWithResult(_0x3fcad4,null))[_0x0b57('0x4a')](handleError(_0x3fcad4,null));};exports['create']=function(_0x5eb033,_0x87fd65){return db['CmList'][_0x0b57('0x4c')](_0x5eb033['body'],{})['then'](function(_0x2cc561){var _0x1bc5b8=_0x5eb033[_0x0b57('0x4d')][_0x0b57('0x2b')]({'plain':!![]});if(!_0x1bc5b8)throw new Error(_0x0b57('0x4e'));if(_0x1bc5b8[_0x0b57('0x4f')]===_0x0b57('0x4d')){var _0x26a219=_0x2cc561[_0x0b57('0x2b')]({'plain':!![]});var _0x37b001='Lists';return db[_0x0b57('0x50')]['find']({'where':{'name':_0x37b001,'userProfileId':_0x1bc5b8[_0x0b57('0x51')]},'raw':!![]})[_0x0b57('0x29')](function(_0x5f588d){if(_0x5f588d&&_0x5f588d[_0x0b57('0x52')]===0x0){return db[_0x0b57('0x2d')]['create']({'name':_0x26a219['name'],'resourceId':_0x26a219['id'],'type':_0x5f588d[_0x0b57('0x30')],'sectionId':_0x5f588d['id']},{})[_0x0b57('0x29')](function(){return _0x2cc561;});}else{return _0x2cc561;}})['catch'](function(_0x13df16){logger[_0x0b57('0x2e')](_0x0b57('0x53'),_0x13df16);throw _0x13df16;});}return _0x2cc561;})[_0x0b57('0x29')](respondWithResult(_0x87fd65,0xc9))[_0x0b57('0x4a')](handleError(_0x87fd65,null));};exports['update']=function(_0x1f2e3b,_0x113748){if(_0x1f2e3b[_0x0b57('0x54')]['id']){delete _0x1f2e3b['body']['id'];}return db[_0x0b57('0x48')][_0x0b57('0x55')]({'where':{'id':_0x1f2e3b[_0x0b57('0x56')]['id']}})[_0x0b57('0x29')](handleEntityNotFound(_0x113748,null))[_0x0b57('0x29')](saveUpdates(_0x1f2e3b[_0x0b57('0x54')],null))[_0x0b57('0x29')](respondWithResult(_0x113748,null))[_0x0b57('0x4a')](handleError(_0x113748,null));};exports[_0x0b57('0x2a')]=function(_0x3b6027,_0x23ee76){return db[_0x0b57('0x48')][_0x0b57('0x55')]({'where':{'id':_0x3b6027[_0x0b57('0x56')]['id']}})[_0x0b57('0x29')](handleEntityNotFound(_0x23ee76,null))[_0x0b57('0x29')](removeEntity(_0x23ee76,null))[_0x0b57('0x4a')](handleError(_0x23ee76,null));};exports[_0x0b57('0x57')]=function(_0x2800ef,_0x57739c){return db[_0x0b57('0x48')][_0x0b57('0x57')]()[_0x0b57('0x29')](respondWithResult(_0x57739c,null))[_0x0b57('0x4a')](handleError(_0x57739c,null));};exports[_0x0b57('0x58')]=function(_0x574f13,_0x4054a1,_0x597756){if(_0x574f13[_0x0b57('0x54')]['id']){delete _0x574f13[_0x0b57('0x54')]['id'];}return db[_0x0b57('0x48')][_0x0b57('0x55')]({'where':{'id':_0x574f13[_0x0b57('0x56')]['id']}})[_0x0b57('0x29')](handleEntityNotFound(_0x4054a1,null))[_0x0b57('0x29')](function(_0x34071c){if(_0x34071c){_0x574f13['body'][_0x0b57('0x59')]=_0x34071c['id'];return db[_0x0b57('0x5a')][_0x0b57('0x4c')](_0x574f13[_0x0b57('0x54')]);}})[_0x0b57('0x29')](respondWithResult(_0x4054a1,null))[_0x0b57('0x4a')](handleError(_0x4054a1,null));};exports['getDispositions']=function(_0x4bbd5b,_0x53ba4f,_0x2590d5){var _0xe75e9d={'raw':![],'where':{}};var _0x3ab7ed={};var _0x2d35f4={'count':0x0,'rows':[]};return db[_0x0b57('0x48')][_0x0b57('0x5b')]({'where':{'id':_0x4bbd5b[_0x0b57('0x56')]['id']}})[_0x0b57('0x29')](handleEntityNotFound(_0x53ba4f,null))['then'](function(_0x13175d){if(_0x13175d){_0x3ab7ed[_0x0b57('0x36')]=_[_0x0b57('0x37')](db['Disposition'][_0x0b57('0x4b')]);_0x3ab7ed[_0x0b57('0x38')]=_[_0x0b57('0x37')](_0x4bbd5b[_0x0b57('0x38')]);_0x3ab7ed[_0x0b57('0x39')]=_[_0x0b57('0x3b')](_0x3ab7ed[_0x0b57('0x36')],_0x3ab7ed['query']);_0xe75e9d['attributes']=_[_0x0b57('0x3b')](_0x3ab7ed['model'],qs[_0x0b57('0x3c')](_0x4bbd5b[_0x0b57('0x38')]['fields']));_0xe75e9d[_0x0b57('0x3a')]=_0xe75e9d[_0x0b57('0x3a')][_0x0b57('0x3d')]?_0xe75e9d[_0x0b57('0x3a')]:_0x3ab7ed[_0x0b57('0x36')];if(!_0x4bbd5b[_0x0b57('0x38')][_0x0b57('0x3e')](_0x0b57('0x3f'))){_0xe75e9d[_0x0b57('0x22')]=qs[_0x0b57('0x22')](_0x4bbd5b[_0x0b57('0x38')][_0x0b57('0x22')]);_0xe75e9d[_0x0b57('0x21')]=qs[_0x0b57('0x21')](_0x4bbd5b[_0x0b57('0x38')][_0x0b57('0x21')]);}_0xe75e9d[_0x0b57('0x40')]=qs['sort'](_0x4bbd5b[_0x0b57('0x38')]['sort']);_0xe75e9d['where']=qs[_0x0b57('0x39')](_[_0x0b57('0x43')](_0x4bbd5b[_0x0b57('0x38')],_0x3ab7ed['filters']));_0xe75e9d[_0x0b57('0x42')][_0x0b57('0x59')]=_0x13175d['id'];if(_0x4bbd5b[_0x0b57('0x38')][_0x0b57('0x5c')]){_0xe75e9d[_0x0b57('0x42')]=_[_0x0b57('0x44')](_0xe75e9d[_0x0b57('0x42')],{'$or':_[_0x0b57('0x33')](_0xe75e9d['attributes'],function(_0x246f54){var _0x3ca8b0={};_0x3ca8b0[_0x246f54]={'$like':'%'+_0x4bbd5b[_0x0b57('0x38')][_0x0b57('0x5c')]+'%'};return _0x3ca8b0;})});}_0xe75e9d=_[_0x0b57('0x44')]({},_0xe75e9d,_0x4bbd5b[_0x0b57('0x46')]);return db[_0x0b57('0x5a')][_0x0b57('0x20')]({'where':_0xe75e9d[_0x0b57('0x42')]})[_0x0b57('0x29')](function(_0x220d14){_0x2d35f4[_0x0b57('0x20')]=_0x220d14;if(_0x4bbd5b[_0x0b57('0x38')]['includeAll']){_0xe75e9d[_0x0b57('0x47')]=[{'all':!![]}];}return db[_0x0b57('0x5a')]['findAll'](_0xe75e9d);})[_0x0b57('0x29')](function(_0x1cd3a2){_0x2d35f4[_0x0b57('0x5d')]=_0x1cd3a2;return _0x2d35f4;});}})[_0x0b57('0x29')](respondWithFilteredResult(_0x53ba4f,_0xe75e9d))[_0x0b57('0x4a')](handleError(_0x53ba4f,null));};exports[_0x0b57('0x5e')]=function(_0x271c73,_0x4fb6df,_0x47acf2){return db['CmList'][_0x0b57('0x55')]({'where':{'id':_0x271c73['params']['id']}})['then'](handleEntityNotFound(_0x4fb6df,null))[_0x0b57('0x29')](function(_0xc5e365){if(_0xc5e365){return _0xc5e365['removeDispositions'](_0x271c73['query'][_0x0b57('0x5f')]);}})['then'](respondWithStatusCode(_0x4fb6df,null))[_0x0b57('0x4a')](handleError(_0x4fb6df,null));};exports['addContacts']=function(_0x387f15,_0x23fafd,_0x6d52c2){return db[_0x0b57('0x48')][_0x0b57('0x55')]({'where':{'id':_0x387f15[_0x0b57('0x56')]['id']}})[_0x0b57('0x29')](handleEntityNotFound(_0x23fafd,null))['then'](function(_0x2b3650){if(_0x2b3650){var _0x453c45=[];var _0x533823={'success':[],'errors':[]};return db[_0x0b57('0x60')][_0x0b57('0x57')]()[_0x0b57('0x29')](function(_0x1fd3e9){if(_0x387f15[_0x0b57('0x54')]['tags']&&_[_0x0b57('0x61')](_0x387f15[_0x0b57('0x54')]['tags'])){if(_0x387f15[_0x0b57('0x54')]['tags']['length']){_0x387f15['body'][_0x0b57('0x62')]=_0x387f15['body'][_0x0b57('0x62')][_0x0b57('0x63')](';')+';';}else{_0x387f15[_0x0b57('0x54')][_0x0b57('0x62')]=null;}}else{_0x387f15[_0x0b57('0x54')]['tags']=null;}if(_0x387f15[_0x0b57('0x54')]&&_[_0x0b57('0x61')](_0x387f15['body'])){for(var _0x8210a0=0x0;_0x8210a0<_0x387f15[_0x0b57('0x54')]['length'];_0x8210a0+=0x1){_0x387f15[_0x0b57('0x54')][_0x8210a0]['ListId']=_0x387f15['params']['id'];_0x453c45[_0x0b57('0x64')](_0x387f15[_0x0b57('0x54')][_0x8210a0]);}return BPromise[_0x0b57('0x65')](_0x453c45,function(_0x3d68ce){return db[_0x0b57('0x60')]['create'](_[_0x0b57('0x66')](_0x3d68ce,[_0x0b57('0x5f'),'id'])||{},{'fields':_[_0x0b57('0x37')](_0x1fd3e9),'raw':!![]})[_0x0b57('0x29')](function(_0x4c4fba){_0x533823['success'][_0x0b57('0x64')](_0x4c4fba[_0x0b57('0x67')]);})['catch'](function(_0x1a580d){_0x533823['errors'][_0x0b57('0x64')]({'data':_0x3d68ce,'error':_0x1a580d['message']});});})[_0x0b57('0x29')](function(_0x347168){return _0x533823;})[_0x0b57('0x4a')](function(_0x13e563){return _0x13e563;});}else{_0x23fafd['status'](0x190)[_0x0b57('0x24')]({'message':_0x0b57('0x68')});}});}})[_0x0b57('0x29')](respondWithResult(_0x23fafd,null))[_0x0b57('0x4a')](handleError(_0x23fafd,null));};exports[_0x0b57('0x69')]=function(_0x408dbf,_0x16d6a6,_0x3a0c28){var _0x21988e;return db[_0x0b57('0x48')][_0x0b57('0x55')]({'where':{'id':_0x408dbf[_0x0b57('0x56')]['id']},'include':[{'model':db[_0x0b57('0x6a')],'as':'CustomFields'}]})[_0x0b57('0x29')](handleEntityNotFound(_0x16d6a6,null))['then'](function(_0x402b77){if(_0x402b77){_0x21988e=_0x402b77;return db[_0x0b57('0x60')][_0x0b57('0x4b')];}})[_0x0b57('0x29')](function(_0x24d2e5){if(_0x24d2e5){var _0x2e2f68={};var _0x2d0287={};_0x2d0287[_0x0b57('0x36')]=_[_0x0b57('0x6b')](_[_0x0b57('0x37')](_0x24d2e5),_['map'](_0x21988e[_0x0b57('0x6c')],function(_0x2d6efe){return util[_0x0b57('0x6d')]('cf_%d',_0x2d6efe['id']);}));_0x2d0287['query']=_[_0x0b57('0x37')](_0x408dbf['query']);_0x2d0287[_0x0b57('0x39')]=_['intersection'](_0x2d0287[_0x0b57('0x36')],_0x2d0287[_0x0b57('0x38')]);_0x2e2f68[_0x0b57('0x3a')]=_[_0x0b57('0x3b')](_0x2d0287[_0x0b57('0x36')],qs['fields'](_0x408dbf['query'][_0x0b57('0x3c')]));_0x2e2f68[_0x0b57('0x3a')]=_0x2e2f68[_0x0b57('0x3a')][_0x0b57('0x3d')]?_0x2e2f68[_0x0b57('0x3a')]:_0x2d0287['model'];if(!_0x408dbf[_0x0b57('0x38')]['hasOwnProperty']('nolimit')){_0x2e2f68[_0x0b57('0x22')]=qs[_0x0b57('0x22')](_0x408dbf[_0x0b57('0x38')][_0x0b57('0x22')]);_0x2e2f68[_0x0b57('0x21')]=qs['offset'](_0x408dbf['query']['offset']);}_0x2e2f68['order']=qs['sort'](_0x408dbf['query'][_0x0b57('0x41')]);_0x2e2f68['where']=qs['filters'](_[_0x0b57('0x43')](_0x408dbf[_0x0b57('0x38')],_0x2d0287['filters']));_0x2e2f68[_0x0b57('0x6e')]=!![];if(_0x408dbf[_0x0b57('0x38')][_0x0b57('0x5c')]){_0x2e2f68[_0x0b57('0x42')]=_['merge'](_0x2e2f68[_0x0b57('0x42')],{'$or':_['map'](_0x2e2f68[_0x0b57('0x3a')],function(_0x2021c6){var _0x1e25f1={};_0x1e25f1[_0x2021c6]={'$like':'%'+_0x408dbf['query'][_0x0b57('0x5c')]+'%'};return _0x1e25f1;})});}_0x2e2f68=_['merge']({},_0x2e2f68,_0x408dbf['options']);return _0x21988e[_0x0b57('0x69')](_0x2e2f68);}})['then'](respondWithResult(_0x16d6a6,null))['catch'](handleError(_0x16d6a6,null));};exports['getContactsCsv']=function(_0x1f2273,_0x45f865,_0x501d9c){var _0x474aea;return db[_0x0b57('0x48')][_0x0b57('0x55')]({'where':{'id':_0x1f2273['params']['id']},'include':[{'model':db[_0x0b57('0x6a')],'as':_0x0b57('0x6c')}]})[_0x0b57('0x29')](handleEntityNotFound(_0x45f865,null))[_0x0b57('0x29')](function(_0x5bd878){if(_0x5bd878){_0x474aea=_0x5bd878;return db[_0x0b57('0x60')][_0x0b57('0x4b')];}})['then'](function(_0x429a5b){if(_0x429a5b){var _0x341ca3={};var _0x5a0988={};_0x5a0988[_0x0b57('0x36')]=_[_0x0b57('0x6b')](_[_0x0b57('0x37')](_0x429a5b),_[_0x0b57('0x33')](_0x474aea['CustomFields'],function(_0x41893a){return util[_0x0b57('0x6d')](_0x0b57('0x6f'),_0x41893a['id']);}));_0x5a0988[_0x0b57('0x38')]=_[_0x0b57('0x37')](_0x1f2273['query']);_0x5a0988['filters']=_[_0x0b57('0x3b')](_0x5a0988['model'],_0x5a0988[_0x0b57('0x38')]);_0x341ca3[_0x0b57('0x3a')]=_[_0x0b57('0x3b')](_0x5a0988[_0x0b57('0x36')],qs[_0x0b57('0x3c')](_0x1f2273['query']['fields']));_0x341ca3[_0x0b57('0x3a')]=_0x341ca3[_0x0b57('0x3a')]['length']?_0x341ca3['attributes']:_0x5a0988[_0x0b57('0x36')];if(!_0x1f2273[_0x0b57('0x38')][_0x0b57('0x3e')](_0x0b57('0x3f'))){_0x341ca3['limit']=qs[_0x0b57('0x22')](_0x1f2273[_0x0b57('0x38')][_0x0b57('0x22')]);_0x341ca3[_0x0b57('0x21')]=qs['offset'](_0x1f2273[_0x0b57('0x38')][_0x0b57('0x21')]);}_0x341ca3[_0x0b57('0x40')]=qs[_0x0b57('0x41')](_0x1f2273[_0x0b57('0x38')][_0x0b57('0x41')]);_0x341ca3[_0x0b57('0x42')]=qs[_0x0b57('0x39')](_[_0x0b57('0x43')](_0x1f2273['query'],_0x5a0988[_0x0b57('0x39')]));_0x341ca3[_0x0b57('0x6e')]=!![];if(_0x1f2273['query']['filter']){_0x341ca3[_0x0b57('0x42')]=_[_0x0b57('0x44')](_0x341ca3[_0x0b57('0x42')],{'$or':_['map'](_0x341ca3['attributes'],function(_0x487228){var _0x3e1ed6={};_0x3e1ed6[_0x487228]={'$like':'%'+_0x1f2273[_0x0b57('0x38')][_0x0b57('0x5c')]+'%'};return _0x3e1ed6;})});}_0x341ca3=_[_0x0b57('0x44')]({},_0x341ca3,_0x1f2273[_0x0b57('0x46')]);return _0x474aea[_0x0b57('0x69')](_0x341ca3);}})[_0x0b57('0x29')](function(_0x305c1a){if(!_[_0x0b57('0x70')](_0x305c1a)){var _0x3fd841=toCsv(_0x305c1a);var _0x3102e6=Date['now']();fs[_0x0b57('0x71')](util['format'](_0x0b57('0x72'),_0x474aea['id'],_0x3102e6),_0x3fd841);_0x45f865[_0x0b57('0x73')](_0x0b57('0x74'),'attachment;\x20filename='+util[_0x0b57('0x6d')](_0x0b57('0x75'),_0x474aea['id'],_0x3102e6));_0x45f865[_0x0b57('0x73')](_0x0b57('0x76'),'text/csv');return _0x45f865[_0x0b57('0x77')](util['format'](_0x0b57('0x72'),_0x474aea['id'],_0x3102e6));}else{return _0x45f865[_0x0b57('0x1d')](0xcc);}})[_0x0b57('0x4a')](handleError(_0x45f865,null));};exports[_0x0b57('0x78')]=function(_0x1708e4,_0x54ba14,_0x47a979){var _0x43b3b9;delete _0x1708e4[_0x0b57('0x54')]['id'];return db['CmList'][_0x0b57('0x5b')]({'where':{'id':_0x1708e4[_0x0b57('0x56')]['id']}})[_0x0b57('0x29')](handleEntityNotFound(_0x54ba14,null))[_0x0b57('0x29')](function(_0x4f3509){if(_0x4f3509){return db[_0x0b57('0x79')][_0x0b57('0x7a')](function(_0x215a2e){return db[_0x0b57('0x6a')][_0x0b57('0x4c')](_0x1708e4[_0x0b57('0x54')],{'transaction':_0x215a2e})[_0x0b57('0x29')](function(_0x5f3372){_0x43b3b9=_0x5f3372;return _0x4f3509['addCustomFields'](_0x5f3372,{'transaction':_0x215a2e});})[_0x0b57('0x29')](function(){var _0x2d61cf={'type':db[_0x0b57('0x7b')]['TEXT'],'transaction':_0x215a2e};switch(_0x1708e4[_0x0b57('0x54')][_0x0b57('0x35')]){case'text':_0x2d61cf[_0x0b57('0x35')]=db[_0x0b57('0x7b')][_0x0b57('0x7c')];break;case'number':_0x2d61cf[_0x0b57('0x35')]=db[_0x0b57('0x7b')][_0x0b57('0x7d')];break;case _0x0b57('0x7e'):_0x2d61cf[_0x0b57('0x35')]=db['Sequelize'][_0x0b57('0x7f')];_0x2d61cf['defaultValue']=![];break;default:}return db['sequelize'][_0x0b57('0x80')][_0x0b57('0x81')]('cm_contacts',util['format'](_0x0b57('0x82'),_0x43b3b9['id']),_0x2d61cf);})[_0x0b57('0x29')](function(){return _0x43b3b9;});});}})['then'](respondWithResult(_0x54ba14,null))[_0x0b57('0x4a')](handleError(_0x54ba14,null));};exports[_0x0b57('0x83')]=function(_0x256b75,_0x428a90,_0x129991){var _0x532f2f={};var _0x270897={};var _0x4e14e1;var _0x37a1c2;return db[_0x0b57('0x48')][_0x0b57('0x5b')]({'where':{'id':_0x256b75[_0x0b57('0x56')]['id']}})[_0x0b57('0x29')](handleEntityNotFound(_0x428a90,null))[_0x0b57('0x29')](function(_0x476513){if(_0x476513){_0x4e14e1=_0x476513;_0x270897[_0x0b57('0x36')]=_[_0x0b57('0x37')](db[_0x0b57('0x6a')]['rawAttributes']);_0x270897[_0x0b57('0x38')]=_[_0x0b57('0x37')](_0x256b75[_0x0b57('0x38')]);_0x270897[_0x0b57('0x39')]=_[_0x0b57('0x3b')](_0x270897[_0x0b57('0x36')],_0x270897[_0x0b57('0x38')]);_0x532f2f[_0x0b57('0x3a')]=_['intersection'](_0x270897[_0x0b57('0x36')],qs['fields'](_0x256b75['query']['fields']));_0x532f2f['attributes']=_0x532f2f[_0x0b57('0x3a')][_0x0b57('0x3d')]?_0x532f2f[_0x0b57('0x3a')]:_0x270897[_0x0b57('0x36')];_0x532f2f[_0x0b57('0x40')]=qs[_0x0b57('0x41')](_0x256b75[_0x0b57('0x38')][_0x0b57('0x41')]);_0x532f2f[_0x0b57('0x42')]=qs[_0x0b57('0x39')](_['pick'](_0x256b75['query'],_0x270897[_0x0b57('0x39')]));_0x532f2f[_0x0b57('0x42')]=_[_0x0b57('0x44')](_0x532f2f[_0x0b57('0x42')],{'$or':[{'ListId':_0x476513['id']},{'ListId':null}]});if(_0x256b75['query'][_0x0b57('0x5c')]){_0x532f2f[_0x0b57('0x42')]=_[_0x0b57('0x44')](_0x532f2f['where'],{'$or':_[_0x0b57('0x33')](_0x532f2f[_0x0b57('0x3a')],function(_0x347af5){var _0x5bd30c={};_0x5bd30c[_0x347af5]={'$like':'%'+_0x256b75[_0x0b57('0x38')][_0x0b57('0x5c')]+'%'};return _0x5bd30c;})});}_0x532f2f=_['merge']({},_0x532f2f,_0x256b75['options']);return db[_0x0b57('0x6a')]['findAndCountAll'](_0x532f2f);}})[_0x0b57('0x29')](respondWithResult(_0x428a90,null))[_0x0b57('0x4a')](handleError(_0x428a90,null));};exports[_0x0b57('0x84')]=function(_0x3f3579,_0x2e5fa1,_0xe15bfe){return db[_0x0b57('0x48')]['find']({'where':{'id':_0x3f3579['params']['id']}})[_0x0b57('0x29')](handleEntityNotFound(_0x2e5fa1,null))[_0x0b57('0x29')](function(_0x570711){if(_0x570711){return _0x570711[_0x0b57('0x84')](_0x3f3579[_0x0b57('0x54')]['ids'],_[_0x0b57('0x66')](_0x3f3579['body'],[_0x0b57('0x5f'),'id'])||{})[_0x0b57('0x85')](function(_0x495293){for(var _0x3c1a00=0x0;_0x3c1a00<_0x3f3579['body'][_0x0b57('0x5f')][_0x0b57('0x3d')];_0x3c1a00+=0x1){socket[_0x0b57('0x86')]('userCmList:save',{'UserId':_0x3f3579[_0x0b57('0x54')][_0x0b57('0x5f')][_0x3c1a00],'CmListId':_0x3f3579['params']['id']});}return _0x495293;});}})[_0x0b57('0x29')](respondWithResult(_0x2e5fa1,null))[_0x0b57('0x4a')](handleError(_0x2e5fa1,null));};exports[_0x0b57('0x87')]=function(_0x1895b0,_0x36f319,_0x2c75e7){return db[_0x0b57('0x48')]['find']({'where':{'id':_0x1895b0[_0x0b57('0x56')]['id']}})[_0x0b57('0x29')](handleEntityNotFound(_0x36f319,null))[_0x0b57('0x29')](function(_0x32e54c){if(_0x32e54c){return _0x32e54c[_0x0b57('0x87')](_0x1895b0['query'][_0x0b57('0x5f')])[_0x0b57('0x29')](function(){if(_[_0x0b57('0x61')](_0x1895b0[_0x0b57('0x38')][_0x0b57('0x5f')])){for(var _0x36606c=0x0;_0x36606c<_0x1895b0['query'][_0x0b57('0x5f')][_0x0b57('0x3d')];_0x36606c+=0x1){socket['emit'](_0x0b57('0x88'),{'UserId':Number(_0x1895b0['query'][_0x0b57('0x5f')][_0x36606c]),'CmListId':Number(_0x1895b0[_0x0b57('0x56')]['id'])});}}else{socket[_0x0b57('0x86')]('userCmList:remove',{'UserId':Number(_0x1895b0[_0x0b57('0x38')][_0x0b57('0x5f')]),'CmListId':Number(_0x1895b0[_0x0b57('0x56')]['id'])});}});}})[_0x0b57('0x29')](respondWithStatusCode(_0x36f319,null))[_0x0b57('0x4a')](handleError(_0x36f319,null));};exports[_0x0b57('0x89')]=function(_0x5750d3,_0x56b465,_0x2c73ac){var _0x876e9a={};var _0x4bded0={};var _0x527b92;var _0x4a9bc6;return db[_0x0b57('0x48')][_0x0b57('0x5b')]({'where':{'id':_0x5750d3[_0x0b57('0x56')]['id']}})['then'](handleEntityNotFound(_0x56b465,null))[_0x0b57('0x29')](function(_0x4c1ec9){if(_0x4c1ec9){_0x527b92=_0x4c1ec9;_0x4bded0[_0x0b57('0x36')]=_[_0x0b57('0x37')](db[_0x0b57('0x8a')][_0x0b57('0x4b')]);_0x4bded0['query']=_['keys'](_0x5750d3[_0x0b57('0x38')]);_0x4bded0[_0x0b57('0x39')]=_[_0x0b57('0x3b')](_0x4bded0[_0x0b57('0x36')],_0x4bded0[_0x0b57('0x38')]);_0x876e9a['attributes']=_[_0x0b57('0x3b')](_0x4bded0[_0x0b57('0x36')],qs[_0x0b57('0x3c')](_0x5750d3['query'][_0x0b57('0x3c')]));_0x876e9a[_0x0b57('0x3a')]=_0x876e9a[_0x0b57('0x3a')][_0x0b57('0x3d')]?_0x876e9a[_0x0b57('0x3a')]:_0x4bded0[_0x0b57('0x36')];_0x876e9a['order']=qs[_0x0b57('0x41')](_0x5750d3[_0x0b57('0x38')]['sort']);_0x876e9a[_0x0b57('0x42')]=qs[_0x0b57('0x39')](_[_0x0b57('0x43')](_0x5750d3[_0x0b57('0x38')],_0x4bded0[_0x0b57('0x39')]));if(_0x5750d3[_0x0b57('0x38')][_0x0b57('0x5c')]){_0x876e9a[_0x0b57('0x42')]=_[_0x0b57('0x44')](_0x876e9a[_0x0b57('0x42')],{'$or':_['map'](_0x876e9a['attributes'],function(_0x99b3be){var _0x2f0643={};_0x2f0643[_0x99b3be]={'$like':'%'+_0x5750d3[_0x0b57('0x38')][_0x0b57('0x5c')]+'%'};return _0x2f0643;})});}_0x876e9a=_[_0x0b57('0x44')]({},_0x876e9a,_0x5750d3[_0x0b57('0x46')]);return _0x527b92[_0x0b57('0x89')](_0x876e9a);}})['then'](function(_0x22147d){if(_0x22147d){_0x4a9bc6=_0x22147d['length'];if(!_0x5750d3[_0x0b57('0x38')][_0x0b57('0x3e')]('nolimit')){_0x876e9a[_0x0b57('0x22')]=qs[_0x0b57('0x22')](_0x5750d3[_0x0b57('0x38')][_0x0b57('0x22')]);_0x876e9a['offset']=qs[_0x0b57('0x21')](_0x5750d3[_0x0b57('0x38')][_0x0b57('0x21')]);}return _0x527b92[_0x0b57('0x89')](_0x876e9a);}})[_0x0b57('0x29')](function(_0x899f5a){if(_0x899f5a){return _0x899f5a?{'count':_0x4a9bc6,'rows':_0x899f5a}:null;}})[_0x0b57('0x29')](respondWithResult(_0x56b465,null))['catch'](handleError(_0x56b465,null));}; \ No newline at end of file +var _0x0298=['removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','status','end','json','count','offset','set','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','CmList','catch','show','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','find','autoAssociation','describe','addDisposition','ListId','Disposition','getDispositions','findOne','order','includeAll','findAll','rows','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','raw','getContactsCsv','cf_%d','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','sendStatus','addCustomField','transaction','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','cf_%s','findAndCountAll','addAgents','spread','emit','userCmList:save'];(function(_0xe0345f,_0x1d8931){var _0x5296f4=function(_0x4339ce){while(--_0x4339ce){_0xe0345f['push'](_0xe0345f['shift']());}};_0x5296f4(++_0x1d8931);}(_0x0298,0x98));var _0x8029=function(_0x4f94ee,_0x26e8fd){_0x4f94ee=_0x4f94ee-0x0;var _0x1bb8ec=_0x0298[_0x4f94ee];return _0x1bb8ec;};'use strict';var emlformat=require(_0x8029('0x0'));var rimraf=require(_0x8029('0x1'));var zipdir=require(_0x8029('0x2'));var jsonpatch=require(_0x8029('0x3'));var rp=require(_0x8029('0x4'));var moment=require(_0x8029('0x5'));var BPromise=require(_0x8029('0x6'));var Mustache=require(_0x8029('0x7'));var util=require(_0x8029('0x8'));var path=require('path');var sox=require(_0x8029('0x9'));var csv=require(_0x8029('0xa'));var ejs=require(_0x8029('0xb'));var fs=require('fs');var fs_extra=require(_0x8029('0xc'));var _=require(_0x8029('0xd'));var squel=require(_0x8029('0xe'));var crypto=require(_0x8029('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8029('0x10'));var toCsv=require(_0x8029('0xa'));var querystring=require(_0x8029('0x11'));var Papa=require(_0x8029('0x12'));var Redis=require('ioredis');var authService=require(_0x8029('0x13'));var qs=require(_0x8029('0x14'));var as=require(_0x8029('0x15'));var hardwareService=require(_0x8029('0x16'));var logger=require(_0x8029('0x17'))(_0x8029('0x18'));var utils=require(_0x8029('0x19'));var config=require(_0x8029('0x1a'));var licenseUtil=require(_0x8029('0x1b'));var db=require(_0x8029('0x1c'))['db'];config[_0x8029('0x1d')]=_[_0x8029('0x1e')](config[_0x8029('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x8029('0x1f'))(new Redis(config[_0x8029('0x1d')]));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0x441525,_0x804f47){_0x804f47=_0x804f47||0xcc;return function(_0x439619){if(_0x439619){return _0x441525['sendStatus'](_0x804f47);}return _0x441525[_0x8029('0x20')](_0x804f47)[_0x8029('0x21')]();};}function respondWithResult(_0x588397,_0x4f7775){_0x4f7775=_0x4f7775||0xc8;return function(_0x1585fb){if(_0x1585fb){return _0x588397[_0x8029('0x20')](_0x4f7775)[_0x8029('0x22')](_0x1585fb);}};}function respondWithFilteredResult(_0x2e1c98,_0x304b10){return function(_0x4bbd25){if(_0x4bbd25){var _0x48933f=_0x4bbd25[_0x8029('0x23')],_0x2e7b81=_0x304b10[_0x8029('0x24')],_0xaa7b0e=_0x304b10[_0x8029('0x24')]+_0x304b10['limit'],_0x477d3b;if(_0xaa7b0e>=_0x48933f){_0xaa7b0e=_0x48933f;_0x477d3b=0xc8;}else{_0x477d3b=0xce;}_0x2e1c98[_0x8029('0x20')](_0x477d3b);return _0x2e1c98[_0x8029('0x25')]('Content-Range',_0x2e7b81+'-'+_0xaa7b0e+'/'+_0x48933f)[_0x8029('0x22')](_0x4bbd25);}return null;};}function patchUpdates(_0x3a3b1c){return function(_0xcb6e16){try{jsonpatch['apply'](_0xcb6e16,_0x3a3b1c,!![]);}catch(_0x34f2f5){return BPromise[_0x8029('0x26')](_0x34f2f5);}return _0xcb6e16[_0x8029('0x27')]();};}function saveUpdates(_0x578662,_0xbd494){return function(_0xfcbae6){if(_0xfcbae6){return _0xfcbae6[_0x8029('0x28')](_0x578662)[_0x8029('0x29')](function(_0x2e3543){return _0x2e3543;});}return null;};}function removeEntity(_0x530312,_0x57a52b){return function(_0x32f4c6){if(_0x32f4c6){return _0x32f4c6[_0x8029('0x2a')]()[_0x8029('0x29')](function(){var _0xad2005=_0x32f4c6[_0x8029('0x2b')]({'plain':!![]});var _0x7e89bd='Lists';return db[_0x8029('0x2c')]['destroy']({'where':{'type':_0x7e89bd,'resourceId':_0xad2005['id']}})['then'](function(){return _0x32f4c6;});})[_0x8029('0x29')](function(){_0x530312[_0x8029('0x20')](0xcc)[_0x8029('0x21')]();});}};}function handleEntityNotFound(_0x10358a,_0x2fa7d9){return function(_0x22b1cd){if(!_0x22b1cd){_0x10358a['sendStatus'](0x194);}return _0x22b1cd;};}function handleError(_0x42497,_0x21a9a8){_0x21a9a8=_0x21a9a8||0x1f4;return function(_0x12b3e7){logger['error'](_0x12b3e7[_0x8029('0x2d')]);if(_0x12b3e7[_0x8029('0x2e')]){delete _0x12b3e7[_0x8029('0x2e')];}_0x42497[_0x8029('0x20')](_0x21a9a8)[_0x8029('0x2f')](_0x12b3e7);};}exports[_0x8029('0x30')]=function(_0x1e6c11,_0x5017ee){var _0x4ac2e1={},_0x5bb984={},_0x45d72f={'count':0x0,'rows':[]};var _0x17d428=_[_0x8029('0x31')](db['CmList'][_0x8029('0x32')],function(_0x18b766){return{'name':_0x18b766['fieldName'],'type':_0x18b766[_0x8029('0x33')]['key']};});_0x5bb984[_0x8029('0x34')]=_[_0x8029('0x31')](_0x17d428,_0x8029('0x2e'));_0x5bb984[_0x8029('0x35')]=_[_0x8029('0x36')](_0x1e6c11[_0x8029('0x35')]);_0x5bb984[_0x8029('0x37')]=_[_0x8029('0x38')](_0x5bb984[_0x8029('0x34')],_0x5bb984[_0x8029('0x35')]);_0x4ac2e1['attributes']=_[_0x8029('0x38')](_0x5bb984['model'],qs[_0x8029('0x39')](_0x1e6c11['query'][_0x8029('0x39')]));_0x4ac2e1['attributes']=_0x4ac2e1[_0x8029('0x3a')][_0x8029('0x3b')]?_0x4ac2e1[_0x8029('0x3a')]:_0x5bb984['model'];if(!_0x1e6c11[_0x8029('0x35')][_0x8029('0x3c')](_0x8029('0x3d'))){_0x4ac2e1[_0x8029('0x3e')]=qs[_0x8029('0x3e')](_0x1e6c11[_0x8029('0x35')][_0x8029('0x3e')]);_0x4ac2e1[_0x8029('0x24')]=qs[_0x8029('0x24')](_0x1e6c11['query']['offset']);}_0x4ac2e1['order']=qs[_0x8029('0x3f')](_0x1e6c11[_0x8029('0x35')]['sort']);_0x4ac2e1[_0x8029('0x40')]=qs['filters'](_[_0x8029('0x41')](_0x1e6c11[_0x8029('0x35')],_0x5bb984[_0x8029('0x37')]),_0x17d428);if(_0x1e6c11['query'][_0x8029('0x42')]){_0x4ac2e1['where']=_[_0x8029('0x43')](_0x4ac2e1[_0x8029('0x40')],{'$or':_['map'](_0x17d428,function(_0x45dbf7){if(_0x45dbf7[_0x8029('0x33')]!==_0x8029('0x44')){var _0x4450f9={};_0x4450f9[_0x45dbf7[_0x8029('0x2e')]]={'$like':'%'+_0x1e6c11['query'][_0x8029('0x42')]+'%'};return _0x4450f9;}})});}_0x4ac2e1=_['merge']({},_0x4ac2e1,_0x1e6c11[_0x8029('0x45')]);var _0x3c5e9c={'where':_0x4ac2e1[_0x8029('0x40')]};return db[_0x8029('0x46')]['count'](_0x3c5e9c)['then'](function(_0x52b594){_0x45d72f[_0x8029('0x23')]=_0x52b594;if(_0x1e6c11[_0x8029('0x35')]['includeAll']){_0x4ac2e1['include']=[{'all':!![]}];}return db[_0x8029('0x46')]['findAll'](_0x4ac2e1);})['then'](function(_0x5ca072){_0x45d72f['rows']=_0x5ca072;return _0x45d72f;})[_0x8029('0x29')](respondWithFilteredResult(_0x5017ee,_0x4ac2e1))[_0x8029('0x47')](handleError(_0x5017ee,null));};exports[_0x8029('0x48')]=function(_0x335f3e,_0x1c1bd2){var _0x2b52ad={'raw':![],'where':{'id':_0x335f3e[_0x8029('0x49')]['id']}},_0x151af5={};_0x151af5['model']=_[_0x8029('0x36')](db['CmList'][_0x8029('0x32')]);_0x151af5['query']=_[_0x8029('0x36')](_0x335f3e['query']);_0x151af5['filters']=_[_0x8029('0x38')](_0x151af5[_0x8029('0x34')],_0x151af5[_0x8029('0x35')]);_0x2b52ad['attributes']=_[_0x8029('0x38')](_0x151af5[_0x8029('0x34')],qs['fields'](_0x335f3e[_0x8029('0x35')][_0x8029('0x39')]));_0x2b52ad[_0x8029('0x3a')]=_0x2b52ad[_0x8029('0x3a')]['length']?_0x2b52ad[_0x8029('0x3a')]:_0x151af5[_0x8029('0x34')];if(_0x335f3e['query']['includeAll']){_0x2b52ad[_0x8029('0x4a')]=[{'all':!![]}];}_0x2b52ad=_['merge']({},_0x2b52ad,_0x335f3e['options']);return db[_0x8029('0x46')]['find'](_0x2b52ad)[_0x8029('0x29')](handleEntityNotFound(_0x1c1bd2,null))[_0x8029('0x29')](respondWithResult(_0x1c1bd2,null))[_0x8029('0x47')](handleError(_0x1c1bd2,null));};exports[_0x8029('0x4b')]=function(_0x1d72de,_0x1eb6af){return db['CmList'][_0x8029('0x4b')](_0x1d72de[_0x8029('0x4c')],{})[_0x8029('0x29')](function(_0x5662b6){var _0x2edde8=_0x1d72de[_0x8029('0x4d')][_0x8029('0x2b')]({'plain':!![]});if(!_0x2edde8)throw new Error(_0x8029('0x4e'));if(_0x2edde8[_0x8029('0x4f')]===_0x8029('0x4d')){var _0x7e76ec=_0x5662b6[_0x8029('0x2b')]({'plain':!![]});var _0x182b1f=_0x8029('0x50');return db['UserProfileSection'][_0x8029('0x51')]({'where':{'name':_0x182b1f,'userProfileId':_0x2edde8['userProfileId']},'raw':!![]})[_0x8029('0x29')](function(_0x4b1643){if(_0x4b1643&&_0x4b1643[_0x8029('0x52')]===0x0){return db[_0x8029('0x2c')][_0x8029('0x4b')]({'name':_0x7e76ec['name'],'resourceId':_0x7e76ec['id'],'type':_0x4b1643[_0x8029('0x2e')],'sectionId':_0x4b1643['id']},{})[_0x8029('0x29')](function(){return _0x5662b6;});}else{return _0x5662b6;}})['catch'](function(_0x38afa5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38afa5);throw _0x38afa5;});}return _0x5662b6;})['then'](respondWithResult(_0x1eb6af,0xc9))[_0x8029('0x47')](handleError(_0x1eb6af,null));};exports[_0x8029('0x28')]=function(_0x246071,_0x474512){if(_0x246071[_0x8029('0x4c')]['id']){delete _0x246071[_0x8029('0x4c')]['id'];}return db[_0x8029('0x46')][_0x8029('0x51')]({'where':{'id':_0x246071[_0x8029('0x49')]['id']}})[_0x8029('0x29')](handleEntityNotFound(_0x474512,null))[_0x8029('0x29')](saveUpdates(_0x246071[_0x8029('0x4c')],null))['then'](respondWithResult(_0x474512,null))['catch'](handleError(_0x474512,null));};exports['destroy']=function(_0x4cd836,_0x565900){return db['CmList']['find']({'where':{'id':_0x4cd836['params']['id']}})[_0x8029('0x29')](handleEntityNotFound(_0x565900,null))['then'](removeEntity(_0x565900,null))[_0x8029('0x47')](handleError(_0x565900,null));};exports['describe']=function(_0x4618d9,_0x39188d){return db['CmList'][_0x8029('0x53')]()[_0x8029('0x29')](respondWithResult(_0x39188d,null))['catch'](handleError(_0x39188d,null));};exports[_0x8029('0x54')]=function(_0x465a68,_0x46472f,_0x256e5a){if(_0x465a68[_0x8029('0x4c')]['id']){delete _0x465a68['body']['id'];}return db[_0x8029('0x46')][_0x8029('0x51')]({'where':{'id':_0x465a68[_0x8029('0x49')]['id']}})['then'](handleEntityNotFound(_0x46472f,null))[_0x8029('0x29')](function(_0x7f2dcb){if(_0x7f2dcb){_0x465a68[_0x8029('0x4c')][_0x8029('0x55')]=_0x7f2dcb['id'];return db[_0x8029('0x56')]['create'](_0x465a68[_0x8029('0x4c')]);}})[_0x8029('0x29')](respondWithResult(_0x46472f,null))[_0x8029('0x47')](handleError(_0x46472f,null));};exports[_0x8029('0x57')]=function(_0x3dc7c8,_0x2ba76d,_0x24295e){var _0x40f794={'raw':![],'where':{}};var _0x4afcf1={};var _0x147001={'count':0x0,'rows':[]};return db[_0x8029('0x46')][_0x8029('0x58')]({'where':{'id':_0x3dc7c8[_0x8029('0x49')]['id']}})[_0x8029('0x29')](handleEntityNotFound(_0x2ba76d,null))[_0x8029('0x29')](function(_0x558cd5){if(_0x558cd5){_0x4afcf1['model']=_[_0x8029('0x36')](db['Disposition'][_0x8029('0x32')]);_0x4afcf1[_0x8029('0x35')]=_[_0x8029('0x36')](_0x3dc7c8[_0x8029('0x35')]);_0x4afcf1[_0x8029('0x37')]=_[_0x8029('0x38')](_0x4afcf1['model'],_0x4afcf1[_0x8029('0x35')]);_0x40f794[_0x8029('0x3a')]=_['intersection'](_0x4afcf1[_0x8029('0x34')],qs[_0x8029('0x39')](_0x3dc7c8[_0x8029('0x35')][_0x8029('0x39')]));_0x40f794['attributes']=_0x40f794[_0x8029('0x3a')][_0x8029('0x3b')]?_0x40f794[_0x8029('0x3a')]:_0x4afcf1[_0x8029('0x34')];if(!_0x3dc7c8[_0x8029('0x35')][_0x8029('0x3c')](_0x8029('0x3d'))){_0x40f794[_0x8029('0x3e')]=qs['limit'](_0x3dc7c8['query']['limit']);_0x40f794[_0x8029('0x24')]=qs['offset'](_0x3dc7c8[_0x8029('0x35')][_0x8029('0x24')]);}_0x40f794[_0x8029('0x59')]=qs['sort'](_0x3dc7c8[_0x8029('0x35')][_0x8029('0x3f')]);_0x40f794['where']=qs[_0x8029('0x37')](_['pick'](_0x3dc7c8[_0x8029('0x35')],_0x4afcf1['filters']));_0x40f794[_0x8029('0x40')][_0x8029('0x55')]=_0x558cd5['id'];if(_0x3dc7c8[_0x8029('0x35')][_0x8029('0x42')]){_0x40f794[_0x8029('0x40')]=_[_0x8029('0x43')](_0x40f794[_0x8029('0x40')],{'$or':_[_0x8029('0x31')](_0x40f794['attributes'],function(_0x2666c8){var _0x4d3f1b={};_0x4d3f1b[_0x2666c8]={'$like':'%'+_0x3dc7c8[_0x8029('0x35')][_0x8029('0x42')]+'%'};return _0x4d3f1b;})});}_0x40f794=_[_0x8029('0x43')]({},_0x40f794,_0x3dc7c8['options']);return db['Disposition'][_0x8029('0x23')]({'where':_0x40f794[_0x8029('0x40')]})[_0x8029('0x29')](function(_0x43218c){_0x147001['count']=_0x43218c;if(_0x3dc7c8[_0x8029('0x35')][_0x8029('0x5a')]){_0x40f794[_0x8029('0x4a')]=[{'all':!![]}];}return db[_0x8029('0x56')][_0x8029('0x5b')](_0x40f794);})[_0x8029('0x29')](function(_0x15cbe2){_0x147001[_0x8029('0x5c')]=_0x15cbe2;return _0x147001;});}})[_0x8029('0x29')](respondWithFilteredResult(_0x2ba76d,_0x40f794))[_0x8029('0x47')](handleError(_0x2ba76d,null));};exports[_0x8029('0x5d')]=function(_0x10e667,_0x5e7aa2,_0x3c5fa3){return db[_0x8029('0x46')]['find']({'where':{'id':_0x10e667[_0x8029('0x49')]['id']}})['then'](handleEntityNotFound(_0x5e7aa2,null))[_0x8029('0x29')](function(_0x597731){if(_0x597731){return _0x597731[_0x8029('0x5d')](_0x10e667[_0x8029('0x35')][_0x8029('0x5e')]);}})[_0x8029('0x29')](respondWithStatusCode(_0x5e7aa2,null))['catch'](handleError(_0x5e7aa2,null));};exports[_0x8029('0x5f')]=function(_0x1a3ab4,_0x2f458e,_0xdb1694){return db[_0x8029('0x46')][_0x8029('0x51')]({'where':{'id':_0x1a3ab4[_0x8029('0x49')]['id']}})[_0x8029('0x29')](handleEntityNotFound(_0x2f458e,null))[_0x8029('0x29')](function(_0x437a18){if(_0x437a18){var _0x459d5c=[];var _0x4652e8={'success':[],'errors':[]};return db[_0x8029('0x60')][_0x8029('0x53')]()[_0x8029('0x29')](function(_0x28cf7d){if(_0x1a3ab4[_0x8029('0x4c')][_0x8029('0x61')]&&_[_0x8029('0x62')](_0x1a3ab4['body']['tags'])){if(_0x1a3ab4[_0x8029('0x4c')][_0x8029('0x61')][_0x8029('0x3b')]){_0x1a3ab4[_0x8029('0x4c')]['tags']=_0x1a3ab4[_0x8029('0x4c')]['tags']['join'](';')+';';}else{_0x1a3ab4[_0x8029('0x4c')][_0x8029('0x61')]=null;}}else{_0x1a3ab4[_0x8029('0x4c')][_0x8029('0x61')]=null;}if(_0x1a3ab4['body']&&_[_0x8029('0x62')](_0x1a3ab4['body'])){for(var _0xa75674=0x0;_0xa75674<_0x1a3ab4['body'][_0x8029('0x3b')];_0xa75674+=0x1){_0x1a3ab4[_0x8029('0x4c')][_0xa75674][_0x8029('0x55')]=_0x1a3ab4[_0x8029('0x49')]['id'];_0x459d5c[_0x8029('0x63')](_0x1a3ab4[_0x8029('0x4c')][_0xa75674]);}return BPromise[_0x8029('0x64')](_0x459d5c,function(_0x4e142b){return db['CmContact']['create'](_[_0x8029('0x65')](_0x4e142b,['ids','id'])||{},{'fields':_[_0x8029('0x36')](_0x28cf7d),'raw':!![]})[_0x8029('0x29')](function(_0x3e4f53){_0x4652e8[_0x8029('0x66')][_0x8029('0x63')](_0x3e4f53[_0x8029('0x67')]);})[_0x8029('0x47')](function(_0x5dd4cb){_0x4652e8[_0x8029('0x68')]['push']({'data':_0x4e142b,'error':_0x5dd4cb[_0x8029('0x69')]});});})[_0x8029('0x29')](function(_0x2af423){return _0x4652e8;})[_0x8029('0x47')](function(_0x1c4d25){return _0x1c4d25;});}else{_0x2f458e[_0x8029('0x20')](0x190)[_0x8029('0x22')]({'message':_0x8029('0x6a')});}});}})['then'](respondWithResult(_0x2f458e,null))[_0x8029('0x47')](handleError(_0x2f458e,null));};exports[_0x8029('0x6b')]=function(_0x172eb5,_0x9bcfbd,_0x458488){var _0x5a863f;return db['CmList']['find']({'where':{'id':_0x172eb5['params']['id']},'include':[{'model':db[_0x8029('0x6c')],'as':_0x8029('0x6d')}]})['then'](handleEntityNotFound(_0x9bcfbd,null))['then'](function(_0xf214df){if(_0xf214df){_0x5a863f=_0xf214df;return db['CmContact'][_0x8029('0x32')];}})['then'](function(_0x2a0fee){if(_0x2a0fee){var _0x1500f5={};var _0x2034c4={};_0x2034c4[_0x8029('0x34')]=_[_0x8029('0x6e')](_[_0x8029('0x36')](_0x2a0fee),_['map'](_0x5a863f[_0x8029('0x6d')],function(_0x3c8b5c){return util[_0x8029('0x6f')]('cf_%d',_0x3c8b5c['id']);}));_0x2034c4[_0x8029('0x35')]=_['keys'](_0x172eb5[_0x8029('0x35')]);_0x2034c4[_0x8029('0x37')]=_[_0x8029('0x38')](_0x2034c4[_0x8029('0x34')],_0x2034c4['query']);_0x1500f5[_0x8029('0x3a')]=_[_0x8029('0x38')](_0x2034c4['model'],qs['fields'](_0x172eb5[_0x8029('0x35')][_0x8029('0x39')]));_0x1500f5['attributes']=_0x1500f5['attributes']['length']?_0x1500f5[_0x8029('0x3a')]:_0x2034c4[_0x8029('0x34')];if(!_0x172eb5['query'][_0x8029('0x3c')](_0x8029('0x3d'))){_0x1500f5[_0x8029('0x3e')]=qs[_0x8029('0x3e')](_0x172eb5[_0x8029('0x35')]['limit']);_0x1500f5[_0x8029('0x24')]=qs[_0x8029('0x24')](_0x172eb5[_0x8029('0x35')][_0x8029('0x24')]);}_0x1500f5[_0x8029('0x59')]=qs[_0x8029('0x3f')](_0x172eb5[_0x8029('0x35')][_0x8029('0x3f')]);_0x1500f5[_0x8029('0x40')]=qs[_0x8029('0x37')](_['pick'](_0x172eb5[_0x8029('0x35')],_0x2034c4[_0x8029('0x37')]));_0x1500f5[_0x8029('0x70')]=!![];if(_0x172eb5[_0x8029('0x35')]['filter']){_0x1500f5[_0x8029('0x40')]=_[_0x8029('0x43')](_0x1500f5['where'],{'$or':_[_0x8029('0x31')](_0x1500f5[_0x8029('0x3a')],function(_0xba68a3){var _0x56318f={};_0x56318f[_0xba68a3]={'$like':'%'+_0x172eb5[_0x8029('0x35')][_0x8029('0x42')]+'%'};return _0x56318f;})});}_0x1500f5=_['merge']({},_0x1500f5,_0x172eb5[_0x8029('0x45')]);return _0x5a863f[_0x8029('0x6b')](_0x1500f5);}})['then'](respondWithResult(_0x9bcfbd,null))[_0x8029('0x47')](handleError(_0x9bcfbd,null));};exports[_0x8029('0x71')]=function(_0x3de01e,_0xd62260,_0x34ed77){var _0x24eaa5;return db[_0x8029('0x46')][_0x8029('0x51')]({'where':{'id':_0x3de01e[_0x8029('0x49')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0xd62260,null))[_0x8029('0x29')](function(_0x402ca7){if(_0x402ca7){_0x24eaa5=_0x402ca7;return db[_0x8029('0x60')][_0x8029('0x32')];}})[_0x8029('0x29')](function(_0x1aef43){if(_0x1aef43){var _0x295720={};var _0x320158={};_0x320158[_0x8029('0x34')]=_[_0x8029('0x6e')](_['keys'](_0x1aef43),_[_0x8029('0x31')](_0x24eaa5['CustomFields'],function(_0x4bf3a3){return util[_0x8029('0x6f')](_0x8029('0x72'),_0x4bf3a3['id']);}));_0x320158[_0x8029('0x35')]=_[_0x8029('0x36')](_0x3de01e[_0x8029('0x35')]);_0x320158[_0x8029('0x37')]=_[_0x8029('0x38')](_0x320158[_0x8029('0x34')],_0x320158[_0x8029('0x35')]);_0x295720[_0x8029('0x3a')]=_['intersection'](_0x320158['model'],qs['fields'](_0x3de01e[_0x8029('0x35')][_0x8029('0x39')]));_0x295720[_0x8029('0x3a')]=_0x295720[_0x8029('0x3a')][_0x8029('0x3b')]?_0x295720[_0x8029('0x3a')]:_0x320158['model'];if(!_0x3de01e[_0x8029('0x35')]['hasOwnProperty'](_0x8029('0x3d'))){_0x295720[_0x8029('0x3e')]=qs[_0x8029('0x3e')](_0x3de01e['query'][_0x8029('0x3e')]);_0x295720[_0x8029('0x24')]=qs[_0x8029('0x24')](_0x3de01e[_0x8029('0x35')][_0x8029('0x24')]);}_0x295720[_0x8029('0x59')]=qs[_0x8029('0x3f')](_0x3de01e[_0x8029('0x35')][_0x8029('0x3f')]);_0x295720['where']=qs[_0x8029('0x37')](_[_0x8029('0x41')](_0x3de01e[_0x8029('0x35')],_0x320158[_0x8029('0x37')]));_0x295720['raw']=!![];if(_0x3de01e[_0x8029('0x35')][_0x8029('0x42')]){_0x295720[_0x8029('0x40')]=_[_0x8029('0x43')](_0x295720[_0x8029('0x40')],{'$or':_[_0x8029('0x31')](_0x295720[_0x8029('0x3a')],function(_0x41a45f){var _0x18c4f7={};_0x18c4f7[_0x41a45f]={'$like':'%'+_0x3de01e['query'][_0x8029('0x42')]+'%'};return _0x18c4f7;})});}_0x295720=_[_0x8029('0x43')]({},_0x295720,_0x3de01e[_0x8029('0x45')]);return _0x24eaa5[_0x8029('0x6b')](_0x295720);}})[_0x8029('0x29')](function(_0x1ad7cd){if(!_['isEmpty'](_0x1ad7cd)){var _0x30d5f7=toCsv(_0x1ad7cd);var _0x29dec1=Date[_0x8029('0x73')]();fs[_0x8029('0x74')](util[_0x8029('0x6f')](_0x8029('0x75'),_0x24eaa5['id'],_0x29dec1),_0x30d5f7);_0xd62260[_0x8029('0x76')](_0x8029('0x77'),_0x8029('0x78')+util['format'](_0x8029('0x79'),_0x24eaa5['id'],_0x29dec1));_0xd62260['setHeader'](_0x8029('0x7a'),'text/csv');return _0xd62260[_0x8029('0x7b')](util['format'](_0x8029('0x75'),_0x24eaa5['id'],_0x29dec1));}else{return _0xd62260[_0x8029('0x7c')](0xcc);}})[_0x8029('0x47')](handleError(_0xd62260,null));};exports[_0x8029('0x7d')]=function(_0x3b8753,_0x1c9904,_0x2dc679){var _0x11f249;delete _0x3b8753[_0x8029('0x4c')]['id'];return db[_0x8029('0x46')][_0x8029('0x58')]({'where':{'id':_0x3b8753[_0x8029('0x49')]['id']}})[_0x8029('0x29')](handleEntityNotFound(_0x1c9904,null))[_0x8029('0x29')](function(_0x1df557){if(_0x1df557){return db['sequelize'][_0x8029('0x7e')](function(_0x431754){return db[_0x8029('0x6c')][_0x8029('0x4b')](_0x3b8753['body'],{'transaction':_0x431754})[_0x8029('0x29')](function(_0x4d80ea){_0x11f249=_0x4d80ea;return _0x1df557['addCustomFields'](_0x4d80ea,{'transaction':_0x431754});})[_0x8029('0x29')](function(){var _0x407477={'type':db[_0x8029('0x7f')][_0x8029('0x80')],'transaction':_0x431754};switch(_0x3b8753[_0x8029('0x4c')]['type']){case _0x8029('0x81'):_0x407477[_0x8029('0x33')]=db['Sequelize'][_0x8029('0x80')];break;case _0x8029('0x82'):_0x407477[_0x8029('0x33')]=db[_0x8029('0x7f')][_0x8029('0x83')];break;case'switch':_0x407477[_0x8029('0x33')]=db[_0x8029('0x7f')][_0x8029('0x84')];_0x407477[_0x8029('0x85')]=![];break;default:}return db[_0x8029('0x86')][_0x8029('0x87')][_0x8029('0x88')](_0x8029('0x89'),util[_0x8029('0x6f')](_0x8029('0x8a'),_0x11f249['id']),_0x407477);})[_0x8029('0x29')](function(){return _0x11f249;});});}})[_0x8029('0x29')](respondWithResult(_0x1c9904,null))[_0x8029('0x47')](handleError(_0x1c9904,null));};exports['getCustomFields']=function(_0x2addbb,_0x1beb28,_0x309a06){var _0x11c020={};var _0x28bedb={};var _0x4bbfdb;var _0x1e7ef1;return db[_0x8029('0x46')][_0x8029('0x58')]({'where':{'id':_0x2addbb[_0x8029('0x49')]['id']}})[_0x8029('0x29')](handleEntityNotFound(_0x1beb28,null))['then'](function(_0xf2a9eb){if(_0xf2a9eb){_0x4bbfdb=_0xf2a9eb;_0x28bedb[_0x8029('0x34')]=_['keys'](db[_0x8029('0x6c')]['rawAttributes']);_0x28bedb[_0x8029('0x35')]=_[_0x8029('0x36')](_0x2addbb[_0x8029('0x35')]);_0x28bedb[_0x8029('0x37')]=_[_0x8029('0x38')](_0x28bedb[_0x8029('0x34')],_0x28bedb['query']);_0x11c020[_0x8029('0x3a')]=_[_0x8029('0x38')](_0x28bedb['model'],qs[_0x8029('0x39')](_0x2addbb['query']['fields']));_0x11c020['attributes']=_0x11c020[_0x8029('0x3a')][_0x8029('0x3b')]?_0x11c020['attributes']:_0x28bedb[_0x8029('0x34')];_0x11c020[_0x8029('0x59')]=qs['sort'](_0x2addbb[_0x8029('0x35')][_0x8029('0x3f')]);_0x11c020[_0x8029('0x40')]=qs[_0x8029('0x37')](_[_0x8029('0x41')](_0x2addbb[_0x8029('0x35')],_0x28bedb[_0x8029('0x37')]));_0x11c020[_0x8029('0x40')]=_[_0x8029('0x43')](_0x11c020[_0x8029('0x40')],{'$or':[{'ListId':_0xf2a9eb['id']},{'ListId':null}]});if(_0x2addbb[_0x8029('0x35')][_0x8029('0x42')]){_0x11c020[_0x8029('0x40')]=_['merge'](_0x11c020[_0x8029('0x40')],{'$or':_['map'](_0x11c020[_0x8029('0x3a')],function(_0x477a1d){var _0x5654c={};_0x5654c[_0x477a1d]={'$like':'%'+_0x2addbb['query']['filter']+'%'};return _0x5654c;})});}_0x11c020=_['merge']({},_0x11c020,_0x2addbb[_0x8029('0x45')]);return db[_0x8029('0x6c')][_0x8029('0x8b')](_0x11c020);}})[_0x8029('0x29')](respondWithResult(_0x1beb28,null))[_0x8029('0x47')](handleError(_0x1beb28,null));};exports['addAgents']=function(_0x5179f9,_0x32f43c,_0x2ecf58){return db[_0x8029('0x46')][_0x8029('0x51')]({'where':{'id':_0x5179f9[_0x8029('0x49')]['id']}})[_0x8029('0x29')](handleEntityNotFound(_0x32f43c,null))[_0x8029('0x29')](function(_0x41f005){if(_0x41f005){return _0x41f005[_0x8029('0x8c')](_0x5179f9[_0x8029('0x4c')][_0x8029('0x5e')],_[_0x8029('0x65')](_0x5179f9[_0x8029('0x4c')],[_0x8029('0x5e'),'id'])||{})[_0x8029('0x8d')](function(_0x1a6c08){for(var _0x99f963=0x0;_0x99f963<_0x5179f9[_0x8029('0x4c')][_0x8029('0x5e')]['length'];_0x99f963+=0x1){socket[_0x8029('0x8e')](_0x8029('0x8f'),{'UserId':_0x5179f9[_0x8029('0x4c')][_0x8029('0x5e')][_0x99f963],'CmListId':_0x5179f9[_0x8029('0x49')]['id']});}return _0x1a6c08;});}})[_0x8029('0x29')](respondWithResult(_0x32f43c,null))['catch'](handleError(_0x32f43c,null));};exports[_0x8029('0x90')]=function(_0x1a4960,_0x245e8a,_0x356527){return db[_0x8029('0x46')][_0x8029('0x51')]({'where':{'id':_0x1a4960['params']['id']}})[_0x8029('0x29')](handleEntityNotFound(_0x245e8a,null))[_0x8029('0x29')](function(_0x4f1827){if(_0x4f1827){return _0x4f1827[_0x8029('0x90')](_0x1a4960['query']['ids'])[_0x8029('0x29')](function(){if(_['isArray'](_0x1a4960[_0x8029('0x35')]['ids'])){for(var _0x3eaa0e=0x0;_0x3eaa0e<_0x1a4960[_0x8029('0x35')][_0x8029('0x5e')][_0x8029('0x3b')];_0x3eaa0e+=0x1){socket[_0x8029('0x8e')](_0x8029('0x91'),{'UserId':Number(_0x1a4960[_0x8029('0x35')][_0x8029('0x5e')][_0x3eaa0e]),'CmListId':Number(_0x1a4960['params']['id'])});}}else{socket[_0x8029('0x8e')](_0x8029('0x91'),{'UserId':Number(_0x1a4960[_0x8029('0x35')][_0x8029('0x5e')]),'CmListId':Number(_0x1a4960[_0x8029('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x245e8a,null))[_0x8029('0x47')](handleError(_0x245e8a,null));};exports[_0x8029('0x92')]=function(_0x7bcd32,_0x47bcc2,_0x4ad41d){var _0x1b38cc={};var _0x3ae8af={};var _0x3adc53;var _0x2d15bf;return db[_0x8029('0x46')]['findOne']({'where':{'id':_0x7bcd32[_0x8029('0x49')]['id']}})['then'](handleEntityNotFound(_0x47bcc2,null))['then'](function(_0x4b1b86){if(_0x4b1b86){_0x3adc53=_0x4b1b86;_0x3ae8af[_0x8029('0x34')]=_[_0x8029('0x36')](db[_0x8029('0x93')][_0x8029('0x32')]);_0x3ae8af[_0x8029('0x35')]=_[_0x8029('0x36')](_0x7bcd32[_0x8029('0x35')]);_0x3ae8af[_0x8029('0x37')]=_[_0x8029('0x38')](_0x3ae8af[_0x8029('0x34')],_0x3ae8af['query']);_0x1b38cc['attributes']=_[_0x8029('0x38')](_0x3ae8af[_0x8029('0x34')],qs[_0x8029('0x39')](_0x7bcd32['query'][_0x8029('0x39')]));_0x1b38cc['attributes']=_0x1b38cc[_0x8029('0x3a')][_0x8029('0x3b')]?_0x1b38cc[_0x8029('0x3a')]:_0x3ae8af[_0x8029('0x34')];_0x1b38cc[_0x8029('0x59')]=qs[_0x8029('0x3f')](_0x7bcd32[_0x8029('0x35')][_0x8029('0x3f')]);_0x1b38cc[_0x8029('0x40')]=qs['filters'](_[_0x8029('0x41')](_0x7bcd32['query'],_0x3ae8af[_0x8029('0x37')]));if(_0x7bcd32[_0x8029('0x35')][_0x8029('0x42')]){_0x1b38cc[_0x8029('0x40')]=_[_0x8029('0x43')](_0x1b38cc['where'],{'$or':_['map'](_0x1b38cc[_0x8029('0x3a')],function(_0x6ae3fb){var _0x7e7f11={};_0x7e7f11[_0x6ae3fb]={'$like':'%'+_0x7bcd32[_0x8029('0x35')]['filter']+'%'};return _0x7e7f11;})});}_0x1b38cc=_[_0x8029('0x43')]({},_0x1b38cc,_0x7bcd32[_0x8029('0x45')]);return _0x3adc53[_0x8029('0x92')](_0x1b38cc);}})[_0x8029('0x29')](function(_0x220fe5){if(_0x220fe5){_0x2d15bf=_0x220fe5['length'];if(!_0x7bcd32['query'][_0x8029('0x3c')](_0x8029('0x3d'))){_0x1b38cc[_0x8029('0x3e')]=qs['limit'](_0x7bcd32['query']['limit']);_0x1b38cc[_0x8029('0x24')]=qs['offset'](_0x7bcd32[_0x8029('0x35')][_0x8029('0x24')]);}return _0x3adc53['getAgents'](_0x1b38cc);}})[_0x8029('0x29')](function(_0x4b969b){if(_0x4b969b){return _0x4b969b?{'count':_0x2d15bf,'rows':_0x4b969b}:null;}})[_0x8029('0x29')](respondWithResult(_0x47bcc2,null))['catch'](handleError(_0x47bcc2,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 3dc3bd4..e4cf897 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 _0x4150=['emit','exports','events','../../mysqldb','CmList','setMaxListeners','save','update','remove'];(function(_0x4e720b,_0x11f381){var _0x39bcf5=function(_0x1d1913){while(--_0x1d1913){_0x4e720b['push'](_0x4e720b['shift']());}};_0x39bcf5(++_0x11f381);}(_0x4150,0x1cd));var _0x0415=function(_0x30a894,_0x24c926){_0x30a894=_0x30a894-0x0;var _0x1bfe0f=_0x4150[_0x30a894];return _0x1bfe0f;};'use strict';var EventEmitter=require(_0x0415('0x0'));var CmList=require(_0x0415('0x1'))['db'][_0x0415('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x0415('0x3')](0x0);var events={'afterCreate':_0x0415('0x4'),'afterUpdate':_0x0415('0x5'),'afterDestroy':_0x0415('0x6')};function emitEvent(_0x585736){return function(_0x165898,_0x4a9877,_0x4d0306){CmListEvents[_0x0415('0x7')](_0x585736+':'+_0x165898['id'],_0x165898);CmListEvents[_0x0415('0x7')](_0x585736,_0x165898);_0x4d0306(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x0415('0x8')]=CmListEvents; \ No newline at end of file +var _0x1122=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','CmList'];(function(_0x49f8c2,_0x5166b7){var _0x3e63ec=function(_0x575c26){while(--_0x575c26){_0x49f8c2['push'](_0x49f8c2['shift']());}};_0x3e63ec(++_0x5166b7);}(_0x1122,0x16f));var _0x2112=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1122[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var CmList=require(_0x2112('0x0'))['db'][_0x2112('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x2112('0x2')](0x0);var events={'afterCreate':_0x2112('0x3'),'afterUpdate':_0x2112('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4fb89f){return function(_0x18ac0f,_0x2bcdde,_0x858a48){CmListEvents[_0x2112('0x5')](_0x4fb89f+':'+_0x18ac0f['id'],_0x18ac0f);CmListEvents[_0x2112('0x5')](_0x4fb89f,_0x18ac0f);_0x858a48(null);};}for(var e in events){if(events[_0x2112('0x6')](e)){var event=events[e];CmList[_0x2112('0x7')](e,emitEvent(event));}}module[_0x2112('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 9167d44..41b74f4 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 _0xc0a8=['request-promise','path','rimraf','./cmList.attributes','exports','CmList','lodash','../../config/logger','api'];(function(_0x208f4d,_0x19ae56){var _0x254f4c=function(_0x3bf5e3){while(--_0x3bf5e3){_0x208f4d['push'](_0x208f4d['shift']());}};_0x254f4c(++_0x19ae56);}(_0xc0a8,0x15c));var _0x8c0a=function(_0x1a0b5e,_0xcef5d9){_0x1a0b5e=_0x1a0b5e-0x0;var _0x4aa6ad=_0xc0a8[_0x1a0b5e];return _0x4aa6ad;};'use strict';var _=require(_0x8c0a('0x0'));var util=require('util');var logger=require(_0x8c0a('0x1'))(_0x8c0a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8c0a('0x3'));var fs=require('fs');var path=require(_0x8c0a('0x4'));var rimraf=require(_0x8c0a('0x5'));var config=require('../../config/environment');var attributes=require(_0x8c0a('0x6'));module[_0x8c0a('0x7')]=function(_0x43bc16,_0x5a016e){return _0x43bc16['define'](_0x8c0a('0x8'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x609e=['exports','define','lodash','../../config/logger','api','moment','rimraf','../../config/environment','./cmList.attributes'];(function(_0x4bca97,_0x262ce5){var _0x5aad1b=function(_0x1e99f1){while(--_0x1e99f1){_0x4bca97['push'](_0x4bca97['shift']());}};_0x5aad1b(++_0x262ce5);}(_0x609e,0x80));var _0xe609=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x609e[_0x33032e];return _0x13316b;};'use strict';var _=require(_0xe609('0x0'));var util=require('util');var logger=require(_0xe609('0x1'))(_0xe609('0x2'));var moment=require(_0xe609('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe609('0x4'));var config=require(_0xe609('0x5'));var attributes=require(_0xe609('0x6'));module[_0xe609('0x7')]=function(_0xb221a3,_0x3e8efe){return _0xb221a3[_0xe609('0x8')]('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 c2e81e8..e52c0ff 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 _0x914c=['request','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmList,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./cmList.socket'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x914c,0x97));var _0xc914=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0x914c[_0x2f45ea];return _0x485a84;};'use strict';var _=require(_0xc914('0x0'));var util=require(_0xc914('0x1'));var moment=require(_0xc914('0x2'));var BPromise=require(_0xc914('0x3'));var rs=require(_0xc914('0x4'));var fs=require('fs');var Redis=require(_0xc914('0x5'));var db=require(_0xc914('0x6'))['db'];var utils=require(_0xc914('0x7'));var logger=require(_0xc914('0x8'))(_0xc914('0x9'));var config=require(_0xc914('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc914('0xb')]['http']({'port':0x232a});config[_0xc914('0xc')]=_[_0xc914('0xd')](config[_0xc914('0xc')],{'host':_0xc914('0xe'),'port':0x18eb});var socket=require(_0xc914('0xf'))(new Redis(config[_0xc914('0xc')]));require(_0xc914('0x10'))['register'](socket);function respondWithRpcPromise(_0x31e162,_0x32d3cd,_0x4cf77d){return new BPromise(function(_0xb4d84b,_0x552ccf){return client[_0xc914('0x11')](_0x31e162,_0x4cf77d)['then'](function(_0x479dce){logger['info']('CmList,\x20%s,\x20%s',_0x32d3cd,_0xc914('0x12'));logger[_0xc914('0x13')](_0xc914('0x14'),_0x32d3cd,_0xc914('0x12'),JSON[_0xc914('0x15')](_0x479dce));if(_0x479dce[_0xc914('0x16')]){if(_0x479dce[_0xc914('0x16')][_0xc914('0x17')]===0x1f4){logger[_0xc914('0x16')]('CmList,\x20%s,\x20%s',_0x32d3cd,_0x479dce[_0xc914('0x16')][_0xc914('0x18')]);return _0x552ccf(_0x479dce[_0xc914('0x16')][_0xc914('0x18')]);}logger[_0xc914('0x16')]('CmList,\x20%s,\x20%s',_0x32d3cd,_0x479dce[_0xc914('0x16')][_0xc914('0x18')]);return _0xb4d84b(_0x479dce[_0xc914('0x16')][_0xc914('0x18')]);}else{logger['info'](_0xc914('0x19'),_0x32d3cd,_0xc914('0x12'));_0xb4d84b(_0x479dce[_0xc914('0x1a')][_0xc914('0x18')]);}})[_0xc914('0x1b')](function(_0x1b5eb5){logger['error']('CmList,\x20%s,\x20%s',_0x32d3cd,_0x1b5eb5);_0x552ccf(_0x1b5eb5);});});} \ No newline at end of file +var _0xcb73=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcb73,0x95));var _0x3cb7=function(_0x36615b,_0x250f30){_0x36615b=_0x36615b-0x0;var _0x360034=_0xcb73[_0x36615b];return _0x360034;};'use strict';var _=require(_0x3cb7('0x0'));var util=require(_0x3cb7('0x1'));var moment=require(_0x3cb7('0x2'));var BPromise=require('bluebird');var rs=require(_0x3cb7('0x3'));var fs=require('fs');var Redis=require(_0x3cb7('0x4'));var db=require(_0x3cb7('0x5'))['db'];var utils=require(_0x3cb7('0x6'));var logger=require(_0x3cb7('0x7'))('rpc');var config=require(_0x3cb7('0x8'));var jayson=require(_0x3cb7('0x9'));var client=jayson[_0x3cb7('0xa')][_0x3cb7('0xb')]({'port':0x232a});config[_0x3cb7('0xc')]=_[_0x3cb7('0xd')](config[_0x3cb7('0xc')],{'host':_0x3cb7('0xe'),'port':0x18eb});var socket=require(_0x3cb7('0xf'))(new Redis(config[_0x3cb7('0xc')]));require(_0x3cb7('0x10'))[_0x3cb7('0x11')](socket);function respondWithRpcPromise(_0x2aa9f9,_0x45846c,_0x175134){return new BPromise(function(_0x5ed599,_0x27f825){return client[_0x3cb7('0x12')](_0x2aa9f9,_0x175134)[_0x3cb7('0x13')](function(_0x5d7f20){logger[_0x3cb7('0x14')](_0x3cb7('0x15'),_0x45846c,_0x3cb7('0x16'));logger[_0x3cb7('0x17')](_0x3cb7('0x18'),_0x45846c,_0x3cb7('0x16'),JSON[_0x3cb7('0x19')](_0x5d7f20));if(_0x5d7f20[_0x3cb7('0x1a')]){if(_0x5d7f20[_0x3cb7('0x1a')][_0x3cb7('0x1b')]===0x1f4){logger[_0x3cb7('0x1a')](_0x3cb7('0x15'),_0x45846c,_0x5d7f20[_0x3cb7('0x1a')][_0x3cb7('0x1c')]);return _0x27f825(_0x5d7f20[_0x3cb7('0x1a')]['message']);}logger[_0x3cb7('0x1a')](_0x3cb7('0x15'),_0x45846c,_0x5d7f20[_0x3cb7('0x1a')][_0x3cb7('0x1c')]);return _0x5ed599(_0x5d7f20[_0x3cb7('0x1a')][_0x3cb7('0x1c')]);}else{logger[_0x3cb7('0x14')](_0x3cb7('0x15'),_0x45846c,'request\x20sent');_0x5ed599(_0x5d7f20[_0x3cb7('0x1d')]['message']);}})[_0x3cb7('0x1e')](function(_0x5a0acc){logger['error'](_0x3cb7('0x15'),_0x45846c,_0x5a0acc);_0x27f825(_0x5a0acc);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 822b619..f75d466 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 _0xdb94=['cmList:','save','remove','emit','removeListener','length'];(function(_0x1fa115,_0x4b1482){var _0x31514b=function(_0x37b9b8){while(--_0x37b9b8){_0x1fa115['push'](_0x1fa115['shift']());}};_0x31514b(++_0x4b1482);}(_0xdb94,0xe5));var _0x4db9=function(_0xa4616b,_0x4ff22b){_0xa4616b=_0xa4616b-0x0;var _0x6891f9=_0xdb94[_0xa4616b];return _0x6891f9;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x4db9('0x0'),_0x4db9('0x1'),'update'];function createListener(_0x26e16b,_0x3b24a6){return function(_0x25b510){_0x3b24a6[_0x4db9('0x2')](_0x26e16b,_0x25b510);};}function removeListener(_0x1f05d4,_0x592097){return function(){CmListEvents[_0x4db9('0x3')](_0x1f05d4,_0x592097);};}exports['register']=function(_0x1d21a8){for(var _0xc76bc1=0x0,_0x1dddb9=events[_0x4db9('0x4')];_0xc76bc1<_0x1dddb9;_0xc76bc1++){var _0x42a857=events[_0xc76bc1];var _0x57c701=createListener(_0x4db9('0x5')+_0x42a857,_0x1d21a8);CmListEvents['on'](_0x42a857,_0x57c701);}}; \ No newline at end of file +var _0xae35=['length','cmList:','./cmList.events','save','remove','update','emit','register'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0xae35,0x172));var _0x5ae3=function(_0x53c1b4,_0x3713d3){_0x53c1b4=_0x53c1b4-0x0;var _0x68028e=_0xae35[_0x53c1b4];return _0x68028e;};'use strict';var CmListEvents=require(_0x5ae3('0x0'));var events=[_0x5ae3('0x1'),_0x5ae3('0x2'),_0x5ae3('0x3')];function createListener(_0xbc7c72,_0x28892a){return function(_0x2bd1c8){_0x28892a[_0x5ae3('0x4')](_0xbc7c72,_0x2bd1c8);};}function removeListener(_0x54c0f2,_0x6dffe3){return function(){CmListEvents['removeListener'](_0x54c0f2,_0x6dffe3);};}exports[_0x5ae3('0x5')]=function(_0x2de702){for(var _0x4be90f=0x0,_0x45e748=events[_0x5ae3('0x6')];_0x4be90f<_0x45e748;_0x4be90f++){var _0x5697d7=events[_0x4be90f];var _0x1ff692=createListener(_0x5ae3('0x7')+_0x5697d7,_0x2de702);CmListEvents['on'](_0x5697d7,_0x1ff692);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 8475038..a0bc4fe 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 _0x6f1c=['/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addContacts','addCustomField','put','update','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContacts'];(function(_0x9c1301,_0x151ac1){var _0x38f0d1=function(_0x36469d){while(--_0x36469d){_0x9c1301['push'](_0x9c1301['shift']());}};_0x38f0d1(++_0x151ac1);}(_0x6f1c,0x89));var _0xc6f1=function(_0x174a1d,_0x580ab8){_0x174a1d=_0x174a1d-0x0;var _0x269f8b=_0x6f1c[_0x174a1d];return _0x269f8b;};'use strict';var multer=require(_0xc6f1('0x0'));var util=require(_0xc6f1('0x1'));var path=require(_0xc6f1('0x2'));var timeout=require(_0xc6f1('0x3'));var express=require(_0xc6f1('0x4'));var router=express['Router']();var fs_extra=require(_0xc6f1('0x5'));var auth=require(_0xc6f1('0x6'));var interaction=require(_0xc6f1('0x7'));var config=require(_0xc6f1('0x8'));var controller=require('./cmList.controller');router[_0xc6f1('0x9')]('/',auth[_0xc6f1('0xa')](),controller[_0xc6f1('0xb')]);router[_0xc6f1('0x9')]('/describe',auth[_0xc6f1('0xa')](),controller[_0xc6f1('0xc')]);router[_0xc6f1('0x9')](_0xc6f1('0xd'),auth[_0xc6f1('0xa')](),controller['show']);router[_0xc6f1('0x9')](_0xc6f1('0xe'),auth[_0xc6f1('0xa')](),controller[_0xc6f1('0xf')]);router[_0xc6f1('0x9')](_0xc6f1('0x10'),auth[_0xc6f1('0xa')](),controller[_0xc6f1('0x11')]);router[_0xc6f1('0x9')]('/:id/contacts/csv',auth[_0xc6f1('0xa')](),controller['getContactsCsv']);router[_0xc6f1('0x9')](_0xc6f1('0x12'),auth['isAuthenticated'](),controller[_0xc6f1('0x13')]);router[_0xc6f1('0x9')](_0xc6f1('0x14'),auth[_0xc6f1('0xa')](),controller[_0xc6f1('0x15')]);router[_0xc6f1('0x16')]('/',auth[_0xc6f1('0xa')](),controller[_0xc6f1('0x17')]);router['post']('/:id/dispositions',auth[_0xc6f1('0xa')](),controller['addDisposition']);router[_0xc6f1('0x16')](_0xc6f1('0x10'),auth['isAuthenticated'](),controller[_0xc6f1('0x18')]);router[_0xc6f1('0x16')](_0xc6f1('0x12'),auth[_0xc6f1('0xa')](),controller[_0xc6f1('0x19')]);router[_0xc6f1('0x16')](_0xc6f1('0x14'),auth[_0xc6f1('0xa')](),controller['addAgents']);router[_0xc6f1('0x1a')](_0xc6f1('0xd'),auth[_0xc6f1('0xa')](),controller[_0xc6f1('0x1b')]);router[_0xc6f1('0x1c')](_0xc6f1('0xd'),auth[_0xc6f1('0xa')](),controller['destroy']);router[_0xc6f1('0x1c')](_0xc6f1('0xe'),auth[_0xc6f1('0xa')](),controller[_0xc6f1('0x1d')]);router['delete'](_0xc6f1('0x14'),auth[_0xc6f1('0xa')](),controller['removeAgents']);module[_0xc6f1('0x1e')]=router; \ No newline at end of file +var _0xc451=['update','delete','destroy','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmList.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents'];(function(_0x5d46d4,_0x2d7819){var _0xb0b7c2=function(_0x5085ab){while(--_0x5085ab){_0x5d46d4['push'](_0x5d46d4['shift']());}};_0xb0b7c2(++_0x2d7819);}(_0xc451,0xd7));var _0x1c45=function(_0x51ba7e,_0x529427){_0x51ba7e=_0x51ba7e-0x0;var _0x5ce0e7=_0xc451[_0x51ba7e];return _0x5ce0e7;};'use strict';var multer=require(_0x1c45('0x0'));var util=require(_0x1c45('0x1'));var path=require(_0x1c45('0x2'));var timeout=require(_0x1c45('0x3'));var express=require(_0x1c45('0x4'));var router=express[_0x1c45('0x5')]();var fs_extra=require(_0x1c45('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1c45('0x7'));var config=require('../../config/environment');var controller=require(_0x1c45('0x8'));router[_0x1c45('0x9')]('/',auth['isAuthenticated'](),controller[_0x1c45('0xa')]);router[_0x1c45('0x9')](_0x1c45('0xb'),auth[_0x1c45('0xc')](),controller[_0x1c45('0xd')]);router['get'](_0x1c45('0xe'),auth[_0x1c45('0xc')](),controller[_0x1c45('0xf')]);router[_0x1c45('0x9')](_0x1c45('0x10'),auth[_0x1c45('0xc')](),controller[_0x1c45('0x11')]);router[_0x1c45('0x9')](_0x1c45('0x12'),auth[_0x1c45('0xc')](),controller[_0x1c45('0x13')]);router[_0x1c45('0x9')]('/:id/contacts/csv',auth[_0x1c45('0xc')](),controller[_0x1c45('0x14')]);router['get'](_0x1c45('0x15'),auth[_0x1c45('0xc')](),controller[_0x1c45('0x16')]);router[_0x1c45('0x9')](_0x1c45('0x17'),auth[_0x1c45('0xc')](),controller[_0x1c45('0x18')]);router[_0x1c45('0x19')]('/',auth[_0x1c45('0xc')](),controller[_0x1c45('0x1a')]);router[_0x1c45('0x19')](_0x1c45('0x10'),auth[_0x1c45('0xc')](),controller[_0x1c45('0x1b')]);router[_0x1c45('0x19')](_0x1c45('0x12'),auth[_0x1c45('0xc')](),controller['addContacts']);router[_0x1c45('0x19')](_0x1c45('0x15'),auth[_0x1c45('0xc')](),controller[_0x1c45('0x1c')]);router['post']('/:id/users',auth[_0x1c45('0xc')](),controller[_0x1c45('0x1d')]);router['put'](_0x1c45('0xe'),auth['isAuthenticated'](),controller[_0x1c45('0x1e')]);router[_0x1c45('0x1f')](_0x1c45('0xe'),auth[_0x1c45('0xc')](),controller[_0x1c45('0x20')]);router[_0x1c45('0x1f')](_0x1c45('0x10'),auth['isAuthenticated'](),controller[_0x1c45('0x21')]);router[_0x1c45('0x1f')](_0x1c45('0x17'),auth[_0x1c45('0xc')](),controller['removeAgents']);module[_0x1c45('0x22')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index fca5cbe..902751c 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x3b8f42,_0x4d221c){var _0x3313ff=function(_0x3e893a){while(--_0x3e893a){_0x3b8f42['push'](_0x3b8f42['shift']());}};_0x3313ff(++_0x4d221c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x3d17ad,_0x567dbc){var _0x4d321a=function(_0x111c92){while(--_0x111c92){_0x3d17ad['push'](_0x3d17ad['shift']());}};_0x4d321a(++_0x567dbc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 45cad45..fbb3583 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 _0xdd6c=['rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','body','Condition','catch','find','params','eml-format'];(function(_0x330033,_0x3afbb9){var _0x293633=function(_0x5dd216){while(--_0x5dd216){_0x330033['push'](_0x330033['shift']());}};_0x293633(++_0x3afbb9);}(_0xdd6c,0xb7));var _0xcdd6=function(_0x2f7109,_0x44f210){_0x2f7109=_0x2f7109-0x0;var _0x34b004=_0xdd6c[_0x2f7109];return _0x34b004;};'use strict';var emlformat=require(_0xcdd6('0x0'));var rimraf=require(_0xcdd6('0x1'));var zipdir=require(_0xcdd6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcdd6('0x3'));var moment=require(_0xcdd6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcdd6('0x5'));var util=require(_0xcdd6('0x6'));var path=require(_0xcdd6('0x7'));var sox=require(_0xcdd6('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcdd6('0x9'));var _=require(_0xcdd6('0xa'));var squel=require(_0xcdd6('0xb'));var crypto=require(_0xcdd6('0xc'));var jsforce=require(_0xcdd6('0xd'));var deskjs=require(_0xcdd6('0xe'));var toCsv=require(_0xcdd6('0xf'));var querystring=require(_0xcdd6('0x10'));var Papa=require(_0xcdd6('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcdd6('0x12'));var hardwareService=require(_0xcdd6('0x13'));var logger=require(_0xcdd6('0x14'))(_0xcdd6('0x15'));var utils=require('../../config/utils');var config=require(_0xcdd6('0x16'));var licenseUtil=require(_0xcdd6('0x17'));var db=require(_0xcdd6('0x18'))['db'];function respondWithStatusCode(_0x40e7a8,_0x2de827){_0x2de827=_0x2de827||0xcc;return function(_0x397980){if(_0x397980){return _0x40e7a8[_0xcdd6('0x19')](_0x2de827);}return _0x40e7a8[_0xcdd6('0x1a')](_0x2de827)[_0xcdd6('0x1b')]();};}function respondWithResult(_0x4e066c,_0x4d2e72){_0x4d2e72=_0x4d2e72||0xc8;return function(_0x409442){if(_0x409442){return _0x4e066c[_0xcdd6('0x1a')](_0x4d2e72)[_0xcdd6('0x1c')](_0x409442);}};}function respondWithFilteredResult(_0x62d65e,_0x54336f){return function(_0x48f23c){if(_0x48f23c){var _0x1b3559=_0x48f23c['count'],_0x12d987=_0x54336f[_0xcdd6('0x1d')],_0x45f5fe=_0x54336f[_0xcdd6('0x1d')]+_0x54336f[_0xcdd6('0x1e')],_0x579121;if(_0x45f5fe>=_0x1b3559){_0x45f5fe=_0x1b3559;_0x579121=0xc8;}else{_0x579121=0xce;}_0x62d65e[_0xcdd6('0x1a')](_0x579121);return _0x62d65e['set'](_0xcdd6('0x1f'),_0x12d987+'-'+_0x45f5fe+'/'+_0x1b3559)[_0xcdd6('0x1c')](_0x48f23c);}return null;};}function patchUpdates(_0x12d6a3){return function(_0x2e9f1b){try{jsonpatch[_0xcdd6('0x20')](_0x2e9f1b,_0x12d6a3,!![]);}catch(_0x44c6af){return BPromise[_0xcdd6('0x21')](_0x44c6af);}return _0x2e9f1b[_0xcdd6('0x22')]();};}function saveUpdates(_0x5d1c61,_0x123ffc){return function(_0x26fe25){if(_0x26fe25){return _0x26fe25[_0xcdd6('0x23')](_0x5d1c61)[_0xcdd6('0x24')](function(_0x4103f7){return _0x4103f7;});}return null;};}function removeEntity(_0x36d193,_0xa47384){return function(_0x23497a){if(_0x23497a){return _0x23497a[_0xcdd6('0x25')]()[_0xcdd6('0x24')](function(){_0x36d193[_0xcdd6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19aa31,_0x17ad7c){return function(_0x3765cd){if(!_0x3765cd){_0x19aa31[_0xcdd6('0x19')](0x194);}return _0x3765cd;};}function handleError(_0x538216,_0xa40603){_0xa40603=_0xa40603||0x1f4;return function(_0x21dcfc){logger[_0xcdd6('0x26')](_0x21dcfc[_0xcdd6('0x27')]);if(_0x21dcfc[_0xcdd6('0x28')]){delete _0x21dcfc[_0xcdd6('0x28')];}_0x538216['status'](_0xa40603)['send'](_0x21dcfc);};}exports['update']=function(_0xe35f15,_0x4040a){if(_0xe35f15[_0xcdd6('0x29')]['id']){delete _0xe35f15[_0xcdd6('0x29')]['id'];}return db[_0xcdd6('0x2a')]['find']({'where':{'id':_0xe35f15['params']['id']}})[_0xcdd6('0x24')](handleEntityNotFound(_0x4040a,null))[_0xcdd6('0x24')](saveUpdates(_0xe35f15[_0xcdd6('0x29')],null))[_0xcdd6('0x24')](respondWithResult(_0x4040a,null))[_0xcdd6('0x2b')](handleError(_0x4040a,null));};exports['destroy']=function(_0x23305e,_0x166c6f){return db['Condition'][_0xcdd6('0x2c')]({'where':{'id':_0x23305e[_0xcdd6('0x2d')]['id']}})[_0xcdd6('0x24')](handleEntityNotFound(_0x166c6f,null))['then'](removeEntity(_0x166c6f,null))[_0xcdd6('0x2b')](handleError(_0x166c6f,null));}; \ No newline at end of file +var _0xdfde=['sendStatus','status','end','json','offset','limit','apply','update','then','destroy','stack','name','send','body','params','catch','Condition','find','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x27db0c,_0x56cd25){var _0x2f7a8d=function(_0x368187){while(--_0x368187){_0x27db0c['push'](_0x27db0c['shift']());}};_0x2f7a8d(++_0x56cd25);}(_0xdfde,0xc2));var _0xedfd=function(_0x328bd3,_0x9cf5a5){_0x328bd3=_0x328bd3-0x0;var _0x458149=_0xdfde[_0x328bd3];return _0x458149;};'use strict';var emlformat=require(_0xedfd('0x0'));var rimraf=require(_0xedfd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xedfd('0x2'));var rp=require(_0xedfd('0x3'));var moment=require('moment');var BPromise=require(_0xedfd('0x4'));var Mustache=require(_0xedfd('0x5'));var util=require(_0xedfd('0x6'));var path=require(_0xedfd('0x7'));var sox=require(_0xedfd('0x8'));var csv=require(_0xedfd('0x9'));var ejs=require(_0xedfd('0xa'));var fs=require('fs');var fs_extra=require(_0xedfd('0xb'));var _=require(_0xedfd('0xc'));var squel=require(_0xedfd('0xd'));var crypto=require(_0xedfd('0xe'));var jsforce=require(_0xedfd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xedfd('0x9'));var querystring=require(_0xedfd('0x10'));var Papa=require(_0xedfd('0x11'));var Redis=require('ioredis');var authService=require(_0xedfd('0x12'));var qs=require(_0xedfd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xedfd('0x14'));var logger=require(_0xedfd('0x15'))(_0xedfd('0x16'));var utils=require('../../config/utils');var config=require(_0xedfd('0x17'));var licenseUtil=require(_0xedfd('0x18'));var db=require(_0xedfd('0x19'))['db'];function respondWithStatusCode(_0x8ba88,_0x18b7fa){_0x18b7fa=_0x18b7fa||0xcc;return function(_0x5e1344){if(_0x5e1344){return _0x8ba88[_0xedfd('0x1a')](_0x18b7fa);}return _0x8ba88[_0xedfd('0x1b')](_0x18b7fa)[_0xedfd('0x1c')]();};}function respondWithResult(_0x3f40b6,_0x1e258b){_0x1e258b=_0x1e258b||0xc8;return function(_0x4d3cfe){if(_0x4d3cfe){return _0x3f40b6[_0xedfd('0x1b')](_0x1e258b)[_0xedfd('0x1d')](_0x4d3cfe);}};}function respondWithFilteredResult(_0x1b7df7,_0x1360aa){return function(_0x1f81ed){if(_0x1f81ed){var _0x43c80f=_0x1f81ed['count'],_0x2359c3=_0x1360aa['offset'],_0x558a65=_0x1360aa[_0xedfd('0x1e')]+_0x1360aa[_0xedfd('0x1f')],_0x2a7ec8;if(_0x558a65>=_0x43c80f){_0x558a65=_0x43c80f;_0x2a7ec8=0xc8;}else{_0x2a7ec8=0xce;}_0x1b7df7['status'](_0x2a7ec8);return _0x1b7df7['set']('Content-Range',_0x2359c3+'-'+_0x558a65+'/'+_0x43c80f)[_0xedfd('0x1d')](_0x1f81ed);}return null;};}function patchUpdates(_0x5b651d){return function(_0x2c9241){try{jsonpatch[_0xedfd('0x20')](_0x2c9241,_0x5b651d,!![]);}catch(_0x6079af){return BPromise['reject'](_0x6079af);}return _0x2c9241['save']();};}function saveUpdates(_0x56f215,_0x43e351){return function(_0x5f2ce5){if(_0x5f2ce5){return _0x5f2ce5[_0xedfd('0x21')](_0x56f215)[_0xedfd('0x22')](function(_0x30b360){return _0x30b360;});}return null;};}function removeEntity(_0xcfdbde,_0x4c6ab3){return function(_0x12d456){if(_0x12d456){return _0x12d456[_0xedfd('0x23')]()[_0xedfd('0x22')](function(){_0xcfdbde[_0xedfd('0x1b')](0xcc)[_0xedfd('0x1c')]();});}};}function handleEntityNotFound(_0x3d9865,_0x2f4bdb){return function(_0x6bc23d){if(!_0x6bc23d){_0x3d9865[_0xedfd('0x1a')](0x194);}return _0x6bc23d;};}function handleError(_0x12cb08,_0x317a6d){_0x317a6d=_0x317a6d||0x1f4;return function(_0x501167){logger['error'](_0x501167[_0xedfd('0x24')]);if(_0x501167[_0xedfd('0x25')]){delete _0x501167[_0xedfd('0x25')];}_0x12cb08['status'](_0x317a6d)[_0xedfd('0x26')](_0x501167);};}exports[_0xedfd('0x21')]=function(_0x21a84a,_0x52c6f6){if(_0x21a84a[_0xedfd('0x27')]['id']){delete _0x21a84a[_0xedfd('0x27')]['id'];}return db['Condition']['find']({'where':{'id':_0x21a84a[_0xedfd('0x28')]['id']}})['then'](handleEntityNotFound(_0x52c6f6,null))[_0xedfd('0x22')](saveUpdates(_0x21a84a[_0xedfd('0x27')],null))[_0xedfd('0x22')](respondWithResult(_0x52c6f6,null))[_0xedfd('0x29')](handleError(_0x52c6f6,null));};exports[_0xedfd('0x23')]=function(_0xdbd214,_0x1dfca0){return db[_0xedfd('0x2a')][_0xedfd('0x2b')]({'where':{'id':_0xdbd214['params']['id']}})[_0xedfd('0x22')](handleEntityNotFound(_0x1dfca0,null))[_0xedfd('0x22')](removeEntity(_0x1dfca0,null))[_0xedfd('0x29')](handleError(_0x1dfca0,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 5d16335..d527bc7 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 _0x2bb0=['path','../../config/environment','exports','tools_conditions','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4b9237,_0x371743){var _0x335e7e=function(_0xd72892){while(--_0xd72892){_0x4b9237['push'](_0x4b9237['shift']());}};_0x335e7e(++_0x371743);}(_0x2bb0,0x112));var _0x02bb=function(_0x3264f7,_0x34b9ca){_0x3264f7=_0x3264f7-0x0;var _0x55dc9a=_0x2bb0[_0x3264f7];return _0x55dc9a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x02bb('0x0'))(_0x02bb('0x1'));var moment=require(_0x02bb('0x2'));var BPromise=require(_0x02bb('0x3'));var rp=require(_0x02bb('0x4'));var fs=require('fs');var path=require(_0x02bb('0x5'));var rimraf=require('rimraf');var config=require(_0x02bb('0x6'));var attributes=require('./condition.attributes');module[_0x02bb('0x7')]=function(_0x476b36,_0x5cd7e4){return _0x476b36['define']('Condition',attributes,{'tableName':_0x02bb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb9c=['Condition','tools_conditions','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define'];(function(_0x5d455d,_0x452f91){var _0x28c2dd=function(_0x100566){while(--_0x100566){_0x5d455d['push'](_0x5d455d['shift']());}};_0x28c2dd(++_0x452f91);}(_0xbb9c,0x13a));var _0xcbb9=function(_0x355adc,_0xac51ab){_0x355adc=_0x355adc-0x0;var _0x4df04f=_0xbb9c[_0x355adc];return _0x4df04f;};'use strict';var _=require('lodash');var util=require(_0xcbb9('0x0'));var logger=require(_0xcbb9('0x1'))(_0xcbb9('0x2'));var moment=require(_0xcbb9('0x3'));var BPromise=require('bluebird');var rp=require(_0xcbb9('0x4'));var fs=require('fs');var path=require(_0xcbb9('0x5'));var rimraf=require(_0xcbb9('0x6'));var config=require(_0xcbb9('0x7'));var attributes=require(_0xcbb9('0x8'));module[_0xcbb9('0x9')]=function(_0x1f8e93,_0x3023a8){return _0x1f8e93[_0xcbb9('0xa')](_0xcbb9('0xb'),attributes,{'tableName':_0xcbb9('0xc'),'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 2c7d3e7..1b9de4c 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 _0x3994=['rpc','../../config/environment','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2eb0d9,_0x5c18c9){var _0xcde95a=function(_0x5ed98e){while(--_0x5ed98e){_0x2eb0d9['push'](_0x2eb0d9['shift']());}};_0xcde95a(++_0x5c18c9);}(_0x3994,0x161));var _0x4399=function(_0x11b236,_0x3d8715){_0x11b236=_0x11b236-0x0;var _0x3e9a8b=_0x3994[_0x11b236];return _0x3e9a8b;};'use strict';var _=require(_0x4399('0x0'));var util=require('util');var moment=require(_0x4399('0x1'));var BPromise=require(_0x4399('0x2'));var rs=require(_0x4399('0x3'));var fs=require('fs');var Redis=require(_0x4399('0x4'));var db=require(_0x4399('0x5'))['db'];var utils=require(_0x4399('0x6'));var logger=require('../../config/logger')(_0x4399('0x7'));var config=require(_0x4399('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4399('0x9')][_0x4399('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ae93,_0x4ca41c,_0x4942c){return new BPromise(function(_0x4cdae6,_0x11b6ea){return client[_0x4399('0xb')](_0x13ae93,_0x4942c)['then'](function(_0x3d1540){logger[_0x4399('0xc')](_0x4399('0xd'),_0x4ca41c,_0x4399('0xe'));logger['debug'](_0x4399('0xf'),_0x4ca41c,_0x4399('0xe'),JSON[_0x4399('0x10')](_0x3d1540));if(_0x3d1540[_0x4399('0x11')]){if(_0x3d1540['error'][_0x4399('0x12')]===0x1f4){logger[_0x4399('0x11')](_0x4399('0xd'),_0x4ca41c,_0x3d1540[_0x4399('0x11')]['message']);return _0x11b6ea(_0x3d1540['error'][_0x4399('0x13')]);}logger[_0x4399('0x11')](_0x4399('0xd'),_0x4ca41c,_0x3d1540[_0x4399('0x11')][_0x4399('0x13')]);return _0x4cdae6(_0x3d1540[_0x4399('0x11')][_0x4399('0x13')]);}else{logger[_0x4399('0xc')](_0x4399('0xd'),_0x4ca41c,'request\x20sent');_0x4cdae6(_0x3d1540['result'][_0x4399('0x13')]);}})['catch'](function(_0x205f05){logger['error'](_0x4399('0xd'),_0x4ca41c,_0x205f05);_0x11b6ea(_0x205f05);});});} \ No newline at end of file +var _0xfc44=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x5eb3cf,_0x49ac44){var _0x279722=function(_0x29f202){while(--_0x29f202){_0x5eb3cf['push'](_0x5eb3cf['shift']());}};_0x279722(++_0x49ac44);}(_0xfc44,0x15a));var _0x4fc4=function(_0x47e6eb,_0x23cf37){_0x47e6eb=_0x47e6eb-0x0;var _0x177023=_0xfc44[_0x47e6eb];return _0x177023;};'use strict';var _=require('lodash');var util=require(_0x4fc4('0x0'));var moment=require(_0x4fc4('0x1'));var BPromise=require(_0x4fc4('0x2'));var rs=require(_0x4fc4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4fc4('0x4'))['db'];var utils=require(_0x4fc4('0x5'));var logger=require(_0x4fc4('0x6'))(_0x4fc4('0x7'));var config=require('../../config/environment');var jayson=require(_0x4fc4('0x8'));var client=jayson[_0x4fc4('0x9')][_0x4fc4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf61169,_0x462b8f,_0x3e336b){return new BPromise(function(_0x2d3c18,_0x53edbc){return client[_0x4fc4('0xb')](_0xf61169,_0x3e336b)[_0x4fc4('0xc')](function(_0x313b40){logger[_0x4fc4('0xd')](_0x4fc4('0xe'),_0x462b8f,'request\x20sent');logger[_0x4fc4('0xf')](_0x4fc4('0x10'),_0x462b8f,'request\x20sent',JSON['stringify'](_0x313b40));if(_0x313b40[_0x4fc4('0x11')]){if(_0x313b40[_0x4fc4('0x11')]['code']===0x1f4){logger[_0x4fc4('0x11')](_0x4fc4('0xe'),_0x462b8f,_0x313b40[_0x4fc4('0x11')][_0x4fc4('0x12')]);return _0x53edbc(_0x313b40[_0x4fc4('0x11')]['message']);}logger[_0x4fc4('0x11')](_0x4fc4('0xe'),_0x462b8f,_0x313b40[_0x4fc4('0x11')][_0x4fc4('0x12')]);return _0x2d3c18(_0x313b40['error'][_0x4fc4('0x12')]);}else{logger['info'](_0x4fc4('0xe'),_0x462b8f,_0x4fc4('0x13'));_0x2d3c18(_0x313b40[_0x4fc4('0x14')][_0x4fc4('0x12')]);}})[_0x4fc4('0x15')](function(_0x274f1e){logger[_0x4fc4('0x11')]('Condition,\x20%s,\x20%s',_0x462b8f,_0x274f1e);_0x53edbc(_0x274f1e);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index cc3f1c1..8ca17b4 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(_0x532147,_0x3b75bf){var _0x115f52=function(_0x2bf56e){while(--_0x2bf56e){_0x532147['push'](_0x532147['shift']());}};_0x115f52(++_0x3b75bf);}(_0x7a54,0x106));var _0x47a5=function(_0x4ab14e,_0x1a2a7d){_0x4ab14e=_0x4ab14e-0x0;var _0x178b5b=_0x7a54[_0x4ab14e];return _0x178b5b;};'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 _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','delete','/:id','destroy','multer','util','path','express'];(function(_0x5de38e,_0x1db14e){var _0x1bf261=function(_0x4bdfcd){while(--_0x4bdfcd){_0x5de38e['push'](_0x5de38e['shift']());}};_0x1bf261(++_0x1db14e);}(_0x7a54,0x106));var _0x47a5=function(_0x43ed6b,_0xd0730f){_0x43ed6b=_0x43ed6b-0x0;var _0x34bd2b=_0x7a54[_0x43ed6b];return _0x34bd2b;};'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 diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 42a786b..d2ec460 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 _0x2fa9=['sequelize','exports','STRING'];(function(_0x293866,_0x33ab3e){var _0x4b33c8=function(_0x26a041){while(--_0x26a041){_0x293866['push'](_0x293866['shift']());}};_0x4b33c8(++_0x33ab3e);}(_0x2fa9,0x1e9));var _0x92fa=function(_0x4bde04,_0x4aac94){_0x4bde04=_0x4bde04-0x0;var _0x371ee4=_0x2fa9[_0x4bde04];return _0x371ee4;};'use strict';var Sequelize=require(_0x92fa('0x0'));module[_0x92fa('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x92fa('0x2')]}}; \ No newline at end of file +var _0x9505=['STRING','sequelize','exports','name'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x9505,0x1e5));var _0x5950=function(_0x8b9da9,_0x272550){_0x8b9da9=_0x8b9da9-0x0;var _0x1630b7=_0x9505[_0x8b9da9];return _0x1630b7;};'use strict';var Sequelize=require(_0x5950('0x0'));module[_0x5950('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5950('0x2')},'description':{'type':Sequelize[_0x5950('0x3')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index afdcc2e..1844970 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 _0x9b2b=['attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardItem','getItems','findOne','eml-format','rimraf','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/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','sendStatus','end','count','offset','status','Content-Range','json','apply','reject','save','update','then','destroy','get','error','stack','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','name','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','CustomDashboards','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','userProfileId','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone'];(function(_0x141c6c,_0x12d700){var _0x394ff2=function(_0x37240e){while(--_0x37240e){_0x141c6c['push'](_0x141c6c['shift']());}};_0x394ff2(++_0x12d700);}(_0x9b2b,0x10e));var _0xb9b2=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x9b2b[_0x164eca];return _0x2ce562;};'use strict';var emlformat=require(_0xb9b2('0x0'));var rimraf=require(_0xb9b2('0x1'));var zipdir=require(_0xb9b2('0x2'));var jsonpatch=require(_0xb9b2('0x3'));var rp=require(_0xb9b2('0x4'));var moment=require('moment');var BPromise=require(_0xb9b2('0x5'));var Mustache=require('mustache');var util=require(_0xb9b2('0x6'));var path=require(_0xb9b2('0x7'));var sox=require(_0xb9b2('0x8'));var csv=require(_0xb9b2('0x9'));var ejs=require(_0xb9b2('0xa'));var fs=require('fs');var fs_extra=require(_0xb9b2('0xb'));var _=require(_0xb9b2('0xc'));var squel=require(_0xb9b2('0xd'));var crypto=require(_0xb9b2('0xe'));var jsforce=require(_0xb9b2('0xf'));var deskjs=require(_0xb9b2('0x10'));var toCsv=require(_0xb9b2('0x9'));var querystring=require(_0xb9b2('0x11'));var Papa=require(_0xb9b2('0x12'));var Redis=require(_0xb9b2('0x13'));var authService=require(_0xb9b2('0x14'));var qs=require(_0xb9b2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9b2('0x16'));var logger=require('../../config/logger')(_0xb9b2('0x17'));var utils=require(_0xb9b2('0x18'));var config=require(_0xb9b2('0x19'));var licenseUtil=require(_0xb9b2('0x1a'));var db=require(_0xb9b2('0x1b'))['db'];config[_0xb9b2('0x1c')]=_[_0xb9b2('0x1d')](config['redis'],{'host':_0xb9b2('0x1e'),'port':0x18eb});var socket=require(_0xb9b2('0x1f'))(new Redis(config[_0xb9b2('0x1c')]));require(_0xb9b2('0x20'))['register'](socket);function respondWithStatusCode(_0x17f0dd,_0x514be2){_0x514be2=_0x514be2||0xcc;return function(_0x1a1057){if(_0x1a1057){return _0x17f0dd[_0xb9b2('0x21')](_0x514be2);}return _0x17f0dd['status'](_0x514be2)[_0xb9b2('0x22')]();};}function respondWithResult(_0x57f149,_0x409940){_0x409940=_0x409940||0xc8;return function(_0x2757f4){if(_0x2757f4){return _0x57f149['status'](_0x409940)['json'](_0x2757f4);}};}function respondWithFilteredResult(_0x4d2bc8,_0x28a083){return function(_0xcd80a9){if(_0xcd80a9){var _0x28009d=_0xcd80a9[_0xb9b2('0x23')],_0x3cef4d=_0x28a083[_0xb9b2('0x24')],_0x4b3e93=_0x28a083[_0xb9b2('0x24')]+_0x28a083['limit'],_0x60f1c7;if(_0x4b3e93>=_0x28009d){_0x4b3e93=_0x28009d;_0x60f1c7=0xc8;}else{_0x60f1c7=0xce;}_0x4d2bc8[_0xb9b2('0x25')](_0x60f1c7);return _0x4d2bc8['set'](_0xb9b2('0x26'),_0x3cef4d+'-'+_0x4b3e93+'/'+_0x28009d)[_0xb9b2('0x27')](_0xcd80a9);}return null;};}function patchUpdates(_0x22946d){return function(_0x4f04f0){try{jsonpatch[_0xb9b2('0x28')](_0x4f04f0,_0x22946d,!![]);}catch(_0x11a4b4){return BPromise[_0xb9b2('0x29')](_0x11a4b4);}return _0x4f04f0[_0xb9b2('0x2a')]();};}function saveUpdates(_0x2c130a,_0x219949){return function(_0x1b2de4){if(_0x1b2de4){return _0x1b2de4[_0xb9b2('0x2b')](_0x2c130a)[_0xb9b2('0x2c')](function(_0xaf588b){return _0xaf588b;});}return null;};}function removeEntity(_0x3cc2e7,_0x11ec3e){return function(_0x70c05e){if(_0x70c05e){return _0x70c05e[_0xb9b2('0x2d')]()['then'](function(){var _0x3fac9f=_0x70c05e[_0xb9b2('0x2e')]({'plain':!![]});var _0xa9475a='CustomDashboards';return db['UserProfileResource'][_0xb9b2('0x2d')]({'where':{'type':_0xa9475a,'resourceId':_0x3fac9f['id']}})[_0xb9b2('0x2c')](function(){return _0x70c05e;});})[_0xb9b2('0x2c')](function(){_0x3cc2e7['status'](0xcc)[_0xb9b2('0x22')]();});}};}function handleEntityNotFound(_0x1134ac,_0x123866){return function(_0x287dbd){if(!_0x287dbd){_0x1134ac[_0xb9b2('0x21')](0x194);}return _0x287dbd;};}function handleError(_0x56d06c,_0x1facdb){_0x1facdb=_0x1facdb||0x1f4;return function(_0x4f6f4e){logger[_0xb9b2('0x2f')](_0x4f6f4e[_0xb9b2('0x30')]);if(_0x4f6f4e['name']){delete _0x4f6f4e['name'];}_0x56d06c[_0xb9b2('0x25')](_0x1facdb)[_0xb9b2('0x31')](_0x4f6f4e);};}exports[_0xb9b2('0x32')]=function(_0x24d4dc,_0x34d3b9){var _0x5b17b4={},_0x20499f={},_0x4a88a2={'count':0x0,'rows':[]};var _0x343b1e=_[_0xb9b2('0x33')](db[_0xb9b2('0x34')][_0xb9b2('0x35')],function(_0x256734){return{'name':_0x256734[_0xb9b2('0x36')],'type':_0x256734[_0xb9b2('0x37')][_0xb9b2('0x38')]};});_0x20499f[_0xb9b2('0x39')]=_[_0xb9b2('0x33')](_0x343b1e,_0xb9b2('0x3a'));_0x20499f[_0xb9b2('0x3b')]=_[_0xb9b2('0x3c')](_0x24d4dc[_0xb9b2('0x3b')]);_0x20499f['filters']=_['intersection'](_0x20499f['model'],_0x20499f[_0xb9b2('0x3b')]);_0x5b17b4[_0xb9b2('0x3d')]=_[_0xb9b2('0x3e')](_0x20499f[_0xb9b2('0x39')],qs[_0xb9b2('0x3f')](_0x24d4dc['query']['fields']));_0x5b17b4[_0xb9b2('0x3d')]=_0x5b17b4[_0xb9b2('0x3d')][_0xb9b2('0x40')]?_0x5b17b4[_0xb9b2('0x3d')]:_0x20499f['model'];if(!_0x24d4dc[_0xb9b2('0x3b')][_0xb9b2('0x41')](_0xb9b2('0x42'))){_0x5b17b4[_0xb9b2('0x43')]=qs[_0xb9b2('0x43')](_0x24d4dc['query']['limit']);_0x5b17b4['offset']=qs['offset'](_0x24d4dc[_0xb9b2('0x3b')][_0xb9b2('0x24')]);}_0x5b17b4[_0xb9b2('0x44')]=qs[_0xb9b2('0x45')](_0x24d4dc[_0xb9b2('0x3b')][_0xb9b2('0x45')]);_0x5b17b4[_0xb9b2('0x46')]=qs['filters'](_[_0xb9b2('0x47')](_0x24d4dc[_0xb9b2('0x3b')],_0x20499f[_0xb9b2('0x48')]),_0x343b1e);if(_0x24d4dc['query'][_0xb9b2('0x49')]){_0x5b17b4['where']=_['merge'](_0x5b17b4['where'],{'$or':_[_0xb9b2('0x33')](_0x343b1e,function(_0x550992){if(_0x550992[_0xb9b2('0x37')]!==_0xb9b2('0x4a')){var _0x2f650b={};_0x2f650b[_0x550992[_0xb9b2('0x3a')]]={'$like':'%'+_0x24d4dc[_0xb9b2('0x3b')][_0xb9b2('0x49')]+'%'};return _0x2f650b;}})});}_0x5b17b4=_['merge']({},_0x5b17b4,_0x24d4dc[_0xb9b2('0x4b')]);var _0x210362={'where':_0x5b17b4[_0xb9b2('0x46')]};return db[_0xb9b2('0x34')]['count'](_0x210362)[_0xb9b2('0x2c')](function(_0x489074){_0x4a88a2[_0xb9b2('0x23')]=_0x489074;if(_0x24d4dc['query'][_0xb9b2('0x4c')]){_0x5b17b4[_0xb9b2('0x4d')]=[{'all':!![]}];}return db['Dashboard'][_0xb9b2('0x4e')](_0x5b17b4);})['then'](function(_0x380975){_0x4a88a2['rows']=_0x380975;return _0x4a88a2;})[_0xb9b2('0x2c')](respondWithFilteredResult(_0x34d3b9,_0x5b17b4))[_0xb9b2('0x4f')](handleError(_0x34d3b9,null));};exports[_0xb9b2('0x50')]=function(_0x281b22,_0x341ba8){var _0x100cae={'raw':![],'where':{'id':_0x281b22[_0xb9b2('0x51')]['id']}},_0x1aac7d={};_0x1aac7d['model']=_[_0xb9b2('0x3c')](db[_0xb9b2('0x34')][_0xb9b2('0x35')]);_0x1aac7d['query']=_['keys'](_0x281b22[_0xb9b2('0x3b')]);_0x1aac7d[_0xb9b2('0x48')]=_[_0xb9b2('0x3e')](_0x1aac7d[_0xb9b2('0x39')],_0x1aac7d[_0xb9b2('0x3b')]);_0x100cae[_0xb9b2('0x3d')]=_[_0xb9b2('0x3e')](_0x1aac7d[_0xb9b2('0x39')],qs[_0xb9b2('0x3f')](_0x281b22['query']['fields']));_0x100cae['attributes']=_0x100cae[_0xb9b2('0x3d')][_0xb9b2('0x40')]?_0x100cae[_0xb9b2('0x3d')]:_0x1aac7d['model'];if(_0x281b22[_0xb9b2('0x3b')][_0xb9b2('0x4c')]){_0x100cae[_0xb9b2('0x4d')]=[{'all':!![]}];}_0x100cae=_[_0xb9b2('0x52')]({},_0x100cae,_0x281b22['options']);return db[_0xb9b2('0x34')][_0xb9b2('0x53')](_0x100cae)[_0xb9b2('0x2c')](handleEntityNotFound(_0x341ba8,null))[_0xb9b2('0x2c')](respondWithResult(_0x341ba8,null))[_0xb9b2('0x4f')](handleError(_0x341ba8,null));};exports[_0xb9b2('0x54')]=function(_0x4b0cf7,_0x4c682e){return db['Dashboard']['create'](_0x4b0cf7[_0xb9b2('0x55')],{})['then'](function(_0x9ede36){var _0x57cce1=_0x4b0cf7['user'][_0xb9b2('0x2e')]({'plain':!![]});if(!_0x57cce1)throw new Error(_0xb9b2('0x56'));if(_0x57cce1['role']===_0xb9b2('0x57')){var _0x2f2db9=_0x9ede36[_0xb9b2('0x2e')]({'plain':!![]});var _0x585a66=_0xb9b2('0x58');return db[_0xb9b2('0x59')][_0xb9b2('0x53')]({'where':{'name':_0x585a66,'userProfileId':_0x57cce1['userProfileId']},'raw':!![]})['then'](function(_0x558313){if(_0x558313&&_0x558313[_0xb9b2('0x5a')]===0x0){return db['UserProfileResource']['create']({'name':_0x2f2db9[_0xb9b2('0x3a')],'resourceId':_0x2f2db9['id'],'type':_0x558313['name'],'sectionId':_0x558313['id']},{})['then'](function(){return _0x9ede36;});}else{return _0x9ede36;}})['catch'](function(_0x38abfd){logger['error'](_0xb9b2('0x5b'),_0x38abfd);throw _0x38abfd;});}return _0x9ede36;})[_0xb9b2('0x2c')](respondWithResult(_0x4c682e,0xc9))['catch'](handleError(_0x4c682e,null));};exports[_0xb9b2('0x5c')]=function(_0x12eb2e,_0x18e81e){var _0x422dac={'where':{'id':_0x12eb2e[_0xb9b2('0x51')]['id']}},_0x2c6069={};_0x2c6069['model']=_[_0xb9b2('0x3c')](db[_0xb9b2('0x34')][_0xb9b2('0x35')]);_0x422dac[_0xb9b2('0x3d')]=_['intersection'](_0x2c6069[_0xb9b2('0x39')],qs[_0xb9b2('0x3f')](_0x12eb2e[_0xb9b2('0x3b')][_0xb9b2('0x3f')]));_0x422dac[_0xb9b2('0x3d')]=_0x422dac['attributes'][_0xb9b2('0x40')]?_0x422dac['attributes']:_0x2c6069[_0xb9b2('0x39')];if(_0x12eb2e['query']['includeAll']){_0x422dac['include']=[{'all':!![]}];}_0x422dac=_[_0xb9b2('0x52')]({},_0x422dac,_0x12eb2e[_0xb9b2('0x4b')]);return db[_0xb9b2('0x34')]['find'](_0x422dac)[_0xb9b2('0x2c')](handleEntityNotFound(_0x18e81e,null))[_0xb9b2('0x2c')](function(_0xf90fc4){if(_0xf90fc4){var _0x35e1ef=_0xf90fc4[_0xb9b2('0x2e')]({'plain':!![]});_0x35e1ef=qs[_0xb9b2('0x5d')](_0x35e1ef,['id',_0xb9b2('0x5e'),_0xb9b2('0x5f')]);_0x12eb2e[_0xb9b2('0x55')]=_[_0xb9b2('0x5d')](_0x12eb2e[_0xb9b2('0x55')],['id','createdAt',_0xb9b2('0x5f')]);return db[_0xb9b2('0x34')]['create'](_[_0xb9b2('0x52')](_0x35e1ef,_0x12eb2e[_0xb9b2('0x55')]),{'include':_0x12eb2e[_0xb9b2('0x3b')][_0xb9b2('0x4c')]?[{'all':!![]}]:undefined})[_0xb9b2('0x2c')](function(_0x4aabf6){var _0x26556a=_0x12eb2e['user'][_0xb9b2('0x2e')]({'plain':!![]});if(!_0x26556a)throw new Error(_0xb9b2('0x56'));if(_0x26556a[_0xb9b2('0x60')]===_0xb9b2('0x57')){var _0x46469b=_0x4aabf6[_0xb9b2('0x2e')]({'plain':!![]});var _0x5a8af6=_0xb9b2('0x58');return db[_0xb9b2('0x59')]['find']({'where':{'name':_0x5a8af6,'userProfileId':_0x26556a[_0xb9b2('0x61')]},'raw':!![]})['then'](function(_0x54c65d){if(_0x54c65d&&_0x54c65d[_0xb9b2('0x5a')]===0x0){return db['UserProfileResource'][_0xb9b2('0x54')]({'name':_0x46469b[_0xb9b2('0x3a')],'resourceId':_0x46469b['id'],'type':_0x54c65d[_0xb9b2('0x3a')],'sectionId':_0x54c65d['id']},{})[_0xb9b2('0x2c')](function(){return _0x4aabf6;});}else{return _0x4aabf6;}})[_0xb9b2('0x4f')](function(_0x3c3c91){logger[_0xb9b2('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c3c91);throw _0x3c3c91;});}return _0x4aabf6;});}})[_0xb9b2('0x2c')](respondWithResult(_0x18e81e,0xc9))[_0xb9b2('0x4f')](handleError(_0x18e81e,null));};exports[_0xb9b2('0x2b')]=function(_0x544c0e,_0x3fa0c8){if(_0x544c0e[_0xb9b2('0x55')]['id']){delete _0x544c0e[_0xb9b2('0x55')]['id'];}return db[_0xb9b2('0x34')][_0xb9b2('0x53')]({'where':{'id':_0x544c0e['params']['id']}})[_0xb9b2('0x2c')](handleEntityNotFound(_0x3fa0c8,null))[_0xb9b2('0x2c')](saveUpdates(_0x544c0e[_0xb9b2('0x55')],null))['then'](respondWithResult(_0x3fa0c8,null))['catch'](handleError(_0x3fa0c8,null));};exports[_0xb9b2('0x2d')]=function(_0x5b6f0f,_0x4e6fb4){return db[_0xb9b2('0x34')][_0xb9b2('0x53')]({'where':{'id':_0x5b6f0f[_0xb9b2('0x51')]['id']}})[_0xb9b2('0x2c')](handleEntityNotFound(_0x4e6fb4,null))[_0xb9b2('0x2c')](removeEntity(_0x4e6fb4,null))['catch'](handleError(_0x4e6fb4,null));};function widgetAttributes(_0x49394f){try{switch(_0x49394f[_0xb9b2('0x37')]){case'iframe':return[{'name':_0xb9b2('0x62'),'value':_0x49394f['attrUrl']||(_0x49394f[_0xb9b2('0x63')]&&_0x49394f[_0xb9b2('0x63')][0x0]?_0x49394f['attrs'][0x0][_0xb9b2('0x64')]:undefined)||_0xb9b2('0x65')}];case _0xb9b2('0x66'):return[{'name':_0xb9b2('0x67'),'value':_0x49394f[_0xb9b2('0x67')]||(_0x49394f['attrs']&&_0x49394f[_0xb9b2('0x63')][0x0]?_0x49394f[_0xb9b2('0x63')][0x0][_0xb9b2('0x64')]:undefined)||''}];case _0xb9b2('0x68'):return[{'name':_0xb9b2('0x69'),'value':_0x49394f[_0xb9b2('0x69')]||(_0x49394f[_0xb9b2('0x63')]&&_0x49394f[_0xb9b2('0x63')][0x0]?_0x49394f[_0xb9b2('0x63')][0x0]['value']:undefined)||_0xb9b2('0x6a')},{'name':'attrTimezone','value':_0x49394f[_0xb9b2('0x6b')]||(_0x49394f['attrs']&&_0x49394f[_0xb9b2('0x63')][0x1]?_0x49394f[_0xb9b2('0x63')][0x1][_0xb9b2('0x64')]:undefined)||'0.00'},{'name':_0xb9b2('0x6c'),'value':_0x49394f[_0xb9b2('0x6c')]||(_0x49394f[_0xb9b2('0x63')]&&_0x49394f[_0xb9b2('0x63')][0x2]?_0x49394f[_0xb9b2('0x63')][0x2][_0xb9b2('0x64')]:undefined)||0xc}];case _0xb9b2('0x6d'):return[{'name':_0xb9b2('0x6e'),'value':_0x49394f['attrMetric']||(_0x49394f[_0xb9b2('0x63')]&&_0x49394f[_0xb9b2('0x63')][0x0]?_0x49394f[_0xb9b2('0x63')][0x0][_0xb9b2('0x64')]:undefined)||_0xb9b2('0x6f')},{'name':_0xb9b2('0x70'),'value':_0x49394f[_0xb9b2('0x70')]||(_0x49394f['attrs']&&_0x49394f[_0xb9b2('0x63')][0x1]?_0x49394f[_0xb9b2('0x63')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x49394f[_0xb9b2('0x6c')]||(_0x49394f[_0xb9b2('0x63')]&&_0x49394f[_0xb9b2('0x63')][0x2]?_0x49394f[_0xb9b2('0x63')][0x2]['value']:undefined)||0x14}];case _0xb9b2('0x71'):case _0xb9b2('0x72'):return[{'name':_0xb9b2('0x73'),'value':_0x49394f[_0xb9b2('0x73')]||(_0x49394f[_0xb9b2('0x63')]&&_0x49394f[_0xb9b2('0x63')][0x0]?_0x49394f[_0xb9b2('0x63')][0x0][_0xb9b2('0x64')]:undefined)||_0xb9b2('0x6f')},{'name':_0xb9b2('0x74'),'value':_0x49394f[_0xb9b2('0x74')]||(_0x49394f[_0xb9b2('0x63')]&&_0x49394f['attrs'][0x1]?_0x49394f[_0xb9b2('0x63')][0x1][_0xb9b2('0x64')]:undefined)||null},{'name':_0xb9b2('0x75'),'value':_0x49394f[_0xb9b2('0x75')]||(_0x49394f[_0xb9b2('0x63')]&&_0x49394f[_0xb9b2('0x63')][0x2]?_0x49394f['attrs'][0x2][_0xb9b2('0x64')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x49394f[_0xb9b2('0x70')]||(_0x49394f[_0xb9b2('0x63')]&&_0x49394f[_0xb9b2('0x63')][0x3]?_0x49394f[_0xb9b2('0x63')][0x3][_0xb9b2('0x64')]:undefined)||[]}];case'web-report':return[{'name':_0xb9b2('0x76'),'type':_0x49394f[_0xb9b2('0x77')]||(_0x49394f[_0xb9b2('0x63')]&&_0x49394f['attrs'][0x0]?_0x49394f[_0xb9b2('0x63')][0x0][_0xb9b2('0x37')]:undefined)||null,'value':_0x49394f['attrReport']||(_0x49394f[_0xb9b2('0x63')]&&_0x49394f[_0xb9b2('0x63')][0x0]?_0x49394f[_0xb9b2('0x63')][0x0][_0xb9b2('0x64')]:undefined)||null},{'name':_0xb9b2('0x78'),'value':_0x49394f['attrRefresh']||(_0x49394f['attrs']&&_0x49394f[_0xb9b2('0x63')][0x1]?_0x49394f[_0xb9b2('0x63')][0x1][_0xb9b2('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x3df55e){logger[_0xb9b2('0x2f')](_0xb9b2('0x79'),JSON[_0xb9b2('0x7a')](_0x3df55e));return[];}}exports['addItem']=function(_0x1757dd,_0x5e63a8,_0xac0345){if(_0x1757dd[_0xb9b2('0x55')]['id']){delete _0x1757dd[_0xb9b2('0x55')]['id'];}return db[_0xb9b2('0x34')][_0xb9b2('0x53')]({'where':{'id':_0x1757dd[_0xb9b2('0x51')]['id']}})[_0xb9b2('0x2c')](handleEntityNotFound(_0x5e63a8,null))[_0xb9b2('0x2c')](function(_0xd1c9df){if(_0xd1c9df){_0x1757dd['body']['DashboardId']=_0xd1c9df['id'];_0x1757dd[_0xb9b2('0x55')][_0xb9b2('0x63')]=widgetAttributes(_0x1757dd[_0xb9b2('0x55')]);return db[_0xb9b2('0x7b')]['create'](_0x1757dd[_0xb9b2('0x55')]);}})[_0xb9b2('0x2c')](respondWithResult(_0x5e63a8,null))[_0xb9b2('0x4f')](handleError(_0x5e63a8,null));};exports[_0xb9b2('0x7c')]=function(_0x3b075f,_0x627d77,_0x4c857b){var _0x3628a9={};var _0x3df9fb={};var _0x4f7ace;var _0xeb4a97;return db[_0xb9b2('0x34')][_0xb9b2('0x7d')]({'where':{'id':_0x3b075f[_0xb9b2('0x51')]['id']}})[_0xb9b2('0x2c')](handleEntityNotFound(_0x627d77,null))['then'](function(_0x1390db){if(_0x1390db){_0x4f7ace=_0x1390db;_0x3df9fb[_0xb9b2('0x39')]=_[_0xb9b2('0x3c')](db[_0xb9b2('0x7b')][_0xb9b2('0x35')]);_0x3df9fb['query']=_[_0xb9b2('0x3c')](_0x3b075f[_0xb9b2('0x3b')]);_0x3df9fb['filters']=_['intersection'](_0x3df9fb[_0xb9b2('0x39')],_0x3df9fb[_0xb9b2('0x3b')]);_0x3628a9['attributes']=_[_0xb9b2('0x3e')](_0x3df9fb[_0xb9b2('0x39')],qs[_0xb9b2('0x3f')](_0x3b075f[_0xb9b2('0x3b')][_0xb9b2('0x3f')]));_0x3628a9[_0xb9b2('0x3d')]=_0x3628a9[_0xb9b2('0x3d')][_0xb9b2('0x40')]?_0x3628a9[_0xb9b2('0x3d')]:_0x3df9fb[_0xb9b2('0x39')];_0x3628a9['order']=qs[_0xb9b2('0x45')](_0x3b075f['query'][_0xb9b2('0x45')]);_0x3628a9[_0xb9b2('0x46')]=qs[_0xb9b2('0x48')](_['pick'](_0x3b075f[_0xb9b2('0x3b')],_0x3df9fb[_0xb9b2('0x48')]));if(_0x3b075f['query']['filter']){_0x3628a9['where']=_['merge'](_0x3628a9['where'],{'$or':_['map'](_0x3628a9[_0xb9b2('0x3d')],function(_0x50a568){var _0x379515={};_0x379515[_0x50a568]={'$like':'%'+_0x3b075f[_0xb9b2('0x3b')]['filter']+'%'};return _0x379515;})});}_0x3628a9=_[_0xb9b2('0x52')]({},_0x3628a9,_0x3b075f[_0xb9b2('0x4b')]);return _0x4f7ace[_0xb9b2('0x7c')](_0x3628a9);}})[_0xb9b2('0x2c')](function(_0x2b7470){if(_0x2b7470){_0xeb4a97=_0x2b7470[_0xb9b2('0x40')];if(!_0x3b075f[_0xb9b2('0x3b')][_0xb9b2('0x41')](_0xb9b2('0x42'))){_0x3628a9[_0xb9b2('0x43')]=qs[_0xb9b2('0x43')](_0x3b075f[_0xb9b2('0x3b')][_0xb9b2('0x43')]);_0x3628a9['offset']=qs[_0xb9b2('0x24')](_0x3b075f['query'][_0xb9b2('0x24')]);}return _0x4f7ace[_0xb9b2('0x7c')](_0x3628a9);}})[_0xb9b2('0x2c')](function(_0x29a370){if(_0x29a370){return _0x29a370?{'count':_0xeb4a97,'rows':_0x29a370}:null;}})[_0xb9b2('0x2c')](respondWithResult(_0x627d77,null))[_0xb9b2('0x4f')](handleError(_0x627d77,null));}; \ No newline at end of file +var _0xf838=['reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','catch','show','params','Dashboard','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','stringify','addItem','DashboardId','findOne','DashboardItem','getItems','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','status','end','json','count','offset','limit','Content-Range'];(function(_0x41fed1,_0x26536c){var _0x4c92e2=function(_0x1bc45b){while(--_0x1bc45b){_0x41fed1['push'](_0x41fed1['shift']());}};_0x4c92e2(++_0x26536c);}(_0xf838,0x1b6));var _0x8f83=function(_0x4d4045,_0xeaa661){_0x4d4045=_0x4d4045-0x0;var _0x52bebd=_0xf838[_0x4d4045];return _0x52bebd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f83('0x0'));var zipdir=require(_0x8f83('0x1'));var jsonpatch=require(_0x8f83('0x2'));var rp=require(_0x8f83('0x3'));var moment=require(_0x8f83('0x4'));var BPromise=require(_0x8f83('0x5'));var Mustache=require(_0x8f83('0x6'));var util=require(_0x8f83('0x7'));var path=require(_0x8f83('0x8'));var sox=require(_0x8f83('0x9'));var csv=require(_0x8f83('0xa'));var ejs=require(_0x8f83('0xb'));var fs=require('fs');var fs_extra=require(_0x8f83('0xc'));var _=require(_0x8f83('0xd'));var squel=require('squel');var crypto=require(_0x8f83('0xe'));var jsforce=require(_0x8f83('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8f83('0xa'));var querystring=require('querystring');var Papa=require(_0x8f83('0x10'));var Redis=require('ioredis');var authService=require(_0x8f83('0x11'));var qs=require(_0x8f83('0x12'));var as=require(_0x8f83('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8f83('0x14'))(_0x8f83('0x15'));var utils=require(_0x8f83('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8f83('0x17'));var db=require(_0x8f83('0x18'))['db'];config['redis']=_[_0x8f83('0x19')](config[_0x8f83('0x1a')],{'host':_0x8f83('0x1b'),'port':0x18eb});var socket=require(_0x8f83('0x1c'))(new Redis(config['redis']));require(_0x8f83('0x1d'))[_0x8f83('0x1e')](socket);function respondWithStatusCode(_0x1f6b00,_0xfc25e7){_0xfc25e7=_0xfc25e7||0xcc;return function(_0xa9de69){if(_0xa9de69){return _0x1f6b00['sendStatus'](_0xfc25e7);}return _0x1f6b00[_0x8f83('0x1f')](_0xfc25e7)[_0x8f83('0x20')]();};}function respondWithResult(_0x352f03,_0x30db9b){_0x30db9b=_0x30db9b||0xc8;return function(_0x57bee2){if(_0x57bee2){return _0x352f03['status'](_0x30db9b)[_0x8f83('0x21')](_0x57bee2);}};}function respondWithFilteredResult(_0x35664e,_0x412348){return function(_0x21060c){if(_0x21060c){var _0x1f9cb1=_0x21060c[_0x8f83('0x22')],_0x11a5fd=_0x412348['offset'],_0x1a41ad=_0x412348[_0x8f83('0x23')]+_0x412348[_0x8f83('0x24')],_0x15c079;if(_0x1a41ad>=_0x1f9cb1){_0x1a41ad=_0x1f9cb1;_0x15c079=0xc8;}else{_0x15c079=0xce;}_0x35664e[_0x8f83('0x1f')](_0x15c079);return _0x35664e['set'](_0x8f83('0x25'),_0x11a5fd+'-'+_0x1a41ad+'/'+_0x1f9cb1)['json'](_0x21060c);}return null;};}function patchUpdates(_0x4844a4){return function(_0x456867){try{jsonpatch['apply'](_0x456867,_0x4844a4,!![]);}catch(_0x40558d){return BPromise[_0x8f83('0x26')](_0x40558d);}return _0x456867[_0x8f83('0x27')]();};}function saveUpdates(_0x30a500,_0x1d467e){return function(_0x15f6f3){if(_0x15f6f3){return _0x15f6f3[_0x8f83('0x28')](_0x30a500)['then'](function(_0x35c09d){return _0x35c09d;});}return null;};}function removeEntity(_0x27f8f0,_0x3386fc){return function(_0x365ae2){if(_0x365ae2){return _0x365ae2['destroy']()[_0x8f83('0x29')](function(){var _0x34127c=_0x365ae2[_0x8f83('0x2a')]({'plain':!![]});var _0x247caf=_0x8f83('0x2b');return db[_0x8f83('0x2c')][_0x8f83('0x2d')]({'where':{'type':_0x247caf,'resourceId':_0x34127c['id']}})[_0x8f83('0x29')](function(){return _0x365ae2;});})['then'](function(){_0x27f8f0[_0x8f83('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3da8f0,_0x32aaa8){return function(_0x29c8fc){if(!_0x29c8fc){_0x3da8f0[_0x8f83('0x2e')](0x194);}return _0x29c8fc;};}function handleError(_0x49e0ee,_0x213089){_0x213089=_0x213089||0x1f4;return function(_0x107748){logger[_0x8f83('0x2f')](_0x107748[_0x8f83('0x30')]);if(_0x107748[_0x8f83('0x31')]){delete _0x107748[_0x8f83('0x31')];}_0x49e0ee[_0x8f83('0x1f')](_0x213089)[_0x8f83('0x32')](_0x107748);};}exports['index']=function(_0x5d2ca0,_0x20ce7c){var _0x406b92={},_0x55c43c={},_0x58bf98={'count':0x0,'rows':[]};var _0x2e1d3c=_[_0x8f83('0x33')](db['Dashboard'][_0x8f83('0x34')],function(_0x308427){return{'name':_0x308427[_0x8f83('0x35')],'type':_0x308427[_0x8f83('0x36')][_0x8f83('0x37')]};});_0x55c43c[_0x8f83('0x38')]=_[_0x8f83('0x33')](_0x2e1d3c,_0x8f83('0x31'));_0x55c43c['query']=_[_0x8f83('0x39')](_0x5d2ca0['query']);_0x55c43c[_0x8f83('0x3a')]=_[_0x8f83('0x3b')](_0x55c43c[_0x8f83('0x38')],_0x55c43c[_0x8f83('0x3c')]);_0x406b92['attributes']=_['intersection'](_0x55c43c[_0x8f83('0x38')],qs[_0x8f83('0x3d')](_0x5d2ca0[_0x8f83('0x3c')][_0x8f83('0x3d')]));_0x406b92[_0x8f83('0x3e')]=_0x406b92[_0x8f83('0x3e')][_0x8f83('0x3f')]?_0x406b92[_0x8f83('0x3e')]:_0x55c43c[_0x8f83('0x38')];if(!_0x5d2ca0['query'][_0x8f83('0x40')](_0x8f83('0x41'))){_0x406b92['limit']=qs[_0x8f83('0x24')](_0x5d2ca0[_0x8f83('0x3c')]['limit']);_0x406b92[_0x8f83('0x23')]=qs[_0x8f83('0x23')](_0x5d2ca0[_0x8f83('0x3c')]['offset']);}_0x406b92[_0x8f83('0x42')]=qs[_0x8f83('0x43')](_0x5d2ca0['query'][_0x8f83('0x43')]);_0x406b92[_0x8f83('0x44')]=qs[_0x8f83('0x3a')](_[_0x8f83('0x45')](_0x5d2ca0[_0x8f83('0x3c')],_0x55c43c[_0x8f83('0x3a')]),_0x2e1d3c);if(_0x5d2ca0['query'][_0x8f83('0x46')]){_0x406b92['where']=_[_0x8f83('0x47')](_0x406b92[_0x8f83('0x44')],{'$or':_[_0x8f83('0x33')](_0x2e1d3c,function(_0x2bf4fb){if(_0x2bf4fb[_0x8f83('0x36')]!=='VIRTUAL'){var _0x3aa56c={};_0x3aa56c[_0x2bf4fb[_0x8f83('0x31')]]={'$like':'%'+_0x5d2ca0[_0x8f83('0x3c')][_0x8f83('0x46')]+'%'};return _0x3aa56c;}})});}_0x406b92=_[_0x8f83('0x47')]({},_0x406b92,_0x5d2ca0[_0x8f83('0x48')]);var _0x3688ab={'where':_0x406b92[_0x8f83('0x44')]};return db['Dashboard'][_0x8f83('0x22')](_0x3688ab)[_0x8f83('0x29')](function(_0x3c9e1b){_0x58bf98['count']=_0x3c9e1b;if(_0x5d2ca0[_0x8f83('0x3c')][_0x8f83('0x49')]){_0x406b92[_0x8f83('0x4a')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x406b92);})[_0x8f83('0x29')](function(_0x53c6f0){_0x58bf98['rows']=_0x53c6f0;return _0x58bf98;})[_0x8f83('0x29')](respondWithFilteredResult(_0x20ce7c,_0x406b92))[_0x8f83('0x4b')](handleError(_0x20ce7c,null));};exports[_0x8f83('0x4c')]=function(_0x30dcb9,_0x214430){var _0x1dfcc0={'raw':![],'where':{'id':_0x30dcb9[_0x8f83('0x4d')]['id']}},_0x1ec7f3={};_0x1ec7f3[_0x8f83('0x38')]=_[_0x8f83('0x39')](db[_0x8f83('0x4e')]['rawAttributes']);_0x1ec7f3[_0x8f83('0x3c')]=_['keys'](_0x30dcb9[_0x8f83('0x3c')]);_0x1ec7f3[_0x8f83('0x3a')]=_[_0x8f83('0x3b')](_0x1ec7f3[_0x8f83('0x38')],_0x1ec7f3['query']);_0x1dfcc0['attributes']=_[_0x8f83('0x3b')](_0x1ec7f3['model'],qs[_0x8f83('0x3d')](_0x30dcb9[_0x8f83('0x3c')]['fields']));_0x1dfcc0['attributes']=_0x1dfcc0['attributes']['length']?_0x1dfcc0['attributes']:_0x1ec7f3[_0x8f83('0x38')];if(_0x30dcb9[_0x8f83('0x3c')]['includeAll']){_0x1dfcc0[_0x8f83('0x4a')]=[{'all':!![]}];}_0x1dfcc0=_[_0x8f83('0x47')]({},_0x1dfcc0,_0x30dcb9[_0x8f83('0x48')]);return db[_0x8f83('0x4e')][_0x8f83('0x4f')](_0x1dfcc0)[_0x8f83('0x29')](handleEntityNotFound(_0x214430,null))[_0x8f83('0x29')](respondWithResult(_0x214430,null))[_0x8f83('0x4b')](handleError(_0x214430,null));};exports[_0x8f83('0x50')]=function(_0x265abc,_0x524781){return db['Dashboard'][_0x8f83('0x50')](_0x265abc[_0x8f83('0x51')],{})[_0x8f83('0x29')](function(_0x4f0e18){var _0x135d58=_0x265abc[_0x8f83('0x52')][_0x8f83('0x2a')]({'plain':!![]});if(!_0x135d58)throw new Error(_0x8f83('0x53'));if(_0x135d58[_0x8f83('0x54')]===_0x8f83('0x52')){var _0x3ee63d=_0x4f0e18[_0x8f83('0x2a')]({'plain':!![]});var _0x3ed451=_0x8f83('0x2b');return db[_0x8f83('0x55')][_0x8f83('0x4f')]({'where':{'name':_0x3ed451,'userProfileId':_0x135d58[_0x8f83('0x56')]},'raw':!![]})[_0x8f83('0x29')](function(_0x4f48de){if(_0x4f48de&&_0x4f48de[_0x8f83('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x3ee63d[_0x8f83('0x31')],'resourceId':_0x3ee63d['id'],'type':_0x4f48de[_0x8f83('0x31')],'sectionId':_0x4f48de['id']},{})['then'](function(){return _0x4f0e18;});}else{return _0x4f0e18;}})[_0x8f83('0x4b')](function(_0x32d3dd){logger[_0x8f83('0x2f')](_0x8f83('0x58'),_0x32d3dd);throw _0x32d3dd;});}return _0x4f0e18;})['then'](respondWithResult(_0x524781,0xc9))[_0x8f83('0x4b')](handleError(_0x524781,null));};exports[_0x8f83('0x59')]=function(_0x3e6aa6,_0x1e0d05){var _0x1fa873={'where':{'id':_0x3e6aa6[_0x8f83('0x4d')]['id']}},_0x18bcfb={};_0x18bcfb[_0x8f83('0x38')]=_[_0x8f83('0x39')](db[_0x8f83('0x4e')]['rawAttributes']);_0x1fa873['attributes']=_[_0x8f83('0x3b')](_0x18bcfb[_0x8f83('0x38')],qs[_0x8f83('0x3d')](_0x3e6aa6[_0x8f83('0x3c')][_0x8f83('0x3d')]));_0x1fa873[_0x8f83('0x3e')]=_0x1fa873['attributes'][_0x8f83('0x3f')]?_0x1fa873['attributes']:_0x18bcfb[_0x8f83('0x38')];if(_0x3e6aa6[_0x8f83('0x3c')]['includeAll']){_0x1fa873[_0x8f83('0x4a')]=[{'all':!![]}];}_0x1fa873=_[_0x8f83('0x47')]({},_0x1fa873,_0x3e6aa6[_0x8f83('0x48')]);return db[_0x8f83('0x4e')]['find'](_0x1fa873)['then'](handleEntityNotFound(_0x1e0d05,null))[_0x8f83('0x29')](function(_0x205a8d){if(_0x205a8d){var _0x427557=_0x205a8d[_0x8f83('0x2a')]({'plain':!![]});_0x427557=qs[_0x8f83('0x5a')](_0x427557,['id',_0x8f83('0x5b'),'updatedAt']);_0x3e6aa6['body']=_[_0x8f83('0x5a')](_0x3e6aa6['body'],['id','createdAt','updatedAt']);return db[_0x8f83('0x4e')][_0x8f83('0x50')](_[_0x8f83('0x47')](_0x427557,_0x3e6aa6[_0x8f83('0x51')]),{'include':_0x3e6aa6['query'][_0x8f83('0x49')]?[{'all':!![]}]:undefined})[_0x8f83('0x29')](function(_0x354cc3){var _0x30fde5=_0x3e6aa6[_0x8f83('0x52')][_0x8f83('0x2a')]({'plain':!![]});if(!_0x30fde5)throw new Error(_0x8f83('0x53'));if(_0x30fde5[_0x8f83('0x54')]==='user'){var _0x1cadf8=_0x354cc3[_0x8f83('0x2a')]({'plain':!![]});var _0xd58dca=_0x8f83('0x2b');return db[_0x8f83('0x55')][_0x8f83('0x4f')]({'where':{'name':_0xd58dca,'userProfileId':_0x30fde5[_0x8f83('0x56')]},'raw':!![]})[_0x8f83('0x29')](function(_0x21921f){if(_0x21921f&&_0x21921f[_0x8f83('0x57')]===0x0){return db[_0x8f83('0x2c')][_0x8f83('0x50')]({'name':_0x1cadf8[_0x8f83('0x31')],'resourceId':_0x1cadf8['id'],'type':_0x21921f[_0x8f83('0x31')],'sectionId':_0x21921f['id']},{})[_0x8f83('0x29')](function(){return _0x354cc3;});}else{return _0x354cc3;}})['catch'](function(_0xa76187){logger['error'](_0x8f83('0x58'),_0xa76187);throw _0xa76187;});}return _0x354cc3;});}})[_0x8f83('0x29')](respondWithResult(_0x1e0d05,0xc9))['catch'](handleError(_0x1e0d05,null));};exports['update']=function(_0x3f86cc,_0x37d5ce){if(_0x3f86cc['body']['id']){delete _0x3f86cc[_0x8f83('0x51')]['id'];}return db['Dashboard'][_0x8f83('0x4f')]({'where':{'id':_0x3f86cc['params']['id']}})[_0x8f83('0x29')](handleEntityNotFound(_0x37d5ce,null))['then'](saveUpdates(_0x3f86cc['body'],null))['then'](respondWithResult(_0x37d5ce,null))['catch'](handleError(_0x37d5ce,null));};exports['destroy']=function(_0x3651dc,_0x1c0d02){return db[_0x8f83('0x4e')]['find']({'where':{'id':_0x3651dc[_0x8f83('0x4d')]['id']}})[_0x8f83('0x29')](handleEntityNotFound(_0x1c0d02,null))[_0x8f83('0x29')](removeEntity(_0x1c0d02,null))[_0x8f83('0x4b')](handleError(_0x1c0d02,null));};function widgetAttributes(_0x49297c){try{switch(_0x49297c[_0x8f83('0x36')]){case _0x8f83('0x5c'):return[{'name':_0x8f83('0x5d'),'value':_0x49297c[_0x8f83('0x5d')]||(_0x49297c[_0x8f83('0x5e')]&&_0x49297c[_0x8f83('0x5e')][0x0]?_0x49297c[_0x8f83('0x5e')][0x0][_0x8f83('0x5f')]:undefined)||'https://'}];case'custom':return[{'name':_0x8f83('0x60'),'value':_0x49297c[_0x8f83('0x60')]||(_0x49297c['attrs']&&_0x49297c['attrs'][0x0]?_0x49297c['attrs'][0x0][_0x8f83('0x5f')]:undefined)||''}];case _0x8f83('0x61'):return[{'name':_0x8f83('0x62'),'value':_0x49297c[_0x8f83('0x62')]||(_0x49297c[_0x8f83('0x5e')]&&_0x49297c[_0x8f83('0x5e')][0x0]?_0x49297c[_0x8f83('0x5e')][0x0][_0x8f83('0x5f')]:undefined)||_0x8f83('0x63')},{'name':_0x8f83('0x64'),'value':_0x49297c[_0x8f83('0x64')]||(_0x49297c[_0x8f83('0x5e')]&&_0x49297c[_0x8f83('0x5e')][0x1]?_0x49297c[_0x8f83('0x5e')][0x1][_0x8f83('0x5f')]:undefined)||_0x8f83('0x65')},{'name':_0x8f83('0x66'),'value':_0x49297c[_0x8f83('0x66')]||(_0x49297c[_0x8f83('0x5e')]&&_0x49297c['attrs'][0x2]?_0x49297c[_0x8f83('0x5e')][0x2][_0x8f83('0x5f')]:undefined)||0xc}];case'counter':return[{'name':_0x8f83('0x67'),'value':_0x49297c['attrMetric']||(_0x49297c['attrs']&&_0x49297c[_0x8f83('0x5e')][0x0]?_0x49297c[_0x8f83('0x5e')][0x0][_0x8f83('0x5f')]:undefined)||_0x8f83('0x68')},{'name':'attrVoiceQueues','value':_0x49297c[_0x8f83('0x69')]||(_0x49297c[_0x8f83('0x5e')]&&_0x49297c['attrs'][0x1]?_0x49297c[_0x8f83('0x5e')][0x1]['value']:undefined)||[]},{'name':_0x8f83('0x66'),'value':_0x49297c['attrFontSize']||(_0x49297c['attrs']&&_0x49297c[_0x8f83('0x5e')][0x2]?_0x49297c[_0x8f83('0x5e')][0x2][_0x8f83('0x5f')]:undefined)||0x14}];case _0x8f83('0x6a'):case _0x8f83('0x6b'):return[{'name':_0x8f83('0x6c'),'value':_0x49297c[_0x8f83('0x6c')]||(_0x49297c[_0x8f83('0x5e')]&&_0x49297c[_0x8f83('0x5e')][0x0]?_0x49297c[_0x8f83('0x5e')][0x0]['value']:undefined)||_0x8f83('0x68')},{'name':_0x8f83('0x6d'),'value':_0x49297c['attrSerie2']||(_0x49297c[_0x8f83('0x5e')]&&_0x49297c['attrs'][0x1]?_0x49297c['attrs'][0x1][_0x8f83('0x5f')]:undefined)||null},{'name':'attrSerie3','value':_0x49297c[_0x8f83('0x6e')]||(_0x49297c[_0x8f83('0x5e')]&&_0x49297c[_0x8f83('0x5e')][0x2]?_0x49297c[_0x8f83('0x5e')][0x2][_0x8f83('0x5f')]:undefined)||null},{'name':_0x8f83('0x69'),'value':_0x49297c[_0x8f83('0x69')]||(_0x49297c[_0x8f83('0x5e')]&&_0x49297c[_0x8f83('0x5e')][0x3]?_0x49297c['attrs'][0x3][_0x8f83('0x5f')]:undefined)||[]}];case _0x8f83('0x6f'):return[{'name':_0x8f83('0x70'),'type':_0x49297c['reportType']||(_0x49297c[_0x8f83('0x5e')]&&_0x49297c[_0x8f83('0x5e')][0x0]?_0x49297c[_0x8f83('0x5e')][0x0]['type']:undefined)||null,'value':_0x49297c['attrReport']||(_0x49297c['attrs']&&_0x49297c[_0x8f83('0x5e')][0x0]?_0x49297c[_0x8f83('0x5e')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x49297c['attrRefresh']||(_0x49297c['attrs']&&_0x49297c['attrs'][0x1]?_0x49297c[_0x8f83('0x5e')][0x1][_0x8f83('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x431d55){logger['error']('widgetAttributes:\x20%s',JSON[_0x8f83('0x71')](_0x431d55));return[];}}exports[_0x8f83('0x72')]=function(_0x24445a,_0x12c851,_0x672b52){if(_0x24445a[_0x8f83('0x51')]['id']){delete _0x24445a[_0x8f83('0x51')]['id'];}return db[_0x8f83('0x4e')][_0x8f83('0x4f')]({'where':{'id':_0x24445a['params']['id']}})['then'](handleEntityNotFound(_0x12c851,null))[_0x8f83('0x29')](function(_0x330437){if(_0x330437){_0x24445a[_0x8f83('0x51')][_0x8f83('0x73')]=_0x330437['id'];_0x24445a[_0x8f83('0x51')][_0x8f83('0x5e')]=widgetAttributes(_0x24445a['body']);return db['DashboardItem']['create'](_0x24445a[_0x8f83('0x51')]);}})[_0x8f83('0x29')](respondWithResult(_0x12c851,null))['catch'](handleError(_0x12c851,null));};exports['getItems']=function(_0x1d2b78,_0xc466a9,_0x7ed252){var _0x571adf={};var _0x80e80={};var _0x2484fd;var _0x4e17b1;return db[_0x8f83('0x4e')][_0x8f83('0x74')]({'where':{'id':_0x1d2b78[_0x8f83('0x4d')]['id']}})['then'](handleEntityNotFound(_0xc466a9,null))['then'](function(_0x419f72){if(_0x419f72){_0x2484fd=_0x419f72;_0x80e80[_0x8f83('0x38')]=_[_0x8f83('0x39')](db[_0x8f83('0x75')][_0x8f83('0x34')]);_0x80e80[_0x8f83('0x3c')]=_[_0x8f83('0x39')](_0x1d2b78[_0x8f83('0x3c')]);_0x80e80['filters']=_[_0x8f83('0x3b')](_0x80e80['model'],_0x80e80[_0x8f83('0x3c')]);_0x571adf[_0x8f83('0x3e')]=_[_0x8f83('0x3b')](_0x80e80['model'],qs['fields'](_0x1d2b78[_0x8f83('0x3c')][_0x8f83('0x3d')]));_0x571adf['attributes']=_0x571adf[_0x8f83('0x3e')]['length']?_0x571adf[_0x8f83('0x3e')]:_0x80e80[_0x8f83('0x38')];_0x571adf[_0x8f83('0x42')]=qs[_0x8f83('0x43')](_0x1d2b78['query']['sort']);_0x571adf[_0x8f83('0x44')]=qs[_0x8f83('0x3a')](_[_0x8f83('0x45')](_0x1d2b78[_0x8f83('0x3c')],_0x80e80[_0x8f83('0x3a')]));if(_0x1d2b78[_0x8f83('0x3c')][_0x8f83('0x46')]){_0x571adf[_0x8f83('0x44')]=_['merge'](_0x571adf['where'],{'$or':_['map'](_0x571adf[_0x8f83('0x3e')],function(_0x26ff8d){var _0x413b0e={};_0x413b0e[_0x26ff8d]={'$like':'%'+_0x1d2b78[_0x8f83('0x3c')][_0x8f83('0x46')]+'%'};return _0x413b0e;})});}_0x571adf=_[_0x8f83('0x47')]({},_0x571adf,_0x1d2b78['options']);return _0x2484fd[_0x8f83('0x76')](_0x571adf);}})[_0x8f83('0x29')](function(_0x42e9d0){if(_0x42e9d0){_0x4e17b1=_0x42e9d0['length'];if(!_0x1d2b78[_0x8f83('0x3c')]['hasOwnProperty'](_0x8f83('0x41'))){_0x571adf[_0x8f83('0x24')]=qs['limit'](_0x1d2b78['query'][_0x8f83('0x24')]);_0x571adf[_0x8f83('0x23')]=qs[_0x8f83('0x23')](_0x1d2b78[_0x8f83('0x3c')]['offset']);}return _0x2484fd['getItems'](_0x571adf);}})[_0x8f83('0x29')](function(_0x222703){if(_0x222703){return _0x222703?{'count':_0x4e17b1,'rows':_0x222703}:null;}})['then'](respondWithResult(_0xc466a9,null))[_0x8f83('0x4b')](handleError(_0xc466a9,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 23a587c..9d57fa8 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 _0x731f=['emit','hasOwnProperty','hook','events','../../mysqldb','Dashboard','setMaxListeners','update','remove'];(function(_0x14f2fa,_0x2004bd){var _0x2b3e45=function(_0x59dd0e){while(--_0x59dd0e){_0x14f2fa['push'](_0x14f2fa['shift']());}};_0x2b3e45(++_0x2004bd);}(_0x731f,0x8a));var _0xf731=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x731f[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0xf731('0x0'));var Dashboard=require(_0xf731('0x1'))['db'][_0xf731('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xf731('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf731('0x4'),'afterDestroy':_0xf731('0x5')};function emitEvent(_0x1e3b60){return function(_0x105559,_0x3a8cc4,_0x522ecb){DashboardEvents[_0xf731('0x6')](_0x1e3b60+':'+_0x105559['id'],_0x105559);DashboardEvents['emit'](_0x1e3b60,_0x105559);_0x522ecb(null);};}for(var e in events){if(events[_0xf731('0x7')](e)){var event=events[e];Dashboard[_0xf731('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x18bd=['update','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x563496,_0x27b251){var _0x1a595e=function(_0x40f7c8){while(--_0x40f7c8){_0x563496['push'](_0x563496['shift']());}};_0x1a595e(++_0x27b251);}(_0x18bd,0xfc));var _0xd18b=function(_0x5c8ef2,_0x418c99){_0x5c8ef2=_0x5c8ef2-0x0;var _0x498f8d=_0x18bd[_0x5c8ef2];return _0x498f8d;};'use strict';var EventEmitter=require(_0xd18b('0x0'));var Dashboard=require(_0xd18b('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xd18b('0x2')](0x0);var events={'afterCreate':_0xd18b('0x3'),'afterUpdate':_0xd18b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3f0367){return function(_0x33d247,_0x539c8c,_0x5751c){DashboardEvents[_0xd18b('0x5')](_0x3f0367+':'+_0x33d247['id'],_0x33d247);DashboardEvents[_0xd18b('0x5')](_0x3f0367,_0x33d247);_0x5751c(null);};}for(var e in events){if(events[_0xd18b('0x6')](e)){var event=events[e];Dashboard[_0xd18b('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 1a267c7..9165cca 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 _0x528d=['dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','define','Dashboard'];(function(_0x377dbd,_0x316f50){var _0x318ff8=function(_0x5a3ea5){while(--_0x5a3ea5){_0x377dbd['push'](_0x377dbd['shift']());}};_0x318ff8(++_0x316f50);}(_0x528d,0x17b));var _0xd528=function(_0x4fdf99,_0x4c4095){_0x4fdf99=_0x4fdf99-0x0;var _0x3b1a6c=_0x528d[_0x4fdf99];return _0x3b1a6c;};'use strict';var _=require(_0xd528('0x0'));var util=require(_0xd528('0x1'));var logger=require(_0xd528('0x2'))(_0xd528('0x3'));var moment=require(_0xd528('0x4'));var BPromise=require(_0xd528('0x5'));var rp=require(_0xd528('0x6'));var fs=require('fs');var path=require(_0xd528('0x7'));var rimraf=require(_0xd528('0x8'));var config=require(_0xd528('0x9'));var attributes=require(_0xd528('0xa'));module['exports']=function(_0x15f111,_0x39841d){return _0x15f111[_0xd528('0xb')](_0xd528('0xc'),attributes,{'tableName':_0xd528('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c66=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes','exports','define','dashboards'];(function(_0x4058a4,_0x48ca8c){var _0x3bea24=function(_0x1cb8b9){while(--_0x1cb8b9){_0x4058a4['push'](_0x4058a4['shift']());}};_0x3bea24(++_0x48ca8c);}(_0x4c66,0xd0));var _0x64c6=function(_0x287152,_0x376f80){_0x287152=_0x287152-0x0;var _0x2785f4=_0x4c66[_0x287152];return _0x2785f4;};'use strict';var _=require(_0x64c6('0x0'));var util=require(_0x64c6('0x1'));var logger=require(_0x64c6('0x2'))(_0x64c6('0x3'));var moment=require(_0x64c6('0x4'));var BPromise=require(_0x64c6('0x5'));var rp=require(_0x64c6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x64c6('0x7'));var config=require(_0x64c6('0x8'));var attributes=require(_0x64c6('0x9'));module[_0x64c6('0xa')]=function(_0x3775b7,_0xb21750){return _0x3775b7[_0x64c6('0xb')]('Dashboard',attributes,{'tableName':_0x64c6('0xc'),'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 4dde413..8d003d8 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 _0xdcc0=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x96643c,_0x5e101c){var _0x359103=function(_0x216871){while(--_0x216871){_0x96643c['push'](_0x96643c['shift']());}};_0x359103(++_0x5e101c);}(_0xdcc0,0x1bb));var _0x0dcc=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xdcc0[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x0dcc('0x0'));var util=require('util');var moment=require(_0x0dcc('0x1'));var BPromise=require(_0x0dcc('0x2'));var rs=require(_0x0dcc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0dcc('0x4'))['db'];var utils=require(_0x0dcc('0x5'));var logger=require(_0x0dcc('0x6'))(_0x0dcc('0x7'));var config=require('../../config/environment');var jayson=require(_0x0dcc('0x8'));var client=jayson[_0x0dcc('0x9')][_0x0dcc('0xa')]({'port':0x232a});config[_0x0dcc('0xb')]=_[_0x0dcc('0xc')](config['redis'],{'host':_0x0dcc('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0dcc('0xe'))[_0x0dcc('0xf')](socket);function respondWithRpcPromise(_0x128f29,_0x1315a8,_0x5ac779){return new BPromise(function(_0xdad3ed,_0x48f496){return client['request'](_0x128f29,_0x5ac779)[_0x0dcc('0x10')](function(_0x2e4a5e){logger[_0x0dcc('0x11')](_0x0dcc('0x12'),_0x1315a8,_0x0dcc('0x13'));logger[_0x0dcc('0x14')](_0x0dcc('0x15'),_0x1315a8,_0x0dcc('0x13'),JSON[_0x0dcc('0x16')](_0x2e4a5e));if(_0x2e4a5e[_0x0dcc('0x17')]){if(_0x2e4a5e[_0x0dcc('0x17')][_0x0dcc('0x18')]===0x1f4){logger[_0x0dcc('0x17')]('Dashboard,\x20%s,\x20%s',_0x1315a8,_0x2e4a5e[_0x0dcc('0x17')]['message']);return _0x48f496(_0x2e4a5e[_0x0dcc('0x17')]['message']);}logger[_0x0dcc('0x17')](_0x0dcc('0x12'),_0x1315a8,_0x2e4a5e[_0x0dcc('0x17')][_0x0dcc('0x19')]);return _0xdad3ed(_0x2e4a5e[_0x0dcc('0x17')]['message']);}else{logger[_0x0dcc('0x11')](_0x0dcc('0x12'),_0x1315a8,'request\x20sent');_0xdad3ed(_0x2e4a5e[_0x0dcc('0x1a')]['message']);}})[_0x0dcc('0x1b')](function(_0x12bc87){logger['error'](_0x0dcc('0x12'),_0x1315a8,_0x12bc87);_0x48f496(_0x12bc87);});});} \ No newline at end of file +var _0xbaa5=['client','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x4caade,_0x549ce1){var _0x2041ff=function(_0x402f3a){while(--_0x402f3a){_0x4caade['push'](_0x4caade['shift']());}};_0x2041ff(++_0x549ce1);}(_0xbaa5,0x1d5));var _0x5baa=function(_0x1ce8d1,_0x64a943){_0x1ce8d1=_0x1ce8d1-0x0;var _0x256fe4=_0xbaa5[_0x1ce8d1];return _0x256fe4;};'use strict';var _=require(_0x5baa('0x0'));var util=require(_0x5baa('0x1'));var moment=require(_0x5baa('0x2'));var BPromise=require(_0x5baa('0x3'));var rs=require(_0x5baa('0x4'));var fs=require('fs');var Redis=require(_0x5baa('0x5'));var db=require(_0x5baa('0x6'))['db'];var utils=require(_0x5baa('0x7'));var logger=require(_0x5baa('0x8'))(_0x5baa('0x9'));var config=require('../../config/environment');var jayson=require(_0x5baa('0xa'));var client=jayson[_0x5baa('0xb')]['http']({'port':0x232a});config['redis']=_[_0x5baa('0xc')](config[_0x5baa('0xd')],{'host':_0x5baa('0xe'),'port':0x18eb});var socket=require(_0x5baa('0xf'))(new Redis(config['redis']));require(_0x5baa('0x10'))[_0x5baa('0x11')](socket);function respondWithRpcPromise(_0x48a032,_0x190259,_0x28a4e7){return new BPromise(function(_0x38d7fa,_0x50eb6e){return client[_0x5baa('0x12')](_0x48a032,_0x28a4e7)[_0x5baa('0x13')](function(_0x1721c6){logger['info'](_0x5baa('0x14'),_0x190259,_0x5baa('0x15'));logger[_0x5baa('0x16')](_0x5baa('0x17'),_0x190259,_0x5baa('0x15'),JSON[_0x5baa('0x18')](_0x1721c6));if(_0x1721c6[_0x5baa('0x19')]){if(_0x1721c6[_0x5baa('0x19')][_0x5baa('0x1a')]===0x1f4){logger[_0x5baa('0x19')]('Dashboard,\x20%s,\x20%s',_0x190259,_0x1721c6['error'][_0x5baa('0x1b')]);return _0x50eb6e(_0x1721c6[_0x5baa('0x19')]['message']);}logger[_0x5baa('0x19')](_0x5baa('0x14'),_0x190259,_0x1721c6[_0x5baa('0x19')][_0x5baa('0x1b')]);return _0x38d7fa(_0x1721c6[_0x5baa('0x19')][_0x5baa('0x1b')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x190259,'request\x20sent');_0x38d7fa(_0x1721c6[_0x5baa('0x1c')]['message']);}})[_0x5baa('0x1d')](function(_0xdb7a87){logger[_0x5baa('0x19')](_0x5baa('0x14'),_0x190259,_0xdb7a87);_0x50eb6e(_0xdb7a87);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index b6952e3..d2cce4c 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 _0x0fe3=['update','removeListener','register','length','dashboard:','./dashboard.events','remove'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x0fe3,0x178));var _0x30fe=function(_0x3698bd,_0x109732){_0x3698bd=_0x3698bd-0x0;var _0x491d8e=_0x0fe3[_0x3698bd];return _0x491d8e;};'use strict';var DashboardEvents=require(_0x30fe('0x0'));var events=['save',_0x30fe('0x1'),_0x30fe('0x2')];function createListener(_0x5aaf3d,_0x3daa22){return function(_0x6674ab){_0x3daa22['emit'](_0x5aaf3d,_0x6674ab);};}function removeListener(_0x3acfe8,_0xd98f8){return function(){DashboardEvents[_0x30fe('0x3')](_0x3acfe8,_0xd98f8);};}exports[_0x30fe('0x4')]=function(_0x2ec707){for(var _0x370c17=0x0,_0x3638b0=events[_0x30fe('0x5')];_0x370c17<_0x3638b0;_0x370c17++){var _0x2fed89=events[_0x370c17];var _0x4b0d37=createListener(_0x30fe('0x6')+_0x2fed89,_0x2ec707);DashboardEvents['on'](_0x2fed89,_0x4b0d37);}}; \ No newline at end of file +var _0x33b2=['update','emit','removeListener','register','length','save','remove'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x33b2,0x1d3));var _0x233b=function(_0x31b0de,_0x2d8988){_0x31b0de=_0x31b0de-0x0;var _0x4de47f=_0x33b2[_0x31b0de];return _0x4de47f;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x233b('0x0'),_0x233b('0x1'),_0x233b('0x2')];function createListener(_0x4b5698,_0xbbbda0){return function(_0x142b39){_0xbbbda0[_0x233b('0x3')](_0x4b5698,_0x142b39);};}function removeListener(_0x51b687,_0x33f668){return function(){DashboardEvents[_0x233b('0x4')](_0x51b687,_0x33f668);};}exports[_0x233b('0x5')]=function(_0x35ded8){for(var _0xfe4e60=0x0,_0x1ecb6f=events[_0x233b('0x6')];_0xfe4e60<_0x1ecb6f;_0xfe4e60++){var _0x18e0d7=events[_0xfe4e60];var _0x39a46d=createListener('dashboard:'+_0x18e0d7,_0x35ded8);DashboardEvents['on'](_0x18e0d7,_0x39a46d);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 1621852..7f4c5ad 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 _0x6f0d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','isAuthenticated','get','/:id','show','getItems','post','create','/:id/clone','clone','addItem','put','update','delete','exports','util','path','connect-timeout','express'];(function(_0x3f6cd2,_0x20af30){var _0x138348=function(_0x30ecaa){while(--_0x30ecaa){_0x3f6cd2['push'](_0x3f6cd2['shift']());}};_0x138348(++_0x20af30);}(_0x6f0d,0x16c));var _0xd6f0=function(_0xc342a9,_0x2128e5){_0xc342a9=_0xc342a9-0x0;var _0x1a0231=_0x6f0d[_0xc342a9];return _0x1a0231;};'use strict';var multer=require('multer');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express['Router']();var fs_extra=require(_0xd6f0('0x4'));var auth=require(_0xd6f0('0x5'));var interaction=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var controller=require(_0xd6f0('0x8'));router['get']('/',auth[_0xd6f0('0x9')](),controller['index']);router[_0xd6f0('0xa')](_0xd6f0('0xb'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xc')]);router['get']('/:id/items',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xd')]);router[_0xd6f0('0xe')]('/',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xf')]);router['post'](_0xd6f0('0x10'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x11')]);router[_0xd6f0('0xe')]('/:id/items',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x12')]);router[_0xd6f0('0x13')](_0xd6f0('0xb'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x14')]);router[_0xd6f0('0x15')](_0xd6f0('0xb'),auth[_0xd6f0('0x9')](),controller['destroy']);module[_0xd6f0('0x16')]=router; \ No newline at end of file +var _0x00bb=['/:id/items','post','create','/:id/clone','clone','addItem','put','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','get','/:id','isAuthenticated','show'];(function(_0x15aef5,_0x54f850){var _0x15daa5=function(_0x10931d){while(--_0x10931d){_0x15aef5['push'](_0x15aef5['shift']());}};_0x15daa5(++_0x54f850);}(_0x00bb,0x1d8));var _0xb00b=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x00bb[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var path=require(_0xb00b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb00b('0x3'));var router=express['Router']();var fs_extra=require(_0xb00b('0x4'));var auth=require(_0xb00b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb00b('0x6'));var controller=require(_0xb00b('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb00b('0x8')](_0xb00b('0x9'),auth[_0xb00b('0xa')](),controller[_0xb00b('0xb')]);router[_0xb00b('0x8')](_0xb00b('0xc'),auth['isAuthenticated'](),controller['getItems']);router[_0xb00b('0xd')]('/',auth[_0xb00b('0xa')](),controller[_0xb00b('0xe')]);router[_0xb00b('0xd')](_0xb00b('0xf'),auth['isAuthenticated'](),controller[_0xb00b('0x10')]);router['post']('/:id/items',auth['isAuthenticated'](),controller[_0xb00b('0x11')]);router[_0xb00b('0x12')](_0xb00b('0x9'),auth[_0xb00b('0xa')](),controller[_0xb00b('0x13')]);router[_0xb00b('0x14')]('/:id',auth[_0xb00b('0xa')](),controller[_0xb00b('0x15')]);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 b773d9a..07f42a1 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 _0x3994=['#2196f3','sequelize','exports','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x1156ca,_0x2bb607){var _0x276e6c=function(_0x5af7d4){while(--_0x5af7d4){_0x1156ca['push'](_0x1156ca['shift']());}};_0x276e6c(++_0x2bb607);}(_0x3994,0x114));var _0x4399=function(_0xe8a94b,_0x3e8cc8){_0xe8a94b=_0xe8a94b-0x0;var _0x34d026=_0x3994[_0xe8a94b];return _0x34d026;};'use strict';var Sequelize=require(_0x4399('0x0'));var squel=require('squel');var _=require('lodash');module[_0x4399('0x1')]={'title':{'type':Sequelize[_0x4399('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4399('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x4399('0x3')]('long'),'get':function(){try{return JSON[_0x4399('0x4')](this[_0x4399('0x5')](_0x4399('0x6')));}catch(_0x368363){return[];}},'set':function(_0xc90cca){try{this[_0x4399('0x7')]('attrs',JSON[_0x4399('0x8')](_0xc90cca));}catch(_0x596f03){this[_0x4399('0x7')](_0x4399('0x6'),JSON[_0x4399('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x4399('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x4399('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4399('0x9')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x4399('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4399('0x2')],'allowNull':![],'defaultValue':_0x4399('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x4399('0x2')]},'titleFontSize':{'type':Sequelize[_0x4399('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0x7642=['attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','sequelize','squel','exports','STRING','TEXT','long','parse','getDataValue'];(function(_0x3ab4d4,_0x597cdc){var _0x5123e5=function(_0x55d51e){while(--_0x55d51e){_0x3ab4d4['push'](_0x3ab4d4['shift']());}};_0x5123e5(++_0x597cdc);}(_0x7642,0xa0));var _0x2764=function(_0x192e10,_0x1264e4){_0x192e10=_0x192e10-0x0;var _0x4b3c0d=_0x7642[_0x192e10];return _0x4b3c0d;};'use strict';var Sequelize=require(_0x2764('0x0'));var squel=require(_0x2764('0x1'));var _=require('lodash');module[_0x2764('0x2')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2764('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x2764('0x4')](_0x2764('0x5')),'get':function(){try{return JSON[_0x2764('0x6')](this[_0x2764('0x7')](_0x2764('0x8')));}catch(_0xc7bb96){return[];}},'set':function(_0xf9cf25){try{this['setDataValue']('attrs',JSON[_0x2764('0x9')](_0xf9cf25));}catch(_0xc2d58d){this[_0x2764('0xa')]('attrs',JSON[_0x2764('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x2764('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x2764('0xb')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2764('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2764('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x2764('0xb')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 3fe90da..cc49823 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 _0x85fc=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','find','params','type','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','create','body','catch','eml-format'];(function(_0x2f726d,_0x4c486c){var _0x38e7fe=function(_0x16fbb2){while(--_0x16fbb2){_0x2f726d['push'](_0x2f726d['shift']());}};_0x38e7fe(++_0x4c486c);}(_0x85fc,0x119));var _0xc85f=function(_0x7c6dce,_0x2ae0f1){_0x7c6dce=_0x7c6dce-0x0;var _0x979be6=_0x85fc[_0x7c6dce];return _0x979be6;};'use strict';var emlformat=require(_0xc85f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc85f('0x1'));var jsonpatch=require(_0xc85f('0x2'));var rp=require(_0xc85f('0x3'));var moment=require('moment');var BPromise=require(_0xc85f('0x4'));var Mustache=require(_0xc85f('0x5'));var util=require(_0xc85f('0x6'));var path=require(_0xc85f('0x7'));var sox=require(_0xc85f('0x8'));var csv=require(_0xc85f('0x9'));var ejs=require(_0xc85f('0xa'));var fs=require('fs');var fs_extra=require(_0xc85f('0xb'));var _=require(_0xc85f('0xc'));var squel=require(_0xc85f('0xd'));var crypto=require(_0xc85f('0xe'));var jsforce=require(_0xc85f('0xf'));var deskjs=require(_0xc85f('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc85f('0x11'));var Papa=require(_0xc85f('0x12'));var Redis=require(_0xc85f('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xc85f('0x14'));var as=require(_0xc85f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc85f('0x16'))(_0xc85f('0x17'));var utils=require(_0xc85f('0x18'));var config=require(_0xc85f('0x19'));var licenseUtil=require(_0xc85f('0x1a'));var db=require('../../mysqldb')['db'];config[_0xc85f('0x1b')]=_[_0xc85f('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc85f('0x1d'))(new Redis(config[_0xc85f('0x1b')]));require(_0xc85f('0x1e'))[_0xc85f('0x1f')](socket);function respondWithStatusCode(_0x437c58,_0x1dd2dc){_0x1dd2dc=_0x1dd2dc||0xcc;return function(_0x34a876){if(_0x34a876){return _0x437c58[_0xc85f('0x20')](_0x1dd2dc);}return _0x437c58[_0xc85f('0x21')](_0x1dd2dc)[_0xc85f('0x22')]();};}function respondWithResult(_0x14bdc1,_0x1f5505){_0x1f5505=_0x1f5505||0xc8;return function(_0x320b21){if(_0x320b21){return _0x14bdc1[_0xc85f('0x21')](_0x1f5505)[_0xc85f('0x23')](_0x320b21);}};}function respondWithFilteredResult(_0x4309c9,_0x5e3de7){return function(_0x4afc2a){if(_0x4afc2a){var _0x55c055=_0x4afc2a[_0xc85f('0x24')],_0x23e3e9=_0x5e3de7[_0xc85f('0x25')],_0x121c17=_0x5e3de7[_0xc85f('0x25')]+_0x5e3de7[_0xc85f('0x26')],_0x189443;if(_0x121c17>=_0x55c055){_0x121c17=_0x55c055;_0x189443=0xc8;}else{_0x189443=0xce;}_0x4309c9['status'](_0x189443);return _0x4309c9[_0xc85f('0x27')](_0xc85f('0x28'),_0x23e3e9+'-'+_0x121c17+'/'+_0x55c055)['json'](_0x4afc2a);}return null;};}function patchUpdates(_0x155995){return function(_0x3ec531){try{jsonpatch[_0xc85f('0x29')](_0x3ec531,_0x155995,!![]);}catch(_0x1c4dd2){return BPromise[_0xc85f('0x2a')](_0x1c4dd2);}return _0x3ec531[_0xc85f('0x2b')]();};}function saveUpdates(_0x2e4218,_0x3e4d69){return function(_0x39ac87){if(_0x39ac87){return _0x39ac87[_0xc85f('0x2c')](_0x2e4218)['then'](function(_0x1a9b66){return _0x1a9b66;});}return null;};}function removeEntity(_0x58b906,_0x19750c){return function(_0x24b0a1){if(_0x24b0a1){return _0x24b0a1[_0xc85f('0x2d')]()[_0xc85f('0x2e')](function(){_0x58b906[_0xc85f('0x21')](0xcc)[_0xc85f('0x22')]();});}};}function handleEntityNotFound(_0x4ac443,_0x206ba8){return function(_0x1825d4){if(!_0x1825d4){_0x4ac443[_0xc85f('0x20')](0x194);}return _0x1825d4;};}function handleError(_0x14e975,_0x2046b8){_0x2046b8=_0x2046b8||0x1f4;return function(_0x1dc148){logger[_0xc85f('0x2f')](_0x1dc148[_0xc85f('0x30')]);if(_0x1dc148[_0xc85f('0x31')]){delete _0x1dc148[_0xc85f('0x31')];}_0x14e975[_0xc85f('0x21')](_0x2046b8)[_0xc85f('0x32')](_0x1dc148);};}exports['show']=function(_0x88230a,_0x2f56f6){var _0x4155ab={'raw':![],'where':{'id':_0x88230a['params']['id']}},_0xd82143={};_0xd82143[_0xc85f('0x33')]=_[_0xc85f('0x34')](db[_0xc85f('0x35')][_0xc85f('0x36')]);_0xd82143[_0xc85f('0x37')]=_[_0xc85f('0x34')](_0x88230a[_0xc85f('0x37')]);_0xd82143[_0xc85f('0x38')]=_[_0xc85f('0x39')](_0xd82143[_0xc85f('0x33')],_0xd82143[_0xc85f('0x37')]);_0x4155ab[_0xc85f('0x3a')]=_['intersection'](_0xd82143[_0xc85f('0x33')],qs['fields'](_0x88230a[_0xc85f('0x37')][_0xc85f('0x3b')]));_0x4155ab[_0xc85f('0x3a')]=_0x4155ab[_0xc85f('0x3a')]['length']?_0x4155ab[_0xc85f('0x3a')]:_0xd82143[_0xc85f('0x33')];if(_0x88230a[_0xc85f('0x37')][_0xc85f('0x3c')]){_0x4155ab[_0xc85f('0x3d')]=[{'all':!![]}];}_0x4155ab=_[_0xc85f('0x3e')]({},_0x4155ab,_0x88230a[_0xc85f('0x3f')]);return db[_0xc85f('0x35')][_0xc85f('0x40')](_0x4155ab)[_0xc85f('0x2e')](handleEntityNotFound(_0x2f56f6,null))[_0xc85f('0x2e')](respondWithResult(_0x2f56f6,null))['catch'](handleError(_0x2f56f6,null));};exports['destroy']=function(_0xfd87c7,_0x34ad09){return db[_0xc85f('0x35')][_0xc85f('0x40')]({'where':{'id':_0xfd87c7[_0xc85f('0x41')]['id']}})['then'](handleEntityNotFound(_0x34ad09,null))[_0xc85f('0x2e')](removeEntity(_0x34ad09,null))['catch'](handleError(_0x34ad09,null));};function widgetAttributes(_0x346440){try{switch(_0x346440[_0xc85f('0x42')]){case'iframe':return[{'name':_0xc85f('0x43'),'value':_0x346440[_0xc85f('0x43')]||(_0x346440[_0xc85f('0x44')]&&_0x346440['attrs'][0x0]?_0x346440[_0xc85f('0x44')][0x0]['value']:undefined)||'https://'}];case _0xc85f('0x45'):return[{'name':_0xc85f('0x46'),'value':_0x346440[_0xc85f('0x46')]||(_0x346440['attrs']&&_0x346440[_0xc85f('0x44')][0x0]?_0x346440[_0xc85f('0x44')][0x0][_0xc85f('0x47')]:undefined)||''}];case _0xc85f('0x48'):return[{'name':'attrHourFormat','value':_0x346440[_0xc85f('0x49')]||(_0x346440['attrs']&&_0x346440[_0xc85f('0x44')][0x0]?_0x346440['attrs'][0x0]['value']:undefined)||_0xc85f('0x4a')},{'name':_0xc85f('0x4b'),'value':_0x346440[_0xc85f('0x4b')]||(_0x346440[_0xc85f('0x44')]&&_0x346440[_0xc85f('0x44')][0x1]?_0x346440['attrs'][0x1][_0xc85f('0x47')]:undefined)||_0xc85f('0x4c')},{'name':_0xc85f('0x4d'),'value':_0x346440[_0xc85f('0x4d')]||(_0x346440[_0xc85f('0x44')]&&_0x346440['attrs'][0x2]?_0x346440[_0xc85f('0x44')][0x2][_0xc85f('0x47')]:undefined)||0xc}];case _0xc85f('0x4e'):return[{'name':'attrMetric','value':_0x346440[_0xc85f('0x4f')]||(_0x346440[_0xc85f('0x44')]&&_0x346440[_0xc85f('0x44')][0x0]?_0x346440[_0xc85f('0x44')][0x0][_0xc85f('0x47')]:undefined)||_0xc85f('0x50')},{'name':_0xc85f('0x51'),'value':_0x346440[_0xc85f('0x51')]||(_0x346440[_0xc85f('0x44')]&&_0x346440[_0xc85f('0x44')][0x1]?_0x346440[_0xc85f('0x44')][0x1][_0xc85f('0x47')]:undefined)||[]},{'name':_0xc85f('0x4d'),'value':_0x346440[_0xc85f('0x4d')]||(_0x346440[_0xc85f('0x44')]&&_0x346440[_0xc85f('0x44')][0x2]?_0x346440[_0xc85f('0x44')][0x2]['value']:undefined)||0x14}];case _0xc85f('0x52'):case _0xc85f('0x53'):return[{'name':'attrSerie1','value':_0x346440['attrSerie1']||(_0x346440[_0xc85f('0x44')]&&_0x346440['attrs'][0x0]?_0x346440[_0xc85f('0x44')][0x0][_0xc85f('0x47')]:undefined)||'total'},{'name':_0xc85f('0x54'),'value':_0x346440[_0xc85f('0x54')]||(_0x346440[_0xc85f('0x44')]&&_0x346440[_0xc85f('0x44')][0x1]?_0x346440['attrs'][0x1]['value']:undefined)||null},{'name':_0xc85f('0x55'),'value':_0x346440[_0xc85f('0x55')]||(_0x346440[_0xc85f('0x44')]&&_0x346440[_0xc85f('0x44')][0x2]?_0x346440[_0xc85f('0x44')][0x2][_0xc85f('0x47')]:undefined)||null},{'name':_0xc85f('0x51'),'value':_0x346440[_0xc85f('0x51')]||(_0x346440['attrs']&&_0x346440['attrs'][0x3]?_0x346440[_0xc85f('0x44')][0x3]['value']:undefined)||[]}];case _0xc85f('0x56'):return[{'name':_0xc85f('0x57'),'type':_0x346440[_0xc85f('0x58')]||(_0x346440['attrs']&&_0x346440['attrs'][0x0]?_0x346440['attrs'][0x0][_0xc85f('0x42')]:undefined)||null,'value':_0x346440[_0xc85f('0x57')]||(_0x346440[_0xc85f('0x44')]&&_0x346440[_0xc85f('0x44')][0x0]?_0x346440[_0xc85f('0x44')][0x0][_0xc85f('0x47')]:undefined)||null},{'name':_0xc85f('0x59'),'value':_0x346440[_0xc85f('0x59')]||(_0x346440[_0xc85f('0x44')]&&_0x346440[_0xc85f('0x44')][0x1]?_0x346440[_0xc85f('0x44')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4b124e){logger[_0xc85f('0x2f')]('widgetAttributes:\x20%s',JSON[_0xc85f('0x5a')](_0x4b124e));return[];}}exports[_0xc85f('0x5b')]=function(_0x4e4ba5,_0x10d715){if(_0x4e4ba5[_0xc85f('0x5c')]){_0x4e4ba5['body'][_0xc85f('0x44')]=widgetAttributes(_0x4e4ba5['body']);}return db[_0xc85f('0x35')][_0xc85f('0x5b')](_0x4e4ba5[_0xc85f('0x5c')],{})[_0xc85f('0x2e')](respondWithResult(_0x10d715,0xc9))[_0xc85f('0x5d')](handleError(_0x10d715,null));};exports[_0xc85f('0x2c')]=function(_0x577cb0,_0x15b751){if(_0x577cb0[_0xc85f('0x5c')]['id']){delete _0x577cb0['body']['id'];}_0x577cb0[_0xc85f('0x5c')][_0xc85f('0x44')]=widgetAttributes(_0x577cb0['body']);return db['DashboardItem'][_0xc85f('0x40')]({'where':{'id':_0x577cb0[_0xc85f('0x41')]['id']}})[_0xc85f('0x2e')](handleEntityNotFound(_0x15b751,null))[_0xc85f('0x2e')](saveUpdates(_0x577cb0[_0xc85f('0x5c')],null))[_0xc85f('0x2e')](respondWithResult(_0x15b751,null))[_0xc85f('0x5d')](handleError(_0x15b751,null));}; \ No newline at end of file +var _0xc94d=['../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','register','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','params','keys','DashboardItem','query','filters','model','attributes','fields','length','include','catch','destroy','find','type','attrUrl','attrs','value','https://','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','error','widgetAttributes:\x20%s','stringify','body','create','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x3eb55f,_0x446b1b){var _0x52f1fa=function(_0x16c554){while(--_0x16c554){_0x3eb55f['push'](_0x3eb55f['shift']());}};_0x52f1fa(++_0x446b1b);}(_0xc94d,0x193));var _0xdc94=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc94d[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdc94('0x0'));var zipdir=require(_0xdc94('0x1'));var jsonpatch=require(_0xdc94('0x2'));var rp=require('request-promise');var moment=require(_0xdc94('0x3'));var BPromise=require(_0xdc94('0x4'));var Mustache=require(_0xdc94('0x5'));var util=require(_0xdc94('0x6'));var path=require(_0xdc94('0x7'));var sox=require(_0xdc94('0x8'));var csv=require(_0xdc94('0x9'));var ejs=require(_0xdc94('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdc94('0xb'));var crypto=require(_0xdc94('0xc'));var jsforce=require(_0xdc94('0xd'));var deskjs=require(_0xdc94('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdc94('0xf'));var Papa=require(_0xdc94('0x10'));var Redis=require('ioredis');var authService=require(_0xdc94('0x11'));var qs=require(_0xdc94('0x12'));var as=require(_0xdc94('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc94('0x14'))(_0xdc94('0x15'));var utils=require(_0xdc94('0x16'));var config=require(_0xdc94('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xdc94('0x18')]=_[_0xdc94('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdc94('0x1a'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0xdc94('0x1b')](socket);function respondWithStatusCode(_0x35507f,_0x1bea5a){_0x1bea5a=_0x1bea5a||0xcc;return function(_0x142d6f){if(_0x142d6f){return _0x35507f['sendStatus'](_0x1bea5a);}return _0x35507f['status'](_0x1bea5a)[_0xdc94('0x1c')]();};}function respondWithResult(_0xe2b087,_0x3bc17){_0x3bc17=_0x3bc17||0xc8;return function(_0x3c3b87){if(_0x3c3b87){return _0xe2b087[_0xdc94('0x1d')](_0x3bc17)[_0xdc94('0x1e')](_0x3c3b87);}};}function respondWithFilteredResult(_0x382d55,_0x2dc88d){return function(_0x4754aa){if(_0x4754aa){var _0x109fed=_0x4754aa[_0xdc94('0x1f')],_0x2438a2=_0x2dc88d[_0xdc94('0x20')],_0x310e49=_0x2dc88d[_0xdc94('0x20')]+_0x2dc88d[_0xdc94('0x21')],_0x41528c;if(_0x310e49>=_0x109fed){_0x310e49=_0x109fed;_0x41528c=0xc8;}else{_0x41528c=0xce;}_0x382d55['status'](_0x41528c);return _0x382d55[_0xdc94('0x22')](_0xdc94('0x23'),_0x2438a2+'-'+_0x310e49+'/'+_0x109fed)['json'](_0x4754aa);}return null;};}function patchUpdates(_0x10a3c0){return function(_0x2fcd81){try{jsonpatch[_0xdc94('0x24')](_0x2fcd81,_0x10a3c0,!![]);}catch(_0x2af7f7){return BPromise[_0xdc94('0x25')](_0x2af7f7);}return _0x2fcd81[_0xdc94('0x26')]();};}function saveUpdates(_0x173672,_0xcc360f){return function(_0x342516){if(_0x342516){return _0x342516[_0xdc94('0x27')](_0x173672)[_0xdc94('0x28')](function(_0x3f210f){return _0x3f210f;});}return null;};}function removeEntity(_0x18cb20,_0x1e9ce5){return function(_0x193b0c){if(_0x193b0c){return _0x193b0c['destroy']()[_0xdc94('0x28')](function(){_0x18cb20[_0xdc94('0x1d')](0xcc)[_0xdc94('0x1c')]();});}};}function handleEntityNotFound(_0x43fa28,_0x594f49){return function(_0xb28a0e){if(!_0xb28a0e){_0x43fa28['sendStatus'](0x194);}return _0xb28a0e;};}function handleError(_0xc00a7b,_0xea66ad){_0xea66ad=_0xea66ad||0x1f4;return function(_0x50bc81){logger['error'](_0x50bc81[_0xdc94('0x29')]);if(_0x50bc81[_0xdc94('0x2a')]){delete _0x50bc81[_0xdc94('0x2a')];}_0xc00a7b[_0xdc94('0x1d')](_0xea66ad)[_0xdc94('0x2b')](_0x50bc81);};}exports['show']=function(_0x25eaab,_0xfeb8bd){var _0x583638={'raw':![],'where':{'id':_0x25eaab[_0xdc94('0x2c')]['id']}},_0x5cfe89={};_0x5cfe89['model']=_[_0xdc94('0x2d')](db[_0xdc94('0x2e')]['rawAttributes']);_0x5cfe89[_0xdc94('0x2f')]=_[_0xdc94('0x2d')](_0x25eaab[_0xdc94('0x2f')]);_0x5cfe89[_0xdc94('0x30')]=_['intersection'](_0x5cfe89[_0xdc94('0x31')],_0x5cfe89[_0xdc94('0x2f')]);_0x583638[_0xdc94('0x32')]=_['intersection'](_0x5cfe89[_0xdc94('0x31')],qs[_0xdc94('0x33')](_0x25eaab[_0xdc94('0x2f')]['fields']));_0x583638[_0xdc94('0x32')]=_0x583638[_0xdc94('0x32')][_0xdc94('0x34')]?_0x583638[_0xdc94('0x32')]:_0x5cfe89[_0xdc94('0x31')];if(_0x25eaab[_0xdc94('0x2f')]['includeAll']){_0x583638[_0xdc94('0x35')]=[{'all':!![]}];}_0x583638=_['merge']({},_0x583638,_0x25eaab['options']);return db[_0xdc94('0x2e')]['find'](_0x583638)[_0xdc94('0x28')](handleEntityNotFound(_0xfeb8bd,null))[_0xdc94('0x28')](respondWithResult(_0xfeb8bd,null))[_0xdc94('0x36')](handleError(_0xfeb8bd,null));};exports[_0xdc94('0x37')]=function(_0x130f70,_0x4f035a){return db[_0xdc94('0x2e')][_0xdc94('0x38')]({'where':{'id':_0x130f70['params']['id']}})[_0xdc94('0x28')](handleEntityNotFound(_0x4f035a,null))[_0xdc94('0x28')](removeEntity(_0x4f035a,null))['catch'](handleError(_0x4f035a,null));};function widgetAttributes(_0x504b52){try{switch(_0x504b52[_0xdc94('0x39')]){case'iframe':return[{'name':_0xdc94('0x3a'),'value':_0x504b52['attrUrl']||(_0x504b52[_0xdc94('0x3b')]&&_0x504b52[_0xdc94('0x3b')][0x0]?_0x504b52[_0xdc94('0x3b')][0x0][_0xdc94('0x3c')]:undefined)||_0xdc94('0x3d')}];case'custom':return[{'name':_0xdc94('0x3e'),'value':_0x504b52[_0xdc94('0x3e')]||(_0x504b52[_0xdc94('0x3b')]&&_0x504b52['attrs'][0x0]?_0x504b52[_0xdc94('0x3b')][0x0][_0xdc94('0x3c')]:undefined)||''}];case'clock':return[{'name':_0xdc94('0x3f'),'value':_0x504b52['attrHourFormat']||(_0x504b52[_0xdc94('0x3b')]&&_0x504b52['attrs'][0x0]?_0x504b52[_0xdc94('0x3b')][0x0]['value']:undefined)||_0xdc94('0x40')},{'name':_0xdc94('0x41'),'value':_0x504b52[_0xdc94('0x41')]||(_0x504b52[_0xdc94('0x3b')]&&_0x504b52[_0xdc94('0x3b')][0x1]?_0x504b52[_0xdc94('0x3b')][0x1][_0xdc94('0x3c')]:undefined)||_0xdc94('0x42')},{'name':_0xdc94('0x43'),'value':_0x504b52['attrFontSize']||(_0x504b52['attrs']&&_0x504b52[_0xdc94('0x3b')][0x2]?_0x504b52[_0xdc94('0x3b')][0x2]['value']:undefined)||0xc}];case _0xdc94('0x44'):return[{'name':_0xdc94('0x45'),'value':_0x504b52[_0xdc94('0x45')]||(_0x504b52[_0xdc94('0x3b')]&&_0x504b52[_0xdc94('0x3b')][0x0]?_0x504b52[_0xdc94('0x3b')][0x0][_0xdc94('0x3c')]:undefined)||'total'},{'name':_0xdc94('0x46'),'value':_0x504b52[_0xdc94('0x46')]||(_0x504b52[_0xdc94('0x3b')]&&_0x504b52['attrs'][0x1]?_0x504b52[_0xdc94('0x3b')][0x1]['value']:undefined)||[]},{'name':_0xdc94('0x43'),'value':_0x504b52[_0xdc94('0x43')]||(_0x504b52[_0xdc94('0x3b')]&&_0x504b52[_0xdc94('0x3b')][0x2]?_0x504b52[_0xdc94('0x3b')][0x2]['value']:undefined)||0x14}];case _0xdc94('0x47'):case _0xdc94('0x48'):return[{'name':'attrSerie1','value':_0x504b52[_0xdc94('0x49')]||(_0x504b52[_0xdc94('0x3b')]&&_0x504b52[_0xdc94('0x3b')][0x0]?_0x504b52[_0xdc94('0x3b')][0x0][_0xdc94('0x3c')]:undefined)||_0xdc94('0x4a')},{'name':_0xdc94('0x4b'),'value':_0x504b52[_0xdc94('0x4b')]||(_0x504b52['attrs']&&_0x504b52[_0xdc94('0x3b')][0x1]?_0x504b52[_0xdc94('0x3b')][0x1][_0xdc94('0x3c')]:undefined)||null},{'name':_0xdc94('0x4c'),'value':_0x504b52['attrSerie3']||(_0x504b52[_0xdc94('0x3b')]&&_0x504b52[_0xdc94('0x3b')][0x2]?_0x504b52[_0xdc94('0x3b')][0x2]['value']:undefined)||null},{'name':_0xdc94('0x46'),'value':_0x504b52[_0xdc94('0x46')]||(_0x504b52[_0xdc94('0x3b')]&&_0x504b52['attrs'][0x3]?_0x504b52['attrs'][0x3][_0xdc94('0x3c')]:undefined)||[]}];case _0xdc94('0x4d'):return[{'name':_0xdc94('0x4e'),'type':_0x504b52['reportType']||(_0x504b52[_0xdc94('0x3b')]&&_0x504b52[_0xdc94('0x3b')][0x0]?_0x504b52['attrs'][0x0][_0xdc94('0x39')]:undefined)||null,'value':_0x504b52[_0xdc94('0x4e')]||(_0x504b52[_0xdc94('0x3b')]&&_0x504b52[_0xdc94('0x3b')][0x0]?_0x504b52[_0xdc94('0x3b')][0x0][_0xdc94('0x3c')]:undefined)||null},{'name':_0xdc94('0x4f'),'value':_0x504b52[_0xdc94('0x4f')]||(_0x504b52[_0xdc94('0x3b')]&&_0x504b52[_0xdc94('0x3b')][0x1]?_0x504b52[_0xdc94('0x3b')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x238c14){logger[_0xdc94('0x50')](_0xdc94('0x51'),JSON[_0xdc94('0x52')](_0x238c14));return[];}}exports['create']=function(_0x33d6d7,_0x37c827){if(_0x33d6d7[_0xdc94('0x53')]){_0x33d6d7[_0xdc94('0x53')][_0xdc94('0x3b')]=widgetAttributes(_0x33d6d7[_0xdc94('0x53')]);}return db[_0xdc94('0x2e')][_0xdc94('0x54')](_0x33d6d7['body'],{})['then'](respondWithResult(_0x37c827,0xc9))[_0xdc94('0x36')](handleError(_0x37c827,null));};exports[_0xdc94('0x27')]=function(_0xecab3b,_0x313a1a){if(_0xecab3b[_0xdc94('0x53')]['id']){delete _0xecab3b[_0xdc94('0x53')]['id'];}_0xecab3b[_0xdc94('0x53')][_0xdc94('0x3b')]=widgetAttributes(_0xecab3b[_0xdc94('0x53')]);return db[_0xdc94('0x2e')][_0xdc94('0x38')]({'where':{'id':_0xecab3b['params']['id']}})[_0xdc94('0x28')](handleEntityNotFound(_0x313a1a,null))[_0xdc94('0x28')](saveUpdates(_0xecab3b[_0xdc94('0x53')],null))['then'](respondWithResult(_0x313a1a,null))[_0xdc94('0x36')](handleError(_0x313a1a,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index a0baa35..18a4f96 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 _0x63b1=['events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3c465d,_0xa81e06){var _0x4c911e=function(_0x655fc2){while(--_0x655fc2){_0x3c465d['push'](_0x3c465d['shift']());}};_0x4c911e(++_0xa81e06);}(_0x63b1,0x96));var _0x163b=function(_0xa49d2e,_0x3bf0e4){_0xa49d2e=_0xa49d2e-0x0;var _0x249cd3=_0x63b1[_0xa49d2e];return _0x249cd3;};'use strict';var EventEmitter=require(_0x163b('0x0'));var DashboardItem=require(_0x163b('0x1'))['db'][_0x163b('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x163b('0x3')](0x0);var events={'afterCreate':_0x163b('0x4'),'afterUpdate':_0x163b('0x5'),'afterDestroy':_0x163b('0x6')};function emitEvent(_0x1d3fbe){return function(_0x591535,_0xffa671,_0x61aa8a){DashboardItemEvents[_0x163b('0x7')](_0x1d3fbe+':'+_0x591535['id'],_0x591535);DashboardItemEvents[_0x163b('0x7')](_0x1d3fbe,_0x591535);_0x61aa8a(null);};}for(var e in events){if(events[_0x163b('0x8')](e)){var event=events[e];DashboardItem[_0x163b('0x9')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x2926=['save','remove','emit','exports','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x3db4c3,_0x6f025d){var _0x336a1b=function(_0x5e1ea5){while(--_0x5e1ea5){_0x3db4c3['push'](_0x3db4c3['shift']());}};_0x336a1b(++_0x6f025d);}(_0x2926,0x170));var _0x6292=function(_0x55ff21,_0x1540f0){_0x55ff21=_0x55ff21-0x0;var _0x4baf37=_0x2926[_0x55ff21];return _0x4baf37;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x6292('0x0'))['db'][_0x6292('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x6292('0x2')](0x0);var events={'afterCreate':_0x6292('0x3'),'afterUpdate':'update','afterDestroy':_0x6292('0x4')};function emitEvent(_0x3840fc){return function(_0x43f028,_0x4c3cf2,_0x4c5cb9){DashboardItemEvents[_0x6292('0x5')](_0x3840fc+':'+_0x43f028['id'],_0x43f028);DashboardItemEvents[_0x6292('0x5')](_0x3840fc,_0x43f028);_0x4c5cb9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x6292('0x6')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index f777e17..7873bca 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 _0x2f9b=['api','moment','request-promise','path','rimraf','exports','define','dashboard_items','lodash','util'];(function(_0x37f85a,_0x240e20){var _0x190eeb=function(_0x2ae374){while(--_0x2ae374){_0x37f85a['push'](_0x37f85a['shift']());}};_0x190eeb(++_0x240e20);}(_0x2f9b,0x94));var _0xb2f9=function(_0x20b594,_0x2b1a67){_0x20b594=_0x20b594-0x0;var _0x248698=_0x2f9b[_0x20b594];return _0x248698;};'use strict';var _=require(_0xb2f9('0x0'));var util=require(_0xb2f9('0x1'));var logger=require('../../config/logger')(_0xb2f9('0x2'));var moment=require(_0xb2f9('0x3'));var BPromise=require('bluebird');var rp=require(_0xb2f9('0x4'));var fs=require('fs');var path=require(_0xb2f9('0x5'));var rimraf=require(_0xb2f9('0x6'));var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module[_0xb2f9('0x7')]=function(_0x2041a7,_0x17357e){return _0x2041a7[_0xb2f9('0x8')]('DashboardItem',attributes,{'tableName':_0xb2f9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2517=['define','DashboardItem','dashboard_items','util','api','bluebird','request-promise','rimraf','exports'];(function(_0x138b7f,_0x3e2ccc){var _0x271fe6=function(_0x1c286f){while(--_0x1c286f){_0x138b7f['push'](_0x138b7f['shift']());}};_0x271fe6(++_0x3e2ccc);}(_0x2517,0x186));var _0x7251=function(_0x26c478,_0x367292){_0x26c478=_0x26c478-0x0;var _0x254a5e=_0x2517[_0x26c478];return _0x254a5e;};'use strict';var _=require('lodash');var util=require(_0x7251('0x0'));var logger=require('../../config/logger')(_0x7251('0x1'));var moment=require('moment');var BPromise=require(_0x7251('0x2'));var rp=require(_0x7251('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7251('0x4'));var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module[_0x7251('0x5')]=function(_0x269015,_0xed680f){return _0x269015[_0x7251('0x6')](_0x7251('0x7'),attributes,{'tableName':_0x7251('0x8'),'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 0435df7..a2b8c7f 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 _0x1f9d=['register','request','then','DashboardItem,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','lodash','moment','randomstring','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./dashboardItem.socket'];(function(_0x1f0213,_0x3c3c9e){var _0x2048c4=function(_0x26d0c6){while(--_0x26d0c6){_0x1f0213['push'](_0x1f0213['shift']());}};_0x2048c4(++_0x3c3c9e);}(_0x1f9d,0x1c1));var _0xd1f9=function(_0x81a736,_0x1e437d){_0x81a736=_0x81a736-0x0;var _0x208d8c=_0x1f9d[_0x81a736];return _0x208d8c;};'use strict';var _=require(_0xd1f9('0x0'));var util=require('util');var moment=require(_0xd1f9('0x1'));var BPromise=require('bluebird');var rs=require(_0xd1f9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd1f9('0x3'));var jayson=require(_0xd1f9('0x4'));var client=jayson['client'][_0xd1f9('0x5')]({'port':0x232a});config['redis']=_[_0xd1f9('0x6')](config['redis'],{'host':_0xd1f9('0x7'),'port':0x18eb});var socket=require(_0xd1f9('0x8'))(new Redis(config[_0xd1f9('0x9')]));require(_0xd1f9('0xa'))[_0xd1f9('0xb')](socket);function respondWithRpcPromise(_0x55ad5e,_0xcfec32,_0x4e35f1){return new BPromise(function(_0x58b70f,_0x57d477){return client[_0xd1f9('0xc')](_0x55ad5e,_0x4e35f1)[_0xd1f9('0xd')](function(_0x101244){logger['info'](_0xd1f9('0xe'),_0xcfec32,'request\x20sent');logger[_0xd1f9('0xf')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0xcfec32,_0xd1f9('0x10'),JSON[_0xd1f9('0x11')](_0x101244));if(_0x101244[_0xd1f9('0x12')]){if(_0x101244['error']['code']===0x1f4){logger[_0xd1f9('0x12')]('DashboardItem,\x20%s,\x20%s',_0xcfec32,_0x101244['error'][_0xd1f9('0x13')]);return _0x57d477(_0x101244['error'][_0xd1f9('0x13')]);}logger[_0xd1f9('0x12')](_0xd1f9('0xe'),_0xcfec32,_0x101244[_0xd1f9('0x12')][_0xd1f9('0x13')]);return _0x58b70f(_0x101244[_0xd1f9('0x12')]['message']);}else{logger[_0xd1f9('0x14')](_0xd1f9('0xe'),_0xcfec32,'request\x20sent');_0x58b70f(_0x101244[_0xd1f9('0x15')][_0xd1f9('0x13')]);}})[_0xd1f9('0x16')](function(_0x52dee2){logger[_0xd1f9('0x12')](_0xd1f9('0xe'),_0xcfec32,_0x52dee2);_0x57d477(_0x52dee2);});});} \ No newline at end of file +var _0x86e7=['jayson/promise','http','redis','defaults','socket.io-emitter','./dashboardItem.socket','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x86e7,0x15e));var _0x786e=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x86e7[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0x786e('0x0'));var util=require(_0x786e('0x1'));var moment=require(_0x786e('0x2'));var BPromise=require(_0x786e('0x3'));var rs=require(_0x786e('0x4'));var fs=require('fs');var Redis=require(_0x786e('0x5'));var db=require(_0x786e('0x6'))['db'];var utils=require(_0x786e('0x7'));var logger=require('../../config/logger')(_0x786e('0x8'));var config=require(_0x786e('0x9'));var jayson=require(_0x786e('0xa'));var client=jayson['client'][_0x786e('0xb')]({'port':0x232a});config[_0x786e('0xc')]=_[_0x786e('0xd')](config[_0x786e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x786e('0xe'))(new Redis(config[_0x786e('0xc')]));require(_0x786e('0xf'))['register'](socket);function respondWithRpcPromise(_0x3ca773,_0x2adf3d,_0x4b418c){return new BPromise(function(_0x52f4d1,_0x826dc2){return client['request'](_0x3ca773,_0x4b418c)['then'](function(_0x521633){logger['info'](_0x786e('0x10'),_0x2adf3d,_0x786e('0x11'));logger[_0x786e('0x12')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x2adf3d,_0x786e('0x11'),JSON[_0x786e('0x13')](_0x521633));if(_0x521633[_0x786e('0x14')]){if(_0x521633['error']['code']===0x1f4){logger[_0x786e('0x14')](_0x786e('0x10'),_0x2adf3d,_0x521633['error'][_0x786e('0x15')]);return _0x826dc2(_0x521633['error'][_0x786e('0x15')]);}logger[_0x786e('0x14')](_0x786e('0x10'),_0x2adf3d,_0x521633[_0x786e('0x14')][_0x786e('0x15')]);return _0x52f4d1(_0x521633[_0x786e('0x14')][_0x786e('0x15')]);}else{logger['info'](_0x786e('0x10'),_0x2adf3d,_0x786e('0x11'));_0x52f4d1(_0x521633[_0x786e('0x16')][_0x786e('0x15')]);}})[_0x786e('0x17')](function(_0x3aaafa){logger[_0x786e('0x14')](_0x786e('0x10'),_0x2adf3d,_0x3aaafa);_0x826dc2(_0x3aaafa);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 15a323f..643cc75 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 _0xa501=['length','dashboardItem:','save','remove','emit','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa501,0x1ec));var _0x1a50=function(_0x1c9933,_0x59e5bb){_0x1c9933=_0x1c9933-0x0;var _0x33fc29=_0xa501[_0x1c9933];return _0x33fc29;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x1a50('0x0'),_0x1a50('0x1'),'update'];function createListener(_0x3b46be,_0x17e8a1){return function(_0x3cb12e){_0x17e8a1[_0x1a50('0x2')](_0x3b46be,_0x3cb12e);};}function removeListener(_0x27c4be,_0x1a4018){return function(){DashboardItemEvents[_0x1a50('0x3')](_0x27c4be,_0x1a4018);};}exports[_0x1a50('0x4')]=function(_0x315e27){for(var _0x228c36=0x0,_0x294cd1=events[_0x1a50('0x5')];_0x228c36<_0x294cd1;_0x228c36++){var _0x33a695=events[_0x228c36];var _0x3c11b8=createListener(_0x1a50('0x6')+_0x33a695,_0x315e27);DashboardItemEvents['on'](_0x33a695,_0x3c11b8);}}; \ No newline at end of file +var _0x094c=['remove','update','emit','removeListener','register','length','dashboardItem:','save'];(function(_0x221457,_0x103d28){var _0x16a25a=function(_0x5b11ad){while(--_0x5b11ad){_0x221457['push'](_0x221457['shift']());}};_0x16a25a(++_0x103d28);}(_0x094c,0x16f));var _0xc094=function(_0x3b2be3,_0x3e602d){_0x3b2be3=_0x3b2be3-0x0;var _0x511b35=_0x094c[_0x3b2be3];return _0x511b35;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xc094('0x0'),_0xc094('0x1'),_0xc094('0x2')];function createListener(_0x12a9d7,_0x298450){return function(_0xf45b0){_0x298450[_0xc094('0x3')](_0x12a9d7,_0xf45b0);};}function removeListener(_0x847a98,_0x3d2818){return function(){DashboardItemEvents[_0xc094('0x4')](_0x847a98,_0x3d2818);};}exports[_0xc094('0x5')]=function(_0x247da2){for(var _0x3d7a18=0x0,_0x390c5d=events[_0xc094('0x6')];_0x3d7a18<_0x390c5d;_0x3d7a18++){var _0x11a653=events[_0x3d7a18];var _0x56d330=createListener(_0xc094('0x7')+_0x11a653,_0x247da2);DashboardItemEvents['on'](_0x11a653,_0x56d330);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index e6147ab..f2a871e 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 _0xd6a0=['../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','show','post','create','update','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x1bbe57,_0x3bd95b){var _0x5daa5f=function(_0x461e2b){while(--_0x461e2b){_0x1bbe57['push'](_0x1bbe57['shift']());}};_0x5daa5f(++_0x3bd95b);}(_0xd6a0,0x118));var _0x0d6a=function(_0x5d8722,_0x5d9cca){_0x5d8722=_0x5d8722-0x0;var _0x580c3a=_0xd6a0[_0x5d8722];return _0x580c3a;};'use strict';var multer=require(_0x0d6a('0x0'));var util=require('util');var path=require(_0x0d6a('0x1'));var timeout=require(_0x0d6a('0x2'));var express=require('express');var router=express[_0x0d6a('0x3')]();var fs_extra=require(_0x0d6a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0d6a('0x5'));var config=require(_0x0d6a('0x6'));var controller=require(_0x0d6a('0x7'));router[_0x0d6a('0x8')]('/:id',auth[_0x0d6a('0x9')](),controller[_0x0d6a('0xa')]);router[_0x0d6a('0xb')]('/',auth['isAuthenticated'](),controller[_0x0d6a('0xc')]);router['put']('/:id',auth[_0x0d6a('0x9')](),controller[_0x0d6a('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x0d6a('0xe')]=router; \ No newline at end of file +var _0x8181=['./dashboardItem.controller','/:id','isAuthenticated','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x39a181,_0xa89263){var _0x245f2d=function(_0x25fcb4){while(--_0x25fcb4){_0x39a181['push'](_0x39a181['shift']());}};_0x245f2d(++_0xa89263);}(_0x8181,0x195));var _0x1818=function(_0x2a9444,_0x3f800c){_0x2a9444=_0x2a9444-0x0;var _0x50cbd5=_0x8181[_0x2a9444];return _0x50cbd5;};'use strict';var multer=require(_0x1818('0x0'));var util=require(_0x1818('0x1'));var path=require(_0x1818('0x2'));var timeout=require(_0x1818('0x3'));var express=require(_0x1818('0x4'));var router=express[_0x1818('0x5')]();var fs_extra=require(_0x1818('0x6'));var auth=require(_0x1818('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1818('0x8'));var controller=require(_0x1818('0x9'));router['get'](_0x1818('0xa'),auth[_0x1818('0xb')](),controller[_0x1818('0xc')]);router[_0x1818('0xd')]('/',auth[_0x1818('0xb')](),controller[_0x1818('0xe')]);router['put'](_0x1818('0xa'),auth[_0x1818('0xb')](),controller[_0x1818('0xf')]);router[_0x1818('0x10')](_0x1818('0xa'),auth[_0x1818('0xb')](),controller['destroy']);module[_0x1818('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 4d5769b..01b7055 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 _0xe786=['first','sequelize','exports','STRING','ENUM','second','third'];(function(_0x35bd6c,_0x585087){var _0x2f421d=function(_0x42ae70){while(--_0x42ae70){_0x35bd6c['push'](_0x35bd6c['shift']());}};_0x2f421d(++_0x585087);}(_0xe786,0x19e));var _0x6e78=function(_0x146837,_0x2aa6a2){_0x146837=_0x146837-0x0;var _0x3d7e60=_0xe786[_0x146837];return _0x3d7e60;};'use strict';var Sequelize=require(_0x6e78('0x0'));module[_0x6e78('0x1')]={'name':{'type':Sequelize[_0x6e78('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x6e78('0x3')]('first',_0x6e78('0x4'),_0x6e78('0x5')),'allowNull':![],'defaultValue':_0x6e78('0x6')},'description':{'type':Sequelize[_0x6e78('0x2')]}}; \ No newline at end of file +var _0x891d=['third','STRING','sequelize','exports','first','second'];(function(_0x3b4441,_0x1d3608){var _0x55f9fe=function(_0x40d599){while(--_0x40d599){_0x3b4441['push'](_0x3b4441['shift']());}};_0x55f9fe(++_0x1d3608);}(_0x891d,0x1c4));var _0xd891=function(_0x2b9b40,_0x379b17){_0x2b9b40=_0x2b9b40-0x0;var _0x273121=_0x891d[_0x2b9b40];return _0x273121;};'use strict';var Sequelize=require(_0xd891('0x0'));module[_0xd891('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xd891('0x2'),_0xd891('0x3'),_0xd891('0x4')),'allowNull':![],'defaultValue':_0xd891('0x2')},'description':{'type':Sequelize[_0xd891('0x5')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index fc4c286..b149cf3 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 _0x31c7=['status','end','limit','set','Content-Range','json','reject','save','update','then','destroy','get','sendStatus','error','stack','name','send','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','Disposition','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','create','user','Dispositions','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','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/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x586910,_0x144620){var _0x441153=function(_0x28d635){while(--_0x28d635){_0x586910['push'](_0x586910['shift']());}};_0x441153(++_0x144620);}(_0x31c7,0x135));var _0x731c=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x31c7[_0x5d6456];return _0x4d66c1;};'use strict';var emlformat=require(_0x731c('0x0'));var rimraf=require(_0x731c('0x1'));var zipdir=require(_0x731c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x731c('0x3'));var moment=require(_0x731c('0x4'));var BPromise=require(_0x731c('0x5'));var Mustache=require(_0x731c('0x6'));var util=require(_0x731c('0x7'));var path=require('path');var sox=require(_0x731c('0x8'));var csv=require(_0x731c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x731c('0xa'));var _=require(_0x731c('0xb'));var squel=require('squel');var crypto=require(_0x731c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x731c('0xd'));var toCsv=require(_0x731c('0x9'));var querystring=require(_0x731c('0xe'));var Papa=require(_0x731c('0xf'));var Redis=require(_0x731c('0x10'));var authService=require(_0x731c('0x11'));var qs=require(_0x731c('0x12'));var as=require(_0x731c('0x13'));var hardwareService=require(_0x731c('0x14'));var logger=require(_0x731c('0x15'))(_0x731c('0x16'));var utils=require(_0x731c('0x17'));var config=require(_0x731c('0x18'));var licenseUtil=require(_0x731c('0x19'));var db=require(_0x731c('0x1a'))['db'];function respondWithStatusCode(_0x5e5046,_0xbd9d2b){_0xbd9d2b=_0xbd9d2b||0xcc;return function(_0x41d431){if(_0x41d431){return _0x5e5046['sendStatus'](_0xbd9d2b);}return _0x5e5046[_0x731c('0x1b')](_0xbd9d2b)[_0x731c('0x1c')]();};}function respondWithResult(_0x496012,_0x3bd2a8){_0x3bd2a8=_0x3bd2a8||0xc8;return function(_0x30038b){if(_0x30038b){return _0x496012['status'](_0x3bd2a8)['json'](_0x30038b);}};}function respondWithFilteredResult(_0xc53f8b,_0x42e6ba){return function(_0x444b07){if(_0x444b07){var _0x5884e1=_0x444b07['count'],_0x315ce3=_0x42e6ba['offset'],_0x2624b3=_0x42e6ba['offset']+_0x42e6ba[_0x731c('0x1d')],_0x3507c7;if(_0x2624b3>=_0x5884e1){_0x2624b3=_0x5884e1;_0x3507c7=0xc8;}else{_0x3507c7=0xce;}_0xc53f8b[_0x731c('0x1b')](_0x3507c7);return _0xc53f8b[_0x731c('0x1e')](_0x731c('0x1f'),_0x315ce3+'-'+_0x2624b3+'/'+_0x5884e1)[_0x731c('0x20')](_0x444b07);}return null;};}function patchUpdates(_0x18bd1f){return function(_0x38cefe){try{jsonpatch['apply'](_0x38cefe,_0x18bd1f,!![]);}catch(_0x4fa145){return BPromise[_0x731c('0x21')](_0x4fa145);}return _0x38cefe[_0x731c('0x22')]();};}function saveUpdates(_0x5dd587,_0x5c5ba3){return function(_0x56e20d){if(_0x56e20d){return _0x56e20d[_0x731c('0x23')](_0x5dd587)[_0x731c('0x24')](function(_0x4fe9d6){return _0x4fe9d6;});}return null;};}function removeEntity(_0x1e5334,_0x3c8c71){return function(_0x472427){if(_0x472427){return _0x472427[_0x731c('0x25')]()[_0x731c('0x24')](function(){var _0x43ba5a=_0x472427[_0x731c('0x26')]({'plain':!![]});var _0x37ea5c='Dispositions';return db['UserProfileResource'][_0x731c('0x25')]({'where':{'type':_0x37ea5c,'resourceId':_0x43ba5a['id']}})[_0x731c('0x24')](function(){return _0x472427;});})[_0x731c('0x24')](function(){_0x1e5334['status'](0xcc)[_0x731c('0x1c')]();});}};}function handleEntityNotFound(_0x46f3de,_0x38fdeb){return function(_0x4e87cd){if(!_0x4e87cd){_0x46f3de[_0x731c('0x27')](0x194);}return _0x4e87cd;};}function handleError(_0x514684,_0x2018d7){_0x2018d7=_0x2018d7||0x1f4;return function(_0x3e3700){logger[_0x731c('0x28')](_0x3e3700[_0x731c('0x29')]);if(_0x3e3700[_0x731c('0x2a')]){delete _0x3e3700[_0x731c('0x2a')];}_0x514684[_0x731c('0x1b')](_0x2018d7)[_0x731c('0x2b')](_0x3e3700);};}exports['index']=function(_0x5298e1,_0x30ddaf){var _0x266bd7={},_0x58cb99={},_0x568f23={'count':0x0,'rows':[]};var _0x36ae1f=_['map'](db['Disposition']['rawAttributes'],function(_0x402eb9){return{'name':_0x402eb9[_0x731c('0x2c')],'type':_0x402eb9[_0x731c('0x2d')][_0x731c('0x2e')]};});_0x58cb99[_0x731c('0x2f')]=_[_0x731c('0x30')](_0x36ae1f,'name');_0x58cb99[_0x731c('0x31')]=_[_0x731c('0x32')](_0x5298e1[_0x731c('0x31')]);_0x58cb99[_0x731c('0x33')]=_['intersection'](_0x58cb99['model'],_0x58cb99['query']);_0x266bd7[_0x731c('0x34')]=_[_0x731c('0x35')](_0x58cb99[_0x731c('0x2f')],qs[_0x731c('0x36')](_0x5298e1[_0x731c('0x31')][_0x731c('0x36')]));_0x266bd7[_0x731c('0x34')]=_0x266bd7[_0x731c('0x34')]['length']?_0x266bd7[_0x731c('0x34')]:_0x58cb99[_0x731c('0x2f')];if(!_0x5298e1[_0x731c('0x31')]['hasOwnProperty'](_0x731c('0x37'))){_0x266bd7[_0x731c('0x1d')]=qs[_0x731c('0x1d')](_0x5298e1[_0x731c('0x31')]['limit']);_0x266bd7[_0x731c('0x38')]=qs['offset'](_0x5298e1[_0x731c('0x31')][_0x731c('0x38')]);}_0x266bd7[_0x731c('0x39')]=qs[_0x731c('0x3a')](_0x5298e1['query'][_0x731c('0x3a')]);_0x266bd7[_0x731c('0x3b')]=qs[_0x731c('0x33')](_['pick'](_0x5298e1[_0x731c('0x31')],_0x58cb99[_0x731c('0x33')]),_0x36ae1f);if(_0x5298e1[_0x731c('0x31')][_0x731c('0x3c')]){_0x266bd7['where']=_[_0x731c('0x3d')](_0x266bd7[_0x731c('0x3b')],{'$or':_[_0x731c('0x30')](_0x36ae1f,function(_0x1f9fff){if(_0x1f9fff[_0x731c('0x2d')]!==_0x731c('0x3e')){var _0x1439a5={};_0x1439a5[_0x1f9fff[_0x731c('0x2a')]]={'$like':'%'+_0x5298e1[_0x731c('0x31')][_0x731c('0x3c')]+'%'};return _0x1439a5;}})});}_0x266bd7=_['merge']({},_0x266bd7,_0x5298e1[_0x731c('0x3f')]);var _0x2cc375={'where':_0x266bd7['where']};return db[_0x731c('0x40')]['count'](_0x2cc375)[_0x731c('0x24')](function(_0x21d3a9){_0x568f23[_0x731c('0x41')]=_0x21d3a9;if(_0x5298e1['query'][_0x731c('0x42')]){_0x266bd7[_0x731c('0x43')]=[{'all':!![]}];}return db[_0x731c('0x40')][_0x731c('0x44')](_0x266bd7);})[_0x731c('0x24')](function(_0xf690d0){_0x568f23[_0x731c('0x45')]=_0xf690d0;return _0x568f23;})[_0x731c('0x24')](respondWithFilteredResult(_0x30ddaf,_0x266bd7))[_0x731c('0x46')](handleError(_0x30ddaf,null));};exports[_0x731c('0x47')]=function(_0x1aab12,_0x19bb51){var _0x3a20ef={'raw':!![],'where':{'id':_0x1aab12[_0x731c('0x48')]['id']}},_0x211ee7={};_0x211ee7[_0x731c('0x2f')]=_[_0x731c('0x32')](db[_0x731c('0x40')][_0x731c('0x49')]);_0x211ee7[_0x731c('0x31')]=_[_0x731c('0x32')](_0x1aab12['query']);_0x211ee7['filters']=_[_0x731c('0x35')](_0x211ee7['model'],_0x211ee7[_0x731c('0x31')]);_0x3a20ef[_0x731c('0x34')]=_['intersection'](_0x211ee7[_0x731c('0x2f')],qs['fields'](_0x1aab12[_0x731c('0x31')][_0x731c('0x36')]));_0x3a20ef['attributes']=_0x3a20ef[_0x731c('0x34')][_0x731c('0x4a')]?_0x3a20ef[_0x731c('0x34')]:_0x211ee7[_0x731c('0x2f')];if(_0x1aab12[_0x731c('0x31')][_0x731c('0x42')]){_0x3a20ef[_0x731c('0x43')]=[{'all':!![]}];}_0x3a20ef=_[_0x731c('0x3d')]({},_0x3a20ef,_0x1aab12[_0x731c('0x3f')]);return db['Disposition']['find'](_0x3a20ef)['then'](handleEntityNotFound(_0x19bb51,null))[_0x731c('0x24')](respondWithResult(_0x19bb51,null))['catch'](handleError(_0x19bb51,null));};exports[_0x731c('0x4b')]=function(_0x598a16,_0x288dc7){return db['Disposition'][_0x731c('0x4b')](_0x598a16['body'],{})['then'](function(_0x1d53aa){var _0x29925e=_0x598a16['user'][_0x731c('0x26')]({'plain':!![]});if(!_0x29925e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29925e['role']===_0x731c('0x4c')){var _0x20fa25=_0x1d53aa[_0x731c('0x26')]({'plain':!![]});var _0x4ee321=_0x731c('0x4d');return db[_0x731c('0x4e')]['find']({'where':{'name':_0x4ee321,'userProfileId':_0x29925e[_0x731c('0x4f')]},'raw':!![]})[_0x731c('0x24')](function(_0x3bac57){if(_0x3bac57&&_0x3bac57[_0x731c('0x50')]===0x0){return db[_0x731c('0x51')][_0x731c('0x4b')]({'name':_0x20fa25[_0x731c('0x2a')],'resourceId':_0x20fa25['id'],'type':_0x3bac57[_0x731c('0x2a')],'sectionId':_0x3bac57['id']},{})['then'](function(){return _0x1d53aa;});}else{return _0x1d53aa;}})[_0x731c('0x46')](function(_0x444f54){logger[_0x731c('0x28')](_0x731c('0x52'),_0x444f54);throw _0x444f54;});}return _0x1d53aa;})[_0x731c('0x24')](respondWithResult(_0x288dc7,0xc9))[_0x731c('0x46')](handleError(_0x288dc7,null));};exports[_0x731c('0x23')]=function(_0x25cc11,_0x5a1742){if(_0x25cc11['body']['id']){delete _0x25cc11['body']['id'];}return db[_0x731c('0x40')]['find']({'where':{'id':_0x25cc11[_0x731c('0x48')]['id']}})[_0x731c('0x24')](handleEntityNotFound(_0x5a1742,null))[_0x731c('0x24')](saveUpdates(_0x25cc11['body'],null))[_0x731c('0x24')](respondWithResult(_0x5a1742,null))['catch'](handleError(_0x5a1742,null));};exports[_0x731c('0x25')]=function(_0x429a5d,_0x412e7d){return db[_0x731c('0x40')][_0x731c('0x53')]({'where':{'id':_0x429a5d['params']['id']}})['then'](handleEntityNotFound(_0x412e7d,null))[_0x731c('0x24')](removeEntity(_0x412e7d,null))[_0x731c('0x46')](handleError(_0x412e7d,null));}; \ No newline at end of file +var _0x10f5=['keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','Disposition','findAll','rows','catch','show','params','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','map','fieldName','type','key','model','query'];(function(_0xb6a3b6,_0x211af6){var _0x218a32=function(_0xffd057){while(--_0xffd057){_0xb6a3b6['push'](_0xb6a3b6['shift']());}};_0x218a32(++_0x211af6);}(_0x10f5,0x119));var _0x510f=function(_0x59e40a,_0x3007b2){_0x59e40a=_0x59e40a-0x0;var _0x75a770=_0x10f5[_0x59e40a];return _0x75a770;};'use strict';var emlformat=require(_0x510f('0x0'));var rimraf=require(_0x510f('0x1'));var zipdir=require(_0x510f('0x2'));var jsonpatch=require(_0x510f('0x3'));var rp=require(_0x510f('0x4'));var moment=require(_0x510f('0x5'));var BPromise=require(_0x510f('0x6'));var Mustache=require(_0x510f('0x7'));var util=require(_0x510f('0x8'));var path=require(_0x510f('0x9'));var sox=require('sox');var csv=require(_0x510f('0xa'));var ejs=require(_0x510f('0xb'));var fs=require('fs');var fs_extra=require(_0x510f('0xc'));var _=require('lodash');var squel=require(_0x510f('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x510f('0xe'));var toCsv=require(_0x510f('0xa'));var querystring=require('querystring');var Papa=require(_0x510f('0xf'));var Redis=require(_0x510f('0x10'));var authService=require(_0x510f('0x11'));var qs=require(_0x510f('0x12'));var as=require(_0x510f('0x13'));var hardwareService=require(_0x510f('0x14'));var logger=require(_0x510f('0x15'))(_0x510f('0x16'));var utils=require(_0x510f('0x17'));var config=require(_0x510f('0x18'));var licenseUtil=require(_0x510f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x545b9e,_0x4c9b97){_0x4c9b97=_0x4c9b97||0xcc;return function(_0x8115df){if(_0x8115df){return _0x545b9e[_0x510f('0x1a')](_0x4c9b97);}return _0x545b9e[_0x510f('0x1b')](_0x4c9b97)[_0x510f('0x1c')]();};}function respondWithResult(_0x1d52ee,_0x5b6bb0){_0x5b6bb0=_0x5b6bb0||0xc8;return function(_0x4cb32d){if(_0x4cb32d){return _0x1d52ee[_0x510f('0x1b')](_0x5b6bb0)[_0x510f('0x1d')](_0x4cb32d);}};}function respondWithFilteredResult(_0x90c467,_0x4e591b){return function(_0x1bf611){if(_0x1bf611){var _0x3ad8a3=_0x1bf611[_0x510f('0x1e')],_0xb02ce=_0x4e591b[_0x510f('0x1f')],_0x4816da=_0x4e591b['offset']+_0x4e591b[_0x510f('0x20')],_0x336550;if(_0x4816da>=_0x3ad8a3){_0x4816da=_0x3ad8a3;_0x336550=0xc8;}else{_0x336550=0xce;}_0x90c467[_0x510f('0x1b')](_0x336550);return _0x90c467['set'](_0x510f('0x21'),_0xb02ce+'-'+_0x4816da+'/'+_0x3ad8a3)[_0x510f('0x1d')](_0x1bf611);}return null;};}function patchUpdates(_0x80a809){return function(_0x295d36){try{jsonpatch[_0x510f('0x22')](_0x295d36,_0x80a809,!![]);}catch(_0x413d17){return BPromise['reject'](_0x413d17);}return _0x295d36[_0x510f('0x23')]();};}function saveUpdates(_0x4caac2,_0x4eecd0){return function(_0x35581f){if(_0x35581f){return _0x35581f['update'](_0x4caac2)[_0x510f('0x24')](function(_0x212de1){return _0x212de1;});}return null;};}function removeEntity(_0x5ed6ee,_0x27e0c6){return function(_0x38de40){if(_0x38de40){return _0x38de40[_0x510f('0x25')]()[_0x510f('0x24')](function(){var _0x5617f4=_0x38de40[_0x510f('0x26')]({'plain':!![]});var _0x1d3cce=_0x510f('0x27');return db[_0x510f('0x28')]['destroy']({'where':{'type':_0x1d3cce,'resourceId':_0x5617f4['id']}})[_0x510f('0x24')](function(){return _0x38de40;});})[_0x510f('0x24')](function(){_0x5ed6ee[_0x510f('0x1b')](0xcc)[_0x510f('0x1c')]();});}};}function handleEntityNotFound(_0x3a063b,_0x280c7a){return function(_0x52ba7c){if(!_0x52ba7c){_0x3a063b[_0x510f('0x1a')](0x194);}return _0x52ba7c;};}function handleError(_0x59ad6c,_0x2411de){_0x2411de=_0x2411de||0x1f4;return function(_0x196c4b){logger[_0x510f('0x29')](_0x196c4b[_0x510f('0x2a')]);if(_0x196c4b[_0x510f('0x2b')]){delete _0x196c4b[_0x510f('0x2b')];}_0x59ad6c[_0x510f('0x1b')](_0x2411de)[_0x510f('0x2c')](_0x196c4b);};}exports['index']=function(_0x1724b6,_0x456e58){var _0x5a8eb1={},_0x4352f4={},_0x38b9f8={'count':0x0,'rows':[]};var _0x5ea077=_[_0x510f('0x2d')](db['Disposition']['rawAttributes'],function(_0xf1509c){return{'name':_0xf1509c[_0x510f('0x2e')],'type':_0xf1509c[_0x510f('0x2f')][_0x510f('0x30')]};});_0x4352f4[_0x510f('0x31')]=_[_0x510f('0x2d')](_0x5ea077,_0x510f('0x2b'));_0x4352f4[_0x510f('0x32')]=_[_0x510f('0x33')](_0x1724b6[_0x510f('0x32')]);_0x4352f4['filters']=_['intersection'](_0x4352f4[_0x510f('0x31')],_0x4352f4[_0x510f('0x32')]);_0x5a8eb1[_0x510f('0x34')]=_[_0x510f('0x35')](_0x4352f4['model'],qs[_0x510f('0x36')](_0x1724b6[_0x510f('0x32')][_0x510f('0x36')]));_0x5a8eb1[_0x510f('0x34')]=_0x5a8eb1[_0x510f('0x34')][_0x510f('0x37')]?_0x5a8eb1[_0x510f('0x34')]:_0x4352f4['model'];if(!_0x1724b6[_0x510f('0x32')][_0x510f('0x38')](_0x510f('0x39'))){_0x5a8eb1[_0x510f('0x20')]=qs[_0x510f('0x20')](_0x1724b6[_0x510f('0x32')][_0x510f('0x20')]);_0x5a8eb1['offset']=qs[_0x510f('0x1f')](_0x1724b6['query'][_0x510f('0x1f')]);}_0x5a8eb1[_0x510f('0x3a')]=qs[_0x510f('0x3b')](_0x1724b6[_0x510f('0x32')][_0x510f('0x3b')]);_0x5a8eb1[_0x510f('0x3c')]=qs[_0x510f('0x3d')](_[_0x510f('0x3e')](_0x1724b6[_0x510f('0x32')],_0x4352f4[_0x510f('0x3d')]),_0x5ea077);if(_0x1724b6[_0x510f('0x32')]['filter']){_0x5a8eb1[_0x510f('0x3c')]=_[_0x510f('0x3f')](_0x5a8eb1['where'],{'$or':_[_0x510f('0x2d')](_0x5ea077,function(_0x13bd2b){if(_0x13bd2b['type']!==_0x510f('0x40')){var _0x10f95a={};_0x10f95a[_0x13bd2b[_0x510f('0x2b')]]={'$like':'%'+_0x1724b6['query'][_0x510f('0x41')]+'%'};return _0x10f95a;}})});}_0x5a8eb1=_[_0x510f('0x3f')]({},_0x5a8eb1,_0x1724b6[_0x510f('0x42')]);var _0x1642d6={'where':_0x5a8eb1['where']};return db[_0x510f('0x43')][_0x510f('0x1e')](_0x1642d6)[_0x510f('0x24')](function(_0x3f2642){_0x38b9f8[_0x510f('0x1e')]=_0x3f2642;if(_0x1724b6[_0x510f('0x32')]['includeAll']){_0x5a8eb1['include']=[{'all':!![]}];}return db['Disposition'][_0x510f('0x44')](_0x5a8eb1);})[_0x510f('0x24')](function(_0x1b21f6){_0x38b9f8[_0x510f('0x45')]=_0x1b21f6;return _0x38b9f8;})[_0x510f('0x24')](respondWithFilteredResult(_0x456e58,_0x5a8eb1))[_0x510f('0x46')](handleError(_0x456e58,null));};exports[_0x510f('0x47')]=function(_0x3ecc61,_0x4ebb10){var _0x418f76={'raw':!![],'where':{'id':_0x3ecc61[_0x510f('0x48')]['id']}},_0x540f52={};_0x540f52['model']=_['keys'](db[_0x510f('0x43')]['rawAttributes']);_0x540f52[_0x510f('0x32')]=_['keys'](_0x3ecc61['query']);_0x540f52[_0x510f('0x3d')]=_[_0x510f('0x35')](_0x540f52[_0x510f('0x31')],_0x540f52[_0x510f('0x32')]);_0x418f76[_0x510f('0x34')]=_[_0x510f('0x35')](_0x540f52[_0x510f('0x31')],qs['fields'](_0x3ecc61[_0x510f('0x32')]['fields']));_0x418f76[_0x510f('0x34')]=_0x418f76[_0x510f('0x34')][_0x510f('0x37')]?_0x418f76[_0x510f('0x34')]:_0x540f52[_0x510f('0x31')];if(_0x3ecc61[_0x510f('0x32')][_0x510f('0x49')]){_0x418f76[_0x510f('0x4a')]=[{'all':!![]}];}_0x418f76=_[_0x510f('0x3f')]({},_0x418f76,_0x3ecc61['options']);return db[_0x510f('0x43')]['find'](_0x418f76)[_0x510f('0x24')](handleEntityNotFound(_0x4ebb10,null))['then'](respondWithResult(_0x4ebb10,null))['catch'](handleError(_0x4ebb10,null));};exports[_0x510f('0x4b')]=function(_0x3be9fa,_0x44d26d){return db[_0x510f('0x43')][_0x510f('0x4b')](_0x3be9fa[_0x510f('0x4c')],{})[_0x510f('0x24')](function(_0x592c2b){var _0x2cd50a=_0x3be9fa[_0x510f('0x4d')][_0x510f('0x26')]({'plain':!![]});if(!_0x2cd50a)throw new Error(_0x510f('0x4e'));if(_0x2cd50a['role']===_0x510f('0x4d')){var _0x220735=_0x592c2b[_0x510f('0x26')]({'plain':!![]});var _0x545088=_0x510f('0x27');return db[_0x510f('0x4f')]['find']({'where':{'name':_0x545088,'userProfileId':_0x2cd50a[_0x510f('0x50')]},'raw':!![]})[_0x510f('0x24')](function(_0x2aa208){if(_0x2aa208&&_0x2aa208['autoAssociation']===0x0){return db['UserProfileResource'][_0x510f('0x4b')]({'name':_0x220735[_0x510f('0x2b')],'resourceId':_0x220735['id'],'type':_0x2aa208[_0x510f('0x2b')],'sectionId':_0x2aa208['id']},{})[_0x510f('0x24')](function(){return _0x592c2b;});}else{return _0x592c2b;}})[_0x510f('0x46')](function(_0x7f6e1b){logger['error'](_0x510f('0x51'),_0x7f6e1b);throw _0x7f6e1b;});}return _0x592c2b;})[_0x510f('0x24')](respondWithResult(_0x44d26d,0xc9))[_0x510f('0x46')](handleError(_0x44d26d,null));};exports[_0x510f('0x52')]=function(_0x1e530c,_0x324b52){if(_0x1e530c[_0x510f('0x4c')]['id']){delete _0x1e530c[_0x510f('0x4c')]['id'];}return db['Disposition']['find']({'where':{'id':_0x1e530c[_0x510f('0x48')]['id']}})[_0x510f('0x24')](handleEntityNotFound(_0x324b52,null))[_0x510f('0x24')](saveUpdates(_0x1e530c[_0x510f('0x4c')],null))[_0x510f('0x24')](respondWithResult(_0x324b52,null))['catch'](handleError(_0x324b52,null));};exports[_0x510f('0x25')]=function(_0xf7fc4d,_0x56724d){return db['Disposition']['find']({'where':{'id':_0xf7fc4d['params']['id']}})[_0x510f('0x24')](handleEntityNotFound(_0x56724d,null))['then'](removeEntity(_0x56724d,null))[_0x510f('0x46')](handleError(_0x56724d,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 2c97808..7434dc0 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 _0x8819=['rimraf','../../config/environment','./disposition.attributes','exports','Disposition','name','name_mail','MailAccountId','SmsAccountId','name_fax','name_openchannel','name_whatsapp','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x57fc06,_0x127721){var _0x2162a9=function(_0x2f8b79){while(--_0x2f8b79){_0x57fc06['push'](_0x57fc06['shift']());}};_0x2162a9(++_0x127721);}(_0x8819,0x94));var _0x9881=function(_0x317957,_0x4740d7){_0x317957=_0x317957-0x0;var _0x56e33c=_0x8819[_0x317957];return _0x56e33c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9881('0x0'))(_0x9881('0x1'));var moment=require(_0x9881('0x2'));var BPromise=require(_0x9881('0x3'));var rp=require(_0x9881('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9881('0x5'));var config=require(_0x9881('0x6'));var attributes=require(_0x9881('0x7'));module[_0x9881('0x8')]=function(_0x1791fd,_0x2a3664){return _0x1791fd['define'](_0x9881('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x9881('0xa'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0x9881('0xa'),'ChatWebsiteId']},{'unique':!![],'name':_0x9881('0xb'),'fields':[_0x9881('0xa'),_0x9881('0xc')]},{'unique':!![],'name':'name_sms','fields':[_0x9881('0xa'),_0x9881('0xd')]},{'unique':!![],'name':_0x9881('0xe'),'fields':[_0x9881('0xa'),'FaxAccountId']},{'unique':!![],'name':_0x9881('0xf'),'fields':[_0x9881('0xa'),'OpenchannelAccountId']},{'unique':!![],'name':_0x9881('0x10'),'fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x95f4=['util','../../config/logger','bluebird','request-promise','../../config/environment','./disposition.attributes','exports','define','Disposition','name_voice','name','ListId','ChatWebsiteId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash'];(function(_0x132a5c,_0x5318d6){var _0x38f3db=function(_0x8fe3ca){while(--_0x8fe3ca){_0x132a5c['push'](_0x132a5c['shift']());}};_0x38f3db(++_0x5318d6);}(_0x95f4,0xf1));var _0x495f=function(_0x5baf4a,_0x442695){_0x5baf4a=_0x5baf4a-0x0;var _0x49d483=_0x95f4[_0x5baf4a];return _0x49d483;};'use strict';var _=require(_0x495f('0x0'));var util=require(_0x495f('0x1'));var logger=require(_0x495f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x495f('0x3'));var rp=require(_0x495f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x495f('0x5'));var attributes=require(_0x495f('0x6'));module[_0x495f('0x7')]=function(_0x4a56a5,_0x704a46){return _0x4a56a5[_0x495f('0x8')](_0x495f('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x495f('0xa'),'fields':[_0x495f('0xb'),_0x495f('0xc')]},{'unique':!![],'name':'name_chat','fields':['name',_0x495f('0xd')]},{'unique':!![],'name':'name_mail','fields':[_0x495f('0xb'),'MailAccountId']},{'unique':!![],'name':_0x495f('0xe'),'fields':[_0x495f('0xb'),_0x495f('0xf')]},{'unique':!![],'name':_0x495f('0x10'),'fields':['name',_0x495f('0x11')]},{'unique':!![],'name':_0x495f('0x12'),'fields':[_0x495f('0xb'),_0x495f('0x13')]},{'unique':!![],'name':_0x495f('0x14'),'fields':['name',_0x495f('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 1096d5a..536c5d4 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 _0xfcea=['result','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x125b22,_0x12e0f1){var _0x5a8ebf=function(_0x1e2cba){while(--_0x1e2cba){_0x125b22['push'](_0x125b22['shift']());}};_0x5a8ebf(++_0x12e0f1);}(_0xfcea,0xf1));var _0xafce=function(_0x4c4be2,_0x37e075){_0x4c4be2=_0x4c4be2-0x0;var _0x13b3a2=_0xfcea[_0x4c4be2];return _0x13b3a2;};'use strict';var _=require('lodash');var util=require(_0xafce('0x0'));var moment=require(_0xafce('0x1'));var BPromise=require(_0xafce('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xafce('0x3'));var db=require(_0xafce('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xafce('0x5'))(_0xafce('0x6'));var config=require('../../config/environment');var jayson=require(_0xafce('0x7'));var client=jayson[_0xafce('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b4a30,_0x53b830,_0x4820f1){return new BPromise(function(_0x43db9e,_0xcf7071){return client[_0xafce('0x9')](_0x3b4a30,_0x4820f1)[_0xafce('0xa')](function(_0x595a34){logger[_0xafce('0xb')](_0xafce('0xc'),_0x53b830,_0xafce('0xd'));logger[_0xafce('0xe')]('Disposition,\x20%s,\x20%s,\x20%s',_0x53b830,'request\x20sent',JSON[_0xafce('0xf')](_0x595a34));if(_0x595a34[_0xafce('0x10')]){if(_0x595a34[_0xafce('0x10')][_0xafce('0x11')]===0x1f4){logger[_0xafce('0x10')](_0xafce('0xc'),_0x53b830,_0x595a34[_0xafce('0x10')][_0xafce('0x12')]);return _0xcf7071(_0x595a34[_0xafce('0x10')][_0xafce('0x12')]);}logger['error'](_0xafce('0xc'),_0x53b830,_0x595a34[_0xafce('0x10')][_0xafce('0x12')]);return _0x43db9e(_0x595a34[_0xafce('0x10')][_0xafce('0x12')]);}else{logger[_0xafce('0xb')](_0xafce('0xc'),_0x53b830,'request\x20sent');_0x43db9e(_0x595a34[_0xafce('0x13')]['message']);}})['catch'](function(_0x27394e){logger[_0xafce('0x10')]('Disposition,\x20%s,\x20%s',_0x53b830,_0x27394e);_0xcf7071(_0x27394e);});});} \ No newline at end of file +var _0x9bc1=['client','http','request','info','Disposition,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1fb794,_0x297464){var _0x5d2095=function(_0x3371a5){while(--_0x3371a5){_0x1fb794['push'](_0x1fb794['shift']());}};_0x5d2095(++_0x297464);}(_0x9bc1,0x75));var _0x19bc=function(_0xede44e,_0x2540de){_0xede44e=_0xede44e-0x0;var _0x36367b=_0x9bc1[_0xede44e];return _0x36367b;};'use strict';var _=require(_0x19bc('0x0'));var util=require('util');var moment=require(_0x19bc('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x19bc('0x2'));var db=require(_0x19bc('0x3'))['db'];var utils=require(_0x19bc('0x4'));var logger=require(_0x19bc('0x5'))(_0x19bc('0x6'));var config=require(_0x19bc('0x7'));var jayson=require(_0x19bc('0x8'));var client=jayson[_0x19bc('0x9')][_0x19bc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b261f,_0x35cbad,_0x291088){return new BPromise(function(_0x31dec0,_0x305d4a){return client[_0x19bc('0xb')](_0x4b261f,_0x291088)['then'](function(_0x2288ad){logger[_0x19bc('0xc')](_0x19bc('0xd'),_0x35cbad,_0x19bc('0xe'));logger['debug']('Disposition,\x20%s,\x20%s,\x20%s',_0x35cbad,'request\x20sent',JSON[_0x19bc('0xf')](_0x2288ad));if(_0x2288ad[_0x19bc('0x10')]){if(_0x2288ad[_0x19bc('0x10')][_0x19bc('0x11')]===0x1f4){logger[_0x19bc('0x10')](_0x19bc('0xd'),_0x35cbad,_0x2288ad[_0x19bc('0x10')]['message']);return _0x305d4a(_0x2288ad[_0x19bc('0x10')][_0x19bc('0x12')]);}logger[_0x19bc('0x10')](_0x19bc('0xd'),_0x35cbad,_0x2288ad['error'][_0x19bc('0x12')]);return _0x31dec0(_0x2288ad['error'][_0x19bc('0x12')]);}else{logger['info']('Disposition,\x20%s,\x20%s',_0x35cbad,_0x19bc('0xe'));_0x31dec0(_0x2288ad[_0x19bc('0x13')][_0x19bc('0x12')]);}})[_0x19bc('0x14')](function(_0x306e5f){logger[_0x19bc('0x10')](_0x19bc('0xd'),_0x35cbad,_0x306e5f);_0x305d4a(_0x306e5f);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 1ae92d2..128dc07 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 _0xb9cc=['isAuthenticated','index','get','/:id','show','post','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller'];(function(_0x3a8bee,_0x36c3d2){var _0xac5261=function(_0xde66dc){while(--_0xde66dc){_0x3a8bee['push'](_0x3a8bee['shift']());}};_0xac5261(++_0x36c3d2);}(_0xb9cc,0x1ba));var _0xcb9c=function(_0x42371d,_0x1a56ca){_0x42371d=_0x42371d-0x0;var _0x46787d=_0xb9cc[_0x42371d];return _0x46787d;};'use strict';var multer=require(_0xcb9c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcb9c('0x1'));var express=require(_0xcb9c('0x2'));var router=express[_0xcb9c('0x3')]();var fs_extra=require(_0xcb9c('0x4'));var auth=require(_0xcb9c('0x5'));var interaction=require(_0xcb9c('0x6'));var config=require('../../config/environment');var controller=require(_0xcb9c('0x7'));router['get']('/',auth[_0xcb9c('0x8')](),controller[_0xcb9c('0x9')]);router[_0xcb9c('0xa')](_0xcb9c('0xb'),auth[_0xcb9c('0x8')](),controller[_0xcb9c('0xc')]);router[_0xcb9c('0xd')]('/',auth[_0xcb9c('0x8')](),controller['create']);router['put'](_0xcb9c('0xb'),auth[_0xcb9c('0x8')](),controller[_0xcb9c('0xe')]);router[_0xcb9c('0xf')](_0xcb9c('0xb'),auth[_0xcb9c('0x8')](),controller[_0xcb9c('0x10')]);module[_0xcb9c('0x11')]=router; \ No newline at end of file +var _0x46bc=['/:id','show','post','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','isAuthenticated','index'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x46bc,0x6c));var _0xc46b=function(_0x1168a1,_0xa0d8c9){_0x1168a1=_0x1168a1-0x0;var _0xcc5ad8=_0x46bc[_0x1168a1];return _0xcc5ad8;};'use strict';var multer=require(_0xc46b('0x0'));var util=require('util');var path=require(_0xc46b('0x1'));var timeout=require(_0xc46b('0x2'));var express=require(_0xc46b('0x3'));var router=express['Router']();var fs_extra=require(_0xc46b('0x4'));var auth=require(_0xc46b('0x5'));var interaction=require(_0xc46b('0x6'));var config=require('../../config/environment');var controller=require(_0xc46b('0x7'));router[_0xc46b('0x8')]('/',auth[_0xc46b('0x9')](),controller[_0xc46b('0xa')]);router[_0xc46b('0x8')](_0xc46b('0xb'),auth[_0xc46b('0x9')](),controller[_0xc46b('0xc')]);router[_0xc46b('0xd')]('/',auth[_0xc46b('0x9')](),controller['create']);router['put'](_0xc46b('0xb'),auth['isAuthenticated'](),controller[_0xc46b('0xe')]);router[_0xc46b('0xf')]('/:id',auth[_0xc46b('0x9')](),controller['destroy']);module[_0xc46b('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 22a2c76..da8173a 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 _0xa500=['ENUM','yes','localstationid','2400','4800','9600','12000','14400','7200','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING'];(function(_0x4c88fd,_0x23fc49){var _0x1ffe8e=function(_0x412278){while(--_0x412278){_0x4c88fd['push'](_0x4c88fd['shift']());}};_0x1ffe8e(++_0x23fc49);}(_0xa500,0x93));var _0x0a50=function(_0x193fae,_0x534f67){_0x193fae=_0x193fae-0x0;var _0x1d3640=_0xa500[_0x193fae];return _0x1d3640;};'use strict';var Sequelize=require(_0x0a50('0x0'));module[_0x0a50('0x1')]={'name':{'type':Sequelize[_0x0a50('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0a50('0x2')]},'ecm':{'type':Sequelize[_0x0a50('0x3')]('yes','no'),'defaultValue':_0x0a50('0x4')},'headerinfo':{'type':Sequelize[_0x0a50('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':_0x0a50('0x5')},'minrate':{'type':Sequelize[_0x0a50('0x3')](_0x0a50('0x6'),_0x0a50('0x7'),'7200',_0x0a50('0x8'),_0x0a50('0x9'),_0x0a50('0xa')),'defaultValue':_0x0a50('0x7')},'maxrate':{'type':Sequelize[_0x0a50('0x3')]('2400',_0x0a50('0x7'),_0x0a50('0xb'),'9600',_0x0a50('0x9'),_0x0a50('0xa')),'defaultValue':_0x0a50('0xa')},'modem':{'type':Sequelize[_0x0a50('0x2')],'defaultValue':_0x0a50('0xc')},'gateway':{'type':Sequelize[_0x0a50('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[_0x0a50('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x0a50('0xe'),_0x0a50('0xf'),_0x0a50('0x10'),_0x0a50('0x11')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x0a50('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0a50('0x12')],'defaultValue':function(){return _0x0a50('0x13');}},'notificationSound':{'type':Sequelize[_0x0a50('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0a50('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0a50('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0a50('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0a50('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a50('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x0a50('0x15')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0a50('0x16'),'set':function(_0x559256){if(!_0x559256)this[_0x0a50('0x17')](_0x0a50('0x18'),null);this[_0x0a50('0x17')]('mandatoryDisposition',_0x559256);}}}; \ No newline at end of file +var _0xba74=['14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','yes','localstationid','2400','4800','7200','9600','12000'];(function(_0x3e148f,_0x544059){var _0x524b4e=function(_0x484faa){while(--_0x484faa){_0x3e148f['push'](_0x3e148f['shift']());}};_0x524b4e(++_0x544059);}(_0xba74,0x176));var _0x4ba7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xba74[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x4ba7('0x0'));module['exports']={'name':{'type':Sequelize[_0x4ba7('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4ba7('0x1')]},'ecm':{'type':Sequelize[_0x4ba7('0x2')](_0x4ba7('0x3'),'no'),'defaultValue':_0x4ba7('0x3')},'headerinfo':{'type':Sequelize[_0x4ba7('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':_0x4ba7('0x4')},'minrate':{'type':Sequelize[_0x4ba7('0x2')](_0x4ba7('0x5'),_0x4ba7('0x6'),_0x4ba7('0x7'),_0x4ba7('0x8'),_0x4ba7('0x9'),_0x4ba7('0xa')),'defaultValue':_0x4ba7('0x6')},'maxrate':{'type':Sequelize[_0x4ba7('0x2')]('2400',_0x4ba7('0x6'),_0x4ba7('0x7'),'9600',_0x4ba7('0x9'),_0x4ba7('0xa')),'defaultValue':_0x4ba7('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x4ba7('0xb')},'gateway':{'type':Sequelize[_0x4ba7('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4ba7('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x4ba7('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4ba7('0x2')](_0x4ba7('0xd'),_0x4ba7('0xe'),_0x4ba7('0xf'),'KHOMP'),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x4ba7('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4ba7('0x10')],'defaultValue':function(){return _0x4ba7('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4ba7('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4ba7('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4ba7('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4ba7('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4ba7('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4ba7('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x4ba7('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x4ba7('0x12')],'defaultValue':![],'comment':_0x4ba7('0x14'),'set':function(_0x44016a){if(!_0x44016a)this[_0x4ba7('0x15')](_0x4ba7('0x16'),null);this[_0x4ba7('0x15')](_0x4ba7('0x17'),_0x44016a);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 0e62e63..4c6a9a3 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 _0xb10b=['VIRTUAL','options','FaxAccount','count','includeAll','include','findAll','rows','params','Pause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','order','removeDispositions','ids','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','nolimit','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','exten','system','description','Fax\x20Extension','appdata','push','Set','ecm','localstationid','gateway','faxdetect','maxrate','minrate','modem','t38timeout','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','tech','createdAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','updatedAt','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','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','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','json','offset','limit','set','Content-Range','apply','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xb10b,0x12a));var _0xbb10=function(_0x587ba2,_0x42eb40){_0x587ba2=_0x587ba2-0x0;var _0x50ec73=_0xb10b[_0x587ba2];return _0x50ec73;};'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'];config[_0xbb10('0x18')]=_[_0xbb10('0x19')](config[_0xbb10('0x18')],{'host':_0xbb10('0x1a'),'port':0x18eb});var socket=require(_0xbb10('0x1b'))(new Redis(config['redis']));require(_0xbb10('0x1c'))[_0xbb10('0x1d')](socket);var jayson=require(_0xbb10('0x1e'));var client=jayson[_0xbb10('0x1f')][_0xbb10('0x20')]({'port':0x232c});var client9002=jayson[_0xbb10('0x1f')][_0xbb10('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x36b5e8,_0x3e26f4,_0x2b184e,_0x4a2bfc){return new BPromise(function(_0x2eca0f,_0x1145f1){var _0x133ac2=_0x4a2bfc||client;return _0x133ac2[_0xbb10('0x21')](_0x36b5e8,_0x2b184e)[_0xbb10('0x22')](function(_0x1682a4){logger[_0xbb10('0x23')](_0xbb10('0x24'),_0x3e26f4,_0xbb10('0x25'));logger[_0xbb10('0x26')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3e26f4,_0xbb10('0x25'),JSON[_0xbb10('0x27')](_0x1682a4));if(_0x1682a4[_0xbb10('0x28')]){if(_0x1682a4[_0xbb10('0x28')][_0xbb10('0x29')]===0x1f4){logger[_0xbb10('0x28')]('FaxAccount,\x20%s,\x20%s',_0x3e26f4,_0x1682a4[_0xbb10('0x28')][_0xbb10('0x2a')]);return _0x1145f1(_0x1682a4['error']['message']);}logger[_0xbb10('0x28')](_0xbb10('0x24'),_0x3e26f4,_0x1682a4[_0xbb10('0x28')][_0xbb10('0x2a')]);return _0x2eca0f(_0x1682a4[_0xbb10('0x28')][_0xbb10('0x2a')]);}else{logger[_0xbb10('0x23')](_0xbb10('0x24'),_0x3e26f4,_0xbb10('0x25'));_0x2eca0f(_0x1682a4[_0xbb10('0x2b')][_0xbb10('0x2a')]);}})[_0xbb10('0x2c')](function(_0x537898){logger['error']('FaxAccount,\x20%s,\x20%s',_0x3e26f4,_0x537898);_0x1145f1(_0x537898);});});}function respondWithStatusCode(_0xc93a04,_0x3c5ae7){_0x3c5ae7=_0x3c5ae7||0xcc;return function(_0x2c89b9){if(_0x2c89b9){return _0xc93a04['sendStatus'](_0x3c5ae7);}return _0xc93a04[_0xbb10('0x2d')](_0x3c5ae7)[_0xbb10('0x2e')]();};}function respondWithResult(_0x6ed43b,_0x1d5e95){_0x1d5e95=_0x1d5e95||0xc8;return function(_0x1acce9){if(_0x1acce9){return _0x6ed43b[_0xbb10('0x2d')](_0x1d5e95)[_0xbb10('0x2f')](_0x1acce9);}};}function respondWithFilteredResult(_0x4aabb9,_0x3796c7){return function(_0x21ac54){if(_0x21ac54){var _0xfc3595=_0x21ac54['count'],_0x2e0249=_0x3796c7[_0xbb10('0x30')],_0x1d30aa=_0x3796c7['offset']+_0x3796c7[_0xbb10('0x31')],_0x2ff4c1;if(_0x1d30aa>=_0xfc3595){_0x1d30aa=_0xfc3595;_0x2ff4c1=0xc8;}else{_0x2ff4c1=0xce;}_0x4aabb9['status'](_0x2ff4c1);return _0x4aabb9[_0xbb10('0x32')](_0xbb10('0x33'),_0x2e0249+'-'+_0x1d30aa+'/'+_0xfc3595)[_0xbb10('0x2f')](_0x21ac54);}return null;};}function patchUpdates(_0x491db4){return function(_0x518d47){try{jsonpatch[_0xbb10('0x34')](_0x518d47,_0x491db4,!![]);}catch(_0x34f65e){return BPromise['reject'](_0x34f65e);}return _0x518d47[_0xbb10('0x35')]();};}function saveUpdates(_0x37dde7,_0x2f653f){return function(_0x1c0b57){if(_0x1c0b57){return _0x1c0b57[_0xbb10('0x36')](_0x37dde7)[_0xbb10('0x22')](function(_0xf85197){return _0xf85197;});}return null;};}function removeEntity(_0x4975f5,_0x25acb3){return function(_0x1da9c9){if(_0x1da9c9){return _0x1da9c9[_0xbb10('0x37')]()[_0xbb10('0x22')](function(){var _0xfb2c5e=_0x1da9c9[_0xbb10('0x38')]({'plain':!![]});var _0x188cbd=_0xbb10('0x39');return db[_0xbb10('0x3a')]['destroy']({'where':{'type':_0x188cbd,'resourceId':_0xfb2c5e['id']}})[_0xbb10('0x22')](function(){return _0x1da9c9;});})[_0xbb10('0x22')](function(){_0x4975f5[_0xbb10('0x2d')](0xcc)[_0xbb10('0x2e')]();});}};}function handleEntityNotFound(_0x570f5a,_0x111762){return function(_0x5de37b){if(!_0x5de37b){_0x570f5a['sendStatus'](0x194);}return _0x5de37b;};}function handleError(_0x3eb3cc,_0x40c164){_0x40c164=_0x40c164||0x1f4;return function(_0x26e76a){logger[_0xbb10('0x28')](_0x26e76a[_0xbb10('0x3b')]);if(_0x26e76a[_0xbb10('0x3c')]){delete _0x26e76a['name'];}_0x3eb3cc[_0xbb10('0x2d')](_0x40c164)[_0xbb10('0x3d')](_0x26e76a);};}exports['index']=function(_0x5e3fbd,_0x5cd55f){var _0x31bee3={'include':[{'model':db['Pause'],'as':_0xbb10('0x3e')}]},_0x2b0b45={},_0x2b658a={'count':0x0,'rows':[]};var _0x3e8538=_[_0xbb10('0x3f')](db['FaxAccount'][_0xbb10('0x40')],function(_0x12238a){return{'name':_0x12238a[_0xbb10('0x41')],'type':_0x12238a[_0xbb10('0x42')]['key']};});_0x2b0b45[_0xbb10('0x43')]=_[_0xbb10('0x3f')](_0x3e8538,'name');_0x2b0b45[_0xbb10('0x44')]=_[_0xbb10('0x45')](_0x5e3fbd[_0xbb10('0x44')]);_0x2b0b45[_0xbb10('0x46')]=_[_0xbb10('0x47')](_0x2b0b45[_0xbb10('0x43')],_0x2b0b45['query']);_0x31bee3[_0xbb10('0x48')]=_[_0xbb10('0x47')](_0x2b0b45[_0xbb10('0x43')],qs[_0xbb10('0x49')](_0x5e3fbd['query'][_0xbb10('0x49')]));_0x31bee3[_0xbb10('0x48')]=_0x31bee3[_0xbb10('0x48')][_0xbb10('0x4a')]?_0x31bee3['attributes']:_0x2b0b45[_0xbb10('0x43')];if(!_0x5e3fbd[_0xbb10('0x44')]['hasOwnProperty']('nolimit')){_0x31bee3[_0xbb10('0x31')]=qs['limit'](_0x5e3fbd[_0xbb10('0x44')][_0xbb10('0x31')]);_0x31bee3['offset']=qs[_0xbb10('0x30')](_0x5e3fbd[_0xbb10('0x44')][_0xbb10('0x30')]);}_0x31bee3['order']=qs[_0xbb10('0x4b')](_0x5e3fbd[_0xbb10('0x44')][_0xbb10('0x4b')]);_0x31bee3[_0xbb10('0x4c')]=qs[_0xbb10('0x46')](_[_0xbb10('0x4d')](_0x5e3fbd[_0xbb10('0x44')],_0x2b0b45[_0xbb10('0x46')]),_0x3e8538);if(_0x5e3fbd[_0xbb10('0x44')][_0xbb10('0x4e')]){_0x31bee3[_0xbb10('0x4c')]=_[_0xbb10('0x4f')](_0x31bee3['where'],{'$or':_[_0xbb10('0x3f')](_0x3e8538,function(_0x41bbf8){if(_0x41bbf8['type']!==_0xbb10('0x50')){var _0x2f5027={};_0x2f5027[_0x41bbf8[_0xbb10('0x3c')]]={'$like':'%'+_0x5e3fbd[_0xbb10('0x44')][_0xbb10('0x4e')]+'%'};return _0x2f5027;}})});}_0x31bee3=_[_0xbb10('0x4f')]({},_0x31bee3,_0x5e3fbd[_0xbb10('0x51')]);var _0x5be85e={'where':_0x31bee3['where']};return db[_0xbb10('0x52')][_0xbb10('0x53')](_0x5be85e)[_0xbb10('0x22')](function(_0x57d2c0){_0x2b658a['count']=_0x57d2c0;if(_0x5e3fbd[_0xbb10('0x44')][_0xbb10('0x54')]){_0x31bee3[_0xbb10('0x55')]=[{'all':!![]}];}return db[_0xbb10('0x52')][_0xbb10('0x56')](_0x31bee3);})[_0xbb10('0x22')](function(_0x2f2552){_0x2b658a[_0xbb10('0x57')]=_0x2f2552;return _0x2b658a;})[_0xbb10('0x22')](respondWithFilteredResult(_0x5cd55f,_0x31bee3))[_0xbb10('0x2c')](handleError(_0x5cd55f,null));};exports['show']=function(_0x5eafac,_0x412e13){var _0x467dba={'raw':![],'where':{'id':_0x5eafac[_0xbb10('0x58')]['id']},'include':[{'model':db[_0xbb10('0x59')],'as':_0xbb10('0x3e')}]},_0x36ab7d={};_0x36ab7d[_0xbb10('0x43')]=_[_0xbb10('0x45')](db[_0xbb10('0x52')][_0xbb10('0x40')]);_0x36ab7d[_0xbb10('0x44')]=_[_0xbb10('0x45')](_0x5eafac[_0xbb10('0x44')]);_0x36ab7d[_0xbb10('0x46')]=_[_0xbb10('0x47')](_0x36ab7d['model'],_0x36ab7d[_0xbb10('0x44')]);_0x467dba['attributes']=_[_0xbb10('0x47')](_0x36ab7d[_0xbb10('0x43')],qs[_0xbb10('0x49')](_0x5eafac[_0xbb10('0x44')][_0xbb10('0x49')]));_0x467dba[_0xbb10('0x48')]=_0x467dba[_0xbb10('0x48')][_0xbb10('0x4a')]?_0x467dba[_0xbb10('0x48')]:_0x36ab7d[_0xbb10('0x43')];if(_0x5eafac[_0xbb10('0x44')][_0xbb10('0x54')]){_0x467dba[_0xbb10('0x55')]=[{'all':!![]}];}_0x467dba=_[_0xbb10('0x4f')]({},_0x467dba,_0x5eafac[_0xbb10('0x51')]);return db['FaxAccount'][_0xbb10('0x5a')](_0x467dba)[_0xbb10('0x22')](handleEntityNotFound(_0x412e13,null))[_0xbb10('0x22')](respondWithResult(_0x412e13,null))[_0xbb10('0x2c')](handleError(_0x412e13,null));};exports[_0xbb10('0x5b')]=function(_0x379d8c,_0x4bedd0){return db[_0xbb10('0x52')][_0xbb10('0x5b')](_0x379d8c[_0xbb10('0x5c')],{})[_0xbb10('0x22')](function(_0x432728){var _0x22de7f=_0x379d8c[_0xbb10('0x5d')][_0xbb10('0x38')]({'plain':!![]});if(!_0x22de7f)throw new Error(_0xbb10('0x5e'));if(_0x22de7f[_0xbb10('0x5f')]===_0xbb10('0x5d')){var _0x2a1ce1=_0x432728[_0xbb10('0x38')]({'plain':!![]});var _0x4e7fac='FaxAccounts';return db[_0xbb10('0x60')][_0xbb10('0x5a')]({'where':{'name':_0x4e7fac,'userProfileId':_0x22de7f[_0xbb10('0x61')]},'raw':!![]})[_0xbb10('0x22')](function(_0x5573bb){if(_0x5573bb&&_0x5573bb['autoAssociation']===0x0){return db[_0xbb10('0x3a')][_0xbb10('0x5b')]({'name':_0x2a1ce1[_0xbb10('0x3c')],'resourceId':_0x2a1ce1['id'],'type':_0x5573bb[_0xbb10('0x3c')],'sectionId':_0x5573bb['id']},{})[_0xbb10('0x22')](function(){return _0x432728;});}else{return _0x432728;}})[_0xbb10('0x2c')](function(_0x45c0dc){logger['error'](_0xbb10('0x62'),_0x45c0dc);throw _0x45c0dc;});}return _0x432728;})[_0xbb10('0x22')](respondWithResult(_0x4bedd0,0xc9))['catch'](handleError(_0x4bedd0,null));};exports['update']=function(_0x5a231f,_0x32c1e8){if(_0x5a231f[_0xbb10('0x5c')]['id']){delete _0x5a231f[_0xbb10('0x5c')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x5a231f['params']['id']},'include':[{'model':db[_0xbb10('0x59')],'as':_0xbb10('0x3e')}]})[_0xbb10('0x22')](handleEntityNotFound(_0x32c1e8,null))['then'](saveUpdates(_0x5a231f[_0xbb10('0x5c')],null))[_0xbb10('0x22')](respondWithResult(_0x32c1e8,null))['catch'](handleError(_0x32c1e8,null));};exports['destroy']=function(_0x27d7b9,_0x308896){return db[_0xbb10('0x52')][_0xbb10('0x5a')]({'where':{'id':_0x27d7b9['params']['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x308896,null))[_0xbb10('0x22')](removeEntity(_0x308896,null))[_0xbb10('0x2c')](handleError(_0x308896,null));};exports['describe']=function(_0x402a01,_0x2f05bc){return db[_0xbb10('0x52')]['describe']()[_0xbb10('0x22')](respondWithResult(_0x2f05bc,null))[_0xbb10('0x2c')](handleError(_0x2f05bc,null));};exports[_0xbb10('0x63')]=function(_0x37b65f,_0x5e4a6e,_0x251417){if(_0x37b65f[_0xbb10('0x5c')]['id']){delete _0x37b65f[_0xbb10('0x5c')]['id'];}return db[_0xbb10('0x52')]['find']({'where':{'id':_0x37b65f[_0xbb10('0x58')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x5e4a6e,null))[_0xbb10('0x22')](function(_0x2ceb3e){if(_0x2ceb3e){_0x37b65f[_0xbb10('0x5c')][_0xbb10('0x64')]=_0x2ceb3e['id'];return db[_0xbb10('0x65')]['create'](_0x37b65f['body']);}})['then'](respondWithResult(_0x5e4a6e,null))[_0xbb10('0x2c')](handleError(_0x5e4a6e,null));};exports[_0xbb10('0x66')]=function(_0x3eda96,_0x5c9afc,_0x5cd089){var _0x46f462={'raw':![],'where':{}};var _0x1b11c0={};var _0xd9e743={'count':0x0,'rows':[]};return db[_0xbb10('0x52')][_0xbb10('0x67')]({'where':{'id':_0x3eda96[_0xbb10('0x58')]['id']}})['then'](handleEntityNotFound(_0x5c9afc,null))[_0xbb10('0x22')](function(_0x15fae2){if(_0x15fae2){_0x1b11c0[_0xbb10('0x43')]=_[_0xbb10('0x45')](db[_0xbb10('0x65')]['rawAttributes']);_0x1b11c0['query']=_['keys'](_0x3eda96[_0xbb10('0x44')]);_0x1b11c0[_0xbb10('0x46')]=_[_0xbb10('0x47')](_0x1b11c0[_0xbb10('0x43')],_0x1b11c0[_0xbb10('0x44')]);_0x46f462[_0xbb10('0x48')]=_['intersection'](_0x1b11c0[_0xbb10('0x43')],qs['fields'](_0x3eda96['query']['fields']));_0x46f462[_0xbb10('0x48')]=_0x46f462[_0xbb10('0x48')][_0xbb10('0x4a')]?_0x46f462[_0xbb10('0x48')]:_0x1b11c0['model'];if(!_0x3eda96[_0xbb10('0x44')]['hasOwnProperty']('nolimit')){_0x46f462[_0xbb10('0x31')]=qs[_0xbb10('0x31')](_0x3eda96[_0xbb10('0x44')][_0xbb10('0x31')]);_0x46f462[_0xbb10('0x30')]=qs['offset'](_0x3eda96[_0xbb10('0x44')][_0xbb10('0x30')]);}_0x46f462[_0xbb10('0x68')]=qs[_0xbb10('0x4b')](_0x3eda96[_0xbb10('0x44')][_0xbb10('0x4b')]);_0x46f462[_0xbb10('0x4c')]=qs['filters'](_[_0xbb10('0x4d')](_0x3eda96[_0xbb10('0x44')],_0x1b11c0[_0xbb10('0x46')]));_0x46f462[_0xbb10('0x4c')][_0xbb10('0x64')]=_0x15fae2['id'];if(_0x3eda96[_0xbb10('0x44')][_0xbb10('0x4e')]){_0x46f462[_0xbb10('0x4c')]=_['merge'](_0x46f462[_0xbb10('0x4c')],{'$or':_[_0xbb10('0x3f')](_0x46f462[_0xbb10('0x48')],function(_0x56416a){var _0x4ee101={};_0x4ee101[_0x56416a]={'$like':'%'+_0x3eda96['query'][_0xbb10('0x4e')]+'%'};return _0x4ee101;})});}_0x46f462=_['merge']({},_0x46f462,_0x3eda96['options']);return db[_0xbb10('0x65')][_0xbb10('0x53')]({'where':_0x46f462[_0xbb10('0x4c')]})[_0xbb10('0x22')](function(_0x32ec27){_0xd9e743[_0xbb10('0x53')]=_0x32ec27;if(_0x3eda96[_0xbb10('0x44')][_0xbb10('0x54')]){_0x46f462[_0xbb10('0x55')]=[{'all':!![]}];}return db['Disposition'][_0xbb10('0x56')](_0x46f462);})[_0xbb10('0x22')](function(_0x46b6d2){_0xd9e743[_0xbb10('0x57')]=_0x46b6d2;return _0xd9e743;});}})['then'](respondWithFilteredResult(_0x5c9afc,_0x46f462))['catch'](handleError(_0x5c9afc,null));};exports[_0xbb10('0x69')]=function(_0x2280bd,_0x30f0a4,_0x32bb25){return db['FaxAccount'][_0xbb10('0x5a')]({'where':{'id':_0x2280bd[_0xbb10('0x58')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x30f0a4,null))[_0xbb10('0x22')](function(_0x35c1e8){if(_0x35c1e8){return _0x35c1e8['removeDispositions'](_0x2280bd['query'][_0xbb10('0x6a')]);}})[_0xbb10('0x22')](respondWithStatusCode(_0x30f0a4,null))[_0xbb10('0x2c')](handleError(_0x30f0a4,null));};exports['addAnswer']=function(_0x256b35,_0x13e2ab,_0x50bcc9){if(_0x256b35['body']['id']){delete _0x256b35[_0xbb10('0x5c')]['id'];}return db[_0xbb10('0x52')][_0xbb10('0x5a')]({'where':{'id':_0x256b35['params']['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x13e2ab,null))[_0xbb10('0x22')](function(_0xfbb365){if(_0xfbb365){_0x256b35[_0xbb10('0x5c')][_0xbb10('0x64')]=_0xfbb365['id'];return db[_0xbb10('0x6b')][_0xbb10('0x5b')](_0x256b35[_0xbb10('0x5c')]);}})[_0xbb10('0x22')](respondWithResult(_0x13e2ab,null))['catch'](handleError(_0x13e2ab,null));};exports[_0xbb10('0x6c')]=function(_0x28cc46,_0x412fbf,_0xdb7d3e){var _0x3e3083={'raw':![],'where':{}};var _0x39f64b={};var _0x33a6fc={'count':0x0,'rows':[]};return db[_0xbb10('0x52')][_0xbb10('0x67')]({'where':{'id':_0x28cc46[_0xbb10('0x58')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x412fbf,null))[_0xbb10('0x22')](function(_0x59e985){if(_0x59e985){_0x39f64b['model']=_[_0xbb10('0x45')](db[_0xbb10('0x6b')][_0xbb10('0x40')]);_0x39f64b[_0xbb10('0x44')]=_[_0xbb10('0x45')](_0x28cc46['query']);_0x39f64b[_0xbb10('0x46')]=_[_0xbb10('0x47')](_0x39f64b[_0xbb10('0x43')],_0x39f64b[_0xbb10('0x44')]);_0x3e3083[_0xbb10('0x48')]=_[_0xbb10('0x47')](_0x39f64b['model'],qs[_0xbb10('0x49')](_0x28cc46[_0xbb10('0x44')]['fields']));_0x3e3083[_0xbb10('0x48')]=_0x3e3083['attributes'][_0xbb10('0x4a')]?_0x3e3083[_0xbb10('0x48')]:_0x39f64b[_0xbb10('0x43')];if(!_0x28cc46[_0xbb10('0x44')][_0xbb10('0x6d')]('nolimit')){_0x3e3083[_0xbb10('0x31')]=qs['limit'](_0x28cc46[_0xbb10('0x44')][_0xbb10('0x31')]);_0x3e3083['offset']=qs['offset'](_0x28cc46[_0xbb10('0x44')][_0xbb10('0x30')]);}_0x3e3083[_0xbb10('0x68')]=qs[_0xbb10('0x4b')](_0x28cc46[_0xbb10('0x44')][_0xbb10('0x4b')]);_0x3e3083[_0xbb10('0x4c')]=qs[_0xbb10('0x46')](_[_0xbb10('0x4d')](_0x28cc46[_0xbb10('0x44')],_0x39f64b[_0xbb10('0x46')]));_0x3e3083['where'][_0xbb10('0x64')]=_0x59e985['id'];if(_0x28cc46[_0xbb10('0x44')][_0xbb10('0x4e')]){_0x3e3083[_0xbb10('0x4c')]=_[_0xbb10('0x4f')](_0x3e3083[_0xbb10('0x4c')],{'$or':_[_0xbb10('0x3f')](_0x3e3083[_0xbb10('0x48')],function(_0x3e6fe2){var _0x18a136={};_0x18a136[_0x3e6fe2]={'$like':'%'+_0x28cc46[_0xbb10('0x44')][_0xbb10('0x4e')]+'%'};return _0x18a136;})});}_0x3e3083=_['merge']({},_0x3e3083,_0x28cc46[_0xbb10('0x51')]);return db['CannedAnswer'][_0xbb10('0x53')]({'where':_0x3e3083[_0xbb10('0x4c')]})[_0xbb10('0x22')](function(_0x40236c){_0x33a6fc[_0xbb10('0x53')]=_0x40236c;if(_0x28cc46['query'][_0xbb10('0x54')]){_0x3e3083[_0xbb10('0x55')]=[{'all':!![]}];}return db[_0xbb10('0x6b')][_0xbb10('0x56')](_0x3e3083);})[_0xbb10('0x22')](function(_0x41380b){_0x33a6fc['rows']=_0x41380b;return _0x33a6fc;});}})['then'](respondWithFilteredResult(_0x412fbf,_0x3e3083))[_0xbb10('0x2c')](handleError(_0x412fbf,null));};exports[_0xbb10('0x6e')]=function(_0x41d4d0,_0x57d5a1,_0x124b32){return db[_0xbb10('0x52')]['find']({'where':{'id':_0x41d4d0[_0xbb10('0x58')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x57d5a1,null))['then'](function(_0xdd3c7e){if(_0xdd3c7e){return _0xdd3c7e['removeAnswers'](_0x41d4d0[_0xbb10('0x44')][_0xbb10('0x6a')]);}})['then'](respondWithStatusCode(_0x57d5a1,null))[_0xbb10('0x2c')](handleError(_0x57d5a1,null));};exports[_0xbb10('0x6f')]=function(_0x4bac29,_0x5dae56,_0xea6bf2){return db[_0xbb10('0x70')][_0xbb10('0x5a')]({'where':{'id':_0x4bac29[_0xbb10('0x58')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x5dae56,null))['then'](function(_0xe7c0a3){if(_0xe7c0a3){return _0xe7c0a3[_0xbb10('0x6f')](_0x4bac29[_0xbb10('0x5c')]['ids'],_[_0xbb10('0x71')](_0x4bac29[_0xbb10('0x5c')],[_0xbb10('0x6a'),'id'])||{});}})[_0xbb10('0x22')](respondWithResult(_0x5dae56,null))[_0xbb10('0x2c')](handleError(_0x5dae56,null));};exports[_0xbb10('0x72')]=function(_0x1f55d3,_0x189f07,_0x2010d4){var _0x5f1fcd={'raw':![],'where':{}};var _0x4fc544={};var _0x37e40c={'count':0x0,'rows':[]};return db[_0xbb10('0x52')][_0xbb10('0x67')]({'where':{'id':_0x1f55d3[_0xbb10('0x58')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x189f07,null))[_0xbb10('0x22')](function(_0x1cccec){if(_0x1cccec){_0x4fc544[_0xbb10('0x43')]=_[_0xbb10('0x45')](db[_0xbb10('0x70')][_0xbb10('0x40')]);_0x4fc544[_0xbb10('0x44')]=_[_0xbb10('0x45')](_0x1f55d3['query']);_0x4fc544[_0xbb10('0x46')]=_[_0xbb10('0x47')](_0x4fc544[_0xbb10('0x43')],_0x4fc544[_0xbb10('0x44')]);_0x5f1fcd[_0xbb10('0x48')]=_[_0xbb10('0x47')](_0x4fc544[_0xbb10('0x43')],qs[_0xbb10('0x49')](_0x1f55d3[_0xbb10('0x44')][_0xbb10('0x49')]));_0x5f1fcd[_0xbb10('0x48')]=_0x5f1fcd['attributes'][_0xbb10('0x4a')]?_0x5f1fcd['attributes']:_0x4fc544[_0xbb10('0x43')];if(!_0x1f55d3[_0xbb10('0x44')][_0xbb10('0x6d')](_0xbb10('0x73'))){_0x5f1fcd[_0xbb10('0x31')]=qs[_0xbb10('0x31')](_0x1f55d3['query'][_0xbb10('0x31')]);_0x5f1fcd['offset']=qs[_0xbb10('0x30')](_0x1f55d3[_0xbb10('0x44')][_0xbb10('0x30')]);}_0x5f1fcd[_0xbb10('0x68')]=qs[_0xbb10('0x4b')](_0x1f55d3[_0xbb10('0x44')][_0xbb10('0x4b')]);_0x5f1fcd[_0xbb10('0x4c')]=qs[_0xbb10('0x46')](_[_0xbb10('0x4d')](_0x1f55d3[_0xbb10('0x44')],_0x4fc544[_0xbb10('0x46')]));_0x5f1fcd['where'][_0xbb10('0x64')]=_0x1cccec['id'];if(_0x1f55d3['query'][_0xbb10('0x4e')]){_0x5f1fcd[_0xbb10('0x4c')]=_[_0xbb10('0x4f')](_0x5f1fcd[_0xbb10('0x4c')],{'$or':_[_0xbb10('0x3f')](_0x5f1fcd[_0xbb10('0x48')],function(_0x185ec9){var _0x5e9888={};_0x5e9888[_0x185ec9]={'$like':'%'+_0x1f55d3[_0xbb10('0x44')]['filter']+'%'};return _0x5e9888;})});}_0x5f1fcd=_['merge']({},_0x5f1fcd,_0x1f55d3[_0xbb10('0x51')]);return db[_0xbb10('0x70')][_0xbb10('0x53')]({'where':_0x5f1fcd[_0xbb10('0x4c')]})[_0xbb10('0x22')](function(_0x16b8c1){_0x37e40c['count']=_0x16b8c1;if(_0x1f55d3[_0xbb10('0x44')][_0xbb10('0x54')]){_0x5f1fcd[_0xbb10('0x55')]=[{'model':db[_0xbb10('0x74')],'as':_0xbb10('0x75'),'required':![]},{'model':db[_0xbb10('0x76')],'as':'Owner','attributes':[_0xbb10('0x3c'),_0xbb10('0x77'),_0xbb10('0x78')],'required':![]},{'model':db[_0xbb10('0x79')],'as':_0xbb10('0x7a'),'attributes':['id',_0xbb10('0x3c'),_0xbb10('0x7b')],'where':_0x1f55d3['query'][_0xbb10('0x7c')]?{'id':_0x1f55d3['query'][_0xbb10('0x7c')]}:undefined,'required':_0x1f55d3['query']['tag']?!![]:![]}];}return db[_0xbb10('0x70')][_0xbb10('0x56')](_0x5f1fcd);})[_0xbb10('0x22')](function(_0x3b7552){_0x37e40c[_0xbb10('0x57')]=_0x3b7552;return _0x37e40c;});}})['then'](respondWithFilteredResult(_0x189f07,_0x5f1fcd))[_0xbb10('0x2c')](handleError(_0x189f07,null));};exports['addApplications']=function(_0x4b877c,_0x4dd138,_0xa00798){return db[_0xbb10('0x52')][_0xbb10('0x67')]({'where':{'id':_0x4b877c[_0xbb10('0x58')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x4dd138,null))['then'](function(_0x125bcf){if(_0x125bcf){return db[_0xbb10('0x7d')][_0xbb10('0x7e')](function(_0x1bd1c1){return db[_0xbb10('0x7f')][_0xbb10('0x37')]({'where':{'FaxAccountId':_0x4b877c[_0xbb10('0x58')]['id']},'transaction':_0x1bd1c1})['then'](function(_0x4c95c2){var _0x584a62=_[_0xbb10('0x3f')](_0x4b877c[_0xbb10('0x5c')],function(_0x2ae3c6){_0x2ae3c6[_0xbb10('0x64')]=_0x4b877c[_0xbb10('0x58')]['id'];return _0x2ae3c6;});return db[_0xbb10('0x7f')][_0xbb10('0x80')](_0x584a62,{'transaction':_0x1bd1c1});});})[_0xbb10('0x22')](function(){return db[_0xbb10('0x7f')][_0xbb10('0x81')]({'where':{'FaxAccountId':_0x4b877c['params']['id']},'order':'priority'});});}})['then'](respondWithResult(_0x4dd138,null))[_0xbb10('0x2c')](handleError(_0x4dd138,null));};exports[_0xbb10('0x82')]=function(_0x7984c1,_0x47c820,_0x2bfa8e){var _0x2f6be3={};var _0x2c638d={};var _0x290280;var _0x2a6589;return db[_0xbb10('0x52')]['findOne']({'where':{'id':_0x7984c1['params']['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x47c820,null))['then'](function(_0x370215){if(_0x370215){_0x290280=_0x370215;_0x2c638d[_0xbb10('0x43')]=_[_0xbb10('0x45')](db[_0xbb10('0x7f')][_0xbb10('0x40')]);_0x2c638d[_0xbb10('0x44')]=_[_0xbb10('0x45')](_0x7984c1[_0xbb10('0x44')]);_0x2c638d[_0xbb10('0x46')]=_[_0xbb10('0x47')](_0x2c638d['model'],_0x2c638d[_0xbb10('0x44')]);_0x2f6be3['attributes']=_[_0xbb10('0x47')](_0x2c638d['model'],qs[_0xbb10('0x49')](_0x7984c1[_0xbb10('0x44')][_0xbb10('0x49')]));_0x2f6be3[_0xbb10('0x48')]=_0x2f6be3['attributes'][_0xbb10('0x4a')]?_0x2f6be3['attributes']:_0x2c638d[_0xbb10('0x43')];_0x2f6be3[_0xbb10('0x68')]=qs[_0xbb10('0x4b')](_0x7984c1['query'][_0xbb10('0x4b')]);_0x2f6be3[_0xbb10('0x4c')]=qs[_0xbb10('0x46')](_[_0xbb10('0x4d')](_0x7984c1[_0xbb10('0x44')],_0x2c638d[_0xbb10('0x46')]));if(_0x7984c1['query']['filter']){_0x2f6be3['where']=_[_0xbb10('0x4f')](_0x2f6be3['where'],{'$or':_[_0xbb10('0x3f')](_0x2f6be3['attributes'],function(_0xf90506){var _0x34ce1b={};_0x34ce1b[_0xf90506]={'$like':'%'+_0x7984c1[_0xbb10('0x44')]['filter']+'%'};return _0x34ce1b;})});}_0x2f6be3=_['merge']({},_0x2f6be3,_0x7984c1[_0xbb10('0x51')]);return _0x290280[_0xbb10('0x82')](_0x2f6be3);}})[_0xbb10('0x22')](function(_0x59b20f){if(_0x59b20f){_0x2a6589=_0x59b20f[_0xbb10('0x4a')];if(!_0x7984c1[_0xbb10('0x44')][_0xbb10('0x6d')]('nolimit')){_0x2f6be3['limit']=qs['limit'](_0x7984c1[_0xbb10('0x44')]['limit']);_0x2f6be3[_0xbb10('0x30')]=qs[_0xbb10('0x30')](_0x7984c1[_0xbb10('0x44')][_0xbb10('0x30')]);}return _0x290280[_0xbb10('0x82')](_0x2f6be3);}})[_0xbb10('0x22')](function(_0x14fce6){if(_0x14fce6){return _0x14fce6?{'count':_0x2a6589,'rows':_0x14fce6}:null;}})[_0xbb10('0x22')](respondWithResult(_0x47c820,null))[_0xbb10('0x2c')](handleError(_0x47c820,null));};function Extension(_0x431792,_0x2e2710,_0x4e33b6,_0xaa2353){this[_0xbb10('0x83')]='from-voip-provider';this[_0xbb10('0x84')]=_0x431792['localstationid'];this['app']=_0xaa2353;this[_0xbb10('0x42')]=_0xbb10('0x85');this[_0xbb10('0x86')]=_0xbb10('0x87');this[_0xbb10('0x64')]=_0x431792['id'];this['priority']=_0x2e2710;this[_0xbb10('0x88')]=_0x4e33b6;}function createExtensionsReciveFax(_0x18b749){var _0x4f17c1=0x1;var _0xa45726=[];_0xa45726[_0xbb10('0x89')](new Extension(_0x18b749,_0x4f17c1,'','Answer'));_0x4f17c1+=0x1;_0xa45726[_0xbb10('0x89')](new Extension(_0x18b749,_0x4f17c1,'CDR(type)=inbound-fax',_0xbb10('0x8a')));_0x4f17c1+=0x1;for(var _0x8e8049 in _0x18b749){if(_0x18b749[_0xbb10('0x6d')](_0x8e8049)&&(_0x8e8049===_0xbb10('0x8b')||_0x8e8049===_0xbb10('0x8c')||_0x8e8049===_0xbb10('0x8d')||_0x8e8049===_0xbb10('0x8e')||_0x8e8049==='headerinfo'||_0x8e8049===_0xbb10('0x8f')||_0x8e8049===_0xbb10('0x90')||_0x8e8049===_0xbb10('0x91')||_0x8e8049===_0xbb10('0x92'))){_0xa45726[_0xbb10('0x89')](new Extension(_0x18b749,_0x4f17c1,_0xbb10('0x93')+_0x8e8049+')='+_0x18b749[_0x8e8049],'Set'));_0x4f17c1+=0x1;}}_0xa45726['push'](new Extension(_0x18b749,_0x4f17c1,'6','Wait'));_0x4f17c1+=0x1;_0xa45726[_0xbb10('0x89')](new Extension(_0x18b749,_0x4f17c1,_0xbb10('0x94'),_0xbb10('0x95')));_0x4f17c1=0x0;return _0xa45726;}exports[_0xbb10('0x96')]=function(_0x57700b,_0x3b01a3,_0x3d7b4d){var _0x468e26;return db['sequelize']['transaction'](function(_0xe5b08){return db['FaxAccount'][_0xbb10('0x5b')](_0x57700b[_0xbb10('0x5c')],{'transaction':_0xe5b08})[_0xbb10('0x22')](function(_0x42276f){_0x468e26=_0x42276f[_0xbb10('0x38')]({'plain':!![]});return db[_0xbb10('0x97')][_0xbb10('0x80')](createExtensionsReciveFax(_0x468e26),{'transaction':_0xe5b08});});})['then'](function(){return _0x468e26;})[_0xbb10('0x22')](respondWithResult(_0x3b01a3,null))[_0xbb10('0x2c')](handleError(_0x3b01a3,null));};exports['updateAccountApplications']=function(_0x23301a,_0x2ab7dc,_0x32f261){var _0x5b11a2;return db['sequelize']['transaction'](function(_0x3571ba){return db[_0xbb10('0x52')]['update'](_0x23301a[_0xbb10('0x5c')],{'where':{'id':_0x23301a[_0xbb10('0x5c')]['id']},'transaction':_0x3571ba})[_0xbb10('0x22')](function(_0x24b0ea){return db[_0xbb10('0x97')][_0xbb10('0x37')]({'where':{'FaxAccountId':_0x23301a[_0xbb10('0x5c')]['id']},'transaction':_0x3571ba})['then'](function(_0x304603){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x23301a[_0xbb10('0x5c')],[_0xbb10('0x98'),'key',_0xbb10('0x99'),'updatedAt',_0xbb10('0x9a'),_0xbb10('0x9b')])),{'transaction':_0x3571ba});});});})[_0xbb10('0x22')](function(){return db['FaxAccount']['findById'](_0x23301a[_0xbb10('0x5c')]['id']);})['then'](respondWithResult(_0x2ab7dc,null))[_0xbb10('0x2c')](handleError(_0x2ab7dc,null));};exports[_0xbb10('0x9c')]=function(_0x589ecb,_0x50cd00,_0xe844b0){var _0x385bab={'raw':!![],'where':{}};var _0x30e1dd={};var _0x59eaaf={'count':0x0,'rows':[]};return db[_0xbb10('0x52')][_0xbb10('0x67')]({'where':{'id':_0x589ecb[_0xbb10('0x58')]['id']}})['then'](handleEntityNotFound(_0x50cd00,null))[_0xbb10('0x22')](function(_0x203e5a){if(_0x203e5a){_0x30e1dd[_0xbb10('0x43')]=_[_0xbb10('0x45')](db[_0xbb10('0x9d')][_0xbb10('0x40')]);_0x30e1dd[_0xbb10('0x44')]=_[_0xbb10('0x45')](_0x589ecb[_0xbb10('0x44')]);_0x30e1dd[_0xbb10('0x46')]=_[_0xbb10('0x47')](_0x30e1dd[_0xbb10('0x43')],_0x30e1dd[_0xbb10('0x44')]);_0x385bab['attributes']=_['intersection'](_0x30e1dd[_0xbb10('0x43')],qs['fields'](_0x589ecb[_0xbb10('0x44')][_0xbb10('0x49')]));_0x385bab[_0xbb10('0x48')]=_0x385bab['attributes'][_0xbb10('0x4a')]?_0x385bab[_0xbb10('0x48')]:_0x30e1dd[_0xbb10('0x43')];if(!_0x589ecb[_0xbb10('0x44')][_0xbb10('0x6d')]('nolimit')){_0x385bab[_0xbb10('0x31')]=qs[_0xbb10('0x31')](_0x589ecb[_0xbb10('0x44')][_0xbb10('0x31')]);_0x385bab[_0xbb10('0x30')]=qs[_0xbb10('0x30')](_0x589ecb['query'][_0xbb10('0x30')]);}_0x385bab[_0xbb10('0x68')]=qs['sort'](_0x589ecb[_0xbb10('0x44')][_0xbb10('0x4b')]);_0x385bab[_0xbb10('0x4c')]=qs[_0xbb10('0x46')](_[_0xbb10('0x4d')](_0x589ecb[_0xbb10('0x44')],_0x30e1dd[_0xbb10('0x46')]));_0x385bab[_0xbb10('0x4c')][_0xbb10('0x64')]=_0x203e5a['id'];if(_0x589ecb[_0xbb10('0x44')][_0xbb10('0x4e')]){_0x385bab[_0xbb10('0x4c')]=_[_0xbb10('0x4f')](_0x385bab[_0xbb10('0x4c')],{'$or':_[_0xbb10('0x3f')](_0x385bab['attributes'],function(_0x12e6cb){var _0x6b5fb3={};_0x6b5fb3[_0x12e6cb]={'$like':'%'+_0x589ecb['query']['filter']+'%'};return _0x6b5fb3;})});}if(_0x589ecb[_0xbb10('0x44')][_0xbb10('0x9e')]){var _0x24810b=_0x589ecb[_0xbb10('0x44')][_0xbb10('0x9e')][_0xbb10('0x9f')](',');var _0x3a696f={};_0x3a696f[_0x24810b[0x0]]={'$gte':moment(_0x24810b[0x1])[_0xbb10('0xa0')](_0xbb10('0xa1'))};_0x385bab['where']=_['merge'](_0x385bab['where'],_0x3a696f);}_0x385bab=_['merge']({},_0x385bab,_0x589ecb['options']);return db['FaxMessage'][_0xbb10('0x53')]({'where':_0x385bab[_0xbb10('0x4c')]})[_0xbb10('0x22')](function(_0x395ac8){_0x59eaaf['count']=_0x395ac8;if(_0x589ecb[_0xbb10('0x44')][_0xbb10('0x54')]){_0x385bab[_0xbb10('0x55')]=[{'all':!![]}];}return db[_0xbb10('0x9d')]['findAll'](_0x385bab);})['then'](function(_0x3057b4){_0x59eaaf[_0xbb10('0x57')]=_0x3057b4;return _0x59eaaf;});}})['then'](respondWithFilteredResult(_0x50cd00,_0x385bab))['catch'](handleError(_0x50cd00,null));};exports[_0xbb10('0x3d')]=function(_0xf1371a,_0x3706b5,_0x3bbdff){var _0x18cda3,_0x564dc6={},_0x4744f4;if(_0xf1371a['body']['to']){_0x4744f4=_0xf1371a['body']['to'][0x0];}return db[_0xbb10('0x52')][_0xbb10('0x5a')]({'where':{'id':_0xf1371a[_0xbb10('0x58')]['id']},'include':[{'model':db[_0xbb10('0xa2')],'as':_0xbb10('0xa3'),'include':[{'model':db[_0xbb10('0x74')],'as':'Contacts','where':{'fax':_0x4744f4},'limit':0x1,'order':[[_0xbb10('0xa4'),_0xbb10('0xa5')]]}]}]})[_0xbb10('0x22')](handleEntityNotFound(_0x3706b5,null))[_0xbb10('0x22')](function(_0x6f8d2){_0x18cda3=_0x6f8d2;if(_0xf1371a[_0xbb10('0x5c')][_0xbb10('0xa6')]&&_0xf1371a[_0xbb10('0x5c')][_0xbb10('0xa6')][_0xbb10('0x4a')]){for(var _0xbae19c=0x0;_0xbae19c<_0xf1371a[_0xbb10('0x5c')][_0xbb10('0xa6')][_0xbb10('0x4a')];_0xbae19c+=0x1){_0xf1371a[_0xbb10('0x5c')][_0xbb10('0xa6')][_0xbae19c]={'filename':_0xf1371a[_0xbb10('0x5c')][_0xbb10('0xa6')][_0xbae19c][_0xbb10('0x3c')],'id':_0xf1371a[_0xbb10('0x5c')][_0xbb10('0xa6')][_0xbae19c]['id'],'path':path[_0xbb10('0xa7')](config['root'],_0xbb10('0xa8'),_0xf1371a['body'][_0xbb10('0xa6')][_0xbae19c][_0xbb10('0xa9')])};}}return respondWithRpcPromise(_0xbb10('0xaa'),_0xbb10('0xaa'),{'FaxAccountId':_[_0xbb10('0xab')](_0xf1371a['params']['id'])?undefined:_0xf1371a['params']['id'],'path':_['isNil'](_0xf1371a[_0xbb10('0x5c')][_0xbb10('0xa6')][0x0]['path'])?undefined:_0xf1371a[_0xbb10('0x5c')][_0xbb10('0xa6')][0x0][_0xbb10('0x7')],'fax':_['isNil'](_0xf1371a[_0xbb10('0x5c')]['to'][0x0])?undefined:_0xf1371a[_0xbb10('0x5c')]['to'][0x0]},client9002);})[_0xbb10('0x22')](function(){if(_0x18cda3){if(_['isNil'](_0xf1371a[_0xbb10('0x5c')]['from'])){_0xf1371a[_0xbb10('0x5c')]['from']=util['format']('\x22%s\x22\x20<%s>',_0x18cda3['name'],_0x18cda3['fax']);}if(_0x18cda3['List']){if(_0x18cda3[_0xbb10('0xa3')][_0xbb10('0xac')][_0xbb10('0x4a')]){return _0x18cda3[_0xbb10('0xa3')]['Contacts'][0x0];}else{return db[_0xbb10('0x74')][_0xbb10('0x5b')](_[_0xbb10('0x19')](_0xf1371a[_0xbb10('0x5c')],{'firstName':_0xf1371a[_0xbb10('0x5c')]['to'][0x0],'phone':_0xf1371a[_0xbb10('0x5c')]['to'][0x0],'fax':_0xf1371a[_0xbb10('0x5c')]['to'][0x0],'ListId':_0x18cda3[_0xbb10('0x9b')]}));}}else{throw new Error(_0xbb10('0xad'));}}else{throw new Error(_0xbb10('0xae'));}})['then'](function(_0x1e4ed3){if(_0x1e4ed3){return db[_0xbb10('0x70')][_0xbb10('0x5a')]({'where':{'ContactId':_0x1e4ed3['id'],'closed':![],'FaxAccountId':_0x18cda3['id']}})['then'](function(_0x873cc9){if(_0x873cc9){return[_0x873cc9,![]];}return db[_0xbb10('0x70')][_0xbb10('0x5b')]({'UserId':_0xf1371a[_0xbb10('0x5d')]['id'],'ContactId':_0x1e4ed3['id'],'FaxAccountId':_0x18cda3['id'],'fax':_0xf1371a['body']['to'][0x0],'firstMsgDirection':_0xbb10('0xaf'),'Messages':[_[_0xbb10('0x4f')](_0xf1371a[_0xbb10('0x5c')],{'read':![],'body':_0xf1371a[_0xbb10('0x5c')][_0xbb10('0xa6')][0x0][_0xbb10('0xb0')],'FaxAccountId':_0x18cda3['id'],'UserId':_0xf1371a[_0xbb10('0x5d')]['id'],'ContactId':_0x1e4ed3['id'],'AttachmentId':_0xf1371a[_0xbb10('0x5c')][_0xbb10('0xa6')][0x0]['id']})]},{'include':[{'model':db[_0xbb10('0x9d')],'as':_0xbb10('0xb1')}]})['then'](function(_0x59d917){return[_0x59d917,!![]];});});}else{throw new Error(_0xbb10('0xb2'));}})['spread'](function(_0x5eb1fb,_0x8c5e76){if(_0x8c5e76){return _0x5eb1fb;}return db[_0xbb10('0x9d')]['create']({'direction':_0xbb10('0xaf'),'read':![],'body':_0xf1371a[_0xbb10('0x5c')]['attachments'][0x0][_0xbb10('0xb0')],'FaxAccountId':_0x18cda3['id'],'FaxInteractionId':_0x5eb1fb['id'],'UserId':_0xf1371a[_0xbb10('0x5d')]['id'],'ContactId':_0x5eb1fb[_0xbb10('0xb3')],'AttachmentId':_0xf1371a[_0xbb10('0x5c')][_0xbb10('0xa6')][0x0]['id']})['then'](function(_0x4fc260){_0x5eb1fb['dataValues'][_0xbb10('0xb1')]=[];_0x5eb1fb['dataValues'][_0xbb10('0xb1')]['push'](_0x4fc260['dataValues']);return _0x5eb1fb;});})[_0xbb10('0x22')](function(_0x43168d){respondWithRpcPromise(_0xbb10('0xb4'),_0xbb10('0xb4'),{'FaxAccountId':_[_0xbb10('0xab')](_0xf1371a[_0xbb10('0x58')]['id'])?undefined:_0xf1371a['params']['id'],'path':_['isNil'](_0xf1371a['body'][_0xbb10('0xa6')][0x0][_0xbb10('0x7')])?undefined:_0xf1371a[_0xbb10('0x5c')][_0xbb10('0xa6')][0x0][_0xbb10('0x7')],'fax':_[_0xbb10('0xab')](_0xf1371a[_0xbb10('0x5c')]['to'][0x0])?undefined:_0xf1371a['body']['to'][0x0],'AttachmentId':_0xf1371a[_0xbb10('0x5c')][_0xbb10('0xa6')][0x0]['id']},client9002)[_0xbb10('0x22')](function(_0x84a51c){logger['info'](_0xbb10('0xb5'),_0x84a51c);})['catch'](function(_0x4fc743){logger[_0xbb10('0x23')](_0xbb10('0xb5'),_0x4fc743);});return _0x43168d;})[_0xbb10('0x22')](respondWithResult(_0x3706b5,null))[_0xbb10('0x2c')](handleError(_0x3706b5,null));};exports[_0xbb10('0xb6')]=function(_0x422774,_0x4b7bf8,_0x39fdd3){return db[_0xbb10('0x52')][_0xbb10('0x5a')]({'where':{'id':_0x422774[_0xbb10('0x58')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x4b7bf8,null))[_0xbb10('0x22')](function(_0x19a629){if(_0x19a629){return _0x19a629['addAgents'](_0x422774[_0xbb10('0x5c')][_0xbb10('0x6a')],_[_0xbb10('0x71')](_0x422774['body'],['ids','id'])||{})[_0xbb10('0xb7')](function(_0xf07094){for(var _0x3b007e=0x0;_0x3b007e<_0x422774[_0xbb10('0x5c')][_0xbb10('0x6a')][_0xbb10('0x4a')];_0x3b007e+=0x1){socket[_0xbb10('0xb8')]('userFaxAccount:save',{'UserId':_0x422774[_0xbb10('0x5c')][_0xbb10('0x6a')][_0x3b007e],'FaxAccountId':_0x422774[_0xbb10('0x58')]['id']});}return _0xf07094;});}})['then'](respondWithResult(_0x4b7bf8,null))['catch'](handleError(_0x4b7bf8,null));};exports['removeAgents']=function(_0x4a01cd,_0x2f73e0,_0x3479ef){return db[_0xbb10('0x52')][_0xbb10('0x5a')]({'where':{'id':_0x4a01cd['params']['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x2f73e0,null))['then'](function(_0x1f071e){if(_0x1f071e){return _0x1f071e[_0xbb10('0xb9')](_0x4a01cd[_0xbb10('0x44')][_0xbb10('0x6a')])[_0xbb10('0x22')](function(){if(_[_0xbb10('0xba')](_0x4a01cd[_0xbb10('0x44')][_0xbb10('0x6a')])){for(var _0x243dc2=0x0;_0x243dc2<_0x4a01cd[_0xbb10('0x44')][_0xbb10('0x6a')][_0xbb10('0x4a')];_0x243dc2+=0x1){socket['emit'](_0xbb10('0xbb'),{'UserId':Number(_0x4a01cd[_0xbb10('0x44')][_0xbb10('0x6a')][_0x243dc2]),'FaxAccountId':Number(_0x4a01cd['params']['id'])});}}else{socket[_0xbb10('0xb8')]('userFaxAccount:remove',{'UserId':Number(_0x4a01cd[_0xbb10('0x44')][_0xbb10('0x6a')]),'FaxAccountId':Number(_0x4a01cd[_0xbb10('0x58')]['id'])});}});}})[_0xbb10('0x22')](respondWithStatusCode(_0x2f73e0,null))[_0xbb10('0x2c')](handleError(_0x2f73e0,null));};exports['getAgents']=function(_0x5345df,_0x842d94,_0x4cf5cc){var _0x553bb8={};var _0x2ff72a={};var _0x5621b1;var _0xa9ed32;return db[_0xbb10('0x52')][_0xbb10('0x67')]({'where':{'id':_0x5345df[_0xbb10('0x58')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x842d94,null))[_0xbb10('0x22')](function(_0x3a0940){if(_0x3a0940){_0x5621b1=_0x3a0940;_0x2ff72a[_0xbb10('0x43')]=_['keys'](db[_0xbb10('0x76')]['rawAttributes']);_0x2ff72a[_0xbb10('0x44')]=_['keys'](_0x5345df[_0xbb10('0x44')]);_0x2ff72a[_0xbb10('0x46')]=_['intersection'](_0x2ff72a[_0xbb10('0x43')],_0x2ff72a[_0xbb10('0x44')]);_0x553bb8[_0xbb10('0x48')]=_['intersection'](_0x2ff72a[_0xbb10('0x43')],qs[_0xbb10('0x49')](_0x5345df[_0xbb10('0x44')]['fields']));_0x553bb8[_0xbb10('0x48')]=_0x553bb8[_0xbb10('0x48')][_0xbb10('0x4a')]?_0x553bb8['attributes']:_0x2ff72a[_0xbb10('0x43')];_0x553bb8['order']=qs[_0xbb10('0x4b')](_0x5345df[_0xbb10('0x44')][_0xbb10('0x4b')]);_0x553bb8[_0xbb10('0x4c')]=qs[_0xbb10('0x46')](_[_0xbb10('0x4d')](_0x5345df[_0xbb10('0x44')],_0x2ff72a[_0xbb10('0x46')]));if(_0x5345df[_0xbb10('0x44')][_0xbb10('0x4e')]){_0x553bb8['where']=_['merge'](_0x553bb8[_0xbb10('0x4c')],{'$or':_[_0xbb10('0x3f')](_0x553bb8[_0xbb10('0x48')],function(_0x50ea2a){var _0x3d5870={};_0x3d5870[_0x50ea2a]={'$like':'%'+_0x5345df[_0xbb10('0x44')][_0xbb10('0x4e')]+'%'};return _0x3d5870;})});}_0x553bb8=_[_0xbb10('0x4f')]({},_0x553bb8,_0x5345df[_0xbb10('0x51')]);return _0x5621b1[_0xbb10('0xbc')](_0x553bb8);}})[_0xbb10('0x22')](function(_0x2035e1){if(_0x2035e1){_0xa9ed32=_0x2035e1[_0xbb10('0x4a')];if(!_0x5345df['query'][_0xbb10('0x6d')](_0xbb10('0x73'))){_0x553bb8[_0xbb10('0x31')]=qs[_0xbb10('0x31')](_0x5345df['query'][_0xbb10('0x31')]);_0x553bb8[_0xbb10('0x30')]=qs[_0xbb10('0x30')](_0x5345df['query']['offset']);}return _0x5621b1[_0xbb10('0xbc')](_0x553bb8);}})['then'](function(_0x37c688){if(_0x37c688){return _0x37c688?{'count':_0xa9ed32,'rows':_0x37c688}:null;}})['then'](respondWithResult(_0x842d94,null))[_0xbb10('0x2c')](handleError(_0x842d94,null));}; \ No newline at end of file +var _0x5f2f=['order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','show','params','include','find','create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Pause','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','FaxInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','FaxApplication','bulkCreate','getApplications','context','from-voip-provider','exten','app','description','Fax\x20Extension','priority','appdata','push','Answer','Set','ecm','gateway','faxdetect','maxrate','minrate','t38timeout','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','VoiceExtension','updateAccountApplications','tech','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','Send\x20Fax\x20failed','Contact\x20not\x20found','spread','out','filename','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','userFaxAccount:remove','User','getAgents','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','redis','defaults','localhost','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','status','json','count','offset','limit','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','map','FaxAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x2436ad,_0x23e462){var _0x53a54a=function(_0x196d58){while(--_0x196d58){_0x2436ad['push'](_0x2436ad['shift']());}};_0x53a54a(++_0x23e462);}(_0x5f2f,0x73));var _0xf5f2=function(_0x47e772,_0x56873b){_0x47e772=_0x47e772-0x0;var _0x13678a=_0x5f2f[_0x47e772];return _0x13678a;};'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'];config[_0xf5f2('0x18')]=_[_0xf5f2('0x19')](config[_0xf5f2('0x18')],{'host':_0xf5f2('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf5f2('0x18')]));require(_0xf5f2('0x1b'))[_0xf5f2('0x1c')](socket);var jayson=require(_0xf5f2('0x1d'));var client=jayson[_0xf5f2('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xf5f2('0x1e')][_0xf5f2('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x17d656,_0x1b6dd2,_0x23e23a,_0x3a9dbb){return new BPromise(function(_0xdb61b3,_0x395a5a){var _0x11f702=_0x3a9dbb||client;return _0x11f702[_0xf5f2('0x20')](_0x17d656,_0x23e23a)[_0xf5f2('0x21')](function(_0x28e097){logger[_0xf5f2('0x22')](_0xf5f2('0x23'),_0x1b6dd2,_0xf5f2('0x24'));logger[_0xf5f2('0x25')](_0xf5f2('0x26'),_0x1b6dd2,'request\x20sent',JSON[_0xf5f2('0x27')](_0x28e097));if(_0x28e097[_0xf5f2('0x28')]){if(_0x28e097['error']['code']===0x1f4){logger[_0xf5f2('0x28')](_0xf5f2('0x23'),_0x1b6dd2,_0x28e097['error'][_0xf5f2('0x29')]);return _0x395a5a(_0x28e097[_0xf5f2('0x28')][_0xf5f2('0x29')]);}logger[_0xf5f2('0x28')](_0xf5f2('0x23'),_0x1b6dd2,_0x28e097['error'][_0xf5f2('0x29')]);return _0xdb61b3(_0x28e097[_0xf5f2('0x28')][_0xf5f2('0x29')]);}else{logger[_0xf5f2('0x22')](_0xf5f2('0x23'),_0x1b6dd2,'request\x20sent');_0xdb61b3(_0x28e097['result'][_0xf5f2('0x29')]);}})[_0xf5f2('0x2a')](function(_0x13da6f){logger[_0xf5f2('0x28')](_0xf5f2('0x23'),_0x1b6dd2,_0x13da6f);_0x395a5a(_0x13da6f);});});}function respondWithStatusCode(_0x788a8d,_0x13a3be){_0x13a3be=_0x13a3be||0xcc;return function(_0x281ec8){if(_0x281ec8){return _0x788a8d[_0xf5f2('0x2b')](_0x13a3be);}return _0x788a8d['status'](_0x13a3be)[_0xf5f2('0x2c')]();};}function respondWithResult(_0x102449,_0x375ca8){_0x375ca8=_0x375ca8||0xc8;return function(_0x31bfcb){if(_0x31bfcb){return _0x102449[_0xf5f2('0x2d')](_0x375ca8)[_0xf5f2('0x2e')](_0x31bfcb);}};}function respondWithFilteredResult(_0x5b6672,_0x53cb96){return function(_0x22c826){if(_0x22c826){var _0x14c829=_0x22c826[_0xf5f2('0x2f')],_0x11c771=_0x53cb96[_0xf5f2('0x30')],_0x5027ab=_0x53cb96[_0xf5f2('0x30')]+_0x53cb96[_0xf5f2('0x31')],_0x5a2c7e;if(_0x5027ab>=_0x14c829){_0x5027ab=_0x14c829;_0x5a2c7e=0xc8;}else{_0x5a2c7e=0xce;}_0x5b6672[_0xf5f2('0x2d')](_0x5a2c7e);return _0x5b6672['set']('Content-Range',_0x11c771+'-'+_0x5027ab+'/'+_0x14c829)[_0xf5f2('0x2e')](_0x22c826);}return null;};}function patchUpdates(_0x4e19cb){return function(_0xb744b9){try{jsonpatch['apply'](_0xb744b9,_0x4e19cb,!![]);}catch(_0x45b643){return BPromise[_0xf5f2('0x32')](_0x45b643);}return _0xb744b9[_0xf5f2('0x33')]();};}function saveUpdates(_0x428770,_0x256bd9){return function(_0x277eee){if(_0x277eee){return _0x277eee[_0xf5f2('0x34')](_0x428770)[_0xf5f2('0x21')](function(_0x5ca917){return _0x5ca917;});}return null;};}function removeEntity(_0x4149e6,_0x43e4ff){return function(_0x4590ec){if(_0x4590ec){return _0x4590ec[_0xf5f2('0x35')]()[_0xf5f2('0x21')](function(){var _0x27c0e7=_0x4590ec[_0xf5f2('0x36')]({'plain':!![]});var _0x48d64d=_0xf5f2('0x37');return db[_0xf5f2('0x38')]['destroy']({'where':{'type':_0x48d64d,'resourceId':_0x27c0e7['id']}})[_0xf5f2('0x21')](function(){return _0x4590ec;});})['then'](function(){_0x4149e6[_0xf5f2('0x2d')](0xcc)[_0xf5f2('0x2c')]();});}};}function handleEntityNotFound(_0x2a2c31,_0x2e3cca){return function(_0x59a6dd){if(!_0x59a6dd){_0x2a2c31['sendStatus'](0x194);}return _0x59a6dd;};}function handleError(_0x41088b,_0x46ad4a){_0x46ad4a=_0x46ad4a||0x1f4;return function(_0x20eb74){logger['error'](_0x20eb74[_0xf5f2('0x39')]);if(_0x20eb74['name']){delete _0x20eb74[_0xf5f2('0x3a')];}_0x41088b['status'](_0x46ad4a)[_0xf5f2('0x3b')](_0x20eb74);};}exports[_0xf5f2('0x3c')]=function(_0x5337a6,_0x29694f){var _0x46eb22={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5a4441={},_0x35f738={'count':0x0,'rows':[]};var _0x3d328f=_[_0xf5f2('0x3d')](db[_0xf5f2('0x3e')][_0xf5f2('0x3f')],function(_0x2c7f65){return{'name':_0x2c7f65[_0xf5f2('0x40')],'type':_0x2c7f65[_0xf5f2('0x41')]['key']};});_0x5a4441[_0xf5f2('0x42')]=_[_0xf5f2('0x3d')](_0x3d328f,'name');_0x5a4441[_0xf5f2('0x43')]=_[_0xf5f2('0x44')](_0x5337a6[_0xf5f2('0x43')]);_0x5a4441[_0xf5f2('0x45')]=_[_0xf5f2('0x46')](_0x5a4441[_0xf5f2('0x42')],_0x5a4441[_0xf5f2('0x43')]);_0x46eb22[_0xf5f2('0x47')]=_['intersection'](_0x5a4441[_0xf5f2('0x42')],qs[_0xf5f2('0x48')](_0x5337a6[_0xf5f2('0x43')]['fields']));_0x46eb22['attributes']=_0x46eb22['attributes'][_0xf5f2('0x49')]?_0x46eb22[_0xf5f2('0x47')]:_0x5a4441['model'];if(!_0x5337a6[_0xf5f2('0x43')][_0xf5f2('0x4a')](_0xf5f2('0x4b'))){_0x46eb22[_0xf5f2('0x31')]=qs[_0xf5f2('0x31')](_0x5337a6[_0xf5f2('0x43')][_0xf5f2('0x31')]);_0x46eb22[_0xf5f2('0x30')]=qs[_0xf5f2('0x30')](_0x5337a6[_0xf5f2('0x43')][_0xf5f2('0x30')]);}_0x46eb22[_0xf5f2('0x4c')]=qs[_0xf5f2('0x4d')](_0x5337a6[_0xf5f2('0x43')]['sort']);_0x46eb22[_0xf5f2('0x4e')]=qs['filters'](_[_0xf5f2('0x4f')](_0x5337a6[_0xf5f2('0x43')],_0x5a4441[_0xf5f2('0x45')]),_0x3d328f);if(_0x5337a6[_0xf5f2('0x43')][_0xf5f2('0x50')]){_0x46eb22[_0xf5f2('0x4e')]=_['merge'](_0x46eb22[_0xf5f2('0x4e')],{'$or':_[_0xf5f2('0x3d')](_0x3d328f,function(_0x1c1497){if(_0x1c1497[_0xf5f2('0x41')]!==_0xf5f2('0x51')){var _0x10753a={};_0x10753a[_0x1c1497[_0xf5f2('0x3a')]]={'$like':'%'+_0x5337a6[_0xf5f2('0x43')]['filter']+'%'};return _0x10753a;}})});}_0x46eb22=_[_0xf5f2('0x52')]({},_0x46eb22,_0x5337a6[_0xf5f2('0x53')]);var _0x45db9a={'where':_0x46eb22['where']};return db[_0xf5f2('0x3e')][_0xf5f2('0x2f')](_0x45db9a)[_0xf5f2('0x21')](function(_0x5e761c){_0x35f738['count']=_0x5e761c;if(_0x5337a6[_0xf5f2('0x43')][_0xf5f2('0x54')]){_0x46eb22['include']=[{'all':!![]}];}return db[_0xf5f2('0x3e')]['findAll'](_0x46eb22);})[_0xf5f2('0x21')](function(_0x497eb8){_0x35f738[_0xf5f2('0x55')]=_0x497eb8;return _0x35f738;})['then'](respondWithFilteredResult(_0x29694f,_0x46eb22))[_0xf5f2('0x2a')](handleError(_0x29694f,null));};exports[_0xf5f2('0x56')]=function(_0xbb658c,_0x11a083){var _0x4fa738={'raw':![],'where':{'id':_0xbb658c[_0xf5f2('0x57')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3154c1={};_0x3154c1[_0xf5f2('0x42')]=_[_0xf5f2('0x44')](db['FaxAccount'][_0xf5f2('0x3f')]);_0x3154c1[_0xf5f2('0x43')]=_[_0xf5f2('0x44')](_0xbb658c[_0xf5f2('0x43')]);_0x3154c1['filters']=_['intersection'](_0x3154c1[_0xf5f2('0x42')],_0x3154c1[_0xf5f2('0x43')]);_0x4fa738['attributes']=_[_0xf5f2('0x46')](_0x3154c1[_0xf5f2('0x42')],qs[_0xf5f2('0x48')](_0xbb658c[_0xf5f2('0x43')][_0xf5f2('0x48')]));_0x4fa738[_0xf5f2('0x47')]=_0x4fa738[_0xf5f2('0x47')]['length']?_0x4fa738['attributes']:_0x3154c1[_0xf5f2('0x42')];if(_0xbb658c[_0xf5f2('0x43')][_0xf5f2('0x54')]){_0x4fa738[_0xf5f2('0x58')]=[{'all':!![]}];}_0x4fa738=_[_0xf5f2('0x52')]({},_0x4fa738,_0xbb658c['options']);return db[_0xf5f2('0x3e')][_0xf5f2('0x59')](_0x4fa738)[_0xf5f2('0x21')](handleEntityNotFound(_0x11a083,null))['then'](respondWithResult(_0x11a083,null))[_0xf5f2('0x2a')](handleError(_0x11a083,null));};exports['create']=function(_0x78f1d2,_0x1a8d33){return db[_0xf5f2('0x3e')][_0xf5f2('0x5a')](_0x78f1d2['body'],{})['then'](function(_0x756f1f){var _0x4de303=_0x78f1d2[_0xf5f2('0x5b')][_0xf5f2('0x36')]({'plain':!![]});if(!_0x4de303)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4de303[_0xf5f2('0x5c')]===_0xf5f2('0x5b')){var _0x2a8f6d=_0x756f1f['get']({'plain':!![]});var _0x397b99=_0xf5f2('0x37');return db[_0xf5f2('0x5d')][_0xf5f2('0x59')]({'where':{'name':_0x397b99,'userProfileId':_0x4de303['userProfileId']},'raw':!![]})[_0xf5f2('0x21')](function(_0x506fe5){if(_0x506fe5&&_0x506fe5[_0xf5f2('0x5e')]===0x0){return db[_0xf5f2('0x38')][_0xf5f2('0x5a')]({'name':_0x2a8f6d[_0xf5f2('0x3a')],'resourceId':_0x2a8f6d['id'],'type':_0x506fe5[_0xf5f2('0x3a')],'sectionId':_0x506fe5['id']},{})['then'](function(){return _0x756f1f;});}else{return _0x756f1f;}})[_0xf5f2('0x2a')](function(_0xacd80){logger[_0xf5f2('0x28')](_0xf5f2('0x5f'),_0xacd80);throw _0xacd80;});}return _0x756f1f;})[_0xf5f2('0x21')](respondWithResult(_0x1a8d33,0xc9))['catch'](handleError(_0x1a8d33,null));};exports[_0xf5f2('0x34')]=function(_0x5ee6bc,_0x4c96ee){if(_0x5ee6bc[_0xf5f2('0x60')]['id']){delete _0x5ee6bc['body']['id'];}return db[_0xf5f2('0x3e')][_0xf5f2('0x59')]({'where':{'id':_0x5ee6bc[_0xf5f2('0x57')]['id']},'include':[{'model':db[_0xf5f2('0x61')],'as':'mandatoryDispositionPause'}]})[_0xf5f2('0x21')](handleEntityNotFound(_0x4c96ee,null))[_0xf5f2('0x21')](saveUpdates(_0x5ee6bc[_0xf5f2('0x60')],null))[_0xf5f2('0x21')](respondWithResult(_0x4c96ee,null))[_0xf5f2('0x2a')](handleError(_0x4c96ee,null));};exports[_0xf5f2('0x35')]=function(_0x158768,_0x4a7be9){return db[_0xf5f2('0x3e')][_0xf5f2('0x59')]({'where':{'id':_0x158768[_0xf5f2('0x57')]['id']}})[_0xf5f2('0x21')](handleEntityNotFound(_0x4a7be9,null))['then'](removeEntity(_0x4a7be9,null))[_0xf5f2('0x2a')](handleError(_0x4a7be9,null));};exports['describe']=function(_0x410866,_0x1c7f06){return db['FaxAccount'][_0xf5f2('0x62')]()[_0xf5f2('0x21')](respondWithResult(_0x1c7f06,null))[_0xf5f2('0x2a')](handleError(_0x1c7f06,null));};exports[_0xf5f2('0x63')]=function(_0x146462,_0x4bd113,_0x3e821c){if(_0x146462[_0xf5f2('0x60')]['id']){delete _0x146462[_0xf5f2('0x60')]['id'];}return db[_0xf5f2('0x3e')][_0xf5f2('0x59')]({'where':{'id':_0x146462[_0xf5f2('0x57')]['id']}})['then'](handleEntityNotFound(_0x4bd113,null))[_0xf5f2('0x21')](function(_0x3f475e){if(_0x3f475e){_0x146462['body'][_0xf5f2('0x64')]=_0x3f475e['id'];return db[_0xf5f2('0x65')][_0xf5f2('0x5a')](_0x146462['body']);}})['then'](respondWithResult(_0x4bd113,null))['catch'](handleError(_0x4bd113,null));};exports[_0xf5f2('0x66')]=function(_0x35f3f6,_0x35f6a2,_0x450691){var _0x55da4d={'raw':![],'where':{}};var _0x4d878e={};var _0x278b76={'count':0x0,'rows':[]};return db[_0xf5f2('0x3e')][_0xf5f2('0x67')]({'where':{'id':_0x35f3f6[_0xf5f2('0x57')]['id']}})[_0xf5f2('0x21')](handleEntityNotFound(_0x35f6a2,null))[_0xf5f2('0x21')](function(_0x11c302){if(_0x11c302){_0x4d878e[_0xf5f2('0x42')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x65')][_0xf5f2('0x3f')]);_0x4d878e['query']=_['keys'](_0x35f3f6['query']);_0x4d878e[_0xf5f2('0x45')]=_[_0xf5f2('0x46')](_0x4d878e[_0xf5f2('0x42')],_0x4d878e[_0xf5f2('0x43')]);_0x55da4d[_0xf5f2('0x47')]=_['intersection'](_0x4d878e[_0xf5f2('0x42')],qs[_0xf5f2('0x48')](_0x35f3f6[_0xf5f2('0x43')][_0xf5f2('0x48')]));_0x55da4d[_0xf5f2('0x47')]=_0x55da4d['attributes'][_0xf5f2('0x49')]?_0x55da4d[_0xf5f2('0x47')]:_0x4d878e['model'];if(!_0x35f3f6[_0xf5f2('0x43')][_0xf5f2('0x4a')](_0xf5f2('0x4b'))){_0x55da4d[_0xf5f2('0x31')]=qs['limit'](_0x35f3f6[_0xf5f2('0x43')][_0xf5f2('0x31')]);_0x55da4d[_0xf5f2('0x30')]=qs[_0xf5f2('0x30')](_0x35f3f6[_0xf5f2('0x43')]['offset']);}_0x55da4d['order']=qs[_0xf5f2('0x4d')](_0x35f3f6[_0xf5f2('0x43')][_0xf5f2('0x4d')]);_0x55da4d[_0xf5f2('0x4e')]=qs['filters'](_['pick'](_0x35f3f6[_0xf5f2('0x43')],_0x4d878e['filters']));_0x55da4d['where']['FaxAccountId']=_0x11c302['id'];if(_0x35f3f6['query'][_0xf5f2('0x50')]){_0x55da4d[_0xf5f2('0x4e')]=_[_0xf5f2('0x52')](_0x55da4d[_0xf5f2('0x4e')],{'$or':_[_0xf5f2('0x3d')](_0x55da4d[_0xf5f2('0x47')],function(_0x164cc6){var _0x3341be={};_0x3341be[_0x164cc6]={'$like':'%'+_0x35f3f6[_0xf5f2('0x43')][_0xf5f2('0x50')]+'%'};return _0x3341be;})});}_0x55da4d=_[_0xf5f2('0x52')]({},_0x55da4d,_0x35f3f6[_0xf5f2('0x53')]);return db[_0xf5f2('0x65')][_0xf5f2('0x2f')]({'where':_0x55da4d[_0xf5f2('0x4e')]})[_0xf5f2('0x21')](function(_0x154a8b){_0x278b76[_0xf5f2('0x2f')]=_0x154a8b;if(_0x35f3f6['query'][_0xf5f2('0x54')]){_0x55da4d[_0xf5f2('0x58')]=[{'all':!![]}];}return db[_0xf5f2('0x65')][_0xf5f2('0x68')](_0x55da4d);})[_0xf5f2('0x21')](function(_0x308220){_0x278b76[_0xf5f2('0x55')]=_0x308220;return _0x278b76;});}})[_0xf5f2('0x21')](respondWithFilteredResult(_0x35f6a2,_0x55da4d))['catch'](handleError(_0x35f6a2,null));};exports[_0xf5f2('0x69')]=function(_0x57b50f,_0x4bc51a,_0x5bf3b9){return db['FaxAccount']['find']({'where':{'id':_0x57b50f['params']['id']}})[_0xf5f2('0x21')](handleEntityNotFound(_0x4bc51a,null))[_0xf5f2('0x21')](function(_0x26a57c){if(_0x26a57c){return _0x26a57c[_0xf5f2('0x69')](_0x57b50f[_0xf5f2('0x43')][_0xf5f2('0x6a')]);}})['then'](respondWithStatusCode(_0x4bc51a,null))['catch'](handleError(_0x4bc51a,null));};exports[_0xf5f2('0x6b')]=function(_0x578a22,_0x418ece,_0x186fdd){if(_0x578a22['body']['id']){delete _0x578a22['body']['id'];}return db[_0xf5f2('0x3e')][_0xf5f2('0x59')]({'where':{'id':_0x578a22['params']['id']}})[_0xf5f2('0x21')](handleEntityNotFound(_0x418ece,null))[_0xf5f2('0x21')](function(_0x49e363){if(_0x49e363){_0x578a22[_0xf5f2('0x60')][_0xf5f2('0x64')]=_0x49e363['id'];return db[_0xf5f2('0x6c')]['create'](_0x578a22[_0xf5f2('0x60')]);}})[_0xf5f2('0x21')](respondWithResult(_0x418ece,null))[_0xf5f2('0x2a')](handleError(_0x418ece,null));};exports[_0xf5f2('0x6d')]=function(_0x3e188e,_0x3e0288,_0x25974b){var _0x379053={'raw':![],'where':{}};var _0x25ec54={};var _0x3a6f60={'count':0x0,'rows':[]};return db[_0xf5f2('0x3e')][_0xf5f2('0x67')]({'where':{'id':_0x3e188e[_0xf5f2('0x57')]['id']}})[_0xf5f2('0x21')](handleEntityNotFound(_0x3e0288,null))[_0xf5f2('0x21')](function(_0x28b9cd){if(_0x28b9cd){_0x25ec54[_0xf5f2('0x42')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x6c')][_0xf5f2('0x3f')]);_0x25ec54[_0xf5f2('0x43')]=_['keys'](_0x3e188e[_0xf5f2('0x43')]);_0x25ec54[_0xf5f2('0x45')]=_['intersection'](_0x25ec54[_0xf5f2('0x42')],_0x25ec54[_0xf5f2('0x43')]);_0x379053['attributes']=_[_0xf5f2('0x46')](_0x25ec54[_0xf5f2('0x42')],qs[_0xf5f2('0x48')](_0x3e188e['query']['fields']));_0x379053[_0xf5f2('0x47')]=_0x379053[_0xf5f2('0x47')][_0xf5f2('0x49')]?_0x379053['attributes']:_0x25ec54['model'];if(!_0x3e188e[_0xf5f2('0x43')][_0xf5f2('0x4a')](_0xf5f2('0x4b'))){_0x379053['limit']=qs['limit'](_0x3e188e['query']['limit']);_0x379053['offset']=qs[_0xf5f2('0x30')](_0x3e188e['query'][_0xf5f2('0x30')]);}_0x379053[_0xf5f2('0x4c')]=qs[_0xf5f2('0x4d')](_0x3e188e[_0xf5f2('0x43')][_0xf5f2('0x4d')]);_0x379053[_0xf5f2('0x4e')]=qs[_0xf5f2('0x45')](_[_0xf5f2('0x4f')](_0x3e188e[_0xf5f2('0x43')],_0x25ec54[_0xf5f2('0x45')]));_0x379053[_0xf5f2('0x4e')][_0xf5f2('0x64')]=_0x28b9cd['id'];if(_0x3e188e[_0xf5f2('0x43')]['filter']){_0x379053[_0xf5f2('0x4e')]=_[_0xf5f2('0x52')](_0x379053['where'],{'$or':_[_0xf5f2('0x3d')](_0x379053[_0xf5f2('0x47')],function(_0x537a7d){var _0x433ba0={};_0x433ba0[_0x537a7d]={'$like':'%'+_0x3e188e[_0xf5f2('0x43')][_0xf5f2('0x50')]+'%'};return _0x433ba0;})});}_0x379053=_['merge']({},_0x379053,_0x3e188e[_0xf5f2('0x53')]);return db[_0xf5f2('0x6c')]['count']({'where':_0x379053[_0xf5f2('0x4e')]})[_0xf5f2('0x21')](function(_0x41bf8c){_0x3a6f60['count']=_0x41bf8c;if(_0x3e188e[_0xf5f2('0x43')]['includeAll']){_0x379053[_0xf5f2('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf5f2('0x68')](_0x379053);})[_0xf5f2('0x21')](function(_0x120e2b){_0x3a6f60[_0xf5f2('0x55')]=_0x120e2b;return _0x3a6f60;});}})['then'](respondWithFilteredResult(_0x3e0288,_0x379053))[_0xf5f2('0x2a')](handleError(_0x3e0288,null));};exports['removeAnswers']=function(_0x52e037,_0x4b4d7f,_0x2a253a){return db[_0xf5f2('0x3e')]['find']({'where':{'id':_0x52e037[_0xf5f2('0x57')]['id']}})[_0xf5f2('0x21')](handleEntityNotFound(_0x4b4d7f,null))[_0xf5f2('0x21')](function(_0x3962b2){if(_0x3962b2){return _0x3962b2[_0xf5f2('0x6e')](_0x52e037[_0xf5f2('0x43')]['ids']);}})[_0xf5f2('0x21')](respondWithStatusCode(_0x4b4d7f,null))[_0xf5f2('0x2a')](handleError(_0x4b4d7f,null));};exports['addInteraction']=function(_0x22865e,_0x19cbff,_0x58042c){return db[_0xf5f2('0x6f')][_0xf5f2('0x59')]({'where':{'id':_0x22865e[_0xf5f2('0x57')]['id']}})[_0xf5f2('0x21')](handleEntityNotFound(_0x19cbff,null))[_0xf5f2('0x21')](function(_0x28dd0c){if(_0x28dd0c){return _0x28dd0c['addInteraction'](_0x22865e[_0xf5f2('0x60')][_0xf5f2('0x6a')],_[_0xf5f2('0x70')](_0x22865e[_0xf5f2('0x60')],[_0xf5f2('0x6a'),'id'])||{});}})[_0xf5f2('0x21')](respondWithResult(_0x19cbff,null))[_0xf5f2('0x2a')](handleError(_0x19cbff,null));};exports[_0xf5f2('0x71')]=function(_0x3e4e40,_0x5cabb2,_0x35408a){var _0x3d3b9b={'raw':![],'where':{}};var _0xdbb2cd={};var _0x934a7d={'count':0x0,'rows':[]};return db[_0xf5f2('0x3e')][_0xf5f2('0x67')]({'where':{'id':_0x3e4e40[_0xf5f2('0x57')]['id']}})[_0xf5f2('0x21')](handleEntityNotFound(_0x5cabb2,null))[_0xf5f2('0x21')](function(_0x40d0eb){if(_0x40d0eb){_0xdbb2cd['model']=_['keys'](db[_0xf5f2('0x6f')][_0xf5f2('0x3f')]);_0xdbb2cd[_0xf5f2('0x43')]=_[_0xf5f2('0x44')](_0x3e4e40['query']);_0xdbb2cd[_0xf5f2('0x45')]=_[_0xf5f2('0x46')](_0xdbb2cd[_0xf5f2('0x42')],_0xdbb2cd[_0xf5f2('0x43')]);_0x3d3b9b[_0xf5f2('0x47')]=_['intersection'](_0xdbb2cd[_0xf5f2('0x42')],qs[_0xf5f2('0x48')](_0x3e4e40['query'][_0xf5f2('0x48')]));_0x3d3b9b[_0xf5f2('0x47')]=_0x3d3b9b[_0xf5f2('0x47')][_0xf5f2('0x49')]?_0x3d3b9b['attributes']:_0xdbb2cd[_0xf5f2('0x42')];if(!_0x3e4e40[_0xf5f2('0x43')][_0xf5f2('0x4a')]('nolimit')){_0x3d3b9b['limit']=qs[_0xf5f2('0x31')](_0x3e4e40[_0xf5f2('0x43')][_0xf5f2('0x31')]);_0x3d3b9b[_0xf5f2('0x30')]=qs[_0xf5f2('0x30')](_0x3e4e40[_0xf5f2('0x43')]['offset']);}_0x3d3b9b[_0xf5f2('0x4c')]=qs['sort'](_0x3e4e40[_0xf5f2('0x43')][_0xf5f2('0x4d')]);_0x3d3b9b[_0xf5f2('0x4e')]=qs[_0xf5f2('0x45')](_[_0xf5f2('0x4f')](_0x3e4e40[_0xf5f2('0x43')],_0xdbb2cd['filters']));_0x3d3b9b[_0xf5f2('0x4e')][_0xf5f2('0x64')]=_0x40d0eb['id'];if(_0x3e4e40[_0xf5f2('0x43')][_0xf5f2('0x50')]){_0x3d3b9b[_0xf5f2('0x4e')]=_[_0xf5f2('0x52')](_0x3d3b9b[_0xf5f2('0x4e')],{'$or':_['map'](_0x3d3b9b[_0xf5f2('0x47')],function(_0x4a6b83){var _0x5857d1={};_0x5857d1[_0x4a6b83]={'$like':'%'+_0x3e4e40['query'][_0xf5f2('0x50')]+'%'};return _0x5857d1;})});}_0x3d3b9b=_[_0xf5f2('0x52')]({},_0x3d3b9b,_0x3e4e40['options']);return db[_0xf5f2('0x6f')][_0xf5f2('0x2f')]({'where':_0x3d3b9b[_0xf5f2('0x4e')]})[_0xf5f2('0x21')](function(_0x4f2704){_0x934a7d[_0xf5f2('0x2f')]=_0x4f2704;if(_0x3e4e40[_0xf5f2('0x43')][_0xf5f2('0x54')]){_0x3d3b9b['include']=[{'model':db[_0xf5f2('0x72')],'as':_0xf5f2('0x73'),'required':![]},{'model':db['User'],'as':_0xf5f2('0x74'),'attributes':[_0xf5f2('0x3a'),_0xf5f2('0x75'),_0xf5f2('0x76')],'required':![]},{'model':db[_0xf5f2('0x77')],'as':_0xf5f2('0x78'),'attributes':['id',_0xf5f2('0x3a'),_0xf5f2('0x79')],'where':_0x3e4e40[_0xf5f2('0x43')][_0xf5f2('0x7a')]?{'id':_0x3e4e40[_0xf5f2('0x43')]['tag']}:undefined,'required':_0x3e4e40[_0xf5f2('0x43')][_0xf5f2('0x7a')]?!![]:![]}];}return db['FaxInteraction'][_0xf5f2('0x68')](_0x3d3b9b);})['then'](function(_0x3b2620){_0x934a7d[_0xf5f2('0x55')]=_0x3b2620;return _0x934a7d;});}})[_0xf5f2('0x21')](respondWithFilteredResult(_0x5cabb2,_0x3d3b9b))[_0xf5f2('0x2a')](handleError(_0x5cabb2,null));};exports['addApplications']=function(_0x451711,_0x5a104b,_0x55da48){return db['FaxAccount'][_0xf5f2('0x67')]({'where':{'id':_0x451711[_0xf5f2('0x57')]['id']}})['then'](handleEntityNotFound(_0x5a104b,null))[_0xf5f2('0x21')](function(_0x4525c9){if(_0x4525c9){return db[_0xf5f2('0x7b')][_0xf5f2('0x7c')](function(_0x344e90){return db[_0xf5f2('0x7d')]['destroy']({'where':{'FaxAccountId':_0x451711['params']['id']},'transaction':_0x344e90})[_0xf5f2('0x21')](function(_0x17e1eb){var _0x5dc5da=_[_0xf5f2('0x3d')](_0x451711[_0xf5f2('0x60')],function(_0xce8b64){_0xce8b64[_0xf5f2('0x64')]=_0x451711[_0xf5f2('0x57')]['id'];return _0xce8b64;});return db[_0xf5f2('0x7d')][_0xf5f2('0x7e')](_0x5dc5da,{'transaction':_0x344e90});});})['then'](function(){return db[_0xf5f2('0x7d')]['findAndCountAll']({'where':{'FaxAccountId':_0x451711[_0xf5f2('0x57')]['id']},'order':'priority'});});}})[_0xf5f2('0x21')](respondWithResult(_0x5a104b,null))['catch'](handleError(_0x5a104b,null));};exports[_0xf5f2('0x7f')]=function(_0x4d4b02,_0x51fd11,_0x2c285c){var _0x2cfb98={};var _0x57708f={};var _0x38cb63;var _0x3ebd59;return db[_0xf5f2('0x3e')][_0xf5f2('0x67')]({'where':{'id':_0x4d4b02[_0xf5f2('0x57')]['id']}})[_0xf5f2('0x21')](handleEntityNotFound(_0x51fd11,null))[_0xf5f2('0x21')](function(_0x128f37){if(_0x128f37){_0x38cb63=_0x128f37;_0x57708f['model']=_['keys'](db[_0xf5f2('0x7d')]['rawAttributes']);_0x57708f[_0xf5f2('0x43')]=_[_0xf5f2('0x44')](_0x4d4b02[_0xf5f2('0x43')]);_0x57708f[_0xf5f2('0x45')]=_[_0xf5f2('0x46')](_0x57708f[_0xf5f2('0x42')],_0x57708f[_0xf5f2('0x43')]);_0x2cfb98[_0xf5f2('0x47')]=_[_0xf5f2('0x46')](_0x57708f[_0xf5f2('0x42')],qs[_0xf5f2('0x48')](_0x4d4b02[_0xf5f2('0x43')]['fields']));_0x2cfb98[_0xf5f2('0x47')]=_0x2cfb98['attributes'][_0xf5f2('0x49')]?_0x2cfb98[_0xf5f2('0x47')]:_0x57708f[_0xf5f2('0x42')];_0x2cfb98[_0xf5f2('0x4c')]=qs[_0xf5f2('0x4d')](_0x4d4b02[_0xf5f2('0x43')][_0xf5f2('0x4d')]);_0x2cfb98[_0xf5f2('0x4e')]=qs[_0xf5f2('0x45')](_[_0xf5f2('0x4f')](_0x4d4b02[_0xf5f2('0x43')],_0x57708f['filters']));if(_0x4d4b02[_0xf5f2('0x43')][_0xf5f2('0x50')]){_0x2cfb98[_0xf5f2('0x4e')]=_[_0xf5f2('0x52')](_0x2cfb98[_0xf5f2('0x4e')],{'$or':_[_0xf5f2('0x3d')](_0x2cfb98[_0xf5f2('0x47')],function(_0x55c37e){var _0x179995={};_0x179995[_0x55c37e]={'$like':'%'+_0x4d4b02[_0xf5f2('0x43')][_0xf5f2('0x50')]+'%'};return _0x179995;})});}_0x2cfb98=_[_0xf5f2('0x52')]({},_0x2cfb98,_0x4d4b02[_0xf5f2('0x53')]);return _0x38cb63[_0xf5f2('0x7f')](_0x2cfb98);}})[_0xf5f2('0x21')](function(_0x1167e2){if(_0x1167e2){_0x3ebd59=_0x1167e2[_0xf5f2('0x49')];if(!_0x4d4b02[_0xf5f2('0x43')][_0xf5f2('0x4a')](_0xf5f2('0x4b'))){_0x2cfb98[_0xf5f2('0x31')]=qs[_0xf5f2('0x31')](_0x4d4b02[_0xf5f2('0x43')][_0xf5f2('0x31')]);_0x2cfb98['offset']=qs[_0xf5f2('0x30')](_0x4d4b02[_0xf5f2('0x43')]['offset']);}return _0x38cb63['getApplications'](_0x2cfb98);}})[_0xf5f2('0x21')](function(_0x22a3dc){if(_0x22a3dc){return _0x22a3dc?{'count':_0x3ebd59,'rows':_0x22a3dc}:null;}})[_0xf5f2('0x21')](respondWithResult(_0x51fd11,null))[_0xf5f2('0x2a')](handleError(_0x51fd11,null));};function Extension(_0x529d6f,_0x28cc,_0x4b2082,_0x2e3189){this[_0xf5f2('0x80')]=_0xf5f2('0x81');this[_0xf5f2('0x82')]=_0x529d6f['localstationid'];this[_0xf5f2('0x83')]=_0x2e3189;this['type']='system';this[_0xf5f2('0x84')]=_0xf5f2('0x85');this[_0xf5f2('0x64')]=_0x529d6f['id'];this[_0xf5f2('0x86')]=_0x28cc;this[_0xf5f2('0x87')]=_0x4b2082;}function createExtensionsReciveFax(_0x2643dc){var _0xc3dfad=0x1;var _0x591f92=[];_0x591f92[_0xf5f2('0x88')](new Extension(_0x2643dc,_0xc3dfad,'',_0xf5f2('0x89')));_0xc3dfad+=0x1;_0x591f92[_0xf5f2('0x88')](new Extension(_0x2643dc,_0xc3dfad,'CDR(type)=inbound-fax',_0xf5f2('0x8a')));_0xc3dfad+=0x1;for(var _0x50e119 in _0x2643dc){if(_0x2643dc['hasOwnProperty'](_0x50e119)&&(_0x50e119===_0xf5f2('0x8b')||_0x50e119==='localstationid'||_0x50e119===_0xf5f2('0x8c')||_0x50e119===_0xf5f2('0x8d')||_0x50e119==='headerinfo'||_0x50e119===_0xf5f2('0x8e')||_0x50e119===_0xf5f2('0x8f')||_0x50e119==='modem'||_0x50e119===_0xf5f2('0x90'))){_0x591f92[_0xf5f2('0x88')](new Extension(_0x2643dc,_0xc3dfad,_0xf5f2('0x91')+_0x50e119+')='+_0x2643dc[_0x50e119],_0xf5f2('0x8a')));_0xc3dfad+=0x1;}}_0x591f92[_0xf5f2('0x88')](new Extension(_0x2643dc,_0xc3dfad,'6','Wait'));_0xc3dfad+=0x1;_0x591f92[_0xf5f2('0x88')](new Extension(_0x2643dc,_0xc3dfad,_0xf5f2('0x92'),'ReceiveFax'));_0xc3dfad=0x0;return _0x591f92;}exports['addAccountApplications']=function(_0x3dd6e8,_0x37f2f1,_0x2d3ed2){var _0x381d27;return db[_0xf5f2('0x7b')][_0xf5f2('0x7c')](function(_0xefa664){return db[_0xf5f2('0x3e')]['create'](_0x3dd6e8['body'],{'transaction':_0xefa664})[_0xf5f2('0x21')](function(_0x5be398){_0x381d27=_0x5be398[_0xf5f2('0x36')]({'plain':!![]});return db[_0xf5f2('0x93')][_0xf5f2('0x7e')](createExtensionsReciveFax(_0x381d27),{'transaction':_0xefa664});});})[_0xf5f2('0x21')](function(){return _0x381d27;})['then'](respondWithResult(_0x37f2f1,null))[_0xf5f2('0x2a')](handleError(_0x37f2f1,null));};exports[_0xf5f2('0x94')]=function(_0x29cb4b,_0x1ed9aa,_0x77e9b9){var _0x48f1ae;return db[_0xf5f2('0x7b')][_0xf5f2('0x7c')](function(_0x378009){return db[_0xf5f2('0x3e')][_0xf5f2('0x34')](_0x29cb4b[_0xf5f2('0x60')],{'where':{'id':_0x29cb4b[_0xf5f2('0x60')]['id']},'transaction':_0x378009})[_0xf5f2('0x21')](function(_0x25deee){return db[_0xf5f2('0x93')][_0xf5f2('0x35')]({'where':{'FaxAccountId':_0x29cb4b[_0xf5f2('0x60')]['id']},'transaction':_0x378009})['then'](function(_0xd05e21){return db['VoiceExtension'][_0xf5f2('0x7e')](createExtensionsReciveFax(_[_0xf5f2('0x70')](_0x29cb4b[_0xf5f2('0x60')],[_0xf5f2('0x95'),_0xf5f2('0x96'),_0xf5f2('0x97'),_0xf5f2('0x98'),_0xf5f2('0x99'),_0xf5f2('0x9a')])),{'transaction':_0x378009});});});})[_0xf5f2('0x21')](function(){return db[_0xf5f2('0x3e')][_0xf5f2('0x9b')](_0x29cb4b[_0xf5f2('0x60')]['id']);})[_0xf5f2('0x21')](respondWithResult(_0x1ed9aa,null))[_0xf5f2('0x2a')](handleError(_0x1ed9aa,null));};exports[_0xf5f2('0x9c')]=function(_0x1afc94,_0x33f987,_0x4cb93d){var _0x32ca19={'raw':!![],'where':{}};var _0x51573a={};var _0x5b96ef={'count':0x0,'rows':[]};return db[_0xf5f2('0x3e')][_0xf5f2('0x67')]({'where':{'id':_0x1afc94['params']['id']}})[_0xf5f2('0x21')](handleEntityNotFound(_0x33f987,null))[_0xf5f2('0x21')](function(_0xb982a1){if(_0xb982a1){_0x51573a[_0xf5f2('0x42')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x9d')][_0xf5f2('0x3f')]);_0x51573a[_0xf5f2('0x43')]=_['keys'](_0x1afc94[_0xf5f2('0x43')]);_0x51573a[_0xf5f2('0x45')]=_[_0xf5f2('0x46')](_0x51573a['model'],_0x51573a[_0xf5f2('0x43')]);_0x32ca19[_0xf5f2('0x47')]=_[_0xf5f2('0x46')](_0x51573a[_0xf5f2('0x42')],qs['fields'](_0x1afc94['query'][_0xf5f2('0x48')]));_0x32ca19[_0xf5f2('0x47')]=_0x32ca19[_0xf5f2('0x47')][_0xf5f2('0x49')]?_0x32ca19[_0xf5f2('0x47')]:_0x51573a[_0xf5f2('0x42')];if(!_0x1afc94[_0xf5f2('0x43')][_0xf5f2('0x4a')](_0xf5f2('0x4b'))){_0x32ca19[_0xf5f2('0x31')]=qs['limit'](_0x1afc94[_0xf5f2('0x43')][_0xf5f2('0x31')]);_0x32ca19[_0xf5f2('0x30')]=qs['offset'](_0x1afc94[_0xf5f2('0x43')][_0xf5f2('0x30')]);}_0x32ca19['order']=qs[_0xf5f2('0x4d')](_0x1afc94['query'][_0xf5f2('0x4d')]);_0x32ca19[_0xf5f2('0x4e')]=qs['filters'](_[_0xf5f2('0x4f')](_0x1afc94['query'],_0x51573a[_0xf5f2('0x45')]));_0x32ca19[_0xf5f2('0x4e')]['FaxAccountId']=_0xb982a1['id'];if(_0x1afc94[_0xf5f2('0x43')][_0xf5f2('0x50')]){_0x32ca19[_0xf5f2('0x4e')]=_[_0xf5f2('0x52')](_0x32ca19[_0xf5f2('0x4e')],{'$or':_['map'](_0x32ca19[_0xf5f2('0x47')],function(_0x391a39){var _0x35284e={};_0x35284e[_0x391a39]={'$like':'%'+_0x1afc94[_0xf5f2('0x43')][_0xf5f2('0x50')]+'%'};return _0x35284e;})});}if(_0x1afc94[_0xf5f2('0x43')][_0xf5f2('0x9e')]){var _0x1d6490=_0x1afc94[_0xf5f2('0x43')]['$gte'][_0xf5f2('0x9f')](',');var _0x5d9e26={};_0x5d9e26[_0x1d6490[0x0]]={'$gte':moment(_0x1d6490[0x1])['format'](_0xf5f2('0xa0'))};_0x32ca19[_0xf5f2('0x4e')]=_[_0xf5f2('0x52')](_0x32ca19[_0xf5f2('0x4e')],_0x5d9e26);}_0x32ca19=_[_0xf5f2('0x52')]({},_0x32ca19,_0x1afc94[_0xf5f2('0x53')]);return db[_0xf5f2('0x9d')][_0xf5f2('0x2f')]({'where':_0x32ca19[_0xf5f2('0x4e')]})[_0xf5f2('0x21')](function(_0x5c2e06){_0x5b96ef['count']=_0x5c2e06;if(_0x1afc94['query'][_0xf5f2('0x54')]){_0x32ca19['include']=[{'all':!![]}];}return db[_0xf5f2('0x9d')][_0xf5f2('0x68')](_0x32ca19);})[_0xf5f2('0x21')](function(_0x5ac7ee){_0x5b96ef[_0xf5f2('0x55')]=_0x5ac7ee;return _0x5b96ef;});}})[_0xf5f2('0x21')](respondWithFilteredResult(_0x33f987,_0x32ca19))['catch'](handleError(_0x33f987,null));};exports['send']=function(_0x4d0709,_0x18cfa9,_0x139a5c){var _0x14ab4d,_0x4f9241={},_0x2cfa84;if(_0x4d0709['body']['to']){_0x2cfa84=_0x4d0709[_0xf5f2('0x60')]['to'][0x0];}return db[_0xf5f2('0x3e')][_0xf5f2('0x59')]({'where':{'id':_0x4d0709['params']['id']},'include':[{'model':db[_0xf5f2('0xa1')],'as':'List','include':[{'model':db[_0xf5f2('0x72')],'as':_0xf5f2('0xa2'),'where':{'fax':_0x2cfa84},'limit':0x1,'order':[[_0xf5f2('0x98'),'DESC']]}]}]})[_0xf5f2('0x21')](handleEntityNotFound(_0x18cfa9,null))[_0xf5f2('0x21')](function(_0x57b4a1){_0x14ab4d=_0x57b4a1;if(_0x4d0709[_0xf5f2('0x60')][_0xf5f2('0xa3')]&&_0x4d0709[_0xf5f2('0x60')][_0xf5f2('0xa3')][_0xf5f2('0x49')]){for(var _0x439c9f=0x0;_0x439c9f<_0x4d0709[_0xf5f2('0x60')][_0xf5f2('0xa3')][_0xf5f2('0x49')];_0x439c9f+=0x1){_0x4d0709[_0xf5f2('0x60')][_0xf5f2('0xa3')][_0x439c9f]={'filename':_0x4d0709[_0xf5f2('0x60')][_0xf5f2('0xa3')][_0x439c9f][_0xf5f2('0x3a')],'id':_0x4d0709[_0xf5f2('0x60')][_0xf5f2('0xa3')][_0x439c9f]['id'],'path':path[_0xf5f2('0xa4')](config[_0xf5f2('0xa5')],_0xf5f2('0xa6'),_0x4d0709[_0xf5f2('0x60')][_0xf5f2('0xa3')][_0x439c9f][_0xf5f2('0xa7')])};}}return respondWithRpcPromise('CheckAfterSend',_0xf5f2('0xa8'),{'FaxAccountId':_[_0xf5f2('0xa9')](_0x4d0709[_0xf5f2('0x57')]['id'])?undefined:_0x4d0709[_0xf5f2('0x57')]['id'],'path':_['isNil'](_0x4d0709[_0xf5f2('0x60')]['attachments'][0x0][_0xf5f2('0xaa')])?undefined:_0x4d0709[_0xf5f2('0x60')][_0xf5f2('0xa3')][0x0][_0xf5f2('0xaa')],'fax':_[_0xf5f2('0xa9')](_0x4d0709[_0xf5f2('0x60')]['to'][0x0])?undefined:_0x4d0709[_0xf5f2('0x60')]['to'][0x0]},client9002);})['then'](function(){if(_0x14ab4d){if(_['isNil'](_0x4d0709[_0xf5f2('0x60')][_0xf5f2('0xab')])){_0x4d0709[_0xf5f2('0x60')][_0xf5f2('0xab')]=util['format'](_0xf5f2('0xac'),_0x14ab4d[_0xf5f2('0x3a')],_0x14ab4d[_0xf5f2('0xad')]);}if(_0x14ab4d[_0xf5f2('0xae')]){if(_0x14ab4d[_0xf5f2('0xae')][_0xf5f2('0xa2')]['length']){return _0x14ab4d['List']['Contacts'][0x0];}else{return db[_0xf5f2('0x72')][_0xf5f2('0x5a')](_[_0xf5f2('0x19')](_0x4d0709['body'],{'firstName':_0x4d0709[_0xf5f2('0x60')]['to'][0x0],'phone':_0x4d0709['body']['to'][0x0],'fax':_0x4d0709[_0xf5f2('0x60')]['to'][0x0],'ListId':_0x14ab4d[_0xf5f2('0x9a')]}));}}else{throw new Error(_0xf5f2('0xaf'));}}else{throw new Error(_0xf5f2('0xb0'));}})[_0xf5f2('0x21')](function(_0x1556cb){if(_0x1556cb){return db[_0xf5f2('0x6f')][_0xf5f2('0x59')]({'where':{'ContactId':_0x1556cb['id'],'closed':![],'FaxAccountId':_0x14ab4d['id']}})[_0xf5f2('0x21')](function(_0x381759){if(_0x381759){return[_0x381759,![]];}return db[_0xf5f2('0x6f')][_0xf5f2('0x5a')]({'UserId':_0x4d0709[_0xf5f2('0x5b')]['id'],'ContactId':_0x1556cb['id'],'FaxAccountId':_0x14ab4d['id'],'fax':_0x4d0709[_0xf5f2('0x60')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xf5f2('0x52')](_0x4d0709[_0xf5f2('0x60')],{'read':![],'body':_0x4d0709[_0xf5f2('0x60')][_0xf5f2('0xa3')][0x0]['filename'],'FaxAccountId':_0x14ab4d['id'],'UserId':_0x4d0709[_0xf5f2('0x5b')]['id'],'ContactId':_0x1556cb['id'],'AttachmentId':_0x4d0709[_0xf5f2('0x60')][_0xf5f2('0xa3')][0x0]['id']})]},{'include':[{'model':db[_0xf5f2('0x9d')],'as':'Messages'}]})[_0xf5f2('0x21')](function(_0x5462ac){return[_0x5462ac,!![]];});});}else{throw new Error(_0xf5f2('0xb1'));}})[_0xf5f2('0xb2')](function(_0x20bb46,_0x17dc52){if(_0x17dc52){return _0x20bb46;}return db['FaxMessage'][_0xf5f2('0x5a')]({'direction':_0xf5f2('0xb3'),'read':![],'body':_0x4d0709[_0xf5f2('0x60')][_0xf5f2('0xa3')][0x0][_0xf5f2('0xb4')],'FaxAccountId':_0x14ab4d['id'],'FaxInteractionId':_0x20bb46['id'],'UserId':_0x4d0709[_0xf5f2('0x5b')]['id'],'ContactId':_0x20bb46['ContactId'],'AttachmentId':_0x4d0709[_0xf5f2('0x60')][_0xf5f2('0xa3')][0x0]['id']})[_0xf5f2('0x21')](function(_0x3dcf4e){_0x20bb46[_0xf5f2('0xb5')][_0xf5f2('0xb6')]=[];_0x20bb46[_0xf5f2('0xb5')][_0xf5f2('0xb6')][_0xf5f2('0x88')](_0x3dcf4e['dataValues']);return _0x20bb46;});})[_0xf5f2('0x21')](function(_0x13353f){respondWithRpcPromise(_0xf5f2('0xb7'),_0xf5f2('0xb7'),{'FaxAccountId':_['isNil'](_0x4d0709['params']['id'])?undefined:_0x4d0709[_0xf5f2('0x57')]['id'],'path':_[_0xf5f2('0xa9')](_0x4d0709[_0xf5f2('0x60')]['attachments'][0x0]['path'])?undefined:_0x4d0709[_0xf5f2('0x60')][_0xf5f2('0xa3')][0x0][_0xf5f2('0xaa')],'fax':_[_0xf5f2('0xa9')](_0x4d0709[_0xf5f2('0x60')]['to'][0x0])?undefined:_0x4d0709[_0xf5f2('0x60')]['to'][0x0],'AttachmentId':_0x4d0709['body'][_0xf5f2('0xa3')][0x0]['id']},client9002)[_0xf5f2('0x21')](function(_0x1c18a0){logger[_0xf5f2('0x22')]('SendFaxRpc,\x20%s',_0x1c18a0);})['catch'](function(_0x40f447){logger['info'](_0xf5f2('0xb8'),_0x40f447);});return _0x13353f;})[_0xf5f2('0x21')](respondWithResult(_0x18cfa9,null))[_0xf5f2('0x2a')](handleError(_0x18cfa9,null));};exports[_0xf5f2('0xb9')]=function(_0x45a01e,_0x3d6d4c,_0x40782a){return db[_0xf5f2('0x3e')][_0xf5f2('0x59')]({'where':{'id':_0x45a01e[_0xf5f2('0x57')]['id']}})[_0xf5f2('0x21')](handleEntityNotFound(_0x3d6d4c,null))[_0xf5f2('0x21')](function(_0x6734c5){if(_0x6734c5){return _0x6734c5[_0xf5f2('0xb9')](_0x45a01e['body'][_0xf5f2('0x6a')],_[_0xf5f2('0x70')](_0x45a01e[_0xf5f2('0x60')],[_0xf5f2('0x6a'),'id'])||{})[_0xf5f2('0xb2')](function(_0x592ee0){for(var _0x374b5e=0x0;_0x374b5e<_0x45a01e[_0xf5f2('0x60')]['ids'][_0xf5f2('0x49')];_0x374b5e+=0x1){socket[_0xf5f2('0xba')]('userFaxAccount:save',{'UserId':_0x45a01e['body'][_0xf5f2('0x6a')][_0x374b5e],'FaxAccountId':_0x45a01e[_0xf5f2('0x57')]['id']});}return _0x592ee0;});}})[_0xf5f2('0x21')](respondWithResult(_0x3d6d4c,null))['catch'](handleError(_0x3d6d4c,null));};exports['removeAgents']=function(_0x48b359,_0x3e4c88,_0x12fdeb){return db[_0xf5f2('0x3e')][_0xf5f2('0x59')]({'where':{'id':_0x48b359[_0xf5f2('0x57')]['id']}})[_0xf5f2('0x21')](handleEntityNotFound(_0x3e4c88,null))[_0xf5f2('0x21')](function(_0x4128ee){if(_0x4128ee){return _0x4128ee[_0xf5f2('0xbb')](_0x48b359['query'][_0xf5f2('0x6a')])[_0xf5f2('0x21')](function(){if(_['isArray'](_0x48b359[_0xf5f2('0x43')][_0xf5f2('0x6a')])){for(var _0xecb4d2=0x0;_0xecb4d2<_0x48b359[_0xf5f2('0x43')][_0xf5f2('0x6a')]['length'];_0xecb4d2+=0x1){socket['emit'](_0xf5f2('0xbc'),{'UserId':Number(_0x48b359[_0xf5f2('0x43')][_0xf5f2('0x6a')][_0xecb4d2]),'FaxAccountId':Number(_0x48b359[_0xf5f2('0x57')]['id'])});}}else{socket['emit'](_0xf5f2('0xbc'),{'UserId':Number(_0x48b359[_0xf5f2('0x43')][_0xf5f2('0x6a')]),'FaxAccountId':Number(_0x48b359[_0xf5f2('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x3e4c88,null))['catch'](handleError(_0x3e4c88,null));};exports['getAgents']=function(_0x4e74e0,_0x2e9d3b,_0x496802){var _0x5be074={};var _0x561666={};var _0x4966cf;var _0x16bcfa;return db['FaxAccount']['findOne']({'where':{'id':_0x4e74e0[_0xf5f2('0x57')]['id']}})[_0xf5f2('0x21')](handleEntityNotFound(_0x2e9d3b,null))[_0xf5f2('0x21')](function(_0x327e03){if(_0x327e03){_0x4966cf=_0x327e03;_0x561666['model']=_[_0xf5f2('0x44')](db[_0xf5f2('0xbd')][_0xf5f2('0x3f')]);_0x561666[_0xf5f2('0x43')]=_[_0xf5f2('0x44')](_0x4e74e0[_0xf5f2('0x43')]);_0x561666[_0xf5f2('0x45')]=_['intersection'](_0x561666[_0xf5f2('0x42')],_0x561666[_0xf5f2('0x43')]);_0x5be074['attributes']=_[_0xf5f2('0x46')](_0x561666[_0xf5f2('0x42')],qs[_0xf5f2('0x48')](_0x4e74e0[_0xf5f2('0x43')][_0xf5f2('0x48')]));_0x5be074['attributes']=_0x5be074[_0xf5f2('0x47')]['length']?_0x5be074[_0xf5f2('0x47')]:_0x561666[_0xf5f2('0x42')];_0x5be074[_0xf5f2('0x4c')]=qs[_0xf5f2('0x4d')](_0x4e74e0['query']['sort']);_0x5be074[_0xf5f2('0x4e')]=qs[_0xf5f2('0x45')](_[_0xf5f2('0x4f')](_0x4e74e0[_0xf5f2('0x43')],_0x561666[_0xf5f2('0x45')]));if(_0x4e74e0[_0xf5f2('0x43')][_0xf5f2('0x50')]){_0x5be074[_0xf5f2('0x4e')]=_['merge'](_0x5be074['where'],{'$or':_[_0xf5f2('0x3d')](_0x5be074[_0xf5f2('0x47')],function(_0x5f424e){var _0xb8bcf3={};_0xb8bcf3[_0x5f424e]={'$like':'%'+_0x4e74e0[_0xf5f2('0x43')][_0xf5f2('0x50')]+'%'};return _0xb8bcf3;})});}_0x5be074=_[_0xf5f2('0x52')]({},_0x5be074,_0x4e74e0[_0xf5f2('0x53')]);return _0x4966cf[_0xf5f2('0xbe')](_0x5be074);}})[_0xf5f2('0x21')](function(_0x4702df){if(_0x4702df){_0x16bcfa=_0x4702df[_0xf5f2('0x49')];if(!_0x4e74e0[_0xf5f2('0x43')][_0xf5f2('0x4a')](_0xf5f2('0x4b'))){_0x5be074[_0xf5f2('0x31')]=qs[_0xf5f2('0x31')](_0x4e74e0[_0xf5f2('0x43')][_0xf5f2('0x31')]);_0x5be074[_0xf5f2('0x30')]=qs['offset'](_0x4e74e0[_0xf5f2('0x43')]['offset']);}return _0x4966cf[_0xf5f2('0xbe')](_0x5be074);}})['then'](function(_0x47bc74){if(_0x47bc74){return _0x47bc74?{'count':_0x16bcfa,'rows':_0x47bc74}:null;}})[_0xf5f2('0x21')](respondWithResult(_0x2e9d3b,null))[_0xf5f2('0x2a')](handleError(_0x2e9d3b,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 61b277b..ae2d21e 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 _0xa333=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa333,0xf9));var _0x3a33=function(_0x14e290,_0xa559a){_0x14e290=_0x14e290-0x0;var _0x4ad101=_0xa333[_0x14e290];return _0x4ad101;};'use strict';var EventEmitter=require(_0x3a33('0x0'));var FaxAccount=require(_0x3a33('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x3a33('0x2')](0x0);var events={'afterCreate':_0x3a33('0x3'),'afterUpdate':'update','afterDestroy':_0x3a33('0x4')};function emitEvent(_0x528d6c){return function(_0x51bc11,_0x430254,_0x41ef0f){FaxAccountEvents[_0x3a33('0x5')](_0x528d6c+':'+_0x51bc11['id'],_0x51bc11);FaxAccountEvents[_0x3a33('0x5')](_0x528d6c,_0x51bc11);_0x41ef0f(null);};}for(var e in events){if(events[_0x3a33('0x6')](e)){var event=events[e];FaxAccount[_0x3a33('0x7')](e,emitEvent(event));}}module[_0x3a33('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x1829=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x2ffa60,_0x2d32f2){var _0x573687=function(_0x14faff){while(--_0x14faff){_0x2ffa60['push'](_0x2ffa60['shift']());}};_0x573687(++_0x2d32f2);}(_0x1829,0x91));var _0x9182=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x1829[_0x1a72f3];return _0x57ef47;};'use strict';var EventEmitter=require(_0x9182('0x0'));var FaxAccount=require(_0x9182('0x1'))['db'][_0x9182('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x9182('0x3')](0x0);var events={'afterCreate':_0x9182('0x4'),'afterUpdate':_0x9182('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1ad5ff){return function(_0x99d52e,_0x41279a,_0x442e37){FaxAccountEvents['emit'](_0x1ad5ff+':'+_0x99d52e['id'],_0x99d52e);FaxAccountEvents[_0x9182('0x6')](_0x1ad5ff,_0x99d52e);_0x442e37(null);};}for(var e in events){if(events[_0x9182('0x7')](e)){var event=events[e];FaxAccount[_0x9182('0x8')](e,emitEvent(event));}}module[_0x9182('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 9c01d7b..b095b88 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 _0xe00b=['FaxAccount','fax_accounts','lodash','api','bluebird','request-promise','../../config/environment','./faxAccount.attributes','exports','define'];(function(_0x14e66d,_0x433870){var _0x25154a=function(_0x166cc3){while(--_0x166cc3){_0x14e66d['push'](_0x14e66d['shift']());}};_0x25154a(++_0x433870);}(_0xe00b,0x16a));var _0xbe00=function(_0x3c49b2,_0x285e48){_0x3c49b2=_0x3c49b2-0x0;var _0x2d9203=_0xe00b[_0x3c49b2];return _0x2d9203;};'use strict';var _=require(_0xbe00('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbe00('0x1'));var moment=require('moment');var BPromise=require(_0xbe00('0x2'));var rp=require(_0xbe00('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbe00('0x4'));var attributes=require(_0xbe00('0x5'));module[_0xbe00('0x6')]=function(_0x574052,_0x871c30){return _0x574052[_0xbe00('0x7')](_0xbe00('0x8'),attributes,{'tableName':_0xbe00('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74d1=['request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','moment'];(function(_0x3b3971,_0x3a62d7){var _0xbcd3dc=function(_0x2ee7fc){while(--_0x2ee7fc){_0x3b3971['push'](_0x3b3971['shift']());}};_0xbcd3dc(++_0x3a62d7);}(_0x74d1,0xd5));var _0x174d=function(_0x109347,_0x18e830){_0x109347=_0x109347-0x0;var _0x267ae3=_0x74d1[_0x109347];return _0x267ae3;};'use strict';var _=require(_0x174d('0x0'));var util=require(_0x174d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x174d('0x2'));var BPromise=require('bluebird');var rp=require(_0x174d('0x3'));var fs=require('fs');var path=require(_0x174d('0x4'));var rimraf=require(_0x174d('0x5'));var config=require(_0x174d('0x6'));var attributes=require(_0x174d('0x7'));module[_0x174d('0x8')]=function(_0x145038,_0x141592){return _0x145038[_0x174d('0x9')](_0x174d('0xa'),attributes,{'tableName':_0x174d('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 1fb7191..9c4d259 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 _0xddbc=['Contacts','DESC','FaxApplication','Applications','get','applications','priority','length','defaults','create','Contact\x20not\x20found','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','GetFaxAccount','findAll','raw','options','where','limit','include','map','model','attributes','catch','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','FaxAccount','find','account','CmList','List'];(function(_0x40a92c,_0x3b28d5){var _0x2b935e=function(_0x121d85){while(--_0x121d85){_0x40a92c['push'](_0x40a92c['shift']());}};_0x2b935e(++_0x3b28d5);}(_0xddbc,0xcb));var _0xcddb=function(_0x4b05a0,_0x42905f){_0x4b05a0=_0x4b05a0-0x0;var _0x5a3d40=_0xddbc[_0x4b05a0];return _0x5a3d40;};'use strict';var _=require(_0xcddb('0x0'));var util=require(_0xcddb('0x1'));var moment=require(_0xcddb('0x2'));var BPromise=require(_0xcddb('0x3'));var rs=require(_0xcddb('0x4'));var fs=require('fs');var Redis=require(_0xcddb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcddb('0x6'));var logger=require(_0xcddb('0x7'))(_0xcddb('0x8'));var config=require(_0xcddb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcddb('0xa')][_0xcddb('0xb')]({'port':0x232c});config[_0xcddb('0xc')]=_['defaults'](config[_0xcddb('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xcddb('0xd'))(new Redis(config[_0xcddb('0xc')]));require(_0xcddb('0xe'))[_0xcddb('0xf')](socket);function respondWithRpcPromise(_0x3d22f0,_0x50249d,_0xe0cf76){return new BPromise(function(_0x13bfc0,_0x293359){return client[_0xcddb('0x10')](_0x3d22f0,_0xe0cf76)[_0xcddb('0x11')](function(_0xeade7c){logger[_0xcddb('0x12')](_0xcddb('0x13'),_0x50249d,_0xcddb('0x14'));logger[_0xcddb('0x15')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x50249d,_0xcddb('0x14'),JSON[_0xcddb('0x16')](_0xeade7c));if(_0xeade7c[_0xcddb('0x17')]){if(_0xeade7c[_0xcddb('0x17')]['code']===0x1f4){logger[_0xcddb('0x17')](_0xcddb('0x13'),_0x50249d,_0xeade7c[_0xcddb('0x17')]['message']);return _0x293359(_0xeade7c[_0xcddb('0x17')][_0xcddb('0x18')]);}logger[_0xcddb('0x17')](_0xcddb('0x13'),_0x50249d,_0xeade7c[_0xcddb('0x17')][_0xcddb('0x18')]);return _0x13bfc0(_0xeade7c[_0xcddb('0x17')][_0xcddb('0x18')]);}else{logger[_0xcddb('0x12')](_0xcddb('0x13'),_0x50249d,_0xcddb('0x14'));_0x13bfc0(_0xeade7c['result'][_0xcddb('0x18')]);}})['catch'](function(_0x49dfba){logger['error'](_0xcddb('0x13'),_0x50249d,_0x49dfba);_0x293359(_0x49dfba);});});}exports[_0xcddb('0x19')]=function(_0x5b99e0){var _0xd0e198=this;return new Promise(function(_0x5761e3,_0x3f63c4){return db['FaxAccount'][_0xcddb('0x1a')]({'raw':_0x5b99e0['options']?_0x5b99e0['options'][_0xcddb('0x1b')]===undefined?!![]:![]:!![],'where':_0x5b99e0[_0xcddb('0x1c')]?_0x5b99e0[_0xcddb('0x1c')][_0xcddb('0x1d')]||null:null,'attributes':_0x5b99e0[_0xcddb('0x1c')]?_0x5b99e0[_0xcddb('0x1c')]['attributes']||null:null,'limit':_0x5b99e0['options']?_0x5b99e0[_0xcddb('0x1c')][_0xcddb('0x1e')]||null:null,'include':_0x5b99e0[_0xcddb('0x1c')]?_0x5b99e0[_0xcddb('0x1c')][_0xcddb('0x1f')]?_[_0xcddb('0x20')](_0x5b99e0['options'][_0xcddb('0x1f')],function(_0x1d018b){return{'model':db[_0x1d018b[_0xcddb('0x21')]],'as':_0x1d018b['as'],'attributes':_0x1d018b[_0xcddb('0x22')],'include':_0x1d018b['include']?_['map'](_0x1d018b[_0xcddb('0x1f')],function(_0x53e167){return{'model':db[_0x53e167['model']],'as':_0x53e167['as'],'attributes':_0x53e167[_0xcddb('0x22')],'include':_0x53e167[_0xcddb('0x1f')]?_['map'](_0x53e167[_0xcddb('0x1f')],function(_0x480514){return{'model':db[_0x480514[_0xcddb('0x21')]],'as':_0x480514['as'],'attributes':_0x480514[_0xcddb('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x215f7a){logger[_0xcddb('0x12')](_0xcddb('0x19'),_0x5b99e0);logger[_0xcddb('0x15')](_0xcddb('0x19'),_0x5b99e0,JSON[_0xcddb('0x16')](_0x215f7a));_0x5761e3(_0x215f7a);})[_0xcddb('0x23')](function(_0x516b24){logger['error'](_0xcddb('0x19'),_0x516b24[_0xcddb('0x18')],_0x5b99e0);_0x3f63c4(_0xd0e198['error'](0x1f4,_0x516b24[_0xcddb('0x18')]));});});};exports['NotifyFaxAccount']=function(_0x39cd42,_0x210390,_0x40adaa){var _0x534edc=this;return new Promise(function(_0x19d634,_0x31892a){var _0x276132={'body':_0x39cd42[_0xcddb('0x24')],'channel':_0xcddb('0x25')};var _0x3a4fb0=[];var _0xf9d1b3=[];var _0x346ff7={};return db[_0xcddb('0x26')][_0xcddb('0x27')]()[_0xcddb('0x11')](function(_0x51591d){if(!_0x51591d){throw new db[(_0xcddb('0x28'))][(_0xcddb('0x29'))](_0xcddb('0x2a'));}_0x3a4fb0=_[_0xcddb('0x2b')](_[_0xcddb('0x2c')](_0x51591d),[_0xcddb('0x2d'),'updatedAt']);_0xf9d1b3=_[_0xcddb('0x2b')](_['keys'](_0x51591d),['createdAt',_0xcddb('0x2e'),_0xcddb('0x2f'),_0xcddb('0x30')]);if(_0x39cd42[_0xcddb('0x24')]['id']){delete _0x39cd42[_0xcddb('0x24')]['id'];}if(_[_0xcddb('0x31')](_0x39cd42[_0xcddb('0x24')][_0xcddb('0x32')])){throw new db[(_0xcddb('0x28'))][(_0xcddb('0x29'))](_0xcddb('0x33'));}if(_[_0xcddb('0x31')](_0x39cd42[_0xcddb('0x24')]['body'])||_0x39cd42[_0xcddb('0x24')][_0xcddb('0x24')]===''){throw new db[(_0xcddb('0x28'))][(_0xcddb('0x29'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x39cd42[_0xcddb('0x24')]['mapKey'])){throw new db[(_0xcddb('0x28'))][(_0xcddb('0x29'))](_0xcddb('0x34')+_0xf9d1b3);}if(!_[_0xcddb('0x35')](_0xf9d1b3,_0x39cd42[_0xcddb('0x24')]['mapKey'])){throw new db['Sequelize'][(_0xcddb('0x29'))](_0xcddb('0x36')+_0xf9d1b3);}_0x346ff7[_0x39cd42[_0xcddb('0x24')][_0xcddb('0x37')]]=_0x39cd42['body']['from'];})[_0xcddb('0x11')](function(){return db[_0xcddb('0x38')][_0xcddb('0x39')]({'where':{'id':_0x39cd42[_0xcddb('0x3a')]['id']},'include':[{'model':db[_0xcddb('0x3b')],'as':_0xcddb('0x3c'),'include':[{'model':db['CmContact'],'as':_0xcddb('0x3d'),'where':_0x346ff7,'limit':0x1,'order':[[_0xcddb('0x2e'),_0xcddb('0x3e')]]}]},{'model':db[_0xcddb('0x3f')],'as':_0xcddb('0x40')}]});})[_0xcddb('0x11')](function(_0x4f9f1e){if(_0x4f9f1e&&_0x4f9f1e[_0xcddb('0x3c')]){var _0xfa05e6=_0x4f9f1e[_0xcddb('0x41')]({'plain':!![]});_0x276132[_0xcddb('0x3a')]=_0xfa05e6;_0x276132[_0xcddb('0x42')]=_0xfa05e6[_0xcddb('0x40')];_0x276132['list']=_0xfa05e6[_0xcddb('0x3c')];_0x276132[_0xcddb('0x42')]=_['orderBy'](_0x276132[_0xcddb('0x42')],[_0xcddb('0x43')],['asc']);if(_0x276132[_0xcddb('0x3a')][_0xcddb('0x40')]){delete _0x276132['account'][_0xcddb('0x40')];}if(_0x276132['account'][_0xcddb('0x3c')]&&_0x276132[_0xcddb('0x3a')][_0xcddb('0x3c')][_0xcddb('0x3d')][_0xcddb('0x44')]){return _0x276132['account'][_0xcddb('0x3c')][_0xcddb('0x3d')][0x0];}var _0x49f606=_[_0xcddb('0x45')](_0x39cd42[_0xcddb('0x24')],{'firstName':_0x39cd42[_0xcddb('0x24')][_0xcddb('0x32')],'ListId':_0xfa05e6[_0xcddb('0x30')]});_0x49f606[_0x39cd42['body'][_0xcddb('0x37')]]=_0x39cd42[_0xcddb('0x24')][_0xcddb('0x32')];return db[_0xcddb('0x26')][_0xcddb('0x46')](_0x49f606,{'fields':_0x3a4fb0,'raw':!![]});}})[_0xcddb('0x11')](function(_0x536d27){_0x276132['contact']=_0x536d27;if(_0x536d27){var _0x5af1dc={'ContactId':_0x536d27['id'],'FaxAccountId':_0x39cd42[_0xcddb('0x3a')]['id'],'fax':_0x536d27[_0xcddb('0x25')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x536d27['id'],'closed':![],'FaxAccountId':_0x39cd42[_0xcddb('0x3a')]['id']}})[_0xcddb('0x11')](function(_0xf5ba5){if(_0xf5ba5){return[_0xf5ba5,![]];}return db['FaxInteraction'][_0xcddb('0x46')](_0x5af1dc)['then'](function(_0x124bb9){return[_0x124bb9,!![]];});});}else{throw new Error(_0xcddb('0x47'));}})['spread'](function(_0x34ece9,_0x139629){var _0x5edd0e=_0x34ece9[_0xcddb('0x41')]({'plain':!![]});if(_0x139629){if(_0x276132['account'][_0xcddb('0x48')]){_0x276132['applications'][_0xcddb('0x49')]({'id':0x0,'priority':_0x276132['applications'][_0xcddb('0x44')]+0x1,'app':_0xcddb('0x4a'),'appdata':_0xcddb('0x4b'),'interval':_0xcddb('0x4c')});}_0x5edd0e['created']=!![];}else{_0x5edd0e[_0xcddb('0x4d')]=![];}_0x276132[_0xcddb('0x4e')]=_0x5edd0e;return db['FaxMessage'][_0xcddb('0x46')]({'body':_0x39cd42[_0xcddb('0x24')][_0xcddb('0x24')],'FaxAccountId':_0x39cd42[_0xcddb('0x3a')]['id'],'FaxInteractionId':_0x34ece9['id'],'direction':'in','ContactId':_0x34ece9[_0xcddb('0x4f')],'AttachmentId':_0x39cd42[_0xcddb('0x24')][_0xcddb('0x50')]});})[_0xcddb('0x11')](function(_0x2ef229){_0x276132[_0xcddb('0x18')]=_0x2ef229;if(_0x276132[_0xcddb('0x4e')][_0xcddb('0x51')]){return db[_0xcddb('0x52')][_0xcddb('0x39')]({'attributes':['id',_0xcddb('0x53')],'where':{'id':_0x276132[_0xcddb('0x4e')][_0xcddb('0x51')]}})['then'](function(_0x4a7331){if(_0x4a7331){_0x276132[_0xcddb('0x42')][_0xcddb('0x54')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4a7331[_0xcddb('0x53')]+','+(_0x276132[_0xcddb('0x3a')][_0xcddb('0x55')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xcddb('0x56'),_0xcddb('0x57'),_0x276132);});}return respondWithRpcPromise(_0xcddb('0x56'),'startRouting',_0x276132);})[_0xcddb('0x11')](function(_0x1ebf2b){_0x19d634(_0x1ebf2b);})[_0xcddb('0x23')](function(_0x65be3e){_0x31892a(_0x534edc[_0xcddb('0x17')](0x1f4,_0x65be3e[_0xcddb('0x18')]));});});}; \ No newline at end of file +var _0xad59=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','List','DESC','Applications','get','account','list','applications','orderBy','priority','asc','Contacts','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','User','UserId','unshift','agent','name','Start','startRouting','lodash','util','randomstring','ioredis'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xad59,0xac));var _0x9ad5=function(_0x2407b8,_0x4dcc35){_0x2407b8=_0x2407b8-0x0;var _0x4dc840=_0xad59[_0x2407b8];return _0x4dc840;};'use strict';var _=require(_0x9ad5('0x0'));var util=require(_0x9ad5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9ad5('0x2'));var fs=require('fs');var Redis=require(_0x9ad5('0x3'));var db=require(_0x9ad5('0x4'))['db'];var utils=require(_0x9ad5('0x5'));var logger=require(_0x9ad5('0x6'))(_0x9ad5('0x7'));var config=require(_0x9ad5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9ad5('0x9')]['http']({'port':0x232c});config[_0x9ad5('0xa')]=_[_0x9ad5('0xb')](config['redis'],{'host':_0x9ad5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9ad5('0xa')]));require(_0x9ad5('0xd'))[_0x9ad5('0xe')](socket);function respondWithRpcPromise(_0x3df907,_0x2bac10,_0x33ad20){return new BPromise(function(_0x56cc01,_0x26fd6a){return client['request'](_0x3df907,_0x33ad20)[_0x9ad5('0xf')](function(_0x34c4bc){logger[_0x9ad5('0x10')](_0x9ad5('0x11'),_0x2bac10,_0x9ad5('0x12'));logger['debug'](_0x9ad5('0x13'),_0x2bac10,_0x9ad5('0x12'),JSON[_0x9ad5('0x14')](_0x34c4bc));if(_0x34c4bc['error']){if(_0x34c4bc[_0x9ad5('0x15')][_0x9ad5('0x16')]===0x1f4){logger[_0x9ad5('0x15')](_0x9ad5('0x11'),_0x2bac10,_0x34c4bc[_0x9ad5('0x15')][_0x9ad5('0x17')]);return _0x26fd6a(_0x34c4bc[_0x9ad5('0x15')]['message']);}logger[_0x9ad5('0x15')]('FaxAccount,\x20%s,\x20%s',_0x2bac10,_0x34c4bc[_0x9ad5('0x15')][_0x9ad5('0x17')]);return _0x56cc01(_0x34c4bc[_0x9ad5('0x15')]['message']);}else{logger['info'](_0x9ad5('0x11'),_0x2bac10,_0x9ad5('0x12'));_0x56cc01(_0x34c4bc[_0x9ad5('0x18')][_0x9ad5('0x17')]);}})[_0x9ad5('0x19')](function(_0x32c06f){logger['error']('FaxAccount,\x20%s,\x20%s',_0x2bac10,_0x32c06f);_0x26fd6a(_0x32c06f);});});}exports[_0x9ad5('0x1a')]=function(_0x348728){var _0x1e2af3=this;return new Promise(function(_0x4810cb,_0x3bc6fd){return db[_0x9ad5('0x1b')][_0x9ad5('0x1c')]({'raw':_0x348728[_0x9ad5('0x1d')]?_0x348728[_0x9ad5('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x348728['options']?_0x348728[_0x9ad5('0x1d')]['where']||null:null,'attributes':_0x348728[_0x9ad5('0x1d')]?_0x348728[_0x9ad5('0x1d')][_0x9ad5('0x1e')]||null:null,'limit':_0x348728[_0x9ad5('0x1d')]?_0x348728[_0x9ad5('0x1d')][_0x9ad5('0x1f')]||null:null,'include':_0x348728[_0x9ad5('0x1d')]?_0x348728['options'][_0x9ad5('0x20')]?_[_0x9ad5('0x21')](_0x348728[_0x9ad5('0x1d')]['include'],function(_0x2f7af3){return{'model':db[_0x2f7af3[_0x9ad5('0x22')]],'as':_0x2f7af3['as'],'attributes':_0x2f7af3[_0x9ad5('0x1e')],'include':_0x2f7af3['include']?_[_0x9ad5('0x21')](_0x2f7af3[_0x9ad5('0x20')],function(_0x153004){return{'model':db[_0x153004['model']],'as':_0x153004['as'],'attributes':_0x153004[_0x9ad5('0x1e')],'include':_0x153004['include']?_['map'](_0x153004[_0x9ad5('0x20')],function(_0x35137a){return{'model':db[_0x35137a['model']],'as':_0x35137a['as'],'attributes':_0x35137a[_0x9ad5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9ad5('0xf')](function(_0x1e3ba1){logger[_0x9ad5('0x10')](_0x9ad5('0x1a'),_0x348728);logger['debug'](_0x9ad5('0x1a'),_0x348728,JSON[_0x9ad5('0x14')](_0x1e3ba1));_0x4810cb(_0x1e3ba1);})['catch'](function(_0x52a0a9){logger[_0x9ad5('0x15')]('GetFaxAccount',_0x52a0a9[_0x9ad5('0x17')],_0x348728);_0x3bc6fd(_0x1e2af3[_0x9ad5('0x15')](0x1f4,_0x52a0a9['message']));});});};exports[_0x9ad5('0x23')]=function(_0x4cc5d5,_0x36687a,_0x25429d){var _0x1db98e=this;return new Promise(function(_0x4168a1,_0x1ae8fc){var _0x4321b3={'body':_0x4cc5d5[_0x9ad5('0x24')],'channel':_0x9ad5('0x25')};var _0x308be0=[];var _0x53c317=[];var _0x4e4580={};return db[_0x9ad5('0x26')][_0x9ad5('0x27')]()[_0x9ad5('0xf')](function(_0x55a1cc){if(!_0x55a1cc){throw new db[(_0x9ad5('0x28'))][(_0x9ad5('0x29'))]('no\x20available\x20attributes');}_0x308be0=_[_0x9ad5('0x2a')](_[_0x9ad5('0x2b')](_0x55a1cc),[_0x9ad5('0x2c'),_0x9ad5('0x2d')]);_0x53c317=_[_0x9ad5('0x2a')](_['keys'](_0x55a1cc),['createdAt','updatedAt','CompanyId',_0x9ad5('0x2e')]);if(_0x4cc5d5[_0x9ad5('0x24')]['id']){delete _0x4cc5d5[_0x9ad5('0x24')]['id'];}if(_['isNil'](_0x4cc5d5['body'][_0x9ad5('0x2f')])){throw new db['Sequelize'][(_0x9ad5('0x29'))](_0x9ad5('0x30'));}if(_[_0x9ad5('0x31')](_0x4cc5d5['body'][_0x9ad5('0x24')])||_0x4cc5d5[_0x9ad5('0x24')][_0x9ad5('0x24')]===''){throw new db['Sequelize']['ValidationError'](_0x9ad5('0x32'));}if(_[_0x9ad5('0x31')](_0x4cc5d5['body'][_0x9ad5('0x33')])){throw new db[(_0x9ad5('0x28'))][(_0x9ad5('0x29'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x53c317);}if(!_[_0x9ad5('0x34')](_0x53c317,_0x4cc5d5[_0x9ad5('0x24')][_0x9ad5('0x33')])){throw new db['Sequelize'][(_0x9ad5('0x29'))](_0x9ad5('0x35')+_0x53c317);}_0x4e4580[_0x4cc5d5[_0x9ad5('0x24')][_0x9ad5('0x33')]]=_0x4cc5d5[_0x9ad5('0x24')][_0x9ad5('0x2f')];})[_0x9ad5('0xf')](function(){return db['FaxAccount'][_0x9ad5('0x36')]({'where':{'id':_0x4cc5d5['account']['id']},'include':[{'model':db['CmList'],'as':_0x9ad5('0x37'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4e4580,'limit':0x1,'order':[[_0x9ad5('0x2d'),_0x9ad5('0x38')]]}]},{'model':db['FaxApplication'],'as':_0x9ad5('0x39')}]});})[_0x9ad5('0xf')](function(_0x4c5452){if(_0x4c5452&&_0x4c5452[_0x9ad5('0x37')]){var _0x6bb142=_0x4c5452[_0x9ad5('0x3a')]({'plain':!![]});_0x4321b3[_0x9ad5('0x3b')]=_0x6bb142;_0x4321b3['applications']=_0x6bb142[_0x9ad5('0x39')];_0x4321b3[_0x9ad5('0x3c')]=_0x6bb142[_0x9ad5('0x37')];_0x4321b3[_0x9ad5('0x3d')]=_[_0x9ad5('0x3e')](_0x4321b3[_0x9ad5('0x3d')],[_0x9ad5('0x3f')],[_0x9ad5('0x40')]);if(_0x4321b3[_0x9ad5('0x3b')][_0x9ad5('0x39')]){delete _0x4321b3[_0x9ad5('0x3b')][_0x9ad5('0x39')];}if(_0x4321b3[_0x9ad5('0x3b')][_0x9ad5('0x37')]&&_0x4321b3[_0x9ad5('0x3b')][_0x9ad5('0x37')][_0x9ad5('0x41')][_0x9ad5('0x42')]){return _0x4321b3['account'][_0x9ad5('0x37')][_0x9ad5('0x41')][0x0];}var _0x413b63=_[_0x9ad5('0xb')](_0x4cc5d5['body'],{'firstName':_0x4cc5d5['body'][_0x9ad5('0x2f')],'ListId':_0x6bb142['ListId']});_0x413b63[_0x4cc5d5[_0x9ad5('0x24')][_0x9ad5('0x33')]]=_0x4cc5d5['body']['from'];return db[_0x9ad5('0x26')][_0x9ad5('0x43')](_0x413b63,{'fields':_0x308be0,'raw':!![]});}})['then'](function(_0x4c8c17){_0x4321b3[_0x9ad5('0x44')]=_0x4c8c17;if(_0x4c8c17){var _0x4f559b={'ContactId':_0x4c8c17['id'],'FaxAccountId':_0x4cc5d5['account']['id'],'fax':_0x4c8c17[_0x9ad5('0x25')]};return db[_0x9ad5('0x45')][_0x9ad5('0x36')]({'where':{'ContactId':_0x4c8c17['id'],'closed':![],'FaxAccountId':_0x4cc5d5[_0x9ad5('0x3b')]['id']}})['then'](function(_0x48cc2f){if(_0x48cc2f){return[_0x48cc2f,![]];}return db[_0x9ad5('0x45')][_0x9ad5('0x43')](_0x4f559b)['then'](function(_0x1f6a49){return[_0x1f6a49,!![]];});});}else{throw new Error(_0x9ad5('0x46'));}})[_0x9ad5('0x47')](function(_0x4dff30,_0x3aa0ca){var _0x401613=_0x4dff30[_0x9ad5('0x3a')]({'plain':!![]});if(_0x3aa0ca){if(_0x4321b3[_0x9ad5('0x3b')][_0x9ad5('0x48')]){_0x4321b3[_0x9ad5('0x3d')]['push']({'id':0x0,'priority':_0x4321b3[_0x9ad5('0x3d')][_0x9ad5('0x42')]+0x1,'app':_0x9ad5('0x49'),'appdata':_0x9ad5('0x4a'),'interval':_0x9ad5('0x4b')});}_0x401613[_0x9ad5('0x4c')]=!![];}else{_0x401613[_0x9ad5('0x4c')]=![];}_0x4321b3[_0x9ad5('0x4d')]=_0x401613;return db[_0x9ad5('0x4e')][_0x9ad5('0x43')]({'body':_0x4cc5d5[_0x9ad5('0x24')][_0x9ad5('0x24')],'FaxAccountId':_0x4cc5d5[_0x9ad5('0x3b')]['id'],'FaxInteractionId':_0x4dff30['id'],'direction':'in','ContactId':_0x4dff30[_0x9ad5('0x4f')],'AttachmentId':_0x4cc5d5[_0x9ad5('0x24')][_0x9ad5('0x50')]});})[_0x9ad5('0xf')](function(_0x268606){_0x4321b3[_0x9ad5('0x17')]=_0x268606;if(_0x4321b3['interaction']['UserId']){return db[_0x9ad5('0x51')]['find']({'attributes':['id','name'],'where':{'id':_0x4321b3[_0x9ad5('0x4d')][_0x9ad5('0x52')]}})[_0x9ad5('0xf')](function(_0x3bf1d4){if(_0x3bf1d4){_0x4321b3['applications'][_0x9ad5('0x53')]({'id':0x0,'priority':0x0,'app':_0x9ad5('0x54'),'appdata':_0x3bf1d4[_0x9ad5('0x55')]+','+(_0x4321b3[_0x9ad5('0x3b')]['waitForTheAssignedAgent']||0xa),'interval':_0x9ad5('0x4b')});}return respondWithRpcPromise(_0x9ad5('0x56'),_0x9ad5('0x57'),_0x4321b3);});}return respondWithRpcPromise(_0x9ad5('0x56'),_0x9ad5('0x57'),_0x4321b3);})['then'](function(_0x41947e){_0x4168a1(_0x41947e);})['catch'](function(_0xc2396d){_0x1ae8fc(_0x1db98e[_0x9ad5('0x15')](0x1f4,_0xc2396d[_0x9ad5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 8f62286..11c5e8d 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 _0xfcf0=['removeListener','register','length','faxAccount:','./faxAccount.events','save','update'];(function(_0x4b50f0,_0x5f0670){var _0x1d2702=function(_0x461ada){while(--_0x461ada){_0x4b50f0['push'](_0x4b50f0['shift']());}};_0x1d2702(++_0x5f0670);}(_0xfcf0,0x138));var _0x0fcf=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0xfcf0[_0x75f869];return _0x10af8b;};'use strict';var FaxAccountEvents=require(_0x0fcf('0x0'));var events=[_0x0fcf('0x1'),'remove',_0x0fcf('0x2')];function createListener(_0x3d8e0f,_0x366cfa){return function(_0xd744d1){_0x366cfa['emit'](_0x3d8e0f,_0xd744d1);};}function removeListener(_0x2fe6d8,_0x265968){return function(){FaxAccountEvents[_0x0fcf('0x3')](_0x2fe6d8,_0x265968);};}exports[_0x0fcf('0x4')]=function(_0x1bace8){for(var _0x1a7b03=0x0,_0x61bbb9=events[_0x0fcf('0x5')];_0x1a7b03<_0x61bbb9;_0x1a7b03++){var _0x50c575=events[_0x1a7b03];var _0x1388d1=createListener(_0x0fcf('0x6')+_0x50c575,_0x1bace8);FaxAccountEvents['on'](_0x50c575,_0x1388d1);}}; \ No newline at end of file +var _0xe5af=['faxAccount:','save','remove','register','length'];(function(_0x126d8d,_0xb02c52){var _0x2e85b8=function(_0x4d9bb9){while(--_0x4d9bb9){_0x126d8d['push'](_0x126d8d['shift']());}};_0x2e85b8(++_0xb02c52);}(_0xe5af,0x9c));var _0xfe5a=function(_0xc8023,_0xd1912){_0xc8023=_0xc8023-0x0;var _0x448b50=_0xe5af[_0xc8023];return _0x448b50;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xfe5a('0x0'),_0xfe5a('0x1'),'update'];function createListener(_0x9a3743,_0x1bad12){return function(_0x23b7f0){_0x1bad12['emit'](_0x9a3743,_0x23b7f0);};}function removeListener(_0x1165e3,_0x48e3a7){return function(){FaxAccountEvents['removeListener'](_0x1165e3,_0x48e3a7);};}exports[_0xfe5a('0x2')]=function(_0x2039cd){for(var _0x4e418f=0x0,_0x5eea2e=events[_0xfe5a('0x3')];_0x4e418f<_0x5eea2e;_0x4e418f++){var _0x106492=events[_0x4e418f];var _0xfb4357=createListener(_0xfe5a('0x4')+_0x106492,_0x2039cd);FaxAccountEvents['on'](_0x106492,_0xfb4357);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 49629a2..e461564 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 _0xa7ad=['isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','post','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','/:id','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./faxAccount.controller','get'];(function(_0x2367a1,_0x2b85c3){var _0x11a0c8=function(_0x50d3d2){while(--_0x50d3d2){_0x2367a1['push'](_0x2367a1['shift']());}};_0x11a0c8(++_0x2b85c3);}(_0xa7ad,0x19b));var _0xda7a=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xa7ad[_0x47aa64];return _0x549c7a;};'use strict';var multer=require(_0xda7a('0x0'));var util=require(_0xda7a('0x1'));var path=require(_0xda7a('0x2'));var timeout=require(_0xda7a('0x3'));var express=require('express');var router=express[_0xda7a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xda7a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xda7a('0x6'));var controller=require(_0xda7a('0x7'));router[_0xda7a('0x8')]('/',auth[_0xda7a('0x9')](),controller[_0xda7a('0xa')]);router[_0xda7a('0x8')](_0xda7a('0xb'),auth[_0xda7a('0x9')](),controller[_0xda7a('0xc')]);router[_0xda7a('0x8')]('/:id',auth[_0xda7a('0x9')](),controller[_0xda7a('0xd')]);router[_0xda7a('0x8')](_0xda7a('0xe'),auth['isAuthenticated'](),controller[_0xda7a('0xf')]);router[_0xda7a('0x8')](_0xda7a('0x10'),auth[_0xda7a('0x9')](),controller['getAnswers']);router[_0xda7a('0x8')](_0xda7a('0x11'),auth[_0xda7a('0x9')](),controller[_0xda7a('0x12')]);router[_0xda7a('0x8')](_0xda7a('0x13'),auth[_0xda7a('0x9')](),controller[_0xda7a('0x14')]);router[_0xda7a('0x8')](_0xda7a('0x15'),auth[_0xda7a('0x9')](),controller['getMessages']);router[_0xda7a('0x8')](_0xda7a('0x16'),auth[_0xda7a('0x9')](),controller[_0xda7a('0x17')]);router[_0xda7a('0x18')]('/',auth['isAuthenticated'](),controller['create']);router[_0xda7a('0x18')](_0xda7a('0xe'),auth['isAuthenticated'](),controller[_0xda7a('0x19')]);router[_0xda7a('0x18')](_0xda7a('0x10'),auth[_0xda7a('0x9')](),controller[_0xda7a('0x1a')]);router['post'](_0xda7a('0x11'),auth[_0xda7a('0x9')](),controller[_0xda7a('0x1b')]);router[_0xda7a('0x18')](_0xda7a('0x13'),auth[_0xda7a('0x9')](),controller[_0xda7a('0x1c')]);router[_0xda7a('0x18')](_0xda7a('0x1d'),auth[_0xda7a('0x9')](),controller[_0xda7a('0x1e')]);router['post'](_0xda7a('0x1f'),auth['isAuthenticated'](),controller[_0xda7a('0x20')]);router[_0xda7a('0x18')](_0xda7a('0x21'),auth['isAuthenticated'](),controller[_0xda7a('0x22')]);router[_0xda7a('0x18')]('/:id/users',auth[_0xda7a('0x9')](),controller['addAgents']);router['put'](_0xda7a('0x23'),auth['isAuthenticated'](),controller[_0xda7a('0x24')]);router[_0xda7a('0x25')](_0xda7a('0x23'),auth[_0xda7a('0x9')](),controller['destroy']);router[_0xda7a('0x25')]('/:id/dispositions',auth[_0xda7a('0x9')](),controller[_0xda7a('0x26')]);router[_0xda7a('0x25')]('/:id/canned_answers',auth[_0xda7a('0x9')](),controller[_0xda7a('0x27')]);router['delete']('/:id/users',auth[_0xda7a('0x9')](),controller[_0xda7a('0x28')]);module[_0xda7a('0x29')]=router; \ No newline at end of file +var _0x676d=['/:id/send','send','put','update','delete','destroy','removeAgents','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxAccount.controller','isAuthenticated','index','/describe','get','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','getApplications','getMessages','/:id/users','post','create','addDisposition','addAnswer','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x676d,0xc5));var _0xd676=function(_0x3b27f7,_0x599245){_0x3b27f7=_0x3b27f7-0x0;var _0x4b63e6=_0x676d[_0x3b27f7];return _0x4b63e6;};'use strict';var multer=require(_0xd676('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd676('0x1'));var express=require(_0xd676('0x2'));var router=express[_0xd676('0x3')]();var fs_extra=require(_0xd676('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd676('0x5'));var config=require(_0xd676('0x6'));var controller=require(_0xd676('0x7'));router['get']('/',auth[_0xd676('0x8')](),controller[_0xd676('0x9')]);router['get'](_0xd676('0xa'),auth[_0xd676('0x8')](),controller['describe']);router[_0xd676('0xb')](_0xd676('0xc'),auth[_0xd676('0x8')](),controller[_0xd676('0xd')]);router[_0xd676('0xb')](_0xd676('0xe'),auth[_0xd676('0x8')](),controller[_0xd676('0xf')]);router[_0xd676('0xb')](_0xd676('0x10'),auth[_0xd676('0x8')](),controller[_0xd676('0x11')]);router[_0xd676('0xb')](_0xd676('0x12'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xd676('0xb')](_0xd676('0x13'),auth[_0xd676('0x8')](),controller[_0xd676('0x14')]);router[_0xd676('0xb')]('/:id/messages',auth[_0xd676('0x8')](),controller[_0xd676('0x15')]);router[_0xd676('0xb')](_0xd676('0x16'),auth['isAuthenticated'](),controller['getAgents']);router[_0xd676('0x17')]('/',auth[_0xd676('0x8')](),controller[_0xd676('0x18')]);router[_0xd676('0x17')](_0xd676('0xe'),auth[_0xd676('0x8')](),controller[_0xd676('0x19')]);router[_0xd676('0x17')](_0xd676('0x10'),auth[_0xd676('0x8')](),controller[_0xd676('0x1a')]);router[_0xd676('0x17')](_0xd676('0x12'),auth[_0xd676('0x8')](),controller['addInteraction']);router[_0xd676('0x17')](_0xd676('0x13'),auth[_0xd676('0x8')](),controller[_0xd676('0x1b')]);router[_0xd676('0x17')]('/addaccountapplications',auth['isAuthenticated'](),controller[_0xd676('0x1c')]);router[_0xd676('0x17')](_0xd676('0x1d'),auth[_0xd676('0x8')](),controller[_0xd676('0x1e')]);router[_0xd676('0x17')](_0xd676('0x1f'),auth[_0xd676('0x8')](),controller[_0xd676('0x20')]);router[_0xd676('0x17')](_0xd676('0x16'),auth[_0xd676('0x8')](),controller['addAgents']);router[_0xd676('0x21')](_0xd676('0xc'),auth[_0xd676('0x8')](),controller[_0xd676('0x22')]);router[_0xd676('0x23')](_0xd676('0xc'),auth[_0xd676('0x8')](),controller[_0xd676('0x24')]);router[_0xd676('0x23')](_0xd676('0xe'),auth[_0xd676('0x8')](),controller['removeDispositions']);router['delete'](_0xd676('0x10'),auth[_0xd676('0x8')](),controller['removeAnswers']);router[_0xd676('0x23')](_0xd676('0x16'),auth['isAuthenticated'](),controller[_0xd676('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index a886206..be806fb 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 _0xe958=['noop','exports','INTEGER','STRING'];(function(_0x4488ca,_0x6acac9){var _0x4b5750=function(_0x3cb748){while(--_0x3cb748){_0x4488ca['push'](_0x4488ca['shift']());}};_0x4b5750(++_0x6acac9);}(_0xe958,0x191));var _0x8e95=function(_0x29faba,_0xeea81e){_0x29faba=_0x29faba-0x0;var _0x3dac50=_0xe958[_0x29faba];return _0x3dac50;};'use strict';var Sequelize=require('sequelize');module[_0x8e95('0x0')]={'priority':{'type':Sequelize[_0x8e95('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x8e95('0x2')],'allowNull':![],'defaultValue':_0x8e95('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8e95('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xbca0=['exports','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x39ea42,_0x3c1f50){var _0x33f5b7=function(_0x5d8e73){while(--_0x5d8e73){_0x39ea42['push'](_0x39ea42['shift']());}};_0x33f5b7(++_0x3c1f50);}(_0xbca0,0x8b));var _0x0bca=function(_0x4e4d15,_0x1235de){_0x4e4d15=_0x4e4d15-0x0;var _0x3f64c4=_0xbca0[_0x4e4d15];return _0x3f64c4;};'use strict';var Sequelize=require(_0x0bca('0x0'));module[_0x0bca('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x0bca('0x2')]()},'description':{'type':Sequelize[_0x0bca('0x3')]},'interval':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 9190c7c..32d6493 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 _0xbede=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','params','rawAttributes','includeAll','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','index','map','FaxApplication','fieldName','type','model','query','keys','intersection'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbede,0x1d4));var _0xebed=function(_0x358567,_0x19f6a0){_0x358567=_0x358567-0x0;var _0x23cbce=_0xbede[_0x358567];return _0x23cbce;};'use strict';var emlformat=require(_0xebed('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xebed('0x1'));var jsonpatch=require(_0xebed('0x2'));var rp=require(_0xebed('0x3'));var moment=require(_0xebed('0x4'));var BPromise=require(_0xebed('0x5'));var Mustache=require(_0xebed('0x6'));var util=require(_0xebed('0x7'));var path=require(_0xebed('0x8'));var sox=require('sox');var csv=require(_0xebed('0x9'));var ejs=require(_0xebed('0xa'));var fs=require('fs');var fs_extra=require(_0xebed('0xb'));var _=require('lodash');var squel=require(_0xebed('0xc'));var crypto=require(_0xebed('0xd'));var jsforce=require(_0xebed('0xe'));var deskjs=require(_0xebed('0xf'));var toCsv=require(_0xebed('0x9'));var querystring=require(_0xebed('0x10'));var Papa=require('papaparse');var Redis=require(_0xebed('0x11'));var authService=require(_0xebed('0x12'));var qs=require(_0xebed('0x13'));var as=require(_0xebed('0x14'));var hardwareService=require(_0xebed('0x15'));var logger=require(_0xebed('0x16'))('api');var utils=require(_0xebed('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xebed('0x18'))['db'];function respondWithStatusCode(_0x534d2a,_0x5251ed){_0x5251ed=_0x5251ed||0xcc;return function(_0x2d23c1){if(_0x2d23c1){return _0x534d2a['sendStatus'](_0x5251ed);}return _0x534d2a[_0xebed('0x19')](_0x5251ed)[_0xebed('0x1a')]();};}function respondWithResult(_0x34b8d1,_0x5a04e8){_0x5a04e8=_0x5a04e8||0xc8;return function(_0x1ffd85){if(_0x1ffd85){return _0x34b8d1[_0xebed('0x19')](_0x5a04e8)[_0xebed('0x1b')](_0x1ffd85);}};}function respondWithFilteredResult(_0x25877a,_0x47111b){return function(_0xd1e5b3){if(_0xd1e5b3){var _0x28289e=_0xd1e5b3[_0xebed('0x1c')],_0x582647=_0x47111b[_0xebed('0x1d')],_0x4b085b=_0x47111b['offset']+_0x47111b[_0xebed('0x1e')],_0x10a5b3;if(_0x4b085b>=_0x28289e){_0x4b085b=_0x28289e;_0x10a5b3=0xc8;}else{_0x10a5b3=0xce;}_0x25877a[_0xebed('0x19')](_0x10a5b3);return _0x25877a['set'](_0xebed('0x1f'),_0x582647+'-'+_0x4b085b+'/'+_0x28289e)[_0xebed('0x1b')](_0xd1e5b3);}return null;};}function patchUpdates(_0x3580d8){return function(_0x76d79c){try{jsonpatch[_0xebed('0x20')](_0x76d79c,_0x3580d8,!![]);}catch(_0x46a5ce){return BPromise['reject'](_0x46a5ce);}return _0x76d79c[_0xebed('0x21')]();};}function saveUpdates(_0x2c0de1,_0x162824){return function(_0x221601){if(_0x221601){return _0x221601[_0xebed('0x22')](_0x2c0de1)[_0xebed('0x23')](function(_0x39379e){return _0x39379e;});}return null;};}function removeEntity(_0x148070,_0x3911a8){return function(_0x1e9acb){if(_0x1e9acb){return _0x1e9acb[_0xebed('0x24')]()[_0xebed('0x23')](function(){_0x148070['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x58dee9,_0xa34b22){return function(_0x50c9f4){if(!_0x50c9f4){_0x58dee9[_0xebed('0x25')](0x194);}return _0x50c9f4;};}function handleError(_0x4ea4dd,_0x3621ca){_0x3621ca=_0x3621ca||0x1f4;return function(_0x54dcba){logger[_0xebed('0x26')](_0x54dcba[_0xebed('0x27')]);if(_0x54dcba[_0xebed('0x28')]){delete _0x54dcba[_0xebed('0x28')];}_0x4ea4dd[_0xebed('0x19')](_0x3621ca)['send'](_0x54dcba);};}exports[_0xebed('0x29')]=function(_0x3039ce,_0x46d5bb){var _0xb1318b={},_0x158327={},_0x404950={'count':0x0,'rows':[]};var _0x146dc1=_[_0xebed('0x2a')](db[_0xebed('0x2b')]['rawAttributes'],function(_0xf2361c){return{'name':_0xf2361c[_0xebed('0x2c')],'type':_0xf2361c[_0xebed('0x2d')]['key']};});_0x158327[_0xebed('0x2e')]=_[_0xebed('0x2a')](_0x146dc1,_0xebed('0x28'));_0x158327[_0xebed('0x2f')]=_[_0xebed('0x30')](_0x3039ce[_0xebed('0x2f')]);_0x158327['filters']=_[_0xebed('0x31')](_0x158327[_0xebed('0x2e')],_0x158327[_0xebed('0x2f')]);_0xb1318b[_0xebed('0x32')]=_['intersection'](_0x158327[_0xebed('0x2e')],qs[_0xebed('0x33')](_0x3039ce[_0xebed('0x2f')][_0xebed('0x33')]));_0xb1318b[_0xebed('0x32')]=_0xb1318b[_0xebed('0x32')][_0xebed('0x34')]?_0xb1318b[_0xebed('0x32')]:_0x158327['model'];if(!_0x3039ce[_0xebed('0x2f')][_0xebed('0x35')](_0xebed('0x36'))){_0xb1318b[_0xebed('0x1e')]=qs['limit'](_0x3039ce[_0xebed('0x2f')][_0xebed('0x1e')]);_0xb1318b[_0xebed('0x1d')]=qs[_0xebed('0x1d')](_0x3039ce[_0xebed('0x2f')]['offset']);}_0xb1318b[_0xebed('0x37')]=qs['sort'](_0x3039ce['query'][_0xebed('0x38')]);_0xb1318b[_0xebed('0x39')]=qs[_0xebed('0x3a')](_[_0xebed('0x3b')](_0x3039ce['query'],_0x158327[_0xebed('0x3a')]),_0x146dc1);if(_0x3039ce[_0xebed('0x2f')][_0xebed('0x3c')]){_0xb1318b[_0xebed('0x39')]=_[_0xebed('0x3d')](_0xb1318b[_0xebed('0x39')],{'$or':_[_0xebed('0x2a')](_0x146dc1,function(_0x5beb3d){if(_0x5beb3d[_0xebed('0x2d')]!==_0xebed('0x3e')){var _0x5c3c73={};_0x5c3c73[_0x5beb3d['name']]={'$like':'%'+_0x3039ce[_0xebed('0x2f')]['filter']+'%'};return _0x5c3c73;}})});}_0xb1318b=_['merge']({},_0xb1318b,_0x3039ce['options']);var _0x2f39fc={'where':_0xb1318b[_0xebed('0x39')]};return db[_0xebed('0x2b')][_0xebed('0x1c')](_0x2f39fc)[_0xebed('0x23')](function(_0xcd6bc9){_0x404950['count']=_0xcd6bc9;if(_0x3039ce[_0xebed('0x2f')]['includeAll']){_0xb1318b[_0xebed('0x3f')]=[{'all':!![]}];}return db[_0xebed('0x2b')][_0xebed('0x40')](_0xb1318b);})[_0xebed('0x23')](function(_0xe18da0){_0x404950[_0xebed('0x41')]=_0xe18da0;return _0x404950;})[_0xebed('0x23')](respondWithFilteredResult(_0x46d5bb,_0xb1318b))[_0xebed('0x42')](handleError(_0x46d5bb,null));};exports['show']=function(_0x106659,_0x1da5ee){var _0x5bf31e={'raw':!![],'where':{'id':_0x106659[_0xebed('0x43')]['id']}},_0x2bf3c9={};_0x2bf3c9[_0xebed('0x2e')]=_[_0xebed('0x30')](db[_0xebed('0x2b')][_0xebed('0x44')]);_0x2bf3c9[_0xebed('0x2f')]=_['keys'](_0x106659[_0xebed('0x2f')]);_0x2bf3c9[_0xebed('0x3a')]=_['intersection'](_0x2bf3c9[_0xebed('0x2e')],_0x2bf3c9[_0xebed('0x2f')]);_0x5bf31e['attributes']=_[_0xebed('0x31')](_0x2bf3c9[_0xebed('0x2e')],qs['fields'](_0x106659['query'][_0xebed('0x33')]));_0x5bf31e[_0xebed('0x32')]=_0x5bf31e[_0xebed('0x32')]['length']?_0x5bf31e[_0xebed('0x32')]:_0x2bf3c9[_0xebed('0x2e')];if(_0x106659[_0xebed('0x2f')][_0xebed('0x45')]){_0x5bf31e[_0xebed('0x3f')]=[{'all':!![]}];}_0x5bf31e=_['merge']({},_0x5bf31e,_0x106659[_0xebed('0x46')]);return db['FaxApplication'][_0xebed('0x47')](_0x5bf31e)['then'](handleEntityNotFound(_0x1da5ee,null))[_0xebed('0x23')](respondWithResult(_0x1da5ee,null))['catch'](handleError(_0x1da5ee,null));};exports[_0xebed('0x48')]=function(_0x3b52a9,_0x4f0693){return db['FaxApplication'][_0xebed('0x48')](_0x3b52a9[_0xebed('0x49')],{})['then'](respondWithResult(_0x4f0693,0xc9))[_0xebed('0x42')](handleError(_0x4f0693,null));};exports[_0xebed('0x22')]=function(_0x14484a,_0x269b1c){if(_0x14484a[_0xebed('0x49')]['id']){delete _0x14484a[_0xebed('0x49')]['id'];}return db[_0xebed('0x2b')][_0xebed('0x47')]({'where':{'id':_0x14484a[_0xebed('0x43')]['id']}})[_0xebed('0x23')](handleEntityNotFound(_0x269b1c,null))['then'](saveUpdates(_0x14484a[_0xebed('0x49')],null))['then'](respondWithResult(_0x269b1c,null))['catch'](handleError(_0x269b1c,null));};exports[_0xebed('0x24')]=function(_0x1c69c2,_0x509342){return db[_0xebed('0x2b')][_0xebed('0x47')]({'where':{'id':_0x1c69c2['params']['id']}})[_0xebed('0x23')](handleEntityNotFound(_0x509342,null))[_0xebed('0x23')](removeEntity(_0x509342,null))[_0xebed('0x42')](handleError(_0x509342,null));}; \ No newline at end of file +var _0xc66a=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','FaxApplication','includeAll','include','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x57f9b5,_0x3a1265){var _0x38856d=function(_0x1f5d18){while(--_0x1f5d18){_0x57f9b5['push'](_0x57f9b5['shift']());}};_0x38856d(++_0x3a1265);}(_0xc66a,0xc4));var _0xac66=function(_0xc9b5aa,_0x333191){_0xc9b5aa=_0xc9b5aa-0x0;var _0x204667=_0xc66a[_0xc9b5aa];return _0x204667;};'use strict';var emlformat=require(_0xac66('0x0'));var rimraf=require(_0xac66('0x1'));var zipdir=require(_0xac66('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac66('0x3'));var moment=require('moment');var BPromise=require(_0xac66('0x4'));var Mustache=require(_0xac66('0x5'));var util=require('util');var path=require(_0xac66('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(_0xac66('0x7'));var squel=require('squel');var crypto=require(_0xac66('0x8'));var jsforce=require(_0xac66('0x9'));var deskjs=require(_0xac66('0xa'));var toCsv=require(_0xac66('0xb'));var querystring=require(_0xac66('0xc'));var Papa=require(_0xac66('0xd'));var Redis=require(_0xac66('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xac66('0xf'));var as=require(_0xac66('0x10'));var hardwareService=require(_0xac66('0x11'));var logger=require(_0xac66('0x12'))(_0xac66('0x13'));var utils=require(_0xac66('0x14'));var config=require(_0xac66('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xac66('0x16'))['db'];function respondWithStatusCode(_0x1f6670,_0x3fc4ab){_0x3fc4ab=_0x3fc4ab||0xcc;return function(_0x36c93b){if(_0x36c93b){return _0x1f6670['sendStatus'](_0x3fc4ab);}return _0x1f6670[_0xac66('0x17')](_0x3fc4ab)[_0xac66('0x18')]();};}function respondWithResult(_0x3d9dcd,_0x2cad27){_0x2cad27=_0x2cad27||0xc8;return function(_0x317ce7){if(_0x317ce7){return _0x3d9dcd[_0xac66('0x17')](_0x2cad27)[_0xac66('0x19')](_0x317ce7);}};}function respondWithFilteredResult(_0x1cdafd,_0x209e3b){return function(_0x1755c0){if(_0x1755c0){var _0x5be177=_0x1755c0['count'],_0x3ac21e=_0x209e3b[_0xac66('0x1a')],_0x4677e7=_0x209e3b[_0xac66('0x1a')]+_0x209e3b['limit'],_0x4c7dbf;if(_0x4677e7>=_0x5be177){_0x4677e7=_0x5be177;_0x4c7dbf=0xc8;}else{_0x4c7dbf=0xce;}_0x1cdafd[_0xac66('0x17')](_0x4c7dbf);return _0x1cdafd[_0xac66('0x1b')]('Content-Range',_0x3ac21e+'-'+_0x4677e7+'/'+_0x5be177)['json'](_0x1755c0);}return null;};}function patchUpdates(_0x2ee760){return function(_0xfa4675){try{jsonpatch[_0xac66('0x1c')](_0xfa4675,_0x2ee760,!![]);}catch(_0x29fa12){return BPromise[_0xac66('0x1d')](_0x29fa12);}return _0xfa4675[_0xac66('0x1e')]();};}function saveUpdates(_0x10e43d,_0x32116c){return function(_0x3e6c5e){if(_0x3e6c5e){return _0x3e6c5e[_0xac66('0x1f')](_0x10e43d)[_0xac66('0x20')](function(_0x171a9){return _0x171a9;});}return null;};}function removeEntity(_0x235dd8,_0x1bbae4){return function(_0x367af1){if(_0x367af1){return _0x367af1[_0xac66('0x21')]()[_0xac66('0x20')](function(){_0x235dd8[_0xac66('0x17')](0xcc)[_0xac66('0x18')]();});}};}function handleEntityNotFound(_0x12a0d8,_0x2e6a93){return function(_0x1baa74){if(!_0x1baa74){_0x12a0d8['sendStatus'](0x194);}return _0x1baa74;};}function handleError(_0x5d6a2a,_0x49d996){_0x49d996=_0x49d996||0x1f4;return function(_0x4f7ffe){logger[_0xac66('0x22')](_0x4f7ffe[_0xac66('0x23')]);if(_0x4f7ffe[_0xac66('0x24')]){delete _0x4f7ffe[_0xac66('0x24')];}_0x5d6a2a['status'](_0x49d996)[_0xac66('0x25')](_0x4f7ffe);};}exports[_0xac66('0x26')]=function(_0x588803,_0x4a8113){var _0xfb30c2={},_0x3d5257={},_0x49db13={'count':0x0,'rows':[]};var _0x43c79e=_[_0xac66('0x27')](db['FaxApplication'][_0xac66('0x28')],function(_0x4be16a){return{'name':_0x4be16a[_0xac66('0x29')],'type':_0x4be16a[_0xac66('0x2a')][_0xac66('0x2b')]};});_0x3d5257[_0xac66('0x2c')]=_[_0xac66('0x27')](_0x43c79e,_0xac66('0x24'));_0x3d5257[_0xac66('0x2d')]=_['keys'](_0x588803['query']);_0x3d5257[_0xac66('0x2e')]=_[_0xac66('0x2f')](_0x3d5257['model'],_0x3d5257[_0xac66('0x2d')]);_0xfb30c2[_0xac66('0x30')]=_['intersection'](_0x3d5257['model'],qs[_0xac66('0x31')](_0x588803[_0xac66('0x2d')]['fields']));_0xfb30c2['attributes']=_0xfb30c2[_0xac66('0x30')][_0xac66('0x32')]?_0xfb30c2[_0xac66('0x30')]:_0x3d5257['model'];if(!_0x588803[_0xac66('0x2d')][_0xac66('0x33')]('nolimit')){_0xfb30c2[_0xac66('0x34')]=qs[_0xac66('0x34')](_0x588803['query']['limit']);_0xfb30c2[_0xac66('0x1a')]=qs[_0xac66('0x1a')](_0x588803[_0xac66('0x2d')][_0xac66('0x1a')]);}_0xfb30c2[_0xac66('0x35')]=qs[_0xac66('0x36')](_0x588803[_0xac66('0x2d')][_0xac66('0x36')]);_0xfb30c2[_0xac66('0x37')]=qs[_0xac66('0x2e')](_['pick'](_0x588803['query'],_0x3d5257[_0xac66('0x2e')]),_0x43c79e);if(_0x588803[_0xac66('0x2d')][_0xac66('0x38')]){_0xfb30c2[_0xac66('0x37')]=_[_0xac66('0x39')](_0xfb30c2[_0xac66('0x37')],{'$or':_['map'](_0x43c79e,function(_0x5b8234){if(_0x5b8234['type']!==_0xac66('0x3a')){var _0xaca985={};_0xaca985[_0x5b8234[_0xac66('0x24')]]={'$like':'%'+_0x588803[_0xac66('0x2d')][_0xac66('0x38')]+'%'};return _0xaca985;}})});}_0xfb30c2=_['merge']({},_0xfb30c2,_0x588803[_0xac66('0x3b')]);var _0x1666e8={'where':_0xfb30c2['where']};return db[_0xac66('0x3c')]['count'](_0x1666e8)[_0xac66('0x20')](function(_0x4fba8f){_0x49db13['count']=_0x4fba8f;if(_0x588803['query'][_0xac66('0x3d')]){_0xfb30c2[_0xac66('0x3e')]=[{'all':!![]}];}return db[_0xac66('0x3c')]['findAll'](_0xfb30c2);})[_0xac66('0x20')](function(_0x6e2943){_0x49db13[_0xac66('0x3f')]=_0x6e2943;return _0x49db13;})[_0xac66('0x20')](respondWithFilteredResult(_0x4a8113,_0xfb30c2))[_0xac66('0x40')](handleError(_0x4a8113,null));};exports[_0xac66('0x41')]=function(_0x598424,_0x2818a6){var _0x3d1a44={'raw':!![],'where':{'id':_0x598424[_0xac66('0x42')]['id']}},_0x335dce={};_0x335dce[_0xac66('0x2c')]=_['keys'](db[_0xac66('0x3c')][_0xac66('0x28')]);_0x335dce[_0xac66('0x2d')]=_[_0xac66('0x43')](_0x598424[_0xac66('0x2d')]);_0x335dce['filters']=_[_0xac66('0x2f')](_0x335dce[_0xac66('0x2c')],_0x335dce[_0xac66('0x2d')]);_0x3d1a44['attributes']=_['intersection'](_0x335dce[_0xac66('0x2c')],qs['fields'](_0x598424['query'][_0xac66('0x31')]));_0x3d1a44['attributes']=_0x3d1a44[_0xac66('0x30')][_0xac66('0x32')]?_0x3d1a44[_0xac66('0x30')]:_0x335dce['model'];if(_0x598424['query']['includeAll']){_0x3d1a44['include']=[{'all':!![]}];}_0x3d1a44=_[_0xac66('0x39')]({},_0x3d1a44,_0x598424[_0xac66('0x3b')]);return db[_0xac66('0x3c')][_0xac66('0x44')](_0x3d1a44)[_0xac66('0x20')](handleEntityNotFound(_0x2818a6,null))[_0xac66('0x20')](respondWithResult(_0x2818a6,null))[_0xac66('0x40')](handleError(_0x2818a6,null));};exports[_0xac66('0x45')]=function(_0x450b29,_0x567528){return db[_0xac66('0x3c')]['create'](_0x450b29[_0xac66('0x46')],{})[_0xac66('0x20')](respondWithResult(_0x567528,0xc9))[_0xac66('0x40')](handleError(_0x567528,null));};exports[_0xac66('0x1f')]=function(_0x40fca6,_0x39194a){if(_0x40fca6[_0xac66('0x46')]['id']){delete _0x40fca6[_0xac66('0x46')]['id'];}return db[_0xac66('0x3c')][_0xac66('0x44')]({'where':{'id':_0x40fca6[_0xac66('0x42')]['id']}})[_0xac66('0x20')](handleEntityNotFound(_0x39194a,null))[_0xac66('0x20')](saveUpdates(_0x40fca6['body'],null))['then'](respondWithResult(_0x39194a,null))['catch'](handleError(_0x39194a,null));};exports[_0xac66('0x21')]=function(_0x2eaa9d,_0x17448b){return db[_0xac66('0x3c')]['find']({'where':{'id':_0x2eaa9d['params']['id']}})['then'](handleEntityNotFound(_0x17448b,null))[_0xac66('0x20')](removeEntity(_0x17448b,null))[_0xac66('0x40')](handleError(_0x17448b,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 94b40f7..8d2a102 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 _0xe240=['rimraf','./faxApplication.attributes','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x4d82ea,_0x4d459f){var _0x257f4a=function(_0x424c4f){while(--_0x424c4f){_0x4d82ea['push'](_0x4d82ea['shift']());}};_0x257f4a(++_0x4d459f);}(_0xe240,0xca));var _0x0e24=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xe240[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0x0e24('0x0'));var util=require(_0x0e24('0x1'));var logger=require(_0x0e24('0x2'))(_0x0e24('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0e24('0x4'));var fs=require('fs');var path=require(_0x0e24('0x5'));var rimraf=require(_0x0e24('0x6'));var config=require('../../config/environment');var attributes=require(_0x0e24('0x7'));module['exports']=function(_0x9bef71,_0xa2e566){return _0x9bef71[_0x0e24('0x8')](_0x0e24('0x9'),attributes,{'tableName':_0x0e24('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0e24('0xb'),'collate':_0x0e24('0xc')});}; \ No newline at end of file +var _0x8ecc=['../../config/environment','FaxApplication','fax_applications','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x6690db,_0x165080){var _0x493db2=function(_0x3a02a5){while(--_0x3a02a5){_0x6690db['push'](_0x6690db['shift']());}};_0x493db2(++_0x165080);}(_0x8ecc,0xc1));var _0xc8ec=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8ecc[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc8ec('0x0'))(_0xc8ec('0x1'));var moment=require(_0xc8ec('0x2'));var BPromise=require(_0xc8ec('0x3'));var rp=require(_0xc8ec('0x4'));var fs=require('fs');var path=require(_0xc8ec('0x5'));var rimraf=require(_0xc8ec('0x6'));var config=require(_0xc8ec('0x7'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0x3c487b,_0x1cc57f){return _0x3c487b['define'](_0xc8ec('0x8'),attributes,{'tableName':_0xc8ec('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 8cb7a11..48e53c2 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 _0xd9fa=['../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateFaxApplication','FaxApplication','update','options','raw','where','attributes','limit','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2493f7,_0x49c670){var _0x594ab2=function(_0x344ec2){while(--_0x344ec2){_0x2493f7['push'](_0x2493f7['shift']());}};_0x594ab2(++_0x49c670);}(_0xd9fa,0x95));var _0xad9f=function(_0xe1addc,_0x5693bc){_0xe1addc=_0xe1addc-0x0;var _0xec7b39=_0xd9fa[_0xe1addc];return _0xec7b39;};'use strict';var _=require(_0xad9f('0x0'));var util=require(_0xad9f('0x1'));var moment=require(_0xad9f('0x2'));var BPromise=require(_0xad9f('0x3'));var rs=require(_0xad9f('0x4'));var fs=require('fs');var Redis=require(_0xad9f('0x5'));var db=require(_0xad9f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xad9f('0x7'))(_0xad9f('0x8'));var config=require(_0xad9f('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x469b4b,_0x2c840f,_0x59c626){return new BPromise(function(_0x20fbbb,_0x19b1bc){return client[_0xad9f('0xa')](_0x469b4b,_0x59c626)[_0xad9f('0xb')](function(_0x1c7cd3){logger[_0xad9f('0xc')](_0xad9f('0xd'),_0x2c840f,_0xad9f('0xe'));logger[_0xad9f('0xf')](_0xad9f('0x10'),_0x2c840f,'request\x20sent',JSON[_0xad9f('0x11')](_0x1c7cd3));if(_0x1c7cd3[_0xad9f('0x12')]){if(_0x1c7cd3[_0xad9f('0x12')][_0xad9f('0x13')]===0x1f4){logger[_0xad9f('0x12')](_0xad9f('0xd'),_0x2c840f,_0x1c7cd3[_0xad9f('0x12')][_0xad9f('0x14')]);return _0x19b1bc(_0x1c7cd3[_0xad9f('0x12')][_0xad9f('0x14')]);}logger['error'](_0xad9f('0xd'),_0x2c840f,_0x1c7cd3[_0xad9f('0x12')][_0xad9f('0x14')]);return _0x20fbbb(_0x1c7cd3[_0xad9f('0x12')]['message']);}else{logger[_0xad9f('0xc')](_0xad9f('0xd'),_0x2c840f,_0xad9f('0xe'));_0x20fbbb(_0x1c7cd3[_0xad9f('0x15')][_0xad9f('0x14')]);}})['catch'](function(_0x59bed4){logger[_0xad9f('0x12')]('FaxApplication,\x20%s,\x20%s',_0x2c840f,_0x59bed4);_0x19b1bc(_0x59bed4);});});}exports[_0xad9f('0x16')]=function(_0x5c95fb){var _0x133fe1=this;return new Promise(function(_0x11d446,_0x33e78b){return db[_0xad9f('0x17')][_0xad9f('0x18')](_0x5c95fb['body'],{'raw':_0x5c95fb[_0xad9f('0x19')]?_0x5c95fb['options'][_0xad9f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c95fb[_0xad9f('0x19')]?_0x5c95fb[_0xad9f('0x19')][_0xad9f('0x1b')]||null:null,'attributes':_0x5c95fb[_0xad9f('0x19')]?_0x5c95fb[_0xad9f('0x19')][_0xad9f('0x1c')]||null:null,'limit':_0x5c95fb[_0xad9f('0x19')]?_0x5c95fb['options'][_0xad9f('0x1d')]||null:null})['then'](function(_0x5a6b1a){logger[_0xad9f('0xc')](_0xad9f('0x16'),_0x5c95fb);logger['debug'](_0xad9f('0x16'),_0x5c95fb,JSON[_0xad9f('0x11')](_0x5a6b1a));_0x11d446(_0x5a6b1a);})[_0xad9f('0x1e')](function(_0x277ccc){logger[_0xad9f('0x12')](_0xad9f('0x16'),_0x277ccc[_0xad9f('0x14')],_0x5c95fb);_0x33e78b(_0x133fe1[_0xad9f('0x12')](0x1f4,_0x277ccc[_0xad9f('0x14')]));});});}; \ No newline at end of file +var _0xcbe9=['info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xcbe9,0x7a));var _0x9cbe=function(_0x11632a,_0x3ea9d5){_0x11632a=_0x11632a-0x0;var _0x45280a=_0xcbe9[_0x11632a];return _0x45280a;};'use strict';var _=require(_0x9cbe('0x0'));var util=require(_0x9cbe('0x1'));var moment=require(_0x9cbe('0x2'));var BPromise=require(_0x9cbe('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9cbe('0x4'));var db=require(_0x9cbe('0x5'))['db'];var utils=require(_0x9cbe('0x6'));var logger=require(_0x9cbe('0x7'))(_0x9cbe('0x8'));var config=require(_0x9cbe('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9cbe('0xa')][_0x9cbe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45c7bc,_0x1d4dd1,_0x9ad671){return new BPromise(function(_0x2d8ced,_0x21b349){return client[_0x9cbe('0xc')](_0x45c7bc,_0x9ad671)[_0x9cbe('0xd')](function(_0x4c8ff5){logger[_0x9cbe('0xe')](_0x9cbe('0xf'),_0x1d4dd1,_0x9cbe('0x10'));logger[_0x9cbe('0x11')](_0x9cbe('0x12'),_0x1d4dd1,'request\x20sent',JSON[_0x9cbe('0x13')](_0x4c8ff5));if(_0x4c8ff5['error']){if(_0x4c8ff5[_0x9cbe('0x14')][_0x9cbe('0x15')]===0x1f4){logger[_0x9cbe('0x14')](_0x9cbe('0xf'),_0x1d4dd1,_0x4c8ff5[_0x9cbe('0x14')][_0x9cbe('0x16')]);return _0x21b349(_0x4c8ff5['error'][_0x9cbe('0x16')]);}logger[_0x9cbe('0x14')](_0x9cbe('0xf'),_0x1d4dd1,_0x4c8ff5[_0x9cbe('0x14')][_0x9cbe('0x16')]);return _0x2d8ced(_0x4c8ff5[_0x9cbe('0x14')]['message']);}else{logger[_0x9cbe('0xe')](_0x9cbe('0xf'),_0x1d4dd1,'request\x20sent');_0x2d8ced(_0x4c8ff5[_0x9cbe('0x17')][_0x9cbe('0x16')]);}})['catch'](function(_0xb9b19c){logger[_0x9cbe('0x14')](_0x9cbe('0xf'),_0x1d4dd1,_0xb9b19c);_0x21b349(_0xb9b19c);});});}exports[_0x9cbe('0x18')]=function(_0x4ff58d){var _0x452e9c=this;return new Promise(function(_0x3f766e,_0x1e4f9b){return db[_0x9cbe('0x19')][_0x9cbe('0x1a')](_0x4ff58d[_0x9cbe('0x1b')],{'raw':_0x4ff58d[_0x9cbe('0x1c')]?_0x4ff58d[_0x9cbe('0x1c')][_0x9cbe('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ff58d['options']?_0x4ff58d[_0x9cbe('0x1c')][_0x9cbe('0x1e')]||null:null,'attributes':_0x4ff58d[_0x9cbe('0x1c')]?_0x4ff58d[_0x9cbe('0x1c')][_0x9cbe('0x1f')]||null:null,'limit':_0x4ff58d['options']?_0x4ff58d['options'][_0x9cbe('0x20')]||null:null})[_0x9cbe('0xd')](function(_0x44a51b){logger[_0x9cbe('0xe')](_0x9cbe('0x18'),_0x4ff58d);logger[_0x9cbe('0x11')](_0x9cbe('0x18'),_0x4ff58d,JSON[_0x9cbe('0x13')](_0x44a51b));_0x3f766e(_0x44a51b);})[_0x9cbe('0x21')](function(_0x5d0b9e){logger[_0x9cbe('0x14')](_0x9cbe('0x18'),_0x5d0b9e['message'],_0x4ff58d);_0x1e4f9b(_0x452e9c['error'](0x1f4,_0x5d0b9e[_0x9cbe('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 55bbcf1..12a7996 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 _0x1f93=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index'];(function(_0x4ffa03,_0x363a82){var _0x30d661=function(_0x36ba86){while(--_0x36ba86){_0x4ffa03['push'](_0x4ffa03['shift']());}};_0x30d661(++_0x363a82);}(_0x1f93,0x9c));var _0x31f9=function(_0x189e13,_0x43b4fb){_0x189e13=_0x189e13-0x0;var _0x28f8b5=_0x1f93[_0x189e13];return _0x28f8b5;};'use strict';var multer=require(_0x31f9('0x0'));var util=require(_0x31f9('0x1'));var path=require(_0x31f9('0x2'));var timeout=require(_0x31f9('0x3'));var express=require(_0x31f9('0x4'));var router=express['Router']();var fs_extra=require(_0x31f9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x31f9('0x6'));var config=require(_0x31f9('0x7'));var controller=require(_0x31f9('0x8'));router[_0x31f9('0x9')]('/',auth[_0x31f9('0xa')](),controller[_0x31f9('0xb')]);router[_0x31f9('0x9')](_0x31f9('0xc'),auth[_0x31f9('0xa')](),controller[_0x31f9('0xd')]);router[_0x31f9('0xe')]('/',auth[_0x31f9('0xa')](),controller[_0x31f9('0xf')]);router[_0x31f9('0x10')](_0x31f9('0xc'),auth[_0x31f9('0xa')](),controller[_0x31f9('0x11')]);router[_0x31f9('0x12')](_0x31f9('0xc'),auth[_0x31f9('0xa')](),controller[_0x31f9('0x13')]);module[_0x31f9('0x14')]=router; \ No newline at end of file +var _0xb9b1=['express','Router','../../components/interaction/service','./faxApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x21fda0,_0x492dcc){var _0xa39199=function(_0x1f0662){while(--_0x1f0662){_0x21fda0['push'](_0x21fda0['shift']());}};_0xa39199(++_0x492dcc);}(_0xb9b1,0xb1));var _0x1b9b=function(_0x15e83d,_0x33ffff){_0x15e83d=_0x15e83d-0x0;var _0x27a734=_0xb9b1[_0x15e83d];return _0x27a734;};'use strict';var multer=require(_0x1b9b('0x0'));var util=require(_0x1b9b('0x1'));var path=require(_0x1b9b('0x2'));var timeout=require('connect-timeout');var express=require(_0x1b9b('0x3'));var router=express[_0x1b9b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1b9b('0x5'));var config=require('../../config/environment');var controller=require(_0x1b9b('0x6'));router[_0x1b9b('0x7')]('/',auth['isAuthenticated'](),controller[_0x1b9b('0x8')]);router[_0x1b9b('0x7')](_0x1b9b('0x9'),auth[_0x1b9b('0xa')](),controller[_0x1b9b('0xb')]);router[_0x1b9b('0xc')]('/',auth[_0x1b9b('0xa')](),controller[_0x1b9b('0xd')]);router[_0x1b9b('0xe')](_0x1b9b('0x9'),auth[_0x1b9b('0xa')](),controller[_0x1b9b('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1b9b('0x10')]);module[_0x1b9b('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 1922cf4..114d7fc 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 _0x24ca=['sequelize','DATE','STRING','ENUM','out'];(function(_0x56b886,_0x1ff474){var _0x164baf=function(_0x575d09){while(--_0x575d09){_0x56b886['push'](_0x56b886['shift']());}};_0x164baf(++_0x1ff474);}(_0x24ca,0x8c));var _0xa24c=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0x24ca[_0x2c3255];return _0x282aba;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa24c('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa24c('0x2')]},'thirdDisposition':{'type':Sequelize[_0xa24c('0x2')]},'note':{'type':Sequelize[_0xa24c('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xa24c('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xa24c('0x3')]('in',_0xa24c('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xd6bb=['DATE','STRING','ENUM','out','sequelize','BOOLEAN'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xd6bb,0x1cc));var _0xbd6b=function(_0x4b26b5,_0x4f71fd){_0x4b26b5=_0x4b26b5-0x0;var _0x4dec71=_0xd6bb[_0x4b26b5];return _0x4dec71;};'use strict';var Sequelize=require(_0xbd6b('0x0'));module['exports']={'closed':{'type':Sequelize[_0xbd6b('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbd6b('0x2')]},'disposition':{'type':Sequelize[_0xbd6b('0x3')]},'secondDisposition':{'type':Sequelize[_0xbd6b('0x3')]},'thirdDisposition':{'type':Sequelize[_0xbd6b('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xbd6b('0x2')]},'fax':{'type':Sequelize[_0xbd6b('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xbd6b('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbd6b('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xbd6b('0x4')]('in',_0xbd6b('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index fee9249..2869310 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 _0xacdc=['unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./faxInteraction.socket','status','end','json','count','offset','set','Content-Range','apply','destroy','sendStatus','error','name','send','Users','Tags','split','push','TagIds','then','index','map','FaxInteraction','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','select','field','color','from','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','length','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)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','keys','some','isEmpty','forEach','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','isNumeric','i.fax\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.FaxAccountId\x20IS\x20NOT\x20NULL','agent','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','all','rows','show','params','includeAll','include','options','catch','create','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','Tag','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','format','transcript-%d-%s.zip','Messages','get','Attachment','existsSync','createReadStream','createWriteStream','basename','log'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xacdc,0x1a9));var _0xcacd=function(_0x203ea9,_0x369198){_0x203ea9=_0x203ea9-0x0;var _0x274da6=_0xacdc[_0x203ea9];return _0x274da6;};'use strict';var emlformat=require(_0xcacd('0x0'));var rimraf=require(_0xcacd('0x1'));var zipdir=require(_0xcacd('0x2'));var jsonpatch=require(_0xcacd('0x3'));var rp=require(_0xcacd('0x4'));var moment=require(_0xcacd('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcacd('0x6'));var path=require(_0xcacd('0x7'));var sox=require(_0xcacd('0x8'));var csv=require(_0xcacd('0x9'));var ejs=require(_0xcacd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcacd('0xb'));var crypto=require(_0xcacd('0xc'));var jsforce=require(_0xcacd('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcacd('0x9'));var querystring=require(_0xcacd('0xe'));var Papa=require(_0xcacd('0xf'));var Redis=require(_0xcacd('0x10'));var authService=require(_0xcacd('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xcacd('0x12'));var hardwareService=require(_0xcacd('0x13'));var logger=require('../../config/logger')(_0xcacd('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcacd('0x15'));var db=require(_0xcacd('0x16'))['db'];config['redis']=_[_0xcacd('0x17')](config['redis'],{'host':_0xcacd('0x18'),'port':0x18eb});var socket=require(_0xcacd('0x19'))(new Redis(config['redis']));require(_0xcacd('0x1a'))['register'](socket);function respondWithStatusCode(_0x5d62c2,_0x3eaac9){_0x3eaac9=_0x3eaac9||0xcc;return function(_0x4a111c){if(_0x4a111c){return _0x5d62c2['sendStatus'](_0x3eaac9);}return _0x5d62c2[_0xcacd('0x1b')](_0x3eaac9)[_0xcacd('0x1c')]();};}function respondWithResult(_0x7b0179,_0x144e12){_0x144e12=_0x144e12||0xc8;return function(_0x2a5056){if(_0x2a5056){return _0x7b0179[_0xcacd('0x1b')](_0x144e12)[_0xcacd('0x1d')](_0x2a5056);}};}function respondWithFilteredResult(_0x262c94,_0x47a333){return function(_0x5df2a6){if(_0x5df2a6){var _0x22df86=_0x5df2a6[_0xcacd('0x1e')],_0x54f5b3=_0x47a333[_0xcacd('0x1f')],_0x3eee05=_0x47a333[_0xcacd('0x1f')]+_0x47a333['limit'],_0x227474;if(_0x3eee05>=_0x22df86){_0x3eee05=_0x22df86;_0x227474=0xc8;}else{_0x227474=0xce;}_0x262c94[_0xcacd('0x1b')](_0x227474);return _0x262c94[_0xcacd('0x20')](_0xcacd('0x21'),_0x54f5b3+'-'+_0x3eee05+'/'+_0x22df86)[_0xcacd('0x1d')](_0x5df2a6);}return null;};}function patchUpdates(_0x336105){return function(_0x368919){try{jsonpatch[_0xcacd('0x22')](_0x368919,_0x336105,!![]);}catch(_0x46cc4a){return BPromise['reject'](_0x46cc4a);}return _0x368919['save']();};}function saveUpdates(_0x53f0fe,_0x1ca6d5){return function(_0x255acf){if(_0x255acf){return _0x255acf['update'](_0x53f0fe)['then'](function(_0x4d4f95){return _0x4d4f95;});}return null;};}function removeEntity(_0x2d1909,_0x573e43){return function(_0x3f2891){if(_0x3f2891){return _0x3f2891[_0xcacd('0x23')]()['then'](function(){_0x2d1909['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2009de,_0x2d475a){return function(_0x5c6bfe){if(!_0x5c6bfe){_0x2009de[_0xcacd('0x24')](0x194);}return _0x5c6bfe;};}function handleError(_0x1d2474,_0x5c6ff9){_0x5c6ff9=_0x5c6ff9||0x1f4;return function(_0x2f3df4){logger[_0xcacd('0x25')](_0x2f3df4['stack']);if(_0x2f3df4[_0xcacd('0x26')]){delete _0x2f3df4[_0xcacd('0x26')];}_0x1d2474[_0xcacd('0x1b')](_0x5c6ff9)[_0xcacd('0x27')](_0x2f3df4);};}function getInteractionUsers(_0x41ad8b,_0x418031){return new BPromise(function(_0x173f96,_0x1ce238){try{if(_0x418031[_0x41ad8b['id']]){_0x41ad8b[_0xcacd('0x28')]=_['map'](_0x418031[_0x41ad8b['id']],function(_0x19eb8d){return{'id':_0x19eb8d['id'],'fullname':_0x19eb8d['fullname']};});}}catch(_0x1c91d8){_0x1ce238(_0x1c91d8);}_0x173f96(_0x41ad8b);});}function getInteractionTags(_0x41b42d,_0x48a0a0){return new BPromise(function(_0x2db62e,_0x131806){try{if(_0x41b42d['TagIds']){_0x41b42d[_0xcacd('0x29')]=[];_0x41b42d['TagIds'][_0xcacd('0x2a')](',')['forEach'](function(_0x1f6566){_0x41b42d[_0xcacd('0x29')][_0xcacd('0x2b')](_0x48a0a0[_0x1f6566]);});}delete _0x41b42d[_0xcacd('0x2c')];}catch(_0x1dec50){_0x131806(_0x1dec50);}_0x2db62e(_0x41b42d);});}function updateFaxInteraction(_0x495140,_0x24ad66,_0x285a1a){return new BPromise(function(_0x177d2f,_0x4e3123){return getInteractionUsers(_0x495140,_0x285a1a)[_0xcacd('0x2d')](function(_0x59ab78){return getInteractionTags(_0x59ab78,_0x24ad66);})['then'](function(_0x1420fd){_0x177d2f(_0x1420fd);})['catch'](function(_0x519714){_0x4e3123(_0x519714);});});}exports[_0xcacd('0x2e')]=function(_0xbbd920,_0x45e35f){var _0x2f3a93={},_0x45bc38={},_0x59d4fc={'count':0x0,'rows':[]};var _0xbbda0f=_[_0xcacd('0x2f')](db[_0xcacd('0x30')][_0xcacd('0x31')],function(_0x43a1e5){return{'name':_0x43a1e5[_0xcacd('0x32')],'type':_0x43a1e5[_0xcacd('0x33')]['key']};});_0x45bc38[_0xcacd('0x34')]=_['map'](_0xbbda0f,_0xcacd('0x26'));_0x45bc38[_0xcacd('0x35')]=_['keys'](_0xbbd920[_0xcacd('0x35')]);_0x45bc38['filters']=_[_0xcacd('0x36')](_0x45bc38[_0xcacd('0x34')],_0x45bc38['query']);_0x2f3a93[_0xcacd('0x37')]=_['intersection'](_0x45bc38[_0xcacd('0x34')],qs['fields'](_0xbbd920[_0xcacd('0x35')][_0xcacd('0x38')]));_0x2f3a93[_0xcacd('0x37')]=_0x2f3a93['attributes']['length']?_0x2f3a93[_0xcacd('0x37')]:_0x45bc38[_0xcacd('0x34')];if(!_0xbbd920[_0xcacd('0x35')][_0xcacd('0x39')](_0xcacd('0x3a'))){_0x2f3a93[_0xcacd('0x3b')]=qs['limit'](_0xbbd920[_0xcacd('0x35')][_0xcacd('0x3b')]);_0x2f3a93[_0xcacd('0x1f')]=qs['offset'](_0xbbd920['query']['offset']);}_0x2f3a93[_0xcacd('0x3c')]=qs[_0xcacd('0x3d')](_0xbbd920['query'][_0xcacd('0x3d')]);_0x2f3a93[_0xcacd('0x3e')]=qs['filters'](_[_0xcacd('0x3f')](_0xbbd920[_0xcacd('0x35')],_0x45bc38[_0xcacd('0x40')]),_0xbbda0f);var _0x572a11=[];var _0x5da182=squel[_0xcacd('0x41')]()[_0xcacd('0x42')]('id')[_0xcacd('0x42')](_0xcacd('0x26'))[_0xcacd('0x42')](_0xcacd('0x43'))[_0xcacd('0x44')]('tools_tags');var _0x1f0424=squel['select']()[_0xcacd('0x42')](_0xcacd('0x45'))['field'](_0xcacd('0x46'))['field'](_0xcacd('0x47'))[_0xcacd('0x44')](_0xcacd('0x48'),'ui')['left_join'](_0xcacd('0x49'),'u',_0xcacd('0x4a'));var _0xe71fe7=squel[_0xcacd('0x41')]()[_0xcacd('0x44')]('fax_interactions','i')[_0xcacd('0x4b')](_0xcacd('0x4c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xcacd('0x49'),'o',_0xcacd('0x4d'))[_0xcacd('0x4b')](_0xcacd('0x4e'),'a',_0xcacd('0x4f'))[_0xcacd('0x4b')](_0xcacd('0x50'),'me','me.FaxInteractionId\x20=\x20i.id')[_0xcacd('0x4b')](_0xcacd('0x51'),'it','it.FaxInteractionId\x20=\x20i.id')['left_join'](_0xcacd('0x52'),'t',_0xcacd('0x53'));var _0x1a1ab2=squel[_0xcacd('0x54')]();var _0x48cda4=[];var _0x579853=squel[_0xcacd('0x54')]();var _0x5c09e6;if(_0xbbd920[_0xcacd('0x35')]['search']){_0x5c09e6=as[_0xcacd('0x55')](_0xbbd920[_0xcacd('0x35')][_0xcacd('0x56')]);var _0x4f7628=_0x5c09e6[_0xcacd('0x57')];for(var _0x2668c6=0x0;_0x2668c6<_0x5c09e6[_0xcacd('0x58')][_0xcacd('0x59')];_0x2668c6++){var _0x2ad517=_0x5c09e6[_0xcacd('0x58')][_0x2668c6];var _0x4e8457='i';var _0x11d050=_[_0xcacd('0x5a')](_0xbbda0f,[_0xcacd('0x26'),_0x2ad517[_0xcacd('0x42')]]);if(!_0x11d050){switch(_0x2ad517[_0xcacd('0x42')]){case _0xcacd('0x5b'):if(_0x2ad517[_0xcacd('0x5c')]==0x1){_0xe71fe7[_0xcacd('0x5d')]('`'+_0x2ad517[_0xcacd('0x42')]+_0xcacd('0x5e'));}else{_0xe71fe7[_0xcacd('0x5d')]('`'+_0x2ad517['field']+_0xcacd('0x5f'));}break;case'Contact':if(_0x2ad517[_0xcacd('0x60')]===_0xcacd('0x61')){if(_0x2ad517[_0xcacd('0x5c')][_0xcacd('0x2a')]('\x20')[_0xcacd('0x59')]>0x1){_0x1a1ab2[_0x4f7628](_0xcacd('0x62'),qs[_0xcacd('0x63')](_0x2ad517['value']),null);}else{var _0x27dd13='%'+_0x2ad517[_0xcacd('0x5c')]+'%';_0x1a1ab2[_0x4f7628](_0xcacd('0x64'),_0x27dd13,_0x27dd13,_0x27dd13);}}else{_0x11d050=_[_0xcacd('0x5a')](_0xbbda0f,[_0xcacd('0x26'),_0xcacd('0x65')]);_0x2ad517[_0xcacd('0x42')]=_0xcacd('0x65');_0x206c8d=as[_0xcacd('0x66')](_0x4e8457,_0x11d050[_0xcacd('0x33')],_0x2ad517);_0x1a1ab2[_0x4f7628](_0x206c8d[_0xcacd('0x67')],_0x206c8d[_0xcacd('0x5c')]['start'],_0x206c8d[_0xcacd('0x5c')][_0xcacd('0x1c')]);}break;case'Tag':var _0x266b3b=_0x2ad517[_0xcacd('0x5c')]['split'](',')['map'](function(_0x44310c){return Number(_0x44310c);});_0x266b3b['forEach'](function(_0x4a9032){_0x579853['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4a9032+',%');});_0x48cda4=_[_0xcacd('0x68')](_0x48cda4,_0x266b3b);break;case _0xcacd('0x69'):if(_0x2ad517[_0xcacd('0x60')]===_0xcacd('0x61')){_0x1a1ab2[_0x4f7628](_0xcacd('0x6a'),'%'+_0x2ad517[_0xcacd('0x5c')]+'%',null);}else{_0x11d050=_[_0xcacd('0x5a')](_0xbbda0f,['name',_0xcacd('0x6b')]);_0x2ad517['field']='UserId';_0x206c8d=as[_0xcacd('0x66')](_0x4e8457,_0x11d050[_0xcacd('0x33')],_0x2ad517);_0x1a1ab2[_0x4f7628](_0x206c8d[_0xcacd('0x67')],_0x206c8d[_0xcacd('0x5c')][_0xcacd('0x6c')],_0x206c8d[_0xcacd('0x5c')][_0xcacd('0x1c')]);}break;case _0xcacd('0x6d'):_0x206c8d=as[_0xcacd('0x66')]('me',null,_0x2ad517);_0x1a1ab2[_0x4f7628](_0x206c8d[_0xcacd('0x67')],_0x206c8d[_0xcacd('0x5c')][_0xcacd('0x6c')],_0x206c8d['value'][_0xcacd('0x1c')]);break;}}else{var _0x206c8d=as[_0xcacd('0x66')](_0x4e8457,_0x11d050[_0xcacd('0x33')],_0x2ad517);_0x1a1ab2[_0x4f7628](_0x206c8d[_0xcacd('0x67')],_0x206c8d[_0xcacd('0x5c')][_0xcacd('0x6c')],_0x206c8d['value']['end']);}}}else{var _0x2731aa=_(_0xbbd920['query'])[_0xcacd('0x6e')]()[_0xcacd('0x2f')](function(_0x5ab8c2){return _[_0xcacd('0x6f')](_0xbbda0f,[_0xcacd('0x26'),_0x5ab8c2])?_0x5ab8c2:undefined;})['compact']()[_0xcacd('0x5c')]();if(!_[_0xcacd('0x70')](_0x2731aa)){_0x2731aa[_0xcacd('0x71')](function(_0x4e378e){if(_0x4e378e===_0xcacd('0x72')){_0xe71fe7['where'](_0xcacd('0x73'),[][_0xcacd('0x74')](_0xbbd920[_0xcacd('0x35')][_0x4e378e]));}else if(_0x4e378e===_0xcacd('0x75')){var _0x159d3d=JSON[_0xcacd('0x76')](_0xbbd920[_0xcacd('0x35')][_0x4e378e])[_0xcacd('0x77')];var _0x285837=JSON['parse'](_0xbbd920[_0xcacd('0x35')][_0x4e378e])['$lte'];_0xe71fe7[_0xcacd('0x3e')](_0xcacd('0x78'),_0x159d3d,_0x285837);}else{if(_0xbbd920[_0xcacd('0x35')][_0x4e378e]===_0xcacd('0x79')){_0xe71fe7[_0xcacd('0x3e')]('i.'+_0x4e378e+'\x20IS\x20NULL');}else{_0xe71fe7['where']('i.'+_0x4e378e+_0xcacd('0x7a'),_0xbbd920['query'][_0x4e378e]);}}});}if(_0xbbd920[_0xcacd('0x35')]['read']){if(_0xbbd920[_0xcacd('0x35')][_0xcacd('0x7b')]==0x1){_0xe71fe7[_0xcacd('0x5d')](_0xcacd('0x7c'));}else{_0xe71fe7[_0xcacd('0x5d')](_0xcacd('0x7d'));}}if(_0xbbd920['query']['tag']){_0x48cda4=_[_0xcacd('0x7e')](_0xbbd920[_0xcacd('0x35')]['tag'])?_0xbbd920[_0xcacd('0x35')][_0xcacd('0x7f')]:new Array(_0xbbd920[_0xcacd('0x35')][_0xcacd('0x7f')]);_0x48cda4[_0xcacd('0x71')](function(_0x2131ef){_0x579853['or'](_0xcacd('0x80'),'%,'+_0x2131ef+',%');});}if(_0xbbd920[_0xcacd('0x35')]['filter']){var _0x5b387e=_0xbbd920[_0xcacd('0x35')][_0xcacd('0x81')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xcacd('0x82')](_0x5b387e)){_0x1a1ab2['or']('i.id\x20LIKE\x20?',_0x5b387e+'%')['or'](_0xcacd('0x83'),_0x5b387e+'%');}_0x1a1ab2['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x5b387e+'%');}}_0xe71fe7[_0xcacd('0x3e')](_0x1a1ab2);_0xe71fe7[_0xcacd('0x84')](_0xcacd('0x85'));var _0x9ad7d1={'type':db[_0xcacd('0x86')]['QueryTypes'][_0xcacd('0x87')],'raw':!![]};var _0x11261b=_0xe71fe7[_0xcacd('0x88')]();_0x11261b[_0xcacd('0x42')](_0xcacd('0x85'));_0x11261b[_0xcacd('0x42')](_0xcacd('0x89'),'unreadMessages');if(_0x2f3a93[_0xcacd('0x3c')]){_0x2f3a93['order'][_0xcacd('0x71')](function(_0x229bd1){var _0x2c29b8=_0x229bd1[0x0]===_0xcacd('0x8a')?_0x229bd1[0x0]:'i.'+_0x229bd1[0x0];_0xe71fe7[_0xcacd('0x3c')](_0x2c29b8,_0x229bd1[0x1]===_0xcacd('0x8b')?![]:!![]);});}if(!_['isEmpty'](_0x48cda4)){_0xe71fe7[_0xcacd('0x5d')](_0x579853);_0x11261b[_0xcacd('0x3e')](_0xcacd('0x8c'),_0x48cda4);}BPromise[_0xcacd('0x8d')]()['then'](function(){if(!_0x5c09e6){if(_0xbbd920[_0xcacd('0x35')][_0xcacd('0x72')])return;_0x11261b[_0xcacd('0x3e')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0xe71fe7['where'](_0xcacd('0x8e'));return;}if(_0xbbd920['user']['role']!==_0xcacd('0x8f'))return;return _0xbbd920[_0xcacd('0x90')][_0xcacd('0x91')]({'attributes':['id'],'raw':!![]})[_0xcacd('0x2d')](function(_0x10ac73){if(_[_0xcacd('0x70')](_0x10ac73)){_0x11261b[_0xcacd('0x3e')](_0xcacd('0x92'));_0xe71fe7['where'](_0xcacd('0x92'));}else{_0x11261b[_0xcacd('0x3e')](_0xcacd('0x73'),_[_0xcacd('0x2f')](_0x10ac73,'id'));_0xe71fe7[_0xcacd('0x3e')](_0xcacd('0x73'),_[_0xcacd('0x2f')](_0x10ac73,'id'));}});})[_0xcacd('0x2d')](function(){if(_0xbbd920[_0xcacd('0x90')]['role']==='agent'&&!_0x5c09e6&&!_0xbbd920[_0xcacd('0x35')][_0xcacd('0x72')])return[];return db[_0xcacd('0x93')][_0xcacd('0x35')](_0x11261b[_0xcacd('0x94')](),_0x9ad7d1);})[_0xcacd('0x2d')](function(_0x5a4625){_0x59d4fc[_0xcacd('0x1e')]=_0x5a4625['length'];if(_0x59d4fc[_0xcacd('0x1e')]===0x0)return[];return db[_0xcacd('0x93')][_0xcacd('0x35')](_0x5da182[_0xcacd('0x94')](),_0x9ad7d1)[_0xcacd('0x2d')](function(_0x1c2185){_0x572a11=_[_0xcacd('0x95')](_0x1c2185,'id');_0x9ad7d1=_[_0xcacd('0x96')](_0x9ad7d1,{'model':db[_0xcacd('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xbbd920[_0xcacd('0x35')][_0xcacd('0x38')]){_0x2f3a93['attributes'][_0xcacd('0x71')](function(_0x330eb7){_0xe71fe7['field']('i.'+_0x330eb7);});}else{_0xe71fe7[_0xcacd('0x42')](_0xcacd('0x89'),'unreadMessages');_0xe71fe7[_0xcacd('0x42')](_0xcacd('0x97'),'Account.key');_0xe71fe7[_0xcacd('0x42')](_0xcacd('0x98'),_0xcacd('0x99'));_0xe71fe7['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0xe71fe7[_0xcacd('0x42')]('i.*');_0xe71fe7['field']('c.firstName',_0xcacd('0x9a'));_0xe71fe7[_0xcacd('0x42')](_0xcacd('0x9b'),_0xcacd('0x9c'));_0xe71fe7[_0xcacd('0x42')](_0xcacd('0x9d'),'Contact.email');_0xe71fe7['field'](_0xcacd('0x9e'),_0xcacd('0x9f'));_0xe71fe7[_0xcacd('0x42')]('c.mobile',_0xcacd('0xa0'));_0xe71fe7[_0xcacd('0x42')](_0xcacd('0xa1'),_0xcacd('0xa2'));_0xe71fe7[_0xcacd('0x42')](_0xcacd('0xa3'),_0xcacd('0xa4'));_0xe71fe7[_0xcacd('0x42')](_0xcacd('0xa5'),_0xcacd('0xa6'));_0xe71fe7['field'](_0xcacd('0xa7'),_0xcacd('0x2c'));}if(_0x2f3a93[_0xcacd('0x3b')])_0xe71fe7['limit'](_0x2f3a93['limit']);if(_0x2f3a93[_0xcacd('0x1f')])_0xe71fe7[_0xcacd('0x1f')](_0x2f3a93[_0xcacd('0x1f')]);return db[_0xcacd('0x93')]['query'](_0xe71fe7[_0xcacd('0x94')](),_0x9ad7d1);})[_0xcacd('0x2d')](function(_0x535828){_0x1f0424[_0xcacd('0x3e')](_0xcacd('0xa8'),_[_0xcacd('0x2f')](_0x535828,'id'));return db[_0xcacd('0x93')][_0xcacd('0x35')](_0x1f0424[_0xcacd('0x94')](),_0x9ad7d1)[_0xcacd('0x2d')](function(_0x12953f){var _0x398414=_['groupBy'](_0x12953f,_0xcacd('0xa9'));var _0x51f816=[];_0x535828[_0xcacd('0x71')](function(_0x5d64fd){_0x51f816['push'](updateFaxInteraction(_0x5d64fd,_0x572a11,_0x398414));});return BPromise[_0xcacd('0xaa')](_0x51f816);});});})[_0xcacd('0x2d')](function(_0x3b95bd){_0x59d4fc[_0xcacd('0xab')]=_0x3b95bd;return _0x59d4fc;})[_0xcacd('0x2d')](respondWithFilteredResult(_0x45e35f,_0x2f3a93))['catch'](handleError(_0x45e35f,null));};exports[_0xcacd('0xac')]=function(_0x457def,_0x3cc34a){var _0x5617ea={'raw':![],'where':{'id':_0x457def[_0xcacd('0xad')]['id']}},_0x573761={};_0x573761['model']=_['keys'](db[_0xcacd('0x30')][_0xcacd('0x31')]);_0x573761['query']=_[_0xcacd('0x6e')](_0x457def[_0xcacd('0x35')]);_0x573761[_0xcacd('0x40')]=_[_0xcacd('0x36')](_0x573761[_0xcacd('0x34')],_0x573761[_0xcacd('0x35')]);_0x5617ea[_0xcacd('0x37')]=_['intersection'](_0x573761[_0xcacd('0x34')],qs['fields'](_0x457def['query'][_0xcacd('0x38')]));_0x5617ea[_0xcacd('0x37')]=_0x5617ea['attributes'][_0xcacd('0x59')]?_0x5617ea[_0xcacd('0x37')]:_0x573761[_0xcacd('0x34')];if(_0x457def['query'][_0xcacd('0xae')]){_0x5617ea[_0xcacd('0xaf')]=[{'all':!![]}];}_0x5617ea=_[_0xcacd('0x96')]({},_0x5617ea,_0x457def[_0xcacd('0xb0')]);return db[_0xcacd('0x30')][_0xcacd('0x5a')](_0x5617ea)['then'](handleEntityNotFound(_0x3cc34a,null))['then'](respondWithResult(_0x3cc34a,null))[_0xcacd('0xb1')](handleError(_0x3cc34a,null));};exports[_0xcacd('0xb2')]=function(_0x17a636,_0x2ff606){return db[_0xcacd('0x30')]['create'](_0x17a636[_0xcacd('0x6d')],{})[_0xcacd('0x2d')](respondWithResult(_0x2ff606,0xc9))[_0xcacd('0xb1')](handleError(_0x2ff606,null));};exports['update']=function(_0x45e67,_0x175c2e){if(_0x45e67[_0xcacd('0x6d')]['id']){delete _0x45e67[_0xcacd('0x6d')]['id'];}return db['FaxInteraction'][_0xcacd('0x5a')]({'where':{'id':_0x45e67[_0xcacd('0xad')]['id']}})[_0xcacd('0x2d')](handleEntityNotFound(_0x175c2e,null))[_0xcacd('0x2d')](saveUpdates(_0x45e67['body'],null))[_0xcacd('0x2d')](respondWithResult(_0x175c2e,null))[_0xcacd('0xb1')](handleError(_0x175c2e,null));};exports['destroy']=function(_0x2fbba2,_0x1b43c7){return db[_0xcacd('0x30')]['find']({'where':{'id':_0x2fbba2['params']['id']}})[_0xcacd('0x2d')](handleEntityNotFound(_0x1b43c7,null))['then'](removeEntity(_0x1b43c7,null))['catch'](handleError(_0x1b43c7,null));};exports['describe']=function(_0x19735f,_0x34993d){return db[_0xcacd('0x30')][_0xcacd('0xb3')]()['then'](respondWithResult(_0x34993d,null))[_0xcacd('0xb1')](handleError(_0x34993d,null));};exports[_0xcacd('0xb4')]=function(_0x54defc,_0x4dd2ce,_0x1c8f0a){return db[_0xcacd('0xb5')][_0xcacd('0x5a')]({'where':{'id':_0x54defc[_0xcacd('0xad')]['id']}})['then'](handleEntityNotFound(_0x4dd2ce,null))[_0xcacd('0x2d')](function(_0x46cf4f){if(_0x46cf4f){return _0x46cf4f[_0xcacd('0xb4')](_0x54defc['body'][_0xcacd('0xb6')],_[_0xcacd('0xb7')](_0x54defc[_0xcacd('0x6d')],[_0xcacd('0xb6'),'id'])||{});}})[_0xcacd('0x2d')](respondWithResult(_0x4dd2ce,null))[_0xcacd('0xb1')](handleError(_0x4dd2ce,null));};exports[_0xcacd('0xb8')]=function(_0x45a32d,_0xd13115,_0x2cd995){var _0x514bcb={'raw':![],'where':{}};var _0x49e12e={};var _0xb76e34={'count':0x0,'rows':[]};return db[_0xcacd('0x30')][_0xcacd('0xb9')]({'where':{'id':_0x45a32d[_0xcacd('0xad')]['id']}})[_0xcacd('0x2d')](handleEntityNotFound(_0xd13115,null))['then'](function(_0x326f0b){if(_0x326f0b){_0x49e12e['model']=_[_0xcacd('0x6e')](db[_0xcacd('0xb5')][_0xcacd('0x31')]);_0x49e12e[_0xcacd('0x35')]=_[_0xcacd('0x6e')](_0x45a32d[_0xcacd('0x35')]);_0x49e12e[_0xcacd('0x40')]=_[_0xcacd('0x36')](_0x49e12e[_0xcacd('0x34')],_0x49e12e[_0xcacd('0x35')]);_0x514bcb[_0xcacd('0x37')]=_['intersection'](_0x49e12e[_0xcacd('0x34')],qs[_0xcacd('0x38')](_0x45a32d[_0xcacd('0x35')][_0xcacd('0x38')]));_0x514bcb[_0xcacd('0x37')]=_0x514bcb[_0xcacd('0x37')][_0xcacd('0x59')]?_0x514bcb[_0xcacd('0x37')]:_0x49e12e[_0xcacd('0x34')];if(!_0x45a32d[_0xcacd('0x35')][_0xcacd('0x39')](_0xcacd('0x3a'))){_0x514bcb[_0xcacd('0x3b')]=qs[_0xcacd('0x3b')](_0x45a32d['query'][_0xcacd('0x3b')]);_0x514bcb[_0xcacd('0x1f')]=qs[_0xcacd('0x1f')](_0x45a32d[_0xcacd('0x35')][_0xcacd('0x1f')]);}_0x514bcb[_0xcacd('0x3c')]=qs[_0xcacd('0x3d')](_0x45a32d[_0xcacd('0x35')][_0xcacd('0x3d')]);_0x514bcb[_0xcacd('0x3e')]=qs[_0xcacd('0x40')](_[_0xcacd('0x3f')](_0x45a32d[_0xcacd('0x35')],_0x49e12e[_0xcacd('0x40')]));_0x514bcb[_0xcacd('0x3e')][_0xcacd('0xa9')]=_0x326f0b['id'];if(_0x45a32d[_0xcacd('0x35')]['filter']){_0x514bcb[_0xcacd('0x3e')]=_['merge'](_0x514bcb['where'],{'$or':_['map'](_0x514bcb[_0xcacd('0x37')],function(_0x3ebae1){var _0x51c172={};_0x51c172[_0x3ebae1]={'$like':'%'+_0x45a32d[_0xcacd('0x35')][_0xcacd('0x81')]+'%'};return _0x51c172;})});}if(_0x45a32d['query'][_0xcacd('0x77')]){var _0x54eef9=_0x45a32d[_0xcacd('0x35')][_0xcacd('0x77')][_0xcacd('0x2a')](',');var _0x5f28f1={};_0x5f28f1[_0x54eef9[0x0]]={'$gte':moment(_0x54eef9[0x1])['format'](_0xcacd('0xba'))};_0x514bcb[_0xcacd('0x3e')]=_[_0xcacd('0x96')](_0x514bcb[_0xcacd('0x3e')],_0x5f28f1);}_0x514bcb=_[_0xcacd('0x96')]({},_0x514bcb,_0x45a32d[_0xcacd('0xb0')]);return db[_0xcacd('0xb5')][_0xcacd('0x1e')]({'where':_0x514bcb[_0xcacd('0x3e')]})[_0xcacd('0x2d')](function(_0x494f6c){_0xb76e34['count']=_0x494f6c;if(_0x45a32d['query'][_0xcacd('0xae')]){_0x514bcb[_0xcacd('0xaf')]=[{'all':!![]}];}return db[_0xcacd('0xb5')][_0xcacd('0xbb')](_0x514bcb);})[_0xcacd('0x2d')](function(_0x344511){_0xb76e34[_0xcacd('0xab')]=_0x344511;return _0xb76e34;});}})[_0xcacd('0x2d')](respondWithFilteredResult(_0xd13115,_0x514bcb))[_0xcacd('0xb1')](handleError(_0xd13115,null));};exports[_0xcacd('0xbc')]=function(_0x43e0bd,_0x1326c9,_0x477750){return db[_0xcacd('0x30')][_0xcacd('0x5a')]({'where':{'id':_0x43e0bd[_0xcacd('0xad')]['id']}})['then'](handleEntityNotFound(_0x1326c9,null))[_0xcacd('0x2d')](function(_0x8a7a55){if(_0x8a7a55){return _0x8a7a55[_0xcacd('0xbd')](_0x43e0bd[_0xcacd('0x6d')]['ids'],_['omit'](_0x43e0bd[_0xcacd('0x6d')],[_0xcacd('0xb6'),'id'])||{})[_0xcacd('0xbe')](function(){return db[_0xcacd('0xbf')]['findAll']({'attributes':['id',_0xcacd('0x26'),'color'],'where':{'id':_0x43e0bd[_0xcacd('0x6d')]['ids']}});})[_0xcacd('0x2d')](function(_0x444a5a){socket[_0xcacd('0xc0')](_0xcacd('0xc1'),{'id':Number(_0x43e0bd[_0xcacd('0xad')]['id']),'tags':_0x444a5a||[]});return{'id':Number(_0x43e0bd[_0xcacd('0xad')]['id']),'tags':_0x444a5a||[]};});}})[_0xcacd('0x2d')](respondWithResult(_0x1326c9,null))[_0xcacd('0xb1')](handleError(_0x1326c9,null));};exports[_0xcacd('0xc2')]=function(_0x561edd,_0x5dc121,_0x215914){return db[_0xcacd('0x30')][_0xcacd('0x5a')]({'where':{'id':_0x561edd[_0xcacd('0xad')]['id']}})[_0xcacd('0x2d')](handleEntityNotFound(_0x5dc121,null))['then'](function(_0x2d7d22){if(_0x2d7d22){return _0x2d7d22[_0xcacd('0xc2')](_0x561edd['query']['ids']);}})['then'](respondWithStatusCode(_0x5dc121,null))['catch'](handleError(_0x5dc121,null));};exports[_0xcacd('0xc3')]=function(_0x466693,_0x3d671d){var _0x5ef3e7=moment()[_0xcacd('0xc4')]()[_0xcacd('0x94')]();var _0x12a857=path[_0xcacd('0xc5')](config[_0xcacd('0xc6')],_0xcacd('0xc7'),'files','tmp');var _0x11af31=path['join'](config[_0xcacd('0xc6')],'server',_0xcacd('0xc8'),'attachments');var _0x3997a5=path[_0xcacd('0xc5')](_0x12a857,_0x5ef3e7);var _0x43bf0f=util[_0xcacd('0xc9')](_0xcacd('0xca'),_0x466693['params']['id'],_0x5ef3e7);var _0x34b239=path[_0xcacd('0xc5')](_0x12a857,_0x43bf0f);var _0x22af97=[];_0x22af97[_0xcacd('0x2b')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x374de0=[{'model':db[_0xcacd('0xb5')],'as':'Messages','attributes':['id',_0xcacd('0x6d'),_0xcacd('0x75')],'include':_0x22af97}];return db['FaxInteraction'][_0xcacd('0x5a')]({'where':{'id':_0x466693[_0xcacd('0xad')]['id']},'include':_0x374de0})[_0xcacd('0x2d')](handleEntityNotFound(_0x3d671d,null))['then'](function(_0x39dec4){if(_0x39dec4&&_0x39dec4[_0xcacd('0xcb')]){var _0x6a76a0=_0x39dec4[_0xcacd('0xcc')]({'plain':!![]});fs['mkdirSync'](_0x3997a5);for(var _0xf9d26d=0x0;_0xf9d26d<_0x6a76a0['Messages'][_0xcacd('0x59')];_0xf9d26d++){var _0x52327b=_0x6a76a0[_0xcacd('0xcb')][_0xf9d26d][_0xcacd('0xcd')];if(_0x52327b){var _0x2ba004=path[_0xcacd('0xc5')](_0x11af31,_0x52327b['basename']);if(fs[_0xcacd('0xce')](_0x2ba004)){fs[_0xcacd('0xcf')](_0x2ba004)['pipe'](fs[_0xcacd('0xd0')](path[_0xcacd('0xc5')](_0x3997a5,_0x52327b[_0xcacd('0xd1')])));}}}return BPromise[_0xcacd('0x8d')]()[_0xcacd('0x2d')](function(){return new BPromise(function(_0x111207,_0xcc171e){zipdir(_0x3997a5,{'saveTo':_0x34b239},function(_0x27c3eb,_0xcd7839){if(_0x27c3eb)return _0xcc171e(_0x27c3eb);return _0x111207(_0xcd7839);});})[_0xcacd('0x2d')](function(){return new BPromise(function(_0x32d77d,_0x16f974){rimraf(_0x3997a5,function(_0x3d8c0c){if(_0x3d8c0c)_0x16f974(_0x3d8c0c);return _0x32d77d();});});})[_0xcacd('0x2d')](function(){return _0x3d671d['download'](_0x34b239,_0x43bf0f,function(_0x49b261){if(_0x49b261){console[_0xcacd('0xd2')]('err',_0x49b261);}else{fs[_0xcacd('0xd3')](_0x34b239);}});});});}else{return _0x3d671d['sendStatus'](0xc8);}})['catch'](handleError(_0x3d671d,null));}; \ No newline at end of file +var _0x6242=['some','compact','isEmpty','FaxAccountId','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','FaxInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','includeAll','include','create','describe','addMessage','FaxMessage','ids','omit','nolimit','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','spread','color','emit','faxInteractionTags:save','removeTags','download','join','root','server','files','attachments','Attachment','get','mkdirSync','Messages','existsSync','createReadStream','pipe','createWriteStream','log','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','length','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','body'];(function(_0x365d8c,_0x4ffe0d){var _0x45362d=function(_0xd146e){while(--_0xd146e){_0x365d8c['push'](_0x365d8c['shift']());}};_0x45362d(++_0x4ffe0d);}(_0x6242,0x143));var _0x2624=function(_0x244300,_0x85931c){_0x244300=_0x244300-0x0;var _0x51e99b=_0x6242[_0x244300];return _0x51e99b;};'use strict';var emlformat=require(_0x2624('0x0'));var rimraf=require(_0x2624('0x1'));var zipdir=require(_0x2624('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2624('0x3'));var moment=require(_0x2624('0x4'));var BPromise=require(_0x2624('0x5'));var Mustache=require(_0x2624('0x6'));var util=require(_0x2624('0x7'));var path=require(_0x2624('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2624('0x9'));var fs=require('fs');var fs_extra=require(_0x2624('0xa'));var _=require(_0x2624('0xb'));var squel=require(_0x2624('0xc'));var crypto=require('crypto');var jsforce=require(_0x2624('0xd'));var deskjs=require(_0x2624('0xe'));var toCsv=require(_0x2624('0xf'));var querystring=require('querystring');var Papa=require(_0x2624('0x10'));var Redis=require(_0x2624('0x11'));var authService=require(_0x2624('0x12'));var qs=require(_0x2624('0x13'));var as=require(_0x2624('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2624('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2624('0x16'));var licenseUtil=require(_0x2624('0x17'));var db=require('../../mysqldb')['db'];config[_0x2624('0x18')]=_[_0x2624('0x19')](config[_0x2624('0x18')],{'host':_0x2624('0x1a'),'port':0x18eb});var socket=require(_0x2624('0x1b'))(new Redis(config[_0x2624('0x18')]));require(_0x2624('0x1c'))[_0x2624('0x1d')](socket);function respondWithStatusCode(_0x152f17,_0x3a89f3){_0x3a89f3=_0x3a89f3||0xcc;return function(_0x327018){if(_0x327018){return _0x152f17[_0x2624('0x1e')](_0x3a89f3);}return _0x152f17[_0x2624('0x1f')](_0x3a89f3)[_0x2624('0x20')]();};}function respondWithResult(_0x165832,_0x3824f8){_0x3824f8=_0x3824f8||0xc8;return function(_0xda971){if(_0xda971){return _0x165832['status'](_0x3824f8)[_0x2624('0x21')](_0xda971);}};}function respondWithFilteredResult(_0x515b4b,_0x518828){return function(_0x6aa3e1){if(_0x6aa3e1){var _0xddcfa3=_0x6aa3e1[_0x2624('0x22')],_0xbb87c=_0x518828[_0x2624('0x23')],_0x5c9a11=_0x518828[_0x2624('0x23')]+_0x518828[_0x2624('0x24')],_0x1e555f;if(_0x5c9a11>=_0xddcfa3){_0x5c9a11=_0xddcfa3;_0x1e555f=0xc8;}else{_0x1e555f=0xce;}_0x515b4b[_0x2624('0x1f')](_0x1e555f);return _0x515b4b[_0x2624('0x25')](_0x2624('0x26'),_0xbb87c+'-'+_0x5c9a11+'/'+_0xddcfa3)[_0x2624('0x21')](_0x6aa3e1);}return null;};}function patchUpdates(_0x5e1094){return function(_0x198174){try{jsonpatch[_0x2624('0x27')](_0x198174,_0x5e1094,!![]);}catch(_0x2ca688){return BPromise['reject'](_0x2ca688);}return _0x198174['save']();};}function saveUpdates(_0x94358e,_0x21bbda){return function(_0x587ec4){if(_0x587ec4){return _0x587ec4[_0x2624('0x28')](_0x94358e)[_0x2624('0x29')](function(_0xfd995e){return _0xfd995e;});}return null;};}function removeEntity(_0x298855,_0x2fb48d){return function(_0x361ee6){if(_0x361ee6){return _0x361ee6[_0x2624('0x2a')]()['then'](function(){_0x298855[_0x2624('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45177b,_0x1cc9f1){return function(_0x58215a){if(!_0x58215a){_0x45177b[_0x2624('0x1e')](0x194);}return _0x58215a;};}function handleError(_0x1ae190,_0x15431f){_0x15431f=_0x15431f||0x1f4;return function(_0x239fbf){logger['error'](_0x239fbf[_0x2624('0x2b')]);if(_0x239fbf[_0x2624('0x2c')]){delete _0x239fbf[_0x2624('0x2c')];}_0x1ae190[_0x2624('0x1f')](_0x15431f)[_0x2624('0x2d')](_0x239fbf);};}function getInteractionUsers(_0xefd0e8,_0x1725f7){return new BPromise(function(_0x8832a4,_0x449397){try{if(_0x1725f7[_0xefd0e8['id']]){_0xefd0e8[_0x2624('0x2e')]=_[_0x2624('0x2f')](_0x1725f7[_0xefd0e8['id']],function(_0x19301c){return{'id':_0x19301c['id'],'fullname':_0x19301c[_0x2624('0x30')]};});}}catch(_0x5207b4){_0x449397(_0x5207b4);}_0x8832a4(_0xefd0e8);});}function getInteractionTags(_0x47b1f3,_0xeccf01){return new BPromise(function(_0x18a161,_0x43848f){try{if(_0x47b1f3[_0x2624('0x31')]){_0x47b1f3[_0x2624('0x32')]=[];_0x47b1f3[_0x2624('0x31')][_0x2624('0x33')](',')['forEach'](function(_0x13ad8a){_0x47b1f3[_0x2624('0x32')][_0x2624('0x34')](_0xeccf01[_0x13ad8a]);});}delete _0x47b1f3[_0x2624('0x31')];}catch(_0x2f46b7){_0x43848f(_0x2f46b7);}_0x18a161(_0x47b1f3);});}function updateFaxInteraction(_0x31022d,_0x16ce34,_0x17f91e){return new BPromise(function(_0x49c2c8,_0x322ef2){return getInteractionUsers(_0x31022d,_0x17f91e)['then'](function(_0x5c6039){return getInteractionTags(_0x5c6039,_0x16ce34);})[_0x2624('0x29')](function(_0x5eb1cc){_0x49c2c8(_0x5eb1cc);})[_0x2624('0x35')](function(_0x4033f3){_0x322ef2(_0x4033f3);});});}exports['index']=function(_0x49071b,_0x377302){var _0x1ca86a={},_0x37c79c={},_0xa7ad7b={'count':0x0,'rows':[]};var _0x508986=_['map'](db['FaxInteraction'][_0x2624('0x36')],function(_0x8a414){return{'name':_0x8a414[_0x2624('0x37')],'type':_0x8a414[_0x2624('0x38')][_0x2624('0x39')]};});_0x37c79c['model']=_['map'](_0x508986,_0x2624('0x2c'));_0x37c79c[_0x2624('0x3a')]=_[_0x2624('0x3b')](_0x49071b[_0x2624('0x3a')]);_0x37c79c[_0x2624('0x3c')]=_[_0x2624('0x3d')](_0x37c79c['model'],_0x37c79c['query']);_0x1ca86a[_0x2624('0x3e')]=_[_0x2624('0x3d')](_0x37c79c[_0x2624('0x3f')],qs['fields'](_0x49071b['query'][_0x2624('0x40')]));_0x1ca86a[_0x2624('0x3e')]=_0x1ca86a[_0x2624('0x3e')]['length']?_0x1ca86a[_0x2624('0x3e')]:_0x37c79c[_0x2624('0x3f')];if(!_0x49071b['query'][_0x2624('0x41')]('nolimit')){_0x1ca86a[_0x2624('0x24')]=qs['limit'](_0x49071b['query']['limit']);_0x1ca86a['offset']=qs[_0x2624('0x23')](_0x49071b[_0x2624('0x3a')][_0x2624('0x23')]);}_0x1ca86a[_0x2624('0x42')]=qs[_0x2624('0x43')](_0x49071b[_0x2624('0x3a')][_0x2624('0x43')]);_0x1ca86a[_0x2624('0x44')]=qs[_0x2624('0x3c')](_[_0x2624('0x45')](_0x49071b[_0x2624('0x3a')],_0x37c79c[_0x2624('0x3c')]),_0x508986);var _0x4d12b1=[];var _0x2015fc=squel[_0x2624('0x46')]()[_0x2624('0x47')]('id')['field'](_0x2624('0x2c'))[_0x2624('0x47')]('color')[_0x2624('0x48')](_0x2624('0x49'));var _0x390214=squel['select']()['field'](_0x2624('0x4a'))[_0x2624('0x47')](_0x2624('0x4b'))['field']('ui.FaxInteractionId')[_0x2624('0x48')](_0x2624('0x4c'),'ui')['left_join'](_0x2624('0x4d'),'u',_0x2624('0x4e'));var _0x59cf2c=squel['select']()['from'](_0x2624('0x4f'),'i')[_0x2624('0x50')](_0x2624('0x51'),'c',_0x2624('0x52'))[_0x2624('0x50')](_0x2624('0x4d'),'o',_0x2624('0x53'))[_0x2624('0x50')](_0x2624('0x54'),'a',_0x2624('0x55'))[_0x2624('0x50')]('fax_messages','me',_0x2624('0x56'))[_0x2624('0x50')]('fax_interaction_has_tags','it',_0x2624('0x57'))[_0x2624('0x50')](_0x2624('0x49'),'t',_0x2624('0x58'));var _0x37e758=squel[_0x2624('0x59')]();var _0x4d7289=[];var _0xdc2ae1=squel['expr']();var _0x5c4f15;if(_0x49071b[_0x2624('0x3a')]['search']){_0x5c4f15=as[_0x2624('0x5a')](_0x49071b[_0x2624('0x3a')]['search']);var _0x43e9e9=_0x5c4f15['sqlOperator'];for(var _0x5286e3=0x0;_0x5286e3<_0x5c4f15[_0x2624('0x5b')]['length'];_0x5286e3++){var _0x4239a6=_0x5c4f15[_0x2624('0x5b')][_0x5286e3];var _0x2d7a1c='i';var _0x173dc9=_[_0x2624('0x5c')](_0x508986,[_0x2624('0x2c'),_0x4239a6['field']]);if(!_0x173dc9){switch(_0x4239a6['field']){case _0x2624('0x5d'):if(_0x4239a6[_0x2624('0x5e')]==0x1){_0x59cf2c[_0x2624('0x5f')]('`'+_0x4239a6[_0x2624('0x47')]+_0x2624('0x60'));}else{_0x59cf2c[_0x2624('0x5f')]('`'+_0x4239a6['field']+_0x2624('0x61'));}break;case _0x2624('0x62'):if(_0x4239a6[_0x2624('0x63')]===_0x2624('0x64')){if(_0x4239a6[_0x2624('0x5e')]['split']('\x20')[_0x2624('0x65')]>0x1){_0x37e758[_0x43e9e9](_0x2624('0x66'),qs[_0x2624('0x67')](_0x4239a6[_0x2624('0x5e')]),null);}else{var _0x29af69='%'+_0x4239a6['value']+'%';_0x37e758[_0x43e9e9](_0x2624('0x68'),_0x29af69,_0x29af69,_0x29af69);}}else{_0x173dc9=_[_0x2624('0x5c')](_0x508986,['name',_0x2624('0x69')]);_0x4239a6[_0x2624('0x47')]=_0x2624('0x69');_0x39ef31=as[_0x2624('0x6a')](_0x2d7a1c,_0x173dc9[_0x2624('0x38')],_0x4239a6);_0x37e758[_0x43e9e9](_0x39ef31[_0x2624('0x6b')],_0x39ef31[_0x2624('0x5e')][_0x2624('0x6c')],_0x39ef31['value'][_0x2624('0x20')]);}break;case _0x2624('0x6d'):var _0x563fd9=_0x4239a6[_0x2624('0x5e')][_0x2624('0x33')](',')[_0x2624('0x2f')](function(_0x490255){return Number(_0x490255);});_0x563fd9[_0x2624('0x6e')](function(_0x4aeb69){_0xdc2ae1['or'](_0x2624('0x6f'),'%,'+_0x4aeb69+',%');});_0x4d7289=_[_0x2624('0x70')](_0x4d7289,_0x563fd9);break;case _0x2624('0x71'):if(_0x4239a6[_0x2624('0x63')]===_0x2624('0x64')){_0x37e758[_0x43e9e9](_0x2624('0x72'),'%'+_0x4239a6['value']+'%',null);}else{_0x173dc9=_[_0x2624('0x5c')](_0x508986,[_0x2624('0x2c'),_0x2624('0x73')]);_0x4239a6['field']='UserId';_0x39ef31=as[_0x2624('0x6a')](_0x2d7a1c,_0x173dc9[_0x2624('0x38')],_0x4239a6);_0x37e758[_0x43e9e9](_0x39ef31[_0x2624('0x6b')],_0x39ef31['value'][_0x2624('0x6c')],_0x39ef31[_0x2624('0x5e')][_0x2624('0x20')]);}break;case _0x2624('0x74'):_0x39ef31=as[_0x2624('0x6a')]('me',null,_0x4239a6);_0x37e758[_0x43e9e9](_0x39ef31[_0x2624('0x6b')],_0x39ef31['value'][_0x2624('0x6c')],_0x39ef31[_0x2624('0x5e')][_0x2624('0x20')]);break;}}else{var _0x39ef31=as[_0x2624('0x6a')](_0x2d7a1c,_0x173dc9[_0x2624('0x38')],_0x4239a6);_0x37e758[_0x43e9e9](_0x39ef31[_0x2624('0x6b')],_0x39ef31['value'][_0x2624('0x6c')],_0x39ef31[_0x2624('0x5e')][_0x2624('0x20')]);}}}else{var _0x16c360=_(_0x49071b[_0x2624('0x3a')])[_0x2624('0x3b')]()['map'](function(_0x57d229){return _[_0x2624('0x75')](_0x508986,[_0x2624('0x2c'),_0x57d229])?_0x57d229:undefined;})[_0x2624('0x76')]()[_0x2624('0x5e')]();if(!_[_0x2624('0x77')](_0x16c360)){_0x16c360['forEach'](function(_0x461623){if(_0x461623===_0x2624('0x78')){_0x59cf2c['where']('i.FaxAccountId\x20IN\x20?',[]['concat'](_0x49071b['query'][_0x461623]));}else if(_0x461623===_0x2624('0x79')){var _0x9407ea=JSON[_0x2624('0x7a')](_0x49071b[_0x2624('0x3a')][_0x461623])['$gte'];var _0x3c2074=JSON[_0x2624('0x7a')](_0x49071b[_0x2624('0x3a')][_0x461623])[_0x2624('0x7b')];_0x59cf2c[_0x2624('0x44')](_0x2624('0x7c'),_0x9407ea,_0x3c2074);}else{if(_0x49071b[_0x2624('0x3a')][_0x461623]==='null'){_0x59cf2c[_0x2624('0x44')]('i.'+_0x461623+'\x20IS\x20NULL');}else{_0x59cf2c[_0x2624('0x44')]('i.'+_0x461623+'\x20=\x20?',_0x49071b[_0x2624('0x3a')][_0x461623]);}}});}if(_0x49071b[_0x2624('0x3a')][_0x2624('0x7d')]){if(_0x49071b[_0x2624('0x3a')]['read']==0x1){_0x59cf2c['having'](_0x2624('0x7e'));}else{_0x59cf2c[_0x2624('0x5f')]('`unreadMessages`\x20>\x200');}}if(_0x49071b[_0x2624('0x3a')]['tag']){_0x4d7289=_[_0x2624('0x7f')](_0x49071b[_0x2624('0x3a')][_0x2624('0x80')])?_0x49071b[_0x2624('0x3a')][_0x2624('0x80')]:new Array(_0x49071b[_0x2624('0x3a')][_0x2624('0x80')]);_0x4d7289[_0x2624('0x6e')](function(_0x5d886e){_0xdc2ae1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5d886e+',%');});}if(_0x49071b['query']['filter']){var _0x52582b=_0x49071b[_0x2624('0x3a')]['filter'][_0x2624('0x81')]('\x5c','\x5c\x5c')[_0x2624('0x81')](/'/g,'\x27\x27');if(qs[_0x2624('0x82')](_0x52582b)){_0x37e758['or']('i.id\x20LIKE\x20?',_0x52582b+'%')['or'](_0x2624('0x83'),_0x52582b+'%');}_0x37e758['or'](_0x2624('0x84'),_0x52582b+'%');}}_0x59cf2c[_0x2624('0x44')](_0x37e758);_0x59cf2c[_0x2624('0x85')](_0x2624('0x86'));var _0x1456dd={'type':db[_0x2624('0x87')][_0x2624('0x88')]['SELECT'],'raw':!![]};var _0x3af484=_0x59cf2c[_0x2624('0x89')]();_0x3af484[_0x2624('0x47')](_0x2624('0x86'));_0x3af484[_0x2624('0x47')](_0x2624('0x8a'),_0x2624('0x5d'));if(_0x1ca86a[_0x2624('0x42')]){_0x1ca86a[_0x2624('0x42')][_0x2624('0x6e')](function(_0x5b6032){var _0x5cf4bc=_0x5b6032[0x0]===_0x2624('0x8b')?_0x5b6032[0x0]:'i.'+_0x5b6032[0x0];_0x59cf2c[_0x2624('0x42')](_0x5cf4bc,_0x5b6032[0x1]==='DESC'?![]:!![]);});}if(!_[_0x2624('0x77')](_0x4d7289)){_0x59cf2c['having'](_0xdc2ae1);_0x3af484[_0x2624('0x44')](_0x2624('0x8c'),_0x4d7289);}BPromise[_0x2624('0x8d')]()['then'](function(){if(!_0x5c4f15){if(_0x49071b[_0x2624('0x3a')][_0x2624('0x78')])return;_0x3af484[_0x2624('0x44')](_0x2624('0x8e'));_0x59cf2c[_0x2624('0x44')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x49071b[_0x2624('0x8f')][_0x2624('0x90')]!==_0x2624('0x91'))return;return _0x49071b[_0x2624('0x8f')][_0x2624('0x92')]({'attributes':['id'],'raw':!![]})[_0x2624('0x29')](function(_0x23ce99){if(_['isEmpty'](_0x23ce99)){_0x3af484[_0x2624('0x44')](_0x2624('0x93'));_0x59cf2c[_0x2624('0x44')](_0x2624('0x93'));}else{_0x3af484[_0x2624('0x44')]('i.FaxAccountId\x20IN\x20?',_[_0x2624('0x2f')](_0x23ce99,'id'));_0x59cf2c[_0x2624('0x44')]('i.FaxAccountId\x20IN\x20?',_[_0x2624('0x2f')](_0x23ce99,'id'));}});})[_0x2624('0x29')](function(){if(_0x49071b[_0x2624('0x8f')][_0x2624('0x90')]==='agent'&&!_0x5c4f15&&!_0x49071b[_0x2624('0x3a')]['FaxAccountId'])return[];return db[_0x2624('0x94')][_0x2624('0x3a')](_0x3af484[_0x2624('0x95')](),_0x1456dd);})[_0x2624('0x29')](function(_0x53541a){_0xa7ad7b['count']=_0x53541a[_0x2624('0x65')];if(_0xa7ad7b[_0x2624('0x22')]===0x0)return[];return db[_0x2624('0x94')][_0x2624('0x3a')](_0x2015fc['toString'](),_0x1456dd)[_0x2624('0x29')](function(_0xba1bf1){_0x4d12b1=_[_0x2624('0x96')](_0xba1bf1,'id');_0x1456dd=_[_0x2624('0x97')](_0x1456dd,{'model':db[_0x2624('0x98')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x49071b[_0x2624('0x3a')][_0x2624('0x40')]){_0x1ca86a[_0x2624('0x3e')][_0x2624('0x6e')](function(_0x4baa66){_0x59cf2c[_0x2624('0x47')]('i.'+_0x4baa66);});}else{_0x59cf2c[_0x2624('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x2624('0x5d'));_0x59cf2c[_0x2624('0x47')](_0x2624('0x99'),_0x2624('0x9a'));_0x59cf2c[_0x2624('0x47')](_0x2624('0x9b'),_0x2624('0x9c'));_0x59cf2c[_0x2624('0x47')](_0x2624('0x9d'),_0x2624('0x8b'));_0x59cf2c[_0x2624('0x47')](_0x2624('0x9e'));_0x59cf2c['field'](_0x2624('0x9f'),_0x2624('0xa0'));_0x59cf2c['field'](_0x2624('0xa1'),_0x2624('0xa2'));_0x59cf2c[_0x2624('0x47')](_0x2624('0xa3'),_0x2624('0xa4'));_0x59cf2c[_0x2624('0x47')](_0x2624('0xa5'),_0x2624('0xa6'));_0x59cf2c[_0x2624('0x47')](_0x2624('0xa7'),_0x2624('0xa8'));_0x59cf2c[_0x2624('0x47')](_0x2624('0xa9'),_0x2624('0xaa'));_0x59cf2c[_0x2624('0x47')](_0x2624('0xab'),_0x2624('0xac'));_0x59cf2c['field']('o.internal',_0x2624('0xad'));_0x59cf2c['field'](_0x2624('0xae'),_0x2624('0x31'));}if(_0x1ca86a[_0x2624('0x24')])_0x59cf2c['limit'](_0x1ca86a[_0x2624('0x24')]);if(_0x1ca86a[_0x2624('0x23')])_0x59cf2c[_0x2624('0x23')](_0x1ca86a[_0x2624('0x23')]);return db[_0x2624('0x94')]['query'](_0x59cf2c['toString'](),_0x1456dd);})['then'](function(_0x56f89e){_0x390214[_0x2624('0x44')](_0x2624('0xaf'),_[_0x2624('0x2f')](_0x56f89e,'id'));return db['sequelize'][_0x2624('0x3a')](_0x390214[_0x2624('0x95')](),_0x1456dd)[_0x2624('0x29')](function(_0x21cf23){var _0x248c9c=_[_0x2624('0xb0')](_0x21cf23,_0x2624('0xb1'));var _0x48d260=[];_0x56f89e['forEach'](function(_0x2eb294){_0x48d260[_0x2624('0x34')](updateFaxInteraction(_0x2eb294,_0x4d12b1,_0x248c9c));});return BPromise[_0x2624('0xb2')](_0x48d260);});});})[_0x2624('0x29')](function(_0xf2f1a2){_0xa7ad7b[_0x2624('0xb3')]=_0xf2f1a2;return _0xa7ad7b;})[_0x2624('0x29')](respondWithFilteredResult(_0x377302,_0x1ca86a))[_0x2624('0x35')](handleError(_0x377302,null));};exports[_0x2624('0xb4')]=function(_0x474180,_0x4fccb4){var _0x53eb51={'raw':![],'where':{'id':_0x474180[_0x2624('0xb5')]['id']}},_0x2a3ace={};_0x2a3ace[_0x2624('0x3f')]=_['keys'](db['FaxInteraction'][_0x2624('0x36')]);_0x2a3ace[_0x2624('0x3a')]=_[_0x2624('0x3b')](_0x474180[_0x2624('0x3a')]);_0x2a3ace['filters']=_['intersection'](_0x2a3ace['model'],_0x2a3ace[_0x2624('0x3a')]);_0x53eb51[_0x2624('0x3e')]=_['intersection'](_0x2a3ace[_0x2624('0x3f')],qs[_0x2624('0x40')](_0x474180[_0x2624('0x3a')]['fields']));_0x53eb51['attributes']=_0x53eb51[_0x2624('0x3e')][_0x2624('0x65')]?_0x53eb51[_0x2624('0x3e')]:_0x2a3ace[_0x2624('0x3f')];if(_0x474180[_0x2624('0x3a')][_0x2624('0xb6')]){_0x53eb51[_0x2624('0xb7')]=[{'all':!![]}];}_0x53eb51=_['merge']({},_0x53eb51,_0x474180['options']);return db['FaxInteraction']['find'](_0x53eb51)[_0x2624('0x29')](handleEntityNotFound(_0x4fccb4,null))[_0x2624('0x29')](respondWithResult(_0x4fccb4,null))[_0x2624('0x35')](handleError(_0x4fccb4,null));};exports['create']=function(_0x2eb325,_0xf21cc0){return db[_0x2624('0x98')][_0x2624('0xb8')](_0x2eb325[_0x2624('0x74')],{})[_0x2624('0x29')](respondWithResult(_0xf21cc0,0xc9))[_0x2624('0x35')](handleError(_0xf21cc0,null));};exports[_0x2624('0x28')]=function(_0x53baed,_0x4a56d6){if(_0x53baed[_0x2624('0x74')]['id']){delete _0x53baed[_0x2624('0x74')]['id'];}return db[_0x2624('0x98')][_0x2624('0x5c')]({'where':{'id':_0x53baed[_0x2624('0xb5')]['id']}})[_0x2624('0x29')](handleEntityNotFound(_0x4a56d6,null))[_0x2624('0x29')](saveUpdates(_0x53baed[_0x2624('0x74')],null))[_0x2624('0x29')](respondWithResult(_0x4a56d6,null))[_0x2624('0x35')](handleError(_0x4a56d6,null));};exports[_0x2624('0x2a')]=function(_0x3ee9d2,_0x5d6022){return db[_0x2624('0x98')]['find']({'where':{'id':_0x3ee9d2[_0x2624('0xb5')]['id']}})[_0x2624('0x29')](handleEntityNotFound(_0x5d6022,null))[_0x2624('0x29')](removeEntity(_0x5d6022,null))[_0x2624('0x35')](handleError(_0x5d6022,null));};exports[_0x2624('0xb9')]=function(_0x2b0966,_0x2d8a84){return db[_0x2624('0x98')]['describe']()[_0x2624('0x29')](respondWithResult(_0x2d8a84,null))['catch'](handleError(_0x2d8a84,null));};exports[_0x2624('0xba')]=function(_0x31cd38,_0x32201b,_0x3a7364){return db[_0x2624('0xbb')][_0x2624('0x5c')]({'where':{'id':_0x31cd38[_0x2624('0xb5')]['id']}})[_0x2624('0x29')](handleEntityNotFound(_0x32201b,null))[_0x2624('0x29')](function(_0x4acb58){if(_0x4acb58){return _0x4acb58[_0x2624('0xba')](_0x31cd38[_0x2624('0x74')][_0x2624('0xbc')],_[_0x2624('0xbd')](_0x31cd38[_0x2624('0x74')],['ids','id'])||{});}})['then'](respondWithResult(_0x32201b,null))[_0x2624('0x35')](handleError(_0x32201b,null));};exports['getMessages']=function(_0x5c1328,_0x3d0867,_0x1076bb){var _0x283ce0={'raw':![],'where':{}};var _0x36c61c={};var _0x111846={'count':0x0,'rows':[]};return db[_0x2624('0x98')]['findOne']({'where':{'id':_0x5c1328[_0x2624('0xb5')]['id']}})[_0x2624('0x29')](handleEntityNotFound(_0x3d0867,null))['then'](function(_0x16f3ed){if(_0x16f3ed){_0x36c61c[_0x2624('0x3f')]=_[_0x2624('0x3b')](db[_0x2624('0xbb')][_0x2624('0x36')]);_0x36c61c[_0x2624('0x3a')]=_[_0x2624('0x3b')](_0x5c1328['query']);_0x36c61c['filters']=_['intersection'](_0x36c61c[_0x2624('0x3f')],_0x36c61c[_0x2624('0x3a')]);_0x283ce0[_0x2624('0x3e')]=_['intersection'](_0x36c61c[_0x2624('0x3f')],qs[_0x2624('0x40')](_0x5c1328[_0x2624('0x3a')][_0x2624('0x40')]));_0x283ce0[_0x2624('0x3e')]=_0x283ce0['attributes'][_0x2624('0x65')]?_0x283ce0[_0x2624('0x3e')]:_0x36c61c[_0x2624('0x3f')];if(!_0x5c1328[_0x2624('0x3a')]['hasOwnProperty'](_0x2624('0xbe'))){_0x283ce0[_0x2624('0x24')]=qs[_0x2624('0x24')](_0x5c1328['query'][_0x2624('0x24')]);_0x283ce0[_0x2624('0x23')]=qs[_0x2624('0x23')](_0x5c1328[_0x2624('0x3a')][_0x2624('0x23')]);}_0x283ce0[_0x2624('0x42')]=qs[_0x2624('0x43')](_0x5c1328[_0x2624('0x3a')][_0x2624('0x43')]);_0x283ce0[_0x2624('0x44')]=qs[_0x2624('0x3c')](_['pick'](_0x5c1328['query'],_0x36c61c[_0x2624('0x3c')]));_0x283ce0['where'][_0x2624('0xb1')]=_0x16f3ed['id'];if(_0x5c1328[_0x2624('0x3a')]['filter']){_0x283ce0[_0x2624('0x44')]=_[_0x2624('0x97')](_0x283ce0[_0x2624('0x44')],{'$or':_[_0x2624('0x2f')](_0x283ce0[_0x2624('0x3e')],function(_0x3f8450){var _0x487957={};_0x487957[_0x3f8450]={'$like':'%'+_0x5c1328[_0x2624('0x3a')][_0x2624('0xbf')]+'%'};return _0x487957;})});}if(_0x5c1328['query'][_0x2624('0xc0')]){var _0x3a96ec=_0x5c1328[_0x2624('0x3a')][_0x2624('0xc0')][_0x2624('0x33')](',');var _0x247e99={};_0x247e99[_0x3a96ec[0x0]]={'$gte':moment(_0x3a96ec[0x1])[_0x2624('0xc1')](_0x2624('0xc2'))};_0x283ce0[_0x2624('0x44')]=_[_0x2624('0x97')](_0x283ce0[_0x2624('0x44')],_0x247e99);}_0x283ce0=_[_0x2624('0x97')]({},_0x283ce0,_0x5c1328[_0x2624('0xc3')]);return db[_0x2624('0xbb')][_0x2624('0x22')]({'where':_0x283ce0[_0x2624('0x44')]})[_0x2624('0x29')](function(_0x358fff){_0x111846[_0x2624('0x22')]=_0x358fff;if(_0x5c1328[_0x2624('0x3a')][_0x2624('0xb6')]){_0x283ce0[_0x2624('0xb7')]=[{'all':!![]}];}return db[_0x2624('0xbb')][_0x2624('0xc4')](_0x283ce0);})[_0x2624('0x29')](function(_0x96642b){_0x111846[_0x2624('0xb3')]=_0x96642b;return _0x111846;});}})['then'](respondWithFilteredResult(_0x3d0867,_0x283ce0))[_0x2624('0x35')](handleError(_0x3d0867,null));};exports[_0x2624('0xc5')]=function(_0x1c7e1a,_0x46f87a,_0x2292a3){return db[_0x2624('0x98')][_0x2624('0x5c')]({'where':{'id':_0x1c7e1a[_0x2624('0xb5')]['id']}})['then'](handleEntityNotFound(_0x46f87a,null))[_0x2624('0x29')](function(_0x34e6dd){if(_0x34e6dd){return _0x34e6dd[_0x2624('0xc6')](_0x1c7e1a[_0x2624('0x74')]['ids'],_['omit'](_0x1c7e1a['body'],['ids','id'])||{})[_0x2624('0xc7')](function(){return db[_0x2624('0x6d')][_0x2624('0xc4')]({'attributes':['id',_0x2624('0x2c'),_0x2624('0xc8')],'where':{'id':_0x1c7e1a['body'][_0x2624('0xbc')]}});})[_0x2624('0x29')](function(_0x229bad){socket[_0x2624('0xc9')](_0x2624('0xca'),{'id':Number(_0x1c7e1a['params']['id']),'tags':_0x229bad||[]});return{'id':Number(_0x1c7e1a[_0x2624('0xb5')]['id']),'tags':_0x229bad||[]};});}})[_0x2624('0x29')](respondWithResult(_0x46f87a,null))['catch'](handleError(_0x46f87a,null));};exports['removeTags']=function(_0x77461d,_0x58907a,_0x1f47db){return db[_0x2624('0x98')][_0x2624('0x5c')]({'where':{'id':_0x77461d[_0x2624('0xb5')]['id']}})[_0x2624('0x29')](handleEntityNotFound(_0x58907a,null))[_0x2624('0x29')](function(_0xce3791){if(_0xce3791){return _0xce3791[_0x2624('0xcb')](_0x77461d[_0x2624('0x3a')][_0x2624('0xbc')]);}})[_0x2624('0x29')](respondWithStatusCode(_0x58907a,null))[_0x2624('0x35')](handleError(_0x58907a,null));};exports[_0x2624('0xcc')]=function(_0x2e0d47,_0x990fb3){var _0x48016a=moment()['unix']()['toString']();var _0x8838a9=path[_0x2624('0xcd')](config[_0x2624('0xce')],_0x2624('0xcf'),_0x2624('0xd0'),'tmp');var _0x67c4fb=path['join'](config['root'],_0x2624('0xcf'),_0x2624('0xd0'),_0x2624('0xd1'));var _0x4a0046=path[_0x2624('0xcd')](_0x8838a9,_0x48016a);var _0x5d465f=util[_0x2624('0xc1')]('transcript-%d-%s.zip',_0x2e0d47['params']['id'],_0x48016a);var _0x5b1a93=path[_0x2624('0xcd')](_0x8838a9,_0x5d465f);var _0x311e8e=[];_0x311e8e['push']({'model':db[_0x2624('0xd2')],'as':_0x2624('0xd2'),'raw':!![]});var _0x501df0=[{'model':db[_0x2624('0xbb')],'as':'Messages','attributes':['id',_0x2624('0x74'),'createdAt'],'include':_0x311e8e}];return db[_0x2624('0x98')][_0x2624('0x5c')]({'where':{'id':_0x2e0d47[_0x2624('0xb5')]['id']},'include':_0x501df0})[_0x2624('0x29')](handleEntityNotFound(_0x990fb3,null))[_0x2624('0x29')](function(_0x2a6899){if(_0x2a6899&&_0x2a6899['Messages']){var _0x17bf4a=_0x2a6899[_0x2624('0xd3')]({'plain':!![]});fs[_0x2624('0xd4')](_0x4a0046);for(var _0x14bb97=0x0;_0x14bb97<_0x17bf4a[_0x2624('0xd5')][_0x2624('0x65')];_0x14bb97++){var _0x245be9=_0x17bf4a[_0x2624('0xd5')][_0x14bb97][_0x2624('0xd2')];if(_0x245be9){var _0x570e0e=path['join'](_0x67c4fb,_0x245be9['basename']);if(fs[_0x2624('0xd6')](_0x570e0e)){fs[_0x2624('0xd7')](_0x570e0e)[_0x2624('0xd8')](fs[_0x2624('0xd9')](path[_0x2624('0xcd')](_0x4a0046,_0x245be9['basename'])));}}}return BPromise[_0x2624('0x8d')]()[_0x2624('0x29')](function(){return new BPromise(function(_0xf72e1a,_0x4bd92d){zipdir(_0x4a0046,{'saveTo':_0x5b1a93},function(_0x48bd07,_0x583944){if(_0x48bd07)return _0x4bd92d(_0x48bd07);return _0xf72e1a(_0x583944);});})['then'](function(){return new BPromise(function(_0x5f4f6a,_0x2852fc){rimraf(_0x4a0046,function(_0x1e17c0){if(_0x1e17c0)_0x2852fc(_0x1e17c0);return _0x5f4f6a();});});})[_0x2624('0x29')](function(){return _0x990fb3[_0x2624('0xcc')](_0x5b1a93,_0x5d465f,function(_0x430793){if(_0x430793){console[_0x2624('0xda')]('err',_0x430793);}else{fs[_0x2624('0xdb')](_0x5b1a93);}});});});}else{return _0x990fb3[_0x2624('0x1e')](0xc8);}})[_0x2624('0x35')](handleError(_0x990fb3,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index a77b42c..214f0cf 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 _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x27d238,_0x479a7d){var _0x35768e=function(_0x33578e){while(--_0x33578e){_0x27d238['push'](_0x27d238['shift']());}};_0x35768e(++_0x479a7d);}(_0x1261,0x144));var _0x1126=function(_0x1aa049,_0x9ae13c){_0x1aa049=_0x1aa049-0x0;var _0x357f29=_0x1261[_0x1aa049];return _0x357f29;};'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 +var _0xc4aa=['unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','getUsers','then','setDataValue','findAll'];(function(_0x13606d,_0x30f265){var _0x1b85b0=function(_0x285c1b){while(--_0x285c1b){_0x13606d['push'](_0x13606d['shift']());}};_0x1b85b0(++_0x30f265);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xc4aa[_0x50a0c2];return _0x5ebadd;};'use strict';var EventEmitter=require(_0xac4a('0x0'));var FaxInteraction=require(_0xac4a('0x1'))['db'][_0xac4a('0x2')];var FaxMessage=require(_0xac4a('0x1'))['db'][_0xac4a('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xac4a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f48ed){return function(_0x15b967,_0x730a38,_0x215f39){_0x15b967[_0xac4a('0x5')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x6')](function(_0x3ef77c){_0x15b967[_0xac4a('0x7')]('Users',_0x3ef77c['map'](function(_0x1aba6d){return{'id':_0x1aba6d['id']};}));return FaxMessage[_0xac4a('0x8')]({'where':{'FaxInteractionId':_0x15b967['id'],'direction':'in','read':![]},'raw':!![]});})[_0xac4a('0x6')](function(_0x4f4146){_0x15b967[_0xac4a('0x7')](_0xac4a('0x9'),_0x4f4146[_0xac4a('0xa')]);FaxInteractionEvents['emit'](_0x2f48ed+':'+_0x15b967['id'],_0x15b967);FaxInteractionEvents[_0xac4a('0xb')](_0x2f48ed,_0x15b967);_0x215f39(null);})['catch'](_0x215f39(null));};}for(var e in events){if(events[_0xac4a('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xac4a('0xd')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 1516f20..83842e9 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 _0x8721=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','FaxInteraction','fax_interactions'];(function(_0x1e7587,_0x852c0b){var _0x9c5a25=function(_0x3cfc14){while(--_0x3cfc14){_0x1e7587['push'](_0x1e7587['shift']());}};_0x9c5a25(++_0x852c0b);}(_0x8721,0x1bf));var _0x1872=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0x8721[_0x158f01];return _0x5ef74e;};'use strict';var _=require(_0x1872('0x0'));var util=require(_0x1872('0x1'));var logger=require(_0x1872('0x2'))(_0x1872('0x3'));var moment=require(_0x1872('0x4'));var BPromise=require(_0x1872('0x5'));var rp=require(_0x1872('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1872('0x7'));var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module[_0x1872('0x8')]=function(_0x423a8d,_0x592a98){return _0x423a8d[_0x1872('0x9')](_0x1872('0xa'),attributes,{'tableName':_0x1872('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3fd40e,_0x1b5a0a,_0x5f52c){if(_0x3fd40e[_0x1872('0xc')](_0x1872('0xd'))){_0x3fd40e[_0x1872('0xe')]=moment()[_0x1872('0xf')](_0x1872('0x10'));}_0x5f52c(null,_0x3fd40e);}}});}; \ No newline at end of file +var _0x81e9=['moment','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','define','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api'];(function(_0x1be842,_0x4f4aeb){var _0x506bff=function(_0x297e39){while(--_0x297e39){_0x1be842['push'](_0x1be842['shift']());}};_0x506bff(++_0x4f4aeb);}(_0x81e9,0xc0));var _0x981e=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x81e9[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require(_0x981e('0x0'));var logger=require(_0x981e('0x1'))(_0x981e('0x2'));var moment=require(_0x981e('0x3'));var BPromise=require('bluebird');var rp=require(_0x981e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x981e('0x5'));var config=require(_0x981e('0x6'));var attributes=require(_0x981e('0x7'));module['exports']=function(_0x3eb80a,_0x5d88bf){return _0x3eb80a[_0x981e('0x8')]('FaxInteraction',attributes,{'tableName':_0x981e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3bf51b,_0x3d5b7b,_0x45e1b5){if(_0x3bf51b[_0x981e('0xa')](_0x981e('0xb'))){_0x3bf51b[_0x981e('0xc')]=moment()[_0x981e('0xd')](_0x981e('0xe'));}_0x45e1b5(null,_0x3bf51b);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index dfab01b..19ebddc 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 _0x1d45=['update','options','raw','where','attributes','AddTagsToFaxInteraction','find','addTags','omit','body','ids','spread','AddTags','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./faxInteraction.socket','register','then','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','info','catch','UpdateFaxInteraction','FaxInteraction'];(function(_0x165b49,_0x121778){var _0x564511=function(_0x4cb900){while(--_0x4cb900){_0x165b49['push'](_0x165b49['shift']());}};_0x564511(++_0x121778);}(_0x1d45,0x155));var _0x51d4=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x1d45[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x51d4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x51d4('0x1'));var fs=require('fs');var Redis=require(_0x51d4('0x2'));var db=require(_0x51d4('0x3'))['db'];var utils=require(_0x51d4('0x4'));var logger=require(_0x51d4('0x5'))(_0x51d4('0x6'));var config=require(_0x51d4('0x7'));var jayson=require(_0x51d4('0x8'));var client=jayson['client'][_0x51d4('0x9')]({'port':0x232a});config[_0x51d4('0xa')]=_[_0x51d4('0xb')](config[_0x51d4('0xa')],{'host':_0x51d4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x51d4('0xa')]));require(_0x51d4('0xd'))[_0x51d4('0xe')](socket);function respondWithRpcPromise(_0xe1703b,_0x129d18,_0x1372ed){return new BPromise(function(_0x2420fc,_0x3ded59){return client['request'](_0xe1703b,_0x1372ed)[_0x51d4('0xf')](function(_0x1749c1){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x129d18,_0x51d4('0x10'));logger[_0x51d4('0x11')](_0x51d4('0x12'),_0x129d18,_0x51d4('0x10'),JSON[_0x51d4('0x13')](_0x1749c1));if(_0x1749c1[_0x51d4('0x14')]){if(_0x1749c1[_0x51d4('0x14')][_0x51d4('0x15')]===0x1f4){logger[_0x51d4('0x14')](_0x51d4('0x16'),_0x129d18,_0x1749c1[_0x51d4('0x14')]['message']);return _0x3ded59(_0x1749c1[_0x51d4('0x14')][_0x51d4('0x17')]);}logger[_0x51d4('0x14')](_0x51d4('0x16'),_0x129d18,_0x1749c1[_0x51d4('0x14')][_0x51d4('0x17')]);return _0x2420fc(_0x1749c1[_0x51d4('0x14')][_0x51d4('0x17')]);}else{logger[_0x51d4('0x18')](_0x51d4('0x16'),_0x129d18,'request\x20sent');_0x2420fc(_0x1749c1['result'][_0x51d4('0x17')]);}})[_0x51d4('0x19')](function(_0x314c3c){logger[_0x51d4('0x14')](_0x51d4('0x16'),_0x129d18,_0x314c3c);_0x3ded59(_0x314c3c);});});}exports[_0x51d4('0x1a')]=function(_0x5d3243){var _0x55fb9d=this;return new Promise(function(_0x219582,_0x1ea1d6){return db[_0x51d4('0x1b')][_0x51d4('0x1c')](_0x5d3243['body'],{'raw':_0x5d3243[_0x51d4('0x1d')]?_0x5d3243['options'][_0x51d4('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d3243[_0x51d4('0x1d')]?_0x5d3243['options'][_0x51d4('0x1f')]||null:null,'attributes':_0x5d3243[_0x51d4('0x1d')]?_0x5d3243['options'][_0x51d4('0x20')]||null:null,'limit':_0x5d3243[_0x51d4('0x1d')]?_0x5d3243[_0x51d4('0x1d')]['limit']||null:null})[_0x51d4('0xf')](function(_0x176417){logger[_0x51d4('0x18')](_0x51d4('0x1a'),_0x5d3243);logger[_0x51d4('0x11')](_0x51d4('0x1a'),_0x5d3243,JSON['stringify'](_0x176417));_0x219582(_0x176417);})[_0x51d4('0x19')](function(_0x381fbb){logger[_0x51d4('0x14')](_0x51d4('0x1a'),_0x381fbb[_0x51d4('0x17')],_0x5d3243);_0x1ea1d6(_0x55fb9d[_0x51d4('0x14')](0x1f4,_0x381fbb[_0x51d4('0x17')]));});});};exports[_0x51d4('0x21')]=function(_0xbb2078){return new Promise(function(_0x1dca0e,_0x1e9f0e){return db[_0x51d4('0x1b')][_0x51d4('0x22')]({'where':_0xbb2078[_0x51d4('0x1d')]?_0xbb2078[_0x51d4('0x1d')][_0x51d4('0x1f')]||null:null})['then'](function(_0xc6be0f){if(_0xc6be0f){return _0xc6be0f[_0x51d4('0x23')](_0xbb2078['body']['ids'],_[_0x51d4('0x24')](_0xbb2078[_0x51d4('0x25')],[_0x51d4('0x26'),'id'])||{});}})[_0x51d4('0x27')](function(_0x832880){logger['info'](_0x51d4('0x28'),_0xbb2078);logger[_0x51d4('0x11')]('AddTags',_0xbb2078,JSON[_0x51d4('0x13')](_0x832880));_0x1dca0e(_0x832880);})['catch'](function(_0x443703){logger['error'](_0x51d4('0x28'),_0x443703[_0x51d4('0x17')],_0xbb2078);_0x1e9f0e(_this['error'](0x1f4,_0x443703['message']));});});}; \ No newline at end of file +var _0xfe60=['error','message','result','UpdateFaxInteraction','FaxInteraction','body','options','where','attributes','limit','then','catch','AddTagsToFaxInteraction','find','addTags','ids','omit','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5ec424,_0x4cd13c){var _0x551958=function(_0x461891){while(--_0x461891){_0x5ec424['push'](_0x5ec424['shift']());}};_0x551958(++_0x4cd13c);}(_0xfe60,0x108));var _0x0fe6=function(_0x469d7c,_0x5c0e36){_0x469d7c=_0x469d7c-0x0;var _0x5a9a18=_0xfe60[_0x469d7c];return _0x5a9a18;};'use strict';var _=require(_0x0fe6('0x0'));var util=require(_0x0fe6('0x1'));var moment=require('moment');var BPromise=require(_0x0fe6('0x2'));var rs=require(_0x0fe6('0x3'));var fs=require('fs');var Redis=require(_0x0fe6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0fe6('0x5'));var logger=require(_0x0fe6('0x6'))(_0x0fe6('0x7'));var config=require(_0x0fe6('0x8'));var jayson=require(_0x0fe6('0x9'));var client=jayson[_0x0fe6('0xa')]['http']({'port':0x232a});config[_0x0fe6('0xb')]=_[_0x0fe6('0xc')](config[_0x0fe6('0xb')],{'host':_0x0fe6('0xd'),'port':0x18eb});var socket=require(_0x0fe6('0xe'))(new Redis(config[_0x0fe6('0xb')]));require(_0x0fe6('0xf'))[_0x0fe6('0x10')](socket);function respondWithRpcPromise(_0x48cc4b,_0x391ce5,_0xc8632a){return new BPromise(function(_0x4c8064,_0x1bfe43){return client[_0x0fe6('0x11')](_0x48cc4b,_0xc8632a)['then'](function(_0x1d1d72){logger[_0x0fe6('0x12')](_0x0fe6('0x13'),_0x391ce5,_0x0fe6('0x14'));logger[_0x0fe6('0x15')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x391ce5,_0x0fe6('0x14'),JSON[_0x0fe6('0x16')](_0x1d1d72));if(_0x1d1d72[_0x0fe6('0x17')]){if(_0x1d1d72[_0x0fe6('0x17')]['code']===0x1f4){logger[_0x0fe6('0x17')](_0x0fe6('0x13'),_0x391ce5,_0x1d1d72[_0x0fe6('0x17')][_0x0fe6('0x18')]);return _0x1bfe43(_0x1d1d72['error'][_0x0fe6('0x18')]);}logger[_0x0fe6('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x391ce5,_0x1d1d72[_0x0fe6('0x17')][_0x0fe6('0x18')]);return _0x4c8064(_0x1d1d72['error'][_0x0fe6('0x18')]);}else{logger[_0x0fe6('0x12')](_0x0fe6('0x13'),_0x391ce5,_0x0fe6('0x14'));_0x4c8064(_0x1d1d72[_0x0fe6('0x19')]['message']);}})['catch'](function(_0x5e4ce0){logger['error'](_0x0fe6('0x13'),_0x391ce5,_0x5e4ce0);_0x1bfe43(_0x5e4ce0);});});}exports[_0x0fe6('0x1a')]=function(_0x4b65fb){var _0x21c575=this;return new Promise(function(_0x26cac4,_0x344a1a){return db[_0x0fe6('0x1b')]['update'](_0x4b65fb[_0x0fe6('0x1c')],{'raw':_0x4b65fb[_0x0fe6('0x1d')]?_0x4b65fb[_0x0fe6('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b65fb[_0x0fe6('0x1d')]?_0x4b65fb[_0x0fe6('0x1d')][_0x0fe6('0x1e')]||null:null,'attributes':_0x4b65fb[_0x0fe6('0x1d')]?_0x4b65fb['options'][_0x0fe6('0x1f')]||null:null,'limit':_0x4b65fb[_0x0fe6('0x1d')]?_0x4b65fb[_0x0fe6('0x1d')][_0x0fe6('0x20')]||null:null})[_0x0fe6('0x21')](function(_0x38118d){logger[_0x0fe6('0x12')](_0x0fe6('0x1a'),_0x4b65fb);logger[_0x0fe6('0x15')](_0x0fe6('0x1a'),_0x4b65fb,JSON[_0x0fe6('0x16')](_0x38118d));_0x26cac4(_0x38118d);})[_0x0fe6('0x22')](function(_0x45fec9){logger[_0x0fe6('0x17')](_0x0fe6('0x1a'),_0x45fec9[_0x0fe6('0x18')],_0x4b65fb);_0x344a1a(_0x21c575[_0x0fe6('0x17')](0x1f4,_0x45fec9[_0x0fe6('0x18')]));});});};exports[_0x0fe6('0x23')]=function(_0x1aacee){return new Promise(function(_0x50ec4b,_0x5ed550){return db['FaxInteraction'][_0x0fe6('0x24')]({'where':_0x1aacee[_0x0fe6('0x1d')]?_0x1aacee[_0x0fe6('0x1d')][_0x0fe6('0x1e')]||null:null})[_0x0fe6('0x21')](function(_0x5e5e94){if(_0x5e5e94){return _0x5e5e94[_0x0fe6('0x25')](_0x1aacee[_0x0fe6('0x1c')][_0x0fe6('0x26')],_[_0x0fe6('0x27')](_0x1aacee[_0x0fe6('0x1c')],[_0x0fe6('0x26'),'id'])||{});}})['spread'](function(_0x24c91b){logger[_0x0fe6('0x12')]('AddTags',_0x1aacee);logger[_0x0fe6('0x15')](_0x0fe6('0x28'),_0x1aacee,JSON['stringify'](_0x24c91b));_0x50ec4b(_0x24c91b);})[_0x0fe6('0x22')](function(_0xb69f79){logger['error'](_0x0fe6('0x28'),_0xb69f79[_0x0fe6('0x18')],_0x1aacee);_0x5ed550(_this[_0x0fe6('0x17')](0x1f4,_0xb69f79[_0x0fe6('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 858d3dd..07eca8f 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 _0x56d3=['length','faxInteraction:','./faxInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x33e06c,_0x4f9475){var _0xc987e8=function(_0x54b831){while(--_0x54b831){_0x33e06c['push'](_0x33e06c['shift']());}};_0xc987e8(++_0x4f9475);}(_0x56d3,0x107));var _0x356d=function(_0x146dd2,_0x1d5332){_0x146dd2=_0x146dd2-0x0;var _0x4396a6=_0x56d3[_0x146dd2];return _0x4396a6;};'use strict';var FaxInteractionEvents=require(_0x356d('0x0'));var events=[_0x356d('0x1'),_0x356d('0x2'),_0x356d('0x3')];function createListener(_0x2098c5,_0x1cba37){return function(_0x4197de){_0x1cba37[_0x356d('0x4')](_0x2098c5,_0x4197de);};}function removeListener(_0x41d6e7,_0x37008d){return function(){FaxInteractionEvents[_0x356d('0x5')](_0x41d6e7,_0x37008d);};}exports[_0x356d('0x6')]=function(_0x22dce0){for(var _0x43b2d3=0x0,_0x1af493=events[_0x356d('0x7')];_0x43b2d3<_0x1af493;_0x43b2d3++){var _0x2e3959=events[_0x43b2d3];var _0x28af8d=createListener(_0x356d('0x8')+_0x2e3959,_0x22dce0);FaxInteractionEvents['on'](_0x2e3959,_0x28af8d);}}; \ No newline at end of file +var _0x101a=['emit','removeListener','length','faxInteraction:','./faxInteraction.events','save','update'];(function(_0x481fda,_0x169219){var _0x117f77=function(_0x139d00){while(--_0x139d00){_0x481fda['push'](_0x481fda['shift']());}};_0x117f77(++_0x169219);}(_0x101a,0x115));var _0xa101=function(_0x49181a,_0x569b6d){_0x49181a=_0x49181a-0x0;var _0x6e9295=_0x101a[_0x49181a];return _0x6e9295;};'use strict';var FaxInteractionEvents=require(_0xa101('0x0'));var events=[_0xa101('0x1'),'remove',_0xa101('0x2')];function createListener(_0x42353b,_0x23491a){return function(_0x9f177){_0x23491a[_0xa101('0x3')](_0x42353b,_0x9f177);};}function removeListener(_0x19947f,_0x27e313){return function(){FaxInteractionEvents[_0xa101('0x4')](_0x19947f,_0x27e313);};}exports['register']=function(_0x4e8435){for(var _0x2957b8=0x0,_0x2a3a93=events[_0xa101('0x5')];_0x2957b8<_0x2a3a93;_0x2957b8++){var _0x2dab85=events[_0x2957b8];var _0xedb19d=createListener(_0xa101('0x6')+_0x2dab85,_0x4e8435);FaxInteractionEvents['on'](_0x2dab85,_0xedb19d);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index cf17a82..1115b12 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 _0x0f83=['removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','tracked','put','fax','update','delete','faxinteraction:destroy','destroy','/:id/tags'];(function(_0x6a818f,_0x58fe68){var _0x24ffe9=function(_0x5806bd){while(--_0x5806bd){_0x6a818f['push'](_0x6a818f['shift']());}};_0x24ffe9(++_0x58fe68);}(_0x0f83,0x157));var _0x30f8=function(_0x21bb8a,_0x8ba707){_0x21bb8a=_0x21bb8a-0x0;var _0x7c0d1c=_0x0f83[_0x21bb8a];return _0x7c0d1c;};'use strict';var multer=require(_0x30f8('0x0'));var util=require(_0x30f8('0x1'));var path=require(_0x30f8('0x2'));var timeout=require(_0x30f8('0x3'));var express=require('express');var router=express[_0x30f8('0x4')]();var fs_extra=require(_0x30f8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x30f8('0x6'));var controller=require(_0x30f8('0x7'));router[_0x30f8('0x8')]('/',auth[_0x30f8('0x9')](),controller[_0x30f8('0xa')]);router['get'](_0x30f8('0xb'),auth[_0x30f8('0x9')](),controller['describe']);router['get'](_0x30f8('0xc'),auth['isAuthenticated'](),controller[_0x30f8('0xd')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x30f8('0xe')]);router[_0x30f8('0x8')](_0x30f8('0xf'),auth[_0x30f8('0x9')](),controller[_0x30f8('0x10')]);router[_0x30f8('0x11')]('/',auth[_0x30f8('0x9')](),controller[_0x30f8('0x12')]);router[_0x30f8('0x11')](_0x30f8('0x13'),auth['isAuthenticated'](),controller[_0x30f8('0x14')]);router[_0x30f8('0x11')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x30f8('0x15')]('fax','faxinteraction:addtags'),controller['addTags']);router[_0x30f8('0x16')](_0x30f8('0xc'),auth[_0x30f8('0x9')](),interaction['tracked'](_0x30f8('0x17'),'faxinteraction:update'),controller[_0x30f8('0x18')]);router[_0x30f8('0x19')](_0x30f8('0xc'),auth[_0x30f8('0x9')](),interaction[_0x30f8('0x15')](_0x30f8('0x17'),_0x30f8('0x1a')),controller[_0x30f8('0x1b')]);router[_0x30f8('0x19')](_0x30f8('0x1c'),auth[_0x30f8('0x9')](),controller[_0x30f8('0x1d')]);module[_0x30f8('0x1e')]=router; \ No newline at end of file +var _0x0ac1=['faxinteraction:update','update','faxinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./faxInteraction.controller','index','get','/describe','isAuthenticated','describe','/:id','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','put'];(function(_0x54d49e,_0x5d9911){var _0x4af0f1=function(_0xf117b3){while(--_0xf117b3){_0x54d49e['push'](_0x54d49e['shift']());}};_0x4af0f1(++_0x5d9911);}(_0x0ac1,0x1e3));var _0x10ac=function(_0x1c4ccf,_0x4761c4){_0x1c4ccf=_0x1c4ccf-0x0;var _0x2380b4=_0x0ac1[_0x1c4ccf];return _0x2380b4;};'use strict';var multer=require(_0x10ac('0x0'));var util=require(_0x10ac('0x1'));var path=require(_0x10ac('0x2'));var timeout=require(_0x10ac('0x3'));var express=require('express');var router=express[_0x10ac('0x4')]();var fs_extra=require(_0x10ac('0x5'));var auth=require(_0x10ac('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x10ac('0x7'));var controller=require(_0x10ac('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x10ac('0x9')]);router[_0x10ac('0xa')](_0x10ac('0xb'),auth[_0x10ac('0xc')](),controller[_0x10ac('0xd')]);router[_0x10ac('0xa')](_0x10ac('0xe'),auth[_0x10ac('0xc')](),controller['show']);router[_0x10ac('0xa')]('/:id/messages',auth[_0x10ac('0xc')](),controller[_0x10ac('0xf')]);router[_0x10ac('0xa')](_0x10ac('0x10'),auth['isAuthenticated'](),controller[_0x10ac('0x11')]);router[_0x10ac('0x12')]('/',auth['isAuthenticated'](),controller[_0x10ac('0x13')]);router[_0x10ac('0x12')](_0x10ac('0x14'),auth['isAuthenticated'](),controller[_0x10ac('0x15')]);router[_0x10ac('0x12')](_0x10ac('0x16'),auth[_0x10ac('0xc')](),interaction[_0x10ac('0x17')](_0x10ac('0x18'),_0x10ac('0x19')),controller['addTags']);router[_0x10ac('0x1a')](_0x10ac('0xe'),auth[_0x10ac('0xc')](),interaction[_0x10ac('0x17')](_0x10ac('0x18'),_0x10ac('0x1b')),controller[_0x10ac('0x1c')]);router['delete'](_0x10ac('0xe'),auth[_0x10ac('0xc')](),interaction[_0x10ac('0x17')](_0x10ac('0x18'),_0x10ac('0x1d')),controller[_0x10ac('0x1e')]);router[_0x10ac('0x1f')](_0x10ac('0x16'),auth[_0x10ac('0xc')](),controller[_0x10ac('0x20')]);module[_0x10ac('0x21')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 515d9f7..ab09f65 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 _0xef6a=['DATE','exports','medium','ENUM','out','TEXT'];(function(_0x1308e8,_0x4290fb){var _0x22d2ec=function(_0x377e6f){while(--_0x377e6f){_0x1308e8['push'](_0x1308e8['shift']());}};_0x22d2ec(++_0x4290fb);}(_0xef6a,0x175));var _0xaef6=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xef6a[_0x3b0731];return _0x4204d7;};'use strict';var Sequelize=require('sequelize');module[_0xaef6('0x0')]={'body':{'type':Sequelize['TEXT'](_0xaef6('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xaef6('0x2')]('in',_0xaef6('0x3')),'defaultValue':_0xaef6('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xaef6('0x4')],'defaultValue':null},'readAt':{'type':Sequelize[_0xaef6('0x5')]}}; \ No newline at end of file +var _0x2d02=['BOOLEAN','ENUM','out','DATE','exports','TEXT','medium'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2d02,0xd6));var _0x22d0=function(_0x5c299d,_0x333e3d){_0x5c299d=_0x5c299d-0x0;var _0x30806f=_0x2d02[_0x5c299d];return _0x30806f;};'use strict';var Sequelize=require('sequelize');module[_0x22d0('0x0')]={'body':{'type':Sequelize[_0x22d0('0x1')](_0x22d0('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x22d0('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x22d0('0x4')]('in',_0x22d0('0x5')),'defaultValue':_0x22d0('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x22d0('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index b65d9c0..4f7b19a 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 _0x0598=['role','RejectMessage','rejectMessage','rejectmessage','create','ContactId','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','basename','download','join','root','server','files','attachments','eml-format','rimraf','fast-json-patch','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','http','client','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','index','FaxMessage','fieldName','type','key','map','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','body','find','describe','../../config/logger','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','CmContact','Contact','get','FaxInteraction','isNil','read1stAt','interaction','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','fax','FaxInteractionId'];(function(_0x5a076a,_0x966333){var _0x152733=function(_0x15dfea){while(--_0x15dfea){_0x5a076a['push'](_0x5a076a['shift']());}};_0x152733(++_0x966333);}(_0x0598,0x92));var _0x8059=function(_0x2788f7,_0xfa3a60){_0x2788f7=_0x2788f7-0x0;var _0x93ba54=_0x0598[_0x2788f7];return _0x93ba54;};'use strict';var emlformat=require(_0x8059('0x0'));var rimraf=require(_0x8059('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8059('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8059('0x3'));var Mustache=require(_0x8059('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8059('0x5'));var ejs=require(_0x8059('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8059('0x7'));var crypto=require(_0x8059('0x8'));var jsforce=require(_0x8059('0x9'));var deskjs=require(_0x8059('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8059('0xb'));var Redis=require(_0x8059('0xc'));var authService=require(_0x8059('0xd'));var qs=require(_0x8059('0xe'));var as=require(_0x8059('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8059('0x10'));var utils=require(_0x8059('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8059('0x12')]=_[_0x8059('0x13')](config[_0x8059('0x12')],{'host':_0x8059('0x14'),'port':0x18eb});var socket=require(_0x8059('0x15'))(new Redis(config['redis']));require(_0x8059('0x16'))['register'](socket);var jayson=require(_0x8059('0x17'));var client=jayson['client'][_0x8059('0x18')]({'port':0x232c});var client9002=jayson[_0x8059('0x19')][_0x8059('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4d3873,_0x516c1f,_0x5cda43,_0x3b8f18){return new BPromise(function(_0x239195,_0x2ffebf){var _0x246c9d=_0x3b8f18||client;return _0x246c9d[_0x8059('0x1a')](_0x4d3873,_0x5cda43)['then'](function(_0x10ad98){logger[_0x8059('0x1b')](_0x8059('0x1c'),_0x516c1f,_0x8059('0x1d'));logger['debug'](_0x8059('0x1e'),_0x516c1f,'request\x20sent',JSON[_0x8059('0x1f')](_0x10ad98));if(_0x10ad98['error']){if(_0x10ad98[_0x8059('0x20')]['code']===0x1f4){logger[_0x8059('0x20')](_0x8059('0x1c'),_0x516c1f,_0x10ad98[_0x8059('0x20')]['message']);return _0x2ffebf(_0x10ad98['error'][_0x8059('0x21')]);}logger[_0x8059('0x20')](_0x8059('0x1c'),_0x516c1f,_0x10ad98[_0x8059('0x20')]['message']);return _0x239195(_0x10ad98[_0x8059('0x20')][_0x8059('0x21')]);}else{logger[_0x8059('0x1b')]('FaxMessage,\x20%s,\x20%s',_0x516c1f,_0x8059('0x1d'));_0x239195(_0x10ad98[_0x8059('0x22')][_0x8059('0x21')]);}})[_0x8059('0x23')](function(_0x59d3a6){logger[_0x8059('0x20')](_0x8059('0x1c'),_0x516c1f,_0x59d3a6);_0x2ffebf(_0x59d3a6);});});}function respondWithStatusCode(_0x4781e2,_0x3e2d2b){_0x3e2d2b=_0x3e2d2b||0xcc;return function(_0x202b30){if(_0x202b30){return _0x4781e2['sendStatus'](_0x3e2d2b);}return _0x4781e2[_0x8059('0x24')](_0x3e2d2b)[_0x8059('0x25')]();};}function respondWithResult(_0xd1fa7e,_0x4a294f){_0x4a294f=_0x4a294f||0xc8;return function(_0x582321){if(_0x582321){return _0xd1fa7e['status'](_0x4a294f)[_0x8059('0x26')](_0x582321);}};}function respondWithFilteredResult(_0xbebe0e,_0xc32b1f){return function(_0x1009af){if(_0x1009af){var _0x59abe9=_0x1009af[_0x8059('0x27')],_0x1eb71b=_0xc32b1f['offset'],_0x50b737=_0xc32b1f[_0x8059('0x28')]+_0xc32b1f[_0x8059('0x29')],_0x2f887c;if(_0x50b737>=_0x59abe9){_0x50b737=_0x59abe9;_0x2f887c=0xc8;}else{_0x2f887c=0xce;}_0xbebe0e[_0x8059('0x24')](_0x2f887c);return _0xbebe0e[_0x8059('0x2a')](_0x8059('0x2b'),_0x1eb71b+'-'+_0x50b737+'/'+_0x59abe9)[_0x8059('0x26')](_0x1009af);}return null;};}function patchUpdates(_0x46b6a1){return function(_0x2016ea){try{jsonpatch['apply'](_0x2016ea,_0x46b6a1,!![]);}catch(_0xb3c36e){return BPromise[_0x8059('0x2c')](_0xb3c36e);}return _0x2016ea[_0x8059('0x2d')]();};}function saveUpdates(_0x15f843,_0x289992){return function(_0x53fb30){if(_0x53fb30){return _0x53fb30[_0x8059('0x2e')](_0x15f843)[_0x8059('0x2f')](function(_0x27c947){return _0x27c947;});}return null;};}function removeEntity(_0x15160a,_0x3ee515){return function(_0x22fd6f){if(_0x22fd6f){return _0x22fd6f[_0x8059('0x30')]()[_0x8059('0x2f')](function(){_0x15160a[_0x8059('0x24')](0xcc)[_0x8059('0x25')]();});}};}function handleEntityNotFound(_0x521ca4,_0x45c175){return function(_0x5b0070){if(!_0x5b0070){_0x521ca4[_0x8059('0x31')](0x194);}return _0x5b0070;};}function handleError(_0x5dc3f7,_0x49fb7e){_0x49fb7e=_0x49fb7e||0x1f4;return function(_0x2191a0){logger['error'](_0x2191a0[_0x8059('0x32')]);if(_0x2191a0['name']){delete _0x2191a0[_0x8059('0x33')];}_0x5dc3f7['status'](_0x49fb7e)[_0x8059('0x34')](_0x2191a0);};}exports[_0x8059('0x35')]=function(_0x53252a,_0x3a3e20){var _0x7961af={},_0x3e5fd3={},_0x483058={'count':0x0,'rows':[]};var _0x241403=_['map'](db[_0x8059('0x36')]['rawAttributes'],function(_0x2034ec){return{'name':_0x2034ec[_0x8059('0x37')],'type':_0x2034ec[_0x8059('0x38')][_0x8059('0x39')]};});_0x3e5fd3['model']=_[_0x8059('0x3a')](_0x241403,'name');_0x3e5fd3['query']=_[_0x8059('0x3b')](_0x53252a[_0x8059('0x3c')]);_0x3e5fd3[_0x8059('0x3d')]=_[_0x8059('0x3e')](_0x3e5fd3[_0x8059('0x3f')],_0x3e5fd3['query']);_0x7961af['attributes']=_['intersection'](_0x3e5fd3['model'],qs[_0x8059('0x40')](_0x53252a[_0x8059('0x3c')][_0x8059('0x40')]));_0x7961af['attributes']=_0x7961af[_0x8059('0x41')][_0x8059('0x42')]?_0x7961af['attributes']:_0x3e5fd3[_0x8059('0x3f')];if(!_0x53252a[_0x8059('0x3c')][_0x8059('0x43')]('nolimit')){_0x7961af[_0x8059('0x29')]=qs[_0x8059('0x29')](_0x53252a['query'][_0x8059('0x29')]);_0x7961af[_0x8059('0x28')]=qs[_0x8059('0x28')](_0x53252a[_0x8059('0x3c')][_0x8059('0x28')]);}_0x7961af[_0x8059('0x44')]=qs[_0x8059('0x45')](_0x53252a[_0x8059('0x3c')][_0x8059('0x45')]);_0x7961af[_0x8059('0x46')]=qs[_0x8059('0x3d')](_[_0x8059('0x47')](_0x53252a[_0x8059('0x3c')],_0x3e5fd3[_0x8059('0x3d')]),_0x241403);if(_0x53252a[_0x8059('0x3c')][_0x8059('0x48')]){_0x7961af[_0x8059('0x46')]=_[_0x8059('0x49')](_0x7961af[_0x8059('0x46')],{'$or':_[_0x8059('0x3a')](_0x241403,function(_0x355595){if(_0x355595[_0x8059('0x38')]!==_0x8059('0x4a')){var _0x4ecb27={};_0x4ecb27[_0x355595[_0x8059('0x33')]]={'$like':'%'+_0x53252a['query']['filter']+'%'};return _0x4ecb27;}})});}_0x7961af=_[_0x8059('0x49')]({},_0x7961af,_0x53252a['options']);var _0x3dc221={'where':_0x7961af['where']};return db[_0x8059('0x36')][_0x8059('0x27')](_0x3dc221)[_0x8059('0x2f')](function(_0x2b69ae){_0x483058[_0x8059('0x27')]=_0x2b69ae;if(_0x53252a[_0x8059('0x3c')]['includeAll']){_0x7961af[_0x8059('0x4b')]=[{'all':!![]}];}return db['FaxMessage'][_0x8059('0x4c')](_0x7961af);})[_0x8059('0x2f')](function(_0x3b954e){_0x483058['rows']=_0x3b954e;return _0x483058;})[_0x8059('0x2f')](respondWithFilteredResult(_0x3a3e20,_0x7961af))[_0x8059('0x23')](handleError(_0x3a3e20,null));};exports[_0x8059('0x4d')]=function(_0x280c42,_0x584e13){var _0x3ccfb1={'raw':!![],'where':{'id':_0x280c42[_0x8059('0x4e')]['id']}},_0x2c0108={};_0x2c0108['model']=_[_0x8059('0x3b')](db['FaxMessage']['rawAttributes']);_0x2c0108[_0x8059('0x3c')]=_['keys'](_0x280c42[_0x8059('0x3c')]);_0x2c0108['filters']=_[_0x8059('0x3e')](_0x2c0108[_0x8059('0x3f')],_0x2c0108['query']);_0x3ccfb1[_0x8059('0x41')]=_['intersection'](_0x2c0108[_0x8059('0x3f')],qs[_0x8059('0x40')](_0x280c42[_0x8059('0x3c')]['fields']));_0x3ccfb1[_0x8059('0x41')]=_0x3ccfb1['attributes'][_0x8059('0x42')]?_0x3ccfb1[_0x8059('0x41')]:_0x2c0108[_0x8059('0x3f')];if(_0x280c42[_0x8059('0x3c')]['includeAll']){_0x3ccfb1[_0x8059('0x4b')]=[{'all':!![]}];}_0x3ccfb1=_[_0x8059('0x49')]({},_0x3ccfb1,_0x280c42['options']);return db[_0x8059('0x36')]['find'](_0x3ccfb1)[_0x8059('0x2f')](handleEntityNotFound(_0x584e13,null))['then'](respondWithResult(_0x584e13,null))['catch'](handleError(_0x584e13,null));};exports[_0x8059('0x2e')]=function(_0x388829,_0x15ed31){if(_0x388829[_0x8059('0x4f')]['id']){delete _0x388829[_0x8059('0x4f')]['id'];}return db[_0x8059('0x36')][_0x8059('0x50')]({'where':{'id':_0x388829['params']['id']}})['then'](handleEntityNotFound(_0x15ed31,null))['then'](saveUpdates(_0x388829['body'],null))[_0x8059('0x2f')](respondWithResult(_0x15ed31,null))[_0x8059('0x23')](handleError(_0x15ed31,null));};exports['destroy']=function(_0x411fe1,_0x4b0078){return db['FaxMessage'][_0x8059('0x50')]({'where':{'id':_0x411fe1['params']['id']}})[_0x8059('0x2f')](handleEntityNotFound(_0x4b0078,null))[_0x8059('0x2f')](removeEntity(_0x4b0078,null))[_0x8059('0x23')](handleError(_0x4b0078,null));};exports['describe']=function(_0x52511f,_0x886c5c){return db[_0x8059('0x36')][_0x8059('0x51')]()['then'](respondWithResult(_0x886c5c,null))['catch'](handleError(_0x886c5c,null));};var interaction_log=require(_0x8059('0x52'))('fax-interactions');exports['accept']=function(_0x43929f,_0x51927e,_0x391687){var _0x1c4015={'agent':{},'channel':'fax'};if(_0x43929f['body']['id']){delete _0x43929f[_0x8059('0x4f')]['id'];}_0x43929f[_0x8059('0x4f')][_0x8059('0x53')]=!![];_0x43929f['body'][_0x8059('0x54')]=moment()[_0x8059('0x55')](_0x8059('0x56'));_0x43929f[_0x8059('0x4f')]['UserId']=_0x43929f[_0x8059('0x4f')]['UserId']||_0x43929f[_0x8059('0x57')]['id'];_0x1c4015[_0x8059('0x58')]['id']=_0x43929f['body'][_0x8059('0x59')];return db['FaxMessage'][_0x8059('0x50')]({'where':{'id':_0x43929f[_0x8059('0x4e')]['id'],'UserId':null},'include':[{'model':db[_0x8059('0x5a')],'as':_0x8059('0x5b')}]})[_0x8059('0x2f')](handleEntityNotFound(_0x51927e,null))[_0x8059('0x2f')](saveUpdates(_0x43929f[_0x8059('0x4f')],null))[_0x8059('0x2f')](function(_0x352e51){if(_0x352e51){_0x1c4015[_0x8059('0x21')]=_0x352e51[_0x8059('0x5c')]({'plain':!![]});return db[_0x8059('0x5d')][_0x8059('0x50')]({'where':{'id':_0x352e51['FaxInteractionId']}});}return null;})[_0x8059('0x2f')](handleEntityNotFound(_0x51927e,null))[_0x8059('0x2f')](function(_0x391924){if(_0x391924){return _0x391924[_0x8059('0x2e')]({'UserId':_0x43929f[_0x8059('0x4f')]['UserId'],'read1stAt':_[_0x8059('0x5e')](_0x391924[_0x8059('0x5f')])?moment()[_0x8059('0x55')](_0x8059('0x56')):undefined});}return null;})[_0x8059('0x2f')](function(_0xf0ae){if(_0xf0ae){_0x1c4015[_0x8059('0x60')]=_0xf0ae[_0x8059('0x5c')]({'plain':!![]});interaction_log[_0x8059('0x1b')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x43929f[_0x8059('0x57')]['id'],_0x43929f[_0x8059('0x57')][_0x8059('0x33')],_0x43929f['user']['role'],_0x1c4015[_0x8059('0x60')]['id'],_0x43929f[_0x8059('0x4f')]?JSON[_0x8059('0x1f')](_0x43929f[_0x8059('0x4f')]):_0x8059('0x61'));return respondWithRpcPromise(_0x8059('0x62'),_0x8059('0x63'),_0x1c4015);}return null;})['then'](function(_0x35ec63){if(_0x35ec63){if(_0x43929f[_0x8059('0x4f')][_0x8059('0x64')]){_0x1c4015['message'][_0x8059('0x65')]=util[_0x8059('0x55')](_0x8059('0x66'),_0x43929f[_0x8059('0x57')]['name']);_0x1c4015['message'][_0x8059('0x67')]=_0x1c4015[_0x8059('0x67')];_0x1c4015['message'][_0x8059('0x68')]=_0x8059('0x69');return respondWithRpcPromise(_0x8059('0x6a'),_0x8059('0x6a'),{'event':_0x8059('0x6b'),'message':_0x1c4015[_0x8059('0x21')]},client9002)['then'](function(){return _0x1c4015;});}return _0x1c4015;}return null;})[_0x8059('0x2f')](respondWithResult(_0x51927e,null))[_0x8059('0x23')](handleError(_0x51927e,null));};var interaction_log=require(_0x8059('0x52'))('fax-interactions');exports['reject']=function(_0x36b586,_0x3934f0,_0x489065){var _0x1f9c4f={'agent':{},'channel':_0x8059('0x6c')};if(_0x36b586[_0x8059('0x4f')]['id']){delete _0x36b586[_0x8059('0x4f')]['id'];}_0x36b586[_0x8059('0x4f')][_0x8059('0x59')]=_0x36b586[_0x8059('0x4f')][_0x8059('0x59')]||_0x36b586[_0x8059('0x57')]['id'];_0x1f9c4f[_0x8059('0x58')]['id']=_0x36b586[_0x8059('0x4f')][_0x8059('0x59')];return db['FaxMessage'][_0x8059('0x50')]({'where':{'id':_0x36b586[_0x8059('0x4e')]['id'],'UserId':null}})[_0x8059('0x2f')](handleEntityNotFound(_0x3934f0,null))['then'](function(_0x48d32f){if(_0x48d32f){_0x1f9c4f[_0x8059('0x21')]=_0x48d32f['get']({'plain':!![]});return db['FaxInteraction'][_0x8059('0x50')]({'where':{'id':_0x48d32f[_0x8059('0x6d')]}});}return null;})['then'](handleEntityNotFound(_0x3934f0,null))[_0x8059('0x2f')](function(_0x221200){if(_0x221200){_0x1f9c4f['interaction']=_0x221200['get']({'plain':!![]});interaction_log[_0x8059('0x1b')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x36b586['user']['id'],_0x36b586[_0x8059('0x57')][_0x8059('0x33')],_0x36b586[_0x8059('0x57')][_0x8059('0x6e')],_0x1f9c4f['interaction']['id'],_0x36b586['body']?JSON[_0x8059('0x1f')](_0x36b586[_0x8059('0x4f')]):_0x8059('0x61'));return respondWithRpcPromise(_0x8059('0x6f'),_0x8059('0x70'),_0x1f9c4f);}return null;})[_0x8059('0x2f')](function(_0x50c86d){if(_0x50c86d){_0x50c86d['message'][_0x8059('0x65')]=util[_0x8059('0x55')](_0x8059('0x66'),_0x36b586['user'][_0x8059('0x33')]);_0x50c86d[_0x8059('0x21')]['channel']=_0x1f9c4f[_0x8059('0x67')];_0x50c86d[_0x8059('0x21')]['event']=_0x8059('0x2c');respondWithRpcPromise(_0x8059('0x6a'),_0x8059('0x6a'),{'event':_0x8059('0x71'),'message':_0x50c86d[_0x8059('0x21')]},client9002);return _0x1f9c4f;}return null;})[_0x8059('0x2f')](respondWithResult(_0x3934f0,null))[_0x8059('0x23')](handleError(_0x3934f0,null));};exports[_0x8059('0x72')]=function(_0x469b4e,_0x55fb0f){var _0x48d884;return db[_0x8059('0x36')][_0x8059('0x72')](_0x469b4e[_0x8059('0x4f')],{})[_0x8059('0x2f')](function(_0x1a92c9){_0x48d884=_0x1a92c9;return db[_0x8059('0x5a')]['findOne']({'where':{'id':_0x48d884[_0x8059('0x73')]}});})[_0x8059('0x2f')](function(_0x185a25){if(_['isNil'](_0x185a25)){return;}else{_0x48d884[_0x8059('0x6c')]=_0x185a25[_0x8059('0x6c')];return db[_0x8059('0x74')][_0x8059('0x75')]({'where':{'id':_0x48d884[_0x8059('0x76')]}});}})[_0x8059('0x2f')](function(_0x902642){return respondWithRpcPromise(_0x8059('0x77'),_0x8059('0x77'),{'FaxAccountId':_[_0x8059('0x5e')](_0x469b4e[_0x8059('0x4f')])?undefined:_0x469b4e[_0x8059('0x4f')][_0x8059('0x78')],'path':_[_0x8059('0x5e')](_0x902642)?undefined:util[_0x8059('0x55')]('/var/opt/motion2/server/files/attachments/%s',_0x902642[_0x8059('0x79')]),'fax':_[_0x8059('0x5e')](_0x48d884['fax'])?undefined:_0x48d884[_0x8059('0x6c')],'AttachmentId':_0x48d884['AttachmentId']},client9002);})[_0x8059('0x2f')](respondWithResult(_0x55fb0f,0xc9))[_0x8059('0x23')](handleError(_0x55fb0f,null));};exports[_0x8059('0x7a')]=function(_0x8c6096,_0x1e2b15){var _0x416c93=path[_0x8059('0x7b')](config[_0x8059('0x7c')],_0x8059('0x7d'),_0x8059('0x7e'),_0x8059('0x7f'));return db[_0x8059('0x36')]['find']({'where':{'id':_0x8c6096['params']['id']},'include':[{'model':db[_0x8059('0x74')],'as':_0x8059('0x74')}]})['then'](handleEntityNotFound(_0x1e2b15,null))[_0x8059('0x2f')](function(_0x4ae0ca){if(_0x4ae0ca){return _0x1e2b15[_0x8059('0x7a')](path[_0x8059('0x7b')](_0x416c93,_0x4ae0ca[_0x8059('0x74')][_0x8059('0x79')]));}})[_0x8059('0x23')](handleError(_0x1e2b15,null));}; \ No newline at end of file +var _0x0833=['YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','manual','interface','channel','event','acceptmessage','fax-interactions','RejectMessage','rejectMessage','SIP/%s','EventManager','create','findOne','ContactId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','server','files','attachments','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','lodash','squel','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','./faxMessage.socket','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','FaxMessage','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','params','keys','includeAll','find','catch','body','describe','accept','fax','readAt','format'];(function(_0x5bb150,_0x4ab5bc){var _0xe240d4=function(_0x8fdd6b){while(--_0x8fdd6b){_0x5bb150['push'](_0x5bb150['shift']());}};_0xe240d4(++_0x4ab5bc);}(_0x0833,0x1bd));var _0x3083=function(_0x335857,_0x59061f){_0x335857=_0x335857-0x0;var _0x3fe127=_0x0833[_0x335857];return _0x3fe127;};'use strict';var emlformat=require(_0x3083('0x0'));var rimraf=require(_0x3083('0x1'));var zipdir=require(_0x3083('0x2'));var jsonpatch=require(_0x3083('0x3'));var rp=require(_0x3083('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3083('0x5'));var path=require('path');var sox=require(_0x3083('0x6'));var csv=require(_0x3083('0x7'));var ejs=require(_0x3083('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3083('0x9'));var squel=require(_0x3083('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3083('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3083('0xb'));var authService=require(_0x3083('0xc'));var qs=require(_0x3083('0xd'));var as=require(_0x3083('0xe'));var hardwareService=require(_0x3083('0xf'));var logger=require(_0x3083('0x10'))(_0x3083('0x11'));var utils=require(_0x3083('0x12'));var config=require(_0x3083('0x13'));var licenseUtil=require(_0x3083('0x14'));var db=require(_0x3083('0x15'))['db'];config[_0x3083('0x16')]=_[_0x3083('0x17')](config[_0x3083('0x16')],{'host':_0x3083('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3083('0x16')]));require(_0x3083('0x19'))['register'](socket);var jayson=require(_0x3083('0x1a'));var client=jayson[_0x3083('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x3083('0x1b')][_0x3083('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1b6955,_0x143cac,_0x3f1f08,_0x1de928){return new BPromise(function(_0xecb368,_0x4d9193){var _0x5c23ea=_0x1de928||client;return _0x5c23ea['request'](_0x1b6955,_0x3f1f08)[_0x3083('0x1d')](function(_0x57fdf7){logger[_0x3083('0x1e')](_0x3083('0x1f'),_0x143cac,_0x3083('0x20'));logger[_0x3083('0x21')](_0x3083('0x22'),_0x143cac,_0x3083('0x20'),JSON[_0x3083('0x23')](_0x57fdf7));if(_0x57fdf7[_0x3083('0x24')]){if(_0x57fdf7[_0x3083('0x24')][_0x3083('0x25')]===0x1f4){logger[_0x3083('0x24')](_0x3083('0x1f'),_0x143cac,_0x57fdf7[_0x3083('0x24')][_0x3083('0x26')]);return _0x4d9193(_0x57fdf7['error']['message']);}logger[_0x3083('0x24')]('FaxMessage,\x20%s,\x20%s',_0x143cac,_0x57fdf7[_0x3083('0x24')][_0x3083('0x26')]);return _0xecb368(_0x57fdf7[_0x3083('0x24')][_0x3083('0x26')]);}else{logger[_0x3083('0x1e')](_0x3083('0x1f'),_0x143cac,_0x3083('0x20'));_0xecb368(_0x57fdf7[_0x3083('0x27')][_0x3083('0x26')]);}})['catch'](function(_0x3b11d1){logger['error']('FaxMessage,\x20%s,\x20%s',_0x143cac,_0x3b11d1);_0x4d9193(_0x3b11d1);});});}function respondWithStatusCode(_0x1bea50,_0x14c963){_0x14c963=_0x14c963||0xcc;return function(_0x2afe80){if(_0x2afe80){return _0x1bea50[_0x3083('0x28')](_0x14c963);}return _0x1bea50[_0x3083('0x29')](_0x14c963)[_0x3083('0x2a')]();};}function respondWithResult(_0x5369f4,_0xd38b35){_0xd38b35=_0xd38b35||0xc8;return function(_0x57eade){if(_0x57eade){return _0x5369f4[_0x3083('0x29')](_0xd38b35)[_0x3083('0x2b')](_0x57eade);}};}function respondWithFilteredResult(_0x52d4c7,_0x3055d2){return function(_0x55a515){if(_0x55a515){var _0x5d9c98=_0x55a515['count'],_0x1677de=_0x3055d2[_0x3083('0x2c')],_0x233a81=_0x3055d2[_0x3083('0x2c')]+_0x3055d2[_0x3083('0x2d')],_0x2e3158;if(_0x233a81>=_0x5d9c98){_0x233a81=_0x5d9c98;_0x2e3158=0xc8;}else{_0x2e3158=0xce;}_0x52d4c7[_0x3083('0x29')](_0x2e3158);return _0x52d4c7[_0x3083('0x2e')](_0x3083('0x2f'),_0x1677de+'-'+_0x233a81+'/'+_0x5d9c98)[_0x3083('0x2b')](_0x55a515);}return null;};}function patchUpdates(_0x1b4680){return function(_0x31f840){try{jsonpatch[_0x3083('0x30')](_0x31f840,_0x1b4680,!![]);}catch(_0x3bd45c){return BPromise[_0x3083('0x31')](_0x3bd45c);}return _0x31f840[_0x3083('0x32')]();};}function saveUpdates(_0xbf9b,_0x2ff391){return function(_0x3dedf1){if(_0x3dedf1){return _0x3dedf1[_0x3083('0x33')](_0xbf9b)[_0x3083('0x1d')](function(_0x15940f){return _0x15940f;});}return null;};}function removeEntity(_0x45db2d,_0x4c3404){return function(_0x25ec5f){if(_0x25ec5f){return _0x25ec5f[_0x3083('0x34')]()['then'](function(){_0x45db2d[_0x3083('0x29')](0xcc)[_0x3083('0x2a')]();});}};}function handleEntityNotFound(_0x4b92b5,_0x517e20){return function(_0x3b5379){if(!_0x3b5379){_0x4b92b5[_0x3083('0x28')](0x194);}return _0x3b5379;};}function handleError(_0xce2bec,_0x7cc634){_0x7cc634=_0x7cc634||0x1f4;return function(_0x5642f8){logger['error'](_0x5642f8[_0x3083('0x35')]);if(_0x5642f8[_0x3083('0x36')]){delete _0x5642f8[_0x3083('0x36')];}_0xce2bec['status'](_0x7cc634)[_0x3083('0x37')](_0x5642f8);};}exports[_0x3083('0x38')]=function(_0x12ff32,_0x418bb2){var _0x408f33={},_0x546255={},_0x4c5bbc={'count':0x0,'rows':[]};var _0x334498=_['map'](db[_0x3083('0x39')][_0x3083('0x3a')],function(_0x2ea594){return{'name':_0x2ea594[_0x3083('0x3b')],'type':_0x2ea594['type'][_0x3083('0x3c')]};});_0x546255[_0x3083('0x3d')]=_[_0x3083('0x3e')](_0x334498,'name');_0x546255[_0x3083('0x3f')]=_['keys'](_0x12ff32[_0x3083('0x3f')]);_0x546255[_0x3083('0x40')]=_[_0x3083('0x41')](_0x546255[_0x3083('0x3d')],_0x546255['query']);_0x408f33[_0x3083('0x42')]=_['intersection'](_0x546255[_0x3083('0x3d')],qs[_0x3083('0x43')](_0x12ff32[_0x3083('0x3f')][_0x3083('0x43')]));_0x408f33[_0x3083('0x42')]=_0x408f33['attributes'][_0x3083('0x44')]?_0x408f33[_0x3083('0x42')]:_0x546255[_0x3083('0x3d')];if(!_0x12ff32[_0x3083('0x3f')][_0x3083('0x45')](_0x3083('0x46'))){_0x408f33[_0x3083('0x2d')]=qs[_0x3083('0x2d')](_0x12ff32[_0x3083('0x3f')][_0x3083('0x2d')]);_0x408f33['offset']=qs[_0x3083('0x2c')](_0x12ff32['query']['offset']);}_0x408f33[_0x3083('0x47')]=qs[_0x3083('0x48')](_0x12ff32[_0x3083('0x3f')]['sort']);_0x408f33[_0x3083('0x49')]=qs[_0x3083('0x40')](_[_0x3083('0x4a')](_0x12ff32['query'],_0x546255[_0x3083('0x40')]),_0x334498);if(_0x12ff32['query'][_0x3083('0x4b')]){_0x408f33['where']=_[_0x3083('0x4c')](_0x408f33['where'],{'$or':_['map'](_0x334498,function(_0x51339a){if(_0x51339a['type']!==_0x3083('0x4d')){var _0x3673b5={};_0x3673b5[_0x51339a[_0x3083('0x36')]]={'$like':'%'+_0x12ff32[_0x3083('0x3f')][_0x3083('0x4b')]+'%'};return _0x3673b5;}})});}_0x408f33=_[_0x3083('0x4c')]({},_0x408f33,_0x12ff32[_0x3083('0x4e')]);var _0x1388e6={'where':_0x408f33[_0x3083('0x49')]};return db[_0x3083('0x39')]['count'](_0x1388e6)[_0x3083('0x1d')](function(_0x28b1ec){_0x4c5bbc[_0x3083('0x4f')]=_0x28b1ec;if(_0x12ff32[_0x3083('0x3f')]['includeAll']){_0x408f33[_0x3083('0x50')]=[{'all':!![]}];}return db[_0x3083('0x39')][_0x3083('0x51')](_0x408f33);})[_0x3083('0x1d')](function(_0x349967){_0x4c5bbc[_0x3083('0x52')]=_0x349967;return _0x4c5bbc;})[_0x3083('0x1d')](respondWithFilteredResult(_0x418bb2,_0x408f33))['catch'](handleError(_0x418bb2,null));};exports[_0x3083('0x53')]=function(_0x243ee0,_0x5bc934){var _0x17bcf0={'raw':!![],'where':{'id':_0x243ee0[_0x3083('0x54')]['id']}},_0xeac2cd={};_0xeac2cd['model']=_['keys'](db[_0x3083('0x39')]['rawAttributes']);_0xeac2cd[_0x3083('0x3f')]=_[_0x3083('0x55')](_0x243ee0[_0x3083('0x3f')]);_0xeac2cd[_0x3083('0x40')]=_[_0x3083('0x41')](_0xeac2cd[_0x3083('0x3d')],_0xeac2cd[_0x3083('0x3f')]);_0x17bcf0['attributes']=_[_0x3083('0x41')](_0xeac2cd[_0x3083('0x3d')],qs[_0x3083('0x43')](_0x243ee0['query'][_0x3083('0x43')]));_0x17bcf0['attributes']=_0x17bcf0[_0x3083('0x42')][_0x3083('0x44')]?_0x17bcf0['attributes']:_0xeac2cd[_0x3083('0x3d')];if(_0x243ee0[_0x3083('0x3f')][_0x3083('0x56')]){_0x17bcf0[_0x3083('0x50')]=[{'all':!![]}];}_0x17bcf0=_['merge']({},_0x17bcf0,_0x243ee0['options']);return db[_0x3083('0x39')][_0x3083('0x57')](_0x17bcf0)[_0x3083('0x1d')](handleEntityNotFound(_0x5bc934,null))[_0x3083('0x1d')](respondWithResult(_0x5bc934,null))[_0x3083('0x58')](handleError(_0x5bc934,null));};exports[_0x3083('0x33')]=function(_0xdc541e,_0x4e21c4){if(_0xdc541e['body']['id']){delete _0xdc541e[_0x3083('0x59')]['id'];}return db[_0x3083('0x39')]['find']({'where':{'id':_0xdc541e[_0x3083('0x54')]['id']}})[_0x3083('0x1d')](handleEntityNotFound(_0x4e21c4,null))[_0x3083('0x1d')](saveUpdates(_0xdc541e[_0x3083('0x59')],null))[_0x3083('0x1d')](respondWithResult(_0x4e21c4,null))[_0x3083('0x58')](handleError(_0x4e21c4,null));};exports['destroy']=function(_0x1360de,_0x333456){return db['FaxMessage'][_0x3083('0x57')]({'where':{'id':_0x1360de['params']['id']}})[_0x3083('0x1d')](handleEntityNotFound(_0x333456,null))['then'](removeEntity(_0x333456,null))['catch'](handleError(_0x333456,null));};exports['describe']=function(_0x2b5e29,_0x1f7361){return db[_0x3083('0x39')][_0x3083('0x5a')]()[_0x3083('0x1d')](respondWithResult(_0x1f7361,null))[_0x3083('0x58')](handleError(_0x1f7361,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x3083('0x5b')]=function(_0x57db7b,_0x1eb418,_0x289906){var _0x473b21={'agent':{},'channel':_0x3083('0x5c')};if(_0x57db7b[_0x3083('0x59')]['id']){delete _0x57db7b[_0x3083('0x59')]['id'];}_0x57db7b[_0x3083('0x59')]['read']=!![];_0x57db7b['body'][_0x3083('0x5d')]=moment()[_0x3083('0x5e')](_0x3083('0x5f'));_0x57db7b[_0x3083('0x59')][_0x3083('0x60')]=_0x57db7b['body'][_0x3083('0x60')]||_0x57db7b[_0x3083('0x61')]['id'];_0x473b21['agent']['id']=_0x57db7b[_0x3083('0x59')][_0x3083('0x60')];return db[_0x3083('0x39')][_0x3083('0x57')]({'where':{'id':_0x57db7b[_0x3083('0x54')]['id'],'UserId':null},'include':[{'model':db[_0x3083('0x62')],'as':_0x3083('0x63')}]})[_0x3083('0x1d')](handleEntityNotFound(_0x1eb418,null))[_0x3083('0x1d')](saveUpdates(_0x57db7b['body'],null))[_0x3083('0x1d')](function(_0x43e7c2){if(_0x43e7c2){_0x473b21[_0x3083('0x26')]=_0x43e7c2[_0x3083('0x64')]({'plain':!![]});return db[_0x3083('0x65')][_0x3083('0x57')]({'where':{'id':_0x43e7c2[_0x3083('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x1eb418,null))[_0x3083('0x1d')](function(_0x5dda6f){if(_0x5dda6f){return _0x5dda6f[_0x3083('0x33')]({'UserId':_0x57db7b[_0x3083('0x59')][_0x3083('0x60')],'read1stAt':_[_0x3083('0x67')](_0x5dda6f[_0x3083('0x68')])?moment()['format'](_0x3083('0x5f')):undefined});}return null;})[_0x3083('0x1d')](function(_0x377d26){if(_0x377d26){_0x473b21['interaction']=_0x377d26[_0x3083('0x64')]({'plain':!![]});interaction_log[_0x3083('0x1e')](_0x3083('0x69'),_0x57db7b[_0x3083('0x61')]['id'],_0x57db7b[_0x3083('0x61')][_0x3083('0x36')],_0x57db7b['user'][_0x3083('0x6a')],_0x473b21[_0x3083('0x6b')]['id'],_0x57db7b[_0x3083('0x59')]?JSON[_0x3083('0x23')](_0x57db7b['body']):_0x3083('0x6c'));return respondWithRpcPromise(_0x3083('0x6d'),_0x3083('0x6e'),_0x473b21);}return null;})[_0x3083('0x1d')](function(_0x18c61e){if(_0x18c61e){if(_0x57db7b[_0x3083('0x59')][_0x3083('0x6f')]){_0x473b21['message'][_0x3083('0x70')]=util[_0x3083('0x5e')]('SIP/%s',_0x57db7b[_0x3083('0x61')]['name']);_0x473b21['message'][_0x3083('0x71')]=_0x473b21['channel'];_0x473b21[_0x3083('0x26')][_0x3083('0x72')]=_0x3083('0x5b');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x3083('0x73'),'message':_0x473b21[_0x3083('0x26')]},client9002)[_0x3083('0x1d')](function(){return _0x473b21;});}return _0x473b21;}return null;})[_0x3083('0x1d')](respondWithResult(_0x1eb418,null))['catch'](handleError(_0x1eb418,null));};var interaction_log=require(_0x3083('0x10'))(_0x3083('0x74'));exports[_0x3083('0x31')]=function(_0x3b9814,_0x2be06c,_0xfed6e){var _0x24de53={'agent':{},'channel':_0x3083('0x5c')};if(_0x3b9814['body']['id']){delete _0x3b9814[_0x3083('0x59')]['id'];}_0x3b9814[_0x3083('0x59')][_0x3083('0x60')]=_0x3b9814['body'][_0x3083('0x60')]||_0x3b9814[_0x3083('0x61')]['id'];_0x24de53['agent']['id']=_0x3b9814['body'][_0x3083('0x60')];return db[_0x3083('0x39')][_0x3083('0x57')]({'where':{'id':_0x3b9814['params']['id'],'UserId':null}})[_0x3083('0x1d')](handleEntityNotFound(_0x2be06c,null))[_0x3083('0x1d')](function(_0x10c758){if(_0x10c758){_0x24de53[_0x3083('0x26')]=_0x10c758[_0x3083('0x64')]({'plain':!![]});return db[_0x3083('0x65')][_0x3083('0x57')]({'where':{'id':_0x10c758['FaxInteractionId']}});}return null;})[_0x3083('0x1d')](handleEntityNotFound(_0x2be06c,null))[_0x3083('0x1d')](function(_0xa20e81){if(_0xa20e81){_0x24de53[_0x3083('0x6b')]=_0xa20e81[_0x3083('0x64')]({'plain':!![]});interaction_log[_0x3083('0x1e')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3b9814[_0x3083('0x61')]['id'],_0x3b9814[_0x3083('0x61')][_0x3083('0x36')],_0x3b9814[_0x3083('0x61')][_0x3083('0x6a')],_0x24de53[_0x3083('0x6b')]['id'],_0x3b9814[_0x3083('0x59')]?JSON['stringify'](_0x3b9814[_0x3083('0x59')]):_0x3083('0x6c'));return respondWithRpcPromise(_0x3083('0x75'),_0x3083('0x76'),_0x24de53);}return null;})[_0x3083('0x1d')](function(_0x4596cc){if(_0x4596cc){_0x4596cc[_0x3083('0x26')]['interface']=util[_0x3083('0x5e')](_0x3083('0x77'),_0x3b9814['user'][_0x3083('0x36')]);_0x4596cc['message']['channel']=_0x24de53[_0x3083('0x71')];_0x4596cc['message']['event']=_0x3083('0x31');respondWithRpcPromise(_0x3083('0x78'),'EventManager',{'event':'rejectmessage','message':_0x4596cc[_0x3083('0x26')]},client9002);return _0x24de53;}return null;})[_0x3083('0x1d')](respondWithResult(_0x2be06c,null))[_0x3083('0x58')](handleError(_0x2be06c,null));};exports['create']=function(_0x518622,_0x62918){var _0x3824b3;return db[_0x3083('0x39')][_0x3083('0x79')](_0x518622['body'],{})['then'](function(_0x40eb8b){_0x3824b3=_0x40eb8b;return db[_0x3083('0x62')][_0x3083('0x7a')]({'where':{'id':_0x3824b3[_0x3083('0x7b')]}});})['then'](function(_0x2a4633){if(_[_0x3083('0x67')](_0x2a4633)){return;}else{_0x3824b3['fax']=_0x2a4633[_0x3083('0x5c')];return db['Attachment']['findOne']({'where':{'id':_0x3824b3['AttachmentId']}});}})['then'](function(_0x94a3f9){return respondWithRpcPromise(_0x3083('0x7c'),_0x3083('0x7c'),{'FaxAccountId':_[_0x3083('0x67')](_0x518622[_0x3083('0x59')])?undefined:_0x518622[_0x3083('0x59')][_0x3083('0x7d')],'path':_['isNil'](_0x94a3f9)?undefined:util[_0x3083('0x5e')](_0x3083('0x7e'),_0x94a3f9[_0x3083('0x7f')]),'fax':_[_0x3083('0x67')](_0x3824b3[_0x3083('0x5c')])?undefined:_0x3824b3[_0x3083('0x5c')],'AttachmentId':_0x3824b3[_0x3083('0x80')]},client9002);})[_0x3083('0x1d')](respondWithResult(_0x62918,0xc9))[_0x3083('0x58')](handleError(_0x62918,null));};exports[_0x3083('0x81')]=function(_0x1b854a,_0xe26d22){var _0x5d99fc=path[_0x3083('0x82')](config[_0x3083('0x83')],_0x3083('0x84'),_0x3083('0x85'),_0x3083('0x86'));return db[_0x3083('0x39')][_0x3083('0x57')]({'where':{'id':_0x1b854a[_0x3083('0x54')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0x3083('0x1d')](handleEntityNotFound(_0xe26d22,null))[_0x3083('0x1d')](function(_0xe127b3){if(_0xe127b3){return _0xe26d22['download'](path[_0x3083('0x82')](_0x5d99fc,_0xe127b3['Attachment'][_0x3083('0x7f')]));}})[_0x3083('0x58')](handleError(_0xe26d22,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 5138a67..d583fc2 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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x5f55b5,_0x372ef9){var _0x489ba1=function(_0x362202){while(--_0x362202){_0x5f55b5['push'](_0x5f55b5['shift']());}};_0x489ba1(++_0x372ef9);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0x7995('0x0'));var FaxMessage=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){FaxMessageEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);FaxMessageEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];FaxMessage[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x4d8f7b,_0x19f746){var _0x2a8d81=function(_0x18bbc2){while(--_0x18bbc2){_0x4d8f7b['push'](_0x4d8f7b['shift']());}};_0x2a8d81(++_0x19f746);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var EventEmitter=require(_0x7995('0x0'));var FaxMessage=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){FaxMessageEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);FaxMessageEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];FaxMessage[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index dd15220..c6a86c5 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 _0x7af0=['error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','FaxMessage','fax_messages','fti_fax_messages','models','get','direction','toLowerCase','out','secret','UserId','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch'];(function(_0x55f898,_0x542314){var _0x36e2f3=function(_0x1f7272){while(--_0x1f7272){_0x55f898['push'](_0x55f898['shift']());}};_0x36e2f3(++_0x542314);}(_0x7af0,0x1c5));var _0x07af=function(_0x28e2cd,_0x153b42){_0x28e2cd=_0x28e2cd-0x0;var _0x11fd46=_0x7af0[_0x28e2cd];return _0x11fd46;};'use strict';var _=require(_0x07af('0x0'));var util=require(_0x07af('0x1'));var logger=require(_0x07af('0x2'))(_0x07af('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x07af('0x4'));var fs=require('fs');var path=require(_0x07af('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module['exports']=function(_0x545522,_0x8d29cf){return _0x545522['define'](_0x07af('0x6'),attributes,{'tableName':_0x07af('0x7'),'paranoid':![],'indexes':[{'name':_0x07af('0x8'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x13f583,_0x3d8234,_0x265410){var _0x424d54=_0x545522[_0x07af('0x9')];var _0x2b73d8=_0x13f583[_0x07af('0xa')]({'plain':!![]});if(_0x2b73d8[_0x07af('0xb')][_0x07af('0xc')]()==='in'||_0x2b73d8[_0x07af('0xb')][_0x07af('0xc')]()===_0x07af('0xd')&&!_0x2b73d8[_0x07af('0xe')]&&!_['isNil'](_0x2b73d8[_0x07af('0xf')])){_0x424d54[_0x07af('0x10')][_0x07af('0x11')]({'where':{'id':_0x2b73d8[_0x07af('0x12')]}})['then'](function(_0xffd2c9){if(_0xffd2c9){_0xffd2c9[_0x07af('0x13')]({'lastMsgAt':_0x2b73d8[_0x07af('0x14')],'lastMsgDirection':_0x2b73d8[_0x07af('0xb')][_0x07af('0xc')]()});}})[_0x07af('0x15')](function(_0x7396fb){console[_0x07af('0x16')](_0x7396fb);});}_0x265410();}},'charset':_0x07af('0x17'),'collate':_0x07af('0x18')});}; \ No newline at end of file +var _0xeb29=['moment','request-promise','path','rimraf','exports','define','FaxMessage','fti_fax_messages','body','models','get','toLowerCase','direction','out','secret','isNil','FaxInteraction','findOne','then','update','createdAt','catch','error','utf8mb4','lodash'];(function(_0x346bd9,_0x5d29e8){var _0x58613b=function(_0x30a4b6){while(--_0x30a4b6){_0x346bd9['push'](_0x346bd9['shift']());}};_0x58613b(++_0x5d29e8);}(_0xeb29,0x1c1));var _0x9eb2=function(_0x23e776,_0x453cf4){_0x23e776=_0x23e776-0x0;var _0x52285a=_0xeb29[_0x23e776];return _0x52285a;};'use strict';var _=require(_0x9eb2('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9eb2('0x1'));var BPromise=require('bluebird');var rp=require(_0x9eb2('0x2'));var fs=require('fs');var path=require(_0x9eb2('0x3'));var rimraf=require(_0x9eb2('0x4'));var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module[_0x9eb2('0x5')]=function(_0x5d36f1,_0x5d5d9a){return _0x5d36f1[_0x9eb2('0x6')](_0x9eb2('0x7'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x9eb2('0x8'),'fields':[_0x9eb2('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x17e916,_0x32eb85,_0x279cfd){var _0x4de8f5=_0x5d36f1[_0x9eb2('0xa')];var _0x2eb775=_0x17e916[_0x9eb2('0xb')]({'plain':!![]});if(_0x2eb775['direction'][_0x9eb2('0xc')]()==='in'||_0x2eb775[_0x9eb2('0xd')][_0x9eb2('0xc')]()===_0x9eb2('0xe')&&!_0x2eb775[_0x9eb2('0xf')]&&!_[_0x9eb2('0x10')](_0x2eb775['UserId'])){_0x4de8f5[_0x9eb2('0x11')][_0x9eb2('0x12')]({'where':{'id':_0x2eb775['FaxInteractionId']}})[_0x9eb2('0x13')](function(_0x27969d){if(_0x27969d){_0x27969d[_0x9eb2('0x14')]({'lastMsgAt':_0x2eb775[_0x9eb2('0x15')],'lastMsgDirection':_0x2eb775[_0x9eb2('0xd')][_0x9eb2('0xc')]()});}})[_0x9eb2('0x16')](function(_0x54627b){console[_0x9eb2('0x17')](_0x54627b);});}_0x279cfd();}},'charset':_0x9eb2('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 8d95fe1..e81b577 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 _0x36ad=['FaxMessage','create','body','options','raw','then','debug','update','where','attributes','limit','UpdateFaxMessage','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','info','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','CreateFaxMessage'];(function(_0x160cd5,_0x19c58e){var _0x366763=function(_0x3b8e31){while(--_0x3b8e31){_0x160cd5['push'](_0x160cd5['shift']());}};_0x366763(++_0x19c58e);}(_0x36ad,0x189));var _0xd36a=function(_0x1cb778,_0x1f29fb){_0x1cb778=_0x1cb778-0x0;var _0x473fd3=_0x36ad[_0x1cb778];return _0x473fd3;};'use strict';var _=require(_0xd36a('0x0'));var util=require(_0xd36a('0x1'));var moment=require('moment');var BPromise=require(_0xd36a('0x2'));var rs=require(_0xd36a('0x3'));var fs=require('fs');var Redis=require(_0xd36a('0x4'));var db=require(_0xd36a('0x5'))['db'];var utils=require(_0xd36a('0x6'));var logger=require('../../config/logger')(_0xd36a('0x7'));var config=require('../../config/environment');var jayson=require(_0xd36a('0x8'));var client=jayson[_0xd36a('0x9')][_0xd36a('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd36a('0xb')],{'host':_0xd36a('0xc'),'port':0x18eb});var socket=require(_0xd36a('0xd'))(new Redis(config[_0xd36a('0xb')]));require(_0xd36a('0xe'))[_0xd36a('0xf')](socket);function respondWithRpcPromise(_0x513ae9,_0xef155d,_0x5de210){return new BPromise(function(_0x252eb0,_0x357b98){return client['request'](_0x513ae9,_0x5de210)['then'](function(_0x1920dd){logger[_0xd36a('0x10')]('FaxMessage,\x20%s,\x20%s',_0xef155d,_0xd36a('0x11'));logger['debug'](_0xd36a('0x12'),_0xef155d,_0xd36a('0x11'),JSON[_0xd36a('0x13')](_0x1920dd));if(_0x1920dd['error']){if(_0x1920dd[_0xd36a('0x14')][_0xd36a('0x15')]===0x1f4){logger[_0xd36a('0x14')](_0xd36a('0x16'),_0xef155d,_0x1920dd['error'][_0xd36a('0x17')]);return _0x357b98(_0x1920dd['error'][_0xd36a('0x17')]);}logger[_0xd36a('0x14')](_0xd36a('0x16'),_0xef155d,_0x1920dd['error']['message']);return _0x252eb0(_0x1920dd[_0xd36a('0x14')][_0xd36a('0x17')]);}else{logger[_0xd36a('0x10')]('FaxMessage,\x20%s,\x20%s',_0xef155d,_0xd36a('0x11'));_0x252eb0(_0x1920dd['result'][_0xd36a('0x17')]);}})['catch'](function(_0x2ef8b8){logger[_0xd36a('0x14')]('FaxMessage,\x20%s,\x20%s',_0xef155d,_0x2ef8b8);_0x357b98(_0x2ef8b8);});});}exports[_0xd36a('0x18')]=function(_0x1789be){var _0x3da9b2=this;return new Promise(function(_0x1eef25,_0x3e6f6b){return db[_0xd36a('0x19')][_0xd36a('0x1a')](_0x1789be[_0xd36a('0x1b')],{'raw':_0x1789be[_0xd36a('0x1c')]?_0x1789be[_0xd36a('0x1c')][_0xd36a('0x1d')]===undefined?!![]:![]:!![]})[_0xd36a('0x1e')](function(_0x44fbab){logger[_0xd36a('0x10')](_0xd36a('0x18'),_0x1789be);logger[_0xd36a('0x1f')](_0xd36a('0x18'),_0x1789be,JSON[_0xd36a('0x13')](_0x44fbab));_0x1eef25(_0x44fbab);})['catch'](function(_0xe95449){logger[_0xd36a('0x14')](_0xd36a('0x18'),_0xe95449[_0xd36a('0x17')],_0x1789be);_0x3e6f6b(_0x3da9b2[_0xd36a('0x14')](0x1f4,_0xe95449['message']));});});};exports['UpdateFaxMessage']=function(_0x577c1e){var _0x25d0de=this;return new Promise(function(_0x396d86,_0x2d4326){return db[_0xd36a('0x19')][_0xd36a('0x20')](_0x577c1e['body'],{'raw':_0x577c1e[_0xd36a('0x1c')]?_0x577c1e[_0xd36a('0x1c')][_0xd36a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x577c1e['options']?_0x577c1e[_0xd36a('0x1c')][_0xd36a('0x21')]||null:null,'attributes':_0x577c1e[_0xd36a('0x1c')]?_0x577c1e[_0xd36a('0x1c')][_0xd36a('0x22')]||null:null,'limit':_0x577c1e['options']?_0x577c1e['options'][_0xd36a('0x23')]||null:null})['then'](function(_0x586585){logger[_0xd36a('0x10')]('UpdateFaxMessage',_0x577c1e);logger[_0xd36a('0x1f')](_0xd36a('0x24'),_0x577c1e,JSON[_0xd36a('0x13')](_0x586585));_0x396d86(_0x586585);})[_0xd36a('0x25')](function(_0x52285b){logger[_0xd36a('0x14')](_0xd36a('0x24'),_0x52285b['message'],_0x577c1e);_0x2d4326(_0x25d0de[_0xd36a('0x14')](0x1f4,_0x52285b['message']));});});}; \ No newline at end of file +var _0x5932=['debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateFaxMessage','FaxMessage','create','body','options','raw','info','catch','UpdateFaxMessage','where','attributes','lodash','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./faxMessage.socket','register','then','FaxMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x3b085,_0x250543){var _0x476a57=function(_0x480941){while(--_0x480941){_0x3b085['push'](_0x3b085['shift']());}};_0x476a57(++_0x250543);}(_0x5932,0x143));var _0x2593=function(_0x56595d,_0x2764a1){_0x56595d=_0x56595d-0x0;var _0x579fb5=_0x5932[_0x56595d];return _0x579fb5;};'use strict';var _=require(_0x2593('0x0'));var util=require(_0x2593('0x1'));var moment=require('moment');var BPromise=require(_0x2593('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2593('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2593('0x4'));var logger=require('../../config/logger')(_0x2593('0x5'));var config=require(_0x2593('0x6'));var jayson=require(_0x2593('0x7'));var client=jayson['client'][_0x2593('0x8')]({'port':0x232a});config[_0x2593('0x9')]=_[_0x2593('0xa')](config['redis'],{'host':_0x2593('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2593('0x9')]));require(_0x2593('0xc'))[_0x2593('0xd')](socket);function respondWithRpcPromise(_0xb14bd7,_0x32e5e6,_0x2eb1b0){return new BPromise(function(_0x171e1a,_0x541ad8){return client['request'](_0xb14bd7,_0x2eb1b0)[_0x2593('0xe')](function(_0x450c7b){logger['info'](_0x2593('0xf'),_0x32e5e6,_0x2593('0x10'));logger[_0x2593('0x11')](_0x2593('0x12'),_0x32e5e6,_0x2593('0x10'),JSON[_0x2593('0x13')](_0x450c7b));if(_0x450c7b[_0x2593('0x14')]){if(_0x450c7b[_0x2593('0x14')]['code']===0x1f4){logger[_0x2593('0x14')](_0x2593('0xf'),_0x32e5e6,_0x450c7b[_0x2593('0x14')][_0x2593('0x15')]);return _0x541ad8(_0x450c7b[_0x2593('0x14')]['message']);}logger[_0x2593('0x14')](_0x2593('0xf'),_0x32e5e6,_0x450c7b[_0x2593('0x14')][_0x2593('0x15')]);return _0x171e1a(_0x450c7b[_0x2593('0x14')][_0x2593('0x15')]);}else{logger['info'](_0x2593('0xf'),_0x32e5e6,_0x2593('0x10'));_0x171e1a(_0x450c7b[_0x2593('0x16')]['message']);}})['catch'](function(_0x32d940){logger[_0x2593('0x14')](_0x2593('0xf'),_0x32e5e6,_0x32d940);_0x541ad8(_0x32d940);});});}exports[_0x2593('0x17')]=function(_0x31e814){var _0x19b844=this;return new Promise(function(_0x2665f4,_0x4cf00b){return db[_0x2593('0x18')][_0x2593('0x19')](_0x31e814[_0x2593('0x1a')],{'raw':_0x31e814[_0x2593('0x1b')]?_0x31e814['options'][_0x2593('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x792ea1){logger[_0x2593('0x1d')](_0x2593('0x17'),_0x31e814);logger[_0x2593('0x11')](_0x2593('0x17'),_0x31e814,JSON['stringify'](_0x792ea1));_0x2665f4(_0x792ea1);})[_0x2593('0x1e')](function(_0xcad8a5){logger[_0x2593('0x14')](_0x2593('0x17'),_0xcad8a5[_0x2593('0x15')],_0x31e814);_0x4cf00b(_0x19b844[_0x2593('0x14')](0x1f4,_0xcad8a5['message']));});});};exports[_0x2593('0x1f')]=function(_0x38dd17){var _0x42b667=this;return new Promise(function(_0x2fe960,_0x5f4fe3){return db[_0x2593('0x18')]['update'](_0x38dd17[_0x2593('0x1a')],{'raw':_0x38dd17['options']?_0x38dd17[_0x2593('0x1b')][_0x2593('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38dd17[_0x2593('0x1b')]?_0x38dd17[_0x2593('0x1b')][_0x2593('0x20')]||null:null,'attributes':_0x38dd17[_0x2593('0x1b')]?_0x38dd17[_0x2593('0x1b')][_0x2593('0x21')]||null:null,'limit':_0x38dd17[_0x2593('0x1b')]?_0x38dd17['options']['limit']||null:null})[_0x2593('0xe')](function(_0x455238){logger[_0x2593('0x1d')](_0x2593('0x1f'),_0x38dd17);logger['debug'](_0x2593('0x1f'),_0x38dd17,JSON[_0x2593('0x13')](_0x455238));_0x2fe960(_0x455238);})[_0x2593('0x1e')](function(_0x2dadcf){logger[_0x2593('0x14')](_0x2593('0x1f'),_0x2dadcf['message'],_0x38dd17);_0x5f4fe3(_0x42b667[_0x2593('0x14')](0x1f4,_0x2dadcf['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 0a96412..49d419f 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(_0x4d45c1,_0x2beda1){var _0x244478=function(_0x11304c){while(--_0x11304c){_0x4d45c1['push'](_0x4d45c1['shift']());}};_0x244478(++_0x2beda1);}(_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 _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x25df80,_0xa2aec5){var _0x17b6d0=function(_0x446155){while(--_0x446155){_0x25df80['push'](_0x25df80['shift']());}};_0x17b6d0(++_0xa2aec5);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 3e98218..b7782f5 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 _0x0d1c=['show','/:id/download','post','tracked','faxmessage:create','create','/:id','put','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x0d1c,0xe5));var _0xc0d1=function(_0x2546ec,_0x4c0f6f){_0x2546ec=_0x2546ec-0x0;var _0x7c69e3=_0x0d1c[_0x2546ec];return _0x7c69e3;};'use strict';var multer=require(_0xc0d1('0x0'));var util=require(_0xc0d1('0x1'));var path=require(_0xc0d1('0x2'));var timeout=require(_0xc0d1('0x3'));var express=require(_0xc0d1('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc0d1('0x5'));var interaction=require(_0xc0d1('0x6'));var config=require(_0xc0d1('0x7'));var controller=require(_0xc0d1('0x8'));router[_0xc0d1('0x9')]('/',auth[_0xc0d1('0xa')](),controller[_0xc0d1('0xb')]);router[_0xc0d1('0x9')](_0xc0d1('0xc'),auth[_0xc0d1('0xa')](),controller[_0xc0d1('0xd')]);router[_0xc0d1('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc0d1('0xe')]);router['get'](_0xc0d1('0xf'),auth[_0xc0d1('0xa')](),controller['download']);router[_0xc0d1('0x10')]('/',auth['isAuthenticated'](),interaction[_0xc0d1('0x11')]('fax',_0xc0d1('0x12')),controller[_0xc0d1('0x13')]);router['put'](_0xc0d1('0x14'),auth[_0xc0d1('0xa')](),controller['update']);router[_0xc0d1('0x15')]('/:id/accept',auth[_0xc0d1('0xa')](),controller[_0xc0d1('0x16')]);router['put'](_0xc0d1('0x17'),auth['isAuthenticated'](),controller[_0xc0d1('0x18')]);router[_0xc0d1('0x19')]('/:id',auth[_0xc0d1('0xa')](),controller[_0xc0d1('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xc10c=['accept','/:id/reject','reject','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','isAuthenticated','describe','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id/accept'];(function(_0x24875d,_0x4fb24d){var _0x181471=function(_0x4ecd6d){while(--_0x4ecd6d){_0x24875d['push'](_0x24875d['shift']());}};_0x181471(++_0x4fb24d);}(_0xc10c,0x7f));var _0xcc10=function(_0x38e11f,_0x3653ce){_0x38e11f=_0x38e11f-0x0;var _0x272dca=_0xc10c[_0x38e11f];return _0x272dca;};'use strict';var multer=require(_0xcc10('0x0'));var util=require(_0xcc10('0x1'));var path=require('path');var timeout=require(_0xcc10('0x2'));var express=require(_0xcc10('0x3'));var router=express[_0xcc10('0x4')]();var fs_extra=require(_0xcc10('0x5'));var auth=require(_0xcc10('0x6'));var interaction=require(_0xcc10('0x7'));var config=require(_0xcc10('0x8'));var controller=require(_0xcc10('0x9'));router[_0xcc10('0xa')]('/',auth['isAuthenticated'](),controller[_0xcc10('0xb')]);router['get']('/describe',auth[_0xcc10('0xc')](),controller[_0xcc10('0xd')]);router[_0xcc10('0xa')]('/:id',auth[_0xcc10('0xc')](),controller['show']);router[_0xcc10('0xa')](_0xcc10('0xe'),auth[_0xcc10('0xc')](),controller[_0xcc10('0xf')]);router[_0xcc10('0x10')]('/',auth[_0xcc10('0xc')](),interaction[_0xcc10('0x11')](_0xcc10('0x12'),_0xcc10('0x13')),controller[_0xcc10('0x14')]);router[_0xcc10('0x15')]('/:id',auth[_0xcc10('0xc')](),controller['update']);router[_0xcc10('0x15')](_0xcc10('0x16'),auth[_0xcc10('0xc')](),controller[_0xcc10('0x17')]);router[_0xcc10('0x15')](_0xcc10('0x18'),auth['isAuthenticated'](),controller[_0xcc10('0x19')]);router[_0xcc10('0x1a')](_0xcc10('0x1b'),auth[_0xcc10('0xc')](),controller[_0xcc10('0x1c')]);module[_0xcc10('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index f142a6c..660ce5a 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 _0x8e3e=['roundrobin','exports','name','INTEGER','ENUM','beepall'];(function(_0x36af3f,_0x1dc982){var _0x31f847=function(_0x3a0571){while(--_0x3a0571){_0x36af3f['push'](_0x36af3f['shift']());}};_0x31f847(++_0x1dc982);}(_0x8e3e,0x91));var _0xe8e3=function(_0x126bae,_0x3a9f0e){_0x126bae=_0x126bae-0x0;var _0x39adea=_0x8e3e[_0x126bae];return _0x39adea;};'use strict';var Sequelize=require('sequelize');module[_0xe8e3('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xe8e3('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xe8e3('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe8e3('0x3')]('rrmemory',_0xe8e3('0x4'),_0xe8e3('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xfeff=['STRING','rrmemory','beepall','roundrobin','INTEGER','sequelize','exports'];(function(_0x44554d,_0x18f36d){var _0x26eb99=function(_0x19e23d){while(--_0x19e23d){_0x44554d['push'](_0x44554d['shift']());}};_0x26eb99(++_0x18f36d);}(_0xfeff,0xe5));var _0xffef=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xfeff[_0x35da42];return _0x370035;};'use strict';var Sequelize=require(_0xffef('0x0'));module[_0xffef('0x1')]={'name':{'type':Sequelize[_0xffef('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xffef('0x3'),_0xffef('0x4'),_0xffef('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xffef('0x6')],'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 51b6071..137bb85 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 _0xd6bb=['getTeams','Team','hasOwnProperty','addTeams','online','interface','Agents','sequelize','transaction','each','findOrCreate','emit','userFaxQueue:save','removeTeams','ids','field','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','push','SELECT','every','TeamId','includes','union','value','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','offset','limit','set','json','apply','reject','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','show','keys','fields','include','options','find','create','body','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','params','describe','getMembers','findOne','UserFaxQueue','order','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','rows','format','SIP'];(function(_0x1e3a8c,_0x516e80){var _0x1c5cf4=function(_0x2ab025){while(--_0x2ab025){_0x1e3a8c['push'](_0x1e3a8c['shift']());}};_0x1c5cf4(++_0x516e80);}(_0xd6bb,0x1cc));var _0xbd6b=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xd6bb[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0xbd6b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd6b('0x1'));var jsonpatch=require(_0xbd6b('0x2'));var rp=require(_0xbd6b('0x3'));var moment=require(_0xbd6b('0x4'));var BPromise=require(_0xbd6b('0x5'));var Mustache=require('mustache');var util=require(_0xbd6b('0x6'));var path=require(_0xbd6b('0x7'));var sox=require(_0xbd6b('0x8'));var csv=require('to-csv');var ejs=require(_0xbd6b('0x9'));var fs=require('fs');var fs_extra=require(_0xbd6b('0xa'));var _=require(_0xbd6b('0xb'));var squel=require(_0xbd6b('0xc'));var crypto=require(_0xbd6b('0xd'));var jsforce=require(_0xbd6b('0xe'));var deskjs=require(_0xbd6b('0xf'));var toCsv=require(_0xbd6b('0x10'));var querystring=require(_0xbd6b('0x11'));var Papa=require(_0xbd6b('0x12'));var Redis=require(_0xbd6b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xbd6b('0x14'));var as=require(_0xbd6b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd6b('0x16'))(_0xbd6b('0x17'));var utils=require('../../config/utils');var config=require(_0xbd6b('0x18'));var licenseUtil=require(_0xbd6b('0x19'));var db=require(_0xbd6b('0x1a'))['db'];config[_0xbd6b('0x1b')]=_[_0xbd6b('0x1c')](config['redis'],{'host':_0xbd6b('0x1d'),'port':0x18eb});var socket=require(_0xbd6b('0x1e'))(new Redis(config[_0xbd6b('0x1b')]));require(_0xbd6b('0x1f'))['register'](socket);function respondWithStatusCode(_0x557820,_0x333210){_0x333210=_0x333210||0xcc;return function(_0x36dcee){if(_0x36dcee){return _0x557820[_0xbd6b('0x20')](_0x333210);}return _0x557820[_0xbd6b('0x21')](_0x333210)[_0xbd6b('0x22')]();};}function respondWithResult(_0x2208de,_0x5469cd){_0x5469cd=_0x5469cd||0xc8;return function(_0x179d75){if(_0x179d75){return _0x2208de['status'](_0x5469cd)['json'](_0x179d75);}};}function respondWithFilteredResult(_0x5437c1,_0x25f311){return function(_0x1c0cad){if(_0x1c0cad){var _0x4293bc=_0x1c0cad['count'],_0x50d857=_0x25f311[_0xbd6b('0x23')],_0x2d6e07=_0x25f311[_0xbd6b('0x23')]+_0x25f311[_0xbd6b('0x24')],_0x27ff92;if(_0x2d6e07>=_0x4293bc){_0x2d6e07=_0x4293bc;_0x27ff92=0xc8;}else{_0x27ff92=0xce;}_0x5437c1[_0xbd6b('0x21')](_0x27ff92);return _0x5437c1[_0xbd6b('0x25')]('Content-Range',_0x50d857+'-'+_0x2d6e07+'/'+_0x4293bc)[_0xbd6b('0x26')](_0x1c0cad);}return null;};}function patchUpdates(_0x34702d){return function(_0x2389c1){try{jsonpatch[_0xbd6b('0x27')](_0x2389c1,_0x34702d,!![]);}catch(_0x1a787d){return BPromise[_0xbd6b('0x28')](_0x1a787d);}return _0x2389c1['save']();};}function saveUpdates(_0x24ce5b,_0x4f08b3){return function(_0x10f04a){if(_0x10f04a){return _0x10f04a[_0xbd6b('0x29')](_0x24ce5b)[_0xbd6b('0x2a')](function(_0x5d6329){return _0x5d6329;});}return null;};}function removeEntity(_0x314526,_0x4d7e35){return function(_0x7f897a){if(_0x7f897a){return _0x7f897a[_0xbd6b('0x2b')]()[_0xbd6b('0x2a')](function(){var _0x323964=_0x7f897a[_0xbd6b('0x2c')]({'plain':!![]});var _0x450a6e=_0xbd6b('0x2d');return db[_0xbd6b('0x2e')][_0xbd6b('0x2b')]({'where':{'type':_0x450a6e,'resourceId':_0x323964['id']}})[_0xbd6b('0x2a')](function(){return _0x7f897a;});})[_0xbd6b('0x2a')](function(){_0x314526[_0xbd6b('0x21')](0xcc)[_0xbd6b('0x22')]();});}};}function handleEntityNotFound(_0x2bcbee,_0x5dd0ef){return function(_0x1ab650){if(!_0x1ab650){_0x2bcbee[_0xbd6b('0x20')](0x194);}return _0x1ab650;};}function handleError(_0x391b59,_0x4f8879){_0x4f8879=_0x4f8879||0x1f4;return function(_0x3b3e77){logger[_0xbd6b('0x2f')](_0x3b3e77[_0xbd6b('0x30')]);if(_0x3b3e77['name']){delete _0x3b3e77[_0xbd6b('0x31')];}_0x391b59[_0xbd6b('0x21')](_0x4f8879)[_0xbd6b('0x32')](_0x3b3e77);};}exports[_0xbd6b('0x33')]=function(_0x229278,_0x2a3b2f){var _0xe346a={},_0x1f342={},_0x26ce96={'count':0x0,'rows':[]};var _0x7f0409=_[_0xbd6b('0x34')](db[_0xbd6b('0x35')][_0xbd6b('0x36')],function(_0x491ed3){return{'name':_0x491ed3[_0xbd6b('0x37')],'type':_0x491ed3[_0xbd6b('0x38')][_0xbd6b('0x39')]};});_0x1f342[_0xbd6b('0x3a')]=_[_0xbd6b('0x34')](_0x7f0409,_0xbd6b('0x31'));_0x1f342[_0xbd6b('0x3b')]=_['keys'](_0x229278[_0xbd6b('0x3b')]);_0x1f342[_0xbd6b('0x3c')]=_[_0xbd6b('0x3d')](_0x1f342[_0xbd6b('0x3a')],_0x1f342[_0xbd6b('0x3b')]);_0xe346a[_0xbd6b('0x3e')]=_[_0xbd6b('0x3d')](_0x1f342[_0xbd6b('0x3a')],qs['fields'](_0x229278[_0xbd6b('0x3b')]['fields']));_0xe346a[_0xbd6b('0x3e')]=_0xe346a[_0xbd6b('0x3e')][_0xbd6b('0x3f')]?_0xe346a[_0xbd6b('0x3e')]:_0x1f342[_0xbd6b('0x3a')];if(!_0x229278['query']['hasOwnProperty'](_0xbd6b('0x40'))){_0xe346a['limit']=qs[_0xbd6b('0x24')](_0x229278[_0xbd6b('0x3b')][_0xbd6b('0x24')]);_0xe346a[_0xbd6b('0x23')]=qs[_0xbd6b('0x23')](_0x229278['query'][_0xbd6b('0x23')]);}_0xe346a['order']=qs['sort'](_0x229278[_0xbd6b('0x3b')][_0xbd6b('0x41')]);_0xe346a[_0xbd6b('0x42')]=qs[_0xbd6b('0x3c')](_[_0xbd6b('0x43')](_0x229278['query'],_0x1f342[_0xbd6b('0x3c')]),_0x7f0409);if(_0x229278[_0xbd6b('0x3b')][_0xbd6b('0x44')]){_0xe346a['where']=_[_0xbd6b('0x45')](_0xe346a[_0xbd6b('0x42')],{'$or':_[_0xbd6b('0x34')](_0x7f0409,function(_0x56ae9d){if(_0x56ae9d[_0xbd6b('0x38')]!==_0xbd6b('0x46')){var _0x49bac8={};_0x49bac8[_0x56ae9d[_0xbd6b('0x31')]]={'$like':'%'+_0x229278['query'][_0xbd6b('0x44')]+'%'};return _0x49bac8;}})});}_0xe346a=_[_0xbd6b('0x45')]({},_0xe346a,_0x229278['options']);var _0x5ea5cf={'where':_0xe346a[_0xbd6b('0x42')]};return db[_0xbd6b('0x35')][_0xbd6b('0x47')](_0x5ea5cf)['then'](function(_0x5d5ac0){_0x26ce96[_0xbd6b('0x47')]=_0x5d5ac0;if(_0x229278[_0xbd6b('0x3b')][_0xbd6b('0x48')]){_0xe346a['include']=[{'all':!![]}];}return db[_0xbd6b('0x35')][_0xbd6b('0x49')](_0xe346a);})[_0xbd6b('0x2a')](function(_0xa44aff){_0x26ce96['rows']=_0xa44aff;return _0x26ce96;})[_0xbd6b('0x2a')](respondWithFilteredResult(_0x2a3b2f,_0xe346a))['catch'](handleError(_0x2a3b2f,null));};exports[_0xbd6b('0x4a')]=function(_0x58a695,_0x36b440){var _0x465edc={'raw':!![],'where':{'id':_0x58a695['params']['id']}},_0x1b699f={};_0x1b699f['model']=_[_0xbd6b('0x4b')](db[_0xbd6b('0x35')][_0xbd6b('0x36')]);_0x1b699f['query']=_[_0xbd6b('0x4b')](_0x58a695[_0xbd6b('0x3b')]);_0x1b699f[_0xbd6b('0x3c')]=_[_0xbd6b('0x3d')](_0x1b699f[_0xbd6b('0x3a')],_0x1b699f[_0xbd6b('0x3b')]);_0x465edc[_0xbd6b('0x3e')]=_[_0xbd6b('0x3d')](_0x1b699f[_0xbd6b('0x3a')],qs['fields'](_0x58a695['query'][_0xbd6b('0x4c')]));_0x465edc['attributes']=_0x465edc[_0xbd6b('0x3e')][_0xbd6b('0x3f')]?_0x465edc[_0xbd6b('0x3e')]:_0x1b699f[_0xbd6b('0x3a')];if(_0x58a695[_0xbd6b('0x3b')][_0xbd6b('0x48')]){_0x465edc[_0xbd6b('0x4d')]=[{'all':!![]}];}_0x465edc=_['merge']({},_0x465edc,_0x58a695[_0xbd6b('0x4e')]);return db[_0xbd6b('0x35')][_0xbd6b('0x4f')](_0x465edc)[_0xbd6b('0x2a')](handleEntityNotFound(_0x36b440,null))['then'](respondWithResult(_0x36b440,null))['catch'](handleError(_0x36b440,null));};exports[_0xbd6b('0x50')]=function(_0x217b6f,_0x1dc314){return db[_0xbd6b('0x35')]['create'](_0x217b6f[_0xbd6b('0x51')],{})['then'](function(_0x4ca04d){var _0x424459=_0x217b6f[_0xbd6b('0x52')][_0xbd6b('0x2c')]({'plain':!![]});if(!_0x424459)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x424459['role']===_0xbd6b('0x52')){var _0x57724c=_0x4ca04d[_0xbd6b('0x2c')]({'plain':!![]});var _0x15a4d6=_0xbd6b('0x2d');return db[_0xbd6b('0x53')][_0xbd6b('0x4f')]({'where':{'name':_0x15a4d6,'userProfileId':_0x424459[_0xbd6b('0x54')]},'raw':!![]})[_0xbd6b('0x2a')](function(_0x3e6157){if(_0x3e6157&&_0x3e6157['autoAssociation']===0x0){return db[_0xbd6b('0x2e')][_0xbd6b('0x50')]({'name':_0x57724c['name'],'resourceId':_0x57724c['id'],'type':_0x3e6157[_0xbd6b('0x31')],'sectionId':_0x3e6157['id']},{})[_0xbd6b('0x2a')](function(){return _0x4ca04d;});}else{return _0x4ca04d;}})['catch'](function(_0x76cbb){logger[_0xbd6b('0x2f')](_0xbd6b('0x55'),_0x76cbb);throw _0x76cbb;});}return _0x4ca04d;})['then'](respondWithResult(_0x1dc314,0xc9))[_0xbd6b('0x56')](handleError(_0x1dc314,null));};exports[_0xbd6b('0x29')]=function(_0xc7cc1,_0x6c0d02){if(_0xc7cc1['body']['id']){delete _0xc7cc1['body']['id'];}return db[_0xbd6b('0x35')][_0xbd6b('0x4f')]({'where':{'id':_0xc7cc1[_0xbd6b('0x57')]['id']}})[_0xbd6b('0x2a')](handleEntityNotFound(_0x6c0d02,null))[_0xbd6b('0x2a')](saveUpdates(_0xc7cc1[_0xbd6b('0x51')],null))['then'](respondWithResult(_0x6c0d02,null))[_0xbd6b('0x56')](handleError(_0x6c0d02,null));};exports[_0xbd6b('0x2b')]=function(_0x500695,_0x2a15dc){return db[_0xbd6b('0x35')][_0xbd6b('0x4f')]({'where':{'id':_0x500695[_0xbd6b('0x57')]['id']}})[_0xbd6b('0x2a')](handleEntityNotFound(_0x2a15dc,null))[_0xbd6b('0x2a')](removeEntity(_0x2a15dc,null))[_0xbd6b('0x56')](handleError(_0x2a15dc,null));};exports['describe']=function(_0x5851df,_0x362d17){return db['FaxQueue'][_0xbd6b('0x58')]()[_0xbd6b('0x2a')](respondWithResult(_0x362d17,null))[_0xbd6b('0x56')](handleError(_0x362d17,null));};exports[_0xbd6b('0x59')]=function(_0x27cd42,_0x2f6d73,_0x40ac0c){var _0x34ab42={'raw':!![],'where':{}},_0x2535e5={},_0x19b990;return db[_0xbd6b('0x35')][_0xbd6b('0x5a')]({'where':{'id':_0x27cd42[_0xbd6b('0x57')]['id']}})[_0xbd6b('0x2a')](handleEntityNotFound(_0x2f6d73,null))[_0xbd6b('0x2a')](function(_0xe78fa){if(_0xe78fa){_0x19b990=_0xe78fa[_0xbd6b('0x2c')]({'plain':!![]});_0x2535e5[_0xbd6b('0x3a')]=_[_0xbd6b('0x4b')](db[_0xbd6b('0x5b')][_0xbd6b('0x36')]);_0x2535e5['query']=_[_0xbd6b('0x4b')](_0x27cd42[_0xbd6b('0x3b')]);_0x2535e5[_0xbd6b('0x3c')]=_['intersection'](_0x2535e5[_0xbd6b('0x3a')],_0x2535e5[_0xbd6b('0x3b')]);_0x34ab42[_0xbd6b('0x3e')]=_['intersection'](_0x2535e5[_0xbd6b('0x3a')],qs['fields'](_0x27cd42['query']['fields']));_0x34ab42['attributes']=_0x34ab42[_0xbd6b('0x3e')][_0xbd6b('0x3f')]?_0x34ab42[_0xbd6b('0x3e')]:_0x2535e5[_0xbd6b('0x3a')];if(!_0x27cd42[_0xbd6b('0x3b')]['hasOwnProperty'](_0xbd6b('0x40'))){_0x34ab42['limit']=qs[_0xbd6b('0x24')](_0x27cd42['query']['limit']);_0x34ab42[_0xbd6b('0x23')]=qs['offset'](_0x27cd42[_0xbd6b('0x3b')][_0xbd6b('0x23')]);}_0x34ab42[_0xbd6b('0x5c')]=qs[_0xbd6b('0x41')](_0x27cd42['query']['sort']);_0x34ab42[_0xbd6b('0x42')]=qs['filters'](_[_0xbd6b('0x43')](_0x27cd42[_0xbd6b('0x3b')],_0x2535e5[_0xbd6b('0x3c')]));_0x34ab42[_0xbd6b('0x42')][_0xbd6b('0x5d')]=_0xe78fa['id'];if(_0x27cd42['query']['filter']){_0x34ab42['where']=_[_0xbd6b('0x45')](_0x34ab42[_0xbd6b('0x42')],{'$or':_['map'](_0x34ab42[_0xbd6b('0x3e')],function(_0x1be3a8){var _0x96fde7={};_0x96fde7[_0x1be3a8]={'$like':'%'+_0x27cd42['query'][_0xbd6b('0x44')]+'%'};return _0x96fde7;})});}_0x34ab42=_[_0xbd6b('0x45')]({},_0x34ab42,_0x27cd42[_0xbd6b('0x4e')]);return db[_0xbd6b('0x5b')]['findAll'](_0x34ab42);}})[_0xbd6b('0x2a')](function(_0x19f2ed){if(_0x19f2ed){return db[_0xbd6b('0x5e')][_0xbd6b('0x5f')]({'where':{'id':_['map'](_0x19f2ed,_0xbd6b('0x60')),'role':_0xbd6b('0x61')},'attributes':['id',_0xbd6b('0x31'),_0xbd6b('0x62'),_0xbd6b('0x63'),_0xbd6b('0x64')]});}})[_0xbd6b('0x2a')](function(_0x3d3e3d){if(_0x3d3e3d){return{'count':_0x3d3e3d['count'],'rows':_[_0xbd6b('0x34')](_0x3d3e3d[_0xbd6b('0x65')],function(_0x27b8af){return{'membername':_0x27b8af[_0xbd6b('0x31')],'UserId':_0x27b8af['id'],'queue_name':_0x19b990[_0xbd6b('0x31')],'FaxQueueId':_0x19b990['id'],'interface':util[_0xbd6b('0x66')]('%s/%s',_0xbd6b('0x67'),_0x27b8af['name']),'penalty':0x0,'paused':_0x27b8af[_0xbd6b('0x62')],'createdAt':_0x27b8af['createdAt'],'updatedAt':_0x27b8af[_0xbd6b('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbd6b('0x2a')](respondWithFilteredResult(_0x2f6d73,_0x34ab42))['catch'](handleError(_0x2f6d73,null));};exports[_0xbd6b('0x68')]=function(_0x13cd27,_0x30bd27,_0x2c3f64){var _0x469f51={};var _0x16352c={};var _0x495293;var _0x1754ab;return db[_0xbd6b('0x35')][_0xbd6b('0x5a')]({'where':{'id':_0x13cd27[_0xbd6b('0x57')]['id']}})['then'](handleEntityNotFound(_0x30bd27,null))[_0xbd6b('0x2a')](function(_0x16bc4e){if(_0x16bc4e){_0x495293=_0x16bc4e;_0x16352c[_0xbd6b('0x3a')]=_[_0xbd6b('0x4b')](db[_0xbd6b('0x69')][_0xbd6b('0x36')]);_0x16352c[_0xbd6b('0x3b')]=_['keys'](_0x13cd27['query']);_0x16352c['filters']=_[_0xbd6b('0x3d')](_0x16352c[_0xbd6b('0x3a')],_0x16352c[_0xbd6b('0x3b')]);_0x469f51[_0xbd6b('0x3e')]=_[_0xbd6b('0x3d')](_0x16352c[_0xbd6b('0x3a')],qs[_0xbd6b('0x4c')](_0x13cd27[_0xbd6b('0x3b')][_0xbd6b('0x4c')]));_0x469f51['attributes']=_0x469f51[_0xbd6b('0x3e')][_0xbd6b('0x3f')]?_0x469f51[_0xbd6b('0x3e')]:_0x16352c[_0xbd6b('0x3a')];_0x469f51[_0xbd6b('0x5c')]=qs[_0xbd6b('0x41')](_0x13cd27[_0xbd6b('0x3b')][_0xbd6b('0x41')]);_0x469f51['where']=qs[_0xbd6b('0x3c')](_['pick'](_0x13cd27['query'],_0x16352c['filters']));if(_0x13cd27['query'][_0xbd6b('0x44')]){_0x469f51[_0xbd6b('0x42')]=_[_0xbd6b('0x45')](_0x469f51[_0xbd6b('0x42')],{'$or':_['map'](_0x469f51[_0xbd6b('0x3e')],function(_0x1da1fd){var _0xfa929f={};_0xfa929f[_0x1da1fd]={'$like':'%'+_0x13cd27[_0xbd6b('0x3b')][_0xbd6b('0x44')]+'%'};return _0xfa929f;})});}_0x469f51=_[_0xbd6b('0x45')]({},_0x469f51,_0x13cd27['options']);return _0x495293[_0xbd6b('0x68')](_0x469f51);}})[_0xbd6b('0x2a')](function(_0x3425d8){if(_0x3425d8){_0x1754ab=_0x3425d8['length'];if(!_0x13cd27[_0xbd6b('0x3b')][_0xbd6b('0x6a')](_0xbd6b('0x40'))){_0x469f51[_0xbd6b('0x24')]=qs[_0xbd6b('0x24')](_0x13cd27[_0xbd6b('0x3b')][_0xbd6b('0x24')]);_0x469f51[_0xbd6b('0x23')]=qs['offset'](_0x13cd27['query'][_0xbd6b('0x23')]);}return _0x495293['getTeams'](_0x469f51);}})['then'](function(_0x398bb6){if(_0x398bb6){return _0x398bb6?{'count':_0x1754ab,'rows':_0x398bb6}:null;}})[_0xbd6b('0x2a')](respondWithResult(_0x30bd27,null))['catch'](handleError(_0x30bd27,null));};exports[_0xbd6b('0x6b')]=function(_0x20210b,_0x302249,_0x4585da){var _0x3ed479=_0x20210b[_0xbd6b('0x51')]['ids'];return db[_0xbd6b('0x69')][_0xbd6b('0x49')]({'where':{'id':_0x3ed479},'attributes':['id'],'include':[{'model':db[_0xbd6b('0x5e')],'as':'Agents','attributes':['id',_0xbd6b('0x31'),_0xbd6b('0x6c'),'voicePause',_0xbd6b('0x6d')],'raw':!![]}]})[_0xbd6b('0x2a')](function(_0x3112ac){if(_0x3112ac){var _0x13b98b=_['flatMap'](_0x3112ac,function(_0x44e84a){var _0x5df638=_0x44e84a['get']({'plain':!![]});return _0x5df638[_0xbd6b('0x6e')];});return db[_0xbd6b('0x35')][_0xbd6b('0x4f')]({'where':{'id':_0x20210b[_0xbd6b('0x57')]['id']}})[_0xbd6b('0x2a')](function(_0x398266){return db[_0xbd6b('0x6f')][_0xbd6b('0x70')](function(_0x28fdd0){return _0x398266[_0xbd6b('0x6b')](_0x3ed479,{'transaction':_0x28fdd0})[_0xbd6b('0x2a')](function(){return BPromise[_0xbd6b('0x71')](_0x13b98b,function(_0x89ec5b){return db[_0xbd6b('0x5b')][_0xbd6b('0x72')]({'where':{'UserId':_0x89ec5b['id'],'FaxQueueId':_0x20210b[_0xbd6b('0x57')]['id']},'transaction':_0x28fdd0});});})[_0xbd6b('0x2a')](function(){_0x13b98b['forEach'](function(_0x2cc2f9){socket[_0xbd6b('0x73')](_0xbd6b('0x74'),{'UserId':_0x2cc2f9['id'],'FaxQueueId':_0x398266['id']});});});});});}})[_0xbd6b('0x2a')](respondWithStatusCode(_0x302249,null))[_0xbd6b('0x56')](handleError(_0x302249,null));};exports[_0xbd6b('0x75')]=function(_0x5ef27b,_0x1f54f9,_0x420fef){return db['Team'][_0xbd6b('0x49')]({'where':{'id':_0x5ef27b[_0xbd6b('0x3b')][_0xbd6b('0x76')]},'attributes':['id'],'include':[{'model':db[_0xbd6b('0x5e')],'as':_0xbd6b('0x6e'),'attributes':['id'],'raw':!![]}]})[_0xbd6b('0x2a')](handleEntityNotFound(_0x1f54f9,null))[_0xbd6b('0x2a')](function(_0x356fa3){var _0x1d4709=_[_0xbd6b('0x34')](_0x356fa3,'id');var _0xb565=[];var _0x2cfd04=[];var _0x248ccc=squel['select']();_0x248ccc[_0xbd6b('0x77')]('tq.TeamId')['from'](_0xbd6b('0x78'),'tq')[_0xbd6b('0x79')](_0xbd6b('0x7a'),'ut',_0xbd6b('0x7b'))['where'](_0xbd6b('0x7c'),_0x5ef27b[_0xbd6b('0x57')]['id']);for(var _0x5b768c=0x0;_0x5b768c<_0x356fa3[_0xbd6b('0x3f')];_0x5b768c+=0x1){let _0x14726c=_0x356fa3[_0x5b768c];for(var _0x105d94=0x0;_0x105d94<_0x14726c[_0xbd6b('0x6e')][_0xbd6b('0x3f')];_0x105d94+=0x1){let _0x53de86=_0x14726c[_0xbd6b('0x6e')][_0x105d94];var _0x3af13a=_0x248ccc['clone']();_0x3af13a[_0xbd6b('0x42')]('ut.UserId\x20=\x20?',_0x53de86['id']);_0x2cfd04[_0xbd6b('0x7d')](db['sequelize'][_0xbd6b('0x3b')](_0x3af13a['toString'](),{'type':db[_0xbd6b('0x6f')]['QueryTypes'][_0xbd6b('0x7e')]})[_0xbd6b('0x2a')](function(_0x356c5f){if(_0x356c5f[_0xbd6b('0x3f')]===0x1){return _0x53de86['id'];}else{var _0x423071=_[_0xbd6b('0x7f')](_[_0xbd6b('0x34')](_0x356c5f,_0xbd6b('0x80')),function(_0x5d4436){return _[_0xbd6b('0x81')](_0x1d4709,_0x5d4436);});if(_0x423071){return _0x53de86['id'];}}}));}}return BPromise['all'](_0x2cfd04)[_0xbd6b('0x2a')](function(_0x2cb289){_0xb565=_(_0xb565)[_0xbd6b('0x82')](_0x2cb289)['compact']()[_0xbd6b('0x83')]();return db[_0xbd6b('0x35')][_0xbd6b('0x4f')]({'where':{'id':_0x5ef27b[_0xbd6b('0x57')]['id']}})[_0xbd6b('0x2a')](function(_0x2e44dd){return db[_0xbd6b('0x6f')]['transaction'](function(_0x2fb5b5){return _0x2e44dd[_0xbd6b('0x75')](_0x5ef27b['query']['ids'],{'transaction':_0x2fb5b5})['then'](function(){if(!_[_0xbd6b('0x84')](_0xb565)){return _0x2e44dd[_0xbd6b('0x85')](_0xb565,{'transaction':_0x2fb5b5});}})[_0xbd6b('0x2a')](function(){_0xb565[_0xbd6b('0x86')](function(_0x14d2d8){socket['emit'](_0xbd6b('0x87'),{'UserId':_0x14d2d8,'FaxQueueId':_0x2e44dd['id']});});});});});});})[_0xbd6b('0x2a')](respondWithStatusCode(_0x1f54f9,null))[_0xbd6b('0x56')](handleError(_0x1f54f9,null));};exports[_0xbd6b('0x88')]=function(_0x210571,_0x4eb170,_0x791fef){return db['FaxQueue']['find']({'where':{'id':_0x210571[_0xbd6b('0x57')]['id']}})[_0xbd6b('0x2a')](handleEntityNotFound(_0x4eb170,null))[_0xbd6b('0x2a')](function(_0x4fd84b){if(_0x4fd84b){return _0x4fd84b['addAgents'](_0x210571[_0xbd6b('0x51')][_0xbd6b('0x76')],_[_0xbd6b('0x89')](_0x210571[_0xbd6b('0x51')],[_0xbd6b('0x76'),'id'])||{})[_0xbd6b('0x8a')](function(_0x30d264){for(var _0x57b74d=0x0;_0x57b74d<_0x210571['body'][_0xbd6b('0x76')]['length'];_0x57b74d+=0x1){socket[_0xbd6b('0x73')]('userFaxQueue:save',{'UserId':_0x210571[_0xbd6b('0x51')]['ids'][_0x57b74d],'FaxQueueId':_0x210571[_0xbd6b('0x57')]['id']});}return _0x30d264;});}})[_0xbd6b('0x2a')](respondWithResult(_0x4eb170,null))[_0xbd6b('0x56')](handleError(_0x4eb170,null));};exports[_0xbd6b('0x85')]=function(_0xde9030,_0x26d68c,_0x343280){return db[_0xbd6b('0x35')]['find']({'where':{'id':_0xde9030[_0xbd6b('0x57')]['id']}})[_0xbd6b('0x2a')](handleEntityNotFound(_0x26d68c,null))[_0xbd6b('0x2a')](function(_0x1c1aff){if(_0x1c1aff){return _0x1c1aff[_0xbd6b('0x85')](_0xde9030['query'][_0xbd6b('0x76')])[_0xbd6b('0x2a')](function(){if(_[_0xbd6b('0x8b')](_0xde9030[_0xbd6b('0x3b')][_0xbd6b('0x76')])){for(var _0x22e52d=0x0;_0x22e52d<_0xde9030[_0xbd6b('0x3b')][_0xbd6b('0x76')][_0xbd6b('0x3f')];_0x22e52d+=0x1){socket[_0xbd6b('0x73')](_0xbd6b('0x87'),{'UserId':Number(_0xde9030[_0xbd6b('0x3b')][_0xbd6b('0x76')][_0x22e52d]),'FaxQueueId':Number(_0xde9030[_0xbd6b('0x57')]['id'])});}}else{socket[_0xbd6b('0x73')](_0xbd6b('0x87'),{'UserId':Number(_0xde9030[_0xbd6b('0x3b')][_0xbd6b('0x76')]),'FaxQueueId':Number(_0xde9030[_0xbd6b('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x26d68c,null))[_0xbd6b('0x56')](handleError(_0x26d68c,null));};exports[_0xbd6b('0x8c')]=function(_0x5a2946,_0x30e0c3,_0x6d13de){var _0x475033={};var _0x1c5f37={};var _0x4b77db;var _0x29ddc4;return db[_0xbd6b('0x35')][_0xbd6b('0x5a')]({'where':{'id':_0x5a2946[_0xbd6b('0x57')]['id']}})['then'](handleEntityNotFound(_0x30e0c3,null))[_0xbd6b('0x2a')](function(_0x4a5fd7){if(_0x4a5fd7){_0x4b77db=_0x4a5fd7;_0x1c5f37[_0xbd6b('0x3a')]=_[_0xbd6b('0x4b')](db[_0xbd6b('0x5e')][_0xbd6b('0x36')]);_0x1c5f37['query']=_[_0xbd6b('0x4b')](_0x5a2946['query']);_0x1c5f37[_0xbd6b('0x3c')]=_[_0xbd6b('0x3d')](_0x1c5f37[_0xbd6b('0x3a')],_0x1c5f37[_0xbd6b('0x3b')]);_0x475033['attributes']=_[_0xbd6b('0x3d')](_0x1c5f37[_0xbd6b('0x3a')],qs['fields'](_0x5a2946['query'][_0xbd6b('0x4c')]));_0x475033[_0xbd6b('0x3e')]=_0x475033['attributes'][_0xbd6b('0x3f')]?_0x475033[_0xbd6b('0x3e')]:_0x1c5f37[_0xbd6b('0x3a')];_0x475033[_0xbd6b('0x5c')]=qs['sort'](_0x5a2946[_0xbd6b('0x3b')][_0xbd6b('0x41')]);_0x475033[_0xbd6b('0x42')]=qs[_0xbd6b('0x3c')](_[_0xbd6b('0x43')](_0x5a2946['query'],_0x1c5f37[_0xbd6b('0x3c')]));if(_0x5a2946[_0xbd6b('0x3b')][_0xbd6b('0x44')]){_0x475033[_0xbd6b('0x42')]=_[_0xbd6b('0x45')](_0x475033[_0xbd6b('0x42')],{'$or':_[_0xbd6b('0x34')](_0x475033[_0xbd6b('0x3e')],function(_0x3dd425){var _0x1b29af={};_0x1b29af[_0x3dd425]={'$like':'%'+_0x5a2946[_0xbd6b('0x3b')]['filter']+'%'};return _0x1b29af;})});}_0x475033=_[_0xbd6b('0x45')]({},_0x475033,_0x5a2946[_0xbd6b('0x4e')]);return _0x4b77db[_0xbd6b('0x8c')](_0x475033);}})[_0xbd6b('0x2a')](function(_0x71f6b){if(_0x71f6b){_0x29ddc4=_0x71f6b[_0xbd6b('0x3f')];if(!_0x5a2946[_0xbd6b('0x3b')][_0xbd6b('0x6a')](_0xbd6b('0x40'))){_0x475033[_0xbd6b('0x24')]=qs[_0xbd6b('0x24')](_0x5a2946[_0xbd6b('0x3b')][_0xbd6b('0x24')]);_0x475033[_0xbd6b('0x23')]=qs[_0xbd6b('0x23')](_0x5a2946[_0xbd6b('0x3b')][_0xbd6b('0x23')]);}return _0x4b77db['getAgents'](_0x475033);}})[_0xbd6b('0x2a')](function(_0x8aa119){if(_0x8aa119){return _0x8aa119?{'count':_0x29ddc4,'rows':_0x8aa119}:null;}})[_0xbd6b('0x2a')](respondWithResult(_0x30e0c3,null))[_0xbd6b('0x56')](handleError(_0x30e0c3,null));}; \ No newline at end of file +var _0x1c23=['agent','faxPause','updatedAt','createdAt','rows','format','%s/%s','Team','getTeams','nolimit','addTeams','ids','Agents','voicePause','flatMap','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','team_has_fax_queues','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','all','union','compact','isEmpty','userFaxQueue:remove','addAgents','omit','spread','removeAgents','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','count','offset','limit','set','json','reject','update','FaxQueues','UserProfileResource','destroy','then','error','stack','name','send','index','FaxQueue','rawAttributes','fieldName','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','filters','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserFaxQueue','FaxQueueId','findAndCountAll','UserId'];(function(_0x2df724,_0x2cd1fe){var _0x5b1001=function(_0x4a13b1){while(--_0x4a13b1){_0x2df724['push'](_0x2df724['shift']());}};_0x5b1001(++_0x2cd1fe);}(_0x1c23,0x1d5));var _0x31c2=function(_0x92dfd9,_0x30b045){_0x92dfd9=_0x92dfd9-0x0;var _0x1dfb05=_0x1c23[_0x92dfd9];return _0x1dfb05;};'use strict';var emlformat=require(_0x31c2('0x0'));var rimraf=require(_0x31c2('0x1'));var zipdir=require(_0x31c2('0x2'));var jsonpatch=require(_0x31c2('0x3'));var rp=require(_0x31c2('0x4'));var moment=require(_0x31c2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x31c2('0x6'));var util=require(_0x31c2('0x7'));var path=require('path');var sox=require(_0x31c2('0x8'));var csv=require(_0x31c2('0x9'));var ejs=require(_0x31c2('0xa'));var fs=require('fs');var fs_extra=require(_0x31c2('0xb'));var _=require(_0x31c2('0xc'));var squel=require('squel');var crypto=require(_0x31c2('0xd'));var jsforce=require(_0x31c2('0xe'));var deskjs=require(_0x31c2('0xf'));var toCsv=require(_0x31c2('0x9'));var querystring=require(_0x31c2('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x31c2('0x11'));var qs=require(_0x31c2('0x12'));var as=require(_0x31c2('0x13'));var hardwareService=require(_0x31c2('0x14'));var logger=require(_0x31c2('0x15'))(_0x31c2('0x16'));var utils=require('../../config/utils');var config=require(_0x31c2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x31c2('0x18'))['db'];config[_0x31c2('0x19')]=_[_0x31c2('0x1a')](config['redis'],{'host':_0x31c2('0x1b'),'port':0x18eb});var socket=require(_0x31c2('0x1c'))(new Redis(config['redis']));require(_0x31c2('0x1d'))[_0x31c2('0x1e')](socket);function respondWithStatusCode(_0x463881,_0x41edf9){_0x41edf9=_0x41edf9||0xcc;return function(_0x3f092f){if(_0x3f092f){return _0x463881[_0x31c2('0x1f')](_0x41edf9);}return _0x463881[_0x31c2('0x20')](_0x41edf9)[_0x31c2('0x21')]();};}function respondWithResult(_0x3f1d79,_0x289fff){_0x289fff=_0x289fff||0xc8;return function(_0x3b23b9){if(_0x3b23b9){return _0x3f1d79['status'](_0x289fff)['json'](_0x3b23b9);}};}function respondWithFilteredResult(_0x3bfa45,_0x1ea2ed){return function(_0x1f7f83){if(_0x1f7f83){var _0x589941=_0x1f7f83[_0x31c2('0x22')],_0x5055e7=_0x1ea2ed[_0x31c2('0x23')],_0x437221=_0x1ea2ed[_0x31c2('0x23')]+_0x1ea2ed[_0x31c2('0x24')],_0x4a52fa;if(_0x437221>=_0x589941){_0x437221=_0x589941;_0x4a52fa=0xc8;}else{_0x4a52fa=0xce;}_0x3bfa45['status'](_0x4a52fa);return _0x3bfa45[_0x31c2('0x25')]('Content-Range',_0x5055e7+'-'+_0x437221+'/'+_0x589941)[_0x31c2('0x26')](_0x1f7f83);}return null;};}function patchUpdates(_0x39b8d7){return function(_0x483c25){try{jsonpatch['apply'](_0x483c25,_0x39b8d7,!![]);}catch(_0x3c14bc){return BPromise[_0x31c2('0x27')](_0x3c14bc);}return _0x483c25['save']();};}function saveUpdates(_0x133d0e,_0xeea92c){return function(_0x321cf9){if(_0x321cf9){return _0x321cf9[_0x31c2('0x28')](_0x133d0e)['then'](function(_0x25bdc2){return _0x25bdc2;});}return null;};}function removeEntity(_0x26939e,_0x5bb71d){return function(_0x259a5b){if(_0x259a5b){return _0x259a5b['destroy']()['then'](function(){var _0x3af6eb=_0x259a5b['get']({'plain':!![]});var _0x37b749=_0x31c2('0x29');return db[_0x31c2('0x2a')][_0x31c2('0x2b')]({'where':{'type':_0x37b749,'resourceId':_0x3af6eb['id']}})[_0x31c2('0x2c')](function(){return _0x259a5b;});})['then'](function(){_0x26939e[_0x31c2('0x20')](0xcc)[_0x31c2('0x21')]();});}};}function handleEntityNotFound(_0x3ae1b9,_0x4da763){return function(_0x28d51a){if(!_0x28d51a){_0x3ae1b9[_0x31c2('0x1f')](0x194);}return _0x28d51a;};}function handleError(_0xf8879a,_0x2a936e){_0x2a936e=_0x2a936e||0x1f4;return function(_0x45aa60){logger[_0x31c2('0x2d')](_0x45aa60[_0x31c2('0x2e')]);if(_0x45aa60['name']){delete _0x45aa60[_0x31c2('0x2f')];}_0xf8879a[_0x31c2('0x20')](_0x2a936e)[_0x31c2('0x30')](_0x45aa60);};}exports[_0x31c2('0x31')]=function(_0x276137,_0x3e2eef){var _0x4739c5={},_0x4a4b43={},_0x595b93={'count':0x0,'rows':[]};var _0x421987=_['map'](db[_0x31c2('0x32')][_0x31c2('0x33')],function(_0x2eb846){return{'name':_0x2eb846[_0x31c2('0x34')],'type':_0x2eb846['type'][_0x31c2('0x35')]};});_0x4a4b43['model']=_[_0x31c2('0x36')](_0x421987,_0x31c2('0x2f'));_0x4a4b43[_0x31c2('0x37')]=_[_0x31c2('0x38')](_0x276137['query']);_0x4a4b43['filters']=_['intersection'](_0x4a4b43[_0x31c2('0x39')],_0x4a4b43[_0x31c2('0x37')]);_0x4739c5[_0x31c2('0x3a')]=_[_0x31c2('0x3b')](_0x4a4b43[_0x31c2('0x39')],qs[_0x31c2('0x3c')](_0x276137[_0x31c2('0x37')][_0x31c2('0x3c')]));_0x4739c5[_0x31c2('0x3a')]=_0x4739c5[_0x31c2('0x3a')][_0x31c2('0x3d')]?_0x4739c5[_0x31c2('0x3a')]:_0x4a4b43[_0x31c2('0x39')];if(!_0x276137[_0x31c2('0x37')][_0x31c2('0x3e')]('nolimit')){_0x4739c5['limit']=qs[_0x31c2('0x24')](_0x276137[_0x31c2('0x37')][_0x31c2('0x24')]);_0x4739c5[_0x31c2('0x23')]=qs[_0x31c2('0x23')](_0x276137['query']['offset']);}_0x4739c5[_0x31c2('0x3f')]=qs[_0x31c2('0x40')](_0x276137[_0x31c2('0x37')][_0x31c2('0x40')]);_0x4739c5[_0x31c2('0x41')]=qs['filters'](_[_0x31c2('0x42')](_0x276137[_0x31c2('0x37')],_0x4a4b43['filters']),_0x421987);if(_0x276137[_0x31c2('0x37')]['filter']){_0x4739c5[_0x31c2('0x41')]=_[_0x31c2('0x43')](_0x4739c5[_0x31c2('0x41')],{'$or':_[_0x31c2('0x36')](_0x421987,function(_0x54980e){if(_0x54980e[_0x31c2('0x44')]!==_0x31c2('0x45')){var _0x37f2ac={};_0x37f2ac[_0x54980e[_0x31c2('0x2f')]]={'$like':'%'+_0x276137['query'][_0x31c2('0x46')]+'%'};return _0x37f2ac;}})});}_0x4739c5=_[_0x31c2('0x43')]({},_0x4739c5,_0x276137[_0x31c2('0x47')]);var _0x8e2de4={'where':_0x4739c5[_0x31c2('0x41')]};return db['FaxQueue'][_0x31c2('0x22')](_0x8e2de4)['then'](function(_0x40b61e){_0x595b93['count']=_0x40b61e;if(_0x276137[_0x31c2('0x37')][_0x31c2('0x48')]){_0x4739c5[_0x31c2('0x49')]=[{'all':!![]}];}return db[_0x31c2('0x32')][_0x31c2('0x4a')](_0x4739c5);})[_0x31c2('0x2c')](function(_0x27ff27){_0x595b93['rows']=_0x27ff27;return _0x595b93;})[_0x31c2('0x2c')](respondWithFilteredResult(_0x3e2eef,_0x4739c5))[_0x31c2('0x4b')](handleError(_0x3e2eef,null));};exports[_0x31c2('0x4c')]=function(_0x65e1bb,_0x3841f1){var _0x3448f4={'raw':!![],'where':{'id':_0x65e1bb[_0x31c2('0x4d')]['id']}},_0x40815f={};_0x40815f[_0x31c2('0x39')]=_[_0x31c2('0x38')](db[_0x31c2('0x32')][_0x31c2('0x33')]);_0x40815f[_0x31c2('0x37')]=_[_0x31c2('0x38')](_0x65e1bb[_0x31c2('0x37')]);_0x40815f[_0x31c2('0x4e')]=_[_0x31c2('0x3b')](_0x40815f[_0x31c2('0x39')],_0x40815f['query']);_0x3448f4[_0x31c2('0x3a')]=_[_0x31c2('0x3b')](_0x40815f['model'],qs[_0x31c2('0x3c')](_0x65e1bb[_0x31c2('0x37')][_0x31c2('0x3c')]));_0x3448f4[_0x31c2('0x3a')]=_0x3448f4[_0x31c2('0x3a')][_0x31c2('0x3d')]?_0x3448f4[_0x31c2('0x3a')]:_0x40815f['model'];if(_0x65e1bb['query']['includeAll']){_0x3448f4[_0x31c2('0x49')]=[{'all':!![]}];}_0x3448f4=_[_0x31c2('0x43')]({},_0x3448f4,_0x65e1bb['options']);return db['FaxQueue'][_0x31c2('0x4f')](_0x3448f4)[_0x31c2('0x2c')](handleEntityNotFound(_0x3841f1,null))['then'](respondWithResult(_0x3841f1,null))[_0x31c2('0x4b')](handleError(_0x3841f1,null));};exports[_0x31c2('0x50')]=function(_0x4c0f5e,_0xa003fd){return db[_0x31c2('0x32')]['create'](_0x4c0f5e[_0x31c2('0x51')],{})[_0x31c2('0x2c')](function(_0x49ad6d){var _0x305769=_0x4c0f5e[_0x31c2('0x52')][_0x31c2('0x53')]({'plain':!![]});if(!_0x305769)throw new Error(_0x31c2('0x54'));if(_0x305769[_0x31c2('0x55')]===_0x31c2('0x52')){var _0x358b4f=_0x49ad6d[_0x31c2('0x53')]({'plain':!![]});var _0x20f0f8=_0x31c2('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x20f0f8,'userProfileId':_0x305769[_0x31c2('0x56')]},'raw':!![]})[_0x31c2('0x2c')](function(_0x2b65ee){if(_0x2b65ee&&_0x2b65ee[_0x31c2('0x57')]===0x0){return db[_0x31c2('0x2a')][_0x31c2('0x50')]({'name':_0x358b4f[_0x31c2('0x2f')],'resourceId':_0x358b4f['id'],'type':_0x2b65ee[_0x31c2('0x2f')],'sectionId':_0x2b65ee['id']},{})[_0x31c2('0x2c')](function(){return _0x49ad6d;});}else{return _0x49ad6d;}})[_0x31c2('0x4b')](function(_0x99af41){logger[_0x31c2('0x2d')](_0x31c2('0x58'),_0x99af41);throw _0x99af41;});}return _0x49ad6d;})[_0x31c2('0x2c')](respondWithResult(_0xa003fd,0xc9))[_0x31c2('0x4b')](handleError(_0xa003fd,null));};exports[_0x31c2('0x28')]=function(_0x2b1e32,_0x4b28c0){if(_0x2b1e32[_0x31c2('0x51')]['id']){delete _0x2b1e32[_0x31c2('0x51')]['id'];}return db[_0x31c2('0x32')][_0x31c2('0x4f')]({'where':{'id':_0x2b1e32['params']['id']}})['then'](handleEntityNotFound(_0x4b28c0,null))[_0x31c2('0x2c')](saveUpdates(_0x2b1e32[_0x31c2('0x51')],null))['then'](respondWithResult(_0x4b28c0,null))[_0x31c2('0x4b')](handleError(_0x4b28c0,null));};exports[_0x31c2('0x2b')]=function(_0x26a9c8,_0x1ac616){return db['FaxQueue']['find']({'where':{'id':_0x26a9c8[_0x31c2('0x4d')]['id']}})[_0x31c2('0x2c')](handleEntityNotFound(_0x1ac616,null))[_0x31c2('0x2c')](removeEntity(_0x1ac616,null))[_0x31c2('0x4b')](handleError(_0x1ac616,null));};exports[_0x31c2('0x59')]=function(_0x57b400,_0x2e6ee0){return db[_0x31c2('0x32')]['describe']()[_0x31c2('0x2c')](respondWithResult(_0x2e6ee0,null))[_0x31c2('0x4b')](handleError(_0x2e6ee0,null));};exports['getMembers']=function(_0x152ed8,_0x220a28,_0x39bdda){var _0x94e9d3={'raw':!![],'where':{}},_0x4037f2={},_0x5dcd40;return db[_0x31c2('0x32')][_0x31c2('0x5a')]({'where':{'id':_0x152ed8['params']['id']}})[_0x31c2('0x2c')](handleEntityNotFound(_0x220a28,null))[_0x31c2('0x2c')](function(_0x74f0b0){if(_0x74f0b0){_0x5dcd40=_0x74f0b0[_0x31c2('0x53')]({'plain':!![]});_0x4037f2['model']=_[_0x31c2('0x38')](db[_0x31c2('0x5b')][_0x31c2('0x33')]);_0x4037f2[_0x31c2('0x37')]=_['keys'](_0x152ed8[_0x31c2('0x37')]);_0x4037f2[_0x31c2('0x4e')]=_[_0x31c2('0x3b')](_0x4037f2['model'],_0x4037f2[_0x31c2('0x37')]);_0x94e9d3[_0x31c2('0x3a')]=_[_0x31c2('0x3b')](_0x4037f2['model'],qs['fields'](_0x152ed8[_0x31c2('0x37')][_0x31c2('0x3c')]));_0x94e9d3[_0x31c2('0x3a')]=_0x94e9d3['attributes'][_0x31c2('0x3d')]?_0x94e9d3[_0x31c2('0x3a')]:_0x4037f2[_0x31c2('0x39')];if(!_0x152ed8[_0x31c2('0x37')][_0x31c2('0x3e')]('nolimit')){_0x94e9d3['limit']=qs[_0x31c2('0x24')](_0x152ed8[_0x31c2('0x37')]['limit']);_0x94e9d3[_0x31c2('0x23')]=qs[_0x31c2('0x23')](_0x152ed8[_0x31c2('0x37')][_0x31c2('0x23')]);}_0x94e9d3[_0x31c2('0x3f')]=qs[_0x31c2('0x40')](_0x152ed8['query']['sort']);_0x94e9d3[_0x31c2('0x41')]=qs[_0x31c2('0x4e')](_[_0x31c2('0x42')](_0x152ed8['query'],_0x4037f2['filters']));_0x94e9d3[_0x31c2('0x41')][_0x31c2('0x5c')]=_0x74f0b0['id'];if(_0x152ed8[_0x31c2('0x37')][_0x31c2('0x46')]){_0x94e9d3[_0x31c2('0x41')]=_[_0x31c2('0x43')](_0x94e9d3['where'],{'$or':_[_0x31c2('0x36')](_0x94e9d3[_0x31c2('0x3a')],function(_0x3dba2a){var _0xe35f9c={};_0xe35f9c[_0x3dba2a]={'$like':'%'+_0x152ed8[_0x31c2('0x37')][_0x31c2('0x46')]+'%'};return _0xe35f9c;})});}_0x94e9d3=_['merge']({},_0x94e9d3,_0x152ed8[_0x31c2('0x47')]);return db[_0x31c2('0x5b')][_0x31c2('0x4a')](_0x94e9d3);}})[_0x31c2('0x2c')](function(_0x489cd2){if(_0x489cd2){return db['User'][_0x31c2('0x5d')]({'where':{'id':_[_0x31c2('0x36')](_0x489cd2,_0x31c2('0x5e')),'role':_0x31c2('0x5f')},'attributes':['id',_0x31c2('0x2f'),_0x31c2('0x60'),_0x31c2('0x61'),_0x31c2('0x62')]});}})['then'](function(_0x3b7e9c){if(_0x3b7e9c){return{'count':_0x3b7e9c[_0x31c2('0x22')],'rows':_[_0x31c2('0x36')](_0x3b7e9c[_0x31c2('0x63')],function(_0x25ae6d){return{'membername':_0x25ae6d[_0x31c2('0x2f')],'UserId':_0x25ae6d['id'],'queue_name':_0x5dcd40[_0x31c2('0x2f')],'FaxQueueId':_0x5dcd40['id'],'interface':util[_0x31c2('0x64')](_0x31c2('0x65'),'SIP',_0x25ae6d[_0x31c2('0x2f')]),'penalty':0x0,'paused':_0x25ae6d['faxPause'],'createdAt':_0x25ae6d[_0x31c2('0x62')],'updatedAt':_0x25ae6d[_0x31c2('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x220a28,_0x94e9d3))[_0x31c2('0x4b')](handleError(_0x220a28,null));};exports['getTeams']=function(_0x567ef0,_0x5e1ad0,_0x20c4b0){var _0x3cb940={};var _0x5791fd={};var _0x292cf5;var _0x116391;return db[_0x31c2('0x32')][_0x31c2('0x5a')]({'where':{'id':_0x567ef0[_0x31c2('0x4d')]['id']}})[_0x31c2('0x2c')](handleEntityNotFound(_0x5e1ad0,null))['then'](function(_0x4c4f0d){if(_0x4c4f0d){_0x292cf5=_0x4c4f0d;_0x5791fd[_0x31c2('0x39')]=_[_0x31c2('0x38')](db[_0x31c2('0x66')][_0x31c2('0x33')]);_0x5791fd['query']=_[_0x31c2('0x38')](_0x567ef0[_0x31c2('0x37')]);_0x5791fd[_0x31c2('0x4e')]=_[_0x31c2('0x3b')](_0x5791fd['model'],_0x5791fd['query']);_0x3cb940[_0x31c2('0x3a')]=_[_0x31c2('0x3b')](_0x5791fd[_0x31c2('0x39')],qs[_0x31c2('0x3c')](_0x567ef0[_0x31c2('0x37')]['fields']));_0x3cb940['attributes']=_0x3cb940[_0x31c2('0x3a')][_0x31c2('0x3d')]?_0x3cb940[_0x31c2('0x3a')]:_0x5791fd['model'];_0x3cb940['order']=qs[_0x31c2('0x40')](_0x567ef0['query'][_0x31c2('0x40')]);_0x3cb940[_0x31c2('0x41')]=qs[_0x31c2('0x4e')](_[_0x31c2('0x42')](_0x567ef0[_0x31c2('0x37')],_0x5791fd['filters']));if(_0x567ef0[_0x31c2('0x37')]['filter']){_0x3cb940[_0x31c2('0x41')]=_[_0x31c2('0x43')](_0x3cb940[_0x31c2('0x41')],{'$or':_[_0x31c2('0x36')](_0x3cb940[_0x31c2('0x3a')],function(_0x3b2c73){var _0x3ec429={};_0x3ec429[_0x3b2c73]={'$like':'%'+_0x567ef0[_0x31c2('0x37')]['filter']+'%'};return _0x3ec429;})});}_0x3cb940=_[_0x31c2('0x43')]({},_0x3cb940,_0x567ef0['options']);return _0x292cf5[_0x31c2('0x67')](_0x3cb940);}})[_0x31c2('0x2c')](function(_0x4a78a4){if(_0x4a78a4){_0x116391=_0x4a78a4['length'];if(!_0x567ef0[_0x31c2('0x37')]['hasOwnProperty'](_0x31c2('0x68'))){_0x3cb940['limit']=qs[_0x31c2('0x24')](_0x567ef0[_0x31c2('0x37')][_0x31c2('0x24')]);_0x3cb940['offset']=qs['offset'](_0x567ef0['query'][_0x31c2('0x23')]);}return _0x292cf5['getTeams'](_0x3cb940);}})['then'](function(_0x5bfa03){if(_0x5bfa03){return _0x5bfa03?{'count':_0x116391,'rows':_0x5bfa03}:null;}})[_0x31c2('0x2c')](respondWithResult(_0x5e1ad0,null))['catch'](handleError(_0x5e1ad0,null));};exports[_0x31c2('0x69')]=function(_0x4a78e8,_0x565c28,_0x396d7f){var _0x38dfe3=_0x4a78e8[_0x31c2('0x51')][_0x31c2('0x6a')];return db[_0x31c2('0x66')]['findAll']({'where':{'id':_0x38dfe3},'attributes':['id'],'include':[{'model':db['User'],'as':_0x31c2('0x6b'),'attributes':['id',_0x31c2('0x2f'),'online',_0x31c2('0x6c'),'interface'],'raw':!![]}]})[_0x31c2('0x2c')](function(_0x3adedc){if(_0x3adedc){var _0x5519bc=_[_0x31c2('0x6d')](_0x3adedc,function(_0x20005b){var _0x2b948b=_0x20005b[_0x31c2('0x53')]({'plain':!![]});return _0x2b948b[_0x31c2('0x6b')];});return db[_0x31c2('0x32')]['find']({'where':{'id':_0x4a78e8[_0x31c2('0x4d')]['id']}})[_0x31c2('0x2c')](function(_0x19a10c){return db['sequelize'][_0x31c2('0x6e')](function(_0x118b1b){return _0x19a10c[_0x31c2('0x69')](_0x38dfe3,{'transaction':_0x118b1b})[_0x31c2('0x2c')](function(){return BPromise[_0x31c2('0x6f')](_0x5519bc,function(_0x2c4549){return db[_0x31c2('0x5b')][_0x31c2('0x70')]({'where':{'UserId':_0x2c4549['id'],'FaxQueueId':_0x4a78e8['params']['id']},'transaction':_0x118b1b});});})[_0x31c2('0x2c')](function(){_0x5519bc[_0x31c2('0x71')](function(_0x210bc0){socket[_0x31c2('0x72')](_0x31c2('0x73'),{'UserId':_0x210bc0['id'],'FaxQueueId':_0x19a10c['id']});});});});});}})[_0x31c2('0x2c')](respondWithStatusCode(_0x565c28,null))[_0x31c2('0x4b')](handleError(_0x565c28,null));};exports[_0x31c2('0x74')]=function(_0x1fde5d,_0x1d83e6,_0x28e6dc){return db['Team']['findAll']({'where':{'id':_0x1fde5d[_0x31c2('0x37')][_0x31c2('0x6a')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x31c2('0x2c')](handleEntityNotFound(_0x1d83e6,null))[_0x31c2('0x2c')](function(_0x39fb6a){var _0x128a0e=_[_0x31c2('0x36')](_0x39fb6a,'id');var _0x83bea7=[];var _0x110965=[];var _0x37700e=squel[_0x31c2('0x75')]();_0x37700e[_0x31c2('0x76')]('tq.TeamId')['from'](_0x31c2('0x77'),'tq')['join']('user_has_teams','ut',_0x31c2('0x78'))[_0x31c2('0x41')](_0x31c2('0x79'),_0x1fde5d['params']['id']);for(var _0x2ce76a=0x0;_0x2ce76a<_0x39fb6a[_0x31c2('0x3d')];_0x2ce76a+=0x1){let _0x4e4413=_0x39fb6a[_0x2ce76a];for(var _0x5466be=0x0;_0x5466be<_0x4e4413[_0x31c2('0x6b')][_0x31c2('0x3d')];_0x5466be+=0x1){let _0x27254c=_0x4e4413[_0x31c2('0x6b')][_0x5466be];var _0xff8071=_0x37700e[_0x31c2('0x7a')]();_0xff8071['where'](_0x31c2('0x7b'),_0x27254c['id']);_0x110965[_0x31c2('0x7c')](db[_0x31c2('0x7d')]['query'](_0xff8071['toString'](),{'type':db['sequelize'][_0x31c2('0x7e')][_0x31c2('0x7f')]})[_0x31c2('0x2c')](function(_0x4e3fc1){if(_0x4e3fc1[_0x31c2('0x3d')]===0x1){return _0x27254c['id'];}else{var _0x1bb46c=_[_0x31c2('0x80')](_['map'](_0x4e3fc1,_0x31c2('0x81')),function(_0x5a060e){return _['includes'](_0x128a0e,_0x5a060e);});if(_0x1bb46c){return _0x27254c['id'];}}}));}}return BPromise[_0x31c2('0x82')](_0x110965)[_0x31c2('0x2c')](function(_0x278e2b){_0x83bea7=_(_0x83bea7)[_0x31c2('0x83')](_0x278e2b)[_0x31c2('0x84')]()['value']();return db[_0x31c2('0x32')][_0x31c2('0x4f')]({'where':{'id':_0x1fde5d[_0x31c2('0x4d')]['id']}})[_0x31c2('0x2c')](function(_0x1afbe9){return db[_0x31c2('0x7d')][_0x31c2('0x6e')](function(_0x45dcd6){return _0x1afbe9[_0x31c2('0x74')](_0x1fde5d['query'][_0x31c2('0x6a')],{'transaction':_0x45dcd6})[_0x31c2('0x2c')](function(){if(!_[_0x31c2('0x85')](_0x83bea7)){return _0x1afbe9['removeAgents'](_0x83bea7,{'transaction':_0x45dcd6});}})[_0x31c2('0x2c')](function(){_0x83bea7[_0x31c2('0x71')](function(_0xb7de51){socket['emit'](_0x31c2('0x86'),{'UserId':_0xb7de51,'FaxQueueId':_0x1afbe9['id']});});});});});});})['then'](respondWithStatusCode(_0x1d83e6,null))[_0x31c2('0x4b')](handleError(_0x1d83e6,null));};exports[_0x31c2('0x87')]=function(_0x3275c2,_0x58ff4d,_0x3788b1){return db['FaxQueue']['find']({'where':{'id':_0x3275c2['params']['id']}})[_0x31c2('0x2c')](handleEntityNotFound(_0x58ff4d,null))[_0x31c2('0x2c')](function(_0x345608){if(_0x345608){return _0x345608[_0x31c2('0x87')](_0x3275c2[_0x31c2('0x51')]['ids'],_[_0x31c2('0x88')](_0x3275c2['body'],[_0x31c2('0x6a'),'id'])||{})[_0x31c2('0x89')](function(_0x1079d9){for(var _0x317d37=0x0;_0x317d37<_0x3275c2[_0x31c2('0x51')][_0x31c2('0x6a')][_0x31c2('0x3d')];_0x317d37+=0x1){socket['emit'](_0x31c2('0x73'),{'UserId':_0x3275c2[_0x31c2('0x51')][_0x31c2('0x6a')][_0x317d37],'FaxQueueId':_0x3275c2[_0x31c2('0x4d')]['id']});}return _0x1079d9;});}})[_0x31c2('0x2c')](respondWithResult(_0x58ff4d,null))[_0x31c2('0x4b')](handleError(_0x58ff4d,null));};exports[_0x31c2('0x8a')]=function(_0x28457f,_0x367ed2,_0x5701cb){return db[_0x31c2('0x32')][_0x31c2('0x4f')]({'where':{'id':_0x28457f[_0x31c2('0x4d')]['id']}})[_0x31c2('0x2c')](handleEntityNotFound(_0x367ed2,null))[_0x31c2('0x2c')](function(_0x1fe0a5){if(_0x1fe0a5){return _0x1fe0a5[_0x31c2('0x8a')](_0x28457f[_0x31c2('0x37')][_0x31c2('0x6a')])[_0x31c2('0x2c')](function(){if(_['isArray'](_0x28457f[_0x31c2('0x37')]['ids'])){for(var _0x7dc963=0x0;_0x7dc963<_0x28457f['query'][_0x31c2('0x6a')]['length'];_0x7dc963+=0x1){socket[_0x31c2('0x72')](_0x31c2('0x86'),{'UserId':Number(_0x28457f[_0x31c2('0x37')]['ids'][_0x7dc963]),'FaxQueueId':Number(_0x28457f[_0x31c2('0x4d')]['id'])});}}else{socket[_0x31c2('0x72')]('userFaxQueue:remove',{'UserId':Number(_0x28457f[_0x31c2('0x37')][_0x31c2('0x6a')]),'FaxQueueId':Number(_0x28457f[_0x31c2('0x4d')]['id'])});}});}})[_0x31c2('0x2c')](respondWithStatusCode(_0x367ed2,null))[_0x31c2('0x4b')](handleError(_0x367ed2,null));};exports[_0x31c2('0x8b')]=function(_0x2ef690,_0x15b3f0,_0x16629f){var _0x3f0a88={};var _0x5d1598={};var _0x132e8f;var _0x4435d8;return db[_0x31c2('0x32')][_0x31c2('0x5a')]({'where':{'id':_0x2ef690[_0x31c2('0x4d')]['id']}})[_0x31c2('0x2c')](handleEntityNotFound(_0x15b3f0,null))[_0x31c2('0x2c')](function(_0x2410da){if(_0x2410da){_0x132e8f=_0x2410da;_0x5d1598[_0x31c2('0x39')]=_['keys'](db[_0x31c2('0x8c')]['rawAttributes']);_0x5d1598[_0x31c2('0x37')]=_[_0x31c2('0x38')](_0x2ef690['query']);_0x5d1598[_0x31c2('0x4e')]=_['intersection'](_0x5d1598[_0x31c2('0x39')],_0x5d1598[_0x31c2('0x37')]);_0x3f0a88[_0x31c2('0x3a')]=_[_0x31c2('0x3b')](_0x5d1598['model'],qs['fields'](_0x2ef690['query'][_0x31c2('0x3c')]));_0x3f0a88[_0x31c2('0x3a')]=_0x3f0a88[_0x31c2('0x3a')][_0x31c2('0x3d')]?_0x3f0a88['attributes']:_0x5d1598[_0x31c2('0x39')];_0x3f0a88[_0x31c2('0x3f')]=qs[_0x31c2('0x40')](_0x2ef690[_0x31c2('0x37')][_0x31c2('0x40')]);_0x3f0a88[_0x31c2('0x41')]=qs[_0x31c2('0x4e')](_['pick'](_0x2ef690[_0x31c2('0x37')],_0x5d1598['filters']));if(_0x2ef690[_0x31c2('0x37')][_0x31c2('0x46')]){_0x3f0a88['where']=_[_0x31c2('0x43')](_0x3f0a88[_0x31c2('0x41')],{'$or':_[_0x31c2('0x36')](_0x3f0a88[_0x31c2('0x3a')],function(_0x5e6bce){var _0x3982c0={};_0x3982c0[_0x5e6bce]={'$like':'%'+_0x2ef690[_0x31c2('0x37')][_0x31c2('0x46')]+'%'};return _0x3982c0;})});}_0x3f0a88=_[_0x31c2('0x43')]({},_0x3f0a88,_0x2ef690[_0x31c2('0x47')]);return _0x132e8f[_0x31c2('0x8b')](_0x3f0a88);}})[_0x31c2('0x2c')](function(_0x186c11){if(_0x186c11){_0x4435d8=_0x186c11[_0x31c2('0x3d')];if(!_0x2ef690[_0x31c2('0x37')][_0x31c2('0x3e')]('nolimit')){_0x3f0a88['limit']=qs[_0x31c2('0x24')](_0x2ef690[_0x31c2('0x37')][_0x31c2('0x24')]);_0x3f0a88[_0x31c2('0x23')]=qs['offset'](_0x2ef690['query'][_0x31c2('0x23')]);}return _0x132e8f['getAgents'](_0x3f0a88);}})[_0x31c2('0x2c')](function(_0x252470){if(_0x252470){return _0x252470?{'count':_0x4435d8,'rows':_0x252470}:null;}})[_0x31c2('0x2c')](respondWithResult(_0x15b3f0,null))[_0x31c2('0x4b')](handleError(_0x15b3f0,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index ac9a505..c5b1735 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 _0x64f8=['update','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x23bcd5,_0x2a3d38){var _0x4554fe=function(_0x4c2215){while(--_0x4c2215){_0x23bcd5['push'](_0x23bcd5['shift']());}};_0x4554fe(++_0x2a3d38);}(_0x64f8,0x19d));var _0x864f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x64f8[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x864f('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x864f('0x1')](0x0);var events={'afterCreate':_0x864f('0x2'),'afterUpdate':_0x864f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5c85aa){return function(_0x2d00f8,_0x333990,_0x315db3){FaxQueueEvents[_0x864f('0x4')](_0x5c85aa+':'+_0x2d00f8['id'],_0x2d00f8);FaxQueueEvents[_0x864f('0x4')](_0x5c85aa,_0x2d00f8);_0x315db3(null);};}for(var e in events){if(events[_0x864f('0x5')](e)){var event=events[e];FaxQueue[_0x864f('0x6')](e,emitEvent(event));}}module[_0x864f('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x8ff9=['../../mysqldb','setMaxListeners','save','update','emit','events'];(function(_0x9be28f,_0x231334){var _0xa9f52d=function(_0x239dad){while(--_0x239dad){_0x9be28f['push'](_0x9be28f['shift']());}};_0xa9f52d(++_0x231334);}(_0x8ff9,0xa1));var _0x98ff=function(_0x3a6fad,_0x306064){_0x3a6fad=_0x3a6fad-0x0;var _0x32e057=_0x8ff9[_0x3a6fad];return _0x32e057;};'use strict';var EventEmitter=require(_0x98ff('0x0'));var FaxQueue=require(_0x98ff('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x98ff('0x2')](0x0);var events={'afterCreate':_0x98ff('0x3'),'afterUpdate':_0x98ff('0x4'),'afterDestroy':'remove'};function emitEvent(_0x596ee8){return function(_0x2a9f3c,_0x7aeb6c,_0x3de543){FaxQueueEvents[_0x98ff('0x5')](_0x596ee8+':'+_0x2a9f3c['id'],_0x2a9f3c);FaxQueueEvents[_0x98ff('0x5')](_0x596ee8,_0x2a9f3c);_0x3de543(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 1b6cb83..2a64983 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 _0xa72e=['../../config/logger','api','moment','bluebird','path','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util'];(function(_0x295f58,_0x5e72dd){var _0x540fe0=function(_0x1335f5){while(--_0x1335f5){_0x295f58['push'](_0x295f58['shift']());}};_0x540fe0(++_0x5e72dd);}(_0xa72e,0x1ba));var _0xea72=function(_0x51ad9b,_0x3dcb3e){_0x51ad9b=_0x51ad9b-0x0;var _0x5b8787=_0xa72e[_0x51ad9b];return _0x5b8787;};'use strict';var _=require(_0xea72('0x0'));var util=require(_0xea72('0x1'));var logger=require(_0xea72('0x2'))(_0xea72('0x3'));var moment=require(_0xea72('0x4'));var BPromise=require(_0xea72('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea72('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xea72('0x7'));module[_0xea72('0x8')]=function(_0x2d4b94,_0x14eb4e){return _0x2d4b94[_0xea72('0x9')](_0xea72('0xa'),attributes,{'tableName':_0xea72('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd502=['fax_queues','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','FaxQueue'];(function(_0x50faaa,_0x59d114){var _0x48300e=function(_0x4cdf0f){while(--_0x4cdf0f){_0x50faaa['push'](_0x50faaa['shift']());}};_0x48300e(++_0x59d114);}(_0xd502,0xc7));var _0x2d50=function(_0x44044a,_0x3a0097){_0x44044a=_0x44044a-0x0;var _0x43bb6e=_0xd502[_0x44044a];return _0x43bb6e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2d50('0x0'))(_0x2d50('0x1'));var moment=require('moment');var BPromise=require(_0x2d50('0x2'));var rp=require(_0x2d50('0x3'));var fs=require('fs');var path=require(_0x2d50('0x4'));var rimraf=require(_0x2d50('0x5'));var config=require(_0x2d50('0x6'));var attributes=require(_0x2d50('0x7'));module[_0x2d50('0x8')]=function(_0x136b2b,_0x4ccf62){return _0x136b2b['define'](_0x2d50('0x9'),attributes,{'tableName':_0x2d50('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index fb7939d..49ee0f0 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 _0x26d4=['ShowFaxQueue','find','info','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','redis','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','catch','FaxQueue','findAll','options','raw','where','attributes','include','map','model','then','GetFaxQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x26d4,0x1a5));var _0x426d=function(_0x582681,_0x476b29){_0x582681=_0x582681-0x0;var _0x436106=_0x26d4[_0x582681];return _0x436106;};'use strict';var _=require(_0x426d('0x0'));var util=require(_0x426d('0x1'));var moment=require('moment');var BPromise=require(_0x426d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x426d('0x3'));var db=require(_0x426d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x426d('0x5'));var config=require(_0x426d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x426d('0x7')]['http']({'port':0x232a});config[_0x426d('0x8')]=_[_0x426d('0x9')](config[_0x426d('0x8')],{'host':_0x426d('0xa'),'port':0x18eb});var socket=require(_0x426d('0xb'))(new Redis(config['redis']));require(_0x426d('0xc'))[_0x426d('0xd')](socket);function respondWithRpcPromise(_0x25839b,_0x17c163,_0x1b6ce1){return new BPromise(function(_0x43cb95,_0x27fd72){return client[_0x426d('0xe')](_0x25839b,_0x1b6ce1)['then'](function(_0x23a662){logger['info'](_0x426d('0xf'),_0x17c163,_0x426d('0x10'));logger[_0x426d('0x11')](_0x426d('0x12'),_0x17c163,_0x426d('0x10'),JSON[_0x426d('0x13')](_0x23a662));if(_0x23a662['error']){if(_0x23a662[_0x426d('0x14')][_0x426d('0x15')]===0x1f4){logger[_0x426d('0x14')](_0x426d('0xf'),_0x17c163,_0x23a662[_0x426d('0x14')]['message']);return _0x27fd72(_0x23a662[_0x426d('0x14')][_0x426d('0x16')]);}logger[_0x426d('0x14')](_0x426d('0xf'),_0x17c163,_0x23a662[_0x426d('0x14')][_0x426d('0x16')]);return _0x43cb95(_0x23a662['error']['message']);}else{logger['info'](_0x426d('0xf'),_0x17c163,_0x426d('0x10'));_0x43cb95(_0x23a662['result']['message']);}})[_0x426d('0x17')](function(_0x22fb67){logger[_0x426d('0x14')](_0x426d('0xf'),_0x17c163,_0x22fb67);_0x27fd72(_0x22fb67);});});}exports['GetFaxQueue']=function(_0x3b7b4e){var _0x20db56=this;return new Promise(function(_0x276216,_0x4b7c4c){return db[_0x426d('0x18')][_0x426d('0x19')]({'raw':_0x3b7b4e['options']?_0x3b7b4e[_0x426d('0x1a')][_0x426d('0x1b')]===undefined?!![]:![]:!![],'where':_0x3b7b4e[_0x426d('0x1a')]?_0x3b7b4e[_0x426d('0x1a')][_0x426d('0x1c')]||null:null,'attributes':_0x3b7b4e['options']?_0x3b7b4e['options'][_0x426d('0x1d')]||null:null,'limit':_0x3b7b4e['options']?_0x3b7b4e[_0x426d('0x1a')]['limit']||null:null,'include':_0x3b7b4e[_0x426d('0x1a')]?_0x3b7b4e[_0x426d('0x1a')][_0x426d('0x1e')]?_[_0x426d('0x1f')](_0x3b7b4e['options']['include'],function(_0x4b7536){return{'model':db[_0x4b7536['model']],'as':_0x4b7536['as'],'attributes':_0x4b7536['attributes'],'include':_0x4b7536[_0x426d('0x1e')]?_[_0x426d('0x1f')](_0x4b7536[_0x426d('0x1e')],function(_0x2d6708){return{'model':db[_0x2d6708[_0x426d('0x20')]],'as':_0x2d6708['as'],'attributes':_0x2d6708['attributes'],'include':_0x2d6708[_0x426d('0x1e')]?_[_0x426d('0x1f')](_0x2d6708[_0x426d('0x1e')],function(_0x19772b){return{'model':db[_0x19772b[_0x426d('0x20')]],'as':_0x19772b['as'],'attributes':_0x19772b[_0x426d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x426d('0x21')](function(_0x5afc3c){logger['info'](_0x426d('0x22'),_0x3b7b4e);logger[_0x426d('0x11')](_0x426d('0x22'),_0x3b7b4e,JSON['stringify'](_0x5afc3c));_0x276216(_0x5afc3c);})[_0x426d('0x17')](function(_0xbf2949){logger['error'](_0x426d('0x22'),_0xbf2949[_0x426d('0x16')],_0x3b7b4e);_0x4b7c4c(_0x20db56['error'](0x1f4,_0xbf2949['message']));});});};exports[_0x426d('0x23')]=function(_0x409a75){var _0x3bdb08=this;return new Promise(function(_0x59ad19,_0x3ee1a7){return db[_0x426d('0x18')][_0x426d('0x24')]({'raw':_0x409a75[_0x426d('0x1a')]?_0x409a75[_0x426d('0x1a')][_0x426d('0x1b')]===undefined?!![]:![]:!![],'where':_0x409a75['options']?_0x409a75[_0x426d('0x1a')][_0x426d('0x1c')]||null:null,'attributes':_0x409a75[_0x426d('0x1a')]?_0x409a75[_0x426d('0x1a')][_0x426d('0x1d')]||null:null,'include':_0x409a75['options']?_0x409a75['options'][_0x426d('0x1e')]?_[_0x426d('0x1f')](_0x409a75[_0x426d('0x1a')][_0x426d('0x1e')],function(_0x21725c){return{'model':db[_0x21725c[_0x426d('0x20')]],'as':_0x21725c['as'],'attributes':_0x21725c['attributes'],'include':_0x21725c['include']?_[_0x426d('0x1f')](_0x21725c[_0x426d('0x1e')],function(_0x4f30a3){return{'model':db[_0x4f30a3[_0x426d('0x20')]],'as':_0x4f30a3['as'],'attributes':_0x4f30a3[_0x426d('0x1d')],'include':_0x4f30a3[_0x426d('0x1e')]?_[_0x426d('0x1f')](_0x4f30a3[_0x426d('0x1e')],function(_0x7e7ee2){return{'model':db[_0x7e7ee2['model']],'as':_0x7e7ee2['as'],'attributes':_0x7e7ee2[_0x426d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x426d('0x21')](function(_0x4133e9){logger[_0x426d('0x25')](_0x426d('0x23'),_0x409a75);logger['debug'](_0x426d('0x23'),_0x409a75,JSON['stringify'](_0x4133e9));_0x59ad19(_0x4133e9);})[_0x426d('0x17')](function(_0x45dba2){logger[_0x426d('0x14')](_0x426d('0x23'),_0x45dba2[_0x426d('0x16')],_0x409a75);_0x3ee1a7(_0x3bdb08[_0x426d('0x14')](0x1f4,_0x45dba2['message']));});});}; \ No newline at end of file +var _0x776a=['limit','include','map','model','then','ShowFaxQueue','find','where','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','attributes'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x776a,0x11a));var _0xa776=function(_0x37223e,_0x40d5a6){_0x37223e=_0x37223e-0x0;var _0x17a9b0=_0x776a[_0x37223e];return _0x17a9b0;};'use strict';var _=require(_0xa776('0x0'));var util=require(_0xa776('0x1'));var moment=require(_0xa776('0x2'));var BPromise=require('bluebird');var rs=require(_0xa776('0x3'));var fs=require('fs');var Redis=require(_0xa776('0x4'));var db=require(_0xa776('0x5'))['db'];var utils=require(_0xa776('0x6'));var logger=require('../../config/logger')(_0xa776('0x7'));var config=require('../../config/environment');var jayson=require(_0xa776('0x8'));var client=jayson[_0xa776('0x9')]['http']({'port':0x232a});config[_0xa776('0xa')]=_[_0xa776('0xb')](config[_0xa776('0xa')],{'host':_0xa776('0xc'),'port':0x18eb});var socket=require(_0xa776('0xd'))(new Redis(config['redis']));require('./faxQueue.socket')[_0xa776('0xe')](socket);function respondWithRpcPromise(_0x3d2827,_0x6f5365,_0xacd995){return new BPromise(function(_0x384c2d,_0x445d8b){return client['request'](_0x3d2827,_0xacd995)['then'](function(_0x3e71a0){logger['info'](_0xa776('0xf'),_0x6f5365,'request\x20sent');logger[_0xa776('0x10')](_0xa776('0x11'),_0x6f5365,'request\x20sent',JSON['stringify'](_0x3e71a0));if(_0x3e71a0['error']){if(_0x3e71a0[_0xa776('0x12')]['code']===0x1f4){logger[_0xa776('0x12')]('FaxQueue,\x20%s,\x20%s',_0x6f5365,_0x3e71a0[_0xa776('0x12')][_0xa776('0x13')]);return _0x445d8b(_0x3e71a0[_0xa776('0x12')][_0xa776('0x13')]);}logger[_0xa776('0x12')](_0xa776('0xf'),_0x6f5365,_0x3e71a0['error'][_0xa776('0x13')]);return _0x384c2d(_0x3e71a0[_0xa776('0x12')][_0xa776('0x13')]);}else{logger[_0xa776('0x14')]('FaxQueue,\x20%s,\x20%s',_0x6f5365,_0xa776('0x15'));_0x384c2d(_0x3e71a0[_0xa776('0x16')][_0xa776('0x13')]);}})[_0xa776('0x17')](function(_0x41eb38){logger[_0xa776('0x12')](_0xa776('0xf'),_0x6f5365,_0x41eb38);_0x445d8b(_0x41eb38);});});}exports[_0xa776('0x18')]=function(_0x2483af){var _0x91f2cf=this;return new Promise(function(_0x35b37c,_0x107e4c){return db[_0xa776('0x19')][_0xa776('0x1a')]({'raw':_0x2483af[_0xa776('0x1b')]?_0x2483af[_0xa776('0x1b')][_0xa776('0x1c')]===undefined?!![]:![]:!![],'where':_0x2483af[_0xa776('0x1b')]?_0x2483af[_0xa776('0x1b')]['where']||null:null,'attributes':_0x2483af['options']?_0x2483af['options'][_0xa776('0x1d')]||null:null,'limit':_0x2483af[_0xa776('0x1b')]?_0x2483af[_0xa776('0x1b')][_0xa776('0x1e')]||null:null,'include':_0x2483af[_0xa776('0x1b')]?_0x2483af[_0xa776('0x1b')][_0xa776('0x1f')]?_[_0xa776('0x20')](_0x2483af[_0xa776('0x1b')]['include'],function(_0x1de6a1){return{'model':db[_0x1de6a1[_0xa776('0x21')]],'as':_0x1de6a1['as'],'attributes':_0x1de6a1[_0xa776('0x1d')],'include':_0x1de6a1[_0xa776('0x1f')]?_['map'](_0x1de6a1['include'],function(_0x8be8b0){return{'model':db[_0x8be8b0[_0xa776('0x21')]],'as':_0x8be8b0['as'],'attributes':_0x8be8b0[_0xa776('0x1d')],'include':_0x8be8b0[_0xa776('0x1f')]?_['map'](_0x8be8b0[_0xa776('0x1f')],function(_0x4a1f0a){return{'model':db[_0x4a1f0a[_0xa776('0x21')]],'as':_0x4a1f0a['as'],'attributes':_0x4a1f0a[_0xa776('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa776('0x22')](function(_0x35222d){logger[_0xa776('0x14')](_0xa776('0x18'),_0x2483af);logger[_0xa776('0x10')](_0xa776('0x18'),_0x2483af,JSON['stringify'](_0x35222d));_0x35b37c(_0x35222d);})[_0xa776('0x17')](function(_0x2de4dc){logger['error'](_0xa776('0x18'),_0x2de4dc[_0xa776('0x13')],_0x2483af);_0x107e4c(_0x91f2cf['error'](0x1f4,_0x2de4dc[_0xa776('0x13')]));});});};exports[_0xa776('0x23')]=function(_0x99da7c){var _0x2322bd=this;return new Promise(function(_0x5ec6cf,_0x8533e7){return db[_0xa776('0x19')][_0xa776('0x24')]({'raw':_0x99da7c['options']?_0x99da7c[_0xa776('0x1b')][_0xa776('0x1c')]===undefined?!![]:![]:!![],'where':_0x99da7c[_0xa776('0x1b')]?_0x99da7c[_0xa776('0x1b')][_0xa776('0x25')]||null:null,'attributes':_0x99da7c['options']?_0x99da7c[_0xa776('0x1b')][_0xa776('0x1d')]||null:null,'include':_0x99da7c[_0xa776('0x1b')]?_0x99da7c[_0xa776('0x1b')][_0xa776('0x1f')]?_[_0xa776('0x20')](_0x99da7c['options']['include'],function(_0x5c485f){return{'model':db[_0x5c485f[_0xa776('0x21')]],'as':_0x5c485f['as'],'attributes':_0x5c485f[_0xa776('0x1d')],'include':_0x5c485f['include']?_[_0xa776('0x20')](_0x5c485f[_0xa776('0x1f')],function(_0x341462){return{'model':db[_0x341462[_0xa776('0x21')]],'as':_0x341462['as'],'attributes':_0x341462['attributes'],'include':_0x341462[_0xa776('0x1f')]?_['map'](_0x341462['include'],function(_0xc3953b){return{'model':db[_0xc3953b['model']],'as':_0xc3953b['as'],'attributes':_0xc3953b[_0xa776('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa776('0x22')](function(_0x58e4c){logger['info'](_0xa776('0x23'),_0x99da7c);logger[_0xa776('0x10')](_0xa776('0x23'),_0x99da7c,JSON[_0xa776('0x26')](_0x58e4c));_0x5ec6cf(_0x58e4c);})[_0xa776('0x17')](function(_0x2106a8){logger[_0xa776('0x12')](_0xa776('0x23'),_0x2106a8[_0xa776('0x13')],_0x99da7c);_0x8533e7(_0x2322bd['error'](0x1f4,_0x2106a8[_0xa776('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index a37b772..4dba534 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 _0xbd46=['register','faxQueue:','remove','update','emit','removeListener'];(function(_0x2307a5,_0xe3e696){var _0x226b93=function(_0x23cc94){while(--_0x23cc94){_0x2307a5['push'](_0x2307a5['shift']());}};_0x226b93(++_0xe3e696);}(_0xbd46,0x17c));var _0x6bd4=function(_0xcf581b,_0x4359dd){_0xcf581b=_0xcf581b-0x0;var _0x4f454d=_0xbd46[_0xcf581b];return _0x4f454d;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save',_0x6bd4('0x0'),_0x6bd4('0x1')];function createListener(_0x446a77,_0x4ad66a){return function(_0x5c7da5){_0x4ad66a[_0x6bd4('0x2')](_0x446a77,_0x5c7da5);};}function removeListener(_0x2410dd,_0x173c2e){return function(){FaxQueueEvents[_0x6bd4('0x3')](_0x2410dd,_0x173c2e);};}exports[_0x6bd4('0x4')]=function(_0x9206){for(var _0x2015d2=0x0,_0x12d3ba=events['length'];_0x2015d2<_0x12d3ba;_0x2015d2++){var _0x59c81a=events[_0x2015d2];var _0x16e6e6=createListener(_0x6bd4('0x5')+_0x59c81a,_0x9206);FaxQueueEvents['on'](_0x59c81a,_0x16e6e6);}}; \ No newline at end of file +var _0x975f=['length','faxQueue:','./faxQueue.events','save','remove','emit','removeListener','register'];(function(_0x45795e,_0x12a849){var _0x10b5c3=function(_0x393eea){while(--_0x393eea){_0x45795e['push'](_0x45795e['shift']());}};_0x10b5c3(++_0x12a849);}(_0x975f,0x82));var _0xf975=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0x975f[_0x3c4f1f];return _0x19cb69;};'use strict';var FaxQueueEvents=require(_0xf975('0x0'));var events=[_0xf975('0x1'),_0xf975('0x2'),'update'];function createListener(_0x5a1e91,_0x280a3f){return function(_0x3b2d75){_0x280a3f[_0xf975('0x3')](_0x5a1e91,_0x3b2d75);};}function removeListener(_0x5c0df7,_0x357579){return function(){FaxQueueEvents[_0xf975('0x4')](_0x5c0df7,_0x357579);};}exports[_0xf975('0x5')]=function(_0x36afed){for(var _0x384fde=0x0,_0x4363fc=events[_0xf975('0x6')];_0x384fde<_0x4363fc;_0x384fde++){var _0x147dac=events[_0x384fde];var _0x1148f1=createListener(_0xf975('0x7')+_0x147dac,_0x36afed);FaxQueueEvents['on'](_0x147dac,_0x1148f1);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 8c6b7b9..be7f261 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 _0x97cd=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','post','/:id/users','addAgents','update','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x58fbb7,_0x3174c3){var _0x5a62fc=function(_0x4fb7c7){while(--_0x4fb7c7){_0x58fbb7['push'](_0x58fbb7['shift']());}};_0x5a62fc(++_0x3174c3);}(_0x97cd,0x1e9));var _0xd97c=function(_0xac9294,_0x2544cc){_0xac9294=_0xac9294-0x0;var _0x399e0e=_0x97cd[_0xac9294];return _0x399e0e;};'use strict';var multer=require(_0xd97c('0x0'));var util=require(_0xd97c('0x1'));var path=require(_0xd97c('0x2'));var timeout=require(_0xd97c('0x3'));var express=require(_0xd97c('0x4'));var router=express[_0xd97c('0x5')]();var fs_extra=require(_0xd97c('0x6'));var auth=require(_0xd97c('0x7'));var interaction=require(_0xd97c('0x8'));var config=require(_0xd97c('0x9'));var controller=require(_0xd97c('0xa'));router[_0xd97c('0xb')]('/',auth[_0xd97c('0xc')](),controller['index']);router[_0xd97c('0xb')](_0xd97c('0xd'),auth[_0xd97c('0xc')](),controller[_0xd97c('0xe')]);router[_0xd97c('0xb')](_0xd97c('0xf'),auth[_0xd97c('0xc')](),controller[_0xd97c('0x10')]);router[_0xd97c('0xb')](_0xd97c('0x11'),auth[_0xd97c('0xc')](),controller[_0xd97c('0x12')]);router['get'](_0xd97c('0x13'),auth['isAuthenticated'](),controller[_0xd97c('0x14')]);router[_0xd97c('0xb')]('/:id/users',auth[_0xd97c('0xc')](),controller['getAgents']);router[_0xd97c('0x15')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xd97c('0x13'),auth[_0xd97c('0xc')](),controller['addTeams']);router['post'](_0xd97c('0x16'),auth['isAuthenticated'](),controller[_0xd97c('0x17')]);router['put']('/:id',auth[_0xd97c('0xc')](),controller[_0xd97c('0x18')]);router['delete'](_0xd97c('0xf'),auth[_0xd97c('0xc')](),controller[_0xd97c('0x19')]);router['delete']('/:id/teams',auth[_0xd97c('0xc')](),controller[_0xd97c('0x1a')]);router['delete'](_0xd97c('0x16'),auth[_0xd97c('0xc')](),controller[_0xd97c('0x1b')]);module[_0xd97c('0x1c')]=router; \ No newline at end of file +var _0x32ed=['/:id/teams','removeTeams','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/users','post','create','addTeams','addAgents','put','delete'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x32ed,0x13b));var _0xd32e=function(_0x360f55,_0x25658c){_0x360f55=_0x360f55-0x0;var _0x3fa3ec=_0x32ed[_0x360f55];return _0x3fa3ec;};'use strict';var multer=require('multer');var util=require(_0xd32e('0x0'));var path=require('path');var timeout=require(_0xd32e('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd32e('0x2'));var auth=require(_0xd32e('0x3'));var interaction=require(_0xd32e('0x4'));var config=require(_0xd32e('0x5'));var controller=require('./faxQueue.controller');router[_0xd32e('0x6')]('/',auth[_0xd32e('0x7')](),controller[_0xd32e('0x8')]);router[_0xd32e('0x6')]('/describe',auth[_0xd32e('0x7')](),controller[_0xd32e('0x9')]);router[_0xd32e('0x6')](_0xd32e('0xa'),auth[_0xd32e('0x7')](),controller[_0xd32e('0xb')]);router[_0xd32e('0x6')](_0xd32e('0xc'),auth['isAuthenticated'](),controller[_0xd32e('0xd')]);router[_0xd32e('0x6')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0xd32e('0x6')](_0xd32e('0xe'),auth[_0xd32e('0x7')](),controller['getAgents']);router[_0xd32e('0xf')]('/',auth[_0xd32e('0x7')](),controller[_0xd32e('0x10')]);router[_0xd32e('0xf')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd32e('0x11')]);router[_0xd32e('0xf')](_0xd32e('0xe'),auth[_0xd32e('0x7')](),controller[_0xd32e('0x12')]);router[_0xd32e('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd32e('0x14')](_0xd32e('0xa'),auth[_0xd32e('0x7')](),controller['destroy']);router[_0xd32e('0x14')](_0xd32e('0x15'),auth[_0xd32e('0x7')](),controller[_0xd32e('0x16')]);router[_0xd32e('0x14')](_0xd32e('0xe'),auth[_0xd32e('0x7')](),controller['removeAgents']);module[_0xd32e('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 75ce8cd..d011fde 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 _0x7983=['moment','sequelize','STRING','DATE'];(function(_0x4bcf38,_0x3c12be){var _0x4a89be=function(_0x3215a6){while(--_0x3215a6){_0x4bcf38['push'](_0x4bcf38['shift']());}};_0x4a89be(++_0x3c12be);}(_0x7983,0x88));var _0x3798=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x7983[_0x8c43de];return _0xa6591b;};'use strict';var moment=require(_0x3798('0x0'));var Sequelize=require(_0x3798('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x3798('0x2')]},'joinAt':{'type':Sequelize[_0x3798('0x3')]},'leaveAt':{'type':Sequelize[_0x3798('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x3798('0x2')]}}; \ No newline at end of file +var _0xb16c=['STRING','DATE','moment','sequelize','exports'];(function(_0x37bd96,_0x4a6212){var _0x5dc6f8=function(_0x56ff80){while(--_0x56ff80){_0x37bd96['push'](_0x37bd96['shift']());}};_0x5dc6f8(++_0x4a6212);}(_0xb16c,0x151));var _0xcb16=function(_0x159cef,_0x256b08){_0x159cef=_0x159cef-0x0;var _0x3f1480=_0xb16c[_0x159cef];return _0x3f1480;};'use strict';var moment=require(_0xcb16('0x0'));var Sequelize=require(_0xcb16('0x1'));module[_0xcb16('0x2')]={'uniqueid':{'type':Sequelize[_0xcb16('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xcb16('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xcb16('0x4')]},'acceptAt':{'type':Sequelize[_0xcb16('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xcb16('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 05bee54..6744c24 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 _0xb10b=['include','findAll','rows','catch','model','keys','find','create','body','describe','eml-format','zip-dir','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','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','name','index','FaxQueueReport','rawAttributes','fieldName','type','key','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll'];(function(_0x546ab6,_0x357f23){var _0x3952ca=function(_0x29dcfa){while(--_0x29dcfa){_0x546ab6['push'](_0x546ab6['shift']());}};_0x3952ca(++_0x357f23);}(_0xb10b,0x12a));var _0xbb10=function(_0x4fa97c,_0x4aa6ab){_0x4fa97c=_0x4fa97c-0x0;var _0x518c7f=_0xb10b[_0x4fa97c];return _0x518c7f;};'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=_0x36b5e8[_0xbb10('0x1b')],_0x2b184e=_0x24a57b[_0xbb10('0x1c')],_0x4a2bfc=_0x24a57b[_0xbb10('0x1c')]+_0x24a57b[_0xbb10('0x1d')],_0x2eca0f;if(_0x4a2bfc>=_0x3e26f4){_0x4a2bfc=_0x3e26f4;_0x2eca0f=0xc8;}else{_0x2eca0f=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x2eca0f);return _0x2f2ebf[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x2b184e+'-'+_0x4a2bfc+'/'+_0x3e26f4)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xe1c665){return function(_0x48b6e9){try{jsonpatch[_0xbb10('0x20')](_0x48b6e9,_0xe1c665,!![]);}catch(_0x19f48d){return BPromise[_0xbb10('0x21')](_0x19f48d);}return _0x48b6e9[_0xbb10('0x22')]();};}function saveUpdates(_0xdf237d,_0x44e563){return function(_0x4deb49){if(_0x4deb49){return _0x4deb49[_0xbb10('0x23')](_0xdf237d)[_0xbb10('0x24')](function(_0x50aea1){return _0x50aea1;});}return null;};}function removeEntity(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x25')]()[_0xbb10('0x24')](function(){_0x4c4b0d[_0xbb10('0x19')](0xcc)[_0xbb10('0x26')]();});}};}function handleEntityNotFound(_0x407cb4,_0x436104){return function(_0x7f2377){if(!_0x7f2377){_0x407cb4[_0xbb10('0x18')](0x194);}return _0x7f2377;};}function handleError(_0x3ba6cd,_0x26ad93){_0x26ad93=_0x26ad93||0x1f4;return function(_0x537898){logger['error'](_0x537898['stack']);if(_0x537898[_0xbb10('0x27')]){delete _0x537898[_0xbb10('0x27')];}_0x3ba6cd[_0xbb10('0x19')](_0x26ad93)['send'](_0x537898);};}exports[_0xbb10('0x28')]=function(_0x24d586,_0x6ed43b){var _0x1d5e95={},_0x1acce9={},_0x20d946={'count':0x0,'rows':[]};var _0x2a0e8b=_['map'](db[_0xbb10('0x29')][_0xbb10('0x2a')],function(_0xfc3595){return{'name':_0xfc3595[_0xbb10('0x2b')],'type':_0xfc3595[_0xbb10('0x2c')][_0xbb10('0x2d')]};});_0x1acce9['model']=_[_0xbb10('0x2e')](_0x2a0e8b,'name');_0x1acce9[_0xbb10('0x2f')]=_['keys'](_0x24d586[_0xbb10('0x2f')]);_0x1acce9[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x1acce9['model'],_0x1acce9['query']);_0x1d5e95[_0xbb10('0x32')]=_[_0xbb10('0x31')](_0x1acce9['model'],qs[_0xbb10('0x33')](_0x24d586[_0xbb10('0x2f')][_0xbb10('0x33')]));_0x1d5e95[_0xbb10('0x32')]=_0x1d5e95[_0xbb10('0x32')][_0xbb10('0x34')]?_0x1d5e95[_0xbb10('0x32')]:_0x1acce9['model'];if(!_0x24d586[_0xbb10('0x2f')][_0xbb10('0x35')](_0xbb10('0x36'))){_0x1d5e95[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x24d586[_0xbb10('0x2f')][_0xbb10('0x1d')]);_0x1d5e95[_0xbb10('0x1c')]=qs[_0xbb10('0x1c')](_0x24d586['query'][_0xbb10('0x1c')]);}_0x1d5e95[_0xbb10('0x37')]=qs[_0xbb10('0x38')](_0x24d586[_0xbb10('0x2f')]['sort']);_0x1d5e95[_0xbb10('0x39')]=qs['filters'](_['pick'](_0x24d586[_0xbb10('0x2f')],_0x1acce9[_0xbb10('0x30')]),_0x2a0e8b);if(_0x24d586[_0xbb10('0x2f')][_0xbb10('0x3a')]){_0x1d5e95[_0xbb10('0x39')]=_[_0xbb10('0x3b')](_0x1d5e95['where'],{'$or':_[_0xbb10('0x2e')](_0x2a0e8b,function(_0x25d72f){if(_0x25d72f['type']!=='VIRTUAL'){var _0x5cd55f={};_0x5cd55f[_0x25d72f[_0xbb10('0x27')]]={'$like':'%'+_0x24d586[_0xbb10('0x2f')][_0xbb10('0x3a')]+'%'};return _0x5cd55f;}})});}_0x1d5e95=_['merge']({},_0x1d5e95,_0x24d586[_0xbb10('0x3c')]);var _0x3e8538={'where':_0x1d5e95[_0xbb10('0x39')]};return db['FaxQueueReport'][_0xbb10('0x1b')](_0x3e8538)[_0xbb10('0x24')](function(_0x1dcd38){_0x20d946[_0xbb10('0x1b')]=_0x1dcd38;if(_0x24d586['query'][_0xbb10('0x3d')]){_0x1d5e95[_0xbb10('0x3e')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xbb10('0x3f')](_0x1d5e95);})[_0xbb10('0x24')](function(_0x44d6ae){_0x20d946[_0xbb10('0x40')]=_0x44d6ae;return _0x20d946;})[_0xbb10('0x24')](respondWithFilteredResult(_0x6ed43b,_0x1d5e95))[_0xbb10('0x41')](handleError(_0x6ed43b,null));};exports['show']=function(_0x1e8f79,_0x1c7fae){var _0x3e7b4c={'raw':!![],'where':{'id':_0x1e8f79['params']['id']}},_0x3d3c41={};_0x3d3c41[_0xbb10('0x42')]=_[_0xbb10('0x43')](db[_0xbb10('0x29')][_0xbb10('0x2a')]);_0x3d3c41['query']=_[_0xbb10('0x43')](_0x1e8f79[_0xbb10('0x2f')]);_0x3d3c41['filters']=_['intersection'](_0x3d3c41[_0xbb10('0x42')],_0x3d3c41['query']);_0x3e7b4c[_0xbb10('0x32')]=_[_0xbb10('0x31')](_0x3d3c41['model'],qs[_0xbb10('0x33')](_0x1e8f79[_0xbb10('0x2f')][_0xbb10('0x33')]));_0x3e7b4c['attributes']=_0x3e7b4c[_0xbb10('0x32')][_0xbb10('0x34')]?_0x3e7b4c[_0xbb10('0x32')]:_0x3d3c41[_0xbb10('0x42')];if(_0x1e8f79[_0xbb10('0x2f')][_0xbb10('0x3d')]){_0x3e7b4c[_0xbb10('0x3e')]=[{'all':!![]}];}_0x3e7b4c=_[_0xbb10('0x3b')]({},_0x3e7b4c,_0x1e8f79[_0xbb10('0x3c')]);return db[_0xbb10('0x29')][_0xbb10('0x44')](_0x3e7b4c)[_0xbb10('0x24')](handleEntityNotFound(_0x1c7fae,null))['then'](respondWithResult(_0x1c7fae,null))[_0xbb10('0x41')](handleError(_0x1c7fae,null));};exports[_0xbb10('0x45')]=function(_0x4a1248,_0x14e1cb){return db[_0xbb10('0x29')][_0xbb10('0x45')](_0x4a1248[_0xbb10('0x46')],{})[_0xbb10('0x24')](respondWithResult(_0x14e1cb,0xc9))[_0xbb10('0x41')](handleError(_0x14e1cb,null));};exports[_0xbb10('0x23')]=function(_0x5be85e,_0x4a9793){if(_0x5be85e[_0xbb10('0x46')]['id']){delete _0x5be85e[_0xbb10('0x46')]['id'];}return db[_0xbb10('0x29')]['find']({'where':{'id':_0x5be85e['params']['id']}})[_0xbb10('0x24')](handleEntityNotFound(_0x4a9793,null))[_0xbb10('0x24')](saveUpdates(_0x5be85e[_0xbb10('0x46')],null))[_0xbb10('0x24')](respondWithResult(_0x4a9793,null))[_0xbb10('0x41')](handleError(_0x4a9793,null));};exports[_0xbb10('0x25')]=function(_0x2f2552,_0x460788){return db[_0xbb10('0x29')][_0xbb10('0x44')]({'where':{'id':_0x2f2552['params']['id']}})['then'](handleEntityNotFound(_0x460788,null))[_0xbb10('0x24')](removeEntity(_0x460788,null))[_0xbb10('0x41')](handleError(_0x460788,null));};exports[_0xbb10('0x47')]=function(_0xb014b0,_0x36aa7d){return db[_0xbb10('0x29')][_0xbb10('0x47')]()[_0xbb10('0x24')](respondWithResult(_0x36aa7d,null))[_0xbb10('0x41')](handleError(_0x36aa7d,null));}; \ No newline at end of file +var _0xb10b=['include','findAll','rows','catch','model','keys','find','create','body','describe','eml-format','zip-dir','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','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','name','index','FaxQueueReport','rawAttributes','fieldName','type','key','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll'];(function(_0x1485a8,_0x11677e){var _0x23bcc7=function(_0xc46720){while(--_0xc46720){_0x1485a8['push'](_0x1485a8['shift']());}};_0x23bcc7(++_0x11677e);}(_0xb10b,0x12a));var _0xbb10=function(_0x497880,_0x430dbc){_0x497880=_0x497880-0x0;var _0x1a3d4b=_0xb10b[_0x497880];return _0x1a3d4b;};'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=_0x36b5e8[_0xbb10('0x1b')],_0x2b184e=_0x24a57b[_0xbb10('0x1c')],_0x4a2bfc=_0x24a57b[_0xbb10('0x1c')]+_0x24a57b[_0xbb10('0x1d')],_0x2eca0f;if(_0x4a2bfc>=_0x3e26f4){_0x4a2bfc=_0x3e26f4;_0x2eca0f=0xc8;}else{_0x2eca0f=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x2eca0f);return _0x2f2ebf[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x2b184e+'-'+_0x4a2bfc+'/'+_0x3e26f4)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xe1c665){return function(_0x48b6e9){try{jsonpatch[_0xbb10('0x20')](_0x48b6e9,_0xe1c665,!![]);}catch(_0x19f48d){return BPromise[_0xbb10('0x21')](_0x19f48d);}return _0x48b6e9[_0xbb10('0x22')]();};}function saveUpdates(_0xdf237d,_0x44e563){return function(_0x4deb49){if(_0x4deb49){return _0x4deb49[_0xbb10('0x23')](_0xdf237d)[_0xbb10('0x24')](function(_0x50aea1){return _0x50aea1;});}return null;};}function removeEntity(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x25')]()[_0xbb10('0x24')](function(){_0x4c4b0d[_0xbb10('0x19')](0xcc)[_0xbb10('0x26')]();});}};}function handleEntityNotFound(_0x407cb4,_0x436104){return function(_0x7f2377){if(!_0x7f2377){_0x407cb4[_0xbb10('0x18')](0x194);}return _0x7f2377;};}function handleError(_0x3ba6cd,_0x26ad93){_0x26ad93=_0x26ad93||0x1f4;return function(_0x537898){logger['error'](_0x537898['stack']);if(_0x537898[_0xbb10('0x27')]){delete _0x537898[_0xbb10('0x27')];}_0x3ba6cd[_0xbb10('0x19')](_0x26ad93)['send'](_0x537898);};}exports[_0xbb10('0x28')]=function(_0x24d586,_0x6ed43b){var _0x1d5e95={},_0x1acce9={},_0x20d946={'count':0x0,'rows':[]};var _0x2a0e8b=_['map'](db[_0xbb10('0x29')][_0xbb10('0x2a')],function(_0xfc3595){return{'name':_0xfc3595[_0xbb10('0x2b')],'type':_0xfc3595[_0xbb10('0x2c')][_0xbb10('0x2d')]};});_0x1acce9['model']=_[_0xbb10('0x2e')](_0x2a0e8b,'name');_0x1acce9[_0xbb10('0x2f')]=_['keys'](_0x24d586[_0xbb10('0x2f')]);_0x1acce9[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x1acce9['model'],_0x1acce9['query']);_0x1d5e95[_0xbb10('0x32')]=_[_0xbb10('0x31')](_0x1acce9['model'],qs[_0xbb10('0x33')](_0x24d586[_0xbb10('0x2f')][_0xbb10('0x33')]));_0x1d5e95[_0xbb10('0x32')]=_0x1d5e95[_0xbb10('0x32')][_0xbb10('0x34')]?_0x1d5e95[_0xbb10('0x32')]:_0x1acce9['model'];if(!_0x24d586[_0xbb10('0x2f')][_0xbb10('0x35')](_0xbb10('0x36'))){_0x1d5e95[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x24d586[_0xbb10('0x2f')][_0xbb10('0x1d')]);_0x1d5e95[_0xbb10('0x1c')]=qs[_0xbb10('0x1c')](_0x24d586['query'][_0xbb10('0x1c')]);}_0x1d5e95[_0xbb10('0x37')]=qs[_0xbb10('0x38')](_0x24d586[_0xbb10('0x2f')]['sort']);_0x1d5e95[_0xbb10('0x39')]=qs['filters'](_['pick'](_0x24d586[_0xbb10('0x2f')],_0x1acce9[_0xbb10('0x30')]),_0x2a0e8b);if(_0x24d586[_0xbb10('0x2f')][_0xbb10('0x3a')]){_0x1d5e95[_0xbb10('0x39')]=_[_0xbb10('0x3b')](_0x1d5e95['where'],{'$or':_[_0xbb10('0x2e')](_0x2a0e8b,function(_0x25d72f){if(_0x25d72f['type']!=='VIRTUAL'){var _0x5cd55f={};_0x5cd55f[_0x25d72f[_0xbb10('0x27')]]={'$like':'%'+_0x24d586[_0xbb10('0x2f')][_0xbb10('0x3a')]+'%'};return _0x5cd55f;}})});}_0x1d5e95=_['merge']({},_0x1d5e95,_0x24d586[_0xbb10('0x3c')]);var _0x3e8538={'where':_0x1d5e95[_0xbb10('0x39')]};return db['FaxQueueReport'][_0xbb10('0x1b')](_0x3e8538)[_0xbb10('0x24')](function(_0x1dcd38){_0x20d946[_0xbb10('0x1b')]=_0x1dcd38;if(_0x24d586['query'][_0xbb10('0x3d')]){_0x1d5e95[_0xbb10('0x3e')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xbb10('0x3f')](_0x1d5e95);})[_0xbb10('0x24')](function(_0x44d6ae){_0x20d946[_0xbb10('0x40')]=_0x44d6ae;return _0x20d946;})[_0xbb10('0x24')](respondWithFilteredResult(_0x6ed43b,_0x1d5e95))[_0xbb10('0x41')](handleError(_0x6ed43b,null));};exports['show']=function(_0x1e8f79,_0x1c7fae){var _0x3e7b4c={'raw':!![],'where':{'id':_0x1e8f79['params']['id']}},_0x3d3c41={};_0x3d3c41[_0xbb10('0x42')]=_[_0xbb10('0x43')](db[_0xbb10('0x29')][_0xbb10('0x2a')]);_0x3d3c41['query']=_[_0xbb10('0x43')](_0x1e8f79[_0xbb10('0x2f')]);_0x3d3c41['filters']=_['intersection'](_0x3d3c41[_0xbb10('0x42')],_0x3d3c41['query']);_0x3e7b4c[_0xbb10('0x32')]=_[_0xbb10('0x31')](_0x3d3c41['model'],qs[_0xbb10('0x33')](_0x1e8f79[_0xbb10('0x2f')][_0xbb10('0x33')]));_0x3e7b4c['attributes']=_0x3e7b4c[_0xbb10('0x32')][_0xbb10('0x34')]?_0x3e7b4c[_0xbb10('0x32')]:_0x3d3c41[_0xbb10('0x42')];if(_0x1e8f79[_0xbb10('0x2f')][_0xbb10('0x3d')]){_0x3e7b4c[_0xbb10('0x3e')]=[{'all':!![]}];}_0x3e7b4c=_[_0xbb10('0x3b')]({},_0x3e7b4c,_0x1e8f79[_0xbb10('0x3c')]);return db[_0xbb10('0x29')][_0xbb10('0x44')](_0x3e7b4c)[_0xbb10('0x24')](handleEntityNotFound(_0x1c7fae,null))['then'](respondWithResult(_0x1c7fae,null))[_0xbb10('0x41')](handleError(_0x1c7fae,null));};exports[_0xbb10('0x45')]=function(_0x4a1248,_0x14e1cb){return db[_0xbb10('0x29')][_0xbb10('0x45')](_0x4a1248[_0xbb10('0x46')],{})[_0xbb10('0x24')](respondWithResult(_0x14e1cb,0xc9))[_0xbb10('0x41')](handleError(_0x14e1cb,null));};exports[_0xbb10('0x23')]=function(_0x5be85e,_0x4a9793){if(_0x5be85e[_0xbb10('0x46')]['id']){delete _0x5be85e[_0xbb10('0x46')]['id'];}return db[_0xbb10('0x29')]['find']({'where':{'id':_0x5be85e['params']['id']}})[_0xbb10('0x24')](handleEntityNotFound(_0x4a9793,null))[_0xbb10('0x24')](saveUpdates(_0x5be85e[_0xbb10('0x46')],null))[_0xbb10('0x24')](respondWithResult(_0x4a9793,null))[_0xbb10('0x41')](handleError(_0x4a9793,null));};exports[_0xbb10('0x25')]=function(_0x2f2552,_0x460788){return db[_0xbb10('0x29')][_0xbb10('0x44')]({'where':{'id':_0x2f2552['params']['id']}})['then'](handleEntityNotFound(_0x460788,null))[_0xbb10('0x24')](removeEntity(_0x460788,null))[_0xbb10('0x41')](handleError(_0x460788,null));};exports[_0xbb10('0x47')]=function(_0xb014b0,_0x36aa7d){return db[_0xbb10('0x29')][_0xbb10('0x47')]()[_0xbb10('0x24')](respondWithResult(_0x36aa7d,null))[_0xbb10('0x41')](handleError(_0x36aa7d,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 5e63a1a..0aefe75 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 _0x5784=['define','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./faxQueueReport.attributes','exports'];(function(_0x304141,_0x19ae89){var _0x49118d=function(_0x1a2711){while(--_0x1a2711){_0x304141['push'](_0x304141['shift']());}};_0x49118d(++_0x19ae89);}(_0x5784,0xd6));var _0x4578=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5784[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x4578('0x0'));var util=require(_0x4578('0x1'));var logger=require('../../config/logger')(_0x4578('0x2'));var moment=require(_0x4578('0x3'));var BPromise=require(_0x4578('0x4'));var rp=require(_0x4578('0x5'));var fs=require('fs');var path=require(_0x4578('0x6'));var rimraf=require(_0x4578('0x7'));var config=require('../../config/environment');var attributes=require(_0x4578('0x8'));module[_0x4578('0x9')]=function(_0x287059,_0x393c5f){return _0x287059[_0x4578('0xa')](_0x4578('0xb'),attributes,{'tableName':_0x4578('0xc'),'paranoid':![],'indexes':[{'name':_0x4578('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa29e=['request-promise','rimraf','../../config/environment','exports','define','FaxQueueReport','uniqueid','util','../../config/logger','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa29e,0x10f));var _0xea29=function(_0x57b443,_0x5145b4){_0x57b443=_0x57b443-0x0;var _0x1a763d=_0xa29e[_0x57b443];return _0x1a763d;};'use strict';var _=require('lodash');var util=require(_0xea29('0x0'));var logger=require(_0xea29('0x1'))('api');var moment=require(_0xea29('0x2'));var BPromise=require(_0xea29('0x3'));var rp=require(_0xea29('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea29('0x5'));var config=require(_0xea29('0x6'));var attributes=require('./faxQueueReport.attributes');module[_0xea29('0x7')]=function(_0x22036b,_0x2576bf){return _0x22036b[_0xea29('0x8')](_0xea29('0x9'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xea29('0xa'),'fields':[_0xea29('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 25bcf40..c16f736 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 _0x6ba7=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','create','body','options','raw','debug','UpdateFaxQueueReport','FaxQueueReport','update','limit','util','moment','bluebird'];(function(_0x2787e0,_0x42bb77){var _0x4f34a3=function(_0x551e1c){while(--_0x551e1c){_0x2787e0['push'](_0x2787e0['shift']());}};_0x4f34a3(++_0x42bb77);}(_0x6ba7,0x105));var _0x76ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ba7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x76ba('0x0'));var moment=require(_0x76ba('0x1'));var BPromise=require(_0x76ba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x76ba('0x3'));var db=require(_0x76ba('0x4'))['db'];var utils=require(_0x76ba('0x5'));var logger=require(_0x76ba('0x6'))('rpc');var config=require(_0x76ba('0x7'));var jayson=require(_0x76ba('0x8'));var client=jayson[_0x76ba('0x9')][_0x76ba('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30a4cb,_0x550fc2,_0x5cf07a){return new BPromise(function(_0x168e38,_0x26d718){return client[_0x76ba('0xb')](_0x30a4cb,_0x5cf07a)[_0x76ba('0xc')](function(_0x209d4d){logger[_0x76ba('0xd')](_0x76ba('0xe'),_0x550fc2,_0x76ba('0xf'));logger['debug'](_0x76ba('0x10'),_0x550fc2,_0x76ba('0xf'),JSON[_0x76ba('0x11')](_0x209d4d));if(_0x209d4d[_0x76ba('0x12')]){if(_0x209d4d[_0x76ba('0x12')][_0x76ba('0x13')]===0x1f4){logger['error'](_0x76ba('0xe'),_0x550fc2,_0x209d4d['error'][_0x76ba('0x14')]);return _0x26d718(_0x209d4d['error'][_0x76ba('0x14')]);}logger[_0x76ba('0x12')](_0x76ba('0xe'),_0x550fc2,_0x209d4d[_0x76ba('0x12')]['message']);return _0x168e38(_0x209d4d[_0x76ba('0x12')][_0x76ba('0x14')]);}else{logger[_0x76ba('0xd')](_0x76ba('0xe'),_0x550fc2,_0x76ba('0xf'));_0x168e38(_0x209d4d[_0x76ba('0x15')][_0x76ba('0x14')]);}})[_0x76ba('0x16')](function(_0x3fc051){logger[_0x76ba('0x12')](_0x76ba('0xe'),_0x550fc2,_0x3fc051);_0x26d718(_0x3fc051);});});}exports[_0x76ba('0x17')]=function(_0xbe009e){var _0xfb9ffb=this;return new Promise(function(_0x57af64,_0x1ee699){return db['FaxQueueReport'][_0x76ba('0x18')](_0xbe009e[_0x76ba('0x19')],{'raw':_0xbe009e[_0x76ba('0x1a')]?_0xbe009e['options'][_0x76ba('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x49c77e){logger[_0x76ba('0xd')](_0x76ba('0x17'),_0xbe009e);logger[_0x76ba('0x1c')](_0x76ba('0x17'),_0xbe009e,JSON[_0x76ba('0x11')](_0x49c77e));_0x57af64(_0x49c77e);})['catch'](function(_0x215d68){logger[_0x76ba('0x12')](_0x76ba('0x17'),_0x215d68[_0x76ba('0x14')],_0xbe009e);_0x1ee699(_0xfb9ffb[_0x76ba('0x12')](0x1f4,_0x215d68[_0x76ba('0x14')]));});});};exports[_0x76ba('0x1d')]=function(_0x2b456b){var _0x57b18d=this;return new Promise(function(_0x9dd965,_0x27d167){return db[_0x76ba('0x1e')][_0x76ba('0x1f')](_0x2b456b[_0x76ba('0x19')],{'raw':_0x2b456b[_0x76ba('0x1a')]?_0x2b456b[_0x76ba('0x1a')][_0x76ba('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b456b[_0x76ba('0x1a')]?_0x2b456b['options']['where']||null:null,'attributes':_0x2b456b[_0x76ba('0x1a')]?_0x2b456b[_0x76ba('0x1a')]['attributes']||null:null,'limit':_0x2b456b['options']?_0x2b456b[_0x76ba('0x1a')][_0x76ba('0x20')]||null:null})['then'](function(_0x5bc39a){logger[_0x76ba('0xd')](_0x76ba('0x1d'),_0x2b456b);logger[_0x76ba('0x1c')]('UpdateFaxQueueReport',_0x2b456b,JSON[_0x76ba('0x11')](_0x5bc39a));_0x9dd965(_0x5bc39a);})[_0x76ba('0x16')](function(_0x4e295d){logger[_0x76ba('0x12')](_0x76ba('0x1d'),_0x4e295d['message'],_0x2b456b);_0x27d167(_0x57b18d['error'](0x1f4,_0x4e295d[_0x76ba('0x14')]));});});}; \ No newline at end of file +var _0xea5d=['UpdateFaxQueueReport','update','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','CreateFaxQueueReport','FaxQueueReport','body','options','raw','catch'];(function(_0x187447,_0x229298){var _0x3cfd6a=function(_0x1b751f){while(--_0x1b751f){_0x187447['push'](_0x187447['shift']());}};_0x3cfd6a(++_0x229298);}(_0xea5d,0x1b6));var _0xdea5=function(_0x28c561,_0xa81339){_0x28c561=_0x28c561-0x0;var _0x5f0160=_0xea5d[_0x28c561];return _0x5f0160;};'use strict';var _=require(_0xdea5('0x0'));var util=require(_0xdea5('0x1'));var moment=require(_0xdea5('0x2'));var BPromise=require(_0xdea5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdea5('0x4'));var db=require(_0xdea5('0x5'))['db'];var utils=require(_0xdea5('0x6'));var logger=require(_0xdea5('0x7'))('rpc');var config=require(_0xdea5('0x8'));var jayson=require(_0xdea5('0x9'));var client=jayson[_0xdea5('0xa')][_0xdea5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c6a30,_0x47118e,_0xbfde8a){return new BPromise(function(_0x1423c8,_0x5d48c4){return client['request'](_0x2c6a30,_0xbfde8a)[_0xdea5('0xc')](function(_0x1209ac){logger[_0xdea5('0xd')](_0xdea5('0xe'),_0x47118e,_0xdea5('0xf'));logger[_0xdea5('0x10')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x47118e,_0xdea5('0xf'),JSON[_0xdea5('0x11')](_0x1209ac));if(_0x1209ac[_0xdea5('0x12')]){if(_0x1209ac[_0xdea5('0x12')][_0xdea5('0x13')]===0x1f4){logger[_0xdea5('0x12')](_0xdea5('0xe'),_0x47118e,_0x1209ac[_0xdea5('0x12')][_0xdea5('0x14')]);return _0x5d48c4(_0x1209ac['error'][_0xdea5('0x14')]);}logger[_0xdea5('0x12')](_0xdea5('0xe'),_0x47118e,_0x1209ac[_0xdea5('0x12')][_0xdea5('0x14')]);return _0x1423c8(_0x1209ac[_0xdea5('0x12')][_0xdea5('0x14')]);}else{logger[_0xdea5('0xd')](_0xdea5('0xe'),_0x47118e,_0xdea5('0xf'));_0x1423c8(_0x1209ac['result'][_0xdea5('0x14')]);}})['catch'](function(_0x2f5b78){logger[_0xdea5('0x12')](_0xdea5('0xe'),_0x47118e,_0x2f5b78);_0x5d48c4(_0x2f5b78);});});}exports[_0xdea5('0x15')]=function(_0x12d597){var _0x1b4fba=this;return new Promise(function(_0x22b000,_0xa03f07){return db[_0xdea5('0x16')]['create'](_0x12d597[_0xdea5('0x17')],{'raw':_0x12d597[_0xdea5('0x18')]?_0x12d597['options'][_0xdea5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1e5e3f){logger[_0xdea5('0xd')](_0xdea5('0x15'),_0x12d597);logger[_0xdea5('0x10')](_0xdea5('0x15'),_0x12d597,JSON[_0xdea5('0x11')](_0x1e5e3f));_0x22b000(_0x1e5e3f);})[_0xdea5('0x1a')](function(_0x1ffe5f){logger['error'](_0xdea5('0x15'),_0x1ffe5f[_0xdea5('0x14')],_0x12d597);_0xa03f07(_0x1b4fba['error'](0x1f4,_0x1ffe5f['message']));});});};exports[_0xdea5('0x1b')]=function(_0x225a8d){var _0x2a1a5c=this;return new Promise(function(_0x285af0,_0xb055da){return db[_0xdea5('0x16')][_0xdea5('0x1c')](_0x225a8d[_0xdea5('0x17')],{'raw':_0x225a8d['options']?_0x225a8d[_0xdea5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225a8d[_0xdea5('0x18')]?_0x225a8d['options'][_0xdea5('0x1d')]||null:null,'attributes':_0x225a8d['options']?_0x225a8d[_0xdea5('0x18')]['attributes']||null:null,'limit':_0x225a8d[_0xdea5('0x18')]?_0x225a8d['options'][_0xdea5('0x1e')]||null:null})['then'](function(_0x4793bc){logger[_0xdea5('0xd')](_0xdea5('0x1b'),_0x225a8d);logger[_0xdea5('0x10')](_0xdea5('0x1b'),_0x225a8d,JSON['stringify'](_0x4793bc));_0x285af0(_0x4793bc);})[_0xdea5('0x1a')](function(_0x3e1092){logger[_0xdea5('0x12')](_0xdea5('0x1b'),_0x3e1092[_0xdea5('0x14')],_0x225a8d);_0xb055da(_0x2a1a5c[_0xdea5('0x12')](0x1f4,_0x3e1092[_0xdea5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 5b674c9..e5717f4 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 _0x3fce=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','/describe','describe','/:id','show','post','update','destroy','exports'];(function(_0x1fee7e,_0x4ea03b){var _0xc69540=function(_0xa8389b){while(--_0xa8389b){_0x1fee7e['push'](_0x1fee7e['shift']());}};_0xc69540(++_0x4ea03b);}(_0x3fce,0x121));var _0xe3fc=function(_0x438434,_0x36f21f){_0x438434=_0x438434-0x0;var _0x3b97c9=_0x3fce[_0x438434];return _0x3b97c9;};'use strict';var multer=require('multer');var util=require(_0xe3fc('0x0'));var path=require(_0xe3fc('0x1'));var timeout=require(_0xe3fc('0x2'));var express=require(_0xe3fc('0x3'));var router=express[_0xe3fc('0x4')]();var fs_extra=require(_0xe3fc('0x5'));var auth=require(_0xe3fc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0xe3fc('0x7')](),controller[_0xe3fc('0x8')]);router['get'](_0xe3fc('0x9'),auth['isAuthenticated'](),controller[_0xe3fc('0xa')]);router['get'](_0xe3fc('0xb'),auth[_0xe3fc('0x7')](),controller[_0xe3fc('0xc')]);router[_0xe3fc('0xd')]('/',auth[_0xe3fc('0x7')](),controller['create']);router['put'](_0xe3fc('0xb'),auth[_0xe3fc('0x7')](),controller[_0xe3fc('0xe')]);router['delete'](_0xe3fc('0xb'),auth[_0xe3fc('0x7')](),controller[_0xe3fc('0xf')]);module[_0xe3fc('0x10')]=router; \ No newline at end of file +var _0xfba3=['exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update'];(function(_0x568981,_0x15d001){var _0x24422b=function(_0xc94952){while(--_0xc94952){_0x568981['push'](_0x568981['shift']());}};_0x24422b(++_0x15d001);}(_0xfba3,0x1dd));var _0x3fba=function(_0x3c340a,_0x1592fa){_0x3c340a=_0x3c340a-0x0;var _0x370e6e=_0xfba3[_0x3c340a];return _0x370e6e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3fba('0x0'));var timeout=require(_0x3fba('0x1'));var express=require(_0x3fba('0x2'));var router=express[_0x3fba('0x3')]();var fs_extra=require(_0x3fba('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3fba('0x5'));var config=require('../../config/environment');var controller=require(_0x3fba('0x6'));router[_0x3fba('0x7')]('/',auth[_0x3fba('0x8')](),controller[_0x3fba('0x9')]);router['get'](_0x3fba('0xa'),auth[_0x3fba('0x8')](),controller['describe']);router['get'](_0x3fba('0xb'),auth[_0x3fba('0x8')](),controller[_0x3fba('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3fba('0xd')]);router[_0x3fba('0xe')](_0x3fba('0xb'),auth[_0x3fba('0x8')](),controller[_0x3fba('0xf')]);router['delete'](_0x3fba('0xb'),auth[_0x3fba('0x8')](),controller['destroy']);module[_0x3fba('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index a648195..c07896a 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 _0xc585=['exports','STRING','ENUM','account','agent','queue','DATE','sequelize'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0xc585,0xff));var _0x5c58=function(_0x4736ca,_0x5a8c95){_0x4736ca=_0x4736ca-0x0;var _0x41feb7=_0xc585[_0x4736ca];return _0x41feb7;};'use strict';var moment=require('moment');var Sequelize=require(_0x5c58('0x0'));module[_0x5c58('0x1')]={'uniqueid':{'type':Sequelize[_0x5c58('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5c58('0x3')](_0x5c58('0x4'),_0x5c58('0x5'),_0x5c58('0x6')),'allowNull':![],'defaultValue':_0x5c58('0x6')},'transferredAt':{'type':Sequelize[_0x5c58('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x3e4d=['ENUM','agent','DATE','sequelize','STRING'];(function(_0x34c063,_0x11d3d7){var _0x2c63a3=function(_0x5983d0){while(--_0x5983d0){_0x34c063['push'](_0x34c063['shift']());}};_0x2c63a3(++_0x11d3d7);}(_0x3e4d,0x1a7));var _0xd3e4=function(_0x55cc78,_0x2ea423){_0x55cc78=_0x55cc78-0x0;var _0x389d77=_0x3e4d[_0x55cc78];return _0x389d77;};'use strict';var moment=require('moment');var Sequelize=require(_0xd3e4('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xd3e4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xd3e4('0x2')]('account',_0xd3e4('0x3'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xd3e4('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 14ddac2..043ab13 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 _0x2025=['crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','end','error','stack','name','send','FaxTransferReport','rawAttributes','key','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','params','length','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x5e19d6,_0x11a78e){var _0x42248a=function(_0x1c7b75){while(--_0x1c7b75){_0x5e19d6['push'](_0x5e19d6['shift']());}};_0x42248a(++_0x11a78e);}(_0x2025,0x88));var _0x5202=function(_0x1008c3,_0x4c60fe){_0x1008c3=_0x1008c3-0x0;var _0x3a850b=_0x2025[_0x1008c3];return _0x3a850b;};'use strict';var emlformat=require(_0x5202('0x0'));var rimraf=require(_0x5202('0x1'));var zipdir=require(_0x5202('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5202('0x3'));var moment=require(_0x5202('0x4'));var BPromise=require(_0x5202('0x5'));var Mustache=require(_0x5202('0x6'));var util=require(_0x5202('0x7'));var path=require(_0x5202('0x8'));var sox=require(_0x5202('0x9'));var csv=require(_0x5202('0xa'));var ejs=require(_0x5202('0xb'));var fs=require('fs');var fs_extra=require(_0x5202('0xc'));var _=require(_0x5202('0xd'));var squel=require('squel');var crypto=require(_0x5202('0xe'));var jsforce=require(_0x5202('0xf'));var deskjs=require(_0x5202('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5202('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5202('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5202('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5202('0x14'))(_0x5202('0x15'));var utils=require(_0x5202('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5202('0x17'));var db=require(_0x5202('0x18'))['db'];function respondWithStatusCode(_0x298ff0,_0xe4b3a7){_0xe4b3a7=_0xe4b3a7||0xcc;return function(_0x192baa){if(_0x192baa){return _0x298ff0[_0x5202('0x19')](_0xe4b3a7);}return _0x298ff0[_0x5202('0x1a')](_0xe4b3a7)['end']();};}function respondWithResult(_0x59c956,_0x13a3a2){_0x13a3a2=_0x13a3a2||0xc8;return function(_0x190e95){if(_0x190e95){return _0x59c956[_0x5202('0x1a')](_0x13a3a2)['json'](_0x190e95);}};}function respondWithFilteredResult(_0x5b0cba,_0x3c3d44){return function(_0x35151c){if(_0x35151c){var _0x35d408=_0x35151c[_0x5202('0x1b')],_0x1e51c0=_0x3c3d44[_0x5202('0x1c')],_0x372fb5=_0x3c3d44['offset']+_0x3c3d44[_0x5202('0x1d')],_0x2e2fdc;if(_0x372fb5>=_0x35d408){_0x372fb5=_0x35d408;_0x2e2fdc=0xc8;}else{_0x2e2fdc=0xce;}_0x5b0cba[_0x5202('0x1a')](_0x2e2fdc);return _0x5b0cba[_0x5202('0x1e')](_0x5202('0x1f'),_0x1e51c0+'-'+_0x372fb5+'/'+_0x35d408)[_0x5202('0x20')](_0x35151c);}return null;};}function patchUpdates(_0xea2e5d){return function(_0x5e4550){try{jsonpatch[_0x5202('0x21')](_0x5e4550,_0xea2e5d,!![]);}catch(_0x163bdb){return BPromise[_0x5202('0x22')](_0x163bdb);}return _0x5e4550[_0x5202('0x23')]();};}function saveUpdates(_0x510631,_0x42c5cc){return function(_0x37986b){if(_0x37986b){return _0x37986b['update'](_0x510631)[_0x5202('0x24')](function(_0x19966c){return _0x19966c;});}return null;};}function removeEntity(_0x3550f3,_0x389951){return function(_0x367145){if(_0x367145){return _0x367145[_0x5202('0x25')]()[_0x5202('0x24')](function(){_0x3550f3[_0x5202('0x1a')](0xcc)[_0x5202('0x26')]();});}};}function handleEntityNotFound(_0x437a2c,_0x1f287e){return function(_0x4328b9){if(!_0x4328b9){_0x437a2c[_0x5202('0x19')](0x194);}return _0x4328b9;};}function handleError(_0x44eddf,_0x15cfbe){_0x15cfbe=_0x15cfbe||0x1f4;return function(_0x357666){logger[_0x5202('0x27')](_0x357666[_0x5202('0x28')]);if(_0x357666['name']){delete _0x357666[_0x5202('0x29')];}_0x44eddf[_0x5202('0x1a')](_0x15cfbe)[_0x5202('0x2a')](_0x357666);};}exports['index']=function(_0x432a39,_0x3f036d){var _0x360cae={},_0xfab75e={},_0x12e5d7={'count':0x0,'rows':[]};var _0x141004=_['map'](db[_0x5202('0x2b')][_0x5202('0x2c')],function(_0x2e0a3e){return{'name':_0x2e0a3e['fieldName'],'type':_0x2e0a3e['type'][_0x5202('0x2d')]};});_0xfab75e[_0x5202('0x2e')]=_[_0x5202('0x2f')](_0x141004,'name');_0xfab75e['query']=_[_0x5202('0x30')](_0x432a39[_0x5202('0x31')]);_0xfab75e[_0x5202('0x32')]=_[_0x5202('0x33')](_0xfab75e[_0x5202('0x2e')],_0xfab75e['query']);_0x360cae['attributes']=_[_0x5202('0x33')](_0xfab75e['model'],qs['fields'](_0x432a39['query'][_0x5202('0x34')]));_0x360cae['attributes']=_0x360cae['attributes']['length']?_0x360cae[_0x5202('0x35')]:_0xfab75e[_0x5202('0x2e')];if(!_0x432a39[_0x5202('0x31')][_0x5202('0x36')](_0x5202('0x37'))){_0x360cae[_0x5202('0x1d')]=qs[_0x5202('0x1d')](_0x432a39[_0x5202('0x31')][_0x5202('0x1d')]);_0x360cae['offset']=qs[_0x5202('0x1c')](_0x432a39[_0x5202('0x31')][_0x5202('0x1c')]);}_0x360cae[_0x5202('0x38')]=qs[_0x5202('0x39')](_0x432a39[_0x5202('0x31')][_0x5202('0x39')]);_0x360cae['where']=qs[_0x5202('0x32')](_[_0x5202('0x3a')](_0x432a39[_0x5202('0x31')],_0xfab75e[_0x5202('0x32')]),_0x141004);if(_0x432a39[_0x5202('0x31')][_0x5202('0x3b')]){_0x360cae[_0x5202('0x3c')]=_[_0x5202('0x3d')](_0x360cae[_0x5202('0x3c')],{'$or':_[_0x5202('0x2f')](_0x141004,function(_0x40fe50){if(_0x40fe50[_0x5202('0x3e')]!==_0x5202('0x3f')){var _0x3b1256={};_0x3b1256[_0x40fe50['name']]={'$like':'%'+_0x432a39[_0x5202('0x31')][_0x5202('0x3b')]+'%'};return _0x3b1256;}})});}_0x360cae=_['merge']({},_0x360cae,_0x432a39[_0x5202('0x40')]);var _0xe04ddb={'where':_0x360cae[_0x5202('0x3c')]};return db[_0x5202('0x2b')]['count'](_0xe04ddb)[_0x5202('0x24')](function(_0x65fe78){_0x12e5d7[_0x5202('0x1b')]=_0x65fe78;if(_0x432a39[_0x5202('0x31')][_0x5202('0x41')]){_0x360cae[_0x5202('0x42')]=[{'all':!![]}];}return db[_0x5202('0x2b')]['findAll'](_0x360cae);})[_0x5202('0x24')](function(_0x3f6dc3){_0x12e5d7[_0x5202('0x43')]=_0x3f6dc3;return _0x12e5d7;})[_0x5202('0x24')](respondWithFilteredResult(_0x3f036d,_0x360cae))['catch'](handleError(_0x3f036d,null));};exports['show']=function(_0x315ebe,_0xd281c0){var _0x2f2dd2={'raw':!![],'where':{'id':_0x315ebe[_0x5202('0x44')]['id']}},_0x41fd37={};_0x41fd37[_0x5202('0x2e')]=_[_0x5202('0x30')](db[_0x5202('0x2b')][_0x5202('0x2c')]);_0x41fd37[_0x5202('0x31')]=_[_0x5202('0x30')](_0x315ebe[_0x5202('0x31')]);_0x41fd37['filters']=_[_0x5202('0x33')](_0x41fd37['model'],_0x41fd37[_0x5202('0x31')]);_0x2f2dd2[_0x5202('0x35')]=_[_0x5202('0x33')](_0x41fd37[_0x5202('0x2e')],qs[_0x5202('0x34')](_0x315ebe[_0x5202('0x31')][_0x5202('0x34')]));_0x2f2dd2['attributes']=_0x2f2dd2[_0x5202('0x35')][_0x5202('0x45')]?_0x2f2dd2[_0x5202('0x35')]:_0x41fd37[_0x5202('0x2e')];if(_0x315ebe[_0x5202('0x31')][_0x5202('0x41')]){_0x2f2dd2[_0x5202('0x42')]=[{'all':!![]}];}_0x2f2dd2=_[_0x5202('0x3d')]({},_0x2f2dd2,_0x315ebe[_0x5202('0x40')]);return db[_0x5202('0x2b')][_0x5202('0x46')](_0x2f2dd2)[_0x5202('0x24')](handleEntityNotFound(_0xd281c0,null))['then'](respondWithResult(_0xd281c0,null))[_0x5202('0x47')](handleError(_0xd281c0,null));};exports[_0x5202('0x48')]=function(_0x4fea9c,_0x5e5da6){return db[_0x5202('0x2b')][_0x5202('0x48')](_0x4fea9c['body'],{})['then'](respondWithResult(_0x5e5da6,0xc9))['catch'](handleError(_0x5e5da6,null));};exports['update']=function(_0x135b52,_0x80b8a){if(_0x135b52[_0x5202('0x49')]['id']){delete _0x135b52['body']['id'];}return db[_0x5202('0x2b')][_0x5202('0x46')]({'where':{'id':_0x135b52[_0x5202('0x44')]['id']}})[_0x5202('0x24')](handleEntityNotFound(_0x80b8a,null))[_0x5202('0x24')](saveUpdates(_0x135b52['body'],null))['then'](respondWithResult(_0x80b8a,null))[_0x5202('0x47')](handleError(_0x80b8a,null));};exports['destroy']=function(_0x481bc8,_0x1471bd){return db[_0x5202('0x2b')][_0x5202('0x46')]({'where':{'id':_0x481bc8['params']['id']}})['then'](handleEntityNotFound(_0x1471bd,null))['then'](removeEntity(_0x1471bd,null))[_0x5202('0x47')](handleError(_0x1471bd,null));};exports[_0x5202('0x4a')]=function(_0x423d72,_0x371125){return db['FaxTransferReport'][_0x5202('0x4a')]()[_0x5202('0x24')](respondWithResult(_0x371125,null))[_0x5202('0x47')](handleError(_0x371125,null));}; \ No newline at end of file +var _0x1a6b=['util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','destroy','then','error','stack','name','index','map','fieldName','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','sort','where','pick','merge','type','filter','options','FaxTransferReport','findAll','rows','catch','show','rawAttributes','length','includeAll','include','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3f8630,_0x1ce5de){var _0x2b3f15=function(_0x59c813){while(--_0x59c813){_0x3f8630['push'](_0x3f8630['shift']());}};_0x2b3f15(++_0x1ce5de);}(_0x1a6b,0x161));var _0xb1a6=function(_0x17be52,_0x341e9e){_0x17be52=_0x17be52-0x0;var _0x512391=_0x1a6b[_0x17be52];return _0x512391;};'use strict';var emlformat=require(_0xb1a6('0x0'));var rimraf=require(_0xb1a6('0x1'));var zipdir=require(_0xb1a6('0x2'));var jsonpatch=require(_0xb1a6('0x3'));var rp=require(_0xb1a6('0x4'));var moment=require(_0xb1a6('0x5'));var BPromise=require(_0xb1a6('0x6'));var Mustache=require('mustache');var util=require(_0xb1a6('0x7'));var path=require(_0xb1a6('0x8'));var sox=require('sox');var csv=require(_0xb1a6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb1a6('0xa'));var squel=require('squel');var crypto=require(_0xb1a6('0xb'));var jsforce=require(_0xb1a6('0xc'));var deskjs=require(_0xb1a6('0xd'));var toCsv=require(_0xb1a6('0x9'));var querystring=require(_0xb1a6('0xe'));var Papa=require(_0xb1a6('0xf'));var Redis=require(_0xb1a6('0x10'));var authService=require(_0xb1a6('0x11'));var qs=require(_0xb1a6('0x12'));var as=require(_0xb1a6('0x13'));var hardwareService=require(_0xb1a6('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xb1a6('0x15'));var config=require(_0xb1a6('0x16'));var licenseUtil=require(_0xb1a6('0x17'));var db=require(_0xb1a6('0x18'))['db'];function respondWithStatusCode(_0x3eef5c,_0x10c4ac){_0x10c4ac=_0x10c4ac||0xcc;return function(_0x49a29e){if(_0x49a29e){return _0x3eef5c[_0xb1a6('0x19')](_0x10c4ac);}return _0x3eef5c['status'](_0x10c4ac)[_0xb1a6('0x1a')]();};}function respondWithResult(_0xf9d00e,_0xbff1bf){_0xbff1bf=_0xbff1bf||0xc8;return function(_0x108c1c){if(_0x108c1c){return _0xf9d00e[_0xb1a6('0x1b')](_0xbff1bf)[_0xb1a6('0x1c')](_0x108c1c);}};}function respondWithFilteredResult(_0x56a767,_0x5d6c2e){return function(_0xc1c2bf){if(_0xc1c2bf){var _0x9dd19=_0xc1c2bf[_0xb1a6('0x1d')],_0x4cb28d=_0x5d6c2e[_0xb1a6('0x1e')],_0x4d2729=_0x5d6c2e[_0xb1a6('0x1e')]+_0x5d6c2e[_0xb1a6('0x1f')],_0x131ce4;if(_0x4d2729>=_0x9dd19){_0x4d2729=_0x9dd19;_0x131ce4=0xc8;}else{_0x131ce4=0xce;}_0x56a767[_0xb1a6('0x1b')](_0x131ce4);return _0x56a767['set'](_0xb1a6('0x20'),_0x4cb28d+'-'+_0x4d2729+'/'+_0x9dd19)['json'](_0xc1c2bf);}return null;};}function patchUpdates(_0x238b09){return function(_0x23a3db){try{jsonpatch[_0xb1a6('0x21')](_0x23a3db,_0x238b09,!![]);}catch(_0x34103e){return BPromise['reject'](_0x34103e);}return _0x23a3db['save']();};}function saveUpdates(_0x714b7,_0x34dc8a){return function(_0x32c4aa){if(_0x32c4aa){return _0x32c4aa['update'](_0x714b7)['then'](function(_0x517998){return _0x517998;});}return null;};}function removeEntity(_0x26440d,_0x2a2abd){return function(_0x5b5011){if(_0x5b5011){return _0x5b5011[_0xb1a6('0x22')]()[_0xb1a6('0x23')](function(){_0x26440d['status'](0xcc)[_0xb1a6('0x1a')]();});}};}function handleEntityNotFound(_0x31276b,_0x665efe){return function(_0x5a17d5){if(!_0x5a17d5){_0x31276b[_0xb1a6('0x19')](0x194);}return _0x5a17d5;};}function handleError(_0x2e1222,_0x409217){_0x409217=_0x409217||0x1f4;return function(_0x6204bf){logger[_0xb1a6('0x24')](_0x6204bf[_0xb1a6('0x25')]);if(_0x6204bf[_0xb1a6('0x26')]){delete _0x6204bf['name'];}_0x2e1222['status'](_0x409217)['send'](_0x6204bf);};}exports[_0xb1a6('0x27')]=function(_0x25d5bf,_0x5644a5){var _0x3500e9={},_0x5ba233={},_0x559e09={'count':0x0,'rows':[]};var _0x521f3a=_[_0xb1a6('0x28')](db['FaxTransferReport']['rawAttributes'],function(_0x4a53e2){return{'name':_0x4a53e2[_0xb1a6('0x29')],'type':_0x4a53e2['type']['key']};});_0x5ba233[_0xb1a6('0x2a')]=_[_0xb1a6('0x28')](_0x521f3a,'name');_0x5ba233[_0xb1a6('0x2b')]=_[_0xb1a6('0x2c')](_0x25d5bf[_0xb1a6('0x2b')]);_0x5ba233[_0xb1a6('0x2d')]=_['intersection'](_0x5ba233['model'],_0x5ba233[_0xb1a6('0x2b')]);_0x3500e9[_0xb1a6('0x2e')]=_[_0xb1a6('0x2f')](_0x5ba233['model'],qs[_0xb1a6('0x30')](_0x25d5bf['query'][_0xb1a6('0x30')]));_0x3500e9[_0xb1a6('0x2e')]=_0x3500e9[_0xb1a6('0x2e')]['length']?_0x3500e9[_0xb1a6('0x2e')]:_0x5ba233['model'];if(!_0x25d5bf['query'][_0xb1a6('0x31')]('nolimit')){_0x3500e9['limit']=qs['limit'](_0x25d5bf['query']['limit']);_0x3500e9[_0xb1a6('0x1e')]=qs[_0xb1a6('0x1e')](_0x25d5bf[_0xb1a6('0x2b')]['offset']);}_0x3500e9['order']=qs[_0xb1a6('0x32')](_0x25d5bf[_0xb1a6('0x2b')][_0xb1a6('0x32')]);_0x3500e9[_0xb1a6('0x33')]=qs[_0xb1a6('0x2d')](_[_0xb1a6('0x34')](_0x25d5bf[_0xb1a6('0x2b')],_0x5ba233[_0xb1a6('0x2d')]),_0x521f3a);if(_0x25d5bf[_0xb1a6('0x2b')]['filter']){_0x3500e9[_0xb1a6('0x33')]=_[_0xb1a6('0x35')](_0x3500e9[_0xb1a6('0x33')],{'$or':_[_0xb1a6('0x28')](_0x521f3a,function(_0x5c79d3){if(_0x5c79d3[_0xb1a6('0x36')]!=='VIRTUAL'){var _0x1d3cd4={};_0x1d3cd4[_0x5c79d3[_0xb1a6('0x26')]]={'$like':'%'+_0x25d5bf[_0xb1a6('0x2b')][_0xb1a6('0x37')]+'%'};return _0x1d3cd4;}})});}_0x3500e9=_[_0xb1a6('0x35')]({},_0x3500e9,_0x25d5bf[_0xb1a6('0x38')]);var _0x59a5ea={'where':_0x3500e9[_0xb1a6('0x33')]};return db[_0xb1a6('0x39')][_0xb1a6('0x1d')](_0x59a5ea)[_0xb1a6('0x23')](function(_0x168136){_0x559e09[_0xb1a6('0x1d')]=_0x168136;if(_0x25d5bf[_0xb1a6('0x2b')]['includeAll']){_0x3500e9['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0xb1a6('0x3a')](_0x3500e9);})[_0xb1a6('0x23')](function(_0x39056f){_0x559e09[_0xb1a6('0x3b')]=_0x39056f;return _0x559e09;})['then'](respondWithFilteredResult(_0x5644a5,_0x3500e9))[_0xb1a6('0x3c')](handleError(_0x5644a5,null));};exports[_0xb1a6('0x3d')]=function(_0x56a8e4,_0x3131d4){var _0x290d16={'raw':!![],'where':{'id':_0x56a8e4['params']['id']}},_0x41a87f={};_0x41a87f[_0xb1a6('0x2a')]=_[_0xb1a6('0x2c')](db[_0xb1a6('0x39')][_0xb1a6('0x3e')]);_0x41a87f[_0xb1a6('0x2b')]=_['keys'](_0x56a8e4[_0xb1a6('0x2b')]);_0x41a87f[_0xb1a6('0x2d')]=_[_0xb1a6('0x2f')](_0x41a87f[_0xb1a6('0x2a')],_0x41a87f[_0xb1a6('0x2b')]);_0x290d16[_0xb1a6('0x2e')]=_[_0xb1a6('0x2f')](_0x41a87f[_0xb1a6('0x2a')],qs[_0xb1a6('0x30')](_0x56a8e4['query'][_0xb1a6('0x30')]));_0x290d16['attributes']=_0x290d16[_0xb1a6('0x2e')][_0xb1a6('0x3f')]?_0x290d16[_0xb1a6('0x2e')]:_0x41a87f['model'];if(_0x56a8e4['query'][_0xb1a6('0x40')]){_0x290d16[_0xb1a6('0x41')]=[{'all':!![]}];}_0x290d16=_[_0xb1a6('0x35')]({},_0x290d16,_0x56a8e4[_0xb1a6('0x38')]);return db[_0xb1a6('0x39')][_0xb1a6('0x42')](_0x290d16)['then'](handleEntityNotFound(_0x3131d4,null))[_0xb1a6('0x23')](respondWithResult(_0x3131d4,null))[_0xb1a6('0x3c')](handleError(_0x3131d4,null));};exports['create']=function(_0x164277,_0x1ddc56){return db[_0xb1a6('0x39')][_0xb1a6('0x43')](_0x164277[_0xb1a6('0x44')],{})['then'](respondWithResult(_0x1ddc56,0xc9))[_0xb1a6('0x3c')](handleError(_0x1ddc56,null));};exports[_0xb1a6('0x45')]=function(_0xd6a10,_0x31d2b2){if(_0xd6a10['body']['id']){delete _0xd6a10[_0xb1a6('0x44')]['id'];}return db[_0xb1a6('0x39')][_0xb1a6('0x42')]({'where':{'id':_0xd6a10[_0xb1a6('0x46')]['id']}})[_0xb1a6('0x23')](handleEntityNotFound(_0x31d2b2,null))[_0xb1a6('0x23')](saveUpdates(_0xd6a10[_0xb1a6('0x44')],null))[_0xb1a6('0x23')](respondWithResult(_0x31d2b2,null))[_0xb1a6('0x3c')](handleError(_0x31d2b2,null));};exports['destroy']=function(_0x1ca04e,_0x45d2c3){return db['FaxTransferReport']['find']({'where':{'id':_0x1ca04e['params']['id']}})[_0xb1a6('0x23')](handleEntityNotFound(_0x45d2c3,null))[_0xb1a6('0x23')](removeEntity(_0x45d2c3,null))[_0xb1a6('0x3c')](handleError(_0x45d2c3,null));};exports[_0xb1a6('0x47')]=function(_0xaeed4e,_0x32d8d2){return db[_0xb1a6('0x39')][_0xb1a6('0x47')]()['then'](respondWithResult(_0x32d8d2,null))[_0xb1a6('0x3c')](handleError(_0x32d8d2,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 9983375..413b5d6 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 _0xec03=['bluebird','request-promise','rimraf','exports','define','FaxTransferReport','uniqueid','util','../../config/logger','api','moment'];(function(_0x18e84d,_0x593b65){var _0x479ad2=function(_0x3e66c8){while(--_0x3e66c8){_0x18e84d['push'](_0x18e84d['shift']());}};_0x479ad2(++_0x593b65);}(_0xec03,0x96));var _0x3ec0=function(_0x5a78f1,_0x276135){_0x5a78f1=_0x5a78f1-0x0;var _0x3b36ad=_0xec03[_0x5a78f1];return _0x3b36ad;};'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('./faxTransferReport.attributes');module[_0x3ec0('0x7')]=function(_0x48802b,_0x9a73eb){return _0x48802b[_0x3ec0('0x8')](_0x3ec0('0x9'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3ec0('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x150e=['define','FaxTransferReport','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxTransferReport.attributes'];(function(_0x470243,_0x439017){var _0x72488e=function(_0x2edb93){while(--_0x2edb93){_0x470243['push'](_0x470243['shift']());}};_0x72488e(++_0x439017);}(_0x150e,0x66));var _0xe150=function(_0x417da4,_0x23d9dd){_0x417da4=_0x417da4-0x0;var _0x53c3b0=_0x150e[_0x417da4];return _0x53c3b0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe150('0x0'))(_0xe150('0x1'));var moment=require(_0xe150('0x2'));var BPromise=require(_0xe150('0x3'));var rp=require(_0xe150('0x4'));var fs=require('fs');var path=require(_0xe150('0x5'));var rimraf=require('rimraf');var config=require(_0xe150('0x6'));var attributes=require(_0xe150('0x7'));module['exports']=function(_0x5b4328,_0x40c752){return _0x5b4328[_0xe150('0x8')](_0xe150('0x9'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xe150('0xa'),'fields':[_0xe150('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 93835f0..1d69215 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 _0x5b5b=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x5b5b,0x9f));var _0xb5b5=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x5b5b[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xb5b5('0x0'));var util=require(_0xb5b5('0x1'));var moment=require(_0xb5b5('0x2'));var BPromise=require(_0xb5b5('0x3'));var rs=require(_0xb5b5('0x4'));var fs=require('fs');var Redis=require(_0xb5b5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb5b5('0x6'));var logger=require(_0xb5b5('0x7'))(_0xb5b5('0x8'));var config=require(_0xb5b5('0x9'));var jayson=require(_0xb5b5('0xa'));var client=jayson[_0xb5b5('0xb')][_0xb5b5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14dc76,_0x21d4a1,_0x195c83){return new BPromise(function(_0x5b4c8a,_0x2aedd2){return client[_0xb5b5('0xd')](_0x14dc76,_0x195c83)['then'](function(_0x1fa1a3){logger[_0xb5b5('0xe')](_0xb5b5('0xf'),_0x21d4a1,_0xb5b5('0x10'));logger[_0xb5b5('0x11')](_0xb5b5('0x12'),_0x21d4a1,_0xb5b5('0x10'),JSON[_0xb5b5('0x13')](_0x1fa1a3));if(_0x1fa1a3[_0xb5b5('0x14')]){if(_0x1fa1a3[_0xb5b5('0x14')]['code']===0x1f4){logger[_0xb5b5('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0x21d4a1,_0x1fa1a3[_0xb5b5('0x14')][_0xb5b5('0x15')]);return _0x2aedd2(_0x1fa1a3[_0xb5b5('0x14')]['message']);}logger[_0xb5b5('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0x21d4a1,_0x1fa1a3[_0xb5b5('0x14')][_0xb5b5('0x15')]);return _0x5b4c8a(_0x1fa1a3[_0xb5b5('0x14')][_0xb5b5('0x15')]);}else{logger[_0xb5b5('0xe')](_0xb5b5('0xf'),_0x21d4a1,_0xb5b5('0x10'));_0x5b4c8a(_0x1fa1a3['result'][_0xb5b5('0x15')]);}})[_0xb5b5('0x16')](function(_0x2419c4){logger[_0xb5b5('0x14')](_0xb5b5('0xf'),_0x21d4a1,_0x2419c4);_0x2aedd2(_0x2419c4);});});} \ No newline at end of file +var _0xd5b2=['http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x2a29bc,_0x2c5470){var _0x10fc32=function(_0x4f85ff){while(--_0x4f85ff){_0x2a29bc['push'](_0x2a29bc['shift']());}};_0x10fc32(++_0x2c5470);}(_0xd5b2,0x7b));var _0x2d5b=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xd5b2[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x2d5b('0x0'));var util=require(_0x2d5b('0x1'));var moment=require(_0x2d5b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d5b('0x3'));var db=require(_0x2d5b('0x4'))['db'];var utils=require(_0x2d5b('0x5'));var logger=require(_0x2d5b('0x6'))('rpc');var config=require(_0x2d5b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2d5b('0x8')][_0x2d5b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f5ca3,_0xc47139,_0x125910){return new BPromise(function(_0x1707c6,_0x4bb465){return client[_0x2d5b('0xa')](_0x2f5ca3,_0x125910)['then'](function(_0x3ad2a4){logger[_0x2d5b('0xb')](_0x2d5b('0xc'),_0xc47139,_0x2d5b('0xd'));logger[_0x2d5b('0xe')](_0x2d5b('0xf'),_0xc47139,_0x2d5b('0xd'),JSON[_0x2d5b('0x10')](_0x3ad2a4));if(_0x3ad2a4[_0x2d5b('0x11')]){if(_0x3ad2a4[_0x2d5b('0x11')][_0x2d5b('0x12')]===0x1f4){logger['error'](_0x2d5b('0xc'),_0xc47139,_0x3ad2a4[_0x2d5b('0x11')][_0x2d5b('0x13')]);return _0x4bb465(_0x3ad2a4['error'][_0x2d5b('0x13')]);}logger[_0x2d5b('0x11')](_0x2d5b('0xc'),_0xc47139,_0x3ad2a4[_0x2d5b('0x11')]['message']);return _0x1707c6(_0x3ad2a4['error'][_0x2d5b('0x13')]);}else{logger[_0x2d5b('0xb')](_0x2d5b('0xc'),_0xc47139,_0x2d5b('0xd'));_0x1707c6(_0x3ad2a4[_0x2d5b('0x14')][_0x2d5b('0x13')]);}})[_0x2d5b('0x15')](function(_0x2be353){logger['error'](_0x2d5b('0xc'),_0xc47139,_0x2be353);_0x4bb465(_0x2be353);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 3afe365..4d95507 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 _0x2efb=['/:id','update','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index','describe'];(function(_0x312c28,_0x894e2c){var _0x14c22b=function(_0x188706){while(--_0x188706){_0x312c28['push'](_0x312c28['shift']());}};_0x14c22b(++_0x894e2c);}(_0x2efb,0xab));var _0xb2ef=function(_0x421325,_0x34d9e9){_0x421325=_0x421325-0x0;var _0x222358=_0x2efb[_0x421325];return _0x222358;};'use strict';var multer=require('multer');var util=require(_0xb2ef('0x0'));var path=require(_0xb2ef('0x1'));var timeout=require('connect-timeout');var express=require(_0xb2ef('0x2'));var router=express[_0xb2ef('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb2ef('0x4'));var interaction=require(_0xb2ef('0x5'));var config=require('../../config/environment');var controller=require(_0xb2ef('0x6'));router[_0xb2ef('0x7')]('/',auth[_0xb2ef('0x8')](),controller[_0xb2ef('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xb2ef('0xa')]);router['get'](_0xb2ef('0xb'),auth[_0xb2ef('0x8')](),controller['show']);router['post']('/',auth[_0xb2ef('0x8')](),controller['create']);router['put'](_0xb2ef('0xb'),auth[_0xb2ef('0x8')](),controller[_0xb2ef('0xc')]);router['delete'](_0xb2ef('0xb'),auth[_0xb2ef('0x8')](),controller['destroy']);module[_0xb2ef('0xd')]=router; \ No newline at end of file +var _0x9123=['multer','util','path','connect-timeout','Router','fs-extra','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports'];(function(_0x54691e,_0x28b041){var _0x5520b2=function(_0x501a05){while(--_0x501a05){_0x54691e['push'](_0x54691e['shift']());}};_0x5520b2(++_0x28b041);}(_0x9123,0x154));var _0x3912=function(_0x308e63,_0x492ccd){_0x308e63=_0x308e63-0x0;var _0x4fabb0=_0x9123[_0x308e63];return _0x4fabb0;};'use strict';var multer=require(_0x3912('0x0'));var util=require(_0x3912('0x1'));var path=require(_0x3912('0x2'));var timeout=require(_0x3912('0x3'));var express=require('express');var router=express[_0x3912('0x4')]();var fs_extra=require(_0x3912('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3912('0x6'));router[_0x3912('0x7')]('/',auth[_0x3912('0x8')](),controller[_0x3912('0x9')]);router[_0x3912('0x7')](_0x3912('0xa'),auth[_0x3912('0x8')](),controller[_0x3912('0xb')]);router['get'](_0x3912('0xc'),auth[_0x3912('0x8')](),controller[_0x3912('0xd')]);router[_0x3912('0xe')]('/',auth[_0x3912('0x8')](),controller[_0x3912('0xf')]);router[_0x3912('0x10')](_0x3912('0xc'),auth[_0x3912('0x8')](),controller['update']);router[_0x3912('0x11')](_0x3912('0xc'),auth[_0x3912('0x8')](),controller[_0x3912('0x12')]);module[_0x3912('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 9dca085..88ea0a8 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 _0xcfd2=['post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','getConfigurations','/:id/fields','getFields'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcfd2,0x190));var _0x2cfd=function(_0x8781c7,_0x323fff){_0x8781c7=_0x8781c7-0x0;var _0x3c8e82=_0xcfd2[_0x8781c7];return _0x3c8e82;};'use strict';var multer=require(_0x2cfd('0x0'));var util=require(_0x2cfd('0x1'));var path=require(_0x2cfd('0x2'));var timeout=require(_0x2cfd('0x3'));var express=require('express');var router=express[_0x2cfd('0x4')]();var fs_extra=require(_0x2cfd('0x5'));var auth=require(_0x2cfd('0x6'));var interaction=require(_0x2cfd('0x7'));var config=require(_0x2cfd('0x8'));var controller=require(_0x2cfd('0x9'));router[_0x2cfd('0xa')]('/',auth[_0x2cfd('0xb')](),controller[_0x2cfd('0xc')]);router[_0x2cfd('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2cfd('0xa')]('/:id/configurations',auth[_0x2cfd('0xb')](),controller[_0x2cfd('0xd')]);router['get'](_0x2cfd('0xe'),auth[_0x2cfd('0xb')](),controller[_0x2cfd('0xf')]);router[_0x2cfd('0x10')]('/',auth[_0x2cfd('0xb')](),controller[_0x2cfd('0x11')]);router['post'](_0x2cfd('0x12'),auth[_0x2cfd('0xb')](),controller[_0x2cfd('0x13')]);router[_0x2cfd('0x14')](_0x2cfd('0x15'),auth[_0x2cfd('0xb')](),controller[_0x2cfd('0x16')]);router[_0x2cfd('0x17')](_0x2cfd('0x15'),auth['isAuthenticated'](),controller[_0x2cfd('0x18')]);module[_0x2cfd('0x19')]=router; \ No newline at end of file +var _0x8acf=['../../config/environment','./intDeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1a4861,_0x510d80){var _0x55c004=function(_0x5c8dd0){while(--_0x5c8dd0){_0x1a4861['push'](_0x1a4861['shift']());}};_0x55c004(++_0x510d80);}(_0x8acf,0x1c1));var _0xf8ac=function(_0x18546c,_0x4daf94){_0x18546c=_0x18546c-0x0;var _0x46ef43=_0x8acf[_0x18546c];return _0x46ef43;};'use strict';var multer=require(_0xf8ac('0x0'));var util=require(_0xf8ac('0x1'));var path=require(_0xf8ac('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf8ac('0x3')]();var fs_extra=require(_0xf8ac('0x4'));var auth=require(_0xf8ac('0x5'));var interaction=require(_0xf8ac('0x6'));var config=require(_0xf8ac('0x7'));var controller=require(_0xf8ac('0x8'));router[_0xf8ac('0x9')]('/',auth['isAuthenticated'](),controller[_0xf8ac('0xa')]);router[_0xf8ac('0x9')](_0xf8ac('0xb'),auth[_0xf8ac('0xc')](),controller[_0xf8ac('0xd')]);router[_0xf8ac('0x9')](_0xf8ac('0xe'),auth[_0xf8ac('0xc')](),controller[_0xf8ac('0xf')]);router[_0xf8ac('0x9')](_0xf8ac('0x10'),auth[_0xf8ac('0xc')](),controller['getFields']);router[_0xf8ac('0x11')]('/',auth['isAuthenticated'](),controller[_0xf8ac('0x12')]);router[_0xf8ac('0x11')]('/:id/configurations',auth[_0xf8ac('0xc')](),controller[_0xf8ac('0x13')]);router[_0xf8ac('0x14')](_0xf8ac('0xb'),auth[_0xf8ac('0xc')](),controller['update']);router[_0xf8ac('0x15')](_0xf8ac('0xb'),auth[_0xf8ac('0xc')](),controller[_0xf8ac('0x16')]);module[_0xf8ac('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 a4e75ae..b47c142 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 _0x13cc=['basic','integrationTab','newTab','STRING','ENUM'];(function(_0x4fa892,_0x41f525){var _0x2d1e7b=function(_0x5eae1e){while(--_0x5eae1e){_0x4fa892['push'](_0x4fa892['shift']());}};_0x2d1e7b(++_0x41f525);}(_0x13cc,0x161));var _0xc13c=function(_0x58ec18,_0x5616cf){_0x58ec18=_0x58ec18-0x0;var _0x2bf6a3=_0x13cc[_0x58ec18];return _0x2bf6a3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc13c('0x0')]},'description':{'type':Sequelize[_0xc13c('0x0')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc13c('0x0')]},'authType':{'type':Sequelize[_0xc13c('0x1')](_0xc13c('0x2')),'defaultValue':_0xc13c('0x2')},'password':{'type':Sequelize[_0xc13c('0x0')]},'consumerKey':{'type':Sequelize[_0xc13c('0x0')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xc13c('0x0')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xc13c('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xc13c('0x1')](_0xc13c('0x3'),_0xc13c('0x4')),'defaultValue':_0xc13c('0x3')}}; \ No newline at end of file +var _0x2c91=['integrationTab','sequelize','exports','STRING','ENUM','basic','newTab'];(function(_0x8bd114,_0x354a02){var _0x42aedb=function(_0x10ec96){while(--_0x10ec96){_0x8bd114['push'](_0x8bd114['shift']());}};_0x42aedb(++_0x354a02);}(_0x2c91,0x158));var _0x12c9=function(_0xc482a0,_0x405f03){_0xc482a0=_0xc482a0-0x0;var _0x489173=_0x2c91[_0xc482a0];return _0x489173;};'use strict';var Sequelize=require(_0x12c9('0x0'));module[_0x12c9('0x1')]={'name':{'type':Sequelize[_0x12c9('0x2')]},'description':{'type':Sequelize[_0x12c9('0x2')]},'username':{'type':Sequelize[_0x12c9('0x2')]},'remoteUri':{'type':Sequelize[_0x12c9('0x2')]},'authType':{'type':Sequelize[_0x12c9('0x3')](_0x12c9('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x12c9('0x2')]},'consumerKey':{'type':Sequelize[_0x12c9('0x2')]},'consumerSecret':{'type':Sequelize[_0x12c9('0x2')]},'token':{'type':Sequelize[_0x12c9('0x2')]},'tokenSecret':{'type':Sequelize[_0x12c9('0x2')]},'serverUrl':{'type':Sequelize[_0x12c9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x12c9('0x3')]('integrationTab',_0x12c9('0x5')),'defaultValue':_0x12c9('0x6')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 88f0132..a5cf7c4 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 _0xa6c4=['test','Wrong\x20credentials','statusCode','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','name','send','index','map','rawAttributes','fieldName','key','keys','query','filters','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','DeskAccount','count','includeAll','include','rows','catch','show','params','intersection','find','create','body','getConfigurations','findOne','nolimit','AccountId','Subjects','getSubjects','type','getDescriptions','channel','DeskConfiguration','DeskField','Descriptions','getFields','remoteUri','authType','password','consumerSecret','slice','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','base64','concat','_embedded','entries','active','label'];(function(_0x2f569b,_0x440e96){var _0x27a204=function(_0x2da42b){while(--_0x2da42b){_0x2f569b['push'](_0x2f569b['shift']());}};_0x27a204(++_0x440e96);}(_0xa6c4,0x168));var _0x4a6c=function(_0x1c5950,_0x49e128){_0x1c5950=_0x1c5950-0x0;var _0x2b720a=_0xa6c4[_0x1c5950];return _0x2b720a;};'use strict';var emlformat=require(_0x4a6c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4a6c('0x1'));var rp=require(_0x4a6c('0x2'));var moment=require('moment');var BPromise=require(_0x4a6c('0x3'));var Mustache=require(_0x4a6c('0x4'));var util=require(_0x4a6c('0x5'));var path=require(_0x4a6c('0x6'));var sox=require(_0x4a6c('0x7'));var csv=require(_0x4a6c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a6c('0x9'));var _=require(_0x4a6c('0xa'));var squel=require(_0x4a6c('0xb'));var crypto=require('crypto');var jsforce=require(_0x4a6c('0xc'));var deskjs=require(_0x4a6c('0xd'));var toCsv=require(_0x4a6c('0x8'));var querystring=require(_0x4a6c('0xe'));var Papa=require(_0x4a6c('0xf'));var Redis=require(_0x4a6c('0x10'));var authService=require(_0x4a6c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a6c('0x12'))(_0x4a6c('0x13'));var utils=require('../../config/utils');var config=require(_0x4a6c('0x14'));var licenseUtil=require(_0x4a6c('0x15'));var db=require(_0x4a6c('0x16'))['db'];var integrations=require(_0x4a6c('0x17'));var jayson=require(_0x4a6c('0x18'));var client=jayson[_0x4a6c('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x495b65,_0x3922ea,_0x25c55b,_0xb5c8c9){return new BPromise(function(_0x51ef25,_0x307c53){var _0x537983=_0xb5c8c9||client;return _0x537983[_0x4a6c('0x1a')](_0x495b65,_0x25c55b)['then'](function(_0x59e6ac){logger[_0x4a6c('0x1b')](_0x4a6c('0x1c'),_0x3922ea,_0x4a6c('0x1d'));logger[_0x4a6c('0x1e')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x3922ea,_0x4a6c('0x1d'),JSON[_0x4a6c('0x1f')](_0x59e6ac));if(_0x59e6ac[_0x4a6c('0x20')]){if(_0x59e6ac['error']['code']===0x1f4){logger[_0x4a6c('0x20')](_0x4a6c('0x1c'),_0x3922ea,_0x59e6ac[_0x4a6c('0x20')][_0x4a6c('0x21')]);return _0x307c53(_0x59e6ac[_0x4a6c('0x20')][_0x4a6c('0x21')]);}logger[_0x4a6c('0x20')](_0x4a6c('0x1c'),_0x3922ea,_0x59e6ac[_0x4a6c('0x20')][_0x4a6c('0x21')]);return _0x51ef25(_0x59e6ac['error'][_0x4a6c('0x21')]);}else{logger[_0x4a6c('0x1b')](_0x4a6c('0x1c'),_0x3922ea,_0x4a6c('0x1d'));_0x51ef25(_0x59e6ac[_0x4a6c('0x22')][_0x4a6c('0x21')]);}})['catch'](function(_0x491dd1){logger[_0x4a6c('0x20')]('DeskAccount,\x20%s,\x20%s',_0x3922ea,_0x491dd1);_0x307c53(_0x491dd1);});});}function respondWithStatusCode(_0x28774d,_0x1b8bfd){_0x1b8bfd=_0x1b8bfd||0xcc;return function(_0x2a1d29){if(_0x2a1d29){return _0x28774d[_0x4a6c('0x23')](_0x1b8bfd);}return _0x28774d[_0x4a6c('0x24')](_0x1b8bfd)['end']();};}function respondWithResult(_0x5d8356,_0x3fad35){_0x3fad35=_0x3fad35||0xc8;return function(_0x48f20f){if(_0x48f20f){return _0x5d8356[_0x4a6c('0x24')](_0x3fad35)[_0x4a6c('0x25')](_0x48f20f);}};}function respondWithFilteredResult(_0x1dfab3,_0x1e4255){return function(_0x48184e){if(_0x48184e){var _0x41eb37=_0x48184e['count'],_0x4c6ea7=_0x1e4255[_0x4a6c('0x26')],_0x158883=_0x1e4255[_0x4a6c('0x26')]+_0x1e4255[_0x4a6c('0x27')],_0x5966bf;if(_0x158883>=_0x41eb37){_0x158883=_0x41eb37;_0x5966bf=0xc8;}else{_0x5966bf=0xce;}_0x1dfab3[_0x4a6c('0x24')](_0x5966bf);return _0x1dfab3[_0x4a6c('0x28')](_0x4a6c('0x29'),_0x4c6ea7+'-'+_0x158883+'/'+_0x41eb37)[_0x4a6c('0x25')](_0x48184e);}return null;};}function patchUpdates(_0x18a66e){return function(_0xc24313){try{jsonpatch['apply'](_0xc24313,_0x18a66e,!![]);}catch(_0x3d8608){return BPromise[_0x4a6c('0x2a')](_0x3d8608);}return _0xc24313[_0x4a6c('0x2b')]();};}function saveUpdates(_0x528f6b,_0x5ceb16){return function(_0x3939d8){if(_0x3939d8){return _0x3939d8[_0x4a6c('0x2c')](_0x528f6b)[_0x4a6c('0x2d')](function(_0x411cb9){return _0x411cb9;});}return null;};}function removeEntity(_0x5dbdbc,_0x561ac1){return function(_0x7ce8d6){if(_0x7ce8d6){return _0x7ce8d6[_0x4a6c('0x2e')]()['then'](function(){_0x5dbdbc[_0x4a6c('0x24')](0xcc)[_0x4a6c('0x2f')]();});}};}function handleEntityNotFound(_0x5b77f9,_0x178b25){return function(_0x1ec2e2){if(!_0x1ec2e2){_0x5b77f9[_0x4a6c('0x23')](0x194);}return _0x1ec2e2;};}function handleError(_0x4704e2,_0x1c6041){_0x1c6041=_0x1c6041||0x1f4;return function(_0x38ab27){logger[_0x4a6c('0x20')](_0x38ab27['stack']);if(_0x38ab27[_0x4a6c('0x30')]){delete _0x38ab27[_0x4a6c('0x30')];}_0x4704e2[_0x4a6c('0x24')](_0x1c6041)[_0x4a6c('0x31')](_0x38ab27);};}exports[_0x4a6c('0x32')]=function(_0x46b8c5,_0x5c1eca){var _0xc52852={},_0xe88afb={},_0x19b8ec={'count':0x0,'rows':[]};var _0x57dbf6=_[_0x4a6c('0x33')](db['DeskAccount'][_0x4a6c('0x34')],function(_0x3b2eb2){return{'name':_0x3b2eb2[_0x4a6c('0x35')],'type':_0x3b2eb2['type'][_0x4a6c('0x36')]};});_0xe88afb['model']=_[_0x4a6c('0x33')](_0x57dbf6,_0x4a6c('0x30'));_0xe88afb['query']=_[_0x4a6c('0x37')](_0x46b8c5[_0x4a6c('0x38')]);_0xe88afb[_0x4a6c('0x39')]=_['intersection'](_0xe88afb[_0x4a6c('0x3a')],_0xe88afb[_0x4a6c('0x38')]);_0xc52852[_0x4a6c('0x3b')]=_['intersection'](_0xe88afb[_0x4a6c('0x3a')],qs[_0x4a6c('0x3c')](_0x46b8c5[_0x4a6c('0x38')][_0x4a6c('0x3c')]));_0xc52852[_0x4a6c('0x3b')]=_0xc52852['attributes'][_0x4a6c('0x3d')]?_0xc52852['attributes']:_0xe88afb[_0x4a6c('0x3a')];if(!_0x46b8c5[_0x4a6c('0x38')][_0x4a6c('0x3e')]('nolimit')){_0xc52852[_0x4a6c('0x27')]=qs[_0x4a6c('0x27')](_0x46b8c5[_0x4a6c('0x38')][_0x4a6c('0x27')]);_0xc52852[_0x4a6c('0x26')]=qs['offset'](_0x46b8c5[_0x4a6c('0x38')][_0x4a6c('0x26')]);}_0xc52852[_0x4a6c('0x3f')]=qs[_0x4a6c('0x40')](_0x46b8c5[_0x4a6c('0x38')][_0x4a6c('0x40')]);_0xc52852['where']=qs[_0x4a6c('0x39')](_[_0x4a6c('0x41')](_0x46b8c5[_0x4a6c('0x38')],_0xe88afb[_0x4a6c('0x39')]),_0x57dbf6);if(_0x46b8c5[_0x4a6c('0x38')][_0x4a6c('0x42')]){_0xc52852[_0x4a6c('0x43')]=_[_0x4a6c('0x44')](_0xc52852[_0x4a6c('0x43')],{'$or':_[_0x4a6c('0x33')](_0x57dbf6,function(_0x1bd58d){if(_0x1bd58d['type']!=='VIRTUAL'){var _0x49619c={};_0x49619c[_0x1bd58d[_0x4a6c('0x30')]]={'$like':'%'+_0x46b8c5[_0x4a6c('0x38')][_0x4a6c('0x42')]+'%'};return _0x49619c;}})});}_0xc52852=_[_0x4a6c('0x44')]({},_0xc52852,_0x46b8c5[_0x4a6c('0x45')]);var _0x18b287={'where':_0xc52852[_0x4a6c('0x43')]};return db[_0x4a6c('0x46')][_0x4a6c('0x47')](_0x18b287)[_0x4a6c('0x2d')](function(_0x5380c1){_0x19b8ec['count']=_0x5380c1;if(_0x46b8c5[_0x4a6c('0x38')][_0x4a6c('0x48')]){_0xc52852[_0x4a6c('0x49')]=[{'all':!![]}];}return db[_0x4a6c('0x46')]['findAll'](_0xc52852);})[_0x4a6c('0x2d')](function(_0x1e5b78){_0x19b8ec[_0x4a6c('0x4a')]=_0x1e5b78;return _0x19b8ec;})[_0x4a6c('0x2d')](respondWithFilteredResult(_0x5c1eca,_0xc52852))[_0x4a6c('0x4b')](handleError(_0x5c1eca,null));};exports[_0x4a6c('0x4c')]=function(_0x263b93,_0x31eb1d){var _0x1e614a={'raw':![],'where':{'id':_0x263b93[_0x4a6c('0x4d')]['id']}},_0x314d9a={};_0x314d9a[_0x4a6c('0x3a')]=_[_0x4a6c('0x37')](db['DeskAccount'][_0x4a6c('0x34')]);_0x314d9a['query']=_[_0x4a6c('0x37')](_0x263b93[_0x4a6c('0x38')]);_0x314d9a[_0x4a6c('0x39')]=_['intersection'](_0x314d9a['model'],_0x314d9a[_0x4a6c('0x38')]);_0x1e614a[_0x4a6c('0x3b')]=_[_0x4a6c('0x4e')](_0x314d9a[_0x4a6c('0x3a')],qs[_0x4a6c('0x3c')](_0x263b93['query'][_0x4a6c('0x3c')]));_0x1e614a['attributes']=_0x1e614a[_0x4a6c('0x3b')][_0x4a6c('0x3d')]?_0x1e614a[_0x4a6c('0x3b')]:_0x314d9a[_0x4a6c('0x3a')];if(_0x263b93[_0x4a6c('0x38')][_0x4a6c('0x48')]){_0x1e614a[_0x4a6c('0x49')]=[{'all':!![]}];}_0x1e614a=_['merge']({},_0x1e614a,_0x263b93['options']);return db['DeskAccount'][_0x4a6c('0x4f')](_0x1e614a)[_0x4a6c('0x2d')](handleEntityNotFound(_0x31eb1d,null))['then'](respondWithResult(_0x31eb1d,null))[_0x4a6c('0x4b')](handleError(_0x31eb1d,null));};exports[_0x4a6c('0x50')]=function(_0x2a4efb,_0x19d412){return db[_0x4a6c('0x46')][_0x4a6c('0x50')](_0x2a4efb[_0x4a6c('0x51')],{})[_0x4a6c('0x2d')](respondWithResult(_0x19d412,0xc9))[_0x4a6c('0x4b')](handleError(_0x19d412,null));};exports['update']=function(_0x283184,_0xf51ed4){if(_0x283184[_0x4a6c('0x51')]['id']){delete _0x283184['body']['id'];}return db[_0x4a6c('0x46')][_0x4a6c('0x4f')]({'where':{'id':_0x283184[_0x4a6c('0x4d')]['id']}})[_0x4a6c('0x2d')](handleEntityNotFound(_0xf51ed4,null))['then'](saveUpdates(_0x283184[_0x4a6c('0x51')],null))[_0x4a6c('0x2d')](respondWithResult(_0xf51ed4,null))[_0x4a6c('0x4b')](handleError(_0xf51ed4,null));};exports['destroy']=function(_0x5a2f9c,_0x1fcebc){return db[_0x4a6c('0x46')][_0x4a6c('0x4f')]({'where':{'id':_0x5a2f9c[_0x4a6c('0x4d')]['id']}})[_0x4a6c('0x2d')](handleEntityNotFound(_0x1fcebc,null))[_0x4a6c('0x2d')](removeEntity(_0x1fcebc,null))[_0x4a6c('0x4b')](handleError(_0x1fcebc,null));};exports[_0x4a6c('0x52')]=function(_0x3597b9,_0x5bf615,_0x23a831){var _0x325271={};var _0x20fb91={};var _0x1d9b80;var _0x380355;return db[_0x4a6c('0x46')][_0x4a6c('0x53')]({'where':{'id':_0x3597b9[_0x4a6c('0x4d')]['id']}})[_0x4a6c('0x2d')](handleEntityNotFound(_0x5bf615,null))['then'](function(_0x22e0ac){if(_0x22e0ac){_0x1d9b80=_0x22e0ac;_0x20fb91[_0x4a6c('0x3a')]=_[_0x4a6c('0x37')](db['DeskConfiguration']['rawAttributes']);_0x20fb91[_0x4a6c('0x38')]=_[_0x4a6c('0x37')](_0x3597b9[_0x4a6c('0x38')]);_0x20fb91[_0x4a6c('0x39')]=_[_0x4a6c('0x4e')](_0x20fb91[_0x4a6c('0x3a')],_0x20fb91[_0x4a6c('0x38')]);_0x325271[_0x4a6c('0x3b')]=_[_0x4a6c('0x4e')](_0x20fb91['model'],qs[_0x4a6c('0x3c')](_0x3597b9[_0x4a6c('0x38')]['fields']));_0x325271[_0x4a6c('0x3b')]=_0x325271['attributes'][_0x4a6c('0x3d')]?_0x325271[_0x4a6c('0x3b')]:_0x20fb91[_0x4a6c('0x3a')];_0x325271[_0x4a6c('0x3f')]=qs['sort'](_0x3597b9[_0x4a6c('0x38')]['sort']);_0x325271[_0x4a6c('0x43')]=qs[_0x4a6c('0x39')](_[_0x4a6c('0x41')](_0x3597b9[_0x4a6c('0x38')],_0x20fb91[_0x4a6c('0x39')]));if(_0x3597b9[_0x4a6c('0x38')][_0x4a6c('0x42')]){_0x325271['where']=_[_0x4a6c('0x44')](_0x325271[_0x4a6c('0x43')],{'$or':_[_0x4a6c('0x33')](_0x325271[_0x4a6c('0x3b')],function(_0x1fdc9e){var _0x560fb6={};_0x560fb6[_0x1fdc9e]={'$like':'%'+_0x3597b9['query'][_0x4a6c('0x42')]+'%'};return _0x560fb6;})});}_0x325271=_[_0x4a6c('0x44')]({},_0x325271,_0x3597b9['options']);return _0x1d9b80[_0x4a6c('0x52')](_0x325271);}})[_0x4a6c('0x2d')](function(_0x551978){if(_0x551978){_0x380355=_0x551978[_0x4a6c('0x3d')];if(!_0x3597b9[_0x4a6c('0x38')][_0x4a6c('0x3e')](_0x4a6c('0x54'))){_0x325271['limit']=qs['limit'](_0x3597b9['query'][_0x4a6c('0x27')]);_0x325271[_0x4a6c('0x26')]=qs['offset'](_0x3597b9[_0x4a6c('0x38')][_0x4a6c('0x26')]);}return _0x1d9b80[_0x4a6c('0x52')](_0x325271);}})['then'](function(_0x4a9b39){if(_0x4a9b39){return _0x4a9b39?{'count':_0x380355,'rows':_0x4a9b39}:null;}})[_0x4a6c('0x2d')](respondWithResult(_0x5bf615,null))['catch'](handleError(_0x5bf615,null));};exports['addConfiguration']=function(_0x42593d,_0x53281c,_0x12c531){if(_0x42593d['body']['id']){delete _0x42593d[_0x4a6c('0x51')]['id'];}return db[_0x4a6c('0x46')][_0x4a6c('0x53')]({'where':{'id':_0x42593d[_0x4a6c('0x4d')]['id']}})[_0x4a6c('0x2d')](handleEntityNotFound(_0x53281c,null))[_0x4a6c('0x2d')](function(_0x19875f){if(_0x19875f){_0x42593d[_0x4a6c('0x51')][_0x4a6c('0x55')]=_0x19875f['id'];_0x42593d[_0x4a6c('0x51')][_0x4a6c('0x56')]=integrations[_0x4a6c('0x57')](_0x42593d['body']['channel'],_0x42593d[_0x4a6c('0x51')][_0x4a6c('0x58')]);_0x42593d['body']['Descriptions']=integrations[_0x4a6c('0x59')](_0x42593d[_0x4a6c('0x51')][_0x4a6c('0x5a')],_0x42593d[_0x4a6c('0x51')][_0x4a6c('0x58')]);return db[_0x4a6c('0x5b')][_0x4a6c('0x50')](_0x42593d[_0x4a6c('0x51')],{'include':[{'model':db[_0x4a6c('0x5c')],'as':_0x4a6c('0x56')},{'model':db['DeskField'],'as':_0x4a6c('0x5d')}]});}return null;})[_0x4a6c('0x2d')](respondWithResult(_0x53281c,null))[_0x4a6c('0x4b')](handleError(_0x53281c,null));};exports[_0x4a6c('0x5e')]=function(_0x269d5d,_0x1f4acb,_0x54b880){var _0x328237=[{'name':'priority','label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x3b7e63='';return db['DeskAccount'][_0x4a6c('0x53')]({'where':{'id':_0x269d5d[_0x4a6c('0x4d')]['id']},'attributes':['id',_0x4a6c('0x5f'),_0x4a6c('0x60'),'username',_0x4a6c('0x61'),'consumerKey',_0x4a6c('0x62'),'token','tokenSecret']})[_0x4a6c('0x2d')](handleEntityNotFound(_0x1f4acb,null))[_0x4a6c('0x2d')](function(_0x5909db){if(_0x5909db){_0x3b7e63=_0x5909db[_0x4a6c('0x5f')];var _0x303f55=_0x3b7e63[_0x4a6c('0x63')](-0x1);if(_0x303f55==='/'){_0x3b7e63=_0x3b7e63[_0x4a6c('0x64')](0x0,_0x3b7e63['lastIndexOf'](_0x303f55));}var _0x5de1a9={'method':_0x4a6c('0x65'),'uri':util[_0x4a6c('0x66')](_0x4a6c('0x67'),_0x3b7e63),'headers':{'Content-Type':'application/json','Accept':_0x4a6c('0x68')},'json':!![]};if(_0x5909db['authType']===_0x4a6c('0x69')){_0x5de1a9[_0x4a6c('0x6a')][_0x4a6c('0x6b')]=util['format'](_0x4a6c('0x6c'),new Buffer(util['format'](_0x4a6c('0x6d'),_0x5909db['username'],_0x5909db[_0x4a6c('0x61')]))['toString'](_0x4a6c('0x6e')));}return rp(_0x5de1a9)[_0x4a6c('0x2d')](function(_0x53d589){return _0x328237[_0x4a6c('0x6f')](_['map'](_0x53d589[_0x4a6c('0x70')][_0x4a6c('0x71')],function(_0x417004){return{'id':_0x417004['name'],'name':_0x417004[_0x4a6c('0x30')],'type':_0x417004[_0x4a6c('0x58')],'active':_0x417004[_0x4a6c('0x72')],'label':_0x417004[_0x4a6c('0x73')],'custom':!![]};}));});}})['then'](function(_0x379802){return{'count':_0x379802[_0x4a6c('0x3d')],'rows':_0x379802};})[_0x4a6c('0x2d')](respondWithResult(_0x1f4acb,null))[_0x4a6c('0x4b')](function(_0x52e03f){var _0x5657c5=_0x269d5d['query'][_0x4a6c('0x74')]?0x1f4:_0x52e03f['statusCode']||0x1f4;logger[_0x4a6c('0x20')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5657c5,JSON[_0x4a6c('0x1f')](_0x52e03f));delete _0x52e03f['name'];if(_0x5657c5===0x191){_0x5657c5=0x190;}_0x1f4acb[_0x4a6c('0x24')](_0x5657c5)[_0x4a6c('0x31')](_0x269d5d[_0x4a6c('0x38')][_0x4a6c('0x74')]?{'message':_0x4a6c('0x75'),'statusCode':_0x52e03f[_0x4a6c('0x76')]}:_0x52e03f);});}; \ No newline at end of file +var _0x7eed=['result','catch','sendStatus','json','count','offset','limit','status','set','Content-Range','save','end','stack','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','name','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','body','update','destroy','getConfigurations','DeskConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','DeskField','getFields','priority','authType','username','password','token','remoteUri','slice','lastIndexOf','GET','application/json','basic','headers','Authorization','format','%s:%s','base64','concat','_embedded','entries','active','label','test','statusCode','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x481baf,_0x29aab7){var _0x213654=function(_0x31d13c){while(--_0x31d13c){_0x481baf['push'](_0x481baf['shift']());}};_0x213654(++_0x29aab7);}(_0x7eed,0x1ce));var _0xd7ee=function(_0x337ef8,_0x3971ab){_0x337ef8=_0x337ef8-0x0;var _0x585b75=_0x7eed[_0x337ef8];return _0x585b75;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd7ee('0x0'));var zipdir=require(_0xd7ee('0x1'));var jsonpatch=require(_0xd7ee('0x2'));var rp=require(_0xd7ee('0x3'));var moment=require(_0xd7ee('0x4'));var BPromise=require(_0xd7ee('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd7ee('0x6'));var sox=require(_0xd7ee('0x7'));var csv=require(_0xd7ee('0x8'));var ejs=require(_0xd7ee('0x9'));var fs=require('fs');var fs_extra=require(_0xd7ee('0xa'));var _=require(_0xd7ee('0xb'));var squel=require(_0xd7ee('0xc'));var crypto=require(_0xd7ee('0xd'));var jsforce=require(_0xd7ee('0xe'));var deskjs=require(_0xd7ee('0xf'));var toCsv=require(_0xd7ee('0x8'));var querystring=require(_0xd7ee('0x10'));var Papa=require(_0xd7ee('0x11'));var Redis=require('ioredis');var authService=require(_0xd7ee('0x12'));var qs=require(_0xd7ee('0x13'));var as=require(_0xd7ee('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd7ee('0x15'))('api');var utils=require(_0xd7ee('0x16'));var config=require(_0xd7ee('0x17'));var licenseUtil=require(_0xd7ee('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xd7ee('0x19'));var jayson=require(_0xd7ee('0x1a'));var client=jayson[_0xd7ee('0x1b')][_0xd7ee('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2d0f6b,_0x30ffaf,_0x10206c,_0x12660f){return new BPromise(function(_0x5ef27f,_0x19ee78){var _0x2c5be0=_0x12660f||client;return _0x2c5be0['request'](_0x2d0f6b,_0x10206c)[_0xd7ee('0x1d')](function(_0x51ee00){logger[_0xd7ee('0x1e')](_0xd7ee('0x1f'),_0x30ffaf,_0xd7ee('0x20'));logger[_0xd7ee('0x21')](_0xd7ee('0x22'),_0x30ffaf,'request\x20sent',JSON[_0xd7ee('0x23')](_0x51ee00));if(_0x51ee00[_0xd7ee('0x24')]){if(_0x51ee00[_0xd7ee('0x24')]['code']===0x1f4){logger[_0xd7ee('0x24')]('DeskAccount,\x20%s,\x20%s',_0x30ffaf,_0x51ee00[_0xd7ee('0x24')][_0xd7ee('0x25')]);return _0x19ee78(_0x51ee00[_0xd7ee('0x24')][_0xd7ee('0x25')]);}logger[_0xd7ee('0x24')]('DeskAccount,\x20%s,\x20%s',_0x30ffaf,_0x51ee00[_0xd7ee('0x24')][_0xd7ee('0x25')]);return _0x5ef27f(_0x51ee00[_0xd7ee('0x24')][_0xd7ee('0x25')]);}else{logger[_0xd7ee('0x1e')](_0xd7ee('0x1f'),_0x30ffaf,_0xd7ee('0x20'));_0x5ef27f(_0x51ee00[_0xd7ee('0x26')]['message']);}})[_0xd7ee('0x27')](function(_0x482876){logger[_0xd7ee('0x24')](_0xd7ee('0x1f'),_0x30ffaf,_0x482876);_0x19ee78(_0x482876);});});}function respondWithStatusCode(_0x1bd510,_0x58b14b){_0x58b14b=_0x58b14b||0xcc;return function(_0x407284){if(_0x407284){return _0x1bd510[_0xd7ee('0x28')](_0x58b14b);}return _0x1bd510['status'](_0x58b14b)['end']();};}function respondWithResult(_0x178f6e,_0x402991){_0x402991=_0x402991||0xc8;return function(_0x368de5){if(_0x368de5){return _0x178f6e['status'](_0x402991)[_0xd7ee('0x29')](_0x368de5);}};}function respondWithFilteredResult(_0x57780b,_0x145544){return function(_0x25e01d){if(_0x25e01d){var _0x68e52d=_0x25e01d[_0xd7ee('0x2a')],_0x4e832d=_0x145544[_0xd7ee('0x2b')],_0x512eee=_0x145544['offset']+_0x145544[_0xd7ee('0x2c')],_0x19c913;if(_0x512eee>=_0x68e52d){_0x512eee=_0x68e52d;_0x19c913=0xc8;}else{_0x19c913=0xce;}_0x57780b[_0xd7ee('0x2d')](_0x19c913);return _0x57780b[_0xd7ee('0x2e')](_0xd7ee('0x2f'),_0x4e832d+'-'+_0x512eee+'/'+_0x68e52d)[_0xd7ee('0x29')](_0x25e01d);}return null;};}function patchUpdates(_0x56f472){return function(_0x117447){try{jsonpatch['apply'](_0x117447,_0x56f472,!![]);}catch(_0x1955d2){return BPromise['reject'](_0x1955d2);}return _0x117447[_0xd7ee('0x30')]();};}function saveUpdates(_0x41e5fd,_0x7bf7d2){return function(_0x33c192){if(_0x33c192){return _0x33c192['update'](_0x41e5fd)[_0xd7ee('0x1d')](function(_0x46b02a){return _0x46b02a;});}return null;};}function removeEntity(_0x523165,_0x3c6dab){return function(_0x2ba05e){if(_0x2ba05e){return _0x2ba05e['destroy']()[_0xd7ee('0x1d')](function(){_0x523165[_0xd7ee('0x2d')](0xcc)[_0xd7ee('0x31')]();});}};}function handleEntityNotFound(_0x6f2f54,_0x19069b){return function(_0x147494){if(!_0x147494){_0x6f2f54[_0xd7ee('0x28')](0x194);}return _0x147494;};}function handleError(_0x1bcca0,_0x477860){_0x477860=_0x477860||0x1f4;return function(_0x13c3c3){logger[_0xd7ee('0x24')](_0x13c3c3[_0xd7ee('0x32')]);if(_0x13c3c3['name']){delete _0x13c3c3['name'];}_0x1bcca0[_0xd7ee('0x2d')](_0x477860)[_0xd7ee('0x33')](_0x13c3c3);};}exports[_0xd7ee('0x34')]=function(_0x1aecba,_0x2cafa1){var _0x278e40={},_0x1ad830={},_0x2aad3e={'count':0x0,'rows':[]};var _0x5712cf=_[_0xd7ee('0x35')](db[_0xd7ee('0x36')][_0xd7ee('0x37')],function(_0x15b3a9){return{'name':_0x15b3a9[_0xd7ee('0x38')],'type':_0x15b3a9[_0xd7ee('0x39')][_0xd7ee('0x3a')]};});_0x1ad830[_0xd7ee('0x3b')]=_['map'](_0x5712cf,_0xd7ee('0x3c'));_0x1ad830['query']=_[_0xd7ee('0x3d')](_0x1aecba['query']);_0x1ad830[_0xd7ee('0x3e')]=_[_0xd7ee('0x3f')](_0x1ad830[_0xd7ee('0x3b')],_0x1ad830[_0xd7ee('0x40')]);_0x278e40[_0xd7ee('0x41')]=_[_0xd7ee('0x3f')](_0x1ad830['model'],qs[_0xd7ee('0x42')](_0x1aecba[_0xd7ee('0x40')][_0xd7ee('0x42')]));_0x278e40[_0xd7ee('0x41')]=_0x278e40['attributes'][_0xd7ee('0x43')]?_0x278e40['attributes']:_0x1ad830['model'];if(!_0x1aecba[_0xd7ee('0x40')]['hasOwnProperty'](_0xd7ee('0x44'))){_0x278e40['limit']=qs[_0xd7ee('0x2c')](_0x1aecba['query'][_0xd7ee('0x2c')]);_0x278e40['offset']=qs[_0xd7ee('0x2b')](_0x1aecba[_0xd7ee('0x40')]['offset']);}_0x278e40[_0xd7ee('0x45')]=qs[_0xd7ee('0x46')](_0x1aecba[_0xd7ee('0x40')]['sort']);_0x278e40[_0xd7ee('0x47')]=qs[_0xd7ee('0x3e')](_[_0xd7ee('0x48')](_0x1aecba['query'],_0x1ad830[_0xd7ee('0x3e')]),_0x5712cf);if(_0x1aecba[_0xd7ee('0x40')][_0xd7ee('0x49')]){_0x278e40['where']=_[_0xd7ee('0x4a')](_0x278e40[_0xd7ee('0x47')],{'$or':_[_0xd7ee('0x35')](_0x5712cf,function(_0x160dc3){if(_0x160dc3['type']!==_0xd7ee('0x4b')){var _0x251912={};_0x251912[_0x160dc3['name']]={'$like':'%'+_0x1aecba[_0xd7ee('0x40')][_0xd7ee('0x49')]+'%'};return _0x251912;}})});}_0x278e40=_[_0xd7ee('0x4a')]({},_0x278e40,_0x1aecba[_0xd7ee('0x4c')]);var _0x2ebe1e={'where':_0x278e40[_0xd7ee('0x47')]};return db[_0xd7ee('0x36')]['count'](_0x2ebe1e)[_0xd7ee('0x1d')](function(_0x7bfd05){_0x2aad3e[_0xd7ee('0x2a')]=_0x7bfd05;if(_0x1aecba[_0xd7ee('0x40')][_0xd7ee('0x4d')]){_0x278e40['include']=[{'all':!![]}];}return db[_0xd7ee('0x36')][_0xd7ee('0x4e')](_0x278e40);})[_0xd7ee('0x1d')](function(_0x1b1e3b){_0x2aad3e[_0xd7ee('0x4f')]=_0x1b1e3b;return _0x2aad3e;})[_0xd7ee('0x1d')](respondWithFilteredResult(_0x2cafa1,_0x278e40))[_0xd7ee('0x27')](handleError(_0x2cafa1,null));};exports[_0xd7ee('0x50')]=function(_0x9ce898,_0x18b76f){var _0x325f23={'raw':![],'where':{'id':_0x9ce898[_0xd7ee('0x51')]['id']}},_0x161d13={};_0x161d13[_0xd7ee('0x3b')]=_[_0xd7ee('0x3d')](db[_0xd7ee('0x36')][_0xd7ee('0x37')]);_0x161d13['query']=_[_0xd7ee('0x3d')](_0x9ce898[_0xd7ee('0x40')]);_0x161d13[_0xd7ee('0x3e')]=_[_0xd7ee('0x3f')](_0x161d13['model'],_0x161d13['query']);_0x325f23[_0xd7ee('0x41')]=_[_0xd7ee('0x3f')](_0x161d13['model'],qs[_0xd7ee('0x42')](_0x9ce898[_0xd7ee('0x40')][_0xd7ee('0x42')]));_0x325f23['attributes']=_0x325f23['attributes']['length']?_0x325f23[_0xd7ee('0x41')]:_0x161d13['model'];if(_0x9ce898[_0xd7ee('0x40')]['includeAll']){_0x325f23[_0xd7ee('0x52')]=[{'all':!![]}];}_0x325f23=_['merge']({},_0x325f23,_0x9ce898[_0xd7ee('0x4c')]);return db[_0xd7ee('0x36')][_0xd7ee('0x53')](_0x325f23)['then'](handleEntityNotFound(_0x18b76f,null))[_0xd7ee('0x1d')](respondWithResult(_0x18b76f,null))['catch'](handleError(_0x18b76f,null));};exports['create']=function(_0x402eac,_0x4487ac){return db['DeskAccount']['create'](_0x402eac[_0xd7ee('0x54')],{})[_0xd7ee('0x1d')](respondWithResult(_0x4487ac,0xc9))[_0xd7ee('0x27')](handleError(_0x4487ac,null));};exports[_0xd7ee('0x55')]=function(_0x55528b,_0x2c52ec){if(_0x55528b['body']['id']){delete _0x55528b[_0xd7ee('0x54')]['id'];}return db[_0xd7ee('0x36')][_0xd7ee('0x53')]({'where':{'id':_0x55528b[_0xd7ee('0x51')]['id']}})[_0xd7ee('0x1d')](handleEntityNotFound(_0x2c52ec,null))[_0xd7ee('0x1d')](saveUpdates(_0x55528b['body'],null))[_0xd7ee('0x1d')](respondWithResult(_0x2c52ec,null))[_0xd7ee('0x27')](handleError(_0x2c52ec,null));};exports[_0xd7ee('0x56')]=function(_0x3b8d77,_0x333dc1){return db[_0xd7ee('0x36')]['find']({'where':{'id':_0x3b8d77['params']['id']}})['then'](handleEntityNotFound(_0x333dc1,null))[_0xd7ee('0x1d')](removeEntity(_0x333dc1,null))[_0xd7ee('0x27')](handleError(_0x333dc1,null));};exports[_0xd7ee('0x57')]=function(_0x23e3dd,_0x12fd62,_0x3f738c){var _0x30537c={};var _0x70787c={};var _0x50cd7f;var _0x3e09a5;return db[_0xd7ee('0x36')]['findOne']({'where':{'id':_0x23e3dd[_0xd7ee('0x51')]['id']}})[_0xd7ee('0x1d')](handleEntityNotFound(_0x12fd62,null))['then'](function(_0x20d9da){if(_0x20d9da){_0x50cd7f=_0x20d9da;_0x70787c[_0xd7ee('0x3b')]=_['keys'](db[_0xd7ee('0x58')][_0xd7ee('0x37')]);_0x70787c['query']=_[_0xd7ee('0x3d')](_0x23e3dd[_0xd7ee('0x40')]);_0x70787c[_0xd7ee('0x3e')]=_[_0xd7ee('0x3f')](_0x70787c['model'],_0x70787c[_0xd7ee('0x40')]);_0x30537c[_0xd7ee('0x41')]=_[_0xd7ee('0x3f')](_0x70787c[_0xd7ee('0x3b')],qs[_0xd7ee('0x42')](_0x23e3dd['query'][_0xd7ee('0x42')]));_0x30537c[_0xd7ee('0x41')]=_0x30537c[_0xd7ee('0x41')][_0xd7ee('0x43')]?_0x30537c[_0xd7ee('0x41')]:_0x70787c['model'];_0x30537c['order']=qs[_0xd7ee('0x46')](_0x23e3dd[_0xd7ee('0x40')][_0xd7ee('0x46')]);_0x30537c[_0xd7ee('0x47')]=qs[_0xd7ee('0x3e')](_[_0xd7ee('0x48')](_0x23e3dd['query'],_0x70787c[_0xd7ee('0x3e')]));if(_0x23e3dd[_0xd7ee('0x40')][_0xd7ee('0x49')]){_0x30537c[_0xd7ee('0x47')]=_[_0xd7ee('0x4a')](_0x30537c[_0xd7ee('0x47')],{'$or':_['map'](_0x30537c['attributes'],function(_0x1c465e){var _0xafe2f0={};_0xafe2f0[_0x1c465e]={'$like':'%'+_0x23e3dd[_0xd7ee('0x40')][_0xd7ee('0x49')]+'%'};return _0xafe2f0;})});}_0x30537c=_[_0xd7ee('0x4a')]({},_0x30537c,_0x23e3dd[_0xd7ee('0x4c')]);return _0x50cd7f[_0xd7ee('0x57')](_0x30537c);}})[_0xd7ee('0x1d')](function(_0x106212){if(_0x106212){_0x3e09a5=_0x106212[_0xd7ee('0x43')];if(!_0x23e3dd[_0xd7ee('0x40')][_0xd7ee('0x59')](_0xd7ee('0x44'))){_0x30537c[_0xd7ee('0x2c')]=qs[_0xd7ee('0x2c')](_0x23e3dd[_0xd7ee('0x40')][_0xd7ee('0x2c')]);_0x30537c[_0xd7ee('0x2b')]=qs[_0xd7ee('0x2b')](_0x23e3dd[_0xd7ee('0x40')]['offset']);}return _0x50cd7f[_0xd7ee('0x57')](_0x30537c);}})[_0xd7ee('0x1d')](function(_0x4c40da){if(_0x4c40da){return _0x4c40da?{'count':_0x3e09a5,'rows':_0x4c40da}:null;}})[_0xd7ee('0x1d')](respondWithResult(_0x12fd62,null))[_0xd7ee('0x27')](handleError(_0x12fd62,null));};exports[_0xd7ee('0x5a')]=function(_0x1c6005,_0x52c7d8,_0x76cf5){if(_0x1c6005[_0xd7ee('0x54')]['id']){delete _0x1c6005[_0xd7ee('0x54')]['id'];}return db[_0xd7ee('0x36')][_0xd7ee('0x5b')]({'where':{'id':_0x1c6005[_0xd7ee('0x51')]['id']}})[_0xd7ee('0x1d')](handleEntityNotFound(_0x52c7d8,null))[_0xd7ee('0x1d')](function(_0x6a2d1c){if(_0x6a2d1c){_0x1c6005[_0xd7ee('0x54')][_0xd7ee('0x5c')]=_0x6a2d1c['id'];_0x1c6005['body'][_0xd7ee('0x5d')]=integrations[_0xd7ee('0x5e')](_0x1c6005[_0xd7ee('0x54')][_0xd7ee('0x5f')],_0x1c6005['body'][_0xd7ee('0x39')]);_0x1c6005[_0xd7ee('0x54')][_0xd7ee('0x60')]=integrations[_0xd7ee('0x61')](_0x1c6005[_0xd7ee('0x54')][_0xd7ee('0x5f')],_0x1c6005[_0xd7ee('0x54')][_0xd7ee('0x39')]);return db[_0xd7ee('0x58')][_0xd7ee('0x62')](_0x1c6005[_0xd7ee('0x54')],{'include':[{'model':db[_0xd7ee('0x63')],'as':_0xd7ee('0x5d')},{'model':db['DeskField'],'as':_0xd7ee('0x60')}]});}return null;})[_0xd7ee('0x1d')](respondWithResult(_0x52c7d8,null))[_0xd7ee('0x27')](handleError(_0x52c7d8,null));};exports[_0xd7ee('0x64')]=function(_0x1557ff,_0xd053ca,_0x684d6c){var _0x196dd4=[{'name':_0xd7ee('0x65'),'label':_0xd7ee('0x65'),'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 _0xdf7a42='';return db[_0xd7ee('0x36')][_0xd7ee('0x5b')]({'where':{'id':_0x1557ff[_0xd7ee('0x51')]['id']},'attributes':['id','remoteUri',_0xd7ee('0x66'),_0xd7ee('0x67'),_0xd7ee('0x68'),'consumerKey','consumerSecret',_0xd7ee('0x69'),'tokenSecret']})[_0xd7ee('0x1d')](handleEntityNotFound(_0xd053ca,null))['then'](function(_0x1d33ae){if(_0x1d33ae){_0xdf7a42=_0x1d33ae[_0xd7ee('0x6a')];var _0x34a452=_0xdf7a42[_0xd7ee('0x6b')](-0x1);if(_0x34a452==='/'){_0xdf7a42=_0xdf7a42['substring'](0x0,_0xdf7a42[_0xd7ee('0x6c')](_0x34a452));}var _0x59379e={'method':_0xd7ee('0x6d'),'uri':util['format']('%s/custom_fields',_0xdf7a42),'headers':{'Content-Type':_0xd7ee('0x6e'),'Accept':_0xd7ee('0x6e')},'json':!![]};if(_0x1d33ae[_0xd7ee('0x66')]===_0xd7ee('0x6f')){_0x59379e[_0xd7ee('0x70')][_0xd7ee('0x71')]=util[_0xd7ee('0x72')]('Basic\x20%s',new Buffer(util['format'](_0xd7ee('0x73'),_0x1d33ae[_0xd7ee('0x67')],_0x1d33ae['password']))['toString'](_0xd7ee('0x74')));}return rp(_0x59379e)['then'](function(_0x521248){return _0x196dd4[_0xd7ee('0x75')](_['map'](_0x521248[_0xd7ee('0x76')][_0xd7ee('0x77')],function(_0x544f2d){return{'id':_0x544f2d[_0xd7ee('0x3c')],'name':_0x544f2d[_0xd7ee('0x3c')],'type':_0x544f2d['type'],'active':_0x544f2d[_0xd7ee('0x78')],'label':_0x544f2d[_0xd7ee('0x79')],'custom':!![]};}));});}})[_0xd7ee('0x1d')](function(_0x12fd71){return{'count':_0x12fd71[_0xd7ee('0x43')],'rows':_0x12fd71};})[_0xd7ee('0x1d')](respondWithResult(_0xd053ca,null))['catch'](function(_0x43d703){var _0x219bf0=_0x1557ff[_0xd7ee('0x40')][_0xd7ee('0x7a')]?0x1f4:_0x43d703[_0xd7ee('0x7b')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xd7ee('0x64'),_0x219bf0,JSON['stringify'](_0x43d703));delete _0x43d703['name'];if(_0x219bf0===0x191){_0x219bf0=0x190;}_0xd053ca[_0xd7ee('0x2d')](_0x219bf0)['send'](_0x1557ff['query']['test']?{'message':_0xd7ee('0x7c'),'statusCode':_0x43d703[_0xd7ee('0x7b')]}:_0x43d703);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index cfd9241..2a4bc9a 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 _0x7bfe=['define','DeskAccount','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7bfe,0xfe));var _0xe7bf=function(_0x24c5e0,_0x2a6620){_0x24c5e0=_0x24c5e0-0x0;var _0x54278a=_0x7bfe[_0x24c5e0];return _0x54278a;};'use strict';var _=require(_0xe7bf('0x0'));var util=require(_0xe7bf('0x1'));var logger=require(_0xe7bf('0x2'))('api');var moment=require(_0xe7bf('0x3'));var BPromise=require(_0xe7bf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe7bf('0x5'));var config=require(_0xe7bf('0x6'));var attributes=require(_0xe7bf('0x7'));var integrations=require(_0xe7bf('0x8'));module[_0xe7bf('0x9')]=function(_0x21f9f9,_0x549d96){return _0x21f9f9[_0xe7bf('0xa')](_0xe7bf('0xb'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb657=['moment','bluebird','path','rimraf','./intDeskAccount.attributes','exports','define','util','../../config/logger','api'];(function(_0x46f2cd,_0x3ee2b4){var _0x308e70=function(_0x1542e9){while(--_0x1542e9){_0x46f2cd['push'](_0x46f2cd['shift']());}};_0x308e70(++_0x3ee2b4);}(_0xb657,0x1ab));var _0x7b65=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xb657[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require('lodash');var util=require(_0x7b65('0x0'));var logger=require(_0x7b65('0x1'))(_0x7b65('0x2'));var moment=require(_0x7b65('0x3'));var BPromise=require(_0x7b65('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b65('0x5'));var rimraf=require(_0x7b65('0x6'));var config=require('../../config/environment');var attributes=require(_0x7b65('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x7b65('0x8')]=function(_0x40f9d8,_0x24155b){return _0x40f9d8[_0x7b65('0x9')]('DeskAccount',attributes,{'tableName':'int_desk_accounts','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 e32df8a..673c9e2 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 _0x635a=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetDeskAccount','DeskAccount','findAll','options','attributes','include','map','find','where','model','ShowDeskAccount','lodash'];(function(_0x263ed6,_0x310444){var _0xa12e8a=function(_0xa0e72a){while(--_0xa0e72a){_0x263ed6['push'](_0x263ed6['shift']());}};_0xa12e8a(++_0x310444);}(_0x635a,0x87));var _0xa635=function(_0x216412,_0x26f02b){_0x216412=_0x216412-0x0;var _0x449874=_0x635a[_0x216412];return _0x449874;};'use strict';var _=require(_0xa635('0x0'));var util=require('util');var moment=require(_0xa635('0x1'));var BPromise=require(_0xa635('0x2'));var rs=require(_0xa635('0x3'));var fs=require('fs');var Redis=require(_0xa635('0x4'));var db=require(_0xa635('0x5'))['db'];var utils=require(_0xa635('0x6'));var logger=require(_0xa635('0x7'))(_0xa635('0x8'));var config=require('../../config/environment');var jayson=require(_0xa635('0x9'));var client=jayson['client'][_0xa635('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1431f4,_0x333f5e,_0x24227b){return new BPromise(function(_0x4aa3c3,_0x3c6cf9){return client[_0xa635('0xb')](_0x1431f4,_0x24227b)[_0xa635('0xc')](function(_0x296157){logger['info'](_0xa635('0xd'),_0x333f5e,_0xa635('0xe'));logger[_0xa635('0xf')](_0xa635('0x10'),_0x333f5e,_0xa635('0xe'),JSON[_0xa635('0x11')](_0x296157));if(_0x296157[_0xa635('0x12')]){if(_0x296157[_0xa635('0x12')]['code']===0x1f4){logger[_0xa635('0x12')](_0xa635('0xd'),_0x333f5e,_0x296157[_0xa635('0x12')][_0xa635('0x13')]);return _0x3c6cf9(_0x296157[_0xa635('0x12')][_0xa635('0x13')]);}logger[_0xa635('0x12')](_0xa635('0xd'),_0x333f5e,_0x296157[_0xa635('0x12')][_0xa635('0x13')]);return _0x4aa3c3(_0x296157[_0xa635('0x12')][_0xa635('0x13')]);}else{logger[_0xa635('0x14')]('DeskAccount,\x20%s,\x20%s',_0x333f5e,_0xa635('0xe'));_0x4aa3c3(_0x296157[_0xa635('0x15')][_0xa635('0x13')]);}})[_0xa635('0x16')](function(_0x4b6c9a){logger[_0xa635('0x12')](_0xa635('0xd'),_0x333f5e,_0x4b6c9a);_0x3c6cf9(_0x4b6c9a);});});}exports[_0xa635('0x17')]=function(_0x16eba9){var _0x24ab8c=this;return new Promise(function(_0x4e0e63,_0x16117d){return db[_0xa635('0x18')][_0xa635('0x19')]({'raw':_0x16eba9[_0xa635('0x1a')]?_0x16eba9['options']['raw']===undefined?!![]:![]:!![],'where':_0x16eba9[_0xa635('0x1a')]?_0x16eba9[_0xa635('0x1a')]['where']||null:null,'attributes':_0x16eba9[_0xa635('0x1a')]?_0x16eba9[_0xa635('0x1a')][_0xa635('0x1b')]||null:null,'limit':_0x16eba9[_0xa635('0x1a')]?_0x16eba9[_0xa635('0x1a')]['limit']||null:null,'include':_0x16eba9[_0xa635('0x1a')]?_0x16eba9[_0xa635('0x1a')][_0xa635('0x1c')]?_[_0xa635('0x1d')](_0x16eba9[_0xa635('0x1a')][_0xa635('0x1c')],function(_0x192dcb){return{'model':db[_0x192dcb['model']],'as':_0x192dcb['as'],'attributes':_0x192dcb[_0xa635('0x1b')],'include':_0x192dcb[_0xa635('0x1c')]?_[_0xa635('0x1d')](_0x192dcb['include'],function(_0x2bba91){return{'model':db[_0x2bba91['model']],'as':_0x2bba91['as'],'attributes':_0x2bba91[_0xa635('0x1b')],'include':_0x2bba91[_0xa635('0x1c')]?_[_0xa635('0x1d')](_0x2bba91[_0xa635('0x1c')],function(_0x19d1c0){return{'model':db[_0x19d1c0['model']],'as':_0x19d1c0['as'],'attributes':_0x19d1c0[_0xa635('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa635('0xc')](function(_0x55dc73){logger[_0xa635('0x14')]('GetDeskAccount',_0x16eba9);logger[_0xa635('0xf')](_0xa635('0x17'),_0x16eba9,JSON[_0xa635('0x11')](_0x55dc73));_0x4e0e63(_0x55dc73);})[_0xa635('0x16')](function(_0x589376){logger[_0xa635('0x12')]('GetDeskAccount',_0x589376['message'],_0x16eba9);_0x16117d(_0x24ab8c['error'](0x1f4,_0x589376[_0xa635('0x13')]));});});};exports['ShowDeskAccount']=function(_0x4903f5){var _0x8105d5=this;return new Promise(function(_0x445313,_0x194737){return db[_0xa635('0x18')][_0xa635('0x1e')]({'raw':_0x4903f5['options']?_0x4903f5[_0xa635('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4903f5[_0xa635('0x1a')]?_0x4903f5[_0xa635('0x1a')][_0xa635('0x1f')]||null:null,'attributes':_0x4903f5[_0xa635('0x1a')]?_0x4903f5[_0xa635('0x1a')][_0xa635('0x1b')]||null:null,'include':_0x4903f5[_0xa635('0x1a')]?_0x4903f5[_0xa635('0x1a')][_0xa635('0x1c')]?_['map'](_0x4903f5['options'][_0xa635('0x1c')],function(_0x59f34f){return{'model':db[_0x59f34f[_0xa635('0x20')]],'as':_0x59f34f['as'],'attributes':_0x59f34f[_0xa635('0x1b')],'include':_0x59f34f['include']?_['map'](_0x59f34f['include'],function(_0x23c046){return{'model':db[_0x23c046[_0xa635('0x20')]],'as':_0x23c046['as'],'attributes':_0x23c046['attributes'],'include':_0x23c046[_0xa635('0x1c')]?_[_0xa635('0x1d')](_0x23c046[_0xa635('0x1c')],function(_0x4cbf0b){return{'model':db[_0x4cbf0b[_0xa635('0x20')]],'as':_0x4cbf0b['as'],'attributes':_0x4cbf0b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x12e904){logger[_0xa635('0x14')](_0xa635('0x21'),_0x4903f5);logger[_0xa635('0xf')](_0xa635('0x21'),_0x4903f5,JSON['stringify'](_0x12e904));_0x445313(_0x12e904);})[_0xa635('0x16')](function(_0x35394c){logger['error'](_0xa635('0x21'),_0x35394c['message'],_0x4903f5);_0x194737(_0x8105d5[_0xa635('0x12')](0x1f4,_0x35394c[_0xa635('0x13')]));});});}; \ No newline at end of file +var _0x1aa2=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskAccount,\x20%s,\x20%s','result','catch','DeskAccount','findAll','options','where','limit','include','model','attributes','map','GetDeskAccount','find','raw','ShowDeskAccount','lodash'];(function(_0x1e4f50,_0x5b9e4c){var _0x5957ee=function(_0x2b7b49){while(--_0x2b7b49){_0x1e4f50['push'](_0x1e4f50['shift']());}};_0x5957ee(++_0x5b9e4c);}(_0x1aa2,0x1c6));var _0x21aa=function(_0x47bc58,_0x1e1998){_0x47bc58=_0x47bc58-0x0;var _0x4a0860=_0x1aa2[_0x47bc58];return _0x4a0860;};'use strict';var _=require(_0x21aa('0x0'));var util=require(_0x21aa('0x1'));var moment=require('moment');var BPromise=require(_0x21aa('0x2'));var rs=require(_0x21aa('0x3'));var fs=require('fs');var Redis=require(_0x21aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x21aa('0x5'));var logger=require(_0x21aa('0x6'))(_0x21aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x21aa('0x8')][_0x21aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30e4d3,_0x388664,_0xc7b364){return new BPromise(function(_0x2d8f1a,_0x16be51){return client['request'](_0x30e4d3,_0xc7b364)[_0x21aa('0xa')](function(_0x36b130){logger[_0x21aa('0xb')]('DeskAccount,\x20%s,\x20%s',_0x388664,_0x21aa('0xc'));logger[_0x21aa('0xd')](_0x21aa('0xe'),_0x388664,'request\x20sent',JSON[_0x21aa('0xf')](_0x36b130));if(_0x36b130[_0x21aa('0x10')]){if(_0x36b130[_0x21aa('0x10')][_0x21aa('0x11')]===0x1f4){logger[_0x21aa('0x10')]('DeskAccount,\x20%s,\x20%s',_0x388664,_0x36b130[_0x21aa('0x10')][_0x21aa('0x12')]);return _0x16be51(_0x36b130[_0x21aa('0x10')][_0x21aa('0x12')]);}logger['error'](_0x21aa('0x13'),_0x388664,_0x36b130[_0x21aa('0x10')][_0x21aa('0x12')]);return _0x2d8f1a(_0x36b130[_0x21aa('0x10')]['message']);}else{logger[_0x21aa('0xb')]('DeskAccount,\x20%s,\x20%s',_0x388664,_0x21aa('0xc'));_0x2d8f1a(_0x36b130[_0x21aa('0x14')][_0x21aa('0x12')]);}})[_0x21aa('0x15')](function(_0x434aec){logger['error']('DeskAccount,\x20%s,\x20%s',_0x388664,_0x434aec);_0x16be51(_0x434aec);});});}exports['GetDeskAccount']=function(_0x5345e0){var _0x2a13cf=this;return new Promise(function(_0x236bb7,_0x16fcd1){return db[_0x21aa('0x16')][_0x21aa('0x17')]({'raw':_0x5345e0[_0x21aa('0x18')]?_0x5345e0[_0x21aa('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5345e0['options']?_0x5345e0[_0x21aa('0x18')][_0x21aa('0x19')]||null:null,'attributes':_0x5345e0[_0x21aa('0x18')]?_0x5345e0['options']['attributes']||null:null,'limit':_0x5345e0[_0x21aa('0x18')]?_0x5345e0[_0x21aa('0x18')][_0x21aa('0x1a')]||null:null,'include':_0x5345e0[_0x21aa('0x18')]?_0x5345e0[_0x21aa('0x18')][_0x21aa('0x1b')]?_['map'](_0x5345e0['options'][_0x21aa('0x1b')],function(_0x160a6c){return{'model':db[_0x160a6c[_0x21aa('0x1c')]],'as':_0x160a6c['as'],'attributes':_0x160a6c[_0x21aa('0x1d')],'include':_0x160a6c[_0x21aa('0x1b')]?_['map'](_0x160a6c[_0x21aa('0x1b')],function(_0x42b26e){return{'model':db[_0x42b26e[_0x21aa('0x1c')]],'as':_0x42b26e['as'],'attributes':_0x42b26e[_0x21aa('0x1d')],'include':_0x42b26e[_0x21aa('0x1b')]?_[_0x21aa('0x1e')](_0x42b26e[_0x21aa('0x1b')],function(_0x32a133){return{'model':db[_0x32a133[_0x21aa('0x1c')]],'as':_0x32a133['as'],'attributes':_0x32a133['attributes']};}):[]};}):[]};}):[]:[]})[_0x21aa('0xa')](function(_0x4cfd8b){logger[_0x21aa('0xb')](_0x21aa('0x1f'),_0x5345e0);logger[_0x21aa('0xd')](_0x21aa('0x1f'),_0x5345e0,JSON[_0x21aa('0xf')](_0x4cfd8b));_0x236bb7(_0x4cfd8b);})[_0x21aa('0x15')](function(_0xc46acd){logger[_0x21aa('0x10')](_0x21aa('0x1f'),_0xc46acd[_0x21aa('0x12')],_0x5345e0);_0x16fcd1(_0x2a13cf['error'](0x1f4,_0xc46acd[_0x21aa('0x12')]));});});};exports['ShowDeskAccount']=function(_0x26b8e1){var _0x55982c=this;return new Promise(function(_0xd9028c,_0x2401ba){return db[_0x21aa('0x16')][_0x21aa('0x20')]({'raw':_0x26b8e1[_0x21aa('0x18')]?_0x26b8e1['options'][_0x21aa('0x21')]===undefined?!![]:![]:!![],'where':_0x26b8e1[_0x21aa('0x18')]?_0x26b8e1['options'][_0x21aa('0x19')]||null:null,'attributes':_0x26b8e1['options']?_0x26b8e1[_0x21aa('0x18')][_0x21aa('0x1d')]||null:null,'include':_0x26b8e1[_0x21aa('0x18')]?_0x26b8e1['options'][_0x21aa('0x1b')]?_[_0x21aa('0x1e')](_0x26b8e1['options'][_0x21aa('0x1b')],function(_0xdcdec){return{'model':db[_0xdcdec[_0x21aa('0x1c')]],'as':_0xdcdec['as'],'attributes':_0xdcdec[_0x21aa('0x1d')],'include':_0xdcdec[_0x21aa('0x1b')]?_[_0x21aa('0x1e')](_0xdcdec['include'],function(_0xbb5af3){return{'model':db[_0xbb5af3[_0x21aa('0x1c')]],'as':_0xbb5af3['as'],'attributes':_0xbb5af3['attributes'],'include':_0xbb5af3[_0x21aa('0x1b')]?_['map'](_0xbb5af3[_0x21aa('0x1b')],function(_0x32792c){return{'model':db[_0x32792c[_0x21aa('0x1c')]],'as':_0x32792c['as'],'attributes':_0x32792c['attributes']};}):[]};}):[]};}):[]:[]})[_0x21aa('0xa')](function(_0x59300f){logger[_0x21aa('0xb')](_0x21aa('0x22'),_0x26b8e1);logger[_0x21aa('0xd')](_0x21aa('0x22'),_0x26b8e1,JSON[_0x21aa('0xf')](_0x59300f));_0xd9028c(_0x59300f);})[_0x21aa('0x15')](function(_0x5eac74){logger[_0x21aa('0x10')](_0x21aa('0x22'),_0x5eac74[_0x21aa('0x12')],_0x26b8e1);_0x2401ba(_0x55982c[_0x21aa('0x10')](0x1f4,_0x5eac74[_0x21aa('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index a299a4e..8ee8e89 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 _0x3728=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getTags','post','create','setTags','put','update','delete'];(function(_0x2e41ca,_0x5295da){var _0xecad42=function(_0x46a021){while(--_0x46a021){_0x2e41ca['push'](_0x2e41ca['shift']());}};_0xecad42(++_0x5295da);}(_0x3728,0x1b2));var _0x8372=function(_0xc8f086,_0x17f629){_0xc8f086=_0xc8f086-0x0;var _0x1b4f7e=_0x3728[_0xc8f086];return _0x1b4f7e;};'use strict';var multer=require(_0x8372('0x0'));var util=require(_0x8372('0x1'));var path=require(_0x8372('0x2'));var timeout=require(_0x8372('0x3'));var express=require(_0x8372('0x4'));var router=express[_0x8372('0x5')]();var fs_extra=require(_0x8372('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8372('0x7'));var controller=require('./intDeskConfiguration.controller');router[_0x8372('0x8')]('/',auth[_0x8372('0x9')](),controller[_0x8372('0xa')]);router[_0x8372('0x8')](_0x8372('0xb'),auth[_0x8372('0x9')](),controller[_0x8372('0xc')]);router[_0x8372('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x8372('0xd')]);router[_0x8372('0x8')](_0x8372('0xe'),auth[_0x8372('0x9')](),controller['getSubjects']);router[_0x8372('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x8372('0x8')]('/:id/tags',auth[_0x8372('0x9')](),controller[_0x8372('0xf')]);router[_0x8372('0x10')]('/',auth[_0x8372('0x9')](),controller[_0x8372('0x11')]);router[_0x8372('0x10')]('/:id/tags',auth[_0x8372('0x9')](),controller[_0x8372('0x12')]);router[_0x8372('0x13')](_0x8372('0xb'),auth['isAuthenticated'](),controller[_0x8372('0x14')]);router[_0x8372('0x15')](_0x8372('0xb'),auth[_0x8372('0x9')](),controller[_0x8372('0x16')]);module[_0x8372('0x17')]=router; \ No newline at end of file +var _0x76a0=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0xc3aae7,_0x3bfa91){var _0x1f365a=function(_0x465838){while(--_0x465838){_0xc3aae7['push'](_0xc3aae7['shift']());}};_0x1f365a(++_0x3bfa91);}(_0x76a0,0x19f));var _0x076a=function(_0x11ba46,_0x1d6752){_0x11ba46=_0x11ba46-0x0;var _0x1c8c6f=_0x76a0[_0x11ba46];return _0x1c8c6f;};'use strict';var multer=require(_0x076a('0x0'));var util=require(_0x076a('0x1'));var path=require(_0x076a('0x2'));var timeout=require(_0x076a('0x3'));var express=require(_0x076a('0x4'));var router=express['Router']();var fs_extra=require(_0x076a('0x5'));var auth=require(_0x076a('0x6'));var interaction=require(_0x076a('0x7'));var config=require(_0x076a('0x8'));var controller=require('./intDeskConfiguration.controller');router[_0x076a('0x9')]('/',auth[_0x076a('0xa')](),controller[_0x076a('0xb')]);router[_0x076a('0x9')](_0x076a('0xc'),auth['isAuthenticated'](),controller[_0x076a('0xd')]);router[_0x076a('0x9')]('/:id/fields',auth[_0x076a('0xa')](),controller[_0x076a('0xe')]);router[_0x076a('0x9')](_0x076a('0xf'),auth[_0x076a('0xa')](),controller[_0x076a('0x10')]);router[_0x076a('0x9')](_0x076a('0x11'),auth[_0x076a('0xa')](),controller[_0x076a('0x12')]);router[_0x076a('0x9')](_0x076a('0x13'),auth['isAuthenticated'](),controller[_0x076a('0x14')]);router[_0x076a('0x15')]('/',auth[_0x076a('0xa')](),controller[_0x076a('0x16')]);router[_0x076a('0x15')](_0x076a('0x13'),auth['isAuthenticated'](),controller[_0x076a('0x17')]);router[_0x076a('0x18')](_0x076a('0xc'),auth[_0x076a('0xa')](),controller['update']);router[_0x076a('0x19')](_0x076a('0xc'),auth[_0x076a('0xa')](),controller[_0x076a('0x1a')]);module[_0x076a('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 988bfb3..97ba841 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 _0xeae2=['sequelize','STRING'];(function(_0x37b79e,_0x2a8f83){var _0x101e97=function(_0x1021bd){while(--_0x1021bd){_0x37b79e['push'](_0x37b79e['shift']());}};_0x101e97(++_0x2a8f83);}(_0xeae2,0xf0));var _0x2eae=function(_0x20db8d,_0x402693){_0x20db8d=_0x20db8d-0x0;var _0x138dec=_0xeae2[_0x20db8d];return _0x138dec;};'use strict';var Sequelize=require(_0x2eae('0x0'));module['exports']={'name':{'type':Sequelize[_0x2eae('0x1')]},'description':{'type':Sequelize[_0x2eae('0x1')]}}; \ No newline at end of file +var _0x86ee=['sequelize','exports','STRING'];(function(_0x1a89ca,_0x27394b){var _0x29cbb2=function(_0x31e1f4){while(--_0x31e1f4){_0x1a89ca['push'](_0x1a89ca['shift']());}};_0x29cbb2(++_0x27394b);}(_0x86ee,0x1e9));var _0xe86e=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x86ee[_0x13b8f3];return _0x1a6d06;};'use strict';var Sequelize=require(_0xe86e('0x0'));module[_0xe86e('0x1')]={'name':{'type':Sequelize[_0xe86e('0x2')]},'description':{'type':Sequelize[_0xe86e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index c033b22..81a6809 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 _0xf88a=['fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','sendStatus','status','json','count','offset','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','DeskConfiguration','includeAll','include','findAll','show','rawAttributes','length','find','create','body','params','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','moment','mustache','util','path','sox','to-csv','ejs'];(function(_0x240e46,_0x141d91){var _0x9bc15e=function(_0x2ab50e){while(--_0x2ab50e){_0x240e46['push'](_0x240e46['shift']());}};_0x9bc15e(++_0x141d91);}(_0xf88a,0xaf));var _0xaf88=function(_0x32c420,_0x28ca10){_0x32c420=_0x32c420-0x0;var _0x5681a7=_0xf88a[_0x32c420];return _0x5681a7;};'use strict';var emlformat=require(_0xaf88('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaf88('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaf88('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xaf88('0x3'));var util=require(_0xaf88('0x4'));var path=require(_0xaf88('0x5'));var sox=require(_0xaf88('0x6'));var csv=require(_0xaf88('0x7'));var ejs=require(_0xaf88('0x8'));var fs=require('fs');var fs_extra=require(_0xaf88('0x9'));var _=require(_0xaf88('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xaf88('0xb'));var deskjs=require(_0xaf88('0xc'));var toCsv=require('to-csv');var querystring=require(_0xaf88('0xd'));var Papa=require('papaparse');var Redis=require(_0xaf88('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xaf88('0xf'));var as=require(_0xaf88('0x10'));var hardwareService=require(_0xaf88('0x11'));var logger=require(_0xaf88('0x12'))(_0xaf88('0x13'));var utils=require(_0xaf88('0x14'));var config=require(_0xaf88('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xaf88('0x16'))['db'];var jayson=require(_0xaf88('0x17'));var client=jayson[_0xaf88('0x18')][_0xaf88('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x23bc4,_0x4a2b8e,_0x58e9ab,_0x350a5b){return new BPromise(function(_0x435231,_0x1d28b9){var _0x569ed2=_0x350a5b||client;return _0x569ed2['request'](_0x23bc4,_0x58e9ab)[_0xaf88('0x1a')](function(_0x4e0649){logger['info'](_0xaf88('0x1b'),_0x4a2b8e,_0xaf88('0x1c'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4a2b8e,_0xaf88('0x1c'),JSON[_0xaf88('0x1d')](_0x4e0649));if(_0x4e0649[_0xaf88('0x1e')]){if(_0x4e0649[_0xaf88('0x1e')][_0xaf88('0x1f')]===0x1f4){logger[_0xaf88('0x1e')](_0xaf88('0x1b'),_0x4a2b8e,_0x4e0649[_0xaf88('0x1e')]['message']);return _0x1d28b9(_0x4e0649[_0xaf88('0x1e')][_0xaf88('0x20')]);}logger[_0xaf88('0x1e')](_0xaf88('0x1b'),_0x4a2b8e,_0x4e0649[_0xaf88('0x1e')]['message']);return _0x435231(_0x4e0649[_0xaf88('0x1e')][_0xaf88('0x20')]);}else{logger[_0xaf88('0x21')]('DeskConfiguration,\x20%s,\x20%s',_0x4a2b8e,_0xaf88('0x1c'));_0x435231(_0x4e0649['result']['message']);}})[_0xaf88('0x22')](function(_0x7e4d01){logger[_0xaf88('0x1e')](_0xaf88('0x1b'),_0x4a2b8e,_0x7e4d01);_0x1d28b9(_0x7e4d01);});});}function respondWithStatusCode(_0x478345,_0x4f8fdd){_0x4f8fdd=_0x4f8fdd||0xcc;return function(_0x3c0c26){if(_0x3c0c26){return _0x478345[_0xaf88('0x23')](_0x4f8fdd);}return _0x478345[_0xaf88('0x24')](_0x4f8fdd)['end']();};}function respondWithResult(_0x43ec8f,_0x32a61d){_0x32a61d=_0x32a61d||0xc8;return function(_0x106036){if(_0x106036){return _0x43ec8f[_0xaf88('0x24')](_0x32a61d)[_0xaf88('0x25')](_0x106036);}};}function respondWithFilteredResult(_0x1b0fd3,_0x2b71ce){return function(_0x4d750c){if(_0x4d750c){var _0x3fbe4f=_0x4d750c[_0xaf88('0x26')],_0x3e5d3c=_0x2b71ce[_0xaf88('0x27')],_0x3ef734=_0x2b71ce['offset']+_0x2b71ce['limit'],_0x2b1725;if(_0x3ef734>=_0x3fbe4f){_0x3ef734=_0x3fbe4f;_0x2b1725=0xc8;}else{_0x2b1725=0xce;}_0x1b0fd3[_0xaf88('0x24')](_0x2b1725);return _0x1b0fd3['set'](_0xaf88('0x28'),_0x3e5d3c+'-'+_0x3ef734+'/'+_0x3fbe4f)['json'](_0x4d750c);}return null;};}function patchUpdates(_0x10af87){return function(_0x1e1491){try{jsonpatch[_0xaf88('0x29')](_0x1e1491,_0x10af87,!![]);}catch(_0x80639d){return BPromise[_0xaf88('0x2a')](_0x80639d);}return _0x1e1491[_0xaf88('0x2b')]();};}function saveUpdates(_0x4cc0ee,_0x33b9e7){return function(_0x35d9b1){if(_0x35d9b1){return _0x35d9b1[_0xaf88('0x2c')](_0x4cc0ee)[_0xaf88('0x1a')](function(_0x414e0c){return _0x414e0c;});}return null;};}function removeEntity(_0x28b457,_0x4f278b){return function(_0x93f75e){if(_0x93f75e){return _0x93f75e[_0xaf88('0x2d')]()[_0xaf88('0x1a')](function(){_0x28b457[_0xaf88('0x24')](0xcc)[_0xaf88('0x2e')]();});}};}function handleEntityNotFound(_0x4a6f8e,_0x22526c){return function(_0x5c5343){if(!_0x5c5343){_0x4a6f8e['sendStatus'](0x194);}return _0x5c5343;};}function handleError(_0x5af807,_0x1cb3e4){_0x1cb3e4=_0x1cb3e4||0x1f4;return function(_0x1a1e2b){logger[_0xaf88('0x1e')](_0x1a1e2b[_0xaf88('0x2f')]);if(_0x1a1e2b[_0xaf88('0x30')]){delete _0x1a1e2b[_0xaf88('0x30')];}_0x5af807[_0xaf88('0x24')](_0x1cb3e4)[_0xaf88('0x31')](_0x1a1e2b);};}exports[_0xaf88('0x32')]=function(_0x1dc601,_0x5e50e3){var _0x3dad3c={},_0x73ad75={},_0x1fffaa={'count':0x0,'rows':[]};var _0x29b4c6=_[_0xaf88('0x33')](db['DeskConfiguration']['rawAttributes'],function(_0x3f0d5c){return{'name':_0x3f0d5c['fieldName'],'type':_0x3f0d5c[_0xaf88('0x34')][_0xaf88('0x35')]};});_0x73ad75[_0xaf88('0x36')]=_[_0xaf88('0x33')](_0x29b4c6,_0xaf88('0x30'));_0x73ad75[_0xaf88('0x37')]=_[_0xaf88('0x38')](_0x1dc601['query']);_0x73ad75[_0xaf88('0x39')]=_['intersection'](_0x73ad75[_0xaf88('0x36')],_0x73ad75[_0xaf88('0x37')]);_0x3dad3c[_0xaf88('0x3a')]=_[_0xaf88('0x3b')](_0x73ad75[_0xaf88('0x36')],qs['fields'](_0x1dc601[_0xaf88('0x37')][_0xaf88('0x3c')]));_0x3dad3c[_0xaf88('0x3a')]=_0x3dad3c['attributes']['length']?_0x3dad3c['attributes']:_0x73ad75[_0xaf88('0x36')];if(!_0x1dc601[_0xaf88('0x37')][_0xaf88('0x3d')](_0xaf88('0x3e'))){_0x3dad3c[_0xaf88('0x3f')]=qs['limit'](_0x1dc601[_0xaf88('0x37')][_0xaf88('0x3f')]);_0x3dad3c['offset']=qs[_0xaf88('0x27')](_0x1dc601[_0xaf88('0x37')][_0xaf88('0x27')]);}_0x3dad3c[_0xaf88('0x40')]=qs['sort'](_0x1dc601[_0xaf88('0x37')][_0xaf88('0x41')]);_0x3dad3c[_0xaf88('0x42')]=qs[_0xaf88('0x39')](_[_0xaf88('0x43')](_0x1dc601[_0xaf88('0x37')],_0x73ad75['filters']),_0x29b4c6);if(_0x1dc601[_0xaf88('0x37')][_0xaf88('0x44')]){_0x3dad3c[_0xaf88('0x42')]=_['merge'](_0x3dad3c['where'],{'$or':_['map'](_0x29b4c6,function(_0x10cc6c){if(_0x10cc6c[_0xaf88('0x34')]!==_0xaf88('0x45')){var _0x38b2c8={};_0x38b2c8[_0x10cc6c[_0xaf88('0x30')]]={'$like':'%'+_0x1dc601[_0xaf88('0x37')]['filter']+'%'};return _0x38b2c8;}})});}_0x3dad3c=_[_0xaf88('0x46')]({},_0x3dad3c,_0x1dc601[_0xaf88('0x47')]);var _0x53acf9={'where':_0x3dad3c[_0xaf88('0x42')]};return db[_0xaf88('0x48')][_0xaf88('0x26')](_0x53acf9)[_0xaf88('0x1a')](function(_0xda7ca1){_0x1fffaa['count']=_0xda7ca1;if(_0x1dc601['query'][_0xaf88('0x49')]){_0x3dad3c[_0xaf88('0x4a')]=[{'all':!![]}];}return db[_0xaf88('0x48')][_0xaf88('0x4b')](_0x3dad3c);})['then'](function(_0x5624dc){_0x1fffaa['rows']=_0x5624dc;return _0x1fffaa;})[_0xaf88('0x1a')](respondWithFilteredResult(_0x5e50e3,_0x3dad3c))[_0xaf88('0x22')](handleError(_0x5e50e3,null));};exports[_0xaf88('0x4c')]=function(_0x4f60ec,_0x4f321a){var _0x577800={'raw':![],'where':{'id':_0x4f60ec['params']['id']}},_0x360ca2={};_0x360ca2[_0xaf88('0x36')]=_['keys'](db['DeskConfiguration'][_0xaf88('0x4d')]);_0x360ca2[_0xaf88('0x37')]=_[_0xaf88('0x38')](_0x4f60ec[_0xaf88('0x37')]);_0x360ca2[_0xaf88('0x39')]=_[_0xaf88('0x3b')](_0x360ca2[_0xaf88('0x36')],_0x360ca2[_0xaf88('0x37')]);_0x577800[_0xaf88('0x3a')]=_[_0xaf88('0x3b')](_0x360ca2[_0xaf88('0x36')],qs[_0xaf88('0x3c')](_0x4f60ec[_0xaf88('0x37')][_0xaf88('0x3c')]));_0x577800[_0xaf88('0x3a')]=_0x577800[_0xaf88('0x3a')][_0xaf88('0x4e')]?_0x577800[_0xaf88('0x3a')]:_0x360ca2['model'];if(_0x4f60ec[_0xaf88('0x37')][_0xaf88('0x49')]){_0x577800[_0xaf88('0x4a')]=[{'all':!![]}];}_0x577800=_['merge']({},_0x577800,_0x4f60ec[_0xaf88('0x47')]);return db[_0xaf88('0x48')][_0xaf88('0x4f')](_0x577800)[_0xaf88('0x1a')](handleEntityNotFound(_0x4f321a,null))[_0xaf88('0x1a')](respondWithResult(_0x4f321a,null))[_0xaf88('0x22')](handleError(_0x4f321a,null));};exports[_0xaf88('0x50')]=function(_0x318f5d,_0x39c990){return db[_0xaf88('0x48')][_0xaf88('0x50')](_0x318f5d[_0xaf88('0x51')],{})[_0xaf88('0x1a')](respondWithResult(_0x39c990,0xc9))[_0xaf88('0x22')](handleError(_0x39c990,null));};exports['update']=function(_0x4df852,_0x27003d){if(_0x4df852[_0xaf88('0x51')]['id']){delete _0x4df852['body']['id'];}return db['DeskConfiguration'][_0xaf88('0x4f')]({'where':{'id':_0x4df852[_0xaf88('0x52')]['id']}})['then'](handleEntityNotFound(_0x27003d,null))[_0xaf88('0x1a')](saveUpdates(_0x4df852[_0xaf88('0x51')],null))[_0xaf88('0x1a')](respondWithResult(_0x27003d,null))[_0xaf88('0x22')](handleError(_0x27003d,null));};exports[_0xaf88('0x2d')]=function(_0x1fac9c,_0x3a3884){return db[_0xaf88('0x48')][_0xaf88('0x4f')]({'where':{'id':_0x1fac9c[_0xaf88('0x52')]['id']}})[_0xaf88('0x1a')](handleEntityNotFound(_0x3a3884,null))['then'](removeEntity(_0x3a3884,null))[_0xaf88('0x22')](handleError(_0x3a3884,null));};exports[_0xaf88('0x53')]=function(_0x5efc21,_0x9f4377,_0x2f0dd9){var _0x577283={};var _0x491200={};var _0x1bbb3a;var _0x160d94;return db['DeskConfiguration'][_0xaf88('0x54')]({'where':{'id':_0x5efc21['params']['id']}})[_0xaf88('0x1a')](handleEntityNotFound(_0x9f4377,null))['then'](function(_0x44f57c){if(_0x44f57c){_0x1bbb3a=_0x44f57c;_0x491200[_0xaf88('0x36')]=_[_0xaf88('0x38')](db[_0xaf88('0x55')][_0xaf88('0x4d')]);_0x491200['query']=_['keys'](_0x5efc21[_0xaf88('0x37')]);_0x491200[_0xaf88('0x39')]=_[_0xaf88('0x3b')](_0x491200['model'],_0x491200['query']);_0x577283['attributes']=_['intersection'](_0x491200[_0xaf88('0x36')],qs[_0xaf88('0x3c')](_0x5efc21[_0xaf88('0x37')][_0xaf88('0x3c')]));_0x577283[_0xaf88('0x3a')]=_0x577283['attributes'][_0xaf88('0x4e')]?_0x577283[_0xaf88('0x3a')]:_0x491200[_0xaf88('0x36')];_0x577283[_0xaf88('0x40')]=qs['sort'](_0x5efc21[_0xaf88('0x37')]['sort']);_0x577283[_0xaf88('0x42')]=qs[_0xaf88('0x39')](_['pick'](_0x5efc21[_0xaf88('0x37')],_0x491200[_0xaf88('0x39')]));if(_0x5efc21['query'][_0xaf88('0x44')]){_0x577283[_0xaf88('0x42')]=_[_0xaf88('0x46')](_0x577283[_0xaf88('0x42')],{'$or':_['map'](_0x577283[_0xaf88('0x3a')],function(_0x405143){var _0x2fe19e={};_0x2fe19e[_0x405143]={'$like':'%'+_0x5efc21['query'][_0xaf88('0x44')]+'%'};return _0x2fe19e;})});}_0x577283=_['merge']({},_0x577283,_0x5efc21[_0xaf88('0x47')]);return _0x1bbb3a[_0xaf88('0x53')](_0x577283);}})[_0xaf88('0x1a')](function(_0x23d106){if(_0x23d106){_0x160d94=_0x23d106['length'];if(!_0x5efc21['query'][_0xaf88('0x3d')](_0xaf88('0x3e'))){_0x577283['limit']=qs[_0xaf88('0x3f')](_0x5efc21['query']['limit']);_0x577283[_0xaf88('0x27')]=qs[_0xaf88('0x27')](_0x5efc21[_0xaf88('0x37')][_0xaf88('0x27')]);}return _0x1bbb3a['getFields'](_0x577283);}})['then'](function(_0x1c729a){if(_0x1c729a){return _0x1c729a?{'count':_0x160d94,'rows':_0x1c729a}:null;}})['then'](respondWithResult(_0x9f4377,null))[_0xaf88('0x22')](handleError(_0x9f4377,null));};exports[_0xaf88('0x56')]=function(_0x151e8f,_0x128c46,_0x1be529){var _0x5db3f1={};var _0x1275d5={};var _0x190490;var _0x3d1b20;return db[_0xaf88('0x48')][_0xaf88('0x54')]({'where':{'id':_0x151e8f[_0xaf88('0x52')]['id']}})[_0xaf88('0x1a')](handleEntityNotFound(_0x128c46,null))[_0xaf88('0x1a')](function(_0x338ac8){if(_0x338ac8){_0x190490=_0x338ac8;_0x1275d5[_0xaf88('0x36')]=_[_0xaf88('0x38')](db[_0xaf88('0x55')][_0xaf88('0x4d')]);_0x1275d5['query']=_['keys'](_0x151e8f['query']);_0x1275d5[_0xaf88('0x39')]=_[_0xaf88('0x3b')](_0x1275d5[_0xaf88('0x36')],_0x1275d5[_0xaf88('0x37')]);_0x5db3f1[_0xaf88('0x3a')]=_[_0xaf88('0x3b')](_0x1275d5[_0xaf88('0x36')],qs[_0xaf88('0x3c')](_0x151e8f[_0xaf88('0x37')][_0xaf88('0x3c')]));_0x5db3f1[_0xaf88('0x3a')]=_0x5db3f1[_0xaf88('0x3a')][_0xaf88('0x4e')]?_0x5db3f1[_0xaf88('0x3a')]:_0x1275d5[_0xaf88('0x36')];_0x5db3f1[_0xaf88('0x40')]=qs['sort'](_0x151e8f['query']['sort']);_0x5db3f1[_0xaf88('0x42')]=qs[_0xaf88('0x39')](_[_0xaf88('0x43')](_0x151e8f['query'],_0x1275d5[_0xaf88('0x39')]));if(_0x151e8f[_0xaf88('0x37')][_0xaf88('0x44')]){_0x5db3f1[_0xaf88('0x42')]=_[_0xaf88('0x46')](_0x5db3f1[_0xaf88('0x42')],{'$or':_['map'](_0x5db3f1[_0xaf88('0x3a')],function(_0x1a5648){var _0x341288={};_0x341288[_0x1a5648]={'$like':'%'+_0x151e8f[_0xaf88('0x37')][_0xaf88('0x44')]+'%'};return _0x341288;})});}_0x5db3f1=_['merge']({},_0x5db3f1,_0x151e8f[_0xaf88('0x47')]);return _0x190490['getSubjects'](_0x5db3f1);}})[_0xaf88('0x1a')](function(_0x5338a8){if(_0x5338a8){_0x3d1b20=_0x5338a8['length'];if(!_0x151e8f[_0xaf88('0x37')][_0xaf88('0x3d')]('nolimit')){_0x5db3f1[_0xaf88('0x3f')]=qs[_0xaf88('0x3f')](_0x151e8f[_0xaf88('0x37')][_0xaf88('0x3f')]);_0x5db3f1[_0xaf88('0x27')]=qs[_0xaf88('0x27')](_0x151e8f[_0xaf88('0x37')][_0xaf88('0x27')]);}return _0x190490[_0xaf88('0x56')](_0x5db3f1);}})[_0xaf88('0x1a')](function(_0x4c5071){if(_0x4c5071){return _0x4c5071?{'count':_0x3d1b20,'rows':_0x4c5071}:null;}})[_0xaf88('0x1a')](respondWithResult(_0x128c46,null))[_0xaf88('0x22')](handleError(_0x128c46,null));};exports[_0xaf88('0x57')]=function(_0x4beb95,_0x20b106,_0x54793e){var _0x18d39c={};var _0x40f954={};var _0x7aaee6;var _0x3fa004;return db[_0xaf88('0x48')][_0xaf88('0x54')]({'where':{'id':_0x4beb95['params']['id']}})['then'](handleEntityNotFound(_0x20b106,null))[_0xaf88('0x1a')](function(_0x43fd2b){if(_0x43fd2b){_0x7aaee6=_0x43fd2b;_0x40f954[_0xaf88('0x36')]=_['keys'](db[_0xaf88('0x55')][_0xaf88('0x4d')]);_0x40f954[_0xaf88('0x37')]=_['keys'](_0x4beb95[_0xaf88('0x37')]);_0x40f954[_0xaf88('0x39')]=_[_0xaf88('0x3b')](_0x40f954[_0xaf88('0x36')],_0x40f954[_0xaf88('0x37')]);_0x18d39c[_0xaf88('0x3a')]=_[_0xaf88('0x3b')](_0x40f954[_0xaf88('0x36')],qs['fields'](_0x4beb95[_0xaf88('0x37')][_0xaf88('0x3c')]));_0x18d39c['attributes']=_0x18d39c[_0xaf88('0x3a')]['length']?_0x18d39c[_0xaf88('0x3a')]:_0x40f954[_0xaf88('0x36')];_0x18d39c[_0xaf88('0x40')]=qs[_0xaf88('0x41')](_0x4beb95[_0xaf88('0x37')][_0xaf88('0x41')]);_0x18d39c[_0xaf88('0x42')]=qs['filters'](_['pick'](_0x4beb95[_0xaf88('0x37')],_0x40f954[_0xaf88('0x39')]));if(_0x4beb95['query'][_0xaf88('0x44')]){_0x18d39c[_0xaf88('0x42')]=_[_0xaf88('0x46')](_0x18d39c[_0xaf88('0x42')],{'$or':_[_0xaf88('0x33')](_0x18d39c[_0xaf88('0x3a')],function(_0x2e417f){var _0xd37728={};_0xd37728[_0x2e417f]={'$like':'%'+_0x4beb95[_0xaf88('0x37')][_0xaf88('0x44')]+'%'};return _0xd37728;})});}_0x18d39c=_[_0xaf88('0x46')]({},_0x18d39c,_0x4beb95[_0xaf88('0x47')]);return _0x7aaee6[_0xaf88('0x57')](_0x18d39c);}})['then'](function(_0x2f1218){if(_0x2f1218){_0x3fa004=_0x2f1218[_0xaf88('0x4e')];if(!_0x4beb95[_0xaf88('0x37')][_0xaf88('0x3d')]('nolimit')){_0x18d39c[_0xaf88('0x3f')]=qs[_0xaf88('0x3f')](_0x4beb95[_0xaf88('0x37')][_0xaf88('0x3f')]);_0x18d39c['offset']=qs[_0xaf88('0x27')](_0x4beb95[_0xaf88('0x37')][_0xaf88('0x27')]);}return _0x7aaee6[_0xaf88('0x57')](_0x18d39c);}})[_0xaf88('0x1a')](function(_0x2ad848){if(_0x2ad848){return _0x2ad848?{'count':_0x3fa004,'rows':_0x2ad848}:null;}})[_0xaf88('0x1a')](respondWithResult(_0x20b106,null))[_0xaf88('0x22')](handleError(_0x20b106,null));};exports[_0xaf88('0x58')]=function(_0x18ec80,_0x4d445e,_0x23ed66){var _0x3d8b57={};var _0x16c779={};var _0x166c97;var _0x5d0e2d;return db[_0xaf88('0x48')]['findOne']({'where':{'id':_0x18ec80[_0xaf88('0x52')]['id']}})[_0xaf88('0x1a')](handleEntityNotFound(_0x4d445e,null))['then'](function(_0x20e0f3){if(_0x20e0f3){_0x166c97=_0x20e0f3;_0x16c779[_0xaf88('0x36')]=_[_0xaf88('0x38')](db[_0xaf88('0x59')]['rawAttributes']);_0x16c779[_0xaf88('0x37')]=_[_0xaf88('0x38')](_0x18ec80[_0xaf88('0x37')]);_0x16c779[_0xaf88('0x39')]=_[_0xaf88('0x3b')](_0x16c779[_0xaf88('0x36')],_0x16c779[_0xaf88('0x37')]);_0x3d8b57[_0xaf88('0x3a')]=_['intersection'](_0x16c779[_0xaf88('0x36')],qs[_0xaf88('0x3c')](_0x18ec80['query'][_0xaf88('0x3c')]));_0x3d8b57['attributes']=_0x3d8b57['attributes'][_0xaf88('0x4e')]?_0x3d8b57[_0xaf88('0x3a')]:_0x16c779[_0xaf88('0x36')];_0x3d8b57[_0xaf88('0x40')]=qs['sort'](_0x18ec80[_0xaf88('0x37')][_0xaf88('0x41')]);_0x3d8b57['where']=qs[_0xaf88('0x39')](_[_0xaf88('0x43')](_0x18ec80[_0xaf88('0x37')],_0x16c779[_0xaf88('0x39')]));if(_0x18ec80[_0xaf88('0x37')]['filter']){_0x3d8b57[_0xaf88('0x42')]=_[_0xaf88('0x46')](_0x3d8b57[_0xaf88('0x42')],{'$or':_['map'](_0x3d8b57[_0xaf88('0x3a')],function(_0x2a08bb){var _0xc33b={};_0xc33b[_0x2a08bb]={'$like':'%'+_0x18ec80[_0xaf88('0x37')]['filter']+'%'};return _0xc33b;})});}_0x3d8b57=_[_0xaf88('0x46')]({},_0x3d8b57,_0x18ec80[_0xaf88('0x47')]);return _0x166c97[_0xaf88('0x58')](_0x3d8b57);}})['then'](function(_0x9a1120){if(_0x9a1120){_0x5d0e2d=_0x9a1120['length'];if(!_0x18ec80[_0xaf88('0x37')][_0xaf88('0x3d')](_0xaf88('0x3e'))){_0x3d8b57[_0xaf88('0x3f')]=qs[_0xaf88('0x3f')](_0x18ec80[_0xaf88('0x37')]['limit']);_0x3d8b57[_0xaf88('0x27')]=qs['offset'](_0x18ec80['query']['offset']);}return _0x166c97[_0xaf88('0x58')](_0x3d8b57);}})['then'](function(_0x4b1506){if(_0x4b1506){return _0x4b1506?{'count':_0x5d0e2d,'rows':_0x4b1506}:null;}})[_0xaf88('0x1a')](respondWithResult(_0x4d445e,null))[_0xaf88('0x22')](handleError(_0x4d445e,null));};exports['setTags']=function(_0x4d4788,_0x38fa20,_0x4a7f5d){if(_0x4d4788['body']['id']){delete _0x4d4788[_0xaf88('0x51')]['id'];}return db[_0xaf88('0x48')]['findOne']({'where':{'id':_0x4d4788[_0xaf88('0x52')]['id']}})[_0xaf88('0x1a')](handleEntityNotFound(_0x38fa20,null))[_0xaf88('0x1a')](function(_0x1882be){if(_0x1882be){return _0x1882be[_0xaf88('0x5a')](_0x4d4788[_0xaf88('0x51')][_0xaf88('0x5b')]||[]);}return null;})[_0xaf88('0x1a')](respondWithResult(_0x38fa20,null))[_0xaf88('0x22')](handleError(_0x38fa20,null));}; \ No newline at end of file +var _0xb59d=['intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','destroy','getFields','findOne','DeskField','getSubjects','order','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','end','status','json','count','offset','limit','set','Content-Range','reject','update','sendStatus','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x1c67ca,_0x56ef69){var _0x1a7720=function(_0xd31eac){while(--_0xd31eac){_0x1c67ca['push'](_0x1c67ca['shift']());}};_0x1a7720(++_0x56ef69);}(_0xb59d,0xdf));var _0xdb59=function(_0x36c955,_0x2646b8){_0x36c955=_0x36c955-0x0;var _0x3c24bc=_0xb59d[_0x36c955];return _0x3c24bc;};'use strict';var emlformat=require(_0xdb59('0x0'));var rimraf=require(_0xdb59('0x1'));var zipdir=require(_0xdb59('0x2'));var jsonpatch=require(_0xdb59('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdb59('0x4'));var Mustache=require('mustache');var util=require(_0xdb59('0x5'));var path=require(_0xdb59('0x6'));var sox=require(_0xdb59('0x7'));var csv=require(_0xdb59('0x8'));var ejs=require(_0xdb59('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdb59('0xa'));var crypto=require(_0xdb59('0xb'));var jsforce=require(_0xdb59('0xc'));var deskjs=require(_0xdb59('0xd'));var toCsv=require(_0xdb59('0x8'));var querystring=require(_0xdb59('0xe'));var Papa=require(_0xdb59('0xf'));var Redis=require(_0xdb59('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdb59('0x11'));var hardwareService=require(_0xdb59('0x12'));var logger=require(_0xdb59('0x13'))(_0xdb59('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdb59('0x15'));var db=require(_0xdb59('0x16'))['db'];var jayson=require(_0xdb59('0x17'));var client=jayson[_0xdb59('0x18')][_0xdb59('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x39d5d9,_0x483571,_0x2eb325,_0x49195f){return new BPromise(function(_0xd97edd,_0x21a1ff){var _0x4f0342=_0x49195f||client;return _0x4f0342[_0xdb59('0x1a')](_0x39d5d9,_0x2eb325)[_0xdb59('0x1b')](function(_0x2f0947){logger[_0xdb59('0x1c')]('DeskConfiguration,\x20%s,\x20%s',_0x483571,_0xdb59('0x1d'));logger[_0xdb59('0x1e')](_0xdb59('0x1f'),_0x483571,_0xdb59('0x1d'),JSON[_0xdb59('0x20')](_0x2f0947));if(_0x2f0947[_0xdb59('0x21')]){if(_0x2f0947[_0xdb59('0x21')][_0xdb59('0x22')]===0x1f4){logger[_0xdb59('0x21')](_0xdb59('0x23'),_0x483571,_0x2f0947[_0xdb59('0x21')][_0xdb59('0x24')]);return _0x21a1ff(_0x2f0947[_0xdb59('0x21')][_0xdb59('0x24')]);}logger['error'](_0xdb59('0x23'),_0x483571,_0x2f0947[_0xdb59('0x21')][_0xdb59('0x24')]);return _0xd97edd(_0x2f0947[_0xdb59('0x21')][_0xdb59('0x24')]);}else{logger[_0xdb59('0x1c')](_0xdb59('0x23'),_0x483571,'request\x20sent');_0xd97edd(_0x2f0947[_0xdb59('0x25')][_0xdb59('0x24')]);}})['catch'](function(_0x36a995){logger[_0xdb59('0x21')](_0xdb59('0x23'),_0x483571,_0x36a995);_0x21a1ff(_0x36a995);});});}function respondWithStatusCode(_0x58644e,_0x305ce3){_0x305ce3=_0x305ce3||0xcc;return function(_0x3a1f28){if(_0x3a1f28){return _0x58644e['sendStatus'](_0x305ce3);}return _0x58644e['status'](_0x305ce3)[_0xdb59('0x26')]();};}function respondWithResult(_0x109e63,_0x4237c3){_0x4237c3=_0x4237c3||0xc8;return function(_0x452baf){if(_0x452baf){return _0x109e63[_0xdb59('0x27')](_0x4237c3)[_0xdb59('0x28')](_0x452baf);}};}function respondWithFilteredResult(_0x8b1680,_0x4f97ec){return function(_0x3694b3){if(_0x3694b3){var _0x4a2587=_0x3694b3[_0xdb59('0x29')],_0x4e70b8=_0x4f97ec[_0xdb59('0x2a')],_0x58443a=_0x4f97ec[_0xdb59('0x2a')]+_0x4f97ec[_0xdb59('0x2b')],_0x5d70e0;if(_0x58443a>=_0x4a2587){_0x58443a=_0x4a2587;_0x5d70e0=0xc8;}else{_0x5d70e0=0xce;}_0x8b1680['status'](_0x5d70e0);return _0x8b1680[_0xdb59('0x2c')](_0xdb59('0x2d'),_0x4e70b8+'-'+_0x58443a+'/'+_0x4a2587)[_0xdb59('0x28')](_0x3694b3);}return null;};}function patchUpdates(_0x3d0da4){return function(_0x549af3){try{jsonpatch['apply'](_0x549af3,_0x3d0da4,!![]);}catch(_0x46adf5){return BPromise[_0xdb59('0x2e')](_0x46adf5);}return _0x549af3['save']();};}function saveUpdates(_0x3c77c1,_0x1f0208){return function(_0x2d81ea){if(_0x2d81ea){return _0x2d81ea[_0xdb59('0x2f')](_0x3c77c1)[_0xdb59('0x1b')](function(_0x30ff23){return _0x30ff23;});}return null;};}function removeEntity(_0x3600dd,_0x2e5837){return function(_0x26f7ca){if(_0x26f7ca){return _0x26f7ca['destroy']()[_0xdb59('0x1b')](function(){_0x3600dd['status'](0xcc)[_0xdb59('0x26')]();});}};}function handleEntityNotFound(_0x15853e,_0x259aa6){return function(_0x37c9bf){if(!_0x37c9bf){_0x15853e[_0xdb59('0x30')](0x194);}return _0x37c9bf;};}function handleError(_0x42bcd5,_0x4ff9f1){_0x4ff9f1=_0x4ff9f1||0x1f4;return function(_0xb2a200){logger[_0xdb59('0x21')](_0xb2a200[_0xdb59('0x31')]);if(_0xb2a200[_0xdb59('0x32')]){delete _0xb2a200[_0xdb59('0x32')];}_0x42bcd5[_0xdb59('0x27')](_0x4ff9f1)[_0xdb59('0x33')](_0xb2a200);};}exports[_0xdb59('0x34')]=function(_0x3c3a94,_0x47f516){var _0x38b525={},_0x3a64e7={},_0x166319={'count':0x0,'rows':[]};var _0x534a5a=_[_0xdb59('0x35')](db[_0xdb59('0x36')][_0xdb59('0x37')],function(_0x1ec1d9){return{'name':_0x1ec1d9[_0xdb59('0x38')],'type':_0x1ec1d9[_0xdb59('0x39')][_0xdb59('0x3a')]};});_0x3a64e7[_0xdb59('0x3b')]=_[_0xdb59('0x35')](_0x534a5a,_0xdb59('0x32'));_0x3a64e7[_0xdb59('0x3c')]=_[_0xdb59('0x3d')](_0x3c3a94[_0xdb59('0x3c')]);_0x3a64e7['filters']=_[_0xdb59('0x3e')](_0x3a64e7[_0xdb59('0x3b')],_0x3a64e7[_0xdb59('0x3c')]);_0x38b525[_0xdb59('0x3f')]=_[_0xdb59('0x3e')](_0x3a64e7[_0xdb59('0x3b')],qs[_0xdb59('0x40')](_0x3c3a94[_0xdb59('0x3c')]['fields']));_0x38b525[_0xdb59('0x3f')]=_0x38b525[_0xdb59('0x3f')]['length']?_0x38b525[_0xdb59('0x3f')]:_0x3a64e7[_0xdb59('0x3b')];if(!_0x3c3a94[_0xdb59('0x3c')][_0xdb59('0x41')](_0xdb59('0x42'))){_0x38b525[_0xdb59('0x2b')]=qs[_0xdb59('0x2b')](_0x3c3a94['query'][_0xdb59('0x2b')]);_0x38b525['offset']=qs[_0xdb59('0x2a')](_0x3c3a94[_0xdb59('0x3c')]['offset']);}_0x38b525['order']=qs['sort'](_0x3c3a94[_0xdb59('0x3c')][_0xdb59('0x43')]);_0x38b525[_0xdb59('0x44')]=qs[_0xdb59('0x45')](_[_0xdb59('0x46')](_0x3c3a94[_0xdb59('0x3c')],_0x3a64e7['filters']),_0x534a5a);if(_0x3c3a94[_0xdb59('0x3c')][_0xdb59('0x47')]){_0x38b525[_0xdb59('0x44')]=_[_0xdb59('0x48')](_0x38b525['where'],{'$or':_[_0xdb59('0x35')](_0x534a5a,function(_0x13f68d){if(_0x13f68d[_0xdb59('0x39')]!==_0xdb59('0x49')){var _0x4ab300={};_0x4ab300[_0x13f68d[_0xdb59('0x32')]]={'$like':'%'+_0x3c3a94[_0xdb59('0x3c')]['filter']+'%'};return _0x4ab300;}})});}_0x38b525=_['merge']({},_0x38b525,_0x3c3a94[_0xdb59('0x4a')]);var _0xefa6b5={'where':_0x38b525['where']};return db[_0xdb59('0x36')][_0xdb59('0x29')](_0xefa6b5)[_0xdb59('0x1b')](function(_0x5bf2e5){_0x166319[_0xdb59('0x29')]=_0x5bf2e5;if(_0x3c3a94[_0xdb59('0x3c')][_0xdb59('0x4b')]){_0x38b525[_0xdb59('0x4c')]=[{'all':!![]}];}return db[_0xdb59('0x36')][_0xdb59('0x4d')](_0x38b525);})['then'](function(_0x4eadd1){_0x166319[_0xdb59('0x4e')]=_0x4eadd1;return _0x166319;})[_0xdb59('0x1b')](respondWithFilteredResult(_0x47f516,_0x38b525))[_0xdb59('0x4f')](handleError(_0x47f516,null));};exports['show']=function(_0x1342d8,_0x569c5d){var _0x360911={'raw':![],'where':{'id':_0x1342d8[_0xdb59('0x50')]['id']}},_0x2e29e2={};_0x2e29e2['model']=_['keys'](db['DeskConfiguration']['rawAttributes']);_0x2e29e2[_0xdb59('0x3c')]=_[_0xdb59('0x3d')](_0x1342d8['query']);_0x2e29e2[_0xdb59('0x45')]=_[_0xdb59('0x3e')](_0x2e29e2[_0xdb59('0x3b')],_0x2e29e2[_0xdb59('0x3c')]);_0x360911[_0xdb59('0x3f')]=_[_0xdb59('0x3e')](_0x2e29e2['model'],qs[_0xdb59('0x40')](_0x1342d8[_0xdb59('0x3c')][_0xdb59('0x40')]));_0x360911['attributes']=_0x360911[_0xdb59('0x3f')][_0xdb59('0x51')]?_0x360911['attributes']:_0x2e29e2[_0xdb59('0x3b')];if(_0x1342d8[_0xdb59('0x3c')][_0xdb59('0x4b')]){_0x360911['include']=[{'all':!![]}];}_0x360911=_[_0xdb59('0x48')]({},_0x360911,_0x1342d8['options']);return db['DeskConfiguration'][_0xdb59('0x52')](_0x360911)[_0xdb59('0x1b')](handleEntityNotFound(_0x569c5d,null))[_0xdb59('0x1b')](respondWithResult(_0x569c5d,null))[_0xdb59('0x4f')](handleError(_0x569c5d,null));};exports['create']=function(_0x1e4c3f,_0x38a921){return db[_0xdb59('0x36')][_0xdb59('0x53')](_0x1e4c3f['body'],{})['then'](respondWithResult(_0x38a921,0xc9))[_0xdb59('0x4f')](handleError(_0x38a921,null));};exports[_0xdb59('0x2f')]=function(_0x3acfbc,_0x33da8c){if(_0x3acfbc[_0xdb59('0x54')]['id']){delete _0x3acfbc[_0xdb59('0x54')]['id'];}return db['DeskConfiguration'][_0xdb59('0x52')]({'where':{'id':_0x3acfbc[_0xdb59('0x50')]['id']}})['then'](handleEntityNotFound(_0x33da8c,null))[_0xdb59('0x1b')](saveUpdates(_0x3acfbc['body'],null))[_0xdb59('0x1b')](respondWithResult(_0x33da8c,null))[_0xdb59('0x4f')](handleError(_0x33da8c,null));};exports[_0xdb59('0x55')]=function(_0x55aec1,_0x54f0e6){return db['DeskConfiguration']['find']({'where':{'id':_0x55aec1['params']['id']}})[_0xdb59('0x1b')](handleEntityNotFound(_0x54f0e6,null))['then'](removeEntity(_0x54f0e6,null))[_0xdb59('0x4f')](handleError(_0x54f0e6,null));};exports[_0xdb59('0x56')]=function(_0x3079a1,_0x4b1bf2,_0x462839){var _0x59aad5={};var _0x2ab05c={};var _0x15e1e9;var _0x105889;return db[_0xdb59('0x36')][_0xdb59('0x57')]({'where':{'id':_0x3079a1[_0xdb59('0x50')]['id']}})['then'](handleEntityNotFound(_0x4b1bf2,null))[_0xdb59('0x1b')](function(_0x1de315){if(_0x1de315){_0x15e1e9=_0x1de315;_0x2ab05c[_0xdb59('0x3b')]=_['keys'](db[_0xdb59('0x58')][_0xdb59('0x37')]);_0x2ab05c[_0xdb59('0x3c')]=_['keys'](_0x3079a1[_0xdb59('0x3c')]);_0x2ab05c[_0xdb59('0x45')]=_['intersection'](_0x2ab05c['model'],_0x2ab05c[_0xdb59('0x3c')]);_0x59aad5[_0xdb59('0x3f')]=_[_0xdb59('0x3e')](_0x2ab05c[_0xdb59('0x3b')],qs['fields'](_0x3079a1[_0xdb59('0x3c')][_0xdb59('0x40')]));_0x59aad5['attributes']=_0x59aad5[_0xdb59('0x3f')][_0xdb59('0x51')]?_0x59aad5[_0xdb59('0x3f')]:_0x2ab05c[_0xdb59('0x3b')];_0x59aad5['order']=qs[_0xdb59('0x43')](_0x3079a1['query'][_0xdb59('0x43')]);_0x59aad5['where']=qs['filters'](_[_0xdb59('0x46')](_0x3079a1['query'],_0x2ab05c['filters']));if(_0x3079a1[_0xdb59('0x3c')][_0xdb59('0x47')]){_0x59aad5['where']=_[_0xdb59('0x48')](_0x59aad5[_0xdb59('0x44')],{'$or':_[_0xdb59('0x35')](_0x59aad5['attributes'],function(_0x14f5aa){var _0x1614ec={};_0x1614ec[_0x14f5aa]={'$like':'%'+_0x3079a1[_0xdb59('0x3c')][_0xdb59('0x47')]+'%'};return _0x1614ec;})});}_0x59aad5=_['merge']({},_0x59aad5,_0x3079a1[_0xdb59('0x4a')]);return _0x15e1e9[_0xdb59('0x56')](_0x59aad5);}})[_0xdb59('0x1b')](function(_0x2be224){if(_0x2be224){_0x105889=_0x2be224['length'];if(!_0x3079a1[_0xdb59('0x3c')]['hasOwnProperty'](_0xdb59('0x42'))){_0x59aad5[_0xdb59('0x2b')]=qs['limit'](_0x3079a1[_0xdb59('0x3c')][_0xdb59('0x2b')]);_0x59aad5['offset']=qs[_0xdb59('0x2a')](_0x3079a1[_0xdb59('0x3c')][_0xdb59('0x2a')]);}return _0x15e1e9[_0xdb59('0x56')](_0x59aad5);}})['then'](function(_0x2f21e2){if(_0x2f21e2){return _0x2f21e2?{'count':_0x105889,'rows':_0x2f21e2}:null;}})[_0xdb59('0x1b')](respondWithResult(_0x4b1bf2,null))['catch'](handleError(_0x4b1bf2,null));};exports[_0xdb59('0x59')]=function(_0x214c30,_0x4fe193,_0x20bce1){var _0x3b78ef={};var _0x36e560={};var _0x496d15;var _0x5a005a;return db[_0xdb59('0x36')]['findOne']({'where':{'id':_0x214c30[_0xdb59('0x50')]['id']}})[_0xdb59('0x1b')](handleEntityNotFound(_0x4fe193,null))[_0xdb59('0x1b')](function(_0x3a418c){if(_0x3a418c){_0x496d15=_0x3a418c;_0x36e560[_0xdb59('0x3b')]=_['keys'](db[_0xdb59('0x58')][_0xdb59('0x37')]);_0x36e560[_0xdb59('0x3c')]=_[_0xdb59('0x3d')](_0x214c30[_0xdb59('0x3c')]);_0x36e560[_0xdb59('0x45')]=_['intersection'](_0x36e560['model'],_0x36e560[_0xdb59('0x3c')]);_0x3b78ef[_0xdb59('0x3f')]=_['intersection'](_0x36e560['model'],qs[_0xdb59('0x40')](_0x214c30[_0xdb59('0x3c')]['fields']));_0x3b78ef[_0xdb59('0x3f')]=_0x3b78ef['attributes']['length']?_0x3b78ef[_0xdb59('0x3f')]:_0x36e560[_0xdb59('0x3b')];_0x3b78ef[_0xdb59('0x5a')]=qs[_0xdb59('0x43')](_0x214c30[_0xdb59('0x3c')][_0xdb59('0x43')]);_0x3b78ef['where']=qs[_0xdb59('0x45')](_[_0xdb59('0x46')](_0x214c30[_0xdb59('0x3c')],_0x36e560[_0xdb59('0x45')]));if(_0x214c30[_0xdb59('0x3c')][_0xdb59('0x47')]){_0x3b78ef[_0xdb59('0x44')]=_[_0xdb59('0x48')](_0x3b78ef['where'],{'$or':_[_0xdb59('0x35')](_0x3b78ef[_0xdb59('0x3f')],function(_0x195d77){var _0x38e20b={};_0x38e20b[_0x195d77]={'$like':'%'+_0x214c30[_0xdb59('0x3c')]['filter']+'%'};return _0x38e20b;})});}_0x3b78ef=_[_0xdb59('0x48')]({},_0x3b78ef,_0x214c30[_0xdb59('0x4a')]);return _0x496d15[_0xdb59('0x59')](_0x3b78ef);}})[_0xdb59('0x1b')](function(_0x59c8c3){if(_0x59c8c3){_0x5a005a=_0x59c8c3['length'];if(!_0x214c30[_0xdb59('0x3c')]['hasOwnProperty'](_0xdb59('0x42'))){_0x3b78ef[_0xdb59('0x2b')]=qs['limit'](_0x214c30[_0xdb59('0x3c')][_0xdb59('0x2b')]);_0x3b78ef[_0xdb59('0x2a')]=qs[_0xdb59('0x2a')](_0x214c30[_0xdb59('0x3c')][_0xdb59('0x2a')]);}return _0x496d15[_0xdb59('0x59')](_0x3b78ef);}})[_0xdb59('0x1b')](function(_0x4f1256){if(_0x4f1256){return _0x4f1256?{'count':_0x5a005a,'rows':_0x4f1256}:null;}})[_0xdb59('0x1b')](respondWithResult(_0x4fe193,null))[_0xdb59('0x4f')](handleError(_0x4fe193,null));};exports['getDescriptions']=function(_0x424bd4,_0x8909a6,_0x295ba9){var _0x1051df={};var _0x26bda1={};var _0x4b822e;var _0x15653d;return db['DeskConfiguration']['findOne']({'where':{'id':_0x424bd4[_0xdb59('0x50')]['id']}})[_0xdb59('0x1b')](handleEntityNotFound(_0x8909a6,null))['then'](function(_0x148d7a){if(_0x148d7a){_0x4b822e=_0x148d7a;_0x26bda1[_0xdb59('0x3b')]=_[_0xdb59('0x3d')](db['DeskField'][_0xdb59('0x37')]);_0x26bda1[_0xdb59('0x3c')]=_['keys'](_0x424bd4[_0xdb59('0x3c')]);_0x26bda1[_0xdb59('0x45')]=_['intersection'](_0x26bda1['model'],_0x26bda1['query']);_0x1051df['attributes']=_[_0xdb59('0x3e')](_0x26bda1[_0xdb59('0x3b')],qs['fields'](_0x424bd4[_0xdb59('0x3c')][_0xdb59('0x40')]));_0x1051df[_0xdb59('0x3f')]=_0x1051df[_0xdb59('0x3f')][_0xdb59('0x51')]?_0x1051df[_0xdb59('0x3f')]:_0x26bda1[_0xdb59('0x3b')];_0x1051df['order']=qs['sort'](_0x424bd4['query']['sort']);_0x1051df[_0xdb59('0x44')]=qs[_0xdb59('0x45')](_[_0xdb59('0x46')](_0x424bd4[_0xdb59('0x3c')],_0x26bda1[_0xdb59('0x45')]));if(_0x424bd4[_0xdb59('0x3c')][_0xdb59('0x47')]){_0x1051df['where']=_[_0xdb59('0x48')](_0x1051df[_0xdb59('0x44')],{'$or':_[_0xdb59('0x35')](_0x1051df[_0xdb59('0x3f')],function(_0x3df800){var _0x5c01c5={};_0x5c01c5[_0x3df800]={'$like':'%'+_0x424bd4[_0xdb59('0x3c')]['filter']+'%'};return _0x5c01c5;})});}_0x1051df=_[_0xdb59('0x48')]({},_0x1051df,_0x424bd4[_0xdb59('0x4a')]);return _0x4b822e[_0xdb59('0x5b')](_0x1051df);}})[_0xdb59('0x1b')](function(_0x35bd64){if(_0x35bd64){_0x15653d=_0x35bd64[_0xdb59('0x51')];if(!_0x424bd4[_0xdb59('0x3c')][_0xdb59('0x41')](_0xdb59('0x42'))){_0x1051df[_0xdb59('0x2b')]=qs[_0xdb59('0x2b')](_0x424bd4[_0xdb59('0x3c')][_0xdb59('0x2b')]);_0x1051df[_0xdb59('0x2a')]=qs['offset'](_0x424bd4[_0xdb59('0x3c')][_0xdb59('0x2a')]);}return _0x4b822e[_0xdb59('0x5b')](_0x1051df);}})['then'](function(_0x2f8475){if(_0x2f8475){return _0x2f8475?{'count':_0x15653d,'rows':_0x2f8475}:null;}})['then'](respondWithResult(_0x8909a6,null))[_0xdb59('0x4f')](handleError(_0x8909a6,null));};exports[_0xdb59('0x5c')]=function(_0x34410f,_0xcd86f3,_0x504f11){var _0xa7d831={};var _0x3a410d={};var _0x4de717;var _0x958526;return db['DeskConfiguration']['findOne']({'where':{'id':_0x34410f['params']['id']}})[_0xdb59('0x1b')](handleEntityNotFound(_0xcd86f3,null))[_0xdb59('0x1b')](function(_0x4e0344){if(_0x4e0344){_0x4de717=_0x4e0344;_0x3a410d[_0xdb59('0x3b')]=_[_0xdb59('0x3d')](db[_0xdb59('0x5d')][_0xdb59('0x37')]);_0x3a410d['query']=_[_0xdb59('0x3d')](_0x34410f[_0xdb59('0x3c')]);_0x3a410d[_0xdb59('0x45')]=_[_0xdb59('0x3e')](_0x3a410d[_0xdb59('0x3b')],_0x3a410d['query']);_0xa7d831[_0xdb59('0x3f')]=_[_0xdb59('0x3e')](_0x3a410d[_0xdb59('0x3b')],qs[_0xdb59('0x40')](_0x34410f[_0xdb59('0x3c')][_0xdb59('0x40')]));_0xa7d831[_0xdb59('0x3f')]=_0xa7d831[_0xdb59('0x3f')][_0xdb59('0x51')]?_0xa7d831[_0xdb59('0x3f')]:_0x3a410d[_0xdb59('0x3b')];_0xa7d831[_0xdb59('0x5a')]=qs[_0xdb59('0x43')](_0x34410f[_0xdb59('0x3c')][_0xdb59('0x43')]);_0xa7d831[_0xdb59('0x44')]=qs[_0xdb59('0x45')](_[_0xdb59('0x46')](_0x34410f[_0xdb59('0x3c')],_0x3a410d[_0xdb59('0x45')]));if(_0x34410f[_0xdb59('0x3c')][_0xdb59('0x47')]){_0xa7d831['where']=_[_0xdb59('0x48')](_0xa7d831[_0xdb59('0x44')],{'$or':_[_0xdb59('0x35')](_0xa7d831[_0xdb59('0x3f')],function(_0x562673){var _0xfba6cb={};_0xfba6cb[_0x562673]={'$like':'%'+_0x34410f[_0xdb59('0x3c')][_0xdb59('0x47')]+'%'};return _0xfba6cb;})});}_0xa7d831=_[_0xdb59('0x48')]({},_0xa7d831,_0x34410f['options']);return _0x4de717[_0xdb59('0x5c')](_0xa7d831);}})[_0xdb59('0x1b')](function(_0x258416){if(_0x258416){_0x958526=_0x258416['length'];if(!_0x34410f[_0xdb59('0x3c')][_0xdb59('0x41')](_0xdb59('0x42'))){_0xa7d831[_0xdb59('0x2b')]=qs['limit'](_0x34410f[_0xdb59('0x3c')][_0xdb59('0x2b')]);_0xa7d831[_0xdb59('0x2a')]=qs['offset'](_0x34410f[_0xdb59('0x3c')]['offset']);}return _0x4de717[_0xdb59('0x5c')](_0xa7d831);}})[_0xdb59('0x1b')](function(_0x3f5489){if(_0x3f5489){return _0x3f5489?{'count':_0x958526,'rows':_0x3f5489}:null;}})[_0xdb59('0x1b')](respondWithResult(_0xcd86f3,null))[_0xdb59('0x4f')](handleError(_0xcd86f3,null));};exports['setTags']=function(_0x2de5c4,_0x38ba12,_0x2b8773){if(_0x2de5c4[_0xdb59('0x54')]['id']){delete _0x2de5c4[_0xdb59('0x54')]['id'];}return db[_0xdb59('0x36')][_0xdb59('0x57')]({'where':{'id':_0x2de5c4['params']['id']}})['then'](handleEntityNotFound(_0x38ba12,null))['then'](function(_0x5531c8){if(_0x5531c8){return _0x5531c8[_0xdb59('0x5e')](_0x2de5c4['body']['ids']||[]);}return null;})[_0xdb59('0x1b')](respondWithResult(_0x38ba12,null))[_0xdb59('0x4f')](handleError(_0x38ba12,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index f69c49c..f7c98f9 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 _0x362f=['define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intDeskConfiguration.attributes','exports'];(function(_0x5cf8c6,_0x1c41f7){var _0x2f16bb=function(_0x44ce8b){while(--_0x44ce8b){_0x5cf8c6['push'](_0x5cf8c6['shift']());}};_0x2f16bb(++_0x1c41f7);}(_0x362f,0x114));var _0xf362=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x362f[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xf362('0x0'));var util=require(_0xf362('0x1'));var logger=require(_0xf362('0x2'))(_0xf362('0x3'));var moment=require(_0xf362('0x4'));var BPromise=require(_0xf362('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf362('0x6'));var rimraf=require(_0xf362('0x7'));var config=require('../../config/environment');var attributes=require(_0xf362('0x8'));module[_0xf362('0x9')]=function(_0x1ebd8f,_0xbb4af8){return _0x1ebd8f[_0xf362('0xa')](_0xf362('0xb'),attributes,{'tableName':_0xf362('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x060f=['../../config/logger','api','moment','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x3888bc,_0x3539a2){var _0x59d7c1=function(_0x2bb104){while(--_0x2bb104){_0x3888bc['push'](_0x3888bc['shift']());}};_0x59d7c1(++_0x3539a2);}(_0x060f,0x112));var _0xf060=function(_0x2e1af3,_0x2a077b){_0x2e1af3=_0x2e1af3-0x0;var _0x4150cd=_0x060f[_0x2e1af3];return _0x4150cd;};'use strict';var _=require(_0xf060('0x0'));var util=require('util');var logger=require(_0xf060('0x1'))(_0xf060('0x2'));var moment=require(_0xf060('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf060('0x4'));var rimraf=require(_0xf060('0x5'));var config=require(_0xf060('0x6'));var attributes=require(_0xf060('0x7'));module[_0xf060('0x8')]=function(_0x475434,_0x4295ac){return _0x475434['define'](_0xf060('0x9'),attributes,{'tableName':_0xf060('0xa'),'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 3fa4e47..54f3426 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 _0x3d15=['debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','DeskConfiguration,\x20%s,\x20%s'];(function(_0x436b11,_0x1a4fe5){var _0x1885c7=function(_0x36681b){while(--_0x36681b){_0x436b11['push'](_0x436b11['shift']());}};_0x1885c7(++_0x1a4fe5);}(_0x3d15,0x127));var _0x53d1=function(_0x283152,_0x468a35){_0x283152=_0x283152-0x0;var _0x6cb80d=_0x3d15[_0x283152];return _0x6cb80d;};'use strict';var _=require('lodash');var util=require(_0x53d1('0x0'));var moment=require(_0x53d1('0x1'));var BPromise=require('bluebird');var rs=require(_0x53d1('0x2'));var fs=require('fs');var Redis=require(_0x53d1('0x3'));var db=require(_0x53d1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x53d1('0x5'))(_0x53d1('0x6'));var config=require(_0x53d1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x53d1('0x8')][_0x53d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b4385,_0x8abe67,_0x32dfe1){return new BPromise(function(_0x1c4833,_0x49309e){return client[_0x53d1('0xa')](_0x4b4385,_0x32dfe1)[_0x53d1('0xb')](function(_0x59f965){logger['info'](_0x53d1('0xc'),_0x8abe67,'request\x20sent');logger[_0x53d1('0xd')](_0x53d1('0xe'),_0x8abe67,_0x53d1('0xf'),JSON[_0x53d1('0x10')](_0x59f965));if(_0x59f965[_0x53d1('0x11')]){if(_0x59f965[_0x53d1('0x11')][_0x53d1('0x12')]===0x1f4){logger[_0x53d1('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x8abe67,_0x59f965[_0x53d1('0x11')][_0x53d1('0x13')]);return _0x49309e(_0x59f965[_0x53d1('0x11')][_0x53d1('0x13')]);}logger[_0x53d1('0x11')](_0x53d1('0xc'),_0x8abe67,_0x59f965[_0x53d1('0x11')][_0x53d1('0x13')]);return _0x1c4833(_0x59f965[_0x53d1('0x11')][_0x53d1('0x13')]);}else{logger[_0x53d1('0x14')](_0x53d1('0xc'),_0x8abe67,_0x53d1('0xf'));_0x1c4833(_0x59f965['result'][_0x53d1('0x13')]);}})[_0x53d1('0x15')](function(_0x4438ef){logger['error'](_0x53d1('0xc'),_0x8abe67,_0x4438ef);_0x49309e(_0x4438ef);});});} \ No newline at end of file +var _0x9585=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','info','result','catch','util','bluebird'];(function(_0x66d6cf,_0x446cdd){var _0x54d0c8=function(_0x3b66dc){while(--_0x3b66dc){_0x66d6cf['push'](_0x66d6cf['shift']());}};_0x54d0c8(++_0x446cdd);}(_0x9585,0x15e));var _0x5958=function(_0xab9a51,_0x12f3b1){_0xab9a51=_0xab9a51-0x0;var _0x3b01c6=_0x9585[_0xab9a51];return _0x3b01c6;};'use strict';var _=require('lodash');var util=require(_0x5958('0x0'));var moment=require('moment');var BPromise=require(_0x5958('0x1'));var rs=require(_0x5958('0x2'));var fs=require('fs');var Redis=require(_0x5958('0x3'));var db=require(_0x5958('0x4'))['db'];var utils=require(_0x5958('0x5'));var logger=require(_0x5958('0x6'))(_0x5958('0x7'));var config=require(_0x5958('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5958('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc050d5,_0xd655ec,_0x264827){return new BPromise(function(_0x5be2d9,_0x1e2de1){return client['request'](_0xc050d5,_0x264827)[_0x5958('0xa')](function(_0x12aa98){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0xd655ec,_0x5958('0xb'));logger[_0x5958('0xc')](_0x5958('0xd'),_0xd655ec,_0x5958('0xb'),JSON[_0x5958('0xe')](_0x12aa98));if(_0x12aa98['error']){if(_0x12aa98[_0x5958('0xf')][_0x5958('0x10')]===0x1f4){logger[_0x5958('0xf')](_0x5958('0x11'),_0xd655ec,_0x12aa98[_0x5958('0xf')]['message']);return _0x1e2de1(_0x12aa98['error'][_0x5958('0x12')]);}logger[_0x5958('0xf')](_0x5958('0x11'),_0xd655ec,_0x12aa98['error'][_0x5958('0x12')]);return _0x5be2d9(_0x12aa98[_0x5958('0xf')][_0x5958('0x12')]);}else{logger[_0x5958('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0xd655ec,_0x5958('0xb'));_0x5be2d9(_0x12aa98[_0x5958('0x14')][_0x5958('0x12')]);}})[_0x5958('0x15')](function(_0x2c9bcf){logger[_0x5958('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0xd655ec,_0x2c9bcf);_0x1e2de1(_0x2c9bcf);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index f89e022..f9b024d 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(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x7a54,0x106));var _0x47a5=function(_0x1e120a,_0x96953b){_0x1e120a=_0x1e120a-0x0;var _0xc03c24=_0x7a54[_0x1e120a];return _0xc03c24;};'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(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x7a54,0x106));var _0x47a5=function(_0x4161d6,_0x4c848b){_0x4161d6=_0x4161d6-0x0;var _0x5793ea=_0x7a54[_0x4161d6];return _0x5793ea;};'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 d4a8118..59193c7 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 _0xc98c=['string','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','keyValue','picklist'];(function(_0x1713ab,_0x43c83e){var _0x1d81ce=function(_0x134d39){while(--_0x134d39){_0x1713ab['push'](_0x1713ab['shift']());}};_0x1d81ce(++_0x43c83e);}(_0xc98c,0x1ea));var _0xcc98=function(_0x32396a,_0xfe5ddb){_0x32396a=_0x32396a-0x0;var _0x14997d=_0xc98c[_0x32396a];return _0x14997d;};'use strict';var Sequelize=require(_0xcc98('0x0'));module[_0xcc98('0x1')]={'type':{'type':Sequelize[_0xcc98('0x2')]('string','variable','customVariable',_0xcc98('0x3'),_0xcc98('0x4')),'defaultValue':_0xcc98('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xcc98('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xcc98('0x5'),'variable',_0xcc98('0x7'))},'keyContent':{'type':Sequelize[_0xcc98('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xcc98('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcc98('0x6')]}}; \ No newline at end of file +var _0xd5d8=['variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x49d700,_0xeaf9f){var _0x2a2dc3=function(_0x1abf13){while(--_0x1abf13){_0x49d700['push'](_0x49d700['shift']());}};_0x2a2dc3(++_0xeaf9f);}(_0xd5d8,0x133));var _0x8d5d=function(_0x9eb142,_0x101537){_0x9eb142=_0x9eb142-0x0;var _0x1b9dbb=_0xd5d8[_0x9eb142];return _0x1b9dbb;};'use strict';var Sequelize=require(_0x8d5d('0x0'));module[_0x8d5d('0x1')]={'type':{'type':Sequelize[_0x8d5d('0x2')]('string',_0x8d5d('0x3'),_0x8d5d('0x4'),_0x8d5d('0x5'),_0x8d5d('0x6')),'defaultValue':_0x8d5d('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8d5d('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x8d5d('0x8')]},'idField':{'type':Sequelize[_0x8d5d('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8d5d('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 0020ad3..a7456d3 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 _0x03e4=['name','send','map','DeskField','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','create','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','save','update','then','stack'];(function(_0x111b0d,_0x5f3f67){var _0x20e0ab=function(_0x749e6b){while(--_0x749e6b){_0x111b0d['push'](_0x111b0d['shift']());}};_0x20e0ab(++_0x5f3f67);}(_0x03e4,0x102));var _0x403e=function(_0x2353fe,_0x4b0bca){_0x2353fe=_0x2353fe-0x0;var _0x4d43f6=_0x03e4[_0x2353fe];return _0x4d43f6;};'use strict';var emlformat=require(_0x403e('0x0'));var rimraf=require(_0x403e('0x1'));var zipdir=require(_0x403e('0x2'));var jsonpatch=require(_0x403e('0x3'));var rp=require('request-promise');var moment=require(_0x403e('0x4'));var BPromise=require(_0x403e('0x5'));var Mustache=require('mustache');var util=require(_0x403e('0x6'));var path=require('path');var sox=require(_0x403e('0x7'));var csv=require(_0x403e('0x8'));var ejs=require(_0x403e('0x9'));var fs=require('fs');var fs_extra=require(_0x403e('0xa'));var _=require(_0x403e('0xb'));var squel=require('squel');var crypto=require(_0x403e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x403e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x403e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x403e('0xf'));var qs=require(_0x403e('0x10'));var as=require(_0x403e('0x11'));var hardwareService=require(_0x403e('0x12'));var logger=require(_0x403e('0x13'))(_0x403e('0x14'));var utils=require(_0x403e('0x15'));var config=require(_0x403e('0x16'));var licenseUtil=require(_0x403e('0x17'));var db=require(_0x403e('0x18'))['db'];function respondWithStatusCode(_0x57d876,_0xbdba2a){_0xbdba2a=_0xbdba2a||0xcc;return function(_0x13be25){if(_0x13be25){return _0x57d876[_0x403e('0x19')](_0xbdba2a);}return _0x57d876[_0x403e('0x1a')](_0xbdba2a)[_0x403e('0x1b')]();};}function respondWithResult(_0x42e46d,_0x43a1d0){_0x43a1d0=_0x43a1d0||0xc8;return function(_0x42b588){if(_0x42b588){return _0x42e46d[_0x403e('0x1a')](_0x43a1d0)[_0x403e('0x1c')](_0x42b588);}};}function respondWithFilteredResult(_0x2a916d,_0x4132ad){return function(_0x287995){if(_0x287995){var _0x14af85=_0x287995[_0x403e('0x1d')],_0x4b934b=_0x4132ad['offset'],_0x18ff55=_0x4132ad['offset']+_0x4132ad[_0x403e('0x1e')],_0x37ba54;if(_0x18ff55>=_0x14af85){_0x18ff55=_0x14af85;_0x37ba54=0xc8;}else{_0x37ba54=0xce;}_0x2a916d[_0x403e('0x1a')](_0x37ba54);return _0x2a916d[_0x403e('0x1f')](_0x403e('0x20'),_0x4b934b+'-'+_0x18ff55+'/'+_0x14af85)['json'](_0x287995);}return null;};}function patchUpdates(_0x248d42){return function(_0x4fb942){try{jsonpatch[_0x403e('0x21')](_0x4fb942,_0x248d42,!![]);}catch(_0x26b622){return BPromise['reject'](_0x26b622);}return _0x4fb942[_0x403e('0x22')]();};}function saveUpdates(_0x5d7b8d,_0x2eb3aa){return function(_0x1ad57a){if(_0x1ad57a){return _0x1ad57a[_0x403e('0x23')](_0x5d7b8d)[_0x403e('0x24')](function(_0x2456e5){return _0x2456e5;});}return null;};}function removeEntity(_0x56d66b,_0x4570c3){return function(_0x1d079b){if(_0x1d079b){return _0x1d079b['destroy']()[_0x403e('0x24')](function(){_0x56d66b[_0x403e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c0bcd,_0x47fa60){return function(_0xf5693d){if(!_0xf5693d){_0x3c0bcd[_0x403e('0x19')](0x194);}return _0xf5693d;};}function handleError(_0x285a24,_0x4ff43d){_0x4ff43d=_0x4ff43d||0x1f4;return function(_0x4af46b){logger['error'](_0x4af46b[_0x403e('0x25')]);if(_0x4af46b['name']){delete _0x4af46b[_0x403e('0x26')];}_0x285a24[_0x403e('0x1a')](_0x4ff43d)[_0x403e('0x27')](_0x4af46b);};}exports['index']=function(_0x296939,_0xaa4d9f){var _0x4cf41b={},_0x1ed4f5={},_0x59fc27={'count':0x0,'rows':[]};var _0x51e252=_[_0x403e('0x28')](db[_0x403e('0x29')]['rawAttributes'],function(_0x10199d){return{'name':_0x10199d[_0x403e('0x2a')],'type':_0x10199d[_0x403e('0x2b')][_0x403e('0x2c')]};});_0x1ed4f5['model']=_[_0x403e('0x28')](_0x51e252,'name');_0x1ed4f5[_0x403e('0x2d')]=_[_0x403e('0x2e')](_0x296939[_0x403e('0x2d')]);_0x1ed4f5[_0x403e('0x2f')]=_[_0x403e('0x30')](_0x1ed4f5[_0x403e('0x31')],_0x1ed4f5[_0x403e('0x2d')]);_0x4cf41b[_0x403e('0x32')]=_[_0x403e('0x30')](_0x1ed4f5[_0x403e('0x31')],qs[_0x403e('0x33')](_0x296939[_0x403e('0x2d')][_0x403e('0x33')]));_0x4cf41b[_0x403e('0x32')]=_0x4cf41b[_0x403e('0x32')]['length']?_0x4cf41b[_0x403e('0x32')]:_0x1ed4f5[_0x403e('0x31')];if(!_0x296939[_0x403e('0x2d')][_0x403e('0x34')](_0x403e('0x35'))){_0x4cf41b[_0x403e('0x1e')]=qs[_0x403e('0x1e')](_0x296939['query']['limit']);_0x4cf41b[_0x403e('0x36')]=qs[_0x403e('0x36')](_0x296939[_0x403e('0x2d')][_0x403e('0x36')]);}_0x4cf41b[_0x403e('0x37')]=qs['sort'](_0x296939[_0x403e('0x2d')][_0x403e('0x38')]);_0x4cf41b[_0x403e('0x39')]=qs['filters'](_[_0x403e('0x3a')](_0x296939[_0x403e('0x2d')],_0x1ed4f5['filters']),_0x51e252);if(_0x296939[_0x403e('0x2d')][_0x403e('0x3b')]){_0x4cf41b[_0x403e('0x39')]=_[_0x403e('0x3c')](_0x4cf41b[_0x403e('0x39')],{'$or':_['map'](_0x51e252,function(_0x427858){if(_0x427858[_0x403e('0x2b')]!=='VIRTUAL'){var _0x5e62ae={};_0x5e62ae[_0x427858[_0x403e('0x26')]]={'$like':'%'+_0x296939['query'][_0x403e('0x3b')]+'%'};return _0x5e62ae;}})});}_0x4cf41b=_[_0x403e('0x3c')]({},_0x4cf41b,_0x296939['options']);var _0x3c21f1={'where':_0x4cf41b['where']};return db[_0x403e('0x29')][_0x403e('0x1d')](_0x3c21f1)[_0x403e('0x24')](function(_0xda49e8){_0x59fc27[_0x403e('0x1d')]=_0xda49e8;if(_0x296939[_0x403e('0x2d')][_0x403e('0x3d')]){_0x4cf41b[_0x403e('0x3e')]=[{'all':!![]}];}return db[_0x403e('0x29')][_0x403e('0x3f')](_0x4cf41b);})[_0x403e('0x24')](function(_0x435226){_0x59fc27[_0x403e('0x40')]=_0x435226;return _0x59fc27;})[_0x403e('0x24')](respondWithFilteredResult(_0xaa4d9f,_0x4cf41b))['catch'](handleError(_0xaa4d9f,null));};exports[_0x403e('0x41')]=function(_0x17d2f8,_0x4b5202){var _0x22060f={'raw':!![],'where':{'id':_0x17d2f8[_0x403e('0x42')]['id']}},_0xc64d7e={};_0xc64d7e['model']=_[_0x403e('0x2e')](db[_0x403e('0x29')][_0x403e('0x43')]);_0xc64d7e[_0x403e('0x2d')]=_[_0x403e('0x2e')](_0x17d2f8[_0x403e('0x2d')]);_0xc64d7e[_0x403e('0x2f')]=_['intersection'](_0xc64d7e[_0x403e('0x31')],_0xc64d7e['query']);_0x22060f[_0x403e('0x32')]=_[_0x403e('0x30')](_0xc64d7e[_0x403e('0x31')],qs[_0x403e('0x33')](_0x17d2f8[_0x403e('0x2d')][_0x403e('0x33')]));_0x22060f[_0x403e('0x32')]=_0x22060f[_0x403e('0x32')]['length']?_0x22060f[_0x403e('0x32')]:_0xc64d7e[_0x403e('0x31')];if(_0x17d2f8[_0x403e('0x2d')][_0x403e('0x3d')]){_0x22060f[_0x403e('0x3e')]=[{'all':!![]}];}_0x22060f=_[_0x403e('0x3c')]({},_0x22060f,_0x17d2f8[_0x403e('0x44')]);return db[_0x403e('0x29')][_0x403e('0x45')](_0x22060f)[_0x403e('0x24')](handleEntityNotFound(_0x4b5202,null))[_0x403e('0x24')](respondWithResult(_0x4b5202,null))['catch'](handleError(_0x4b5202,null));};exports[_0x403e('0x46')]=function(_0x1ef032,_0x18468d){return db[_0x403e('0x29')][_0x403e('0x46')](_0x1ef032[_0x403e('0x47')],{})[_0x403e('0x24')](respondWithResult(_0x18468d,0xc9))[_0x403e('0x48')](handleError(_0x18468d,null));};exports['update']=function(_0xc7f51a,_0x3df2ac){if(_0xc7f51a[_0x403e('0x47')]['id']){delete _0xc7f51a['body']['id'];}return db[_0x403e('0x29')][_0x403e('0x45')]({'where':{'id':_0xc7f51a[_0x403e('0x42')]['id']}})[_0x403e('0x24')](handleEntityNotFound(_0x3df2ac,null))[_0x403e('0x24')](saveUpdates(_0xc7f51a[_0x403e('0x47')],null))['then'](respondWithResult(_0x3df2ac,null))['catch'](handleError(_0x3df2ac,null));};exports[_0x403e('0x49')]=function(_0x493e0e,_0xbda82d){return db[_0x403e('0x29')][_0x403e('0x45')]({'where':{'id':_0x493e0e['params']['id']}})[_0x403e('0x24')](handleEntityNotFound(_0xbda82d,null))[_0x403e('0x24')](removeEntity(_0xbda82d,null))[_0x403e('0x48')](handleError(_0xbda82d,null));}; \ No newline at end of file +var _0xfb1d=['set','Content-Range','apply','reject','save','update','then','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit'];(function(_0x47f6b5,_0x2934a3){var _0x59a4af=function(_0x9ed9c4){while(--_0x9ed9c4){_0x47f6b5['push'](_0x47f6b5['shift']());}};_0x59a4af(++_0x2934a3);}(_0xfb1d,0x72));var _0xdfb1=function(_0x4069db,_0x5deed7){_0x4069db=_0x4069db-0x0;var _0x55f10d=_0xfb1d[_0x4069db];return _0x55f10d;};'use strict';var emlformat=require(_0xdfb1('0x0'));var rimraf=require(_0xdfb1('0x1'));var zipdir=require(_0xdfb1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdfb1('0x3'));var BPromise=require(_0xdfb1('0x4'));var Mustache=require(_0xdfb1('0x5'));var util=require(_0xdfb1('0x6'));var path=require('path');var sox=require(_0xdfb1('0x7'));var csv=require(_0xdfb1('0x8'));var ejs=require(_0xdfb1('0x9'));var fs=require('fs');var fs_extra=require(_0xdfb1('0xa'));var _=require(_0xdfb1('0xb'));var squel=require('squel');var crypto=require(_0xdfb1('0xc'));var jsforce=require(_0xdfb1('0xd'));var deskjs=require(_0xdfb1('0xe'));var toCsv=require(_0xdfb1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdfb1('0xf'));var authService=require(_0xdfb1('0x10'));var qs=require(_0xdfb1('0x11'));var as=require(_0xdfb1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdfb1('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdfb1('0x14'));var db=require(_0xdfb1('0x15'))['db'];function respondWithStatusCode(_0x4b4068,_0x5d5705){_0x5d5705=_0x5d5705||0xcc;return function(_0x16865a){if(_0x16865a){return _0x4b4068['sendStatus'](_0x5d5705);}return _0x4b4068['status'](_0x5d5705)[_0xdfb1('0x16')]();};}function respondWithResult(_0x2f5c38,_0x31ebb5){_0x31ebb5=_0x31ebb5||0xc8;return function(_0xd16132){if(_0xd16132){return _0x2f5c38[_0xdfb1('0x17')](_0x31ebb5)[_0xdfb1('0x18')](_0xd16132);}};}function respondWithFilteredResult(_0x1daf66,_0xfaf673){return function(_0x17c2c1){if(_0x17c2c1){var _0x4a893c=_0x17c2c1[_0xdfb1('0x19')],_0x21fa2e=_0xfaf673['offset'],_0xf1c2a1=_0xfaf673[_0xdfb1('0x1a')]+_0xfaf673[_0xdfb1('0x1b')],_0x10454c;if(_0xf1c2a1>=_0x4a893c){_0xf1c2a1=_0x4a893c;_0x10454c=0xc8;}else{_0x10454c=0xce;}_0x1daf66[_0xdfb1('0x17')](_0x10454c);return _0x1daf66[_0xdfb1('0x1c')](_0xdfb1('0x1d'),_0x21fa2e+'-'+_0xf1c2a1+'/'+_0x4a893c)[_0xdfb1('0x18')](_0x17c2c1);}return null;};}function patchUpdates(_0x3cca23){return function(_0x597db7){try{jsonpatch[_0xdfb1('0x1e')](_0x597db7,_0x3cca23,!![]);}catch(_0x11e920){return BPromise[_0xdfb1('0x1f')](_0x11e920);}return _0x597db7[_0xdfb1('0x20')]();};}function saveUpdates(_0x1f0e3f,_0x565f3f){return function(_0x26164c){if(_0x26164c){return _0x26164c[_0xdfb1('0x21')](_0x1f0e3f)[_0xdfb1('0x22')](function(_0x55a15d){return _0x55a15d;});}return null;};}function removeEntity(_0x803b8b,_0x439d60){return function(_0xa310bd){if(_0xa310bd){return _0xa310bd['destroy']()['then'](function(){_0x803b8b['status'](0xcc)[_0xdfb1('0x16')]();});}};}function handleEntityNotFound(_0x28b2f3,_0x2496a1){return function(_0x1b6ef2){if(!_0x1b6ef2){_0x28b2f3['sendStatus'](0x194);}return _0x1b6ef2;};}function handleError(_0x295d8f,_0x3804d9){_0x3804d9=_0x3804d9||0x1f4;return function(_0x10d84d){logger['error'](_0x10d84d['stack']);if(_0x10d84d[_0xdfb1('0x23')]){delete _0x10d84d[_0xdfb1('0x23')];}_0x295d8f[_0xdfb1('0x17')](_0x3804d9)[_0xdfb1('0x24')](_0x10d84d);};}exports[_0xdfb1('0x25')]=function(_0x4cfc4b,_0x592f4a){var _0x4d35bf={},_0x34c826={},_0x2d88e9={'count':0x0,'rows':[]};var _0x3e5ca1=_[_0xdfb1('0x26')](db[_0xdfb1('0x27')][_0xdfb1('0x28')],function(_0x559816){return{'name':_0x559816[_0xdfb1('0x29')],'type':_0x559816[_0xdfb1('0x2a')][_0xdfb1('0x2b')]};});_0x34c826[_0xdfb1('0x2c')]=_[_0xdfb1('0x26')](_0x3e5ca1,'name');_0x34c826['query']=_[_0xdfb1('0x2d')](_0x4cfc4b[_0xdfb1('0x2e')]);_0x34c826[_0xdfb1('0x2f')]=_[_0xdfb1('0x30')](_0x34c826[_0xdfb1('0x2c')],_0x34c826['query']);_0x4d35bf[_0xdfb1('0x31')]=_[_0xdfb1('0x30')](_0x34c826[_0xdfb1('0x2c')],qs[_0xdfb1('0x32')](_0x4cfc4b['query'][_0xdfb1('0x32')]));_0x4d35bf[_0xdfb1('0x31')]=_0x4d35bf[_0xdfb1('0x31')][_0xdfb1('0x33')]?_0x4d35bf[_0xdfb1('0x31')]:_0x34c826[_0xdfb1('0x2c')];if(!_0x4cfc4b[_0xdfb1('0x2e')]['hasOwnProperty'](_0xdfb1('0x34'))){_0x4d35bf[_0xdfb1('0x1b')]=qs[_0xdfb1('0x1b')](_0x4cfc4b[_0xdfb1('0x2e')][_0xdfb1('0x1b')]);_0x4d35bf[_0xdfb1('0x1a')]=qs[_0xdfb1('0x1a')](_0x4cfc4b[_0xdfb1('0x2e')][_0xdfb1('0x1a')]);}_0x4d35bf[_0xdfb1('0x35')]=qs[_0xdfb1('0x36')](_0x4cfc4b[_0xdfb1('0x2e')][_0xdfb1('0x36')]);_0x4d35bf[_0xdfb1('0x37')]=qs[_0xdfb1('0x2f')](_[_0xdfb1('0x38')](_0x4cfc4b[_0xdfb1('0x2e')],_0x34c826[_0xdfb1('0x2f')]),_0x3e5ca1);if(_0x4cfc4b[_0xdfb1('0x2e')]['filter']){_0x4d35bf['where']=_['merge'](_0x4d35bf[_0xdfb1('0x37')],{'$or':_[_0xdfb1('0x26')](_0x3e5ca1,function(_0x5dbff2){if(_0x5dbff2['type']!==_0xdfb1('0x39')){var _0x1e06b0={};_0x1e06b0[_0x5dbff2[_0xdfb1('0x23')]]={'$like':'%'+_0x4cfc4b[_0xdfb1('0x2e')][_0xdfb1('0x3a')]+'%'};return _0x1e06b0;}})});}_0x4d35bf=_[_0xdfb1('0x3b')]({},_0x4d35bf,_0x4cfc4b[_0xdfb1('0x3c')]);var _0xef709={'where':_0x4d35bf[_0xdfb1('0x37')]};return db[_0xdfb1('0x27')][_0xdfb1('0x19')](_0xef709)[_0xdfb1('0x22')](function(_0x54ba49){_0x2d88e9[_0xdfb1('0x19')]=_0x54ba49;if(_0x4cfc4b['query'][_0xdfb1('0x3d')]){_0x4d35bf[_0xdfb1('0x3e')]=[{'all':!![]}];}return db[_0xdfb1('0x27')][_0xdfb1('0x3f')](_0x4d35bf);})[_0xdfb1('0x22')](function(_0x40b087){_0x2d88e9[_0xdfb1('0x40')]=_0x40b087;return _0x2d88e9;})['then'](respondWithFilteredResult(_0x592f4a,_0x4d35bf))[_0xdfb1('0x41')](handleError(_0x592f4a,null));};exports[_0xdfb1('0x42')]=function(_0x46925e,_0x17bb0){var _0x5ae98f={'raw':!![],'where':{'id':_0x46925e[_0xdfb1('0x43')]['id']}},_0x35d239={};_0x35d239[_0xdfb1('0x2c')]=_[_0xdfb1('0x2d')](db[_0xdfb1('0x27')][_0xdfb1('0x28')]);_0x35d239['query']=_[_0xdfb1('0x2d')](_0x46925e[_0xdfb1('0x2e')]);_0x35d239[_0xdfb1('0x2f')]=_[_0xdfb1('0x30')](_0x35d239['model'],_0x35d239[_0xdfb1('0x2e')]);_0x5ae98f[_0xdfb1('0x31')]=_['intersection'](_0x35d239[_0xdfb1('0x2c')],qs[_0xdfb1('0x32')](_0x46925e[_0xdfb1('0x2e')][_0xdfb1('0x32')]));_0x5ae98f[_0xdfb1('0x31')]=_0x5ae98f[_0xdfb1('0x31')]['length']?_0x5ae98f[_0xdfb1('0x31')]:_0x35d239['model'];if(_0x46925e[_0xdfb1('0x2e')][_0xdfb1('0x3d')]){_0x5ae98f[_0xdfb1('0x3e')]=[{'all':!![]}];}_0x5ae98f=_[_0xdfb1('0x3b')]({},_0x5ae98f,_0x46925e[_0xdfb1('0x3c')]);return db['DeskField'][_0xdfb1('0x44')](_0x5ae98f)[_0xdfb1('0x22')](handleEntityNotFound(_0x17bb0,null))[_0xdfb1('0x22')](respondWithResult(_0x17bb0,null))[_0xdfb1('0x41')](handleError(_0x17bb0,null));};exports['create']=function(_0x165bdb,_0x18a9a1){return db[_0xdfb1('0x27')]['create'](_0x165bdb['body'],{})[_0xdfb1('0x22')](respondWithResult(_0x18a9a1,0xc9))['catch'](handleError(_0x18a9a1,null));};exports[_0xdfb1('0x21')]=function(_0x31e8fb,_0x258c23){if(_0x31e8fb[_0xdfb1('0x45')]['id']){delete _0x31e8fb[_0xdfb1('0x45')]['id'];}return db[_0xdfb1('0x27')][_0xdfb1('0x44')]({'where':{'id':_0x31e8fb[_0xdfb1('0x43')]['id']}})['then'](handleEntityNotFound(_0x258c23,null))[_0xdfb1('0x22')](saveUpdates(_0x31e8fb['body'],null))[_0xdfb1('0x22')](respondWithResult(_0x258c23,null))[_0xdfb1('0x41')](handleError(_0x258c23,null));};exports[_0xdfb1('0x46')]=function(_0x548e4f,_0x3426dd){return db[_0xdfb1('0x27')][_0xdfb1('0x44')]({'where':{'id':_0x548e4f['params']['id']}})['then'](handleEntityNotFound(_0x3426dd,null))[_0xdfb1('0x22')](removeEntity(_0x3426dd,null))[_0xdfb1('0x41')](handleError(_0x3426dd,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index d578bf1..c11613f 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 _0x3b89=['int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports'];(function(_0x506d52,_0x58c446){var _0x3b0c64=function(_0x265d4e){while(--_0x265d4e){_0x506d52['push'](_0x506d52['shift']());}};_0x3b0c64(++_0x58c446);}(_0x3b89,0x13f));var _0x93b8=function(_0x567f69,_0x128fbe){_0x567f69=_0x567f69-0x0;var _0x32f2f8=_0x3b89[_0x567f69];return _0x32f2f8;};'use strict';var _=require(_0x93b8('0x0'));var util=require(_0x93b8('0x1'));var logger=require(_0x93b8('0x2'))(_0x93b8('0x3'));var moment=require(_0x93b8('0x4'));var BPromise=require('bluebird');var rp=require(_0x93b8('0x5'));var fs=require('fs');var path=require(_0x93b8('0x6'));var rimraf=require(_0x93b8('0x7'));var config=require(_0x93b8('0x8'));var attributes=require(_0x93b8('0x9'));module[_0x93b8('0xa')]=function(_0x1ce039,_0xa86d9d){return _0x1ce039['define']('DeskField',attributes,{'tableName':_0x93b8('0xb'),'paranoid':![],'indexes':[{'name':_0x93b8('0xc'),'fields':[_0x93b8('0xd'),_0x93b8('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5da7=['rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','idField','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x2316c3,_0xf3f88a){var _0x13127c=function(_0xc8528d){while(--_0xc8528d){_0x2316c3['push'](_0x2316c3['shift']());}};_0x13127c(++_0xf3f88a);}(_0x5da7,0x86));var _0x75da=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5da7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x75da('0x0'));var util=require(_0x75da('0x1'));var logger=require(_0x75da('0x2'))('api');var moment=require(_0x75da('0x3'));var BPromise=require(_0x75da('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x75da('0x5'));var rimraf=require(_0x75da('0x6'));var config=require(_0x75da('0x7'));var attributes=require(_0x75da('0x8'));module[_0x75da('0x9')]=function(_0x3b50ac,_0x3f0335){return _0x3b50ac[_0x75da('0xa')](_0x75da('0xb'),attributes,{'tableName':_0x75da('0xc'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x75da('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index c9d985e..328c37d 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 _0x3745=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0xcc7d79,_0x4f498c){var _0x5bd9d3=function(_0x1ab7f8){while(--_0x1ab7f8){_0xcc7d79['push'](_0xcc7d79['shift']());}};_0x5bd9d3(++_0x4f498c);}(_0x3745,0x1c8));var _0x5374=function(_0x2c1aee,_0x1a494f){_0x2c1aee=_0x2c1aee-0x0;var _0x5e3b51=_0x3745[_0x2c1aee];return _0x5e3b51;};'use strict';var _=require(_0x5374('0x0'));var util=require(_0x5374('0x1'));var moment=require('moment');var BPromise=require(_0x5374('0x2'));var rs=require(_0x5374('0x3'));var fs=require('fs');var Redis=require(_0x5374('0x4'));var db=require(_0x5374('0x5'))['db'];var utils=require(_0x5374('0x6'));var logger=require(_0x5374('0x7'))('rpc');var config=require(_0x5374('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5374('0x9')][_0x5374('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a0fad,_0x52087a,_0x4fd238){return new BPromise(function(_0x3a6623,_0x155c51){return client[_0x5374('0xb')](_0x3a0fad,_0x4fd238)[_0x5374('0xc')](function(_0x4bab6e){logger[_0x5374('0xd')](_0x5374('0xe'),_0x52087a,_0x5374('0xf'));logger['debug'](_0x5374('0x10'),_0x52087a,_0x5374('0xf'),JSON[_0x5374('0x11')](_0x4bab6e));if(_0x4bab6e[_0x5374('0x12')]){if(_0x4bab6e[_0x5374('0x12')][_0x5374('0x13')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x52087a,_0x4bab6e['error'][_0x5374('0x14')]);return _0x155c51(_0x4bab6e['error']['message']);}logger[_0x5374('0x12')]('DeskField,\x20%s,\x20%s',_0x52087a,_0x4bab6e[_0x5374('0x12')][_0x5374('0x14')]);return _0x3a6623(_0x4bab6e[_0x5374('0x12')][_0x5374('0x14')]);}else{logger[_0x5374('0xd')](_0x5374('0xe'),_0x52087a,_0x5374('0xf'));_0x3a6623(_0x4bab6e[_0x5374('0x15')][_0x5374('0x14')]);}})[_0x5374('0x16')](function(_0x1e18f9){logger[_0x5374('0x12')](_0x5374('0xe'),_0x52087a,_0x1e18f9);_0x155c51(_0x1e18f9);});});} \ No newline at end of file +var _0x9f52=['DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f52,0xc7));var _0x29f5=function(_0x513789,_0x3d7067){_0x513789=_0x513789-0x0;var _0xbdc2f3=_0x9f52[_0x513789];return _0xbdc2f3;};'use strict';var _=require(_0x29f5('0x0'));var util=require('util');var moment=require(_0x29f5('0x1'));var BPromise=require('bluebird');var rs=require(_0x29f5('0x2'));var fs=require('fs');var Redis=require(_0x29f5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x29f5('0x4'));var config=require(_0x29f5('0x5'));var jayson=require(_0x29f5('0x6'));var client=jayson[_0x29f5('0x7')][_0x29f5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e9bd9,_0x4c3af2,_0x8ec87f){return new BPromise(function(_0x47ac07,_0x47aae5){return client[_0x29f5('0x9')](_0x2e9bd9,_0x8ec87f)['then'](function(_0xb2cd78){logger[_0x29f5('0xa')](_0x29f5('0xb'),_0x4c3af2,'request\x20sent');logger[_0x29f5('0xc')](_0x29f5('0xd'),_0x4c3af2,_0x29f5('0xe'),JSON[_0x29f5('0xf')](_0xb2cd78));if(_0xb2cd78[_0x29f5('0x10')]){if(_0xb2cd78[_0x29f5('0x10')][_0x29f5('0x11')]===0x1f4){logger['error'](_0x29f5('0xb'),_0x4c3af2,_0xb2cd78[_0x29f5('0x10')]['message']);return _0x47aae5(_0xb2cd78[_0x29f5('0x10')][_0x29f5('0x12')]);}logger[_0x29f5('0x10')](_0x29f5('0xb'),_0x4c3af2,_0xb2cd78[_0x29f5('0x10')][_0x29f5('0x12')]);return _0x47ac07(_0xb2cd78[_0x29f5('0x10')]['message']);}else{logger[_0x29f5('0xa')](_0x29f5('0xb'),_0x4c3af2,_0x29f5('0xe'));_0x47ac07(_0xb2cd78[_0x29f5('0x13')][_0x29f5('0x12')]);}})[_0x29f5('0x14')](function(_0x42a523){logger[_0x29f5('0x10')](_0x29f5('0xb'),_0x4c3af2,_0x42a523);_0x47aae5(_0x42a523);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 4e01d58..14e2da3 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 _0x0e32=['isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','put','/:id','exports','multer','util','Router','fs-extra','../../components/auth/service','./intDynamics365Account.controller','get','index','/:id/configurations'];(function(_0x3108d9,_0xf08d6){var _0x1455e6=function(_0xfd5906){while(--_0xfd5906){_0x3108d9['push'](_0x3108d9['shift']());}};_0x1455e6(++_0xf08d6);}(_0x0e32,0x99));var _0x20e3=function(_0x3a405f,_0x2403e2){_0x3a405f=_0x3a405f-0x0;var _0x1ff27a=_0x0e32[_0x3a405f];return _0x1ff27a;};'use strict';var multer=require(_0x20e3('0x0'));var util=require(_0x20e3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x20e3('0x2')]();var fs_extra=require(_0x20e3('0x3'));var auth=require(_0x20e3('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x20e3('0x5'));router[_0x20e3('0x6')]('/',auth['isAuthenticated'](),controller[_0x20e3('0x7')]);router[_0x20e3('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x20e3('0x6')](_0x20e3('0x8'),auth[_0x20e3('0x9')](),controller[_0x20e3('0xa')]);router[_0x20e3('0x6')](_0x20e3('0xb'),auth[_0x20e3('0x9')](),controller[_0x20e3('0xc')]);router[_0x20e3('0xd')]('/',auth[_0x20e3('0x9')](),controller[_0x20e3('0xe')]);router[_0x20e3('0xd')](_0x20e3('0x8'),auth[_0x20e3('0x9')](),controller['addConfiguration']);router[_0x20e3('0xf')](_0x20e3('0x10'),auth[_0x20e3('0x9')](),controller['update']);router['delete'](_0x20e3('0x10'),auth[_0x20e3('0x9')](),controller['destroy']);module[_0x20e3('0x11')]=router; \ No newline at end of file +var _0x2936=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','getConfigurations','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x35ee69,_0x2dc599){var _0x3b1bd8=function(_0x3d795c){while(--_0x3d795c){_0x35ee69['push'](_0x35ee69['shift']());}};_0x3b1bd8(++_0x2dc599);}(_0x2936,0x110));var _0x6293=function(_0x555c46,_0x12c911){_0x555c46=_0x555c46-0x0;var _0x3e37b5=_0x2936[_0x555c46];return _0x3e37b5;};'use strict';var multer=require(_0x6293('0x0'));var util=require('util');var path=require(_0x6293('0x1'));var timeout=require(_0x6293('0x2'));var express=require(_0x6293('0x3'));var router=express[_0x6293('0x4')]();var fs_extra=require(_0x6293('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6293('0x6'));var config=require(_0x6293('0x7'));var controller=require('./intDynamics365Account.controller');router[_0x6293('0x8')]('/',auth[_0x6293('0x9')](),controller[_0x6293('0xa')]);router[_0x6293('0x8')](_0x6293('0xb'),auth[_0x6293('0x9')](),controller['show']);router[_0x6293('0x8')]('/:id/configurations',auth[_0x6293('0x9')](),controller[_0x6293('0xc')]);router[_0x6293('0x8')]('/:id/fields',auth[_0x6293('0x9')](),controller[_0x6293('0xd')]);router['post']('/',auth[_0x6293('0x9')](),controller[_0x6293('0xe')]);router[_0x6293('0xf')](_0x6293('0x10'),auth[_0x6293('0x9')](),controller[_0x6293('0x11')]);router[_0x6293('0x12')](_0x6293('0xb'),auth[_0x6293('0x9')](),controller[_0x6293('0x13')]);router[_0x6293('0x14')](_0x6293('0xb'),auth['isAuthenticated'](),controller[_0x6293('0x15')]);module[_0x6293('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 984f6e2..616390a 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 _0x2c50=['STRING'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2c50,0x16f));var _0x02c5=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x2c50[_0x1b6c6d];return _0x290d9d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x02c5('0x0')]},'username':{'type':Sequelize[_0x02c5('0x0')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x02c5('0x0')]},'tenantId':{'type':Sequelize[_0x02c5('0x0')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x02c5('0x0')]},'serverUrl':{'type':Sequelize[_0x02c5('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe1b0=['sequelize','exports','STRING'];(function(_0x35354c,_0x374571){var _0x4e1014=function(_0x25286f){while(--_0x25286f){_0x35354c['push'](_0x35354c['shift']());}};_0x4e1014(++_0x374571);}(_0xe1b0,0xd8));var _0x0e1b=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xe1b0[_0x4b2436];return _0x4f5ab2;};'use strict';var Sequelize=require(_0x0e1b('0x0'));module[_0x0e1b('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x0e1b('0x2')]},'password':{'type':Sequelize[_0x0e1b('0x2')]},'remoteUri':{'type':Sequelize[_0x0e1b('0x2')]},'tenantId':{'type':Sequelize[_0x0e1b('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x0e1b('0x2')]},'serverUrl':{'type':Sequelize[_0x0e1b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x0e1b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 49e4ea8..8ab050c 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 _0x232e=['owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientSecret','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','tenantId','/oauth2/token','clientId','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','MetadataId','all','isNil','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','send','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','Value','LogicalName','DisplayName','UserLocalizedLabel',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true',')/Microsoft.Dynamics.CRM.','eml-format','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','params','length','find','create','body','findOne','Dynamics365Configuration','pick','getConfigurations','addConfiguration','Subjects','Descriptions','channel','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','caseorigincode','subject','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype'];(function(_0x386043,_0x34f904){var _0x4aafe9=function(_0x1be7b9){while(--_0x1be7b9){_0x386043['push'](_0x386043['shift']());}};_0x4aafe9(++_0x34f904);}(_0x232e,0x11f));var _0xe232=function(_0x8c1a9b,_0x342d30){_0x8c1a9b=_0x8c1a9b-0x0;var _0x30b93b=_0x232e[_0x8c1a9b];return _0x30b93b;};'use strict';var emlformat=require(_0xe232('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe232('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe232('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe232('0x3'));var util=require(_0xe232('0x4'));var path=require(_0xe232('0x5'));var sox=require(_0xe232('0x6'));var csv=require('to-csv');var ejs=require(_0xe232('0x7'));var fs=require('fs');var fs_extra=require(_0xe232('0x8'));var _=require(_0xe232('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe232('0xa'));var deskjs=require(_0xe232('0xb'));var toCsv=require(_0xe232('0xc'));var querystring=require(_0xe232('0xd'));var Papa=require('papaparse');var Redis=require(_0xe232('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe232('0xf'));var hardwareService=require(_0xe232('0x10'));var logger=require('../../config/logger')(_0xe232('0x11'));var utils=require('../../config/utils');var config=require(_0xe232('0x12'));var licenseUtil=require(_0xe232('0x13'));var db=require(_0xe232('0x14'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xe232('0x15')][_0xe232('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x2b8046,_0x5a34c7,_0x19a310,_0x25942e){return new BPromise(function(_0x26265e,_0x3231da){var _0x53c69c=_0x25942e||client;return _0x53c69c[_0xe232('0x17')](_0x2b8046,_0x19a310)[_0xe232('0x18')](function(_0x2ea6e9){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x5a34c7,_0xe232('0x19'));logger[_0xe232('0x1a')](_0xe232('0x1b'),_0x5a34c7,_0xe232('0x19'),JSON['stringify'](_0x2ea6e9));if(_0x2ea6e9[_0xe232('0x1c')]){if(_0x2ea6e9[_0xe232('0x1c')][_0xe232('0x1d')]===0x1f4){logger[_0xe232('0x1c')](_0xe232('0x1e'),_0x5a34c7,_0x2ea6e9['error'][_0xe232('0x1f')]);return _0x3231da(_0x2ea6e9[_0xe232('0x1c')][_0xe232('0x1f')]);}logger[_0xe232('0x1c')]('Dynamics365Account,\x20%s,\x20%s',_0x5a34c7,_0x2ea6e9[_0xe232('0x1c')]['message']);return _0x26265e(_0x2ea6e9[_0xe232('0x1c')][_0xe232('0x1f')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x5a34c7,_0xe232('0x19'));_0x26265e(_0x2ea6e9[_0xe232('0x20')][_0xe232('0x1f')]);}})[_0xe232('0x21')](function(_0x4849f2){logger[_0xe232('0x1c')](_0xe232('0x1e'),_0x5a34c7,_0x4849f2);_0x3231da(_0x4849f2);});});}function respondWithStatusCode(_0x3cd4fc,_0x247442){_0x247442=_0x247442||0xcc;return function(_0x3a6b06){if(_0x3a6b06){return _0x3cd4fc[_0xe232('0x22')](_0x247442);}return _0x3cd4fc[_0xe232('0x23')](_0x247442)[_0xe232('0x24')]();};}function respondWithResult(_0x35064e,_0x376605){_0x376605=_0x376605||0xc8;return function(_0x252d7d){if(_0x252d7d){return _0x35064e[_0xe232('0x23')](_0x376605)[_0xe232('0x25')](_0x252d7d);}};}function respondWithFilteredResult(_0x1771cf,_0xcad7da){return function(_0x36ce80){if(_0x36ce80){var _0x445e4f=_0x36ce80['count'],_0x5d811f=_0xcad7da['offset'],_0x1cbf2d=_0xcad7da[_0xe232('0x26')]+_0xcad7da[_0xe232('0x27')],_0x161cb0;if(_0x1cbf2d>=_0x445e4f){_0x1cbf2d=_0x445e4f;_0x161cb0=0xc8;}else{_0x161cb0=0xce;}_0x1771cf[_0xe232('0x23')](_0x161cb0);return _0x1771cf[_0xe232('0x28')](_0xe232('0x29'),_0x5d811f+'-'+_0x1cbf2d+'/'+_0x445e4f)['json'](_0x36ce80);}return null;};}function patchUpdates(_0x32b608){return function(_0x1f6e99){try{jsonpatch[_0xe232('0x2a')](_0x1f6e99,_0x32b608,!![]);}catch(_0x14cb33){return BPromise['reject'](_0x14cb33);}return _0x1f6e99[_0xe232('0x2b')]();};}function saveUpdates(_0x90797b,_0x90c878){return function(_0xb8a277){if(_0xb8a277){return _0xb8a277[_0xe232('0x2c')](_0x90797b)[_0xe232('0x18')](function(_0x27d0af){return _0x27d0af;});}return null;};}function removeEntity(_0x32bdb9,_0x10b3b8){return function(_0x4318e5){if(_0x4318e5){return _0x4318e5[_0xe232('0x2d')]()[_0xe232('0x18')](function(){_0x32bdb9[_0xe232('0x23')](0xcc)[_0xe232('0x24')]();});}};}function handleEntityNotFound(_0x5c1239,_0xc69463){return function(_0x55df44){if(!_0x55df44){_0x5c1239[_0xe232('0x22')](0x194);}return _0x55df44;};}function handleError(_0x9b352f,_0x220d25){_0x220d25=_0x220d25||0x1f4;return function(_0x33acb2){logger['error'](_0x33acb2[_0xe232('0x2e')]);if(_0x33acb2[_0xe232('0x2f')]){delete _0x33acb2['name'];}_0x9b352f['status'](_0x220d25)['send'](_0x33acb2);};}exports[_0xe232('0x30')]=function(_0x4e69be,_0x10f345){var _0x3deea8={},_0x14bb00={},_0x49d109={'count':0x0,'rows':[]};var _0x3bb719=_[_0xe232('0x31')](db[_0xe232('0x32')][_0xe232('0x33')],function(_0x4994a5){return{'name':_0x4994a5[_0xe232('0x34')],'type':_0x4994a5[_0xe232('0x35')][_0xe232('0x36')]};});_0x14bb00['model']=_[_0xe232('0x31')](_0x3bb719,_0xe232('0x2f'));_0x14bb00[_0xe232('0x37')]=_[_0xe232('0x38')](_0x4e69be[_0xe232('0x37')]);_0x14bb00[_0xe232('0x39')]=_[_0xe232('0x3a')](_0x14bb00[_0xe232('0x3b')],_0x14bb00[_0xe232('0x37')]);_0x3deea8['attributes']=_[_0xe232('0x3a')](_0x14bb00[_0xe232('0x3b')],qs['fields'](_0x4e69be[_0xe232('0x37')][_0xe232('0x3c')]));_0x3deea8[_0xe232('0x3d')]=_0x3deea8['attributes']['length']?_0x3deea8['attributes']:_0x14bb00['model'];if(!_0x4e69be[_0xe232('0x37')][_0xe232('0x3e')](_0xe232('0x3f'))){_0x3deea8['limit']=qs['limit'](_0x4e69be[_0xe232('0x37')][_0xe232('0x27')]);_0x3deea8[_0xe232('0x26')]=qs[_0xe232('0x26')](_0x4e69be[_0xe232('0x37')][_0xe232('0x26')]);}_0x3deea8[_0xe232('0x40')]=qs['sort'](_0x4e69be[_0xe232('0x37')][_0xe232('0x41')]);_0x3deea8[_0xe232('0x42')]=qs[_0xe232('0x39')](_['pick'](_0x4e69be[_0xe232('0x37')],_0x14bb00[_0xe232('0x39')]),_0x3bb719);if(_0x4e69be[_0xe232('0x37')][_0xe232('0x43')]){_0x3deea8[_0xe232('0x42')]=_[_0xe232('0x44')](_0x3deea8[_0xe232('0x42')],{'$or':_['map'](_0x3bb719,function(_0x2544bb){if(_0x2544bb[_0xe232('0x35')]!==_0xe232('0x45')){var _0x4a461d={};_0x4a461d[_0x2544bb[_0xe232('0x2f')]]={'$like':'%'+_0x4e69be[_0xe232('0x37')]['filter']+'%'};return _0x4a461d;}})});}_0x3deea8=_[_0xe232('0x44')]({},_0x3deea8,_0x4e69be[_0xe232('0x46')]);var _0x6fa202={'where':_0x3deea8[_0xe232('0x42')]};return db[_0xe232('0x32')]['count'](_0x6fa202)[_0xe232('0x18')](function(_0x572995){_0x49d109[_0xe232('0x47')]=_0x572995;if(_0x4e69be['query'][_0xe232('0x48')]){_0x3deea8['include']=[{'all':!![]}];}return db[_0xe232('0x32')][_0xe232('0x49')](_0x3deea8);})[_0xe232('0x18')](function(_0x5458d7){_0x49d109[_0xe232('0x4a')]=_0x5458d7;return _0x49d109;})[_0xe232('0x18')](respondWithFilteredResult(_0x10f345,_0x3deea8))[_0xe232('0x21')](handleError(_0x10f345,null));};exports['show']=function(_0x29ab98,_0x1bb65f){var _0x2a81c2={'raw':![],'where':{'id':_0x29ab98[_0xe232('0x4b')]['id']}},_0x27d45c={};_0x27d45c[_0xe232('0x3b')]=_['keys'](db['Dynamics365Account'][_0xe232('0x33')]);_0x27d45c[_0xe232('0x37')]=_['keys'](_0x29ab98[_0xe232('0x37')]);_0x27d45c[_0xe232('0x39')]=_[_0xe232('0x3a')](_0x27d45c['model'],_0x27d45c[_0xe232('0x37')]);_0x2a81c2[_0xe232('0x3d')]=_[_0xe232('0x3a')](_0x27d45c[_0xe232('0x3b')],qs['fields'](_0x29ab98[_0xe232('0x37')]['fields']));_0x2a81c2['attributes']=_0x2a81c2['attributes'][_0xe232('0x4c')]?_0x2a81c2[_0xe232('0x3d')]:_0x27d45c[_0xe232('0x3b')];if(_0x29ab98[_0xe232('0x37')][_0xe232('0x48')]){_0x2a81c2['include']=[{'all':!![]}];}_0x2a81c2=_[_0xe232('0x44')]({},_0x2a81c2,_0x29ab98[_0xe232('0x46')]);return db['Dynamics365Account'][_0xe232('0x4d')](_0x2a81c2)[_0xe232('0x18')](handleEntityNotFound(_0x1bb65f,null))[_0xe232('0x18')](respondWithResult(_0x1bb65f,null))[_0xe232('0x21')](handleError(_0x1bb65f,null));};exports[_0xe232('0x4e')]=function(_0x147537,_0x3dd432){return db['Dynamics365Account'][_0xe232('0x4e')](_0x147537[_0xe232('0x4f')],{})['then'](respondWithResult(_0x3dd432,0xc9))[_0xe232('0x21')](handleError(_0x3dd432,null));};exports[_0xe232('0x2c')]=function(_0x730bb7,_0x239c67){if(_0x730bb7[_0xe232('0x4f')]['id']){delete _0x730bb7[_0xe232('0x4f')]['id'];}return db[_0xe232('0x32')][_0xe232('0x4d')]({'where':{'id':_0x730bb7[_0xe232('0x4b')]['id']}})[_0xe232('0x18')](handleEntityNotFound(_0x239c67,null))[_0xe232('0x18')](saveUpdates(_0x730bb7[_0xe232('0x4f')],null))[_0xe232('0x18')](respondWithResult(_0x239c67,null))[_0xe232('0x21')](handleError(_0x239c67,null));};exports[_0xe232('0x2d')]=function(_0x40ce82,_0x3df41c){return db[_0xe232('0x32')][_0xe232('0x4d')]({'where':{'id':_0x40ce82[_0xe232('0x4b')]['id']}})[_0xe232('0x18')](handleEntityNotFound(_0x3df41c,null))['then'](removeEntity(_0x3df41c,null))[_0xe232('0x21')](handleError(_0x3df41c,null));};exports['getConfigurations']=function(_0x51aae4,_0x395af7,_0x5c3521){var _0xa14739={};var _0x177991={};var _0x924b07;var _0xfb6008;return db['Dynamics365Account'][_0xe232('0x50')]({'where':{'id':_0x51aae4[_0xe232('0x4b')]['id']}})['then'](handleEntityNotFound(_0x395af7,null))[_0xe232('0x18')](function(_0x299922){if(_0x299922){_0x924b07=_0x299922;_0x177991[_0xe232('0x3b')]=_['keys'](db[_0xe232('0x51')][_0xe232('0x33')]);_0x177991[_0xe232('0x37')]=_[_0xe232('0x38')](_0x51aae4[_0xe232('0x37')]);_0x177991[_0xe232('0x39')]=_[_0xe232('0x3a')](_0x177991[_0xe232('0x3b')],_0x177991[_0xe232('0x37')]);_0xa14739[_0xe232('0x3d')]=_[_0xe232('0x3a')](_0x177991['model'],qs[_0xe232('0x3c')](_0x51aae4[_0xe232('0x37')][_0xe232('0x3c')]));_0xa14739['attributes']=_0xa14739[_0xe232('0x3d')][_0xe232('0x4c')]?_0xa14739[_0xe232('0x3d')]:_0x177991[_0xe232('0x3b')];_0xa14739[_0xe232('0x40')]=qs[_0xe232('0x41')](_0x51aae4[_0xe232('0x37')][_0xe232('0x41')]);_0xa14739[_0xe232('0x42')]=qs[_0xe232('0x39')](_[_0xe232('0x52')](_0x51aae4[_0xe232('0x37')],_0x177991[_0xe232('0x39')]));if(_0x51aae4['query'][_0xe232('0x43')]){_0xa14739[_0xe232('0x42')]=_[_0xe232('0x44')](_0xa14739[_0xe232('0x42')],{'$or':_['map'](_0xa14739[_0xe232('0x3d')],function(_0x239292){var _0x3e7373={};_0x3e7373[_0x239292]={'$like':'%'+_0x51aae4['query'][_0xe232('0x43')]+'%'};return _0x3e7373;})});}_0xa14739=_[_0xe232('0x44')]({},_0xa14739,_0x51aae4[_0xe232('0x46')]);return _0x924b07[_0xe232('0x53')](_0xa14739);}})['then'](function(_0x31d98a){if(_0x31d98a){_0xfb6008=_0x31d98a['length'];if(!_0x51aae4[_0xe232('0x37')][_0xe232('0x3e')]('nolimit')){_0xa14739[_0xe232('0x27')]=qs['limit'](_0x51aae4[_0xe232('0x37')][_0xe232('0x27')]);_0xa14739[_0xe232('0x26')]=qs[_0xe232('0x26')](_0x51aae4[_0xe232('0x37')][_0xe232('0x26')]);}return _0x924b07[_0xe232('0x53')](_0xa14739);}})[_0xe232('0x18')](function(_0x104084){if(_0x104084){return _0x104084?{'count':_0xfb6008,'rows':_0x104084}:null;}})[_0xe232('0x18')](respondWithResult(_0x395af7,null))[_0xe232('0x21')](handleError(_0x395af7,null));};exports[_0xe232('0x54')]=function(_0x2b2e41,_0x1cec34,_0x4430e7){if(_0x2b2e41[_0xe232('0x4f')]['id']){delete _0x2b2e41[_0xe232('0x4f')]['id'];}return db[_0xe232('0x32')]['findOne']({'where':{'id':_0x2b2e41[_0xe232('0x4b')]['id']}})[_0xe232('0x18')](handleEntityNotFound(_0x1cec34,null))[_0xe232('0x18')](function(_0x25d7cc){if(_0x25d7cc){_0x2b2e41[_0xe232('0x4f')]['AccountId']=_0x25d7cc['id'];_0x2b2e41[_0xe232('0x4f')][_0xe232('0x55')]=integrations['getSubjects'](_0x2b2e41[_0xe232('0x4f')]['channel'],_0x2b2e41[_0xe232('0x4f')][_0xe232('0x35')]);_0x2b2e41[_0xe232('0x4f')][_0xe232('0x56')]=integrations['getDescriptions'](_0x2b2e41[_0xe232('0x4f')][_0xe232('0x57')],_0x2b2e41[_0xe232('0x4f')]['type']);return db[_0xe232('0x51')][_0xe232('0x4e')](_0x2b2e41['body'],{'include':[{'model':db[_0xe232('0x58')],'as':_0xe232('0x55')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0xe232('0x18')](respondWithResult(_0x1cec34,null))['catch'](handleError(_0x1cec34,null));};exports[_0xe232('0x59')]=function(_0x21f536,_0x5d3f48,_0x6fe27f){var _0x2efa9e=_0x21f536[_0xe232('0x37')][_0xe232('0x5a')];var _0x2650a1=_0x2efa9e===_0xe232('0x5b')?_0xe232('0x5c'):_0xe232('0x5d');var _0x3174ea='';var _0x4a869f='';var _0x509624='';var _0x249033='';var _0x434f8b='';var _0x1952bd='';var _0x2e411e='';var _0x1c565c='';var _0x5337a5=[_0xe232('0x5e'),_0xe232('0x5f'),_0xe232('0x60'),'ownerid',_0xe232('0x61'),_0xe232('0x62'),'phonenumber','regardingobjectid',_0xe232('0x63'),_0xe232('0x64')];var _0x52c15e=[_0xe232('0x65'),'accountidyominame',_0xe232('0x66'),_0xe232('0x67'),_0xe232('0x68'),_0xe232('0x69'),_0xe232('0x6a'),'contractidname',_0xe232('0x6b'),'createdbyexternalpartyyominame',_0xe232('0x6c'),_0xe232('0x6d'),_0xe232('0x6e'),_0xe232('0x6f'),_0xe232('0x70'),_0xe232('0x71'),_0xe232('0x72'),_0xe232('0x73'),_0xe232('0x74'),_0xe232('0x75'),_0xe232('0x76'),'entityimage_url',_0xe232('0x77'),_0xe232('0x78'),_0xe232('0x79'),_0xe232('0x7a'),_0xe232('0x7b'),'influencescore',_0xe232('0x7c'),'lastonholdtime','masteridname',_0xe232('0x7d'),_0xe232('0x7e'),_0xe232('0x7f'),'modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname',_0xe232('0x80'),_0xe232('0x81'),_0xe232('0x82'),_0xe232('0x83'),_0xe232('0x84'),_0xe232('0x85'),_0xe232('0x86'),_0xe232('0x87'),_0xe232('0x88'),_0xe232('0x89'),_0xe232('0x8a'),_0xe232('0x8b'),_0xe232('0x8c'),_0xe232('0x8d'),_0xe232('0x8e'),_0xe232('0x8f'),_0xe232('0x90'),_0xe232('0x91'),'slainvokedidname','slaname',_0xe232('0x92'),'statecode',_0xe232('0x93'),_0xe232('0x94'),_0xe232('0x95'),_0xe232('0x96'),_0xe232('0x97'),_0xe232('0x98'),_0xe232('0x99'),_0xe232('0x9a')];var _0x40f82f=_0x5337a5[_0xe232('0x9b')](_0x52c15e);return db['Dynamics365Account'][_0xe232('0x50')]({'where':{'id':_0x21f536[_0xe232('0x4b')]['id']},'attributes':['id',_0xe232('0x9c'),_0xe232('0x9d'),_0xe232('0x9e'),'tenantId','clientId',_0xe232('0x9f')]})[_0xe232('0x18')](handleEntityNotFound(_0x5d3f48,null))[_0xe232('0x18')](function(_0x52bfd8){if(_0x52bfd8){_0x1c565c=_0x52bfd8[_0xe232('0x9e')];var _0x24ab24=_0x1c565c['slice'](-0x1);if(_0x24ab24==='/'){_0x1c565c=_0x1c565c[_0xe232('0xa0')](0x0,_0x1c565c[_0xe232('0xa1')](_0x24ab24));}_0x2e411e=util[_0xe232('0xa2')](_0xe232('0xa3'),_0x1c565c);var _0x588a75={'method':_0xe232('0xa4'),'uri':'https://login.microsoftonline.com/'+_0x52bfd8[_0xe232('0xa5')]+_0xe232('0xa6'),'form':{'client_id':_0x52bfd8[_0xe232('0xa7')],'resource':_0x1c565c,'username':_0x52bfd8[_0xe232('0x9c')],'password':_0x52bfd8[_0xe232('0x9d')],'grant_type':_0xe232('0x9d'),'client_secret':_0x52bfd8[_0xe232('0x9f')]},'json':!![]};return rp(_0x588a75);}})[_0xe232('0x18')](function(_0x42cbb8){_0x1952bd=_0x42cbb8[_0xe232('0xa8')];var _0x2ec457={'method':_0xe232('0xa9'),'uri':encodeURI(_0x2e411e+_0xe232('0xaa')+_0x2650a1+'\x27'),'headers':{'Authorization':_0xe232('0xab')+_0x1952bd,'If-None-Match':null,'OData-Version':_0xe232('0xac')},'json':!![]};return rp(_0x2ec457);})[_0xe232('0x18')](function(_0x17446f){var _0x5d5536=_0x17446f[_0xe232('0xad')][0x0];var _0x8e06a1=_0x5d5536['MetadataId'];var _0x1befca={'method':_0xe232('0xa9'),'uri':_0x2e411e+_0xe232('0xae')+_0x8e06a1+_0xe232('0xaf'),'headers':{'Authorization':_0xe232('0xab')+_0x1952bd,'If-None-Match':null,'OData-Version':_0xe232('0xac')},'json':!![]};return rp(_0x1befca);})[_0xe232('0x18')](function(_0x338791){_0x3174ea=_0x338791;_0x4a869f=_0x3174ea[_0xe232('0xb0')];_0x4a869f=_[_0xe232('0xb1')](_0x4a869f,function(_0x7e7bfe){return!_0x40f82f[_0xe232('0xb2')](_0x7e7bfe['LogicalName']);});var _0x3840a9=[];var _0x4a4dc4=[];_0x4a869f[_0xe232('0xb3')](function(_0x5e66fc){if(_0x5e66fc[_0xe232('0xb4')]){var _0x3e6295=_0x5e66fc[_0xe232('0xb4')]['substring'](_0x5e66fc[_0xe232('0xb4')]['lastIndexOf']('.')+0x1);if(_0x3e6295===_0xe232('0xb5')){_0x3840a9[_0xe232('0xb6')](getSelectList(_0x2e411e,_0x2efa9e,_0x4a4dc4,_0x3174ea[_0xe232('0xb7')],_0x5e66fc['MetadataId'],_0x1952bd));}}});return Promise[_0xe232('0xb8')](_0x3840a9);})[_0xe232('0x18')](function(_0x597a04){_0x509624=_0x597a04[0x0];var _0x5a936e=[];var _0x33692e=[];_0x4a869f[_0xe232('0xb3')](function(_0x19d76b){if(!_[_0xe232('0xb9')](_0x19d76b[_0xe232('0xb4')])){var _0x54691a=_0x19d76b['@odata.type'][_0xe232('0xa0')](_0x19d76b[_0xe232('0xb4')][_0xe232('0xa1')]('.')+0x1);if(_0x54691a==='BooleanAttributeMetadata'){_0x5a936e[_0xe232('0xb6')](getBooleanList(_0x2e411e,_0x2efa9e,_0x33692e,_0x3174ea[_0xe232('0xb7')],_0x19d76b['MetadataId'],_0x1952bd));}}});return Promise[_0xe232('0xb8')](_0x5a936e);})[_0xe232('0x18')](function(_0x17a1c2){_0x249033=_0x17a1c2[0x0];var _0x508330=[];var _0x56e386=[];_0x4a869f[_0xe232('0xb3')](function(_0x5e44d1){if(_0x5e44d1['@odata.type']){var _0x5f1aa1=_0x5e44d1['@odata.type']['substring'](_0x5e44d1[_0xe232('0xb4')]['lastIndexOf']('.')+0x1);if(_0x5f1aa1==='StringAttributeMetadata'||_0x5f1aa1==='DoubleAttributeMetadata'||_0x5f1aa1===_0xe232('0xba')||_0x5f1aa1==='IntegerAttributeMetadata'||_0x5f1aa1===_0xe232('0xbb')||_0x5f1aa1===_0xe232('0xbc')||_0x5f1aa1===_0xe232('0xbd')||_0x5f1aa1===_0xe232('0xbe')||_0x5f1aa1==='StateAttributeMetadata'||_0x5f1aa1===_0xe232('0xbf')){_0x508330[_0xe232('0xb6')](getInputList(_0x2e411e,_0x2efa9e,_0x5f1aa1,_0x56e386,_0x3174ea[_0xe232('0xb7')],_0x5e44d1[_0xe232('0xb7')],_0x1952bd));}}});return Promise[_0xe232('0xb8')](_0x508330);})['then'](function(_0x1ad920){_0x434f8b=_0x1ad920[0x0];var _0x2f241f=_0x509624[_0xe232('0x9b')](_0x249033)['concat'](_0x434f8b);var _0x44b15e={'count':_0x2f241f['length'],'rows':_0x2f241f};return _0x44b15e;})[_0xe232('0x18')](respondWithResult(_0x5d3f48,null))[_0xe232('0x21')](function(_0x4c13a8){var _0x48b887=_0x21f536[_0xe232('0x37')][_0xe232('0xc0')]?0x1f4:_0x4c13a8[_0xe232('0xc1')]||0x1f4;logger['error'](_0x4c13a8['stack']);delete _0x4c13a8['name'];if(_0x48b887===0x191){_0x48b887=0x190;}_0x5d3f48[_0xe232('0x23')](_0x48b887)[_0xe232('0xc2')](_0x21f536[_0xe232('0x37')][_0xe232('0xc0')]?{'message':_0xe232('0xc3'),'statusCode':_0x4c13a8[_0xe232('0xc1')]}:_0x4c13a8);});};function getSelectList(_0x4880c8,_0x587e0e,_0x1906de,_0xcb5a95,_0x449863,_0x5b601e){var _0x3ada3d={'method':'GET','uri':_0x4880c8+'EntityDefinitions('+_0xcb5a95+')/Attributes('+_0x449863+_0xe232('0xc4')+_0xe232('0xc5'),'headers':{'Authorization':'Bearer\x20'+_0x5b601e,'If-None-Match':null,'OData-Version':_0xe232('0xac')},'json':!![]};return rp(_0x3ada3d)[_0xe232('0x18')](function(_0x1cd9a1){var _0x28a8d3=[];var _0x2b8abe=_0x1cd9a1[_0xe232('0xc6')][_0xe232('0xc7')];_0x2b8abe[_0xe232('0xb3')](function(_0x32c147){_0x28a8d3[_0xe232('0xb6')]({'name':_0x32c147[_0xe232('0xc8')]['UserLocalizedLabel'][_0xe232('0xc8')],'value':String(_0x32c147[_0xe232('0xc9')])});});var _0x30c93f={'id':_0x587e0e+'_'+_0x1cd9a1[_0xe232('0xca')],'name':_0x1cd9a1[_0xe232('0xcb')][_0xe232('0xcc')][_0xe232('0xc8')],'custom':![],'options':_0x28a8d3};_0x1906de[_0xe232('0xb6')](_0x30c93f);return _0x1906de;});}function getBooleanList(_0x351aa8,_0x55f67f,_0x56280c,_0x2be614,_0x3465cd,_0x10f52d){var _0x17fcdb={'method':_0xe232('0xa9'),'uri':_0x351aa8+_0xe232('0xae')+_0x2be614+_0xe232('0xcd')+_0x3465cd+_0xe232('0xce'),'headers':{'Authorization':_0xe232('0xab')+_0x10f52d,'If-None-Match':null,'OData-Version':_0xe232('0xac')},'json':!![]};return rp(_0x17fcdb)[_0xe232('0x18')](function(_0x4b4491){var _0x3425f6=[];_0x3425f6[_0xe232('0xb6')]({'name':_0x4b4491['OptionSet'][_0xe232('0xcf')][_0xe232('0xc8')][_0xe232('0xcc')]['Label'],'value':_0xe232('0xd0')},{'name':_0x4b4491[_0xe232('0xc6')]['FalseOption'][_0xe232('0xc8')][_0xe232('0xcc')]['Label'],'value':'false'});var _0x393683={'id':_0x55f67f+'_'+_0x4b4491['LogicalName'],'name':_0x4b4491[_0xe232('0xcb')][_0xe232('0xcc')]['Label'],'custom':![],'options':_0x3425f6};_0x56280c[_0xe232('0xb6')](_0x393683);return _0x56280c;});}function getInputList(_0x21084d,_0x3c15dd,_0x5a7c05,_0x496680,_0xa1bb16,_0x3472d6,_0x55cc68){var _0x8280dc={'method':_0xe232('0xa9'),'uri':_0x21084d+'EntityDefinitions('+_0xa1bb16+_0xe232('0xcd')+_0x3472d6+_0xe232('0xd1')+_0x5a7c05+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xe232('0xab')+_0x55cc68,'If-None-Match':null,'OData-Version':_0xe232('0xac')},'json':!![]};return rp(_0x8280dc)[_0xe232('0x18')](function(_0x4695d5){var _0x17f4ad={'id':_0x3c15dd+'_'+_0x4695d5[_0xe232('0xca')],'name':_0x4695d5[_0xe232('0xcb')]['UserLocalizedLabel']?_0x4695d5[_0xe232('0xcb')][_0xe232('0xcc')]['Label']:_0x4695d5['LogicalName'],'custom':![],'options':[]};_0x496680[_0xe232('0xb6')](_0x17f4ad);return _0x496680;});} \ No newline at end of file +var _0x845e=['map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','count','include','rows','rawAttributes','options','find','create','body','update','params','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','description','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidyominame','createdbyexternalpartyname','createdbyname','createdon','createdonbehalfbyname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','msdyn_iotalertname','numberofchildincidents','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolvebykpiidname','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','Bearer\x20','4.0','value','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','forEach','@odata.type','substring','PicklistAttributeMetadata','push','MetadataId','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Label','UserLocalizedLabel','DisplayName','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','LogicalName','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','jayson/promise','http','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','limit','set','apply','reject','save','then','destroy','end','stack','name','send','index','Dynamics365Account','fieldName','type','model'];(function(_0x51ed62,_0x574379){var _0x34aee3=function(_0x2958bc){while(--_0x2958bc){_0x51ed62['push'](_0x51ed62['shift']());}};_0x34aee3(++_0x574379);}(_0x845e,0x94));var _0xe845=function(_0x7638e6,_0x1426e6){_0x7638e6=_0x7638e6-0x0;var _0x4aad4f=_0x845e[_0x7638e6];return _0x4aad4f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe845('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe845('0x1'));var rp=require('request-promise');var moment=require(_0xe845('0x2'));var BPromise=require(_0xe845('0x3'));var Mustache=require('mustache');var util=require(_0xe845('0x4'));var path=require(_0xe845('0x5'));var sox=require(_0xe845('0x6'));var csv=require(_0xe845('0x7'));var ejs=require(_0xe845('0x8'));var fs=require('fs');var fs_extra=require(_0xe845('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe845('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe845('0xb'));var toCsv=require(_0xe845('0x7'));var querystring=require(_0xe845('0xc'));var Papa=require('papaparse');var Redis=require(_0xe845('0xd'));var authService=require(_0xe845('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xe845('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe845('0x10'))(_0xe845('0x11'));var utils=require(_0xe845('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xe845('0x13'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xe845('0x14'));var client=jayson['client'][_0xe845('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x5d9c06,_0x39dd8d,_0x5f380e,_0xb07375){return new BPromise(function(_0x52aa5b,_0x1accd){var _0x323557=_0xb07375||client;return _0x323557['request'](_0x5d9c06,_0x5f380e)['then'](function(_0x30976c){logger[_0xe845('0x16')]('Dynamics365Account,\x20%s,\x20%s',_0x39dd8d,_0xe845('0x17'));logger[_0xe845('0x18')](_0xe845('0x19'),_0x39dd8d,'request\x20sent',JSON[_0xe845('0x1a')](_0x30976c));if(_0x30976c[_0xe845('0x1b')]){if(_0x30976c[_0xe845('0x1b')]['code']===0x1f4){logger[_0xe845('0x1b')](_0xe845('0x1c'),_0x39dd8d,_0x30976c['error'][_0xe845('0x1d')]);return _0x1accd(_0x30976c[_0xe845('0x1b')]['message']);}logger[_0xe845('0x1b')](_0xe845('0x1c'),_0x39dd8d,_0x30976c['error'][_0xe845('0x1d')]);return _0x52aa5b(_0x30976c[_0xe845('0x1b')][_0xe845('0x1d')]);}else{logger[_0xe845('0x16')](_0xe845('0x1c'),_0x39dd8d,_0xe845('0x17'));_0x52aa5b(_0x30976c[_0xe845('0x1e')][_0xe845('0x1d')]);}})[_0xe845('0x1f')](function(_0x1a9c5a){logger[_0xe845('0x1b')](_0xe845('0x1c'),_0x39dd8d,_0x1a9c5a);_0x1accd(_0x1a9c5a);});});}function respondWithStatusCode(_0x2c70e6,_0x1166cf){_0x1166cf=_0x1166cf||0xcc;return function(_0x2cc2f2){if(_0x2cc2f2){return _0x2c70e6[_0xe845('0x20')](_0x1166cf);}return _0x2c70e6[_0xe845('0x21')](_0x1166cf)['end']();};}function respondWithResult(_0x3c47b2,_0x19072a){_0x19072a=_0x19072a||0xc8;return function(_0x52e72f){if(_0x52e72f){return _0x3c47b2['status'](_0x19072a)[_0xe845('0x22')](_0x52e72f);}};}function respondWithFilteredResult(_0x2f8f89,_0x585d8f){return function(_0x555380){if(_0x555380){var _0x4639d9=_0x555380['count'],_0x31469f=_0x585d8f[_0xe845('0x23')],_0x17f124=_0x585d8f[_0xe845('0x23')]+_0x585d8f[_0xe845('0x24')],_0x47072b;if(_0x17f124>=_0x4639d9){_0x17f124=_0x4639d9;_0x47072b=0xc8;}else{_0x47072b=0xce;}_0x2f8f89['status'](_0x47072b);return _0x2f8f89[_0xe845('0x25')]('Content-Range',_0x31469f+'-'+_0x17f124+'/'+_0x4639d9)['json'](_0x555380);}return null;};}function patchUpdates(_0x542baa){return function(_0x3a22a8){try{jsonpatch[_0xe845('0x26')](_0x3a22a8,_0x542baa,!![]);}catch(_0x3c84b0){return BPromise[_0xe845('0x27')](_0x3c84b0);}return _0x3a22a8[_0xe845('0x28')]();};}function saveUpdates(_0x7a9fa6,_0x1cd488){return function(_0x4654d9){if(_0x4654d9){return _0x4654d9['update'](_0x7a9fa6)[_0xe845('0x29')](function(_0x2ed4a9){return _0x2ed4a9;});}return null;};}function removeEntity(_0x46c9cc,_0x35466a){return function(_0x579dae){if(_0x579dae){return _0x579dae[_0xe845('0x2a')]()[_0xe845('0x29')](function(){_0x46c9cc[_0xe845('0x21')](0xcc)[_0xe845('0x2b')]();});}};}function handleEntityNotFound(_0x1df272,_0x3e5933){return function(_0x3ab5aa){if(!_0x3ab5aa){_0x1df272[_0xe845('0x20')](0x194);}return _0x3ab5aa;};}function handleError(_0x5c14c7,_0x4d85a8){_0x4d85a8=_0x4d85a8||0x1f4;return function(_0x47c361){logger['error'](_0x47c361[_0xe845('0x2c')]);if(_0x47c361[_0xe845('0x2d')]){delete _0x47c361['name'];}_0x5c14c7[_0xe845('0x21')](_0x4d85a8)[_0xe845('0x2e')](_0x47c361);};}exports[_0xe845('0x2f')]=function(_0x596042,_0x20f9d7){var _0x673545={},_0x4e6f90={},_0x140a60={'count':0x0,'rows':[]};var _0x3c2ec3=_['map'](db[_0xe845('0x30')]['rawAttributes'],function(_0x58a38b){return{'name':_0x58a38b[_0xe845('0x31')],'type':_0x58a38b[_0xe845('0x32')]['key']};});_0x4e6f90[_0xe845('0x33')]=_[_0xe845('0x34')](_0x3c2ec3,_0xe845('0x2d'));_0x4e6f90[_0xe845('0x35')]=_[_0xe845('0x36')](_0x596042[_0xe845('0x35')]);_0x4e6f90['filters']=_[_0xe845('0x37')](_0x4e6f90[_0xe845('0x33')],_0x4e6f90[_0xe845('0x35')]);_0x673545['attributes']=_[_0xe845('0x37')](_0x4e6f90[_0xe845('0x33')],qs[_0xe845('0x38')](_0x596042[_0xe845('0x35')]['fields']));_0x673545[_0xe845('0x39')]=_0x673545[_0xe845('0x39')][_0xe845('0x3a')]?_0x673545['attributes']:_0x4e6f90[_0xe845('0x33')];if(!_0x596042['query'][_0xe845('0x3b')](_0xe845('0x3c'))){_0x673545[_0xe845('0x24')]=qs['limit'](_0x596042['query'][_0xe845('0x24')]);_0x673545[_0xe845('0x23')]=qs[_0xe845('0x23')](_0x596042['query']['offset']);}_0x673545['order']=qs['sort'](_0x596042[_0xe845('0x35')][_0xe845('0x3d')]);_0x673545[_0xe845('0x3e')]=qs[_0xe845('0x3f')](_[_0xe845('0x40')](_0x596042[_0xe845('0x35')],_0x4e6f90[_0xe845('0x3f')]),_0x3c2ec3);if(_0x596042['query'][_0xe845('0x41')]){_0x673545[_0xe845('0x3e')]=_['merge'](_0x673545['where'],{'$or':_[_0xe845('0x34')](_0x3c2ec3,function(_0x2f1cf8){if(_0x2f1cf8[_0xe845('0x32')]!==_0xe845('0x42')){var _0xf391e6={};_0xf391e6[_0x2f1cf8[_0xe845('0x2d')]]={'$like':'%'+_0x596042[_0xe845('0x35')][_0xe845('0x41')]+'%'};return _0xf391e6;}})});}_0x673545=_[_0xe845('0x43')]({},_0x673545,_0x596042['options']);var _0x10182e={'where':_0x673545[_0xe845('0x3e')]};return db['Dynamics365Account'][_0xe845('0x44')](_0x10182e)[_0xe845('0x29')](function(_0x54b605){_0x140a60['count']=_0x54b605;if(_0x596042[_0xe845('0x35')]['includeAll']){_0x673545[_0xe845('0x45')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x673545);})[_0xe845('0x29')](function(_0x50ad07){_0x140a60[_0xe845('0x46')]=_0x50ad07;return _0x140a60;})[_0xe845('0x29')](respondWithFilteredResult(_0x20f9d7,_0x673545))[_0xe845('0x1f')](handleError(_0x20f9d7,null));};exports['show']=function(_0x1f6cf2,_0x4a04c4){var _0x57bd7c={'raw':![],'where':{'id':_0x1f6cf2['params']['id']}},_0x2f565d={};_0x2f565d[_0xe845('0x33')]=_[_0xe845('0x36')](db['Dynamics365Account'][_0xe845('0x47')]);_0x2f565d[_0xe845('0x35')]=_['keys'](_0x1f6cf2[_0xe845('0x35')]);_0x2f565d[_0xe845('0x3f')]=_['intersection'](_0x2f565d[_0xe845('0x33')],_0x2f565d[_0xe845('0x35')]);_0x57bd7c[_0xe845('0x39')]=_['intersection'](_0x2f565d[_0xe845('0x33')],qs[_0xe845('0x38')](_0x1f6cf2[_0xe845('0x35')]['fields']));_0x57bd7c[_0xe845('0x39')]=_0x57bd7c[_0xe845('0x39')][_0xe845('0x3a')]?_0x57bd7c[_0xe845('0x39')]:_0x2f565d['model'];if(_0x1f6cf2[_0xe845('0x35')]['includeAll']){_0x57bd7c['include']=[{'all':!![]}];}_0x57bd7c=_['merge']({},_0x57bd7c,_0x1f6cf2[_0xe845('0x48')]);return db[_0xe845('0x30')][_0xe845('0x49')](_0x57bd7c)[_0xe845('0x29')](handleEntityNotFound(_0x4a04c4,null))[_0xe845('0x29')](respondWithResult(_0x4a04c4,null))['catch'](handleError(_0x4a04c4,null));};exports[_0xe845('0x4a')]=function(_0x265952,_0x3bec04){return db[_0xe845('0x30')][_0xe845('0x4a')](_0x265952[_0xe845('0x4b')],{})['then'](respondWithResult(_0x3bec04,0xc9))[_0xe845('0x1f')](handleError(_0x3bec04,null));};exports[_0xe845('0x4c')]=function(_0x2842ea,_0x4cef5a){if(_0x2842ea['body']['id']){delete _0x2842ea[_0xe845('0x4b')]['id'];}return db[_0xe845('0x30')][_0xe845('0x49')]({'where':{'id':_0x2842ea[_0xe845('0x4d')]['id']}})[_0xe845('0x29')](handleEntityNotFound(_0x4cef5a,null))[_0xe845('0x29')](saveUpdates(_0x2842ea[_0xe845('0x4b')],null))[_0xe845('0x29')](respondWithResult(_0x4cef5a,null))['catch'](handleError(_0x4cef5a,null));};exports['destroy']=function(_0x16a678,_0xdcd809){return db['Dynamics365Account']['find']({'where':{'id':_0x16a678[_0xe845('0x4d')]['id']}})[_0xe845('0x29')](handleEntityNotFound(_0xdcd809,null))['then'](removeEntity(_0xdcd809,null))[_0xe845('0x1f')](handleError(_0xdcd809,null));};exports[_0xe845('0x4e')]=function(_0x27cac6,_0x5e3d48,_0x276eba){var _0x9b649={};var _0x5f1eca={};var _0x3c131a;var _0x37ffeb;return db[_0xe845('0x30')][_0xe845('0x4f')]({'where':{'id':_0x27cac6['params']['id']}})[_0xe845('0x29')](handleEntityNotFound(_0x5e3d48,null))[_0xe845('0x29')](function(_0x2ba8b2){if(_0x2ba8b2){_0x3c131a=_0x2ba8b2;_0x5f1eca[_0xe845('0x33')]=_['keys'](db[_0xe845('0x50')][_0xe845('0x47')]);_0x5f1eca[_0xe845('0x35')]=_[_0xe845('0x36')](_0x27cac6[_0xe845('0x35')]);_0x5f1eca[_0xe845('0x3f')]=_[_0xe845('0x37')](_0x5f1eca[_0xe845('0x33')],_0x5f1eca[_0xe845('0x35')]);_0x9b649[_0xe845('0x39')]=_[_0xe845('0x37')](_0x5f1eca[_0xe845('0x33')],qs[_0xe845('0x38')](_0x27cac6[_0xe845('0x35')][_0xe845('0x38')]));_0x9b649['attributes']=_0x9b649[_0xe845('0x39')][_0xe845('0x3a')]?_0x9b649['attributes']:_0x5f1eca[_0xe845('0x33')];_0x9b649['order']=qs['sort'](_0x27cac6[_0xe845('0x35')]['sort']);_0x9b649[_0xe845('0x3e')]=qs[_0xe845('0x3f')](_[_0xe845('0x40')](_0x27cac6[_0xe845('0x35')],_0x5f1eca[_0xe845('0x3f')]));if(_0x27cac6['query'][_0xe845('0x41')]){_0x9b649['where']=_[_0xe845('0x43')](_0x9b649['where'],{'$or':_[_0xe845('0x34')](_0x9b649[_0xe845('0x39')],function(_0x33cef5){var _0x33aab8={};_0x33aab8[_0x33cef5]={'$like':'%'+_0x27cac6['query'][_0xe845('0x41')]+'%'};return _0x33aab8;})});}_0x9b649=_[_0xe845('0x43')]({},_0x9b649,_0x27cac6[_0xe845('0x48')]);return _0x3c131a[_0xe845('0x4e')](_0x9b649);}})[_0xe845('0x29')](function(_0x1c1638){if(_0x1c1638){_0x37ffeb=_0x1c1638[_0xe845('0x3a')];if(!_0x27cac6[_0xe845('0x35')][_0xe845('0x3b')]('nolimit')){_0x9b649['limit']=qs['limit'](_0x27cac6[_0xe845('0x35')][_0xe845('0x24')]);_0x9b649['offset']=qs[_0xe845('0x23')](_0x27cac6[_0xe845('0x35')]['offset']);}return _0x3c131a[_0xe845('0x4e')](_0x9b649);}})[_0xe845('0x29')](function(_0x10e408){if(_0x10e408){return _0x10e408?{'count':_0x37ffeb,'rows':_0x10e408}:null;}})[_0xe845('0x29')](respondWithResult(_0x5e3d48,null))['catch'](handleError(_0x5e3d48,null));};exports[_0xe845('0x51')]=function(_0x47f348,_0x55c2e9,_0xdf0668){if(_0x47f348['body']['id']){delete _0x47f348[_0xe845('0x4b')]['id'];}return db['Dynamics365Account'][_0xe845('0x4f')]({'where':{'id':_0x47f348[_0xe845('0x4d')]['id']}})[_0xe845('0x29')](handleEntityNotFound(_0x55c2e9,null))[_0xe845('0x29')](function(_0x136d9f){if(_0x136d9f){_0x47f348[_0xe845('0x4b')][_0xe845('0x52')]=_0x136d9f['id'];_0x47f348[_0xe845('0x4b')][_0xe845('0x53')]=integrations['getSubjects'](_0x47f348[_0xe845('0x4b')]['channel'],_0x47f348['body']['type']);_0x47f348['body'][_0xe845('0x54')]=integrations[_0xe845('0x55')](_0x47f348[_0xe845('0x4b')][_0xe845('0x56')],_0x47f348['body'][_0xe845('0x32')]);return db[_0xe845('0x50')][_0xe845('0x4a')](_0x47f348[_0xe845('0x4b')],{'include':[{'model':db[_0xe845('0x57')],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0xe845('0x54')}]});}return null;})[_0xe845('0x29')](respondWithResult(_0x55c2e9,null))[_0xe845('0x1f')](handleError(_0x55c2e9,null));};exports[_0xe845('0x58')]=function(_0x5750cb,_0x4ccfc4,_0x1ccf2d){var _0x20a7d0=_0x5750cb[_0xe845('0x35')][_0xe845('0x59')];var _0x2cf9be=_0x20a7d0===_0xe845('0x5a')?_0xe845('0x5b'):_0xe845('0x5c');var _0x1d8f6d='';var _0x459df8='';var _0x39110b='';var _0x56bc9b='';var _0x13b734='';var _0x224db4='';var _0x1112f2='';var _0x396b31='';var _0x52ee09=['title',_0xe845('0x5d'),'customerid',_0xe845('0x5e'),_0xe845('0x5f'),_0xe845('0x60'),_0xe845('0x61'),_0xe845('0x62'),_0xe845('0x63'),_0xe845('0x64')];var _0x1c8796=[_0xe845('0x65'),'accountidyominame',_0xe845('0x66'),_0xe845('0x67'),'contactidname',_0xe845('0x68'),'contractdetailidname','contractidname',_0xe845('0x69'),'createdbyexternalpartyyominame',_0xe845('0x6a'),'createdbyyominame',_0xe845('0x6b'),_0xe845('0x6c'),'createdonbehalfbyyominame','customeridname',_0xe845('0x6d'),_0xe845('0x6e'),_0xe845('0x6f'),_0xe845('0x70'),_0xe845('0x71'),'entityimage_url',_0xe845('0x72'),_0xe845('0x73'),_0xe845('0x74'),_0xe845('0x75'),_0xe845('0x76'),_0xe845('0x77'),'kbarticleidname',_0xe845('0x78'),_0xe845('0x79'),_0xe845('0x7a'),_0xe845('0x7b'),_0xe845('0x7c'),'modifiedbyyominame',_0xe845('0x7d'),'modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename',_0xe845('0x7e'),_0xe845('0x7f'),'onholdtime','overriddencreatedon','owneridname',_0xe845('0x80'),_0xe845('0x81'),_0xe845('0x82'),_0xe845('0x83'),_0xe845('0x84'),_0xe845('0x85'),_0xe845('0x86'),'productserialnumber','resolveby',_0xe845('0x87'),'responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue',_0xe845('0x88'),_0xe845('0x89'),_0xe845('0x8a'),_0xe845('0x8b'),_0xe845('0x8c'),_0xe845('0x8d'),_0xe845('0x8e'),_0xe845('0x8f'),_0xe845('0x90'),_0xe845('0x91'),_0xe845('0x92'),_0xe845('0x93')];var _0xbd4760=_0x52ee09[_0xe845('0x94')](_0x1c8796);return db[_0xe845('0x30')][_0xe845('0x4f')]({'where':{'id':_0x5750cb[_0xe845('0x4d')]['id']},'attributes':['id',_0xe845('0x95'),_0xe845('0x96'),_0xe845('0x97'),_0xe845('0x98'),_0xe845('0x99'),_0xe845('0x9a')]})[_0xe845('0x29')](handleEntityNotFound(_0x4ccfc4,null))['then'](function(_0x2217e2){if(_0x2217e2){_0x396b31=_0x2217e2[_0xe845('0x97')];var _0xf9b766=_0x396b31['slice'](-0x1);if(_0xf9b766==='/'){_0x396b31=_0x396b31['substring'](0x0,_0x396b31[_0xe845('0x9b')](_0xf9b766));}_0x1112f2=util[_0xe845('0x9c')](_0xe845('0x9d'),_0x396b31);var _0x4695f7={'method':_0xe845('0x9e'),'uri':_0xe845('0x9f')+_0x2217e2[_0xe845('0x98')]+'/oauth2/token','form':{'client_id':_0x2217e2['clientId'],'resource':_0x396b31,'username':_0x2217e2['username'],'password':_0x2217e2[_0xe845('0x96')],'grant_type':_0xe845('0x96'),'client_secret':_0x2217e2[_0xe845('0x9a')]},'json':!![]};return rp(_0x4695f7);}})['then'](function(_0x56b0bf){_0x224db4=_0x56b0bf['access_token'];var _0x248378={'method':'GET','uri':encodeURI(_0x1112f2+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x2cf9be+'\x27'),'headers':{'Authorization':_0xe845('0xa0')+_0x224db4,'If-None-Match':null,'OData-Version':_0xe845('0xa1')},'json':!![]};return rp(_0x248378);})[_0xe845('0x29')](function(_0x46ccda){var _0x46a77b=_0x46ccda[_0xe845('0xa2')][0x0];var _0x3d69c0=_0x46a77b['MetadataId'];var _0x451a61={'method':_0xe845('0xa3'),'uri':_0x1112f2+_0xe845('0xa4')+_0x3d69c0+_0xe845('0xa5'),'headers':{'Authorization':_0xe845('0xa0')+_0x224db4,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x451a61);})[_0xe845('0x29')](function(_0x516464){_0x1d8f6d=_0x516464;_0x459df8=_0x1d8f6d[_0xe845('0xa6')];_0x459df8=_[_0xe845('0xa7')](_0x459df8,function(_0x338775){return!_0xbd4760[_0xe845('0xa8')](_0x338775['LogicalName']);});var _0x1997be=[];var _0x298741=[];_0x459df8[_0xe845('0xa9')](function(_0x2f0441){if(_0x2f0441[_0xe845('0xaa')]){var _0x22c3fb=_0x2f0441[_0xe845('0xaa')][_0xe845('0xab')](_0x2f0441[_0xe845('0xaa')][_0xe845('0x9b')]('.')+0x1);if(_0x22c3fb===_0xe845('0xac')){_0x1997be[_0xe845('0xad')](getSelectList(_0x1112f2,_0x20a7d0,_0x298741,_0x1d8f6d[_0xe845('0xae')],_0x2f0441[_0xe845('0xae')],_0x224db4));}}});return Promise[_0xe845('0xaf')](_0x1997be);})['then'](function(_0x445968){_0x39110b=_0x445968[0x0];var _0x3e6d91=[];var _0x50392d=[];_0x459df8['forEach'](function(_0x4629e3){if(!_[_0xe845('0xb0')](_0x4629e3['@odata.type'])){var _0x1e7ec6=_0x4629e3[_0xe845('0xaa')][_0xe845('0xab')](_0x4629e3[_0xe845('0xaa')][_0xe845('0x9b')]('.')+0x1);if(_0x1e7ec6===_0xe845('0xb1')){_0x3e6d91[_0xe845('0xad')](getBooleanList(_0x1112f2,_0x20a7d0,_0x50392d,_0x1d8f6d[_0xe845('0xae')],_0x4629e3[_0xe845('0xae')],_0x224db4));}}});return Promise['all'](_0x3e6d91);})[_0xe845('0x29')](function(_0x21d037){_0x56bc9b=_0x21d037[0x0];var _0x21da59=[];var _0x3aedd0=[];_0x459df8['forEach'](function(_0x5ad962){if(_0x5ad962[_0xe845('0xaa')]){var _0x3ed8f6=_0x5ad962[_0xe845('0xaa')]['substring'](_0x5ad962[_0xe845('0xaa')][_0xe845('0x9b')]('.')+0x1);if(_0x3ed8f6===_0xe845('0xb2')||_0x3ed8f6===_0xe845('0xb3')||_0x3ed8f6===_0xe845('0xb4')||_0x3ed8f6===_0xe845('0xb5')||_0x3ed8f6===_0xe845('0xb6')||_0x3ed8f6===_0xe845('0xb7')||_0x3ed8f6===_0xe845('0xb8')||_0x3ed8f6===_0xe845('0xb9')||_0x3ed8f6===_0xe845('0xba')||_0x3ed8f6===_0xe845('0xbb')){_0x21da59['push'](getInputList(_0x1112f2,_0x20a7d0,_0x3ed8f6,_0x3aedd0,_0x1d8f6d['MetadataId'],_0x5ad962[_0xe845('0xae')],_0x224db4));}}});return Promise[_0xe845('0xaf')](_0x21da59);})[_0xe845('0x29')](function(_0x5d6d78){_0x13b734=_0x5d6d78[0x0];var _0x643f2=_0x39110b['concat'](_0x56bc9b)[_0xe845('0x94')](_0x13b734);var _0x4b9900={'count':_0x643f2[_0xe845('0x3a')],'rows':_0x643f2};return _0x4b9900;})[_0xe845('0x29')](respondWithResult(_0x4ccfc4,null))[_0xe845('0x1f')](function(_0x4bf0ab){var _0x481ff4=_0x5750cb[_0xe845('0x35')][_0xe845('0xbc')]?0x1f4:_0x4bf0ab[_0xe845('0xbd')]||0x1f4;logger[_0xe845('0x1b')](_0x4bf0ab[_0xe845('0x2c')]);delete _0x4bf0ab[_0xe845('0x2d')];if(_0x481ff4===0x191){_0x481ff4=0x190;}_0x4ccfc4[_0xe845('0x21')](_0x481ff4)[_0xe845('0x2e')](_0x5750cb[_0xe845('0x35')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4bf0ab[_0xe845('0xbd')]}:_0x4bf0ab);});};function getSelectList(_0xa7c0bc,_0xf42eae,_0x160983,_0x1cb3b8,_0x2d172d,_0x1621f7){var _0x23ca31={'method':_0xe845('0xa3'),'uri':_0xa7c0bc+_0xe845('0xa4')+_0x1cb3b8+_0xe845('0xbe')+_0x2d172d+_0xe845('0xbf')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x1621f7,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x23ca31)[_0xe845('0x29')](function(_0x26356f){var _0x1d3f80=[];var _0x51daa9=_0x26356f[_0xe845('0xc0')]['Options'];_0x51daa9[_0xe845('0xa9')](function(_0x47c701){_0x1d3f80[_0xe845('0xad')]({'name':_0x47c701[_0xe845('0xc1')][_0xe845('0xc2')][_0xe845('0xc1')],'value':String(_0x47c701['Value'])});});var _0x3218dd={'id':_0xf42eae+'_'+_0x26356f['LogicalName'],'name':_0x26356f[_0xe845('0xc3')][_0xe845('0xc2')][_0xe845('0xc1')],'custom':![],'options':_0x1d3f80};_0x160983['push'](_0x3218dd);return _0x160983;});}function getBooleanList(_0x2b969b,_0x3b077f,_0x1e8c66,_0x4dacb2,_0x3cba53,_0x524bbc){var _0x35d6b2={'method':_0xe845('0xa3'),'uri':_0x2b969b+_0xe845('0xa4')+_0x4dacb2+_0xe845('0xbe')+_0x3cba53+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x524bbc,'If-None-Match':null,'OData-Version':_0xe845('0xa1')},'json':!![]};return rp(_0x35d6b2)[_0xe845('0x29')](function(_0x2c5a7a){var _0x1022fd=[];_0x1022fd[_0xe845('0xad')]({'name':_0x2c5a7a[_0xe845('0xc0')]['TrueOption'][_0xe845('0xc1')][_0xe845('0xc2')][_0xe845('0xc1')],'value':'true'},{'name':_0x2c5a7a['OptionSet']['FalseOption']['Label'][_0xe845('0xc2')][_0xe845('0xc1')],'value':_0xe845('0xc4')});var _0x2c996e={'id':_0x3b077f+'_'+_0x2c5a7a['LogicalName'],'name':_0x2c5a7a[_0xe845('0xc3')]['UserLocalizedLabel'][_0xe845('0xc1')],'custom':![],'options':_0x1022fd};_0x1e8c66[_0xe845('0xad')](_0x2c996e);return _0x1e8c66;});}function getInputList(_0x3bd270,_0x5684a2,_0x1bba44,_0x5cd91e,_0x3473b8,_0x264d50,_0x256c21){var _0x38b276={'method':_0xe845('0xa3'),'uri':_0x3bd270+_0xe845('0xa4')+_0x3473b8+_0xe845('0xbe')+_0x264d50+_0xe845('0xc5')+_0x1bba44+_0xe845('0xc6'),'headers':{'Authorization':_0xe845('0xa0')+_0x256c21,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x38b276)['then'](function(_0x3a7961){var _0x2f261c={'id':_0x5684a2+'_'+_0x3a7961[_0xe845('0xc7')],'name':_0x3a7961[_0xe845('0xc3')]['UserLocalizedLabel']?_0x3a7961['DisplayName'][_0xe845('0xc2')]['Label']:_0x3a7961[_0xe845('0xc7')],'custom':![],'options':[]};_0x5cd91e[_0xe845('0xad')](_0x2f261c);return _0x5cd91e;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 2c925bf..a4b75d1 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 _0x5287=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','Dynamics365Account','int_dynamics365_accounts','lodash'];(function(_0x30c2c1,_0x227dd5){var _0x57d96b=function(_0x158cad){while(--_0x158cad){_0x30c2c1['push'](_0x30c2c1['shift']());}};_0x57d96b(++_0x227dd5);}(_0x5287,0x18b));var _0x7528=function(_0xfa0c75,_0x5d2448){_0xfa0c75=_0xfa0c75-0x0;var _0x544395=_0x5287[_0xfa0c75];return _0x544395;};'use strict';var _=require(_0x7528('0x0'));var util=require('util');var logger=require(_0x7528('0x1'))(_0x7528('0x2'));var moment=require(_0x7528('0x3'));var BPromise=require(_0x7528('0x4'));var rp=require(_0x7528('0x5'));var fs=require('fs');var path=require(_0x7528('0x6'));var rimraf=require(_0x7528('0x7'));var config=require(_0x7528('0x8'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x7528('0x9')]=function(_0x5193eb,_0x5ed4dd){return _0x5193eb['define'](_0x7528('0xa'),attributes,{'tableName':_0x7528('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c82=['request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','int_dynamics365_accounts','util','api','bluebird'];(function(_0x52c4aa,_0x55003c){var _0x32c62d=function(_0x745a48){while(--_0x745a48){_0x52c4aa['push'](_0x52c4aa['shift']());}};_0x32c62d(++_0x55003c);}(_0x4c82,0x133));var _0x24c8=function(_0x40c58d,_0xca539f){_0x40c58d=_0x40c58d-0x0;var _0x2a8381=_0x4c82[_0x40c58d];return _0x2a8381;};'use strict';var _=require('lodash');var util=require(_0x24c8('0x0'));var logger=require('../../config/logger')(_0x24c8('0x1'));var moment=require('moment');var BPromise=require(_0x24c8('0x2'));var rp=require(_0x24c8('0x3'));var fs=require('fs');var path=require(_0x24c8('0x4'));var rimraf=require(_0x24c8('0x5'));var config=require(_0x24c8('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0x24c8('0x7'));module[_0x24c8('0x8')]=function(_0x11898e,_0x59e17a){return _0x11898e['define']('Dynamics365Account',attributes,{'tableName':_0x24c8('0x9'),'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 8002007..a222a64 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 _0xae35=['limit','include','map','model','then','debug','find','raw','where','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','options','attributes'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xae35,0x172));var _0x5ae3=function(_0x3cc699,_0x48b8da){_0x3cc699=_0x3cc699-0x0;var _0x42d3ea=_0xae35[_0x3cc699];return _0x42d3ea;};'use strict';var _=require(_0x5ae3('0x0'));var util=require(_0x5ae3('0x1'));var moment=require(_0x5ae3('0x2'));var BPromise=require(_0x5ae3('0x3'));var rs=require(_0x5ae3('0x4'));var fs=require('fs');var Redis=require(_0x5ae3('0x5'));var db=require(_0x5ae3('0x6'))['db'];var utils=require(_0x5ae3('0x7'));var logger=require('../../config/logger')(_0x5ae3('0x8'));var config=require('../../config/environment');var jayson=require(_0x5ae3('0x9'));var client=jayson[_0x5ae3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45e748,_0x1e1d6b,_0x5697d7){return new BPromise(function(_0x1ff692,_0x2c91a0){return client[_0x5ae3('0xb')](_0x45e748,_0x5697d7)['then'](function(_0x36f616){logger[_0x5ae3('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x1e1d6b,_0x5ae3('0xd'));logger['debug'](_0x5ae3('0xe'),_0x1e1d6b,_0x5ae3('0xd'),JSON[_0x5ae3('0xf')](_0x36f616));if(_0x36f616[_0x5ae3('0x10')]){if(_0x36f616[_0x5ae3('0x10')][_0x5ae3('0x11')]===0x1f4){logger['error'](_0x5ae3('0x12'),_0x1e1d6b,_0x36f616[_0x5ae3('0x10')][_0x5ae3('0x13')]);return _0x2c91a0(_0x36f616[_0x5ae3('0x10')][_0x5ae3('0x13')]);}logger[_0x5ae3('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x1e1d6b,_0x36f616[_0x5ae3('0x10')][_0x5ae3('0x13')]);return _0x1ff692(_0x36f616[_0x5ae3('0x10')][_0x5ae3('0x13')]);}else{logger[_0x5ae3('0xc')](_0x5ae3('0x12'),_0x1e1d6b,'request\x20sent');_0x1ff692(_0x36f616[_0x5ae3('0x14')]['message']);}})[_0x5ae3('0x15')](function(_0x5e2470){logger[_0x5ae3('0x10')](_0x5ae3('0x12'),_0x1e1d6b,_0x5e2470);_0x2c91a0(_0x5e2470);});});}exports[_0x5ae3('0x16')]=function(_0x2d8626){var _0x3b34eb=this;return new Promise(function(_0x27be78,_0x1d45bc){return db[_0x5ae3('0x17')]['findAll']({'raw':_0x2d8626[_0x5ae3('0x18')]?_0x2d8626[_0x5ae3('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2d8626[_0x5ae3('0x18')]?_0x2d8626[_0x5ae3('0x18')]['where']||null:null,'attributes':_0x2d8626[_0x5ae3('0x18')]?_0x2d8626['options'][_0x5ae3('0x19')]||null:null,'limit':_0x2d8626[_0x5ae3('0x18')]?_0x2d8626[_0x5ae3('0x18')][_0x5ae3('0x1a')]||null:null,'include':_0x2d8626[_0x5ae3('0x18')]?_0x2d8626[_0x5ae3('0x18')][_0x5ae3('0x1b')]?_[_0x5ae3('0x1c')](_0x2d8626[_0x5ae3('0x18')][_0x5ae3('0x1b')],function(_0x4f97c6){return{'model':db[_0x4f97c6['model']],'as':_0x4f97c6['as'],'attributes':_0x4f97c6[_0x5ae3('0x19')],'include':_0x4f97c6[_0x5ae3('0x1b')]?_['map'](_0x4f97c6[_0x5ae3('0x1b')],function(_0x49ec7b){return{'model':db[_0x49ec7b[_0x5ae3('0x1d')]],'as':_0x49ec7b['as'],'attributes':_0x49ec7b[_0x5ae3('0x19')],'include':_0x49ec7b[_0x5ae3('0x1b')]?_[_0x5ae3('0x1c')](_0x49ec7b['include'],function(_0x1b95ed){return{'model':db[_0x1b95ed[_0x5ae3('0x1d')]],'as':_0x1b95ed['as'],'attributes':_0x1b95ed['attributes']};}):[]};}):[]};}):[]:[]})[_0x5ae3('0x1e')](function(_0x4dbe22){logger['info'](_0x5ae3('0x16'),_0x2d8626);logger[_0x5ae3('0x1f')]('GetDynamics365Account',_0x2d8626,JSON[_0x5ae3('0xf')](_0x4dbe22));_0x27be78(_0x4dbe22);})[_0x5ae3('0x15')](function(_0x4c9c7a){logger[_0x5ae3('0x10')](_0x5ae3('0x16'),_0x4c9c7a['message'],_0x2d8626);_0x1d45bc(_0x3b34eb[_0x5ae3('0x10')](0x1f4,_0x4c9c7a[_0x5ae3('0x13')]));});});};exports['ShowDynamics365Account']=function(_0x37d206){var _0xf0bb19=this;return new Promise(function(_0xabe28a,_0x2217a8){return db[_0x5ae3('0x17')][_0x5ae3('0x20')]({'raw':_0x37d206['options']?_0x37d206[_0x5ae3('0x18')][_0x5ae3('0x21')]===undefined?!![]:![]:!![],'where':_0x37d206[_0x5ae3('0x18')]?_0x37d206[_0x5ae3('0x18')][_0x5ae3('0x22')]||null:null,'attributes':_0x37d206['options']?_0x37d206[_0x5ae3('0x18')]['attributes']||null:null,'include':_0x37d206['options']?_0x37d206[_0x5ae3('0x18')][_0x5ae3('0x1b')]?_[_0x5ae3('0x1c')](_0x37d206[_0x5ae3('0x18')][_0x5ae3('0x1b')],function(_0x5b02fc){return{'model':db[_0x5b02fc[_0x5ae3('0x1d')]],'as':_0x5b02fc['as'],'attributes':_0x5b02fc[_0x5ae3('0x19')],'include':_0x5b02fc[_0x5ae3('0x1b')]?_[_0x5ae3('0x1c')](_0x5b02fc[_0x5ae3('0x1b')],function(_0x2875ba){return{'model':db[_0x2875ba['model']],'as':_0x2875ba['as'],'attributes':_0x2875ba['attributes'],'include':_0x2875ba[_0x5ae3('0x1b')]?_[_0x5ae3('0x1c')](_0x2875ba[_0x5ae3('0x1b')],function(_0x42fc9f){return{'model':db[_0x42fc9f['model']],'as':_0x42fc9f['as'],'attributes':_0x42fc9f[_0x5ae3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5ae3('0x1e')](function(_0x3d2fa6){logger[_0x5ae3('0xc')]('ShowDynamics365Account',_0x37d206);logger[_0x5ae3('0x1f')]('ShowDynamics365Account',_0x37d206,JSON['stringify'](_0x3d2fa6));_0xabe28a(_0x3d2fa6);})[_0x5ae3('0x15')](function(_0x3ae16c){logger[_0x5ae3('0x10')](_0x5ae3('0x23'),_0x3ae16c[_0x5ae3('0x13')],_0x37d206);_0x2217a8(_0xf0bb19['error'](0x1f4,_0x3ae16c[_0x5ae3('0x13')]));});});}; \ No newline at end of file +var _0xedf2=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','include','map','model','ShowDynamics365Account','find','where','util'];(function(_0x1b1948,_0x49f451){var _0x3cbd38=function(_0x2ca4f2){while(--_0x2ca4f2){_0x1b1948['push'](_0x1b1948['shift']());}};_0x3cbd38(++_0x49f451);}(_0xedf2,0x1ac));var _0x2edf=function(_0x52155e,_0x4e0320){_0x52155e=_0x52155e-0x0;var _0xbcbcd2=_0xedf2[_0x52155e];return _0xbcbcd2;};'use strict';var _=require('lodash');var util=require(_0x2edf('0x0'));var moment=require(_0x2edf('0x1'));var BPromise=require(_0x2edf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2edf('0x3'));var db=require(_0x2edf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2edf('0x5'))(_0x2edf('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2edf('0x7')][_0x2edf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5af8d9,_0x4d27fa,_0x2b7b21){return new BPromise(function(_0x498c41,_0x2316e2){return client['request'](_0x5af8d9,_0x2b7b21)[_0x2edf('0x9')](function(_0x3d60f0){logger[_0x2edf('0xa')](_0x2edf('0xb'),_0x4d27fa,_0x2edf('0xc'));logger[_0x2edf('0xd')](_0x2edf('0xe'),_0x4d27fa,_0x2edf('0xc'),JSON[_0x2edf('0xf')](_0x3d60f0));if(_0x3d60f0['error']){if(_0x3d60f0[_0x2edf('0x10')][_0x2edf('0x11')]===0x1f4){logger[_0x2edf('0x10')](_0x2edf('0xb'),_0x4d27fa,_0x3d60f0[_0x2edf('0x10')][_0x2edf('0x12')]);return _0x2316e2(_0x3d60f0['error'][_0x2edf('0x12')]);}logger[_0x2edf('0x10')](_0x2edf('0xb'),_0x4d27fa,_0x3d60f0[_0x2edf('0x10')]['message']);return _0x498c41(_0x3d60f0[_0x2edf('0x10')][_0x2edf('0x12')]);}else{logger[_0x2edf('0xa')](_0x2edf('0xb'),_0x4d27fa,_0x2edf('0xc'));_0x498c41(_0x3d60f0[_0x2edf('0x13')]['message']);}})[_0x2edf('0x14')](function(_0x36ecfc){logger[_0x2edf('0x10')](_0x2edf('0xb'),_0x4d27fa,_0x36ecfc);_0x2316e2(_0x36ecfc);});});}exports[_0x2edf('0x15')]=function(_0x5b96d0){var _0x28998a=this;return new Promise(function(_0x14f2bb,_0x23fa85){return db[_0x2edf('0x16')][_0x2edf('0x17')]({'raw':_0x5b96d0[_0x2edf('0x18')]?_0x5b96d0[_0x2edf('0x18')][_0x2edf('0x19')]===undefined?!![]:![]:!![],'where':_0x5b96d0[_0x2edf('0x18')]?_0x5b96d0[_0x2edf('0x18')]['where']||null:null,'attributes':_0x5b96d0[_0x2edf('0x18')]?_0x5b96d0[_0x2edf('0x18')][_0x2edf('0x1a')]||null:null,'limit':_0x5b96d0[_0x2edf('0x18')]?_0x5b96d0['options']['limit']||null:null,'include':_0x5b96d0['options']?_0x5b96d0[_0x2edf('0x18')]['include']?_['map'](_0x5b96d0[_0x2edf('0x18')][_0x2edf('0x1b')],function(_0x245dc0){return{'model':db[_0x245dc0['model']],'as':_0x245dc0['as'],'attributes':_0x245dc0[_0x2edf('0x1a')],'include':_0x245dc0[_0x2edf('0x1b')]?_[_0x2edf('0x1c')](_0x245dc0[_0x2edf('0x1b')],function(_0x1a8e3b){return{'model':db[_0x1a8e3b[_0x2edf('0x1d')]],'as':_0x1a8e3b['as'],'attributes':_0x1a8e3b['attributes'],'include':_0x1a8e3b[_0x2edf('0x1b')]?_[_0x2edf('0x1c')](_0x1a8e3b['include'],function(_0x2e3f85){return{'model':db[_0x2e3f85['model']],'as':_0x2e3f85['as'],'attributes':_0x2e3f85[_0x2edf('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc39b5e){logger[_0x2edf('0xa')](_0x2edf('0x15'),_0x5b96d0);logger['debug'](_0x2edf('0x15'),_0x5b96d0,JSON[_0x2edf('0xf')](_0xc39b5e));_0x14f2bb(_0xc39b5e);})[_0x2edf('0x14')](function(_0x3c1a7d){logger[_0x2edf('0x10')](_0x2edf('0x15'),_0x3c1a7d[_0x2edf('0x12')],_0x5b96d0);_0x23fa85(_0x28998a[_0x2edf('0x10')](0x1f4,_0x3c1a7d[_0x2edf('0x12')]));});});};exports[_0x2edf('0x1e')]=function(_0x1e0bdf){var _0x19cc45=this;return new Promise(function(_0x4a0a55,_0x11c7a3){return db[_0x2edf('0x16')][_0x2edf('0x1f')]({'raw':_0x1e0bdf['options']?_0x1e0bdf[_0x2edf('0x18')][_0x2edf('0x19')]===undefined?!![]:![]:!![],'where':_0x1e0bdf[_0x2edf('0x18')]?_0x1e0bdf[_0x2edf('0x18')][_0x2edf('0x20')]||null:null,'attributes':_0x1e0bdf[_0x2edf('0x18')]?_0x1e0bdf[_0x2edf('0x18')]['attributes']||null:null,'include':_0x1e0bdf[_0x2edf('0x18')]?_0x1e0bdf[_0x2edf('0x18')][_0x2edf('0x1b')]?_[_0x2edf('0x1c')](_0x1e0bdf[_0x2edf('0x18')]['include'],function(_0x45f11d){return{'model':db[_0x45f11d[_0x2edf('0x1d')]],'as':_0x45f11d['as'],'attributes':_0x45f11d['attributes'],'include':_0x45f11d[_0x2edf('0x1b')]?_[_0x2edf('0x1c')](_0x45f11d[_0x2edf('0x1b')],function(_0x3699c4){return{'model':db[_0x3699c4[_0x2edf('0x1d')]],'as':_0x3699c4['as'],'attributes':_0x3699c4['attributes'],'include':_0x3699c4[_0x2edf('0x1b')]?_[_0x2edf('0x1c')](_0x3699c4[_0x2edf('0x1b')],function(_0x9530d1){return{'model':db[_0x9530d1['model']],'as':_0x9530d1['as'],'attributes':_0x9530d1[_0x2edf('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2edf('0x9')](function(_0x4667ba){logger[_0x2edf('0xa')](_0x2edf('0x1e'),_0x1e0bdf);logger['debug']('ShowDynamics365Account',_0x1e0bdf,JSON[_0x2edf('0xf')](_0x4667ba));_0x4a0a55(_0x4667ba);})[_0x2edf('0x14')](function(_0x3a501b){logger[_0x2edf('0x10')](_0x2edf('0x1e'),_0x3a501b[_0x2edf('0x12')],_0x1e0bdf);_0x11c7a3(_0x19cc45[_0x2edf('0x10')](0x1f4,_0x3a501b[_0x2edf('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index a78135a..e0e6448 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 _0x1c92=['create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post'];(function(_0x282a1f,_0x49a6ef){var _0x296ea7=function(_0x4bac68){while(--_0x4bac68){_0x282a1f['push'](_0x282a1f['shift']());}};_0x296ea7(++_0x49a6ef);}(_0x1c92,0x118));var _0x21c9=function(_0x5b083b,_0x145a9b){_0x5b083b=_0x5b083b-0x0;var _0x6c2225=_0x1c92[_0x5b083b];return _0x6c2225;};'use strict';var multer=require(_0x21c9('0x0'));var util=require(_0x21c9('0x1'));var path=require('path');var timeout=require(_0x21c9('0x2'));var express=require(_0x21c9('0x3'));var router=express[_0x21c9('0x4')]();var fs_extra=require(_0x21c9('0x5'));var auth=require(_0x21c9('0x6'));var interaction=require(_0x21c9('0x7'));var config=require(_0x21c9('0x8'));var controller=require(_0x21c9('0x9'));router[_0x21c9('0xa')]('/',auth[_0x21c9('0xb')](),controller['index']);router[_0x21c9('0xa')](_0x21c9('0xc'),auth['isAuthenticated'](),controller[_0x21c9('0xd')]);router[_0x21c9('0xa')]('/:id/fields',auth[_0x21c9('0xb')](),controller[_0x21c9('0xe')]);router[_0x21c9('0xa')](_0x21c9('0xf'),auth[_0x21c9('0xb')](),controller['getSubjects']);router[_0x21c9('0xa')](_0x21c9('0x10'),auth[_0x21c9('0xb')](),controller[_0x21c9('0x11')]);router[_0x21c9('0x12')]('/',auth[_0x21c9('0xb')](),controller[_0x21c9('0x13')]);router[_0x21c9('0x14')]('/:id',auth[_0x21c9('0xb')](),controller['update']);router['delete'](_0x21c9('0xc'),auth[_0x21c9('0xb')](),controller[_0x21c9('0x15')]);module[_0x21c9('0x16')]=router; \ No newline at end of file +var _0x3491=['./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment'];(function(_0x151e09,_0x20de1b){var _0x29290a=function(_0x353a39){while(--_0x353a39){_0x151e09['push'](_0x151e09['shift']());}};_0x29290a(++_0x20de1b);}(_0x3491,0x86));var _0x1349=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3491[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x1349('0x0'));var util=require(_0x1349('0x1'));var path=require('path');var timeout=require(_0x1349('0x2'));var express=require('express');var router=express[_0x1349('0x3')]();var fs_extra=require(_0x1349('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1349('0x5'));var controller=require(_0x1349('0x6'));router[_0x1349('0x7')]('/',auth[_0x1349('0x8')](),controller[_0x1349('0x9')]);router[_0x1349('0x7')](_0x1349('0xa'),auth[_0x1349('0x8')](),controller[_0x1349('0xb')]);router['get'](_0x1349('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x1349('0x7')]('/:id/subjects',auth[_0x1349('0x8')](),controller[_0x1349('0xd')]);router[_0x1349('0x7')](_0x1349('0xe'),auth[_0x1349('0x8')](),controller[_0x1349('0xf')]);router[_0x1349('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x1349('0x8')](),controller[_0x1349('0x11')]);router['delete'](_0x1349('0xa'),auth[_0x1349('0x8')](),controller[_0x1349('0x12')]);module[_0x1349('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index c6c34f3..07307e4 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 _0x2c00=['ENUM','incident','sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2c00,0xc0));var _0x02c0=function(_0x4b0290,_0x188c34){_0x4b0290=_0x4b0290-0x0;var _0x4bd9f4=_0x2c00[_0x4b0290];return _0x4bd9f4;};'use strict';var Sequelize=require(_0x02c0('0x0'));module[_0x02c0('0x1')]={'name':{'type':Sequelize[_0x02c0('0x2')]},'description':{'type':Sequelize[_0x02c0('0x2')]},'ticketType':{'type':Sequelize[_0x02c0('0x3')](_0x02c0('0x4'),'phonecall'),'defaultValue':_0x02c0('0x4')}}; \ No newline at end of file +var _0x8bda=['incident','sequelize','exports','STRING','ENUM'];(function(_0xfb2935,_0x4ca521){var _0x49394b=function(_0x1241fb){while(--_0x1241fb){_0xfb2935['push'](_0xfb2935['shift']());}};_0x49394b(++_0x4ca521);}(_0x8bda,0x1e1));var _0xa8bd=function(_0x2fd69d,_0xeb1037){_0x2fd69d=_0x2fd69d-0x0;var _0x5d5ef3=_0x8bda[_0x2fd69d];return _0x5d5ef3;};'use strict';var Sequelize=require(_0xa8bd('0x0'));module[_0xa8bd('0x1')]={'name':{'type':Sequelize[_0xa8bd('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xa8bd('0x3')]('incident','phonecall'),'defaultValue':_0xa8bd('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 7b4ef9e..9041a46 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 _0xa699=['catch','show','params','length','includeAll','find','create','body','getFields','findOne','Dynamics365Field','filter','getSubjects','getDescriptions','hasOwnProperty','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','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','client','http','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','sendStatus','status','count','offset','set','reject','save','update','destroy','end','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows'];(function(_0x6c5308,_0x4e4507){var _0x962435=function(_0x5b68fc){while(--_0x5b68fc){_0x6c5308['push'](_0x6c5308['shift']());}};_0x962435(++_0x4e4507);}(_0xa699,0x6b));var _0x9a69=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0xa699[_0x146a97];return _0x259d5c;};'use strict';var emlformat=require(_0x9a69('0x0'));var rimraf=require(_0x9a69('0x1'));var zipdir=require(_0x9a69('0x2'));var jsonpatch=require(_0x9a69('0x3'));var rp=require(_0x9a69('0x4'));var moment=require(_0x9a69('0x5'));var BPromise=require(_0x9a69('0x6'));var Mustache=require(_0x9a69('0x7'));var util=require(_0x9a69('0x8'));var path=require(_0x9a69('0x9'));var sox=require(_0x9a69('0xa'));var csv=require(_0x9a69('0xb'));var ejs=require(_0x9a69('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a69('0xd'));var squel=require(_0x9a69('0xe'));var crypto=require(_0x9a69('0xf'));var jsforce=require(_0x9a69('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x9a69('0xb'));var querystring=require(_0x9a69('0x11'));var Papa=require(_0x9a69('0x12'));var Redis=require(_0x9a69('0x13'));var authService=require(_0x9a69('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a69('0x15'));var logger=require('../../config/logger')(_0x9a69('0x16'));var utils=require(_0x9a69('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9a69('0x18'));var db=require(_0x9a69('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x9a69('0x1a')][_0x9a69('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x57e34,_0xddc572,_0x404b9d,_0x70475b){return new BPromise(function(_0x34b5b0,_0x2a5b83){var _0x1581d6=_0x70475b||client;return _0x1581d6['request'](_0x57e34,_0x404b9d)[_0x9a69('0x1c')](function(_0x17de41){logger[_0x9a69('0x1d')]('Dynamics365Configuration,\x20%s,\x20%s',_0xddc572,_0x9a69('0x1e'));logger[_0x9a69('0x1f')](_0x9a69('0x20'),_0xddc572,_0x9a69('0x1e'),JSON[_0x9a69('0x21')](_0x17de41));if(_0x17de41['error']){if(_0x17de41[_0x9a69('0x22')][_0x9a69('0x23')]===0x1f4){logger[_0x9a69('0x22')](_0x9a69('0x24'),_0xddc572,_0x17de41[_0x9a69('0x22')][_0x9a69('0x25')]);return _0x2a5b83(_0x17de41[_0x9a69('0x22')][_0x9a69('0x25')]);}logger[_0x9a69('0x22')](_0x9a69('0x24'),_0xddc572,_0x17de41['error']['message']);return _0x34b5b0(_0x17de41[_0x9a69('0x22')][_0x9a69('0x25')]);}else{logger[_0x9a69('0x1d')]('Dynamics365Configuration,\x20%s,\x20%s',_0xddc572,_0x9a69('0x1e'));_0x34b5b0(_0x17de41[_0x9a69('0x26')][_0x9a69('0x25')]);}})['catch'](function(_0x4b9b28){logger['error'](_0x9a69('0x24'),_0xddc572,_0x4b9b28);_0x2a5b83(_0x4b9b28);});});}function respondWithStatusCode(_0x5f4138,_0x140cbe){_0x140cbe=_0x140cbe||0xcc;return function(_0x28f5f7){if(_0x28f5f7){return _0x5f4138[_0x9a69('0x27')](_0x140cbe);}return _0x5f4138[_0x9a69('0x28')](_0x140cbe)['end']();};}function respondWithResult(_0x2f5eb0,_0x5130b2){_0x5130b2=_0x5130b2||0xc8;return function(_0x203d32){if(_0x203d32){return _0x2f5eb0['status'](_0x5130b2)['json'](_0x203d32);}};}function respondWithFilteredResult(_0xbcdcd9,_0xf6fea2){return function(_0x268cef){if(_0x268cef){var _0xbe0597=_0x268cef[_0x9a69('0x29')],_0x26369e=_0xf6fea2[_0x9a69('0x2a')],_0x2514fa=_0xf6fea2[_0x9a69('0x2a')]+_0xf6fea2['limit'],_0x1e8334;if(_0x2514fa>=_0xbe0597){_0x2514fa=_0xbe0597;_0x1e8334=0xc8;}else{_0x1e8334=0xce;}_0xbcdcd9[_0x9a69('0x28')](_0x1e8334);return _0xbcdcd9[_0x9a69('0x2b')]('Content-Range',_0x26369e+'-'+_0x2514fa+'/'+_0xbe0597)['json'](_0x268cef);}return null;};}function patchUpdates(_0x4b3539){return function(_0x1f976b){try{jsonpatch['apply'](_0x1f976b,_0x4b3539,!![]);}catch(_0x14e7da){return BPromise[_0x9a69('0x2c')](_0x14e7da);}return _0x1f976b[_0x9a69('0x2d')]();};}function saveUpdates(_0x1fccab,_0x10e247){return function(_0x10076d){if(_0x10076d){return _0x10076d[_0x9a69('0x2e')](_0x1fccab)[_0x9a69('0x1c')](function(_0x389e61){return _0x389e61;});}return null;};}function removeEntity(_0x420c44,_0x400d73){return function(_0xb20bf1){if(_0xb20bf1){return _0xb20bf1[_0x9a69('0x2f')]()[_0x9a69('0x1c')](function(){_0x420c44[_0x9a69('0x28')](0xcc)[_0x9a69('0x30')]();});}};}function handleEntityNotFound(_0x392a8e,_0x4933af){return function(_0x5c7f13){if(!_0x5c7f13){_0x392a8e[_0x9a69('0x27')](0x194);}return _0x5c7f13;};}function handleError(_0x104f75,_0x856d40){_0x856d40=_0x856d40||0x1f4;return function(_0x43afc2){logger[_0x9a69('0x22')](_0x43afc2['stack']);if(_0x43afc2['name']){delete _0x43afc2['name'];}_0x104f75['status'](_0x856d40)[_0x9a69('0x31')](_0x43afc2);};}exports[_0x9a69('0x32')]=function(_0x264cf4,_0xb4e58e){var _0x4699f2={},_0x371e01={},_0x52714a={'count':0x0,'rows':[]};var _0x4ef316=_[_0x9a69('0x33')](db[_0x9a69('0x34')][_0x9a69('0x35')],function(_0x4b4d50){return{'name':_0x4b4d50[_0x9a69('0x36')],'type':_0x4b4d50[_0x9a69('0x37')][_0x9a69('0x38')]};});_0x371e01[_0x9a69('0x39')]=_[_0x9a69('0x33')](_0x4ef316,_0x9a69('0x3a'));_0x371e01[_0x9a69('0x3b')]=_[_0x9a69('0x3c')](_0x264cf4[_0x9a69('0x3b')]);_0x371e01[_0x9a69('0x3d')]=_[_0x9a69('0x3e')](_0x371e01['model'],_0x371e01[_0x9a69('0x3b')]);_0x4699f2['attributes']=_['intersection'](_0x371e01['model'],qs['fields'](_0x264cf4[_0x9a69('0x3b')][_0x9a69('0x3f')]));_0x4699f2['attributes']=_0x4699f2['attributes']['length']?_0x4699f2[_0x9a69('0x40')]:_0x371e01[_0x9a69('0x39')];if(!_0x264cf4[_0x9a69('0x3b')]['hasOwnProperty'](_0x9a69('0x41'))){_0x4699f2[_0x9a69('0x42')]=qs[_0x9a69('0x42')](_0x264cf4[_0x9a69('0x3b')][_0x9a69('0x42')]);_0x4699f2[_0x9a69('0x2a')]=qs['offset'](_0x264cf4[_0x9a69('0x3b')][_0x9a69('0x2a')]);}_0x4699f2[_0x9a69('0x43')]=qs[_0x9a69('0x44')](_0x264cf4['query'][_0x9a69('0x44')]);_0x4699f2[_0x9a69('0x45')]=qs['filters'](_[_0x9a69('0x46')](_0x264cf4[_0x9a69('0x3b')],_0x371e01[_0x9a69('0x3d')]),_0x4ef316);if(_0x264cf4['query']['filter']){_0x4699f2['where']=_[_0x9a69('0x47')](_0x4699f2[_0x9a69('0x45')],{'$or':_[_0x9a69('0x33')](_0x4ef316,function(_0x436371){if(_0x436371['type']!==_0x9a69('0x48')){var _0x382dbd={};_0x382dbd[_0x436371[_0x9a69('0x3a')]]={'$like':'%'+_0x264cf4[_0x9a69('0x3b')]['filter']+'%'};return _0x382dbd;}})});}_0x4699f2=_[_0x9a69('0x47')]({},_0x4699f2,_0x264cf4[_0x9a69('0x49')]);var _0x7a7d4e={'where':_0x4699f2[_0x9a69('0x45')]};return db['Dynamics365Configuration'][_0x9a69('0x29')](_0x7a7d4e)['then'](function(_0x1d4f04){_0x52714a['count']=_0x1d4f04;if(_0x264cf4[_0x9a69('0x3b')]['includeAll']){_0x4699f2[_0x9a69('0x4a')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x9a69('0x4b')](_0x4699f2);})[_0x9a69('0x1c')](function(_0x19f3a4){_0x52714a[_0x9a69('0x4c')]=_0x19f3a4;return _0x52714a;})['then'](respondWithFilteredResult(_0xb4e58e,_0x4699f2))[_0x9a69('0x4d')](handleError(_0xb4e58e,null));};exports[_0x9a69('0x4e')]=function(_0x77781d,_0x2537b0){var _0x18b0be={'raw':![],'where':{'id':_0x77781d[_0x9a69('0x4f')]['id']}},_0xc691be={};_0xc691be[_0x9a69('0x39')]=_[_0x9a69('0x3c')](db['Dynamics365Configuration'][_0x9a69('0x35')]);_0xc691be[_0x9a69('0x3b')]=_[_0x9a69('0x3c')](_0x77781d[_0x9a69('0x3b')]);_0xc691be[_0x9a69('0x3d')]=_[_0x9a69('0x3e')](_0xc691be[_0x9a69('0x39')],_0xc691be[_0x9a69('0x3b')]);_0x18b0be[_0x9a69('0x40')]=_[_0x9a69('0x3e')](_0xc691be[_0x9a69('0x39')],qs[_0x9a69('0x3f')](_0x77781d[_0x9a69('0x3b')][_0x9a69('0x3f')]));_0x18b0be[_0x9a69('0x40')]=_0x18b0be['attributes'][_0x9a69('0x50')]?_0x18b0be[_0x9a69('0x40')]:_0xc691be[_0x9a69('0x39')];if(_0x77781d[_0x9a69('0x3b')][_0x9a69('0x51')]){_0x18b0be[_0x9a69('0x4a')]=[{'all':!![]}];}_0x18b0be=_[_0x9a69('0x47')]({},_0x18b0be,_0x77781d['options']);return db[_0x9a69('0x34')][_0x9a69('0x52')](_0x18b0be)[_0x9a69('0x1c')](handleEntityNotFound(_0x2537b0,null))[_0x9a69('0x1c')](respondWithResult(_0x2537b0,null))[_0x9a69('0x4d')](handleError(_0x2537b0,null));};exports[_0x9a69('0x53')]=function(_0xb7cf95,_0x2bb723){return db[_0x9a69('0x34')][_0x9a69('0x53')](_0xb7cf95[_0x9a69('0x54')],{})['then'](respondWithResult(_0x2bb723,0xc9))[_0x9a69('0x4d')](handleError(_0x2bb723,null));};exports[_0x9a69('0x2e')]=function(_0x5ebf43,_0x5b2fc5){if(_0x5ebf43[_0x9a69('0x54')]['id']){delete _0x5ebf43['body']['id'];}return db['Dynamics365Configuration'][_0x9a69('0x52')]({'where':{'id':_0x5ebf43[_0x9a69('0x4f')]['id']}})[_0x9a69('0x1c')](handleEntityNotFound(_0x5b2fc5,null))[_0x9a69('0x1c')](saveUpdates(_0x5ebf43['body'],null))['then'](respondWithResult(_0x5b2fc5,null))[_0x9a69('0x4d')](handleError(_0x5b2fc5,null));};exports['destroy']=function(_0x1ddd4c,_0x5c3e61){return db['Dynamics365Configuration'][_0x9a69('0x52')]({'where':{'id':_0x1ddd4c[_0x9a69('0x4f')]['id']}})[_0x9a69('0x1c')](handleEntityNotFound(_0x5c3e61,null))[_0x9a69('0x1c')](removeEntity(_0x5c3e61,null))[_0x9a69('0x4d')](handleError(_0x5c3e61,null));};exports[_0x9a69('0x55')]=function(_0x1c7f4b,_0x592a3e,_0x2bd711){var _0x1de741={};var _0x17ac58={};var _0x298a50;var _0x5ba3f4;return db[_0x9a69('0x34')][_0x9a69('0x56')]({'where':{'id':_0x1c7f4b[_0x9a69('0x4f')]['id']}})['then'](handleEntityNotFound(_0x592a3e,null))[_0x9a69('0x1c')](function(_0xb11556){if(_0xb11556){_0x298a50=_0xb11556;_0x17ac58['model']=_['keys'](db[_0x9a69('0x57')][_0x9a69('0x35')]);_0x17ac58[_0x9a69('0x3b')]=_[_0x9a69('0x3c')](_0x1c7f4b['query']);_0x17ac58['filters']=_[_0x9a69('0x3e')](_0x17ac58[_0x9a69('0x39')],_0x17ac58['query']);_0x1de741[_0x9a69('0x40')]=_[_0x9a69('0x3e')](_0x17ac58['model'],qs[_0x9a69('0x3f')](_0x1c7f4b['query'][_0x9a69('0x3f')]));_0x1de741['attributes']=_0x1de741['attributes'][_0x9a69('0x50')]?_0x1de741[_0x9a69('0x40')]:_0x17ac58[_0x9a69('0x39')];_0x1de741['order']=qs[_0x9a69('0x44')](_0x1c7f4b[_0x9a69('0x3b')][_0x9a69('0x44')]);_0x1de741[_0x9a69('0x45')]=qs['filters'](_[_0x9a69('0x46')](_0x1c7f4b[_0x9a69('0x3b')],_0x17ac58[_0x9a69('0x3d')]));if(_0x1c7f4b[_0x9a69('0x3b')][_0x9a69('0x58')]){_0x1de741[_0x9a69('0x45')]=_[_0x9a69('0x47')](_0x1de741[_0x9a69('0x45')],{'$or':_['map'](_0x1de741[_0x9a69('0x40')],function(_0x51bf8d){var _0x4c6b2e={};_0x4c6b2e[_0x51bf8d]={'$like':'%'+_0x1c7f4b['query'][_0x9a69('0x58')]+'%'};return _0x4c6b2e;})});}_0x1de741=_[_0x9a69('0x47')]({},_0x1de741,_0x1c7f4b[_0x9a69('0x49')]);return _0x298a50[_0x9a69('0x55')](_0x1de741);}})[_0x9a69('0x1c')](function(_0x3ba1cd){if(_0x3ba1cd){_0x5ba3f4=_0x3ba1cd['length'];if(!_0x1c7f4b[_0x9a69('0x3b')]['hasOwnProperty'](_0x9a69('0x41'))){_0x1de741[_0x9a69('0x42')]=qs[_0x9a69('0x42')](_0x1c7f4b[_0x9a69('0x3b')][_0x9a69('0x42')]);_0x1de741[_0x9a69('0x2a')]=qs[_0x9a69('0x2a')](_0x1c7f4b['query']['offset']);}return _0x298a50[_0x9a69('0x55')](_0x1de741);}})[_0x9a69('0x1c')](function(_0x4283a3){if(_0x4283a3){return _0x4283a3?{'count':_0x5ba3f4,'rows':_0x4283a3}:null;}})['then'](respondWithResult(_0x592a3e,null))[_0x9a69('0x4d')](handleError(_0x592a3e,null));};exports[_0x9a69('0x59')]=function(_0xb93218,_0x270e6b,_0xbbc647){var _0x2a7f48={};var _0x22569f={};var _0x532899;var _0x53f25b;return db[_0x9a69('0x34')]['findOne']({'where':{'id':_0xb93218['params']['id']}})[_0x9a69('0x1c')](handleEntityNotFound(_0x270e6b,null))[_0x9a69('0x1c')](function(_0x1eb2b1){if(_0x1eb2b1){_0x532899=_0x1eb2b1;_0x22569f[_0x9a69('0x39')]=_[_0x9a69('0x3c')](db[_0x9a69('0x57')][_0x9a69('0x35')]);_0x22569f[_0x9a69('0x3b')]=_[_0x9a69('0x3c')](_0xb93218[_0x9a69('0x3b')]);_0x22569f['filters']=_['intersection'](_0x22569f['model'],_0x22569f[_0x9a69('0x3b')]);_0x2a7f48[_0x9a69('0x40')]=_['intersection'](_0x22569f[_0x9a69('0x39')],qs[_0x9a69('0x3f')](_0xb93218[_0x9a69('0x3b')][_0x9a69('0x3f')]));_0x2a7f48[_0x9a69('0x40')]=_0x2a7f48['attributes'][_0x9a69('0x50')]?_0x2a7f48[_0x9a69('0x40')]:_0x22569f[_0x9a69('0x39')];_0x2a7f48[_0x9a69('0x43')]=qs[_0x9a69('0x44')](_0xb93218['query'][_0x9a69('0x44')]);_0x2a7f48[_0x9a69('0x45')]=qs[_0x9a69('0x3d')](_[_0x9a69('0x46')](_0xb93218[_0x9a69('0x3b')],_0x22569f[_0x9a69('0x3d')]));if(_0xb93218[_0x9a69('0x3b')][_0x9a69('0x58')]){_0x2a7f48['where']=_[_0x9a69('0x47')](_0x2a7f48['where'],{'$or':_[_0x9a69('0x33')](_0x2a7f48['attributes'],function(_0x3d671f){var _0x17aa90={};_0x17aa90[_0x3d671f]={'$like':'%'+_0xb93218[_0x9a69('0x3b')]['filter']+'%'};return _0x17aa90;})});}_0x2a7f48=_[_0x9a69('0x47')]({},_0x2a7f48,_0xb93218[_0x9a69('0x49')]);return _0x532899['getSubjects'](_0x2a7f48);}})[_0x9a69('0x1c')](function(_0x34c9a7){if(_0x34c9a7){_0x53f25b=_0x34c9a7[_0x9a69('0x50')];if(!_0xb93218[_0x9a69('0x3b')]['hasOwnProperty']('nolimit')){_0x2a7f48[_0x9a69('0x42')]=qs['limit'](_0xb93218[_0x9a69('0x3b')][_0x9a69('0x42')]);_0x2a7f48[_0x9a69('0x2a')]=qs['offset'](_0xb93218['query']['offset']);}return _0x532899[_0x9a69('0x59')](_0x2a7f48);}})['then'](function(_0x51c119){if(_0x51c119){return _0x51c119?{'count':_0x53f25b,'rows':_0x51c119}:null;}})[_0x9a69('0x1c')](respondWithResult(_0x270e6b,null))['catch'](handleError(_0x270e6b,null));};exports['getDescriptions']=function(_0x1594c5,_0x40a1f9,_0x99e46d){var _0x2d1411={};var _0x129844={};var _0x57097c;var _0x2c4a51;return db[_0x9a69('0x34')][_0x9a69('0x56')]({'where':{'id':_0x1594c5[_0x9a69('0x4f')]['id']}})[_0x9a69('0x1c')](handleEntityNotFound(_0x40a1f9,null))[_0x9a69('0x1c')](function(_0x23d399){if(_0x23d399){_0x57097c=_0x23d399;_0x129844[_0x9a69('0x39')]=_[_0x9a69('0x3c')](db[_0x9a69('0x57')][_0x9a69('0x35')]);_0x129844['query']=_[_0x9a69('0x3c')](_0x1594c5[_0x9a69('0x3b')]);_0x129844[_0x9a69('0x3d')]=_[_0x9a69('0x3e')](_0x129844['model'],_0x129844[_0x9a69('0x3b')]);_0x2d1411['attributes']=_[_0x9a69('0x3e')](_0x129844[_0x9a69('0x39')],qs['fields'](_0x1594c5[_0x9a69('0x3b')]['fields']));_0x2d1411[_0x9a69('0x40')]=_0x2d1411[_0x9a69('0x40')][_0x9a69('0x50')]?_0x2d1411['attributes']:_0x129844['model'];_0x2d1411['order']=qs[_0x9a69('0x44')](_0x1594c5['query'][_0x9a69('0x44')]);_0x2d1411[_0x9a69('0x45')]=qs[_0x9a69('0x3d')](_['pick'](_0x1594c5[_0x9a69('0x3b')],_0x129844[_0x9a69('0x3d')]));if(_0x1594c5[_0x9a69('0x3b')][_0x9a69('0x58')]){_0x2d1411[_0x9a69('0x45')]=_[_0x9a69('0x47')](_0x2d1411[_0x9a69('0x45')],{'$or':_[_0x9a69('0x33')](_0x2d1411[_0x9a69('0x40')],function(_0x1e031e){var _0x1666b9={};_0x1666b9[_0x1e031e]={'$like':'%'+_0x1594c5[_0x9a69('0x3b')][_0x9a69('0x58')]+'%'};return _0x1666b9;})});}_0x2d1411=_[_0x9a69('0x47')]({},_0x2d1411,_0x1594c5[_0x9a69('0x49')]);return _0x57097c[_0x9a69('0x5a')](_0x2d1411);}})[_0x9a69('0x1c')](function(_0x25c0a2){if(_0x25c0a2){_0x2c4a51=_0x25c0a2[_0x9a69('0x50')];if(!_0x1594c5[_0x9a69('0x3b')][_0x9a69('0x5b')](_0x9a69('0x41'))){_0x2d1411[_0x9a69('0x42')]=qs['limit'](_0x1594c5[_0x9a69('0x3b')][_0x9a69('0x42')]);_0x2d1411['offset']=qs[_0x9a69('0x2a')](_0x1594c5[_0x9a69('0x3b')][_0x9a69('0x2a')]);}return _0x57097c[_0x9a69('0x5a')](_0x2d1411);}})[_0x9a69('0x1c')](function(_0x173e6c){if(_0x173e6c){return _0x173e6c?{'count':_0x2c4a51,'rows':_0x173e6c}:null;}})[_0x9a69('0x1c')](respondWithResult(_0x40a1f9,null))[_0x9a69('0x4d')](handleError(_0x40a1f9,null));}; \ No newline at end of file +var _0xeee9=['Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','end','status','json','count','offset','limit','Content-Range','apply','reject','destroy','sendStatus','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','show','params','includeAll','include','options','find','create','body','update','Dynamics365Field','getFields','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info'];(function(_0x47acdf,_0x1b12cb){var _0x271030=function(_0x45f86c){while(--_0x45f86c){_0x47acdf['push'](_0x47acdf['shift']());}};_0x271030(++_0x1b12cb);}(_0xeee9,0x153));var _0x9eee=function(_0x41fc1a,_0x2f9cf5){_0x41fc1a=_0x41fc1a-0x0;var _0x55b9b2=_0xeee9[_0x41fc1a];return _0x55b9b2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9eee('0x0'));var zipdir=require(_0x9eee('0x1'));var jsonpatch=require(_0x9eee('0x2'));var rp=require(_0x9eee('0x3'));var moment=require(_0x9eee('0x4'));var BPromise=require(_0x9eee('0x5'));var Mustache=require(_0x9eee('0x6'));var util=require(_0x9eee('0x7'));var path=require(_0x9eee('0x8'));var sox=require('sox');var csv=require(_0x9eee('0x9'));var ejs=require(_0x9eee('0xa'));var fs=require('fs');var fs_extra=require(_0x9eee('0xb'));var _=require(_0x9eee('0xc'));var squel=require(_0x9eee('0xd'));var crypto=require('crypto');var jsforce=require(_0x9eee('0xe'));var deskjs=require(_0x9eee('0xf'));var toCsv=require(_0x9eee('0x9'));var querystring=require(_0x9eee('0x10'));var Papa=require(_0x9eee('0x11'));var Redis=require(_0x9eee('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9eee('0x13'));var as=require(_0x9eee('0x14'));var hardwareService=require(_0x9eee('0x15'));var logger=require(_0x9eee('0x16'))(_0x9eee('0x17'));var utils=require(_0x9eee('0x18'));var config=require(_0x9eee('0x19'));var licenseUtil=require(_0x9eee('0x1a'));var db=require(_0x9eee('0x1b'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x9eee('0x1c')][_0x9eee('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x35ac66,_0x2036cc,_0x4b5d89,_0x55a913){return new BPromise(function(_0x1bea21,_0x8e20aa){var _0x10fc58=_0x55a913||client;return _0x10fc58[_0x9eee('0x1e')](_0x35ac66,_0x4b5d89)[_0x9eee('0x1f')](function(_0x145b62){logger[_0x9eee('0x20')](_0x9eee('0x21'),_0x2036cc,_0x9eee('0x22'));logger['debug'](_0x9eee('0x23'),_0x2036cc,'request\x20sent',JSON[_0x9eee('0x24')](_0x145b62));if(_0x145b62[_0x9eee('0x25')]){if(_0x145b62[_0x9eee('0x25')]['code']===0x1f4){logger[_0x9eee('0x25')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2036cc,_0x145b62[_0x9eee('0x25')][_0x9eee('0x26')]);return _0x8e20aa(_0x145b62[_0x9eee('0x25')][_0x9eee('0x26')]);}logger[_0x9eee('0x25')](_0x9eee('0x21'),_0x2036cc,_0x145b62[_0x9eee('0x25')][_0x9eee('0x26')]);return _0x1bea21(_0x145b62[_0x9eee('0x25')]['message']);}else{logger['info'](_0x9eee('0x21'),_0x2036cc,_0x9eee('0x22'));_0x1bea21(_0x145b62[_0x9eee('0x27')][_0x9eee('0x26')]);}})[_0x9eee('0x28')](function(_0x38addb){logger[_0x9eee('0x25')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2036cc,_0x38addb);_0x8e20aa(_0x38addb);});});}function respondWithStatusCode(_0x22d4be,_0x130a66){_0x130a66=_0x130a66||0xcc;return function(_0x493647){if(_0x493647){return _0x22d4be['sendStatus'](_0x130a66);}return _0x22d4be['status'](_0x130a66)[_0x9eee('0x29')]();};}function respondWithResult(_0x3c9e70,_0x736123){_0x736123=_0x736123||0xc8;return function(_0x3cc9e0){if(_0x3cc9e0){return _0x3c9e70[_0x9eee('0x2a')](_0x736123)[_0x9eee('0x2b')](_0x3cc9e0);}};}function respondWithFilteredResult(_0x6bbda4,_0x4db9cb){return function(_0x32af5a){if(_0x32af5a){var _0xebb4cb=_0x32af5a[_0x9eee('0x2c')],_0x3c26a5=_0x4db9cb[_0x9eee('0x2d')],_0x4cee44=_0x4db9cb['offset']+_0x4db9cb[_0x9eee('0x2e')],_0x512e61;if(_0x4cee44>=_0xebb4cb){_0x4cee44=_0xebb4cb;_0x512e61=0xc8;}else{_0x512e61=0xce;}_0x6bbda4[_0x9eee('0x2a')](_0x512e61);return _0x6bbda4['set'](_0x9eee('0x2f'),_0x3c26a5+'-'+_0x4cee44+'/'+_0xebb4cb)['json'](_0x32af5a);}return null;};}function patchUpdates(_0x3f99c6){return function(_0x3f08c6){try{jsonpatch[_0x9eee('0x30')](_0x3f08c6,_0x3f99c6,!![]);}catch(_0x434649){return BPromise[_0x9eee('0x31')](_0x434649);}return _0x3f08c6['save']();};}function saveUpdates(_0x52d0a9,_0x305264){return function(_0x2d1529){if(_0x2d1529){return _0x2d1529['update'](_0x52d0a9)[_0x9eee('0x1f')](function(_0xce93ad){return _0xce93ad;});}return null;};}function removeEntity(_0x455d6d,_0x12e411){return function(_0x2a424c){if(_0x2a424c){return _0x2a424c[_0x9eee('0x32')]()[_0x9eee('0x1f')](function(){_0x455d6d[_0x9eee('0x2a')](0xcc)[_0x9eee('0x29')]();});}};}function handleEntityNotFound(_0x212242,_0x5e85b4){return function(_0x59fe52){if(!_0x59fe52){_0x212242[_0x9eee('0x33')](0x194);}return _0x59fe52;};}function handleError(_0x4a0045,_0x327b1e){_0x327b1e=_0x327b1e||0x1f4;return function(_0x330057){logger[_0x9eee('0x25')](_0x330057[_0x9eee('0x34')]);if(_0x330057[_0x9eee('0x35')]){delete _0x330057[_0x9eee('0x35')];}_0x4a0045[_0x9eee('0x2a')](_0x327b1e)[_0x9eee('0x36')](_0x330057);};}exports[_0x9eee('0x37')]=function(_0x5e2746,_0x2e7f74){var _0x2913c4={},_0x2c4cb9={},_0x7031d8={'count':0x0,'rows':[]};var _0x548212=_[_0x9eee('0x38')](db[_0x9eee('0x39')][_0x9eee('0x3a')],function(_0x3b70a6){return{'name':_0x3b70a6[_0x9eee('0x3b')],'type':_0x3b70a6['type'][_0x9eee('0x3c')]};});_0x2c4cb9['model']=_[_0x9eee('0x38')](_0x548212,_0x9eee('0x35'));_0x2c4cb9[_0x9eee('0x3d')]=_[_0x9eee('0x3e')](_0x5e2746[_0x9eee('0x3d')]);_0x2c4cb9[_0x9eee('0x3f')]=_['intersection'](_0x2c4cb9[_0x9eee('0x40')],_0x2c4cb9[_0x9eee('0x3d')]);_0x2913c4['attributes']=_[_0x9eee('0x41')](_0x2c4cb9[_0x9eee('0x40')],qs[_0x9eee('0x42')](_0x5e2746['query'][_0x9eee('0x42')]));_0x2913c4[_0x9eee('0x43')]=_0x2913c4[_0x9eee('0x43')][_0x9eee('0x44')]?_0x2913c4[_0x9eee('0x43')]:_0x2c4cb9[_0x9eee('0x40')];if(!_0x5e2746['query'][_0x9eee('0x45')](_0x9eee('0x46'))){_0x2913c4[_0x9eee('0x2e')]=qs[_0x9eee('0x2e')](_0x5e2746[_0x9eee('0x3d')][_0x9eee('0x2e')]);_0x2913c4['offset']=qs[_0x9eee('0x2d')](_0x5e2746[_0x9eee('0x3d')][_0x9eee('0x2d')]);}_0x2913c4[_0x9eee('0x47')]=qs[_0x9eee('0x48')](_0x5e2746[_0x9eee('0x3d')]['sort']);_0x2913c4[_0x9eee('0x49')]=qs[_0x9eee('0x3f')](_[_0x9eee('0x4a')](_0x5e2746['query'],_0x2c4cb9['filters']),_0x548212);if(_0x5e2746[_0x9eee('0x3d')][_0x9eee('0x4b')]){_0x2913c4[_0x9eee('0x49')]=_[_0x9eee('0x4c')](_0x2913c4[_0x9eee('0x49')],{'$or':_[_0x9eee('0x38')](_0x548212,function(_0x2715c3){if(_0x2715c3[_0x9eee('0x4d')]!==_0x9eee('0x4e')){var _0x58e955={};_0x58e955[_0x2715c3['name']]={'$like':'%'+_0x5e2746[_0x9eee('0x3d')][_0x9eee('0x4b')]+'%'};return _0x58e955;}})});}_0x2913c4=_[_0x9eee('0x4c')]({},_0x2913c4,_0x5e2746['options']);var _0x3ff85a={'where':_0x2913c4[_0x9eee('0x49')]};return db[_0x9eee('0x39')]['count'](_0x3ff85a)[_0x9eee('0x1f')](function(_0x451ce4){_0x7031d8[_0x9eee('0x2c')]=_0x451ce4;if(_0x5e2746['query']['includeAll']){_0x2913c4['include']=[{'all':!![]}];}return db[_0x9eee('0x39')]['findAll'](_0x2913c4);})['then'](function(_0x3eccc6){_0x7031d8['rows']=_0x3eccc6;return _0x7031d8;})[_0x9eee('0x1f')](respondWithFilteredResult(_0x2e7f74,_0x2913c4))[_0x9eee('0x28')](handleError(_0x2e7f74,null));};exports[_0x9eee('0x4f')]=function(_0x3748a0,_0x40ad65){var _0x31bdc5={'raw':![],'where':{'id':_0x3748a0[_0x9eee('0x50')]['id']}},_0xfae52f={};_0xfae52f[_0x9eee('0x40')]=_[_0x9eee('0x3e')](db[_0x9eee('0x39')]['rawAttributes']);_0xfae52f[_0x9eee('0x3d')]=_['keys'](_0x3748a0[_0x9eee('0x3d')]);_0xfae52f['filters']=_[_0x9eee('0x41')](_0xfae52f[_0x9eee('0x40')],_0xfae52f[_0x9eee('0x3d')]);_0x31bdc5[_0x9eee('0x43')]=_[_0x9eee('0x41')](_0xfae52f[_0x9eee('0x40')],qs['fields'](_0x3748a0[_0x9eee('0x3d')]['fields']));_0x31bdc5[_0x9eee('0x43')]=_0x31bdc5[_0x9eee('0x43')][_0x9eee('0x44')]?_0x31bdc5[_0x9eee('0x43')]:_0xfae52f[_0x9eee('0x40')];if(_0x3748a0['query'][_0x9eee('0x51')]){_0x31bdc5[_0x9eee('0x52')]=[{'all':!![]}];}_0x31bdc5=_[_0x9eee('0x4c')]({},_0x31bdc5,_0x3748a0[_0x9eee('0x53')]);return db[_0x9eee('0x39')][_0x9eee('0x54')](_0x31bdc5)[_0x9eee('0x1f')](handleEntityNotFound(_0x40ad65,null))[_0x9eee('0x1f')](respondWithResult(_0x40ad65,null))['catch'](handleError(_0x40ad65,null));};exports['create']=function(_0x578411,_0x16d2e3){return db[_0x9eee('0x39')][_0x9eee('0x55')](_0x578411[_0x9eee('0x56')],{})[_0x9eee('0x1f')](respondWithResult(_0x16d2e3,0xc9))[_0x9eee('0x28')](handleError(_0x16d2e3,null));};exports[_0x9eee('0x57')]=function(_0x17e21f,_0x441cdf){if(_0x17e21f[_0x9eee('0x56')]['id']){delete _0x17e21f['body']['id'];}return db[_0x9eee('0x39')]['find']({'where':{'id':_0x17e21f[_0x9eee('0x50')]['id']}})[_0x9eee('0x1f')](handleEntityNotFound(_0x441cdf,null))['then'](saveUpdates(_0x17e21f[_0x9eee('0x56')],null))[_0x9eee('0x1f')](respondWithResult(_0x441cdf,null))['catch'](handleError(_0x441cdf,null));};exports[_0x9eee('0x32')]=function(_0x1144ba,_0x38755a){return db[_0x9eee('0x39')][_0x9eee('0x54')]({'where':{'id':_0x1144ba[_0x9eee('0x50')]['id']}})[_0x9eee('0x1f')](handleEntityNotFound(_0x38755a,null))[_0x9eee('0x1f')](removeEntity(_0x38755a,null))[_0x9eee('0x28')](handleError(_0x38755a,null));};exports['getFields']=function(_0x5a7bb0,_0x5ccc89,_0x251caf){var _0x2ea55b={};var _0x438387={};var _0x989ed1;var _0x1f6549;return db[_0x9eee('0x39')]['findOne']({'where':{'id':_0x5a7bb0[_0x9eee('0x50')]['id']}})[_0x9eee('0x1f')](handleEntityNotFound(_0x5ccc89,null))[_0x9eee('0x1f')](function(_0xa391c8){if(_0xa391c8){_0x989ed1=_0xa391c8;_0x438387[_0x9eee('0x40')]=_[_0x9eee('0x3e')](db[_0x9eee('0x58')][_0x9eee('0x3a')]);_0x438387[_0x9eee('0x3d')]=_[_0x9eee('0x3e')](_0x5a7bb0[_0x9eee('0x3d')]);_0x438387['filters']=_[_0x9eee('0x41')](_0x438387['model'],_0x438387[_0x9eee('0x3d')]);_0x2ea55b['attributes']=_['intersection'](_0x438387[_0x9eee('0x40')],qs[_0x9eee('0x42')](_0x5a7bb0[_0x9eee('0x3d')]['fields']));_0x2ea55b[_0x9eee('0x43')]=_0x2ea55b['attributes']['length']?_0x2ea55b[_0x9eee('0x43')]:_0x438387['model'];_0x2ea55b['order']=qs['sort'](_0x5a7bb0[_0x9eee('0x3d')]['sort']);_0x2ea55b[_0x9eee('0x49')]=qs[_0x9eee('0x3f')](_[_0x9eee('0x4a')](_0x5a7bb0[_0x9eee('0x3d')],_0x438387[_0x9eee('0x3f')]));if(_0x5a7bb0['query'][_0x9eee('0x4b')]){_0x2ea55b[_0x9eee('0x49')]=_[_0x9eee('0x4c')](_0x2ea55b['where'],{'$or':_['map'](_0x2ea55b[_0x9eee('0x43')],function(_0x3674bf){var _0x2fb2a0={};_0x2fb2a0[_0x3674bf]={'$like':'%'+_0x5a7bb0[_0x9eee('0x3d')][_0x9eee('0x4b')]+'%'};return _0x2fb2a0;})});}_0x2ea55b=_[_0x9eee('0x4c')]({},_0x2ea55b,_0x5a7bb0['options']);return _0x989ed1[_0x9eee('0x59')](_0x2ea55b);}})[_0x9eee('0x1f')](function(_0x2773f4){if(_0x2773f4){_0x1f6549=_0x2773f4[_0x9eee('0x44')];if(!_0x5a7bb0[_0x9eee('0x3d')][_0x9eee('0x45')]('nolimit')){_0x2ea55b[_0x9eee('0x2e')]=qs[_0x9eee('0x2e')](_0x5a7bb0['query'][_0x9eee('0x2e')]);_0x2ea55b['offset']=qs['offset'](_0x5a7bb0[_0x9eee('0x3d')][_0x9eee('0x2d')]);}return _0x989ed1[_0x9eee('0x59')](_0x2ea55b);}})['then'](function(_0x4f04ff){if(_0x4f04ff){return _0x4f04ff?{'count':_0x1f6549,'rows':_0x4f04ff}:null;}})[_0x9eee('0x1f')](respondWithResult(_0x5ccc89,null))[_0x9eee('0x28')](handleError(_0x5ccc89,null));};exports[_0x9eee('0x5a')]=function(_0x44d519,_0x4bdabf,_0x4651c1){var _0x2301e1={};var _0x2667cd={};var _0x1d0727;var _0x21d4de;return db['Dynamics365Configuration'][_0x9eee('0x5b')]({'where':{'id':_0x44d519[_0x9eee('0x50')]['id']}})[_0x9eee('0x1f')](handleEntityNotFound(_0x4bdabf,null))[_0x9eee('0x1f')](function(_0x2f7cc6){if(_0x2f7cc6){_0x1d0727=_0x2f7cc6;_0x2667cd['model']=_[_0x9eee('0x3e')](db['Dynamics365Field'][_0x9eee('0x3a')]);_0x2667cd['query']=_[_0x9eee('0x3e')](_0x44d519['query']);_0x2667cd[_0x9eee('0x3f')]=_['intersection'](_0x2667cd[_0x9eee('0x40')],_0x2667cd[_0x9eee('0x3d')]);_0x2301e1[_0x9eee('0x43')]=_[_0x9eee('0x41')](_0x2667cd[_0x9eee('0x40')],qs[_0x9eee('0x42')](_0x44d519[_0x9eee('0x3d')][_0x9eee('0x42')]));_0x2301e1[_0x9eee('0x43')]=_0x2301e1['attributes'][_0x9eee('0x44')]?_0x2301e1[_0x9eee('0x43')]:_0x2667cd[_0x9eee('0x40')];_0x2301e1[_0x9eee('0x47')]=qs['sort'](_0x44d519['query'][_0x9eee('0x48')]);_0x2301e1['where']=qs['filters'](_[_0x9eee('0x4a')](_0x44d519[_0x9eee('0x3d')],_0x2667cd['filters']));if(_0x44d519[_0x9eee('0x3d')][_0x9eee('0x4b')]){_0x2301e1['where']=_['merge'](_0x2301e1[_0x9eee('0x49')],{'$or':_[_0x9eee('0x38')](_0x2301e1[_0x9eee('0x43')],function(_0x189bcf){var _0x54a805={};_0x54a805[_0x189bcf]={'$like':'%'+_0x44d519[_0x9eee('0x3d')]['filter']+'%'};return _0x54a805;})});}_0x2301e1=_['merge']({},_0x2301e1,_0x44d519['options']);return _0x1d0727[_0x9eee('0x5a')](_0x2301e1);}})[_0x9eee('0x1f')](function(_0x19ac75){if(_0x19ac75){_0x21d4de=_0x19ac75['length'];if(!_0x44d519[_0x9eee('0x3d')][_0x9eee('0x45')]('nolimit')){_0x2301e1['limit']=qs['limit'](_0x44d519[_0x9eee('0x3d')][_0x9eee('0x2e')]);_0x2301e1[_0x9eee('0x2d')]=qs[_0x9eee('0x2d')](_0x44d519[_0x9eee('0x3d')][_0x9eee('0x2d')]);}return _0x1d0727[_0x9eee('0x5a')](_0x2301e1);}})[_0x9eee('0x1f')](function(_0x583f65){if(_0x583f65){return _0x583f65?{'count':_0x21d4de,'rows':_0x583f65}:null;}})[_0x9eee('0x1f')](respondWithResult(_0x4bdabf,null))[_0x9eee('0x28')](handleError(_0x4bdabf,null));};exports[_0x9eee('0x5c')]=function(_0x105a20,_0x3b1c8a,_0x36601f){var _0x1a1b5d={};var _0x1e8c2c={};var _0x4f9f37;var _0x13f1d7;return db[_0x9eee('0x39')][_0x9eee('0x5b')]({'where':{'id':_0x105a20[_0x9eee('0x50')]['id']}})[_0x9eee('0x1f')](handleEntityNotFound(_0x3b1c8a,null))[_0x9eee('0x1f')](function(_0x118d68){if(_0x118d68){_0x4f9f37=_0x118d68;_0x1e8c2c[_0x9eee('0x40')]=_[_0x9eee('0x3e')](db[_0x9eee('0x58')][_0x9eee('0x3a')]);_0x1e8c2c[_0x9eee('0x3d')]=_[_0x9eee('0x3e')](_0x105a20[_0x9eee('0x3d')]);_0x1e8c2c['filters']=_['intersection'](_0x1e8c2c[_0x9eee('0x40')],_0x1e8c2c['query']);_0x1a1b5d[_0x9eee('0x43')]=_[_0x9eee('0x41')](_0x1e8c2c['model'],qs['fields'](_0x105a20[_0x9eee('0x3d')][_0x9eee('0x42')]));_0x1a1b5d[_0x9eee('0x43')]=_0x1a1b5d['attributes'][_0x9eee('0x44')]?_0x1a1b5d['attributes']:_0x1e8c2c[_0x9eee('0x40')];_0x1a1b5d[_0x9eee('0x47')]=qs['sort'](_0x105a20['query'][_0x9eee('0x48')]);_0x1a1b5d[_0x9eee('0x49')]=qs[_0x9eee('0x3f')](_[_0x9eee('0x4a')](_0x105a20['query'],_0x1e8c2c[_0x9eee('0x3f')]));if(_0x105a20[_0x9eee('0x3d')][_0x9eee('0x4b')]){_0x1a1b5d[_0x9eee('0x49')]=_['merge'](_0x1a1b5d['where'],{'$or':_[_0x9eee('0x38')](_0x1a1b5d[_0x9eee('0x43')],function(_0xa2fe82){var _0x38b7b4={};_0x38b7b4[_0xa2fe82]={'$like':'%'+_0x105a20[_0x9eee('0x3d')]['filter']+'%'};return _0x38b7b4;})});}_0x1a1b5d=_[_0x9eee('0x4c')]({},_0x1a1b5d,_0x105a20['options']);return _0x4f9f37[_0x9eee('0x5c')](_0x1a1b5d);}})[_0x9eee('0x1f')](function(_0x4d8c3b){if(_0x4d8c3b){_0x13f1d7=_0x4d8c3b[_0x9eee('0x44')];if(!_0x105a20[_0x9eee('0x3d')]['hasOwnProperty'](_0x9eee('0x46'))){_0x1a1b5d['limit']=qs[_0x9eee('0x2e')](_0x105a20[_0x9eee('0x3d')][_0x9eee('0x2e')]);_0x1a1b5d['offset']=qs[_0x9eee('0x2d')](_0x105a20[_0x9eee('0x3d')][_0x9eee('0x2d')]);}return _0x4f9f37[_0x9eee('0x5c')](_0x1a1b5d);}})[_0x9eee('0x1f')](function(_0x163ff1){if(_0x163ff1){return _0x163ff1?{'count':_0x13f1d7,'rows':_0x163ff1}:null;}})['then'](respondWithResult(_0x3b1c8a,null))['catch'](handleError(_0x3b1c8a,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index fd403c1..215c47c 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 _0xa2f4=['./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x52e98a,_0x3d27bf){var _0x326faa=function(_0x3d5ca8){while(--_0x3d5ca8){_0x52e98a['push'](_0x52e98a['shift']());}};_0x326faa(++_0x3d27bf);}(_0xa2f4,0x93));var _0x4a2f=function(_0x27bd57,_0x40c4d5){_0x27bd57=_0x27bd57-0x0;var _0x35e9c6=_0xa2f4[_0x27bd57];return _0x35e9c6;};'use strict';var _=require(_0x4a2f('0x0'));var util=require(_0x4a2f('0x1'));var logger=require(_0x4a2f('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4a2f('0x3'));var fs=require('fs');var path=require(_0x4a2f('0x4'));var rimraf=require(_0x4a2f('0x5'));var config=require(_0x4a2f('0x6'));var attributes=require(_0x4a2f('0x7'));module[_0x4a2f('0x8')]=function(_0x1bb4c3,_0x1cbd5f){return _0x1bb4c3[_0x4a2f('0x9')](_0x4a2f('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8407=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x8407,0xfd));var _0x7840=function(_0x1393d4,_0x1cad98){_0x1393d4=_0x1393d4-0x0;var _0x2fc2fa=_0x8407[_0x1393d4];return _0x2fc2fa;};'use strict';var _=require(_0x7840('0x0'));var util=require(_0x7840('0x1'));var logger=require(_0x7840('0x2'))(_0x7840('0x3'));var moment=require(_0x7840('0x4'));var BPromise=require(_0x7840('0x5'));var rp=require(_0x7840('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7840('0x7'));var config=require(_0x7840('0x8'));var attributes=require(_0x7840('0x9'));module[_0x7840('0xa')]=function(_0x25f36d,_0xe804f9){return _0x25f36d[_0x7840('0xb')](_0x7840('0xc'),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 57df73e..982cd31 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 _0x2aa3=['stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s'];(function(_0x1fac34,_0x26a70a){var _0x597f26=function(_0x13c93f){while(--_0x13c93f){_0x1fac34['push'](_0x1fac34['shift']());}};_0x597f26(++_0x26a70a);}(_0x2aa3,0x1ce));var _0x32aa=function(_0x4a485c,_0x325b1e){_0x4a485c=_0x4a485c-0x0;var _0x95b1f8=_0x2aa3[_0x4a485c];return _0x95b1f8;};'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('../../mysqldb')['db'];var utils=require(_0x32aa('0x4'));var logger=require(_0x32aa('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x32aa('0x6'));var client=jayson[_0x32aa('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x177694,_0x2b4b27,_0xcb9d5e){return new BPromise(function(_0x5e38ae,_0x3eef3b){return client[_0x32aa('0x8')](_0x177694,_0xcb9d5e)[_0x32aa('0x9')](function(_0x3bb83e){logger[_0x32aa('0xa')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2b4b27,_0x32aa('0xb'));logger['debug'](_0x32aa('0xc'),_0x2b4b27,_0x32aa('0xb'),JSON[_0x32aa('0xd')](_0x3bb83e));if(_0x3bb83e[_0x32aa('0xe')]){if(_0x3bb83e[_0x32aa('0xe')][_0x32aa('0xf')]===0x1f4){logger[_0x32aa('0xe')](_0x32aa('0x10'),_0x2b4b27,_0x3bb83e[_0x32aa('0xe')][_0x32aa('0x11')]);return _0x3eef3b(_0x3bb83e[_0x32aa('0xe')][_0x32aa('0x11')]);}logger[_0x32aa('0xe')](_0x32aa('0x10'),_0x2b4b27,_0x3bb83e[_0x32aa('0xe')][_0x32aa('0x11')]);return _0x5e38ae(_0x3bb83e[_0x32aa('0xe')][_0x32aa('0x11')]);}else{logger[_0x32aa('0xa')](_0x32aa('0x10'),_0x2b4b27,_0x32aa('0xb'));_0x5e38ae(_0x3bb83e[_0x32aa('0x12')][_0x32aa('0x11')]);}})['catch'](function(_0x10731a){logger[_0x32aa('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2b4b27,_0x10731a);_0x3eef3b(_0x10731a);});});} \ No newline at end of file +var _0xb772=['message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb772,0x1e7));var _0x2b77=function(_0x4c84cf,_0x27b00b){_0x4c84cf=_0x4c84cf-0x0;var _0x54af3e=_0xb772[_0x4c84cf];return _0x54af3e;};'use strict';var _=require('lodash');var util=require(_0x2b77('0x0'));var moment=require('moment');var BPromise=require(_0x2b77('0x1'));var rs=require(_0x2b77('0x2'));var fs=require('fs');var Redis=require(_0x2b77('0x3'));var db=require(_0x2b77('0x4'))['db'];var utils=require(_0x2b77('0x5'));var logger=require(_0x2b77('0x6'))(_0x2b77('0x7'));var config=require('../../config/environment');var jayson=require(_0x2b77('0x8'));var client=jayson['client'][_0x2b77('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x517525,_0x2685d6,_0x47368a){return new BPromise(function(_0xeafb4a,_0x3e3e44){return client[_0x2b77('0xa')](_0x517525,_0x47368a)[_0x2b77('0xb')](function(_0x1d72a8){logger['info'](_0x2b77('0xc'),_0x2685d6,_0x2b77('0xd'));logger[_0x2b77('0xe')](_0x2b77('0xf'),_0x2685d6,_0x2b77('0xd'),JSON[_0x2b77('0x10')](_0x1d72a8));if(_0x1d72a8[_0x2b77('0x11')]){if(_0x1d72a8['error'][_0x2b77('0x12')]===0x1f4){logger['error'](_0x2b77('0xc'),_0x2685d6,_0x1d72a8[_0x2b77('0x11')]['message']);return _0x3e3e44(_0x1d72a8[_0x2b77('0x11')][_0x2b77('0x13')]);}logger[_0x2b77('0x11')](_0x2b77('0xc'),_0x2685d6,_0x1d72a8[_0x2b77('0x11')][_0x2b77('0x13')]);return _0xeafb4a(_0x1d72a8[_0x2b77('0x11')][_0x2b77('0x13')]);}else{logger[_0x2b77('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2685d6,_0x2b77('0xd'));_0xeafb4a(_0x1d72a8[_0x2b77('0x15')][_0x2b77('0x13')]);}})['catch'](function(_0x3e90fb){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x2685d6,_0x3e90fb);_0x3e3e44(_0x3e90fb);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 505129e..0a2d2aa 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 _0x41bb=['./intDynamics365Field.controller','get','isAuthenticated','show','create','put','/:id','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x23c4a6,_0x1d3514){var _0x21bd8d=function(_0x3885f3){while(--_0x3885f3){_0x23c4a6['push'](_0x23c4a6['shift']());}};_0x21bd8d(++_0x1d3514);}(_0x41bb,0xc5));var _0xb41b=function(_0x9e7eae,_0x14db8a){_0x9e7eae=_0x9e7eae-0x0;var _0x392bdc=_0x41bb[_0x9e7eae];return _0x392bdc;};'use strict';var multer=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var path=require('path');var timeout=require(_0xb41b('0x2'));var express=require('express');var router=express[_0xb41b('0x3')]();var fs_extra=require(_0xb41b('0x4'));var auth=require(_0xb41b('0x5'));var interaction=require(_0xb41b('0x6'));var config=require('../../config/environment');var controller=require(_0xb41b('0x7'));router[_0xb41b('0x8')]('/',auth[_0xb41b('0x9')](),controller['index']);router['get']('/:id',auth[_0xb41b('0x9')](),controller[_0xb41b('0xa')]);router['post']('/',auth[_0xb41b('0x9')](),controller[_0xb41b('0xb')]);router[_0xb41b('0xc')](_0xb41b('0xd'),auth[_0xb41b('0x9')](),controller[_0xb41b('0xe')]);router[_0xb41b('0xf')]('/:id',auth[_0xb41b('0x9')](),controller['destroy']);module[_0xb41b('0x10')]=router; \ No newline at end of file +var _0xacb8=['fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','exports','multer','path','connect-timeout','express'];(function(_0x2e9475,_0x55353e){var _0x2e737e=function(_0x4f3091){while(--_0x4f3091){_0x2e9475['push'](_0x2e9475['shift']());}};_0x2e737e(++_0x55353e);}(_0xacb8,0x119));var _0x8acb=function(_0x5b9989,_0x2cf715){_0x5b9989=_0x5b9989-0x0;var _0xe45bbe=_0xacb8[_0x5b9989];return _0xe45bbe;};'use strict';var multer=require(_0x8acb('0x0'));var util=require('util');var path=require(_0x8acb('0x1'));var timeout=require(_0x8acb('0x2'));var express=require(_0x8acb('0x3'));var router=express['Router']();var fs_extra=require(_0x8acb('0x4'));var auth=require(_0x8acb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8acb('0x6'));var controller=require(_0x8acb('0x7'));router[_0x8acb('0x8')]('/',auth[_0x8acb('0x9')](),controller[_0x8acb('0xa')]);router[_0x8acb('0x8')]('/:id',auth[_0x8acb('0x9')](),controller[_0x8acb('0xb')]);router[_0x8acb('0xc')]('/',auth[_0x8acb('0x9')](),controller[_0x8acb('0xd')]);router[_0x8acb('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x8acb('0xf')]);router[_0x8acb('0x10')](_0x8acb('0x11'),auth[_0x8acb('0x9')](),controller['destroy']);module[_0x8acb('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index e4a7e1d..e8902a2 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 _0xdc97=['picklist','STRING','string','customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue'];(function(_0x53e9d8,_0x33a39f){var _0x400044=function(_0x47aaa0){while(--_0x47aaa0){_0x53e9d8['push'](_0x53e9d8['shift']());}};_0x400044(++_0x33a39f);}(_0xdc97,0x13b));var _0x7dc9=function(_0x47a492,_0x1b4f2d){_0x47a492=_0x47a492-0x0;var _0x5069df=_0xdc97[_0x47a492];return _0x5069df;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'type':{'type':Sequelize[_0x7dc9('0x2')]('string',_0x7dc9('0x3'),'customVariable',_0x7dc9('0x4'),_0x7dc9('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x7dc9('0x6')]},'key':{'type':Sequelize[_0x7dc9('0x6')]},'keyType':{'type':Sequelize[_0x7dc9('0x2')](_0x7dc9('0x7'),'variable',_0x7dc9('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7dc9('0x6')]},'customField':{'type':Sequelize[_0x7dc9('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7dc9('0x6')]}}; \ No newline at end of file +var _0xd13e=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','customVariable'];(function(_0x47d026,_0xaea6f5){var _0x50650d=function(_0x1181ef){while(--_0x1181ef){_0x47d026['push'](_0x47d026['shift']());}};_0x50650d(++_0xaea6f5);}(_0xd13e,0x193));var _0xed13=function(_0x259081,_0x4278c5){_0x259081=_0x259081-0x0;var _0x1e399b=_0xd13e[_0x259081];return _0x1e399b;};'use strict';var Sequelize=require(_0xed13('0x0'));module[_0xed13('0x1')]={'type':{'type':Sequelize[_0xed13('0x2')](_0xed13('0x3'),'variable',_0xed13('0x4'),'keyValue',_0xed13('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xed13('0x6')]},'key':{'type':Sequelize[_0xed13('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0xed13('0x4'))},'keyContent':{'type':Sequelize[_0xed13('0x6')]},'idField':{'type':Sequelize[_0xed13('0x6')]},'nameField':{'type':Sequelize[_0xed13('0x6')]},'customField':{'type':Sequelize[_0xed13('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xed13('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 0ed5382..c1d2412 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 _0x555a=['sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','save','then','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','fields','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path'];(function(_0x5ece84,_0xc06c9f){var _0x2a12c4=function(_0x133bf3){while(--_0x133bf3){_0x5ece84['push'](_0x5ece84['shift']());}};_0x2a12c4(++_0xc06c9f);}(_0x555a,0xd3));var _0xa555=function(_0x323d0e,_0x274907){_0x323d0e=_0x323d0e-0x0;var _0x5c0e6e=_0x555a[_0x323d0e];return _0x5c0e6e;};'use strict';var emlformat=require(_0xa555('0x0'));var rimraf=require(_0xa555('0x1'));var zipdir=require(_0xa555('0x2'));var jsonpatch=require(_0xa555('0x3'));var rp=require('request-promise');var moment=require(_0xa555('0x4'));var BPromise=require(_0xa555('0x5'));var Mustache=require(_0xa555('0x6'));var util=require('util');var path=require(_0xa555('0x7'));var sox=require(_0xa555('0x8'));var csv=require(_0xa555('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa555('0xa'));var _=require(_0xa555('0xb'));var squel=require(_0xa555('0xc'));var crypto=require(_0xa555('0xd'));var jsforce=require(_0xa555('0xe'));var deskjs=require(_0xa555('0xf'));var toCsv=require(_0xa555('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa555('0x10'));var qs=require(_0xa555('0x11'));var as=require(_0xa555('0x12'));var hardwareService=require(_0xa555('0x13'));var logger=require('../../config/logger')(_0xa555('0x14'));var utils=require(_0xa555('0x15'));var config=require(_0xa555('0x16'));var licenseUtil=require(_0xa555('0x17'));var db=require(_0xa555('0x18'))['db'];function respondWithStatusCode(_0x468a29,_0x3b31b7){_0x3b31b7=_0x3b31b7||0xcc;return function(_0x464b22){if(_0x464b22){return _0x468a29[_0xa555('0x19')](_0x3b31b7);}return _0x468a29[_0xa555('0x1a')](_0x3b31b7)[_0xa555('0x1b')]();};}function respondWithResult(_0x4f2580,_0x260068){_0x260068=_0x260068||0xc8;return function(_0x3e7ab5){if(_0x3e7ab5){return _0x4f2580['status'](_0x260068)[_0xa555('0x1c')](_0x3e7ab5);}};}function respondWithFilteredResult(_0x15413e,_0x4a92f8){return function(_0x544dbd){if(_0x544dbd){var _0x248af7=_0x544dbd[_0xa555('0x1d')],_0x33f248=_0x4a92f8[_0xa555('0x1e')],_0x30c8a2=_0x4a92f8[_0xa555('0x1e')]+_0x4a92f8['limit'],_0x737f77;if(_0x30c8a2>=_0x248af7){_0x30c8a2=_0x248af7;_0x737f77=0xc8;}else{_0x737f77=0xce;}_0x15413e[_0xa555('0x1a')](_0x737f77);return _0x15413e[_0xa555('0x1f')]('Content-Range',_0x33f248+'-'+_0x30c8a2+'/'+_0x248af7)[_0xa555('0x1c')](_0x544dbd);}return null;};}function patchUpdates(_0x236f23){return function(_0x3480f2){try{jsonpatch['apply'](_0x3480f2,_0x236f23,!![]);}catch(_0x515d93){return BPromise['reject'](_0x515d93);}return _0x3480f2[_0xa555('0x20')]();};}function saveUpdates(_0x11e431,_0x1ff1e1){return function(_0x3cfb31){if(_0x3cfb31){return _0x3cfb31['update'](_0x11e431)[_0xa555('0x21')](function(_0x3c4c2a){return _0x3c4c2a;});}return null;};}function removeEntity(_0x1db3bf,_0x19fd23){return function(_0x4d9a45){if(_0x4d9a45){return _0x4d9a45['destroy']()['then'](function(){_0x1db3bf[_0xa555('0x1a')](0xcc)[_0xa555('0x1b')]();});}};}function handleEntityNotFound(_0x19e89f,_0x40ec48){return function(_0x1c8d61){if(!_0x1c8d61){_0x19e89f['sendStatus'](0x194);}return _0x1c8d61;};}function handleError(_0xdec995,_0x397daa){_0x397daa=_0x397daa||0x1f4;return function(_0x15ef4c){logger[_0xa555('0x22')](_0x15ef4c[_0xa555('0x23')]);if(_0x15ef4c[_0xa555('0x24')]){delete _0x15ef4c[_0xa555('0x24')];}_0xdec995[_0xa555('0x1a')](_0x397daa)[_0xa555('0x25')](_0x15ef4c);};}exports[_0xa555('0x26')]=function(_0x1837e5,_0x4ec22c){var _0x51bcad={},_0x40cd84={},_0x5da805={'count':0x0,'rows':[]};var _0x1f0435=_[_0xa555('0x27')](db[_0xa555('0x28')][_0xa555('0x29')],function(_0x153379){return{'name':_0x153379[_0xa555('0x2a')],'type':_0x153379[_0xa555('0x2b')][_0xa555('0x2c')]};});_0x40cd84[_0xa555('0x2d')]=_[_0xa555('0x27')](_0x1f0435,_0xa555('0x24'));_0x40cd84[_0xa555('0x2e')]=_['keys'](_0x1837e5[_0xa555('0x2e')]);_0x40cd84[_0xa555('0x2f')]=_[_0xa555('0x30')](_0x40cd84[_0xa555('0x2d')],_0x40cd84['query']);_0x51bcad[_0xa555('0x31')]=_[_0xa555('0x30')](_0x40cd84[_0xa555('0x2d')],qs['fields'](_0x1837e5[_0xa555('0x2e')]['fields']));_0x51bcad[_0xa555('0x31')]=_0x51bcad[_0xa555('0x31')][_0xa555('0x32')]?_0x51bcad[_0xa555('0x31')]:_0x40cd84[_0xa555('0x2d')];if(!_0x1837e5['query']['hasOwnProperty'](_0xa555('0x33'))){_0x51bcad[_0xa555('0x34')]=qs['limit'](_0x1837e5[_0xa555('0x2e')][_0xa555('0x34')]);_0x51bcad['offset']=qs['offset'](_0x1837e5['query'][_0xa555('0x1e')]);}_0x51bcad[_0xa555('0x35')]=qs[_0xa555('0x36')](_0x1837e5['query'][_0xa555('0x36')]);_0x51bcad[_0xa555('0x37')]=qs[_0xa555('0x2f')](_[_0xa555('0x38')](_0x1837e5['query'],_0x40cd84[_0xa555('0x2f')]),_0x1f0435);if(_0x1837e5[_0xa555('0x2e')][_0xa555('0x39')]){_0x51bcad[_0xa555('0x37')]=_[_0xa555('0x3a')](_0x51bcad['where'],{'$or':_[_0xa555('0x27')](_0x1f0435,function(_0x4de833){if(_0x4de833[_0xa555('0x2b')]!==_0xa555('0x3b')){var _0x1539a2={};_0x1539a2[_0x4de833[_0xa555('0x24')]]={'$like':'%'+_0x1837e5['query']['filter']+'%'};return _0x1539a2;}})});}_0x51bcad=_['merge']({},_0x51bcad,_0x1837e5[_0xa555('0x3c')]);var _0x2f3dc2={'where':_0x51bcad['where']};return db[_0xa555('0x28')][_0xa555('0x1d')](_0x2f3dc2)[_0xa555('0x21')](function(_0x19862e){_0x5da805['count']=_0x19862e;if(_0x1837e5[_0xa555('0x2e')][_0xa555('0x3d')]){_0x51bcad[_0xa555('0x3e')]=[{'all':!![]}];}return db[_0xa555('0x28')][_0xa555('0x3f')](_0x51bcad);})['then'](function(_0x2e91f5){_0x5da805[_0xa555('0x40')]=_0x2e91f5;return _0x5da805;})[_0xa555('0x21')](respondWithFilteredResult(_0x4ec22c,_0x51bcad))['catch'](handleError(_0x4ec22c,null));};exports[_0xa555('0x41')]=function(_0x3c1e65,_0x286150){var _0x5a4ee2={'raw':!![],'where':{'id':_0x3c1e65[_0xa555('0x42')]['id']}},_0x215fb4={};_0x215fb4[_0xa555('0x2d')]=_['keys'](db[_0xa555('0x28')][_0xa555('0x29')]);_0x215fb4[_0xa555('0x2e')]=_[_0xa555('0x43')](_0x3c1e65['query']);_0x215fb4[_0xa555('0x2f')]=_[_0xa555('0x30')](_0x215fb4[_0xa555('0x2d')],_0x215fb4[_0xa555('0x2e')]);_0x5a4ee2[_0xa555('0x31')]=_[_0xa555('0x30')](_0x215fb4[_0xa555('0x2d')],qs[_0xa555('0x44')](_0x3c1e65[_0xa555('0x2e')][_0xa555('0x44')]));_0x5a4ee2[_0xa555('0x31')]=_0x5a4ee2[_0xa555('0x31')][_0xa555('0x32')]?_0x5a4ee2[_0xa555('0x31')]:_0x215fb4[_0xa555('0x2d')];if(_0x3c1e65[_0xa555('0x2e')][_0xa555('0x3d')]){_0x5a4ee2['include']=[{'all':!![]}];}_0x5a4ee2=_[_0xa555('0x3a')]({},_0x5a4ee2,_0x3c1e65[_0xa555('0x3c')]);return db['Dynamics365Field']['find'](_0x5a4ee2)['then'](handleEntityNotFound(_0x286150,null))[_0xa555('0x21')](respondWithResult(_0x286150,null))[_0xa555('0x45')](handleError(_0x286150,null));};exports[_0xa555('0x46')]=function(_0x36b9a0,_0x2ca54d){return db[_0xa555('0x28')][_0xa555('0x46')](_0x36b9a0[_0xa555('0x47')],{})[_0xa555('0x21')](respondWithResult(_0x2ca54d,0xc9))['catch'](handleError(_0x2ca54d,null));};exports['update']=function(_0x2e1b04,_0x21fa31){if(_0x2e1b04[_0xa555('0x47')]['id']){delete _0x2e1b04['body']['id'];}return db['Dynamics365Field'][_0xa555('0x48')]({'where':{'id':_0x2e1b04[_0xa555('0x42')]['id']}})['then'](handleEntityNotFound(_0x21fa31,null))[_0xa555('0x21')](saveUpdates(_0x2e1b04[_0xa555('0x47')],null))['then'](respondWithResult(_0x21fa31,null))[_0xa555('0x45')](handleError(_0x21fa31,null));};exports['destroy']=function(_0x314fa5,_0x5646d8){return db[_0xa555('0x28')][_0xa555('0x48')]({'where':{'id':_0x314fa5['params']['id']}})[_0xa555('0x21')](handleEntityNotFound(_0x5646d8,null))[_0xa555('0x21')](removeEntity(_0x5646d8,null))[_0xa555('0x45')](handleError(_0x5646d8,null));}; \ No newline at end of file +var _0x9d6f=['../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','reject','save','update','then','end','error','stack','name','index','map','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','merge','options','Dynamics365Field','includeAll','include','rows','catch','show','params','keys','find','create','body','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0xa124c4,_0x344250){var _0x49dbb4=function(_0x3e8256){while(--_0x3e8256){_0xa124c4['push'](_0xa124c4['shift']());}};_0x49dbb4(++_0x344250);}(_0x9d6f,0x145));var _0xf9d6=function(_0x4e4f4a,_0x4cc9e0){_0x4e4f4a=_0x4e4f4a-0x0;var _0x544349=_0x9d6f[_0x4e4f4a];return _0x544349;};'use strict';var emlformat=require(_0xf9d6('0x0'));var rimraf=require(_0xf9d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf9d6('0x2'));var rp=require('request-promise');var moment=require(_0xf9d6('0x3'));var BPromise=require(_0xf9d6('0x4'));var Mustache=require(_0xf9d6('0x5'));var util=require(_0xf9d6('0x6'));var path=require(_0xf9d6('0x7'));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(_0xf9d6('0x8'));var squel=require(_0xf9d6('0x9'));var crypto=require(_0xf9d6('0xa'));var jsforce=require(_0xf9d6('0xb'));var deskjs=require(_0xf9d6('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf9d6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf9d6('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf9d6('0xf'));var hardwareService=require(_0xf9d6('0x10'));var logger=require('../../config/logger')(_0xf9d6('0x11'));var utils=require(_0xf9d6('0x12'));var config=require(_0xf9d6('0x13'));var licenseUtil=require(_0xf9d6('0x14'));var db=require(_0xf9d6('0x15'))['db'];function respondWithStatusCode(_0x312b74,_0x3bd8fe){_0x3bd8fe=_0x3bd8fe||0xcc;return function(_0x38b16c){if(_0x38b16c){return _0x312b74[_0xf9d6('0x16')](_0x3bd8fe);}return _0x312b74[_0xf9d6('0x17')](_0x3bd8fe)['end']();};}function respondWithResult(_0x45432e,_0x2f47c5){_0x2f47c5=_0x2f47c5||0xc8;return function(_0x11dd0f){if(_0x11dd0f){return _0x45432e[_0xf9d6('0x17')](_0x2f47c5)[_0xf9d6('0x18')](_0x11dd0f);}};}function respondWithFilteredResult(_0x56a0ca,_0x58c45b){return function(_0x3677b9){if(_0x3677b9){var _0x467839=_0x3677b9[_0xf9d6('0x19')],_0x189310=_0x58c45b[_0xf9d6('0x1a')],_0x3ea1c5=_0x58c45b[_0xf9d6('0x1a')]+_0x58c45b[_0xf9d6('0x1b')],_0x44c520;if(_0x3ea1c5>=_0x467839){_0x3ea1c5=_0x467839;_0x44c520=0xc8;}else{_0x44c520=0xce;}_0x56a0ca[_0xf9d6('0x17')](_0x44c520);return _0x56a0ca[_0xf9d6('0x1c')]('Content-Range',_0x189310+'-'+_0x3ea1c5+'/'+_0x467839)[_0xf9d6('0x18')](_0x3677b9);}return null;};}function patchUpdates(_0x406acb){return function(_0x14d985){try{jsonpatch['apply'](_0x14d985,_0x406acb,!![]);}catch(_0x5cf8d9){return BPromise[_0xf9d6('0x1d')](_0x5cf8d9);}return _0x14d985[_0xf9d6('0x1e')]();};}function saveUpdates(_0x51e7b3,_0x2b14c5){return function(_0x4498cd){if(_0x4498cd){return _0x4498cd[_0xf9d6('0x1f')](_0x51e7b3)[_0xf9d6('0x20')](function(_0x84ad8b){return _0x84ad8b;});}return null;};}function removeEntity(_0x12275a,_0x4573fc){return function(_0x45edc4){if(_0x45edc4){return _0x45edc4['destroy']()[_0xf9d6('0x20')](function(){_0x12275a[_0xf9d6('0x17')](0xcc)[_0xf9d6('0x21')]();});}};}function handleEntityNotFound(_0x313a2e,_0x5a6fb9){return function(_0xe54f06){if(!_0xe54f06){_0x313a2e[_0xf9d6('0x16')](0x194);}return _0xe54f06;};}function handleError(_0x573f79,_0x5f4801){_0x5f4801=_0x5f4801||0x1f4;return function(_0x1cce77){logger[_0xf9d6('0x22')](_0x1cce77[_0xf9d6('0x23')]);if(_0x1cce77[_0xf9d6('0x24')]){delete _0x1cce77[_0xf9d6('0x24')];}_0x573f79[_0xf9d6('0x17')](_0x5f4801)['send'](_0x1cce77);};}exports[_0xf9d6('0x25')]=function(_0x555fac,_0x91087a){var _0x4a64e8={},_0x2a937d={},_0x3e16bc={'count':0x0,'rows':[]};var _0x1de1c4=_[_0xf9d6('0x26')](db['Dynamics365Field'][_0xf9d6('0x27')],function(_0x577440){return{'name':_0x577440['fieldName'],'type':_0x577440['type'][_0xf9d6('0x28')]};});_0x2a937d[_0xf9d6('0x29')]=_[_0xf9d6('0x26')](_0x1de1c4,_0xf9d6('0x24'));_0x2a937d[_0xf9d6('0x2a')]=_['keys'](_0x555fac['query']);_0x2a937d[_0xf9d6('0x2b')]=_[_0xf9d6('0x2c')](_0x2a937d[_0xf9d6('0x29')],_0x2a937d[_0xf9d6('0x2a')]);_0x4a64e8[_0xf9d6('0x2d')]=_[_0xf9d6('0x2c')](_0x2a937d[_0xf9d6('0x29')],qs['fields'](_0x555fac['query'][_0xf9d6('0x2e')]));_0x4a64e8['attributes']=_0x4a64e8[_0xf9d6('0x2d')][_0xf9d6('0x2f')]?_0x4a64e8[_0xf9d6('0x2d')]:_0x2a937d[_0xf9d6('0x29')];if(!_0x555fac[_0xf9d6('0x2a')][_0xf9d6('0x30')]('nolimit')){_0x4a64e8[_0xf9d6('0x1b')]=qs[_0xf9d6('0x1b')](_0x555fac[_0xf9d6('0x2a')][_0xf9d6('0x1b')]);_0x4a64e8[_0xf9d6('0x1a')]=qs[_0xf9d6('0x1a')](_0x555fac[_0xf9d6('0x2a')]['offset']);}_0x4a64e8[_0xf9d6('0x31')]=qs[_0xf9d6('0x32')](_0x555fac[_0xf9d6('0x2a')][_0xf9d6('0x32')]);_0x4a64e8[_0xf9d6('0x33')]=qs[_0xf9d6('0x2b')](_['pick'](_0x555fac[_0xf9d6('0x2a')],_0x2a937d[_0xf9d6('0x2b')]),_0x1de1c4);if(_0x555fac[_0xf9d6('0x2a')][_0xf9d6('0x34')]){_0x4a64e8[_0xf9d6('0x33')]=_['merge'](_0x4a64e8['where'],{'$or':_[_0xf9d6('0x26')](_0x1de1c4,function(_0x40d429){if(_0x40d429[_0xf9d6('0x35')]!==_0xf9d6('0x36')){var _0x33f775={};_0x33f775[_0x40d429[_0xf9d6('0x24')]]={'$like':'%'+_0x555fac[_0xf9d6('0x2a')]['filter']+'%'};return _0x33f775;}})});}_0x4a64e8=_[_0xf9d6('0x37')]({},_0x4a64e8,_0x555fac[_0xf9d6('0x38')]);var _0x340ca7={'where':_0x4a64e8[_0xf9d6('0x33')]};return db[_0xf9d6('0x39')]['count'](_0x340ca7)['then'](function(_0x4450a9){_0x3e16bc[_0xf9d6('0x19')]=_0x4450a9;if(_0x555fac[_0xf9d6('0x2a')][_0xf9d6('0x3a')]){_0x4a64e8[_0xf9d6('0x3b')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x4a64e8);})['then'](function(_0x546be9){_0x3e16bc[_0xf9d6('0x3c')]=_0x546be9;return _0x3e16bc;})[_0xf9d6('0x20')](respondWithFilteredResult(_0x91087a,_0x4a64e8))[_0xf9d6('0x3d')](handleError(_0x91087a,null));};exports[_0xf9d6('0x3e')]=function(_0x2643b7,_0x23097f){var _0x437e96={'raw':!![],'where':{'id':_0x2643b7[_0xf9d6('0x3f')]['id']}},_0x5dfe4d={};_0x5dfe4d['model']=_['keys'](db[_0xf9d6('0x39')][_0xf9d6('0x27')]);_0x5dfe4d[_0xf9d6('0x2a')]=_[_0xf9d6('0x40')](_0x2643b7[_0xf9d6('0x2a')]);_0x5dfe4d[_0xf9d6('0x2b')]=_['intersection'](_0x5dfe4d['model'],_0x5dfe4d[_0xf9d6('0x2a')]);_0x437e96['attributes']=_['intersection'](_0x5dfe4d[_0xf9d6('0x29')],qs[_0xf9d6('0x2e')](_0x2643b7[_0xf9d6('0x2a')]['fields']));_0x437e96['attributes']=_0x437e96[_0xf9d6('0x2d')]['length']?_0x437e96['attributes']:_0x5dfe4d[_0xf9d6('0x29')];if(_0x2643b7[_0xf9d6('0x2a')][_0xf9d6('0x3a')]){_0x437e96[_0xf9d6('0x3b')]=[{'all':!![]}];}_0x437e96=_['merge']({},_0x437e96,_0x2643b7[_0xf9d6('0x38')]);return db[_0xf9d6('0x39')][_0xf9d6('0x41')](_0x437e96)['then'](handleEntityNotFound(_0x23097f,null))[_0xf9d6('0x20')](respondWithResult(_0x23097f,null))[_0xf9d6('0x3d')](handleError(_0x23097f,null));};exports[_0xf9d6('0x42')]=function(_0x89128d,_0x14927b){return db[_0xf9d6('0x39')][_0xf9d6('0x42')](_0x89128d[_0xf9d6('0x43')],{})[_0xf9d6('0x20')](respondWithResult(_0x14927b,0xc9))[_0xf9d6('0x3d')](handleError(_0x14927b,null));};exports[_0xf9d6('0x1f')]=function(_0x56cd25,_0xc0ac56){if(_0x56cd25['body']['id']){delete _0x56cd25[_0xf9d6('0x43')]['id'];}return db[_0xf9d6('0x39')]['find']({'where':{'id':_0x56cd25[_0xf9d6('0x3f')]['id']}})['then'](handleEntityNotFound(_0xc0ac56,null))[_0xf9d6('0x20')](saveUpdates(_0x56cd25[_0xf9d6('0x43')],null))[_0xf9d6('0x20')](respondWithResult(_0xc0ac56,null))[_0xf9d6('0x3d')](handleError(_0xc0ac56,null));};exports[_0xf9d6('0x44')]=function(_0x3b9e7e,_0x301d89){return db[_0xf9d6('0x39')][_0xf9d6('0x41')]({'where':{'id':_0x3b9e7e[_0xf9d6('0x3f')]['id']}})[_0xf9d6('0x20')](handleEntityNotFound(_0x301d89,null))[_0xf9d6('0x20')](removeEntity(_0x301d89,null))[_0xf9d6('0x3d')](handleError(_0x301d89,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index bf82237..9c90272 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 _0xe9e2=['bluebird','request-promise','path','rimraf','../../config/environment','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','api'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0xe9e2,0x1d9));var _0x2e9e=function(_0x12d5e9,_0x1decd6){_0x12d5e9=_0x12d5e9-0x0;var _0x343939=_0xe9e2[_0x12d5e9];return _0x343939;};'use strict';var _=require(_0x2e9e('0x0'));var util=require(_0x2e9e('0x1'));var logger=require('../../config/logger')(_0x2e9e('0x2'));var moment=require('moment');var BPromise=require(_0x2e9e('0x3'));var rp=require(_0x2e9e('0x4'));var fs=require('fs');var path=require(_0x2e9e('0x5'));var rimraf=require(_0x2e9e('0x6'));var config=require(_0x2e9e('0x7'));var attributes=require('./intDynamics365Field.attributes');module[_0x2e9e('0x8')]=function(_0x870c28,_0x2513c0){return _0x870c28['define'](_0x2e9e('0x9'),attributes,{'tableName':_0x2e9e('0xa'),'paranoid':![],'indexes':[{'name':_0x2e9e('0xb'),'fields':[_0x2e9e('0xc'),_0x2e9e('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x07ec=['moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','FieldId','lodash','util','../../config/logger','api'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x07ec,0x92));var _0xc07e=function(_0x1488cd,_0x25a893){_0x1488cd=_0x1488cd-0x0;var _0x63fa13=_0x07ec[_0x1488cd];return _0x63fa13;};'use strict';var _=require(_0xc07e('0x0'));var util=require(_0xc07e('0x1'));var logger=require(_0xc07e('0x2'))(_0xc07e('0x3'));var moment=require(_0xc07e('0x4'));var BPromise=require(_0xc07e('0x5'));var rp=require(_0xc07e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc07e('0x7'));var config=require(_0xc07e('0x8'));var attributes=require(_0xc07e('0x9'));module[_0xc07e('0xa')]=function(_0x43370d,_0x33e7e6){return _0x43370d[_0xc07e('0xb')](_0xc07e('0xc'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xc07e('0xd'),'fields':['idField',_0xc07e('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 c48abe6..ed8b18b 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 _0x0af5=['rpc','../../config/environment','jayson/promise','client','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5e2c54,_0x1f76bc){var _0x37f14b=function(_0x1d4235){while(--_0x1d4235){_0x5e2c54['push'](_0x5e2c54['shift']());}};_0x37f14b(++_0x1f76bc);}(_0x0af5,0x158));var _0x50af=function(_0x34c639,_0x1a2b98){_0x34c639=_0x34c639-0x0;var _0x1f948b=_0x0af5[_0x34c639];return _0x1f948b;};'use strict';var _=require('lodash');var util=require(_0x50af('0x0'));var moment=require(_0x50af('0x1'));var BPromise=require(_0x50af('0x2'));var rs=require(_0x50af('0x3'));var fs=require('fs');var Redis=require(_0x50af('0x4'));var db=require(_0x50af('0x5'))['db'];var utils=require(_0x50af('0x6'));var logger=require(_0x50af('0x7'))(_0x50af('0x8'));var config=require(_0x50af('0x9'));var jayson=require(_0x50af('0xa'));var client=jayson[_0x50af('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a5c0a,_0x3724ed,_0x120038){return new BPromise(function(_0x4dc2b9,_0x49814d){return client[_0x50af('0xc')](_0x5a5c0a,_0x120038)[_0x50af('0xd')](function(_0x4c7c19){logger['info'](_0x50af('0xe'),_0x3724ed,_0x50af('0xf'));logger['debug'](_0x50af('0x10'),_0x3724ed,_0x50af('0xf'),JSON[_0x50af('0x11')](_0x4c7c19));if(_0x4c7c19[_0x50af('0x12')]){if(_0x4c7c19['error'][_0x50af('0x13')]===0x1f4){logger[_0x50af('0x12')](_0x50af('0xe'),_0x3724ed,_0x4c7c19[_0x50af('0x12')][_0x50af('0x14')]);return _0x49814d(_0x4c7c19[_0x50af('0x12')]['message']);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x3724ed,_0x4c7c19[_0x50af('0x12')]['message']);return _0x4dc2b9(_0x4c7c19[_0x50af('0x12')][_0x50af('0x14')]);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x3724ed,_0x50af('0xf'));_0x4dc2b9(_0x4c7c19[_0x50af('0x15')]['message']);}})['catch'](function(_0x615464){logger[_0x50af('0x12')](_0x50af('0xe'),_0x3724ed,_0x615464);_0x49814d(_0x615464);});});} \ No newline at end of file +var _0xd2f5=['result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x47d93e,_0x553fe4){var _0x5326f3=function(_0x4f2be8){while(--_0x4f2be8){_0x47d93e['push'](_0x47d93e['shift']());}};_0x5326f3(++_0x553fe4);}(_0xd2f5,0x144));var _0x5d2f=function(_0x17b808,_0x7eda54){_0x17b808=_0x17b808-0x0;var _0xd843dd=_0xd2f5[_0x17b808];return _0xd843dd;};'use strict';var _=require(_0x5d2f('0x0'));var util=require('util');var moment=require(_0x5d2f('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d2f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d2f('0x3'))['db'];var utils=require(_0x5d2f('0x4'));var logger=require(_0x5d2f('0x5'))(_0x5d2f('0x6'));var config=require(_0x5d2f('0x7'));var jayson=require(_0x5d2f('0x8'));var client=jayson[_0x5d2f('0x9')][_0x5d2f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b2540,_0x443779,_0x908c6){return new BPromise(function(_0x1c8c59,_0x1670ea){return client[_0x5d2f('0xb')](_0x4b2540,_0x908c6)[_0x5d2f('0xc')](function(_0x58e637){logger[_0x5d2f('0xd')](_0x5d2f('0xe'),_0x443779,'request\x20sent');logger[_0x5d2f('0xf')](_0x5d2f('0x10'),_0x443779,_0x5d2f('0x11'),JSON['stringify'](_0x58e637));if(_0x58e637[_0x5d2f('0x12')]){if(_0x58e637[_0x5d2f('0x12')][_0x5d2f('0x13')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x443779,_0x58e637[_0x5d2f('0x12')]['message']);return _0x1670ea(_0x58e637[_0x5d2f('0x12')][_0x5d2f('0x14')]);}logger['error'](_0x5d2f('0xe'),_0x443779,_0x58e637['error'][_0x5d2f('0x14')]);return _0x1c8c59(_0x58e637[_0x5d2f('0x12')][_0x5d2f('0x14')]);}else{logger['info'](_0x5d2f('0xe'),_0x443779,_0x5d2f('0x11'));_0x1c8c59(_0x58e637[_0x5d2f('0x15')][_0x5d2f('0x14')]);}})[_0x5d2f('0x16')](function(_0x5796f6){logger[_0x5d2f('0x12')](_0x5d2f('0xe'),_0x443779,_0x5796f6);_0x1670ea(_0x5796f6);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 7e52d28..d16a33b 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 _0x3ba1=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','multer','util','path','connect-timeout','Router'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x3ba1,0x95));var _0x13ba=function(_0x17a037,_0x568996){_0x17a037=_0x17a037-0x0;var _0x5d24fb=_0x3ba1[_0x17a037];return _0x5d24fb;};'use strict';var multer=require(_0x13ba('0x0'));var util=require(_0x13ba('0x1'));var path=require(_0x13ba('0x2'));var timeout=require(_0x13ba('0x3'));var express=require('express');var router=express[_0x13ba('0x4')]();var fs_extra=require(_0x13ba('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x13ba('0x6'));var config=require(_0x13ba('0x7'));var controller=require('./intFreshdeskAccount.controller');router[_0x13ba('0x8')]('/',auth[_0x13ba('0x9')](),controller[_0x13ba('0xa')]);router[_0x13ba('0x8')](_0x13ba('0xb'),auth[_0x13ba('0x9')](),controller[_0x13ba('0xc')]);router[_0x13ba('0x8')](_0x13ba('0xd'),auth[_0x13ba('0x9')](),controller[_0x13ba('0xe')]);router[_0x13ba('0x8')]('/:id/fields',auth[_0x13ba('0x9')](),controller[_0x13ba('0xf')]);router[_0x13ba('0x10')]('/',auth[_0x13ba('0x9')](),controller[_0x13ba('0x11')]);router[_0x13ba('0x10')](_0x13ba('0xd'),auth[_0x13ba('0x9')](),controller[_0x13ba('0x12')]);router[_0x13ba('0x13')](_0x13ba('0xb'),auth[_0x13ba('0x9')](),controller[_0x13ba('0x14')]);router[_0x13ba('0x15')]('/:id',auth[_0x13ba('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7b3c=['delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','addConfiguration','update'];(function(_0x1fe8b9,_0xd87696){var _0x25d006=function(_0x35727f){while(--_0x35727f){_0x1fe8b9['push'](_0x1fe8b9['shift']());}};_0x25d006(++_0xd87696);}(_0x7b3c,0x75));var _0xc7b3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7b3c[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0xc7b3('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc7b3('0x1'));var router=express[_0xc7b3('0x2')]();var fs_extra=require(_0xc7b3('0x3'));var auth=require(_0xc7b3('0x4'));var interaction=require(_0xc7b3('0x5'));var config=require(_0xc7b3('0x6'));var controller=require('./intFreshdeskAccount.controller');router[_0xc7b3('0x7')]('/',auth['isAuthenticated'](),controller[_0xc7b3('0x8')]);router['get']('/:id',auth[_0xc7b3('0x9')](),controller[_0xc7b3('0xa')]);router['get'](_0xc7b3('0xb'),auth['isAuthenticated'](),controller[_0xc7b3('0xc')]);router[_0xc7b3('0x7')](_0xc7b3('0xd'),auth[_0xc7b3('0x9')](),controller['getFields']);router['post']('/',auth[_0xc7b3('0x9')](),controller['create']);router['post'](_0xc7b3('0xb'),auth[_0xc7b3('0x9')](),controller[_0xc7b3('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc7b3('0xf')]);router[_0xc7b3('0x10')]('/:id',auth[_0xc7b3('0x9')](),controller[_0xc7b3('0x11')]);module[_0xc7b3('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 263f212..d8b86be 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 _0xaa99=['STRING','username','remoteUri','sequelize','exports'];(function(_0x36940e,_0x11f338){var _0x3283f2=function(_0x418008){while(--_0x418008){_0x36940e['push'](_0x36940e['shift']());}};_0x3283f2(++_0x11f338);}(_0xaa99,0xa8));var _0x9aa9=function(_0x5eab2f,_0x23bc2a){_0x5eab2f=_0x5eab2f-0x0;var _0x5c5717=_0xaa99[_0x5eab2f];return _0x5c5717;};'use strict';var Sequelize=require(_0x9aa9('0x0'));module[_0x9aa9('0x1')]={'name':{'type':Sequelize[_0x9aa9('0x2')]},'description':{'type':Sequelize[_0x9aa9('0x2')]},'username':{'type':Sequelize[_0x9aa9('0x2')],'unique':_0x9aa9('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9aa9('0x2')],'unique':_0x9aa9('0x4')},'serverUrl':{'type':Sequelize[_0x9aa9('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xca71=['username','remoteUri','sequelize','exports','STRING'];(function(_0x1b54f7,_0xe89862){var _0x343192=function(_0x5ac498){while(--_0x5ac498){_0x1b54f7['push'](_0x1b54f7['shift']());}};_0x343192(++_0xe89862);}(_0xca71,0x101));var _0x1ca7=function(_0x70d3b5,_0x4bbd30){_0x70d3b5=_0x70d3b5-0x0;var _0x4f96d6=_0xca71[_0x70d3b5];return _0x4f96d6;};'use strict';var Sequelize=require(_0x1ca7('0x0'));module[_0x1ca7('0x1')]={'name':{'type':Sequelize[_0x1ca7('0x2')]},'description':{'type':Sequelize[_0x1ca7('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x1ca7('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1ca7('0x2')],'unique':_0x1ca7('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index bdd26be..0cb3d96 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 _0xaaa1=['then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','Content-Range','json','apply','save','update','destroy','stack','send','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskAccount','includeAll','include','findAll','rows','show','find','create','body','params','findOne','FreshdeskConfiguration','hasOwnProperty','getConfigurations','addConfiguration','Subjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','slice','lastIndexOf','GET','format','%s/%s','Basic\x20%s','%s:X','toString','requester','subject','agent','description','priority','group','source','remove','default','label','choices','capitalize','test','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request'];(function(_0xde202b,_0x21cae8){var _0x277944=function(_0x53535a){while(--_0x53535a){_0xde202b['push'](_0xde202b['shift']());}};_0x277944(++_0x21cae8);}(_0xaaa1,0x14f));var _0x1aaa=function(_0x3d63e9,_0x15f6a7){_0x3d63e9=_0x3d63e9-0x0;var _0xf44238=_0xaaa1[_0x3d63e9];return _0xf44238;};'use strict';var emlformat=require(_0x1aaa('0x0'));var rimraf=require(_0x1aaa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1aaa('0x2'));var rp=require(_0x1aaa('0x3'));var moment=require(_0x1aaa('0x4'));var BPromise=require(_0x1aaa('0x5'));var Mustache=require(_0x1aaa('0x6'));var util=require(_0x1aaa('0x7'));var path=require('path');var sox=require(_0x1aaa('0x8'));var csv=require(_0x1aaa('0x9'));var ejs=require(_0x1aaa('0xa'));var fs=require('fs');var fs_extra=require(_0x1aaa('0xb'));var _=require(_0x1aaa('0xc'));var squel=require(_0x1aaa('0xd'));var crypto=require('crypto');var jsforce=require(_0x1aaa('0xe'));var deskjs=require(_0x1aaa('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1aaa('0x10'));var Papa=require('papaparse');var Redis=require(_0x1aaa('0x11'));var authService=require(_0x1aaa('0x12'));var qs=require(_0x1aaa('0x13'));var as=require(_0x1aaa('0x14'));var hardwareService=require(_0x1aaa('0x15'));var logger=require(_0x1aaa('0x16'))(_0x1aaa('0x17'));var utils=require(_0x1aaa('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1aaa('0x19'))['db'];var integrations=require(_0x1aaa('0x1a'));var jayson=require(_0x1aaa('0x1b'));var client=jayson[_0x1aaa('0x1c')][_0x1aaa('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x137193,_0x3db522,_0x5b8426,_0x4759c0){return new BPromise(function(_0x26f0f3,_0x1b7283){var _0x4d15e1=_0x4759c0||client;return _0x4d15e1[_0x1aaa('0x1e')](_0x137193,_0x5b8426)[_0x1aaa('0x1f')](function(_0x7a29a5){logger['info'](_0x1aaa('0x20'),_0x3db522,_0x1aaa('0x21'));logger[_0x1aaa('0x22')](_0x1aaa('0x23'),_0x3db522,_0x1aaa('0x21'),JSON[_0x1aaa('0x24')](_0x7a29a5));if(_0x7a29a5[_0x1aaa('0x25')]){if(_0x7a29a5[_0x1aaa('0x25')][_0x1aaa('0x26')]===0x1f4){logger['error'](_0x1aaa('0x20'),_0x3db522,_0x7a29a5['error']['message']);return _0x1b7283(_0x7a29a5[_0x1aaa('0x25')][_0x1aaa('0x27')]);}logger[_0x1aaa('0x25')](_0x1aaa('0x20'),_0x3db522,_0x7a29a5['error']['message']);return _0x26f0f3(_0x7a29a5['error']['message']);}else{logger['info'](_0x1aaa('0x20'),_0x3db522,_0x1aaa('0x21'));_0x26f0f3(_0x7a29a5[_0x1aaa('0x28')][_0x1aaa('0x27')]);}})[_0x1aaa('0x29')](function(_0x547346){logger['error'](_0x1aaa('0x20'),_0x3db522,_0x547346);_0x1b7283(_0x547346);});});}function respondWithStatusCode(_0x3d7aa3,_0x3d1cd8){_0x3d1cd8=_0x3d1cd8||0xcc;return function(_0x188879){if(_0x188879){return _0x3d7aa3[_0x1aaa('0x2a')](_0x3d1cd8);}return _0x3d7aa3[_0x1aaa('0x2b')](_0x3d1cd8)[_0x1aaa('0x2c')]();};}function respondWithResult(_0x512714,_0x22dba2){_0x22dba2=_0x22dba2||0xc8;return function(_0x52cb81){if(_0x52cb81){return _0x512714[_0x1aaa('0x2b')](_0x22dba2)['json'](_0x52cb81);}};}function respondWithFilteredResult(_0x378a53,_0x3095e2){return function(_0x90398){if(_0x90398){var _0x5de154=_0x90398[_0x1aaa('0x2d')],_0x20cf69=_0x3095e2[_0x1aaa('0x2e')],_0x249e36=_0x3095e2[_0x1aaa('0x2e')]+_0x3095e2['limit'],_0x2cc562;if(_0x249e36>=_0x5de154){_0x249e36=_0x5de154;_0x2cc562=0xc8;}else{_0x2cc562=0xce;}_0x378a53[_0x1aaa('0x2b')](_0x2cc562);return _0x378a53['set'](_0x1aaa('0x2f'),_0x20cf69+'-'+_0x249e36+'/'+_0x5de154)[_0x1aaa('0x30')](_0x90398);}return null;};}function patchUpdates(_0x3bc6b7){return function(_0x172f6b){try{jsonpatch[_0x1aaa('0x31')](_0x172f6b,_0x3bc6b7,!![]);}catch(_0x56ca08){return BPromise['reject'](_0x56ca08);}return _0x172f6b[_0x1aaa('0x32')]();};}function saveUpdates(_0x62eff5,_0x21bfe2){return function(_0x1f958f){if(_0x1f958f){return _0x1f958f[_0x1aaa('0x33')](_0x62eff5)['then'](function(_0x2ce171){return _0x2ce171;});}return null;};}function removeEntity(_0x259e80,_0x40bfba){return function(_0x33bad8){if(_0x33bad8){return _0x33bad8[_0x1aaa('0x34')]()[_0x1aaa('0x1f')](function(){_0x259e80['status'](0xcc)[_0x1aaa('0x2c')]();});}};}function handleEntityNotFound(_0x174a94,_0xdfe9fc){return function(_0x36cb49){if(!_0x36cb49){_0x174a94[_0x1aaa('0x2a')](0x194);}return _0x36cb49;};}function handleError(_0x30fbf6,_0x1683d9){_0x1683d9=_0x1683d9||0x1f4;return function(_0x2f8061){logger[_0x1aaa('0x25')](_0x2f8061[_0x1aaa('0x35')]);if(_0x2f8061['name']){delete _0x2f8061['name'];}_0x30fbf6[_0x1aaa('0x2b')](_0x1683d9)[_0x1aaa('0x36')](_0x2f8061);};}exports['index']=function(_0x9352a8,_0x5352ae){var _0x280cf4={},_0x44d38e={},_0xa3fa29={'count':0x0,'rows':[]};var _0x3e27a6=_[_0x1aaa('0x37')](db['FreshdeskAccount'][_0x1aaa('0x38')],function(_0x1a3d37){return{'name':_0x1a3d37[_0x1aaa('0x39')],'type':_0x1a3d37[_0x1aaa('0x3a')][_0x1aaa('0x3b')]};});_0x44d38e[_0x1aaa('0x3c')]=_[_0x1aaa('0x37')](_0x3e27a6,_0x1aaa('0x3d'));_0x44d38e[_0x1aaa('0x3e')]=_[_0x1aaa('0x3f')](_0x9352a8[_0x1aaa('0x3e')]);_0x44d38e[_0x1aaa('0x40')]=_[_0x1aaa('0x41')](_0x44d38e[_0x1aaa('0x3c')],_0x44d38e['query']);_0x280cf4['attributes']=_[_0x1aaa('0x41')](_0x44d38e[_0x1aaa('0x3c')],qs[_0x1aaa('0x42')](_0x9352a8['query'][_0x1aaa('0x42')]));_0x280cf4[_0x1aaa('0x43')]=_0x280cf4[_0x1aaa('0x43')][_0x1aaa('0x44')]?_0x280cf4[_0x1aaa('0x43')]:_0x44d38e['model'];if(!_0x9352a8[_0x1aaa('0x3e')]['hasOwnProperty'](_0x1aaa('0x45'))){_0x280cf4[_0x1aaa('0x46')]=qs[_0x1aaa('0x46')](_0x9352a8[_0x1aaa('0x3e')][_0x1aaa('0x46')]);_0x280cf4[_0x1aaa('0x2e')]=qs[_0x1aaa('0x2e')](_0x9352a8['query'][_0x1aaa('0x2e')]);}_0x280cf4[_0x1aaa('0x47')]=qs[_0x1aaa('0x48')](_0x9352a8[_0x1aaa('0x3e')][_0x1aaa('0x48')]);_0x280cf4[_0x1aaa('0x49')]=qs[_0x1aaa('0x40')](_[_0x1aaa('0x4a')](_0x9352a8['query'],_0x44d38e[_0x1aaa('0x40')]),_0x3e27a6);if(_0x9352a8[_0x1aaa('0x3e')][_0x1aaa('0x4b')]){_0x280cf4[_0x1aaa('0x49')]=_[_0x1aaa('0x4c')](_0x280cf4[_0x1aaa('0x49')],{'$or':_[_0x1aaa('0x37')](_0x3e27a6,function(_0x377eaa){if(_0x377eaa[_0x1aaa('0x3a')]!==_0x1aaa('0x4d')){var _0x19a571={};_0x19a571[_0x377eaa[_0x1aaa('0x3d')]]={'$like':'%'+_0x9352a8[_0x1aaa('0x3e')]['filter']+'%'};return _0x19a571;}})});}_0x280cf4=_['merge']({},_0x280cf4,_0x9352a8[_0x1aaa('0x4e')]);var _0x1ed521={'where':_0x280cf4['where']};return db[_0x1aaa('0x4f')][_0x1aaa('0x2d')](_0x1ed521)[_0x1aaa('0x1f')](function(_0x9aa0f4){_0xa3fa29[_0x1aaa('0x2d')]=_0x9aa0f4;if(_0x9352a8['query'][_0x1aaa('0x50')]){_0x280cf4[_0x1aaa('0x51')]=[{'all':!![]}];}return db[_0x1aaa('0x4f')][_0x1aaa('0x52')](_0x280cf4);})[_0x1aaa('0x1f')](function(_0x3d5f83){_0xa3fa29[_0x1aaa('0x53')]=_0x3d5f83;return _0xa3fa29;})[_0x1aaa('0x1f')](respondWithFilteredResult(_0x5352ae,_0x280cf4))[_0x1aaa('0x29')](handleError(_0x5352ae,null));};exports[_0x1aaa('0x54')]=function(_0x4a146a,_0x2e531e){var _0x1dbf07={'raw':![],'where':{'id':_0x4a146a['params']['id']}},_0x269982={};_0x269982[_0x1aaa('0x3c')]=_[_0x1aaa('0x3f')](db['FreshdeskAccount'][_0x1aaa('0x38')]);_0x269982[_0x1aaa('0x3e')]=_[_0x1aaa('0x3f')](_0x4a146a[_0x1aaa('0x3e')]);_0x269982['filters']=_['intersection'](_0x269982['model'],_0x269982[_0x1aaa('0x3e')]);_0x1dbf07['attributes']=_['intersection'](_0x269982[_0x1aaa('0x3c')],qs['fields'](_0x4a146a['query'][_0x1aaa('0x42')]));_0x1dbf07[_0x1aaa('0x43')]=_0x1dbf07['attributes'][_0x1aaa('0x44')]?_0x1dbf07[_0x1aaa('0x43')]:_0x269982['model'];if(_0x4a146a[_0x1aaa('0x3e')][_0x1aaa('0x50')]){_0x1dbf07[_0x1aaa('0x51')]=[{'all':!![]}];}_0x1dbf07=_[_0x1aaa('0x4c')]({},_0x1dbf07,_0x4a146a[_0x1aaa('0x4e')]);return db['FreshdeskAccount'][_0x1aaa('0x55')](_0x1dbf07)['then'](handleEntityNotFound(_0x2e531e,null))[_0x1aaa('0x1f')](respondWithResult(_0x2e531e,null))[_0x1aaa('0x29')](handleError(_0x2e531e,null));};exports[_0x1aaa('0x56')]=function(_0x17044d,_0x47996f){return db['FreshdeskAccount'][_0x1aaa('0x56')](_0x17044d['body'],{})[_0x1aaa('0x1f')](respondWithResult(_0x47996f,0xc9))[_0x1aaa('0x29')](handleError(_0x47996f,null));};exports['update']=function(_0x127b82,_0x1d1dc7){if(_0x127b82[_0x1aaa('0x57')]['id']){delete _0x127b82[_0x1aaa('0x57')]['id'];}return db['FreshdeskAccount'][_0x1aaa('0x55')]({'where':{'id':_0x127b82[_0x1aaa('0x58')]['id']}})[_0x1aaa('0x1f')](handleEntityNotFound(_0x1d1dc7,null))['then'](saveUpdates(_0x127b82['body'],null))[_0x1aaa('0x1f')](respondWithResult(_0x1d1dc7,null))['catch'](handleError(_0x1d1dc7,null));};exports[_0x1aaa('0x34')]=function(_0x3c3496,_0x11d157){return db['FreshdeskAccount'][_0x1aaa('0x55')]({'where':{'id':_0x3c3496[_0x1aaa('0x58')]['id']}})['then'](handleEntityNotFound(_0x11d157,null))[_0x1aaa('0x1f')](removeEntity(_0x11d157,null))[_0x1aaa('0x29')](handleError(_0x11d157,null));};exports['getConfigurations']=function(_0x3b612e,_0x22276c,_0x224a97){var _0x3d1b2e={};var _0x5d423f={};var _0x4aa7c3;var _0x41c62b;return db[_0x1aaa('0x4f')][_0x1aaa('0x59')]({'where':{'id':_0x3b612e[_0x1aaa('0x58')]['id']}})[_0x1aaa('0x1f')](handleEntityNotFound(_0x22276c,null))[_0x1aaa('0x1f')](function(_0x4b7343){if(_0x4b7343){_0x4aa7c3=_0x4b7343;_0x5d423f['model']=_[_0x1aaa('0x3f')](db[_0x1aaa('0x5a')][_0x1aaa('0x38')]);_0x5d423f[_0x1aaa('0x3e')]=_[_0x1aaa('0x3f')](_0x3b612e['query']);_0x5d423f[_0x1aaa('0x40')]=_[_0x1aaa('0x41')](_0x5d423f[_0x1aaa('0x3c')],_0x5d423f[_0x1aaa('0x3e')]);_0x3d1b2e[_0x1aaa('0x43')]=_[_0x1aaa('0x41')](_0x5d423f[_0x1aaa('0x3c')],qs[_0x1aaa('0x42')](_0x3b612e[_0x1aaa('0x3e')][_0x1aaa('0x42')]));_0x3d1b2e[_0x1aaa('0x43')]=_0x3d1b2e[_0x1aaa('0x43')]['length']?_0x3d1b2e[_0x1aaa('0x43')]:_0x5d423f[_0x1aaa('0x3c')];_0x3d1b2e[_0x1aaa('0x47')]=qs['sort'](_0x3b612e['query']['sort']);_0x3d1b2e[_0x1aaa('0x49')]=qs[_0x1aaa('0x40')](_[_0x1aaa('0x4a')](_0x3b612e[_0x1aaa('0x3e')],_0x5d423f[_0x1aaa('0x40')]));if(_0x3b612e[_0x1aaa('0x3e')][_0x1aaa('0x4b')]){_0x3d1b2e[_0x1aaa('0x49')]=_['merge'](_0x3d1b2e[_0x1aaa('0x49')],{'$or':_[_0x1aaa('0x37')](_0x3d1b2e[_0x1aaa('0x43')],function(_0x2872d6){var _0x3f511e={};_0x3f511e[_0x2872d6]={'$like':'%'+_0x3b612e[_0x1aaa('0x3e')][_0x1aaa('0x4b')]+'%'};return _0x3f511e;})});}_0x3d1b2e=_[_0x1aaa('0x4c')]({},_0x3d1b2e,_0x3b612e[_0x1aaa('0x4e')]);return _0x4aa7c3['getConfigurations'](_0x3d1b2e);}})['then'](function(_0x14cabd){if(_0x14cabd){_0x41c62b=_0x14cabd[_0x1aaa('0x44')];if(!_0x3b612e[_0x1aaa('0x3e')][_0x1aaa('0x5b')](_0x1aaa('0x45'))){_0x3d1b2e[_0x1aaa('0x46')]=qs['limit'](_0x3b612e[_0x1aaa('0x3e')][_0x1aaa('0x46')]);_0x3d1b2e[_0x1aaa('0x2e')]=qs['offset'](_0x3b612e[_0x1aaa('0x3e')]['offset']);}return _0x4aa7c3[_0x1aaa('0x5c')](_0x3d1b2e);}})[_0x1aaa('0x1f')](function(_0x5d953c){if(_0x5d953c){return _0x5d953c?{'count':_0x41c62b,'rows':_0x5d953c}:null;}})[_0x1aaa('0x1f')](respondWithResult(_0x22276c,null))[_0x1aaa('0x29')](handleError(_0x22276c,null));};exports[_0x1aaa('0x5d')]=function(_0x35284c,_0x2851b4,_0x3647ee){if(_0x35284c['body']['id']){delete _0x35284c[_0x1aaa('0x57')]['id'];}return db['FreshdeskAccount'][_0x1aaa('0x59')]({'where':{'id':_0x35284c['params']['id']}})['then'](handleEntityNotFound(_0x2851b4,null))['then'](function(_0x4d5925){if(_0x4d5925){_0x35284c[_0x1aaa('0x57')]['AccountId']=_0x4d5925['id'];_0x35284c[_0x1aaa('0x57')][_0x1aaa('0x5e')]=integrations['getSubjects'](_0x35284c[_0x1aaa('0x57')][_0x1aaa('0x5f')],_0x35284c[_0x1aaa('0x57')]['type']);_0x35284c[_0x1aaa('0x57')][_0x1aaa('0x60')]=integrations['getDescriptions'](_0x35284c[_0x1aaa('0x57')][_0x1aaa('0x5f')],_0x35284c[_0x1aaa('0x57')][_0x1aaa('0x3a')]);return db[_0x1aaa('0x5a')][_0x1aaa('0x56')](_0x35284c['body'],{'include':[{'model':db['FreshdeskField'],'as':_0x1aaa('0x5e')},{'model':db[_0x1aaa('0x61')],'as':_0x1aaa('0x60')}]});}return null;})[_0x1aaa('0x1f')](respondWithResult(_0x2851b4,null))[_0x1aaa('0x29')](handleError(_0x2851b4,null));};exports[_0x1aaa('0x62')]=function(_0x8bc5ce,_0x176d8d,_0x5d2900){var _0x1c5959='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x8bc5ce[_0x1aaa('0x58')]['id']},'attributes':['id',_0x1aaa('0x63'),'apiKey']})[_0x1aaa('0x1f')](handleEntityNotFound(_0x176d8d,null))[_0x1aaa('0x1f')](function(_0x329269){if(_0x329269){_0x1c5959=_0x329269['remoteUri'];var _0x59afb4=_0x1c5959[_0x1aaa('0x64')](-0x1);if(_0x59afb4==='/'){_0x1c5959=_0x1c5959['substring'](0x0,_0x1c5959[_0x1aaa('0x65')](_0x59afb4));}return rp({'method':_0x1aaa('0x66'),'uri':util[_0x1aaa('0x67')](_0x1aaa('0x68'),_0x1c5959,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x1aaa('0x67')](_0x1aaa('0x69'),new Buffer(util[_0x1aaa('0x67')](_0x1aaa('0x6a'),_0x329269['apiKey']))[_0x1aaa('0x6b')]('base64'))},'json':!![]});}})[_0x1aaa('0x1f')](function(_0x24737c){if(_0x24737c){var _0x1b86ca=[_0x1aaa('0x6c'),_0x1aaa('0x6d'),_0x1aaa('0x6e'),_0x1aaa('0x6f'),_0x1aaa('0x2b'),_0x1aaa('0x70'),_0x1aaa('0x71'),_0x1aaa('0x72'),'ticket_type',_0x1aaa('0x71'),'company'];_[_0x1aaa('0x73')](_0x24737c,function(_0x2910b0){return _0x1b86ca['includes'](_0x2910b0[_0x1aaa('0x3d')])||!_0x2910b0[_0x1aaa('0x74')]&&_0x2910b0['type']!=='custom_text'&&_0x2910b0[_0x1aaa('0x3a')]!=='custom_dropdown';});return{'count':_0x24737c['length'],'rows':_[_0x1aaa('0x37')](_0x24737c,function(_0x2798e6){return{'id':_0x2798e6[_0x1aaa('0x3d')],'name':_0x2798e6[_0x1aaa('0x75')],'custom':!_0x2798e6[_0x1aaa('0x74')],'options':_0x2798e6[_0x1aaa('0x76')]?_['map'](_0x2798e6['choices'],function(_0x487917){return{'name':_[_0x1aaa('0x77')](_0x487917),'value':_0x487917};}):[]};})};}})[_0x1aaa('0x1f')](respondWithResult(_0x176d8d,null))[_0x1aaa('0x29')](function(_0xde8b3d){var _0x33d13a=_0x8bc5ce[_0x1aaa('0x3e')][_0x1aaa('0x78')]?0x1f4:_0xde8b3d['statusCode']||0x1f4;logger[_0x1aaa('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x1aaa('0x62'),_0x33d13a,JSON[_0x1aaa('0x24')](_0xde8b3d));delete _0xde8b3d[_0x1aaa('0x3d')];if(_0x33d13a===0x191){_0x33d13a=0x190;}_0x176d8d[_0x1aaa('0x2b')](_0x33d13a)[_0x1aaa('0x36')](_0x8bc5ce['query'][_0x1aaa('0x78')]?{'message':'Wrong\x20credentials','statusCode':_0xde8b3d[_0x1aaa('0x79')]}:_0xde8b3d);});}; \ No newline at end of file +var _0x0228=['../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','FreshdeskAccount','findAll','rows','show','params','find','create','body','getConfigurations','FreshdeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','description','group','ticket_type','company','default','custom_text','custom_dropdown','label','capitalize','test','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0x0228,0x1d4));var _0x8022=function(_0x43b9af,_0x2c8316){_0x43b9af=_0x43b9af-0x0;var _0x1df62e=_0x0228[_0x43b9af];return _0x1df62e;};'use strict';var emlformat=require(_0x8022('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8022('0x1'));var jsonpatch=require(_0x8022('0x2'));var rp=require('request-promise');var moment=require(_0x8022('0x3'));var BPromise=require(_0x8022('0x4'));var Mustache=require(_0x8022('0x5'));var util=require(_0x8022('0x6'));var path=require(_0x8022('0x7'));var sox=require(_0x8022('0x8'));var csv=require(_0x8022('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8022('0xa'));var _=require('lodash');var squel=require(_0x8022('0xb'));var crypto=require(_0x8022('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8022('0x9'));var querystring=require(_0x8022('0xd'));var Papa=require(_0x8022('0xe'));var Redis=require(_0x8022('0xf'));var authService=require(_0x8022('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8022('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8022('0x12'))('api');var utils=require(_0x8022('0x13'));var config=require(_0x8022('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8022('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x8022('0x16'));var client=jayson[_0x8022('0x17')][_0x8022('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5b3e82,_0x4c4fb8,_0x4c11ef,_0x18e7f7){return new BPromise(function(_0x20fbbd,_0x52801e){var _0x3acda0=_0x18e7f7||client;return _0x3acda0[_0x8022('0x19')](_0x5b3e82,_0x4c11ef)['then'](function(_0x7b4272){logger[_0x8022('0x1a')](_0x8022('0x1b'),_0x4c4fb8,_0x8022('0x1c'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x4c4fb8,_0x8022('0x1c'),JSON[_0x8022('0x1d')](_0x7b4272));if(_0x7b4272[_0x8022('0x1e')]){if(_0x7b4272['error'][_0x8022('0x1f')]===0x1f4){logger[_0x8022('0x1e')](_0x8022('0x1b'),_0x4c4fb8,_0x7b4272[_0x8022('0x1e')][_0x8022('0x20')]);return _0x52801e(_0x7b4272['error'][_0x8022('0x20')]);}logger[_0x8022('0x1e')]('FreshdeskAccount,\x20%s,\x20%s',_0x4c4fb8,_0x7b4272['error']['message']);return _0x20fbbd(_0x7b4272[_0x8022('0x1e')][_0x8022('0x20')]);}else{logger[_0x8022('0x1a')](_0x8022('0x1b'),_0x4c4fb8,_0x8022('0x1c'));_0x20fbbd(_0x7b4272[_0x8022('0x21')][_0x8022('0x20')]);}})[_0x8022('0x22')](function(_0x411dff){logger[_0x8022('0x1e')](_0x8022('0x1b'),_0x4c4fb8,_0x411dff);_0x52801e(_0x411dff);});});}function respondWithStatusCode(_0x131cec,_0x513753){_0x513753=_0x513753||0xcc;return function(_0x2ad696){if(_0x2ad696){return _0x131cec[_0x8022('0x23')](_0x513753);}return _0x131cec[_0x8022('0x24')](_0x513753)[_0x8022('0x25')]();};}function respondWithResult(_0x54c9c6,_0x575e1f){_0x575e1f=_0x575e1f||0xc8;return function(_0x5b47e7){if(_0x5b47e7){return _0x54c9c6[_0x8022('0x24')](_0x575e1f)[_0x8022('0x26')](_0x5b47e7);}};}function respondWithFilteredResult(_0x568a10,_0x46fb8c){return function(_0x3ca243){if(_0x3ca243){var _0x35ff26=_0x3ca243[_0x8022('0x27')],_0x11e352=_0x46fb8c[_0x8022('0x28')],_0x5a96c9=_0x46fb8c[_0x8022('0x28')]+_0x46fb8c[_0x8022('0x29')],_0x326781;if(_0x5a96c9>=_0x35ff26){_0x5a96c9=_0x35ff26;_0x326781=0xc8;}else{_0x326781=0xce;}_0x568a10[_0x8022('0x24')](_0x326781);return _0x568a10['set'](_0x8022('0x2a'),_0x11e352+'-'+_0x5a96c9+'/'+_0x35ff26)['json'](_0x3ca243);}return null;};}function patchUpdates(_0x7a19fb){return function(_0x146d1a){try{jsonpatch[_0x8022('0x2b')](_0x146d1a,_0x7a19fb,!![]);}catch(_0x2e2690){return BPromise[_0x8022('0x2c')](_0x2e2690);}return _0x146d1a[_0x8022('0x2d')]();};}function saveUpdates(_0x4daabc,_0x4191f3){return function(_0x4d80e1){if(_0x4d80e1){return _0x4d80e1[_0x8022('0x2e')](_0x4daabc)[_0x8022('0x2f')](function(_0x5a650d){return _0x5a650d;});}return null;};}function removeEntity(_0x200854,_0x997ea2){return function(_0xa73fab){if(_0xa73fab){return _0xa73fab['destroy']()['then'](function(){_0x200854['status'](0xcc)[_0x8022('0x25')]();});}};}function handleEntityNotFound(_0x47fed9,_0x21bd3d){return function(_0x10a90e){if(!_0x10a90e){_0x47fed9[_0x8022('0x23')](0x194);}return _0x10a90e;};}function handleError(_0x126295,_0x3be437){_0x3be437=_0x3be437||0x1f4;return function(_0x23263d){logger[_0x8022('0x1e')](_0x23263d[_0x8022('0x30')]);if(_0x23263d[_0x8022('0x31')]){delete _0x23263d['name'];}_0x126295[_0x8022('0x24')](_0x3be437)[_0x8022('0x32')](_0x23263d);};}exports[_0x8022('0x33')]=function(_0x2d2979,_0x3e1ea1){var _0x3c21f9={},_0x2014f8={},_0x1c80a2={'count':0x0,'rows':[]};var _0x5b9138=_[_0x8022('0x34')](db['FreshdeskAccount'][_0x8022('0x35')],function(_0x45e985){return{'name':_0x45e985['fieldName'],'type':_0x45e985[_0x8022('0x36')][_0x8022('0x37')]};});_0x2014f8[_0x8022('0x38')]=_['map'](_0x5b9138,_0x8022('0x31'));_0x2014f8[_0x8022('0x39')]=_[_0x8022('0x3a')](_0x2d2979[_0x8022('0x39')]);_0x2014f8[_0x8022('0x3b')]=_['intersection'](_0x2014f8[_0x8022('0x38')],_0x2014f8['query']);_0x3c21f9[_0x8022('0x3c')]=_[_0x8022('0x3d')](_0x2014f8[_0x8022('0x38')],qs[_0x8022('0x3e')](_0x2d2979[_0x8022('0x39')][_0x8022('0x3e')]));_0x3c21f9[_0x8022('0x3c')]=_0x3c21f9[_0x8022('0x3c')][_0x8022('0x3f')]?_0x3c21f9[_0x8022('0x3c')]:_0x2014f8['model'];if(!_0x2d2979['query'][_0x8022('0x40')](_0x8022('0x41'))){_0x3c21f9['limit']=qs[_0x8022('0x29')](_0x2d2979[_0x8022('0x39')][_0x8022('0x29')]);_0x3c21f9[_0x8022('0x28')]=qs[_0x8022('0x28')](_0x2d2979[_0x8022('0x39')]['offset']);}_0x3c21f9[_0x8022('0x42')]=qs[_0x8022('0x43')](_0x2d2979['query'][_0x8022('0x43')]);_0x3c21f9[_0x8022('0x44')]=qs[_0x8022('0x3b')](_[_0x8022('0x45')](_0x2d2979['query'],_0x2014f8[_0x8022('0x3b')]),_0x5b9138);if(_0x2d2979['query'][_0x8022('0x46')]){_0x3c21f9[_0x8022('0x44')]=_[_0x8022('0x47')](_0x3c21f9[_0x8022('0x44')],{'$or':_[_0x8022('0x34')](_0x5b9138,function(_0x2e57f7){if(_0x2e57f7[_0x8022('0x36')]!==_0x8022('0x48')){var _0x1d9220={};_0x1d9220[_0x2e57f7[_0x8022('0x31')]]={'$like':'%'+_0x2d2979[_0x8022('0x39')][_0x8022('0x46')]+'%'};return _0x1d9220;}})});}_0x3c21f9=_['merge']({},_0x3c21f9,_0x2d2979[_0x8022('0x49')]);var _0x450148={'where':_0x3c21f9[_0x8022('0x44')]};return db['FreshdeskAccount']['count'](_0x450148)[_0x8022('0x2f')](function(_0x552e4d){_0x1c80a2[_0x8022('0x27')]=_0x552e4d;if(_0x2d2979['query'][_0x8022('0x4a')]){_0x3c21f9[_0x8022('0x4b')]=[{'all':!![]}];}return db[_0x8022('0x4c')][_0x8022('0x4d')](_0x3c21f9);})[_0x8022('0x2f')](function(_0xd1d75f){_0x1c80a2[_0x8022('0x4e')]=_0xd1d75f;return _0x1c80a2;})[_0x8022('0x2f')](respondWithFilteredResult(_0x3e1ea1,_0x3c21f9))['catch'](handleError(_0x3e1ea1,null));};exports[_0x8022('0x4f')]=function(_0x2ca713,_0x3890e1){var _0x589c47={'raw':![],'where':{'id':_0x2ca713[_0x8022('0x50')]['id']}},_0x594e23={};_0x594e23[_0x8022('0x38')]=_['keys'](db[_0x8022('0x4c')][_0x8022('0x35')]);_0x594e23[_0x8022('0x39')]=_[_0x8022('0x3a')](_0x2ca713[_0x8022('0x39')]);_0x594e23[_0x8022('0x3b')]=_['intersection'](_0x594e23['model'],_0x594e23[_0x8022('0x39')]);_0x589c47[_0x8022('0x3c')]=_[_0x8022('0x3d')](_0x594e23[_0x8022('0x38')],qs[_0x8022('0x3e')](_0x2ca713[_0x8022('0x39')][_0x8022('0x3e')]));_0x589c47[_0x8022('0x3c')]=_0x589c47[_0x8022('0x3c')][_0x8022('0x3f')]?_0x589c47[_0x8022('0x3c')]:_0x594e23[_0x8022('0x38')];if(_0x2ca713[_0x8022('0x39')]['includeAll']){_0x589c47['include']=[{'all':!![]}];}_0x589c47=_['merge']({},_0x589c47,_0x2ca713[_0x8022('0x49')]);return db[_0x8022('0x4c')][_0x8022('0x51')](_0x589c47)['then'](handleEntityNotFound(_0x3890e1,null))[_0x8022('0x2f')](respondWithResult(_0x3890e1,null))[_0x8022('0x22')](handleError(_0x3890e1,null));};exports[_0x8022('0x52')]=function(_0x3cd5a1,_0xfa6ba2){return db[_0x8022('0x4c')][_0x8022('0x52')](_0x3cd5a1[_0x8022('0x53')],{})[_0x8022('0x2f')](respondWithResult(_0xfa6ba2,0xc9))[_0x8022('0x22')](handleError(_0xfa6ba2,null));};exports[_0x8022('0x2e')]=function(_0x12db7a,_0x1d563b){if(_0x12db7a[_0x8022('0x53')]['id']){delete _0x12db7a[_0x8022('0x53')]['id'];}return db[_0x8022('0x4c')][_0x8022('0x51')]({'where':{'id':_0x12db7a[_0x8022('0x50')]['id']}})[_0x8022('0x2f')](handleEntityNotFound(_0x1d563b,null))[_0x8022('0x2f')](saveUpdates(_0x12db7a['body'],null))[_0x8022('0x2f')](respondWithResult(_0x1d563b,null))[_0x8022('0x22')](handleError(_0x1d563b,null));};exports['destroy']=function(_0x17c2e4,_0x1e2da3){return db['FreshdeskAccount'][_0x8022('0x51')]({'where':{'id':_0x17c2e4[_0x8022('0x50')]['id']}})[_0x8022('0x2f')](handleEntityNotFound(_0x1e2da3,null))[_0x8022('0x2f')](removeEntity(_0x1e2da3,null))[_0x8022('0x22')](handleError(_0x1e2da3,null));};exports[_0x8022('0x54')]=function(_0x3dc40b,_0x471667,_0x3e9ffe){var _0x4686f1={};var _0x4babfa={};var _0x43d7c6;var _0x292271;return db[_0x8022('0x4c')]['findOne']({'where':{'id':_0x3dc40b[_0x8022('0x50')]['id']}})[_0x8022('0x2f')](handleEntityNotFound(_0x471667,null))[_0x8022('0x2f')](function(_0xd2277f){if(_0xd2277f){_0x43d7c6=_0xd2277f;_0x4babfa['model']=_[_0x8022('0x3a')](db[_0x8022('0x55')]['rawAttributes']);_0x4babfa[_0x8022('0x39')]=_['keys'](_0x3dc40b[_0x8022('0x39')]);_0x4babfa[_0x8022('0x3b')]=_[_0x8022('0x3d')](_0x4babfa[_0x8022('0x38')],_0x4babfa[_0x8022('0x39')]);_0x4686f1[_0x8022('0x3c')]=_[_0x8022('0x3d')](_0x4babfa[_0x8022('0x38')],qs[_0x8022('0x3e')](_0x3dc40b['query'][_0x8022('0x3e')]));_0x4686f1[_0x8022('0x3c')]=_0x4686f1[_0x8022('0x3c')][_0x8022('0x3f')]?_0x4686f1[_0x8022('0x3c')]:_0x4babfa['model'];_0x4686f1[_0x8022('0x42')]=qs[_0x8022('0x43')](_0x3dc40b[_0x8022('0x39')][_0x8022('0x43')]);_0x4686f1[_0x8022('0x44')]=qs[_0x8022('0x3b')](_[_0x8022('0x45')](_0x3dc40b['query'],_0x4babfa[_0x8022('0x3b')]));if(_0x3dc40b[_0x8022('0x39')][_0x8022('0x46')]){_0x4686f1['where']=_[_0x8022('0x47')](_0x4686f1[_0x8022('0x44')],{'$or':_[_0x8022('0x34')](_0x4686f1[_0x8022('0x3c')],function(_0x2c8143){var _0x3ad3c5={};_0x3ad3c5[_0x2c8143]={'$like':'%'+_0x3dc40b['query'][_0x8022('0x46')]+'%'};return _0x3ad3c5;})});}_0x4686f1=_[_0x8022('0x47')]({},_0x4686f1,_0x3dc40b['options']);return _0x43d7c6['getConfigurations'](_0x4686f1);}})[_0x8022('0x2f')](function(_0x2356c2){if(_0x2356c2){_0x292271=_0x2356c2[_0x8022('0x3f')];if(!_0x3dc40b[_0x8022('0x39')][_0x8022('0x40')]('nolimit')){_0x4686f1[_0x8022('0x29')]=qs[_0x8022('0x29')](_0x3dc40b[_0x8022('0x39')][_0x8022('0x29')]);_0x4686f1[_0x8022('0x28')]=qs[_0x8022('0x28')](_0x3dc40b[_0x8022('0x39')]['offset']);}return _0x43d7c6[_0x8022('0x54')](_0x4686f1);}})[_0x8022('0x2f')](function(_0x540cec){if(_0x540cec){return _0x540cec?{'count':_0x292271,'rows':_0x540cec}:null;}})[_0x8022('0x2f')](respondWithResult(_0x471667,null))[_0x8022('0x22')](handleError(_0x471667,null));};exports[_0x8022('0x56')]=function(_0x30d127,_0x45075d,_0x536fa2){if(_0x30d127['body']['id']){delete _0x30d127[_0x8022('0x53')]['id'];}return db[_0x8022('0x4c')][_0x8022('0x57')]({'where':{'id':_0x30d127[_0x8022('0x50')]['id']}})[_0x8022('0x2f')](handleEntityNotFound(_0x45075d,null))[_0x8022('0x2f')](function(_0x8807a3){if(_0x8807a3){_0x30d127[_0x8022('0x53')][_0x8022('0x58')]=_0x8807a3['id'];_0x30d127[_0x8022('0x53')][_0x8022('0x59')]=integrations[_0x8022('0x5a')](_0x30d127['body'][_0x8022('0x5b')],_0x30d127[_0x8022('0x53')]['type']);_0x30d127[_0x8022('0x53')][_0x8022('0x5c')]=integrations[_0x8022('0x5d')](_0x30d127[_0x8022('0x53')]['channel'],_0x30d127[_0x8022('0x53')]['type']);return db[_0x8022('0x55')][_0x8022('0x52')](_0x30d127['body'],{'include':[{'model':db['FreshdeskField'],'as':_0x8022('0x59')},{'model':db[_0x8022('0x5e')],'as':_0x8022('0x5c')}]});}return null;})['then'](respondWithResult(_0x45075d,null))['catch'](handleError(_0x45075d,null));};exports[_0x8022('0x5f')]=function(_0x2d73ca,_0x3123aa,_0x1a9389){var _0x1b6f4c='';return db[_0x8022('0x4c')][_0x8022('0x57')]({'where':{'id':_0x2d73ca['params']['id']},'attributes':['id',_0x8022('0x60'),_0x8022('0x61')]})['then'](handleEntityNotFound(_0x3123aa,null))[_0x8022('0x2f')](function(_0x1377ca){if(_0x1377ca){_0x1b6f4c=_0x1377ca[_0x8022('0x60')];var _0x59b038=_0x1b6f4c[_0x8022('0x62')](-0x1);if(_0x59b038==='/'){_0x1b6f4c=_0x1b6f4c[_0x8022('0x63')](0x0,_0x1b6f4c['lastIndexOf'](_0x59b038));}return rp({'method':_0x8022('0x64'),'uri':util[_0x8022('0x65')](_0x8022('0x66'),_0x1b6f4c,_0x8022('0x67')),'headers':{'Authorization':util['format'](_0x8022('0x68'),new Buffer(util['format'](_0x8022('0x69'),_0x1377ca['apiKey']))[_0x8022('0x6a')](_0x8022('0x6b')))},'json':!![]});}})[_0x8022('0x2f')](function(_0x524793){if(_0x524793){var _0x3c8fdf=[_0x8022('0x6c'),_0x8022('0x6d'),'agent',_0x8022('0x6e'),_0x8022('0x24'),'priority',_0x8022('0x6f'),'source',_0x8022('0x70'),_0x8022('0x6f'),_0x8022('0x71')];_['remove'](_0x524793,function(_0x378932){return _0x3c8fdf['includes'](_0x378932['name'])||!_0x378932[_0x8022('0x72')]&&_0x378932['type']!==_0x8022('0x73')&&_0x378932[_0x8022('0x36')]!==_0x8022('0x74');});return{'count':_0x524793[_0x8022('0x3f')],'rows':_[_0x8022('0x34')](_0x524793,function(_0x3288e1){return{'id':_0x3288e1['name'],'name':_0x3288e1[_0x8022('0x75')],'custom':!_0x3288e1[_0x8022('0x72')],'options':_0x3288e1['choices']?_[_0x8022('0x34')](_0x3288e1['choices'],function(_0xf7fd73){return{'name':_[_0x8022('0x76')](_0xf7fd73),'value':_0xf7fd73};}):[]};})};}})[_0x8022('0x2f')](respondWithResult(_0x3123aa,null))['catch'](function(_0x44ea58){var _0x11d0cd=_0x2d73ca[_0x8022('0x39')]['test']?0x1f4:_0x44ea58['statusCode']||0x1f4;logger[_0x8022('0x1e')]('getFields,\x20%s,\x20%s,\x20%s',_0x8022('0x5f'),_0x11d0cd,JSON[_0x8022('0x1d')](_0x44ea58));delete _0x44ea58[_0x8022('0x31')];if(_0x11d0cd===0x191){_0x11d0cd=0x190;}_0x3123aa[_0x8022('0x24')](_0x11d0cd)[_0x8022('0x32')](_0x2d73ca[_0x8022('0x39')][_0x8022('0x77')]?{'message':_0x8022('0x78'),'statusCode':_0x44ea58[_0x8022('0x79')]}:_0x44ea58);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index caa0cd0..1fab2d1 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 _0x3c5c=['int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x4cfd9c,_0x2a7e22){var _0x17dd6a=function(_0x99993){while(--_0x99993){_0x4cfd9c['push'](_0x4cfd9c['shift']());}};_0x17dd6a(++_0x2a7e22);}(_0x3c5c,0x16d));var _0xc3c5=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x3c5c[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xc3c5('0x0'));var util=require(_0xc3c5('0x1'));var logger=require(_0xc3c5('0x2'))(_0xc3c5('0x3'));var moment=require(_0xc3c5('0x4'));var BPromise=require(_0xc3c5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc3c5('0x6'));var rimraf=require(_0xc3c5('0x7'));var config=require(_0xc3c5('0x8'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xc3c5('0x9'));module[_0xc3c5('0xa')]=function(_0x1c813a,_0xc73dac){return _0x1c813a[_0xc3c5('0xb')]('FreshdeskAccount',attributes,{'tableName':_0xc3c5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa30b=['./intFreshdeskAccount.attributes','../../components/integrations/configuration','FreshdeskAccount','int_freshdesk_accounts','lodash','util','api','moment','request-promise','path','../../config/environment'];(function(_0x5117b2,_0xcd3ef3){var _0x5ba389=function(_0x5207f2){while(--_0x5207f2){_0x5117b2['push'](_0x5117b2['shift']());}};_0x5ba389(++_0xcd3ef3);}(_0xa30b,0x1f3));var _0xba30=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa30b[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xba30('0x0'));var util=require(_0xba30('0x1'));var logger=require('../../config/logger')(_0xba30('0x2'));var moment=require(_0xba30('0x3'));var BPromise=require('bluebird');var rp=require(_0xba30('0x4'));var fs=require('fs');var path=require(_0xba30('0x5'));var rimraf=require('rimraf');var config=require(_0xba30('0x6'));var attributes=require(_0xba30('0x7'));var integrations=require(_0xba30('0x8'));module['exports']=function(_0x22f5f5,_0x7674d2){return _0x22f5f5['define'](_0xba30('0x9'),attributes,{'tableName':_0xba30('0xa'),'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 7914739..89672e8 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 _0xe6b3=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','catch','util'];(function(_0x549868,_0x44415e){var _0x2b02a0=function(_0x110773){while(--_0x110773){_0x549868['push'](_0x549868['shift']());}};_0x2b02a0(++_0x44415e);}(_0xe6b3,0x8b));var _0x3e6b=function(_0x380f4b,_0x333e50){_0x380f4b=_0x380f4b-0x0;var _0x1135e6=_0xe6b3[_0x380f4b];return _0x1135e6;};'use strict';var _=require('lodash');var util=require(_0x3e6b('0x0'));var moment=require(_0x3e6b('0x1'));var BPromise=require(_0x3e6b('0x2'));var rs=require(_0x3e6b('0x3'));var fs=require('fs');var Redis=require(_0x3e6b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3e6b('0x5'));var logger=require(_0x3e6b('0x6'))(_0x3e6b('0x7'));var config=require('../../config/environment');var jayson=require(_0x3e6b('0x8'));var client=jayson[_0x3e6b('0x9')][_0x3e6b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34d7c2,_0x53fd2a,_0x373ed9){return new BPromise(function(_0x3de586,_0x28cc06){return client['request'](_0x34d7c2,_0x373ed9)[_0x3e6b('0xb')](function(_0xd49eb){logger[_0x3e6b('0xc')](_0x3e6b('0xd'),_0x53fd2a,_0x3e6b('0xe'));logger[_0x3e6b('0xf')](_0x3e6b('0x10'),_0x53fd2a,_0x3e6b('0xe'),JSON[_0x3e6b('0x11')](_0xd49eb));if(_0xd49eb[_0x3e6b('0x12')]){if(_0xd49eb[_0x3e6b('0x12')][_0x3e6b('0x13')]===0x1f4){logger[_0x3e6b('0x12')](_0x3e6b('0xd'),_0x53fd2a,_0xd49eb['error'][_0x3e6b('0x14')]);return _0x28cc06(_0xd49eb[_0x3e6b('0x12')]['message']);}logger[_0x3e6b('0x12')](_0x3e6b('0xd'),_0x53fd2a,_0xd49eb['error'][_0x3e6b('0x14')]);return _0x3de586(_0xd49eb['error'][_0x3e6b('0x14')]);}else{logger[_0x3e6b('0xc')](_0x3e6b('0xd'),_0x53fd2a,_0x3e6b('0xe'));_0x3de586(_0xd49eb[_0x3e6b('0x15')][_0x3e6b('0x14')]);}})['catch'](function(_0x5be373){logger[_0x3e6b('0x12')](_0x3e6b('0xd'),_0x53fd2a,_0x5be373);_0x28cc06(_0x5be373);});});}exports[_0x3e6b('0x16')]=function(_0x2f1f91){var _0xdff21c=this;return new Promise(function(_0x24c422,_0x40b22e){return db[_0x3e6b('0x17')][_0x3e6b('0x18')]({'raw':_0x2f1f91[_0x3e6b('0x19')]?_0x2f1f91[_0x3e6b('0x19')][_0x3e6b('0x1a')]===undefined?!![]:![]:!![],'where':_0x2f1f91[_0x3e6b('0x19')]?_0x2f1f91[_0x3e6b('0x19')][_0x3e6b('0x1b')]||null:null,'attributes':_0x2f1f91['options']?_0x2f1f91[_0x3e6b('0x19')][_0x3e6b('0x1c')]||null:null,'limit':_0x2f1f91[_0x3e6b('0x19')]?_0x2f1f91[_0x3e6b('0x19')][_0x3e6b('0x1d')]||null:null,'include':_0x2f1f91['options']?_0x2f1f91[_0x3e6b('0x19')][_0x3e6b('0x1e')]?_[_0x3e6b('0x1f')](_0x2f1f91['options']['include'],function(_0x378c30){return{'model':db[_0x378c30[_0x3e6b('0x20')]],'as':_0x378c30['as'],'attributes':_0x378c30[_0x3e6b('0x1c')],'include':_0x378c30[_0x3e6b('0x1e')]?_[_0x3e6b('0x1f')](_0x378c30['include'],function(_0xbfe7d3){return{'model':db[_0xbfe7d3[_0x3e6b('0x20')]],'as':_0xbfe7d3['as'],'attributes':_0xbfe7d3[_0x3e6b('0x1c')],'include':_0xbfe7d3[_0x3e6b('0x1e')]?_[_0x3e6b('0x1f')](_0xbfe7d3[_0x3e6b('0x1e')],function(_0x5079fa){return{'model':db[_0x5079fa[_0x3e6b('0x20')]],'as':_0x5079fa['as'],'attributes':_0x5079fa[_0x3e6b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3e6b('0xb')](function(_0x493570){logger['info'](_0x3e6b('0x16'),_0x2f1f91);logger['debug'](_0x3e6b('0x16'),_0x2f1f91,JSON[_0x3e6b('0x11')](_0x493570));_0x24c422(_0x493570);})['catch'](function(_0x4ae9e4){logger['error']('GetFreshdeskAccount',_0x4ae9e4[_0x3e6b('0x14')],_0x2f1f91);_0x40b22e(_0xdff21c[_0x3e6b('0x12')](0x1f4,_0x4ae9e4[_0x3e6b('0x14')]));});});};exports['ShowFreshdeskAccount']=function(_0x567066){var _0x1ed7b7=this;return new Promise(function(_0x41f7fa,_0x2aa1a9){return db[_0x3e6b('0x17')]['find']({'raw':_0x567066['options']?_0x567066[_0x3e6b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x567066[_0x3e6b('0x19')]?_0x567066[_0x3e6b('0x19')][_0x3e6b('0x1b')]||null:null,'attributes':_0x567066[_0x3e6b('0x19')]?_0x567066[_0x3e6b('0x19')][_0x3e6b('0x1c')]||null:null,'include':_0x567066['options']?_0x567066[_0x3e6b('0x19')][_0x3e6b('0x1e')]?_['map'](_0x567066[_0x3e6b('0x19')][_0x3e6b('0x1e')],function(_0x313f5f){return{'model':db[_0x313f5f[_0x3e6b('0x20')]],'as':_0x313f5f['as'],'attributes':_0x313f5f['attributes'],'include':_0x313f5f['include']?_['map'](_0x313f5f[_0x3e6b('0x1e')],function(_0x29ad03){return{'model':db[_0x29ad03['model']],'as':_0x29ad03['as'],'attributes':_0x29ad03['attributes'],'include':_0x29ad03[_0x3e6b('0x1e')]?_[_0x3e6b('0x1f')](_0x29ad03['include'],function(_0x24ebe6){return{'model':db[_0x24ebe6[_0x3e6b('0x20')]],'as':_0x24ebe6['as'],'attributes':_0x24ebe6[_0x3e6b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3e6b('0xb')](function(_0x1b90f3){logger['info'](_0x3e6b('0x21'),_0x567066);logger['debug'](_0x3e6b('0x21'),_0x567066,JSON['stringify'](_0x1b90f3));_0x41f7fa(_0x1b90f3);})[_0x3e6b('0x22')](function(_0x3fadce){logger[_0x3e6b('0x12')](_0x3e6b('0x21'),_0x3fadce[_0x3e6b('0x14')],_0x567066);_0x2aa1a9(_0x1ed7b7[_0x3e6b('0x12')](0x1f4,_0x3fadce[_0x3e6b('0x14')]));});});}; \ No newline at end of file +var _0x3412=['message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','attributes','limit','map','include','model','stringify','ShowFreshdeskAccount','find','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x26eddb,_0x9ab664){var _0x5cd9f5=function(_0x2f6693){while(--_0x2f6693){_0x26eddb['push'](_0x26eddb['shift']());}};_0x5cd9f5(++_0x9ab664);}(_0x3412,0xe3));var _0x2341=function(_0x13cd99,_0x50bd8d){_0x13cd99=_0x13cd99-0x0;var _0x1d42c7=_0x3412[_0x13cd99];return _0x1d42c7;};'use strict';var _=require('lodash');var util=require(_0x2341('0x0'));var moment=require('moment');var BPromise=require(_0x2341('0x1'));var rs=require(_0x2341('0x2'));var fs=require('fs');var Redis=require(_0x2341('0x3'));var db=require(_0x2341('0x4'))['db'];var utils=require(_0x2341('0x5'));var logger=require(_0x2341('0x6'))(_0x2341('0x7'));var config=require(_0x2341('0x8'));var jayson=require(_0x2341('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd8ee63,_0x4fb293,_0x4f1604){return new BPromise(function(_0x45047a,_0xd0bada){return client['request'](_0xd8ee63,_0x4f1604)[_0x2341('0xa')](function(_0x1d3026){logger[_0x2341('0xb')](_0x2341('0xc'),_0x4fb293,_0x2341('0xd'));logger[_0x2341('0xe')](_0x2341('0xf'),_0x4fb293,'request\x20sent',JSON['stringify'](_0x1d3026));if(_0x1d3026[_0x2341('0x10')]){if(_0x1d3026[_0x2341('0x10')][_0x2341('0x11')]===0x1f4){logger[_0x2341('0x10')](_0x2341('0xc'),_0x4fb293,_0x1d3026[_0x2341('0x10')]['message']);return _0xd0bada(_0x1d3026[_0x2341('0x10')][_0x2341('0x12')]);}logger[_0x2341('0x10')](_0x2341('0xc'),_0x4fb293,_0x1d3026['error'][_0x2341('0x12')]);return _0x45047a(_0x1d3026[_0x2341('0x10')]['message']);}else{logger[_0x2341('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x4fb293,'request\x20sent');_0x45047a(_0x1d3026[_0x2341('0x13')][_0x2341('0x12')]);}})[_0x2341('0x14')](function(_0x2cb0fc){logger[_0x2341('0x10')](_0x2341('0xc'),_0x4fb293,_0x2cb0fc);_0xd0bada(_0x2cb0fc);});});}exports[_0x2341('0x15')]=function(_0x33146b){var _0xdc11a4=this;return new Promise(function(_0x2924ed,_0x3edad5){return db[_0x2341('0x16')][_0x2341('0x17')]({'raw':_0x33146b[_0x2341('0x18')]?_0x33146b[_0x2341('0x18')][_0x2341('0x19')]===undefined?!![]:![]:!![],'where':_0x33146b['options']?_0x33146b['options']['where']||null:null,'attributes':_0x33146b['options']?_0x33146b[_0x2341('0x18')][_0x2341('0x1a')]||null:null,'limit':_0x33146b[_0x2341('0x18')]?_0x33146b[_0x2341('0x18')][_0x2341('0x1b')]||null:null,'include':_0x33146b[_0x2341('0x18')]?_0x33146b[_0x2341('0x18')]['include']?_[_0x2341('0x1c')](_0x33146b[_0x2341('0x18')][_0x2341('0x1d')],function(_0x2a47b0){return{'model':db[_0x2a47b0[_0x2341('0x1e')]],'as':_0x2a47b0['as'],'attributes':_0x2a47b0[_0x2341('0x1a')],'include':_0x2a47b0[_0x2341('0x1d')]?_[_0x2341('0x1c')](_0x2a47b0[_0x2341('0x1d')],function(_0x1e9499){return{'model':db[_0x1e9499[_0x2341('0x1e')]],'as':_0x1e9499['as'],'attributes':_0x1e9499[_0x2341('0x1a')],'include':_0x1e9499['include']?_[_0x2341('0x1c')](_0x1e9499['include'],function(_0x59b5b3){return{'model':db[_0x59b5b3[_0x2341('0x1e')]],'as':_0x59b5b3['as'],'attributes':_0x59b5b3[_0x2341('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2341('0xa')](function(_0x5a5bec){logger[_0x2341('0xb')](_0x2341('0x15'),_0x33146b);logger[_0x2341('0xe')](_0x2341('0x15'),_0x33146b,JSON[_0x2341('0x1f')](_0x5a5bec));_0x2924ed(_0x5a5bec);})[_0x2341('0x14')](function(_0x4f8310){logger['error'](_0x2341('0x15'),_0x4f8310[_0x2341('0x12')],_0x33146b);_0x3edad5(_0xdc11a4[_0x2341('0x10')](0x1f4,_0x4f8310[_0x2341('0x12')]));});});};exports[_0x2341('0x20')]=function(_0xf10ee7){var _0x248a8a=this;return new Promise(function(_0x1041fb,_0x553dc1){return db['FreshdeskAccount'][_0x2341('0x21')]({'raw':_0xf10ee7['options']?_0xf10ee7[_0x2341('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xf10ee7[_0x2341('0x18')]?_0xf10ee7[_0x2341('0x18')][_0x2341('0x22')]||null:null,'attributes':_0xf10ee7[_0x2341('0x18')]?_0xf10ee7[_0x2341('0x18')]['attributes']||null:null,'include':_0xf10ee7[_0x2341('0x18')]?_0xf10ee7[_0x2341('0x18')]['include']?_[_0x2341('0x1c')](_0xf10ee7['options'][_0x2341('0x1d')],function(_0x4f4c77){return{'model':db[_0x4f4c77['model']],'as':_0x4f4c77['as'],'attributes':_0x4f4c77[_0x2341('0x1a')],'include':_0x4f4c77[_0x2341('0x1d')]?_[_0x2341('0x1c')](_0x4f4c77[_0x2341('0x1d')],function(_0x29484f){return{'model':db[_0x29484f['model']],'as':_0x29484f['as'],'attributes':_0x29484f[_0x2341('0x1a')],'include':_0x29484f[_0x2341('0x1d')]?_['map'](_0x29484f[_0x2341('0x1d')],function(_0x69591c){return{'model':db[_0x69591c[_0x2341('0x1e')]],'as':_0x69591c['as'],'attributes':_0x69591c['attributes']};}):[]};}):[]};}):[]:[]})[_0x2341('0xa')](function(_0x2e4b60){logger[_0x2341('0xb')](_0x2341('0x20'),_0xf10ee7);logger[_0x2341('0xe')](_0x2341('0x20'),_0xf10ee7,JSON[_0x2341('0x1f')](_0x2e4b60));_0x1041fb(_0x2e4b60);})[_0x2341('0x14')](function(_0x143b8d){logger[_0x2341('0x10')]('ShowFreshdeskAccount',_0x143b8d[_0x2341('0x12')],_0xf10ee7);_0x553dc1(_0x248a8a[_0x2341('0x10')](0x1f4,_0x143b8d[_0x2341('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index a14dc0e..38672ce 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 _0x9276=['isAuthenticated','/:id','show','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','post','create','setTags','update','destroy','exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get'];(function(_0x6339b,_0x332b11){var _0x28e2a3=function(_0x188ffc){while(--_0x188ffc){_0x6339b['push'](_0x6339b['shift']());}};_0x28e2a3(++_0x332b11);}(_0x9276,0x11f));var _0x6927=function(_0x2a2626,_0x4fead9){_0x2a2626=_0x2a2626-0x0;var _0x3d664d=_0x9276[_0x2a2626];return _0x3d664d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6927('0x0'));var timeout=require(_0x6927('0x1'));var express=require('express');var router=express[_0x6927('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6927('0x3'));var config=require(_0x6927('0x4'));var controller=require(_0x6927('0x5'));router[_0x6927('0x6')]('/',auth[_0x6927('0x7')](),controller['index']);router[_0x6927('0x6')](_0x6927('0x8'),auth[_0x6927('0x7')](),controller[_0x6927('0x9')]);router[_0x6927('0x6')]('/:id/fields',auth[_0x6927('0x7')](),controller[_0x6927('0xa')]);router[_0x6927('0x6')](_0x6927('0xb'),auth[_0x6927('0x7')](),controller[_0x6927('0xc')]);router[_0x6927('0x6')]('/:id/descriptions',auth[_0x6927('0x7')](),controller['getDescriptions']);router[_0x6927('0x6')](_0x6927('0xd'),auth[_0x6927('0x7')](),controller[_0x6927('0xe')]);router[_0x6927('0xf')]('/',auth[_0x6927('0x7')](),controller[_0x6927('0x10')]);router[_0x6927('0xf')]('/:id/tags',auth[_0x6927('0x7')](),controller[_0x6927('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6927('0x12')]);router['delete']('/:id',auth[_0x6927('0x7')](),controller[_0x6927('0x13')]);module[_0x6927('0x14')]=router; \ No newline at end of file +var _0x11e9=['getTags','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','./intFreshdeskConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags'];(function(_0x279b00,_0x30721e){var _0x1fc445=function(_0x1c7f31){while(--_0x1c7f31){_0x279b00['push'](_0x279b00['shift']());}};_0x1fc445(++_0x30721e);}(_0x11e9,0x132));var _0x911e=function(_0x2b1093,_0x46b325){_0x2b1093=_0x2b1093-0x0;var _0x582d99=_0x11e9[_0x2b1093];return _0x582d99;};'use strict';var multer=require(_0x911e('0x0'));var util=require(_0x911e('0x1'));var path=require(_0x911e('0x2'));var timeout=require('connect-timeout');var express=require(_0x911e('0x3'));var router=express[_0x911e('0x4')]();var fs_extra=require(_0x911e('0x5'));var auth=require(_0x911e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x911e('0x7'));router['get']('/',auth[_0x911e('0x8')](),controller['index']);router[_0x911e('0x9')](_0x911e('0xa'),auth[_0x911e('0x8')](),controller[_0x911e('0xb')]);router[_0x911e('0x9')](_0x911e('0xc'),auth['isAuthenticated'](),controller[_0x911e('0xd')]);router['get'](_0x911e('0xe'),auth['isAuthenticated'](),controller[_0x911e('0xf')]);router['get'](_0x911e('0x10'),auth[_0x911e('0x8')](),controller[_0x911e('0x11')]);router[_0x911e('0x9')](_0x911e('0x12'),auth[_0x911e('0x8')](),controller[_0x911e('0x13')]);router['post']('/',auth[_0x911e('0x8')](),controller[_0x911e('0x14')]);router['post'](_0x911e('0x12'),auth['isAuthenticated'](),controller['setTags']);router[_0x911e('0x15')](_0x911e('0xa'),auth[_0x911e('0x8')](),controller[_0x911e('0x16')]);router[_0x911e('0x17')]('/:id',auth[_0x911e('0x8')](),controller[_0x911e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 3e0dd1b..307d943 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 _0xbd56=['sequelize','exports','STRING'];(function(_0xf79a37,_0x33b9cf){var _0x2ce1ca=function(_0x1780a0){while(--_0x1780a0){_0xf79a37['push'](_0xf79a37['shift']());}};_0x2ce1ca(++_0x33b9cf);}(_0xbd56,0x1a4));var _0x6bd5=function(_0x3c15f1,_0x3922a9){_0x3c15f1=_0x3c15f1-0x0;var _0x458992=_0xbd56[_0x3c15f1];return _0x458992;};'use strict';var Sequelize=require(_0x6bd5('0x0'));module[_0x6bd5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6bd5('0x2')]}}; \ No newline at end of file +var _0x5448=['STRING','sequelize'];(function(_0xee7ead,_0x5ccfb9){var _0x4d9c47=function(_0x1252eb){while(--_0x1252eb){_0xee7ead['push'](_0xee7ead['shift']());}};_0x4d9c47(++_0x5ccfb9);}(_0x5448,0xf1));var _0x8544=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x5448[_0x186376];return _0x2dbdd9;};'use strict';var Sequelize=require(_0x8544('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8544('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 7601946..94f8ab0 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 _0xa9e0=['filter','merge','options','FreshdeskConfiguration','count','includeAll','include','findAll','rows','params','intersection','find','body','findOne','FreshdeskField','order','getFields','getSubjects','getDescriptions','Tag','getTags','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','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x2f85c8,_0x3da88f){var _0x5845e7=function(_0x62b568){while(--_0x62b568){_0x2f85c8['push'](_0x2f85c8['shift']());}};_0x5845e7(++_0x3da88f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['FreshdeskConfiguration'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x50')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x48')]['create'](_0x39d77d[_0x0a9e('0x51')],{})[_0x0a9e('0x2f')](respondWithResult(_0x204173,0xc9))['catch'](handleError(_0x204173,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x51')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x48')][_0x0a9e('0x50')]({'where':{'id':_0x2ef381[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x2f')](saveUpdates(_0x2ef381[_0x0a9e('0x51')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x30')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x2f')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['getFields']=function(_0x5df0ad,_0x2da03c,_0x47de4c){var _0x2f7092={};var _0x65432={};var _0x3cfd00;var _0x19b4df;return db[_0x0a9e('0x48')][_0x0a9e('0x52')]({'where':{'id':_0x5df0ad[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2da03c,null))['then'](function(_0x1c693e){if(_0x1c693e){_0x3cfd00=_0x1c693e;_0x65432[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x65432[_0x0a9e('0x39')]=_['keys'](_0x5df0ad[_0x0a9e('0x39')]);_0x65432[_0x0a9e('0x3b')]=_['intersection'](_0x65432[_0x0a9e('0x3c')],_0x65432['query']);_0x2f7092[_0x0a9e('0x3d')]=_['intersection'](_0x65432['model'],qs['fields'](_0x5df0ad[_0x0a9e('0x39')]['fields']));_0x2f7092[_0x0a9e('0x3d')]=_0x2f7092[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x2f7092[_0x0a9e('0x3d')]:_0x65432[_0x0a9e('0x3c')];_0x2f7092[_0x0a9e('0x54')]=qs['sort'](_0x5df0ad[_0x0a9e('0x39')]['sort']);_0x2f7092[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5df0ad['query'],_0x65432[_0x0a9e('0x3b')]));if(_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x2f7092[_0x0a9e('0x43')]=_['merge'](_0x2f7092[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2f7092['attributes'],function(_0x797b45){var _0x17e88c={};_0x17e88c[_0x797b45]={'$like':'%'+_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x17e88c;})});}_0x2f7092=_[_0x0a9e('0x46')]({},_0x2f7092,_0x5df0ad['options']);return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x281c7d){if(_0x281c7d){_0x19b4df=_0x281c7d['length'];if(!_0x5df0ad[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x2f7092[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x2f7092[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x27')]);}return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x2e89b7){if(_0x2e89b7){return _0x2e89b7?{'count':_0x19b4df,'rows':_0x2e89b7}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x22')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x56')]=function(_0x320898,_0x412a72,_0x2a28c0){var _0x4257c9={};var _0x5150a4={};var _0x1b0b98;var _0x295763;return db[_0x0a9e('0x48')]['findOne']({'where':{'id':_0x320898[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x412a72,null))['then'](function(_0x83f0b2){if(_0x83f0b2){_0x1b0b98=_0x83f0b2;_0x5150a4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x5150a4['query']=_['keys'](_0x320898['query']);_0x5150a4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],_0x5150a4[_0x0a9e('0x39')]);_0x4257c9[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x320898['query'][_0x0a9e('0x3e')]));_0x4257c9[_0x0a9e('0x3d')]=_0x4257c9[_0x0a9e('0x3d')]['length']?_0x4257c9[_0x0a9e('0x3d')]:_0x5150a4['model'];_0x4257c9[_0x0a9e('0x54')]=qs[_0x0a9e('0x42')](_0x320898['query'][_0x0a9e('0x42')]);_0x4257c9[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x320898['query'],_0x5150a4[_0x0a9e('0x3b')]));if(_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x4257c9[_0x0a9e('0x43')]=_['merge'](_0x4257c9[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x4257c9[_0x0a9e('0x3d')],function(_0x361b21){var _0x4abc8f={};_0x4abc8f[_0x361b21]={'$like':'%'+_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x4abc8f;})});}_0x4257c9=_[_0x0a9e('0x46')]({},_0x4257c9,_0x320898[_0x0a9e('0x47')]);return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x40fc56){if(_0x40fc56){_0x295763=_0x40fc56[_0x0a9e('0x3f')];if(!_0x320898[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x4257c9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x320898[_0x0a9e('0x39')]['limit']);_0x4257c9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x320898[_0x0a9e('0x39')]['offset']);}return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x8cea96){if(_0x8cea96){return _0x8cea96?{'count':_0x295763,'rows':_0x8cea96}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x412a72,null))['catch'](handleError(_0x412a72,null));};exports['getDescriptions']=function(_0x7ebea8,_0x2bbdb5,_0x4c54fa){var _0x45108c={};var _0x53a6a1={};var _0x260f4b;var _0x8ebf02;return db['FreshdeskConfiguration'][_0x0a9e('0x52')]({'where':{'id':_0x7ebea8[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x2f')](function(_0x3755fe){if(_0x3755fe){_0x260f4b=_0x3755fe;_0x53a6a1[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db['FreshdeskField'][_0x0a9e('0x36')]);_0x53a6a1[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x7ebea8[_0x0a9e('0x39')]);_0x53a6a1['filters']=_[_0x0a9e('0x4f')](_0x53a6a1[_0x0a9e('0x3c')],_0x53a6a1['query']);_0x45108c[_0x0a9e('0x3d')]=_['intersection'](_0x53a6a1[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x3e')]));_0x45108c['attributes']=_0x45108c['attributes'][_0x0a9e('0x3f')]?_0x45108c[_0x0a9e('0x3d')]:_0x53a6a1[_0x0a9e('0x3c')];_0x45108c['order']=qs[_0x0a9e('0x42')](_0x7ebea8[_0x0a9e('0x39')]['sort']);_0x45108c['where']=qs[_0x0a9e('0x3b')](_['pick'](_0x7ebea8['query'],_0x53a6a1['filters']));if(_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x45108c[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x45108c[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x45108c['attributes'],function(_0x5fd5db){var _0x5955f1={};_0x5955f1[_0x5fd5db]={'$like':'%'+_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x5955f1;})});}_0x45108c=_[_0x0a9e('0x46')]({},_0x45108c,_0x7ebea8[_0x0a9e('0x47')]);return _0x260f4b['getDescriptions'](_0x45108c);}})[_0x0a9e('0x2f')](function(_0x32f761){if(_0x32f761){_0x8ebf02=_0x32f761[_0x0a9e('0x3f')];if(!_0x7ebea8['query'][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x45108c[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x45108c[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x7ebea8['query'][_0x0a9e('0x27')]);}return _0x260f4b[_0x0a9e('0x57')](_0x45108c);}})['then'](function(_0x40e0f0){if(_0x40e0f0){return _0x40e0f0?{'count':_0x8ebf02,'rows':_0x40e0f0}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2bbdb5,null))[_0x0a9e('0x22')](handleError(_0x2bbdb5,null));};exports['getTags']=function(_0x96672f,_0x52ec10,_0x8c8fbe){var _0x2b5148={};var _0x558a87={};var _0x1f29bd;var _0x842d6f;return db[_0x0a9e('0x48')][_0x0a9e('0x52')]({'where':{'id':_0x96672f[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x52ec10,null))[_0x0a9e('0x2f')](function(_0x31d25a){if(_0x31d25a){_0x1f29bd=_0x31d25a;_0x558a87[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x58')][_0x0a9e('0x36')]);_0x558a87[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x96672f[_0x0a9e('0x39')]);_0x558a87[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x558a87[_0x0a9e('0x3c')],_0x558a87[_0x0a9e('0x39')]);_0x2b5148['attributes']=_[_0x0a9e('0x4f')](_0x558a87[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x96672f[_0x0a9e('0x39')][_0x0a9e('0x3e')]));_0x2b5148['attributes']=_0x2b5148[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x2b5148['attributes']:_0x558a87[_0x0a9e('0x3c')];_0x2b5148['order']=qs[_0x0a9e('0x42')](_0x96672f[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x2b5148[_0x0a9e('0x43')]=qs['filters'](_[_0x0a9e('0x44')](_0x96672f['query'],_0x558a87[_0x0a9e('0x3b')]));if(_0x96672f[_0x0a9e('0x39')]['filter']){_0x2b5148[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x2b5148[_0x0a9e('0x43')],{'$or':_['map'](_0x2b5148['attributes'],function(_0x1b82b7){var _0x6ba2be={};_0x6ba2be[_0x1b82b7]={'$like':'%'+_0x96672f[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x6ba2be;})});}_0x2b5148=_[_0x0a9e('0x46')]({},_0x2b5148,_0x96672f[_0x0a9e('0x47')]);return _0x1f29bd[_0x0a9e('0x59')](_0x2b5148);}})[_0x0a9e('0x2f')](function(_0x3f8124){if(_0x3f8124){_0x842d6f=_0x3f8124['length'];if(!_0x96672f[_0x0a9e('0x39')]['hasOwnProperty'](_0x0a9e('0x41'))){_0x2b5148[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x96672f[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x2b5148['offset']=qs[_0x0a9e('0x27')](_0x96672f[_0x0a9e('0x39')][_0x0a9e('0x27')]);}return _0x1f29bd[_0x0a9e('0x59')](_0x2b5148);}})[_0x0a9e('0x2f')](function(_0x5c66ef){if(_0x5c66ef){return _0x5c66ef?{'count':_0x842d6f,'rows':_0x5c66ef}:null;}})['then'](respondWithResult(_0x52ec10,null))[_0x0a9e('0x22')](handleError(_0x52ec10,null));};exports['setTags']=function(_0x25eae0,_0x4658df,_0x4672e1){if(_0x25eae0[_0x0a9e('0x51')]['id']){delete _0x25eae0[_0x0a9e('0x51')]['id'];}return db[_0x0a9e('0x48')]['findOne']({'where':{'id':_0x25eae0['params']['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x4658df,null))['then'](function(_0x2469d1){if(_0x2469d1){return _0x2469d1['setTags'](_0x25eae0[_0x0a9e('0x51')]['ids']||[]);}return null;})['then'](respondWithResult(_0x4658df,null))[_0x0a9e('0x22')](handleError(_0x4658df,null));}; \ No newline at end of file +var _0xe706=['info','request\x20sent','result','end','status','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3d58e0,_0x16e05d){var _0x444645=function(_0x23aedd){while(--_0x23aedd){_0x3d58e0['push'](_0x3d58e0['shift']());}};_0x444645(++_0x16e05d);}(_0xe706,0xa3));var _0x6e70=function(_0x10b4f4,_0x4f1ca0){_0x10b4f4=_0x10b4f4-0x0;var _0x187294=_0xe706[_0x10b4f4];return _0x187294;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];var jayson=require(_0x6e70('0x1d'));var client=jayson[_0x6e70('0x1e')][_0x6e70('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0xa1eb74,_0x181005,_0x5dfbaa,_0x52737e){return new BPromise(function(_0x48bc72,_0x257e81){var _0x5a37a6=_0x52737e||client;return _0x5a37a6['request'](_0xa1eb74,_0x5dfbaa)[_0x6e70('0x20')](function(_0x22c50c){logger['info'](_0x6e70('0x21'),_0x181005,'request\x20sent');logger[_0x6e70('0x22')](_0x6e70('0x23'),_0x181005,'request\x20sent',JSON['stringify'](_0x22c50c));if(_0x22c50c[_0x6e70('0x24')]){if(_0x22c50c['error'][_0x6e70('0x25')]===0x1f4){logger[_0x6e70('0x24')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x181005,_0x22c50c['error'][_0x6e70('0x26')]);return _0x257e81(_0x22c50c[_0x6e70('0x24')][_0x6e70('0x26')]);}logger[_0x6e70('0x24')](_0x6e70('0x21'),_0x181005,_0x22c50c[_0x6e70('0x24')][_0x6e70('0x26')]);return _0x48bc72(_0x22c50c[_0x6e70('0x24')][_0x6e70('0x26')]);}else{logger[_0x6e70('0x27')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x181005,_0x6e70('0x28'));_0x48bc72(_0x22c50c[_0x6e70('0x29')][_0x6e70('0x26')]);}})['catch'](function(_0x3ccd87){logger[_0x6e70('0x24')](_0x6e70('0x21'),_0x181005,_0x3ccd87);_0x257e81(_0x3ccd87);});});}function respondWithStatusCode(_0x50da2c,_0x10fc91){_0x10fc91=_0x10fc91||0xcc;return function(_0x538b9c){if(_0x538b9c){return _0x50da2c['sendStatus'](_0x10fc91);}return _0x50da2c['status'](_0x10fc91)[_0x6e70('0x2a')]();};}function respondWithResult(_0x19c5ae,_0x51d292){_0x51d292=_0x51d292||0xc8;return function(_0x3ecdf1){if(_0x3ecdf1){return _0x19c5ae[_0x6e70('0x2b')](_0x51d292)['json'](_0x3ecdf1);}};}function respondWithFilteredResult(_0x338ad6,_0x67fb43){return function(_0x2bb231){if(_0x2bb231){var _0x4a67ac=_0x2bb231[_0x6e70('0x2c')],_0x54a5fe=_0x67fb43[_0x6e70('0x2d')],_0x2c4d37=_0x67fb43[_0x6e70('0x2d')]+_0x67fb43['limit'],_0x3af17f;if(_0x2c4d37>=_0x4a67ac){_0x2c4d37=_0x4a67ac;_0x3af17f=0xc8;}else{_0x3af17f=0xce;}_0x338ad6[_0x6e70('0x2b')](_0x3af17f);return _0x338ad6[_0x6e70('0x2e')](_0x6e70('0x2f'),_0x54a5fe+'-'+_0x2c4d37+'/'+_0x4a67ac)[_0x6e70('0x30')](_0x2bb231);}return null;};}function patchUpdates(_0x396a67){return function(_0x20a225){try{jsonpatch[_0x6e70('0x31')](_0x20a225,_0x396a67,!![]);}catch(_0x24114a){return BPromise[_0x6e70('0x32')](_0x24114a);}return _0x20a225[_0x6e70('0x33')]();};}function saveUpdates(_0x4b1229,_0x1b27d8){return function(_0x50d60b){if(_0x50d60b){return _0x50d60b[_0x6e70('0x34')](_0x4b1229)['then'](function(_0xdd7cc1){return _0xdd7cc1;});}return null;};}function removeEntity(_0x2722e8,_0x30fa0b){return function(_0x56f6f7){if(_0x56f6f7){return _0x56f6f7[_0x6e70('0x35')]()[_0x6e70('0x20')](function(){_0x2722e8['status'](0xcc)[_0x6e70('0x2a')]();});}};}function handleEntityNotFound(_0x154925,_0x52b457){return function(_0x10d8f6){if(!_0x10d8f6){_0x154925[_0x6e70('0x36')](0x194);}return _0x10d8f6;};}function handleError(_0x2d52bd,_0x2723d7){_0x2723d7=_0x2723d7||0x1f4;return function(_0x3b4a13){logger[_0x6e70('0x24')](_0x3b4a13[_0x6e70('0x37')]);if(_0x3b4a13[_0x6e70('0x38')]){delete _0x3b4a13[_0x6e70('0x38')];}_0x2d52bd[_0x6e70('0x2b')](_0x2723d7)['send'](_0x3b4a13);};}exports[_0x6e70('0x39')]=function(_0x4795a0,_0x23cd1a){var _0x3222a2={},_0x98c683={},_0x32d12d={'count':0x0,'rows':[]};var _0x233a83=_[_0x6e70('0x3a')](db[_0x6e70('0x3b')][_0x6e70('0x3c')],function(_0x80bebb){return{'name':_0x80bebb[_0x6e70('0x3d')],'type':_0x80bebb[_0x6e70('0x3e')][_0x6e70('0x3f')]};});_0x98c683[_0x6e70('0x40')]=_['map'](_0x233a83,'name');_0x98c683['query']=_[_0x6e70('0x41')](_0x4795a0[_0x6e70('0x42')]);_0x98c683[_0x6e70('0x43')]=_[_0x6e70('0x44')](_0x98c683[_0x6e70('0x40')],_0x98c683[_0x6e70('0x42')]);_0x3222a2['attributes']=_[_0x6e70('0x44')](_0x98c683[_0x6e70('0x40')],qs[_0x6e70('0x45')](_0x4795a0[_0x6e70('0x42')][_0x6e70('0x45')]));_0x3222a2[_0x6e70('0x46')]=_0x3222a2[_0x6e70('0x46')][_0x6e70('0x47')]?_0x3222a2['attributes']:_0x98c683[_0x6e70('0x40')];if(!_0x4795a0[_0x6e70('0x42')][_0x6e70('0x48')](_0x6e70('0x49'))){_0x3222a2[_0x6e70('0x4a')]=qs[_0x6e70('0x4a')](_0x4795a0[_0x6e70('0x42')]['limit']);_0x3222a2['offset']=qs['offset'](_0x4795a0[_0x6e70('0x42')][_0x6e70('0x2d')]);}_0x3222a2[_0x6e70('0x4b')]=qs[_0x6e70('0x4c')](_0x4795a0[_0x6e70('0x42')]['sort']);_0x3222a2[_0x6e70('0x4d')]=qs[_0x6e70('0x43')](_[_0x6e70('0x4e')](_0x4795a0['query'],_0x98c683['filters']),_0x233a83);if(_0x4795a0['query'][_0x6e70('0x4f')]){_0x3222a2['where']=_[_0x6e70('0x50')](_0x3222a2[_0x6e70('0x4d')],{'$or':_[_0x6e70('0x3a')](_0x233a83,function(_0x75a90d){if(_0x75a90d['type']!==_0x6e70('0x51')){var _0x4d1243={};_0x4d1243[_0x75a90d[_0x6e70('0x38')]]={'$like':'%'+_0x4795a0[_0x6e70('0x42')][_0x6e70('0x4f')]+'%'};return _0x4d1243;}})});}_0x3222a2=_[_0x6e70('0x50')]({},_0x3222a2,_0x4795a0['options']);var _0x291de6={'where':_0x3222a2[_0x6e70('0x4d')]};return db[_0x6e70('0x3b')][_0x6e70('0x2c')](_0x291de6)[_0x6e70('0x20')](function(_0x3fcb2d){_0x32d12d[_0x6e70('0x2c')]=_0x3fcb2d;if(_0x4795a0['query'][_0x6e70('0x52')]){_0x3222a2[_0x6e70('0x53')]=[{'all':!![]}];}return db[_0x6e70('0x3b')][_0x6e70('0x54')](_0x3222a2);})[_0x6e70('0x20')](function(_0x172e8a){_0x32d12d[_0x6e70('0x55')]=_0x172e8a;return _0x32d12d;})['then'](respondWithFilteredResult(_0x23cd1a,_0x3222a2))[_0x6e70('0x56')](handleError(_0x23cd1a,null));};exports['show']=function(_0x11794e,_0x3836e4){var _0x4b351e={'raw':![],'where':{'id':_0x11794e[_0x6e70('0x57')]['id']}},_0x53efc3={};_0x53efc3[_0x6e70('0x40')]=_[_0x6e70('0x41')](db['FreshdeskConfiguration']['rawAttributes']);_0x53efc3[_0x6e70('0x42')]=_[_0x6e70('0x41')](_0x11794e[_0x6e70('0x42')]);_0x53efc3[_0x6e70('0x43')]=_[_0x6e70('0x44')](_0x53efc3[_0x6e70('0x40')],_0x53efc3['query']);_0x4b351e[_0x6e70('0x46')]=_[_0x6e70('0x44')](_0x53efc3[_0x6e70('0x40')],qs[_0x6e70('0x45')](_0x11794e[_0x6e70('0x42')]['fields']));_0x4b351e['attributes']=_0x4b351e[_0x6e70('0x46')][_0x6e70('0x47')]?_0x4b351e[_0x6e70('0x46')]:_0x53efc3[_0x6e70('0x40')];if(_0x11794e[_0x6e70('0x42')]['includeAll']){_0x4b351e[_0x6e70('0x53')]=[{'all':!![]}];}_0x4b351e=_[_0x6e70('0x50')]({},_0x4b351e,_0x11794e[_0x6e70('0x58')]);return db[_0x6e70('0x3b')][_0x6e70('0x59')](_0x4b351e)['then'](handleEntityNotFound(_0x3836e4,null))[_0x6e70('0x20')](respondWithResult(_0x3836e4,null))[_0x6e70('0x56')](handleError(_0x3836e4,null));};exports[_0x6e70('0x5a')]=function(_0x3fb0d3,_0x8ef4f7){return db[_0x6e70('0x3b')]['create'](_0x3fb0d3[_0x6e70('0x5b')],{})[_0x6e70('0x20')](respondWithResult(_0x8ef4f7,0xc9))['catch'](handleError(_0x8ef4f7,null));};exports[_0x6e70('0x34')]=function(_0xebe5f7,_0x54efdf){if(_0xebe5f7[_0x6e70('0x5b')]['id']){delete _0xebe5f7[_0x6e70('0x5b')]['id'];}return db[_0x6e70('0x3b')][_0x6e70('0x59')]({'where':{'id':_0xebe5f7[_0x6e70('0x57')]['id']}})['then'](handleEntityNotFound(_0x54efdf,null))[_0x6e70('0x20')](saveUpdates(_0xebe5f7[_0x6e70('0x5b')],null))[_0x6e70('0x20')](respondWithResult(_0x54efdf,null))[_0x6e70('0x56')](handleError(_0x54efdf,null));};exports[_0x6e70('0x35')]=function(_0x1fe13a,_0x14643b){return db[_0x6e70('0x3b')][_0x6e70('0x59')]({'where':{'id':_0x1fe13a[_0x6e70('0x57')]['id']}})[_0x6e70('0x20')](handleEntityNotFound(_0x14643b,null))[_0x6e70('0x20')](removeEntity(_0x14643b,null))[_0x6e70('0x56')](handleError(_0x14643b,null));};exports[_0x6e70('0x5c')]=function(_0x2a9173,_0x2240a1,_0x324fa6){var _0x4329a6={};var _0x2a8627={};var _0x1c7dca;var _0x4c6aab;return db[_0x6e70('0x3b')][_0x6e70('0x5d')]({'where':{'id':_0x2a9173[_0x6e70('0x57')]['id']}})[_0x6e70('0x20')](handleEntityNotFound(_0x2240a1,null))[_0x6e70('0x20')](function(_0x3880dd){if(_0x3880dd){_0x1c7dca=_0x3880dd;_0x2a8627['model']=_[_0x6e70('0x41')](db[_0x6e70('0x5e')]['rawAttributes']);_0x2a8627[_0x6e70('0x42')]=_[_0x6e70('0x41')](_0x2a9173[_0x6e70('0x42')]);_0x2a8627['filters']=_['intersection'](_0x2a8627[_0x6e70('0x40')],_0x2a8627[_0x6e70('0x42')]);_0x4329a6[_0x6e70('0x46')]=_[_0x6e70('0x44')](_0x2a8627[_0x6e70('0x40')],qs[_0x6e70('0x45')](_0x2a9173[_0x6e70('0x42')]['fields']));_0x4329a6['attributes']=_0x4329a6[_0x6e70('0x46')][_0x6e70('0x47')]?_0x4329a6[_0x6e70('0x46')]:_0x2a8627[_0x6e70('0x40')];_0x4329a6['order']=qs['sort'](_0x2a9173[_0x6e70('0x42')][_0x6e70('0x4c')]);_0x4329a6['where']=qs['filters'](_[_0x6e70('0x4e')](_0x2a9173['query'],_0x2a8627[_0x6e70('0x43')]));if(_0x2a9173[_0x6e70('0x42')][_0x6e70('0x4f')]){_0x4329a6[_0x6e70('0x4d')]=_[_0x6e70('0x50')](_0x4329a6[_0x6e70('0x4d')],{'$or':_[_0x6e70('0x3a')](_0x4329a6[_0x6e70('0x46')],function(_0x570115){var _0x2ed223={};_0x2ed223[_0x570115]={'$like':'%'+_0x2a9173[_0x6e70('0x42')][_0x6e70('0x4f')]+'%'};return _0x2ed223;})});}_0x4329a6=_[_0x6e70('0x50')]({},_0x4329a6,_0x2a9173[_0x6e70('0x58')]);return _0x1c7dca['getFields'](_0x4329a6);}})['then'](function(_0x5979bf){if(_0x5979bf){_0x4c6aab=_0x5979bf[_0x6e70('0x47')];if(!_0x2a9173[_0x6e70('0x42')][_0x6e70('0x48')]('nolimit')){_0x4329a6['limit']=qs[_0x6e70('0x4a')](_0x2a9173[_0x6e70('0x42')][_0x6e70('0x4a')]);_0x4329a6[_0x6e70('0x2d')]=qs[_0x6e70('0x2d')](_0x2a9173[_0x6e70('0x42')]['offset']);}return _0x1c7dca[_0x6e70('0x5c')](_0x4329a6);}})[_0x6e70('0x20')](function(_0x30d11b){if(_0x30d11b){return _0x30d11b?{'count':_0x4c6aab,'rows':_0x30d11b}:null;}})[_0x6e70('0x20')](respondWithResult(_0x2240a1,null))['catch'](handleError(_0x2240a1,null));};exports[_0x6e70('0x5f')]=function(_0x531097,_0x5b4046,_0x30487b){var _0x3249a5={};var _0x3f37c1={};var _0xe24ad5;var _0x326584;return db[_0x6e70('0x3b')]['findOne']({'where':{'id':_0x531097[_0x6e70('0x57')]['id']}})[_0x6e70('0x20')](handleEntityNotFound(_0x5b4046,null))[_0x6e70('0x20')](function(_0x18e64c){if(_0x18e64c){_0xe24ad5=_0x18e64c;_0x3f37c1[_0x6e70('0x40')]=_[_0x6e70('0x41')](db[_0x6e70('0x5e')][_0x6e70('0x3c')]);_0x3f37c1[_0x6e70('0x42')]=_[_0x6e70('0x41')](_0x531097['query']);_0x3f37c1[_0x6e70('0x43')]=_[_0x6e70('0x44')](_0x3f37c1[_0x6e70('0x40')],_0x3f37c1['query']);_0x3249a5['attributes']=_[_0x6e70('0x44')](_0x3f37c1[_0x6e70('0x40')],qs[_0x6e70('0x45')](_0x531097[_0x6e70('0x42')][_0x6e70('0x45')]));_0x3249a5['attributes']=_0x3249a5['attributes'][_0x6e70('0x47')]?_0x3249a5[_0x6e70('0x46')]:_0x3f37c1['model'];_0x3249a5[_0x6e70('0x4b')]=qs[_0x6e70('0x4c')](_0x531097[_0x6e70('0x42')][_0x6e70('0x4c')]);_0x3249a5[_0x6e70('0x4d')]=qs[_0x6e70('0x43')](_[_0x6e70('0x4e')](_0x531097[_0x6e70('0x42')],_0x3f37c1[_0x6e70('0x43')]));if(_0x531097[_0x6e70('0x42')][_0x6e70('0x4f')]){_0x3249a5[_0x6e70('0x4d')]=_[_0x6e70('0x50')](_0x3249a5[_0x6e70('0x4d')],{'$or':_['map'](_0x3249a5['attributes'],function(_0x39ed95){var _0x4be7e4={};_0x4be7e4[_0x39ed95]={'$like':'%'+_0x531097[_0x6e70('0x42')]['filter']+'%'};return _0x4be7e4;})});}_0x3249a5=_['merge']({},_0x3249a5,_0x531097[_0x6e70('0x58')]);return _0xe24ad5['getSubjects'](_0x3249a5);}})['then'](function(_0x3c77d8){if(_0x3c77d8){_0x326584=_0x3c77d8[_0x6e70('0x47')];if(!_0x531097[_0x6e70('0x42')]['hasOwnProperty']('nolimit')){_0x3249a5['limit']=qs[_0x6e70('0x4a')](_0x531097['query'][_0x6e70('0x4a')]);_0x3249a5[_0x6e70('0x2d')]=qs[_0x6e70('0x2d')](_0x531097[_0x6e70('0x42')][_0x6e70('0x2d')]);}return _0xe24ad5[_0x6e70('0x5f')](_0x3249a5);}})[_0x6e70('0x20')](function(_0x50046a){if(_0x50046a){return _0x50046a?{'count':_0x326584,'rows':_0x50046a}:null;}})[_0x6e70('0x20')](respondWithResult(_0x5b4046,null))[_0x6e70('0x56')](handleError(_0x5b4046,null));};exports[_0x6e70('0x60')]=function(_0x551904,_0x2c84ed,_0x227d94){var _0x11a615={};var _0x267576={};var _0x451960;var _0x2ec096;return db[_0x6e70('0x3b')][_0x6e70('0x5d')]({'where':{'id':_0x551904[_0x6e70('0x57')]['id']}})['then'](handleEntityNotFound(_0x2c84ed,null))[_0x6e70('0x20')](function(_0x39e6db){if(_0x39e6db){_0x451960=_0x39e6db;_0x267576['model']=_[_0x6e70('0x41')](db[_0x6e70('0x5e')]['rawAttributes']);_0x267576['query']=_[_0x6e70('0x41')](_0x551904['query']);_0x267576[_0x6e70('0x43')]=_['intersection'](_0x267576[_0x6e70('0x40')],_0x267576[_0x6e70('0x42')]);_0x11a615[_0x6e70('0x46')]=_[_0x6e70('0x44')](_0x267576[_0x6e70('0x40')],qs[_0x6e70('0x45')](_0x551904[_0x6e70('0x42')]['fields']));_0x11a615['attributes']=_0x11a615[_0x6e70('0x46')]['length']?_0x11a615[_0x6e70('0x46')]:_0x267576[_0x6e70('0x40')];_0x11a615[_0x6e70('0x4b')]=qs[_0x6e70('0x4c')](_0x551904['query'][_0x6e70('0x4c')]);_0x11a615['where']=qs[_0x6e70('0x43')](_[_0x6e70('0x4e')](_0x551904[_0x6e70('0x42')],_0x267576[_0x6e70('0x43')]));if(_0x551904[_0x6e70('0x42')][_0x6e70('0x4f')]){_0x11a615[_0x6e70('0x4d')]=_['merge'](_0x11a615[_0x6e70('0x4d')],{'$or':_['map'](_0x11a615[_0x6e70('0x46')],function(_0x5f1e62){var _0x532b77={};_0x532b77[_0x5f1e62]={'$like':'%'+_0x551904['query'][_0x6e70('0x4f')]+'%'};return _0x532b77;})});}_0x11a615=_[_0x6e70('0x50')]({},_0x11a615,_0x551904[_0x6e70('0x58')]);return _0x451960[_0x6e70('0x60')](_0x11a615);}})[_0x6e70('0x20')](function(_0x4dd69a){if(_0x4dd69a){_0x2ec096=_0x4dd69a[_0x6e70('0x47')];if(!_0x551904[_0x6e70('0x42')]['hasOwnProperty'](_0x6e70('0x49'))){_0x11a615['limit']=qs[_0x6e70('0x4a')](_0x551904['query']['limit']);_0x11a615[_0x6e70('0x2d')]=qs[_0x6e70('0x2d')](_0x551904[_0x6e70('0x42')][_0x6e70('0x2d')]);}return _0x451960[_0x6e70('0x60')](_0x11a615);}})[_0x6e70('0x20')](function(_0x1a0a55){if(_0x1a0a55){return _0x1a0a55?{'count':_0x2ec096,'rows':_0x1a0a55}:null;}})['then'](respondWithResult(_0x2c84ed,null))[_0x6e70('0x56')](handleError(_0x2c84ed,null));};exports['getTags']=function(_0x1e74c0,_0x16628e,_0x2bd364){var _0x3269ce={};var _0x4764d5={};var _0x41b7de;var _0x2012ee;return db['FreshdeskConfiguration'][_0x6e70('0x5d')]({'where':{'id':_0x1e74c0['params']['id']}})[_0x6e70('0x20')](handleEntityNotFound(_0x16628e,null))[_0x6e70('0x20')](function(_0x7d81f){if(_0x7d81f){_0x41b7de=_0x7d81f;_0x4764d5[_0x6e70('0x40')]=_[_0x6e70('0x41')](db[_0x6e70('0x61')][_0x6e70('0x3c')]);_0x4764d5[_0x6e70('0x42')]=_[_0x6e70('0x41')](_0x1e74c0[_0x6e70('0x42')]);_0x4764d5['filters']=_[_0x6e70('0x44')](_0x4764d5[_0x6e70('0x40')],_0x4764d5[_0x6e70('0x42')]);_0x3269ce[_0x6e70('0x46')]=_[_0x6e70('0x44')](_0x4764d5['model'],qs['fields'](_0x1e74c0['query'][_0x6e70('0x45')]));_0x3269ce[_0x6e70('0x46')]=_0x3269ce[_0x6e70('0x46')][_0x6e70('0x47')]?_0x3269ce[_0x6e70('0x46')]:_0x4764d5[_0x6e70('0x40')];_0x3269ce[_0x6e70('0x4b')]=qs[_0x6e70('0x4c')](_0x1e74c0[_0x6e70('0x42')][_0x6e70('0x4c')]);_0x3269ce[_0x6e70('0x4d')]=qs[_0x6e70('0x43')](_[_0x6e70('0x4e')](_0x1e74c0[_0x6e70('0x42')],_0x4764d5[_0x6e70('0x43')]));if(_0x1e74c0['query'][_0x6e70('0x4f')]){_0x3269ce[_0x6e70('0x4d')]=_[_0x6e70('0x50')](_0x3269ce[_0x6e70('0x4d')],{'$or':_[_0x6e70('0x3a')](_0x3269ce[_0x6e70('0x46')],function(_0x4a1e50){var _0x52a7b0={};_0x52a7b0[_0x4a1e50]={'$like':'%'+_0x1e74c0[_0x6e70('0x42')][_0x6e70('0x4f')]+'%'};return _0x52a7b0;})});}_0x3269ce=_[_0x6e70('0x50')]({},_0x3269ce,_0x1e74c0[_0x6e70('0x58')]);return _0x41b7de[_0x6e70('0x62')](_0x3269ce);}})[_0x6e70('0x20')](function(_0x2ea4e9){if(_0x2ea4e9){_0x2012ee=_0x2ea4e9['length'];if(!_0x1e74c0[_0x6e70('0x42')]['hasOwnProperty'](_0x6e70('0x49'))){_0x3269ce[_0x6e70('0x4a')]=qs[_0x6e70('0x4a')](_0x1e74c0[_0x6e70('0x42')]['limit']);_0x3269ce[_0x6e70('0x2d')]=qs[_0x6e70('0x2d')](_0x1e74c0['query'][_0x6e70('0x2d')]);}return _0x41b7de['getTags'](_0x3269ce);}})[_0x6e70('0x20')](function(_0x47930c){if(_0x47930c){return _0x47930c?{'count':_0x2012ee,'rows':_0x47930c}:null;}})['then'](respondWithResult(_0x16628e,null))[_0x6e70('0x56')](handleError(_0x16628e,null));};exports[_0x6e70('0x63')]=function(_0x3cd4cc,_0x47edfe,_0x31cb39){if(_0x3cd4cc[_0x6e70('0x5b')]['id']){delete _0x3cd4cc['body']['id'];}return db[_0x6e70('0x3b')][_0x6e70('0x5d')]({'where':{'id':_0x3cd4cc[_0x6e70('0x57')]['id']}})[_0x6e70('0x20')](handleEntityNotFound(_0x47edfe,null))[_0x6e70('0x20')](function(_0x2df345){if(_0x2df345){return _0x2df345[_0x6e70('0x63')](_0x3cd4cc[_0x6e70('0x5b')][_0x6e70('0x64')]||[]);}return null;})['then'](respondWithResult(_0x47edfe,null))['catch'](handleError(_0x47edfe,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 270f442..6b955e9 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 _0x30a7=['../../config/logger','api','moment','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util'];(function(_0x4de9a5,_0x245d11){var _0x1b0f37=function(_0x454f9a){while(--_0x454f9a){_0x4de9a5['push'](_0x4de9a5['shift']());}};_0x1b0f37(++_0x245d11);}(_0x30a7,0x177));var _0x730a=function(_0x29dd55,_0x5e5c73){_0x29dd55=_0x29dd55-0x0;var _0x416ace=_0x30a7[_0x29dd55];return _0x416ace;};'use strict';var _=require(_0x730a('0x0'));var util=require(_0x730a('0x1'));var logger=require(_0x730a('0x2'))(_0x730a('0x3'));var moment=require(_0x730a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x730a('0x5'));var rimraf=require(_0x730a('0x6'));var config=require(_0x730a('0x7'));var attributes=require(_0x730a('0x8'));module[_0x730a('0x9')]=function(_0x1a7659,_0x274a7e){return _0x1a7659[_0x730a('0xa')](_0x730a('0xb'),attributes,{'tableName':_0x730a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf08d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0xf08d,0x15f));var _0xdf08=function(_0x57eedd,_0x297a36){_0x57eedd=_0x57eedd-0x0;var _0x3d02b0=_0xf08d[_0x57eedd];return _0x3d02b0;};'use strict';var _=require(_0xdf08('0x0'));var util=require(_0xdf08('0x1'));var logger=require(_0xdf08('0x2'))(_0xdf08('0x3'));var moment=require(_0xdf08('0x4'));var BPromise=require(_0xdf08('0x5'));var rp=require(_0xdf08('0x6'));var fs=require('fs');var path=require(_0xdf08('0x7'));var rimraf=require(_0xdf08('0x8'));var config=require('../../config/environment');var attributes=require(_0xdf08('0x9'));module[_0xdf08('0xa')]=function(_0x24e8ce,_0x119807){return _0x24e8ce[_0xdf08('0xb')]('FreshdeskConfiguration',attributes,{'tableName':_0xdf08('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 9a02f52..b17f754 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 _0xa34f=['then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x487b16,_0x4ea4a1){var _0xe7c758=function(_0x431b80){while(--_0x431b80){_0x487b16['push'](_0x487b16['shift']());}};_0xe7c758(++_0x4ea4a1);}(_0xa34f,0x192));var _0xfa34=function(_0x2b4920,_0x401f83){_0x2b4920=_0x2b4920-0x0;var _0x11feda=_0xa34f[_0x2b4920];return _0x11feda;};'use strict';var _=require(_0xfa34('0x0'));var util=require(_0xfa34('0x1'));var moment=require('moment');var BPromise=require(_0xfa34('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa34('0x3'))['db'];var utils=require(_0xfa34('0x4'));var logger=require(_0xfa34('0x5'))(_0xfa34('0x6'));var config=require(_0xfa34('0x7'));var jayson=require(_0xfa34('0x8'));var client=jayson[_0xfa34('0x9')][_0xfa34('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x803849,_0x37942d,_0x423688){return new BPromise(function(_0x3fca09,_0x18436f){return client[_0xfa34('0xb')](_0x803849,_0x423688)[_0xfa34('0xc')](function(_0x1efb3a){logger['info'](_0xfa34('0xd'),_0x37942d,_0xfa34('0xe'));logger['debug'](_0xfa34('0xf'),_0x37942d,_0xfa34('0xe'),JSON[_0xfa34('0x10')](_0x1efb3a));if(_0x1efb3a[_0xfa34('0x11')]){if(_0x1efb3a[_0xfa34('0x11')][_0xfa34('0x12')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x37942d,_0x1efb3a[_0xfa34('0x11')][_0xfa34('0x13')]);return _0x18436f(_0x1efb3a[_0xfa34('0x11')][_0xfa34('0x13')]);}logger[_0xfa34('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x37942d,_0x1efb3a[_0xfa34('0x11')][_0xfa34('0x13')]);return _0x3fca09(_0x1efb3a[_0xfa34('0x11')][_0xfa34('0x13')]);}else{logger[_0xfa34('0x14')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x37942d,'request\x20sent');_0x3fca09(_0x1efb3a[_0xfa34('0x15')][_0xfa34('0x13')]);}})[_0xfa34('0x16')](function(_0x32f656){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x37942d,_0x32f656);_0x18436f(_0x32f656);});});} \ No newline at end of file +var _0xc032=['FreshdeskConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','request\x20sent','stringify','error','message'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc032,0x145));var _0x2c03=function(_0x5df80a,_0x4541f4){_0x5df80a=_0x5df80a-0x0;var _0x9c6acc=_0xc032[_0x5df80a];return _0x9c6acc;};'use strict';var _=require(_0x2c03('0x0'));var util=require(_0x2c03('0x1'));var moment=require(_0x2c03('0x2'));var BPromise=require(_0x2c03('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c03('0x4'));var db=require(_0x2c03('0x5'))['db'];var utils=require(_0x2c03('0x6'));var logger=require(_0x2c03('0x7'))(_0x2c03('0x8'));var config=require(_0x2c03('0x9'));var jayson=require(_0x2c03('0xa'));var client=jayson[_0x2c03('0xb')][_0x2c03('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1eed7c,_0x4582d9,_0x5b466a){return new BPromise(function(_0x35816f,_0x2d076c){return client[_0x2c03('0xd')](_0x1eed7c,_0x5b466a)['then'](function(_0x31ff0a){logger[_0x2c03('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4582d9,'request\x20sent');logger[_0x2c03('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4582d9,_0x2c03('0x10'),JSON[_0x2c03('0x11')](_0x31ff0a));if(_0x31ff0a[_0x2c03('0x12')]){if(_0x31ff0a[_0x2c03('0x12')]['code']===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x4582d9,_0x31ff0a[_0x2c03('0x12')]['message']);return _0x2d076c(_0x31ff0a[_0x2c03('0x12')][_0x2c03('0x13')]);}logger[_0x2c03('0x12')](_0x2c03('0x14'),_0x4582d9,_0x31ff0a[_0x2c03('0x12')][_0x2c03('0x13')]);return _0x35816f(_0x31ff0a['error'][_0x2c03('0x13')]);}else{logger[_0x2c03('0xe')](_0x2c03('0x14'),_0x4582d9,'request\x20sent');_0x35816f(_0x31ff0a[_0x2c03('0x15')]['message']);}})[_0x2c03('0x16')](function(_0x4e3a09){logger[_0x2c03('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4582d9,_0x4e3a09);_0x2d076c(_0x4e3a09);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 07ced4f..5fbcfe3 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 _0x6142=['put','update','delete','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x6142,0x193));var _0x2614=function(_0x10ddef,_0x2fd6ae){_0x10ddef=_0x10ddef-0x0;var _0x326915=_0x6142[_0x10ddef];return _0x326915;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x2614('0x0'));var express=require(_0x2614('0x1'));var router=express[_0x2614('0x2')]();var fs_extra=require(_0x2614('0x3'));var auth=require(_0x2614('0x4'));var interaction=require(_0x2614('0x5'));var config=require(_0x2614('0x6'));var controller=require(_0x2614('0x7'));router[_0x2614('0x8')]('/',auth[_0x2614('0x9')](),controller[_0x2614('0xa')]);router[_0x2614('0x8')](_0x2614('0xb'),auth[_0x2614('0x9')](),controller[_0x2614('0xc')]);router[_0x2614('0xd')]('/',auth[_0x2614('0x9')](),controller[_0x2614('0xe')]);router[_0x2614('0xf')](_0x2614('0xb'),auth['isAuthenticated'](),controller[_0x2614('0x10')]);router[_0x2614('0x11')](_0x2614('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x2614('0x12')]=router; \ No newline at end of file +var _0xc2e8=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x53d1f7,_0x2f447d){var _0x209157=function(_0x1f6a31){while(--_0x1f6a31){_0x53d1f7['push'](_0x53d1f7['shift']());}};_0x209157(++_0x2f447d);}(_0xc2e8,0x193));var _0x8c2e=function(_0x27d6a0,_0x40d1b0){_0x27d6a0=_0x27d6a0-0x0;var _0x303073=_0xc2e8[_0x27d6a0];return _0x303073;};'use strict';var multer=require(_0x8c2e('0x0'));var util=require(_0x8c2e('0x1'));var path=require(_0x8c2e('0x2'));var timeout=require(_0x8c2e('0x3'));var express=require(_0x8c2e('0x4'));var router=express[_0x8c2e('0x5')]();var fs_extra=require(_0x8c2e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8c2e('0x7'));var config=require(_0x8c2e('0x8'));var controller=require(_0x8c2e('0x9'));router['get']('/',auth[_0x8c2e('0xa')](),controller[_0x8c2e('0xb')]);router[_0x8c2e('0xc')](_0x8c2e('0xd'),auth[_0x8c2e('0xa')](),controller[_0x8c2e('0xe')]);router[_0x8c2e('0xf')]('/',auth[_0x8c2e('0xa')](),controller[_0x8c2e('0x10')]);router[_0x8c2e('0x11')]('/:id',auth[_0x8c2e('0xa')](),controller['update']);router[_0x8c2e('0x12')](_0x8c2e('0xd'),auth[_0x8c2e('0xa')](),controller[_0x8c2e('0x13')]);module[_0x8c2e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 6b7512e..f23149a 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 _0x87ae=['customVariable','keyValue','picklist','STRING','BOOLEAN','ENUM'];(function(_0x37b83f,_0x29a8f7){var _0x1fbac1=function(_0x1cdcc2){while(--_0x1cdcc2){_0x37b83f['push'](_0x37b83f['shift']());}};_0x1fbac1(++_0x29a8f7);}(_0x87ae,0xf5));var _0xe87a=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x87ae[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xe87a('0x0')]('string','variable',_0xe87a('0x1'),_0xe87a('0x2'),_0xe87a('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0xe87a('0x4')]},'key':{'type':Sequelize[_0xe87a('0x4')]},'keyType':{'type':Sequelize[_0xe87a('0x0')]('string','variable',_0xe87a('0x1'))},'keyContent':{'type':Sequelize[_0xe87a('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xe87a('0x4')]},'customField':{'type':Sequelize[_0xe87a('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf109=['picklist','string','STRING','variable','customVariable','BOOLEAN','sequelize','exports','ENUM','keyValue'];(function(_0x5e4301,_0x46c209){var _0x3d7313=function(_0x53639f){while(--_0x53639f){_0x5e4301['push'](_0x5e4301['shift']());}};_0x3d7313(++_0x46c209);}(_0xf109,0xce));var _0x9f10=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xf109[_0x4792c8];return _0x35edb1;};'use strict';var Sequelize=require(_0x9f10('0x0'));module[_0x9f10('0x1')]={'type':{'type':Sequelize[_0x9f10('0x2')]('string','variable','customVariable',_0x9f10('0x3'),_0x9f10('0x4')),'defaultValue':_0x9f10('0x5')},'content':{'type':Sequelize[_0x9f10('0x6')]},'key':{'type':Sequelize[_0x9f10('0x6')]},'keyType':{'type':Sequelize[_0x9f10('0x2')](_0x9f10('0x5'),_0x9f10('0x7'),_0x9f10('0x8'))},'keyContent':{'type':Sequelize[_0x9f10('0x6')]},'idField':{'type':Sequelize[_0x9f10('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9f10('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9f10('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 980df9e..f57c1d5 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 _0x34e8=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','include','FreshdeskField','findAll','rows','catch','params','includeAll','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra'];(function(_0x405022,_0x2377a8){var _0x3b29e7=function(_0xb927b5){while(--_0xb927b5){_0x405022['push'](_0x405022['shift']());}};_0x3b29e7(++_0x2377a8);}(_0x34e8,0x12c));var _0x834e=function(_0x1a6ed3,_0x483fca){_0x1a6ed3=_0x1a6ed3-0x0;var _0x1834c2=_0x34e8[_0x1a6ed3];return _0x1834c2;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=_0x38a8cd[_0x834e('0x1f')],_0x478afe=_0x4a9cdc['offset'],_0x43ac41=_0x4a9cdc[_0x834e('0x20')]+_0x4a9cdc[_0x834e('0x21')],_0x22106e;if(_0x43ac41>=_0x36d443){_0x43ac41=_0x36d443;_0x22106e=0xc8;}else{_0x22106e=0xce;}_0x316205[_0x834e('0x1d')](_0x22106e);return _0x316205[_0x834e('0x22')](_0x834e('0x23'),_0x478afe+'-'+_0x43ac41+'/'+_0x36d443)[_0x834e('0x24')](_0x38a8cd);}return null;};}function patchUpdates(_0x1dd214){return function(_0x595515){try{jsonpatch[_0x834e('0x25')](_0x595515,_0x1dd214,!![]);}catch(_0x1fd2c6){return BPromise[_0x834e('0x26')](_0x1fd2c6);}return _0x595515[_0x834e('0x27')]();};}function saveUpdates(_0x4ab05d,_0x45a630){return function(_0x62f8f1){if(_0x62f8f1){return _0x62f8f1['update'](_0x4ab05d)[_0x834e('0x28')](function(_0x28d687){return _0x28d687;});}return null;};}function removeEntity(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')]()[_0x834e('0x28')](function(){_0x8d406e['status'](0xcc)[_0x834e('0x1e')]();});}};}function handleEntityNotFound(_0x1dc1e0,_0x58f4fd){return function(_0x3bc4f7){if(!_0x3bc4f7){_0x1dc1e0[_0x834e('0x1c')](0x194);}return _0x3bc4f7;};}function handleError(_0x338636,_0x561cd2){_0x561cd2=_0x561cd2||0x1f4;return function(_0x24fcf7){logger[_0x834e('0x2a')](_0x24fcf7['stack']);if(_0x24fcf7['name']){delete _0x24fcf7[_0x834e('0x2b')];}_0x338636['status'](_0x561cd2)[_0x834e('0x2c')](_0x24fcf7);};}exports[_0x834e('0x2d')]=function(_0x3db026,_0x2cc2eb){var _0x3cd928={},_0x130cc5={},_0x491919={'count':0x0,'rows':[]};var _0x510780=_['map'](db['FreshdeskField'][_0x834e('0x2e')],function(_0x567cea){return{'name':_0x567cea[_0x834e('0x2f')],'type':_0x567cea['type'][_0x834e('0x30')]};});_0x130cc5[_0x834e('0x31')]=_[_0x834e('0x32')](_0x510780,_0x834e('0x2b'));_0x130cc5[_0x834e('0x33')]=_[_0x834e('0x34')](_0x3db026[_0x834e('0x33')]);_0x130cc5[_0x834e('0x35')]=_[_0x834e('0x36')](_0x130cc5['model'],_0x130cc5[_0x834e('0x33')]);_0x3cd928['attributes']=_[_0x834e('0x36')](_0x130cc5[_0x834e('0x31')],qs[_0x834e('0x37')](_0x3db026[_0x834e('0x33')][_0x834e('0x37')]));_0x3cd928[_0x834e('0x38')]=_0x3cd928[_0x834e('0x38')][_0x834e('0x39')]?_0x3cd928[_0x834e('0x38')]:_0x130cc5[_0x834e('0x31')];if(!_0x3db026['query'][_0x834e('0x3a')](_0x834e('0x3b'))){_0x3cd928[_0x834e('0x21')]=qs[_0x834e('0x21')](_0x3db026['query'][_0x834e('0x21')]);_0x3cd928[_0x834e('0x20')]=qs['offset'](_0x3db026['query']['offset']);}_0x3cd928[_0x834e('0x3c')]=qs[_0x834e('0x3d')](_0x3db026[_0x834e('0x33')][_0x834e('0x3d')]);_0x3cd928[_0x834e('0x3e')]=qs[_0x834e('0x35')](_['pick'](_0x3db026[_0x834e('0x33')],_0x130cc5['filters']),_0x510780);if(_0x3db026[_0x834e('0x33')][_0x834e('0x3f')]){_0x3cd928['where']=_[_0x834e('0x40')](_0x3cd928[_0x834e('0x3e')],{'$or':_['map'](_0x510780,function(_0x481f70){if(_0x481f70[_0x834e('0x41')]!==_0x834e('0x42')){var _0x2e9383={};_0x2e9383[_0x481f70[_0x834e('0x2b')]]={'$like':'%'+_0x3db026[_0x834e('0x33')]['filter']+'%'};return _0x2e9383;}})});}_0x3cd928=_[_0x834e('0x40')]({},_0x3cd928,_0x3db026['options']);var _0x50c243={'where':_0x3cd928[_0x834e('0x3e')]};return db['FreshdeskField'][_0x834e('0x1f')](_0x50c243)[_0x834e('0x28')](function(_0x16aea6){_0x491919[_0x834e('0x1f')]=_0x16aea6;if(_0x3db026[_0x834e('0x33')]['includeAll']){_0x3cd928[_0x834e('0x43')]=[{'all':!![]}];}return db[_0x834e('0x44')][_0x834e('0x45')](_0x3cd928);})['then'](function(_0x35380e){_0x491919[_0x834e('0x46')]=_0x35380e;return _0x491919;})['then'](respondWithFilteredResult(_0x2cc2eb,_0x3cd928))[_0x834e('0x47')](handleError(_0x2cc2eb,null));};exports['show']=function(_0x2ebfb6,_0x585335){var _0x4a18bb={'raw':!![],'where':{'id':_0x2ebfb6[_0x834e('0x48')]['id']}},_0x4a6942={};_0x4a6942[_0x834e('0x31')]=_[_0x834e('0x34')](db[_0x834e('0x44')][_0x834e('0x2e')]);_0x4a6942[_0x834e('0x33')]=_[_0x834e('0x34')](_0x2ebfb6['query']);_0x4a6942[_0x834e('0x35')]=_['intersection'](_0x4a6942[_0x834e('0x31')],_0x4a6942['query']);_0x4a18bb[_0x834e('0x38')]=_['intersection'](_0x4a6942[_0x834e('0x31')],qs[_0x834e('0x37')](_0x2ebfb6['query'][_0x834e('0x37')]));_0x4a18bb[_0x834e('0x38')]=_0x4a18bb[_0x834e('0x38')][_0x834e('0x39')]?_0x4a18bb[_0x834e('0x38')]:_0x4a6942[_0x834e('0x31')];if(_0x2ebfb6[_0x834e('0x33')][_0x834e('0x49')]){_0x4a18bb[_0x834e('0x43')]=[{'all':!![]}];}_0x4a18bb=_[_0x834e('0x40')]({},_0x4a18bb,_0x2ebfb6['options']);return db[_0x834e('0x44')][_0x834e('0x4a')](_0x4a18bb)['then'](handleEntityNotFound(_0x585335,null))[_0x834e('0x28')](respondWithResult(_0x585335,null))[_0x834e('0x47')](handleError(_0x585335,null));};exports[_0x834e('0x4b')]=function(_0x2112d5,_0x19b5ef){return db[_0x834e('0x44')]['create'](_0x2112d5['body'],{})[_0x834e('0x28')](respondWithResult(_0x19b5ef,0xc9))[_0x834e('0x47')](handleError(_0x19b5ef,null));};exports[_0x834e('0x4c')]=function(_0x40ff5a,_0x3da408){if(_0x40ff5a[_0x834e('0x4d')]['id']){delete _0x40ff5a[_0x834e('0x4d')]['id'];}return db[_0x834e('0x44')][_0x834e('0x4a')]({'where':{'id':_0x40ff5a[_0x834e('0x48')]['id']}})[_0x834e('0x28')](handleEntityNotFound(_0x3da408,null))[_0x834e('0x28')](saveUpdates(_0x40ff5a[_0x834e('0x4d')],null))[_0x834e('0x28')](respondWithResult(_0x3da408,null))[_0x834e('0x47')](handleError(_0x3da408,null));};exports[_0x834e('0x29')]=function(_0x3df078,_0x32b8f7){return db[_0x834e('0x44')][_0x834e('0x4a')]({'where':{'id':_0x3df078['params']['id']}})[_0x834e('0x28')](handleEntityNotFound(_0x32b8f7,null))[_0x834e('0x28')](removeEntity(_0x32b8f7,null))['catch'](handleError(_0x32b8f7,null));}; \ No newline at end of file +var _0xa9e0=['VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','FreshdeskField','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter'];(function(_0x5a5b0e,_0x254ec9){var _0x27ab64=function(_0x1d8608){while(--_0x1d8608){_0x5a5b0e['push'](_0x5a5b0e['shift']());}};_0x27ab64(++_0x254ec9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':!![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['FreshdeskField'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 8df6869..32cbbb8 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 _0x819a=['exports','define','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x56818e,_0x47e2aa){var _0x5df93a=function(_0x1c95db){while(--_0x1c95db){_0x56818e['push'](_0x56818e['shift']());}};_0x5df93a(++_0x47e2aa);}(_0x819a,0x139));var _0xa819=function(_0x2a2b9d,_0x29ad81){_0x2a2b9d=_0x2a2b9d-0x0;var _0x314b2d=_0x819a[_0x2a2b9d];return _0x314b2d;};'use strict';var _=require(_0xa819('0x0'));var util=require(_0xa819('0x1'));var logger=require(_0xa819('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa819('0x3'));var rp=require(_0xa819('0x4'));var fs=require('fs');var path=require(_0xa819('0x5'));var rimraf=require(_0xa819('0x6'));var config=require(_0xa819('0x7'));var attributes=require(_0xa819('0x8'));module[_0xa819('0x9')]=function(_0x537011,_0x439d26){return _0x537011[_0xa819('0xa')]('FreshdeskField',attributes,{'tableName':_0xa819('0xb'),'paranoid':![],'indexes':[{'name':_0xa819('0xc'),'fields':['idField',_0xa819('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe6a5=['rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe6a5,0x79));var _0x5e6a=function(_0x21da27,_0x5cf45b){_0x21da27=_0x21da27-0x0;var _0x34e844=_0xe6a5[_0x21da27];return _0x34e844;};'use strict';var _=require(_0x5e6a('0x0'));var util=require(_0x5e6a('0x1'));var logger=require(_0x5e6a('0x2'))(_0x5e6a('0x3'));var moment=require(_0x5e6a('0x4'));var BPromise=require(_0x5e6a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e6a('0x6'));var rimraf=require(_0x5e6a('0x7'));var config=require(_0x5e6a('0x8'));var attributes=require(_0x5e6a('0x9'));module[_0x5e6a('0xa')]=function(_0xf0ad23,_0x4c5141){return _0xf0ad23[_0x5e6a('0xb')]('FreshdeskField',attributes,{'tableName':_0x5e6a('0xc'),'paranoid':![],'indexes':[{'name':_0x5e6a('0xd'),'fields':[_0x5e6a('0xe'),_0x5e6a('0xf')],'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 41d7a92..238d426 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0xc85d8b,_0x2b7c28){_0xc85d8b=_0xc85d8b-0x0;var _0x3b1a55=_0x7a54[_0xc85d8b];return _0x3b1a55;};'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 _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(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x6815b5,_0x1c9375){_0x6815b5=_0x6815b5-0x0;var _0x1aa90b=_0x7a54[_0x6815b5];return _0x1aa90b;};'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 diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 2409c55..2142520 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 _0xa404=['get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0xa404,0x159));var _0x4a40=function(_0x1ce0bd,_0x3805b1){_0x1ce0bd=_0x1ce0bd-0x0;var _0x231829=_0xa404[_0x1ce0bd];return _0x231829;};'use strict';var multer=require(_0x4a40('0x0'));var util=require(_0x4a40('0x1'));var path=require(_0x4a40('0x2'));var timeout=require('connect-timeout');var express=require(_0x4a40('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4a40('0x4'));var interaction=require(_0x4a40('0x5'));var config=require('../../config/environment');var controller=require(_0x4a40('0x6'));router[_0x4a40('0x7')]('/',auth[_0x4a40('0x8')](),controller[_0x4a40('0x9')]);router[_0x4a40('0x7')](_0x4a40('0xa'),auth[_0x4a40('0x8')](),controller[_0x4a40('0xb')]);router['get']('/:id/configurations',auth[_0x4a40('0x8')](),controller[_0x4a40('0xc')]);router[_0x4a40('0x7')](_0x4a40('0xd'),auth['isAuthenticated'](),controller[_0x4a40('0xe')]);router[_0x4a40('0xf')]('/',auth['isAuthenticated'](),controller[_0x4a40('0x10')]);router[_0x4a40('0xf')](_0x4a40('0x11'),auth[_0x4a40('0x8')](),controller[_0x4a40('0x12')]);router[_0x4a40('0x13')]('/:id',auth[_0x4a40('0x8')](),controller['update']);router[_0x4a40('0x14')](_0x4a40('0xa'),auth['isAuthenticated'](),controller[_0x4a40('0x15')]);module['exports']=router; \ No newline at end of file +var _0x1c17=['./intFreshsalesAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x141327,_0x46ec61){var _0x18c8d1=function(_0x254c86){while(--_0x254c86){_0x141327['push'](_0x141327['shift']());}};_0x18c8d1(++_0x46ec61);}(_0x1c17,0x158));var _0x71c1=function(_0x7c2eb8,_0x378317){_0x7c2eb8=_0x7c2eb8-0x0;var _0x6f0423=_0x1c17[_0x7c2eb8];return _0x6f0423;};'use strict';var multer=require(_0x71c1('0x0'));var util=require(_0x71c1('0x1'));var path=require(_0x71c1('0x2'));var timeout=require(_0x71c1('0x3'));var express=require('express');var router=express[_0x71c1('0x4')]();var fs_extra=require(_0x71c1('0x5'));var auth=require(_0x71c1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x71c1('0x7'));var controller=require(_0x71c1('0x8'));router[_0x71c1('0x9')]('/',auth[_0x71c1('0xa')](),controller['index']);router[_0x71c1('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x71c1('0xb')]);router[_0x71c1('0x9')](_0x71c1('0xc'),auth[_0x71c1('0xa')](),controller[_0x71c1('0xd')]);router[_0x71c1('0x9')](_0x71c1('0xe'),auth[_0x71c1('0xa')](),controller[_0x71c1('0xf')]);router[_0x71c1('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x71c1('0xc'),auth[_0x71c1('0xa')](),controller[_0x71c1('0x11')]);router[_0x71c1('0x12')](_0x71c1('0x13'),auth[_0x71c1('0xa')](),controller['update']);router[_0x71c1('0x14')](_0x71c1('0x13'),auth['isAuthenticated'](),controller[_0x71c1('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index a947d8f..e31ce8e 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 _0x9203=['username','remoteUri','STRING'];(function(_0x598225,_0x4ba28a){var _0x24e280=function(_0x1b1fed){while(--_0x1b1fed){_0x598225['push'](_0x598225['shift']());}};_0x24e280(++_0x4ba28a);}(_0x9203,0xe3));var _0x3920=function(_0x1d3892,_0x47d5fe){_0x1d3892=_0x1d3892-0x0;var _0x574ff2=_0x9203[_0x1d3892];return _0x574ff2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3920('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3920('0x0')],'unique':_0x3920('0x1')},'apiKey':{'type':Sequelize[_0x3920('0x0')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x3920('0x2')},'serverUrl':{'type':Sequelize[_0x3920('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x52e2=['STRING','remoteUri','exports','username'];(function(_0x387937,_0x5256b5){var _0x4f8216=function(_0x1e245e){while(--_0x1e245e){_0x387937['push'](_0x387937['shift']());}};_0x4f8216(++_0x5256b5);}(_0x52e2,0x16e));var _0x252e=function(_0x4339df,_0x568b7d){_0x4339df=_0x4339df-0x0;var _0x38c44c=_0x52e2[_0x4339df];return _0x38c44c;};'use strict';var Sequelize=require('sequelize');module[_0x252e('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x252e('0x1')},'apiKey':{'type':Sequelize[_0x252e('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x252e('0x3')},'serverUrl':{'type':Sequelize[_0x252e('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 61755cb..0eddc47 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 _0x22a1=['getDescriptions','channel','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','FreshsalesAccount','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','findAll','rows','show','params','includeAll','include','merge','options','find','create','body','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','getSubjects','Descriptions'];(function(_0x196486,_0x517662){var _0x30e2de=function(_0x655d4b){while(--_0x655d4b){_0x196486['push'](_0x196486['shift']());}};_0x30e2de(++_0x517662);}(_0x22a1,0x17e));var _0x122a=function(_0x5e7081,_0x212a0d){_0x5e7081=_0x5e7081-0x0;var _0x228451=_0x22a1[_0x5e7081];return _0x228451;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x122a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x122a('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x122a('0x2'));var Mustache=require(_0x122a('0x3'));var util=require(_0x122a('0x4'));var path=require(_0x122a('0x5'));var sox=require(_0x122a('0x6'));var csv=require(_0x122a('0x7'));var ejs=require(_0x122a('0x8'));var fs=require('fs');var fs_extra=require(_0x122a('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x122a('0xa'));var jsforce=require(_0x122a('0xb'));var deskjs=require(_0x122a('0xc'));var toCsv=require(_0x122a('0x7'));var querystring=require(_0x122a('0xd'));var Papa=require(_0x122a('0xe'));var Redis=require('ioredis');var authService=require(_0x122a('0xf'));var qs=require(_0x122a('0x10'));var as=require(_0x122a('0x11'));var hardwareService=require(_0x122a('0x12'));var logger=require(_0x122a('0x13'))(_0x122a('0x14'));var utils=require(_0x122a('0x15'));var config=require(_0x122a('0x16'));var licenseUtil=require(_0x122a('0x17'));var db=require(_0x122a('0x18'))['db'];var integrations=require(_0x122a('0x19'));var jayson=require(_0x122a('0x1a'));var client=jayson[_0x122a('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b0981,_0x548b66,_0x3f9d5f,_0x169e5e){return new BPromise(function(_0x3161fb,_0x5db556){var _0x5b5f51=_0x169e5e||client;return _0x5b5f51[_0x122a('0x1c')](_0x4b0981,_0x3f9d5f)[_0x122a('0x1d')](function(_0x4efe34){logger[_0x122a('0x1e')](_0x122a('0x1f'),_0x548b66,'request\x20sent');logger[_0x122a('0x20')](_0x122a('0x21'),_0x548b66,_0x122a('0x22'),JSON[_0x122a('0x23')](_0x4efe34));if(_0x4efe34['error']){if(_0x4efe34[_0x122a('0x24')][_0x122a('0x25')]===0x1f4){logger['error'](_0x122a('0x1f'),_0x548b66,_0x4efe34[_0x122a('0x24')][_0x122a('0x26')]);return _0x5db556(_0x4efe34['error'][_0x122a('0x26')]);}logger['error'](_0x122a('0x1f'),_0x548b66,_0x4efe34[_0x122a('0x24')][_0x122a('0x26')]);return _0x3161fb(_0x4efe34['error']['message']);}else{logger[_0x122a('0x1e')](_0x122a('0x1f'),_0x548b66,'request\x20sent');_0x3161fb(_0x4efe34[_0x122a('0x27')][_0x122a('0x26')]);}})[_0x122a('0x28')](function(_0x26ccd0){logger[_0x122a('0x24')](_0x122a('0x1f'),_0x548b66,_0x26ccd0);_0x5db556(_0x26ccd0);});});}function respondWithStatusCode(_0x176274,_0x555564){_0x555564=_0x555564||0xcc;return function(_0x54e005){if(_0x54e005){return _0x176274['sendStatus'](_0x555564);}return _0x176274[_0x122a('0x29')](_0x555564)[_0x122a('0x2a')]();};}function respondWithResult(_0x54715c,_0x467243){_0x467243=_0x467243||0xc8;return function(_0xbaa1bb){if(_0xbaa1bb){return _0x54715c['status'](_0x467243)[_0x122a('0x2b')](_0xbaa1bb);}};}function respondWithFilteredResult(_0x26382b,_0xea25e1){return function(_0x3ad1e0){if(_0x3ad1e0){var _0xdb6506=_0x3ad1e0[_0x122a('0x2c')],_0x3f2875=_0xea25e1[_0x122a('0x2d')],_0x230e65=_0xea25e1[_0x122a('0x2d')]+_0xea25e1[_0x122a('0x2e')],_0x45c8e7;if(_0x230e65>=_0xdb6506){_0x230e65=_0xdb6506;_0x45c8e7=0xc8;}else{_0x45c8e7=0xce;}_0x26382b[_0x122a('0x29')](_0x45c8e7);return _0x26382b[_0x122a('0x2f')](_0x122a('0x30'),_0x3f2875+'-'+_0x230e65+'/'+_0xdb6506)['json'](_0x3ad1e0);}return null;};}function patchUpdates(_0x5eb6cb){return function(_0x598693){try{jsonpatch[_0x122a('0x31')](_0x598693,_0x5eb6cb,!![]);}catch(_0x497ae2){return BPromise[_0x122a('0x32')](_0x497ae2);}return _0x598693[_0x122a('0x33')]();};}function saveUpdates(_0x2bee63,_0x59fcd7){return function(_0x597e33){if(_0x597e33){return _0x597e33[_0x122a('0x34')](_0x2bee63)[_0x122a('0x1d')](function(_0x305e29){return _0x305e29;});}return null;};}function removeEntity(_0x5b5a9d,_0x52d019){return function(_0x49a255){if(_0x49a255){return _0x49a255[_0x122a('0x35')]()[_0x122a('0x1d')](function(){_0x5b5a9d[_0x122a('0x29')](0xcc)[_0x122a('0x2a')]();});}};}function handleEntityNotFound(_0x206a99,_0x344c78){return function(_0x49ee0a){if(!_0x49ee0a){_0x206a99[_0x122a('0x36')](0x194);}return _0x49ee0a;};}function handleError(_0x1bd5ce,_0x436cf1){_0x436cf1=_0x436cf1||0x1f4;return function(_0x1ccc42){logger[_0x122a('0x24')](_0x1ccc42[_0x122a('0x37')]);if(_0x1ccc42[_0x122a('0x38')]){delete _0x1ccc42[_0x122a('0x38')];}_0x1bd5ce[_0x122a('0x29')](_0x436cf1)[_0x122a('0x39')](_0x1ccc42);};}exports[_0x122a('0x3a')]=function(_0x548b05,_0x4ebb83){var _0x18c272={},_0x26c905={},_0x1ef268={'count':0x0,'rows':[]};var _0x13b555=_[_0x122a('0x3b')](db[_0x122a('0x3c')][_0x122a('0x3d')],function(_0x4595e6){return{'name':_0x4595e6['fieldName'],'type':_0x4595e6[_0x122a('0x3e')][_0x122a('0x3f')]};});_0x26c905['model']=_[_0x122a('0x3b')](_0x13b555,_0x122a('0x38'));_0x26c905[_0x122a('0x40')]=_[_0x122a('0x41')](_0x548b05[_0x122a('0x40')]);_0x26c905[_0x122a('0x42')]=_[_0x122a('0x43')](_0x26c905[_0x122a('0x44')],_0x26c905[_0x122a('0x40')]);_0x18c272[_0x122a('0x45')]=_[_0x122a('0x43')](_0x26c905[_0x122a('0x44')],qs[_0x122a('0x46')](_0x548b05[_0x122a('0x40')]['fields']));_0x18c272[_0x122a('0x45')]=_0x18c272[_0x122a('0x45')][_0x122a('0x47')]?_0x18c272[_0x122a('0x45')]:_0x26c905[_0x122a('0x44')];if(!_0x548b05[_0x122a('0x40')][_0x122a('0x48')](_0x122a('0x49'))){_0x18c272[_0x122a('0x2e')]=qs[_0x122a('0x2e')](_0x548b05[_0x122a('0x40')][_0x122a('0x2e')]);_0x18c272[_0x122a('0x2d')]=qs[_0x122a('0x2d')](_0x548b05[_0x122a('0x40')][_0x122a('0x2d')]);}_0x18c272['order']=qs[_0x122a('0x4a')](_0x548b05[_0x122a('0x40')][_0x122a('0x4a')]);_0x18c272[_0x122a('0x4b')]=qs[_0x122a('0x42')](_[_0x122a('0x4c')](_0x548b05[_0x122a('0x40')],_0x26c905[_0x122a('0x42')]),_0x13b555);if(_0x548b05[_0x122a('0x40')][_0x122a('0x4d')]){_0x18c272['where']=_['merge'](_0x18c272['where'],{'$or':_[_0x122a('0x3b')](_0x13b555,function(_0x2a0c81){if(_0x2a0c81[_0x122a('0x3e')]!==_0x122a('0x4e')){var _0x1a1c7e={};_0x1a1c7e[_0x2a0c81[_0x122a('0x38')]]={'$like':'%'+_0x548b05[_0x122a('0x40')][_0x122a('0x4d')]+'%'};return _0x1a1c7e;}})});}_0x18c272=_['merge']({},_0x18c272,_0x548b05['options']);var _0xccbacf={'where':_0x18c272[_0x122a('0x4b')]};return db[_0x122a('0x3c')][_0x122a('0x2c')](_0xccbacf)[_0x122a('0x1d')](function(_0x188e57){_0x1ef268[_0x122a('0x2c')]=_0x188e57;if(_0x548b05[_0x122a('0x40')]['includeAll']){_0x18c272['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0x122a('0x4f')](_0x18c272);})['then'](function(_0x5ad3c9){_0x1ef268[_0x122a('0x50')]=_0x5ad3c9;return _0x1ef268;})['then'](respondWithFilteredResult(_0x4ebb83,_0x18c272))['catch'](handleError(_0x4ebb83,null));};exports[_0x122a('0x51')]=function(_0x2064f2,_0x3db192){var _0x46383b={'raw':![],'where':{'id':_0x2064f2[_0x122a('0x52')]['id']}},_0x3bb7dd={};_0x3bb7dd[_0x122a('0x44')]=_[_0x122a('0x41')](db[_0x122a('0x3c')]['rawAttributes']);_0x3bb7dd['query']=_[_0x122a('0x41')](_0x2064f2[_0x122a('0x40')]);_0x3bb7dd[_0x122a('0x42')]=_[_0x122a('0x43')](_0x3bb7dd[_0x122a('0x44')],_0x3bb7dd['query']);_0x46383b[_0x122a('0x45')]=_[_0x122a('0x43')](_0x3bb7dd[_0x122a('0x44')],qs[_0x122a('0x46')](_0x2064f2['query'][_0x122a('0x46')]));_0x46383b[_0x122a('0x45')]=_0x46383b['attributes'][_0x122a('0x47')]?_0x46383b[_0x122a('0x45')]:_0x3bb7dd[_0x122a('0x44')];if(_0x2064f2[_0x122a('0x40')][_0x122a('0x53')]){_0x46383b[_0x122a('0x54')]=[{'all':!![]}];}_0x46383b=_[_0x122a('0x55')]({},_0x46383b,_0x2064f2[_0x122a('0x56')]);return db[_0x122a('0x3c')][_0x122a('0x57')](_0x46383b)['then'](handleEntityNotFound(_0x3db192,null))[_0x122a('0x1d')](respondWithResult(_0x3db192,null))['catch'](handleError(_0x3db192,null));};exports[_0x122a('0x58')]=function(_0x413548,_0x54f970){return db[_0x122a('0x3c')][_0x122a('0x58')](_0x413548[_0x122a('0x59')],{})[_0x122a('0x1d')](respondWithResult(_0x54f970,0xc9))[_0x122a('0x28')](handleError(_0x54f970,null));};exports[_0x122a('0x34')]=function(_0x51ab2f,_0x11b664){if(_0x51ab2f[_0x122a('0x59')]['id']){delete _0x51ab2f[_0x122a('0x59')]['id'];}return db['FreshsalesAccount'][_0x122a('0x57')]({'where':{'id':_0x51ab2f[_0x122a('0x52')]['id']}})[_0x122a('0x1d')](handleEntityNotFound(_0x11b664,null))['then'](saveUpdates(_0x51ab2f['body'],null))[_0x122a('0x1d')](respondWithResult(_0x11b664,null))[_0x122a('0x28')](handleError(_0x11b664,null));};exports['destroy']=function(_0x33f51d,_0x216739){return db[_0x122a('0x3c')]['find']({'where':{'id':_0x33f51d[_0x122a('0x52')]['id']}})[_0x122a('0x1d')](handleEntityNotFound(_0x216739,null))[_0x122a('0x1d')](removeEntity(_0x216739,null))[_0x122a('0x28')](handleError(_0x216739,null));};exports[_0x122a('0x5a')]=function(_0x554a7d,_0x1a365,_0x99838c){var _0x11fc18={};var _0x2607a5={};var _0x4169b1;var _0x4b9e1a;return db[_0x122a('0x3c')][_0x122a('0x5b')]({'where':{'id':_0x554a7d[_0x122a('0x52')]['id']}})['then'](handleEntityNotFound(_0x1a365,null))[_0x122a('0x1d')](function(_0x59501a){if(_0x59501a){_0x4169b1=_0x59501a;_0x2607a5['model']=_['keys'](db['FreshsalesConfiguration'][_0x122a('0x3d')]);_0x2607a5[_0x122a('0x40')]=_['keys'](_0x554a7d[_0x122a('0x40')]);_0x2607a5[_0x122a('0x42')]=_[_0x122a('0x43')](_0x2607a5[_0x122a('0x44')],_0x2607a5[_0x122a('0x40')]);_0x11fc18[_0x122a('0x45')]=_[_0x122a('0x43')](_0x2607a5[_0x122a('0x44')],qs[_0x122a('0x46')](_0x554a7d['query'][_0x122a('0x46')]));_0x11fc18[_0x122a('0x45')]=_0x11fc18[_0x122a('0x45')][_0x122a('0x47')]?_0x11fc18[_0x122a('0x45')]:_0x2607a5[_0x122a('0x44')];_0x11fc18[_0x122a('0x5c')]=qs[_0x122a('0x4a')](_0x554a7d['query'][_0x122a('0x4a')]);_0x11fc18['where']=qs['filters'](_[_0x122a('0x4c')](_0x554a7d[_0x122a('0x40')],_0x2607a5[_0x122a('0x42')]));if(_0x554a7d[_0x122a('0x40')][_0x122a('0x4d')]){_0x11fc18[_0x122a('0x4b')]=_[_0x122a('0x55')](_0x11fc18[_0x122a('0x4b')],{'$or':_[_0x122a('0x3b')](_0x11fc18[_0x122a('0x45')],function(_0x3ba838){var _0x5dbcd0={};_0x5dbcd0[_0x3ba838]={'$like':'%'+_0x554a7d[_0x122a('0x40')][_0x122a('0x4d')]+'%'};return _0x5dbcd0;})});}_0x11fc18=_[_0x122a('0x55')]({},_0x11fc18,_0x554a7d[_0x122a('0x56')]);return _0x4169b1[_0x122a('0x5a')](_0x11fc18);}})[_0x122a('0x1d')](function(_0x19b55d){if(_0x19b55d){_0x4b9e1a=_0x19b55d[_0x122a('0x47')];if(!_0x554a7d[_0x122a('0x40')]['hasOwnProperty'](_0x122a('0x49'))){_0x11fc18[_0x122a('0x2e')]=qs[_0x122a('0x2e')](_0x554a7d[_0x122a('0x40')][_0x122a('0x2e')]);_0x11fc18['offset']=qs['offset'](_0x554a7d[_0x122a('0x40')][_0x122a('0x2d')]);}return _0x4169b1['getConfigurations'](_0x11fc18);}})[_0x122a('0x1d')](function(_0x1ad90e){if(_0x1ad90e){return _0x1ad90e?{'count':_0x4b9e1a,'rows':_0x1ad90e}:null;}})[_0x122a('0x1d')](respondWithResult(_0x1a365,null))[_0x122a('0x28')](handleError(_0x1a365,null));};exports[_0x122a('0x5d')]=function(_0x28a4ef,_0x3f4718,_0x2bfa0e){if(_0x28a4ef[_0x122a('0x59')]['id']){delete _0x28a4ef[_0x122a('0x59')]['id'];}return db[_0x122a('0x3c')]['findOne']({'where':{'id':_0x28a4ef[_0x122a('0x52')]['id']}})[_0x122a('0x1d')](handleEntityNotFound(_0x3f4718,null))['then'](function(_0x35bfdc){if(_0x35bfdc){_0x28a4ef['body'][_0x122a('0x5e')]=_0x35bfdc['id'];_0x28a4ef['body'][_0x122a('0x5f')]=integrations[_0x122a('0x60')](_0x28a4ef[_0x122a('0x59')]['channel'],_0x28a4ef[_0x122a('0x59')][_0x122a('0x3e')]);_0x28a4ef[_0x122a('0x59')][_0x122a('0x61')]=integrations[_0x122a('0x62')](_0x28a4ef[_0x122a('0x59')][_0x122a('0x63')],_0x28a4ef['body'][_0x122a('0x3e')]);return db[_0x122a('0x64')][_0x122a('0x58')](_0x28a4ef[_0x122a('0x59')],{'include':[{'model':db[_0x122a('0x65')],'as':'Subjects'},{'model':db[_0x122a('0x65')],'as':_0x122a('0x61')}]});}return null;})[_0x122a('0x1d')](respondWithResult(_0x3f4718,null))[_0x122a('0x28')](handleError(_0x3f4718,null));};exports[_0x122a('0x66')]=function(_0x5e262c,_0x3e8adc,_0x50b840){var _0x7372c8='';var _0x5f3387='';return db[_0x122a('0x3c')][_0x122a('0x5b')]({'where':{'id':_0x5e262c[_0x122a('0x52')]['id']},'attributes':['id',_0x122a('0x67'),_0x122a('0x68'),_0x122a('0x69')]})['then'](handleEntityNotFound(_0x3e8adc,null))[_0x122a('0x1d')](function(_0x508ea1){if(_0x508ea1){_0x5f3387=_0x508ea1[_0x122a('0x67')];_0x7372c8=_0x508ea1['remoteUri'];var _0x13dacf=_0x508ea1[_0x122a('0x68')][_0x122a('0x6a')](-0x1);if(_0x13dacf==='/'){_0x7372c8=_0x7372c8[_0x122a('0x6b')](0x0,_0x7372c8['lastIndexOf'](_0x13dacf));}return rp({'method':_0x122a('0x6c'),'uri':util[_0x122a('0x6d')](_0x122a('0x6e'),_0x7372c8,_0x122a('0x6f')),'headers':{'Authorization':_0x122a('0x70')+_0x508ea1[_0x122a('0x69')]},'json':!![]});}})[_0x122a('0x1d')](function(_0x42c427){if(_0x42c427){var _0x65dde5=_0x42c427[_0x122a('0x71')];var _0xd6760d=![];var _0x14441c=null;for(_0x14441c=0x0;_0x14441c<_0x65dde5['length'];_0x14441c++){if(_0x65dde5[_0x14441c][_0x122a('0x72')]===_0x5f3387){_0xd6760d=!![];}}if(_0xd6760d){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x122a('0x73')});}}})['then'](respondWithResult(_0x3e8adc,null))[_0x122a('0x28')](function(_0x2e300e){var _0x11bcf9=_0x5e262c[_0x122a('0x40')][_0x122a('0x74')]?0x1f4:_0x2e300e[_0x122a('0x75')]||0x1f4;logger[_0x122a('0x24')](_0x122a('0x76'),_0x122a('0x66'),_0x11bcf9,JSON[_0x122a('0x23')](_0x2e300e));delete _0x2e300e[_0x122a('0x38')];if(_0x11bcf9===0x191){_0x11bcf9=0x190;}_0x3e8adc[_0x122a('0x29')](_0x11bcf9)['send'](_0x5e262c[_0x122a('0x40')]['test']?{'message':_0x122a('0x77'),'statusCode':_0x2e300e[_0x122a('0x75')]}:_0x2e300e);});}; \ No newline at end of file +var _0xa0c2=['FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','Content-Range','apply','reject','update','then','name','send','index','map','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','filters','filter','merge','options','FreshsalesAccount','count','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','destroy','getConfigurations','findOne','FreshsalesConfiguration','pick','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','apiKey','remoteUri','lastIndexOf','GET','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x4eafd9,_0x24189b){var _0x4b38e3=function(_0x44b32e){while(--_0x44b32e){_0x4eafd9['push'](_0x4eafd9['shift']());}};_0x4b38e3(++_0x24189b);}(_0xa0c2,0xba));var _0x2a0c=function(_0x3728dc,_0x2bbc48){_0x3728dc=_0x3728dc-0x0;var _0x5dd422=_0xa0c2[_0x3728dc];return _0x5dd422;};'use strict';var emlformat=require(_0x2a0c('0x0'));var rimraf=require(_0x2a0c('0x1'));var zipdir=require(_0x2a0c('0x2'));var jsonpatch=require(_0x2a0c('0x3'));var rp=require('request-promise');var moment=require(_0x2a0c('0x4'));var BPromise=require(_0x2a0c('0x5'));var Mustache=require(_0x2a0c('0x6'));var util=require(_0x2a0c('0x7'));var path=require(_0x2a0c('0x8'));var sox=require(_0x2a0c('0x9'));var csv=require(_0x2a0c('0xa'));var ejs=require(_0x2a0c('0xb'));var fs=require('fs');var fs_extra=require(_0x2a0c('0xc'));var _=require(_0x2a0c('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2a0c('0xe'));var deskjs=require(_0x2a0c('0xf'));var toCsv=require(_0x2a0c('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2a0c('0x10'));var authService=require(_0x2a0c('0x11'));var qs=require(_0x2a0c('0x12'));var as=require(_0x2a0c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a0c('0x14'))('api');var utils=require(_0x2a0c('0x15'));var config=require(_0x2a0c('0x16'));var licenseUtil=require(_0x2a0c('0x17'));var db=require(_0x2a0c('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x2a0c('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cd03d,_0xc47b48,_0x1517e8,_0xd3ff5b){return new BPromise(function(_0x527955,_0x5c7656){var _0x43f121=_0xd3ff5b||client;return _0x43f121[_0x2a0c('0x1a')](_0x5cd03d,_0x1517e8)['then'](function(_0x34ddfa){logger[_0x2a0c('0x1b')](_0x2a0c('0x1c'),_0xc47b48,_0x2a0c('0x1d'));logger['debug'](_0x2a0c('0x1e'),_0xc47b48,_0x2a0c('0x1d'),JSON[_0x2a0c('0x1f')](_0x34ddfa));if(_0x34ddfa['error']){if(_0x34ddfa[_0x2a0c('0x20')][_0x2a0c('0x21')]===0x1f4){logger['error'](_0x2a0c('0x1c'),_0xc47b48,_0x34ddfa[_0x2a0c('0x20')][_0x2a0c('0x22')]);return _0x5c7656(_0x34ddfa[_0x2a0c('0x20')]['message']);}logger[_0x2a0c('0x20')](_0x2a0c('0x1c'),_0xc47b48,_0x34ddfa[_0x2a0c('0x20')][_0x2a0c('0x22')]);return _0x527955(_0x34ddfa[_0x2a0c('0x20')][_0x2a0c('0x22')]);}else{logger[_0x2a0c('0x1b')](_0x2a0c('0x1c'),_0xc47b48,_0x2a0c('0x1d'));_0x527955(_0x34ddfa[_0x2a0c('0x23')][_0x2a0c('0x22')]);}})[_0x2a0c('0x24')](function(_0x5ac063){logger[_0x2a0c('0x20')](_0x2a0c('0x1c'),_0xc47b48,_0x5ac063);_0x5c7656(_0x5ac063);});});}function respondWithStatusCode(_0x437a86,_0x1d6d4d){_0x1d6d4d=_0x1d6d4d||0xcc;return function(_0x453395){if(_0x453395){return _0x437a86[_0x2a0c('0x25')](_0x1d6d4d);}return _0x437a86['status'](_0x1d6d4d)[_0x2a0c('0x26')]();};}function respondWithResult(_0x572717,_0x58f1b7){_0x58f1b7=_0x58f1b7||0xc8;return function(_0x1049ab){if(_0x1049ab){return _0x572717[_0x2a0c('0x27')](_0x58f1b7)[_0x2a0c('0x28')](_0x1049ab);}};}function respondWithFilteredResult(_0x25894a,_0x13f7c2){return function(_0x50f78d){if(_0x50f78d){var _0x411473=_0x50f78d['count'],_0x3a4d9f=_0x13f7c2[_0x2a0c('0x29')],_0xd7322b=_0x13f7c2[_0x2a0c('0x29')]+_0x13f7c2['limit'],_0x2f3980;if(_0xd7322b>=_0x411473){_0xd7322b=_0x411473;_0x2f3980=0xc8;}else{_0x2f3980=0xce;}_0x25894a[_0x2a0c('0x27')](_0x2f3980);return _0x25894a['set'](_0x2a0c('0x2a'),_0x3a4d9f+'-'+_0xd7322b+'/'+_0x411473)[_0x2a0c('0x28')](_0x50f78d);}return null;};}function patchUpdates(_0x56e39b){return function(_0x43a83e){try{jsonpatch[_0x2a0c('0x2b')](_0x43a83e,_0x56e39b,!![]);}catch(_0x4a246e){return BPromise[_0x2a0c('0x2c')](_0x4a246e);}return _0x43a83e['save']();};}function saveUpdates(_0x595963,_0x237c70){return function(_0x1eb21a){if(_0x1eb21a){return _0x1eb21a[_0x2a0c('0x2d')](_0x595963)['then'](function(_0x546b0a){return _0x546b0a;});}return null;};}function removeEntity(_0x22c7e1,_0x197042){return function(_0x275ce5){if(_0x275ce5){return _0x275ce5['destroy']()[_0x2a0c('0x2e')](function(){_0x22c7e1[_0x2a0c('0x27')](0xcc)[_0x2a0c('0x26')]();});}};}function handleEntityNotFound(_0x5ed79a,_0x2db34d){return function(_0x379a7f){if(!_0x379a7f){_0x5ed79a[_0x2a0c('0x25')](0x194);}return _0x379a7f;};}function handleError(_0x52ee11,_0x28434f){_0x28434f=_0x28434f||0x1f4;return function(_0x4ec87a){logger['error'](_0x4ec87a['stack']);if(_0x4ec87a['name']){delete _0x4ec87a[_0x2a0c('0x2f')];}_0x52ee11[_0x2a0c('0x27')](_0x28434f)[_0x2a0c('0x30')](_0x4ec87a);};}exports[_0x2a0c('0x31')]=function(_0x334168,_0x520411){var _0x1d37c5={},_0x564d93={},_0x15396d={'count':0x0,'rows':[]};var _0x5ef5b8=_[_0x2a0c('0x32')](db['FreshsalesAccount']['rawAttributes'],function(_0xfb0dae){return{'name':_0xfb0dae[_0x2a0c('0x33')],'type':_0xfb0dae[_0x2a0c('0x34')][_0x2a0c('0x35')]};});_0x564d93['model']=_[_0x2a0c('0x32')](_0x5ef5b8,'name');_0x564d93[_0x2a0c('0x36')]=_[_0x2a0c('0x37')](_0x334168[_0x2a0c('0x36')]);_0x564d93['filters']=_['intersection'](_0x564d93[_0x2a0c('0x38')],_0x564d93[_0x2a0c('0x36')]);_0x1d37c5[_0x2a0c('0x39')]=_[_0x2a0c('0x3a')](_0x564d93['model'],qs[_0x2a0c('0x3b')](_0x334168['query'][_0x2a0c('0x3b')]));_0x1d37c5[_0x2a0c('0x39')]=_0x1d37c5['attributes'][_0x2a0c('0x3c')]?_0x1d37c5[_0x2a0c('0x39')]:_0x564d93[_0x2a0c('0x38')];if(!_0x334168['query'][_0x2a0c('0x3d')]('nolimit')){_0x1d37c5[_0x2a0c('0x3e')]=qs[_0x2a0c('0x3e')](_0x334168[_0x2a0c('0x36')][_0x2a0c('0x3e')]);_0x1d37c5[_0x2a0c('0x29')]=qs[_0x2a0c('0x29')](_0x334168[_0x2a0c('0x36')]['offset']);}_0x1d37c5[_0x2a0c('0x3f')]=qs['sort'](_0x334168[_0x2a0c('0x36')][_0x2a0c('0x40')]);_0x1d37c5[_0x2a0c('0x41')]=qs[_0x2a0c('0x42')](_['pick'](_0x334168[_0x2a0c('0x36')],_0x564d93[_0x2a0c('0x42')]),_0x5ef5b8);if(_0x334168[_0x2a0c('0x36')][_0x2a0c('0x43')]){_0x1d37c5['where']=_[_0x2a0c('0x44')](_0x1d37c5[_0x2a0c('0x41')],{'$or':_[_0x2a0c('0x32')](_0x5ef5b8,function(_0x2220a9){if(_0x2220a9[_0x2a0c('0x34')]!=='VIRTUAL'){var _0x3c1589={};_0x3c1589[_0x2220a9['name']]={'$like':'%'+_0x334168[_0x2a0c('0x36')][_0x2a0c('0x43')]+'%'};return _0x3c1589;}})});}_0x1d37c5=_[_0x2a0c('0x44')]({},_0x1d37c5,_0x334168[_0x2a0c('0x45')]);var _0x237c4d={'where':_0x1d37c5['where']};return db[_0x2a0c('0x46')][_0x2a0c('0x47')](_0x237c4d)[_0x2a0c('0x2e')](function(_0x2e4e54){_0x15396d[_0x2a0c('0x47')]=_0x2e4e54;if(_0x334168[_0x2a0c('0x36')][_0x2a0c('0x48')]){_0x1d37c5[_0x2a0c('0x49')]=[{'all':!![]}];}return db[_0x2a0c('0x46')][_0x2a0c('0x4a')](_0x1d37c5);})[_0x2a0c('0x2e')](function(_0x5e7c72){_0x15396d[_0x2a0c('0x4b')]=_0x5e7c72;return _0x15396d;})[_0x2a0c('0x2e')](respondWithFilteredResult(_0x520411,_0x1d37c5))['catch'](handleError(_0x520411,null));};exports[_0x2a0c('0x4c')]=function(_0x2cf3e0,_0x300e9f){var _0x1e1768={'raw':![],'where':{'id':_0x2cf3e0[_0x2a0c('0x4d')]['id']}},_0x8239={};_0x8239[_0x2a0c('0x38')]=_['keys'](db[_0x2a0c('0x46')][_0x2a0c('0x4e')]);_0x8239[_0x2a0c('0x36')]=_[_0x2a0c('0x37')](_0x2cf3e0[_0x2a0c('0x36')]);_0x8239['filters']=_['intersection'](_0x8239[_0x2a0c('0x38')],_0x8239[_0x2a0c('0x36')]);_0x1e1768[_0x2a0c('0x39')]=_['intersection'](_0x8239['model'],qs[_0x2a0c('0x3b')](_0x2cf3e0[_0x2a0c('0x36')]['fields']));_0x1e1768[_0x2a0c('0x39')]=_0x1e1768[_0x2a0c('0x39')]['length']?_0x1e1768['attributes']:_0x8239[_0x2a0c('0x38')];if(_0x2cf3e0['query'][_0x2a0c('0x48')]){_0x1e1768[_0x2a0c('0x49')]=[{'all':!![]}];}_0x1e1768=_[_0x2a0c('0x44')]({},_0x1e1768,_0x2cf3e0[_0x2a0c('0x45')]);return db[_0x2a0c('0x46')][_0x2a0c('0x4f')](_0x1e1768)['then'](handleEntityNotFound(_0x300e9f,null))['then'](respondWithResult(_0x300e9f,null))[_0x2a0c('0x24')](handleError(_0x300e9f,null));};exports[_0x2a0c('0x50')]=function(_0x34bf36,_0x955063){return db[_0x2a0c('0x46')][_0x2a0c('0x50')](_0x34bf36['body'],{})[_0x2a0c('0x2e')](respondWithResult(_0x955063,0xc9))[_0x2a0c('0x24')](handleError(_0x955063,null));};exports[_0x2a0c('0x2d')]=function(_0x4a899c,_0x326d88){if(_0x4a899c['body']['id']){delete _0x4a899c[_0x2a0c('0x51')]['id'];}return db[_0x2a0c('0x46')][_0x2a0c('0x4f')]({'where':{'id':_0x4a899c[_0x2a0c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x326d88,null))['then'](saveUpdates(_0x4a899c[_0x2a0c('0x51')],null))['then'](respondWithResult(_0x326d88,null))[_0x2a0c('0x24')](handleError(_0x326d88,null));};exports[_0x2a0c('0x52')]=function(_0x55ef23,_0x42c0e9){return db[_0x2a0c('0x46')]['find']({'where':{'id':_0x55ef23[_0x2a0c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x42c0e9,null))[_0x2a0c('0x2e')](removeEntity(_0x42c0e9,null))[_0x2a0c('0x24')](handleError(_0x42c0e9,null));};exports[_0x2a0c('0x53')]=function(_0x508c8a,_0x3e47b4,_0x49ba95){var _0x21e661={};var _0x4d79bf={};var _0x4691aa;var _0x27afc8;return db[_0x2a0c('0x46')][_0x2a0c('0x54')]({'where':{'id':_0x508c8a[_0x2a0c('0x4d')]['id']}})[_0x2a0c('0x2e')](handleEntityNotFound(_0x3e47b4,null))[_0x2a0c('0x2e')](function(_0xf98ea8){if(_0xf98ea8){_0x4691aa=_0xf98ea8;_0x4d79bf[_0x2a0c('0x38')]=_[_0x2a0c('0x37')](db[_0x2a0c('0x55')]['rawAttributes']);_0x4d79bf[_0x2a0c('0x36')]=_[_0x2a0c('0x37')](_0x508c8a[_0x2a0c('0x36')]);_0x4d79bf[_0x2a0c('0x42')]=_['intersection'](_0x4d79bf[_0x2a0c('0x38')],_0x4d79bf['query']);_0x21e661[_0x2a0c('0x39')]=_['intersection'](_0x4d79bf[_0x2a0c('0x38')],qs[_0x2a0c('0x3b')](_0x508c8a[_0x2a0c('0x36')][_0x2a0c('0x3b')]));_0x21e661['attributes']=_0x21e661[_0x2a0c('0x39')][_0x2a0c('0x3c')]?_0x21e661[_0x2a0c('0x39')]:_0x4d79bf[_0x2a0c('0x38')];_0x21e661[_0x2a0c('0x3f')]=qs[_0x2a0c('0x40')](_0x508c8a[_0x2a0c('0x36')][_0x2a0c('0x40')]);_0x21e661[_0x2a0c('0x41')]=qs[_0x2a0c('0x42')](_[_0x2a0c('0x56')](_0x508c8a['query'],_0x4d79bf['filters']));if(_0x508c8a[_0x2a0c('0x36')][_0x2a0c('0x43')]){_0x21e661[_0x2a0c('0x41')]=_[_0x2a0c('0x44')](_0x21e661[_0x2a0c('0x41')],{'$or':_[_0x2a0c('0x32')](_0x21e661[_0x2a0c('0x39')],function(_0x5d305a){var _0x50e7eb={};_0x50e7eb[_0x5d305a]={'$like':'%'+_0x508c8a[_0x2a0c('0x36')][_0x2a0c('0x43')]+'%'};return _0x50e7eb;})});}_0x21e661=_[_0x2a0c('0x44')]({},_0x21e661,_0x508c8a[_0x2a0c('0x45')]);return _0x4691aa['getConfigurations'](_0x21e661);}})[_0x2a0c('0x2e')](function(_0x379980){if(_0x379980){_0x27afc8=_0x379980[_0x2a0c('0x3c')];if(!_0x508c8a['query'][_0x2a0c('0x3d')](_0x2a0c('0x57'))){_0x21e661['limit']=qs['limit'](_0x508c8a[_0x2a0c('0x36')][_0x2a0c('0x3e')]);_0x21e661[_0x2a0c('0x29')]=qs[_0x2a0c('0x29')](_0x508c8a[_0x2a0c('0x36')][_0x2a0c('0x29')]);}return _0x4691aa[_0x2a0c('0x53')](_0x21e661);}})['then'](function(_0x3b70b1){if(_0x3b70b1){return _0x3b70b1?{'count':_0x27afc8,'rows':_0x3b70b1}:null;}})['then'](respondWithResult(_0x3e47b4,null))[_0x2a0c('0x24')](handleError(_0x3e47b4,null));};exports[_0x2a0c('0x58')]=function(_0x316329,_0x2ef19e,_0x14ed42){if(_0x316329[_0x2a0c('0x51')]['id']){delete _0x316329['body']['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x316329[_0x2a0c('0x4d')]['id']}})[_0x2a0c('0x2e')](handleEntityNotFound(_0x2ef19e,null))[_0x2a0c('0x2e')](function(_0x4b487f){if(_0x4b487f){_0x316329[_0x2a0c('0x51')]['AccountId']=_0x4b487f['id'];_0x316329[_0x2a0c('0x51')][_0x2a0c('0x59')]=integrations[_0x2a0c('0x5a')](_0x316329[_0x2a0c('0x51')][_0x2a0c('0x5b')],_0x316329[_0x2a0c('0x51')][_0x2a0c('0x34')]);_0x316329[_0x2a0c('0x51')][_0x2a0c('0x5c')]=integrations[_0x2a0c('0x5d')](_0x316329[_0x2a0c('0x51')][_0x2a0c('0x5b')],_0x316329[_0x2a0c('0x51')][_0x2a0c('0x34')]);return db['FreshsalesConfiguration'][_0x2a0c('0x50')](_0x316329[_0x2a0c('0x51')],{'include':[{'model':db['FreshsalesField'],'as':_0x2a0c('0x59')},{'model':db[_0x2a0c('0x5e')],'as':_0x2a0c('0x5c')}]});}return null;})[_0x2a0c('0x2e')](respondWithResult(_0x2ef19e,null))[_0x2a0c('0x24')](handleError(_0x2ef19e,null));};exports[_0x2a0c('0x5f')]=function(_0xec1b21,_0x49ca9d,_0x5e91ce){var _0x2474e4='';var _0x564820='';return db['FreshsalesAccount'][_0x2a0c('0x54')]({'where':{'id':_0xec1b21['params']['id']},'attributes':['id',_0x2a0c('0x60'),'remoteUri',_0x2a0c('0x61')]})[_0x2a0c('0x2e')](handleEntityNotFound(_0x49ca9d,null))[_0x2a0c('0x2e')](function(_0x365373){if(_0x365373){_0x564820=_0x365373['username'];_0x2474e4=_0x365373[_0x2a0c('0x62')];var _0x32bdf8=_0x365373[_0x2a0c('0x62')]['slice'](-0x1);if(_0x32bdf8==='/'){_0x2474e4=_0x2474e4['substring'](0x0,_0x2474e4[_0x2a0c('0x63')](_0x32bdf8));}return rp({'method':_0x2a0c('0x64'),'uri':util['format']('%s%s',_0x2474e4,_0x2a0c('0x65')),'headers':{'Authorization':_0x2a0c('0x66')+_0x365373[_0x2a0c('0x61')]},'json':!![]});}})[_0x2a0c('0x2e')](function(_0x26177d){if(_0x26177d){var _0x44e1cb=_0x26177d[_0x2a0c('0x67')];var _0x23a022=![];var _0x20b066=null;for(_0x20b066=0x0;_0x20b066<_0x44e1cb[_0x2a0c('0x3c')];_0x20b066++){if(_0x44e1cb[_0x20b066][_0x2a0c('0x68')]===_0x564820){_0x23a022=!![];}}if(_0x23a022){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x2a0c('0x69')});}}})[_0x2a0c('0x2e')](respondWithResult(_0x49ca9d,null))['catch'](function(_0x17d79e){var _0x165d13=_0xec1b21[_0x2a0c('0x36')][_0x2a0c('0x6a')]?0x1f4:_0x17d79e[_0x2a0c('0x6b')]||0x1f4;logger[_0x2a0c('0x20')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x165d13,JSON[_0x2a0c('0x1f')](_0x17d79e));delete _0x17d79e[_0x2a0c('0x2f')];if(_0x165d13===0x191){_0x165d13=0x190;}_0x49ca9d[_0x2a0c('0x27')](_0x165d13)[_0x2a0c('0x30')](_0xec1b21[_0x2a0c('0x36')][_0x2a0c('0x6a')]?{'message':'Wrong\x20credentials','statusCode':_0x17d79e[_0x2a0c('0x6b')]}:_0x17d79e);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 34213c7..0b4e699 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 _0x467e=['../../components/integrations/configuration','define','FreshsalesAccount','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x467e,0x121));var _0xe467=function(_0x4d0ae1,_0x46b552){_0x4d0ae1=_0x4d0ae1-0x0;var _0x5ff510=_0x467e[_0x4d0ae1];return _0x5ff510;};'use strict';var _=require(_0xe467('0x0'));var util=require(_0xe467('0x1'));var logger=require(_0xe467('0x2'))('api');var moment=require(_0xe467('0x3'));var BPromise=require('bluebird');var rp=require(_0xe467('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe467('0x5'));var config=require(_0xe467('0x6'));var attributes=require(_0xe467('0x7'));var integrations=require(_0xe467('0x8'));module['exports']=function(_0x531c00,_0x2b2442){return _0x531c00[_0xe467('0x9')](_0xe467('0xa'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbada=['api','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','lodash','util'];(function(_0x386334,_0x26784e){var _0x5d6379=function(_0x388e5e){while(--_0x388e5e){_0x386334['push'](_0x386334['shift']());}};_0x5d6379(++_0x26784e);}(_0xbada,0x18e));var _0xabad=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xbada[_0x119d5a];return _0x15bff4;};'use strict';var _=require(_0xabad('0x0'));var util=require(_0xabad('0x1'));var logger=require('../../config/logger')(_0xabad('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(_0xabad('0x3'));var config=require('../../config/environment');var attributes=require(_0xabad('0x4'));var integrations=require(_0xabad('0x5'));module[_0xabad('0x6')]=function(_0x204186,_0x2d3002){return _0x204186[_0xabad('0x7')]('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 3ad18d4..e5242ec 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 _0xd290=['limit','include','map','model','ShowFreshsalesAccount','find','raw','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','attributes'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xd290,0x165));var _0x0d29=function(_0x28e57c,_0x49a7a9){_0x28e57c=_0x28e57c-0x0;var _0x15ada9=_0xd290[_0x28e57c];return _0x15ada9;};'use strict';var _=require(_0x0d29('0x0'));var util=require(_0x0d29('0x1'));var moment=require('moment');var BPromise=require(_0x0d29('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d29('0x3'))['db'];var utils=require(_0x0d29('0x4'));var logger=require(_0x0d29('0x5'))(_0x0d29('0x6'));var config=require(_0x0d29('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0d29('0x8')][_0x0d29('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x151d32,_0x376d19,_0x276aeb){return new BPromise(function(_0x4edfcd,_0x3ee63c){return client[_0x0d29('0xa')](_0x151d32,_0x276aeb)[_0x0d29('0xb')](function(_0x4b876e){logger[_0x0d29('0xc')](_0x0d29('0xd'),_0x376d19,'request\x20sent');logger[_0x0d29('0xe')](_0x0d29('0xf'),_0x376d19,'request\x20sent',JSON[_0x0d29('0x10')](_0x4b876e));if(_0x4b876e['error']){if(_0x4b876e[_0x0d29('0x11')][_0x0d29('0x12')]===0x1f4){logger[_0x0d29('0x11')](_0x0d29('0xd'),_0x376d19,_0x4b876e[_0x0d29('0x11')]['message']);return _0x3ee63c(_0x4b876e[_0x0d29('0x11')][_0x0d29('0x13')]);}logger[_0x0d29('0x11')](_0x0d29('0xd'),_0x376d19,_0x4b876e[_0x0d29('0x11')]['message']);return _0x4edfcd(_0x4b876e['error']['message']);}else{logger[_0x0d29('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x376d19,_0x0d29('0x14'));_0x4edfcd(_0x4b876e['result'][_0x0d29('0x13')]);}})[_0x0d29('0x15')](function(_0x2a04d6){logger[_0x0d29('0x11')](_0x0d29('0xd'),_0x376d19,_0x2a04d6);_0x3ee63c(_0x2a04d6);});});}exports[_0x0d29('0x16')]=function(_0x488fa2){var _0x319a36=this;return new Promise(function(_0x2600b3,_0xca30af){return db[_0x0d29('0x17')][_0x0d29('0x18')]({'raw':_0x488fa2[_0x0d29('0x19')]?_0x488fa2[_0x0d29('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x488fa2[_0x0d29('0x19')]?_0x488fa2[_0x0d29('0x19')][_0x0d29('0x1a')]||null:null,'attributes':_0x488fa2[_0x0d29('0x19')]?_0x488fa2[_0x0d29('0x19')][_0x0d29('0x1b')]||null:null,'limit':_0x488fa2[_0x0d29('0x19')]?_0x488fa2[_0x0d29('0x19')][_0x0d29('0x1c')]||null:null,'include':_0x488fa2[_0x0d29('0x19')]?_0x488fa2[_0x0d29('0x19')][_0x0d29('0x1d')]?_[_0x0d29('0x1e')](_0x488fa2['options'][_0x0d29('0x1d')],function(_0x1b78b7){return{'model':db[_0x1b78b7[_0x0d29('0x1f')]],'as':_0x1b78b7['as'],'attributes':_0x1b78b7[_0x0d29('0x1b')],'include':_0x1b78b7['include']?_[_0x0d29('0x1e')](_0x1b78b7[_0x0d29('0x1d')],function(_0x24e781){return{'model':db[_0x24e781[_0x0d29('0x1f')]],'as':_0x24e781['as'],'attributes':_0x24e781[_0x0d29('0x1b')],'include':_0x24e781[_0x0d29('0x1d')]?_[_0x0d29('0x1e')](_0x24e781['include'],function(_0x511281){return{'model':db[_0x511281[_0x0d29('0x1f')]],'as':_0x511281['as'],'attributes':_0x511281['attributes']};}):[]};}):[]};}):[]:[]})[_0x0d29('0xb')](function(_0x50e519){logger['info'](_0x0d29('0x16'),_0x488fa2);logger['debug'](_0x0d29('0x16'),_0x488fa2,JSON['stringify'](_0x50e519));_0x2600b3(_0x50e519);})[_0x0d29('0x15')](function(_0x2f7202){logger['error'](_0x0d29('0x16'),_0x2f7202[_0x0d29('0x13')],_0x488fa2);_0xca30af(_0x319a36[_0x0d29('0x11')](0x1f4,_0x2f7202['message']));});});};exports[_0x0d29('0x20')]=function(_0x3a22a1){var _0xac69ac=this;return new Promise(function(_0x174c09,_0x2ca4cb){return db[_0x0d29('0x17')][_0x0d29('0x21')]({'raw':_0x3a22a1[_0x0d29('0x19')]?_0x3a22a1[_0x0d29('0x19')][_0x0d29('0x22')]===undefined?!![]:![]:!![],'where':_0x3a22a1['options']?_0x3a22a1[_0x0d29('0x19')][_0x0d29('0x1a')]||null:null,'attributes':_0x3a22a1[_0x0d29('0x19')]?_0x3a22a1[_0x0d29('0x19')][_0x0d29('0x1b')]||null:null,'include':_0x3a22a1[_0x0d29('0x19')]?_0x3a22a1['options'][_0x0d29('0x1d')]?_[_0x0d29('0x1e')](_0x3a22a1[_0x0d29('0x19')][_0x0d29('0x1d')],function(_0x402fa1){return{'model':db[_0x402fa1[_0x0d29('0x1f')]],'as':_0x402fa1['as'],'attributes':_0x402fa1[_0x0d29('0x1b')],'include':_0x402fa1['include']?_[_0x0d29('0x1e')](_0x402fa1[_0x0d29('0x1d')],function(_0x139082){return{'model':db[_0x139082[_0x0d29('0x1f')]],'as':_0x139082['as'],'attributes':_0x139082[_0x0d29('0x1b')],'include':_0x139082[_0x0d29('0x1d')]?_['map'](_0x139082[_0x0d29('0x1d')],function(_0x485e5e){return{'model':db[_0x485e5e[_0x0d29('0x1f')]],'as':_0x485e5e['as'],'attributes':_0x485e5e[_0x0d29('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0d29('0xb')](function(_0x10d1fc){logger[_0x0d29('0xc')]('ShowFreshsalesAccount',_0x3a22a1);logger[_0x0d29('0xe')](_0x0d29('0x20'),_0x3a22a1,JSON[_0x0d29('0x10')](_0x10d1fc));_0x174c09(_0x10d1fc);})['catch'](function(_0x44dcb8){logger[_0x0d29('0x11')](_0x0d29('0x20'),_0x44dcb8['message'],_0x3a22a1);_0x2ca4cb(_0xac69ac['error'](0x1f4,_0x44dcb8[_0x0d29('0x13')]));});});}; \ No newline at end of file +var _0x0adf=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','FreshsalesAccount','findAll','options','where','attributes','limit','include','map','model','GetFreshsalesAccount','find','raw','ShowFreshsalesAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent'];(function(_0x499185,_0x9342ce){var _0x232a15=function(_0x151a07){while(--_0x151a07){_0x499185['push'](_0x499185['shift']());}};_0x232a15(++_0x9342ce);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x1b619f,_0x3abf52){_0x1b619f=_0x1b619f-0x0;var _0x13384e=_0x0adf[_0x1b619f];return _0x13384e;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var moment=require(_0xf0ad('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0ad('0x3'));var fs=require('fs');var Redis=require(_0xf0ad('0x4'));var db=require(_0xf0ad('0x5'))['db'];var utils=require(_0xf0ad('0x6'));var logger=require(_0xf0ad('0x7'))(_0xf0ad('0x8'));var config=require(_0xf0ad('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0ad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eca0e,_0x44cf37,_0x170574){return new BPromise(function(_0x41c99d,_0xa9a315){return client[_0xf0ad('0xb')](_0x2eca0e,_0x170574)[_0xf0ad('0xc')](function(_0x5bdf69){logger[_0xf0ad('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x44cf37,_0xf0ad('0xe'));logger[_0xf0ad('0xf')](_0xf0ad('0x10'),_0x44cf37,_0xf0ad('0xe'),JSON[_0xf0ad('0x11')](_0x5bdf69));if(_0x5bdf69['error']){if(_0x5bdf69['error'][_0xf0ad('0x12')]===0x1f4){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x5bdf69[_0xf0ad('0x13')]['message']);return _0xa9a315(_0x5bdf69[_0xf0ad('0x13')][_0xf0ad('0x15')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x44cf37,_0x5bdf69['error'][_0xf0ad('0x15')]);return _0x41c99d(_0x5bdf69['error'][_0xf0ad('0x15')]);}else{logger[_0xf0ad('0xd')](_0xf0ad('0x14'),_0x44cf37,_0xf0ad('0xe'));_0x41c99d(_0x5bdf69[_0xf0ad('0x16')]['message']);}})[_0xf0ad('0x17')](function(_0x285ab0){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x285ab0);_0xa9a315(_0x285ab0);});});}exports['GetFreshsalesAccount']=function(_0x4e9970){var _0x2466e8=this;return new Promise(function(_0x46fb20,_0x49f2ec){return db[_0xf0ad('0x18')][_0xf0ad('0x19')]({'raw':_0x4e9970[_0xf0ad('0x1a')]?_0x4e9970[_0xf0ad('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4e9970['options']?_0x4e9970[_0xf0ad('0x1a')][_0xf0ad('0x1b')]||null:null,'attributes':_0x4e9970[_0xf0ad('0x1a')]?_0x4e9970[_0xf0ad('0x1a')][_0xf0ad('0x1c')]||null:null,'limit':_0x4e9970[_0xf0ad('0x1a')]?_0x4e9970['options'][_0xf0ad('0x1d')]||null:null,'include':_0x4e9970[_0xf0ad('0x1a')]?_0x4e9970[_0xf0ad('0x1a')][_0xf0ad('0x1e')]?_[_0xf0ad('0x1f')](_0x4e9970[_0xf0ad('0x1a')][_0xf0ad('0x1e')],function(_0x276322){return{'model':db[_0x276322[_0xf0ad('0x20')]],'as':_0x276322['as'],'attributes':_0x276322[_0xf0ad('0x1c')],'include':_0x276322[_0xf0ad('0x1e')]?_[_0xf0ad('0x1f')](_0x276322[_0xf0ad('0x1e')],function(_0x456f81){return{'model':db[_0x456f81[_0xf0ad('0x20')]],'as':_0x456f81['as'],'attributes':_0x456f81['attributes'],'include':_0x456f81[_0xf0ad('0x1e')]?_[_0xf0ad('0x1f')](_0x456f81[_0xf0ad('0x1e')],function(_0x7377d7){return{'model':db[_0x7377d7[_0xf0ad('0x20')]],'as':_0x7377d7['as'],'attributes':_0x7377d7[_0xf0ad('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cbe00){logger[_0xf0ad('0xd')](_0xf0ad('0x21'),_0x4e9970);logger[_0xf0ad('0xf')](_0xf0ad('0x21'),_0x4e9970,JSON[_0xf0ad('0x11')](_0x2cbe00));_0x46fb20(_0x2cbe00);})[_0xf0ad('0x17')](function(_0x1bee71){logger[_0xf0ad('0x13')](_0xf0ad('0x21'),_0x1bee71[_0xf0ad('0x15')],_0x4e9970);_0x49f2ec(_0x2466e8['error'](0x1f4,_0x1bee71[_0xf0ad('0x15')]));});});};exports['ShowFreshsalesAccount']=function(_0x83f211){var _0x57a1f3=this;return new Promise(function(_0x25ed0b,_0x320174){return db[_0xf0ad('0x18')][_0xf0ad('0x22')]({'raw':_0x83f211[_0xf0ad('0x1a')]?_0x83f211[_0xf0ad('0x1a')][_0xf0ad('0x23')]===undefined?!![]:![]:!![],'where':_0x83f211[_0xf0ad('0x1a')]?_0x83f211['options']['where']||null:null,'attributes':_0x83f211[_0xf0ad('0x1a')]?_0x83f211[_0xf0ad('0x1a')][_0xf0ad('0x1c')]||null:null,'include':_0x83f211[_0xf0ad('0x1a')]?_0x83f211['options'][_0xf0ad('0x1e')]?_['map'](_0x83f211[_0xf0ad('0x1a')]['include'],function(_0x4136b9){return{'model':db[_0x4136b9['model']],'as':_0x4136b9['as'],'attributes':_0x4136b9[_0xf0ad('0x1c')],'include':_0x4136b9[_0xf0ad('0x1e')]?_[_0xf0ad('0x1f')](_0x4136b9[_0xf0ad('0x1e')],function(_0x42f87f){return{'model':db[_0x42f87f[_0xf0ad('0x20')]],'as':_0x42f87f['as'],'attributes':_0x42f87f[_0xf0ad('0x1c')],'include':_0x42f87f[_0xf0ad('0x1e')]?_['map'](_0x42f87f[_0xf0ad('0x1e')],function(_0x54b59d){return{'model':db[_0x54b59d[_0xf0ad('0x20')]],'as':_0x54b59d['as'],'attributes':_0x54b59d['attributes']};}):[]};}):[]};}):[]:[]})[_0xf0ad('0xc')](function(_0x25246b){logger[_0xf0ad('0xd')](_0xf0ad('0x24'),_0x83f211);logger[_0xf0ad('0xf')]('ShowFreshsalesAccount',_0x83f211,JSON[_0xf0ad('0x11')](_0x25246b));_0x25ed0b(_0x25246b);})[_0xf0ad('0x17')](function(_0x1d57d1){logger[_0xf0ad('0x13')](_0xf0ad('0x24'),_0x1d57d1[_0xf0ad('0x15')],_0x83f211);_0x320174(_0x57a1f3[_0xf0ad('0x13')](0x1f4,_0x1d57d1['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 4d66162..5415a50 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 _0xbc61=['delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getFields','post','create','put','update'];(function(_0x3e7332,_0x2b8728){var _0x25a450=function(_0x4c1784){while(--_0x4c1784){_0x3e7332['push'](_0x3e7332['shift']());}};_0x25a450(++_0x2b8728);}(_0xbc61,0xdc));var _0x1bc6=function(_0x117f56,_0x303777){_0x117f56=_0x117f56-0x0;var _0x42a3af=_0xbc61[_0x117f56];return _0x42a3af;};'use strict';var multer=require(_0x1bc6('0x0'));var util=require(_0x1bc6('0x1'));var path=require(_0x1bc6('0x2'));var timeout=require(_0x1bc6('0x3'));var express=require(_0x1bc6('0x4'));var router=express[_0x1bc6('0x5')]();var fs_extra=require(_0x1bc6('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1bc6('0x7'));var config=require(_0x1bc6('0x8'));var controller=require(_0x1bc6('0x9'));router[_0x1bc6('0xa')]('/',auth[_0x1bc6('0xb')](),controller[_0x1bc6('0xc')]);router[_0x1bc6('0xa')]('/:id',auth[_0x1bc6('0xb')](),controller[_0x1bc6('0xd')]);router['get'](_0x1bc6('0xe'),auth[_0x1bc6('0xb')](),controller[_0x1bc6('0xf')]);router[_0x1bc6('0xa')](_0x1bc6('0x10'),auth['isAuthenticated'](),controller[_0x1bc6('0x11')]);router[_0x1bc6('0xa')]('/:id/fields',auth[_0x1bc6('0xb')](),controller[_0x1bc6('0x12')]);router[_0x1bc6('0x13')]('/',auth['isAuthenticated'](),controller[_0x1bc6('0x14')]);router[_0x1bc6('0x15')]('/:id',auth[_0x1bc6('0xb')](),controller[_0x1bc6('0x16')]);router[_0x1bc6('0x17')](_0x1bc6('0x18'),auth[_0x1bc6('0xb')](),controller[_0x1bc6('0x19')]);module[_0x1bc6('0x1a')]=router; \ No newline at end of file +var _0x4ebd=['isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get'];(function(_0xc83107,_0x1886c8){var _0x33373a=function(_0x1db311){while(--_0x1db311){_0xc83107['push'](_0xc83107['shift']());}};_0x33373a(++_0x1886c8);}(_0x4ebd,0x7b));var _0xd4eb=function(_0x5c17f3,_0x13b530){_0x5c17f3=_0x5c17f3-0x0;var _0x2eaab8=_0x4ebd[_0x5c17f3];return _0x2eaab8;};'use strict';var multer=require(_0xd4eb('0x0'));var util=require(_0xd4eb('0x1'));var path=require(_0xd4eb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd4eb('0x3')]();var fs_extra=require(_0xd4eb('0x4'));var auth=require(_0xd4eb('0x5'));var interaction=require(_0xd4eb('0x6'));var config=require('../../config/environment');var controller=require(_0xd4eb('0x7'));router[_0xd4eb('0x8')]('/',auth[_0xd4eb('0x9')](),controller[_0xd4eb('0xa')]);router['get'](_0xd4eb('0xb'),auth[_0xd4eb('0x9')](),controller[_0xd4eb('0xc')]);router[_0xd4eb('0x8')](_0xd4eb('0xd'),auth[_0xd4eb('0x9')](),controller[_0xd4eb('0xe')]);router[_0xd4eb('0x8')](_0xd4eb('0xf'),auth[_0xd4eb('0x9')](),controller[_0xd4eb('0x10')]);router[_0xd4eb('0x8')](_0xd4eb('0x11'),auth[_0xd4eb('0x9')](),controller[_0xd4eb('0x12')]);router[_0xd4eb('0x13')]('/',auth[_0xd4eb('0x9')](),controller['create']);router['put']('/:id',auth[_0xd4eb('0x9')](),controller['update']);router['delete'](_0xd4eb('0xb'),auth[_0xd4eb('0x9')](),controller[_0xd4eb('0x14')]);module[_0xd4eb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 31dca2d..81c01da 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 _0x73ea=['exports','sequelize'];(function(_0x4915be,_0x3fbdd3){var _0x115aba=function(_0x4b496b){while(--_0x4b496b){_0x4915be['push'](_0x4915be['shift']());}};_0x115aba(++_0x3fbdd3);}(_0x73ea,0x6f));var _0xa73e=function(_0x5e93bd,_0x3c858a){_0x5e93bd=_0x5e93bd-0x0;var _0x254588=_0x73ea[_0x5e93bd];return _0x254588;};'use strict';var Sequelize=require(_0xa73e('0x0'));module[_0xa73e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc534=['sequelize','exports','STRING'];(function(_0x44215a,_0x1c36a6){var _0xa34fe8=function(_0x2935a0){while(--_0x2935a0){_0x44215a['push'](_0x44215a['shift']());}};_0xa34fe8(++_0x1c36a6);}(_0xc534,0x1ad));var _0x4c53=function(_0x422994,_0x99047b){_0x422994=_0x422994-0x0;var _0x43ad8f=_0xc534[_0x422994];return _0x43ad8f;};'use strict';var Sequelize=require(_0x4c53('0x0'));module[_0x4c53('0x1')]={'name':{'type':Sequelize[_0x4c53('0x2')]},'description':{'type':Sequelize[_0x4c53('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 29632e2..7829efa 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 _0xb7e9=['message','result','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','rows','catch','show','params','length','includeAll','include','find','create','body','getSubjects','findOne','pick','getDescriptions','getFields','FreshsalesField','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x41a86c,_0x2aa8b6){var _0x4e388d=function(_0x454c33){while(--_0x454c33){_0x41a86c['push'](_0x41a86c['shift']());}};_0x4e388d(++_0x2aa8b6);}(_0xb7e9,0x99));var _0x9b7e=function(_0x2d344f,_0x25fa84){_0x2d344f=_0x2d344f-0x0;var _0x2e796b=_0xb7e9[_0x2d344f];return _0x2e796b;};'use strict';var emlformat=require(_0x9b7e('0x0'));var rimraf=require(_0x9b7e('0x1'));var zipdir=require(_0x9b7e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9b7e('0x3'));var moment=require(_0x9b7e('0x4'));var BPromise=require(_0x9b7e('0x5'));var Mustache=require(_0x9b7e('0x6'));var util=require(_0x9b7e('0x7'));var path=require(_0x9b7e('0x8'));var sox=require(_0x9b7e('0x9'));var csv=require('to-csv');var ejs=require(_0x9b7e('0xa'));var fs=require('fs');var fs_extra=require(_0x9b7e('0xb'));var _=require(_0x9b7e('0xc'));var squel=require(_0x9b7e('0xd'));var crypto=require(_0x9b7e('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9b7e('0xf'));var querystring=require(_0x9b7e('0x10'));var Papa=require(_0x9b7e('0x11'));var Redis=require(_0x9b7e('0x12'));var authService=require(_0x9b7e('0x13'));var qs=require(_0x9b7e('0x14'));var as=require(_0x9b7e('0x15'));var hardwareService=require(_0x9b7e('0x16'));var logger=require(_0x9b7e('0x17'))('api');var utils=require(_0x9b7e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9b7e('0x19'));var db=require(_0x9b7e('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x9b7e('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3a495a,_0x11aeb2,_0x83a912,_0x22ff59){return new BPromise(function(_0x4ba56c,_0x2a9e9f){var _0x4d28d0=_0x22ff59||client;return _0x4d28d0[_0x9b7e('0x1c')](_0x3a495a,_0x83a912)['then'](function(_0x58abe3){logger[_0x9b7e('0x1d')](_0x9b7e('0x1e'),_0x11aeb2,_0x9b7e('0x1f'));logger[_0x9b7e('0x20')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x11aeb2,_0x9b7e('0x1f'),JSON[_0x9b7e('0x21')](_0x58abe3));if(_0x58abe3['error']){if(_0x58abe3[_0x9b7e('0x22')]['code']===0x1f4){logger['error'](_0x9b7e('0x1e'),_0x11aeb2,_0x58abe3['error'][_0x9b7e('0x23')]);return _0x2a9e9f(_0x58abe3[_0x9b7e('0x22')][_0x9b7e('0x23')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x11aeb2,_0x58abe3['error'][_0x9b7e('0x23')]);return _0x4ba56c(_0x58abe3[_0x9b7e('0x22')][_0x9b7e('0x23')]);}else{logger['info'](_0x9b7e('0x1e'),_0x11aeb2,_0x9b7e('0x1f'));_0x4ba56c(_0x58abe3[_0x9b7e('0x24')][_0x9b7e('0x23')]);}})['catch'](function(_0x5112fd){logger[_0x9b7e('0x22')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x11aeb2,_0x5112fd);_0x2a9e9f(_0x5112fd);});});}function respondWithStatusCode(_0x394143,_0x1bdec9){_0x1bdec9=_0x1bdec9||0xcc;return function(_0x127a17){if(_0x127a17){return _0x394143[_0x9b7e('0x25')](_0x1bdec9);}return _0x394143[_0x9b7e('0x26')](_0x1bdec9)[_0x9b7e('0x27')]();};}function respondWithResult(_0x5e1f48,_0x2a131c){_0x2a131c=_0x2a131c||0xc8;return function(_0x28459a){if(_0x28459a){return _0x5e1f48[_0x9b7e('0x26')](_0x2a131c)[_0x9b7e('0x28')](_0x28459a);}};}function respondWithFilteredResult(_0x440542,_0x5c40d8){return function(_0x2dbfa7){if(_0x2dbfa7){var _0x1cb3a2=_0x2dbfa7[_0x9b7e('0x29')],_0x551138=_0x5c40d8['offset'],_0x25a1fa=_0x5c40d8[_0x9b7e('0x2a')]+_0x5c40d8['limit'],_0x403f9b;if(_0x25a1fa>=_0x1cb3a2){_0x25a1fa=_0x1cb3a2;_0x403f9b=0xc8;}else{_0x403f9b=0xce;}_0x440542[_0x9b7e('0x26')](_0x403f9b);return _0x440542[_0x9b7e('0x2b')](_0x9b7e('0x2c'),_0x551138+'-'+_0x25a1fa+'/'+_0x1cb3a2)[_0x9b7e('0x28')](_0x2dbfa7);}return null;};}function patchUpdates(_0x465391){return function(_0x2fa75a){try{jsonpatch[_0x9b7e('0x2d')](_0x2fa75a,_0x465391,!![]);}catch(_0x33744a){return BPromise[_0x9b7e('0x2e')](_0x33744a);}return _0x2fa75a[_0x9b7e('0x2f')]();};}function saveUpdates(_0x35eb41,_0x2ca8d9){return function(_0x3fa242){if(_0x3fa242){return _0x3fa242[_0x9b7e('0x30')](_0x35eb41)[_0x9b7e('0x31')](function(_0x1f0f90){return _0x1f0f90;});}return null;};}function removeEntity(_0x202133,_0x4885bd){return function(_0x34acee){if(_0x34acee){return _0x34acee[_0x9b7e('0x32')]()[_0x9b7e('0x31')](function(){_0x202133['status'](0xcc)[_0x9b7e('0x27')]();});}};}function handleEntityNotFound(_0x23afbf,_0xa32a0b){return function(_0x357106){if(!_0x357106){_0x23afbf[_0x9b7e('0x25')](0x194);}return _0x357106;};}function handleError(_0x4a0eea,_0x2a0e4b){_0x2a0e4b=_0x2a0e4b||0x1f4;return function(_0x3a52dc){logger[_0x9b7e('0x22')](_0x3a52dc[_0x9b7e('0x33')]);if(_0x3a52dc['name']){delete _0x3a52dc[_0x9b7e('0x34')];}_0x4a0eea[_0x9b7e('0x26')](_0x2a0e4b)[_0x9b7e('0x35')](_0x3a52dc);};}exports[_0x9b7e('0x36')]=function(_0x4f3762,_0x53901c){var _0x8783f1={},_0x2dceff={},_0x15e07c={'count':0x0,'rows':[]};var _0x3b803f=_['map'](db[_0x9b7e('0x37')][_0x9b7e('0x38')],function(_0x2b4e85){return{'name':_0x2b4e85[_0x9b7e('0x39')],'type':_0x2b4e85[_0x9b7e('0x3a')][_0x9b7e('0x3b')]};});_0x2dceff[_0x9b7e('0x3c')]=_[_0x9b7e('0x3d')](_0x3b803f,_0x9b7e('0x34'));_0x2dceff[_0x9b7e('0x3e')]=_[_0x9b7e('0x3f')](_0x4f3762['query']);_0x2dceff[_0x9b7e('0x40')]=_['intersection'](_0x2dceff[_0x9b7e('0x3c')],_0x2dceff[_0x9b7e('0x3e')]);_0x8783f1[_0x9b7e('0x41')]=_[_0x9b7e('0x42')](_0x2dceff[_0x9b7e('0x3c')],qs[_0x9b7e('0x43')](_0x4f3762[_0x9b7e('0x3e')]['fields']));_0x8783f1[_0x9b7e('0x41')]=_0x8783f1[_0x9b7e('0x41')]['length']?_0x8783f1[_0x9b7e('0x41')]:_0x2dceff[_0x9b7e('0x3c')];if(!_0x4f3762[_0x9b7e('0x3e')][_0x9b7e('0x44')](_0x9b7e('0x45'))){_0x8783f1[_0x9b7e('0x46')]=qs[_0x9b7e('0x46')](_0x4f3762['query'][_0x9b7e('0x46')]);_0x8783f1[_0x9b7e('0x2a')]=qs[_0x9b7e('0x2a')](_0x4f3762['query'][_0x9b7e('0x2a')]);}_0x8783f1[_0x9b7e('0x47')]=qs[_0x9b7e('0x48')](_0x4f3762['query'][_0x9b7e('0x48')]);_0x8783f1[_0x9b7e('0x49')]=qs[_0x9b7e('0x40')](_['pick'](_0x4f3762[_0x9b7e('0x3e')],_0x2dceff['filters']),_0x3b803f);if(_0x4f3762['query'][_0x9b7e('0x4a')]){_0x8783f1[_0x9b7e('0x49')]=_[_0x9b7e('0x4b')](_0x8783f1[_0x9b7e('0x49')],{'$or':_[_0x9b7e('0x3d')](_0x3b803f,function(_0x350fcc){if(_0x350fcc['type']!==_0x9b7e('0x4c')){var _0x52bb94={};_0x52bb94[_0x350fcc[_0x9b7e('0x34')]]={'$like':'%'+_0x4f3762[_0x9b7e('0x3e')]['filter']+'%'};return _0x52bb94;}})});}_0x8783f1=_[_0x9b7e('0x4b')]({},_0x8783f1,_0x4f3762[_0x9b7e('0x4d')]);var _0x33ad1e={'where':_0x8783f1['where']};return db['FreshsalesConfiguration'][_0x9b7e('0x29')](_0x33ad1e)[_0x9b7e('0x31')](function(_0x3f3922){_0x15e07c['count']=_0x3f3922;if(_0x4f3762[_0x9b7e('0x3e')]['includeAll']){_0x8783f1['include']=[{'all':!![]}];}return db[_0x9b7e('0x37')]['findAll'](_0x8783f1);})[_0x9b7e('0x31')](function(_0x4e1b0e){_0x15e07c[_0x9b7e('0x4e')]=_0x4e1b0e;return _0x15e07c;})[_0x9b7e('0x31')](respondWithFilteredResult(_0x53901c,_0x8783f1))[_0x9b7e('0x4f')](handleError(_0x53901c,null));};exports[_0x9b7e('0x50')]=function(_0x421fbd,_0x40e907){var _0x2ad1f0={'raw':![],'where':{'id':_0x421fbd[_0x9b7e('0x51')]['id']}},_0x3322f2={};_0x3322f2['model']=_['keys'](db[_0x9b7e('0x37')][_0x9b7e('0x38')]);_0x3322f2['query']=_[_0x9b7e('0x3f')](_0x421fbd[_0x9b7e('0x3e')]);_0x3322f2[_0x9b7e('0x40')]=_[_0x9b7e('0x42')](_0x3322f2[_0x9b7e('0x3c')],_0x3322f2[_0x9b7e('0x3e')]);_0x2ad1f0['attributes']=_[_0x9b7e('0x42')](_0x3322f2[_0x9b7e('0x3c')],qs['fields'](_0x421fbd['query'][_0x9b7e('0x43')]));_0x2ad1f0[_0x9b7e('0x41')]=_0x2ad1f0[_0x9b7e('0x41')][_0x9b7e('0x52')]?_0x2ad1f0[_0x9b7e('0x41')]:_0x3322f2[_0x9b7e('0x3c')];if(_0x421fbd['query'][_0x9b7e('0x53')]){_0x2ad1f0[_0x9b7e('0x54')]=[{'all':!![]}];}_0x2ad1f0=_['merge']({},_0x2ad1f0,_0x421fbd[_0x9b7e('0x4d')]);return db[_0x9b7e('0x37')][_0x9b7e('0x55')](_0x2ad1f0)[_0x9b7e('0x31')](handleEntityNotFound(_0x40e907,null))['then'](respondWithResult(_0x40e907,null))[_0x9b7e('0x4f')](handleError(_0x40e907,null));};exports[_0x9b7e('0x56')]=function(_0xfe37b2,_0x29b3de){return db[_0x9b7e('0x37')][_0x9b7e('0x56')](_0xfe37b2[_0x9b7e('0x57')],{})[_0x9b7e('0x31')](respondWithResult(_0x29b3de,0xc9))[_0x9b7e('0x4f')](handleError(_0x29b3de,null));};exports[_0x9b7e('0x30')]=function(_0x1a42f8,_0x2a570e){if(_0x1a42f8[_0x9b7e('0x57')]['id']){delete _0x1a42f8[_0x9b7e('0x57')]['id'];}return db[_0x9b7e('0x37')][_0x9b7e('0x55')]({'where':{'id':_0x1a42f8[_0x9b7e('0x51')]['id']}})[_0x9b7e('0x31')](handleEntityNotFound(_0x2a570e,null))[_0x9b7e('0x31')](saveUpdates(_0x1a42f8[_0x9b7e('0x57')],null))[_0x9b7e('0x31')](respondWithResult(_0x2a570e,null))[_0x9b7e('0x4f')](handleError(_0x2a570e,null));};exports[_0x9b7e('0x32')]=function(_0x479bf0,_0x5cad62){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x479bf0[_0x9b7e('0x51')]['id']}})[_0x9b7e('0x31')](handleEntityNotFound(_0x5cad62,null))[_0x9b7e('0x31')](removeEntity(_0x5cad62,null))[_0x9b7e('0x4f')](handleError(_0x5cad62,null));};exports[_0x9b7e('0x58')]=function(_0x2a5a73,_0x498547,_0x56cdec){var _0x29de30={};var _0x5b892a={};var _0x4dd3d2;var _0x18d83f;return db[_0x9b7e('0x37')][_0x9b7e('0x59')]({'where':{'id':_0x2a5a73[_0x9b7e('0x51')]['id']}})[_0x9b7e('0x31')](handleEntityNotFound(_0x498547,null))[_0x9b7e('0x31')](function(_0x1e6e74){if(_0x1e6e74){_0x4dd3d2=_0x1e6e74;_0x5b892a['model']=_['keys'](db['FreshsalesField'][_0x9b7e('0x38')]);_0x5b892a[_0x9b7e('0x3e')]=_[_0x9b7e('0x3f')](_0x2a5a73['query']);_0x5b892a[_0x9b7e('0x40')]=_['intersection'](_0x5b892a[_0x9b7e('0x3c')],_0x5b892a[_0x9b7e('0x3e')]);_0x29de30[_0x9b7e('0x41')]=_[_0x9b7e('0x42')](_0x5b892a['model'],qs[_0x9b7e('0x43')](_0x2a5a73[_0x9b7e('0x3e')][_0x9b7e('0x43')]));_0x29de30[_0x9b7e('0x41')]=_0x29de30[_0x9b7e('0x41')][_0x9b7e('0x52')]?_0x29de30['attributes']:_0x5b892a[_0x9b7e('0x3c')];_0x29de30['order']=qs[_0x9b7e('0x48')](_0x2a5a73[_0x9b7e('0x3e')][_0x9b7e('0x48')]);_0x29de30[_0x9b7e('0x49')]=qs[_0x9b7e('0x40')](_[_0x9b7e('0x5a')](_0x2a5a73[_0x9b7e('0x3e')],_0x5b892a['filters']));if(_0x2a5a73['query'][_0x9b7e('0x4a')]){_0x29de30[_0x9b7e('0x49')]=_[_0x9b7e('0x4b')](_0x29de30[_0x9b7e('0x49')],{'$or':_[_0x9b7e('0x3d')](_0x29de30[_0x9b7e('0x41')],function(_0x3ab955){var _0x357dbb={};_0x357dbb[_0x3ab955]={'$like':'%'+_0x2a5a73[_0x9b7e('0x3e')][_0x9b7e('0x4a')]+'%'};return _0x357dbb;})});}_0x29de30=_[_0x9b7e('0x4b')]({},_0x29de30,_0x2a5a73[_0x9b7e('0x4d')]);return _0x4dd3d2[_0x9b7e('0x58')](_0x29de30);}})[_0x9b7e('0x31')](function(_0x1f9e62){if(_0x1f9e62){_0x18d83f=_0x1f9e62[_0x9b7e('0x52')];if(!_0x2a5a73[_0x9b7e('0x3e')][_0x9b7e('0x44')](_0x9b7e('0x45'))){_0x29de30[_0x9b7e('0x46')]=qs[_0x9b7e('0x46')](_0x2a5a73[_0x9b7e('0x3e')]['limit']);_0x29de30[_0x9b7e('0x2a')]=qs[_0x9b7e('0x2a')](_0x2a5a73['query']['offset']);}return _0x4dd3d2[_0x9b7e('0x58')](_0x29de30);}})[_0x9b7e('0x31')](function(_0x20cc8e){if(_0x20cc8e){return _0x20cc8e?{'count':_0x18d83f,'rows':_0x20cc8e}:null;}})[_0x9b7e('0x31')](respondWithResult(_0x498547,null))[_0x9b7e('0x4f')](handleError(_0x498547,null));};exports[_0x9b7e('0x5b')]=function(_0x2aceeb,_0x34ed12,_0x191cd1){var _0x11d387={};var _0x5b569e={};var _0x17d3d8;var _0x20a910;return db['FreshsalesConfiguration'][_0x9b7e('0x59')]({'where':{'id':_0x2aceeb[_0x9b7e('0x51')]['id']}})[_0x9b7e('0x31')](handleEntityNotFound(_0x34ed12,null))[_0x9b7e('0x31')](function(_0x28f014){if(_0x28f014){_0x17d3d8=_0x28f014;_0x5b569e[_0x9b7e('0x3c')]=_[_0x9b7e('0x3f')](db['FreshsalesField']['rawAttributes']);_0x5b569e[_0x9b7e('0x3e')]=_[_0x9b7e('0x3f')](_0x2aceeb['query']);_0x5b569e[_0x9b7e('0x40')]=_['intersection'](_0x5b569e[_0x9b7e('0x3c')],_0x5b569e[_0x9b7e('0x3e')]);_0x11d387[_0x9b7e('0x41')]=_[_0x9b7e('0x42')](_0x5b569e[_0x9b7e('0x3c')],qs[_0x9b7e('0x43')](_0x2aceeb[_0x9b7e('0x3e')][_0x9b7e('0x43')]));_0x11d387[_0x9b7e('0x41')]=_0x11d387[_0x9b7e('0x41')][_0x9b7e('0x52')]?_0x11d387[_0x9b7e('0x41')]:_0x5b569e[_0x9b7e('0x3c')];_0x11d387['order']=qs[_0x9b7e('0x48')](_0x2aceeb['query'][_0x9b7e('0x48')]);_0x11d387[_0x9b7e('0x49')]=qs[_0x9b7e('0x40')](_[_0x9b7e('0x5a')](_0x2aceeb[_0x9b7e('0x3e')],_0x5b569e[_0x9b7e('0x40')]));if(_0x2aceeb['query'][_0x9b7e('0x4a')]){_0x11d387[_0x9b7e('0x49')]=_['merge'](_0x11d387['where'],{'$or':_[_0x9b7e('0x3d')](_0x11d387[_0x9b7e('0x41')],function(_0x25660e){var _0x206ce8={};_0x206ce8[_0x25660e]={'$like':'%'+_0x2aceeb[_0x9b7e('0x3e')][_0x9b7e('0x4a')]+'%'};return _0x206ce8;})});}_0x11d387=_[_0x9b7e('0x4b')]({},_0x11d387,_0x2aceeb['options']);return _0x17d3d8['getDescriptions'](_0x11d387);}})['then'](function(_0x313323){if(_0x313323){_0x20a910=_0x313323['length'];if(!_0x2aceeb[_0x9b7e('0x3e')]['hasOwnProperty'](_0x9b7e('0x45'))){_0x11d387[_0x9b7e('0x46')]=qs[_0x9b7e('0x46')](_0x2aceeb['query'][_0x9b7e('0x46')]);_0x11d387['offset']=qs['offset'](_0x2aceeb[_0x9b7e('0x3e')]['offset']);}return _0x17d3d8[_0x9b7e('0x5b')](_0x11d387);}})[_0x9b7e('0x31')](function(_0x4cb699){if(_0x4cb699){return _0x4cb699?{'count':_0x20a910,'rows':_0x4cb699}:null;}})['then'](respondWithResult(_0x34ed12,null))['catch'](handleError(_0x34ed12,null));};exports[_0x9b7e('0x5c')]=function(_0x22301b,_0x4df53d,_0x5e980d){var _0x289822={};var _0x147d0b={};var _0x3d6bdd;var _0x352ca6;return db['FreshsalesConfiguration'][_0x9b7e('0x59')]({'where':{'id':_0x22301b[_0x9b7e('0x51')]['id']}})[_0x9b7e('0x31')](handleEntityNotFound(_0x4df53d,null))[_0x9b7e('0x31')](function(_0x192d50){if(_0x192d50){_0x3d6bdd=_0x192d50;_0x147d0b[_0x9b7e('0x3c')]=_[_0x9b7e('0x3f')](db[_0x9b7e('0x5d')][_0x9b7e('0x38')]);_0x147d0b[_0x9b7e('0x3e')]=_['keys'](_0x22301b['query']);_0x147d0b[_0x9b7e('0x40')]=_[_0x9b7e('0x42')](_0x147d0b['model'],_0x147d0b[_0x9b7e('0x3e')]);_0x289822[_0x9b7e('0x41')]=_[_0x9b7e('0x42')](_0x147d0b[_0x9b7e('0x3c')],qs['fields'](_0x22301b[_0x9b7e('0x3e')][_0x9b7e('0x43')]));_0x289822[_0x9b7e('0x41')]=_0x289822['attributes'][_0x9b7e('0x52')]?_0x289822[_0x9b7e('0x41')]:_0x147d0b['model'];_0x289822[_0x9b7e('0x47')]=qs[_0x9b7e('0x48')](_0x22301b[_0x9b7e('0x3e')][_0x9b7e('0x48')]);_0x289822[_0x9b7e('0x49')]=qs[_0x9b7e('0x40')](_[_0x9b7e('0x5a')](_0x22301b['query'],_0x147d0b['filters']));if(_0x22301b['query'][_0x9b7e('0x4a')]){_0x289822[_0x9b7e('0x49')]=_[_0x9b7e('0x4b')](_0x289822['where'],{'$or':_[_0x9b7e('0x3d')](_0x289822[_0x9b7e('0x41')],function(_0x223594){var _0x3308fa={};_0x3308fa[_0x223594]={'$like':'%'+_0x22301b[_0x9b7e('0x3e')][_0x9b7e('0x4a')]+'%'};return _0x3308fa;})});}_0x289822=_[_0x9b7e('0x4b')]({},_0x289822,_0x22301b['options']);return _0x3d6bdd[_0x9b7e('0x5c')](_0x289822);}})[_0x9b7e('0x31')](function(_0x4974ff){if(_0x4974ff){_0x352ca6=_0x4974ff[_0x9b7e('0x52')];if(!_0x22301b[_0x9b7e('0x3e')][_0x9b7e('0x44')](_0x9b7e('0x45'))){_0x289822['limit']=qs[_0x9b7e('0x46')](_0x22301b[_0x9b7e('0x3e')][_0x9b7e('0x46')]);_0x289822[_0x9b7e('0x2a')]=qs[_0x9b7e('0x2a')](_0x22301b[_0x9b7e('0x3e')][_0x9b7e('0x2a')]);}return _0x3d6bdd[_0x9b7e('0x5c')](_0x289822);}})['then'](function(_0x434986){if(_0x434986){return _0x434986?{'count':_0x352ca6,'rows':_0x434986}:null;}})[_0x9b7e('0x31')](respondWithResult(_0x4df53d,null))[_0x9b7e('0x4f')](handleError(_0x4df53d,null));}; \ No newline at end of file +var _0x4b46=['debug','error','message','info','request\x20sent','result','catch','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','save','then','destroy','name','send','index','map','FreshsalesConfiguration','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','VIRTUAL','options','count','includeAll','include','params','keys','rawAttributes','update','body','find','getSubjects','findOne','FreshsalesField','order','filter','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','request','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x4b46,0xe7));var _0x64b4=function(_0x37f5c7,_0x2b2d43){_0x37f5c7=_0x37f5c7-0x0;var _0x115e05=_0x4b46[_0x37f5c7];return _0x115e05;};'use strict';var emlformat=require(_0x64b4('0x0'));var rimraf=require(_0x64b4('0x1'));var zipdir=require(_0x64b4('0x2'));var jsonpatch=require(_0x64b4('0x3'));var rp=require('request-promise');var moment=require(_0x64b4('0x4'));var BPromise=require(_0x64b4('0x5'));var Mustache=require(_0x64b4('0x6'));var util=require(_0x64b4('0x7'));var path=require(_0x64b4('0x8'));var sox=require(_0x64b4('0x9'));var csv=require('to-csv');var ejs=require(_0x64b4('0xa'));var fs=require('fs');var fs_extra=require(_0x64b4('0xb'));var _=require(_0x64b4('0xc'));var squel=require('squel');var crypto=require(_0x64b4('0xd'));var jsforce=require(_0x64b4('0xe'));var deskjs=require(_0x64b4('0xf'));var toCsv=require(_0x64b4('0x10'));var querystring=require(_0x64b4('0x11'));var Papa=require('papaparse');var Redis=require(_0x64b4('0x12'));var authService=require(_0x64b4('0x13'));var qs=require(_0x64b4('0x14'));var as=require(_0x64b4('0x15'));var hardwareService=require(_0x64b4('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x64b4('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x64b4('0x18'));var db=require(_0x64b4('0x19'))['db'];var jayson=require(_0x64b4('0x1a'));var client=jayson[_0x64b4('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x357b8e,_0x13c7b3,_0x456992,_0xaee79c){return new BPromise(function(_0x50ebc2,_0x260dc3){var _0x280c43=_0xaee79c||client;return _0x280c43[_0x64b4('0x1c')](_0x357b8e,_0x456992)['then'](function(_0x118e83){logger['info'](_0x64b4('0x1d'),_0x13c7b3,'request\x20sent');logger[_0x64b4('0x1e')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x13c7b3,'request\x20sent',JSON['stringify'](_0x118e83));if(_0x118e83['error']){if(_0x118e83[_0x64b4('0x1f')]['code']===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x13c7b3,_0x118e83[_0x64b4('0x1f')][_0x64b4('0x20')]);return _0x260dc3(_0x118e83['error'][_0x64b4('0x20')]);}logger[_0x64b4('0x1f')](_0x64b4('0x1d'),_0x13c7b3,_0x118e83[_0x64b4('0x1f')][_0x64b4('0x20')]);return _0x50ebc2(_0x118e83[_0x64b4('0x1f')][_0x64b4('0x20')]);}else{logger[_0x64b4('0x21')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x13c7b3,_0x64b4('0x22'));_0x50ebc2(_0x118e83[_0x64b4('0x23')][_0x64b4('0x20')]);}})[_0x64b4('0x24')](function(_0x4d7d44){logger['error'](_0x64b4('0x1d'),_0x13c7b3,_0x4d7d44);_0x260dc3(_0x4d7d44);});});}function respondWithStatusCode(_0x5a4437,_0x519ef1){_0x519ef1=_0x519ef1||0xcc;return function(_0x249f54){if(_0x249f54){return _0x5a4437[_0x64b4('0x25')](_0x519ef1);}return _0x5a4437['status'](_0x519ef1)[_0x64b4('0x26')]();};}function respondWithResult(_0x5a264c,_0x46f705){_0x46f705=_0x46f705||0xc8;return function(_0x32e536){if(_0x32e536){return _0x5a264c[_0x64b4('0x27')](_0x46f705)[_0x64b4('0x28')](_0x32e536);}};}function respondWithFilteredResult(_0x4cfe90,_0x27ea0e){return function(_0x5d19c5){if(_0x5d19c5){var _0x55f27c=_0x5d19c5['count'],_0x38670f=_0x27ea0e[_0x64b4('0x29')],_0x247dbb=_0x27ea0e[_0x64b4('0x29')]+_0x27ea0e[_0x64b4('0x2a')],_0x1a9e1c;if(_0x247dbb>=_0x55f27c){_0x247dbb=_0x55f27c;_0x1a9e1c=0xc8;}else{_0x1a9e1c=0xce;}_0x4cfe90[_0x64b4('0x27')](_0x1a9e1c);return _0x4cfe90[_0x64b4('0x2b')](_0x64b4('0x2c'),_0x38670f+'-'+_0x247dbb+'/'+_0x55f27c)[_0x64b4('0x28')](_0x5d19c5);}return null;};}function patchUpdates(_0x55681c){return function(_0x564aeb){try{jsonpatch[_0x64b4('0x2d')](_0x564aeb,_0x55681c,!![]);}catch(_0x354f40){return BPromise['reject'](_0x354f40);}return _0x564aeb[_0x64b4('0x2e')]();};}function saveUpdates(_0x31fa31,_0x3c3c25){return function(_0x198282){if(_0x198282){return _0x198282['update'](_0x31fa31)[_0x64b4('0x2f')](function(_0x18bc38){return _0x18bc38;});}return null;};}function removeEntity(_0x4e88e9,_0x2d1989){return function(_0xd42d4b){if(_0xd42d4b){return _0xd42d4b[_0x64b4('0x30')]()[_0x64b4('0x2f')](function(){_0x4e88e9[_0x64b4('0x27')](0xcc)[_0x64b4('0x26')]();});}};}function handleEntityNotFound(_0x447312,_0x238746){return function(_0x479fc3){if(!_0x479fc3){_0x447312[_0x64b4('0x25')](0x194);}return _0x479fc3;};}function handleError(_0x108725,_0x3d0032){_0x3d0032=_0x3d0032||0x1f4;return function(_0x3dac97){logger[_0x64b4('0x1f')](_0x3dac97['stack']);if(_0x3dac97[_0x64b4('0x31')]){delete _0x3dac97[_0x64b4('0x31')];}_0x108725[_0x64b4('0x27')](_0x3d0032)[_0x64b4('0x32')](_0x3dac97);};}exports[_0x64b4('0x33')]=function(_0x3103d3,_0x1e26b1){var _0x28748c={},_0x5d2fdf={},_0x27a4fb={'count':0x0,'rows':[]};var _0xeaed57=_[_0x64b4('0x34')](db[_0x64b4('0x35')]['rawAttributes'],function(_0x43b846){return{'name':_0x43b846['fieldName'],'type':_0x43b846[_0x64b4('0x36')][_0x64b4('0x37')]};});_0x5d2fdf[_0x64b4('0x38')]=_['map'](_0xeaed57,'name');_0x5d2fdf['query']=_['keys'](_0x3103d3[_0x64b4('0x39')]);_0x5d2fdf['filters']=_[_0x64b4('0x3a')](_0x5d2fdf['model'],_0x5d2fdf['query']);_0x28748c[_0x64b4('0x3b')]=_['intersection'](_0x5d2fdf[_0x64b4('0x38')],qs['fields'](_0x3103d3[_0x64b4('0x39')][_0x64b4('0x3c')]));_0x28748c['attributes']=_0x28748c['attributes'][_0x64b4('0x3d')]?_0x28748c[_0x64b4('0x3b')]:_0x5d2fdf[_0x64b4('0x38')];if(!_0x3103d3[_0x64b4('0x39')][_0x64b4('0x3e')](_0x64b4('0x3f'))){_0x28748c['limit']=qs['limit'](_0x3103d3[_0x64b4('0x39')]['limit']);_0x28748c[_0x64b4('0x29')]=qs[_0x64b4('0x29')](_0x3103d3[_0x64b4('0x39')]['offset']);}_0x28748c['order']=qs[_0x64b4('0x40')](_0x3103d3['query']['sort']);_0x28748c['where']=qs[_0x64b4('0x41')](_[_0x64b4('0x42')](_0x3103d3[_0x64b4('0x39')],_0x5d2fdf[_0x64b4('0x41')]),_0xeaed57);if(_0x3103d3['query']['filter']){_0x28748c[_0x64b4('0x43')]=_[_0x64b4('0x44')](_0x28748c[_0x64b4('0x43')],{'$or':_[_0x64b4('0x34')](_0xeaed57,function(_0x3f8339){if(_0x3f8339['type']!==_0x64b4('0x45')){var _0x3d9d8c={};_0x3d9d8c[_0x3f8339[_0x64b4('0x31')]]={'$like':'%'+_0x3103d3[_0x64b4('0x39')]['filter']+'%'};return _0x3d9d8c;}})});}_0x28748c=_['merge']({},_0x28748c,_0x3103d3[_0x64b4('0x46')]);var _0x58eaca={'where':_0x28748c[_0x64b4('0x43')]};return db[_0x64b4('0x35')][_0x64b4('0x47')](_0x58eaca)[_0x64b4('0x2f')](function(_0x1f43f7){_0x27a4fb[_0x64b4('0x47')]=_0x1f43f7;if(_0x3103d3[_0x64b4('0x39')][_0x64b4('0x48')]){_0x28748c[_0x64b4('0x49')]=[{'all':!![]}];}return db[_0x64b4('0x35')]['findAll'](_0x28748c);})[_0x64b4('0x2f')](function(_0xe83b8){_0x27a4fb['rows']=_0xe83b8;return _0x27a4fb;})[_0x64b4('0x2f')](respondWithFilteredResult(_0x1e26b1,_0x28748c))['catch'](handleError(_0x1e26b1,null));};exports['show']=function(_0x49664f,_0x431800){var _0x65d6a1={'raw':![],'where':{'id':_0x49664f[_0x64b4('0x4a')]['id']}},_0x2bb4f7={};_0x2bb4f7[_0x64b4('0x38')]=_[_0x64b4('0x4b')](db[_0x64b4('0x35')][_0x64b4('0x4c')]);_0x2bb4f7[_0x64b4('0x39')]=_[_0x64b4('0x4b')](_0x49664f[_0x64b4('0x39')]);_0x2bb4f7[_0x64b4('0x41')]=_['intersection'](_0x2bb4f7['model'],_0x2bb4f7[_0x64b4('0x39')]);_0x65d6a1[_0x64b4('0x3b')]=_[_0x64b4('0x3a')](_0x2bb4f7[_0x64b4('0x38')],qs[_0x64b4('0x3c')](_0x49664f[_0x64b4('0x39')][_0x64b4('0x3c')]));_0x65d6a1['attributes']=_0x65d6a1['attributes'][_0x64b4('0x3d')]?_0x65d6a1['attributes']:_0x2bb4f7[_0x64b4('0x38')];if(_0x49664f['query']['includeAll']){_0x65d6a1[_0x64b4('0x49')]=[{'all':!![]}];}_0x65d6a1=_['merge']({},_0x65d6a1,_0x49664f['options']);return db['FreshsalesConfiguration']['find'](_0x65d6a1)['then'](handleEntityNotFound(_0x431800,null))[_0x64b4('0x2f')](respondWithResult(_0x431800,null))[_0x64b4('0x24')](handleError(_0x431800,null));};exports['create']=function(_0x28e279,_0x3802ae){return db[_0x64b4('0x35')]['create'](_0x28e279['body'],{})[_0x64b4('0x2f')](respondWithResult(_0x3802ae,0xc9))['catch'](handleError(_0x3802ae,null));};exports[_0x64b4('0x4d')]=function(_0x852f49,_0x10701b){if(_0x852f49[_0x64b4('0x4e')]['id']){delete _0x852f49[_0x64b4('0x4e')]['id'];}return db[_0x64b4('0x35')][_0x64b4('0x4f')]({'where':{'id':_0x852f49[_0x64b4('0x4a')]['id']}})[_0x64b4('0x2f')](handleEntityNotFound(_0x10701b,null))['then'](saveUpdates(_0x852f49[_0x64b4('0x4e')],null))[_0x64b4('0x2f')](respondWithResult(_0x10701b,null))[_0x64b4('0x24')](handleError(_0x10701b,null));};exports[_0x64b4('0x30')]=function(_0x47a599,_0x31ec62){return db[_0x64b4('0x35')][_0x64b4('0x4f')]({'where':{'id':_0x47a599['params']['id']}})[_0x64b4('0x2f')](handleEntityNotFound(_0x31ec62,null))[_0x64b4('0x2f')](removeEntity(_0x31ec62,null))[_0x64b4('0x24')](handleError(_0x31ec62,null));};exports[_0x64b4('0x50')]=function(_0xc2a051,_0x28ed82,_0x55eaa1){var _0x4013e0={};var _0x262ce0={};var _0x23c277;var _0x594ffb;return db[_0x64b4('0x35')][_0x64b4('0x51')]({'where':{'id':_0xc2a051[_0x64b4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x28ed82,null))[_0x64b4('0x2f')](function(_0x5aee3b){if(_0x5aee3b){_0x23c277=_0x5aee3b;_0x262ce0['model']=_[_0x64b4('0x4b')](db[_0x64b4('0x52')][_0x64b4('0x4c')]);_0x262ce0[_0x64b4('0x39')]=_[_0x64b4('0x4b')](_0xc2a051['query']);_0x262ce0['filters']=_[_0x64b4('0x3a')](_0x262ce0[_0x64b4('0x38')],_0x262ce0[_0x64b4('0x39')]);_0x4013e0[_0x64b4('0x3b')]=_[_0x64b4('0x3a')](_0x262ce0[_0x64b4('0x38')],qs[_0x64b4('0x3c')](_0xc2a051[_0x64b4('0x39')][_0x64b4('0x3c')]));_0x4013e0['attributes']=_0x4013e0[_0x64b4('0x3b')][_0x64b4('0x3d')]?_0x4013e0[_0x64b4('0x3b')]:_0x262ce0[_0x64b4('0x38')];_0x4013e0[_0x64b4('0x53')]=qs['sort'](_0xc2a051[_0x64b4('0x39')]['sort']);_0x4013e0[_0x64b4('0x43')]=qs[_0x64b4('0x41')](_['pick'](_0xc2a051[_0x64b4('0x39')],_0x262ce0['filters']));if(_0xc2a051['query'][_0x64b4('0x54')]){_0x4013e0[_0x64b4('0x43')]=_[_0x64b4('0x44')](_0x4013e0[_0x64b4('0x43')],{'$or':_[_0x64b4('0x34')](_0x4013e0[_0x64b4('0x3b')],function(_0x2827f2){var _0x286260={};_0x286260[_0x2827f2]={'$like':'%'+_0xc2a051[_0x64b4('0x39')][_0x64b4('0x54')]+'%'};return _0x286260;})});}_0x4013e0=_[_0x64b4('0x44')]({},_0x4013e0,_0xc2a051['options']);return _0x23c277[_0x64b4('0x50')](_0x4013e0);}})['then'](function(_0x3f2c41){if(_0x3f2c41){_0x594ffb=_0x3f2c41['length'];if(!_0xc2a051[_0x64b4('0x39')][_0x64b4('0x3e')]('nolimit')){_0x4013e0[_0x64b4('0x2a')]=qs[_0x64b4('0x2a')](_0xc2a051[_0x64b4('0x39')][_0x64b4('0x2a')]);_0x4013e0[_0x64b4('0x29')]=qs['offset'](_0xc2a051[_0x64b4('0x39')][_0x64b4('0x29')]);}return _0x23c277[_0x64b4('0x50')](_0x4013e0);}})[_0x64b4('0x2f')](function(_0x475383){if(_0x475383){return _0x475383?{'count':_0x594ffb,'rows':_0x475383}:null;}})[_0x64b4('0x2f')](respondWithResult(_0x28ed82,null))[_0x64b4('0x24')](handleError(_0x28ed82,null));};exports[_0x64b4('0x55')]=function(_0x39f9be,_0x22a8a5,_0x37494d){var _0x55c3c2={};var _0x13e46d={};var _0x488826;var _0x2238ae;return db[_0x64b4('0x35')]['findOne']({'where':{'id':_0x39f9be[_0x64b4('0x4a')]['id']}})[_0x64b4('0x2f')](handleEntityNotFound(_0x22a8a5,null))[_0x64b4('0x2f')](function(_0x326a1a){if(_0x326a1a){_0x488826=_0x326a1a;_0x13e46d[_0x64b4('0x38')]=_[_0x64b4('0x4b')](db[_0x64b4('0x52')][_0x64b4('0x4c')]);_0x13e46d[_0x64b4('0x39')]=_[_0x64b4('0x4b')](_0x39f9be[_0x64b4('0x39')]);_0x13e46d[_0x64b4('0x41')]=_['intersection'](_0x13e46d[_0x64b4('0x38')],_0x13e46d['query']);_0x55c3c2[_0x64b4('0x3b')]=_[_0x64b4('0x3a')](_0x13e46d[_0x64b4('0x38')],qs['fields'](_0x39f9be[_0x64b4('0x39')]['fields']));_0x55c3c2[_0x64b4('0x3b')]=_0x55c3c2[_0x64b4('0x3b')][_0x64b4('0x3d')]?_0x55c3c2[_0x64b4('0x3b')]:_0x13e46d[_0x64b4('0x38')];_0x55c3c2[_0x64b4('0x53')]=qs[_0x64b4('0x40')](_0x39f9be[_0x64b4('0x39')]['sort']);_0x55c3c2[_0x64b4('0x43')]=qs[_0x64b4('0x41')](_[_0x64b4('0x42')](_0x39f9be[_0x64b4('0x39')],_0x13e46d[_0x64b4('0x41')]));if(_0x39f9be['query'][_0x64b4('0x54')]){_0x55c3c2[_0x64b4('0x43')]=_[_0x64b4('0x44')](_0x55c3c2[_0x64b4('0x43')],{'$or':_[_0x64b4('0x34')](_0x55c3c2[_0x64b4('0x3b')],function(_0x9066e3){var _0x28f7fe={};_0x28f7fe[_0x9066e3]={'$like':'%'+_0x39f9be[_0x64b4('0x39')][_0x64b4('0x54')]+'%'};return _0x28f7fe;})});}_0x55c3c2=_['merge']({},_0x55c3c2,_0x39f9be[_0x64b4('0x46')]);return _0x488826[_0x64b4('0x55')](_0x55c3c2);}})[_0x64b4('0x2f')](function(_0x286959){if(_0x286959){_0x2238ae=_0x286959[_0x64b4('0x3d')];if(!_0x39f9be[_0x64b4('0x39')][_0x64b4('0x3e')](_0x64b4('0x3f'))){_0x55c3c2[_0x64b4('0x2a')]=qs[_0x64b4('0x2a')](_0x39f9be['query'][_0x64b4('0x2a')]);_0x55c3c2['offset']=qs['offset'](_0x39f9be[_0x64b4('0x39')][_0x64b4('0x29')]);}return _0x488826['getDescriptions'](_0x55c3c2);}})[_0x64b4('0x2f')](function(_0x410fc6){if(_0x410fc6){return _0x410fc6?{'count':_0x2238ae,'rows':_0x410fc6}:null;}})[_0x64b4('0x2f')](respondWithResult(_0x22a8a5,null))[_0x64b4('0x24')](handleError(_0x22a8a5,null));};exports[_0x64b4('0x56')]=function(_0x4c7f5a,_0x1137e7,_0x574550){var _0x438cb7={};var _0x2baf62={};var _0x4b0831;var _0x17e64e;return db[_0x64b4('0x35')]['findOne']({'where':{'id':_0x4c7f5a['params']['id']}})[_0x64b4('0x2f')](handleEntityNotFound(_0x1137e7,null))[_0x64b4('0x2f')](function(_0x5dd08b){if(_0x5dd08b){_0x4b0831=_0x5dd08b;_0x2baf62['model']=_[_0x64b4('0x4b')](db[_0x64b4('0x52')][_0x64b4('0x4c')]);_0x2baf62[_0x64b4('0x39')]=_[_0x64b4('0x4b')](_0x4c7f5a[_0x64b4('0x39')]);_0x2baf62[_0x64b4('0x41')]=_[_0x64b4('0x3a')](_0x2baf62[_0x64b4('0x38')],_0x2baf62[_0x64b4('0x39')]);_0x438cb7[_0x64b4('0x3b')]=_[_0x64b4('0x3a')](_0x2baf62[_0x64b4('0x38')],qs[_0x64b4('0x3c')](_0x4c7f5a['query']['fields']));_0x438cb7[_0x64b4('0x3b')]=_0x438cb7[_0x64b4('0x3b')][_0x64b4('0x3d')]?_0x438cb7['attributes']:_0x2baf62[_0x64b4('0x38')];_0x438cb7[_0x64b4('0x53')]=qs[_0x64b4('0x40')](_0x4c7f5a[_0x64b4('0x39')]['sort']);_0x438cb7['where']=qs['filters'](_['pick'](_0x4c7f5a['query'],_0x2baf62['filters']));if(_0x4c7f5a[_0x64b4('0x39')]['filter']){_0x438cb7[_0x64b4('0x43')]=_[_0x64b4('0x44')](_0x438cb7[_0x64b4('0x43')],{'$or':_[_0x64b4('0x34')](_0x438cb7['attributes'],function(_0x1609dc){var _0x5bc3b9={};_0x5bc3b9[_0x1609dc]={'$like':'%'+_0x4c7f5a[_0x64b4('0x39')][_0x64b4('0x54')]+'%'};return _0x5bc3b9;})});}_0x438cb7=_[_0x64b4('0x44')]({},_0x438cb7,_0x4c7f5a[_0x64b4('0x46')]);return _0x4b0831[_0x64b4('0x56')](_0x438cb7);}})[_0x64b4('0x2f')](function(_0x3e3568){if(_0x3e3568){_0x17e64e=_0x3e3568[_0x64b4('0x3d')];if(!_0x4c7f5a[_0x64b4('0x39')][_0x64b4('0x3e')]('nolimit')){_0x438cb7['limit']=qs[_0x64b4('0x2a')](_0x4c7f5a[_0x64b4('0x39')][_0x64b4('0x2a')]);_0x438cb7[_0x64b4('0x29')]=qs[_0x64b4('0x29')](_0x4c7f5a[_0x64b4('0x39')][_0x64b4('0x29')]);}return _0x4b0831[_0x64b4('0x56')](_0x438cb7);}})[_0x64b4('0x2f')](function(_0x53d2e0){if(_0x53d2e0){return _0x53d2e0?{'count':_0x17e64e,'rows':_0x53d2e0}:null;}})[_0x64b4('0x2f')](respondWithResult(_0x1137e7,null))[_0x64b4('0x24')](handleError(_0x1137e7,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 913f6b8..648643d 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 _0x2242=['util','../../config/logger','moment','bluebird','path','rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x12f0e5,_0x34fc25){var _0x2f60b0=function(_0x5cc213){while(--_0x5cc213){_0x12f0e5['push'](_0x12f0e5['shift']());}};_0x2f60b0(++_0x34fc25);}(_0x2242,0x1a3));var _0x2224=function(_0x5aa46a,_0x2ff57a){_0x5aa46a=_0x5aa46a-0x0;var _0x12b127=_0x2242[_0x5aa46a];return _0x12b127;};'use strict';var _=require(_0x2224('0x0'));var util=require(_0x2224('0x1'));var logger=require(_0x2224('0x2'))('api');var moment=require(_0x2224('0x3'));var BPromise=require(_0x2224('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2224('0x5'));var rimraf=require(_0x2224('0x6'));var config=require('../../config/environment');var attributes=require(_0x2224('0x7'));module[_0x2224('0x8')]=function(_0x23a873,_0x54d057){return _0x23a873[_0x2224('0x9')](_0x2224('0xa'),attributes,{'tableName':_0x2224('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04b8=['../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','util','api','moment','request-promise','path'];(function(_0x5819a8,_0x16c2a){var _0x498206=function(_0x461395){while(--_0x461395){_0x5819a8['push'](_0x5819a8['shift']());}};_0x498206(++_0x16c2a);}(_0x04b8,0x159));var _0x804b=function(_0x14d0d2,_0x2ad908){_0x14d0d2=_0x14d0d2-0x0;var _0x57b04e=_0x04b8[_0x14d0d2];return _0x57b04e;};'use strict';var _=require('lodash');var util=require(_0x804b('0x0'));var logger=require('../../config/logger')(_0x804b('0x1'));var moment=require(_0x804b('0x2'));var BPromise=require('bluebird');var rp=require(_0x804b('0x3'));var fs=require('fs');var path=require(_0x804b('0x4'));var rimraf=require('rimraf');var config=require(_0x804b('0x5'));var attributes=require(_0x804b('0x6'));module[_0x804b('0x7')]=function(_0x5a8a5b,_0x2c22e3){return _0x5a8a5b[_0x804b('0x8')](_0x804b('0x9'),attributes,{'tableName':'int_freshsales_configurations','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 2b673fc..742d84a 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 _0xfc73=['FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2d9a24,_0x59661e){var _0x2152fc=function(_0x45871b){while(--_0x45871b){_0x2d9a24['push'](_0x2d9a24['shift']());}};_0x2152fc(++_0x59661e);}(_0xfc73,0x8d));var _0x3fc7=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xfc73[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x3fc7('0x0'));var util=require(_0x3fc7('0x1'));var moment=require('moment');var BPromise=require(_0x3fc7('0x2'));var rs=require(_0x3fc7('0x3'));var fs=require('fs');var Redis=require(_0x3fc7('0x4'));var db=require(_0x3fc7('0x5'))['db'];var utils=require(_0x3fc7('0x6'));var logger=require(_0x3fc7('0x7'))(_0x3fc7('0x8'));var config=require(_0x3fc7('0x9'));var jayson=require(_0x3fc7('0xa'));var client=jayson[_0x3fc7('0xb')][_0x3fc7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1375dc,_0x5e41d3,_0x36ec87){return new BPromise(function(_0x12c2ec,_0x14cd0a){return client[_0x3fc7('0xd')](_0x1375dc,_0x36ec87)[_0x3fc7('0xe')](function(_0x4ed1e6){logger['info'](_0x3fc7('0xf'),_0x5e41d3,_0x3fc7('0x10'));logger[_0x3fc7('0x11')](_0x3fc7('0x12'),_0x5e41d3,_0x3fc7('0x10'),JSON[_0x3fc7('0x13')](_0x4ed1e6));if(_0x4ed1e6['error']){if(_0x4ed1e6['error'][_0x3fc7('0x14')]===0x1f4){logger['error'](_0x3fc7('0xf'),_0x5e41d3,_0x4ed1e6[_0x3fc7('0x15')][_0x3fc7('0x16')]);return _0x14cd0a(_0x4ed1e6[_0x3fc7('0x15')]['message']);}logger[_0x3fc7('0x15')](_0x3fc7('0xf'),_0x5e41d3,_0x4ed1e6[_0x3fc7('0x15')][_0x3fc7('0x16')]);return _0x12c2ec(_0x4ed1e6[_0x3fc7('0x15')][_0x3fc7('0x16')]);}else{logger[_0x3fc7('0x17')](_0x3fc7('0xf'),_0x5e41d3,_0x3fc7('0x10'));_0x12c2ec(_0x4ed1e6[_0x3fc7('0x18')][_0x3fc7('0x16')]);}})[_0x3fc7('0x19')](function(_0x10a0d3){logger[_0x3fc7('0x15')](_0x3fc7('0xf'),_0x5e41d3,_0x10a0d3);_0x14cd0a(_0x10a0d3);});});} \ No newline at end of file +var _0xe890=['result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe890,0x1a6));var _0x0e89=function(_0xf3c609,_0x2830fc){_0xf3c609=_0xf3c609-0x0;var _0x5ee364=_0xe890[_0xf3c609];return _0x5ee364;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0e89('0x0'));var BPromise=require(_0x0e89('0x1'));var rs=require(_0x0e89('0x2'));var fs=require('fs');var Redis=require(_0x0e89('0x3'));var db=require(_0x0e89('0x4'))['db'];var utils=require(_0x0e89('0x5'));var logger=require(_0x0e89('0x6'))(_0x0e89('0x7'));var config=require(_0x0e89('0x8'));var jayson=require(_0x0e89('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38ef9d,_0x4568a8,_0x50f325){return new BPromise(function(_0x17cf6a,_0x23655f){return client['request'](_0x38ef9d,_0x50f325)[_0x0e89('0xa')](function(_0x3f9333){logger[_0x0e89('0xb')](_0x0e89('0xc'),_0x4568a8,_0x0e89('0xd'));logger[_0x0e89('0xe')](_0x0e89('0xf'),_0x4568a8,_0x0e89('0xd'),JSON[_0x0e89('0x10')](_0x3f9333));if(_0x3f9333['error']){if(_0x3f9333['error']['code']===0x1f4){logger['error'](_0x0e89('0xc'),_0x4568a8,_0x3f9333[_0x0e89('0x11')][_0x0e89('0x12')]);return _0x23655f(_0x3f9333[_0x0e89('0x11')]['message']);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x4568a8,_0x3f9333[_0x0e89('0x11')][_0x0e89('0x12')]);return _0x17cf6a(_0x3f9333[_0x0e89('0x11')][_0x0e89('0x12')]);}else{logger[_0x0e89('0xb')](_0x0e89('0xc'),_0x4568a8,_0x0e89('0xd'));_0x17cf6a(_0x3f9333[_0x0e89('0x13')][_0x0e89('0x12')]);}})[_0x0e89('0x14')](function(_0x40f9a6){logger[_0x0e89('0x11')](_0x0e89('0xc'),_0x4568a8,_0x40f9a6);_0x23655f(_0x40f9a6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index f9fc6a4..60f8cfe 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 _0x0bb5=['put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','/:id','isAuthenticated','show','create'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x0bb5,0x148));var _0x50bb=function(_0x398abc,_0x22d480){_0x398abc=_0x398abc-0x0;var _0x4a00e8=_0x0bb5[_0x398abc];return _0x4a00e8;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x50bb('0xd')]);router[_0x50bb('0xe')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller['update']);router[_0x50bb('0xf')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x10')]);module[_0x50bb('0x11')]=router; \ No newline at end of file +var _0x0abf=['isAuthenticated','index','show','post','put','/:id','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x0abf,0xe8));var _0xf0ab=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0abf[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf0ab('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var controller=require(_0xf0ab('0x6'));router[_0xf0ab('0x7')]('/',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x9')]);router[_0xf0ab('0x7')]('/:id',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0xb')]('/',auth[_0xf0ab('0x8')](),controller['create']);router[_0xf0ab('0xc')](_0xf0ab('0xd'),auth[_0xf0ab('0x8')](),controller['update']);router['delete'](_0xf0ab('0xd'),auth['isAuthenticated'](),controller[_0xf0ab('0xe')]);module[_0xf0ab('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 681c799..f0bd981 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(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x326f,0xd1));var _0xf326=function(_0x41760a,_0x4fa52a){_0x41760a=_0x41760a-0x0;var _0x54b7f2=_0x326f[_0x41760a];return _0x54b7f2;};'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 _0x11e5=['picklist','STRING','variable','BOOLEAN','sequelize','ENUM','string','customVariable','keyValue'];(function(_0x5c321a,_0x57bdac){var _0x3a1b28=function(_0x25d7ab){while(--_0x25d7ab){_0x5c321a['push'](_0x5c321a['shift']());}};_0x3a1b28(++_0x57bdac);}(_0x11e5,0x8b));var _0x511e=function(_0x4789cd,_0x1d18d6){_0x4789cd=_0x4789cd-0x0;var _0x39f810=_0x11e5[_0x4789cd];return _0x39f810;};'use strict';var Sequelize=require(_0x511e('0x0'));module['exports']={'type':{'type':Sequelize[_0x511e('0x1')](_0x511e('0x2'),'variable',_0x511e('0x3'),_0x511e('0x4'),_0x511e('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x511e('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x511e('0x2'),_0x511e('0x7'),_0x511e('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x511e('0x6')]},'customField':{'type':Sequelize[_0x511e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x511e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 3200da2..f823f1d 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 _0xea26=['rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','save','update','destroy','then','error','name','index','rawAttributes','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','FreshsalesField','include','findAll'];(function(_0x57565d,_0x2de66c){var _0xe1d8ce=function(_0x40426f){while(--_0x40426f){_0x57565d['push'](_0x57565d['shift']());}};_0xe1d8ce(++_0x2de66c);}(_0xea26,0xdd));var _0x6ea2=function(_0x28f7cb,_0x6412f7){_0x28f7cb=_0x28f7cb-0x0;var _0x2bb668=_0xea26[_0x28f7cb];return _0x2bb668;};'use strict';var emlformat=require(_0x6ea2('0x0'));var rimraf=require(_0x6ea2('0x1'));var zipdir=require(_0x6ea2('0x2'));var jsonpatch=require(_0x6ea2('0x3'));var rp=require('request-promise');var moment=require(_0x6ea2('0x4'));var BPromise=require(_0x6ea2('0x5'));var Mustache=require(_0x6ea2('0x6'));var util=require(_0x6ea2('0x7'));var path=require(_0x6ea2('0x8'));var sox=require('sox');var csv=require(_0x6ea2('0x9'));var ejs=require(_0x6ea2('0xa'));var fs=require('fs');var fs_extra=require(_0x6ea2('0xb'));var _=require('lodash');var squel=require(_0x6ea2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6ea2('0xd'));var toCsv=require(_0x6ea2('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6ea2('0xe'));var authService=require(_0x6ea2('0xf'));var qs=require(_0x6ea2('0x10'));var as=require(_0x6ea2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ea2('0x12'))(_0x6ea2('0x13'));var utils=require(_0x6ea2('0x14'));var config=require(_0x6ea2('0x15'));var licenseUtil=require(_0x6ea2('0x16'));var db=require(_0x6ea2('0x17'))['db'];function respondWithStatusCode(_0x6e8e5e,_0x26f143){_0x26f143=_0x26f143||0xcc;return function(_0x32e616){if(_0x32e616){return _0x6e8e5e[_0x6ea2('0x18')](_0x26f143);}return _0x6e8e5e[_0x6ea2('0x19')](_0x26f143)[_0x6ea2('0x1a')]();};}function respondWithResult(_0x279557,_0x4626ed){_0x4626ed=_0x4626ed||0xc8;return function(_0x252f5e){if(_0x252f5e){return _0x279557[_0x6ea2('0x19')](_0x4626ed)['json'](_0x252f5e);}};}function respondWithFilteredResult(_0x4fe6aa,_0x1e41f9){return function(_0x2877b7){if(_0x2877b7){var _0x12430a=_0x2877b7[_0x6ea2('0x1b')],_0x19db8f=_0x1e41f9['offset'],_0x485d4b=_0x1e41f9[_0x6ea2('0x1c')]+_0x1e41f9[_0x6ea2('0x1d')],_0xe480de;if(_0x485d4b>=_0x12430a){_0x485d4b=_0x12430a;_0xe480de=0xc8;}else{_0xe480de=0xce;}_0x4fe6aa[_0x6ea2('0x19')](_0xe480de);return _0x4fe6aa['set'](_0x6ea2('0x1e'),_0x19db8f+'-'+_0x485d4b+'/'+_0x12430a)[_0x6ea2('0x1f')](_0x2877b7);}return null;};}function patchUpdates(_0x1a48b8){return function(_0x4cc3fd){try{jsonpatch['apply'](_0x4cc3fd,_0x1a48b8,!![]);}catch(_0x4f608e){return BPromise['reject'](_0x4f608e);}return _0x4cc3fd[_0x6ea2('0x20')]();};}function saveUpdates(_0x5e9b4c,_0x5bb459){return function(_0x292595){if(_0x292595){return _0x292595[_0x6ea2('0x21')](_0x5e9b4c)['then'](function(_0x13c4f6){return _0x13c4f6;});}return null;};}function removeEntity(_0xbcba79,_0x4854ae){return function(_0x27558d){if(_0x27558d){return _0x27558d[_0x6ea2('0x22')]()[_0x6ea2('0x23')](function(){_0xbcba79[_0x6ea2('0x19')](0xcc)[_0x6ea2('0x1a')]();});}};}function handleEntityNotFound(_0x36c78e,_0x30af11){return function(_0x34f095){if(!_0x34f095){_0x36c78e[_0x6ea2('0x18')](0x194);}return _0x34f095;};}function handleError(_0x18f786,_0x4cb21a){_0x4cb21a=_0x4cb21a||0x1f4;return function(_0x2add46){logger[_0x6ea2('0x24')](_0x2add46['stack']);if(_0x2add46[_0x6ea2('0x25')]){delete _0x2add46['name'];}_0x18f786[_0x6ea2('0x19')](_0x4cb21a)['send'](_0x2add46);};}exports[_0x6ea2('0x26')]=function(_0x2ec596,_0x43e8b2){var _0x135bea={},_0x48bfa7={},_0x1eb1a9={'count':0x0,'rows':[]};var _0x4d2447=_['map'](db['FreshsalesField'][_0x6ea2('0x27')],function(_0x51a2d4){return{'name':_0x51a2d4['fieldName'],'type':_0x51a2d4['type'][_0x6ea2('0x28')]};});_0x48bfa7[_0x6ea2('0x29')]=_[_0x6ea2('0x2a')](_0x4d2447,'name');_0x48bfa7['query']=_[_0x6ea2('0x2b')](_0x2ec596[_0x6ea2('0x2c')]);_0x48bfa7[_0x6ea2('0x2d')]=_['intersection'](_0x48bfa7[_0x6ea2('0x29')],_0x48bfa7[_0x6ea2('0x2c')]);_0x135bea[_0x6ea2('0x2e')]=_[_0x6ea2('0x2f')](_0x48bfa7[_0x6ea2('0x29')],qs[_0x6ea2('0x30')](_0x2ec596[_0x6ea2('0x2c')]['fields']));_0x135bea[_0x6ea2('0x2e')]=_0x135bea[_0x6ea2('0x2e')][_0x6ea2('0x31')]?_0x135bea['attributes']:_0x48bfa7[_0x6ea2('0x29')];if(!_0x2ec596[_0x6ea2('0x2c')][_0x6ea2('0x32')]('nolimit')){_0x135bea[_0x6ea2('0x1d')]=qs[_0x6ea2('0x1d')](_0x2ec596[_0x6ea2('0x2c')]['limit']);_0x135bea[_0x6ea2('0x1c')]=qs[_0x6ea2('0x1c')](_0x2ec596[_0x6ea2('0x2c')][_0x6ea2('0x1c')]);}_0x135bea[_0x6ea2('0x33')]=qs[_0x6ea2('0x34')](_0x2ec596['query'][_0x6ea2('0x34')]);_0x135bea[_0x6ea2('0x35')]=qs[_0x6ea2('0x2d')](_[_0x6ea2('0x36')](_0x2ec596[_0x6ea2('0x2c')],_0x48bfa7[_0x6ea2('0x2d')]),_0x4d2447);if(_0x2ec596[_0x6ea2('0x2c')][_0x6ea2('0x37')]){_0x135bea[_0x6ea2('0x35')]=_[_0x6ea2('0x38')](_0x135bea['where'],{'$or':_[_0x6ea2('0x2a')](_0x4d2447,function(_0x3fad2f){if(_0x3fad2f[_0x6ea2('0x39')]!==_0x6ea2('0x3a')){var _0x394792={};_0x394792[_0x3fad2f[_0x6ea2('0x25')]]={'$like':'%'+_0x2ec596[_0x6ea2('0x2c')]['filter']+'%'};return _0x394792;}})});}_0x135bea=_[_0x6ea2('0x38')]({},_0x135bea,_0x2ec596[_0x6ea2('0x3b')]);var _0x2b2e13={'where':_0x135bea[_0x6ea2('0x35')]};return db[_0x6ea2('0x3c')][_0x6ea2('0x1b')](_0x2b2e13)['then'](function(_0x4389fc){_0x1eb1a9[_0x6ea2('0x1b')]=_0x4389fc;if(_0x2ec596[_0x6ea2('0x2c')]['includeAll']){_0x135bea[_0x6ea2('0x3d')]=[{'all':!![]}];}return db[_0x6ea2('0x3c')][_0x6ea2('0x3e')](_0x135bea);})['then'](function(_0x264c43){_0x1eb1a9[_0x6ea2('0x3f')]=_0x264c43;return _0x1eb1a9;})[_0x6ea2('0x23')](respondWithFilteredResult(_0x43e8b2,_0x135bea))[_0x6ea2('0x40')](handleError(_0x43e8b2,null));};exports[_0x6ea2('0x41')]=function(_0x593c9a,_0x564e2e){var _0xeb887e={'raw':!![],'where':{'id':_0x593c9a[_0x6ea2('0x42')]['id']}},_0x337633={};_0x337633[_0x6ea2('0x29')]=_['keys'](db['FreshsalesField'][_0x6ea2('0x27')]);_0x337633[_0x6ea2('0x2c')]=_[_0x6ea2('0x2b')](_0x593c9a[_0x6ea2('0x2c')]);_0x337633['filters']=_[_0x6ea2('0x2f')](_0x337633[_0x6ea2('0x29')],_0x337633['query']);_0xeb887e[_0x6ea2('0x2e')]=_[_0x6ea2('0x2f')](_0x337633[_0x6ea2('0x29')],qs[_0x6ea2('0x30')](_0x593c9a[_0x6ea2('0x2c')][_0x6ea2('0x30')]));_0xeb887e[_0x6ea2('0x2e')]=_0xeb887e[_0x6ea2('0x2e')][_0x6ea2('0x31')]?_0xeb887e[_0x6ea2('0x2e')]:_0x337633[_0x6ea2('0x29')];if(_0x593c9a['query'][_0x6ea2('0x43')]){_0xeb887e[_0x6ea2('0x3d')]=[{'all':!![]}];}_0xeb887e=_[_0x6ea2('0x38')]({},_0xeb887e,_0x593c9a['options']);return db[_0x6ea2('0x3c')][_0x6ea2('0x44')](_0xeb887e)['then'](handleEntityNotFound(_0x564e2e,null))[_0x6ea2('0x23')](respondWithResult(_0x564e2e,null))[_0x6ea2('0x40')](handleError(_0x564e2e,null));};exports[_0x6ea2('0x45')]=function(_0x364d5f,_0x1e3ab4){return db[_0x6ea2('0x3c')]['create'](_0x364d5f['body'],{})[_0x6ea2('0x23')](respondWithResult(_0x1e3ab4,0xc9))[_0x6ea2('0x40')](handleError(_0x1e3ab4,null));};exports[_0x6ea2('0x21')]=function(_0x4ed827,_0x17727d){if(_0x4ed827['body']['id']){delete _0x4ed827[_0x6ea2('0x46')]['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x4ed827[_0x6ea2('0x42')]['id']}})[_0x6ea2('0x23')](handleEntityNotFound(_0x17727d,null))[_0x6ea2('0x23')](saveUpdates(_0x4ed827[_0x6ea2('0x46')],null))[_0x6ea2('0x23')](respondWithResult(_0x17727d,null))['catch'](handleError(_0x17727d,null));};exports[_0x6ea2('0x22')]=function(_0x498109,_0x171566){return db[_0x6ea2('0x3c')][_0x6ea2('0x44')]({'where':{'id':_0x498109[_0x6ea2('0x42')]['id']}})[_0x6ea2('0x23')](handleEntityNotFound(_0x171566,null))[_0x6ea2('0x23')](removeEntity(_0x171566,null))[_0x6ea2('0x40')](handleError(_0x171566,null));}; \ No newline at end of file +var _0xb5b7=['fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','FreshsalesField','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','fieldName','type','query','keys','filters','model','attributes','intersection'];(function(_0x17a28b,_0x5d1465){var _0x9cbb5a=function(_0x24e3c9){while(--_0x24e3c9){_0x17a28b['push'](_0x17a28b['shift']());}};_0x9cbb5a(++_0x5d1465);}(_0xb5b7,0xa6));var _0x7b5b=function(_0x15b92f,_0x55808a){_0x15b92f=_0x15b92f-0x0;var _0xa5cd5a=_0xb5b7[_0x15b92f];return _0xa5cd5a;};'use strict';var emlformat=require(_0x7b5b('0x0'));var rimraf=require(_0x7b5b('0x1'));var zipdir=require(_0x7b5b('0x2'));var jsonpatch=require(_0x7b5b('0x3'));var rp=require('request-promise');var moment=require(_0x7b5b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7b5b('0x5'));var path=require(_0x7b5b('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(_0x7b5b('0x7'));var squel=require(_0x7b5b('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7b5b('0x9'));var toCsv=require(_0x7b5b('0xa'));var querystring=require(_0x7b5b('0xb'));var Papa=require(_0x7b5b('0xc'));var Redis=require('ioredis');var authService=require(_0x7b5b('0xd'));var qs=require(_0x7b5b('0xe'));var as=require(_0x7b5b('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b5b('0x10'))(_0x7b5b('0x11'));var utils=require(_0x7b5b('0x12'));var config=require(_0x7b5b('0x13'));var licenseUtil=require(_0x7b5b('0x14'));var db=require(_0x7b5b('0x15'))['db'];function respondWithStatusCode(_0x3f4ee0,_0x205219){_0x205219=_0x205219||0xcc;return function(_0x4f5bf5){if(_0x4f5bf5){return _0x3f4ee0[_0x7b5b('0x16')](_0x205219);}return _0x3f4ee0['status'](_0x205219)[_0x7b5b('0x17')]();};}function respondWithResult(_0x181c46,_0x475399){_0x475399=_0x475399||0xc8;return function(_0xffdda){if(_0xffdda){return _0x181c46[_0x7b5b('0x18')](_0x475399)[_0x7b5b('0x19')](_0xffdda);}};}function respondWithFilteredResult(_0x34a243,_0x3da371){return function(_0xc193c7){if(_0xc193c7){var _0x5c0826=_0xc193c7[_0x7b5b('0x1a')],_0x34b9a9=_0x3da371['offset'],_0x4b0f7b=_0x3da371[_0x7b5b('0x1b')]+_0x3da371[_0x7b5b('0x1c')],_0x1f25b4;if(_0x4b0f7b>=_0x5c0826){_0x4b0f7b=_0x5c0826;_0x1f25b4=0xc8;}else{_0x1f25b4=0xce;}_0x34a243[_0x7b5b('0x18')](_0x1f25b4);return _0x34a243['set'](_0x7b5b('0x1d'),_0x34b9a9+'-'+_0x4b0f7b+'/'+_0x5c0826)[_0x7b5b('0x19')](_0xc193c7);}return null;};}function patchUpdates(_0x30ca27){return function(_0x3c8ad8){try{jsonpatch[_0x7b5b('0x1e')](_0x3c8ad8,_0x30ca27,!![]);}catch(_0x1e5782){return BPromise[_0x7b5b('0x1f')](_0x1e5782);}return _0x3c8ad8[_0x7b5b('0x20')]();};}function saveUpdates(_0x1dc9c6,_0xf36e21){return function(_0x3123de){if(_0x3123de){return _0x3123de[_0x7b5b('0x21')](_0x1dc9c6)['then'](function(_0x1baf24){return _0x1baf24;});}return null;};}function removeEntity(_0x5c07e3,_0x4d5e01){return function(_0x396782){if(_0x396782){return _0x396782[_0x7b5b('0x22')]()[_0x7b5b('0x23')](function(){_0x5c07e3[_0x7b5b('0x18')](0xcc)[_0x7b5b('0x17')]();});}};}function handleEntityNotFound(_0xd9cb7c,_0x2a83d1){return function(_0x4b78e8){if(!_0x4b78e8){_0xd9cb7c[_0x7b5b('0x16')](0x194);}return _0x4b78e8;};}function handleError(_0x5bc461,_0x673b45){_0x673b45=_0x673b45||0x1f4;return function(_0x14fe52){logger[_0x7b5b('0x24')](_0x14fe52[_0x7b5b('0x25')]);if(_0x14fe52[_0x7b5b('0x26')]){delete _0x14fe52[_0x7b5b('0x26')];}_0x5bc461[_0x7b5b('0x18')](_0x673b45)[_0x7b5b('0x27')](_0x14fe52);};}exports[_0x7b5b('0x28')]=function(_0x514636,_0x1ae784){var _0x250628={},_0x8efa93={},_0x2c4d2e={'count':0x0,'rows':[]};var _0x23bd0b=_[_0x7b5b('0x29')](db['FreshsalesField']['rawAttributes'],function(_0x31892a){return{'name':_0x31892a[_0x7b5b('0x2a')],'type':_0x31892a[_0x7b5b('0x2b')]['key']};});_0x8efa93['model']=_[_0x7b5b('0x29')](_0x23bd0b,'name');_0x8efa93[_0x7b5b('0x2c')]=_[_0x7b5b('0x2d')](_0x514636[_0x7b5b('0x2c')]);_0x8efa93[_0x7b5b('0x2e')]=_['intersection'](_0x8efa93[_0x7b5b('0x2f')],_0x8efa93['query']);_0x250628[_0x7b5b('0x30')]=_[_0x7b5b('0x31')](_0x8efa93['model'],qs['fields'](_0x514636['query'][_0x7b5b('0x32')]));_0x250628[_0x7b5b('0x30')]=_0x250628[_0x7b5b('0x30')][_0x7b5b('0x33')]?_0x250628['attributes']:_0x8efa93['model'];if(!_0x514636[_0x7b5b('0x2c')][_0x7b5b('0x34')](_0x7b5b('0x35'))){_0x250628['limit']=qs['limit'](_0x514636[_0x7b5b('0x2c')][_0x7b5b('0x1c')]);_0x250628[_0x7b5b('0x1b')]=qs[_0x7b5b('0x1b')](_0x514636['query'][_0x7b5b('0x1b')]);}_0x250628['order']=qs[_0x7b5b('0x36')](_0x514636['query'][_0x7b5b('0x36')]);_0x250628[_0x7b5b('0x37')]=qs[_0x7b5b('0x2e')](_['pick'](_0x514636[_0x7b5b('0x2c')],_0x8efa93[_0x7b5b('0x2e')]),_0x23bd0b);if(_0x514636[_0x7b5b('0x2c')][_0x7b5b('0x38')]){_0x250628[_0x7b5b('0x37')]=_[_0x7b5b('0x39')](_0x250628['where'],{'$or':_[_0x7b5b('0x29')](_0x23bd0b,function(_0x4b4208){if(_0x4b4208[_0x7b5b('0x2b')]!==_0x7b5b('0x3a')){var _0xec4645={};_0xec4645[_0x4b4208[_0x7b5b('0x26')]]={'$like':'%'+_0x514636['query'][_0x7b5b('0x38')]+'%'};return _0xec4645;}})});}_0x250628=_[_0x7b5b('0x39')]({},_0x250628,_0x514636[_0x7b5b('0x3b')]);var _0x385ca2={'where':_0x250628['where']};return db[_0x7b5b('0x3c')][_0x7b5b('0x1a')](_0x385ca2)[_0x7b5b('0x23')](function(_0x15a950){_0x2c4d2e[_0x7b5b('0x1a')]=_0x15a950;if(_0x514636[_0x7b5b('0x2c')]['includeAll']){_0x250628[_0x7b5b('0x3d')]=[{'all':!![]}];}return db['FreshsalesField'][_0x7b5b('0x3e')](_0x250628);})['then'](function(_0x22c424){_0x2c4d2e[_0x7b5b('0x3f')]=_0x22c424;return _0x2c4d2e;})[_0x7b5b('0x23')](respondWithFilteredResult(_0x1ae784,_0x250628))[_0x7b5b('0x40')](handleError(_0x1ae784,null));};exports[_0x7b5b('0x41')]=function(_0x4108cd,_0x500805){var _0xae1a6={'raw':!![],'where':{'id':_0x4108cd[_0x7b5b('0x42')]['id']}},_0xa919f1={};_0xa919f1[_0x7b5b('0x2f')]=_['keys'](db[_0x7b5b('0x3c')][_0x7b5b('0x43')]);_0xa919f1['query']=_['keys'](_0x4108cd[_0x7b5b('0x2c')]);_0xa919f1['filters']=_['intersection'](_0xa919f1[_0x7b5b('0x2f')],_0xa919f1[_0x7b5b('0x2c')]);_0xae1a6[_0x7b5b('0x30')]=_[_0x7b5b('0x31')](_0xa919f1[_0x7b5b('0x2f')],qs[_0x7b5b('0x32')](_0x4108cd['query'][_0x7b5b('0x32')]));_0xae1a6[_0x7b5b('0x30')]=_0xae1a6[_0x7b5b('0x30')][_0x7b5b('0x33')]?_0xae1a6[_0x7b5b('0x30')]:_0xa919f1[_0x7b5b('0x2f')];if(_0x4108cd[_0x7b5b('0x2c')][_0x7b5b('0x44')]){_0xae1a6[_0x7b5b('0x3d')]=[{'all':!![]}];}_0xae1a6=_['merge']({},_0xae1a6,_0x4108cd[_0x7b5b('0x3b')]);return db[_0x7b5b('0x3c')][_0x7b5b('0x45')](_0xae1a6)[_0x7b5b('0x23')](handleEntityNotFound(_0x500805,null))[_0x7b5b('0x23')](respondWithResult(_0x500805,null))[_0x7b5b('0x40')](handleError(_0x500805,null));};exports['create']=function(_0x2c8781,_0xad9d10){return db[_0x7b5b('0x3c')][_0x7b5b('0x46')](_0x2c8781['body'],{})[_0x7b5b('0x23')](respondWithResult(_0xad9d10,0xc9))['catch'](handleError(_0xad9d10,null));};exports[_0x7b5b('0x21')]=function(_0x3e8d10,_0x30d341){if(_0x3e8d10[_0x7b5b('0x47')]['id']){delete _0x3e8d10[_0x7b5b('0x47')]['id'];}return db[_0x7b5b('0x3c')][_0x7b5b('0x45')]({'where':{'id':_0x3e8d10[_0x7b5b('0x42')]['id']}})[_0x7b5b('0x23')](handleEntityNotFound(_0x30d341,null))[_0x7b5b('0x23')](saveUpdates(_0x3e8d10[_0x7b5b('0x47')],null))[_0x7b5b('0x23')](respondWithResult(_0x30d341,null))[_0x7b5b('0x40')](handleError(_0x30d341,null));};exports['destroy']=function(_0x32793b,_0x4171c8){return db[_0x7b5b('0x3c')][_0x7b5b('0x45')]({'where':{'id':_0x32793b[_0x7b5b('0x42')]['id']}})[_0x7b5b('0x23')](handleEntityNotFound(_0x4171c8,null))['then'](removeEntity(_0x4171c8,null))[_0x7b5b('0x40')](handleError(_0x4171c8,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index d54e0e2..5606bf7 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 _0x0b0d=['../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','idField','FieldId','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x2d27dd,_0x1cbf98){var _0x3911ad=function(_0x8e2de5){while(--_0x8e2de5){_0x2d27dd['push'](_0x2d27dd['shift']());}};_0x3911ad(++_0x1cbf98);}(_0x0b0d,0x117));var _0xd0b0=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x0b0d[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0xd0b0('0x0'));var util=require(_0xd0b0('0x1'));var logger=require(_0xd0b0('0x2'))(_0xd0b0('0x3'));var moment=require(_0xd0b0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd0b0('0x5'));var rimraf=require(_0xd0b0('0x6'));var config=require(_0xd0b0('0x7'));var attributes=require(_0xd0b0('0x8'));module[_0xd0b0('0x9')]=function(_0x1b625c,_0xda7a16){return _0x1b625c['define'](_0xd0b0('0xa'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xd0b0('0xb'),_0xd0b0('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6905=['api','moment','path','rimraf','../../config/environment','define','FreshsalesField','int_freshsales_fields','FieldId','../../config/logger'];(function(_0x7cf489,_0x109052){var _0xbfabe1=function(_0x3c8063){while(--_0x3c8063){_0x7cf489['push'](_0x7cf489['shift']());}};_0xbfabe1(++_0x109052);}(_0x6905,0xef));var _0x5690=function(_0x3ed054,_0x4d4f16){_0x3ed054=_0x3ed054-0x0;var _0x16dd95=_0x6905[_0x3ed054];return _0x16dd95;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5690('0x0'))(_0x5690('0x1'));var moment=require(_0x5690('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5690('0x3'));var rimraf=require(_0x5690('0x4'));var config=require(_0x5690('0x5'));var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x1fbcc5,_0x212eca){return _0x1fbcc5[_0x5690('0x6')](_0x5690('0x7'),attributes,{'tableName':_0x5690('0x8'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField',_0x5690('0x9')],'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 47b472c..7f5accb 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 _0x31c2=['stringify','error','code','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x376b7b,_0x372135){var _0x227525=function(_0x14eae0){while(--_0x14eae0){_0x376b7b['push'](_0x376b7b['shift']());}};_0x227525(++_0x372135);}(_0x31c2,0x1be));var _0x231c=function(_0x4c3c3e,_0x3a2d73){_0x4c3c3e=_0x4c3c3e-0x0;var _0x359c7a=_0x31c2[_0x4c3c3e];return _0x359c7a;};'use strict';var _=require('lodash');var util=require(_0x231c('0x0'));var moment=require('moment');var BPromise=require(_0x231c('0x1'));var rs=require(_0x231c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x231c('0x3'))['db'];var utils=require(_0x231c('0x4'));var logger=require(_0x231c('0x5'))('rpc');var config=require(_0x231c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x231c('0x7')][_0x231c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x197968,_0x50ae14,_0x4c9530){return new BPromise(function(_0x216971,_0x2f0556){return client[_0x231c('0x9')](_0x197968,_0x4c9530)[_0x231c('0xa')](function(_0xf1677d){logger[_0x231c('0xb')](_0x231c('0xc'),_0x50ae14,'request\x20sent');logger[_0x231c('0xd')](_0x231c('0xe'),_0x50ae14,_0x231c('0xf'),JSON[_0x231c('0x10')](_0xf1677d));if(_0xf1677d[_0x231c('0x11')]){if(_0xf1677d[_0x231c('0x11')][_0x231c('0x12')]===0x1f4){logger[_0x231c('0x11')](_0x231c('0xc'),_0x50ae14,_0xf1677d[_0x231c('0x11')][_0x231c('0x13')]);return _0x2f0556(_0xf1677d[_0x231c('0x11')][_0x231c('0x13')]);}logger[_0x231c('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x50ae14,_0xf1677d[_0x231c('0x11')]['message']);return _0x216971(_0xf1677d[_0x231c('0x11')][_0x231c('0x13')]);}else{logger['info'](_0x231c('0xc'),_0x50ae14,_0x231c('0xf'));_0x216971(_0xf1677d[_0x231c('0x14')][_0x231c('0x13')]);}})[_0x231c('0x15')](function(_0x4c53b2){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x50ae14,_0x4c53b2);_0x2f0556(_0x4c53b2);});});} \ No newline at end of file +var _0xece2=['bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x40ff5a,_0xd84a1d){var _0x2643a9=function(_0x4fbcec){while(--_0x4fbcec){_0x40ff5a['push'](_0x40ff5a['shift']());}};_0x2643a9(++_0xd84a1d);}(_0xece2,0xb5));var _0x2ece=function(_0x34d479,_0x315857){_0x34d479=_0x34d479-0x0;var _0x47bdb7=_0xece2[_0x34d479];return _0x47bdb7;};'use strict';var _=require(_0x2ece('0x0'));var util=require(_0x2ece('0x1'));var moment=require(_0x2ece('0x2'));var BPromise=require(_0x2ece('0x3'));var rs=require(_0x2ece('0x4'));var fs=require('fs');var Redis=require(_0x2ece('0x5'));var db=require(_0x2ece('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2ece('0x7'));var config=require(_0x2ece('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2ece('0x9')][_0x2ece('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f5cf,_0x4ef292,_0x2711b7){return new BPromise(function(_0x53c905,_0x122f8e){return client[_0x2ece('0xb')](_0xe5f5cf,_0x2711b7)[_0x2ece('0xc')](function(_0x108cd0){logger[_0x2ece('0xd')](_0x2ece('0xe'),_0x4ef292,_0x2ece('0xf'));logger[_0x2ece('0x10')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x4ef292,_0x2ece('0xf'),JSON[_0x2ece('0x11')](_0x108cd0));if(_0x108cd0[_0x2ece('0x12')]){if(_0x108cd0[_0x2ece('0x12')][_0x2ece('0x13')]===0x1f4){logger[_0x2ece('0x12')](_0x2ece('0xe'),_0x4ef292,_0x108cd0[_0x2ece('0x12')][_0x2ece('0x14')]);return _0x122f8e(_0x108cd0[_0x2ece('0x12')][_0x2ece('0x14')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x4ef292,_0x108cd0[_0x2ece('0x12')][_0x2ece('0x14')]);return _0x53c905(_0x108cd0[_0x2ece('0x12')][_0x2ece('0x14')]);}else{logger[_0x2ece('0xd')](_0x2ece('0xe'),_0x4ef292,_0x2ece('0xf'));_0x53c905(_0x108cd0[_0x2ece('0x15')]['message']);}})[_0x2ece('0x16')](function(_0x450844){logger[_0x2ece('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x4ef292,_0x450844);_0x122f8e(_0x450844);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index f44fd1c..417a2e6 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 _0xf879=['show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xf879,0x106));var _0x9f87=function(_0x3d9b94,_0x51de49){_0x3d9b94=_0x3d9b94-0x0;var _0xb590e7=_0xf879[_0x3d9b94];return _0xb590e7;};'use strict';var multer=require(_0x9f87('0x0'));var util=require('util');var path=require(_0x9f87('0x1'));var timeout=require(_0x9f87('0x2'));var express=require(_0x9f87('0x3'));var router=express[_0x9f87('0x4')]();var fs_extra=require(_0x9f87('0x5'));var auth=require(_0x9f87('0x6'));var interaction=require(_0x9f87('0x7'));var config=require(_0x9f87('0x8'));var controller=require(_0x9f87('0x9'));router[_0x9f87('0xa')]('/',auth[_0x9f87('0xb')](),controller[_0x9f87('0xc')]);router[_0x9f87('0xa')](_0x9f87('0xd'),auth[_0x9f87('0xb')](),controller[_0x9f87('0xe')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x9f87('0xf')]);router['get'](_0x9f87('0x10'),auth[_0x9f87('0xb')](),controller[_0x9f87('0x11')]);router[_0x9f87('0x12')]('/',auth[_0x9f87('0xb')](),controller[_0x9f87('0x13')]);router['post'](_0x9f87('0x14'),auth[_0x9f87('0xb')](),controller['addConfiguration']);router['put'](_0x9f87('0xd'),auth[_0x9f87('0xb')](),controller['update']);router[_0x9f87('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x9f87('0x16')]=router; \ No newline at end of file +var _0x2104=['/:id/configurations','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','post'];(function(_0xe470b2,_0x13d3be){var _0x373fd7=function(_0x5c782b){while(--_0x5c782b){_0xe470b2['push'](_0xe470b2['shift']());}};_0x373fd7(++_0x13d3be);}(_0x2104,0x1bb));var _0x4210=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0x2104[_0x173f10];return _0x53142d;};'use strict';var multer=require(_0x4210('0x0'));var util=require('util');var path=require(_0x4210('0x1'));var timeout=require(_0x4210('0x2'));var express=require(_0x4210('0x3'));var router=express[_0x4210('0x4')]();var fs_extra=require(_0x4210('0x5'));var auth=require(_0x4210('0x6'));var interaction=require(_0x4210('0x7'));var config=require(_0x4210('0x8'));var controller=require(_0x4210('0x9'));router[_0x4210('0xa')]('/',auth[_0x4210('0xb')](),controller[_0x4210('0xc')]);router[_0x4210('0xa')](_0x4210('0xd'),auth[_0x4210('0xb')](),controller[_0x4210('0xe')]);router['get']('/:id/configurations',auth[_0x4210('0xb')](),controller['getConfigurations']);router[_0x4210('0xa')](_0x4210('0xf'),auth[_0x4210('0xb')](),controller['getFields']);router[_0x4210('0x10')]('/',auth[_0x4210('0xb')](),controller['create']);router['post'](_0x4210('0x11'),auth[_0x4210('0xb')](),controller['addConfiguration']);router[_0x4210('0x12')](_0x4210('0xd'),auth[_0x4210('0xb')](),controller[_0x4210('0x13')]);router[_0x4210('0x14')]('/:id',auth[_0x4210('0xb')](),controller[_0x4210('0x15')]);module[_0x4210('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 6621e09..9007137 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 _0x8fee=['newTab','sequelize','exports','STRING','username','ENUM','integrationTab'];(function(_0x2dbad9,_0xbf4667){var _0x479455=function(_0x40cf48){while(--_0x40cf48){_0x2dbad9['push'](_0x2dbad9['shift']());}};_0x479455(++_0xbf4667);}(_0x8fee,0x1e4));var _0xe8fe=function(_0x1fc1f9,_0x454fb2){_0x1fc1f9=_0x1fc1f9-0x0;var _0x4987ca=_0x8fee[_0x1fc1f9];return _0x4987ca;};'use strict';var Sequelize=require(_0xe8fe('0x0'));module[_0xe8fe('0x1')]={'name':{'type':Sequelize[_0xe8fe('0x2')]},'description':{'type':Sequelize[_0xe8fe('0x2')]},'username':{'type':Sequelize[_0xe8fe('0x2')],'unique':_0xe8fe('0x3')},'remoteUri':{'type':Sequelize[_0xe8fe('0x2')]},'password':{'type':Sequelize[_0xe8fe('0x2')]},'clientId':{'type':Sequelize[_0xe8fe('0x2')]},'clientSecret':{'type':Sequelize[_0xe8fe('0x2')]},'securityToken':{'type':Sequelize[_0xe8fe('0x2')]},'serverUrl':{'type':Sequelize[_0xe8fe('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe8fe('0x4')](_0xe8fe('0x5'),_0xe8fe('0x6')),'defaultValue':_0xe8fe('0x5')}}; \ No newline at end of file +var _0xff40=['STRING','username','ENUM','integrationTab','newTab','exports'];(function(_0x17eba5,_0x434f32){var _0x1aa6f1=function(_0x163713){while(--_0x163713){_0x17eba5['push'](_0x17eba5['shift']());}};_0x1aa6f1(++_0x434f32);}(_0xff40,0x1c7));var _0x0ff4=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0xff40[_0x14a0a0];return _0x56b651;};'use strict';var Sequelize=require('sequelize');module[_0x0ff4('0x0')]={'name':{'type':Sequelize[_0x0ff4('0x1')]},'description':{'type':Sequelize[_0x0ff4('0x1')]},'username':{'type':Sequelize[_0x0ff4('0x1')],'unique':_0x0ff4('0x2')},'remoteUri':{'type':Sequelize[_0x0ff4('0x1')]},'password':{'type':Sequelize[_0x0ff4('0x1')]},'clientId':{'type':Sequelize[_0x0ff4('0x1')]},'clientSecret':{'type':Sequelize[_0x0ff4('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x0ff4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0ff4('0x3')](_0x0ff4('0x4'),_0x0ff4('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 0b78a85..5df78aa 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 _0x105a=['lastIndexOf','Connection','login','password','ticketType','sobject','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','boolean','email','textarea','remove','includes','label','custom','picklistValues','value','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','SalesforceAccount','rawAttributes','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','includeAll','findAll','rows','params','intersection','options','find','create','body','getConfigurations','findOne','merge','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','Subjects','getFields','Task','clientId','clientSecret','username','securityToken','remoteUri','slice'];(function(_0x260f28,_0x4e9b30){var _0x3aefcc=function(_0x223b18){while(--_0x223b18){_0x260f28['push'](_0x260f28['shift']());}};_0x3aefcc(++_0x4e9b30);}(_0x105a,0x130));var _0xa105=function(_0x29ca8a,_0x5b50b9){_0x29ca8a=_0x29ca8a-0x0;var _0x34ffc3=_0x105a[_0x29ca8a];return _0x34ffc3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa105('0x0'));var zipdir=require(_0xa105('0x1'));var jsonpatch=require(_0xa105('0x2'));var rp=require(_0xa105('0x3'));var moment=require(_0xa105('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa105('0x5'));var util=require(_0xa105('0x6'));var path=require('path');var sox=require(_0xa105('0x7'));var csv=require('to-csv');var ejs=require(_0xa105('0x8'));var fs=require('fs');var fs_extra=require(_0xa105('0x9'));var _=require(_0xa105('0xa'));var squel=require(_0xa105('0xb'));var crypto=require(_0xa105('0xc'));var jsforce=require(_0xa105('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa105('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa105('0xf'));var authService=require(_0xa105('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa105('0x11'));var hardwareService=require(_0xa105('0x12'));var logger=require('../../config/logger')(_0xa105('0x13'));var utils=require(_0xa105('0x14'));var config=require(_0xa105('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa105('0x16'))['db'];var integrations=require(_0xa105('0x17'));var jayson=require(_0xa105('0x18'));var client=jayson[_0xa105('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa0fa80,_0x2c649e,_0x2eeb5d,_0x128eed){return new BPromise(function(_0x1979e2,_0x141897){var _0x5e91c7=_0x128eed||client;return _0x5e91c7[_0xa105('0x1a')](_0xa0fa80,_0x2eeb5d)['then'](function(_0x24ae1d){logger[_0xa105('0x1b')](_0xa105('0x1c'),_0x2c649e,'request\x20sent');logger[_0xa105('0x1d')](_0xa105('0x1e'),_0x2c649e,_0xa105('0x1f'),JSON['stringify'](_0x24ae1d));if(_0x24ae1d[_0xa105('0x20')]){if(_0x24ae1d['error'][_0xa105('0x21')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x2c649e,_0x24ae1d[_0xa105('0x20')]['message']);return _0x141897(_0x24ae1d[_0xa105('0x20')][_0xa105('0x22')]);}logger[_0xa105('0x20')](_0xa105('0x1c'),_0x2c649e,_0x24ae1d[_0xa105('0x20')][_0xa105('0x22')]);return _0x1979e2(_0x24ae1d[_0xa105('0x20')][_0xa105('0x22')]);}else{logger[_0xa105('0x1b')]('SalesforceAccount,\x20%s,\x20%s',_0x2c649e,'request\x20sent');_0x1979e2(_0x24ae1d[_0xa105('0x23')]['message']);}})[_0xa105('0x24')](function(_0x4f56ca){logger[_0xa105('0x20')]('SalesforceAccount,\x20%s,\x20%s',_0x2c649e,_0x4f56ca);_0x141897(_0x4f56ca);});});}function respondWithStatusCode(_0xeed8b9,_0x55032b){_0x55032b=_0x55032b||0xcc;return function(_0x51342f){if(_0x51342f){return _0xeed8b9[_0xa105('0x25')](_0x55032b);}return _0xeed8b9[_0xa105('0x26')](_0x55032b)[_0xa105('0x27')]();};}function respondWithResult(_0x1ba67c,_0x237138){_0x237138=_0x237138||0xc8;return function(_0x51981e){if(_0x51981e){return _0x1ba67c['status'](_0x237138)[_0xa105('0x28')](_0x51981e);}};}function respondWithFilteredResult(_0x238c9f,_0x4243d4){return function(_0x225e90){if(_0x225e90){var _0x6b9e1a=_0x225e90[_0xa105('0x29')],_0x3a196a=_0x4243d4['offset'],_0x313bbb=_0x4243d4['offset']+_0x4243d4[_0xa105('0x2a')],_0x71fbb5;if(_0x313bbb>=_0x6b9e1a){_0x313bbb=_0x6b9e1a;_0x71fbb5=0xc8;}else{_0x71fbb5=0xce;}_0x238c9f[_0xa105('0x26')](_0x71fbb5);return _0x238c9f[_0xa105('0x2b')](_0xa105('0x2c'),_0x3a196a+'-'+_0x313bbb+'/'+_0x6b9e1a)['json'](_0x225e90);}return null;};}function patchUpdates(_0x24d7ec){return function(_0x20fd02){try{jsonpatch[_0xa105('0x2d')](_0x20fd02,_0x24d7ec,!![]);}catch(_0x4d99de){return BPromise[_0xa105('0x2e')](_0x4d99de);}return _0x20fd02['save']();};}function saveUpdates(_0x577caf,_0x15aae6){return function(_0x5c858c){if(_0x5c858c){return _0x5c858c[_0xa105('0x2f')](_0x577caf)[_0xa105('0x30')](function(_0x413db6){return _0x413db6;});}return null;};}function removeEntity(_0x60ae33,_0x2c2a59){return function(_0x43d783){if(_0x43d783){return _0x43d783[_0xa105('0x31')]()['then'](function(){_0x60ae33[_0xa105('0x26')](0xcc)[_0xa105('0x27')]();});}};}function handleEntityNotFound(_0x26fd65,_0x25acd9){return function(_0xb7148e){if(!_0xb7148e){_0x26fd65[_0xa105('0x25')](0x194);}return _0xb7148e;};}function handleError(_0xce2b6c,_0x52fe4a){_0x52fe4a=_0x52fe4a||0x1f4;return function(_0x1d9c76){logger[_0xa105('0x20')](_0x1d9c76[_0xa105('0x32')]);if(_0x1d9c76[_0xa105('0x33')]){delete _0x1d9c76[_0xa105('0x33')];}_0xce2b6c[_0xa105('0x26')](_0x52fe4a)[_0xa105('0x34')](_0x1d9c76);};}exports[_0xa105('0x35')]=function(_0x5b0ba1,_0x486d32){var _0x24e134={},_0x5126c8={},_0xebc0b={'count':0x0,'rows':[]};var _0x4c352b=_['map'](db[_0xa105('0x36')][_0xa105('0x37')],function(_0x4416e5){return{'name':_0x4416e5['fieldName'],'type':_0x4416e5[_0xa105('0x38')][_0xa105('0x39')]};});_0x5126c8[_0xa105('0x3a')]=_[_0xa105('0x3b')](_0x4c352b,_0xa105('0x33'));_0x5126c8[_0xa105('0x3c')]=_[_0xa105('0x3d')](_0x5b0ba1[_0xa105('0x3c')]);_0x5126c8[_0xa105('0x3e')]=_['intersection'](_0x5126c8[_0xa105('0x3a')],_0x5126c8[_0xa105('0x3c')]);_0x24e134[_0xa105('0x3f')]=_['intersection'](_0x5126c8[_0xa105('0x3a')],qs[_0xa105('0x40')](_0x5b0ba1[_0xa105('0x3c')][_0xa105('0x40')]));_0x24e134[_0xa105('0x3f')]=_0x24e134['attributes'][_0xa105('0x41')]?_0x24e134[_0xa105('0x3f')]:_0x5126c8[_0xa105('0x3a')];if(!_0x5b0ba1[_0xa105('0x3c')][_0xa105('0x42')](_0xa105('0x43'))){_0x24e134[_0xa105('0x2a')]=qs[_0xa105('0x2a')](_0x5b0ba1[_0xa105('0x3c')][_0xa105('0x2a')]);_0x24e134[_0xa105('0x44')]=qs[_0xa105('0x44')](_0x5b0ba1[_0xa105('0x3c')]['offset']);}_0x24e134[_0xa105('0x45')]=qs[_0xa105('0x46')](_0x5b0ba1[_0xa105('0x3c')]['sort']);_0x24e134[_0xa105('0x47')]=qs[_0xa105('0x3e')](_[_0xa105('0x48')](_0x5b0ba1[_0xa105('0x3c')],_0x5126c8[_0xa105('0x3e')]),_0x4c352b);if(_0x5b0ba1['query'][_0xa105('0x49')]){_0x24e134[_0xa105('0x47')]=_['merge'](_0x24e134['where'],{'$or':_[_0xa105('0x3b')](_0x4c352b,function(_0x5a62bc){if(_0x5a62bc[_0xa105('0x38')]!==_0xa105('0x4a')){var _0x56c2b2={};_0x56c2b2[_0x5a62bc[_0xa105('0x33')]]={'$like':'%'+_0x5b0ba1['query'][_0xa105('0x49')]+'%'};return _0x56c2b2;}})});}_0x24e134=_['merge']({},_0x24e134,_0x5b0ba1['options']);var _0x1d16c6={'where':_0x24e134[_0xa105('0x47')]};return db[_0xa105('0x36')][_0xa105('0x29')](_0x1d16c6)[_0xa105('0x30')](function(_0x12d1d4){_0xebc0b[_0xa105('0x29')]=_0x12d1d4;if(_0x5b0ba1['query'][_0xa105('0x4b')]){_0x24e134['include']=[{'all':!![]}];}return db['SalesforceAccount'][_0xa105('0x4c')](_0x24e134);})[_0xa105('0x30')](function(_0x173903){_0xebc0b[_0xa105('0x4d')]=_0x173903;return _0xebc0b;})['then'](respondWithFilteredResult(_0x486d32,_0x24e134))[_0xa105('0x24')](handleError(_0x486d32,null));};exports['show']=function(_0x7e1aef,_0x44a2da){var _0x19521e={'raw':![],'where':{'id':_0x7e1aef[_0xa105('0x4e')]['id']}},_0x1d0da4={};_0x1d0da4['model']=_[_0xa105('0x3d')](db[_0xa105('0x36')]['rawAttributes']);_0x1d0da4[_0xa105('0x3c')]=_['keys'](_0x7e1aef['query']);_0x1d0da4['filters']=_['intersection'](_0x1d0da4[_0xa105('0x3a')],_0x1d0da4[_0xa105('0x3c')]);_0x19521e[_0xa105('0x3f')]=_[_0xa105('0x4f')](_0x1d0da4[_0xa105('0x3a')],qs[_0xa105('0x40')](_0x7e1aef[_0xa105('0x3c')][_0xa105('0x40')]));_0x19521e[_0xa105('0x3f')]=_0x19521e[_0xa105('0x3f')][_0xa105('0x41')]?_0x19521e[_0xa105('0x3f')]:_0x1d0da4[_0xa105('0x3a')];if(_0x7e1aef[_0xa105('0x3c')][_0xa105('0x4b')]){_0x19521e['include']=[{'all':!![]}];}_0x19521e=_['merge']({},_0x19521e,_0x7e1aef[_0xa105('0x50')]);return db[_0xa105('0x36')][_0xa105('0x51')](_0x19521e)['then'](handleEntityNotFound(_0x44a2da,null))[_0xa105('0x30')](respondWithResult(_0x44a2da,null))['catch'](handleError(_0x44a2da,null));};exports[_0xa105('0x52')]=function(_0x164de1,_0x13bca3){return db[_0xa105('0x36')][_0xa105('0x52')](_0x164de1['body'],{})[_0xa105('0x30')](respondWithResult(_0x13bca3,0xc9))[_0xa105('0x24')](handleError(_0x13bca3,null));};exports['update']=function(_0x14f3f6,_0x1a5cd7){if(_0x14f3f6[_0xa105('0x53')]['id']){delete _0x14f3f6[_0xa105('0x53')]['id'];}return db[_0xa105('0x36')][_0xa105('0x51')]({'where':{'id':_0x14f3f6[_0xa105('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1a5cd7,null))['then'](saveUpdates(_0x14f3f6[_0xa105('0x53')],null))[_0xa105('0x30')](respondWithResult(_0x1a5cd7,null))[_0xa105('0x24')](handleError(_0x1a5cd7,null));};exports[_0xa105('0x31')]=function(_0x238c86,_0x56df34){return db[_0xa105('0x36')][_0xa105('0x51')]({'where':{'id':_0x238c86['params']['id']}})['then'](handleEntityNotFound(_0x56df34,null))['then'](removeEntity(_0x56df34,null))[_0xa105('0x24')](handleError(_0x56df34,null));};exports[_0xa105('0x54')]=function(_0x3c9f96,_0x231e3f,_0xe64d14){var _0x22c3ee={};var _0x3198e1={};var _0x3a699d;var _0x3a6784;return db[_0xa105('0x36')][_0xa105('0x55')]({'where':{'id':_0x3c9f96[_0xa105('0x4e')]['id']}})[_0xa105('0x30')](handleEntityNotFound(_0x231e3f,null))[_0xa105('0x30')](function(_0x49cacd){if(_0x49cacd){_0x3a699d=_0x49cacd;_0x3198e1[_0xa105('0x3a')]=_['keys'](db['SalesforceConfiguration'][_0xa105('0x37')]);_0x3198e1[_0xa105('0x3c')]=_[_0xa105('0x3d')](_0x3c9f96['query']);_0x3198e1[_0xa105('0x3e')]=_[_0xa105('0x4f')](_0x3198e1[_0xa105('0x3a')],_0x3198e1[_0xa105('0x3c')]);_0x22c3ee[_0xa105('0x3f')]=_[_0xa105('0x4f')](_0x3198e1[_0xa105('0x3a')],qs[_0xa105('0x40')](_0x3c9f96[_0xa105('0x3c')]['fields']));_0x22c3ee[_0xa105('0x3f')]=_0x22c3ee['attributes'][_0xa105('0x41')]?_0x22c3ee['attributes']:_0x3198e1[_0xa105('0x3a')];_0x22c3ee[_0xa105('0x45')]=qs[_0xa105('0x46')](_0x3c9f96[_0xa105('0x3c')][_0xa105('0x46')]);_0x22c3ee[_0xa105('0x47')]=qs[_0xa105('0x3e')](_['pick'](_0x3c9f96[_0xa105('0x3c')],_0x3198e1[_0xa105('0x3e')]));if(_0x3c9f96['query']['filter']){_0x22c3ee[_0xa105('0x47')]=_[_0xa105('0x56')](_0x22c3ee[_0xa105('0x47')],{'$or':_['map'](_0x22c3ee[_0xa105('0x3f')],function(_0x42960c){var _0x41156f={};_0x41156f[_0x42960c]={'$like':'%'+_0x3c9f96[_0xa105('0x3c')][_0xa105('0x49')]+'%'};return _0x41156f;})});}_0x22c3ee=_['merge']({},_0x22c3ee,_0x3c9f96['options']);return _0x3a699d[_0xa105('0x54')](_0x22c3ee);}})[_0xa105('0x30')](function(_0x367879){if(_0x367879){_0x3a6784=_0x367879[_0xa105('0x41')];if(!_0x3c9f96['query']['hasOwnProperty'](_0xa105('0x43'))){_0x22c3ee[_0xa105('0x2a')]=qs[_0xa105('0x2a')](_0x3c9f96[_0xa105('0x3c')][_0xa105('0x2a')]);_0x22c3ee['offset']=qs[_0xa105('0x44')](_0x3c9f96[_0xa105('0x3c')][_0xa105('0x44')]);}return _0x3a699d[_0xa105('0x54')](_0x22c3ee);}})[_0xa105('0x30')](function(_0x49e9ba){if(_0x49e9ba){return _0x49e9ba?{'count':_0x3a6784,'rows':_0x49e9ba}:null;}})[_0xa105('0x30')](respondWithResult(_0x231e3f,null))['catch'](handleError(_0x231e3f,null));};exports[_0xa105('0x57')]=function(_0x45f241,_0x2cd838,_0x163067){if(_0x45f241[_0xa105('0x53')]['id']){delete _0x45f241[_0xa105('0x53')]['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x45f241[_0xa105('0x4e')]['id']}})[_0xa105('0x30')](handleEntityNotFound(_0x2cd838,null))[_0xa105('0x30')](function(_0xb6b68b){if(_0xb6b68b){_0x45f241[_0xa105('0x53')][_0xa105('0x58')]=_0xb6b68b['id'];_0x45f241[_0xa105('0x53')]['Subjects']=integrations[_0xa105('0x59')](_0x45f241[_0xa105('0x53')][_0xa105('0x5a')],_0x45f241[_0xa105('0x53')][_0xa105('0x38')]);_0x45f241[_0xa105('0x53')][_0xa105('0x5b')]=integrations[_0xa105('0x5c')](_0x45f241[_0xa105('0x53')]['channel'],_0x45f241[_0xa105('0x53')][_0xa105('0x38')]);return db[_0xa105('0x5d')][_0xa105('0x52')](_0x45f241[_0xa105('0x53')],{'include':[{'model':db[_0xa105('0x5e')],'as':_0xa105('0x5f')},{'model':db[_0xa105('0x5e')],'as':_0xa105('0x5b')}]});}return null;})[_0xa105('0x30')](respondWithResult(_0x2cd838,null))[_0xa105('0x24')](handleError(_0x2cd838,null));};exports[_0xa105('0x60')]=function(_0x18bf9b,_0x2f9581,_0x41f3a5){var _0xc5700d;var _0xf85f11='';var _0x91d7db=_0xa105('0x61');return db['SalesforceAccount']['findOne']({'where':{'id':_0x18bf9b[_0xa105('0x4e')]['id']},'attributes':['id','remoteUri',_0xa105('0x62'),_0xa105('0x63'),_0xa105('0x64'),'password',_0xa105('0x65')]})[_0xa105('0x30')](handleEntityNotFound(_0x2f9581,null))[_0xa105('0x30')](function(_0x4ce600){if(_0x4ce600){_0xf85f11=_0x4ce600[_0xa105('0x66')];var _0x2ff67c=_0xf85f11[_0xa105('0x67')](-0x1);if(_0x2ff67c==='/'){_0xf85f11=_0xf85f11['substring'](0x0,_0xf85f11[_0xa105('0x68')](_0x2ff67c));}_0xc5700d=new jsforce[(_0xa105('0x69'))]({'oauth2':{'loginUrl':_0xf85f11,'clientId':_0x4ce600[_0xa105('0x62')],'clientSecret':_0x4ce600[_0xa105('0x63')]}});return _0xc5700d[_0xa105('0x6a')](_0x4ce600[_0xa105('0x64')],_0x4ce600[_0xa105('0x6b')]['concat'](_0x4ce600[_0xa105('0x65')]));}})[_0xa105('0x30')](function(_0x499ae4){if(_0x499ae4){if(!_['isNil'](_0x18bf9b[_0xa105('0x3c')][_0xa105('0x6c')])){_0x91d7db=_0x18bf9b[_0xa105('0x3c')][_0xa105('0x6c')];}return _0xc5700d[_0xa105('0x6d')](_0x91d7db)[_0xa105('0x6e')]();}})[_0xa105('0x30')](function(_0xf1f3cc){var _0x56ec4f=[_0xa105('0x6f'),'ActivityDate',_0xa105('0x70'),_0xa105('0x71'),_0xa105('0x72'),_0xa105('0x73')];var _0x45672d=[_0xa105('0x74'),'int',_0xa105('0x75'),_0xa105('0x76'),_0xa105('0x77'),_0xa105('0x78'),'phone'];if(_0xf1f3cc){_[_0xa105('0x79')](_0xf1f3cc[_0xa105('0x40')],function(_0x3dba3e){return _0x56ec4f[_0xa105('0x7a')](_0x3dba3e[_0xa105('0x33')])||!_0x45672d[_0xa105('0x7a')](_0x3dba3e['type']);});return{'count':_0xf1f3cc['fields']['length'],'rows':_['map'](_0xf1f3cc[_0xa105('0x40')],function(_0x5b1dd8){return{'id':_0x5b1dd8[_0xa105('0x33')],'name':_0x5b1dd8[_0xa105('0x7b')],'custom':_0x5b1dd8[_0xa105('0x7c')],'options':_0x5b1dd8[_0xa105('0x7d')][_0xa105('0x41')]>0x0?_[_0xa105('0x3b')](_0x5b1dd8[_0xa105('0x7d')],function(_0x3e83fc){return{'name':_0x3e83fc['label'],'value':_0x3e83fc[_0xa105('0x7e')]};}):_0x5b1dd8[_0xa105('0x38')]==_0xa105('0x76')?[{'name':_0xa105('0x7f'),'value':_0xa105('0x80')},{'name':_0xa105('0x81'),'value':_0xa105('0x82')}]:[]};})};}})[_0xa105('0x30')](respondWithResult(_0x2f9581,null))[_0xa105('0x24')](function(_0x383f30){var _0x1e3b31=_0x18bf9b['query']['test']?0x1f4:_0x383f30[_0xa105('0x83')]||0x1f4;logger['error'](_0xa105('0x84'),_0xa105('0x60'),_0x1e3b31,JSON[_0xa105('0x85')](_0x383f30));delete _0x383f30[_0xa105('0x33')];if(_0x1e3b31===0x191){_0x1e3b31=0x190;}_0x2f9581[_0xa105('0x26')](_0x1e3b31)[_0xa105('0x34')](_0x18bf9b[_0xa105('0x3c')][_0xa105('0x86')]?{'message':_0xa105('0x87'),'statusCode':_0x383f30['statusCode']}:_0x383f30);});}; \ No newline at end of file +var _0x2c1a=['rows','keys','options','create','body','find','params','destroy','findOne','SalesforceConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','clientSecret','username','password','slice','substring','Connection','clientId','concat','securityToken','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','Description','string','int','picklist','boolean','textarea','phone','includes','picklistValues','label','value','True','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','rimraf','zip-dir','fast-json-patch','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','then','info','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','SalesforceAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','name','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0x2c1a,0x12f));var _0xa2c1=function(_0x3b6856,_0x5f2266){_0x3b6856=_0x3b6856-0x0;var _0x1cbcce=_0x2c1a[_0x3b6856];return _0x1cbcce;};'use strict';var emlformat=require(_0xa2c1('0x0'));var rimraf=require(_0xa2c1('0x1'));var zipdir=require(_0xa2c1('0x2'));var jsonpatch=require(_0xa2c1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa2c1('0x4'));var csv=require('to-csv');var ejs=require(_0xa2c1('0x5'));var fs=require('fs');var fs_extra=require(_0xa2c1('0x6'));var _=require(_0xa2c1('0x7'));var squel=require(_0xa2c1('0x8'));var crypto=require(_0xa2c1('0x9'));var jsforce=require(_0xa2c1('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa2c1('0xb'));var querystring=require(_0xa2c1('0xc'));var Papa=require('papaparse');var Redis=require(_0xa2c1('0xd'));var authService=require(_0xa2c1('0xe'));var qs=require(_0xa2c1('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa2c1('0x10'));var logger=require('../../config/logger')(_0xa2c1('0x11'));var utils=require('../../config/utils');var config=require(_0xa2c1('0x12'));var licenseUtil=require(_0xa2c1('0x13'));var db=require(_0xa2c1('0x14'))['db'];var integrations=require(_0xa2c1('0x15'));var jayson=require(_0xa2c1('0x16'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x257d8f,_0x5020be,_0x5b40b1,_0x2181ef){return new BPromise(function(_0x5224bd,_0x3dc89f){var _0x32573c=_0x2181ef||client;return _0x32573c['request'](_0x257d8f,_0x5b40b1)[_0xa2c1('0x17')](function(_0x4effb4){logger[_0xa2c1('0x18')]('SalesforceAccount,\x20%s,\x20%s',_0x5020be,_0xa2c1('0x19'));logger['debug'](_0xa2c1('0x1a'),_0x5020be,'request\x20sent',JSON['stringify'](_0x4effb4));if(_0x4effb4[_0xa2c1('0x1b')]){if(_0x4effb4[_0xa2c1('0x1b')]['code']===0x1f4){logger[_0xa2c1('0x1b')](_0xa2c1('0x1c'),_0x5020be,_0x4effb4[_0xa2c1('0x1b')][_0xa2c1('0x1d')]);return _0x3dc89f(_0x4effb4[_0xa2c1('0x1b')]['message']);}logger[_0xa2c1('0x1b')](_0xa2c1('0x1c'),_0x5020be,_0x4effb4[_0xa2c1('0x1b')][_0xa2c1('0x1d')]);return _0x5224bd(_0x4effb4[_0xa2c1('0x1b')][_0xa2c1('0x1d')]);}else{logger[_0xa2c1('0x18')](_0xa2c1('0x1c'),_0x5020be,_0xa2c1('0x19'));_0x5224bd(_0x4effb4[_0xa2c1('0x1e')]['message']);}})[_0xa2c1('0x1f')](function(_0x526797){logger[_0xa2c1('0x1b')]('SalesforceAccount,\x20%s,\x20%s',_0x5020be,_0x526797);_0x3dc89f(_0x526797);});});}function respondWithStatusCode(_0x265367,_0x40f333){_0x40f333=_0x40f333||0xcc;return function(_0x1c3a20){if(_0x1c3a20){return _0x265367[_0xa2c1('0x20')](_0x40f333);}return _0x265367[_0xa2c1('0x21')](_0x40f333)[_0xa2c1('0x22')]();};}function respondWithResult(_0x449e18,_0x15e825){_0x15e825=_0x15e825||0xc8;return function(_0x317df2){if(_0x317df2){return _0x449e18[_0xa2c1('0x21')](_0x15e825)[_0xa2c1('0x23')](_0x317df2);}};}function respondWithFilteredResult(_0x3db075,_0x55b76d){return function(_0x53c245){if(_0x53c245){var _0x1f330c=_0x53c245[_0xa2c1('0x24')],_0x19603a=_0x55b76d['offset'],_0x533cfd=_0x55b76d[_0xa2c1('0x25')]+_0x55b76d['limit'],_0x1b4d9c;if(_0x533cfd>=_0x1f330c){_0x533cfd=_0x1f330c;_0x1b4d9c=0xc8;}else{_0x1b4d9c=0xce;}_0x3db075[_0xa2c1('0x21')](_0x1b4d9c);return _0x3db075[_0xa2c1('0x26')](_0xa2c1('0x27'),_0x19603a+'-'+_0x533cfd+'/'+_0x1f330c)['json'](_0x53c245);}return null;};}function patchUpdates(_0x3029db){return function(_0x16b102){try{jsonpatch[_0xa2c1('0x28')](_0x16b102,_0x3029db,!![]);}catch(_0x542595){return BPromise['reject'](_0x542595);}return _0x16b102[_0xa2c1('0x29')]();};}function saveUpdates(_0x489139,_0x25d517){return function(_0x269772){if(_0x269772){return _0x269772[_0xa2c1('0x2a')](_0x489139)[_0xa2c1('0x17')](function(_0x5a45df){return _0x5a45df;});}return null;};}function removeEntity(_0x3d2b3f,_0x5673fd){return function(_0x5a339a){if(_0x5a339a){return _0x5a339a['destroy']()[_0xa2c1('0x17')](function(){_0x3d2b3f[_0xa2c1('0x21')](0xcc)[_0xa2c1('0x22')]();});}};}function handleEntityNotFound(_0x5a449b,_0x47e737){return function(_0x3fcd85){if(!_0x3fcd85){_0x5a449b[_0xa2c1('0x20')](0x194);}return _0x3fcd85;};}function handleError(_0x2bb8e2,_0x493452){_0x493452=_0x493452||0x1f4;return function(_0x539a71){logger['error'](_0x539a71['stack']);if(_0x539a71['name']){delete _0x539a71[_0xa2c1('0x2b')];}_0x2bb8e2['status'](_0x493452)['send'](_0x539a71);};}exports['index']=function(_0x83219c,_0x5029c8){var _0x2c3358={},_0x178d11={},_0xd758c2={'count':0x0,'rows':[]};var _0x2b5ccd=_[_0xa2c1('0x2c')](db[_0xa2c1('0x2d')][_0xa2c1('0x2e')],function(_0x11b79c){return{'name':_0x11b79c[_0xa2c1('0x2f')],'type':_0x11b79c[_0xa2c1('0x30')][_0xa2c1('0x31')]};});_0x178d11[_0xa2c1('0x32')]=_[_0xa2c1('0x2c')](_0x2b5ccd,_0xa2c1('0x2b'));_0x178d11['query']=_['keys'](_0x83219c[_0xa2c1('0x33')]);_0x178d11[_0xa2c1('0x34')]=_[_0xa2c1('0x35')](_0x178d11[_0xa2c1('0x32')],_0x178d11[_0xa2c1('0x33')]);_0x2c3358['attributes']=_[_0xa2c1('0x35')](_0x178d11[_0xa2c1('0x32')],qs[_0xa2c1('0x36')](_0x83219c['query'][_0xa2c1('0x36')]));_0x2c3358[_0xa2c1('0x37')]=_0x2c3358['attributes'][_0xa2c1('0x38')]?_0x2c3358[_0xa2c1('0x37')]:_0x178d11[_0xa2c1('0x32')];if(!_0x83219c[_0xa2c1('0x33')][_0xa2c1('0x39')](_0xa2c1('0x3a'))){_0x2c3358[_0xa2c1('0x3b')]=qs[_0xa2c1('0x3b')](_0x83219c[_0xa2c1('0x33')][_0xa2c1('0x3b')]);_0x2c3358[_0xa2c1('0x25')]=qs[_0xa2c1('0x25')](_0x83219c['query']['offset']);}_0x2c3358[_0xa2c1('0x3c')]=qs[_0xa2c1('0x3d')](_0x83219c[_0xa2c1('0x33')][_0xa2c1('0x3d')]);_0x2c3358[_0xa2c1('0x3e')]=qs['filters'](_['pick'](_0x83219c[_0xa2c1('0x33')],_0x178d11[_0xa2c1('0x34')]),_0x2b5ccd);if(_0x83219c[_0xa2c1('0x33')][_0xa2c1('0x3f')]){_0x2c3358[_0xa2c1('0x3e')]=_[_0xa2c1('0x40')](_0x2c3358[_0xa2c1('0x3e')],{'$or':_[_0xa2c1('0x2c')](_0x2b5ccd,function(_0x244616){if(_0x244616[_0xa2c1('0x30')]!==_0xa2c1('0x41')){var _0x18810c={};_0x18810c[_0x244616[_0xa2c1('0x2b')]]={'$like':'%'+_0x83219c[_0xa2c1('0x33')][_0xa2c1('0x3f')]+'%'};return _0x18810c;}})});}_0x2c3358=_[_0xa2c1('0x40')]({},_0x2c3358,_0x83219c['options']);var _0x32d5cc={'where':_0x2c3358[_0xa2c1('0x3e')]};return db[_0xa2c1('0x2d')][_0xa2c1('0x24')](_0x32d5cc)[_0xa2c1('0x17')](function(_0x5b6f18){_0xd758c2[_0xa2c1('0x24')]=_0x5b6f18;if(_0x83219c[_0xa2c1('0x33')][_0xa2c1('0x42')]){_0x2c3358[_0xa2c1('0x43')]=[{'all':!![]}];}return db[_0xa2c1('0x2d')][_0xa2c1('0x44')](_0x2c3358);})[_0xa2c1('0x17')](function(_0x3d7c8b){_0xd758c2[_0xa2c1('0x45')]=_0x3d7c8b;return _0xd758c2;})[_0xa2c1('0x17')](respondWithFilteredResult(_0x5029c8,_0x2c3358))[_0xa2c1('0x1f')](handleError(_0x5029c8,null));};exports['show']=function(_0xf5a2ec,_0x531446){var _0x3463f3={'raw':![],'where':{'id':_0xf5a2ec['params']['id']}},_0x1d5cbe={};_0x1d5cbe['model']=_[_0xa2c1('0x46')](db[_0xa2c1('0x2d')][_0xa2c1('0x2e')]);_0x1d5cbe['query']=_[_0xa2c1('0x46')](_0xf5a2ec['query']);_0x1d5cbe[_0xa2c1('0x34')]=_[_0xa2c1('0x35')](_0x1d5cbe[_0xa2c1('0x32')],_0x1d5cbe[_0xa2c1('0x33')]);_0x3463f3[_0xa2c1('0x37')]=_[_0xa2c1('0x35')](_0x1d5cbe[_0xa2c1('0x32')],qs[_0xa2c1('0x36')](_0xf5a2ec[_0xa2c1('0x33')][_0xa2c1('0x36')]));_0x3463f3['attributes']=_0x3463f3[_0xa2c1('0x37')][_0xa2c1('0x38')]?_0x3463f3[_0xa2c1('0x37')]:_0x1d5cbe[_0xa2c1('0x32')];if(_0xf5a2ec[_0xa2c1('0x33')][_0xa2c1('0x42')]){_0x3463f3[_0xa2c1('0x43')]=[{'all':!![]}];}_0x3463f3=_[_0xa2c1('0x40')]({},_0x3463f3,_0xf5a2ec[_0xa2c1('0x47')]);return db[_0xa2c1('0x2d')]['find'](_0x3463f3)[_0xa2c1('0x17')](handleEntityNotFound(_0x531446,null))[_0xa2c1('0x17')](respondWithResult(_0x531446,null))[_0xa2c1('0x1f')](handleError(_0x531446,null));};exports[_0xa2c1('0x48')]=function(_0x529bbe,_0x455a85){return db[_0xa2c1('0x2d')]['create'](_0x529bbe[_0xa2c1('0x49')],{})['then'](respondWithResult(_0x455a85,0xc9))[_0xa2c1('0x1f')](handleError(_0x455a85,null));};exports[_0xa2c1('0x2a')]=function(_0x2e4386,_0x415383){if(_0x2e4386['body']['id']){delete _0x2e4386['body']['id'];}return db[_0xa2c1('0x2d')][_0xa2c1('0x4a')]({'where':{'id':_0x2e4386[_0xa2c1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x415383,null))['then'](saveUpdates(_0x2e4386[_0xa2c1('0x49')],null))['then'](respondWithResult(_0x415383,null))[_0xa2c1('0x1f')](handleError(_0x415383,null));};exports[_0xa2c1('0x4c')]=function(_0x1efa28,_0x56dc18){return db[_0xa2c1('0x2d')]['find']({'where':{'id':_0x1efa28[_0xa2c1('0x4b')]['id']}})[_0xa2c1('0x17')](handleEntityNotFound(_0x56dc18,null))['then'](removeEntity(_0x56dc18,null))[_0xa2c1('0x1f')](handleError(_0x56dc18,null));};exports['getConfigurations']=function(_0x3144c8,_0xc819cc,_0x30a66d){var _0x14ebc7={};var _0x4b7ee3={};var _0x5e4730;var _0x5087a3;return db[_0xa2c1('0x2d')][_0xa2c1('0x4d')]({'where':{'id':_0x3144c8[_0xa2c1('0x4b')]['id']}})['then'](handleEntityNotFound(_0xc819cc,null))['then'](function(_0x111611){if(_0x111611){_0x5e4730=_0x111611;_0x4b7ee3[_0xa2c1('0x32')]=_['keys'](db[_0xa2c1('0x4e')][_0xa2c1('0x2e')]);_0x4b7ee3[_0xa2c1('0x33')]=_[_0xa2c1('0x46')](_0x3144c8[_0xa2c1('0x33')]);_0x4b7ee3[_0xa2c1('0x34')]=_[_0xa2c1('0x35')](_0x4b7ee3[_0xa2c1('0x32')],_0x4b7ee3[_0xa2c1('0x33')]);_0x14ebc7[_0xa2c1('0x37')]=_[_0xa2c1('0x35')](_0x4b7ee3[_0xa2c1('0x32')],qs[_0xa2c1('0x36')](_0x3144c8[_0xa2c1('0x33')]['fields']));_0x14ebc7[_0xa2c1('0x37')]=_0x14ebc7[_0xa2c1('0x37')][_0xa2c1('0x38')]?_0x14ebc7[_0xa2c1('0x37')]:_0x4b7ee3['model'];_0x14ebc7[_0xa2c1('0x3c')]=qs[_0xa2c1('0x3d')](_0x3144c8[_0xa2c1('0x33')]['sort']);_0x14ebc7[_0xa2c1('0x3e')]=qs[_0xa2c1('0x34')](_['pick'](_0x3144c8[_0xa2c1('0x33')],_0x4b7ee3[_0xa2c1('0x34')]));if(_0x3144c8[_0xa2c1('0x33')][_0xa2c1('0x3f')]){_0x14ebc7[_0xa2c1('0x3e')]=_['merge'](_0x14ebc7[_0xa2c1('0x3e')],{'$or':_[_0xa2c1('0x2c')](_0x14ebc7[_0xa2c1('0x37')],function(_0x3879f0){var _0x5df27f={};_0x5df27f[_0x3879f0]={'$like':'%'+_0x3144c8[_0xa2c1('0x33')][_0xa2c1('0x3f')]+'%'};return _0x5df27f;})});}_0x14ebc7=_[_0xa2c1('0x40')]({},_0x14ebc7,_0x3144c8[_0xa2c1('0x47')]);return _0x5e4730[_0xa2c1('0x4f')](_0x14ebc7);}})['then'](function(_0x58055a){if(_0x58055a){_0x5087a3=_0x58055a[_0xa2c1('0x38')];if(!_0x3144c8[_0xa2c1('0x33')]['hasOwnProperty'](_0xa2c1('0x3a'))){_0x14ebc7[_0xa2c1('0x3b')]=qs['limit'](_0x3144c8[_0xa2c1('0x33')][_0xa2c1('0x3b')]);_0x14ebc7[_0xa2c1('0x25')]=qs['offset'](_0x3144c8[_0xa2c1('0x33')]['offset']);}return _0x5e4730[_0xa2c1('0x4f')](_0x14ebc7);}})[_0xa2c1('0x17')](function(_0x40e4dd){if(_0x40e4dd){return _0x40e4dd?{'count':_0x5087a3,'rows':_0x40e4dd}:null;}})[_0xa2c1('0x17')](respondWithResult(_0xc819cc,null))[_0xa2c1('0x1f')](handleError(_0xc819cc,null));};exports[_0xa2c1('0x50')]=function(_0x13f7c6,_0xb9b590,_0x183524){if(_0x13f7c6['body']['id']){delete _0x13f7c6['body']['id'];}return db[_0xa2c1('0x2d')]['findOne']({'where':{'id':_0x13f7c6[_0xa2c1('0x4b')]['id']}})[_0xa2c1('0x17')](handleEntityNotFound(_0xb9b590,null))['then'](function(_0x392806){if(_0x392806){_0x13f7c6[_0xa2c1('0x49')][_0xa2c1('0x51')]=_0x392806['id'];_0x13f7c6[_0xa2c1('0x49')][_0xa2c1('0x52')]=integrations['getSubjects'](_0x13f7c6[_0xa2c1('0x49')][_0xa2c1('0x53')],_0x13f7c6[_0xa2c1('0x49')]['type']);_0x13f7c6[_0xa2c1('0x49')][_0xa2c1('0x54')]=integrations[_0xa2c1('0x55')](_0x13f7c6[_0xa2c1('0x49')][_0xa2c1('0x53')],_0x13f7c6[_0xa2c1('0x49')][_0xa2c1('0x30')]);return db[_0xa2c1('0x4e')][_0xa2c1('0x48')](_0x13f7c6[_0xa2c1('0x49')],{'include':[{'model':db['SalesforceField'],'as':_0xa2c1('0x52')},{'model':db[_0xa2c1('0x56')],'as':_0xa2c1('0x54')}]});}return null;})[_0xa2c1('0x17')](respondWithResult(_0xb9b590,null))[_0xa2c1('0x1f')](handleError(_0xb9b590,null));};exports[_0xa2c1('0x57')]=function(_0x455e99,_0x167523,_0x5dcfa8){var _0x35bb9b;var _0x1735ad='';var _0x16c9a9='Task';return db[_0xa2c1('0x2d')][_0xa2c1('0x4d')]({'where':{'id':_0x455e99['params']['id']},'attributes':['id',_0xa2c1('0x58'),'clientId',_0xa2c1('0x59'),_0xa2c1('0x5a'),_0xa2c1('0x5b'),'securityToken']})[_0xa2c1('0x17')](handleEntityNotFound(_0x167523,null))[_0xa2c1('0x17')](function(_0x165bac){if(_0x165bac){_0x1735ad=_0x165bac[_0xa2c1('0x58')];var _0x1013d1=_0x1735ad[_0xa2c1('0x5c')](-0x1);if(_0x1013d1==='/'){_0x1735ad=_0x1735ad[_0xa2c1('0x5d')](0x0,_0x1735ad['lastIndexOf'](_0x1013d1));}_0x35bb9b=new jsforce[(_0xa2c1('0x5e'))]({'oauth2':{'loginUrl':_0x1735ad,'clientId':_0x165bac[_0xa2c1('0x5f')],'clientSecret':_0x165bac[_0xa2c1('0x59')]}});return _0x35bb9b['login'](_0x165bac[_0xa2c1('0x5a')],_0x165bac[_0xa2c1('0x5b')][_0xa2c1('0x60')](_0x165bac[_0xa2c1('0x61')]));}})[_0xa2c1('0x17')](function(_0x45d403){if(_0x45d403){if(!_[_0xa2c1('0x62')](_0x455e99['query'][_0xa2c1('0x63')])){_0x16c9a9=_0x455e99[_0xa2c1('0x33')][_0xa2c1('0x63')];}return _0x35bb9b[_0xa2c1('0x64')](_0x16c9a9)[_0xa2c1('0x65')]();}})[_0xa2c1('0x17')](function(_0x9dd413){var _0x40d529=[_0xa2c1('0x66'),_0xa2c1('0x67'),_0xa2c1('0x68'),'IsRecurrence','Subject',_0xa2c1('0x69')];var _0x11df09=[_0xa2c1('0x6a'),_0xa2c1('0x6b'),_0xa2c1('0x6c'),_0xa2c1('0x6d'),'email',_0xa2c1('0x6e'),_0xa2c1('0x6f')];if(_0x9dd413){_['remove'](_0x9dd413[_0xa2c1('0x36')],function(_0x15dd7b){return _0x40d529[_0xa2c1('0x70')](_0x15dd7b[_0xa2c1('0x2b')])||!_0x11df09[_0xa2c1('0x70')](_0x15dd7b[_0xa2c1('0x30')]);});return{'count':_0x9dd413[_0xa2c1('0x36')][_0xa2c1('0x38')],'rows':_[_0xa2c1('0x2c')](_0x9dd413[_0xa2c1('0x36')],function(_0x962c0d){return{'id':_0x962c0d['name'],'name':_0x962c0d['label'],'custom':_0x962c0d['custom'],'options':_0x962c0d[_0xa2c1('0x71')][_0xa2c1('0x38')]>0x0?_[_0xa2c1('0x2c')](_0x962c0d['picklistValues'],function(_0x1c5a2e){return{'name':_0x1c5a2e[_0xa2c1('0x72')],'value':_0x1c5a2e[_0xa2c1('0x73')]};}):_0x962c0d[_0xa2c1('0x30')]==_0xa2c1('0x6d')?[{'name':_0xa2c1('0x74'),'value':'true'},{'name':_0xa2c1('0x75'),'value':_0xa2c1('0x76')}]:[]};})};}})[_0xa2c1('0x17')](respondWithResult(_0x167523,null))[_0xa2c1('0x1f')](function(_0x2b1c05){var _0x1bc930=_0x455e99[_0xa2c1('0x33')][_0xa2c1('0x77')]?0x1f4:_0x2b1c05[_0xa2c1('0x78')]||0x1f4;logger['error'](_0xa2c1('0x79'),_0xa2c1('0x57'),_0x1bc930,JSON[_0xa2c1('0x7a')](_0x2b1c05));delete _0x2b1c05[_0xa2c1('0x2b')];if(_0x1bc930===0x191){_0x1bc930=0x190;}_0x167523['status'](_0x1bc930)[_0xa2c1('0x7b')](_0x455e99[_0xa2c1('0x33')][_0xa2c1('0x77')]?{'message':'Wrong\x20credentials','statusCode':_0x2b1c05[_0xa2c1('0x78')]}:_0x2b1c05);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 9f0913b..105bbff 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 _0xde25=['bluebird','request-promise','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','lodash','util','api','moment'];(function(_0x2d8518,_0x134865){var _0x499087=function(_0x285ce6){while(--_0x285ce6){_0x2d8518['push'](_0x2d8518['shift']());}};_0x499087(++_0x134865);}(_0xde25,0x1c4));var _0x5de2=function(_0x1f603e,_0x2bb597){_0x1f603e=_0x1f603e-0x0;var _0x1b837f=_0xde25[_0x1f603e];return _0x1b837f;};'use strict';var _=require(_0x5de2('0x0'));var util=require(_0x5de2('0x1'));var logger=require('../../config/logger')(_0x5de2('0x2'));var moment=require(_0x5de2('0x3'));var BPromise=require(_0x5de2('0x4'));var rp=require(_0x5de2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5de2('0x6'));var attributes=require(_0x5de2('0x7'));var integrations=require(_0x5de2('0x8'));module[_0x5de2('0x9')]=function(_0x44b848,_0x6b6006){return _0x44b848[_0x5de2('0xa')](_0x5de2('0xb'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fe6=['exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x8fe6,0xf4));var _0x68fe=function(_0xc7f23c,_0x2be758){_0xc7f23c=_0xc7f23c-0x0;var _0x4b4def=_0x8fe6[_0xc7f23c];return _0x4b4def;};'use strict';var _=require(_0x68fe('0x0'));var util=require(_0x68fe('0x1'));var logger=require(_0x68fe('0x2'))('api');var moment=require(_0x68fe('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x68fe('0x4'));var rimraf=require(_0x68fe('0x5'));var config=require(_0x68fe('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x68fe('0x7'));module[_0x68fe('0x8')]=function(_0x5a75fd,_0x3c243f){return _0x5a75fd[_0x68fe('0x9')](_0x68fe('0xa'),attributes,{'tableName':_0x68fe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 54bf959..f31e393 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 _0x22fb=['include','map','attributes','model','GetSalesforceAccount','ShowSalesforceAccount','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','code','message','error','result','catch','SalesforceAccount','findAll','options','where','limit'];(function(_0x12ac66,_0x19a9ae){var _0x2c24b2=function(_0x3e6399){while(--_0x3e6399){_0x12ac66['push'](_0x12ac66['shift']());}};_0x2c24b2(++_0x19a9ae);}(_0x22fb,0x192));var _0xb22f=function(_0x4e3315,_0x30667e){_0x4e3315=_0x4e3315-0x0;var _0x409486=_0x22fb[_0x4e3315];return _0x409486;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb22f('0x0'));var BPromise=require('bluebird');var rs=require(_0xb22f('0x1'));var fs=require('fs');var Redis=require(_0xb22f('0x2'));var db=require(_0xb22f('0x3'))['db'];var utils=require(_0xb22f('0x4'));var logger=require(_0xb22f('0x5'))('rpc');var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x412a95,_0x367d4b,_0x47f61a){return new BPromise(function(_0x34433b,_0x22c509){return client[_0xb22f('0xa')](_0x412a95,_0x47f61a)[_0xb22f('0xb')](function(_0x1a3aae){logger[_0xb22f('0xc')](_0xb22f('0xd'),_0x367d4b,_0xb22f('0xe'));logger[_0xb22f('0xf')](_0xb22f('0x10'),_0x367d4b,_0xb22f('0xe'),JSON['stringify'](_0x1a3aae));if(_0x1a3aae['error']){if(_0x1a3aae['error'][_0xb22f('0x11')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x367d4b,_0x1a3aae['error'][_0xb22f('0x12')]);return _0x22c509(_0x1a3aae[_0xb22f('0x13')][_0xb22f('0x12')]);}logger[_0xb22f('0x13')](_0xb22f('0xd'),_0x367d4b,_0x1a3aae[_0xb22f('0x13')]['message']);return _0x34433b(_0x1a3aae[_0xb22f('0x13')]['message']);}else{logger[_0xb22f('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x367d4b,_0xb22f('0xe'));_0x34433b(_0x1a3aae[_0xb22f('0x14')][_0xb22f('0x12')]);}})[_0xb22f('0x15')](function(_0x447eaf){logger['error'](_0xb22f('0xd'),_0x367d4b,_0x447eaf);_0x22c509(_0x447eaf);});});}exports['GetSalesforceAccount']=function(_0x252742){var _0x35caec=this;return new Promise(function(_0x2aaec4,_0x1f515d){return db[_0xb22f('0x16')][_0xb22f('0x17')]({'raw':_0x252742['options']?_0x252742[_0xb22f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x252742[_0xb22f('0x18')]?_0x252742[_0xb22f('0x18')][_0xb22f('0x19')]||null:null,'attributes':_0x252742[_0xb22f('0x18')]?_0x252742[_0xb22f('0x18')]['attributes']||null:null,'limit':_0x252742['options']?_0x252742[_0xb22f('0x18')][_0xb22f('0x1a')]||null:null,'include':_0x252742[_0xb22f('0x18')]?_0x252742[_0xb22f('0x18')][_0xb22f('0x1b')]?_[_0xb22f('0x1c')](_0x252742[_0xb22f('0x18')][_0xb22f('0x1b')],function(_0x583fbe){return{'model':db[_0x583fbe['model']],'as':_0x583fbe['as'],'attributes':_0x583fbe[_0xb22f('0x1d')],'include':_0x583fbe[_0xb22f('0x1b')]?_['map'](_0x583fbe[_0xb22f('0x1b')],function(_0x4364f5){return{'model':db[_0x4364f5['model']],'as':_0x4364f5['as'],'attributes':_0x4364f5[_0xb22f('0x1d')],'include':_0x4364f5[_0xb22f('0x1b')]?_['map'](_0x4364f5[_0xb22f('0x1b')],function(_0x2c4a9e){return{'model':db[_0x2c4a9e[_0xb22f('0x1e')]],'as':_0x2c4a9e['as'],'attributes':_0x2c4a9e[_0xb22f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb22f('0xb')](function(_0x246a0c){logger[_0xb22f('0xc')](_0xb22f('0x1f'),_0x252742);logger['debug']('GetSalesforceAccount',_0x252742,JSON['stringify'](_0x246a0c));_0x2aaec4(_0x246a0c);})[_0xb22f('0x15')](function(_0x557d96){logger[_0xb22f('0x13')](_0xb22f('0x1f'),_0x557d96[_0xb22f('0x12')],_0x252742);_0x1f515d(_0x35caec[_0xb22f('0x13')](0x1f4,_0x557d96[_0xb22f('0x12')]));});});};exports['ShowSalesforceAccount']=function(_0x519034){var _0x435690=this;return new Promise(function(_0x12c042,_0x319e56){return db[_0xb22f('0x16')]['find']({'raw':_0x519034[_0xb22f('0x18')]?_0x519034[_0xb22f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x519034[_0xb22f('0x18')]?_0x519034[_0xb22f('0x18')][_0xb22f('0x19')]||null:null,'attributes':_0x519034[_0xb22f('0x18')]?_0x519034[_0xb22f('0x18')]['attributes']||null:null,'include':_0x519034['options']?_0x519034[_0xb22f('0x18')][_0xb22f('0x1b')]?_[_0xb22f('0x1c')](_0x519034[_0xb22f('0x18')][_0xb22f('0x1b')],function(_0x12b079){return{'model':db[_0x12b079[_0xb22f('0x1e')]],'as':_0x12b079['as'],'attributes':_0x12b079[_0xb22f('0x1d')],'include':_0x12b079[_0xb22f('0x1b')]?_['map'](_0x12b079[_0xb22f('0x1b')],function(_0x4eadf7){return{'model':db[_0x4eadf7['model']],'as':_0x4eadf7['as'],'attributes':_0x4eadf7[_0xb22f('0x1d')],'include':_0x4eadf7[_0xb22f('0x1b')]?_[_0xb22f('0x1c')](_0x4eadf7[_0xb22f('0x1b')],function(_0x142ec1){return{'model':db[_0x142ec1[_0xb22f('0x1e')]],'as':_0x142ec1['as'],'attributes':_0x142ec1[_0xb22f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb22f('0xb')](function(_0x1be763){logger[_0xb22f('0xc')](_0xb22f('0x20'),_0x519034);logger[_0xb22f('0xf')](_0xb22f('0x20'),_0x519034,JSON['stringify'](_0x1be763));_0x12c042(_0x1be763);})['catch'](function(_0x3e5ade){logger[_0xb22f('0x13')](_0xb22f('0x20'),_0x3e5ade['message'],_0x519034);_0x319e56(_0x435690[_0xb22f('0x13')](0x1f4,_0x3e5ade[_0xb22f('0x12')]));});});}; \ No newline at end of file +var _0xda55=['include','model','find','ShowSalesforceAccount','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','map'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xda55,0x6d));var _0x5da5=function(_0x2df13f,_0x3a3921){_0x2df13f=_0x2df13f-0x0;var _0x5c8a3f=_0xda55[_0x2df13f];return _0x5c8a3f;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5da5('0x2'));var fs=require('fs');var Redis=require(_0x5da5('0x3'));var db=require(_0x5da5('0x4'))['db'];var utils=require(_0x5da5('0x5'));var logger=require(_0x5da5('0x6'))('rpc');var config=require(_0x5da5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5da5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fd877,_0x267469,_0x71b187){return new BPromise(function(_0x46290d,_0x3debdf){return client[_0x5da5('0x9')](_0x2fd877,_0x71b187)[_0x5da5('0xa')](function(_0x302795){logger['info'](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));logger[_0x5da5('0xd')](_0x5da5('0xe'),_0x267469,_0x5da5('0xc'),JSON[_0x5da5('0xf')](_0x302795));if(_0x302795[_0x5da5('0x10')]){if(_0x302795['error'][_0x5da5('0x11')]===0x1f4){logger[_0x5da5('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x267469,_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);return _0x3debdf(_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);}logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x302795['error']['message']);return _0x46290d(_0x302795['error'][_0x5da5('0x12')]);}else{logger[_0x5da5('0x13')](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));_0x46290d(_0x302795[_0x5da5('0x14')][_0x5da5('0x12')]);}})[_0x5da5('0x15')](function(_0x4a952a){logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x4a952a);_0x3debdf(_0x4a952a);});});}exports[_0x5da5('0x16')]=function(_0x16b11f){var _0x3f7e98=this;return new Promise(function(_0x428b07,_0x547c58){return db[_0x5da5('0x17')][_0x5da5('0x18')]({'raw':_0x16b11f[_0x5da5('0x19')]?_0x16b11f[_0x5da5('0x19')][_0x5da5('0x1a')]===undefined?!![]:![]:!![],'where':_0x16b11f['options']?_0x16b11f[_0x5da5('0x19')][_0x5da5('0x1b')]||null:null,'attributes':_0x16b11f[_0x5da5('0x19')]?_0x16b11f['options'][_0x5da5('0x1c')]||null:null,'limit':_0x16b11f[_0x5da5('0x19')]?_0x16b11f[_0x5da5('0x19')][_0x5da5('0x1d')]||null:null,'include':_0x16b11f[_0x5da5('0x19')]?_0x16b11f[_0x5da5('0x19')]['include']?_[_0x5da5('0x1e')](_0x16b11f['options'][_0x5da5('0x1f')],function(_0x716ab7){return{'model':db[_0x716ab7[_0x5da5('0x20')]],'as':_0x716ab7['as'],'attributes':_0x716ab7['attributes'],'include':_0x716ab7[_0x5da5('0x1f')]?_[_0x5da5('0x1e')](_0x716ab7[_0x5da5('0x1f')],function(_0x21e795){return{'model':db[_0x21e795['model']],'as':_0x21e795['as'],'attributes':_0x21e795['attributes'],'include':_0x21e795['include']?_[_0x5da5('0x1e')](_0x21e795['include'],function(_0x4e8890){return{'model':db[_0x4e8890[_0x5da5('0x20')]],'as':_0x4e8890['as'],'attributes':_0x4e8890[_0x5da5('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1798ae){logger[_0x5da5('0x13')]('GetSalesforceAccount',_0x16b11f);logger[_0x5da5('0xd')](_0x5da5('0x16'),_0x16b11f,JSON[_0x5da5('0xf')](_0x1798ae));_0x428b07(_0x1798ae);})[_0x5da5('0x15')](function(_0x766ed9){logger['error'](_0x5da5('0x16'),_0x766ed9[_0x5da5('0x12')],_0x16b11f);_0x547c58(_0x3f7e98[_0x5da5('0x10')](0x1f4,_0x766ed9[_0x5da5('0x12')]));});});};exports['ShowSalesforceAccount']=function(_0x5ee7f2){var _0x4cb022=this;return new Promise(function(_0x245273,_0x27ed41){return db[_0x5da5('0x17')][_0x5da5('0x21')]({'raw':_0x5ee7f2['options']?_0x5ee7f2['options'][_0x5da5('0x1a')]===undefined?!![]:![]:!![],'where':_0x5ee7f2['options']?_0x5ee7f2['options'][_0x5da5('0x1b')]||null:null,'attributes':_0x5ee7f2['options']?_0x5ee7f2[_0x5da5('0x19')][_0x5da5('0x1c')]||null:null,'include':_0x5ee7f2[_0x5da5('0x19')]?_0x5ee7f2[_0x5da5('0x19')][_0x5da5('0x1f')]?_[_0x5da5('0x1e')](_0x5ee7f2[_0x5da5('0x19')][_0x5da5('0x1f')],function(_0x52ce3c){return{'model':db[_0x52ce3c[_0x5da5('0x20')]],'as':_0x52ce3c['as'],'attributes':_0x52ce3c['attributes'],'include':_0x52ce3c[_0x5da5('0x1f')]?_[_0x5da5('0x1e')](_0x52ce3c[_0x5da5('0x1f')],function(_0x464623){return{'model':db[_0x464623[_0x5da5('0x20')]],'as':_0x464623['as'],'attributes':_0x464623[_0x5da5('0x1c')],'include':_0x464623[_0x5da5('0x1f')]?_[_0x5da5('0x1e')](_0x464623[_0x5da5('0x1f')],function(_0x1828e9){return{'model':db[_0x1828e9[_0x5da5('0x20')]],'as':_0x1828e9['as'],'attributes':_0x1828e9[_0x5da5('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5da5('0xa')](function(_0x4f05d7){logger[_0x5da5('0x13')]('ShowSalesforceAccount',_0x5ee7f2);logger[_0x5da5('0xd')](_0x5da5('0x22'),_0x5ee7f2,JSON[_0x5da5('0xf')](_0x4f05d7));_0x245273(_0x4f05d7);})[_0x5da5('0x15')](function(_0x59c92e){logger[_0x5da5('0x10')](_0x5da5('0x22'),_0x59c92e[_0x5da5('0x12')],_0x5ee7f2);_0x27ed41(_0x4cb022['error'](0x1f4,_0x59c92e[_0x5da5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 3b304f6..35955e0 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 _0x9344=['put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x53e091,_0x346566){var _0x5d4719=function(_0x4abf0e){while(--_0x4abf0e){_0x53e091['push'](_0x53e091['shift']());}};_0x5d4719(++_0x346566);}(_0x9344,0x1a7));var _0x4934=function(_0x5b6988,_0x67e002){_0x5b6988=_0x5b6988-0x0;var _0x4e2cc9=_0x9344[_0x5b6988];return _0x4e2cc9;};'use strict';var multer=require(_0x4934('0x0'));var util=require(_0x4934('0x1'));var path=require('path');var timeout=require(_0x4934('0x2'));var express=require(_0x4934('0x3'));var router=express[_0x4934('0x4')]();var fs_extra=require(_0x4934('0x5'));var auth=require(_0x4934('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4934('0x7'));var controller=require('./intSalesforceConfiguration.controller');router[_0x4934('0x8')]('/',auth[_0x4934('0x9')](),controller[_0x4934('0xa')]);router[_0x4934('0x8')](_0x4934('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4934('0x8')](_0x4934('0xc'),auth[_0x4934('0x9')](),controller[_0x4934('0xd')]);router[_0x4934('0x8')](_0x4934('0xe'),auth[_0x4934('0x9')](),controller[_0x4934('0xf')]);router[_0x4934('0x8')](_0x4934('0x10'),auth[_0x4934('0x9')](),controller[_0x4934('0x11')]);router['post']('/',auth[_0x4934('0x9')](),controller['create']);router[_0x4934('0x12')](_0x4934('0xb'),auth[_0x4934('0x9')](),controller[_0x4934('0x13')]);router['delete'](_0x4934('0xb'),auth[_0x4934('0x9')](),controller[_0x4934('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1e23=['getFields','/:id/subjects','getSubjects','post','create','/:id','update','delete','exports','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields'];(function(_0x4f8184,_0x5b6b51){var _0xbd0150=function(_0x311117){while(--_0x311117){_0x4f8184['push'](_0x4f8184['shift']());}};_0xbd0150(++_0x5b6b51);}(_0x1e23,0x15d));var _0x31e2=function(_0x340b39,_0xa7225e){_0x340b39=_0x340b39-0x0;var _0x24b674=_0x1e23[_0x340b39];return _0x24b674;};'use strict';var multer=require('multer');var util=require(_0x31e2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x31e2('0x1')]();var fs_extra=require(_0x31e2('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x31e2('0x3'));var config=require(_0x31e2('0x4'));var controller=require(_0x31e2('0x5'));router[_0x31e2('0x6')]('/',auth[_0x31e2('0x7')](),controller[_0x31e2('0x8')]);router[_0x31e2('0x6')]('/:id',auth[_0x31e2('0x7')](),controller[_0x31e2('0x9')]);router[_0x31e2('0x6')](_0x31e2('0xa'),auth[_0x31e2('0x7')](),controller[_0x31e2('0xb')]);router[_0x31e2('0x6')](_0x31e2('0xc'),auth[_0x31e2('0x7')](),controller[_0x31e2('0xd')]);router[_0x31e2('0x6')]('/:id/descriptions',auth[_0x31e2('0x7')](),controller['getDescriptions']);router[_0x31e2('0xe')]('/',auth[_0x31e2('0x7')](),controller[_0x31e2('0xf')]);router['put'](_0x31e2('0x10'),auth[_0x31e2('0x7')](),controller[_0x31e2('0x11')]);router[_0x31e2('0x12')](_0x31e2('0x10'),auth[_0x31e2('0x7')](),controller['destroy']);module[_0x31e2('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index a678b50..cb160e7 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 _0xcb39=['Task','Case','contact_lead','contact','lead','account_contact_lead','account','sequelize','exports','STRING','ENUM'];(function(_0x443019,_0x1c160d){var _0x48fb86=function(_0x1f1e55){while(--_0x1f1e55){_0x443019['push'](_0x443019['shift']());}};_0x48fb86(++_0x1c160d);}(_0xcb39,0xee));var _0x9cb3=function(_0x2e1095,_0x3a7d94){_0x2e1095=_0x2e1095-0x0;var _0x3b2455=_0xcb39[_0x2e1095];return _0x3b2455;};'use strict';var Sequelize=require(_0x9cb3('0x0'));module[_0x9cb3('0x1')]={'name':{'type':Sequelize[_0x9cb3('0x2')]},'description':{'type':Sequelize[_0x9cb3('0x2')]},'ticketType':{'type':Sequelize[_0x9cb3('0x3')](_0x9cb3('0x4'),_0x9cb3('0x5')),'defaultValue':_0x9cb3('0x4')},'moduleSearch':{'type':Sequelize[_0x9cb3('0x3')](_0x9cb3('0x6'),_0x9cb3('0x7'),_0x9cb3('0x8'),_0x9cb3('0x9'),_0x9cb3('0xa')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x9cb3('0x3')]('nothing','contact',_0x9cb3('0x8'),_0x9cb3('0xa')),'defaultValue':_0x9cb3('0x8')},'leadId':{'type':Sequelize[_0x9cb3('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x9cb3('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x9cb3('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x9cb3('0x2')]}}; \ No newline at end of file +var _0xf544=['account','nothing','lead','sequelize','STRING','ENUM','Case','Task','contact_lead','contact'];(function(_0x13e875,_0x5c7330){var _0x5c4ab2=function(_0x3186db){while(--_0x3186db){_0x13e875['push'](_0x13e875['shift']());}};_0x5c4ab2(++_0x5c7330);}(_0xf544,0x99));var _0x4f54=function(_0x3df9dd,_0x26f5cd){_0x3df9dd=_0x3df9dd-0x0;var _0x4f11e4=_0xf544[_0x3df9dd];return _0x4f11e4;};'use strict';var Sequelize=require(_0x4f54('0x0'));module['exports']={'name':{'type':Sequelize[_0x4f54('0x1')]},'description':{'type':Sequelize[_0x4f54('0x1')]},'ticketType':{'type':Sequelize[_0x4f54('0x2')]('Task',_0x4f54('0x3')),'defaultValue':_0x4f54('0x4')},'moduleSearch':{'type':Sequelize[_0x4f54('0x2')](_0x4f54('0x5'),_0x4f54('0x6'),'lead','account_contact_lead',_0x4f54('0x7')),'defaultValue':_0x4f54('0x5')},'moduleCreate':{'type':Sequelize[_0x4f54('0x2')](_0x4f54('0x8'),_0x4f54('0x6'),_0x4f54('0x9'),_0x4f54('0x7')),'defaultValue':_0x4f54('0x9')},'leadId':{'type':Sequelize[_0x4f54('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x4f54('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x4f54('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x4f54('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 9ed81f5..993b44c 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 _0x3867=['find','create','body','destroy','params','getFields','findOne','nolimit','getSubjects','SalesforceField','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','show','length','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3867,0x15f));var _0x7386=function(_0x364ccd,_0x27a439){_0x364ccd=_0x364ccd-0x0;var _0x388ae5=_0x3867[_0x364ccd];return _0x388ae5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7386('0x0'));var zipdir=require(_0x7386('0x1'));var jsonpatch=require(_0x7386('0x2'));var rp=require('request-promise');var moment=require(_0x7386('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7386('0x4'));var util=require(_0x7386('0x5'));var path=require(_0x7386('0x6'));var sox=require('sox');var csv=require(_0x7386('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7386('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7386('0x9'));var jsforce=require(_0x7386('0xa'));var deskjs=require(_0x7386('0xb'));var toCsv=require(_0x7386('0x7'));var querystring=require(_0x7386('0xc'));var Papa=require(_0x7386('0xd'));var Redis=require(_0x7386('0xe'));var authService=require(_0x7386('0xf'));var qs=require(_0x7386('0x10'));var as=require(_0x7386('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7386('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x7386('0x13'));var licenseUtil=require(_0x7386('0x14'));var db=require(_0x7386('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x7386('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x109af2,_0x523a79,_0x33f640,_0x2996de){return new BPromise(function(_0x4b869c,_0x500d0c){var _0x4266cc=_0x2996de||client;return _0x4266cc['request'](_0x109af2,_0x33f640)[_0x7386('0x17')](function(_0xa886eb){logger[_0x7386('0x18')](_0x7386('0x19'),_0x523a79,_0x7386('0x1a'));logger['debug'](_0x7386('0x1b'),_0x523a79,'request\x20sent',JSON[_0x7386('0x1c')](_0xa886eb));if(_0xa886eb[_0x7386('0x1d')]){if(_0xa886eb[_0x7386('0x1d')]['code']===0x1f4){logger[_0x7386('0x1d')](_0x7386('0x19'),_0x523a79,_0xa886eb['error'][_0x7386('0x1e')]);return _0x500d0c(_0xa886eb[_0x7386('0x1d')][_0x7386('0x1e')]);}logger[_0x7386('0x1d')](_0x7386('0x19'),_0x523a79,_0xa886eb['error']['message']);return _0x4b869c(_0xa886eb[_0x7386('0x1d')]['message']);}else{logger[_0x7386('0x18')]('SalesforceConfiguration,\x20%s,\x20%s',_0x523a79,_0x7386('0x1a'));_0x4b869c(_0xa886eb['result'][_0x7386('0x1e')]);}})[_0x7386('0x1f')](function(_0x255966){logger[_0x7386('0x1d')]('SalesforceConfiguration,\x20%s,\x20%s',_0x523a79,_0x255966);_0x500d0c(_0x255966);});});}function respondWithStatusCode(_0x196ced,_0x114083){_0x114083=_0x114083||0xcc;return function(_0x50b5c0){if(_0x50b5c0){return _0x196ced[_0x7386('0x20')](_0x114083);}return _0x196ced[_0x7386('0x21')](_0x114083)[_0x7386('0x22')]();};}function respondWithResult(_0x78b14a,_0x290d6e){_0x290d6e=_0x290d6e||0xc8;return function(_0x480f1d){if(_0x480f1d){return _0x78b14a[_0x7386('0x21')](_0x290d6e)[_0x7386('0x23')](_0x480f1d);}};}function respondWithFilteredResult(_0x719b1e,_0x33098c){return function(_0x2191c0){if(_0x2191c0){var _0x5ee32f=_0x2191c0[_0x7386('0x24')],_0x32ca2a=_0x33098c['offset'],_0x5c57de=_0x33098c[_0x7386('0x25')]+_0x33098c[_0x7386('0x26')],_0x44c661;if(_0x5c57de>=_0x5ee32f){_0x5c57de=_0x5ee32f;_0x44c661=0xc8;}else{_0x44c661=0xce;}_0x719b1e[_0x7386('0x21')](_0x44c661);return _0x719b1e[_0x7386('0x27')]('Content-Range',_0x32ca2a+'-'+_0x5c57de+'/'+_0x5ee32f)[_0x7386('0x23')](_0x2191c0);}return null;};}function patchUpdates(_0x11c69d){return function(_0x38c20a){try{jsonpatch[_0x7386('0x28')](_0x38c20a,_0x11c69d,!![]);}catch(_0x1413aa){return BPromise[_0x7386('0x29')](_0x1413aa);}return _0x38c20a[_0x7386('0x2a')]();};}function saveUpdates(_0x3d5949,_0x56496c){return function(_0x570b32){if(_0x570b32){return _0x570b32[_0x7386('0x2b')](_0x3d5949)[_0x7386('0x17')](function(_0x252f75){return _0x252f75;});}return null;};}function removeEntity(_0x6455f2,_0xc8ab99){return function(_0x4b1662){if(_0x4b1662){return _0x4b1662['destroy']()[_0x7386('0x17')](function(){_0x6455f2[_0x7386('0x21')](0xcc)[_0x7386('0x22')]();});}};}function handleEntityNotFound(_0x440f4e,_0x546927){return function(_0x336010){if(!_0x336010){_0x440f4e[_0x7386('0x20')](0x194);}return _0x336010;};}function handleError(_0x1f8084,_0x1269d0){_0x1269d0=_0x1269d0||0x1f4;return function(_0x5dd0bb){logger[_0x7386('0x1d')](_0x5dd0bb[_0x7386('0x2c')]);if(_0x5dd0bb[_0x7386('0x2d')]){delete _0x5dd0bb['name'];}_0x1f8084[_0x7386('0x21')](_0x1269d0)[_0x7386('0x2e')](_0x5dd0bb);};}exports[_0x7386('0x2f')]=function(_0x55ac9f,_0x4768a4){var _0x3e297f={},_0x4ff0b1={},_0x274832={'count':0x0,'rows':[]};var _0x4a8e92=_[_0x7386('0x30')](db[_0x7386('0x31')][_0x7386('0x32')],function(_0x3dac81){return{'name':_0x3dac81[_0x7386('0x33')],'type':_0x3dac81['type'][_0x7386('0x34')]};});_0x4ff0b1[_0x7386('0x35')]=_[_0x7386('0x30')](_0x4a8e92,_0x7386('0x2d'));_0x4ff0b1[_0x7386('0x36')]=_[_0x7386('0x37')](_0x55ac9f['query']);_0x4ff0b1[_0x7386('0x38')]=_[_0x7386('0x39')](_0x4ff0b1[_0x7386('0x35')],_0x4ff0b1[_0x7386('0x36')]);_0x3e297f[_0x7386('0x3a')]=_[_0x7386('0x39')](_0x4ff0b1['model'],qs[_0x7386('0x3b')](_0x55ac9f[_0x7386('0x36')][_0x7386('0x3b')]));_0x3e297f['attributes']=_0x3e297f['attributes']['length']?_0x3e297f[_0x7386('0x3a')]:_0x4ff0b1[_0x7386('0x35')];if(!_0x55ac9f[_0x7386('0x36')][_0x7386('0x3c')]('nolimit')){_0x3e297f[_0x7386('0x26')]=qs[_0x7386('0x26')](_0x55ac9f[_0x7386('0x36')][_0x7386('0x26')]);_0x3e297f[_0x7386('0x25')]=qs[_0x7386('0x25')](_0x55ac9f[_0x7386('0x36')]['offset']);}_0x3e297f[_0x7386('0x3d')]=qs['sort'](_0x55ac9f[_0x7386('0x36')][_0x7386('0x3e')]);_0x3e297f[_0x7386('0x3f')]=qs[_0x7386('0x38')](_[_0x7386('0x40')](_0x55ac9f[_0x7386('0x36')],_0x4ff0b1[_0x7386('0x38')]),_0x4a8e92);if(_0x55ac9f[_0x7386('0x36')][_0x7386('0x41')]){_0x3e297f['where']=_['merge'](_0x3e297f[_0x7386('0x3f')],{'$or':_[_0x7386('0x30')](_0x4a8e92,function(_0x235bb1){if(_0x235bb1['type']!==_0x7386('0x42')){var _0x2026bc={};_0x2026bc[_0x235bb1[_0x7386('0x2d')]]={'$like':'%'+_0x55ac9f['query'][_0x7386('0x41')]+'%'};return _0x2026bc;}})});}_0x3e297f=_[_0x7386('0x43')]({},_0x3e297f,_0x55ac9f['options']);var _0x12db9b={'where':_0x3e297f['where']};return db[_0x7386('0x31')][_0x7386('0x24')](_0x12db9b)[_0x7386('0x17')](function(_0x2e5b30){_0x274832[_0x7386('0x24')]=_0x2e5b30;if(_0x55ac9f[_0x7386('0x36')][_0x7386('0x44')]){_0x3e297f[_0x7386('0x45')]=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x3e297f);})[_0x7386('0x17')](function(_0x53d63e){_0x274832[_0x7386('0x46')]=_0x53d63e;return _0x274832;})[_0x7386('0x17')](respondWithFilteredResult(_0x4768a4,_0x3e297f))[_0x7386('0x1f')](handleError(_0x4768a4,null));};exports[_0x7386('0x47')]=function(_0x130cab,_0x1fc85f){var _0x3c7460={'raw':![],'where':{'id':_0x130cab['params']['id']}},_0x2fb642={};_0x2fb642[_0x7386('0x35')]=_[_0x7386('0x37')](db[_0x7386('0x31')]['rawAttributes']);_0x2fb642[_0x7386('0x36')]=_[_0x7386('0x37')](_0x130cab[_0x7386('0x36')]);_0x2fb642[_0x7386('0x38')]=_['intersection'](_0x2fb642[_0x7386('0x35')],_0x2fb642[_0x7386('0x36')]);_0x3c7460['attributes']=_[_0x7386('0x39')](_0x2fb642[_0x7386('0x35')],qs['fields'](_0x130cab['query']['fields']));_0x3c7460[_0x7386('0x3a')]=_0x3c7460[_0x7386('0x3a')][_0x7386('0x48')]?_0x3c7460[_0x7386('0x3a')]:_0x2fb642[_0x7386('0x35')];if(_0x130cab[_0x7386('0x36')][_0x7386('0x44')]){_0x3c7460[_0x7386('0x45')]=[{'all':!![]}];}_0x3c7460=_[_0x7386('0x43')]({},_0x3c7460,_0x130cab[_0x7386('0x49')]);return db[_0x7386('0x31')][_0x7386('0x4a')](_0x3c7460)[_0x7386('0x17')](handleEntityNotFound(_0x1fc85f,null))[_0x7386('0x17')](respondWithResult(_0x1fc85f,null))[_0x7386('0x1f')](handleError(_0x1fc85f,null));};exports[_0x7386('0x4b')]=function(_0x172694,_0x5a2967){return db[_0x7386('0x31')]['create'](_0x172694[_0x7386('0x4c')],{})['then'](respondWithResult(_0x5a2967,0xc9))[_0x7386('0x1f')](handleError(_0x5a2967,null));};exports[_0x7386('0x2b')]=function(_0x1dce74,_0x4c7e49){if(_0x1dce74[_0x7386('0x4c')]['id']){delete _0x1dce74[_0x7386('0x4c')]['id'];}return db[_0x7386('0x31')][_0x7386('0x4a')]({'where':{'id':_0x1dce74['params']['id']}})[_0x7386('0x17')](handleEntityNotFound(_0x4c7e49,null))[_0x7386('0x17')](saveUpdates(_0x1dce74[_0x7386('0x4c')],null))[_0x7386('0x17')](respondWithResult(_0x4c7e49,null))['catch'](handleError(_0x4c7e49,null));};exports[_0x7386('0x4d')]=function(_0x256f86,_0x588b4a){return db[_0x7386('0x31')][_0x7386('0x4a')]({'where':{'id':_0x256f86[_0x7386('0x4e')]['id']}})[_0x7386('0x17')](handleEntityNotFound(_0x588b4a,null))[_0x7386('0x17')](removeEntity(_0x588b4a,null))['catch'](handleError(_0x588b4a,null));};exports[_0x7386('0x4f')]=function(_0x1d773f,_0x5d18af,_0x3249a9){var _0x50b312={};var _0x120227={};var _0x2deaf3;var _0x331158;return db[_0x7386('0x31')][_0x7386('0x50')]({'where':{'id':_0x1d773f[_0x7386('0x4e')]['id']}})[_0x7386('0x17')](handleEntityNotFound(_0x5d18af,null))['then'](function(_0x699665){if(_0x699665){_0x2deaf3=_0x699665;_0x120227['model']=_['keys'](db['SalesforceField'][_0x7386('0x32')]);_0x120227[_0x7386('0x36')]=_[_0x7386('0x37')](_0x1d773f['query']);_0x120227[_0x7386('0x38')]=_['intersection'](_0x120227['model'],_0x120227[_0x7386('0x36')]);_0x50b312[_0x7386('0x3a')]=_[_0x7386('0x39')](_0x120227[_0x7386('0x35')],qs[_0x7386('0x3b')](_0x1d773f[_0x7386('0x36')][_0x7386('0x3b')]));_0x50b312[_0x7386('0x3a')]=_0x50b312['attributes']['length']?_0x50b312[_0x7386('0x3a')]:_0x120227[_0x7386('0x35')];_0x50b312['order']=qs[_0x7386('0x3e')](_0x1d773f['query'][_0x7386('0x3e')]);_0x50b312['where']=qs[_0x7386('0x38')](_[_0x7386('0x40')](_0x1d773f['query'],_0x120227[_0x7386('0x38')]));if(_0x1d773f['query'][_0x7386('0x41')]){_0x50b312['where']=_[_0x7386('0x43')](_0x50b312[_0x7386('0x3f')],{'$or':_[_0x7386('0x30')](_0x50b312[_0x7386('0x3a')],function(_0x34cfae){var _0x590bda={};_0x590bda[_0x34cfae]={'$like':'%'+_0x1d773f[_0x7386('0x36')][_0x7386('0x41')]+'%'};return _0x590bda;})});}_0x50b312=_[_0x7386('0x43')]({},_0x50b312,_0x1d773f[_0x7386('0x49')]);return _0x2deaf3['getFields'](_0x50b312);}})[_0x7386('0x17')](function(_0x36bd6d){if(_0x36bd6d){_0x331158=_0x36bd6d[_0x7386('0x48')];if(!_0x1d773f[_0x7386('0x36')][_0x7386('0x3c')](_0x7386('0x51'))){_0x50b312['limit']=qs[_0x7386('0x26')](_0x1d773f[_0x7386('0x36')]['limit']);_0x50b312['offset']=qs[_0x7386('0x25')](_0x1d773f[_0x7386('0x36')][_0x7386('0x25')]);}return _0x2deaf3[_0x7386('0x4f')](_0x50b312);}})['then'](function(_0x2cb25e){if(_0x2cb25e){return _0x2cb25e?{'count':_0x331158,'rows':_0x2cb25e}:null;}})[_0x7386('0x17')](respondWithResult(_0x5d18af,null))['catch'](handleError(_0x5d18af,null));};exports[_0x7386('0x52')]=function(_0x224680,_0x48fa55,_0x8317a4){var _0x3d5382={};var _0x29b27b={};var _0x3a584a;var _0xc98007;return db[_0x7386('0x31')][_0x7386('0x50')]({'where':{'id':_0x224680[_0x7386('0x4e')]['id']}})[_0x7386('0x17')](handleEntityNotFound(_0x48fa55,null))[_0x7386('0x17')](function(_0x37bf79){if(_0x37bf79){_0x3a584a=_0x37bf79;_0x29b27b[_0x7386('0x35')]=_['keys'](db[_0x7386('0x53')][_0x7386('0x32')]);_0x29b27b[_0x7386('0x36')]=_[_0x7386('0x37')](_0x224680[_0x7386('0x36')]);_0x29b27b[_0x7386('0x38')]=_[_0x7386('0x39')](_0x29b27b[_0x7386('0x35')],_0x29b27b[_0x7386('0x36')]);_0x3d5382['attributes']=_[_0x7386('0x39')](_0x29b27b[_0x7386('0x35')],qs[_0x7386('0x3b')](_0x224680[_0x7386('0x36')]['fields']));_0x3d5382[_0x7386('0x3a')]=_0x3d5382[_0x7386('0x3a')]['length']?_0x3d5382[_0x7386('0x3a')]:_0x29b27b[_0x7386('0x35')];_0x3d5382['order']=qs['sort'](_0x224680['query'][_0x7386('0x3e')]);_0x3d5382[_0x7386('0x3f')]=qs[_0x7386('0x38')](_[_0x7386('0x40')](_0x224680[_0x7386('0x36')],_0x29b27b[_0x7386('0x38')]));if(_0x224680['query'][_0x7386('0x41')]){_0x3d5382[_0x7386('0x3f')]=_['merge'](_0x3d5382[_0x7386('0x3f')],{'$or':_[_0x7386('0x30')](_0x3d5382['attributes'],function(_0xc82f89){var _0x6f2c54={};_0x6f2c54[_0xc82f89]={'$like':'%'+_0x224680[_0x7386('0x36')][_0x7386('0x41')]+'%'};return _0x6f2c54;})});}_0x3d5382=_[_0x7386('0x43')]({},_0x3d5382,_0x224680['options']);return _0x3a584a['getSubjects'](_0x3d5382);}})['then'](function(_0x3b4f5a){if(_0x3b4f5a){_0xc98007=_0x3b4f5a['length'];if(!_0x224680[_0x7386('0x36')][_0x7386('0x3c')]('nolimit')){_0x3d5382[_0x7386('0x26')]=qs['limit'](_0x224680[_0x7386('0x36')][_0x7386('0x26')]);_0x3d5382[_0x7386('0x25')]=qs[_0x7386('0x25')](_0x224680[_0x7386('0x36')][_0x7386('0x25')]);}return _0x3a584a[_0x7386('0x52')](_0x3d5382);}})['then'](function(_0xd0b267){if(_0xd0b267){return _0xd0b267?{'count':_0xc98007,'rows':_0xd0b267}:null;}})[_0x7386('0x17')](respondWithResult(_0x48fa55,null))[_0x7386('0x1f')](handleError(_0x48fa55,null));};exports[_0x7386('0x54')]=function(_0x5c448c,_0x3b7500,_0x43e0e2){var _0x4835c4={};var _0x5ae56d={};var _0x343df7;var _0xcd7e1d;return db[_0x7386('0x31')][_0x7386('0x50')]({'where':{'id':_0x5c448c[_0x7386('0x4e')]['id']}})[_0x7386('0x17')](handleEntityNotFound(_0x3b7500,null))[_0x7386('0x17')](function(_0x513bf7){if(_0x513bf7){_0x343df7=_0x513bf7;_0x5ae56d['model']=_[_0x7386('0x37')](db['SalesforceField'][_0x7386('0x32')]);_0x5ae56d[_0x7386('0x36')]=_[_0x7386('0x37')](_0x5c448c[_0x7386('0x36')]);_0x5ae56d[_0x7386('0x38')]=_[_0x7386('0x39')](_0x5ae56d[_0x7386('0x35')],_0x5ae56d[_0x7386('0x36')]);_0x4835c4[_0x7386('0x3a')]=_[_0x7386('0x39')](_0x5ae56d[_0x7386('0x35')],qs[_0x7386('0x3b')](_0x5c448c['query']['fields']));_0x4835c4[_0x7386('0x3a')]=_0x4835c4[_0x7386('0x3a')][_0x7386('0x48')]?_0x4835c4[_0x7386('0x3a')]:_0x5ae56d['model'];_0x4835c4[_0x7386('0x3d')]=qs[_0x7386('0x3e')](_0x5c448c['query'][_0x7386('0x3e')]);_0x4835c4[_0x7386('0x3f')]=qs[_0x7386('0x38')](_['pick'](_0x5c448c['query'],_0x5ae56d[_0x7386('0x38')]));if(_0x5c448c['query'][_0x7386('0x41')]){_0x4835c4[_0x7386('0x3f')]=_[_0x7386('0x43')](_0x4835c4['where'],{'$or':_[_0x7386('0x30')](_0x4835c4['attributes'],function(_0x5753ed){var _0x4271ec={};_0x4271ec[_0x5753ed]={'$like':'%'+_0x5c448c[_0x7386('0x36')]['filter']+'%'};return _0x4271ec;})});}_0x4835c4=_[_0x7386('0x43')]({},_0x4835c4,_0x5c448c[_0x7386('0x49')]);return _0x343df7[_0x7386('0x54')](_0x4835c4);}})[_0x7386('0x17')](function(_0x310518){if(_0x310518){_0xcd7e1d=_0x310518[_0x7386('0x48')];if(!_0x5c448c[_0x7386('0x36')][_0x7386('0x3c')](_0x7386('0x51'))){_0x4835c4[_0x7386('0x26')]=qs[_0x7386('0x26')](_0x5c448c['query']['limit']);_0x4835c4['offset']=qs['offset'](_0x5c448c[_0x7386('0x36')][_0x7386('0x25')]);}return _0x343df7[_0x7386('0x54')](_0x4835c4);}})[_0x7386('0x17')](function(_0x3cd4e4){if(_0x3cd4e4){return _0x3cd4e4?{'count':_0xcd7e1d,'rows':_0x3cd4e4}:null;}})[_0x7386('0x17')](respondWithResult(_0x3b7500,null))['catch'](handleError(_0x3b7500,null));}; \ No newline at end of file +var _0xf12d=['map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','show','params','length','includeAll','find','create','body','SalesforceField','order','nolimit','getFields','getSubjects','findOne','getDescriptions','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','send'];(function(_0x56ec9d,_0x5a4d7e){var _0x1d77b6=function(_0x24f2c4){while(--_0x24f2c4){_0x56ec9d['push'](_0x56ec9d['shift']());}};_0x1d77b6(++_0x5a4d7e);}(_0xf12d,0xcc));var _0xdf12=function(_0x4118c5,_0x378ea7){_0x4118c5=_0x4118c5-0x0;var _0x21fe14=_0xf12d[_0x4118c5];return _0x21fe14;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdf12('0x0'));var rp=require(_0xdf12('0x1'));var moment=require(_0xdf12('0x2'));var BPromise=require(_0xdf12('0x3'));var Mustache=require(_0xdf12('0x4'));var util=require('util');var path=require('path');var sox=require(_0xdf12('0x5'));var csv=require(_0xdf12('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdf12('0x7'));var squel=require('squel');var crypto=require(_0xdf12('0x8'));var jsforce=require(_0xdf12('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xdf12('0x6'));var querystring=require(_0xdf12('0xa'));var Papa=require('papaparse');var Redis=require(_0xdf12('0xb'));var authService=require(_0xdf12('0xc'));var qs=require(_0xdf12('0xd'));var as=require(_0xdf12('0xe'));var hardwareService=require(_0xdf12('0xf'));var logger=require('../../config/logger')(_0xdf12('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdf12('0x11'));var db=require('../../mysqldb')['db'];var jayson=require(_0xdf12('0x12'));var client=jayson[_0xdf12('0x13')][_0xdf12('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x587124,_0x5b9b24,_0x10e901,_0x4fd345){return new BPromise(function(_0x284cfe,_0x46f7b5){var _0x43c687=_0x4fd345||client;return _0x43c687[_0xdf12('0x15')](_0x587124,_0x10e901)[_0xdf12('0x16')](function(_0x3f1a4d){logger[_0xdf12('0x17')](_0xdf12('0x18'),_0x5b9b24,_0xdf12('0x19'));logger[_0xdf12('0x1a')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x5b9b24,_0xdf12('0x19'),JSON['stringify'](_0x3f1a4d));if(_0x3f1a4d[_0xdf12('0x1b')]){if(_0x3f1a4d[_0xdf12('0x1b')]['code']===0x1f4){logger['error'](_0xdf12('0x18'),_0x5b9b24,_0x3f1a4d['error'][_0xdf12('0x1c')]);return _0x46f7b5(_0x3f1a4d[_0xdf12('0x1b')][_0xdf12('0x1c')]);}logger['error'](_0xdf12('0x18'),_0x5b9b24,_0x3f1a4d[_0xdf12('0x1b')]['message']);return _0x284cfe(_0x3f1a4d[_0xdf12('0x1b')][_0xdf12('0x1c')]);}else{logger[_0xdf12('0x17')](_0xdf12('0x18'),_0x5b9b24,_0xdf12('0x19'));_0x284cfe(_0x3f1a4d[_0xdf12('0x1d')][_0xdf12('0x1c')]);}})[_0xdf12('0x1e')](function(_0xf2a3c3){logger[_0xdf12('0x1b')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5b9b24,_0xf2a3c3);_0x46f7b5(_0xf2a3c3);});});}function respondWithStatusCode(_0xae1340,_0x467036){_0x467036=_0x467036||0xcc;return function(_0x9f141e){if(_0x9f141e){return _0xae1340[_0xdf12('0x1f')](_0x467036);}return _0xae1340[_0xdf12('0x20')](_0x467036)[_0xdf12('0x21')]();};}function respondWithResult(_0x5bf3d9,_0x25dc54){_0x25dc54=_0x25dc54||0xc8;return function(_0x338011){if(_0x338011){return _0x5bf3d9['status'](_0x25dc54)['json'](_0x338011);}};}function respondWithFilteredResult(_0x2556a1,_0x3b0cf2){return function(_0x268fa1){if(_0x268fa1){var _0x571958=_0x268fa1[_0xdf12('0x22')],_0x1fb25c=_0x3b0cf2[_0xdf12('0x23')],_0x18feed=_0x3b0cf2[_0xdf12('0x23')]+_0x3b0cf2[_0xdf12('0x24')],_0x4cab91;if(_0x18feed>=_0x571958){_0x18feed=_0x571958;_0x4cab91=0xc8;}else{_0x4cab91=0xce;}_0x2556a1[_0xdf12('0x20')](_0x4cab91);return _0x2556a1[_0xdf12('0x25')](_0xdf12('0x26'),_0x1fb25c+'-'+_0x18feed+'/'+_0x571958)[_0xdf12('0x27')](_0x268fa1);}return null;};}function patchUpdates(_0x35cdea){return function(_0x3a7314){try{jsonpatch[_0xdf12('0x28')](_0x3a7314,_0x35cdea,!![]);}catch(_0x46e713){return BPromise['reject'](_0x46e713);}return _0x3a7314[_0xdf12('0x29')]();};}function saveUpdates(_0x50f4f5,_0x18edcc){return function(_0x4127fa){if(_0x4127fa){return _0x4127fa[_0xdf12('0x2a')](_0x50f4f5)[_0xdf12('0x16')](function(_0x1460c7){return _0x1460c7;});}return null;};}function removeEntity(_0x116920,_0x336982){return function(_0x44fb13){if(_0x44fb13){return _0x44fb13[_0xdf12('0x2b')]()[_0xdf12('0x16')](function(){_0x116920[_0xdf12('0x20')](0xcc)[_0xdf12('0x21')]();});}};}function handleEntityNotFound(_0x460e40,_0x5b6a8e){return function(_0x4ccdce){if(!_0x4ccdce){_0x460e40[_0xdf12('0x1f')](0x194);}return _0x4ccdce;};}function handleError(_0x5ece16,_0x2c42c0){_0x2c42c0=_0x2c42c0||0x1f4;return function(_0x166449){logger[_0xdf12('0x1b')](_0x166449['stack']);if(_0x166449['name']){delete _0x166449['name'];}_0x5ece16[_0xdf12('0x20')](_0x2c42c0)[_0xdf12('0x2c')](_0x166449);};}exports['index']=function(_0x3bb410,_0x284a0c){var _0x384a5b={},_0x2c796a={},_0xa7b9fd={'count':0x0,'rows':[]};var _0x43bd07=_[_0xdf12('0x2d')](db[_0xdf12('0x2e')][_0xdf12('0x2f')],function(_0x2c01ba){return{'name':_0x2c01ba[_0xdf12('0x30')],'type':_0x2c01ba[_0xdf12('0x31')][_0xdf12('0x32')]};});_0x2c796a[_0xdf12('0x33')]=_[_0xdf12('0x2d')](_0x43bd07,_0xdf12('0x34'));_0x2c796a[_0xdf12('0x35')]=_[_0xdf12('0x36')](_0x3bb410[_0xdf12('0x35')]);_0x2c796a['filters']=_[_0xdf12('0x37')](_0x2c796a[_0xdf12('0x33')],_0x2c796a[_0xdf12('0x35')]);_0x384a5b[_0xdf12('0x38')]=_[_0xdf12('0x37')](_0x2c796a['model'],qs[_0xdf12('0x39')](_0x3bb410[_0xdf12('0x35')][_0xdf12('0x39')]));_0x384a5b[_0xdf12('0x38')]=_0x384a5b[_0xdf12('0x38')]['length']?_0x384a5b[_0xdf12('0x38')]:_0x2c796a[_0xdf12('0x33')];if(!_0x3bb410['query'][_0xdf12('0x3a')]('nolimit')){_0x384a5b['limit']=qs[_0xdf12('0x24')](_0x3bb410[_0xdf12('0x35')][_0xdf12('0x24')]);_0x384a5b['offset']=qs['offset'](_0x3bb410['query'][_0xdf12('0x23')]);}_0x384a5b['order']=qs[_0xdf12('0x3b')](_0x3bb410[_0xdf12('0x35')][_0xdf12('0x3b')]);_0x384a5b[_0xdf12('0x3c')]=qs[_0xdf12('0x3d')](_[_0xdf12('0x3e')](_0x3bb410['query'],_0x2c796a[_0xdf12('0x3d')]),_0x43bd07);if(_0x3bb410['query'][_0xdf12('0x3f')]){_0x384a5b['where']=_[_0xdf12('0x40')](_0x384a5b[_0xdf12('0x3c')],{'$or':_[_0xdf12('0x2d')](_0x43bd07,function(_0x450c5a){if(_0x450c5a['type']!==_0xdf12('0x41')){var _0x4b65c4={};_0x4b65c4[_0x450c5a[_0xdf12('0x34')]]={'$like':'%'+_0x3bb410[_0xdf12('0x35')][_0xdf12('0x3f')]+'%'};return _0x4b65c4;}})});}_0x384a5b=_[_0xdf12('0x40')]({},_0x384a5b,_0x3bb410[_0xdf12('0x42')]);var _0x358d06={'where':_0x384a5b['where']};return db[_0xdf12('0x2e')][_0xdf12('0x22')](_0x358d06)[_0xdf12('0x16')](function(_0x1068e1){_0xa7b9fd[_0xdf12('0x22')]=_0x1068e1;if(_0x3bb410['query']['includeAll']){_0x384a5b[_0xdf12('0x43')]=[{'all':!![]}];}return db[_0xdf12('0x2e')]['findAll'](_0x384a5b);})[_0xdf12('0x16')](function(_0x3766c3){_0xa7b9fd[_0xdf12('0x44')]=_0x3766c3;return _0xa7b9fd;})[_0xdf12('0x16')](respondWithFilteredResult(_0x284a0c,_0x384a5b))[_0xdf12('0x1e')](handleError(_0x284a0c,null));};exports[_0xdf12('0x45')]=function(_0x5d4ed5,_0x533c16){var _0x64ae3a={'raw':![],'where':{'id':_0x5d4ed5[_0xdf12('0x46')]['id']}},_0x5975c8={};_0x5975c8[_0xdf12('0x33')]=_['keys'](db[_0xdf12('0x2e')][_0xdf12('0x2f')]);_0x5975c8['query']=_[_0xdf12('0x36')](_0x5d4ed5[_0xdf12('0x35')]);_0x5975c8[_0xdf12('0x3d')]=_['intersection'](_0x5975c8['model'],_0x5975c8[_0xdf12('0x35')]);_0x64ae3a[_0xdf12('0x38')]=_[_0xdf12('0x37')](_0x5975c8[_0xdf12('0x33')],qs[_0xdf12('0x39')](_0x5d4ed5[_0xdf12('0x35')]['fields']));_0x64ae3a[_0xdf12('0x38')]=_0x64ae3a[_0xdf12('0x38')][_0xdf12('0x47')]?_0x64ae3a['attributes']:_0x5975c8[_0xdf12('0x33')];if(_0x5d4ed5[_0xdf12('0x35')][_0xdf12('0x48')]){_0x64ae3a[_0xdf12('0x43')]=[{'all':!![]}];}_0x64ae3a=_[_0xdf12('0x40')]({},_0x64ae3a,_0x5d4ed5[_0xdf12('0x42')]);return db[_0xdf12('0x2e')][_0xdf12('0x49')](_0x64ae3a)[_0xdf12('0x16')](handleEntityNotFound(_0x533c16,null))[_0xdf12('0x16')](respondWithResult(_0x533c16,null))[_0xdf12('0x1e')](handleError(_0x533c16,null));};exports[_0xdf12('0x4a')]=function(_0x3ed63b,_0x54573f){return db[_0xdf12('0x2e')][_0xdf12('0x4a')](_0x3ed63b['body'],{})[_0xdf12('0x16')](respondWithResult(_0x54573f,0xc9))[_0xdf12('0x1e')](handleError(_0x54573f,null));};exports[_0xdf12('0x2a')]=function(_0x246227,_0x23c6d4){if(_0x246227[_0xdf12('0x4b')]['id']){delete _0x246227[_0xdf12('0x4b')]['id'];}return db[_0xdf12('0x2e')][_0xdf12('0x49')]({'where':{'id':_0x246227['params']['id']}})[_0xdf12('0x16')](handleEntityNotFound(_0x23c6d4,null))[_0xdf12('0x16')](saveUpdates(_0x246227[_0xdf12('0x4b')],null))['then'](respondWithResult(_0x23c6d4,null))[_0xdf12('0x1e')](handleError(_0x23c6d4,null));};exports[_0xdf12('0x2b')]=function(_0x1309d3,_0x4b5292){return db['SalesforceConfiguration'][_0xdf12('0x49')]({'where':{'id':_0x1309d3[_0xdf12('0x46')]['id']}})[_0xdf12('0x16')](handleEntityNotFound(_0x4b5292,null))[_0xdf12('0x16')](removeEntity(_0x4b5292,null))[_0xdf12('0x1e')](handleError(_0x4b5292,null));};exports['getFields']=function(_0x93d927,_0x431c9b,_0x389eb4){var _0x11115b={};var _0x4a04c3={};var _0xa9e148;var _0x37b898;return db[_0xdf12('0x2e')]['findOne']({'where':{'id':_0x93d927[_0xdf12('0x46')]['id']}})['then'](handleEntityNotFound(_0x431c9b,null))[_0xdf12('0x16')](function(_0x5f274f){if(_0x5f274f){_0xa9e148=_0x5f274f;_0x4a04c3[_0xdf12('0x33')]=_[_0xdf12('0x36')](db[_0xdf12('0x4c')][_0xdf12('0x2f')]);_0x4a04c3['query']=_[_0xdf12('0x36')](_0x93d927[_0xdf12('0x35')]);_0x4a04c3[_0xdf12('0x3d')]=_[_0xdf12('0x37')](_0x4a04c3['model'],_0x4a04c3['query']);_0x11115b['attributes']=_[_0xdf12('0x37')](_0x4a04c3[_0xdf12('0x33')],qs[_0xdf12('0x39')](_0x93d927[_0xdf12('0x35')][_0xdf12('0x39')]));_0x11115b[_0xdf12('0x38')]=_0x11115b[_0xdf12('0x38')][_0xdf12('0x47')]?_0x11115b[_0xdf12('0x38')]:_0x4a04c3[_0xdf12('0x33')];_0x11115b[_0xdf12('0x4d')]=qs[_0xdf12('0x3b')](_0x93d927[_0xdf12('0x35')][_0xdf12('0x3b')]);_0x11115b['where']=qs[_0xdf12('0x3d')](_[_0xdf12('0x3e')](_0x93d927[_0xdf12('0x35')],_0x4a04c3[_0xdf12('0x3d')]));if(_0x93d927[_0xdf12('0x35')][_0xdf12('0x3f')]){_0x11115b[_0xdf12('0x3c')]=_[_0xdf12('0x40')](_0x11115b[_0xdf12('0x3c')],{'$or':_[_0xdf12('0x2d')](_0x11115b[_0xdf12('0x38')],function(_0x533ed4){var _0x5e59d1={};_0x5e59d1[_0x533ed4]={'$like':'%'+_0x93d927[_0xdf12('0x35')][_0xdf12('0x3f')]+'%'};return _0x5e59d1;})});}_0x11115b=_['merge']({},_0x11115b,_0x93d927['options']);return _0xa9e148['getFields'](_0x11115b);}})[_0xdf12('0x16')](function(_0x561b54){if(_0x561b54){_0x37b898=_0x561b54[_0xdf12('0x47')];if(!_0x93d927['query'][_0xdf12('0x3a')](_0xdf12('0x4e'))){_0x11115b[_0xdf12('0x24')]=qs[_0xdf12('0x24')](_0x93d927[_0xdf12('0x35')][_0xdf12('0x24')]);_0x11115b[_0xdf12('0x23')]=qs[_0xdf12('0x23')](_0x93d927[_0xdf12('0x35')][_0xdf12('0x23')]);}return _0xa9e148[_0xdf12('0x4f')](_0x11115b);}})[_0xdf12('0x16')](function(_0x28c23e){if(_0x28c23e){return _0x28c23e?{'count':_0x37b898,'rows':_0x28c23e}:null;}})['then'](respondWithResult(_0x431c9b,null))[_0xdf12('0x1e')](handleError(_0x431c9b,null));};exports[_0xdf12('0x50')]=function(_0x5d4f4b,_0x38c780,_0x2a1dd5){var _0x158cdf={};var _0x2333fa={};var _0x460e52;var _0x150b4a;return db[_0xdf12('0x2e')][_0xdf12('0x51')]({'where':{'id':_0x5d4f4b['params']['id']}})['then'](handleEntityNotFound(_0x38c780,null))['then'](function(_0x3c8d41){if(_0x3c8d41){_0x460e52=_0x3c8d41;_0x2333fa[_0xdf12('0x33')]=_[_0xdf12('0x36')](db[_0xdf12('0x4c')]['rawAttributes']);_0x2333fa[_0xdf12('0x35')]=_[_0xdf12('0x36')](_0x5d4f4b[_0xdf12('0x35')]);_0x2333fa['filters']=_[_0xdf12('0x37')](_0x2333fa[_0xdf12('0x33')],_0x2333fa['query']);_0x158cdf[_0xdf12('0x38')]=_[_0xdf12('0x37')](_0x2333fa['model'],qs['fields'](_0x5d4f4b['query'][_0xdf12('0x39')]));_0x158cdf[_0xdf12('0x38')]=_0x158cdf[_0xdf12('0x38')][_0xdf12('0x47')]?_0x158cdf[_0xdf12('0x38')]:_0x2333fa[_0xdf12('0x33')];_0x158cdf[_0xdf12('0x4d')]=qs[_0xdf12('0x3b')](_0x5d4f4b[_0xdf12('0x35')][_0xdf12('0x3b')]);_0x158cdf[_0xdf12('0x3c')]=qs[_0xdf12('0x3d')](_['pick'](_0x5d4f4b[_0xdf12('0x35')],_0x2333fa[_0xdf12('0x3d')]));if(_0x5d4f4b['query'][_0xdf12('0x3f')]){_0x158cdf[_0xdf12('0x3c')]=_['merge'](_0x158cdf[_0xdf12('0x3c')],{'$or':_[_0xdf12('0x2d')](_0x158cdf['attributes'],function(_0x5bffb2){var _0x2dd4d4={};_0x2dd4d4[_0x5bffb2]={'$like':'%'+_0x5d4f4b[_0xdf12('0x35')][_0xdf12('0x3f')]+'%'};return _0x2dd4d4;})});}_0x158cdf=_[_0xdf12('0x40')]({},_0x158cdf,_0x5d4f4b[_0xdf12('0x42')]);return _0x460e52[_0xdf12('0x50')](_0x158cdf);}})[_0xdf12('0x16')](function(_0x436aeb){if(_0x436aeb){_0x150b4a=_0x436aeb[_0xdf12('0x47')];if(!_0x5d4f4b[_0xdf12('0x35')][_0xdf12('0x3a')]('nolimit')){_0x158cdf[_0xdf12('0x24')]=qs[_0xdf12('0x24')](_0x5d4f4b[_0xdf12('0x35')]['limit']);_0x158cdf['offset']=qs['offset'](_0x5d4f4b[_0xdf12('0x35')][_0xdf12('0x23')]);}return _0x460e52[_0xdf12('0x50')](_0x158cdf);}})[_0xdf12('0x16')](function(_0xee424d){if(_0xee424d){return _0xee424d?{'count':_0x150b4a,'rows':_0xee424d}:null;}})[_0xdf12('0x16')](respondWithResult(_0x38c780,null))[_0xdf12('0x1e')](handleError(_0x38c780,null));};exports[_0xdf12('0x52')]=function(_0x5bfc2e,_0x5ae94c,_0x5e3794){var _0xc00a5f={};var _0x5c0465={};var _0x3743da;var _0x45aa54;return db[_0xdf12('0x2e')][_0xdf12('0x51')]({'where':{'id':_0x5bfc2e[_0xdf12('0x46')]['id']}})[_0xdf12('0x16')](handleEntityNotFound(_0x5ae94c,null))[_0xdf12('0x16')](function(_0x2f3a35){if(_0x2f3a35){_0x3743da=_0x2f3a35;_0x5c0465[_0xdf12('0x33')]=_['keys'](db['SalesforceField'][_0xdf12('0x2f')]);_0x5c0465[_0xdf12('0x35')]=_[_0xdf12('0x36')](_0x5bfc2e[_0xdf12('0x35')]);_0x5c0465[_0xdf12('0x3d')]=_[_0xdf12('0x37')](_0x5c0465[_0xdf12('0x33')],_0x5c0465[_0xdf12('0x35')]);_0xc00a5f['attributes']=_['intersection'](_0x5c0465[_0xdf12('0x33')],qs[_0xdf12('0x39')](_0x5bfc2e[_0xdf12('0x35')][_0xdf12('0x39')]));_0xc00a5f[_0xdf12('0x38')]=_0xc00a5f['attributes'][_0xdf12('0x47')]?_0xc00a5f[_0xdf12('0x38')]:_0x5c0465[_0xdf12('0x33')];_0xc00a5f[_0xdf12('0x4d')]=qs[_0xdf12('0x3b')](_0x5bfc2e[_0xdf12('0x35')][_0xdf12('0x3b')]);_0xc00a5f[_0xdf12('0x3c')]=qs[_0xdf12('0x3d')](_[_0xdf12('0x3e')](_0x5bfc2e[_0xdf12('0x35')],_0x5c0465[_0xdf12('0x3d')]));if(_0x5bfc2e['query'][_0xdf12('0x3f')]){_0xc00a5f[_0xdf12('0x3c')]=_[_0xdf12('0x40')](_0xc00a5f[_0xdf12('0x3c')],{'$or':_[_0xdf12('0x2d')](_0xc00a5f[_0xdf12('0x38')],function(_0x151bdb){var _0x175f9b={};_0x175f9b[_0x151bdb]={'$like':'%'+_0x5bfc2e[_0xdf12('0x35')][_0xdf12('0x3f')]+'%'};return _0x175f9b;})});}_0xc00a5f=_[_0xdf12('0x40')]({},_0xc00a5f,_0x5bfc2e[_0xdf12('0x42')]);return _0x3743da['getDescriptions'](_0xc00a5f);}})['then'](function(_0x17c451){if(_0x17c451){_0x45aa54=_0x17c451['length'];if(!_0x5bfc2e['query'][_0xdf12('0x3a')]('nolimit')){_0xc00a5f[_0xdf12('0x24')]=qs[_0xdf12('0x24')](_0x5bfc2e['query'][_0xdf12('0x24')]);_0xc00a5f['offset']=qs[_0xdf12('0x23')](_0x5bfc2e[_0xdf12('0x35')]['offset']);}return _0x3743da['getDescriptions'](_0xc00a5f);}})[_0xdf12('0x16')](function(_0x2035df){if(_0x2035df){return _0x2035df?{'count':_0x45aa54,'rows':_0x2035df}:null;}})[_0xdf12('0x16')](respondWithResult(_0x5ae94c,null))[_0xdf12('0x1e')](handleError(_0x5ae94c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index c833f13..c7b4551 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 _0xd354=['../../config/logger','api','moment','bluebird','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0xd354,0x16a));var _0x4d35=function(_0x1ec817,_0xb9dc77){_0x1ec817=_0x1ec817-0x0;var _0x25fe72=_0xd354[_0x1ec817];return _0x25fe72;};'use strict';var _=require(_0x4d35('0x0'));var util=require('util');var logger=require(_0x4d35('0x1'))(_0x4d35('0x2'));var moment=require(_0x4d35('0x3'));var BPromise=require(_0x4d35('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4d35('0x5'));var attributes=require(_0x4d35('0x6'));module[_0x4d35('0x7')]=function(_0x52576c,_0x24f122){return _0x52576c[_0x4d35('0x8')](_0x4d35('0x9'),attributes,{'tableName':_0x4d35('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9735=['exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes'];(function(_0x278506,_0x48f274){var _0x1fb3b5=function(_0x138a21){while(--_0x138a21){_0x278506['push'](_0x278506['shift']());}};_0x1fb3b5(++_0x48f274);}(_0x9735,0x11c));var _0x5973=function(_0x1481b8,_0x4521d7){_0x1481b8=_0x1481b8-0x0;var _0x5436c3=_0x9735[_0x1481b8];return _0x5436c3;};'use strict';var _=require(_0x5973('0x0'));var util=require(_0x5973('0x1'));var logger=require(_0x5973('0x2'))('api');var moment=require(_0x5973('0x3'));var BPromise=require(_0x5973('0x4'));var rp=require(_0x5973('0x5'));var fs=require('fs');var path=require(_0x5973('0x6'));var rimraf=require(_0x5973('0x7'));var config=require(_0x5973('0x8'));var attributes=require(_0x5973('0x9'));module[_0x5973('0xa')]=function(_0x344309,_0x3808ef){return _0x344309[_0x5973('0xb')](_0x5973('0xc'),attributes,{'tableName':_0x5973('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 10e89f6..7f06605 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 _0xd7f3=['request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0x4ed6c7,_0x2e6803){var _0x112d0c=function(_0x188c4f){while(--_0x188c4f){_0x4ed6c7['push'](_0x4ed6c7['shift']());}};_0x112d0c(++_0x2e6803);}(_0xd7f3,0x127));var _0x3d7f=function(_0x4e8e68,_0x52a7b8){_0x4e8e68=_0x4e8e68-0x0;var _0x3c1398=_0xd7f3[_0x4e8e68];return _0x3c1398;};'use strict';var _=require(_0x3d7f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3d7f('0x1'));var rs=require(_0x3d7f('0x2'));var fs=require('fs');var Redis=require(_0x3d7f('0x3'));var db=require(_0x3d7f('0x4'))['db'];var utils=require(_0x3d7f('0x5'));var logger=require(_0x3d7f('0x6'))(_0x3d7f('0x7'));var config=require(_0x3d7f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3d7f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57de85,_0x528bac,_0xd77d3d){return new BPromise(function(_0x2b06f4,_0x5e46a3){return client['request'](_0x57de85,_0xd77d3d)[_0x3d7f('0xa')](function(_0x47d950){logger[_0x3d7f('0xb')](_0x3d7f('0xc'),_0x528bac,_0x3d7f('0xd'));logger[_0x3d7f('0xe')](_0x3d7f('0xf'),_0x528bac,_0x3d7f('0xd'),JSON[_0x3d7f('0x10')](_0x47d950));if(_0x47d950[_0x3d7f('0x11')]){if(_0x47d950[_0x3d7f('0x11')][_0x3d7f('0x12')]===0x1f4){logger[_0x3d7f('0x11')](_0x3d7f('0xc'),_0x528bac,_0x47d950[_0x3d7f('0x11')][_0x3d7f('0x13')]);return _0x5e46a3(_0x47d950[_0x3d7f('0x11')][_0x3d7f('0x13')]);}logger[_0x3d7f('0x11')](_0x3d7f('0xc'),_0x528bac,_0x47d950[_0x3d7f('0x11')][_0x3d7f('0x13')]);return _0x2b06f4(_0x47d950['error'][_0x3d7f('0x13')]);}else{logger[_0x3d7f('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x528bac,_0x3d7f('0xd'));_0x2b06f4(_0x47d950[_0x3d7f('0x14')][_0x3d7f('0x13')]);}})[_0x3d7f('0x15')](function(_0x5a0646){logger[_0x3d7f('0x11')](_0x3d7f('0xc'),_0x528bac,_0x5a0646);_0x5e46a3(_0x5a0646);});});} \ No newline at end of file +var _0x5551=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util'];(function(_0x676452,_0x515240){var _0x2a8187=function(_0x512142){while(--_0x512142){_0x676452['push'](_0x676452['shift']());}};_0x2a8187(++_0x515240);}(_0x5551,0x7c));var _0x1555=function(_0xf56aa1,_0x3c9fc6){_0xf56aa1=_0xf56aa1-0x0;var _0x4e1cbd=_0x5551[_0xf56aa1];return _0x4e1cbd;};'use strict';var _=require(_0x1555('0x0'));var util=require(_0x1555('0x1'));var moment=require(_0x1555('0x2'));var BPromise=require(_0x1555('0x3'));var rs=require(_0x1555('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1555('0x5'))['db'];var utils=require(_0x1555('0x6'));var logger=require(_0x1555('0x7'))('rpc');var config=require(_0x1555('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1555('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x163ecc,_0xa5fcc0,_0x796d29){return new BPromise(function(_0x4a0929,_0x2e8a8a){return client[_0x1555('0xa')](_0x163ecc,_0x796d29)['then'](function(_0x22531b){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0xa5fcc0,_0x1555('0xb'));logger['debug'](_0x1555('0xc'),_0xa5fcc0,_0x1555('0xb'),JSON[_0x1555('0xd')](_0x22531b));if(_0x22531b[_0x1555('0xe')]){if(_0x22531b[_0x1555('0xe')][_0x1555('0xf')]===0x1f4){logger['error'](_0x1555('0x10'),_0xa5fcc0,_0x22531b[_0x1555('0xe')][_0x1555('0x11')]);return _0x2e8a8a(_0x22531b['error'][_0x1555('0x11')]);}logger['error'](_0x1555('0x10'),_0xa5fcc0,_0x22531b[_0x1555('0xe')][_0x1555('0x11')]);return _0x4a0929(_0x22531b['error'][_0x1555('0x11')]);}else{logger[_0x1555('0x12')](_0x1555('0x10'),_0xa5fcc0,_0x1555('0xb'));_0x4a0929(_0x22531b[_0x1555('0x13')][_0x1555('0x11')]);}})[_0x1555('0x14')](function(_0x27d4e6){logger[_0x1555('0xe')](_0x1555('0x10'),_0xa5fcc0,_0x27d4e6);_0x2e8a8a(_0x27d4e6);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 690eace..03029d3 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 _0x13c5=['create','put','/:id','delete','exports','multer','../../components/auth/service','./intSalesforceField.controller','get','isAuthenticated','index','show','post'];(function(_0x1f437a,_0x124790){var _0x3fddf3=function(_0x53bbaf){while(--_0x53bbaf){_0x1f437a['push'](_0x1f437a['shift']());}};_0x3fddf3(++_0x124790);}(_0x13c5,0x7a));var _0x513c=function(_0x12aea8,_0x3ed193){_0x12aea8=_0x12aea8-0x0;var _0x43d633=_0x13c5[_0x12aea8];return _0x43d633;};'use strict';var multer=require(_0x513c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x513c('0x1'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x513c('0x2'));router[_0x513c('0x3')]('/',auth[_0x513c('0x4')](),controller[_0x513c('0x5')]);router['get']('/:id',auth[_0x513c('0x4')](),controller[_0x513c('0x6')]);router[_0x513c('0x7')]('/',auth[_0x513c('0x4')](),controller[_0x513c('0x8')]);router[_0x513c('0x9')](_0x513c('0xa'),auth[_0x513c('0x4')](),controller['update']);router[_0x513c('0xb')](_0x513c('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x513c('0xc')]=router; \ No newline at end of file +var _0x349f=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy'];(function(_0x484032,_0x11ce70){var _0xec7c10=function(_0x5af4b3){while(--_0x5af4b3){_0x484032['push'](_0x484032['shift']());}};_0xec7c10(++_0x11ce70);}(_0x349f,0xa8));var _0xf349=function(_0xc49eee,_0x2e0925){_0xc49eee=_0xc49eee-0x0;var _0x171056=_0x349f[_0xc49eee];return _0x171056;};'use strict';var multer=require(_0xf349('0x0'));var util=require(_0xf349('0x1'));var path=require(_0xf349('0x2'));var timeout=require('connect-timeout');var express=require(_0xf349('0x3'));var router=express[_0xf349('0x4')]();var fs_extra=require(_0xf349('0x5'));var auth=require(_0xf349('0x6'));var interaction=require(_0xf349('0x7'));var config=require(_0xf349('0x8'));var controller=require(_0xf349('0x9'));router[_0xf349('0xa')]('/',auth[_0xf349('0xb')](),controller[_0xf349('0xc')]);router['get'](_0xf349('0xd'),auth[_0xf349('0xb')](),controller[_0xf349('0xe')]);router[_0xf349('0xf')]('/',auth[_0xf349('0xb')](),controller[_0xf349('0x10')]);router[_0xf349('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf349('0x12')]);router[_0xf349('0x13')](_0xf349('0xd'),auth[_0xf349('0xb')](),controller[_0xf349('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 3948132..c8f2bd8 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 _0x0713=['variable','customVariable','keyValue','STRING','ENUM','string'];(function(_0xb833b1,_0x1c3d3f){var _0x1ab87a=function(_0x1c9f6c){while(--_0x1c9f6c){_0xb833b1['push'](_0xb833b1['shift']());}};_0x1ab87a(++_0x1c3d3f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x3071('0x0')](_0x3071('0x1'),_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4'),'picklist'),'defaultValue':_0x3071('0x1')},'content':{'type':Sequelize[_0x3071('0x5')]},'key':{'type':Sequelize[_0x3071('0x5')]},'keyType':{'type':Sequelize[_0x3071('0x0')](_0x3071('0x1'),_0x3071('0x2'),_0x3071('0x3'))},'keyContent':{'type':Sequelize[_0x3071('0x5')]},'idField':{'type':Sequelize[_0x3071('0x5')]},'variableName':{'type':Sequelize[_0x3071('0x5')]}}; \ No newline at end of file +var _0xcb91=['string','variable','customVariable','picklist','STRING','ENUM'];(function(_0x2c19be,_0x4810be){var _0x2c7c68=function(_0x4b4dfd){while(--_0x4b4dfd){_0x2c19be['push'](_0x2c19be['shift']());}};_0x2c7c68(++_0x4810be);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2543d6,_0x3a5e78){_0x2543d6=_0x2543d6-0x0;var _0x55213c=_0xcb91[_0x2543d6];return _0x55213c;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x1cb9('0x0')](_0x1cb9('0x1'),_0x1cb9('0x2'),_0x1cb9('0x3'),'keyValue',_0x1cb9('0x4')),'defaultValue':_0x1cb9('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1cb9('0x5')]},'keyType':{'type':Sequelize[_0x1cb9('0x0')]('string',_0x1cb9('0x2'),_0x1cb9('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1cb9('0x5')]},'variableName':{'type':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 467c769..7f69c01 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 _0xeff8=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','type','options','SalesforceField','count','includeAll','include','findAll','rows','catch','show','params','body','update','find','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','keys'];(function(_0x5b88f1,_0x9555f0){var _0x41f6c2=function(_0x306694){while(--_0x306694){_0x5b88f1['push'](_0x5b88f1['shift']());}};_0x41f6c2(++_0x9555f0);}(_0xeff8,0x186));var _0x8eff=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xeff8[_0xac151d];return _0x111dba;};'use strict';var emlformat=require(_0x8eff('0x0'));var rimraf=require(_0x8eff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8eff('0x2'));var rp=require(_0x8eff('0x3'));var moment=require(_0x8eff('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8eff('0x5'));var util=require(_0x8eff('0x6'));var path=require(_0x8eff('0x7'));var sox=require(_0x8eff('0x8'));var csv=require('to-csv');var ejs=require(_0x8eff('0x9'));var fs=require('fs');var fs_extra=require(_0x8eff('0xa'));var _=require(_0x8eff('0xb'));var squel=require(_0x8eff('0xc'));var crypto=require('crypto');var jsforce=require(_0x8eff('0xd'));var deskjs=require(_0x8eff('0xe'));var toCsv=require(_0x8eff('0xf'));var querystring=require(_0x8eff('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8eff('0x11'));var qs=require(_0x8eff('0x12'));var as=require(_0x8eff('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8eff('0x14'))(_0x8eff('0x15'));var utils=require('../../config/utils');var config=require(_0x8eff('0x16'));var licenseUtil=require(_0x8eff('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a399e,_0x45f280){_0x45f280=_0x45f280||0xcc;return function(_0x43c914){if(_0x43c914){return _0x4a399e[_0x8eff('0x18')](_0x45f280);}return _0x4a399e[_0x8eff('0x19')](_0x45f280)[_0x8eff('0x1a')]();};}function respondWithResult(_0x56efdf,_0x3e7c01){_0x3e7c01=_0x3e7c01||0xc8;return function(_0x212a2e){if(_0x212a2e){return _0x56efdf[_0x8eff('0x19')](_0x3e7c01)[_0x8eff('0x1b')](_0x212a2e);}};}function respondWithFilteredResult(_0x228eb1,_0x4cfc91){return function(_0x16202e){if(_0x16202e){var _0xdbb753=_0x16202e['count'],_0x16a4eb=_0x4cfc91[_0x8eff('0x1c')],_0x427902=_0x4cfc91[_0x8eff('0x1c')]+_0x4cfc91[_0x8eff('0x1d')],_0x137344;if(_0x427902>=_0xdbb753){_0x427902=_0xdbb753;_0x137344=0xc8;}else{_0x137344=0xce;}_0x228eb1[_0x8eff('0x19')](_0x137344);return _0x228eb1[_0x8eff('0x1e')](_0x8eff('0x1f'),_0x16a4eb+'-'+_0x427902+'/'+_0xdbb753)[_0x8eff('0x1b')](_0x16202e);}return null;};}function patchUpdates(_0x399d96){return function(_0x1b003c){try{jsonpatch[_0x8eff('0x20')](_0x1b003c,_0x399d96,!![]);}catch(_0x453c7a){return BPromise[_0x8eff('0x21')](_0x453c7a);}return _0x1b003c[_0x8eff('0x22')]();};}function saveUpdates(_0x2a7337,_0xdbb7b5){return function(_0x183a53){if(_0x183a53){return _0x183a53['update'](_0x2a7337)[_0x8eff('0x23')](function(_0x4d3e84){return _0x4d3e84;});}return null;};}function removeEntity(_0x5a2492,_0x1c4ad3){return function(_0x5ea31f){if(_0x5ea31f){return _0x5ea31f[_0x8eff('0x24')]()[_0x8eff('0x23')](function(){_0x5a2492[_0x8eff('0x19')](0xcc)[_0x8eff('0x1a')]();});}};}function handleEntityNotFound(_0x1ee09c,_0x4e891c){return function(_0x179814){if(!_0x179814){_0x1ee09c[_0x8eff('0x18')](0x194);}return _0x179814;};}function handleError(_0x50784c,_0x15b66f){_0x15b66f=_0x15b66f||0x1f4;return function(_0x5ec3d7){logger[_0x8eff('0x25')](_0x5ec3d7[_0x8eff('0x26')]);if(_0x5ec3d7[_0x8eff('0x27')]){delete _0x5ec3d7[_0x8eff('0x27')];}_0x50784c[_0x8eff('0x19')](_0x15b66f)[_0x8eff('0x28')](_0x5ec3d7);};}exports['index']=function(_0x3e1607,_0x323ffa){var _0x15083c={},_0xb88ce9={},_0x45803c={'count':0x0,'rows':[]};var _0x85cccb=_['map'](db['SalesforceField'][_0x8eff('0x29')],function(_0x472b19){return{'name':_0x472b19[_0x8eff('0x2a')],'type':_0x472b19['type'][_0x8eff('0x2b')]};});_0xb88ce9[_0x8eff('0x2c')]=_[_0x8eff('0x2d')](_0x85cccb,_0x8eff('0x27'));_0xb88ce9[_0x8eff('0x2e')]=_[_0x8eff('0x2f')](_0x3e1607[_0x8eff('0x2e')]);_0xb88ce9[_0x8eff('0x30')]=_[_0x8eff('0x31')](_0xb88ce9[_0x8eff('0x2c')],_0xb88ce9[_0x8eff('0x2e')]);_0x15083c[_0x8eff('0x32')]=_['intersection'](_0xb88ce9[_0x8eff('0x2c')],qs[_0x8eff('0x33')](_0x3e1607[_0x8eff('0x2e')][_0x8eff('0x33')]));_0x15083c['attributes']=_0x15083c[_0x8eff('0x32')][_0x8eff('0x34')]?_0x15083c['attributes']:_0xb88ce9['model'];if(!_0x3e1607[_0x8eff('0x2e')][_0x8eff('0x35')]('nolimit')){_0x15083c['limit']=qs['limit'](_0x3e1607[_0x8eff('0x2e')]['limit']);_0x15083c[_0x8eff('0x1c')]=qs['offset'](_0x3e1607[_0x8eff('0x2e')][_0x8eff('0x1c')]);}_0x15083c[_0x8eff('0x36')]=qs[_0x8eff('0x37')](_0x3e1607[_0x8eff('0x2e')][_0x8eff('0x37')]);_0x15083c['where']=qs[_0x8eff('0x30')](_['pick'](_0x3e1607[_0x8eff('0x2e')],_0xb88ce9['filters']),_0x85cccb);if(_0x3e1607[_0x8eff('0x2e')][_0x8eff('0x38')]){_0x15083c[_0x8eff('0x39')]=_[_0x8eff('0x3a')](_0x15083c['where'],{'$or':_[_0x8eff('0x2d')](_0x85cccb,function(_0x170a33){if(_0x170a33[_0x8eff('0x3b')]!=='VIRTUAL'){var _0x475213={};_0x475213[_0x170a33[_0x8eff('0x27')]]={'$like':'%'+_0x3e1607[_0x8eff('0x2e')][_0x8eff('0x38')]+'%'};return _0x475213;}})});}_0x15083c=_[_0x8eff('0x3a')]({},_0x15083c,_0x3e1607[_0x8eff('0x3c')]);var _0x29f68e={'where':_0x15083c[_0x8eff('0x39')]};return db[_0x8eff('0x3d')]['count'](_0x29f68e)['then'](function(_0xf67cf3){_0x45803c[_0x8eff('0x3e')]=_0xf67cf3;if(_0x3e1607[_0x8eff('0x2e')][_0x8eff('0x3f')]){_0x15083c[_0x8eff('0x40')]=[{'all':!![]}];}return db[_0x8eff('0x3d')][_0x8eff('0x41')](_0x15083c);})['then'](function(_0x14cf6e){_0x45803c[_0x8eff('0x42')]=_0x14cf6e;return _0x45803c;})['then'](respondWithFilteredResult(_0x323ffa,_0x15083c))[_0x8eff('0x43')](handleError(_0x323ffa,null));};exports[_0x8eff('0x44')]=function(_0x241b33,_0x18309b){var _0xdc5e2f={'raw':!![],'where':{'id':_0x241b33[_0x8eff('0x45')]['id']}},_0x43dc74={};_0x43dc74[_0x8eff('0x2c')]=_[_0x8eff('0x2f')](db['SalesforceField'][_0x8eff('0x29')]);_0x43dc74[_0x8eff('0x2e')]=_[_0x8eff('0x2f')](_0x241b33[_0x8eff('0x2e')]);_0x43dc74[_0x8eff('0x30')]=_['intersection'](_0x43dc74[_0x8eff('0x2c')],_0x43dc74['query']);_0xdc5e2f[_0x8eff('0x32')]=_[_0x8eff('0x31')](_0x43dc74[_0x8eff('0x2c')],qs[_0x8eff('0x33')](_0x241b33['query'][_0x8eff('0x33')]));_0xdc5e2f[_0x8eff('0x32')]=_0xdc5e2f[_0x8eff('0x32')]['length']?_0xdc5e2f['attributes']:_0x43dc74[_0x8eff('0x2c')];if(_0x241b33[_0x8eff('0x2e')][_0x8eff('0x3f')]){_0xdc5e2f[_0x8eff('0x40')]=[{'all':!![]}];}_0xdc5e2f=_[_0x8eff('0x3a')]({},_0xdc5e2f,_0x241b33['options']);return db[_0x8eff('0x3d')]['find'](_0xdc5e2f)[_0x8eff('0x23')](handleEntityNotFound(_0x18309b,null))[_0x8eff('0x23')](respondWithResult(_0x18309b,null))['catch'](handleError(_0x18309b,null));};exports['create']=function(_0x47ecff,_0x494388){return db['SalesforceField']['create'](_0x47ecff[_0x8eff('0x46')],{})[_0x8eff('0x23')](respondWithResult(_0x494388,0xc9))[_0x8eff('0x43')](handleError(_0x494388,null));};exports[_0x8eff('0x47')]=function(_0x1aa204,_0x190aec){if(_0x1aa204[_0x8eff('0x46')]['id']){delete _0x1aa204[_0x8eff('0x46')]['id'];}return db[_0x8eff('0x3d')][_0x8eff('0x48')]({'where':{'id':_0x1aa204['params']['id']}})[_0x8eff('0x23')](handleEntityNotFound(_0x190aec,null))['then'](saveUpdates(_0x1aa204[_0x8eff('0x46')],null))[_0x8eff('0x23')](respondWithResult(_0x190aec,null))[_0x8eff('0x43')](handleError(_0x190aec,null));};exports[_0x8eff('0x24')]=function(_0x5c491b,_0xecde36){return db[_0x8eff('0x3d')][_0x8eff('0x48')]({'where':{'id':_0x5c491b[_0x8eff('0x45')]['id']}})[_0x8eff('0x23')](handleEntityNotFound(_0xecde36,null))[_0x8eff('0x23')](removeEntity(_0xecde36,null))[_0x8eff('0x43')](handleError(_0xecde36,null));}; \ No newline at end of file +var _0xf494=['fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','save','update','destroy','then','error','stack','name','send','index','map','SalesforceField','fieldName','type','query','filters','intersection','model','attributes'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xf494,0x1c6));var _0x4f49=function(_0x39697d,_0x42b555){_0x39697d=_0x39697d-0x0;var _0xe0c626=_0xf494[_0x39697d];return _0xe0c626;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];function respondWithStatusCode(_0x12527d,_0x4bf89f){_0x4bf89f=_0x4bf89f||0xcc;return function(_0x1e1c37){if(_0x1e1c37){return _0x12527d[_0x4f49('0x19')](_0x4bf89f);}return _0x12527d[_0x4f49('0x1a')](_0x4bf89f)[_0x4f49('0x1b')]();};}function respondWithResult(_0x1a0f1e,_0x2f0131){_0x2f0131=_0x2f0131||0xc8;return function(_0xfdb477){if(_0xfdb477){return _0x1a0f1e['status'](_0x2f0131)[_0x4f49('0x1c')](_0xfdb477);}};}function respondWithFilteredResult(_0x1f2d0d,_0x415e83){return function(_0x5878f4){if(_0x5878f4){var _0x5bdfaf=_0x5878f4['count'],_0x2f0a0d=_0x415e83[_0x4f49('0x1d')],_0x2ecaaa=_0x415e83[_0x4f49('0x1d')]+_0x415e83[_0x4f49('0x1e')],_0x74886e;if(_0x2ecaaa>=_0x5bdfaf){_0x2ecaaa=_0x5bdfaf;_0x74886e=0xc8;}else{_0x74886e=0xce;}_0x1f2d0d['status'](_0x74886e);return _0x1f2d0d['set']('Content-Range',_0x2f0a0d+'-'+_0x2ecaaa+'/'+_0x5bdfaf)['json'](_0x5878f4);}return null;};}function patchUpdates(_0xb2081a){return function(_0x1834f4){try{jsonpatch[_0x4f49('0x1f')](_0x1834f4,_0xb2081a,!![]);}catch(_0x407042){return BPromise['reject'](_0x407042);}return _0x1834f4[_0x4f49('0x20')]();};}function saveUpdates(_0x2aed27,_0x197a49){return function(_0xaab5e7){if(_0xaab5e7){return _0xaab5e7[_0x4f49('0x21')](_0x2aed27)['then'](function(_0x3e7e28){return _0x3e7e28;});}return null;};}function removeEntity(_0x357446,_0x3ae590){return function(_0x53b57d){if(_0x53b57d){return _0x53b57d[_0x4f49('0x22')]()[_0x4f49('0x23')](function(){_0x357446[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x9d30aa,_0x36187b){return function(_0x559d98){if(!_0x559d98){_0x9d30aa['sendStatus'](0x194);}return _0x559d98;};}function handleError(_0x3a947b,_0x429de7){_0x429de7=_0x429de7||0x1f4;return function(_0x4fedbb){logger[_0x4f49('0x24')](_0x4fedbb[_0x4f49('0x25')]);if(_0x4fedbb[_0x4f49('0x26')]){delete _0x4fedbb['name'];}_0x3a947b[_0x4f49('0x1a')](_0x429de7)[_0x4f49('0x27')](_0x4fedbb);};}exports[_0x4f49('0x28')]=function(_0x148153,_0xfefbab){var _0x122404={},_0x4915af={},_0x50c571={'count':0x0,'rows':[]};var _0x239f44=_[_0x4f49('0x29')](db[_0x4f49('0x2a')]['rawAttributes'],function(_0x3cbfbd){return{'name':_0x3cbfbd[_0x4f49('0x2b')],'type':_0x3cbfbd[_0x4f49('0x2c')]['key']};});_0x4915af['model']=_[_0x4f49('0x29')](_0x239f44,_0x4f49('0x26'));_0x4915af[_0x4f49('0x2d')]=_['keys'](_0x148153[_0x4f49('0x2d')]);_0x4915af[_0x4f49('0x2e')]=_[_0x4f49('0x2f')](_0x4915af[_0x4f49('0x30')],_0x4915af[_0x4f49('0x2d')]);_0x122404[_0x4f49('0x31')]=_[_0x4f49('0x2f')](_0x4915af[_0x4f49('0x30')],qs[_0x4f49('0x32')](_0x148153[_0x4f49('0x2d')][_0x4f49('0x32')]));_0x122404[_0x4f49('0x31')]=_0x122404[_0x4f49('0x31')][_0x4f49('0x33')]?_0x122404[_0x4f49('0x31')]:_0x4915af[_0x4f49('0x30')];if(!_0x148153[_0x4f49('0x2d')][_0x4f49('0x34')](_0x4f49('0x35'))){_0x122404['limit']=qs[_0x4f49('0x1e')](_0x148153[_0x4f49('0x2d')][_0x4f49('0x1e')]);_0x122404[_0x4f49('0x1d')]=qs[_0x4f49('0x1d')](_0x148153[_0x4f49('0x2d')][_0x4f49('0x1d')]);}_0x122404[_0x4f49('0x36')]=qs[_0x4f49('0x37')](_0x148153[_0x4f49('0x2d')][_0x4f49('0x37')]);_0x122404[_0x4f49('0x38')]=qs[_0x4f49('0x2e')](_['pick'](_0x148153[_0x4f49('0x2d')],_0x4915af[_0x4f49('0x2e')]),_0x239f44);if(_0x148153[_0x4f49('0x2d')][_0x4f49('0x39')]){_0x122404[_0x4f49('0x38')]=_[_0x4f49('0x3a')](_0x122404[_0x4f49('0x38')],{'$or':_[_0x4f49('0x29')](_0x239f44,function(_0x10bfc4){if(_0x10bfc4[_0x4f49('0x2c')]!==_0x4f49('0x3b')){var _0x141db={};_0x141db[_0x10bfc4[_0x4f49('0x26')]]={'$like':'%'+_0x148153[_0x4f49('0x2d')]['filter']+'%'};return _0x141db;}})});}_0x122404=_[_0x4f49('0x3a')]({},_0x122404,_0x148153[_0x4f49('0x3c')]);var _0x543605={'where':_0x122404[_0x4f49('0x38')]};return db[_0x4f49('0x2a')]['count'](_0x543605)[_0x4f49('0x23')](function(_0x1dd1a6){_0x50c571[_0x4f49('0x3d')]=_0x1dd1a6;if(_0x148153[_0x4f49('0x2d')][_0x4f49('0x3e')]){_0x122404[_0x4f49('0x3f')]=[{'all':!![]}];}return db[_0x4f49('0x2a')]['findAll'](_0x122404);})['then'](function(_0x55960a){_0x50c571[_0x4f49('0x40')]=_0x55960a;return _0x50c571;})[_0x4f49('0x23')](respondWithFilteredResult(_0xfefbab,_0x122404))[_0x4f49('0x41')](handleError(_0xfefbab,null));};exports[_0x4f49('0x42')]=function(_0x1053b2,_0x1ecf6c){var _0x38aff8={'raw':!![],'where':{'id':_0x1053b2[_0x4f49('0x43')]['id']}},_0x23720a={};_0x23720a['model']=_['keys'](db[_0x4f49('0x2a')][_0x4f49('0x44')]);_0x23720a[_0x4f49('0x2d')]=_['keys'](_0x1053b2[_0x4f49('0x2d')]);_0x23720a['filters']=_['intersection'](_0x23720a[_0x4f49('0x30')],_0x23720a[_0x4f49('0x2d')]);_0x38aff8[_0x4f49('0x31')]=_['intersection'](_0x23720a[_0x4f49('0x30')],qs[_0x4f49('0x32')](_0x1053b2['query'][_0x4f49('0x32')]));_0x38aff8['attributes']=_0x38aff8[_0x4f49('0x31')][_0x4f49('0x33')]?_0x38aff8[_0x4f49('0x31')]:_0x23720a['model'];if(_0x1053b2[_0x4f49('0x2d')][_0x4f49('0x3e')]){_0x38aff8[_0x4f49('0x3f')]=[{'all':!![]}];}_0x38aff8=_[_0x4f49('0x3a')]({},_0x38aff8,_0x1053b2[_0x4f49('0x3c')]);return db[_0x4f49('0x2a')][_0x4f49('0x45')](_0x38aff8)[_0x4f49('0x23')](handleEntityNotFound(_0x1ecf6c,null))[_0x4f49('0x23')](respondWithResult(_0x1ecf6c,null))[_0x4f49('0x41')](handleError(_0x1ecf6c,null));};exports['create']=function(_0x26c222,_0x44bf1d){return db['SalesforceField'][_0x4f49('0x46')](_0x26c222['body'],{})[_0x4f49('0x23')](respondWithResult(_0x44bf1d,0xc9))[_0x4f49('0x41')](handleError(_0x44bf1d,null));};exports[_0x4f49('0x21')]=function(_0x300230,_0x4a91ec){if(_0x300230[_0x4f49('0x47')]['id']){delete _0x300230[_0x4f49('0x47')]['id'];}return db[_0x4f49('0x2a')][_0x4f49('0x45')]({'where':{'id':_0x300230[_0x4f49('0x43')]['id']}})[_0x4f49('0x23')](handleEntityNotFound(_0x4a91ec,null))[_0x4f49('0x23')](saveUpdates(_0x300230[_0x4f49('0x47')],null))[_0x4f49('0x23')](respondWithResult(_0x4a91ec,null))[_0x4f49('0x41')](handleError(_0x4a91ec,null));};exports[_0x4f49('0x22')]=function(_0x4482f7,_0x148031){return db[_0x4f49('0x2a')][_0x4f49('0x45')]({'where':{'id':_0x4482f7[_0x4f49('0x43')]['id']}})['then'](handleEntityNotFound(_0x148031,null))['then'](removeEntity(_0x148031,null))[_0x4f49('0x41')](handleError(_0x148031,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index d35b20d..798cdce 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 _0x208d=['bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x57a1cb,_0x2a3f32){var _0x13ca75=function(_0x11fe89){while(--_0x11fe89){_0x57a1cb['push'](_0x57a1cb['shift']());}};_0x13ca75(++_0x2a3f32);}(_0x208d,0xa4));var _0xd208=function(_0x5e6cea,_0x24b02a){_0x5e6cea=_0x5e6cea-0x0;var _0x55a315=_0x208d[_0x5e6cea];return _0x55a315;};'use strict';var _=require(_0xd208('0x0'));var util=require(_0xd208('0x1'));var logger=require(_0xd208('0x2'))(_0xd208('0x3'));var moment=require('moment');var BPromise=require(_0xd208('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd208('0x5'));var rimraf=require(_0xd208('0x6'));var config=require(_0xd208('0x7'));var attributes=require(_0xd208('0x8'));module[_0xd208('0x9')]=function(_0x5de5f5,_0x4250e4){return _0x5de5f5[_0xd208('0xa')](_0xd208('0xb'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xd208('0xc'),'fields':[_0xd208('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcef6=['path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','FieldId','lodash','util','api','moment','request-promise'];(function(_0x45a945,_0x2e8b66){var _0x403af5=function(_0x3a1c80){while(--_0x3a1c80){_0x45a945['push'](_0x45a945['shift']());}};_0x403af5(++_0x2e8b66);}(_0xcef6,0xa3));var _0x6cef=function(_0xc69fda,_0x367f93){_0xc69fda=_0xc69fda-0x0;var _0x721842=_0xcef6[_0xc69fda];return _0x721842;};'use strict';var _=require(_0x6cef('0x0'));var util=require(_0x6cef('0x1'));var logger=require('../../config/logger')(_0x6cef('0x2'));var moment=require(_0x6cef('0x3'));var BPromise=require('bluebird');var rp=require(_0x6cef('0x4'));var fs=require('fs');var path=require(_0x6cef('0x5'));var rimraf=require(_0x6cef('0x6'));var config=require(_0x6cef('0x7'));var attributes=require(_0x6cef('0x8'));module[_0x6cef('0x9')]=function(_0x14a29a,_0xa5775b){return _0x14a29a[_0x6cef('0xa')](_0x6cef('0xb'),attributes,{'tableName':_0x6cef('0xc'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField',_0x6cef('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index f125209..3cbf77a 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 _0xe5b5=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x3ee1fe,_0x59f2a1){_0x3ee1fe=_0x3ee1fe-0x0;var _0x1ae57a=_0xe5b5[_0x3ee1fe];return _0x1ae57a;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var moment=require(_0x5e5b('0x2'));var BPromise=require(_0x5e5b('0x3'));var rs=require(_0x5e5b('0x4'));var fs=require('fs');var Redis=require(_0x5e5b('0x5'));var db=require(_0x5e5b('0x6'))['db'];var utils=require(_0x5e5b('0x7'));var logger=require(_0x5e5b('0x8'))(_0x5e5b('0x9'));var config=require(_0x5e5b('0xa'));var jayson=require(_0x5e5b('0xb'));var client=jayson[_0x5e5b('0xc')][_0x5e5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x545eb3,_0x29db2c,_0xe089b1){return new BPromise(function(_0xcbd478,_0x258414){return client[_0x5e5b('0xe')](_0x545eb3,_0xe089b1)[_0x5e5b('0xf')](function(_0x3a37db){logger[_0x5e5b('0x10')]('SalesforceField,\x20%s,\x20%s',_0x29db2c,_0x5e5b('0x11'));logger['debug'](_0x5e5b('0x12'),_0x29db2c,_0x5e5b('0x11'),JSON[_0x5e5b('0x13')](_0x3a37db));if(_0x3a37db[_0x5e5b('0x14')]){if(_0x3a37db['error']['code']===0x1f4){logger['error'](_0x5e5b('0x15'),_0x29db2c,_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);return _0x258414(_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);}logger[_0x5e5b('0x14')](_0x5e5b('0x15'),_0x29db2c,_0x3a37db['error'][_0x5e5b('0x16')]);return _0xcbd478(_0x3a37db[_0x5e5b('0x14')]['message']);}else{logger[_0x5e5b('0x10')]('SalesforceField,\x20%s,\x20%s',_0x29db2c,'request\x20sent');_0xcbd478(_0x3a37db[_0x5e5b('0x17')][_0x5e5b('0x16')]);}})[_0x5e5b('0x18')](function(_0x5c7148){logger[_0x5e5b('0x14')]('SalesforceField,\x20%s,\x20%s',_0x29db2c,_0x5c7148);_0x258414(_0x5c7148);});});} \ No newline at end of file +var _0xdace=['request\x20sent','debug','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0xdace,0xc5));var _0xedac=function(_0x59ee41,_0xaf7db8){_0x59ee41=_0x59ee41-0x0;var _0x3ecd3e=_0xdace[_0x59ee41];return _0x3ecd3e;};'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']('SalesforceField,\x20%s,\x20%s',_0x4081c6,_0xedac('0xd'));logger[_0xedac('0xe')]('SalesforceField,\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/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 142b675..43aee14 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 _0x14a0=['fs-extra','../../components/auth/service','./intServicenowAccount.controller','get','isAuthenticated','/:id','show','getFields','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x300f57,_0x38bc92){var _0x369a46=function(_0x3ce60e){while(--_0x3ce60e){_0x300f57['push'](_0x300f57['shift']());}};_0x369a46(++_0x38bc92);}(_0x14a0,0x8e));var _0x014a=function(_0x39be6d,_0x3ea26b){_0x39be6d=_0x39be6d-0x0;var _0x31f0a9=_0x14a0[_0x39be6d];return _0x31f0a9;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['get']('/:id/configurations',auth[_0x014a('0x9')](),controller['getConfigurations']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['post']('/',auth[_0x014a('0x9')](),controller[_0x014a('0xd')]);router['post'](_0x014a('0xe'),auth[_0x014a('0x9')](),controller[_0x014a('0xf')]);router[_0x014a('0x10')](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0x11')]);router[_0x014a('0x12')](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0x13')]);module[_0x014a('0x14')]=router; \ No newline at end of file +var _0x8f4c=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports'];(function(_0x30b029,_0x54663a){var _0x3e06da=function(_0x294ba1){while(--_0x294ba1){_0x30b029['push'](_0x30b029['shift']());}};_0x3e06da(++_0x54663a);}(_0x8f4c,0x113));var _0xc8f4=function(_0x2ad71b,_0x4afbb5){_0x2ad71b=_0x2ad71b-0x0;var _0x120cc5=_0x8f4c[_0x2ad71b];return _0x120cc5;};'use strict';var multer=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var path=require(_0xc8f4('0x2'));var timeout=require(_0xc8f4('0x3'));var express=require(_0xc8f4('0x4'));var router=express[_0xc8f4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc8f4('0x6'));var interaction=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var controller=require('./intServicenowAccount.controller');router[_0xc8f4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc8f4('0xa'),auth['isAuthenticated'](),controller[_0xc8f4('0xb')]);router[_0xc8f4('0x9')](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0xe')]);router['get'](_0xc8f4('0xf'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x10')]);router[_0xc8f4('0x11')]('/',auth['isAuthenticated'](),controller[_0xc8f4('0x12')]);router['post'](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x13')]);router[_0xc8f4('0x14')](_0xc8f4('0xa'),auth['isAuthenticated'](),controller[_0xc8f4('0x15')]);router[_0xc8f4('0x16')](_0xc8f4('0xa'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x17')]);module[_0xc8f4('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 413a476..d1642ca 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 _0xc6b2=['username','remoteUri','sequelize','STRING'];(function(_0xd770c1,_0x2bdb89){var _0x548404=function(_0x560d6a){while(--_0x560d6a){_0xd770c1['push'](_0xd770c1['shift']());}};_0x548404(++_0x2bdb89);}(_0xc6b2,0x1a2));var _0x2c6b=function(_0x29ac6b,_0x184514){_0x29ac6b=_0x29ac6b-0x0;var _0x44a29b=_0xc6b2[_0x29ac6b];return _0x44a29b;};'use strict';var Sequelize=require(_0x2c6b('0x0'));module['exports']={'name':{'type':Sequelize[_0x2c6b('0x1')]},'description':{'type':Sequelize[_0x2c6b('0x1')]},'username':{'type':Sequelize[_0x2c6b('0x1')],'unique':_0x2c6b('0x2')},'password':{'type':Sequelize[_0x2c6b('0x1')]},'email':{'type':Sequelize[_0x2c6b('0x1')]},'remoteUri':{'type':Sequelize[_0x2c6b('0x1')],'unique':_0x2c6b('0x3')},'serverUrl':{'type':Sequelize[_0x2c6b('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x98d7=['exports','STRING','username','remoteUri','sequelize'];(function(_0x1c7cf2,_0x40cdb6){var _0x6a2dc7=function(_0x2055c8){while(--_0x2055c8){_0x1c7cf2['push'](_0x1c7cf2['shift']());}};_0x6a2dc7(++_0x40cdb6);}(_0x98d7,0x1b2));var _0x798d=function(_0x3f1d6d,_0x2595b4){_0x3f1d6d=_0x3f1d6d-0x0;var _0x5a9c3d=_0x98d7[_0x3f1d6d];return _0x5a9c3d;};'use strict';var Sequelize=require(_0x798d('0x0'));module[_0x798d('0x1')]={'name':{'type':Sequelize[_0x798d('0x2')]},'description':{'type':Sequelize[_0x798d('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x798d('0x3')},'password':{'type':Sequelize[_0x798d('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x798d('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 127974e..49cfd96 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 _0xdf7a=['sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','send','index','ServicenowAccount','rawAttributes','fieldName','key','keys','query','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','attributes','find','create','body','params','destroy','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','type','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','knowledge','close_code','incident_state','category','parent','caused_by','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','order','calendar_stc','cmdb_ci','active','business_service','priority','sys_domain_path','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','caller_id','approval_set','subcategory','work_notes','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','activity_due','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','internalType','label','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','ServiceNow\x20error:\x20','statusCode','Wrong\x20credentials','boolean','true','False'];(function(_0x30505b,_0x3b6c06){var _0x4f7466=function(_0x1714fe){while(--_0x1714fe){_0x30505b['push'](_0x30505b['shift']());}};_0x4f7466(++_0x3b6c06);}(_0xdf7a,0x18b));var _0xadf7=function(_0x4cedbe,_0x17c16d){_0x4cedbe=_0x4cedbe-0x0;var _0x47aee5=_0xdf7a[_0x4cedbe];return _0x47aee5;};'use strict';var emlformat=require(_0xadf7('0x0'));var rimraf=require(_0xadf7('0x1'));var zipdir=require(_0xadf7('0x2'));var jsonpatch=require(_0xadf7('0x3'));var rp=require(_0xadf7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xadf7('0x5'));var util=require(_0xadf7('0x6'));var path=require(_0xadf7('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xadf7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xadf7('0x9'));var squel=require(_0xadf7('0xa'));var crypto=require(_0xadf7('0xb'));var jsforce=require(_0xadf7('0xc'));var deskjs=require(_0xadf7('0xd'));var toCsv=require('to-csv');var querystring=require(_0xadf7('0xe'));var Papa=require(_0xadf7('0xf'));var Redis=require(_0xadf7('0x10'));var authService=require(_0xadf7('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xadf7('0x12'));var logger=require(_0xadf7('0x13'))(_0xadf7('0x14'));var utils=require(_0xadf7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xadf7('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xadf7('0x17'));var jayson=require('jayson/promise');var client=jayson[_0xadf7('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x519f21,_0x1e9dd0,_0x2a002f,_0x31842c){return new BPromise(function(_0x17f8e2,_0x595cab){var _0x4aa710=_0x31842c||client;return _0x4aa710[_0xadf7('0x19')](_0x519f21,_0x2a002f)[_0xadf7('0x1a')](function(_0x53aa39){logger[_0xadf7('0x1b')](_0xadf7('0x1c'),_0x1e9dd0,_0xadf7('0x1d'));logger[_0xadf7('0x1e')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x1e9dd0,'request\x20sent',JSON[_0xadf7('0x1f')](_0x53aa39));if(_0x53aa39[_0xadf7('0x20')]){if(_0x53aa39[_0xadf7('0x20')][_0xadf7('0x21')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x1e9dd0,_0x53aa39[_0xadf7('0x20')]['message']);return _0x595cab(_0x53aa39[_0xadf7('0x20')][_0xadf7('0x22')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x1e9dd0,_0x53aa39[_0xadf7('0x20')][_0xadf7('0x22')]);return _0x17f8e2(_0x53aa39[_0xadf7('0x20')][_0xadf7('0x22')]);}else{logger[_0xadf7('0x1b')](_0xadf7('0x1c'),_0x1e9dd0,_0xadf7('0x1d'));_0x17f8e2(_0x53aa39['result'][_0xadf7('0x22')]);}})[_0xadf7('0x23')](function(_0x11bbd3){logger[_0xadf7('0x20')](_0xadf7('0x1c'),_0x1e9dd0,_0x11bbd3);_0x595cab(_0x11bbd3);});});}function respondWithStatusCode(_0x567b2a,_0x279488){_0x279488=_0x279488||0xcc;return function(_0x15113c){if(_0x15113c){return _0x567b2a['sendStatus'](_0x279488);}return _0x567b2a[_0xadf7('0x24')](_0x279488)[_0xadf7('0x25')]();};}function respondWithResult(_0x157a37,_0x597caf){_0x597caf=_0x597caf||0xc8;return function(_0x1c4ce9){if(_0x1c4ce9){return _0x157a37['status'](_0x597caf)[_0xadf7('0x26')](_0x1c4ce9);}};}function respondWithFilteredResult(_0x5a564f,_0x1632d2){return function(_0x1b60d3){if(_0x1b60d3){var _0x218e92=_0x1b60d3[_0xadf7('0x27')],_0x29fcdb=_0x1632d2[_0xadf7('0x28')],_0x671d80=_0x1632d2[_0xadf7('0x28')]+_0x1632d2[_0xadf7('0x29')],_0xf7bd67;if(_0x671d80>=_0x218e92){_0x671d80=_0x218e92;_0xf7bd67=0xc8;}else{_0xf7bd67=0xce;}_0x5a564f[_0xadf7('0x24')](_0xf7bd67);return _0x5a564f[_0xadf7('0x2a')](_0xadf7('0x2b'),_0x29fcdb+'-'+_0x671d80+'/'+_0x218e92)['json'](_0x1b60d3);}return null;};}function patchUpdates(_0xd15e96){return function(_0xfd4425){try{jsonpatch[_0xadf7('0x2c')](_0xfd4425,_0xd15e96,!![]);}catch(_0x4d4f9c){return BPromise[_0xadf7('0x2d')](_0x4d4f9c);}return _0xfd4425[_0xadf7('0x2e')]();};}function saveUpdates(_0x3a38cb,_0x4e86d3){return function(_0x22c32c){if(_0x22c32c){return _0x22c32c[_0xadf7('0x2f')](_0x3a38cb)[_0xadf7('0x1a')](function(_0x470169){return _0x470169;});}return null;};}function removeEntity(_0x3b1b7f,_0x4c6c87){return function(_0x56dcbb){if(_0x56dcbb){return _0x56dcbb['destroy']()[_0xadf7('0x1a')](function(){_0x3b1b7f['status'](0xcc)[_0xadf7('0x25')]();});}};}function handleEntityNotFound(_0x571c1c,_0x12a9e9){return function(_0x332dea){if(!_0x332dea){_0x571c1c['sendStatus'](0x194);}return _0x332dea;};}function handleError(_0x1bf9f0,_0x37e158){_0x37e158=_0x37e158||0x1f4;return function(_0x336991){logger['error'](_0x336991[_0xadf7('0x30')]);if(_0x336991[_0xadf7('0x31')]){delete _0x336991['name'];}_0x1bf9f0['status'](_0x37e158)[_0xadf7('0x32')](_0x336991);};}exports[_0xadf7('0x33')]=function(_0x41c6c9,_0x53ada4){var _0x29240f={},_0x443211={},_0x3c5e32={'count':0x0,'rows':[]};var _0x461b0e=_['map'](db[_0xadf7('0x34')][_0xadf7('0x35')],function(_0x5c2a7c){return{'name':_0x5c2a7c[_0xadf7('0x36')],'type':_0x5c2a7c['type'][_0xadf7('0x37')]};});_0x443211['model']=_['map'](_0x461b0e,'name');_0x443211['query']=_[_0xadf7('0x38')](_0x41c6c9[_0xadf7('0x39')]);_0x443211['filters']=_[_0xadf7('0x3a')](_0x443211[_0xadf7('0x3b')],_0x443211[_0xadf7('0x39')]);_0x29240f['attributes']=_[_0xadf7('0x3a')](_0x443211['model'],qs[_0xadf7('0x3c')](_0x41c6c9[_0xadf7('0x39')][_0xadf7('0x3c')]));_0x29240f['attributes']=_0x29240f['attributes'][_0xadf7('0x3d')]?_0x29240f['attributes']:_0x443211[_0xadf7('0x3b')];if(!_0x41c6c9['query'][_0xadf7('0x3e')](_0xadf7('0x3f'))){_0x29240f[_0xadf7('0x29')]=qs[_0xadf7('0x29')](_0x41c6c9[_0xadf7('0x39')]['limit']);_0x29240f[_0xadf7('0x28')]=qs['offset'](_0x41c6c9[_0xadf7('0x39')][_0xadf7('0x28')]);}_0x29240f['order']=qs[_0xadf7('0x40')](_0x41c6c9['query'][_0xadf7('0x40')]);_0x29240f[_0xadf7('0x41')]=qs[_0xadf7('0x42')](_[_0xadf7('0x43')](_0x41c6c9['query'],_0x443211[_0xadf7('0x42')]),_0x461b0e);if(_0x41c6c9[_0xadf7('0x39')][_0xadf7('0x44')]){_0x29240f['where']=_[_0xadf7('0x45')](_0x29240f[_0xadf7('0x41')],{'$or':_[_0xadf7('0x46')](_0x461b0e,function(_0x34407e){if(_0x34407e['type']!==_0xadf7('0x47')){var _0x1ff866={};_0x1ff866[_0x34407e['name']]={'$like':'%'+_0x41c6c9[_0xadf7('0x39')]['filter']+'%'};return _0x1ff866;}})});}_0x29240f=_[_0xadf7('0x45')]({},_0x29240f,_0x41c6c9[_0xadf7('0x48')]);var _0x132241={'where':_0x29240f[_0xadf7('0x41')]};return db['ServicenowAccount'][_0xadf7('0x27')](_0x132241)[_0xadf7('0x1a')](function(_0x755310){_0x3c5e32['count']=_0x755310;if(_0x41c6c9[_0xadf7('0x39')][_0xadf7('0x49')]){_0x29240f[_0xadf7('0x4a')]=[{'all':!![]}];}return db[_0xadf7('0x34')][_0xadf7('0x4b')](_0x29240f);})['then'](function(_0x364322){_0x3c5e32[_0xadf7('0x4c')]=_0x364322;return _0x3c5e32;})[_0xadf7('0x1a')](respondWithFilteredResult(_0x53ada4,_0x29240f))[_0xadf7('0x23')](handleError(_0x53ada4,null));};exports['show']=function(_0x3c3109,_0x26d824){var _0x349894={'raw':![],'where':{'id':_0x3c3109['params']['id']}},_0x2c0c61={};_0x2c0c61[_0xadf7('0x3b')]=_[_0xadf7('0x38')](db[_0xadf7('0x34')][_0xadf7('0x35')]);_0x2c0c61[_0xadf7('0x39')]=_[_0xadf7('0x38')](_0x3c3109[_0xadf7('0x39')]);_0x2c0c61['filters']=_[_0xadf7('0x3a')](_0x2c0c61['model'],_0x2c0c61[_0xadf7('0x39')]);_0x349894['attributes']=_[_0xadf7('0x3a')](_0x2c0c61['model'],qs[_0xadf7('0x3c')](_0x3c3109[_0xadf7('0x39')][_0xadf7('0x3c')]));_0x349894[_0xadf7('0x4d')]=_0x349894[_0xadf7('0x4d')][_0xadf7('0x3d')]?_0x349894['attributes']:_0x2c0c61[_0xadf7('0x3b')];if(_0x3c3109[_0xadf7('0x39')][_0xadf7('0x49')]){_0x349894[_0xadf7('0x4a')]=[{'all':!![]}];}_0x349894=_['merge']({},_0x349894,_0x3c3109[_0xadf7('0x48')]);return db['ServicenowAccount'][_0xadf7('0x4e')](_0x349894)[_0xadf7('0x1a')](handleEntityNotFound(_0x26d824,null))[_0xadf7('0x1a')](respondWithResult(_0x26d824,null))[_0xadf7('0x23')](handleError(_0x26d824,null));};exports[_0xadf7('0x4f')]=function(_0x2936af,_0x53b711){return db[_0xadf7('0x34')][_0xadf7('0x4f')](_0x2936af[_0xadf7('0x50')],{})['then'](respondWithResult(_0x53b711,0xc9))['catch'](handleError(_0x53b711,null));};exports[_0xadf7('0x2f')]=function(_0xe26a35,_0x39dc04){if(_0xe26a35[_0xadf7('0x50')]['id']){delete _0xe26a35[_0xadf7('0x50')]['id'];}return db[_0xadf7('0x34')][_0xadf7('0x4e')]({'where':{'id':_0xe26a35[_0xadf7('0x51')]['id']}})['then'](handleEntityNotFound(_0x39dc04,null))[_0xadf7('0x1a')](saveUpdates(_0xe26a35[_0xadf7('0x50')],null))[_0xadf7('0x1a')](respondWithResult(_0x39dc04,null))[_0xadf7('0x23')](handleError(_0x39dc04,null));};exports[_0xadf7('0x52')]=function(_0x52832f,_0x2b5872){return db['ServicenowAccount']['find']({'where':{'id':_0x52832f[_0xadf7('0x51')]['id']}})[_0xadf7('0x1a')](handleEntityNotFound(_0x2b5872,null))[_0xadf7('0x1a')](removeEntity(_0x2b5872,null))[_0xadf7('0x23')](handleError(_0x2b5872,null));};exports[_0xadf7('0x53')]=function(_0x1e5cfc,_0x35bdfa,_0x4eabfd){var _0x9655ac={};var _0x1aa705={};var _0x36f85f;var _0x52bdaf;return db[_0xadf7('0x34')][_0xadf7('0x54')]({'where':{'id':_0x1e5cfc['params']['id']}})[_0xadf7('0x1a')](handleEntityNotFound(_0x35bdfa,null))[_0xadf7('0x1a')](function(_0x362fd3){if(_0x362fd3){_0x36f85f=_0x362fd3;_0x1aa705[_0xadf7('0x3b')]=_[_0xadf7('0x38')](db['ServicenowConfiguration'][_0xadf7('0x35')]);_0x1aa705[_0xadf7('0x39')]=_[_0xadf7('0x38')](_0x1e5cfc[_0xadf7('0x39')]);_0x1aa705[_0xadf7('0x42')]=_[_0xadf7('0x3a')](_0x1aa705['model'],_0x1aa705['query']);_0x9655ac[_0xadf7('0x4d')]=_[_0xadf7('0x3a')](_0x1aa705[_0xadf7('0x3b')],qs[_0xadf7('0x3c')](_0x1e5cfc[_0xadf7('0x39')][_0xadf7('0x3c')]));_0x9655ac[_0xadf7('0x4d')]=_0x9655ac[_0xadf7('0x4d')][_0xadf7('0x3d')]?_0x9655ac[_0xadf7('0x4d')]:_0x1aa705[_0xadf7('0x3b')];_0x9655ac['order']=qs[_0xadf7('0x40')](_0x1e5cfc[_0xadf7('0x39')][_0xadf7('0x40')]);_0x9655ac['where']=qs[_0xadf7('0x42')](_[_0xadf7('0x43')](_0x1e5cfc[_0xadf7('0x39')],_0x1aa705[_0xadf7('0x42')]));if(_0x1e5cfc[_0xadf7('0x39')][_0xadf7('0x44')]){_0x9655ac[_0xadf7('0x41')]=_[_0xadf7('0x45')](_0x9655ac[_0xadf7('0x41')],{'$or':_['map'](_0x9655ac[_0xadf7('0x4d')],function(_0x4b5a5f){var _0x2f6d44={};_0x2f6d44[_0x4b5a5f]={'$like':'%'+_0x1e5cfc[_0xadf7('0x39')][_0xadf7('0x44')]+'%'};return _0x2f6d44;})});}_0x9655ac=_['merge']({},_0x9655ac,_0x1e5cfc[_0xadf7('0x48')]);return _0x36f85f[_0xadf7('0x53')](_0x9655ac);}})['then'](function(_0x4e2f05){if(_0x4e2f05){_0x52bdaf=_0x4e2f05[_0xadf7('0x3d')];if(!_0x1e5cfc[_0xadf7('0x39')][_0xadf7('0x3e')](_0xadf7('0x3f'))){_0x9655ac[_0xadf7('0x29')]=qs[_0xadf7('0x29')](_0x1e5cfc[_0xadf7('0x39')]['limit']);_0x9655ac[_0xadf7('0x28')]=qs['offset'](_0x1e5cfc[_0xadf7('0x39')][_0xadf7('0x28')]);}return _0x36f85f['getConfigurations'](_0x9655ac);}})[_0xadf7('0x1a')](function(_0xe49340){if(_0xe49340){return _0xe49340?{'count':_0x52bdaf,'rows':_0xe49340}:null;}})[_0xadf7('0x1a')](respondWithResult(_0x35bdfa,null))[_0xadf7('0x23')](handleError(_0x35bdfa,null));};exports[_0xadf7('0x55')]=function(_0xbf1cbc,_0x54e262,_0x20d6e2){if(_0xbf1cbc[_0xadf7('0x50')]['id']){delete _0xbf1cbc[_0xadf7('0x50')]['id'];}return db[_0xadf7('0x34')][_0xadf7('0x54')]({'where':{'id':_0xbf1cbc[_0xadf7('0x51')]['id']}})[_0xadf7('0x1a')](handleEntityNotFound(_0x54e262,null))[_0xadf7('0x1a')](function(_0x3928d7){if(_0x3928d7){_0xbf1cbc['body'][_0xadf7('0x56')]=_0x3928d7['id'];_0xbf1cbc['body'][_0xadf7('0x57')]=integrations[_0xadf7('0x58')](_0xbf1cbc['body'][_0xadf7('0x59')],_0xbf1cbc[_0xadf7('0x50')][_0xadf7('0x5a')]);_0xbf1cbc[_0xadf7('0x50')]['Descriptions']=integrations['getDescriptions'](_0xbf1cbc[_0xadf7('0x50')][_0xadf7('0x59')],_0xbf1cbc[_0xadf7('0x50')][_0xadf7('0x5a')]);return db[_0xadf7('0x5b')]['create'](_0xbf1cbc['body'],{'include':[{'model':db[_0xadf7('0x5c')],'as':_0xadf7('0x57')},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})[_0xadf7('0x1a')](respondWithResult(_0x54e262,null))['catch'](handleError(_0x54e262,null));};exports[_0xadf7('0x5d')]=function(_0x48fb2a,_0x4fc176,_0x36239f){var _0x512909=[_0xadf7('0x5e'),_0xadf7('0x5f'),_0xadf7('0x60'),'subcategory',_0xadf7('0x61'),'notify',_0xadf7('0x62'),'severity',_0xadf7('0x63')];var _0x19c7cb=[_0xadf7('0x64'),_0xadf7('0x5e'),_0xadf7('0x65'),'watch_list','upon_reject',_0xadf7('0x66'),_0xadf7('0x67'),_0xadf7('0x5f'),_0xadf7('0x68'),_0xadf7('0x69'),_0xadf7('0x6a'),_0xadf7('0x6b'),_0xadf7('0x6c'),_0xadf7('0x6d'),_0xadf7('0x6e'),_0xadf7('0x6f'),_0xadf7('0x70'),_0xadf7('0x71'),_0xadf7('0x60'),_0xadf7('0x72'),_0xadf7('0x73'),'closed_at',_0xadf7('0x74'),'delivery_plan','impact',_0xadf7('0x75'),'work_notes_list',_0xadf7('0x76'),_0xadf7('0x77'),_0xadf7('0x78'),'rfc',_0xadf7('0x79'),_0xadf7('0x7a'),'opened_at',_0xadf7('0x7b'),_0xadf7('0x7c'),_0xadf7('0x7d'),_0xadf7('0x7e'),'resolved_at',_0xadf7('0x7f'),_0xadf7('0x80'),_0xadf7('0x81'),_0xadf7('0x82'),'short_description','close_code','correlation_display',_0xadf7('0x83'),_0xadf7('0x84'),_0xadf7('0x85'),_0xadf7('0x86'),'additional_assignee_list',_0xadf7('0x87'),_0xadf7('0x88'),_0xadf7('0x89'),_0xadf7('0x8a'),_0xadf7('0x8b'),_0xadf7('0x8c'),_0xadf7('0x8d'),_0xadf7('0x8e'),_0xadf7('0x8f'),_0xadf7('0x90'),_0xadf7('0x91'),_0xadf7('0x62'),_0xadf7('0x92'),_0xadf7('0x93'),_0xadf7('0x94'),'reassignment_count',_0xadf7('0x95'),_0xadf7('0x96'),_0xadf7('0x97'),_0xadf7('0x98'),_0xadf7('0x99'),_0xadf7('0x9a'),_0xadf7('0x9b'),_0xadf7('0x9c'),_0xadf7('0x9d'),_0xadf7('0x9e'),_0xadf7('0x9f'),_0xadf7('0xa0'),_0xadf7('0xa1'),'correlation_id',_0xadf7('0xa2'),_0xadf7('0x63')];var _0x35fe95='';var _0x271226='';var _0x205f8d=[];var _0x529072='';var _0x1f1632='';var _0x53365b=[];var _0x116f82='';var _0x4340d7='';var _0x4f66a7={};var _0x21d1e0='';return db[_0xadf7('0x34')][_0xadf7('0x54')]({'where':{'id':_0x48fb2a[_0xadf7('0x51')]['id']},'attributes':['id',_0xadf7('0xa3'),_0xadf7('0xa4'),_0xadf7('0xa5'),_0xadf7('0xa6'),_0xadf7('0xa7')]})[_0xadf7('0x1a')](handleEntityNotFound(_0x4fc176,null))[_0xadf7('0x1a')](function(_0x12a558){if(_0x12a558){_0x21d1e0=_0x12a558[_0xadf7('0xa6')];var _0x63817a=_0x21d1e0[_0xadf7('0xa8')](-0x1);if(_0x63817a==='/'){_0x21d1e0=_0x21d1e0[_0xadf7('0xa9')](0x0,_0x21d1e0[_0xadf7('0xaa')](_0x63817a));}_0x4340d7=util[_0xadf7('0xab')](_0xadf7('0xac'),_0x21d1e0);_0x116f82=util[_0xadf7('0xab')](_0xadf7('0xad'),_0x21d1e0);_0x4f66a7={'user':_0x12a558['username'],'pass':_0x12a558['password']};var _0x552221={'method':_0xadf7('0xae'),'uri':_0x4340d7+_0xadf7('0xaf'),'auth':_0x4f66a7,'json':!![]};return rp(_0x552221);}})[_0xadf7('0x1a')](function(_0x9a4a18){if(_0x9a4a18['result']['length']>0x0){_0x35fe95=_0x9a4a18[_0xadf7('0xb0')];}console[_0xadf7('0xb1')](_0xadf7('0xb2'),_0x35fe95);_0x53365b=[];_0x271226=Object[_0xadf7('0xb3')]([],_0x35fe95);_[_0xadf7('0xb4')](_0x271226,function(_0x216530){return!_0x512909['includes'](_0x216530['name']);});_0x271226['forEach'](function(_0x1dbeb6){var _0x1e94cf=createFieldObject(_0x116f82,_0x4f66a7,_0x1dbeb6[_0xadf7('0xb5')],_0x1dbeb6[_0xadf7('0x31')],_0x1dbeb6[_0xadf7('0xb6')],![]);_0x53365b[_0xadf7('0xb7')](_0x1e94cf);});return Promise[_0xadf7('0xb8')](_0x53365b);})['then'](function(_0x3e93c3){_0x205f8d=_0x3e93c3;_0x529072=Object[_0xadf7('0xb3')]([],_0x35fe95);console[_0xadf7('0xb1')]('TCL:\x20_object',_0x35fe95);_[_0xadf7('0xb4')](_0x529072,function(_0x376994){return _0x19c7cb['includes'](_0x376994[_0xadf7('0x31')]);});console[_0xadf7('0xb1')](_0xadf7('0xb9'),_0x529072);_0x53365b=[];_0x529072[_0xadf7('0xba')](function(_0x2abf23){var _0x7ffecd=createFieldObject(_0x116f82,_0x4f66a7,_0x2abf23[_0xadf7('0xb5')],_0x2abf23['name'],_0x2abf23['label'],!![]);_0x53365b[_0xadf7('0xb7')](_0x7ffecd);});return Promise[_0xadf7('0xb8')](_0x53365b);})['then'](function(_0xf7ff86){_0x1f1632=_0xf7ff86;var _0x5539e1=_0x205f8d['concat'](_0x1f1632);return{'count':_0x5539e1[_0xadf7('0x3d')],'rows':_0x5539e1};})[_0xadf7('0x1a')](respondWithResult(_0x4fc176,null))[_0xadf7('0x23')](function(_0x5352db){console['log'](_0xadf7('0xbb')+_0x5352db);var _0x8a0448=_0x48fb2a['query']['test']?0x1f4:_0x5352db[_0xadf7('0xbc')]||0x1f4;logger[_0xadf7('0x20')](_0x5352db[_0xadf7('0x30')]);delete _0x5352db['name'];if(_0x8a0448===0x191){_0x8a0448=0x190;}_0x4fc176[_0xadf7('0x24')](_0x8a0448)[_0xadf7('0x32')](_0x48fb2a[_0xadf7('0x39')]['test']?{'message':_0xadf7('0xbd'),'statusCode':_0x5352db[_0xadf7('0xbc')]}:_0x5352db);});};function createFieldObject(_0x582ecf,_0x548925,_0x546de5,_0x2287f9,_0x132fd2,_0x149ac4){return new Promise(function(_0x241ae6,_0x3fdb15){var _0x20005a={'id':_0x2287f9,'name':_0x132fd2,'custom':_0x149ac4};if(_0x546de5===_0xadf7('0xbe')){_0x20005a[_0xadf7('0x48')]=[{'name':'True','value':_0xadf7('0xbf')},{'name':_0xadf7('0xc0'),'value':'false'}];_0x241ae6(_0x20005a);}else{var _0xf19a30={'method':_0xadf7('0xae'),'uri':_0x582ecf+_0xadf7('0xc1')+_0x2287f9,'auth':_0x548925,'json':!![]};return rp(_0xf19a30)[_0xadf7('0x1a')](function(_0x24d390){var _0x348f12=[];if(_0x24d390[_0xadf7('0xb0')]['length']>0x0){_0x24d390[_0xadf7('0xb0')][_0xadf7('0xba')](function(_0x9bcc66){if(_0x9bcc66[_0xadf7('0xc2')]==='false'){var _0x2afc09={'name':_0x9bcc66[_0xadf7('0xb6')],'value':_0x9bcc66[_0xadf7('0xc3')]};_0x348f12[_0xadf7('0xb7')](_0x2afc09);}});}_0x20005a['options']=_0x348f12;if(_0x20005a['options'][_0xadf7('0x3d')]>0x0){_0x241ae6(_0x20005a);}else{if(_0x149ac4==![]){_0x241ae6();}else{_0x241ae6(_0x20005a);}}});}});} \ No newline at end of file +var _0x9e24=['statusCode','True','true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','value','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','update','destroy','name','index','map','ServicenowAccount','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','getConfigurations','findOne','order','addConfiguration','AccountId','channel','ServicenowConfiguration','ServicenowField','Subjects','getFields','made_sla','knowledge','subcategory','close_code','notify','incident_state','severity','parent','sys_updated_on','hold_reason','number','resolved_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','business_service','priority','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','short_description','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','close_notes','closed_by','follow_up','contact_type','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','email','remoteUri','serverUrl','slice','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','password','incident?sysparm_display_value=all','assign','remove','includes','push','all','log','TCL:\x20_object','forEach','internalType','label','concat','ServiceNow\x20error:\x20','test','stack','send','Wrong\x20credentials'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e24,0xc4));var _0x49e2=function(_0x4907de,_0x5bbdc6){_0x4907de=_0x4907de-0x0;var _0x482054=_0x9e24[_0x4907de];return _0x482054;};'use strict';var emlformat=require(_0x49e2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x49e2('0x1'));var jsonpatch=require(_0x49e2('0x2'));var rp=require('request-promise');var moment=require(_0x49e2('0x3'));var BPromise=require(_0x49e2('0x4'));var Mustache=require(_0x49e2('0x5'));var util=require(_0x49e2('0x6'));var path=require(_0x49e2('0x7'));var sox=require('sox');var csv=require(_0x49e2('0x8'));var ejs=require(_0x49e2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x49e2('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x49e2('0xb'));var toCsv=require(_0x49e2('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x49e2('0xc'));var authService=require(_0x49e2('0xd'));var qs=require(_0x49e2('0xe'));var as=require(_0x49e2('0xf'));var hardwareService=require(_0x49e2('0x10'));var logger=require(_0x49e2('0x11'))(_0x49e2('0x12'));var utils=require(_0x49e2('0x13'));var config=require(_0x49e2('0x14'));var licenseUtil=require(_0x49e2('0x15'));var db=require(_0x49e2('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x49e2('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x91d7b9,_0x324507,_0x591e68,_0x338882){return new BPromise(function(_0xe06e5a,_0xc93a7f){var _0x25192f=_0x338882||client;return _0x25192f[_0x49e2('0x18')](_0x91d7b9,_0x591e68)[_0x49e2('0x19')](function(_0xdceb37){logger[_0x49e2('0x1a')]('ServicenowAccount,\x20%s,\x20%s',_0x324507,_0x49e2('0x1b'));logger[_0x49e2('0x1c')](_0x49e2('0x1d'),_0x324507,_0x49e2('0x1b'),JSON[_0x49e2('0x1e')](_0xdceb37));if(_0xdceb37[_0x49e2('0x1f')]){if(_0xdceb37[_0x49e2('0x1f')][_0x49e2('0x20')]===0x1f4){logger[_0x49e2('0x1f')]('ServicenowAccount,\x20%s,\x20%s',_0x324507,_0xdceb37['error'][_0x49e2('0x21')]);return _0xc93a7f(_0xdceb37[_0x49e2('0x1f')]['message']);}logger[_0x49e2('0x1f')]('ServicenowAccount,\x20%s,\x20%s',_0x324507,_0xdceb37['error'][_0x49e2('0x21')]);return _0xe06e5a(_0xdceb37['error']['message']);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x324507,_0x49e2('0x1b'));_0xe06e5a(_0xdceb37[_0x49e2('0x22')][_0x49e2('0x21')]);}})['catch'](function(_0x14192c){logger[_0x49e2('0x1f')]('ServicenowAccount,\x20%s,\x20%s',_0x324507,_0x14192c);_0xc93a7f(_0x14192c);});});}function respondWithStatusCode(_0x5bdbbd,_0x334e48){_0x334e48=_0x334e48||0xcc;return function(_0xae301){if(_0xae301){return _0x5bdbbd[_0x49e2('0x23')](_0x334e48);}return _0x5bdbbd[_0x49e2('0x24')](_0x334e48)[_0x49e2('0x25')]();};}function respondWithResult(_0x36b70c,_0x30f1a7){_0x30f1a7=_0x30f1a7||0xc8;return function(_0x4f5fd9){if(_0x4f5fd9){return _0x36b70c['status'](_0x30f1a7)[_0x49e2('0x26')](_0x4f5fd9);}};}function respondWithFilteredResult(_0x9a0487,_0x220a03){return function(_0x5c1bfd){if(_0x5c1bfd){var _0xa599a1=_0x5c1bfd['count'],_0x57e4b9=_0x220a03[_0x49e2('0x27')],_0x2dd59b=_0x220a03[_0x49e2('0x27')]+_0x220a03[_0x49e2('0x28')],_0x4fc8fe;if(_0x2dd59b>=_0xa599a1){_0x2dd59b=_0xa599a1;_0x4fc8fe=0xc8;}else{_0x4fc8fe=0xce;}_0x9a0487['status'](_0x4fc8fe);return _0x9a0487['set'](_0x49e2('0x29'),_0x57e4b9+'-'+_0x2dd59b+'/'+_0xa599a1)[_0x49e2('0x26')](_0x5c1bfd);}return null;};}function patchUpdates(_0x4b4269){return function(_0x1a1d7a){try{jsonpatch['apply'](_0x1a1d7a,_0x4b4269,!![]);}catch(_0x1f2005){return BPromise[_0x49e2('0x2a')](_0x1f2005);}return _0x1a1d7a[_0x49e2('0x2b')]();};}function saveUpdates(_0x1b60c4,_0x4f14a6){return function(_0x437701){if(_0x437701){return _0x437701[_0x49e2('0x2c')](_0x1b60c4)['then'](function(_0x1db8dd){return _0x1db8dd;});}return null;};}function removeEntity(_0x4621f4,_0x233e01){return function(_0x2ed05f){if(_0x2ed05f){return _0x2ed05f[_0x49e2('0x2d')]()[_0x49e2('0x19')](function(){_0x4621f4[_0x49e2('0x24')](0xcc)[_0x49e2('0x25')]();});}};}function handleEntityNotFound(_0x1c0e83,_0x43c3a8){return function(_0x5e93a3){if(!_0x5e93a3){_0x1c0e83['sendStatus'](0x194);}return _0x5e93a3;};}function handleError(_0x4cd41c,_0x520c20){_0x520c20=_0x520c20||0x1f4;return function(_0x50dc95){logger[_0x49e2('0x1f')](_0x50dc95['stack']);if(_0x50dc95[_0x49e2('0x2e')]){delete _0x50dc95[_0x49e2('0x2e')];}_0x4cd41c['status'](_0x520c20)['send'](_0x50dc95);};}exports[_0x49e2('0x2f')]=function(_0x3df45d,_0x4d0f2b){var _0x2c4b09={},_0x244537={},_0x5d0f46={'count':0x0,'rows':[]};var _0x426104=_[_0x49e2('0x30')](db[_0x49e2('0x31')]['rawAttributes'],function(_0x55bca4){return{'name':_0x55bca4[_0x49e2('0x32')],'type':_0x55bca4[_0x49e2('0x33')]['key']};});_0x244537['model']=_[_0x49e2('0x30')](_0x426104,_0x49e2('0x2e'));_0x244537[_0x49e2('0x34')]=_[_0x49e2('0x35')](_0x3df45d['query']);_0x244537['filters']=_[_0x49e2('0x36')](_0x244537[_0x49e2('0x37')],_0x244537['query']);_0x2c4b09[_0x49e2('0x38')]=_['intersection'](_0x244537[_0x49e2('0x37')],qs[_0x49e2('0x39')](_0x3df45d['query']['fields']));_0x2c4b09[_0x49e2('0x38')]=_0x2c4b09[_0x49e2('0x38')][_0x49e2('0x3a')]?_0x2c4b09['attributes']:_0x244537['model'];if(!_0x3df45d[_0x49e2('0x34')][_0x49e2('0x3b')](_0x49e2('0x3c'))){_0x2c4b09[_0x49e2('0x28')]=qs[_0x49e2('0x28')](_0x3df45d[_0x49e2('0x34')]['limit']);_0x2c4b09['offset']=qs[_0x49e2('0x27')](_0x3df45d[_0x49e2('0x34')]['offset']);}_0x2c4b09['order']=qs[_0x49e2('0x3d')](_0x3df45d[_0x49e2('0x34')]['sort']);_0x2c4b09[_0x49e2('0x3e')]=qs[_0x49e2('0x3f')](_[_0x49e2('0x40')](_0x3df45d[_0x49e2('0x34')],_0x244537['filters']),_0x426104);if(_0x3df45d[_0x49e2('0x34')][_0x49e2('0x41')]){_0x2c4b09[_0x49e2('0x3e')]=_[_0x49e2('0x42')](_0x2c4b09[_0x49e2('0x3e')],{'$or':_[_0x49e2('0x30')](_0x426104,function(_0x41bf5a){if(_0x41bf5a['type']!==_0x49e2('0x43')){var _0x52caac={};_0x52caac[_0x41bf5a[_0x49e2('0x2e')]]={'$like':'%'+_0x3df45d[_0x49e2('0x34')][_0x49e2('0x41')]+'%'};return _0x52caac;}})});}_0x2c4b09=_[_0x49e2('0x42')]({},_0x2c4b09,_0x3df45d['options']);var _0x55e92f={'where':_0x2c4b09[_0x49e2('0x3e')]};return db[_0x49e2('0x31')][_0x49e2('0x44')](_0x55e92f)['then'](function(_0x5059f1){_0x5d0f46[_0x49e2('0x44')]=_0x5059f1;if(_0x3df45d[_0x49e2('0x34')][_0x49e2('0x45')]){_0x2c4b09[_0x49e2('0x46')]=[{'all':!![]}];}return db[_0x49e2('0x31')][_0x49e2('0x47')](_0x2c4b09);})[_0x49e2('0x19')](function(_0x739a3a){_0x5d0f46['rows']=_0x739a3a;return _0x5d0f46;})[_0x49e2('0x19')](respondWithFilteredResult(_0x4d0f2b,_0x2c4b09))[_0x49e2('0x48')](handleError(_0x4d0f2b,null));};exports[_0x49e2('0x49')]=function(_0x287e4e,_0x31cf4f){var _0xc0d4eb={'raw':![],'where':{'id':_0x287e4e[_0x49e2('0x4a')]['id']}},_0x3b5b30={};_0x3b5b30[_0x49e2('0x37')]=_[_0x49e2('0x35')](db['ServicenowAccount'][_0x49e2('0x4b')]);_0x3b5b30['query']=_[_0x49e2('0x35')](_0x287e4e['query']);_0x3b5b30[_0x49e2('0x3f')]=_[_0x49e2('0x36')](_0x3b5b30[_0x49e2('0x37')],_0x3b5b30[_0x49e2('0x34')]);_0xc0d4eb[_0x49e2('0x38')]=_[_0x49e2('0x36')](_0x3b5b30[_0x49e2('0x37')],qs[_0x49e2('0x39')](_0x287e4e[_0x49e2('0x34')][_0x49e2('0x39')]));_0xc0d4eb[_0x49e2('0x38')]=_0xc0d4eb['attributes'][_0x49e2('0x3a')]?_0xc0d4eb[_0x49e2('0x38')]:_0x3b5b30[_0x49e2('0x37')];if(_0x287e4e['query'][_0x49e2('0x45')]){_0xc0d4eb[_0x49e2('0x46')]=[{'all':!![]}];}_0xc0d4eb=_[_0x49e2('0x42')]({},_0xc0d4eb,_0x287e4e[_0x49e2('0x4c')]);return db[_0x49e2('0x31')][_0x49e2('0x4d')](_0xc0d4eb)['then'](handleEntityNotFound(_0x31cf4f,null))[_0x49e2('0x19')](respondWithResult(_0x31cf4f,null))[_0x49e2('0x48')](handleError(_0x31cf4f,null));};exports[_0x49e2('0x4e')]=function(_0x9e91bf,_0x5e3e18){return db[_0x49e2('0x31')]['create'](_0x9e91bf[_0x49e2('0x4f')],{})[_0x49e2('0x19')](respondWithResult(_0x5e3e18,0xc9))[_0x49e2('0x48')](handleError(_0x5e3e18,null));};exports[_0x49e2('0x2c')]=function(_0x1cc53b,_0x12bc5d){if(_0x1cc53b[_0x49e2('0x4f')]['id']){delete _0x1cc53b[_0x49e2('0x4f')]['id'];}return db[_0x49e2('0x31')][_0x49e2('0x4d')]({'where':{'id':_0x1cc53b['params']['id']}})[_0x49e2('0x19')](handleEntityNotFound(_0x12bc5d,null))['then'](saveUpdates(_0x1cc53b[_0x49e2('0x4f')],null))[_0x49e2('0x19')](respondWithResult(_0x12bc5d,null))['catch'](handleError(_0x12bc5d,null));};exports[_0x49e2('0x2d')]=function(_0x3edf7a,_0x3d92e1){return db[_0x49e2('0x31')]['find']({'where':{'id':_0x3edf7a[_0x49e2('0x4a')]['id']}})[_0x49e2('0x19')](handleEntityNotFound(_0x3d92e1,null))[_0x49e2('0x19')](removeEntity(_0x3d92e1,null))[_0x49e2('0x48')](handleError(_0x3d92e1,null));};exports[_0x49e2('0x50')]=function(_0x535acc,_0x1ae2e3,_0xe4eadb){var _0x152c7b={};var _0x53513e={};var _0x1adc77;var _0x1d8fda;return db[_0x49e2('0x31')][_0x49e2('0x51')]({'where':{'id':_0x535acc['params']['id']}})[_0x49e2('0x19')](handleEntityNotFound(_0x1ae2e3,null))[_0x49e2('0x19')](function(_0x57d120){if(_0x57d120){_0x1adc77=_0x57d120;_0x53513e[_0x49e2('0x37')]=_[_0x49e2('0x35')](db['ServicenowConfiguration'][_0x49e2('0x4b')]);_0x53513e['query']=_[_0x49e2('0x35')](_0x535acc[_0x49e2('0x34')]);_0x53513e[_0x49e2('0x3f')]=_[_0x49e2('0x36')](_0x53513e[_0x49e2('0x37')],_0x53513e[_0x49e2('0x34')]);_0x152c7b[_0x49e2('0x38')]=_[_0x49e2('0x36')](_0x53513e[_0x49e2('0x37')],qs[_0x49e2('0x39')](_0x535acc[_0x49e2('0x34')][_0x49e2('0x39')]));_0x152c7b['attributes']=_0x152c7b[_0x49e2('0x38')][_0x49e2('0x3a')]?_0x152c7b[_0x49e2('0x38')]:_0x53513e['model'];_0x152c7b[_0x49e2('0x52')]=qs[_0x49e2('0x3d')](_0x535acc[_0x49e2('0x34')][_0x49e2('0x3d')]);_0x152c7b[_0x49e2('0x3e')]=qs[_0x49e2('0x3f')](_['pick'](_0x535acc[_0x49e2('0x34')],_0x53513e[_0x49e2('0x3f')]));if(_0x535acc[_0x49e2('0x34')][_0x49e2('0x41')]){_0x152c7b[_0x49e2('0x3e')]=_[_0x49e2('0x42')](_0x152c7b[_0x49e2('0x3e')],{'$or':_[_0x49e2('0x30')](_0x152c7b['attributes'],function(_0x532975){var _0xc73ff9={};_0xc73ff9[_0x532975]={'$like':'%'+_0x535acc['query']['filter']+'%'};return _0xc73ff9;})});}_0x152c7b=_['merge']({},_0x152c7b,_0x535acc['options']);return _0x1adc77[_0x49e2('0x50')](_0x152c7b);}})[_0x49e2('0x19')](function(_0x236319){if(_0x236319){_0x1d8fda=_0x236319[_0x49e2('0x3a')];if(!_0x535acc[_0x49e2('0x34')][_0x49e2('0x3b')]('nolimit')){_0x152c7b['limit']=qs[_0x49e2('0x28')](_0x535acc[_0x49e2('0x34')]['limit']);_0x152c7b[_0x49e2('0x27')]=qs[_0x49e2('0x27')](_0x535acc[_0x49e2('0x34')]['offset']);}return _0x1adc77[_0x49e2('0x50')](_0x152c7b);}})['then'](function(_0x125f7e){if(_0x125f7e){return _0x125f7e?{'count':_0x1d8fda,'rows':_0x125f7e}:null;}})[_0x49e2('0x19')](respondWithResult(_0x1ae2e3,null))[_0x49e2('0x48')](handleError(_0x1ae2e3,null));};exports[_0x49e2('0x53')]=function(_0x350e02,_0x5c1843,_0x47bb5f){if(_0x350e02[_0x49e2('0x4f')]['id']){delete _0x350e02[_0x49e2('0x4f')]['id'];}return db[_0x49e2('0x31')][_0x49e2('0x51')]({'where':{'id':_0x350e02[_0x49e2('0x4a')]['id']}})[_0x49e2('0x19')](handleEntityNotFound(_0x5c1843,null))[_0x49e2('0x19')](function(_0x353281){if(_0x353281){_0x350e02[_0x49e2('0x4f')][_0x49e2('0x54')]=_0x353281['id'];_0x350e02['body']['Subjects']=integrations['getSubjects'](_0x350e02[_0x49e2('0x4f')][_0x49e2('0x55')],_0x350e02[_0x49e2('0x4f')][_0x49e2('0x33')]);_0x350e02[_0x49e2('0x4f')]['Descriptions']=integrations['getDescriptions'](_0x350e02[_0x49e2('0x4f')][_0x49e2('0x55')],_0x350e02['body']['type']);return db[_0x49e2('0x56')][_0x49e2('0x4e')](_0x350e02['body'],{'include':[{'model':db[_0x49e2('0x57')],'as':_0x49e2('0x58')},{'model':db[_0x49e2('0x57')],'as':'Descriptions'}]});}return null;})[_0x49e2('0x19')](respondWithResult(_0x5c1843,null))[_0x49e2('0x48')](handleError(_0x5c1843,null));};exports[_0x49e2('0x59')]=function(_0x531a66,_0x4100b2,_0x3cfae9){var _0x18d286=[_0x49e2('0x5a'),'hold_reason',_0x49e2('0x5b'),_0x49e2('0x5c'),_0x49e2('0x5d'),_0x49e2('0x5e'),_0x49e2('0x5f'),_0x49e2('0x60'),'category'];var _0x2fd2a6=[_0x49e2('0x61'),_0x49e2('0x5a'),'caused_by','watch_list','upon_reject',_0x49e2('0x62'),'child_incidents',_0x49e2('0x63'),'approval_history',_0x49e2('0x64'),_0x49e2('0x65'),'sys_updated_by','opened_by',_0x49e2('0x66'),_0x49e2('0x67'),_0x49e2('0x68'),_0x49e2('0x69'),_0x49e2('0x6a'),_0x49e2('0x5b'),_0x49e2('0x52'),_0x49e2('0x6b'),_0x49e2('0x6c'),_0x49e2('0x6d'),_0x49e2('0x6e'),_0x49e2('0x6f'),'active','work_notes_list',_0x49e2('0x70'),_0x49e2('0x71'),'sys_domain_path','rfc',_0x49e2('0x72'),_0x49e2('0x73'),_0x49e2('0x74'),_0x49e2('0x75'),_0x49e2('0x76'),_0x49e2('0x77'),_0x49e2('0x78'),_0x49e2('0x79'),_0x49e2('0x7a'),_0x49e2('0x7b'),_0x49e2('0x5c'),'work_notes',_0x49e2('0x7c'),_0x49e2('0x5d'),_0x49e2('0x7d'),'delivery_task',_0x49e2('0x7e'),_0x49e2('0x7f'),_0x49e2('0x80'),_0x49e2('0x81'),_0x49e2('0x82'),_0x49e2('0x83'),'notify','sys_class_name',_0x49e2('0x84'),_0x49e2('0x85'),_0x49e2('0x86'),'parent_incident','sys_id',_0x49e2('0x87'),'reopened_by','incident_state','urgency',_0x49e2('0x88'),_0x49e2('0x89'),_0x49e2('0x8a'),_0x49e2('0x8b'),_0x49e2('0x8c'),_0x49e2('0x60'),_0x49e2('0x8d'),_0x49e2('0x8e'),_0x49e2('0x8f'),_0x49e2('0x90'),_0x49e2('0x91'),_0x49e2('0x92'),_0x49e2('0x93'),_0x49e2('0x94'),_0x49e2('0x95'),_0x49e2('0x96'),_0x49e2('0x97'),_0x49e2('0x98'),'category'];var _0x13b072='';var _0xcc0e4d='';var _0x5be629=[];var _0x456de3='';var _0x376352='';var _0x48e337=[];var _0x541f4e='';var _0x50c419='';var _0x5aca8d={};var _0x2e9a6c='';return db[_0x49e2('0x31')]['findOne']({'where':{'id':_0x531a66[_0x49e2('0x4a')]['id']},'attributes':['id',_0x49e2('0x99'),'password',_0x49e2('0x9a'),_0x49e2('0x9b'),_0x49e2('0x9c')]})[_0x49e2('0x19')](handleEntityNotFound(_0x4100b2,null))[_0x49e2('0x19')](function(_0x49e3f3){if(_0x49e3f3){_0x2e9a6c=_0x49e3f3[_0x49e2('0x9b')];var _0x692933=_0x2e9a6c[_0x49e2('0x9d')](-0x1);if(_0x692933==='/'){_0x2e9a6c=_0x2e9a6c['substring'](0x0,_0x2e9a6c[_0x49e2('0x9e')](_0x692933));}_0x50c419=util['format'](_0x49e2('0x9f'),_0x2e9a6c);_0x541f4e=util[_0x49e2('0xa0')](_0x49e2('0xa1'),_0x2e9a6c);_0x5aca8d={'user':_0x49e3f3['username'],'pass':_0x49e3f3[_0x49e2('0xa2')]};var _0x5134a1={'method':'GET','uri':_0x50c419+_0x49e2('0xa3'),'auth':_0x5aca8d,'json':!![]};return rp(_0x5134a1);}})[_0x49e2('0x19')](function(_0x41bc3a){if(_0x41bc3a[_0x49e2('0x22')][_0x49e2('0x3a')]>0x0){_0x13b072=_0x41bc3a[_0x49e2('0x22')];}console['log']('incident\x20table\x20objects',_0x13b072);_0x48e337=[];_0xcc0e4d=Object[_0x49e2('0xa4')]([],_0x13b072);_[_0x49e2('0xa5')](_0xcc0e4d,function(_0x5715b6){return!_0x18d286[_0x49e2('0xa6')](_0x5715b6[_0x49e2('0x2e')]);});_0xcc0e4d['forEach'](function(_0x20f71a){var _0x2633fe=createFieldObject(_0x541f4e,_0x5aca8d,_0x20f71a['internalType'],_0x20f71a[_0x49e2('0x2e')],_0x20f71a['label'],![]);_0x48e337[_0x49e2('0xa7')](_0x2633fe);});return Promise[_0x49e2('0xa8')](_0x48e337);})[_0x49e2('0x19')](function(_0x29bb4c){_0x5be629=_0x29bb4c;_0x456de3=Object[_0x49e2('0xa4')]([],_0x13b072);console[_0x49e2('0xa9')](_0x49e2('0xaa'),_0x13b072);_[_0x49e2('0xa5')](_0x456de3,function(_0x2d8d6a){return _0x2fd2a6[_0x49e2('0xa6')](_0x2d8d6a['name']);});console[_0x49e2('0xa9')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x456de3);_0x48e337=[];_0x456de3[_0x49e2('0xab')](function(_0x28bdaf){var _0x5ce01a=createFieldObject(_0x541f4e,_0x5aca8d,_0x28bdaf[_0x49e2('0xac')],_0x28bdaf[_0x49e2('0x2e')],_0x28bdaf[_0x49e2('0xad')],!![]);_0x48e337['push'](_0x5ce01a);});return Promise[_0x49e2('0xa8')](_0x48e337);})['then'](function(_0x1496ba){_0x376352=_0x1496ba;var _0x22b1b5=_0x5be629[_0x49e2('0xae')](_0x376352);return{'count':_0x22b1b5[_0x49e2('0x3a')],'rows':_0x22b1b5};})[_0x49e2('0x19')](respondWithResult(_0x4100b2,null))[_0x49e2('0x48')](function(_0x1f1708){console['log'](_0x49e2('0xaf')+_0x1f1708);var _0xc8c673=_0x531a66[_0x49e2('0x34')][_0x49e2('0xb0')]?0x1f4:_0x1f1708['statusCode']||0x1f4;logger[_0x49e2('0x1f')](_0x1f1708[_0x49e2('0xb1')]);delete _0x1f1708[_0x49e2('0x2e')];if(_0xc8c673===0x191){_0xc8c673=0x190;}_0x4100b2[_0x49e2('0x24')](_0xc8c673)[_0x49e2('0xb2')](_0x531a66[_0x49e2('0x34')][_0x49e2('0xb0')]?{'message':_0x49e2('0xb3'),'statusCode':_0x1f1708[_0x49e2('0xb4')]}:_0x1f1708);});};function createFieldObject(_0x551490,_0x5cfb77,_0x22f230,_0x3790f5,_0xbd7cc8,_0x23af73){return new Promise(function(_0x3f32b7,_0x5b8fba){var _0x3b43b8={'id':_0x3790f5,'name':_0xbd7cc8,'custom':_0x23af73};if(_0x22f230==='boolean'){_0x3b43b8[_0x49e2('0x4c')]=[{'name':_0x49e2('0xb5'),'value':_0x49e2('0xb6')},{'name':_0x49e2('0xb7'),'value':_0x49e2('0xb8')}];_0x3f32b7(_0x3b43b8);}else{var _0x56de49={'method':_0x49e2('0xb9'),'uri':_0x551490+_0x49e2('0xba')+_0x3790f5,'auth':_0x5cfb77,'json':!![]};return rp(_0x56de49)[_0x49e2('0x19')](function(_0x511bc3){var _0x357a22=[];if(_0x511bc3[_0x49e2('0x22')][_0x49e2('0x3a')]>0x0){_0x511bc3['result'][_0x49e2('0xab')](function(_0x5bb95b){if(_0x5bb95b['inactive']===_0x49e2('0xb8')){var _0x4b4186={'name':_0x5bb95b[_0x49e2('0xad')],'value':_0x5bb95b[_0x49e2('0xbb')]};_0x357a22[_0x49e2('0xa7')](_0x4b4186);}});}_0x3b43b8[_0x49e2('0x4c')]=_0x357a22;if(_0x3b43b8[_0x49e2('0x4c')][_0x49e2('0x3a')]>0x0){_0x3f32b7(_0x3b43b8);}else{if(_0x23af73==![]){_0x3f32b7();}else{_0x3f32b7(_0x3b43b8);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index c32ab37..e99e88b 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 _0xca9e=['bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','../../config/logger','api','moment'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0xca9e,0x136));var _0xeca9=function(_0x206b9f,_0x45718d){_0x206b9f=_0x206b9f-0x0;var _0x3abe55=_0xca9e[_0x206b9f];return _0x3abe55;};'use strict';var _=require(_0xeca9('0x0'));var util=require(_0xeca9('0x1'));var logger=require(_0xeca9('0x2'))(_0xeca9('0x3'));var moment=require(_0xeca9('0x4'));var BPromise=require(_0xeca9('0x5'));var rp=require(_0xeca9('0x6'));var fs=require('fs');var path=require(_0xeca9('0x7'));var rimraf=require(_0xeca9('0x8'));var config=require(_0xeca9('0x9'));var attributes=require(_0xeca9('0xa'));var integrations=require(_0xeca9('0xb'));module[_0xeca9('0xc')]=function(_0x305dc5,_0x483e41){return _0x305dc5[_0xeca9('0xd')](_0xeca9('0xe'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac9d=['bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','../../config/logger','api','moment'];(function(_0x5ef35e,_0x329db7){var _0x4cdc0c=function(_0x20bda0){while(--_0x20bda0){_0x5ef35e['push'](_0x5ef35e['shift']());}};_0x4cdc0c(++_0x329db7);}(_0xac9d,0x14d));var _0xdac9=function(_0x2918fb,_0x1ac725){_0x2918fb=_0x2918fb-0x0;var _0xef01f8=_0xac9d[_0x2918fb];return _0xef01f8;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var logger=require(_0xdac9('0x2'))(_0xdac9('0x3'));var moment=require(_0xdac9('0x4'));var BPromise=require(_0xdac9('0x5'));var rp=require(_0xdac9('0x6'));var fs=require('fs');var path=require(_0xdac9('0x7'));var rimraf=require('rimraf');var config=require(_0xdac9('0x8'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xdac9('0x9'));module[_0xdac9('0xa')]=function(_0x1222bb,_0x776b6c){return _0x1222bb[_0xdac9('0xb')](_0xdac9('0xc'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index b16654a..772de78 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 _0x83ed=['request\x20sent','stringify','error','message','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','include','map','model','catch','find','ShowServicenowAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s'];(function(_0x266aa1,_0x28ea25){var _0x11fbfa=function(_0x21f90f){while(--_0x21f90f){_0x266aa1['push'](_0x266aa1['shift']());}};_0x11fbfa(++_0x28ea25);}(_0x83ed,0xd1));var _0xd83e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x83ed[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xd83e('0x0'));var util=require(_0xd83e('0x1'));var moment=require(_0xd83e('0x2'));var BPromise=require('bluebird');var rs=require(_0xd83e('0x3'));var fs=require('fs');var Redis=require(_0xd83e('0x4'));var db=require(_0xd83e('0x5'))['db'];var utils=require(_0xd83e('0x6'));var logger=require(_0xd83e('0x7'))('rpc');var config=require(_0xd83e('0x8'));var jayson=require(_0xd83e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x18e683,_0x11fe5d,_0x3dad41){return new BPromise(function(_0x5c3f9c,_0x4cb95d){return client['request'](_0x18e683,_0x3dad41)[_0xd83e('0xa')](function(_0x3f5e29){logger[_0xd83e('0xb')](_0xd83e('0xc'),_0x11fe5d,'request\x20sent');logger[_0xd83e('0xd')](_0xd83e('0xe'),_0x11fe5d,_0xd83e('0xf'),JSON[_0xd83e('0x10')](_0x3f5e29));if(_0x3f5e29[_0xd83e('0x11')]){if(_0x3f5e29[_0xd83e('0x11')]['code']===0x1f4){logger[_0xd83e('0x11')](_0xd83e('0xc'),_0x11fe5d,_0x3f5e29['error']['message']);return _0x4cb95d(_0x3f5e29['error'][_0xd83e('0x12')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x11fe5d,_0x3f5e29['error'][_0xd83e('0x12')]);return _0x5c3f9c(_0x3f5e29[_0xd83e('0x11')][_0xd83e('0x12')]);}else{logger[_0xd83e('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x11fe5d,'request\x20sent');_0x5c3f9c(_0x3f5e29['result'][_0xd83e('0x12')]);}})['catch'](function(_0x474ad6){logger[_0xd83e('0x11')](_0xd83e('0xc'),_0x11fe5d,_0x474ad6);_0x4cb95d(_0x474ad6);});});}exports[_0xd83e('0x13')]=function(_0x372d63){var _0x52db37=this;return new Promise(function(_0x1aa65f,_0xf6975b){return db[_0xd83e('0x14')][_0xd83e('0x15')]({'raw':_0x372d63[_0xd83e('0x16')]?_0x372d63['options'][_0xd83e('0x17')]===undefined?!![]:![]:!![],'where':_0x372d63[_0xd83e('0x16')]?_0x372d63['options'][_0xd83e('0x18')]||null:null,'attributes':_0x372d63['options']?_0x372d63[_0xd83e('0x16')][_0xd83e('0x19')]||null:null,'limit':_0x372d63[_0xd83e('0x16')]?_0x372d63[_0xd83e('0x16')]['limit']||null:null,'include':_0x372d63['options']?_0x372d63['options'][_0xd83e('0x1a')]?_[_0xd83e('0x1b')](_0x372d63[_0xd83e('0x16')][_0xd83e('0x1a')],function(_0x22fa70){return{'model':db[_0x22fa70[_0xd83e('0x1c')]],'as':_0x22fa70['as'],'attributes':_0x22fa70['attributes'],'include':_0x22fa70[_0xd83e('0x1a')]?_[_0xd83e('0x1b')](_0x22fa70['include'],function(_0xc7718e){return{'model':db[_0xc7718e[_0xd83e('0x1c')]],'as':_0xc7718e['as'],'attributes':_0xc7718e['attributes'],'include':_0xc7718e[_0xd83e('0x1a')]?_[_0xd83e('0x1b')](_0xc7718e['include'],function(_0xc63865){return{'model':db[_0xc63865['model']],'as':_0xc63865['as'],'attributes':_0xc63865[_0xd83e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1cfca4){logger[_0xd83e('0xb')](_0xd83e('0x13'),_0x372d63);logger[_0xd83e('0xd')](_0xd83e('0x13'),_0x372d63,JSON[_0xd83e('0x10')](_0x1cfca4));_0x1aa65f(_0x1cfca4);})[_0xd83e('0x1d')](function(_0x935732){logger[_0xd83e('0x11')](_0xd83e('0x13'),_0x935732[_0xd83e('0x12')],_0x372d63);_0xf6975b(_0x52db37['error'](0x1f4,_0x935732[_0xd83e('0x12')]));});});};exports['ShowServicenowAccount']=function(_0x1af9e8){var _0x5da497=this;return new Promise(function(_0x35c9ed,_0x55b6ee){return db[_0xd83e('0x14')][_0xd83e('0x1e')]({'raw':_0x1af9e8['options']?_0x1af9e8['options'][_0xd83e('0x17')]===undefined?!![]:![]:!![],'where':_0x1af9e8[_0xd83e('0x16')]?_0x1af9e8[_0xd83e('0x16')][_0xd83e('0x18')]||null:null,'attributes':_0x1af9e8[_0xd83e('0x16')]?_0x1af9e8[_0xd83e('0x16')][_0xd83e('0x19')]||null:null,'include':_0x1af9e8[_0xd83e('0x16')]?_0x1af9e8[_0xd83e('0x16')]['include']?_[_0xd83e('0x1b')](_0x1af9e8[_0xd83e('0x16')]['include'],function(_0x562fff){return{'model':db[_0x562fff['model']],'as':_0x562fff['as'],'attributes':_0x562fff[_0xd83e('0x19')],'include':_0x562fff[_0xd83e('0x1a')]?_[_0xd83e('0x1b')](_0x562fff[_0xd83e('0x1a')],function(_0x5a7254){return{'model':db[_0x5a7254[_0xd83e('0x1c')]],'as':_0x5a7254['as'],'attributes':_0x5a7254['attributes'],'include':_0x5a7254[_0xd83e('0x1a')]?_[_0xd83e('0x1b')](_0x5a7254[_0xd83e('0x1a')],function(_0x46877a){return{'model':db[_0x46877a[_0xd83e('0x1c')]],'as':_0x46877a['as'],'attributes':_0x46877a[_0xd83e('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd83e('0xa')](function(_0x2ecfb3){logger[_0xd83e('0xb')](_0xd83e('0x1f'),_0x1af9e8);logger[_0xd83e('0xd')](_0xd83e('0x1f'),_0x1af9e8,JSON[_0xd83e('0x10')](_0x2ecfb3));_0x35c9ed(_0x2ecfb3);})[_0xd83e('0x1d')](function(_0x4f828e){logger['error'](_0xd83e('0x1f'),_0x4f828e[_0xd83e('0x12')],_0x1af9e8);_0x55b6ee(_0x5da497[_0xd83e('0x11')](0x1f4,_0x4f828e['message']));});});}; \ No newline at end of file +var _0x56e6=['../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowServicenowAccount','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2f8152,_0x27ef67){var _0x1653e1=function(_0x573e26){while(--_0x573e26){_0x2f8152['push'](_0x2f8152['shift']());}};_0x1653e1(++_0x27ef67);}(_0x56e6,0x109));var _0x656e=function(_0x310676,_0x59b568){_0x310676=_0x310676-0x0;var _0x4dbe54=_0x56e6[_0x310676];return _0x4dbe54;};'use strict';var _=require('lodash');var util=require(_0x656e('0x0'));var moment=require('moment');var BPromise=require(_0x656e('0x1'));var rs=require(_0x656e('0x2'));var fs=require('fs');var Redis=require(_0x656e('0x3'));var db=require(_0x656e('0x4'))['db'];var utils=require(_0x656e('0x5'));var logger=require(_0x656e('0x6'))('rpc');var config=require(_0x656e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x656e('0x8')][_0x656e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x87e9ef,_0x5e7ca9,_0x20fcac){return new BPromise(function(_0x12bfa0,_0x195790){return client[_0x656e('0xa')](_0x87e9ef,_0x20fcac)[_0x656e('0xb')](function(_0x154055){logger[_0x656e('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x5e7ca9,_0x656e('0xd'));logger[_0x656e('0xe')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x5e7ca9,'request\x20sent',JSON[_0x656e('0xf')](_0x154055));if(_0x154055['error']){if(_0x154055[_0x656e('0x10')][_0x656e('0x11')]===0x1f4){logger[_0x656e('0x10')](_0x656e('0x12'),_0x5e7ca9,_0x154055[_0x656e('0x10')][_0x656e('0x13')]);return _0x195790(_0x154055[_0x656e('0x10')][_0x656e('0x13')]);}logger[_0x656e('0x10')](_0x656e('0x12'),_0x5e7ca9,_0x154055[_0x656e('0x10')][_0x656e('0x13')]);return _0x12bfa0(_0x154055['error']['message']);}else{logger[_0x656e('0xc')](_0x656e('0x12'),_0x5e7ca9,_0x656e('0xd'));_0x12bfa0(_0x154055['result'][_0x656e('0x13')]);}})[_0x656e('0x14')](function(_0x24b08e){logger[_0x656e('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x5e7ca9,_0x24b08e);_0x195790(_0x24b08e);});});}exports[_0x656e('0x15')]=function(_0x13708a){var _0x2da550=this;return new Promise(function(_0x25a369,_0x352376){return db[_0x656e('0x16')][_0x656e('0x17')]({'raw':_0x13708a['options']?_0x13708a[_0x656e('0x18')][_0x656e('0x19')]===undefined?!![]:![]:!![],'where':_0x13708a['options']?_0x13708a['options'][_0x656e('0x1a')]||null:null,'attributes':_0x13708a['options']?_0x13708a[_0x656e('0x18')]['attributes']||null:null,'limit':_0x13708a[_0x656e('0x18')]?_0x13708a[_0x656e('0x18')][_0x656e('0x1b')]||null:null,'include':_0x13708a[_0x656e('0x18')]?_0x13708a['options'][_0x656e('0x1c')]?_[_0x656e('0x1d')](_0x13708a[_0x656e('0x18')]['include'],function(_0x561193){return{'model':db[_0x561193[_0x656e('0x1e')]],'as':_0x561193['as'],'attributes':_0x561193[_0x656e('0x1f')],'include':_0x561193[_0x656e('0x1c')]?_['map'](_0x561193[_0x656e('0x1c')],function(_0x362f85){return{'model':db[_0x362f85[_0x656e('0x1e')]],'as':_0x362f85['as'],'attributes':_0x362f85[_0x656e('0x1f')],'include':_0x362f85[_0x656e('0x1c')]?_[_0x656e('0x1d')](_0x362f85[_0x656e('0x1c')],function(_0x53d408){return{'model':db[_0x53d408[_0x656e('0x1e')]],'as':_0x53d408['as'],'attributes':_0x53d408['attributes']};}):[]};}):[]};}):[]:[]})[_0x656e('0xb')](function(_0x580f6e){logger['info'](_0x656e('0x15'),_0x13708a);logger[_0x656e('0xe')](_0x656e('0x15'),_0x13708a,JSON[_0x656e('0xf')](_0x580f6e));_0x25a369(_0x580f6e);})[_0x656e('0x14')](function(_0x799bbf){logger[_0x656e('0x10')](_0x656e('0x15'),_0x799bbf[_0x656e('0x13')],_0x13708a);_0x352376(_0x2da550[_0x656e('0x10')](0x1f4,_0x799bbf[_0x656e('0x13')]));});});};exports[_0x656e('0x20')]=function(_0x41984b){var _0x324e0f=this;return new Promise(function(_0x3bbf1a,_0x2af0af){return db['ServicenowAccount'][_0x656e('0x21')]({'raw':_0x41984b['options']?_0x41984b[_0x656e('0x18')][_0x656e('0x19')]===undefined?!![]:![]:!![],'where':_0x41984b[_0x656e('0x18')]?_0x41984b[_0x656e('0x18')][_0x656e('0x1a')]||null:null,'attributes':_0x41984b['options']?_0x41984b[_0x656e('0x18')][_0x656e('0x1f')]||null:null,'include':_0x41984b[_0x656e('0x18')]?_0x41984b['options'][_0x656e('0x1c')]?_[_0x656e('0x1d')](_0x41984b['options'][_0x656e('0x1c')],function(_0x14d21b){return{'model':db[_0x14d21b[_0x656e('0x1e')]],'as':_0x14d21b['as'],'attributes':_0x14d21b[_0x656e('0x1f')],'include':_0x14d21b['include']?_[_0x656e('0x1d')](_0x14d21b['include'],function(_0x23b365){return{'model':db[_0x23b365['model']],'as':_0x23b365['as'],'attributes':_0x23b365[_0x656e('0x1f')],'include':_0x23b365['include']?_['map'](_0x23b365[_0x656e('0x1c')],function(_0x46b887){return{'model':db[_0x46b887[_0x656e('0x1e')]],'as':_0x46b887['as'],'attributes':_0x46b887[_0x656e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x656e('0xb')](function(_0x30e98e){logger[_0x656e('0xc')](_0x656e('0x20'),_0x41984b);logger[_0x656e('0xe')]('ShowServicenowAccount',_0x41984b,JSON[_0x656e('0xf')](_0x30e98e));_0x3bbf1a(_0x30e98e);})[_0x656e('0x14')](function(_0x22bd32){logger[_0x656e('0x10')](_0x656e('0x20'),_0x22bd32[_0x656e('0x13')],_0x41984b);_0x2af0af(_0x324e0f[_0x656e('0x10')](0x1f4,_0x22bd32['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 1e714f1..7a5d3da 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 _0x9830=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','delete','exports','util'];(function(_0xd6d95,_0xc15359){var _0x403deb=function(_0x1d335b){while(--_0x1d335b){_0xd6d95['push'](_0xd6d95['shift']());}};_0x403deb(++_0xc15359);}(_0x9830,0x167));var _0x0983=function(_0x1ee62e,_0x159bb2){_0x1ee62e=_0x1ee62e-0x0;var _0x27c6c8=_0x9830[_0x1ee62e];return _0x27c6c8;};'use strict';var multer=require('multer');var util=require(_0x0983('0x0'));var path=require(_0x0983('0x1'));var timeout=require(_0x0983('0x2'));var express=require(_0x0983('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0983('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0983('0x5'));var controller=require(_0x0983('0x6'));router[_0x0983('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0983('0x7')](_0x0983('0x8'),auth[_0x0983('0x9')](),controller[_0x0983('0xa')]);router[_0x0983('0x7')](_0x0983('0xb'),auth[_0x0983('0x9')](),controller[_0x0983('0xc')]);router[_0x0983('0x7')](_0x0983('0xd'),auth[_0x0983('0x9')](),controller[_0x0983('0xe')]);router[_0x0983('0x7')](_0x0983('0xf'),auth[_0x0983('0x9')](),controller['getDescriptions']);router[_0x0983('0x10')]('/',auth[_0x0983('0x9')](),controller['create']);router[_0x0983('0x11')](_0x0983('0x8'),auth[_0x0983('0x9')](),controller['update']);router[_0x0983('0x12')](_0x0983('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x0983('0x13')]=router; \ No newline at end of file +var _0x2002=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','show'];(function(_0x4996dd,_0x1613fc){var _0x98b206=function(_0x8778b2){while(--_0x8778b2){_0x4996dd['push'](_0x4996dd['shift']());}};_0x98b206(++_0x1613fc);}(_0x2002,0xf0));var _0x2200=function(_0x179b53,_0x31f6fe){_0x179b53=_0x179b53-0x0;var _0x38a146=_0x2002[_0x179b53];return _0x38a146;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2200('0x0'));var timeout=require(_0x2200('0x1'));var express=require(_0x2200('0x2'));var router=express[_0x2200('0x3')]();var fs_extra=require(_0x2200('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2200('0x5'));var config=require(_0x2200('0x6'));var controller=require(_0x2200('0x7'));router[_0x2200('0x8')]('/',auth[_0x2200('0x9')](),controller['index']);router[_0x2200('0x8')](_0x2200('0xa'),auth[_0x2200('0x9')](),controller[_0x2200('0xb')]);router[_0x2200('0x8')](_0x2200('0xc'),auth[_0x2200('0x9')](),controller[_0x2200('0xd')]);router[_0x2200('0x8')](_0x2200('0xe'),auth['isAuthenticated'](),controller[_0x2200('0xf')]);router[_0x2200('0x8')](_0x2200('0x10'),auth[_0x2200('0x9')](),controller['getDescriptions']);router[_0x2200('0x11')]('/',auth[_0x2200('0x9')](),controller[_0x2200('0x12')]);router[_0x2200('0x13')](_0x2200('0xa'),auth[_0x2200('0x9')](),controller['update']);router['delete'](_0x2200('0xa'),auth['isAuthenticated'](),controller[_0x2200('0x14')]);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 28d2651..80368d5 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 _0xa196=['sequelize','exports','STRING'];(function(_0x2a0183,_0x3fc93c){var _0x158c3a=function(_0x57a903){while(--_0x57a903){_0x2a0183['push'](_0x2a0183['shift']());}};_0x158c3a(++_0x3fc93c);}(_0xa196,0x1ad));var _0x6a19=function(_0x19c5b7,_0x5b1cae){_0x19c5b7=_0x19c5b7-0x0;var _0x59a31e=_0xa196[_0x19c5b7];return _0x59a31e;};'use strict';var Sequelize=require(_0x6a19('0x0'));module[_0x6a19('0x1')]={'name':{'type':Sequelize[_0x6a19('0x2')]},'description':{'type':Sequelize[_0x6a19('0x2')]}}; \ No newline at end of file +var _0x9f68=['sequelize','STRING'];(function(_0x436f80,_0x294ae9){var _0x1da5c2=function(_0x1755aa){while(--_0x1755aa){_0x436f80['push'](_0x436f80['shift']());}};_0x1da5c2(++_0x294ae9);}(_0x9f68,0xd4));var _0x89f6=function(_0x387149,_0x1c6953){_0x387149=_0x387149-0x0;var _0x3c0b80=_0x9f68[_0x387149];return _0x3c0b80;};'use strict';var Sequelize=require(_0x89f6('0x0'));module['exports']={'name':{'type':Sequelize[_0x89f6('0x1')]},'description':{'type':Sequelize[_0x89f6('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 3d1c809..9c03386 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 _0xacb1=['name','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','options','ServicenowConfiguration','count','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','getFields','findOne','ServicenowField','hasOwnProperty','getSubjects','order','getDescriptions','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','client','http','request','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','end','offset','limit','status','Content-Range','json','apply','reject','save','update','then','destroy','stack'];(function(_0x382987,_0x58058b){var _0x29eb57=function(_0x646f43){while(--_0x646f43){_0x382987['push'](_0x382987['shift']());}};_0x29eb57(++_0x58058b);}(_0xacb1,0x183));var _0x1acb=function(_0x1970ad,_0x4b5a93){_0x1970ad=_0x1970ad-0x0;var _0x3d9417=_0xacb1[_0x1970ad];return _0x3d9417;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1acb('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1acb('0x1'));var moment=require(_0x1acb('0x2'));var BPromise=require(_0x1acb('0x3'));var Mustache=require(_0x1acb('0x4'));var util=require(_0x1acb('0x5'));var path=require(_0x1acb('0x6'));var sox=require(_0x1acb('0x7'));var csv=require(_0x1acb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1acb('0x9'));var _=require(_0x1acb('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1acb('0xb'));var deskjs=require(_0x1acb('0xc'));var toCsv=require(_0x1acb('0x8'));var querystring=require(_0x1acb('0xd'));var Papa=require(_0x1acb('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1acb('0xf'));var as=require(_0x1acb('0x10'));var hardwareService=require(_0x1acb('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x1acb('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1acb('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x1acb('0x14')][_0x1acb('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x45301c,_0x21aaf6,_0x2d65b0,_0x3cf188){return new BPromise(function(_0x5626f6,_0x2782f6){var _0x3e3078=_0x3cf188||client;return _0x3e3078[_0x1acb('0x16')](_0x45301c,_0x2d65b0)['then'](function(_0x4263d0){logger['info'](_0x1acb('0x17'),_0x21aaf6,_0x1acb('0x18'));logger[_0x1acb('0x19')](_0x1acb('0x1a'),_0x21aaf6,'request\x20sent',JSON[_0x1acb('0x1b')](_0x4263d0));if(_0x4263d0['error']){if(_0x4263d0[_0x1acb('0x1c')][_0x1acb('0x1d')]===0x1f4){logger[_0x1acb('0x1c')](_0x1acb('0x17'),_0x21aaf6,_0x4263d0[_0x1acb('0x1c')][_0x1acb('0x1e')]);return _0x2782f6(_0x4263d0[_0x1acb('0x1c')][_0x1acb('0x1e')]);}logger[_0x1acb('0x1c')](_0x1acb('0x17'),_0x21aaf6,_0x4263d0['error'][_0x1acb('0x1e')]);return _0x5626f6(_0x4263d0[_0x1acb('0x1c')]['message']);}else{logger[_0x1acb('0x1f')](_0x1acb('0x17'),_0x21aaf6,_0x1acb('0x18'));_0x5626f6(_0x4263d0[_0x1acb('0x20')]['message']);}})[_0x1acb('0x21')](function(_0x35b18d){logger['error'](_0x1acb('0x17'),_0x21aaf6,_0x35b18d);_0x2782f6(_0x35b18d);});});}function respondWithStatusCode(_0xa50c72,_0x517c6a){_0x517c6a=_0x517c6a||0xcc;return function(_0x21844b){if(_0x21844b){return _0xa50c72[_0x1acb('0x22')](_0x517c6a);}return _0xa50c72['status'](_0x517c6a)[_0x1acb('0x23')]();};}function respondWithResult(_0x2b0fde,_0xdfec6c){_0xdfec6c=_0xdfec6c||0xc8;return function(_0x5bd163){if(_0x5bd163){return _0x2b0fde['status'](_0xdfec6c)['json'](_0x5bd163);}};}function respondWithFilteredResult(_0x2443e9,_0x4e82fd){return function(_0x365898){if(_0x365898){var _0x2181a6=_0x365898['count'],_0x212aed=_0x4e82fd[_0x1acb('0x24')],_0x5de280=_0x4e82fd[_0x1acb('0x24')]+_0x4e82fd[_0x1acb('0x25')],_0x4c1ad0;if(_0x5de280>=_0x2181a6){_0x5de280=_0x2181a6;_0x4c1ad0=0xc8;}else{_0x4c1ad0=0xce;}_0x2443e9[_0x1acb('0x26')](_0x4c1ad0);return _0x2443e9['set'](_0x1acb('0x27'),_0x212aed+'-'+_0x5de280+'/'+_0x2181a6)[_0x1acb('0x28')](_0x365898);}return null;};}function patchUpdates(_0x473f30){return function(_0x1beedc){try{jsonpatch[_0x1acb('0x29')](_0x1beedc,_0x473f30,!![]);}catch(_0x5c0c93){return BPromise[_0x1acb('0x2a')](_0x5c0c93);}return _0x1beedc[_0x1acb('0x2b')]();};}function saveUpdates(_0x5c0c1c,_0x2b5887){return function(_0x38efe0){if(_0x38efe0){return _0x38efe0[_0x1acb('0x2c')](_0x5c0c1c)[_0x1acb('0x2d')](function(_0x586d9c){return _0x586d9c;});}return null;};}function removeEntity(_0x3d3303,_0x173d02){return function(_0x86895){if(_0x86895){return _0x86895[_0x1acb('0x2e')]()[_0x1acb('0x2d')](function(){_0x3d3303[_0x1acb('0x26')](0xcc)[_0x1acb('0x23')]();});}};}function handleEntityNotFound(_0x220614,_0x55c674){return function(_0xb75b7c){if(!_0xb75b7c){_0x220614[_0x1acb('0x22')](0x194);}return _0xb75b7c;};}function handleError(_0x55d845,_0x21206b){_0x21206b=_0x21206b||0x1f4;return function(_0x24f0d6){logger[_0x1acb('0x1c')](_0x24f0d6[_0x1acb('0x2f')]);if(_0x24f0d6[_0x1acb('0x30')]){delete _0x24f0d6[_0x1acb('0x30')];}_0x55d845['status'](_0x21206b)['send'](_0x24f0d6);};}exports['index']=function(_0x5b4f5b,_0x13fca5){var _0x2b533c={},_0x462ea7={},_0x4c9245={'count':0x0,'rows':[]};var _0x5d7bf7=_[_0x1acb('0x31')](db['ServicenowConfiguration']['rawAttributes'],function(_0x86dac6){return{'name':_0x86dac6[_0x1acb('0x32')],'type':_0x86dac6[_0x1acb('0x33')][_0x1acb('0x34')]};});_0x462ea7[_0x1acb('0x35')]=_[_0x1acb('0x31')](_0x5d7bf7,'name');_0x462ea7[_0x1acb('0x36')]=_[_0x1acb('0x37')](_0x5b4f5b[_0x1acb('0x36')]);_0x462ea7['filters']=_['intersection'](_0x462ea7[_0x1acb('0x35')],_0x462ea7[_0x1acb('0x36')]);_0x2b533c['attributes']=_[_0x1acb('0x38')](_0x462ea7[_0x1acb('0x35')],qs[_0x1acb('0x39')](_0x5b4f5b[_0x1acb('0x36')][_0x1acb('0x39')]));_0x2b533c[_0x1acb('0x3a')]=_0x2b533c[_0x1acb('0x3a')][_0x1acb('0x3b')]?_0x2b533c[_0x1acb('0x3a')]:_0x462ea7[_0x1acb('0x35')];if(!_0x5b4f5b[_0x1acb('0x36')]['hasOwnProperty'](_0x1acb('0x3c'))){_0x2b533c['limit']=qs[_0x1acb('0x25')](_0x5b4f5b[_0x1acb('0x36')][_0x1acb('0x25')]);_0x2b533c['offset']=qs['offset'](_0x5b4f5b[_0x1acb('0x36')][_0x1acb('0x24')]);}_0x2b533c['order']=qs[_0x1acb('0x3d')](_0x5b4f5b[_0x1acb('0x36')][_0x1acb('0x3d')]);_0x2b533c[_0x1acb('0x3e')]=qs[_0x1acb('0x3f')](_[_0x1acb('0x40')](_0x5b4f5b[_0x1acb('0x36')],_0x462ea7['filters']),_0x5d7bf7);if(_0x5b4f5b[_0x1acb('0x36')][_0x1acb('0x41')]){_0x2b533c['where']=_[_0x1acb('0x42')](_0x2b533c[_0x1acb('0x3e')],{'$or':_['map'](_0x5d7bf7,function(_0x248175){if(_0x248175['type']!=='VIRTUAL'){var _0x29f6f1={};_0x29f6f1[_0x248175[_0x1acb('0x30')]]={'$like':'%'+_0x5b4f5b['query'][_0x1acb('0x41')]+'%'};return _0x29f6f1;}})});}_0x2b533c=_[_0x1acb('0x42')]({},_0x2b533c,_0x5b4f5b[_0x1acb('0x43')]);var _0x19cd2c={'where':_0x2b533c['where']};return db[_0x1acb('0x44')][_0x1acb('0x45')](_0x19cd2c)['then'](function(_0x1248b5){_0x4c9245['count']=_0x1248b5;if(_0x5b4f5b[_0x1acb('0x36')][_0x1acb('0x46')]){_0x2b533c[_0x1acb('0x47')]=[{'all':!![]}];}return db[_0x1acb('0x44')][_0x1acb('0x48')](_0x2b533c);})[_0x1acb('0x2d')](function(_0x1bb249){_0x4c9245[_0x1acb('0x49')]=_0x1bb249;return _0x4c9245;})[_0x1acb('0x2d')](respondWithFilteredResult(_0x13fca5,_0x2b533c))['catch'](handleError(_0x13fca5,null));};exports[_0x1acb('0x4a')]=function(_0x29cbb1,_0x3b58c4){var _0x5b9c92={'raw':![],'where':{'id':_0x29cbb1[_0x1acb('0x4b')]['id']}},_0x5a81d2={};_0x5a81d2['model']=_['keys'](db['ServicenowConfiguration'][_0x1acb('0x4c')]);_0x5a81d2[_0x1acb('0x36')]=_[_0x1acb('0x37')](_0x29cbb1[_0x1acb('0x36')]);_0x5a81d2[_0x1acb('0x3f')]=_[_0x1acb('0x38')](_0x5a81d2[_0x1acb('0x35')],_0x5a81d2['query']);_0x5b9c92['attributes']=_[_0x1acb('0x38')](_0x5a81d2['model'],qs[_0x1acb('0x39')](_0x29cbb1[_0x1acb('0x36')]['fields']));_0x5b9c92['attributes']=_0x5b9c92['attributes']['length']?_0x5b9c92[_0x1acb('0x3a')]:_0x5a81d2[_0x1acb('0x35')];if(_0x29cbb1['query'][_0x1acb('0x46')]){_0x5b9c92['include']=[{'all':!![]}];}_0x5b9c92=_[_0x1acb('0x42')]({},_0x5b9c92,_0x29cbb1['options']);return db[_0x1acb('0x44')][_0x1acb('0x4d')](_0x5b9c92)[_0x1acb('0x2d')](handleEntityNotFound(_0x3b58c4,null))[_0x1acb('0x2d')](respondWithResult(_0x3b58c4,null))[_0x1acb('0x21')](handleError(_0x3b58c4,null));};exports[_0x1acb('0x4e')]=function(_0x25b667,_0x45dca7){return db['ServicenowConfiguration'][_0x1acb('0x4e')](_0x25b667['body'],{})[_0x1acb('0x2d')](respondWithResult(_0x45dca7,0xc9))[_0x1acb('0x21')](handleError(_0x45dca7,null));};exports[_0x1acb('0x2c')]=function(_0x453bac,_0x1e04f1){if(_0x453bac[_0x1acb('0x4f')]['id']){delete _0x453bac[_0x1acb('0x4f')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x453bac[_0x1acb('0x4b')]['id']}})[_0x1acb('0x2d')](handleEntityNotFound(_0x1e04f1,null))[_0x1acb('0x2d')](saveUpdates(_0x453bac[_0x1acb('0x4f')],null))[_0x1acb('0x2d')](respondWithResult(_0x1e04f1,null))[_0x1acb('0x21')](handleError(_0x1e04f1,null));};exports[_0x1acb('0x2e')]=function(_0x3f9fdc,_0xe4c26e){return db['ServicenowConfiguration'][_0x1acb('0x4d')]({'where':{'id':_0x3f9fdc[_0x1acb('0x4b')]['id']}})[_0x1acb('0x2d')](handleEntityNotFound(_0xe4c26e,null))[_0x1acb('0x2d')](removeEntity(_0xe4c26e,null))[_0x1acb('0x21')](handleError(_0xe4c26e,null));};exports[_0x1acb('0x50')]=function(_0x4b44a1,_0x356cd4,_0x51e021){var _0x2b8252={};var _0x141313={};var _0x502b09;var _0x56464c;return db['ServicenowConfiguration'][_0x1acb('0x51')]({'where':{'id':_0x4b44a1[_0x1acb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x356cd4,null))[_0x1acb('0x2d')](function(_0x2965d7){if(_0x2965d7){_0x502b09=_0x2965d7;_0x141313[_0x1acb('0x35')]=_[_0x1acb('0x37')](db[_0x1acb('0x52')][_0x1acb('0x4c')]);_0x141313[_0x1acb('0x36')]=_[_0x1acb('0x37')](_0x4b44a1[_0x1acb('0x36')]);_0x141313['filters']=_[_0x1acb('0x38')](_0x141313[_0x1acb('0x35')],_0x141313['query']);_0x2b8252[_0x1acb('0x3a')]=_[_0x1acb('0x38')](_0x141313[_0x1acb('0x35')],qs[_0x1acb('0x39')](_0x4b44a1[_0x1acb('0x36')]['fields']));_0x2b8252['attributes']=_0x2b8252['attributes'][_0x1acb('0x3b')]?_0x2b8252[_0x1acb('0x3a')]:_0x141313[_0x1acb('0x35')];_0x2b8252['order']=qs['sort'](_0x4b44a1[_0x1acb('0x36')][_0x1acb('0x3d')]);_0x2b8252[_0x1acb('0x3e')]=qs[_0x1acb('0x3f')](_[_0x1acb('0x40')](_0x4b44a1[_0x1acb('0x36')],_0x141313['filters']));if(_0x4b44a1['query'][_0x1acb('0x41')]){_0x2b8252[_0x1acb('0x3e')]=_[_0x1acb('0x42')](_0x2b8252[_0x1acb('0x3e')],{'$or':_[_0x1acb('0x31')](_0x2b8252[_0x1acb('0x3a')],function(_0x354e3e){var _0x2d46c5={};_0x2d46c5[_0x354e3e]={'$like':'%'+_0x4b44a1[_0x1acb('0x36')][_0x1acb('0x41')]+'%'};return _0x2d46c5;})});}_0x2b8252=_['merge']({},_0x2b8252,_0x4b44a1[_0x1acb('0x43')]);return _0x502b09[_0x1acb('0x50')](_0x2b8252);}})[_0x1acb('0x2d')](function(_0x3d1f65){if(_0x3d1f65){_0x56464c=_0x3d1f65[_0x1acb('0x3b')];if(!_0x4b44a1[_0x1acb('0x36')][_0x1acb('0x53')]('nolimit')){_0x2b8252[_0x1acb('0x25')]=qs['limit'](_0x4b44a1[_0x1acb('0x36')][_0x1acb('0x25')]);_0x2b8252['offset']=qs[_0x1acb('0x24')](_0x4b44a1['query'][_0x1acb('0x24')]);}return _0x502b09[_0x1acb('0x50')](_0x2b8252);}})[_0x1acb('0x2d')](function(_0x19c609){if(_0x19c609){return _0x19c609?{'count':_0x56464c,'rows':_0x19c609}:null;}})[_0x1acb('0x2d')](respondWithResult(_0x356cd4,null))[_0x1acb('0x21')](handleError(_0x356cd4,null));};exports[_0x1acb('0x54')]=function(_0x325247,_0x1411a7,_0x5bb7f7){var _0x3b17ac={};var _0x218004={};var _0x11d1a2;var _0x345aac;return db[_0x1acb('0x44')]['findOne']({'where':{'id':_0x325247[_0x1acb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1411a7,null))['then'](function(_0xa20f50){if(_0xa20f50){_0x11d1a2=_0xa20f50;_0x218004[_0x1acb('0x35')]=_[_0x1acb('0x37')](db[_0x1acb('0x52')][_0x1acb('0x4c')]);_0x218004[_0x1acb('0x36')]=_[_0x1acb('0x37')](_0x325247['query']);_0x218004[_0x1acb('0x3f')]=_['intersection'](_0x218004['model'],_0x218004[_0x1acb('0x36')]);_0x3b17ac['attributes']=_['intersection'](_0x218004[_0x1acb('0x35')],qs['fields'](_0x325247[_0x1acb('0x36')]['fields']));_0x3b17ac[_0x1acb('0x3a')]=_0x3b17ac[_0x1acb('0x3a')][_0x1acb('0x3b')]?_0x3b17ac[_0x1acb('0x3a')]:_0x218004[_0x1acb('0x35')];_0x3b17ac['order']=qs['sort'](_0x325247[_0x1acb('0x36')]['sort']);_0x3b17ac[_0x1acb('0x3e')]=qs[_0x1acb('0x3f')](_[_0x1acb('0x40')](_0x325247[_0x1acb('0x36')],_0x218004['filters']));if(_0x325247[_0x1acb('0x36')]['filter']){_0x3b17ac[_0x1acb('0x3e')]=_['merge'](_0x3b17ac['where'],{'$or':_[_0x1acb('0x31')](_0x3b17ac[_0x1acb('0x3a')],function(_0x25d69b){var _0x4df459={};_0x4df459[_0x25d69b]={'$like':'%'+_0x325247[_0x1acb('0x36')][_0x1acb('0x41')]+'%'};return _0x4df459;})});}_0x3b17ac=_[_0x1acb('0x42')]({},_0x3b17ac,_0x325247[_0x1acb('0x43')]);return _0x11d1a2['getSubjects'](_0x3b17ac);}})[_0x1acb('0x2d')](function(_0x5c8811){if(_0x5c8811){_0x345aac=_0x5c8811[_0x1acb('0x3b')];if(!_0x325247[_0x1acb('0x36')][_0x1acb('0x53')](_0x1acb('0x3c'))){_0x3b17ac[_0x1acb('0x25')]=qs[_0x1acb('0x25')](_0x325247['query'][_0x1acb('0x25')]);_0x3b17ac['offset']=qs[_0x1acb('0x24')](_0x325247['query'][_0x1acb('0x24')]);}return _0x11d1a2[_0x1acb('0x54')](_0x3b17ac);}})['then'](function(_0x4bd279){if(_0x4bd279){return _0x4bd279?{'count':_0x345aac,'rows':_0x4bd279}:null;}})['then'](respondWithResult(_0x1411a7,null))['catch'](handleError(_0x1411a7,null));};exports['getDescriptions']=function(_0x105eca,_0x42afed,_0x1393c1){var _0x2ea7cd={};var _0x5e44eb={};var _0x5d76de;var _0x4e4b93;return db[_0x1acb('0x44')]['findOne']({'where':{'id':_0x105eca[_0x1acb('0x4b')]['id']}})[_0x1acb('0x2d')](handleEntityNotFound(_0x42afed,null))[_0x1acb('0x2d')](function(_0x4e1686){if(_0x4e1686){_0x5d76de=_0x4e1686;_0x5e44eb[_0x1acb('0x35')]=_[_0x1acb('0x37')](db['ServicenowField'][_0x1acb('0x4c')]);_0x5e44eb[_0x1acb('0x36')]=_[_0x1acb('0x37')](_0x105eca['query']);_0x5e44eb[_0x1acb('0x3f')]=_[_0x1acb('0x38')](_0x5e44eb['model'],_0x5e44eb[_0x1acb('0x36')]);_0x2ea7cd[_0x1acb('0x3a')]=_[_0x1acb('0x38')](_0x5e44eb[_0x1acb('0x35')],qs['fields'](_0x105eca['query'][_0x1acb('0x39')]));_0x2ea7cd[_0x1acb('0x3a')]=_0x2ea7cd['attributes'][_0x1acb('0x3b')]?_0x2ea7cd[_0x1acb('0x3a')]:_0x5e44eb[_0x1acb('0x35')];_0x2ea7cd[_0x1acb('0x55')]=qs[_0x1acb('0x3d')](_0x105eca[_0x1acb('0x36')]['sort']);_0x2ea7cd[_0x1acb('0x3e')]=qs[_0x1acb('0x3f')](_['pick'](_0x105eca[_0x1acb('0x36')],_0x5e44eb['filters']));if(_0x105eca[_0x1acb('0x36')][_0x1acb('0x41')]){_0x2ea7cd[_0x1acb('0x3e')]=_[_0x1acb('0x42')](_0x2ea7cd['where'],{'$or':_[_0x1acb('0x31')](_0x2ea7cd[_0x1acb('0x3a')],function(_0x3e8d7b){var _0x4d03e2={};_0x4d03e2[_0x3e8d7b]={'$like':'%'+_0x105eca[_0x1acb('0x36')][_0x1acb('0x41')]+'%'};return _0x4d03e2;})});}_0x2ea7cd=_['merge']({},_0x2ea7cd,_0x105eca['options']);return _0x5d76de[_0x1acb('0x56')](_0x2ea7cd);}})[_0x1acb('0x2d')](function(_0x53a228){if(_0x53a228){_0x4e4b93=_0x53a228[_0x1acb('0x3b')];if(!_0x105eca[_0x1acb('0x36')]['hasOwnProperty'](_0x1acb('0x3c'))){_0x2ea7cd[_0x1acb('0x25')]=qs[_0x1acb('0x25')](_0x105eca[_0x1acb('0x36')]['limit']);_0x2ea7cd[_0x1acb('0x24')]=qs[_0x1acb('0x24')](_0x105eca[_0x1acb('0x36')]['offset']);}return _0x5d76de[_0x1acb('0x56')](_0x2ea7cd);}})[_0x1acb('0x2d')](function(_0x59f25c){if(_0x59f25c){return _0x59f25c?{'count':_0x4e4b93,'rows':_0x59f25c}:null;}})['then'](respondWithResult(_0x42afed,null))[_0x1acb('0x21')](handleError(_0x42afed,null));}; \ No newline at end of file +var _0x3797=['pick','merge','VIRTUAL','ServicenowConfiguration','includeAll','include','rows','show','params','keys','rawAttributes','intersection','options','find','create','update','body','getFields','ServicenowField','length','sort','filter','getSubjects','findOne','getDescriptions','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','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','json','save','destroy','stack','name','send','index','map','fieldName','type','key','model','filters','query','fields','attributes','hasOwnProperty','nolimit','order','where'];(function(_0x2f923d,_0x7f560){var _0x441d0a=function(_0x3ddf0b){while(--_0x3ddf0b){_0x2f923d['push'](_0x2f923d['shift']());}};_0x441d0a(++_0x7f560);}(_0x3797,0x1e5));var _0x7379=function(_0x1f31cb,_0x49ed49){_0x1f31cb=_0x1f31cb-0x0;var _0x188f8d=_0x3797[_0x1f31cb];return _0x188f8d;};'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(_0x7379('0x5'));var BPromise=require(_0x7379('0x6'));var Mustache=require(_0x7379('0x7'));var util=require(_0x7379('0x8'));var path=require(_0x7379('0x9'));var sox=require(_0x7379('0xa'));var csv=require(_0x7379('0xb'));var ejs=require(_0x7379('0xc'));var fs=require('fs');var fs_extra=require(_0x7379('0xd'));var _=require(_0x7379('0xe'));var squel=require(_0x7379('0xf'));var crypto=require(_0x7379('0x10'));var jsforce=require(_0x7379('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x7379('0xb'));var querystring=require(_0x7379('0x12'));var Papa=require(_0x7379('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7379('0x14'));var as=require(_0x7379('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7379('0x16'));var utils=require(_0x7379('0x17'));var config=require(_0x7379('0x18'));var licenseUtil=require(_0x7379('0x19'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x7379('0x1a')][_0x7379('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4fe586,_0x20371a,_0x5f1688,_0x260ac4){return new BPromise(function(_0x68f72c,_0x2e601e){var _0x3b281e=_0x260ac4||client;return _0x3b281e[_0x7379('0x1c')](_0x4fe586,_0x5f1688)[_0x7379('0x1d')](function(_0xb5c0d4){logger[_0x7379('0x1e')](_0x7379('0x1f'),_0x20371a,_0x7379('0x20'));logger[_0x7379('0x21')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x20371a,_0x7379('0x20'),JSON[_0x7379('0x22')](_0xb5c0d4));if(_0xb5c0d4['error']){if(_0xb5c0d4[_0x7379('0x23')][_0x7379('0x24')]===0x1f4){logger[_0x7379('0x23')](_0x7379('0x1f'),_0x20371a,_0xb5c0d4['error']['message']);return _0x2e601e(_0xb5c0d4[_0x7379('0x23')][_0x7379('0x25')]);}logger['error'](_0x7379('0x1f'),_0x20371a,_0xb5c0d4[_0x7379('0x23')][_0x7379('0x25')]);return _0x68f72c(_0xb5c0d4[_0x7379('0x23')][_0x7379('0x25')]);}else{logger[_0x7379('0x1e')]('ServicenowConfiguration,\x20%s,\x20%s',_0x20371a,'request\x20sent');_0x68f72c(_0xb5c0d4[_0x7379('0x26')][_0x7379('0x25')]);}})[_0x7379('0x27')](function(_0xca1ffe){logger[_0x7379('0x23')](_0x7379('0x1f'),_0x20371a,_0xca1ffe);_0x2e601e(_0xca1ffe);});});}function respondWithStatusCode(_0x2270fc,_0x3a5e99){_0x3a5e99=_0x3a5e99||0xcc;return function(_0x1f831b){if(_0x1f831b){return _0x2270fc[_0x7379('0x28')](_0x3a5e99);}return _0x2270fc[_0x7379('0x29')](_0x3a5e99)[_0x7379('0x2a')]();};}function respondWithResult(_0x13a71a,_0x4f06dd){_0x4f06dd=_0x4f06dd||0xc8;return function(_0x287dbf){if(_0x287dbf){return _0x13a71a[_0x7379('0x29')](_0x4f06dd)['json'](_0x287dbf);}};}function respondWithFilteredResult(_0xe9a111,_0x334c21){return function(_0x2ea70b){if(_0x2ea70b){var _0x583b37=_0x2ea70b[_0x7379('0x2b')],_0x29cb5c=_0x334c21['offset'],_0x943e60=_0x334c21[_0x7379('0x2c')]+_0x334c21[_0x7379('0x2d')],_0x246097;if(_0x943e60>=_0x583b37){_0x943e60=_0x583b37;_0x246097=0xc8;}else{_0x246097=0xce;}_0xe9a111[_0x7379('0x29')](_0x246097);return _0xe9a111[_0x7379('0x2e')]('Content-Range',_0x29cb5c+'-'+_0x943e60+'/'+_0x583b37)[_0x7379('0x2f')](_0x2ea70b);}return null;};}function patchUpdates(_0x251f0b){return function(_0x24f9bb){try{jsonpatch['apply'](_0x24f9bb,_0x251f0b,!![]);}catch(_0x30a0b3){return BPromise['reject'](_0x30a0b3);}return _0x24f9bb[_0x7379('0x30')]();};}function saveUpdates(_0x3fd170,_0x95c387){return function(_0xf20adf){if(_0xf20adf){return _0xf20adf['update'](_0x3fd170)[_0x7379('0x1d')](function(_0x1d86d1){return _0x1d86d1;});}return null;};}function removeEntity(_0x4f450e,_0x3399ed){return function(_0x5e933d){if(_0x5e933d){return _0x5e933d[_0x7379('0x31')]()[_0x7379('0x1d')](function(){_0x4f450e['status'](0xcc)[_0x7379('0x2a')]();});}};}function handleEntityNotFound(_0x4abd6a,_0x7f8df7){return function(_0x5bec2f){if(!_0x5bec2f){_0x4abd6a['sendStatus'](0x194);}return _0x5bec2f;};}function handleError(_0x34d333,_0x2a2825){_0x2a2825=_0x2a2825||0x1f4;return function(_0x531979){logger[_0x7379('0x23')](_0x531979[_0x7379('0x32')]);if(_0x531979['name']){delete _0x531979[_0x7379('0x33')];}_0x34d333['status'](_0x2a2825)[_0x7379('0x34')](_0x531979);};}exports[_0x7379('0x35')]=function(_0xb9cb80,_0x4948c4){var _0x254a45={},_0x198ec1={},_0x159227={'count':0x0,'rows':[]};var _0x5b2fd2=_[_0x7379('0x36')](db['ServicenowConfiguration']['rawAttributes'],function(_0x3c0b4e){return{'name':_0x3c0b4e[_0x7379('0x37')],'type':_0x3c0b4e[_0x7379('0x38')][_0x7379('0x39')]};});_0x198ec1[_0x7379('0x3a')]=_[_0x7379('0x36')](_0x5b2fd2,_0x7379('0x33'));_0x198ec1['query']=_['keys'](_0xb9cb80['query']);_0x198ec1[_0x7379('0x3b')]=_['intersection'](_0x198ec1[_0x7379('0x3a')],_0x198ec1[_0x7379('0x3c')]);_0x254a45['attributes']=_['intersection'](_0x198ec1[_0x7379('0x3a')],qs[_0x7379('0x3d')](_0xb9cb80[_0x7379('0x3c')]['fields']));_0x254a45[_0x7379('0x3e')]=_0x254a45['attributes']['length']?_0x254a45[_0x7379('0x3e')]:_0x198ec1[_0x7379('0x3a')];if(!_0xb9cb80[_0x7379('0x3c')][_0x7379('0x3f')](_0x7379('0x40'))){_0x254a45[_0x7379('0x2d')]=qs[_0x7379('0x2d')](_0xb9cb80['query']['limit']);_0x254a45[_0x7379('0x2c')]=qs[_0x7379('0x2c')](_0xb9cb80['query'][_0x7379('0x2c')]);}_0x254a45[_0x7379('0x41')]=qs['sort'](_0xb9cb80[_0x7379('0x3c')]['sort']);_0x254a45[_0x7379('0x42')]=qs[_0x7379('0x3b')](_[_0x7379('0x43')](_0xb9cb80[_0x7379('0x3c')],_0x198ec1['filters']),_0x5b2fd2);if(_0xb9cb80[_0x7379('0x3c')]['filter']){_0x254a45['where']=_[_0x7379('0x44')](_0x254a45[_0x7379('0x42')],{'$or':_[_0x7379('0x36')](_0x5b2fd2,function(_0x411c75){if(_0x411c75[_0x7379('0x38')]!==_0x7379('0x45')){var _0x34567a={};_0x34567a[_0x411c75[_0x7379('0x33')]]={'$like':'%'+_0xb9cb80[_0x7379('0x3c')]['filter']+'%'};return _0x34567a;}})});}_0x254a45=_[_0x7379('0x44')]({},_0x254a45,_0xb9cb80['options']);var _0x34f410={'where':_0x254a45[_0x7379('0x42')]};return db[_0x7379('0x46')][_0x7379('0x2b')](_0x34f410)[_0x7379('0x1d')](function(_0x573a09){_0x159227[_0x7379('0x2b')]=_0x573a09;if(_0xb9cb80[_0x7379('0x3c')][_0x7379('0x47')]){_0x254a45[_0x7379('0x48')]=[{'all':!![]}];}return db[_0x7379('0x46')]['findAll'](_0x254a45);})[_0x7379('0x1d')](function(_0x14188e){_0x159227[_0x7379('0x49')]=_0x14188e;return _0x159227;})[_0x7379('0x1d')](respondWithFilteredResult(_0x4948c4,_0x254a45))[_0x7379('0x27')](handleError(_0x4948c4,null));};exports[_0x7379('0x4a')]=function(_0x2f1aca,_0x442c26){var _0x43ef99={'raw':![],'where':{'id':_0x2f1aca[_0x7379('0x4b')]['id']}},_0x236c87={};_0x236c87[_0x7379('0x3a')]=_[_0x7379('0x4c')](db[_0x7379('0x46')][_0x7379('0x4d')]);_0x236c87['query']=_['keys'](_0x2f1aca[_0x7379('0x3c')]);_0x236c87[_0x7379('0x3b')]=_[_0x7379('0x4e')](_0x236c87[_0x7379('0x3a')],_0x236c87[_0x7379('0x3c')]);_0x43ef99[_0x7379('0x3e')]=_['intersection'](_0x236c87[_0x7379('0x3a')],qs[_0x7379('0x3d')](_0x2f1aca[_0x7379('0x3c')]['fields']));_0x43ef99['attributes']=_0x43ef99['attributes']['length']?_0x43ef99['attributes']:_0x236c87[_0x7379('0x3a')];if(_0x2f1aca[_0x7379('0x3c')][_0x7379('0x47')]){_0x43ef99['include']=[{'all':!![]}];}_0x43ef99=_[_0x7379('0x44')]({},_0x43ef99,_0x2f1aca[_0x7379('0x4f')]);return db[_0x7379('0x46')][_0x7379('0x50')](_0x43ef99)[_0x7379('0x1d')](handleEntityNotFound(_0x442c26,null))[_0x7379('0x1d')](respondWithResult(_0x442c26,null))['catch'](handleError(_0x442c26,null));};exports[_0x7379('0x51')]=function(_0x5e41f7,_0x3738b2){return db['ServicenowConfiguration']['create'](_0x5e41f7['body'],{})[_0x7379('0x1d')](respondWithResult(_0x3738b2,0xc9))['catch'](handleError(_0x3738b2,null));};exports[_0x7379('0x52')]=function(_0x95f613,_0x414736){if(_0x95f613[_0x7379('0x53')]['id']){delete _0x95f613[_0x7379('0x53')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x95f613[_0x7379('0x4b')]['id']}})[_0x7379('0x1d')](handleEntityNotFound(_0x414736,null))[_0x7379('0x1d')](saveUpdates(_0x95f613['body'],null))[_0x7379('0x1d')](respondWithResult(_0x414736,null))[_0x7379('0x27')](handleError(_0x414736,null));};exports['destroy']=function(_0x1ce0b6,_0x11ba7f){return db[_0x7379('0x46')]['find']({'where':{'id':_0x1ce0b6['params']['id']}})['then'](handleEntityNotFound(_0x11ba7f,null))[_0x7379('0x1d')](removeEntity(_0x11ba7f,null))[_0x7379('0x27')](handleError(_0x11ba7f,null));};exports[_0x7379('0x54')]=function(_0x1466ee,_0x3be181,_0x2c439b){var _0x12a700={};var _0x1f3d58={};var _0x456cae;var _0x17fb62;return db[_0x7379('0x46')]['findOne']({'where':{'id':_0x1466ee['params']['id']}})[_0x7379('0x1d')](handleEntityNotFound(_0x3be181,null))[_0x7379('0x1d')](function(_0x4ef5a8){if(_0x4ef5a8){_0x456cae=_0x4ef5a8;_0x1f3d58[_0x7379('0x3a')]=_[_0x7379('0x4c')](db[_0x7379('0x55')]['rawAttributes']);_0x1f3d58['query']=_['keys'](_0x1466ee[_0x7379('0x3c')]);_0x1f3d58[_0x7379('0x3b')]=_[_0x7379('0x4e')](_0x1f3d58[_0x7379('0x3a')],_0x1f3d58[_0x7379('0x3c')]);_0x12a700['attributes']=_['intersection'](_0x1f3d58[_0x7379('0x3a')],qs[_0x7379('0x3d')](_0x1466ee[_0x7379('0x3c')]['fields']));_0x12a700['attributes']=_0x12a700['attributes'][_0x7379('0x56')]?_0x12a700[_0x7379('0x3e')]:_0x1f3d58[_0x7379('0x3a')];_0x12a700[_0x7379('0x41')]=qs['sort'](_0x1466ee[_0x7379('0x3c')][_0x7379('0x57')]);_0x12a700[_0x7379('0x42')]=qs[_0x7379('0x3b')](_['pick'](_0x1466ee[_0x7379('0x3c')],_0x1f3d58[_0x7379('0x3b')]));if(_0x1466ee[_0x7379('0x3c')][_0x7379('0x58')]){_0x12a700[_0x7379('0x42')]=_['merge'](_0x12a700[_0x7379('0x42')],{'$or':_[_0x7379('0x36')](_0x12a700[_0x7379('0x3e')],function(_0x1693ee){var _0x47bf17={};_0x47bf17[_0x1693ee]={'$like':'%'+_0x1466ee[_0x7379('0x3c')][_0x7379('0x58')]+'%'};return _0x47bf17;})});}_0x12a700=_[_0x7379('0x44')]({},_0x12a700,_0x1466ee['options']);return _0x456cae[_0x7379('0x54')](_0x12a700);}})['then'](function(_0x2ac5f8){if(_0x2ac5f8){_0x17fb62=_0x2ac5f8['length'];if(!_0x1466ee[_0x7379('0x3c')][_0x7379('0x3f')](_0x7379('0x40'))){_0x12a700['limit']=qs['limit'](_0x1466ee[_0x7379('0x3c')][_0x7379('0x2d')]);_0x12a700['offset']=qs[_0x7379('0x2c')](_0x1466ee['query'][_0x7379('0x2c')]);}return _0x456cae[_0x7379('0x54')](_0x12a700);}})[_0x7379('0x1d')](function(_0x2dc82d){if(_0x2dc82d){return _0x2dc82d?{'count':_0x17fb62,'rows':_0x2dc82d}:null;}})[_0x7379('0x1d')](respondWithResult(_0x3be181,null))[_0x7379('0x27')](handleError(_0x3be181,null));};exports[_0x7379('0x59')]=function(_0x685247,_0x3e7b98,_0x12e3aa){var _0x11968e={};var _0x5c88ca={};var _0x484abe;var _0x3de3f0;return db[_0x7379('0x46')][_0x7379('0x5a')]({'where':{'id':_0x685247[_0x7379('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3e7b98,null))[_0x7379('0x1d')](function(_0x4e17e1){if(_0x4e17e1){_0x484abe=_0x4e17e1;_0x5c88ca['model']=_[_0x7379('0x4c')](db[_0x7379('0x55')][_0x7379('0x4d')]);_0x5c88ca['query']=_[_0x7379('0x4c')](_0x685247[_0x7379('0x3c')]);_0x5c88ca[_0x7379('0x3b')]=_[_0x7379('0x4e')](_0x5c88ca[_0x7379('0x3a')],_0x5c88ca['query']);_0x11968e[_0x7379('0x3e')]=_[_0x7379('0x4e')](_0x5c88ca[_0x7379('0x3a')],qs[_0x7379('0x3d')](_0x685247[_0x7379('0x3c')]['fields']));_0x11968e[_0x7379('0x3e')]=_0x11968e[_0x7379('0x3e')][_0x7379('0x56')]?_0x11968e[_0x7379('0x3e')]:_0x5c88ca[_0x7379('0x3a')];_0x11968e[_0x7379('0x41')]=qs[_0x7379('0x57')](_0x685247[_0x7379('0x3c')][_0x7379('0x57')]);_0x11968e[_0x7379('0x42')]=qs['filters'](_[_0x7379('0x43')](_0x685247['query'],_0x5c88ca['filters']));if(_0x685247[_0x7379('0x3c')][_0x7379('0x58')]){_0x11968e['where']=_[_0x7379('0x44')](_0x11968e[_0x7379('0x42')],{'$or':_['map'](_0x11968e[_0x7379('0x3e')],function(_0x5be293){var _0x45918d={};_0x45918d[_0x5be293]={'$like':'%'+_0x685247[_0x7379('0x3c')][_0x7379('0x58')]+'%'};return _0x45918d;})});}_0x11968e=_[_0x7379('0x44')]({},_0x11968e,_0x685247[_0x7379('0x4f')]);return _0x484abe[_0x7379('0x59')](_0x11968e);}})[_0x7379('0x1d')](function(_0x34959b){if(_0x34959b){_0x3de3f0=_0x34959b[_0x7379('0x56')];if(!_0x685247[_0x7379('0x3c')][_0x7379('0x3f')]('nolimit')){_0x11968e[_0x7379('0x2d')]=qs[_0x7379('0x2d')](_0x685247[_0x7379('0x3c')][_0x7379('0x2d')]);_0x11968e['offset']=qs[_0x7379('0x2c')](_0x685247[_0x7379('0x3c')][_0x7379('0x2c')]);}return _0x484abe[_0x7379('0x59')](_0x11968e);}})[_0x7379('0x1d')](function(_0x4390fb){if(_0x4390fb){return _0x4390fb?{'count':_0x3de3f0,'rows':_0x4390fb}:null;}})[_0x7379('0x1d')](respondWithResult(_0x3e7b98,null))[_0x7379('0x27')](handleError(_0x3e7b98,null));};exports[_0x7379('0x5b')]=function(_0x55e47b,_0x525916,_0x1dfb52){var _0x264676={};var _0x3fb56b={};var _0x4b42e2;var _0x5f05ee;return db[_0x7379('0x46')]['findOne']({'where':{'id':_0x55e47b[_0x7379('0x4b')]['id']}})['then'](handleEntityNotFound(_0x525916,null))[_0x7379('0x1d')](function(_0x44ba08){if(_0x44ba08){_0x4b42e2=_0x44ba08;_0x3fb56b[_0x7379('0x3a')]=_['keys'](db[_0x7379('0x55')][_0x7379('0x4d')]);_0x3fb56b[_0x7379('0x3c')]=_[_0x7379('0x4c')](_0x55e47b[_0x7379('0x3c')]);_0x3fb56b[_0x7379('0x3b')]=_[_0x7379('0x4e')](_0x3fb56b['model'],_0x3fb56b[_0x7379('0x3c')]);_0x264676[_0x7379('0x3e')]=_[_0x7379('0x4e')](_0x3fb56b[_0x7379('0x3a')],qs['fields'](_0x55e47b[_0x7379('0x3c')][_0x7379('0x3d')]));_0x264676['attributes']=_0x264676['attributes'][_0x7379('0x56')]?_0x264676['attributes']:_0x3fb56b[_0x7379('0x3a')];_0x264676[_0x7379('0x41')]=qs[_0x7379('0x57')](_0x55e47b[_0x7379('0x3c')][_0x7379('0x57')]);_0x264676[_0x7379('0x42')]=qs[_0x7379('0x3b')](_[_0x7379('0x43')](_0x55e47b[_0x7379('0x3c')],_0x3fb56b['filters']));if(_0x55e47b[_0x7379('0x3c')][_0x7379('0x58')]){_0x264676[_0x7379('0x42')]=_['merge'](_0x264676[_0x7379('0x42')],{'$or':_[_0x7379('0x36')](_0x264676[_0x7379('0x3e')],function(_0x485472){var _0x4b282e={};_0x4b282e[_0x485472]={'$like':'%'+_0x55e47b['query'][_0x7379('0x58')]+'%'};return _0x4b282e;})});}_0x264676=_[_0x7379('0x44')]({},_0x264676,_0x55e47b['options']);return _0x4b42e2['getDescriptions'](_0x264676);}})[_0x7379('0x1d')](function(_0x2d4fed){if(_0x2d4fed){_0x5f05ee=_0x2d4fed['length'];if(!_0x55e47b[_0x7379('0x3c')]['hasOwnProperty']('nolimit')){_0x264676[_0x7379('0x2d')]=qs[_0x7379('0x2d')](_0x55e47b[_0x7379('0x3c')][_0x7379('0x2d')]);_0x264676[_0x7379('0x2c')]=qs[_0x7379('0x2c')](_0x55e47b[_0x7379('0x3c')][_0x7379('0x2c')]);}return _0x4b42e2[_0x7379('0x5b')](_0x264676);}})[_0x7379('0x1d')](function(_0x44392d){if(_0x44392d){return _0x44392d?{'count':_0x5f05ee,'rows':_0x44392d}:null;}})[_0x7379('0x1d')](respondWithResult(_0x525916,null))[_0x7379('0x27')](handleError(_0x525916,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index ff7c800..1cfe32f 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 _0xa31e=['int_servicenow_configurations','lodash','util','../../config/logger','api','moment','path','rimraf','./intServicenowConfiguration.attributes','exports','define'];(function(_0x5d572e,_0x3458a0){var _0x322e3b=function(_0x48e8ff){while(--_0x48e8ff){_0x5d572e['push'](_0x5d572e['shift']());}};_0x322e3b(++_0x3458a0);}(_0xa31e,0x11f));var _0xea31=function(_0xff5684,_0xfe6e00){_0xff5684=_0xff5684-0x0;var _0x41e374=_0xa31e[_0xff5684];return _0x41e374;};'use strict';var _=require(_0xea31('0x0'));var util=require(_0xea31('0x1'));var logger=require(_0xea31('0x2'))(_0xea31('0x3'));var moment=require(_0xea31('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xea31('0x5'));var rimraf=require(_0xea31('0x6'));var config=require('../../config/environment');var attributes=require(_0xea31('0x7'));module[_0xea31('0x8')]=function(_0x96b050,_0x2c7f5b){return _0x96b050[_0xea31('0x9')]('ServicenowConfiguration',attributes,{'tableName':_0xea31('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3bc2=['../../config/logger','api','request-promise','path','./intServicenowConfiguration.attributes','define','int_servicenow_configurations','util'];(function(_0x291d3f,_0x3ef99f){var _0x242080=function(_0x257705){while(--_0x257705){_0x291d3f['push'](_0x291d3f['shift']());}};_0x242080(++_0x3ef99f);}(_0x3bc2,0x167));var _0x23bc=function(_0x598689,_0x2fcfcb){_0x598689=_0x598689-0x0;var _0x2fa7e4=_0x3bc2[_0x598689];return _0x2fa7e4;};'use strict';var _=require('lodash');var util=require(_0x23bc('0x0'));var logger=require(_0x23bc('0x1'))(_0x23bc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x23bc('0x3'));var fs=require('fs');var path=require(_0x23bc('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x23bc('0x5'));module['exports']=function(_0x4cb0f7,_0x474e2c){return _0x4cb0f7[_0x23bc('0x6')]('ServicenowConfiguration',attributes,{'tableName':_0x23bc('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index be182a3..9c7d6c4 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 _0x7763=['error','message','result','catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x5b7755,_0x44681c){var _0x1a9c39=function(_0x56ceec){while(--_0x56ceec){_0x5b7755['push'](_0x5b7755['shift']());}};_0x1a9c39(++_0x44681c);}(_0x7763,0x1a6));var _0x3776=function(_0x9cad5,_0x4c2d77){_0x9cad5=_0x9cad5-0x0;var _0x2b9b73=_0x7763[_0x9cad5];return _0x2b9b73;};'use strict';var _=require(_0x3776('0x0'));var util=require(_0x3776('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3776('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3776('0x3'));var logger=require(_0x3776('0x4'))(_0x3776('0x5'));var config=require(_0x3776('0x6'));var jayson=require(_0x3776('0x7'));var client=jayson['client'][_0x3776('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48e65b,_0xca5e67,_0x506702){return new BPromise(function(_0x5ed73e,_0x30f062){return client[_0x3776('0x9')](_0x48e65b,_0x506702)[_0x3776('0xa')](function(_0x1caa89){logger[_0x3776('0xb')](_0x3776('0xc'),_0xca5e67,_0x3776('0xd'));logger['debug'](_0x3776('0xe'),_0xca5e67,_0x3776('0xd'),JSON['stringify'](_0x1caa89));if(_0x1caa89[_0x3776('0xf')]){if(_0x1caa89[_0x3776('0xf')]['code']===0x1f4){logger['error'](_0x3776('0xc'),_0xca5e67,_0x1caa89['error'][_0x3776('0x10')]);return _0x30f062(_0x1caa89['error']['message']);}logger[_0x3776('0xf')](_0x3776('0xc'),_0xca5e67,_0x1caa89[_0x3776('0xf')]['message']);return _0x5ed73e(_0x1caa89['error'][_0x3776('0x10')]);}else{logger[_0x3776('0xb')](_0x3776('0xc'),_0xca5e67,_0x3776('0xd'));_0x5ed73e(_0x1caa89[_0x3776('0x11')][_0x3776('0x10')]);}})[_0x3776('0x12')](function(_0x4289e2){logger[_0x3776('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0xca5e67,_0x4289e2);_0x30f062(_0x4289e2);});});} \ No newline at end of file +var _0x8b6d=['http','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x27a3cb,_0x4af597){var _0x54ff38=function(_0x3a82d2){while(--_0x3a82d2){_0x27a3cb['push'](_0x27a3cb['shift']());}};_0x54ff38(++_0x4af597);}(_0x8b6d,0xec));var _0xd8b6=function(_0x49df93,_0x2bb7ac){_0x49df93=_0x49df93-0x0;var _0x471bac=_0x8b6d[_0x49df93];return _0x471bac;};'use strict';var _=require('lodash');var util=require(_0xd8b6('0x0'));var moment=require('moment');var BPromise=require(_0xd8b6('0x1'));var rs=require(_0xd8b6('0x2'));var fs=require('fs');var Redis=require(_0xd8b6('0x3'));var db=require(_0xd8b6('0x4'))['db'];var utils=require(_0xd8b6('0x5'));var logger=require(_0xd8b6('0x6'))(_0xd8b6('0x7'));var config=require(_0xd8b6('0x8'));var jayson=require(_0xd8b6('0x9'));var client=jayson[_0xd8b6('0xa')][_0xd8b6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a9fd4,_0x3548ed,_0x594430){return new BPromise(function(_0x231153,_0x6fbffd){return client['request'](_0x2a9fd4,_0x594430)['then'](function(_0x462af3){logger['info'](_0xd8b6('0xc'),_0x3548ed,_0xd8b6('0xd'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x3548ed,_0xd8b6('0xd'),JSON[_0xd8b6('0xe')](_0x462af3));if(_0x462af3[_0xd8b6('0xf')]){if(_0x462af3[_0xd8b6('0xf')]['code']===0x1f4){logger[_0xd8b6('0xf')](_0xd8b6('0xc'),_0x3548ed,_0x462af3[_0xd8b6('0xf')][_0xd8b6('0x10')]);return _0x6fbffd(_0x462af3[_0xd8b6('0xf')][_0xd8b6('0x10')]);}logger['error'](_0xd8b6('0xc'),_0x3548ed,_0x462af3[_0xd8b6('0xf')][_0xd8b6('0x10')]);return _0x231153(_0x462af3[_0xd8b6('0xf')][_0xd8b6('0x10')]);}else{logger[_0xd8b6('0x11')](_0xd8b6('0xc'),_0x3548ed,_0xd8b6('0xd'));_0x231153(_0x462af3[_0xd8b6('0x12')][_0xd8b6('0x10')]);}})['catch'](function(_0x4f8162){logger[_0xd8b6('0xf')](_0xd8b6('0xc'),_0x3548ed,_0x4f8162);_0x6fbffd(_0x4f8162);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index d3d8025..45cceff 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 _0x5882=['post','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','index','isAuthenticated','show'];(function(_0x58220a,_0x3545b5){var _0x30e125=function(_0x4aafd){while(--_0x4aafd){_0x58220a['push'](_0x58220a['shift']());}};_0x30e125(++_0x3545b5);}(_0x5882,0x137));var _0x2588=function(_0x432c46,_0x462cf0){_0x432c46=_0x432c46-0x0;var _0x3454ae=_0x5882[_0x432c46];return _0x3454ae;};'use strict';var multer=require('multer');var util=require(_0x2588('0x0'));var path=require(_0x2588('0x1'));var timeout=require(_0x2588('0x2'));var express=require(_0x2588('0x3'));var router=express[_0x2588('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2588('0x5'));var interaction=require(_0x2588('0x6'));var config=require('../../config/environment');var controller=require(_0x2588('0x7'));router[_0x2588('0x8')]('/',auth['isAuthenticated'](),controller[_0x2588('0x9')]);router[_0x2588('0x8')]('/:id',auth[_0x2588('0xa')](),controller[_0x2588('0xb')]);router[_0x2588('0xc')]('/',auth[_0x2588('0xa')](),controller['create']);router[_0x2588('0xd')]('/:id',auth[_0x2588('0xa')](),controller[_0x2588('0xe')]);router[_0x2588('0xf')]('/:id',auth[_0x2588('0xa')](),controller[_0x2588('0x10')]);module['exports']=router; \ No newline at end of file +var _0xbe95=['destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated','show','post','put','delete'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xbe95,0x1aa));var _0x5be9=function(_0x21b069,_0x4f6fd0){_0x21b069=_0x21b069-0x0;var _0x2fea7d=_0xbe95[_0x21b069];return _0x2fea7d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5be9('0x0'));var timeout=require(_0x5be9('0x1'));var express=require(_0x5be9('0x2'));var router=express[_0x5be9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5be9('0x4'));var interaction=require(_0x5be9('0x5'));var config=require(_0x5be9('0x6'));var controller=require(_0x5be9('0x7'));router[_0x5be9('0x8')]('/',auth['isAuthenticated'](),controller[_0x5be9('0x9')]);router['get'](_0x5be9('0xa'),auth[_0x5be9('0xb')](),controller[_0x5be9('0xc')]);router[_0x5be9('0xd')]('/',auth[_0x5be9('0xb')](),controller['create']);router[_0x5be9('0xe')](_0x5be9('0xa'),auth[_0x5be9('0xb')](),controller['update']);router[_0x5be9('0xf')](_0x5be9('0xa'),auth[_0x5be9('0xb')](),controller[_0x5be9('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 7c6092b..d307923 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 _0x038b=['exports','ENUM','string','customVariable','picklist','STRING'];(function(_0x5329d9,_0x29063b){var _0x3879f6=function(_0x309b11){while(--_0x309b11){_0x5329d9['push'](_0x5329d9['shift']());}};_0x3879f6(++_0x29063b);}(_0x038b,0x114));var _0xb038=function(_0x2aee58,_0x5591b7){_0x2aee58=_0x2aee58-0x0;var _0x12ce02=_0x038b[_0x2aee58];return _0x12ce02;};'use strict';var Sequelize=require('sequelize');module[_0xb038('0x0')]={'type':{'type':Sequelize[_0xb038('0x1')](_0xb038('0x2'),'variable',_0xb038('0x3'),'keyValue',_0xb038('0x4')),'defaultValue':_0xb038('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb038('0x5')]},'keyType':{'type':Sequelize[_0xb038('0x1')]('string','variable',_0xb038('0x3'))},'keyContent':{'type':Sequelize[_0xb038('0x5')]},'idField':{'type':Sequelize[_0xb038('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb038('0x5')]}}; \ No newline at end of file +var _0xc949=['BOOLEAN','sequelize','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x246f97,_0x528368){var _0x509e6e=function(_0x679ca1){while(--_0x679ca1){_0x246f97['push'](_0x246f97['shift']());}};_0x509e6e(++_0x528368);}(_0xc949,0x181));var _0x9c94=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xc949[_0x42f009];return _0x22a1e0;};'use strict';var Sequelize=require(_0x9c94('0x0'));module['exports']={'type':{'type':Sequelize[_0x9c94('0x1')](_0x9c94('0x2'),_0x9c94('0x3'),_0x9c94('0x4'),'keyValue',_0x9c94('0x5')),'defaultValue':_0x9c94('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9c94('0x6')]},'keyType':{'type':Sequelize[_0x9c94('0x1')](_0x9c94('0x2'),_0x9c94('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x9c94('0x6')]},'idField':{'type':Sequelize[_0x9c94('0x6')]},'nameField':{'type':Sequelize[_0x9c94('0x6')]},'customField':{'type':Sequelize[_0x9c94('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9c94('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 37d30f6..6bfce0c 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 _0xca9d=['stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','create','body','find','params','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','set','json','apply','update','then','destroy','sendStatus','error'];(function(_0x3951ab,_0x3724ed){var _0x2a808e=function(_0x524b90){while(--_0x524b90){_0x3951ab['push'](_0x3951ab['shift']());}};_0x2a808e(++_0x3724ed);}(_0xca9d,0x18c));var _0xdca9=function(_0x28bcdb,_0x537185){_0x28bcdb=_0x28bcdb-0x0;var _0x38db94=_0xca9d[_0x28bcdb];return _0x38db94;};'use strict';var emlformat=require(_0xdca9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdca9('0x1'));var jsonpatch=require(_0xdca9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdca9('0x3'));var Mustache=require(_0xdca9('0x4'));var util=require(_0xdca9('0x5'));var path=require(_0xdca9('0x6'));var sox=require(_0xdca9('0x7'));var csv=require(_0xdca9('0x8'));var ejs=require(_0xdca9('0x9'));var fs=require('fs');var fs_extra=require(_0xdca9('0xa'));var _=require(_0xdca9('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdca9('0xc'));var deskjs=require(_0xdca9('0xd'));var toCsv=require(_0xdca9('0x8'));var querystring=require('querystring');var Papa=require(_0xdca9('0xe'));var Redis=require(_0xdca9('0xf'));var authService=require(_0xdca9('0x10'));var qs=require(_0xdca9('0x11'));var as=require(_0xdca9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdca9('0x13'))('api');var utils=require(_0xdca9('0x14'));var config=require(_0xdca9('0x15'));var licenseUtil=require(_0xdca9('0x16'));var db=require(_0xdca9('0x17'))['db'];function respondWithStatusCode(_0x4a9925,_0x43fd40){_0x43fd40=_0x43fd40||0xcc;return function(_0x33e3a8){if(_0x33e3a8){return _0x4a9925['sendStatus'](_0x43fd40);}return _0x4a9925[_0xdca9('0x18')](_0x43fd40)[_0xdca9('0x19')]();};}function respondWithResult(_0x186768,_0x6d1910){_0x6d1910=_0x6d1910||0xc8;return function(_0x36c48b){if(_0x36c48b){return _0x186768['status'](_0x6d1910)['json'](_0x36c48b);}};}function respondWithFilteredResult(_0x677566,_0x53186f){return function(_0x3ee51f){if(_0x3ee51f){var _0x145c0c=_0x3ee51f['count'],_0x39ec2f=_0x53186f[_0xdca9('0x1a')],_0x171cdb=_0x53186f['offset']+_0x53186f[_0xdca9('0x1b')],_0x2206d9;if(_0x171cdb>=_0x145c0c){_0x171cdb=_0x145c0c;_0x2206d9=0xc8;}else{_0x2206d9=0xce;}_0x677566['status'](_0x2206d9);return _0x677566[_0xdca9('0x1c')]('Content-Range',_0x39ec2f+'-'+_0x171cdb+'/'+_0x145c0c)[_0xdca9('0x1d')](_0x3ee51f);}return null;};}function patchUpdates(_0x10e603){return function(_0x28db93){try{jsonpatch[_0xdca9('0x1e')](_0x28db93,_0x10e603,!![]);}catch(_0x1365f3){return BPromise['reject'](_0x1365f3);}return _0x28db93['save']();};}function saveUpdates(_0x48d345,_0x277e17){return function(_0x1521c5){if(_0x1521c5){return _0x1521c5[_0xdca9('0x1f')](_0x48d345)[_0xdca9('0x20')](function(_0x373c29){return _0x373c29;});}return null;};}function removeEntity(_0x4258f4,_0x5e0093){return function(_0x21497f){if(_0x21497f){return _0x21497f[_0xdca9('0x21')]()[_0xdca9('0x20')](function(){_0x4258f4[_0xdca9('0x18')](0xcc)[_0xdca9('0x19')]();});}};}function handleEntityNotFound(_0x4c5472,_0x59880a){return function(_0x3e21e1){if(!_0x3e21e1){_0x4c5472[_0xdca9('0x22')](0x194);}return _0x3e21e1;};}function handleError(_0x25bc8d,_0x1f686c){_0x1f686c=_0x1f686c||0x1f4;return function(_0x2c823c){logger[_0xdca9('0x23')](_0x2c823c[_0xdca9('0x24')]);if(_0x2c823c[_0xdca9('0x25')]){delete _0x2c823c[_0xdca9('0x25')];}_0x25bc8d[_0xdca9('0x18')](_0x1f686c)[_0xdca9('0x26')](_0x2c823c);};}exports[_0xdca9('0x27')]=function(_0x4e31e5,_0x4e01ca){var _0xa1fbbc={},_0x45814d={},_0x18bc17={'count':0x0,'rows':[]};var _0x19d4e1=_[_0xdca9('0x28')](db[_0xdca9('0x29')][_0xdca9('0x2a')],function(_0x32e2f8){return{'name':_0x32e2f8[_0xdca9('0x2b')],'type':_0x32e2f8[_0xdca9('0x2c')][_0xdca9('0x2d')]};});_0x45814d[_0xdca9('0x2e')]=_[_0xdca9('0x28')](_0x19d4e1,_0xdca9('0x25'));_0x45814d['query']=_[_0xdca9('0x2f')](_0x4e31e5['query']);_0x45814d[_0xdca9('0x30')]=_[_0xdca9('0x31')](_0x45814d['model'],_0x45814d[_0xdca9('0x32')]);_0xa1fbbc[_0xdca9('0x33')]=_[_0xdca9('0x31')](_0x45814d[_0xdca9('0x2e')],qs[_0xdca9('0x34')](_0x4e31e5['query'][_0xdca9('0x34')]));_0xa1fbbc['attributes']=_0xa1fbbc['attributes'][_0xdca9('0x35')]?_0xa1fbbc[_0xdca9('0x33')]:_0x45814d[_0xdca9('0x2e')];if(!_0x4e31e5[_0xdca9('0x32')][_0xdca9('0x36')](_0xdca9('0x37'))){_0xa1fbbc[_0xdca9('0x1b')]=qs['limit'](_0x4e31e5[_0xdca9('0x32')][_0xdca9('0x1b')]);_0xa1fbbc['offset']=qs[_0xdca9('0x1a')](_0x4e31e5[_0xdca9('0x32')]['offset']);}_0xa1fbbc['order']=qs[_0xdca9('0x38')](_0x4e31e5['query'][_0xdca9('0x38')]);_0xa1fbbc[_0xdca9('0x39')]=qs[_0xdca9('0x30')](_[_0xdca9('0x3a')](_0x4e31e5['query'],_0x45814d[_0xdca9('0x30')]),_0x19d4e1);if(_0x4e31e5[_0xdca9('0x32')][_0xdca9('0x3b')]){_0xa1fbbc['where']=_[_0xdca9('0x3c')](_0xa1fbbc[_0xdca9('0x39')],{'$or':_[_0xdca9('0x28')](_0x19d4e1,function(_0x21ad0a){if(_0x21ad0a[_0xdca9('0x2c')]!==_0xdca9('0x3d')){var _0x5072a4={};_0x5072a4[_0x21ad0a['name']]={'$like':'%'+_0x4e31e5['query'][_0xdca9('0x3b')]+'%'};return _0x5072a4;}})});}_0xa1fbbc=_['merge']({},_0xa1fbbc,_0x4e31e5[_0xdca9('0x3e')]);var _0x247a3c={'where':_0xa1fbbc['where']};return db[_0xdca9('0x29')][_0xdca9('0x3f')](_0x247a3c)[_0xdca9('0x20')](function(_0x3caa65){_0x18bc17[_0xdca9('0x3f')]=_0x3caa65;if(_0x4e31e5[_0xdca9('0x32')][_0xdca9('0x40')]){_0xa1fbbc['include']=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0xa1fbbc);})['then'](function(_0x33d795){_0x18bc17[_0xdca9('0x41')]=_0x33d795;return _0x18bc17;})[_0xdca9('0x20')](respondWithFilteredResult(_0x4e01ca,_0xa1fbbc))[_0xdca9('0x42')](handleError(_0x4e01ca,null));};exports[_0xdca9('0x43')]=function(_0x4aed20,_0x8d189e){var _0x140037={'raw':!![],'where':{'id':_0x4aed20['params']['id']}},_0x440b32={};_0x440b32[_0xdca9('0x2e')]=_[_0xdca9('0x2f')](db['ServicenowField'][_0xdca9('0x2a')]);_0x440b32[_0xdca9('0x32')]=_[_0xdca9('0x2f')](_0x4aed20['query']);_0x440b32[_0xdca9('0x30')]=_[_0xdca9('0x31')](_0x440b32[_0xdca9('0x2e')],_0x440b32[_0xdca9('0x32')]);_0x140037[_0xdca9('0x33')]=_[_0xdca9('0x31')](_0x440b32[_0xdca9('0x2e')],qs['fields'](_0x4aed20[_0xdca9('0x32')]['fields']));_0x140037[_0xdca9('0x33')]=_0x140037['attributes'][_0xdca9('0x35')]?_0x140037[_0xdca9('0x33')]:_0x440b32['model'];if(_0x4aed20['query'][_0xdca9('0x40')]){_0x140037['include']=[{'all':!![]}];}_0x140037=_[_0xdca9('0x3c')]({},_0x140037,_0x4aed20[_0xdca9('0x3e')]);return db[_0xdca9('0x29')]['find'](_0x140037)['then'](handleEntityNotFound(_0x8d189e,null))['then'](respondWithResult(_0x8d189e,null))[_0xdca9('0x42')](handleError(_0x8d189e,null));};exports[_0xdca9('0x44')]=function(_0x3d9aea,_0x394e21){return db[_0xdca9('0x29')][_0xdca9('0x44')](_0x3d9aea[_0xdca9('0x45')],{})['then'](respondWithResult(_0x394e21,0xc9))['catch'](handleError(_0x394e21,null));};exports[_0xdca9('0x1f')]=function(_0x2dbb92,_0x565e09){if(_0x2dbb92['body']['id']){delete _0x2dbb92[_0xdca9('0x45')]['id'];}return db[_0xdca9('0x29')][_0xdca9('0x46')]({'where':{'id':_0x2dbb92['params']['id']}})['then'](handleEntityNotFound(_0x565e09,null))[_0xdca9('0x20')](saveUpdates(_0x2dbb92[_0xdca9('0x45')],null))[_0xdca9('0x20')](respondWithResult(_0x565e09,null))[_0xdca9('0x42')](handleError(_0x565e09,null));};exports[_0xdca9('0x21')]=function(_0x4b1b41,_0x267b9a){return db[_0xdca9('0x29')][_0xdca9('0x46')]({'where':{'id':_0x4b1b41[_0xdca9('0x47')]['id']}})['then'](handleEntityNotFound(_0x267b9a,null))[_0xdca9('0x20')](removeEntity(_0x267b9a,null))[_0xdca9('0x42')](handleError(_0x267b9a,null));}; \ No newline at end of file +var _0xe86f=['apply','reject','save','update','then','destroy','end','sendStatus','error','stack','send','index','ServicenowField','rawAttributes','fieldName','type','key','model','map','name','query','keys','intersection','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','params','fields','include','create','body','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','status','json','count','offset','limit','set','Content-Range'];(function(_0xaef36b,_0x518c0a){var _0x6e5f47=function(_0x965b37){while(--_0x965b37){_0xaef36b['push'](_0xaef36b['shift']());}};_0x6e5f47(++_0x518c0a);}(_0xe86f,0x78));var _0xfe86=function(_0x453366,_0x2b79d9){_0x453366=_0x453366-0x0;var _0x1a32c5=_0xe86f[_0x453366];return _0x1a32c5;};'use strict';var emlformat=require(_0xfe86('0x0'));var rimraf=require(_0xfe86('0x1'));var zipdir=require(_0xfe86('0x2'));var jsonpatch=require(_0xfe86('0x3'));var rp=require(_0xfe86('0x4'));var moment=require(_0xfe86('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfe86('0x6'));var path=require(_0xfe86('0x7'));var sox=require(_0xfe86('0x8'));var csv=require(_0xfe86('0x9'));var ejs=require(_0xfe86('0xa'));var fs=require('fs');var fs_extra=require(_0xfe86('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfe86('0xc'));var deskjs=require(_0xfe86('0xd'));var toCsv=require(_0xfe86('0x9'));var querystring=require('querystring');var Papa=require(_0xfe86('0xe'));var Redis=require(_0xfe86('0xf'));var authService=require(_0xfe86('0x10'));var qs=require(_0xfe86('0x11'));var as=require(_0xfe86('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfe86('0x13'))(_0xfe86('0x14'));var utils=require(_0xfe86('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfe86('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55bc88,_0x4530c0){_0x4530c0=_0x4530c0||0xcc;return function(_0x58d65e){if(_0x58d65e){return _0x55bc88['sendStatus'](_0x4530c0);}return _0x55bc88[_0xfe86('0x17')](_0x4530c0)['end']();};}function respondWithResult(_0x13b9d6,_0x5b0798){_0x5b0798=_0x5b0798||0xc8;return function(_0x220318){if(_0x220318){return _0x13b9d6[_0xfe86('0x17')](_0x5b0798)[_0xfe86('0x18')](_0x220318);}};}function respondWithFilteredResult(_0x2cc0ad,_0x3d92ef){return function(_0x4ab078){if(_0x4ab078){var _0x5d848b=_0x4ab078[_0xfe86('0x19')],_0x10e6ca=_0x3d92ef[_0xfe86('0x1a')],_0x54881f=_0x3d92ef[_0xfe86('0x1a')]+_0x3d92ef[_0xfe86('0x1b')],_0x40824b;if(_0x54881f>=_0x5d848b){_0x54881f=_0x5d848b;_0x40824b=0xc8;}else{_0x40824b=0xce;}_0x2cc0ad[_0xfe86('0x17')](_0x40824b);return _0x2cc0ad[_0xfe86('0x1c')](_0xfe86('0x1d'),_0x10e6ca+'-'+_0x54881f+'/'+_0x5d848b)[_0xfe86('0x18')](_0x4ab078);}return null;};}function patchUpdates(_0x2bce65){return function(_0x345cc9){try{jsonpatch[_0xfe86('0x1e')](_0x345cc9,_0x2bce65,!![]);}catch(_0x55bf03){return BPromise[_0xfe86('0x1f')](_0x55bf03);}return _0x345cc9[_0xfe86('0x20')]();};}function saveUpdates(_0xb06904,_0x4fc8a3){return function(_0x3cbd09){if(_0x3cbd09){return _0x3cbd09[_0xfe86('0x21')](_0xb06904)[_0xfe86('0x22')](function(_0x1394e8){return _0x1394e8;});}return null;};}function removeEntity(_0x53c1b9,_0x365634){return function(_0x5b2101){if(_0x5b2101){return _0x5b2101[_0xfe86('0x23')]()['then'](function(){_0x53c1b9[_0xfe86('0x17')](0xcc)[_0xfe86('0x24')]();});}};}function handleEntityNotFound(_0x1b897e,_0x1ce4fc){return function(_0x465495){if(!_0x465495){_0x1b897e[_0xfe86('0x25')](0x194);}return _0x465495;};}function handleError(_0x28336,_0x3943ce){_0x3943ce=_0x3943ce||0x1f4;return function(_0x1498d9){logger[_0xfe86('0x26')](_0x1498d9[_0xfe86('0x27')]);if(_0x1498d9['name']){delete _0x1498d9['name'];}_0x28336[_0xfe86('0x17')](_0x3943ce)[_0xfe86('0x28')](_0x1498d9);};}exports[_0xfe86('0x29')]=function(_0x58d74a,_0x32beb4){var _0x9ddfc1={},_0x256ed5={},_0x292d8c={'count':0x0,'rows':[]};var _0x251290=_['map'](db[_0xfe86('0x2a')][_0xfe86('0x2b')],function(_0x1959c5){return{'name':_0x1959c5[_0xfe86('0x2c')],'type':_0x1959c5[_0xfe86('0x2d')][_0xfe86('0x2e')]};});_0x256ed5[_0xfe86('0x2f')]=_[_0xfe86('0x30')](_0x251290,_0xfe86('0x31'));_0x256ed5[_0xfe86('0x32')]=_[_0xfe86('0x33')](_0x58d74a[_0xfe86('0x32')]);_0x256ed5['filters']=_[_0xfe86('0x34')](_0x256ed5['model'],_0x256ed5[_0xfe86('0x32')]);_0x9ddfc1[_0xfe86('0x35')]=_[_0xfe86('0x34')](_0x256ed5[_0xfe86('0x2f')],qs['fields'](_0x58d74a[_0xfe86('0x32')]['fields']));_0x9ddfc1['attributes']=_0x9ddfc1[_0xfe86('0x35')][_0xfe86('0x36')]?_0x9ddfc1[_0xfe86('0x35')]:_0x256ed5[_0xfe86('0x2f')];if(!_0x58d74a['query']['hasOwnProperty'](_0xfe86('0x37'))){_0x9ddfc1[_0xfe86('0x1b')]=qs[_0xfe86('0x1b')](_0x58d74a['query'][_0xfe86('0x1b')]);_0x9ddfc1[_0xfe86('0x1a')]=qs[_0xfe86('0x1a')](_0x58d74a['query']['offset']);}_0x9ddfc1[_0xfe86('0x38')]=qs[_0xfe86('0x39')](_0x58d74a[_0xfe86('0x32')]['sort']);_0x9ddfc1['where']=qs[_0xfe86('0x3a')](_[_0xfe86('0x3b')](_0x58d74a[_0xfe86('0x32')],_0x256ed5['filters']),_0x251290);if(_0x58d74a[_0xfe86('0x32')][_0xfe86('0x3c')]){_0x9ddfc1[_0xfe86('0x3d')]=_[_0xfe86('0x3e')](_0x9ddfc1[_0xfe86('0x3d')],{'$or':_[_0xfe86('0x30')](_0x251290,function(_0x592fda){if(_0x592fda[_0xfe86('0x2d')]!==_0xfe86('0x3f')){var _0x3a1ca8={};_0x3a1ca8[_0x592fda[_0xfe86('0x31')]]={'$like':'%'+_0x58d74a[_0xfe86('0x32')][_0xfe86('0x3c')]+'%'};return _0x3a1ca8;}})});}_0x9ddfc1=_[_0xfe86('0x3e')]({},_0x9ddfc1,_0x58d74a[_0xfe86('0x40')]);var _0x31ca97={'where':_0x9ddfc1['where']};return db[_0xfe86('0x2a')][_0xfe86('0x19')](_0x31ca97)['then'](function(_0x5b4989){_0x292d8c[_0xfe86('0x19')]=_0x5b4989;if(_0x58d74a['query'][_0xfe86('0x41')]){_0x9ddfc1['include']=[{'all':!![]}];}return db[_0xfe86('0x2a')][_0xfe86('0x42')](_0x9ddfc1);})[_0xfe86('0x22')](function(_0x2ea63b){_0x292d8c[_0xfe86('0x43')]=_0x2ea63b;return _0x292d8c;})[_0xfe86('0x22')](respondWithFilteredResult(_0x32beb4,_0x9ddfc1))['catch'](handleError(_0x32beb4,null));};exports['show']=function(_0xf39590,_0x41cfc0){var _0x3a6600={'raw':!![],'where':{'id':_0xf39590[_0xfe86('0x44')]['id']}},_0xd37e47={};_0xd37e47[_0xfe86('0x2f')]=_[_0xfe86('0x33')](db[_0xfe86('0x2a')][_0xfe86('0x2b')]);_0xd37e47[_0xfe86('0x32')]=_['keys'](_0xf39590[_0xfe86('0x32')]);_0xd37e47[_0xfe86('0x3a')]=_[_0xfe86('0x34')](_0xd37e47[_0xfe86('0x2f')],_0xd37e47[_0xfe86('0x32')]);_0x3a6600[_0xfe86('0x35')]=_[_0xfe86('0x34')](_0xd37e47['model'],qs[_0xfe86('0x45')](_0xf39590[_0xfe86('0x32')][_0xfe86('0x45')]));_0x3a6600[_0xfe86('0x35')]=_0x3a6600[_0xfe86('0x35')][_0xfe86('0x36')]?_0x3a6600[_0xfe86('0x35')]:_0xd37e47[_0xfe86('0x2f')];if(_0xf39590[_0xfe86('0x32')][_0xfe86('0x41')]){_0x3a6600[_0xfe86('0x46')]=[{'all':!![]}];}_0x3a6600=_[_0xfe86('0x3e')]({},_0x3a6600,_0xf39590[_0xfe86('0x40')]);return db[_0xfe86('0x2a')]['find'](_0x3a6600)[_0xfe86('0x22')](handleEntityNotFound(_0x41cfc0,null))['then'](respondWithResult(_0x41cfc0,null))['catch'](handleError(_0x41cfc0,null));};exports[_0xfe86('0x47')]=function(_0x3d1178,_0x333e16){return db[_0xfe86('0x2a')][_0xfe86('0x47')](_0x3d1178[_0xfe86('0x48')],{})[_0xfe86('0x22')](respondWithResult(_0x333e16,0xc9))[_0xfe86('0x49')](handleError(_0x333e16,null));};exports[_0xfe86('0x21')]=function(_0x139209,_0x4cba94){if(_0x139209[_0xfe86('0x48')]['id']){delete _0x139209[_0xfe86('0x48')]['id'];}return db[_0xfe86('0x2a')][_0xfe86('0x4a')]({'where':{'id':_0x139209[_0xfe86('0x44')]['id']}})['then'](handleEntityNotFound(_0x4cba94,null))[_0xfe86('0x22')](saveUpdates(_0x139209['body'],null))[_0xfe86('0x22')](respondWithResult(_0x4cba94,null))[_0xfe86('0x49')](handleError(_0x4cba94,null));};exports[_0xfe86('0x23')]=function(_0x3d8091,_0x3eafe8){return db[_0xfe86('0x2a')][_0xfe86('0x4a')]({'where':{'id':_0x3d8091[_0xfe86('0x44')]['id']}})[_0xfe86('0x22')](handleEntityNotFound(_0x3eafe8,null))[_0xfe86('0x22')](removeEntity(_0x3eafe8,null))['catch'](handleError(_0x3eafe8,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 378fb0b..0f3d034 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 _0x3ba1=['FieldId','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','define','servicenow_unique_index','idField'];(function(_0x1bfda1,_0x238e14){var _0x3e6917=function(_0xe08969){while(--_0xe08969){_0x1bfda1['push'](_0x1bfda1['shift']());}};_0x3e6917(++_0x238e14);}(_0x3ba1,0x1ae));var _0x13ba=function(_0x40d18c,_0x170f07){_0x40d18c=_0x40d18c-0x0;var _0xe08c17=_0x3ba1[_0x40d18c];return _0xe08c17;};'use strict';var _=require('lodash');var util=require(_0x13ba('0x0'));var logger=require(_0x13ba('0x1'))(_0x13ba('0x2'));var moment=require(_0x13ba('0x3'));var BPromise=require('bluebird');var rp=require(_0x13ba('0x4'));var fs=require('fs');var path=require(_0x13ba('0x5'));var rimraf=require(_0x13ba('0x6'));var config=require(_0x13ba('0x7'));var attributes=require(_0x13ba('0x8'));module['exports']=function(_0x112247,_0x3201f7){return _0x112247[_0x13ba('0x9')]('ServicenowField',attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x13ba('0xa'),'fields':[_0x13ba('0xb'),_0x13ba('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8594=['path','rimraf','../../config/environment','./intServicenowField.attributes','exports','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','bluebird','request-promise'];(function(_0x27efed,_0x3b26c0){var _0x1e8ba0=function(_0x4f5f00){while(--_0x4f5f00){_0x27efed['push'](_0x27efed['shift']());}};_0x1e8ba0(++_0x3b26c0);}(_0x8594,0x141));var _0x4859=function(_0x490f70,_0x3933ff){_0x490f70=_0x490f70-0x0;var _0x1eca10=_0x8594[_0x490f70];return _0x1eca10;};'use strict';var _=require(_0x4859('0x0'));var util=require(_0x4859('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4859('0x2'));var rp=require(_0x4859('0x3'));var fs=require('fs');var path=require(_0x4859('0x4'));var rimraf=require(_0x4859('0x5'));var config=require(_0x4859('0x6'));var attributes=require(_0x4859('0x7'));module[_0x4859('0x8')]=function(_0x44443a,_0x4424a4){return _0x44443a['define']('ServicenowField',attributes,{'tableName':_0x4859('0x9'),'paranoid':![],'indexes':[{'name':_0x4859('0xa'),'fields':[_0x4859('0xb'),_0x4859('0xc')],'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 ef5f575..1714a1f 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 _0xde6f=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ServicenowField,\x20%s,\x20%s','request\x20sent','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util'];(function(_0x335271,_0x5025f2){var _0xa9fff8=function(_0x28d0bd){while(--_0x28d0bd){_0x335271['push'](_0x335271['shift']());}};_0xa9fff8(++_0x5025f2);}(_0xde6f,0x9f));var _0xfde6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xde6f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xfde6('0x0'));var util=require(_0xfde6('0x1'));var moment=require(_0xfde6('0x2'));var BPromise=require('bluebird');var rs=require(_0xfde6('0x3'));var fs=require('fs');var Redis=require(_0xfde6('0x4'));var db=require(_0xfde6('0x5'))['db'];var utils=require(_0xfde6('0x6'));var logger=require(_0xfde6('0x7'))(_0xfde6('0x8'));var config=require(_0xfde6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfde6('0xa')][_0xfde6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf595c5,_0x21b91a,_0x41c5e0){return new BPromise(function(_0x52ce1c,_0x1881bb){return client[_0xfde6('0xc')](_0xf595c5,_0x41c5e0)[_0xfde6('0xd')](function(_0x18e020){logger['info'](_0xfde6('0xe'),_0x21b91a,_0xfde6('0xf'));logger['debug'](_0xfde6('0x10'),_0x21b91a,_0xfde6('0xf'),JSON[_0xfde6('0x11')](_0x18e020));if(_0x18e020[_0xfde6('0x12')]){if(_0x18e020[_0xfde6('0x12')][_0xfde6('0x13')]===0x1f4){logger[_0xfde6('0x12')](_0xfde6('0xe'),_0x21b91a,_0x18e020[_0xfde6('0x12')][_0xfde6('0x14')]);return _0x1881bb(_0x18e020[_0xfde6('0x12')][_0xfde6('0x14')]);}logger['error'](_0xfde6('0xe'),_0x21b91a,_0x18e020[_0xfde6('0x12')][_0xfde6('0x14')]);return _0x52ce1c(_0x18e020[_0xfde6('0x12')]['message']);}else{logger[_0xfde6('0x15')](_0xfde6('0xe'),_0x21b91a,_0xfde6('0xf'));_0x52ce1c(_0x18e020['result'][_0xfde6('0x14')]);}})[_0xfde6('0x16')](function(_0x49b080){logger[_0xfde6('0x12')]('ServicenowField,\x20%s,\x20%s',_0x21b91a,_0x49b080);_0x1881bb(_0x49b080);});});} \ No newline at end of file +var _0x2b1b=['then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','ioredis','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x69b218,_0x29e70c){var _0xc986ef=function(_0x644821){while(--_0x644821){_0x69b218['push'](_0x69b218['shift']());}};_0xc986ef(++_0x29e70c);}(_0x2b1b,0x1a0));var _0xb2b1=function(_0x137bc,_0x309e24){_0x137bc=_0x137bc-0x0;var _0x8bebd1=_0x2b1b[_0x137bc];return _0x8bebd1;};'use strict';var _=require(_0xb2b1('0x0'));var util=require(_0xb2b1('0x1'));var moment=require(_0xb2b1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb2b1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb2b1('0x4'));var logger=require('../../config/logger')(_0xb2b1('0x5'));var config=require('../../config/environment');var jayson=require(_0xb2b1('0x6'));var client=jayson[_0xb2b1('0x7')][_0xb2b1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5257d3,_0x213695,_0x27f2b8){return new BPromise(function(_0x43a30b,_0x28a382){return client['request'](_0x5257d3,_0x27f2b8)[_0xb2b1('0x9')](function(_0x11dbb5){logger[_0xb2b1('0xa')](_0xb2b1('0xb'),_0x213695,'request\x20sent');logger['debug']('ServicenowField,\x20%s,\x20%s,\x20%s',_0x213695,_0xb2b1('0xc'),JSON['stringify'](_0x11dbb5));if(_0x11dbb5[_0xb2b1('0xd')]){if(_0x11dbb5[_0xb2b1('0xd')][_0xb2b1('0xe')]===0x1f4){logger[_0xb2b1('0xd')]('ServicenowField,\x20%s,\x20%s',_0x213695,_0x11dbb5[_0xb2b1('0xd')][_0xb2b1('0xf')]);return _0x28a382(_0x11dbb5[_0xb2b1('0xd')][_0xb2b1('0xf')]);}logger['error'](_0xb2b1('0xb'),_0x213695,_0x11dbb5[_0xb2b1('0xd')][_0xb2b1('0xf')]);return _0x43a30b(_0x11dbb5[_0xb2b1('0xd')]['message']);}else{logger['info'](_0xb2b1('0xb'),_0x213695,'request\x20sent');_0x43a30b(_0x11dbb5[_0xb2b1('0x10')][_0xb2b1('0xf')]);}})['catch'](function(_0x388cad){logger[_0xb2b1('0xd')]('ServicenowField,\x20%s,\x20%s',_0x213695,_0x388cad);_0x28a382(_0x388cad);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index bff1279..2a9d747 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 _0xc03f=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','/:id','isAuthenticated'];(function(_0x161ca6,_0x51b41a){var _0x137ed0=function(_0x1d5a04){while(--_0x1d5a04){_0x161ca6['push'](_0x161ca6['shift']());}};_0x137ed0(++_0x51b41a);}(_0xc03f,0x1a3));var _0xfc03=function(_0x592af7,_0x2a1ba7){_0x592af7=_0x592af7-0x0;var _0x4738f1=_0xc03f[_0x592af7];return _0x4738f1;};'use strict';var multer=require(_0xfc03('0x0'));var util=require(_0xfc03('0x1'));var path=require(_0xfc03('0x2'));var timeout=require(_0xfc03('0x3'));var express=require(_0xfc03('0x4'));var router=express[_0xfc03('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfc03('0x6'));var interaction=require(_0xfc03('0x7'));var config=require(_0xfc03('0x8'));var controller=require(_0xfc03('0x9'));router[_0xfc03('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfc03('0xa')](_0xfc03('0xb'),auth[_0xfc03('0xc')](),controller['show']);router[_0xfc03('0xa')](_0xfc03('0xd'),auth[_0xfc03('0xc')](),controller[_0xfc03('0xe')]);router[_0xfc03('0xa')](_0xfc03('0xf'),auth[_0xfc03('0xc')](),controller[_0xfc03('0x10')]);router[_0xfc03('0x11')]('/',auth[_0xfc03('0xc')](),controller[_0xfc03('0x12')]);router['post'](_0xfc03('0xd'),auth[_0xfc03('0xc')](),controller['addConfiguration']);router[_0xfc03('0x13')](_0xfc03('0xb'),auth[_0xfc03('0xc')](),controller[_0xfc03('0x14')]);router[_0xfc03('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xfc03('0x16')]);module[_0xfc03('0x17')]=router; \ No newline at end of file +var _0x2c9e=['../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x346add,_0x5056a6){var _0x4fb723=function(_0x12bbcc){while(--_0x12bbcc){_0x346add['push'](_0x346add['shift']());}};_0x4fb723(++_0x5056a6);}(_0x2c9e,0x1c6));var _0xe2c9=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2c9e[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0xe2c9('0x0'));var path=require('path');var timeout=require(_0xe2c9('0x1'));var express=require(_0xe2c9('0x2'));var router=express[_0xe2c9('0x3')]();var fs_extra=require(_0xe2c9('0x4'));var auth=require(_0xe2c9('0x5'));var interaction=require(_0xe2c9('0x6'));var config=require('../../config/environment');var controller=require(_0xe2c9('0x7'));router[_0xe2c9('0x8')]('/',auth[_0xe2c9('0x9')](),controller['index']);router[_0xe2c9('0x8')](_0xe2c9('0xa'),auth['isAuthenticated'](),controller[_0xe2c9('0xb')]);router[_0xe2c9('0x8')]('/:id/configurations',auth[_0xe2c9('0x9')](),controller[_0xe2c9('0xc')]);router[_0xe2c9('0x8')](_0xe2c9('0xd'),auth[_0xe2c9('0x9')](),controller[_0xe2c9('0xe')]);router['post']('/',auth[_0xe2c9('0x9')](),controller[_0xe2c9('0xf')]);router[_0xe2c9('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xe2c9('0x11')]);router[_0xe2c9('0x12')](_0xe2c9('0xa'),auth[_0xe2c9('0x9')](),controller[_0xe2c9('0x13')]);router[_0xe2c9('0x14')](_0xe2c9('0xa'),auth['isAuthenticated'](),controller[_0xe2c9('0x15')]);module[_0xe2c9('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index c532fec..ee1a735 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 _0x9e51=['exports','STRING','username','remoteUri'];(function(_0x484590,_0x47818c){var _0x274de2=function(_0x321039){while(--_0x321039){_0x484590['push'](_0x484590['shift']());}};_0x274de2(++_0x47818c);}(_0x9e51,0x128));var _0x19e5=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x9e51[_0x4b2863];return _0x567d67;};'use strict';var Sequelize=require('sequelize');module[_0x19e5('0x0')]={'name':{'type':Sequelize[_0x19e5('0x1')]},'description':{'type':Sequelize[_0x19e5('0x1')]},'username':{'type':Sequelize[_0x19e5('0x1')],'unique':_0x19e5('0x2')},'password':{'type':Sequelize[_0x19e5('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x19e5('0x3')},'serverUrl':{'type':Sequelize[_0x19e5('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xa1cb=['STRING','username','exports'];(function(_0xdc868f,_0x4d0da4){var _0x345bda=function(_0x1fe26b){while(--_0x1fe26b){_0xdc868f['push'](_0xdc868f['shift']());}};_0x345bda(++_0x4d0da4);}(_0xa1cb,0x89));var _0xba1c=function(_0x376a5d,_0x152b40){_0x376a5d=_0x376a5d-0x0;var _0x100a7a=_0xa1cb[_0x376a5d];return _0x100a7a;};'use strict';var Sequelize=require('sequelize');module[_0xba1c('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xba1c('0x1')]},'username':{'type':Sequelize[_0xba1c('0x1')],'unique':_0xba1c('0x2')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xba1c('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xba1c('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 d7f0779..cc4dcca 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 _0x528f=['create','body','getConfigurations','findOne','SugarcrmConfiguration','order','AccountId','Subjects','getSubjects','Descriptions','channel','SugarcrmField','getFields','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','username','password','remoteUri','slice','lastIndexOf','POST','login','JSON','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','/service/v4_1/rest.php','get_module_fields','values','module_fields','remove','label','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','lodash','squel','jsforce','desk.js','ioredis','../../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','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','sendStatus','status','end','json','set','apply','reject','update','destroy','stack','name','send','index','map','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','offset','sort','where','pick','filter','VIRTUAL','merge','options','SugarcrmAccount','count','findAll','catch','show','params','keys','includeAll','include','find'];(function(_0x494315,_0x2d42bd){var _0x49cc18=function(_0x419de9){while(--_0x419de9){_0x494315['push'](_0x494315['shift']());}};_0x49cc18(++_0x2d42bd);}(_0x528f,0x123));var _0xf528=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x528f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf528('0x0'));var rimraf=require(_0xf528('0x1'));var zipdir=require(_0xf528('0x2'));var jsonpatch=require(_0xf528('0x3'));var rp=require(_0xf528('0x4'));var moment=require(_0xf528('0x5'));var BPromise=require(_0xf528('0x6'));var Mustache=require('mustache');var util=require(_0xf528('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xf528('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf528('0x9'));var squel=require(_0xf528('0xa'));var crypto=require('crypto');var jsforce=require(_0xf528('0xb'));var deskjs=require(_0xf528('0xc'));var toCsv=require(_0xf528('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf528('0xd'));var authService=require(_0xf528('0xe'));var qs=require(_0xf528('0xf'));var as=require(_0xf528('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf528('0x11'))(_0xf528('0x12'));var utils=require(_0xf528('0x13'));var config=require(_0xf528('0x14'));var licenseUtil=require(_0xf528('0x15'));var db=require(_0xf528('0x16'))['db'];var integrations=require(_0xf528('0x17'));var jayson=require(_0xf528('0x18'));var client=jayson[_0xf528('0x19')][_0xf528('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1caaf1,_0x210b52,_0x44e3c0,_0x5cbf0){return new BPromise(function(_0x59d325,_0x3cfb5d){var _0x157ede=_0x5cbf0||client;return _0x157ede['request'](_0x1caaf1,_0x44e3c0)[_0xf528('0x1b')](function(_0x17773c){logger[_0xf528('0x1c')]('SugarcrmAccount,\x20%s,\x20%s',_0x210b52,_0xf528('0x1d'));logger[_0xf528('0x1e')](_0xf528('0x1f'),_0x210b52,_0xf528('0x1d'),JSON[_0xf528('0x20')](_0x17773c));if(_0x17773c[_0xf528('0x21')]){if(_0x17773c[_0xf528('0x21')][_0xf528('0x22')]===0x1f4){logger[_0xf528('0x21')](_0xf528('0x23'),_0x210b52,_0x17773c['error']['message']);return _0x3cfb5d(_0x17773c[_0xf528('0x21')][_0xf528('0x24')]);}logger[_0xf528('0x21')]('SugarcrmAccount,\x20%s,\x20%s',_0x210b52,_0x17773c[_0xf528('0x21')]['message']);return _0x59d325(_0x17773c[_0xf528('0x21')]['message']);}else{logger[_0xf528('0x1c')](_0xf528('0x23'),_0x210b52,'request\x20sent');_0x59d325(_0x17773c['result'][_0xf528('0x24')]);}})['catch'](function(_0x4a2454){logger[_0xf528('0x21')]('SugarcrmAccount,\x20%s,\x20%s',_0x210b52,_0x4a2454);_0x3cfb5d(_0x4a2454);});});}function respondWithStatusCode(_0x333e6b,_0x271f44){_0x271f44=_0x271f44||0xcc;return function(_0x5ce463){if(_0x5ce463){return _0x333e6b[_0xf528('0x25')](_0x271f44);}return _0x333e6b[_0xf528('0x26')](_0x271f44)[_0xf528('0x27')]();};}function respondWithResult(_0x19aef2,_0x2e4ca8){_0x2e4ca8=_0x2e4ca8||0xc8;return function(_0x4ac175){if(_0x4ac175){return _0x19aef2[_0xf528('0x26')](_0x2e4ca8)[_0xf528('0x28')](_0x4ac175);}};}function respondWithFilteredResult(_0x169741,_0x5ed9b9){return function(_0xb6567a){if(_0xb6567a){var _0x807a22=_0xb6567a['count'],_0x34d10c=_0x5ed9b9['offset'],_0x588048=_0x5ed9b9['offset']+_0x5ed9b9['limit'],_0x995853;if(_0x588048>=_0x807a22){_0x588048=_0x807a22;_0x995853=0xc8;}else{_0x995853=0xce;}_0x169741[_0xf528('0x26')](_0x995853);return _0x169741[_0xf528('0x29')]('Content-Range',_0x34d10c+'-'+_0x588048+'/'+_0x807a22)[_0xf528('0x28')](_0xb6567a);}return null;};}function patchUpdates(_0x1dd6e7){return function(_0x831ae5){try{jsonpatch[_0xf528('0x2a')](_0x831ae5,_0x1dd6e7,!![]);}catch(_0x3767b3){return BPromise[_0xf528('0x2b')](_0x3767b3);}return _0x831ae5['save']();};}function saveUpdates(_0xc5a43c,_0x5dcd3c){return function(_0x3774a1){if(_0x3774a1){return _0x3774a1[_0xf528('0x2c')](_0xc5a43c)[_0xf528('0x1b')](function(_0x4790c6){return _0x4790c6;});}return null;};}function removeEntity(_0x4b0c96,_0x4420e3){return function(_0x12f295){if(_0x12f295){return _0x12f295[_0xf528('0x2d')]()[_0xf528('0x1b')](function(){_0x4b0c96['status'](0xcc)[_0xf528('0x27')]();});}};}function handleEntityNotFound(_0x333a21,_0x396907){return function(_0x33da35){if(!_0x33da35){_0x333a21[_0xf528('0x25')](0x194);}return _0x33da35;};}function handleError(_0x46c24d,_0x1c0de3){_0x1c0de3=_0x1c0de3||0x1f4;return function(_0x5670fa){logger[_0xf528('0x21')](_0x5670fa[_0xf528('0x2e')]);if(_0x5670fa[_0xf528('0x2f')]){delete _0x5670fa[_0xf528('0x2f')];}_0x46c24d[_0xf528('0x26')](_0x1c0de3)[_0xf528('0x30')](_0x5670fa);};}exports[_0xf528('0x31')]=function(_0x3d4fc2,_0x542436){var _0x3fc237={},_0x451965={},_0x2d8ea1={'count':0x0,'rows':[]};var _0x1a2876=_[_0xf528('0x32')](db['SugarcrmAccount'][_0xf528('0x33')],function(_0x4a5e1){return{'name':_0x4a5e1['fieldName'],'type':_0x4a5e1[_0xf528('0x34')][_0xf528('0x35')]};});_0x451965['model']=_[_0xf528('0x32')](_0x1a2876,_0xf528('0x2f'));_0x451965[_0xf528('0x36')]=_['keys'](_0x3d4fc2[_0xf528('0x36')]);_0x451965[_0xf528('0x37')]=_[_0xf528('0x38')](_0x451965[_0xf528('0x39')],_0x451965['query']);_0x3fc237['attributes']=_[_0xf528('0x38')](_0x451965[_0xf528('0x39')],qs[_0xf528('0x3a')](_0x3d4fc2[_0xf528('0x36')][_0xf528('0x3a')]));_0x3fc237[_0xf528('0x3b')]=_0x3fc237[_0xf528('0x3b')][_0xf528('0x3c')]?_0x3fc237[_0xf528('0x3b')]:_0x451965[_0xf528('0x39')];if(!_0x3d4fc2[_0xf528('0x36')][_0xf528('0x3d')]('nolimit')){_0x3fc237['limit']=qs[_0xf528('0x3e')](_0x3d4fc2[_0xf528('0x36')][_0xf528('0x3e')]);_0x3fc237['offset']=qs[_0xf528('0x3f')](_0x3d4fc2[_0xf528('0x36')][_0xf528('0x3f')]);}_0x3fc237['order']=qs['sort'](_0x3d4fc2[_0xf528('0x36')][_0xf528('0x40')]);_0x3fc237[_0xf528('0x41')]=qs[_0xf528('0x37')](_[_0xf528('0x42')](_0x3d4fc2['query'],_0x451965[_0xf528('0x37')]),_0x1a2876);if(_0x3d4fc2[_0xf528('0x36')][_0xf528('0x43')]){_0x3fc237['where']=_['merge'](_0x3fc237[_0xf528('0x41')],{'$or':_['map'](_0x1a2876,function(_0x1e38ab){if(_0x1e38ab[_0xf528('0x34')]!==_0xf528('0x44')){var _0x3385bd={};_0x3385bd[_0x1e38ab[_0xf528('0x2f')]]={'$like':'%'+_0x3d4fc2['query'][_0xf528('0x43')]+'%'};return _0x3385bd;}})});}_0x3fc237=_[_0xf528('0x45')]({},_0x3fc237,_0x3d4fc2[_0xf528('0x46')]);var _0x3a049c={'where':_0x3fc237['where']};return db[_0xf528('0x47')]['count'](_0x3a049c)[_0xf528('0x1b')](function(_0x18f720){_0x2d8ea1[_0xf528('0x48')]=_0x18f720;if(_0x3d4fc2[_0xf528('0x36')]['includeAll']){_0x3fc237['include']=[{'all':!![]}];}return db[_0xf528('0x47')][_0xf528('0x49')](_0x3fc237);})[_0xf528('0x1b')](function(_0x1da11a){_0x2d8ea1['rows']=_0x1da11a;return _0x2d8ea1;})[_0xf528('0x1b')](respondWithFilteredResult(_0x542436,_0x3fc237))[_0xf528('0x4a')](handleError(_0x542436,null));};exports[_0xf528('0x4b')]=function(_0x56b8ce,_0x1ae409){var _0xaed61b={'raw':![],'where':{'id':_0x56b8ce[_0xf528('0x4c')]['id']}},_0x38eeec={};_0x38eeec[_0xf528('0x39')]=_[_0xf528('0x4d')](db[_0xf528('0x47')][_0xf528('0x33')]);_0x38eeec[_0xf528('0x36')]=_[_0xf528('0x4d')](_0x56b8ce[_0xf528('0x36')]);_0x38eeec[_0xf528('0x37')]=_['intersection'](_0x38eeec[_0xf528('0x39')],_0x38eeec[_0xf528('0x36')]);_0xaed61b[_0xf528('0x3b')]=_[_0xf528('0x38')](_0x38eeec[_0xf528('0x39')],qs[_0xf528('0x3a')](_0x56b8ce[_0xf528('0x36')][_0xf528('0x3a')]));_0xaed61b[_0xf528('0x3b')]=_0xaed61b['attributes'][_0xf528('0x3c')]?_0xaed61b['attributes']:_0x38eeec[_0xf528('0x39')];if(_0x56b8ce[_0xf528('0x36')][_0xf528('0x4e')]){_0xaed61b[_0xf528('0x4f')]=[{'all':!![]}];}_0xaed61b=_[_0xf528('0x45')]({},_0xaed61b,_0x56b8ce[_0xf528('0x46')]);return db[_0xf528('0x47')][_0xf528('0x50')](_0xaed61b)[_0xf528('0x1b')](handleEntityNotFound(_0x1ae409,null))['then'](respondWithResult(_0x1ae409,null))[_0xf528('0x4a')](handleError(_0x1ae409,null));};exports[_0xf528('0x51')]=function(_0x3588ea,_0xc395b8){return db[_0xf528('0x47')][_0xf528('0x51')](_0x3588ea[_0xf528('0x52')],{})[_0xf528('0x1b')](respondWithResult(_0xc395b8,0xc9))[_0xf528('0x4a')](handleError(_0xc395b8,null));};exports[_0xf528('0x2c')]=function(_0x4881f0,_0x3b3950){if(_0x4881f0['body']['id']){delete _0x4881f0[_0xf528('0x52')]['id'];}return db[_0xf528('0x47')]['find']({'where':{'id':_0x4881f0[_0xf528('0x4c')]['id']}})[_0xf528('0x1b')](handleEntityNotFound(_0x3b3950,null))[_0xf528('0x1b')](saveUpdates(_0x4881f0[_0xf528('0x52')],null))['then'](respondWithResult(_0x3b3950,null))['catch'](handleError(_0x3b3950,null));};exports[_0xf528('0x2d')]=function(_0x1c2cfb,_0x105797){return db[_0xf528('0x47')][_0xf528('0x50')]({'where':{'id':_0x1c2cfb['params']['id']}})[_0xf528('0x1b')](handleEntityNotFound(_0x105797,null))[_0xf528('0x1b')](removeEntity(_0x105797,null))['catch'](handleError(_0x105797,null));};exports[_0xf528('0x53')]=function(_0x502dc3,_0x4abc05,_0x21b991){var _0x467c49={};var _0x48ae50={};var _0x56288f;var _0x2c9a30;return db[_0xf528('0x47')][_0xf528('0x54')]({'where':{'id':_0x502dc3[_0xf528('0x4c')]['id']}})[_0xf528('0x1b')](handleEntityNotFound(_0x4abc05,null))['then'](function(_0x43441c){if(_0x43441c){_0x56288f=_0x43441c;_0x48ae50[_0xf528('0x39')]=_[_0xf528('0x4d')](db[_0xf528('0x55')][_0xf528('0x33')]);_0x48ae50[_0xf528('0x36')]=_[_0xf528('0x4d')](_0x502dc3[_0xf528('0x36')]);_0x48ae50[_0xf528('0x37')]=_[_0xf528('0x38')](_0x48ae50[_0xf528('0x39')],_0x48ae50[_0xf528('0x36')]);_0x467c49[_0xf528('0x3b')]=_[_0xf528('0x38')](_0x48ae50[_0xf528('0x39')],qs[_0xf528('0x3a')](_0x502dc3['query']['fields']));_0x467c49[_0xf528('0x3b')]=_0x467c49['attributes'][_0xf528('0x3c')]?_0x467c49[_0xf528('0x3b')]:_0x48ae50[_0xf528('0x39')];_0x467c49[_0xf528('0x56')]=qs['sort'](_0x502dc3['query'][_0xf528('0x40')]);_0x467c49[_0xf528('0x41')]=qs[_0xf528('0x37')](_[_0xf528('0x42')](_0x502dc3[_0xf528('0x36')],_0x48ae50[_0xf528('0x37')]));if(_0x502dc3[_0xf528('0x36')][_0xf528('0x43')]){_0x467c49[_0xf528('0x41')]=_[_0xf528('0x45')](_0x467c49['where'],{'$or':_['map'](_0x467c49['attributes'],function(_0x97ac6c){var _0x4af59d={};_0x4af59d[_0x97ac6c]={'$like':'%'+_0x502dc3['query']['filter']+'%'};return _0x4af59d;})});}_0x467c49=_[_0xf528('0x45')]({},_0x467c49,_0x502dc3[_0xf528('0x46')]);return _0x56288f[_0xf528('0x53')](_0x467c49);}})[_0xf528('0x1b')](function(_0x21a7ff){if(_0x21a7ff){_0x2c9a30=_0x21a7ff[_0xf528('0x3c')];if(!_0x502dc3['query'][_0xf528('0x3d')]('nolimit')){_0x467c49[_0xf528('0x3e')]=qs[_0xf528('0x3e')](_0x502dc3[_0xf528('0x36')][_0xf528('0x3e')]);_0x467c49['offset']=qs[_0xf528('0x3f')](_0x502dc3[_0xf528('0x36')][_0xf528('0x3f')]);}return _0x56288f[_0xf528('0x53')](_0x467c49);}})[_0xf528('0x1b')](function(_0x4c5c2b){if(_0x4c5c2b){return _0x4c5c2b?{'count':_0x2c9a30,'rows':_0x4c5c2b}:null;}})['then'](respondWithResult(_0x4abc05,null))[_0xf528('0x4a')](handleError(_0x4abc05,null));};exports['addConfiguration']=function(_0xe40f3d,_0x285dc0,_0x57ae0a){if(_0xe40f3d[_0xf528('0x52')]['id']){delete _0xe40f3d['body']['id'];}return db['SugarcrmAccount'][_0xf528('0x54')]({'where':{'id':_0xe40f3d['params']['id']}})['then'](handleEntityNotFound(_0x285dc0,null))[_0xf528('0x1b')](function(_0x475ec8){if(_0x475ec8){_0xe40f3d['body'][_0xf528('0x57')]=_0x475ec8['id'];_0xe40f3d[_0xf528('0x52')][_0xf528('0x58')]=integrations[_0xf528('0x59')](_0xe40f3d[_0xf528('0x52')]['channel'],_0xe40f3d[_0xf528('0x52')]['type']);_0xe40f3d['body'][_0xf528('0x5a')]=integrations['getDescriptions'](_0xe40f3d[_0xf528('0x52')][_0xf528('0x5b')],_0xe40f3d['body'][_0xf528('0x34')]);return db[_0xf528('0x55')][_0xf528('0x51')](_0xe40f3d[_0xf528('0x52')],{'include':[{'model':db[_0xf528('0x5c')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':_0xf528('0x5a')}]});}return null;})[_0xf528('0x1b')](respondWithResult(_0x285dc0,null))[_0xf528('0x4a')](handleError(_0x285dc0,null));};exports[_0xf528('0x5d')]=function(_0x2588c1,_0x5b5bbb,_0x3fcd9a){var _0x4cd748='';var _0x10c4d4=['id',_0xf528('0x2f'),'assigned_user_id',_0xf528('0x5e'),_0xf528('0x5f'),_0xf528('0x60'),_0xf528('0x61'),_0xf528('0x62'),_0xf528('0x63'),_0xf528('0x64'),_0xf528('0x65'),'direction'];return db[_0xf528('0x47')][_0xf528('0x54')]({'where':{'id':_0x2588c1[_0xf528('0x4c')]['id']},'attributes':['id',_0xf528('0x66'),_0xf528('0x67'),_0xf528('0x68')]})[_0xf528('0x1b')](handleEntityNotFound(_0x5b5bbb,null))[_0xf528('0x1b')](function(_0x242849){if(_0x242849){_0x4cd748=_0x242849['remoteUri'];var _0x4a0b85=_0x4cd748[_0xf528('0x69')](-0x1);if(_0x4a0b85==='/'){_0x4cd748=_0x4cd748['substring'](0x0,_0x4cd748[_0xf528('0x6a')](_0x4a0b85));}return rp({'method':_0xf528('0x6b'),'uri':util['format']('%s%s',_0x4cd748,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xf528('0x6c'),'input_type':'JSON','response_type':_0xf528('0x6d'),'rest_data':JSON[_0xf528('0x20')]({'user_auth':{'user_name':_0x242849[_0xf528('0x66')],'password':_0x242849[_0xf528('0x67')],'encryption':'PLAIN'},'application':_0xf528('0x6e')})}});}})[_0xf528('0x1b')](function(_0x44a8f0){if(_0x44a8f0&&_0x44a8f0[_0xf528('0x2f')]!==_0xf528('0x6f')&&_0x44a8f0[_0xf528('0x2f')]!==_0xf528('0x70')){return rp({'method':'POST','uri':util['format'](_0xf528('0x71'),_0x4cd748,_0xf528('0x72')),'json':!![],'form':{'method':_0xf528('0x73'),'input_type':_0xf528('0x6d'),'response_type':_0xf528('0x6d'),'rest_data':JSON[_0xf528('0x20')]({'session':_0x44a8f0['id'],'module_name':'Calls'})}})[_0xf528('0x1b')](function(_0x4d4b9d){if(_0x4d4b9d){var _0x523f39=_[_0xf528('0x74')](_0x4d4b9d[_0xf528('0x75')]);_[_0xf528('0x76')](_0x523f39,function(_0x4b9332){return _0x10c4d4['includes'](_0x4b9332[_0xf528('0x2f')]);});return{'count':_0x523f39[_0xf528('0x3c')],'rows':_[_0xf528('0x32')](_0x523f39,function(_0x487e73){return{'id':_0x487e73[_0xf528('0x2f')],'name':_0x487e73[_0xf528('0x77')],'custom':_[_0xf528('0x78')](_0x487e73[_0xf528('0x2f')],'_c')?!![]:![],'options':_0x487e73[_0xf528('0x46')]?_[_0xf528('0x32')](_[_0xf528('0x74')](_0x487e73[_0xf528('0x46')]),function(_0x44c9b7){return{'name':_0x44c9b7['value'],'value':_0x44c9b7[_0xf528('0x2f')]};}):[]};})};}})[_0xf528('0x1b')](respondWithResult(_0x5b5bbb,null))[_0xf528('0x4a')](function(_0x2df10e){var _0x5e5691=_0x2588c1['query'][_0xf528('0x79')]?0x1f4:_0x2df10e[_0xf528('0x7a')]||0x1f4;logger[_0xf528('0x21')](_0xf528('0x7b'),_0xf528('0x5d'),_0x5e5691,JSON[_0xf528('0x20')](_0x2df10e));delete _0x2df10e[_0xf528('0x2f')];if(_0x5e5691===0x191){_0x5e5691=0x190;}_0x5b5bbb['status'](_0x5e5691)['send'](_0x2588c1[_0xf528('0x36')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x2df10e[_0xf528('0x7a')]}:_0x2df10e);});}else{var _0x12486a=0x1f4;_0x5b5bbb[_0xf528('0x26')](_0x12486a)[_0xf528('0x30')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x3c65=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','reject','save','end','stack','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','VIRTUAL','name','merge','options','SugarcrmAccount','includeAll','include','findAll','params','find','create','update','body','destroy','findOne','order','pick','hasOwnProperty','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmConfiguration','SugarcrmField','created_by','duration_hours','parent_name','username','remoteUri','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','module_fields','includes','label','values','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','send','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js'];(function(_0x232134,_0x29bee1){var _0x5ed5b3=function(_0x4104c0){while(--_0x4104c0){_0x232134['push'](_0x232134['shift']());}};_0x5ed5b3(++_0x29bee1);}(_0x3c65,0xed));var _0x53c6=function(_0x421eeb,_0x3d3e3e){_0x421eeb=_0x421eeb-0x0;var _0x2c7371=_0x3c65[_0x421eeb];return _0x2c7371;};'use strict';var emlformat=require(_0x53c6('0x0'));var rimraf=require(_0x53c6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x53c6('0x2'));var rp=require(_0x53c6('0x3'));var moment=require('moment');var BPromise=require(_0x53c6('0x4'));var Mustache=require(_0x53c6('0x5'));var util=require(_0x53c6('0x6'));var path=require(_0x53c6('0x7'));var sox=require(_0x53c6('0x8'));var csv=require(_0x53c6('0x9'));var ejs=require(_0x53c6('0xa'));var fs=require('fs');var fs_extra=require(_0x53c6('0xb'));var _=require('lodash');var squel=require(_0x53c6('0xc'));var crypto=require('crypto');var jsforce=require(_0x53c6('0xd'));var deskjs=require(_0x53c6('0xe'));var toCsv=require(_0x53c6('0x9'));var querystring=require(_0x53c6('0xf'));var Papa=require(_0x53c6('0x10'));var Redis=require(_0x53c6('0x11'));var authService=require(_0x53c6('0x12'));var qs=require(_0x53c6('0x13'));var as=require(_0x53c6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x53c6('0x15'));var utils=require(_0x53c6('0x16'));var config=require(_0x53c6('0x17'));var licenseUtil=require(_0x53c6('0x18'));var db=require(_0x53c6('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x53c6('0x1a'));var client=jayson[_0x53c6('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ba965,_0x336774,_0x1b3b56,_0x138d49){return new BPromise(function(_0x224e78,_0x47d50e){var _0x867cab=_0x138d49||client;return _0x867cab[_0x53c6('0x1c')](_0x1ba965,_0x1b3b56)[_0x53c6('0x1d')](function(_0x5d9055){logger[_0x53c6('0x1e')](_0x53c6('0x1f'),_0x336774,_0x53c6('0x20'));logger[_0x53c6('0x21')](_0x53c6('0x22'),_0x336774,_0x53c6('0x20'),JSON[_0x53c6('0x23')](_0x5d9055));if(_0x5d9055[_0x53c6('0x24')]){if(_0x5d9055[_0x53c6('0x24')][_0x53c6('0x25')]===0x1f4){logger[_0x53c6('0x24')](_0x53c6('0x1f'),_0x336774,_0x5d9055['error']['message']);return _0x47d50e(_0x5d9055[_0x53c6('0x24')]['message']);}logger[_0x53c6('0x24')](_0x53c6('0x1f'),_0x336774,_0x5d9055[_0x53c6('0x24')]['message']);return _0x224e78(_0x5d9055['error'][_0x53c6('0x26')]);}else{logger[_0x53c6('0x1e')](_0x53c6('0x1f'),_0x336774,_0x53c6('0x20'));_0x224e78(_0x5d9055[_0x53c6('0x27')][_0x53c6('0x26')]);}})[_0x53c6('0x28')](function(_0x18b1fd){logger[_0x53c6('0x24')](_0x53c6('0x1f'),_0x336774,_0x18b1fd);_0x47d50e(_0x18b1fd);});});}function respondWithStatusCode(_0x44d32a,_0x393d40){_0x393d40=_0x393d40||0xcc;return function(_0x547443){if(_0x547443){return _0x44d32a[_0x53c6('0x29')](_0x393d40);}return _0x44d32a[_0x53c6('0x2a')](_0x393d40)['end']();};}function respondWithResult(_0x5545e6,_0x8154af){_0x8154af=_0x8154af||0xc8;return function(_0x29fc05){if(_0x29fc05){return _0x5545e6[_0x53c6('0x2a')](_0x8154af)[_0x53c6('0x2b')](_0x29fc05);}};}function respondWithFilteredResult(_0x5512fa,_0x3a1ce0){return function(_0x30af3d){if(_0x30af3d){var _0x40b679=_0x30af3d[_0x53c6('0x2c')],_0x6d0b32=_0x3a1ce0[_0x53c6('0x2d')],_0x732fa2=_0x3a1ce0['offset']+_0x3a1ce0[_0x53c6('0x2e')],_0x3c0a9f;if(_0x732fa2>=_0x40b679){_0x732fa2=_0x40b679;_0x3c0a9f=0xc8;}else{_0x3c0a9f=0xce;}_0x5512fa[_0x53c6('0x2a')](_0x3c0a9f);return _0x5512fa[_0x53c6('0x2f')]('Content-Range',_0x6d0b32+'-'+_0x732fa2+'/'+_0x40b679)[_0x53c6('0x2b')](_0x30af3d);}return null;};}function patchUpdates(_0x15c7c7){return function(_0x4df9d0){try{jsonpatch['apply'](_0x4df9d0,_0x15c7c7,!![]);}catch(_0x474dc0){return BPromise[_0x53c6('0x30')](_0x474dc0);}return _0x4df9d0[_0x53c6('0x31')]();};}function saveUpdates(_0xe36a54,_0x5aafb7){return function(_0x3fa816){if(_0x3fa816){return _0x3fa816['update'](_0xe36a54)[_0x53c6('0x1d')](function(_0x1cf5dd){return _0x1cf5dd;});}return null;};}function removeEntity(_0x43af9a,_0x4c0f02){return function(_0x1fe8eb){if(_0x1fe8eb){return _0x1fe8eb['destroy']()[_0x53c6('0x1d')](function(){_0x43af9a['status'](0xcc)[_0x53c6('0x32')]();});}};}function handleEntityNotFound(_0x1c4073,_0x4d50cd){return function(_0x4f9594){if(!_0x4f9594){_0x1c4073[_0x53c6('0x29')](0x194);}return _0x4f9594;};}function handleError(_0x14a670,_0x188b2b){_0x188b2b=_0x188b2b||0x1f4;return function(_0x4a272b){logger[_0x53c6('0x24')](_0x4a272b[_0x53c6('0x33')]);if(_0x4a272b['name']){delete _0x4a272b['name'];}_0x14a670[_0x53c6('0x2a')](_0x188b2b)['send'](_0x4a272b);};}exports[_0x53c6('0x34')]=function(_0x5af32b,_0x3c81f2){var _0x5e4b79={},_0x38afc3={},_0x517d3b={'count':0x0,'rows':[]};var _0x184914=_[_0x53c6('0x35')](db['SugarcrmAccount'][_0x53c6('0x36')],function(_0x56babc){return{'name':_0x56babc[_0x53c6('0x37')],'type':_0x56babc[_0x53c6('0x38')][_0x53c6('0x39')]};});_0x38afc3[_0x53c6('0x3a')]=_['map'](_0x184914,'name');_0x38afc3[_0x53c6('0x3b')]=_[_0x53c6('0x3c')](_0x5af32b[_0x53c6('0x3b')]);_0x38afc3[_0x53c6('0x3d')]=_[_0x53c6('0x3e')](_0x38afc3[_0x53c6('0x3a')],_0x38afc3['query']);_0x5e4b79[_0x53c6('0x3f')]=_[_0x53c6('0x3e')](_0x38afc3[_0x53c6('0x3a')],qs[_0x53c6('0x40')](_0x5af32b[_0x53c6('0x3b')][_0x53c6('0x40')]));_0x5e4b79[_0x53c6('0x3f')]=_0x5e4b79[_0x53c6('0x3f')][_0x53c6('0x41')]?_0x5e4b79[_0x53c6('0x3f')]:_0x38afc3[_0x53c6('0x3a')];if(!_0x5af32b[_0x53c6('0x3b')]['hasOwnProperty'](_0x53c6('0x42'))){_0x5e4b79[_0x53c6('0x2e')]=qs[_0x53c6('0x2e')](_0x5af32b[_0x53c6('0x3b')][_0x53c6('0x2e')]);_0x5e4b79[_0x53c6('0x2d')]=qs['offset'](_0x5af32b[_0x53c6('0x3b')][_0x53c6('0x2d')]);}_0x5e4b79['order']=qs['sort'](_0x5af32b['query'][_0x53c6('0x43')]);_0x5e4b79[_0x53c6('0x44')]=qs[_0x53c6('0x3d')](_['pick'](_0x5af32b[_0x53c6('0x3b')],_0x38afc3[_0x53c6('0x3d')]),_0x184914);if(_0x5af32b[_0x53c6('0x3b')][_0x53c6('0x45')]){_0x5e4b79[_0x53c6('0x44')]=_['merge'](_0x5e4b79[_0x53c6('0x44')],{'$or':_['map'](_0x184914,function(_0x912cd9){if(_0x912cd9['type']!==_0x53c6('0x46')){var _0x520940={};_0x520940[_0x912cd9[_0x53c6('0x47')]]={'$like':'%'+_0x5af32b[_0x53c6('0x3b')][_0x53c6('0x45')]+'%'};return _0x520940;}})});}_0x5e4b79=_[_0x53c6('0x48')]({},_0x5e4b79,_0x5af32b[_0x53c6('0x49')]);var _0x279bf1={'where':_0x5e4b79['where']};return db[_0x53c6('0x4a')][_0x53c6('0x2c')](_0x279bf1)[_0x53c6('0x1d')](function(_0x175dd1){_0x517d3b['count']=_0x175dd1;if(_0x5af32b['query'][_0x53c6('0x4b')]){_0x5e4b79[_0x53c6('0x4c')]=[{'all':!![]}];}return db[_0x53c6('0x4a')][_0x53c6('0x4d')](_0x5e4b79);})[_0x53c6('0x1d')](function(_0x5761f4){_0x517d3b['rows']=_0x5761f4;return _0x517d3b;})[_0x53c6('0x1d')](respondWithFilteredResult(_0x3c81f2,_0x5e4b79))['catch'](handleError(_0x3c81f2,null));};exports['show']=function(_0x2080ee,_0x1a60ee){var _0x55ae35={'raw':![],'where':{'id':_0x2080ee[_0x53c6('0x4e')]['id']}},_0x4e92c7={};_0x4e92c7[_0x53c6('0x3a')]=_[_0x53c6('0x3c')](db[_0x53c6('0x4a')][_0x53c6('0x36')]);_0x4e92c7[_0x53c6('0x3b')]=_['keys'](_0x2080ee['query']);_0x4e92c7[_0x53c6('0x3d')]=_['intersection'](_0x4e92c7[_0x53c6('0x3a')],_0x4e92c7[_0x53c6('0x3b')]);_0x55ae35[_0x53c6('0x3f')]=_[_0x53c6('0x3e')](_0x4e92c7['model'],qs[_0x53c6('0x40')](_0x2080ee[_0x53c6('0x3b')][_0x53c6('0x40')]));_0x55ae35['attributes']=_0x55ae35['attributes'][_0x53c6('0x41')]?_0x55ae35[_0x53c6('0x3f')]:_0x4e92c7['model'];if(_0x2080ee[_0x53c6('0x3b')]['includeAll']){_0x55ae35[_0x53c6('0x4c')]=[{'all':!![]}];}_0x55ae35=_[_0x53c6('0x48')]({},_0x55ae35,_0x2080ee[_0x53c6('0x49')]);return db['SugarcrmAccount'][_0x53c6('0x4f')](_0x55ae35)[_0x53c6('0x1d')](handleEntityNotFound(_0x1a60ee,null))[_0x53c6('0x1d')](respondWithResult(_0x1a60ee,null))[_0x53c6('0x28')](handleError(_0x1a60ee,null));};exports[_0x53c6('0x50')]=function(_0x4697df,_0x43a913){return db['SugarcrmAccount']['create'](_0x4697df['body'],{})[_0x53c6('0x1d')](respondWithResult(_0x43a913,0xc9))[_0x53c6('0x28')](handleError(_0x43a913,null));};exports[_0x53c6('0x51')]=function(_0x37d6b4,_0x3e8276){if(_0x37d6b4[_0x53c6('0x52')]['id']){delete _0x37d6b4[_0x53c6('0x52')]['id'];}return db[_0x53c6('0x4a')][_0x53c6('0x4f')]({'where':{'id':_0x37d6b4[_0x53c6('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3e8276,null))['then'](saveUpdates(_0x37d6b4[_0x53c6('0x52')],null))[_0x53c6('0x1d')](respondWithResult(_0x3e8276,null))[_0x53c6('0x28')](handleError(_0x3e8276,null));};exports[_0x53c6('0x53')]=function(_0x5dd1f8,_0x2bb15d){return db[_0x53c6('0x4a')][_0x53c6('0x4f')]({'where':{'id':_0x5dd1f8[_0x53c6('0x4e')]['id']}})[_0x53c6('0x1d')](handleEntityNotFound(_0x2bb15d,null))[_0x53c6('0x1d')](removeEntity(_0x2bb15d,null))[_0x53c6('0x28')](handleError(_0x2bb15d,null));};exports['getConfigurations']=function(_0x5660b9,_0xffb3be,_0x3d5be1){var _0x4559e0={};var _0x17329d={};var _0x340d4b;var _0x38462b;return db[_0x53c6('0x4a')][_0x53c6('0x54')]({'where':{'id':_0x5660b9[_0x53c6('0x4e')]['id']}})[_0x53c6('0x1d')](handleEntityNotFound(_0xffb3be,null))['then'](function(_0x50d899){if(_0x50d899){_0x340d4b=_0x50d899;_0x17329d[_0x53c6('0x3a')]=_[_0x53c6('0x3c')](db['SugarcrmConfiguration'][_0x53c6('0x36')]);_0x17329d[_0x53c6('0x3b')]=_[_0x53c6('0x3c')](_0x5660b9[_0x53c6('0x3b')]);_0x17329d[_0x53c6('0x3d')]=_[_0x53c6('0x3e')](_0x17329d[_0x53c6('0x3a')],_0x17329d['query']);_0x4559e0[_0x53c6('0x3f')]=_[_0x53c6('0x3e')](_0x17329d[_0x53c6('0x3a')],qs[_0x53c6('0x40')](_0x5660b9[_0x53c6('0x3b')][_0x53c6('0x40')]));_0x4559e0[_0x53c6('0x3f')]=_0x4559e0[_0x53c6('0x3f')][_0x53c6('0x41')]?_0x4559e0[_0x53c6('0x3f')]:_0x17329d[_0x53c6('0x3a')];_0x4559e0[_0x53c6('0x55')]=qs['sort'](_0x5660b9[_0x53c6('0x3b')][_0x53c6('0x43')]);_0x4559e0[_0x53c6('0x44')]=qs[_0x53c6('0x3d')](_[_0x53c6('0x56')](_0x5660b9[_0x53c6('0x3b')],_0x17329d['filters']));if(_0x5660b9['query']['filter']){_0x4559e0[_0x53c6('0x44')]=_[_0x53c6('0x48')](_0x4559e0[_0x53c6('0x44')],{'$or':_['map'](_0x4559e0[_0x53c6('0x3f')],function(_0x4f27f2){var _0x114e88={};_0x114e88[_0x4f27f2]={'$like':'%'+_0x5660b9[_0x53c6('0x3b')][_0x53c6('0x45')]+'%'};return _0x114e88;})});}_0x4559e0=_['merge']({},_0x4559e0,_0x5660b9[_0x53c6('0x49')]);return _0x340d4b['getConfigurations'](_0x4559e0);}})['then'](function(_0x368b2a){if(_0x368b2a){_0x38462b=_0x368b2a[_0x53c6('0x41')];if(!_0x5660b9[_0x53c6('0x3b')][_0x53c6('0x57')](_0x53c6('0x42'))){_0x4559e0[_0x53c6('0x2e')]=qs['limit'](_0x5660b9[_0x53c6('0x3b')][_0x53c6('0x2e')]);_0x4559e0['offset']=qs[_0x53c6('0x2d')](_0x5660b9['query'][_0x53c6('0x2d')]);}return _0x340d4b[_0x53c6('0x58')](_0x4559e0);}})[_0x53c6('0x1d')](function(_0x3f6f28){if(_0x3f6f28){return _0x3f6f28?{'count':_0x38462b,'rows':_0x3f6f28}:null;}})['then'](respondWithResult(_0xffb3be,null))[_0x53c6('0x28')](handleError(_0xffb3be,null));};exports[_0x53c6('0x59')]=function(_0x113704,_0x451a8f,_0x73df9f){if(_0x113704[_0x53c6('0x52')]['id']){delete _0x113704[_0x53c6('0x52')]['id'];}return db['SugarcrmAccount'][_0x53c6('0x54')]({'where':{'id':_0x113704[_0x53c6('0x4e')]['id']}})[_0x53c6('0x1d')](handleEntityNotFound(_0x451a8f,null))['then'](function(_0x42ea82){if(_0x42ea82){_0x113704[_0x53c6('0x52')][_0x53c6('0x5a')]=_0x42ea82['id'];_0x113704[_0x53c6('0x52')][_0x53c6('0x5b')]=integrations[_0x53c6('0x5c')](_0x113704[_0x53c6('0x52')]['channel'],_0x113704[_0x53c6('0x52')][_0x53c6('0x38')]);_0x113704[_0x53c6('0x52')][_0x53c6('0x5d')]=integrations[_0x53c6('0x5e')](_0x113704[_0x53c6('0x52')][_0x53c6('0x5f')],_0x113704[_0x53c6('0x52')][_0x53c6('0x38')]);return db[_0x53c6('0x60')][_0x53c6('0x50')](_0x113704[_0x53c6('0x52')],{'include':[{'model':db[_0x53c6('0x61')],'as':_0x53c6('0x5b')},{'model':db[_0x53c6('0x61')],'as':_0x53c6('0x5d')}]});}return null;})[_0x53c6('0x1d')](respondWithResult(_0x451a8f,null))[_0x53c6('0x28')](handleError(_0x451a8f,null));};exports['getFields']=function(_0x266fdc,_0x4b1eb1,_0x13fa8b){var _0x573a4f='';var _0x14b816=['id','name','assigned_user_id',_0x53c6('0x62'),'description','date_start',_0x53c6('0x63'),'duration_minutes','parent_id','parent_type',_0x53c6('0x64'),'direction'];return db[_0x53c6('0x4a')][_0x53c6('0x54')]({'where':{'id':_0x266fdc['params']['id']},'attributes':['id',_0x53c6('0x65'),'password',_0x53c6('0x66')]})[_0x53c6('0x1d')](handleEntityNotFound(_0x4b1eb1,null))['then'](function(_0x518d44){if(_0x518d44){_0x573a4f=_0x518d44[_0x53c6('0x66')];var _0x420c65=_0x573a4f['slice'](-0x1);if(_0x420c65==='/'){_0x573a4f=_0x573a4f['substring'](0x0,_0x573a4f[_0x53c6('0x67')](_0x420c65));}return rp({'method':_0x53c6('0x68'),'uri':util[_0x53c6('0x69')](_0x53c6('0x6a'),_0x573a4f,_0x53c6('0x6b')),'json':!![],'form':{'method':_0x53c6('0x6c'),'input_type':_0x53c6('0x6d'),'response_type':_0x53c6('0x6d'),'rest_data':JSON[_0x53c6('0x23')]({'user_auth':{'user_name':_0x518d44['username'],'password':_0x518d44[_0x53c6('0x6e')],'encryption':_0x53c6('0x6f')},'application':_0x53c6('0x70')})}});}})['then'](function(_0x1458da){if(_0x1458da&&_0x1458da[_0x53c6('0x47')]!==_0x53c6('0x71')&&_0x1458da[_0x53c6('0x47')]!==_0x53c6('0x72')){return rp({'method':'POST','uri':util[_0x53c6('0x69')]('%s%s',_0x573a4f,_0x53c6('0x6b')),'json':!![],'form':{'method':_0x53c6('0x73'),'input_type':'JSON','response_type':_0x53c6('0x6d'),'rest_data':JSON[_0x53c6('0x23')]({'session':_0x1458da['id'],'module_name':'Calls'})}})[_0x53c6('0x1d')](function(_0x5ddc88){if(_0x5ddc88){var _0x1cf773=_['values'](_0x5ddc88[_0x53c6('0x74')]);_['remove'](_0x1cf773,function(_0x5eba78){return _0x14b816[_0x53c6('0x75')](_0x5eba78[_0x53c6('0x47')]);});return{'count':_0x1cf773[_0x53c6('0x41')],'rows':_['map'](_0x1cf773,function(_0x2db94d){return{'id':_0x2db94d[_0x53c6('0x47')],'name':_0x2db94d[_0x53c6('0x76')],'custom':_['endsWith'](_0x2db94d[_0x53c6('0x47')],'_c')?!![]:![],'options':_0x2db94d[_0x53c6('0x49')]?_[_0x53c6('0x35')](_[_0x53c6('0x77')](_0x2db94d[_0x53c6('0x49')]),function(_0x15ea64){return{'name':_0x15ea64[_0x53c6('0x78')],'value':_0x15ea64[_0x53c6('0x47')]};}):[]};})};}})[_0x53c6('0x1d')](respondWithResult(_0x4b1eb1,null))['catch'](function(_0x5d60a0){var _0x29488a=_0x266fdc[_0x53c6('0x3b')]['test']?0x1f4:_0x5d60a0[_0x53c6('0x79')]||0x1f4;logger[_0x53c6('0x24')](_0x53c6('0x7a'),_0x53c6('0x7b'),_0x29488a,JSON[_0x53c6('0x23')](_0x5d60a0));delete _0x5d60a0[_0x53c6('0x47')];if(_0x29488a===0x191){_0x29488a=0x190;}_0x4b1eb1[_0x53c6('0x2a')](_0x29488a)['send'](_0x266fdc['query']['test']?{'message':_0x53c6('0x7c'),'statusCode':_0x5d60a0[_0x53c6('0x79')]}:_0x5d60a0);});}else{var _0x14c992=0x1f4;_0x4b1eb1[_0x53c6('0x2a')](_0x14c992)[_0x53c6('0x7d')]({'message':_0x53c6('0x7c'),'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 6b37831..3bd5711 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 _0xf71f=['api','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util'];(function(_0x4d7ce7,_0x365efd){var _0x379fb7=function(_0x1887b1){while(--_0x1887b1){_0x4d7ce7['push'](_0x4d7ce7['shift']());}};_0x379fb7(++_0x365efd);}(_0xf71f,0x1ab));var _0xff71=function(_0x5c77ee,_0x2dfefe){_0x5c77ee=_0x5c77ee-0x0;var _0x39d243=_0xf71f[_0x5c77ee];return _0x39d243;};'use strict';var _=require(_0xff71('0x0'));var util=require(_0xff71('0x1'));var logger=require('../../config/logger')(_0xff71('0x2'));var moment=require(_0xff71('0x3'));var BPromise=require(_0xff71('0x4'));var rp=require(_0xff71('0x5'));var fs=require('fs');var path=require(_0xff71('0x6'));var rimraf=require('rimraf');var config=require(_0xff71('0x7'));var attributes=require(_0xff71('0x8'));var integrations=require(_0xff71('0x9'));module[_0xff71('0xa')]=function(_0xf4a368,_0x4b86f4){return _0xf4a368['define'](_0xff71('0xb'),attributes,{'tableName':_0xff71('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0724=['util','../../config/logger','api','path','rimraf','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash'];(function(_0x34ad5c,_0x1ae6b2){var _0x1746b6=function(_0x51e699){while(--_0x51e699){_0x34ad5c['push'](_0x34ad5c['shift']());}};_0x1746b6(++_0x1ae6b2);}(_0x0724,0x18b));var _0x4072=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0724[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x4072('0x0'));var util=require(_0x4072('0x1'));var logger=require(_0x4072('0x2'))(_0x4072('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4072('0x4'));var rimraf=require(_0x4072('0x5'));var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x4072('0x6'));module[_0x4072('0x7')]=function(_0x49d99f,_0x5ae6ae){return _0x49d99f[_0x4072('0x8')](_0x4072('0x9'),attributes,{'tableName':_0x4072('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 238a746..ffd5398 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 _0x744a=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','message','SugarcrmAccount,\x20%s,\x20%s','result','GetSugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowSugarcrmAccount','SugarcrmAccount','find','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x41214e,_0x50e1bf){var _0x329a78=function(_0x37e20d){while(--_0x37e20d){_0x41214e['push'](_0x41214e['shift']());}};_0x329a78(++_0x50e1bf);}(_0x744a,0x68));var _0xa744=function(_0x1aef65,_0x521e60){_0x1aef65=_0x1aef65-0x0;var _0x4a4594=_0x744a[_0x1aef65];return _0x4a4594;};'use strict';var _=require(_0xa744('0x0'));var util=require(_0xa744('0x1'));var moment=require('moment');var BPromise=require(_0xa744('0x2'));var rs=require(_0xa744('0x3'));var fs=require('fs');var Redis=require(_0xa744('0x4'));var db=require(_0xa744('0x5'))['db'];var utils=require(_0xa744('0x6'));var logger=require('../../config/logger')(_0xa744('0x7'));var config=require(_0xa744('0x8'));var jayson=require(_0xa744('0x9'));var client=jayson[_0xa744('0xa')][_0xa744('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xafab30,_0x360492,_0x77fb6f){return new BPromise(function(_0x3a2eef,_0x122e15){return client[_0xa744('0xc')](_0xafab30,_0x77fb6f)['then'](function(_0x136944){logger[_0xa744('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x360492,_0xa744('0xe'));logger[_0xa744('0xf')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x360492,_0xa744('0xe'),JSON[_0xa744('0x10')](_0x136944));if(_0x136944['error']){if(_0x136944[_0xa744('0x11')][_0xa744('0x12')]===0x1f4){logger[_0xa744('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x360492,_0x136944[_0xa744('0x11')]['message']);return _0x122e15(_0x136944[_0xa744('0x11')][_0xa744('0x13')]);}logger[_0xa744('0x11')](_0xa744('0x14'),_0x360492,_0x136944['error'][_0xa744('0x13')]);return _0x3a2eef(_0x136944['error'][_0xa744('0x13')]);}else{logger[_0xa744('0xd')](_0xa744('0x14'),_0x360492,_0xa744('0xe'));_0x3a2eef(_0x136944[_0xa744('0x15')][_0xa744('0x13')]);}})['catch'](function(_0x2a0dd0){logger[_0xa744('0x11')](_0xa744('0x14'),_0x360492,_0x2a0dd0);_0x122e15(_0x2a0dd0);});});}exports[_0xa744('0x16')]=function(_0x55d13a){var _0x5c4fa5=this;return new Promise(function(_0x5c8f1e,_0x3fb4db){return db['SugarcrmAccount'][_0xa744('0x17')]({'raw':_0x55d13a[_0xa744('0x18')]?_0x55d13a['options'][_0xa744('0x19')]===undefined?!![]:![]:!![],'where':_0x55d13a['options']?_0x55d13a[_0xa744('0x18')][_0xa744('0x1a')]||null:null,'attributes':_0x55d13a[_0xa744('0x18')]?_0x55d13a[_0xa744('0x18')][_0xa744('0x1b')]||null:null,'limit':_0x55d13a[_0xa744('0x18')]?_0x55d13a['options'][_0xa744('0x1c')]||null:null,'include':_0x55d13a[_0xa744('0x18')]?_0x55d13a[_0xa744('0x18')][_0xa744('0x1d')]?_[_0xa744('0x1e')](_0x55d13a[_0xa744('0x18')][_0xa744('0x1d')],function(_0x3a5299){return{'model':db[_0x3a5299[_0xa744('0x1f')]],'as':_0x3a5299['as'],'attributes':_0x3a5299[_0xa744('0x1b')],'include':_0x3a5299[_0xa744('0x1d')]?_[_0xa744('0x1e')](_0x3a5299[_0xa744('0x1d')],function(_0x36573c){return{'model':db[_0x36573c['model']],'as':_0x36573c['as'],'attributes':_0x36573c[_0xa744('0x1b')],'include':_0x36573c[_0xa744('0x1d')]?_[_0xa744('0x1e')](_0x36573c[_0xa744('0x1d')],function(_0x51b71d){return{'model':db[_0x51b71d['model']],'as':_0x51b71d['as'],'attributes':_0x51b71d[_0xa744('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa744('0x20')](function(_0x4f9c8e){logger['info'](_0xa744('0x16'),_0x55d13a);logger[_0xa744('0xf')](_0xa744('0x16'),_0x55d13a,JSON['stringify'](_0x4f9c8e));_0x5c8f1e(_0x4f9c8e);})['catch'](function(_0x416397){logger[_0xa744('0x11')](_0xa744('0x16'),_0x416397[_0xa744('0x13')],_0x55d13a);_0x3fb4db(_0x5c4fa5['error'](0x1f4,_0x416397[_0xa744('0x13')]));});});};exports[_0xa744('0x21')]=function(_0x5e5763){var _0x2734dc=this;return new Promise(function(_0x5c76fc,_0x352067){return db[_0xa744('0x22')][_0xa744('0x23')]({'raw':_0x5e5763['options']?_0x5e5763[_0xa744('0x18')][_0xa744('0x19')]===undefined?!![]:![]:!![],'where':_0x5e5763['options']?_0x5e5763['options'][_0xa744('0x1a')]||null:null,'attributes':_0x5e5763[_0xa744('0x18')]?_0x5e5763[_0xa744('0x18')]['attributes']||null:null,'include':_0x5e5763[_0xa744('0x18')]?_0x5e5763[_0xa744('0x18')][_0xa744('0x1d')]?_[_0xa744('0x1e')](_0x5e5763[_0xa744('0x18')][_0xa744('0x1d')],function(_0x270217){return{'model':db[_0x270217[_0xa744('0x1f')]],'as':_0x270217['as'],'attributes':_0x270217[_0xa744('0x1b')],'include':_0x270217[_0xa744('0x1d')]?_[_0xa744('0x1e')](_0x270217['include'],function(_0x3fd79e){return{'model':db[_0x3fd79e[_0xa744('0x1f')]],'as':_0x3fd79e['as'],'attributes':_0x3fd79e['attributes'],'include':_0x3fd79e[_0xa744('0x1d')]?_[_0xa744('0x1e')](_0x3fd79e[_0xa744('0x1d')],function(_0x537bee){return{'model':db[_0x537bee['model']],'as':_0x537bee['as'],'attributes':_0x537bee['attributes']};}):[]};}):[]};}):[]:[]})[_0xa744('0x20')](function(_0x11eadb){logger['info'](_0xa744('0x21'),_0x5e5763);logger[_0xa744('0xf')]('ShowSugarcrmAccount',_0x5e5763,JSON[_0xa744('0x10')](_0x11eadb));_0x5c76fc(_0x11eadb);})[_0xa744('0x24')](function(_0x1cb3ea){logger[_0xa744('0x11')](_0xa744('0x21'),_0x1cb3ea[_0xa744('0x13')],_0x5e5763);_0x352067(_0x2734dc[_0xa744('0x11')](0x1f4,_0x1cb3ea[_0xa744('0x13')]));});});}; \ No newline at end of file +var _0x6e25=['lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','include','model','map','ShowSugarcrmAccount','find'];(function(_0x399e13,_0x574c1f){var _0x2a695b=function(_0x4b82a0){while(--_0x4b82a0){_0x399e13['push'](_0x399e13['shift']());}};_0x2a695b(++_0x574c1f);}(_0x6e25,0x1a4));var _0x56e2=function(_0x266ddc,_0x45aa52){_0x266ddc=_0x266ddc-0x0;var _0x39c1d7=_0x6e25[_0x266ddc];return _0x39c1d7;};'use strict';var _=require(_0x56e2('0x0'));var util=require('util');var moment=require(_0x56e2('0x1'));var BPromise=require(_0x56e2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56e2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x56e2('0x4'));var logger=require(_0x56e2('0x5'))(_0x56e2('0x6'));var config=require(_0x56e2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x56e2('0x8')][_0x56e2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f9f88,_0x5023d3,_0x244b1f){return new BPromise(function(_0x1a60cf,_0x4133a3){return client[_0x56e2('0xa')](_0x1f9f88,_0x244b1f)[_0x56e2('0xb')](function(_0x196f7d){logger[_0x56e2('0xc')](_0x56e2('0xd'),_0x5023d3,_0x56e2('0xe'));logger[_0x56e2('0xf')](_0x56e2('0x10'),_0x5023d3,_0x56e2('0xe'),JSON[_0x56e2('0x11')](_0x196f7d));if(_0x196f7d[_0x56e2('0x12')]){if(_0x196f7d[_0x56e2('0x12')][_0x56e2('0x13')]===0x1f4){logger[_0x56e2('0x12')](_0x56e2('0xd'),_0x5023d3,_0x196f7d[_0x56e2('0x12')][_0x56e2('0x14')]);return _0x4133a3(_0x196f7d[_0x56e2('0x12')][_0x56e2('0x14')]);}logger[_0x56e2('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x5023d3,_0x196f7d[_0x56e2('0x12')]['message']);return _0x1a60cf(_0x196f7d['error'][_0x56e2('0x14')]);}else{logger['info'](_0x56e2('0xd'),_0x5023d3,_0x56e2('0xe'));_0x1a60cf(_0x196f7d[_0x56e2('0x15')][_0x56e2('0x14')]);}})[_0x56e2('0x16')](function(_0x4048c9){logger[_0x56e2('0x12')](_0x56e2('0xd'),_0x5023d3,_0x4048c9);_0x4133a3(_0x4048c9);});});}exports[_0x56e2('0x17')]=function(_0x3e47a0){var _0x392305=this;return new Promise(function(_0x8f044a,_0x5f24bf){return db[_0x56e2('0x18')][_0x56e2('0x19')]({'raw':_0x3e47a0['options']?_0x3e47a0[_0x56e2('0x1a')][_0x56e2('0x1b')]===undefined?!![]:![]:!![],'where':_0x3e47a0[_0x56e2('0x1a')]?_0x3e47a0[_0x56e2('0x1a')][_0x56e2('0x1c')]||null:null,'attributes':_0x3e47a0['options']?_0x3e47a0[_0x56e2('0x1a')][_0x56e2('0x1d')]||null:null,'limit':_0x3e47a0['options']?_0x3e47a0[_0x56e2('0x1a')]['limit']||null:null,'include':_0x3e47a0[_0x56e2('0x1a')]?_0x3e47a0[_0x56e2('0x1a')]['include']?_['map'](_0x3e47a0[_0x56e2('0x1a')][_0x56e2('0x1e')],function(_0x6c7722){return{'model':db[_0x6c7722[_0x56e2('0x1f')]],'as':_0x6c7722['as'],'attributes':_0x6c7722[_0x56e2('0x1d')],'include':_0x6c7722[_0x56e2('0x1e')]?_[_0x56e2('0x20')](_0x6c7722[_0x56e2('0x1e')],function(_0x58b56a){return{'model':db[_0x58b56a[_0x56e2('0x1f')]],'as':_0x58b56a['as'],'attributes':_0x58b56a['attributes'],'include':_0x58b56a[_0x56e2('0x1e')]?_[_0x56e2('0x20')](_0x58b56a['include'],function(_0x2268c1){return{'model':db[_0x2268c1['model']],'as':_0x2268c1['as'],'attributes':_0x2268c1[_0x56e2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x56e2('0xb')](function(_0x4e23b4){logger[_0x56e2('0xc')]('GetSugarcrmAccount',_0x3e47a0);logger['debug'](_0x56e2('0x17'),_0x3e47a0,JSON[_0x56e2('0x11')](_0x4e23b4));_0x8f044a(_0x4e23b4);})['catch'](function(_0x134d7c){logger[_0x56e2('0x12')]('GetSugarcrmAccount',_0x134d7c[_0x56e2('0x14')],_0x3e47a0);_0x5f24bf(_0x392305[_0x56e2('0x12')](0x1f4,_0x134d7c[_0x56e2('0x14')]));});});};exports[_0x56e2('0x21')]=function(_0x42c52c){var _0x57d0e6=this;return new Promise(function(_0x59d0d7,_0x36105e){return db[_0x56e2('0x18')][_0x56e2('0x22')]({'raw':_0x42c52c[_0x56e2('0x1a')]?_0x42c52c[_0x56e2('0x1a')][_0x56e2('0x1b')]===undefined?!![]:![]:!![],'where':_0x42c52c[_0x56e2('0x1a')]?_0x42c52c[_0x56e2('0x1a')][_0x56e2('0x1c')]||null:null,'attributes':_0x42c52c[_0x56e2('0x1a')]?_0x42c52c[_0x56e2('0x1a')][_0x56e2('0x1d')]||null:null,'include':_0x42c52c[_0x56e2('0x1a')]?_0x42c52c[_0x56e2('0x1a')]['include']?_[_0x56e2('0x20')](_0x42c52c[_0x56e2('0x1a')][_0x56e2('0x1e')],function(_0x5c65db){return{'model':db[_0x5c65db['model']],'as':_0x5c65db['as'],'attributes':_0x5c65db['attributes'],'include':_0x5c65db[_0x56e2('0x1e')]?_[_0x56e2('0x20')](_0x5c65db[_0x56e2('0x1e')],function(_0x45d21c){return{'model':db[_0x45d21c[_0x56e2('0x1f')]],'as':_0x45d21c['as'],'attributes':_0x45d21c[_0x56e2('0x1d')],'include':_0x45d21c[_0x56e2('0x1e')]?_[_0x56e2('0x20')](_0x45d21c[_0x56e2('0x1e')],function(_0xab6ed9){return{'model':db[_0xab6ed9[_0x56e2('0x1f')]],'as':_0xab6ed9['as'],'attributes':_0xab6ed9[_0x56e2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x56e2('0xb')](function(_0x1a387b){logger[_0x56e2('0xc')](_0x56e2('0x21'),_0x42c52c);logger[_0x56e2('0xf')](_0x56e2('0x21'),_0x42c52c,JSON[_0x56e2('0x11')](_0x1a387b));_0x59d0d7(_0x1a387b);})[_0x56e2('0x16')](function(_0x69acd0){logger[_0x56e2('0x12')]('ShowSugarcrmAccount',_0x69acd0[_0x56e2('0x14')],_0x42c52c);_0x36105e(_0x57d0e6[_0x56e2('0x12')](0x1f4,_0x69acd0[_0x56e2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 5a66d6e..ff577f3 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 _0xb517=['getDescriptions','post','create','put','update','delete','destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','/:id','show','getFields','/:id/subjects','getSubjects'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb517,0x1d3));var _0x7b51=function(_0x4e4f0e,_0x1c3892){_0x4e4f0e=_0x4e4f0e-0x0;var _0x1a7219=_0xb517[_0x4e4f0e];return _0x1a7219;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7b51('0x0'));var timeout=require(_0x7b51('0x1'));var express=require('express');var router=express[_0x7b51('0x2')]();var fs_extra=require(_0x7b51('0x3'));var auth=require(_0x7b51('0x4'));var interaction=require(_0x7b51('0x5'));var config=require(_0x7b51('0x6'));var controller=require(_0x7b51('0x7'));router['get']('/',auth[_0x7b51('0x8')](),controller[_0x7b51('0x9')]);router[_0x7b51('0xa')](_0x7b51('0xb'),auth['isAuthenticated'](),controller[_0x7b51('0xc')]);router['get']('/:id/fields',auth[_0x7b51('0x8')](),controller[_0x7b51('0xd')]);router['get'](_0x7b51('0xe'),auth[_0x7b51('0x8')](),controller[_0x7b51('0xf')]);router[_0x7b51('0xa')]('/:id/descriptions',auth[_0x7b51('0x8')](),controller[_0x7b51('0x10')]);router[_0x7b51('0x11')]('/',auth[_0x7b51('0x8')](),controller[_0x7b51('0x12')]);router[_0x7b51('0x13')](_0x7b51('0xb'),auth[_0x7b51('0x8')](),controller[_0x7b51('0x14')]);router[_0x7b51('0x15')](_0x7b51('0xb'),auth[_0x7b51('0x8')](),controller[_0x7b51('0x16')]);module['exports']=router; \ No newline at end of file +var _0x790e=['put','update','delete','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x4a6771,_0x3ad9a1){var _0xa8fc97=function(_0x9c216){while(--_0x9c216){_0x4a6771['push'](_0x4a6771['shift']());}};_0xa8fc97(++_0x3ad9a1);}(_0x790e,0x1a6));var _0xe790=function(_0x250f34,_0xb720b8){_0x250f34=_0x250f34-0x0;var _0x31452a=_0x790e[_0x250f34];return _0x31452a;};'use strict';var multer=require('multer');var util=require(_0xe790('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe790('0x1'));var router=express[_0xe790('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe790('0x3'));var interaction=require(_0xe790('0x4'));var config=require(_0xe790('0x5'));var controller=require(_0xe790('0x6'));router[_0xe790('0x7')]('/',auth[_0xe790('0x8')](),controller[_0xe790('0x9')]);router['get'](_0xe790('0xa'),auth[_0xe790('0x8')](),controller[_0xe790('0xb')]);router[_0xe790('0x7')](_0xe790('0xc'),auth[_0xe790('0x8')](),controller['getFields']);router['get'](_0xe790('0xd'),auth[_0xe790('0x8')](),controller['getSubjects']);router[_0xe790('0x7')](_0xe790('0xe'),auth[_0xe790('0x8')](),controller[_0xe790('0xf')]);router[_0xe790('0x10')]('/',auth[_0xe790('0x8')](),controller[_0xe790('0x11')]);router[_0xe790('0x12')](_0xe790('0xa'),auth['isAuthenticated'](),controller[_0xe790('0x13')]);router[_0xe790('0x14')]('/:id',auth[_0xe790('0x8')](),controller['destroy']);module[_0xe790('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 0595f8f..d527e93 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 _0xbdbf=['STRING','sequelize','exports'];(function(_0x325501,_0x5242f6){var _0x2c1626=function(_0x4270b2){while(--_0x4270b2){_0x325501['push'](_0x325501['shift']());}};_0x2c1626(++_0x5242f6);}(_0xbdbf,0x1d5));var _0xfbdb=function(_0x1ab180,_0x382b2c){_0x1ab180=_0x1ab180-0x0;var _0xfb2c2d=_0xbdbf[_0x1ab180];return _0xfb2c2d;};'use strict';var Sequelize=require(_0xfbdb('0x0'));module[_0xfbdb('0x1')]={'name':{'type':Sequelize[_0xfbdb('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4401=['STRING','exports'];(function(_0x106e51,_0x5c946c){var _0x2b9fd7=function(_0x5dd3db){while(--_0x5dd3db){_0x106e51['push'](_0x106e51['shift']());}};_0x2b9fd7(++_0x5c946c);}(_0x4401,0x9f));var _0x1440=function(_0x18f0d3,_0x4203e3){_0x18f0d3=_0x18f0d3-0x0;var _0x397bc7=_0x4401[_0x18f0d3];return _0x397bc7;};'use strict';var Sequelize=require('sequelize');module[_0x1440('0x0')]={'name':{'type':Sequelize[_0x1440('0x1')]},'description':{'type':Sequelize[_0x1440('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 5d1da0e..0c8965c 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 _0x9b42=['count','offset','limit','status','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','find','create','body','getFields','findOne','SugarcrmField','getSubjects','options','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','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','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','end','json'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9b42,0xe0));var _0x29b4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9b42[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29b4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29b4('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x29b4('0x2'));var util=require(_0x29b4('0x3'));var path=require(_0x29b4('0x4'));var sox=require(_0x29b4('0x5'));var csv=require(_0x29b4('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29b4('0x7'));var _=require(_0x29b4('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x29b4('0x9'));var deskjs=require(_0x29b4('0xa'));var toCsv=require('to-csv');var querystring=require(_0x29b4('0xb'));var Papa=require(_0x29b4('0xc'));var Redis=require('ioredis');var authService=require(_0x29b4('0xd'));var qs=require(_0x29b4('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29b4('0xf'));var logger=require('../../config/logger')(_0x29b4('0x10'));var utils=require(_0x29b4('0x11'));var config=require(_0x29b4('0x12'));var licenseUtil=require(_0x29b4('0x13'));var db=require('../../mysqldb')['db'];var jayson=require(_0x29b4('0x14'));var client=jayson[_0x29b4('0x15')][_0x29b4('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x24ffa7,_0x3c00bb,_0x4c67ab,_0x554206){return new BPromise(function(_0x5779eb,_0x2d8085){var _0x59be8e=_0x554206||client;return _0x59be8e[_0x29b4('0x17')](_0x24ffa7,_0x4c67ab)[_0x29b4('0x18')](function(_0x32ecbd){logger[_0x29b4('0x19')](_0x29b4('0x1a'),_0x3c00bb,_0x29b4('0x1b'));logger[_0x29b4('0x1c')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x3c00bb,_0x29b4('0x1b'),JSON[_0x29b4('0x1d')](_0x32ecbd));if(_0x32ecbd[_0x29b4('0x1e')]){if(_0x32ecbd[_0x29b4('0x1e')][_0x29b4('0x1f')]===0x1f4){logger[_0x29b4('0x1e')](_0x29b4('0x1a'),_0x3c00bb,_0x32ecbd[_0x29b4('0x1e')][_0x29b4('0x20')]);return _0x2d8085(_0x32ecbd['error'][_0x29b4('0x20')]);}logger[_0x29b4('0x1e')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3c00bb,_0x32ecbd[_0x29b4('0x1e')][_0x29b4('0x20')]);return _0x5779eb(_0x32ecbd[_0x29b4('0x1e')]['message']);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x3c00bb,_0x29b4('0x1b'));_0x5779eb(_0x32ecbd[_0x29b4('0x21')][_0x29b4('0x20')]);}})['catch'](function(_0x389bad){logger[_0x29b4('0x1e')](_0x29b4('0x1a'),_0x3c00bb,_0x389bad);_0x2d8085(_0x389bad);});});}function respondWithStatusCode(_0x2d6986,_0x28e2ba){_0x28e2ba=_0x28e2ba||0xcc;return function(_0x334fef){if(_0x334fef){return _0x2d6986[_0x29b4('0x22')](_0x28e2ba);}return _0x2d6986['status'](_0x28e2ba)[_0x29b4('0x23')]();};}function respondWithResult(_0x31cbd2,_0x2aafa0){_0x2aafa0=_0x2aafa0||0xc8;return function(_0x32260a){if(_0x32260a){return _0x31cbd2['status'](_0x2aafa0)[_0x29b4('0x24')](_0x32260a);}};}function respondWithFilteredResult(_0x2eab9f,_0x3aebe4){return function(_0x5cc754){if(_0x5cc754){var _0x2ac7ef=_0x5cc754[_0x29b4('0x25')],_0x3f536d=_0x3aebe4[_0x29b4('0x26')],_0x194147=_0x3aebe4[_0x29b4('0x26')]+_0x3aebe4[_0x29b4('0x27')],_0x4c2717;if(_0x194147>=_0x2ac7ef){_0x194147=_0x2ac7ef;_0x4c2717=0xc8;}else{_0x4c2717=0xce;}_0x2eab9f[_0x29b4('0x28')](_0x4c2717);return _0x2eab9f[_0x29b4('0x29')](_0x29b4('0x2a'),_0x3f536d+'-'+_0x194147+'/'+_0x2ac7ef)[_0x29b4('0x24')](_0x5cc754);}return null;};}function patchUpdates(_0x5d5f23){return function(_0x54bc8c){try{jsonpatch[_0x29b4('0x2b')](_0x54bc8c,_0x5d5f23,!![]);}catch(_0x118099){return BPromise[_0x29b4('0x2c')](_0x118099);}return _0x54bc8c[_0x29b4('0x2d')]();};}function saveUpdates(_0x37474d,_0x34aeb1){return function(_0x4b2f19){if(_0x4b2f19){return _0x4b2f19[_0x29b4('0x2e')](_0x37474d)[_0x29b4('0x18')](function(_0x9e0579){return _0x9e0579;});}return null;};}function removeEntity(_0x3481ea,_0x3fc437){return function(_0x2a7c53){if(_0x2a7c53){return _0x2a7c53[_0x29b4('0x2f')]()[_0x29b4('0x18')](function(){_0x3481ea['status'](0xcc)[_0x29b4('0x23')]();});}};}function handleEntityNotFound(_0x41483a,_0x4d6e51){return function(_0x412fc2){if(!_0x412fc2){_0x41483a[_0x29b4('0x22')](0x194);}return _0x412fc2;};}function handleError(_0x2995dc,_0x540f1e){_0x540f1e=_0x540f1e||0x1f4;return function(_0x1f42f2){logger['error'](_0x1f42f2['stack']);if(_0x1f42f2[_0x29b4('0x30')]){delete _0x1f42f2['name'];}_0x2995dc[_0x29b4('0x28')](_0x540f1e)[_0x29b4('0x31')](_0x1f42f2);};}exports[_0x29b4('0x32')]=function(_0x22f410,_0x18f960){var _0x4fa519={},_0x43b05f={},_0x560176={'count':0x0,'rows':[]};var _0x16d879=_[_0x29b4('0x33')](db[_0x29b4('0x34')][_0x29b4('0x35')],function(_0x4fa57f){return{'name':_0x4fa57f[_0x29b4('0x36')],'type':_0x4fa57f[_0x29b4('0x37')]['key']};});_0x43b05f['model']=_[_0x29b4('0x33')](_0x16d879,_0x29b4('0x30'));_0x43b05f['query']=_['keys'](_0x22f410['query']);_0x43b05f[_0x29b4('0x38')]=_['intersection'](_0x43b05f[_0x29b4('0x39')],_0x43b05f[_0x29b4('0x3a')]);_0x4fa519[_0x29b4('0x3b')]=_[_0x29b4('0x3c')](_0x43b05f['model'],qs['fields'](_0x22f410['query'][_0x29b4('0x3d')]));_0x4fa519[_0x29b4('0x3b')]=_0x4fa519[_0x29b4('0x3b')][_0x29b4('0x3e')]?_0x4fa519[_0x29b4('0x3b')]:_0x43b05f[_0x29b4('0x39')];if(!_0x22f410[_0x29b4('0x3a')][_0x29b4('0x3f')](_0x29b4('0x40'))){_0x4fa519[_0x29b4('0x27')]=qs[_0x29b4('0x27')](_0x22f410[_0x29b4('0x3a')]['limit']);_0x4fa519[_0x29b4('0x26')]=qs[_0x29b4('0x26')](_0x22f410[_0x29b4('0x3a')][_0x29b4('0x26')]);}_0x4fa519[_0x29b4('0x41')]=qs[_0x29b4('0x42')](_0x22f410['query'][_0x29b4('0x42')]);_0x4fa519[_0x29b4('0x43')]=qs['filters'](_[_0x29b4('0x44')](_0x22f410[_0x29b4('0x3a')],_0x43b05f[_0x29b4('0x38')]),_0x16d879);if(_0x22f410[_0x29b4('0x3a')][_0x29b4('0x45')]){_0x4fa519[_0x29b4('0x43')]=_[_0x29b4('0x46')](_0x4fa519['where'],{'$or':_[_0x29b4('0x33')](_0x16d879,function(_0x1afb56){if(_0x1afb56[_0x29b4('0x37')]!==_0x29b4('0x47')){var _0x1d2e9b={};_0x1d2e9b[_0x1afb56[_0x29b4('0x30')]]={'$like':'%'+_0x22f410[_0x29b4('0x3a')][_0x29b4('0x45')]+'%'};return _0x1d2e9b;}})});}_0x4fa519=_['merge']({},_0x4fa519,_0x22f410['options']);var _0x326f8e={'where':_0x4fa519[_0x29b4('0x43')]};return db[_0x29b4('0x34')][_0x29b4('0x25')](_0x326f8e)[_0x29b4('0x18')](function(_0x5df0ce){_0x560176[_0x29b4('0x25')]=_0x5df0ce;if(_0x22f410[_0x29b4('0x3a')][_0x29b4('0x48')]){_0x4fa519[_0x29b4('0x49')]=[{'all':!![]}];}return db[_0x29b4('0x34')]['findAll'](_0x4fa519);})[_0x29b4('0x18')](function(_0x85069e){_0x560176[_0x29b4('0x4a')]=_0x85069e;return _0x560176;})[_0x29b4('0x18')](respondWithFilteredResult(_0x18f960,_0x4fa519))[_0x29b4('0x4b')](handleError(_0x18f960,null));};exports[_0x29b4('0x4c')]=function(_0x1173b9,_0x527485){var _0x5ccfb9={'raw':![],'where':{'id':_0x1173b9[_0x29b4('0x4d')]['id']}},_0x550891={};_0x550891[_0x29b4('0x39')]=_[_0x29b4('0x4e')](db[_0x29b4('0x34')]['rawAttributes']);_0x550891[_0x29b4('0x3a')]=_[_0x29b4('0x4e')](_0x1173b9[_0x29b4('0x3a')]);_0x550891[_0x29b4('0x38')]=_['intersection'](_0x550891['model'],_0x550891[_0x29b4('0x3a')]);_0x5ccfb9[_0x29b4('0x3b')]=_[_0x29b4('0x3c')](_0x550891[_0x29b4('0x39')],qs[_0x29b4('0x3d')](_0x1173b9[_0x29b4('0x3a')][_0x29b4('0x3d')]));_0x5ccfb9[_0x29b4('0x3b')]=_0x5ccfb9[_0x29b4('0x3b')]['length']?_0x5ccfb9[_0x29b4('0x3b')]:_0x550891['model'];if(_0x1173b9[_0x29b4('0x3a')][_0x29b4('0x48')]){_0x5ccfb9['include']=[{'all':!![]}];}_0x5ccfb9=_[_0x29b4('0x46')]({},_0x5ccfb9,_0x1173b9['options']);return db[_0x29b4('0x34')][_0x29b4('0x4f')](_0x5ccfb9)[_0x29b4('0x18')](handleEntityNotFound(_0x527485,null))[_0x29b4('0x18')](respondWithResult(_0x527485,null))[_0x29b4('0x4b')](handleError(_0x527485,null));};exports[_0x29b4('0x50')]=function(_0x42797b,_0x338567){return db['SugarcrmConfiguration']['create'](_0x42797b['body'],{})[_0x29b4('0x18')](respondWithResult(_0x338567,0xc9))[_0x29b4('0x4b')](handleError(_0x338567,null));};exports[_0x29b4('0x2e')]=function(_0x1e841d,_0x2b21f0){if(_0x1e841d['body']['id']){delete _0x1e841d[_0x29b4('0x51')]['id'];}return db['SugarcrmConfiguration'][_0x29b4('0x4f')]({'where':{'id':_0x1e841d[_0x29b4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2b21f0,null))[_0x29b4('0x18')](saveUpdates(_0x1e841d[_0x29b4('0x51')],null))['then'](respondWithResult(_0x2b21f0,null))[_0x29b4('0x4b')](handleError(_0x2b21f0,null));};exports[_0x29b4('0x2f')]=function(_0x45692c,_0xb18979){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x45692c[_0x29b4('0x4d')]['id']}})[_0x29b4('0x18')](handleEntityNotFound(_0xb18979,null))['then'](removeEntity(_0xb18979,null))[_0x29b4('0x4b')](handleError(_0xb18979,null));};exports[_0x29b4('0x52')]=function(_0x12e977,_0x5c7d8c,_0xc3b590){var _0x412c0f={};var _0x1949d6={};var _0x264457;var _0x4a04fc;return db[_0x29b4('0x34')][_0x29b4('0x53')]({'where':{'id':_0x12e977[_0x29b4('0x4d')]['id']}})[_0x29b4('0x18')](handleEntityNotFound(_0x5c7d8c,null))['then'](function(_0x475eee){if(_0x475eee){_0x264457=_0x475eee;_0x1949d6['model']=_['keys'](db[_0x29b4('0x54')][_0x29b4('0x35')]);_0x1949d6['query']=_[_0x29b4('0x4e')](_0x12e977['query']);_0x1949d6[_0x29b4('0x38')]=_[_0x29b4('0x3c')](_0x1949d6[_0x29b4('0x39')],_0x1949d6[_0x29b4('0x3a')]);_0x412c0f['attributes']=_[_0x29b4('0x3c')](_0x1949d6[_0x29b4('0x39')],qs['fields'](_0x12e977[_0x29b4('0x3a')][_0x29b4('0x3d')]));_0x412c0f[_0x29b4('0x3b')]=_0x412c0f[_0x29b4('0x3b')]['length']?_0x412c0f['attributes']:_0x1949d6[_0x29b4('0x39')];_0x412c0f[_0x29b4('0x41')]=qs[_0x29b4('0x42')](_0x12e977[_0x29b4('0x3a')][_0x29b4('0x42')]);_0x412c0f[_0x29b4('0x43')]=qs[_0x29b4('0x38')](_[_0x29b4('0x44')](_0x12e977[_0x29b4('0x3a')],_0x1949d6[_0x29b4('0x38')]));if(_0x12e977[_0x29b4('0x3a')][_0x29b4('0x45')]){_0x412c0f[_0x29b4('0x43')]=_[_0x29b4('0x46')](_0x412c0f[_0x29b4('0x43')],{'$or':_[_0x29b4('0x33')](_0x412c0f['attributes'],function(_0x195f8e){var _0x268c12={};_0x268c12[_0x195f8e]={'$like':'%'+_0x12e977[_0x29b4('0x3a')][_0x29b4('0x45')]+'%'};return _0x268c12;})});}_0x412c0f=_['merge']({},_0x412c0f,_0x12e977['options']);return _0x264457[_0x29b4('0x52')](_0x412c0f);}})[_0x29b4('0x18')](function(_0x232586){if(_0x232586){_0x4a04fc=_0x232586[_0x29b4('0x3e')];if(!_0x12e977[_0x29b4('0x3a')][_0x29b4('0x3f')](_0x29b4('0x40'))){_0x412c0f[_0x29b4('0x27')]=qs[_0x29b4('0x27')](_0x12e977[_0x29b4('0x3a')][_0x29b4('0x27')]);_0x412c0f[_0x29b4('0x26')]=qs['offset'](_0x12e977[_0x29b4('0x3a')][_0x29b4('0x26')]);}return _0x264457[_0x29b4('0x52')](_0x412c0f);}})['then'](function(_0x49c7dd){if(_0x49c7dd){return _0x49c7dd?{'count':_0x4a04fc,'rows':_0x49c7dd}:null;}})['then'](respondWithResult(_0x5c7d8c,null))[_0x29b4('0x4b')](handleError(_0x5c7d8c,null));};exports[_0x29b4('0x55')]=function(_0x37b8b7,_0x13110c,_0x47d1e6){var _0x2b0688={};var _0x427a22={};var _0x119f3c;var _0x471fe0;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x37b8b7[_0x29b4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x13110c,null))[_0x29b4('0x18')](function(_0x5d24ec){if(_0x5d24ec){_0x119f3c=_0x5d24ec;_0x427a22[_0x29b4('0x39')]=_[_0x29b4('0x4e')](db[_0x29b4('0x54')][_0x29b4('0x35')]);_0x427a22[_0x29b4('0x3a')]=_[_0x29b4('0x4e')](_0x37b8b7[_0x29b4('0x3a')]);_0x427a22[_0x29b4('0x38')]=_[_0x29b4('0x3c')](_0x427a22[_0x29b4('0x39')],_0x427a22[_0x29b4('0x3a')]);_0x2b0688[_0x29b4('0x3b')]=_[_0x29b4('0x3c')](_0x427a22[_0x29b4('0x39')],qs[_0x29b4('0x3d')](_0x37b8b7[_0x29b4('0x3a')][_0x29b4('0x3d')]));_0x2b0688['attributes']=_0x2b0688[_0x29b4('0x3b')][_0x29b4('0x3e')]?_0x2b0688[_0x29b4('0x3b')]:_0x427a22['model'];_0x2b0688[_0x29b4('0x41')]=qs[_0x29b4('0x42')](_0x37b8b7[_0x29b4('0x3a')][_0x29b4('0x42')]);_0x2b0688[_0x29b4('0x43')]=qs['filters'](_[_0x29b4('0x44')](_0x37b8b7['query'],_0x427a22[_0x29b4('0x38')]));if(_0x37b8b7[_0x29b4('0x3a')][_0x29b4('0x45')]){_0x2b0688[_0x29b4('0x43')]=_[_0x29b4('0x46')](_0x2b0688[_0x29b4('0x43')],{'$or':_[_0x29b4('0x33')](_0x2b0688[_0x29b4('0x3b')],function(_0x28b258){var _0x27d946={};_0x27d946[_0x28b258]={'$like':'%'+_0x37b8b7['query']['filter']+'%'};return _0x27d946;})});}_0x2b0688=_[_0x29b4('0x46')]({},_0x2b0688,_0x37b8b7[_0x29b4('0x56')]);return _0x119f3c['getSubjects'](_0x2b0688);}})[_0x29b4('0x18')](function(_0xac4866){if(_0xac4866){_0x471fe0=_0xac4866[_0x29b4('0x3e')];if(!_0x37b8b7[_0x29b4('0x3a')]['hasOwnProperty'](_0x29b4('0x40'))){_0x2b0688[_0x29b4('0x27')]=qs[_0x29b4('0x27')](_0x37b8b7[_0x29b4('0x3a')][_0x29b4('0x27')]);_0x2b0688['offset']=qs[_0x29b4('0x26')](_0x37b8b7['query'][_0x29b4('0x26')]);}return _0x119f3c[_0x29b4('0x55')](_0x2b0688);}})['then'](function(_0x2911cd){if(_0x2911cd){return _0x2911cd?{'count':_0x471fe0,'rows':_0x2911cd}:null;}})[_0x29b4('0x18')](respondWithResult(_0x13110c,null))[_0x29b4('0x4b')](handleError(_0x13110c,null));};exports['getDescriptions']=function(_0x823a8f,_0x5455e1,_0x972a83){var _0x314ed5={};var _0xd70fc1={};var _0x37189f;var _0x5511f0;return db[_0x29b4('0x34')][_0x29b4('0x53')]({'where':{'id':_0x823a8f[_0x29b4('0x4d')]['id']}})[_0x29b4('0x18')](handleEntityNotFound(_0x5455e1,null))['then'](function(_0x1d21aa){if(_0x1d21aa){_0x37189f=_0x1d21aa;_0xd70fc1[_0x29b4('0x39')]=_[_0x29b4('0x4e')](db[_0x29b4('0x54')][_0x29b4('0x35')]);_0xd70fc1[_0x29b4('0x3a')]=_[_0x29b4('0x4e')](_0x823a8f['query']);_0xd70fc1['filters']=_[_0x29b4('0x3c')](_0xd70fc1[_0x29b4('0x39')],_0xd70fc1[_0x29b4('0x3a')]);_0x314ed5[_0x29b4('0x3b')]=_[_0x29b4('0x3c')](_0xd70fc1['model'],qs[_0x29b4('0x3d')](_0x823a8f[_0x29b4('0x3a')][_0x29b4('0x3d')]));_0x314ed5[_0x29b4('0x3b')]=_0x314ed5[_0x29b4('0x3b')]['length']?_0x314ed5[_0x29b4('0x3b')]:_0xd70fc1[_0x29b4('0x39')];_0x314ed5[_0x29b4('0x41')]=qs['sort'](_0x823a8f['query']['sort']);_0x314ed5[_0x29b4('0x43')]=qs['filters'](_[_0x29b4('0x44')](_0x823a8f[_0x29b4('0x3a')],_0xd70fc1['filters']));if(_0x823a8f[_0x29b4('0x3a')]['filter']){_0x314ed5['where']=_[_0x29b4('0x46')](_0x314ed5[_0x29b4('0x43')],{'$or':_['map'](_0x314ed5[_0x29b4('0x3b')],function(_0x4e6d4b){var _0x178f6e={};_0x178f6e[_0x4e6d4b]={'$like':'%'+_0x823a8f[_0x29b4('0x3a')][_0x29b4('0x45')]+'%'};return _0x178f6e;})});}_0x314ed5=_[_0x29b4('0x46')]({},_0x314ed5,_0x823a8f[_0x29b4('0x56')]);return _0x37189f['getDescriptions'](_0x314ed5);}})[_0x29b4('0x18')](function(_0x37dd11){if(_0x37dd11){_0x5511f0=_0x37dd11['length'];if(!_0x823a8f[_0x29b4('0x3a')][_0x29b4('0x3f')](_0x29b4('0x40'))){_0x314ed5[_0x29b4('0x27')]=qs[_0x29b4('0x27')](_0x823a8f[_0x29b4('0x3a')]['limit']);_0x314ed5[_0x29b4('0x26')]=qs[_0x29b4('0x26')](_0x823a8f['query'][_0x29b4('0x26')]);}return _0x37189f['getDescriptions'](_0x314ed5);}})[_0x29b4('0x18')](function(_0x3e2a5e){if(_0x3e2a5e){return _0x3e2a5e?{'count':_0x5511f0,'rows':_0x3e2a5e}:null;}})['then'](respondWithResult(_0x5455e1,null))[_0x29b4('0x4b')](handleError(_0x5455e1,null));}; \ No newline at end of file +var _0x0a4c=['keys','rawAttributes','intersection','length','options','find','create','body','params','findOne','getFields','getSubjects','SugarcrmField','getDescriptions','eml-format','rimraf','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SugarcrmConfiguration,\x20%s,\x20%s','result','catch','sendStatus','end','status','json','count','offset','limit','set','update','destroy','name','send','index','map','SugarcrmConfiguration','type','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','show'];(function(_0x43b860,_0x3b1343){var _0x37db56=function(_0x229b4e){while(--_0x229b4e){_0x43b860['push'](_0x43b860['shift']());}};_0x37db56(++_0x3b1343);}(_0x0a4c,0xba));var _0xc0a4=function(_0x215a37,_0x26bf78){_0x215a37=_0x215a37-0x0;var _0x2b3aba=_0x0a4c[_0x215a37];return _0x2b3aba;};'use strict';var emlformat=require(_0xc0a4('0x0'));var rimraf=require(_0xc0a4('0x1'));var zipdir=require(_0xc0a4('0x2'));var jsonpatch=require(_0xc0a4('0x3'));var rp=require(_0xc0a4('0x4'));var moment=require('moment');var BPromise=require(_0xc0a4('0x5'));var Mustache=require(_0xc0a4('0x6'));var util=require(_0xc0a4('0x7'));var path=require('path');var sox=require(_0xc0a4('0x8'));var csv=require(_0xc0a4('0x9'));var ejs=require(_0xc0a4('0xa'));var fs=require('fs');var fs_extra=require(_0xc0a4('0xb'));var _=require(_0xc0a4('0xc'));var squel=require(_0xc0a4('0xd'));var crypto=require(_0xc0a4('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc0a4('0xf'));var toCsv=require(_0xc0a4('0x9'));var querystring=require('querystring');var Papa=require(_0xc0a4('0x10'));var Redis=require(_0xc0a4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc0a4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc0a4('0x13'))('api');var utils=require(_0xc0a4('0x14'));var config=require(_0xc0a4('0x15'));var licenseUtil=require(_0xc0a4('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xc0a4('0x17'));var client=jayson[_0xc0a4('0x18')][_0xc0a4('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2a16b1,_0x4a6fca,_0x45591c,_0x99583d){return new BPromise(function(_0xea8bc9,_0x3ba055){var _0xd63902=_0x99583d||client;return _0xd63902[_0xc0a4('0x1a')](_0x2a16b1,_0x45591c)[_0xc0a4('0x1b')](function(_0x29bf6c){logger[_0xc0a4('0x1c')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4a6fca,_0xc0a4('0x1d'));logger['debug'](_0xc0a4('0x1e'),_0x4a6fca,_0xc0a4('0x1d'),JSON[_0xc0a4('0x1f')](_0x29bf6c));if(_0x29bf6c[_0xc0a4('0x20')]){if(_0x29bf6c['error'][_0xc0a4('0x21')]===0x1f4){logger[_0xc0a4('0x20')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4a6fca,_0x29bf6c['error'][_0xc0a4('0x22')]);return _0x3ba055(_0x29bf6c[_0xc0a4('0x20')][_0xc0a4('0x22')]);}logger[_0xc0a4('0x20')](_0xc0a4('0x23'),_0x4a6fca,_0x29bf6c['error']['message']);return _0xea8bc9(_0x29bf6c['error'][_0xc0a4('0x22')]);}else{logger[_0xc0a4('0x1c')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4a6fca,'request\x20sent');_0xea8bc9(_0x29bf6c[_0xc0a4('0x24')][_0xc0a4('0x22')]);}})[_0xc0a4('0x25')](function(_0x194929){logger[_0xc0a4('0x20')](_0xc0a4('0x23'),_0x4a6fca,_0x194929);_0x3ba055(_0x194929);});});}function respondWithStatusCode(_0x1f7254,_0x376630){_0x376630=_0x376630||0xcc;return function(_0x26b046){if(_0x26b046){return _0x1f7254[_0xc0a4('0x26')](_0x376630);}return _0x1f7254['status'](_0x376630)[_0xc0a4('0x27')]();};}function respondWithResult(_0x22ec4,_0x40ebe4){_0x40ebe4=_0x40ebe4||0xc8;return function(_0x35b5c7){if(_0x35b5c7){return _0x22ec4[_0xc0a4('0x28')](_0x40ebe4)[_0xc0a4('0x29')](_0x35b5c7);}};}function respondWithFilteredResult(_0x17e1e2,_0x37accd){return function(_0x4389d8){if(_0x4389d8){var _0x4778a0=_0x4389d8[_0xc0a4('0x2a')],_0x449e26=_0x37accd['offset'],_0x3114d5=_0x37accd[_0xc0a4('0x2b')]+_0x37accd[_0xc0a4('0x2c')],_0x29ecee;if(_0x3114d5>=_0x4778a0){_0x3114d5=_0x4778a0;_0x29ecee=0xc8;}else{_0x29ecee=0xce;}_0x17e1e2['status'](_0x29ecee);return _0x17e1e2[_0xc0a4('0x2d')]('Content-Range',_0x449e26+'-'+_0x3114d5+'/'+_0x4778a0)[_0xc0a4('0x29')](_0x4389d8);}return null;};}function patchUpdates(_0x1b0414){return function(_0x8a1964){try{jsonpatch['apply'](_0x8a1964,_0x1b0414,!![]);}catch(_0x1314a6){return BPromise['reject'](_0x1314a6);}return _0x8a1964['save']();};}function saveUpdates(_0x58dcf6,_0x4211dd){return function(_0x475003){if(_0x475003){return _0x475003[_0xc0a4('0x2e')](_0x58dcf6)['then'](function(_0x503918){return _0x503918;});}return null;};}function removeEntity(_0x4718dd,_0x382fb2){return function(_0x1f48ef){if(_0x1f48ef){return _0x1f48ef[_0xc0a4('0x2f')]()[_0xc0a4('0x1b')](function(){_0x4718dd[_0xc0a4('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1872c3,_0x2d0d3a){return function(_0x1af00c){if(!_0x1af00c){_0x1872c3['sendStatus'](0x194);}return _0x1af00c;};}function handleError(_0x311669,_0x4b422c){_0x4b422c=_0x4b422c||0x1f4;return function(_0x57dbf0){logger[_0xc0a4('0x20')](_0x57dbf0['stack']);if(_0x57dbf0[_0xc0a4('0x30')]){delete _0x57dbf0[_0xc0a4('0x30')];}_0x311669[_0xc0a4('0x28')](_0x4b422c)[_0xc0a4('0x31')](_0x57dbf0);};}exports[_0xc0a4('0x32')]=function(_0x1890b8,_0x2c0a23){var _0x185647={},_0x166117={},_0x3c76bc={'count':0x0,'rows':[]};var _0x4ab391=_[_0xc0a4('0x33')](db[_0xc0a4('0x34')]['rawAttributes'],function(_0x2f2fcf){return{'name':_0x2f2fcf['fieldName'],'type':_0x2f2fcf[_0xc0a4('0x35')][_0xc0a4('0x36')]};});_0x166117[_0xc0a4('0x37')]=_[_0xc0a4('0x33')](_0x4ab391,_0xc0a4('0x30'));_0x166117[_0xc0a4('0x38')]=_['keys'](_0x1890b8[_0xc0a4('0x38')]);_0x166117[_0xc0a4('0x39')]=_['intersection'](_0x166117[_0xc0a4('0x37')],_0x166117[_0xc0a4('0x38')]);_0x185647[_0xc0a4('0x3a')]=_['intersection'](_0x166117[_0xc0a4('0x37')],qs[_0xc0a4('0x3b')](_0x1890b8['query'][_0xc0a4('0x3b')]));_0x185647[_0xc0a4('0x3a')]=_0x185647[_0xc0a4('0x3a')]['length']?_0x185647[_0xc0a4('0x3a')]:_0x166117['model'];if(!_0x1890b8['query'][_0xc0a4('0x3c')](_0xc0a4('0x3d'))){_0x185647[_0xc0a4('0x2c')]=qs[_0xc0a4('0x2c')](_0x1890b8['query'][_0xc0a4('0x2c')]);_0x185647[_0xc0a4('0x2b')]=qs[_0xc0a4('0x2b')](_0x1890b8[_0xc0a4('0x38')]['offset']);}_0x185647[_0xc0a4('0x3e')]=qs['sort'](_0x1890b8[_0xc0a4('0x38')][_0xc0a4('0x3f')]);_0x185647[_0xc0a4('0x40')]=qs[_0xc0a4('0x39')](_[_0xc0a4('0x41')](_0x1890b8['query'],_0x166117[_0xc0a4('0x39')]),_0x4ab391);if(_0x1890b8[_0xc0a4('0x38')][_0xc0a4('0x42')]){_0x185647[_0xc0a4('0x40')]=_['merge'](_0x185647[_0xc0a4('0x40')],{'$or':_[_0xc0a4('0x33')](_0x4ab391,function(_0x585c10){if(_0x585c10[_0xc0a4('0x35')]!==_0xc0a4('0x43')){var _0x1dfe10={};_0x1dfe10[_0x585c10[_0xc0a4('0x30')]]={'$like':'%'+_0x1890b8[_0xc0a4('0x38')][_0xc0a4('0x42')]+'%'};return _0x1dfe10;}})});}_0x185647=_[_0xc0a4('0x44')]({},_0x185647,_0x1890b8['options']);var _0x5d290b={'where':_0x185647[_0xc0a4('0x40')]};return db['SugarcrmConfiguration'][_0xc0a4('0x2a')](_0x5d290b)[_0xc0a4('0x1b')](function(_0x359389){_0x3c76bc[_0xc0a4('0x2a')]=_0x359389;if(_0x1890b8[_0xc0a4('0x38')][_0xc0a4('0x45')]){_0x185647[_0xc0a4('0x46')]=[{'all':!![]}];}return db[_0xc0a4('0x34')]['findAll'](_0x185647);})[_0xc0a4('0x1b')](function(_0x688c14){_0x3c76bc['rows']=_0x688c14;return _0x3c76bc;})[_0xc0a4('0x1b')](respondWithFilteredResult(_0x2c0a23,_0x185647))[_0xc0a4('0x25')](handleError(_0x2c0a23,null));};exports[_0xc0a4('0x47')]=function(_0x3990e2,_0x371c43){var _0x3e96f8={'raw':![],'where':{'id':_0x3990e2['params']['id']}},_0x347667={};_0x347667[_0xc0a4('0x37')]=_[_0xc0a4('0x48')](db[_0xc0a4('0x34')][_0xc0a4('0x49')]);_0x347667[_0xc0a4('0x38')]=_[_0xc0a4('0x48')](_0x3990e2[_0xc0a4('0x38')]);_0x347667[_0xc0a4('0x39')]=_['intersection'](_0x347667[_0xc0a4('0x37')],_0x347667[_0xc0a4('0x38')]);_0x3e96f8[_0xc0a4('0x3a')]=_[_0xc0a4('0x4a')](_0x347667['model'],qs[_0xc0a4('0x3b')](_0x3990e2[_0xc0a4('0x38')][_0xc0a4('0x3b')]));_0x3e96f8[_0xc0a4('0x3a')]=_0x3e96f8[_0xc0a4('0x3a')][_0xc0a4('0x4b')]?_0x3e96f8['attributes']:_0x347667[_0xc0a4('0x37')];if(_0x3990e2[_0xc0a4('0x38')][_0xc0a4('0x45')]){_0x3e96f8[_0xc0a4('0x46')]=[{'all':!![]}];}_0x3e96f8=_[_0xc0a4('0x44')]({},_0x3e96f8,_0x3990e2[_0xc0a4('0x4c')]);return db[_0xc0a4('0x34')][_0xc0a4('0x4d')](_0x3e96f8)[_0xc0a4('0x1b')](handleEntityNotFound(_0x371c43,null))[_0xc0a4('0x1b')](respondWithResult(_0x371c43,null))[_0xc0a4('0x25')](handleError(_0x371c43,null));};exports[_0xc0a4('0x4e')]=function(_0x39a20d,_0x3f9cab){return db[_0xc0a4('0x34')][_0xc0a4('0x4e')](_0x39a20d['body'],{})[_0xc0a4('0x1b')](respondWithResult(_0x3f9cab,0xc9))['catch'](handleError(_0x3f9cab,null));};exports[_0xc0a4('0x2e')]=function(_0x349591,_0x301718){if(_0x349591[_0xc0a4('0x4f')]['id']){delete _0x349591[_0xc0a4('0x4f')]['id'];}return db[_0xc0a4('0x34')]['find']({'where':{'id':_0x349591[_0xc0a4('0x50')]['id']}})[_0xc0a4('0x1b')](handleEntityNotFound(_0x301718,null))[_0xc0a4('0x1b')](saveUpdates(_0x349591[_0xc0a4('0x4f')],null))['then'](respondWithResult(_0x301718,null))[_0xc0a4('0x25')](handleError(_0x301718,null));};exports[_0xc0a4('0x2f')]=function(_0x2df557,_0x4ba11b){return db[_0xc0a4('0x34')][_0xc0a4('0x4d')]({'where':{'id':_0x2df557[_0xc0a4('0x50')]['id']}})['then'](handleEntityNotFound(_0x4ba11b,null))['then'](removeEntity(_0x4ba11b,null))['catch'](handleError(_0x4ba11b,null));};exports['getFields']=function(_0xe418f3,_0x38554b,_0x30adf4){var _0x39bc6b={};var _0x5ee37d={};var _0x1663aa;var _0x38a34c;return db[_0xc0a4('0x34')][_0xc0a4('0x51')]({'where':{'id':_0xe418f3['params']['id']}})['then'](handleEntityNotFound(_0x38554b,null))[_0xc0a4('0x1b')](function(_0x27abf5){if(_0x27abf5){_0x1663aa=_0x27abf5;_0x5ee37d['model']=_[_0xc0a4('0x48')](db['SugarcrmField'][_0xc0a4('0x49')]);_0x5ee37d[_0xc0a4('0x38')]=_['keys'](_0xe418f3[_0xc0a4('0x38')]);_0x5ee37d[_0xc0a4('0x39')]=_[_0xc0a4('0x4a')](_0x5ee37d[_0xc0a4('0x37')],_0x5ee37d['query']);_0x39bc6b[_0xc0a4('0x3a')]=_[_0xc0a4('0x4a')](_0x5ee37d['model'],qs[_0xc0a4('0x3b')](_0xe418f3[_0xc0a4('0x38')][_0xc0a4('0x3b')]));_0x39bc6b[_0xc0a4('0x3a')]=_0x39bc6b[_0xc0a4('0x3a')][_0xc0a4('0x4b')]?_0x39bc6b[_0xc0a4('0x3a')]:_0x5ee37d[_0xc0a4('0x37')];_0x39bc6b[_0xc0a4('0x3e')]=qs[_0xc0a4('0x3f')](_0xe418f3[_0xc0a4('0x38')][_0xc0a4('0x3f')]);_0x39bc6b[_0xc0a4('0x40')]=qs[_0xc0a4('0x39')](_['pick'](_0xe418f3['query'],_0x5ee37d[_0xc0a4('0x39')]));if(_0xe418f3['query']['filter']){_0x39bc6b[_0xc0a4('0x40')]=_[_0xc0a4('0x44')](_0x39bc6b['where'],{'$or':_[_0xc0a4('0x33')](_0x39bc6b[_0xc0a4('0x3a')],function(_0x557560){var _0x43b7de={};_0x43b7de[_0x557560]={'$like':'%'+_0xe418f3[_0xc0a4('0x38')]['filter']+'%'};return _0x43b7de;})});}_0x39bc6b=_[_0xc0a4('0x44')]({},_0x39bc6b,_0xe418f3[_0xc0a4('0x4c')]);return _0x1663aa[_0xc0a4('0x52')](_0x39bc6b);}})[_0xc0a4('0x1b')](function(_0x3fcb7e){if(_0x3fcb7e){_0x38a34c=_0x3fcb7e[_0xc0a4('0x4b')];if(!_0xe418f3[_0xc0a4('0x38')][_0xc0a4('0x3c')]('nolimit')){_0x39bc6b[_0xc0a4('0x2c')]=qs[_0xc0a4('0x2c')](_0xe418f3[_0xc0a4('0x38')]['limit']);_0x39bc6b[_0xc0a4('0x2b')]=qs['offset'](_0xe418f3[_0xc0a4('0x38')]['offset']);}return _0x1663aa[_0xc0a4('0x52')](_0x39bc6b);}})[_0xc0a4('0x1b')](function(_0x4a3484){if(_0x4a3484){return _0x4a3484?{'count':_0x38a34c,'rows':_0x4a3484}:null;}})[_0xc0a4('0x1b')](respondWithResult(_0x38554b,null))[_0xc0a4('0x25')](handleError(_0x38554b,null));};exports[_0xc0a4('0x53')]=function(_0x1cc5ba,_0x67040c,_0x593b99){var _0x4a2da0={};var _0xc6df68={};var _0x38df1c;var _0x2d8511;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x1cc5ba['params']['id']}})[_0xc0a4('0x1b')](handleEntityNotFound(_0x67040c,null))['then'](function(_0x49d2e9){if(_0x49d2e9){_0x38df1c=_0x49d2e9;_0xc6df68[_0xc0a4('0x37')]=_[_0xc0a4('0x48')](db['SugarcrmField'][_0xc0a4('0x49')]);_0xc6df68['query']=_[_0xc0a4('0x48')](_0x1cc5ba[_0xc0a4('0x38')]);_0xc6df68['filters']=_[_0xc0a4('0x4a')](_0xc6df68[_0xc0a4('0x37')],_0xc6df68['query']);_0x4a2da0[_0xc0a4('0x3a')]=_[_0xc0a4('0x4a')](_0xc6df68['model'],qs[_0xc0a4('0x3b')](_0x1cc5ba[_0xc0a4('0x38')]['fields']));_0x4a2da0['attributes']=_0x4a2da0[_0xc0a4('0x3a')]['length']?_0x4a2da0[_0xc0a4('0x3a')]:_0xc6df68[_0xc0a4('0x37')];_0x4a2da0['order']=qs['sort'](_0x1cc5ba[_0xc0a4('0x38')][_0xc0a4('0x3f')]);_0x4a2da0[_0xc0a4('0x40')]=qs['filters'](_[_0xc0a4('0x41')](_0x1cc5ba['query'],_0xc6df68[_0xc0a4('0x39')]));if(_0x1cc5ba[_0xc0a4('0x38')]['filter']){_0x4a2da0[_0xc0a4('0x40')]=_[_0xc0a4('0x44')](_0x4a2da0[_0xc0a4('0x40')],{'$or':_[_0xc0a4('0x33')](_0x4a2da0[_0xc0a4('0x3a')],function(_0xcfc83e){var _0x12dbb1={};_0x12dbb1[_0xcfc83e]={'$like':'%'+_0x1cc5ba['query'][_0xc0a4('0x42')]+'%'};return _0x12dbb1;})});}_0x4a2da0=_['merge']({},_0x4a2da0,_0x1cc5ba[_0xc0a4('0x4c')]);return _0x38df1c['getSubjects'](_0x4a2da0);}})[_0xc0a4('0x1b')](function(_0x498952){if(_0x498952){_0x2d8511=_0x498952[_0xc0a4('0x4b')];if(!_0x1cc5ba['query'][_0xc0a4('0x3c')]('nolimit')){_0x4a2da0['limit']=qs[_0xc0a4('0x2c')](_0x1cc5ba[_0xc0a4('0x38')][_0xc0a4('0x2c')]);_0x4a2da0[_0xc0a4('0x2b')]=qs[_0xc0a4('0x2b')](_0x1cc5ba[_0xc0a4('0x38')][_0xc0a4('0x2b')]);}return _0x38df1c[_0xc0a4('0x53')](_0x4a2da0);}})['then'](function(_0x3f5d74){if(_0x3f5d74){return _0x3f5d74?{'count':_0x2d8511,'rows':_0x3f5d74}:null;}})['then'](respondWithResult(_0x67040c,null))['catch'](handleError(_0x67040c,null));};exports['getDescriptions']=function(_0x27fe14,_0x43ac64,_0xa6e9b4){var _0x2aeb01={};var _0x2e03b0={};var _0x312f83;var _0x1f0ded;return db[_0xc0a4('0x34')]['findOne']({'where':{'id':_0x27fe14[_0xc0a4('0x50')]['id']}})[_0xc0a4('0x1b')](handleEntityNotFound(_0x43ac64,null))[_0xc0a4('0x1b')](function(_0x1aefb1){if(_0x1aefb1){_0x312f83=_0x1aefb1;_0x2e03b0[_0xc0a4('0x37')]=_[_0xc0a4('0x48')](db[_0xc0a4('0x54')][_0xc0a4('0x49')]);_0x2e03b0['query']=_['keys'](_0x27fe14[_0xc0a4('0x38')]);_0x2e03b0[_0xc0a4('0x39')]=_[_0xc0a4('0x4a')](_0x2e03b0[_0xc0a4('0x37')],_0x2e03b0[_0xc0a4('0x38')]);_0x2aeb01[_0xc0a4('0x3a')]=_[_0xc0a4('0x4a')](_0x2e03b0[_0xc0a4('0x37')],qs[_0xc0a4('0x3b')](_0x27fe14['query'][_0xc0a4('0x3b')]));_0x2aeb01[_0xc0a4('0x3a')]=_0x2aeb01[_0xc0a4('0x3a')][_0xc0a4('0x4b')]?_0x2aeb01['attributes']:_0x2e03b0['model'];_0x2aeb01[_0xc0a4('0x3e')]=qs[_0xc0a4('0x3f')](_0x27fe14['query'][_0xc0a4('0x3f')]);_0x2aeb01['where']=qs[_0xc0a4('0x39')](_[_0xc0a4('0x41')](_0x27fe14[_0xc0a4('0x38')],_0x2e03b0[_0xc0a4('0x39')]));if(_0x27fe14['query']['filter']){_0x2aeb01[_0xc0a4('0x40')]=_[_0xc0a4('0x44')](_0x2aeb01[_0xc0a4('0x40')],{'$or':_[_0xc0a4('0x33')](_0x2aeb01[_0xc0a4('0x3a')],function(_0x41f41a){var _0x18c6d5={};_0x18c6d5[_0x41f41a]={'$like':'%'+_0x27fe14[_0xc0a4('0x38')][_0xc0a4('0x42')]+'%'};return _0x18c6d5;})});}_0x2aeb01=_[_0xc0a4('0x44')]({},_0x2aeb01,_0x27fe14[_0xc0a4('0x4c')]);return _0x312f83[_0xc0a4('0x55')](_0x2aeb01);}})[_0xc0a4('0x1b')](function(_0x5ed3b7){if(_0x5ed3b7){_0x1f0ded=_0x5ed3b7[_0xc0a4('0x4b')];if(!_0x27fe14[_0xc0a4('0x38')][_0xc0a4('0x3c')](_0xc0a4('0x3d'))){_0x2aeb01[_0xc0a4('0x2c')]=qs[_0xc0a4('0x2c')](_0x27fe14['query'][_0xc0a4('0x2c')]);_0x2aeb01['offset']=qs[_0xc0a4('0x2b')](_0x27fe14[_0xc0a4('0x38')]['offset']);}return _0x312f83[_0xc0a4('0x55')](_0x2aeb01);}})[_0xc0a4('0x1b')](function(_0x4e0cc1){if(_0x4e0cc1){return _0x4e0cc1?{'count':_0x1f0ded,'rows':_0x4e0cc1}:null;}})[_0xc0a4('0x1b')](respondWithResult(_0x43ac64,null))[_0xc0a4('0x25')](handleError(_0x43ac64,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index cee2084..f1ca9a7 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 _0xc0cf=['int_sugarcrm_configurations','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','SugarcrmConfiguration'];(function(_0x3170c7,_0x354c02){var _0x291457=function(_0x3dc7ba){while(--_0x3dc7ba){_0x3170c7['push'](_0x3170c7['shift']());}};_0x291457(++_0x354c02);}(_0xc0cf,0x1b1));var _0xfc0c=function(_0x34d53c,_0x4c5503){_0x34d53c=_0x34d53c-0x0;var _0xdbd57b=_0xc0cf[_0x34d53c];return _0xdbd57b;};'use strict';var _=require(_0xfc0c('0x0'));var util=require(_0xfc0c('0x1'));var logger=require(_0xfc0c('0x2'))('api');var moment=require(_0xfc0c('0x3'));var BPromise=require(_0xfc0c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc0c('0x5'));var rimraf=require(_0xfc0c('0x6'));var config=require(_0xfc0c('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xfc0c('0x8')]=function(_0x271243,_0x290cdf){return _0x271243[_0xfc0c('0x9')](_0xfc0c('0xa'),attributes,{'tableName':_0xfc0c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ecf=['SugarcrmConfiguration','lodash','../../config/logger','api','moment','path','rimraf','./intSugarcrmConfiguration.attributes','exports','define'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x0ecf,0xdd));var _0xf0ec=function(_0x5c729c,_0x52a1bf){_0x5c729c=_0x5c729c-0x0;var _0xdee2f2=_0x0ecf[_0x5c729c];return _0xdee2f2;};'use strict';var _=require(_0xf0ec('0x0'));var util=require('util');var logger=require(_0xf0ec('0x1'))(_0xf0ec('0x2'));var moment=require(_0xf0ec('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0ec('0x4'));var rimraf=require(_0xf0ec('0x5'));var config=require('../../config/environment');var attributes=require(_0xf0ec('0x6'));module[_0xf0ec('0x7')]=function(_0x2f906f,_0x2f90f2){return _0x2f906f[_0xf0ec('0x8')](_0xf0ec('0x9'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index be48ebd..fa05dae 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 _0x4c7f=['SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x26c6b9,_0x232e4a){var _0x2ae6dd=function(_0x5ba7ea){while(--_0x5ba7ea){_0x26c6b9['push'](_0x26c6b9['shift']());}};_0x2ae6dd(++_0x232e4a);}(_0x4c7f,0x1d1));var _0xf4c7=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x4c7f[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require(_0xf4c7('0x0'));var util=require(_0xf4c7('0x1'));var moment=require(_0xf4c7('0x2'));var BPromise=require(_0xf4c7('0x3'));var rs=require(_0xf4c7('0x4'));var fs=require('fs');var Redis=require(_0xf4c7('0x5'));var db=require(_0xf4c7('0x6'))['db'];var utils=require(_0xf4c7('0x7'));var logger=require(_0xf4c7('0x8'))(_0xf4c7('0x9'));var config=require(_0xf4c7('0xa'));var jayson=require(_0xf4c7('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x22a242,_0x57bdc5,_0x2d1125){return new BPromise(function(_0x1612e2,_0x5467ba){return client[_0xf4c7('0xc')](_0x22a242,_0x2d1125)[_0xf4c7('0xd')](function(_0x1584d7){logger[_0xf4c7('0xe')](_0xf4c7('0xf'),_0x57bdc5,_0xf4c7('0x10'));logger[_0xf4c7('0x11')](_0xf4c7('0x12'),_0x57bdc5,_0xf4c7('0x10'),JSON[_0xf4c7('0x13')](_0x1584d7));if(_0x1584d7[_0xf4c7('0x14')]){if(_0x1584d7['error']['code']===0x1f4){logger[_0xf4c7('0x14')](_0xf4c7('0xf'),_0x57bdc5,_0x1584d7[_0xf4c7('0x14')][_0xf4c7('0x15')]);return _0x5467ba(_0x1584d7['error'][_0xf4c7('0x15')]);}logger[_0xf4c7('0x14')](_0xf4c7('0xf'),_0x57bdc5,_0x1584d7[_0xf4c7('0x14')]['message']);return _0x1612e2(_0x1584d7[_0xf4c7('0x14')]['message']);}else{logger['info'](_0xf4c7('0xf'),_0x57bdc5,_0xf4c7('0x10'));_0x1612e2(_0x1584d7[_0xf4c7('0x16')][_0xf4c7('0x15')]);}})[_0xf4c7('0x17')](function(_0x32816a){logger[_0xf4c7('0x14')](_0xf4c7('0xf'),_0x57bdc5,_0x32816a);_0x5467ba(_0x32816a);});});} \ No newline at end of file +var _0x9364=['info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x435400,_0x967d0b){var _0xa8927f=function(_0x300310){while(--_0x300310){_0x435400['push'](_0x435400['shift']());}};_0xa8927f(++_0x967d0b);}(_0x9364,0x10a));var _0x4936=function(_0x5ebcc6,_0x1b3e0e){_0x5ebcc6=_0x5ebcc6-0x0;var _0x2985f8=_0x9364[_0x5ebcc6];return _0x2985f8;};'use strict';var _=require(_0x4936('0x0'));var util=require(_0x4936('0x1'));var moment=require(_0x4936('0x2'));var BPromise=require(_0x4936('0x3'));var rs=require(_0x4936('0x4'));var fs=require('fs');var Redis=require(_0x4936('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4936('0x6'));var logger=require(_0x4936('0x7'))(_0x4936('0x8'));var config=require(_0x4936('0x9'));var jayson=require(_0x4936('0xa'));var client=jayson['client'][_0x4936('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x527d53,_0x2891ae,_0x1fc8d5){return new BPromise(function(_0x362f93,_0x54b73b){return client['request'](_0x527d53,_0x1fc8d5)['then'](function(_0x527231){logger['info'](_0x4936('0xc'),_0x2891ae,'request\x20sent');logger[_0x4936('0xd')](_0x4936('0xe'),_0x2891ae,_0x4936('0xf'),JSON[_0x4936('0x10')](_0x527231));if(_0x527231[_0x4936('0x11')]){if(_0x527231[_0x4936('0x11')][_0x4936('0x12')]===0x1f4){logger[_0x4936('0x11')](_0x4936('0xc'),_0x2891ae,_0x527231[_0x4936('0x11')][_0x4936('0x13')]);return _0x54b73b(_0x527231[_0x4936('0x11')][_0x4936('0x13')]);}logger[_0x4936('0x11')](_0x4936('0xc'),_0x2891ae,_0x527231['error'][_0x4936('0x13')]);return _0x362f93(_0x527231[_0x4936('0x11')][_0x4936('0x13')]);}else{logger[_0x4936('0x14')](_0x4936('0xc'),_0x2891ae,'request\x20sent');_0x362f93(_0x527231['result']['message']);}})[_0x4936('0x15')](function(_0x29a33b){logger[_0x4936('0x11')](_0x4936('0xc'),_0x2891ae,_0x29a33b);_0x54b73b(_0x29a33b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index b770bb0..1a8cda7 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 _0x2a36=['create','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated'];(function(_0x4acd65,_0x193e16){var _0x1e7c1d=function(_0x49ee80){while(--_0x49ee80){_0x4acd65['push'](_0x4acd65['shift']());}};_0x1e7c1d(++_0x193e16);}(_0x2a36,0x95));var _0x62a3=function(_0x5e64b4,_0x3fe76b){_0x5e64b4=_0x5e64b4-0x0;var _0x4c85ce=_0x2a36[_0x5e64b4];return _0x4c85ce;};'use strict';var multer=require(_0x62a3('0x0'));var util=require(_0x62a3('0x1'));var path=require(_0x62a3('0x2'));var timeout=require(_0x62a3('0x3'));var express=require(_0x62a3('0x4'));var router=express[_0x62a3('0x5')]();var fs_extra=require(_0x62a3('0x6'));var auth=require(_0x62a3('0x7'));var interaction=require(_0x62a3('0x8'));var config=require(_0x62a3('0x9'));var controller=require(_0x62a3('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x62a3('0xb')]('/:id',auth[_0x62a3('0xc')](),controller['show']);router['post']('/',auth[_0x62a3('0xc')](),controller[_0x62a3('0xd')]);router['put'](_0x62a3('0xe'),auth[_0x62a3('0xc')](),controller[_0x62a3('0xf')]);router['delete'](_0x62a3('0xe'),auth[_0x62a3('0xc')](),controller[_0x62a3('0x10')]);module[_0x62a3('0x11')]=router; \ No newline at end of file +var _0x1178=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','/:id','create'];(function(_0x580b43,_0x527e4a){var _0x46d154=function(_0x5135eb){while(--_0x5135eb){_0x580b43['push'](_0x580b43['shift']());}};_0x46d154(++_0x527e4a);}(_0x1178,0xb7));var _0x8117=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1178[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8117('0x0'));var util=require(_0x8117('0x1'));var path=require(_0x8117('0x2'));var timeout=require(_0x8117('0x3'));var express=require(_0x8117('0x4'));var router=express[_0x8117('0x5')]();var fs_extra=require(_0x8117('0x6'));var auth=require(_0x8117('0x7'));var interaction=require(_0x8117('0x8'));var config=require(_0x8117('0x9'));var controller=require(_0x8117('0xa'));router[_0x8117('0xb')]('/',auth[_0x8117('0xc')](),controller['index']);router[_0x8117('0xb')](_0x8117('0xd'),auth[_0x8117('0xc')](),controller['show']);router['post']('/',auth[_0x8117('0xc')](),controller[_0x8117('0xe')]);router['put'](_0x8117('0xd'),auth[_0x8117('0xc')](),controller[_0x8117('0xf')]);router[_0x8117('0x10')](_0x8117('0xd'),auth[_0x8117('0xc')](),controller[_0x8117('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 39c0faa..b0b718f 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 _0x303a=['customVariable','picklist','STRING','sequelize','ENUM','string','variable'];(function(_0x213ed5,_0x26712a){var _0x191514=function(_0x2d9305){while(--_0x2d9305){_0x213ed5['push'](_0x213ed5['shift']());}};_0x191514(++_0x26712a);}(_0x303a,0x1a0));var _0xa303=function(_0x942eca,_0x1d0181){_0x942eca=_0x942eca-0x0;var _0x589c16=_0x303a[_0x942eca];return _0x589c16;};'use strict';var Sequelize=require(_0xa303('0x0'));module['exports']={'type':{'type':Sequelize[_0xa303('0x1')](_0xa303('0x2'),_0xa303('0x3'),_0xa303('0x4'),'keyValue',_0xa303('0x5')),'defaultValue':_0xa303('0x2')},'content':{'type':Sequelize[_0xa303('0x6')]},'key':{'type':Sequelize[_0xa303('0x6')]},'keyType':{'type':Sequelize[_0xa303('0x1')](_0xa303('0x2'),_0xa303('0x3'),_0xa303('0x4'))},'keyContent':{'type':Sequelize[_0xa303('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa303('0x6')]}}; \ No newline at end of file +var _0xaf93=['ENUM','sequelize','exports','variable','customVariable','picklist','string','STRING'];(function(_0x29cbcc,_0x25e6d1){var _0x973a76=function(_0xc650c6){while(--_0xc650c6){_0x29cbcc['push'](_0x29cbcc['shift']());}};_0x973a76(++_0x25e6d1);}(_0xaf93,0x151));var _0x3af9=function(_0x51a055,_0x2a0ecb){_0x51a055=_0x51a055-0x0;var _0xe9590a=_0xaf93[_0x51a055];return _0xe9590a;};'use strict';var Sequelize=require(_0x3af9('0x0'));module[_0x3af9('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x3af9('0x2'),_0x3af9('0x3'),'keyValue',_0x3af9('0x4')),'defaultValue':_0x3af9('0x5')},'content':{'type':Sequelize[_0x3af9('0x6')]},'key':{'type':Sequelize[_0x3af9('0x6')]},'keyType':{'type':Sequelize[_0x3af9('0x7')](_0x3af9('0x5'),_0x3af9('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x3af9('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3af9('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index d1abaa5..4f35939 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 _0xd38f=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','limit','set','apply','reject','update','then','destroy','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','find','create','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xd38f,0x1e7));var _0xfd38=function(_0x5c7387,_0x1359d9){_0x5c7387=_0x5c7387-0x0;var _0x449735=_0xd38f[_0x5c7387];return _0x449735;};'use strict';var emlformat=require(_0xfd38('0x0'));var rimraf=require(_0xfd38('0x1'));var zipdir=require(_0xfd38('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfd38('0x3'));var moment=require(_0xfd38('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfd38('0x5'));var util=require(_0xfd38('0x6'));var path=require('path');var sox=require(_0xfd38('0x7'));var csv=require(_0xfd38('0x8'));var ejs=require(_0xfd38('0x9'));var fs=require('fs');var fs_extra=require(_0xfd38('0xa'));var _=require('lodash');var squel=require(_0xfd38('0xb'));var crypto=require(_0xfd38('0xc'));var jsforce=require(_0xfd38('0xd'));var deskjs=require(_0xfd38('0xe'));var toCsv=require(_0xfd38('0x8'));var querystring=require(_0xfd38('0xf'));var Papa=require(_0xfd38('0x10'));var Redis=require(_0xfd38('0x11'));var authService=require(_0xfd38('0x12'));var qs=require(_0xfd38('0x13'));var as=require(_0xfd38('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfd38('0x15'))(_0xfd38('0x16'));var utils=require(_0xfd38('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfd38('0x18'))['db'];function respondWithStatusCode(_0x1fed0d,_0x4ed2b2){_0x4ed2b2=_0x4ed2b2||0xcc;return function(_0x256337){if(_0x256337){return _0x1fed0d[_0xfd38('0x19')](_0x4ed2b2);}return _0x1fed0d[_0xfd38('0x1a')](_0x4ed2b2)[_0xfd38('0x1b')]();};}function respondWithResult(_0x1f0bf4,_0x19ceee){_0x19ceee=_0x19ceee||0xc8;return function(_0x16dee2){if(_0x16dee2){return _0x1f0bf4['status'](_0x19ceee)[_0xfd38('0x1c')](_0x16dee2);}};}function respondWithFilteredResult(_0x5d1db0,_0x4bd0c8){return function(_0x56a1b5){if(_0x56a1b5){var _0x1f5e86=_0x56a1b5['count'],_0x1f12c9=_0x4bd0c8['offset'],_0x3422fe=_0x4bd0c8['offset']+_0x4bd0c8[_0xfd38('0x1d')],_0x1445e2;if(_0x3422fe>=_0x1f5e86){_0x3422fe=_0x1f5e86;_0x1445e2=0xc8;}else{_0x1445e2=0xce;}_0x5d1db0[_0xfd38('0x1a')](_0x1445e2);return _0x5d1db0[_0xfd38('0x1e')]('Content-Range',_0x1f12c9+'-'+_0x3422fe+'/'+_0x1f5e86)[_0xfd38('0x1c')](_0x56a1b5);}return null;};}function patchUpdates(_0x42293a){return function(_0xf38c03){try{jsonpatch[_0xfd38('0x1f')](_0xf38c03,_0x42293a,!![]);}catch(_0x46029b){return BPromise[_0xfd38('0x20')](_0x46029b);}return _0xf38c03['save']();};}function saveUpdates(_0x271988,_0x1b22e1){return function(_0x5e68be){if(_0x5e68be){return _0x5e68be[_0xfd38('0x21')](_0x271988)[_0xfd38('0x22')](function(_0x25f659){return _0x25f659;});}return null;};}function removeEntity(_0x33e927,_0x572ce2){return function(_0x535e26){if(_0x535e26){return _0x535e26[_0xfd38('0x23')]()[_0xfd38('0x22')](function(){_0x33e927[_0xfd38('0x1a')](0xcc)[_0xfd38('0x1b')]();});}};}function handleEntityNotFound(_0x5a0084,_0x1741b3){return function(_0x1c86f1){if(!_0x1c86f1){_0x5a0084['sendStatus'](0x194);}return _0x1c86f1;};}function handleError(_0xdecf66,_0x330492){_0x330492=_0x330492||0x1f4;return function(_0xac828a){logger['error'](_0xac828a[_0xfd38('0x24')]);if(_0xac828a[_0xfd38('0x25')]){delete _0xac828a[_0xfd38('0x25')];}_0xdecf66[_0xfd38('0x1a')](_0x330492)[_0xfd38('0x26')](_0xac828a);};}exports[_0xfd38('0x27')]=function(_0x5a7fff,_0x4987ae){var _0x3c3b58={},_0x18608b={},_0x2a675d={'count':0x0,'rows':[]};var _0x1edee8=_[_0xfd38('0x28')](db[_0xfd38('0x29')][_0xfd38('0x2a')],function(_0x44743e){return{'name':_0x44743e[_0xfd38('0x2b')],'type':_0x44743e[_0xfd38('0x2c')][_0xfd38('0x2d')]};});_0x18608b[_0xfd38('0x2e')]=_[_0xfd38('0x28')](_0x1edee8,_0xfd38('0x25'));_0x18608b[_0xfd38('0x2f')]=_[_0xfd38('0x30')](_0x5a7fff[_0xfd38('0x2f')]);_0x18608b[_0xfd38('0x31')]=_[_0xfd38('0x32')](_0x18608b[_0xfd38('0x2e')],_0x18608b[_0xfd38('0x2f')]);_0x3c3b58[_0xfd38('0x33')]=_[_0xfd38('0x32')](_0x18608b[_0xfd38('0x2e')],qs[_0xfd38('0x34')](_0x5a7fff[_0xfd38('0x2f')][_0xfd38('0x34')]));_0x3c3b58['attributes']=_0x3c3b58[_0xfd38('0x33')]['length']?_0x3c3b58['attributes']:_0x18608b[_0xfd38('0x2e')];if(!_0x5a7fff[_0xfd38('0x2f')]['hasOwnProperty']('nolimit')){_0x3c3b58['limit']=qs['limit'](_0x5a7fff[_0xfd38('0x2f')][_0xfd38('0x1d')]);_0x3c3b58['offset']=qs[_0xfd38('0x35')](_0x5a7fff['query'][_0xfd38('0x35')]);}_0x3c3b58[_0xfd38('0x36')]=qs[_0xfd38('0x37')](_0x5a7fff[_0xfd38('0x2f')]['sort']);_0x3c3b58[_0xfd38('0x38')]=qs[_0xfd38('0x31')](_[_0xfd38('0x39')](_0x5a7fff[_0xfd38('0x2f')],_0x18608b[_0xfd38('0x31')]),_0x1edee8);if(_0x5a7fff['query'][_0xfd38('0x3a')]){_0x3c3b58['where']=_[_0xfd38('0x3b')](_0x3c3b58[_0xfd38('0x38')],{'$or':_['map'](_0x1edee8,function(_0x50eb35){if(_0x50eb35[_0xfd38('0x2c')]!==_0xfd38('0x3c')){var _0x334bbc={};_0x334bbc[_0x50eb35[_0xfd38('0x25')]]={'$like':'%'+_0x5a7fff[_0xfd38('0x2f')][_0xfd38('0x3a')]+'%'};return _0x334bbc;}})});}_0x3c3b58=_[_0xfd38('0x3b')]({},_0x3c3b58,_0x5a7fff[_0xfd38('0x3d')]);var _0x130f4c={'where':_0x3c3b58['where']};return db[_0xfd38('0x29')][_0xfd38('0x3e')](_0x130f4c)[_0xfd38('0x22')](function(_0x120938){_0x2a675d[_0xfd38('0x3e')]=_0x120938;if(_0x5a7fff[_0xfd38('0x2f')][_0xfd38('0x3f')]){_0x3c3b58[_0xfd38('0x40')]=[{'all':!![]}];}return db[_0xfd38('0x29')][_0xfd38('0x41')](_0x3c3b58);})[_0xfd38('0x22')](function(_0x5419f4){_0x2a675d[_0xfd38('0x42')]=_0x5419f4;return _0x2a675d;})[_0xfd38('0x22')](respondWithFilteredResult(_0x4987ae,_0x3c3b58))['catch'](handleError(_0x4987ae,null));};exports['show']=function(_0x11d365,_0x4164ff){var _0x591951={'raw':!![],'where':{'id':_0x11d365[_0xfd38('0x43')]['id']}},_0x3819bd={};_0x3819bd[_0xfd38('0x2e')]=_[_0xfd38('0x30')](db[_0xfd38('0x29')][_0xfd38('0x2a')]);_0x3819bd['query']=_[_0xfd38('0x30')](_0x11d365['query']);_0x3819bd[_0xfd38('0x31')]=_[_0xfd38('0x32')](_0x3819bd[_0xfd38('0x2e')],_0x3819bd[_0xfd38('0x2f')]);_0x591951['attributes']=_[_0xfd38('0x32')](_0x3819bd[_0xfd38('0x2e')],qs[_0xfd38('0x34')](_0x11d365[_0xfd38('0x2f')][_0xfd38('0x34')]));_0x591951['attributes']=_0x591951[_0xfd38('0x33')]['length']?_0x591951[_0xfd38('0x33')]:_0x3819bd[_0xfd38('0x2e')];if(_0x11d365[_0xfd38('0x2f')][_0xfd38('0x3f')]){_0x591951[_0xfd38('0x40')]=[{'all':!![]}];}_0x591951=_['merge']({},_0x591951,_0x11d365[_0xfd38('0x3d')]);return db['SugarcrmField'][_0xfd38('0x44')](_0x591951)['then'](handleEntityNotFound(_0x4164ff,null))[_0xfd38('0x22')](respondWithResult(_0x4164ff,null))['catch'](handleError(_0x4164ff,null));};exports[_0xfd38('0x45')]=function(_0x1f0887,_0x306ef1){return db[_0xfd38('0x29')][_0xfd38('0x45')](_0x1f0887[_0xfd38('0x46')],{})[_0xfd38('0x22')](respondWithResult(_0x306ef1,0xc9))[_0xfd38('0x47')](handleError(_0x306ef1,null));};exports[_0xfd38('0x21')]=function(_0x146caa,_0x50d289){if(_0x146caa[_0xfd38('0x46')]['id']){delete _0x146caa[_0xfd38('0x46')]['id'];}return db[_0xfd38('0x29')][_0xfd38('0x44')]({'where':{'id':_0x146caa[_0xfd38('0x43')]['id']}})['then'](handleEntityNotFound(_0x50d289,null))[_0xfd38('0x22')](saveUpdates(_0x146caa['body'],null))['then'](respondWithResult(_0x50d289,null))[_0xfd38('0x47')](handleError(_0x50d289,null));};exports['destroy']=function(_0x13db1a,_0x213779){return db[_0xfd38('0x29')][_0xfd38('0x44')]({'where':{'id':_0x13db1a[_0xfd38('0x43')]['id']}})[_0xfd38('0x22')](handleEntityNotFound(_0x213779,null))[_0xfd38('0x22')](removeEntity(_0x213779,null))[_0xfd38('0x47')](handleError(_0x213779,null));}; \ No newline at end of file +var _0x3972=['status','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','params','keys','fields','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','set','apply','reject','save','update','then','destroy'];(function(_0x61b3ab,_0x1fc298){var _0x57097f=function(_0x25970b){while(--_0x25970b){_0x61b3ab['push'](_0x61b3ab['shift']());}};_0x57097f(++_0x1fc298);}(_0x3972,0x100));var _0x2397=function(_0x1cf513,_0x174bc8){_0x1cf513=_0x1cf513-0x0;var _0x5c3f43=_0x3972[_0x1cf513];return _0x5c3f43;};'use strict';var emlformat=require(_0x2397('0x0'));var rimraf=require(_0x2397('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2397('0x2'));var rp=require(_0x2397('0x3'));var moment=require(_0x2397('0x4'));var BPromise=require(_0x2397('0x5'));var Mustache=require('mustache');var util=require(_0x2397('0x6'));var path=require(_0x2397('0x7'));var sox=require(_0x2397('0x8'));var csv=require(_0x2397('0x9'));var ejs=require(_0x2397('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2397('0xb'));var squel=require('squel');var crypto=require(_0x2397('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2397('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2397('0xe'));var Redis=require(_0x2397('0xf'));var authService=require(_0x2397('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2397('0x11'));var hardwareService=require(_0x2397('0x12'));var logger=require('../../config/logger')(_0x2397('0x13'));var utils=require(_0x2397('0x14'));var config=require(_0x2397('0x15'));var licenseUtil=require(_0x2397('0x16'));var db=require(_0x2397('0x17'))['db'];function respondWithStatusCode(_0x133fda,_0x561d19){_0x561d19=_0x561d19||0xcc;return function(_0x41ad45){if(_0x41ad45){return _0x133fda[_0x2397('0x18')](_0x561d19);}return _0x133fda['status'](_0x561d19)[_0x2397('0x19')]();};}function respondWithResult(_0x3a15f6,_0x1bb407){_0x1bb407=_0x1bb407||0xc8;return function(_0x2ea08e){if(_0x2ea08e){return _0x3a15f6['status'](_0x1bb407)[_0x2397('0x1a')](_0x2ea08e);}};}function respondWithFilteredResult(_0x292ffb,_0x47b4a2){return function(_0x2251f1){if(_0x2251f1){var _0x3e3c56=_0x2251f1[_0x2397('0x1b')],_0x40b058=_0x47b4a2['offset'],_0x14928e=_0x47b4a2[_0x2397('0x1c')]+_0x47b4a2['limit'],_0x25b055;if(_0x14928e>=_0x3e3c56){_0x14928e=_0x3e3c56;_0x25b055=0xc8;}else{_0x25b055=0xce;}_0x292ffb['status'](_0x25b055);return _0x292ffb[_0x2397('0x1d')]('Content-Range',_0x40b058+'-'+_0x14928e+'/'+_0x3e3c56)['json'](_0x2251f1);}return null;};}function patchUpdates(_0x3535d6){return function(_0x51d879){try{jsonpatch[_0x2397('0x1e')](_0x51d879,_0x3535d6,!![]);}catch(_0x14ce6d){return BPromise[_0x2397('0x1f')](_0x14ce6d);}return _0x51d879[_0x2397('0x20')]();};}function saveUpdates(_0x526611,_0x5d9e6e){return function(_0x320dc9){if(_0x320dc9){return _0x320dc9[_0x2397('0x21')](_0x526611)[_0x2397('0x22')](function(_0x16ac67){return _0x16ac67;});}return null;};}function removeEntity(_0x9ba288,_0x5ab030){return function(_0xb0978f){if(_0xb0978f){return _0xb0978f[_0x2397('0x23')]()[_0x2397('0x22')](function(){_0x9ba288[_0x2397('0x24')](0xcc)[_0x2397('0x19')]();});}};}function handleEntityNotFound(_0x35d281,_0x388578){return function(_0xe55a12){if(!_0xe55a12){_0x35d281['sendStatus'](0x194);}return _0xe55a12;};}function handleError(_0x183366,_0x5da5b8){_0x5da5b8=_0x5da5b8||0x1f4;return function(_0x58dcba){logger['error'](_0x58dcba[_0x2397('0x25')]);if(_0x58dcba['name']){delete _0x58dcba[_0x2397('0x26')];}_0x183366[_0x2397('0x24')](_0x5da5b8)[_0x2397('0x27')](_0x58dcba);};}exports[_0x2397('0x28')]=function(_0x2ec191,_0x2b0c1b){var _0x4a7c66={},_0x4fb944={},_0x4b32f0={'count':0x0,'rows':[]};var _0x27254f=_[_0x2397('0x29')](db[_0x2397('0x2a')][_0x2397('0x2b')],function(_0x5e7357){return{'name':_0x5e7357[_0x2397('0x2c')],'type':_0x5e7357['type'][_0x2397('0x2d')]};});_0x4fb944[_0x2397('0x2e')]=_['map'](_0x27254f,_0x2397('0x26'));_0x4fb944[_0x2397('0x2f')]=_['keys'](_0x2ec191[_0x2397('0x2f')]);_0x4fb944[_0x2397('0x30')]=_[_0x2397('0x31')](_0x4fb944[_0x2397('0x2e')],_0x4fb944[_0x2397('0x2f')]);_0x4a7c66['attributes']=_[_0x2397('0x31')](_0x4fb944[_0x2397('0x2e')],qs['fields'](_0x2ec191[_0x2397('0x2f')]['fields']));_0x4a7c66[_0x2397('0x32')]=_0x4a7c66[_0x2397('0x32')][_0x2397('0x33')]?_0x4a7c66[_0x2397('0x32')]:_0x4fb944[_0x2397('0x2e')];if(!_0x2ec191['query'][_0x2397('0x34')](_0x2397('0x35'))){_0x4a7c66[_0x2397('0x36')]=qs[_0x2397('0x36')](_0x2ec191['query'][_0x2397('0x36')]);_0x4a7c66[_0x2397('0x1c')]=qs[_0x2397('0x1c')](_0x2ec191['query'][_0x2397('0x1c')]);}_0x4a7c66['order']=qs['sort'](_0x2ec191[_0x2397('0x2f')][_0x2397('0x37')]);_0x4a7c66[_0x2397('0x38')]=qs[_0x2397('0x30')](_[_0x2397('0x39')](_0x2ec191[_0x2397('0x2f')],_0x4fb944[_0x2397('0x30')]),_0x27254f);if(_0x2ec191['query'][_0x2397('0x3a')]){_0x4a7c66['where']=_[_0x2397('0x3b')](_0x4a7c66[_0x2397('0x38')],{'$or':_[_0x2397('0x29')](_0x27254f,function(_0x2db1c2){if(_0x2db1c2[_0x2397('0x3c')]!==_0x2397('0x3d')){var _0x236f0c={};_0x236f0c[_0x2db1c2['name']]={'$like':'%'+_0x2ec191[_0x2397('0x2f')][_0x2397('0x3a')]+'%'};return _0x236f0c;}})});}_0x4a7c66=_['merge']({},_0x4a7c66,_0x2ec191['options']);var _0x28ca3f={'where':_0x4a7c66['where']};return db[_0x2397('0x2a')][_0x2397('0x1b')](_0x28ca3f)[_0x2397('0x22')](function(_0x18e55e){_0x4b32f0[_0x2397('0x1b')]=_0x18e55e;if(_0x2ec191[_0x2397('0x2f')][_0x2397('0x3e')]){_0x4a7c66[_0x2397('0x3f')]=[{'all':!![]}];}return db[_0x2397('0x2a')]['findAll'](_0x4a7c66);})[_0x2397('0x22')](function(_0x5bf60b){_0x4b32f0[_0x2397('0x40')]=_0x5bf60b;return _0x4b32f0;})[_0x2397('0x22')](respondWithFilteredResult(_0x2b0c1b,_0x4a7c66))[_0x2397('0x41')](handleError(_0x2b0c1b,null));};exports['show']=function(_0x3141ef,_0x288743){var _0x1624c8={'raw':!![],'where':{'id':_0x3141ef[_0x2397('0x42')]['id']}},_0x4b2424={};_0x4b2424[_0x2397('0x2e')]=_['keys'](db[_0x2397('0x2a')][_0x2397('0x2b')]);_0x4b2424[_0x2397('0x2f')]=_[_0x2397('0x43')](_0x3141ef[_0x2397('0x2f')]);_0x4b2424[_0x2397('0x30')]=_[_0x2397('0x31')](_0x4b2424[_0x2397('0x2e')],_0x4b2424[_0x2397('0x2f')]);_0x1624c8[_0x2397('0x32')]=_[_0x2397('0x31')](_0x4b2424[_0x2397('0x2e')],qs['fields'](_0x3141ef[_0x2397('0x2f')][_0x2397('0x44')]));_0x1624c8[_0x2397('0x32')]=_0x1624c8[_0x2397('0x32')][_0x2397('0x33')]?_0x1624c8['attributes']:_0x4b2424[_0x2397('0x2e')];if(_0x3141ef[_0x2397('0x2f')]['includeAll']){_0x1624c8['include']=[{'all':!![]}];}_0x1624c8=_[_0x2397('0x3b')]({},_0x1624c8,_0x3141ef[_0x2397('0x45')]);return db[_0x2397('0x2a')][_0x2397('0x46')](_0x1624c8)[_0x2397('0x22')](handleEntityNotFound(_0x288743,null))[_0x2397('0x22')](respondWithResult(_0x288743,null))[_0x2397('0x41')](handleError(_0x288743,null));};exports[_0x2397('0x47')]=function(_0x225a8e,_0x27980b){return db[_0x2397('0x2a')]['create'](_0x225a8e['body'],{})[_0x2397('0x22')](respondWithResult(_0x27980b,0xc9))[_0x2397('0x41')](handleError(_0x27980b,null));};exports[_0x2397('0x21')]=function(_0x1989a0,_0x541733){if(_0x1989a0[_0x2397('0x48')]['id']){delete _0x1989a0[_0x2397('0x48')]['id'];}return db[_0x2397('0x2a')][_0x2397('0x46')]({'where':{'id':_0x1989a0['params']['id']}})['then'](handleEntityNotFound(_0x541733,null))[_0x2397('0x22')](saveUpdates(_0x1989a0[_0x2397('0x48')],null))[_0x2397('0x22')](respondWithResult(_0x541733,null))['catch'](handleError(_0x541733,null));};exports[_0x2397('0x23')]=function(_0x4a0245,_0x176291){return db['SugarcrmField'][_0x2397('0x46')]({'where':{'id':_0x4a0245[_0x2397('0x42')]['id']}})[_0x2397('0x22')](handleEntityNotFound(_0x176291,null))['then'](removeEntity(_0x176291,null))[_0x2397('0x41')](handleError(_0x176291,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index ffa68aa..5f5facd 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 _0x31a3=['int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0x31a3,0xe5));var _0x331a=function(_0x4dee14,_0x3d6aba){_0x4dee14=_0x4dee14-0x0;var _0x4daacb=_0x31a3[_0x4dee14];return _0x4daacb;};'use strict';var _=require(_0x331a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x331a('0x1'));var moment=require('moment');var BPromise=require(_0x331a('0x2'));var rp=require(_0x331a('0x3'));var fs=require('fs');var path=require(_0x331a('0x4'));var rimraf=require(_0x331a('0x5'));var config=require(_0x331a('0x6'));var attributes=require(_0x331a('0x7'));module[_0x331a('0x8')]=function(_0x5324fa,_0x4d4f20){return _0x5324fa[_0x331a('0x9')](_0x331a('0xa'),attributes,{'tableName':_0x331a('0xb'),'paranoid':![],'indexes':[{'name':_0x331a('0xc'),'fields':[_0x331a('0xd'),_0x331a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe626=['sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields'];(function(_0x3008ac,_0x4a2694){var _0x416012=function(_0x1f37e9){while(--_0x1f37e9){_0x3008ac['push'](_0x3008ac['shift']());}};_0x416012(++_0x4a2694);}(_0xe626,0x135));var _0x6e62=function(_0x18e7c9,_0x32e43a){_0x18e7c9=_0x18e7c9-0x0;var _0x5be192=_0xe626[_0x18e7c9];return _0x5be192;};'use strict';var _=require(_0x6e62('0x0'));var util=require(_0x6e62('0x1'));var logger=require(_0x6e62('0x2'))(_0x6e62('0x3'));var moment=require(_0x6e62('0x4'));var BPromise=require(_0x6e62('0x5'));var rp=require(_0x6e62('0x6'));var fs=require('fs');var path=require(_0x6e62('0x7'));var rimraf=require(_0x6e62('0x8'));var config=require('../../config/environment');var attributes=require(_0x6e62('0x9'));module[_0x6e62('0xa')]=function(_0x19a3c4,_0x446e48){return _0x19a3c4[_0x6e62('0xb')](_0x6e62('0xc'),attributes,{'tableName':_0x6e62('0xd'),'paranoid':![],'indexes':[{'name':_0x6e62('0xe'),'fields':[_0x6e62('0xf'),_0x6e62('0x10')],'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 c8ffa89..431a68f 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x5cc1b1,_0xb39424){var _0x295f7=function(_0x2df490){while(--_0x2df490){_0x5cc1b1['push'](_0x5cc1b1['shift']());}};_0x295f7(++_0xb39424);}(_0xdb28,0x106));var _0x8db2=function(_0x43de14,_0x22b907){_0x43de14=_0x43de14-0x0;var _0x1dc3a4=_0xdb28[_0x43de14];return _0x1dc3a4;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x30fc97,_0x70efbc){var _0x362093=function(_0x108496){while(--_0x108496){_0x30fc97['push'](_0x30fc97['shift']());}};_0x362093(++_0x70efbc);}(_0x1a85,0x178));var _0x51a8=function(_0x4218d0,_0x18aa4c){_0x4218d0=_0x4218d0-0x0;var _0x2c142c=_0x1a85[_0x4218d0];return _0x2c142c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 623be4e..0e943a4 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 _0x60d4=['Router','fs-extra','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','getConfigurations','/:id/fields','post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','multer','util','path','connect-timeout'];(function(_0x89bddd,_0x5c50e8){var _0x3a10e6=function(_0x2c887f){while(--_0x2c887f){_0x89bddd['push'](_0x89bddd['shift']());}};_0x3a10e6(++_0x5c50e8);}(_0x60d4,0xa4));var _0x460d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x60d4[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x460d('0x0'));var util=require(_0x460d('0x1'));var path=require(_0x460d('0x2'));var timeout=require(_0x460d('0x3'));var express=require('express');var router=express[_0x460d('0x4')]();var fs_extra=require(_0x460d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x460d('0x6'));var controller=require(_0x460d('0x7'));router[_0x460d('0x8')]('/',auth[_0x460d('0x9')](),controller[_0x460d('0xa')]);router['get']('/:id',auth[_0x460d('0x9')](),controller['show']);router[_0x460d('0x8')]('/:id/configurations',auth[_0x460d('0x9')](),controller[_0x460d('0xb')]);router[_0x460d('0x8')](_0x460d('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x460d('0xd')]('/',auth[_0x460d('0x9')](),controller[_0x460d('0xe')]);router['post'](_0x460d('0xf'),auth[_0x460d('0x9')](),controller[_0x460d('0x10')]);router[_0x460d('0x11')](_0x460d('0x12'),auth[_0x460d('0x9')](),controller[_0x460d('0x13')]);router[_0x460d('0x14')](_0x460d('0x12'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x37f5=['Router','fs-extra','../../components/auth/service','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x3b925c,_0x1e0f77){var _0x4cc6d4=function(_0x931e38){while(--_0x931e38){_0x3b925c['push'](_0x3b925c['shift']());}};_0x4cc6d4(++_0x1e0f77);}(_0x37f5,0x7b));var _0x537f=function(_0x25aa40,_0x26ccbb){_0x25aa40=_0x25aa40-0x0;var _0x4ba55d=_0x37f5[_0x25aa40];return _0x4ba55d;};'use strict';var multer=require('multer');var util=require(_0x537f('0x0'));var path=require('path');var timeout=require(_0x537f('0x1'));var express=require(_0x537f('0x2'));var router=express[_0x537f('0x3')]();var fs_extra=require(_0x537f('0x4'));var auth=require(_0x537f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x537f('0x6'));router[_0x537f('0x7')]('/',auth[_0x537f('0x8')](),controller[_0x537f('0x9')]);router['get'](_0x537f('0xa'),auth[_0x537f('0x8')](),controller['show']);router[_0x537f('0x7')](_0x537f('0xb'),auth[_0x537f('0x8')](),controller['getConfigurations']);router[_0x537f('0x7')]('/:id/fields',auth[_0x537f('0x8')](),controller[_0x537f('0xc')]);router[_0x537f('0xd')]('/',auth[_0x537f('0x8')](),controller[_0x537f('0xe')]);router[_0x537f('0xd')](_0x537f('0xb'),auth['isAuthenticated'](),controller[_0x537f('0xf')]);router[_0x537f('0x10')](_0x537f('0xa'),auth[_0x537f('0x8')](),controller[_0x537f('0x11')]);router[_0x537f('0x12')](_0x537f('0xa'),auth['isAuthenticated'](),controller[_0x537f('0x13')]);module[_0x537f('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 0d6bc17..d2ad637 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 _0xff85=['STRING'];(function(_0xf7494b,_0x2f3f42){var _0x43ea5a=function(_0x42b4f5){while(--_0x42b4f5){_0xf7494b['push'](_0xf7494b['shift']());}};_0x43ea5a(++_0x2f3f42);}(_0xff85,0x1da));var _0x5ff8=function(_0xc2df7,_0x2d8a7d){_0xc2df7=_0xc2df7-0x0;var _0x552947=_0xff85[_0xc2df7];return _0x552947;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5ff8('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x5ff8('0x0')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x5ff8('0x0')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x5ff8('0x0')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x5ff8('0x0')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x5ff8('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x68f8=['sequelize','STRING'];(function(_0xaf5738,_0x3254f9){var _0xeaac2d=function(_0x554c8b){while(--_0x554c8b){_0xaf5738['push'](_0xaf5738['shift']());}};_0xeaac2d(++_0x3254f9);}(_0x68f8,0xf6));var _0x868f=function(_0x300dc2,_0x19df08){_0x300dc2=_0x300dc2-0x0;var _0x515efe=_0x68f8[_0x300dc2];return _0x515efe;};'use strict';var Sequelize=require(_0x868f('0x0'));module['exports']={'name':{'type':Sequelize[_0x868f('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x868f('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x868f('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x868f('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x868f('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 4eeeb38..b84ba42 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 _0xd8b0=['getConfigurations','findOne','pick','merge','hasOwnProperty','addConfiguration','getSubjects','channel','type','Descriptions','getDescriptions','Subjects','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','describe','sessionName','owner','remove','includes','editable','false','label','startsWith','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','offset','limit','set','json','reject','save','update','destroy','end','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','VIRTUAL','options','count','includeAll','include','rows','show','params','create','body','find'];(function(_0x4d86c9,_0x2a19bd){var _0x5f5a4f=function(_0x3a2117){while(--_0x3a2117){_0x4d86c9['push'](_0x4d86c9['shift']());}};_0x5f5a4f(++_0x2a19bd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];var integrations=require(_0x0d8b('0x18'));var jayson=require(_0x0d8b('0x19'));var client=jayson[_0x0d8b('0x1a')][_0x0d8b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x31a8cc,_0x1d4bbc,_0x2ce75e,_0x5ad086){return new BPromise(function(_0xe65334,_0x1567ce){var _0x2d4e1c=_0x5ad086||client;return _0x2d4e1c['request'](_0x31a8cc,_0x2ce75e)[_0x0d8b('0x1c')](function(_0xa86349){logger[_0x0d8b('0x1d')](_0x0d8b('0x1e'),_0x1d4bbc,_0x0d8b('0x1f'));logger['debug'](_0x0d8b('0x20'),_0x1d4bbc,_0x0d8b('0x1f'),JSON[_0x0d8b('0x21')](_0xa86349));if(_0xa86349[_0x0d8b('0x22')]){if(_0xa86349[_0x0d8b('0x22')][_0x0d8b('0x23')]===0x1f4){logger[_0x0d8b('0x22')](_0x0d8b('0x1e'),_0x1d4bbc,_0xa86349['error'][_0x0d8b('0x24')]);return _0x1567ce(_0xa86349[_0x0d8b('0x22')][_0x0d8b('0x24')]);}logger[_0x0d8b('0x22')](_0x0d8b('0x1e'),_0x1d4bbc,_0xa86349[_0x0d8b('0x22')][_0x0d8b('0x24')]);return _0xe65334(_0xa86349[_0x0d8b('0x22')]['message']);}else{logger['info'](_0x0d8b('0x1e'),_0x1d4bbc,'request\x20sent');_0xe65334(_0xa86349['result']['message']);}})[_0x0d8b('0x25')](function(_0x2b924f){logger[_0x0d8b('0x22')](_0x0d8b('0x1e'),_0x1d4bbc,_0x2b924f);_0x1567ce(_0x2b924f);});});}function respondWithStatusCode(_0x221071,_0x2c64e2){_0x2c64e2=_0x2c64e2||0xcc;return function(_0x30980c){if(_0x30980c){return _0x221071[_0x0d8b('0x26')](_0x2c64e2);}return _0x221071[_0x0d8b('0x27')](_0x2c64e2)['end']();};}function respondWithResult(_0xe8bbee,_0x4463ee){_0x4463ee=_0x4463ee||0xc8;return function(_0x5363e3){if(_0x5363e3){return _0xe8bbee[_0x0d8b('0x27')](_0x4463ee)['json'](_0x5363e3);}};}function respondWithFilteredResult(_0x3dd149,_0x234bdd){return function(_0xa2af02){if(_0xa2af02){var _0x4fe6f9=_0xa2af02['count'],_0x59a905=_0x234bdd[_0x0d8b('0x28')],_0x28f639=_0x234bdd['offset']+_0x234bdd[_0x0d8b('0x29')],_0x3ef745;if(_0x28f639>=_0x4fe6f9){_0x28f639=_0x4fe6f9;_0x3ef745=0xc8;}else{_0x3ef745=0xce;}_0x3dd149['status'](_0x3ef745);return _0x3dd149[_0x0d8b('0x2a')]('Content-Range',_0x59a905+'-'+_0x28f639+'/'+_0x4fe6f9)[_0x0d8b('0x2b')](_0xa2af02);}return null;};}function patchUpdates(_0x546bf6){return function(_0x3829c6){try{jsonpatch['apply'](_0x3829c6,_0x546bf6,!![]);}catch(_0x3c8887){return BPromise[_0x0d8b('0x2c')](_0x3c8887);}return _0x3829c6[_0x0d8b('0x2d')]();};}function saveUpdates(_0x56120a,_0x4c80a2){return function(_0x51cf32){if(_0x51cf32){return _0x51cf32[_0x0d8b('0x2e')](_0x56120a)['then'](function(_0x3cdf3c){return _0x3cdf3c;});}return null;};}function removeEntity(_0x54f6f3,_0x5d05fc){return function(_0x36017a){if(_0x36017a){return _0x36017a[_0x0d8b('0x2f')]()[_0x0d8b('0x1c')](function(){_0x54f6f3[_0x0d8b('0x27')](0xcc)[_0x0d8b('0x30')]();});}};}function handleEntityNotFound(_0xeaa769,_0x4a99d3){return function(_0x6f93c7){if(!_0x6f93c7){_0xeaa769['sendStatus'](0x194);}return _0x6f93c7;};}function handleError(_0x37ca42,_0x3ef48d){_0x3ef48d=_0x3ef48d||0x1f4;return function(_0x4b3ea0){logger[_0x0d8b('0x22')](_0x4b3ea0[_0x0d8b('0x31')]);if(_0x4b3ea0[_0x0d8b('0x32')]){delete _0x4b3ea0['name'];}_0x37ca42[_0x0d8b('0x27')](_0x3ef48d)[_0x0d8b('0x33')](_0x4b3ea0);};}exports[_0x0d8b('0x34')]=function(_0x31ceba,_0x933e01){var _0x55d742={},_0x3f1cb3={},_0x1649fc={'count':0x0,'rows':[]};var _0x5ad0fe=_[_0x0d8b('0x35')](db[_0x0d8b('0x36')][_0x0d8b('0x37')],function(_0x974b9b){return{'name':_0x974b9b[_0x0d8b('0x38')],'type':_0x974b9b['type']['key']};});_0x3f1cb3[_0x0d8b('0x39')]=_['map'](_0x5ad0fe,'name');_0x3f1cb3[_0x0d8b('0x3a')]=_[_0x0d8b('0x3b')](_0x31ceba[_0x0d8b('0x3a')]);_0x3f1cb3[_0x0d8b('0x3c')]=_[_0x0d8b('0x3d')](_0x3f1cb3[_0x0d8b('0x39')],_0x3f1cb3['query']);_0x55d742[_0x0d8b('0x3e')]=_[_0x0d8b('0x3d')](_0x3f1cb3[_0x0d8b('0x39')],qs[_0x0d8b('0x3f')](_0x31ceba[_0x0d8b('0x3a')][_0x0d8b('0x3f')]));_0x55d742[_0x0d8b('0x3e')]=_0x55d742['attributes'][_0x0d8b('0x40')]?_0x55d742[_0x0d8b('0x3e')]:_0x3f1cb3[_0x0d8b('0x39')];if(!_0x31ceba[_0x0d8b('0x3a')]['hasOwnProperty'](_0x0d8b('0x41'))){_0x55d742['limit']=qs[_0x0d8b('0x29')](_0x31ceba[_0x0d8b('0x3a')][_0x0d8b('0x29')]);_0x55d742[_0x0d8b('0x28')]=qs[_0x0d8b('0x28')](_0x31ceba[_0x0d8b('0x3a')][_0x0d8b('0x28')]);}_0x55d742[_0x0d8b('0x42')]=qs[_0x0d8b('0x43')](_0x31ceba[_0x0d8b('0x3a')]['sort']);_0x55d742['where']=qs['filters'](_['pick'](_0x31ceba['query'],_0x3f1cb3[_0x0d8b('0x3c')]),_0x5ad0fe);if(_0x31ceba[_0x0d8b('0x3a')][_0x0d8b('0x44')]){_0x55d742['where']=_['merge'](_0x55d742[_0x0d8b('0x45')],{'$or':_[_0x0d8b('0x35')](_0x5ad0fe,function(_0x344278){if(_0x344278['type']!==_0x0d8b('0x46')){var _0x26941a={};_0x26941a[_0x344278['name']]={'$like':'%'+_0x31ceba['query'][_0x0d8b('0x44')]+'%'};return _0x26941a;}})});}_0x55d742=_['merge']({},_0x55d742,_0x31ceba[_0x0d8b('0x47')]);var _0x5a96b1={'where':_0x55d742['where']};return db[_0x0d8b('0x36')][_0x0d8b('0x48')](_0x5a96b1)['then'](function(_0x5ebe8a){_0x1649fc['count']=_0x5ebe8a;if(_0x31ceba['query'][_0x0d8b('0x49')]){_0x55d742[_0x0d8b('0x4a')]=[{'all':!![]}];}return db[_0x0d8b('0x36')]['findAll'](_0x55d742);})[_0x0d8b('0x1c')](function(_0x1afe8a){_0x1649fc[_0x0d8b('0x4b')]=_0x1afe8a;return _0x1649fc;})[_0x0d8b('0x1c')](respondWithFilteredResult(_0x933e01,_0x55d742))[_0x0d8b('0x25')](handleError(_0x933e01,null));};exports[_0x0d8b('0x4c')]=function(_0x11d22b,_0x1d5067){var _0x384a5e={'raw':![],'where':{'id':_0x11d22b[_0x0d8b('0x4d')]['id']}},_0x1f2077={};_0x1f2077[_0x0d8b('0x39')]=_[_0x0d8b('0x3b')](db[_0x0d8b('0x36')][_0x0d8b('0x37')]);_0x1f2077[_0x0d8b('0x3a')]=_[_0x0d8b('0x3b')](_0x11d22b[_0x0d8b('0x3a')]);_0x1f2077[_0x0d8b('0x3c')]=_['intersection'](_0x1f2077[_0x0d8b('0x39')],_0x1f2077['query']);_0x384a5e['attributes']=_[_0x0d8b('0x3d')](_0x1f2077[_0x0d8b('0x39')],qs[_0x0d8b('0x3f')](_0x11d22b[_0x0d8b('0x3a')]['fields']));_0x384a5e[_0x0d8b('0x3e')]=_0x384a5e[_0x0d8b('0x3e')][_0x0d8b('0x40')]?_0x384a5e[_0x0d8b('0x3e')]:_0x1f2077[_0x0d8b('0x39')];if(_0x11d22b['query']['includeAll']){_0x384a5e['include']=[{'all':!![]}];}_0x384a5e=_['merge']({},_0x384a5e,_0x11d22b[_0x0d8b('0x47')]);return db[_0x0d8b('0x36')]['find'](_0x384a5e)['then'](handleEntityNotFound(_0x1d5067,null))[_0x0d8b('0x1c')](respondWithResult(_0x1d5067,null))[_0x0d8b('0x25')](handleError(_0x1d5067,null));};exports['create']=function(_0x5ef6c3,_0x900906){return db[_0x0d8b('0x36')][_0x0d8b('0x4e')](_0x5ef6c3[_0x0d8b('0x4f')],{})[_0x0d8b('0x1c')](respondWithResult(_0x900906,0xc9))['catch'](handleError(_0x900906,null));};exports[_0x0d8b('0x2e')]=function(_0x2afe34,_0x5481fc){if(_0x2afe34['body']['id']){delete _0x2afe34[_0x0d8b('0x4f')]['id'];}return db[_0x0d8b('0x36')]['find']({'where':{'id':_0x2afe34['params']['id']}})[_0x0d8b('0x1c')](handleEntityNotFound(_0x5481fc,null))[_0x0d8b('0x1c')](saveUpdates(_0x2afe34[_0x0d8b('0x4f')],null))[_0x0d8b('0x1c')](respondWithResult(_0x5481fc,null))['catch'](handleError(_0x5481fc,null));};exports[_0x0d8b('0x2f')]=function(_0x598e03,_0x5c271c){return db[_0x0d8b('0x36')][_0x0d8b('0x50')]({'where':{'id':_0x598e03['params']['id']}})['then'](handleEntityNotFound(_0x5c271c,null))[_0x0d8b('0x1c')](removeEntity(_0x5c271c,null))[_0x0d8b('0x25')](handleError(_0x5c271c,null));};exports[_0x0d8b('0x51')]=function(_0x2c1eb0,_0x3afc3a,_0xb66e76){var _0x3978e5={};var _0x3bead7={};var _0x5418d8;var _0x24a859;return db[_0x0d8b('0x36')][_0x0d8b('0x52')]({'where':{'id':_0x2c1eb0[_0x0d8b('0x4d')]['id']}})[_0x0d8b('0x1c')](handleEntityNotFound(_0x3afc3a,null))[_0x0d8b('0x1c')](function(_0x70c8c4){if(_0x70c8c4){_0x5418d8=_0x70c8c4;_0x3bead7[_0x0d8b('0x39')]=_[_0x0d8b('0x3b')](db['VtigerConfiguration'][_0x0d8b('0x37')]);_0x3bead7[_0x0d8b('0x3a')]=_[_0x0d8b('0x3b')](_0x2c1eb0[_0x0d8b('0x3a')]);_0x3bead7[_0x0d8b('0x3c')]=_['intersection'](_0x3bead7[_0x0d8b('0x39')],_0x3bead7[_0x0d8b('0x3a')]);_0x3978e5[_0x0d8b('0x3e')]=_[_0x0d8b('0x3d')](_0x3bead7[_0x0d8b('0x39')],qs['fields'](_0x2c1eb0['query'][_0x0d8b('0x3f')]));_0x3978e5[_0x0d8b('0x3e')]=_0x3978e5[_0x0d8b('0x3e')][_0x0d8b('0x40')]?_0x3978e5['attributes']:_0x3bead7[_0x0d8b('0x39')];_0x3978e5[_0x0d8b('0x42')]=qs[_0x0d8b('0x43')](_0x2c1eb0['query'][_0x0d8b('0x43')]);_0x3978e5['where']=qs[_0x0d8b('0x3c')](_[_0x0d8b('0x53')](_0x2c1eb0[_0x0d8b('0x3a')],_0x3bead7[_0x0d8b('0x3c')]));if(_0x2c1eb0[_0x0d8b('0x3a')][_0x0d8b('0x44')]){_0x3978e5['where']=_[_0x0d8b('0x54')](_0x3978e5['where'],{'$or':_[_0x0d8b('0x35')](_0x3978e5[_0x0d8b('0x3e')],function(_0xafeeb0){var _0x33a614={};_0x33a614[_0xafeeb0]={'$like':'%'+_0x2c1eb0['query'][_0x0d8b('0x44')]+'%'};return _0x33a614;})});}_0x3978e5=_[_0x0d8b('0x54')]({},_0x3978e5,_0x2c1eb0[_0x0d8b('0x47')]);return _0x5418d8[_0x0d8b('0x51')](_0x3978e5);}})[_0x0d8b('0x1c')](function(_0x273aef){if(_0x273aef){_0x24a859=_0x273aef[_0x0d8b('0x40')];if(!_0x2c1eb0[_0x0d8b('0x3a')][_0x0d8b('0x55')](_0x0d8b('0x41'))){_0x3978e5['limit']=qs['limit'](_0x2c1eb0[_0x0d8b('0x3a')][_0x0d8b('0x29')]);_0x3978e5['offset']=qs[_0x0d8b('0x28')](_0x2c1eb0['query']['offset']);}return _0x5418d8[_0x0d8b('0x51')](_0x3978e5);}})[_0x0d8b('0x1c')](function(_0x4f4b4d){if(_0x4f4b4d){return _0x4f4b4d?{'count':_0x24a859,'rows':_0x4f4b4d}:null;}})['then'](respondWithResult(_0x3afc3a,null))[_0x0d8b('0x25')](handleError(_0x3afc3a,null));};exports[_0x0d8b('0x56')]=function(_0x70e4b2,_0x435090,_0x2ab72b){if(_0x70e4b2[_0x0d8b('0x4f')]['id']){delete _0x70e4b2[_0x0d8b('0x4f')]['id'];}return db['VtigerAccount'][_0x0d8b('0x52')]({'where':{'id':_0x70e4b2['params']['id']}})[_0x0d8b('0x1c')](handleEntityNotFound(_0x435090,null))[_0x0d8b('0x1c')](function(_0x2bb690){if(_0x2bb690){_0x70e4b2[_0x0d8b('0x4f')]['AccountId']=_0x2bb690['id'];_0x70e4b2[_0x0d8b('0x4f')]['Subjects']=integrations[_0x0d8b('0x57')](_0x70e4b2[_0x0d8b('0x4f')][_0x0d8b('0x58')],_0x70e4b2[_0x0d8b('0x4f')][_0x0d8b('0x59')]);_0x70e4b2[_0x0d8b('0x4f')][_0x0d8b('0x5a')]=integrations[_0x0d8b('0x5b')](_0x70e4b2[_0x0d8b('0x4f')][_0x0d8b('0x58')],_0x70e4b2['body'][_0x0d8b('0x59')]);return db['VtigerConfiguration'][_0x0d8b('0x4e')](_0x70e4b2[_0x0d8b('0x4f')],{'include':[{'model':db['VtigerField'],'as':_0x0d8b('0x5c')},{'model':db['VtigerField'],'as':_0x0d8b('0x5a')}]});}return null;})[_0x0d8b('0x1c')](respondWithResult(_0x435090,null))[_0x0d8b('0x25')](handleError(_0x435090,null));};var md5=require(_0x0d8b('0x5d'));exports[_0x0d8b('0x5e')]=function(_0x299f98,_0x3a073b,_0x3029d9){var _0x4bde46=null;var _0x10eca6=null;var _0x8ca59e=null;var _0x5b2916=null;var _0x191a5a='';return db[_0x0d8b('0x36')][_0x0d8b('0x52')]({'where':{'id':_0x299f98[_0x0d8b('0x4d')]['id']},'attributes':['id',_0x0d8b('0x32'),_0x0d8b('0x5f'),_0x0d8b('0x60'),_0x0d8b('0x61'),_0x0d8b('0x62'),_0x0d8b('0x63'),_0x0d8b('0x64')]})[_0x0d8b('0x1c')](handleEntityNotFound(_0x3a073b,null))['then'](function(_0x1ece98){if(_0x1ece98){_0x4bde46=_0x1ece98[_0x0d8b('0x5f')];_0x10eca6=_0x1ece98[_0x0d8b('0x64')];_0x8ca59e=_0x1ece98['moduleName'];_0x191a5a=_0x1ece98['remoteUri'];var _0xebca83=_0x191a5a[_0x0d8b('0x65')](-0x1);if(_0xebca83==='/'){_0x191a5a=_0x191a5a[_0x0d8b('0x66')](0x0,_0x191a5a['lastIndexOf'](_0xebca83));}_0x5b2916=util['format'](_0x0d8b('0x67'),_0x191a5a);var _0x130159={'method':_0x0d8b('0x68'),'uri':_0x5b2916,'qs':{'operation':_0x0d8b('0x69'),'username':_0x1ece98[_0x0d8b('0x5f')]},'json':!![]};return rp(_0x130159);}})[_0x0d8b('0x1c')](function(_0x45aabf){if(_0x45aabf[_0x0d8b('0x6a')]){var _0x20a3dd={'method':_0x0d8b('0x6b'),'uri':_0x5b2916,'form':{'operation':_0x0d8b('0x6c'),'username':_0x4bde46,'accessKey':md5(_0x45aabf[_0x0d8b('0x6d')][_0x0d8b('0x6e')]+_0x10eca6)},'json':!![]};return rp(_0x20a3dd);}})['then'](function(_0x3d3b0b){if(_0x3d3b0b[_0x0d8b('0x6a')]){var _0x48c965={'method':'GET','uri':_0x5b2916,'qs':{'operation':_0x0d8b('0x6f'),'username':_0x4bde46,'sessionName':_0x3d3b0b[_0x0d8b('0x6d')][_0x0d8b('0x70')],'elementType':_0x8ca59e},'json':!![]};return rp(_0x48c965);}})[_0x0d8b('0x1c')](function(_0x23e2e0){if(_0x23e2e0[_0x0d8b('0x6a')]){var _0x5dec44=['autogenerated','reference',_0x0d8b('0x71')];_[_0x0d8b('0x72')](_0x23e2e0[_0x0d8b('0x6d')][_0x0d8b('0x3f')],function(_0x3f1eee){return _0x5dec44[_0x0d8b('0x73')](_0x3f1eee['type'][_0x0d8b('0x32')]);});_[_0x0d8b('0x72')](_0x23e2e0['result'][_0x0d8b('0x3f')],function(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x74')]===_0x0d8b('0x75');});return{'count':_0x23e2e0[_0x0d8b('0x6d')][_0x0d8b('0x3f')][_0x0d8b('0x40')],'rows':_[_0x0d8b('0x35')](_0x23e2e0[_0x0d8b('0x6d')][_0x0d8b('0x3f')],function(_0x391121){return{'id':_0x391121[_0x0d8b('0x32')],'name':_0x391121[_0x0d8b('0x76')],'custom':_[_0x0d8b('0x77')](_0x391121['name'],'cf_')?!![]:![],'options':_0x391121[_0x0d8b('0x59')][_0x0d8b('0x32')]===_0x0d8b('0x78')&&_0x391121[_0x0d8b('0x59')][_0x0d8b('0x79')][_0x0d8b('0x40')]>0x0?_[_0x0d8b('0x35')](_0x391121['type'][_0x0d8b('0x79')],function(_0x4c3948){return{'name':_0x4c3948[_0x0d8b('0x76')],'value':_0x4c3948['value']};}):[]};})};}})['then'](respondWithResult(_0x3a073b,null))[_0x0d8b('0x25')](function(_0x460a36){console[_0x0d8b('0x7a')](_0x0d8b('0x7b')+_0x460a36);var _0x2cf02c=_0x299f98[_0x0d8b('0x3a')][_0x0d8b('0x7c')]?0x1f4:_0x460a36[_0x0d8b('0x7d')]||0x1f4;logger[_0x0d8b('0x22')](_0x0d8b('0x7e'),_0x0d8b('0x5e'),_0x2cf02c,JSON[_0x0d8b('0x21')](_0x460a36));delete _0x460a36['name'];if(_0x2cf02c===0x191){_0x2cf02c=0x190;}_0x3a073b[_0x0d8b('0x27')](_0x2cf02c)[_0x0d8b('0x33')](_0x299f98[_0x0d8b('0x3a')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x460a36[_0x0d8b('0x7d')]}:_0x460a36);});}; \ No newline at end of file +var _0x0abf=['jayson/promise','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','end','json','offset','limit','status','set','Content-Range','apply','reject','destroy','stack','name','send','index','map','VtigerAccount','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','params','rawAttributes','find','create','body','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','token','describe','sessionName','autogenerated','reference','includes','editable','label','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration'];(function(_0x23f47f,_0x13c6b){var _0x1ce40b=function(_0x2dd4b3){while(--_0x2dd4b3){_0x23f47f['push'](_0x23f47f['shift']());}};_0x1ce40b(++_0x13c6b);}(_0x0abf,0xe8));var _0xf0ab=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0abf[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0xf0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ab('0x1'));var jsonpatch=require(_0xf0ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0ab('0x3'));var Mustache=require('mustache');var util=require(_0xf0ab('0x4'));var path=require(_0xf0ab('0x5'));var sox=require(_0xf0ab('0x6'));var csv=require(_0xf0ab('0x7'));var ejs=require(_0xf0ab('0x8'));var fs=require('fs');var fs_extra=require(_0xf0ab('0x9'));var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x7'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0ab('0x11'));var logger=require('../../config/logger')(_0xf0ab('0x12'));var utils=require(_0xf0ab('0x13'));var config=require(_0xf0ab('0x14'));var licenseUtil=require(_0xf0ab('0x15'));var db=require(_0xf0ab('0x16'))['db'];var integrations=require(_0xf0ab('0x17'));var jayson=require(_0xf0ab('0x18'));var client=jayson['client'][_0xf0ab('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2cc002,_0x1913fe,_0x35c75f,_0x1824ef){return new BPromise(function(_0x36cabe,_0x3d7129){var _0x1fb4e5=_0x1824ef||client;return _0x1fb4e5[_0xf0ab('0x1a')](_0x2cc002,_0x35c75f)[_0xf0ab('0x1b')](function(_0x20f453){logger[_0xf0ab('0x1c')](_0xf0ab('0x1d'),_0x1913fe,_0xf0ab('0x1e'));logger[_0xf0ab('0x1f')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x1913fe,_0xf0ab('0x1e'),JSON[_0xf0ab('0x20')](_0x20f453));if(_0x20f453[_0xf0ab('0x21')]){if(_0x20f453[_0xf0ab('0x21')][_0xf0ab('0x22')]===0x1f4){logger[_0xf0ab('0x21')](_0xf0ab('0x1d'),_0x1913fe,_0x20f453[_0xf0ab('0x21')][_0xf0ab('0x23')]);return _0x3d7129(_0x20f453[_0xf0ab('0x21')][_0xf0ab('0x23')]);}logger[_0xf0ab('0x21')](_0xf0ab('0x1d'),_0x1913fe,_0x20f453[_0xf0ab('0x21')][_0xf0ab('0x23')]);return _0x36cabe(_0x20f453[_0xf0ab('0x21')]['message']);}else{logger[_0xf0ab('0x1c')](_0xf0ab('0x1d'),_0x1913fe,_0xf0ab('0x1e'));_0x36cabe(_0x20f453[_0xf0ab('0x24')][_0xf0ab('0x23')]);}})[_0xf0ab('0x25')](function(_0x250317){logger[_0xf0ab('0x21')](_0xf0ab('0x1d'),_0x1913fe,_0x250317);_0x3d7129(_0x250317);});});}function respondWithStatusCode(_0x18bb37,_0x43119f){_0x43119f=_0x43119f||0xcc;return function(_0x5645b2){if(_0x5645b2){return _0x18bb37['sendStatus'](_0x43119f);}return _0x18bb37['status'](_0x43119f)[_0xf0ab('0x26')]();};}function respondWithResult(_0x4f0caf,_0x3eca32){_0x3eca32=_0x3eca32||0xc8;return function(_0x16b979){if(_0x16b979){return _0x4f0caf['status'](_0x3eca32)[_0xf0ab('0x27')](_0x16b979);}};}function respondWithFilteredResult(_0x22671e,_0x10bf5f){return function(_0x38fb71){if(_0x38fb71){var _0x7d4ff9=_0x38fb71['count'],_0x502921=_0x10bf5f[_0xf0ab('0x28')],_0x2d0da7=_0x10bf5f[_0xf0ab('0x28')]+_0x10bf5f[_0xf0ab('0x29')],_0x574ce7;if(_0x2d0da7>=_0x7d4ff9){_0x2d0da7=_0x7d4ff9;_0x574ce7=0xc8;}else{_0x574ce7=0xce;}_0x22671e[_0xf0ab('0x2a')](_0x574ce7);return _0x22671e[_0xf0ab('0x2b')](_0xf0ab('0x2c'),_0x502921+'-'+_0x2d0da7+'/'+_0x7d4ff9)[_0xf0ab('0x27')](_0x38fb71);}return null;};}function patchUpdates(_0x14da9c){return function(_0x76a3f3){try{jsonpatch[_0xf0ab('0x2d')](_0x76a3f3,_0x14da9c,!![]);}catch(_0x21e8ac){return BPromise[_0xf0ab('0x2e')](_0x21e8ac);}return _0x76a3f3['save']();};}function saveUpdates(_0x1e1ffb,_0x35973a){return function(_0x5e073a){if(_0x5e073a){return _0x5e073a['update'](_0x1e1ffb)[_0xf0ab('0x1b')](function(_0x1dc84e){return _0x1dc84e;});}return null;};}function removeEntity(_0x43e500,_0x4dd5b7){return function(_0x58efce){if(_0x58efce){return _0x58efce[_0xf0ab('0x2f')]()['then'](function(){_0x43e500[_0xf0ab('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f66fa,_0x9b16fa){return function(_0x5074c9){if(!_0x5074c9){_0x3f66fa['sendStatus'](0x194);}return _0x5074c9;};}function handleError(_0x469f42,_0x27c6f9){_0x27c6f9=_0x27c6f9||0x1f4;return function(_0x2a3fac){logger[_0xf0ab('0x21')](_0x2a3fac[_0xf0ab('0x30')]);if(_0x2a3fac[_0xf0ab('0x31')]){delete _0x2a3fac[_0xf0ab('0x31')];}_0x469f42[_0xf0ab('0x2a')](_0x27c6f9)[_0xf0ab('0x32')](_0x2a3fac);};}exports[_0xf0ab('0x33')]=function(_0x2c88d0,_0x2ad3e2){var _0x22dcfe={},_0x437fdb={},_0x5d8443={'count':0x0,'rows':[]};var _0x391fc0=_[_0xf0ab('0x34')](db[_0xf0ab('0x35')]['rawAttributes'],function(_0x9e38af){return{'name':_0x9e38af[_0xf0ab('0x36')],'type':_0x9e38af[_0xf0ab('0x37')]['key']};});_0x437fdb[_0xf0ab('0x38')]=_['map'](_0x391fc0,_0xf0ab('0x31'));_0x437fdb['query']=_[_0xf0ab('0x39')](_0x2c88d0[_0xf0ab('0x3a')]);_0x437fdb[_0xf0ab('0x3b')]=_[_0xf0ab('0x3c')](_0x437fdb[_0xf0ab('0x38')],_0x437fdb[_0xf0ab('0x3a')]);_0x22dcfe['attributes']=_[_0xf0ab('0x3c')](_0x437fdb[_0xf0ab('0x38')],qs['fields'](_0x2c88d0[_0xf0ab('0x3a')][_0xf0ab('0x3d')]));_0x22dcfe[_0xf0ab('0x3e')]=_0x22dcfe[_0xf0ab('0x3e')][_0xf0ab('0x3f')]?_0x22dcfe[_0xf0ab('0x3e')]:_0x437fdb[_0xf0ab('0x38')];if(!_0x2c88d0['query'][_0xf0ab('0x40')](_0xf0ab('0x41'))){_0x22dcfe[_0xf0ab('0x29')]=qs['limit'](_0x2c88d0[_0xf0ab('0x3a')][_0xf0ab('0x29')]);_0x22dcfe[_0xf0ab('0x28')]=qs[_0xf0ab('0x28')](_0x2c88d0[_0xf0ab('0x3a')]['offset']);}_0x22dcfe[_0xf0ab('0x42')]=qs[_0xf0ab('0x43')](_0x2c88d0[_0xf0ab('0x3a')][_0xf0ab('0x43')]);_0x22dcfe[_0xf0ab('0x44')]=qs[_0xf0ab('0x3b')](_[_0xf0ab('0x45')](_0x2c88d0[_0xf0ab('0x3a')],_0x437fdb[_0xf0ab('0x3b')]),_0x391fc0);if(_0x2c88d0[_0xf0ab('0x3a')][_0xf0ab('0x46')]){_0x22dcfe[_0xf0ab('0x44')]=_[_0xf0ab('0x47')](_0x22dcfe['where'],{'$or':_['map'](_0x391fc0,function(_0x2fc677){if(_0x2fc677['type']!==_0xf0ab('0x48')){var _0x2d50c0={};_0x2d50c0[_0x2fc677['name']]={'$like':'%'+_0x2c88d0[_0xf0ab('0x3a')][_0xf0ab('0x46')]+'%'};return _0x2d50c0;}})});}_0x22dcfe=_['merge']({},_0x22dcfe,_0x2c88d0[_0xf0ab('0x49')]);var _0x29cc6a={'where':_0x22dcfe[_0xf0ab('0x44')]};return db[_0xf0ab('0x35')][_0xf0ab('0x4a')](_0x29cc6a)[_0xf0ab('0x1b')](function(_0x198cc3){_0x5d8443[_0xf0ab('0x4a')]=_0x198cc3;if(_0x2c88d0[_0xf0ab('0x3a')][_0xf0ab('0x4b')]){_0x22dcfe[_0xf0ab('0x4c')]=[{'all':!![]}];}return db[_0xf0ab('0x35')][_0xf0ab('0x4d')](_0x22dcfe);})[_0xf0ab('0x1b')](function(_0x58fea3){_0x5d8443['rows']=_0x58fea3;return _0x5d8443;})[_0xf0ab('0x1b')](respondWithFilteredResult(_0x2ad3e2,_0x22dcfe))['catch'](handleError(_0x2ad3e2,null));};exports['show']=function(_0x4e57d3,_0xc3b68d){var _0x45b32c={'raw':![],'where':{'id':_0x4e57d3[_0xf0ab('0x4e')]['id']}},_0x3d9e70={};_0x3d9e70[_0xf0ab('0x38')]=_[_0xf0ab('0x39')](db[_0xf0ab('0x35')][_0xf0ab('0x4f')]);_0x3d9e70[_0xf0ab('0x3a')]=_[_0xf0ab('0x39')](_0x4e57d3[_0xf0ab('0x3a')]);_0x3d9e70[_0xf0ab('0x3b')]=_['intersection'](_0x3d9e70[_0xf0ab('0x38')],_0x3d9e70[_0xf0ab('0x3a')]);_0x45b32c[_0xf0ab('0x3e')]=_[_0xf0ab('0x3c')](_0x3d9e70[_0xf0ab('0x38')],qs[_0xf0ab('0x3d')](_0x4e57d3[_0xf0ab('0x3a')][_0xf0ab('0x3d')]));_0x45b32c['attributes']=_0x45b32c['attributes']['length']?_0x45b32c[_0xf0ab('0x3e')]:_0x3d9e70[_0xf0ab('0x38')];if(_0x4e57d3['query'][_0xf0ab('0x4b')]){_0x45b32c[_0xf0ab('0x4c')]=[{'all':!![]}];}_0x45b32c=_['merge']({},_0x45b32c,_0x4e57d3[_0xf0ab('0x49')]);return db[_0xf0ab('0x35')][_0xf0ab('0x50')](_0x45b32c)[_0xf0ab('0x1b')](handleEntityNotFound(_0xc3b68d,null))[_0xf0ab('0x1b')](respondWithResult(_0xc3b68d,null))[_0xf0ab('0x25')](handleError(_0xc3b68d,null));};exports[_0xf0ab('0x51')]=function(_0x4d1606,_0x3be796){return db['VtigerAccount'][_0xf0ab('0x51')](_0x4d1606['body'],{})[_0xf0ab('0x1b')](respondWithResult(_0x3be796,0xc9))['catch'](handleError(_0x3be796,null));};exports['update']=function(_0x1e3b91,_0x58ac39){if(_0x1e3b91[_0xf0ab('0x52')]['id']){delete _0x1e3b91['body']['id'];}return db[_0xf0ab('0x35')]['find']({'where':{'id':_0x1e3b91[_0xf0ab('0x4e')]['id']}})[_0xf0ab('0x1b')](handleEntityNotFound(_0x58ac39,null))[_0xf0ab('0x1b')](saveUpdates(_0x1e3b91['body'],null))['then'](respondWithResult(_0x58ac39,null))['catch'](handleError(_0x58ac39,null));};exports[_0xf0ab('0x2f')]=function(_0x421d93,_0x57d6c3){return db['VtigerAccount'][_0xf0ab('0x50')]({'where':{'id':_0x421d93[_0xf0ab('0x4e')]['id']}})[_0xf0ab('0x1b')](handleEntityNotFound(_0x57d6c3,null))[_0xf0ab('0x1b')](removeEntity(_0x57d6c3,null))[_0xf0ab('0x25')](handleError(_0x57d6c3,null));};exports[_0xf0ab('0x53')]=function(_0x2d3aa8,_0x3bc749,_0x1d7616){var _0x1f180f={};var _0x1e6a4e={};var _0x4d80a6;var _0x41ed17;return db['VtigerAccount'][_0xf0ab('0x54')]({'where':{'id':_0x2d3aa8[_0xf0ab('0x4e')]['id']}})[_0xf0ab('0x1b')](handleEntityNotFound(_0x3bc749,null))[_0xf0ab('0x1b')](function(_0x3e1b85){if(_0x3e1b85){_0x4d80a6=_0x3e1b85;_0x1e6a4e[_0xf0ab('0x38')]=_[_0xf0ab('0x39')](db[_0xf0ab('0x55')][_0xf0ab('0x4f')]);_0x1e6a4e[_0xf0ab('0x3a')]=_['keys'](_0x2d3aa8[_0xf0ab('0x3a')]);_0x1e6a4e[_0xf0ab('0x3b')]=_[_0xf0ab('0x3c')](_0x1e6a4e[_0xf0ab('0x38')],_0x1e6a4e[_0xf0ab('0x3a')]);_0x1f180f[_0xf0ab('0x3e')]=_[_0xf0ab('0x3c')](_0x1e6a4e[_0xf0ab('0x38')],qs[_0xf0ab('0x3d')](_0x2d3aa8['query']['fields']));_0x1f180f[_0xf0ab('0x3e')]=_0x1f180f[_0xf0ab('0x3e')][_0xf0ab('0x3f')]?_0x1f180f['attributes']:_0x1e6a4e[_0xf0ab('0x38')];_0x1f180f[_0xf0ab('0x42')]=qs[_0xf0ab('0x43')](_0x2d3aa8['query'][_0xf0ab('0x43')]);_0x1f180f[_0xf0ab('0x44')]=qs[_0xf0ab('0x3b')](_[_0xf0ab('0x45')](_0x2d3aa8[_0xf0ab('0x3a')],_0x1e6a4e['filters']));if(_0x2d3aa8[_0xf0ab('0x3a')][_0xf0ab('0x46')]){_0x1f180f[_0xf0ab('0x44')]=_[_0xf0ab('0x47')](_0x1f180f[_0xf0ab('0x44')],{'$or':_[_0xf0ab('0x34')](_0x1f180f[_0xf0ab('0x3e')],function(_0x2b0b89){var _0x2d9194={};_0x2d9194[_0x2b0b89]={'$like':'%'+_0x2d3aa8[_0xf0ab('0x3a')][_0xf0ab('0x46')]+'%'};return _0x2d9194;})});}_0x1f180f=_[_0xf0ab('0x47')]({},_0x1f180f,_0x2d3aa8[_0xf0ab('0x49')]);return _0x4d80a6['getConfigurations'](_0x1f180f);}})['then'](function(_0x3e1f1e){if(_0x3e1f1e){_0x41ed17=_0x3e1f1e[_0xf0ab('0x3f')];if(!_0x2d3aa8[_0xf0ab('0x3a')]['hasOwnProperty'](_0xf0ab('0x41'))){_0x1f180f['limit']=qs[_0xf0ab('0x29')](_0x2d3aa8[_0xf0ab('0x3a')][_0xf0ab('0x29')]);_0x1f180f['offset']=qs[_0xf0ab('0x28')](_0x2d3aa8['query']['offset']);}return _0x4d80a6[_0xf0ab('0x53')](_0x1f180f);}})[_0xf0ab('0x1b')](function(_0x283426){if(_0x283426){return _0x283426?{'count':_0x41ed17,'rows':_0x283426}:null;}})['then'](respondWithResult(_0x3bc749,null))[_0xf0ab('0x25')](handleError(_0x3bc749,null));};exports[_0xf0ab('0x56')]=function(_0x1035b3,_0x122c41,_0x5b6923){if(_0x1035b3['body']['id']){delete _0x1035b3['body']['id'];}return db[_0xf0ab('0x35')][_0xf0ab('0x54')]({'where':{'id':_0x1035b3[_0xf0ab('0x4e')]['id']}})[_0xf0ab('0x1b')](handleEntityNotFound(_0x122c41,null))[_0xf0ab('0x1b')](function(_0x1c6163){if(_0x1c6163){_0x1035b3[_0xf0ab('0x52')][_0xf0ab('0x57')]=_0x1c6163['id'];_0x1035b3[_0xf0ab('0x52')][_0xf0ab('0x58')]=integrations[_0xf0ab('0x59')](_0x1035b3['body'][_0xf0ab('0x5a')],_0x1035b3[_0xf0ab('0x52')][_0xf0ab('0x37')]);_0x1035b3[_0xf0ab('0x52')][_0xf0ab('0x5b')]=integrations[_0xf0ab('0x5c')](_0x1035b3[_0xf0ab('0x52')][_0xf0ab('0x5a')],_0x1035b3['body'][_0xf0ab('0x37')]);return db[_0xf0ab('0x55')]['create'](_0x1035b3['body'],{'include':[{'model':db['VtigerField'],'as':_0xf0ab('0x58')},{'model':db[_0xf0ab('0x5d')],'as':_0xf0ab('0x5b')}]});}return null;})[_0xf0ab('0x1b')](respondWithResult(_0x122c41,null))[_0xf0ab('0x25')](handleError(_0x122c41,null));};var md5=require(_0xf0ab('0x5e'));exports['getFields']=function(_0x1053c0,_0x5e7d84,_0x208032){var _0x5d5bb0=null;var _0x2978a9=null;var _0x5b614e=null;var _0x3b48ae=null;var _0x4ffd8d='';return db['VtigerAccount'][_0xf0ab('0x54')]({'where':{'id':_0x1053c0[_0xf0ab('0x4e')]['id']},'attributes':['id',_0xf0ab('0x31'),_0xf0ab('0x5f'),_0xf0ab('0x60'),_0xf0ab('0x61'),_0xf0ab('0x62'),_0xf0ab('0x63'),_0xf0ab('0x64')]})[_0xf0ab('0x1b')](handleEntityNotFound(_0x5e7d84,null))[_0xf0ab('0x1b')](function(_0x31f464){if(_0x31f464){_0x5d5bb0=_0x31f464[_0xf0ab('0x5f')];_0x2978a9=_0x31f464['accessKey'];_0x5b614e=_0x31f464[_0xf0ab('0x61')];_0x4ffd8d=_0x31f464[_0xf0ab('0x62')];var _0x26990f=_0x4ffd8d[_0xf0ab('0x65')](-0x1);if(_0x26990f==='/'){_0x4ffd8d=_0x4ffd8d[_0xf0ab('0x66')](0x0,_0x4ffd8d[_0xf0ab('0x67')](_0x26990f));}_0x3b48ae=util[_0xf0ab('0x68')](_0xf0ab('0x69'),_0x4ffd8d);var _0xa0852a={'method':_0xf0ab('0x6a'),'uri':_0x3b48ae,'qs':{'operation':_0xf0ab('0x6b'),'username':_0x31f464[_0xf0ab('0x5f')]},'json':!![]};return rp(_0xa0852a);}})['then'](function(_0x38249b){if(_0x38249b[_0xf0ab('0x6c')]){var _0x3221ff={'method':_0xf0ab('0x6d'),'uri':_0x3b48ae,'form':{'operation':'login','username':_0x5d5bb0,'accessKey':md5(_0x38249b[_0xf0ab('0x24')][_0xf0ab('0x6e')]+_0x2978a9)},'json':!![]};return rp(_0x3221ff);}})[_0xf0ab('0x1b')](function(_0x318e89){if(_0x318e89[_0xf0ab('0x6c')]){var _0x478860={'method':_0xf0ab('0x6a'),'uri':_0x3b48ae,'qs':{'operation':_0xf0ab('0x6f'),'username':_0x5d5bb0,'sessionName':_0x318e89['result'][_0xf0ab('0x70')],'elementType':_0x5b614e},'json':!![]};return rp(_0x478860);}})['then'](function(_0x238833){if(_0x238833[_0xf0ab('0x6c')]){var _0x597a3d=[_0xf0ab('0x71'),_0xf0ab('0x72'),'owner'];_['remove'](_0x238833[_0xf0ab('0x24')]['fields'],function(_0x289318){return _0x597a3d[_0xf0ab('0x73')](_0x289318['type']['name']);});_['remove'](_0x238833[_0xf0ab('0x24')][_0xf0ab('0x3d')],function(_0x365dea){return _0x365dea[_0xf0ab('0x74')]==='false';});return{'count':_0x238833[_0xf0ab('0x24')][_0xf0ab('0x3d')][_0xf0ab('0x3f')],'rows':_[_0xf0ab('0x34')](_0x238833[_0xf0ab('0x24')]['fields'],function(_0x56909f){return{'id':_0x56909f[_0xf0ab('0x31')],'name':_0x56909f[_0xf0ab('0x75')],'custom':_['startsWith'](_0x56909f['name'],_0xf0ab('0x76'))?!![]:![],'options':_0x56909f[_0xf0ab('0x37')][_0xf0ab('0x31')]===_0xf0ab('0x77')&&_0x56909f[_0xf0ab('0x37')][_0xf0ab('0x78')][_0xf0ab('0x3f')]>0x0?_[_0xf0ab('0x34')](_0x56909f[_0xf0ab('0x37')][_0xf0ab('0x78')],function(_0x3c40c2){return{'name':_0x3c40c2['label'],'value':_0x3c40c2['value']};}):[]};})};}})[_0xf0ab('0x1b')](respondWithResult(_0x5e7d84,null))['catch'](function(_0x327dac){console[_0xf0ab('0x79')](_0xf0ab('0x7a')+_0x327dac);var _0x1c4d2a=_0x1053c0['query'][_0xf0ab('0x7b')]?0x1f4:_0x327dac[_0xf0ab('0x7c')]||0x1f4;logger[_0xf0ab('0x21')](_0xf0ab('0x7d'),_0xf0ab('0x7e'),_0x1c4d2a,JSON[_0xf0ab('0x20')](_0x327dac));delete _0x327dac[_0xf0ab('0x31')];if(_0x1c4d2a===0x191){_0x1c4d2a=0x190;}_0x5e7d84[_0xf0ab('0x2a')](_0x1c4d2a)[_0xf0ab('0x32')](_0x1053c0[_0xf0ab('0x3a')][_0xf0ab('0x7b')]?{'message':_0xf0ab('0x7f'),'statusCode':_0x327dac[_0xf0ab('0x7c')]}:_0x327dac);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 6cd5fdb..3b6a0ba 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 _0xcb7d=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util'];(function(_0x272404,_0x17ba38){var _0x45fccc=function(_0x1db5fc){while(--_0x1db5fc){_0x272404['push'](_0x272404['shift']());}};_0x45fccc(++_0x17ba38);}(_0xcb7d,0xd0));var _0xdcb7=function(_0x158931,_0x272e0c){_0x158931=_0x158931-0x0;var _0x51d331=_0xcb7d[_0x158931];return _0x51d331;};'use strict';var _=require(_0xdcb7('0x0'));var util=require(_0xdcb7('0x1'));var logger=require(_0xdcb7('0x2'))('api');var moment=require(_0xdcb7('0x3'));var BPromise=require(_0xdcb7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdcb7('0x5'));var rimraf=require(_0xdcb7('0x6'));var config=require(_0xdcb7('0x7'));var attributes=require(_0xdcb7('0x8'));var integrations=require(_0xdcb7('0x9'));module[_0xdcb7('0xa')]=function(_0x42092a,_0x2e1219){return _0x42092a[_0xdcb7('0xb')](_0xdcb7('0xc'),attributes,{'tableName':_0xdcb7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a9d=['exports','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration'];(function(_0x314fba,_0x4ee8c0){var _0x1b8a76=function(_0xeb6d66){while(--_0xeb6d66){_0x314fba['push'](_0x314fba['shift']());}};_0x1b8a76(++_0x4ee8c0);}(_0x7a9d,0xbc));var _0xd7a9=function(_0x2167d2,_0x51ec78){_0x2167d2=_0x2167d2-0x0;var _0x19cc54=_0x7a9d[_0x2167d2];return _0x19cc54;};'use strict';var _=require('lodash');var util=require(_0xd7a9('0x0'));var logger=require(_0xd7a9('0x1'))(_0xd7a9('0x2'));var moment=require(_0xd7a9('0x3'));var BPromise=require(_0xd7a9('0x4'));var rp=require(_0xd7a9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd7a9('0x6'));var config=require(_0xd7a9('0x7'));var attributes=require(_0xd7a9('0x8'));var integrations=require(_0xd7a9('0x9'));module[_0xd7a9('0xa')]=function(_0x4cb98d,_0x171625){return _0x4cb98d['define']('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 174b224..3927ac8 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 _0x84fc=['info','VtigerAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','VtigerAccount','findAll','options','where','include','map','model','attributes','then','GetVtigerAccount','debug','raw','ShowVtigerAccount','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x5a792c,_0x1385a9){var _0x32587b=function(_0x2617c2){while(--_0x2617c2){_0x5a792c['push'](_0x5a792c['shift']());}};_0x32587b(++_0x1385a9);}(_0x84fc,0x16a));var _0xc84f=function(_0x185952,_0x914ad8){_0x185952=_0x185952-0x0;var _0x3b2d90=_0x84fc[_0x185952];return _0x3b2d90;};'use strict';var _=require(_0xc84f('0x0'));var util=require(_0xc84f('0x1'));var moment=require(_0xc84f('0x2'));var BPromise=require(_0xc84f('0x3'));var rs=require(_0xc84f('0x4'));var fs=require('fs');var Redis=require(_0xc84f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc84f('0x6'));var logger=require(_0xc84f('0x7'))(_0xc84f('0x8'));var config=require(_0xc84f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc84f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ce914,_0x30255f,_0x44e960){return new BPromise(function(_0x4606bf,_0x447247){return client[_0xc84f('0xb')](_0x3ce914,_0x44e960)['then'](function(_0x5035e6){logger[_0xc84f('0xc')](_0xc84f('0xd'),_0x30255f,_0xc84f('0xe'));logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x30255f,_0xc84f('0xe'),JSON[_0xc84f('0xf')](_0x5035e6));if(_0x5035e6[_0xc84f('0x10')]){if(_0x5035e6['error'][_0xc84f('0x11')]===0x1f4){logger['error'](_0xc84f('0xd'),_0x30255f,_0x5035e6[_0xc84f('0x10')]['message']);return _0x447247(_0x5035e6[_0xc84f('0x10')][_0xc84f('0x12')]);}logger[_0xc84f('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x30255f,_0x5035e6[_0xc84f('0x10')][_0xc84f('0x12')]);return _0x4606bf(_0x5035e6[_0xc84f('0x10')]['message']);}else{logger['info'](_0xc84f('0xd'),_0x30255f,_0xc84f('0xe'));_0x4606bf(_0x5035e6[_0xc84f('0x13')][_0xc84f('0x12')]);}})['catch'](function(_0x563ba8){logger[_0xc84f('0x10')](_0xc84f('0xd'),_0x30255f,_0x563ba8);_0x447247(_0x563ba8);});});}exports['GetVtigerAccount']=function(_0x183000){var _0xfc6bc3=this;return new Promise(function(_0x337fd3,_0x13cc6e){return db[_0xc84f('0x14')][_0xc84f('0x15')]({'raw':_0x183000[_0xc84f('0x16')]?_0x183000['options']['raw']===undefined?!![]:![]:!![],'where':_0x183000[_0xc84f('0x16')]?_0x183000[_0xc84f('0x16')][_0xc84f('0x17')]||null:null,'attributes':_0x183000[_0xc84f('0x16')]?_0x183000[_0xc84f('0x16')]['attributes']||null:null,'limit':_0x183000[_0xc84f('0x16')]?_0x183000[_0xc84f('0x16')]['limit']||null:null,'include':_0x183000[_0xc84f('0x16')]?_0x183000[_0xc84f('0x16')][_0xc84f('0x18')]?_[_0xc84f('0x19')](_0x183000[_0xc84f('0x16')][_0xc84f('0x18')],function(_0x574d06){return{'model':db[_0x574d06[_0xc84f('0x1a')]],'as':_0x574d06['as'],'attributes':_0x574d06[_0xc84f('0x1b')],'include':_0x574d06[_0xc84f('0x18')]?_['map'](_0x574d06[_0xc84f('0x18')],function(_0x16bfdb){return{'model':db[_0x16bfdb[_0xc84f('0x1a')]],'as':_0x16bfdb['as'],'attributes':_0x16bfdb[_0xc84f('0x1b')],'include':_0x16bfdb[_0xc84f('0x18')]?_[_0xc84f('0x19')](_0x16bfdb[_0xc84f('0x18')],function(_0x25735f){return{'model':db[_0x25735f[_0xc84f('0x1a')]],'as':_0x25735f['as'],'attributes':_0x25735f[_0xc84f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc84f('0x1c')](function(_0x6a5853){logger[_0xc84f('0xc')](_0xc84f('0x1d'),_0x183000);logger[_0xc84f('0x1e')](_0xc84f('0x1d'),_0x183000,JSON[_0xc84f('0xf')](_0x6a5853));_0x337fd3(_0x6a5853);})['catch'](function(_0x2d67cf){logger['error'](_0xc84f('0x1d'),_0x2d67cf[_0xc84f('0x12')],_0x183000);_0x13cc6e(_0xfc6bc3[_0xc84f('0x10')](0x1f4,_0x2d67cf[_0xc84f('0x12')]));});});};exports['ShowVtigerAccount']=function(_0x4c8b55){var _0x4d77ce=this;return new Promise(function(_0x49409a,_0x429fa6){return db['VtigerAccount']['find']({'raw':_0x4c8b55[_0xc84f('0x16')]?_0x4c8b55[_0xc84f('0x16')][_0xc84f('0x1f')]===undefined?!![]:![]:!![],'where':_0x4c8b55[_0xc84f('0x16')]?_0x4c8b55['options']['where']||null:null,'attributes':_0x4c8b55[_0xc84f('0x16')]?_0x4c8b55[_0xc84f('0x16')][_0xc84f('0x1b')]||null:null,'include':_0x4c8b55['options']?_0x4c8b55[_0xc84f('0x16')]['include']?_[_0xc84f('0x19')](_0x4c8b55['options'][_0xc84f('0x18')],function(_0x17d84f){return{'model':db[_0x17d84f[_0xc84f('0x1a')]],'as':_0x17d84f['as'],'attributes':_0x17d84f[_0xc84f('0x1b')],'include':_0x17d84f['include']?_['map'](_0x17d84f[_0xc84f('0x18')],function(_0x5bd89e){return{'model':db[_0x5bd89e[_0xc84f('0x1a')]],'as':_0x5bd89e['as'],'attributes':_0x5bd89e['attributes'],'include':_0x5bd89e[_0xc84f('0x18')]?_[_0xc84f('0x19')](_0x5bd89e[_0xc84f('0x18')],function(_0x5a7bd7){return{'model':db[_0x5a7bd7['model']],'as':_0x5a7bd7['as'],'attributes':_0x5a7bd7['attributes']};}):[]};}):[]};}):[]:[]})[_0xc84f('0x1c')](function(_0x21a62a){logger[_0xc84f('0xc')](_0xc84f('0x20'),_0x4c8b55);logger[_0xc84f('0x1e')]('ShowVtigerAccount',_0x4c8b55,JSON['stringify'](_0x21a62a));_0x49409a(_0x21a62a);})[_0xc84f('0x21')](function(_0x4d97fd){logger[_0xc84f('0x10')]('ShowVtigerAccount',_0x4d97fd[_0xc84f('0x12')],_0x4c8b55);_0x429fa6(_0x4d77ce[_0xc84f('0x10')](0x1f4,_0x4d97fd[_0xc84f('0x12')]));});});}; \ No newline at end of file +var _0x3a52=['then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetVtigerAccount','ShowVtigerAccount','find','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x2bba77,_0x3af1ef){var _0x510681=function(_0x35911b){while(--_0x35911b){_0x2bba77['push'](_0x2bba77['shift']());}};_0x510681(++_0x3af1ef);}(_0x3a52,0x181));var _0x23a5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3a52[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x23a5('0x0'));var moment=require(_0x23a5('0x1'));var BPromise=require(_0x23a5('0x2'));var rs=require(_0x23a5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x23a5('0x4'));var logger=require(_0x23a5('0x5'))(_0x23a5('0x6'));var config=require('../../config/environment');var jayson=require(_0x23a5('0x7'));var client=jayson[_0x23a5('0x8')][_0x23a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c908b,_0x2a9d26,_0x453b01){return new BPromise(function(_0x3d813d,_0x3a5d8f){return client[_0x23a5('0xa')](_0x1c908b,_0x453b01)[_0x23a5('0xb')](function(_0x540578){logger[_0x23a5('0xc')](_0x23a5('0xd'),_0x2a9d26,_0x23a5('0xe'));logger[_0x23a5('0xf')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x2a9d26,_0x23a5('0xe'),JSON[_0x23a5('0x10')](_0x540578));if(_0x540578[_0x23a5('0x11')]){if(_0x540578['error']['code']===0x1f4){logger[_0x23a5('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x2a9d26,_0x540578[_0x23a5('0x11')][_0x23a5('0x12')]);return _0x3a5d8f(_0x540578[_0x23a5('0x11')]['message']);}logger['error'](_0x23a5('0xd'),_0x2a9d26,_0x540578[_0x23a5('0x11')][_0x23a5('0x12')]);return _0x3d813d(_0x540578[_0x23a5('0x11')][_0x23a5('0x12')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x2a9d26,_0x23a5('0xe'));_0x3d813d(_0x540578['result']['message']);}})[_0x23a5('0x13')](function(_0x1938a2){logger[_0x23a5('0x11')](_0x23a5('0xd'),_0x2a9d26,_0x1938a2);_0x3a5d8f(_0x1938a2);});});}exports['GetVtigerAccount']=function(_0x257f75){var _0x42f3a3=this;return new Promise(function(_0x49d7a2,_0x4bef96){return db[_0x23a5('0x14')][_0x23a5('0x15')]({'raw':_0x257f75[_0x23a5('0x16')]?_0x257f75['options'][_0x23a5('0x17')]===undefined?!![]:![]:!![],'where':_0x257f75[_0x23a5('0x16')]?_0x257f75[_0x23a5('0x16')][_0x23a5('0x18')]||null:null,'attributes':_0x257f75[_0x23a5('0x16')]?_0x257f75[_0x23a5('0x16')][_0x23a5('0x19')]||null:null,'limit':_0x257f75[_0x23a5('0x16')]?_0x257f75[_0x23a5('0x16')][_0x23a5('0x1a')]||null:null,'include':_0x257f75[_0x23a5('0x16')]?_0x257f75[_0x23a5('0x16')][_0x23a5('0x1b')]?_[_0x23a5('0x1c')](_0x257f75[_0x23a5('0x16')][_0x23a5('0x1b')],function(_0x44d893){return{'model':db[_0x44d893['model']],'as':_0x44d893['as'],'attributes':_0x44d893['attributes'],'include':_0x44d893['include']?_[_0x23a5('0x1c')](_0x44d893[_0x23a5('0x1b')],function(_0x5a3cad){return{'model':db[_0x5a3cad[_0x23a5('0x1d')]],'as':_0x5a3cad['as'],'attributes':_0x5a3cad['attributes'],'include':_0x5a3cad['include']?_[_0x23a5('0x1c')](_0x5a3cad[_0x23a5('0x1b')],function(_0x40aa20){return{'model':db[_0x40aa20['model']],'as':_0x40aa20['as'],'attributes':_0x40aa20['attributes']};}):[]};}):[]};}):[]:[]})[_0x23a5('0xb')](function(_0x17c919){logger['info'](_0x23a5('0x1e'),_0x257f75);logger[_0x23a5('0xf')](_0x23a5('0x1e'),_0x257f75,JSON['stringify'](_0x17c919));_0x49d7a2(_0x17c919);})[_0x23a5('0x13')](function(_0x40fd78){logger[_0x23a5('0x11')](_0x23a5('0x1e'),_0x40fd78['message'],_0x257f75);_0x4bef96(_0x42f3a3[_0x23a5('0x11')](0x1f4,_0x40fd78['message']));});});};exports[_0x23a5('0x1f')]=function(_0x205547){var _0x3b3504=this;return new Promise(function(_0x279ae7,_0x544582){return db[_0x23a5('0x14')][_0x23a5('0x20')]({'raw':_0x205547['options']?_0x205547['options'][_0x23a5('0x17')]===undefined?!![]:![]:!![],'where':_0x205547['options']?_0x205547['options'][_0x23a5('0x18')]||null:null,'attributes':_0x205547[_0x23a5('0x16')]?_0x205547[_0x23a5('0x16')][_0x23a5('0x19')]||null:null,'include':_0x205547['options']?_0x205547[_0x23a5('0x16')]['include']?_[_0x23a5('0x1c')](_0x205547[_0x23a5('0x16')][_0x23a5('0x1b')],function(_0x4fe680){return{'model':db[_0x4fe680[_0x23a5('0x1d')]],'as':_0x4fe680['as'],'attributes':_0x4fe680['attributes'],'include':_0x4fe680[_0x23a5('0x1b')]?_[_0x23a5('0x1c')](_0x4fe680[_0x23a5('0x1b')],function(_0x43e679){return{'model':db[_0x43e679['model']],'as':_0x43e679['as'],'attributes':_0x43e679[_0x23a5('0x19')],'include':_0x43e679[_0x23a5('0x1b')]?_['map'](_0x43e679[_0x23a5('0x1b')],function(_0xd61cdc){return{'model':db[_0xd61cdc[_0x23a5('0x1d')]],'as':_0xd61cdc['as'],'attributes':_0xd61cdc[_0x23a5('0x19')]};}):[]};}):[]};}):[]:[]})[_0x23a5('0xb')](function(_0x450fc2){logger['info'](_0x23a5('0x1f'),_0x205547);logger[_0x23a5('0xf')](_0x23a5('0x1f'),_0x205547,JSON[_0x23a5('0x10')](_0x450fc2));_0x279ae7(_0x450fc2);})['catch'](function(_0x34d9b4){logger[_0x23a5('0x11')](_0x23a5('0x1f'),_0x34d9b4['message'],_0x205547);_0x544582(_0x3b3504[_0x23a5('0x11')](0x1f4,_0x34d9b4[_0x23a5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 0b73fce..6f8c233 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 _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x3f996a,_0x554d9f){var _0xde85f0=function(_0x489f6a){while(--_0x489f6a){_0x3f996a['push'](_0x3f996a['shift']());}};_0xde85f0(++_0x554d9f);}(_0x7a54,0x106));var _0x47a5=function(_0x37c6c9,_0x1f7a6e){_0x37c6c9=_0x37c6c9-0x0;var _0x330559=_0x7a54[_0x37c6c9];return _0x330559;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file +var _0xc4aa=['getDescriptions','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xc4aa[_0x88cd7b];return _0x56fcc8;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0x12')]);router[_0xac4a('0x13')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x14')]);router[_0xac4a('0x15')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x16')]);module[_0xac4a('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 acae074..1da5fdb 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 _0x2949=['sequelize','exports','STRING'];(function(_0x394cf9,_0x2a8461){var _0x171b55=function(_0x42df3e){while(--_0x42df3e){_0x394cf9['push'](_0x394cf9['shift']());}};_0x171b55(++_0x2a8461);}(_0x2949,0xcc));var _0x9294=function(_0x553621,_0x18ff21){_0x553621=_0x553621-0x0;var _0x30d42f=_0x2949[_0x553621];return _0x30d42f;};'use strict';var Sequelize=require(_0x9294('0x0'));module[_0x9294('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9294('0x2')]}}; \ No newline at end of file +var _0xecba=['STRING','sequelize'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0xecba,0x1c5));var _0xaecb=function(_0x185e23,_0xeb2229){_0x185e23=_0x185e23-0x0;var _0x495347=_0xecba[_0x185e23];return _0x495347;};'use strict';var Sequelize=require(_0xaecb('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaecb('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 3646b3f..0db73bc 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 _0x5f2a=['ejs','fs-extra','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','jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','show','params','includeAll','create','body','find','getFields','VtigerField','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x5ad630,_0x2af462){var _0x12453f=function(_0x27ec2b){while(--_0x27ec2b){_0x5ad630['push'](_0x5ad630['shift']());}};_0x12453f(++_0x2af462);}(_0x5f2a,0x171));var _0xa5f2=function(_0x424c53,_0x105695){_0x424c53=_0x424c53-0x0;var _0x587247=_0x5f2a[_0x424c53];return _0x587247;};'use strict';var emlformat=require(_0xa5f2('0x0'));var rimraf=require(_0xa5f2('0x1'));var zipdir=require(_0xa5f2('0x2'));var jsonpatch=require(_0xa5f2('0x3'));var rp=require(_0xa5f2('0x4'));var moment=require(_0xa5f2('0x5'));var BPromise=require(_0xa5f2('0x6'));var Mustache=require(_0xa5f2('0x7'));var util=require('util');var path=require(_0xa5f2('0x8'));var sox=require(_0xa5f2('0x9'));var csv=require(_0xa5f2('0xa'));var ejs=require(_0xa5f2('0xb'));var fs=require('fs');var fs_extra=require(_0xa5f2('0xc'));var _=require('lodash');var squel=require(_0xa5f2('0xd'));var crypto=require(_0xa5f2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa5f2('0xf'));var toCsv=require(_0xa5f2('0xa'));var querystring=require(_0xa5f2('0x10'));var Papa=require(_0xa5f2('0x11'));var Redis=require(_0xa5f2('0x12'));var authService=require(_0xa5f2('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa5f2('0x14'));var hardwareService=require(_0xa5f2('0x15'));var logger=require(_0xa5f2('0x16'))(_0xa5f2('0x17'));var utils=require(_0xa5f2('0x18'));var config=require(_0xa5f2('0x19'));var licenseUtil=require(_0xa5f2('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0xa5f2('0x1b'));var client=jayson['client'][_0xa5f2('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x273dc8,_0x1789cb,_0x519c88,_0xcfdf6c){return new BPromise(function(_0x4f7325,_0x30c1ce){var _0x8032e5=_0xcfdf6c||client;return _0x8032e5[_0xa5f2('0x1d')](_0x273dc8,_0x519c88)[_0xa5f2('0x1e')](function(_0x42c3a3){logger[_0xa5f2('0x1f')](_0xa5f2('0x20'),_0x1789cb,_0xa5f2('0x21'));logger[_0xa5f2('0x22')](_0xa5f2('0x23'),_0x1789cb,'request\x20sent',JSON[_0xa5f2('0x24')](_0x42c3a3));if(_0x42c3a3[_0xa5f2('0x25')]){if(_0x42c3a3[_0xa5f2('0x25')]['code']===0x1f4){logger[_0xa5f2('0x25')](_0xa5f2('0x20'),_0x1789cb,_0x42c3a3['error']['message']);return _0x30c1ce(_0x42c3a3[_0xa5f2('0x25')][_0xa5f2('0x26')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x1789cb,_0x42c3a3[_0xa5f2('0x25')][_0xa5f2('0x26')]);return _0x4f7325(_0x42c3a3[_0xa5f2('0x25')][_0xa5f2('0x26')]);}else{logger[_0xa5f2('0x1f')](_0xa5f2('0x20'),_0x1789cb,_0xa5f2('0x21'));_0x4f7325(_0x42c3a3[_0xa5f2('0x27')][_0xa5f2('0x26')]);}})[_0xa5f2('0x28')](function(_0x1e3aa0){logger[_0xa5f2('0x25')](_0xa5f2('0x20'),_0x1789cb,_0x1e3aa0);_0x30c1ce(_0x1e3aa0);});});}function respondWithStatusCode(_0x1e85b5,_0xb4cf8d){_0xb4cf8d=_0xb4cf8d||0xcc;return function(_0x252719){if(_0x252719){return _0x1e85b5[_0xa5f2('0x29')](_0xb4cf8d);}return _0x1e85b5[_0xa5f2('0x2a')](_0xb4cf8d)[_0xa5f2('0x2b')]();};}function respondWithResult(_0x48fe6e,_0x5992b4){_0x5992b4=_0x5992b4||0xc8;return function(_0xd84602){if(_0xd84602){return _0x48fe6e[_0xa5f2('0x2a')](_0x5992b4)['json'](_0xd84602);}};}function respondWithFilteredResult(_0x34524a,_0xea68d5){return function(_0x4b9ae5){if(_0x4b9ae5){var _0xc0a352=_0x4b9ae5[_0xa5f2('0x2c')],_0x556537=_0xea68d5['offset'],_0x3dbe95=_0xea68d5[_0xa5f2('0x2d')]+_0xea68d5[_0xa5f2('0x2e')],_0x34f732;if(_0x3dbe95>=_0xc0a352){_0x3dbe95=_0xc0a352;_0x34f732=0xc8;}else{_0x34f732=0xce;}_0x34524a['status'](_0x34f732);return _0x34524a[_0xa5f2('0x2f')](_0xa5f2('0x30'),_0x556537+'-'+_0x3dbe95+'/'+_0xc0a352)[_0xa5f2('0x31')](_0x4b9ae5);}return null;};}function patchUpdates(_0xbffced){return function(_0x1d53e6){try{jsonpatch[_0xa5f2('0x32')](_0x1d53e6,_0xbffced,!![]);}catch(_0x11d7ff){return BPromise[_0xa5f2('0x33')](_0x11d7ff);}return _0x1d53e6['save']();};}function saveUpdates(_0x1730e4,_0x18d958){return function(_0x51b8c1){if(_0x51b8c1){return _0x51b8c1[_0xa5f2('0x34')](_0x1730e4)['then'](function(_0x31c9d6){return _0x31c9d6;});}return null;};}function removeEntity(_0x5a81de,_0x29808a){return function(_0x333225){if(_0x333225){return _0x333225[_0xa5f2('0x35')]()[_0xa5f2('0x1e')](function(){_0x5a81de[_0xa5f2('0x2a')](0xcc)[_0xa5f2('0x2b')]();});}};}function handleEntityNotFound(_0x4cabdb,_0x4113db){return function(_0x32dab9){if(!_0x32dab9){_0x4cabdb[_0xa5f2('0x29')](0x194);}return _0x32dab9;};}function handleError(_0x15cbcf,_0x5df695){_0x5df695=_0x5df695||0x1f4;return function(_0x410330){logger[_0xa5f2('0x25')](_0x410330[_0xa5f2('0x36')]);if(_0x410330['name']){delete _0x410330[_0xa5f2('0x37')];}_0x15cbcf[_0xa5f2('0x2a')](_0x5df695)[_0xa5f2('0x38')](_0x410330);};}exports[_0xa5f2('0x39')]=function(_0x368272,_0x5393b5){var _0x2f6492={},_0x1e5102={},_0x379443={'count':0x0,'rows':[]};var _0x887eba=_['map'](db[_0xa5f2('0x3a')][_0xa5f2('0x3b')],function(_0x4b3124){return{'name':_0x4b3124[_0xa5f2('0x3c')],'type':_0x4b3124[_0xa5f2('0x3d')][_0xa5f2('0x3e')]};});_0x1e5102[_0xa5f2('0x3f')]=_[_0xa5f2('0x40')](_0x887eba,_0xa5f2('0x37'));_0x1e5102[_0xa5f2('0x41')]=_[_0xa5f2('0x42')](_0x368272[_0xa5f2('0x41')]);_0x1e5102[_0xa5f2('0x43')]=_[_0xa5f2('0x44')](_0x1e5102['model'],_0x1e5102[_0xa5f2('0x41')]);_0x2f6492[_0xa5f2('0x45')]=_[_0xa5f2('0x44')](_0x1e5102[_0xa5f2('0x3f')],qs['fields'](_0x368272[_0xa5f2('0x41')][_0xa5f2('0x46')]));_0x2f6492[_0xa5f2('0x45')]=_0x2f6492['attributes'][_0xa5f2('0x47')]?_0x2f6492[_0xa5f2('0x45')]:_0x1e5102['model'];if(!_0x368272['query'][_0xa5f2('0x48')](_0xa5f2('0x49'))){_0x2f6492['limit']=qs[_0xa5f2('0x2e')](_0x368272[_0xa5f2('0x41')][_0xa5f2('0x2e')]);_0x2f6492[_0xa5f2('0x2d')]=qs[_0xa5f2('0x2d')](_0x368272[_0xa5f2('0x41')]['offset']);}_0x2f6492[_0xa5f2('0x4a')]=qs[_0xa5f2('0x4b')](_0x368272[_0xa5f2('0x41')]['sort']);_0x2f6492['where']=qs[_0xa5f2('0x43')](_[_0xa5f2('0x4c')](_0x368272[_0xa5f2('0x41')],_0x1e5102[_0xa5f2('0x43')]),_0x887eba);if(_0x368272['query']['filter']){_0x2f6492[_0xa5f2('0x4d')]=_[_0xa5f2('0x4e')](_0x2f6492[_0xa5f2('0x4d')],{'$or':_[_0xa5f2('0x40')](_0x887eba,function(_0x3a013a){if(_0x3a013a[_0xa5f2('0x3d')]!==_0xa5f2('0x4f')){var _0x1bbbb8={};_0x1bbbb8[_0x3a013a[_0xa5f2('0x37')]]={'$like':'%'+_0x368272[_0xa5f2('0x41')][_0xa5f2('0x50')]+'%'};return _0x1bbbb8;}})});}_0x2f6492=_[_0xa5f2('0x4e')]({},_0x2f6492,_0x368272[_0xa5f2('0x51')]);var _0x202794={'where':_0x2f6492[_0xa5f2('0x4d')]};return db['VtigerConfiguration']['count'](_0x202794)[_0xa5f2('0x1e')](function(_0x5e393e){_0x379443[_0xa5f2('0x2c')]=_0x5e393e;if(_0x368272[_0xa5f2('0x41')]['includeAll']){_0x2f6492[_0xa5f2('0x52')]=[{'all':!![]}];}return db[_0xa5f2('0x3a')][_0xa5f2('0x53')](_0x2f6492);})[_0xa5f2('0x1e')](function(_0x16a1e1){_0x379443['rows']=_0x16a1e1;return _0x379443;})[_0xa5f2('0x1e')](respondWithFilteredResult(_0x5393b5,_0x2f6492))[_0xa5f2('0x28')](handleError(_0x5393b5,null));};exports[_0xa5f2('0x54')]=function(_0x3c615f,_0xb6bd9){var _0x5e39f1={'raw':![],'where':{'id':_0x3c615f[_0xa5f2('0x55')]['id']}},_0x5da100={};_0x5da100[_0xa5f2('0x3f')]=_['keys'](db[_0xa5f2('0x3a')][_0xa5f2('0x3b')]);_0x5da100[_0xa5f2('0x41')]=_[_0xa5f2('0x42')](_0x3c615f[_0xa5f2('0x41')]);_0x5da100[_0xa5f2('0x43')]=_[_0xa5f2('0x44')](_0x5da100[_0xa5f2('0x3f')],_0x5da100['query']);_0x5e39f1['attributes']=_['intersection'](_0x5da100[_0xa5f2('0x3f')],qs[_0xa5f2('0x46')](_0x3c615f[_0xa5f2('0x41')]['fields']));_0x5e39f1['attributes']=_0x5e39f1['attributes'][_0xa5f2('0x47')]?_0x5e39f1[_0xa5f2('0x45')]:_0x5da100[_0xa5f2('0x3f')];if(_0x3c615f[_0xa5f2('0x41')][_0xa5f2('0x56')]){_0x5e39f1[_0xa5f2('0x52')]=[{'all':!![]}];}_0x5e39f1=_[_0xa5f2('0x4e')]({},_0x5e39f1,_0x3c615f[_0xa5f2('0x51')]);return db['VtigerConfiguration']['find'](_0x5e39f1)['then'](handleEntityNotFound(_0xb6bd9,null))[_0xa5f2('0x1e')](respondWithResult(_0xb6bd9,null))['catch'](handleError(_0xb6bd9,null));};exports['create']=function(_0x274a30,_0x5dc1d6){return db[_0xa5f2('0x3a')][_0xa5f2('0x57')](_0x274a30[_0xa5f2('0x58')],{})[_0xa5f2('0x1e')](respondWithResult(_0x5dc1d6,0xc9))['catch'](handleError(_0x5dc1d6,null));};exports[_0xa5f2('0x34')]=function(_0x4db731,_0x44066a){if(_0x4db731[_0xa5f2('0x58')]['id']){delete _0x4db731['body']['id'];}return db['VtigerConfiguration'][_0xa5f2('0x59')]({'where':{'id':_0x4db731[_0xa5f2('0x55')]['id']}})[_0xa5f2('0x1e')](handleEntityNotFound(_0x44066a,null))[_0xa5f2('0x1e')](saveUpdates(_0x4db731[_0xa5f2('0x58')],null))[_0xa5f2('0x1e')](respondWithResult(_0x44066a,null))[_0xa5f2('0x28')](handleError(_0x44066a,null));};exports[_0xa5f2('0x35')]=function(_0x210863,_0x3b0410){return db[_0xa5f2('0x3a')]['find']({'where':{'id':_0x210863['params']['id']}})[_0xa5f2('0x1e')](handleEntityNotFound(_0x3b0410,null))['then'](removeEntity(_0x3b0410,null))[_0xa5f2('0x28')](handleError(_0x3b0410,null));};exports[_0xa5f2('0x5a')]=function(_0xc2c3af,_0x321968,_0x52a502){var _0x3fa483={};var _0x29b90d={};var _0x2d2daf;var _0x201c68;return db[_0xa5f2('0x3a')]['findOne']({'where':{'id':_0xc2c3af[_0xa5f2('0x55')]['id']}})['then'](handleEntityNotFound(_0x321968,null))[_0xa5f2('0x1e')](function(_0x201c16){if(_0x201c16){_0x2d2daf=_0x201c16;_0x29b90d[_0xa5f2('0x3f')]=_[_0xa5f2('0x42')](db[_0xa5f2('0x5b')]['rawAttributes']);_0x29b90d['query']=_[_0xa5f2('0x42')](_0xc2c3af['query']);_0x29b90d[_0xa5f2('0x43')]=_['intersection'](_0x29b90d[_0xa5f2('0x3f')],_0x29b90d[_0xa5f2('0x41')]);_0x3fa483[_0xa5f2('0x45')]=_[_0xa5f2('0x44')](_0x29b90d['model'],qs['fields'](_0xc2c3af[_0xa5f2('0x41')]['fields']));_0x3fa483[_0xa5f2('0x45')]=_0x3fa483['attributes'][_0xa5f2('0x47')]?_0x3fa483[_0xa5f2('0x45')]:_0x29b90d[_0xa5f2('0x3f')];_0x3fa483['order']=qs[_0xa5f2('0x4b')](_0xc2c3af[_0xa5f2('0x41')][_0xa5f2('0x4b')]);_0x3fa483['where']=qs[_0xa5f2('0x43')](_[_0xa5f2('0x4c')](_0xc2c3af[_0xa5f2('0x41')],_0x29b90d['filters']));if(_0xc2c3af[_0xa5f2('0x41')][_0xa5f2('0x50')]){_0x3fa483['where']=_['merge'](_0x3fa483[_0xa5f2('0x4d')],{'$or':_[_0xa5f2('0x40')](_0x3fa483['attributes'],function(_0x49034c){var _0x407387={};_0x407387[_0x49034c]={'$like':'%'+_0xc2c3af[_0xa5f2('0x41')][_0xa5f2('0x50')]+'%'};return _0x407387;})});}_0x3fa483=_[_0xa5f2('0x4e')]({},_0x3fa483,_0xc2c3af[_0xa5f2('0x51')]);return _0x2d2daf[_0xa5f2('0x5a')](_0x3fa483);}})[_0xa5f2('0x1e')](function(_0x4dc350){if(_0x4dc350){_0x201c68=_0x4dc350[_0xa5f2('0x47')];if(!_0xc2c3af[_0xa5f2('0x41')][_0xa5f2('0x48')](_0xa5f2('0x49'))){_0x3fa483[_0xa5f2('0x2e')]=qs[_0xa5f2('0x2e')](_0xc2c3af[_0xa5f2('0x41')][_0xa5f2('0x2e')]);_0x3fa483[_0xa5f2('0x2d')]=qs[_0xa5f2('0x2d')](_0xc2c3af[_0xa5f2('0x41')][_0xa5f2('0x2d')]);}return _0x2d2daf[_0xa5f2('0x5a')](_0x3fa483);}})[_0xa5f2('0x1e')](function(_0x2c4b85){if(_0x2c4b85){return _0x2c4b85?{'count':_0x201c68,'rows':_0x2c4b85}:null;}})[_0xa5f2('0x1e')](respondWithResult(_0x321968,null))[_0xa5f2('0x28')](handleError(_0x321968,null));};exports[_0xa5f2('0x5c')]=function(_0x433226,_0x2cb552,_0x586159){var _0x2e8104={};var _0x24f362={};var _0x18f4c5;var _0x3f2f99;return db['VtigerConfiguration'][_0xa5f2('0x5d')]({'where':{'id':_0x433226['params']['id']}})[_0xa5f2('0x1e')](handleEntityNotFound(_0x2cb552,null))['then'](function(_0x28036d){if(_0x28036d){_0x18f4c5=_0x28036d;_0x24f362[_0xa5f2('0x3f')]=_[_0xa5f2('0x42')](db[_0xa5f2('0x5b')][_0xa5f2('0x3b')]);_0x24f362[_0xa5f2('0x41')]=_[_0xa5f2('0x42')](_0x433226[_0xa5f2('0x41')]);_0x24f362[_0xa5f2('0x43')]=_[_0xa5f2('0x44')](_0x24f362[_0xa5f2('0x3f')],_0x24f362['query']);_0x2e8104[_0xa5f2('0x45')]=_[_0xa5f2('0x44')](_0x24f362[_0xa5f2('0x3f')],qs['fields'](_0x433226[_0xa5f2('0x41')][_0xa5f2('0x46')]));_0x2e8104[_0xa5f2('0x45')]=_0x2e8104['attributes'][_0xa5f2('0x47')]?_0x2e8104[_0xa5f2('0x45')]:_0x24f362['model'];_0x2e8104[_0xa5f2('0x4a')]=qs[_0xa5f2('0x4b')](_0x433226['query'][_0xa5f2('0x4b')]);_0x2e8104[_0xa5f2('0x4d')]=qs[_0xa5f2('0x43')](_[_0xa5f2('0x4c')](_0x433226[_0xa5f2('0x41')],_0x24f362[_0xa5f2('0x43')]));if(_0x433226[_0xa5f2('0x41')]['filter']){_0x2e8104[_0xa5f2('0x4d')]=_['merge'](_0x2e8104['where'],{'$or':_[_0xa5f2('0x40')](_0x2e8104[_0xa5f2('0x45')],function(_0x1d1bda){var _0x45f552={};_0x45f552[_0x1d1bda]={'$like':'%'+_0x433226['query'][_0xa5f2('0x50')]+'%'};return _0x45f552;})});}_0x2e8104=_[_0xa5f2('0x4e')]({},_0x2e8104,_0x433226[_0xa5f2('0x51')]);return _0x18f4c5[_0xa5f2('0x5c')](_0x2e8104);}})[_0xa5f2('0x1e')](function(_0x50b0b5){if(_0x50b0b5){_0x3f2f99=_0x50b0b5[_0xa5f2('0x47')];if(!_0x433226[_0xa5f2('0x41')][_0xa5f2('0x48')](_0xa5f2('0x49'))){_0x2e8104[_0xa5f2('0x2e')]=qs[_0xa5f2('0x2e')](_0x433226[_0xa5f2('0x41')][_0xa5f2('0x2e')]);_0x2e8104[_0xa5f2('0x2d')]=qs[_0xa5f2('0x2d')](_0x433226[_0xa5f2('0x41')][_0xa5f2('0x2d')]);}return _0x18f4c5['getSubjects'](_0x2e8104);}})[_0xa5f2('0x1e')](function(_0x2d51a3){if(_0x2d51a3){return _0x2d51a3?{'count':_0x3f2f99,'rows':_0x2d51a3}:null;}})['then'](respondWithResult(_0x2cb552,null))[_0xa5f2('0x28')](handleError(_0x2cb552,null));};exports['getDescriptions']=function(_0x45944c,_0xb0d1,_0x4fd09e){var _0x49f149={};var _0x586074={};var _0xc9c671;var _0x48c7f7;return db[_0xa5f2('0x3a')][_0xa5f2('0x5d')]({'where':{'id':_0x45944c[_0xa5f2('0x55')]['id']}})['then'](handleEntityNotFound(_0xb0d1,null))[_0xa5f2('0x1e')](function(_0x314293){if(_0x314293){_0xc9c671=_0x314293;_0x586074[_0xa5f2('0x3f')]=_[_0xa5f2('0x42')](db['VtigerField'][_0xa5f2('0x3b')]);_0x586074[_0xa5f2('0x41')]=_['keys'](_0x45944c[_0xa5f2('0x41')]);_0x586074[_0xa5f2('0x43')]=_['intersection'](_0x586074[_0xa5f2('0x3f')],_0x586074[_0xa5f2('0x41')]);_0x49f149[_0xa5f2('0x45')]=_[_0xa5f2('0x44')](_0x586074[_0xa5f2('0x3f')],qs[_0xa5f2('0x46')](_0x45944c[_0xa5f2('0x41')][_0xa5f2('0x46')]));_0x49f149[_0xa5f2('0x45')]=_0x49f149[_0xa5f2('0x45')][_0xa5f2('0x47')]?_0x49f149[_0xa5f2('0x45')]:_0x586074[_0xa5f2('0x3f')];_0x49f149[_0xa5f2('0x4a')]=qs['sort'](_0x45944c[_0xa5f2('0x41')]['sort']);_0x49f149[_0xa5f2('0x4d')]=qs[_0xa5f2('0x43')](_[_0xa5f2('0x4c')](_0x45944c['query'],_0x586074[_0xa5f2('0x43')]));if(_0x45944c[_0xa5f2('0x41')][_0xa5f2('0x50')]){_0x49f149[_0xa5f2('0x4d')]=_[_0xa5f2('0x4e')](_0x49f149[_0xa5f2('0x4d')],{'$or':_[_0xa5f2('0x40')](_0x49f149[_0xa5f2('0x45')],function(_0x284438){var _0x8b8987={};_0x8b8987[_0x284438]={'$like':'%'+_0x45944c[_0xa5f2('0x41')][_0xa5f2('0x50')]+'%'};return _0x8b8987;})});}_0x49f149=_['merge']({},_0x49f149,_0x45944c['options']);return _0xc9c671[_0xa5f2('0x5e')](_0x49f149);}})['then'](function(_0x332f3b){if(_0x332f3b){_0x48c7f7=_0x332f3b['length'];if(!_0x45944c[_0xa5f2('0x41')][_0xa5f2('0x48')](_0xa5f2('0x49'))){_0x49f149[_0xa5f2('0x2e')]=qs['limit'](_0x45944c[_0xa5f2('0x41')][_0xa5f2('0x2e')]);_0x49f149[_0xa5f2('0x2d')]=qs[_0xa5f2('0x2d')](_0x45944c[_0xa5f2('0x41')][_0xa5f2('0x2d')]);}return _0xc9c671[_0xa5f2('0x5e')](_0x49f149);}})[_0xa5f2('0x1e')](function(_0xd27381){if(_0xd27381){return _0xd27381?{'count':_0x48c7f7,'rows':_0xd27381}:null;}})[_0xa5f2('0x1e')](respondWithResult(_0xb0d1,null))[_0xa5f2('0x28')](handleError(_0xb0d1,null));}; \ No newline at end of file +var _0x29cf=['zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','then','VtigerConfiguration,\x20%s,\x20%s','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','update','destroy','end','stack','name','send','index','VtigerConfiguration','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','params','rawAttributes','fields','create','body','find','getFields','findOne','VtigerField','limit','getSubjects','hasOwnProperty','getDescriptions','rimraf'];(function(_0x3bd821,_0x12e772){var _0x131af0=function(_0x217d3a){while(--_0x217d3a){_0x3bd821['push'](_0x3bd821['shift']());}};_0x131af0(++_0x12e772);}(_0x29cf,0x10d));var _0xf29c=function(_0x3f7e80,_0x557788){_0x3f7e80=_0x3f7e80-0x0;var _0x5ef935=_0x29cf[_0x3f7e80];return _0x5ef935;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf29c('0x0'));var zipdir=require(_0xf29c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf29c('0x2'));var moment=require(_0xf29c('0x3'));var BPromise=require(_0xf29c('0x4'));var Mustache=require(_0xf29c('0x5'));var util=require('util');var path=require(_0xf29c('0x6'));var sox=require('sox');var csv=require(_0xf29c('0x7'));var ejs=require(_0xf29c('0x8'));var fs=require('fs');var fs_extra=require(_0xf29c('0x9'));var _=require(_0xf29c('0xa'));var squel=require('squel');var crypto=require(_0xf29c('0xb'));var jsforce=require(_0xf29c('0xc'));var deskjs=require(_0xf29c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf29c('0xe'));var Papa=require(_0xf29c('0xf'));var Redis=require(_0xf29c('0x10'));var authService=require(_0xf29c('0x11'));var qs=require(_0xf29c('0x12'));var as=require(_0xf29c('0x13'));var hardwareService=require(_0xf29c('0x14'));var logger=require(_0xf29c('0x15'))('api');var utils=require(_0xf29c('0x16'));var config=require(_0xf29c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf29c('0x18'))['db'];var jayson=require(_0xf29c('0x19'));var client=jayson[_0xf29c('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59e0c8,_0x515647,_0x38a3bd,_0x1434d0){return new BPromise(function(_0x26d58a,_0x169082){var _0x851a23=_0x1434d0||client;return _0x851a23[_0xf29c('0x1b')](_0x59e0c8,_0x38a3bd)[_0xf29c('0x1c')](function(_0x4e8c51){logger['info'](_0xf29c('0x1d'),_0x515647,'request\x20sent');logger['debug'](_0xf29c('0x1e'),_0x515647,'request\x20sent',JSON[_0xf29c('0x1f')](_0x4e8c51));if(_0x4e8c51[_0xf29c('0x20')]){if(_0x4e8c51['error']['code']===0x1f4){logger[_0xf29c('0x20')](_0xf29c('0x1d'),_0x515647,_0x4e8c51[_0xf29c('0x20')][_0xf29c('0x21')]);return _0x169082(_0x4e8c51[_0xf29c('0x20')][_0xf29c('0x21')]);}logger[_0xf29c('0x20')](_0xf29c('0x1d'),_0x515647,_0x4e8c51[_0xf29c('0x20')][_0xf29c('0x21')]);return _0x26d58a(_0x4e8c51[_0xf29c('0x20')][_0xf29c('0x21')]);}else{logger[_0xf29c('0x22')]('VtigerConfiguration,\x20%s,\x20%s',_0x515647,_0xf29c('0x23'));_0x26d58a(_0x4e8c51[_0xf29c('0x24')][_0xf29c('0x21')]);}})[_0xf29c('0x25')](function(_0x2ee000){logger[_0xf29c('0x20')](_0xf29c('0x1d'),_0x515647,_0x2ee000);_0x169082(_0x2ee000);});});}function respondWithStatusCode(_0x8c1041,_0x18de5a){_0x18de5a=_0x18de5a||0xcc;return function(_0x26f9c6){if(_0x26f9c6){return _0x8c1041[_0xf29c('0x26')](_0x18de5a);}return _0x8c1041[_0xf29c('0x27')](_0x18de5a)['end']();};}function respondWithResult(_0x4d9310,_0x1dca25){_0x1dca25=_0x1dca25||0xc8;return function(_0x3027cb){if(_0x3027cb){return _0x4d9310['status'](_0x1dca25)[_0xf29c('0x28')](_0x3027cb);}};}function respondWithFilteredResult(_0xc89665,_0x55608e){return function(_0x270990){if(_0x270990){var _0x3475f3=_0x270990[_0xf29c('0x29')],_0x1dcfcd=_0x55608e['offset'],_0x72e75a=_0x55608e[_0xf29c('0x2a')]+_0x55608e['limit'],_0x58b44c;if(_0x72e75a>=_0x3475f3){_0x72e75a=_0x3475f3;_0x58b44c=0xc8;}else{_0x58b44c=0xce;}_0xc89665['status'](_0x58b44c);return _0xc89665[_0xf29c('0x2b')](_0xf29c('0x2c'),_0x1dcfcd+'-'+_0x72e75a+'/'+_0x3475f3)['json'](_0x270990);}return null;};}function patchUpdates(_0x4b6f22){return function(_0x4a3d08){try{jsonpatch[_0xf29c('0x2d')](_0x4a3d08,_0x4b6f22,!![]);}catch(_0x4f1c6f){return BPromise[_0xf29c('0x2e')](_0x4f1c6f);}return _0x4a3d08['save']();};}function saveUpdates(_0x39ae95,_0x246934){return function(_0x387234){if(_0x387234){return _0x387234[_0xf29c('0x2f')](_0x39ae95)[_0xf29c('0x1c')](function(_0x5a1e8e){return _0x5a1e8e;});}return null;};}function removeEntity(_0x49b64b,_0x303df4){return function(_0x11f135){if(_0x11f135){return _0x11f135[_0xf29c('0x30')]()[_0xf29c('0x1c')](function(){_0x49b64b[_0xf29c('0x27')](0xcc)[_0xf29c('0x31')]();});}};}function handleEntityNotFound(_0x3f14ed,_0x556721){return function(_0x15e464){if(!_0x15e464){_0x3f14ed[_0xf29c('0x26')](0x194);}return _0x15e464;};}function handleError(_0xac39e3,_0x26ac51){_0x26ac51=_0x26ac51||0x1f4;return function(_0x4a1b3b){logger['error'](_0x4a1b3b[_0xf29c('0x32')]);if(_0x4a1b3b[_0xf29c('0x33')]){delete _0x4a1b3b[_0xf29c('0x33')];}_0xac39e3[_0xf29c('0x27')](_0x26ac51)[_0xf29c('0x34')](_0x4a1b3b);};}exports[_0xf29c('0x35')]=function(_0x1d1e6b,_0x558cee){var _0x239028={},_0x21ad28={},_0x6d9f6f={'count':0x0,'rows':[]};var _0x25ef4d=_['map'](db[_0xf29c('0x36')]['rawAttributes'],function(_0x20ca52){return{'name':_0x20ca52[_0xf29c('0x37')],'type':_0x20ca52[_0xf29c('0x38')][_0xf29c('0x39')]};});_0x21ad28[_0xf29c('0x3a')]=_[_0xf29c('0x3b')](_0x25ef4d,_0xf29c('0x33'));_0x21ad28[_0xf29c('0x3c')]=_[_0xf29c('0x3d')](_0x1d1e6b['query']);_0x21ad28[_0xf29c('0x3e')]=_[_0xf29c('0x3f')](_0x21ad28[_0xf29c('0x3a')],_0x21ad28[_0xf29c('0x3c')]);_0x239028[_0xf29c('0x40')]=_[_0xf29c('0x3f')](_0x21ad28[_0xf29c('0x3a')],qs['fields'](_0x1d1e6b['query']['fields']));_0x239028[_0xf29c('0x40')]=_0x239028[_0xf29c('0x40')][_0xf29c('0x41')]?_0x239028['attributes']:_0x21ad28[_0xf29c('0x3a')];if(!_0x1d1e6b[_0xf29c('0x3c')]['hasOwnProperty'](_0xf29c('0x42'))){_0x239028['limit']=qs['limit'](_0x1d1e6b[_0xf29c('0x3c')]['limit']);_0x239028[_0xf29c('0x2a')]=qs[_0xf29c('0x2a')](_0x1d1e6b[_0xf29c('0x3c')]['offset']);}_0x239028[_0xf29c('0x43')]=qs[_0xf29c('0x44')](_0x1d1e6b['query'][_0xf29c('0x44')]);_0x239028[_0xf29c('0x45')]=qs[_0xf29c('0x3e')](_[_0xf29c('0x46')](_0x1d1e6b['query'],_0x21ad28[_0xf29c('0x3e')]),_0x25ef4d);if(_0x1d1e6b[_0xf29c('0x3c')][_0xf29c('0x47')]){_0x239028[_0xf29c('0x45')]=_[_0xf29c('0x48')](_0x239028['where'],{'$or':_[_0xf29c('0x3b')](_0x25ef4d,function(_0x4e53fa){if(_0x4e53fa['type']!=='VIRTUAL'){var _0x36153e={};_0x36153e[_0x4e53fa['name']]={'$like':'%'+_0x1d1e6b[_0xf29c('0x3c')][_0xf29c('0x47')]+'%'};return _0x36153e;}})});}_0x239028=_[_0xf29c('0x48')]({},_0x239028,_0x1d1e6b[_0xf29c('0x49')]);var _0x43dee8={'where':_0x239028['where']};return db['VtigerConfiguration'][_0xf29c('0x29')](_0x43dee8)['then'](function(_0x1c923d){_0x6d9f6f['count']=_0x1c923d;if(_0x1d1e6b[_0xf29c('0x3c')][_0xf29c('0x4a')]){_0x239028[_0xf29c('0x4b')]=[{'all':!![]}];}return db[_0xf29c('0x36')][_0xf29c('0x4c')](_0x239028);})[_0xf29c('0x1c')](function(_0x153286){_0x6d9f6f['rows']=_0x153286;return _0x6d9f6f;})[_0xf29c('0x1c')](respondWithFilteredResult(_0x558cee,_0x239028))['catch'](handleError(_0x558cee,null));};exports['show']=function(_0x40b33e,_0x71167d){var _0x299a45={'raw':![],'where':{'id':_0x40b33e[_0xf29c('0x4d')]['id']}},_0x1146eb={};_0x1146eb[_0xf29c('0x3a')]=_[_0xf29c('0x3d')](db[_0xf29c('0x36')][_0xf29c('0x4e')]);_0x1146eb[_0xf29c('0x3c')]=_[_0xf29c('0x3d')](_0x40b33e['query']);_0x1146eb[_0xf29c('0x3e')]=_[_0xf29c('0x3f')](_0x1146eb[_0xf29c('0x3a')],_0x1146eb[_0xf29c('0x3c')]);_0x299a45['attributes']=_['intersection'](_0x1146eb[_0xf29c('0x3a')],qs['fields'](_0x40b33e[_0xf29c('0x3c')][_0xf29c('0x4f')]));_0x299a45[_0xf29c('0x40')]=_0x299a45[_0xf29c('0x40')][_0xf29c('0x41')]?_0x299a45['attributes']:_0x1146eb[_0xf29c('0x3a')];if(_0x40b33e['query']['includeAll']){_0x299a45['include']=[{'all':!![]}];}_0x299a45=_[_0xf29c('0x48')]({},_0x299a45,_0x40b33e[_0xf29c('0x49')]);return db[_0xf29c('0x36')]['find'](_0x299a45)[_0xf29c('0x1c')](handleEntityNotFound(_0x71167d,null))[_0xf29c('0x1c')](respondWithResult(_0x71167d,null))['catch'](handleError(_0x71167d,null));};exports[_0xf29c('0x50')]=function(_0x5cff15,_0x7eefd4){return db[_0xf29c('0x36')]['create'](_0x5cff15[_0xf29c('0x51')],{})[_0xf29c('0x1c')](respondWithResult(_0x7eefd4,0xc9))[_0xf29c('0x25')](handleError(_0x7eefd4,null));};exports[_0xf29c('0x2f')]=function(_0x2ba5f5,_0x3fdeb7){if(_0x2ba5f5[_0xf29c('0x51')]['id']){delete _0x2ba5f5[_0xf29c('0x51')]['id'];}return db['VtigerConfiguration'][_0xf29c('0x52')]({'where':{'id':_0x2ba5f5[_0xf29c('0x4d')]['id']}})[_0xf29c('0x1c')](handleEntityNotFound(_0x3fdeb7,null))[_0xf29c('0x1c')](saveUpdates(_0x2ba5f5['body'],null))[_0xf29c('0x1c')](respondWithResult(_0x3fdeb7,null))[_0xf29c('0x25')](handleError(_0x3fdeb7,null));};exports[_0xf29c('0x30')]=function(_0xdec09,_0x4f6705){return db[_0xf29c('0x36')][_0xf29c('0x52')]({'where':{'id':_0xdec09[_0xf29c('0x4d')]['id']}})[_0xf29c('0x1c')](handleEntityNotFound(_0x4f6705,null))[_0xf29c('0x1c')](removeEntity(_0x4f6705,null))[_0xf29c('0x25')](handleError(_0x4f6705,null));};exports[_0xf29c('0x53')]=function(_0x1fb757,_0x3455fa,_0x1403a4){var _0x4ac14c={};var _0x1558bb={};var _0x24452f;var _0x37b720;return db[_0xf29c('0x36')][_0xf29c('0x54')]({'where':{'id':_0x1fb757[_0xf29c('0x4d')]['id']}})[_0xf29c('0x1c')](handleEntityNotFound(_0x3455fa,null))[_0xf29c('0x1c')](function(_0x26a86d){if(_0x26a86d){_0x24452f=_0x26a86d;_0x1558bb['model']=_[_0xf29c('0x3d')](db[_0xf29c('0x55')][_0xf29c('0x4e')]);_0x1558bb['query']=_['keys'](_0x1fb757[_0xf29c('0x3c')]);_0x1558bb['filters']=_[_0xf29c('0x3f')](_0x1558bb[_0xf29c('0x3a')],_0x1558bb[_0xf29c('0x3c')]);_0x4ac14c[_0xf29c('0x40')]=_[_0xf29c('0x3f')](_0x1558bb[_0xf29c('0x3a')],qs[_0xf29c('0x4f')](_0x1fb757[_0xf29c('0x3c')]['fields']));_0x4ac14c[_0xf29c('0x40')]=_0x4ac14c[_0xf29c('0x40')][_0xf29c('0x41')]?_0x4ac14c['attributes']:_0x1558bb[_0xf29c('0x3a')];_0x4ac14c[_0xf29c('0x43')]=qs[_0xf29c('0x44')](_0x1fb757[_0xf29c('0x3c')][_0xf29c('0x44')]);_0x4ac14c['where']=qs[_0xf29c('0x3e')](_[_0xf29c('0x46')](_0x1fb757[_0xf29c('0x3c')],_0x1558bb[_0xf29c('0x3e')]));if(_0x1fb757[_0xf29c('0x3c')][_0xf29c('0x47')]){_0x4ac14c[_0xf29c('0x45')]=_[_0xf29c('0x48')](_0x4ac14c[_0xf29c('0x45')],{'$or':_[_0xf29c('0x3b')](_0x4ac14c[_0xf29c('0x40')],function(_0x55bd51){var _0x1079bd={};_0x1079bd[_0x55bd51]={'$like':'%'+_0x1fb757[_0xf29c('0x3c')][_0xf29c('0x47')]+'%'};return _0x1079bd;})});}_0x4ac14c=_[_0xf29c('0x48')]({},_0x4ac14c,_0x1fb757[_0xf29c('0x49')]);return _0x24452f['getFields'](_0x4ac14c);}})[_0xf29c('0x1c')](function(_0x1654ef){if(_0x1654ef){_0x37b720=_0x1654ef[_0xf29c('0x41')];if(!_0x1fb757[_0xf29c('0x3c')]['hasOwnProperty'](_0xf29c('0x42'))){_0x4ac14c[_0xf29c('0x56')]=qs[_0xf29c('0x56')](_0x1fb757[_0xf29c('0x3c')][_0xf29c('0x56')]);_0x4ac14c[_0xf29c('0x2a')]=qs[_0xf29c('0x2a')](_0x1fb757[_0xf29c('0x3c')][_0xf29c('0x2a')]);}return _0x24452f[_0xf29c('0x53')](_0x4ac14c);}})[_0xf29c('0x1c')](function(_0x4b18b3){if(_0x4b18b3){return _0x4b18b3?{'count':_0x37b720,'rows':_0x4b18b3}:null;}})['then'](respondWithResult(_0x3455fa,null))['catch'](handleError(_0x3455fa,null));};exports[_0xf29c('0x57')]=function(_0x4d7596,_0x53b8fb,_0x2bebcd){var _0x2dc6cd={};var _0x5ce3e3={};var _0x3209c7;var _0x475435;return db['VtigerConfiguration'][_0xf29c('0x54')]({'where':{'id':_0x4d7596[_0xf29c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x53b8fb,null))['then'](function(_0x56e92f){if(_0x56e92f){_0x3209c7=_0x56e92f;_0x5ce3e3[_0xf29c('0x3a')]=_[_0xf29c('0x3d')](db[_0xf29c('0x55')][_0xf29c('0x4e')]);_0x5ce3e3['query']=_[_0xf29c('0x3d')](_0x4d7596['query']);_0x5ce3e3[_0xf29c('0x3e')]=_[_0xf29c('0x3f')](_0x5ce3e3[_0xf29c('0x3a')],_0x5ce3e3[_0xf29c('0x3c')]);_0x2dc6cd[_0xf29c('0x40')]=_[_0xf29c('0x3f')](_0x5ce3e3['model'],qs[_0xf29c('0x4f')](_0x4d7596['query'][_0xf29c('0x4f')]));_0x2dc6cd[_0xf29c('0x40')]=_0x2dc6cd['attributes'][_0xf29c('0x41')]?_0x2dc6cd['attributes']:_0x5ce3e3['model'];_0x2dc6cd[_0xf29c('0x43')]=qs['sort'](_0x4d7596[_0xf29c('0x3c')][_0xf29c('0x44')]);_0x2dc6cd[_0xf29c('0x45')]=qs[_0xf29c('0x3e')](_['pick'](_0x4d7596[_0xf29c('0x3c')],_0x5ce3e3[_0xf29c('0x3e')]));if(_0x4d7596['query'][_0xf29c('0x47')]){_0x2dc6cd[_0xf29c('0x45')]=_[_0xf29c('0x48')](_0x2dc6cd[_0xf29c('0x45')],{'$or':_['map'](_0x2dc6cd[_0xf29c('0x40')],function(_0x402539){var _0x31815b={};_0x31815b[_0x402539]={'$like':'%'+_0x4d7596[_0xf29c('0x3c')][_0xf29c('0x47')]+'%'};return _0x31815b;})});}_0x2dc6cd=_[_0xf29c('0x48')]({},_0x2dc6cd,_0x4d7596['options']);return _0x3209c7[_0xf29c('0x57')](_0x2dc6cd);}})[_0xf29c('0x1c')](function(_0x9b5324){if(_0x9b5324){_0x475435=_0x9b5324[_0xf29c('0x41')];if(!_0x4d7596['query'][_0xf29c('0x58')](_0xf29c('0x42'))){_0x2dc6cd[_0xf29c('0x56')]=qs[_0xf29c('0x56')](_0x4d7596[_0xf29c('0x3c')][_0xf29c('0x56')]);_0x2dc6cd['offset']=qs['offset'](_0x4d7596[_0xf29c('0x3c')][_0xf29c('0x2a')]);}return _0x3209c7['getSubjects'](_0x2dc6cd);}})[_0xf29c('0x1c')](function(_0x48a60c){if(_0x48a60c){return _0x48a60c?{'count':_0x475435,'rows':_0x48a60c}:null;}})[_0xf29c('0x1c')](respondWithResult(_0x53b8fb,null))['catch'](handleError(_0x53b8fb,null));};exports[_0xf29c('0x59')]=function(_0x58e0a5,_0x1297cc,_0xfea3e2){var _0xecdd32={};var _0x3e3324={};var _0x7bbd44;var _0x1a4a5c;return db[_0xf29c('0x36')][_0xf29c('0x54')]({'where':{'id':_0x58e0a5[_0xf29c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1297cc,null))[_0xf29c('0x1c')](function(_0x3fbca5){if(_0x3fbca5){_0x7bbd44=_0x3fbca5;_0x3e3324['model']=_[_0xf29c('0x3d')](db['VtigerField'][_0xf29c('0x4e')]);_0x3e3324[_0xf29c('0x3c')]=_[_0xf29c('0x3d')](_0x58e0a5[_0xf29c('0x3c')]);_0x3e3324[_0xf29c('0x3e')]=_['intersection'](_0x3e3324['model'],_0x3e3324['query']);_0xecdd32[_0xf29c('0x40')]=_[_0xf29c('0x3f')](_0x3e3324[_0xf29c('0x3a')],qs[_0xf29c('0x4f')](_0x58e0a5[_0xf29c('0x3c')]['fields']));_0xecdd32[_0xf29c('0x40')]=_0xecdd32['attributes'][_0xf29c('0x41')]?_0xecdd32[_0xf29c('0x40')]:_0x3e3324[_0xf29c('0x3a')];_0xecdd32[_0xf29c('0x43')]=qs['sort'](_0x58e0a5[_0xf29c('0x3c')][_0xf29c('0x44')]);_0xecdd32[_0xf29c('0x45')]=qs[_0xf29c('0x3e')](_[_0xf29c('0x46')](_0x58e0a5[_0xf29c('0x3c')],_0x3e3324['filters']));if(_0x58e0a5['query'][_0xf29c('0x47')]){_0xecdd32[_0xf29c('0x45')]=_[_0xf29c('0x48')](_0xecdd32[_0xf29c('0x45')],{'$or':_[_0xf29c('0x3b')](_0xecdd32['attributes'],function(_0x2a5087){var _0x4daf65={};_0x4daf65[_0x2a5087]={'$like':'%'+_0x58e0a5[_0xf29c('0x3c')][_0xf29c('0x47')]+'%'};return _0x4daf65;})});}_0xecdd32=_[_0xf29c('0x48')]({},_0xecdd32,_0x58e0a5['options']);return _0x7bbd44[_0xf29c('0x59')](_0xecdd32);}})[_0xf29c('0x1c')](function(_0x10218e){if(_0x10218e){_0x1a4a5c=_0x10218e[_0xf29c('0x41')];if(!_0x58e0a5[_0xf29c('0x3c')]['hasOwnProperty'](_0xf29c('0x42'))){_0xecdd32[_0xf29c('0x56')]=qs[_0xf29c('0x56')](_0x58e0a5[_0xf29c('0x3c')][_0xf29c('0x56')]);_0xecdd32[_0xf29c('0x2a')]=qs['offset'](_0x58e0a5[_0xf29c('0x3c')][_0xf29c('0x2a')]);}return _0x7bbd44[_0xf29c('0x59')](_0xecdd32);}})[_0xf29c('0x1c')](function(_0x5884c1){if(_0x5884c1){return _0x5884c1?{'count':_0x1a4a5c,'rows':_0x5884c1}:null;}})[_0xf29c('0x1c')](respondWithResult(_0x1297cc,null))[_0xf29c('0x25')](handleError(_0x1297cc,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 2dc54d8..2ab9733 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 _0x9673=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x9673,0x83));var _0x3967=function(_0x481ffe,_0x2a43ea){_0x481ffe=_0x481ffe-0x0;var _0x3b918a=_0x9673[_0x481ffe];return _0x3b918a;};'use strict';var _=require(_0x3967('0x0'));var util=require(_0x3967('0x1'));var logger=require(_0x3967('0x2'))(_0x3967('0x3'));var moment=require(_0x3967('0x4'));var BPromise=require(_0x3967('0x5'));var rp=require(_0x3967('0x6'));var fs=require('fs');var path=require(_0x3967('0x7'));var rimraf=require(_0x3967('0x8'));var config=require(_0x3967('0x9'));var attributes=require(_0x3967('0xa'));module[_0x3967('0xb')]=function(_0x44b7d5,_0x23e9a2){return _0x44b7d5[_0x3967('0xc')](_0x3967('0xd'),attributes,{'tableName':_0x3967('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf25f=['request-promise','../../config/environment','define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','bluebird'];(function(_0x5c0134,_0x5a41fb){var _0x2bcd72=function(_0x563423){while(--_0x563423){_0x5c0134['push'](_0x5c0134['shift']());}};_0x2bcd72(++_0x5a41fb);}(_0xf25f,0x75));var _0xff25=function(_0x56db4d,_0x4efecc){_0x56db4d=_0x56db4d-0x0;var _0xb5734e=_0xf25f[_0x56db4d];return _0xb5734e;};'use strict';var _=require('lodash');var util=require(_0xff25('0x0'));var logger=require(_0xff25('0x1'))('api');var moment=require('moment');var BPromise=require(_0xff25('0x2'));var rp=require(_0xff25('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xff25('0x4'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x37560c,_0x933c52){return _0x37560c[_0xff25('0x5')](_0xff25('0x6'),attributes,{'tableName':_0xff25('0x7'),'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 fed0505..c6a2151 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 _0x314b=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','VtigerConfiguration,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','ioredis'];(function(_0x274638,_0x578968){var _0x5755df=function(_0x3227d5){while(--_0x3227d5){_0x274638['push'](_0x274638['shift']());}};_0x5755df(++_0x578968);}(_0x314b,0xec));var _0xb314=function(_0x3ccc44,_0x207b0c){_0x3ccc44=_0x3ccc44-0x0;var _0x5d74bb=_0x314b[_0x3ccc44];return _0x5d74bb;};'use strict';var _=require(_0xb314('0x0'));var util=require('util');var moment=require(_0xb314('0x1'));var BPromise=require(_0xb314('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb314('0x3'));var db=require(_0xb314('0x4'))['db'];var utils=require(_0xb314('0x5'));var logger=require(_0xb314('0x6'))(_0xb314('0x7'));var config=require(_0xb314('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb314('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a1681,_0x228035,_0x486ac3){return new BPromise(function(_0x5f4075,_0x45e929){return client[_0xb314('0xa')](_0x5a1681,_0x486ac3)[_0xb314('0xb')](function(_0x29633c){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x228035,_0xb314('0xc'));logger[_0xb314('0xd')](_0xb314('0xe'),_0x228035,_0xb314('0xc'),JSON['stringify'](_0x29633c));if(_0x29633c[_0xb314('0xf')]){if(_0x29633c[_0xb314('0xf')][_0xb314('0x10')]===0x1f4){logger[_0xb314('0xf')](_0xb314('0x11'),_0x228035,_0x29633c[_0xb314('0xf')][_0xb314('0x12')]);return _0x45e929(_0x29633c[_0xb314('0xf')][_0xb314('0x12')]);}logger[_0xb314('0xf')](_0xb314('0x11'),_0x228035,_0x29633c[_0xb314('0xf')][_0xb314('0x12')]);return _0x5f4075(_0x29633c[_0xb314('0xf')][_0xb314('0x12')]);}else{logger['info'](_0xb314('0x11'),_0x228035,_0xb314('0xc'));_0x5f4075(_0x29633c['result'][_0xb314('0x12')]);}})[_0xb314('0x13')](function(_0x56b06a){logger[_0xb314('0xf')](_0xb314('0x11'),_0x228035,_0x56b06a);_0x45e929(_0x56b06a);});});} \ No newline at end of file +var _0xdc2a=['result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x494223,_0x2c1f71){var _0xdaf98=function(_0x1f790e){while(--_0x1f790e){_0x494223['push'](_0x494223['shift']());}};_0xdaf98(++_0x2c1f71);}(_0xdc2a,0x1b6));var _0xadc2=function(_0x4d2f8a,_0x2c4f06){_0x4d2f8a=_0x4d2f8a-0x0;var _0x15a2b1=_0xdc2a[_0x4d2f8a];return _0x15a2b1;};'use strict';var _=require(_0xadc2('0x0'));var util=require(_0xadc2('0x1'));var moment=require(_0xadc2('0x2'));var BPromise=require(_0xadc2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xadc2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xadc2('0x5'))(_0xadc2('0x6'));var config=require(_0xadc2('0x7'));var jayson=require(_0xadc2('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x50df7c,_0x168aec,_0xb175d5){return new BPromise(function(_0x2a46ce,_0x193b35){return client['request'](_0x50df7c,_0xb175d5)[_0xadc2('0x9')](function(_0x27f84e){logger['info'](_0xadc2('0xa'),_0x168aec,_0xadc2('0xb'));logger[_0xadc2('0xc')](_0xadc2('0xd'),_0x168aec,_0xadc2('0xb'),JSON['stringify'](_0x27f84e));if(_0x27f84e['error']){if(_0x27f84e[_0xadc2('0xe')][_0xadc2('0xf')]===0x1f4){logger[_0xadc2('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x168aec,_0x27f84e['error'][_0xadc2('0x10')]);return _0x193b35(_0x27f84e['error'][_0xadc2('0x10')]);}logger[_0xadc2('0xe')](_0xadc2('0xa'),_0x168aec,_0x27f84e[_0xadc2('0xe')][_0xadc2('0x10')]);return _0x2a46ce(_0x27f84e['error'][_0xadc2('0x10')]);}else{logger[_0xadc2('0x11')](_0xadc2('0xa'),_0x168aec,_0xadc2('0xb'));_0x2a46ce(_0x27f84e[_0xadc2('0x12')][_0xadc2('0x10')]);}})['catch'](function(_0x259ac2){logger['error'](_0xadc2('0xa'),_0x168aec,_0x259ac2);_0x193b35(_0x259ac2);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index fb2cc32..7434d04 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 _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','multer','util','connect-timeout'];(function(_0x372515,_0xdd11f){var _0xa3bf4e=function(_0x212cc8){while(--_0x212cc8){_0x372515['push'](_0x372515['shift']());}};_0xa3bf4e(++_0xdd11f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2ee790,_0x5a8661){_0x2ee790=_0x2ee790-0x0;var _0x5a54a5=_0x5fc3[_0x2ee790];return _0x5a54a5;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0xc')]('/',auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x10')]);router[_0x35fc('0x11')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x12')]);module['exports']=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','./intVtigerField.controller','get'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x7a54,0x106));var _0x47a5=function(_0x1cfa76,_0x3bde56){_0x1cfa76=_0x1cfa76-0x0;var _0x1d5850=_0x7a54[_0x1cfa76];return _0x1d5850;};'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/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index c9cdcdf..93a2a24 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 _0xa588=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x3e0dc4,_0x13971b){var _0x586111=function(_0x123c53){while(--_0x123c53){_0x3e0dc4['push'](_0x3e0dc4['shift']());}};_0x586111(++_0x13971b);}(_0xa588,0xe1));var _0x8a58=function(_0x2f63a0,_0x51855d){_0x2f63a0=_0x2f63a0-0x0;var _0x536ae8=_0xa588[_0x2f63a0];return _0x536ae8;};'use strict';var Sequelize=require('sequelize');module[_0x8a58('0x0')]={'type':{'type':Sequelize[_0x8a58('0x1')](_0x8a58('0x2'),_0x8a58('0x3'),_0x8a58('0x4'),_0x8a58('0x5'),_0x8a58('0x6')),'defaultValue':_0x8a58('0x2')},'content':{'type':Sequelize[_0x8a58('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8a58('0x1')](_0x8a58('0x2'),_0x8a58('0x3'),_0x8a58('0x4'))},'keyContent':{'type':Sequelize[_0x8a58('0x7')]},'idField':{'type':Sequelize[_0x8a58('0x7')]},'nameField':{'type':Sequelize[_0x8a58('0x7')]},'customField':{'type':Sequelize[_0x8a58('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x524a=['string','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM'];(function(_0xfebdca,_0x16a4ce){var _0x5c7904=function(_0x3c382e){while(--_0x3c382e){_0xfebdca['push'](_0xfebdca['shift']());}};_0x5c7904(++_0x16a4ce);}(_0x524a,0xf5));var _0xa524=function(_0x2bff81,_0x53b54c){_0x2bff81=_0x2bff81-0x0;var _0x18a10d=_0x524a[_0x2bff81];return _0x18a10d;};'use strict';var Sequelize=require(_0xa524('0x0'));module[_0xa524('0x1')]={'type':{'type':Sequelize[_0xa524('0x2')](_0xa524('0x3'),'variable',_0xa524('0x4'),_0xa524('0x5'),_0xa524('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa524('0x7')]},'keyType':{'type':Sequelize[_0xa524('0x2')](_0xa524('0x3'),'variable',_0xa524('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa524('0x7')]},'nameField':{'type':Sequelize[_0xa524('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa524('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 182646f..48c0c3a 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 _0x92cd=['name','index','VtigerField','rawAttributes','fieldName','type','key','model','filters','intersection','attributes','fields','length','query','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','keys','include','options','find','create','body','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack'];(function(_0x5bf019,_0x375a83){var _0x42497e=function(_0x189e66){while(--_0x189e66){_0x5bf019['push'](_0x5bf019['shift']());}};_0x42497e(++_0x375a83);}(_0x92cd,0x147));var _0xd92c=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x92cd[_0x3070dc];return _0x431489;};'use strict';var emlformat=require(_0xd92c('0x0'));var rimraf=require(_0xd92c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd92c('0x2'));var rp=require('request-promise');var moment=require(_0xd92c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd92c('0x4'));var util=require(_0xd92c('0x5'));var path=require(_0xd92c('0x6'));var sox=require('sox');var csv=require(_0xd92c('0x7'));var ejs=require(_0xd92c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd92c('0x9'));var crypto=require(_0xd92c('0xa'));var jsforce=require(_0xd92c('0xb'));var deskjs=require(_0xd92c('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd92c('0xd'));var Papa=require(_0xd92c('0xe'));var Redis=require(_0xd92c('0xf'));var authService=require(_0xd92c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd92c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd92c('0x12'))(_0xd92c('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd92c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x100663,_0x50629e){_0x50629e=_0x50629e||0xcc;return function(_0x17b668){if(_0x17b668){return _0x100663['sendStatus'](_0x50629e);}return _0x100663['status'](_0x50629e)[_0xd92c('0x15')]();};}function respondWithResult(_0x2be2c2,_0x18af0f){_0x18af0f=_0x18af0f||0xc8;return function(_0x4f3499){if(_0x4f3499){return _0x2be2c2['status'](_0x18af0f)[_0xd92c('0x16')](_0x4f3499);}};}function respondWithFilteredResult(_0x1d6a62,_0x58a309){return function(_0x138a4a){if(_0x138a4a){var _0x1f9564=_0x138a4a[_0xd92c('0x17')],_0x36324a=_0x58a309[_0xd92c('0x18')],_0x295b2b=_0x58a309['offset']+_0x58a309[_0xd92c('0x19')],_0xc639fd;if(_0x295b2b>=_0x1f9564){_0x295b2b=_0x1f9564;_0xc639fd=0xc8;}else{_0xc639fd=0xce;}_0x1d6a62[_0xd92c('0x1a')](_0xc639fd);return _0x1d6a62[_0xd92c('0x1b')](_0xd92c('0x1c'),_0x36324a+'-'+_0x295b2b+'/'+_0x1f9564)['json'](_0x138a4a);}return null;};}function patchUpdates(_0x1bf7d4){return function(_0xfbf48e){try{jsonpatch[_0xd92c('0x1d')](_0xfbf48e,_0x1bf7d4,!![]);}catch(_0x593e63){return BPromise[_0xd92c('0x1e')](_0x593e63);}return _0xfbf48e[_0xd92c('0x1f')]();};}function saveUpdates(_0xf9cd13,_0x28c0a2){return function(_0x9d1ce1){if(_0x9d1ce1){return _0x9d1ce1[_0xd92c('0x20')](_0xf9cd13)[_0xd92c('0x21')](function(_0xffa553){return _0xffa553;});}return null;};}function removeEntity(_0x51121f,_0xb5ed14){return function(_0xb7b739){if(_0xb7b739){return _0xb7b739[_0xd92c('0x22')]()['then'](function(){_0x51121f[_0xd92c('0x1a')](0xcc)[_0xd92c('0x15')]();});}};}function handleEntityNotFound(_0x38b14a,_0x156cd6){return function(_0x25cd06){if(!_0x25cd06){_0x38b14a[_0xd92c('0x23')](0x194);}return _0x25cd06;};}function handleError(_0xeb7f8,_0x52fc80){_0x52fc80=_0x52fc80||0x1f4;return function(_0xb6a36b){logger[_0xd92c('0x24')](_0xb6a36b[_0xd92c('0x25')]);if(_0xb6a36b[_0xd92c('0x26')]){delete _0xb6a36b['name'];}_0xeb7f8['status'](_0x52fc80)['send'](_0xb6a36b);};}exports[_0xd92c('0x27')]=function(_0x264e1a,_0x1e7239){var _0x17d9f9={},_0x3b47c4={},_0x332729={'count':0x0,'rows':[]};var _0x4a7c01=_['map'](db[_0xd92c('0x28')][_0xd92c('0x29')],function(_0x5a1210){return{'name':_0x5a1210[_0xd92c('0x2a')],'type':_0x5a1210[_0xd92c('0x2b')][_0xd92c('0x2c')]};});_0x3b47c4[_0xd92c('0x2d')]=_['map'](_0x4a7c01,_0xd92c('0x26'));_0x3b47c4['query']=_['keys'](_0x264e1a['query']);_0x3b47c4[_0xd92c('0x2e')]=_[_0xd92c('0x2f')](_0x3b47c4[_0xd92c('0x2d')],_0x3b47c4['query']);_0x17d9f9[_0xd92c('0x30')]=_[_0xd92c('0x2f')](_0x3b47c4[_0xd92c('0x2d')],qs['fields'](_0x264e1a['query'][_0xd92c('0x31')]));_0x17d9f9['attributes']=_0x17d9f9[_0xd92c('0x30')][_0xd92c('0x32')]?_0x17d9f9[_0xd92c('0x30')]:_0x3b47c4[_0xd92c('0x2d')];if(!_0x264e1a[_0xd92c('0x33')]['hasOwnProperty'](_0xd92c('0x34'))){_0x17d9f9[_0xd92c('0x19')]=qs[_0xd92c('0x19')](_0x264e1a[_0xd92c('0x33')][_0xd92c('0x19')]);_0x17d9f9[_0xd92c('0x18')]=qs[_0xd92c('0x18')](_0x264e1a[_0xd92c('0x33')]['offset']);}_0x17d9f9[_0xd92c('0x35')]=qs[_0xd92c('0x36')](_0x264e1a[_0xd92c('0x33')][_0xd92c('0x36')]);_0x17d9f9[_0xd92c('0x37')]=qs[_0xd92c('0x2e')](_[_0xd92c('0x38')](_0x264e1a[_0xd92c('0x33')],_0x3b47c4[_0xd92c('0x2e')]),_0x4a7c01);if(_0x264e1a[_0xd92c('0x33')][_0xd92c('0x39')]){_0x17d9f9['where']=_['merge'](_0x17d9f9['where'],{'$or':_[_0xd92c('0x3a')](_0x4a7c01,function(_0x5bce8e){if(_0x5bce8e[_0xd92c('0x2b')]!==_0xd92c('0x3b')){var _0x453990={};_0x453990[_0x5bce8e['name']]={'$like':'%'+_0x264e1a[_0xd92c('0x33')][_0xd92c('0x39')]+'%'};return _0x453990;}})});}_0x17d9f9=_[_0xd92c('0x3c')]({},_0x17d9f9,_0x264e1a['options']);var _0xd0ab2b={'where':_0x17d9f9[_0xd92c('0x37')]};return db['VtigerField'][_0xd92c('0x17')](_0xd0ab2b)['then'](function(_0x511e00){_0x332729[_0xd92c('0x17')]=_0x511e00;if(_0x264e1a[_0xd92c('0x33')][_0xd92c('0x3d')]){_0x17d9f9['include']=[{'all':!![]}];}return db[_0xd92c('0x28')][_0xd92c('0x3e')](_0x17d9f9);})[_0xd92c('0x21')](function(_0x53fda8){_0x332729[_0xd92c('0x3f')]=_0x53fda8;return _0x332729;})[_0xd92c('0x21')](respondWithFilteredResult(_0x1e7239,_0x17d9f9))[_0xd92c('0x40')](handleError(_0x1e7239,null));};exports[_0xd92c('0x41')]=function(_0x44f07f,_0x40dbef){var _0x4c821b={'raw':!![],'where':{'id':_0x44f07f[_0xd92c('0x42')]['id']}},_0x129567={};_0x129567[_0xd92c('0x2d')]=_[_0xd92c('0x43')](db[_0xd92c('0x28')][_0xd92c('0x29')]);_0x129567[_0xd92c('0x33')]=_[_0xd92c('0x43')](_0x44f07f[_0xd92c('0x33')]);_0x129567[_0xd92c('0x2e')]=_[_0xd92c('0x2f')](_0x129567['model'],_0x129567['query']);_0x4c821b[_0xd92c('0x30')]=_[_0xd92c('0x2f')](_0x129567[_0xd92c('0x2d')],qs[_0xd92c('0x31')](_0x44f07f['query'][_0xd92c('0x31')]));_0x4c821b['attributes']=_0x4c821b[_0xd92c('0x30')]['length']?_0x4c821b[_0xd92c('0x30')]:_0x129567['model'];if(_0x44f07f['query'][_0xd92c('0x3d')]){_0x4c821b[_0xd92c('0x44')]=[{'all':!![]}];}_0x4c821b=_[_0xd92c('0x3c')]({},_0x4c821b,_0x44f07f[_0xd92c('0x45')]);return db[_0xd92c('0x28')][_0xd92c('0x46')](_0x4c821b)['then'](handleEntityNotFound(_0x40dbef,null))[_0xd92c('0x21')](respondWithResult(_0x40dbef,null))['catch'](handleError(_0x40dbef,null));};exports[_0xd92c('0x47')]=function(_0x44347d,_0x1b923f){return db[_0xd92c('0x28')][_0xd92c('0x47')](_0x44347d[_0xd92c('0x48')],{})['then'](respondWithResult(_0x1b923f,0xc9))[_0xd92c('0x40')](handleError(_0x1b923f,null));};exports['update']=function(_0x395553,_0x136960){if(_0x395553[_0xd92c('0x48')]['id']){delete _0x395553[_0xd92c('0x48')]['id'];}return db[_0xd92c('0x28')][_0xd92c('0x46')]({'where':{'id':_0x395553[_0xd92c('0x42')]['id']}})[_0xd92c('0x21')](handleEntityNotFound(_0x136960,null))[_0xd92c('0x21')](saveUpdates(_0x395553[_0xd92c('0x48')],null))[_0xd92c('0x21')](respondWithResult(_0x136960,null))[_0xd92c('0x40')](handleError(_0x136960,null));};exports[_0xd92c('0x22')]=function(_0x35c26b,_0xa04562){return db[_0xd92c('0x28')][_0xd92c('0x46')]({'where':{'id':_0x35c26b['params']['id']}})[_0xd92c('0x21')](handleEntityNotFound(_0xa04562,null))[_0xd92c('0x21')](removeEntity(_0xa04562,null))[_0xd92c('0x40')](handleError(_0xa04562,null));}; \ No newline at end of file +var _0x2d11=['fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','reject','save','then','error','stack','name','send','map','VtigerField','rawAttributes','type','key','model','query','keys','intersection','attributes'];(function(_0x356312,_0x4e93b7){var _0x1b1055=function(_0x224f96){while(--_0x224f96){_0x356312['push'](_0x356312['shift']());}};_0x1b1055(++_0x4e93b7);}(_0x2d11,0x183));var _0x12d1=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x2d11[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0x12d1('0x0'));var rimraf=require(_0x12d1('0x1'));var zipdir=require(_0x12d1('0x2'));var jsonpatch=require(_0x12d1('0x3'));var rp=require(_0x12d1('0x4'));var moment=require(_0x12d1('0x5'));var BPromise=require(_0x12d1('0x6'));var Mustache=require(_0x12d1('0x7'));var util=require(_0x12d1('0x8'));var path=require(_0x12d1('0x9'));var sox=require(_0x12d1('0xa'));var csv=require('to-csv');var ejs=require(_0x12d1('0xb'));var fs=require('fs');var fs_extra=require(_0x12d1('0xc'));var _=require(_0x12d1('0xd'));var squel=require(_0x12d1('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x12d1('0xf'));var toCsv=require(_0x12d1('0x10'));var querystring=require('querystring');var Papa=require(_0x12d1('0x11'));var Redis=require(_0x12d1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x12d1('0x13'));var as=require(_0x12d1('0x14'));var hardwareService=require(_0x12d1('0x15'));var logger=require('../../config/logger')(_0x12d1('0x16'));var utils=require(_0x12d1('0x17'));var config=require(_0x12d1('0x18'));var licenseUtil=require(_0x12d1('0x19'));var db=require(_0x12d1('0x1a'))['db'];function respondWithStatusCode(_0x2c8c67,_0x2853c7){_0x2853c7=_0x2853c7||0xcc;return function(_0x4a79f9){if(_0x4a79f9){return _0x2c8c67[_0x12d1('0x1b')](_0x2853c7);}return _0x2c8c67[_0x12d1('0x1c')](_0x2853c7)['end']();};}function respondWithResult(_0x212741,_0x4e1bab){_0x4e1bab=_0x4e1bab||0xc8;return function(_0x3aaf60){if(_0x3aaf60){return _0x212741[_0x12d1('0x1c')](_0x4e1bab)[_0x12d1('0x1d')](_0x3aaf60);}};}function respondWithFilteredResult(_0xc5a963,_0x346bd0){return function(_0x47dc1f){if(_0x47dc1f){var _0x2ecb4d=_0x47dc1f[_0x12d1('0x1e')],_0x38899c=_0x346bd0['offset'],_0x2c9593=_0x346bd0['offset']+_0x346bd0[_0x12d1('0x1f')],_0x4187c0;if(_0x2c9593>=_0x2ecb4d){_0x2c9593=_0x2ecb4d;_0x4187c0=0xc8;}else{_0x4187c0=0xce;}_0xc5a963[_0x12d1('0x1c')](_0x4187c0);return _0xc5a963[_0x12d1('0x20')](_0x12d1('0x21'),_0x38899c+'-'+_0x2c9593+'/'+_0x2ecb4d)[_0x12d1('0x1d')](_0x47dc1f);}return null;};}function patchUpdates(_0x4ae2a4){return function(_0x369509){try{jsonpatch['apply'](_0x369509,_0x4ae2a4,!![]);}catch(_0x291f56){return BPromise[_0x12d1('0x22')](_0x291f56);}return _0x369509[_0x12d1('0x23')]();};}function saveUpdates(_0x38629f,_0x26ffb2){return function(_0x4ec4c0){if(_0x4ec4c0){return _0x4ec4c0['update'](_0x38629f)[_0x12d1('0x24')](function(_0x5a00fa){return _0x5a00fa;});}return null;};}function removeEntity(_0x42f4dc,_0x1b4deb){return function(_0x1b1321){if(_0x1b1321){return _0x1b1321['destroy']()[_0x12d1('0x24')](function(){_0x42f4dc[_0x12d1('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33b803,_0x216720){return function(_0x4a5e67){if(!_0x4a5e67){_0x33b803[_0x12d1('0x1b')](0x194);}return _0x4a5e67;};}function handleError(_0xb1d1be,_0x1c6c7c){_0x1c6c7c=_0x1c6c7c||0x1f4;return function(_0x28166e){logger[_0x12d1('0x25')](_0x28166e[_0x12d1('0x26')]);if(_0x28166e['name']){delete _0x28166e[_0x12d1('0x27')];}_0xb1d1be[_0x12d1('0x1c')](_0x1c6c7c)[_0x12d1('0x28')](_0x28166e);};}exports['index']=function(_0x15a05c,_0x17d8c6){var _0xd0a7b8={},_0x298d7e={},_0xce0d94={'count':0x0,'rows':[]};var _0x5b7bcd=_[_0x12d1('0x29')](db[_0x12d1('0x2a')][_0x12d1('0x2b')],function(_0x5ee70a){return{'name':_0x5ee70a['fieldName'],'type':_0x5ee70a[_0x12d1('0x2c')][_0x12d1('0x2d')]};});_0x298d7e[_0x12d1('0x2e')]=_['map'](_0x5b7bcd,_0x12d1('0x27'));_0x298d7e[_0x12d1('0x2f')]=_[_0x12d1('0x30')](_0x15a05c[_0x12d1('0x2f')]);_0x298d7e['filters']=_[_0x12d1('0x31')](_0x298d7e[_0x12d1('0x2e')],_0x298d7e[_0x12d1('0x2f')]);_0xd0a7b8[_0x12d1('0x32')]=_[_0x12d1('0x31')](_0x298d7e[_0x12d1('0x2e')],qs[_0x12d1('0x33')](_0x15a05c[_0x12d1('0x2f')][_0x12d1('0x33')]));_0xd0a7b8[_0x12d1('0x32')]=_0xd0a7b8['attributes']['length']?_0xd0a7b8['attributes']:_0x298d7e['model'];if(!_0x15a05c[_0x12d1('0x2f')][_0x12d1('0x34')](_0x12d1('0x35'))){_0xd0a7b8[_0x12d1('0x1f')]=qs[_0x12d1('0x1f')](_0x15a05c['query']['limit']);_0xd0a7b8[_0x12d1('0x36')]=qs[_0x12d1('0x36')](_0x15a05c['query'][_0x12d1('0x36')]);}_0xd0a7b8[_0x12d1('0x37')]=qs[_0x12d1('0x38')](_0x15a05c[_0x12d1('0x2f')][_0x12d1('0x38')]);_0xd0a7b8[_0x12d1('0x39')]=qs['filters'](_[_0x12d1('0x3a')](_0x15a05c[_0x12d1('0x2f')],_0x298d7e[_0x12d1('0x3b')]),_0x5b7bcd);if(_0x15a05c[_0x12d1('0x2f')][_0x12d1('0x3c')]){_0xd0a7b8['where']=_[_0x12d1('0x3d')](_0xd0a7b8['where'],{'$or':_[_0x12d1('0x29')](_0x5b7bcd,function(_0x313f8c){if(_0x313f8c[_0x12d1('0x2c')]!==_0x12d1('0x3e')){var _0x4b3197={};_0x4b3197[_0x313f8c[_0x12d1('0x27')]]={'$like':'%'+_0x15a05c[_0x12d1('0x2f')]['filter']+'%'};return _0x4b3197;}})});}_0xd0a7b8=_['merge']({},_0xd0a7b8,_0x15a05c[_0x12d1('0x3f')]);var _0x149acd={'where':_0xd0a7b8[_0x12d1('0x39')]};return db['VtigerField'][_0x12d1('0x1e')](_0x149acd)[_0x12d1('0x24')](function(_0x5beaa0){_0xce0d94[_0x12d1('0x1e')]=_0x5beaa0;if(_0x15a05c[_0x12d1('0x2f')][_0x12d1('0x40')]){_0xd0a7b8[_0x12d1('0x41')]=[{'all':!![]}];}return db[_0x12d1('0x2a')]['findAll'](_0xd0a7b8);})[_0x12d1('0x24')](function(_0x4cfd01){_0xce0d94[_0x12d1('0x42')]=_0x4cfd01;return _0xce0d94;})[_0x12d1('0x24')](respondWithFilteredResult(_0x17d8c6,_0xd0a7b8))[_0x12d1('0x43')](handleError(_0x17d8c6,null));};exports[_0x12d1('0x44')]=function(_0x565364,_0x1c7c6d){var _0x2c1155={'raw':!![],'where':{'id':_0x565364[_0x12d1('0x45')]['id']}},_0x20ffa1={};_0x20ffa1[_0x12d1('0x2e')]=_[_0x12d1('0x30')](db['VtigerField'][_0x12d1('0x2b')]);_0x20ffa1[_0x12d1('0x2f')]=_[_0x12d1('0x30')](_0x565364[_0x12d1('0x2f')]);_0x20ffa1[_0x12d1('0x3b')]=_['intersection'](_0x20ffa1[_0x12d1('0x2e')],_0x20ffa1[_0x12d1('0x2f')]);_0x2c1155[_0x12d1('0x32')]=_[_0x12d1('0x31')](_0x20ffa1[_0x12d1('0x2e')],qs['fields'](_0x565364[_0x12d1('0x2f')][_0x12d1('0x33')]));_0x2c1155[_0x12d1('0x32')]=_0x2c1155[_0x12d1('0x32')]['length']?_0x2c1155[_0x12d1('0x32')]:_0x20ffa1['model'];if(_0x565364['query'][_0x12d1('0x40')]){_0x2c1155[_0x12d1('0x41')]=[{'all':!![]}];}_0x2c1155=_['merge']({},_0x2c1155,_0x565364['options']);return db[_0x12d1('0x2a')][_0x12d1('0x46')](_0x2c1155)[_0x12d1('0x24')](handleEntityNotFound(_0x1c7c6d,null))[_0x12d1('0x24')](respondWithResult(_0x1c7c6d,null))[_0x12d1('0x43')](handleError(_0x1c7c6d,null));};exports['create']=function(_0x3bab51,_0x3f3d2f){return db['VtigerField']['create'](_0x3bab51[_0x12d1('0x47')],{})[_0x12d1('0x24')](respondWithResult(_0x3f3d2f,0xc9))['catch'](handleError(_0x3f3d2f,null));};exports[_0x12d1('0x48')]=function(_0x24ccc3,_0x5d584b){if(_0x24ccc3[_0x12d1('0x47')]['id']){delete _0x24ccc3[_0x12d1('0x47')]['id'];}return db[_0x12d1('0x2a')][_0x12d1('0x46')]({'where':{'id':_0x24ccc3[_0x12d1('0x45')]['id']}})['then'](handleEntityNotFound(_0x5d584b,null))[_0x12d1('0x24')](saveUpdates(_0x24ccc3[_0x12d1('0x47')],null))[_0x12d1('0x24')](respondWithResult(_0x5d584b,null))['catch'](handleError(_0x5d584b,null));};exports['destroy']=function(_0x3d2f2a,_0x4740d4){return db[_0x12d1('0x2a')][_0x12d1('0x46')]({'where':{'id':_0x3d2f2a[_0x12d1('0x45')]['id']}})[_0x12d1('0x24')](handleEntityNotFound(_0x4740d4,null))[_0x12d1('0x24')](removeEntity(_0x4740d4,null))[_0x12d1('0x43')](handleError(_0x4740d4,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index f8cff58..49fb034 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(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 3defebb..fd8e5b5 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 _0x505d=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','VtigerField,\x20%s,\x20%s','catch','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4c9cc4,_0x1b6528){var _0x4384fb=function(_0x512d47){while(--_0x512d47){_0x4c9cc4['push'](_0x4c9cc4['shift']());}};_0x4384fb(++_0x1b6528);}(_0x505d,0x93));var _0xd505=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x505d[_0x37bd26];return _0xe83dc4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd505('0x0'));var BPromise=require(_0xd505('0x1'));var rs=require(_0xd505('0x2'));var fs=require('fs');var Redis=require(_0xd505('0x3'));var db=require(_0xd505('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd505('0x5'))(_0xd505('0x6'));var config=require(_0xd505('0x7'));var jayson=require(_0xd505('0x8'));var client=jayson['client'][_0xd505('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d4f8d,_0x2bc4e7,_0x162ee2){return new BPromise(function(_0x543c42,_0x2abf26){return client[_0xd505('0xa')](_0x5d4f8d,_0x162ee2)['then'](function(_0x47b37a){logger[_0xd505('0xb')]('VtigerField,\x20%s,\x20%s',_0x2bc4e7,_0xd505('0xc'));logger['debug'](_0xd505('0xd'),_0x2bc4e7,'request\x20sent',JSON[_0xd505('0xe')](_0x47b37a));if(_0x47b37a['error']){if(_0x47b37a['error']['code']===0x1f4){logger[_0xd505('0xf')]('VtigerField,\x20%s,\x20%s',_0x2bc4e7,_0x47b37a[_0xd505('0xf')][_0xd505('0x10')]);return _0x2abf26(_0x47b37a['error']['message']);}logger[_0xd505('0xf')](_0xd505('0x11'),_0x2bc4e7,_0x47b37a[_0xd505('0xf')][_0xd505('0x10')]);return _0x543c42(_0x47b37a[_0xd505('0xf')][_0xd505('0x10')]);}else{logger[_0xd505('0xb')](_0xd505('0x11'),_0x2bc4e7,_0xd505('0xc'));_0x543c42(_0x47b37a['result'][_0xd505('0x10')]);}})[_0xd505('0x12')](function(_0x8013f2){logger['error'](_0xd505('0x11'),_0x2bc4e7,_0x8013f2);_0x2abf26(_0x8013f2);});});} \ No newline at end of file +var _0xf767=['../../config/environment','jayson/promise','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis'];(function(_0x262323,_0x4a81f1){var _0xa963c3=function(_0x5c715e){while(--_0x5c715e){_0x262323['push'](_0x262323['shift']());}};_0xa963c3(++_0x4a81f1);}(_0xf767,0x183));var _0x7f76=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0xf767[_0x541ea6];return _0x3c3e84;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7f76('0x0'));var BPromise=require(_0x7f76('0x1'));var rs=require(_0x7f76('0x2'));var fs=require('fs');var Redis=require(_0x7f76('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7f76('0x4'));var jayson=require(_0x7f76('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x23629f,_0x370b0a,_0x5ced68){return new BPromise(function(_0x4060f6,_0x7561e0){return client['request'](_0x23629f,_0x5ced68)[_0x7f76('0x6')](function(_0x3e79ad){logger[_0x7f76('0x7')](_0x7f76('0x8'),_0x370b0a,_0x7f76('0x9'));logger[_0x7f76('0xa')](_0x7f76('0xb'),_0x370b0a,_0x7f76('0x9'),JSON[_0x7f76('0xc')](_0x3e79ad));if(_0x3e79ad['error']){if(_0x3e79ad[_0x7f76('0xd')][_0x7f76('0xe')]===0x1f4){logger[_0x7f76('0xd')](_0x7f76('0x8'),_0x370b0a,_0x3e79ad[_0x7f76('0xd')][_0x7f76('0xf')]);return _0x7561e0(_0x3e79ad[_0x7f76('0xd')][_0x7f76('0xf')]);}logger[_0x7f76('0xd')]('VtigerField,\x20%s,\x20%s',_0x370b0a,_0x3e79ad[_0x7f76('0xd')][_0x7f76('0xf')]);return _0x4060f6(_0x3e79ad[_0x7f76('0xd')][_0x7f76('0xf')]);}else{logger['info'](_0x7f76('0x8'),_0x370b0a,_0x7f76('0x9'));_0x4060f6(_0x3e79ad[_0x7f76('0x10')]['message']);}})['catch'](function(_0x1eea7e){logger['error'](_0x7f76('0x8'),_0x370b0a,_0x1eea7e);_0x7561e0(_0x1eea7e);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 18660bf..42f9f46 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 _0x12e9=['delete','destroy','path','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update'];(function(_0x4712fd,_0x22d986){var _0x5c655a=function(_0x1f944c){while(--_0x1f944c){_0x4712fd['push'](_0x4712fd['shift']());}};_0x5c655a(++_0x22d986);}(_0x12e9,0x66));var _0x912e=function(_0x5d8370,_0x4c3690){_0x5d8370=_0x5d8370-0x0;var _0x558762=_0x12e9[_0x5d8370];return _0x558762;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x912e('0x0'));var timeout=require('connect-timeout');var express=require(_0x912e('0x1'));var router=express[_0x912e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x912e('0x3'));var interaction=require(_0x912e('0x4'));var config=require('../../config/environment');var controller=require(_0x912e('0x5'));router[_0x912e('0x6')]('/',auth[_0x912e('0x7')](),controller[_0x912e('0x8')]);router['get'](_0x912e('0x9'),auth[_0x912e('0x7')](),controller[_0x912e('0xa')]);router[_0x912e('0x6')](_0x912e('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x912e('0xc'),auth[_0x912e('0x7')](),controller[_0x912e('0xd')]);router[_0x912e('0xe')]('/',auth[_0x912e('0x7')](),controller['create']);router[_0x912e('0xe')](_0x912e('0xb'),auth[_0x912e('0x7')](),controller[_0x912e('0xf')]);router[_0x912e('0x10')](_0x912e('0x9'),auth[_0x912e('0x7')](),controller[_0x912e('0x11')]);router[_0x912e('0x12')](_0x912e('0x9'),auth[_0x912e('0x7')](),controller[_0x912e('0x13')]);module['exports']=router; \ No newline at end of file +var _0xfc9b=['express','Router','fs-extra','../../components/interaction/service','./intZendeskAccount.controller','get','index','/:id','isAuthenticated','getFields','post','create','addConfiguration','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x3b0515,_0x1fa41d){var _0x198d7a=function(_0x17b712){while(--_0x17b712){_0x3b0515['push'](_0x3b0515['shift']());}};_0x198d7a(++_0x1fa41d);}(_0xfc9b,0x74));var _0xbfc9=function(_0x19921d,_0xd10ebe){_0x19921d=_0x19921d-0x0;var _0x158b3a=_0xfc9b[_0x19921d];return _0x158b3a;};'use strict';var multer=require(_0xbfc9('0x0'));var util=require(_0xbfc9('0x1'));var path=require(_0xbfc9('0x2'));var timeout=require(_0xbfc9('0x3'));var express=require(_0xbfc9('0x4'));var router=express[_0xbfc9('0x5')]();var fs_extra=require(_0xbfc9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xbfc9('0x7'));var config=require('../../config/environment');var controller=require(_0xbfc9('0x8'));router[_0xbfc9('0x9')]('/',auth['isAuthenticated'](),controller[_0xbfc9('0xa')]);router[_0xbfc9('0x9')](_0xbfc9('0xb'),auth[_0xbfc9('0xc')](),controller['show']);router[_0xbfc9('0x9')]('/:id/configurations',auth[_0xbfc9('0xc')](),controller['getConfigurations']);router[_0xbfc9('0x9')]('/:id/fields',auth[_0xbfc9('0xc')](),controller[_0xbfc9('0xd')]);router[_0xbfc9('0xe')]('/',auth[_0xbfc9('0xc')](),controller[_0xbfc9('0xf')]);router[_0xbfc9('0xe')]('/:id/configurations',auth[_0xbfc9('0xc')](),controller[_0xbfc9('0x10')]);router['put'](_0xbfc9('0xb'),auth['isAuthenticated'](),controller[_0xbfc9('0x11')]);router[_0xbfc9('0x12')](_0xbfc9('0xb'),auth[_0xbfc9('0xc')](),controller['destroy']);module[_0xbfc9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 44fbf92..9ad1ea9 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 _0x39c5=['ENUM','password','integrationTab','sequelize','exports','STRING'];(function(_0x5bc5fe,_0x2afaef){var _0x298ea7=function(_0x1c6bd5){while(--_0x1c6bd5){_0x5bc5fe['push'](_0x5bc5fe['shift']());}};_0x298ea7(++_0x2afaef);}(_0x39c5,0x1c5));var _0x539c=function(_0x40d13b,_0x18740c){_0x40d13b=_0x40d13b-0x0;var _0x190bf1=_0x39c5[_0x40d13b];return _0x190bf1;};'use strict';var Sequelize=require(_0x539c('0x0'));module[_0x539c('0x1')]={'name':{'type':Sequelize[_0x539c('0x2')]},'description':{'type':Sequelize[_0x539c('0x2')]},'username':{'type':Sequelize[_0x539c('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x539c('0x2')]},'token':{'type':Sequelize[_0x539c('0x2')]},'remoteUri':{'type':Sequelize[_0x539c('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x539c('0x3')](_0x539c('0x4'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x539c('0x5'),'newTab'),'defaultValue':_0x539c('0x5')}}; \ No newline at end of file +var _0x66a9=['STRING','remoteUri','ENUM','password','token','integrationTab','newTab','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x66a9,0x1cf));var _0x966a=function(_0x271c7b,_0x2e717d){_0x271c7b=_0x271c7b-0x0;var _0x5da025=_0x66a9[_0x271c7b];return _0x5da025;};'use strict';var Sequelize=require(_0x966a('0x0'));module['exports']={'name':{'type':Sequelize[_0x966a('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x966a('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x966a('0x1')]},'token':{'type':Sequelize[_0x966a('0x1')]},'remoteUri':{'type':Sequelize[_0x966a('0x1')],'unique':_0x966a('0x2')},'authType':{'type':Sequelize[_0x966a('0x3')](_0x966a('0x4'),_0x966a('0x5')),'defaultValue':_0x966a('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x966a('0x3')](_0x966a('0x6'),_0x966a('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index bf0bcb5..0e5f915 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 _0x0f9f=['nolimit','pick','filter','where','merge','VIRTUAL','includeAll','include','ZendeskAccount','findAll','show','params','rawAttributes','options','find','catch','create','body','update','destroy','getConfigurations','findOne','ZendeskConfiguration','length','order','sort','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','GET','format','ticket_fields','Basic\x20%s','%s:%s','toString','base64','headers','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','remove','includes','position','title','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','message','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','stack','name','send','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty'];(function(_0x3b0966,_0x3fc4ca){var _0x18e6b0=function(_0x535058){while(--_0x535058){_0x3b0966['push'](_0x3b0966['shift']());}};_0x18e6b0(++_0x3fc4ca);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x35b07e,_0x4c5a33){_0x35b07e=_0x35b07e-0x0;var _0xcb745e=_0x0f9f[_0x35b07e];return _0xcb745e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf0f9('0x0'));var zipdir=require(_0xf0f9('0x1'));var jsonpatch=require(_0xf0f9('0x2'));var rp=require('request-promise');var moment=require(_0xf0f9('0x3'));var BPromise=require(_0xf0f9('0x4'));var Mustache=require(_0xf0f9('0x5'));var util=require(_0xf0f9('0x6'));var path=require(_0xf0f9('0x7'));var sox=require(_0xf0f9('0x8'));var csv=require(_0xf0f9('0x9'));var ejs=require(_0xf0f9('0xa'));var fs=require('fs');var fs_extra=require(_0xf0f9('0xb'));var _=require(_0xf0f9('0xc'));var squel=require('squel');var crypto=require(_0xf0f9('0xd'));var jsforce=require(_0xf0f9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf0f9('0x9'));var querystring=require(_0xf0f9('0xf'));var Papa=require(_0xf0f9('0x10'));var Redis=require('ioredis');var authService=require(_0xf0f9('0x11'));var qs=require(_0xf0f9('0x12'));var as=require(_0xf0f9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf0f9('0x14'));var utils=require(_0xf0f9('0x15'));var config=require(_0xf0f9('0x16'));var licenseUtil=require(_0xf0f9('0x17'));var db=require(_0xf0f9('0x18'))['db'];var integrations=require(_0xf0f9('0x19'));var jayson=require(_0xf0f9('0x1a'));var client=jayson['client'][_0xf0f9('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x297fe1,_0x30bdaa,_0x200514,_0x524169){return new BPromise(function(_0x51d78a,_0x459c76){var _0x35aa5d=_0x524169||client;return _0x35aa5d[_0xf0f9('0x1c')](_0x297fe1,_0x200514)[_0xf0f9('0x1d')](function(_0x2b05e3){logger[_0xf0f9('0x1e')](_0xf0f9('0x1f'),_0x30bdaa,_0xf0f9('0x20'));logger[_0xf0f9('0x21')](_0xf0f9('0x22'),_0x30bdaa,'request\x20sent',JSON['stringify'](_0x2b05e3));if(_0x2b05e3[_0xf0f9('0x23')]){if(_0x2b05e3[_0xf0f9('0x23')]['code']===0x1f4){logger[_0xf0f9('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0x30bdaa,_0x2b05e3['error'][_0xf0f9('0x24')]);return _0x459c76(_0x2b05e3[_0xf0f9('0x23')][_0xf0f9('0x24')]);}logger[_0xf0f9('0x23')](_0xf0f9('0x1f'),_0x30bdaa,_0x2b05e3['error']['message']);return _0x51d78a(_0x2b05e3['error'][_0xf0f9('0x24')]);}else{logger[_0xf0f9('0x1e')](_0xf0f9('0x1f'),_0x30bdaa,'request\x20sent');_0x51d78a(_0x2b05e3['result'][_0xf0f9('0x24')]);}})['catch'](function(_0x2195ee){logger[_0xf0f9('0x23')](_0xf0f9('0x1f'),_0x30bdaa,_0x2195ee);_0x459c76(_0x2195ee);});});}function respondWithStatusCode(_0x570c68,_0x33dfca){_0x33dfca=_0x33dfca||0xcc;return function(_0x1061ca){if(_0x1061ca){return _0x570c68[_0xf0f9('0x25')](_0x33dfca);}return _0x570c68['status'](_0x33dfca)[_0xf0f9('0x26')]();};}function respondWithResult(_0x33f070,_0x2879a2){_0x2879a2=_0x2879a2||0xc8;return function(_0x185e1e){if(_0x185e1e){return _0x33f070[_0xf0f9('0x27')](_0x2879a2)[_0xf0f9('0x28')](_0x185e1e);}};}function respondWithFilteredResult(_0x5df7f5,_0x28e1f6){return function(_0x56663e){if(_0x56663e){var _0x1288e0=_0x56663e[_0xf0f9('0x29')],_0x30e85c=_0x28e1f6['offset'],_0x519a46=_0x28e1f6[_0xf0f9('0x2a')]+_0x28e1f6[_0xf0f9('0x2b')],_0x4b75b2;if(_0x519a46>=_0x1288e0){_0x519a46=_0x1288e0;_0x4b75b2=0xc8;}else{_0x4b75b2=0xce;}_0x5df7f5[_0xf0f9('0x27')](_0x4b75b2);return _0x5df7f5[_0xf0f9('0x2c')](_0xf0f9('0x2d'),_0x30e85c+'-'+_0x519a46+'/'+_0x1288e0)[_0xf0f9('0x28')](_0x56663e);}return null;};}function patchUpdates(_0x1377ed){return function(_0x201247){try{jsonpatch[_0xf0f9('0x2e')](_0x201247,_0x1377ed,!![]);}catch(_0x4e4e08){return BPromise[_0xf0f9('0x2f')](_0x4e4e08);}return _0x201247[_0xf0f9('0x30')]();};}function saveUpdates(_0x534083,_0x48ef2a){return function(_0x49ce78){if(_0x49ce78){return _0x49ce78['update'](_0x534083)['then'](function(_0x14f3cb){return _0x14f3cb;});}return null;};}function removeEntity(_0x490e91,_0x31b6c4){return function(_0xf9b6a8){if(_0xf9b6a8){return _0xf9b6a8['destroy']()['then'](function(){_0x490e91[_0xf0f9('0x27')](0xcc)[_0xf0f9('0x26')]();});}};}function handleEntityNotFound(_0x3393bd,_0x1773d2){return function(_0x278192){if(!_0x278192){_0x3393bd[_0xf0f9('0x25')](0x194);}return _0x278192;};}function handleError(_0x1b784a,_0x30bc8e){_0x30bc8e=_0x30bc8e||0x1f4;return function(_0x3c92f7){logger[_0xf0f9('0x23')](_0x3c92f7[_0xf0f9('0x31')]);if(_0x3c92f7[_0xf0f9('0x32')]){delete _0x3c92f7[_0xf0f9('0x32')];}_0x1b784a['status'](_0x30bc8e)[_0xf0f9('0x33')](_0x3c92f7);};}exports['index']=function(_0x3fe149,_0x44c9ed){var _0x5a4e2e={},_0x376a6b={},_0x2db7f0={'count':0x0,'rows':[]};var _0x5ac68b=_[_0xf0f9('0x34')](db['ZendeskAccount']['rawAttributes'],function(_0x1188e1){return{'name':_0x1188e1[_0xf0f9('0x35')],'type':_0x1188e1[_0xf0f9('0x36')][_0xf0f9('0x37')]};});_0x376a6b[_0xf0f9('0x38')]=_['map'](_0x5ac68b,_0xf0f9('0x32'));_0x376a6b[_0xf0f9('0x39')]=_[_0xf0f9('0x3a')](_0x3fe149[_0xf0f9('0x39')]);_0x376a6b[_0xf0f9('0x3b')]=_['intersection'](_0x376a6b[_0xf0f9('0x38')],_0x376a6b[_0xf0f9('0x39')]);_0x5a4e2e[_0xf0f9('0x3c')]=_[_0xf0f9('0x3d')](_0x376a6b[_0xf0f9('0x38')],qs[_0xf0f9('0x3e')](_0x3fe149['query'][_0xf0f9('0x3e')]));_0x5a4e2e[_0xf0f9('0x3c')]=_0x5a4e2e[_0xf0f9('0x3c')]['length']?_0x5a4e2e[_0xf0f9('0x3c')]:_0x376a6b[_0xf0f9('0x38')];if(!_0x3fe149[_0xf0f9('0x39')][_0xf0f9('0x3f')](_0xf0f9('0x40'))){_0x5a4e2e[_0xf0f9('0x2b')]=qs[_0xf0f9('0x2b')](_0x3fe149[_0xf0f9('0x39')][_0xf0f9('0x2b')]);_0x5a4e2e[_0xf0f9('0x2a')]=qs[_0xf0f9('0x2a')](_0x3fe149[_0xf0f9('0x39')][_0xf0f9('0x2a')]);}_0x5a4e2e['order']=qs['sort'](_0x3fe149[_0xf0f9('0x39')]['sort']);_0x5a4e2e['where']=qs['filters'](_[_0xf0f9('0x41')](_0x3fe149[_0xf0f9('0x39')],_0x376a6b[_0xf0f9('0x3b')]),_0x5ac68b);if(_0x3fe149[_0xf0f9('0x39')][_0xf0f9('0x42')]){_0x5a4e2e[_0xf0f9('0x43')]=_[_0xf0f9('0x44')](_0x5a4e2e[_0xf0f9('0x43')],{'$or':_[_0xf0f9('0x34')](_0x5ac68b,function(_0x5add81){if(_0x5add81[_0xf0f9('0x36')]!==_0xf0f9('0x45')){var _0x434fc1={};_0x434fc1[_0x5add81['name']]={'$like':'%'+_0x3fe149[_0xf0f9('0x39')][_0xf0f9('0x42')]+'%'};return _0x434fc1;}})});}_0x5a4e2e=_[_0xf0f9('0x44')]({},_0x5a4e2e,_0x3fe149['options']);var _0x9e387c={'where':_0x5a4e2e[_0xf0f9('0x43')]};return db['ZendeskAccount'][_0xf0f9('0x29')](_0x9e387c)[_0xf0f9('0x1d')](function(_0x1230e1){_0x2db7f0[_0xf0f9('0x29')]=_0x1230e1;if(_0x3fe149['query'][_0xf0f9('0x46')]){_0x5a4e2e[_0xf0f9('0x47')]=[{'all':!![]}];}return db[_0xf0f9('0x48')][_0xf0f9('0x49')](_0x5a4e2e);})[_0xf0f9('0x1d')](function(_0x26f088){_0x2db7f0['rows']=_0x26f088;return _0x2db7f0;})[_0xf0f9('0x1d')](respondWithFilteredResult(_0x44c9ed,_0x5a4e2e))['catch'](handleError(_0x44c9ed,null));};exports[_0xf0f9('0x4a')]=function(_0x38956b,_0x130fc8){var _0x314e0c={'raw':![],'where':{'id':_0x38956b[_0xf0f9('0x4b')]['id']}},_0x44b00d={};_0x44b00d[_0xf0f9('0x38')]=_[_0xf0f9('0x3a')](db[_0xf0f9('0x48')][_0xf0f9('0x4c')]);_0x44b00d[_0xf0f9('0x39')]=_[_0xf0f9('0x3a')](_0x38956b[_0xf0f9('0x39')]);_0x44b00d[_0xf0f9('0x3b')]=_[_0xf0f9('0x3d')](_0x44b00d[_0xf0f9('0x38')],_0x44b00d[_0xf0f9('0x39')]);_0x314e0c[_0xf0f9('0x3c')]=_[_0xf0f9('0x3d')](_0x44b00d[_0xf0f9('0x38')],qs[_0xf0f9('0x3e')](_0x38956b[_0xf0f9('0x39')][_0xf0f9('0x3e')]));_0x314e0c[_0xf0f9('0x3c')]=_0x314e0c['attributes']['length']?_0x314e0c[_0xf0f9('0x3c')]:_0x44b00d['model'];if(_0x38956b[_0xf0f9('0x39')][_0xf0f9('0x46')]){_0x314e0c[_0xf0f9('0x47')]=[{'all':!![]}];}_0x314e0c=_['merge']({},_0x314e0c,_0x38956b[_0xf0f9('0x4d')]);return db['ZendeskAccount'][_0xf0f9('0x4e')](_0x314e0c)[_0xf0f9('0x1d')](handleEntityNotFound(_0x130fc8,null))[_0xf0f9('0x1d')](respondWithResult(_0x130fc8,null))[_0xf0f9('0x4f')](handleError(_0x130fc8,null));};exports[_0xf0f9('0x50')]=function(_0x593b54,_0x422e72){return db['ZendeskAccount'][_0xf0f9('0x50')](_0x593b54[_0xf0f9('0x51')],{})[_0xf0f9('0x1d')](respondWithResult(_0x422e72,0xc9))[_0xf0f9('0x4f')](handleError(_0x422e72,null));};exports[_0xf0f9('0x52')]=function(_0x570f67,_0x4d1ab6){if(_0x570f67[_0xf0f9('0x51')]['id']){delete _0x570f67[_0xf0f9('0x51')]['id'];}return db[_0xf0f9('0x48')][_0xf0f9('0x4e')]({'where':{'id':_0x570f67[_0xf0f9('0x4b')]['id']}})[_0xf0f9('0x1d')](handleEntityNotFound(_0x4d1ab6,null))[_0xf0f9('0x1d')](saveUpdates(_0x570f67[_0xf0f9('0x51')],null))[_0xf0f9('0x1d')](respondWithResult(_0x4d1ab6,null))[_0xf0f9('0x4f')](handleError(_0x4d1ab6,null));};exports[_0xf0f9('0x53')]=function(_0x435861,_0x3a499d){return db['ZendeskAccount'][_0xf0f9('0x4e')]({'where':{'id':_0x435861[_0xf0f9('0x4b')]['id']}})[_0xf0f9('0x1d')](handleEntityNotFound(_0x3a499d,null))['then'](removeEntity(_0x3a499d,null))[_0xf0f9('0x4f')](handleError(_0x3a499d,null));};exports[_0xf0f9('0x54')]=function(_0x22fe30,_0x115d02,_0x6979f){var _0x586022={};var _0x3b1d45={};var _0x838550;var _0x3dbb9c;return db[_0xf0f9('0x48')][_0xf0f9('0x55')]({'where':{'id':_0x22fe30[_0xf0f9('0x4b')]['id']}})[_0xf0f9('0x1d')](handleEntityNotFound(_0x115d02,null))[_0xf0f9('0x1d')](function(_0x2025e9){if(_0x2025e9){_0x838550=_0x2025e9;_0x3b1d45[_0xf0f9('0x38')]=_['keys'](db[_0xf0f9('0x56')][_0xf0f9('0x4c')]);_0x3b1d45['query']=_[_0xf0f9('0x3a')](_0x22fe30['query']);_0x3b1d45[_0xf0f9('0x3b')]=_[_0xf0f9('0x3d')](_0x3b1d45[_0xf0f9('0x38')],_0x3b1d45['query']);_0x586022[_0xf0f9('0x3c')]=_[_0xf0f9('0x3d')](_0x3b1d45[_0xf0f9('0x38')],qs[_0xf0f9('0x3e')](_0x22fe30[_0xf0f9('0x39')][_0xf0f9('0x3e')]));_0x586022[_0xf0f9('0x3c')]=_0x586022[_0xf0f9('0x3c')][_0xf0f9('0x57')]?_0x586022[_0xf0f9('0x3c')]:_0x3b1d45[_0xf0f9('0x38')];_0x586022[_0xf0f9('0x58')]=qs['sort'](_0x22fe30[_0xf0f9('0x39')][_0xf0f9('0x59')]);_0x586022[_0xf0f9('0x43')]=qs[_0xf0f9('0x3b')](_['pick'](_0x22fe30[_0xf0f9('0x39')],_0x3b1d45[_0xf0f9('0x3b')]));if(_0x22fe30[_0xf0f9('0x39')]['filter']){_0x586022[_0xf0f9('0x43')]=_[_0xf0f9('0x44')](_0x586022['where'],{'$or':_[_0xf0f9('0x34')](_0x586022[_0xf0f9('0x3c')],function(_0x5b3b40){var _0x110bb7={};_0x110bb7[_0x5b3b40]={'$like':'%'+_0x22fe30[_0xf0f9('0x39')][_0xf0f9('0x42')]+'%'};return _0x110bb7;})});}_0x586022=_[_0xf0f9('0x44')]({},_0x586022,_0x22fe30[_0xf0f9('0x4d')]);return _0x838550[_0xf0f9('0x54')](_0x586022);}})[_0xf0f9('0x1d')](function(_0x504cb5){if(_0x504cb5){_0x3dbb9c=_0x504cb5[_0xf0f9('0x57')];if(!_0x22fe30[_0xf0f9('0x39')]['hasOwnProperty'](_0xf0f9('0x40'))){_0x586022[_0xf0f9('0x2b')]=qs['limit'](_0x22fe30[_0xf0f9('0x39')][_0xf0f9('0x2b')]);_0x586022['offset']=qs[_0xf0f9('0x2a')](_0x22fe30['query'][_0xf0f9('0x2a')]);}return _0x838550[_0xf0f9('0x54')](_0x586022);}})[_0xf0f9('0x1d')](function(_0x553937){if(_0x553937){return _0x553937?{'count':_0x3dbb9c,'rows':_0x553937}:null;}})[_0xf0f9('0x1d')](respondWithResult(_0x115d02,null))[_0xf0f9('0x4f')](handleError(_0x115d02,null));};exports[_0xf0f9('0x5a')]=function(_0x27771a,_0x4fb990,_0x1e64a5){if(_0x27771a[_0xf0f9('0x51')]['id']){delete _0x27771a[_0xf0f9('0x51')]['id'];}return db[_0xf0f9('0x48')][_0xf0f9('0x55')]({'where':{'id':_0x27771a[_0xf0f9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4fb990,null))[_0xf0f9('0x1d')](function(_0x1eb8d2){if(_0x1eb8d2){_0x27771a[_0xf0f9('0x51')][_0xf0f9('0x5b')]=_0x1eb8d2['id'];_0x27771a['body'][_0xf0f9('0x5c')]=integrations['getSubjects'](_0x27771a[_0xf0f9('0x51')][_0xf0f9('0x5d')],_0x27771a[_0xf0f9('0x51')][_0xf0f9('0x36')]);_0x27771a[_0xf0f9('0x51')][_0xf0f9('0x5e')]=integrations[_0xf0f9('0x5f')](_0x27771a[_0xf0f9('0x51')][_0xf0f9('0x5d')],_0x27771a[_0xf0f9('0x51')][_0xf0f9('0x36')]);return db[_0xf0f9('0x56')]['create'](_0x27771a[_0xf0f9('0x51')],{'include':[{'model':db[_0xf0f9('0x60')],'as':'Subjects'},{'model':db[_0xf0f9('0x60')],'as':_0xf0f9('0x5e')}]});}return null;})['then'](respondWithResult(_0x4fb990,null))['catch'](handleError(_0x4fb990,null));};exports[_0xf0f9('0x61')]=function(_0xb1f145,_0x299c58,_0x1cba61){var _0x287b01='';return db[_0xf0f9('0x48')]['findOne']({'where':{'id':_0xb1f145[_0xf0f9('0x4b')]['id']},'attributes':['id',_0xf0f9('0x62'),_0xf0f9('0x63'),_0xf0f9('0x64'),_0xf0f9('0x65'),_0xf0f9('0x66')]})[_0xf0f9('0x1d')](handleEntityNotFound(_0x299c58,null))[_0xf0f9('0x1d')](function(_0x5cee0d){if(_0x5cee0d){_0x287b01=_0x5cee0d[_0xf0f9('0x66')];var _0x2c4171=_0x287b01[_0xf0f9('0x67')](-0x1);if(_0x2c4171==='/'){_0x287b01=_0x287b01[_0xf0f9('0x68')](0x0,_0x287b01['lastIndexOf'](_0x2c4171));}var _0x5efb78={'method':_0xf0f9('0x69'),'uri':util[_0xf0f9('0x6a')]('%s/%s',_0x287b01,_0xf0f9('0x6b')),'json':!![]};switch(_0x5cee0d[_0xf0f9('0x65')]){case _0xf0f9('0x63'):_0x5efb78['headers']={'Authorization':util[_0xf0f9('0x6a')](_0xf0f9('0x6c'),new Buffer(util['format'](_0xf0f9('0x6d'),_0x5cee0d[_0xf0f9('0x62')],_0x5cee0d['password']))[_0xf0f9('0x6e')](_0xf0f9('0x6f')))};break;case _0xf0f9('0x64'):_0x5efb78[_0xf0f9('0x70')]={'Authorization':util['format'](_0xf0f9('0x6c'),new Buffer(util[_0xf0f9('0x6a')](_0xf0f9('0x71'),_0x5cee0d['username'],_0x5cee0d['token']))[_0xf0f9('0x6e')]('base64'))};break;default:throw new db[(_0xf0f9('0x72'))][(_0xf0f9('0x73'))](_0xf0f9('0x74'));}return rp(_0x5efb78);}})[_0xf0f9('0x1d')](function(_0x3b727e){if(_0x3b727e){var _0x11ed29=[_0xf0f9('0x75'),_0xf0f9('0x76'),_0xf0f9('0x77'),'assignee'];_[_0xf0f9('0x78')](_0x3b727e[_0xf0f9('0x6b')],function(_0x431c87){return _0x11ed29[_0xf0f9('0x79')](_0x431c87[_0xf0f9('0x36')]);});return{'count':_0x3b727e[_0xf0f9('0x6b')]['length'],'rows':_[_0xf0f9('0x34')](_0x3b727e['ticket_fields'],function(_0x2914cb){return{'id':_0x2914cb['id'],'name':_0x2914cb[_0xf0f9('0x7a')]>0x7?_0x2914cb[_0xf0f9('0x7b')]:_0x2914cb[_0xf0f9('0x36')],'custom':_0x2914cb[_0xf0f9('0x7a')]>0x7?!![]:![],'options':_0x2914cb[_0xf0f9('0x7c')]?_0x2914cb[_0xf0f9('0x7c')]:_0x2914cb['custom_field_options']?_0x2914cb[_0xf0f9('0x7d')]:[]};})};}})['then'](respondWithResult(_0x299c58,null))['catch'](function(_0x2e908b){var _0x4da812=_0xb1f145[_0xf0f9('0x39')][_0xf0f9('0x7e')]?0x1f4:_0x2e908b['statusCode']||0x1f4;logger[_0xf0f9('0x23')](_0xf0f9('0x7f'),_0xf0f9('0x61'),_0x4da812,JSON[_0xf0f9('0x80')](_0x2e908b));delete _0x2e908b[_0xf0f9('0x32')];if(_0x4da812===0x191){_0x4da812=0x190;}_0x299c58[_0xf0f9('0x27')](_0x4da812)[_0xf0f9('0x33')](_0xb1f145[_0xf0f9('0x39')][_0xf0f9('0x7e')]?{'message':_0xf0f9('0x81'),'statusCode':_0x2e908b[_0xf0f9('0x82')]}:_0x2e908b);});}; \ No newline at end of file +var _0x0dee=['statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','offset','json','apply','reject','update','end','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','show','params','filters','find','create','body','destroy','getConfigurations','findOne','length','pick','AccountId','getSubjects','channel','Descriptions','ZendeskConfiguration','ZendeskField','Subjects','getFields','username','password','token','authType','remoteUri','slice','substring','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','%s/token:%s','base64','Sequelize','Unknown\x20authentication\x20type','subject','description','group','assignee','includes','position','system_field_options','custom_field_options','test'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0x0dee,0xf7));var _0xe0de=function(_0x11bce7,_0x19c7bf){_0x11bce7=_0x11bce7-0x0;var _0x4c4917=_0x0dee[_0x11bce7];return _0x4c4917;};'use strict';var emlformat=require(_0xe0de('0x0'));var rimraf=require(_0xe0de('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0de('0x2'));var rp=require('request-promise');var moment=require(_0xe0de('0x3'));var BPromise=require(_0xe0de('0x4'));var Mustache=require('mustache');var util=require(_0xe0de('0x5'));var path=require(_0xe0de('0x6'));var sox=require(_0xe0de('0x7'));var csv=require('to-csv');var ejs=require(_0xe0de('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe0de('0x9'));var squel=require(_0xe0de('0xa'));var crypto=require(_0xe0de('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe0de('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe0de('0xd'));var Papa=require('papaparse');var Redis=require(_0xe0de('0xe'));var authService=require(_0xe0de('0xf'));var qs=require(_0xe0de('0x10'));var as=require(_0xe0de('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0de('0x12'))(_0xe0de('0x13'));var utils=require(_0xe0de('0x14'));var config=require(_0xe0de('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xe0de('0x16'));var jayson=require(_0xe0de('0x17'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ae0cd,_0x176fd6,_0x4e4c41,_0x4cd724){return new BPromise(function(_0x5e1fd9,_0x4adf3c){var _0x1188b7=_0x4cd724||client;return _0x1188b7[_0xe0de('0x18')](_0x1ae0cd,_0x4e4c41)[_0xe0de('0x19')](function(_0xfc026b){logger[_0xe0de('0x1a')](_0xe0de('0x1b'),_0x176fd6,_0xe0de('0x1c'));logger[_0xe0de('0x1d')](_0xe0de('0x1e'),_0x176fd6,_0xe0de('0x1c'),JSON['stringify'](_0xfc026b));if(_0xfc026b[_0xe0de('0x1f')]){if(_0xfc026b[_0xe0de('0x1f')][_0xe0de('0x20')]===0x1f4){logger[_0xe0de('0x1f')](_0xe0de('0x1b'),_0x176fd6,_0xfc026b[_0xe0de('0x1f')][_0xe0de('0x21')]);return _0x4adf3c(_0xfc026b[_0xe0de('0x1f')][_0xe0de('0x21')]);}logger[_0xe0de('0x1f')]('ZendeskAccount,\x20%s,\x20%s',_0x176fd6,_0xfc026b[_0xe0de('0x1f')]['message']);return _0x5e1fd9(_0xfc026b[_0xe0de('0x1f')][_0xe0de('0x21')]);}else{logger[_0xe0de('0x1a')]('ZendeskAccount,\x20%s,\x20%s',_0x176fd6,_0xe0de('0x1c'));_0x5e1fd9(_0xfc026b[_0xe0de('0x22')][_0xe0de('0x21')]);}})[_0xe0de('0x23')](function(_0x119c4d){logger['error'](_0xe0de('0x1b'),_0x176fd6,_0x119c4d);_0x4adf3c(_0x119c4d);});});}function respondWithStatusCode(_0x211e92,_0x4e0d04){_0x4e0d04=_0x4e0d04||0xcc;return function(_0x1d7c7d){if(_0x1d7c7d){return _0x211e92[_0xe0de('0x24')](_0x4e0d04);}return _0x211e92[_0xe0de('0x25')](_0x4e0d04)['end']();};}function respondWithResult(_0x523891,_0x5877f8){_0x5877f8=_0x5877f8||0xc8;return function(_0x3a41a9){if(_0x3a41a9){return _0x523891[_0xe0de('0x25')](_0x5877f8)['json'](_0x3a41a9);}};}function respondWithFilteredResult(_0x241acd,_0x31bab4){return function(_0x3b677f){if(_0x3b677f){var _0xb95460=_0x3b677f['count'],_0x4ef3e3=_0x31bab4[_0xe0de('0x26')],_0x248fc4=_0x31bab4[_0xe0de('0x26')]+_0x31bab4['limit'],_0x264ca6;if(_0x248fc4>=_0xb95460){_0x248fc4=_0xb95460;_0x264ca6=0xc8;}else{_0x264ca6=0xce;}_0x241acd['status'](_0x264ca6);return _0x241acd['set']('Content-Range',_0x4ef3e3+'-'+_0x248fc4+'/'+_0xb95460)[_0xe0de('0x27')](_0x3b677f);}return null;};}function patchUpdates(_0x57c2df){return function(_0x3bd694){try{jsonpatch[_0xe0de('0x28')](_0x3bd694,_0x57c2df,!![]);}catch(_0x5745ec){return BPromise[_0xe0de('0x29')](_0x5745ec);}return _0x3bd694['save']();};}function saveUpdates(_0x4128d9,_0x378cd3){return function(_0x1ff079){if(_0x1ff079){return _0x1ff079[_0xe0de('0x2a')](_0x4128d9)['then'](function(_0x53266b){return _0x53266b;});}return null;};}function removeEntity(_0x322688,_0x3ac61e){return function(_0xf7f8e8){if(_0xf7f8e8){return _0xf7f8e8['destroy']()[_0xe0de('0x19')](function(){_0x322688['status'](0xcc)[_0xe0de('0x2b')]();});}};}function handleEntityNotFound(_0x3e894b,_0x3fd449){return function(_0x105193){if(!_0x105193){_0x3e894b[_0xe0de('0x24')](0x194);}return _0x105193;};}function handleError(_0x3f9507,_0x146f2d){_0x146f2d=_0x146f2d||0x1f4;return function(_0x42aaf3){logger[_0xe0de('0x1f')](_0x42aaf3[_0xe0de('0x2c')]);if(_0x42aaf3[_0xe0de('0x2d')]){delete _0x42aaf3[_0xe0de('0x2d')];}_0x3f9507['status'](_0x146f2d)[_0xe0de('0x2e')](_0x42aaf3);};}exports[_0xe0de('0x2f')]=function(_0x1ac48b,_0x4c81c1){var _0x3dcc6d={},_0x34da70={},_0x4af5dc={'count':0x0,'rows':[]};var _0x22c11a=_['map'](db[_0xe0de('0x30')][_0xe0de('0x31')],function(_0x292119){return{'name':_0x292119[_0xe0de('0x32')],'type':_0x292119['type'][_0xe0de('0x33')]};});_0x34da70[_0xe0de('0x34')]=_[_0xe0de('0x35')](_0x22c11a,_0xe0de('0x2d'));_0x34da70[_0xe0de('0x36')]=_[_0xe0de('0x37')](_0x1ac48b[_0xe0de('0x36')]);_0x34da70['filters']=_[_0xe0de('0x38')](_0x34da70['model'],_0x34da70[_0xe0de('0x36')]);_0x3dcc6d[_0xe0de('0x39')]=_[_0xe0de('0x38')](_0x34da70['model'],qs[_0xe0de('0x3a')](_0x1ac48b[_0xe0de('0x36')]['fields']));_0x3dcc6d[_0xe0de('0x39')]=_0x3dcc6d['attributes']['length']?_0x3dcc6d['attributes']:_0x34da70['model'];if(!_0x1ac48b[_0xe0de('0x36')][_0xe0de('0x3b')](_0xe0de('0x3c'))){_0x3dcc6d[_0xe0de('0x3d')]=qs[_0xe0de('0x3d')](_0x1ac48b[_0xe0de('0x36')][_0xe0de('0x3d')]);_0x3dcc6d['offset']=qs[_0xe0de('0x26')](_0x1ac48b['query']['offset']);}_0x3dcc6d['order']=qs[_0xe0de('0x3e')](_0x1ac48b['query'][_0xe0de('0x3e')]);_0x3dcc6d[_0xe0de('0x3f')]=qs['filters'](_['pick'](_0x1ac48b[_0xe0de('0x36')],_0x34da70['filters']),_0x22c11a);if(_0x1ac48b[_0xe0de('0x36')][_0xe0de('0x40')]){_0x3dcc6d[_0xe0de('0x3f')]=_[_0xe0de('0x41')](_0x3dcc6d[_0xe0de('0x3f')],{'$or':_['map'](_0x22c11a,function(_0x5c1c93){if(_0x5c1c93[_0xe0de('0x42')]!==_0xe0de('0x43')){var _0x5118c4={};_0x5118c4[_0x5c1c93[_0xe0de('0x2d')]]={'$like':'%'+_0x1ac48b[_0xe0de('0x36')]['filter']+'%'};return _0x5118c4;}})});}_0x3dcc6d=_[_0xe0de('0x41')]({},_0x3dcc6d,_0x1ac48b[_0xe0de('0x44')]);var _0x28579d={'where':_0x3dcc6d[_0xe0de('0x3f')]};return db[_0xe0de('0x30')][_0xe0de('0x45')](_0x28579d)[_0xe0de('0x19')](function(_0x5e2595){_0x4af5dc[_0xe0de('0x45')]=_0x5e2595;if(_0x1ac48b['query'][_0xe0de('0x46')]){_0x3dcc6d[_0xe0de('0x47')]=[{'all':!![]}];}return db[_0xe0de('0x30')]['findAll'](_0x3dcc6d);})[_0xe0de('0x19')](function(_0x5e36ac){_0x4af5dc['rows']=_0x5e36ac;return _0x4af5dc;})[_0xe0de('0x19')](respondWithFilteredResult(_0x4c81c1,_0x3dcc6d))[_0xe0de('0x23')](handleError(_0x4c81c1,null));};exports[_0xe0de('0x48')]=function(_0x33f588,_0x2df3e7){var _0x3fcaf2={'raw':![],'where':{'id':_0x33f588[_0xe0de('0x49')]['id']}},_0x1ef0aa={};_0x1ef0aa[_0xe0de('0x34')]=_['keys'](db[_0xe0de('0x30')]['rawAttributes']);_0x1ef0aa[_0xe0de('0x36')]=_['keys'](_0x33f588[_0xe0de('0x36')]);_0x1ef0aa[_0xe0de('0x4a')]=_['intersection'](_0x1ef0aa[_0xe0de('0x34')],_0x1ef0aa[_0xe0de('0x36')]);_0x3fcaf2['attributes']=_[_0xe0de('0x38')](_0x1ef0aa[_0xe0de('0x34')],qs[_0xe0de('0x3a')](_0x33f588['query'][_0xe0de('0x3a')]));_0x3fcaf2[_0xe0de('0x39')]=_0x3fcaf2[_0xe0de('0x39')]['length']?_0x3fcaf2[_0xe0de('0x39')]:_0x1ef0aa[_0xe0de('0x34')];if(_0x33f588[_0xe0de('0x36')]['includeAll']){_0x3fcaf2[_0xe0de('0x47')]=[{'all':!![]}];}_0x3fcaf2=_['merge']({},_0x3fcaf2,_0x33f588[_0xe0de('0x44')]);return db['ZendeskAccount'][_0xe0de('0x4b')](_0x3fcaf2)[_0xe0de('0x19')](handleEntityNotFound(_0x2df3e7,null))[_0xe0de('0x19')](respondWithResult(_0x2df3e7,null))[_0xe0de('0x23')](handleError(_0x2df3e7,null));};exports[_0xe0de('0x4c')]=function(_0x59c18f,_0x19337a){return db['ZendeskAccount'][_0xe0de('0x4c')](_0x59c18f['body'],{})[_0xe0de('0x19')](respondWithResult(_0x19337a,0xc9))[_0xe0de('0x23')](handleError(_0x19337a,null));};exports[_0xe0de('0x2a')]=function(_0x59fa78,_0x4d751b){if(_0x59fa78[_0xe0de('0x4d')]['id']){delete _0x59fa78[_0xe0de('0x4d')]['id'];}return db[_0xe0de('0x30')]['find']({'where':{'id':_0x59fa78[_0xe0de('0x49')]['id']}})[_0xe0de('0x19')](handleEntityNotFound(_0x4d751b,null))[_0xe0de('0x19')](saveUpdates(_0x59fa78['body'],null))[_0xe0de('0x19')](respondWithResult(_0x4d751b,null))['catch'](handleError(_0x4d751b,null));};exports[_0xe0de('0x4e')]=function(_0x1a2271,_0x1d2d5a){return db[_0xe0de('0x30')][_0xe0de('0x4b')]({'where':{'id':_0x1a2271[_0xe0de('0x49')]['id']}})[_0xe0de('0x19')](handleEntityNotFound(_0x1d2d5a,null))[_0xe0de('0x19')](removeEntity(_0x1d2d5a,null))['catch'](handleError(_0x1d2d5a,null));};exports[_0xe0de('0x4f')]=function(_0x5d2c99,_0x2e0587,_0x55977d){var _0x587014={};var _0x3966bf={};var _0x5359b6;var _0x546373;return db[_0xe0de('0x30')][_0xe0de('0x50')]({'where':{'id':_0x5d2c99[_0xe0de('0x49')]['id']}})['then'](handleEntityNotFound(_0x2e0587,null))['then'](function(_0x4c1c54){if(_0x4c1c54){_0x5359b6=_0x4c1c54;_0x3966bf[_0xe0de('0x34')]=_[_0xe0de('0x37')](db['ZendeskConfiguration']['rawAttributes']);_0x3966bf[_0xe0de('0x36')]=_[_0xe0de('0x37')](_0x5d2c99[_0xe0de('0x36')]);_0x3966bf['filters']=_['intersection'](_0x3966bf[_0xe0de('0x34')],_0x3966bf['query']);_0x587014[_0xe0de('0x39')]=_[_0xe0de('0x38')](_0x3966bf[_0xe0de('0x34')],qs[_0xe0de('0x3a')](_0x5d2c99[_0xe0de('0x36')]['fields']));_0x587014[_0xe0de('0x39')]=_0x587014[_0xe0de('0x39')][_0xe0de('0x51')]?_0x587014[_0xe0de('0x39')]:_0x3966bf[_0xe0de('0x34')];_0x587014['order']=qs[_0xe0de('0x3e')](_0x5d2c99[_0xe0de('0x36')]['sort']);_0x587014['where']=qs[_0xe0de('0x4a')](_[_0xe0de('0x52')](_0x5d2c99['query'],_0x3966bf[_0xe0de('0x4a')]));if(_0x5d2c99[_0xe0de('0x36')][_0xe0de('0x40')]){_0x587014[_0xe0de('0x3f')]=_[_0xe0de('0x41')](_0x587014[_0xe0de('0x3f')],{'$or':_[_0xe0de('0x35')](_0x587014[_0xe0de('0x39')],function(_0x2fce59){var _0x4b207e={};_0x4b207e[_0x2fce59]={'$like':'%'+_0x5d2c99[_0xe0de('0x36')][_0xe0de('0x40')]+'%'};return _0x4b207e;})});}_0x587014=_['merge']({},_0x587014,_0x5d2c99[_0xe0de('0x44')]);return _0x5359b6[_0xe0de('0x4f')](_0x587014);}})['then'](function(_0x52b48d){if(_0x52b48d){_0x546373=_0x52b48d[_0xe0de('0x51')];if(!_0x5d2c99[_0xe0de('0x36')][_0xe0de('0x3b')](_0xe0de('0x3c'))){_0x587014[_0xe0de('0x3d')]=qs[_0xe0de('0x3d')](_0x5d2c99[_0xe0de('0x36')][_0xe0de('0x3d')]);_0x587014[_0xe0de('0x26')]=qs['offset'](_0x5d2c99[_0xe0de('0x36')]['offset']);}return _0x5359b6[_0xe0de('0x4f')](_0x587014);}})['then'](function(_0x2828bf){if(_0x2828bf){return _0x2828bf?{'count':_0x546373,'rows':_0x2828bf}:null;}})[_0xe0de('0x19')](respondWithResult(_0x2e0587,null))[_0xe0de('0x23')](handleError(_0x2e0587,null));};exports['addConfiguration']=function(_0x4bb5d0,_0x1fe6b8,_0x13b051){if(_0x4bb5d0['body']['id']){delete _0x4bb5d0[_0xe0de('0x4d')]['id'];}return db[_0xe0de('0x30')][_0xe0de('0x50')]({'where':{'id':_0x4bb5d0[_0xe0de('0x49')]['id']}})[_0xe0de('0x19')](handleEntityNotFound(_0x1fe6b8,null))['then'](function(_0x106482){if(_0x106482){_0x4bb5d0[_0xe0de('0x4d')][_0xe0de('0x53')]=_0x106482['id'];_0x4bb5d0[_0xe0de('0x4d')]['Subjects']=integrations[_0xe0de('0x54')](_0x4bb5d0[_0xe0de('0x4d')][_0xe0de('0x55')],_0x4bb5d0[_0xe0de('0x4d')][_0xe0de('0x42')]);_0x4bb5d0['body'][_0xe0de('0x56')]=integrations['getDescriptions'](_0x4bb5d0[_0xe0de('0x4d')]['channel'],_0x4bb5d0[_0xe0de('0x4d')][_0xe0de('0x42')]);return db[_0xe0de('0x57')]['create'](_0x4bb5d0[_0xe0de('0x4d')],{'include':[{'model':db[_0xe0de('0x58')],'as':_0xe0de('0x59')},{'model':db[_0xe0de('0x58')],'as':_0xe0de('0x56')}]});}return null;})['then'](respondWithResult(_0x1fe6b8,null))[_0xe0de('0x23')](handleError(_0x1fe6b8,null));};exports[_0xe0de('0x5a')]=function(_0x21f4bf,_0x55ae1f,_0x3a4b93){var _0x3a641a='';return db[_0xe0de('0x30')][_0xe0de('0x50')]({'where':{'id':_0x21f4bf[_0xe0de('0x49')]['id']},'attributes':['id',_0xe0de('0x5b'),_0xe0de('0x5c'),_0xe0de('0x5d'),_0xe0de('0x5e'),'remoteUri']})[_0xe0de('0x19')](handleEntityNotFound(_0x55ae1f,null))[_0xe0de('0x19')](function(_0x2fbc56){if(_0x2fbc56){_0x3a641a=_0x2fbc56[_0xe0de('0x5f')];var _0x1bc83a=_0x3a641a[_0xe0de('0x60')](-0x1);if(_0x1bc83a==='/'){_0x3a641a=_0x3a641a[_0xe0de('0x61')](0x0,_0x3a641a['lastIndexOf'](_0x1bc83a));}var _0x2b5801={'method':_0xe0de('0x62'),'uri':util[_0xe0de('0x63')](_0xe0de('0x64'),_0x3a641a,_0xe0de('0x65')),'json':!![]};switch(_0x2fbc56[_0xe0de('0x5e')]){case _0xe0de('0x5c'):_0x2b5801[_0xe0de('0x66')]={'Authorization':util[_0xe0de('0x63')](_0xe0de('0x67'),new Buffer(util['format'](_0xe0de('0x68'),_0x2fbc56['username'],_0x2fbc56[_0xe0de('0x5c')]))[_0xe0de('0x69')]('base64'))};break;case _0xe0de('0x5d'):_0x2b5801[_0xe0de('0x66')]={'Authorization':util[_0xe0de('0x63')](_0xe0de('0x67'),new Buffer(util[_0xe0de('0x63')](_0xe0de('0x6a'),_0x2fbc56[_0xe0de('0x5b')],_0x2fbc56[_0xe0de('0x5d')]))[_0xe0de('0x69')](_0xe0de('0x6b')))};break;default:throw new db[(_0xe0de('0x6c'))]['ValidationError'](_0xe0de('0x6d'));}return rp(_0x2b5801);}})['then'](function(_0x3800f4){if(_0x3800f4){var _0x5a9d28=[_0xe0de('0x6e'),_0xe0de('0x6f'),_0xe0de('0x70'),_0xe0de('0x71')];_['remove'](_0x3800f4['ticket_fields'],function(_0x50ddc0){return _0x5a9d28[_0xe0de('0x72')](_0x50ddc0[_0xe0de('0x42')]);});return{'count':_0x3800f4['ticket_fields']['length'],'rows':_[_0xe0de('0x35')](_0x3800f4[_0xe0de('0x65')],function(_0x32b8c9){return{'id':_0x32b8c9['id'],'name':_0x32b8c9[_0xe0de('0x73')]>0x7?_0x32b8c9['title']:_0x32b8c9[_0xe0de('0x42')],'custom':_0x32b8c9[_0xe0de('0x73')]>0x7?!![]:![],'options':_0x32b8c9[_0xe0de('0x74')]?_0x32b8c9[_0xe0de('0x74')]:_0x32b8c9[_0xe0de('0x75')]?_0x32b8c9['custom_field_options']:[]};})};}})[_0xe0de('0x19')](respondWithResult(_0x55ae1f,null))[_0xe0de('0x23')](function(_0x737dd2){var _0x38da1f=_0x21f4bf[_0xe0de('0x36')][_0xe0de('0x76')]?0x1f4:_0x737dd2[_0xe0de('0x77')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xe0de('0x5a'),_0x38da1f,JSON[_0xe0de('0x78')](_0x737dd2));delete _0x737dd2[_0xe0de('0x2d')];if(_0x38da1f===0x191){_0x38da1f=0x190;}_0x55ae1f[_0xe0de('0x25')](_0x38da1f)[_0xe0de('0x2e')](_0x21f4bf['query'][_0xe0de('0x76')]?{'message':_0xe0de('0x79'),'statusCode':_0x737dd2['statusCode']}:_0x737dd2);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 3c3a16a..fbdab1b 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 _0xfff3=['api','moment','bluebird','request-promise','path','../../components/integrations/configuration','int_zendesk_accounts'];(function(_0x2ec06f,_0x4c42f2){var _0x5b8c15=function(_0x3c7962){while(--_0x3c7962){_0x2ec06f['push'](_0x2ec06f['shift']());}};_0x5b8c15(++_0x4c42f2);}(_0xfff3,0xf5));var _0x3fff=function(_0x675e70,_0xe45ecb){_0x675e70=_0x675e70-0x0;var _0x22f975=_0xfff3[_0x675e70];return _0x22f975;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3fff('0x0'));var moment=require(_0x3fff('0x1'));var BPromise=require(_0x3fff('0x2'));var rp=require(_0x3fff('0x3'));var fs=require('fs');var path=require(_0x3fff('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x3fff('0x5'));module['exports']=function(_0x24c908,_0x176838){return _0x24c908['define']('ZendeskAccount',attributes,{'tableName':_0x3fff('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9bc=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash'];(function(_0x7496a2,_0x3b1e5b){var _0x14f2f5=function(_0x1e2545){while(--_0x1e2545){_0x7496a2['push'](_0x7496a2['shift']());}};_0x14f2f5(++_0x3b1e5b);}(_0xb9bc,0x12b));var _0xcb9b=function(_0x2ff739,_0x1c8e0f){_0x2ff739=_0x2ff739-0x0;var _0x12dc13=_0xb9bc[_0x2ff739];return _0x12dc13;};'use strict';var _=require(_0xcb9b('0x0'));var util=require(_0xcb9b('0x1'));var logger=require(_0xcb9b('0x2'))(_0xcb9b('0x3'));var moment=require(_0xcb9b('0x4'));var BPromise=require(_0xcb9b('0x5'));var rp=require(_0xcb9b('0x6'));var fs=require('fs');var path=require(_0xcb9b('0x7'));var rimraf=require(_0xcb9b('0x8'));var config=require('../../config/environment');var attributes=require(_0xcb9b('0x9'));var integrations=require(_0xcb9b('0xa'));module[_0xcb9b('0xb')]=function(_0x55bdbc,_0x5a4daf){return _0x55bdbc[_0xcb9b('0xc')](_0xcb9b('0xd'),attributes,{'tableName':_0xcb9b('0xe'),'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 0161f02..461362e 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 _0xb7e7=['request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','find','where','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0x156728,_0x53098b){var _0x51ec65=function(_0x39bb1f){while(--_0x39bb1f){_0x156728['push'](_0x156728['shift']());}};_0x51ec65(++_0x53098b);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xb7e7[_0x34843e];return _0x598f7f;};'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')]('ZendeskAccount,\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);});});}exports[_0x7b7e('0x14')]=function(_0x242368){var _0x200ef7=this;return new Promise(function(_0x2acb8c,_0x429a0e){return db[_0x7b7e('0x15')][_0x7b7e('0x16')]({'raw':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')]['where']||null:null,'attributes':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x19')]||null:null,'limit':_0x242368['options']?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1a')]||null:null,'include':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x53bbb3){return{'model':db[_0x53bbb3['model']],'as':_0x53bbb3['as'],'attributes':_0x53bbb3['attributes'],'include':_0x53bbb3[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x53bbb3[_0x7b7e('0x1b')],function(_0x483c6f){return{'model':db[_0x483c6f['model']],'as':_0x483c6f['as'],'attributes':_0x483c6f['attributes'],'include':_0x483c6f[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x483c6f[_0x7b7e('0x1b')],function(_0x7aa71){return{'model':db[_0x7aa71[_0x7b7e('0x1d')]],'as':_0x7aa71['as'],'attributes':_0x7aa71['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x21a15){logger['info']('GetZendeskAccount',_0x242368);logger['debug'](_0x7b7e('0x14'),_0x242368,JSON[_0x7b7e('0xf')](_0x21a15));_0x2acb8c(_0x21a15);})['catch'](function(_0x3db8c4){logger['error'](_0x7b7e('0x14'),_0x3db8c4[_0x7b7e('0x12')],_0x242368);_0x429a0e(_0x200ef7[_0x7b7e('0x10')](0x1f4,_0x3db8c4['message']));});});};exports[_0x7b7e('0x1e')]=function(_0xe31336){var _0x35602a=this;return new Promise(function(_0x326dd2,_0x33f9a1){return db['ZendeskAccount'][_0x7b7e('0x1f')]({'raw':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x20')]||null:null,'attributes':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')]['attributes']||null:null,'include':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_['map'](_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x2ca366){return{'model':db[_0x2ca366['model']],'as':_0x2ca366['as'],'attributes':_0x2ca366[_0x7b7e('0x19')],'include':_0x2ca366[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x2ca366[_0x7b7e('0x1b')],function(_0x31043a){return{'model':db[_0x31043a[_0x7b7e('0x1d')]],'as':_0x31043a['as'],'attributes':_0x31043a[_0x7b7e('0x19')],'include':_0x31043a[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x31043a[_0x7b7e('0x1b')],function(_0xd5a64d){return{'model':db[_0xd5a64d[_0x7b7e('0x1d')]],'as':_0xd5a64d['as'],'attributes':_0xd5a64d[_0x7b7e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x116563){logger[_0x7b7e('0xa')]('ShowZendeskAccount',_0xe31336);logger[_0x7b7e('0xc')](_0x7b7e('0x1e'),_0xe31336,JSON[_0x7b7e('0xf')](_0x116563));_0x326dd2(_0x116563);})[_0x7b7e('0x13')](function(_0x36abfc){logger[_0x7b7e('0x10')](_0x7b7e('0x1e'),_0x36abfc[_0x7b7e('0x12')],_0xe31336);_0x33f9a1(_0x35602a[_0x7b7e('0x10')](0x1f4,_0x36abfc[_0x7b7e('0x12')]));});});}; \ No newline at end of file +var _0xd8b0=['raw','where','include','map','model','attributes','ShowZendeskAccount','find','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','options'];(function(_0x1bbfe6,_0x3dd9fd){var _0x57c56d=function(_0x580061){while(--_0x580061){_0x1bbfe6['push'](_0x1bbfe6['shift']());}};_0x57c56d(++_0x3dd9fd);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['findAll']({'raw':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x19')]===undefined?!![]:![]:!![],'where':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')]['attributes']||null:null,'limit':_0x5fecbd['options']?_0x5fecbd[_0x0d8b('0x18')]['limit']||null:null,'include':_0x5fecbd['options']?_0x5fecbd['options'][_0x0d8b('0x1b')]?_[_0x0d8b('0x1c')](_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1b')],function(_0x221071){return{'model':db[_0x221071[_0x0d8b('0x1d')]],'as':_0x221071['as'],'attributes':_0x221071[_0x0d8b('0x1e')],'include':_0x221071[_0x0d8b('0x1b')]?_[_0x0d8b('0x1c')](_0x221071['include'],function(_0xe8bbee){return{'model':db[_0xe8bbee[_0x0d8b('0x1d')]],'as':_0xe8bbee['as'],'attributes':_0xe8bbee['attributes'],'include':_0xe8bbee[_0x0d8b('0x1b')]?_['map'](_0xe8bbee[_0x0d8b('0x1b')],function(_0x234bdd){return{'model':db[_0x234bdd[_0x0d8b('0x1d')]],'as':_0x234bdd['as'],'attributes':_0x234bdd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x28f639){logger[_0x0d8b('0xb')]('GetZendeskAccount',_0x5fecbd);logger[_0x0d8b('0xe')]('GetZendeskAccount',_0x5fecbd,JSON[_0x0d8b('0x10')](_0x28f639));_0x18dd2d(_0x28f639);})['catch'](function(_0x97050a){logger['error'](_0x0d8b('0x16'),_0x97050a['message'],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x97050a['message']));});});};exports[_0x0d8b('0x1f')]=function(_0x106e4c){var _0x2c058d=this;return new Promise(function(_0x56120a,_0x4c80a2){return db['ZendeskAccount'][_0x0d8b('0x20')]({'raw':_0x106e4c['options']?_0x106e4c[_0x0d8b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x106e4c['options']?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x106e4c[_0x0d8b('0x18')]?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1e')]||null:null,'include':_0x106e4c[_0x0d8b('0x18')]?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1b')]?_['map'](_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1b')],function(_0x4b3ea0){return{'model':db[_0x4b3ea0[_0x0d8b('0x1d')]],'as':_0x4b3ea0['as'],'attributes':_0x4b3ea0[_0x0d8b('0x1e')],'include':_0x4b3ea0[_0x0d8b('0x1b')]?_['map'](_0x4b3ea0[_0x0d8b('0x1b')],function(_0x2c507e){return{'model':db[_0x2c507e[_0x0d8b('0x1d')]],'as':_0x2c507e['as'],'attributes':_0x2c507e[_0x0d8b('0x1e')],'include':_0x2c507e[_0x0d8b('0x1b')]?_['map'](_0x2c507e[_0x0d8b('0x1b')],function(_0x1649fc){return{'model':db[_0x1649fc['model']],'as':_0x1649fc['as'],'attributes':_0x1649fc[_0x0d8b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0d8b('0xa')](function(_0x188af2){logger[_0x0d8b('0xb')](_0x0d8b('0x1f'),_0x106e4c);logger['debug']('ShowZendeskAccount',_0x106e4c,JSON[_0x0d8b('0x10')](_0x188af2));_0x56120a(_0x188af2);})['catch'](function(_0x531c55){logger[_0x0d8b('0x11')](_0x0d8b('0x1f'),_0x531c55[_0x0d8b('0x13')],_0x106e4c);_0x4c80a2(_0x2c058d[_0x0d8b('0x11')](0x1f4,_0x531c55[_0x0d8b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index aea5048..410a38c 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 _0xefc5=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags'];(function(_0x307601,_0x263598){var _0x1507bc=function(_0x346e1c){while(--_0x346e1c){_0x307601['push'](_0x307601['shift']());}};_0x1507bc(++_0x263598);}(_0xefc5,0x1b7));var _0x5efc=function(_0x134827,_0x21f6ed){_0x134827=_0x134827-0x0;var _0x366671=_0xefc5[_0x134827];return _0x366671;};'use strict';var multer=require(_0x5efc('0x0'));var util=require('util');var path=require(_0x5efc('0x1'));var timeout=require(_0x5efc('0x2'));var express=require(_0x5efc('0x3'));var router=express[_0x5efc('0x4')]();var fs_extra=require(_0x5efc('0x5'));var auth=require(_0x5efc('0x6'));var interaction=require(_0x5efc('0x7'));var config=require(_0x5efc('0x8'));var controller=require(_0x5efc('0x9'));router[_0x5efc('0xa')]('/',auth[_0x5efc('0xb')](),controller[_0x5efc('0xc')]);router['get'](_0x5efc('0xd'),auth[_0x5efc('0xb')](),controller[_0x5efc('0xe')]);router['get']('/:id/fields',auth[_0x5efc('0xb')](),controller[_0x5efc('0xf')]);router['get'](_0x5efc('0x10'),auth[_0x5efc('0xb')](),controller[_0x5efc('0x11')]);router[_0x5efc('0xa')](_0x5efc('0x12'),auth[_0x5efc('0xb')](),controller[_0x5efc('0x13')]);router[_0x5efc('0xa')](_0x5efc('0x14'),auth[_0x5efc('0xb')](),controller[_0x5efc('0x15')]);router[_0x5efc('0x16')]('/',auth[_0x5efc('0xb')](),controller[_0x5efc('0x17')]);router[_0x5efc('0x16')]('/:id/tags',auth[_0x5efc('0xb')](),controller[_0x5efc('0x18')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x5efc('0x19')]);router[_0x5efc('0x1a')](_0x5efc('0xd'),auth['isAuthenticated'](),controller[_0x5efc('0x1b')]);module[_0x5efc('0x1c')]=router; \ No newline at end of file +var _0x8d15=['/:id/subjects','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/fields','getFields'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x8d15,0xf5));var _0x58d1=function(_0xd6cf39,_0x5dc5e3){_0xd6cf39=_0xd6cf39-0x0;var _0x269fe7=_0x8d15[_0xd6cf39];return _0x269fe7;};'use strict';var multer=require('multer');var util=require(_0x58d1('0x0'));var path=require(_0x58d1('0x1'));var timeout=require(_0x58d1('0x2'));var express=require(_0x58d1('0x3'));var router=express[_0x58d1('0x4')]();var fs_extra=require(_0x58d1('0x5'));var auth=require(_0x58d1('0x6'));var interaction=require(_0x58d1('0x7'));var config=require(_0x58d1('0x8'));var controller=require('./intZendeskConfiguration.controller');router['get']('/',auth[_0x58d1('0x9')](),controller[_0x58d1('0xa')]);router[_0x58d1('0xb')](_0x58d1('0xc'),auth[_0x58d1('0x9')](),controller['show']);router[_0x58d1('0xb')](_0x58d1('0xd'),auth[_0x58d1('0x9')](),controller[_0x58d1('0xe')]);router[_0x58d1('0xb')](_0x58d1('0xf'),auth[_0x58d1('0x9')](),controller['getSubjects']);router[_0x58d1('0xb')]('/:id/descriptions',auth[_0x58d1('0x9')](),controller[_0x58d1('0x10')]);router[_0x58d1('0xb')]('/:id/tags',auth[_0x58d1('0x9')](),controller[_0x58d1('0x11')]);router[_0x58d1('0x12')]('/',auth[_0x58d1('0x9')](),controller[_0x58d1('0x13')]);router[_0x58d1('0x12')](_0x58d1('0x14'),auth['isAuthenticated'](),controller[_0x58d1('0x15')]);router[_0x58d1('0x16')](_0x58d1('0xc'),auth[_0x58d1('0x9')](),controller[_0x58d1('0x17')]);router['delete'](_0x58d1('0xc'),auth[_0x58d1('0x9')](),controller[_0x58d1('0x18')]);module[_0x58d1('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 8efcc1e..8c3ea12 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 _0xc770=['STRING','sequelize'];(function(_0x3ccbbc,_0x14050b){var _0x3afcbd=function(_0x398773){while(--_0x398773){_0x3ccbbc['push'](_0x3ccbbc['shift']());}};_0x3afcbd(++_0x14050b);}(_0xc770,0xcf));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0c77('0x0'));module['exports']={'name':{'type':Sequelize[_0x0c77('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf900=['sequelize','STRING'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xf900,0xc0));var _0x0f90=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xf900[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0x0f90('0x0'));module['exports']={'name':{'type':Sequelize[_0x0f90('0x1')]},'description':{'type':Sequelize[_0x0f90('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 42a9826..1be90af 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 _0x916e=['create','body','update','params','destroy','getFields','findOne','hasOwnProperty','getSubjects','ZendeskField','getDescriptions','getTags','Tag','setTags','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','count','offset','limit','set','json','apply','save','stack','name','index','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','keys','options','find'];(function(_0x34e3f3,_0x8446af){var _0x3e0d10=function(_0x10a8e6){while(--_0x10a8e6){_0x34e3f3['push'](_0x34e3f3['shift']());}};_0x3e0d10(++_0x8446af);}(_0x916e,0x125));var _0xe916=function(_0x5b7f83,_0x1cb1a5){_0x5b7f83=_0x5b7f83-0x0;var _0x335a42=_0x916e[_0x5b7f83];return _0x335a42;};'use strict';var emlformat=require(_0xe916('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe916('0x1'));var rp=require(_0xe916('0x2'));var moment=require(_0xe916('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe916('0x4'));var util=require(_0xe916('0x5'));var path=require(_0xe916('0x6'));var sox=require(_0xe916('0x7'));var csv=require(_0xe916('0x8'));var ejs=require(_0xe916('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe916('0xa'));var squel=require(_0xe916('0xb'));var crypto=require(_0xe916('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe916('0xd'));var Papa=require(_0xe916('0xe'));var Redis=require(_0xe916('0xf'));var authService=require(_0xe916('0x10'));var qs=require(_0xe916('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe916('0x12'));var logger=require(_0xe916('0x13'))(_0xe916('0x14'));var utils=require(_0xe916('0x15'));var config=require(_0xe916('0x16'));var licenseUtil=require(_0xe916('0x17'));var db=require(_0xe916('0x18'))['db'];var jayson=require(_0xe916('0x19'));var client=jayson[_0xe916('0x1a')][_0xe916('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4a32e3,_0x1bb50b,_0x288062,_0x435cb3){return new BPromise(function(_0x147058,_0x5f2006){var _0x3c66bf=_0x435cb3||client;return _0x3c66bf['request'](_0x4a32e3,_0x288062)[_0xe916('0x1c')](function(_0x21ad32){logger[_0xe916('0x1d')](_0xe916('0x1e'),_0x1bb50b,_0xe916('0x1f'));logger[_0xe916('0x20')](_0xe916('0x21'),_0x1bb50b,'request\x20sent',JSON[_0xe916('0x22')](_0x21ad32));if(_0x21ad32[_0xe916('0x23')]){if(_0x21ad32[_0xe916('0x23')]['code']===0x1f4){logger[_0xe916('0x23')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1bb50b,_0x21ad32[_0xe916('0x23')][_0xe916('0x24')]);return _0x5f2006(_0x21ad32[_0xe916('0x23')][_0xe916('0x24')]);}logger[_0xe916('0x23')](_0xe916('0x1e'),_0x1bb50b,_0x21ad32[_0xe916('0x23')]['message']);return _0x147058(_0x21ad32[_0xe916('0x23')][_0xe916('0x24')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x1bb50b,_0xe916('0x1f'));_0x147058(_0x21ad32[_0xe916('0x25')][_0xe916('0x24')]);}})[_0xe916('0x26')](function(_0x15ee4b){logger[_0xe916('0x23')](_0xe916('0x1e'),_0x1bb50b,_0x15ee4b);_0x5f2006(_0x15ee4b);});});}function respondWithStatusCode(_0x2fed2b,_0x245907){_0x245907=_0x245907||0xcc;return function(_0x4b85b3){if(_0x4b85b3){return _0x2fed2b[_0xe916('0x27')](_0x245907);}return _0x2fed2b[_0xe916('0x28')](_0x245907)[_0xe916('0x29')]();};}function respondWithResult(_0x3bd96f,_0x13b000){_0x13b000=_0x13b000||0xc8;return function(_0x39d9dd){if(_0x39d9dd){return _0x3bd96f[_0xe916('0x28')](_0x13b000)['json'](_0x39d9dd);}};}function respondWithFilteredResult(_0x999869,_0x46ae4e){return function(_0x431bde){if(_0x431bde){var _0x207988=_0x431bde[_0xe916('0x2a')],_0x5e024f=_0x46ae4e[_0xe916('0x2b')],_0x93c9c5=_0x46ae4e['offset']+_0x46ae4e[_0xe916('0x2c')],_0x51aba0;if(_0x93c9c5>=_0x207988){_0x93c9c5=_0x207988;_0x51aba0=0xc8;}else{_0x51aba0=0xce;}_0x999869[_0xe916('0x28')](_0x51aba0);return _0x999869[_0xe916('0x2d')]('Content-Range',_0x5e024f+'-'+_0x93c9c5+'/'+_0x207988)[_0xe916('0x2e')](_0x431bde);}return null;};}function patchUpdates(_0x31ff22){return function(_0x434f38){try{jsonpatch[_0xe916('0x2f')](_0x434f38,_0x31ff22,!![]);}catch(_0xfba729){return BPromise['reject'](_0xfba729);}return _0x434f38[_0xe916('0x30')]();};}function saveUpdates(_0x31818,_0x79a72b){return function(_0x51cfcf){if(_0x51cfcf){return _0x51cfcf['update'](_0x31818)['then'](function(_0x29c2b7){return _0x29c2b7;});}return null;};}function removeEntity(_0x2978e2,_0x3b92eb){return function(_0x40b8fc){if(_0x40b8fc){return _0x40b8fc['destroy']()[_0xe916('0x1c')](function(){_0x2978e2[_0xe916('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x285374,_0x3467f1){return function(_0x56501d){if(!_0x56501d){_0x285374['sendStatus'](0x194);}return _0x56501d;};}function handleError(_0x272c52,_0x4c3203){_0x4c3203=_0x4c3203||0x1f4;return function(_0x2ca4eb){logger[_0xe916('0x23')](_0x2ca4eb[_0xe916('0x31')]);if(_0x2ca4eb[_0xe916('0x32')]){delete _0x2ca4eb[_0xe916('0x32')];}_0x272c52[_0xe916('0x28')](_0x4c3203)['send'](_0x2ca4eb);};}exports[_0xe916('0x33')]=function(_0x331bc7,_0x441561){var _0x1df4db={},_0x5c86e8={},_0x16b2ff={'count':0x0,'rows':[]};var _0x9d3677=_['map'](db[_0xe916('0x34')][_0xe916('0x35')],function(_0x38b5e2){return{'name':_0x38b5e2[_0xe916('0x36')],'type':_0x38b5e2[_0xe916('0x37')][_0xe916('0x38')]};});_0x5c86e8[_0xe916('0x39')]=_[_0xe916('0x3a')](_0x9d3677,_0xe916('0x32'));_0x5c86e8['query']=_['keys'](_0x331bc7[_0xe916('0x3b')]);_0x5c86e8[_0xe916('0x3c')]=_[_0xe916('0x3d')](_0x5c86e8['model'],_0x5c86e8[_0xe916('0x3b')]);_0x1df4db[_0xe916('0x3e')]=_[_0xe916('0x3d')](_0x5c86e8['model'],qs[_0xe916('0x3f')](_0x331bc7[_0xe916('0x3b')][_0xe916('0x3f')]));_0x1df4db[_0xe916('0x3e')]=_0x1df4db[_0xe916('0x3e')][_0xe916('0x40')]?_0x1df4db[_0xe916('0x3e')]:_0x5c86e8[_0xe916('0x39')];if(!_0x331bc7[_0xe916('0x3b')]['hasOwnProperty'](_0xe916('0x41'))){_0x1df4db['limit']=qs['limit'](_0x331bc7['query'][_0xe916('0x2c')]);_0x1df4db[_0xe916('0x2b')]=qs[_0xe916('0x2b')](_0x331bc7[_0xe916('0x3b')][_0xe916('0x2b')]);}_0x1df4db[_0xe916('0x42')]=qs[_0xe916('0x43')](_0x331bc7[_0xe916('0x3b')][_0xe916('0x43')]);_0x1df4db[_0xe916('0x44')]=qs[_0xe916('0x3c')](_[_0xe916('0x45')](_0x331bc7[_0xe916('0x3b')],_0x5c86e8[_0xe916('0x3c')]),_0x9d3677);if(_0x331bc7[_0xe916('0x3b')][_0xe916('0x46')]){_0x1df4db[_0xe916('0x44')]=_[_0xe916('0x47')](_0x1df4db['where'],{'$or':_[_0xe916('0x3a')](_0x9d3677,function(_0x3a3ac8){if(_0x3a3ac8[_0xe916('0x37')]!==_0xe916('0x48')){var _0x580e61={};_0x580e61[_0x3a3ac8['name']]={'$like':'%'+_0x331bc7[_0xe916('0x3b')][_0xe916('0x46')]+'%'};return _0x580e61;}})});}_0x1df4db=_[_0xe916('0x47')]({},_0x1df4db,_0x331bc7['options']);var _0x3368e7={'where':_0x1df4db[_0xe916('0x44')]};return db[_0xe916('0x34')]['count'](_0x3368e7)[_0xe916('0x1c')](function(_0x3b53ab){_0x16b2ff[_0xe916('0x2a')]=_0x3b53ab;if(_0x331bc7[_0xe916('0x3b')][_0xe916('0x49')]){_0x1df4db[_0xe916('0x4a')]=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x1df4db);})[_0xe916('0x1c')](function(_0x42076d){_0x16b2ff[_0xe916('0x4b')]=_0x42076d;return _0x16b2ff;})[_0xe916('0x1c')](respondWithFilteredResult(_0x441561,_0x1df4db))[_0xe916('0x26')](handleError(_0x441561,null));};exports['show']=function(_0xd4f82d,_0x28a180){var _0x4dc107={'raw':![],'where':{'id':_0xd4f82d['params']['id']}},_0x1d2d71={};_0x1d2d71[_0xe916('0x39')]=_[_0xe916('0x4c')](db[_0xe916('0x34')][_0xe916('0x35')]);_0x1d2d71['query']=_[_0xe916('0x4c')](_0xd4f82d[_0xe916('0x3b')]);_0x1d2d71[_0xe916('0x3c')]=_[_0xe916('0x3d')](_0x1d2d71[_0xe916('0x39')],_0x1d2d71['query']);_0x4dc107[_0xe916('0x3e')]=_[_0xe916('0x3d')](_0x1d2d71[_0xe916('0x39')],qs[_0xe916('0x3f')](_0xd4f82d['query'][_0xe916('0x3f')]));_0x4dc107[_0xe916('0x3e')]=_0x4dc107[_0xe916('0x3e')][_0xe916('0x40')]?_0x4dc107[_0xe916('0x3e')]:_0x1d2d71[_0xe916('0x39')];if(_0xd4f82d[_0xe916('0x3b')][_0xe916('0x49')]){_0x4dc107[_0xe916('0x4a')]=[{'all':!![]}];}_0x4dc107=_[_0xe916('0x47')]({},_0x4dc107,_0xd4f82d[_0xe916('0x4d')]);return db[_0xe916('0x34')][_0xe916('0x4e')](_0x4dc107)[_0xe916('0x1c')](handleEntityNotFound(_0x28a180,null))[_0xe916('0x1c')](respondWithResult(_0x28a180,null))[_0xe916('0x26')](handleError(_0x28a180,null));};exports[_0xe916('0x4f')]=function(_0xb043c9,_0x2668f5){return db[_0xe916('0x34')][_0xe916('0x4f')](_0xb043c9[_0xe916('0x50')],{})['then'](respondWithResult(_0x2668f5,0xc9))[_0xe916('0x26')](handleError(_0x2668f5,null));};exports[_0xe916('0x51')]=function(_0x486ea6,_0x51d837){if(_0x486ea6[_0xe916('0x50')]['id']){delete _0x486ea6[_0xe916('0x50')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x486ea6[_0xe916('0x52')]['id']}})[_0xe916('0x1c')](handleEntityNotFound(_0x51d837,null))['then'](saveUpdates(_0x486ea6[_0xe916('0x50')],null))[_0xe916('0x1c')](respondWithResult(_0x51d837,null))[_0xe916('0x26')](handleError(_0x51d837,null));};exports[_0xe916('0x53')]=function(_0xd7fd70,_0x5179bf){return db[_0xe916('0x34')][_0xe916('0x4e')]({'where':{'id':_0xd7fd70[_0xe916('0x52')]['id']}})['then'](handleEntityNotFound(_0x5179bf,null))[_0xe916('0x1c')](removeEntity(_0x5179bf,null))[_0xe916('0x26')](handleError(_0x5179bf,null));};exports[_0xe916('0x54')]=function(_0x4255b5,_0x16808e,_0x8a7d44){var _0x4f963f={};var _0x39a505={};var _0x6c9ce3;var _0x2a6e87;return db[_0xe916('0x34')][_0xe916('0x55')]({'where':{'id':_0x4255b5['params']['id']}})[_0xe916('0x1c')](handleEntityNotFound(_0x16808e,null))[_0xe916('0x1c')](function(_0x5842ce){if(_0x5842ce){_0x6c9ce3=_0x5842ce;_0x39a505['model']=_['keys'](db['ZendeskField'][_0xe916('0x35')]);_0x39a505[_0xe916('0x3b')]=_[_0xe916('0x4c')](_0x4255b5[_0xe916('0x3b')]);_0x39a505['filters']=_[_0xe916('0x3d')](_0x39a505[_0xe916('0x39')],_0x39a505['query']);_0x4f963f[_0xe916('0x3e')]=_[_0xe916('0x3d')](_0x39a505['model'],qs[_0xe916('0x3f')](_0x4255b5['query'][_0xe916('0x3f')]));_0x4f963f['attributes']=_0x4f963f[_0xe916('0x3e')][_0xe916('0x40')]?_0x4f963f[_0xe916('0x3e')]:_0x39a505[_0xe916('0x39')];_0x4f963f['order']=qs[_0xe916('0x43')](_0x4255b5[_0xe916('0x3b')][_0xe916('0x43')]);_0x4f963f[_0xe916('0x44')]=qs[_0xe916('0x3c')](_[_0xe916('0x45')](_0x4255b5[_0xe916('0x3b')],_0x39a505[_0xe916('0x3c')]));if(_0x4255b5[_0xe916('0x3b')][_0xe916('0x46')]){_0x4f963f['where']=_['merge'](_0x4f963f[_0xe916('0x44')],{'$or':_['map'](_0x4f963f[_0xe916('0x3e')],function(_0x5d7c3a){var _0x58321a={};_0x58321a[_0x5d7c3a]={'$like':'%'+_0x4255b5[_0xe916('0x3b')][_0xe916('0x46')]+'%'};return _0x58321a;})});}_0x4f963f=_[_0xe916('0x47')]({},_0x4f963f,_0x4255b5[_0xe916('0x4d')]);return _0x6c9ce3[_0xe916('0x54')](_0x4f963f);}})['then'](function(_0x33b8d0){if(_0x33b8d0){_0x2a6e87=_0x33b8d0[_0xe916('0x40')];if(!_0x4255b5['query'][_0xe916('0x56')]('nolimit')){_0x4f963f[_0xe916('0x2c')]=qs[_0xe916('0x2c')](_0x4255b5['query'][_0xe916('0x2c')]);_0x4f963f[_0xe916('0x2b')]=qs[_0xe916('0x2b')](_0x4255b5[_0xe916('0x3b')][_0xe916('0x2b')]);}return _0x6c9ce3[_0xe916('0x54')](_0x4f963f);}})['then'](function(_0x44b568){if(_0x44b568){return _0x44b568?{'count':_0x2a6e87,'rows':_0x44b568}:null;}})[_0xe916('0x1c')](respondWithResult(_0x16808e,null))['catch'](handleError(_0x16808e,null));};exports[_0xe916('0x57')]=function(_0x26ea48,_0x1d605f,_0x2f3e58){var _0x2b4d84={};var _0x3f8ae5={};var _0x176430;var _0x4c8350;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x26ea48['params']['id']}})[_0xe916('0x1c')](handleEntityNotFound(_0x1d605f,null))[_0xe916('0x1c')](function(_0xdf5f56){if(_0xdf5f56){_0x176430=_0xdf5f56;_0x3f8ae5['model']=_[_0xe916('0x4c')](db[_0xe916('0x58')]['rawAttributes']);_0x3f8ae5['query']=_['keys'](_0x26ea48[_0xe916('0x3b')]);_0x3f8ae5['filters']=_[_0xe916('0x3d')](_0x3f8ae5[_0xe916('0x39')],_0x3f8ae5['query']);_0x2b4d84[_0xe916('0x3e')]=_[_0xe916('0x3d')](_0x3f8ae5[_0xe916('0x39')],qs['fields'](_0x26ea48['query'][_0xe916('0x3f')]));_0x2b4d84[_0xe916('0x3e')]=_0x2b4d84['attributes'][_0xe916('0x40')]?_0x2b4d84[_0xe916('0x3e')]:_0x3f8ae5[_0xe916('0x39')];_0x2b4d84[_0xe916('0x42')]=qs[_0xe916('0x43')](_0x26ea48[_0xe916('0x3b')]['sort']);_0x2b4d84['where']=qs[_0xe916('0x3c')](_['pick'](_0x26ea48[_0xe916('0x3b')],_0x3f8ae5[_0xe916('0x3c')]));if(_0x26ea48['query'][_0xe916('0x46')]){_0x2b4d84[_0xe916('0x44')]=_[_0xe916('0x47')](_0x2b4d84[_0xe916('0x44')],{'$or':_['map'](_0x2b4d84[_0xe916('0x3e')],function(_0x14aa94){var _0x27846a={};_0x27846a[_0x14aa94]={'$like':'%'+_0x26ea48[_0xe916('0x3b')][_0xe916('0x46')]+'%'};return _0x27846a;})});}_0x2b4d84=_[_0xe916('0x47')]({},_0x2b4d84,_0x26ea48['options']);return _0x176430[_0xe916('0x57')](_0x2b4d84);}})['then'](function(_0x576e21){if(_0x576e21){_0x4c8350=_0x576e21[_0xe916('0x40')];if(!_0x26ea48[_0xe916('0x3b')][_0xe916('0x56')](_0xe916('0x41'))){_0x2b4d84['limit']=qs[_0xe916('0x2c')](_0x26ea48[_0xe916('0x3b')][_0xe916('0x2c')]);_0x2b4d84[_0xe916('0x2b')]=qs['offset'](_0x26ea48['query'][_0xe916('0x2b')]);}return _0x176430[_0xe916('0x57')](_0x2b4d84);}})[_0xe916('0x1c')](function(_0x40451f){if(_0x40451f){return _0x40451f?{'count':_0x4c8350,'rows':_0x40451f}:null;}})[_0xe916('0x1c')](respondWithResult(_0x1d605f,null))[_0xe916('0x26')](handleError(_0x1d605f,null));};exports['getDescriptions']=function(_0x17fa65,_0x4d67a1,_0x9f33b1){var _0x2fac18={};var _0x2d772c={};var _0xfa1274;var _0x97aa53;return db[_0xe916('0x34')][_0xe916('0x55')]({'where':{'id':_0x17fa65[_0xe916('0x52')]['id']}})[_0xe916('0x1c')](handleEntityNotFound(_0x4d67a1,null))['then'](function(_0x35bbe6){if(_0x35bbe6){_0xfa1274=_0x35bbe6;_0x2d772c[_0xe916('0x39')]=_[_0xe916('0x4c')](db[_0xe916('0x58')][_0xe916('0x35')]);_0x2d772c[_0xe916('0x3b')]=_['keys'](_0x17fa65[_0xe916('0x3b')]);_0x2d772c[_0xe916('0x3c')]=_[_0xe916('0x3d')](_0x2d772c[_0xe916('0x39')],_0x2d772c[_0xe916('0x3b')]);_0x2fac18['attributes']=_[_0xe916('0x3d')](_0x2d772c[_0xe916('0x39')],qs[_0xe916('0x3f')](_0x17fa65[_0xe916('0x3b')][_0xe916('0x3f')]));_0x2fac18[_0xe916('0x3e')]=_0x2fac18[_0xe916('0x3e')]['length']?_0x2fac18[_0xe916('0x3e')]:_0x2d772c[_0xe916('0x39')];_0x2fac18[_0xe916('0x42')]=qs[_0xe916('0x43')](_0x17fa65['query'][_0xe916('0x43')]);_0x2fac18[_0xe916('0x44')]=qs[_0xe916('0x3c')](_[_0xe916('0x45')](_0x17fa65[_0xe916('0x3b')],_0x2d772c[_0xe916('0x3c')]));if(_0x17fa65[_0xe916('0x3b')][_0xe916('0x46')]){_0x2fac18[_0xe916('0x44')]=_[_0xe916('0x47')](_0x2fac18['where'],{'$or':_[_0xe916('0x3a')](_0x2fac18[_0xe916('0x3e')],function(_0x112f36){var _0x2b3e25={};_0x2b3e25[_0x112f36]={'$like':'%'+_0x17fa65[_0xe916('0x3b')][_0xe916('0x46')]+'%'};return _0x2b3e25;})});}_0x2fac18=_[_0xe916('0x47')]({},_0x2fac18,_0x17fa65['options']);return _0xfa1274[_0xe916('0x59')](_0x2fac18);}})[_0xe916('0x1c')](function(_0x457fe9){if(_0x457fe9){_0x97aa53=_0x457fe9[_0xe916('0x40')];if(!_0x17fa65[_0xe916('0x3b')][_0xe916('0x56')]('nolimit')){_0x2fac18[_0xe916('0x2c')]=qs[_0xe916('0x2c')](_0x17fa65[_0xe916('0x3b')][_0xe916('0x2c')]);_0x2fac18['offset']=qs['offset'](_0x17fa65[_0xe916('0x3b')][_0xe916('0x2b')]);}return _0xfa1274['getDescriptions'](_0x2fac18);}})[_0xe916('0x1c')](function(_0x554e06){if(_0x554e06){return _0x554e06?{'count':_0x97aa53,'rows':_0x554e06}:null;}})[_0xe916('0x1c')](respondWithResult(_0x4d67a1,null))[_0xe916('0x26')](handleError(_0x4d67a1,null));};exports[_0xe916('0x5a')]=function(_0xe6a9a7,_0xfe8f03,_0x438c7a){var _0x3d93b4={};var _0x18fa69={};var _0x2bc899;var _0x32a6d2;return db['ZendeskConfiguration'][_0xe916('0x55')]({'where':{'id':_0xe6a9a7[_0xe916('0x52')]['id']}})[_0xe916('0x1c')](handleEntityNotFound(_0xfe8f03,null))['then'](function(_0x178c20){if(_0x178c20){_0x2bc899=_0x178c20;_0x18fa69[_0xe916('0x39')]=_[_0xe916('0x4c')](db[_0xe916('0x5b')]['rawAttributes']);_0x18fa69[_0xe916('0x3b')]=_['keys'](_0xe6a9a7[_0xe916('0x3b')]);_0x18fa69[_0xe916('0x3c')]=_['intersection'](_0x18fa69[_0xe916('0x39')],_0x18fa69[_0xe916('0x3b')]);_0x3d93b4[_0xe916('0x3e')]=_[_0xe916('0x3d')](_0x18fa69[_0xe916('0x39')],qs[_0xe916('0x3f')](_0xe6a9a7[_0xe916('0x3b')][_0xe916('0x3f')]));_0x3d93b4[_0xe916('0x3e')]=_0x3d93b4[_0xe916('0x3e')][_0xe916('0x40')]?_0x3d93b4[_0xe916('0x3e')]:_0x18fa69[_0xe916('0x39')];_0x3d93b4['order']=qs[_0xe916('0x43')](_0xe6a9a7[_0xe916('0x3b')][_0xe916('0x43')]);_0x3d93b4[_0xe916('0x44')]=qs[_0xe916('0x3c')](_[_0xe916('0x45')](_0xe6a9a7[_0xe916('0x3b')],_0x18fa69[_0xe916('0x3c')]));if(_0xe6a9a7[_0xe916('0x3b')][_0xe916('0x46')]){_0x3d93b4[_0xe916('0x44')]=_[_0xe916('0x47')](_0x3d93b4[_0xe916('0x44')],{'$or':_[_0xe916('0x3a')](_0x3d93b4[_0xe916('0x3e')],function(_0x1dee3e){var _0x26611a={};_0x26611a[_0x1dee3e]={'$like':'%'+_0xe6a9a7['query']['filter']+'%'};return _0x26611a;})});}_0x3d93b4=_['merge']({},_0x3d93b4,_0xe6a9a7[_0xe916('0x4d')]);return _0x2bc899[_0xe916('0x5a')](_0x3d93b4);}})[_0xe916('0x1c')](function(_0x43a779){if(_0x43a779){_0x32a6d2=_0x43a779[_0xe916('0x40')];if(!_0xe6a9a7['query'][_0xe916('0x56')]('nolimit')){_0x3d93b4[_0xe916('0x2c')]=qs['limit'](_0xe6a9a7['query'][_0xe916('0x2c')]);_0x3d93b4[_0xe916('0x2b')]=qs[_0xe916('0x2b')](_0xe6a9a7['query'][_0xe916('0x2b')]);}return _0x2bc899['getTags'](_0x3d93b4);}})[_0xe916('0x1c')](function(_0x543c8c){if(_0x543c8c){return _0x543c8c?{'count':_0x32a6d2,'rows':_0x543c8c}:null;}})[_0xe916('0x1c')](respondWithResult(_0xfe8f03,null))[_0xe916('0x26')](handleError(_0xfe8f03,null));};exports['setTags']=function(_0x406678,_0x5552f6,_0x5876b7){if(_0x406678[_0xe916('0x50')]['id']){delete _0x406678[_0xe916('0x50')]['id'];}return db['ZendeskConfiguration'][_0xe916('0x55')]({'where':{'id':_0x406678[_0xe916('0x52')]['id']}})[_0xe916('0x1c')](handleEntityNotFound(_0x5552f6,null))[_0xe916('0x1c')](function(_0x498eac){if(_0x498eac){return _0x498eac[_0xe916('0x5c')](_0x406678[_0xe916('0x50')]['ids']||[]);}return null;})[_0xe916('0x1c')](respondWithResult(_0x5552f6,null))[_0xe916('0x26')](handleError(_0x5552f6,null));}; \ No newline at end of file +var _0xff0a=['rows','show','find','create','body','params','getFields','findOne','pick','getSubjects','ZendeskField','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff0a,0x183));var _0xaff0=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xff0a[_0x122096];return _0x3d1966;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaff0('0x0'));var zipdir=require(_0xaff0('0x1'));var jsonpatch=require(_0xaff0('0x2'));var rp=require(_0xaff0('0x3'));var moment=require(_0xaff0('0x4'));var BPromise=require(_0xaff0('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xaff0('0x6'));var ejs=require(_0xaff0('0x7'));var fs=require('fs');var fs_extra=require(_0xaff0('0x8'));var _=require(_0xaff0('0x9'));var squel=require(_0xaff0('0xa'));var crypto=require('crypto');var jsforce=require(_0xaff0('0xb'));var deskjs=require(_0xaff0('0xc'));var toCsv=require('to-csv');var querystring=require(_0xaff0('0xd'));var Papa=require(_0xaff0('0xe'));var Redis=require(_0xaff0('0xf'));var authService=require(_0xaff0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xaff0('0x11'));var hardwareService=require(_0xaff0('0x12'));var logger=require('../../config/logger')(_0xaff0('0x13'));var utils=require(_0xaff0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xaff0('0x15'));var db=require(_0xaff0('0x16'))['db'];var jayson=require(_0xaff0('0x17'));var client=jayson[_0xaff0('0x18')][_0xaff0('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3e64df,_0x1416ea,_0x335fc3,_0x355714){return new BPromise(function(_0x1187e0,_0x5de59f){var _0x603c66=_0x355714||client;return _0x603c66[_0xaff0('0x1a')](_0x3e64df,_0x335fc3)[_0xaff0('0x1b')](function(_0x413265){logger[_0xaff0('0x1c')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1416ea,_0xaff0('0x1d'));logger['debug'](_0xaff0('0x1e'),_0x1416ea,_0xaff0('0x1d'),JSON['stringify'](_0x413265));if(_0x413265['error']){if(_0x413265[_0xaff0('0x1f')][_0xaff0('0x20')]===0x1f4){logger[_0xaff0('0x1f')](_0xaff0('0x21'),_0x1416ea,_0x413265[_0xaff0('0x1f')][_0xaff0('0x22')]);return _0x5de59f(_0x413265[_0xaff0('0x1f')][_0xaff0('0x22')]);}logger[_0xaff0('0x1f')](_0xaff0('0x21'),_0x1416ea,_0x413265[_0xaff0('0x1f')][_0xaff0('0x22')]);return _0x1187e0(_0x413265['error'][_0xaff0('0x22')]);}else{logger[_0xaff0('0x1c')](_0xaff0('0x21'),_0x1416ea,'request\x20sent');_0x1187e0(_0x413265[_0xaff0('0x23')][_0xaff0('0x22')]);}})[_0xaff0('0x24')](function(_0x294b46){logger[_0xaff0('0x1f')](_0xaff0('0x21'),_0x1416ea,_0x294b46);_0x5de59f(_0x294b46);});});}function respondWithStatusCode(_0x47799e,_0x4a43d2){_0x4a43d2=_0x4a43d2||0xcc;return function(_0x10a584){if(_0x10a584){return _0x47799e[_0xaff0('0x25')](_0x4a43d2);}return _0x47799e[_0xaff0('0x26')](_0x4a43d2)[_0xaff0('0x27')]();};}function respondWithResult(_0x5c6631,_0xf47e40){_0xf47e40=_0xf47e40||0xc8;return function(_0x1e1ac2){if(_0x1e1ac2){return _0x5c6631[_0xaff0('0x26')](_0xf47e40)['json'](_0x1e1ac2);}};}function respondWithFilteredResult(_0x2a9fa8,_0x5542ff){return function(_0x2a01dc){if(_0x2a01dc){var _0xf93421=_0x2a01dc[_0xaff0('0x28')],_0x212d01=_0x5542ff['offset'],_0x528ac9=_0x5542ff[_0xaff0('0x29')]+_0x5542ff[_0xaff0('0x2a')],_0x6e9ecb;if(_0x528ac9>=_0xf93421){_0x528ac9=_0xf93421;_0x6e9ecb=0xc8;}else{_0x6e9ecb=0xce;}_0x2a9fa8[_0xaff0('0x26')](_0x6e9ecb);return _0x2a9fa8[_0xaff0('0x2b')](_0xaff0('0x2c'),_0x212d01+'-'+_0x528ac9+'/'+_0xf93421)[_0xaff0('0x2d')](_0x2a01dc);}return null;};}function patchUpdates(_0x10fce3){return function(_0x2e9b6d){try{jsonpatch['apply'](_0x2e9b6d,_0x10fce3,!![]);}catch(_0x171f04){return BPromise[_0xaff0('0x2e')](_0x171f04);}return _0x2e9b6d[_0xaff0('0x2f')]();};}function saveUpdates(_0x265027,_0x4ec30d){return function(_0x2ba15c){if(_0x2ba15c){return _0x2ba15c[_0xaff0('0x30')](_0x265027)[_0xaff0('0x1b')](function(_0xecf28b){return _0xecf28b;});}return null;};}function removeEntity(_0x263015,_0x39d251){return function(_0x4af711){if(_0x4af711){return _0x4af711[_0xaff0('0x31')]()[_0xaff0('0x1b')](function(){_0x263015[_0xaff0('0x26')](0xcc)[_0xaff0('0x27')]();});}};}function handleEntityNotFound(_0xb6121,_0x30054d){return function(_0x160a6c){if(!_0x160a6c){_0xb6121[_0xaff0('0x25')](0x194);}return _0x160a6c;};}function handleError(_0x3a22c1,_0x3a8209){_0x3a8209=_0x3a8209||0x1f4;return function(_0x3104d7){logger[_0xaff0('0x1f')](_0x3104d7[_0xaff0('0x32')]);if(_0x3104d7[_0xaff0('0x33')]){delete _0x3104d7[_0xaff0('0x33')];}_0x3a22c1[_0xaff0('0x26')](_0x3a8209)['send'](_0x3104d7);};}exports[_0xaff0('0x34')]=function(_0x2368f9,_0x3362a2){var _0x48a0be={},_0x46e06e={},_0x10a603={'count':0x0,'rows':[]};var _0x5f2d96=_[_0xaff0('0x35')](db[_0xaff0('0x36')][_0xaff0('0x37')],function(_0x106c43){return{'name':_0x106c43[_0xaff0('0x38')],'type':_0x106c43['type'][_0xaff0('0x39')]};});_0x46e06e[_0xaff0('0x3a')]=_[_0xaff0('0x35')](_0x5f2d96,'name');_0x46e06e[_0xaff0('0x3b')]=_[_0xaff0('0x3c')](_0x2368f9[_0xaff0('0x3b')]);_0x46e06e[_0xaff0('0x3d')]=_[_0xaff0('0x3e')](_0x46e06e['model'],_0x46e06e[_0xaff0('0x3b')]);_0x48a0be[_0xaff0('0x3f')]=_[_0xaff0('0x3e')](_0x46e06e['model'],qs['fields'](_0x2368f9['query'][_0xaff0('0x40')]));_0x48a0be[_0xaff0('0x3f')]=_0x48a0be[_0xaff0('0x3f')][_0xaff0('0x41')]?_0x48a0be['attributes']:_0x46e06e[_0xaff0('0x3a')];if(!_0x2368f9[_0xaff0('0x3b')][_0xaff0('0x42')](_0xaff0('0x43'))){_0x48a0be[_0xaff0('0x2a')]=qs['limit'](_0x2368f9[_0xaff0('0x3b')][_0xaff0('0x2a')]);_0x48a0be['offset']=qs[_0xaff0('0x29')](_0x2368f9[_0xaff0('0x3b')]['offset']);}_0x48a0be[_0xaff0('0x44')]=qs[_0xaff0('0x45')](_0x2368f9[_0xaff0('0x3b')][_0xaff0('0x45')]);_0x48a0be['where']=qs[_0xaff0('0x3d')](_['pick'](_0x2368f9[_0xaff0('0x3b')],_0x46e06e[_0xaff0('0x3d')]),_0x5f2d96);if(_0x2368f9[_0xaff0('0x3b')][_0xaff0('0x46')]){_0x48a0be[_0xaff0('0x47')]=_['merge'](_0x48a0be[_0xaff0('0x47')],{'$or':_[_0xaff0('0x35')](_0x5f2d96,function(_0x59dc21){if(_0x59dc21['type']!==_0xaff0('0x48')){var _0x594a41={};_0x594a41[_0x59dc21[_0xaff0('0x33')]]={'$like':'%'+_0x2368f9[_0xaff0('0x3b')][_0xaff0('0x46')]+'%'};return _0x594a41;}})});}_0x48a0be=_[_0xaff0('0x49')]({},_0x48a0be,_0x2368f9[_0xaff0('0x4a')]);var _0x5a17ae={'where':_0x48a0be[_0xaff0('0x47')]};return db[_0xaff0('0x36')][_0xaff0('0x28')](_0x5a17ae)['then'](function(_0x15b884){_0x10a603[_0xaff0('0x28')]=_0x15b884;if(_0x2368f9['query'][_0xaff0('0x4b')]){_0x48a0be[_0xaff0('0x4c')]=[{'all':!![]}];}return db[_0xaff0('0x36')][_0xaff0('0x4d')](_0x48a0be);})[_0xaff0('0x1b')](function(_0x29a191){_0x10a603[_0xaff0('0x4e')]=_0x29a191;return _0x10a603;})[_0xaff0('0x1b')](respondWithFilteredResult(_0x3362a2,_0x48a0be))['catch'](handleError(_0x3362a2,null));};exports[_0xaff0('0x4f')]=function(_0x3c399b,_0x298a72){var _0x13c5a1={'raw':![],'where':{'id':_0x3c399b['params']['id']}},_0x26cf5f={};_0x26cf5f['model']=_[_0xaff0('0x3c')](db['ZendeskConfiguration']['rawAttributes']);_0x26cf5f[_0xaff0('0x3b')]=_['keys'](_0x3c399b[_0xaff0('0x3b')]);_0x26cf5f[_0xaff0('0x3d')]=_[_0xaff0('0x3e')](_0x26cf5f[_0xaff0('0x3a')],_0x26cf5f[_0xaff0('0x3b')]);_0x13c5a1[_0xaff0('0x3f')]=_['intersection'](_0x26cf5f[_0xaff0('0x3a')],qs['fields'](_0x3c399b[_0xaff0('0x3b')][_0xaff0('0x40')]));_0x13c5a1[_0xaff0('0x3f')]=_0x13c5a1['attributes'][_0xaff0('0x41')]?_0x13c5a1[_0xaff0('0x3f')]:_0x26cf5f[_0xaff0('0x3a')];if(_0x3c399b[_0xaff0('0x3b')][_0xaff0('0x4b')]){_0x13c5a1[_0xaff0('0x4c')]=[{'all':!![]}];}_0x13c5a1=_[_0xaff0('0x49')]({},_0x13c5a1,_0x3c399b['options']);return db[_0xaff0('0x36')][_0xaff0('0x50')](_0x13c5a1)[_0xaff0('0x1b')](handleEntityNotFound(_0x298a72,null))['then'](respondWithResult(_0x298a72,null))[_0xaff0('0x24')](handleError(_0x298a72,null));};exports['create']=function(_0x309aeb,_0x27dbe4){return db['ZendeskConfiguration'][_0xaff0('0x51')](_0x309aeb[_0xaff0('0x52')],{})[_0xaff0('0x1b')](respondWithResult(_0x27dbe4,0xc9))[_0xaff0('0x24')](handleError(_0x27dbe4,null));};exports['update']=function(_0x2847ee,_0x49106a){if(_0x2847ee[_0xaff0('0x52')]['id']){delete _0x2847ee[_0xaff0('0x52')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x2847ee[_0xaff0('0x53')]['id']}})[_0xaff0('0x1b')](handleEntityNotFound(_0x49106a,null))[_0xaff0('0x1b')](saveUpdates(_0x2847ee[_0xaff0('0x52')],null))[_0xaff0('0x1b')](respondWithResult(_0x49106a,null))[_0xaff0('0x24')](handleError(_0x49106a,null));};exports[_0xaff0('0x31')]=function(_0x784d09,_0x2d7af2){return db[_0xaff0('0x36')][_0xaff0('0x50')]({'where':{'id':_0x784d09[_0xaff0('0x53')]['id']}})[_0xaff0('0x1b')](handleEntityNotFound(_0x2d7af2,null))[_0xaff0('0x1b')](removeEntity(_0x2d7af2,null))[_0xaff0('0x24')](handleError(_0x2d7af2,null));};exports[_0xaff0('0x54')]=function(_0x1ae71c,_0x3c2fb9,_0x1bf14a){var _0x1f6096={};var _0x2cd9d7={};var _0x56475f;var _0x118994;return db[_0xaff0('0x36')][_0xaff0('0x55')]({'where':{'id':_0x1ae71c[_0xaff0('0x53')]['id']}})[_0xaff0('0x1b')](handleEntityNotFound(_0x3c2fb9,null))[_0xaff0('0x1b')](function(_0x5b6271){if(_0x5b6271){_0x56475f=_0x5b6271;_0x2cd9d7[_0xaff0('0x3a')]=_['keys'](db['ZendeskField'][_0xaff0('0x37')]);_0x2cd9d7[_0xaff0('0x3b')]=_[_0xaff0('0x3c')](_0x1ae71c[_0xaff0('0x3b')]);_0x2cd9d7[_0xaff0('0x3d')]=_[_0xaff0('0x3e')](_0x2cd9d7[_0xaff0('0x3a')],_0x2cd9d7['query']);_0x1f6096[_0xaff0('0x3f')]=_[_0xaff0('0x3e')](_0x2cd9d7[_0xaff0('0x3a')],qs[_0xaff0('0x40')](_0x1ae71c['query']['fields']));_0x1f6096[_0xaff0('0x3f')]=_0x1f6096['attributes'][_0xaff0('0x41')]?_0x1f6096[_0xaff0('0x3f')]:_0x2cd9d7['model'];_0x1f6096[_0xaff0('0x44')]=qs[_0xaff0('0x45')](_0x1ae71c[_0xaff0('0x3b')]['sort']);_0x1f6096[_0xaff0('0x47')]=qs[_0xaff0('0x3d')](_[_0xaff0('0x56')](_0x1ae71c[_0xaff0('0x3b')],_0x2cd9d7[_0xaff0('0x3d')]));if(_0x1ae71c['query'][_0xaff0('0x46')]){_0x1f6096[_0xaff0('0x47')]=_['merge'](_0x1f6096['where'],{'$or':_[_0xaff0('0x35')](_0x1f6096[_0xaff0('0x3f')],function(_0x5b5470){var _0x3f1fa2={};_0x3f1fa2[_0x5b5470]={'$like':'%'+_0x1ae71c[_0xaff0('0x3b')][_0xaff0('0x46')]+'%'};return _0x3f1fa2;})});}_0x1f6096=_[_0xaff0('0x49')]({},_0x1f6096,_0x1ae71c['options']);return _0x56475f['getFields'](_0x1f6096);}})[_0xaff0('0x1b')](function(_0x35d013){if(_0x35d013){_0x118994=_0x35d013[_0xaff0('0x41')];if(!_0x1ae71c[_0xaff0('0x3b')][_0xaff0('0x42')]('nolimit')){_0x1f6096[_0xaff0('0x2a')]=qs[_0xaff0('0x2a')](_0x1ae71c[_0xaff0('0x3b')]['limit']);_0x1f6096[_0xaff0('0x29')]=qs[_0xaff0('0x29')](_0x1ae71c[_0xaff0('0x3b')]['offset']);}return _0x56475f[_0xaff0('0x54')](_0x1f6096);}})[_0xaff0('0x1b')](function(_0xc28c7f){if(_0xc28c7f){return _0xc28c7f?{'count':_0x118994,'rows':_0xc28c7f}:null;}})[_0xaff0('0x1b')](respondWithResult(_0x3c2fb9,null))[_0xaff0('0x24')](handleError(_0x3c2fb9,null));};exports[_0xaff0('0x57')]=function(_0x51e2f4,_0x3d2d4f,_0x17e7e3){var _0x3e1b16={};var _0x560f09={};var _0x386e50;var _0x566018;return db[_0xaff0('0x36')]['findOne']({'where':{'id':_0x51e2f4[_0xaff0('0x53')]['id']}})[_0xaff0('0x1b')](handleEntityNotFound(_0x3d2d4f,null))['then'](function(_0x4bef1d){if(_0x4bef1d){_0x386e50=_0x4bef1d;_0x560f09[_0xaff0('0x3a')]=_[_0xaff0('0x3c')](db[_0xaff0('0x58')][_0xaff0('0x37')]);_0x560f09['query']=_[_0xaff0('0x3c')](_0x51e2f4['query']);_0x560f09[_0xaff0('0x3d')]=_[_0xaff0('0x3e')](_0x560f09[_0xaff0('0x3a')],_0x560f09['query']);_0x3e1b16[_0xaff0('0x3f')]=_['intersection'](_0x560f09[_0xaff0('0x3a')],qs[_0xaff0('0x40')](_0x51e2f4[_0xaff0('0x3b')][_0xaff0('0x40')]));_0x3e1b16['attributes']=_0x3e1b16['attributes'][_0xaff0('0x41')]?_0x3e1b16['attributes']:_0x560f09[_0xaff0('0x3a')];_0x3e1b16['order']=qs[_0xaff0('0x45')](_0x51e2f4[_0xaff0('0x3b')][_0xaff0('0x45')]);_0x3e1b16[_0xaff0('0x47')]=qs['filters'](_[_0xaff0('0x56')](_0x51e2f4['query'],_0x560f09[_0xaff0('0x3d')]));if(_0x51e2f4[_0xaff0('0x3b')]['filter']){_0x3e1b16[_0xaff0('0x47')]=_[_0xaff0('0x49')](_0x3e1b16[_0xaff0('0x47')],{'$or':_[_0xaff0('0x35')](_0x3e1b16[_0xaff0('0x3f')],function(_0x760479){var _0x2d0aba={};_0x2d0aba[_0x760479]={'$like':'%'+_0x51e2f4[_0xaff0('0x3b')]['filter']+'%'};return _0x2d0aba;})});}_0x3e1b16=_['merge']({},_0x3e1b16,_0x51e2f4[_0xaff0('0x4a')]);return _0x386e50[_0xaff0('0x57')](_0x3e1b16);}})['then'](function(_0x519714){if(_0x519714){_0x566018=_0x519714[_0xaff0('0x41')];if(!_0x51e2f4[_0xaff0('0x3b')][_0xaff0('0x42')](_0xaff0('0x43'))){_0x3e1b16[_0xaff0('0x2a')]=qs['limit'](_0x51e2f4[_0xaff0('0x3b')]['limit']);_0x3e1b16[_0xaff0('0x29')]=qs[_0xaff0('0x29')](_0x51e2f4['query'][_0xaff0('0x29')]);}return _0x386e50[_0xaff0('0x57')](_0x3e1b16);}})[_0xaff0('0x1b')](function(_0x36c0bd){if(_0x36c0bd){return _0x36c0bd?{'count':_0x566018,'rows':_0x36c0bd}:null;}})[_0xaff0('0x1b')](respondWithResult(_0x3d2d4f,null))[_0xaff0('0x24')](handleError(_0x3d2d4f,null));};exports[_0xaff0('0x59')]=function(_0x3b9c70,_0x17201c,_0x581bbe){var _0x55a7ac={};var _0x223ff6={};var _0x1faf25;var _0x33a091;return db[_0xaff0('0x36')][_0xaff0('0x55')]({'where':{'id':_0x3b9c70[_0xaff0('0x53')]['id']}})['then'](handleEntityNotFound(_0x17201c,null))[_0xaff0('0x1b')](function(_0x5de574){if(_0x5de574){_0x1faf25=_0x5de574;_0x223ff6[_0xaff0('0x3a')]=_[_0xaff0('0x3c')](db[_0xaff0('0x58')][_0xaff0('0x37')]);_0x223ff6[_0xaff0('0x3b')]=_['keys'](_0x3b9c70[_0xaff0('0x3b')]);_0x223ff6['filters']=_['intersection'](_0x223ff6[_0xaff0('0x3a')],_0x223ff6[_0xaff0('0x3b')]);_0x55a7ac[_0xaff0('0x3f')]=_['intersection'](_0x223ff6[_0xaff0('0x3a')],qs[_0xaff0('0x40')](_0x3b9c70[_0xaff0('0x3b')][_0xaff0('0x40')]));_0x55a7ac[_0xaff0('0x3f')]=_0x55a7ac['attributes'][_0xaff0('0x41')]?_0x55a7ac[_0xaff0('0x3f')]:_0x223ff6[_0xaff0('0x3a')];_0x55a7ac['order']=qs[_0xaff0('0x45')](_0x3b9c70[_0xaff0('0x3b')][_0xaff0('0x45')]);_0x55a7ac[_0xaff0('0x47')]=qs['filters'](_[_0xaff0('0x56')](_0x3b9c70['query'],_0x223ff6[_0xaff0('0x3d')]));if(_0x3b9c70['query'][_0xaff0('0x46')]){_0x55a7ac[_0xaff0('0x47')]=_['merge'](_0x55a7ac['where'],{'$or':_[_0xaff0('0x35')](_0x55a7ac[_0xaff0('0x3f')],function(_0x15c5b2){var _0x3eb044={};_0x3eb044[_0x15c5b2]={'$like':'%'+_0x3b9c70[_0xaff0('0x3b')][_0xaff0('0x46')]+'%'};return _0x3eb044;})});}_0x55a7ac=_[_0xaff0('0x49')]({},_0x55a7ac,_0x3b9c70['options']);return _0x1faf25[_0xaff0('0x59')](_0x55a7ac);}})[_0xaff0('0x1b')](function(_0x276ff2){if(_0x276ff2){_0x33a091=_0x276ff2['length'];if(!_0x3b9c70[_0xaff0('0x3b')][_0xaff0('0x42')](_0xaff0('0x43'))){_0x55a7ac[_0xaff0('0x2a')]=qs['limit'](_0x3b9c70[_0xaff0('0x3b')]['limit']);_0x55a7ac[_0xaff0('0x29')]=qs[_0xaff0('0x29')](_0x3b9c70['query']['offset']);}return _0x1faf25[_0xaff0('0x59')](_0x55a7ac);}})[_0xaff0('0x1b')](function(_0x1333c4){if(_0x1333c4){return _0x1333c4?{'count':_0x33a091,'rows':_0x1333c4}:null;}})[_0xaff0('0x1b')](respondWithResult(_0x17201c,null))[_0xaff0('0x24')](handleError(_0x17201c,null));};exports[_0xaff0('0x5a')]=function(_0x1e58de,_0x26658e,_0x3a88db){var _0x5ac6e9={};var _0x9e136e={};var _0x33d7ee;var _0x514bc5;return db[_0xaff0('0x36')]['findOne']({'where':{'id':_0x1e58de[_0xaff0('0x53')]['id']}})['then'](handleEntityNotFound(_0x26658e,null))[_0xaff0('0x1b')](function(_0x3c2705){if(_0x3c2705){_0x33d7ee=_0x3c2705;_0x9e136e[_0xaff0('0x3a')]=_[_0xaff0('0x3c')](db['Tag']['rawAttributes']);_0x9e136e[_0xaff0('0x3b')]=_['keys'](_0x1e58de[_0xaff0('0x3b')]);_0x9e136e[_0xaff0('0x3d')]=_[_0xaff0('0x3e')](_0x9e136e[_0xaff0('0x3a')],_0x9e136e[_0xaff0('0x3b')]);_0x5ac6e9[_0xaff0('0x3f')]=_[_0xaff0('0x3e')](_0x9e136e[_0xaff0('0x3a')],qs[_0xaff0('0x40')](_0x1e58de['query'][_0xaff0('0x40')]));_0x5ac6e9[_0xaff0('0x3f')]=_0x5ac6e9['attributes']['length']?_0x5ac6e9['attributes']:_0x9e136e[_0xaff0('0x3a')];_0x5ac6e9[_0xaff0('0x44')]=qs[_0xaff0('0x45')](_0x1e58de[_0xaff0('0x3b')][_0xaff0('0x45')]);_0x5ac6e9[_0xaff0('0x47')]=qs[_0xaff0('0x3d')](_['pick'](_0x1e58de['query'],_0x9e136e[_0xaff0('0x3d')]));if(_0x1e58de[_0xaff0('0x3b')][_0xaff0('0x46')]){_0x5ac6e9[_0xaff0('0x47')]=_[_0xaff0('0x49')](_0x5ac6e9['where'],{'$or':_['map'](_0x5ac6e9[_0xaff0('0x3f')],function(_0x17ea90){var _0x5d5509={};_0x5d5509[_0x17ea90]={'$like':'%'+_0x1e58de[_0xaff0('0x3b')][_0xaff0('0x46')]+'%'};return _0x5d5509;})});}_0x5ac6e9=_['merge']({},_0x5ac6e9,_0x1e58de[_0xaff0('0x4a')]);return _0x33d7ee[_0xaff0('0x5a')](_0x5ac6e9);}})[_0xaff0('0x1b')](function(_0x6fef09){if(_0x6fef09){_0x514bc5=_0x6fef09[_0xaff0('0x41')];if(!_0x1e58de[_0xaff0('0x3b')][_0xaff0('0x42')](_0xaff0('0x43'))){_0x5ac6e9['limit']=qs['limit'](_0x1e58de['query'][_0xaff0('0x2a')]);_0x5ac6e9[_0xaff0('0x29')]=qs[_0xaff0('0x29')](_0x1e58de['query']['offset']);}return _0x33d7ee[_0xaff0('0x5a')](_0x5ac6e9);}})[_0xaff0('0x1b')](function(_0x338f55){if(_0x338f55){return _0x338f55?{'count':_0x514bc5,'rows':_0x338f55}:null;}})[_0xaff0('0x1b')](respondWithResult(_0x26658e,null))[_0xaff0('0x24')](handleError(_0x26658e,null));};exports[_0xaff0('0x5b')]=function(_0x3e1508,_0x257ae3,_0x555c50){if(_0x3e1508[_0xaff0('0x52')]['id']){delete _0x3e1508[_0xaff0('0x52')]['id'];}return db[_0xaff0('0x36')]['findOne']({'where':{'id':_0x3e1508['params']['id']}})[_0xaff0('0x1b')](handleEntityNotFound(_0x257ae3,null))[_0xaff0('0x1b')](function(_0x37b212){if(_0x37b212){return _0x37b212[_0xaff0('0x5b')](_0x3e1508[_0xaff0('0x52')][_0xaff0('0x5c')]||[]);}return null;})['then'](respondWithResult(_0x257ae3,null))[_0xaff0('0x24')](handleError(_0x257ae3,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 2f28829..9db5093 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 _0x3602=['request-promise','path','rimraf','../../config/environment','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2e13c4,_0x5749d8){var _0x3bccdc=function(_0x4bf110){while(--_0x4bf110){_0x2e13c4['push'](_0x2e13c4['shift']());}};_0x3bccdc(++_0x5749d8);}(_0x3602,0x13f));var _0x2360=function(_0x190bde,_0x61f44d){_0x190bde=_0x190bde-0x0;var _0x10f6c4=_0x3602[_0x190bde];return _0x10f6c4;};'use strict';var _=require(_0x2360('0x0'));var util=require(_0x2360('0x1'));var logger=require(_0x2360('0x2'))(_0x2360('0x3'));var moment=require(_0x2360('0x4'));var BPromise=require(_0x2360('0x5'));var rp=require(_0x2360('0x6'));var fs=require('fs');var path=require(_0x2360('0x7'));var rimraf=require(_0x2360('0x8'));var config=require(_0x2360('0x9'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x2360('0xa')]=function(_0x3c0481,_0x2cdbd9){return _0x3c0481['define'](_0x2360('0xb'),attributes,{'tableName':_0x2360('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc786=['moment','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api'];(function(_0xc769bd,_0x6dee19){var _0x55d784=function(_0x15e491){while(--_0x15e491){_0xc769bd['push'](_0xc769bd['shift']());}};_0x55d784(++_0x6dee19);}(_0xc786,0x111));var _0x6c78=function(_0x2052be,_0x541a2e){_0x2052be=_0x2052be-0x0;var _0x34cfe4=_0xc786[_0x2052be];return _0x34cfe4;};'use strict';var _=require(_0x6c78('0x0'));var util=require(_0x6c78('0x1'));var logger=require('../../config/logger')(_0x6c78('0x2'));var moment=require(_0x6c78('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c78('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c78('0x5'));var config=require(_0x6c78('0x6'));var attributes=require(_0x6c78('0x7'));module[_0x6c78('0x8')]=function(_0x5ebc43,_0x2a087a){return _0x5ebc43[_0x6c78('0x9')](_0x6c78('0xa'),attributes,{'tableName':_0x6c78('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index ec32ca1..45a7930 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 _0xc2eb=['lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch'];(function(_0x5b1430,_0x1ec89e){var _0xa2864a=function(_0x339aec){while(--_0x339aec){_0x5b1430['push'](_0x5b1430['shift']());}};_0xa2864a(++_0x1ec89e);}(_0xc2eb,0x1a2));var _0xbc2e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xc2eb[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xbc2e('0x0'));var util=require(_0xbc2e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbc2e('0x2'));var db=require(_0xbc2e('0x3'))['db'];var utils=require(_0xbc2e('0x4'));var logger=require(_0xbc2e('0x5'))(_0xbc2e('0x6'));var config=require('../../config/environment');var jayson=require(_0xbc2e('0x7'));var client=jayson[_0xbc2e('0x8')][_0xbc2e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f35c6,_0x4136c2,_0x47c440){return new BPromise(function(_0x18e1fe,_0x11b5cc){return client[_0xbc2e('0xa')](_0x3f35c6,_0x47c440)['then'](function(_0xb35ded){logger[_0xbc2e('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4136c2,_0xbc2e('0xc'));logger[_0xbc2e('0xd')](_0xbc2e('0xe'),_0x4136c2,_0xbc2e('0xc'),JSON[_0xbc2e('0xf')](_0xb35ded));if(_0xb35ded['error']){if(_0xb35ded[_0xbc2e('0x10')][_0xbc2e('0x11')]===0x1f4){logger['error'](_0xbc2e('0x12'),_0x4136c2,_0xb35ded[_0xbc2e('0x10')][_0xbc2e('0x13')]);return _0x11b5cc(_0xb35ded[_0xbc2e('0x10')]['message']);}logger[_0xbc2e('0x10')](_0xbc2e('0x12'),_0x4136c2,_0xb35ded[_0xbc2e('0x10')][_0xbc2e('0x13')]);return _0x18e1fe(_0xb35ded[_0xbc2e('0x10')][_0xbc2e('0x13')]);}else{logger[_0xbc2e('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4136c2,_0xbc2e('0xc'));_0x18e1fe(_0xb35ded[_0xbc2e('0x14')][_0xbc2e('0x13')]);}})[_0xbc2e('0x15')](function(_0x48073e){logger[_0xbc2e('0x10')](_0xbc2e('0x12'),_0x4136c2,_0x48073e);_0x11b5cc(_0x48073e);});});} \ No newline at end of file +var _0x89a0=['stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x18ea8a,_0x32f09f){var _0x19c99a=function(_0x21d8d6){while(--_0x21d8d6){_0x18ea8a['push'](_0x18ea8a['shift']());}};_0x19c99a(++_0x32f09f);}(_0x89a0,0xcd));var _0x089a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x89a0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x089a('0x0'));var util=require('util');var moment=require(_0x089a('0x1'));var BPromise=require(_0x089a('0x2'));var rs=require(_0x089a('0x3'));var fs=require('fs');var Redis=require(_0x089a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x089a('0x5'));var logger=require('../../config/logger')(_0x089a('0x6'));var config=require(_0x089a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x089a('0x8')][_0x089a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x434f3c,_0x2f17fc,_0x445f6a){return new BPromise(function(_0x46088d,_0x5d09c3){return client[_0x089a('0xa')](_0x434f3c,_0x445f6a)[_0x089a('0xb')](function(_0x2a818){logger['info'](_0x089a('0xc'),_0x2f17fc,_0x089a('0xd'));logger[_0x089a('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2f17fc,_0x089a('0xd'),JSON[_0x089a('0xf')](_0x2a818));if(_0x2a818['error']){if(_0x2a818[_0x089a('0x10')][_0x089a('0x11')]===0x1f4){logger[_0x089a('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2f17fc,_0x2a818['error'][_0x089a('0x12')]);return _0x5d09c3(_0x2a818[_0x089a('0x10')][_0x089a('0x12')]);}logger[_0x089a('0x10')](_0x089a('0xc'),_0x2f17fc,_0x2a818[_0x089a('0x10')]['message']);return _0x46088d(_0x2a818[_0x089a('0x10')][_0x089a('0x12')]);}else{logger[_0x089a('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2f17fc,_0x089a('0xd'));_0x46088d(_0x2a818[_0x089a('0x14')][_0x089a('0x12')]);}})[_0x089a('0x15')](function(_0x3cd97d){logger[_0x089a('0x10')](_0x089a('0xc'),_0x2f17fc,_0x3cd97d);_0x5d09c3(_0x3cd97d);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index e115628..f873043 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 _0x79df=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79df,0x71));var _0xf79d=function(_0x43fa89,_0xd1c04b){_0x43fa89=_0x43fa89-0x0;var _0x197fe2=_0x79df[_0x43fa89];return _0x197fe2;};'use strict';var multer=require(_0xf79d('0x0'));var util=require(_0xf79d('0x1'));var path=require(_0xf79d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf79d('0x3')]();var fs_extra=require(_0xf79d('0x4'));var auth=require(_0xf79d('0x5'));var interaction=require(_0xf79d('0x6'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0xf79d('0x7')]('/',auth[_0xf79d('0x8')](),controller[_0xf79d('0x9')]);router[_0xf79d('0x7')]('/:id',auth[_0xf79d('0x8')](),controller[_0xf79d('0xa')]);router[_0xf79d('0xb')]('/',auth[_0xf79d('0x8')](),controller[_0xf79d('0xc')]);router[_0xf79d('0xd')](_0xf79d('0xe'),auth['isAuthenticated'](),controller[_0xf79d('0xf')]);router[_0xf79d('0x10')]('/:id',auth[_0xf79d('0x8')](),controller[_0xf79d('0x11')]);module[_0xf79d('0x12')]=router; \ No newline at end of file +var _0x4e0d=['show','post','create','put','update','/:id','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated'];(function(_0x5ee281,_0x4c99cf){var _0x12631f=function(_0x28afa4){while(--_0x28afa4){_0x5ee281['push'](_0x5ee281['shift']());}};_0x12631f(++_0x4c99cf);}(_0x4e0d,0x127));var _0xd4e0=function(_0x2e29d3,_0x2435ec){_0x2e29d3=_0x2e29d3-0x0;var _0x14ba2d=_0x4e0d[_0x2e29d3];return _0x14ba2d;};'use strict';var multer=require(_0xd4e0('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd4e0('0x1'));var router=express[_0xd4e0('0x2')]();var fs_extra=require(_0xd4e0('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd4e0('0x4'));var config=require(_0xd4e0('0x5'));var controller=require(_0xd4e0('0x6'));router[_0xd4e0('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xd4e0('0x8')](),controller[_0xd4e0('0x9')]);router[_0xd4e0('0xa')]('/',auth['isAuthenticated'](),controller[_0xd4e0('0xb')]);router[_0xd4e0('0xc')]('/:id',auth[_0xd4e0('0x8')](),controller[_0xd4e0('0xd')]);router['delete'](_0xd4e0('0xe'),auth[_0xd4e0('0x8')](),controller['destroy']);module[_0xd4e0('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 714c4c9..6e403c6 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 _0xb717=['keyValue','string','STRING','BOOLEAN','sequelize','ENUM','variable','customVariable'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb717,0x1b4));var _0x7b71=function(_0x2f96e3,_0x4dd3d8){_0x2f96e3=_0x2f96e3-0x0;var _0x527295=_0xb717[_0x2f96e3];return _0x527295;};'use strict';var Sequelize=require(_0x7b71('0x0'));module['exports']={'type':{'type':Sequelize[_0x7b71('0x1')]('string',_0x7b71('0x2'),_0x7b71('0x3'),_0x7b71('0x4'),'picklist'),'defaultValue':_0x7b71('0x5')},'content':{'type':Sequelize[_0x7b71('0x6')]},'key':{'type':Sequelize[_0x7b71('0x6')]},'keyType':{'type':Sequelize[_0x7b71('0x1')](_0x7b71('0x5'),'variable',_0x7b71('0x3'))},'keyContent':{'type':Sequelize[_0x7b71('0x6')]},'idField':{'type':Sequelize[_0x7b71('0x6')]},'nameField':{'type':Sequelize[_0x7b71('0x6')]},'customField':{'type':Sequelize[_0x7b71('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9c44=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0xe09edf,_0x2ca5a5){var _0x589eea=function(_0x5199e2){while(--_0x5199e2){_0xe09edf['push'](_0xe09edf['shift']());}};_0x589eea(++_0x2ca5a5);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'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')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 1b8ad4c..f2f4259 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 _0x2c24=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','keys','filters','length','includeAll','include','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x2a131b,_0x2aa39a){var _0xa72f1d=function(_0x532f9e){while(--_0x532f9e){_0x2a131b['push'](_0x2a131b['shift']());}};_0xa72f1d(++_0x2aa39a);}(_0x2c24,0x1c8));var _0x42c2=function(_0xd429d8,_0x711d9f){_0xd429d8=_0xd429d8-0x0;var _0x79067f=_0x2c24[_0xd429d8];return _0x79067f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x42c2('0x0'));var zipdir=require(_0x42c2('0x1'));var jsonpatch=require(_0x42c2('0x2'));var rp=require(_0x42c2('0x3'));var moment=require(_0x42c2('0x4'));var BPromise=require(_0x42c2('0x5'));var Mustache=require(_0x42c2('0x6'));var util=require(_0x42c2('0x7'));var path=require('path');var sox=require(_0x42c2('0x8'));var csv=require(_0x42c2('0x9'));var ejs=require(_0x42c2('0xa'));var fs=require('fs');var fs_extra=require(_0x42c2('0xb'));var _=require(_0x42c2('0xc'));var squel=require(_0x42c2('0xd'));var crypto=require(_0x42c2('0xe'));var jsforce=require(_0x42c2('0xf'));var deskjs=require(_0x42c2('0x10'));var toCsv=require(_0x42c2('0x9'));var querystring=require(_0x42c2('0x11'));var Papa=require(_0x42c2('0x12'));var Redis=require('ioredis');var authService=require(_0x42c2('0x13'));var qs=require(_0x42c2('0x14'));var as=require(_0x42c2('0x15'));var hardwareService=require(_0x42c2('0x16'));var logger=require('../../config/logger')(_0x42c2('0x17'));var utils=require(_0x42c2('0x18'));var config=require(_0x42c2('0x19'));var licenseUtil=require(_0x42c2('0x1a'));var db=require(_0x42c2('0x1b'))['db'];function respondWithStatusCode(_0x401f5e,_0x9830e7){_0x9830e7=_0x9830e7||0xcc;return function(_0x25408e){if(_0x25408e){return _0x401f5e[_0x42c2('0x1c')](_0x9830e7);}return _0x401f5e[_0x42c2('0x1d')](_0x9830e7)['end']();};}function respondWithResult(_0x8ec9c6,_0x2b6f79){_0x2b6f79=_0x2b6f79||0xc8;return function(_0x544204){if(_0x544204){return _0x8ec9c6[_0x42c2('0x1d')](_0x2b6f79)[_0x42c2('0x1e')](_0x544204);}};}function respondWithFilteredResult(_0x4079e6,_0x280084){return function(_0x35e63f){if(_0x35e63f){var _0x3c901c=_0x35e63f[_0x42c2('0x1f')],_0x96f93c=_0x280084[_0x42c2('0x20')],_0x3dfd73=_0x280084[_0x42c2('0x20')]+_0x280084[_0x42c2('0x21')],_0x4333eb;if(_0x3dfd73>=_0x3c901c){_0x3dfd73=_0x3c901c;_0x4333eb=0xc8;}else{_0x4333eb=0xce;}_0x4079e6[_0x42c2('0x1d')](_0x4333eb);return _0x4079e6[_0x42c2('0x22')](_0x42c2('0x23'),_0x96f93c+'-'+_0x3dfd73+'/'+_0x3c901c)[_0x42c2('0x1e')](_0x35e63f);}return null;};}function patchUpdates(_0x256dbc){return function(_0x3106d4){try{jsonpatch[_0x42c2('0x24')](_0x3106d4,_0x256dbc,!![]);}catch(_0x3f572c){return BPromise[_0x42c2('0x25')](_0x3f572c);}return _0x3106d4[_0x42c2('0x26')]();};}function saveUpdates(_0x307bb1,_0x2667ec){return function(_0x15adcf){if(_0x15adcf){return _0x15adcf[_0x42c2('0x27')](_0x307bb1)[_0x42c2('0x28')](function(_0x55789c){return _0x55789c;});}return null;};}function removeEntity(_0x192ef0,_0x1124be){return function(_0x115db7){if(_0x115db7){return _0x115db7[_0x42c2('0x29')]()[_0x42c2('0x28')](function(){_0x192ef0[_0x42c2('0x1d')](0xcc)[_0x42c2('0x2a')]();});}};}function handleEntityNotFound(_0x360760,_0x1156fb){return function(_0x306570){if(!_0x306570){_0x360760[_0x42c2('0x1c')](0x194);}return _0x306570;};}function handleError(_0x3330b0,_0x25a50e){_0x25a50e=_0x25a50e||0x1f4;return function(_0x35e093){logger['error'](_0x35e093[_0x42c2('0x2b')]);if(_0x35e093[_0x42c2('0x2c')]){delete _0x35e093[_0x42c2('0x2c')];}_0x3330b0[_0x42c2('0x1d')](_0x25a50e)[_0x42c2('0x2d')](_0x35e093);};}exports[_0x42c2('0x2e')]=function(_0x58d1ea,_0x306eaa){var _0x264618={},_0x26ed2f={},_0xe79f87={'count':0x0,'rows':[]};var _0x114f93=_[_0x42c2('0x2f')](db[_0x42c2('0x30')][_0x42c2('0x31')],function(_0x16196d){return{'name':_0x16196d[_0x42c2('0x32')],'type':_0x16196d[_0x42c2('0x33')][_0x42c2('0x34')]};});_0x26ed2f[_0x42c2('0x35')]=_[_0x42c2('0x2f')](_0x114f93,_0x42c2('0x2c'));_0x26ed2f[_0x42c2('0x36')]=_['keys'](_0x58d1ea[_0x42c2('0x36')]);_0x26ed2f['filters']=_[_0x42c2('0x37')](_0x26ed2f['model'],_0x26ed2f[_0x42c2('0x36')]);_0x264618['attributes']=_[_0x42c2('0x37')](_0x26ed2f[_0x42c2('0x35')],qs[_0x42c2('0x38')](_0x58d1ea[_0x42c2('0x36')][_0x42c2('0x38')]));_0x264618[_0x42c2('0x39')]=_0x264618[_0x42c2('0x39')]['length']?_0x264618[_0x42c2('0x39')]:_0x26ed2f[_0x42c2('0x35')];if(!_0x58d1ea['query'][_0x42c2('0x3a')](_0x42c2('0x3b'))){_0x264618[_0x42c2('0x21')]=qs[_0x42c2('0x21')](_0x58d1ea[_0x42c2('0x36')][_0x42c2('0x21')]);_0x264618[_0x42c2('0x20')]=qs[_0x42c2('0x20')](_0x58d1ea[_0x42c2('0x36')]['offset']);}_0x264618['order']=qs[_0x42c2('0x3c')](_0x58d1ea[_0x42c2('0x36')][_0x42c2('0x3c')]);_0x264618[_0x42c2('0x3d')]=qs['filters'](_[_0x42c2('0x3e')](_0x58d1ea[_0x42c2('0x36')],_0x26ed2f['filters']),_0x114f93);if(_0x58d1ea['query'][_0x42c2('0x3f')]){_0x264618[_0x42c2('0x3d')]=_[_0x42c2('0x40')](_0x264618[_0x42c2('0x3d')],{'$or':_['map'](_0x114f93,function(_0x50609f){if(_0x50609f[_0x42c2('0x33')]!==_0x42c2('0x41')){var _0x3c4388={};_0x3c4388[_0x50609f[_0x42c2('0x2c')]]={'$like':'%'+_0x58d1ea['query'][_0x42c2('0x3f')]+'%'};return _0x3c4388;}})});}_0x264618=_[_0x42c2('0x40')]({},_0x264618,_0x58d1ea[_0x42c2('0x42')]);var _0x417698={'where':_0x264618[_0x42c2('0x3d')]};return db[_0x42c2('0x30')][_0x42c2('0x1f')](_0x417698)['then'](function(_0x218d84){_0xe79f87[_0x42c2('0x1f')]=_0x218d84;if(_0x58d1ea[_0x42c2('0x36')]['includeAll']){_0x264618['include']=[{'all':!![]}];}return db[_0x42c2('0x30')][_0x42c2('0x43')](_0x264618);})[_0x42c2('0x28')](function(_0x10d190){_0xe79f87[_0x42c2('0x44')]=_0x10d190;return _0xe79f87;})[_0x42c2('0x28')](respondWithFilteredResult(_0x306eaa,_0x264618))[_0x42c2('0x45')](handleError(_0x306eaa,null));};exports['show']=function(_0xef7b53,_0x56f979){var _0x4ccb46={'raw':!![],'where':{'id':_0xef7b53['params']['id']}},_0x30ae3f={};_0x30ae3f[_0x42c2('0x35')]=_[_0x42c2('0x46')](db['ZendeskField'][_0x42c2('0x31')]);_0x30ae3f['query']=_[_0x42c2('0x46')](_0xef7b53[_0x42c2('0x36')]);_0x30ae3f[_0x42c2('0x47')]=_[_0x42c2('0x37')](_0x30ae3f[_0x42c2('0x35')],_0x30ae3f[_0x42c2('0x36')]);_0x4ccb46['attributes']=_[_0x42c2('0x37')](_0x30ae3f[_0x42c2('0x35')],qs[_0x42c2('0x38')](_0xef7b53[_0x42c2('0x36')]['fields']));_0x4ccb46[_0x42c2('0x39')]=_0x4ccb46[_0x42c2('0x39')][_0x42c2('0x48')]?_0x4ccb46[_0x42c2('0x39')]:_0x30ae3f[_0x42c2('0x35')];if(_0xef7b53[_0x42c2('0x36')][_0x42c2('0x49')]){_0x4ccb46[_0x42c2('0x4a')]=[{'all':!![]}];}_0x4ccb46=_['merge']({},_0x4ccb46,_0xef7b53[_0x42c2('0x42')]);return db[_0x42c2('0x30')][_0x42c2('0x4b')](_0x4ccb46)[_0x42c2('0x28')](handleEntityNotFound(_0x56f979,null))[_0x42c2('0x28')](respondWithResult(_0x56f979,null))[_0x42c2('0x45')](handleError(_0x56f979,null));};exports[_0x42c2('0x4c')]=function(_0xe92357,_0x3358d4){return db[_0x42c2('0x30')][_0x42c2('0x4c')](_0xe92357['body'],{})[_0x42c2('0x28')](respondWithResult(_0x3358d4,0xc9))[_0x42c2('0x45')](handleError(_0x3358d4,null));};exports[_0x42c2('0x27')]=function(_0x56232c,_0x5ea693){if(_0x56232c[_0x42c2('0x4d')]['id']){delete _0x56232c['body']['id'];}return db[_0x42c2('0x30')][_0x42c2('0x4b')]({'where':{'id':_0x56232c['params']['id']}})[_0x42c2('0x28')](handleEntityNotFound(_0x5ea693,null))[_0x42c2('0x28')](saveUpdates(_0x56232c[_0x42c2('0x4d')],null))[_0x42c2('0x28')](respondWithResult(_0x5ea693,null))['catch'](handleError(_0x5ea693,null));};exports[_0x42c2('0x29')]=function(_0x50162f,_0x454655){return db[_0x42c2('0x30')]['find']({'where':{'id':_0x50162f[_0x42c2('0x4e')]['id']}})[_0x42c2('0x28')](handleEntityNotFound(_0x454655,null))[_0x42c2('0x28')](removeEntity(_0x454655,null))[_0x42c2('0x45')](handleError(_0x454655,null));}; \ No newline at end of file +var _0x9a01=['reject','save','update','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','then','include','rows','catch','show','params','length','includeAll','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','Content-Range','apply'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x9a01,0x72));var _0x19a0=function(_0x3986a9,_0x164fe5){_0x3986a9=_0x3986a9-0x0;var _0x2fb3ba=_0x9a01[_0x3986a9];return _0x2fb3ba;};'use strict';var emlformat=require(_0x19a0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x19a0('0x1'));var jsonpatch=require(_0x19a0('0x2'));var rp=require(_0x19a0('0x3'));var moment=require(_0x19a0('0x4'));var BPromise=require(_0x19a0('0x5'));var Mustache=require('mustache');var util=require(_0x19a0('0x6'));var path=require(_0x19a0('0x7'));var sox=require(_0x19a0('0x8'));var csv=require('to-csv');var ejs=require(_0x19a0('0x9'));var fs=require('fs');var fs_extra=require(_0x19a0('0xa'));var _=require(_0x19a0('0xb'));var squel=require('squel');var crypto=require(_0x19a0('0xc'));var jsforce=require(_0x19a0('0xd'));var deskjs=require(_0x19a0('0xe'));var toCsv=require(_0x19a0('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x19a0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x19a0('0x11'));var hardwareService=require(_0x19a0('0x12'));var logger=require(_0x19a0('0x13'))(_0x19a0('0x14'));var utils=require(_0x19a0('0x15'));var config=require(_0x19a0('0x16'));var licenseUtil=require(_0x19a0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x284b3f,_0x3cec97){_0x3cec97=_0x3cec97||0xcc;return function(_0x539a4e){if(_0x539a4e){return _0x284b3f[_0x19a0('0x18')](_0x3cec97);}return _0x284b3f[_0x19a0('0x19')](_0x3cec97)[_0x19a0('0x1a')]();};}function respondWithResult(_0x5e327f,_0x17e8e7){_0x17e8e7=_0x17e8e7||0xc8;return function(_0x560dfb){if(_0x560dfb){return _0x5e327f[_0x19a0('0x19')](_0x17e8e7)[_0x19a0('0x1b')](_0x560dfb);}};}function respondWithFilteredResult(_0x4b0ac2,_0x9bea27){return function(_0x3ab992){if(_0x3ab992){var _0x10c043=_0x3ab992[_0x19a0('0x1c')],_0x4a6f8d=_0x9bea27['offset'],_0x559705=_0x9bea27[_0x19a0('0x1d')]+_0x9bea27['limit'],_0x429593;if(_0x559705>=_0x10c043){_0x559705=_0x10c043;_0x429593=0xc8;}else{_0x429593=0xce;}_0x4b0ac2[_0x19a0('0x19')](_0x429593);return _0x4b0ac2['set'](_0x19a0('0x1e'),_0x4a6f8d+'-'+_0x559705+'/'+_0x10c043)[_0x19a0('0x1b')](_0x3ab992);}return null;};}function patchUpdates(_0x141c7e){return function(_0x2515e0){try{jsonpatch[_0x19a0('0x1f')](_0x2515e0,_0x141c7e,!![]);}catch(_0x1990ef){return BPromise[_0x19a0('0x20')](_0x1990ef);}return _0x2515e0[_0x19a0('0x21')]();};}function saveUpdates(_0x25b580,_0x5436b3){return function(_0x4af0a3){if(_0x4af0a3){return _0x4af0a3[_0x19a0('0x22')](_0x25b580)['then'](function(_0x53bb52){return _0x53bb52;});}return null;};}function removeEntity(_0x56ed8b,_0x3414f9){return function(_0x266251){if(_0x266251){return _0x266251['destroy']()['then'](function(){_0x56ed8b[_0x19a0('0x19')](0xcc)[_0x19a0('0x1a')]();});}};}function handleEntityNotFound(_0x56e0d3,_0x1e6024){return function(_0x5348ba){if(!_0x5348ba){_0x56e0d3[_0x19a0('0x18')](0x194);}return _0x5348ba;};}function handleError(_0x1afc06,_0x5f0102){_0x5f0102=_0x5f0102||0x1f4;return function(_0x10776a){logger[_0x19a0('0x23')](_0x10776a[_0x19a0('0x24')]);if(_0x10776a[_0x19a0('0x25')]){delete _0x10776a[_0x19a0('0x25')];}_0x1afc06[_0x19a0('0x19')](_0x5f0102)[_0x19a0('0x26')](_0x10776a);};}exports[_0x19a0('0x27')]=function(_0x42e33f,_0x55db22){var _0x51e272={},_0x4d7e38={},_0x56bd59={'count':0x0,'rows':[]};var _0x540999=_[_0x19a0('0x28')](db[_0x19a0('0x29')][_0x19a0('0x2a')],function(_0x37923e){return{'name':_0x37923e[_0x19a0('0x2b')],'type':_0x37923e[_0x19a0('0x2c')]['key']};});_0x4d7e38[_0x19a0('0x2d')]=_[_0x19a0('0x28')](_0x540999,'name');_0x4d7e38[_0x19a0('0x2e')]=_[_0x19a0('0x2f')](_0x42e33f['query']);_0x4d7e38[_0x19a0('0x30')]=_[_0x19a0('0x31')](_0x4d7e38[_0x19a0('0x2d')],_0x4d7e38[_0x19a0('0x2e')]);_0x51e272[_0x19a0('0x32')]=_[_0x19a0('0x31')](_0x4d7e38[_0x19a0('0x2d')],qs['fields'](_0x42e33f[_0x19a0('0x2e')][_0x19a0('0x33')]));_0x51e272[_0x19a0('0x32')]=_0x51e272[_0x19a0('0x32')]['length']?_0x51e272['attributes']:_0x4d7e38[_0x19a0('0x2d')];if(!_0x42e33f[_0x19a0('0x2e')][_0x19a0('0x34')](_0x19a0('0x35'))){_0x51e272[_0x19a0('0x36')]=qs[_0x19a0('0x36')](_0x42e33f[_0x19a0('0x2e')]['limit']);_0x51e272['offset']=qs[_0x19a0('0x1d')](_0x42e33f[_0x19a0('0x2e')]['offset']);}_0x51e272[_0x19a0('0x37')]=qs[_0x19a0('0x38')](_0x42e33f['query'][_0x19a0('0x38')]);_0x51e272[_0x19a0('0x39')]=qs[_0x19a0('0x30')](_['pick'](_0x42e33f[_0x19a0('0x2e')],_0x4d7e38[_0x19a0('0x30')]),_0x540999);if(_0x42e33f[_0x19a0('0x2e')][_0x19a0('0x3a')]){_0x51e272[_0x19a0('0x39')]=_[_0x19a0('0x3b')](_0x51e272[_0x19a0('0x39')],{'$or':_['map'](_0x540999,function(_0x4c3aff){if(_0x4c3aff[_0x19a0('0x2c')]!==_0x19a0('0x3c')){var _0x35d19a={};_0x35d19a[_0x4c3aff[_0x19a0('0x25')]]={'$like':'%'+_0x42e33f[_0x19a0('0x2e')]['filter']+'%'};return _0x35d19a;}})});}_0x51e272=_[_0x19a0('0x3b')]({},_0x51e272,_0x42e33f[_0x19a0('0x3d')]);var _0x4189ab={'where':_0x51e272[_0x19a0('0x39')]};return db['ZendeskField']['count'](_0x4189ab)[_0x19a0('0x3e')](function(_0x46bcb0){_0x56bd59[_0x19a0('0x1c')]=_0x46bcb0;if(_0x42e33f[_0x19a0('0x2e')]['includeAll']){_0x51e272[_0x19a0('0x3f')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x51e272);})[_0x19a0('0x3e')](function(_0x22837b){_0x56bd59[_0x19a0('0x40')]=_0x22837b;return _0x56bd59;})[_0x19a0('0x3e')](respondWithFilteredResult(_0x55db22,_0x51e272))[_0x19a0('0x41')](handleError(_0x55db22,null));};exports[_0x19a0('0x42')]=function(_0xb875dd,_0x4a77a8){var _0x230ea5={'raw':!![],'where':{'id':_0xb875dd[_0x19a0('0x43')]['id']}},_0x9fbf14={};_0x9fbf14['model']=_[_0x19a0('0x2f')](db['ZendeskField'][_0x19a0('0x2a')]);_0x9fbf14[_0x19a0('0x2e')]=_[_0x19a0('0x2f')](_0xb875dd[_0x19a0('0x2e')]);_0x9fbf14[_0x19a0('0x30')]=_[_0x19a0('0x31')](_0x9fbf14['model'],_0x9fbf14[_0x19a0('0x2e')]);_0x230ea5['attributes']=_['intersection'](_0x9fbf14[_0x19a0('0x2d')],qs['fields'](_0xb875dd['query'][_0x19a0('0x33')]));_0x230ea5[_0x19a0('0x32')]=_0x230ea5[_0x19a0('0x32')][_0x19a0('0x44')]?_0x230ea5[_0x19a0('0x32')]:_0x9fbf14[_0x19a0('0x2d')];if(_0xb875dd[_0x19a0('0x2e')][_0x19a0('0x45')]){_0x230ea5[_0x19a0('0x3f')]=[{'all':!![]}];}_0x230ea5=_[_0x19a0('0x3b')]({},_0x230ea5,_0xb875dd[_0x19a0('0x3d')]);return db['ZendeskField']['find'](_0x230ea5)['then'](handleEntityNotFound(_0x4a77a8,null))[_0x19a0('0x3e')](respondWithResult(_0x4a77a8,null))['catch'](handleError(_0x4a77a8,null));};exports[_0x19a0('0x46')]=function(_0x1c2424,_0x370185){return db[_0x19a0('0x29')][_0x19a0('0x46')](_0x1c2424[_0x19a0('0x47')],{})['then'](respondWithResult(_0x370185,0xc9))[_0x19a0('0x41')](handleError(_0x370185,null));};exports[_0x19a0('0x22')]=function(_0x3a5d26,_0x23e50a){if(_0x3a5d26[_0x19a0('0x47')]['id']){delete _0x3a5d26[_0x19a0('0x47')]['id'];}return db[_0x19a0('0x29')]['find']({'where':{'id':_0x3a5d26['params']['id']}})[_0x19a0('0x3e')](handleEntityNotFound(_0x23e50a,null))['then'](saveUpdates(_0x3a5d26[_0x19a0('0x47')],null))[_0x19a0('0x3e')](respondWithResult(_0x23e50a,null))[_0x19a0('0x41')](handleError(_0x23e50a,null));};exports[_0x19a0('0x48')]=function(_0x36f429,_0x423f5a){return db[_0x19a0('0x29')]['find']({'where':{'id':_0x36f429[_0x19a0('0x43')]['id']}})[_0x19a0('0x3e')](handleEntityNotFound(_0x423f5a,null))[_0x19a0('0x3e')](removeEntity(_0x423f5a,null))[_0x19a0('0x41')](handleError(_0x423f5a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 5c880f8..658cc8e 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 _0xa739=['util','api','moment','request-promise','path','rimraf','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId'];(function(_0x4a2cda,_0x2ff004){var _0x1db941=function(_0xbd72cd){while(--_0xbd72cd){_0x4a2cda['push'](_0x4a2cda['shift']());}};_0x1db941(++_0x2ff004);}(_0xa739,0x1e1));var _0x9a73=function(_0x206dda,_0x5ae1ce){_0x206dda=_0x206dda-0x0;var _0x10b13d=_0xa739[_0x206dda];return _0x10b13d;};'use strict';var _=require('lodash');var util=require(_0x9a73('0x0'));var logger=require('../../config/logger')(_0x9a73('0x1'));var moment=require(_0x9a73('0x2'));var BPromise=require('bluebird');var rp=require(_0x9a73('0x3'));var fs=require('fs');var path=require(_0x9a73('0x4'));var rimraf=require(_0x9a73('0x5'));var config=require('../../config/environment');var attributes=require(_0x9a73('0x6'));module[_0x9a73('0x7')]=function(_0xcb4e9e,_0x65115e){return _0xcb4e9e[_0x9a73('0x8')](_0x9a73('0x9'),attributes,{'tableName':_0x9a73('0xa'),'paranoid':![],'indexes':[{'name':_0x9a73('0xb'),'fields':['idField',_0x9a73('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2917=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index'];(function(_0x39f01b,_0x5c1540){var _0x220359=function(_0x3516a3){while(--_0x3516a3){_0x39f01b['push'](_0x39f01b['shift']());}};_0x220359(++_0x5c1540);}(_0x2917,0x142));var _0x7291=function(_0x2a3c4d,_0x9c6b37){_0x2a3c4d=_0x2a3c4d-0x0;var _0x55c390=_0x2917[_0x2a3c4d];return _0x55c390;};'use strict';var _=require(_0x7291('0x0'));var util=require(_0x7291('0x1'));var logger=require(_0x7291('0x2'))(_0x7291('0x3'));var moment=require(_0x7291('0x4'));var BPromise=require(_0x7291('0x5'));var rp=require(_0x7291('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7291('0x7'));var attributes=require(_0x7291('0x8'));module[_0x7291('0x9')]=function(_0x6aac19,_0x1ee790){return _0x6aac19[_0x7291('0xa')](_0x7291('0xb'),attributes,{'tableName':_0x7291('0xc'),'paranoid':![],'indexes':[{'name':_0x7291('0xd'),'fields':[_0x7291('0xe'),_0x7291('0xf')],'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 30863fd..7c3d92d 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 _0xe6c2=['http','request','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','ioredis','../../config/utils','../../config/logger','rpc','client'];(function(_0xbd8d09,_0x30bc3f){var _0x3e3079=function(_0x2ca616){while(--_0x2ca616){_0xbd8d09['push'](_0xbd8d09['shift']());}};_0x3e3079(++_0x30bc3f);}(_0xe6c2,0x6c));var _0x2e6c=function(_0x9c0ce1,_0x348d7e){_0x9c0ce1=_0x9c0ce1-0x0;var _0x17f37d=_0xe6c2[_0x9c0ce1];return _0x17f37d;};'use strict';var _=require(_0x2e6c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e6c('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e6c('0x2'));var logger=require(_0x2e6c('0x3'))(_0x2e6c('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2e6c('0x5')][_0x2e6c('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xc0af29,_0x1a67ae,_0x423217){return new BPromise(function(_0x2086bf,_0x4966fc){return client[_0x2e6c('0x7')](_0xc0af29,_0x423217)[_0x2e6c('0x8')](function(_0x132015){logger[_0x2e6c('0x9')](_0x2e6c('0xa'),_0x1a67ae,'request\x20sent');logger[_0x2e6c('0xb')](_0x2e6c('0xc'),_0x1a67ae,_0x2e6c('0xd'),JSON[_0x2e6c('0xe')](_0x132015));if(_0x132015[_0x2e6c('0xf')]){if(_0x132015['error'][_0x2e6c('0x10')]===0x1f4){logger[_0x2e6c('0xf')]('ZendeskField,\x20%s,\x20%s',_0x1a67ae,_0x132015[_0x2e6c('0xf')][_0x2e6c('0x11')]);return _0x4966fc(_0x132015[_0x2e6c('0xf')][_0x2e6c('0x11')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x1a67ae,_0x132015['error'][_0x2e6c('0x11')]);return _0x2086bf(_0x132015[_0x2e6c('0xf')][_0x2e6c('0x11')]);}else{logger[_0x2e6c('0x9')](_0x2e6c('0xa'),_0x1a67ae,_0x2e6c('0xd'));_0x2086bf(_0x132015['result']['message']);}})[_0x2e6c('0x12')](function(_0x2ab36a){logger[_0x2e6c('0xf')](_0x2e6c('0xa'),_0x1a67ae,_0x2ab36a);_0x4966fc(_0x2ab36a);});});} \ No newline at end of file +var _0xfecb=['ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xd8aad0,_0x4da2cd){var _0x570860=function(_0x1acc03){while(--_0x1acc03){_0xd8aad0['push'](_0xd8aad0['shift']());}};_0x570860(++_0x4da2cd);}(_0xfecb,0x8b));var _0xbfec=function(_0x507095,_0x2711bd){_0x507095=_0x507095-0x0;var _0x1014d8=_0xfecb[_0x507095];return _0x1014d8;};'use strict';var _=require(_0xbfec('0x0'));var util=require(_0xbfec('0x1'));var moment=require(_0xbfec('0x2'));var BPromise=require(_0xbfec('0x3'));var rs=require(_0xbfec('0x4'));var fs=require('fs');var Redis=require(_0xbfec('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbfec('0x6'));var logger=require(_0xbfec('0x7'))(_0xbfec('0x8'));var config=require(_0xbfec('0x9'));var jayson=require(_0xbfec('0xa'));var client=jayson[_0xbfec('0xb')][_0xbfec('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3eeb83,_0x783fca,_0x2ad40c){return new BPromise(function(_0x381c5f,_0x4bc78c){return client[_0xbfec('0xd')](_0x3eeb83,_0x2ad40c)[_0xbfec('0xe')](function(_0x57b051){logger['info'](_0xbfec('0xf'),_0x783fca,_0xbfec('0x10'));logger['debug'](_0xbfec('0x11'),_0x783fca,_0xbfec('0x10'),JSON['stringify'](_0x57b051));if(_0x57b051[_0xbfec('0x12')]){if(_0x57b051[_0xbfec('0x12')][_0xbfec('0x13')]===0x1f4){logger[_0xbfec('0x12')]('ZendeskField,\x20%s,\x20%s',_0x783fca,_0x57b051[_0xbfec('0x12')][_0xbfec('0x14')]);return _0x4bc78c(_0x57b051[_0xbfec('0x12')]['message']);}logger[_0xbfec('0x12')]('ZendeskField,\x20%s,\x20%s',_0x783fca,_0x57b051[_0xbfec('0x12')][_0xbfec('0x14')]);return _0x381c5f(_0x57b051[_0xbfec('0x12')][_0xbfec('0x14')]);}else{logger[_0xbfec('0x15')]('ZendeskField,\x20%s,\x20%s',_0x783fca,_0xbfec('0x10'));_0x381c5f(_0x57b051['result']['message']);}})['catch'](function(_0x17201b){logger['error'](_0xbfec('0xf'),_0x783fca,_0x17201b);_0x4bc78c(_0x17201b);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index f11858d..30679a2 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 _0x0620=['get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x2fef36,_0xd5afba){var _0x49f2c0=function(_0x5a9bf4){while(--_0x5a9bf4){_0x2fef36['push'](_0x2fef36['shift']());}};_0x49f2c0(++_0xd5afba);}(_0x0620,0xdd));var _0x0062=function(_0x9cc912,_0x18afa2){_0x9cc912=_0x9cc912-0x0;var _0x324b54=_0x0620[_0x9cc912];return _0x324b54;};'use strict';var multer=require(_0x0062('0x0'));var util=require(_0x0062('0x1'));var path=require(_0x0062('0x2'));var timeout=require(_0x0062('0x3'));var express=require('express');var router=express[_0x0062('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0062('0x5'));var interaction=require(_0x0062('0x6'));var config=require(_0x0062('0x7'));var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0x0062('0x8')](),controller[_0x0062('0x9')]);router[_0x0062('0xa')](_0x0062('0xb'),auth[_0x0062('0x8')](),controller[_0x0062('0xc')]);router[_0x0062('0xa')](_0x0062('0xd'),auth[_0x0062('0x8')](),controller[_0x0062('0xe')]);router[_0x0062('0xa')](_0x0062('0xf'),auth['isAuthenticated'](),controller[_0x0062('0x10')]);router['post']('/',auth[_0x0062('0x8')](),controller['create']);router[_0x0062('0x11')]('/:id/configurations',auth[_0x0062('0x8')](),controller['addConfiguration']);router[_0x0062('0x12')](_0x0062('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0062('0x13')](_0x0062('0xb'),auth[_0x0062('0x8')](),controller[_0x0062('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa1dd=['addConfiguration','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','create','post'];(function(_0x35ac74,_0x3e0ef1){var _0x45e84a=function(_0x56080f){while(--_0x56080f){_0x35ac74['push'](_0x35ac74['shift']());}};_0x45e84a(++_0x3e0ef1);}(_0xa1dd,0x119));var _0xda1d=function(_0x44b4ab,_0xb888fa){_0x44b4ab=_0x44b4ab-0x0;var _0x2fa74c=_0xa1dd[_0x44b4ab];return _0x2fa74c;};'use strict';var multer=require('multer');var util=require(_0xda1d('0x0'));var path=require(_0xda1d('0x1'));var timeout=require(_0xda1d('0x2'));var express=require('express');var router=express[_0xda1d('0x3')]();var fs_extra=require(_0xda1d('0x4'));var auth=require(_0xda1d('0x5'));var interaction=require(_0xda1d('0x6'));var config=require(_0xda1d('0x7'));var controller=require(_0xda1d('0x8'));router[_0xda1d('0x9')]('/',auth[_0xda1d('0xa')](),controller[_0xda1d('0xb')]);router[_0xda1d('0x9')](_0xda1d('0xc'),auth[_0xda1d('0xa')](),controller[_0xda1d('0xd')]);router[_0xda1d('0x9')](_0xda1d('0xe'),auth[_0xda1d('0xa')](),controller[_0xda1d('0xf')]);router[_0xda1d('0x9')]('/:id/fields',auth[_0xda1d('0xa')](),controller['getFields']);router['post']('/',auth[_0xda1d('0xa')](),controller[_0xda1d('0x10')]);router[_0xda1d('0x11')](_0xda1d('0xe'),auth['isAuthenticated'](),controller[_0xda1d('0x12')]);router['put']('/:id',auth[_0xda1d('0xa')](),controller[_0xda1d('0x13')]);router[_0xda1d('0x14')](_0xda1d('0xc'),auth['isAuthenticated'](),controller[_0xda1d('0x15')]);module[_0xda1d('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 1472add..a8ee7cf 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 _0xab23=['sequelize','exports','STRING'];(function(_0x47f0f8,_0x5f0deb){var _0x4f1cdb=function(_0x433b62){while(--_0x433b62){_0x47f0f8['push'](_0x47f0f8['shift']());}};_0x4f1cdb(++_0x5f0deb);}(_0xab23,0x1bc));var _0x3ab2=function(_0xd0145,_0x547c3e){_0xd0145=_0xd0145-0x0;var _0x1bd359=_0xab23[_0xd0145];return _0x1bd359;};'use strict';var Sequelize=require(_0x3ab2('0x0'));module[_0x3ab2('0x1')]={'name':{'type':Sequelize[_0x3ab2('0x2')]},'description':{'type':Sequelize[_0x3ab2('0x2')]},'host':{'type':Sequelize[_0x3ab2('0x2')]},'zone':{'type':Sequelize[_0x3ab2('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x3ab2('0x2')]},'serverUrl':{'type':Sequelize[_0x3ab2('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x3ab2('0x2')]},'refreshToken':{'type':Sequelize[_0x3ab2('0x2')]}}; \ No newline at end of file +var _0x7126=['STRING','sequelize','exports'];(function(_0x5b7b04,_0x41c3a3){var _0x470b9c=function(_0x84b595){while(--_0x84b595){_0x5b7b04['push'](_0x5b7b04['shift']());}};_0x470b9c(++_0x41c3a3);}(_0x7126,0x67));var _0x6712=function(_0x3f5365,_0x2cb212){_0x3f5365=_0x3f5365-0x0;var _0x3ba73d=_0x7126[_0x3f5365];return _0x3ba73d;};'use strict';var Sequelize=require(_0x6712('0x0'));module[_0x6712('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6712('0x2')]},'host':{'type':Sequelize[_0x6712('0x2')]},'zone':{'type':Sequelize[_0x6712('0x2')]},'clientId':{'type':Sequelize[_0x6712('0x2')]},'clientSecret':{'type':Sequelize[_0x6712('0x2')]},'serverUrl':{'type':Sequelize[_0x6712('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x6712('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index e012991..3a0a298 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 _0x6fec=['clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','serverUrl','refreshToken','com','slice','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','api_name','push','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','set','Content-Range','reject','save','update','then','sendStatus','stack','name','index','map','ZohoAccount','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','show','params','rawAttributes','length','options','find','create','body','ZohoConfiguration','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token'];(function(_0x90c8d8,_0x2a3edd){var _0x2d04fb=function(_0x423a76){while(--_0x423a76){_0x90c8d8['push'](_0x90c8d8['shift']());}};_0x2d04fb(++_0x2a3edd);}(_0x6fec,0xb0));var _0xc6fe=function(_0x165f80,_0x3781d7){_0x165f80=_0x165f80-0x0;var _0x15b371=_0x6fec[_0x165f80];return _0x15b371;};'use strict';var emlformat=require(_0xc6fe('0x0'));var rimraf=require(_0xc6fe('0x1'));var zipdir=require(_0xc6fe('0x2'));var jsonpatch=require(_0xc6fe('0x3'));var rp=require('request-promise');var moment=require(_0xc6fe('0x4'));var BPromise=require(_0xc6fe('0x5'));var Mustache=require(_0xc6fe('0x6'));var util=require(_0xc6fe('0x7'));var path=require(_0xc6fe('0x8'));var sox=require(_0xc6fe('0x9'));var csv=require(_0xc6fe('0xa'));var ejs=require(_0xc6fe('0xb'));var fs=require('fs');var fs_extra=require(_0xc6fe('0xc'));var _=require(_0xc6fe('0xd'));var squel=require(_0xc6fe('0xe'));var crypto=require(_0xc6fe('0xf'));var jsforce=require(_0xc6fe('0x10'));var deskjs=require(_0xc6fe('0x11'));var toCsv=require(_0xc6fe('0xa'));var querystring=require(_0xc6fe('0x12'));var Papa=require(_0xc6fe('0x13'));var Redis=require(_0xc6fe('0x14'));var authService=require(_0xc6fe('0x15'));var qs=require(_0xc6fe('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6fe('0x17'));var logger=require(_0xc6fe('0x18'))(_0xc6fe('0x19'));var utils=require(_0xc6fe('0x1a'));var config=require(_0xc6fe('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xc6fe('0x1c'))['db'];var integrations=require(_0xc6fe('0x1d'));var jayson=require(_0xc6fe('0x1e'));var client=jayson[_0xc6fe('0x1f')][_0xc6fe('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x586ea3,_0x16d9db,_0x47a63d,_0x6dea02){return new BPromise(function(_0x29b60b,_0x55b5a8){var _0x5e40f7=_0x6dea02||client;return _0x5e40f7['request'](_0x586ea3,_0x47a63d)['then'](function(_0x478417){logger['info'](_0xc6fe('0x21'),_0x16d9db,_0xc6fe('0x22'));logger['debug'](_0xc6fe('0x23'),_0x16d9db,_0xc6fe('0x22'),JSON[_0xc6fe('0x24')](_0x478417));if(_0x478417[_0xc6fe('0x25')]){if(_0x478417[_0xc6fe('0x25')][_0xc6fe('0x26')]===0x1f4){logger[_0xc6fe('0x25')]('ZohoAccount,\x20%s,\x20%s',_0x16d9db,_0x478417[_0xc6fe('0x25')][_0xc6fe('0x27')]);return _0x55b5a8(_0x478417[_0xc6fe('0x25')]['message']);}logger[_0xc6fe('0x25')]('ZohoAccount,\x20%s,\x20%s',_0x16d9db,_0x478417[_0xc6fe('0x25')]['message']);return _0x29b60b(_0x478417[_0xc6fe('0x25')][_0xc6fe('0x27')]);}else{logger['info'](_0xc6fe('0x21'),_0x16d9db,'request\x20sent');_0x29b60b(_0x478417[_0xc6fe('0x28')][_0xc6fe('0x27')]);}})[_0xc6fe('0x29')](function(_0x4d93a7){logger['error'](_0xc6fe('0x21'),_0x16d9db,_0x4d93a7);_0x55b5a8(_0x4d93a7);});});}function respondWithStatusCode(_0xe05f6c,_0x13ffe0){_0x13ffe0=_0x13ffe0||0xcc;return function(_0x1dfcda){if(_0x1dfcda){return _0xe05f6c['sendStatus'](_0x13ffe0);}return _0xe05f6c[_0xc6fe('0x2a')](_0x13ffe0)[_0xc6fe('0x2b')]();};}function respondWithResult(_0x49d0c9,_0x46221b){_0x46221b=_0x46221b||0xc8;return function(_0x537e8c){if(_0x537e8c){return _0x49d0c9['status'](_0x46221b)[_0xc6fe('0x2c')](_0x537e8c);}};}function respondWithFilteredResult(_0x57b374,_0x38ba26){return function(_0x164ca3){if(_0x164ca3){var _0x44eaf1=_0x164ca3[_0xc6fe('0x2d')],_0x2bba83=_0x38ba26[_0xc6fe('0x2e')],_0x425d19=_0x38ba26['offset']+_0x38ba26['limit'],_0x27c893;if(_0x425d19>=_0x44eaf1){_0x425d19=_0x44eaf1;_0x27c893=0xc8;}else{_0x27c893=0xce;}_0x57b374[_0xc6fe('0x2a')](_0x27c893);return _0x57b374[_0xc6fe('0x2f')](_0xc6fe('0x30'),_0x2bba83+'-'+_0x425d19+'/'+_0x44eaf1)[_0xc6fe('0x2c')](_0x164ca3);}return null;};}function patchUpdates(_0xf36955){return function(_0x394f5b){try{jsonpatch['apply'](_0x394f5b,_0xf36955,!![]);}catch(_0x55db19){return BPromise[_0xc6fe('0x31')](_0x55db19);}return _0x394f5b[_0xc6fe('0x32')]();};}function saveUpdates(_0xf2f38b,_0x335b84){return function(_0x552f7b){if(_0x552f7b){return _0x552f7b[_0xc6fe('0x33')](_0xf2f38b)[_0xc6fe('0x34')](function(_0x227d4e){return _0x227d4e;});}return null;};}function removeEntity(_0x1c5b55,_0xfd9221){return function(_0x3fea47){if(_0x3fea47){return _0x3fea47['destroy']()['then'](function(){_0x1c5b55['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xbb0bcc,_0x25ca26){return function(_0x39573e){if(!_0x39573e){_0xbb0bcc[_0xc6fe('0x35')](0x194);}return _0x39573e;};}function handleError(_0xf882e9,_0x474c95){_0x474c95=_0x474c95||0x1f4;return function(_0x36294a){logger[_0xc6fe('0x25')](_0x36294a[_0xc6fe('0x36')]);if(_0x36294a[_0xc6fe('0x37')]){delete _0x36294a[_0xc6fe('0x37')];}_0xf882e9['status'](_0x474c95)['send'](_0x36294a);};}exports[_0xc6fe('0x38')]=function(_0x1b0df5,_0x2c1f7d){var _0x2e46aa={},_0x43df67={},_0x209206={'count':0x0,'rows':[]};var _0x50d1df=_[_0xc6fe('0x39')](db[_0xc6fe('0x3a')]['rawAttributes'],function(_0x4fdb05){return{'name':_0x4fdb05[_0xc6fe('0x3b')],'type':_0x4fdb05[_0xc6fe('0x3c')][_0xc6fe('0x3d')]};});_0x43df67[_0xc6fe('0x3e')]=_[_0xc6fe('0x39')](_0x50d1df,_0xc6fe('0x37'));_0x43df67[_0xc6fe('0x3f')]=_[_0xc6fe('0x40')](_0x1b0df5[_0xc6fe('0x3f')]);_0x43df67[_0xc6fe('0x41')]=_[_0xc6fe('0x42')](_0x43df67[_0xc6fe('0x3e')],_0x43df67[_0xc6fe('0x3f')]);_0x2e46aa['attributes']=_[_0xc6fe('0x42')](_0x43df67[_0xc6fe('0x3e')],qs['fields'](_0x1b0df5[_0xc6fe('0x3f')][_0xc6fe('0x43')]));_0x2e46aa[_0xc6fe('0x44')]=_0x2e46aa['attributes']['length']?_0x2e46aa[_0xc6fe('0x44')]:_0x43df67['model'];if(!_0x1b0df5[_0xc6fe('0x3f')][_0xc6fe('0x45')](_0xc6fe('0x46'))){_0x2e46aa[_0xc6fe('0x47')]=qs[_0xc6fe('0x47')](_0x1b0df5['query'][_0xc6fe('0x47')]);_0x2e46aa[_0xc6fe('0x2e')]=qs['offset'](_0x1b0df5[_0xc6fe('0x3f')][_0xc6fe('0x2e')]);}_0x2e46aa[_0xc6fe('0x48')]=qs[_0xc6fe('0x49')](_0x1b0df5[_0xc6fe('0x3f')][_0xc6fe('0x49')]);_0x2e46aa['where']=qs[_0xc6fe('0x41')](_[_0xc6fe('0x4a')](_0x1b0df5[_0xc6fe('0x3f')],_0x43df67[_0xc6fe('0x41')]),_0x50d1df);if(_0x1b0df5[_0xc6fe('0x3f')][_0xc6fe('0x4b')]){_0x2e46aa[_0xc6fe('0x4c')]=_[_0xc6fe('0x4d')](_0x2e46aa['where'],{'$or':_[_0xc6fe('0x39')](_0x50d1df,function(_0x17c1f1){if(_0x17c1f1['type']!==_0xc6fe('0x4e')){var _0x99586c={};_0x99586c[_0x17c1f1[_0xc6fe('0x37')]]={'$like':'%'+_0x1b0df5[_0xc6fe('0x3f')][_0xc6fe('0x4b')]+'%'};return _0x99586c;}})});}_0x2e46aa=_[_0xc6fe('0x4d')]({},_0x2e46aa,_0x1b0df5['options']);var _0x22ba2b={'where':_0x2e46aa[_0xc6fe('0x4c')]};return db[_0xc6fe('0x3a')]['count'](_0x22ba2b)[_0xc6fe('0x34')](function(_0x46fd9c){_0x209206[_0xc6fe('0x2d')]=_0x46fd9c;if(_0x1b0df5[_0xc6fe('0x3f')][_0xc6fe('0x4f')]){_0x2e46aa['include']=[{'all':!![]}];}return db[_0xc6fe('0x3a')][_0xc6fe('0x50')](_0x2e46aa);})[_0xc6fe('0x34')](function(_0x4a2bee){_0x209206[_0xc6fe('0x51')]=_0x4a2bee;return _0x209206;})[_0xc6fe('0x34')](respondWithFilteredResult(_0x2c1f7d,_0x2e46aa))['catch'](handleError(_0x2c1f7d,null));};exports[_0xc6fe('0x52')]=function(_0x203511,_0x116b64){var _0x4f1028={'raw':![],'where':{'id':_0x203511[_0xc6fe('0x53')]['id']}},_0x7996ed={};_0x7996ed['model']=_[_0xc6fe('0x40')](db['ZohoAccount'][_0xc6fe('0x54')]);_0x7996ed[_0xc6fe('0x3f')]=_[_0xc6fe('0x40')](_0x203511[_0xc6fe('0x3f')]);_0x7996ed[_0xc6fe('0x41')]=_[_0xc6fe('0x42')](_0x7996ed[_0xc6fe('0x3e')],_0x7996ed[_0xc6fe('0x3f')]);_0x4f1028['attributes']=_['intersection'](_0x7996ed['model'],qs[_0xc6fe('0x43')](_0x203511[_0xc6fe('0x3f')][_0xc6fe('0x43')]));_0x4f1028[_0xc6fe('0x44')]=_0x4f1028[_0xc6fe('0x44')][_0xc6fe('0x55')]?_0x4f1028[_0xc6fe('0x44')]:_0x7996ed[_0xc6fe('0x3e')];if(_0x203511[_0xc6fe('0x3f')][_0xc6fe('0x4f')]){_0x4f1028['include']=[{'all':!![]}];}_0x4f1028=_[_0xc6fe('0x4d')]({},_0x4f1028,_0x203511[_0xc6fe('0x56')]);return db['ZohoAccount'][_0xc6fe('0x57')](_0x4f1028)[_0xc6fe('0x34')](handleEntityNotFound(_0x116b64,null))[_0xc6fe('0x34')](respondWithResult(_0x116b64,null))[_0xc6fe('0x29')](handleError(_0x116b64,null));};exports[_0xc6fe('0x58')]=function(_0x1d1852,_0x1a63e7){return db['ZohoAccount'][_0xc6fe('0x58')](_0x1d1852[_0xc6fe('0x59')],{})['then'](respondWithResult(_0x1a63e7,0xc9))[_0xc6fe('0x29')](handleError(_0x1a63e7,null));};exports['update']=function(_0x3b54e6,_0x1d9be8){if(_0x3b54e6['body']['id']){delete _0x3b54e6[_0xc6fe('0x59')]['id'];}return db[_0xc6fe('0x3a')][_0xc6fe('0x57')]({'where':{'id':_0x3b54e6[_0xc6fe('0x53')]['id']}})[_0xc6fe('0x34')](handleEntityNotFound(_0x1d9be8,null))[_0xc6fe('0x34')](saveUpdates(_0x3b54e6['body'],null))[_0xc6fe('0x34')](respondWithResult(_0x1d9be8,null))['catch'](handleError(_0x1d9be8,null));};exports['destroy']=function(_0x13b7e4,_0x2fc73b){return db[_0xc6fe('0x3a')][_0xc6fe('0x57')]({'where':{'id':_0x13b7e4['params']['id']}})['then'](handleEntityNotFound(_0x2fc73b,null))[_0xc6fe('0x34')](removeEntity(_0x2fc73b,null))['catch'](handleError(_0x2fc73b,null));};exports['getConfigurations']=function(_0xbc59b1,_0x3c9f89,_0x1fd882){var _0x4a3104={};var _0xf8282a={};var _0x394678;var _0x35f305;return db[_0xc6fe('0x3a')]['findOne']({'where':{'id':_0xbc59b1[_0xc6fe('0x53')]['id']}})[_0xc6fe('0x34')](handleEntityNotFound(_0x3c9f89,null))[_0xc6fe('0x34')](function(_0x2ef955){if(_0x2ef955){_0x394678=_0x2ef955;_0xf8282a[_0xc6fe('0x3e')]=_[_0xc6fe('0x40')](db[_0xc6fe('0x5a')][_0xc6fe('0x54')]);_0xf8282a[_0xc6fe('0x3f')]=_[_0xc6fe('0x40')](_0xbc59b1[_0xc6fe('0x3f')]);_0xf8282a[_0xc6fe('0x41')]=_['intersection'](_0xf8282a[_0xc6fe('0x3e')],_0xf8282a[_0xc6fe('0x3f')]);_0x4a3104[_0xc6fe('0x44')]=_['intersection'](_0xf8282a[_0xc6fe('0x3e')],qs['fields'](_0xbc59b1[_0xc6fe('0x3f')][_0xc6fe('0x43')]));_0x4a3104[_0xc6fe('0x44')]=_0x4a3104[_0xc6fe('0x44')]['length']?_0x4a3104[_0xc6fe('0x44')]:_0xf8282a[_0xc6fe('0x3e')];_0x4a3104[_0xc6fe('0x48')]=qs[_0xc6fe('0x49')](_0xbc59b1[_0xc6fe('0x3f')][_0xc6fe('0x49')]);_0x4a3104[_0xc6fe('0x4c')]=qs['filters'](_[_0xc6fe('0x4a')](_0xbc59b1[_0xc6fe('0x3f')],_0xf8282a[_0xc6fe('0x41')]));if(_0xbc59b1[_0xc6fe('0x3f')][_0xc6fe('0x4b')]){_0x4a3104[_0xc6fe('0x4c')]=_[_0xc6fe('0x4d')](_0x4a3104[_0xc6fe('0x4c')],{'$or':_[_0xc6fe('0x39')](_0x4a3104[_0xc6fe('0x44')],function(_0x67ad13){var _0x41abf1={};_0x41abf1[_0x67ad13]={'$like':'%'+_0xbc59b1[_0xc6fe('0x3f')][_0xc6fe('0x4b')]+'%'};return _0x41abf1;})});}_0x4a3104=_['merge']({},_0x4a3104,_0xbc59b1[_0xc6fe('0x56')]);return _0x394678[_0xc6fe('0x5b')](_0x4a3104);}})[_0xc6fe('0x34')](function(_0x2d00ea){if(_0x2d00ea){_0x35f305=_0x2d00ea[_0xc6fe('0x55')];if(!_0xbc59b1['query'][_0xc6fe('0x45')](_0xc6fe('0x46'))){_0x4a3104[_0xc6fe('0x47')]=qs[_0xc6fe('0x47')](_0xbc59b1[_0xc6fe('0x3f')]['limit']);_0x4a3104[_0xc6fe('0x2e')]=qs[_0xc6fe('0x2e')](_0xbc59b1[_0xc6fe('0x3f')]['offset']);}return _0x394678[_0xc6fe('0x5b')](_0x4a3104);}})['then'](function(_0x7f8376){if(_0x7f8376){return _0x7f8376?{'count':_0x35f305,'rows':_0x7f8376}:null;}})[_0xc6fe('0x34')](respondWithResult(_0x3c9f89,null))[_0xc6fe('0x29')](handleError(_0x3c9f89,null));};exports[_0xc6fe('0x5c')]=function(_0x4a09df,_0x3f563e,_0x15fff0){if(_0x4a09df['body']['id']){delete _0x4a09df['body']['id'];}return db[_0xc6fe('0x3a')][_0xc6fe('0x5d')]({'where':{'id':_0x4a09df['params']['id']}})[_0xc6fe('0x34')](handleEntityNotFound(_0x3f563e,null))[_0xc6fe('0x34')](function(_0x2aa014){if(_0x2aa014){_0x4a09df[_0xc6fe('0x59')]['AccountId']=_0x2aa014['id'];_0x4a09df[_0xc6fe('0x59')][_0xc6fe('0x5e')]=integrations[_0xc6fe('0x5f')](_0x4a09df[_0xc6fe('0x59')][_0xc6fe('0x60')],_0x4a09df[_0xc6fe('0x59')][_0xc6fe('0x3c')]);_0x4a09df[_0xc6fe('0x59')][_0xc6fe('0x61')]=integrations[_0xc6fe('0x62')](_0x4a09df[_0xc6fe('0x59')][_0xc6fe('0x60')],_0x4a09df[_0xc6fe('0x59')][_0xc6fe('0x3c')]);return db[_0xc6fe('0x5a')][_0xc6fe('0x58')](_0x4a09df[_0xc6fe('0x59')],{'include':[{'model':db[_0xc6fe('0x63')],'as':_0xc6fe('0x5e')},{'model':db[_0xc6fe('0x63')],'as':_0xc6fe('0x61')}]});}return null;})[_0xc6fe('0x34')](respondWithResult(_0x3f563e,null))[_0xc6fe('0x29')](handleError(_0x3f563e,null));};function getAccessToken(_0x353d3f){return new Promise(function(_0x32dd61,_0x65e41){var _0x5bfeb0;switch(_0x353d3f['zone']){case'US':_0x5bfeb0=_0xc6fe('0x64');break;case'AU':_0x5bfeb0=_0xc6fe('0x65');break;case'EU':_0x5bfeb0=_0xc6fe('0x66');break;case'IN':_0x5bfeb0=_0xc6fe('0x67');break;case'CN':_0x5bfeb0='https://accounts.zoho.com.cn';break;default:_0x5bfeb0='https://accounts.zoho.eu';break;}var _0x1a334c={'method':_0xc6fe('0x68'),'uri':_0x5bfeb0+_0xc6fe('0x69'),'qs':{'refresh_token':_0x353d3f['refreshToken'],'client_id':_0x353d3f[_0xc6fe('0x6a')],'client_secret':_0x353d3f[_0xc6fe('0x6b')],'grant_type':_0xc6fe('0x6c')},'json':!![]};return rp(_0x1a334c)[_0xc6fe('0x34')](function(_0x34b799){if(_0x34b799['access_token']){_0x32dd61(_0x34b799[_0xc6fe('0x6d')]);}else{_0x65e41(_0xc6fe('0x6e'));}})[_0xc6fe('0x29')](function(_0x574757){_0x65e41(_0x574757);});});}exports[_0xc6fe('0x6f')]=function(_0x536f4d,_0x4e90de,_0x4a6677){var _0x52d20c,_0x490613,_0x340cce,_0x7886df,_0x381835;return db[_0xc6fe('0x3a')][_0xc6fe('0x5d')]({'where':{'id':_0x536f4d['params']['id']},'attributes':['id',_0xc6fe('0x70'),_0xc6fe('0x71'),_0xc6fe('0x6a'),_0xc6fe('0x6b'),_0xc6fe('0x72'),_0xc6fe('0x26'),_0xc6fe('0x73')]})[_0xc6fe('0x34')](handleEntityNotFound(_0x4e90de,null))[_0xc6fe('0x34')](function(_0x3bda89){_0x381835=_0x3bda89;_0x52d20c=_0x381835['host'];_0x490613=_0x52d20c==='zoho.eu'?'eu':_0xc6fe('0x74');_0x340cce=_0x381835[_0xc6fe('0x72')];var _0x1686be=_0x340cce[_0xc6fe('0x75')](-0x1);if(_0x1686be==='/'||_0x1686be==='\x5c'||_0x1686be===':'){_0x340cce=_0x340cce['substring'](0x0,_0x340cce['lastIndexOf'](_0x1686be));}if(!_0x381835[_0xc6fe('0x73')]){throw new Error(_0xc6fe('0x76'));}return getAccessToken(_0x381835);})[_0xc6fe('0x34')](function(_0x4ec472){if(_0x4ec472){return rp({'method':_0xc6fe('0x77'),'uri':util[_0xc6fe('0x78')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x490613),'qs':{'module':_0xc6fe('0x79')},'headers':{'Authorization':_0xc6fe('0x7a')+_0x4ec472},'json':!![]});}})[_0xc6fe('0x34')](function(_0x226b67){if(_0x226b67){if(_0x226b67[_0xc6fe('0x7b')]&&_0x226b67[_0xc6fe('0x7b')][_0xc6fe('0x25')]){throw new Error(_0x226b67['response'][_0xc6fe('0x25')]['message']);}var _0x394a55=[];var _0x1ef4af=[];var _0x4e78d2=[_0xc6fe('0x7c'),_0xc6fe('0x7d'),_0xc6fe('0x7e'),'WhoId',_0xc6fe('0x7f'),_0xc6fe('0x80'),_0xc6fe('0x81'),_0xc6fe('0x82')];_0x1ef4af=_['remove'](_0x226b67['fields'],function(_0x3e147b){return _0x4e78d2[_0xc6fe('0x83')](_0x3e147b[_0xc6fe('0x84')]);});for(var _0x5245ad=0x0;_0x5245ad<_0x1ef4af[_0xc6fe('0x55')];_0x5245ad++){if(_0x1ef4af[_0x5245ad]['system_mandatory']===![]){_0x394a55[_0xc6fe('0x85')]({'id':_0x1ef4af[_0x5245ad]['id'],'name':_0x1ef4af[_0x5245ad]['display_label'],'custom':_0x1ef4af[_0x5245ad]['custom_field'],'options':_0x1ef4af[_0x5245ad]['data_type']===_0xc6fe('0x86')&&_0x1ef4af[_0x5245ad][_0xc6fe('0x87')][_0xc6fe('0x55')]>-0x1?_['map'](_0x1ef4af[_0x5245ad][_0xc6fe('0x87')],function(_0x43bc0b){return{'name':_0x43bc0b,'value':_0x43bc0b};}):[]});}}return{'count':_0x394a55[_0xc6fe('0x55')],'rows':_0x394a55};}else{return{'count':0x0,'rows':[]};}})[_0xc6fe('0x34')](respondWithResult(_0x4e90de,null))['catch'](function(_0x59e84a){var _0x11e482=_0x536f4d[_0xc6fe('0x3f')]['test']?0x1f4:_0x59e84a[_0xc6fe('0x88')]||0x1f4;logger[_0xc6fe('0x25')](_0xc6fe('0x89'),'getFields',_0x11e482,JSON[_0xc6fe('0x24')](_0x59e84a));delete _0x59e84a['name'];if(_0x11e482===0x191){_0x11e482=0x190;}_0x4e90de['status'](_0x11e482)[_0xc6fe('0x8a')](_0x536f4d[_0xc6fe('0x3f')][_0xc6fe('0x8b')]?{'message':_0xc6fe('0x8c'),'statusCode':_0x59e84a[_0xc6fe('0x88')]}:_0x59e84a);});}; \ No newline at end of file +var _0xcb02=['end','json','count','limit','set','apply','reject','save','update','then','destroy','stack','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','nolimit','offset','order','sort','where','pick','filter','options','ZohoAccount','includeAll','include','findAll','rows','params','find','create','body','getConfigurations','findOne','ZohoConfiguration','merge','hasOwnProperty','Subjects','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Subject','Description','WhoId','Call_Duration','Call_Start_Time','remove','includes','system_mandatory','display_label','data_type','picklist','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status'];(function(_0x5e12e8,_0x59354f){var _0x403807=function(_0x20b3dd){while(--_0x20b3dd){_0x5e12e8['push'](_0x5e12e8['shift']());}};_0x403807(++_0x59354f);}(_0xcb02,0x1e9));var _0x2cb0=function(_0x1dd0c1,_0xdbdae7){_0x1dd0c1=_0x1dd0c1-0x0;var _0x5760ba=_0xcb02[_0x1dd0c1];return _0x5760ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2cb0('0x0'));var zipdir=require(_0x2cb0('0x1'));var jsonpatch=require(_0x2cb0('0x2'));var rp=require(_0x2cb0('0x3'));var moment=require(_0x2cb0('0x4'));var BPromise=require(_0x2cb0('0x5'));var Mustache=require('mustache');var util=require(_0x2cb0('0x6'));var path=require(_0x2cb0('0x7'));var sox=require(_0x2cb0('0x8'));var csv=require(_0x2cb0('0x9'));var ejs=require(_0x2cb0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2cb0('0xb'));var squel=require(_0x2cb0('0xc'));var crypto=require(_0x2cb0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2cb0('0xe'));var toCsv=require(_0x2cb0('0x9'));var querystring=require(_0x2cb0('0xf'));var Papa=require('papaparse');var Redis=require(_0x2cb0('0x10'));var authService=require(_0x2cb0('0x11'));var qs=require(_0x2cb0('0x12'));var as=require(_0x2cb0('0x13'));var hardwareService=require(_0x2cb0('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x2cb0('0x15'));var config=require(_0x2cb0('0x16'));var licenseUtil=require(_0x2cb0('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x2cb0('0x18'));var client=jayson[_0x2cb0('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494266,_0x51cc95,_0x5f2749,_0x366a10){return new BPromise(function(_0x4c76ea,_0x465387){var _0x22def9=_0x366a10||client;return _0x22def9['request'](_0x494266,_0x5f2749)['then'](function(_0x46172b){logger[_0x2cb0('0x1a')](_0x2cb0('0x1b'),_0x51cc95,'request\x20sent');logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x51cc95,_0x2cb0('0x1c'),JSON[_0x2cb0('0x1d')](_0x46172b));if(_0x46172b['error']){if(_0x46172b[_0x2cb0('0x1e')]['code']===0x1f4){logger[_0x2cb0('0x1e')](_0x2cb0('0x1b'),_0x51cc95,_0x46172b['error']['message']);return _0x465387(_0x46172b['error'][_0x2cb0('0x1f')]);}logger['error'](_0x2cb0('0x1b'),_0x51cc95,_0x46172b[_0x2cb0('0x1e')]['message']);return _0x4c76ea(_0x46172b['error'][_0x2cb0('0x1f')]);}else{logger[_0x2cb0('0x1a')](_0x2cb0('0x1b'),_0x51cc95,_0x2cb0('0x1c'));_0x4c76ea(_0x46172b['result'][_0x2cb0('0x1f')]);}})[_0x2cb0('0x20')](function(_0xb54227){logger[_0x2cb0('0x1e')](_0x2cb0('0x1b'),_0x51cc95,_0xb54227);_0x465387(_0xb54227);});});}function respondWithStatusCode(_0x2054c6,_0x21c01d){_0x21c01d=_0x21c01d||0xcc;return function(_0x4f042d){if(_0x4f042d){return _0x2054c6[_0x2cb0('0x21')](_0x21c01d);}return _0x2054c6[_0x2cb0('0x22')](_0x21c01d)[_0x2cb0('0x23')]();};}function respondWithResult(_0x15d92d,_0x4829b5){_0x4829b5=_0x4829b5||0xc8;return function(_0x59460d){if(_0x59460d){return _0x15d92d[_0x2cb0('0x22')](_0x4829b5)[_0x2cb0('0x24')](_0x59460d);}};}function respondWithFilteredResult(_0x49fbb6,_0x3cdb79){return function(_0x2ff060){if(_0x2ff060){var _0x2cc126=_0x2ff060[_0x2cb0('0x25')],_0x533c4a=_0x3cdb79['offset'],_0x3836e8=_0x3cdb79['offset']+_0x3cdb79[_0x2cb0('0x26')],_0x57f471;if(_0x3836e8>=_0x2cc126){_0x3836e8=_0x2cc126;_0x57f471=0xc8;}else{_0x57f471=0xce;}_0x49fbb6[_0x2cb0('0x22')](_0x57f471);return _0x49fbb6[_0x2cb0('0x27')]('Content-Range',_0x533c4a+'-'+_0x3836e8+'/'+_0x2cc126)[_0x2cb0('0x24')](_0x2ff060);}return null;};}function patchUpdates(_0x48535b){return function(_0x382b58){try{jsonpatch[_0x2cb0('0x28')](_0x382b58,_0x48535b,!![]);}catch(_0x3ee310){return BPromise[_0x2cb0('0x29')](_0x3ee310);}return _0x382b58[_0x2cb0('0x2a')]();};}function saveUpdates(_0x3ea376,_0x11ca96){return function(_0xc38ca0){if(_0xc38ca0){return _0xc38ca0[_0x2cb0('0x2b')](_0x3ea376)[_0x2cb0('0x2c')](function(_0x56f13c){return _0x56f13c;});}return null;};}function removeEntity(_0x4208ec,_0x5f230f){return function(_0x7d8480){if(_0x7d8480){return _0x7d8480[_0x2cb0('0x2d')]()['then'](function(){_0x4208ec[_0x2cb0('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f2623,_0x88ec39){return function(_0x39dfc0){if(!_0x39dfc0){_0x5f2623[_0x2cb0('0x21')](0x194);}return _0x39dfc0;};}function handleError(_0x6e44df,_0x342e55){_0x342e55=_0x342e55||0x1f4;return function(_0x18e27f){logger[_0x2cb0('0x1e')](_0x18e27f[_0x2cb0('0x2e')]);if(_0x18e27f['name']){delete _0x18e27f['name'];}_0x6e44df[_0x2cb0('0x22')](_0x342e55)['send'](_0x18e27f);};}exports[_0x2cb0('0x2f')]=function(_0x253f23,_0x425e23){var _0x56883f={},_0x124370={},_0x5619ec={'count':0x0,'rows':[]};var _0x3ab86d=_[_0x2cb0('0x30')](db['ZohoAccount'][_0x2cb0('0x31')],function(_0x864d48){return{'name':_0x864d48[_0x2cb0('0x32')],'type':_0x864d48[_0x2cb0('0x33')][_0x2cb0('0x34')]};});_0x124370[_0x2cb0('0x35')]=_[_0x2cb0('0x30')](_0x3ab86d,_0x2cb0('0x36'));_0x124370[_0x2cb0('0x37')]=_[_0x2cb0('0x38')](_0x253f23[_0x2cb0('0x37')]);_0x124370[_0x2cb0('0x39')]=_['intersection'](_0x124370[_0x2cb0('0x35')],_0x124370[_0x2cb0('0x37')]);_0x56883f[_0x2cb0('0x3a')]=_[_0x2cb0('0x3b')](_0x124370[_0x2cb0('0x35')],qs[_0x2cb0('0x3c')](_0x253f23[_0x2cb0('0x37')]['fields']));_0x56883f[_0x2cb0('0x3a')]=_0x56883f[_0x2cb0('0x3a')][_0x2cb0('0x3d')]?_0x56883f[_0x2cb0('0x3a')]:_0x124370[_0x2cb0('0x35')];if(!_0x253f23['query']['hasOwnProperty'](_0x2cb0('0x3e'))){_0x56883f[_0x2cb0('0x26')]=qs[_0x2cb0('0x26')](_0x253f23['query'][_0x2cb0('0x26')]);_0x56883f[_0x2cb0('0x3f')]=qs[_0x2cb0('0x3f')](_0x253f23['query'][_0x2cb0('0x3f')]);}_0x56883f[_0x2cb0('0x40')]=qs['sort'](_0x253f23[_0x2cb0('0x37')][_0x2cb0('0x41')]);_0x56883f[_0x2cb0('0x42')]=qs[_0x2cb0('0x39')](_[_0x2cb0('0x43')](_0x253f23['query'],_0x124370[_0x2cb0('0x39')]),_0x3ab86d);if(_0x253f23[_0x2cb0('0x37')][_0x2cb0('0x44')]){_0x56883f[_0x2cb0('0x42')]=_['merge'](_0x56883f['where'],{'$or':_[_0x2cb0('0x30')](_0x3ab86d,function(_0x50ff53){if(_0x50ff53[_0x2cb0('0x33')]!=='VIRTUAL'){var _0x235a35={};_0x235a35[_0x50ff53['name']]={'$like':'%'+_0x253f23[_0x2cb0('0x37')][_0x2cb0('0x44')]+'%'};return _0x235a35;}})});}_0x56883f=_['merge']({},_0x56883f,_0x253f23[_0x2cb0('0x45')]);var _0x2af10d={'where':_0x56883f['where']};return db[_0x2cb0('0x46')]['count'](_0x2af10d)['then'](function(_0xd02231){_0x5619ec[_0x2cb0('0x25')]=_0xd02231;if(_0x253f23['query'][_0x2cb0('0x47')]){_0x56883f[_0x2cb0('0x48')]=[{'all':!![]}];}return db[_0x2cb0('0x46')][_0x2cb0('0x49')](_0x56883f);})[_0x2cb0('0x2c')](function(_0xc8dd9a){_0x5619ec[_0x2cb0('0x4a')]=_0xc8dd9a;return _0x5619ec;})[_0x2cb0('0x2c')](respondWithFilteredResult(_0x425e23,_0x56883f))[_0x2cb0('0x20')](handleError(_0x425e23,null));};exports['show']=function(_0x4106fe,_0x41e9c9){var _0x48aab8={'raw':![],'where':{'id':_0x4106fe[_0x2cb0('0x4b')]['id']}},_0x238c04={};_0x238c04['model']=_['keys'](db['ZohoAccount'][_0x2cb0('0x31')]);_0x238c04['query']=_[_0x2cb0('0x38')](_0x4106fe[_0x2cb0('0x37')]);_0x238c04[_0x2cb0('0x39')]=_[_0x2cb0('0x3b')](_0x238c04[_0x2cb0('0x35')],_0x238c04[_0x2cb0('0x37')]);_0x48aab8['attributes']=_[_0x2cb0('0x3b')](_0x238c04['model'],qs[_0x2cb0('0x3c')](_0x4106fe[_0x2cb0('0x37')][_0x2cb0('0x3c')]));_0x48aab8[_0x2cb0('0x3a')]=_0x48aab8[_0x2cb0('0x3a')]['length']?_0x48aab8[_0x2cb0('0x3a')]:_0x238c04['model'];if(_0x4106fe[_0x2cb0('0x37')][_0x2cb0('0x47')]){_0x48aab8[_0x2cb0('0x48')]=[{'all':!![]}];}_0x48aab8=_['merge']({},_0x48aab8,_0x4106fe[_0x2cb0('0x45')]);return db['ZohoAccount'][_0x2cb0('0x4c')](_0x48aab8)[_0x2cb0('0x2c')](handleEntityNotFound(_0x41e9c9,null))[_0x2cb0('0x2c')](respondWithResult(_0x41e9c9,null))['catch'](handleError(_0x41e9c9,null));};exports[_0x2cb0('0x4d')]=function(_0x426ea1,_0x5330d5){return db[_0x2cb0('0x46')][_0x2cb0('0x4d')](_0x426ea1[_0x2cb0('0x4e')],{})[_0x2cb0('0x2c')](respondWithResult(_0x5330d5,0xc9))[_0x2cb0('0x20')](handleError(_0x5330d5,null));};exports[_0x2cb0('0x2b')]=function(_0x4e77cf,_0xf9b277){if(_0x4e77cf['body']['id']){delete _0x4e77cf[_0x2cb0('0x4e')]['id'];}return db[_0x2cb0('0x46')][_0x2cb0('0x4c')]({'where':{'id':_0x4e77cf[_0x2cb0('0x4b')]['id']}})[_0x2cb0('0x2c')](handleEntityNotFound(_0xf9b277,null))['then'](saveUpdates(_0x4e77cf[_0x2cb0('0x4e')],null))['then'](respondWithResult(_0xf9b277,null))[_0x2cb0('0x20')](handleError(_0xf9b277,null));};exports[_0x2cb0('0x2d')]=function(_0x55ccc8,_0x20df7d){return db[_0x2cb0('0x46')][_0x2cb0('0x4c')]({'where':{'id':_0x55ccc8[_0x2cb0('0x4b')]['id']}})[_0x2cb0('0x2c')](handleEntityNotFound(_0x20df7d,null))[_0x2cb0('0x2c')](removeEntity(_0x20df7d,null))[_0x2cb0('0x20')](handleError(_0x20df7d,null));};exports[_0x2cb0('0x4f')]=function(_0x35b8da,_0x2d7929,_0x1c6e50){var _0x31c418={};var _0x4404a1={};var _0x425d1b;var _0x5165ab;return db[_0x2cb0('0x46')][_0x2cb0('0x50')]({'where':{'id':_0x35b8da[_0x2cb0('0x4b')]['id']}})[_0x2cb0('0x2c')](handleEntityNotFound(_0x2d7929,null))[_0x2cb0('0x2c')](function(_0x3799ee){if(_0x3799ee){_0x425d1b=_0x3799ee;_0x4404a1[_0x2cb0('0x35')]=_[_0x2cb0('0x38')](db[_0x2cb0('0x51')]['rawAttributes']);_0x4404a1['query']=_[_0x2cb0('0x38')](_0x35b8da['query']);_0x4404a1[_0x2cb0('0x39')]=_['intersection'](_0x4404a1[_0x2cb0('0x35')],_0x4404a1['query']);_0x31c418[_0x2cb0('0x3a')]=_[_0x2cb0('0x3b')](_0x4404a1['model'],qs[_0x2cb0('0x3c')](_0x35b8da[_0x2cb0('0x37')][_0x2cb0('0x3c')]));_0x31c418[_0x2cb0('0x3a')]=_0x31c418[_0x2cb0('0x3a')][_0x2cb0('0x3d')]?_0x31c418['attributes']:_0x4404a1[_0x2cb0('0x35')];_0x31c418[_0x2cb0('0x40')]=qs[_0x2cb0('0x41')](_0x35b8da[_0x2cb0('0x37')][_0x2cb0('0x41')]);_0x31c418['where']=qs['filters'](_[_0x2cb0('0x43')](_0x35b8da[_0x2cb0('0x37')],_0x4404a1[_0x2cb0('0x39')]));if(_0x35b8da['query'][_0x2cb0('0x44')]){_0x31c418[_0x2cb0('0x42')]=_[_0x2cb0('0x52')](_0x31c418[_0x2cb0('0x42')],{'$or':_[_0x2cb0('0x30')](_0x31c418[_0x2cb0('0x3a')],function(_0x2a4932){var _0x363416={};_0x363416[_0x2a4932]={'$like':'%'+_0x35b8da[_0x2cb0('0x37')][_0x2cb0('0x44')]+'%'};return _0x363416;})});}_0x31c418=_['merge']({},_0x31c418,_0x35b8da[_0x2cb0('0x45')]);return _0x425d1b[_0x2cb0('0x4f')](_0x31c418);}})[_0x2cb0('0x2c')](function(_0xbe8eff){if(_0xbe8eff){_0x5165ab=_0xbe8eff[_0x2cb0('0x3d')];if(!_0x35b8da['query'][_0x2cb0('0x53')](_0x2cb0('0x3e'))){_0x31c418['limit']=qs[_0x2cb0('0x26')](_0x35b8da[_0x2cb0('0x37')]['limit']);_0x31c418['offset']=qs[_0x2cb0('0x3f')](_0x35b8da[_0x2cb0('0x37')][_0x2cb0('0x3f')]);}return _0x425d1b[_0x2cb0('0x4f')](_0x31c418);}})['then'](function(_0x1c4f7){if(_0x1c4f7){return _0x1c4f7?{'count':_0x5165ab,'rows':_0x1c4f7}:null;}})['then'](respondWithResult(_0x2d7929,null))['catch'](handleError(_0x2d7929,null));};exports['addConfiguration']=function(_0x4d81cd,_0x229150,_0x127f43){if(_0x4d81cd[_0x2cb0('0x4e')]['id']){delete _0x4d81cd['body']['id'];}return db[_0x2cb0('0x46')]['findOne']({'where':{'id':_0x4d81cd[_0x2cb0('0x4b')]['id']}})[_0x2cb0('0x2c')](handleEntityNotFound(_0x229150,null))['then'](function(_0x4da070){if(_0x4da070){_0x4d81cd[_0x2cb0('0x4e')]['AccountId']=_0x4da070['id'];_0x4d81cd['body'][_0x2cb0('0x54')]=integrations[_0x2cb0('0x55')](_0x4d81cd[_0x2cb0('0x4e')][_0x2cb0('0x56')],_0x4d81cd['body'][_0x2cb0('0x33')]);_0x4d81cd[_0x2cb0('0x4e')][_0x2cb0('0x57')]=integrations['getDescriptions'](_0x4d81cd[_0x2cb0('0x4e')][_0x2cb0('0x56')],_0x4d81cd[_0x2cb0('0x4e')]['type']);return db[_0x2cb0('0x51')][_0x2cb0('0x4d')](_0x4d81cd[_0x2cb0('0x4e')],{'include':[{'model':db[_0x2cb0('0x58')],'as':_0x2cb0('0x54')},{'model':db[_0x2cb0('0x58')],'as':_0x2cb0('0x57')}]});}return null;})[_0x2cb0('0x2c')](respondWithResult(_0x229150,null))[_0x2cb0('0x20')](handleError(_0x229150,null));};function getAccessToken(_0x470540){return new Promise(function(_0x19fc96,_0x8b436){var _0x2c66fc;switch(_0x470540[_0x2cb0('0x59')]){case'US':_0x2c66fc='https://accounts.zoho.com';break;case'AU':_0x2c66fc='https://accounts.zoho.com.au';break;case'EU':_0x2c66fc=_0x2cb0('0x5a');break;case'IN':_0x2c66fc=_0x2cb0('0x5b');break;case'CN':_0x2c66fc=_0x2cb0('0x5c');break;default:_0x2c66fc='https://accounts.zoho.eu';break;}var _0x5d6f00={'method':_0x2cb0('0x5d'),'uri':_0x2c66fc+_0x2cb0('0x5e'),'qs':{'refresh_token':_0x470540[_0x2cb0('0x5f')],'client_id':_0x470540[_0x2cb0('0x60')],'client_secret':_0x470540['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5d6f00)[_0x2cb0('0x2c')](function(_0x1d0cd0){if(_0x1d0cd0['access_token']){_0x19fc96(_0x1d0cd0[_0x2cb0('0x61')]);}else{_0x8b436(_0x2cb0('0x62'));}})[_0x2cb0('0x20')](function(_0x29e74b){_0x8b436(_0x29e74b);});});}exports[_0x2cb0('0x63')]=function(_0x272493,_0x384fc8,_0x95bd4a){var _0x4442a2,_0x8a7c16,_0x2d774a,_0x15ab32,_0x5ecc6d;return db['ZohoAccount'][_0x2cb0('0x50')]({'where':{'id':_0x272493['params']['id']},'attributes':['id',_0x2cb0('0x64'),_0x2cb0('0x59'),'clientId',_0x2cb0('0x65'),_0x2cb0('0x66'),_0x2cb0('0x67'),_0x2cb0('0x5f')]})[_0x2cb0('0x2c')](handleEntityNotFound(_0x384fc8,null))[_0x2cb0('0x2c')](function(_0x564cb1){_0x5ecc6d=_0x564cb1;_0x4442a2=_0x5ecc6d[_0x2cb0('0x64')];_0x8a7c16=_0x4442a2===_0x2cb0('0x68')?'eu':_0x2cb0('0x69');_0x2d774a=_0x5ecc6d['serverUrl'];var _0x372f42=_0x2d774a[_0x2cb0('0x6a')](-0x1);if(_0x372f42==='/'||_0x372f42==='\x5c'||_0x372f42===':'){_0x2d774a=_0x2d774a[_0x2cb0('0x6b')](0x0,_0x2d774a[_0x2cb0('0x6c')](_0x372f42));}if(!_0x5ecc6d[_0x2cb0('0x5f')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x5ecc6d);})[_0x2cb0('0x2c')](function(_0x2ddf06){if(_0x2ddf06){return rp({'method':_0x2cb0('0x6d'),'uri':util[_0x2cb0('0x6e')](_0x2cb0('0x6f'),_0x8a7c16),'qs':{'module':_0x2cb0('0x70')},'headers':{'Authorization':_0x2cb0('0x71')+_0x2ddf06},'json':!![]});}})['then'](function(_0x10c815){if(_0x10c815){if(_0x10c815[_0x2cb0('0x72')]&&_0x10c815[_0x2cb0('0x72')][_0x2cb0('0x1e')]){throw new Error(_0x10c815[_0x2cb0('0x72')][_0x2cb0('0x1e')][_0x2cb0('0x1f')]);}var _0xa7447e=[];var _0xb92dd8=[];var _0x4d70a7=['Owner',_0x2cb0('0x73'),_0x2cb0('0x74'),_0x2cb0('0x75'),_0x2cb0('0x76'),'Call_Result',_0x2cb0('0x77'),'Call_Type'];_0xb92dd8=_[_0x2cb0('0x78')](_0x10c815['fields'],function(_0x489375){return _0x4d70a7[_0x2cb0('0x79')](_0x489375['api_name']);});for(var _0x174ec3=0x0;_0x174ec3<_0xb92dd8[_0x2cb0('0x3d')];_0x174ec3++){if(_0xb92dd8[_0x174ec3][_0x2cb0('0x7a')]===![]){_0xa7447e['push']({'id':_0xb92dd8[_0x174ec3]['id'],'name':_0xb92dd8[_0x174ec3][_0x2cb0('0x7b')],'custom':_0xb92dd8[_0x174ec3]['custom_field'],'options':_0xb92dd8[_0x174ec3][_0x2cb0('0x7c')]===_0x2cb0('0x7d')&&_0xb92dd8[_0x174ec3][_0x2cb0('0x7e')][_0x2cb0('0x3d')]>-0x1?_[_0x2cb0('0x30')](_0xb92dd8[_0x174ec3][_0x2cb0('0x7e')],function(_0x5bc78a){return{'name':_0x5bc78a,'value':_0x5bc78a};}):[]});}}return{'count':_0xa7447e[_0x2cb0('0x3d')],'rows':_0xa7447e};}else{return{'count':0x0,'rows':[]};}})[_0x2cb0('0x2c')](respondWithResult(_0x384fc8,null))[_0x2cb0('0x20')](function(_0x53f540){var _0x2664da=_0x272493['query']['test']?0x1f4:_0x53f540['statusCode']||0x1f4;logger[_0x2cb0('0x1e')](_0x2cb0('0x7f'),_0x2cb0('0x63'),_0x2664da,JSON[_0x2cb0('0x1d')](_0x53f540));delete _0x53f540[_0x2cb0('0x36')];if(_0x2664da===0x191){_0x2664da=0x190;}_0x384fc8[_0x2cb0('0x22')](_0x2664da)['send'](_0x272493[_0x2cb0('0x37')][_0x2cb0('0x80')]?{'message':_0x2cb0('0x81'),'statusCode':_0x53f540[_0x2cb0('0x82')]}:_0x53f540);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index ac98f80..c189420 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 _0x265f=['changed','zone','serverUrl','clientId','clientSecret','code','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','application/x-www-form-urlencoded','then','parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','error','https://accounts.zoho.com.au','https://accounts.zoho.in','authorization_code','lodash','../../config/logger','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts'];(function(_0x1ed034,_0x5d495d){var _0x4a82b7=function(_0x348231){while(--_0x348231){_0x1ed034['push'](_0x1ed034['shift']());}};_0x4a82b7(++_0x5d495d);}(_0x265f,0x155));var _0xf265=function(_0x4ecd76,_0x79f1f3){_0x4ecd76=_0x4ecd76-0x0;var _0x240f34=_0x265f[_0x4ecd76];return _0x240f34;};'use strict';var _=require(_0xf265('0x0'));var util=require('util');var logger=require(_0xf265('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf265('0x2'));var fs=require('fs');var path=require(_0xf265('0x3'));var rimraf=require('rimraf');var config=require(_0xf265('0x4'));var attributes=require(_0xf265('0x5'));var integrations=require(_0xf265('0x6'));module['exports']=function(_0x410cd0,_0x244b0b){return _0x410cd0[_0xf265('0x7')](_0xf265('0x8'),attributes,{'tableName':_0xf265('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3784c9,_0x242229,_0x3f1981){if(_0x3784c9[_0xf265('0xa')](_0xf265('0xb'))||_0x3784c9[_0xf265('0xa')](_0xf265('0xc'))||_0x3784c9[_0xf265('0xa')](_0xf265('0xd'))||_0x3784c9[_0xf265('0xa')](_0xf265('0xe'))||_0x3784c9[_0xf265('0xa')](_0xf265('0xf'))||_0x3784c9[_0xf265('0xa')]('host')){var _0xf01a68,_0x669935;_0xf01a68=_0x3784c9[_0xf265('0xc')];var _0x4c8d4a=_0xf01a68[_0xf265('0x10')](-0x1);if(_0x4c8d4a==='/'||_0x4c8d4a==='\x5c'||_0x4c8d4a===':'){_0xf01a68=_0xf01a68[_0xf265('0x11')](0x0,_0xf01a68[_0xf265('0x12')](_0x4c8d4a));}switch(_0x3784c9[_0xf265('0xb')]){case'US':_0x669935=_0xf265('0x13');break;case'AU':_0x669935='https://accounts.zoho.com.au';break;case'IN':_0x669935='https://accounts.zoho.in';break;case'CN':_0x669935=_0xf265('0x14');break;default:_0x669935=_0xf265('0x15');break;}var _0x1d50e3={'method':_0xf265('0x16'),'uri':_0x669935+_0xf265('0x17'),'form':{'grant_type':'authorization_code','client_id':_0x3784c9[_0xf265('0xd')],'client_secret':_0x3784c9[_0xf265('0xe')],'redirect_uri':_0x3784c9[_0xf265('0xc')],'code':_0x3784c9[_0xf265('0xf')]},'headers':{'Content-Type':_0xf265('0x18')}};return rp(_0x1d50e3)[_0xf265('0x19')](function(_0x1b6ff4){var _0x5a4b1a=JSON[_0xf265('0x1a')](_0x1b6ff4);if(_0x5a4b1a[_0xf265('0x1b')]){_0x3784c9['refreshToken']=_0x5a4b1a[_0xf265('0x1b')];logger[_0xf265('0x1c')](util[_0xf265('0x1d')](_0xf265('0x1e'),_0x3784c9[_0xf265('0x1f')],_0x3784c9['id']));}else{logger['error'](util[_0xf265('0x1d')](_0xf265('0x20'),_0x3784c9['name'],_0x3784c9['id']),util[_0xf265('0x21')](_0x5a4b1a,{'showHidden':![],'depth':null}));}return _0x3f1981(null,_0x242229);})[_0xf265('0x22')](function(_0x54e8f2){logger[_0xf265('0x23')](util[_0xf265('0x1d')](_0xf265('0x20'),_0x3784c9[_0xf265('0x1f')],_0x3784c9['id']),util[_0xf265('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x3f1981(_0x54e8f2);});}else{return _0x3f1981(null,_0x242229);}},'beforeUpdate':function(_0xbd28cb,_0x1b99d3,_0x5676e7){if(_0xbd28cb['changed'](_0xf265('0xb'))||_0xbd28cb[_0xf265('0xa')](_0xf265('0xc'))||_0xbd28cb['changed']('clientId')||_0xbd28cb['changed'](_0xf265('0xe'))||_0xbd28cb[_0xf265('0xa')](_0xf265('0xf'))||_0xbd28cb['changed']('host')){var _0x23ddd3,_0x53da94;_0x23ddd3=_0xbd28cb[_0xf265('0xc')];var _0x4ac0a0=_0x23ddd3[_0xf265('0x10')](-0x1);if(_0x4ac0a0==='/'||_0x4ac0a0==='\x5c'||_0x4ac0a0===':'){_0x23ddd3=_0x23ddd3['substring'](0x0,_0x23ddd3[_0xf265('0x12')](_0x4ac0a0));}switch(_0xbd28cb[_0xf265('0xb')]){case'US':_0x53da94='https://accounts.zoho.com';break;case'AU':_0x53da94=_0xf265('0x24');break;case'IN':_0x53da94=_0xf265('0x25');break;case'CN':_0x53da94='https://accounts.zoho.com.cn';break;default:_0x53da94=_0xf265('0x15');break;}var _0x39a104={'method':_0xf265('0x16'),'uri':_0x53da94+_0xf265('0x17'),'form':{'grant_type':_0xf265('0x26'),'client_id':_0xbd28cb[_0xf265('0xd')],'client_secret':_0xbd28cb[_0xf265('0xe')],'redirect_uri':_0xbd28cb['serverUrl'],'code':_0xbd28cb[_0xf265('0xf')]},'headers':{'Content-Type':_0xf265('0x18')}};return rp(_0x39a104)[_0xf265('0x19')](function(_0x2e8ddc){var _0x241c7b=JSON[_0xf265('0x1a')](_0x2e8ddc);if(_0x241c7b[_0xf265('0x1b')]){_0xbd28cb['refreshToken']=_0x241c7b[_0xf265('0x1b')];logger[_0xf265('0x1c')](util['format'](_0xf265('0x1e'),_0xbd28cb[_0xf265('0x1f')],_0xbd28cb['id']));}else{logger[_0xf265('0x23')](util[_0xf265('0x1d')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xbd28cb[_0xf265('0x1f')],_0xbd28cb['id']),util['inspect'](_0x241c7b,{'showHidden':![],'depth':null}));}return _0x5676e7(null,_0x1b99d3);})['catch'](function(_0x2a78fd){logger[_0xf265('0x23')](util[_0xf265('0x1d')](_0xf265('0x20'),_0xbd28cb[_0xf265('0x1f')],_0xbd28cb['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x5676e7(_0x2a78fd);});}else{return _0x5676e7(null,_0x1b99d3);}}}});}; \ No newline at end of file +var _0x1df3=['https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','error','https://accounts.zoho.com.cn','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in'];(function(_0x3f59b1,_0x25cdbe){var _0x11d2e8=function(_0x37b3fc){while(--_0x37b3fc){_0x3f59b1['push'](_0x3f59b1['shift']());}};_0x11d2e8(++_0x25cdbe);}(_0x1df3,0x18c));var _0x31df=function(_0x85b114,_0xb01d3b){_0x85b114=_0x85b114-0x0;var _0x4b64e7=_0x1df3[_0x85b114];return _0x4b64e7;};'use strict';var _=require(_0x31df('0x0'));var util=require(_0x31df('0x1'));var logger=require(_0x31df('0x2'))(_0x31df('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x31df('0x4'));var fs=require('fs');var path=require(_0x31df('0x5'));var rimraf=require('rimraf');var config=require(_0x31df('0x6'));var attributes=require(_0x31df('0x7'));var integrations=require(_0x31df('0x8'));module['exports']=function(_0x503883,_0x330c96){return _0x503883[_0x31df('0x9')](_0x31df('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x354fad,_0x654156,_0x474fbc){if(_0x354fad[_0x31df('0xb')](_0x31df('0xc'))||_0x354fad[_0x31df('0xb')](_0x31df('0xd'))||_0x354fad[_0x31df('0xb')](_0x31df('0xe'))||_0x354fad[_0x31df('0xb')](_0x31df('0xf'))||_0x354fad[_0x31df('0xb')](_0x31df('0x10'))||_0x354fad[_0x31df('0xb')](_0x31df('0x11'))){var _0x3c0f64,_0x180242;_0x3c0f64=_0x354fad['serverUrl'];var _0x17defc=_0x3c0f64[_0x31df('0x12')](-0x1);if(_0x17defc==='/'||_0x17defc==='\x5c'||_0x17defc===':'){_0x3c0f64=_0x3c0f64[_0x31df('0x13')](0x0,_0x3c0f64[_0x31df('0x14')](_0x17defc));}switch(_0x354fad[_0x31df('0xc')]){case'US':_0x180242=_0x31df('0x15');break;case'AU':_0x180242=_0x31df('0x16');break;case'IN':_0x180242=_0x31df('0x17');break;case'CN':_0x180242='https://accounts.zoho.com.cn';break;default:_0x180242=_0x31df('0x18');break;}var _0x3ee6ac={'method':_0x31df('0x19'),'uri':_0x180242+_0x31df('0x1a'),'form':{'grant_type':_0x31df('0x1b'),'client_id':_0x354fad['clientId'],'client_secret':_0x354fad[_0x31df('0xf')],'redirect_uri':_0x354fad[_0x31df('0xd')],'code':_0x354fad[_0x31df('0x10')]},'headers':{'Content-Type':_0x31df('0x1c')}};return rp(_0x3ee6ac)[_0x31df('0x1d')](function(_0x4bcfce){var _0x4fd187=JSON[_0x31df('0x1e')](_0x4bcfce);if(_0x4fd187[_0x31df('0x1f')]){_0x354fad[_0x31df('0x20')]=_0x4fd187['refresh_token'];logger[_0x31df('0x21')](util[_0x31df('0x22')](_0x31df('0x23'),_0x354fad[_0x31df('0x24')],_0x354fad['id']));}else{logger['error'](util[_0x31df('0x22')](_0x31df('0x25'),_0x354fad[_0x31df('0x24')],_0x354fad['id']),util[_0x31df('0x26')](_0x4fd187,{'showHidden':![],'depth':null}));}return _0x474fbc(null,_0x654156);})[_0x31df('0x27')](function(_0x139b47){logger[_0x31df('0x28')](util[_0x31df('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x354fad[_0x31df('0x24')],_0x354fad['id']),util[_0x31df('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x474fbc(_0x139b47);});}else{return _0x474fbc(null,_0x654156);}},'beforeUpdate':function(_0x4a14e9,_0x6d3540,_0x2c19e){if(_0x4a14e9[_0x31df('0xb')]('zone')||_0x4a14e9[_0x31df('0xb')]('serverUrl')||_0x4a14e9[_0x31df('0xb')](_0x31df('0xe'))||_0x4a14e9['changed'](_0x31df('0xf'))||_0x4a14e9[_0x31df('0xb')](_0x31df('0x10'))||_0x4a14e9[_0x31df('0xb')](_0x31df('0x11'))){var _0x590cf3,_0x1ae694;_0x590cf3=_0x4a14e9[_0x31df('0xd')];var _0x1605ea=_0x590cf3['slice'](-0x1);if(_0x1605ea==='/'||_0x1605ea==='\x5c'||_0x1605ea===':'){_0x590cf3=_0x590cf3['substring'](0x0,_0x590cf3[_0x31df('0x14')](_0x1605ea));}switch(_0x4a14e9['zone']){case'US':_0x1ae694=_0x31df('0x15');break;case'AU':_0x1ae694=_0x31df('0x16');break;case'IN':_0x1ae694=_0x31df('0x17');break;case'CN':_0x1ae694=_0x31df('0x29');break;default:_0x1ae694=_0x31df('0x18');break;}var _0x42a045={'method':_0x31df('0x19'),'uri':_0x1ae694+_0x31df('0x1a'),'form':{'grant_type':_0x31df('0x1b'),'client_id':_0x4a14e9[_0x31df('0xe')],'client_secret':_0x4a14e9[_0x31df('0xf')],'redirect_uri':_0x4a14e9['serverUrl'],'code':_0x4a14e9[_0x31df('0x10')]},'headers':{'Content-Type':_0x31df('0x1c')}};return rp(_0x42a045)[_0x31df('0x1d')](function(_0x871d4c){var _0x885753=JSON[_0x31df('0x1e')](_0x871d4c);if(_0x885753['refresh_token']){_0x4a14e9[_0x31df('0x20')]=_0x885753['refresh_token'];logger[_0x31df('0x21')](util[_0x31df('0x22')](_0x31df('0x23'),_0x4a14e9[_0x31df('0x24')],_0x4a14e9['id']));}else{logger['error'](util[_0x31df('0x22')](_0x31df('0x25'),_0x4a14e9['name'],_0x4a14e9['id']),util[_0x31df('0x26')](_0x885753,{'showHidden':![],'depth':null}));}return _0x2c19e(null,_0x6d3540);})['catch'](function(_0x413e0f){logger['error'](util[_0x31df('0x22')](_0x31df('0x25'),_0x4a14e9['name'],_0x4a14e9['id']),util[_0x31df('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x2c19e(_0x413e0f);});}else{return _0x2c19e(null,_0x6d3540);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 819c51e..14e1a74 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 _0x75ac=['message','info','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowZohoAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x3649d3,_0x283e04){var _0x44245a=function(_0x569c5a){while(--_0x569c5a){_0x3649d3['push'](_0x3649d3['shift']());}};_0x44245a(++_0x283e04);}(_0x75ac,0x1b6));var _0xc75a=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0x75ac[_0x519756];return _0x37047e;};'use strict';var _=require(_0xc75a('0x0'));var util=require('util');var moment=require(_0xc75a('0x1'));var BPromise=require(_0xc75a('0x2'));var rs=require(_0xc75a('0x3'));var fs=require('fs');var Redis=require(_0xc75a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc75a('0x5'));var logger=require(_0xc75a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc75a('0x7')][_0xc75a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ad1c2,_0x10bdd2,_0x2542b3){return new BPromise(function(_0x5d93bb,_0x1b5114){return client[_0xc75a('0x9')](_0x5ad1c2,_0x2542b3)[_0xc75a('0xa')](function(_0x2a3af2){logger['info'](_0xc75a('0xb'),_0x10bdd2,_0xc75a('0xc'));logger['debug'](_0xc75a('0xd'),_0x10bdd2,_0xc75a('0xc'),JSON[_0xc75a('0xe')](_0x2a3af2));if(_0x2a3af2['error']){if(_0x2a3af2['error'][_0xc75a('0xf')]===0x1f4){logger[_0xc75a('0x10')](_0xc75a('0xb'),_0x10bdd2,_0x2a3af2[_0xc75a('0x10')]['message']);return _0x1b5114(_0x2a3af2['error']['message']);}logger[_0xc75a('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x10bdd2,_0x2a3af2[_0xc75a('0x10')][_0xc75a('0x11')]);return _0x5d93bb(_0x2a3af2[_0xc75a('0x10')]['message']);}else{logger[_0xc75a('0x12')](_0xc75a('0xb'),_0x10bdd2,_0xc75a('0xc'));_0x5d93bb(_0x2a3af2[_0xc75a('0x13')][_0xc75a('0x11')]);}})[_0xc75a('0x14')](function(_0x47b4dd){logger[_0xc75a('0x10')](_0xc75a('0xb'),_0x10bdd2,_0x47b4dd);_0x1b5114(_0x47b4dd);});});}exports[_0xc75a('0x15')]=function(_0x4b640e){var _0x2e61a7=this;return new Promise(function(_0x5d0bd3,_0x23d517){return db[_0xc75a('0x16')][_0xc75a('0x17')]({'raw':_0x4b640e[_0xc75a('0x18')]?_0x4b640e[_0xc75a('0x18')][_0xc75a('0x19')]===undefined?!![]:![]:!![],'where':_0x4b640e['options']?_0x4b640e[_0xc75a('0x18')][_0xc75a('0x1a')]||null:null,'attributes':_0x4b640e[_0xc75a('0x18')]?_0x4b640e[_0xc75a('0x18')][_0xc75a('0x1b')]||null:null,'limit':_0x4b640e[_0xc75a('0x18')]?_0x4b640e['options'][_0xc75a('0x1c')]||null:null,'include':_0x4b640e[_0xc75a('0x18')]?_0x4b640e[_0xc75a('0x18')][_0xc75a('0x1d')]?_[_0xc75a('0x1e')](_0x4b640e[_0xc75a('0x18')][_0xc75a('0x1d')],function(_0x99003c){return{'model':db[_0x99003c[_0xc75a('0x1f')]],'as':_0x99003c['as'],'attributes':_0x99003c[_0xc75a('0x1b')],'include':_0x99003c[_0xc75a('0x1d')]?_['map'](_0x99003c[_0xc75a('0x1d')],function(_0x5a7f3c){return{'model':db[_0x5a7f3c[_0xc75a('0x1f')]],'as':_0x5a7f3c['as'],'attributes':_0x5a7f3c[_0xc75a('0x1b')],'include':_0x5a7f3c['include']?_['map'](_0x5a7f3c[_0xc75a('0x1d')],function(_0x3aff82){return{'model':db[_0x3aff82['model']],'as':_0x3aff82['as'],'attributes':_0x3aff82[_0xc75a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4be3a2){logger[_0xc75a('0x12')](_0xc75a('0x15'),_0x4b640e);logger[_0xc75a('0x20')](_0xc75a('0x15'),_0x4b640e,JSON[_0xc75a('0xe')](_0x4be3a2));_0x5d0bd3(_0x4be3a2);})['catch'](function(_0x537569){logger['error']('GetZohoAccount',_0x537569['message'],_0x4b640e);_0x23d517(_0x2e61a7['error'](0x1f4,_0x537569[_0xc75a('0x11')]));});});};exports[_0xc75a('0x21')]=function(_0x2bbe98){var _0x4bbf4c=this;return new Promise(function(_0x24ddcc,_0x2503c4){return db[_0xc75a('0x16')][_0xc75a('0x22')]({'raw':_0x2bbe98['options']?_0x2bbe98[_0xc75a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2bbe98[_0xc75a('0x18')]?_0x2bbe98['options'][_0xc75a('0x1a')]||null:null,'attributes':_0x2bbe98['options']?_0x2bbe98[_0xc75a('0x18')]['attributes']||null:null,'include':_0x2bbe98['options']?_0x2bbe98[_0xc75a('0x18')][_0xc75a('0x1d')]?_['map'](_0x2bbe98[_0xc75a('0x18')][_0xc75a('0x1d')],function(_0x1c5763){return{'model':db[_0x1c5763['model']],'as':_0x1c5763['as'],'attributes':_0x1c5763[_0xc75a('0x1b')],'include':_0x1c5763[_0xc75a('0x1d')]?_[_0xc75a('0x1e')](_0x1c5763[_0xc75a('0x1d')],function(_0x354649){return{'model':db[_0x354649[_0xc75a('0x1f')]],'as':_0x354649['as'],'attributes':_0x354649[_0xc75a('0x1b')],'include':_0x354649[_0xc75a('0x1d')]?_[_0xc75a('0x1e')](_0x354649[_0xc75a('0x1d')],function(_0x2eaa2a){return{'model':db[_0x2eaa2a[_0xc75a('0x1f')]],'as':_0x2eaa2a['as'],'attributes':_0x2eaa2a[_0xc75a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fcbf3){logger['info']('ShowZohoAccount',_0x2bbe98);logger['debug'](_0xc75a('0x21'),_0x2bbe98,JSON[_0xc75a('0xe')](_0x2fcbf3));_0x24ddcc(_0x2fcbf3);})['catch'](function(_0x51c8c1){logger[_0xc75a('0x10')](_0xc75a('0x21'),_0x51c8c1[_0xc75a('0x11')],_0x2bbe98);_0x2503c4(_0x4bbf4c[_0xc75a('0x10')](0x1f4,_0x51c8c1['message']));});});}; \ No newline at end of file +var _0xd2f3=['model','info','catch','ZohoAccount','find','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','GetZohoAccount','findAll','raw','options','where','attributes','limit','include','map'];(function(_0x934754,_0x15bd40){var _0x5cf1fc=function(_0x2c1de6){while(--_0x2c1de6){_0x934754['push'](_0x934754['shift']());}};_0x5cf1fc(++_0x15bd40);}(_0xd2f3,0x1b3));var _0x3d2f=function(_0x39e464,_0x114f4f){_0x39e464=_0x39e464-0x0;var _0xc0eadb=_0xd2f3[_0x39e464];return _0xc0eadb;};'use strict';var _=require(_0x3d2f('0x0'));var util=require(_0x3d2f('0x1'));var moment=require(_0x3d2f('0x2'));var BPromise=require(_0x3d2f('0x3'));var rs=require(_0x3d2f('0x4'));var fs=require('fs');var Redis=require(_0x3d2f('0x5'));var db=require(_0x3d2f('0x6'))['db'];var utils=require(_0x3d2f('0x7'));var logger=require(_0x3d2f('0x8'))(_0x3d2f('0x9'));var config=require(_0x3d2f('0xa'));var jayson=require(_0x3d2f('0xb'));var client=jayson['client'][_0x3d2f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4bbc6a,_0x4f949d,_0x2b0bb9){return new BPromise(function(_0x261470,_0x24a763){return client[_0x3d2f('0xd')](_0x4bbc6a,_0x2b0bb9)[_0x3d2f('0xe')](function(_0x5f347e){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x4f949d,_0x3d2f('0xf'));logger[_0x3d2f('0x10')](_0x3d2f('0x11'),_0x4f949d,_0x3d2f('0xf'),JSON[_0x3d2f('0x12')](_0x5f347e));if(_0x5f347e[_0x3d2f('0x13')]){if(_0x5f347e[_0x3d2f('0x13')][_0x3d2f('0x14')]===0x1f4){logger['error'](_0x3d2f('0x15'),_0x4f949d,_0x5f347e[_0x3d2f('0x13')][_0x3d2f('0x16')]);return _0x24a763(_0x5f347e['error'][_0x3d2f('0x16')]);}logger[_0x3d2f('0x13')](_0x3d2f('0x15'),_0x4f949d,_0x5f347e['error'][_0x3d2f('0x16')]);return _0x261470(_0x5f347e[_0x3d2f('0x13')]['message']);}else{logger['info']('ZohoAccount,\x20%s,\x20%s',_0x4f949d,_0x3d2f('0xf'));_0x261470(_0x5f347e[_0x3d2f('0x17')]['message']);}})['catch'](function(_0x42aaaf){logger['error'](_0x3d2f('0x15'),_0x4f949d,_0x42aaaf);_0x24a763(_0x42aaaf);});});}exports[_0x3d2f('0x18')]=function(_0x50cf48){var _0x356d7b=this;return new Promise(function(_0x3735a6,_0x3a0917){return db['ZohoAccount'][_0x3d2f('0x19')]({'raw':_0x50cf48['options']?_0x50cf48['options'][_0x3d2f('0x1a')]===undefined?!![]:![]:!![],'where':_0x50cf48[_0x3d2f('0x1b')]?_0x50cf48[_0x3d2f('0x1b')][_0x3d2f('0x1c')]||null:null,'attributes':_0x50cf48[_0x3d2f('0x1b')]?_0x50cf48['options'][_0x3d2f('0x1d')]||null:null,'limit':_0x50cf48[_0x3d2f('0x1b')]?_0x50cf48[_0x3d2f('0x1b')][_0x3d2f('0x1e')]||null:null,'include':_0x50cf48['options']?_0x50cf48['options'][_0x3d2f('0x1f')]?_[_0x3d2f('0x20')](_0x50cf48[_0x3d2f('0x1b')]['include'],function(_0x50d462){return{'model':db[_0x50d462[_0x3d2f('0x21')]],'as':_0x50d462['as'],'attributes':_0x50d462[_0x3d2f('0x1d')],'include':_0x50d462['include']?_[_0x3d2f('0x20')](_0x50d462[_0x3d2f('0x1f')],function(_0x4cea61){return{'model':db[_0x4cea61[_0x3d2f('0x21')]],'as':_0x4cea61['as'],'attributes':_0x4cea61[_0x3d2f('0x1d')],'include':_0x4cea61['include']?_[_0x3d2f('0x20')](_0x4cea61[_0x3d2f('0x1f')],function(_0x365303){return{'model':db[_0x365303[_0x3d2f('0x21')]],'as':_0x365303['as'],'attributes':_0x365303[_0x3d2f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3d2f('0xe')](function(_0xc7e8f7){logger[_0x3d2f('0x22')](_0x3d2f('0x18'),_0x50cf48);logger[_0x3d2f('0x10')](_0x3d2f('0x18'),_0x50cf48,JSON[_0x3d2f('0x12')](_0xc7e8f7));_0x3735a6(_0xc7e8f7);})[_0x3d2f('0x23')](function(_0x519364){logger[_0x3d2f('0x13')]('GetZohoAccount',_0x519364[_0x3d2f('0x16')],_0x50cf48);_0x3a0917(_0x356d7b[_0x3d2f('0x13')](0x1f4,_0x519364['message']));});});};exports['ShowZohoAccount']=function(_0x5c42a2){var _0x4d3921=this;return new Promise(function(_0x55ad9f,_0x1bbdeb){return db[_0x3d2f('0x24')][_0x3d2f('0x25')]({'raw':_0x5c42a2[_0x3d2f('0x1b')]?_0x5c42a2[_0x3d2f('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5c42a2[_0x3d2f('0x1b')]?_0x5c42a2[_0x3d2f('0x1b')]['where']||null:null,'attributes':_0x5c42a2[_0x3d2f('0x1b')]?_0x5c42a2['options'][_0x3d2f('0x1d')]||null:null,'include':_0x5c42a2['options']?_0x5c42a2[_0x3d2f('0x1b')][_0x3d2f('0x1f')]?_[_0x3d2f('0x20')](_0x5c42a2[_0x3d2f('0x1b')]['include'],function(_0x248099){return{'model':db[_0x248099[_0x3d2f('0x21')]],'as':_0x248099['as'],'attributes':_0x248099[_0x3d2f('0x1d')],'include':_0x248099[_0x3d2f('0x1f')]?_['map'](_0x248099['include'],function(_0xaad8b9){return{'model':db[_0xaad8b9[_0x3d2f('0x21')]],'as':_0xaad8b9['as'],'attributes':_0xaad8b9['attributes'],'include':_0xaad8b9[_0x3d2f('0x1f')]?_[_0x3d2f('0x20')](_0xaad8b9[_0x3d2f('0x1f')],function(_0x2eeddf){return{'model':db[_0x2eeddf[_0x3d2f('0x21')]],'as':_0x2eeddf['as'],'attributes':_0x2eeddf[_0x3d2f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3d2f('0xe')](function(_0x21b0d5){logger[_0x3d2f('0x22')](_0x3d2f('0x26'),_0x5c42a2);logger[_0x3d2f('0x10')](_0x3d2f('0x26'),_0x5c42a2,JSON[_0x3d2f('0x12')](_0x21b0d5));_0x55ad9f(_0x21b0d5);})[_0x3d2f('0x23')](function(_0x4839b8){logger[_0x3d2f('0x13')](_0x3d2f('0x26'),_0x4839b8[_0x3d2f('0x16')],_0x5c42a2);_0x1bbdeb(_0x4d3921[_0x3d2f('0x13')](0x1f4,_0x4839b8['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index fec0282..5f17c34 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 _0xa9b0=['put','update','destroy','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x20629d,_0x1a6757){var _0x4ca950=function(_0x2c806c){while(--_0x2c806c){_0x20629d['push'](_0x20629d['shift']());}};_0x4ca950(++_0x1a6757);}(_0xa9b0,0xcb));var _0x0a9b=function(_0x15942a,_0x13b58c){_0x15942a=_0x15942a-0x0;var _0x36a9fb=_0xa9b0[_0x15942a];return _0x36a9fb;};'use strict';var multer=require(_0x0a9b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0a9b('0x1'));var express=require('express');var router=express[_0x0a9b('0x2')]();var fs_extra=require(_0x0a9b('0x3'));var auth=require(_0x0a9b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0a9b('0x5'));var controller=require(_0x0a9b('0x6'));router[_0x0a9b('0x7')]('/',auth[_0x0a9b('0x8')](),controller['index']);router['get'](_0x0a9b('0x9'),auth[_0x0a9b('0x8')](),controller[_0x0a9b('0xa')]);router[_0x0a9b('0x7')]('/:id/fields',auth[_0x0a9b('0x8')](),controller[_0x0a9b('0xb')]);router[_0x0a9b('0x7')](_0x0a9b('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x0a9b('0x7')](_0x0a9b('0xd'),auth[_0x0a9b('0x8')](),controller[_0x0a9b('0xe')]);router[_0x0a9b('0xf')]('/',auth[_0x0a9b('0x8')](),controller[_0x0a9b('0x10')]);router[_0x0a9b('0x11')](_0x0a9b('0x9'),auth[_0x0a9b('0x8')](),controller[_0x0a9b('0x12')]);router['delete'](_0x0a9b('0x9'),auth[_0x0a9b('0x8')](),controller[_0x0a9b('0x13')]);module['exports']=router; \ No newline at end of file +var _0x9be7=['multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports'];(function(_0x429f69,_0x12e9cf){var _0x4f1025=function(_0xca0486){while(--_0xca0486){_0x429f69['push'](_0x429f69['shift']());}};_0x4f1025(++_0x12e9cf);}(_0x9be7,0xdc));var _0x79be=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0x9be7[_0x1b51ea];return _0x18bbdc;};'use strict';var multer=require(_0x79be('0x0'));var util=require(_0x79be('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x79be('0x2')]();var fs_extra=require(_0x79be('0x3'));var auth=require(_0x79be('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x79be('0x5'));var controller=require('./intZohoConfiguration.controller');router[_0x79be('0x6')]('/',auth[_0x79be('0x7')](),controller[_0x79be('0x8')]);router[_0x79be('0x6')](_0x79be('0x9'),auth[_0x79be('0x7')](),controller[_0x79be('0xa')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x79be('0xb')]);router[_0x79be('0x6')]('/:id/subjects',auth[_0x79be('0x7')](),controller[_0x79be('0xc')]);router[_0x79be('0x6')](_0x79be('0xd'),auth[_0x79be('0x7')](),controller[_0x79be('0xe')]);router[_0x79be('0xf')]('/',auth['isAuthenticated'](),controller[_0x79be('0x10')]);router[_0x79be('0x11')](_0x79be('0x9'),auth[_0x79be('0x7')](),controller[_0x79be('0x12')]);router[_0x79be('0x13')](_0x79be('0x9'),auth[_0x79be('0x7')](),controller[_0x79be('0x14')]);module[_0x79be('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 503f77e..56cc1c2 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 _0x6e70=['lead','contact','nothing','contact_lead','exports','ENUM'];(function(_0x53ae51,_0x2ecacd){var _0x468540=function(_0x4761a9){while(--_0x4761a9){_0x53ae51['push'](_0x53ae51['shift']());}};_0x468540(++_0x2ecacd);}(_0x6e70,0x19c));var _0x06e7=function(_0x2faccd,_0x377f20){_0x2faccd=_0x2faccd-0x0;var _0x3630e6=_0x6e70[_0x2faccd];return _0x3630e6;};'use strict';var Sequelize=require('sequelize');module[_0x06e7('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x06e7('0x1')](_0x06e7('0x2'),_0x06e7('0x3'),_0x06e7('0x4')),'defaultValue':_0x06e7('0x2')},'moduleSearch':{'type':Sequelize['ENUM'](_0x06e7('0x5'),_0x06e7('0x3'),_0x06e7('0x2')),'defaultValue':_0x06e7('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x93ad=['contact','nothing','contact_lead','STRING','sequelize','exports','ENUM','lead'];(function(_0x8abd64,_0x539570){var _0xd2511e=function(_0x9fef7d){while(--_0x9fef7d){_0x8abd64['push'](_0x8abd64['shift']());}};_0xd2511e(++_0x539570);}(_0x93ad,0x84));var _0xd93a=function(_0x4cad49,_0x5c3bb3){_0x4cad49=_0x4cad49-0x0;var _0x5e0a00=_0x93ad[_0x4cad49];return _0x5e0a00;};'use strict';var Sequelize=require(_0xd93a('0x0'));module[_0xd93a('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xd93a('0x2')](_0xd93a('0x3'),_0xd93a('0x4'),_0xd93a('0x5')),'defaultValue':_0xd93a('0x3')},'moduleSearch':{'type':Sequelize[_0xd93a('0x2')]('contact_lead',_0xd93a('0x4'),'lead'),'defaultValue':_0xd93a('0x6')},'description':{'type':Sequelize[_0xd93a('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 73fb613..604abd2 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 _0xbe60=['attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','merge','VIRTUAL','options','ZohoConfiguration','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','findOne','ZohoField','filter','getFields','getSubjects','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','info','request\x20sent','debug','stringify','error','code','message','ZohoConfiguration,\x20%s,\x20%s','sendStatus','status','limit','set','Content-Range','json','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','model','query','keys','filters','intersection'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe60,0x1dc));var _0x0be6=function(_0x3aa654,_0x3682a6){_0x3aa654=_0x3aa654-0x0;var _0x3ca4ae=_0xbe60[_0x3aa654];return _0x3ca4ae;};'use strict';var emlformat=require(_0x0be6('0x0'));var rimraf=require(_0x0be6('0x1'));var zipdir=require(_0x0be6('0x2'));var jsonpatch=require(_0x0be6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0be6('0x4'));var Mustache=require(_0x0be6('0x5'));var util=require(_0x0be6('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0be6('0x7'));var ejs=require(_0x0be6('0x8'));var fs=require('fs');var fs_extra=require(_0x0be6('0x9'));var _=require(_0x0be6('0xa'));var squel=require(_0x0be6('0xb'));var crypto=require(_0x0be6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0be6('0xd'));var toCsv=require(_0x0be6('0x7'));var querystring=require('querystring');var Papa=require(_0x0be6('0xe'));var Redis=require('ioredis');var authService=require(_0x0be6('0xf'));var qs=require(_0x0be6('0x10'));var as=require(_0x0be6('0x11'));var hardwareService=require(_0x0be6('0x12'));var logger=require(_0x0be6('0x13'))(_0x0be6('0x14'));var utils=require(_0x0be6('0x15'));var config=require(_0x0be6('0x16'));var licenseUtil=require(_0x0be6('0x17'));var db=require(_0x0be6('0x18'))['db'];var jayson=require(_0x0be6('0x19'));var client=jayson['client'][_0x0be6('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2317e3,_0x352140,_0x498c08,_0x5bc51d){return new BPromise(function(_0x433c15,_0x3fe9f3){var _0x3480c3=_0x5bc51d||client;return _0x3480c3['request'](_0x2317e3,_0x498c08)['then'](function(_0x1c5837){logger[_0x0be6('0x1b')]('ZohoConfiguration,\x20%s,\x20%s',_0x352140,_0x0be6('0x1c'));logger[_0x0be6('0x1d')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x352140,'request\x20sent',JSON[_0x0be6('0x1e')](_0x1c5837));if(_0x1c5837[_0x0be6('0x1f')]){if(_0x1c5837[_0x0be6('0x1f')][_0x0be6('0x20')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x352140,_0x1c5837[_0x0be6('0x1f')][_0x0be6('0x21')]);return _0x3fe9f3(_0x1c5837['error'][_0x0be6('0x21')]);}logger[_0x0be6('0x1f')]('ZohoConfiguration,\x20%s,\x20%s',_0x352140,_0x1c5837[_0x0be6('0x1f')][_0x0be6('0x21')]);return _0x433c15(_0x1c5837[_0x0be6('0x1f')][_0x0be6('0x21')]);}else{logger[_0x0be6('0x1b')](_0x0be6('0x22'),_0x352140,_0x0be6('0x1c'));_0x433c15(_0x1c5837['result'][_0x0be6('0x21')]);}})['catch'](function(_0x480c02){logger[_0x0be6('0x1f')]('ZohoConfiguration,\x20%s,\x20%s',_0x352140,_0x480c02);_0x3fe9f3(_0x480c02);});});}function respondWithStatusCode(_0x3df57e,_0x2572e8){_0x2572e8=_0x2572e8||0xcc;return function(_0x43461e){if(_0x43461e){return _0x3df57e[_0x0be6('0x23')](_0x2572e8);}return _0x3df57e[_0x0be6('0x24')](_0x2572e8)['end']();};}function respondWithResult(_0x5c439a,_0x1c5e6e){_0x1c5e6e=_0x1c5e6e||0xc8;return function(_0x3583e6){if(_0x3583e6){return _0x5c439a[_0x0be6('0x24')](_0x1c5e6e)['json'](_0x3583e6);}};}function respondWithFilteredResult(_0x494c12,_0x66db4){return function(_0x383bc7){if(_0x383bc7){var _0x2ef682=_0x383bc7['count'],_0x23a800=_0x66db4['offset'],_0x4347e8=_0x66db4['offset']+_0x66db4[_0x0be6('0x25')],_0x1f8544;if(_0x4347e8>=_0x2ef682){_0x4347e8=_0x2ef682;_0x1f8544=0xc8;}else{_0x1f8544=0xce;}_0x494c12[_0x0be6('0x24')](_0x1f8544);return _0x494c12[_0x0be6('0x26')](_0x0be6('0x27'),_0x23a800+'-'+_0x4347e8+'/'+_0x2ef682)[_0x0be6('0x28')](_0x383bc7);}return null;};}function patchUpdates(_0x1f3ab6){return function(_0x4e460a){try{jsonpatch['apply'](_0x4e460a,_0x1f3ab6,!![]);}catch(_0x3180ba){return BPromise[_0x0be6('0x29')](_0x3180ba);}return _0x4e460a[_0x0be6('0x2a')]();};}function saveUpdates(_0x32081c,_0x14d2ac){return function(_0x3ebd6d){if(_0x3ebd6d){return _0x3ebd6d[_0x0be6('0x2b')](_0x32081c)[_0x0be6('0x2c')](function(_0x1fb914){return _0x1fb914;});}return null;};}function removeEntity(_0x541b42,_0x419b7c){return function(_0x4acdb4){if(_0x4acdb4){return _0x4acdb4[_0x0be6('0x2d')]()[_0x0be6('0x2c')](function(){_0x541b42[_0x0be6('0x24')](0xcc)[_0x0be6('0x2e')]();});}};}function handleEntityNotFound(_0x41ee66,_0x332fd5){return function(_0x55f71b){if(!_0x55f71b){_0x41ee66['sendStatus'](0x194);}return _0x55f71b;};}function handleError(_0x317f55,_0x3104cf){_0x3104cf=_0x3104cf||0x1f4;return function(_0x502318){logger[_0x0be6('0x1f')](_0x502318[_0x0be6('0x2f')]);if(_0x502318[_0x0be6('0x30')]){delete _0x502318[_0x0be6('0x30')];}_0x317f55[_0x0be6('0x24')](_0x3104cf)[_0x0be6('0x31')](_0x502318);};}exports[_0x0be6('0x32')]=function(_0x5d74bc,_0x79b108){var _0x1da7fa={},_0x5b9bff={},_0x416e28={'count':0x0,'rows':[]};var _0x104cb0=_[_0x0be6('0x33')](db['ZohoConfiguration'][_0x0be6('0x34')],function(_0x40976d){return{'name':_0x40976d['fieldName'],'type':_0x40976d['type']['key']};});_0x5b9bff[_0x0be6('0x35')]=_[_0x0be6('0x33')](_0x104cb0,'name');_0x5b9bff[_0x0be6('0x36')]=_[_0x0be6('0x37')](_0x5d74bc[_0x0be6('0x36')]);_0x5b9bff[_0x0be6('0x38')]=_[_0x0be6('0x39')](_0x5b9bff[_0x0be6('0x35')],_0x5b9bff[_0x0be6('0x36')]);_0x1da7fa[_0x0be6('0x3a')]=_[_0x0be6('0x39')](_0x5b9bff[_0x0be6('0x35')],qs['fields'](_0x5d74bc[_0x0be6('0x36')][_0x0be6('0x3b')]));_0x1da7fa[_0x0be6('0x3a')]=_0x1da7fa[_0x0be6('0x3a')][_0x0be6('0x3c')]?_0x1da7fa[_0x0be6('0x3a')]:_0x5b9bff[_0x0be6('0x35')];if(!_0x5d74bc[_0x0be6('0x36')][_0x0be6('0x3d')](_0x0be6('0x3e'))){_0x1da7fa[_0x0be6('0x25')]=qs[_0x0be6('0x25')](_0x5d74bc['query'][_0x0be6('0x25')]);_0x1da7fa[_0x0be6('0x3f')]=qs[_0x0be6('0x3f')](_0x5d74bc['query'][_0x0be6('0x3f')]);}_0x1da7fa[_0x0be6('0x40')]=qs[_0x0be6('0x41')](_0x5d74bc[_0x0be6('0x36')][_0x0be6('0x41')]);_0x1da7fa['where']=qs[_0x0be6('0x38')](_['pick'](_0x5d74bc[_0x0be6('0x36')],_0x5b9bff[_0x0be6('0x38')]),_0x104cb0);if(_0x5d74bc['query']['filter']){_0x1da7fa[_0x0be6('0x42')]=_[_0x0be6('0x43')](_0x1da7fa[_0x0be6('0x42')],{'$or':_[_0x0be6('0x33')](_0x104cb0,function(_0x37ca6b){if(_0x37ca6b['type']!==_0x0be6('0x44')){var _0x23ded6={};_0x23ded6[_0x37ca6b[_0x0be6('0x30')]]={'$like':'%'+_0x5d74bc['query']['filter']+'%'};return _0x23ded6;}})});}_0x1da7fa=_['merge']({},_0x1da7fa,_0x5d74bc[_0x0be6('0x45')]);var _0x5f1b39={'where':_0x1da7fa[_0x0be6('0x42')]};return db[_0x0be6('0x46')][_0x0be6('0x47')](_0x5f1b39)[_0x0be6('0x2c')](function(_0x3c8523){_0x416e28[_0x0be6('0x47')]=_0x3c8523;if(_0x5d74bc[_0x0be6('0x36')][_0x0be6('0x48')]){_0x1da7fa[_0x0be6('0x49')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x0be6('0x4a')](_0x1da7fa);})[_0x0be6('0x2c')](function(_0x3dc284){_0x416e28[_0x0be6('0x4b')]=_0x3dc284;return _0x416e28;})[_0x0be6('0x2c')](respondWithFilteredResult(_0x79b108,_0x1da7fa))[_0x0be6('0x4c')](handleError(_0x79b108,null));};exports[_0x0be6('0x4d')]=function(_0x98ae91,_0x54d20a){var _0x19b230={'raw':![],'where':{'id':_0x98ae91[_0x0be6('0x4e')]['id']}},_0x4e5f03={};_0x4e5f03[_0x0be6('0x35')]=_[_0x0be6('0x37')](db[_0x0be6('0x46')][_0x0be6('0x34')]);_0x4e5f03['query']=_[_0x0be6('0x37')](_0x98ae91[_0x0be6('0x36')]);_0x4e5f03['filters']=_[_0x0be6('0x39')](_0x4e5f03[_0x0be6('0x35')],_0x4e5f03[_0x0be6('0x36')]);_0x19b230[_0x0be6('0x3a')]=_[_0x0be6('0x39')](_0x4e5f03[_0x0be6('0x35')],qs[_0x0be6('0x3b')](_0x98ae91[_0x0be6('0x36')][_0x0be6('0x3b')]));_0x19b230[_0x0be6('0x3a')]=_0x19b230['attributes'][_0x0be6('0x3c')]?_0x19b230[_0x0be6('0x3a')]:_0x4e5f03[_0x0be6('0x35')];if(_0x98ae91[_0x0be6('0x36')]['includeAll']){_0x19b230[_0x0be6('0x49')]=[{'all':!![]}];}_0x19b230=_[_0x0be6('0x43')]({},_0x19b230,_0x98ae91[_0x0be6('0x45')]);return db['ZohoConfiguration']['find'](_0x19b230)[_0x0be6('0x2c')](handleEntityNotFound(_0x54d20a,null))[_0x0be6('0x2c')](respondWithResult(_0x54d20a,null))[_0x0be6('0x4c')](handleError(_0x54d20a,null));};exports[_0x0be6('0x4f')]=function(_0x511988,_0x4aa760){return db[_0x0be6('0x46')][_0x0be6('0x4f')](_0x511988[_0x0be6('0x50')],{})[_0x0be6('0x2c')](respondWithResult(_0x4aa760,0xc9))[_0x0be6('0x4c')](handleError(_0x4aa760,null));};exports[_0x0be6('0x2b')]=function(_0x1b7b64,_0x4b1aeb){if(_0x1b7b64[_0x0be6('0x50')]['id']){delete _0x1b7b64['body']['id'];}return db[_0x0be6('0x46')][_0x0be6('0x51')]({'where':{'id':_0x1b7b64[_0x0be6('0x4e')]['id']}})[_0x0be6('0x2c')](handleEntityNotFound(_0x4b1aeb,null))[_0x0be6('0x2c')](saveUpdates(_0x1b7b64[_0x0be6('0x50')],null))[_0x0be6('0x2c')](respondWithResult(_0x4b1aeb,null))['catch'](handleError(_0x4b1aeb,null));};exports['destroy']=function(_0x56fd20,_0x31e1f1){return db[_0x0be6('0x46')][_0x0be6('0x51')]({'where':{'id':_0x56fd20[_0x0be6('0x4e')]['id']}})['then'](handleEntityNotFound(_0x31e1f1,null))[_0x0be6('0x2c')](removeEntity(_0x31e1f1,null))['catch'](handleError(_0x31e1f1,null));};exports['getFields']=function(_0x1747ec,_0xffef13,_0x2f73f0){var _0x437acc={};var _0x56ff0d={};var _0xcd4279;var _0x2def97;return db[_0x0be6('0x46')][_0x0be6('0x52')]({'where':{'id':_0x1747ec[_0x0be6('0x4e')]['id']}})['then'](handleEntityNotFound(_0xffef13,null))[_0x0be6('0x2c')](function(_0x5be00a){if(_0x5be00a){_0xcd4279=_0x5be00a;_0x56ff0d[_0x0be6('0x35')]=_[_0x0be6('0x37')](db[_0x0be6('0x53')]['rawAttributes']);_0x56ff0d['query']=_[_0x0be6('0x37')](_0x1747ec[_0x0be6('0x36')]);_0x56ff0d[_0x0be6('0x38')]=_[_0x0be6('0x39')](_0x56ff0d[_0x0be6('0x35')],_0x56ff0d[_0x0be6('0x36')]);_0x437acc[_0x0be6('0x3a')]=_[_0x0be6('0x39')](_0x56ff0d[_0x0be6('0x35')],qs[_0x0be6('0x3b')](_0x1747ec[_0x0be6('0x36')]['fields']));_0x437acc['attributes']=_0x437acc['attributes'][_0x0be6('0x3c')]?_0x437acc[_0x0be6('0x3a')]:_0x56ff0d['model'];_0x437acc[_0x0be6('0x40')]=qs['sort'](_0x1747ec[_0x0be6('0x36')][_0x0be6('0x41')]);_0x437acc[_0x0be6('0x42')]=qs[_0x0be6('0x38')](_['pick'](_0x1747ec[_0x0be6('0x36')],_0x56ff0d[_0x0be6('0x38')]));if(_0x1747ec[_0x0be6('0x36')][_0x0be6('0x54')]){_0x437acc[_0x0be6('0x42')]=_[_0x0be6('0x43')](_0x437acc[_0x0be6('0x42')],{'$or':_[_0x0be6('0x33')](_0x437acc[_0x0be6('0x3a')],function(_0x4640c7){var _0x173387={};_0x173387[_0x4640c7]={'$like':'%'+_0x1747ec['query'][_0x0be6('0x54')]+'%'};return _0x173387;})});}_0x437acc=_[_0x0be6('0x43')]({},_0x437acc,_0x1747ec['options']);return _0xcd4279[_0x0be6('0x55')](_0x437acc);}})[_0x0be6('0x2c')](function(_0x2b305e){if(_0x2b305e){_0x2def97=_0x2b305e[_0x0be6('0x3c')];if(!_0x1747ec[_0x0be6('0x36')][_0x0be6('0x3d')](_0x0be6('0x3e'))){_0x437acc[_0x0be6('0x25')]=qs['limit'](_0x1747ec[_0x0be6('0x36')]['limit']);_0x437acc[_0x0be6('0x3f')]=qs[_0x0be6('0x3f')](_0x1747ec[_0x0be6('0x36')][_0x0be6('0x3f')]);}return _0xcd4279['getFields'](_0x437acc);}})['then'](function(_0x45ef05){if(_0x45ef05){return _0x45ef05?{'count':_0x2def97,'rows':_0x45ef05}:null;}})[_0x0be6('0x2c')](respondWithResult(_0xffef13,null))['catch'](handleError(_0xffef13,null));};exports[_0x0be6('0x56')]=function(_0x4eb568,_0x3d0f91,_0x84a296){var _0x1ec8bd={};var _0xf573a6={};var _0x42b7ab;var _0x2a561c;return db['ZohoConfiguration'][_0x0be6('0x52')]({'where':{'id':_0x4eb568['params']['id']}})[_0x0be6('0x2c')](handleEntityNotFound(_0x3d0f91,null))['then'](function(_0x492e5e){if(_0x492e5e){_0x42b7ab=_0x492e5e;_0xf573a6[_0x0be6('0x35')]=_['keys'](db[_0x0be6('0x53')][_0x0be6('0x34')]);_0xf573a6['query']=_[_0x0be6('0x37')](_0x4eb568[_0x0be6('0x36')]);_0xf573a6[_0x0be6('0x38')]=_['intersection'](_0xf573a6['model'],_0xf573a6[_0x0be6('0x36')]);_0x1ec8bd[_0x0be6('0x3a')]=_['intersection'](_0xf573a6[_0x0be6('0x35')],qs[_0x0be6('0x3b')](_0x4eb568[_0x0be6('0x36')]['fields']));_0x1ec8bd[_0x0be6('0x3a')]=_0x1ec8bd[_0x0be6('0x3a')][_0x0be6('0x3c')]?_0x1ec8bd[_0x0be6('0x3a')]:_0xf573a6['model'];_0x1ec8bd[_0x0be6('0x40')]=qs[_0x0be6('0x41')](_0x4eb568[_0x0be6('0x36')]['sort']);_0x1ec8bd[_0x0be6('0x42')]=qs['filters'](_['pick'](_0x4eb568['query'],_0xf573a6['filters']));if(_0x4eb568[_0x0be6('0x36')]['filter']){_0x1ec8bd[_0x0be6('0x42')]=_[_0x0be6('0x43')](_0x1ec8bd[_0x0be6('0x42')],{'$or':_['map'](_0x1ec8bd['attributes'],function(_0x524860){var _0x409815={};_0x409815[_0x524860]={'$like':'%'+_0x4eb568['query'][_0x0be6('0x54')]+'%'};return _0x409815;})});}_0x1ec8bd=_[_0x0be6('0x43')]({},_0x1ec8bd,_0x4eb568[_0x0be6('0x45')]);return _0x42b7ab[_0x0be6('0x56')](_0x1ec8bd);}})[_0x0be6('0x2c')](function(_0x21a877){if(_0x21a877){_0x2a561c=_0x21a877[_0x0be6('0x3c')];if(!_0x4eb568[_0x0be6('0x36')]['hasOwnProperty'](_0x0be6('0x3e'))){_0x1ec8bd[_0x0be6('0x25')]=qs[_0x0be6('0x25')](_0x4eb568[_0x0be6('0x36')][_0x0be6('0x25')]);_0x1ec8bd[_0x0be6('0x3f')]=qs[_0x0be6('0x3f')](_0x4eb568[_0x0be6('0x36')][_0x0be6('0x3f')]);}return _0x42b7ab[_0x0be6('0x56')](_0x1ec8bd);}})[_0x0be6('0x2c')](function(_0x1f6177){if(_0x1f6177){return _0x1f6177?{'count':_0x2a561c,'rows':_0x1f6177}:null;}})[_0x0be6('0x2c')](respondWithResult(_0x3d0f91,null))[_0x0be6('0x4c')](handleError(_0x3d0f91,null));};exports['getDescriptions']=function(_0x3f15ce,_0x5b6686,_0x22acef){var _0x35eb50={};var _0x869aea={};var _0x31c2de;var _0x59531d;return db['ZohoConfiguration'][_0x0be6('0x52')]({'where':{'id':_0x3f15ce[_0x0be6('0x4e')]['id']}})[_0x0be6('0x2c')](handleEntityNotFound(_0x5b6686,null))['then'](function(_0x28ca5b){if(_0x28ca5b){_0x31c2de=_0x28ca5b;_0x869aea[_0x0be6('0x35')]=_[_0x0be6('0x37')](db[_0x0be6('0x53')][_0x0be6('0x34')]);_0x869aea['query']=_[_0x0be6('0x37')](_0x3f15ce[_0x0be6('0x36')]);_0x869aea[_0x0be6('0x38')]=_[_0x0be6('0x39')](_0x869aea[_0x0be6('0x35')],_0x869aea['query']);_0x35eb50[_0x0be6('0x3a')]=_[_0x0be6('0x39')](_0x869aea['model'],qs[_0x0be6('0x3b')](_0x3f15ce[_0x0be6('0x36')][_0x0be6('0x3b')]));_0x35eb50[_0x0be6('0x3a')]=_0x35eb50['attributes'][_0x0be6('0x3c')]?_0x35eb50['attributes']:_0x869aea[_0x0be6('0x35')];_0x35eb50['order']=qs['sort'](_0x3f15ce[_0x0be6('0x36')]['sort']);_0x35eb50['where']=qs[_0x0be6('0x38')](_[_0x0be6('0x57')](_0x3f15ce[_0x0be6('0x36')],_0x869aea['filters']));if(_0x3f15ce[_0x0be6('0x36')]['filter']){_0x35eb50[_0x0be6('0x42')]=_[_0x0be6('0x43')](_0x35eb50[_0x0be6('0x42')],{'$or':_[_0x0be6('0x33')](_0x35eb50[_0x0be6('0x3a')],function(_0x4bd92d){var _0xbcaf6e={};_0xbcaf6e[_0x4bd92d]={'$like':'%'+_0x3f15ce['query'][_0x0be6('0x54')]+'%'};return _0xbcaf6e;})});}_0x35eb50=_[_0x0be6('0x43')]({},_0x35eb50,_0x3f15ce['options']);return _0x31c2de['getDescriptions'](_0x35eb50);}})[_0x0be6('0x2c')](function(_0x5a35fd){if(_0x5a35fd){_0x59531d=_0x5a35fd[_0x0be6('0x3c')];if(!_0x3f15ce[_0x0be6('0x36')][_0x0be6('0x3d')](_0x0be6('0x3e'))){_0x35eb50[_0x0be6('0x25')]=qs[_0x0be6('0x25')](_0x3f15ce[_0x0be6('0x36')][_0x0be6('0x25')]);_0x35eb50[_0x0be6('0x3f')]=qs[_0x0be6('0x3f')](_0x3f15ce[_0x0be6('0x36')][_0x0be6('0x3f')]);}return _0x31c2de[_0x0be6('0x58')](_0x35eb50);}})[_0x0be6('0x2c')](function(_0x30e04a){if(_0x30e04a){return _0x30e04a?{'count':_0x59531d,'rows':_0x30e04a}:null;}})[_0x0be6('0x2c')](respondWithResult(_0x5b6686,null))[_0x0be6('0x4c')](handleError(_0x5b6686,null));}; \ No newline at end of file +var _0x964c=['to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','create','body','findOne','ZohoField','nolimit','limit','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','moment','util','sox'];(function(_0x1f6188,_0x46ad8d){var _0x40873c=function(_0x8dbb57){while(--_0x8dbb57){_0x1f6188['push'](_0x1f6188['shift']());}};_0x40873c(++_0x46ad8d);}(_0x964c,0x162));var _0xc964=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x964c[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xc964('0x0'));var rimraf=require(_0xc964('0x1'));var zipdir=require(_0xc964('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc964('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc964('0x4'));var path=require('path');var sox=require(_0xc964('0x5'));var csv=require(_0xc964('0x6'));var ejs=require(_0xc964('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc964('0x8'));var squel=require(_0xc964('0x9'));var crypto=require(_0xc964('0xa'));var jsforce=require(_0xc964('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc964('0x6'));var querystring=require(_0xc964('0xc'));var Papa=require(_0xc964('0xd'));var Redis=require(_0xc964('0xe'));var authService=require(_0xc964('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc964('0x10'));var hardwareService=require(_0xc964('0x11'));var logger=require('../../config/logger')(_0xc964('0x12'));var utils=require(_0xc964('0x13'));var config=require(_0xc964('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc964('0x15'))['db'];var jayson=require(_0xc964('0x16'));var client=jayson['client'][_0xc964('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x287bee,_0x489f6d,_0x11a2bb,_0x5eaa15){return new BPromise(function(_0x5eb82c,_0x5e5225){var _0x9bf030=_0x5eaa15||client;return _0x9bf030[_0xc964('0x18')](_0x287bee,_0x11a2bb)[_0xc964('0x19')](function(_0x4bdf88){logger[_0xc964('0x1a')](_0xc964('0x1b'),_0x489f6d,_0xc964('0x1c'));logger[_0xc964('0x1d')](_0xc964('0x1e'),_0x489f6d,_0xc964('0x1c'),JSON[_0xc964('0x1f')](_0x4bdf88));if(_0x4bdf88[_0xc964('0x20')]){if(_0x4bdf88['error']['code']===0x1f4){logger[_0xc964('0x20')](_0xc964('0x1b'),_0x489f6d,_0x4bdf88[_0xc964('0x20')][_0xc964('0x21')]);return _0x5e5225(_0x4bdf88[_0xc964('0x20')][_0xc964('0x21')]);}logger[_0xc964('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x489f6d,_0x4bdf88[_0xc964('0x20')]['message']);return _0x5eb82c(_0x4bdf88['error'][_0xc964('0x21')]);}else{logger[_0xc964('0x1a')](_0xc964('0x1b'),_0x489f6d,_0xc964('0x1c'));_0x5eb82c(_0x4bdf88[_0xc964('0x22')]['message']);}})[_0xc964('0x23')](function(_0x110318){logger[_0xc964('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x489f6d,_0x110318);_0x5e5225(_0x110318);});});}function respondWithStatusCode(_0x3ee81e,_0x2944ff){_0x2944ff=_0x2944ff||0xcc;return function(_0x5a85f7){if(_0x5a85f7){return _0x3ee81e['sendStatus'](_0x2944ff);}return _0x3ee81e[_0xc964('0x24')](_0x2944ff)[_0xc964('0x25')]();};}function respondWithResult(_0x36f1a2,_0x7d30cc){_0x7d30cc=_0x7d30cc||0xc8;return function(_0x585fb2){if(_0x585fb2){return _0x36f1a2[_0xc964('0x24')](_0x7d30cc)[_0xc964('0x26')](_0x585fb2);}};}function respondWithFilteredResult(_0x763e93,_0x5dee0e){return function(_0x47688e){if(_0x47688e){var _0x3090b9=_0x47688e[_0xc964('0x27')],_0x27d498=_0x5dee0e['offset'],_0x3effc1=_0x5dee0e[_0xc964('0x28')]+_0x5dee0e['limit'],_0xbd16e9;if(_0x3effc1>=_0x3090b9){_0x3effc1=_0x3090b9;_0xbd16e9=0xc8;}else{_0xbd16e9=0xce;}_0x763e93[_0xc964('0x24')](_0xbd16e9);return _0x763e93[_0xc964('0x29')](_0xc964('0x2a'),_0x27d498+'-'+_0x3effc1+'/'+_0x3090b9)['json'](_0x47688e);}return null;};}function patchUpdates(_0x233ca){return function(_0x2de305){try{jsonpatch['apply'](_0x2de305,_0x233ca,!![]);}catch(_0x2827e4){return BPromise[_0xc964('0x2b')](_0x2827e4);}return _0x2de305[_0xc964('0x2c')]();};}function saveUpdates(_0x1f1509,_0x5c511c){return function(_0x4cfb4e){if(_0x4cfb4e){return _0x4cfb4e[_0xc964('0x2d')](_0x1f1509)['then'](function(_0x253aee){return _0x253aee;});}return null;};}function removeEntity(_0x5622cb,_0x2b7b88){return function(_0x31634b){if(_0x31634b){return _0x31634b[_0xc964('0x2e')]()[_0xc964('0x19')](function(){_0x5622cb[_0xc964('0x24')](0xcc)[_0xc964('0x25')]();});}};}function handleEntityNotFound(_0x2406c8,_0x2a8c66){return function(_0x1b5ff9){if(!_0x1b5ff9){_0x2406c8['sendStatus'](0x194);}return _0x1b5ff9;};}function handleError(_0x28c001,_0x569e39){_0x569e39=_0x569e39||0x1f4;return function(_0x8a12e3){logger[_0xc964('0x20')](_0x8a12e3[_0xc964('0x2f')]);if(_0x8a12e3[_0xc964('0x30')]){delete _0x8a12e3[_0xc964('0x30')];}_0x28c001['status'](_0x569e39)[_0xc964('0x31')](_0x8a12e3);};}exports[_0xc964('0x32')]=function(_0x27d32d,_0x3541e5){var _0x58988e={},_0x875e64={},_0x501baf={'count':0x0,'rows':[]};var _0x431b95=_[_0xc964('0x33')](db[_0xc964('0x34')][_0xc964('0x35')],function(_0x3cfd0e){return{'name':_0x3cfd0e[_0xc964('0x36')],'type':_0x3cfd0e['type'][_0xc964('0x37')]};});_0x875e64[_0xc964('0x38')]=_['map'](_0x431b95,'name');_0x875e64[_0xc964('0x39')]=_[_0xc964('0x3a')](_0x27d32d[_0xc964('0x39')]);_0x875e64[_0xc964('0x3b')]=_['intersection'](_0x875e64[_0xc964('0x38')],_0x875e64[_0xc964('0x39')]);_0x58988e[_0xc964('0x3c')]=_[_0xc964('0x3d')](_0x875e64[_0xc964('0x38')],qs[_0xc964('0x3e')](_0x27d32d[_0xc964('0x39')][_0xc964('0x3e')]));_0x58988e[_0xc964('0x3c')]=_0x58988e['attributes'][_0xc964('0x3f')]?_0x58988e[_0xc964('0x3c')]:_0x875e64[_0xc964('0x38')];if(!_0x27d32d[_0xc964('0x39')][_0xc964('0x40')]('nolimit')){_0x58988e['limit']=qs['limit'](_0x27d32d[_0xc964('0x39')]['limit']);_0x58988e[_0xc964('0x28')]=qs['offset'](_0x27d32d[_0xc964('0x39')][_0xc964('0x28')]);}_0x58988e[_0xc964('0x41')]=qs['sort'](_0x27d32d[_0xc964('0x39')][_0xc964('0x42')]);_0x58988e['where']=qs['filters'](_[_0xc964('0x43')](_0x27d32d[_0xc964('0x39')],_0x875e64['filters']),_0x431b95);if(_0x27d32d['query'][_0xc964('0x44')]){_0x58988e[_0xc964('0x45')]=_[_0xc964('0x46')](_0x58988e[_0xc964('0x45')],{'$or':_[_0xc964('0x33')](_0x431b95,function(_0xee520a){if(_0xee520a[_0xc964('0x47')]!==_0xc964('0x48')){var _0x5c0924={};_0x5c0924[_0xee520a[_0xc964('0x30')]]={'$like':'%'+_0x27d32d[_0xc964('0x39')]['filter']+'%'};return _0x5c0924;}})});}_0x58988e=_[_0xc964('0x46')]({},_0x58988e,_0x27d32d[_0xc964('0x49')]);var _0x1e5615={'where':_0x58988e['where']};return db[_0xc964('0x34')][_0xc964('0x27')](_0x1e5615)[_0xc964('0x19')](function(_0x205f65){_0x501baf[_0xc964('0x27')]=_0x205f65;if(_0x27d32d[_0xc964('0x39')][_0xc964('0x4a')]){_0x58988e['include']=[{'all':!![]}];}return db[_0xc964('0x34')][_0xc964('0x4b')](_0x58988e);})['then'](function(_0x58ade9){_0x501baf[_0xc964('0x4c')]=_0x58ade9;return _0x501baf;})[_0xc964('0x19')](respondWithFilteredResult(_0x3541e5,_0x58988e))[_0xc964('0x23')](handleError(_0x3541e5,null));};exports[_0xc964('0x4d')]=function(_0x1e7e82,_0x58cffe){var _0x327fde={'raw':![],'where':{'id':_0x1e7e82[_0xc964('0x4e')]['id']}},_0x60a054={};_0x60a054[_0xc964('0x38')]=_[_0xc964('0x3a')](db[_0xc964('0x34')][_0xc964('0x35')]);_0x60a054[_0xc964('0x39')]=_[_0xc964('0x3a')](_0x1e7e82['query']);_0x60a054[_0xc964('0x3b')]=_[_0xc964('0x3d')](_0x60a054[_0xc964('0x38')],_0x60a054[_0xc964('0x39')]);_0x327fde[_0xc964('0x3c')]=_[_0xc964('0x3d')](_0x60a054[_0xc964('0x38')],qs[_0xc964('0x3e')](_0x1e7e82[_0xc964('0x39')][_0xc964('0x3e')]));_0x327fde[_0xc964('0x3c')]=_0x327fde[_0xc964('0x3c')][_0xc964('0x3f')]?_0x327fde['attributes']:_0x60a054[_0xc964('0x38')];if(_0x1e7e82['query'][_0xc964('0x4a')]){_0x327fde[_0xc964('0x4f')]=[{'all':!![]}];}_0x327fde=_[_0xc964('0x46')]({},_0x327fde,_0x1e7e82[_0xc964('0x49')]);return db['ZohoConfiguration'][_0xc964('0x50')](_0x327fde)['then'](handleEntityNotFound(_0x58cffe,null))['then'](respondWithResult(_0x58cffe,null))[_0xc964('0x23')](handleError(_0x58cffe,null));};exports[_0xc964('0x51')]=function(_0x17bb0d,_0x227e6b){return db[_0xc964('0x34')][_0xc964('0x51')](_0x17bb0d[_0xc964('0x52')],{})['then'](respondWithResult(_0x227e6b,0xc9))[_0xc964('0x23')](handleError(_0x227e6b,null));};exports['update']=function(_0x171dfa,_0x39526f){if(_0x171dfa[_0xc964('0x52')]['id']){delete _0x171dfa[_0xc964('0x52')]['id'];}return db[_0xc964('0x34')][_0xc964('0x50')]({'where':{'id':_0x171dfa[_0xc964('0x4e')]['id']}})[_0xc964('0x19')](handleEntityNotFound(_0x39526f,null))[_0xc964('0x19')](saveUpdates(_0x171dfa[_0xc964('0x52')],null))[_0xc964('0x19')](respondWithResult(_0x39526f,null))[_0xc964('0x23')](handleError(_0x39526f,null));};exports[_0xc964('0x2e')]=function(_0x2601ad,_0x5d27b0){return db[_0xc964('0x34')]['find']({'where':{'id':_0x2601ad[_0xc964('0x4e')]['id']}})[_0xc964('0x19')](handleEntityNotFound(_0x5d27b0,null))[_0xc964('0x19')](removeEntity(_0x5d27b0,null))[_0xc964('0x23')](handleError(_0x5d27b0,null));};exports['getFields']=function(_0x3acc9b,_0x1cafd8,_0x192e4e){var _0x300078={};var _0x269aef={};var _0x13f7d3;var _0x17b8a;return db[_0xc964('0x34')][_0xc964('0x53')]({'where':{'id':_0x3acc9b['params']['id']}})[_0xc964('0x19')](handleEntityNotFound(_0x1cafd8,null))[_0xc964('0x19')](function(_0x22d95b){if(_0x22d95b){_0x13f7d3=_0x22d95b;_0x269aef[_0xc964('0x38')]=_[_0xc964('0x3a')](db[_0xc964('0x54')][_0xc964('0x35')]);_0x269aef[_0xc964('0x39')]=_[_0xc964('0x3a')](_0x3acc9b[_0xc964('0x39')]);_0x269aef[_0xc964('0x3b')]=_['intersection'](_0x269aef[_0xc964('0x38')],_0x269aef['query']);_0x300078[_0xc964('0x3c')]=_[_0xc964('0x3d')](_0x269aef[_0xc964('0x38')],qs['fields'](_0x3acc9b[_0xc964('0x39')][_0xc964('0x3e')]));_0x300078[_0xc964('0x3c')]=_0x300078['attributes']['length']?_0x300078['attributes']:_0x269aef['model'];_0x300078[_0xc964('0x41')]=qs[_0xc964('0x42')](_0x3acc9b[_0xc964('0x39')][_0xc964('0x42')]);_0x300078[_0xc964('0x45')]=qs[_0xc964('0x3b')](_[_0xc964('0x43')](_0x3acc9b[_0xc964('0x39')],_0x269aef[_0xc964('0x3b')]));if(_0x3acc9b[_0xc964('0x39')][_0xc964('0x44')]){_0x300078['where']=_[_0xc964('0x46')](_0x300078[_0xc964('0x45')],{'$or':_['map'](_0x300078[_0xc964('0x3c')],function(_0x2957d3){var _0x5a8b95={};_0x5a8b95[_0x2957d3]={'$like':'%'+_0x3acc9b[_0xc964('0x39')][_0xc964('0x44')]+'%'};return _0x5a8b95;})});}_0x300078=_[_0xc964('0x46')]({},_0x300078,_0x3acc9b[_0xc964('0x49')]);return _0x13f7d3['getFields'](_0x300078);}})[_0xc964('0x19')](function(_0x4002c2){if(_0x4002c2){_0x17b8a=_0x4002c2['length'];if(!_0x3acc9b[_0xc964('0x39')][_0xc964('0x40')](_0xc964('0x55'))){_0x300078[_0xc964('0x56')]=qs[_0xc964('0x56')](_0x3acc9b[_0xc964('0x39')][_0xc964('0x56')]);_0x300078['offset']=qs[_0xc964('0x28')](_0x3acc9b[_0xc964('0x39')][_0xc964('0x28')]);}return _0x13f7d3[_0xc964('0x57')](_0x300078);}})[_0xc964('0x19')](function(_0x20593d){if(_0x20593d){return _0x20593d?{'count':_0x17b8a,'rows':_0x20593d}:null;}})[_0xc964('0x19')](respondWithResult(_0x1cafd8,null))[_0xc964('0x23')](handleError(_0x1cafd8,null));};exports[_0xc964('0x58')]=function(_0x43b79a,_0x17b194,_0x45e7d4){var _0x1e89b5={};var _0x1419d9={};var _0x5f49ab;var _0x4e94cb;return db[_0xc964('0x34')][_0xc964('0x53')]({'where':{'id':_0x43b79a[_0xc964('0x4e')]['id']}})['then'](handleEntityNotFound(_0x17b194,null))[_0xc964('0x19')](function(_0x4623f5){if(_0x4623f5){_0x5f49ab=_0x4623f5;_0x1419d9[_0xc964('0x38')]=_[_0xc964('0x3a')](db[_0xc964('0x54')][_0xc964('0x35')]);_0x1419d9['query']=_[_0xc964('0x3a')](_0x43b79a[_0xc964('0x39')]);_0x1419d9['filters']=_['intersection'](_0x1419d9[_0xc964('0x38')],_0x1419d9[_0xc964('0x39')]);_0x1e89b5[_0xc964('0x3c')]=_[_0xc964('0x3d')](_0x1419d9[_0xc964('0x38')],qs[_0xc964('0x3e')](_0x43b79a[_0xc964('0x39')][_0xc964('0x3e')]));_0x1e89b5[_0xc964('0x3c')]=_0x1e89b5[_0xc964('0x3c')][_0xc964('0x3f')]?_0x1e89b5[_0xc964('0x3c')]:_0x1419d9[_0xc964('0x38')];_0x1e89b5[_0xc964('0x41')]=qs[_0xc964('0x42')](_0x43b79a[_0xc964('0x39')][_0xc964('0x42')]);_0x1e89b5[_0xc964('0x45')]=qs[_0xc964('0x3b')](_[_0xc964('0x43')](_0x43b79a[_0xc964('0x39')],_0x1419d9['filters']));if(_0x43b79a['query']['filter']){_0x1e89b5['where']=_['merge'](_0x1e89b5[_0xc964('0x45')],{'$or':_[_0xc964('0x33')](_0x1e89b5[_0xc964('0x3c')],function(_0x54ebaa){var _0x104e8b={};_0x104e8b[_0x54ebaa]={'$like':'%'+_0x43b79a['query'][_0xc964('0x44')]+'%'};return _0x104e8b;})});}_0x1e89b5=_['merge']({},_0x1e89b5,_0x43b79a[_0xc964('0x49')]);return _0x5f49ab['getSubjects'](_0x1e89b5);}})[_0xc964('0x19')](function(_0x2840c6){if(_0x2840c6){_0x4e94cb=_0x2840c6[_0xc964('0x3f')];if(!_0x43b79a['query'][_0xc964('0x40')](_0xc964('0x55'))){_0x1e89b5[_0xc964('0x56')]=qs['limit'](_0x43b79a[_0xc964('0x39')][_0xc964('0x56')]);_0x1e89b5[_0xc964('0x28')]=qs[_0xc964('0x28')](_0x43b79a[_0xc964('0x39')][_0xc964('0x28')]);}return _0x5f49ab[_0xc964('0x58')](_0x1e89b5);}})[_0xc964('0x19')](function(_0x555126){if(_0x555126){return _0x555126?{'count':_0x4e94cb,'rows':_0x555126}:null;}})['then'](respondWithResult(_0x17b194,null))[_0xc964('0x23')](handleError(_0x17b194,null));};exports[_0xc964('0x59')]=function(_0x569c23,_0xdfacf9,_0x4dc57f){var _0xf98f1a={};var _0x1b234f={};var _0x5064e0;var _0x3de8e9;return db[_0xc964('0x34')][_0xc964('0x53')]({'where':{'id':_0x569c23[_0xc964('0x4e')]['id']}})[_0xc964('0x19')](handleEntityNotFound(_0xdfacf9,null))[_0xc964('0x19')](function(_0x40d725){if(_0x40d725){_0x5064e0=_0x40d725;_0x1b234f['model']=_[_0xc964('0x3a')](db[_0xc964('0x54')]['rawAttributes']);_0x1b234f[_0xc964('0x39')]=_[_0xc964('0x3a')](_0x569c23['query']);_0x1b234f[_0xc964('0x3b')]=_[_0xc964('0x3d')](_0x1b234f[_0xc964('0x38')],_0x1b234f['query']);_0xf98f1a[_0xc964('0x3c')]=_[_0xc964('0x3d')](_0x1b234f[_0xc964('0x38')],qs[_0xc964('0x3e')](_0x569c23[_0xc964('0x39')][_0xc964('0x3e')]));_0xf98f1a[_0xc964('0x3c')]=_0xf98f1a['attributes'][_0xc964('0x3f')]?_0xf98f1a[_0xc964('0x3c')]:_0x1b234f[_0xc964('0x38')];_0xf98f1a[_0xc964('0x41')]=qs[_0xc964('0x42')](_0x569c23['query'][_0xc964('0x42')]);_0xf98f1a[_0xc964('0x45')]=qs[_0xc964('0x3b')](_[_0xc964('0x43')](_0x569c23['query'],_0x1b234f[_0xc964('0x3b')]));if(_0x569c23[_0xc964('0x39')][_0xc964('0x44')]){_0xf98f1a[_0xc964('0x45')]=_[_0xc964('0x46')](_0xf98f1a['where'],{'$or':_['map'](_0xf98f1a[_0xc964('0x3c')],function(_0x39aa28){var _0x29bd3e={};_0x29bd3e[_0x39aa28]={'$like':'%'+_0x569c23['query'][_0xc964('0x44')]+'%'};return _0x29bd3e;})});}_0xf98f1a=_[_0xc964('0x46')]({},_0xf98f1a,_0x569c23['options']);return _0x5064e0[_0xc964('0x59')](_0xf98f1a);}})['then'](function(_0x5eb49e){if(_0x5eb49e){_0x3de8e9=_0x5eb49e['length'];if(!_0x569c23[_0xc964('0x39')][_0xc964('0x40')](_0xc964('0x55'))){_0xf98f1a[_0xc964('0x56')]=qs[_0xc964('0x56')](_0x569c23[_0xc964('0x39')][_0xc964('0x56')]);_0xf98f1a[_0xc964('0x28')]=qs['offset'](_0x569c23['query']['offset']);}return _0x5064e0[_0xc964('0x59')](_0xf98f1a);}})[_0xc964('0x19')](function(_0x211ff4){if(_0x211ff4){return _0x211ff4?{'count':_0x3de8e9,'rows':_0x211ff4}:null;}})[_0xc964('0x19')](respondWithResult(_0xdfacf9,null))[_0xc964('0x23')](handleError(_0xdfacf9,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index b30e26b..89b4f9f 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 _0x9a8d=['bluebird','request-promise','path','rimraf','./intZohoConfiguration.attributes','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment'];(function(_0xe09760,_0x40c433){var _0x3e44f7=function(_0x26557a){while(--_0x26557a){_0xe09760['push'](_0xe09760['shift']());}};_0x3e44f7(++_0x40c433);}(_0x9a8d,0x73));var _0xd9a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a8d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd9a8('0x0'));var util=require(_0xd9a8('0x1'));var logger=require(_0xd9a8('0x2'))(_0xd9a8('0x3'));var moment=require(_0xd9a8('0x4'));var BPromise=require(_0xd9a8('0x5'));var rp=require(_0xd9a8('0x6'));var fs=require('fs');var path=require(_0xd9a8('0x7'));var rimraf=require(_0xd9a8('0x8'));var config=require('../../config/environment');var attributes=require(_0xd9a8('0x9'));module['exports']=function(_0x38242d,_0x1017ed){return _0x38242d['define'](_0xd9a8('0xa'),attributes,{'tableName':_0xd9a8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b3e=['moment','path','./intZohoConfiguration.attributes','ZohoConfiguration','int_zoho_configurations','util','api'];(function(_0x1eb9a7,_0x242459){var _0x107982=function(_0x19dfc8){while(--_0x19dfc8){_0x1eb9a7['push'](_0x1eb9a7['shift']());}};_0x107982(++_0x242459);}(_0x2b3e,0x17f));var _0xe2b3=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x2b3e[_0x5447fd];return _0x15b28a;};'use strict';var _=require('lodash');var util=require(_0xe2b3('0x0'));var logger=require('../../config/logger')(_0xe2b3('0x1'));var moment=require(_0xe2b3('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe2b3('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe2b3('0x4'));module['exports']=function(_0x110817,_0x32bea0){return _0x110817['define'](_0xe2b3('0x5'),attributes,{'tableName':_0xe2b3('0x6'),'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 610f272..03b635e 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 _0xbfb9=['ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info'];(function(_0x16e02d,_0x234448){var _0x1be6e7=function(_0x5b6c4b){while(--_0x5b6c4b){_0x16e02d['push'](_0x16e02d['shift']());}};_0x1be6e7(++_0x234448);}(_0xbfb9,0x95));var _0x9bfb=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbfb9[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x9bfb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9bfb('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bfb('0x2'))['db'];var utils=require(_0x9bfb('0x3'));var logger=require(_0x9bfb('0x4'))(_0x9bfb('0x5'));var config=require('../../config/environment');var jayson=require(_0x9bfb('0x6'));var client=jayson['client'][_0x9bfb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x8632b4,_0x34cb60,_0x56e92c){return new BPromise(function(_0x2ee18b,_0xabfed2){return client[_0x9bfb('0x8')](_0x8632b4,_0x56e92c)[_0x9bfb('0x9')](function(_0x45a1f7){logger[_0x9bfb('0xa')](_0x9bfb('0xb'),_0x34cb60,'request\x20sent');logger[_0x9bfb('0xc')](_0x9bfb('0xd'),_0x34cb60,_0x9bfb('0xe'),JSON[_0x9bfb('0xf')](_0x45a1f7));if(_0x45a1f7[_0x9bfb('0x10')]){if(_0x45a1f7[_0x9bfb('0x10')][_0x9bfb('0x11')]===0x1f4){logger[_0x9bfb('0x10')](_0x9bfb('0xb'),_0x34cb60,_0x45a1f7[_0x9bfb('0x10')][_0x9bfb('0x12')]);return _0xabfed2(_0x45a1f7[_0x9bfb('0x10')][_0x9bfb('0x12')]);}logger[_0x9bfb('0x10')](_0x9bfb('0xb'),_0x34cb60,_0x45a1f7[_0x9bfb('0x10')]['message']);return _0x2ee18b(_0x45a1f7['error'][_0x9bfb('0x12')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x34cb60,_0x9bfb('0xe'));_0x2ee18b(_0x45a1f7[_0x9bfb('0x13')][_0x9bfb('0x12')]);}})['catch'](function(_0x4857d){logger['error'](_0x9bfb('0xb'),_0x34cb60,_0x4857d);_0xabfed2(_0x4857d);});});} \ No newline at end of file +var _0xac56=['request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','ZohoConfiguration,\x20%s,\x20%s'];(function(_0x451bb6,_0x3d87a9){var _0x9bce0e=function(_0x4378dd){while(--_0x4378dd){_0x451bb6['push'](_0x451bb6['shift']());}};_0x9bce0e(++_0x3d87a9);}(_0xac56,0x7f));var _0x6ac5=function(_0x267cec,_0x608100){_0x267cec=_0x267cec-0x0;var _0x252df3=_0xac56[_0x267cec];return _0x252df3;};'use strict';var _=require(_0x6ac5('0x0'));var util=require(_0x6ac5('0x1'));var moment=require(_0x6ac5('0x2'));var BPromise=require(_0x6ac5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ac5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ac5('0x5'));var logger=require(_0x6ac5('0x6'))('rpc');var config=require(_0x6ac5('0x7'));var jayson=require(_0x6ac5('0x8'));var client=jayson['client'][_0x6ac5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c579e,_0x2d29cc,_0x5278e7){return new BPromise(function(_0x10d560,_0x1ebee0){return client['request'](_0x5c579e,_0x5278e7)[_0x6ac5('0xa')](function(_0x56705f){logger[_0x6ac5('0xb')](_0x6ac5('0xc'),_0x2d29cc,_0x6ac5('0xd'));logger[_0x6ac5('0xe')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x2d29cc,'request\x20sent',JSON[_0x6ac5('0xf')](_0x56705f));if(_0x56705f[_0x6ac5('0x10')]){if(_0x56705f[_0x6ac5('0x10')][_0x6ac5('0x11')]===0x1f4){logger[_0x6ac5('0x10')](_0x6ac5('0xc'),_0x2d29cc,_0x56705f[_0x6ac5('0x10')][_0x6ac5('0x12')]);return _0x1ebee0(_0x56705f['error'][_0x6ac5('0x12')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x2d29cc,_0x56705f['error'][_0x6ac5('0x12')]);return _0x10d560(_0x56705f[_0x6ac5('0x10')][_0x6ac5('0x12')]);}else{logger['info'](_0x6ac5('0xc'),_0x2d29cc,_0x6ac5('0xd'));_0x10d560(_0x56705f[_0x6ac5('0x13')][_0x6ac5('0x12')]);}})['catch'](function(_0x161da1){logger[_0x6ac5('0x10')](_0x6ac5('0xc'),_0x2d29cc,_0x161da1);_0x1ebee0(_0x161da1);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 68aa9ad..29fddf5 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 _0x13cc=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','get','/:id','show','post','create','update','delete','destroy','path','connect-timeout','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x13cc,0x161));var _0xc13c=function(_0x555890,_0xd516c8){_0x555890=_0x555890-0x0;var _0x3e574b=_0x13cc[_0x555890];return _0x3e574b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc13c('0x0'));var timeout=require(_0xc13c('0x1'));var express=require('express');var router=express[_0xc13c('0x2')]();var fs_extra=require(_0xc13c('0x3'));var auth=require(_0xc13c('0x4'));var interaction=require(_0xc13c('0x5'));var config=require(_0xc13c('0x6'));var controller=require(_0xc13c('0x7'));router['get']('/',auth[_0xc13c('0x8')](),controller['index']);router[_0xc13c('0x9')](_0xc13c('0xa'),auth[_0xc13c('0x8')](),controller[_0xc13c('0xb')]);router[_0xc13c('0xc')]('/',auth[_0xc13c('0x8')](),controller[_0xc13c('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc13c('0xe')]);router[_0xc13c('0xf')](_0xc13c('0xa'),auth[_0xc13c('0x8')](),controller[_0xc13c('0x10')]);module['exports']=router; \ No newline at end of file +var _0x81cb=['isAuthenticated','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id'];(function(_0x1ebd2d,_0x407697){var _0x4a5a0c=function(_0x1c6a00){while(--_0x1c6a00){_0x1ebd2d['push'](_0x1ebd2d['shift']());}};_0x4a5a0c(++_0x407697);}(_0x81cb,0xaa));var _0xb81c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81cb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb81c('0x0'));var util=require(_0xb81c('0x1'));var path=require('path');var timeout=require(_0xb81c('0x2'));var express=require(_0xb81c('0x3'));var router=express['Router']();var fs_extra=require(_0xb81c('0x4'));var auth=require(_0xb81c('0x5'));var interaction=require(_0xb81c('0x6'));var config=require(_0xb81c('0x7'));var controller=require('./intZohoField.controller');router[_0xb81c('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb81c('0x8')](_0xb81c('0x9'),auth[_0xb81c('0xa')](),controller[_0xb81c('0xb')]);router[_0xb81c('0xc')]('/',auth[_0xb81c('0xa')](),controller[_0xb81c('0xd')]);router[_0xb81c('0xe')](_0xb81c('0x9'),auth[_0xb81c('0xa')](),controller[_0xb81c('0xf')]);router[_0xb81c('0x10')](_0xb81c('0x9'),auth[_0xb81c('0xa')](),controller['destroy']);module[_0xb81c('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 b7badff..7c78693 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 _0x1af3=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x395d6d,_0xece4d6){var _0x13a442=function(_0x6fc13a){while(--_0x6fc13a){_0x395d6d['push'](_0x395d6d['shift']());}};_0x13a442(++_0xece4d6);}(_0x1af3,0x1ca));var _0x31af=function(_0x15e6fe,_0x1a5c39){_0x15e6fe=_0x15e6fe-0x0;var _0x34894d=_0x1af3[_0x15e6fe];return _0x34894d;};'use strict';var Sequelize=require(_0x31af('0x0'));module[_0x31af('0x1')]={'type':{'type':Sequelize[_0x31af('0x2')](_0x31af('0x3'),_0x31af('0x4'),_0x31af('0x5'),_0x31af('0x6'),_0x31af('0x7')),'defaultValue':_0x31af('0x3')},'content':{'type':Sequelize[_0x31af('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x31af('0x2')](_0x31af('0x3'),_0x31af('0x4'),_0x31af('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x31af('0x8')]},'nameField':{'type':Sequelize[_0x31af('0x8')]},'customField':{'type':Sequelize[_0x31af('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x032e=['STRING','variable','customVariable','BOOLEAN','sequelize','ENUM','string','keyValue','picklist'];(function(_0x2ddea7,_0x3e49a8){var _0x423d41=function(_0x33b6c5){while(--_0x33b6c5){_0x2ddea7['push'](_0x2ddea7['shift']());}};_0x423d41(++_0x3e49a8);}(_0x032e,0x124));var _0xe032=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x032e[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0xe032('0x0'));module['exports']={'type':{'type':Sequelize[_0xe032('0x1')](_0xe032('0x2'),'variable','customVariable',_0xe032('0x3'),_0xe032('0x4')),'defaultValue':_0xe032('0x2')},'content':{'type':Sequelize[_0xe032('0x5')]},'key':{'type':Sequelize[_0xe032('0x5')]},'keyType':{'type':Sequelize[_0xe032('0x1')](_0xe032('0x2'),_0xe032('0x6'),_0xe032('0x7'))},'keyContent':{'type':Sequelize[_0xe032('0x5')]},'idField':{'type':Sequelize[_0xe032('0x5')]},'nameField':{'type':Sequelize[_0xe032('0x5')]},'customField':{'type':Sequelize[_0xe032('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe032('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 9b03a51..12ab674 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 _0xd69f=['ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','index','map','rawAttributes','type','model','keys','filters','intersection','query','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ZohoField','includeAll','include','findAll','rows','catch','params','length','create','body','find','eml-format','rimraf','request-promise','moment','mustache','path','sox'];(function(_0x71e875,_0x135f75){var _0x50ad00=function(_0x33a317){while(--_0x33a317){_0x71e875['push'](_0x71e875['shift']());}};_0x50ad00(++_0x135f75);}(_0xd69f,0x1d5));var _0xfd69=function(_0x591638,_0x406511){_0x591638=_0x591638-0x0;var _0x8d7bf9=_0xd69f[_0x591638];return _0x8d7bf9;};'use strict';var emlformat=require(_0xfd69('0x0'));var rimraf=require(_0xfd69('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfd69('0x2'));var moment=require(_0xfd69('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfd69('0x4'));var util=require('util');var path=require(_0xfd69('0x5'));var sox=require(_0xfd69('0x6'));var csv=require('to-csv');var ejs=require(_0xfd69('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd69('0x8'));var squel=require('squel');var crypto=require(_0xfd69('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xfd69('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfd69('0xb'));var Redis=require(_0xfd69('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xfd69('0xd'));var as=require(_0xfd69('0xe'));var hardwareService=require(_0xfd69('0xf'));var logger=require('../../config/logger')(_0xfd69('0x10'));var utils=require(_0xfd69('0x11'));var config=require(_0xfd69('0x12'));var licenseUtil=require(_0xfd69('0x13'));var db=require(_0xfd69('0x14'))['db'];function respondWithStatusCode(_0x365a69,_0x104835){_0x104835=_0x104835||0xcc;return function(_0x33c0cb){if(_0x33c0cb){return _0x365a69['sendStatus'](_0x104835);}return _0x365a69[_0xfd69('0x15')](_0x104835)[_0xfd69('0x16')]();};}function respondWithResult(_0x1d478c,_0xab7145){_0xab7145=_0xab7145||0xc8;return function(_0x51029a){if(_0x51029a){return _0x1d478c['status'](_0xab7145)[_0xfd69('0x17')](_0x51029a);}};}function respondWithFilteredResult(_0x2cfafa,_0x431363){return function(_0x488ca3){if(_0x488ca3){var _0x3c65be=_0x488ca3[_0xfd69('0x18')],_0x2c4254=_0x431363['offset'],_0x1e4929=_0x431363[_0xfd69('0x19')]+_0x431363[_0xfd69('0x1a')],_0xa90b07;if(_0x1e4929>=_0x3c65be){_0x1e4929=_0x3c65be;_0xa90b07=0xc8;}else{_0xa90b07=0xce;}_0x2cfafa[_0xfd69('0x15')](_0xa90b07);return _0x2cfafa[_0xfd69('0x1b')](_0xfd69('0x1c'),_0x2c4254+'-'+_0x1e4929+'/'+_0x3c65be)[_0xfd69('0x17')](_0x488ca3);}return null;};}function patchUpdates(_0x1ee6bd){return function(_0x4aaa31){try{jsonpatch[_0xfd69('0x1d')](_0x4aaa31,_0x1ee6bd,!![]);}catch(_0xe320d7){return BPromise[_0xfd69('0x1e')](_0xe320d7);}return _0x4aaa31['save']();};}function saveUpdates(_0xb3189,_0xa8edd0){return function(_0x1fc9ca){if(_0x1fc9ca){return _0x1fc9ca[_0xfd69('0x1f')](_0xb3189)['then'](function(_0x13f9e3){return _0x13f9e3;});}return null;};}function removeEntity(_0x1256fc,_0x2f24b6){return function(_0x2d4665){if(_0x2d4665){return _0x2d4665[_0xfd69('0x20')]()[_0xfd69('0x21')](function(){_0x1256fc[_0xfd69('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26b569,_0x2d2adb){return function(_0x494227){if(!_0x494227){_0x26b569[_0xfd69('0x22')](0x194);}return _0x494227;};}function handleError(_0x18c9f4,_0x4fbf32){_0x4fbf32=_0x4fbf32||0x1f4;return function(_0x53ecec){logger[_0xfd69('0x23')](_0x53ecec[_0xfd69('0x24')]);if(_0x53ecec[_0xfd69('0x25')]){delete _0x53ecec[_0xfd69('0x25')];}_0x18c9f4[_0xfd69('0x15')](_0x4fbf32)['send'](_0x53ecec);};}exports[_0xfd69('0x26')]=function(_0x3a0f86,_0x519c36){var _0x22d266={},_0x457293={},_0x57a5b3={'count':0x0,'rows':[]};var _0x1da8d8=_[_0xfd69('0x27')](db['ZohoField'][_0xfd69('0x28')],function(_0x55c536){return{'name':_0x55c536['fieldName'],'type':_0x55c536[_0xfd69('0x29')]['key']};});_0x457293[_0xfd69('0x2a')]=_[_0xfd69('0x27')](_0x1da8d8,_0xfd69('0x25'));_0x457293['query']=_[_0xfd69('0x2b')](_0x3a0f86['query']);_0x457293[_0xfd69('0x2c')]=_[_0xfd69('0x2d')](_0x457293[_0xfd69('0x2a')],_0x457293[_0xfd69('0x2e')]);_0x22d266[_0xfd69('0x2f')]=_[_0xfd69('0x2d')](_0x457293[_0xfd69('0x2a')],qs[_0xfd69('0x30')](_0x3a0f86[_0xfd69('0x2e')][_0xfd69('0x30')]));_0x22d266[_0xfd69('0x2f')]=_0x22d266['attributes']['length']?_0x22d266[_0xfd69('0x2f')]:_0x457293[_0xfd69('0x2a')];if(!_0x3a0f86['query']['hasOwnProperty'](_0xfd69('0x31'))){_0x22d266['limit']=qs[_0xfd69('0x1a')](_0x3a0f86[_0xfd69('0x2e')][_0xfd69('0x1a')]);_0x22d266[_0xfd69('0x19')]=qs['offset'](_0x3a0f86[_0xfd69('0x2e')][_0xfd69('0x19')]);}_0x22d266[_0xfd69('0x32')]=qs[_0xfd69('0x33')](_0x3a0f86[_0xfd69('0x2e')]['sort']);_0x22d266[_0xfd69('0x34')]=qs[_0xfd69('0x2c')](_[_0xfd69('0x35')](_0x3a0f86[_0xfd69('0x2e')],_0x457293[_0xfd69('0x2c')]),_0x1da8d8);if(_0x3a0f86[_0xfd69('0x2e')][_0xfd69('0x36')]){_0x22d266[_0xfd69('0x34')]=_[_0xfd69('0x37')](_0x22d266['where'],{'$or':_['map'](_0x1da8d8,function(_0x316649){if(_0x316649['type']!==_0xfd69('0x38')){var _0x1a6c66={};_0x1a6c66[_0x316649[_0xfd69('0x25')]]={'$like':'%'+_0x3a0f86[_0xfd69('0x2e')][_0xfd69('0x36')]+'%'};return _0x1a6c66;}})});}_0x22d266=_[_0xfd69('0x37')]({},_0x22d266,_0x3a0f86['options']);var _0x5c9fa2={'where':_0x22d266['where']};return db[_0xfd69('0x39')]['count'](_0x5c9fa2)[_0xfd69('0x21')](function(_0x2942bf){_0x57a5b3[_0xfd69('0x18')]=_0x2942bf;if(_0x3a0f86[_0xfd69('0x2e')][_0xfd69('0x3a')]){_0x22d266[_0xfd69('0x3b')]=[{'all':!![]}];}return db[_0xfd69('0x39')][_0xfd69('0x3c')](_0x22d266);})['then'](function(_0xf0e85d){_0x57a5b3[_0xfd69('0x3d')]=_0xf0e85d;return _0x57a5b3;})[_0xfd69('0x21')](respondWithFilteredResult(_0x519c36,_0x22d266))[_0xfd69('0x3e')](handleError(_0x519c36,null));};exports['show']=function(_0x1f764b,_0x4e28a4){var _0x5e184a={'raw':!![],'where':{'id':_0x1f764b[_0xfd69('0x3f')]['id']}},_0x4dc850={};_0x4dc850[_0xfd69('0x2a')]=_[_0xfd69('0x2b')](db[_0xfd69('0x39')][_0xfd69('0x28')]);_0x4dc850['query']=_[_0xfd69('0x2b')](_0x1f764b['query']);_0x4dc850[_0xfd69('0x2c')]=_[_0xfd69('0x2d')](_0x4dc850[_0xfd69('0x2a')],_0x4dc850['query']);_0x5e184a['attributes']=_['intersection'](_0x4dc850[_0xfd69('0x2a')],qs[_0xfd69('0x30')](_0x1f764b[_0xfd69('0x2e')][_0xfd69('0x30')]));_0x5e184a['attributes']=_0x5e184a[_0xfd69('0x2f')][_0xfd69('0x40')]?_0x5e184a[_0xfd69('0x2f')]:_0x4dc850[_0xfd69('0x2a')];if(_0x1f764b[_0xfd69('0x2e')][_0xfd69('0x3a')]){_0x5e184a['include']=[{'all':!![]}];}_0x5e184a=_[_0xfd69('0x37')]({},_0x5e184a,_0x1f764b['options']);return db[_0xfd69('0x39')]['find'](_0x5e184a)[_0xfd69('0x21')](handleEntityNotFound(_0x4e28a4,null))[_0xfd69('0x21')](respondWithResult(_0x4e28a4,null))['catch'](handleError(_0x4e28a4,null));};exports[_0xfd69('0x41')]=function(_0x500d76,_0x28587c){return db[_0xfd69('0x39')][_0xfd69('0x41')](_0x500d76[_0xfd69('0x42')],{})[_0xfd69('0x21')](respondWithResult(_0x28587c,0xc9))[_0xfd69('0x3e')](handleError(_0x28587c,null));};exports[_0xfd69('0x1f')]=function(_0x53e502,_0xbc76db){if(_0x53e502[_0xfd69('0x42')]['id']){delete _0x53e502['body']['id'];}return db['ZohoField']['find']({'where':{'id':_0x53e502[_0xfd69('0x3f')]['id']}})[_0xfd69('0x21')](handleEntityNotFound(_0xbc76db,null))[_0xfd69('0x21')](saveUpdates(_0x53e502[_0xfd69('0x42')],null))['then'](respondWithResult(_0xbc76db,null))[_0xfd69('0x3e')](handleError(_0xbc76db,null));};exports['destroy']=function(_0x5d8730,_0x24e8b7){return db[_0xfd69('0x39')][_0xfd69('0x43')]({'where':{'id':_0x5d8730[_0xfd69('0x3f')]['id']}})['then'](handleEntityNotFound(_0x24e8b7,null))['then'](removeEntity(_0x24e8b7,null))['catch'](handleError(_0x24e8b7,null));}; \ No newline at end of file +var _0x7bba=['set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filter','merge','options','includeAll','include','rows','show','params','find','catch','create','body','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit'];(function(_0x513697,_0x2c7700){var _0x264e61=function(_0x22e0f7){while(--_0x22e0f7){_0x513697['push'](_0x513697['shift']());}};_0x264e61(++_0x2c7700);}(_0x7bba,0x181));var _0xa7bb=function(_0x65c0bb,_0x82e7b8){_0x65c0bb=_0x65c0bb-0x0;var _0x320bd5=_0x7bba[_0x65c0bb];return _0x320bd5;};'use strict';var emlformat=require(_0xa7bb('0x0'));var rimraf=require(_0xa7bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa7bb('0x2'));var rp=require('request-promise');var moment=require(_0xa7bb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa7bb('0x4'));var util=require(_0xa7bb('0x5'));var path=require(_0xa7bb('0x6'));var sox=require('sox');var csv=require(_0xa7bb('0x7'));var ejs=require(_0xa7bb('0x8'));var fs=require('fs');var fs_extra=require(_0xa7bb('0x9'));var _=require('lodash');var squel=require(_0xa7bb('0xa'));var crypto=require('crypto');var jsforce=require(_0xa7bb('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa7bb('0x7'));var querystring=require(_0xa7bb('0xc'));var Papa=require(_0xa7bb('0xd'));var Redis=require(_0xa7bb('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa7bb('0xf'));var as=require(_0xa7bb('0x10'));var hardwareService=require(_0xa7bb('0x11'));var logger=require('../../config/logger')(_0xa7bb('0x12'));var utils=require(_0xa7bb('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa7bb('0x14'));var db=require(_0xa7bb('0x15'))['db'];function respondWithStatusCode(_0x3d5ece,_0xc53e8e){_0xc53e8e=_0xc53e8e||0xcc;return function(_0x25a41f){if(_0x25a41f){return _0x3d5ece[_0xa7bb('0x16')](_0xc53e8e);}return _0x3d5ece[_0xa7bb('0x17')](_0xc53e8e)[_0xa7bb('0x18')]();};}function respondWithResult(_0x20bfdb,_0x4f0feb){_0x4f0feb=_0x4f0feb||0xc8;return function(_0x43f680){if(_0x43f680){return _0x20bfdb[_0xa7bb('0x17')](_0x4f0feb)[_0xa7bb('0x19')](_0x43f680);}};}function respondWithFilteredResult(_0x54fe16,_0x5f8dff){return function(_0x1f44f3){if(_0x1f44f3){var _0x4d023a=_0x1f44f3[_0xa7bb('0x1a')],_0x130aec=_0x5f8dff[_0xa7bb('0x1b')],_0x4f4ff5=_0x5f8dff[_0xa7bb('0x1b')]+_0x5f8dff[_0xa7bb('0x1c')],_0x37e66d;if(_0x4f4ff5>=_0x4d023a){_0x4f4ff5=_0x4d023a;_0x37e66d=0xc8;}else{_0x37e66d=0xce;}_0x54fe16[_0xa7bb('0x17')](_0x37e66d);return _0x54fe16[_0xa7bb('0x1d')](_0xa7bb('0x1e'),_0x130aec+'-'+_0x4f4ff5+'/'+_0x4d023a)[_0xa7bb('0x19')](_0x1f44f3);}return null;};}function patchUpdates(_0x4876bf){return function(_0x20ba2a){try{jsonpatch[_0xa7bb('0x1f')](_0x20ba2a,_0x4876bf,!![]);}catch(_0x17f7ae){return BPromise[_0xa7bb('0x20')](_0x17f7ae);}return _0x20ba2a['save']();};}function saveUpdates(_0x380ca1,_0x4fe710){return function(_0x42c06b){if(_0x42c06b){return _0x42c06b[_0xa7bb('0x21')](_0x380ca1)[_0xa7bb('0x22')](function(_0x3ee141){return _0x3ee141;});}return null;};}function removeEntity(_0x25da7d,_0xe2f797){return function(_0x4cb14e){if(_0x4cb14e){return _0x4cb14e[_0xa7bb('0x23')]()[_0xa7bb('0x22')](function(){_0x25da7d[_0xa7bb('0x17')](0xcc)[_0xa7bb('0x18')]();});}};}function handleEntityNotFound(_0x36f68a,_0x3a977a){return function(_0x52ed08){if(!_0x52ed08){_0x36f68a[_0xa7bb('0x16')](0x194);}return _0x52ed08;};}function handleError(_0x152b53,_0x5119b5){_0x5119b5=_0x5119b5||0x1f4;return function(_0x313591){logger[_0xa7bb('0x24')](_0x313591['stack']);if(_0x313591[_0xa7bb('0x25')]){delete _0x313591[_0xa7bb('0x25')];}_0x152b53[_0xa7bb('0x17')](_0x5119b5)[_0xa7bb('0x26')](_0x313591);};}exports[_0xa7bb('0x27')]=function(_0x4a2068,_0x2c3297){var _0x5f662c={},_0x1b2214={},_0x5577b9={'count':0x0,'rows':[]};var _0x4f792d=_[_0xa7bb('0x28')](db[_0xa7bb('0x29')][_0xa7bb('0x2a')],function(_0x588a23){return{'name':_0x588a23[_0xa7bb('0x2b')],'type':_0x588a23[_0xa7bb('0x2c')][_0xa7bb('0x2d')]};});_0x1b2214[_0xa7bb('0x2e')]=_[_0xa7bb('0x28')](_0x4f792d,_0xa7bb('0x25'));_0x1b2214['query']=_[_0xa7bb('0x2f')](_0x4a2068[_0xa7bb('0x30')]);_0x1b2214[_0xa7bb('0x31')]=_[_0xa7bb('0x32')](_0x1b2214[_0xa7bb('0x2e')],_0x1b2214[_0xa7bb('0x30')]);_0x5f662c[_0xa7bb('0x33')]=_[_0xa7bb('0x32')](_0x1b2214['model'],qs[_0xa7bb('0x34')](_0x4a2068[_0xa7bb('0x30')]['fields']));_0x5f662c[_0xa7bb('0x33')]=_0x5f662c[_0xa7bb('0x33')][_0xa7bb('0x35')]?_0x5f662c[_0xa7bb('0x33')]:_0x1b2214['model'];if(!_0x4a2068[_0xa7bb('0x30')][_0xa7bb('0x36')](_0xa7bb('0x37'))){_0x5f662c[_0xa7bb('0x1c')]=qs['limit'](_0x4a2068[_0xa7bb('0x30')][_0xa7bb('0x1c')]);_0x5f662c[_0xa7bb('0x1b')]=qs[_0xa7bb('0x1b')](_0x4a2068['query'][_0xa7bb('0x1b')]);}_0x5f662c['order']=qs['sort'](_0x4a2068[_0xa7bb('0x30')]['sort']);_0x5f662c[_0xa7bb('0x38')]=qs[_0xa7bb('0x31')](_['pick'](_0x4a2068[_0xa7bb('0x30')],_0x1b2214['filters']),_0x4f792d);if(_0x4a2068[_0xa7bb('0x30')][_0xa7bb('0x39')]){_0x5f662c[_0xa7bb('0x38')]=_[_0xa7bb('0x3a')](_0x5f662c[_0xa7bb('0x38')],{'$or':_['map'](_0x4f792d,function(_0x2bcbd0){if(_0x2bcbd0[_0xa7bb('0x2c')]!=='VIRTUAL'){var _0x4e30e2={};_0x4e30e2[_0x2bcbd0['name']]={'$like':'%'+_0x4a2068[_0xa7bb('0x30')][_0xa7bb('0x39')]+'%'};return _0x4e30e2;}})});}_0x5f662c=_['merge']({},_0x5f662c,_0x4a2068[_0xa7bb('0x3b')]);var _0x373111={'where':_0x5f662c['where']};return db[_0xa7bb('0x29')][_0xa7bb('0x1a')](_0x373111)[_0xa7bb('0x22')](function(_0x13c475){_0x5577b9[_0xa7bb('0x1a')]=_0x13c475;if(_0x4a2068[_0xa7bb('0x30')][_0xa7bb('0x3c')]){_0x5f662c[_0xa7bb('0x3d')]=[{'all':!![]}];}return db[_0xa7bb('0x29')]['findAll'](_0x5f662c);})['then'](function(_0x49d96e){_0x5577b9[_0xa7bb('0x3e')]=_0x49d96e;return _0x5577b9;})['then'](respondWithFilteredResult(_0x2c3297,_0x5f662c))['catch'](handleError(_0x2c3297,null));};exports[_0xa7bb('0x3f')]=function(_0x1bd9b4,_0x5e4e35){var _0x534e59={'raw':!![],'where':{'id':_0x1bd9b4[_0xa7bb('0x40')]['id']}},_0x1d9cca={};_0x1d9cca[_0xa7bb('0x2e')]=_[_0xa7bb('0x2f')](db['ZohoField'][_0xa7bb('0x2a')]);_0x1d9cca[_0xa7bb('0x30')]=_['keys'](_0x1bd9b4['query']);_0x1d9cca['filters']=_[_0xa7bb('0x32')](_0x1d9cca['model'],_0x1d9cca[_0xa7bb('0x30')]);_0x534e59[_0xa7bb('0x33')]=_[_0xa7bb('0x32')](_0x1d9cca[_0xa7bb('0x2e')],qs[_0xa7bb('0x34')](_0x1bd9b4[_0xa7bb('0x30')][_0xa7bb('0x34')]));_0x534e59[_0xa7bb('0x33')]=_0x534e59[_0xa7bb('0x33')][_0xa7bb('0x35')]?_0x534e59[_0xa7bb('0x33')]:_0x1d9cca['model'];if(_0x1bd9b4[_0xa7bb('0x30')][_0xa7bb('0x3c')]){_0x534e59[_0xa7bb('0x3d')]=[{'all':!![]}];}_0x534e59=_['merge']({},_0x534e59,_0x1bd9b4[_0xa7bb('0x3b')]);return db['ZohoField'][_0xa7bb('0x41')](_0x534e59)['then'](handleEntityNotFound(_0x5e4e35,null))[_0xa7bb('0x22')](respondWithResult(_0x5e4e35,null))[_0xa7bb('0x42')](handleError(_0x5e4e35,null));};exports[_0xa7bb('0x43')]=function(_0x55fb51,_0x2ef56d){return db[_0xa7bb('0x29')][_0xa7bb('0x43')](_0x55fb51[_0xa7bb('0x44')],{})[_0xa7bb('0x22')](respondWithResult(_0x2ef56d,0xc9))['catch'](handleError(_0x2ef56d,null));};exports[_0xa7bb('0x21')]=function(_0x56edae,_0x41b954){if(_0x56edae['body']['id']){delete _0x56edae[_0xa7bb('0x44')]['id'];}return db['ZohoField'][_0xa7bb('0x41')]({'where':{'id':_0x56edae[_0xa7bb('0x40')]['id']}})[_0xa7bb('0x22')](handleEntityNotFound(_0x41b954,null))[_0xa7bb('0x22')](saveUpdates(_0x56edae['body'],null))['then'](respondWithResult(_0x41b954,null))[_0xa7bb('0x42')](handleError(_0x41b954,null));};exports[_0xa7bb('0x23')]=function(_0x468d3a,_0x1f3c0b){return db[_0xa7bb('0x29')]['find']({'where':{'id':_0x468d3a[_0xa7bb('0x40')]['id']}})[_0xa7bb('0x22')](handleEntityNotFound(_0x1f3c0b,null))[_0xa7bb('0x22')](removeEntity(_0x1f3c0b,null))[_0xa7bb('0x42')](handleError(_0x1f3c0b,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 55461ff..d788782 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 _0xb006=['ZohoField','int_zoho_fields','FieldId','lodash','api','moment','bluebird','request-promise','path','rimraf','./intZohoField.attributes','exports','define'];(function(_0x2c4fda,_0x2dc93f){var _0x503c72=function(_0x14aee7){while(--_0x14aee7){_0x2c4fda['push'](_0x2c4fda['shift']());}};_0x503c72(++_0x2dc93f);}(_0xb006,0xc6));var _0x6b00=function(_0x2cba09,_0x23ee85){_0x2cba09=_0x2cba09-0x0;var _0x10d084=_0xb006[_0x2cba09];return _0x10d084;};'use strict';var _=require(_0x6b00('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6b00('0x1'));var moment=require(_0x6b00('0x2'));var BPromise=require(_0x6b00('0x3'));var rp=require(_0x6b00('0x4'));var fs=require('fs');var path=require(_0x6b00('0x5'));var rimraf=require(_0x6b00('0x6'));var config=require('../../config/environment');var attributes=require(_0x6b00('0x7'));module[_0x6b00('0x8')]=function(_0x46002c,_0x52565b){return _0x46002c[_0x6b00('0x9')](_0x6b00('0xa'),attributes,{'tableName':_0x6b00('0xb'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x6b00('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe10e=['../../config/environment','./intZohoField.attributes','exports','int_zoho_fields','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x329b75,_0x4a8111){var _0xa48da0=function(_0x2da245){while(--_0x2da245){_0x329b75['push'](_0x329b75['shift']());}};_0xa48da0(++_0x4a8111);}(_0xe10e,0x1c1));var _0xee10=function(_0x23b106,_0x50acec){_0x23b106=_0x23b106-0x0;var _0x3c88e5=_0xe10e[_0x23b106];return _0x3c88e5;};'use strict';var _=require(_0xee10('0x0'));var util=require(_0xee10('0x1'));var logger=require(_0xee10('0x2'))('api');var moment=require('moment');var BPromise=require(_0xee10('0x3'));var rp=require(_0xee10('0x4'));var fs=require('fs');var path=require(_0xee10('0x5'));var rimraf=require(_0xee10('0x6'));var config=require(_0xee10('0x7'));var attributes=require(_0xee10('0x8'));module[_0xee10('0x9')]=function(_0x2a696f,_0x51283d){return _0x2a696f['define']('ZohoField',attributes,{'tableName':_0xee10('0xa'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0xee10('0xb')],'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 d4d90ca..928e640 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 _0x9c5a=['http','then','ZohoField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x2e4531,_0x82387d){var _0x3c51ee=function(_0x5aa31d){while(--_0x5aa31d){_0x2e4531['push'](_0x2e4531['shift']());}};_0x3c51ee(++_0x82387d);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x403e27,_0x323e38){_0x403e27=_0x403e27-0x0;var _0x21b2c1=_0x9c5a[_0x403e27];return _0x21b2c1;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var moment=require('moment');var BPromise=require(_0xa9c5('0x2'));var rs=require(_0xa9c5('0x3'));var fs=require('fs');var Redis=require(_0xa9c5('0x4'));var db=require(_0xa9c5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9c5('0x6'))(_0xa9c5('0x7'));var config=require('../../config/environment');var jayson=require(_0xa9c5('0x8'));var client=jayson['client'][_0xa9c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3df556,_0x4cb597,_0x4b6db6){return new BPromise(function(_0x3d6b50,_0x16f331){return client['request'](_0x3df556,_0x4b6db6)[_0xa9c5('0xa')](function(_0x97f9e2){logger['info'](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0x4cb597,_0xa9c5('0xc'),JSON[_0xa9c5('0xd')](_0x97f9e2));if(_0x97f9e2[_0xa9c5('0xe')]){if(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0xf')]===0x1f4){logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x16f331(_0x97f9e2[_0xa9c5('0xe')]['message']);}logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x3d6b50(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);}else{logger[_0xa9c5('0x11')](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));_0x3d6b50(_0x97f9e2[_0xa9c5('0x12')]['message']);}})[_0xa9c5('0x13')](function(_0xd85c32){logger[_0xa9c5('0xe')]('ZohoField,\x20%s,\x20%s',_0x4cb597,_0xd85c32);_0x16f331(_0xd85c32);});});} \ No newline at end of file +var _0xb458=['ZohoField,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','ZohoField,\x20%s,\x20%s','debug'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xb458,0x103));var _0x8b45=function(_0x1b8191,_0xf183e9){_0x1b8191=_0x1b8191-0x0;var _0x2ccc28=_0xb458[_0x1b8191];return _0x2ccc28;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];var utils=require(_0x8b45('0x5'));var logger=require(_0x8b45('0x6'))('rpc');var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b45('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12bd05,_0x2daa9a,_0x3a8ccb){return new BPromise(function(_0x32342f,_0x4d1718){return client[_0x8b45('0x9')](_0x12bd05,_0x3a8ccb)[_0x8b45('0xa')](function(_0x33f30e){logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,'request\x20sent');logger[_0x8b45('0xd')](_0x8b45('0xe'),_0x2daa9a,'request\x20sent',JSON['stringify'](_0x33f30e));if(_0x33f30e['error']){if(_0x33f30e['error'][_0x8b45('0xf')]===0x1f4){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e['error'][_0x8b45('0x11')]);return _0x4d1718(_0x33f30e[_0x8b45('0x10')][_0x8b45('0x11')]);}logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e[_0x8b45('0x10')]['message']);return _0x32342f(_0x33f30e['error'][_0x8b45('0x11')]);}else{logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,_0x8b45('0x12'));_0x32342f(_0x33f30e[_0x8b45('0x13')][_0x8b45('0x11')]);}})[_0x8b45('0x14')](function(_0x147d6b){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x147d6b);_0x4d1718(_0x147d6b);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index c374800..0869eb2 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 _0xc04a=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','exports','multer','path'];(function(_0xe1d90f,_0x3beed4){var _0x1b1bed=function(_0x1f1d4b){while(--_0x1f1d4b){_0xe1d90f['push'](_0xe1d90f['shift']());}};_0x1b1bed(++_0x3beed4);}(_0xc04a,0x12e));var _0xac04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc04a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xac04('0x0'));var util=require('util');var path=require(_0xac04('0x1'));var timeout=require('connect-timeout');var express=require(_0xac04('0x2'));var router=express[_0xac04('0x3')]();var fs_extra=require(_0xac04('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xac04('0x5'));var config=require(_0xac04('0x6'));module[_0xac04('0x7')]=router; \ No newline at end of file +var _0xae1b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports','util','connect-timeout'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xae1b,0x96));var _0xbae1=function(_0x1aff9d,_0x2a19ab){_0x1aff9d=_0x1aff9d-0x0;var _0x4f4d96=_0xae1b[_0x1aff9d];return _0x4f4d96;};'use strict';var multer=require('multer');var util=require(_0xbae1('0x0'));var path=require('path');var timeout=require(_0xbae1('0x1'));var express=require(_0xbae1('0x2'));var router=express[_0xbae1('0x3')]();var fs_extra=require(_0xbae1('0x4'));var auth=require(_0xbae1('0x5'));var interaction=require(_0xbae1('0x6'));var config=require('../../config/environment');module[_0xbae1('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 395f98d..0489fae 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 _0x36ba=['BOOLEAN','exports','STRING','unique_name_and_version','app.js'];(function(_0x270e6d,_0x5c32f7){var _0x5b558c=function(_0x30d07a){while(--_0x30d07a){_0x270e6d['push'](_0x270e6d['shift']());}};_0x5b558c(++_0x5c32f7);}(_0x36ba,0x1dc));var _0xa36b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x36ba[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0xa36b('0x0')]={'name':{'type':Sequelize[_0xa36b('0x1')],'allowNull':![],'unique':_0xa36b('0x2')},'version':{'type':Sequelize[_0xa36b('0x1')],'allowNull':![],'unique':_0xa36b('0x2')},'main':{'type':Sequelize[_0xa36b('0x1')],'defaultValue':_0xa36b('0x3')},'filename':{'type':Sequelize[_0xa36b('0x1')]},'path':{'type':Sequelize[_0xa36b('0x1')]},'type':{'type':Sequelize[_0xa36b('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xa36b('0x4')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':'state'},'description':{'type':Sequelize[_0xa36b('0x1')]},'title':{'type':Sequelize[_0xa36b('0x1')]},'remoteUri':{'type':Sequelize[_0xa36b('0x1')]},'link':{'type':Sequelize[_0xa36b('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x7568=['unique_name_and_version','STRING','app.js','state','sequelize','exports'];(function(_0x10a212,_0x579d85){var _0x23c82b=function(_0x412ea9){while(--_0x412ea9){_0x10a212['push'](_0x10a212['shift']());}};_0x23c82b(++_0x579d85);}(_0x7568,0x166));var _0x8756=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x7568[_0x1589dd];return _0x1bddd1;};'use strict';var Sequelize=require(_0x8756('0x0'));module[_0x8756('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8756('0x2')},'version':{'type':Sequelize[_0x8756('0x3')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x8756('0x3')],'defaultValue':_0x8756('0x4')},'filename':{'type':Sequelize[_0x8756('0x3')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8756('0x3')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x8756('0x3')]},'state':{'type':Sequelize['STRING'],'unique':_0x8756('0x5')},'description':{'type':Sequelize[_0x8756('0x3')]},'title':{'type':Sequelize[_0x8756('0x3')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x8756('0x3')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index ede3a0e..52353eb 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 _0x1439=['params','length','include','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','apply','reject','update','then','destroy','error','stack','name','send','map','Integration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0x1439,0x98));var _0x9143=function(_0x5953c8,_0x418950){_0x5953c8=_0x5953c8-0x0;var _0x25a42d=_0x1439[_0x5953c8];return _0x25a42d;};'use strict';var emlformat=require(_0x9143('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9143('0x1'));var jsonpatch=require(_0x9143('0x2'));var rp=require(_0x9143('0x3'));var moment=require('moment');var BPromise=require(_0x9143('0x4'));var Mustache=require(_0x9143('0x5'));var util=require(_0x9143('0x6'));var path=require(_0x9143('0x7'));var sox=require(_0x9143('0x8'));var csv=require(_0x9143('0x9'));var ejs=require(_0x9143('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9143('0xb'));var squel=require(_0x9143('0xc'));var crypto=require(_0x9143('0xd'));var jsforce=require(_0x9143('0xe'));var deskjs=require(_0x9143('0xf'));var toCsv=require(_0x9143('0x9'));var querystring=require(_0x9143('0x10'));var Papa=require(_0x9143('0x11'));var Redis=require(_0x9143('0x12'));var authService=require(_0x9143('0x13'));var qs=require(_0x9143('0x14'));var as=require(_0x9143('0x15'));var hardwareService=require(_0x9143('0x16'));var logger=require(_0x9143('0x17'))(_0x9143('0x18'));var utils=require(_0x9143('0x19'));var config=require(_0x9143('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b9042,_0x5194d2){_0x5194d2=_0x5194d2||0xcc;return function(_0x67852f){if(_0x67852f){return _0x5b9042[_0x9143('0x1b')](_0x5194d2);}return _0x5b9042[_0x9143('0x1c')](_0x5194d2)[_0x9143('0x1d')]();};}function respondWithResult(_0x18080c,_0xee5356){_0xee5356=_0xee5356||0xc8;return function(_0x17a932){if(_0x17a932){return _0x18080c[_0x9143('0x1c')](_0xee5356)[_0x9143('0x1e')](_0x17a932);}};}function respondWithFilteredResult(_0x5d7ed1,_0x354800){return function(_0x2e8f34){if(_0x2e8f34){var _0x31e3fc=_0x2e8f34[_0x9143('0x1f')],_0x4f7be5=_0x354800[_0x9143('0x20')],_0x2ef410=_0x354800[_0x9143('0x20')]+_0x354800['limit'],_0x458569;if(_0x2ef410>=_0x31e3fc){_0x2ef410=_0x31e3fc;_0x458569=0xc8;}else{_0x458569=0xce;}_0x5d7ed1[_0x9143('0x1c')](_0x458569);return _0x5d7ed1[_0x9143('0x21')]('Content-Range',_0x4f7be5+'-'+_0x2ef410+'/'+_0x31e3fc)[_0x9143('0x1e')](_0x2e8f34);}return null;};}function patchUpdates(_0x4f96d6){return function(_0x52662f){try{jsonpatch[_0x9143('0x22')](_0x52662f,_0x4f96d6,!![]);}catch(_0x193896){return BPromise[_0x9143('0x23')](_0x193896);}return _0x52662f['save']();};}function saveUpdates(_0x2d53ce,_0x5a383b){return function(_0x46a8fa){if(_0x46a8fa){return _0x46a8fa[_0x9143('0x24')](_0x2d53ce)[_0x9143('0x25')](function(_0x91de0b){return _0x91de0b;});}return null;};}function removeEntity(_0x170212,_0x4b5036){return function(_0xf03c71){if(_0xf03c71){return _0xf03c71[_0x9143('0x26')]()['then'](function(){_0x170212['status'](0xcc)[_0x9143('0x1d')]();});}};}function handleEntityNotFound(_0x4d1efa,_0x1799e5){return function(_0x685816){if(!_0x685816){_0x4d1efa['sendStatus'](0x194);}return _0x685816;};}function handleError(_0x129212,_0x3557e8){_0x3557e8=_0x3557e8||0x1f4;return function(_0x38e0da){logger[_0x9143('0x27')](_0x38e0da[_0x9143('0x28')]);if(_0x38e0da[_0x9143('0x29')]){delete _0x38e0da['name'];}_0x129212['status'](_0x3557e8)[_0x9143('0x2a')](_0x38e0da);};}exports['index']=function(_0x4905dd,_0x1c50b5){var _0x2b1d52={},_0x474aa2={},_0x528a3a={'count':0x0,'rows':[]};var _0x4d6e9a=_[_0x9143('0x2b')](db[_0x9143('0x2c')][_0x9143('0x2d')],function(_0x378fbd){return{'name':_0x378fbd['fieldName'],'type':_0x378fbd[_0x9143('0x2e')][_0x9143('0x2f')]};});_0x474aa2[_0x9143('0x30')]=_['map'](_0x4d6e9a,_0x9143('0x29'));_0x474aa2[_0x9143('0x31')]=_[_0x9143('0x32')](_0x4905dd[_0x9143('0x31')]);_0x474aa2[_0x9143('0x33')]=_[_0x9143('0x34')](_0x474aa2[_0x9143('0x30')],_0x474aa2[_0x9143('0x31')]);_0x2b1d52[_0x9143('0x35')]=_['intersection'](_0x474aa2[_0x9143('0x30')],qs[_0x9143('0x36')](_0x4905dd['query'][_0x9143('0x36')]));_0x2b1d52[_0x9143('0x35')]=_0x2b1d52['attributes']['length']?_0x2b1d52['attributes']:_0x474aa2['model'];if(!_0x4905dd[_0x9143('0x31')]['hasOwnProperty'](_0x9143('0x37'))){_0x2b1d52[_0x9143('0x38')]=qs[_0x9143('0x38')](_0x4905dd[_0x9143('0x31')][_0x9143('0x38')]);_0x2b1d52['offset']=qs['offset'](_0x4905dd[_0x9143('0x31')][_0x9143('0x20')]);}_0x2b1d52[_0x9143('0x39')]=qs[_0x9143('0x3a')](_0x4905dd[_0x9143('0x31')][_0x9143('0x3a')]);_0x2b1d52['where']=qs[_0x9143('0x33')](_['pick'](_0x4905dd[_0x9143('0x31')],_0x474aa2[_0x9143('0x33')]),_0x4d6e9a);if(_0x4905dd[_0x9143('0x31')][_0x9143('0x3b')]){_0x2b1d52[_0x9143('0x3c')]=_[_0x9143('0x3d')](_0x2b1d52[_0x9143('0x3c')],{'$or':_[_0x9143('0x2b')](_0x4d6e9a,function(_0x205341){if(_0x205341[_0x9143('0x2e')]!==_0x9143('0x3e')){var _0x2d98d2={};_0x2d98d2[_0x205341['name']]={'$like':'%'+_0x4905dd[_0x9143('0x31')][_0x9143('0x3b')]+'%'};return _0x2d98d2;}})});}_0x2b1d52=_[_0x9143('0x3d')]({},_0x2b1d52,_0x4905dd[_0x9143('0x3f')]);var _0x447140={'where':_0x2b1d52[_0x9143('0x3c')]};return db[_0x9143('0x2c')][_0x9143('0x1f')](_0x447140)[_0x9143('0x25')](function(_0xa3e5d4){_0x528a3a[_0x9143('0x1f')]=_0xa3e5d4;if(_0x4905dd[_0x9143('0x31')][_0x9143('0x40')]){_0x2b1d52['include']=[{'all':!![]}];}return db[_0x9143('0x2c')][_0x9143('0x41')](_0x2b1d52);})[_0x9143('0x25')](function(_0x1c6ebf){_0x528a3a[_0x9143('0x42')]=_0x1c6ebf;return _0x528a3a;})['then'](respondWithFilteredResult(_0x1c50b5,_0x2b1d52))['catch'](handleError(_0x1c50b5,null));};exports['show']=function(_0x58ea06,_0x393acb){var _0x3e9b27={'raw':![],'where':{'id':_0x58ea06[_0x9143('0x43')]['id']}},_0x3be0a0={};_0x3be0a0[_0x9143('0x30')]=_[_0x9143('0x32')](db[_0x9143('0x2c')][_0x9143('0x2d')]);_0x3be0a0[_0x9143('0x31')]=_[_0x9143('0x32')](_0x58ea06['query']);_0x3be0a0[_0x9143('0x33')]=_[_0x9143('0x34')](_0x3be0a0[_0x9143('0x30')],_0x3be0a0['query']);_0x3e9b27[_0x9143('0x35')]=_[_0x9143('0x34')](_0x3be0a0[_0x9143('0x30')],qs[_0x9143('0x36')](_0x58ea06['query'][_0x9143('0x36')]));_0x3e9b27[_0x9143('0x35')]=_0x3e9b27[_0x9143('0x35')][_0x9143('0x44')]?_0x3e9b27[_0x9143('0x35')]:_0x3be0a0[_0x9143('0x30')];if(_0x58ea06[_0x9143('0x31')][_0x9143('0x40')]){_0x3e9b27[_0x9143('0x45')]=[{'all':!![]}];}_0x3e9b27=_[_0x9143('0x3d')]({},_0x3e9b27,_0x58ea06[_0x9143('0x3f')]);return db[_0x9143('0x2c')][_0x9143('0x46')](_0x3e9b27)[_0x9143('0x25')](handleEntityNotFound(_0x393acb,null))['then'](respondWithResult(_0x393acb,null))['catch'](handleError(_0x393acb,null));};exports[_0x9143('0x47')]=function(_0x2afa52,_0x573673){return db[_0x9143('0x2c')]['create'](_0x2afa52[_0x9143('0x48')],{})['then'](respondWithResult(_0x573673,0xc9))['catch'](handleError(_0x573673,null));};exports[_0x9143('0x24')]=function(_0x282d23,_0x4a69b9){if(_0x282d23[_0x9143('0x48')]['id']){delete _0x282d23[_0x9143('0x48')]['id'];}return db[_0x9143('0x2c')][_0x9143('0x46')]({'where':{'id':_0x282d23[_0x9143('0x43')]['id']}})['then'](handleEntityNotFound(_0x4a69b9,null))['then'](saveUpdates(_0x282d23['body'],null))[_0x9143('0x25')](respondWithResult(_0x4a69b9,null))['catch'](handleError(_0x4a69b9,null));};exports['destroy']=function(_0x492c51,_0x4dd46b){return db[_0x9143('0x2c')][_0x9143('0x46')]({'where':{'id':_0x492c51['params']['id']}})[_0x9143('0x25')](handleEntityNotFound(_0x4dd46b,null))['then'](removeEntity(_0x4dd46b,null))['catch'](handleError(_0x4dd46b,null));}; \ No newline at end of file +var _0x88ac=['mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','catch','show','params','keys','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x88ac,0x122));var _0xc88a=function(_0x253201,_0x55488a){_0x253201=_0x253201-0x0;var _0x4a479a=_0x88ac[_0x253201];return _0x4a479a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc88a('0x0'));var zipdir=require(_0xc88a('0x1'));var jsonpatch=require(_0xc88a('0x2'));var rp=require(_0xc88a('0x3'));var moment=require(_0xc88a('0x4'));var BPromise=require(_0xc88a('0x5'));var Mustache=require(_0xc88a('0x6'));var util=require(_0xc88a('0x7'));var path=require('path');var sox=require(_0xc88a('0x8'));var csv=require(_0xc88a('0x9'));var ejs=require(_0xc88a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc88a('0xb'));var squel=require(_0xc88a('0xc'));var crypto=require(_0xc88a('0xd'));var jsforce=require(_0xc88a('0xe'));var deskjs=require(_0xc88a('0xf'));var toCsv=require(_0xc88a('0x9'));var querystring=require(_0xc88a('0x10'));var Papa=require(_0xc88a('0x11'));var Redis=require(_0xc88a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc88a('0x13'));var as=require(_0xc88a('0x14'));var hardwareService=require(_0xc88a('0x15'));var logger=require(_0xc88a('0x16'))(_0xc88a('0x17'));var utils=require(_0xc88a('0x18'));var config=require(_0xc88a('0x19'));var licenseUtil=require(_0xc88a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50d663,_0x33ec30){_0x33ec30=_0x33ec30||0xcc;return function(_0x58a5a9){if(_0x58a5a9){return _0x50d663['sendStatus'](_0x33ec30);}return _0x50d663[_0xc88a('0x1b')](_0x33ec30)[_0xc88a('0x1c')]();};}function respondWithResult(_0x14e36f,_0x475277){_0x475277=_0x475277||0xc8;return function(_0x231676){if(_0x231676){return _0x14e36f['status'](_0x475277)[_0xc88a('0x1d')](_0x231676);}};}function respondWithFilteredResult(_0x1e595a,_0x5eaf94){return function(_0x36e20c){if(_0x36e20c){var _0x2c8485=_0x36e20c[_0xc88a('0x1e')],_0x3cc79a=_0x5eaf94[_0xc88a('0x1f')],_0x306ab7=_0x5eaf94[_0xc88a('0x1f')]+_0x5eaf94[_0xc88a('0x20')],_0x1bf52;if(_0x306ab7>=_0x2c8485){_0x306ab7=_0x2c8485;_0x1bf52=0xc8;}else{_0x1bf52=0xce;}_0x1e595a['status'](_0x1bf52);return _0x1e595a['set'](_0xc88a('0x21'),_0x3cc79a+'-'+_0x306ab7+'/'+_0x2c8485)['json'](_0x36e20c);}return null;};}function patchUpdates(_0x5d5f9e){return function(_0x34ca37){try{jsonpatch[_0xc88a('0x22')](_0x34ca37,_0x5d5f9e,!![]);}catch(_0x534bb){return BPromise[_0xc88a('0x23')](_0x534bb);}return _0x34ca37['save']();};}function saveUpdates(_0x4e0135,_0xb3e91b){return function(_0x3c1415){if(_0x3c1415){return _0x3c1415[_0xc88a('0x24')](_0x4e0135)[_0xc88a('0x25')](function(_0x43cb6c){return _0x43cb6c;});}return null;};}function removeEntity(_0x5898a6,_0x5b1e69){return function(_0x57f4f9){if(_0x57f4f9){return _0x57f4f9[_0xc88a('0x26')]()[_0xc88a('0x25')](function(){_0x5898a6['status'](0xcc)[_0xc88a('0x1c')]();});}};}function handleEntityNotFound(_0x325e3d,_0xc4a106){return function(_0x1e3997){if(!_0x1e3997){_0x325e3d['sendStatus'](0x194);}return _0x1e3997;};}function handleError(_0x9cb7bd,_0x7eee4a){_0x7eee4a=_0x7eee4a||0x1f4;return function(_0x3f6a70){logger[_0xc88a('0x27')](_0x3f6a70[_0xc88a('0x28')]);if(_0x3f6a70[_0xc88a('0x29')]){delete _0x3f6a70[_0xc88a('0x29')];}_0x9cb7bd[_0xc88a('0x1b')](_0x7eee4a)[_0xc88a('0x2a')](_0x3f6a70);};}exports[_0xc88a('0x2b')]=function(_0x2dcf3c,_0x127dd1){var _0x4eec61={},_0x154cff={},_0x244bbd={'count':0x0,'rows':[]};var _0x2fda83=_[_0xc88a('0x2c')](db[_0xc88a('0x2d')][_0xc88a('0x2e')],function(_0x396fe6){return{'name':_0x396fe6[_0xc88a('0x2f')],'type':_0x396fe6[_0xc88a('0x30')][_0xc88a('0x31')]};});_0x154cff['model']=_[_0xc88a('0x2c')](_0x2fda83,'name');_0x154cff[_0xc88a('0x32')]=_['keys'](_0x2dcf3c[_0xc88a('0x32')]);_0x154cff[_0xc88a('0x33')]=_[_0xc88a('0x34')](_0x154cff[_0xc88a('0x35')],_0x154cff[_0xc88a('0x32')]);_0x4eec61[_0xc88a('0x36')]=_['intersection'](_0x154cff[_0xc88a('0x35')],qs['fields'](_0x2dcf3c['query'][_0xc88a('0x37')]));_0x4eec61[_0xc88a('0x36')]=_0x4eec61[_0xc88a('0x36')][_0xc88a('0x38')]?_0x4eec61[_0xc88a('0x36')]:_0x154cff[_0xc88a('0x35')];if(!_0x2dcf3c['query'][_0xc88a('0x39')](_0xc88a('0x3a'))){_0x4eec61[_0xc88a('0x20')]=qs[_0xc88a('0x20')](_0x2dcf3c[_0xc88a('0x32')][_0xc88a('0x20')]);_0x4eec61['offset']=qs[_0xc88a('0x1f')](_0x2dcf3c['query'][_0xc88a('0x1f')]);}_0x4eec61['order']=qs[_0xc88a('0x3b')](_0x2dcf3c['query'][_0xc88a('0x3b')]);_0x4eec61[_0xc88a('0x3c')]=qs[_0xc88a('0x33')](_[_0xc88a('0x3d')](_0x2dcf3c[_0xc88a('0x32')],_0x154cff['filters']),_0x2fda83);if(_0x2dcf3c[_0xc88a('0x32')][_0xc88a('0x3e')]){_0x4eec61['where']=_[_0xc88a('0x3f')](_0x4eec61[_0xc88a('0x3c')],{'$or':_['map'](_0x2fda83,function(_0xc4a4e9){if(_0xc4a4e9['type']!=='VIRTUAL'){var _0xdcfc1c={};_0xdcfc1c[_0xc4a4e9['name']]={'$like':'%'+_0x2dcf3c[_0xc88a('0x32')][_0xc88a('0x3e')]+'%'};return _0xdcfc1c;}})});}_0x4eec61=_[_0xc88a('0x3f')]({},_0x4eec61,_0x2dcf3c[_0xc88a('0x40')]);var _0x3fabcf={'where':_0x4eec61['where']};return db[_0xc88a('0x2d')][_0xc88a('0x1e')](_0x3fabcf)[_0xc88a('0x25')](function(_0x203a1f){_0x244bbd[_0xc88a('0x1e')]=_0x203a1f;if(_0x2dcf3c['query'][_0xc88a('0x41')]){_0x4eec61[_0xc88a('0x42')]=[{'all':!![]}];}return db[_0xc88a('0x2d')]['findAll'](_0x4eec61);})[_0xc88a('0x25')](function(_0x5cfbf4){_0x244bbd['rows']=_0x5cfbf4;return _0x244bbd;})['then'](respondWithFilteredResult(_0x127dd1,_0x4eec61))[_0xc88a('0x43')](handleError(_0x127dd1,null));};exports[_0xc88a('0x44')]=function(_0x126090,_0x15945c){var _0x565be7={'raw':![],'where':{'id':_0x126090[_0xc88a('0x45')]['id']}},_0xa8f92c={};_0xa8f92c[_0xc88a('0x35')]=_[_0xc88a('0x46')](db[_0xc88a('0x2d')][_0xc88a('0x2e')]);_0xa8f92c[_0xc88a('0x32')]=_[_0xc88a('0x46')](_0x126090[_0xc88a('0x32')]);_0xa8f92c['filters']=_[_0xc88a('0x34')](_0xa8f92c[_0xc88a('0x35')],_0xa8f92c[_0xc88a('0x32')]);_0x565be7[_0xc88a('0x36')]=_[_0xc88a('0x34')](_0xa8f92c[_0xc88a('0x35')],qs[_0xc88a('0x37')](_0x126090['query'][_0xc88a('0x37')]));_0x565be7['attributes']=_0x565be7[_0xc88a('0x36')]['length']?_0x565be7[_0xc88a('0x36')]:_0xa8f92c[_0xc88a('0x35')];if(_0x126090['query'][_0xc88a('0x41')]){_0x565be7[_0xc88a('0x42')]=[{'all':!![]}];}_0x565be7=_[_0xc88a('0x3f')]({},_0x565be7,_0x126090[_0xc88a('0x40')]);return db[_0xc88a('0x2d')]['find'](_0x565be7)[_0xc88a('0x25')](handleEntityNotFound(_0x15945c,null))[_0xc88a('0x25')](respondWithResult(_0x15945c,null))[_0xc88a('0x43')](handleError(_0x15945c,null));};exports[_0xc88a('0x47')]=function(_0x225d5f,_0x516bfe){return db[_0xc88a('0x2d')][_0xc88a('0x47')](_0x225d5f[_0xc88a('0x48')],{})[_0xc88a('0x25')](respondWithResult(_0x516bfe,0xc9))['catch'](handleError(_0x516bfe,null));};exports[_0xc88a('0x24')]=function(_0x18f501,_0x574ecc){if(_0x18f501['body']['id']){delete _0x18f501[_0xc88a('0x48')]['id'];}return db[_0xc88a('0x2d')][_0xc88a('0x49')]({'where':{'id':_0x18f501[_0xc88a('0x45')]['id']}})['then'](handleEntityNotFound(_0x574ecc,null))[_0xc88a('0x25')](saveUpdates(_0x18f501[_0xc88a('0x48')],null))[_0xc88a('0x25')](respondWithResult(_0x574ecc,null))[_0xc88a('0x43')](handleError(_0x574ecc,null));};exports[_0xc88a('0x26')]=function(_0x945304,_0x3ea2f2){return db[_0xc88a('0x2d')]['find']({'where':{'id':_0x945304[_0xc88a('0x45')]['id']}})['then'](handleEntityNotFound(_0x3ea2f2,null))['then'](removeEntity(_0x3ea2f2,null))[_0xc88a('0x43')](handleError(_0x3ea2f2,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index d743370..2facb3e 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 _0x89a0=['define','Integration','integrations','util','api','moment','request-promise','path','rimraf','./integration.attributes','exports'];(function(_0x435634,_0x228d70){var _0x3ed4b9=function(_0x1ee3a1){while(--_0x1ee3a1){_0x435634['push'](_0x435634['shift']());}};_0x3ed4b9(++_0x228d70);}(_0x89a0,0x10b));var _0x089a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x89a0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x089a('0x0'));var logger=require('../../config/logger')(_0x089a('0x1'));var moment=require(_0x089a('0x2'));var BPromise=require('bluebird');var rp=require(_0x089a('0x3'));var fs=require('fs');var path=require(_0x089a('0x4'));var rimraf=require(_0x089a('0x5'));var config=require('../../config/environment');var attributes=require(_0x089a('0x6'));module[_0x089a('0x7')]=function(_0x5ccbce,_0x43e014){return _0x5ccbce[_0x089a('0x8')](_0x089a('0x9'),attributes,{'tableName':_0x089a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a17=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','Integration','integrations','lodash'];(function(_0x432169,_0x7ffbe9){var _0x28e745=function(_0x810c68){while(--_0x810c68){_0x432169['push'](_0x432169['shift']());}};_0x28e745(++_0x7ffbe9);}(_0x3a17,0x6b));var _0x73a1=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x3a17[_0x4c445a];return _0x2f611c;};'use strict';var _=require(_0x73a1('0x0'));var util=require(_0x73a1('0x1'));var logger=require(_0x73a1('0x2'))('api');var moment=require(_0x73a1('0x3'));var BPromise=require(_0x73a1('0x4'));var rp=require(_0x73a1('0x5'));var fs=require('fs');var path=require(_0x73a1('0x6'));var rimraf=require(_0x73a1('0x7'));var config=require(_0x73a1('0x8'));var attributes=require(_0x73a1('0x9'));module['exports']=function(_0x494ac6,_0xc71f3e){return _0x494ac6['define'](_0x73a1('0xa'),attributes,{'tableName':_0x73a1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 52bb3b5..39ecfdd 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 _0xb777=['client','http','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1229c8,_0x1a7f0f){var _0x3ae885=function(_0x27b46d){while(--_0x27b46d){_0x1229c8['push'](_0x1229c8['shift']());}};_0x3ae885(++_0x1a7f0f);}(_0xb777,0x107));var _0x7b77=function(_0x3f6bcf,_0x531e79){_0x3f6bcf=_0x3f6bcf-0x0;var _0x1c5350=_0xb777[_0x3f6bcf];return _0x1c5350;};'use strict';var _=require('lodash');var util=require(_0x7b77('0x0'));var moment=require(_0x7b77('0x1'));var BPromise=require(_0x7b77('0x2'));var rs=require(_0x7b77('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b77('0x4'))['db'];var utils=require(_0x7b77('0x5'));var logger=require(_0x7b77('0x6'))(_0x7b77('0x7'));var config=require(_0x7b77('0x8'));var jayson=require(_0x7b77('0x9'));var client=jayson[_0x7b77('0xa')][_0x7b77('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53c9e0,_0x2e159f,_0x13118f){return new BPromise(function(_0x44773b,_0xd9bf4e){return client['request'](_0x53c9e0,_0x13118f)[_0x7b77('0xc')](function(_0xa989d6){logger[_0x7b77('0xd')](_0x7b77('0xe'),_0x2e159f,_0x7b77('0xf'));logger[_0x7b77('0x10')]('Integration,\x20%s,\x20%s,\x20%s',_0x2e159f,'request\x20sent',JSON['stringify'](_0xa989d6));if(_0xa989d6[_0x7b77('0x11')]){if(_0xa989d6['error'][_0x7b77('0x12')]===0x1f4){logger[_0x7b77('0x11')]('Integration,\x20%s,\x20%s',_0x2e159f,_0xa989d6[_0x7b77('0x11')][_0x7b77('0x13')]);return _0xd9bf4e(_0xa989d6[_0x7b77('0x11')][_0x7b77('0x13')]);}logger['error'](_0x7b77('0xe'),_0x2e159f,_0xa989d6[_0x7b77('0x11')][_0x7b77('0x13')]);return _0x44773b(_0xa989d6[_0x7b77('0x11')][_0x7b77('0x13')]);}else{logger['info'](_0x7b77('0xe'),_0x2e159f,'request\x20sent');_0x44773b(_0xa989d6['result'][_0x7b77('0x13')]);}})[_0x7b77('0x14')](function(_0x281950){logger[_0x7b77('0x11')]('Integration,\x20%s,\x20%s',_0x2e159f,_0x281950);_0xd9bf4e(_0x281950);});});} \ No newline at end of file +var _0xcac6=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcac6,0xa3));var _0x6cac=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcac6[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x6cac('0x0'));var moment=require(_0x6cac('0x1'));var BPromise=require(_0x6cac('0x2'));var rs=require(_0x6cac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6cac('0x4'));var logger=require(_0x6cac('0x5'))(_0x6cac('0x6'));var config=require(_0x6cac('0x7'));var jayson=require(_0x6cac('0x8'));var client=jayson[_0x6cac('0x9')][_0x6cac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51a850,_0x2abd7b,_0x21c42a){return new BPromise(function(_0x353359,_0xde53ae){return client[_0x6cac('0xb')](_0x51a850,_0x21c42a)['then'](function(_0x5c1dca){logger[_0x6cac('0xc')](_0x6cac('0xd'),_0x2abd7b,_0x6cac('0xe'));logger[_0x6cac('0xf')](_0x6cac('0x10'),_0x2abd7b,_0x6cac('0xe'),JSON['stringify'](_0x5c1dca));if(_0x5c1dca[_0x6cac('0x11')]){if(_0x5c1dca['error'][_0x6cac('0x12')]===0x1f4){logger[_0x6cac('0x11')](_0x6cac('0xd'),_0x2abd7b,_0x5c1dca[_0x6cac('0x11')][_0x6cac('0x13')]);return _0xde53ae(_0x5c1dca[_0x6cac('0x11')]['message']);}logger['error']('Integration,\x20%s,\x20%s',_0x2abd7b,_0x5c1dca[_0x6cac('0x11')][_0x6cac('0x13')]);return _0x353359(_0x5c1dca['error'][_0x6cac('0x13')]);}else{logger['info'](_0x6cac('0xd'),_0x2abd7b,_0x6cac('0xe'));_0x353359(_0x5c1dca['result'][_0x6cac('0x13')]);}})[_0x6cac('0x14')](function(_0x440058){logger['error'](_0x6cac('0xd'),_0x2abd7b,_0x440058);_0xde53ae(_0x440058);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 9958a4c..04d0889 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 _0xe4ef=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','/:id','post','create','put','delete','destroy','exports'];(function(_0x2bbeea,_0x279420){var _0x45e0bd=function(_0x59208f){while(--_0x59208f){_0x2bbeea['push'](_0x2bbeea['shift']());}};_0x45e0bd(++_0x279420);}(_0xe4ef,0xd1));var _0xfe4e=function(_0x3b118a,_0x52a94e){_0x3b118a=_0x3b118a-0x0;var _0x5e7430=_0xe4ef[_0x3b118a];return _0x5e7430;};'use strict';var multer=require('multer');var util=require(_0xfe4e('0x0'));var path=require(_0xfe4e('0x1'));var timeout=require(_0xfe4e('0x2'));var express=require(_0xfe4e('0x3'));var router=express[_0xfe4e('0x4')]();var fs_extra=require(_0xfe4e('0x5'));var auth=require(_0xfe4e('0x6'));var interaction=require(_0xfe4e('0x7'));var config=require(_0xfe4e('0x8'));var controller=require(_0xfe4e('0x9'));router[_0xfe4e('0xa')]('/',auth[_0xfe4e('0xb')](),controller['index']);router[_0xfe4e('0xa')]('/describe',auth[_0xfe4e('0xb')](),controller['describe']);router[_0xfe4e('0xa')](_0xfe4e('0xc'),auth[_0xfe4e('0xb')](),controller['show']);router[_0xfe4e('0xd')]('/',auth[_0xfe4e('0xb')](),controller[_0xfe4e('0xe')]);router[_0xfe4e('0xf')](_0xfe4e('0xc'),auth[_0xfe4e('0xb')](),controller['update']);router[_0xfe4e('0x10')](_0xfe4e('0xc'),auth[_0xfe4e('0xb')](),controller[_0xfe4e('0x11')]);module[_0xfe4e('0x12')]=router; \ No newline at end of file +var _0x1bbf=['express','Router','fs-extra','../../components/auth/service','./integrationReport.controller','index','get','/describe','isAuthenticated','describe','show','post','put','update','delete','exports','multer','util','path'];(function(_0x1e58cf,_0x30af86){var _0x3e4bf1=function(_0x43200e){while(--_0x43200e){_0x1e58cf['push'](_0x1e58cf['shift']());}};_0x3e4bf1(++_0x30af86);}(_0x1bbf,0x95));var _0xf1bb=function(_0x380a3f,_0x202483){_0x380a3f=_0x380a3f-0x0;var _0x2b4eca=_0x1bbf[_0x380a3f];return _0x2b4eca;};'use strict';var multer=require(_0xf1bb('0x0'));var util=require(_0xf1bb('0x1'));var path=require(_0xf1bb('0x2'));var timeout=require('connect-timeout');var express=require(_0xf1bb('0x3'));var router=express[_0xf1bb('0x4')]();var fs_extra=require(_0xf1bb('0x5'));var auth=require(_0xf1bb('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf1bb('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xf1bb('0x8')]);router[_0xf1bb('0x9')](_0xf1bb('0xa'),auth[_0xf1bb('0xb')](),controller[_0xf1bb('0xc')]);router[_0xf1bb('0x9')]('/:id',auth[_0xf1bb('0xb')](),controller[_0xf1bb('0xd')]);router[_0xf1bb('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf1bb('0xf')]('/:id',auth[_0xf1bb('0xb')](),controller[_0xf1bb('0x10')]);router[_0xf1bb('0x11')]('/:id',auth[_0xf1bb('0xb')](),controller['destroy']);module[_0xf1bb('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 61fd1d4..6382c84 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 _0x88be=['RECEIVED','sequelize','STRING','INTEGER','BOOLEAN','DATE','TEXT','ENUM','SENT','SENDING'];(function(_0x214aab,_0x392db8){var _0x1a97df=function(_0x4ca7d5){while(--_0x4ca7d5){_0x214aab['push'](_0x214aab['shift']());}};_0x1a97df(++_0x392db8);}(_0x88be,0x97));var _0xe88b=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x88be[_0x5c351c];return _0x26f3b3;};'use strict';var Sequelize=require(_0xe88b('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xe88b('0x1')]},'exitStatus':{'type':Sequelize[_0xe88b('0x1')]},'ticketId':{'type':Sequelize[_0xe88b('0x1')]},'integrationId':{'type':Sequelize[_0xe88b('0x2')]},'contacts':{'type':Sequelize[_0xe88b('0x1')]},'uniqueid':{'type':Sequelize[_0xe88b('0x1')]},'calleridnum':{'type':Sequelize[_0xe88b('0x1')]},'calleridname':{'type':Sequelize[_0xe88b('0x1')]},'queue':{'type':Sequelize[_0xe88b('0x1')]},'interface':{'type':Sequelize[_0xe88b('0x1')]},'membername':{'type':Sequelize[_0xe88b('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xe88b('0x2')]},'agentcomplete':{'type':Sequelize[_0xe88b('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xe88b('0x4')]},'talktime':{'type':Sequelize[_0xe88b('0x2')]},'agentacw':{'type':Sequelize[_0xe88b('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe88b('0x2')]},'reason':{'type':Sequelize[_0xe88b('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xe88b('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xe88b('0x4')]},'agentdump':{'type':Sequelize[_0xe88b('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xe88b('0x1')]},'channel':{'type':Sequelize[_0xe88b('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xe88b('0x1')]},'connectedlinenum':{'type':Sequelize[_0xe88b('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe88b('0x1')]},'accountcode':{'type':Sequelize[_0xe88b('0x1')]},'context':{'type':Sequelize[_0xe88b('0x1')]},'exten':{'type':Sequelize[_0xe88b('0x1')]},'priority':{'type':Sequelize[_0xe88b('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xe88b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xe88b('0x1')]},'destcalleridnum':{'type':Sequelize[_0xe88b('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xe88b('0x1')]},'destlanguage':{'type':Sequelize[_0xe88b('0x1')]},'destaccountcode':{'type':Sequelize[_0xe88b('0x1')]},'destcontext':{'type':Sequelize[_0xe88b('0x1')]},'destexten':{'type':Sequelize[_0xe88b('0x1')]},'destpriority':{'type':Sequelize[_0xe88b('0x1')]},'destuniqueid':{'type':Sequelize[_0xe88b('0x1')]},'messageId':{'type':Sequelize[_0xe88b('0x1')]},'inReplyTo':{'type':Sequelize[_0xe88b('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xe88b('0x1')]},'cc':{'type':Sequelize[_0xe88b('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xe88b('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xe88b('0x6')](_0xe88b('0x7'),_0xe88b('0x8'),_0xe88b('0x9'),'FAILED')},'url':{'type':Sequelize[_0xe88b('0x1')]},'app':{'type':Sequelize[_0xe88b('0x1')]},'appdata':{'type':Sequelize[_0xe88b('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa951=['DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','exports','STRING','INTEGER'];(function(_0x2d8335,_0xf3f592){var _0x11d709=function(_0x5c0275){while(--_0x5c0275){_0x2d8335['push'](_0x2d8335['shift']());}};_0x11d709(++_0xf3f592);}(_0xa951,0x1bf));var _0x1a95=function(_0x5bc10c,_0x26bf7d){_0x5bc10c=_0x5bc10c-0x0;var _0x3d3740=_0xa951[_0x5bc10c];return _0x3d3740;};'use strict';var Sequelize=require('sequelize');module[_0x1a95('0x0')]={'integration':{'type':Sequelize[_0x1a95('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x1a95('0x1')]},'ticketId':{'type':Sequelize[_0x1a95('0x1')]},'integrationId':{'type':Sequelize[_0x1a95('0x2')]},'contacts':{'type':Sequelize[_0x1a95('0x1')]},'uniqueid':{'type':Sequelize[_0x1a95('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1a95('0x1')]},'queue':{'type':Sequelize[_0x1a95('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1a95('0x1')]},'agentcalledAt':{'type':Sequelize[_0x1a95('0x3')]},'agentconnectAt':{'type':Sequelize[_0x1a95('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x1a95('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x1a95('0x3')]},'talktime':{'type':Sequelize[_0x1a95('0x2')]},'agentacw':{'type':Sequelize[_0x1a95('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1a95('0x2')]},'reason':{'type':Sequelize[_0x1a95('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x1a95('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x1a95('0x1')]},'channel':{'type':Sequelize[_0x1a95('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x1a95('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x1a95('0x1')]},'language':{'type':Sequelize[_0x1a95('0x1')]},'accountcode':{'type':Sequelize[_0x1a95('0x1')]},'context':{'type':Sequelize[_0x1a95('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1a95('0x1')]},'destchannel':{'type':Sequelize[_0x1a95('0x1')]},'destchannelstate':{'type':Sequelize[_0x1a95('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x1a95('0x1')]},'destcalleridnum':{'type':Sequelize[_0x1a95('0x1')]},'destcalleridname':{'type':Sequelize[_0x1a95('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x1a95('0x1')]},'destlanguage':{'type':Sequelize[_0x1a95('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x1a95('0x1')]},'destexten':{'type':Sequelize[_0x1a95('0x1')]},'destpriority':{'type':Sequelize[_0x1a95('0x1')]},'destuniqueid':{'type':Sequelize[_0x1a95('0x1')]},'messageId':{'type':Sequelize[_0x1a95('0x1')]},'inReplyTo':{'type':Sequelize[_0x1a95('0x1')]},'subject':{'type':Sequelize[_0x1a95('0x1')]},'from':{'type':Sequelize[_0x1a95('0x1')]},'to':{'type':Sequelize[_0x1a95('0x1')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x1a95('0x5')]},'text':{'type':Sequelize[_0x1a95('0x5')]},'status':{'type':Sequelize[_0x1a95('0x6')](_0x1a95('0x7'),_0x1a95('0x8'),_0x1a95('0x9'),'FAILED')},'url':{'type':Sequelize[_0x1a95('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x1a95('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 56ea027..aed93a0 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 _0xb302=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','limit','set','Content-Range','json','save','then','destroy','end','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','IntegrationReport','include','rows','show','params','includeAll','merge','find','create','update','body','catch','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x58ad8c,_0x58360e){var _0x16e88a=function(_0x43ae74){while(--_0x43ae74){_0x58ad8c['push'](_0x58ad8c['shift']());}};_0x16e88a(++_0x58360e);}(_0xb302,0x19f));var _0x2b30=function(_0x51bf25,_0x515b49){_0x51bf25=_0x51bf25-0x0;var _0x20ecca=_0xb302[_0x51bf25];return _0x20ecca;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2b30('0x0'));var jsonpatch=require(_0x2b30('0x1'));var rp=require(_0x2b30('0x2'));var moment=require(_0x2b30('0x3'));var BPromise=require(_0x2b30('0x4'));var Mustache=require(_0x2b30('0x5'));var util=require('util');var path=require(_0x2b30('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2b30('0x7'));var fs=require('fs');var fs_extra=require(_0x2b30('0x8'));var _=require('lodash');var squel=require(_0x2b30('0x9'));var crypto=require(_0x2b30('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2b30('0xb'));var toCsv=require(_0x2b30('0xc'));var querystring=require(_0x2b30('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2b30('0xe'));var qs=require(_0x2b30('0xf'));var as=require(_0x2b30('0x10'));var hardwareService=require(_0x2b30('0x11'));var logger=require('../../config/logger')(_0x2b30('0x12'));var utils=require(_0x2b30('0x13'));var config=require(_0x2b30('0x14'));var licenseUtil=require(_0x2b30('0x15'));var db=require(_0x2b30('0x16'))['db'];function respondWithStatusCode(_0x377150,_0x23fda6){_0x23fda6=_0x23fda6||0xcc;return function(_0x9e3fd1){if(_0x9e3fd1){return _0x377150['sendStatus'](_0x23fda6);}return _0x377150[_0x2b30('0x17')](_0x23fda6)['end']();};}function respondWithResult(_0x2cfa78,_0x5d0e34){_0x5d0e34=_0x5d0e34||0xc8;return function(_0x4ea95b){if(_0x4ea95b){return _0x2cfa78['status'](_0x5d0e34)['json'](_0x4ea95b);}};}function respondWithFilteredResult(_0x736db0,_0x2efe82){return function(_0x248c85){if(_0x248c85){var _0x2f3eb5=_0x248c85[_0x2b30('0x18')],_0x15037f=_0x2efe82[_0x2b30('0x19')],_0x49f0b8=_0x2efe82[_0x2b30('0x19')]+_0x2efe82[_0x2b30('0x1a')],_0x2d7d85;if(_0x49f0b8>=_0x2f3eb5){_0x49f0b8=_0x2f3eb5;_0x2d7d85=0xc8;}else{_0x2d7d85=0xce;}_0x736db0[_0x2b30('0x17')](_0x2d7d85);return _0x736db0[_0x2b30('0x1b')](_0x2b30('0x1c'),_0x15037f+'-'+_0x49f0b8+'/'+_0x2f3eb5)[_0x2b30('0x1d')](_0x248c85);}return null;};}function patchUpdates(_0x4701d7){return function(_0x408033){try{jsonpatch['apply'](_0x408033,_0x4701d7,!![]);}catch(_0x216263){return BPromise['reject'](_0x216263);}return _0x408033[_0x2b30('0x1e')]();};}function saveUpdates(_0x218fca,_0x597744){return function(_0x55ac6d){if(_0x55ac6d){return _0x55ac6d['update'](_0x218fca)[_0x2b30('0x1f')](function(_0x5ee696){return _0x5ee696;});}return null;};}function removeEntity(_0x109a4e,_0x4d27be){return function(_0x3f8ebf){if(_0x3f8ebf){return _0x3f8ebf[_0x2b30('0x20')]()[_0x2b30('0x1f')](function(){_0x109a4e['status'](0xcc)[_0x2b30('0x21')]();});}};}function handleEntityNotFound(_0x3ae439,_0x106fad){return function(_0x599e64){if(!_0x599e64){_0x3ae439[_0x2b30('0x22')](0x194);}return _0x599e64;};}function handleError(_0x6cc962,_0x4775a9){_0x4775a9=_0x4775a9||0x1f4;return function(_0x2a60e2){logger[_0x2b30('0x23')](_0x2a60e2['stack']);if(_0x2a60e2['name']){delete _0x2a60e2[_0x2b30('0x24')];}_0x6cc962[_0x2b30('0x17')](_0x4775a9)[_0x2b30('0x25')](_0x2a60e2);};}exports[_0x2b30('0x26')]=function(_0x479da7,_0x1712fb){var _0x59b06c={},_0x4c9b2f={},_0x204c6e={'count':0x0,'rows':[]};var _0x536f64=_[_0x2b30('0x27')](db['IntegrationReport'][_0x2b30('0x28')],function(_0x34beee){return{'name':_0x34beee[_0x2b30('0x29')],'type':_0x34beee[_0x2b30('0x2a')][_0x2b30('0x2b')]};});_0x4c9b2f['model']=_[_0x2b30('0x27')](_0x536f64,_0x2b30('0x24'));_0x4c9b2f[_0x2b30('0x2c')]=_[_0x2b30('0x2d')](_0x479da7['query']);_0x4c9b2f['filters']=_[_0x2b30('0x2e')](_0x4c9b2f['model'],_0x4c9b2f['query']);_0x59b06c[_0x2b30('0x2f')]=_[_0x2b30('0x2e')](_0x4c9b2f[_0x2b30('0x30')],qs[_0x2b30('0x31')](_0x479da7[_0x2b30('0x2c')]['fields']));_0x59b06c['attributes']=_0x59b06c[_0x2b30('0x2f')][_0x2b30('0x32')]?_0x59b06c[_0x2b30('0x2f')]:_0x4c9b2f[_0x2b30('0x30')];if(!_0x479da7[_0x2b30('0x2c')][_0x2b30('0x33')]('nolimit')){_0x59b06c['limit']=qs[_0x2b30('0x1a')](_0x479da7['query'][_0x2b30('0x1a')]);_0x59b06c['offset']=qs[_0x2b30('0x19')](_0x479da7[_0x2b30('0x2c')]['offset']);}_0x59b06c[_0x2b30('0x34')]=qs['sort'](_0x479da7[_0x2b30('0x2c')][_0x2b30('0x35')]);_0x59b06c[_0x2b30('0x36')]=qs[_0x2b30('0x37')](_[_0x2b30('0x38')](_0x479da7[_0x2b30('0x2c')],_0x4c9b2f[_0x2b30('0x37')]),_0x536f64);if(_0x479da7['query'][_0x2b30('0x39')]){_0x59b06c[_0x2b30('0x36')]=_['merge'](_0x59b06c[_0x2b30('0x36')],{'$or':_[_0x2b30('0x27')](_0x536f64,function(_0x5d7968){if(_0x5d7968[_0x2b30('0x2a')]!==_0x2b30('0x3a')){var _0x22b467={};_0x22b467[_0x5d7968[_0x2b30('0x24')]]={'$like':'%'+_0x479da7['query'][_0x2b30('0x39')]+'%'};return _0x22b467;}})});}_0x59b06c=_['merge']({},_0x59b06c,_0x479da7['options']);var _0x40282b={'where':_0x59b06c[_0x2b30('0x36')]};return db[_0x2b30('0x3b')][_0x2b30('0x18')](_0x40282b)[_0x2b30('0x1f')](function(_0x55396d){_0x204c6e[_0x2b30('0x18')]=_0x55396d;if(_0x479da7[_0x2b30('0x2c')]['includeAll']){_0x59b06c[_0x2b30('0x3c')]=[{'all':!![]}];}return db[_0x2b30('0x3b')]['findAll'](_0x59b06c);})[_0x2b30('0x1f')](function(_0x25e4c7){_0x204c6e[_0x2b30('0x3d')]=_0x25e4c7;return _0x204c6e;})[_0x2b30('0x1f')](respondWithFilteredResult(_0x1712fb,_0x59b06c))['catch'](handleError(_0x1712fb,null));};exports[_0x2b30('0x3e')]=function(_0x165d7b,_0x30702f){var _0x4dc674={'raw':![],'where':{'id':_0x165d7b[_0x2b30('0x3f')]['id']}},_0x1d5cdf={};_0x1d5cdf[_0x2b30('0x30')]=_[_0x2b30('0x2d')](db[_0x2b30('0x3b')][_0x2b30('0x28')]);_0x1d5cdf[_0x2b30('0x2c')]=_[_0x2b30('0x2d')](_0x165d7b[_0x2b30('0x2c')]);_0x1d5cdf[_0x2b30('0x37')]=_[_0x2b30('0x2e')](_0x1d5cdf[_0x2b30('0x30')],_0x1d5cdf[_0x2b30('0x2c')]);_0x4dc674['attributes']=_[_0x2b30('0x2e')](_0x1d5cdf[_0x2b30('0x30')],qs[_0x2b30('0x31')](_0x165d7b['query'][_0x2b30('0x31')]));_0x4dc674['attributes']=_0x4dc674[_0x2b30('0x2f')][_0x2b30('0x32')]?_0x4dc674['attributes']:_0x1d5cdf['model'];if(_0x165d7b[_0x2b30('0x2c')][_0x2b30('0x40')]){_0x4dc674['include']=[{'all':!![]}];}_0x4dc674=_[_0x2b30('0x41')]({},_0x4dc674,_0x165d7b['options']);return db[_0x2b30('0x3b')][_0x2b30('0x42')](_0x4dc674)[_0x2b30('0x1f')](handleEntityNotFound(_0x30702f,null))[_0x2b30('0x1f')](respondWithResult(_0x30702f,null))['catch'](handleError(_0x30702f,null));};exports[_0x2b30('0x43')]=function(_0x4b664b,_0x430cf3){return db[_0x2b30('0x3b')][_0x2b30('0x43')](_0x4b664b['body'],{})[_0x2b30('0x1f')](respondWithResult(_0x430cf3,0xc9))['catch'](handleError(_0x430cf3,null));};exports[_0x2b30('0x44')]=function(_0x156b15,_0x5c6dc5){if(_0x156b15[_0x2b30('0x45')]['id']){delete _0x156b15[_0x2b30('0x45')]['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x156b15[_0x2b30('0x3f')]['id']}})[_0x2b30('0x1f')](handleEntityNotFound(_0x5c6dc5,null))[_0x2b30('0x1f')](saveUpdates(_0x156b15[_0x2b30('0x45')],null))[_0x2b30('0x1f')](respondWithResult(_0x5c6dc5,null))[_0x2b30('0x46')](handleError(_0x5c6dc5,null));};exports[_0x2b30('0x20')]=function(_0x4a4330,_0x135440){return db[_0x2b30('0x3b')][_0x2b30('0x42')]({'where':{'id':_0x4a4330[_0x2b30('0x3f')]['id']}})['then'](handleEntityNotFound(_0x135440,null))[_0x2b30('0x1f')](removeEntity(_0x135440,null))['catch'](handleError(_0x135440,null));};exports[_0x2b30('0x47')]=function(_0x1ea2d3,_0x286ed4){return db[_0x2b30('0x3b')][_0x2b30('0x47')]()[_0x2b30('0x1f')](respondWithResult(_0x286ed4,null))[_0x2b30('0x46')](handleError(_0x286ed4,null));}; \ No newline at end of file +var _0xe56d=['attributes','intersection','fields','length','sort','filter','where','merge','VIRTUAL','count','include','rows','catch','show','params','includeAll','options','find','create','body','describe','eml-format','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','IntegrationReport','rawAttributes','type','model','query','keys','filters'];(function(_0x221061,_0x8cf308){var _0x336a03=function(_0x45afe8){while(--_0x45afe8){_0x221061['push'](_0x221061['shift']());}};_0x336a03(++_0x8cf308);}(_0xe56d,0x1ea));var _0xde56=function(_0x3a04ab,_0x31b9fd){_0x3a04ab=_0x3a04ab-0x0;var _0x4bff6d=_0xe56d[_0x3a04ab];return _0x4bff6d;};'use strict';var emlformat=require(_0xde56('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xde56('0x1'));var BPromise=require(_0xde56('0x2'));var Mustache=require(_0xde56('0x3'));var util=require(_0xde56('0x4'));var path=require('path');var sox=require(_0xde56('0x5'));var csv=require(_0xde56('0x6'));var ejs=require(_0xde56('0x7'));var fs=require('fs');var fs_extra=require(_0xde56('0x8'));var _=require(_0xde56('0x9'));var squel=require(_0xde56('0xa'));var crypto=require(_0xde56('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xde56('0x6'));var querystring=require(_0xde56('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xde56('0xd'));var qs=require(_0xde56('0xe'));var as=require(_0xde56('0xf'));var hardwareService=require(_0xde56('0x10'));var logger=require(_0xde56('0x11'))(_0xde56('0x12'));var utils=require(_0xde56('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xde56('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x307371,_0x302e91){_0x302e91=_0x302e91||0xcc;return function(_0x413252){if(_0x413252){return _0x307371['sendStatus'](_0x302e91);}return _0x307371[_0xde56('0x15')](_0x302e91)[_0xde56('0x16')]();};}function respondWithResult(_0x467386,_0x441b18){_0x441b18=_0x441b18||0xc8;return function(_0x2b48e5){if(_0x2b48e5){return _0x467386['status'](_0x441b18)[_0xde56('0x17')](_0x2b48e5);}};}function respondWithFilteredResult(_0xf63f92,_0x4dbe91){return function(_0x285353){if(_0x285353){var _0x1e2ac9=_0x285353['count'],_0x53a2fa=_0x4dbe91[_0xde56('0x18')],_0x235e01=_0x4dbe91[_0xde56('0x18')]+_0x4dbe91[_0xde56('0x19')],_0x24fc87;if(_0x235e01>=_0x1e2ac9){_0x235e01=_0x1e2ac9;_0x24fc87=0xc8;}else{_0x24fc87=0xce;}_0xf63f92[_0xde56('0x15')](_0x24fc87);return _0xf63f92[_0xde56('0x1a')](_0xde56('0x1b'),_0x53a2fa+'-'+_0x235e01+'/'+_0x1e2ac9)['json'](_0x285353);}return null;};}function patchUpdates(_0x1d1d9e){return function(_0x2d7415){try{jsonpatch[_0xde56('0x1c')](_0x2d7415,_0x1d1d9e,!![]);}catch(_0x52b6d4){return BPromise['reject'](_0x52b6d4);}return _0x2d7415[_0xde56('0x1d')]();};}function saveUpdates(_0x257698,_0x174743){return function(_0x10c9ca){if(_0x10c9ca){return _0x10c9ca[_0xde56('0x1e')](_0x257698)[_0xde56('0x1f')](function(_0x471a23){return _0x471a23;});}return null;};}function removeEntity(_0x1a3eb6,_0x3d16b5){return function(_0x42398c){if(_0x42398c){return _0x42398c[_0xde56('0x20')]()[_0xde56('0x1f')](function(){_0x1a3eb6[_0xde56('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x373a5b,_0x1a3dc7){return function(_0x11f48d){if(!_0x11f48d){_0x373a5b[_0xde56('0x21')](0x194);}return _0x11f48d;};}function handleError(_0x24eacf,_0x1cc5cb){_0x1cc5cb=_0x1cc5cb||0x1f4;return function(_0x1a7ab9){logger['error'](_0x1a7ab9[_0xde56('0x22')]);if(_0x1a7ab9[_0xde56('0x23')]){delete _0x1a7ab9[_0xde56('0x23')];}_0x24eacf[_0xde56('0x15')](_0x1cc5cb)[_0xde56('0x24')](_0x1a7ab9);};}exports[_0xde56('0x25')]=function(_0x57c1c8,_0x4f5c5e){var _0x3206d7={},_0x1bcb3f={},_0x474be3={'count':0x0,'rows':[]};var _0x559f50=_[_0xde56('0x26')](db[_0xde56('0x27')][_0xde56('0x28')],function(_0x53a22c){return{'name':_0x53a22c['fieldName'],'type':_0x53a22c[_0xde56('0x29')]['key']};});_0x1bcb3f[_0xde56('0x2a')]=_[_0xde56('0x26')](_0x559f50,_0xde56('0x23'));_0x1bcb3f[_0xde56('0x2b')]=_[_0xde56('0x2c')](_0x57c1c8[_0xde56('0x2b')]);_0x1bcb3f[_0xde56('0x2d')]=_['intersection'](_0x1bcb3f[_0xde56('0x2a')],_0x1bcb3f['query']);_0x3206d7[_0xde56('0x2e')]=_[_0xde56('0x2f')](_0x1bcb3f[_0xde56('0x2a')],qs[_0xde56('0x30')](_0x57c1c8['query'][_0xde56('0x30')]));_0x3206d7[_0xde56('0x2e')]=_0x3206d7[_0xde56('0x2e')][_0xde56('0x31')]?_0x3206d7[_0xde56('0x2e')]:_0x1bcb3f[_0xde56('0x2a')];if(!_0x57c1c8[_0xde56('0x2b')]['hasOwnProperty']('nolimit')){_0x3206d7[_0xde56('0x19')]=qs[_0xde56('0x19')](_0x57c1c8[_0xde56('0x2b')]['limit']);_0x3206d7[_0xde56('0x18')]=qs[_0xde56('0x18')](_0x57c1c8['query'][_0xde56('0x18')]);}_0x3206d7['order']=qs['sort'](_0x57c1c8[_0xde56('0x2b')][_0xde56('0x32')]);_0x3206d7['where']=qs['filters'](_['pick'](_0x57c1c8[_0xde56('0x2b')],_0x1bcb3f[_0xde56('0x2d')]),_0x559f50);if(_0x57c1c8[_0xde56('0x2b')][_0xde56('0x33')]){_0x3206d7[_0xde56('0x34')]=_[_0xde56('0x35')](_0x3206d7['where'],{'$or':_[_0xde56('0x26')](_0x559f50,function(_0x5970ac){if(_0x5970ac['type']!==_0xde56('0x36')){var _0x25431c={};_0x25431c[_0x5970ac['name']]={'$like':'%'+_0x57c1c8[_0xde56('0x2b')]['filter']+'%'};return _0x25431c;}})});}_0x3206d7=_['merge']({},_0x3206d7,_0x57c1c8['options']);var _0xef00b={'where':_0x3206d7[_0xde56('0x34')]};return db['IntegrationReport'][_0xde56('0x37')](_0xef00b)[_0xde56('0x1f')](function(_0x142528){_0x474be3[_0xde56('0x37')]=_0x142528;if(_0x57c1c8[_0xde56('0x2b')]['includeAll']){_0x3206d7[_0xde56('0x38')]=[{'all':!![]}];}return db[_0xde56('0x27')]['findAll'](_0x3206d7);})['then'](function(_0x11edf9){_0x474be3[_0xde56('0x39')]=_0x11edf9;return _0x474be3;})[_0xde56('0x1f')](respondWithFilteredResult(_0x4f5c5e,_0x3206d7))[_0xde56('0x3a')](handleError(_0x4f5c5e,null));};exports[_0xde56('0x3b')]=function(_0x1726bc,_0x3a42c1){var _0x52dd17={'raw':![],'where':{'id':_0x1726bc[_0xde56('0x3c')]['id']}},_0x225f1f={};_0x225f1f['model']=_['keys'](db[_0xde56('0x27')]['rawAttributes']);_0x225f1f[_0xde56('0x2b')]=_['keys'](_0x1726bc[_0xde56('0x2b')]);_0x225f1f[_0xde56('0x2d')]=_[_0xde56('0x2f')](_0x225f1f[_0xde56('0x2a')],_0x225f1f['query']);_0x52dd17['attributes']=_[_0xde56('0x2f')](_0x225f1f[_0xde56('0x2a')],qs[_0xde56('0x30')](_0x1726bc[_0xde56('0x2b')][_0xde56('0x30')]));_0x52dd17[_0xde56('0x2e')]=_0x52dd17[_0xde56('0x2e')][_0xde56('0x31')]?_0x52dd17[_0xde56('0x2e')]:_0x225f1f['model'];if(_0x1726bc[_0xde56('0x2b')][_0xde56('0x3d')]){_0x52dd17[_0xde56('0x38')]=[{'all':!![]}];}_0x52dd17=_[_0xde56('0x35')]({},_0x52dd17,_0x1726bc[_0xde56('0x3e')]);return db[_0xde56('0x27')][_0xde56('0x3f')](_0x52dd17)[_0xde56('0x1f')](handleEntityNotFound(_0x3a42c1,null))[_0xde56('0x1f')](respondWithResult(_0x3a42c1,null))['catch'](handleError(_0x3a42c1,null));};exports[_0xde56('0x40')]=function(_0x228230,_0x189598){return db['IntegrationReport']['create'](_0x228230[_0xde56('0x41')],{})[_0xde56('0x1f')](respondWithResult(_0x189598,0xc9))[_0xde56('0x3a')](handleError(_0x189598,null));};exports[_0xde56('0x1e')]=function(_0x3cc175,_0x207cb2){if(_0x3cc175[_0xde56('0x41')]['id']){delete _0x3cc175['body']['id'];}return db[_0xde56('0x27')][_0xde56('0x3f')]({'where':{'id':_0x3cc175[_0xde56('0x3c')]['id']}})[_0xde56('0x1f')](handleEntityNotFound(_0x207cb2,null))[_0xde56('0x1f')](saveUpdates(_0x3cc175[_0xde56('0x41')],null))[_0xde56('0x1f')](respondWithResult(_0x207cb2,null))[_0xde56('0x3a')](handleError(_0x207cb2,null));};exports[_0xde56('0x20')]=function(_0xd2af5d,_0x26b739){return db['IntegrationReport'][_0xde56('0x3f')]({'where':{'id':_0xd2af5d[_0xde56('0x3c')]['id']}})[_0xde56('0x1f')](handleEntityNotFound(_0x26b739,null))[_0xde56('0x1f')](removeEntity(_0x26b739,null))[_0xde56('0x3a')](handleError(_0x26b739,null));};exports[_0xde56('0x42')]=function(_0x2ddfbd,_0x17ca34){return db['IntegrationReport'][_0xde56('0x42')]()['then'](respondWithResult(_0x17ca34,null))['catch'](handleError(_0x17ca34,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 5d8498b..8c39fd9 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 _0xc4bd=['IntegrationReport','report_integration','util','../../config/logger','api','moment','bluebird','request-promise','path','./integrationReport.attributes','exports'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xc4bd,0x7b));var _0xdc4b=function(_0x4483ee,_0x539b44){_0x4483ee=_0x4483ee-0x0;var _0x4affb5=_0xc4bd[_0x4483ee];return _0x4affb5;};'use strict';var _=require('lodash');var util=require(_0xdc4b('0x0'));var logger=require(_0xdc4b('0x1'))(_0xdc4b('0x2'));var moment=require(_0xdc4b('0x3'));var BPromise=require(_0xdc4b('0x4'));var rp=require(_0xdc4b('0x5'));var fs=require('fs');var path=require(_0xdc4b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdc4b('0x7'));module[_0xdc4b('0x8')]=function(_0x5f3b8d,_0xd47151){return _0x5f3b8d['define'](_0xdc4b('0x9'),attributes,{'tableName':_0xdc4b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x350a=['exports','define','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x4fa609,_0x24ba3a){var _0x4e9e3c=function(_0x165102){while(--_0x165102){_0x4fa609['push'](_0x4fa609['shift']());}};_0x4e9e3c(++_0x24ba3a);}(_0x350a,0x16a));var _0xa350=function(_0x21b359,_0x4dc80e){_0x21b359=_0x21b359-0x0;var _0x57b8e7=_0x350a[_0x21b359];return _0x57b8e7;};'use strict';var _=require(_0xa350('0x0'));var util=require(_0xa350('0x1'));var logger=require(_0xa350('0x2'))(_0xa350('0x3'));var moment=require('moment');var BPromise=require(_0xa350('0x4'));var rp=require(_0xa350('0x5'));var fs=require('fs');var path=require(_0xa350('0x6'));var rimraf=require(_0xa350('0x7'));var config=require(_0xa350('0x8'));var attributes=require(_0xa350('0x9'));module[_0xa350('0xa')]=function(_0x566f2f,_0xe941c0){return _0x566f2f[_0xa350('0xb')]('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index bd08641..f5c3c86 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 _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(_0x291d3f,_0x3ef99f){var _0x242080=function(_0x257705){while(--_0x257705){_0x291d3f['push'](_0x291d3f['shift']());}};_0x242080(++_0x3ef99f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'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 +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(_0x583aa3,_0x16854){var _0x37a92c=function(_0x1a6259){while(--_0x1a6259){_0x583aa3['push'](_0x583aa3['shift']());}};_0x37a92c(++_0x16854);}(_0x14a0,0x8e));var _0x014a=function(_0x1dddaf,_0x2516d8){_0x1dddaf=_0x1dddaf-0x0;var _0x40c7cf=_0x14a0[_0x1dddaf];return _0x40c7cf;};'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 diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 1a6ec50..75ccbbc 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 _0xfe52=['/:id','show','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xfe52,0x1c1));var _0x2fe5=function(_0x2929f0,_0x8bb756){_0x2929f0=_0x2929f0-0x0;var _0x599e5d=_0xfe52[_0x2929f0];return _0x599e5d;};'use strict';var multer=require(_0x2fe5('0x0'));var util=require(_0x2fe5('0x1'));var path=require(_0x2fe5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2fe5('0x3')]();var fs_extra=require(_0x2fe5('0x4'));var auth=require(_0x2fe5('0x5'));var interaction=require(_0x2fe5('0x6'));var config=require(_0x2fe5('0x7'));var controller=require('./interval.controller');router[_0x2fe5('0x8')]('/',auth[_0x2fe5('0x9')](),controller[_0x2fe5('0xa')]);router[_0x2fe5('0x8')](_0x2fe5('0xb'),auth['isAuthenticated'](),controller[_0x2fe5('0xc')]);router[_0x2fe5('0x8')](_0x2fe5('0xd'),auth[_0x2fe5('0x9')](),controller[_0x2fe5('0xe')]);router[_0x2fe5('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2fe5('0xf')](_0x2fe5('0xd'),auth[_0x2fe5('0x9')](),controller[_0x2fe5('0x10')]);router['post'](_0x2fe5('0x11'),auth['isAuthenticated'](),controller[_0x2fe5('0x12')]);router[_0x2fe5('0x13')](_0x2fe5('0xb'),auth[_0x2fe5('0x9')](),controller['update']);router[_0x2fe5('0x14')](_0x2fe5('0xb'),auth[_0x2fe5('0x9')](),controller[_0x2fe5('0x15')]);module[_0x2fe5('0x16')]=router; \ No newline at end of file +var _0xc5cc=['../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','/:id','isAuthenticated','/:id/sub_intervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','destroy','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x3c5bff,_0x3ba4d2){var _0x4789f3=function(_0x24745c){while(--_0x24745c){_0x3c5bff['push'](_0x3c5bff['shift']());}};_0x4789f3(++_0x3ba4d2);}(_0xc5cc,0x86));var _0xcc5c=function(_0x201c34,_0x3ced43){_0x201c34=_0x201c34-0x0;var _0xd87aea=_0xc5cc[_0x201c34];return _0xd87aea;};'use strict';var multer=require(_0xcc5c('0x0'));var util=require(_0xcc5c('0x1'));var path=require(_0xcc5c('0x2'));var timeout=require(_0xcc5c('0x3'));var express=require('express');var router=express[_0xcc5c('0x4')]();var fs_extra=require(_0xcc5c('0x5'));var auth=require(_0xcc5c('0x6'));var interaction=require(_0xcc5c('0x7'));var config=require(_0xcc5c('0x8'));var controller=require(_0xcc5c('0x9'));router[_0xcc5c('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcc5c('0xa')](_0xcc5c('0xb'),auth[_0xcc5c('0xc')](),controller['show']);router[_0xcc5c('0xa')](_0xcc5c('0xd'),auth[_0xcc5c('0xc')](),controller['getIntervals']);router[_0xcc5c('0xe')]('/',auth[_0xcc5c('0xc')](),controller[_0xcc5c('0xf')]);router['post'](_0xcc5c('0xd'),auth['isAuthenticated'](),controller[_0xcc5c('0x10')]);router['post'](_0xcc5c('0x11'),auth[_0xcc5c('0xc')](),controller[_0xcc5c('0x12')]);router['put'](_0xcc5c('0xb'),auth[_0xcc5c('0xc')](),controller['update']);router['delete'](_0xcc5c('0xb'),auth[_0xcc5c('0xc')](),controller[_0xcc5c('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 93b77a0..f61cefb 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 _0x0c6b=['STRING','exports'];(function(_0x4cc8dc,_0xf53b71){var _0x2cc092=function(_0x3c971d){while(--_0x3c971d){_0x4cc8dc['push'](_0x4cc8dc['shift']());}};_0x2cc092(++_0xf53b71);}(_0x0c6b,0x1d5));var _0xb0c6=function(_0x203f51,_0x306814){_0x203f51=_0x203f51-0x0;var _0x5b8836=_0x0c6b[_0x203f51];return _0x5b8836;};'use strict';var Sequelize=require('sequelize');module[_0xb0c6('0x0')]={'name':{'type':Sequelize[_0xb0c6('0x1')]},'description':{'type':Sequelize[_0xb0c6('0x1')]},'interval':{'type':Sequelize[_0xb0c6('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x398b=['STRING','sequelize','exports'];(function(_0x4ac5c1,_0x12f4bc){var _0x17c632=function(_0x5a586c){while(--_0x5a586c){_0x4ac5c1['push'](_0x4ac5c1['shift']());}};_0x17c632(++_0x12f4bc);}(_0x398b,0x1ed));var _0xb398=function(_0x4b256a,_0x154505){_0x4b256a=_0x4b256a-0x0;var _0x14ca6f=_0x398b[_0x4b256a];return _0x14ca6f;};'use strict';var Sequelize=require(_0xb398('0x0'));module[_0xb398('0x1')]={'name':{'type':Sequelize[_0xb398('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb398('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 76a30a9..1e521a0 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 _0xd824=['rows','catch','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','findOne','addIntervals','sequelize','IntervalId','bulkCreate','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../components/extensions/rewrite','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','get','Intervals','UserProfileResource','sendStatus','stack','name','index','map','rawAttributes','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','Interval','findAll'];(function(_0x31a119,_0x17e6ca){var _0x2d6e6a=function(_0x3faa80){while(--_0x3faa80){_0x31a119['push'](_0x31a119['shift']());}};_0x2d6e6a(++_0x17e6ca);}(_0xd824,0xc2));var _0x4d82=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd824[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x4d82('0x0'));var rimraf=require(_0x4d82('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4d82('0x2'));var moment=require(_0x4d82('0x3'));var BPromise=require(_0x4d82('0x4'));var Mustache=require(_0x4d82('0x5'));var util=require(_0x4d82('0x6'));var path=require(_0x4d82('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4d82('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4d82('0x9'));var crypto=require(_0x4d82('0xa'));var jsforce=require(_0x4d82('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4d82('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d82('0xd'));var authService=require(_0x4d82('0xe'));var qs=require(_0x4d82('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d82('0x10'));var logger=require('../../config/logger')(_0x4d82('0x11'));var utils=require(_0x4d82('0x12'));var config=require(_0x4d82('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require(_0x4d82('0x14'));function respondWithStatusCode(_0x248eed,_0x319ba8){_0x319ba8=_0x319ba8||0xcc;return function(_0x32e91a){if(_0x32e91a){return _0x248eed['sendStatus'](_0x319ba8);}return _0x248eed[_0x4d82('0x15')](_0x319ba8)[_0x4d82('0x16')]();};}function respondWithResult(_0x41f5b2,_0x486152){_0x486152=_0x486152||0xc8;return function(_0x70c598){if(_0x70c598){return _0x41f5b2['status'](_0x486152)[_0x4d82('0x17')](_0x70c598);}};}function respondWithFilteredResult(_0x5012db,_0x469e09){return function(_0x496f3b){if(_0x496f3b){var _0x474acf=_0x496f3b[_0x4d82('0x18')],_0xb1640d=_0x469e09[_0x4d82('0x19')],_0x461476=_0x469e09[_0x4d82('0x19')]+_0x469e09[_0x4d82('0x1a')],_0x1846e0;if(_0x461476>=_0x474acf){_0x461476=_0x474acf;_0x1846e0=0xc8;}else{_0x1846e0=0xce;}_0x5012db[_0x4d82('0x15')](_0x1846e0);return _0x5012db['set'](_0x4d82('0x1b'),_0xb1640d+'-'+_0x461476+'/'+_0x474acf)[_0x4d82('0x17')](_0x496f3b);}return null;};}function patchUpdates(_0x1b1e39){return function(_0x259055){try{jsonpatch[_0x4d82('0x1c')](_0x259055,_0x1b1e39,!![]);}catch(_0xd5f47){return BPromise[_0x4d82('0x1d')](_0xd5f47);}return _0x259055[_0x4d82('0x1e')]();};}function saveUpdates(_0x19832f,_0x35c56e){return function(_0xf2f5a5){if(_0xf2f5a5){return _0xf2f5a5['update'](_0x19832f)[_0x4d82('0x1f')](function(_0x748ee7){return _0x748ee7;});}return null;};}function removeEntity(_0x5e5bdf,_0x1a419f){return function(_0x41f194){if(_0x41f194){return _0x41f194[_0x4d82('0x20')]()[_0x4d82('0x1f')](function(){var _0xe17d70=_0x41f194[_0x4d82('0x21')]({'plain':!![]});var _0x11c043=_0x4d82('0x22');return db[_0x4d82('0x23')][_0x4d82('0x20')]({'where':{'type':_0x11c043,'resourceId':_0xe17d70['id']}})[_0x4d82('0x1f')](function(){return _0x41f194;});})[_0x4d82('0x1f')](function(){_0x5e5bdf[_0x4d82('0x15')](0xcc)[_0x4d82('0x16')]();});}};}function handleEntityNotFound(_0x1940ef,_0x4af6da){return function(_0x5e0b03){if(!_0x5e0b03){_0x1940ef[_0x4d82('0x24')](0x194);}return _0x5e0b03;};}function handleError(_0x2548de,_0x2a0572){_0x2a0572=_0x2a0572||0x1f4;return function(_0x3348d9){logger['error'](_0x3348d9[_0x4d82('0x25')]);if(_0x3348d9[_0x4d82('0x26')]){delete _0x3348d9[_0x4d82('0x26')];}_0x2548de[_0x4d82('0x15')](_0x2a0572)['send'](_0x3348d9);};}exports[_0x4d82('0x27')]=function(_0x4a7444,_0x4d9ac4){var _0x487581={},_0x52533b={},_0x3d2229={'count':0x0,'rows':[]};var _0x8cfbf1=_[_0x4d82('0x28')](db['Interval'][_0x4d82('0x29')],function(_0x37cdc4){return{'name':_0x37cdc4['fieldName'],'type':_0x37cdc4['type'][_0x4d82('0x2a')]};});_0x52533b[_0x4d82('0x2b')]=_[_0x4d82('0x28')](_0x8cfbf1,_0x4d82('0x26'));_0x52533b['query']=_[_0x4d82('0x2c')](_0x4a7444['query']);_0x52533b[_0x4d82('0x2d')]=_[_0x4d82('0x2e')](_0x52533b['model'],_0x52533b['query']);_0x487581[_0x4d82('0x2f')]=_[_0x4d82('0x2e')](_0x52533b[_0x4d82('0x2b')],qs[_0x4d82('0x30')](_0x4a7444[_0x4d82('0x31')][_0x4d82('0x30')]));_0x487581[_0x4d82('0x2f')]=_0x487581[_0x4d82('0x2f')][_0x4d82('0x32')]?_0x487581[_0x4d82('0x2f')]:_0x52533b['model'];if(!_0x4a7444[_0x4d82('0x31')][_0x4d82('0x33')](_0x4d82('0x34'))){_0x487581['limit']=qs[_0x4d82('0x1a')](_0x4a7444[_0x4d82('0x31')]['limit']);_0x487581[_0x4d82('0x19')]=qs[_0x4d82('0x19')](_0x4a7444[_0x4d82('0x31')]['offset']);}_0x487581[_0x4d82('0x35')]=qs[_0x4d82('0x36')](_0x4a7444['query'][_0x4d82('0x36')]);_0x487581['where']=qs[_0x4d82('0x2d')](_[_0x4d82('0x37')](_0x4a7444['query'],_0x52533b[_0x4d82('0x2d')]),_0x8cfbf1);if(_0x4a7444['query'][_0x4d82('0x38')]){_0x487581['where']=_['merge'](_0x487581[_0x4d82('0x39')],{'$or':_['map'](_0x8cfbf1,function(_0x2528d7){if(_0x2528d7['type']!==_0x4d82('0x3a')){var _0x330cf4={};_0x330cf4[_0x2528d7['name']]={'$like':'%'+_0x4a7444[_0x4d82('0x31')]['filter']+'%'};return _0x330cf4;}})});}_0x487581=_[_0x4d82('0x3b')]({},_0x487581,_0x4a7444[_0x4d82('0x3c')]);var _0x4ff859={'where':_0x487581[_0x4d82('0x39')]};return db['Interval'][_0x4d82('0x18')](_0x4ff859)[_0x4d82('0x1f')](function(_0x25b5e2){_0x3d2229[_0x4d82('0x18')]=_0x25b5e2;if(_0x4a7444[_0x4d82('0x31')][_0x4d82('0x3d')]){_0x487581['include']=[{'all':!![]}];}return db[_0x4d82('0x3e')][_0x4d82('0x3f')](_0x487581);})[_0x4d82('0x1f')](function(_0x3e29a6){_0x3d2229[_0x4d82('0x40')]=_0x3e29a6;return _0x3d2229;})[_0x4d82('0x1f')](respondWithFilteredResult(_0x4d9ac4,_0x487581))[_0x4d82('0x41')](handleError(_0x4d9ac4,null));};exports['show']=function(_0x3c80d6,_0x17b624){var _0x3795eb={'raw':!![],'where':{'id':_0x3c80d6[_0x4d82('0x42')]['id']}},_0x28fe4a={};_0x28fe4a['model']=_[_0x4d82('0x2c')](db[_0x4d82('0x3e')][_0x4d82('0x29')]);_0x28fe4a[_0x4d82('0x31')]=_[_0x4d82('0x2c')](_0x3c80d6[_0x4d82('0x31')]);_0x28fe4a[_0x4d82('0x2d')]=_['intersection'](_0x28fe4a[_0x4d82('0x2b')],_0x28fe4a[_0x4d82('0x31')]);_0x3795eb['attributes']=_[_0x4d82('0x2e')](_0x28fe4a['model'],qs[_0x4d82('0x30')](_0x3c80d6[_0x4d82('0x31')]['fields']));_0x3795eb[_0x4d82('0x2f')]=_0x3795eb[_0x4d82('0x2f')]['length']?_0x3795eb[_0x4d82('0x2f')]:_0x28fe4a[_0x4d82('0x2b')];if(_0x3c80d6[_0x4d82('0x31')]['includeAll']){_0x3795eb[_0x4d82('0x43')]=[{'all':!![]}];}_0x3795eb=_[_0x4d82('0x3b')]({},_0x3795eb,_0x3c80d6['options']);return db['Interval'][_0x4d82('0x44')](_0x3795eb)[_0x4d82('0x1f')](handleEntityNotFound(_0x17b624,null))[_0x4d82('0x1f')](respondWithResult(_0x17b624,null))[_0x4d82('0x41')](handleError(_0x17b624,null));};exports[_0x4d82('0x45')]=function(_0x2c6708,_0x21faf4){return db['Interval'][_0x4d82('0x45')](_0x2c6708[_0x4d82('0x46')],{})[_0x4d82('0x1f')](function(_0x234ce3){var _0x50a85f=_0x2c6708['user']['get']({'plain':!![]});if(!_0x50a85f)throw new Error(_0x4d82('0x47'));if(_0x50a85f[_0x4d82('0x48')]===_0x4d82('0x49')){var _0x34a08b=_0x234ce3[_0x4d82('0x21')]({'plain':!![]});var _0x2b604d='Intervals';return db[_0x4d82('0x4a')][_0x4d82('0x44')]({'where':{'name':_0x2b604d,'userProfileId':_0x50a85f[_0x4d82('0x4b')]},'raw':!![]})[_0x4d82('0x1f')](function(_0x3919e5){if(_0x3919e5&&_0x3919e5[_0x4d82('0x4c')]===0x0){return db[_0x4d82('0x23')][_0x4d82('0x45')]({'name':_0x34a08b[_0x4d82('0x26')],'resourceId':_0x34a08b['id'],'type':_0x3919e5['name'],'sectionId':_0x3919e5['id']},{})[_0x4d82('0x1f')](function(){return _0x234ce3;});}else{return _0x234ce3;}})[_0x4d82('0x41')](function(_0x1822db){logger[_0x4d82('0x4d')](_0x4d82('0x4e'),_0x1822db);throw _0x1822db;});}return _0x234ce3;})[_0x4d82('0x1f')](respondWithResult(_0x21faf4,0xc9))['catch'](handleError(_0x21faf4,null));};exports['update']=function(_0x432414,_0x242c26){if(_0x432414[_0x4d82('0x46')]['id']){delete _0x432414[_0x4d82('0x46')]['id'];}return db[_0x4d82('0x3e')][_0x4d82('0x44')]({'where':{'id':_0x432414[_0x4d82('0x42')]['id']}})[_0x4d82('0x1f')](handleEntityNotFound(_0x242c26,null))[_0x4d82('0x1f')](saveUpdates(_0x432414[_0x4d82('0x46')],null))[_0x4d82('0x1f')](respondWithResult(_0x242c26,null))[_0x4d82('0x41')](handleError(_0x242c26,null));};exports['destroy']=function(_0xd812c9,_0x5563d8){return db['Interval'][_0x4d82('0x44')]({'where':{'id':_0xd812c9[_0x4d82('0x42')]['id']}})[_0x4d82('0x1f')](handleEntityNotFound(_0x5563d8,null))['then'](removeEntity(_0x5563d8,null))[_0x4d82('0x41')](handleError(_0x5563d8,null));};exports[_0x4d82('0x4f')]=function(_0x371a1a,_0x1625fb,_0x4aaa65){if(_0x371a1a[_0x4d82('0x46')]['id']){delete _0x371a1a[_0x4d82('0x46')]['id'];}return db[_0x4d82('0x3e')][_0x4d82('0x44')]({'where':{'id':_0x371a1a[_0x4d82('0x42')]['id']}})['then'](handleEntityNotFound(_0x1625fb,null))[_0x4d82('0x1f')](function(_0x3297ce){if(_0x3297ce){_0x371a1a[_0x4d82('0x46')]['IntervalId']=_0x3297ce['id'];return db[_0x4d82('0x3e')][_0x4d82('0x45')](_0x371a1a[_0x4d82('0x46')]);}})[_0x4d82('0x1f')](respondWithResult(_0x1625fb,null))[_0x4d82('0x41')](handleError(_0x1625fb,null));};exports[_0x4d82('0x50')]=function(_0x9a125a,_0x58b87c,_0x5dc2c7){var _0x2113b3={};var _0x419d02={};var _0x848165;var _0x56311a;return db[_0x4d82('0x3e')][_0x4d82('0x51')]({'where':{'id':_0x9a125a[_0x4d82('0x42')]['id']}})[_0x4d82('0x1f')](handleEntityNotFound(_0x58b87c,null))[_0x4d82('0x1f')](function(_0x2aec60){if(_0x2aec60){_0x848165=_0x2aec60;_0x419d02[_0x4d82('0x2b')]=_[_0x4d82('0x2c')](db[_0x4d82('0x3e')][_0x4d82('0x29')]);_0x419d02['query']=_['keys'](_0x9a125a[_0x4d82('0x31')]);_0x419d02[_0x4d82('0x2d')]=_[_0x4d82('0x2e')](_0x419d02['model'],_0x419d02[_0x4d82('0x31')]);_0x2113b3[_0x4d82('0x2f')]=_[_0x4d82('0x2e')](_0x419d02[_0x4d82('0x2b')],qs[_0x4d82('0x30')](_0x9a125a[_0x4d82('0x31')][_0x4d82('0x30')]));_0x2113b3[_0x4d82('0x2f')]=_0x2113b3['attributes'][_0x4d82('0x32')]?_0x2113b3[_0x4d82('0x2f')]:_0x419d02[_0x4d82('0x2b')];_0x2113b3['order']=qs['sort'](_0x9a125a[_0x4d82('0x31')][_0x4d82('0x36')]);_0x2113b3[_0x4d82('0x39')]=qs[_0x4d82('0x2d')](_[_0x4d82('0x37')](_0x9a125a[_0x4d82('0x31')],_0x419d02['filters']));if(_0x9a125a[_0x4d82('0x31')][_0x4d82('0x38')]){_0x2113b3[_0x4d82('0x39')]=_['merge'](_0x2113b3[_0x4d82('0x39')],{'$or':_[_0x4d82('0x28')](_0x2113b3[_0x4d82('0x2f')],function(_0x5d647c){var _0x20d3ae={};_0x20d3ae[_0x5d647c]={'$like':'%'+_0x9a125a[_0x4d82('0x31')]['filter']+'%'};return _0x20d3ae;})});}_0x2113b3=_[_0x4d82('0x3b')]({},_0x2113b3,_0x9a125a['options']);return _0x848165[_0x4d82('0x50')](_0x2113b3);}})['then'](function(_0x4a83f4){if(_0x4a83f4){_0x56311a=_0x4a83f4[_0x4d82('0x32')];if(!_0x9a125a[_0x4d82('0x31')]['hasOwnProperty'](_0x4d82('0x34'))){_0x2113b3['limit']=qs[_0x4d82('0x1a')](_0x9a125a['query'][_0x4d82('0x1a')]);_0x2113b3[_0x4d82('0x19')]=qs[_0x4d82('0x19')](_0x9a125a[_0x4d82('0x31')][_0x4d82('0x19')]);}return _0x848165[_0x4d82('0x50')](_0x2113b3);}})[_0x4d82('0x1f')](function(_0x2027a0){if(_0x2027a0){return _0x2027a0?{'count':_0x56311a,'rows':_0x2027a0}:null;}})[_0x4d82('0x1f')](respondWithResult(_0x58b87c,null))[_0x4d82('0x41')](handleError(_0x58b87c,null));};exports[_0x4d82('0x52')]=function(_0x2e60d4,_0x14d697,_0x3d5c42){return db[_0x4d82('0x3e')][_0x4d82('0x51')]({'where':{'id':_0x2e60d4[_0x4d82('0x42')]['id']}})[_0x4d82('0x1f')](handleEntityNotFound(_0x14d697,null))['then'](function(_0x504dea){if(_0x504dea){return db[_0x4d82('0x53')]['transaction'](function(_0x6081ce){return db[_0x4d82('0x3e')][_0x4d82('0x20')]({'where':{'IntervalId':_0x2e60d4[_0x4d82('0x42')]['id']},'transaction':_0x6081ce})[_0x4d82('0x1f')](function(_0x1a6938){var _0x5ddcc0=_[_0x4d82('0x28')](_0x2e60d4[_0x4d82('0x46')],function(_0x554778){delete _0x554778['id'];_0x554778[_0x4d82('0x54')]=_0x2e60d4[_0x4d82('0x42')]['id'];return _0x554778;});return db[_0x4d82('0x3e')][_0x4d82('0x55')](_0x5ddcc0,{'transaction':_0x6081ce});});})[_0x4d82('0x1f')](function(){return db[_0x4d82('0x3e')][_0x4d82('0x3f')]({'where':{'IntervalId':_0x2e60d4[_0x4d82('0x42')]['id']}});});}})['then'](respondWithResult(_0x14d697,null))['catch'](handleError(_0x14d697,null));}; \ No newline at end of file +var _0xd4a2=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','IntervalId','findOne','hasOwnProperty','getIntervals','addIntervals','sequelize','transaction','bulkCreate','eml-format','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','count','offset','limit','apply','reject','update','then','get','Intervals','UserProfileResource','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','filter','options','Interval','includeAll','include','findAll','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xd4a2,0x173));var _0x2d4a=function(_0x22f84d,_0xea2603){_0x22f84d=_0x22f84d-0x0;var _0x32b112=_0xd4a2[_0x22f84d];return _0x32b112;};'use strict';var emlformat=require(_0x2d4a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2d4a('0x1'));var rp=require('request-promise');var moment=require(_0x2d4a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2d4a('0x3'));var util=require('util');var path=require(_0x2d4a('0x4'));var sox=require(_0x2d4a('0x5'));var csv=require(_0x2d4a('0x6'));var ejs=require(_0x2d4a('0x7'));var fs=require('fs');var fs_extra=require(_0x2d4a('0x8'));var _=require('lodash');var squel=require(_0x2d4a('0x9'));var crypto=require(_0x2d4a('0xa'));var jsforce=require(_0x2d4a('0xb'));var deskjs=require(_0x2d4a('0xc'));var toCsv=require(_0x2d4a('0x6'));var querystring=require(_0x2d4a('0xd'));var Papa=require(_0x2d4a('0xe'));var Redis=require(_0x2d4a('0xf'));var authService=require(_0x2d4a('0x10'));var qs=require(_0x2d4a('0x11'));var as=require(_0x2d4a('0x12'));var hardwareService=require(_0x2d4a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2d4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2d4a('0x15'));var db=require(_0x2d4a('0x16'))['db'];var extensions=require(_0x2d4a('0x17'));function respondWithStatusCode(_0x5ac803,_0x2f785f){_0x2f785f=_0x2f785f||0xcc;return function(_0x3341e3){if(_0x3341e3){return _0x5ac803[_0x2d4a('0x18')](_0x2f785f);}return _0x5ac803[_0x2d4a('0x19')](_0x2f785f)['end']();};}function respondWithResult(_0x4be8b4,_0x2a1d0f){_0x2a1d0f=_0x2a1d0f||0xc8;return function(_0x5b6c4f){if(_0x5b6c4f){return _0x4be8b4[_0x2d4a('0x19')](_0x2a1d0f)[_0x2d4a('0x1a')](_0x5b6c4f);}};}function respondWithFilteredResult(_0x11896d,_0x3a3156){return function(_0x4c5287){if(_0x4c5287){var _0x5f825d=_0x4c5287[_0x2d4a('0x1b')],_0x5a6378=_0x3a3156[_0x2d4a('0x1c')],_0x2838fa=_0x3a3156[_0x2d4a('0x1c')]+_0x3a3156[_0x2d4a('0x1d')],_0x4802f0;if(_0x2838fa>=_0x5f825d){_0x2838fa=_0x5f825d;_0x4802f0=0xc8;}else{_0x4802f0=0xce;}_0x11896d['status'](_0x4802f0);return _0x11896d['set']('Content-Range',_0x5a6378+'-'+_0x2838fa+'/'+_0x5f825d)[_0x2d4a('0x1a')](_0x4c5287);}return null;};}function patchUpdates(_0x1966d1){return function(_0x321a33){try{jsonpatch[_0x2d4a('0x1e')](_0x321a33,_0x1966d1,!![]);}catch(_0x46c331){return BPromise[_0x2d4a('0x1f')](_0x46c331);}return _0x321a33['save']();};}function saveUpdates(_0x49f378,_0x3eabe5){return function(_0x1f3e17){if(_0x1f3e17){return _0x1f3e17[_0x2d4a('0x20')](_0x49f378)[_0x2d4a('0x21')](function(_0x1a2d20){return _0x1a2d20;});}return null;};}function removeEntity(_0x2e7736,_0x22dd0b){return function(_0xa43fb1){if(_0xa43fb1){return _0xa43fb1['destroy']()[_0x2d4a('0x21')](function(){var _0x3240a2=_0xa43fb1[_0x2d4a('0x22')]({'plain':!![]});var _0x42d813=_0x2d4a('0x23');return db[_0x2d4a('0x24')][_0x2d4a('0x25')]({'where':{'type':_0x42d813,'resourceId':_0x3240a2['id']}})[_0x2d4a('0x21')](function(){return _0xa43fb1;});})['then'](function(){_0x2e7736['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bb9f0,_0x5029f3){return function(_0x410f7d){if(!_0x410f7d){_0x2bb9f0[_0x2d4a('0x18')](0x194);}return _0x410f7d;};}function handleError(_0x3d5558,_0x1d2fa6){_0x1d2fa6=_0x1d2fa6||0x1f4;return function(_0x13e769){logger[_0x2d4a('0x26')](_0x13e769[_0x2d4a('0x27')]);if(_0x13e769[_0x2d4a('0x28')]){delete _0x13e769['name'];}_0x3d5558[_0x2d4a('0x19')](_0x1d2fa6)['send'](_0x13e769);};}exports[_0x2d4a('0x29')]=function(_0x9bac28,_0xc497ce){var _0x20b87d={},_0x101382={},_0x1dfc5d={'count':0x0,'rows':[]};var _0x25ac5c=_[_0x2d4a('0x2a')](db['Interval'][_0x2d4a('0x2b')],function(_0x3d94b7){return{'name':_0x3d94b7[_0x2d4a('0x2c')],'type':_0x3d94b7[_0x2d4a('0x2d')][_0x2d4a('0x2e')]};});_0x101382['model']=_[_0x2d4a('0x2a')](_0x25ac5c,_0x2d4a('0x28'));_0x101382[_0x2d4a('0x2f')]=_[_0x2d4a('0x30')](_0x9bac28[_0x2d4a('0x2f')]);_0x101382['filters']=_[_0x2d4a('0x31')](_0x101382[_0x2d4a('0x32')],_0x101382[_0x2d4a('0x2f')]);_0x20b87d[_0x2d4a('0x33')]=_[_0x2d4a('0x31')](_0x101382[_0x2d4a('0x32')],qs['fields'](_0x9bac28[_0x2d4a('0x2f')][_0x2d4a('0x34')]));_0x20b87d[_0x2d4a('0x33')]=_0x20b87d[_0x2d4a('0x33')][_0x2d4a('0x35')]?_0x20b87d['attributes']:_0x101382[_0x2d4a('0x32')];if(!_0x9bac28[_0x2d4a('0x2f')]['hasOwnProperty'](_0x2d4a('0x36'))){_0x20b87d[_0x2d4a('0x1d')]=qs[_0x2d4a('0x1d')](_0x9bac28[_0x2d4a('0x2f')][_0x2d4a('0x1d')]);_0x20b87d[_0x2d4a('0x1c')]=qs['offset'](_0x9bac28[_0x2d4a('0x2f')][_0x2d4a('0x1c')]);}_0x20b87d[_0x2d4a('0x37')]=qs[_0x2d4a('0x38')](_0x9bac28[_0x2d4a('0x2f')][_0x2d4a('0x38')]);_0x20b87d['where']=qs['filters'](_[_0x2d4a('0x39')](_0x9bac28['query'],_0x101382[_0x2d4a('0x3a')]),_0x25ac5c);if(_0x9bac28[_0x2d4a('0x2f')]['filter']){_0x20b87d[_0x2d4a('0x3b')]=_[_0x2d4a('0x3c')](_0x20b87d[_0x2d4a('0x3b')],{'$or':_[_0x2d4a('0x2a')](_0x25ac5c,function(_0x67bce3){if(_0x67bce3[_0x2d4a('0x2d')]!==_0x2d4a('0x3d')){var _0x2bd60a={};_0x2bd60a[_0x67bce3[_0x2d4a('0x28')]]={'$like':'%'+_0x9bac28[_0x2d4a('0x2f')][_0x2d4a('0x3e')]+'%'};return _0x2bd60a;}})});}_0x20b87d=_['merge']({},_0x20b87d,_0x9bac28[_0x2d4a('0x3f')]);var _0x24e015={'where':_0x20b87d[_0x2d4a('0x3b')]};return db[_0x2d4a('0x40')][_0x2d4a('0x1b')](_0x24e015)['then'](function(_0x50dbc3){_0x1dfc5d['count']=_0x50dbc3;if(_0x9bac28['query'][_0x2d4a('0x41')]){_0x20b87d[_0x2d4a('0x42')]=[{'all':!![]}];}return db[_0x2d4a('0x40')][_0x2d4a('0x43')](_0x20b87d);})['then'](function(_0x155f2d){_0x1dfc5d[_0x2d4a('0x44')]=_0x155f2d;return _0x1dfc5d;})['then'](respondWithFilteredResult(_0xc497ce,_0x20b87d))[_0x2d4a('0x45')](handleError(_0xc497ce,null));};exports[_0x2d4a('0x46')]=function(_0x8a9375,_0x13970c){var _0x1ad852={'raw':!![],'where':{'id':_0x8a9375['params']['id']}},_0x2c91e1={};_0x2c91e1[_0x2d4a('0x32')]=_[_0x2d4a('0x30')](db[_0x2d4a('0x40')][_0x2d4a('0x2b')]);_0x2c91e1[_0x2d4a('0x2f')]=_[_0x2d4a('0x30')](_0x8a9375['query']);_0x2c91e1[_0x2d4a('0x3a')]=_[_0x2d4a('0x31')](_0x2c91e1[_0x2d4a('0x32')],_0x2c91e1['query']);_0x1ad852[_0x2d4a('0x33')]=_['intersection'](_0x2c91e1[_0x2d4a('0x32')],qs[_0x2d4a('0x34')](_0x8a9375[_0x2d4a('0x2f')][_0x2d4a('0x34')]));_0x1ad852[_0x2d4a('0x33')]=_0x1ad852['attributes']['length']?_0x1ad852[_0x2d4a('0x33')]:_0x2c91e1[_0x2d4a('0x32')];if(_0x8a9375['query'][_0x2d4a('0x41')]){_0x1ad852['include']=[{'all':!![]}];}_0x1ad852=_[_0x2d4a('0x3c')]({},_0x1ad852,_0x8a9375[_0x2d4a('0x3f')]);return db[_0x2d4a('0x40')]['find'](_0x1ad852)[_0x2d4a('0x21')](handleEntityNotFound(_0x13970c,null))['then'](respondWithResult(_0x13970c,null))[_0x2d4a('0x45')](handleError(_0x13970c,null));};exports[_0x2d4a('0x47')]=function(_0x3c7a80,_0x2d66f2){return db[_0x2d4a('0x40')][_0x2d4a('0x47')](_0x3c7a80[_0x2d4a('0x48')],{})[_0x2d4a('0x21')](function(_0x1ffb96){var _0x2a94ff=_0x3c7a80[_0x2d4a('0x49')]['get']({'plain':!![]});if(!_0x2a94ff)throw new Error(_0x2d4a('0x4a'));if(_0x2a94ff[_0x2d4a('0x4b')]===_0x2d4a('0x49')){var _0x1467ab=_0x1ffb96[_0x2d4a('0x22')]({'plain':!![]});var _0x5b6086=_0x2d4a('0x23');return db[_0x2d4a('0x4c')][_0x2d4a('0x4d')]({'where':{'name':_0x5b6086,'userProfileId':_0x2a94ff[_0x2d4a('0x4e')]},'raw':!![]})[_0x2d4a('0x21')](function(_0x540bf9){if(_0x540bf9&&_0x540bf9['autoAssociation']===0x0){return db[_0x2d4a('0x24')][_0x2d4a('0x47')]({'name':_0x1467ab['name'],'resourceId':_0x1467ab['id'],'type':_0x540bf9[_0x2d4a('0x28')],'sectionId':_0x540bf9['id']},{})[_0x2d4a('0x21')](function(){return _0x1ffb96;});}else{return _0x1ffb96;}})[_0x2d4a('0x45')](function(_0x19109b){logger['error'](_0x2d4a('0x4f'),_0x19109b);throw _0x19109b;});}return _0x1ffb96;})['then'](respondWithResult(_0x2d66f2,0xc9))[_0x2d4a('0x45')](handleError(_0x2d66f2,null));};exports[_0x2d4a('0x20')]=function(_0x298fed,_0x1174e2){if(_0x298fed[_0x2d4a('0x48')]['id']){delete _0x298fed[_0x2d4a('0x48')]['id'];}return db[_0x2d4a('0x40')][_0x2d4a('0x4d')]({'where':{'id':_0x298fed['params']['id']}})[_0x2d4a('0x21')](handleEntityNotFound(_0x1174e2,null))[_0x2d4a('0x21')](saveUpdates(_0x298fed[_0x2d4a('0x48')],null))[_0x2d4a('0x21')](respondWithResult(_0x1174e2,null))[_0x2d4a('0x45')](handleError(_0x1174e2,null));};exports[_0x2d4a('0x25')]=function(_0x142b8c,_0x1d7af6){return db[_0x2d4a('0x40')][_0x2d4a('0x4d')]({'where':{'id':_0x142b8c[_0x2d4a('0x50')]['id']}})[_0x2d4a('0x21')](handleEntityNotFound(_0x1d7af6,null))[_0x2d4a('0x21')](removeEntity(_0x1d7af6,null))[_0x2d4a('0x45')](handleError(_0x1d7af6,null));};exports[_0x2d4a('0x51')]=function(_0x268a2f,_0x1e18a9,_0x4cce5e){if(_0x268a2f[_0x2d4a('0x48')]['id']){delete _0x268a2f[_0x2d4a('0x48')]['id'];}return db['Interval'][_0x2d4a('0x4d')]({'where':{'id':_0x268a2f[_0x2d4a('0x50')]['id']}})[_0x2d4a('0x21')](handleEntityNotFound(_0x1e18a9,null))[_0x2d4a('0x21')](function(_0x165c00){if(_0x165c00){_0x268a2f[_0x2d4a('0x48')][_0x2d4a('0x52')]=_0x165c00['id'];return db[_0x2d4a('0x40')][_0x2d4a('0x47')](_0x268a2f[_0x2d4a('0x48')]);}})[_0x2d4a('0x21')](respondWithResult(_0x1e18a9,null))[_0x2d4a('0x45')](handleError(_0x1e18a9,null));};exports['getIntervals']=function(_0x1e6661,_0x448307,_0x48c1f9){var _0xb5042d={};var _0x3f42eb={};var _0x1930c6;var _0xb4f74c;return db[_0x2d4a('0x40')][_0x2d4a('0x53')]({'where':{'id':_0x1e6661[_0x2d4a('0x50')]['id']}})[_0x2d4a('0x21')](handleEntityNotFound(_0x448307,null))[_0x2d4a('0x21')](function(_0x282df8){if(_0x282df8){_0x1930c6=_0x282df8;_0x3f42eb['model']=_[_0x2d4a('0x30')](db[_0x2d4a('0x40')][_0x2d4a('0x2b')]);_0x3f42eb['query']=_[_0x2d4a('0x30')](_0x1e6661[_0x2d4a('0x2f')]);_0x3f42eb[_0x2d4a('0x3a')]=_[_0x2d4a('0x31')](_0x3f42eb[_0x2d4a('0x32')],_0x3f42eb[_0x2d4a('0x2f')]);_0xb5042d[_0x2d4a('0x33')]=_[_0x2d4a('0x31')](_0x3f42eb[_0x2d4a('0x32')],qs['fields'](_0x1e6661[_0x2d4a('0x2f')][_0x2d4a('0x34')]));_0xb5042d[_0x2d4a('0x33')]=_0xb5042d[_0x2d4a('0x33')][_0x2d4a('0x35')]?_0xb5042d[_0x2d4a('0x33')]:_0x3f42eb['model'];_0xb5042d[_0x2d4a('0x37')]=qs[_0x2d4a('0x38')](_0x1e6661[_0x2d4a('0x2f')]['sort']);_0xb5042d[_0x2d4a('0x3b')]=qs[_0x2d4a('0x3a')](_['pick'](_0x1e6661[_0x2d4a('0x2f')],_0x3f42eb[_0x2d4a('0x3a')]));if(_0x1e6661['query'][_0x2d4a('0x3e')]){_0xb5042d['where']=_['merge'](_0xb5042d[_0x2d4a('0x3b')],{'$or':_[_0x2d4a('0x2a')](_0xb5042d[_0x2d4a('0x33')],function(_0xe78826){var _0x4b9a3d={};_0x4b9a3d[_0xe78826]={'$like':'%'+_0x1e6661[_0x2d4a('0x2f')][_0x2d4a('0x3e')]+'%'};return _0x4b9a3d;})});}_0xb5042d=_[_0x2d4a('0x3c')]({},_0xb5042d,_0x1e6661[_0x2d4a('0x3f')]);return _0x1930c6['getIntervals'](_0xb5042d);}})['then'](function(_0x34f1d0){if(_0x34f1d0){_0xb4f74c=_0x34f1d0[_0x2d4a('0x35')];if(!_0x1e6661[_0x2d4a('0x2f')][_0x2d4a('0x54')](_0x2d4a('0x36'))){_0xb5042d[_0x2d4a('0x1d')]=qs[_0x2d4a('0x1d')](_0x1e6661['query'][_0x2d4a('0x1d')]);_0xb5042d[_0x2d4a('0x1c')]=qs[_0x2d4a('0x1c')](_0x1e6661[_0x2d4a('0x2f')]['offset']);}return _0x1930c6[_0x2d4a('0x55')](_0xb5042d);}})[_0x2d4a('0x21')](function(_0x32a048){if(_0x32a048){return _0x32a048?{'count':_0xb4f74c,'rows':_0x32a048}:null;}})[_0x2d4a('0x21')](respondWithResult(_0x448307,null))['catch'](handleError(_0x448307,null));};exports[_0x2d4a('0x56')]=function(_0x118a3b,_0x55d565,_0x13fc38){return db[_0x2d4a('0x40')][_0x2d4a('0x53')]({'where':{'id':_0x118a3b['params']['id']}})[_0x2d4a('0x21')](handleEntityNotFound(_0x55d565,null))[_0x2d4a('0x21')](function(_0x41f2bd){if(_0x41f2bd){return db[_0x2d4a('0x57')][_0x2d4a('0x58')](function(_0xb6c864){return db[_0x2d4a('0x40')]['destroy']({'where':{'IntervalId':_0x118a3b[_0x2d4a('0x50')]['id']},'transaction':_0xb6c864})[_0x2d4a('0x21')](function(_0x318ef4){var _0x1cc5ed=_[_0x2d4a('0x2a')](_0x118a3b['body'],function(_0x38e623){delete _0x38e623['id'];_0x38e623['IntervalId']=_0x118a3b[_0x2d4a('0x50')]['id'];return _0x38e623;});return db[_0x2d4a('0x40')][_0x2d4a('0x59')](_0x1cc5ed,{'transaction':_0xb6c864});});})[_0x2d4a('0x21')](function(){return db[_0x2d4a('0x40')][_0x2d4a('0x43')]({'where':{'IntervalId':_0x118a3b[_0x2d4a('0x50')]['id']}});});}})[_0x2d4a('0x21')](respondWithResult(_0x55d565,null))[_0x2d4a('0x45')](handleError(_0x55d565,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index d3dfcc5..9a1e572 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 _0xdafe=['rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','define','Interval'];(function(_0x3ce301,_0x858468){var _0x323499=function(_0x789e5b){while(--_0x789e5b){_0x3ce301['push'](_0x3ce301['shift']());}};_0x323499(++_0x858468);}(_0xdafe,0x6a));var _0xedaf=function(_0xf94963,_0x3bdaa3){_0xf94963=_0xf94963-0x0;var _0x4b66df=_0xdafe[_0xf94963];return _0x4b66df;};'use strict';var _=require(_0xedaf('0x0'));var util=require(_0xedaf('0x1'));var logger=require(_0xedaf('0x2'))(_0xedaf('0x3'));var moment=require(_0xedaf('0x4'));var BPromise=require(_0xedaf('0x5'));var rp=require(_0xedaf('0x6'));var fs=require('fs');var path=require(_0xedaf('0x7'));var rimraf=require(_0xedaf('0x8'));var config=require(_0xedaf('0x9'));var attributes=require(_0xedaf('0xa'));var extensions=require(_0xedaf('0xb'));module['exports']=function(_0x1b0c20,_0x4ed160){return _0x1b0c20[_0xedaf('0xc')](_0xedaf('0xd'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4eba67,_0xa561a3){extensions[_0xedaf('0xe')](_0x1b0c20,_0x4eba67);},'afterBulkCreate':function(_0x4470e6,_0x207265,_0x49ec7c){_0x49ec7c();extensions['rewrite'](_0x1b0c20,_0x4470e6[0x0]);},'afterUpdate':function(_0x5c56a8,_0x5cf092){extensions[_0xedaf('0xe')](_0x1b0c20,_0x5c56a8);},'afterDestroy':function(_0x3bebe0,_0x228b23){extensions['rewrite'](_0x1b0c20,_0x3bebe0);}}});}; \ No newline at end of file +var _0xb688=['moment','bluebird','request-promise','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','define','Interval','tools_intervals','rewrite','util','../../config/logger','api'];(function(_0xf8468f,_0x1e016c){var _0x1a5db5=function(_0x32ca4c){while(--_0x32ca4c){_0xf8468f['push'](_0xf8468f['shift']());}};_0x1a5db5(++_0x1e016c);}(_0xb688,0xcf));var _0x8b68=function(_0x2608b7,_0xe7ef2d){_0x2608b7=_0x2608b7-0x0;var _0x3e7349=_0xb688[_0x2608b7];return _0x3e7349;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var logger=require(_0x8b68('0x1'))(_0x8b68('0x2'));var moment=require(_0x8b68('0x3'));var BPromise=require(_0x8b68('0x4'));var rp=require(_0x8b68('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var attributes=require(_0x8b68('0x8'));var extensions=require(_0x8b68('0x9'));module['exports']=function(_0x34314e,_0x57ee56){return _0x34314e[_0x8b68('0xa')](_0x8b68('0xb'),attributes,{'tableName':_0x8b68('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xa5571b,_0x132617){extensions[_0x8b68('0xd')](_0x34314e,_0xa5571b);},'afterBulkCreate':function(_0x261753,_0x21d944,_0x24e0b0){_0x24e0b0();extensions[_0x8b68('0xd')](_0x34314e,_0x261753[0x0]);},'afterUpdate':function(_0x418775,_0x317d01){extensions[_0x8b68('0xd')](_0x34314e,_0x418775);},'afterDestroy':function(_0x502727,_0x2c0f3b){extensions[_0x8b68('0xd')](_0x34314e,_0x502727);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index a033e0a..c1d9c3c 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 _0x1884=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowInterval','find','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4001ad,_0x1e22dd){var _0x4c7ec2=function(_0x24cb8a){while(--_0x24cb8a){_0x4001ad['push'](_0x4001ad['shift']());}};_0x4c7ec2(++_0x1e22dd);}(_0x1884,0x1c2));var _0x4188=function(_0x2dbcea,_0x35a776){_0x2dbcea=_0x2dbcea-0x0;var _0x40eb89=_0x1884[_0x2dbcea];return _0x40eb89;};'use strict';var _=require(_0x4188('0x0'));var util=require(_0x4188('0x1'));var moment=require(_0x4188('0x2'));var BPromise=require('bluebird');var rs=require(_0x4188('0x3'));var fs=require('fs');var Redis=require(_0x4188('0x4'));var db=require(_0x4188('0x5'))['db'];var utils=require(_0x4188('0x6'));var logger=require(_0x4188('0x7'))(_0x4188('0x8'));var config=require(_0x4188('0x9'));var jayson=require(_0x4188('0xa'));var client=jayson[_0x4188('0xb')][_0x4188('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x595af7,_0x53e59c,_0x558b3d){return new BPromise(function(_0x214be0,_0x5aafe0){return client[_0x4188('0xd')](_0x595af7,_0x558b3d)[_0x4188('0xe')](function(_0x437d9f){logger[_0x4188('0xf')](_0x4188('0x10'),_0x53e59c,_0x4188('0x11'));logger[_0x4188('0x12')](_0x4188('0x13'),_0x53e59c,_0x4188('0x11'),JSON[_0x4188('0x14')](_0x437d9f));if(_0x437d9f[_0x4188('0x15')]){if(_0x437d9f[_0x4188('0x15')][_0x4188('0x16')]===0x1f4){logger[_0x4188('0x15')](_0x4188('0x10'),_0x53e59c,_0x437d9f[_0x4188('0x15')][_0x4188('0x17')]);return _0x5aafe0(_0x437d9f[_0x4188('0x15')][_0x4188('0x17')]);}logger['error']('Interval,\x20%s,\x20%s',_0x53e59c,_0x437d9f[_0x4188('0x15')][_0x4188('0x17')]);return _0x214be0(_0x437d9f[_0x4188('0x15')][_0x4188('0x17')]);}else{logger[_0x4188('0xf')](_0x4188('0x10'),_0x53e59c,_0x4188('0x11'));_0x214be0(_0x437d9f['result'][_0x4188('0x17')]);}})['catch'](function(_0x151f23){logger[_0x4188('0x15')](_0x4188('0x10'),_0x53e59c,_0x151f23);_0x5aafe0(_0x151f23);});});}exports[_0x4188('0x18')]=function(_0x15b822){var _0xb2aee2=this;return new Promise(function(_0x5b8a87,_0x58e18d){return db[_0x4188('0x19')][_0x4188('0x1a')]({'raw':_0x15b822[_0x4188('0x1b')]?_0x15b822[_0x4188('0x1b')][_0x4188('0x1c')]===undefined?!![]:![]:!![],'where':_0x15b822[_0x4188('0x1b')]?_0x15b822[_0x4188('0x1b')][_0x4188('0x1d')]||null:null,'attributes':_0x15b822[_0x4188('0x1b')]?_0x15b822[_0x4188('0x1b')][_0x4188('0x1e')]||null:null,'limit':_0x15b822[_0x4188('0x1b')]?_0x15b822[_0x4188('0x1b')][_0x4188('0x1f')]||null:null,'include':_0x15b822[_0x4188('0x1b')]?_0x15b822[_0x4188('0x1b')][_0x4188('0x20')]?_[_0x4188('0x21')](_0x15b822[_0x4188('0x1b')][_0x4188('0x20')],function(_0x126ff0){return{'model':db[_0x126ff0[_0x4188('0x22')]],'as':_0x126ff0['as'],'attributes':_0x126ff0['attributes'],'include':_0x126ff0[_0x4188('0x20')]?_['map'](_0x126ff0[_0x4188('0x20')],function(_0x348327){return{'model':db[_0x348327['model']],'as':_0x348327['as'],'attributes':_0x348327[_0x4188('0x1e')],'include':_0x348327[_0x4188('0x20')]?_['map'](_0x348327[_0x4188('0x20')],function(_0x51ca0b){return{'model':db[_0x51ca0b[_0x4188('0x22')]],'as':_0x51ca0b['as'],'attributes':_0x51ca0b[_0x4188('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4188('0xe')](function(_0x5a8096){logger['info']('GetInterval',_0x15b822);logger[_0x4188('0x12')](_0x4188('0x18'),_0x15b822,JSON[_0x4188('0x14')](_0x5a8096));_0x5b8a87(_0x5a8096);})[_0x4188('0x23')](function(_0xa5409){logger[_0x4188('0x15')]('GetInterval',_0xa5409[_0x4188('0x17')],_0x15b822);_0x58e18d(_0xb2aee2[_0x4188('0x15')](0x1f4,_0xa5409[_0x4188('0x17')]));});});};exports[_0x4188('0x24')]=function(_0x5a0003){var _0x382a60=this;return new Promise(function(_0x19c924,_0x4dccb4){return db[_0x4188('0x19')][_0x4188('0x25')]({'raw':_0x5a0003[_0x4188('0x1b')]?_0x5a0003[_0x4188('0x1b')][_0x4188('0x1c')]===undefined?!![]:![]:!![],'where':_0x5a0003[_0x4188('0x1b')]?_0x5a0003[_0x4188('0x1b')][_0x4188('0x1d')]||null:null,'attributes':_0x5a0003[_0x4188('0x1b')]?_0x5a0003[_0x4188('0x1b')]['attributes']||null:null,'include':_0x5a0003[_0x4188('0x1b')]?_0x5a0003['options'][_0x4188('0x20')]?_[_0x4188('0x21')](_0x5a0003['options'][_0x4188('0x20')],function(_0xa3f4f5){return{'model':db[_0xa3f4f5[_0x4188('0x22')]],'as':_0xa3f4f5['as'],'attributes':_0xa3f4f5[_0x4188('0x1e')],'include':_0xa3f4f5[_0x4188('0x20')]?_[_0x4188('0x21')](_0xa3f4f5[_0x4188('0x20')],function(_0x121ff2){return{'model':db[_0x121ff2[_0x4188('0x22')]],'as':_0x121ff2['as'],'attributes':_0x121ff2[_0x4188('0x1e')],'include':_0x121ff2[_0x4188('0x20')]?_[_0x4188('0x21')](_0x121ff2[_0x4188('0x20')],function(_0x4cc681){return{'model':db[_0x4cc681['model']],'as':_0x4cc681['as'],'attributes':_0x4cc681['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f364d){logger[_0x4188('0xf')](_0x4188('0x24'),_0x5a0003);logger[_0x4188('0x12')](_0x4188('0x24'),_0x5a0003,JSON[_0x4188('0x14')](_0x5f364d));_0x19c924(_0x5f364d);})[_0x4188('0x23')](function(_0x17ee51){logger[_0x4188('0x15')](_0x4188('0x24'),_0x17ee51[_0x4188('0x17')],_0x5a0003);_0x4dccb4(_0x382a60[_0x4188('0x15')](0x1f4,_0x17ee51[_0x4188('0x17')]));});});}; \ No newline at end of file +var _0x1ab5=['stringify','error','code','message','info','result','catch','GetInterval','Interval','findAll','options','where','attributes','limit','map','model','include','debug','ShowInterval','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','Interval,\x20%s,\x20%s','request\x20sent','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x38622b,_0x3cfdf7){var _0x2c1a7a=function(_0x5de9cc){while(--_0x5de9cc){_0x38622b['push'](_0x38622b['shift']());}};_0x2c1a7a(++_0x3cfdf7);}(_0x1ab5,0xf3));var _0x51ab=function(_0x64efe5,_0x4ddd0d){_0x64efe5=_0x64efe5-0x0;var _0x58bd4a=_0x1ab5[_0x64efe5];return _0x58bd4a;};'use strict';var _=require(_0x51ab('0x0'));var util=require(_0x51ab('0x1'));var moment=require(_0x51ab('0x2'));var BPromise=require('bluebird');var rs=require(_0x51ab('0x3'));var fs=require('fs');var Redis=require(_0x51ab('0x4'));var db=require(_0x51ab('0x5'))['db'];var utils=require(_0x51ab('0x6'));var logger=require(_0x51ab('0x7'))('rpc');var config=require(_0x51ab('0x8'));var jayson=require(_0x51ab('0x9'));var client=jayson[_0x51ab('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a0343,_0x489ab5,_0x5dc5b7){return new BPromise(function(_0x11408a,_0x59b1a2){return client[_0x51ab('0xb')](_0x3a0343,_0x5dc5b7)[_0x51ab('0xc')](function(_0x385dcc){logger['info'](_0x51ab('0xd'),_0x489ab5,_0x51ab('0xe'));logger['debug'](_0x51ab('0xf'),_0x489ab5,_0x51ab('0xe'),JSON[_0x51ab('0x10')](_0x385dcc));if(_0x385dcc[_0x51ab('0x11')]){if(_0x385dcc[_0x51ab('0x11')][_0x51ab('0x12')]===0x1f4){logger[_0x51ab('0x11')](_0x51ab('0xd'),_0x489ab5,_0x385dcc[_0x51ab('0x11')][_0x51ab('0x13')]);return _0x59b1a2(_0x385dcc[_0x51ab('0x11')][_0x51ab('0x13')]);}logger[_0x51ab('0x11')](_0x51ab('0xd'),_0x489ab5,_0x385dcc[_0x51ab('0x11')][_0x51ab('0x13')]);return _0x11408a(_0x385dcc[_0x51ab('0x11')][_0x51ab('0x13')]);}else{logger[_0x51ab('0x14')](_0x51ab('0xd'),_0x489ab5,_0x51ab('0xe'));_0x11408a(_0x385dcc[_0x51ab('0x15')][_0x51ab('0x13')]);}})[_0x51ab('0x16')](function(_0x753ff7){logger[_0x51ab('0x11')]('Interval,\x20%s,\x20%s',_0x489ab5,_0x753ff7);_0x59b1a2(_0x753ff7);});});}exports[_0x51ab('0x17')]=function(_0x48dc95){var _0xc76892=this;return new Promise(function(_0x8009fc,_0x163608){return db[_0x51ab('0x18')][_0x51ab('0x19')]({'raw':_0x48dc95[_0x51ab('0x1a')]?_0x48dc95[_0x51ab('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x48dc95[_0x51ab('0x1a')]?_0x48dc95['options'][_0x51ab('0x1b')]||null:null,'attributes':_0x48dc95['options']?_0x48dc95[_0x51ab('0x1a')][_0x51ab('0x1c')]||null:null,'limit':_0x48dc95['options']?_0x48dc95[_0x51ab('0x1a')][_0x51ab('0x1d')]||null:null,'include':_0x48dc95[_0x51ab('0x1a')]?_0x48dc95[_0x51ab('0x1a')]['include']?_[_0x51ab('0x1e')](_0x48dc95[_0x51ab('0x1a')]['include'],function(_0x401af7){return{'model':db[_0x401af7[_0x51ab('0x1f')]],'as':_0x401af7['as'],'attributes':_0x401af7[_0x51ab('0x1c')],'include':_0x401af7[_0x51ab('0x20')]?_[_0x51ab('0x1e')](_0x401af7[_0x51ab('0x20')],function(_0x2b0e1d){return{'model':db[_0x2b0e1d['model']],'as':_0x2b0e1d['as'],'attributes':_0x2b0e1d['attributes'],'include':_0x2b0e1d['include']?_[_0x51ab('0x1e')](_0x2b0e1d[_0x51ab('0x20')],function(_0x5d5252){return{'model':db[_0x5d5252[_0x51ab('0x1f')]],'as':_0x5d5252['as'],'attributes':_0x5d5252[_0x51ab('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x51ab('0xc')](function(_0x338ed3){logger[_0x51ab('0x14')](_0x51ab('0x17'),_0x48dc95);logger[_0x51ab('0x21')]('GetInterval',_0x48dc95,JSON[_0x51ab('0x10')](_0x338ed3));_0x8009fc(_0x338ed3);})[_0x51ab('0x16')](function(_0x2b5972){logger[_0x51ab('0x11')](_0x51ab('0x17'),_0x2b5972[_0x51ab('0x13')],_0x48dc95);_0x163608(_0xc76892[_0x51ab('0x11')](0x1f4,_0x2b5972[_0x51ab('0x13')]));});});};exports[_0x51ab('0x22')]=function(_0x30dfd5){var _0xec3e3f=this;return new Promise(function(_0x3f5c62,_0xcaff11){return db[_0x51ab('0x18')][_0x51ab('0x23')]({'raw':_0x30dfd5[_0x51ab('0x1a')]?_0x30dfd5['options'][_0x51ab('0x24')]===undefined?!![]:![]:!![],'where':_0x30dfd5['options']?_0x30dfd5[_0x51ab('0x1a')][_0x51ab('0x1b')]||null:null,'attributes':_0x30dfd5[_0x51ab('0x1a')]?_0x30dfd5[_0x51ab('0x1a')]['attributes']||null:null,'include':_0x30dfd5['options']?_0x30dfd5[_0x51ab('0x1a')][_0x51ab('0x20')]?_[_0x51ab('0x1e')](_0x30dfd5[_0x51ab('0x1a')][_0x51ab('0x20')],function(_0x53e43f){return{'model':db[_0x53e43f[_0x51ab('0x1f')]],'as':_0x53e43f['as'],'attributes':_0x53e43f[_0x51ab('0x1c')],'include':_0x53e43f[_0x51ab('0x20')]?_[_0x51ab('0x1e')](_0x53e43f[_0x51ab('0x20')],function(_0x313a0a){return{'model':db[_0x313a0a['model']],'as':_0x313a0a['as'],'attributes':_0x313a0a['attributes'],'include':_0x313a0a[_0x51ab('0x20')]?_['map'](_0x313a0a[_0x51ab('0x20')],function(_0x9a7b1c){return{'model':db[_0x9a7b1c[_0x51ab('0x1f')]],'as':_0x9a7b1c['as'],'attributes':_0x9a7b1c[_0x51ab('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x51ab('0xc')](function(_0x586002){logger['info'](_0x51ab('0x22'),_0x30dfd5);logger[_0x51ab('0x21')]('ShowInterval',_0x30dfd5,JSON[_0x51ab('0x10')](_0x586002));_0x3f5c62(_0x586002);})[_0x51ab('0x16')](function(_0x2875df){logger[_0x51ab('0x11')](_0x51ab('0x22'),_0x2875df[_0x51ab('0x13')],_0x30dfd5);_0xcaff11(_0xec3e3f[_0x51ab('0x11')](0x1f4,_0x2875df['message']));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 7e64122..0915ad1 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 _0xc58a=['./jira.controller','post','isAuthenticated','send','Router','../../components/auth/service'];(function(_0x483cbe,_0x1832da){var _0x191c71=function(_0x2f812f){while(--_0x2f812f){_0x483cbe['push'](_0x483cbe['shift']());}};_0x191c71(++_0x1832da);}(_0xc58a,0x64));var _0xac58=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0xc58a[_0x2abc3d];return _0x252745;};'use strict';var express=require('express');var router=express[_0xac58('0x0')]();var auth=require(_0xac58('0x1'));var controller=require(_0xac58('0x2'));router[_0xac58('0x3')]('/',auth[_0xac58('0x4')](),controller[_0xac58('0x5')]);module['exports']=router; \ No newline at end of file +var _0x48c4=['../../components/auth/service','post','isAuthenticated','express','Router'];(function(_0x73a6f1,_0x295caa){var _0x291f82=function(_0x5dd297){while(--_0x5dd297){_0x73a6f1['push'](_0x73a6f1['shift']());}};_0x291f82(++_0x295caa);}(_0x48c4,0x134));var _0x448c=function(_0x82760d,_0xf8da33){_0x82760d=_0x82760d-0x0;var _0x5dd02e=_0x48c4[_0x82760d];return _0x5dd02e;};'use strict';var express=require(_0x448c('0x0'));var router=express[_0x448c('0x1')]();var auth=require(_0x448c('0x2'));var controller=require('./jira.controller');router[_0x448c('0x3')]('/',auth[_0x448c('0x4')](),controller['send']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 876016f..cb2da11 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 _0xb13a=['email','fields','customfield_11501','oldToken','customfield_11502','newToken','name','customfield_11504','customfield_10102','POST','Basic\x20','toString','base64','setEncoding','utf8','data','end','status','statusCode','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','https','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug'];(function(_0x1369b1,_0x5b4848){var _0xb9428d=function(_0x31c27e){while(--_0x31c27e){_0x1369b1['push'](_0x1369b1['shift']());}};_0xb9428d(++_0x5b4848);}(_0xb13a,0x188));var _0xab13=function(_0x26764b,_0x52b925){_0x26764b=_0x26764b-0x0;var _0x165f4a=_0xb13a[_0x26764b];return _0x165f4a;};'use strict';var BPromise=require('bluebird');var https=require(_0xab13('0x0'));var logger=require(_0xab13('0x1'))(_0xab13('0x2'));var USERNAME='support';var PASSWORD=_0xab13('0x3');function openIssue(_0x46e70c,_0x3ac09a){var _0x9562e6={'fields':{'project':{'key':_0x46e70c[_0xab13('0x4')]||_0xab13('0x5')},'summary':(_0x46e70c[_0xab13('0x6')]||_0xab13('0x7'))+_0xab13('0x8')+_0x46e70c['ip'],'description':_0x46e70c[_0xab13('0x9')]||JSON[_0xab13('0xa')](_0x46e70c),'issuetype':{'name':_0x46e70c[_0xab13('0xb')]||_0xab13('0xc')}}};_0x9562e6['fields']['customfield_11500']=_0x46e70c[_0xab13('0xd')];_0x9562e6[_0xab13('0xe')][_0xab13('0xf')]=_0x46e70c[_0xab13('0x10')];_0x9562e6[_0xab13('0xe')][_0xab13('0x11')]=_0x46e70c[_0xab13('0x12')];_0x9562e6[_0xab13('0xe')]['customfield_11503']=_0x46e70c[_0xab13('0x13')];_0x9562e6['fields'][_0xab13('0x14')]=_0x46e70c['reason'];_0x9562e6[_0xab13('0xe')][_0xab13('0x15')]=_0x46e70c['ip'];var _0x635fec={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':_0xab13('0x16'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xab13('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0xab13('0x18')](_0xab13('0x19'))}};var _0x2a1551=JSON[_0xab13('0xa')](_0x9562e6);var _0x1bab27=https['request'](_0x635fec,function(_0x31969a){_0x31969a[_0xab13('0x1a')](_0xab13('0x1b'));var _0x47f50f='';_0x31969a['on'](_0xab13('0x1c'),function(_0x99c410){_0x47f50f+=_0x99c410;});_0x31969a['on'](_0xab13('0x1d'),function(){if(_0x3ac09a){return _0x3ac09a[_0xab13('0x1e')](_0x31969a[_0xab13('0x1f')])[_0xab13('0x20')](JSON[_0xab13('0x21')](_0x47f50f));}});});_0x1bab27['on'](_0xab13('0x22'),function(_0x5764a6){if(_0x3ac09a){return _0x3ac09a[_0xab13('0x1e')](0x1f4)[_0xab13('0x20')]({'errors':[{'message':_0xab13('0x23'),'type':'api.jira'}]});}});_0x1bab27[_0xab13('0x24')](_0x2a1551);_0x1bab27['end']();}exports[_0xab13('0x25')]=openIssue;exports[_0xab13('0x26')]=function(_0x44cc1b,_0x4aa34b){_0x44cc1b[_0xab13('0x27')]['ip']=_0x44cc1b[_0xab13('0x28')][_0xab13('0x29')]||_0x44cc1b[_0xab13('0x2a')][_0xab13('0x2b')]||_0x44cc1b[_0xab13('0x2c')][_0xab13('0x2b')]||_0x44cc1b[_0xab13('0x2a')][_0xab13('0x2c')][_0xab13('0x2b')];return openIssue(_0x44cc1b['body'],_0x4aa34b);}; \ No newline at end of file +var _0x52ac=['customfield_11504','reason','customfield_10102','track.xcallymotion.com','application/json','Basic\x20','toString','base64','stringify','request','setEncoding','utf8','status','statusCode','parse','error','json','api.jira','write','end','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','issuetype','Bug','fields','email','customfield_11501','oldToken','customfield_11502','newToken','name'];(function(_0x401bc2,_0x2743a4){var _0x177999=function(_0x2bd06b){while(--_0x2bd06b){_0x401bc2['push'](_0x401bc2['shift']());}};_0x177999(++_0x2743a4);}(_0x52ac,0x165));var _0xc52a=function(_0x171ac7,_0x339c8d){_0x171ac7=_0x171ac7-0x0;var _0x94478d=_0x52ac[_0x171ac7];return _0x94478d;};'use strict';var BPromise=require(_0xc52a('0x0'));var https=require(_0xc52a('0x1'));var logger=require(_0xc52a('0x2'))(_0xc52a('0x3'));var USERNAME=_0xc52a('0x4');var PASSWORD=_0xc52a('0x5');function openIssue(_0x2c4351,_0x5466f8){var _0x2c3ffa={'fields':{'project':{'key':_0x2c4351[_0xc52a('0x6')]||_0xc52a('0x7')},'summary':(_0x2c4351[_0xc52a('0x8')]||_0xc52a('0x9'))+'\x20from\x20'+_0x2c4351['ip'],'description':_0x2c4351['description']||JSON['stringify'](_0x2c4351),'issuetype':{'name':_0x2c4351[_0xc52a('0xa')]||_0xc52a('0xb')}}};_0x2c3ffa[_0xc52a('0xc')]['customfield_11500']=_0x2c4351[_0xc52a('0xd')];_0x2c3ffa[_0xc52a('0xc')][_0xc52a('0xe')]=_0x2c4351[_0xc52a('0xf')];_0x2c3ffa[_0xc52a('0xc')][_0xc52a('0x10')]=_0x2c4351[_0xc52a('0x11')];_0x2c3ffa['fields']['customfield_11503']=_0x2c4351[_0xc52a('0x12')];_0x2c3ffa[_0xc52a('0xc')][_0xc52a('0x13')]=_0x2c4351[_0xc52a('0x14')];_0x2c3ffa[_0xc52a('0xc')][_0xc52a('0x15')]=_0x2c4351['ip'];var _0x4a0643={'host':_0xc52a('0x16'),'port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xc52a('0x17'),'Authorization':_0xc52a('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xc52a('0x19')](_0xc52a('0x1a'))}};var _0x50efeb=JSON[_0xc52a('0x1b')](_0x2c3ffa);var _0x27d536=https[_0xc52a('0x1c')](_0x4a0643,function(_0x4fa148){_0x4fa148[_0xc52a('0x1d')](_0xc52a('0x1e'));var _0x1d5af0='';_0x4fa148['on']('data',function(_0x3a1114){_0x1d5af0+=_0x3a1114;});_0x4fa148['on']('end',function(){if(_0x5466f8){return _0x5466f8[_0xc52a('0x1f')](_0x4fa148[_0xc52a('0x20')])['json'](JSON[_0xc52a('0x21')](_0x1d5af0));}});});_0x27d536['on'](_0xc52a('0x22'),function(_0x52a27a){if(_0x5466f8){return _0x5466f8[_0xc52a('0x1f')](0x1f4)[_0xc52a('0x23')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xc52a('0x24')}]});}});_0x27d536[_0xc52a('0x25')](_0x50efeb);_0x27d536[_0xc52a('0x26')]();}exports[_0xc52a('0x27')]=openIssue;exports[_0xc52a('0x28')]=function(_0x2721bf,_0x1c1676){_0x2721bf[_0xc52a('0x29')]['ip']=_0x2721bf[_0xc52a('0x2a')][_0xc52a('0x2b')]||_0x2721bf[_0xc52a('0x2c')]['remoteAddress']||_0x2721bf[_0xc52a('0x2d')][_0xc52a('0x2e')]||_0x2721bf[_0xc52a('0x2c')]['socket'][_0xc52a('0x2e')];return openIssue(_0x2721bf[_0xc52a('0x29')],_0x1c1676);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 66db964..c303bd8 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 _0x2088=['get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller'];(function(_0x13147b,_0x283a7f){var _0xe98ff6=function(_0x6277bc){while(--_0x6277bc){_0x13147b['push'](_0x13147b['shift']());}};_0xe98ff6(++_0x283a7f);}(_0x2088,0xe9));var _0x8208=function(_0x5b697a,_0x280202){_0x5b697a=_0x5b697a-0x0;var _0x5de43b=_0x2088[_0x5b697a];return _0x5de43b;};'use strict';var multer=require('multer');var util=require(_0x8208('0x0'));var path=require(_0x8208('0x1'));var timeout=require('connect-timeout');var express=require(_0x8208('0x2'));var router=express[_0x8208('0x3')]();var fs_extra=require(_0x8208('0x4'));var auth=require(_0x8208('0x5'));var interaction=require(_0x8208('0x6'));var config=require(_0x8208('0x7'));var controller=require(_0x8208('0x8'));router[_0x8208('0x9')]('/',auth[_0x8208('0xa')](),controller[_0x8208('0xb')]);router['get'](_0x8208('0xc'),auth[_0x8208('0xa')](),controller['describe']);router[_0x8208('0x9')](_0x8208('0xd'),auth[_0x8208('0xa')](),controller[_0x8208('0xe')]);router[_0x8208('0xf')]('/',auth[_0x8208('0xa')](),controller[_0x8208('0x10')]);router[_0x8208('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x8208('0x12')]);router[_0x8208('0x13')](_0x8208('0xd'),auth[_0x8208('0xa')](),controller[_0x8208('0x14')]);module[_0x8208('0x15')]=router; \ No newline at end of file +var _0xf020=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','show','put','/:id','update','destroy','exports','multer','util'];(function(_0x247083,_0x3849ed){var _0x1576e4=function(_0x4a5aea){while(--_0x4a5aea){_0x247083['push'](_0x247083['shift']());}};_0x1576e4(++_0x3849ed);}(_0xf020,0x17a));var _0x0f02=function(_0x1c458e,_0x554344){_0x1c458e=_0x1c458e-0x0;var _0x767fd9=_0xf020[_0x1c458e];return _0x767fd9;};'use strict';var multer=require(_0x0f02('0x0'));var util=require(_0x0f02('0x1'));var path=require(_0x0f02('0x2'));var timeout=require(_0x0f02('0x3'));var express=require(_0x0f02('0x4'));var router=express['Router']();var fs_extra=require(_0x0f02('0x5'));var auth=require(_0x0f02('0x6'));var interaction=require(_0x0f02('0x7'));var config=require(_0x0f02('0x8'));var controller=require(_0x0f02('0x9'));router[_0x0f02('0xa')]('/',auth['isAuthenticated'](),controller[_0x0f02('0xb')]);router[_0x0f02('0xa')](_0x0f02('0xc'),auth[_0x0f02('0xd')](),controller['describe']);router['get']('/:id',auth[_0x0f02('0xd')](),controller[_0x0f02('0xe')]);router['post']('/',auth[_0x0f02('0xd')](),controller['create']);router[_0x0f02('0xf')](_0x0f02('0x10'),auth[_0x0f02('0xd')](),controller[_0x0f02('0x11')]);router['delete'](_0x0f02('0x10'),auth['isAuthenticated'](),controller[_0x0f02('0x12')]);module[_0x0f02('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index fe274cb..9597890 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 _0x5eb1=['exports','TEXT','long','STRING'];(function(_0x2ec2bf,_0x64e983){var _0x2c279c=function(_0x41fe42){while(--_0x41fe42){_0x2ec2bf['push'](_0x2ec2bf['shift']());}};_0x2c279c(++_0x64e983);}(_0x5eb1,0x7c));var _0x15eb=function(_0x589fb1,_0x5d8fb5){_0x589fb1=_0x589fb1-0x0;var _0x12195c=_0x5eb1[_0x589fb1];return _0x12195c;};'use strict';var Sequelize=require('sequelize');module[_0x15eb('0x0')]={'question':{'type':Sequelize[_0x15eb('0x1')]},'answer':{'type':Sequelize[_0x15eb('0x1')](_0x15eb('0x2'))},'membername':{'type':Sequelize[_0x15eb('0x3')]},'projectname':{'type':Sequelize[_0x15eb('0x3')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x15eb('0x3')]},'calleridname':{'type':Sequelize[_0x15eb('0x3')]},'calleridnum':{'type':Sequelize[_0x15eb('0x3')]},'questionId':{'type':Sequelize[_0x15eb('0x3')]}}; \ No newline at end of file +var _0x0972=['STRING','exports','TEXT'];(function(_0x3fa8ee,_0x3b350d){var _0x36a857=function(_0x289c6c){while(--_0x289c6c){_0x3fa8ee['push'](_0x3fa8ee['shift']());}};_0x36a857(++_0x3b350d);}(_0x0972,0x64));var _0x2097=function(_0x22f1b6,_0x21174c){_0x22f1b6=_0x22f1b6-0x0;var _0x3944a7=_0x0972[_0x22f1b6];return _0x3944a7;};'use strict';var Sequelize=require('sequelize');module[_0x2097('0x0')]={'question':{'type':Sequelize['TEXT']},'answer':{'type':Sequelize[_0x2097('0x1')]('long')},'membername':{'type':Sequelize[_0x2097('0x2')]},'projectname':{'type':Sequelize[_0x2097('0x2')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2097('0x2')]},'calleridname':{'type':Sequelize[_0x2097('0x2')]},'calleridnum':{'type':Sequelize[_0x2097('0x2')]},'questionId':{'type':Sequelize[_0x2097('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 02b267d..d58f96b 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 _0xc833=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','map','JscriptyAnswerReport','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','length','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xc833,0x115));var _0x3c83=function(_0xc9cfc9,_0x575e4e){_0xc9cfc9=_0xc9cfc9-0x0;var _0x313cbd=_0xc833[_0xc9cfc9];return _0x313cbd;};'use strict';var emlformat=require(_0x3c83('0x0'));var rimraf=require(_0x3c83('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3c83('0x2'));var rp=require(_0x3c83('0x3'));var moment=require(_0x3c83('0x4'));var BPromise=require(_0x3c83('0x5'));var Mustache=require(_0x3c83('0x6'));var util=require(_0x3c83('0x7'));var path=require(_0x3c83('0x8'));var sox=require(_0x3c83('0x9'));var csv=require(_0x3c83('0xa'));var ejs=require(_0x3c83('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c83('0xc'));var squel=require('squel');var crypto=require(_0x3c83('0xd'));var jsforce=require(_0x3c83('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3c83('0xf'));var Papa=require(_0x3c83('0x10'));var Redis=require(_0x3c83('0x11'));var authService=require(_0x3c83('0x12'));var qs=require(_0x3c83('0x13'));var as=require(_0x3c83('0x14'));var hardwareService=require(_0x3c83('0x15'));var logger=require(_0x3c83('0x16'))(_0x3c83('0x17'));var utils=require('../../config/utils');var config=require(_0x3c83('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3c83('0x19'))['db'];function respondWithStatusCode(_0xdbd5c4,_0x1e7a71){_0x1e7a71=_0x1e7a71||0xcc;return function(_0x55b910){if(_0x55b910){return _0xdbd5c4[_0x3c83('0x1a')](_0x1e7a71);}return _0xdbd5c4['status'](_0x1e7a71)[_0x3c83('0x1b')]();};}function respondWithResult(_0x2229c5,_0x3b3d28){_0x3b3d28=_0x3b3d28||0xc8;return function(_0x50eab3){if(_0x50eab3){return _0x2229c5[_0x3c83('0x1c')](_0x3b3d28)[_0x3c83('0x1d')](_0x50eab3);}};}function respondWithFilteredResult(_0x4b5c6c,_0x1e8831){return function(_0x566cbd){if(_0x566cbd){var _0x210804=_0x566cbd[_0x3c83('0x1e')],_0x1950b1=_0x1e8831[_0x3c83('0x1f')],_0x1b9c74=_0x1e8831['offset']+_0x1e8831[_0x3c83('0x20')],_0x5591cb;if(_0x1b9c74>=_0x210804){_0x1b9c74=_0x210804;_0x5591cb=0xc8;}else{_0x5591cb=0xce;}_0x4b5c6c[_0x3c83('0x1c')](_0x5591cb);return _0x4b5c6c[_0x3c83('0x21')](_0x3c83('0x22'),_0x1950b1+'-'+_0x1b9c74+'/'+_0x210804)[_0x3c83('0x1d')](_0x566cbd);}return null;};}function patchUpdates(_0x3cfd9b){return function(_0x52306b){try{jsonpatch[_0x3c83('0x23')](_0x52306b,_0x3cfd9b,!![]);}catch(_0x4ca010){return BPromise['reject'](_0x4ca010);}return _0x52306b[_0x3c83('0x24')]();};}function saveUpdates(_0x536b44,_0x3ea4e7){return function(_0x57a5a5){if(_0x57a5a5){return _0x57a5a5[_0x3c83('0x25')](_0x536b44)[_0x3c83('0x26')](function(_0x5e7288){return _0x5e7288;});}return null;};}function removeEntity(_0x167430,_0x1f28c2){return function(_0x52ba37){if(_0x52ba37){return _0x52ba37[_0x3c83('0x27')]()[_0x3c83('0x26')](function(){_0x167430[_0x3c83('0x1c')](0xcc)[_0x3c83('0x1b')]();});}};}function handleEntityNotFound(_0x3d7985,_0x45baa5){return function(_0x3bf9d3){if(!_0x3bf9d3){_0x3d7985[_0x3c83('0x1a')](0x194);}return _0x3bf9d3;};}function handleError(_0x11b7a7,_0x1cddda){_0x1cddda=_0x1cddda||0x1f4;return function(_0x478945){logger[_0x3c83('0x28')](_0x478945['stack']);if(_0x478945[_0x3c83('0x29')]){delete _0x478945[_0x3c83('0x29')];}_0x11b7a7[_0x3c83('0x1c')](_0x1cddda)[_0x3c83('0x2a')](_0x478945);};}exports['index']=function(_0x340c54,_0x2c44de){var _0x56b268={},_0x15f13c={},_0x3069e7={'count':0x0,'rows':[]};var _0x3bd0af=_[_0x3c83('0x2b')](db[_0x3c83('0x2c')][_0x3c83('0x2d')],function(_0xe0df7f){return{'name':_0xe0df7f['fieldName'],'type':_0xe0df7f[_0x3c83('0x2e')][_0x3c83('0x2f')]};});_0x15f13c['model']=_[_0x3c83('0x2b')](_0x3bd0af,_0x3c83('0x29'));_0x15f13c[_0x3c83('0x30')]=_[_0x3c83('0x31')](_0x340c54[_0x3c83('0x30')]);_0x15f13c[_0x3c83('0x32')]=_[_0x3c83('0x33')](_0x15f13c['model'],_0x15f13c['query']);_0x56b268[_0x3c83('0x34')]=_[_0x3c83('0x33')](_0x15f13c[_0x3c83('0x35')],qs[_0x3c83('0x36')](_0x340c54[_0x3c83('0x30')][_0x3c83('0x36')]));_0x56b268['attributes']=_0x56b268['attributes']['length']?_0x56b268[_0x3c83('0x34')]:_0x15f13c['model'];if(!_0x340c54[_0x3c83('0x30')][_0x3c83('0x37')](_0x3c83('0x38'))){_0x56b268[_0x3c83('0x20')]=qs[_0x3c83('0x20')](_0x340c54['query'][_0x3c83('0x20')]);_0x56b268[_0x3c83('0x1f')]=qs[_0x3c83('0x1f')](_0x340c54[_0x3c83('0x30')][_0x3c83('0x1f')]);}_0x56b268[_0x3c83('0x39')]=qs['sort'](_0x340c54['query']['sort']);_0x56b268[_0x3c83('0x3a')]=qs['filters'](_[_0x3c83('0x3b')](_0x340c54['query'],_0x15f13c[_0x3c83('0x32')]),_0x3bd0af);if(_0x340c54[_0x3c83('0x30')]['filter']){_0x56b268[_0x3c83('0x3a')]=_[_0x3c83('0x3c')](_0x56b268['where'],{'$or':_[_0x3c83('0x2b')](_0x3bd0af,function(_0x4a22fb){if(_0x4a22fb['type']!==_0x3c83('0x3d')){var _0x288758={};_0x288758[_0x4a22fb[_0x3c83('0x29')]]={'$like':'%'+_0x340c54[_0x3c83('0x30')][_0x3c83('0x3e')]+'%'};return _0x288758;}})});}_0x56b268=_[_0x3c83('0x3c')]({},_0x56b268,_0x340c54[_0x3c83('0x3f')]);var _0x4be333={'where':_0x56b268[_0x3c83('0x3a')]};return db[_0x3c83('0x2c')][_0x3c83('0x1e')](_0x4be333)['then'](function(_0x5ad8c0){_0x3069e7[_0x3c83('0x1e')]=_0x5ad8c0;if(_0x340c54[_0x3c83('0x30')][_0x3c83('0x40')]){_0x56b268[_0x3c83('0x41')]=[{'all':!![]}];}return db[_0x3c83('0x2c')][_0x3c83('0x42')](_0x56b268);})['then'](function(_0x3e84b6){_0x3069e7['rows']=_0x3e84b6;return _0x3069e7;})[_0x3c83('0x26')](respondWithFilteredResult(_0x2c44de,_0x56b268))[_0x3c83('0x43')](handleError(_0x2c44de,null));};exports['show']=function(_0x43365f,_0x7d086f){var _0x26d75e={'raw':!![],'where':{'id':_0x43365f[_0x3c83('0x44')]['id']}},_0x16423f={};_0x16423f['model']=_[_0x3c83('0x31')](db[_0x3c83('0x2c')][_0x3c83('0x2d')]);_0x16423f[_0x3c83('0x30')]=_[_0x3c83('0x31')](_0x43365f['query']);_0x16423f['filters']=_[_0x3c83('0x33')](_0x16423f[_0x3c83('0x35')],_0x16423f[_0x3c83('0x30')]);_0x26d75e[_0x3c83('0x34')]=_[_0x3c83('0x33')](_0x16423f['model'],qs[_0x3c83('0x36')](_0x43365f['query'][_0x3c83('0x36')]));_0x26d75e[_0x3c83('0x34')]=_0x26d75e[_0x3c83('0x34')][_0x3c83('0x45')]?_0x26d75e[_0x3c83('0x34')]:_0x16423f[_0x3c83('0x35')];if(_0x43365f[_0x3c83('0x30')][_0x3c83('0x40')]){_0x26d75e['include']=[{'all':!![]}];}_0x26d75e=_[_0x3c83('0x3c')]({},_0x26d75e,_0x43365f[_0x3c83('0x3f')]);return db[_0x3c83('0x2c')][_0x3c83('0x46')](_0x26d75e)[_0x3c83('0x26')](handleEntityNotFound(_0x7d086f,null))[_0x3c83('0x26')](respondWithResult(_0x7d086f,null))[_0x3c83('0x43')](handleError(_0x7d086f,null));};exports[_0x3c83('0x47')]=function(_0xd1bc94,_0x4f7819){return db['JscriptyAnswerReport'][_0x3c83('0x47')](_0xd1bc94[_0x3c83('0x48')],{})['then'](respondWithResult(_0x4f7819,0xc9))['catch'](handleError(_0x4f7819,null));};exports[_0x3c83('0x25')]=function(_0x510cc5,_0x1f0668){if(_0x510cc5[_0x3c83('0x48')]['id']){delete _0x510cc5[_0x3c83('0x48')]['id'];}return db['JscriptyAnswerReport'][_0x3c83('0x46')]({'where':{'id':_0x510cc5[_0x3c83('0x44')]['id']}})[_0x3c83('0x26')](handleEntityNotFound(_0x1f0668,null))[_0x3c83('0x26')](saveUpdates(_0x510cc5[_0x3c83('0x48')],null))[_0x3c83('0x26')](respondWithResult(_0x1f0668,null))[_0x3c83('0x43')](handleError(_0x1f0668,null));};exports[_0x3c83('0x27')]=function(_0xb3ef2e,_0x58100f){return db[_0x3c83('0x2c')][_0x3c83('0x46')]({'where':{'id':_0xb3ef2e[_0x3c83('0x44')]['id']}})['then'](handleEntityNotFound(_0x58100f,null))[_0x3c83('0x26')](removeEntity(_0x58100f,null))[_0x3c83('0x43')](handleError(_0x58100f,null));};exports['describe']=function(_0x3b9e12,_0x2db199){return db[_0x3c83('0x2c')][_0x3c83('0x49')]()[_0x3c83('0x26')](respondWithResult(_0x2db199,null))[_0x3c83('0x43')](handleError(_0x2db199,null));}; \ No newline at end of file +var _0xdfcf=['then','destroy','sendStatus','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','count','include','findAll','rows','catch','params','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','reject','save','update'];(function(_0x3d44ff,_0x12c54a){var _0x2f06f3=function(_0x3ed960){while(--_0x3ed960){_0x3d44ff['push'](_0x3d44ff['shift']());}};_0x2f06f3(++_0x12c54a);}(_0xdfcf,0xb7));var _0xfdfc=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xdfcf[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xfdfc('0x0'));var rimraf=require(_0xfdfc('0x1'));var zipdir=require(_0xfdfc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfdfc('0x3'));var BPromise=require(_0xfdfc('0x4'));var Mustache=require(_0xfdfc('0x5'));var util=require(_0xfdfc('0x6'));var path=require(_0xfdfc('0x7'));var sox=require(_0xfdfc('0x8'));var csv=require('to-csv');var ejs=require(_0xfdfc('0x9'));var fs=require('fs');var fs_extra=require(_0xfdfc('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfdfc('0xb'));var jsforce=require(_0xfdfc('0xc'));var deskjs=require(_0xfdfc('0xd'));var toCsv=require(_0xfdfc('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfdfc('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xfdfc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfdfc('0x11'));var logger=require(_0xfdfc('0x12'))(_0xfdfc('0x13'));var utils=require(_0xfdfc('0x14'));var config=require(_0xfdfc('0x15'));var licenseUtil=require(_0xfdfc('0x16'));var db=require(_0xfdfc('0x17'))['db'];function respondWithStatusCode(_0x4f44ca,_0x234a0f){_0x234a0f=_0x234a0f||0xcc;return function(_0x9484e4){if(_0x9484e4){return _0x4f44ca['sendStatus'](_0x234a0f);}return _0x4f44ca[_0xfdfc('0x18')](_0x234a0f)[_0xfdfc('0x19')]();};}function respondWithResult(_0x3b0861,_0xed01de){_0xed01de=_0xed01de||0xc8;return function(_0x479d57){if(_0x479d57){return _0x3b0861['status'](_0xed01de)[_0xfdfc('0x1a')](_0x479d57);}};}function respondWithFilteredResult(_0x295c93,_0x4ad81f){return function(_0x39e8cb){if(_0x39e8cb){var _0x268fcf=_0x39e8cb['count'],_0x20033f=_0x4ad81f[_0xfdfc('0x1b')],_0x5e5caf=_0x4ad81f[_0xfdfc('0x1b')]+_0x4ad81f[_0xfdfc('0x1c')],_0x25d0ee;if(_0x5e5caf>=_0x268fcf){_0x5e5caf=_0x268fcf;_0x25d0ee=0xc8;}else{_0x25d0ee=0xce;}_0x295c93[_0xfdfc('0x18')](_0x25d0ee);return _0x295c93[_0xfdfc('0x1d')]('Content-Range',_0x20033f+'-'+_0x5e5caf+'/'+_0x268fcf)[_0xfdfc('0x1a')](_0x39e8cb);}return null;};}function patchUpdates(_0x43dcf0){return function(_0x9722a0){try{jsonpatch['apply'](_0x9722a0,_0x43dcf0,!![]);}catch(_0x396d09){return BPromise[_0xfdfc('0x1e')](_0x396d09);}return _0x9722a0[_0xfdfc('0x1f')]();};}function saveUpdates(_0x2722a6,_0x5659cc){return function(_0x3f78c8){if(_0x3f78c8){return _0x3f78c8[_0xfdfc('0x20')](_0x2722a6)[_0xfdfc('0x21')](function(_0x4af079){return _0x4af079;});}return null;};}function removeEntity(_0x3510e1,_0x3e4e36){return function(_0x21b763){if(_0x21b763){return _0x21b763[_0xfdfc('0x22')]()['then'](function(){_0x3510e1[_0xfdfc('0x18')](0xcc)[_0xfdfc('0x19')]();});}};}function handleEntityNotFound(_0xe36946,_0xca0a31){return function(_0x5712ea){if(!_0x5712ea){_0xe36946[_0xfdfc('0x23')](0x194);}return _0x5712ea;};}function handleError(_0x4ccfe3,_0x128ac4){_0x128ac4=_0x128ac4||0x1f4;return function(_0x114841){logger['error'](_0x114841[_0xfdfc('0x24')]);if(_0x114841[_0xfdfc('0x25')]){delete _0x114841[_0xfdfc('0x25')];}_0x4ccfe3[_0xfdfc('0x18')](_0x128ac4)[_0xfdfc('0x26')](_0x114841);};}exports[_0xfdfc('0x27')]=function(_0x385d8a,_0x2a9ca0){var _0x29182d={},_0x42054d={},_0x31113d={'count':0x0,'rows':[]};var _0xdaecda=_[_0xfdfc('0x28')](db[_0xfdfc('0x29')][_0xfdfc('0x2a')],function(_0x1a822d){return{'name':_0x1a822d['fieldName'],'type':_0x1a822d['type'][_0xfdfc('0x2b')]};});_0x42054d[_0xfdfc('0x2c')]=_['map'](_0xdaecda,_0xfdfc('0x25'));_0x42054d[_0xfdfc('0x2d')]=_[_0xfdfc('0x2e')](_0x385d8a[_0xfdfc('0x2d')]);_0x42054d[_0xfdfc('0x2f')]=_[_0xfdfc('0x30')](_0x42054d[_0xfdfc('0x2c')],_0x42054d[_0xfdfc('0x2d')]);_0x29182d['attributes']=_[_0xfdfc('0x30')](_0x42054d[_0xfdfc('0x2c')],qs[_0xfdfc('0x31')](_0x385d8a[_0xfdfc('0x2d')][_0xfdfc('0x31')]));_0x29182d['attributes']=_0x29182d['attributes']['length']?_0x29182d[_0xfdfc('0x32')]:_0x42054d['model'];if(!_0x385d8a[_0xfdfc('0x2d')]['hasOwnProperty'](_0xfdfc('0x33'))){_0x29182d[_0xfdfc('0x1c')]=qs[_0xfdfc('0x1c')](_0x385d8a[_0xfdfc('0x2d')][_0xfdfc('0x1c')]);_0x29182d[_0xfdfc('0x1b')]=qs[_0xfdfc('0x1b')](_0x385d8a[_0xfdfc('0x2d')]['offset']);}_0x29182d[_0xfdfc('0x34')]=qs[_0xfdfc('0x35')](_0x385d8a[_0xfdfc('0x2d')]['sort']);_0x29182d[_0xfdfc('0x36')]=qs[_0xfdfc('0x2f')](_[_0xfdfc('0x37')](_0x385d8a[_0xfdfc('0x2d')],_0x42054d[_0xfdfc('0x2f')]),_0xdaecda);if(_0x385d8a[_0xfdfc('0x2d')]['filter']){_0x29182d[_0xfdfc('0x36')]=_[_0xfdfc('0x38')](_0x29182d['where'],{'$or':_[_0xfdfc('0x28')](_0xdaecda,function(_0x64db5e){if(_0x64db5e[_0xfdfc('0x39')]!==_0xfdfc('0x3a')){var _0x16617a={};_0x16617a[_0x64db5e[_0xfdfc('0x25')]]={'$like':'%'+_0x385d8a[_0xfdfc('0x2d')][_0xfdfc('0x3b')]+'%'};return _0x16617a;}})});}_0x29182d=_[_0xfdfc('0x38')]({},_0x29182d,_0x385d8a[_0xfdfc('0x3c')]);var _0x3f31f8={'where':_0x29182d[_0xfdfc('0x36')]};return db['JscriptyAnswerReport'][_0xfdfc('0x3d')](_0x3f31f8)['then'](function(_0x2091a7){_0x31113d[_0xfdfc('0x3d')]=_0x2091a7;if(_0x385d8a[_0xfdfc('0x2d')]['includeAll']){_0x29182d[_0xfdfc('0x3e')]=[{'all':!![]}];}return db[_0xfdfc('0x29')][_0xfdfc('0x3f')](_0x29182d);})[_0xfdfc('0x21')](function(_0x3f7b95){_0x31113d[_0xfdfc('0x40')]=_0x3f7b95;return _0x31113d;})[_0xfdfc('0x21')](respondWithFilteredResult(_0x2a9ca0,_0x29182d))[_0xfdfc('0x41')](handleError(_0x2a9ca0,null));};exports['show']=function(_0x22bba8,_0x20c515){var _0xaf6add={'raw':!![],'where':{'id':_0x22bba8[_0xfdfc('0x42')]['id']}},_0x3c6294={};_0x3c6294[_0xfdfc('0x2c')]=_[_0xfdfc('0x2e')](db[_0xfdfc('0x29')][_0xfdfc('0x2a')]);_0x3c6294['query']=_[_0xfdfc('0x2e')](_0x22bba8['query']);_0x3c6294[_0xfdfc('0x2f')]=_[_0xfdfc('0x30')](_0x3c6294[_0xfdfc('0x2c')],_0x3c6294[_0xfdfc('0x2d')]);_0xaf6add[_0xfdfc('0x32')]=_['intersection'](_0x3c6294['model'],qs[_0xfdfc('0x31')](_0x22bba8['query'][_0xfdfc('0x31')]));_0xaf6add[_0xfdfc('0x32')]=_0xaf6add[_0xfdfc('0x32')]['length']?_0xaf6add[_0xfdfc('0x32')]:_0x3c6294['model'];if(_0x22bba8[_0xfdfc('0x2d')][_0xfdfc('0x43')]){_0xaf6add[_0xfdfc('0x3e')]=[{'all':!![]}];}_0xaf6add=_[_0xfdfc('0x38')]({},_0xaf6add,_0x22bba8['options']);return db[_0xfdfc('0x29')]['find'](_0xaf6add)[_0xfdfc('0x21')](handleEntityNotFound(_0x20c515,null))['then'](respondWithResult(_0x20c515,null))[_0xfdfc('0x41')](handleError(_0x20c515,null));};exports[_0xfdfc('0x44')]=function(_0x5eab8f,_0x47d132){return db[_0xfdfc('0x29')]['create'](_0x5eab8f[_0xfdfc('0x45')],{})['then'](respondWithResult(_0x47d132,0xc9))[_0xfdfc('0x41')](handleError(_0x47d132,null));};exports[_0xfdfc('0x20')]=function(_0x3a1bb4,_0x1ab861){if(_0x3a1bb4['body']['id']){delete _0x3a1bb4[_0xfdfc('0x45')]['id'];}return db[_0xfdfc('0x29')][_0xfdfc('0x46')]({'where':{'id':_0x3a1bb4[_0xfdfc('0x42')]['id']}})[_0xfdfc('0x21')](handleEntityNotFound(_0x1ab861,null))[_0xfdfc('0x21')](saveUpdates(_0x3a1bb4[_0xfdfc('0x45')],null))[_0xfdfc('0x21')](respondWithResult(_0x1ab861,null))['catch'](handleError(_0x1ab861,null));};exports[_0xfdfc('0x22')]=function(_0x7b34bf,_0x3b803e){return db[_0xfdfc('0x29')][_0xfdfc('0x46')]({'where':{'id':_0x7b34bf[_0xfdfc('0x42')]['id']}})[_0xfdfc('0x21')](handleEntityNotFound(_0x3b803e,null))[_0xfdfc('0x21')](removeEntity(_0x3b803e,null))[_0xfdfc('0x41')](handleError(_0x3b803e,null));};exports[_0xfdfc('0x47')]=function(_0x3623f6,_0x4219f8){return db[_0xfdfc('0x29')]['describe']()[_0xfdfc('0x21')](respondWithResult(_0x4219f8,null))[_0xfdfc('0x41')](handleError(_0x4219f8,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 9eafc62..cb78ea4 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 _0x1733=['exports','define','report_jscripty_answers','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x51f920,_0x3b4747){var _0x382843=function(_0x3f529d){while(--_0x3f529d){_0x51f920['push'](_0x51f920['shift']());}};_0x382843(++_0x3b4747);}(_0x1733,0x9f));var _0x3173=function(_0x9b724c,_0x56cc20){_0x9b724c=_0x9b724c-0x0;var _0x5ad180=_0x1733[_0x9b724c];return _0x5ad180;};'use strict';var _=require('lodash');var util=require(_0x3173('0x0'));var logger=require(_0x3173('0x1'))(_0x3173('0x2'));var moment=require(_0x3173('0x3'));var BPromise=require(_0x3173('0x4'));var rp=require(_0x3173('0x5'));var fs=require('fs');var path=require(_0x3173('0x6'));var rimraf=require('rimraf');var config=require(_0x3173('0x7'));var attributes=require(_0x3173('0x8'));module[_0x3173('0x9')]=function(_0x28bc82,_0x407362){return _0x28bc82[_0x3173('0xa')]('JscriptyAnswerReport',attributes,{'tableName':_0x3173('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe837=['../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','api','moment','request-promise','path','rimraf'];(function(_0x2fe1a2,_0x4419da){var _0xb5fa97=function(_0x2a9f93){while(--_0x2a9f93){_0x2fe1a2['push'](_0x2fe1a2['shift']());}};_0xb5fa97(++_0x4419da);}(_0xe837,0xe2));var _0x7e83=function(_0x261b8a,_0x553ec4){_0x261b8a=_0x261b8a-0x0;var _0x3455e8=_0xe837[_0x261b8a];return _0x3455e8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7e83('0x0'));var moment=require(_0x7e83('0x1'));var BPromise=require('bluebird');var rp=require(_0x7e83('0x2'));var fs=require('fs');var path=require(_0x7e83('0x3'));var rimraf=require(_0x7e83('0x4'));var config=require(_0x7e83('0x5'));var attributes=require(_0x7e83('0x6'));module[_0x7e83('0x7')]=function(_0x4fd69c,_0x5ac049){return _0x4fd69c[_0x7e83('0x8')](_0x7e83('0x9'),attributes,{'tableName':_0x7e83('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 00f9f05..1baeba8 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 _0xa5f1=['../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x3c22f2,_0x16267e){var _0x2e398a=function(_0x48d31e){while(--_0x48d31e){_0x3c22f2['push'](_0x3c22f2['shift']());}};_0x2e398a(++_0x16267e);}(_0xa5f1,0x8d));var _0x1a5f=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa5f1[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x1a5f('0x0'));var util=require(_0x1a5f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1a5f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1a5f('0x3'));var logger=require(_0x1a5f('0x4'))(_0x1a5f('0x5'));var config=require(_0x1a5f('0x6'));var jayson=require(_0x1a5f('0x7'));var client=jayson[_0x1a5f('0x8')][_0x1a5f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2813b6,_0x2ca505,_0x2378fa){return new BPromise(function(_0x52ecc4,_0x288ba4){return client[_0x1a5f('0xa')](_0x2813b6,_0x2378fa)[_0x1a5f('0xb')](function(_0x2fea71){logger[_0x1a5f('0xc')](_0x1a5f('0xd'),_0x2ca505,_0x1a5f('0xe'));logger['debug'](_0x1a5f('0xf'),_0x2ca505,_0x1a5f('0xe'),JSON['stringify'](_0x2fea71));if(_0x2fea71['error']){if(_0x2fea71[_0x1a5f('0x10')][_0x1a5f('0x11')]===0x1f4){logger[_0x1a5f('0x10')](_0x1a5f('0xd'),_0x2ca505,_0x2fea71[_0x1a5f('0x10')][_0x1a5f('0x12')]);return _0x288ba4(_0x2fea71[_0x1a5f('0x10')]['message']);}logger['error'](_0x1a5f('0xd'),_0x2ca505,_0x2fea71['error'][_0x1a5f('0x12')]);return _0x52ecc4(_0x2fea71['error']['message']);}else{logger[_0x1a5f('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2ca505,_0x1a5f('0xe'));_0x52ecc4(_0x2fea71[_0x1a5f('0x13')][_0x1a5f('0x12')]);}})[_0x1a5f('0x14')](function(_0x1dcecf){logger[_0x1a5f('0x10')](_0x1a5f('0xd'),_0x2ca505,_0x1dcecf);_0x288ba4(_0x1dcecf);});});} \ No newline at end of file +var _0xf5df=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','lodash','util'];(function(_0x54238c,_0x2ac5dc){var _0x5c31ef=function(_0x58167a){while(--_0x58167a){_0x54238c['push'](_0x54238c['shift']());}};_0x5c31ef(++_0x2ac5dc);}(_0xf5df,0x13e));var _0xff5d=function(_0x476d61,_0x22f686){_0x476d61=_0x476d61-0x0;var _0xc31b7f=_0xf5df[_0x476d61];return _0xc31b7f;};'use strict';var _=require(_0xff5d('0x0'));var util=require(_0xff5d('0x1'));var moment=require(_0xff5d('0x2'));var BPromise=require(_0xff5d('0x3'));var rs=require(_0xff5d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff5d('0x5'))['db'];var utils=require(_0xff5d('0x6'));var logger=require(_0xff5d('0x7'))(_0xff5d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xff5d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1433f4,_0x6b0cc6,_0x29bcac){return new BPromise(function(_0x376e14,_0xca9090){return client[_0xff5d('0xa')](_0x1433f4,_0x29bcac)[_0xff5d('0xb')](function(_0x1efbac){logger['info'](_0xff5d('0xc'),_0x6b0cc6,_0xff5d('0xd'));logger[_0xff5d('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x6b0cc6,'request\x20sent',JSON['stringify'](_0x1efbac));if(_0x1efbac[_0xff5d('0xf')]){if(_0x1efbac[_0xff5d('0xf')]['code']===0x1f4){logger[_0xff5d('0xf')](_0xff5d('0xc'),_0x6b0cc6,_0x1efbac[_0xff5d('0xf')][_0xff5d('0x10')]);return _0xca9090(_0x1efbac[_0xff5d('0xf')][_0xff5d('0x10')]);}logger[_0xff5d('0xf')](_0xff5d('0xc'),_0x6b0cc6,_0x1efbac[_0xff5d('0xf')][_0xff5d('0x10')]);return _0x376e14(_0x1efbac[_0xff5d('0xf')][_0xff5d('0x10')]);}else{logger[_0xff5d('0x11')](_0xff5d('0xc'),_0x6b0cc6,_0xff5d('0xd'));_0x376e14(_0x1efbac[_0xff5d('0x12')][_0xff5d('0x10')]);}})[_0xff5d('0x13')](function(_0x58a299){logger[_0xff5d('0xf')](_0xff5d('0xc'),_0x6b0cc6,_0x58a299);_0xca9090(_0x58a299);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index f4d9bf9..c0747fa 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 _0x07e8=['fs-extra','../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','/:id/clone','clone','put','destroy','exports','multer','util','path','express'];(function(_0x253f2a,_0x2c51f2){var _0x1c15f5=function(_0x446493){while(--_0x446493){_0x253f2a['push'](_0x253f2a['shift']());}};_0x1c15f5(++_0x2c51f2);}(_0x07e8,0x10f));var _0x807e=function(_0x1df0b6,_0x4a8040){_0x1df0b6=_0x1df0b6-0x0;var _0x866f9f=_0x07e8[_0x1df0b6];return _0x866f9f;};'use strict';var multer=require(_0x807e('0x0'));var util=require(_0x807e('0x1'));var path=require(_0x807e('0x2'));var timeout=require('connect-timeout');var express=require(_0x807e('0x3'));var router=express['Router']();var fs_extra=require(_0x807e('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x807e('0x5'));var controller=require(_0x807e('0x6'));router[_0x807e('0x7')]('/',auth['isAuthenticated'](),controller[_0x807e('0x8')]);router[_0x807e('0x7')](_0x807e('0x9'),auth[_0x807e('0xa')](),controller[_0x807e('0xb')]);router['get'](_0x807e('0xc'),auth[_0x807e('0xa')](),controller[_0x807e('0xd')]);router[_0x807e('0x7')](_0x807e('0xe'),auth[_0x807e('0xa')](),controller[_0x807e('0xf')]);router[_0x807e('0x7')](_0x807e('0x10'),auth[_0x807e('0xa')](),timeout(_0x807e('0x11')),controller[_0x807e('0x12')]);router[_0x807e('0x13')]('/',auth[_0x807e('0xa')](),controller['create']);router[_0x807e('0x13')](_0x807e('0x14'),auth[_0x807e('0xa')](),controller[_0x807e('0x15')]);router[_0x807e('0x16')](_0x807e('0x9'),auth[_0x807e('0xa')](),controller['update']);router['delete'](_0x807e('0x9'),auth[_0x807e('0xa')](),controller[_0x807e('0x17')]);module[_0x807e('0x18')]=router; \ No newline at end of file +var _0x958a=['/:id/summary','30s','getSummary','post','clone','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getSessions','/:id/answers','getAnswers'];(function(_0x5aead0,_0x3a8c8e){var _0x3306fb=function(_0x18c478){while(--_0x18c478){_0x5aead0['push'](_0x5aead0['shift']());}};_0x3306fb(++_0x3a8c8e);}(_0x958a,0x128));var _0xa958=function(_0x341f15,_0x389b2f){_0x341f15=_0x341f15-0x0;var _0x1d11ad=_0x958a[_0x341f15];return _0x1d11ad;};'use strict';var multer=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var path=require('path');var timeout=require(_0xa958('0x2'));var express=require(_0xa958('0x3'));var router=express[_0xa958('0x4')]();var fs_extra=require(_0xa958('0x5'));var auth=require(_0xa958('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa958('0x7'));var controller=require('./jscriptyProject.controller');router[_0xa958('0x8')]('/',auth[_0xa958('0x9')](),controller[_0xa958('0xa')]);router[_0xa958('0x8')](_0xa958('0xb'),auth[_0xa958('0x9')](),controller[_0xa958('0xc')]);router['get']('/:id/sessions',auth[_0xa958('0x9')](),controller[_0xa958('0xd')]);router[_0xa958('0x8')](_0xa958('0xe'),auth[_0xa958('0x9')](),controller[_0xa958('0xf')]);router[_0xa958('0x8')](_0xa958('0x10'),auth[_0xa958('0x9')](),timeout(_0xa958('0x11')),controller[_0xa958('0x12')]);router[_0xa958('0x13')]('/',auth[_0xa958('0x9')](),controller['create']);router['post']('/:id/clone',auth[_0xa958('0x9')](),controller[_0xa958('0x14')]);router[_0xa958('0x15')]('/:id',auth[_0xa958('0x9')](),controller['update']);router['delete']('/:id',auth[_0xa958('0x9')](),controller[_0xa958('0x16')]);module[_0xa958('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index f6498ad..144f4f6 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 _0x079b=['exports','STRING','name','TEXT','long','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x079b,0xb8));var _0xb079=function(_0x525b28,_0x5cf5a0){_0x525b28=_0x525b28-0x0;var _0x180178=_0x079b[_0x525b28];return _0x180178;};'use strict';var Sequelize=require(_0xb079('0x0'));var _=require(_0xb079('0x1'));var util=require(_0xb079('0x2'));module[_0xb079('0x3')]={'name':{'type':Sequelize[_0xb079('0x4')],'unique':_0xb079('0x5')},'description':{'type':Sequelize[_0xb079('0x4')]},'formData':{'type':Sequelize[_0xb079('0x6')](_0xb079('0x7')),'set':function(_0x1f91aa){if(_['isObjectLike'](_0x1f91aa)){this[_0xb079('0x8')](_0xb079('0x9'),JSON[_0xb079('0xa')](_0x1f91aa));}else if(_[_0xb079('0xb')](_0x1f91aa)){this['setDataValue']('formData',_0x1f91aa);}else{this[_0xb079('0x8')](_0xb079('0x9'),util[_0xb079('0xc')](_0xb079('0xd'),this['getDataValue'](_0xb079('0x5'))||'',this[_0xb079('0xe')](_0xb079('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xb079('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6600=['isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','description','BOOLEAN','sequelize','lodash','exports','STRING','TEXT','long','isObjectLike','formData','stringify'];(function(_0x50cc38,_0x5c0cad){var _0x4cea2d=function(_0x1e1e56){while(--_0x1e1e56){_0x50cc38['push'](_0x50cc38['shift']());}};_0x4cea2d(++_0x5c0cad);}(_0x6600,0x90));var _0x0660=function(_0x3f14f4,_0x43c650){_0x3f14f4=_0x3f14f4-0x0;var _0x5f00d5=_0x6600[_0x3f14f4];return _0x5f00d5;};'use strict';var Sequelize=require(_0x0660('0x0'));var _=require(_0x0660('0x1'));var util=require('util');module[_0x0660('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x0660('0x3')]},'formData':{'type':Sequelize[_0x0660('0x4')](_0x0660('0x5')),'set':function(_0x167f77){if(_[_0x0660('0x6')](_0x167f77)){this['setDataValue'](_0x0660('0x7'),JSON[_0x0660('0x8')](_0x167f77));}else if(_[_0x0660('0x9')](_0x167f77)){this[_0x0660('0xa')]('formData',_0x167f77);}else{this['setDataValue'](_0x0660('0x7'),util[_0x0660('0xb')](_0x0660('0xc'),this[_0x0660('0xd')](_0x0660('0xe'))||'',this[_0x0660('0xd')](_0x0660('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x0660('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x0660('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 0e7de17..199c14d 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 _0x00bb=['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','sendStatus','status','json','count','offset','limit','set','apply','save','update','then','destroy','get','Projects','UserProfileResource','end','error','stack','name','send','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','length','options','find','user','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','body','updatedAt','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','findAll','fromCharCode','indexOf','toString','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','format','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','request-promise'];(function(_0x21ffba,_0x1a5145){var _0x3394a3=function(_0x57642b){while(--_0x57642b){_0x21ffba['push'](_0x21ffba['shift']());}};_0x3394a3(++_0x1a5145);}(_0x00bb,0x1d8));var _0xb00b=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x00bb[_0x28947d];return _0x12d2ee;};'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'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=_0x9b471e[_0xb00b('0x18')],_0x51d136=_0x5da36b[_0xb00b('0x19')],_0x1f9c78=_0x5da36b['offset']+_0x5da36b[_0xb00b('0x1a')],_0x638443;if(_0x1f9c78>=_0x4dcd45){_0x1f9c78=_0x4dcd45;_0x638443=0xc8;}else{_0x638443=0xce;}_0x540b79['status'](_0x638443);return _0x540b79[_0xb00b('0x1b')]('Content-Range',_0x51d136+'-'+_0x1f9c78+'/'+_0x4dcd45)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x5e8d7b){return function(_0xb26ebb){try{jsonpatch[_0xb00b('0x1c')](_0xb26ebb,_0x5e8d7b,!![]);}catch(_0x53ee68){return BPromise['reject'](_0x53ee68);}return _0xb26ebb[_0xb00b('0x1d')]();};}function saveUpdates(_0x4a334b,_0x1344c4){return function(_0x43da66){if(_0x43da66){return _0x43da66[_0xb00b('0x1e')](_0x4a334b)[_0xb00b('0x1f')](function(_0x56c189){return _0x56c189;});}return null;};}function removeEntity(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x20')]()['then'](function(){var _0x231293=_0x25a973[_0xb00b('0x21')]({'plain':!![]});var _0x520444=_0xb00b('0x22');return db[_0xb00b('0x23')]['destroy']({'where':{'type':_0x520444,'resourceId':_0x231293['id']}})[_0xb00b('0x1f')](function(){return _0x25a973;});})[_0xb00b('0x1f')](function(){_0x362ee0[_0xb00b('0x16')](0xcc)[_0xb00b('0x24')]();});}};}function handleEntityNotFound(_0x520e55,_0x50be6c){return function(_0x3785e9){if(!_0x3785e9){_0x520e55['sendStatus'](0x194);}return _0x3785e9;};}function handleError(_0x550587,_0x4a635e){_0x4a635e=_0x4a635e||0x1f4;return function(_0x16ac55){logger[_0xb00b('0x25')](_0x16ac55[_0xb00b('0x26')]);if(_0x16ac55[_0xb00b('0x27')]){delete _0x16ac55[_0xb00b('0x27')];}_0x550587[_0xb00b('0x16')](_0x4a635e)[_0xb00b('0x28')](_0x16ac55);};}exports['index']=function(_0x22c22d,_0x503c9c){var _0x450129={},_0x348165={},_0x5424ca={'count':0x0,'rows':[]};var _0x5b987e=_[_0xb00b('0x29')](db[_0xb00b('0x2a')][_0xb00b('0x2b')],function(_0x183233){return{'name':_0x183233[_0xb00b('0x2c')],'type':_0x183233[_0xb00b('0x2d')][_0xb00b('0x2e')]};});_0x348165[_0xb00b('0x2f')]=_[_0xb00b('0x29')](_0x5b987e,'name');_0x348165[_0xb00b('0x30')]=_[_0xb00b('0x31')](_0x22c22d['query']);_0x348165[_0xb00b('0x32')]=_[_0xb00b('0x33')](_0x348165['model'],_0x348165[_0xb00b('0x30')]);_0x450129['attributes']=_[_0xb00b('0x33')](_0x348165[_0xb00b('0x2f')],qs[_0xb00b('0x34')](_0x22c22d[_0xb00b('0x30')][_0xb00b('0x34')]));_0x450129[_0xb00b('0x35')]=_0x450129[_0xb00b('0x35')]['length']?_0x450129['attributes']:_0x348165['model'];if(!_0x22c22d[_0xb00b('0x30')][_0xb00b('0x36')](_0xb00b('0x37'))){_0x450129[_0xb00b('0x1a')]=qs['limit'](_0x22c22d[_0xb00b('0x30')][_0xb00b('0x1a')]);_0x450129[_0xb00b('0x19')]=qs[_0xb00b('0x19')](_0x22c22d[_0xb00b('0x30')][_0xb00b('0x19')]);}_0x450129[_0xb00b('0x38')]=qs[_0xb00b('0x39')](_0x22c22d['query']['sort']);_0x450129[_0xb00b('0x3a')]=qs['filters'](_[_0xb00b('0x3b')](_0x22c22d[_0xb00b('0x30')],_0x348165[_0xb00b('0x32')]),_0x5b987e);if(_0x22c22d[_0xb00b('0x30')][_0xb00b('0x3c')]){_0x450129[_0xb00b('0x3a')]=_[_0xb00b('0x3d')](_0x450129['where'],{'$or':_[_0xb00b('0x29')](_0x5b987e,function(_0x25578e){if(_0x25578e[_0xb00b('0x2d')]!==_0xb00b('0x3e')){var _0x2496e2={};_0x2496e2[_0x25578e[_0xb00b('0x27')]]={'$like':'%'+_0x22c22d['query'][_0xb00b('0x3c')]+'%'};return _0x2496e2;}})});}_0x450129=_[_0xb00b('0x3d')]({},_0x450129,_0x22c22d['options']);var _0x17ff34={'where':_0x450129[_0xb00b('0x3a')]};return db[_0xb00b('0x2a')][_0xb00b('0x18')](_0x17ff34)[_0xb00b('0x1f')](function(_0x5636b1){_0x5424ca[_0xb00b('0x18')]=_0x5636b1;if(_0x22c22d[_0xb00b('0x30')][_0xb00b('0x3f')]){_0x450129[_0xb00b('0x40')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x450129);})[_0xb00b('0x1f')](function(_0xf6ae0c){_0x5424ca[_0xb00b('0x41')]=_0xf6ae0c;return _0x5424ca;})[_0xb00b('0x1f')](respondWithFilteredResult(_0x503c9c,_0x450129))[_0xb00b('0x42')](handleError(_0x503c9c,null));};exports[_0xb00b('0x43')]=function(_0x275664,_0x493841){var _0x36200d={'raw':![],'where':{'id':_0x275664[_0xb00b('0x44')]['id']}},_0x3b72c4={};_0x3b72c4[_0xb00b('0x2f')]=_[_0xb00b('0x31')](db[_0xb00b('0x2a')][_0xb00b('0x2b')]);_0x3b72c4[_0xb00b('0x30')]=_[_0xb00b('0x31')](_0x275664[_0xb00b('0x30')]);_0x3b72c4[_0xb00b('0x32')]=_[_0xb00b('0x33')](_0x3b72c4['model'],_0x3b72c4[_0xb00b('0x30')]);_0x36200d[_0xb00b('0x35')]=_[_0xb00b('0x33')](_0x3b72c4[_0xb00b('0x2f')],qs[_0xb00b('0x34')](_0x275664[_0xb00b('0x30')][_0xb00b('0x34')]));_0x36200d[_0xb00b('0x35')]=_0x36200d[_0xb00b('0x35')][_0xb00b('0x45')]?_0x36200d[_0xb00b('0x35')]:_0x3b72c4[_0xb00b('0x2f')];if(_0x275664['query']['includeAll']){_0x36200d['include']=[{'all':!![]}];}_0x36200d=_[_0xb00b('0x3d')]({},_0x36200d,_0x275664[_0xb00b('0x46')]);return db['JscriptyProject'][_0xb00b('0x47')](_0x36200d)[_0xb00b('0x1f')](handleEntityNotFound(_0x493841,null))[_0xb00b('0x1f')](respondWithResult(_0x493841,null))[_0xb00b('0x42')](handleError(_0x493841,null));};exports['create']=function(_0x58e9cb,_0x172729){return db[_0xb00b('0x2a')]['create'](_0x58e9cb['body'],{})[_0xb00b('0x1f')](function(_0x3a205d){var _0x4e0be4=_0x58e9cb[_0xb00b('0x48')]['get']({'plain':!![]});if(!_0x4e0be4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e0be4['role']===_0xb00b('0x48')){var _0x481515=_0x3a205d[_0xb00b('0x21')]({'plain':!![]});var _0x3178aa=_0xb00b('0x22');return db[_0xb00b('0x49')][_0xb00b('0x47')]({'where':{'name':_0x3178aa,'userProfileId':_0x4e0be4[_0xb00b('0x4a')]},'raw':!![]})['then'](function(_0x5bd40c){if(_0x5bd40c&&_0x5bd40c[_0xb00b('0x4b')]===0x0){return db[_0xb00b('0x23')]['create']({'name':_0x481515[_0xb00b('0x27')],'resourceId':_0x481515['id'],'type':_0x5bd40c[_0xb00b('0x27')],'sectionId':_0x5bd40c['id']},{})['then'](function(){return _0x3a205d;});}else{return _0x3a205d;}})[_0xb00b('0x42')](function(_0x10e066){logger[_0xb00b('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10e066);throw _0x10e066;});}return _0x3a205d;})['then'](respondWithResult(_0x172729,0xc9))[_0xb00b('0x42')](handleError(_0x172729,null));};exports[_0xb00b('0x4c')]=function(_0x12737d,_0xde3cc1){var _0x489b49={'where':{'id':_0x12737d[_0xb00b('0x44')]['id']}},_0x380acb={};_0x380acb['model']=_['keys'](db[_0xb00b('0x2a')]['rawAttributes']);_0x489b49[_0xb00b('0x35')]=_[_0xb00b('0x33')](_0x380acb[_0xb00b('0x2f')],qs[_0xb00b('0x34')](_0x12737d[_0xb00b('0x30')][_0xb00b('0x34')]));_0x489b49['attributes']=_0x489b49[_0xb00b('0x35')]['length']?_0x489b49[_0xb00b('0x35')]:_0x380acb[_0xb00b('0x2f')];if(_0x12737d[_0xb00b('0x30')]['includeAll']){_0x489b49[_0xb00b('0x40')]=[{'all':!![]}];}_0x489b49=_[_0xb00b('0x3d')]({},_0x489b49,_0x12737d[_0xb00b('0x46')]);return db['JscriptyProject'][_0xb00b('0x47')](_0x489b49)[_0xb00b('0x1f')](handleEntityNotFound(_0xde3cc1,null))[_0xb00b('0x1f')](function(_0x385029){if(_0x385029){var _0x131848=_0x385029[_0xb00b('0x21')]({'plain':!![]});_0x131848=qs[_0xb00b('0x4d')](_0x131848,['id',_0xb00b('0x4e'),'updatedAt']);_0x12737d[_0xb00b('0x4f')]=_[_0xb00b('0x4d')](_0x12737d[_0xb00b('0x4f')],['id','createdAt',_0xb00b('0x50')]);return db[_0xb00b('0x2a')][_0xb00b('0x51')](_[_0xb00b('0x3d')](_0x131848,_0x12737d[_0xb00b('0x4f')]),{'include':_0x12737d['query'][_0xb00b('0x3f')]?[{'all':!![]}]:undefined})[_0xb00b('0x1f')](function(_0x2e3c56){var _0x1cad79=_0x12737d['user'][_0xb00b('0x21')]({'plain':!![]});if(!_0x1cad79)throw new Error(_0xb00b('0x52'));if(_0x1cad79[_0xb00b('0x53')]===_0xb00b('0x48')){var _0x161216=_0x2e3c56[_0xb00b('0x21')]({'plain':!![]});var _0x2f2032='Projects';return db[_0xb00b('0x49')]['find']({'where':{'name':_0x2f2032,'userProfileId':_0x1cad79[_0xb00b('0x4a')]},'raw':!![]})['then'](function(_0x3b3272){if(_0x3b3272&&_0x3b3272['autoAssociation']===0x0){return db[_0xb00b('0x23')]['create']({'name':_0x161216[_0xb00b('0x27')],'resourceId':_0x161216['id'],'type':_0x3b3272[_0xb00b('0x27')],'sectionId':_0x3b3272['id']},{})[_0xb00b('0x1f')](function(){return _0x2e3c56;});}else{return _0x2e3c56;}})['catch'](function(_0x51fbe2){logger['error'](_0xb00b('0x54'),_0x51fbe2);throw _0x51fbe2;});}return _0x2e3c56;});}})[_0xb00b('0x1f')](respondWithResult(_0xde3cc1,0xc9))[_0xb00b('0x42')](handleError(_0xde3cc1,null));};exports['update']=function(_0x311f49,_0x37ae88){if(_0x311f49[_0xb00b('0x4f')]['id']){delete _0x311f49[_0xb00b('0x4f')]['id'];}return db[_0xb00b('0x2a')]['find']({'where':{'id':_0x311f49[_0xb00b('0x44')]['id']}})[_0xb00b('0x1f')](handleEntityNotFound(_0x37ae88,null))['then'](saveUpdates(_0x311f49[_0xb00b('0x4f')],null))[_0xb00b('0x1f')](respondWithResult(_0x37ae88,null))[_0xb00b('0x42')](handleError(_0x37ae88,null));};exports['destroy']=function(_0x4e8b85,_0x359669){return db[_0xb00b('0x2a')][_0xb00b('0x47')]({'where':{'id':_0x4e8b85['params']['id']}})['then'](handleEntityNotFound(_0x359669,null))['then'](removeEntity(_0x359669,null))['catch'](handleError(_0x359669,null));};exports[_0xb00b('0x55')]=function(_0x4df7fa,_0x2434a0,_0x30c0a7){var _0x53dd22={'raw':!![],'where':{}};var _0x7523d5={};var _0x1e7f3a={'count':0x0,'rows':[]};return db[_0xb00b('0x2a')][_0xb00b('0x56')]({'where':{'id':_0x4df7fa[_0xb00b('0x44')]['id']}})['then'](handleEntityNotFound(_0x2434a0,null))[_0xb00b('0x1f')](function(_0x851800){if(_0x851800){_0x7523d5[_0xb00b('0x2f')]=_[_0xb00b('0x31')](db[_0xb00b('0x57')][_0xb00b('0x2b')]);_0x7523d5[_0xb00b('0x30')]=_['keys'](_0x4df7fa[_0xb00b('0x30')]);_0x7523d5[_0xb00b('0x32')]=_[_0xb00b('0x33')](_0x7523d5[_0xb00b('0x2f')],_0x7523d5[_0xb00b('0x30')]);_0x53dd22[_0xb00b('0x35')]=_[_0xb00b('0x33')](_0x7523d5[_0xb00b('0x2f')],qs['fields'](_0x4df7fa[_0xb00b('0x30')][_0xb00b('0x34')]));_0x53dd22[_0xb00b('0x35')]=_0x53dd22[_0xb00b('0x35')][_0xb00b('0x45')]?_0x53dd22[_0xb00b('0x35')]:_0x7523d5[_0xb00b('0x2f')];if(!_0x4df7fa[_0xb00b('0x30')]['hasOwnProperty'](_0xb00b('0x37'))){_0x53dd22[_0xb00b('0x1a')]=qs[_0xb00b('0x1a')](_0x4df7fa[_0xb00b('0x30')][_0xb00b('0x1a')]);_0x53dd22[_0xb00b('0x19')]=qs[_0xb00b('0x19')](_0x4df7fa['query'][_0xb00b('0x19')]);}_0x53dd22[_0xb00b('0x38')]=qs[_0xb00b('0x39')](_0x4df7fa[_0xb00b('0x30')][_0xb00b('0x39')]);_0x53dd22[_0xb00b('0x3a')]=qs['filters'](_[_0xb00b('0x3b')](_0x4df7fa['query'],_0x7523d5[_0xb00b('0x32')]));_0x53dd22['where'][_0xb00b('0x58')]=_0x851800['id'];if(_0x4df7fa[_0xb00b('0x30')][_0xb00b('0x3c')]){_0x53dd22['where']=_['merge'](_0x53dd22[_0xb00b('0x3a')],{'$or':_[_0xb00b('0x29')](_0x53dd22[_0xb00b('0x35')],function(_0x355958){var _0x36b3a2={};_0x36b3a2[_0x355958]={'$like':'%'+_0x4df7fa[_0xb00b('0x30')][_0xb00b('0x3c')]+'%'};return _0x36b3a2;})});}_0x53dd22=_[_0xb00b('0x3d')]({},_0x53dd22,_0x4df7fa[_0xb00b('0x46')]);return db[_0xb00b('0x57')][_0xb00b('0x18')]({'where':_0x53dd22[_0xb00b('0x3a')]})[_0xb00b('0x1f')](function(_0x2e65ce){_0x1e7f3a['count']=_0x2e65ce;if(_0x4df7fa['query'][_0xb00b('0x3f')]){_0x53dd22[_0xb00b('0x40')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x53dd22);})[_0xb00b('0x1f')](function(_0x391e98){_0x1e7f3a[_0xb00b('0x41')]=_0x391e98;return _0x1e7f3a;});}})['then'](respondWithFilteredResult(_0x2434a0,_0x53dd22))[_0xb00b('0x42')](handleError(_0x2434a0,null));};exports[_0xb00b('0x59')]=function(_0x13a059,_0x45c9cd,_0x42b904){var _0x2082e6={'raw':!![],'where':{}};var _0x3113e9={};var _0x4a9125={'count':0x0,'rows':[]};return db[_0xb00b('0x2a')]['findOne']({'where':{'id':_0x13a059[_0xb00b('0x44')]['id']}})[_0xb00b('0x1f')](handleEntityNotFound(_0x45c9cd,null))['then'](function(_0xcef063){if(_0xcef063){_0x3113e9[_0xb00b('0x2f')]=_[_0xb00b('0x31')](db[_0xb00b('0x5a')][_0xb00b('0x2b')]);_0x3113e9[_0xb00b('0x30')]=_[_0xb00b('0x31')](_0x13a059[_0xb00b('0x30')]);_0x3113e9[_0xb00b('0x32')]=_[_0xb00b('0x33')](_0x3113e9[_0xb00b('0x2f')],_0x3113e9[_0xb00b('0x30')]);_0x2082e6['attributes']=_[_0xb00b('0x33')](_0x3113e9[_0xb00b('0x2f')],qs[_0xb00b('0x34')](_0x13a059[_0xb00b('0x30')]['fields']));_0x2082e6[_0xb00b('0x35')]=_0x2082e6[_0xb00b('0x35')][_0xb00b('0x45')]?_0x2082e6[_0xb00b('0x35')]:_0x3113e9[_0xb00b('0x2f')];if(!_0x13a059['query'][_0xb00b('0x36')](_0xb00b('0x37'))){_0x2082e6[_0xb00b('0x1a')]=qs[_0xb00b('0x1a')](_0x13a059['query'][_0xb00b('0x1a')]);_0x2082e6['offset']=qs[_0xb00b('0x19')](_0x13a059[_0xb00b('0x30')][_0xb00b('0x19')]);}_0x2082e6[_0xb00b('0x38')]=qs[_0xb00b('0x39')](_0x13a059[_0xb00b('0x30')][_0xb00b('0x39')]);_0x2082e6[_0xb00b('0x3a')]=qs[_0xb00b('0x32')](_[_0xb00b('0x3b')](_0x13a059[_0xb00b('0x30')],_0x3113e9['filters']));_0x2082e6[_0xb00b('0x3a')][_0xb00b('0x58')]=_0xcef063['id'];if(_0x13a059[_0xb00b('0x30')][_0xb00b('0x3c')]){_0x2082e6['where']=_[_0xb00b('0x3d')](_0x2082e6[_0xb00b('0x3a')],{'$or':_['map'](_0x2082e6[_0xb00b('0x35')],function(_0x4b0278){var _0x3caf51={};_0x3caf51[_0x4b0278]={'$like':'%'+_0x13a059[_0xb00b('0x30')][_0xb00b('0x3c')]+'%'};return _0x3caf51;})});}_0x2082e6=_['merge']({},_0x2082e6,_0x13a059[_0xb00b('0x46')]);return db[_0xb00b('0x5a')][_0xb00b('0x18')]({'where':_0x2082e6[_0xb00b('0x3a')]})[_0xb00b('0x1f')](function(_0x85882c){_0x4a9125[_0xb00b('0x18')]=_0x85882c;if(_0x13a059[_0xb00b('0x30')][_0xb00b('0x3f')]){_0x2082e6['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xb00b('0x5b')](_0x2082e6);})[_0xb00b('0x1f')](function(_0x2c4488){_0x4a9125[_0xb00b('0x41')]=_0x2c4488;return _0x4a9125;});}})['then'](respondWithFilteredResult(_0x45c9cd,_0x2082e6))[_0xb00b('0x42')](handleError(_0x45c9cd,null));};function char(_0x3ac189){return'number'===typeof _0x3ac189?String[_0xb00b('0x5c')][_0xb00b('0x1c')](null,arguments):_0x3ac189;}function needsEncapsulation(_0x2762fb){return!!_0x2762fb&&(_0x2762fb['toString']()[_0xb00b('0x5d')](char(0xd))>=0x0||_0x2762fb[_0xb00b('0x5e')]()['indexOf'](char(0xa))>=0x0||_0x2762fb[_0xb00b('0x5e')]()[_0xb00b('0x5d')](char(0x2c))>=0x0||_0x2762fb[_0xb00b('0x5e')]()[_0xb00b('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x476c6c){var _0x294f38=char(0x22),_0x3a7db7='\x5c'+char(0x22),_0x183341=_0x476c6c['toString']()[_0xb00b('0x5f')](new RegExp(_0x294f38,'g'),_0x3a7db7);return _0x294f38+_0x183341+_0x294f38;}exports[_0xb00b('0x60')]=function(_0x320542,_0x29d101,_0x4b699f){var _0x10e61c,_0x4ee480;var _0x219829={'where':{'ProjectId':_0x320542['params']['id']}};if(_0x320542[_0xb00b('0x30')][_0xb00b('0x61')]){_0x219829[_0xb00b('0x3a')][_0xb00b('0x62')]=JSON[_0xb00b('0x63')](_0x320542['query'][_0xb00b('0x61')]);}return db[_0xb00b('0x57')]['findAll'](_0x219829)[_0xb00b('0x1f')](handleEntityNotFound(_0x29d101,null))['then'](function(_0x20a690){if(_0x20a690){_0x10e61c=_0x20a690;return db[_0xb00b('0x64')][_0xb00b('0x5b')]({'where':{'SessionId':{'$in':_[_0xb00b('0x29')](_0x10e61c,'id')},'ProjectId':_0x320542['params']['id']},'order':_0xb00b('0x65')});}})[_0xb00b('0x1f')](handleEntityNotFound(_0x29d101,null))[_0xb00b('0x1f')](function(_0x44ea58){if(_0x44ea58){_0x4ee480=_0x44ea58;var _0x11172e={};for(var _0x4a4b60=0x0,_0x5e2785=_0x4ee480[_0xb00b('0x45')];_0x4a4b60<_0x5e2785;_0x4a4b60++){if(!_0x11172e[_0xb00b('0x36')](_0x4ee480[_0x4a4b60][_0xb00b('0x66')])){_0x11172e[_0x4ee480[_0x4a4b60][_0xb00b('0x66')]]=needsEncapsulation(_0x4ee480[_0x4a4b60][_0xb00b('0x67')])?encapsulate(_0x4ee480[_0x4a4b60]['question']):_0x4ee480[_0x4a4b60]['question'];}}var _0x3b8bbd=[],_0x7e4de2={};for(var _0x20d610=0x0,_0x265817=_0x10e61c[_0xb00b('0x45')];_0x20d610<_0x265817;_0x20d610++){_0x7e4de2={'ProjectId':_0x320542[_0xb00b('0x44')]['id'],'SessionId':_0x10e61c[_0x20d610]['id'],'StartTime':moment(_0x10e61c[_0x20d610][_0xb00b('0x62')])['format'](_0xb00b('0x68'))};for(var _0x54b972=0x0,_0x128a41=_0x4ee480['length'];_0x54b972<_0x128a41;_0x54b972++){if(_0x4ee480[_0x54b972][_0xb00b('0x69')]==_0x10e61c[_0x20d610]['id']&&_0x11172e[_0xb00b('0x36')](_0x4ee480[_0x54b972][_0xb00b('0x66')])){_0x7e4de2[_0x11172e[_0x4ee480[_0x54b972][_0xb00b('0x66')]]]=_0x4ee480[_0x54b972][_0xb00b('0x6a')];}}for(var _0x2c6471 in _0x11172e){if(!_0x7e4de2[_0xb00b('0x36')](_0x11172e[_0x2c6471])){_0x7e4de2[_0x11172e[_0x2c6471]]=null;}}_0x3b8bbd[_0xb00b('0x6b')](_0x7e4de2);}return _0x3b8bbd;}})[_0xb00b('0x1f')](function(_0x63b8e7){if(!_[_0xb00b('0x6c')](_0x63b8e7)){var _0x565667=toCsv(_0x63b8e7);var _0x456a2f=Date[_0xb00b('0x6d')]();fs[_0xb00b('0x6e')](util[_0xb00b('0x6f')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x320542[_0xb00b('0x44')]['id'],_0x456a2f),_0x565667);_0x29d101[_0xb00b('0x70')]('Content-disposition',_0xb00b('0x71')+util['format'](_0xb00b('0x72'),_0x320542[_0xb00b('0x44')]['id'],_0x456a2f));_0x29d101['setHeader'](_0xb00b('0x73'),_0xb00b('0x74'));return _0x29d101[_0xb00b('0x75')](util[_0xb00b('0x6f')](_0xb00b('0x76'),_0x320542[_0xb00b('0x44')]['id'],_0x456a2f));}else{return _0x29d101['sendStatus'](0xcc);}})[_0xb00b('0x42')](handleError(_0x29d101,null));}; \ No newline at end of file +var _0x4b84=['eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getSessions','findOne','JscriptySessionReport','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','JscriptyQuestionReport','-createdAt','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','questionId','push','isEmpty','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','sendStatus'];(function(_0x383158,_0x415e43){var _0x507985=function(_0x1e498e){while(--_0x1e498e){_0x383158['push'](_0x383158['shift']());}};_0x507985(++_0x415e43);}(_0x4b84,0x1cc));var _0x44b8=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0x4b84[_0x506d83];return _0x335e8b;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];function respondWithStatusCode(_0x4301a6,_0x4bcc43){_0x4bcc43=_0x4bcc43||0xcc;return function(_0x194230){if(_0x194230){return _0x4301a6['sendStatus'](_0x4bcc43);}return _0x4301a6[_0x44b8('0x14')](_0x4bcc43)[_0x44b8('0x15')]();};}function respondWithResult(_0x4df670,_0x63e8f6){_0x63e8f6=_0x63e8f6||0xc8;return function(_0x4be54c){if(_0x4be54c){return _0x4df670['status'](_0x63e8f6)[_0x44b8('0x16')](_0x4be54c);}};}function respondWithFilteredResult(_0x2af0ad,_0x1722da){return function(_0x41ab46){if(_0x41ab46){var _0x5e52f2=_0x41ab46['count'],_0x495c74=_0x1722da[_0x44b8('0x17')],_0x5d6349=_0x1722da[_0x44b8('0x17')]+_0x1722da['limit'],_0x3fe9fb;if(_0x5d6349>=_0x5e52f2){_0x5d6349=_0x5e52f2;_0x3fe9fb=0xc8;}else{_0x3fe9fb=0xce;}_0x2af0ad[_0x44b8('0x14')](_0x3fe9fb);return _0x2af0ad[_0x44b8('0x18')]('Content-Range',_0x495c74+'-'+_0x5d6349+'/'+_0x5e52f2)[_0x44b8('0x16')](_0x41ab46);}return null;};}function patchUpdates(_0x3f4688){return function(_0x4b600f){try{jsonpatch[_0x44b8('0x19')](_0x4b600f,_0x3f4688,!![]);}catch(_0x8b4301){return BPromise[_0x44b8('0x1a')](_0x8b4301);}return _0x4b600f[_0x44b8('0x1b')]();};}function saveUpdates(_0x102ef9,_0x369c09){return function(_0x452f2f){if(_0x452f2f){return _0x452f2f[_0x44b8('0x1c')](_0x102ef9)[_0x44b8('0x1d')](function(_0x1e0f2d){return _0x1e0f2d;});}return null;};}function removeEntity(_0x1d642b,_0x14996c){return function(_0x48327e){if(_0x48327e){return _0x48327e[_0x44b8('0x1e')]()[_0x44b8('0x1d')](function(){var _0x416b34=_0x48327e[_0x44b8('0x1f')]({'plain':!![]});var _0x305a5c='Projects';return db[_0x44b8('0x20')]['destroy']({'where':{'type':_0x305a5c,'resourceId':_0x416b34['id']}})[_0x44b8('0x1d')](function(){return _0x48327e;});})[_0x44b8('0x1d')](function(){_0x1d642b[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();});}};}function handleEntityNotFound(_0x230a3d,_0x59acbc){return function(_0x474f01){if(!_0x474f01){_0x230a3d['sendStatus'](0x194);}return _0x474f01;};}function handleError(_0x41d673,_0x350482){_0x350482=_0x350482||0x1f4;return function(_0x549a26){logger[_0x44b8('0x21')](_0x549a26[_0x44b8('0x22')]);if(_0x549a26[_0x44b8('0x23')]){delete _0x549a26['name'];}_0x41d673[_0x44b8('0x14')](_0x350482)[_0x44b8('0x24')](_0x549a26);};}exports['index']=function(_0x2e0174,_0x4a182d){var _0xfb0028={},_0x5a544c={},_0x559f0b={'count':0x0,'rows':[]};var _0x5948dc=_[_0x44b8('0x25')](db[_0x44b8('0x26')][_0x44b8('0x27')],function(_0x1bd1be){return{'name':_0x1bd1be[_0x44b8('0x28')],'type':_0x1bd1be[_0x44b8('0x29')][_0x44b8('0x2a')]};});_0x5a544c[_0x44b8('0x2b')]=_[_0x44b8('0x25')](_0x5948dc,_0x44b8('0x23'));_0x5a544c[_0x44b8('0x2c')]=_[_0x44b8('0x2d')](_0x2e0174[_0x44b8('0x2c')]);_0x5a544c['filters']=_[_0x44b8('0x2e')](_0x5a544c['model'],_0x5a544c[_0x44b8('0x2c')]);_0xfb0028[_0x44b8('0x2f')]=_[_0x44b8('0x2e')](_0x5a544c[_0x44b8('0x2b')],qs[_0x44b8('0x30')](_0x2e0174['query'][_0x44b8('0x30')]));_0xfb0028[_0x44b8('0x2f')]=_0xfb0028[_0x44b8('0x2f')][_0x44b8('0x31')]?_0xfb0028[_0x44b8('0x2f')]:_0x5a544c['model'];if(!_0x2e0174[_0x44b8('0x2c')][_0x44b8('0x32')](_0x44b8('0x33'))){_0xfb0028[_0x44b8('0x34')]=qs[_0x44b8('0x34')](_0x2e0174[_0x44b8('0x2c')][_0x44b8('0x34')]);_0xfb0028[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x2e0174[_0x44b8('0x2c')][_0x44b8('0x17')]);}_0xfb0028[_0x44b8('0x35')]=qs[_0x44b8('0x36')](_0x2e0174[_0x44b8('0x2c')][_0x44b8('0x36')]);_0xfb0028[_0x44b8('0x37')]=qs[_0x44b8('0x38')](_[_0x44b8('0x39')](_0x2e0174[_0x44b8('0x2c')],_0x5a544c[_0x44b8('0x38')]),_0x5948dc);if(_0x2e0174[_0x44b8('0x2c')][_0x44b8('0x3a')]){_0xfb0028['where']=_[_0x44b8('0x3b')](_0xfb0028[_0x44b8('0x37')],{'$or':_['map'](_0x5948dc,function(_0x25688b){if(_0x25688b[_0x44b8('0x29')]!==_0x44b8('0x3c')){var _0x332c2b={};_0x332c2b[_0x25688b['name']]={'$like':'%'+_0x2e0174[_0x44b8('0x2c')][_0x44b8('0x3a')]+'%'};return _0x332c2b;}})});}_0xfb0028=_[_0x44b8('0x3b')]({},_0xfb0028,_0x2e0174[_0x44b8('0x3d')]);var _0x9cb2a={'where':_0xfb0028[_0x44b8('0x37')]};return db[_0x44b8('0x26')][_0x44b8('0x3e')](_0x9cb2a)[_0x44b8('0x1d')](function(_0x3d1be1){_0x559f0b[_0x44b8('0x3e')]=_0x3d1be1;if(_0x2e0174[_0x44b8('0x2c')][_0x44b8('0x3f')]){_0xfb0028[_0x44b8('0x40')]=[{'all':!![]}];}return db[_0x44b8('0x26')][_0x44b8('0x41')](_0xfb0028);})['then'](function(_0x12a0a4){_0x559f0b[_0x44b8('0x42')]=_0x12a0a4;return _0x559f0b;})[_0x44b8('0x1d')](respondWithFilteredResult(_0x4a182d,_0xfb0028))['catch'](handleError(_0x4a182d,null));};exports[_0x44b8('0x43')]=function(_0x1054c5,_0x229cc9){var _0x585a16={'raw':![],'where':{'id':_0x1054c5[_0x44b8('0x44')]['id']}},_0xbad4bb={};_0xbad4bb[_0x44b8('0x2b')]=_[_0x44b8('0x2d')](db[_0x44b8('0x26')]['rawAttributes']);_0xbad4bb['query']=_[_0x44b8('0x2d')](_0x1054c5[_0x44b8('0x2c')]);_0xbad4bb[_0x44b8('0x38')]=_[_0x44b8('0x2e')](_0xbad4bb[_0x44b8('0x2b')],_0xbad4bb[_0x44b8('0x2c')]);_0x585a16[_0x44b8('0x2f')]=_[_0x44b8('0x2e')](_0xbad4bb[_0x44b8('0x2b')],qs[_0x44b8('0x30')](_0x1054c5[_0x44b8('0x2c')][_0x44b8('0x30')]));_0x585a16[_0x44b8('0x2f')]=_0x585a16[_0x44b8('0x2f')][_0x44b8('0x31')]?_0x585a16[_0x44b8('0x2f')]:_0xbad4bb[_0x44b8('0x2b')];if(_0x1054c5[_0x44b8('0x2c')][_0x44b8('0x3f')]){_0x585a16['include']=[{'all':!![]}];}_0x585a16=_['merge']({},_0x585a16,_0x1054c5[_0x44b8('0x3d')]);return db[_0x44b8('0x26')][_0x44b8('0x45')](_0x585a16)[_0x44b8('0x1d')](handleEntityNotFound(_0x229cc9,null))[_0x44b8('0x1d')](respondWithResult(_0x229cc9,null))[_0x44b8('0x46')](handleError(_0x229cc9,null));};exports[_0x44b8('0x47')]=function(_0x4fe73f,_0x156070){return db['JscriptyProject'][_0x44b8('0x47')](_0x4fe73f[_0x44b8('0x48')],{})[_0x44b8('0x1d')](function(_0x9207bf){var _0x103d57=_0x4fe73f[_0x44b8('0x49')]['get']({'plain':!![]});if(!_0x103d57)throw new Error(_0x44b8('0x4a'));if(_0x103d57[_0x44b8('0x4b')]===_0x44b8('0x49')){var _0x25d266=_0x9207bf['get']({'plain':!![]});var _0x4e4ed1=_0x44b8('0x4c');return db[_0x44b8('0x4d')][_0x44b8('0x45')]({'where':{'name':_0x4e4ed1,'userProfileId':_0x103d57[_0x44b8('0x4e')]},'raw':!![]})[_0x44b8('0x1d')](function(_0x500bad){if(_0x500bad&&_0x500bad[_0x44b8('0x4f')]===0x0){return db[_0x44b8('0x20')][_0x44b8('0x47')]({'name':_0x25d266[_0x44b8('0x23')],'resourceId':_0x25d266['id'],'type':_0x500bad[_0x44b8('0x23')],'sectionId':_0x500bad['id']},{})['then'](function(){return _0x9207bf;});}else{return _0x9207bf;}})['catch'](function(_0x2516fc){logger['error'](_0x44b8('0x50'),_0x2516fc);throw _0x2516fc;});}return _0x9207bf;})['then'](respondWithResult(_0x156070,0xc9))[_0x44b8('0x46')](handleError(_0x156070,null));};exports[_0x44b8('0x51')]=function(_0x1a29f6,_0x15f4c6){var _0x2fa6b4={'where':{'id':_0x1a29f6[_0x44b8('0x44')]['id']}},_0x32f588={};_0x32f588['model']=_[_0x44b8('0x2d')](db[_0x44b8('0x26')][_0x44b8('0x27')]);_0x2fa6b4['attributes']=_[_0x44b8('0x2e')](_0x32f588[_0x44b8('0x2b')],qs[_0x44b8('0x30')](_0x1a29f6[_0x44b8('0x2c')]['fields']));_0x2fa6b4[_0x44b8('0x2f')]=_0x2fa6b4[_0x44b8('0x2f')]['length']?_0x2fa6b4[_0x44b8('0x2f')]:_0x32f588[_0x44b8('0x2b')];if(_0x1a29f6[_0x44b8('0x2c')][_0x44b8('0x3f')]){_0x2fa6b4[_0x44b8('0x40')]=[{'all':!![]}];}_0x2fa6b4=_['merge']({},_0x2fa6b4,_0x1a29f6['options']);return db[_0x44b8('0x26')][_0x44b8('0x45')](_0x2fa6b4)[_0x44b8('0x1d')](handleEntityNotFound(_0x15f4c6,null))[_0x44b8('0x1d')](function(_0x765e45){if(_0x765e45){var _0x3f6b92=_0x765e45[_0x44b8('0x1f')]({'plain':!![]});_0x3f6b92=qs[_0x44b8('0x52')](_0x3f6b92,['id',_0x44b8('0x53'),_0x44b8('0x54')]);_0x1a29f6[_0x44b8('0x48')]=_[_0x44b8('0x52')](_0x1a29f6['body'],['id',_0x44b8('0x53'),_0x44b8('0x54')]);return db[_0x44b8('0x26')][_0x44b8('0x47')](_[_0x44b8('0x3b')](_0x3f6b92,_0x1a29f6[_0x44b8('0x48')]),{'include':_0x1a29f6[_0x44b8('0x2c')][_0x44b8('0x3f')]?[{'all':!![]}]:undefined})[_0x44b8('0x1d')](function(_0x2d6a31){var _0x2ecff9=_0x1a29f6[_0x44b8('0x49')][_0x44b8('0x1f')]({'plain':!![]});if(!_0x2ecff9)throw new Error(_0x44b8('0x4a'));if(_0x2ecff9[_0x44b8('0x4b')]===_0x44b8('0x49')){var _0x25f91c=_0x2d6a31[_0x44b8('0x1f')]({'plain':!![]});var _0x4cf835=_0x44b8('0x4c');return db[_0x44b8('0x4d')][_0x44b8('0x45')]({'where':{'name':_0x4cf835,'userProfileId':_0x2ecff9[_0x44b8('0x4e')]},'raw':!![]})[_0x44b8('0x1d')](function(_0x29ed5d){if(_0x29ed5d&&_0x29ed5d[_0x44b8('0x4f')]===0x0){return db['UserProfileResource'][_0x44b8('0x47')]({'name':_0x25f91c[_0x44b8('0x23')],'resourceId':_0x25f91c['id'],'type':_0x29ed5d['name'],'sectionId':_0x29ed5d['id']},{})[_0x44b8('0x1d')](function(){return _0x2d6a31;});}else{return _0x2d6a31;}})[_0x44b8('0x46')](function(_0x520929){logger[_0x44b8('0x21')](_0x44b8('0x50'),_0x520929);throw _0x520929;});}return _0x2d6a31;});}})[_0x44b8('0x1d')](respondWithResult(_0x15f4c6,0xc9))['catch'](handleError(_0x15f4c6,null));};exports[_0x44b8('0x1c')]=function(_0x5da64b,_0x36cdd8){if(_0x5da64b['body']['id']){delete _0x5da64b[_0x44b8('0x48')]['id'];}return db[_0x44b8('0x26')][_0x44b8('0x45')]({'where':{'id':_0x5da64b[_0x44b8('0x44')]['id']}})[_0x44b8('0x1d')](handleEntityNotFound(_0x36cdd8,null))[_0x44b8('0x1d')](saveUpdates(_0x5da64b['body'],null))[_0x44b8('0x1d')](respondWithResult(_0x36cdd8,null))['catch'](handleError(_0x36cdd8,null));};exports[_0x44b8('0x1e')]=function(_0x22c762,_0x4c1a7c){return db[_0x44b8('0x26')][_0x44b8('0x45')]({'where':{'id':_0x22c762[_0x44b8('0x44')]['id']}})[_0x44b8('0x1d')](handleEntityNotFound(_0x4c1a7c,null))[_0x44b8('0x1d')](removeEntity(_0x4c1a7c,null))[_0x44b8('0x46')](handleError(_0x4c1a7c,null));};exports[_0x44b8('0x55')]=function(_0x3d4a88,_0x3f9102,_0x11ad5b){var _0x41111f={'raw':!![],'where':{}};var _0x27869f={};var _0x52381a={'count':0x0,'rows':[]};return db[_0x44b8('0x26')][_0x44b8('0x56')]({'where':{'id':_0x3d4a88[_0x44b8('0x44')]['id']}})['then'](handleEntityNotFound(_0x3f9102,null))[_0x44b8('0x1d')](function(_0x5cc122){if(_0x5cc122){_0x27869f['model']=_[_0x44b8('0x2d')](db[_0x44b8('0x57')][_0x44b8('0x27')]);_0x27869f[_0x44b8('0x2c')]=_[_0x44b8('0x2d')](_0x3d4a88['query']);_0x27869f[_0x44b8('0x38')]=_[_0x44b8('0x2e')](_0x27869f[_0x44b8('0x2b')],_0x27869f[_0x44b8('0x2c')]);_0x41111f[_0x44b8('0x2f')]=_[_0x44b8('0x2e')](_0x27869f[_0x44b8('0x2b')],qs[_0x44b8('0x30')](_0x3d4a88['query'][_0x44b8('0x30')]));_0x41111f[_0x44b8('0x2f')]=_0x41111f[_0x44b8('0x2f')][_0x44b8('0x31')]?_0x41111f['attributes']:_0x27869f['model'];if(!_0x3d4a88['query'][_0x44b8('0x32')](_0x44b8('0x33'))){_0x41111f[_0x44b8('0x34')]=qs[_0x44b8('0x34')](_0x3d4a88[_0x44b8('0x2c')]['limit']);_0x41111f[_0x44b8('0x17')]=qs['offset'](_0x3d4a88[_0x44b8('0x2c')][_0x44b8('0x17')]);}_0x41111f[_0x44b8('0x35')]=qs['sort'](_0x3d4a88['query'][_0x44b8('0x36')]);_0x41111f[_0x44b8('0x37')]=qs[_0x44b8('0x38')](_['pick'](_0x3d4a88[_0x44b8('0x2c')],_0x27869f[_0x44b8('0x38')]));_0x41111f[_0x44b8('0x37')][_0x44b8('0x58')]=_0x5cc122['id'];if(_0x3d4a88[_0x44b8('0x2c')]['filter']){_0x41111f[_0x44b8('0x37')]=_[_0x44b8('0x3b')](_0x41111f[_0x44b8('0x37')],{'$or':_[_0x44b8('0x25')](_0x41111f[_0x44b8('0x2f')],function(_0x4cc81e){var _0x40571c={};_0x40571c[_0x4cc81e]={'$like':'%'+_0x3d4a88[_0x44b8('0x2c')][_0x44b8('0x3a')]+'%'};return _0x40571c;})});}_0x41111f=_[_0x44b8('0x3b')]({},_0x41111f,_0x3d4a88[_0x44b8('0x3d')]);return db[_0x44b8('0x57')][_0x44b8('0x3e')]({'where':_0x41111f['where']})[_0x44b8('0x1d')](function(_0x2212e8){_0x52381a['count']=_0x2212e8;if(_0x3d4a88[_0x44b8('0x2c')][_0x44b8('0x3f')]){_0x41111f['include']=[{'all':!![]}];}return db[_0x44b8('0x57')]['findAll'](_0x41111f);})['then'](function(_0x31d3b6){_0x52381a[_0x44b8('0x42')]=_0x31d3b6;return _0x52381a;});}})[_0x44b8('0x1d')](respondWithFilteredResult(_0x3f9102,_0x41111f))['catch'](handleError(_0x3f9102,null));};exports['getAnswers']=function(_0x5b82ec,_0x36334a,_0x225782){var _0x119d05={'raw':!![],'where':{}};var _0x20b53c={};var _0x1a5621={'count':0x0,'rows':[]};return db[_0x44b8('0x26')][_0x44b8('0x56')]({'where':{'id':_0x5b82ec[_0x44b8('0x44')]['id']}})['then'](handleEntityNotFound(_0x36334a,null))[_0x44b8('0x1d')](function(_0x48eba8){if(_0x48eba8){_0x20b53c['model']=_['keys'](db[_0x44b8('0x59')]['rawAttributes']);_0x20b53c[_0x44b8('0x2c')]=_[_0x44b8('0x2d')](_0x5b82ec[_0x44b8('0x2c')]);_0x20b53c[_0x44b8('0x38')]=_[_0x44b8('0x2e')](_0x20b53c[_0x44b8('0x2b')],_0x20b53c[_0x44b8('0x2c')]);_0x119d05[_0x44b8('0x2f')]=_['intersection'](_0x20b53c[_0x44b8('0x2b')],qs[_0x44b8('0x30')](_0x5b82ec[_0x44b8('0x2c')][_0x44b8('0x30')]));_0x119d05[_0x44b8('0x2f')]=_0x119d05[_0x44b8('0x2f')][_0x44b8('0x31')]?_0x119d05[_0x44b8('0x2f')]:_0x20b53c[_0x44b8('0x2b')];if(!_0x5b82ec['query']['hasOwnProperty'](_0x44b8('0x33'))){_0x119d05['limit']=qs[_0x44b8('0x34')](_0x5b82ec[_0x44b8('0x2c')][_0x44b8('0x34')]);_0x119d05['offset']=qs['offset'](_0x5b82ec['query'][_0x44b8('0x17')]);}_0x119d05['order']=qs[_0x44b8('0x36')](_0x5b82ec[_0x44b8('0x2c')][_0x44b8('0x36')]);_0x119d05[_0x44b8('0x37')]=qs[_0x44b8('0x38')](_[_0x44b8('0x39')](_0x5b82ec[_0x44b8('0x2c')],_0x20b53c[_0x44b8('0x38')]));_0x119d05[_0x44b8('0x37')][_0x44b8('0x58')]=_0x48eba8['id'];if(_0x5b82ec[_0x44b8('0x2c')][_0x44b8('0x3a')]){_0x119d05[_0x44b8('0x37')]=_[_0x44b8('0x3b')](_0x119d05['where'],{'$or':_[_0x44b8('0x25')](_0x119d05[_0x44b8('0x2f')],function(_0x395cd6){var _0x379b35={};_0x379b35[_0x395cd6]={'$like':'%'+_0x5b82ec[_0x44b8('0x2c')][_0x44b8('0x3a')]+'%'};return _0x379b35;})});}_0x119d05=_[_0x44b8('0x3b')]({},_0x119d05,_0x5b82ec[_0x44b8('0x3d')]);return db[_0x44b8('0x59')][_0x44b8('0x3e')]({'where':_0x119d05[_0x44b8('0x37')]})[_0x44b8('0x1d')](function(_0x1a41e2){_0x1a5621['count']=_0x1a41e2;if(_0x5b82ec[_0x44b8('0x2c')][_0x44b8('0x3f')]){_0x119d05[_0x44b8('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x119d05);})[_0x44b8('0x1d')](function(_0x116f98){_0x1a5621[_0x44b8('0x42')]=_0x116f98;return _0x1a5621;});}})['then'](respondWithFilteredResult(_0x36334a,_0x119d05))[_0x44b8('0x46')](handleError(_0x36334a,null));};function char(_0x419852){return _0x44b8('0x5a')===typeof _0x419852?String[_0x44b8('0x5b')][_0x44b8('0x19')](null,arguments):_0x419852;}function needsEncapsulation(_0x4695b3){return!!_0x4695b3&&(_0x4695b3[_0x44b8('0x5c')]()[_0x44b8('0x5d')](char(0xd))>=0x0||_0x4695b3['toString']()[_0x44b8('0x5d')](char(0xa))>=0x0||_0x4695b3[_0x44b8('0x5c')]()[_0x44b8('0x5d')](char(0x2c))>=0x0||_0x4695b3[_0x44b8('0x5c')]()[_0x44b8('0x5d')](char(0x22))>=0x0);}function encapsulate(_0xb689ed){var _0x9d6d07=char(0x22),_0x5747b5='\x5c'+char(0x22),_0x5c8ce9=_0xb689ed['toString']()[_0x44b8('0x5e')](new RegExp(_0x9d6d07,'g'),_0x5747b5);return _0x9d6d07+_0x5c8ce9+_0x9d6d07;}exports[_0x44b8('0x5f')]=function(_0x2d74ee,_0x312f4c,_0x45b4d8){var _0xf8e834,_0x252066;var _0x205bc1={'where':{'ProjectId':_0x2d74ee[_0x44b8('0x44')]['id']}};if(_0x2d74ee['query'][_0x44b8('0x60')]){_0x205bc1[_0x44b8('0x37')]['starttime']=JSON['parse'](_0x2d74ee[_0x44b8('0x2c')]['startTime']);}return db[_0x44b8('0x57')][_0x44b8('0x41')](_0x205bc1)[_0x44b8('0x1d')](handleEntityNotFound(_0x312f4c,null))['then'](function(_0x3f4a2a){if(_0x3f4a2a){_0xf8e834=_0x3f4a2a;return db[_0x44b8('0x61')][_0x44b8('0x41')]({'where':{'SessionId':{'$in':_[_0x44b8('0x25')](_0xf8e834,'id')},'ProjectId':_0x2d74ee['params']['id']},'order':_0x44b8('0x62')});}})['then'](handleEntityNotFound(_0x312f4c,null))[_0x44b8('0x1d')](function(_0x2f2923){if(_0x2f2923){_0x252066=_0x2f2923;var _0x2d9d62={};for(var _0x13f16f=0x0,_0x3fe77d=_0x252066[_0x44b8('0x31')];_0x13f16f<_0x3fe77d;_0x13f16f++){if(!_0x2d9d62[_0x44b8('0x32')](_0x252066[_0x13f16f]['questionId'])){_0x2d9d62[_0x252066[_0x13f16f]['questionId']]=needsEncapsulation(_0x252066[_0x13f16f]['question'])?encapsulate(_0x252066[_0x13f16f][_0x44b8('0x63')]):_0x252066[_0x13f16f][_0x44b8('0x63')];}}var _0x28ff91=[],_0x2a8e9a={};for(var _0x1e06f0=0x0,_0x185b3c=_0xf8e834[_0x44b8('0x31')];_0x1e06f0<_0x185b3c;_0x1e06f0++){_0x2a8e9a={'ProjectId':_0x2d74ee[_0x44b8('0x44')]['id'],'SessionId':_0xf8e834[_0x1e06f0]['id'],'StartTime':moment(_0xf8e834[_0x1e06f0][_0x44b8('0x64')])[_0x44b8('0x65')](_0x44b8('0x66'))};for(var _0x3dfb2c=0x0,_0x3cd117=_0x252066[_0x44b8('0x31')];_0x3dfb2c<_0x3cd117;_0x3dfb2c++){if(_0x252066[_0x3dfb2c][_0x44b8('0x67')]==_0xf8e834[_0x1e06f0]['id']&&_0x2d9d62[_0x44b8('0x32')](_0x252066[_0x3dfb2c][_0x44b8('0x68')])){_0x2a8e9a[_0x2d9d62[_0x252066[_0x3dfb2c][_0x44b8('0x68')]]]=_0x252066[_0x3dfb2c]['answer'];}}for(var _0xd3390e in _0x2d9d62){if(!_0x2a8e9a['hasOwnProperty'](_0x2d9d62[_0xd3390e])){_0x2a8e9a[_0x2d9d62[_0xd3390e]]=null;}}_0x28ff91[_0x44b8('0x69')](_0x2a8e9a);}return _0x28ff91;}})['then'](function(_0x5db410){if(!_[_0x44b8('0x6a')](_0x5db410)){var _0x56541a=toCsv(_0x5db410);var _0x4d9f8a=Date['now']();fs['writeFileSync'](util['format'](_0x44b8('0x6b'),_0x2d74ee[_0x44b8('0x44')]['id'],_0x4d9f8a),_0x56541a);_0x312f4c[_0x44b8('0x6c')](_0x44b8('0x6d'),'attachment;\x20filename='+util[_0x44b8('0x65')](_0x44b8('0x6e'),_0x2d74ee['params']['id'],_0x4d9f8a));_0x312f4c['setHeader'](_0x44b8('0x6f'),_0x44b8('0x70'));return _0x312f4c[_0x44b8('0x71')](util['format'](_0x44b8('0x6b'),_0x2d74ee[_0x44b8('0x44')]['id'],_0x4d9f8a));}else{return _0x312f4c[_0x44b8('0x72')](0xcc);}})[_0x44b8('0x46')](handleError(_0x312f4c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index e3ce1da..d3dd786 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 _0x74c7=['../../config/environment','exports','JscriptyProject','jscripty_projects','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x5d0134,_0x4784e7){var _0x400946=function(_0x42d126){while(--_0x42d126){_0x5d0134['push'](_0x5d0134['shift']());}};_0x400946(++_0x4784e7);}(_0x74c7,0x194));var _0x774c=function(_0x396a8f,_0x105269){_0x396a8f=_0x396a8f-0x0;var _0x255407=_0x74c7[_0x396a8f];return _0x255407;};'use strict';var _=require('lodash');var util=require(_0x774c('0x0'));var logger=require(_0x774c('0x1'))('api');var moment=require(_0x774c('0x2'));var BPromise=require(_0x774c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x774c('0x4'));var rimraf=require(_0x774c('0x5'));var config=require(_0x774c('0x6'));var attributes=require('./jscriptyProject.attributes');module[_0x774c('0x7')]=function(_0x324896,_0x23aa92){return _0x324896['define'](_0x774c('0x8'),attributes,{'tableName':_0x774c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b17=['define','JscriptyProject','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x53f4eb,_0x52b3fb){var _0x3e0679=function(_0x46b618){while(--_0x46b618){_0x53f4eb['push'](_0x53f4eb['shift']());}};_0x3e0679(++_0x52b3fb);}(_0x2b17,0x1ba));var _0x72b1=function(_0x595a71,_0x84ac71){_0x595a71=_0x595a71-0x0;var _0xa492ed=_0x2b17[_0x595a71];return _0xa492ed;};'use strict';var _=require('lodash');var util=require(_0x72b1('0x0'));var logger=require(_0x72b1('0x1'))(_0x72b1('0x2'));var moment=require(_0x72b1('0x3'));var BPromise=require(_0x72b1('0x4'));var rp=require(_0x72b1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x363e32,_0x42b025){return _0x363e32[_0x72b1('0x6')](_0x72b1('0x7'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 3605360..49101d7 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 _0x08d2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util'];(function(_0x4914ee,_0xab53e9){var _0x1c3a8d=function(_0x106852){while(--_0x106852){_0x4914ee['push'](_0x4914ee['shift']());}};_0x1c3a8d(++_0xab53e9);}(_0x08d2,0x151));var _0x208d=function(_0x158970,_0x1f9776){_0x158970=_0x158970-0x0;var _0x588002=_0x08d2[_0x158970];return _0x588002;};'use strict';var _=require('lodash');var util=require(_0x208d('0x0'));var moment=require(_0x208d('0x1'));var BPromise=require(_0x208d('0x2'));var rs=require(_0x208d('0x3'));var fs=require('fs');var Redis=require(_0x208d('0x4'));var db=require(_0x208d('0x5'))['db'];var utils=require(_0x208d('0x6'));var logger=require(_0x208d('0x7'))(_0x208d('0x8'));var config=require(_0x208d('0x9'));var jayson=require(_0x208d('0xa'));var client=jayson[_0x208d('0xb')][_0x208d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a4362,_0x4ada93,_0x1105f6){return new BPromise(function(_0x512fa1,_0x44769b){return client[_0x208d('0xd')](_0x5a4362,_0x1105f6)[_0x208d('0xe')](function(_0x24a83d){logger[_0x208d('0xf')](_0x208d('0x10'),_0x4ada93,'request\x20sent');logger[_0x208d('0x11')](_0x208d('0x12'),_0x4ada93,_0x208d('0x13'),JSON[_0x208d('0x14')](_0x24a83d));if(_0x24a83d[_0x208d('0x15')]){if(_0x24a83d[_0x208d('0x15')][_0x208d('0x16')]===0x1f4){logger[_0x208d('0x15')]('JscriptyProject,\x20%s,\x20%s',_0x4ada93,_0x24a83d[_0x208d('0x15')][_0x208d('0x17')]);return _0x44769b(_0x24a83d['error'][_0x208d('0x17')]);}logger[_0x208d('0x15')](_0x208d('0x10'),_0x4ada93,_0x24a83d[_0x208d('0x15')][_0x208d('0x17')]);return _0x512fa1(_0x24a83d[_0x208d('0x15')][_0x208d('0x17')]);}else{logger[_0x208d('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x4ada93,'request\x20sent');_0x512fa1(_0x24a83d[_0x208d('0x18')][_0x208d('0x17')]);}})[_0x208d('0x19')](function(_0x3548cf){logger[_0x208d('0x15')](_0x208d('0x10'),_0x4ada93,_0x3548cf);_0x44769b(_0x3548cf);});});} \ No newline at end of file +var _0x5386=['result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x5ea7a8,_0x261bd5){var _0xe57770=function(_0x215e93){while(--_0x215e93){_0x5ea7a8['push'](_0x5ea7a8['shift']());}};_0xe57770(++_0x261bd5);}(_0x5386,0x128));var _0x6538=function(_0x1d5714,_0x2fa5f4){_0x1d5714=_0x1d5714-0x0;var _0x1b620e=_0x5386[_0x1d5714];return _0x1b620e;};'use strict';var _=require(_0x6538('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6538('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6538('0x2'));var db=require(_0x6538('0x3'))['db'];var utils=require(_0x6538('0x4'));var logger=require(_0x6538('0x5'))(_0x6538('0x6'));var config=require(_0x6538('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6538('0x8')][_0x6538('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2be275,_0x24cf3b,_0x2f6de6){return new BPromise(function(_0x39a3c0,_0x15aede){return client[_0x6538('0xa')](_0x2be275,_0x2f6de6)[_0x6538('0xb')](function(_0x2e3522){logger[_0x6538('0xc')](_0x6538('0xd'),_0x24cf3b,_0x6538('0xe'));logger['debug'](_0x6538('0xf'),_0x24cf3b,_0x6538('0xe'),JSON[_0x6538('0x10')](_0x2e3522));if(_0x2e3522['error']){if(_0x2e3522['error']['code']===0x1f4){logger[_0x6538('0x11')]('JscriptyProject,\x20%s,\x20%s',_0x24cf3b,_0x2e3522[_0x6538('0x11')][_0x6538('0x12')]);return _0x15aede(_0x2e3522['error']['message']);}logger[_0x6538('0x11')](_0x6538('0xd'),_0x24cf3b,_0x2e3522[_0x6538('0x11')][_0x6538('0x12')]);return _0x39a3c0(_0x2e3522[_0x6538('0x11')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x24cf3b,_0x6538('0xe'));_0x39a3c0(_0x2e3522[_0x6538('0x13')][_0x6538('0x12')]);}})[_0x6538('0x14')](function(_0x32327d){logger['error'](_0x6538('0xd'),_0x24cf3b,_0x32327d);_0x15aede(_0x32327d);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index a6f1538..39acd16 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 _0x6041=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put'];(function(_0x48571f,_0x4c86f4){var _0x495a93=function(_0x4928b7){while(--_0x4928b7){_0x48571f['push'](_0x48571f['shift']());}};_0x495a93(++_0x4c86f4);}(_0x6041,0x1bb));var _0x1604=function(_0x329d9,_0x23ffbc){_0x329d9=_0x329d9-0x0;var _0x5afb93=_0x6041[_0x329d9];return _0x5afb93;};'use strict';var multer=require(_0x1604('0x0'));var util=require(_0x1604('0x1'));var path=require(_0x1604('0x2'));var timeout=require(_0x1604('0x3'));var express=require(_0x1604('0x4'));var router=express[_0x1604('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1604('0x6'));var interaction=require(_0x1604('0x7'));var config=require(_0x1604('0x8'));var controller=require(_0x1604('0x9'));router[_0x1604('0xa')]('/',auth[_0x1604('0xb')](),controller[_0x1604('0xc')]);router[_0x1604('0xa')](_0x1604('0xd'),auth[_0x1604('0xb')](),controller[_0x1604('0xe')]);router[_0x1604('0xa')](_0x1604('0xf'),auth[_0x1604('0xb')](),controller[_0x1604('0x10')]);router['post']('/',auth[_0x1604('0xb')](),controller[_0x1604('0x11')]);router[_0x1604('0x12')](_0x1604('0xf'),auth[_0x1604('0xb')](),controller[_0x1604('0x13')]);router['delete'](_0x1604('0xf'),auth[_0x1604('0xb')](),controller[_0x1604('0x14')]);module[_0x1604('0x15')]=router; \ No newline at end of file +var _0x0430=['show','create','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','/describe','get','/:id'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0430,0x1d0));var _0x0043=function(_0x405fa5,_0x4584b8){_0x405fa5=_0x405fa5-0x0;var _0x59f6da=_0x0430[_0x405fa5];return _0x59f6da;};'use strict';var multer=require(_0x0043('0x0'));var util=require('util');var path=require(_0x0043('0x1'));var timeout=require('connect-timeout');var express=require(_0x0043('0x2'));var router=express[_0x0043('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0043('0x4'));var interaction=require(_0x0043('0x5'));var config=require(_0x0043('0x6'));var controller=require(_0x0043('0x7'));router['get']('/',auth[_0x0043('0x8')](),controller['index']);router['get'](_0x0043('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x0043('0xa')](_0x0043('0xb'),auth[_0x0043('0x8')](),controller[_0x0043('0xc')]);router['post']('/',auth[_0x0043('0x8')](),controller[_0x0043('0xd')]);router['put'](_0x0043('0xb'),auth[_0x0043('0x8')](),controller['update']);router[_0x0043('0xe')](_0x0043('0xb'),auth[_0x0043('0x8')](),controller[_0x0043('0xf')]);module[_0x0043('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 2b9e146..0e9d786 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 _0x26f9=['exports','TEXT','STRING','sequelize'];(function(_0x162c96,_0x2cc77c){var _0x3ae40c=function(_0x520409){while(--_0x520409){_0x162c96['push'](_0x162c96['shift']());}};_0x3ae40c(++_0x2cc77c);}(_0x26f9,0x16f));var _0x926f=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x26f9[_0x1b6186];return _0x186121;};'use strict';var Sequelize=require(_0x926f('0x0'));module[_0x926f('0x1')]={'question':{'type':Sequelize['TEXT']},'answer':{'type':Sequelize[_0x926f('0x2')]('long')},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x926f('0x3')]},'queue':{'type':Sequelize[_0x926f('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x926f('0x3')]},'calleridnum':{'type':Sequelize[_0x926f('0x3')]},'questionId':{'type':Sequelize[_0x926f('0x3')]}}; \ No newline at end of file +var _0x3264=['TEXT','long','STRING','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3264,0x7f));var _0x4326=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x3264[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');module[_0x4326('0x0')]={'question':{'type':Sequelize[_0x4326('0x1')]},'answer':{'type':Sequelize[_0x4326('0x1')](_0x4326('0x2'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x4326('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4326('0x3')]},'questionId':{'type':Sequelize[_0x4326('0x3')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 83e10c2..a92547d 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 _0x50a6=['order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','find','create','body','params','destroy','describe','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset'];(function(_0x303563,_0x4ac90e){var _0x26a40b=function(_0x152ba3){while(--_0x152ba3){_0x303563['push'](_0x303563['shift']());}};_0x26a40b(++_0x4ac90e);}(_0x50a6,0xa4));var _0x650a=function(_0x57fa5c,_0x22d1e7){_0x57fa5c=_0x57fa5c-0x0;var _0x270ebe=_0x50a6[_0x57fa5c];return _0x270ebe;};'use strict';var emlformat=require(_0x650a('0x0'));var rimraf=require(_0x650a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x650a('0x2'));var moment=require('moment');var BPromise=require(_0x650a('0x3'));var Mustache=require(_0x650a('0x4'));var util=require(_0x650a('0x5'));var path=require('path');var sox=require(_0x650a('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x650a('0x7'));var _=require(_0x650a('0x8'));var squel=require(_0x650a('0x9'));var crypto=require(_0x650a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x650a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x650a('0xc'));var Papa=require(_0x650a('0xd'));var Redis=require('ioredis');var authService=require(_0x650a('0xe'));var qs=require(_0x650a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x650a('0x10'));var logger=require('../../config/logger')(_0x650a('0x11'));var utils=require('../../config/utils');var config=require(_0x650a('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x650a('0x13'))['db'];function respondWithStatusCode(_0x48077a,_0x33e73d){_0x33e73d=_0x33e73d||0xcc;return function(_0x163e5f){if(_0x163e5f){return _0x48077a[_0x650a('0x14')](_0x33e73d);}return _0x48077a['status'](_0x33e73d)[_0x650a('0x15')]();};}function respondWithResult(_0x3919a7,_0x2f727d){_0x2f727d=_0x2f727d||0xc8;return function(_0x15f2fd){if(_0x15f2fd){return _0x3919a7[_0x650a('0x16')](_0x2f727d)[_0x650a('0x17')](_0x15f2fd);}};}function respondWithFilteredResult(_0x5b7c74,_0x2460a3){return function(_0x4fdd82){if(_0x4fdd82){var _0x1f94ab=_0x4fdd82['count'],_0x3c2206=_0x2460a3['offset'],_0x348fda=_0x2460a3['offset']+_0x2460a3[_0x650a('0x18')],_0x5d9c92;if(_0x348fda>=_0x1f94ab){_0x348fda=_0x1f94ab;_0x5d9c92=0xc8;}else{_0x5d9c92=0xce;}_0x5b7c74[_0x650a('0x16')](_0x5d9c92);return _0x5b7c74[_0x650a('0x19')](_0x650a('0x1a'),_0x3c2206+'-'+_0x348fda+'/'+_0x1f94ab)[_0x650a('0x17')](_0x4fdd82);}return null;};}function patchUpdates(_0x5c3d99){return function(_0x4eba86){try{jsonpatch[_0x650a('0x1b')](_0x4eba86,_0x5c3d99,!![]);}catch(_0x1c65f6){return BPromise['reject'](_0x1c65f6);}return _0x4eba86[_0x650a('0x1c')]();};}function saveUpdates(_0x385ecd,_0x59b5e4){return function(_0x158356){if(_0x158356){return _0x158356[_0x650a('0x1d')](_0x385ecd)[_0x650a('0x1e')](function(_0x8dde4a){return _0x8dde4a;});}return null;};}function removeEntity(_0x5163fe,_0x489a5f){return function(_0x88531d){if(_0x88531d){return _0x88531d['destroy']()[_0x650a('0x1e')](function(){_0x5163fe[_0x650a('0x16')](0xcc)[_0x650a('0x15')]();});}};}function handleEntityNotFound(_0x469e53,_0x2ed256){return function(_0x326d60){if(!_0x326d60){_0x469e53[_0x650a('0x14')](0x194);}return _0x326d60;};}function handleError(_0x322eba,_0xf31b91){_0xf31b91=_0xf31b91||0x1f4;return function(_0x2761a8){logger[_0x650a('0x1f')](_0x2761a8[_0x650a('0x20')]);if(_0x2761a8[_0x650a('0x21')]){delete _0x2761a8[_0x650a('0x21')];}_0x322eba[_0x650a('0x16')](_0xf31b91)[_0x650a('0x22')](_0x2761a8);};}exports[_0x650a('0x23')]=function(_0x12fdb4,_0x4c1df6){var _0x2290a7={},_0x34ce04={},_0x558002={'count':0x0,'rows':[]};var _0x5dee27=_[_0x650a('0x24')](db[_0x650a('0x25')][_0x650a('0x26')],function(_0x783509){return{'name':_0x783509[_0x650a('0x27')],'type':_0x783509[_0x650a('0x28')]['key']};});_0x34ce04[_0x650a('0x29')]=_[_0x650a('0x24')](_0x5dee27,_0x650a('0x21'));_0x34ce04[_0x650a('0x2a')]=_[_0x650a('0x2b')](_0x12fdb4[_0x650a('0x2a')]);_0x34ce04[_0x650a('0x2c')]=_[_0x650a('0x2d')](_0x34ce04['model'],_0x34ce04[_0x650a('0x2a')]);_0x2290a7[_0x650a('0x2e')]=_[_0x650a('0x2d')](_0x34ce04['model'],qs[_0x650a('0x2f')](_0x12fdb4[_0x650a('0x2a')]['fields']));_0x2290a7[_0x650a('0x2e')]=_0x2290a7[_0x650a('0x2e')][_0x650a('0x30')]?_0x2290a7['attributes']:_0x34ce04['model'];if(!_0x12fdb4['query'][_0x650a('0x31')](_0x650a('0x32'))){_0x2290a7[_0x650a('0x18')]=qs[_0x650a('0x18')](_0x12fdb4['query'][_0x650a('0x18')]);_0x2290a7[_0x650a('0x33')]=qs['offset'](_0x12fdb4[_0x650a('0x2a')][_0x650a('0x33')]);}_0x2290a7[_0x650a('0x34')]=qs[_0x650a('0x35')](_0x12fdb4[_0x650a('0x2a')]['sort']);_0x2290a7[_0x650a('0x36')]=qs['filters'](_[_0x650a('0x37')](_0x12fdb4[_0x650a('0x2a')],_0x34ce04['filters']),_0x5dee27);if(_0x12fdb4[_0x650a('0x2a')][_0x650a('0x38')]){_0x2290a7['where']=_[_0x650a('0x39')](_0x2290a7[_0x650a('0x36')],{'$or':_[_0x650a('0x24')](_0x5dee27,function(_0x53179e){if(_0x53179e[_0x650a('0x28')]!==_0x650a('0x3a')){var _0x424073={};_0x424073[_0x53179e[_0x650a('0x21')]]={'$like':'%'+_0x12fdb4['query'][_0x650a('0x38')]+'%'};return _0x424073;}})});}_0x2290a7=_[_0x650a('0x39')]({},_0x2290a7,_0x12fdb4[_0x650a('0x3b')]);var _0x4974c4={'where':_0x2290a7['where']};return db[_0x650a('0x25')][_0x650a('0x3c')](_0x4974c4)['then'](function(_0x1acbe5){_0x558002['count']=_0x1acbe5;if(_0x12fdb4[_0x650a('0x2a')][_0x650a('0x3d')]){_0x2290a7[_0x650a('0x3e')]=[{'all':!![]}];}return db[_0x650a('0x25')][_0x650a('0x3f')](_0x2290a7);})['then'](function(_0x20ba76){_0x558002['rows']=_0x20ba76;return _0x558002;})[_0x650a('0x1e')](respondWithFilteredResult(_0x4c1df6,_0x2290a7))[_0x650a('0x40')](handleError(_0x4c1df6,null));};exports[_0x650a('0x41')]=function(_0x2fa90c,_0x1c5c6c){var _0x132644={'raw':!![],'where':{'id':_0x2fa90c['params']['id']}},_0xbab4b7={};_0xbab4b7['model']=_[_0x650a('0x2b')](db['JscriptyQuestionReport']['rawAttributes']);_0xbab4b7[_0x650a('0x2a')]=_['keys'](_0x2fa90c[_0x650a('0x2a')]);_0xbab4b7['filters']=_[_0x650a('0x2d')](_0xbab4b7[_0x650a('0x29')],_0xbab4b7[_0x650a('0x2a')]);_0x132644[_0x650a('0x2e')]=_[_0x650a('0x2d')](_0xbab4b7[_0x650a('0x29')],qs[_0x650a('0x2f')](_0x2fa90c[_0x650a('0x2a')][_0x650a('0x2f')]));_0x132644[_0x650a('0x2e')]=_0x132644[_0x650a('0x2e')][_0x650a('0x30')]?_0x132644['attributes']:_0xbab4b7[_0x650a('0x29')];if(_0x2fa90c[_0x650a('0x2a')][_0x650a('0x3d')]){_0x132644[_0x650a('0x3e')]=[{'all':!![]}];}_0x132644=_[_0x650a('0x39')]({},_0x132644,_0x2fa90c[_0x650a('0x3b')]);return db['JscriptyQuestionReport'][_0x650a('0x42')](_0x132644)[_0x650a('0x1e')](handleEntityNotFound(_0x1c5c6c,null))[_0x650a('0x1e')](respondWithResult(_0x1c5c6c,null))[_0x650a('0x40')](handleError(_0x1c5c6c,null));};exports[_0x650a('0x43')]=function(_0x195ec9,_0x548bab){return db['JscriptyQuestionReport'][_0x650a('0x43')](_0x195ec9[_0x650a('0x44')],{})[_0x650a('0x1e')](respondWithResult(_0x548bab,0xc9))['catch'](handleError(_0x548bab,null));};exports[_0x650a('0x1d')]=function(_0x5b360a,_0x6a0321){if(_0x5b360a[_0x650a('0x44')]['id']){delete _0x5b360a['body']['id'];}return db[_0x650a('0x25')][_0x650a('0x42')]({'where':{'id':_0x5b360a[_0x650a('0x45')]['id']}})['then'](handleEntityNotFound(_0x6a0321,null))[_0x650a('0x1e')](saveUpdates(_0x5b360a[_0x650a('0x44')],null))[_0x650a('0x1e')](respondWithResult(_0x6a0321,null))['catch'](handleError(_0x6a0321,null));};exports[_0x650a('0x46')]=function(_0x3f2151,_0x34fa7a){return db[_0x650a('0x25')][_0x650a('0x42')]({'where':{'id':_0x3f2151['params']['id']}})['then'](handleEntityNotFound(_0x34fa7a,null))[_0x650a('0x1e')](removeEntity(_0x34fa7a,null))[_0x650a('0x40')](handleError(_0x34fa7a,null));};exports['describe']=function(_0x11c4f2,_0x27dfcd){return db[_0x650a('0x25')][_0x650a('0x47')]()[_0x650a('0x1e')](respondWithResult(_0x27dfcd,null))[_0x650a('0x40')](handleError(_0x27dfcd,null));}; \ No newline at end of file +var _0x80d9=['params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','error','stack','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','order','sort','pick','filter','where','merge','options','count','findAll','then','catch','show','length','include','find','create','body','update'];(function(_0xe446b9,_0x4b27df){var _0xb77c67=function(_0x325965){while(--_0x325965){_0xe446b9['push'](_0xe446b9['shift']());}};_0xb77c67(++_0x4b27df);}(_0x80d9,0x15c));var _0x980d=function(_0x108131,_0x3a27b2){_0x108131=_0x108131-0x0;var _0x468a53=_0x80d9[_0x108131];return _0x468a53;};'use strict';var emlformat=require(_0x980d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x980d('0x1'));var jsonpatch=require(_0x980d('0x2'));var rp=require(_0x980d('0x3'));var moment=require('moment');var BPromise=require(_0x980d('0x4'));var Mustache=require(_0x980d('0x5'));var util=require(_0x980d('0x6'));var path=require(_0x980d('0x7'));var sox=require(_0x980d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x980d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x980d('0xa'));var jsforce=require(_0x980d('0xb'));var deskjs=require(_0x980d('0xc'));var toCsv=require(_0x980d('0xd'));var querystring=require(_0x980d('0xe'));var Papa=require(_0x980d('0xf'));var Redis=require(_0x980d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x980d('0x11'));var logger=require(_0x980d('0x12'))('api');var utils=require(_0x980d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x980d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc0168a,_0x19cb9b){_0x19cb9b=_0x19cb9b||0xcc;return function(_0x171a61){if(_0x171a61){return _0xc0168a[_0x980d('0x15')](_0x19cb9b);}return _0xc0168a[_0x980d('0x16')](_0x19cb9b)[_0x980d('0x17')]();};}function respondWithResult(_0x109ddf,_0x3a317b){_0x3a317b=_0x3a317b||0xc8;return function(_0x5f524e){if(_0x5f524e){return _0x109ddf[_0x980d('0x16')](_0x3a317b)[_0x980d('0x18')](_0x5f524e);}};}function respondWithFilteredResult(_0x3fc5f7,_0x3846bd){return function(_0x2f229b){if(_0x2f229b){var _0x169648=_0x2f229b['count'],_0x5824bf=_0x3846bd[_0x980d('0x19')],_0x27dd6a=_0x3846bd['offset']+_0x3846bd[_0x980d('0x1a')],_0x393ae2;if(_0x27dd6a>=_0x169648){_0x27dd6a=_0x169648;_0x393ae2=0xc8;}else{_0x393ae2=0xce;}_0x3fc5f7[_0x980d('0x16')](_0x393ae2);return _0x3fc5f7[_0x980d('0x1b')](_0x980d('0x1c'),_0x5824bf+'-'+_0x27dd6a+'/'+_0x169648)[_0x980d('0x18')](_0x2f229b);}return null;};}function patchUpdates(_0xc360c4){return function(_0x3ef68b){try{jsonpatch[_0x980d('0x1d')](_0x3ef68b,_0xc360c4,!![]);}catch(_0xa59cc9){return BPromise[_0x980d('0x1e')](_0xa59cc9);}return _0x3ef68b[_0x980d('0x1f')]();};}function saveUpdates(_0x550741,_0x58dddf){return function(_0x3cb470){if(_0x3cb470){return _0x3cb470['update'](_0x550741)['then'](function(_0x124c3f){return _0x124c3f;});}return null;};}function removeEntity(_0x1d6286,_0x45d698){return function(_0xbb89e3){if(_0xbb89e3){return _0xbb89e3['destroy']()['then'](function(){_0x1d6286[_0x980d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4de252,_0x20cea1){return function(_0x4da06c){if(!_0x4da06c){_0x4de252[_0x980d('0x15')](0x194);}return _0x4da06c;};}function handleError(_0x4798d7,_0x4e5af6){_0x4e5af6=_0x4e5af6||0x1f4;return function(_0x4ecf91){logger[_0x980d('0x20')](_0x4ecf91[_0x980d('0x21')]);if(_0x4ecf91[_0x980d('0x22')]){delete _0x4ecf91[_0x980d('0x22')];}_0x4798d7['status'](_0x4e5af6)['send'](_0x4ecf91);};}exports[_0x980d('0x23')]=function(_0x1d5dad,_0x97ca70){var _0x1da8ea={},_0x3d5f19={},_0x47b11d={'count':0x0,'rows':[]};var _0x4a51f9=_[_0x980d('0x24')](db[_0x980d('0x25')][_0x980d('0x26')],function(_0xf00845){return{'name':_0xf00845[_0x980d('0x27')],'type':_0xf00845[_0x980d('0x28')]['key']};});_0x3d5f19[_0x980d('0x29')]=_[_0x980d('0x24')](_0x4a51f9,_0x980d('0x22'));_0x3d5f19[_0x980d('0x2a')]=_[_0x980d('0x2b')](_0x1d5dad[_0x980d('0x2a')]);_0x3d5f19[_0x980d('0x2c')]=_[_0x980d('0x2d')](_0x3d5f19[_0x980d('0x29')],_0x3d5f19['query']);_0x1da8ea[_0x980d('0x2e')]=_[_0x980d('0x2d')](_0x3d5f19[_0x980d('0x29')],qs['fields'](_0x1d5dad['query'][_0x980d('0x2f')]));_0x1da8ea['attributes']=_0x1da8ea[_0x980d('0x2e')]['length']?_0x1da8ea['attributes']:_0x3d5f19['model'];if(!_0x1d5dad['query']['hasOwnProperty']('nolimit')){_0x1da8ea['limit']=qs[_0x980d('0x1a')](_0x1d5dad[_0x980d('0x2a')][_0x980d('0x1a')]);_0x1da8ea['offset']=qs[_0x980d('0x19')](_0x1d5dad[_0x980d('0x2a')][_0x980d('0x19')]);}_0x1da8ea[_0x980d('0x30')]=qs[_0x980d('0x31')](_0x1d5dad[_0x980d('0x2a')][_0x980d('0x31')]);_0x1da8ea['where']=qs[_0x980d('0x2c')](_[_0x980d('0x32')](_0x1d5dad['query'],_0x3d5f19[_0x980d('0x2c')]),_0x4a51f9);if(_0x1d5dad['query'][_0x980d('0x33')]){_0x1da8ea[_0x980d('0x34')]=_[_0x980d('0x35')](_0x1da8ea['where'],{'$or':_['map'](_0x4a51f9,function(_0x5d5903){if(_0x5d5903[_0x980d('0x28')]!=='VIRTUAL'){var _0x4cda3e={};_0x4cda3e[_0x5d5903[_0x980d('0x22')]]={'$like':'%'+_0x1d5dad[_0x980d('0x2a')][_0x980d('0x33')]+'%'};return _0x4cda3e;}})});}_0x1da8ea=_['merge']({},_0x1da8ea,_0x1d5dad[_0x980d('0x36')]);var _0x28d8d2={'where':_0x1da8ea[_0x980d('0x34')]};return db[_0x980d('0x25')][_0x980d('0x37')](_0x28d8d2)['then'](function(_0x5a8515){_0x47b11d[_0x980d('0x37')]=_0x5a8515;if(_0x1d5dad['query']['includeAll']){_0x1da8ea['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x980d('0x38')](_0x1da8ea);})[_0x980d('0x39')](function(_0x8bcd98){_0x47b11d['rows']=_0x8bcd98;return _0x47b11d;})[_0x980d('0x39')](respondWithFilteredResult(_0x97ca70,_0x1da8ea))[_0x980d('0x3a')](handleError(_0x97ca70,null));};exports[_0x980d('0x3b')]=function(_0xb585,_0x20a388){var _0x42bbc9={'raw':!![],'where':{'id':_0xb585['params']['id']}},_0x1221e7={};_0x1221e7[_0x980d('0x29')]=_[_0x980d('0x2b')](db[_0x980d('0x25')]['rawAttributes']);_0x1221e7[_0x980d('0x2a')]=_[_0x980d('0x2b')](_0xb585[_0x980d('0x2a')]);_0x1221e7[_0x980d('0x2c')]=_[_0x980d('0x2d')](_0x1221e7[_0x980d('0x29')],_0x1221e7[_0x980d('0x2a')]);_0x42bbc9['attributes']=_[_0x980d('0x2d')](_0x1221e7['model'],qs[_0x980d('0x2f')](_0xb585[_0x980d('0x2a')][_0x980d('0x2f')]));_0x42bbc9[_0x980d('0x2e')]=_0x42bbc9[_0x980d('0x2e')][_0x980d('0x3c')]?_0x42bbc9[_0x980d('0x2e')]:_0x1221e7[_0x980d('0x29')];if(_0xb585['query']['includeAll']){_0x42bbc9[_0x980d('0x3d')]=[{'all':!![]}];}_0x42bbc9=_[_0x980d('0x35')]({},_0x42bbc9,_0xb585[_0x980d('0x36')]);return db[_0x980d('0x25')][_0x980d('0x3e')](_0x42bbc9)['then'](handleEntityNotFound(_0x20a388,null))[_0x980d('0x39')](respondWithResult(_0x20a388,null))[_0x980d('0x3a')](handleError(_0x20a388,null));};exports['create']=function(_0x28dd28,_0x169270){return db[_0x980d('0x25')][_0x980d('0x3f')](_0x28dd28[_0x980d('0x40')],{})[_0x980d('0x39')](respondWithResult(_0x169270,0xc9))[_0x980d('0x3a')](handleError(_0x169270,null));};exports[_0x980d('0x41')]=function(_0x7515ac,_0x5259ea){if(_0x7515ac[_0x980d('0x40')]['id']){delete _0x7515ac[_0x980d('0x40')]['id'];}return db[_0x980d('0x25')][_0x980d('0x3e')]({'where':{'id':_0x7515ac[_0x980d('0x42')]['id']}})[_0x980d('0x39')](handleEntityNotFound(_0x5259ea,null))[_0x980d('0x39')](saveUpdates(_0x7515ac['body'],null))[_0x980d('0x39')](respondWithResult(_0x5259ea,null))['catch'](handleError(_0x5259ea,null));};exports[_0x980d('0x43')]=function(_0x6e16c1,_0x44c97d){return db[_0x980d('0x25')][_0x980d('0x3e')]({'where':{'id':_0x6e16c1['params']['id']}})[_0x980d('0x39')](handleEntityNotFound(_0x44c97d,null))[_0x980d('0x39')](removeEntity(_0x44c97d,null))[_0x980d('0x3a')](handleError(_0x44c97d,null));};exports[_0x980d('0x44')]=function(_0x35b13c,_0x2799a4){return db[_0x980d('0x25')]['describe']()['then'](respondWithResult(_0x2799a4,null))['catch'](handleError(_0x2799a4,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 6895a18..6b51813 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 _0xaf97=['exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./jscriptyQuestionReport.attributes'];(function(_0x2231f7,_0x1c866e){var _0x516301=function(_0x4cc71a){while(--_0x4cc71a){_0x2231f7['push'](_0x2231f7['shift']());}};_0x516301(++_0x1c866e);}(_0xaf97,0x1c0));var _0x7af9=function(_0x3e204d,_0x17b241){_0x3e204d=_0x3e204d-0x0;var _0x472185=_0xaf97[_0x3e204d];return _0x472185;};'use strict';var _=require(_0x7af9('0x0'));var util=require('util');var logger=require(_0x7af9('0x1'))(_0x7af9('0x2'));var moment=require(_0x7af9('0x3'));var BPromise=require(_0x7af9('0x4'));var rp=require(_0x7af9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7af9('0x6'));var config=require('../../config/environment');var attributes=require(_0x7af9('0x7'));module[_0x7af9('0x8')]=function(_0x1b6cb6,_0x195263){return _0x1b6cb6[_0x7af9('0x9')](_0x7af9('0xa'),attributes,{'tableName':_0x7af9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfc8=['./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x28b5da,_0x1aedff){var _0x203598=function(_0x3c6726){while(--_0x3c6726){_0x28b5da['push'](_0x28b5da['shift']());}};_0x203598(++_0x1aedff);}(_0xbfc8,0x70));var _0x8bfc=function(_0x2fe1c1,_0x2835d0){_0x2fe1c1=_0x2fe1c1-0x0;var _0x3c922b=_0xbfc8[_0x2fe1c1];return _0x3c922b;};'use strict';var _=require('lodash');var util=require(_0x8bfc('0x0'));var logger=require(_0x8bfc('0x1'))('api');var moment=require(_0x8bfc('0x2'));var BPromise=require(_0x8bfc('0x3'));var rp=require(_0x8bfc('0x4'));var fs=require('fs');var path=require(_0x8bfc('0x5'));var rimraf=require(_0x8bfc('0x6'));var config=require(_0x8bfc('0x7'));var attributes=require(_0x8bfc('0x8'));module[_0x8bfc('0x9')]=function(_0x47c86e,_0x41333c){return _0x47c86e[_0x8bfc('0xa')](_0x8bfc('0xb'),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 c64a664..b011f27 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 _0xdf49=['client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x456200,_0x3d4c03){var _0x551f2e=function(_0x807f2d){while(--_0x807f2d){_0x456200['push'](_0x456200['shift']());}};_0x551f2e(++_0x3d4c03);}(_0xdf49,0x140));var _0x9df4=function(_0x880aed,_0x16597b){_0x880aed=_0x880aed-0x0;var _0x40df37=_0xdf49[_0x880aed];return _0x40df37;};'use strict';var _=require(_0x9df4('0x0'));var util=require(_0x9df4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9df4('0x2'));var fs=require('fs');var Redis=require(_0x9df4('0x3'));var db=require(_0x9df4('0x4'))['db'];var utils=require(_0x9df4('0x5'));var logger=require(_0x9df4('0x6'))(_0x9df4('0x7'));var config=require(_0x9df4('0x8'));var jayson=require(_0x9df4('0x9'));var client=jayson[_0x9df4('0xa')][_0x9df4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44bfb9,_0x36be5a,_0x56e431){return new BPromise(function(_0x46f433,_0x23f984){return client[_0x9df4('0xc')](_0x44bfb9,_0x56e431)[_0x9df4('0xd')](function(_0x32c31b){logger['info'](_0x9df4('0xe'),_0x36be5a,'request\x20sent');logger[_0x9df4('0xf')](_0x9df4('0x10'),_0x36be5a,_0x9df4('0x11'),JSON['stringify'](_0x32c31b));if(_0x32c31b[_0x9df4('0x12')]){if(_0x32c31b[_0x9df4('0x12')]['code']===0x1f4){logger[_0x9df4('0x12')](_0x9df4('0xe'),_0x36be5a,_0x32c31b[_0x9df4('0x12')][_0x9df4('0x13')]);return _0x23f984(_0x32c31b[_0x9df4('0x12')][_0x9df4('0x13')]);}logger[_0x9df4('0x12')](_0x9df4('0xe'),_0x36be5a,_0x32c31b[_0x9df4('0x12')][_0x9df4('0x13')]);return _0x46f433(_0x32c31b['error'][_0x9df4('0x13')]);}else{logger[_0x9df4('0x14')](_0x9df4('0xe'),_0x36be5a,_0x9df4('0x11'));_0x46f433(_0x32c31b[_0x9df4('0x15')][_0x9df4('0x13')]);}})['catch'](function(_0x57429d){logger[_0x9df4('0x12')](_0x9df4('0xe'),_0x36be5a,_0x57429d);_0x23f984(_0x57429d);});});} \ No newline at end of file +var _0x9bf0=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x54a14f,_0x59c124){var _0x47d334=function(_0xfe197f){while(--_0xfe197f){_0x54a14f['push'](_0x54a14f['shift']());}};_0x47d334(++_0x59c124);}(_0x9bf0,0xff));var _0x09bf=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x9bf0[_0x75f869];return _0x10af8b;};'use strict';var _=require(_0x09bf('0x0'));var util=require(_0x09bf('0x1'));var moment=require(_0x09bf('0x2'));var BPromise=require(_0x09bf('0x3'));var rs=require(_0x09bf('0x4'));var fs=require('fs');var Redis=require(_0x09bf('0x5'));var db=require(_0x09bf('0x6'))['db'];var utils=require(_0x09bf('0x7'));var logger=require('../../config/logger')(_0x09bf('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x159d9f,_0x2fac76,_0x548776){return new BPromise(function(_0x56b779,_0x1ccab3){return client['request'](_0x159d9f,_0x548776)[_0x09bf('0x9')](function(_0xb5254f){logger['info'](_0x09bf('0xa'),_0x2fac76,_0x09bf('0xb'));logger[_0x09bf('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x2fac76,_0x09bf('0xb'),JSON[_0x09bf('0xd')](_0xb5254f));if(_0xb5254f[_0x09bf('0xe')]){if(_0xb5254f['error'][_0x09bf('0xf')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x2fac76,_0xb5254f[_0x09bf('0xe')][_0x09bf('0x10')]);return _0x1ccab3(_0xb5254f[_0x09bf('0xe')][_0x09bf('0x10')]);}logger[_0x09bf('0xe')](_0x09bf('0xa'),_0x2fac76,_0xb5254f[_0x09bf('0xe')][_0x09bf('0x10')]);return _0x56b779(_0xb5254f[_0x09bf('0xe')]['message']);}else{logger['info'](_0x09bf('0xa'),_0x2fac76,_0x09bf('0xb'));_0x56b779(_0xb5254f['result'][_0x09bf('0x10')]);}})[_0x09bf('0x11')](function(_0x17f764){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x2fac76,_0x17f764);_0x1ccab3(_0x17f764);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 27cafb4..afdeea4 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 _0xa630=['exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa630,0xbe));var _0x0a63=function(_0x41eb21,_0x2c6a3a){_0x41eb21=_0x41eb21-0x0;var _0x413a13=_0xa630[_0x41eb21];return _0x413a13;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var fs_extra=require(_0x0a63('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var controller=require(_0x0a63('0x6'));router[_0x0a63('0x7')]('/',auth[_0x0a63('0x8')](),controller['index']);router[_0x0a63('0x7')](_0x0a63('0x9'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xa')]);router[_0x0a63('0x7')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0xc')]);router[_0x0a63('0x7')](_0x0a63('0xd'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xe')]);router[_0x0a63('0xf')]('/',auth[_0x0a63('0x8')](),controller[_0x0a63('0x10')]);router[_0x0a63('0x11')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0x12')]);router[_0x0a63('0x13')](_0x0a63('0xb'),auth[_0x0a63('0x8')](),controller['destroy']);module[_0x0a63('0x14')]=router; \ No newline at end of file +var _0x53ec=['update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/questions','getQuestions','create'];(function(_0x3acb89,_0x2ca05e){var _0x4d38f2=function(_0x4cb6a9){while(--_0x4cb6a9){_0x3acb89['push'](_0x3acb89['shift']());}};_0x4d38f2(++_0x2ca05e);}(_0x53ec,0x192));var _0xc53e=function(_0x34e4a0,_0x1fd446){_0x34e4a0=_0x34e4a0-0x0;var _0x3ead3e=_0x53ec[_0x34e4a0];return _0x3ead3e;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xa')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc53e('0x11')]);router['put']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x12')]);router[_0xc53e('0x13')](_0xc53e('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xc53e('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 03b21e8..e0fd6c7 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 _0x3428=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','DATE','starttime','setDataValue','endtime'];(function(_0x5e0690,_0x58bbb0){var _0x2027dc=function(_0x14bc03){while(--_0x14bc03){_0x5e0690['push'](_0x5e0690['shift']());}};_0x2027dc(++_0x58bbb0);}(_0x3428,0x199));var _0x8342=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x3428[_0x199572];return _0x13cfa3;};'use strict';var moment=require(_0x8342('0x0'));var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize[_0x8342('0x1')],'set':function(_0x389543){this['setDataValue'](_0x8342('0x2'),_0x389543);this[_0x8342('0x3')](_0x8342('0x4'),moment()[_0x8342('0x5')](_0x8342('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8342('0x7')]},'calleridname':{'type':Sequelize[_0x8342('0x7')]},'calleridnum':{'type':Sequelize[_0x8342('0x7')]},'completed':{'type':Sequelize[_0x8342('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xcdac=['DATE','setDataValue','endtime','format','STRING','BOOLEAN','moment','sequelize','exports'];(function(_0x191ead,_0xc76762){var _0x37a958=function(_0x586f4f){while(--_0x586f4f){_0x191ead['push'](_0x191ead['shift']());}};_0x37a958(++_0xc76762);}(_0xcdac,0x96));var _0xccda=function(_0x5b1ef1,_0x31b15){_0x5b1ef1=_0x5b1ef1-0x0;var _0x373b86=_0xcdac[_0x5b1ef1];return _0x373b86;};'use strict';var moment=require(_0xccda('0x0'));var Sequelize=require(_0xccda('0x1'));module[_0xccda('0x2')]={'starttime':{'type':Sequelize[_0xccda('0x3')],'set':function(_0x433e41){this[_0xccda('0x4')]('starttime',_0x433e41);this[_0xccda('0x4')](_0xccda('0x5'),moment()[_0xccda('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xccda('0x3')]},'membername':{'type':Sequelize[_0xccda('0x7')]},'projectname':{'type':Sequelize[_0xccda('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xccda('0x7')]},'calleridname':{'type':Sequelize[_0xccda('0x7')]},'calleridnum':{'type':Sequelize[_0xccda('0x7')]},'completed':{'type':Sequelize[_0xccda('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 b7aa977..c1463a7 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 _0x7551=['merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','findOne','JscriptyQuestionReport','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL'];(function(_0xf70d79,_0x49c998){var _0x29039d=function(_0xe5660e){while(--_0xe5660e){_0xf70d79['push'](_0xf70d79['shift']());}};_0x29039d(++_0x49c998);}(_0x7551,0xad));var _0x1755=function(_0x2888ab,_0x4f8bd1){_0x2888ab=_0x2888ab-0x0;var _0x311ee5=_0x7551[_0x2888ab];return _0x311ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1755('0x0'));var jsonpatch=require(_0x1755('0x1'));var rp=require('request-promise');var moment=require(_0x1755('0x2'));var BPromise=require(_0x1755('0x3'));var Mustache=require(_0x1755('0x4'));var util=require(_0x1755('0x5'));var path=require('path');var sox=require(_0x1755('0x6'));var csv=require(_0x1755('0x7'));var ejs=require(_0x1755('0x8'));var fs=require('fs');var fs_extra=require(_0x1755('0x9'));var _=require(_0x1755('0xa'));var squel=require(_0x1755('0xb'));var crypto=require('crypto');var jsforce=require(_0x1755('0xc'));var deskjs=require(_0x1755('0xd'));var toCsv=require(_0x1755('0x7'));var querystring=require(_0x1755('0xe'));var Papa=require(_0x1755('0xf'));var Redis=require(_0x1755('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1755('0x11'));var as=require(_0x1755('0x12'));var hardwareService=require(_0x1755('0x13'));var logger=require(_0x1755('0x14'))('api');var utils=require(_0x1755('0x15'));var config=require(_0x1755('0x16'));var licenseUtil=require(_0x1755('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b6c5e,_0x387f03){_0x387f03=_0x387f03||0xcc;return function(_0x4f9fd6){if(_0x4f9fd6){return _0x5b6c5e[_0x1755('0x18')](_0x387f03);}return _0x5b6c5e[_0x1755('0x19')](_0x387f03)[_0x1755('0x1a')]();};}function respondWithResult(_0x3b41a2,_0x189599){_0x189599=_0x189599||0xc8;return function(_0x123749){if(_0x123749){return _0x3b41a2[_0x1755('0x19')](_0x189599)[_0x1755('0x1b')](_0x123749);}};}function respondWithFilteredResult(_0x5e4c4f,_0x48b17e){return function(_0x48b473){if(_0x48b473){var _0x5ddee5=_0x48b473[_0x1755('0x1c')],_0x275246=_0x48b17e[_0x1755('0x1d')],_0x19d269=_0x48b17e[_0x1755('0x1d')]+_0x48b17e[_0x1755('0x1e')],_0x45f1de;if(_0x19d269>=_0x5ddee5){_0x19d269=_0x5ddee5;_0x45f1de=0xc8;}else{_0x45f1de=0xce;}_0x5e4c4f[_0x1755('0x19')](_0x45f1de);return _0x5e4c4f[_0x1755('0x1f')](_0x1755('0x20'),_0x275246+'-'+_0x19d269+'/'+_0x5ddee5)[_0x1755('0x1b')](_0x48b473);}return null;};}function patchUpdates(_0x5d709c){return function(_0x5ea20c){try{jsonpatch['apply'](_0x5ea20c,_0x5d709c,!![]);}catch(_0x1115a8){return BPromise[_0x1755('0x21')](_0x1115a8);}return _0x5ea20c[_0x1755('0x22')]();};}function saveUpdates(_0x3c1070,_0x48d871){return function(_0x57b67d){if(_0x57b67d){return _0x57b67d[_0x1755('0x23')](_0x3c1070)[_0x1755('0x24')](function(_0xb69dd2){return _0xb69dd2;});}return null;};}function removeEntity(_0x14fb4e,_0x16521a){return function(_0x108211){if(_0x108211){return _0x108211[_0x1755('0x25')]()[_0x1755('0x24')](function(){_0x14fb4e[_0x1755('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x216dad,_0x1814e1){return function(_0x4a5d56){if(!_0x4a5d56){_0x216dad[_0x1755('0x18')](0x194);}return _0x4a5d56;};}function handleError(_0x314b3d,_0x1175ae){_0x1175ae=_0x1175ae||0x1f4;return function(_0xacc6cd){logger[_0x1755('0x26')](_0xacc6cd[_0x1755('0x27')]);if(_0xacc6cd['name']){delete _0xacc6cd[_0x1755('0x28')];}_0x314b3d[_0x1755('0x19')](_0x1175ae)[_0x1755('0x29')](_0xacc6cd);};}exports[_0x1755('0x2a')]=function(_0x1fb66e,_0x95b4b3){var _0xf72a73={},_0xa7634c={},_0x1112be={'count':0x0,'rows':[]};var _0x1b89ef=_[_0x1755('0x2b')](db[_0x1755('0x2c')][_0x1755('0x2d')],function(_0x315726){return{'name':_0x315726[_0x1755('0x2e')],'type':_0x315726['type'][_0x1755('0x2f')]};});_0xa7634c[_0x1755('0x30')]=_[_0x1755('0x2b')](_0x1b89ef,_0x1755('0x28'));_0xa7634c[_0x1755('0x31')]=_[_0x1755('0x32')](_0x1fb66e[_0x1755('0x31')]);_0xa7634c[_0x1755('0x33')]=_[_0x1755('0x34')](_0xa7634c[_0x1755('0x30')],_0xa7634c[_0x1755('0x31')]);_0xf72a73[_0x1755('0x35')]=_['intersection'](_0xa7634c[_0x1755('0x30')],qs[_0x1755('0x36')](_0x1fb66e[_0x1755('0x31')]['fields']));_0xf72a73[_0x1755('0x35')]=_0xf72a73['attributes'][_0x1755('0x37')]?_0xf72a73[_0x1755('0x35')]:_0xa7634c[_0x1755('0x30')];if(!_0x1fb66e['query'][_0x1755('0x38')](_0x1755('0x39'))){_0xf72a73['limit']=qs[_0x1755('0x1e')](_0x1fb66e[_0x1755('0x31')][_0x1755('0x1e')]);_0xf72a73[_0x1755('0x1d')]=qs[_0x1755('0x1d')](_0x1fb66e[_0x1755('0x31')]['offset']);}_0xf72a73[_0x1755('0x3a')]=qs['sort'](_0x1fb66e[_0x1755('0x31')][_0x1755('0x3b')]);_0xf72a73[_0x1755('0x3c')]=qs[_0x1755('0x33')](_[_0x1755('0x3d')](_0x1fb66e[_0x1755('0x31')],_0xa7634c[_0x1755('0x33')]),_0x1b89ef);if(_0x1fb66e[_0x1755('0x31')][_0x1755('0x3e')]){_0xf72a73['where']=_['merge'](_0xf72a73[_0x1755('0x3c')],{'$or':_[_0x1755('0x2b')](_0x1b89ef,function(_0x2917a3){if(_0x2917a3['type']!==_0x1755('0x3f')){var _0x27bfed={};_0x27bfed[_0x2917a3[_0x1755('0x28')]]={'$like':'%'+_0x1fb66e[_0x1755('0x31')]['filter']+'%'};return _0x27bfed;}})});}_0xf72a73=_[_0x1755('0x40')]({},_0xf72a73,_0x1fb66e[_0x1755('0x41')]);var _0x58586a={'where':_0xf72a73[_0x1755('0x3c')]};return db[_0x1755('0x2c')][_0x1755('0x1c')](_0x58586a)[_0x1755('0x24')](function(_0x5e0326){_0x1112be['count']=_0x5e0326;if(_0x1fb66e[_0x1755('0x31')][_0x1755('0x42')]){_0xf72a73[_0x1755('0x43')]=[{'all':!![]}];}return db[_0x1755('0x2c')][_0x1755('0x44')](_0xf72a73);})[_0x1755('0x24')](function(_0x11e514){_0x1112be[_0x1755('0x45')]=_0x11e514;return _0x1112be;})[_0x1755('0x24')](respondWithFilteredResult(_0x95b4b3,_0xf72a73))[_0x1755('0x46')](handleError(_0x95b4b3,null));};exports[_0x1755('0x47')]=function(_0x591b55,_0x546ace){var _0x27d427={'raw':!![],'where':{'id':_0x591b55[_0x1755('0x48')]['id']}},_0x561744={};_0x561744[_0x1755('0x30')]=_[_0x1755('0x32')](db['JscriptySessionReport']['rawAttributes']);_0x561744[_0x1755('0x31')]=_[_0x1755('0x32')](_0x591b55['query']);_0x561744[_0x1755('0x33')]=_[_0x1755('0x34')](_0x561744['model'],_0x561744[_0x1755('0x31')]);_0x27d427['attributes']=_[_0x1755('0x34')](_0x561744[_0x1755('0x30')],qs[_0x1755('0x36')](_0x591b55[_0x1755('0x31')]['fields']));_0x27d427['attributes']=_0x27d427[_0x1755('0x35')]['length']?_0x27d427[_0x1755('0x35')]:_0x561744[_0x1755('0x30')];if(_0x591b55[_0x1755('0x31')][_0x1755('0x42')]){_0x27d427[_0x1755('0x43')]=[{'all':!![]}];}_0x27d427=_[_0x1755('0x40')]({},_0x27d427,_0x591b55['options']);return db[_0x1755('0x2c')][_0x1755('0x49')](_0x27d427)[_0x1755('0x24')](handleEntityNotFound(_0x546ace,null))[_0x1755('0x24')](respondWithResult(_0x546ace,null))[_0x1755('0x46')](handleError(_0x546ace,null));};exports[_0x1755('0x4a')]=function(_0x56a8e4,_0x3fb824){return db[_0x1755('0x2c')]['create'](_0x56a8e4['body'],{})[_0x1755('0x24')](respondWithResult(_0x3fb824,0xc9))[_0x1755('0x46')](handleError(_0x3fb824,null));};exports[_0x1755('0x23')]=function(_0x3a5f57,_0x200c3e){if(_0x3a5f57[_0x1755('0x4b')]['id']){delete _0x3a5f57[_0x1755('0x4b')]['id'];}return db[_0x1755('0x2c')]['find']({'where':{'id':_0x3a5f57[_0x1755('0x48')]['id']}})[_0x1755('0x24')](handleEntityNotFound(_0x200c3e,null))[_0x1755('0x24')](saveUpdates(_0x3a5f57['body'],null))[_0x1755('0x24')](respondWithResult(_0x200c3e,null))[_0x1755('0x46')](handleError(_0x200c3e,null));};exports[_0x1755('0x25')]=function(_0x334153,_0x213296){return db[_0x1755('0x2c')]['find']({'where':{'id':_0x334153[_0x1755('0x48')]['id']}})[_0x1755('0x24')](handleEntityNotFound(_0x213296,null))[_0x1755('0x24')](removeEntity(_0x213296,null))['catch'](handleError(_0x213296,null));};exports['describe']=function(_0x5ba1f1,_0x3068cb){return db[_0x1755('0x2c')][_0x1755('0x4c')]()[_0x1755('0x24')](respondWithResult(_0x3068cb,null))[_0x1755('0x46')](handleError(_0x3068cb,null));};exports['getQuestions']=function(_0x1ad8d1,_0x180c3d,_0x57d727){var _0x10f116={'raw':!![],'where':{}};var _0x3c7a5a={};var _0x4cd134={'count':0x0,'rows':[]};return db[_0x1755('0x2c')][_0x1755('0x4d')]({'where':{'id':_0x1ad8d1['params']['id']}})['then'](handleEntityNotFound(_0x180c3d,null))[_0x1755('0x24')](function(_0x42a32c){if(_0x42a32c){_0x3c7a5a[_0x1755('0x30')]=_[_0x1755('0x32')](db['JscriptyQuestionReport'][_0x1755('0x2d')]);_0x3c7a5a[_0x1755('0x31')]=_[_0x1755('0x32')](_0x1ad8d1[_0x1755('0x31')]);_0x3c7a5a[_0x1755('0x33')]=_[_0x1755('0x34')](_0x3c7a5a[_0x1755('0x30')],_0x3c7a5a[_0x1755('0x31')]);_0x10f116[_0x1755('0x35')]=_[_0x1755('0x34')](_0x3c7a5a[_0x1755('0x30')],qs[_0x1755('0x36')](_0x1ad8d1[_0x1755('0x31')][_0x1755('0x36')]));_0x10f116['attributes']=_0x10f116[_0x1755('0x35')]['length']?_0x10f116['attributes']:_0x3c7a5a[_0x1755('0x30')];if(!_0x1ad8d1[_0x1755('0x31')][_0x1755('0x38')]('nolimit')){_0x10f116[_0x1755('0x1e')]=qs[_0x1755('0x1e')](_0x1ad8d1['query'][_0x1755('0x1e')]);_0x10f116[_0x1755('0x1d')]=qs[_0x1755('0x1d')](_0x1ad8d1[_0x1755('0x31')][_0x1755('0x1d')]);}_0x10f116[_0x1755('0x3a')]=qs[_0x1755('0x3b')](_0x1ad8d1[_0x1755('0x31')][_0x1755('0x3b')]);_0x10f116[_0x1755('0x3c')]=qs[_0x1755('0x33')](_[_0x1755('0x3d')](_0x1ad8d1[_0x1755('0x31')],_0x3c7a5a[_0x1755('0x33')]));_0x10f116[_0x1755('0x3c')]['SessionId']=_0x42a32c['id'];if(_0x1ad8d1[_0x1755('0x31')][_0x1755('0x3e')]){_0x10f116[_0x1755('0x3c')]=_[_0x1755('0x40')](_0x10f116[_0x1755('0x3c')],{'$or':_[_0x1755('0x2b')](_0x10f116['attributes'],function(_0xc52aea){var _0x4b0e9c={};_0x4b0e9c[_0xc52aea]={'$like':'%'+_0x1ad8d1[_0x1755('0x31')][_0x1755('0x3e')]+'%'};return _0x4b0e9c;})});}_0x10f116=_[_0x1755('0x40')]({},_0x10f116,_0x1ad8d1[_0x1755('0x41')]);return db[_0x1755('0x4e')][_0x1755('0x1c')]({'where':_0x10f116[_0x1755('0x3c')]})[_0x1755('0x24')](function(_0x288830){_0x4cd134['count']=_0x288830;if(_0x1ad8d1['query'][_0x1755('0x42')]){_0x10f116[_0x1755('0x43')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x1755('0x44')](_0x10f116);})[_0x1755('0x24')](function(_0x3d7c19){_0x4cd134[_0x1755('0x45')]=_0x3d7c19;return _0x4cd134;});}})[_0x1755('0x24')](respondWithFilteredResult(_0x180c3d,_0x10f116))['catch'](handleError(_0x180c3d,null));}; \ No newline at end of file +var _0x0d71=['findOne','JscriptyQuestionReport','nolimit','count','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','getQuestions'];(function(_0x2fa5e9,_0x23ff57){var _0x4f78db=function(_0x17cf56){while(--_0x17cf56){_0x2fa5e9['push'](_0x2fa5e9['shift']());}};_0x4f78db(++_0x23ff57);}(_0x0d71,0x1de));var _0x10d7=function(_0x1f597e,_0xf8508a){_0x1f597e=_0x1f597e-0x0;var _0x46e1db=_0x0d71[_0x1f597e];return _0x46e1db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x10d7('0x0'));var zipdir=require(_0x10d7('0x1'));var jsonpatch=require(_0x10d7('0x2'));var rp=require('request-promise');var moment=require(_0x10d7('0x3'));var BPromise=require(_0x10d7('0x4'));var Mustache=require(_0x10d7('0x5'));var util=require(_0x10d7('0x6'));var path=require('path');var sox=require(_0x10d7('0x7'));var csv=require(_0x10d7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x10d7('0x9'));var _=require(_0x10d7('0xa'));var squel=require(_0x10d7('0xb'));var crypto=require(_0x10d7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x10d7('0xd'));var toCsv=require(_0x10d7('0x8'));var querystring=require('querystring');var Papa=require(_0x10d7('0xe'));var Redis=require(_0x10d7('0xf'));var authService=require(_0x10d7('0x10'));var qs=require(_0x10d7('0x11'));var as=require(_0x10d7('0x12'));var hardwareService=require(_0x10d7('0x13'));var logger=require(_0x10d7('0x14'))(_0x10d7('0x15'));var utils=require(_0x10d7('0x16'));var config=require(_0x10d7('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b2194,_0x5b6682){_0x5b6682=_0x5b6682||0xcc;return function(_0x173fce){if(_0x173fce){return _0x2b2194[_0x10d7('0x18')](_0x5b6682);}return _0x2b2194[_0x10d7('0x19')](_0x5b6682)[_0x10d7('0x1a')]();};}function respondWithResult(_0x434450,_0x5ec3a1){_0x5ec3a1=_0x5ec3a1||0xc8;return function(_0x207646){if(_0x207646){return _0x434450['status'](_0x5ec3a1)[_0x10d7('0x1b')](_0x207646);}};}function respondWithFilteredResult(_0x3a0b8b,_0x12cff2){return function(_0x460d2d){if(_0x460d2d){var _0x4f11db=_0x460d2d['count'],_0x29872d=_0x12cff2[_0x10d7('0x1c')],_0x114bde=_0x12cff2[_0x10d7('0x1c')]+_0x12cff2[_0x10d7('0x1d')],_0x791f03;if(_0x114bde>=_0x4f11db){_0x114bde=_0x4f11db;_0x791f03=0xc8;}else{_0x791f03=0xce;}_0x3a0b8b[_0x10d7('0x19')](_0x791f03);return _0x3a0b8b[_0x10d7('0x1e')](_0x10d7('0x1f'),_0x29872d+'-'+_0x114bde+'/'+_0x4f11db)[_0x10d7('0x1b')](_0x460d2d);}return null;};}function patchUpdates(_0x270842){return function(_0x40e572){try{jsonpatch[_0x10d7('0x20')](_0x40e572,_0x270842,!![]);}catch(_0x5e8606){return BPromise[_0x10d7('0x21')](_0x5e8606);}return _0x40e572[_0x10d7('0x22')]();};}function saveUpdates(_0x5f0789,_0x2ccd1c){return function(_0x219b16){if(_0x219b16){return _0x219b16[_0x10d7('0x23')](_0x5f0789)[_0x10d7('0x24')](function(_0x2e4f84){return _0x2e4f84;});}return null;};}function removeEntity(_0x55f105,_0x51e2b3){return function(_0x2f1873){if(_0x2f1873){return _0x2f1873[_0x10d7('0x25')]()[_0x10d7('0x24')](function(){_0x55f105['status'](0xcc)[_0x10d7('0x1a')]();});}};}function handleEntityNotFound(_0x10d8e7,_0x201955){return function(_0x19092c){if(!_0x19092c){_0x10d8e7[_0x10d7('0x18')](0x194);}return _0x19092c;};}function handleError(_0x149fd9,_0x3d4a93){_0x3d4a93=_0x3d4a93||0x1f4;return function(_0x5d5470){logger['error'](_0x5d5470[_0x10d7('0x26')]);if(_0x5d5470[_0x10d7('0x27')]){delete _0x5d5470[_0x10d7('0x27')];}_0x149fd9[_0x10d7('0x19')](_0x3d4a93)[_0x10d7('0x28')](_0x5d5470);};}exports[_0x10d7('0x29')]=function(_0x102cec,_0x35b314){var _0x1ec960={},_0x2b73ec={},_0x5a48cc={'count':0x0,'rows':[]};var _0x3a27ef=_[_0x10d7('0x2a')](db[_0x10d7('0x2b')][_0x10d7('0x2c')],function(_0x3c5003){return{'name':_0x3c5003[_0x10d7('0x2d')],'type':_0x3c5003[_0x10d7('0x2e')]['key']};});_0x2b73ec[_0x10d7('0x2f')]=_[_0x10d7('0x2a')](_0x3a27ef,_0x10d7('0x27'));_0x2b73ec[_0x10d7('0x30')]=_[_0x10d7('0x31')](_0x102cec[_0x10d7('0x30')]);_0x2b73ec[_0x10d7('0x32')]=_['intersection'](_0x2b73ec[_0x10d7('0x2f')],_0x2b73ec[_0x10d7('0x30')]);_0x1ec960[_0x10d7('0x33')]=_[_0x10d7('0x34')](_0x2b73ec['model'],qs[_0x10d7('0x35')](_0x102cec[_0x10d7('0x30')][_0x10d7('0x35')]));_0x1ec960['attributes']=_0x1ec960[_0x10d7('0x33')][_0x10d7('0x36')]?_0x1ec960[_0x10d7('0x33')]:_0x2b73ec[_0x10d7('0x2f')];if(!_0x102cec[_0x10d7('0x30')][_0x10d7('0x37')]('nolimit')){_0x1ec960['limit']=qs['limit'](_0x102cec[_0x10d7('0x30')][_0x10d7('0x1d')]);_0x1ec960[_0x10d7('0x1c')]=qs[_0x10d7('0x1c')](_0x102cec[_0x10d7('0x30')][_0x10d7('0x1c')]);}_0x1ec960[_0x10d7('0x38')]=qs[_0x10d7('0x39')](_0x102cec[_0x10d7('0x30')][_0x10d7('0x39')]);_0x1ec960[_0x10d7('0x3a')]=qs[_0x10d7('0x32')](_[_0x10d7('0x3b')](_0x102cec[_0x10d7('0x30')],_0x2b73ec['filters']),_0x3a27ef);if(_0x102cec[_0x10d7('0x30')][_0x10d7('0x3c')]){_0x1ec960['where']=_[_0x10d7('0x3d')](_0x1ec960[_0x10d7('0x3a')],{'$or':_[_0x10d7('0x2a')](_0x3a27ef,function(_0x31ab7e){if(_0x31ab7e[_0x10d7('0x2e')]!==_0x10d7('0x3e')){var _0x499ea8={};_0x499ea8[_0x31ab7e[_0x10d7('0x27')]]={'$like':'%'+_0x102cec[_0x10d7('0x30')]['filter']+'%'};return _0x499ea8;}})});}_0x1ec960=_[_0x10d7('0x3d')]({},_0x1ec960,_0x102cec[_0x10d7('0x3f')]);var _0x17fdba={'where':_0x1ec960[_0x10d7('0x3a')]};return db[_0x10d7('0x2b')]['count'](_0x17fdba)[_0x10d7('0x24')](function(_0x4e6087){_0x5a48cc['count']=_0x4e6087;if(_0x102cec[_0x10d7('0x30')][_0x10d7('0x40')]){_0x1ec960[_0x10d7('0x41')]=[{'all':!![]}];}return db[_0x10d7('0x2b')][_0x10d7('0x42')](_0x1ec960);})[_0x10d7('0x24')](function(_0x5948d0){_0x5a48cc[_0x10d7('0x43')]=_0x5948d0;return _0x5a48cc;})[_0x10d7('0x24')](respondWithFilteredResult(_0x35b314,_0x1ec960))[_0x10d7('0x44')](handleError(_0x35b314,null));};exports['show']=function(_0x4be023,_0x3e3c35){var _0x5cdaa1={'raw':!![],'where':{'id':_0x4be023[_0x10d7('0x45')]['id']}},_0x3dbffe={};_0x3dbffe['model']=_[_0x10d7('0x31')](db['JscriptySessionReport']['rawAttributes']);_0x3dbffe[_0x10d7('0x30')]=_[_0x10d7('0x31')](_0x4be023['query']);_0x3dbffe['filters']=_[_0x10d7('0x34')](_0x3dbffe[_0x10d7('0x2f')],_0x3dbffe[_0x10d7('0x30')]);_0x5cdaa1[_0x10d7('0x33')]=_[_0x10d7('0x34')](_0x3dbffe[_0x10d7('0x2f')],qs[_0x10d7('0x35')](_0x4be023[_0x10d7('0x30')][_0x10d7('0x35')]));_0x5cdaa1[_0x10d7('0x33')]=_0x5cdaa1[_0x10d7('0x33')][_0x10d7('0x36')]?_0x5cdaa1[_0x10d7('0x33')]:_0x3dbffe[_0x10d7('0x2f')];if(_0x4be023[_0x10d7('0x30')][_0x10d7('0x40')]){_0x5cdaa1[_0x10d7('0x41')]=[{'all':!![]}];}_0x5cdaa1=_['merge']({},_0x5cdaa1,_0x4be023['options']);return db[_0x10d7('0x2b')][_0x10d7('0x46')](_0x5cdaa1)['then'](handleEntityNotFound(_0x3e3c35,null))[_0x10d7('0x24')](respondWithResult(_0x3e3c35,null))[_0x10d7('0x44')](handleError(_0x3e3c35,null));};exports[_0x10d7('0x47')]=function(_0x164f2a,_0x687cdd){return db[_0x10d7('0x2b')][_0x10d7('0x47')](_0x164f2a['body'],{})['then'](respondWithResult(_0x687cdd,0xc9))[_0x10d7('0x44')](handleError(_0x687cdd,null));};exports[_0x10d7('0x23')]=function(_0x21ecae,_0x54b982){if(_0x21ecae[_0x10d7('0x48')]['id']){delete _0x21ecae[_0x10d7('0x48')]['id'];}return db['JscriptySessionReport'][_0x10d7('0x46')]({'where':{'id':_0x21ecae[_0x10d7('0x45')]['id']}})[_0x10d7('0x24')](handleEntityNotFound(_0x54b982,null))[_0x10d7('0x24')](saveUpdates(_0x21ecae[_0x10d7('0x48')],null))['then'](respondWithResult(_0x54b982,null))[_0x10d7('0x44')](handleError(_0x54b982,null));};exports[_0x10d7('0x25')]=function(_0x383156,_0x1d8a00){return db['JscriptySessionReport'][_0x10d7('0x46')]({'where':{'id':_0x383156[_0x10d7('0x45')]['id']}})[_0x10d7('0x24')](handleEntityNotFound(_0x1d8a00,null))[_0x10d7('0x24')](removeEntity(_0x1d8a00,null))[_0x10d7('0x44')](handleError(_0x1d8a00,null));};exports['describe']=function(_0x4c9d89,_0x491a9a){return db[_0x10d7('0x2b')][_0x10d7('0x49')]()[_0x10d7('0x24')](respondWithResult(_0x491a9a,null))[_0x10d7('0x44')](handleError(_0x491a9a,null));};exports[_0x10d7('0x4a')]=function(_0x30c309,_0x2c9f60,_0x171bd0){var _0x1d552e={'raw':!![],'where':{}};var _0x5892a1={};var _0x536f6c={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x10d7('0x4b')]({'where':{'id':_0x30c309[_0x10d7('0x45')]['id']}})[_0x10d7('0x24')](handleEntityNotFound(_0x2c9f60,null))[_0x10d7('0x24')](function(_0x1e2b52){if(_0x1e2b52){_0x5892a1[_0x10d7('0x2f')]=_[_0x10d7('0x31')](db[_0x10d7('0x4c')][_0x10d7('0x2c')]);_0x5892a1['query']=_[_0x10d7('0x31')](_0x30c309[_0x10d7('0x30')]);_0x5892a1['filters']=_[_0x10d7('0x34')](_0x5892a1[_0x10d7('0x2f')],_0x5892a1[_0x10d7('0x30')]);_0x1d552e[_0x10d7('0x33')]=_[_0x10d7('0x34')](_0x5892a1[_0x10d7('0x2f')],qs[_0x10d7('0x35')](_0x30c309['query'][_0x10d7('0x35')]));_0x1d552e[_0x10d7('0x33')]=_0x1d552e['attributes'][_0x10d7('0x36')]?_0x1d552e[_0x10d7('0x33')]:_0x5892a1[_0x10d7('0x2f')];if(!_0x30c309['query']['hasOwnProperty'](_0x10d7('0x4d'))){_0x1d552e[_0x10d7('0x1d')]=qs[_0x10d7('0x1d')](_0x30c309[_0x10d7('0x30')][_0x10d7('0x1d')]);_0x1d552e[_0x10d7('0x1c')]=qs['offset'](_0x30c309[_0x10d7('0x30')][_0x10d7('0x1c')]);}_0x1d552e[_0x10d7('0x38')]=qs[_0x10d7('0x39')](_0x30c309[_0x10d7('0x30')][_0x10d7('0x39')]);_0x1d552e[_0x10d7('0x3a')]=qs['filters'](_[_0x10d7('0x3b')](_0x30c309[_0x10d7('0x30')],_0x5892a1['filters']));_0x1d552e[_0x10d7('0x3a')]['SessionId']=_0x1e2b52['id'];if(_0x30c309['query'][_0x10d7('0x3c')]){_0x1d552e[_0x10d7('0x3a')]=_[_0x10d7('0x3d')](_0x1d552e[_0x10d7('0x3a')],{'$or':_[_0x10d7('0x2a')](_0x1d552e[_0x10d7('0x33')],function(_0x52d965){var _0x2244e4={};_0x2244e4[_0x52d965]={'$like':'%'+_0x30c309[_0x10d7('0x30')][_0x10d7('0x3c')]+'%'};return _0x2244e4;})});}_0x1d552e=_[_0x10d7('0x3d')]({},_0x1d552e,_0x30c309[_0x10d7('0x3f')]);return db[_0x10d7('0x4c')]['count']({'where':_0x1d552e[_0x10d7('0x3a')]})[_0x10d7('0x24')](function(_0x371ce8){_0x536f6c[_0x10d7('0x4e')]=_0x371ce8;if(_0x30c309['query'][_0x10d7('0x40')]){_0x1d552e[_0x10d7('0x41')]=[{'all':!![]}];}return db[_0x10d7('0x4c')][_0x10d7('0x42')](_0x1d552e);})['then'](function(_0x4c3b5d){_0x536f6c['rows']=_0x4c3b5d;return _0x536f6c;});}})[_0x10d7('0x24')](respondWithFilteredResult(_0x2c9f60,_0x1d552e))['catch'](handleError(_0x2c9f60,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 01ee799..151fa2e 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 _0xa1c9=['../../config/environment','define','JscriptySessionReport','report_jscripty_sessions','util','../../config/logger','api','moment','rimraf'];(function(_0x168127,_0x59cea1){var _0x4c99ad=function(_0x4ab3f2){while(--_0x4ab3f2){_0x168127['push'](_0x168127['shift']());}};_0x4c99ad(++_0x59cea1);}(_0xa1c9,0xd3));var _0x9a1c=function(_0x120042,_0x1dcb92){_0x120042=_0x120042-0x0;var _0x2f13ee=_0xa1c9[_0x120042];return _0x2f13ee;};'use strict';var _=require('lodash');var util=require(_0x9a1c('0x0'));var logger=require(_0x9a1c('0x1'))(_0x9a1c('0x2'));var moment=require(_0x9a1c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9a1c('0x4'));var config=require(_0x9a1c('0x5'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x23243d,_0x22a769){return _0x23243d[_0x9a1c('0x6')](_0x9a1c('0x7'),attributes,{'tableName':_0x9a1c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e1f=['rimraf','../../config/environment','./jscriptySessionReport.attributes','define','JscriptySessionReport','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4df9e6,_0x4cc955){var _0x1198d3=function(_0x2fe2ff){while(--_0x2fe2ff){_0x4df9e6['push'](_0x4df9e6['shift']());}};_0x1198d3(++_0x4cc955);}(_0x3e1f,0xb5));var _0xf3e1=function(_0x5a5276,_0x262d69){_0x5a5276=_0x5a5276-0x0;var _0x3e8ee2=_0x3e1f[_0x5a5276];return _0x3e8ee2;};'use strict';var _=require(_0xf3e1('0x0'));var util=require(_0xf3e1('0x1'));var logger=require(_0xf3e1('0x2'))(_0xf3e1('0x3'));var moment=require('moment');var BPromise=require(_0xf3e1('0x4'));var rp=require(_0xf3e1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf3e1('0x6'));var config=require(_0xf3e1('0x7'));var attributes=require(_0xf3e1('0x8'));module['exports']=function(_0x14ec8d,_0x5af586){return _0x14ec8d[_0xf3e1('0x9')](_0xf3e1('0xa'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 7a09247..0818619 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 _0xa4e9=['stringify','error','message','result','lodash','util','randomstring','../../mysqldb','rpc','../../config/environment','request','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x142076,_0x364722){var _0x33b004=function(_0x4684ce){while(--_0x4684ce){_0x142076['push'](_0x142076['shift']());}};_0x33b004(++_0x364722);}(_0xa4e9,0x1c6));var _0x9a4e=function(_0x65fcbf,_0x480087){_0x65fcbf=_0x65fcbf-0x0;var _0x5cefdb=_0xa4e9[_0x65fcbf];return _0x5cefdb;};'use strict';var _=require(_0x9a4e('0x0'));var util=require(_0x9a4e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9a4e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a4e('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9a4e('0x4'));var config=require(_0x9a4e('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5543f2,_0x13c820,_0x47dc40){return new BPromise(function(_0x2c4483,_0x231eff){return client[_0x9a4e('0x6')](_0x5543f2,_0x47dc40)['then'](function(_0xfec7bb){logger['info'](_0x9a4e('0x7'),_0x13c820,'request\x20sent');logger[_0x9a4e('0x8')](_0x9a4e('0x9'),_0x13c820,_0x9a4e('0xa'),JSON[_0x9a4e('0xb')](_0xfec7bb));if(_0xfec7bb[_0x9a4e('0xc')]){if(_0xfec7bb[_0x9a4e('0xc')]['code']===0x1f4){logger['error'](_0x9a4e('0x7'),_0x13c820,_0xfec7bb[_0x9a4e('0xc')][_0x9a4e('0xd')]);return _0x231eff(_0xfec7bb['error']['message']);}logger[_0x9a4e('0xc')](_0x9a4e('0x7'),_0x13c820,_0xfec7bb[_0x9a4e('0xc')]['message']);return _0x2c4483(_0xfec7bb['error'][_0x9a4e('0xd')]);}else{logger['info'](_0x9a4e('0x7'),_0x13c820,'request\x20sent');_0x2c4483(_0xfec7bb[_0x9a4e('0xe')]['message']);}})['catch'](function(_0x828965){logger['error'](_0x9a4e('0x7'),_0x13c820,_0x828965);_0x231eff(_0x828965);});});} \ No newline at end of file +var _0xb11e=['rpc','../../config/environment','client','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xb11e,0x7d));var _0xeb11=function(_0x4d49b9,_0x4e2bc0){_0x4d49b9=_0x4d49b9-0x0;var _0x4828c0=_0xb11e[_0x4d49b9];return _0x4828c0;};'use strict';var _=require(_0xeb11('0x0'));var util=require(_0xeb11('0x1'));var moment=require(_0xeb11('0x2'));var BPromise=require(_0xeb11('0x3'));var rs=require(_0xeb11('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeb11('0x5'));var logger=require(_0xeb11('0x6'))(_0xeb11('0x7'));var config=require(_0xeb11('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xeb11('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53b7a1,_0x203d78,_0x4994a2){return new BPromise(function(_0x5e5648,_0xfa9ff7){return client[_0xeb11('0xa')](_0x53b7a1,_0x4994a2)[_0xeb11('0xb')](function(_0x4841d3){logger[_0xeb11('0xc')](_0xeb11('0xd'),_0x203d78,_0xeb11('0xe'));logger[_0xeb11('0xf')](_0xeb11('0x10'),_0x203d78,_0xeb11('0xe'),JSON[_0xeb11('0x11')](_0x4841d3));if(_0x4841d3[_0xeb11('0x12')]){if(_0x4841d3['error'][_0xeb11('0x13')]===0x1f4){logger[_0xeb11('0x12')](_0xeb11('0xd'),_0x203d78,_0x4841d3['error'][_0xeb11('0x14')]);return _0xfa9ff7(_0x4841d3['error'][_0xeb11('0x14')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x203d78,_0x4841d3[_0xeb11('0x12')][_0xeb11('0x14')]);return _0x5e5648(_0x4841d3[_0xeb11('0x12')][_0xeb11('0x14')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x203d78,_0xeb11('0xe'));_0x5e5648(_0x4841d3[_0xeb11('0x15')][_0xeb11('0x14')]);}})['catch'](function(_0x23acb4){logger['error'](_0xeb11('0xd'),_0x203d78,_0x23acb4);_0xfa9ff7(_0x23acb4);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 13103ed..531b00b 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 _0xb77e=['put','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x57056c,_0x12c8a1){var _0xb624a2=function(_0x3933fc){while(--_0x3933fc){_0x57056c['push'](_0x57056c['shift']());}};_0xb624a2(++_0x12c8a1);}(_0xb77e,0x17c));var _0xeb77=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xb77e[_0x23e7c1];return _0x1add43;};'use strict';var multer=require(_0xeb77('0x0'));var util=require(_0xeb77('0x1'));var path=require('path');var timeout=require(_0xeb77('0x2'));var express=require(_0xeb77('0x3'));var router=express[_0xeb77('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xeb77('0x5'));var interaction=require(_0xeb77('0x6'));var config=require(_0xeb77('0x7'));var controller=require('./license.controller');router[_0xeb77('0x8')]('/',controller[_0xeb77('0x9')]);router[_0xeb77('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xeb77('0xb')]);module[_0xeb77('0xc')]=router; \ No newline at end of file +var _0x3791=['get','index','put','/:id','isAuthenticated','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3138f7,_0x16eb5a){var _0x3d1c89=function(_0x835f0c){while(--_0x835f0c){_0x3138f7['push'](_0x3138f7['shift']());}};_0x3d1c89(++_0x16eb5a);}(_0x3791,0xe7));var _0x1379=function(_0x226bfa,_0x4ca14f){_0x226bfa=_0x226bfa-0x0;var _0x4797d5=_0x3791[_0x226bfa];return _0x4797d5;};'use strict';var multer=require(_0x1379('0x0'));var util=require(_0x1379('0x1'));var path=require('path');var timeout=require(_0x1379('0x2'));var express=require(_0x1379('0x3'));var router=express[_0x1379('0x4')]();var fs_extra=require(_0x1379('0x5'));var auth=require(_0x1379('0x6'));var interaction=require(_0x1379('0x7'));var config=require(_0x1379('0x8'));var controller=require('./license.controller');router[_0x1379('0x9')]('/',controller[_0x1379('0xa')]);router[_0x1379('0xb')](_0x1379('0xc'),auth[_0x1379('0xd')](),controller['update']);module[_0x1379('0xe')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index b275bf3..4f3b8b1 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 _0x687b=['TEXT','STRING','sequelize','exports'];(function(_0x50e1b1,_0xeccd9){var _0xb01103=function(_0x579c09){while(--_0x579c09){_0x50e1b1['push'](_0x50e1b1['shift']());}};_0xb01103(++_0xeccd9);}(_0x687b,0x14a));var _0xb687=function(_0x219729,_0x19f07d){_0x219729=_0x219729-0x0;var _0x35c464=_0x687b[_0x219729];return _0x35c464;};'use strict';var Sequelize=require(_0xb687('0x0'));module[_0xb687('0x1')]={'license':{'type':Sequelize[_0xb687('0x2')]},'data1':{'type':Sequelize[_0xb687('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x31f0=['TEXT','STRING','INTEGER','sequelize'];(function(_0x5c380f,_0x2bf568){var _0x1cb483=function(_0x2eb286){while(--_0x2eb286){_0x5c380f['push'](_0x5c380f['shift']());}};_0x1cb483(++_0x2bf568);}(_0x31f0,0xb7));var _0x031f=function(_0x4c6a95,_0x3c97bc){_0x4c6a95=_0x4c6a95-0x0;var _0x2369e6=_0x31f0[_0x4c6a95];return _0x2369e6;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'license':{'type':Sequelize[_0x031f('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x031f('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x031f('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 e6dc931..07705b1 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 _0x2607=['request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','apply','update','then','error','name','send','../../config/license/util','model','keys','License','rawAttributes','query','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','params','checkLicense','key','demo','rimraf','zip-dir','fast-json-patch'];(function(_0x1e91db,_0x5aaabe){var _0x5cb560=function(_0x27e456){while(--_0x27e456){_0x1e91db['push'](_0x1e91db['shift']());}};_0x5cb560(++_0x5aaabe);}(_0x2607,0xe1));var _0x7260=function(_0x1e05c1,_0x3cffa3){_0x1e05c1=_0x1e05c1-0x0;var _0x15f1ca=_0x2607[_0x1e05c1];return _0x15f1ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7260('0x0'));var zipdir=require(_0x7260('0x1'));var jsonpatch=require(_0x7260('0x2'));var rp=require(_0x7260('0x3'));var moment=require(_0x7260('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7260('0x5'));var util=require(_0x7260('0x6'));var path=require(_0x7260('0x7'));var sox=require(_0x7260('0x8'));var csv=require(_0x7260('0x9'));var ejs=require(_0x7260('0xa'));var fs=require('fs');var fs_extra=require(_0x7260('0xb'));var _=require('lodash');var squel=require(_0x7260('0xc'));var crypto=require(_0x7260('0xd'));var jsforce=require(_0x7260('0xe'));var deskjs=require(_0x7260('0xf'));var toCsv=require(_0x7260('0x9'));var querystring=require(_0x7260('0x10'));var Papa=require(_0x7260('0x11'));var Redis=require(_0x7260('0x12'));var authService=require(_0x7260('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7260('0x14'));var hardwareService=require(_0x7260('0x15'));var logger=require('../../config/logger')(_0x7260('0x16'));var utils=require('../../config/utils');var config=require(_0x7260('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7260('0x18'))['db'];function respondWithStatusCode(_0x23d8c2,_0x4579d7){_0x4579d7=_0x4579d7||0xcc;return function(_0x33d887){if(_0x33d887){return _0x23d8c2[_0x7260('0x19')](_0x4579d7);}return _0x23d8c2[_0x7260('0x1a')](_0x4579d7)[_0x7260('0x1b')]();};}function respondWithResult(_0x15d5d3,_0x4b642a){_0x4b642a=_0x4b642a||0xc8;return function(_0x573177){if(_0x573177){return _0x15d5d3['status'](_0x4b642a)[_0x7260('0x1c')](_0x573177);}};}function respondWithFilteredResult(_0xabc9bb,_0x148a0a){return function(_0x289b5c){if(_0x289b5c){var _0x5a8e60=_0x289b5c[_0x7260('0x1d')],_0xdba61d=_0x148a0a[_0x7260('0x1e')],_0x58203a=_0x148a0a[_0x7260('0x1e')]+_0x148a0a['limit'],_0x1a02bb;if(_0x58203a>=_0x5a8e60){_0x58203a=_0x5a8e60;_0x1a02bb=0xc8;}else{_0x1a02bb=0xce;}_0xabc9bb[_0x7260('0x1a')](_0x1a02bb);return _0xabc9bb['set']('Content-Range',_0xdba61d+'-'+_0x58203a+'/'+_0x5a8e60)[_0x7260('0x1c')](_0x289b5c);}return null;};}function patchUpdates(_0x29283e){return function(_0x34088a){try{jsonpatch[_0x7260('0x1f')](_0x34088a,_0x29283e,!![]);}catch(_0x4da563){return BPromise['reject'](_0x4da563);}return _0x34088a['save']();};}function saveUpdates(_0x5825c1,_0x126c83){return function(_0x1e1ddd){if(_0x1e1ddd){return _0x1e1ddd[_0x7260('0x20')](_0x5825c1)[_0x7260('0x21')](function(_0x50027e){return _0x50027e;});}return null;};}function removeEntity(_0x375f71,_0x49d398){return function(_0x11b68e){if(_0x11b68e){return _0x11b68e['destroy']()[_0x7260('0x21')](function(){_0x375f71[_0x7260('0x1a')](0xcc)[_0x7260('0x1b')]();});}};}function handleEntityNotFound(_0x762c87,_0x3bff16){return function(_0x4024c6){if(!_0x4024c6){_0x762c87[_0x7260('0x19')](0x194);}return _0x4024c6;};}function handleError(_0x2e1e0f,_0x5cd3ca){_0x5cd3ca=_0x5cd3ca||0x1f4;return function(_0x2f19b8){logger[_0x7260('0x22')](_0x2f19b8['stack']);if(_0x2f19b8[_0x7260('0x23')]){delete _0x2f19b8[_0x7260('0x23')];}_0x2e1e0f[_0x7260('0x1a')](_0x5cd3ca)[_0x7260('0x24')](_0x2f19b8);};}var utilLicense=require(_0x7260('0x25'));exports['index']=function(_0x303836,_0x35c85e){var _0x3336b6={'raw':!![],'where':{'id':0x1}},_0x338386={};_0x338386[_0x7260('0x26')]=_[_0x7260('0x27')](db[_0x7260('0x28')][_0x7260('0x29')]);_0x338386[_0x7260('0x2a')]=_['keys'](_0x303836[_0x7260('0x2a')]);_0x338386['filters']=_[_0x7260('0x2b')](_0x338386[_0x7260('0x26')],_0x338386['query']);_0x3336b6[_0x7260('0x2c')]=_[_0x7260('0x2b')](_0x338386[_0x7260('0x26')],qs[_0x7260('0x2d')](_0x303836[_0x7260('0x2a')][_0x7260('0x2d')]));_0x3336b6['attributes']=_0x3336b6[_0x7260('0x2c')][_0x7260('0x2e')]?_0x3336b6[_0x7260('0x2c')]:_0x338386[_0x7260('0x26')];_0x3336b6=_[_0x7260('0x2f')]({},_0x3336b6,_0x303836[_0x7260('0x30')]);return utilLicense[_0x7260('0x31')](_0x3336b6)[_0x7260('0x21')](respondWithResult(_0x35c85e,null))[_0x7260('0x32')](handleError(_0x35c85e,null));};exports[_0x7260('0x20')]=function(_0x32fd32,_0x2ea92a){if(_0x32fd32[_0x7260('0x33')]['id']){delete _0x32fd32[_0x7260('0x33')]['id'];}return db[_0x7260('0x28')][_0x7260('0x34')]({'where':{'id':_0x32fd32[_0x7260('0x35')]['id']}})[_0x7260('0x21')](handleEntityNotFound(_0x2ea92a,null))[_0x7260('0x21')](function(_0xaff3f9){var _0x135e3b=_0xaff3f9['get']({'plain':!![]});return utilLicense[_0x7260('0x36')](_0x135e3b,_0x32fd32[_0x7260('0x33')][_0x7260('0x37')]);})[_0x7260('0x21')](function(_0x37a2b2){if(!_0x37a2b2[_0x7260('0x38')]){return saveUpdates(_0x32fd32[_0x7260('0x33')],null);}return _0x37a2b2;})[_0x7260('0x21')](respondWithResult(_0x2ea92a,null))[_0x7260('0x32')](handleError(_0x2ea92a,null));}; \ No newline at end of file +var _0xfa13=['keys','License','rawAttributes','query','filters','intersection','attributes','fields','getLicense','catch','body','find','params','get','checkLicense','demo','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','count','offset','limit','set','Content-Range','update','then','sendStatus','stack','name','send','index','model'];(function(_0x2c6936,_0x518044){var _0x6f9fea=function(_0x22a5c5){while(--_0x22a5c5){_0x2c6936['push'](_0x2c6936['shift']());}};_0x6f9fea(++_0x518044);}(_0xfa13,0x132));var _0x3fa1=function(_0x11812c,_0x16d53b){_0x11812c=_0x11812c-0x0;var _0x2451f0=_0xfa13[_0x11812c];return _0x2451f0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3fa1('0x0'));var zipdir=require(_0x3fa1('0x1'));var jsonpatch=require(_0x3fa1('0x2'));var rp=require(_0x3fa1('0x3'));var moment=require(_0x3fa1('0x4'));var BPromise=require(_0x3fa1('0x5'));var Mustache=require(_0x3fa1('0x6'));var util=require('util');var path=require(_0x3fa1('0x7'));var sox=require(_0x3fa1('0x8'));var csv=require(_0x3fa1('0x9'));var ejs=require(_0x3fa1('0xa'));var fs=require('fs');var fs_extra=require(_0x3fa1('0xb'));var _=require(_0x3fa1('0xc'));var squel=require(_0x3fa1('0xd'));var crypto=require(_0x3fa1('0xe'));var jsforce=require(_0x3fa1('0xf'));var deskjs=require(_0x3fa1('0x10'));var toCsv=require(_0x3fa1('0x9'));var querystring=require('querystring');var Papa=require(_0x3fa1('0x11'));var Redis=require(_0x3fa1('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3fa1('0x13'));var hardwareService=require(_0x3fa1('0x14'));var logger=require(_0x3fa1('0x15'))(_0x3fa1('0x16'));var utils=require(_0x3fa1('0x17'));var config=require(_0x3fa1('0x18'));var licenseUtil=require(_0x3fa1('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43dc62,_0x188f7e){_0x188f7e=_0x188f7e||0xcc;return function(_0x475eed){if(_0x475eed){return _0x43dc62['sendStatus'](_0x188f7e);}return _0x43dc62['status'](_0x188f7e)[_0x3fa1('0x1a')]();};}function respondWithResult(_0x1fde21,_0x2fe836){_0x2fe836=_0x2fe836||0xc8;return function(_0x45fe9b){if(_0x45fe9b){return _0x1fde21[_0x3fa1('0x1b')](_0x2fe836)[_0x3fa1('0x1c')](_0x45fe9b);}};}function respondWithFilteredResult(_0x242157,_0x4caf9f){return function(_0x2985eb){if(_0x2985eb){var _0x47b155=_0x2985eb[_0x3fa1('0x1d')],_0x3ab39c=_0x4caf9f[_0x3fa1('0x1e')],_0x20ed70=_0x4caf9f['offset']+_0x4caf9f[_0x3fa1('0x1f')],_0x35be8f;if(_0x20ed70>=_0x47b155){_0x20ed70=_0x47b155;_0x35be8f=0xc8;}else{_0x35be8f=0xce;}_0x242157[_0x3fa1('0x1b')](_0x35be8f);return _0x242157[_0x3fa1('0x20')](_0x3fa1('0x21'),_0x3ab39c+'-'+_0x20ed70+'/'+_0x47b155)['json'](_0x2985eb);}return null;};}function patchUpdates(_0x5ed8ff){return function(_0x11d677){try{jsonpatch['apply'](_0x11d677,_0x5ed8ff,!![]);}catch(_0x537728){return BPromise['reject'](_0x537728);}return _0x11d677['save']();};}function saveUpdates(_0x3aab9a,_0x5f2214){return function(_0x3547bf){if(_0x3547bf){return _0x3547bf[_0x3fa1('0x22')](_0x3aab9a)[_0x3fa1('0x23')](function(_0x20be10){return _0x20be10;});}return null;};}function removeEntity(_0x50ed5e,_0x2100b5){return function(_0x401b19){if(_0x401b19){return _0x401b19['destroy']()[_0x3fa1('0x23')](function(){_0x50ed5e[_0x3fa1('0x1b')](0xcc)[_0x3fa1('0x1a')]();});}};}function handleEntityNotFound(_0x52839d,_0x5435d8){return function(_0x56d12f){if(!_0x56d12f){_0x52839d[_0x3fa1('0x24')](0x194);}return _0x56d12f;};}function handleError(_0x393ff6,_0x2a8329){_0x2a8329=_0x2a8329||0x1f4;return function(_0x202d37){logger['error'](_0x202d37[_0x3fa1('0x25')]);if(_0x202d37[_0x3fa1('0x26')]){delete _0x202d37[_0x3fa1('0x26')];}_0x393ff6[_0x3fa1('0x1b')](_0x2a8329)[_0x3fa1('0x27')](_0x202d37);};}var utilLicense=require(_0x3fa1('0x19'));exports[_0x3fa1('0x28')]=function(_0x51339c,_0x5ba7db){var _0x5072cc={'raw':!![],'where':{'id':0x1}},_0x27cd7d={};_0x27cd7d[_0x3fa1('0x29')]=_[_0x3fa1('0x2a')](db[_0x3fa1('0x2b')][_0x3fa1('0x2c')]);_0x27cd7d[_0x3fa1('0x2d')]=_[_0x3fa1('0x2a')](_0x51339c[_0x3fa1('0x2d')]);_0x27cd7d[_0x3fa1('0x2e')]=_[_0x3fa1('0x2f')](_0x27cd7d[_0x3fa1('0x29')],_0x27cd7d['query']);_0x5072cc[_0x3fa1('0x30')]=_[_0x3fa1('0x2f')](_0x27cd7d['model'],qs[_0x3fa1('0x31')](_0x51339c[_0x3fa1('0x2d')][_0x3fa1('0x31')]));_0x5072cc['attributes']=_0x5072cc[_0x3fa1('0x30')]['length']?_0x5072cc[_0x3fa1('0x30')]:_0x27cd7d[_0x3fa1('0x29')];_0x5072cc=_['merge']({},_0x5072cc,_0x51339c['options']);return utilLicense[_0x3fa1('0x32')](_0x5072cc)['then'](respondWithResult(_0x5ba7db,null))[_0x3fa1('0x33')](handleError(_0x5ba7db,null));};exports[_0x3fa1('0x22')]=function(_0x3989be,_0xe2c66){if(_0x3989be['body']['id']){delete _0x3989be[_0x3fa1('0x34')]['id'];}return db[_0x3fa1('0x2b')][_0x3fa1('0x35')]({'where':{'id':_0x3989be[_0x3fa1('0x36')]['id']}})['then'](handleEntityNotFound(_0xe2c66,null))[_0x3fa1('0x23')](function(_0x20f178){var _0x4b90a4=_0x20f178[_0x3fa1('0x37')]({'plain':!![]});return utilLicense[_0x3fa1('0x38')](_0x4b90a4,_0x3989be[_0x3fa1('0x34')]['key']);})[_0x3fa1('0x23')](function(_0x2816bb){if(!_0x2816bb[_0x3fa1('0x39')]){return saveUpdates(_0x3989be[_0x3fa1('0x34')],null);}return _0x2816bb;})[_0x3fa1('0x23')](respondWithResult(_0xe2c66,null))[_0x3fa1('0x33')](handleError(_0xe2c66,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 82802da..c7c5ba1 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 _0x435a=['bluebird','request-promise','./license.attributes','exports','define','License','license'];(function(_0x1a8478,_0x54ca9a){var _0x5d8d9e=function(_0x2759d8){while(--_0x2759d8){_0x1a8478['push'](_0x1a8478['shift']());}};_0x5d8d9e(++_0x54ca9a);}(_0x435a,0x13b));var _0xa435=function(_0xde4f09,_0x3f451e){_0xde4f09=_0xde4f09-0x0;var _0xcbdfb3=_0x435a[_0xde4f09];return _0xcbdfb3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa435('0x0'));var rp=require(_0xa435('0x1'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa435('0x2'));module[_0xa435('0x3')]=function(_0x1a8386,_0xc88a73){return _0x1a8386[_0xa435('0x4')](_0xa435('0x5'),attributes,{'tableName':_0xa435('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a44=['License','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0xf876e2,_0x25b687){var _0xb00743=function(_0x27d201){while(--_0x27d201){_0xf876e2['push'](_0xf876e2['shift']());}};_0xb00743(++_0x25b687);}(_0x9a44,0x156));var _0x49a4=function(_0x5abcc2,_0x140309){_0x5abcc2=_0x5abcc2-0x0;var _0x1dedff=_0x9a44[_0x5abcc2];return _0x1dedff;};'use strict';var _=require(_0x49a4('0x0'));var util=require(_0x49a4('0x1'));var logger=require(_0x49a4('0x2'))('api');var moment=require(_0x49a4('0x3'));var BPromise=require(_0x49a4('0x4'));var rp=require(_0x49a4('0x5'));var fs=require('fs');var path=require(_0x49a4('0x6'));var rimraf=require(_0x49a4('0x7'));var config=require(_0x49a4('0x8'));var attributes=require('./license.attributes');module['exports']=function(_0x52eb1d,_0x14d299){return _0x52eb1d[_0x49a4('0x9')](_0x49a4('0xa'),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 e118363..6e5f2fa 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 _0x24cf=['info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x15b101,_0x2a629c){var _0x399e7b=function(_0x29ebbf){while(--_0x29ebbf){_0x15b101['push'](_0x15b101['shift']());}};_0x399e7b(++_0x2a629c);}(_0x24cf,0x1d5));var _0xf24c=function(_0x14e7ef,_0x9390b8){_0x14e7ef=_0x14e7ef-0x0;var _0x39cf0a=_0x24cf[_0x14e7ef];return _0x39cf0a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf24c('0x0'));var BPromise=require(_0xf24c('0x1'));var rs=require(_0xf24c('0x2'));var fs=require('fs');var Redis=require(_0xf24c('0x3'));var db=require(_0xf24c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf24c('0x5'))(_0xf24c('0x6'));var config=require(_0xf24c('0x7'));var jayson=require(_0xf24c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5104bd,_0x272d25,_0x596e81){return new BPromise(function(_0x3b7cf1,_0x13163e){return client[_0xf24c('0x9')](_0x5104bd,_0x596e81)[_0xf24c('0xa')](function(_0x4b3ea3){logger[_0xf24c('0xb')](_0xf24c('0xc'),_0x272d25,_0xf24c('0xd'));logger[_0xf24c('0xe')](_0xf24c('0xf'),_0x272d25,_0xf24c('0xd'),JSON['stringify'](_0x4b3ea3));if(_0x4b3ea3[_0xf24c('0x10')]){if(_0x4b3ea3[_0xf24c('0x10')][_0xf24c('0x11')]===0x1f4){logger['error'](_0xf24c('0xc'),_0x272d25,_0x4b3ea3[_0xf24c('0x10')]['message']);return _0x13163e(_0x4b3ea3['error'][_0xf24c('0x12')]);}logger['error'](_0xf24c('0xc'),_0x272d25,_0x4b3ea3[_0xf24c('0x10')]['message']);return _0x3b7cf1(_0x4b3ea3[_0xf24c('0x10')][_0xf24c('0x12')]);}else{logger[_0xf24c('0xb')](_0xf24c('0xc'),_0x272d25,_0xf24c('0xd'));_0x3b7cf1(_0x4b3ea3['result']['message']);}})[_0xf24c('0x13')](function(_0x462801){logger['error'](_0xf24c('0xc'),_0x272d25,_0x462801);_0x13163e(_0x462801);});});} \ No newline at end of file +var _0x49e9=['stringify','error','code','License,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s'];(function(_0x43a7ea,_0x35316){var _0x15d84b=function(_0x2e09d8){while(--_0x2e09d8){_0x43a7ea['push'](_0x43a7ea['shift']());}};_0x15d84b(++_0x35316);}(_0x49e9,0x10f));var _0x949e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49e9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x949e('0x0'));var util=require(_0x949e('0x1'));var moment=require('moment');var BPromise=require(_0x949e('0x2'));var rs=require(_0x949e('0x3'));var fs=require('fs');var Redis=require(_0x949e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x949e('0x5'))('rpc');var config=require(_0x949e('0x6'));var jayson=require(_0x949e('0x7'));var client=jayson[_0x949e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17f649,_0x16c669,_0xfc4f8a){return new BPromise(function(_0x34ee57,_0x40d442){return client[_0x949e('0x9')](_0x17f649,_0xfc4f8a)[_0x949e('0xa')](function(_0x56e31d){logger[_0x949e('0xb')]('License,\x20%s,\x20%s',_0x16c669,_0x949e('0xc'));logger[_0x949e('0xd')](_0x949e('0xe'),_0x16c669,'request\x20sent',JSON[_0x949e('0xf')](_0x56e31d));if(_0x56e31d[_0x949e('0x10')]){if(_0x56e31d[_0x949e('0x10')][_0x949e('0x11')]===0x1f4){logger[_0x949e('0x10')](_0x949e('0x12'),_0x16c669,_0x56e31d[_0x949e('0x10')][_0x949e('0x13')]);return _0x40d442(_0x56e31d[_0x949e('0x10')][_0x949e('0x13')]);}logger[_0x949e('0x10')](_0x949e('0x12'),_0x16c669,_0x56e31d[_0x949e('0x10')][_0x949e('0x13')]);return _0x34ee57(_0x56e31d[_0x949e('0x10')]['message']);}else{logger[_0x949e('0xb')](_0x949e('0x12'),_0x16c669,_0x949e('0xc'));_0x34ee57(_0x56e31d[_0x949e('0x14')]['message']);}})[_0x949e('0x15')](function(_0x441b80){logger['error'](_0x949e('0x12'),_0x16c669,_0x441b80);_0x40d442(_0x441b80);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 4b96ef6..28bf4cf 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 _0xdfb9=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','addImap','/:id/out_servers','addSmtp','addApplications','/:id/send','addAgents','update','delete','removeAnswers','removeImap','removeSmtp','destroy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdfb9,0x171));var _0x9dfb=function(_0x364b04,_0x5a95e5){_0x364b04=_0x364b04-0x0;var _0x4442fc=_0xdfb9[_0x364b04];return _0x4442fc;};'use strict';var multer=require(_0x9dfb('0x0'));var util=require('util');var path=require(_0x9dfb('0x1'));var timeout=require(_0x9dfb('0x2'));var express=require(_0x9dfb('0x3'));var router=express[_0x9dfb('0x4')]();var fs_extra=require(_0x9dfb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9dfb('0x6'));var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0x9dfb('0x7')]('/',auth[_0x9dfb('0x8')](),controller[_0x9dfb('0x9')]);router[_0x9dfb('0x7')](_0x9dfb('0xa'),auth[_0x9dfb('0x8')](),controller[_0x9dfb('0xb')]);router[_0x9dfb('0x7')](_0x9dfb('0xc'),auth['isAuthenticated'](),controller[_0x9dfb('0xd')]);router[_0x9dfb('0x7')]('/:id/dispositions',auth[_0x9dfb('0x8')](),controller[_0x9dfb('0xe')]);router[_0x9dfb('0x7')](_0x9dfb('0xf'),auth[_0x9dfb('0x8')](),controller[_0x9dfb('0x10')]);router[_0x9dfb('0x7')](_0x9dfb('0x11'),auth[_0x9dfb('0x8')](),controller[_0x9dfb('0x12')]);router[_0x9dfb('0x7')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x9dfb('0x13')]);router['get'](_0x9dfb('0x14'),auth['isAuthenticated'](),controller[_0x9dfb('0x15')]);router[_0x9dfb('0x7')](_0x9dfb('0x16'),auth[_0x9dfb('0x8')](),controller[_0x9dfb('0x17')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x9dfb('0x18')]);router[_0x9dfb('0x7')](_0x9dfb('0x19'),auth['isAuthenticated'](),controller[_0x9dfb('0x1a')]);router[_0x9dfb('0x7')](_0x9dfb('0x1b'),auth[_0x9dfb('0x8')](),controller[_0x9dfb('0x1c')]);router[_0x9dfb('0x1d')](_0x9dfb('0x1e'),auth[_0x9dfb('0x8')](),controller[_0x9dfb('0x1f')]);router[_0x9dfb('0x1d')]('/:id/canned_answers',auth[_0x9dfb('0x8')](),controller[_0x9dfb('0x20')]);router['post']('/',auth[_0x9dfb('0x8')](),controller['create']);router['post']('/:id/in_servers',auth[_0x9dfb('0x8')](),controller[_0x9dfb('0x21')]);router[_0x9dfb('0x1d')](_0x9dfb('0x22'),auth[_0x9dfb('0x8')](),controller[_0x9dfb('0x23')]);router[_0x9dfb('0x1d')](_0x9dfb('0x14'),auth[_0x9dfb('0x8')](),controller['addInteraction']);router['post']('/:id/applications',auth[_0x9dfb('0x8')](),controller[_0x9dfb('0x24')]);router[_0x9dfb('0x1d')](_0x9dfb('0x25'),auth[_0x9dfb('0x8')](),controller['send']);router[_0x9dfb('0x1d')](_0x9dfb('0x1b'),auth['isAuthenticated'](),controller[_0x9dfb('0x26')]);router['put'](_0x9dfb('0xc'),auth[_0x9dfb('0x8')](),controller[_0x9dfb('0x27')]);router[_0x9dfb('0x28')](_0x9dfb('0x1e'),auth[_0x9dfb('0x8')](),controller['removeDispositions']);router[_0x9dfb('0x28')]('/:id/canned_answers',auth[_0x9dfb('0x8')](),controller[_0x9dfb('0x29')]);router[_0x9dfb('0x28')](_0x9dfb('0x11'),auth[_0x9dfb('0x8')](),controller[_0x9dfb('0x2a')]);router[_0x9dfb('0x28')]('/:id/out_servers',auth[_0x9dfb('0x8')](),controller[_0x9dfb('0x2b')]);router[_0x9dfb('0x28')](_0x9dfb('0xc'),auth[_0x9dfb('0x8')](),controller[_0x9dfb('0x2c')]);router[_0x9dfb('0x28')](_0x9dfb('0x1b'),auth[_0x9dfb('0x8')](),controller['removeAgents']);module[_0x9dfb('0x2d')]=router; \ No newline at end of file +var _0xde5e=['getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','addImap','addInteraction','addApplications','/:id/send','send','put','update','delete','removeAnswers','removeImap','removeSmtp','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','describe','get','/:id','/:id/dispositions'];(function(_0x2002b3,_0x11e91c){var _0x2756f0=function(_0x4bf0b3){while(--_0x4bf0b3){_0x2002b3['push'](_0x2002b3['shift']());}};_0x2756f0(++_0x11e91c);}(_0xde5e,0x187));var _0xede5=function(_0x1087dc,_0x456f3c){_0x1087dc=_0x1087dc-0x0;var _0xe2fbcf=_0xde5e[_0x1087dc];return _0xe2fbcf;};'use strict';var multer=require('multer');var util=require(_0xede5('0x0'));var path=require('path');var timeout=require(_0xede5('0x1'));var express=require(_0xede5('0x2'));var router=express[_0xede5('0x3')]();var fs_extra=require(_0xede5('0x4'));var auth=require(_0xede5('0x5'));var interaction=require(_0xede5('0x6'));var config=require(_0xede5('0x7'));var controller=require('./mailAccount.controller');router['get']('/',auth[_0xede5('0x8')](),controller[_0xede5('0x9')]);router['get']('/describe',auth[_0xede5('0x8')](),controller[_0xede5('0xa')]);router[_0xede5('0xb')](_0xede5('0xc'),auth[_0xede5('0x8')](),controller['show']);router[_0xede5('0xb')](_0xede5('0xd'),auth['isAuthenticated'](),controller[_0xede5('0xe')]);router['get'](_0xede5('0xf'),auth[_0xede5('0x8')](),controller['getAnswers']);router[_0xede5('0xb')](_0xede5('0x10'),auth[_0xede5('0x8')](),controller[_0xede5('0x11')]);router[_0xede5('0xb')](_0xede5('0x12'),auth[_0xede5('0x8')](),controller[_0xede5('0x13')]);router['get'](_0xede5('0x14'),auth[_0xede5('0x8')](),controller[_0xede5('0x15')]);router[_0xede5('0xb')](_0xede5('0x16'),auth['isAuthenticated'](),controller['getApplications']);router[_0xede5('0xb')](_0xede5('0x17'),auth[_0xede5('0x8')](),controller[_0xede5('0x18')]);router[_0xede5('0xb')](_0xede5('0x19'),auth[_0xede5('0x8')](),controller[_0xede5('0x1a')]);router[_0xede5('0xb')](_0xede5('0x1b'),auth['isAuthenticated'](),controller[_0xede5('0x1c')]);router[_0xede5('0x1d')](_0xede5('0xd'),auth[_0xede5('0x8')](),controller[_0xede5('0x1e')]);router['post']('/:id/canned_answers',auth[_0xede5('0x8')](),controller[_0xede5('0x1f')]);router[_0xede5('0x1d')]('/',auth[_0xede5('0x8')](),controller['create']);router[_0xede5('0x1d')](_0xede5('0x10'),auth[_0xede5('0x8')](),controller[_0xede5('0x20')]);router[_0xede5('0x1d')](_0xede5('0x12'),auth[_0xede5('0x8')](),controller['addSmtp']);router[_0xede5('0x1d')](_0xede5('0x14'),auth[_0xede5('0x8')](),controller[_0xede5('0x21')]);router[_0xede5('0x1d')](_0xede5('0x16'),auth[_0xede5('0x8')](),controller[_0xede5('0x22')]);router[_0xede5('0x1d')](_0xede5('0x23'),auth[_0xede5('0x8')](),controller[_0xede5('0x24')]);router[_0xede5('0x1d')]('/:id/users',auth[_0xede5('0x8')](),controller['addAgents']);router[_0xede5('0x25')](_0xede5('0xc'),auth[_0xede5('0x8')](),controller[_0xede5('0x26')]);router['delete']('/:id/dispositions',auth[_0xede5('0x8')](),controller['removeDispositions']);router[_0xede5('0x27')](_0xede5('0xf'),auth[_0xede5('0x8')](),controller[_0xede5('0x28')]);router['delete'](_0xede5('0x10'),auth[_0xede5('0x8')](),controller[_0xede5('0x29')]);router[_0xede5('0x27')]('/:id/out_servers',auth[_0xede5('0x8')](),controller[_0xede5('0x2a')]);router['delete'](_0xede5('0xc'),auth[_0xede5('0x8')](),controller[_0xede5('0x2b')]);router[_0xede5('0x27')]('/:id/users',auth[_0xede5('0x8')](),controller['removeAgents']);module[_0xede5('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 1ab87a6..f6b0c66 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 _0x1dec=['mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x14f262,_0xf7a7ef){var _0x216dbb=function(_0x1fef52){while(--_0x1fef52){_0x14f262['push'](_0x14f262['shift']());}};_0x216dbb(++_0xf7a7ef);}(_0x1dec,0x91));var _0xc1de=function(_0x449159,_0x223c13){_0x449159=_0x449159-0x0;var _0x40e721=_0x1dec[_0x449159];return _0x40e721;};'use strict';var Sequelize=require('sequelize');module[_0xc1de('0x0')]={'description':{'type':Sequelize[_0xc1de('0x1')]},'name':{'type':Sequelize[_0xc1de('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xc1de('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xc1de('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xc1de('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc1de('0x3')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xc1de('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xc1de('0x5')],'defaultValue':function(){return _0xc1de('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc1de('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc1de('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc1de('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc1de('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xc1de('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xc1de('0x2')],'defaultValue':![],'comment':_0xc1de('0x9'),'set':function(_0x3be55d){if(!_0x3be55d)this[_0xc1de('0xa')](_0xc1de('0xb'),null);this[_0xc1de('0xa')](_0xc1de('0xc'),_0x3be55d);}}}; \ No newline at end of file +var _0x7612=['BOOLEAN','TEXT','Arial,Helvetica,sans-serif','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','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING'];(function(_0x423dd4,_0x34d52b){var _0x2de11c=function(_0x1c8780){while(--_0x1c8780){_0x423dd4['push'](_0x423dd4['shift']());}};_0x2de11c(++_0x34d52b);}(_0x7612,0x15b));var _0x2761=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0x7612[_0x3207aa];return _0x51758f;};'use strict';var Sequelize=require(_0x2761('0x0'));module[_0x2761('0x1')]={'description':{'type':Sequelize[_0x2761('0x2')]},'name':{'type':Sequelize[_0x2761('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x2761('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x2761('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x2761('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x2761('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x2761('0x4')]},'markAsUnread':{'type':Sequelize[_0x2761('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x2761('0x2')],'allowNull':![],'defaultValue':_0x2761('0x5')},'fontSize':{'type':Sequelize[_0x2761('0x6')](0x2)[_0x2761('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x2761('0x4')],'defaultValue':function(){return _0x2761('0x8');}},'notificationSound':{'type':Sequelize[_0x2761('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2761('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2761('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2761('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2761('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2761('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2761('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x2761('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x2761('0x3')],'defaultValue':![],'comment':_0x2761('0xa'),'set':function(_0x1d50c4){if(!_0x1d50c4)this[_0x2761('0xb')](_0x2761('0xc'),null);this[_0x2761('0xb')](_0x2761('0xd'),_0x1d50c4);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index f386daa..5c56551 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 _0xb10b=['Pause','find','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','removeDispositions','addAnswer','getAnswers','CannedAnswer','rawAttributes','length','rows','removeAnswers','ListId','active','description','isNil','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','getInteractions','MailInteraction','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','MailApplication','bulkCreate','findAndCountAll','getApplications','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','split','CmList','Contacts','DESC','%s\x20<%s>','email','attachments','join','root','secure','auth','SendMail','sendMail','List','List\x20not\x20found','messageId','from','out','format','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','addAgents','ids','omit','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','juice','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','json','offset','limit','set','Content-Range','apply','save','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','Imap','MailServerOut','Smtp','mandatoryDispositionPause','map','MailAccount','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','count','includeAll','include','findAll','show','params','MailServerIn'];(function(_0x330696,_0x4bc5b3){var _0x3f4789=function(_0xfe9a19){while(--_0xfe9a19){_0x330696['push'](_0x330696['shift']());}};_0x3f4789(++_0x4bc5b3);}(_0xb10b,0x12a));var _0xbb10=function(_0x38fbc2,_0x641aa1){_0x38fbc2=_0x38fbc2-0x0;var _0x43c7d4=_0xb10b[_0x38fbc2];return _0x43c7d4;};'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 htmlToText=require(_0xbb10('0x11'));var juice=require(_0xbb10('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbb10('0x13'));var as=require(_0xbb10('0x14'));var hardwareService=require(_0xbb10('0x15'));var logger=require('../../config/logger')(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var licenseUtil=require(_0xbb10('0x18'));var db=require(_0xbb10('0x19'))['db'];config[_0xbb10('0x1a')]=_[_0xbb10('0x1b')](config[_0xbb10('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xbb10('0x1c'))(new Redis(config[_0xbb10('0x1a')]));require(_0xbb10('0x1d'))[_0xbb10('0x1e')](socket);var jayson=require(_0xbb10('0x1f'));var client=jayson[_0xbb10('0x20')][_0xbb10('0x21')]({'port':0x232b});function respondWithRpcPromise(_0x36b5e8,_0x3e26f4,_0x2b184e,_0x4a2bfc){return new BPromise(function(_0x2eca0f,_0x1145f1){var _0x133ac2=_0x4a2bfc||client;return _0x133ac2[_0xbb10('0x22')](_0x36b5e8,_0x2b184e)[_0xbb10('0x23')](function(_0x1682a4){logger[_0xbb10('0x24')](_0xbb10('0x25'),_0x3e26f4,_0xbb10('0x26'));logger[_0xbb10('0x27')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x3e26f4,_0xbb10('0x26'),JSON[_0xbb10('0x28')](_0x1682a4));if(_0x1682a4[_0xbb10('0x29')]){if(_0x1682a4[_0xbb10('0x29')][_0xbb10('0x2a')]===0x1f4){logger[_0xbb10('0x29')]('MailAccount,\x20%s,\x20%s',_0x3e26f4,_0x1682a4[_0xbb10('0x29')][_0xbb10('0x2b')]);return _0x1145f1(_0x1682a4['error']['message']);}logger[_0xbb10('0x29')](_0xbb10('0x25'),_0x3e26f4,_0x1682a4[_0xbb10('0x29')][_0xbb10('0x2b')]);return _0x2eca0f(_0x1682a4[_0xbb10('0x29')][_0xbb10('0x2b')]);}else{logger[_0xbb10('0x24')](_0xbb10('0x25'),_0x3e26f4,_0xbb10('0x26'));_0x2eca0f(_0x1682a4[_0xbb10('0x2c')][_0xbb10('0x2b')]);}})[_0xbb10('0x2d')](function(_0x537898){logger['error']('MailAccount,\x20%s,\x20%s',_0x3e26f4,_0x537898);_0x1145f1(_0x537898);});});}function respondWithStatusCode(_0xc93a04,_0x3c5ae7){_0x3c5ae7=_0x3c5ae7||0xcc;return function(_0x2c89b9){if(_0x2c89b9){return _0xc93a04['sendStatus'](_0x3c5ae7);}return _0xc93a04[_0xbb10('0x2e')](_0x3c5ae7)[_0xbb10('0x2f')]();};}function respondWithResult(_0x6ed43b,_0x1d5e95){_0x1d5e95=_0x1d5e95||0xc8;return function(_0x1acce9){if(_0x1acce9){return _0x6ed43b[_0xbb10('0x2e')](_0x1d5e95)[_0xbb10('0x30')](_0x1acce9);}};}function respondWithFilteredResult(_0x4aabb9,_0x3796c7){return function(_0x21ac54){if(_0x21ac54){var _0xfc3595=_0x21ac54['count'],_0x2e0249=_0x3796c7[_0xbb10('0x31')],_0x1d30aa=_0x3796c7['offset']+_0x3796c7[_0xbb10('0x32')],_0x2ff4c1;if(_0x1d30aa>=_0xfc3595){_0x1d30aa=_0xfc3595;_0x2ff4c1=0xc8;}else{_0x2ff4c1=0xce;}_0x4aabb9['status'](_0x2ff4c1);return _0x4aabb9[_0xbb10('0x33')](_0xbb10('0x34'),_0x2e0249+'-'+_0x1d30aa+'/'+_0xfc3595)[_0xbb10('0x30')](_0x21ac54);}return null;};}function patchUpdates(_0x491db4){return function(_0x518d47){try{jsonpatch[_0xbb10('0x35')](_0x518d47,_0x491db4,!![]);}catch(_0x34f65e){return BPromise['reject'](_0x34f65e);}return _0x518d47[_0xbb10('0x36')]();};}function saveUpdates(_0x37dde7,_0x2f653f){return function(_0x1c0b57){if(_0x1c0b57){return _0x1c0b57[_0xbb10('0x37')](_0x37dde7)[_0xbb10('0x23')](function(_0xf85197){return _0xf85197;});}return null;};}function removeEntity(_0x4975f5,_0x25acb3){return function(_0x1da9c9){if(_0x1da9c9){return _0x1da9c9[_0xbb10('0x38')]()[_0xbb10('0x23')](function(){var _0xfb2c5e=_0x1da9c9[_0xbb10('0x39')]({'plain':!![]});var _0x188cbd=_0xbb10('0x3a');return db[_0xbb10('0x3b')]['destroy']({'where':{'type':_0x188cbd,'resourceId':_0xfb2c5e['id']}})[_0xbb10('0x23')](function(){return _0x1da9c9;});})[_0xbb10('0x23')](function(){_0x4975f5[_0xbb10('0x2e')](0xcc)[_0xbb10('0x2f')]();});}};}function handleEntityNotFound(_0x570f5a,_0x111762){return function(_0x5de37b){if(!_0x5de37b){_0x570f5a['sendStatus'](0x194);}return _0x5de37b;};}function handleError(_0x3eb3cc,_0x40c164){_0x40c164=_0x40c164||0x1f4;return function(_0x26e76a){logger[_0xbb10('0x29')](_0x26e76a[_0xbb10('0x3c')]);if(_0x26e76a[_0xbb10('0x3d')]){delete _0x26e76a['name'];}_0x3eb3cc[_0xbb10('0x2e')](_0x40c164)[_0xbb10('0x3e')](_0x26e76a);};}exports['index']=function(_0x5e3fbd,_0x5cd55f){var _0x31bee3={'include':[{'model':db['MailServerIn'],'as':_0xbb10('0x3f')},{'model':db[_0xbb10('0x40')],'as':_0xbb10('0x41')},{'model':db['Pause'],'as':_0xbb10('0x42')}]},_0x2b0b45={},_0x2b658a={'count':0x0,'rows':[]};var _0x12238a=_[_0xbb10('0x43')](db[_0xbb10('0x44')]['rawAttributes'],function(_0xd238e9){return{'name':_0xd238e9[_0xbb10('0x45')],'type':_0xd238e9['type'][_0xbb10('0x46')]};});_0x2b0b45[_0xbb10('0x47')]=_[_0xbb10('0x43')](_0x12238a,_0xbb10('0x3d'));_0x2b0b45[_0xbb10('0x48')]=_[_0xbb10('0x49')](_0x5e3fbd['query']);_0x2b0b45[_0xbb10('0x4a')]=_[_0xbb10('0x4b')](_0x2b0b45[_0xbb10('0x47')],_0x2b0b45[_0xbb10('0x48')]);_0x31bee3['attributes']=_[_0xbb10('0x4b')](_0x2b0b45[_0xbb10('0x47')],qs[_0xbb10('0x4c')](_0x5e3fbd[_0xbb10('0x48')]['fields']));_0x31bee3[_0xbb10('0x4d')]=_0x31bee3[_0xbb10('0x4d')]['length']?_0x31bee3['attributes']:_0x2b0b45[_0xbb10('0x47')];if(!_0x5e3fbd['query'][_0xbb10('0x4e')](_0xbb10('0x4f'))){_0x31bee3['limit']=qs[_0xbb10('0x32')](_0x5e3fbd[_0xbb10('0x48')][_0xbb10('0x32')]);_0x31bee3['offset']=qs[_0xbb10('0x31')](_0x5e3fbd[_0xbb10('0x48')][_0xbb10('0x31')]);}_0x31bee3[_0xbb10('0x50')]=qs[_0xbb10('0x51')](_0x5e3fbd[_0xbb10('0x48')][_0xbb10('0x51')]);_0x31bee3[_0xbb10('0x52')]=qs[_0xbb10('0x4a')](_[_0xbb10('0x53')](_0x5e3fbd[_0xbb10('0x48')],_0x2b0b45[_0xbb10('0x4a')]),_0x12238a);if(_0x5e3fbd['query'][_0xbb10('0x54')]){_0x31bee3[_0xbb10('0x52')]=_['merge'](_0x31bee3[_0xbb10('0x52')],{'$or':_[_0xbb10('0x43')](_0x12238a,function(_0x1a7df6){if(_0x1a7df6[_0xbb10('0x55')]!==_0xbb10('0x56')){var _0x39f0de={};_0x39f0de[_0x1a7df6[_0xbb10('0x3d')]]={'$like':'%'+_0x5e3fbd['query']['filter']+'%'};return _0x39f0de;}})});}_0x31bee3=_[_0xbb10('0x57')]({},_0x31bee3,_0x5e3fbd[_0xbb10('0x58')]);var _0x2b12bd={'where':_0x31bee3['where']};return db['MailAccount'][_0xbb10('0x59')](_0x2b12bd)[_0xbb10('0x23')](function(_0x1bd054){_0x2b658a[_0xbb10('0x59')]=_0x1bd054;if(_0x5e3fbd[_0xbb10('0x48')][_0xbb10('0x5a')]){_0x31bee3[_0xbb10('0x5b')]=[{'all':!![]}];}return db[_0xbb10('0x44')][_0xbb10('0x5c')](_0x31bee3);})[_0xbb10('0x23')](function(_0x550111){_0x2b658a['rows']=_0x550111;return _0x2b658a;})[_0xbb10('0x23')](respondWithFilteredResult(_0x5cd55f,_0x31bee3))[_0xbb10('0x2d')](handleError(_0x5cd55f,null));};exports[_0xbb10('0x5d')]=function(_0xb014b0,_0x36aa7d){var _0x440f9e={'raw':![],'where':{'id':_0xb014b0[_0xbb10('0x5e')]['id']},'include':[{'model':db[_0xbb10('0x5f')],'as':_0xbb10('0x3f')},{'model':db[_0xbb10('0x40')],'as':_0xbb10('0x41')},{'model':db[_0xbb10('0x60')],'as':_0xbb10('0x42')}]},_0x358e7e={};_0x358e7e[_0xbb10('0x47')]=_['keys'](db[_0xbb10('0x44')]['rawAttributes']);_0x358e7e[_0xbb10('0x48')]=_[_0xbb10('0x49')](_0xb014b0[_0xbb10('0x48')]);_0x358e7e[_0xbb10('0x4a')]=_[_0xbb10('0x4b')](_0x358e7e[_0xbb10('0x47')],_0x358e7e[_0xbb10('0x48')]);_0x440f9e[_0xbb10('0x4d')]=_[_0xbb10('0x4b')](_0x358e7e[_0xbb10('0x47')],qs[_0xbb10('0x4c')](_0xb014b0[_0xbb10('0x48')][_0xbb10('0x4c')]));_0x440f9e[_0xbb10('0x4d')]=_0x440f9e[_0xbb10('0x4d')]['length']?_0x440f9e[_0xbb10('0x4d')]:_0x358e7e[_0xbb10('0x47')];if(_0xb014b0[_0xbb10('0x48')][_0xbb10('0x5a')]){_0x440f9e[_0xbb10('0x5b')]=[{'all':!![]}];}_0x440f9e=_[_0xbb10('0x57')]({},_0x440f9e,_0xb014b0['options']);return db[_0xbb10('0x44')][_0xbb10('0x61')](_0x440f9e)[_0xbb10('0x23')](handleEntityNotFound(_0x36aa7d,null))[_0xbb10('0x23')](respondWithResult(_0x36aa7d,null))[_0xbb10('0x2d')](handleError(_0x36aa7d,null));};exports[_0xbb10('0x37')]=function(_0x175872,_0x12ec18){if(_0x175872[_0xbb10('0x62')]['id']){delete _0x175872[_0xbb10('0x62')]['id'];}return db[_0xbb10('0x44')][_0xbb10('0x61')]({'where':{'id':_0x175872[_0xbb10('0x5e')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0xbb10('0x40')],'as':_0xbb10('0x41')},{'model':db[_0xbb10('0x60')],'as':_0xbb10('0x42')}]})['then'](handleEntityNotFound(_0x12ec18,null))['then'](saveUpdates(_0x175872[_0xbb10('0x62')],null))[_0xbb10('0x23')](function(_0x410bef){if(_0x410bef&&_0x175872[_0xbb10('0x62')][_0xbb10('0x3f')]){return db[_0xbb10('0x5f')][_0xbb10('0x37')](_0x175872['body'][_0xbb10('0x3f')],{'where':{'MailAccountId':_0x410bef['id']}})[_0xbb10('0x23')](function(){return _0x410bef;});}return _0x410bef;})['then'](function(_0x5e03cb){if(_0x5e03cb&&_0x175872['body'][_0xbb10('0x41')]){return db[_0xbb10('0x40')][_0xbb10('0x37')](_0x175872['body']['Smtp'],{'where':{'MailAccountId':_0x5e03cb['id']}})['then'](function(){return _0x5e03cb;});}return _0x5e03cb;})[_0xbb10('0x23')](respondWithResult(_0x12ec18,null))[_0xbb10('0x2d')](handleError(_0x12ec18,null));};exports[_0xbb10('0x63')]=function(_0x4e9fbd,_0xa1bbd9){return db[_0xbb10('0x44')]['describe']()['then'](respondWithResult(_0xa1bbd9,null))[_0xbb10('0x2d')](handleError(_0xa1bbd9,null));};exports[_0xbb10('0x64')]=function(_0xd77753,_0x237246,_0x54b7c5){if(_0xd77753[_0xbb10('0x62')]['id']){delete _0xd77753[_0xbb10('0x62')]['id'];}return db[_0xbb10('0x44')]['find']({'where':{'id':_0xd77753[_0xbb10('0x5e')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x237246,null))[_0xbb10('0x23')](function(_0x5b2bd4){if(_0x5b2bd4){_0xd77753[_0xbb10('0x62')][_0xbb10('0x65')]=_0x5b2bd4['id'];return db[_0xbb10('0x66')][_0xbb10('0x67')](_0xd77753['body']);}})[_0xbb10('0x23')](respondWithResult(_0x237246,null))[_0xbb10('0x2d')](handleError(_0x237246,null));};exports[_0xbb10('0x68')]=function(_0x2d0f4b,_0x56b3a3,_0x354ea7){var _0x277fe7={'raw':![],'where':{}};var _0x2a166e={};var _0x2ceb3e={'count':0x0,'rows':[]};return db[_0xbb10('0x44')][_0xbb10('0x69')]({'where':{'id':_0x2d0f4b[_0xbb10('0x5e')]['id']}})['then'](handleEntityNotFound(_0x56b3a3,null))['then'](function(_0x5acd5e){if(_0x5acd5e){_0x2a166e[_0xbb10('0x47')]=_[_0xbb10('0x49')](db[_0xbb10('0x66')]['rawAttributes']);_0x2a166e['query']=_[_0xbb10('0x49')](_0x2d0f4b[_0xbb10('0x48')]);_0x2a166e[_0xbb10('0x4a')]=_[_0xbb10('0x4b')](_0x2a166e[_0xbb10('0x47')],_0x2a166e[_0xbb10('0x48')]);_0x277fe7['attributes']=_[_0xbb10('0x4b')](_0x2a166e[_0xbb10('0x47')],qs[_0xbb10('0x4c')](_0x2d0f4b[_0xbb10('0x48')][_0xbb10('0x4c')]));_0x277fe7['attributes']=_0x277fe7['attributes']['length']?_0x277fe7[_0xbb10('0x4d')]:_0x2a166e[_0xbb10('0x47')];if(!_0x2d0f4b[_0xbb10('0x48')][_0xbb10('0x4e')](_0xbb10('0x4f'))){_0x277fe7[_0xbb10('0x32')]=qs['limit'](_0x2d0f4b[_0xbb10('0x48')]['limit']);_0x277fe7['offset']=qs['offset'](_0x2d0f4b[_0xbb10('0x48')][_0xbb10('0x31')]);}_0x277fe7[_0xbb10('0x50')]=qs[_0xbb10('0x51')](_0x2d0f4b['query'][_0xbb10('0x51')]);_0x277fe7['where']=qs['filters'](_[_0xbb10('0x53')](_0x2d0f4b[_0xbb10('0x48')],_0x2a166e[_0xbb10('0x4a')]));_0x277fe7[_0xbb10('0x52')][_0xbb10('0x65')]=_0x5acd5e['id'];if(_0x2d0f4b['query'][_0xbb10('0x54')]){_0x277fe7[_0xbb10('0x52')]=_[_0xbb10('0x57')](_0x277fe7[_0xbb10('0x52')],{'$or':_[_0xbb10('0x43')](_0x277fe7[_0xbb10('0x4d')],function(_0x174395){var _0x53fa98={};_0x53fa98[_0x174395]={'$like':'%'+_0x2d0f4b[_0xbb10('0x48')][_0xbb10('0x54')]+'%'};return _0x53fa98;})});}_0x277fe7=_[_0xbb10('0x57')]({},_0x277fe7,_0x2d0f4b[_0xbb10('0x58')]);return db[_0xbb10('0x66')][_0xbb10('0x59')]({'where':_0x277fe7[_0xbb10('0x52')]})[_0xbb10('0x23')](function(_0x5a4429){_0x2ceb3e[_0xbb10('0x59')]=_0x5a4429;if(_0x2d0f4b[_0xbb10('0x48')][_0xbb10('0x5a')]){_0x277fe7['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x277fe7);})[_0xbb10('0x23')](function(_0x5a3c44){_0x2ceb3e['rows']=_0x5a3c44;return _0x2ceb3e;});}})[_0xbb10('0x23')](respondWithFilteredResult(_0x56b3a3,_0x277fe7))[_0xbb10('0x2d')](handleError(_0x56b3a3,null));};exports[_0xbb10('0x6a')]=function(_0x12ed63,_0x32ec27,_0x24dca6){return db[_0xbb10('0x44')][_0xbb10('0x61')]({'where':{'id':_0x12ed63[_0xbb10('0x5e')]['id']}})['then'](handleEntityNotFound(_0x32ec27,null))[_0xbb10('0x23')](function(_0x1351eb){if(_0x1351eb){return _0x1351eb[_0xbb10('0x6a')](_0x12ed63[_0xbb10('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x32ec27,null))[_0xbb10('0x2d')](handleError(_0x32ec27,null));};exports[_0xbb10('0x6b')]=function(_0x30f0a4,_0x32bb25,_0x5ee705){if(_0x30f0a4[_0xbb10('0x62')]['id']){delete _0x30f0a4[_0xbb10('0x62')]['id'];}return db[_0xbb10('0x44')][_0xbb10('0x61')]({'where':{'id':_0x30f0a4[_0xbb10('0x5e')]['id']}})['then'](handleEntityNotFound(_0x32bb25,null))['then'](function(_0x372636){if(_0x372636){_0x30f0a4[_0xbb10('0x62')][_0xbb10('0x65')]=_0x372636['id'];return db['CannedAnswer'][_0xbb10('0x67')](_0x30f0a4[_0xbb10('0x62')]);}})['then'](respondWithResult(_0x32bb25,null))['catch'](handleError(_0x32bb25,null));};exports[_0xbb10('0x6c')]=function(_0x26d0dd,_0x177f77,_0x4d64ff){var _0x32d5a5={'raw':![],'where':{}};var _0x3a17fc={};var _0xfbb365={'count':0x0,'rows':[]};return db[_0xbb10('0x44')][_0xbb10('0x69')]({'where':{'id':_0x26d0dd[_0xbb10('0x5e')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x177f77,null))[_0xbb10('0x23')](function(_0x3e6246){if(_0x3e6246){_0x3a17fc['model']=_[_0xbb10('0x49')](db[_0xbb10('0x6d')][_0xbb10('0x6e')]);_0x3a17fc[_0xbb10('0x48')]=_[_0xbb10('0x49')](_0x26d0dd[_0xbb10('0x48')]);_0x3a17fc[_0xbb10('0x4a')]=_[_0xbb10('0x4b')](_0x3a17fc[_0xbb10('0x47')],_0x3a17fc[_0xbb10('0x48')]);_0x32d5a5[_0xbb10('0x4d')]=_[_0xbb10('0x4b')](_0x3a17fc['model'],qs['fields'](_0x26d0dd[_0xbb10('0x48')][_0xbb10('0x4c')]));_0x32d5a5[_0xbb10('0x4d')]=_0x32d5a5[_0xbb10('0x4d')][_0xbb10('0x6f')]?_0x32d5a5['attributes']:_0x3a17fc[_0xbb10('0x47')];if(!_0x26d0dd[_0xbb10('0x48')][_0xbb10('0x4e')](_0xbb10('0x4f'))){_0x32d5a5[_0xbb10('0x32')]=qs[_0xbb10('0x32')](_0x26d0dd['query'][_0xbb10('0x32')]);_0x32d5a5[_0xbb10('0x31')]=qs['offset'](_0x26d0dd[_0xbb10('0x48')]['offset']);}_0x32d5a5[_0xbb10('0x50')]=qs[_0xbb10('0x51')](_0x26d0dd[_0xbb10('0x48')][_0xbb10('0x51')]);_0x32d5a5[_0xbb10('0x52')]=qs['filters'](_[_0xbb10('0x53')](_0x26d0dd['query'],_0x3a17fc[_0xbb10('0x4a')]));_0x32d5a5[_0xbb10('0x52')]['MailAccountId']=_0x3e6246['id'];if(_0x26d0dd['query'][_0xbb10('0x54')]){_0x32d5a5[_0xbb10('0x52')]=_[_0xbb10('0x57')](_0x32d5a5[_0xbb10('0x52')],{'$or':_[_0xbb10('0x43')](_0x32d5a5[_0xbb10('0x4d')],function(_0x1b6ebc){var _0x25b4ef={};_0x25b4ef[_0x1b6ebc]={'$like':'%'+_0x26d0dd[_0xbb10('0x48')][_0xbb10('0x54')]+'%'};return _0x25b4ef;})});}_0x32d5a5=_[_0xbb10('0x57')]({},_0x32d5a5,_0x26d0dd['options']);return db[_0xbb10('0x6d')][_0xbb10('0x59')]({'where':_0x32d5a5[_0xbb10('0x52')]})[_0xbb10('0x23')](function(_0xfe02f5){_0xfbb365[_0xbb10('0x59')]=_0xfe02f5;if(_0x26d0dd[_0xbb10('0x48')][_0xbb10('0x5a')]){_0x32d5a5[_0xbb10('0x5b')]=[{'all':!![]}];}return db[_0xbb10('0x6d')][_0xbb10('0x5c')](_0x32d5a5);})[_0xbb10('0x23')](function(_0x499b9d){_0xfbb365[_0xbb10('0x70')]=_0x499b9d;return _0xfbb365;});}})['then'](respondWithFilteredResult(_0x177f77,_0x32d5a5))[_0xbb10('0x2d')](handleError(_0x177f77,null));};exports[_0xbb10('0x71')]=function(_0x3b2b54,_0x40236c,_0x38d369){return db['MailAccount'][_0xbb10('0x61')]({'where':{'id':_0x3b2b54[_0xbb10('0x5e')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x40236c,null))[_0xbb10('0x23')](function(_0x315b55){if(_0x315b55){return _0x315b55[_0xbb10('0x71')](_0x3b2b54['query']['ids']);}})[_0xbb10('0x23')](respondWithStatusCode(_0x40236c,null))[_0xbb10('0x2d')](handleError(_0x40236c,null));};exports[_0xbb10('0x67')]=function(_0x57d5a1,_0x124b32){var _0x3d6a91={'name':_0x57d5a1['body'][_0xbb10('0x3d')],'key':_0x57d5a1[_0xbb10('0x62')]['key'],'email':_0x57d5a1[_0xbb10('0x62')]['email'],'ListId':_0x57d5a1[_0xbb10('0x62')][_0xbb10('0x72')],'active':!_['isNil'](_0x57d5a1[_0xbb10('0x62')][_0xbb10('0x73')])?_0x57d5a1['body']['active']:!![],'description':_0x57d5a1[_0xbb10('0x62')][_0xbb10('0x74')]||null,'Imap':{},'Smtp':{}};if(_[_0xbb10('0x75')](_0x57d5a1[_0xbb10('0x62')][_0xbb10('0x76')])){if(_0x57d5a1['body'][_0xbb10('0x77')]){_0x3d6a91[_0xbb10('0x3f')][_0xbb10('0x78')]=_0x3d6a91['Smtp'][_0xbb10('0x78')]=_0x57d5a1[_0xbb10('0x62')][_0xbb10('0x79')];_0x3d6a91[_0xbb10('0x3f')][_0xbb10('0x7a')]=_0x3d6a91[_0xbb10('0x41')][_0xbb10('0x7b')]=_0x57d5a1[_0xbb10('0x62')][_0xbb10('0x7c')];}else{_0x3d6a91['Imap']['authentication']=_0x3d6a91[_0xbb10('0x41')][_0xbb10('0x7d')]=![];}_0x3d6a91[_0xbb10('0x3f')][_0xbb10('0x7e')]=_0x57d5a1[_0xbb10('0x62')][_0xbb10('0x3f')][_0xbb10('0x7e')];_0x3d6a91[_0xbb10('0x3f')][_0xbb10('0x7f')]=_0x57d5a1[_0xbb10('0x62')][_0xbb10('0x3f')][_0xbb10('0x7f')];_0x3d6a91[_0xbb10('0x41')]['host']=_0x57d5a1[_0xbb10('0x62')][_0xbb10('0x41')][_0xbb10('0x7e')];_0x3d6a91[_0xbb10('0x41')][_0xbb10('0x7f')]=_0x57d5a1[_0xbb10('0x62')][_0xbb10('0x41')][_0xbb10('0x7f')];}else{_0x3d6a91[_0xbb10('0x3f')][_0xbb10('0x80')]=_0x3d6a91[_0xbb10('0x41')]['service']=_0x57d5a1[_0xbb10('0x62')]['cservice'];_0x3d6a91[_0xbb10('0x3f')][_0xbb10('0x78')]=_0x3d6a91[_0xbb10('0x41')][_0xbb10('0x78')]=_0x57d5a1[_0xbb10('0x62')][_0xbb10('0x79')];_0x3d6a91['Imap'][_0xbb10('0x7a')]=_0x3d6a91['Smtp'][_0xbb10('0x7b')]=_0x57d5a1[_0xbb10('0x62')][_0xbb10('0x7c')];}return db[_0xbb10('0x44')][_0xbb10('0x67')](_0x3d6a91,{'include':[{'model':db[_0xbb10('0x40')],'as':_0xbb10('0x41')},{'model':db[_0xbb10('0x5f')],'as':_0xbb10('0x3f')}]})[_0xbb10('0x23')](function(_0x13efa1){var _0xa09041=_0x57d5a1['user'][_0xbb10('0x39')]({'plain':!![]});if(!_0xa09041)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa09041[_0xbb10('0x81')]===_0xbb10('0x78')){var _0x418f63=_0x13efa1[_0xbb10('0x39')]({'plain':!![]});return db[_0xbb10('0x82')][_0xbb10('0x61')]({'where':{'name':_0xbb10('0x3a'),'userProfileId':_0xa09041['userProfileId']},'raw':!![]})[_0xbb10('0x23')](function(_0x5ca9a0){if(_0x5ca9a0&&_0x5ca9a0['autoAssociation']===0x0){return db[_0xbb10('0x3b')][_0xbb10('0x67')]({'name':_0x418f63[_0xbb10('0x3d')],'resourceId':_0x418f63['id'],'type':_0x5ca9a0[_0xbb10('0x3d')],'sectionId':_0x5ca9a0['id']},{})[_0xbb10('0x23')](function(){return _0x13efa1;});}else{return _0x13efa1;}})[_0xbb10('0x2d')](function(_0x5d1077){logger[_0xbb10('0x29')](_0xbb10('0x83'),_0x5d1077);throw _0x5d1077;});}return _0x13efa1;})[_0xbb10('0x23')](respondWithResult(_0x124b32,0xc9))[_0xbb10('0x2d')](handleError(_0x124b32,null));};exports[_0xbb10('0x84')]=function(_0x28127c,_0x528aff,_0xdfdc42){return db[_0xbb10('0x44')][_0xbb10('0x69')]({'where':{'id':_0x28127c[_0xbb10('0x5e')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x528aff,null))[_0xbb10('0x23')](function(_0x2764e1){if(_0x2764e1){return _0x2764e1['getImap']();}return null;})[_0xbb10('0x23')](respondWithResult(_0x528aff,null))['catch'](handleError(_0x528aff,null));};exports[_0xbb10('0x85')]=function(_0x4a6660,_0x4c8b68,_0x32183f){if(_0x4a6660[_0xbb10('0x62')]['id']){delete _0x4a6660[_0xbb10('0x62')]['id'];}return db[_0xbb10('0x44')][_0xbb10('0x61')]({'where':{'id':_0x4a6660['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x4c8b68,null))['then'](function(_0x4b877c){if(_0x4b877c){_0x4a6660['body'][_0xbb10('0x65')]=_0x4b877c['id'];return db[_0xbb10('0x5f')][_0xbb10('0x67')](_0x4a6660[_0xbb10('0x62')]);}})[_0xbb10('0x23')](respondWithResult(_0x4c8b68,null))['catch'](handleError(_0x4c8b68,null));};exports[_0xbb10('0x86')]=function(_0x42a2d7,_0x352de4,_0x1bd1c1){return db[_0xbb10('0x44')][_0xbb10('0x69')]({'where':{'id':_0x42a2d7[_0xbb10('0x5e')]['id']}})['then'](handleEntityNotFound(_0x352de4,null))['then'](function(_0x584a62){if(_0x584a62){return _0x584a62[_0xbb10('0x87')](null);}return null;})[_0xbb10('0x23')](respondWithStatusCode(_0x352de4,null))[_0xbb10('0x2d')](handleError(_0x352de4,null));};exports[_0xbb10('0x88')]=function(_0x25cba1,_0x2261aa,_0x15b866){return db[_0xbb10('0x44')][_0xbb10('0x69')]({'where':{'id':_0x25cba1[_0xbb10('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2261aa,null))['then'](function(_0x4dce53){if(_0x4dce53){return _0x4dce53[_0xbb10('0x88')]();}return null;})[_0xbb10('0x23')](respondWithResult(_0x2261aa,null))[_0xbb10('0x2d')](handleError(_0x2261aa,null));};exports['addSmtp']=function(_0x2bfa8e,_0x2f6be3,_0x2c638d){if(_0x2bfa8e[_0xbb10('0x62')]['id']){delete _0x2bfa8e[_0xbb10('0x62')]['id'];}return db[_0xbb10('0x44')]['find']({'where':{'id':_0x2bfa8e['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x2f6be3,null))['then'](function(_0x370215){if(_0x370215){_0x2bfa8e[_0xbb10('0x62')][_0xbb10('0x65')]=_0x370215['id'];return db[_0xbb10('0x40')][_0xbb10('0x67')](_0x2bfa8e[_0xbb10('0x62')]);}})[_0xbb10('0x23')](respondWithResult(_0x2f6be3,null))[_0xbb10('0x2d')](handleError(_0x2f6be3,null));};exports[_0xbb10('0x89')]=function(_0x30fa80,_0x56871b,_0x343c5f){return db['MailAccount'][_0xbb10('0x69')]({'where':{'id':_0x30fa80['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x56871b,null))[_0xbb10('0x23')](function(_0x2adbbc){if(_0x2adbbc){return _0x2adbbc[_0xbb10('0x8a')](null);}return null;})['then'](respondWithStatusCode(_0x56871b,null))[_0xbb10('0x2d')](handleError(_0x56871b,null));};exports['addInteraction']=function(_0xfe1154,_0x1b6b9f,_0xcdaf04){return db['MailInteraction'][_0xbb10('0x61')]({'where':{'id':_0xfe1154[_0xbb10('0x5e')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x1b6b9f,null))[_0xbb10('0x23')](function(_0x11d31b){if(_0x11d31b){return _0x11d31b[_0xbb10('0x8b')](_0xfe1154['body']['ids'],_['omit'](_0xfe1154[_0xbb10('0x62')],['ids','id'])||{});}})[_0xbb10('0x23')](respondWithResult(_0x1b6b9f,null))['catch'](handleError(_0x1b6b9f,null));};exports[_0xbb10('0x8c')]=function(_0x34ce1b,_0x385ad3,_0x5d5288){var _0x4b5364={'raw':![],'where':{}};var _0x451b4d={};var _0x9e5cf2={'count':0x0,'rows':[]};return db[_0xbb10('0x44')]['findOne']({'where':{'id':_0x34ce1b[_0xbb10('0x5e')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x385ad3,null))[_0xbb10('0x23')](function(_0x4848b9){if(_0x4848b9){_0x451b4d['model']=_['keys'](db[_0xbb10('0x8d')]['rawAttributes']);_0x451b4d[_0xbb10('0x48')]=_[_0xbb10('0x49')](_0x34ce1b[_0xbb10('0x48')]);_0x451b4d[_0xbb10('0x4a')]=_[_0xbb10('0x4b')](_0x451b4d[_0xbb10('0x47')],_0x451b4d[_0xbb10('0x48')]);_0x4b5364[_0xbb10('0x4d')]=_[_0xbb10('0x4b')](_0x451b4d[_0xbb10('0x47')],qs[_0xbb10('0x4c')](_0x34ce1b['query'][_0xbb10('0x4c')]));_0x4b5364[_0xbb10('0x4d')]=_0x4b5364['attributes'][_0xbb10('0x6f')]?_0x4b5364['attributes']:_0x451b4d['model'];if(!_0x34ce1b[_0xbb10('0x48')][_0xbb10('0x4e')](_0xbb10('0x4f'))){_0x4b5364[_0xbb10('0x32')]=qs[_0xbb10('0x32')](_0x34ce1b['query'][_0xbb10('0x32')]);_0x4b5364[_0xbb10('0x31')]=qs['offset'](_0x34ce1b[_0xbb10('0x48')][_0xbb10('0x31')]);}_0x4b5364['order']=qs[_0xbb10('0x51')](_0x34ce1b['query'][_0xbb10('0x51')]);_0x4b5364[_0xbb10('0x52')]=qs[_0xbb10('0x4a')](_[_0xbb10('0x53')](_0x34ce1b[_0xbb10('0x48')],_0x451b4d[_0xbb10('0x4a')]));_0x4b5364[_0xbb10('0x52')]['MailAccountId']=_0x4848b9['id'];if(_0x34ce1b[_0xbb10('0x48')][_0xbb10('0x54')]){_0x4b5364[_0xbb10('0x52')]=_[_0xbb10('0x57')](_0x4b5364[_0xbb10('0x52')],{'$or':_[_0xbb10('0x43')](_0x4b5364['attributes'],function(_0x550301){var _0x5a40e8={};_0x5a40e8[_0x550301]={'$like':'%'+_0x34ce1b[_0xbb10('0x48')][_0xbb10('0x54')]+'%'};return _0x5a40e8;})});}_0x4b5364=_[_0xbb10('0x57')]({},_0x4b5364,_0x34ce1b[_0xbb10('0x58')]);return db['MailInteraction'][_0xbb10('0x59')]({'where':_0x4b5364[_0xbb10('0x52')]})[_0xbb10('0x23')](function(_0x577d27){_0x9e5cf2['count']=_0x577d27;if(_0x34ce1b[_0xbb10('0x48')]['includeAll']){_0x4b5364[_0xbb10('0x5b')]=[{'model':db[_0xbb10('0x8e')],'as':_0xbb10('0x8f'),'required':![]},{'model':db[_0xbb10('0x90')],'as':_0xbb10('0x91'),'attributes':[_0xbb10('0x3d'),_0xbb10('0x92'),'internal'],'required':![]},{'model':db[_0xbb10('0x93')],'as':_0xbb10('0x94'),'attributes':['id','name',_0xbb10('0x95')],'where':_0x34ce1b[_0xbb10('0x48')][_0xbb10('0x96')]?{'id':_0x34ce1b['query']['tag']}:undefined,'required':_0x34ce1b['query'][_0xbb10('0x96')]?!![]:![]}];}return db[_0xbb10('0x8d')]['findAll'](_0x4b5364);})[_0xbb10('0x23')](function(_0x163420){_0x9e5cf2[_0xbb10('0x70')]=_0x163420;return _0x9e5cf2;});}})[_0xbb10('0x23')](respondWithFilteredResult(_0x385ad3,_0x4b5364))[_0xbb10('0x2d')](handleError(_0x385ad3,null));};exports[_0xbb10('0x97')]=function(_0x34225f,_0x48f0eb,_0x304603){return db['MailAccount']['findOne']({'where':{'id':_0x34225f['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x48f0eb,null))[_0xbb10('0x23')](function(_0x5bd1f0){if(_0x5bd1f0){return db[_0xbb10('0x98')]['transaction'](function(_0x2b1bb5){return db[_0xbb10('0x99')][_0xbb10('0x38')]({'where':{'MailAccountId':_0x34225f['params']['id']},'transaction':_0x2b1bb5})['then'](function(_0x447c0d){var _0x502e73=_[_0xbb10('0x43')](_0x34225f[_0xbb10('0x62')],function(_0x589ecb){_0x589ecb['MailAccountId']=_0x34225f[_0xbb10('0x5e')]['id'];return _0x589ecb;});return db[_0xbb10('0x99')][_0xbb10('0x9a')](_0x502e73,{'transaction':_0x2b1bb5});});})['then'](function(){return db[_0xbb10('0x99')][_0xbb10('0x9b')]({'where':{'MailAccountId':_0x34225f[_0xbb10('0x5e')]['id']},'order':'priority'});});}})[_0xbb10('0x23')](respondWithResult(_0x48f0eb,null))[_0xbb10('0x2d')](handleError(_0x48f0eb,null));};exports[_0xbb10('0x9c')]=function(_0x4845b5,_0x112b35,_0x29bd42){var _0x166f4f={};var _0x1583cb={};var _0x148041;var _0x7c2e8f;return db[_0xbb10('0x44')][_0xbb10('0x69')]({'where':{'id':_0x4845b5[_0xbb10('0x5e')]['id']}})['then'](handleEntityNotFound(_0x112b35,null))['then'](function(_0x196be4){if(_0x196be4){_0x148041=_0x196be4;_0x1583cb['model']=_[_0xbb10('0x49')](db[_0xbb10('0x99')][_0xbb10('0x6e')]);_0x1583cb['query']=_[_0xbb10('0x49')](_0x4845b5[_0xbb10('0x48')]);_0x1583cb[_0xbb10('0x4a')]=_[_0xbb10('0x4b')](_0x1583cb[_0xbb10('0x47')],_0x1583cb['query']);_0x166f4f[_0xbb10('0x4d')]=_[_0xbb10('0x4b')](_0x1583cb[_0xbb10('0x47')],qs[_0xbb10('0x4c')](_0x4845b5[_0xbb10('0x48')][_0xbb10('0x4c')]));_0x166f4f['attributes']=_0x166f4f[_0xbb10('0x4d')][_0xbb10('0x6f')]?_0x166f4f['attributes']:_0x1583cb[_0xbb10('0x47')];_0x166f4f[_0xbb10('0x50')]=qs[_0xbb10('0x51')](_0x4845b5[_0xbb10('0x48')][_0xbb10('0x51')]);_0x166f4f[_0xbb10('0x52')]=qs[_0xbb10('0x4a')](_[_0xbb10('0x53')](_0x4845b5[_0xbb10('0x48')],_0x1583cb[_0xbb10('0x4a')]));if(_0x4845b5[_0xbb10('0x48')][_0xbb10('0x54')]){_0x166f4f[_0xbb10('0x52')]=_[_0xbb10('0x57')](_0x166f4f[_0xbb10('0x52')],{'$or':_['map'](_0x166f4f[_0xbb10('0x4d')],function(_0x6b5fb3){var _0x5507f6={};_0x5507f6[_0x6b5fb3]={'$like':'%'+_0x4845b5['query'][_0xbb10('0x54')]+'%'};return _0x5507f6;})});}_0x166f4f=_[_0xbb10('0x57')]({},_0x166f4f,_0x4845b5[_0xbb10('0x58')]);return _0x148041[_0xbb10('0x9c')](_0x166f4f);}})[_0xbb10('0x23')](function(_0x355987){if(_0x355987){_0x7c2e8f=_0x355987[_0xbb10('0x6f')];if(!_0x4845b5[_0xbb10('0x48')][_0xbb10('0x4e')]('nolimit')){_0x166f4f['limit']=qs['limit'](_0x4845b5['query']['limit']);_0x166f4f['offset']=qs[_0xbb10('0x31')](_0x4845b5[_0xbb10('0x48')][_0xbb10('0x31')]);}return _0x148041[_0xbb10('0x9c')](_0x166f4f);}})['then'](function(_0x367fcf){if(_0x367fcf){return _0x367fcf?{'count':_0x7c2e8f,'rows':_0x367fcf}:null;}})[_0xbb10('0x23')](respondWithResult(_0x112b35,null))[_0xbb10('0x2d')](handleError(_0x112b35,null));};exports[_0xbb10('0x9d')]=function(_0x514241,_0x55874f,_0x3057b4){var _0x9a163b={'raw':!![],'where':{}};var _0x536613={};var _0x581832={'count':0x0,'rows':[]};return db[_0xbb10('0x44')][_0xbb10('0x69')]({'where':{'id':_0x514241[_0xbb10('0x5e')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x55874f,null))[_0xbb10('0x23')](function(_0x564dc6){if(_0x564dc6){_0x536613[_0xbb10('0x47')]=_['keys'](db['MailMessage'][_0xbb10('0x6e')]);_0x536613[_0xbb10('0x48')]=_[_0xbb10('0x49')](_0x514241[_0xbb10('0x48')]);_0x536613[_0xbb10('0x4a')]=_[_0xbb10('0x4b')](_0x536613['model'],_0x536613[_0xbb10('0x48')]);_0x9a163b[_0xbb10('0x4d')]=_[_0xbb10('0x4b')](_0x536613[_0xbb10('0x47')],qs[_0xbb10('0x4c')](_0x514241[_0xbb10('0x48')][_0xbb10('0x4c')]));_0x9a163b[_0xbb10('0x4d')]=_0x9a163b[_0xbb10('0x4d')][_0xbb10('0x6f')]?_0x9a163b[_0xbb10('0x4d')]:_0x536613[_0xbb10('0x47')];if(!_0x514241[_0xbb10('0x48')][_0xbb10('0x4e')](_0xbb10('0x4f'))){_0x9a163b[_0xbb10('0x32')]=qs[_0xbb10('0x32')](_0x514241[_0xbb10('0x48')][_0xbb10('0x32')]);_0x9a163b[_0xbb10('0x31')]=qs[_0xbb10('0x31')](_0x514241[_0xbb10('0x48')]['offset']);}_0x9a163b[_0xbb10('0x50')]=qs['sort'](_0x514241[_0xbb10('0x48')][_0xbb10('0x51')]);_0x9a163b[_0xbb10('0x52')]=qs[_0xbb10('0x4a')](_[_0xbb10('0x53')](_0x514241['query'],_0x536613['filters']));_0x9a163b['where'][_0xbb10('0x65')]=_0x564dc6['id'];if(_0x514241[_0xbb10('0x48')]['filter']){_0x9a163b[_0xbb10('0x52')]=_[_0xbb10('0x57')](_0x9a163b[_0xbb10('0x52')],{'$or':_['map'](_0x9a163b[_0xbb10('0x4d')],function(_0x6463ed){var _0x289788={};_0x289788[_0x6463ed]={'$like':'%'+_0x514241['query'][_0xbb10('0x54')]+'%'};return _0x289788;})});}if(_0x514241['query'][_0xbb10('0x9e')]){var _0x50fe23=_0x514241['query']['$gte']['split'](',');var _0x588581={};_0x588581[_0x50fe23[0x0]]={'$gte':moment(_0x50fe23[0x1])['format'](_0xbb10('0x9f'))};_0x9a163b[_0xbb10('0x52')]=_[_0xbb10('0x57')](_0x9a163b[_0xbb10('0x52')],_0x588581);}_0x9a163b=_['merge']({},_0x9a163b,_0x514241[_0xbb10('0x58')]);return db[_0xbb10('0xa0')][_0xbb10('0x59')]({'where':_0x9a163b[_0xbb10('0x52')]})[_0xbb10('0x23')](function(_0x17bff6){_0x581832[_0xbb10('0x59')]=_0x17bff6;if(_0x514241[_0xbb10('0x48')][_0xbb10('0x5a')]){_0x9a163b[_0xbb10('0x5b')]=[{'all':!![]}];}return db['MailMessage'][_0xbb10('0x5c')](_0x9a163b);})[_0xbb10('0x23')](function(_0x288ccc){if(_0x514241['query'][_0xbb10('0xa1')]===_0xbb10('0xa2')){for(var _0x1442c5=0x0;_0x1442c5<_0x288ccc[_0xbb10('0x6f')];_0x1442c5++){_0x288ccc[_0x1442c5]['body']=juice(_0x288ccc[_0x1442c5][_0xbb10('0x62')]);}}_0x581832[_0xbb10('0x70')]=_0x288ccc;return _0x581832;});}})[_0xbb10('0x23')](respondWithFilteredResult(_0x55874f,_0x9a163b))[_0xbb10('0x2d')](handleError(_0x55874f,null));};exports[_0xbb10('0x3e')]=function(_0x3ff3fe,_0x38eb3d,_0x1c0529){var _0x3522cd,_0x3c24f3={},_0x3c01ff;if(_0x3ff3fe['body']['to']){_0x3c01ff=_0x3ff3fe[_0xbb10('0x62')]['to'][_0xbb10('0xa3')](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x3ff3fe[_0xbb10('0x5e')]['id']},'include':[{'model':db[_0xbb10('0xa4')],'as':'List','include':[{'model':db[_0xbb10('0x8e')],'as':_0xbb10('0xa5'),'where':{'email':_0x3c01ff},'limit':0x1,'order':[['updatedAt',_0xbb10('0xa6')]]}]},{'model':db[_0xbb10('0x40')],'as':_0xbb10('0x41'),'raw':!![]}]})[_0xbb10('0x23')](handleEntityNotFound(_0x38eb3d,null))[_0xbb10('0x23')](function(_0x4d2c76){if(_0x4d2c76){_0x3522cd=_0x4d2c76;if(_0x4d2c76['Smtp']){if(_['isNil'](_0x3ff3fe[_0xbb10('0x62')]['from'])){_0x3ff3fe[_0xbb10('0x62')]['from']=util['format'](_0xbb10('0xa7'),_0x4d2c76[_0xbb10('0x3d')],_0x4d2c76[_0xbb10('0xa8')]||_0x4d2c76[_0xbb10('0x41')][_0xbb10('0x78')]);}if(_0x3ff3fe[_0xbb10('0x62')]['attachments']&&_0x3ff3fe['body']['attachments'][_0xbb10('0x6f')]){for(var _0xf29f61=0x0;_0xf29f61<_0x3ff3fe[_0xbb10('0x62')][_0xbb10('0xa9')][_0xbb10('0x6f')];_0xf29f61+=0x1){_0x3ff3fe[_0xbb10('0x62')][_0xbb10('0xa9')][_0xf29f61]={'filename':_0x3ff3fe['body'][_0xbb10('0xa9')][_0xf29f61][_0xbb10('0x3d')],'path':path[_0xbb10('0xaa')](config[_0xbb10('0xab')],'server/files/attachments',_0x3ff3fe[_0xbb10('0x62')]['attachments'][_0xf29f61]['basename'])};}}var _0x25b5a7={'tls':{'rejectUnauthorized':![]}};if(_[_0xbb10('0x75')](_0x4d2c76[_0xbb10('0x41')][_0xbb10('0x80')])){if(_0x4d2c76[_0xbb10('0x41')][_0xbb10('0x7d')]){_0x25b5a7['auth']={'user':_0x4d2c76[_0xbb10('0x41')][_0xbb10('0x78')],'pass':_0x4d2c76[_0xbb10('0x41')][_0xbb10('0x7b')]};}_0x25b5a7[_0xbb10('0x7e')]=_0x4d2c76[_0xbb10('0x41')][_0xbb10('0x7e')];_0x25b5a7['port']=_0x4d2c76[_0xbb10('0x41')][_0xbb10('0x7f')];_0x25b5a7[_0xbb10('0xac')]=_0x4d2c76['Smtp']['secure'];}else{_0x25b5a7[_0xbb10('0x80')]=_0x4d2c76[_0xbb10('0x41')][_0xbb10('0x80')];_0x25b5a7[_0xbb10('0xad')]={'user':_0x4d2c76[_0xbb10('0x41')][_0xbb10('0x78')],'pass':_0x4d2c76[_0xbb10('0x41')]['pass']};}return respondWithRpcPromise(_0xbb10('0xae'),_0xbb10('0xaf'),{'account':_0x25b5a7,'message':_0x3ff3fe[_0xbb10('0x62')]});}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x55efcf){if(_0x55efcf){_0x3c24f3=_0x55efcf;if(_0x3522cd['List']){if(_0x3522cd[_0xbb10('0xb0')][_0xbb10('0xa5')][_0xbb10('0x6f')]){return _0x3522cd[_0xbb10('0xb0')]['Contacts'][0x0];}else{return db[_0xbb10('0x8e')]['create'](_[_0xbb10('0x1b')](_0x3ff3fe[_0xbb10('0x62')],{'firstName':_0x3ff3fe[_0xbb10('0x62')]['to'],'email':_0x3ff3fe[_0xbb10('0x62')]['to'],'phone':_0x3ff3fe[_0xbb10('0x62')]['to'],'ListId':_0x3522cd[_0xbb10('0x72')]}));}}else{throw new Error(_0xbb10('0xb1'));}}})[_0xbb10('0x23')](function(_0x243dc2){if(_0x243dc2){var _0x71d5a4={'UserId':_0x3ff3fe[_0xbb10('0x78')]['id'],'ContactId':_0x243dc2['id'],'MailAccountId':_0x3522cd['id'],'inReplyTo':_0x3c24f3[_0xbb10('0xb2')],'to':_0x3ff3fe['body'][_0xbb10('0xb3')],'cc':_0x3ff3fe[_0xbb10('0x62')]['cc'],'subject':_0x3ff3fe[_0xbb10('0x62')]['subject'],'attach':_0x3ff3fe[_0xbb10('0x62')]['attach'],'firstMsgDirection':_0xbb10('0xb4'),'lastMsgAt':moment()[_0xbb10('0xb5')](_0xbb10('0x9f')),'lastMsgDirection':_0xbb10('0xb4'),'Messages':[_[_0xbb10('0x57')](_0x3ff3fe['body'],{'messageId':_0x3c24f3['messageId'],'sentAt':moment()[_0xbb10('0xb5')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x3522cd['id'],'UserId':_0x3ff3fe['user']['id'],'ContactId':_0x243dc2['id']})]};if(_0x3ff3fe[_0xbb10('0x62')]['Interaction']){_0x71d5a4=_[_0xbb10('0x57')](_0x71d5a4,_0x3ff3fe[_0xbb10('0x62')][_0xbb10('0xb6')]);}return db[_0xbb10('0x8d')][_0xbb10('0x67')](_0x71d5a4,{'include':[{'model':db[_0xbb10('0xa0')],'as':_0xbb10('0xb7')}]});}})[_0xbb10('0x23')](respondWithResult(_0x38eb3d,null))['catch'](handleError(_0x38eb3d,null));};exports[_0xbb10('0xb8')]=function(_0x498702,_0x207715,_0x53bc82){return db[_0xbb10('0x44')][_0xbb10('0x61')]({'where':{'id':_0x498702['params']['id']},'include':[{'model':db[_0xbb10('0x40')],'as':_0xbb10('0x41'),'raw':!![]}]})[_0xbb10('0x23')](handleEntityNotFound(_0x207715,null))['then'](function(_0x17b086){if(_0x17b086&&_0x17b086[_0xbb10('0x41')]){var _0x327b64={'id':_0x17b086['id'],'tls':{'rejectUnauthorized':![]}};if(_0x17b086['Smtp'][_0xbb10('0x80')]){_0x327b64[_0xbb10('0x80')]=_0x17b086[_0xbb10('0x41')]['service'];}else{_0x327b64[_0xbb10('0x7e')]=_0x17b086['Smtp'][_0xbb10('0x7e')];_0x327b64[_0xbb10('0x7f')]=_0x17b086[_0xbb10('0x41')][_0xbb10('0x7f')];_0x327b64[_0xbb10('0xac')]=_0x17b086[_0xbb10('0x41')][_0xbb10('0xac')];}if(_0x17b086[_0xbb10('0x41')][_0xbb10('0x7d')]){_0x327b64[_0xbb10('0xad')]={'user':_0x17b086['Smtp']['user'],'pass':_0x17b086[_0xbb10('0x41')][_0xbb10('0x7b')]};}return respondWithRpcPromise(_0xbb10('0xb9'),'verifySmtp',{'account':_0x327b64});}})[_0xbb10('0x23')](respondWithResult(_0x207715,null))[_0xbb10('0x2d')](handleError(_0x207715,null));};exports[_0xbb10('0x38')]=function(_0x108ec7,_0x36d799){return db[_0xbb10('0x44')][_0xbb10('0x61')]({'where':{'id':_0x108ec7[_0xbb10('0x5e')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x36d799,null))['then'](function(_0xa7e6bd){if(_0xa7e6bd&&_0xa7e6bd[_0xbb10('0x80')]){throw new db[(_0xbb10('0xba'))][(_0xbb10('0xbb'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0xa7e6bd;})[_0xbb10('0x23')](removeEntity(_0x36d799,null))[_0xbb10('0x2d')](handleError(_0x36d799,null));};exports[_0xbb10('0xbc')]=function(_0x59fef2,_0x59f9b2,_0x3b45c4){return db['MailAccount'][_0xbb10('0x61')]({'where':{'id':_0x59fef2['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x59f9b2,null))[_0xbb10('0x23')](function(_0x28cd8e){if(_0x28cd8e){return _0x28cd8e[_0xbb10('0xbc')](_0x59fef2[_0xbb10('0x62')][_0xbb10('0xbd')],_[_0xbb10('0xbe')](_0x59fef2['body'],[_0xbb10('0xbd'),'id'])||{})[_0xbb10('0xbf')](function(_0x28271e){for(var _0x2807d2=0x0;_0x2807d2<_0x59fef2[_0xbb10('0x62')][_0xbb10('0xbd')]['length'];_0x2807d2+=0x1){socket[_0xbb10('0xc0')](_0xbb10('0xc1'),{'UserId':_0x59fef2[_0xbb10('0x62')][_0xbb10('0xbd')][_0x2807d2],'MailAccountId':_0x59fef2[_0xbb10('0x5e')]['id']});}return _0x28271e;});}})[_0xbb10('0x23')](respondWithResult(_0x59f9b2,null))[_0xbb10('0x2d')](handleError(_0x59f9b2,null));};exports['removeAgents']=function(_0x1322bb,_0x183e57,_0x1e8713){return db['MailAccount'][_0xbb10('0x61')]({'where':{'id':_0x1322bb['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x183e57,null))[_0xbb10('0x23')](function(_0x43a945){if(_0x43a945){return _0x43a945['removeAgents'](_0x1322bb['query'][_0xbb10('0xbd')])[_0xbb10('0x23')](function(){if(_[_0xbb10('0xc2')](_0x1322bb[_0xbb10('0x48')][_0xbb10('0xbd')])){for(var _0x34dddb=0x0;_0x34dddb<_0x1322bb[_0xbb10('0x48')][_0xbb10('0xbd')][_0xbb10('0x6f')];_0x34dddb+=0x1){socket[_0xbb10('0xc0')](_0xbb10('0xc3'),{'UserId':Number(_0x1322bb['query']['ids'][_0x34dddb]),'MailAccountId':Number(_0x1322bb[_0xbb10('0x5e')]['id'])});}}else{socket[_0xbb10('0xc0')]('userMailAccount:remove',{'UserId':Number(_0x1322bb['query'][_0xbb10('0xbd')]),'MailAccountId':Number(_0x1322bb[_0xbb10('0x5e')]['id'])});}});}})[_0xbb10('0x23')](respondWithStatusCode(_0x183e57,null))['catch'](handleError(_0x183e57,null));};exports[_0xbb10('0xc4')]=function(_0x35c8a7,_0x578793,_0x4375ac){var _0x97224a={};var _0x544c9c={};var _0x5a5349;var _0x3eb533;return db[_0xbb10('0x44')][_0xbb10('0x69')]({'where':{'id':_0x35c8a7['params']['id']}})['then'](handleEntityNotFound(_0x578793,null))[_0xbb10('0x23')](function(_0x140927){if(_0x140927){_0x5a5349=_0x140927;_0x544c9c['model']=_[_0xbb10('0x49')](db[_0xbb10('0x90')]['rawAttributes']);_0x544c9c[_0xbb10('0x48')]=_[_0xbb10('0x49')](_0x35c8a7[_0xbb10('0x48')]);_0x544c9c[_0xbb10('0x4a')]=_['intersection'](_0x544c9c[_0xbb10('0x47')],_0x544c9c['query']);_0x97224a[_0xbb10('0x4d')]=_[_0xbb10('0x4b')](_0x544c9c[_0xbb10('0x47')],qs[_0xbb10('0x4c')](_0x35c8a7[_0xbb10('0x48')][_0xbb10('0x4c')]));_0x97224a[_0xbb10('0x4d')]=_0x97224a[_0xbb10('0x4d')]['length']?_0x97224a[_0xbb10('0x4d')]:_0x544c9c[_0xbb10('0x47')];_0x97224a[_0xbb10('0x50')]=qs[_0xbb10('0x51')](_0x35c8a7['query']['sort']);_0x97224a[_0xbb10('0x52')]=qs[_0xbb10('0x4a')](_[_0xbb10('0x53')](_0x35c8a7[_0xbb10('0x48')],_0x544c9c['filters']));if(_0x35c8a7[_0xbb10('0x48')][_0xbb10('0x54')]){_0x97224a['where']=_[_0xbb10('0x57')](_0x97224a['where'],{'$or':_['map'](_0x97224a[_0xbb10('0x4d')],function(_0x18cede){var _0x41478b={};_0x41478b[_0x18cede]={'$like':'%'+_0x35c8a7[_0xbb10('0x48')][_0xbb10('0x54')]+'%'};return _0x41478b;})});}_0x97224a=_['merge']({},_0x97224a,_0x35c8a7[_0xbb10('0x58')]);return _0x5a5349[_0xbb10('0xc4')](_0x97224a);}})[_0xbb10('0x23')](function(_0x24acce){if(_0x24acce){_0x3eb533=_0x24acce[_0xbb10('0x6f')];if(!_0x35c8a7[_0xbb10('0x48')][_0xbb10('0x4e')](_0xbb10('0x4f'))){_0x97224a[_0xbb10('0x32')]=qs[_0xbb10('0x32')](_0x35c8a7[_0xbb10('0x48')][_0xbb10('0x32')]);_0x97224a[_0xbb10('0x31')]=qs[_0xbb10('0x31')](_0x35c8a7[_0xbb10('0x48')][_0xbb10('0x31')]);}return _0x5a5349[_0xbb10('0xc4')](_0x97224a);}})[_0xbb10('0x23')](function(_0x27e0c5){if(_0x27e0c5){return _0x27e0c5?{'count':_0x3eb533,'rows':_0x27e0c5}:null;}})[_0xbb10('0x23')](respondWithResult(_0x578793,null))[_0xbb10('0x2d')](handleError(_0x578793,null));}; \ No newline at end of file +var _0x7a54=['Smtp','pass','host','port','service','cpassword','get','UserProfileSection','getImap','addImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','MailApplication','destroy','bulkCreate','priority','getApplications','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','send','CmList','List','Contacts','DESC','from','format','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','sendMail','List\x20not\x20found','ListId','messageId','subject','attach','out','Interaction','Messages','verifySmtp','authentication','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','html-to-text','juice','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','http','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','Content-Range','reject','save','update','MailAccounts','UserProfileResource','then','sendStatus','stack','name','index','Imap','MailServerOut','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','includeAll','include','MailAccount','findAll','show','MailServerIn','options','body','find','params','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','length','hasOwnProperty','order','rows','removeDispositions','ids','CannedAnswer','create','getAnswers','removeAnswers','email','isNil','active','description','cservice','cauthentication','user','password'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x7a54,0x106));var _0x47a5=function(_0x17bd52,_0x1ef852){_0x17bd52=_0x17bd52-0x0;var _0x51f92c=_0x7a54[_0x17bd52];return _0x51f92c;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var htmlToText=require(_0x47a5('0xe'));var juice=require(_0x47a5('0xf'));var Redis=require('ioredis');var authService=require(_0x47a5('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x47a5('0x11'));var logger=require(_0x47a5('0x12'))(_0x47a5('0x13'));var utils=require(_0x47a5('0x14'));var config=require(_0x47a5('0x15'));var licenseUtil=require(_0x47a5('0x16'));var db=require(_0x47a5('0x17'))['db'];config['redis']=_[_0x47a5('0x18')](config[_0x47a5('0x19')],{'host':_0x47a5('0x1a'),'port':0x18eb});var socket=require(_0x47a5('0x1b'))(new Redis(config[_0x47a5('0x19')]));require(_0x47a5('0x1c'))[_0x47a5('0x1d')](socket);var jayson=require(_0x47a5('0x1e'));var client=jayson['client'][_0x47a5('0x1f')]({'port':0x232b});function respondWithRpcPromise(_0x11faf5,_0x3b001e,_0x2a2cbb,_0x1ef44c){return new BPromise(function(_0x574af6,_0x549de3){var _0x138bc0=_0x1ef44c||client;return _0x138bc0['request'](_0x11faf5,_0x2a2cbb)['then'](function(_0x423a81){logger[_0x47a5('0x20')](_0x47a5('0x21'),_0x3b001e,_0x47a5('0x22'));logger[_0x47a5('0x23')](_0x47a5('0x24'),_0x3b001e,_0x47a5('0x22'),JSON[_0x47a5('0x25')](_0x423a81));if(_0x423a81[_0x47a5('0x26')]){if(_0x423a81['error'][_0x47a5('0x27')]===0x1f4){logger[_0x47a5('0x26')]('MailAccount,\x20%s,\x20%s',_0x3b001e,_0x423a81[_0x47a5('0x26')][_0x47a5('0x28')]);return _0x549de3(_0x423a81[_0x47a5('0x26')]['message']);}logger[_0x47a5('0x26')](_0x47a5('0x21'),_0x3b001e,_0x423a81[_0x47a5('0x26')][_0x47a5('0x28')]);return _0x574af6(_0x423a81['error'][_0x47a5('0x28')]);}else{logger[_0x47a5('0x20')]('MailAccount,\x20%s,\x20%s',_0x3b001e,_0x47a5('0x22'));_0x574af6(_0x423a81[_0x47a5('0x29')][_0x47a5('0x28')]);}})[_0x47a5('0x2a')](function(_0x3abd6a){logger['error']('MailAccount,\x20%s,\x20%s',_0x3b001e,_0x3abd6a);_0x549de3(_0x3abd6a);});});}function respondWithStatusCode(_0x136745,_0x5686db){_0x5686db=_0x5686db||0xcc;return function(_0x1ea9c8){if(_0x1ea9c8){return _0x136745['sendStatus'](_0x5686db);}return _0x136745[_0x47a5('0x2b')](_0x5686db)[_0x47a5('0x2c')]();};}function respondWithResult(_0x36ad34,_0x1dac65){_0x1dac65=_0x1dac65||0xc8;return function(_0x21f296){if(_0x21f296){return _0x36ad34[_0x47a5('0x2b')](_0x1dac65)[_0x47a5('0x2d')](_0x21f296);}};}function respondWithFilteredResult(_0x136b14,_0x16631f){return function(_0x361bfa){if(_0x361bfa){var _0x1127f8=_0x361bfa[_0x47a5('0x2e')],_0x11a4fa=_0x16631f['offset'],_0x3ad507=_0x16631f[_0x47a5('0x2f')]+_0x16631f[_0x47a5('0x30')],_0x528582;if(_0x3ad507>=_0x1127f8){_0x3ad507=_0x1127f8;_0x528582=0xc8;}else{_0x528582=0xce;}_0x136b14[_0x47a5('0x2b')](_0x528582);return _0x136b14['set'](_0x47a5('0x31'),_0x11a4fa+'-'+_0x3ad507+'/'+_0x1127f8)[_0x47a5('0x2d')](_0x361bfa);}return null;};}function patchUpdates(_0x39b50b){return function(_0x1f1c68){try{jsonpatch['apply'](_0x1f1c68,_0x39b50b,!![]);}catch(_0x50d875){return BPromise[_0x47a5('0x32')](_0x50d875);}return _0x1f1c68[_0x47a5('0x33')]();};}function saveUpdates(_0x5bd7eb,_0x4e1006){return function(_0x836303){if(_0x836303){return _0x836303[_0x47a5('0x34')](_0x5bd7eb)['then'](function(_0x42f70c){return _0x42f70c;});}return null;};}function removeEntity(_0x53119b,_0x122ed6){return function(_0xd972c){if(_0xd972c){return _0xd972c['destroy']()['then'](function(){var _0x274e34=_0xd972c['get']({'plain':!![]});var _0x403028=_0x47a5('0x35');return db[_0x47a5('0x36')]['destroy']({'where':{'type':_0x403028,'resourceId':_0x274e34['id']}})[_0x47a5('0x37')](function(){return _0xd972c;});})['then'](function(){_0x53119b['status'](0xcc)[_0x47a5('0x2c')]();});}};}function handleEntityNotFound(_0x5a8a7c,_0x25cce0){return function(_0x5ef577){if(!_0x5ef577){_0x5a8a7c[_0x47a5('0x38')](0x194);}return _0x5ef577;};}function handleError(_0x3534cb,_0x38c8d4){_0x38c8d4=_0x38c8d4||0x1f4;return function(_0x199698){logger[_0x47a5('0x26')](_0x199698[_0x47a5('0x39')]);if(_0x199698[_0x47a5('0x3a')]){delete _0x199698[_0x47a5('0x3a')];}_0x3534cb[_0x47a5('0x2b')](_0x38c8d4)['send'](_0x199698);};}exports[_0x47a5('0x3b')]=function(_0x10f136,_0x511c06){var _0x2c50d6={'include':[{'model':db['MailServerIn'],'as':_0x47a5('0x3c')},{'model':db[_0x47a5('0x3d')],'as':'Smtp'},{'model':db[_0x47a5('0x3e')],'as':_0x47a5('0x3f')}]},_0x2bf53d={},_0x1d4348={'count':0x0,'rows':[]};var _0x54ae35=_['map'](db['MailAccount'][_0x47a5('0x40')],function(_0x5c569e){return{'name':_0x5c569e[_0x47a5('0x41')],'type':_0x5c569e[_0x47a5('0x42')][_0x47a5('0x43')]};});_0x2bf53d[_0x47a5('0x44')]=_[_0x47a5('0x45')](_0x54ae35,_0x47a5('0x3a'));_0x2bf53d[_0x47a5('0x46')]=_[_0x47a5('0x47')](_0x10f136[_0x47a5('0x46')]);_0x2bf53d[_0x47a5('0x48')]=_[_0x47a5('0x49')](_0x2bf53d[_0x47a5('0x44')],_0x2bf53d[_0x47a5('0x46')]);_0x2c50d6['attributes']=_[_0x47a5('0x49')](_0x2bf53d[_0x47a5('0x44')],qs[_0x47a5('0x4a')](_0x10f136[_0x47a5('0x46')]['fields']));_0x2c50d6[_0x47a5('0x4b')]=_0x2c50d6['attributes']['length']?_0x2c50d6['attributes']:_0x2bf53d['model'];if(!_0x10f136[_0x47a5('0x46')]['hasOwnProperty'](_0x47a5('0x4c'))){_0x2c50d6[_0x47a5('0x30')]=qs[_0x47a5('0x30')](_0x10f136['query'][_0x47a5('0x30')]);_0x2c50d6[_0x47a5('0x2f')]=qs['offset'](_0x10f136['query'][_0x47a5('0x2f')]);}_0x2c50d6['order']=qs[_0x47a5('0x4d')](_0x10f136[_0x47a5('0x46')][_0x47a5('0x4d')]);_0x2c50d6[_0x47a5('0x4e')]=qs[_0x47a5('0x48')](_[_0x47a5('0x4f')](_0x10f136[_0x47a5('0x46')],_0x2bf53d[_0x47a5('0x48')]),_0x54ae35);if(_0x10f136[_0x47a5('0x46')][_0x47a5('0x50')]){_0x2c50d6[_0x47a5('0x4e')]=_[_0x47a5('0x51')](_0x2c50d6[_0x47a5('0x4e')],{'$or':_[_0x47a5('0x45')](_0x54ae35,function(_0x4e5e7){if(_0x4e5e7[_0x47a5('0x42')]!=='VIRTUAL'){var _0x2d38de={};_0x2d38de[_0x4e5e7[_0x47a5('0x3a')]]={'$like':'%'+_0x10f136['query']['filter']+'%'};return _0x2d38de;}})});}_0x2c50d6=_[_0x47a5('0x51')]({},_0x2c50d6,_0x10f136['options']);var _0x13750d={'where':_0x2c50d6[_0x47a5('0x4e')]};return db['MailAccount']['count'](_0x13750d)[_0x47a5('0x37')](function(_0x52d409){_0x1d4348[_0x47a5('0x2e')]=_0x52d409;if(_0x10f136[_0x47a5('0x46')][_0x47a5('0x52')]){_0x2c50d6[_0x47a5('0x53')]=[{'all':!![]}];}return db[_0x47a5('0x54')][_0x47a5('0x55')](_0x2c50d6);})[_0x47a5('0x37')](function(_0x53e994){_0x1d4348['rows']=_0x53e994;return _0x1d4348;})[_0x47a5('0x37')](respondWithFilteredResult(_0x511c06,_0x2c50d6))[_0x47a5('0x2a')](handleError(_0x511c06,null));};exports[_0x47a5('0x56')]=function(_0x9ea93e,_0x2c7020){var _0x2c0c86={'raw':![],'where':{'id':_0x9ea93e['params']['id']},'include':[{'model':db[_0x47a5('0x57')],'as':_0x47a5('0x3c')},{'model':db[_0x47a5('0x3d')],'as':'Smtp'},{'model':db[_0x47a5('0x3e')],'as':'mandatoryDispositionPause'}]},_0x249de5={};_0x249de5[_0x47a5('0x44')]=_[_0x47a5('0x47')](db[_0x47a5('0x54')][_0x47a5('0x40')]);_0x249de5['query']=_[_0x47a5('0x47')](_0x9ea93e[_0x47a5('0x46')]);_0x249de5[_0x47a5('0x48')]=_[_0x47a5('0x49')](_0x249de5[_0x47a5('0x44')],_0x249de5[_0x47a5('0x46')]);_0x2c0c86[_0x47a5('0x4b')]=_['intersection'](_0x249de5[_0x47a5('0x44')],qs[_0x47a5('0x4a')](_0x9ea93e[_0x47a5('0x46')][_0x47a5('0x4a')]));_0x2c0c86[_0x47a5('0x4b')]=_0x2c0c86[_0x47a5('0x4b')]['length']?_0x2c0c86[_0x47a5('0x4b')]:_0x249de5[_0x47a5('0x44')];if(_0x9ea93e[_0x47a5('0x46')]['includeAll']){_0x2c0c86[_0x47a5('0x53')]=[{'all':!![]}];}_0x2c0c86=_[_0x47a5('0x51')]({},_0x2c0c86,_0x9ea93e[_0x47a5('0x58')]);return db['MailAccount']['find'](_0x2c0c86)[_0x47a5('0x37')](handleEntityNotFound(_0x2c7020,null))[_0x47a5('0x37')](respondWithResult(_0x2c7020,null))['catch'](handleError(_0x2c7020,null));};exports['update']=function(_0x6d6b2b,_0x4d6a82){if(_0x6d6b2b[_0x47a5('0x59')]['id']){delete _0x6d6b2b['body']['id'];}return db['MailAccount'][_0x47a5('0x5a')]({'where':{'id':_0x6d6b2b[_0x47a5('0x5b')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x47a5('0x3c')},{'model':db[_0x47a5('0x3d')],'as':'Smtp'},{'model':db['Pause'],'as':_0x47a5('0x3f')}]})[_0x47a5('0x37')](handleEntityNotFound(_0x4d6a82,null))[_0x47a5('0x37')](saveUpdates(_0x6d6b2b[_0x47a5('0x59')],null))['then'](function(_0x199621){if(_0x199621&&_0x6d6b2b[_0x47a5('0x59')][_0x47a5('0x3c')]){return db['MailServerIn'][_0x47a5('0x34')](_0x6d6b2b['body'][_0x47a5('0x3c')],{'where':{'MailAccountId':_0x199621['id']}})[_0x47a5('0x37')](function(){return _0x199621;});}return _0x199621;})[_0x47a5('0x37')](function(_0x1c485b){if(_0x1c485b&&_0x6d6b2b[_0x47a5('0x59')]['Smtp']){return db[_0x47a5('0x3d')]['update'](_0x6d6b2b['body']['Smtp'],{'where':{'MailAccountId':_0x1c485b['id']}})['then'](function(){return _0x1c485b;});}return _0x1c485b;})[_0x47a5('0x37')](respondWithResult(_0x4d6a82,null))[_0x47a5('0x2a')](handleError(_0x4d6a82,null));};exports[_0x47a5('0x5c')]=function(_0x52e3ee,_0x4d3db1){return db[_0x47a5('0x54')][_0x47a5('0x5c')]()[_0x47a5('0x37')](respondWithResult(_0x4d3db1,null))[_0x47a5('0x2a')](handleError(_0x4d3db1,null));};exports[_0x47a5('0x5d')]=function(_0x4b5d0c,_0x3474b7,_0x519e9e){if(_0x4b5d0c[_0x47a5('0x59')]['id']){delete _0x4b5d0c[_0x47a5('0x59')]['id'];}return db['MailAccount'][_0x47a5('0x5a')]({'where':{'id':_0x4b5d0c[_0x47a5('0x5b')]['id']}})[_0x47a5('0x37')](handleEntityNotFound(_0x3474b7,null))[_0x47a5('0x37')](function(_0x2d6494){if(_0x2d6494){_0x4b5d0c[_0x47a5('0x59')][_0x47a5('0x5e')]=_0x2d6494['id'];return db[_0x47a5('0x5f')]['create'](_0x4b5d0c[_0x47a5('0x59')]);}})[_0x47a5('0x37')](respondWithResult(_0x3474b7,null))[_0x47a5('0x2a')](handleError(_0x3474b7,null));};exports[_0x47a5('0x60')]=function(_0x396cb0,_0x4bbe14,_0xbec033){var _0xdfcecc={'raw':![],'where':{}};var _0x1224bc={};var _0x144aaa={'count':0x0,'rows':[]};return db[_0x47a5('0x54')][_0x47a5('0x61')]({'where':{'id':_0x396cb0[_0x47a5('0x5b')]['id']}})[_0x47a5('0x37')](handleEntityNotFound(_0x4bbe14,null))[_0x47a5('0x37')](function(_0x44cb90){if(_0x44cb90){_0x1224bc[_0x47a5('0x44')]=_[_0x47a5('0x47')](db[_0x47a5('0x5f')][_0x47a5('0x40')]);_0x1224bc[_0x47a5('0x46')]=_['keys'](_0x396cb0[_0x47a5('0x46')]);_0x1224bc[_0x47a5('0x48')]=_[_0x47a5('0x49')](_0x1224bc['model'],_0x1224bc[_0x47a5('0x46')]);_0xdfcecc[_0x47a5('0x4b')]=_[_0x47a5('0x49')](_0x1224bc[_0x47a5('0x44')],qs['fields'](_0x396cb0[_0x47a5('0x46')]['fields']));_0xdfcecc[_0x47a5('0x4b')]=_0xdfcecc['attributes'][_0x47a5('0x62')]?_0xdfcecc['attributes']:_0x1224bc[_0x47a5('0x44')];if(!_0x396cb0[_0x47a5('0x46')][_0x47a5('0x63')]('nolimit')){_0xdfcecc['limit']=qs['limit'](_0x396cb0[_0x47a5('0x46')][_0x47a5('0x30')]);_0xdfcecc[_0x47a5('0x2f')]=qs[_0x47a5('0x2f')](_0x396cb0['query'][_0x47a5('0x2f')]);}_0xdfcecc[_0x47a5('0x64')]=qs[_0x47a5('0x4d')](_0x396cb0[_0x47a5('0x46')][_0x47a5('0x4d')]);_0xdfcecc[_0x47a5('0x4e')]=qs[_0x47a5('0x48')](_[_0x47a5('0x4f')](_0x396cb0[_0x47a5('0x46')],_0x1224bc[_0x47a5('0x48')]));_0xdfcecc[_0x47a5('0x4e')][_0x47a5('0x5e')]=_0x44cb90['id'];if(_0x396cb0['query'][_0x47a5('0x50')]){_0xdfcecc['where']=_[_0x47a5('0x51')](_0xdfcecc[_0x47a5('0x4e')],{'$or':_[_0x47a5('0x45')](_0xdfcecc[_0x47a5('0x4b')],function(_0x40e584){var _0xa9c853={};_0xa9c853[_0x40e584]={'$like':'%'+_0x396cb0[_0x47a5('0x46')][_0x47a5('0x50')]+'%'};return _0xa9c853;})});}_0xdfcecc=_[_0x47a5('0x51')]({},_0xdfcecc,_0x396cb0[_0x47a5('0x58')]);return db[_0x47a5('0x5f')][_0x47a5('0x2e')]({'where':_0xdfcecc[_0x47a5('0x4e')]})[_0x47a5('0x37')](function(_0x441d64){_0x144aaa['count']=_0x441d64;if(_0x396cb0['query']['includeAll']){_0xdfcecc['include']=[{'all':!![]}];}return db[_0x47a5('0x5f')][_0x47a5('0x55')](_0xdfcecc);})['then'](function(_0x732e00){_0x144aaa[_0x47a5('0x65')]=_0x732e00;return _0x144aaa;});}})[_0x47a5('0x37')](respondWithFilteredResult(_0x4bbe14,_0xdfcecc))[_0x47a5('0x2a')](handleError(_0x4bbe14,null));};exports[_0x47a5('0x66')]=function(_0x930d25,_0x218dfa,_0x1c7302){return db[_0x47a5('0x54')][_0x47a5('0x5a')]({'where':{'id':_0x930d25[_0x47a5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x218dfa,null))[_0x47a5('0x37')](function(_0x1fbd42){if(_0x1fbd42){return _0x1fbd42[_0x47a5('0x66')](_0x930d25['query'][_0x47a5('0x67')]);}})[_0x47a5('0x37')](respondWithStatusCode(_0x218dfa,null))[_0x47a5('0x2a')](handleError(_0x218dfa,null));};exports['addAnswer']=function(_0x19dc8c,_0x5205ba,_0x49d93d){if(_0x19dc8c[_0x47a5('0x59')]['id']){delete _0x19dc8c[_0x47a5('0x59')]['id'];}return db[_0x47a5('0x54')][_0x47a5('0x5a')]({'where':{'id':_0x19dc8c[_0x47a5('0x5b')]['id']}})[_0x47a5('0x37')](handleEntityNotFound(_0x5205ba,null))['then'](function(_0x592322){if(_0x592322){_0x19dc8c[_0x47a5('0x59')]['MailAccountId']=_0x592322['id'];return db[_0x47a5('0x68')][_0x47a5('0x69')](_0x19dc8c[_0x47a5('0x59')]);}})[_0x47a5('0x37')](respondWithResult(_0x5205ba,null))['catch'](handleError(_0x5205ba,null));};exports[_0x47a5('0x6a')]=function(_0x550bde,_0x5f3a04,_0x139c79){var _0x391f8e={'raw':![],'where':{}};var _0x5b91f7={};var _0x1926bd={'count':0x0,'rows':[]};return db[_0x47a5('0x54')][_0x47a5('0x61')]({'where':{'id':_0x550bde['params']['id']}})[_0x47a5('0x37')](handleEntityNotFound(_0x5f3a04,null))['then'](function(_0x2307da){if(_0x2307da){_0x5b91f7[_0x47a5('0x44')]=_[_0x47a5('0x47')](db['CannedAnswer'][_0x47a5('0x40')]);_0x5b91f7[_0x47a5('0x46')]=_[_0x47a5('0x47')](_0x550bde['query']);_0x5b91f7[_0x47a5('0x48')]=_['intersection'](_0x5b91f7[_0x47a5('0x44')],_0x5b91f7['query']);_0x391f8e[_0x47a5('0x4b')]=_[_0x47a5('0x49')](_0x5b91f7[_0x47a5('0x44')],qs[_0x47a5('0x4a')](_0x550bde['query'][_0x47a5('0x4a')]));_0x391f8e[_0x47a5('0x4b')]=_0x391f8e[_0x47a5('0x4b')][_0x47a5('0x62')]?_0x391f8e[_0x47a5('0x4b')]:_0x5b91f7['model'];if(!_0x550bde['query'][_0x47a5('0x63')]('nolimit')){_0x391f8e[_0x47a5('0x30')]=qs[_0x47a5('0x30')](_0x550bde[_0x47a5('0x46')]['limit']);_0x391f8e[_0x47a5('0x2f')]=qs[_0x47a5('0x2f')](_0x550bde['query'][_0x47a5('0x2f')]);}_0x391f8e[_0x47a5('0x64')]=qs[_0x47a5('0x4d')](_0x550bde[_0x47a5('0x46')]['sort']);_0x391f8e['where']=qs[_0x47a5('0x48')](_[_0x47a5('0x4f')](_0x550bde['query'],_0x5b91f7[_0x47a5('0x48')]));_0x391f8e[_0x47a5('0x4e')]['MailAccountId']=_0x2307da['id'];if(_0x550bde[_0x47a5('0x46')][_0x47a5('0x50')]){_0x391f8e[_0x47a5('0x4e')]=_['merge'](_0x391f8e[_0x47a5('0x4e')],{'$or':_['map'](_0x391f8e[_0x47a5('0x4b')],function(_0x5e2946){var _0x243c8b={};_0x243c8b[_0x5e2946]={'$like':'%'+_0x550bde[_0x47a5('0x46')]['filter']+'%'};return _0x243c8b;})});}_0x391f8e=_[_0x47a5('0x51')]({},_0x391f8e,_0x550bde['options']);return db[_0x47a5('0x68')][_0x47a5('0x2e')]({'where':_0x391f8e[_0x47a5('0x4e')]})[_0x47a5('0x37')](function(_0x49b76a){_0x1926bd[_0x47a5('0x2e')]=_0x49b76a;if(_0x550bde['query']['includeAll']){_0x391f8e[_0x47a5('0x53')]=[{'all':!![]}];}return db[_0x47a5('0x68')][_0x47a5('0x55')](_0x391f8e);})[_0x47a5('0x37')](function(_0x380c8b){_0x1926bd['rows']=_0x380c8b;return _0x1926bd;});}})[_0x47a5('0x37')](respondWithFilteredResult(_0x5f3a04,_0x391f8e))[_0x47a5('0x2a')](handleError(_0x5f3a04,null));};exports[_0x47a5('0x6b')]=function(_0x11b68b,_0x50b98e,_0x240db9){return db['MailAccount'][_0x47a5('0x5a')]({'where':{'id':_0x11b68b[_0x47a5('0x5b')]['id']}})[_0x47a5('0x37')](handleEntityNotFound(_0x50b98e,null))[_0x47a5('0x37')](function(_0x29a1cf){if(_0x29a1cf){return _0x29a1cf[_0x47a5('0x6b')](_0x11b68b[_0x47a5('0x46')][_0x47a5('0x67')]);}})[_0x47a5('0x37')](respondWithStatusCode(_0x50b98e,null))['catch'](handleError(_0x50b98e,null));};exports[_0x47a5('0x69')]=function(_0x18f8b2,_0x59266f){var _0x2fd46f={'name':_0x18f8b2[_0x47a5('0x59')][_0x47a5('0x3a')],'key':_0x18f8b2['body']['key'],'email':_0x18f8b2[_0x47a5('0x59')][_0x47a5('0x6c')],'ListId':_0x18f8b2['body']['ListId'],'active':!_[_0x47a5('0x6d')](_0x18f8b2[_0x47a5('0x59')]['active'])?_0x18f8b2[_0x47a5('0x59')][_0x47a5('0x6e')]:!![],'description':_0x18f8b2['body'][_0x47a5('0x6f')]||null,'Imap':{},'Smtp':{}};if(_[_0x47a5('0x6d')](_0x18f8b2[_0x47a5('0x59')][_0x47a5('0x70')])){if(_0x18f8b2[_0x47a5('0x59')][_0x47a5('0x71')]){_0x2fd46f['Imap']['user']=_0x2fd46f['Smtp'][_0x47a5('0x72')]=_0x18f8b2[_0x47a5('0x59')]['cuser'];_0x2fd46f[_0x47a5('0x3c')][_0x47a5('0x73')]=_0x2fd46f[_0x47a5('0x74')][_0x47a5('0x75')]=_0x18f8b2[_0x47a5('0x59')]['cpassword'];}else{_0x2fd46f[_0x47a5('0x3c')]['authentication']=_0x2fd46f['Smtp']['authentication']=![];}_0x2fd46f[_0x47a5('0x3c')]['host']=_0x18f8b2[_0x47a5('0x59')][_0x47a5('0x3c')][_0x47a5('0x76')];_0x2fd46f['Imap'][_0x47a5('0x77')]=_0x18f8b2[_0x47a5('0x59')][_0x47a5('0x3c')][_0x47a5('0x77')];_0x2fd46f[_0x47a5('0x74')]['host']=_0x18f8b2[_0x47a5('0x59')][_0x47a5('0x74')]['host'];_0x2fd46f[_0x47a5('0x74')][_0x47a5('0x77')]=_0x18f8b2[_0x47a5('0x59')][_0x47a5('0x74')][_0x47a5('0x77')];}else{_0x2fd46f[_0x47a5('0x3c')]['service']=_0x2fd46f[_0x47a5('0x74')][_0x47a5('0x78')]=_0x18f8b2['body'][_0x47a5('0x70')];_0x2fd46f[_0x47a5('0x3c')][_0x47a5('0x72')]=_0x2fd46f[_0x47a5('0x74')]['user']=_0x18f8b2['body']['cuser'];_0x2fd46f['Imap'][_0x47a5('0x73')]=_0x2fd46f[_0x47a5('0x74')][_0x47a5('0x75')]=_0x18f8b2[_0x47a5('0x59')][_0x47a5('0x79')];}return db[_0x47a5('0x54')][_0x47a5('0x69')](_0x2fd46f,{'include':[{'model':db[_0x47a5('0x3d')],'as':'Smtp'},{'model':db[_0x47a5('0x57')],'as':_0x47a5('0x3c')}]})[_0x47a5('0x37')](function(_0x399528){var _0x47be87=_0x18f8b2['user'][_0x47a5('0x7a')]({'plain':!![]});if(!_0x47be87)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47be87['role']===_0x47a5('0x72')){var _0x3f0a15=_0x399528['get']({'plain':!![]});return db[_0x47a5('0x7b')][_0x47a5('0x5a')]({'where':{'name':_0x47a5('0x35'),'userProfileId':_0x47be87['userProfileId']},'raw':!![]})[_0x47a5('0x37')](function(_0xee23c7){if(_0xee23c7&&_0xee23c7['autoAssociation']===0x0){return db[_0x47a5('0x36')][_0x47a5('0x69')]({'name':_0x3f0a15[_0x47a5('0x3a')],'resourceId':_0x3f0a15['id'],'type':_0xee23c7[_0x47a5('0x3a')],'sectionId':_0xee23c7['id']},{})[_0x47a5('0x37')](function(){return _0x399528;});}else{return _0x399528;}})[_0x47a5('0x2a')](function(_0x482c87){logger[_0x47a5('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x482c87);throw _0x482c87;});}return _0x399528;})[_0x47a5('0x37')](respondWithResult(_0x59266f,0xc9))[_0x47a5('0x2a')](handleError(_0x59266f,null));};exports[_0x47a5('0x7c')]=function(_0x25f188,_0x522972,_0x3d93ad){return db[_0x47a5('0x54')][_0x47a5('0x61')]({'where':{'id':_0x25f188[_0x47a5('0x5b')]['id']}})[_0x47a5('0x37')](handleEntityNotFound(_0x522972,null))[_0x47a5('0x37')](function(_0x31b8b1){if(_0x31b8b1){return _0x31b8b1[_0x47a5('0x7c')]();}return null;})[_0x47a5('0x37')](respondWithResult(_0x522972,null))[_0x47a5('0x2a')](handleError(_0x522972,null));};exports[_0x47a5('0x7d')]=function(_0x301031,_0x52a2be,_0x4218fd){if(_0x301031[_0x47a5('0x59')]['id']){delete _0x301031['body']['id'];}return db[_0x47a5('0x54')][_0x47a5('0x5a')]({'where':{'id':_0x301031[_0x47a5('0x5b')]['id']}})[_0x47a5('0x37')](handleEntityNotFound(_0x52a2be,null))[_0x47a5('0x37')](function(_0x58fac0){if(_0x58fac0){_0x301031[_0x47a5('0x59')][_0x47a5('0x5e')]=_0x58fac0['id'];return db[_0x47a5('0x57')][_0x47a5('0x69')](_0x301031[_0x47a5('0x59')]);}})[_0x47a5('0x37')](respondWithResult(_0x52a2be,null))[_0x47a5('0x2a')](handleError(_0x52a2be,null));};exports['removeImap']=function(_0x596562,_0xa3d578,_0x580ce8){return db[_0x47a5('0x54')]['findOne']({'where':{'id':_0x596562[_0x47a5('0x5b')]['id']}})[_0x47a5('0x37')](handleEntityNotFound(_0xa3d578,null))[_0x47a5('0x37')](function(_0x2bc7ae){if(_0x2bc7ae){return _0x2bc7ae['setImap'](null);}return null;})[_0x47a5('0x37')](respondWithStatusCode(_0xa3d578,null))[_0x47a5('0x2a')](handleError(_0xa3d578,null));};exports[_0x47a5('0x7e')]=function(_0x5a150a,_0x581759,_0x30375f){return db[_0x47a5('0x54')][_0x47a5('0x61')]({'where':{'id':_0x5a150a[_0x47a5('0x5b')]['id']}})[_0x47a5('0x37')](handleEntityNotFound(_0x581759,null))[_0x47a5('0x37')](function(_0x1c0323){if(_0x1c0323){return _0x1c0323[_0x47a5('0x7e')]();}return null;})['then'](respondWithResult(_0x581759,null))[_0x47a5('0x2a')](handleError(_0x581759,null));};exports['addSmtp']=function(_0x346322,_0xc3b5e1,_0x5b0b0b){if(_0x346322['body']['id']){delete _0x346322[_0x47a5('0x59')]['id'];}return db[_0x47a5('0x54')]['find']({'where':{'id':_0x346322[_0x47a5('0x5b')]['id']}})[_0x47a5('0x37')](handleEntityNotFound(_0xc3b5e1,null))[_0x47a5('0x37')](function(_0x44567e){if(_0x44567e){_0x346322['body'][_0x47a5('0x5e')]=_0x44567e['id'];return db['MailServerOut']['create'](_0x346322['body']);}})[_0x47a5('0x37')](respondWithResult(_0xc3b5e1,null))['catch'](handleError(_0xc3b5e1,null));};exports[_0x47a5('0x7f')]=function(_0x156d51,_0x401139,_0x2005d5){return db[_0x47a5('0x54')][_0x47a5('0x61')]({'where':{'id':_0x156d51[_0x47a5('0x5b')]['id']}})[_0x47a5('0x37')](handleEntityNotFound(_0x401139,null))[_0x47a5('0x37')](function(_0x2200f9){if(_0x2200f9){return _0x2200f9[_0x47a5('0x80')](null);}return null;})[_0x47a5('0x37')](respondWithStatusCode(_0x401139,null))[_0x47a5('0x2a')](handleError(_0x401139,null));};exports[_0x47a5('0x81')]=function(_0xff64fb,_0x5e17cb,_0xdd95c8){return db[_0x47a5('0x82')][_0x47a5('0x5a')]({'where':{'id':_0xff64fb[_0x47a5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5e17cb,null))[_0x47a5('0x37')](function(_0x49998b){if(_0x49998b){return _0x49998b[_0x47a5('0x81')](_0xff64fb['body'][_0x47a5('0x67')],_[_0x47a5('0x83')](_0xff64fb[_0x47a5('0x59')],['ids','id'])||{});}})[_0x47a5('0x37')](respondWithResult(_0x5e17cb,null))[_0x47a5('0x2a')](handleError(_0x5e17cb,null));};exports[_0x47a5('0x84')]=function(_0x4ac804,_0x52798d,_0x20f320){var _0x1a5e07={'raw':![],'where':{}};var _0x31c88c={};var _0x4594df={'count':0x0,'rows':[]};return db[_0x47a5('0x54')]['findOne']({'where':{'id':_0x4ac804[_0x47a5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x52798d,null))[_0x47a5('0x37')](function(_0xdeaf4e){if(_0xdeaf4e){_0x31c88c[_0x47a5('0x44')]=_[_0x47a5('0x47')](db['MailInteraction']['rawAttributes']);_0x31c88c[_0x47a5('0x46')]=_[_0x47a5('0x47')](_0x4ac804[_0x47a5('0x46')]);_0x31c88c[_0x47a5('0x48')]=_[_0x47a5('0x49')](_0x31c88c[_0x47a5('0x44')],_0x31c88c[_0x47a5('0x46')]);_0x1a5e07[_0x47a5('0x4b')]=_[_0x47a5('0x49')](_0x31c88c['model'],qs['fields'](_0x4ac804[_0x47a5('0x46')]['fields']));_0x1a5e07[_0x47a5('0x4b')]=_0x1a5e07[_0x47a5('0x4b')][_0x47a5('0x62')]?_0x1a5e07['attributes']:_0x31c88c[_0x47a5('0x44')];if(!_0x4ac804[_0x47a5('0x46')]['hasOwnProperty'](_0x47a5('0x4c'))){_0x1a5e07['limit']=qs[_0x47a5('0x30')](_0x4ac804[_0x47a5('0x46')][_0x47a5('0x30')]);_0x1a5e07['offset']=qs['offset'](_0x4ac804['query']['offset']);}_0x1a5e07['order']=qs[_0x47a5('0x4d')](_0x4ac804['query'][_0x47a5('0x4d')]);_0x1a5e07[_0x47a5('0x4e')]=qs['filters'](_['pick'](_0x4ac804['query'],_0x31c88c[_0x47a5('0x48')]));_0x1a5e07['where']['MailAccountId']=_0xdeaf4e['id'];if(_0x4ac804['query'][_0x47a5('0x50')]){_0x1a5e07[_0x47a5('0x4e')]=_[_0x47a5('0x51')](_0x1a5e07[_0x47a5('0x4e')],{'$or':_['map'](_0x1a5e07[_0x47a5('0x4b')],function(_0x559943){var _0x2b6f9e={};_0x2b6f9e[_0x559943]={'$like':'%'+_0x4ac804['query'][_0x47a5('0x50')]+'%'};return _0x2b6f9e;})});}_0x1a5e07=_[_0x47a5('0x51')]({},_0x1a5e07,_0x4ac804[_0x47a5('0x58')]);return db['MailInteraction'][_0x47a5('0x2e')]({'where':_0x1a5e07[_0x47a5('0x4e')]})[_0x47a5('0x37')](function(_0x31100e){_0x4594df['count']=_0x31100e;if(_0x4ac804[_0x47a5('0x46')][_0x47a5('0x52')]){_0x1a5e07[_0x47a5('0x53')]=[{'model':db[_0x47a5('0x85')],'as':_0x47a5('0x86'),'required':![]},{'model':db[_0x47a5('0x87')],'as':'Owner','attributes':[_0x47a5('0x3a'),_0x47a5('0x88'),_0x47a5('0x89')],'required':![]},{'model':db[_0x47a5('0x8a')],'as':_0x47a5('0x8b'),'attributes':['id',_0x47a5('0x3a'),_0x47a5('0x8c')],'where':_0x4ac804[_0x47a5('0x46')][_0x47a5('0x8d')]?{'id':_0x4ac804[_0x47a5('0x46')][_0x47a5('0x8d')]}:undefined,'required':_0x4ac804[_0x47a5('0x46')][_0x47a5('0x8d')]?!![]:![]}];}return db[_0x47a5('0x82')][_0x47a5('0x55')](_0x1a5e07);})[_0x47a5('0x37')](function(_0x40505e){_0x4594df['rows']=_0x40505e;return _0x4594df;});}})[_0x47a5('0x37')](respondWithFilteredResult(_0x52798d,_0x1a5e07))['catch'](handleError(_0x52798d,null));};exports['addApplications']=function(_0x1542b9,_0x154365,_0x36f910){return db['MailAccount'][_0x47a5('0x61')]({'where':{'id':_0x1542b9[_0x47a5('0x5b')]['id']}})[_0x47a5('0x37')](handleEntityNotFound(_0x154365,null))[_0x47a5('0x37')](function(_0x30e5fb){if(_0x30e5fb){return db[_0x47a5('0x8e')][_0x47a5('0x8f')](function(_0x46cb3a){return db[_0x47a5('0x90')][_0x47a5('0x91')]({'where':{'MailAccountId':_0x1542b9[_0x47a5('0x5b')]['id']},'transaction':_0x46cb3a})[_0x47a5('0x37')](function(_0x203bc9){var _0x4d7fd4=_['map'](_0x1542b9[_0x47a5('0x59')],function(_0x5e7d56){_0x5e7d56[_0x47a5('0x5e')]=_0x1542b9[_0x47a5('0x5b')]['id'];return _0x5e7d56;});return db[_0x47a5('0x90')][_0x47a5('0x92')](_0x4d7fd4,{'transaction':_0x46cb3a});});})[_0x47a5('0x37')](function(){return db[_0x47a5('0x90')]['findAndCountAll']({'where':{'MailAccountId':_0x1542b9[_0x47a5('0x5b')]['id']},'order':_0x47a5('0x93')});});}})[_0x47a5('0x37')](respondWithResult(_0x154365,null))['catch'](handleError(_0x154365,null));};exports[_0x47a5('0x94')]=function(_0x439f60,_0x3ecc41,_0x3e4148){var _0x4c46ea={};var _0x23e649={};var _0x35e20f;var _0x46615a;return db[_0x47a5('0x54')][_0x47a5('0x61')]({'where':{'id':_0x439f60[_0x47a5('0x5b')]['id']}})[_0x47a5('0x37')](handleEntityNotFound(_0x3ecc41,null))[_0x47a5('0x37')](function(_0x2ac386){if(_0x2ac386){_0x35e20f=_0x2ac386;_0x23e649[_0x47a5('0x44')]=_[_0x47a5('0x47')](db[_0x47a5('0x90')][_0x47a5('0x40')]);_0x23e649[_0x47a5('0x46')]=_[_0x47a5('0x47')](_0x439f60[_0x47a5('0x46')]);_0x23e649[_0x47a5('0x48')]=_['intersection'](_0x23e649[_0x47a5('0x44')],_0x23e649['query']);_0x4c46ea[_0x47a5('0x4b')]=_[_0x47a5('0x49')](_0x23e649[_0x47a5('0x44')],qs[_0x47a5('0x4a')](_0x439f60[_0x47a5('0x46')][_0x47a5('0x4a')]));_0x4c46ea[_0x47a5('0x4b')]=_0x4c46ea[_0x47a5('0x4b')]['length']?_0x4c46ea[_0x47a5('0x4b')]:_0x23e649[_0x47a5('0x44')];_0x4c46ea[_0x47a5('0x64')]=qs['sort'](_0x439f60[_0x47a5('0x46')][_0x47a5('0x4d')]);_0x4c46ea[_0x47a5('0x4e')]=qs[_0x47a5('0x48')](_['pick'](_0x439f60[_0x47a5('0x46')],_0x23e649[_0x47a5('0x48')]));if(_0x439f60[_0x47a5('0x46')][_0x47a5('0x50')]){_0x4c46ea['where']=_[_0x47a5('0x51')](_0x4c46ea['where'],{'$or':_['map'](_0x4c46ea[_0x47a5('0x4b')],function(_0x1efae8){var _0x407fd2={};_0x407fd2[_0x1efae8]={'$like':'%'+_0x439f60[_0x47a5('0x46')]['filter']+'%'};return _0x407fd2;})});}_0x4c46ea=_[_0x47a5('0x51')]({},_0x4c46ea,_0x439f60[_0x47a5('0x58')]);return _0x35e20f[_0x47a5('0x94')](_0x4c46ea);}})[_0x47a5('0x37')](function(_0xf470f5){if(_0xf470f5){_0x46615a=_0xf470f5[_0x47a5('0x62')];if(!_0x439f60['query'][_0x47a5('0x63')](_0x47a5('0x4c'))){_0x4c46ea[_0x47a5('0x30')]=qs[_0x47a5('0x30')](_0x439f60[_0x47a5('0x46')]['limit']);_0x4c46ea[_0x47a5('0x2f')]=qs['offset'](_0x439f60[_0x47a5('0x46')]['offset']);}return _0x35e20f[_0x47a5('0x94')](_0x4c46ea);}})['then'](function(_0x56a3c4){if(_0x56a3c4){return _0x56a3c4?{'count':_0x46615a,'rows':_0x56a3c4}:null;}})[_0x47a5('0x37')](respondWithResult(_0x3ecc41,null))[_0x47a5('0x2a')](handleError(_0x3ecc41,null));};exports['getMessages']=function(_0xa07bc6,_0x2d7e13,_0x530542){var _0x3a09e6={'raw':!![],'where':{}};var _0x112e1e={};var _0x36871e={'count':0x0,'rows':[]};return db['MailAccount'][_0x47a5('0x61')]({'where':{'id':_0xa07bc6[_0x47a5('0x5b')]['id']}})[_0x47a5('0x37')](handleEntityNotFound(_0x2d7e13,null))[_0x47a5('0x37')](function(_0x37721c){if(_0x37721c){_0x112e1e['model']=_['keys'](db[_0x47a5('0x95')]['rawAttributes']);_0x112e1e[_0x47a5('0x46')]=_[_0x47a5('0x47')](_0xa07bc6['query']);_0x112e1e['filters']=_[_0x47a5('0x49')](_0x112e1e['model'],_0x112e1e[_0x47a5('0x46')]);_0x3a09e6[_0x47a5('0x4b')]=_[_0x47a5('0x49')](_0x112e1e[_0x47a5('0x44')],qs[_0x47a5('0x4a')](_0xa07bc6[_0x47a5('0x46')][_0x47a5('0x4a')]));_0x3a09e6['attributes']=_0x3a09e6[_0x47a5('0x4b')]['length']?_0x3a09e6[_0x47a5('0x4b')]:_0x112e1e[_0x47a5('0x44')];if(!_0xa07bc6[_0x47a5('0x46')][_0x47a5('0x63')](_0x47a5('0x4c'))){_0x3a09e6[_0x47a5('0x30')]=qs[_0x47a5('0x30')](_0xa07bc6[_0x47a5('0x46')][_0x47a5('0x30')]);_0x3a09e6[_0x47a5('0x2f')]=qs[_0x47a5('0x2f')](_0xa07bc6[_0x47a5('0x46')]['offset']);}_0x3a09e6[_0x47a5('0x64')]=qs[_0x47a5('0x4d')](_0xa07bc6[_0x47a5('0x46')]['sort']);_0x3a09e6[_0x47a5('0x4e')]=qs[_0x47a5('0x48')](_[_0x47a5('0x4f')](_0xa07bc6[_0x47a5('0x46')],_0x112e1e[_0x47a5('0x48')]));_0x3a09e6[_0x47a5('0x4e')]['MailAccountId']=_0x37721c['id'];if(_0xa07bc6[_0x47a5('0x46')][_0x47a5('0x50')]){_0x3a09e6[_0x47a5('0x4e')]=_[_0x47a5('0x51')](_0x3a09e6[_0x47a5('0x4e')],{'$or':_[_0x47a5('0x45')](_0x3a09e6[_0x47a5('0x4b')],function(_0x188bdf){var _0x355c4b={};_0x355c4b[_0x188bdf]={'$like':'%'+_0xa07bc6[_0x47a5('0x46')]['filter']+'%'};return _0x355c4b;})});}if(_0xa07bc6['query'][_0x47a5('0x96')]){var _0x144524=_0xa07bc6[_0x47a5('0x46')]['$gte'][_0x47a5('0x97')](',');var _0x50b7fc={};_0x50b7fc[_0x144524[0x0]]={'$gte':moment(_0x144524[0x1])['format'](_0x47a5('0x98'))};_0x3a09e6[_0x47a5('0x4e')]=_[_0x47a5('0x51')](_0x3a09e6[_0x47a5('0x4e')],_0x50b7fc);}_0x3a09e6=_['merge']({},_0x3a09e6,_0xa07bc6[_0x47a5('0x58')]);return db[_0x47a5('0x95')]['count']({'where':_0x3a09e6['where']})['then'](function(_0x28a52a){_0x36871e[_0x47a5('0x2e')]=_0x28a52a;if(_0xa07bc6[_0x47a5('0x46')][_0x47a5('0x52')]){_0x3a09e6[_0x47a5('0x53')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x3a09e6);})[_0x47a5('0x37')](function(_0x1b0fd4){if(_0xa07bc6[_0x47a5('0x46')][_0x47a5('0x99')]==='true'){for(var _0x873e26=0x0;_0x873e26<_0x1b0fd4[_0x47a5('0x62')];_0x873e26++){_0x1b0fd4[_0x873e26][_0x47a5('0x59')]=juice(_0x1b0fd4[_0x873e26][_0x47a5('0x59')]);}}_0x36871e['rows']=_0x1b0fd4;return _0x36871e;});}})['then'](respondWithFilteredResult(_0x2d7e13,_0x3a09e6))['catch'](handleError(_0x2d7e13,null));};exports[_0x47a5('0x9a')]=function(_0x15ddfc,_0x156ceb,_0x3c6142){var _0x242006,_0x1441c3={},_0x3bcdbc;if(_0x15ddfc[_0x47a5('0x59')]['to']){_0x3bcdbc=_0x15ddfc[_0x47a5('0x59')]['to']['split'](',')[0x0];}return db[_0x47a5('0x54')][_0x47a5('0x5a')]({'where':{'id':_0x15ddfc['params']['id']},'include':[{'model':db[_0x47a5('0x9b')],'as':_0x47a5('0x9c'),'include':[{'model':db[_0x47a5('0x85')],'as':_0x47a5('0x9d'),'where':{'email':_0x3bcdbc},'limit':0x1,'order':[['updatedAt',_0x47a5('0x9e')]]}]},{'model':db[_0x47a5('0x3d')],'as':_0x47a5('0x74'),'raw':!![]}]})['then'](handleEntityNotFound(_0x156ceb,null))['then'](function(_0x27a666){if(_0x27a666){_0x242006=_0x27a666;if(_0x27a666['Smtp']){if(_[_0x47a5('0x6d')](_0x15ddfc['body'][_0x47a5('0x9f')])){_0x15ddfc[_0x47a5('0x59')][_0x47a5('0x9f')]=util[_0x47a5('0xa0')](_0x47a5('0xa1'),_0x27a666['name'],_0x27a666['email']||_0x27a666[_0x47a5('0x74')][_0x47a5('0x72')]);}if(_0x15ddfc[_0x47a5('0x59')][_0x47a5('0xa2')]&&_0x15ddfc['body']['attachments'][_0x47a5('0x62')]){for(var _0x4c9f4f=0x0;_0x4c9f4f<_0x15ddfc[_0x47a5('0x59')]['attachments'][_0x47a5('0x62')];_0x4c9f4f+=0x1){_0x15ddfc['body'][_0x47a5('0xa2')][_0x4c9f4f]={'filename':_0x15ddfc[_0x47a5('0x59')][_0x47a5('0xa2')][_0x4c9f4f][_0x47a5('0x3a')],'path':path[_0x47a5('0xa3')](config[_0x47a5('0xa4')],_0x47a5('0xa5'),_0x15ddfc[_0x47a5('0x59')]['attachments'][_0x4c9f4f][_0x47a5('0xa6')])};}}var _0x4394f0={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x27a666[_0x47a5('0x74')][_0x47a5('0x78')])){if(_0x27a666['Smtp']['authentication']){_0x4394f0[_0x47a5('0xa7')]={'user':_0x27a666['Smtp'][_0x47a5('0x72')],'pass':_0x27a666[_0x47a5('0x74')][_0x47a5('0x75')]};}_0x4394f0['host']=_0x27a666[_0x47a5('0x74')][_0x47a5('0x76')];_0x4394f0[_0x47a5('0x77')]=_0x27a666[_0x47a5('0x74')][_0x47a5('0x77')];_0x4394f0[_0x47a5('0xa8')]=_0x27a666[_0x47a5('0x74')]['secure'];}else{_0x4394f0[_0x47a5('0x78')]=_0x27a666[_0x47a5('0x74')][_0x47a5('0x78')];_0x4394f0[_0x47a5('0xa7')]={'user':_0x27a666[_0x47a5('0x74')][_0x47a5('0x72')],'pass':_0x27a666[_0x47a5('0x74')]['pass']};}return respondWithRpcPromise('SendMail',_0x47a5('0xa9'),{'account':_0x4394f0,'message':_0x15ddfc[_0x47a5('0x59')]});}else{throw new Error(_0x47a5('0xaa'));}}})['then'](function(_0x5d2a10){if(_0x5d2a10){_0x1441c3=_0x5d2a10;if(_0x242006[_0x47a5('0x9c')]){if(_0x242006[_0x47a5('0x9c')][_0x47a5('0x9d')][_0x47a5('0x62')]){return _0x242006[_0x47a5('0x9c')][_0x47a5('0x9d')][0x0];}else{return db[_0x47a5('0x85')]['create'](_[_0x47a5('0x18')](_0x15ddfc[_0x47a5('0x59')],{'firstName':_0x15ddfc[_0x47a5('0x59')]['to'],'email':_0x15ddfc['body']['to'],'phone':_0x15ddfc[_0x47a5('0x59')]['to'],'ListId':_0x242006[_0x47a5('0xab')]}));}}else{throw new Error(_0x47a5('0xaa'));}}})[_0x47a5('0x37')](function(_0x38aab1){if(_0x38aab1){var _0x20eff3={'UserId':_0x15ddfc[_0x47a5('0x72')]['id'],'ContactId':_0x38aab1['id'],'MailAccountId':_0x242006['id'],'inReplyTo':_0x1441c3[_0x47a5('0xac')],'to':_0x15ddfc[_0x47a5('0x59')][_0x47a5('0x9f')],'cc':_0x15ddfc[_0x47a5('0x59')]['cc'],'subject':_0x15ddfc[_0x47a5('0x59')][_0x47a5('0xad')],'attach':_0x15ddfc['body'][_0x47a5('0xae')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x47a5('0xa0')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x47a5('0xaf'),'Messages':[_[_0x47a5('0x51')](_0x15ddfc[_0x47a5('0x59')],{'messageId':_0x1441c3['messageId'],'sentAt':moment()[_0x47a5('0xa0')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x242006['id'],'UserId':_0x15ddfc[_0x47a5('0x72')]['id'],'ContactId':_0x38aab1['id']})]};if(_0x15ddfc[_0x47a5('0x59')][_0x47a5('0xb0')]){_0x20eff3=_[_0x47a5('0x51')](_0x20eff3,_0x15ddfc['body'][_0x47a5('0xb0')]);}return db['MailInteraction']['create'](_0x20eff3,{'include':[{'model':db[_0x47a5('0x95')],'as':_0x47a5('0xb1')}]});}})[_0x47a5('0x37')](respondWithResult(_0x156ceb,null))[_0x47a5('0x2a')](handleError(_0x156ceb,null));};exports[_0x47a5('0xb2')]=function(_0x11ae07,_0x10a789,_0x33ac8b){return db[_0x47a5('0x54')]['find']({'where':{'id':_0x11ae07['params']['id']},'include':[{'model':db[_0x47a5('0x3d')],'as':_0x47a5('0x74'),'raw':!![]}]})[_0x47a5('0x37')](handleEntityNotFound(_0x10a789,null))[_0x47a5('0x37')](function(_0x616b88){if(_0x616b88&&_0x616b88['Smtp']){var _0x3cfa62={'id':_0x616b88['id'],'tls':{'rejectUnauthorized':![]}};if(_0x616b88[_0x47a5('0x74')][_0x47a5('0x78')]){_0x3cfa62['service']=_0x616b88['Smtp'][_0x47a5('0x78')];}else{_0x3cfa62[_0x47a5('0x76')]=_0x616b88['Smtp'][_0x47a5('0x76')];_0x3cfa62[_0x47a5('0x77')]=_0x616b88[_0x47a5('0x74')]['port'];_0x3cfa62[_0x47a5('0xa8')]=_0x616b88[_0x47a5('0x74')][_0x47a5('0xa8')];}if(_0x616b88[_0x47a5('0x74')][_0x47a5('0xb3')]){_0x3cfa62['auth']={'user':_0x616b88[_0x47a5('0x74')][_0x47a5('0x72')],'pass':_0x616b88[_0x47a5('0x74')][_0x47a5('0x75')]};}return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x3cfa62});}})[_0x47a5('0x37')](respondWithResult(_0x10a789,null))['catch'](handleError(_0x10a789,null));};exports[_0x47a5('0x91')]=function(_0xe66584,_0x17a4c2){return db[_0x47a5('0x54')][_0x47a5('0x5a')]({'where':{'id':_0xe66584[_0x47a5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x17a4c2,null))[_0x47a5('0x37')](function(_0x4035c6){if(_0x4035c6&&_0x4035c6[_0x47a5('0x78')]){throw new db['Sequelize']['ValidationError'](_0x47a5('0xb4'));}return _0x4035c6;})['then'](removeEntity(_0x17a4c2,null))[_0x47a5('0x2a')](handleError(_0x17a4c2,null));};exports[_0x47a5('0xb5')]=function(_0x3641f8,_0x22390f,_0x184d43){return db['MailAccount']['find']({'where':{'id':_0x3641f8[_0x47a5('0x5b')]['id']}})[_0x47a5('0x37')](handleEntityNotFound(_0x22390f,null))[_0x47a5('0x37')](function(_0x9fdee1){if(_0x9fdee1){return _0x9fdee1[_0x47a5('0xb5')](_0x3641f8['body'][_0x47a5('0x67')],_[_0x47a5('0x83')](_0x3641f8[_0x47a5('0x59')],[_0x47a5('0x67'),'id'])||{})[_0x47a5('0xb6')](function(_0x4df71d){for(var _0x28a5f3=0x0;_0x28a5f3<_0x3641f8[_0x47a5('0x59')][_0x47a5('0x67')][_0x47a5('0x62')];_0x28a5f3+=0x1){socket[_0x47a5('0xb7')](_0x47a5('0xb8'),{'UserId':_0x3641f8[_0x47a5('0x59')][_0x47a5('0x67')][_0x28a5f3],'MailAccountId':_0x3641f8[_0x47a5('0x5b')]['id']});}return _0x4df71d;});}})[_0x47a5('0x37')](respondWithResult(_0x22390f,null))[_0x47a5('0x2a')](handleError(_0x22390f,null));};exports['removeAgents']=function(_0x39786a,_0x1ccb2e,_0x19f0da){return db[_0x47a5('0x54')]['find']({'where':{'id':_0x39786a['params']['id']}})['then'](handleEntityNotFound(_0x1ccb2e,null))[_0x47a5('0x37')](function(_0x52e921){if(_0x52e921){return _0x52e921[_0x47a5('0xb9')](_0x39786a[_0x47a5('0x46')]['ids'])[_0x47a5('0x37')](function(){if(_[_0x47a5('0xba')](_0x39786a[_0x47a5('0x46')]['ids'])){for(var _0x457398=0x0;_0x457398<_0x39786a['query'][_0x47a5('0x67')][_0x47a5('0x62')];_0x457398+=0x1){socket[_0x47a5('0xb7')](_0x47a5('0xbb'),{'UserId':Number(_0x39786a[_0x47a5('0x46')][_0x47a5('0x67')][_0x457398]),'MailAccountId':Number(_0x39786a['params']['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0x39786a[_0x47a5('0x46')][_0x47a5('0x67')]),'MailAccountId':Number(_0x39786a[_0x47a5('0x5b')]['id'])});}});}})[_0x47a5('0x37')](respondWithStatusCode(_0x1ccb2e,null))[_0x47a5('0x2a')](handleError(_0x1ccb2e,null));};exports[_0x47a5('0xbc')]=function(_0x338c9d,_0x138b92,_0x232c36){var _0x25954e={};var _0x277061={};var _0x3917e0;var _0x1c7695;return db[_0x47a5('0x54')][_0x47a5('0x61')]({'where':{'id':_0x338c9d[_0x47a5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x138b92,null))[_0x47a5('0x37')](function(_0x46b82a){if(_0x46b82a){_0x3917e0=_0x46b82a;_0x277061[_0x47a5('0x44')]=_[_0x47a5('0x47')](db[_0x47a5('0x87')][_0x47a5('0x40')]);_0x277061[_0x47a5('0x46')]=_[_0x47a5('0x47')](_0x338c9d['query']);_0x277061[_0x47a5('0x48')]=_['intersection'](_0x277061[_0x47a5('0x44')],_0x277061[_0x47a5('0x46')]);_0x25954e['attributes']=_[_0x47a5('0x49')](_0x277061['model'],qs[_0x47a5('0x4a')](_0x338c9d[_0x47a5('0x46')][_0x47a5('0x4a')]));_0x25954e[_0x47a5('0x4b')]=_0x25954e[_0x47a5('0x4b')]['length']?_0x25954e[_0x47a5('0x4b')]:_0x277061[_0x47a5('0x44')];_0x25954e[_0x47a5('0x64')]=qs['sort'](_0x338c9d['query'][_0x47a5('0x4d')]);_0x25954e[_0x47a5('0x4e')]=qs[_0x47a5('0x48')](_['pick'](_0x338c9d[_0x47a5('0x46')],_0x277061[_0x47a5('0x48')]));if(_0x338c9d[_0x47a5('0x46')]['filter']){_0x25954e[_0x47a5('0x4e')]=_[_0x47a5('0x51')](_0x25954e[_0x47a5('0x4e')],{'$or':_[_0x47a5('0x45')](_0x25954e['attributes'],function(_0x1a1be9){var _0x5d6808={};_0x5d6808[_0x1a1be9]={'$like':'%'+_0x338c9d[_0x47a5('0x46')][_0x47a5('0x50')]+'%'};return _0x5d6808;})});}_0x25954e=_[_0x47a5('0x51')]({},_0x25954e,_0x338c9d[_0x47a5('0x58')]);return _0x3917e0['getAgents'](_0x25954e);}})[_0x47a5('0x37')](function(_0x147d77){if(_0x147d77){_0x1c7695=_0x147d77[_0x47a5('0x62')];if(!_0x338c9d[_0x47a5('0x46')][_0x47a5('0x63')]('nolimit')){_0x25954e[_0x47a5('0x30')]=qs[_0x47a5('0x30')](_0x338c9d[_0x47a5('0x46')][_0x47a5('0x30')]);_0x25954e[_0x47a5('0x2f')]=qs[_0x47a5('0x2f')](_0x338c9d['query'][_0x47a5('0x2f')]);}return _0x3917e0[_0x47a5('0xbc')](_0x25954e);}})['then'](function(_0x556e8e){if(_0x556e8e){return _0x556e8e?{'count':_0x1c7695,'rows':_0x556e8e}:null;}})[_0x47a5('0x37')](respondWithResult(_0x138b92,null))[_0x47a5('0x2a')](handleError(_0x138b92,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 37252f3..49abb56 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 _0xdf47=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailAccount','setMaxListeners','save'];(function(_0x4159ca,_0x120405){var _0x19036a=function(_0x578a2f){while(--_0x578a2f){_0x4159ca['push'](_0x4159ca['shift']());}};_0x19036a(++_0x120405);}(_0xdf47,0xe2));var _0x7df4=function(_0x131573,_0x3fc347){_0x131573=_0x131573-0x0;var _0xa51210=_0xdf47[_0x131573];return _0xa51210;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x7df4('0x0'))['db'][_0x7df4('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7df4('0x2')](0x0);var events={'afterCreate':_0x7df4('0x3'),'afterUpdate':_0x7df4('0x4'),'afterDestroy':_0x7df4('0x5')};function emitEvent(_0x392166){return function(_0x485ad7,_0x36e74a,_0x3c4e86){MailAccountEvents[_0x7df4('0x6')](_0x392166+':'+_0x485ad7['id'],_0x485ad7);MailAccountEvents[_0x7df4('0x6')](_0x392166,_0x485ad7);_0x3c4e86(null);};}for(var e in events){if(events[_0x7df4('0x7')](e)){var event=events[e];MailAccount[_0x7df4('0x8')](e,emitEvent(event));}}module[_0x7df4('0x9')]=MailAccountEvents; \ No newline at end of file +var _0xead9=['events','../../mysqldb','MailAccount','save','update','emit','hook'];(function(_0x396f5e,_0x107581){var _0x2e6ff5=function(_0x375dc7){while(--_0x375dc7){_0x396f5e['push'](_0x396f5e['shift']());}};_0x2e6ff5(++_0x107581);}(_0xead9,0xaf));var _0x9ead=function(_0x525af1,_0x452e7f){_0x525af1=_0x525af1-0x0;var _0xe06dac=_0xead9[_0x525af1];return _0xe06dac;};'use strict';var EventEmitter=require(_0x9ead('0x0'));var MailAccount=require(_0x9ead('0x1'))['db'][_0x9ead('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9ead('0x3'),'afterUpdate':_0x9ead('0x4'),'afterDestroy':'remove'};function emitEvent(_0x8b5db1){return function(_0x30fdb4,_0x30b82a,_0x537779){MailAccountEvents[_0x9ead('0x5')](_0x8b5db1+':'+_0x30fdb4['id'],_0x30fdb4);MailAccountEvents[_0x9ead('0x5')](_0x8b5db1,_0x30fdb4);_0x537779(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x9ead('0x6')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 000dc54..ad1ed5a 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 _0xe018=['define','MailAccount','mail_accounts','lodash','util','../../config/logger','moment','request-promise','path','./mailAccount.attributes','exports'];(function(_0x110c54,_0xa3cfcb){var _0x58a348=function(_0x2ddb40){while(--_0x2ddb40){_0x110c54['push'](_0x110c54['shift']());}};_0x58a348(++_0xa3cfcb);}(_0xe018,0xc9));var _0x8e01=function(_0x471de2,_0x45fa14){_0x471de2=_0x471de2-0x0;var _0x1d2ee7=_0xe018[_0x471de2];return _0x1d2ee7;};'use strict';var _=require(_0x8e01('0x0'));var util=require(_0x8e01('0x1'));var logger=require(_0x8e01('0x2'))('api');var moment=require(_0x8e01('0x3'));var BPromise=require('bluebird');var rp=require(_0x8e01('0x4'));var fs=require('fs');var path=require(_0x8e01('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8e01('0x6'));module[_0x8e01('0x7')]=function(_0x5ab6ce,_0x2ab437){return _0x5ab6ce[_0x8e01('0x8')](_0x8e01('0x9'),attributes,{'tableName':_0x8e01('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa227=['util','../../config/logger','api','moment','request-promise','rimraf','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash'];(function(_0x9b3efc,_0x577a0d){var _0x200f05=function(_0x15ad7c){while(--_0x15ad7c){_0x9b3efc['push'](_0x9b3efc['shift']());}};_0x200f05(++_0x577a0d);}(_0xa227,0x18b));var _0x7a22=function(_0x2f2bfd,_0x1a7949){_0x2f2bfd=_0x2f2bfd-0x0;var _0x4ae24c=_0xa227[_0x2f2bfd];return _0x4ae24c;};'use strict';var _=require(_0x7a22('0x0'));var util=require(_0x7a22('0x1'));var logger=require(_0x7a22('0x2'))(_0x7a22('0x3'));var moment=require(_0x7a22('0x4'));var BPromise=require('bluebird');var rp=require(_0x7a22('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7a22('0x6'));var config=require('../../config/environment');var attributes=require(_0x7a22('0x7'));module[_0x7a22('0x8')]=function(_0x5e940c,_0x33b4a1){return _0x5e940c[_0x7a22('0x9')](_0x7a22('0xa'),attributes,{'tableName':_0x7a22('0xb'),'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 692aec3..2afce79 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 _0x8828=['MailAccount','findAll','options','raw','where','attributes','limit','map','include','model','GetMailAccount','stringify','ShowMailAccount','find','NotifyMailAccount','body','mail','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','MailApplication','Applications','Smtp','get','omit','applications','list','orderBy','priority','asc','account','close','*,*,*,*','ListId','create','contact','messageId','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','spread','update','format','interaction','created','MailMessage','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','then','info','request\x20sent','debug','error','code','message','MailAccount,\x20%s,\x20%s','result','catch'];(function(_0xa0ac5f,_0x414309){var _0x284910=function(_0x550721){while(--_0x550721){_0xa0ac5f['push'](_0xa0ac5f['shift']());}};_0x284910(++_0x414309);}(_0x8828,0x123));var _0x8882=function(_0x5199f5,_0x2fb830){_0x5199f5=_0x5199f5-0x0;var _0x133f16=_0x8828[_0x5199f5];return _0x133f16;};'use strict';var _=require(_0x8882('0x0'));var util=require(_0x8882('0x1'));var moment=require(_0x8882('0x2'));var BPromise=require('bluebird');var rs=require(_0x8882('0x3'));var fs=require('fs');var Redis=require(_0x8882('0x4'));var db=require(_0x8882('0x5'))['db'];var utils=require(_0x8882('0x6'));var logger=require(_0x8882('0x7'))('rpc');var config=require(_0x8882('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8882('0x9')][_0x8882('0xa')]({'port':0x232c});config[_0x8882('0xb')]=_[_0x8882('0xc')](config['redis'],{'host':_0x8882('0xd'),'port':0x18eb});var socket=require(_0x8882('0xe'))(new Redis(config['redis']));require(_0x8882('0xf'))['register'](socket);function respondWithRpcPromise(_0x334f01,_0x20d57c,_0x17b343){return new BPromise(function(_0x56f7e5,_0x12dc9c){return client[_0x8882('0x10')](_0x334f01,_0x17b343)[_0x8882('0x11')](function(_0x5aedd3){logger[_0x8882('0x12')]('MailAccount,\x20%s,\x20%s',_0x20d57c,_0x8882('0x13'));logger[_0x8882('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x20d57c,'request\x20sent',JSON['stringify'](_0x5aedd3));if(_0x5aedd3['error']){if(_0x5aedd3[_0x8882('0x15')][_0x8882('0x16')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x20d57c,_0x5aedd3[_0x8882('0x15')]['message']);return _0x12dc9c(_0x5aedd3[_0x8882('0x15')][_0x8882('0x17')]);}logger['error'](_0x8882('0x18'),_0x20d57c,_0x5aedd3[_0x8882('0x15')][_0x8882('0x17')]);return _0x56f7e5(_0x5aedd3[_0x8882('0x15')][_0x8882('0x17')]);}else{logger[_0x8882('0x12')](_0x8882('0x18'),_0x20d57c,'request\x20sent');_0x56f7e5(_0x5aedd3[_0x8882('0x19')]['message']);}})[_0x8882('0x1a')](function(_0x5f3ef1){logger[_0x8882('0x15')]('MailAccount,\x20%s,\x20%s',_0x20d57c,_0x5f3ef1);_0x12dc9c(_0x5f3ef1);});});}exports['GetMailAccount']=function(_0x5c8c82){var _0x4aeea4=this;return new Promise(function(_0x568373,_0x479f58){return db[_0x8882('0x1b')][_0x8882('0x1c')]({'raw':_0x5c8c82[_0x8882('0x1d')]?_0x5c8c82[_0x8882('0x1d')][_0x8882('0x1e')]===undefined?!![]:![]:!![],'where':_0x5c8c82['options']?_0x5c8c82['options'][_0x8882('0x1f')]||null:null,'attributes':_0x5c8c82[_0x8882('0x1d')]?_0x5c8c82[_0x8882('0x1d')][_0x8882('0x20')]||null:null,'limit':_0x5c8c82[_0x8882('0x1d')]?_0x5c8c82[_0x8882('0x1d')][_0x8882('0x21')]||null:null,'include':_0x5c8c82[_0x8882('0x1d')]?_0x5c8c82[_0x8882('0x1d')]['include']?_[_0x8882('0x22')](_0x5c8c82[_0x8882('0x1d')][_0x8882('0x23')],function(_0x4ce66c){return{'model':db[_0x4ce66c[_0x8882('0x24')]],'as':_0x4ce66c['as'],'attributes':_0x4ce66c['attributes'],'include':_0x4ce66c[_0x8882('0x23')]?_[_0x8882('0x22')](_0x4ce66c[_0x8882('0x23')],function(_0x2b31a2){return{'model':db[_0x2b31a2[_0x8882('0x24')]],'as':_0x2b31a2['as'],'attributes':_0x2b31a2[_0x8882('0x20')],'include':_0x2b31a2[_0x8882('0x23')]?_[_0x8882('0x22')](_0x2b31a2[_0x8882('0x23')],function(_0x418254){return{'model':db[_0x418254[_0x8882('0x24')]],'as':_0x418254['as'],'attributes':_0x418254[_0x8882('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5bf934){logger[_0x8882('0x12')](_0x8882('0x25'),_0x5c8c82);logger[_0x8882('0x14')]('GetMailAccount',_0x5c8c82,JSON[_0x8882('0x26')](_0x5bf934));_0x568373(_0x5bf934);})[_0x8882('0x1a')](function(_0x3ff87b){logger[_0x8882('0x15')]('GetMailAccount',_0x3ff87b[_0x8882('0x17')],_0x5c8c82);_0x479f58(_0x4aeea4['error'](0x1f4,_0x3ff87b['message']));});});};exports[_0x8882('0x27')]=function(_0x59d189){var _0x919bf3=this;return new Promise(function(_0x490fca,_0x445222){return db[_0x8882('0x1b')][_0x8882('0x28')]({'raw':_0x59d189[_0x8882('0x1d')]?_0x59d189[_0x8882('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x59d189[_0x8882('0x1d')]?_0x59d189[_0x8882('0x1d')]['where']||null:null,'attributes':_0x59d189[_0x8882('0x1d')]?_0x59d189[_0x8882('0x1d')][_0x8882('0x20')]||null:null,'include':_0x59d189[_0x8882('0x1d')]?_0x59d189[_0x8882('0x1d')][_0x8882('0x23')]?_[_0x8882('0x22')](_0x59d189['options']['include'],function(_0x45923d){return{'model':db[_0x45923d[_0x8882('0x24')]],'as':_0x45923d['as'],'attributes':_0x45923d[_0x8882('0x20')],'include':_0x45923d['include']?_['map'](_0x45923d[_0x8882('0x23')],function(_0x15b212){return{'model':db[_0x15b212[_0x8882('0x24')]],'as':_0x15b212['as'],'attributes':_0x15b212['attributes'],'include':_0x15b212['include']?_['map'](_0x15b212[_0x8882('0x23')],function(_0x5ef6ab){return{'model':db[_0x5ef6ab[_0x8882('0x24')]],'as':_0x5ef6ab['as'],'attributes':_0x5ef6ab[_0x8882('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8882('0x11')](function(_0x43506a){logger['info'](_0x8882('0x27'),_0x59d189);logger[_0x8882('0x14')]('ShowMailAccount',_0x59d189,JSON[_0x8882('0x26')](_0x43506a));_0x490fca(_0x43506a);})[_0x8882('0x1a')](function(_0x341205){logger[_0x8882('0x15')](_0x8882('0x27'),_0x341205['message'],_0x59d189);_0x445222(_0x919bf3[_0x8882('0x15')](0x1f4,_0x341205[_0x8882('0x17')]));});});};exports[_0x8882('0x29')]=function(_0x334e8e){var _0x1f89f5=this;return new Promise(function(_0x160bd8,_0x3db30c){var _0xcdb44c={'body':_0x334e8e[_0x8882('0x2a')],'channel':_0x8882('0x2b')};var _0x4b8519=_['difference'](_[_0x8882('0x2c')](db[_0x8882('0x2d')][_0x8882('0x2e')]),[_0x8882('0x2f'),_0x8882('0x30'),_0x8882('0x31'),'ListId']);var _0x87edac=![];if(_0x334e8e[_0x8882('0x2a')]['id']){delete _0x334e8e[_0x8882('0x2a')]['id'];}if(_[_0x8882('0x32')](_0x334e8e[_0x8882('0x2a')][_0x8882('0x33')])){return _0x3db30c(_0x1f89f5[_0x8882('0x15')](0x1f4,_0x8882('0x34')));}if(_[_0x8882('0x32')](_0x334e8e['body'][_0x8882('0x2a')])||_0x334e8e[_0x8882('0x2a')][_0x8882('0x2a')]===''){return _0x3db30c(_0x1f89f5[_0x8882('0x15')](0x1f4,_0x8882('0x35')));}if(_[_0x8882('0x32')](_0x334e8e[_0x8882('0x2a')][_0x8882('0x36')])){return _0x3db30c(_0x1f89f5[_0x8882('0x15')](0x1f4,_0x8882('0x37')+_0x4b8519));}if(!_['includes'](_0x4b8519,_0x334e8e['body'][_0x8882('0x36')])){return _0x3db30c(_0x1f89f5['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4b8519));}var _0x15b0cf={};_0x15b0cf[_0x334e8e['body'][_0x8882('0x36')]]=_0x334e8e['body'][_0x8882('0x33')];return db[_0x8882('0x1b')][_0x8882('0x28')]({'where':{'id':_0x334e8e['account']['id']},'include':[{'model':db[_0x8882('0x38')],'as':_0x8882('0x39'),'include':[{'model':db[_0x8882('0x2d')],'as':_0x8882('0x3a'),'where':_0x15b0cf,'limit':0x1,'order':[[_0x8882('0x30'),_0x8882('0x3b')]]}]},{'model':db[_0x8882('0x3c')],'as':_0x8882('0x3d')},{'model':db['MailServerOut'],'as':_0x8882('0x3e')}]})[_0x8882('0x11')](function(_0x2aa658){if(_0x2aa658&&_0x2aa658[_0x8882('0x39')]){var _0x54dde3=_0x2aa658[_0x8882('0x3f')]({'plain':!![]});_0xcdb44c['account']=_[_0x8882('0x40')](_0x54dde3,[_0x8882('0x3d'),_0x8882('0x39')]);_0xcdb44c[_0x8882('0x41')]=_0x54dde3[_0x8882('0x3d')];_0xcdb44c[_0x8882('0x42')]=_0x54dde3[_0x8882('0x39')];_0xcdb44c[_0x8882('0x41')]=_[_0x8882('0x43')](_0xcdb44c[_0x8882('0x41')],[_0x8882('0x44')],[_0x8882('0x45')]);if(_0xcdb44c['account']&&_0xcdb44c[_0x8882('0x46')]['autoclose']){_0xcdb44c[_0x8882('0x41')]['push']({'id':0x0,'priority':_0xcdb44c['applications']['length']+0x1,'app':_0x8882('0x47'),'appdata':'autoclose','interval':_0x8882('0x48')});}if(_0xcdb44c[_0x8882('0x46')][_0x8882('0x3d')]){delete _0xcdb44c[_0x8882('0x46')][_0x8882('0x3d')];}if(_0xcdb44c['account'][_0x8882('0x39')]){delete _0xcdb44c[_0x8882('0x46')]['List'];}if(_0x54dde3['List'][_0x8882('0x3a')]['length']){return _0x54dde3[_0x8882('0x39')][_0x8882('0x3a')][0x0];}var _0x2eac2b=_['defaults'](_0x334e8e[_0x8882('0x2a')],{'firstName':_0x334e8e[_0x8882('0x2a')][_0x8882('0x33')],'ListId':_0x54dde3[_0x8882('0x49')]});_0x2eac2b[_0x334e8e['body'][_0x8882('0x36')]]=_0x334e8e['body'][_0x8882('0x33')];return db[_0x8882('0x2d')][_0x8882('0x4a')](_0x2eac2b);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x4f82a5){_0xcdb44c[_0x8882('0x4b')]=_0x4f82a5;if(_0x4f82a5){if(!_0x334e8e[_0x8882('0x2a')][_0x8882('0x17')][_0x8882('0x4c')]){_0x334e8e[_0x8882('0x2a')]['message'][_0x8882('0x4c')]=rs['generate']()+'\x20'+_0x334e8e[_0x8882('0x2a')][_0x8882('0x17')]['from'];}var _0x76c0f5={'ContactId':_0x4f82a5['id'],'MailAccountId':_0x334e8e['account']['id'],'inReplyTo':_0x334e8e[_0x8882('0x2a')]['message']['messageId'],'to':_0x334e8e[_0x8882('0x2a')][_0x8882('0x17')][_0x8882('0x33')],'cc':_0x334e8e[_0x8882('0x2a')]['message']['cc'],'subject':_0x334e8e['body'][_0x8882('0x17')][_0x8882('0x4d')],'attach':_0x334e8e[_0x8882('0x2a')][_0x8882('0x17')][_0x8882('0x4e')],'lastMsgAt':moment()['format'](_0x8882('0x4f')),'lastMsgDirection':'in'};return db[_0x8882('0x50')][_0x8882('0x28')]({'where':{'closed':![],'MailAccountId':_0x334e8e[_0x8882('0x46')]['id']},'include':[{'model':db['MailMessage'],'as':_0x8882('0x51'),'attributes':[_0x8882('0x4c')],'where':{'messageId':_0x334e8e[_0x8882('0x2a')][_0x8882('0x17')][_0x8882('0x52')]}}]})[_0x8882('0x11')](function(_0x41cc37){if(_0x41cc37){return[_0x41cc37,![]];}return db[_0x8882('0x50')][_0x8882('0x4a')](_0x76c0f5)[_0x8882('0x11')](function(_0x5bf4ac){return[_0x5bf4ac,!![]];});});}else{throw new Error(_0x8882('0x53'));}})[_0x8882('0x54')](function(_0x457bb6,_0xa192fd){if(_0x457bb6){_0x87edac=_0xa192fd;if(!_0xa192fd){return _0x457bb6[_0x8882('0x55')]({'inReplyTo':_0x334e8e[_0x8882('0x2a')][_0x8882('0x17')]['messageId'],'to':_0x334e8e['body'][_0x8882('0x17')]['from'],'cc':_0x334e8e['body'][_0x8882('0x17')]['cc'],'subject':_0x334e8e[_0x8882('0x2a')][_0x8882('0x17')]['subject'],'attach':_0x457bb6[_0x8882('0x4e')]?_0x457bb6['attach']:_0x334e8e[_0x8882('0x2a')][_0x8882('0x17')]['attach'],'substatus':null,'substatusAt':moment()[_0x8882('0x56')](_0x8882('0x4f')),'lastMsgAt':moment()['format'](_0x8882('0x4f')),'lastMsgDirection':'in'});}else{return _0x457bb6;}}})['then'](function(_0x48d7fa){_0xcdb44c[_0x8882('0x57')]=_0x48d7fa['get']({'plain':!![]});_0xcdb44c[_0x8882('0x57')][_0x8882('0x58')]=_0x87edac;return db[_0x8882('0x59')]['create']({'body':_0x334e8e[_0x8882('0x2a')][_0x8882('0x2a')],'MailAccountId':_0x334e8e['account']['id'],'MailInteractionId':_0x48d7fa['id'],'direction':'in','ContactId':_0xcdb44c['contact']['id'],'messageId':_0x334e8e[_0x8882('0x2a')][_0x8882('0x17')][_0x8882('0x4c')],'from':_0x334e8e[_0x8882('0x2a')][_0x8882('0x17')][_0x8882('0x33')],'to':_0x334e8e['body']['message']['to'],'cc':_0x334e8e[_0x8882('0x2a')]['message']['cc'],'subject':_0x334e8e[_0x8882('0x2a')][_0x8882('0x17')]['subject'],'attach':_0x334e8e[_0x8882('0x2a')][_0x8882('0x17')][_0x8882('0x4e')],'Attachments':_0x334e8e[_0x8882('0x2a')][_0x8882('0x17')][_0x8882('0x5a')],'originTo':_0x334e8e[_0x8882('0x2a')][_0x8882('0x17')][_0x8882('0x5b')],'originCc':_0x334e8e['body']['message'][_0x8882('0x5c')],'bcc':_0x334e8e[_0x8882('0x2a')][_0x8882('0x17')][_0x8882('0x5d')],'ChatWebsiteId':_0x334e8e[_0x8882('0x2a')][_0x8882('0x17')][_0x8882('0x5e')]||null,'originChannel':_0x334e8e['body'][_0x8882('0x17')][_0x8882('0x5f')]||_0x8882('0x60'),'ChatOfflineMessageId':_0x334e8e['body'][_0x8882('0x17')][_0x8882('0x61')]||null},{'include':[{'model':db[_0x8882('0x62')],'as':_0x8882('0x63')}]});})[_0x8882('0x11')](function(_0x396fb0){_0xcdb44c[_0x8882('0x17')]=_0x396fb0;if(_0xcdb44c[_0x8882('0x57')][_0x8882('0x64')]){return db['User']['find']({'attributes':['id',_0x8882('0x65')],'where':{'id':_0xcdb44c[_0x8882('0x57')]['UserId']}})[_0x8882('0x11')](function(_0x74f722){if(_0x74f722){_0xcdb44c[_0x8882('0x41')][_0x8882('0x66')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x74f722['name']+','+(_0xcdb44c[_0x8882('0x46')][_0x8882('0x67')]||0xa),'interval':_0x8882('0x48')});}return respondWithRpcPromise(_0x8882('0x68'),_0x8882('0x69'),_0xcdb44c);});}return respondWithRpcPromise('Start',_0x8882('0x69'),_0xcdb44c);})[_0x8882('0x11')](function(_0x2961f3){_0x160bd8(_0x2961f3);})[_0x8882('0x1a')](function(_0x423f13){_0x3db30c(_0x1f89f5[_0x8882('0x15')](0x1f4,_0x423f13[_0x8882('0x17')]));});});}; \ No newline at end of file +var _0xe461=['rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetMailAccount','findAll','options','raw','where','attributes','limit','include','model','map','info','ShowMailAccount','find','stringify','NotifyMailAccount','body','mail','CmContact','rawAttributes','CompanyId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','from','MailAccount','account','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','Smtp','List','get','applications','list','orderBy','priority','length','close','*,*,*,*','ListId','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','update','subject','interaction','created','MailMessage','create','originTo','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','agent','Start','startRouting','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0xf429ef,_0x1d7642){var _0x522132=function(_0x15e5f5){while(--_0x15e5f5){_0xf429ef['push'](_0xf429ef['shift']());}};_0x522132(++_0x1d7642);}(_0xe461,0xc2));var _0x1e46=function(_0x6f8f25,_0x4b8467){_0x6f8f25=_0x6f8f25-0x0;var _0x1b20b3=_0xe461[_0x6f8f25];return _0x1b20b3;};'use strict';var _=require(_0x1e46('0x0'));var util=require('util');var moment=require(_0x1e46('0x1'));var BPromise=require(_0x1e46('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e46('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1e46('0x4'));var logger=require(_0x1e46('0x5'))(_0x1e46('0x6'));var config=require(_0x1e46('0x7'));var jayson=require(_0x1e46('0x8'));var client=jayson['client'][_0x1e46('0x9')]({'port':0x232c});config['redis']=_[_0x1e46('0xa')](config[_0x1e46('0xb')],{'host':_0x1e46('0xc'),'port':0x18eb});var socket=require(_0x1e46('0xd'))(new Redis(config[_0x1e46('0xb')]));require(_0x1e46('0xe'))['register'](socket);function respondWithRpcPromise(_0x1ce6e3,_0x29723d,_0x1cc3ff){return new BPromise(function(_0x335692,_0x234810){return client[_0x1e46('0xf')](_0x1ce6e3,_0x1cc3ff)[_0x1e46('0x10')](function(_0x330d89){logger['info'](_0x1e46('0x11'),_0x29723d,_0x1e46('0x12'));logger[_0x1e46('0x13')](_0x1e46('0x14'),_0x29723d,_0x1e46('0x12'),JSON['stringify'](_0x330d89));if(_0x330d89[_0x1e46('0x15')]){if(_0x330d89[_0x1e46('0x15')][_0x1e46('0x16')]===0x1f4){logger[_0x1e46('0x15')](_0x1e46('0x11'),_0x29723d,_0x330d89[_0x1e46('0x15')]['message']);return _0x234810(_0x330d89['error']['message']);}logger[_0x1e46('0x15')]('MailAccount,\x20%s,\x20%s',_0x29723d,_0x330d89[_0x1e46('0x15')][_0x1e46('0x17')]);return _0x335692(_0x330d89[_0x1e46('0x15')]['message']);}else{logger['info'](_0x1e46('0x11'),_0x29723d,_0x1e46('0x12'));_0x335692(_0x330d89['result']['message']);}})[_0x1e46('0x18')](function(_0x3d8797){logger[_0x1e46('0x15')](_0x1e46('0x11'),_0x29723d,_0x3d8797);_0x234810(_0x3d8797);});});}exports[_0x1e46('0x19')]=function(_0x320ad2){var _0x156f68=this;return new Promise(function(_0x309739,_0x14e0d1){return db['MailAccount'][_0x1e46('0x1a')]({'raw':_0x320ad2[_0x1e46('0x1b')]?_0x320ad2['options'][_0x1e46('0x1c')]===undefined?!![]:![]:!![],'where':_0x320ad2[_0x1e46('0x1b')]?_0x320ad2[_0x1e46('0x1b')][_0x1e46('0x1d')]||null:null,'attributes':_0x320ad2[_0x1e46('0x1b')]?_0x320ad2[_0x1e46('0x1b')][_0x1e46('0x1e')]||null:null,'limit':_0x320ad2[_0x1e46('0x1b')]?_0x320ad2[_0x1e46('0x1b')][_0x1e46('0x1f')]||null:null,'include':_0x320ad2['options']?_0x320ad2[_0x1e46('0x1b')]['include']?_['map'](_0x320ad2[_0x1e46('0x1b')][_0x1e46('0x20')],function(_0x1595b5){return{'model':db[_0x1595b5[_0x1e46('0x21')]],'as':_0x1595b5['as'],'attributes':_0x1595b5[_0x1e46('0x1e')],'include':_0x1595b5[_0x1e46('0x20')]?_[_0x1e46('0x22')](_0x1595b5['include'],function(_0x511b95){return{'model':db[_0x511b95['model']],'as':_0x511b95['as'],'attributes':_0x511b95['attributes'],'include':_0x511b95[_0x1e46('0x20')]?_[_0x1e46('0x22')](_0x511b95[_0x1e46('0x20')],function(_0x2f457c){return{'model':db[_0x2f457c[_0x1e46('0x21')]],'as':_0x2f457c['as'],'attributes':_0x2f457c[_0x1e46('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e69f0){logger[_0x1e46('0x23')]('GetMailAccount',_0x320ad2);logger[_0x1e46('0x13')]('GetMailAccount',_0x320ad2,JSON['stringify'](_0x2e69f0));_0x309739(_0x2e69f0);})[_0x1e46('0x18')](function(_0x5e4b2a){logger[_0x1e46('0x15')]('GetMailAccount',_0x5e4b2a['message'],_0x320ad2);_0x14e0d1(_0x156f68[_0x1e46('0x15')](0x1f4,_0x5e4b2a[_0x1e46('0x17')]));});});};exports[_0x1e46('0x24')]=function(_0x16ba6e){var _0x384bbf=this;return new Promise(function(_0x455ebf,_0x561377){return db['MailAccount'][_0x1e46('0x25')]({'raw':_0x16ba6e[_0x1e46('0x1b')]?_0x16ba6e[_0x1e46('0x1b')][_0x1e46('0x1c')]===undefined?!![]:![]:!![],'where':_0x16ba6e[_0x1e46('0x1b')]?_0x16ba6e[_0x1e46('0x1b')]['where']||null:null,'attributes':_0x16ba6e['options']?_0x16ba6e[_0x1e46('0x1b')]['attributes']||null:null,'include':_0x16ba6e[_0x1e46('0x1b')]?_0x16ba6e[_0x1e46('0x1b')][_0x1e46('0x20')]?_[_0x1e46('0x22')](_0x16ba6e[_0x1e46('0x1b')][_0x1e46('0x20')],function(_0x1c9097){return{'model':db[_0x1c9097[_0x1e46('0x21')]],'as':_0x1c9097['as'],'attributes':_0x1c9097[_0x1e46('0x1e')],'include':_0x1c9097[_0x1e46('0x20')]?_[_0x1e46('0x22')](_0x1c9097[_0x1e46('0x20')],function(_0x420437){return{'model':db[_0x420437[_0x1e46('0x21')]],'as':_0x420437['as'],'attributes':_0x420437[_0x1e46('0x1e')],'include':_0x420437[_0x1e46('0x20')]?_['map'](_0x420437[_0x1e46('0x20')],function(_0x1100f7){return{'model':db[_0x1100f7[_0x1e46('0x21')]],'as':_0x1100f7['as'],'attributes':_0x1100f7[_0x1e46('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1e46('0x10')](function(_0x5ff611){logger[_0x1e46('0x23')](_0x1e46('0x24'),_0x16ba6e);logger[_0x1e46('0x13')](_0x1e46('0x24'),_0x16ba6e,JSON[_0x1e46('0x26')](_0x5ff611));_0x455ebf(_0x5ff611);})[_0x1e46('0x18')](function(_0xcf104e){logger[_0x1e46('0x15')](_0x1e46('0x24'),_0xcf104e[_0x1e46('0x17')],_0x16ba6e);_0x561377(_0x384bbf[_0x1e46('0x15')](0x1f4,_0xcf104e['message']));});});};exports[_0x1e46('0x27')]=function(_0x3de968){var _0x25d578=this;return new Promise(function(_0xcf652a,_0x13153c){var _0x2f0ae2={'body':_0x3de968[_0x1e46('0x28')],'channel':_0x1e46('0x29')};var _0x145944=_['difference'](_['keys'](db[_0x1e46('0x2a')][_0x1e46('0x2b')]),['createdAt','updatedAt',_0x1e46('0x2c'),'ListId']);var _0x2e858e=![];if(_0x3de968[_0x1e46('0x28')]['id']){delete _0x3de968[_0x1e46('0x28')]['id'];}if(_[_0x1e46('0x2d')](_0x3de968[_0x1e46('0x28')]['from'])){return _0x13153c(_0x25d578['error'](0x1f4,_0x1e46('0x2e')));}if(_[_0x1e46('0x2d')](_0x3de968['body'][_0x1e46('0x28')])||_0x3de968[_0x1e46('0x28')][_0x1e46('0x28')]===''){return _0x13153c(_0x25d578[_0x1e46('0x15')](0x1f4,_0x1e46('0x2f')));}if(_['isNil'](_0x3de968[_0x1e46('0x28')]['mapKey'])){return _0x13153c(_0x25d578['error'](0x1f4,_0x1e46('0x30')+_0x145944));}if(!_[_0x1e46('0x31')](_0x145944,_0x3de968[_0x1e46('0x28')][_0x1e46('0x32')])){return _0x13153c(_0x25d578[_0x1e46('0x15')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x145944));}var _0x3b50ed={};_0x3b50ed[_0x3de968[_0x1e46('0x28')][_0x1e46('0x32')]]=_0x3de968[_0x1e46('0x28')][_0x1e46('0x33')];return db[_0x1e46('0x34')][_0x1e46('0x25')]({'where':{'id':_0x3de968[_0x1e46('0x35')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x1e46('0x2a')],'as':_0x1e46('0x36'),'where':_0x3b50ed,'limit':0x1,'order':[[_0x1e46('0x37'),_0x1e46('0x38')]]}]},{'model':db[_0x1e46('0x39')],'as':_0x1e46('0x3a')},{'model':db[_0x1e46('0x3b')],'as':_0x1e46('0x3c')}]})[_0x1e46('0x10')](function(_0x297d02){if(_0x297d02&&_0x297d02[_0x1e46('0x3d')]){var _0x1d4286=_0x297d02[_0x1e46('0x3e')]({'plain':!![]});_0x2f0ae2['account']=_['omit'](_0x1d4286,[_0x1e46('0x3a'),'List']);_0x2f0ae2[_0x1e46('0x3f')]=_0x1d4286[_0x1e46('0x3a')];_0x2f0ae2[_0x1e46('0x40')]=_0x1d4286[_0x1e46('0x3d')];_0x2f0ae2['applications']=_[_0x1e46('0x41')](_0x2f0ae2[_0x1e46('0x3f')],[_0x1e46('0x42')],['asc']);if(_0x2f0ae2['account']&&_0x2f0ae2[_0x1e46('0x35')]['autoclose']){_0x2f0ae2[_0x1e46('0x3f')]['push']({'id':0x0,'priority':_0x2f0ae2[_0x1e46('0x3f')][_0x1e46('0x43')]+0x1,'app':_0x1e46('0x44'),'appdata':'autoclose','interval':_0x1e46('0x45')});}if(_0x2f0ae2[_0x1e46('0x35')][_0x1e46('0x3a')]){delete _0x2f0ae2[_0x1e46('0x35')][_0x1e46('0x3a')];}if(_0x2f0ae2['account']['List']){delete _0x2f0ae2['account']['List'];}if(_0x1d4286['List']['Contacts'][_0x1e46('0x43')]){return _0x1d4286[_0x1e46('0x3d')][_0x1e46('0x36')][0x0];}var _0x465bc9=_[_0x1e46('0xa')](_0x3de968[_0x1e46('0x28')],{'firstName':_0x3de968[_0x1e46('0x28')][_0x1e46('0x33')],'ListId':_0x1d4286[_0x1e46('0x46')]});_0x465bc9[_0x3de968['body'][_0x1e46('0x32')]]=_0x3de968[_0x1e46('0x28')]['from'];return db['CmContact']['create'](_0x465bc9);}else{throw new Error(_0x1e46('0x47'));}})[_0x1e46('0x10')](function(_0x238a32){_0x2f0ae2[_0x1e46('0x48')]=_0x238a32;if(_0x238a32){if(!_0x3de968[_0x1e46('0x28')][_0x1e46('0x17')][_0x1e46('0x49')]){_0x3de968[_0x1e46('0x28')][_0x1e46('0x17')][_0x1e46('0x49')]=rs[_0x1e46('0x4a')]()+'\x20'+_0x3de968['body'][_0x1e46('0x17')]['from'];}var _0x16d85d={'ContactId':_0x238a32['id'],'MailAccountId':_0x3de968['account']['id'],'inReplyTo':_0x3de968[_0x1e46('0x28')]['message']['messageId'],'to':_0x3de968[_0x1e46('0x28')][_0x1e46('0x17')]['from'],'cc':_0x3de968[_0x1e46('0x28')][_0x1e46('0x17')]['cc'],'subject':_0x3de968[_0x1e46('0x28')][_0x1e46('0x17')]['subject'],'attach':_0x3de968[_0x1e46('0x28')][_0x1e46('0x17')][_0x1e46('0x4b')],'lastMsgAt':moment()[_0x1e46('0x4c')](_0x1e46('0x4d')),'lastMsgDirection':'in'};return db[_0x1e46('0x4e')][_0x1e46('0x25')]({'where':{'closed':![],'MailAccountId':_0x3de968[_0x1e46('0x35')]['id']},'include':[{'model':db['MailMessage'],'as':_0x1e46('0x4f'),'attributes':[_0x1e46('0x49')],'where':{'messageId':_0x3de968[_0x1e46('0x28')][_0x1e46('0x17')]['inReplyTo']}}]})[_0x1e46('0x10')](function(_0x533c18){if(_0x533c18){return[_0x533c18,![]];}return db[_0x1e46('0x4e')]['create'](_0x16d85d)[_0x1e46('0x10')](function(_0x56b073){return[_0x56b073,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x29714f,_0x312de4){if(_0x29714f){_0x2e858e=_0x312de4;if(!_0x312de4){return _0x29714f[_0x1e46('0x50')]({'inReplyTo':_0x3de968[_0x1e46('0x28')]['message']['messageId'],'to':_0x3de968[_0x1e46('0x28')][_0x1e46('0x17')][_0x1e46('0x33')],'cc':_0x3de968[_0x1e46('0x28')][_0x1e46('0x17')]['cc'],'subject':_0x3de968[_0x1e46('0x28')]['message'][_0x1e46('0x51')],'attach':_0x29714f[_0x1e46('0x4b')]?_0x29714f['attach']:_0x3de968[_0x1e46('0x28')][_0x1e46('0x17')][_0x1e46('0x4b')],'substatus':null,'substatusAt':moment()[_0x1e46('0x4c')](_0x1e46('0x4d')),'lastMsgAt':moment()[_0x1e46('0x4c')](_0x1e46('0x4d')),'lastMsgDirection':'in'});}else{return _0x29714f;}}})[_0x1e46('0x10')](function(_0x254231){_0x2f0ae2[_0x1e46('0x52')]=_0x254231['get']({'plain':!![]});_0x2f0ae2['interaction'][_0x1e46('0x53')]=_0x2e858e;return db[_0x1e46('0x54')][_0x1e46('0x55')]({'body':_0x3de968[_0x1e46('0x28')]['body'],'MailAccountId':_0x3de968[_0x1e46('0x35')]['id'],'MailInteractionId':_0x254231['id'],'direction':'in','ContactId':_0x2f0ae2[_0x1e46('0x48')]['id'],'messageId':_0x3de968[_0x1e46('0x28')][_0x1e46('0x17')]['messageId'],'from':_0x3de968[_0x1e46('0x28')][_0x1e46('0x17')]['from'],'to':_0x3de968[_0x1e46('0x28')][_0x1e46('0x17')]['to'],'cc':_0x3de968['body']['message']['cc'],'subject':_0x3de968[_0x1e46('0x28')]['message'][_0x1e46('0x51')],'attach':_0x3de968[_0x1e46('0x28')][_0x1e46('0x17')][_0x1e46('0x4b')],'Attachments':_0x3de968['body'][_0x1e46('0x17')]['attachments'],'originTo':_0x3de968[_0x1e46('0x28')][_0x1e46('0x17')][_0x1e46('0x56')],'originCc':_0x3de968['body']['message']['originCc'],'bcc':_0x3de968[_0x1e46('0x28')]['message'][_0x1e46('0x57')],'ChatWebsiteId':_0x3de968[_0x1e46('0x28')]['message'][_0x1e46('0x58')]||null,'originChannel':_0x3de968[_0x1e46('0x28')][_0x1e46('0x17')][_0x1e46('0x59')]||_0x1e46('0x5a'),'ChatOfflineMessageId':_0x3de968[_0x1e46('0x28')][_0x1e46('0x17')][_0x1e46('0x5b')]||null},{'include':[{'model':db[_0x1e46('0x5c')],'as':'Attachments'}]});})['then'](function(_0xd66970){_0x2f0ae2[_0x1e46('0x17')]=_0xd66970;if(_0x2f0ae2['interaction'][_0x1e46('0x5d')]){return db[_0x1e46('0x5e')]['find']({'attributes':['id',_0x1e46('0x5f')],'where':{'id':_0x2f0ae2[_0x1e46('0x52')][_0x1e46('0x5d')]}})[_0x1e46('0x10')](function(_0x4931a6){if(_0x4931a6){_0x2f0ae2[_0x1e46('0x3f')][_0x1e46('0x60')]({'id':0x0,'priority':0x0,'app':_0x1e46('0x61'),'appdata':_0x4931a6[_0x1e46('0x5f')]+','+(_0x2f0ae2['account']['waitForTheAssignedAgent']||0xa),'interval':_0x1e46('0x45')});}return respondWithRpcPromise(_0x1e46('0x62'),_0x1e46('0x63'),_0x2f0ae2);});}return respondWithRpcPromise(_0x1e46('0x62'),_0x1e46('0x63'),_0x2f0ae2);})['then'](function(_0x1f89cb){_0xcf652a(_0x1f89cb);})['catch'](function(_0x4ef1b8){_0x13153c(_0x25d578[_0x1e46('0x15')](0x1f4,_0x4ef1b8['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 9f63bc2..94719a1 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 _0x4f5a=['length','mailAccount:','./mailAccount.events','save','update','register'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x4f5a,0xaa));var _0xa4f5=function(_0x5c2669,_0x3ea086){_0x5c2669=_0x5c2669-0x0;var _0x5c33fa=_0x4f5a[_0x5c2669];return _0x5c33fa;};'use strict';var MailAccountEvents=require(_0xa4f5('0x0'));var events=[_0xa4f5('0x1'),'remove',_0xa4f5('0x2')];function createListener(_0x4aef62,_0x5f4bb4){return function(_0x4802d5){_0x5f4bb4['emit'](_0x4aef62,_0x4802d5);};}function removeListener(_0x230b40,_0x200782){return function(){MailAccountEvents['removeListener'](_0x230b40,_0x200782);};}exports[_0xa4f5('0x3')]=function(_0x5155b6){for(var _0x4effa5=0x0,_0x595188=events[_0xa4f5('0x4')];_0x4effa5<_0x595188;_0x4effa5++){var _0x27b613=events[_0x4effa5];var _0xa92ceb=createListener(_0xa4f5('0x5')+_0x27b613,_0x5155b6);MailAccountEvents['on'](_0x27b613,_0xa92ceb);}}; \ No newline at end of file +var _0xf776=['length','./mailAccount.events','remove','update','emit','removeListener'];(function(_0x4bffb6,_0x15fb8e){var _0x1a44f3=function(_0x47145e){while(--_0x47145e){_0x4bffb6['push'](_0x4bffb6['shift']());}};_0x1a44f3(++_0x15fb8e);}(_0xf776,0x169));var _0x6f77=function(_0x312aaa,_0x5ace19){_0x312aaa=_0x312aaa-0x0;var _0x478545=_0xf776[_0x312aaa];return _0x478545;};'use strict';var MailAccountEvents=require(_0x6f77('0x0'));var events=['save',_0x6f77('0x1'),_0x6f77('0x2')];function createListener(_0x4e3b77,_0x43f2fd){return function(_0x2458e0){_0x43f2fd[_0x6f77('0x3')](_0x4e3b77,_0x2458e0);};}function removeListener(_0x16874b,_0x53ec9b){return function(){MailAccountEvents[_0x6f77('0x4')](_0x16874b,_0x53ec9b);};}exports['register']=function(_0xf62e3e){for(var _0x21909a=0x0,_0x36ffd2=events[_0x6f77('0x5')];_0x21909a<_0x36ffd2;_0x21909a++){var _0x545ba9=events[_0x21909a];var _0x1dd52f=createListener('mailAccount:'+_0x545ba9,_0xf62e3e);MailAccountEvents['on'](_0x545ba9,_0x1dd52f);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 8a04acf..87e7144 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 _0x2ef3=['/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','show','put'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x2ef3,0xba));var _0x32ef=function(_0x180cf7,_0x1310f9){_0x180cf7=_0x180cf7-0x0;var _0x2d0e04=_0x2ef3[_0x180cf7];return _0x2d0e04;};'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')]('/:id',auth['isAuthenticated'](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0xc'),auth[_0x32ef('0xd')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')](_0x32ef('0xc'),auth[_0x32ef('0xd')](),controller[_0x32ef('0x10')]);module[_0x32ef('0x11')]=router; \ No newline at end of file +var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x549dc8,_0x4b83bc){var _0x138e37=function(_0x6bb374){while(--_0x6bb374){_0x549dc8['push'](_0x549dc8['shift']());}};_0x138e37(++_0x4b83bc);}(_0xadb5,0xad));var _0x5adb=function(_0x337a9f,_0x3ec1ed){_0x337a9f=_0x337a9f-0x0;var _0x47685e=_0xadb5[_0x337a9f];return _0x47685e;};'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('./mailApplication.controller');router[_0x5adb('0x7')](_0x5adb('0x8'),auth[_0x5adb('0x9')](),controller[_0x5adb('0xa')]);router[_0x5adb('0xb')](_0x5adb('0x8'),auth[_0x5adb('0x9')](),controller[_0x5adb('0xc')]);router[_0x5adb('0xd')](_0x5adb('0x8'),auth[_0x5adb('0x9')](),controller[_0x5adb('0xe')]);module[_0x5adb('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 04307ca..6a1306d 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 _0x0234=['STRING','*,*,*,*'];(function(_0x29a92f,_0x2a0411){var _0x1c2202=function(_0x18c276){while(--_0x18c276){_0x29a92f['push'](_0x29a92f['shift']());}};_0x1c2202(++_0x2a0411);}(_0x0234,0xfc));var _0x4023=function(_0x648377,_0x368d97){_0x648377=_0x648377-0x0;var _0x32feab=_0x0234[_0x648377];return _0x32feab;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x4023('0x0')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4023('0x0')]},'interval':{'type':Sequelize[_0x4023('0x0')],'defaultValue':_0x4023('0x1')}}; \ No newline at end of file +var _0x72f6=['exports','INTEGER','noop','TEXT','STRING','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x72f6,0x1a9));var _0x672f=function(_0x4f4d86,_0x9a7e3c){_0x4f4d86=_0x4f4d86-0x0;var _0x3fd739=_0x72f6[_0x4f4d86];return _0x3fd739;};'use strict';var Sequelize=require(_0x672f('0x0'));module[_0x672f('0x1')]={'priority':{'type':Sequelize[_0x672f('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x672f('0x3')},'appdata':{'type':Sequelize[_0x672f('0x4')]()},'description':{'type':Sequelize[_0x672f('0x5')]},'interval':{'type':Sequelize[_0x672f('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 0a05eaf..3ba95a3 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 _0xd1be=['catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','save','update','then','error','name','send','params','model','keys','MailApplication','query','filters','intersection','attributes','fields','length','includeAll','options','find'];(function(_0x34ad91,_0x4c0720){var _0x246402=function(_0x293da3){while(--_0x293da3){_0x34ad91['push'](_0x34ad91['shift']());}};_0x246402(++_0x4c0720);}(_0xd1be,0xad));var _0xed1b=function(_0x53210a,_0x4a49f1){_0x53210a=_0x53210a-0x0;var _0x82411c=_0xd1be[_0x53210a];return _0x82411c;};'use strict';var emlformat=require(_0xed1b('0x0'));var rimraf=require(_0xed1b('0x1'));var zipdir=require(_0xed1b('0x2'));var jsonpatch=require(_0xed1b('0x3'));var rp=require(_0xed1b('0x4'));var moment=require(_0xed1b('0x5'));var BPromise=require(_0xed1b('0x6'));var Mustache=require('mustache');var util=require(_0xed1b('0x7'));var path=require(_0xed1b('0x8'));var sox=require(_0xed1b('0x9'));var csv=require(_0xed1b('0xa'));var ejs=require(_0xed1b('0xb'));var fs=require('fs');var fs_extra=require(_0xed1b('0xc'));var _=require(_0xed1b('0xd'));var squel=require('squel');var crypto=require(_0xed1b('0xe'));var jsforce=require(_0xed1b('0xf'));var deskjs=require(_0xed1b('0x10'));var toCsv=require(_0xed1b('0xa'));var querystring=require(_0xed1b('0x11'));var Papa=require('papaparse');var Redis=require(_0xed1b('0x12'));var authService=require(_0xed1b('0x13'));var qs=require(_0xed1b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xed1b('0x15'));var logger=require(_0xed1b('0x16'))(_0xed1b('0x17'));var utils=require(_0xed1b('0x18'));var config=require(_0xed1b('0x19'));var licenseUtil=require(_0xed1b('0x1a'));var db=require(_0xed1b('0x1b'))['db'];function respondWithStatusCode(_0xa35e59,_0x3fea17){_0x3fea17=_0x3fea17||0xcc;return function(_0x35236c){if(_0x35236c){return _0xa35e59[_0xed1b('0x1c')](_0x3fea17);}return _0xa35e59[_0xed1b('0x1d')](_0x3fea17)[_0xed1b('0x1e')]();};}function respondWithResult(_0x2010ae,_0x26e9a1){_0x26e9a1=_0x26e9a1||0xc8;return function(_0xddb30){if(_0xddb30){return _0x2010ae[_0xed1b('0x1d')](_0x26e9a1)[_0xed1b('0x1f')](_0xddb30);}};}function respondWithFilteredResult(_0x66ebfe,_0x2609fd){return function(_0x35f16e){if(_0x35f16e){var _0x4a00f5=_0x35f16e[_0xed1b('0x20')],_0x327f5d=_0x2609fd[_0xed1b('0x21')],_0xecdbb0=_0x2609fd[_0xed1b('0x21')]+_0x2609fd['limit'],_0x17e4d6;if(_0xecdbb0>=_0x4a00f5){_0xecdbb0=_0x4a00f5;_0x17e4d6=0xc8;}else{_0x17e4d6=0xce;}_0x66ebfe['status'](_0x17e4d6);return _0x66ebfe['set'](_0xed1b('0x22'),_0x327f5d+'-'+_0xecdbb0+'/'+_0x4a00f5)[_0xed1b('0x1f')](_0x35f16e);}return null;};}function patchUpdates(_0x19cab3){return function(_0x427ce2){try{jsonpatch[_0xed1b('0x23')](_0x427ce2,_0x19cab3,!![]);}catch(_0x4d9289){return BPromise['reject'](_0x4d9289);}return _0x427ce2[_0xed1b('0x24')]();};}function saveUpdates(_0xc67df9,_0x2bae7c){return function(_0x4c372b){if(_0x4c372b){return _0x4c372b[_0xed1b('0x25')](_0xc67df9)[_0xed1b('0x26')](function(_0x18f702){return _0x18f702;});}return null;};}function removeEntity(_0x5ca2bb,_0x508b5f){return function(_0x458c03){if(_0x458c03){return _0x458c03['destroy']()['then'](function(){_0x5ca2bb['status'](0xcc)[_0xed1b('0x1e')]();});}};}function handleEntityNotFound(_0x43bbdf,_0x29372e){return function(_0xa0b612){if(!_0xa0b612){_0x43bbdf[_0xed1b('0x1c')](0x194);}return _0xa0b612;};}function handleError(_0x111276,_0x12a9ef){_0x12a9ef=_0x12a9ef||0x1f4;return function(_0x4431c0){logger[_0xed1b('0x27')](_0x4431c0['stack']);if(_0x4431c0[_0xed1b('0x28')]){delete _0x4431c0['name'];}_0x111276[_0xed1b('0x1d')](_0x12a9ef)[_0xed1b('0x29')](_0x4431c0);};}exports['show']=function(_0x5df395,_0x2207fe){var _0x39e067={'raw':!![],'where':{'id':_0x5df395[_0xed1b('0x2a')]['id']}},_0x39d5bc={};_0x39d5bc[_0xed1b('0x2b')]=_[_0xed1b('0x2c')](db[_0xed1b('0x2d')]['rawAttributes']);_0x39d5bc[_0xed1b('0x2e')]=_['keys'](_0x5df395['query']);_0x39d5bc[_0xed1b('0x2f')]=_[_0xed1b('0x30')](_0x39d5bc[_0xed1b('0x2b')],_0x39d5bc[_0xed1b('0x2e')]);_0x39e067[_0xed1b('0x31')]=_[_0xed1b('0x30')](_0x39d5bc[_0xed1b('0x2b')],qs['fields'](_0x5df395[_0xed1b('0x2e')][_0xed1b('0x32')]));_0x39e067['attributes']=_0x39e067[_0xed1b('0x31')][_0xed1b('0x33')]?_0x39e067[_0xed1b('0x31')]:_0x39d5bc[_0xed1b('0x2b')];if(_0x5df395[_0xed1b('0x2e')][_0xed1b('0x34')]){_0x39e067['include']=[{'all':!![]}];}_0x39e067=_['merge']({},_0x39e067,_0x5df395[_0xed1b('0x35')]);return db['MailApplication'][_0xed1b('0x36')](_0x39e067)[_0xed1b('0x26')](handleEntityNotFound(_0x2207fe,null))[_0xed1b('0x26')](respondWithResult(_0x2207fe,null))[_0xed1b('0x37')](handleError(_0x2207fe,null));};exports[_0xed1b('0x25')]=function(_0x4bf94b,_0x51500c){if(_0x4bf94b['body']['id']){delete _0x4bf94b[_0xed1b('0x38')]['id'];}return db['MailApplication'][_0xed1b('0x36')]({'where':{'id':_0x4bf94b['params']['id']}})['then'](handleEntityNotFound(_0x51500c,null))['then'](saveUpdates(_0x4bf94b[_0xed1b('0x38')],null))[_0xed1b('0x26')](respondWithResult(_0x51500c,null))[_0xed1b('0x37')](handleError(_0x51500c,null));};exports['destroy']=function(_0xbfdd6b,_0x4a370d){return db[_0xed1b('0x2d')][_0xed1b('0x36')]({'where':{'id':_0xbfdd6b[_0xed1b('0x2a')]['id']}})['then'](handleEntityNotFound(_0x4a370d,null))['then'](removeEntity(_0x4a370d,null))[_0xed1b('0x37')](handleError(_0x4a370d,null));}; \ No newline at end of file +var _0x4d29=['request-promise','moment','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','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','save','then','error','stack','name','send','show','params','model','MailApplication','rawAttributes','query','keys','filters','attributes','intersection','fields','length','includeAll','include','merge','options','update','body','find','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4d29,0xf0));var _0x94d2=function(_0x23ca0e,_0x5e44ca){_0x23ca0e=_0x23ca0e-0x0;var _0x3fa464=_0x4d29[_0x23ca0e];return _0x3fa464;};'use strict';var emlformat=require(_0x94d2('0x0'));var rimraf=require(_0x94d2('0x1'));var zipdir=require(_0x94d2('0x2'));var jsonpatch=require(_0x94d2('0x3'));var rp=require(_0x94d2('0x4'));var moment=require(_0x94d2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x94d2('0x6'));var path=require(_0x94d2('0x7'));var sox=require(_0x94d2('0x8'));var csv=require(_0x94d2('0x9'));var ejs=require(_0x94d2('0xa'));var fs=require('fs');var fs_extra=require(_0x94d2('0xb'));var _=require(_0x94d2('0xc'));var squel=require(_0x94d2('0xd'));var crypto=require(_0x94d2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x94d2('0xf'));var toCsv=require(_0x94d2('0x9'));var querystring=require(_0x94d2('0x10'));var Papa=require(_0x94d2('0x11'));var Redis=require(_0x94d2('0x12'));var authService=require(_0x94d2('0x13'));var qs=require(_0x94d2('0x14'));var as=require(_0x94d2('0x15'));var hardwareService=require(_0x94d2('0x16'));var logger=require(_0x94d2('0x17'))('api');var utils=require(_0x94d2('0x18'));var config=require(_0x94d2('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48a967,_0x280d43){_0x280d43=_0x280d43||0xcc;return function(_0x1b333e){if(_0x1b333e){return _0x48a967[_0x94d2('0x1a')](_0x280d43);}return _0x48a967[_0x94d2('0x1b')](_0x280d43)[_0x94d2('0x1c')]();};}function respondWithResult(_0x5c6b4e,_0x13f8bf){_0x13f8bf=_0x13f8bf||0xc8;return function(_0x5a2e0a){if(_0x5a2e0a){return _0x5c6b4e['status'](_0x13f8bf)[_0x94d2('0x1d')](_0x5a2e0a);}};}function respondWithFilteredResult(_0x254f8e,_0x21e8f5){return function(_0x155935){if(_0x155935){var _0x4aaf2c=_0x155935[_0x94d2('0x1e')],_0x361b2d=_0x21e8f5[_0x94d2('0x1f')],_0x48d251=_0x21e8f5[_0x94d2('0x1f')]+_0x21e8f5['limit'],_0x3af146;if(_0x48d251>=_0x4aaf2c){_0x48d251=_0x4aaf2c;_0x3af146=0xc8;}else{_0x3af146=0xce;}_0x254f8e['status'](_0x3af146);return _0x254f8e[_0x94d2('0x20')](_0x94d2('0x21'),_0x361b2d+'-'+_0x48d251+'/'+_0x4aaf2c)[_0x94d2('0x1d')](_0x155935);}return null;};}function patchUpdates(_0x51215e){return function(_0x33f136){try{jsonpatch['apply'](_0x33f136,_0x51215e,!![]);}catch(_0x1a23d7){return BPromise['reject'](_0x1a23d7);}return _0x33f136[_0x94d2('0x22')]();};}function saveUpdates(_0x3ba44c,_0x14ceb7){return function(_0xa2b49d){if(_0xa2b49d){return _0xa2b49d['update'](_0x3ba44c)[_0x94d2('0x23')](function(_0x5bbf4c){return _0x5bbf4c;});}return null;};}function removeEntity(_0x2bfad0,_0x5022d9){return function(_0x3000f8){if(_0x3000f8){return _0x3000f8['destroy']()[_0x94d2('0x23')](function(){_0x2bfad0[_0x94d2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20f49d,_0x398792){return function(_0x552e13){if(!_0x552e13){_0x20f49d[_0x94d2('0x1a')](0x194);}return _0x552e13;};}function handleError(_0xbd552c,_0x542010){_0x542010=_0x542010||0x1f4;return function(_0x4dc0dd){logger[_0x94d2('0x24')](_0x4dc0dd[_0x94d2('0x25')]);if(_0x4dc0dd[_0x94d2('0x26')]){delete _0x4dc0dd[_0x94d2('0x26')];}_0xbd552c[_0x94d2('0x1b')](_0x542010)[_0x94d2('0x27')](_0x4dc0dd);};}exports[_0x94d2('0x28')]=function(_0x8d242f,_0x42cd8a){var _0x83dba8={'raw':!![],'where':{'id':_0x8d242f[_0x94d2('0x29')]['id']}},_0x517712={};_0x517712[_0x94d2('0x2a')]=_['keys'](db[_0x94d2('0x2b')][_0x94d2('0x2c')]);_0x517712[_0x94d2('0x2d')]=_[_0x94d2('0x2e')](_0x8d242f[_0x94d2('0x2d')]);_0x517712[_0x94d2('0x2f')]=_['intersection'](_0x517712['model'],_0x517712[_0x94d2('0x2d')]);_0x83dba8[_0x94d2('0x30')]=_[_0x94d2('0x31')](_0x517712[_0x94d2('0x2a')],qs[_0x94d2('0x32')](_0x8d242f[_0x94d2('0x2d')][_0x94d2('0x32')]));_0x83dba8[_0x94d2('0x30')]=_0x83dba8['attributes'][_0x94d2('0x33')]?_0x83dba8[_0x94d2('0x30')]:_0x517712[_0x94d2('0x2a')];if(_0x8d242f[_0x94d2('0x2d')][_0x94d2('0x34')]){_0x83dba8[_0x94d2('0x35')]=[{'all':!![]}];}_0x83dba8=_[_0x94d2('0x36')]({},_0x83dba8,_0x8d242f[_0x94d2('0x37')]);return db['MailApplication']['find'](_0x83dba8)['then'](handleEntityNotFound(_0x42cd8a,null))[_0x94d2('0x23')](respondWithResult(_0x42cd8a,null))['catch'](handleError(_0x42cd8a,null));};exports[_0x94d2('0x38')]=function(_0x2ca335,_0x346fe2){if(_0x2ca335[_0x94d2('0x39')]['id']){delete _0x2ca335[_0x94d2('0x39')]['id'];}return db['MailApplication'][_0x94d2('0x3a')]({'where':{'id':_0x2ca335[_0x94d2('0x29')]['id']}})[_0x94d2('0x23')](handleEntityNotFound(_0x346fe2,null))[_0x94d2('0x23')](saveUpdates(_0x2ca335['body'],null))['then'](respondWithResult(_0x346fe2,null))[_0x94d2('0x3b')](handleError(_0x346fe2,null));};exports[_0x94d2('0x3c')]=function(_0x4e1932,_0x1f7b41){return db[_0x94d2('0x2b')]['find']({'where':{'id':_0x4e1932[_0x94d2('0x29')]['id']}})[_0x94d2('0x23')](handleEntityNotFound(_0x1f7b41,null))[_0x94d2('0x23')](removeEntity(_0x1f7b41,null))['catch'](handleError(_0x1f7b41,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 184e04d..5b867d7 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 _0x1b0e=['rimraf','../../config/environment','exports','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xec74fe,_0x2dce88){var _0x50bda2=function(_0x538a6d){while(--_0x538a6d){_0xec74fe['push'](_0xec74fe['shift']());}};_0x50bda2(++_0x2dce88);}(_0x1b0e,0x132));var _0xe1b0=function(_0x3c7269,_0xa3eec3){_0x3c7269=_0x3c7269-0x0;var _0x14152c=_0x1b0e[_0x3c7269];return _0x14152c;};'use strict';var _=require(_0xe1b0('0x0'));var util=require(_0xe1b0('0x1'));var logger=require(_0xe1b0('0x2'))(_0xe1b0('0x3'));var moment=require(_0xe1b0('0x4'));var BPromise=require(_0xe1b0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe1b0('0x6'));var config=require(_0xe1b0('0x7'));var attributes=require('./mailApplication.attributes');module[_0xe1b0('0x8')]=function(_0x2a049f,_0xfb57ae){return _0x2a049f['define'](_0xe1b0('0x9'),attributes,{'tableName':_0xe1b0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe1b0('0xb')});}; \ No newline at end of file +var _0x0c19=['define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x13a6d8,_0x6189c){var _0x176743=function(_0x9a7fff){while(--_0x9a7fff){_0x13a6d8['push'](_0x13a6d8['shift']());}};_0x176743(++_0x6189c);}(_0x0c19,0xf5));var _0x90c1=function(_0x5c903c,_0x6d824b){_0x5c903c=_0x5c903c-0x0;var _0x5dee1b=_0x0c19[_0x5c903c];return _0x5dee1b;};'use strict';var _=require(_0x90c1('0x0'));var util=require(_0x90c1('0x1'));var logger=require(_0x90c1('0x2'))(_0x90c1('0x3'));var moment=require(_0x90c1('0x4'));var BPromise=require(_0x90c1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x90c1('0x6'));var rimraf=require(_0x90c1('0x7'));var config=require(_0x90c1('0x8'));var attributes=require('./mailApplication.attributes');module[_0x90c1('0x9')]=function(_0xb605b6,_0x5434a1){return _0xb605b6[_0x90c1('0xa')](_0x90c1('0xb'),attributes,{'tableName':_0x90c1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x90c1('0xd'),'collate':_0x90c1('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index bd5001b..a779025 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 _0x2c37=['UpdateMailApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailApplication','update','body','options','raw','where','limit','then'];(function(_0x1bda37,_0x2f4799){var _0x15fa7f=function(_0x4b0b96){while(--_0x4b0b96){_0x1bda37['push'](_0x1bda37['shift']());}};_0x15fa7f(++_0x2f4799);}(_0x2c37,0x1cf));var _0x72c3=function(_0x232d98,_0x562367){_0x232d98=_0x232d98-0x0;var _0x3ebead=_0x2c37[_0x232d98];return _0x3ebead;};'use strict';var _=require(_0x72c3('0x0'));var util=require(_0x72c3('0x1'));var moment=require(_0x72c3('0x2'));var BPromise=require(_0x72c3('0x3'));var rs=require(_0x72c3('0x4'));var fs=require('fs');var Redis=require(_0x72c3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x72c3('0x6'));var logger=require(_0x72c3('0x7'))(_0x72c3('0x8'));var config=require(_0x72c3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x72c3('0xa')][_0x72c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50bc1c,_0x28ad06,_0x3c8290){return new BPromise(function(_0xc76ff9,_0x7e74ce){return client[_0x72c3('0xc')](_0x50bc1c,_0x3c8290)['then'](function(_0x595e5f){logger[_0x72c3('0xd')](_0x72c3('0xe'),_0x28ad06,_0x72c3('0xf'));logger[_0x72c3('0x10')](_0x72c3('0x11'),_0x28ad06,_0x72c3('0xf'),JSON[_0x72c3('0x12')](_0x595e5f));if(_0x595e5f[_0x72c3('0x13')]){if(_0x595e5f[_0x72c3('0x13')][_0x72c3('0x14')]===0x1f4){logger['error'](_0x72c3('0xe'),_0x28ad06,_0x595e5f[_0x72c3('0x13')][_0x72c3('0x15')]);return _0x7e74ce(_0x595e5f[_0x72c3('0x13')][_0x72c3('0x15')]);}logger[_0x72c3('0x13')]('MailApplication,\x20%s,\x20%s',_0x28ad06,_0x595e5f[_0x72c3('0x13')][_0x72c3('0x15')]);return _0xc76ff9(_0x595e5f[_0x72c3('0x13')][_0x72c3('0x15')]);}else{logger[_0x72c3('0xd')](_0x72c3('0xe'),_0x28ad06,_0x72c3('0xf'));_0xc76ff9(_0x595e5f[_0x72c3('0x16')]['message']);}})[_0x72c3('0x17')](function(_0x129236){logger[_0x72c3('0x13')](_0x72c3('0xe'),_0x28ad06,_0x129236);_0x7e74ce(_0x129236);});});}exports['UpdateMailApplication']=function(_0x42d862){var _0x583d89=this;return new Promise(function(_0x2470b4,_0x2fc590){return db[_0x72c3('0x18')][_0x72c3('0x19')](_0x42d862[_0x72c3('0x1a')],{'raw':_0x42d862[_0x72c3('0x1b')]?_0x42d862[_0x72c3('0x1b')][_0x72c3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42d862['options']?_0x42d862['options'][_0x72c3('0x1d')]||null:null,'attributes':_0x42d862[_0x72c3('0x1b')]?_0x42d862['options']['attributes']||null:null,'limit':_0x42d862[_0x72c3('0x1b')]?_0x42d862[_0x72c3('0x1b')][_0x72c3('0x1e')]||null:null})[_0x72c3('0x1f')](function(_0x648cab){logger['info'](_0x72c3('0x20'),_0x42d862);logger[_0x72c3('0x10')](_0x72c3('0x20'),_0x42d862,JSON[_0x72c3('0x12')](_0x648cab));_0x2470b4(_0x648cab);})['catch'](function(_0x2d50d0){logger[_0x72c3('0x13')](_0x72c3('0x20'),_0x2d50d0['message'],_0x42d862);_0x2fc590(_0x583d89[_0x72c3('0x13')](0x1f4,_0x2d50d0[_0x72c3('0x15')]));});});}; \ No newline at end of file +var _0xb21a=['MailApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','update','body','options','raw','attributes','UpdateMailApplication','debug','util','randomstring','../../mysqldb','../../config/environment','http','request','then','info'];(function(_0x45fe69,_0x586cab){var _0x58399b=function(_0x2cf26d){while(--_0x2cf26d){_0x45fe69['push'](_0x45fe69['shift']());}};_0x58399b(++_0x586cab);}(_0xb21a,0xa8));var _0xab21=function(_0x50a3c4,_0x3772da){_0x50a3c4=_0x50a3c4-0x0;var _0x449ec1=_0xb21a[_0x50a3c4];return _0x449ec1;};'use strict';var _=require('lodash');var util=require(_0xab21('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xab21('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab21('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xab21('0x3'));var jayson=require('jayson/promise');var client=jayson['client'][_0xab21('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x3998e0,_0x20bd68,_0x1be3dc){return new BPromise(function(_0x20c1ff,_0x32e9b3){return client[_0xab21('0x5')](_0x3998e0,_0x1be3dc)[_0xab21('0x6')](function(_0xb8822a){logger[_0xab21('0x7')](_0xab21('0x8'),_0x20bd68,'request\x20sent');logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x20bd68,_0xab21('0x9'),JSON[_0xab21('0xa')](_0xb8822a));if(_0xb8822a[_0xab21('0xb')]){if(_0xb8822a['error'][_0xab21('0xc')]===0x1f4){logger[_0xab21('0xb')](_0xab21('0x8'),_0x20bd68,_0xb8822a[_0xab21('0xb')][_0xab21('0xd')]);return _0x32e9b3(_0xb8822a['error'][_0xab21('0xd')]);}logger[_0xab21('0xb')]('MailApplication,\x20%s,\x20%s',_0x20bd68,_0xb8822a[_0xab21('0xb')]['message']);return _0x20c1ff(_0xb8822a[_0xab21('0xb')][_0xab21('0xd')]);}else{logger['info'](_0xab21('0x8'),_0x20bd68,_0xab21('0x9'));_0x20c1ff(_0xb8822a['result'][_0xab21('0xd')]);}})[_0xab21('0xe')](function(_0x1bb233){logger[_0xab21('0xb')](_0xab21('0x8'),_0x20bd68,_0x1bb233);_0x32e9b3(_0x1bb233);});});}exports['UpdateMailApplication']=function(_0x3fac3f){var _0xf67549=this;return new Promise(function(_0x228fd7,_0x1e2869){return db['MailApplication'][_0xab21('0xf')](_0x3fac3f[_0xab21('0x10')],{'raw':_0x3fac3f[_0xab21('0x11')]?_0x3fac3f['options'][_0xab21('0x12')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fac3f[_0xab21('0x11')]?_0x3fac3f[_0xab21('0x11')]['where']||null:null,'attributes':_0x3fac3f[_0xab21('0x11')]?_0x3fac3f['options'][_0xab21('0x13')]||null:null,'limit':_0x3fac3f[_0xab21('0x11')]?_0x3fac3f[_0xab21('0x11')]['limit']||null:null})['then'](function(_0x81c927){logger['info'](_0xab21('0x14'),_0x3fac3f);logger[_0xab21('0x15')]('UpdateMailApplication',_0x3fac3f,JSON[_0xab21('0xa')](_0x81c927));_0x228fd7(_0x81c927);})[_0xab21('0xe')](function(_0x52ed4f){logger[_0xab21('0xb')](_0xab21('0x14'),_0x52ed4f['message'],_0x3fac3f);_0x1e2869(_0xf67549[_0xab21('0xb')](0x1f4,_0x52ed4f[_0xab21('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index c802909..1b014ef 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 _0x34de=['update','delete','destroy','removeTags','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','/:id/tags','mail','mailinteraction:addtags','addTags','put','tracked'];(function(_0x167914,_0x87b5a){var _0x5e5d79=function(_0x221d4e){while(--_0x221d4e){_0x167914['push'](_0x167914['shift']());}};_0x5e5d79(++_0x87b5a);}(_0x34de,0xad));var _0xe34d=function(_0x2d9bca,_0x54fe57){_0x2d9bca=_0x2d9bca-0x0;var _0x33cae7=_0x34de[_0x2d9bca];return _0x33cae7;};'use strict';var multer=require('multer');var util=require(_0xe34d('0x0'));var path=require('path');var timeout=require(_0xe34d('0x1'));var express=require(_0xe34d('0x2'));var router=express[_0xe34d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe34d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe34d('0x5'));var controller=require('./mailInteraction.controller');router[_0xe34d('0x6')]('/',auth[_0xe34d('0x7')](),controller[_0xe34d('0x8')]);router[_0xe34d('0x6')](_0xe34d('0x9'),auth[_0xe34d('0x7')](),controller['describe']);router[_0xe34d('0x6')](_0xe34d('0xa'),auth[_0xe34d('0x7')](),controller[_0xe34d('0xb')]);router[_0xe34d('0x6')](_0xe34d('0xc'),auth['isAuthenticated'](),controller[_0xe34d('0xd')]);router[_0xe34d('0x6')](_0xe34d('0xe'),auth[_0xe34d('0x7')](),controller[_0xe34d('0xf')]);router[_0xe34d('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe34d('0x10')](_0xe34d('0xc'),auth[_0xe34d('0x7')](),controller['addMessage']);router[_0xe34d('0x10')](_0xe34d('0x11'),auth[_0xe34d('0x7')](),interaction['tracked'](_0xe34d('0x12'),_0xe34d('0x13')),controller[_0xe34d('0x14')]);router[_0xe34d('0x15')](_0xe34d('0xa'),auth[_0xe34d('0x7')](),interaction[_0xe34d('0x16')]('mail','mailinteraction:update'),controller[_0xe34d('0x17')]);router[_0xe34d('0x18')](_0xe34d('0xa'),auth[_0xe34d('0x7')](),interaction[_0xe34d('0x16')]('mail','mailinteraction:destroy'),controller[_0xe34d('0x19')]);router[_0xe34d('0x18')](_0xe34d('0x11'),auth['isAuthenticated'](),controller[_0xe34d('0x1a')]);module[_0xe34d('0x1b')]=router; \ No newline at end of file +var _0xf7de=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','mailinteraction:addtags','put','mail','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','Router'];(function(_0x265928,_0x222b2d){var _0x2b8caa=function(_0x3769df){while(--_0x3769df){_0x265928['push'](_0x265928['shift']());}};_0x2b8caa(++_0x222b2d);}(_0xf7de,0x14e));var _0xef7d=function(_0x44a2aa,_0x51d352){_0x44a2aa=_0x44a2aa-0x0;var _0x4735ab=_0xf7de[_0x44a2aa];return _0x4735ab;};'use strict';var multer=require(_0xef7d('0x0'));var util=require(_0xef7d('0x1'));var path=require(_0xef7d('0x2'));var timeout=require(_0xef7d('0x3'));var express=require(_0xef7d('0x4'));var router=express[_0xef7d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xef7d('0x6'));var interaction=require(_0xef7d('0x7'));var config=require(_0xef7d('0x8'));var controller=require(_0xef7d('0x9'));router[_0xef7d('0xa')]('/',auth[_0xef7d('0xb')](),controller[_0xef7d('0xc')]);router[_0xef7d('0xa')](_0xef7d('0xd'),auth[_0xef7d('0xb')](),controller[_0xef7d('0xe')]);router['get'](_0xef7d('0xf'),auth[_0xef7d('0xb')](),controller[_0xef7d('0x10')]);router[_0xef7d('0xa')](_0xef7d('0x11'),auth[_0xef7d('0xb')](),controller[_0xef7d('0x12')]);router[_0xef7d('0xa')]('/:id/download',auth[_0xef7d('0xb')](),controller[_0xef7d('0x13')]);router[_0xef7d('0x14')]('/',auth[_0xef7d('0xb')](),controller[_0xef7d('0x15')]);router['post'](_0xef7d('0x11'),auth[_0xef7d('0xb')](),controller[_0xef7d('0x16')]);router[_0xef7d('0x14')](_0xef7d('0x17'),auth['isAuthenticated'](),interaction[_0xef7d('0x18')]('mail',_0xef7d('0x19')),controller['addTags']);router[_0xef7d('0x1a')](_0xef7d('0xf'),auth[_0xef7d('0xb')](),interaction[_0xef7d('0x18')](_0xef7d('0x1b'),_0xef7d('0x1c')),controller[_0xef7d('0x1d')]);router[_0xef7d('0x1e')]('/:id',auth[_0xef7d('0xb')](),interaction[_0xef7d('0x18')](_0xef7d('0x1b'),_0xef7d('0x1f')),controller[_0xef7d('0x20')]);router[_0xef7d('0x1e')]('/:id/tags',auth['isAuthenticated'](),controller[_0xef7d('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index ee6f129..b4ed8eb 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 _0xe172=['TEXT','ENUM','out','sequelize','iconv','BOOLEAN','DATE','STRING'];(function(_0x47bb2e,_0x51c499){var _0x4d38b4=function(_0x49cfc3){while(--_0x49cfc3){_0x47bb2e['push'](_0x47bb2e['shift']());}};_0x4d38b4(++_0x51c499);}(_0xe172,0x1bb));var _0x2e17=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xe172[_0x5cb1af];return _0x8d7940;};'use strict';var Sequelize=require(_0x2e17('0x0'));var iconv=require(_0x2e17('0x1'));module['exports']={'closed':{'type':Sequelize[_0x2e17('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2e17('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2e17('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2e17('0x4')]},'inReplyTo':{'type':Sequelize[_0x2e17('0x4')](0x1fe)},'to':{'type':Sequelize[_0x2e17('0x4')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x2e17('0x5')]()},'attach':{'type':Sequelize[_0x2e17('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x2e17('0x3')]},'substatus':{'type':Sequelize[_0x2e17('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x2e17('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x2e17('0x6')]('in',_0x2e17('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2e17('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x2e17('0x6')]('in',_0x2e17('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xe742=['TEXT','DATE','out','ENUM','sequelize','exports','STRING','long'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xe742,0xa4));var _0x2e74=function(_0x4ce96c,_0x24dd25){_0x4ce96c=_0x4ce96c-0x0;var _0x168309=_0xe742[_0x4ce96c];return _0x168309;};'use strict';var Sequelize=require(_0x2e74('0x0'));var iconv=require('iconv');module[_0x2e74('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2e74('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2e74('0x2')]},'note':{'type':Sequelize[_0x2e74('0x2')]},'inReplyTo':{'type':Sequelize[_0x2e74('0x2')](0x1fe)},'to':{'type':Sequelize[_0x2e74('0x2')]},'cc':{'type':Sequelize['TEXT'](_0x2e74('0x3'))},'subject':{'type':Sequelize[_0x2e74('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x2e74('0x5')]},'substatus':{'type':Sequelize[_0x2e74('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0x2e74('0x5')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x2e74('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2e74('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x2e74('0x7')]('in',_0x2e74('0x6')),'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 62ad731..7ba54b0 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 _0x2454=['fields','attributes','length','sort','where','pick','select','field','color','from','tools_tags','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','mail_messages','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','expr','search','sqlOperator','conditions','find','value','`\x20=\x200','having','`\x20>\x200','Contact','$substring','getFullTextValue','ContactId','buildExpression','text','start','Tag','User','operator','UserId','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','unreadMessages','order','contactName','DESC','t.id\x20IN\x20?','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.secondDisposition','i.thirdDisposition','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','MailInteractionId','Setting','all','rows','includeAll','include','options','create','body','params','describe','addMessage','ids','omit','getMessages','filters','nolimit','$gte','format','addTags','setTags','spread','findAll','emit','mailInteractionTags:save','removeTags','download','join','tmp','root','files','attachments','transcript-%d-%s.zip','Attachment','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','Attachments','existsSync','readFileSync','build','writeFileSync','message%d.eml','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','fullname','TagIds','Tags','split','forEach','push','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','MailInteraction','rawAttributes','type','key','model','query','keys','intersection'];(function(_0x9e108a,_0x592e87){var _0x2c7d87=function(_0x4b54f2){while(--_0x4b54f2){_0x9e108a['push'](_0x9e108a['shift']());}};_0x2c7d87(++_0x592e87);}(_0x2454,0x19a));var _0x4245=function(_0x505dec,_0x5a69e4){_0x505dec=_0x505dec-0x0;var _0x182135=_0x2454[_0x505dec];return _0x182135;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4245('0x0'));var zipdir=require(_0x4245('0x1'));var jsonpatch=require(_0x4245('0x2'));var rp=require(_0x4245('0x3'));var moment=require(_0x4245('0x4'));var BPromise=require(_0x4245('0x5'));var Mustache=require(_0x4245('0x6'));var util=require(_0x4245('0x7'));var path=require(_0x4245('0x8'));var sox=require(_0x4245('0x9'));var csv=require(_0x4245('0xa'));var ejs=require(_0x4245('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4245('0xc'));var squel=require('squel');var crypto=require(_0x4245('0xd'));var jsforce=require(_0x4245('0xe'));var deskjs=require(_0x4245('0xf'));var toCsv=require(_0x4245('0xa'));var querystring=require(_0x4245('0x10'));var Papa=require(_0x4245('0x11'));var htmlToText=require('html-to-text');var juice=require(_0x4245('0x12'));var Redis=require(_0x4245('0x13'));var authService=require(_0x4245('0x14'));var qs=require(_0x4245('0x15'));var as=require(_0x4245('0x16'));var hardwareService=require(_0x4245('0x17'));var logger=require(_0x4245('0x18'))(_0x4245('0x19'));var utils=require(_0x4245('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x4245('0x1b'));var db=require(_0x4245('0x1c'))['db'];config[_0x4245('0x1d')]=_[_0x4245('0x1e')](config['redis'],{'host':_0x4245('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4245('0x1d')]));require(_0x4245('0x20'))[_0x4245('0x21')](socket);function respondWithStatusCode(_0x9b5622,_0x5ee7ee){_0x5ee7ee=_0x5ee7ee||0xcc;return function(_0x2b58fb){if(_0x2b58fb){return _0x9b5622[_0x4245('0x22')](_0x5ee7ee);}return _0x9b5622[_0x4245('0x23')](_0x5ee7ee)[_0x4245('0x24')]();};}function respondWithResult(_0x4b5b30,_0x38f593){_0x38f593=_0x38f593||0xc8;return function(_0x43fe20){if(_0x43fe20){return _0x4b5b30[_0x4245('0x23')](_0x38f593)[_0x4245('0x25')](_0x43fe20);}};}function respondWithFilteredResult(_0x28723a,_0xff1bf7){return function(_0x10902e){if(_0x10902e){var _0xe06815=_0x10902e[_0x4245('0x26')],_0x412b53=_0xff1bf7[_0x4245('0x27')],_0x2c54cf=_0xff1bf7[_0x4245('0x27')]+_0xff1bf7[_0x4245('0x28')],_0x386fe5;if(_0x2c54cf>=_0xe06815){_0x2c54cf=_0xe06815;_0x386fe5=0xc8;}else{_0x386fe5=0xce;}_0x28723a[_0x4245('0x23')](_0x386fe5);return _0x28723a[_0x4245('0x29')](_0x4245('0x2a'),_0x412b53+'-'+_0x2c54cf+'/'+_0xe06815)[_0x4245('0x25')](_0x10902e);}return null;};}function patchUpdates(_0x3d1436){return function(_0x6c0706){try{jsonpatch[_0x4245('0x2b')](_0x6c0706,_0x3d1436,!![]);}catch(_0x2dbb64){return BPromise[_0x4245('0x2c')](_0x2dbb64);}return _0x6c0706[_0x4245('0x2d')]();};}function saveUpdates(_0x3a74d5,_0x2891bf){return function(_0x385af2){if(_0x385af2){return _0x385af2[_0x4245('0x2e')](_0x3a74d5)['then'](function(_0x364b1c){return _0x364b1c;});}return null;};}function removeEntity(_0x1617fb,_0x8205c0){return function(_0x5eb078){if(_0x5eb078){return _0x5eb078[_0x4245('0x2f')]()[_0x4245('0x30')](function(){_0x1617fb[_0x4245('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e45c3,_0x3cd2be){return function(_0x4f86f1){if(!_0x4f86f1){_0x5e45c3[_0x4245('0x22')](0x194);}return _0x4f86f1;};}function handleError(_0xca3a04,_0x47f203){_0x47f203=_0x47f203||0x1f4;return function(_0x5e0600){logger[_0x4245('0x31')](_0x5e0600[_0x4245('0x32')]);if(_0x5e0600[_0x4245('0x33')]){delete _0x5e0600[_0x4245('0x33')];}_0xca3a04[_0x4245('0x23')](_0x47f203)[_0x4245('0x34')](_0x5e0600);};}function getInteractionUsers(_0x35b2e1,_0x46f164){return new BPromise(function(_0x12d1c7,_0xd805e8){try{if(_0x46f164[_0x35b2e1['id']]){_0x35b2e1['Users']=_[_0x4245('0x35')](_0x46f164[_0x35b2e1['id']],function(_0x3cb29d){return{'id':_0x3cb29d['id'],'fullname':_0x3cb29d[_0x4245('0x36')]};});}}catch(_0x6e6850){_0xd805e8(_0x6e6850);}_0x12d1c7(_0x35b2e1);});}function getInteractionTags(_0x14a03f,_0x2e0135){return new BPromise(function(_0x23b5e2,_0x53ba67){try{if(_0x14a03f[_0x4245('0x37')]){_0x14a03f[_0x4245('0x38')]=[];_0x14a03f[_0x4245('0x37')][_0x4245('0x39')](',')[_0x4245('0x3a')](function(_0x1fcbb3){_0x14a03f['Tags'][_0x4245('0x3b')](_0x2e0135[_0x1fcbb3]);});}delete _0x14a03f['TagIds'];}catch(_0x5e9c4e){_0x53ba67(_0x5e9c4e);}_0x23b5e2(_0x14a03f);});}function getLastMessageText(_0x5c3a36){return new BPromise(function(_0x1fa1a0,_0x53997e){return db[_0x4245('0x3c')][_0x4245('0x3d')]({'where':{'$and':[{'MailInteractionId':_0x5c3a36['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x4245('0x3e')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x4245('0x3f')],'order':_0x4245('0x40'),'raw':!![]})['then'](function(_0x3d2e28){if(_0x3d2e28&&_0x3d2e28[_0x4245('0x3f')]){_0x5c3a36[_0x4245('0x41')]=_[_0x4245('0x42')](_0x3d2e28['plainBody']);}_0x1fa1a0(_0x5c3a36);})[_0x4245('0x43')](function(_0x257c44){_0x53997e(_0x257c44);});});}function updateMailInteraction(_0x31f1cc,_0x3aac44,_0x35d3ee,_0x3d5879){return new BPromise(function(_0xbde070,_0xd20af3){return getInteractionUsers(_0x31f1cc,_0x35d3ee)[_0x4245('0x30')](function(_0x1244c0){return getInteractionTags(_0x1244c0,_0x3aac44);})[_0x4245('0x30')](function(_0x13cbbe){if(_0x3d5879){_0xbde070(getLastMessageText(_0x13cbbe));}else{_0xbde070(_0x13cbbe);}})[_0x4245('0x43')](function(_0x6e6500){_0xd20af3(_0x6e6500);});});}exports['index']=function(_0x40d003,_0x7e4424){var _0x47e50d={},_0x54d084={},_0x22fef5={'count':0x0,'rows':[]};var _0x5eaef8=_[_0x4245('0x35')](db[_0x4245('0x44')][_0x4245('0x45')],function(_0x48cb71){return{'name':_0x48cb71['fieldName'],'type':_0x48cb71[_0x4245('0x46')][_0x4245('0x47')]};});_0x54d084[_0x4245('0x48')]=_[_0x4245('0x35')](_0x5eaef8,'name');_0x54d084[_0x4245('0x49')]=_[_0x4245('0x4a')](_0x40d003[_0x4245('0x49')]);_0x54d084['filters']=_[_0x4245('0x4b')](_0x54d084[_0x4245('0x48')],_0x54d084['query']);_0x47e50d['attributes']=_[_0x4245('0x4b')](_0x54d084[_0x4245('0x48')],qs[_0x4245('0x4c')](_0x40d003[_0x4245('0x49')][_0x4245('0x4c')]));_0x47e50d[_0x4245('0x4d')]=_0x47e50d[_0x4245('0x4d')][_0x4245('0x4e')]?_0x47e50d[_0x4245('0x4d')]:_0x54d084[_0x4245('0x48')];if(!_0x40d003[_0x4245('0x49')]['hasOwnProperty']('nolimit')){_0x47e50d[_0x4245('0x28')]=qs['limit'](_0x40d003[_0x4245('0x49')][_0x4245('0x28')]);_0x47e50d[_0x4245('0x27')]=qs[_0x4245('0x27')](_0x40d003['query'][_0x4245('0x27')]);}_0x47e50d['order']=qs[_0x4245('0x4f')](_0x40d003[_0x4245('0x49')][_0x4245('0x4f')]);_0x47e50d[_0x4245('0x50')]=qs['filters'](_[_0x4245('0x51')](_0x40d003[_0x4245('0x49')],_0x54d084['filters']),_0x5eaef8);var _0xe4cd68=[];var _0x577a85=squel[_0x4245('0x52')]()[_0x4245('0x53')]('id')[_0x4245('0x53')]('name')[_0x4245('0x53')](_0x4245('0x54'))[_0x4245('0x55')](_0x4245('0x56'));var _0x2bffb7=squel[_0x4245('0x52')]()[_0x4245('0x53')](_0x4245('0x57'))[_0x4245('0x53')](_0x4245('0x58'))[_0x4245('0x53')](_0x4245('0x59'))[_0x4245('0x55')]('user_has_mail_interactions','ui')[_0x4245('0x5a')](_0x4245('0x5b'),'u',_0x4245('0x5c'));var _0x4629b6=squel[_0x4245('0x52')]()[_0x4245('0x55')](_0x4245('0x5d'),'i')[_0x4245('0x5a')]('cm_contacts','c',_0x4245('0x5e'))['left_join'](_0x4245('0x5b'),'o',_0x4245('0x5f'))[_0x4245('0x5a')](_0x4245('0x60'),'a',_0x4245('0x61'))['left_join'](_0x4245('0x62'),'me','me.MailInteractionId\x20=\x20i.id')[_0x4245('0x5a')](_0x4245('0x63'),'it',_0x4245('0x64'))[_0x4245('0x5a')](_0x4245('0x56'),'t','t.id\x20=\x20it.TagId');var _0x25af2d=squel['expr']();var _0x45cb9e=[];var _0xe306e5=squel[_0x4245('0x65')]();var _0x21875;if(_0x40d003[_0x4245('0x49')][_0x4245('0x66')]){_0x21875=as['parseSearch'](_0x40d003[_0x4245('0x49')][_0x4245('0x66')]);var _0x5e60f5=_0x21875[_0x4245('0x67')];for(var _0x4eadf8=0x0;_0x4eadf8<_0x21875[_0x4245('0x68')][_0x4245('0x4e')];_0x4eadf8++){var _0x3a7b54=_0x21875[_0x4245('0x68')][_0x4eadf8];var _0x4d3bbd='i';var _0x8e44e7=_[_0x4245('0x69')](_0x5eaef8,[_0x4245('0x33'),_0x3a7b54[_0x4245('0x53')]]);if(!_0x8e44e7){switch(_0x3a7b54[_0x4245('0x53')]){case'unreadMessages':if(_0x3a7b54[_0x4245('0x6a')]==0x1){_0x4629b6['having']('`'+_0x3a7b54[_0x4245('0x53')]+_0x4245('0x6b'));}else{_0x4629b6[_0x4245('0x6c')]('`'+_0x3a7b54[_0x4245('0x53')]+_0x4245('0x6d'));}break;case _0x4245('0x6e'):if(_0x3a7b54['operator']===_0x4245('0x6f')){if(_0x3a7b54['value'][_0x4245('0x39')]('\x20')[_0x4245('0x4e')]>0x1){_0x25af2d[_0x5e60f5]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4245('0x70')](_0x3a7b54[_0x4245('0x6a')]),null);}else{var _0x49d72e='%'+_0x3a7b54['value']+'%';_0x25af2d[_0x5e60f5]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x49d72e,_0x49d72e,_0x49d72e);}}else{_0x8e44e7=_[_0x4245('0x69')](_0x5eaef8,['name',_0x4245('0x71')]);_0x3a7b54['field']=_0x4245('0x71');_0x1dd721=as[_0x4245('0x72')](_0x4d3bbd,_0x8e44e7[_0x4245('0x46')],_0x3a7b54);_0x25af2d[_0x5e60f5](_0x1dd721[_0x4245('0x73')],_0x1dd721[_0x4245('0x6a')][_0x4245('0x74')],_0x1dd721['value'][_0x4245('0x24')]);}break;case _0x4245('0x75'):var _0xb3727c=_0x3a7b54[_0x4245('0x6a')][_0x4245('0x39')](',')[_0x4245('0x35')](function(_0x12d2e5){return Number(_0x12d2e5);});_0xb3727c['forEach'](function(_0x30d67d){_0xe306e5['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x30d67d+',%');});_0x45cb9e=_['union'](_0x45cb9e,_0xb3727c);break;case _0x4245('0x76'):if(_0x3a7b54[_0x4245('0x77')]==='$substring'){_0x25af2d[_0x5e60f5]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3a7b54[_0x4245('0x6a')]+'%',null);}else{_0x8e44e7=_['find'](_0x5eaef8,[_0x4245('0x33'),_0x4245('0x78')]);_0x3a7b54['field']=_0x4245('0x78');_0x1dd721=as[_0x4245('0x72')](_0x4d3bbd,_0x8e44e7['type'],_0x3a7b54);_0x25af2d[_0x5e60f5](_0x1dd721[_0x4245('0x73')],_0x1dd721[_0x4245('0x6a')][_0x4245('0x74')],_0x1dd721[_0x4245('0x6a')]['end']);}break;case _0x4245('0x3f'):_0x1dd721=as[_0x4245('0x72')]('me',null,_0x3a7b54);_0x25af2d[_0x5e60f5](_0x1dd721[_0x4245('0x73')],_0x1dd721[_0x4245('0x6a')][_0x4245('0x74')],_0x1dd721['value'][_0x4245('0x24')]);break;}}else{var _0x1dd721=as[_0x4245('0x72')](_0x4d3bbd,_0x8e44e7[_0x4245('0x46')],_0x3a7b54);_0x25af2d[_0x5e60f5](_0x1dd721[_0x4245('0x73')],_0x1dd721[_0x4245('0x6a')][_0x4245('0x74')],_0x1dd721[_0x4245('0x6a')][_0x4245('0x24')]);}}}else{var _0x194a76=_(_0x40d003[_0x4245('0x49')])['keys']()[_0x4245('0x35')](function(_0x2a389e){return _[_0x4245('0x79')](_0x5eaef8,['name',_0x2a389e])?_0x2a389e:undefined;})[_0x4245('0x7a')]()['value']();if(!_[_0x4245('0x7b')](_0x194a76)){_0x194a76[_0x4245('0x3a')](function(_0x16fcb7){if(_0x16fcb7===_0x4245('0x7c')){_0x4629b6[_0x4245('0x50')](_0x4245('0x7d'),[][_0x4245('0x7e')](_0x40d003[_0x4245('0x49')][_0x16fcb7]));}else if(_0x16fcb7===_0x4245('0x7f')){var _0x55e267=JSON[_0x4245('0x80')](_0x40d003[_0x4245('0x49')][_0x16fcb7])['$gte'];var _0x525cd6=JSON[_0x4245('0x80')](_0x40d003[_0x4245('0x49')][_0x16fcb7])[_0x4245('0x81')];_0x4629b6[_0x4245('0x50')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x55e267,_0x525cd6);}else{if(_0x40d003[_0x4245('0x49')][_0x16fcb7]===_0x4245('0x82')){_0x4629b6[_0x4245('0x50')]('i.'+_0x16fcb7+_0x4245('0x83'));}else{_0x4629b6[_0x4245('0x50')]('i.'+_0x16fcb7+_0x4245('0x84'),_0x40d003[_0x4245('0x49')][_0x16fcb7]);}}});}if(_0x40d003[_0x4245('0x49')]['read']){if(_0x40d003[_0x4245('0x49')][_0x4245('0x85')]==0x1){_0x4629b6['having']('`unreadMessages`\x20=\x200');}else{_0x4629b6[_0x4245('0x6c')](_0x4245('0x86'));}}if(_0x40d003[_0x4245('0x49')]['tag']){_0x45cb9e=_[_0x4245('0x87')](_0x40d003['query'][_0x4245('0x88')])?_0x40d003['query'][_0x4245('0x88')]:new Array(_0x40d003[_0x4245('0x49')][_0x4245('0x88')]);_0x45cb9e[_0x4245('0x3a')](function(_0x4b67fa){_0xe306e5['or'](_0x4245('0x89'),'%,'+_0x4b67fa+',%');});}if(_0x40d003[_0x4245('0x49')]['filter']){var _0x185467=_0x40d003['query'][_0x4245('0x8a')][_0x4245('0x8b')]('\x5c','\x5c\x5c')[_0x4245('0x8b')](/'/g,'\x27\x27');if(qs[_0x4245('0x8c')](_0x185467)){_0x25af2d['or'](_0x4245('0x8d'),_0x185467+'%');}else if(qs[_0x4245('0x8e')](_0x185467)){_0x25af2d['or'](_0x4245('0x8f'),_0x185467+'%');}else{_0x25af2d['or'](_0x4245('0x90'),qs[_0x4245('0x70')](_0x185467))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x185467));}}}_0x4629b6[_0x4245('0x50')](_0x25af2d);_0x4629b6[_0x4245('0x91')](_0x4245('0x92'));var _0x29ccb2={'type':db[_0x4245('0x93')][_0x4245('0x94')]['SELECT'],'raw':!![]};var _0x1240d4=_0x4629b6['clone']();_0x1240d4[_0x4245('0x53')](_0x4245('0x92'));_0x1240d4[_0x4245('0x53')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4245('0x95'));if(_0x47e50d[_0x4245('0x96')]){_0x47e50d[_0x4245('0x96')]['forEach'](function(_0x4b6ac7){var _0x3f85f1=_0x4b6ac7[0x0]===_0x4245('0x97')?_0x4b6ac7[0x0]:'i.'+_0x4b6ac7[0x0];_0x4629b6[_0x4245('0x96')](_0x3f85f1,_0x4b6ac7[0x1]===_0x4245('0x98')?![]:!![]);});}if(!_[_0x4245('0x7b')](_0x45cb9e)){_0x4629b6[_0x4245('0x6c')](_0xe306e5);_0x1240d4['where'](_0x4245('0x99'),_0x45cb9e);}BPromise['resolve']()[_0x4245('0x30')](function(){if(!_0x21875){if(_0x40d003['query'][_0x4245('0x7c')])return;_0x1240d4[_0x4245('0x50')](_0x4245('0x9a'));_0x4629b6[_0x4245('0x50')](_0x4245('0x9a'));return;}if(_0x40d003['user'][_0x4245('0x9b')]!==_0x4245('0x9c'))return;return _0x40d003[_0x4245('0x9d')][_0x4245('0x9e')]({'attributes':['id'],'raw':!![]})['then'](function(_0x31f786){if(_[_0x4245('0x7b')](_0x31f786)){_0x1240d4[_0x4245('0x50')](_0x4245('0x9f'));_0x4629b6[_0x4245('0x50')](_0x4245('0x9f'));}else{_0x1240d4[_0x4245('0x50')](_0x4245('0x7d'),_[_0x4245('0x35')](_0x31f786,'id'));_0x4629b6[_0x4245('0x50')](_0x4245('0x7d'),_[_0x4245('0x35')](_0x31f786,'id'));}});})[_0x4245('0x30')](function(){if(_0x40d003[_0x4245('0x9d')][_0x4245('0x9b')]===_0x4245('0x9c')&&!_0x21875&&!_0x40d003[_0x4245('0x49')][_0x4245('0x7c')])return[];return db[_0x4245('0xa0')][_0x4245('0x49')](_0x1240d4[_0x4245('0xa1')](),_0x29ccb2);})[_0x4245('0x30')](function(_0x411d52){_0x22fef5[_0x4245('0x26')]=_0x411d52[_0x4245('0x4e')];if(_0x22fef5[_0x4245('0x26')]===0x0)return[];return db[_0x4245('0xa0')][_0x4245('0x49')](_0x577a85['toString'](),_0x29ccb2)['then'](function(_0x257f06){_0xe4cd68=_[_0x4245('0xa2')](_0x257f06,'id');_0x29ccb2=_[_0x4245('0xa3')](_0x29ccb2,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x40d003['query'][_0x4245('0x4c')]){_0x47e50d[_0x4245('0x4d')][_0x4245('0x3a')](function(_0x103745){_0x4629b6[_0x4245('0x53')]('i.'+_0x103745);});}else{_0x4629b6['field'](_0x4245('0xa4'),_0x4245('0x95'));_0x4629b6['field'](_0x4245('0xa5'),_0x4245('0xa6'));_0x4629b6[_0x4245('0x53')](_0x4245('0xa7'),_0x4245('0xa8'));_0x4629b6[_0x4245('0x53')]('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');_0x4629b6['field']('i.id');_0x4629b6['field'](_0x4245('0xa9'));_0x4629b6['field'](_0x4245('0xaa'));_0x4629b6[_0x4245('0x53')]('i.closed');_0x4629b6['field'](_0x4245('0xab'));_0x4629b6['field'](_0x4245('0xac'));_0x4629b6[_0x4245('0x53')]('i.lastMsgAt');_0x4629b6[_0x4245('0x53')](_0x4245('0xad'));_0x4629b6[_0x4245('0x53')](_0x4245('0xae'));_0x4629b6['field']('i.disposition');_0x4629b6[_0x4245('0x53')](_0x4245('0xaf'));_0x4629b6['field'](_0x4245('0xb0'));_0x4629b6[_0x4245('0x53')]('i.substatus');_0x4629b6[_0x4245('0x53')]('i.to');_0x4629b6[_0x4245('0x53')](_0x4245('0xb1'));_0x4629b6[_0x4245('0x53')](_0x4245('0xb2'));_0x4629b6[_0x4245('0x53')](_0x4245('0xb3'));_0x4629b6[_0x4245('0x53')](_0x4245('0xb4'),_0x4245('0xb5'));_0x4629b6['field'](_0x4245('0xb6'),_0x4245('0xb7'));_0x4629b6[_0x4245('0x53')]('c.email',_0x4245('0xb8'));_0x4629b6[_0x4245('0x53')]('c.phone','Contact.phone');_0x4629b6['field'](_0x4245('0xb9'),_0x4245('0xba'));_0x4629b6[_0x4245('0x53')]('c.fax',_0x4245('0xbb'));_0x4629b6[_0x4245('0x53')](_0x4245('0xbc'),_0x4245('0xbd'));_0x4629b6['field'](_0x4245('0xbe'),_0x4245('0xbf'));_0x4629b6[_0x4245('0x53')](_0x4245('0xc0'),'TagIds');}if(_0x47e50d[_0x4245('0x28')])_0x4629b6[_0x4245('0x28')](_0x47e50d['limit']);if(_0x47e50d[_0x4245('0x27')])_0x4629b6[_0x4245('0x27')](_0x47e50d['offset']);return db[_0x4245('0xa0')][_0x4245('0x49')](_0x4629b6['toString'](),_0x29ccb2);})[_0x4245('0x30')](function(_0x1bb73f){_0x2bffb7[_0x4245('0x50')]('ui.MailInteractionId\x20IN\x20?',_[_0x4245('0x35')](_0x1bb73f,'id'));return db[_0x4245('0xa0')][_0x4245('0x49')](_0x2bffb7['toString'](),_0x29ccb2)[_0x4245('0x30')](function(_0x23401d){var _0x107f1c=_['groupBy'](_0x23401d,_0x4245('0xc1'));var _0x536e6b=[];return db[_0x4245('0xc2')][_0x4245('0x3d')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0x4245('0x30')](function(_0x3a30b7){var _0x5c3bd2=_0x3a30b7['enableEmailPreview'];_0x1bb73f[_0x4245('0x3a')](function(_0x571586){_0x536e6b[_0x4245('0x3b')](updateMailInteraction(_0x571586,_0xe4cd68,_0x107f1c,_0x5c3bd2));});return BPromise[_0x4245('0xc3')](_0x536e6b);});});});})['then'](function(_0x351c37){_0x22fef5[_0x4245('0xc4')]=_0x351c37;return _0x22fef5;})[_0x4245('0x30')](respondWithFilteredResult(_0x7e4424,_0x47e50d))[_0x4245('0x43')](handleError(_0x7e4424,null));};exports['show']=function(_0x1232a4,_0x4969f5){var _0x3e96e9={'raw':![],'where':{'id':_0x1232a4['params']['id']}},_0x1de3bc={};_0x1de3bc[_0x4245('0x48')]=_['keys'](db[_0x4245('0x44')][_0x4245('0x45')]);_0x1de3bc['query']=_[_0x4245('0x4a')](_0x1232a4[_0x4245('0x49')]);_0x1de3bc['filters']=_[_0x4245('0x4b')](_0x1de3bc['model'],_0x1de3bc[_0x4245('0x49')]);_0x3e96e9[_0x4245('0x4d')]=_[_0x4245('0x4b')](_0x1de3bc[_0x4245('0x48')],qs[_0x4245('0x4c')](_0x1232a4[_0x4245('0x49')][_0x4245('0x4c')]));_0x3e96e9[_0x4245('0x4d')]=_0x3e96e9[_0x4245('0x4d')][_0x4245('0x4e')]?_0x3e96e9[_0x4245('0x4d')]:_0x1de3bc['model'];if(_0x1232a4[_0x4245('0x49')][_0x4245('0xc5')]){_0x3e96e9[_0x4245('0xc6')]=[{'all':!![]}];}_0x3e96e9=_[_0x4245('0xa3')]({},_0x3e96e9,_0x1232a4[_0x4245('0xc7')]);return db[_0x4245('0x44')]['find'](_0x3e96e9)[_0x4245('0x30')](handleEntityNotFound(_0x4969f5,null))[_0x4245('0x30')](respondWithResult(_0x4969f5,null))[_0x4245('0x43')](handleError(_0x4969f5,null));};exports[_0x4245('0xc8')]=function(_0x3d5e36,_0x167d37){return db[_0x4245('0x44')][_0x4245('0xc8')](_0x3d5e36['body'],{})[_0x4245('0x30')](respondWithResult(_0x167d37,0xc9))['catch'](handleError(_0x167d37,null));};exports[_0x4245('0x2e')]=function(_0x5ab12d,_0x150b14){if(_0x5ab12d[_0x4245('0xc9')]['id']){delete _0x5ab12d[_0x4245('0xc9')]['id'];}return db[_0x4245('0x44')][_0x4245('0x69')]({'where':{'id':_0x5ab12d[_0x4245('0xca')]['id']}})['then'](handleEntityNotFound(_0x150b14,null))[_0x4245('0x30')](saveUpdates(_0x5ab12d['body'],null))[_0x4245('0x30')](respondWithResult(_0x150b14,null))[_0x4245('0x43')](handleError(_0x150b14,null));};exports['destroy']=function(_0x38664f,_0x47d8c5){return db[_0x4245('0x44')][_0x4245('0x69')]({'where':{'id':_0x38664f[_0x4245('0xca')]['id']}})[_0x4245('0x30')](handleEntityNotFound(_0x47d8c5,null))[_0x4245('0x30')](removeEntity(_0x47d8c5,null))['catch'](handleError(_0x47d8c5,null));};exports[_0x4245('0xcb')]=function(_0x479f87,_0x573bee){return db[_0x4245('0x44')][_0x4245('0xcb')]()[_0x4245('0x30')](respondWithResult(_0x573bee,null))[_0x4245('0x43')](handleError(_0x573bee,null));};exports['addMessage']=function(_0x54674a,_0x29a240,_0x5c129f){return db[_0x4245('0x3c')][_0x4245('0x69')]({'where':{'id':_0x54674a[_0x4245('0xca')]['id']}})['then'](handleEntityNotFound(_0x29a240,null))[_0x4245('0x30')](function(_0x23c313){if(_0x23c313){return _0x23c313[_0x4245('0xcc')](_0x54674a[_0x4245('0xc9')][_0x4245('0xcd')],_[_0x4245('0xce')](_0x54674a['body'],[_0x4245('0xcd'),'id'])||{});}})[_0x4245('0x30')](respondWithResult(_0x29a240,null))[_0x4245('0x43')](handleError(_0x29a240,null));};exports[_0x4245('0xcf')]=function(_0x4ca115,_0x361ef7,_0x5664b8){var _0x16ed24={'raw':![],'where':{}};var _0x2e2952={};var _0x176ea3={'count':0x0,'rows':[]};return db[_0x4245('0x44')]['findOne']({'where':{'id':_0x4ca115[_0x4245('0xca')]['id']}})['then'](handleEntityNotFound(_0x361ef7,null))[_0x4245('0x30')](function(_0x2079bb){if(_0x2079bb){_0x2e2952[_0x4245('0x48')]=_[_0x4245('0x4a')](db['MailMessage']['rawAttributes']);_0x2e2952['query']=_[_0x4245('0x4a')](_0x4ca115[_0x4245('0x49')]);_0x2e2952[_0x4245('0xd0')]=_[_0x4245('0x4b')](_0x2e2952['model'],_0x2e2952[_0x4245('0x49')]);_0x16ed24['attributes']=_['intersection'](_0x2e2952['model'],qs['fields'](_0x4ca115['query'][_0x4245('0x4c')]));_0x16ed24[_0x4245('0x4d')]=_0x16ed24[_0x4245('0x4d')][_0x4245('0x4e')]?_0x16ed24[_0x4245('0x4d')]:_0x2e2952['model'];if(!_0x4ca115[_0x4245('0x49')]['hasOwnProperty'](_0x4245('0xd1'))){_0x16ed24[_0x4245('0x28')]=qs['limit'](_0x4ca115[_0x4245('0x49')]['limit']);_0x16ed24[_0x4245('0x27')]=qs[_0x4245('0x27')](_0x4ca115[_0x4245('0x49')]['offset']);}_0x16ed24['order']=qs[_0x4245('0x4f')](_0x4ca115[_0x4245('0x49')][_0x4245('0x4f')]);_0x16ed24[_0x4245('0x50')]=qs[_0x4245('0xd0')](_['pick'](_0x4ca115['query'],_0x2e2952[_0x4245('0xd0')]));_0x16ed24[_0x4245('0x50')][_0x4245('0xc1')]=_0x2079bb['id'];if(_0x4ca115['query'][_0x4245('0x8a')]){_0x16ed24[_0x4245('0x50')]=_['merge'](_0x16ed24[_0x4245('0x50')],{'$or':_['map'](_0x16ed24[_0x4245('0x4d')],function(_0x226971){var _0x5bb321={};_0x5bb321[_0x226971]={'$like':'%'+_0x4ca115[_0x4245('0x49')][_0x4245('0x8a')]+'%'};return _0x5bb321;})});}if(_0x4ca115[_0x4245('0x49')][_0x4245('0xd2')]){var _0x43ea1f=_0x4ca115['query'][_0x4245('0xd2')][_0x4245('0x39')](',');var _0x1d6ad5={};_0x1d6ad5[_0x43ea1f[0x0]]={'$gte':moment(_0x43ea1f[0x1])[_0x4245('0xd3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x16ed24[_0x4245('0x50')]=_['merge'](_0x16ed24[_0x4245('0x50')],_0x1d6ad5);}_0x16ed24=_[_0x4245('0xa3')]({},_0x16ed24,_0x4ca115[_0x4245('0xc7')]);return db[_0x4245('0x3c')]['count']({'where':_0x16ed24['where']})[_0x4245('0x30')](function(_0xe2321d){_0x176ea3[_0x4245('0x26')]=_0xe2321d;if(_0x4ca115[_0x4245('0x49')][_0x4245('0xc5')]){_0x16ed24[_0x4245('0xc6')]=[{'all':!![]}];}return db[_0x4245('0x3c')]['findAll'](_0x16ed24);})[_0x4245('0x30')](function(_0x4b7011){if(_0x4ca115['query']['inlineCss']==='true'){for(var _0x32bf8b=0x0;_0x32bf8b<_0x4b7011[_0x4245('0x4e')];_0x32bf8b++){_0x4b7011[_0x32bf8b][_0x4245('0xc9')]=juice(_0x4b7011[_0x32bf8b][_0x4245('0xc9')]);}}_0x176ea3['rows']=_0x4b7011;return _0x176ea3;});}})['then'](respondWithFilteredResult(_0x361ef7,_0x16ed24))[_0x4245('0x43')](handleError(_0x361ef7,null));};exports[_0x4245('0xd4')]=function(_0x287000,_0x11da5e,_0x33c89f){return db[_0x4245('0x44')][_0x4245('0x69')]({'where':{'id':_0x287000['params']['id']}})['then'](handleEntityNotFound(_0x11da5e,null))[_0x4245('0x30')](function(_0x562870){if(_0x562870){return _0x562870[_0x4245('0xd5')](_0x287000[_0x4245('0xc9')][_0x4245('0xcd')],_['omit'](_0x287000[_0x4245('0xc9')],[_0x4245('0xcd'),'id'])||{})[_0x4245('0xd6')](function(){return db[_0x4245('0x75')][_0x4245('0xd7')]({'attributes':['id',_0x4245('0x33'),_0x4245('0x54')],'where':{'id':_0x287000['body']['ids']}});})[_0x4245('0x30')](function(_0x26658e){socket[_0x4245('0xd8')](_0x4245('0xd9'),{'id':Number(_0x287000[_0x4245('0xca')]['id']),'tags':_0x26658e||[]});return{'id':Number(_0x287000[_0x4245('0xca')]['id']),'tags':_0x26658e||[]};});}})['then'](respondWithResult(_0x11da5e,null))[_0x4245('0x43')](handleError(_0x11da5e,null));};exports[_0x4245('0xda')]=function(_0x9036e3,_0x3fd77c,_0x1def09){return db['MailInteraction']['find']({'where':{'id':_0x9036e3['params']['id']}})[_0x4245('0x30')](handleEntityNotFound(_0x3fd77c,null))[_0x4245('0x30')](function(_0x29d9cb){if(_0x29d9cb){return _0x29d9cb[_0x4245('0xda')](_0x9036e3[_0x4245('0x49')]['ids']);}})[_0x4245('0x30')](respondWithStatusCode(_0x3fd77c,null))[_0x4245('0x43')](handleError(_0x3fd77c,null));};exports[_0x4245('0xdb')]=function(_0x271c66,_0x2fb920){var _0x50db46=moment()['unix']()[_0x4245('0xa1')]();var _0x2d980f=path[_0x4245('0xdc')](config['root'],'server','files',_0x4245('0xdd'));var _0x3de2fc=path[_0x4245('0xdc')](config[_0x4245('0xde')],'server',_0x4245('0xdf'),_0x4245('0xe0'));var _0x38ff25=path[_0x4245('0xdc')](_0x2d980f,_0x50db46);var _0x4b8066=util[_0x4245('0xd3')](_0x4245('0xe1'),_0x271c66['params']['id'],_0x50db46);var _0x58a250=path[_0x4245('0xdc')](_0x2d980f,_0x4b8066);var _0x1790f7=[];if(_0x271c66['query'][_0x4245('0xe0')]){_0x1790f7[_0x4245('0x3b')]({'model':db[_0x4245('0xe2')],'as':'Attachments','raw':!![]});}var _0x4ba246=[{'model':db[_0x4245('0x3c')],'as':'Messages','attributes':['id',_0x4245('0xc9'),_0x4245('0x55'),'to','cc','bcc',_0x4245('0xe3'),'createdAt'],'where':{'secret':![]},'order':qs[_0x4245('0x4f')]('id'),'include':_0x1790f7}];return db[_0x4245('0x44')][_0x4245('0x69')]({'where':{'id':_0x271c66['params']['id']},'include':_0x4ba246})[_0x4245('0x30')](handleEntityNotFound(_0x2fb920,null))[_0x4245('0x30')](function(_0x532e5b){if(_0x532e5b&&_0x532e5b[_0x4245('0xe4')]){var _0x15a5a9=_0x532e5b[_0x4245('0xe5')]({'plain':!![]});fs[_0x4245('0xe6')](_0x38ff25);return BPromise[_0x4245('0xe7')](_0x15a5a9[_0x4245('0xe4')],function(_0x1ca480,_0x2390ea){var _0x840d83={'from':_0x1ca480[_0x4245('0x55')],'to':_0x1ca480['to'],'subject':_0x1ca480[_0x4245('0xe3')],'html':_0x1ca480[_0x4245('0xc9')],'headers':{'Date':moment(_0x1ca480[_0x4245('0x7f')])[_0x4245('0xd3')](_0x4245('0xe8'))},'attachments':[]};if(_0x1ca480['cc']){_0x840d83['headers']['Cc']=_0x1ca480['cc'];}if(_0x1ca480['bcc']){_0x840d83['headers']['Bcc']=_0x1ca480[_0x4245('0xe9')];}return new BPromise(function(_0xe1b312,_0x838633){if(_0x1ca480[_0x4245('0xea')]){for(var _0x350417=0x0;_0x350417<_0x1ca480[_0x4245('0xea')][_0x4245('0x4e')];_0x350417++){var _0x3b4a9c=_0x1ca480['Attachments'][_0x350417];var _0x363964=path['join'](_0x3de2fc,_0x3b4a9c['basename']);if(fs[_0x4245('0xeb')](_0x363964)){_0x840d83[_0x4245('0xe0')][_0x4245('0x3b')]({'name':_0x3b4a9c['name'],'contentType':_0x3b4a9c[_0x4245('0x46')],'data':fs[_0x4245('0xec')](_0x363964)});}}}emlformat[_0x4245('0xed')](_0x840d83,function(_0x439806,_0x2d2158){if(_0x439806)return _0x838633(_0x439806);fs[_0x4245('0xee')](path[_0x4245('0xdc')](_0x38ff25,util[_0x4245('0xd3')](_0x4245('0xef'),_0x2390ea)),_0x2d2158);return _0xe1b312(_0x2d2158);});});})[_0x4245('0x30')](function(){return new BPromise(function(_0x3f00b4,_0x1bb767){zipdir(_0x38ff25,{'saveTo':_0x58a250},function(_0x113817,_0x3e5090){if(_0x113817)return _0x1bb767(_0x113817);return _0x3f00b4(_0x3e5090);});})['then'](function(){return new BPromise(function(_0xd45b57,_0x40f2c7){rimraf(_0x38ff25,function(_0x1a8ff1){if(_0x1a8ff1)_0x40f2c7(_0x1a8ff1);return _0xd45b57();});});})[_0x4245('0x30')](function(){return _0x2fb920[_0x4245('0xdb')](_0x58a250,_0x4b8066,function(_0x450532){if(_0x450532){console[_0x4245('0xf0')](_0x4245('0xf1'),_0x450532);}else{fs[_0x4245('0xf2')](_0x58a250);}});});});}else{return _0x2fb920[_0x4245('0x22')](0xc8);}})[_0x4245('0x43')](handleError(_0x2fb920,null));}; \ No newline at end of file +var _0x1922=['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?','find','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','some','compact','isEmpty','where','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','all','rows','show','params','rawAttributes','includeAll','options','create','catch','body','describe','addMessage','ids','getMessages','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','include','inlineCss','true','setTags','omit','color','emit','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','Attachments','Messages','subject','mkdirSync','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','message%d.eml','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','count','offset','reject','save','update','destroy','then','error','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','MailMessage','findOne','plainBody','-id','trimStart','index','MailInteraction','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','select','field','from','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','users','o.id\x20=\x20i.UserId','left_join','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact'];(function(_0x5bc0f6,_0x372a6b){var _0x50ef27=function(_0x24f4d1){while(--_0x24f4d1){_0x5bc0f6['push'](_0x5bc0f6['shift']());}};_0x50ef27(++_0x372a6b);}(_0x1922,0x8a));var _0x2192=function(_0x215346,_0x1ef5ae){_0x215346=_0x215346-0x0;var _0x7c5bc6=_0x1922[_0x215346];return _0x7c5bc6;};'use strict';var emlformat=require(_0x2192('0x0'));var rimraf=require(_0x2192('0x1'));var zipdir=require(_0x2192('0x2'));var jsonpatch=require(_0x2192('0x3'));var rp=require(_0x2192('0x4'));var moment=require(_0x2192('0x5'));var BPromise=require(_0x2192('0x6'));var Mustache=require(_0x2192('0x7'));var util=require('util');var path=require(_0x2192('0x8'));var sox=require(_0x2192('0x9'));var csv=require(_0x2192('0xa'));var ejs=require(_0x2192('0xb'));var fs=require('fs');var fs_extra=require(_0x2192('0xc'));var _=require('lodash');var squel=require(_0x2192('0xd'));var crypto=require(_0x2192('0xe'));var jsforce=require(_0x2192('0xf'));var deskjs=require(_0x2192('0x10'));var toCsv=require(_0x2192('0xa'));var querystring=require(_0x2192('0x11'));var Papa=require(_0x2192('0x12'));var htmlToText=require(_0x2192('0x13'));var juice=require('juice');var Redis=require('ioredis');var authService=require(_0x2192('0x14'));var qs=require(_0x2192('0x15'));var as=require(_0x2192('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2192('0x17'))('api');var utils=require(_0x2192('0x18'));var config=require(_0x2192('0x19'));var licenseUtil=require(_0x2192('0x1a'));var db=require(_0x2192('0x1b'))['db'];config[_0x2192('0x1c')]=_[_0x2192('0x1d')](config['redis'],{'host':_0x2192('0x1e'),'port':0x18eb});var socket=require(_0x2192('0x1f'))(new Redis(config[_0x2192('0x1c')]));require(_0x2192('0x20'))[_0x2192('0x21')](socket);function respondWithStatusCode(_0x269a49,_0x57440e){_0x57440e=_0x57440e||0xcc;return function(_0x165ab9){if(_0x165ab9){return _0x269a49[_0x2192('0x22')](_0x57440e);}return _0x269a49[_0x2192('0x23')](_0x57440e)[_0x2192('0x24')]();};}function respondWithResult(_0x42930c,_0x2ca0d6){_0x2ca0d6=_0x2ca0d6||0xc8;return function(_0x1f9a89){if(_0x1f9a89){return _0x42930c['status'](_0x2ca0d6)['json'](_0x1f9a89);}};}function respondWithFilteredResult(_0x312f18,_0x4ee55d){return function(_0x280129){if(_0x280129){var _0x3c9727=_0x280129[_0x2192('0x25')],_0x466b60=_0x4ee55d[_0x2192('0x26')],_0x581e86=_0x4ee55d[_0x2192('0x26')]+_0x4ee55d['limit'],_0x292eab;if(_0x581e86>=_0x3c9727){_0x581e86=_0x3c9727;_0x292eab=0xc8;}else{_0x292eab=0xce;}_0x312f18[_0x2192('0x23')](_0x292eab);return _0x312f18['set']('Content-Range',_0x466b60+'-'+_0x581e86+'/'+_0x3c9727)['json'](_0x280129);}return null;};}function patchUpdates(_0x34a59a){return function(_0xaf737a){try{jsonpatch['apply'](_0xaf737a,_0x34a59a,!![]);}catch(_0x11a4e1){return BPromise[_0x2192('0x27')](_0x11a4e1);}return _0xaf737a[_0x2192('0x28')]();};}function saveUpdates(_0x31f106,_0x185743){return function(_0x4865b4){if(_0x4865b4){return _0x4865b4[_0x2192('0x29')](_0x31f106)['then'](function(_0x1e7ce7){return _0x1e7ce7;});}return null;};}function removeEntity(_0x326ffe,_0x5a2bcc){return function(_0x46b423){if(_0x46b423){return _0x46b423[_0x2192('0x2a')]()[_0x2192('0x2b')](function(){_0x326ffe['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x270a56,_0x3e1cff){return function(_0x2f375e){if(!_0x2f375e){_0x270a56[_0x2192('0x22')](0x194);}return _0x2f375e;};}function handleError(_0x5ab997,_0x207d03){_0x207d03=_0x207d03||0x1f4;return function(_0x1c4019){logger[_0x2192('0x2c')](_0x1c4019['stack']);if(_0x1c4019[_0x2192('0x2d')]){delete _0x1c4019[_0x2192('0x2d')];}_0x5ab997[_0x2192('0x23')](_0x207d03)[_0x2192('0x2e')](_0x1c4019);};}function getInteractionUsers(_0xe0cfc3,_0x1cf9f0){return new BPromise(function(_0x2b2483,_0x40da76){try{if(_0x1cf9f0[_0xe0cfc3['id']]){_0xe0cfc3[_0x2192('0x2f')]=_[_0x2192('0x30')](_0x1cf9f0[_0xe0cfc3['id']],function(_0x43a1aa){return{'id':_0x43a1aa['id'],'fullname':_0x43a1aa[_0x2192('0x31')]};});}}catch(_0x24f17d){_0x40da76(_0x24f17d);}_0x2b2483(_0xe0cfc3);});}function getInteractionTags(_0x263939,_0x26dabd){return new BPromise(function(_0x39b0da,_0x48a03b){try{if(_0x263939[_0x2192('0x32')]){_0x263939[_0x2192('0x33')]=[];_0x263939[_0x2192('0x32')][_0x2192('0x34')](',')[_0x2192('0x35')](function(_0x4de386){_0x263939['Tags'][_0x2192('0x36')](_0x26dabd[_0x4de386]);});}delete _0x263939[_0x2192('0x32')];}catch(_0x5a53c9){_0x48a03b(_0x5a53c9);}_0x39b0da(_0x263939);});}function getLastMessageText(_0x2fbb05){return new BPromise(function(_0x285201,_0x253ac3){return db[_0x2192('0x37')][_0x2192('0x38')]({'where':{'$and':[{'MailInteractionId':_0x2fbb05['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x2192('0x39')],'order':_0x2192('0x3a'),'raw':!![]})['then'](function(_0x81a38e){if(_0x81a38e&&_0x81a38e[_0x2192('0x39')]){_0x2fbb05['lastMsgText']=_[_0x2192('0x3b')](_0x81a38e[_0x2192('0x39')]);}_0x285201(_0x2fbb05);})['catch'](function(_0x537a70){_0x253ac3(_0x537a70);});});}function updateMailInteraction(_0x474889,_0x404511,_0x580e88,_0x4ac757){return new BPromise(function(_0xbab00e,_0x732d90){return getInteractionUsers(_0x474889,_0x580e88)[_0x2192('0x2b')](function(_0x452d93){return getInteractionTags(_0x452d93,_0x404511);})[_0x2192('0x2b')](function(_0x119600){if(_0x4ac757){_0xbab00e(getLastMessageText(_0x119600));}else{_0xbab00e(_0x119600);}})['catch'](function(_0xfa8d35){_0x732d90(_0xfa8d35);});});}exports[_0x2192('0x3c')]=function(_0x59a3b1,_0xbcaaff){var _0x389ca5={},_0x4c9148={},_0x17131b={'count':0x0,'rows':[]};var _0x47c4c5=_[_0x2192('0x30')](db[_0x2192('0x3d')]['rawAttributes'],function(_0x24013d){return{'name':_0x24013d['fieldName'],'type':_0x24013d[_0x2192('0x3e')][_0x2192('0x3f')]};});_0x4c9148[_0x2192('0x40')]=_[_0x2192('0x30')](_0x47c4c5,_0x2192('0x2d'));_0x4c9148[_0x2192('0x41')]=_[_0x2192('0x42')](_0x59a3b1['query']);_0x4c9148['filters']=_[_0x2192('0x43')](_0x4c9148[_0x2192('0x40')],_0x4c9148[_0x2192('0x41')]);_0x389ca5[_0x2192('0x44')]=_['intersection'](_0x4c9148[_0x2192('0x40')],qs[_0x2192('0x45')](_0x59a3b1[_0x2192('0x41')][_0x2192('0x45')]));_0x389ca5[_0x2192('0x44')]=_0x389ca5[_0x2192('0x44')][_0x2192('0x46')]?_0x389ca5[_0x2192('0x44')]:_0x4c9148[_0x2192('0x40')];if(!_0x59a3b1[_0x2192('0x41')][_0x2192('0x47')](_0x2192('0x48'))){_0x389ca5['limit']=qs['limit'](_0x59a3b1['query'][_0x2192('0x49')]);_0x389ca5[_0x2192('0x26')]=qs[_0x2192('0x26')](_0x59a3b1[_0x2192('0x41')]['offset']);}_0x389ca5[_0x2192('0x4a')]=qs['sort'](_0x59a3b1['query'][_0x2192('0x4b')]);_0x389ca5['where']=qs[_0x2192('0x4c')](_[_0x2192('0x4d')](_0x59a3b1[_0x2192('0x41')],_0x4c9148[_0x2192('0x4c')]),_0x47c4c5);var _0x252757=[];var _0x423b52=squel[_0x2192('0x4e')]()[_0x2192('0x4f')]('id')[_0x2192('0x4f')](_0x2192('0x2d'))[_0x2192('0x4f')]('color')[_0x2192('0x50')]('tools_tags');var _0x7f7651=squel[_0x2192('0x4e')]()[_0x2192('0x4f')](_0x2192('0x51'))['field'](_0x2192('0x52'))[_0x2192('0x4f')](_0x2192('0x53'))['from'](_0x2192('0x54'),'ui')['left_join'](_0x2192('0x55'),'u','u.id\x20=\x20ui.UserId');var _0x3f1a0a=squel[_0x2192('0x4e')]()['from']('mail_interactions','i')['left_join']('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x2192('0x55'),'o',_0x2192('0x56'))[_0x2192('0x57')]('mail_accounts','a',_0x2192('0x58'))[_0x2192('0x57')](_0x2192('0x59'),'me',_0x2192('0x5a'))[_0x2192('0x57')](_0x2192('0x5b'),'it',_0x2192('0x5c'))[_0x2192('0x57')](_0x2192('0x5d'),'t',_0x2192('0x5e'));var _0x266ff3=squel[_0x2192('0x5f')]();var _0x3d810c=[];var _0x481287=squel[_0x2192('0x5f')]();var _0x443972;if(_0x59a3b1[_0x2192('0x41')]['search']){_0x443972=as['parseSearch'](_0x59a3b1['query'][_0x2192('0x60')]);var _0x43c399=_0x443972[_0x2192('0x61')];for(var _0x11fd6e=0x0;_0x11fd6e<_0x443972[_0x2192('0x62')]['length'];_0x11fd6e++){var _0x3676bf=_0x443972[_0x2192('0x62')][_0x11fd6e];var _0x3cb313='i';var _0x2a57fe=_['find'](_0x47c4c5,[_0x2192('0x2d'),_0x3676bf[_0x2192('0x4f')]]);if(!_0x2a57fe){switch(_0x3676bf['field']){case _0x2192('0x63'):if(_0x3676bf[_0x2192('0x64')]==0x1){_0x3f1a0a[_0x2192('0x65')]('`'+_0x3676bf[_0x2192('0x4f')]+_0x2192('0x66'));}else{_0x3f1a0a[_0x2192('0x65')]('`'+_0x3676bf[_0x2192('0x4f')]+_0x2192('0x67'));}break;case _0x2192('0x68'):if(_0x3676bf[_0x2192('0x69')]===_0x2192('0x6a')){if(_0x3676bf[_0x2192('0x64')][_0x2192('0x34')]('\x20')[_0x2192('0x46')]>0x1){_0x266ff3[_0x43c399](_0x2192('0x6b'),qs['getFullTextValue'](_0x3676bf[_0x2192('0x64')]),null);}else{var _0x170fb1='%'+_0x3676bf[_0x2192('0x64')]+'%';_0x266ff3[_0x43c399](_0x2192('0x6c'),_0x170fb1,_0x170fb1,_0x170fb1);}}else{_0x2a57fe=_[_0x2192('0x6d')](_0x47c4c5,[_0x2192('0x2d'),_0x2192('0x6e')]);_0x3676bf[_0x2192('0x4f')]=_0x2192('0x6e');_0x2e8455=as['buildExpression'](_0x3cb313,_0x2a57fe[_0x2192('0x3e')],_0x3676bf);_0x266ff3[_0x43c399](_0x2e8455[_0x2192('0x6f')],_0x2e8455[_0x2192('0x64')][_0x2192('0x70')],_0x2e8455[_0x2192('0x64')][_0x2192('0x24')]);}break;case _0x2192('0x71'):var _0x26c56a=_0x3676bf[_0x2192('0x64')]['split'](',')['map'](function(_0x5be88e){return Number(_0x5be88e);});_0x26c56a['forEach'](function(_0x564ba1){_0x481287['or'](_0x2192('0x72'),'%,'+_0x564ba1+',%');});_0x3d810c=_[_0x2192('0x73')](_0x3d810c,_0x26c56a);break;case _0x2192('0x74'):if(_0x3676bf[_0x2192('0x69')]==='$substring'){_0x266ff3[_0x43c399](_0x2192('0x75'),'%'+_0x3676bf['value']+'%',null);}else{_0x2a57fe=_[_0x2192('0x6d')](_0x47c4c5,[_0x2192('0x2d'),'UserId']);_0x3676bf[_0x2192('0x4f')]=_0x2192('0x76');_0x2e8455=as[_0x2192('0x77')](_0x3cb313,_0x2a57fe['type'],_0x3676bf);_0x266ff3[_0x43c399](_0x2e8455['text'],_0x2e8455['value']['start'],_0x2e8455['value'][_0x2192('0x24')]);}break;case _0x2192('0x39'):_0x2e8455=as['buildExpression']('me',null,_0x3676bf);_0x266ff3[_0x43c399](_0x2e8455[_0x2192('0x6f')],_0x2e8455[_0x2192('0x64')]['start'],_0x2e8455[_0x2192('0x64')][_0x2192('0x24')]);break;}}else{var _0x2e8455=as[_0x2192('0x77')](_0x3cb313,_0x2a57fe[_0x2192('0x3e')],_0x3676bf);_0x266ff3[_0x43c399](_0x2e8455[_0x2192('0x6f')],_0x2e8455['value'][_0x2192('0x70')],_0x2e8455['value']['end']);}}}else{var _0xc246dd=_(_0x59a3b1[_0x2192('0x41')])[_0x2192('0x42')]()[_0x2192('0x30')](function(_0x2c59dc){return _[_0x2192('0x78')](_0x47c4c5,['name',_0x2c59dc])?_0x2c59dc:undefined;})[_0x2192('0x79')]()[_0x2192('0x64')]();if(!_[_0x2192('0x7a')](_0xc246dd)){_0xc246dd[_0x2192('0x35')](function(_0x29e2ec){if(_0x29e2ec==='MailAccountId'){_0x3f1a0a[_0x2192('0x7b')]('i.MailAccountId\x20IN\x20?',[][_0x2192('0x7c')](_0x59a3b1[_0x2192('0x41')][_0x29e2ec]));}else if(_0x29e2ec===_0x2192('0x7d')){var _0x1359a4=JSON['parse'](_0x59a3b1['query'][_0x29e2ec])[_0x2192('0x7e')];var _0x41b5cd=JSON[_0x2192('0x7f')](_0x59a3b1['query'][_0x29e2ec])[_0x2192('0x80')];_0x3f1a0a['where'](_0x2192('0x81'),_0x1359a4,_0x41b5cd);}else{if(_0x59a3b1['query'][_0x29e2ec]==='null'){_0x3f1a0a[_0x2192('0x7b')]('i.'+_0x29e2ec+_0x2192('0x82'));}else{_0x3f1a0a[_0x2192('0x7b')]('i.'+_0x29e2ec+_0x2192('0x83'),_0x59a3b1[_0x2192('0x41')][_0x29e2ec]);}}});}if(_0x59a3b1[_0x2192('0x41')]['read']){if(_0x59a3b1['query'][_0x2192('0x84')]==0x1){_0x3f1a0a['having'](_0x2192('0x85'));}else{_0x3f1a0a[_0x2192('0x65')](_0x2192('0x86'));}}if(_0x59a3b1[_0x2192('0x41')]['tag']){_0x3d810c=_[_0x2192('0x87')](_0x59a3b1[_0x2192('0x41')][_0x2192('0x88')])?_0x59a3b1['query'][_0x2192('0x88')]:new Array(_0x59a3b1[_0x2192('0x41')][_0x2192('0x88')]);_0x3d810c['forEach'](function(_0x4e230d){_0x481287['or'](_0x2192('0x72'),'%,'+_0x4e230d+',%');});}if(_0x59a3b1[_0x2192('0x41')][_0x2192('0x89')]){var _0x373875=_0x59a3b1['query'][_0x2192('0x89')][_0x2192('0x8a')]('\x5c','\x5c\x5c')[_0x2192('0x8a')](/'/g,'\x27\x27');if(qs[_0x2192('0x8b')](_0x373875)){_0x266ff3['or']('i.id\x20LIKE\x20?',_0x373875+'%');}else if(qs[_0x2192('0x8c')](_0x373875)){_0x266ff3['or'](_0x2192('0x8d'),_0x373875+'%');}else{_0x266ff3['or'](_0x2192('0x8e'),qs[_0x2192('0x8f')](_0x373875))['or'](_0x2192('0x90'),qs[_0x2192('0x8f')](_0x373875));}}}_0x3f1a0a[_0x2192('0x7b')](_0x266ff3);_0x3f1a0a['group'](_0x2192('0x91'));var _0x259189={'type':db['Sequelize'][_0x2192('0x92')][_0x2192('0x93')],'raw':!![]};var _0x1b7517=_0x3f1a0a[_0x2192('0x94')]();_0x1b7517[_0x2192('0x4f')](_0x2192('0x91'));_0x1b7517[_0x2192('0x4f')](_0x2192('0x95'),_0x2192('0x63'));if(_0x389ca5['order']){_0x389ca5['order'][_0x2192('0x35')](function(_0x158f1e){var _0xc435dc=_0x158f1e[0x0]===_0x2192('0x96')?_0x158f1e[0x0]:'i.'+_0x158f1e[0x0];_0x3f1a0a[_0x2192('0x4a')](_0xc435dc,_0x158f1e[0x1]===_0x2192('0x97')?![]:!![]);});}if(!_[_0x2192('0x7a')](_0x3d810c)){_0x3f1a0a['having'](_0x481287);_0x1b7517[_0x2192('0x7b')]('t.id\x20IN\x20?',_0x3d810c);}BPromise['resolve']()[_0x2192('0x2b')](function(){if(!_0x443972){if(_0x59a3b1[_0x2192('0x41')][_0x2192('0x98')])return;_0x1b7517['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x3f1a0a[_0x2192('0x7b')](_0x2192('0x99'));return;}if(_0x59a3b1[_0x2192('0x9a')][_0x2192('0x9b')]!==_0x2192('0x9c'))return;return _0x59a3b1[_0x2192('0x9a')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0x2192('0x2b')](function(_0x1631b8){if(_[_0x2192('0x7a')](_0x1631b8)){_0x1b7517[_0x2192('0x7b')](_0x2192('0x9d'));_0x3f1a0a['where']('i.MailAccountId\x20IS\x20NULL');}else{_0x1b7517[_0x2192('0x7b')](_0x2192('0x9e'),_['map'](_0x1631b8,'id'));_0x3f1a0a[_0x2192('0x7b')](_0x2192('0x9e'),_[_0x2192('0x30')](_0x1631b8,'id'));}});})[_0x2192('0x2b')](function(){if(_0x59a3b1[_0x2192('0x9a')][_0x2192('0x9b')]===_0x2192('0x9c')&&!_0x443972&&!_0x59a3b1[_0x2192('0x41')][_0x2192('0x98')])return[];return db[_0x2192('0x9f')][_0x2192('0x41')](_0x1b7517[_0x2192('0xa0')](),_0x259189);})['then'](function(_0x100256){_0x17131b[_0x2192('0x25')]=_0x100256[_0x2192('0x46')];if(_0x17131b[_0x2192('0x25')]===0x0)return[];return db[_0x2192('0x9f')][_0x2192('0x41')](_0x423b52['toString'](),_0x259189)['then'](function(_0xef0510){_0x252757=_[_0x2192('0xa1')](_0xef0510,'id');_0x259189=_[_0x2192('0xa2')](_0x259189,{'model':db[_0x2192('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x59a3b1[_0x2192('0x41')][_0x2192('0x45')]){_0x389ca5['attributes'][_0x2192('0x35')](function(_0x1ca944){_0x3f1a0a[_0x2192('0x4f')]('i.'+_0x1ca944);});}else{_0x3f1a0a[_0x2192('0x4f')](_0x2192('0x95'),_0x2192('0x63'));_0x3f1a0a['field'](_0x2192('0xa3'),'Account.key');_0x3f1a0a[_0x2192('0x4f')](_0x2192('0xa4'),'Account.mandatoryDisposition');_0x3f1a0a['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x2192('0x96'));_0x3f1a0a['field'](_0x2192('0x91'));_0x3f1a0a[_0x2192('0x4f')](_0x2192('0xa5'));_0x3f1a0a[_0x2192('0x4f')](_0x2192('0xa6'));_0x3f1a0a[_0x2192('0x4f')](_0x2192('0xa7'));_0x3f1a0a[_0x2192('0x4f')](_0x2192('0xa8'));_0x3f1a0a[_0x2192('0x4f')]('i.attach');_0x3f1a0a[_0x2192('0x4f')](_0x2192('0xa9'));_0x3f1a0a[_0x2192('0x4f')](_0x2192('0xaa'));_0x3f1a0a[_0x2192('0x4f')]('i.subject');_0x3f1a0a['field']('i.disposition');_0x3f1a0a[_0x2192('0x4f')](_0x2192('0xab'));_0x3f1a0a[_0x2192('0x4f')](_0x2192('0xac'));_0x3f1a0a['field'](_0x2192('0xad'));_0x3f1a0a[_0x2192('0x4f')](_0x2192('0xae'));_0x3f1a0a['field'](_0x2192('0xaf'));_0x3f1a0a[_0x2192('0x4f')]('i.MailAccountId');_0x3f1a0a[_0x2192('0x4f')](_0x2192('0xb0'));_0x3f1a0a[_0x2192('0x4f')](_0x2192('0xb1'),_0x2192('0xb2'));_0x3f1a0a['field'](_0x2192('0xb3'),_0x2192('0xb4'));_0x3f1a0a[_0x2192('0x4f')](_0x2192('0xb5'),'Contact.email');_0x3f1a0a[_0x2192('0x4f')]('c.phone',_0x2192('0xb6'));_0x3f1a0a[_0x2192('0x4f')](_0x2192('0xb7'),_0x2192('0xb8'));_0x3f1a0a['field'](_0x2192('0xb9'),_0x2192('0xba'));_0x3f1a0a[_0x2192('0x4f')](_0x2192('0xbb'),_0x2192('0xbc'));_0x3f1a0a[_0x2192('0x4f')](_0x2192('0xbd'),'Owner.internal');_0x3f1a0a['field'](_0x2192('0xbe'),_0x2192('0x32'));}if(_0x389ca5[_0x2192('0x49')])_0x3f1a0a[_0x2192('0x49')](_0x389ca5['limit']);if(_0x389ca5[_0x2192('0x26')])_0x3f1a0a[_0x2192('0x26')](_0x389ca5[_0x2192('0x26')]);return db[_0x2192('0x9f')][_0x2192('0x41')](_0x3f1a0a[_0x2192('0xa0')](),_0x259189);})['then'](function(_0x358680){_0x7f7651[_0x2192('0x7b')]('ui.MailInteractionId\x20IN\x20?',_[_0x2192('0x30')](_0x358680,'id'));return db[_0x2192('0x9f')][_0x2192('0x41')](_0x7f7651[_0x2192('0xa0')](),_0x259189)[_0x2192('0x2b')](function(_0x36eaa7){var _0x39ab25=_[_0x2192('0xbf')](_0x36eaa7,'MailInteractionId');var _0x3273b2=[];return db[_0x2192('0xc0')][_0x2192('0x38')]({'attributes':[_0x2192('0xc1')],'raw':!![]})[_0x2192('0x2b')](function(_0xc99147){var _0x4d2203=_0xc99147[_0x2192('0xc1')];_0x358680[_0x2192('0x35')](function(_0x36b9de){_0x3273b2['push'](updateMailInteraction(_0x36b9de,_0x252757,_0x39ab25,_0x4d2203));});return BPromise[_0x2192('0xc2')](_0x3273b2);});});});})[_0x2192('0x2b')](function(_0x19a976){_0x17131b[_0x2192('0xc3')]=_0x19a976;return _0x17131b;})[_0x2192('0x2b')](respondWithFilteredResult(_0xbcaaff,_0x389ca5))['catch'](handleError(_0xbcaaff,null));};exports[_0x2192('0xc4')]=function(_0x17f404,_0x3d3f49){var _0x38ba53={'raw':![],'where':{'id':_0x17f404[_0x2192('0xc5')]['id']}},_0x5bd4c5={};_0x5bd4c5['model']=_[_0x2192('0x42')](db['MailInteraction'][_0x2192('0xc6')]);_0x5bd4c5[_0x2192('0x41')]=_['keys'](_0x17f404[_0x2192('0x41')]);_0x5bd4c5[_0x2192('0x4c')]=_[_0x2192('0x43')](_0x5bd4c5[_0x2192('0x40')],_0x5bd4c5[_0x2192('0x41')]);_0x38ba53[_0x2192('0x44')]=_[_0x2192('0x43')](_0x5bd4c5[_0x2192('0x40')],qs[_0x2192('0x45')](_0x17f404[_0x2192('0x41')]['fields']));_0x38ba53[_0x2192('0x44')]=_0x38ba53[_0x2192('0x44')]['length']?_0x38ba53[_0x2192('0x44')]:_0x5bd4c5[_0x2192('0x40')];if(_0x17f404[_0x2192('0x41')][_0x2192('0xc7')]){_0x38ba53['include']=[{'all':!![]}];}_0x38ba53=_[_0x2192('0xa2')]({},_0x38ba53,_0x17f404[_0x2192('0xc8')]);return db[_0x2192('0x3d')]['find'](_0x38ba53)[_0x2192('0x2b')](handleEntityNotFound(_0x3d3f49,null))[_0x2192('0x2b')](respondWithResult(_0x3d3f49,null))['catch'](handleError(_0x3d3f49,null));};exports[_0x2192('0xc9')]=function(_0x2212f1,_0x8add64){return db['MailInteraction'][_0x2192('0xc9')](_0x2212f1['body'],{})[_0x2192('0x2b')](respondWithResult(_0x8add64,0xc9))[_0x2192('0xca')](handleError(_0x8add64,null));};exports[_0x2192('0x29')]=function(_0x333d1f,_0x1f71f8){if(_0x333d1f[_0x2192('0xcb')]['id']){delete _0x333d1f[_0x2192('0xcb')]['id'];}return db['MailInteraction'][_0x2192('0x6d')]({'where':{'id':_0x333d1f['params']['id']}})['then'](handleEntityNotFound(_0x1f71f8,null))[_0x2192('0x2b')](saveUpdates(_0x333d1f[_0x2192('0xcb')],null))[_0x2192('0x2b')](respondWithResult(_0x1f71f8,null))['catch'](handleError(_0x1f71f8,null));};exports[_0x2192('0x2a')]=function(_0x351321,_0x185c0e){return db[_0x2192('0x3d')][_0x2192('0x6d')]({'where':{'id':_0x351321[_0x2192('0xc5')]['id']}})['then'](handleEntityNotFound(_0x185c0e,null))[_0x2192('0x2b')](removeEntity(_0x185c0e,null))[_0x2192('0xca')](handleError(_0x185c0e,null));};exports['describe']=function(_0x5a7d5b,_0xcab38e){return db[_0x2192('0x3d')][_0x2192('0xcc')]()[_0x2192('0x2b')](respondWithResult(_0xcab38e,null))[_0x2192('0xca')](handleError(_0xcab38e,null));};exports[_0x2192('0xcd')]=function(_0x38711c,_0x4e2bfa,_0x2aeacd){return db[_0x2192('0x37')][_0x2192('0x6d')]({'where':{'id':_0x38711c[_0x2192('0xc5')]['id']}})[_0x2192('0x2b')](handleEntityNotFound(_0x4e2bfa,null))[_0x2192('0x2b')](function(_0x178a8f){if(_0x178a8f){return _0x178a8f[_0x2192('0xcd')](_0x38711c['body'][_0x2192('0xce')],_['omit'](_0x38711c[_0x2192('0xcb')],[_0x2192('0xce'),'id'])||{});}})['then'](respondWithResult(_0x4e2bfa,null))[_0x2192('0xca')](handleError(_0x4e2bfa,null));};exports[_0x2192('0xcf')]=function(_0x4a4c96,_0x52c7f3,_0x441223){var _0x4048b0={'raw':![],'where':{}};var _0x565269={};var _0x4e2db4={'count':0x0,'rows':[]};return db[_0x2192('0x3d')][_0x2192('0x38')]({'where':{'id':_0x4a4c96[_0x2192('0xc5')]['id']}})[_0x2192('0x2b')](handleEntityNotFound(_0x52c7f3,null))[_0x2192('0x2b')](function(_0x5cc764){if(_0x5cc764){_0x565269[_0x2192('0x40')]=_[_0x2192('0x42')](db[_0x2192('0x37')][_0x2192('0xc6')]);_0x565269[_0x2192('0x41')]=_[_0x2192('0x42')](_0x4a4c96[_0x2192('0x41')]);_0x565269[_0x2192('0x4c')]=_['intersection'](_0x565269[_0x2192('0x40')],_0x565269[_0x2192('0x41')]);_0x4048b0['attributes']=_[_0x2192('0x43')](_0x565269[_0x2192('0x40')],qs['fields'](_0x4a4c96[_0x2192('0x41')][_0x2192('0x45')]));_0x4048b0[_0x2192('0x44')]=_0x4048b0[_0x2192('0x44')]['length']?_0x4048b0[_0x2192('0x44')]:_0x565269[_0x2192('0x40')];if(!_0x4a4c96[_0x2192('0x41')][_0x2192('0x47')](_0x2192('0x48'))){_0x4048b0['limit']=qs[_0x2192('0x49')](_0x4a4c96[_0x2192('0x41')]['limit']);_0x4048b0['offset']=qs[_0x2192('0x26')](_0x4a4c96[_0x2192('0x41')][_0x2192('0x26')]);}_0x4048b0[_0x2192('0x4a')]=qs[_0x2192('0x4b')](_0x4a4c96[_0x2192('0x41')][_0x2192('0x4b')]);_0x4048b0[_0x2192('0x7b')]=qs[_0x2192('0x4c')](_['pick'](_0x4a4c96[_0x2192('0x41')],_0x565269[_0x2192('0x4c')]));_0x4048b0[_0x2192('0x7b')][_0x2192('0xd0')]=_0x5cc764['id'];if(_0x4a4c96[_0x2192('0x41')][_0x2192('0x89')]){_0x4048b0[_0x2192('0x7b')]=_[_0x2192('0xa2')](_0x4048b0[_0x2192('0x7b')],{'$or':_[_0x2192('0x30')](_0x4048b0[_0x2192('0x44')],function(_0x4d2df7){var _0x5d3200={};_0x5d3200[_0x4d2df7]={'$like':'%'+_0x4a4c96['query']['filter']+'%'};return _0x5d3200;})});}if(_0x4a4c96[_0x2192('0x41')]['$gte']){var _0x38870a=_0x4a4c96[_0x2192('0x41')][_0x2192('0x7e')]['split'](',');var _0xaf6528={};_0xaf6528[_0x38870a[0x0]]={'$gte':moment(_0x38870a[0x1])[_0x2192('0xd1')](_0x2192('0xd2'))};_0x4048b0['where']=_[_0x2192('0xa2')](_0x4048b0['where'],_0xaf6528);}_0x4048b0=_[_0x2192('0xa2')]({},_0x4048b0,_0x4a4c96[_0x2192('0xc8')]);return db[_0x2192('0x37')][_0x2192('0x25')]({'where':_0x4048b0[_0x2192('0x7b')]})[_0x2192('0x2b')](function(_0x3a878b){_0x4e2db4[_0x2192('0x25')]=_0x3a878b;if(_0x4a4c96[_0x2192('0x41')][_0x2192('0xc7')]){_0x4048b0[_0x2192('0xd3')]=[{'all':!![]}];}return db[_0x2192('0x37')]['findAll'](_0x4048b0);})[_0x2192('0x2b')](function(_0x19eaa7){if(_0x4a4c96[_0x2192('0x41')][_0x2192('0xd4')]===_0x2192('0xd5')){for(var _0x2c8025=0x0;_0x2c8025<_0x19eaa7[_0x2192('0x46')];_0x2c8025++){_0x19eaa7[_0x2c8025][_0x2192('0xcb')]=juice(_0x19eaa7[_0x2c8025][_0x2192('0xcb')]);}}_0x4e2db4[_0x2192('0xc3')]=_0x19eaa7;return _0x4e2db4;});}})[_0x2192('0x2b')](respondWithFilteredResult(_0x52c7f3,_0x4048b0))['catch'](handleError(_0x52c7f3,null));};exports['addTags']=function(_0x264c3b,_0x584f75,_0x427cc2){return db[_0x2192('0x3d')][_0x2192('0x6d')]({'where':{'id':_0x264c3b[_0x2192('0xc5')]['id']}})[_0x2192('0x2b')](handleEntityNotFound(_0x584f75,null))['then'](function(_0x4453bb){if(_0x4453bb){return _0x4453bb[_0x2192('0xd6')](_0x264c3b[_0x2192('0xcb')][_0x2192('0xce')],_[_0x2192('0xd7')](_0x264c3b[_0x2192('0xcb')],[_0x2192('0xce'),'id'])||{})['spread'](function(){return db[_0x2192('0x71')]['findAll']({'attributes':['id','name',_0x2192('0xd8')],'where':{'id':_0x264c3b[_0x2192('0xcb')][_0x2192('0xce')]}});})[_0x2192('0x2b')](function(_0x4451ca){socket[_0x2192('0xd9')](_0x2192('0xda'),{'id':Number(_0x264c3b[_0x2192('0xc5')]['id']),'tags':_0x4451ca||[]});return{'id':Number(_0x264c3b['params']['id']),'tags':_0x4451ca||[]};});}})['then'](respondWithResult(_0x584f75,null))['catch'](handleError(_0x584f75,null));};exports[_0x2192('0xdb')]=function(_0xaa11e,_0x3b9dc8,_0x5ba28a){return db[_0x2192('0x3d')][_0x2192('0x6d')]({'where':{'id':_0xaa11e[_0x2192('0xc5')]['id']}})[_0x2192('0x2b')](handleEntityNotFound(_0x3b9dc8,null))[_0x2192('0x2b')](function(_0x359513){if(_0x359513){return _0x359513[_0x2192('0xdb')](_0xaa11e[_0x2192('0x41')][_0x2192('0xce')]);}})[_0x2192('0x2b')](respondWithStatusCode(_0x3b9dc8,null))[_0x2192('0xca')](handleError(_0x3b9dc8,null));};exports[_0x2192('0xdc')]=function(_0x270086,_0x3a1cb2){var _0x4fcc78=moment()[_0x2192('0xdd')]()[_0x2192('0xa0')]();var _0x2a9621=path[_0x2192('0xde')](config[_0x2192('0xdf')],_0x2192('0xe0'),_0x2192('0xe1'),_0x2192('0xe2'));var _0x2bdcf3=path[_0x2192('0xde')](config[_0x2192('0xdf')],_0x2192('0xe0'),_0x2192('0xe1'),_0x2192('0xe3'));var _0x1549ed=path[_0x2192('0xde')](_0x2a9621,_0x4fcc78);var _0x4b3be3=util[_0x2192('0xd1')]('transcript-%d-%s.zip',_0x270086['params']['id'],_0x4fcc78);var _0x491359=path[_0x2192('0xde')](_0x2a9621,_0x4b3be3);var _0x33de51=[];if(_0x270086[_0x2192('0x41')][_0x2192('0xe3')]){_0x33de51['push']({'model':db['Attachment'],'as':_0x2192('0xe4'),'raw':!![]});}var _0x47bdb3=[{'model':db[_0x2192('0x37')],'as':_0x2192('0xe5'),'attributes':['id',_0x2192('0xcb'),_0x2192('0x50'),'to','cc','bcc',_0x2192('0xe6'),_0x2192('0x7d')],'where':{'secret':![]},'order':qs[_0x2192('0x4b')]('id'),'include':_0x33de51}];return db[_0x2192('0x3d')][_0x2192('0x6d')]({'where':{'id':_0x270086['params']['id']},'include':_0x47bdb3})['then'](handleEntityNotFound(_0x3a1cb2,null))[_0x2192('0x2b')](function(_0xe723d3){if(_0xe723d3&&_0xe723d3[_0x2192('0xe5')]){var _0x1c10f1=_0xe723d3['get']({'plain':!![]});fs[_0x2192('0xe7')](_0x1549ed);return BPromise['each'](_0x1c10f1[_0x2192('0xe5')],function(_0x2330e9,_0x1f17a7){var _0x21735b={'from':_0x2330e9[_0x2192('0x50')],'to':_0x2330e9['to'],'subject':_0x2330e9['subject'],'html':_0x2330e9['body'],'headers':{'Date':moment(_0x2330e9['createdAt'])[_0x2192('0xd1')](_0x2192('0xe8'))},'attachments':[]};if(_0x2330e9['cc']){_0x21735b[_0x2192('0xe9')]['Cc']=_0x2330e9['cc'];}if(_0x2330e9[_0x2192('0xea')]){_0x21735b[_0x2192('0xe9')][_0x2192('0xeb')]=_0x2330e9['bcc'];}return new BPromise(function(_0xf39cbb,_0x5c8b5f){if(_0x2330e9[_0x2192('0xe4')]){for(var _0x271a67=0x0;_0x271a67<_0x2330e9[_0x2192('0xe4')][_0x2192('0x46')];_0x271a67++){var _0x46c5e0=_0x2330e9[_0x2192('0xe4')][_0x271a67];var _0x2e831f=path[_0x2192('0xde')](_0x2bdcf3,_0x46c5e0[_0x2192('0xec')]);if(fs[_0x2192('0xed')](_0x2e831f)){_0x21735b[_0x2192('0xe3')][_0x2192('0x36')]({'name':_0x46c5e0[_0x2192('0x2d')],'contentType':_0x46c5e0['type'],'data':fs[_0x2192('0xee')](_0x2e831f)});}}}emlformat['build'](_0x21735b,function(_0x271954,_0x53fba3){if(_0x271954)return _0x5c8b5f(_0x271954);fs['writeFileSync'](path['join'](_0x1549ed,util[_0x2192('0xd1')](_0x2192('0xef'),_0x1f17a7)),_0x53fba3);return _0xf39cbb(_0x53fba3);});});})[_0x2192('0x2b')](function(){return new BPromise(function(_0x50d4d3,_0x2f9134){zipdir(_0x1549ed,{'saveTo':_0x491359},function(_0x10b580,_0x45baa5){if(_0x10b580)return _0x2f9134(_0x10b580);return _0x50d4d3(_0x45baa5);});})[_0x2192('0x2b')](function(){return new BPromise(function(_0x2c9b26,_0x4da946){rimraf(_0x1549ed,function(_0xca330){if(_0xca330)_0x4da946(_0xca330);return _0x2c9b26();});});})[_0x2192('0x2b')](function(){return _0x3a1cb2['download'](_0x491359,_0x4b3be3,function(_0x183151){if(_0x183151){console[_0x2192('0xf0')](_0x2192('0xf1'),_0x183151);}else{fs[_0x2192('0xf2')](_0x491359);}});});});}else{return _0x3a1cb2[_0x2192('0x22')](0xc8);}})['catch'](handleError(_0x3a1cb2,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 21fba6b..2accf4e 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 _0xab40=['../../mysqldb','MailInteraction','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab40,0x87));var _0x0ab4=function(_0x280cba,_0x5d5fac){_0x280cba=_0x280cba-0x0;var _0xbaf99f=_0xab40[_0x280cba];return _0xbaf99f;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x0ab4('0x0'))['db'][_0x0ab4('0x1')];var MailMessage=require(_0x0ab4('0x0'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0ab4('0x2'),'afterUpdate':_0x0ab4('0x3'),'afterDestroy':_0x0ab4('0x4')};function emitEvent(_0x30f43d){return function(_0x28954e,_0x42df26,_0x113386){_0x28954e[_0x0ab4('0x5')]({'attributes':['id'],'raw':!![]})[_0x0ab4('0x6')](function(_0x179c36){_0x28954e[_0x0ab4('0x7')](_0x0ab4('0x8'),_0x179c36[_0x0ab4('0x9')](function(_0x48f779){return{'id':_0x48f779['id']};}));return MailMessage[_0x0ab4('0xa')]({'where':{'MailInteractionId':_0x28954e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0ab4('0x6')](function(_0x43d96a){_0x28954e[_0x0ab4('0x7')](_0x0ab4('0xb'),_0x43d96a[_0x0ab4('0xc')]);MailInteractionEvents[_0x0ab4('0xd')](_0x30f43d+':'+_0x28954e['id'],_0x28954e);MailInteractionEvents[_0x0ab4('0xd')](_0x30f43d,_0x28954e);_0x113386(null);})['catch'](_0x113386(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x0ab4('0xe')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x3b23=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x3b23,0x9f));var _0x33b2=function(_0x2da885,_0x505296){_0x2da885=_0x2da885-0x0;var _0x11b8b8=_0x3b23[_0x2da885];return _0x11b8b8;};'use strict';var EventEmitter=require(_0x33b2('0x0'));var MailInteraction=require(_0x33b2('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x33b2('0x1'))['db'][_0x33b2('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x33b2('0x3')](0x0);var events={'afterCreate':_0x33b2('0x4'),'afterUpdate':_0x33b2('0x5'),'afterDestroy':_0x33b2('0x6')};function emitEvent(_0x37befb){return function(_0x93a36d,_0x4143cf,_0x5d2fa1){_0x93a36d[_0x33b2('0x7')]({'attributes':['id'],'raw':!![]})[_0x33b2('0x8')](function(_0x4da773){_0x93a36d[_0x33b2('0x9')]('Users',_0x4da773[_0x33b2('0xa')](function(_0x59c651){return{'id':_0x59c651['id']};}));return MailMessage[_0x33b2('0xb')]({'where':{'MailInteractionId':_0x93a36d['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x72edc){_0x93a36d[_0x33b2('0x9')](_0x33b2('0xc'),_0x72edc[_0x33b2('0xd')]);MailInteractionEvents[_0x33b2('0xe')](_0x37befb+':'+_0x93a36d['id'],_0x93a36d);MailInteractionEvents[_0x33b2('0xe')](_0x37befb,_0x93a36d);_0x5d2fa1(null);})[_0x33b2('0xf')](_0x5d2fa1(null));};}for(var e in events){if(events[_0x33b2('0x10')](e)){var event=events[e];MailInteraction[_0x33b2('0x11')](e,emitEvent(event));}}module[_0x33b2('0x12')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 55c0ace..491bce7 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 _0x008d=['MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','substatus','changed','closed','closedAt','models','get'];(function(_0x1d2288,_0x79e3f8){var _0x1de414=function(_0x405581){while(--_0x405581){_0x1d2288['push'](_0x1d2288['shift']());}};_0x1de414(++_0x79e3f8);}(_0x008d,0x9b));var _0xd008=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x008d[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xd008('0x0'));var util=require(_0xd008('0x1'));var logger=require(_0xd008('0x2'))(_0xd008('0x3'));var moment=require(_0xd008('0x4'));var BPromise=require(_0xd008('0x5'));var rp=require(_0xd008('0x6'));var fs=require('fs');var path=require(_0xd008('0x7'));var rimraf=require(_0xd008('0x8'));var config=require('../../config/environment');var attributes=require(_0xd008('0x9'));module[_0xd008('0xa')]=function(_0x439a36,_0x24b1ec){return _0x439a36[_0xd008('0xb')](_0xd008('0xc'),attributes,{'tableName':_0xd008('0xd'),'paranoid':![],'indexes':[{'name':_0xd008('0xe'),'fields':[_0xd008('0xf'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x39ec1a,_0x4fc9bb,_0x2066ab){if(_0x39ec1a['substatus']){_0x39ec1a[_0xd008('0x10')]=moment()[_0xd008('0x11')](_0xd008('0x12'));}if(_0x39ec1a['closed']){_0x39ec1a['closedAt']=moment()[_0xd008('0x11')](_0xd008('0x12'));}_0x2066ab(null,_0x4fc9bb);},'beforeUpdate':function(_0xed62ca,_0x23fbee,_0xf913da){if(_0xed62ca['changed'](_0xd008('0x13'))){_0xed62ca[_0xd008('0x10')]=_0xed62ca[_0xd008('0x13')]?moment()[_0xd008('0x11')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0xed62ca[_0xd008('0x14')](_0xd008('0x15'))){_0xed62ca[_0xd008('0x16')]=moment()[_0xd008('0x11')](_0xd008('0x12'));_0xed62ca['substatus']=null;_0xed62ca['substatusAt']=null;}_0xf913da(null,_0xed62ca);},'afterUpdate':function(_0x268a4f,_0x12c43d,_0x3fd2a1){var _0x1836af=_0x439a36[_0xd008('0x17')];var _0x56061d=_0x268a4f[_0xd008('0x18')]({'plain':!![]});if(_0x56061d['closed']){return _0x1836af[_0xd008('0x19')][_0xd008('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x56061d['id']}})[_0xd008('0x1b')](function(){_0x3fd2a1();})['catch'](function(_0x41ac1f){_0x3fd2a1(_0x41ac1f);});}else{_0x3fd2a1();}}},'charset':_0xd008('0x1c'),'collate':_0xd008('0x1d')});}; \ No newline at end of file +var _0x765b=['update','then','catch','utf8mb4','utf8mb4_unicode_ci','api','bluebird','path','rimraf','../../config/environment','define','mail_interactions','fti_mail_interactions','subject','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','substatus','substatusAt','models','get'];(function(_0x10c98c,_0x43fb26){var _0x47f007=function(_0x23da21){while(--_0x23da21){_0x10c98c['push'](_0x10c98c['shift']());}};_0x47f007(++_0x43fb26);}(_0x765b,0x18c));var _0xb765=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x765b[_0x34325b];return _0x3da348;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb765('0x0'));var moment=require('moment');var BPromise=require(_0xb765('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb765('0x2'));var rimraf=require(_0xb765('0x3'));var config=require(_0xb765('0x4'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x58195b,_0x5441a3){return _0x58195b[_0xb765('0x5')]('MailInteraction',attributes,{'tableName':_0xb765('0x6'),'paranoid':![],'indexes':[{'name':_0xb765('0x7'),'fields':[_0xb765('0x8'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xdb0017,_0x293807,_0x26ad83){if(_0xdb0017['substatus']){_0xdb0017['substatusAt']=moment()['format'](_0xb765('0x9'));}if(_0xdb0017[_0xb765('0xa')]){_0xdb0017[_0xb765('0xb')]=moment()[_0xb765('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x26ad83(null,_0x293807);},'beforeUpdate':function(_0x2e8b58,_0x311db5,_0x157a3b){if(_0x2e8b58[_0xb765('0xd')](_0xb765('0xe'))){_0x2e8b58[_0xb765('0xf')]=_0x2e8b58[_0xb765('0xe')]?moment()[_0xb765('0xc')](_0xb765('0x9')):null;}if(_0x2e8b58['changed'](_0xb765('0xa'))){_0x2e8b58['closedAt']=moment()[_0xb765('0xc')](_0xb765('0x9'));_0x2e8b58['substatus']=null;_0x2e8b58['substatusAt']=null;}_0x157a3b(null,_0x2e8b58);},'afterUpdate':function(_0x3f73f4,_0x2ab6b8,_0x291dbe){var _0x3a2341=_0x58195b[_0xb765('0x10')];var _0x3b9a9b=_0x3f73f4[_0xb765('0x11')]({'plain':!![]});if(_0x3b9a9b[_0xb765('0xa')]){return _0x3a2341['MailMessage'][_0xb765('0x12')]({'read':!![]},{'where':{'MailInteractionId':_0x3b9a9b['id']}})[_0xb765('0x13')](function(){_0x291dbe();})[_0xb765('0x14')](function(_0x11fb1e){_0x291dbe(_0x11fb1e);});}else{_0x291dbe();}}},'charset':_0xb765('0x15'),'collate':_0xb765('0x16')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 3bc2af2..9ea7e4c 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 _0xfbac=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','AddTagsToMailInteraction','find','addTags','ids','spread','AddTags','debug','util'];(function(_0x21ee1e,_0x31e068){var _0x3737f0=function(_0x5cb960){while(--_0x5cb960){_0x21ee1e['push'](_0x21ee1e['shift']());}};_0x3737f0(++_0x31e068);}(_0xfbac,0x167));var _0xcfba=function(_0x40248f,_0x1e6c8f){_0x40248f=_0x40248f-0x0;var _0xe7edef=_0xfbac[_0x40248f];return _0xe7edef;};'use strict';var _=require('lodash');var util=require(_0xcfba('0x0'));var moment=require(_0xcfba('0x1'));var BPromise=require(_0xcfba('0x2'));var rs=require(_0xcfba('0x3'));var fs=require('fs');var Redis=require(_0xcfba('0x4'));var db=require(_0xcfba('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcfba('0x6'));var config=require(_0xcfba('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcfba('0x8')]({'port':0x232a});config['redis']=_[_0xcfba('0x9')](config['redis'],{'host':_0xcfba('0xa'),'port':0x18eb});var socket=require(_0xcfba('0xb'))(new Redis(config['redis']));require(_0xcfba('0xc'))[_0xcfba('0xd')](socket);function respondWithRpcPromise(_0xb47f0e,_0x460f01,_0x12d959){return new BPromise(function(_0x44af2e,_0x37ed2d){return client[_0xcfba('0xe')](_0xb47f0e,_0x12d959)[_0xcfba('0xf')](function(_0x8f9e59){logger[_0xcfba('0x10')](_0xcfba('0x11'),_0x460f01,'request\x20sent');logger['debug'](_0xcfba('0x12'),_0x460f01,_0xcfba('0x13'),JSON['stringify'](_0x8f9e59));if(_0x8f9e59[_0xcfba('0x14')]){if(_0x8f9e59[_0xcfba('0x14')][_0xcfba('0x15')]===0x1f4){logger[_0xcfba('0x14')](_0xcfba('0x11'),_0x460f01,_0x8f9e59[_0xcfba('0x14')][_0xcfba('0x16')]);return _0x37ed2d(_0x8f9e59[_0xcfba('0x14')][_0xcfba('0x16')]);}logger[_0xcfba('0x14')](_0xcfba('0x11'),_0x460f01,_0x8f9e59[_0xcfba('0x14')][_0xcfba('0x16')]);return _0x44af2e(_0x8f9e59['error'][_0xcfba('0x16')]);}else{logger[_0xcfba('0x10')](_0xcfba('0x11'),_0x460f01,_0xcfba('0x13'));_0x44af2e(_0x8f9e59[_0xcfba('0x17')][_0xcfba('0x16')]);}})[_0xcfba('0x18')](function(_0x5ebd44){logger[_0xcfba('0x14')](_0xcfba('0x11'),_0x460f01,_0x5ebd44);_0x37ed2d(_0x5ebd44);});});}exports[_0xcfba('0x19')]=function(_0x47aa59){var _0x5832d4=this;return new Promise(function(_0x98831c,_0x43b745){return db[_0xcfba('0x1a')][_0xcfba('0x1b')](_0x47aa59[_0xcfba('0x1c')],{'raw':_0x47aa59[_0xcfba('0x1d')]?_0x47aa59['options'][_0xcfba('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47aa59['options']?_0x47aa59[_0xcfba('0x1d')][_0xcfba('0x1f')]||null:null,'attributes':_0x47aa59['options']?_0x47aa59[_0xcfba('0x1d')][_0xcfba('0x20')]||null:null,'limit':_0x47aa59[_0xcfba('0x1d')]?_0x47aa59[_0xcfba('0x1d')]['limit']||null:null})['then'](function(_0x387a32){logger[_0xcfba('0x10')](_0xcfba('0x19'),_0x47aa59);logger['debug'](_0xcfba('0x19'),_0x47aa59,JSON['stringify'](_0x387a32));_0x98831c(_0x387a32);})[_0xcfba('0x18')](function(_0x5e79c7){logger['error'](_0xcfba('0x19'),_0x5e79c7[_0xcfba('0x16')],_0x47aa59);_0x43b745(_0x5832d4['error'](0x1f4,_0x5e79c7[_0xcfba('0x16')]));});});};exports[_0xcfba('0x21')]=function(_0x69bb2f){return new Promise(function(_0x334d97,_0xae6518){return db[_0xcfba('0x1a')][_0xcfba('0x22')]({'where':_0x69bb2f[_0xcfba('0x1d')]?_0x69bb2f['options'][_0xcfba('0x1f')]||null:null})['then'](function(_0x4be92b){if(_0x4be92b){return _0x4be92b[_0xcfba('0x23')](_0x69bb2f['body'][_0xcfba('0x24')],_['omit'](_0x69bb2f[_0xcfba('0x1c')],[_0xcfba('0x24'),'id'])||{});}})[_0xcfba('0x25')](function(_0x127ad5){logger[_0xcfba('0x10')](_0xcfba('0x26'),_0x69bb2f);logger[_0xcfba('0x27')](_0xcfba('0x26'),_0x69bb2f,JSON['stringify'](_0x127ad5));_0x334d97(_0x127ad5);})['catch'](function(_0x5d4e1a){logger[_0xcfba('0x14')](_0xcfba('0x26'),_0x5d4e1a['message'],_0x69bb2f);_0xae6518(_this[_0xcfba('0x14')](0x1f4,_0x5d4e1a['message']));});});}; \ No newline at end of file +var _0x90ae=['request\x20sent','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToMailInteraction','find','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','info','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','MailInteraction,\x20%s,\x20%s','message'];(function(_0x14476b,_0xd1a7a4){var _0x24e2e8=function(_0x52ed26){while(--_0x52ed26){_0x14476b['push'](_0x14476b['shift']());}};_0x24e2e8(++_0xd1a7a4);}(_0x90ae,0x195));var _0xe90a=function(_0x4a21eb,_0x5da5e8){_0x4a21eb=_0x4a21eb-0x0;var _0x13aba9=_0x90ae[_0x4a21eb];return _0x13aba9;};'use strict';var _=require(_0xe90a('0x0'));var util=require(_0xe90a('0x1'));var moment=require(_0xe90a('0x2'));var BPromise=require('bluebird');var rs=require(_0xe90a('0x3'));var fs=require('fs');var Redis=require(_0xe90a('0x4'));var db=require(_0xe90a('0x5'))['db'];var utils=require(_0xe90a('0x6'));var logger=require(_0xe90a('0x7'))(_0xe90a('0x8'));var config=require(_0xe90a('0x9'));var jayson=require(_0xe90a('0xa'));var client=jayson[_0xe90a('0xb')]['http']({'port':0x232a});config[_0xe90a('0xc')]=_[_0xe90a('0xd')](config[_0xe90a('0xc')],{'host':_0xe90a('0xe'),'port':0x18eb});var socket=require(_0xe90a('0xf'))(new Redis(config[_0xe90a('0xc')]));require('./mailInteraction.socket')[_0xe90a('0x10')](socket);function respondWithRpcPromise(_0x241cef,_0x2f08cc,_0x177f29){return new BPromise(function(_0x465cdd,_0x4f19d1){return client[_0xe90a('0x11')](_0x241cef,_0x177f29)['then'](function(_0x3a77f3){logger[_0xe90a('0x12')]('MailInteraction,\x20%s,\x20%s',_0x2f08cc,'request\x20sent');logger[_0xe90a('0x13')](_0xe90a('0x14'),_0x2f08cc,'request\x20sent',JSON[_0xe90a('0x15')](_0x3a77f3));if(_0x3a77f3[_0xe90a('0x16')]){if(_0x3a77f3[_0xe90a('0x16')]['code']===0x1f4){logger[_0xe90a('0x16')](_0xe90a('0x17'),_0x2f08cc,_0x3a77f3['error'][_0xe90a('0x18')]);return _0x4f19d1(_0x3a77f3['error']['message']);}logger['error'](_0xe90a('0x17'),_0x2f08cc,_0x3a77f3[_0xe90a('0x16')][_0xe90a('0x18')]);return _0x465cdd(_0x3a77f3[_0xe90a('0x16')][_0xe90a('0x18')]);}else{logger[_0xe90a('0x12')](_0xe90a('0x17'),_0x2f08cc,_0xe90a('0x19'));_0x465cdd(_0x3a77f3[_0xe90a('0x1a')][_0xe90a('0x18')]);}})[_0xe90a('0x1b')](function(_0x38f5b4){logger[_0xe90a('0x16')]('MailInteraction,\x20%s,\x20%s',_0x2f08cc,_0x38f5b4);_0x4f19d1(_0x38f5b4);});});}exports[_0xe90a('0x1c')]=function(_0x952335){var _0x2f18aa=this;return new Promise(function(_0x7cb509,_0x4cfb63){return db[_0xe90a('0x1d')][_0xe90a('0x1e')](_0x952335[_0xe90a('0x1f')],{'raw':_0x952335['options']?_0x952335[_0xe90a('0x20')][_0xe90a('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x952335[_0xe90a('0x20')]?_0x952335[_0xe90a('0x20')][_0xe90a('0x22')]||null:null,'attributes':_0x952335[_0xe90a('0x20')]?_0x952335['options'][_0xe90a('0x23')]||null:null,'limit':_0x952335['options']?_0x952335[_0xe90a('0x20')][_0xe90a('0x24')]||null:null})[_0xe90a('0x25')](function(_0x74cf58){logger[_0xe90a('0x12')](_0xe90a('0x1c'),_0x952335);logger['debug'](_0xe90a('0x1c'),_0x952335,JSON[_0xe90a('0x15')](_0x74cf58));_0x7cb509(_0x74cf58);})['catch'](function(_0x15a36b){logger[_0xe90a('0x16')]('UpdateMailInteraction',_0x15a36b[_0xe90a('0x18')],_0x952335);_0x4cfb63(_0x2f18aa[_0xe90a('0x16')](0x1f4,_0x15a36b[_0xe90a('0x18')]));});});};exports[_0xe90a('0x26')]=function(_0x5b1061){return new Promise(function(_0x448a6c,_0x2dc8e9){return db['MailInteraction'][_0xe90a('0x27')]({'where':_0x5b1061[_0xe90a('0x20')]?_0x5b1061[_0xe90a('0x20')][_0xe90a('0x22')]||null:null})[_0xe90a('0x25')](function(_0x302cd6){if(_0x302cd6){return _0x302cd6['addTags'](_0x5b1061[_0xe90a('0x1f')][_0xe90a('0x28')],_['omit'](_0x5b1061[_0xe90a('0x1f')],[_0xe90a('0x28'),'id'])||{});}})[_0xe90a('0x29')](function(_0x1e7d53){logger[_0xe90a('0x12')](_0xe90a('0x2a'),_0x5b1061);logger[_0xe90a('0x13')](_0xe90a('0x2a'),_0x5b1061,JSON['stringify'](_0x1e7d53));_0x448a6c(_0x1e7d53);})[_0xe90a('0x1b')](function(_0x3ac7b6){logger[_0xe90a('0x16')](_0xe90a('0x2a'),_0x3ac7b6['message'],_0x5b1061);_0x2dc8e9(_this[_0xe90a('0x16')](0x1f4,_0x3ac7b6[_0xe90a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 60326a5..bd0c548 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 _0x2aa9=['save','update','emit','removeListener','mailInteraction:','./mailInteraction.events'];(function(_0x36153a,_0x249024){var _0x11b13c=function(_0x386a4d){while(--_0x386a4d){_0x36153a['push'](_0x36153a['shift']());}};_0x11b13c(++_0x249024);}(_0x2aa9,0x83));var _0x92aa=function(_0x5a2408,_0x278391){_0x5a2408=_0x5a2408-0x0;var _0x5c4342=_0x2aa9[_0x5a2408];return _0x5c4342;};'use strict';var MailInteractionEvents=require(_0x92aa('0x0'));var events=[_0x92aa('0x1'),'remove',_0x92aa('0x2')];function createListener(_0x281d8e,_0xd656af){return function(_0x1493cd){_0xd656af[_0x92aa('0x3')](_0x281d8e,_0x1493cd);};}function removeListener(_0x3f3b7e,_0x4beec5){return function(){MailInteractionEvents[_0x92aa('0x4')](_0x3f3b7e,_0x4beec5);};}exports['register']=function(_0x156118){for(var _0x25e623=0x0,_0x41f126=events['length'];_0x25e623<_0x41f126;_0x25e623++){var _0x1f67b2=events[_0x25e623];var _0x1f564b=createListener(_0x92aa('0x5')+_0x1f67b2,_0x156118);MailInteractionEvents['on'](_0x1f67b2,_0x1f564b);}}; \ No newline at end of file +var _0xa562=['update','emit','removeListener','register','mailInteraction:','./mailInteraction.events','remove'];(function(_0x2f1651,_0x10b559){var _0xedeb1=function(_0x3f8e4b){while(--_0x3f8e4b){_0x2f1651['push'](_0x2f1651['shift']());}};_0xedeb1(++_0x10b559);}(_0xa562,0xec));var _0x2a56=function(_0x58efa6,_0x2c00bd){_0x58efa6=_0x58efa6-0x0;var _0x5d643c=_0xa562[_0x58efa6];return _0x5d643c;};'use strict';var MailInteractionEvents=require(_0x2a56('0x0'));var events=['save',_0x2a56('0x1'),_0x2a56('0x2')];function createListener(_0x132428,_0xc34a13){return function(_0x4a0b1b){_0xc34a13[_0x2a56('0x3')](_0x132428,_0x4a0b1b);};}function removeListener(_0x470f36,_0x492113){return function(){MailInteractionEvents[_0x2a56('0x4')](_0x470f36,_0x492113);};}exports[_0x2a56('0x5')]=function(_0x1bbc87){for(var _0x3e23fb=0x0,_0x306ae7=events['length'];_0x3e23fb<_0x306ae7;_0x3e23fb++){var _0x34a2c9=events[_0x3e23fb];var _0x308f63=createListener(_0x2a56('0x6')+_0x34a2c9,_0x1bbc87);MailInteractionEvents['on'](_0x34a2c9,_0x308f63);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 6262146..079b258 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 _0xec87=['index','show','/:id/download','download','post','tracked','create','put','/:id','/:id/accept','reject','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x5752da,_0x15d577){var _0x2f19b2=function(_0x156e0c){while(--_0x156e0c){_0x5752da['push'](_0x5752da['shift']());}};_0x2f19b2(++_0x15d577);}(_0xec87,0x167));var _0x7ec8=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0xec87[_0x4eafed];return _0x159c85;};'use strict';var multer=require(_0x7ec8('0x0'));var util=require(_0x7ec8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7ec8('0x2')]();var fs_extra=require(_0x7ec8('0x3'));var auth=require(_0x7ec8('0x4'));var interaction=require(_0x7ec8('0x5'));var config=require(_0x7ec8('0x6'));var controller=require('./mailMessage.controller');router[_0x7ec8('0x7')]('/',auth[_0x7ec8('0x8')](),controller[_0x7ec8('0x9')]);router[_0x7ec8('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x7ec8('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7ec8('0xa')]);router['get'](_0x7ec8('0xb'),auth['isAuthenticated'](),controller[_0x7ec8('0xc')]);router[_0x7ec8('0xd')]('/',auth[_0x7ec8('0x8')](),interaction[_0x7ec8('0xe')]('mail','mailmessage:create'),controller[_0x7ec8('0xf')]);router[_0x7ec8('0x10')](_0x7ec8('0x11'),auth[_0x7ec8('0x8')](),controller['update']);router[_0x7ec8('0x10')](_0x7ec8('0x12'),auth['isAuthenticated'](),controller['accept']);router[_0x7ec8('0x10')]('/:id/reject',auth[_0x7ec8('0x8')](),controller[_0x7ec8('0x13')]);router[_0x7ec8('0x14')](_0x7ec8('0x11'),auth[_0x7ec8('0x8')](),controller[_0x7ec8('0x15')]);module[_0x7ec8('0x16')]=router; \ No newline at end of file +var _0x6e7f=['mail','mailmessage:create','create','update','put','/:id/accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download'];(function(_0x5b7315,_0x2a8675){var _0x3960ea=function(_0x1defb6){while(--_0x1defb6){_0x5b7315['push'](_0x5b7315['shift']());}};_0x3960ea(++_0x2a8675);}(_0x6e7f,0x128));var _0xf6e7=function(_0x571bc1,_0x50e410){_0x571bc1=_0x571bc1-0x0;var _0x52273f=_0x6e7f[_0x571bc1];return _0x52273f;};'use strict';var multer=require(_0xf6e7('0x0'));var util=require(_0xf6e7('0x1'));var path=require(_0xf6e7('0x2'));var timeout=require(_0xf6e7('0x3'));var express=require('express');var router=express[_0xf6e7('0x4')]();var fs_extra=require(_0xf6e7('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf6e7('0x6'));var controller=require(_0xf6e7('0x7'));router[_0xf6e7('0x8')]('/',auth[_0xf6e7('0x9')](),controller['index']);router[_0xf6e7('0x8')](_0xf6e7('0xa'),auth[_0xf6e7('0x9')](),controller[_0xf6e7('0xb')]);router[_0xf6e7('0x8')](_0xf6e7('0xc'),auth[_0xf6e7('0x9')](),controller[_0xf6e7('0xd')]);router[_0xf6e7('0x8')](_0xf6e7('0xe'),auth[_0xf6e7('0x9')](),controller[_0xf6e7('0xf')]);router['post']('/',auth[_0xf6e7('0x9')](),interaction['tracked'](_0xf6e7('0x10'),_0xf6e7('0x11')),controller[_0xf6e7('0x12')]);router['put']('/:id',auth[_0xf6e7('0x9')](),controller[_0xf6e7('0x13')]);router[_0xf6e7('0x14')](_0xf6e7('0x15'),auth[_0xf6e7('0x9')](),controller['accept']);router[_0xf6e7('0x14')](_0xf6e7('0x16'),auth['isAuthenticated'](),controller[_0xf6e7('0x17')]);router[_0xf6e7('0x18')]('/:id',auth[_0xf6e7('0x9')](),controller[_0xf6e7('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 5282744..9fb1c60 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 _0xe8c6=['out','STRING','DATE','INTEGER','Email','sequelize','lodash','exports','TEXT','long','medium','ENUM'];(function(_0x361f59,_0x371ffe){var _0x2fecdd=function(_0x46e15a){while(--_0x46e15a){_0x361f59['push'](_0x361f59['shift']());}};_0x2fecdd(++_0x371ffe);}(_0xe8c6,0x7d));var _0x6e8c=function(_0x2c7f80,_0x5da68e){_0x2c7f80=_0x2c7f80-0x0;var _0x413d06=_0xe8c6[_0x2c7f80];return _0x413d06;};'use strict';var Sequelize=require(_0x6e8c('0x0'));var _=require(_0x6e8c('0x1'));module[_0x6e8c('0x2')]={'body':{'type':Sequelize[_0x6e8c('0x3')](_0x6e8c('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x6e8c('0x3')](_0x6e8c('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x6e8c('0x6')]('in',_0x6e8c('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x6e8c('0x8')]},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0x6e8c('0x3')](_0x6e8c('0x4'))},'subject':{'type':Sequelize[_0x6e8c('0x3')]},'sentAt':{'type':Sequelize[_0x6e8c('0x9')]},'attach':{'type':Sequelize[_0x6e8c('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x6e8c('0x9')]},'originTo':{'type':Sequelize[_0x6e8c('0x3')]('long')},'originCc':{'type':Sequelize[_0x6e8c('0x3')](_0x6e8c('0x4'))},'originChannel':{'type':Sequelize['ENUM'](_0x6e8c('0xb'),'Chat'),'defaultValue':_0x6e8c('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x42b5=['STRING','INTEGER','Chat','Email','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out'];(function(_0xbf07b8,_0x4fc2c6){var _0x17aef8=function(_0x443a16){while(--_0x443a16){_0xbf07b8['push'](_0xbf07b8['shift']());}};_0x17aef8(++_0x4fc2c6);}(_0x42b5,0x79));var _0x542b=function(_0x345cb6,_0xeae5b1){_0x345cb6=_0x345cb6-0x0;var _0xcf2853=_0x42b5[_0x345cb6];return _0xcf2853;};'use strict';var Sequelize=require(_0x542b('0x0'));var _=require(_0x542b('0x1'));module[_0x542b('0x2')]={'body':{'type':Sequelize[_0x542b('0x3')](_0x542b('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x542b('0x3')](_0x542b('0x5'))},'read':{'type':Sequelize[_0x542b('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x542b('0x7')]('in',_0x542b('0x8')),'defaultValue':_0x542b('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x542b('0x9')](0x1fe)},'from':{'type':Sequelize[_0x542b('0x9')]},'to':{'type':Sequelize[_0x542b('0x3')](_0x542b('0x4'))},'cc':{'type':Sequelize[_0x542b('0x3')]('long')},'bcc':{'type':Sequelize[_0x542b('0x3')](_0x542b('0x4'))},'subject':{'type':Sequelize[_0x542b('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x542b('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x542b('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x542b('0x3')]('long')},'originCc':{'type':Sequelize[_0x542b('0x3')]('long')},'originChannel':{'type':Sequelize[_0x542b('0x7')]('Email',_0x542b('0xb')),'defaultValue':_0x542b('0xc'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 6ef4c11..3955a3b 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 _0xf110=['querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','http','client','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','MailMessage','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','options','count','includeAll','include','rows','rawAttributes','body','find','params','describe','create','direction','out','split','findOne','MailAccountId','List','CmContact','Contacts','updatedAt','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','user','pass','auth','attachments','join','root','server/files/attachments','basename','defaults','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','mail-interactions','accept','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','Contact','get','MailInteraction','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','interface','download','unix','toString','server','files','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','push','readFileSync','build','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto'];(function(_0x4c3498,_0x457c0e){var _0x513563=function(_0x5cf351){while(--_0x5cf351){_0x4c3498['push'](_0x4c3498['shift']());}};_0x513563(++_0x457c0e);}(_0xf110,0x1e8));var _0x0f11=function(_0x274638,_0x578968){_0x274638=_0x274638-0x0;var _0x5755df=_0xf110[_0x274638];return _0x5755df;};'use strict';var emlformat=require(_0x0f11('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0f11('0x1'));var jsonpatch=require(_0x0f11('0x2'));var rp=require(_0x0f11('0x3'));var moment=require('moment');var BPromise=require(_0x0f11('0x4'));var Mustache=require(_0x0f11('0x5'));var util=require(_0x0f11('0x6'));var path=require(_0x0f11('0x7'));var sox=require(_0x0f11('0x8'));var csv=require(_0x0f11('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f11('0xa'));var _=require('lodash');var squel=require(_0x0f11('0xb'));var crypto=require(_0x0f11('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0f11('0x9'));var querystring=require(_0x0f11('0xd'));var Papa=require(_0x0f11('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0f11('0xf'));var hardwareService=require(_0x0f11('0x10'));var logger=require(_0x0f11('0x11'))('api');var utils=require(_0x0f11('0x12'));var config=require(_0x0f11('0x13'));var licenseUtil=require(_0x0f11('0x14'));var db=require(_0x0f11('0x15'))['db'];config[_0x0f11('0x16')]=_['defaults'](config['redis'],{'host':_0x0f11('0x17'),'port':0x18eb});var socket=require(_0x0f11('0x18'))(new Redis(config['redis']));require(_0x0f11('0x19'))[_0x0f11('0x1a')](socket);var jayson=require(_0x0f11('0x1b'));var client=jayson['client'][_0x0f11('0x1c')]({'port':0x232c});var client9003=jayson[_0x0f11('0x1d')][_0x0f11('0x1c')]({'port':0x232b});var client9002=jayson[_0x0f11('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a8529,_0x47a890,_0x31145b,_0x32dbee){return new BPromise(function(_0x3b08c4,_0x1f8533){var _0x2d1551=_0x32dbee||client;return _0x2d1551[_0x0f11('0x1e')](_0x4a8529,_0x31145b)['then'](function(_0x48dcc2){logger[_0x0f11('0x1f')](_0x0f11('0x20'),_0x47a890,_0x0f11('0x21'));logger[_0x0f11('0x22')](_0x0f11('0x23'),_0x47a890,'request\x20sent',JSON[_0x0f11('0x24')](_0x48dcc2));if(_0x48dcc2[_0x0f11('0x25')]){if(_0x48dcc2[_0x0f11('0x25')]['code']===0x1f4){logger[_0x0f11('0x25')]('MailMessage,\x20%s,\x20%s',_0x47a890,_0x48dcc2[_0x0f11('0x25')][_0x0f11('0x26')]);return _0x1f8533(_0x48dcc2[_0x0f11('0x25')][_0x0f11('0x26')]);}logger[_0x0f11('0x25')](_0x0f11('0x20'),_0x47a890,_0x48dcc2[_0x0f11('0x25')][_0x0f11('0x26')]);return _0x3b08c4(_0x48dcc2[_0x0f11('0x25')][_0x0f11('0x26')]);}else{logger[_0x0f11('0x1f')](_0x0f11('0x20'),_0x47a890,_0x0f11('0x21'));_0x3b08c4(_0x48dcc2['result'][_0x0f11('0x26')]);}})[_0x0f11('0x27')](function(_0x156ab8){logger['error'](_0x0f11('0x20'),_0x47a890,_0x156ab8);_0x1f8533(_0x156ab8);});});}function respondWithStatusCode(_0x4d0f36,_0x70a2e1){_0x70a2e1=_0x70a2e1||0xcc;return function(_0x2ac8e0){if(_0x2ac8e0){return _0x4d0f36[_0x0f11('0x28')](_0x70a2e1);}return _0x4d0f36[_0x0f11('0x29')](_0x70a2e1)[_0x0f11('0x2a')]();};}function respondWithResult(_0x24a124,_0x31bf76){_0x31bf76=_0x31bf76||0xc8;return function(_0x4796ed){if(_0x4796ed){return _0x24a124[_0x0f11('0x29')](_0x31bf76)['json'](_0x4796ed);}};}function respondWithFilteredResult(_0x205374,_0x4dae71){return function(_0x376c07){if(_0x376c07){var _0x3dd379=_0x376c07['count'],_0x1c7175=_0x4dae71['offset'],_0x3c2629=_0x4dae71[_0x0f11('0x2b')]+_0x4dae71['limit'],_0x17af04;if(_0x3c2629>=_0x3dd379){_0x3c2629=_0x3dd379;_0x17af04=0xc8;}else{_0x17af04=0xce;}_0x205374['status'](_0x17af04);return _0x205374[_0x0f11('0x2c')](_0x0f11('0x2d'),_0x1c7175+'-'+_0x3c2629+'/'+_0x3dd379)[_0x0f11('0x2e')](_0x376c07);}return null;};}function patchUpdates(_0xe3697){return function(_0x3e3152){try{jsonpatch[_0x0f11('0x2f')](_0x3e3152,_0xe3697,!![]);}catch(_0x11e167){return BPromise[_0x0f11('0x30')](_0x11e167);}return _0x3e3152[_0x0f11('0x31')]();};}function saveUpdates(_0x5c8248,_0x2979dd){return function(_0x2028f7){if(_0x2028f7){return _0x2028f7[_0x0f11('0x32')](_0x5c8248)[_0x0f11('0x33')](function(_0x577fcc){return _0x577fcc;});}return null;};}function removeEntity(_0x4da44a,_0x46539d){return function(_0x4d616a){if(_0x4d616a){return _0x4d616a[_0x0f11('0x34')]()[_0x0f11('0x33')](function(){_0x4da44a[_0x0f11('0x29')](0xcc)[_0x0f11('0x2a')]();});}};}function handleEntityNotFound(_0x409a6d,_0x2d030c){return function(_0x8aa216){if(!_0x8aa216){_0x409a6d[_0x0f11('0x28')](0x194);}return _0x8aa216;};}function handleError(_0xddceea,_0x5241d1){_0x5241d1=_0x5241d1||0x1f4;return function(_0x5b82ff){logger['error'](_0x5b82ff[_0x0f11('0x35')]);if(_0x5b82ff['name']){delete _0x5b82ff[_0x0f11('0x36')];}_0xddceea[_0x0f11('0x29')](_0x5241d1)[_0x0f11('0x37')](_0x5b82ff);};}exports[_0x0f11('0x38')]=function(_0x53aecc,_0x544411){var _0x514c22={},_0x2cde52={},_0x403510={'count':0x0,'rows':[]};var _0xcb9990=_[_0x0f11('0x39')](db[_0x0f11('0x3a')]['rawAttributes'],function(_0x24c60b){return{'name':_0x24c60b[_0x0f11('0x3b')],'type':_0x24c60b[_0x0f11('0x3c')]['key']};});_0x2cde52[_0x0f11('0x3d')]=_[_0x0f11('0x39')](_0xcb9990,'name');_0x2cde52[_0x0f11('0x3e')]=_[_0x0f11('0x3f')](_0x53aecc['query']);_0x2cde52[_0x0f11('0x40')]=_[_0x0f11('0x41')](_0x2cde52['model'],_0x2cde52['query']);_0x514c22[_0x0f11('0x42')]=_[_0x0f11('0x41')](_0x2cde52[_0x0f11('0x3d')],qs['fields'](_0x53aecc['query'][_0x0f11('0x43')]));_0x514c22[_0x0f11('0x42')]=_0x514c22[_0x0f11('0x42')][_0x0f11('0x44')]?_0x514c22[_0x0f11('0x42')]:_0x2cde52['model'];if(!_0x53aecc[_0x0f11('0x3e')][_0x0f11('0x45')](_0x0f11('0x46'))){_0x514c22[_0x0f11('0x47')]=qs['limit'](_0x53aecc[_0x0f11('0x3e')][_0x0f11('0x47')]);_0x514c22[_0x0f11('0x2b')]=qs[_0x0f11('0x2b')](_0x53aecc[_0x0f11('0x3e')]['offset']);}_0x514c22[_0x0f11('0x48')]=qs['sort'](_0x53aecc[_0x0f11('0x3e')]['sort']);_0x514c22[_0x0f11('0x49')]=qs[_0x0f11('0x40')](_[_0x0f11('0x4a')](_0x53aecc[_0x0f11('0x3e')],_0x2cde52[_0x0f11('0x40')]),_0xcb9990);if(_0x53aecc['query'][_0x0f11('0x4b')]){_0x514c22[_0x0f11('0x49')]=_['merge'](_0x514c22[_0x0f11('0x49')],{'$or':_[_0x0f11('0x39')](_0xcb9990,function(_0x457712){if(_0x457712[_0x0f11('0x3c')]!=='VIRTUAL'){var _0x23ca98={};_0x23ca98[_0x457712[_0x0f11('0x36')]]={'$like':'%'+_0x53aecc['query'][_0x0f11('0x4b')]+'%'};return _0x23ca98;}})});}_0x514c22=_[_0x0f11('0x4c')]({},_0x514c22,_0x53aecc[_0x0f11('0x4d')]);var _0x38ae4a={'where':_0x514c22[_0x0f11('0x49')]};return db[_0x0f11('0x3a')][_0x0f11('0x4e')](_0x38ae4a)['then'](function(_0xdf2c5c){_0x403510[_0x0f11('0x4e')]=_0xdf2c5c;if(_0x53aecc[_0x0f11('0x3e')][_0x0f11('0x4f')]){_0x514c22[_0x0f11('0x50')]=[{'all':!![]}];}return db[_0x0f11('0x3a')]['findAll'](_0x514c22);})[_0x0f11('0x33')](function(_0xa1666e){_0x403510[_0x0f11('0x51')]=_0xa1666e;return _0x403510;})[_0x0f11('0x33')](respondWithFilteredResult(_0x544411,_0x514c22))[_0x0f11('0x27')](handleError(_0x544411,null));};exports['show']=function(_0x120f75,_0x4fddbc){var _0x23b6f1={'raw':!![],'where':{'id':_0x120f75['params']['id']}},_0x2ae2e3={};_0x2ae2e3[_0x0f11('0x3d')]=_[_0x0f11('0x3f')](db[_0x0f11('0x3a')][_0x0f11('0x52')]);_0x2ae2e3[_0x0f11('0x3e')]=_[_0x0f11('0x3f')](_0x120f75[_0x0f11('0x3e')]);_0x2ae2e3['filters']=_['intersection'](_0x2ae2e3[_0x0f11('0x3d')],_0x2ae2e3['query']);_0x23b6f1[_0x0f11('0x42')]=_[_0x0f11('0x41')](_0x2ae2e3['model'],qs[_0x0f11('0x43')](_0x120f75['query'][_0x0f11('0x43')]));_0x23b6f1['attributes']=_0x23b6f1[_0x0f11('0x42')][_0x0f11('0x44')]?_0x23b6f1[_0x0f11('0x42')]:_0x2ae2e3['model'];if(_0x120f75[_0x0f11('0x3e')][_0x0f11('0x4f')]){_0x23b6f1[_0x0f11('0x50')]=[{'all':!![]}];}_0x23b6f1=_[_0x0f11('0x4c')]({},_0x23b6f1,_0x120f75[_0x0f11('0x4d')]);return db['MailMessage']['find'](_0x23b6f1)[_0x0f11('0x33')](handleEntityNotFound(_0x4fddbc,null))[_0x0f11('0x33')](respondWithResult(_0x4fddbc,null))['catch'](handleError(_0x4fddbc,null));};exports[_0x0f11('0x32')]=function(_0x21c2af,_0x40e07e){if(_0x21c2af[_0x0f11('0x53')]['id']){delete _0x21c2af['body']['id'];}return db[_0x0f11('0x3a')][_0x0f11('0x54')]({'where':{'id':_0x21c2af['params']['id']}})['then'](handleEntityNotFound(_0x40e07e,null))['then'](saveUpdates(_0x21c2af[_0x0f11('0x53')],null))[_0x0f11('0x33')](respondWithResult(_0x40e07e,null))[_0x0f11('0x27')](handleError(_0x40e07e,null));};exports[_0x0f11('0x34')]=function(_0x5b5e50,_0x1d692d){return db[_0x0f11('0x3a')][_0x0f11('0x54')]({'where':{'id':_0x5b5e50[_0x0f11('0x55')]['id']}})[_0x0f11('0x33')](handleEntityNotFound(_0x1d692d,null))['then'](removeEntity(_0x1d692d,null))[_0x0f11('0x27')](handleError(_0x1d692d,null));};exports[_0x0f11('0x56')]=function(_0x463fb4,_0x563451){return db[_0x0f11('0x3a')]['describe']()[_0x0f11('0x33')](respondWithResult(_0x563451,null))[_0x0f11('0x27')](handleError(_0x563451,null));};exports[_0x0f11('0x57')]=function(_0x1a492a,_0x343650){return db[_0x0f11('0x3a')]['create'](_0x1a492a[_0x0f11('0x53')])[_0x0f11('0x33')](function(_0x785b5f){if(_0x785b5f){if(_0x785b5f[_0x0f11('0x58')]===_0x0f11('0x59')&&!_0x785b5f['secret']){var _0xc244b4,_0xfb149a,_0x3a1e54;if(_0x1a492a[_0x0f11('0x53')]['to']){_0xfb149a=_0x1a492a[_0x0f11('0x53')]['to'][_0x0f11('0x5a')](',')[0x0];}return db['MailAccount'][_0x0f11('0x5b')]({'where':{'id':_0x785b5f[_0x0f11('0x5c')]},'include':[{'model':db['CmList'],'as':_0x0f11('0x5d'),'include':[{'model':db[_0x0f11('0x5e')],'as':_0x0f11('0x5f'),'where':{'email':_0xfb149a},'limit':0x1,'order':[[_0x0f11('0x60'),'DESC']]}]},{'model':db[_0x0f11('0x61')],'as':_0x0f11('0x62'),'raw':!![]}]})[_0x0f11('0x33')](function(_0x4e86de){_0xc244b4=_0x4e86de;if(_0xc244b4&&_0xc244b4[_0x0f11('0x62')]){var _0x45d876={'tls':{'rejectUnauthorized':![]}};if(_[_0x0f11('0x63')](_0xc244b4[_0x0f11('0x62')][_0x0f11('0x64')])){_0x45d876[_0x0f11('0x65')]=_0xc244b4[_0x0f11('0x62')][_0x0f11('0x65')];_0x45d876[_0x0f11('0x66')]=_0xc244b4['Smtp'][_0x0f11('0x66')];_0x45d876[_0x0f11('0x67')]=_0xc244b4[_0x0f11('0x62')]['secure'];if(_0xc244b4['Smtp'][_0x0f11('0x68')]){_0x45d876['auth']={'user':_0xc244b4['Smtp'][_0x0f11('0x69')],'pass':_0xc244b4['Smtp'][_0x0f11('0x6a')]};}}else{_0x45d876[_0x0f11('0x64')]=_0xc244b4[_0x0f11('0x62')][_0x0f11('0x64')];_0x45d876[_0x0f11('0x6b')]={'user':_0xc244b4[_0x0f11('0x62')][_0x0f11('0x69')],'pass':_0xc244b4['Smtp']['pass']};_0x45d876[_0x0f11('0x67')]=_0xc244b4['Smtp'][_0x0f11('0x67')];}if(_0x1a492a['body'][_0x0f11('0x6c')]&&_0x1a492a['body'][_0x0f11('0x6c')][_0x0f11('0x44')]){for(var _0x26b032=0x0;_0x26b032<_0x1a492a[_0x0f11('0x53')]['attachments'][_0x0f11('0x44')];_0x26b032+=0x1){_0x1a492a[_0x0f11('0x53')]['attachments'][_0x26b032]={'filename':_0x1a492a[_0x0f11('0x53')]['attachments'][_0x26b032][_0x0f11('0x36')],'path':path[_0x0f11('0x6d')](config[_0x0f11('0x6e')],_0x0f11('0x6f'),_0x1a492a[_0x0f11('0x53')][_0x0f11('0x6c')][_0x26b032][_0x0f11('0x70')])};}}_0x3a1e54={'account':_0x45d876,'message':_0x1a492a[_0x0f11('0x53')]};return;}})[_0x0f11('0x33')](function(){if(_0xc244b4[_0x0f11('0x5d')]){if(_0xc244b4[_0x0f11('0x5d')][_0x0f11('0x5f')][_0x0f11('0x44')]){return _0xc244b4[_0x0f11('0x5d')][_0x0f11('0x5f')][0x0];}else{return db[_0x0f11('0x5e')]['create'](_[_0x0f11('0x71')](_0x1a492a[_0x0f11('0x53')],{'firstName':_0x1a492a[_0x0f11('0x53')]['to'],'email':_0x1a492a[_0x0f11('0x53')]['to'],'phone':_0x1a492a['body']['to'],'ListId':_0xc244b4[_0x0f11('0x72')]}));}}else{throw new Error(_0x0f11('0x73'));}})[_0x0f11('0x33')](function(){if(_0x3a1e54){return respondWithRpcPromise(_0x0f11('0x74'),_0x0f11('0x75'),_0x3a1e54,client9003)[_0x0f11('0x33')](function(_0x36dcc2){return _0x785b5f['update']({'read':!![],'messageId':_0x36dcc2[_0x0f11('0x76')],'sentAt':moment()[_0x0f11('0x77')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x2bd7ab){logger[_0x0f11('0x25')]('%s',JSON[_0x0f11('0x24')](_0x2bd7ab));return _0x785b5f;});}return _0x785b5f;});}return _0x785b5f;}})[_0x0f11('0x33')](respondWithResult(_0x343650,0xc9))[_0x0f11('0x27')](handleError(_0x343650,null));};var interaction_log=require('../../config/logger')(_0x0f11('0x78'));exports[_0x0f11('0x79')]=function(_0x20cfad,_0x3208a8,_0x32d94f){var _0xd8f45={'agent':{},'channel':_0x0f11('0x7a')};if(_0x20cfad[_0x0f11('0x53')]['id']){delete _0x20cfad[_0x0f11('0x53')]['id'];}_0x20cfad['body'][_0x0f11('0x7b')]=!![];_0x20cfad[_0x0f11('0x53')][_0x0f11('0x7c')]=moment()[_0x0f11('0x77')](_0x0f11('0x7d'));_0x20cfad[_0x0f11('0x53')][_0x0f11('0x7e')]=_0x20cfad[_0x0f11('0x53')]['UserId']||_0x20cfad['user']['id'];_0xd8f45[_0x0f11('0x7f')]['id']=_0x20cfad[_0x0f11('0x53')][_0x0f11('0x7e')];return db[_0x0f11('0x3a')][_0x0f11('0x54')]({'where':{'id':_0x20cfad['params']['id'],'UserId':null},'include':[{'model':db[_0x0f11('0x5e')],'as':_0x0f11('0x80')}]})[_0x0f11('0x33')](handleEntityNotFound(_0x3208a8,null))[_0x0f11('0x33')](saveUpdates(_0x20cfad[_0x0f11('0x53')],null))[_0x0f11('0x33')](function(_0x402936){if(_0x402936){_0xd8f45['message']=_0x402936[_0x0f11('0x81')]({'plain':!![]});return db[_0x0f11('0x82')][_0x0f11('0x54')]({'where':{'id':_0x402936['MailInteractionId']}});}return null;})[_0x0f11('0x33')](handleEntityNotFound(_0x3208a8,null))[_0x0f11('0x33')](function(_0x47085e){if(_0x47085e){return _0x47085e['update']({'UserId':_0x20cfad[_0x0f11('0x53')][_0x0f11('0x7e')],'read1stAt':_[_0x0f11('0x63')](_0x47085e[_0x0f11('0x83')])?moment()[_0x0f11('0x77')](_0x0f11('0x7d')):undefined});}return null;})[_0x0f11('0x33')](function(_0x2ecfac){if(_0x2ecfac){_0xd8f45[_0x0f11('0x84')]=_0x2ecfac[_0x0f11('0x81')]({'plain':!![]});interaction_log[_0x0f11('0x1f')](_0x0f11('0x85'),_0x20cfad[_0x0f11('0x69')]['id'],_0x20cfad[_0x0f11('0x69')][_0x0f11('0x36')],_0x20cfad[_0x0f11('0x69')]['role'],_0xd8f45[_0x0f11('0x84')]['id'],_0x20cfad[_0x0f11('0x53')]?JSON[_0x0f11('0x24')](_0x20cfad['body']):'null');return respondWithRpcPromise(_0x0f11('0x86'),'acceptMessage',_0xd8f45);}return null;})[_0x0f11('0x33')](function(_0x455bf4){if(_0x455bf4){if(_0x20cfad['body'][_0x0f11('0x87')]){_0xd8f45[_0x0f11('0x26')]['interface']=util['format'](_0x0f11('0x88'),_0x20cfad['user']['name']);_0xd8f45['message'][_0x0f11('0x89')]=_0xd8f45['channel'];_0xd8f45['message'][_0x0f11('0x8a')]='accept';return respondWithRpcPromise(_0x0f11('0x8b'),'EventManager',{'event':_0x0f11('0x8c'),'message':_0xd8f45[_0x0f11('0x26')]},client9002)[_0x0f11('0x33')](function(){return _0xd8f45;});}return _0xd8f45;}return null;})[_0x0f11('0x33')](respondWithResult(_0x3208a8,null))[_0x0f11('0x27')](handleError(_0x3208a8,null));};var interaction_log=require(_0x0f11('0x11'))(_0x0f11('0x78'));exports[_0x0f11('0x30')]=function(_0x21ee28,_0x15b3f7,_0x1b9154){var _0x4956ae={'agent':{},'channel':_0x0f11('0x7a')};if(_0x21ee28[_0x0f11('0x53')]['id']){delete _0x21ee28[_0x0f11('0x53')]['id'];}_0x21ee28[_0x0f11('0x53')][_0x0f11('0x7e')]=_0x21ee28[_0x0f11('0x53')][_0x0f11('0x7e')]||_0x21ee28[_0x0f11('0x69')]['id'];_0x4956ae['agent']['id']=_0x21ee28[_0x0f11('0x53')][_0x0f11('0x7e')];return db[_0x0f11('0x3a')][_0x0f11('0x54')]({'where':{'id':_0x21ee28['params']['id'],'UserId':null}})[_0x0f11('0x33')](handleEntityNotFound(_0x15b3f7,null))[_0x0f11('0x33')](function(_0x57b448){if(_0x57b448){_0x4956ae[_0x0f11('0x26')]=_0x57b448[_0x0f11('0x81')]({'plain':!![]});return db[_0x0f11('0x82')][_0x0f11('0x54')]({'where':{'id':_0x57b448[_0x0f11('0x8d')]}});}return null;})[_0x0f11('0x33')](handleEntityNotFound(_0x15b3f7,null))[_0x0f11('0x33')](function(_0x52d3cb){if(_0x52d3cb){_0x4956ae[_0x0f11('0x84')]=_0x52d3cb[_0x0f11('0x81')]({'plain':!![]});interaction_log['info'](_0x0f11('0x8e'),_0x21ee28['user']['id'],_0x21ee28[_0x0f11('0x69')][_0x0f11('0x36')],_0x21ee28[_0x0f11('0x69')][_0x0f11('0x8f')],_0x4956ae[_0x0f11('0x84')]['id'],_0x21ee28[_0x0f11('0x53')]?JSON[_0x0f11('0x24')](_0x21ee28[_0x0f11('0x53')]):_0x0f11('0x90'));return respondWithRpcPromise(_0x0f11('0x91'),_0x0f11('0x92'),_0x4956ae);}return null;})['then'](function(_0x120854){if(_0x120854){_0x120854['message'][_0x0f11('0x93')]=util[_0x0f11('0x77')]('SIP/%s',_0x21ee28[_0x0f11('0x69')]['name']);_0x120854['message'][_0x0f11('0x89')]=_0x4956ae[_0x0f11('0x89')];_0x120854[_0x0f11('0x26')][_0x0f11('0x8a')]=_0x0f11('0x30');respondWithRpcPromise('EventManager',_0x0f11('0x8b'),{'event':'rejectmessage','message':_0x120854[_0x0f11('0x26')]},client9002);return _0x4956ae;}return null;})['then'](respondWithResult(_0x15b3f7,null))[_0x0f11('0x27')](handleError(_0x15b3f7,null));};exports[_0x0f11('0x94')]=function(_0x68db85,_0x3b79ec){var _0x46c4a4=moment()[_0x0f11('0x95')]()[_0x0f11('0x96')]();var _0x30f58c=path[_0x0f11('0x6d')](config[_0x0f11('0x6e')],_0x0f11('0x97'),_0x0f11('0x98'),'tmp');var _0x86ccca=path[_0x0f11('0x6d')](config[_0x0f11('0x6e')],_0x0f11('0x97'),_0x0f11('0x98'),_0x0f11('0x6c'));var _0x152cef=util[_0x0f11('0x77')]('message-%s.eml',_0x46c4a4);return db[_0x0f11('0x3a')][_0x0f11('0x54')]({'where':{'id':_0x68db85['params']['id']},'attributes':['id',_0x0f11('0x53'),_0x0f11('0x99'),'to','cc',_0x0f11('0x9a'),_0x0f11('0x9b'),_0x0f11('0x9c')],'include':_0x68db85[_0x0f11('0x3e')][_0x0f11('0x6c')]?[{'model':db[_0x0f11('0x9d')],'as':_0x0f11('0x9e')}]:undefined})[_0x0f11('0x33')](handleEntityNotFound(_0x3b79ec,null))[_0x0f11('0x33')](function(_0x1fc43f){if(_0x1fc43f){var _0x339910=_0x1fc43f;var _0x302c7e={'from':_0x339910[_0x0f11('0x99')],'to':_0x339910['to'],'subject':_0x339910['subject'],'html':_0x339910[_0x0f11('0x53')],'headers':{'Date':moment(_0x339910[_0x0f11('0x9c')])['format'](_0x0f11('0x9f'))},'attachments':[]};if(_0x1fc43f['cc']){_0x302c7e[_0x0f11('0xa0')]['Cc']=_0x1fc43f['cc'];}if(_0x1fc43f[_0x0f11('0x9a')]){_0x302c7e[_0x0f11('0xa0')]['Bcc']=_0x1fc43f[_0x0f11('0x9a')];}return new BPromise(function(_0x57decc,_0x530714){if(_0x1fc43f[_0x0f11('0x9e')]){for(var _0x3fb01f=0x0;_0x3fb01f<_0x1fc43f[_0x0f11('0x9e')][_0x0f11('0x44')];_0x3fb01f++){var _0x398737=_0x1fc43f['Attachments'][_0x3fb01f];var _0x3ffc45=path[_0x0f11('0x6d')](_0x86ccca,_0x398737[_0x0f11('0x70')]);if(fs['existsSync'](_0x3ffc45)){_0x302c7e[_0x0f11('0x6c')][_0x0f11('0xa1')]({'name':_0x398737[_0x0f11('0x36')],'contentType':_0x398737[_0x0f11('0x3c')],'data':fs[_0x0f11('0xa2')](_0x3ffc45)});}}}emlformat[_0x0f11('0xa3')](_0x302c7e,function(_0x122233,_0x5cf8df){if(_0x122233)return _0x530714(_0x122233);fs['writeFileSync'](path[_0x0f11('0x6d')](_0x30f58c,_0x152cef),_0x5cf8df);return _0x57decc(_0x5cf8df);});});}})[_0x0f11('0x33')](function(_0x238e1f){if(_0x238e1f){return _0x3b79ec[_0x0f11('0x94')](path[_0x0f11('0x6d')](_0x30f58c,_0x152cef),_0x152cef,function(_0x3cd754){if(_0x3cd754){console[_0x0f11('0xa4')](_0x0f11('0xa5'),_0x3cd754);}else{fs[_0x0f11('0xa6')](path[_0x0f11('0x6d')](_0x30f58c,_0x152cef));}});}})[_0x0f11('0x27')](handleError(_0x3b79ec,null));}; \ No newline at end of file +var _0x86ea=['include','findAll','show','find','body','params','describe','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','service','host','port','secure','authentication','pass','auth','attachments','join','server/files/attachments','basename','List','create','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','accept','read','readAt','UserId','user','agent','Contact','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','role','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','mail-interactions','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','unix','root','server','files','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','download','log','err','unlinkSync','eml-format','zip-dir','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','MailMessage','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll'];(function(_0x459335,_0x2e95dd){var _0x50f00b=function(_0x5ccdaf){while(--_0x5ccdaf){_0x459335['push'](_0x459335['shift']());}};_0x50f00b(++_0x2e95dd);}(_0x86ea,0x103));var _0xa86e=function(_0x1f9de4,_0x9b0515){_0x1f9de4=_0x1f9de4-0x0;var _0x3e9603=_0x86ea[_0x1f9de4];return _0x3e9603;};'use strict';var emlformat=require(_0xa86e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa86e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa86e('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa86e('0x3'));var util=require('util');var path=require(_0xa86e('0x4'));var sox=require(_0xa86e('0x5'));var csv=require(_0xa86e('0x6'));var ejs=require(_0xa86e('0x7'));var fs=require('fs');var fs_extra=require(_0xa86e('0x8'));var _=require(_0xa86e('0x9'));var squel=require(_0xa86e('0xa'));var crypto=require(_0xa86e('0xb'));var jsforce=require(_0xa86e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa86e('0x6'));var querystring=require(_0xa86e('0xd'));var Papa=require(_0xa86e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa86e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa86e('0x10'));var logger=require('../../config/logger')(_0xa86e('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa86e('0x12'));var db=require(_0xa86e('0x13'))['db'];config[_0xa86e('0x14')]=_[_0xa86e('0x15')](config[_0xa86e('0x14')],{'host':_0xa86e('0x16'),'port':0x18eb});var socket=require(_0xa86e('0x17'))(new Redis(config[_0xa86e('0x14')]));require('./mailMessage.socket')[_0xa86e('0x18')](socket);var jayson=require(_0xa86e('0x19'));var client=jayson[_0xa86e('0x1a')][_0xa86e('0x1b')]({'port':0x232c});var client9003=jayson[_0xa86e('0x1a')][_0xa86e('0x1b')]({'port':0x232b});var client9002=jayson[_0xa86e('0x1a')][_0xa86e('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5359e1,_0x3a5191,_0x2f2092,_0x14b2b8){return new BPromise(function(_0x377887,_0xce34c2){var _0x1f7fc5=_0x14b2b8||client;return _0x1f7fc5[_0xa86e('0x1c')](_0x5359e1,_0x2f2092)['then'](function(_0x2b1790){logger[_0xa86e('0x1d')](_0xa86e('0x1e'),_0x3a5191,_0xa86e('0x1f'));logger[_0xa86e('0x20')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x3a5191,_0xa86e('0x1f'),JSON[_0xa86e('0x21')](_0x2b1790));if(_0x2b1790['error']){if(_0x2b1790[_0xa86e('0x22')][_0xa86e('0x23')]===0x1f4){logger[_0xa86e('0x22')](_0xa86e('0x1e'),_0x3a5191,_0x2b1790[_0xa86e('0x22')][_0xa86e('0x24')]);return _0xce34c2(_0x2b1790[_0xa86e('0x22')][_0xa86e('0x24')]);}logger[_0xa86e('0x22')]('MailMessage,\x20%s,\x20%s',_0x3a5191,_0x2b1790['error'][_0xa86e('0x24')]);return _0x377887(_0x2b1790['error'][_0xa86e('0x24')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x3a5191,'request\x20sent');_0x377887(_0x2b1790[_0xa86e('0x25')][_0xa86e('0x24')]);}})[_0xa86e('0x26')](function(_0xa19bb7){logger['error'](_0xa86e('0x1e'),_0x3a5191,_0xa19bb7);_0xce34c2(_0xa19bb7);});});}function respondWithStatusCode(_0x10e390,_0x474130){_0x474130=_0x474130||0xcc;return function(_0x2745c3){if(_0x2745c3){return _0x10e390['sendStatus'](_0x474130);}return _0x10e390[_0xa86e('0x27')](_0x474130)[_0xa86e('0x28')]();};}function respondWithResult(_0x38ab37,_0x448e62){_0x448e62=_0x448e62||0xc8;return function(_0x491706){if(_0x491706){return _0x38ab37[_0xa86e('0x27')](_0x448e62)[_0xa86e('0x29')](_0x491706);}};}function respondWithFilteredResult(_0x2cadc0,_0xd13aec){return function(_0x9820b6){if(_0x9820b6){var _0x32fe1f=_0x9820b6[_0xa86e('0x2a')],_0x738895=_0xd13aec[_0xa86e('0x2b')],_0x167cf9=_0xd13aec[_0xa86e('0x2b')]+_0xd13aec['limit'],_0x2ecfd6;if(_0x167cf9>=_0x32fe1f){_0x167cf9=_0x32fe1f;_0x2ecfd6=0xc8;}else{_0x2ecfd6=0xce;}_0x2cadc0[_0xa86e('0x27')](_0x2ecfd6);return _0x2cadc0[_0xa86e('0x2c')](_0xa86e('0x2d'),_0x738895+'-'+_0x167cf9+'/'+_0x32fe1f)['json'](_0x9820b6);}return null;};}function patchUpdates(_0x307181){return function(_0x85ffce){try{jsonpatch[_0xa86e('0x2e')](_0x85ffce,_0x307181,!![]);}catch(_0x4cfc76){return BPromise[_0xa86e('0x2f')](_0x4cfc76);}return _0x85ffce[_0xa86e('0x30')]();};}function saveUpdates(_0x2a13d4,_0x25063f){return function(_0x22d55c){if(_0x22d55c){return _0x22d55c[_0xa86e('0x31')](_0x2a13d4)[_0xa86e('0x32')](function(_0x74f734){return _0x74f734;});}return null;};}function removeEntity(_0x1f128c,_0x17ff48){return function(_0xd1e06b){if(_0xd1e06b){return _0xd1e06b[_0xa86e('0x33')]()[_0xa86e('0x32')](function(){_0x1f128c[_0xa86e('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11254e,_0x251859){return function(_0x21f5ac){if(!_0x21f5ac){_0x11254e[_0xa86e('0x34')](0x194);}return _0x21f5ac;};}function handleError(_0x3726fb,_0x760806){_0x760806=_0x760806||0x1f4;return function(_0xa4e734){logger[_0xa86e('0x22')](_0xa4e734[_0xa86e('0x35')]);if(_0xa4e734[_0xa86e('0x36')]){delete _0xa4e734[_0xa86e('0x36')];}_0x3726fb[_0xa86e('0x27')](_0x760806)['send'](_0xa4e734);};}exports['index']=function(_0xf4a8cf,_0x28dd51){var _0x525355={},_0x15bd7e={},_0x5e96bf={'count':0x0,'rows':[]};var _0x3e928f=_['map'](db[_0xa86e('0x37')][_0xa86e('0x38')],function(_0x97995d){return{'name':_0x97995d[_0xa86e('0x39')],'type':_0x97995d['type'][_0xa86e('0x3a')]};});_0x15bd7e[_0xa86e('0x3b')]=_[_0xa86e('0x3c')](_0x3e928f,_0xa86e('0x36'));_0x15bd7e[_0xa86e('0x3d')]=_['keys'](_0xf4a8cf[_0xa86e('0x3d')]);_0x15bd7e[_0xa86e('0x3e')]=_[_0xa86e('0x3f')](_0x15bd7e['model'],_0x15bd7e[_0xa86e('0x3d')]);_0x525355[_0xa86e('0x40')]=_[_0xa86e('0x3f')](_0x15bd7e[_0xa86e('0x3b')],qs[_0xa86e('0x41')](_0xf4a8cf[_0xa86e('0x3d')][_0xa86e('0x41')]));_0x525355['attributes']=_0x525355['attributes'][_0xa86e('0x42')]?_0x525355['attributes']:_0x15bd7e['model'];if(!_0xf4a8cf[_0xa86e('0x3d')]['hasOwnProperty'](_0xa86e('0x43'))){_0x525355[_0xa86e('0x44')]=qs[_0xa86e('0x44')](_0xf4a8cf['query'][_0xa86e('0x44')]);_0x525355[_0xa86e('0x2b')]=qs[_0xa86e('0x2b')](_0xf4a8cf['query'][_0xa86e('0x2b')]);}_0x525355[_0xa86e('0x45')]=qs[_0xa86e('0x46')](_0xf4a8cf[_0xa86e('0x3d')][_0xa86e('0x46')]);_0x525355[_0xa86e('0x47')]=qs[_0xa86e('0x3e')](_[_0xa86e('0x48')](_0xf4a8cf['query'],_0x15bd7e[_0xa86e('0x3e')]),_0x3e928f);if(_0xf4a8cf[_0xa86e('0x3d')]['filter']){_0x525355['where']=_[_0xa86e('0x49')](_0x525355[_0xa86e('0x47')],{'$or':_[_0xa86e('0x3c')](_0x3e928f,function(_0x3d3b92){if(_0x3d3b92[_0xa86e('0x4a')]!==_0xa86e('0x4b')){var _0x59d73b={};_0x59d73b[_0x3d3b92[_0xa86e('0x36')]]={'$like':'%'+_0xf4a8cf['query'][_0xa86e('0x4c')]+'%'};return _0x59d73b;}})});}_0x525355=_[_0xa86e('0x49')]({},_0x525355,_0xf4a8cf[_0xa86e('0x4d')]);var _0x5e57d1={'where':_0x525355[_0xa86e('0x47')]};return db['MailMessage'][_0xa86e('0x2a')](_0x5e57d1)[_0xa86e('0x32')](function(_0x20ede1){_0x5e96bf[_0xa86e('0x2a')]=_0x20ede1;if(_0xf4a8cf[_0xa86e('0x3d')][_0xa86e('0x4e')]){_0x525355[_0xa86e('0x4f')]=[{'all':!![]}];}return db['MailMessage'][_0xa86e('0x50')](_0x525355);})['then'](function(_0x158f20){_0x5e96bf['rows']=_0x158f20;return _0x5e96bf;})[_0xa86e('0x32')](respondWithFilteredResult(_0x28dd51,_0x525355))[_0xa86e('0x26')](handleError(_0x28dd51,null));};exports[_0xa86e('0x51')]=function(_0x138eef,_0x288743){var _0x3bfca={'raw':!![],'where':{'id':_0x138eef['params']['id']}},_0x14afc8={};_0x14afc8[_0xa86e('0x3b')]=_['keys'](db['MailMessage']['rawAttributes']);_0x14afc8[_0xa86e('0x3d')]=_['keys'](_0x138eef[_0xa86e('0x3d')]);_0x14afc8['filters']=_[_0xa86e('0x3f')](_0x14afc8[_0xa86e('0x3b')],_0x14afc8[_0xa86e('0x3d')]);_0x3bfca[_0xa86e('0x40')]=_[_0xa86e('0x3f')](_0x14afc8[_0xa86e('0x3b')],qs[_0xa86e('0x41')](_0x138eef[_0xa86e('0x3d')][_0xa86e('0x41')]));_0x3bfca['attributes']=_0x3bfca['attributes'][_0xa86e('0x42')]?_0x3bfca[_0xa86e('0x40')]:_0x14afc8[_0xa86e('0x3b')];if(_0x138eef['query'][_0xa86e('0x4e')]){_0x3bfca['include']=[{'all':!![]}];}_0x3bfca=_[_0xa86e('0x49')]({},_0x3bfca,_0x138eef[_0xa86e('0x4d')]);return db[_0xa86e('0x37')][_0xa86e('0x52')](_0x3bfca)['then'](handleEntityNotFound(_0x288743,null))[_0xa86e('0x32')](respondWithResult(_0x288743,null))[_0xa86e('0x26')](handleError(_0x288743,null));};exports['update']=function(_0x51dd8d,_0x5ea4df){if(_0x51dd8d[_0xa86e('0x53')]['id']){delete _0x51dd8d[_0xa86e('0x53')]['id'];}return db[_0xa86e('0x37')][_0xa86e('0x52')]({'where':{'id':_0x51dd8d['params']['id']}})[_0xa86e('0x32')](handleEntityNotFound(_0x5ea4df,null))[_0xa86e('0x32')](saveUpdates(_0x51dd8d[_0xa86e('0x53')],null))[_0xa86e('0x32')](respondWithResult(_0x5ea4df,null))[_0xa86e('0x26')](handleError(_0x5ea4df,null));};exports[_0xa86e('0x33')]=function(_0x2bce1a,_0x300dd9){return db[_0xa86e('0x37')][_0xa86e('0x52')]({'where':{'id':_0x2bce1a[_0xa86e('0x54')]['id']}})['then'](handleEntityNotFound(_0x300dd9,null))[_0xa86e('0x32')](removeEntity(_0x300dd9,null))['catch'](handleError(_0x300dd9,null));};exports[_0xa86e('0x55')]=function(_0x3fb00e,_0x4f7241){return db[_0xa86e('0x37')][_0xa86e('0x55')]()[_0xa86e('0x32')](respondWithResult(_0x4f7241,null))['catch'](handleError(_0x4f7241,null));};exports['create']=function(_0x1ad947,_0x424dfe){return db['MailMessage']['create'](_0x1ad947['body'])['then'](function(_0x5fb107){if(_0x5fb107){if(_0x5fb107[_0xa86e('0x56')]===_0xa86e('0x57')&&!_0x5fb107[_0xa86e('0x58')]){var _0x24ce3c,_0x11538f,_0x2e73f5;if(_0x1ad947[_0xa86e('0x53')]['to']){_0x11538f=_0x1ad947[_0xa86e('0x53')]['to'][_0xa86e('0x59')](',')[0x0];}return db[_0xa86e('0x5a')][_0xa86e('0x5b')]({'where':{'id':_0x5fb107[_0xa86e('0x5c')]},'include':[{'model':db[_0xa86e('0x5d')],'as':'List','include':[{'model':db[_0xa86e('0x5e')],'as':_0xa86e('0x5f'),'where':{'email':_0x11538f},'limit':0x1,'order':[[_0xa86e('0x60'),_0xa86e('0x61')]]}]},{'model':db[_0xa86e('0x62')],'as':_0xa86e('0x63'),'raw':!![]}]})[_0xa86e('0x32')](function(_0x19630c){_0x24ce3c=_0x19630c;if(_0x24ce3c&&_0x24ce3c[_0xa86e('0x63')]){var _0x50c28d={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x24ce3c[_0xa86e('0x63')][_0xa86e('0x64')])){_0x50c28d[_0xa86e('0x65')]=_0x24ce3c[_0xa86e('0x63')][_0xa86e('0x65')];_0x50c28d[_0xa86e('0x66')]=_0x24ce3c[_0xa86e('0x63')][_0xa86e('0x66')];_0x50c28d[_0xa86e('0x67')]=_0x24ce3c['Smtp'][_0xa86e('0x67')];if(_0x24ce3c['Smtp'][_0xa86e('0x68')]){_0x50c28d['auth']={'user':_0x24ce3c[_0xa86e('0x63')]['user'],'pass':_0x24ce3c[_0xa86e('0x63')][_0xa86e('0x69')]};}}else{_0x50c28d[_0xa86e('0x64')]=_0x24ce3c[_0xa86e('0x63')][_0xa86e('0x64')];_0x50c28d[_0xa86e('0x6a')]={'user':_0x24ce3c[_0xa86e('0x63')]['user'],'pass':_0x24ce3c[_0xa86e('0x63')][_0xa86e('0x69')]};_0x50c28d[_0xa86e('0x67')]=_0x24ce3c[_0xa86e('0x63')][_0xa86e('0x67')];}if(_0x1ad947[_0xa86e('0x53')][_0xa86e('0x6b')]&&_0x1ad947[_0xa86e('0x53')]['attachments'][_0xa86e('0x42')]){for(var _0x4a4331=0x0;_0x4a4331<_0x1ad947[_0xa86e('0x53')][_0xa86e('0x6b')][_0xa86e('0x42')];_0x4a4331+=0x1){_0x1ad947[_0xa86e('0x53')][_0xa86e('0x6b')][_0x4a4331]={'filename':_0x1ad947['body'][_0xa86e('0x6b')][_0x4a4331][_0xa86e('0x36')],'path':path[_0xa86e('0x6c')](config['root'],_0xa86e('0x6d'),_0x1ad947[_0xa86e('0x53')][_0xa86e('0x6b')][_0x4a4331][_0xa86e('0x6e')])};}}_0x2e73f5={'account':_0x50c28d,'message':_0x1ad947[_0xa86e('0x53')]};return;}})[_0xa86e('0x32')](function(){if(_0x24ce3c[_0xa86e('0x6f')]){if(_0x24ce3c[_0xa86e('0x6f')][_0xa86e('0x5f')]['length']){return _0x24ce3c['List'][_0xa86e('0x5f')][0x0];}else{return db[_0xa86e('0x5e')][_0xa86e('0x70')](_[_0xa86e('0x15')](_0x1ad947[_0xa86e('0x53')],{'firstName':_0x1ad947['body']['to'],'email':_0x1ad947[_0xa86e('0x53')]['to'],'phone':_0x1ad947[_0xa86e('0x53')]['to'],'ListId':_0x24ce3c['ListId']}));}}else{throw new Error('List\x20not\x20found');}})[_0xa86e('0x32')](function(){if(_0x2e73f5){return respondWithRpcPromise(_0xa86e('0x71'),_0xa86e('0x72'),_0x2e73f5,client9003)['then'](function(_0x3a62c6){return _0x5fb107['update']({'read':!![],'messageId':_0x3a62c6[_0xa86e('0x73')],'sentAt':moment()[_0xa86e('0x74')](_0xa86e('0x75'))});})[_0xa86e('0x26')](function(_0x4f9667){logger['error']('%s',JSON[_0xa86e('0x21')](_0x4f9667));return _0x5fb107;});}return _0x5fb107;});}return _0x5fb107;}})['then'](respondWithResult(_0x424dfe,0xc9))['catch'](handleError(_0x424dfe,null));};var interaction_log=require(_0xa86e('0x76'))('mail-interactions');exports[_0xa86e('0x77')]=function(_0x4cd5f7,_0x4f3db5,_0x524560){var _0x33ba99={'agent':{},'channel':'mail'};if(_0x4cd5f7['body']['id']){delete _0x4cd5f7[_0xa86e('0x53')]['id'];}_0x4cd5f7[_0xa86e('0x53')][_0xa86e('0x78')]=!![];_0x4cd5f7[_0xa86e('0x53')][_0xa86e('0x79')]=moment()['format'](_0xa86e('0x75'));_0x4cd5f7['body'][_0xa86e('0x7a')]=_0x4cd5f7[_0xa86e('0x53')][_0xa86e('0x7a')]||_0x4cd5f7[_0xa86e('0x7b')]['id'];_0x33ba99[_0xa86e('0x7c')]['id']=_0x4cd5f7[_0xa86e('0x53')][_0xa86e('0x7a')];return db[_0xa86e('0x37')][_0xa86e('0x52')]({'where':{'id':_0x4cd5f7['params']['id'],'UserId':null},'include':[{'model':db[_0xa86e('0x5e')],'as':_0xa86e('0x7d')}]})[_0xa86e('0x32')](handleEntityNotFound(_0x4f3db5,null))[_0xa86e('0x32')](saveUpdates(_0x4cd5f7[_0xa86e('0x53')],null))['then'](function(_0x34eeae){if(_0x34eeae){_0x33ba99[_0xa86e('0x24')]=_0x34eeae[_0xa86e('0x7e')]({'plain':!![]});return db[_0xa86e('0x7f')][_0xa86e('0x52')]({'where':{'id':_0x34eeae[_0xa86e('0x80')]}});}return null;})[_0xa86e('0x32')](handleEntityNotFound(_0x4f3db5,null))[_0xa86e('0x32')](function(_0x39fa8c){if(_0x39fa8c){return _0x39fa8c[_0xa86e('0x31')]({'UserId':_0x4cd5f7[_0xa86e('0x53')][_0xa86e('0x7a')],'read1stAt':_[_0xa86e('0x81')](_0x39fa8c[_0xa86e('0x82')])?moment()[_0xa86e('0x74')](_0xa86e('0x75')):undefined});}return null;})[_0xa86e('0x32')](function(_0x1364e5){if(_0x1364e5){_0x33ba99[_0xa86e('0x83')]=_0x1364e5[_0xa86e('0x7e')]({'plain':!![]});interaction_log[_0xa86e('0x1d')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4cd5f7['user']['id'],_0x4cd5f7[_0xa86e('0x7b')][_0xa86e('0x36')],_0x4cd5f7[_0xa86e('0x7b')][_0xa86e('0x84')],_0x33ba99[_0xa86e('0x83')]['id'],_0x4cd5f7[_0xa86e('0x53')]?JSON['stringify'](_0x4cd5f7[_0xa86e('0x53')]):'null');return respondWithRpcPromise(_0xa86e('0x85'),_0xa86e('0x86'),_0x33ba99);}return null;})[_0xa86e('0x32')](function(_0x56677b){if(_0x56677b){if(_0x4cd5f7[_0xa86e('0x53')]['manual']){_0x33ba99[_0xa86e('0x24')][_0xa86e('0x87')]=util[_0xa86e('0x74')](_0xa86e('0x88'),_0x4cd5f7[_0xa86e('0x7b')][_0xa86e('0x36')]);_0x33ba99[_0xa86e('0x24')]['channel']=_0x33ba99[_0xa86e('0x89')];_0x33ba99[_0xa86e('0x24')][_0xa86e('0x8a')]=_0xa86e('0x77');return respondWithRpcPromise(_0xa86e('0x8b'),_0xa86e('0x8b'),{'event':_0xa86e('0x8c'),'message':_0x33ba99[_0xa86e('0x24')]},client9002)['then'](function(){return _0x33ba99;});}return _0x33ba99;}return null;})[_0xa86e('0x32')](respondWithResult(_0x4f3db5,null))[_0xa86e('0x26')](handleError(_0x4f3db5,null));};var interaction_log=require(_0xa86e('0x76'))(_0xa86e('0x8d'));exports[_0xa86e('0x2f')]=function(_0x22317a,_0x552af2,_0x5782e0){var _0x35a48a={'agent':{},'channel':_0xa86e('0x8e')};if(_0x22317a['body']['id']){delete _0x22317a[_0xa86e('0x53')]['id'];}_0x22317a['body'][_0xa86e('0x7a')]=_0x22317a[_0xa86e('0x53')][_0xa86e('0x7a')]||_0x22317a[_0xa86e('0x7b')]['id'];_0x35a48a[_0xa86e('0x7c')]['id']=_0x22317a[_0xa86e('0x53')][_0xa86e('0x7a')];return db[_0xa86e('0x37')][_0xa86e('0x52')]({'where':{'id':_0x22317a[_0xa86e('0x54')]['id'],'UserId':null}})[_0xa86e('0x32')](handleEntityNotFound(_0x552af2,null))[_0xa86e('0x32')](function(_0x18212c){if(_0x18212c){_0x35a48a[_0xa86e('0x24')]=_0x18212c['get']({'plain':!![]});return db['MailInteraction'][_0xa86e('0x52')]({'where':{'id':_0x18212c[_0xa86e('0x80')]}});}return null;})[_0xa86e('0x32')](handleEntityNotFound(_0x552af2,null))[_0xa86e('0x32')](function(_0x6ff210){if(_0x6ff210){_0x35a48a['interaction']=_0x6ff210[_0xa86e('0x7e')]({'plain':!![]});interaction_log[_0xa86e('0x1d')](_0xa86e('0x8f'),_0x22317a['user']['id'],_0x22317a[_0xa86e('0x7b')][_0xa86e('0x36')],_0x22317a[_0xa86e('0x7b')][_0xa86e('0x84')],_0x35a48a[_0xa86e('0x83')]['id'],_0x22317a[_0xa86e('0x53')]?JSON[_0xa86e('0x21')](_0x22317a[_0xa86e('0x53')]):'null');return respondWithRpcPromise('RejectMessage',_0xa86e('0x90'),_0x35a48a);}return null;})[_0xa86e('0x32')](function(_0x33fde8){if(_0x33fde8){_0x33fde8[_0xa86e('0x24')][_0xa86e('0x87')]=util['format'](_0xa86e('0x88'),_0x22317a[_0xa86e('0x7b')][_0xa86e('0x36')]);_0x33fde8[_0xa86e('0x24')]['channel']=_0x35a48a[_0xa86e('0x89')];_0x33fde8[_0xa86e('0x24')][_0xa86e('0x8a')]='reject';respondWithRpcPromise('EventManager',_0xa86e('0x8b'),{'event':_0xa86e('0x91'),'message':_0x33fde8[_0xa86e('0x24')]},client9002);return _0x35a48a;}return null;})[_0xa86e('0x32')](respondWithResult(_0x552af2,null))[_0xa86e('0x26')](handleError(_0x552af2,null));};exports['download']=function(_0x59537c,_0x544a0a){var _0x2b61f1=moment()[_0xa86e('0x92')]()['toString']();var _0x5b58b8=path[_0xa86e('0x6c')](config[_0xa86e('0x93')],_0xa86e('0x94'),'files','tmp');var _0x863b50=path['join'](config[_0xa86e('0x93')],'server',_0xa86e('0x95'),_0xa86e('0x6b'));var _0x2896c7=util[_0xa86e('0x74')](_0xa86e('0x96'),_0x2b61f1);return db[_0xa86e('0x37')][_0xa86e('0x52')]({'where':{'id':_0x59537c['params']['id']},'attributes':['id','body',_0xa86e('0x97'),'to','cc',_0xa86e('0x98'),_0xa86e('0x99'),_0xa86e('0x9a')],'include':_0x59537c['query']['attachments']?[{'model':db[_0xa86e('0x9b')],'as':_0xa86e('0x9c')}]:undefined})[_0xa86e('0x32')](handleEntityNotFound(_0x544a0a,null))[_0xa86e('0x32')](function(_0x540eb4){if(_0x540eb4){var _0x5ab9ef=_0x540eb4;var _0x16ab2c={'from':_0x5ab9ef['from'],'to':_0x5ab9ef['to'],'subject':_0x5ab9ef['subject'],'html':_0x5ab9ef[_0xa86e('0x53')],'headers':{'Date':moment(_0x5ab9ef[_0xa86e('0x9a')])[_0xa86e('0x74')](_0xa86e('0x9d'))},'attachments':[]};if(_0x540eb4['cc']){_0x16ab2c[_0xa86e('0x9e')]['Cc']=_0x540eb4['cc'];}if(_0x540eb4[_0xa86e('0x98')]){_0x16ab2c[_0xa86e('0x9e')][_0xa86e('0x9f')]=_0x540eb4[_0xa86e('0x98')];}return new BPromise(function(_0x14a85d,_0x256476){if(_0x540eb4[_0xa86e('0x9c')]){for(var _0x1d8c88=0x0;_0x1d8c88<_0x540eb4[_0xa86e('0x9c')][_0xa86e('0x42')];_0x1d8c88++){var _0x51b9a6=_0x540eb4[_0xa86e('0x9c')][_0x1d8c88];var _0x35acc7=path[_0xa86e('0x6c')](_0x863b50,_0x51b9a6[_0xa86e('0x6e')]);if(fs[_0xa86e('0xa0')](_0x35acc7)){_0x16ab2c[_0xa86e('0x6b')][_0xa86e('0xa1')]({'name':_0x51b9a6[_0xa86e('0x36')],'contentType':_0x51b9a6[_0xa86e('0x4a')],'data':fs[_0xa86e('0xa2')](_0x35acc7)});}}}emlformat[_0xa86e('0xa3')](_0x16ab2c,function(_0x356123,_0x1235b3){if(_0x356123)return _0x256476(_0x356123);fs[_0xa86e('0xa4')](path[_0xa86e('0x6c')](_0x5b58b8,_0x2896c7),_0x1235b3);return _0x14a85d(_0x1235b3);});});}})[_0xa86e('0x32')](function(_0xb798f2){if(_0xb798f2){return _0x544a0a[_0xa86e('0xa5')](path[_0xa86e('0x6c')](_0x5b58b8,_0x2896c7),_0x2896c7,function(_0x42ff90){if(_0x42ff90){console[_0xa86e('0xa6')](_0xa86e('0xa7'),_0x42ff90);}else{fs[_0xa86e('0xa8')](path[_0xa86e('0x6c')](_0x5b58b8,_0x2896c7));}});}})[_0xa86e('0x26')](handleError(_0x544a0a,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 537ce7f..1621458 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 _0x1c2d=['exports','events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1f0228,_0x4a7925){var _0x517059=function(_0x5617ab){while(--_0x5617ab){_0x1f0228['push'](_0x1f0228['shift']());}};_0x517059(++_0x4a7925);}(_0x1c2d,0xfd));var _0xd1c2=function(_0x41e226,_0x5b6d61){_0x41e226=_0x41e226-0x0;var _0x87089d=_0x1c2d[_0x41e226];return _0x87089d;};'use strict';var EventEmitter=require(_0xd1c2('0x0'));var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xd1c2('0x1')](0x0);var events={'afterCreate':_0xd1c2('0x2'),'afterUpdate':_0xd1c2('0x3'),'afterDestroy':_0xd1c2('0x4')};function emitEvent(_0x111959){return function(_0x49c849,_0x1939b7,_0x1b1020){MailMessageEvents[_0xd1c2('0x5')](_0x111959+':'+_0x49c849['id'],_0x49c849);MailMessageEvents[_0xd1c2('0x5')](_0x111959,_0x49c849);_0x1b1020(null);};}for(var e in events){if(events[_0xd1c2('0x6')](e)){var event=events[e];MailMessage[_0xd1c2('0x7')](e,emitEvent(event));}}module[_0xd1c2('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x824d=['save','remove','emit','hook','events','../../mysqldb','setMaxListeners'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x824d,0x12a));var _0xd824=function(_0x3de660,_0x5bdc59){_0x3de660=_0x3de660-0x0;var _0xceb2c8=_0x824d[_0x3de660];return _0xceb2c8;};'use strict';var EventEmitter=require(_0xd824('0x0'));var MailMessage=require(_0xd824('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xd824('0x2')](0x0);var events={'afterCreate':_0xd824('0x3'),'afterUpdate':'update','afterDestroy':_0xd824('0x4')};function emitEvent(_0x1e0f0c){return function(_0x6a2a5c,_0x30c9b7,_0x11935e){MailMessageEvents[_0xd824('0x5')](_0x1e0f0c+':'+_0x6a2a5c['id'],_0x6a2a5c);MailMessageEvents[_0xd824('0x5')](_0x1e0f0c,_0x6a2a5c);_0x11935e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xd824('0x6')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index eb7d637..da9d86e 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 _0x7341=['utf8mb4','lodash','api','bluebird','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','get','direction','out','isNil','MailInteractionId','update','createdAt','toLowerCase','catch','error'];(function(_0x4ff19e,_0x243f60){var _0x39874a=function(_0x5d0ee0){while(--_0x5d0ee0){_0x4ff19e['push'](_0x4ff19e['shift']());}};_0x39874a(++_0x243f60);}(_0x7341,0x1d1));var _0x1734=function(_0x48c3a1,_0x1b8294){_0x48c3a1=_0x48c3a1-0x0;var _0x2736ba=_0x7341[_0x48c3a1];return _0x2736ba;};'use strict';var _=require(_0x1734('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1734('0x1'));var moment=require('moment');var BPromise=require(_0x1734('0x2'));var rp=require('request-promise');var htmlToText=require(_0x1734('0x3'));var fs=require('fs');var path=require(_0x1734('0x4'));var rimraf=require(_0x1734('0x5'));var config=require(_0x1734('0x6'));var attributes=require(_0x1734('0x7'));module[_0x1734('0x8')]=function(_0x47a7cf,_0x5453e5){return _0x47a7cf[_0x1734('0x9')](_0x1734('0xa'),attributes,{'tableName':_0x1734('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x1734('0xc')]},{'name':_0x1734('0xd'),'fields':[_0x1734('0xe'),_0x1734('0xf')],'type':_0x1734('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3c42e3,_0x30d012,_0x5678ad){if(_0x3c42e3[_0x1734('0x11')]){_0x3c42e3['plainBody']=htmlToText['fromString'](_0x3c42e3[_0x1734('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5678ad(null,_0x30d012);},'afterCreate':function(_0x3d5df1,_0x2c57a5,_0x7c141){var _0x15b9f0=_0x47a7cf['models'];var _0x47a555=_0x3d5df1[_0x1734('0x12')]({'plain':!![]});if(_0x47a555['direction']['toLowerCase']()==='in'||_0x47a555[_0x1734('0x13')]['toLowerCase']()===_0x1734('0x14')&&!_0x47a555['secret']&&!_[_0x1734('0x15')](_0x47a555['UserId'])){_0x15b9f0['MailInteraction']['findOne']({'where':{'id':_0x47a555[_0x1734('0x16')]}})['then'](function(_0x37595c){if(_0x37595c){_0x37595c[_0x1734('0x17')]({'lastMsgAt':_0x47a555[_0x1734('0x18')],'lastMsgDirection':_0x47a555[_0x1734('0x13')][_0x1734('0x19')]()});}})[_0x1734('0x1a')](function(_0x4dbefe){console[_0x1734('0x1b')](_0x4dbefe);});}_0x7c141();}},'charset':_0x1734('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xae3f=['util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','models','direction','toLowerCase','out','UserId','MailInteraction','findOne','then','createdAt','error','utf8mb4_unicode_ci'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xae3f,0x136));var _0xfae3=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xae3f[_0x3070dc];return _0x431489;};'use strict';var _=require('lodash');var util=require(_0xfae3('0x0'));var logger=require(_0xfae3('0x1'))(_0xfae3('0x2'));var moment=require(_0xfae3('0x3'));var BPromise=require(_0xfae3('0x4'));var rp=require(_0xfae3('0x5'));var htmlToText=require(_0xfae3('0x6'));var fs=require('fs');var path=require(_0xfae3('0x7'));var rimraf=require(_0xfae3('0x8'));var config=require(_0xfae3('0x9'));var attributes=require(_0xfae3('0xa'));module[_0xfae3('0xb')]=function(_0x1e771d,_0x71a020){return _0x1e771d['define'](_0xfae3('0xc'),attributes,{'tableName':_0xfae3('0xd'),'paranoid':![],'indexes':[{'name':_0xfae3('0xe'),'fields':[_0xfae3('0xe')]},{'name':_0xfae3('0xf'),'fields':[_0xfae3('0x10'),'subject'],'type':_0xfae3('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3fbf6e,_0xea046c,_0x43fc72){if(_0x3fbf6e[_0xfae3('0x12')]){_0x3fbf6e[_0xfae3('0x10')]=htmlToText[_0xfae3('0x13')](_0x3fbf6e[_0xfae3('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x43fc72(null,_0xea046c);},'afterCreate':function(_0x1a322a,_0xe37e66,_0x1e99f1){var _0x379956=_0x1e771d[_0xfae3('0x14')];var _0x5d9d21=_0x1a322a['get']({'plain':!![]});if(_0x5d9d21[_0xfae3('0x15')][_0xfae3('0x16')]()==='in'||_0x5d9d21[_0xfae3('0x15')][_0xfae3('0x16')]()===_0xfae3('0x17')&&!_0x5d9d21['secret']&&!_['isNil'](_0x5d9d21[_0xfae3('0x18')])){_0x379956[_0xfae3('0x19')][_0xfae3('0x1a')]({'where':{'id':_0x5d9d21['MailInteractionId']}})[_0xfae3('0x1b')](function(_0x1cd16e){if(_0x1cd16e){_0x1cd16e['update']({'lastMsgAt':_0x5d9d21[_0xfae3('0x1c')],'lastMsgDirection':_0x5d9d21[_0xfae3('0x15')]['toLowerCase']()});}})['catch'](function(_0x51e519){console[_0xfae3('0x1d')](_0x51e519);});}_0x1e99f1();}},'charset':'utf8mb4','collate':_0xfae3('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 1f9d36f..90e4d59 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 _0x6ea4=['../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailMessage,\x20%s,\x20%s','result','catch','MailMessage','body','CreateMailMessage','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0xa8b7b2,_0x537118){var _0x5455c8=function(_0x17de60){while(--_0x17de60){_0xa8b7b2['push'](_0xa8b7b2['shift']());}};_0x5455c8(++_0x537118);}(_0x6ea4,0xd3));var _0x46ea=function(_0x38b106,_0x52ac69){_0x38b106=_0x38b106-0x0;var _0x4b106e=_0x6ea4[_0x38b106];return _0x4b106e;};'use strict';var _=require(_0x46ea('0x0'));var util=require(_0x46ea('0x1'));var moment=require(_0x46ea('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46ea('0x3'));var db=require(_0x46ea('0x4'))['db'];var utils=require(_0x46ea('0x5'));var logger=require(_0x46ea('0x6'))(_0x46ea('0x7'));var config=require(_0x46ea('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x46ea('0x9')]({'port':0x232a});config[_0x46ea('0xa')]=_[_0x46ea('0xb')](config['redis'],{'host':_0x46ea('0xc'),'port':0x18eb});var socket=require(_0x46ea('0xd'))(new Redis(config['redis']));require('./mailMessage.socket')[_0x46ea('0xe')](socket);function respondWithRpcPromise(_0x1a97cd,_0x161ed3,_0x14c626){return new BPromise(function(_0x4f8ea9,_0x4cf3ad){return client[_0x46ea('0xf')](_0x1a97cd,_0x14c626)[_0x46ea('0x10')](function(_0x2372d2){logger[_0x46ea('0x11')]('MailMessage,\x20%s,\x20%s',_0x161ed3,_0x46ea('0x12'));logger[_0x46ea('0x13')](_0x46ea('0x14'),_0x161ed3,_0x46ea('0x12'),JSON[_0x46ea('0x15')](_0x2372d2));if(_0x2372d2['error']){if(_0x2372d2[_0x46ea('0x16')][_0x46ea('0x17')]===0x1f4){logger[_0x46ea('0x16')]('MailMessage,\x20%s,\x20%s',_0x161ed3,_0x2372d2[_0x46ea('0x16')][_0x46ea('0x18')]);return _0x4cf3ad(_0x2372d2[_0x46ea('0x16')][_0x46ea('0x18')]);}logger[_0x46ea('0x16')](_0x46ea('0x19'),_0x161ed3,_0x2372d2['error'][_0x46ea('0x18')]);return _0x4f8ea9(_0x2372d2[_0x46ea('0x16')][_0x46ea('0x18')]);}else{logger[_0x46ea('0x11')](_0x46ea('0x19'),_0x161ed3,_0x46ea('0x12'));_0x4f8ea9(_0x2372d2[_0x46ea('0x1a')][_0x46ea('0x18')]);}})[_0x46ea('0x1b')](function(_0x5973c3){logger['error'](_0x46ea('0x19'),_0x161ed3,_0x5973c3);_0x4cf3ad(_0x5973c3);});});}exports['CreateMailMessage']=function(_0x21d9b0){var _0x1c3878=this;return new Promise(function(_0x348b1b,_0x2c4ca8){return db[_0x46ea('0x1c')]['create'](_0x21d9b0[_0x46ea('0x1d')],{'raw':_0x21d9b0['options']?_0x21d9b0['options']['raw']===undefined?!![]:![]:!![]})[_0x46ea('0x10')](function(_0xe4e74a){logger[_0x46ea('0x11')](_0x46ea('0x1e'),_0x21d9b0);logger[_0x46ea('0x13')](_0x46ea('0x1e'),_0x21d9b0,JSON['stringify'](_0xe4e74a));_0x348b1b(_0xe4e74a);})[_0x46ea('0x1b')](function(_0x900479){logger[_0x46ea('0x16')](_0x46ea('0x1e'),_0x900479[_0x46ea('0x18')],_0x21d9b0);_0x2c4ca8(_0x1c3878['error'](0x1f4,_0x900479[_0x46ea('0x18')]));});});}; \ No newline at end of file +var _0x4131=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','CreateMailMessage','create','body','options','stringify','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2239c1,_0x435239){var _0x1e8497=function(_0x4099f5){while(--_0x4099f5){_0x2239c1['push'](_0x2239c1['shift']());}};_0x1e8497(++_0x435239);}(_0x4131,0x17b));var _0x1413=function(_0x52ea08,_0x15d935){_0x52ea08=_0x52ea08-0x0;var _0x28d546=_0x4131[_0x52ea08];return _0x28d546;};'use strict';var _=require('lodash');var util=require(_0x1413('0x0'));var moment=require(_0x1413('0x1'));var BPromise=require(_0x1413('0x2'));var rs=require(_0x1413('0x3'));var fs=require('fs');var Redis=require(_0x1413('0x4'));var db=require(_0x1413('0x5'))['db'];var utils=require(_0x1413('0x6'));var logger=require(_0x1413('0x7'))(_0x1413('0x8'));var config=require(_0x1413('0x9'));var jayson=require(_0x1413('0xa'));var client=jayson[_0x1413('0xb')][_0x1413('0xc')]({'port':0x232a});config[_0x1413('0xd')]=_[_0x1413('0xe')](config[_0x1413('0xd')],{'host':_0x1413('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1413('0xd')]));require(_0x1413('0x10'))[_0x1413('0x11')](socket);function respondWithRpcPromise(_0x4a96c7,_0x1af9a9,_0x4195e1){return new BPromise(function(_0x108696,_0x5b4858){return client[_0x1413('0x12')](_0x4a96c7,_0x4195e1)[_0x1413('0x13')](function(_0x5a9d65){logger['info'](_0x1413('0x14'),_0x1af9a9,'request\x20sent');logger[_0x1413('0x15')](_0x1413('0x16'),_0x1af9a9,_0x1413('0x17'),JSON['stringify'](_0x5a9d65));if(_0x5a9d65[_0x1413('0x18')]){if(_0x5a9d65[_0x1413('0x18')][_0x1413('0x19')]===0x1f4){logger[_0x1413('0x18')](_0x1413('0x14'),_0x1af9a9,_0x5a9d65[_0x1413('0x18')]['message']);return _0x5b4858(_0x5a9d65['error'][_0x1413('0x1a')]);}logger[_0x1413('0x18')](_0x1413('0x14'),_0x1af9a9,_0x5a9d65[_0x1413('0x18')][_0x1413('0x1a')]);return _0x108696(_0x5a9d65['error']['message']);}else{logger[_0x1413('0x1b')](_0x1413('0x14'),_0x1af9a9,_0x1413('0x17'));_0x108696(_0x5a9d65[_0x1413('0x1c')][_0x1413('0x1a')]);}})['catch'](function(_0x27dbb5){logger[_0x1413('0x18')](_0x1413('0x14'),_0x1af9a9,_0x27dbb5);_0x5b4858(_0x27dbb5);});});}exports[_0x1413('0x1d')]=function(_0x521ce4){var _0x4c6c92=this;return new Promise(function(_0x31f3f4,_0x2d7251){return db['MailMessage'][_0x1413('0x1e')](_0x521ce4[_0x1413('0x1f')],{'raw':_0x521ce4[_0x1413('0x20')]?_0x521ce4[_0x1413('0x20')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4cfae3){logger[_0x1413('0x1b')](_0x1413('0x1d'),_0x521ce4);logger[_0x1413('0x15')](_0x1413('0x1d'),_0x521ce4,JSON[_0x1413('0x21')](_0x4cfae3));_0x31f3f4(_0x4cfae3);})[_0x1413('0x22')](function(_0x34c09a){logger[_0x1413('0x18')](_0x1413('0x1d'),_0x34c09a['message'],_0x521ce4);_0x2d7251(_0x4c6c92[_0x1413('0x18')](0x1f4,_0x34c09a[_0x1413('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index ee054b5..508aefa 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 _0xfa72=['emit','register','length','mailMessage:','./mailMessage.events','remove','update'];(function(_0x57e3e8,_0x301418){var _0x3bd128=function(_0x24ddf4){while(--_0x24ddf4){_0x57e3e8['push'](_0x57e3e8['shift']());}};_0x3bd128(++_0x301418);}(_0xfa72,0xcf));var _0x2fa7=function(_0x57f123,_0x1decc6){_0x57f123=_0x57f123-0x0;var _0x502cf7=_0xfa72[_0x57f123];return _0x502cf7;};'use strict';var MailMessageEvents=require(_0x2fa7('0x0'));var events=['save',_0x2fa7('0x1'),_0x2fa7('0x2')];function createListener(_0x19be18,_0x4057e6){return function(_0x1f3c3b){_0x4057e6[_0x2fa7('0x3')](_0x19be18,_0x1f3c3b);};}function removeListener(_0x88ff57,_0x3faa90){return function(){MailMessageEvents['removeListener'](_0x88ff57,_0x3faa90);};}exports[_0x2fa7('0x4')]=function(_0x34593c){for(var _0x1177be=0x0,_0x1d62a7=events[_0x2fa7('0x5')];_0x1177be<_0x1d62a7;_0x1177be++){var _0x266d93=events[_0x1177be];var _0x59a6ce=createListener(_0x2fa7('0x6')+_0x266d93,_0x34593c);MailMessageEvents['on'](_0x266d93,_0x59a6ce);}}; \ No newline at end of file +var _0x8ae8=['update','emit','register','length','mailMessage:','./mailMessage.events','remove'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8ae8,0x163));var _0x88ae=function(_0x3fc6e6,_0x5a6c91){_0x3fc6e6=_0x3fc6e6-0x0;var _0x1733e8=_0x8ae8[_0x3fc6e6];return _0x1733e8;};'use strict';var MailMessageEvents=require(_0x88ae('0x0'));var events=['save',_0x88ae('0x1'),_0x88ae('0x2')];function createListener(_0x250850,_0x31effe){return function(_0x2fb39b){_0x31effe[_0x88ae('0x3')](_0x250850,_0x2fb39b);};}function removeListener(_0x1fded6,_0x24c8f9){return function(){MailMessageEvents['removeListener'](_0x1fded6,_0x24c8f9);};}exports[_0x88ae('0x4')]=function(_0x2874cd){for(var _0x4037fc=0x0,_0x423ebc=events[_0x88ae('0x5')];_0x4037fc<_0x423ebc;_0x4037fc++){var _0x5064cd=events[_0x4037fc];var _0x2c220f=createListener(_0x88ae('0x6')+_0x5064cd,_0x2874cd);MailMessageEvents['on'](_0x5064cd,_0x2c220f);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 7d21934..26042f0 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 _0xb3a6=['get','isAuthenticated','/:id/members','getTeams','/:id/users','post','/:id/teams','/:id','update','delete','destroy','removeTeams','removeAgents','exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller'];(function(_0x59282e,_0x5d875b){var _0x1e8b7e=function(_0x2802b5){while(--_0x2802b5){_0x59282e['push'](_0x59282e['shift']());}};_0x1e8b7e(++_0x5d875b);}(_0xb3a6,0x188));var _0x6b3a=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0xb3a6[_0x43d16c];return _0x208cce;};'use strict';var multer=require('multer');var util=require(_0x6b3a('0x0'));var path=require(_0x6b3a('0x1'));var timeout=require('connect-timeout');var express=require(_0x6b3a('0x2'));var router=express['Router']();var fs_extra=require(_0x6b3a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6b3a('0x4'));var config=require(_0x6b3a('0x5'));var controller=require(_0x6b3a('0x6'));router[_0x6b3a('0x7')]('/',auth[_0x6b3a('0x8')](),controller['index']);router[_0x6b3a('0x7')]('/describe',auth[_0x6b3a('0x8')](),controller['describe']);router[_0x6b3a('0x7')]('/:id',auth[_0x6b3a('0x8')](),controller['show']);router[_0x6b3a('0x7')](_0x6b3a('0x9'),auth[_0x6b3a('0x8')](),controller['getMembers']);router[_0x6b3a('0x7')]('/:id/teams',auth[_0x6b3a('0x8')](),controller[_0x6b3a('0xa')]);router[_0x6b3a('0x7')](_0x6b3a('0xb'),auth[_0x6b3a('0x8')](),controller['getAgents']);router[_0x6b3a('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6b3a('0xc')](_0x6b3a('0xd'),auth[_0x6b3a('0x8')](),controller['addTeams']);router['post']('/:id/users',auth[_0x6b3a('0x8')](),controller['addAgents']);router['put'](_0x6b3a('0xe'),auth[_0x6b3a('0x8')](),controller[_0x6b3a('0xf')]);router[_0x6b3a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6b3a('0x11')]);router[_0x6b3a('0x10')](_0x6b3a('0xd'),auth['isAuthenticated'](),controller[_0x6b3a('0x12')]);router[_0x6b3a('0x10')](_0x6b3a('0xb'),auth[_0x6b3a('0x8')](),controller[_0x6b3a('0x13')]);module[_0x6b3a('0x14')]=router; \ No newline at end of file +var _0x8a7b=['Router','fs-extra','../../components/auth/service','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','removeTeams','multer','util','express'];(function(_0x465f17,_0x4bd683){var _0x38fb72=function(_0xcd6ba){while(--_0xcd6ba){_0x465f17['push'](_0x465f17['shift']());}};_0x38fb72(++_0x4bd683);}(_0x8a7b,0xe7));var _0xb8a7=function(_0x3f87ce,_0x4abd6c){_0x3f87ce=_0x3f87ce-0x0;var _0x8d7035=_0x8a7b[_0x3f87ce];return _0x8d7035;};'use strict';var multer=require(_0xb8a7('0x0'));var util=require(_0xb8a7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb8a7('0x2'));var router=express[_0xb8a7('0x3')]();var fs_extra=require(_0xb8a7('0x4'));var auth=require(_0xb8a7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb8a7('0x6'));router[_0xb8a7('0x7')]('/',auth[_0xb8a7('0x8')](),controller[_0xb8a7('0x9')]);router[_0xb8a7('0x7')](_0xb8a7('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xb8a7('0x7')](_0xb8a7('0xb'),auth['isAuthenticated'](),controller[_0xb8a7('0xc')]);router[_0xb8a7('0x7')]('/:id/members',auth['isAuthenticated'](),controller[_0xb8a7('0xd')]);router[_0xb8a7('0x7')](_0xb8a7('0xe'),auth[_0xb8a7('0x8')](),controller[_0xb8a7('0xf')]);router[_0xb8a7('0x7')](_0xb8a7('0x10'),auth[_0xb8a7('0x8')](),controller[_0xb8a7('0x11')]);router[_0xb8a7('0x12')]('/',auth[_0xb8a7('0x8')](),controller[_0xb8a7('0x13')]);router['post'](_0xb8a7('0xe'),auth[_0xb8a7('0x8')](),controller[_0xb8a7('0x14')]);router['post']('/:id/users',auth[_0xb8a7('0x8')](),controller[_0xb8a7('0x15')]);router[_0xb8a7('0x16')]('/:id',auth[_0xb8a7('0x8')](),controller['update']);router[_0xb8a7('0x17')](_0xb8a7('0xb'),auth[_0xb8a7('0x8')](),controller[_0xb8a7('0x18')]);router[_0xb8a7('0x17')]('/:id/teams',auth[_0xb8a7('0x8')](),controller[_0xb8a7('0x19')]);router[_0xb8a7('0x17')]('/:id/users',auth['isAuthenticated'](),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 21aa494..6db3108 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 _0x7785=['STRING','name','INTEGER','ENUM'];(function(_0x22e2e5,_0x478c6a){var _0x6aff9c=function(_0x3aed65){while(--_0x3aed65){_0x22e2e5['push'](_0x22e2e5['shift']());}};_0x6aff9c(++_0x478c6a);}(_0x7785,0x104));var _0x5778=function(_0x52f6ae,_0x23a9b6){_0x52f6ae=_0x52f6ae-0x0;var _0x12ac09=_0x7785[_0x52f6ae];return _0x12ac09;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5778('0x0')],'unique':_0x5778('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x5778('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5778('0x3')]('rrmemory','beepall','roundrobin')}}; \ No newline at end of file +var _0x0424=['rrmemory','STRING','name','INTEGER'];(function(_0x569560,_0x16b989){var _0x3c1de0=function(_0x1f652b){while(--_0x1f652b){_0x569560['push'](_0x569560['shift']());}};_0x3c1de0(++_0x16b989);}(_0x0424,0x159));var _0x4042=function(_0x11dcf0,_0x4eb137){_0x11dcf0=_0x11dcf0-0x0;var _0x4f9831=_0x0424[_0x11dcf0];return _0x4f9831;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4042('0x0')],'unique':_0x4042('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4042('0x0')]},'timeout':{'type':Sequelize[_0x4042('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x4042('0x3'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 15b851c..9b877b7 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 _0x2883=['index','map','MailQueue','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','describe','getMembers','findOne','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','union','compact','value','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','emit','getAgents','request-promise','moment','mustache','util','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send'];(function(_0x17e7c8,_0x1f594f){var _0x29406a=function(_0x558cc4){while(--_0x558cc4){_0x17e7c8['push'](_0x17e7c8['shift']());}};_0x29406a(++_0x1f594f);}(_0x2883,0x170));var _0x3288=function(_0x3302a0,_0x40ddac){_0x3302a0=_0x3302a0-0x0;var _0xe857e6=_0x2883[_0x3302a0];return _0xe857e6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3288('0x0'));var moment=require(_0x3288('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x3288('0x2'));var util=require(_0x3288('0x3'));var path=require('path');var sox=require(_0x3288('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3288('0x5'));var _=require(_0x3288('0x6'));var squel=require('squel');var crypto=require(_0x3288('0x7'));var jsforce=require(_0x3288('0x8'));var deskjs=require(_0x3288('0x9'));var toCsv=require(_0x3288('0xa'));var querystring=require('querystring');var Papa=require(_0x3288('0xb'));var Redis=require('ioredis');var authService=require(_0x3288('0xc'));var qs=require(_0x3288('0xd'));var as=require(_0x3288('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3288('0xf'));var utils=require(_0x3288('0x10'));var config=require(_0x3288('0x11'));var licenseUtil=require(_0x3288('0x12'));var db=require(_0x3288('0x13'))['db'];config[_0x3288('0x14')]=_[_0x3288('0x15')](config[_0x3288('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x3288('0x16'))(new Redis(config[_0x3288('0x14')]));require(_0x3288('0x17'))[_0x3288('0x18')](socket);function respondWithStatusCode(_0xf4cb84,_0x2d34ee){_0x2d34ee=_0x2d34ee||0xcc;return function(_0x31a546){if(_0x31a546){return _0xf4cb84[_0x3288('0x19')](_0x2d34ee);}return _0xf4cb84[_0x3288('0x1a')](_0x2d34ee)[_0x3288('0x1b')]();};}function respondWithResult(_0x576797,_0x5e0026){_0x5e0026=_0x5e0026||0xc8;return function(_0x1024c1){if(_0x1024c1){return _0x576797['status'](_0x5e0026)[_0x3288('0x1c')](_0x1024c1);}};}function respondWithFilteredResult(_0x473477,_0x287d0f){return function(_0x27f617){if(_0x27f617){var _0x566523=_0x27f617[_0x3288('0x1d')],_0xca588b=_0x287d0f[_0x3288('0x1e')],_0x16a955=_0x287d0f[_0x3288('0x1e')]+_0x287d0f[_0x3288('0x1f')],_0x25dce7;if(_0x16a955>=_0x566523){_0x16a955=_0x566523;_0x25dce7=0xc8;}else{_0x25dce7=0xce;}_0x473477[_0x3288('0x1a')](_0x25dce7);return _0x473477[_0x3288('0x20')](_0x3288('0x21'),_0xca588b+'-'+_0x16a955+'/'+_0x566523)[_0x3288('0x1c')](_0x27f617);}return null;};}function patchUpdates(_0x41bde){return function(_0x4d6c04){try{jsonpatch[_0x3288('0x22')](_0x4d6c04,_0x41bde,!![]);}catch(_0xe33c41){return BPromise[_0x3288('0x23')](_0xe33c41);}return _0x4d6c04[_0x3288('0x24')]();};}function saveUpdates(_0x2af462,_0x34550b){return function(_0x3c477c){if(_0x3c477c){return _0x3c477c[_0x3288('0x25')](_0x2af462)[_0x3288('0x26')](function(_0xab8e22){return _0xab8e22;});}return null;};}function removeEntity(_0x5655fc,_0xb747c5){return function(_0x20eb93){if(_0x20eb93){return _0x20eb93['destroy']()[_0x3288('0x26')](function(){var _0x44f82c=_0x20eb93[_0x3288('0x27')]({'plain':!![]});var _0x382c5e='MailQueues';return db[_0x3288('0x28')][_0x3288('0x29')]({'where':{'type':_0x382c5e,'resourceId':_0x44f82c['id']}})[_0x3288('0x26')](function(){return _0x20eb93;});})['then'](function(){_0x5655fc[_0x3288('0x1a')](0xcc)[_0x3288('0x1b')]();});}};}function handleEntityNotFound(_0x1388e6,_0xa86ccb){return function(_0xf6fd42){if(!_0xf6fd42){_0x1388e6[_0x3288('0x19')](0x194);}return _0xf6fd42;};}function handleError(_0x4ca805,_0x43066b){_0x43066b=_0x43066b||0x1f4;return function(_0x384ec2){logger[_0x3288('0x2a')](_0x384ec2[_0x3288('0x2b')]);if(_0x384ec2[_0x3288('0x2c')]){delete _0x384ec2['name'];}_0x4ca805['status'](_0x43066b)[_0x3288('0x2d')](_0x384ec2);};}exports[_0x3288('0x2e')]=function(_0xc666f9,_0x633960){var _0x5bda03={},_0x1bd3e6={},_0x294e6f={'count':0x0,'rows':[]};var _0x104d06=_[_0x3288('0x2f')](db[_0x3288('0x30')][_0x3288('0x31')],function(_0x2eaf36){return{'name':_0x2eaf36['fieldName'],'type':_0x2eaf36['type'][_0x3288('0x32')]};});_0x1bd3e6[_0x3288('0x33')]=_[_0x3288('0x2f')](_0x104d06,_0x3288('0x2c'));_0x1bd3e6[_0x3288('0x34')]=_[_0x3288('0x35')](_0xc666f9[_0x3288('0x34')]);_0x1bd3e6['filters']=_['intersection'](_0x1bd3e6[_0x3288('0x33')],_0x1bd3e6[_0x3288('0x34')]);_0x5bda03[_0x3288('0x36')]=_[_0x3288('0x37')](_0x1bd3e6[_0x3288('0x33')],qs[_0x3288('0x38')](_0xc666f9[_0x3288('0x34')][_0x3288('0x38')]));_0x5bda03['attributes']=_0x5bda03['attributes'][_0x3288('0x39')]?_0x5bda03[_0x3288('0x36')]:_0x1bd3e6[_0x3288('0x33')];if(!_0xc666f9[_0x3288('0x34')][_0x3288('0x3a')](_0x3288('0x3b'))){_0x5bda03[_0x3288('0x1f')]=qs[_0x3288('0x1f')](_0xc666f9[_0x3288('0x34')]['limit']);_0x5bda03['offset']=qs['offset'](_0xc666f9[_0x3288('0x34')]['offset']);}_0x5bda03[_0x3288('0x3c')]=qs[_0x3288('0x3d')](_0xc666f9[_0x3288('0x34')][_0x3288('0x3d')]);_0x5bda03[_0x3288('0x3e')]=qs[_0x3288('0x3f')](_[_0x3288('0x40')](_0xc666f9['query'],_0x1bd3e6[_0x3288('0x3f')]),_0x104d06);if(_0xc666f9[_0x3288('0x34')][_0x3288('0x41')]){_0x5bda03['where']=_[_0x3288('0x42')](_0x5bda03['where'],{'$or':_['map'](_0x104d06,function(_0x16926d){if(_0x16926d['type']!=='VIRTUAL'){var _0x16aeb5={};_0x16aeb5[_0x16926d['name']]={'$like':'%'+_0xc666f9[_0x3288('0x34')][_0x3288('0x41')]+'%'};return _0x16aeb5;}})});}_0x5bda03=_['merge']({},_0x5bda03,_0xc666f9['options']);var _0x39b2b0={'where':_0x5bda03[_0x3288('0x3e')]};return db['MailQueue'][_0x3288('0x1d')](_0x39b2b0)[_0x3288('0x26')](function(_0x74431d){_0x294e6f[_0x3288('0x1d')]=_0x74431d;if(_0xc666f9[_0x3288('0x34')][_0x3288('0x43')]){_0x5bda03[_0x3288('0x44')]=[{'all':!![]}];}return db['MailQueue'][_0x3288('0x45')](_0x5bda03);})['then'](function(_0x2e8bc2){_0x294e6f[_0x3288('0x46')]=_0x2e8bc2;return _0x294e6f;})['then'](respondWithFilteredResult(_0x633960,_0x5bda03))['catch'](handleError(_0x633960,null));};exports[_0x3288('0x47')]=function(_0x26d4df,_0x503827){var _0x160e9f={'raw':!![],'where':{'id':_0x26d4df[_0x3288('0x48')]['id']}},_0x135d33={};_0x135d33[_0x3288('0x33')]=_[_0x3288('0x35')](db[_0x3288('0x30')][_0x3288('0x31')]);_0x135d33['query']=_[_0x3288('0x35')](_0x26d4df['query']);_0x135d33['filters']=_[_0x3288('0x37')](_0x135d33['model'],_0x135d33[_0x3288('0x34')]);_0x160e9f[_0x3288('0x36')]=_['intersection'](_0x135d33[_0x3288('0x33')],qs[_0x3288('0x38')](_0x26d4df[_0x3288('0x34')]['fields']));_0x160e9f[_0x3288('0x36')]=_0x160e9f['attributes'][_0x3288('0x39')]?_0x160e9f[_0x3288('0x36')]:_0x135d33[_0x3288('0x33')];if(_0x26d4df[_0x3288('0x34')][_0x3288('0x43')]){_0x160e9f[_0x3288('0x44')]=[{'all':!![]}];}_0x160e9f=_[_0x3288('0x42')]({},_0x160e9f,_0x26d4df[_0x3288('0x49')]);return db[_0x3288('0x30')][_0x3288('0x4a')](_0x160e9f)[_0x3288('0x26')](handleEntityNotFound(_0x503827,null))['then'](respondWithResult(_0x503827,null))['catch'](handleError(_0x503827,null));};exports[_0x3288('0x4b')]=function(_0x56798d,_0xdb27a6){return db['MailQueue'][_0x3288('0x4b')](_0x56798d[_0x3288('0x4c')],{})[_0x3288('0x26')](function(_0x10a225){var _0x34bf33=_0x56798d['user'][_0x3288('0x27')]({'plain':!![]});if(!_0x34bf33)throw new Error(_0x3288('0x4d'));if(_0x34bf33[_0x3288('0x4e')]==='user'){var _0x3fc40d=_0x10a225['get']({'plain':!![]});var _0x1ecd3f='MailQueues';return db['UserProfileSection'][_0x3288('0x4a')]({'where':{'name':_0x1ecd3f,'userProfileId':_0x34bf33[_0x3288('0x4f')]},'raw':!![]})[_0x3288('0x26')](function(_0x25ab8b){if(_0x25ab8b&&_0x25ab8b[_0x3288('0x50')]===0x0){return db[_0x3288('0x28')][_0x3288('0x4b')]({'name':_0x3fc40d[_0x3288('0x2c')],'resourceId':_0x3fc40d['id'],'type':_0x25ab8b[_0x3288('0x2c')],'sectionId':_0x25ab8b['id']},{})['then'](function(){return _0x10a225;});}else{return _0x10a225;}})['catch'](function(_0x429487){logger[_0x3288('0x2a')](_0x3288('0x51'),_0x429487);throw _0x429487;});}return _0x10a225;})[_0x3288('0x26')](respondWithResult(_0xdb27a6,0xc9))[_0x3288('0x52')](handleError(_0xdb27a6,null));};exports['update']=function(_0x128bf8,_0x40b658){if(_0x128bf8['body']['id']){delete _0x128bf8['body']['id'];}return db[_0x3288('0x30')]['find']({'where':{'id':_0x128bf8[_0x3288('0x48')]['id']}})['then'](handleEntityNotFound(_0x40b658,null))[_0x3288('0x26')](saveUpdates(_0x128bf8[_0x3288('0x4c')],null))['then'](respondWithResult(_0x40b658,null))[_0x3288('0x52')](handleError(_0x40b658,null));};exports['destroy']=function(_0x202642,_0x548d86){return db[_0x3288('0x30')][_0x3288('0x4a')]({'where':{'id':_0x202642[_0x3288('0x48')]['id']}})['then'](handleEntityNotFound(_0x548d86,null))[_0x3288('0x26')](removeEntity(_0x548d86,null))['catch'](handleError(_0x548d86,null));};exports[_0x3288('0x53')]=function(_0x3a9dd9,_0x51dcca){return db[_0x3288('0x30')][_0x3288('0x53')]()[_0x3288('0x26')](respondWithResult(_0x51dcca,null))[_0x3288('0x52')](handleError(_0x51dcca,null));};exports[_0x3288('0x54')]=function(_0x5b79f7,_0x347ffb,_0x43a3ec){var _0x24117b={'raw':!![],'where':{}},_0x340236={},_0x48e4f9;return db[_0x3288('0x30')][_0x3288('0x55')]({'where':{'id':_0x5b79f7[_0x3288('0x48')]['id']}})['then'](handleEntityNotFound(_0x347ffb,null))['then'](function(_0xfe8bf3){if(_0xfe8bf3){_0x48e4f9=_0xfe8bf3[_0x3288('0x27')]({'plain':!![]});_0x340236[_0x3288('0x33')]=_[_0x3288('0x35')](db[_0x3288('0x56')][_0x3288('0x31')]);_0x340236['query']=_[_0x3288('0x35')](_0x5b79f7[_0x3288('0x34')]);_0x340236['filters']=_[_0x3288('0x37')](_0x340236[_0x3288('0x33')],_0x340236[_0x3288('0x34')]);_0x24117b[_0x3288('0x36')]=_[_0x3288('0x37')](_0x340236['model'],qs['fields'](_0x5b79f7['query'][_0x3288('0x38')]));_0x24117b[_0x3288('0x36')]=_0x24117b['attributes'][_0x3288('0x39')]?_0x24117b[_0x3288('0x36')]:_0x340236[_0x3288('0x33')];if(!_0x5b79f7[_0x3288('0x34')][_0x3288('0x3a')](_0x3288('0x3b'))){_0x24117b['limit']=qs['limit'](_0x5b79f7[_0x3288('0x34')][_0x3288('0x1f')]);_0x24117b[_0x3288('0x1e')]=qs[_0x3288('0x1e')](_0x5b79f7[_0x3288('0x34')]['offset']);}_0x24117b['order']=qs[_0x3288('0x3d')](_0x5b79f7[_0x3288('0x34')]['sort']);_0x24117b['where']=qs[_0x3288('0x3f')](_[_0x3288('0x40')](_0x5b79f7[_0x3288('0x34')],_0x340236[_0x3288('0x3f')]));_0x24117b[_0x3288('0x3e')][_0x3288('0x57')]=_0xfe8bf3['id'];if(_0x5b79f7['query'][_0x3288('0x41')]){_0x24117b[_0x3288('0x3e')]=_[_0x3288('0x42')](_0x24117b[_0x3288('0x3e')],{'$or':_[_0x3288('0x2f')](_0x24117b[_0x3288('0x36')],function(_0x264393){var _0x4346c9={};_0x4346c9[_0x264393]={'$like':'%'+_0x5b79f7[_0x3288('0x34')][_0x3288('0x41')]+'%'};return _0x4346c9;})});}_0x24117b=_[_0x3288('0x42')]({},_0x24117b,_0x5b79f7['options']);return db[_0x3288('0x56')][_0x3288('0x45')](_0x24117b);}})['then'](function(_0x1e027e){if(_0x1e027e){return db[_0x3288('0x58')][_0x3288('0x59')]({'where':{'id':_[_0x3288('0x2f')](_0x1e027e,_0x3288('0x5a')),'role':_0x3288('0x5b')},'attributes':['id',_0x3288('0x2c'),_0x3288('0x5c'),_0x3288('0x5d'),_0x3288('0x5e')]});}})[_0x3288('0x26')](function(_0x563b41){if(_0x563b41){return{'count':_0x563b41['count'],'rows':_['map'](_0x563b41['rows'],function(_0x24b0fb){return{'membername':_0x24b0fb['name'],'UserId':_0x24b0fb['id'],'queue_name':_0x48e4f9[_0x3288('0x2c')],'MailQueueId':_0x48e4f9['id'],'interface':util[_0x3288('0x5f')](_0x3288('0x60'),_0x3288('0x61'),_0x24b0fb[_0x3288('0x2c')]),'penalty':0x0,'paused':_0x24b0fb[_0x3288('0x5c')],'createdAt':_0x24b0fb['createdAt'],'updatedAt':_0x24b0fb['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3288('0x26')](respondWithFilteredResult(_0x347ffb,_0x24117b))[_0x3288('0x52')](handleError(_0x347ffb,null));};exports[_0x3288('0x62')]=function(_0x1b19a8,_0x5a1b92,_0x2836ec){var _0x496730={};var _0x1331a1={};var _0x250460;var _0x4ffdb0;return db[_0x3288('0x30')]['findOne']({'where':{'id':_0x1b19a8['params']['id']}})[_0x3288('0x26')](handleEntityNotFound(_0x5a1b92,null))[_0x3288('0x26')](function(_0x384e00){if(_0x384e00){_0x250460=_0x384e00;_0x1331a1['model']=_[_0x3288('0x35')](db[_0x3288('0x63')][_0x3288('0x31')]);_0x1331a1[_0x3288('0x34')]=_['keys'](_0x1b19a8[_0x3288('0x34')]);_0x1331a1[_0x3288('0x3f')]=_[_0x3288('0x37')](_0x1331a1[_0x3288('0x33')],_0x1331a1['query']);_0x496730[_0x3288('0x36')]=_['intersection'](_0x1331a1[_0x3288('0x33')],qs[_0x3288('0x38')](_0x1b19a8[_0x3288('0x34')][_0x3288('0x38')]));_0x496730[_0x3288('0x36')]=_0x496730[_0x3288('0x36')][_0x3288('0x39')]?_0x496730['attributes']:_0x1331a1[_0x3288('0x33')];_0x496730[_0x3288('0x3c')]=qs[_0x3288('0x3d')](_0x1b19a8[_0x3288('0x34')][_0x3288('0x3d')]);_0x496730[_0x3288('0x3e')]=qs[_0x3288('0x3f')](_[_0x3288('0x40')](_0x1b19a8[_0x3288('0x34')],_0x1331a1[_0x3288('0x3f')]));if(_0x1b19a8[_0x3288('0x34')][_0x3288('0x41')]){_0x496730[_0x3288('0x3e')]=_[_0x3288('0x42')](_0x496730[_0x3288('0x3e')],{'$or':_['map'](_0x496730[_0x3288('0x36')],function(_0x1e09da){var _0x108035={};_0x108035[_0x1e09da]={'$like':'%'+_0x1b19a8[_0x3288('0x34')][_0x3288('0x41')]+'%'};return _0x108035;})});}_0x496730=_[_0x3288('0x42')]({},_0x496730,_0x1b19a8[_0x3288('0x49')]);return _0x250460['getTeams'](_0x496730);}})[_0x3288('0x26')](function(_0x4e57a0){if(_0x4e57a0){_0x4ffdb0=_0x4e57a0[_0x3288('0x39')];if(!_0x1b19a8['query'][_0x3288('0x3a')](_0x3288('0x3b'))){_0x496730[_0x3288('0x1f')]=qs['limit'](_0x1b19a8['query'][_0x3288('0x1f')]);_0x496730[_0x3288('0x1e')]=qs[_0x3288('0x1e')](_0x1b19a8[_0x3288('0x34')][_0x3288('0x1e')]);}return _0x250460['getTeams'](_0x496730);}})[_0x3288('0x26')](function(_0x5ecf0d){if(_0x5ecf0d){return _0x5ecf0d?{'count':_0x4ffdb0,'rows':_0x5ecf0d}:null;}})['then'](respondWithResult(_0x5a1b92,null))[_0x3288('0x52')](handleError(_0x5a1b92,null));};exports[_0x3288('0x64')]=function(_0x28d57a,_0x304590,_0x50f94e){var _0x5f32ef=_0x28d57a[_0x3288('0x4c')][_0x3288('0x65')];return db[_0x3288('0x63')][_0x3288('0x45')]({'where':{'id':_0x5f32ef},'attributes':['id'],'include':[{'model':db[_0x3288('0x58')],'as':_0x3288('0x66'),'attributes':['id','name',_0x3288('0x67'),_0x3288('0x68'),_0x3288('0x69')],'raw':!![]}]})['then'](function(_0x1312d7){if(_0x1312d7){var _0x458b68=_[_0x3288('0x6a')](_0x1312d7,function(_0x24efa4){var _0x22a80e=_0x24efa4[_0x3288('0x27')]({'plain':!![]});return _0x22a80e['Agents'];});return db[_0x3288('0x30')][_0x3288('0x4a')]({'where':{'id':_0x28d57a['params']['id']}})[_0x3288('0x26')](function(_0xdec2fa){return db[_0x3288('0x6b')]['transaction'](function(_0x519fd0){return _0xdec2fa[_0x3288('0x64')](_0x5f32ef,{'transaction':_0x519fd0})[_0x3288('0x26')](function(){return BPromise[_0x3288('0x6c')](_0x458b68,function(_0x160157){return db[_0x3288('0x56')][_0x3288('0x6d')]({'where':{'UserId':_0x160157['id'],'MailQueueId':_0x28d57a[_0x3288('0x48')]['id']},'transaction':_0x519fd0});});})['then'](function(){_0x458b68[_0x3288('0x6e')](function(_0x380455){socket['emit'](_0x3288('0x6f'),{'UserId':_0x380455['id'],'MailQueueId':_0xdec2fa['id']});});});});});}})[_0x3288('0x26')](respondWithStatusCode(_0x304590,null))[_0x3288('0x52')](handleError(_0x304590,null));};exports[_0x3288('0x70')]=function(_0x2e1faa,_0x5e3fd7,_0x2f7a29){return db['Team']['findAll']({'where':{'id':_0x2e1faa[_0x3288('0x34')][_0x3288('0x65')]},'attributes':['id'],'include':[{'model':db[_0x3288('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x3288('0x26')](handleEntityNotFound(_0x5e3fd7,null))[_0x3288('0x26')](function(_0x5a15fc){var _0x1bf3f3=_[_0x3288('0x2f')](_0x5a15fc,'id');var _0x2be1d2=[];var _0x451869=[];var _0x3dab6f=squel[_0x3288('0x71')]();_0x3dab6f[_0x3288('0x72')](_0x3288('0x73'))[_0x3288('0x74')](_0x3288('0x75'),'tq')[_0x3288('0x76')]('user_has_teams','ut',_0x3288('0x77'))[_0x3288('0x3e')](_0x3288('0x78'),_0x2e1faa[_0x3288('0x48')]['id']);for(var _0x130a6f=0x0;_0x130a6f<_0x5a15fc[_0x3288('0x39')];_0x130a6f+=0x1){let _0x424ae2=_0x5a15fc[_0x130a6f];for(var _0x47e606=0x0;_0x47e606<_0x424ae2[_0x3288('0x66')][_0x3288('0x39')];_0x47e606+=0x1){let _0x3623ef=_0x424ae2[_0x3288('0x66')][_0x47e606];var _0xb02bcb=_0x3dab6f[_0x3288('0x79')]();_0xb02bcb[_0x3288('0x3e')](_0x3288('0x7a'),_0x3623ef['id']);_0x451869[_0x3288('0x7b')](db['sequelize'][_0x3288('0x34')](_0xb02bcb['toString'](),{'type':db['sequelize']['QueryTypes'][_0x3288('0x7c')]})[_0x3288('0x26')](function(_0xb45c82){if(_0xb45c82[_0x3288('0x39')]===0x1){return _0x3623ef['id'];}else{var _0x5a0118=_[_0x3288('0x7d')](_['map'](_0xb45c82,_0x3288('0x7e')),function(_0x4db03f){return _['includes'](_0x1bf3f3,_0x4db03f);});if(_0x5a0118){return _0x3623ef['id'];}}}));}}return BPromise['all'](_0x451869)[_0x3288('0x26')](function(_0x1da79d){_0x2be1d2=_(_0x2be1d2)[_0x3288('0x7f')](_0x1da79d)[_0x3288('0x80')]()[_0x3288('0x81')]();return db[_0x3288('0x30')][_0x3288('0x4a')]({'where':{'id':_0x2e1faa['params']['id']}})['then'](function(_0x4d1f59){return db[_0x3288('0x6b')]['transaction'](function(_0x56ce26){return _0x4d1f59[_0x3288('0x70')](_0x2e1faa[_0x3288('0x34')][_0x3288('0x65')],{'transaction':_0x56ce26})['then'](function(){if(!_['isEmpty'](_0x2be1d2)){return _0x4d1f59[_0x3288('0x82')](_0x2be1d2,{'transaction':_0x56ce26});}})[_0x3288('0x26')](function(){_0x2be1d2[_0x3288('0x6e')](function(_0x4a69ca){socket['emit'](_0x3288('0x83'),{'UserId':_0x4a69ca,'MailQueueId':_0x4d1f59['id']});});});});});});})[_0x3288('0x26')](respondWithStatusCode(_0x5e3fd7,null))[_0x3288('0x52')](handleError(_0x5e3fd7,null));};exports[_0x3288('0x84')]=function(_0x564379,_0x89666e,_0x4b3585){return db[_0x3288('0x30')][_0x3288('0x4a')]({'where':{'id':_0x564379['params']['id']}})[_0x3288('0x26')](handleEntityNotFound(_0x89666e,null))[_0x3288('0x26')](function(_0x3a8059){if(_0x3a8059){return _0x3a8059['addAgents'](_0x564379[_0x3288('0x4c')][_0x3288('0x65')],_[_0x3288('0x85')](_0x564379[_0x3288('0x4c')],['ids','id'])||{})[_0x3288('0x86')](function(_0x32d8f5){for(var _0x3b9ccc=0x0;_0x3b9ccc<_0x564379[_0x3288('0x4c')][_0x3288('0x65')]['length'];_0x3b9ccc+=0x1){socket['emit'](_0x3288('0x6f'),{'UserId':_0x564379[_0x3288('0x4c')][_0x3288('0x65')][_0x3b9ccc],'MailQueueId':_0x564379[_0x3288('0x48')]['id']});}return _0x32d8f5;});}})['then'](respondWithResult(_0x89666e,null))[_0x3288('0x52')](handleError(_0x89666e,null));};exports[_0x3288('0x82')]=function(_0x4ad99b,_0x29ea2c,_0x2073cf){return db[_0x3288('0x30')][_0x3288('0x4a')]({'where':{'id':_0x4ad99b[_0x3288('0x48')]['id']}})[_0x3288('0x26')](handleEntityNotFound(_0x29ea2c,null))[_0x3288('0x26')](function(_0x497ea5){if(_0x497ea5){return _0x497ea5[_0x3288('0x82')](_0x4ad99b[_0x3288('0x34')][_0x3288('0x65')])[_0x3288('0x26')](function(){if(_[_0x3288('0x87')](_0x4ad99b[_0x3288('0x34')][_0x3288('0x65')])){for(var _0x4f72e5=0x0;_0x4f72e5<_0x4ad99b[_0x3288('0x34')]['ids']['length'];_0x4f72e5+=0x1){socket[_0x3288('0x88')](_0x3288('0x83'),{'UserId':Number(_0x4ad99b[_0x3288('0x34')]['ids'][_0x4f72e5]),'MailQueueId':Number(_0x4ad99b[_0x3288('0x48')]['id'])});}}else{socket[_0x3288('0x88')](_0x3288('0x83'),{'UserId':Number(_0x4ad99b[_0x3288('0x34')][_0x3288('0x65')]),'MailQueueId':Number(_0x4ad99b['params']['id'])});}});}})[_0x3288('0x26')](respondWithStatusCode(_0x29ea2c,null))[_0x3288('0x52')](handleError(_0x29ea2c,null));};exports[_0x3288('0x89')]=function(_0x4a907a,_0x2dca83,_0x574bfa){var _0x33583a={};var _0x51083f={};var _0x32da81;var _0x5eb6b4;return db[_0x3288('0x30')][_0x3288('0x55')]({'where':{'id':_0x4a907a[_0x3288('0x48')]['id']}})[_0x3288('0x26')](handleEntityNotFound(_0x2dca83,null))[_0x3288('0x26')](function(_0xf29d22){if(_0xf29d22){_0x32da81=_0xf29d22;_0x51083f[_0x3288('0x33')]=_[_0x3288('0x35')](db[_0x3288('0x58')][_0x3288('0x31')]);_0x51083f[_0x3288('0x34')]=_['keys'](_0x4a907a[_0x3288('0x34')]);_0x51083f[_0x3288('0x3f')]=_[_0x3288('0x37')](_0x51083f[_0x3288('0x33')],_0x51083f[_0x3288('0x34')]);_0x33583a[_0x3288('0x36')]=_[_0x3288('0x37')](_0x51083f['model'],qs[_0x3288('0x38')](_0x4a907a[_0x3288('0x34')][_0x3288('0x38')]));_0x33583a[_0x3288('0x36')]=_0x33583a['attributes'][_0x3288('0x39')]?_0x33583a[_0x3288('0x36')]:_0x51083f[_0x3288('0x33')];_0x33583a[_0x3288('0x3c')]=qs[_0x3288('0x3d')](_0x4a907a[_0x3288('0x34')][_0x3288('0x3d')]);_0x33583a[_0x3288('0x3e')]=qs[_0x3288('0x3f')](_[_0x3288('0x40')](_0x4a907a['query'],_0x51083f[_0x3288('0x3f')]));if(_0x4a907a[_0x3288('0x34')][_0x3288('0x41')]){_0x33583a[_0x3288('0x3e')]=_[_0x3288('0x42')](_0x33583a['where'],{'$or':_[_0x3288('0x2f')](_0x33583a['attributes'],function(_0x32b8f2){var _0x43e69e={};_0x43e69e[_0x32b8f2]={'$like':'%'+_0x4a907a[_0x3288('0x34')]['filter']+'%'};return _0x43e69e;})});}_0x33583a=_[_0x3288('0x42')]({},_0x33583a,_0x4a907a[_0x3288('0x49')]);return _0x32da81[_0x3288('0x89')](_0x33583a);}})[_0x3288('0x26')](function(_0x4d79d8){if(_0x4d79d8){_0x5eb6b4=_0x4d79d8['length'];if(!_0x4a907a[_0x3288('0x34')][_0x3288('0x3a')](_0x3288('0x3b'))){_0x33583a['limit']=qs[_0x3288('0x1f')](_0x4a907a[_0x3288('0x34')][_0x3288('0x1f')]);_0x33583a[_0x3288('0x1e')]=qs[_0x3288('0x1e')](_0x4a907a['query'][_0x3288('0x1e')]);}return _0x32da81['getAgents'](_0x33583a);}})['then'](function(_0x3f0c42){if(_0x3f0c42){return _0x3f0c42?{'count':_0x5eb6b4,'rows':_0x3f0c42}:null;}})[_0x3288('0x26')](respondWithResult(_0x2dca83,null))['catch'](handleError(_0x2dca83,null));}; \ No newline at end of file +var _0x42f4=['show','params','length','includeAll','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserMailQueue','order','MailQueueId','findAll','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','Agents','flatMap','transaction','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','from','team_has_mail_queues','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','union','compact','value','isEmpty','removeAgents','addAgents','spread','isArray','userMailQueue:remove','getAgents','sort','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./mailQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','MailQueues','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','where','filters','pick','filter','merge','type','VIRTUAL','options','MailQueue','rows'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x42f4,0x159));var _0x442f=function(_0x33c1b1,_0x2355fb){_0x33c1b1=_0x33c1b1-0x0;var _0x2c2037=_0x42f4[_0x33c1b1];return _0x2c2037;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x442f('0x0'));var zipdir=require(_0x442f('0x1'));var jsonpatch=require(_0x442f('0x2'));var rp=require('request-promise');var moment=require(_0x442f('0x3'));var BPromise=require(_0x442f('0x4'));var Mustache=require(_0x442f('0x5'));var util=require(_0x442f('0x6'));var path=require(_0x442f('0x7'));var sox=require('sox');var csv=require(_0x442f('0x8'));var ejs=require(_0x442f('0x9'));var fs=require('fs');var fs_extra=require(_0x442f('0xa'));var _=require(_0x442f('0xb'));var squel=require('squel');var crypto=require(_0x442f('0xc'));var jsforce=require(_0x442f('0xd'));var deskjs=require(_0x442f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x442f('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x442f('0x10'));var qs=require(_0x442f('0x11'));var as=require(_0x442f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x442f('0x13'))(_0x442f('0x14'));var utils=require('../../config/utils');var config=require(_0x442f('0x15'));var licenseUtil=require(_0x442f('0x16'));var db=require(_0x442f('0x17'))['db'];config['redis']=_[_0x442f('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x442f('0x19'))(new Redis(config[_0x442f('0x1a')]));require(_0x442f('0x1b'))[_0x442f('0x1c')](socket);function respondWithStatusCode(_0xc69f3c,_0x444526){_0x444526=_0x444526||0xcc;return function(_0x1317d6){if(_0x1317d6){return _0xc69f3c[_0x442f('0x1d')](_0x444526);}return _0xc69f3c[_0x442f('0x1e')](_0x444526)[_0x442f('0x1f')]();};}function respondWithResult(_0x2ccccc,_0x18b2d4){_0x18b2d4=_0x18b2d4||0xc8;return function(_0x37b4dd){if(_0x37b4dd){return _0x2ccccc[_0x442f('0x1e')](_0x18b2d4)[_0x442f('0x20')](_0x37b4dd);}};}function respondWithFilteredResult(_0x4a3a86,_0x3fcd18){return function(_0x3ce4af){if(_0x3ce4af){var _0x5bf231=_0x3ce4af[_0x442f('0x21')],_0x388f34=_0x3fcd18[_0x442f('0x22')],_0x5a5747=_0x3fcd18[_0x442f('0x22')]+_0x3fcd18[_0x442f('0x23')],_0x439b66;if(_0x5a5747>=_0x5bf231){_0x5a5747=_0x5bf231;_0x439b66=0xc8;}else{_0x439b66=0xce;}_0x4a3a86[_0x442f('0x1e')](_0x439b66);return _0x4a3a86[_0x442f('0x24')](_0x442f('0x25'),_0x388f34+'-'+_0x5a5747+'/'+_0x5bf231)[_0x442f('0x20')](_0x3ce4af);}return null;};}function patchUpdates(_0xdfae1d){return function(_0x5362ab){try{jsonpatch[_0x442f('0x26')](_0x5362ab,_0xdfae1d,!![]);}catch(_0x5319e9){return BPromise[_0x442f('0x27')](_0x5319e9);}return _0x5362ab[_0x442f('0x28')]();};}function saveUpdates(_0x8575ce,_0x322397){return function(_0x29e30f){if(_0x29e30f){return _0x29e30f[_0x442f('0x29')](_0x8575ce)['then'](function(_0x3a3f81){return _0x3a3f81;});}return null;};}function removeEntity(_0xe17584,_0x41dc72){return function(_0x132279){if(_0x132279){return _0x132279[_0x442f('0x2a')]()[_0x442f('0x2b')](function(){var _0xce60ca=_0x132279[_0x442f('0x2c')]({'plain':!![]});var _0x59aa4a=_0x442f('0x2d');return db[_0x442f('0x2e')][_0x442f('0x2a')]({'where':{'type':_0x59aa4a,'resourceId':_0xce60ca['id']}})[_0x442f('0x2b')](function(){return _0x132279;});})['then'](function(){_0xe17584[_0x442f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28584c,_0x4282e9){return function(_0x4efd71){if(!_0x4efd71){_0x28584c['sendStatus'](0x194);}return _0x4efd71;};}function handleError(_0x40a961,_0x290e49){_0x290e49=_0x290e49||0x1f4;return function(_0x4b1642){logger['error'](_0x4b1642[_0x442f('0x2f')]);if(_0x4b1642[_0x442f('0x30')]){delete _0x4b1642[_0x442f('0x30')];}_0x40a961[_0x442f('0x1e')](_0x290e49)[_0x442f('0x31')](_0x4b1642);};}exports[_0x442f('0x32')]=function(_0x1ba3e4,_0x4c9405){var _0x17cb0a={},_0xe8b6cd={},_0x1503d8={'count':0x0,'rows':[]};var _0x3d91e2=_['map'](db['MailQueue'][_0x442f('0x33')],function(_0x39c483){return{'name':_0x39c483[_0x442f('0x34')],'type':_0x39c483['type']['key']};});_0xe8b6cd['model']=_[_0x442f('0x35')](_0x3d91e2,_0x442f('0x30'));_0xe8b6cd[_0x442f('0x36')]=_[_0x442f('0x37')](_0x1ba3e4[_0x442f('0x36')]);_0xe8b6cd['filters']=_[_0x442f('0x38')](_0xe8b6cd[_0x442f('0x39')],_0xe8b6cd[_0x442f('0x36')]);_0x17cb0a[_0x442f('0x3a')]=_[_0x442f('0x38')](_0xe8b6cd[_0x442f('0x39')],qs[_0x442f('0x3b')](_0x1ba3e4[_0x442f('0x36')][_0x442f('0x3b')]));_0x17cb0a['attributes']=_0x17cb0a[_0x442f('0x3a')]['length']?_0x17cb0a[_0x442f('0x3a')]:_0xe8b6cd['model'];if(!_0x1ba3e4[_0x442f('0x36')][_0x442f('0x3c')](_0x442f('0x3d'))){_0x17cb0a['limit']=qs[_0x442f('0x23')](_0x1ba3e4[_0x442f('0x36')][_0x442f('0x23')]);_0x17cb0a['offset']=qs['offset'](_0x1ba3e4['query'][_0x442f('0x22')]);}_0x17cb0a['order']=qs['sort'](_0x1ba3e4[_0x442f('0x36')]['sort']);_0x17cb0a[_0x442f('0x3e')]=qs[_0x442f('0x3f')](_[_0x442f('0x40')](_0x1ba3e4[_0x442f('0x36')],_0xe8b6cd['filters']),_0x3d91e2);if(_0x1ba3e4[_0x442f('0x36')][_0x442f('0x41')]){_0x17cb0a['where']=_[_0x442f('0x42')](_0x17cb0a[_0x442f('0x3e')],{'$or':_[_0x442f('0x35')](_0x3d91e2,function(_0x2243ed){if(_0x2243ed[_0x442f('0x43')]!==_0x442f('0x44')){var _0x27ebc4={};_0x27ebc4[_0x2243ed[_0x442f('0x30')]]={'$like':'%'+_0x1ba3e4[_0x442f('0x36')][_0x442f('0x41')]+'%'};return _0x27ebc4;}})});}_0x17cb0a=_['merge']({},_0x17cb0a,_0x1ba3e4[_0x442f('0x45')]);var _0x4f2e5b={'where':_0x17cb0a[_0x442f('0x3e')]};return db[_0x442f('0x46')][_0x442f('0x21')](_0x4f2e5b)[_0x442f('0x2b')](function(_0x2306f0){_0x1503d8['count']=_0x2306f0;if(_0x1ba3e4[_0x442f('0x36')]['includeAll']){_0x17cb0a['include']=[{'all':!![]}];}return db[_0x442f('0x46')]['findAll'](_0x17cb0a);})[_0x442f('0x2b')](function(_0x5753db){_0x1503d8[_0x442f('0x47')]=_0x5753db;return _0x1503d8;})[_0x442f('0x2b')](respondWithFilteredResult(_0x4c9405,_0x17cb0a))['catch'](handleError(_0x4c9405,null));};exports[_0x442f('0x48')]=function(_0x241dd7,_0x51ae44){var _0x33b4ea={'raw':!![],'where':{'id':_0x241dd7[_0x442f('0x49')]['id']}},_0x396e02={};_0x396e02[_0x442f('0x39')]=_['keys'](db[_0x442f('0x46')][_0x442f('0x33')]);_0x396e02[_0x442f('0x36')]=_[_0x442f('0x37')](_0x241dd7[_0x442f('0x36')]);_0x396e02['filters']=_[_0x442f('0x38')](_0x396e02[_0x442f('0x39')],_0x396e02[_0x442f('0x36')]);_0x33b4ea['attributes']=_[_0x442f('0x38')](_0x396e02[_0x442f('0x39')],qs[_0x442f('0x3b')](_0x241dd7['query']['fields']));_0x33b4ea[_0x442f('0x3a')]=_0x33b4ea[_0x442f('0x3a')][_0x442f('0x4a')]?_0x33b4ea[_0x442f('0x3a')]:_0x396e02[_0x442f('0x39')];if(_0x241dd7[_0x442f('0x36')][_0x442f('0x4b')]){_0x33b4ea[_0x442f('0x4c')]=[{'all':!![]}];}_0x33b4ea=_[_0x442f('0x42')]({},_0x33b4ea,_0x241dd7[_0x442f('0x45')]);return db[_0x442f('0x46')]['find'](_0x33b4ea)['then'](handleEntityNotFound(_0x51ae44,null))[_0x442f('0x2b')](respondWithResult(_0x51ae44,null))[_0x442f('0x4d')](handleError(_0x51ae44,null));};exports[_0x442f('0x4e')]=function(_0x26b3d3,_0x435278){return db[_0x442f('0x46')][_0x442f('0x4e')](_0x26b3d3[_0x442f('0x4f')],{})[_0x442f('0x2b')](function(_0x48a6b0){var _0x376936=_0x26b3d3[_0x442f('0x50')]['get']({'plain':!![]});if(!_0x376936)throw new Error(_0x442f('0x51'));if(_0x376936['role']===_0x442f('0x50')){var _0x5a54a1=_0x48a6b0[_0x442f('0x2c')]({'plain':!![]});var _0x58b829=_0x442f('0x2d');return db['UserProfileSection'][_0x442f('0x52')]({'where':{'name':_0x58b829,'userProfileId':_0x376936[_0x442f('0x53')]},'raw':!![]})[_0x442f('0x2b')](function(_0x5902d4){if(_0x5902d4&&_0x5902d4[_0x442f('0x54')]===0x0){return db['UserProfileResource'][_0x442f('0x4e')]({'name':_0x5a54a1['name'],'resourceId':_0x5a54a1['id'],'type':_0x5902d4['name'],'sectionId':_0x5902d4['id']},{})[_0x442f('0x2b')](function(){return _0x48a6b0;});}else{return _0x48a6b0;}})['catch'](function(_0x4559a8){logger['error'](_0x442f('0x55'),_0x4559a8);throw _0x4559a8;});}return _0x48a6b0;})[_0x442f('0x2b')](respondWithResult(_0x435278,0xc9))['catch'](handleError(_0x435278,null));};exports[_0x442f('0x29')]=function(_0x52c6d0,_0x2363e3){if(_0x52c6d0['body']['id']){delete _0x52c6d0[_0x442f('0x4f')]['id'];}return db[_0x442f('0x46')][_0x442f('0x52')]({'where':{'id':_0x52c6d0[_0x442f('0x49')]['id']}})[_0x442f('0x2b')](handleEntityNotFound(_0x2363e3,null))['then'](saveUpdates(_0x52c6d0['body'],null))[_0x442f('0x2b')](respondWithResult(_0x2363e3,null))[_0x442f('0x4d')](handleError(_0x2363e3,null));};exports[_0x442f('0x2a')]=function(_0x59b694,_0x2eb0cf){return db[_0x442f('0x46')][_0x442f('0x52')]({'where':{'id':_0x59b694[_0x442f('0x49')]['id']}})[_0x442f('0x2b')](handleEntityNotFound(_0x2eb0cf,null))['then'](removeEntity(_0x2eb0cf,null))[_0x442f('0x4d')](handleError(_0x2eb0cf,null));};exports[_0x442f('0x56')]=function(_0xf312ed,_0x587f58){return db[_0x442f('0x46')]['describe']()['then'](respondWithResult(_0x587f58,null))[_0x442f('0x4d')](handleError(_0x587f58,null));};exports['getMembers']=function(_0x26948f,_0x423610,_0x2757c3){var _0xa43968={'raw':!![],'where':{}},_0x417161={},_0x8b259;return db[_0x442f('0x46')][_0x442f('0x57')]({'where':{'id':_0x26948f['params']['id']}})[_0x442f('0x2b')](handleEntityNotFound(_0x423610,null))[_0x442f('0x2b')](function(_0x123482){if(_0x123482){_0x8b259=_0x123482[_0x442f('0x2c')]({'plain':!![]});_0x417161[_0x442f('0x39')]=_[_0x442f('0x37')](db[_0x442f('0x58')][_0x442f('0x33')]);_0x417161[_0x442f('0x36')]=_['keys'](_0x26948f['query']);_0x417161[_0x442f('0x3f')]=_[_0x442f('0x38')](_0x417161[_0x442f('0x39')],_0x417161[_0x442f('0x36')]);_0xa43968['attributes']=_[_0x442f('0x38')](_0x417161[_0x442f('0x39')],qs[_0x442f('0x3b')](_0x26948f[_0x442f('0x36')][_0x442f('0x3b')]));_0xa43968[_0x442f('0x3a')]=_0xa43968[_0x442f('0x3a')][_0x442f('0x4a')]?_0xa43968['attributes']:_0x417161[_0x442f('0x39')];if(!_0x26948f['query'][_0x442f('0x3c')]('nolimit')){_0xa43968[_0x442f('0x23')]=qs['limit'](_0x26948f[_0x442f('0x36')][_0x442f('0x23')]);_0xa43968[_0x442f('0x22')]=qs[_0x442f('0x22')](_0x26948f[_0x442f('0x36')][_0x442f('0x22')]);}_0xa43968[_0x442f('0x59')]=qs['sort'](_0x26948f[_0x442f('0x36')]['sort']);_0xa43968[_0x442f('0x3e')]=qs[_0x442f('0x3f')](_['pick'](_0x26948f[_0x442f('0x36')],_0x417161['filters']));_0xa43968[_0x442f('0x3e')][_0x442f('0x5a')]=_0x123482['id'];if(_0x26948f['query'][_0x442f('0x41')]){_0xa43968[_0x442f('0x3e')]=_[_0x442f('0x42')](_0xa43968['where'],{'$or':_['map'](_0xa43968[_0x442f('0x3a')],function(_0x26c731){var _0x46b4f8={};_0x46b4f8[_0x26c731]={'$like':'%'+_0x26948f[_0x442f('0x36')][_0x442f('0x41')]+'%'};return _0x46b4f8;})});}_0xa43968=_['merge']({},_0xa43968,_0x26948f[_0x442f('0x45')]);return db[_0x442f('0x58')][_0x442f('0x5b')](_0xa43968);}})[_0x442f('0x2b')](function(_0x22cb56){if(_0x22cb56){return db[_0x442f('0x5c')][_0x442f('0x5d')]({'where':{'id':_[_0x442f('0x35')](_0x22cb56,_0x442f('0x5e')),'role':_0x442f('0x5f')},'attributes':['id',_0x442f('0x30'),_0x442f('0x60'),_0x442f('0x61'),_0x442f('0x62')]});}})[_0x442f('0x2b')](function(_0xa03f09){if(_0xa03f09){return{'count':_0xa03f09[_0x442f('0x21')],'rows':_['map'](_0xa03f09[_0x442f('0x47')],function(_0x2fc7c3){return{'membername':_0x2fc7c3[_0x442f('0x30')],'UserId':_0x2fc7c3['id'],'queue_name':_0x8b259[_0x442f('0x30')],'MailQueueId':_0x8b259['id'],'interface':util[_0x442f('0x63')](_0x442f('0x64'),_0x442f('0x65'),_0x2fc7c3['name']),'penalty':0x0,'paused':_0x2fc7c3[_0x442f('0x60')],'createdAt':_0x2fc7c3[_0x442f('0x62')],'updatedAt':_0x2fc7c3['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x442f('0x2b')](respondWithFilteredResult(_0x423610,_0xa43968))[_0x442f('0x4d')](handleError(_0x423610,null));};exports['getTeams']=function(_0x58a01e,_0x40eb32,_0x265cdf){var _0x1faac6={};var _0x3c5974={};var _0x4b7e8e;var _0x2c553a;return db[_0x442f('0x46')][_0x442f('0x57')]({'where':{'id':_0x58a01e[_0x442f('0x49')]['id']}})[_0x442f('0x2b')](handleEntityNotFound(_0x40eb32,null))['then'](function(_0x5f166f){if(_0x5f166f){_0x4b7e8e=_0x5f166f;_0x3c5974[_0x442f('0x39')]=_[_0x442f('0x37')](db[_0x442f('0x66')][_0x442f('0x33')]);_0x3c5974[_0x442f('0x36')]=_[_0x442f('0x37')](_0x58a01e[_0x442f('0x36')]);_0x3c5974[_0x442f('0x3f')]=_[_0x442f('0x38')](_0x3c5974[_0x442f('0x39')],_0x3c5974[_0x442f('0x36')]);_0x1faac6[_0x442f('0x3a')]=_[_0x442f('0x38')](_0x3c5974[_0x442f('0x39')],qs[_0x442f('0x3b')](_0x58a01e[_0x442f('0x36')]['fields']));_0x1faac6[_0x442f('0x3a')]=_0x1faac6[_0x442f('0x3a')][_0x442f('0x4a')]?_0x1faac6[_0x442f('0x3a')]:_0x3c5974[_0x442f('0x39')];_0x1faac6[_0x442f('0x59')]=qs['sort'](_0x58a01e[_0x442f('0x36')]['sort']);_0x1faac6[_0x442f('0x3e')]=qs[_0x442f('0x3f')](_[_0x442f('0x40')](_0x58a01e[_0x442f('0x36')],_0x3c5974['filters']));if(_0x58a01e['query'][_0x442f('0x41')]){_0x1faac6['where']=_[_0x442f('0x42')](_0x1faac6[_0x442f('0x3e')],{'$or':_[_0x442f('0x35')](_0x1faac6[_0x442f('0x3a')],function(_0x30c877){var _0x5b7130={};_0x5b7130[_0x30c877]={'$like':'%'+_0x58a01e[_0x442f('0x36')]['filter']+'%'};return _0x5b7130;})});}_0x1faac6=_[_0x442f('0x42')]({},_0x1faac6,_0x58a01e[_0x442f('0x45')]);return _0x4b7e8e[_0x442f('0x67')](_0x1faac6);}})[_0x442f('0x2b')](function(_0x429834){if(_0x429834){_0x2c553a=_0x429834[_0x442f('0x4a')];if(!_0x58a01e[_0x442f('0x36')][_0x442f('0x3c')](_0x442f('0x3d'))){_0x1faac6[_0x442f('0x23')]=qs[_0x442f('0x23')](_0x58a01e[_0x442f('0x36')]['limit']);_0x1faac6['offset']=qs[_0x442f('0x22')](_0x58a01e['query'][_0x442f('0x22')]);}return _0x4b7e8e[_0x442f('0x67')](_0x1faac6);}})[_0x442f('0x2b')](function(_0x2ffaa8){if(_0x2ffaa8){return _0x2ffaa8?{'count':_0x2c553a,'rows':_0x2ffaa8}:null;}})['then'](respondWithResult(_0x40eb32,null))[_0x442f('0x4d')](handleError(_0x40eb32,null));};exports[_0x442f('0x68')]=function(_0x36eb98,_0x5010f0,_0xe0a061){var _0x1d9c03=_0x36eb98[_0x442f('0x4f')][_0x442f('0x69')];return db[_0x442f('0x66')][_0x442f('0x5b')]({'where':{'id':_0x1d9c03},'attributes':['id'],'include':[{'model':db['User'],'as':_0x442f('0x6a'),'attributes':['id','name','online','voicePause','interface'],'raw':!![]}]})[_0x442f('0x2b')](function(_0xda21a5){if(_0xda21a5){var _0x343422=_[_0x442f('0x6b')](_0xda21a5,function(_0x218796){var _0x2ed1b7=_0x218796['get']({'plain':!![]});return _0x2ed1b7[_0x442f('0x6a')];});return db[_0x442f('0x46')][_0x442f('0x52')]({'where':{'id':_0x36eb98['params']['id']}})[_0x442f('0x2b')](function(_0x57d2f3){return db['sequelize'][_0x442f('0x6c')](function(_0x5b33af){return _0x57d2f3[_0x442f('0x68')](_0x1d9c03,{'transaction':_0x5b33af})[_0x442f('0x2b')](function(){return BPromise['each'](_0x343422,function(_0x396904){return db[_0x442f('0x58')][_0x442f('0x6d')]({'where':{'UserId':_0x396904['id'],'MailQueueId':_0x36eb98[_0x442f('0x49')]['id']},'transaction':_0x5b33af});});})['then'](function(){_0x343422[_0x442f('0x6e')](function(_0x105aa3){socket[_0x442f('0x6f')](_0x442f('0x70'),{'UserId':_0x105aa3['id'],'MailQueueId':_0x57d2f3['id']});});});});});}})['then'](respondWithStatusCode(_0x5010f0,null))['catch'](handleError(_0x5010f0,null));};exports[_0x442f('0x71')]=function(_0xb65c2d,_0x3aef47,_0x421d95){return db[_0x442f('0x66')][_0x442f('0x5b')]({'where':{'id':_0xb65c2d[_0x442f('0x36')][_0x442f('0x69')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x442f('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x442f('0x2b')](handleEntityNotFound(_0x3aef47,null))[_0x442f('0x2b')](function(_0x346d83){var _0x53d6c2=_[_0x442f('0x35')](_0x346d83,'id');var _0x39132d=[];var _0x29476d=[];var _0x27db77=squel[_0x442f('0x72')]();_0x27db77[_0x442f('0x73')]('tq.TeamId')[_0x442f('0x74')](_0x442f('0x75'),'tq')['join'](_0x442f('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x442f('0x3e')](_0x442f('0x77'),_0xb65c2d[_0x442f('0x49')]['id']);for(var _0x29f351=0x0;_0x29f351<_0x346d83[_0x442f('0x4a')];_0x29f351+=0x1){let _0x8f9d73=_0x346d83[_0x29f351];for(var _0x31b982=0x0;_0x31b982<_0x8f9d73[_0x442f('0x6a')][_0x442f('0x4a')];_0x31b982+=0x1){let _0x100983=_0x8f9d73[_0x442f('0x6a')][_0x31b982];var _0x8975af=_0x27db77[_0x442f('0x78')]();_0x8975af[_0x442f('0x3e')](_0x442f('0x79'),_0x100983['id']);_0x29476d[_0x442f('0x7a')](db[_0x442f('0x7b')]['query'](_0x8975af['toString'](),{'type':db[_0x442f('0x7b')][_0x442f('0x7c')][_0x442f('0x7d')]})[_0x442f('0x2b')](function(_0x3bcafd){if(_0x3bcafd['length']===0x1){return _0x100983['id'];}else{var _0x3aea06=_[_0x442f('0x7e')](_[_0x442f('0x35')](_0x3bcafd,_0x442f('0x7f')),function(_0x398494){return _['includes'](_0x53d6c2,_0x398494);});if(_0x3aea06){return _0x100983['id'];}}}));}}return BPromise['all'](_0x29476d)['then'](function(_0x2c2ac0){_0x39132d=_(_0x39132d)[_0x442f('0x80')](_0x2c2ac0)[_0x442f('0x81')]()[_0x442f('0x82')]();return db[_0x442f('0x46')][_0x442f('0x52')]({'where':{'id':_0xb65c2d[_0x442f('0x49')]['id']}})[_0x442f('0x2b')](function(_0x160434){return db[_0x442f('0x7b')][_0x442f('0x6c')](function(_0x323aed){return _0x160434[_0x442f('0x71')](_0xb65c2d[_0x442f('0x36')][_0x442f('0x69')],{'transaction':_0x323aed})[_0x442f('0x2b')](function(){if(!_[_0x442f('0x83')](_0x39132d)){return _0x160434[_0x442f('0x84')](_0x39132d,{'transaction':_0x323aed});}})[_0x442f('0x2b')](function(){_0x39132d['forEach'](function(_0x309502){socket[_0x442f('0x6f')]('userMailQueue:remove',{'UserId':_0x309502,'MailQueueId':_0x160434['id']});});});});});});})['then'](respondWithStatusCode(_0x3aef47,null))['catch'](handleError(_0x3aef47,null));};exports[_0x442f('0x85')]=function(_0x890af,_0x3f35d3,_0x1f2a48){return db[_0x442f('0x46')]['find']({'where':{'id':_0x890af[_0x442f('0x49')]['id']}})['then'](handleEntityNotFound(_0x3f35d3,null))[_0x442f('0x2b')](function(_0x407eec){if(_0x407eec){return _0x407eec['addAgents'](_0x890af[_0x442f('0x4f')]['ids'],_['omit'](_0x890af['body'],['ids','id'])||{})[_0x442f('0x86')](function(_0x46f397){for(var _0x42db1e=0x0;_0x42db1e<_0x890af['body'][_0x442f('0x69')]['length'];_0x42db1e+=0x1){socket[_0x442f('0x6f')](_0x442f('0x70'),{'UserId':_0x890af[_0x442f('0x4f')][_0x442f('0x69')][_0x42db1e],'MailQueueId':_0x890af[_0x442f('0x49')]['id']});}return _0x46f397;});}})['then'](respondWithResult(_0x3f35d3,null))[_0x442f('0x4d')](handleError(_0x3f35d3,null));};exports[_0x442f('0x84')]=function(_0x48f351,_0x100e87,_0x2956d4){return db[_0x442f('0x46')]['find']({'where':{'id':_0x48f351['params']['id']}})[_0x442f('0x2b')](handleEntityNotFound(_0x100e87,null))['then'](function(_0xc463d5){if(_0xc463d5){return _0xc463d5[_0x442f('0x84')](_0x48f351[_0x442f('0x36')]['ids'])[_0x442f('0x2b')](function(){if(_[_0x442f('0x87')](_0x48f351[_0x442f('0x36')][_0x442f('0x69')])){for(var _0x173c59=0x0;_0x173c59<_0x48f351[_0x442f('0x36')][_0x442f('0x69')][_0x442f('0x4a')];_0x173c59+=0x1){socket[_0x442f('0x6f')](_0x442f('0x88'),{'UserId':Number(_0x48f351[_0x442f('0x36')][_0x442f('0x69')][_0x173c59]),'MailQueueId':Number(_0x48f351[_0x442f('0x49')]['id'])});}}else{socket[_0x442f('0x6f')](_0x442f('0x88'),{'UserId':Number(_0x48f351[_0x442f('0x36')]['ids']),'MailQueueId':Number(_0x48f351[_0x442f('0x49')]['id'])});}});}})[_0x442f('0x2b')](respondWithStatusCode(_0x100e87,null))[_0x442f('0x4d')](handleError(_0x100e87,null));};exports[_0x442f('0x89')]=function(_0x471549,_0x478445,_0x126e21){var _0x32934c={};var _0xa6ad19={};var _0x6cd358;var _0x27bc07;return db[_0x442f('0x46')][_0x442f('0x57')]({'where':{'id':_0x471549[_0x442f('0x49')]['id']}})[_0x442f('0x2b')](handleEntityNotFound(_0x478445,null))[_0x442f('0x2b')](function(_0x22a11c){if(_0x22a11c){_0x6cd358=_0x22a11c;_0xa6ad19[_0x442f('0x39')]=_[_0x442f('0x37')](db['User']['rawAttributes']);_0xa6ad19[_0x442f('0x36')]=_[_0x442f('0x37')](_0x471549[_0x442f('0x36')]);_0xa6ad19[_0x442f('0x3f')]=_['intersection'](_0xa6ad19['model'],_0xa6ad19[_0x442f('0x36')]);_0x32934c[_0x442f('0x3a')]=_[_0x442f('0x38')](_0xa6ad19[_0x442f('0x39')],qs['fields'](_0x471549[_0x442f('0x36')][_0x442f('0x3b')]));_0x32934c[_0x442f('0x3a')]=_0x32934c[_0x442f('0x3a')][_0x442f('0x4a')]?_0x32934c[_0x442f('0x3a')]:_0xa6ad19[_0x442f('0x39')];_0x32934c[_0x442f('0x59')]=qs['sort'](_0x471549['query'][_0x442f('0x8a')]);_0x32934c[_0x442f('0x3e')]=qs[_0x442f('0x3f')](_['pick'](_0x471549[_0x442f('0x36')],_0xa6ad19[_0x442f('0x3f')]));if(_0x471549[_0x442f('0x36')][_0x442f('0x41')]){_0x32934c[_0x442f('0x3e')]=_[_0x442f('0x42')](_0x32934c['where'],{'$or':_[_0x442f('0x35')](_0x32934c[_0x442f('0x3a')],function(_0x526cbc){var _0x35e245={};_0x35e245[_0x526cbc]={'$like':'%'+_0x471549[_0x442f('0x36')]['filter']+'%'};return _0x35e245;})});}_0x32934c=_['merge']({},_0x32934c,_0x471549[_0x442f('0x45')]);return _0x6cd358[_0x442f('0x89')](_0x32934c);}})['then'](function(_0x4d695e){if(_0x4d695e){_0x27bc07=_0x4d695e[_0x442f('0x4a')];if(!_0x471549[_0x442f('0x36')][_0x442f('0x3c')]('nolimit')){_0x32934c[_0x442f('0x23')]=qs[_0x442f('0x23')](_0x471549[_0x442f('0x36')][_0x442f('0x23')]);_0x32934c[_0x442f('0x22')]=qs['offset'](_0x471549['query'][_0x442f('0x22')]);}return _0x6cd358['getAgents'](_0x32934c);}})['then'](function(_0x9716e0){if(_0x9716e0){return _0x9716e0?{'count':_0x27bc07,'rows':_0x9716e0}:null;}})['then'](respondWithResult(_0x478445,null))['catch'](handleError(_0x478445,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index c297d42..c9c090b 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 _0x4dd4=['hasOwnProperty','hook','events','MailQueue','setMaxListeners','save','update','remove','emit'];(function(_0x5509e4,_0x420554){var _0x2108d=function(_0x5383f8){while(--_0x5383f8){_0x5509e4['push'](_0x5509e4['shift']());}};_0x2108d(++_0x420554);}(_0x4dd4,0x1f1));var _0x44dd=function(_0x14b6dd,_0x6777c8){_0x14b6dd=_0x14b6dd-0x0;var _0x31be86=_0x4dd4[_0x14b6dd];return _0x31be86;};'use strict';var EventEmitter=require(_0x44dd('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x44dd('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x44dd('0x2')](0x0);var events={'afterCreate':_0x44dd('0x3'),'afterUpdate':_0x44dd('0x4'),'afterDestroy':_0x44dd('0x5')};function emitEvent(_0x1d13b4){return function(_0x1ce3e5,_0x5c46c1,_0x1e46a9){MailQueueEvents['emit'](_0x1d13b4+':'+_0x1ce3e5['id'],_0x1ce3e5);MailQueueEvents[_0x44dd('0x6')](_0x1d13b4,_0x1ce3e5);_0x1e46a9(null);};}for(var e in events){if(events[_0x44dd('0x7')](e)){var event=events[e];MailQueue[_0x44dd('0x8')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x485b=['MailQueue','setMaxListeners','save','update','emit','events'];(function(_0xc8dfd8,_0x2358f1){var _0x5e2ae3=function(_0x1e5832){while(--_0x1e5832){_0xc8dfd8['push'](_0xc8dfd8['shift']());}};_0x5e2ae3(++_0x2358f1);}(_0x485b,0x1d3));var _0xb485=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x485b[_0x4bfac3];return _0x15f0f2;};'use strict';var EventEmitter=require(_0xb485('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xb485('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xb485('0x2')](0x0);var events={'afterCreate':_0xb485('0x3'),'afterUpdate':_0xb485('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1339bc){return function(_0x812bd,_0x25f7b3,_0x3d2728){MailQueueEvents[_0xb485('0x5')](_0x1339bc+':'+_0x812bd['id'],_0x812bd);MailQueueEvents['emit'](_0x1339bc,_0x812bd);_0x3d2728(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 99009f4..0b3c657 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 _0xbeac=['../../config/environment','exports','define','MailQueue','mail_queues','lodash','util','bluebird','path','rimraf'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0xbeac,0x1c7));var _0xcbea=function(_0x93922e,_0x8f6820){_0x93922e=_0x93922e-0x0;var _0x4bb29e=_0xbeac[_0x93922e];return _0x4bb29e;};'use strict';var _=require(_0xcbea('0x0'));var util=require(_0xcbea('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xcbea('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcbea('0x3'));var rimraf=require(_0xcbea('0x4'));var config=require(_0xcbea('0x5'));var attributes=require('./mailQueue.attributes');module[_0xcbea('0x6')]=function(_0x51539f,_0xd02beb){return _0x51539f[_0xcbea('0x7')](_0xcbea('0x8'),attributes,{'tableName':_0xcbea('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x792f=['exports','define','mail_queues','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x792f,0x1ef));var _0xf792=function(_0x36f47c,_0x38ef4d){_0x36f47c=_0x36f47c-0x0;var _0x296c55=_0x792f[_0x36f47c];return _0x296c55;};'use strict';var _=require(_0xf792('0x0'));var util=require('util');var logger=require(_0xf792('0x1'))(_0xf792('0x2'));var moment=require(_0xf792('0x3'));var BPromise=require(_0xf792('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf792('0x5'));var rimraf=require(_0xf792('0x6'));var config=require(_0xf792('0x7'));var attributes=require(_0xf792('0x8'));module[_0xf792('0x9')]=function(_0xbcea1b,_0x2fcd5d){return _0xbcea1b[_0xf792('0xa')]('MailQueue',attributes,{'tableName':_0xf792('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index b59a919..27c14c1 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 _0xad93=['GetMailQueue','ShowMailQueue','find','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','MailQueue','options','raw','where','attributes','limit','include','map','model'];(function(_0x4a7643,_0x114c7f){var _0x33236b=function(_0x5d3341){while(--_0x5d3341){_0x4a7643['push'](_0x4a7643['shift']());}};_0x33236b(++_0x114c7f);}(_0xad93,0x12a));var _0x3ad9=function(_0x11de69,_0x46c7c6){_0x11de69=_0x11de69-0x0;var _0x211379=_0xad93[_0x11de69];return _0x211379;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3ad9('0x0'));var BPromise=require(_0x3ad9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3ad9('0x2'));var db=require(_0x3ad9('0x3'))['db'];var utils=require(_0x3ad9('0x4'));var logger=require(_0x3ad9('0x5'))(_0x3ad9('0x6'));var config=require(_0x3ad9('0x7'));var jayson=require(_0x3ad9('0x8'));var client=jayson[_0x3ad9('0x9')][_0x3ad9('0xa')]({'port':0x232a});config[_0x3ad9('0xb')]=_[_0x3ad9('0xc')](config[_0x3ad9('0xb')],{'host':_0x3ad9('0xd'),'port':0x18eb});var socket=require(_0x3ad9('0xe'))(new Redis(config[_0x3ad9('0xb')]));require(_0x3ad9('0xf'))[_0x3ad9('0x10')](socket);function respondWithRpcPromise(_0x58a14d,_0x540d45,_0x55d0ff){return new BPromise(function(_0x397f78,_0x3ae7f9){return client[_0x3ad9('0x11')](_0x58a14d,_0x55d0ff)[_0x3ad9('0x12')](function(_0x47aa09){logger[_0x3ad9('0x13')](_0x3ad9('0x14'),_0x540d45,_0x3ad9('0x15'));logger[_0x3ad9('0x16')](_0x3ad9('0x17'),_0x540d45,_0x3ad9('0x15'),JSON[_0x3ad9('0x18')](_0x47aa09));if(_0x47aa09['error']){if(_0x47aa09[_0x3ad9('0x19')][_0x3ad9('0x1a')]===0x1f4){logger[_0x3ad9('0x19')](_0x3ad9('0x14'),_0x540d45,_0x47aa09['error'][_0x3ad9('0x1b')]);return _0x3ae7f9(_0x47aa09['error'][_0x3ad9('0x1b')]);}logger[_0x3ad9('0x19')](_0x3ad9('0x14'),_0x540d45,_0x47aa09[_0x3ad9('0x19')][_0x3ad9('0x1b')]);return _0x397f78(_0x47aa09[_0x3ad9('0x19')][_0x3ad9('0x1b')]);}else{logger[_0x3ad9('0x13')](_0x3ad9('0x14'),_0x540d45,'request\x20sent');_0x397f78(_0x47aa09[_0x3ad9('0x1c')]['message']);}})['catch'](function(_0x1d55dd){logger[_0x3ad9('0x19')](_0x3ad9('0x14'),_0x540d45,_0x1d55dd);_0x3ae7f9(_0x1d55dd);});});}exports['GetMailQueue']=function(_0x4a0775){var _0x5337cb=this;return new Promise(function(_0x496bc0,_0x49c993){return db[_0x3ad9('0x1d')]['findAll']({'raw':_0x4a0775[_0x3ad9('0x1e')]?_0x4a0775[_0x3ad9('0x1e')][_0x3ad9('0x1f')]===undefined?!![]:![]:!![],'where':_0x4a0775[_0x3ad9('0x1e')]?_0x4a0775[_0x3ad9('0x1e')][_0x3ad9('0x20')]||null:null,'attributes':_0x4a0775['options']?_0x4a0775['options'][_0x3ad9('0x21')]||null:null,'limit':_0x4a0775[_0x3ad9('0x1e')]?_0x4a0775['options'][_0x3ad9('0x22')]||null:null,'include':_0x4a0775[_0x3ad9('0x1e')]?_0x4a0775['options'][_0x3ad9('0x23')]?_[_0x3ad9('0x24')](_0x4a0775['options'][_0x3ad9('0x23')],function(_0x3ef4d3){return{'model':db[_0x3ef4d3[_0x3ad9('0x25')]],'as':_0x3ef4d3['as'],'attributes':_0x3ef4d3[_0x3ad9('0x21')],'include':_0x3ef4d3[_0x3ad9('0x23')]?_[_0x3ad9('0x24')](_0x3ef4d3['include'],function(_0x9829b9){return{'model':db[_0x9829b9[_0x3ad9('0x25')]],'as':_0x9829b9['as'],'attributes':_0x9829b9[_0x3ad9('0x21')],'include':_0x9829b9[_0x3ad9('0x23')]?_[_0x3ad9('0x24')](_0x9829b9[_0x3ad9('0x23')],function(_0x356670){return{'model':db[_0x356670[_0x3ad9('0x25')]],'as':_0x356670['as'],'attributes':_0x356670[_0x3ad9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3ad9('0x12')](function(_0x499da8){logger['info']('GetMailQueue',_0x4a0775);logger[_0x3ad9('0x16')](_0x3ad9('0x26'),_0x4a0775,JSON[_0x3ad9('0x18')](_0x499da8));_0x496bc0(_0x499da8);})['catch'](function(_0x12dddb){logger[_0x3ad9('0x19')](_0x3ad9('0x26'),_0x12dddb['message'],_0x4a0775);_0x49c993(_0x5337cb['error'](0x1f4,_0x12dddb[_0x3ad9('0x1b')]));});});};exports[_0x3ad9('0x27')]=function(_0x3321de){var _0x1e2950=this;return new Promise(function(_0x1e4440,_0x105a62){return db['MailQueue'][_0x3ad9('0x28')]({'raw':_0x3321de[_0x3ad9('0x1e')]?_0x3321de[_0x3ad9('0x1e')][_0x3ad9('0x1f')]===undefined?!![]:![]:!![],'where':_0x3321de[_0x3ad9('0x1e')]?_0x3321de[_0x3ad9('0x1e')][_0x3ad9('0x20')]||null:null,'attributes':_0x3321de[_0x3ad9('0x1e')]?_0x3321de[_0x3ad9('0x1e')][_0x3ad9('0x21')]||null:null,'include':_0x3321de[_0x3ad9('0x1e')]?_0x3321de[_0x3ad9('0x1e')][_0x3ad9('0x23')]?_[_0x3ad9('0x24')](_0x3321de[_0x3ad9('0x1e')]['include'],function(_0x1797f2){return{'model':db[_0x1797f2[_0x3ad9('0x25')]],'as':_0x1797f2['as'],'attributes':_0x1797f2[_0x3ad9('0x21')],'include':_0x1797f2[_0x3ad9('0x23')]?_[_0x3ad9('0x24')](_0x1797f2[_0x3ad9('0x23')],function(_0x26e832){return{'model':db[_0x26e832['model']],'as':_0x26e832['as'],'attributes':_0x26e832[_0x3ad9('0x21')],'include':_0x26e832[_0x3ad9('0x23')]?_[_0x3ad9('0x24')](_0x26e832[_0x3ad9('0x23')],function(_0x4ac081){return{'model':db[_0x4ac081[_0x3ad9('0x25')]],'as':_0x4ac081['as'],'attributes':_0x4ac081[_0x3ad9('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4bf365){logger[_0x3ad9('0x13')](_0x3ad9('0x27'),_0x3321de);logger[_0x3ad9('0x16')](_0x3ad9('0x27'),_0x3321de,JSON[_0x3ad9('0x18')](_0x4bf365));_0x1e4440(_0x4bf365);})[_0x3ad9('0x29')](function(_0x33b881){logger[_0x3ad9('0x19')]('ShowMailQueue',_0x33b881[_0x3ad9('0x1b')],_0x3321de);_0x105a62(_0x1e2950['error'](0x1f4,_0x33b881[_0x3ad9('0x1b')]));});});}; \ No newline at end of file +var _0x54ad=['./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','GetMailQueue','MailQueue','options','raw','where','attributes','include','model','map','debug','find','ShowMailQueue','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','defaults','socket.io-emitter'];(function(_0x4ca586,_0x3236b9){var _0x378d9d=function(_0x400603){while(--_0x400603){_0x4ca586['push'](_0x4ca586['shift']());}};_0x378d9d(++_0x3236b9);}(_0x54ad,0x1c9));var _0xd54a=function(_0x5b4921,_0x3722d9){_0x5b4921=_0x5b4921-0x0;var _0x42c404=_0x54ad[_0x5b4921];return _0x42c404;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd54a('0x0'));var BPromise=require('bluebird');var rs=require(_0xd54a('0x1'));var fs=require('fs');var Redis=require(_0xd54a('0x2'));var db=require(_0xd54a('0x3'))['db'];var utils=require(_0xd54a('0x4'));var logger=require('../../config/logger')(_0xd54a('0x5'));var config=require(_0xd54a('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd54a('0x7')]({'port':0x232a});config[_0xd54a('0x8')]=_[_0xd54a('0x9')](config[_0xd54a('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xd54a('0xa'))(new Redis(config[_0xd54a('0x8')]));require(_0xd54a('0xb'))[_0xd54a('0xc')](socket);function respondWithRpcPromise(_0x1fc798,_0x2cf59d,_0x16e675){return new BPromise(function(_0x32797b,_0x3b1b62){return client[_0xd54a('0xd')](_0x1fc798,_0x16e675)[_0xd54a('0xe')](function(_0x3d4a73){logger['info'](_0xd54a('0xf'),_0x2cf59d,'request\x20sent');logger['debug'](_0xd54a('0x10'),_0x2cf59d,_0xd54a('0x11'),JSON[_0xd54a('0x12')](_0x3d4a73));if(_0x3d4a73[_0xd54a('0x13')]){if(_0x3d4a73[_0xd54a('0x13')]['code']===0x1f4){logger[_0xd54a('0x13')](_0xd54a('0xf'),_0x2cf59d,_0x3d4a73[_0xd54a('0x13')]['message']);return _0x3b1b62(_0x3d4a73[_0xd54a('0x13')]['message']);}logger[_0xd54a('0x13')](_0xd54a('0xf'),_0x2cf59d,_0x3d4a73[_0xd54a('0x13')][_0xd54a('0x14')]);return _0x32797b(_0x3d4a73[_0xd54a('0x13')][_0xd54a('0x14')]);}else{logger[_0xd54a('0x15')](_0xd54a('0xf'),_0x2cf59d,_0xd54a('0x11'));_0x32797b(_0x3d4a73[_0xd54a('0x16')]['message']);}})[_0xd54a('0x17')](function(_0x1d58fa){logger[_0xd54a('0x13')](_0xd54a('0xf'),_0x2cf59d,_0x1d58fa);_0x3b1b62(_0x1d58fa);});});}exports[_0xd54a('0x18')]=function(_0x102422){var _0x564c06=this;return new Promise(function(_0x238f75,_0x3d69c1){return db[_0xd54a('0x19')]['findAll']({'raw':_0x102422[_0xd54a('0x1a')]?_0x102422[_0xd54a('0x1a')][_0xd54a('0x1b')]===undefined?!![]:![]:!![],'where':_0x102422[_0xd54a('0x1a')]?_0x102422['options'][_0xd54a('0x1c')]||null:null,'attributes':_0x102422['options']?_0x102422[_0xd54a('0x1a')][_0xd54a('0x1d')]||null:null,'limit':_0x102422[_0xd54a('0x1a')]?_0x102422['options']['limit']||null:null,'include':_0x102422['options']?_0x102422[_0xd54a('0x1a')][_0xd54a('0x1e')]?_['map'](_0x102422[_0xd54a('0x1a')][_0xd54a('0x1e')],function(_0x35de6a){return{'model':db[_0x35de6a[_0xd54a('0x1f')]],'as':_0x35de6a['as'],'attributes':_0x35de6a[_0xd54a('0x1d')],'include':_0x35de6a[_0xd54a('0x1e')]?_['map'](_0x35de6a[_0xd54a('0x1e')],function(_0x5f120e){return{'model':db[_0x5f120e[_0xd54a('0x1f')]],'as':_0x5f120e['as'],'attributes':_0x5f120e[_0xd54a('0x1d')],'include':_0x5f120e[_0xd54a('0x1e')]?_[_0xd54a('0x20')](_0x5f120e[_0xd54a('0x1e')],function(_0x446675){return{'model':db[_0x446675[_0xd54a('0x1f')]],'as':_0x446675['as'],'attributes':_0x446675[_0xd54a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd54a('0xe')](function(_0x1466e6){logger[_0xd54a('0x15')](_0xd54a('0x18'),_0x102422);logger[_0xd54a('0x21')]('GetMailQueue',_0x102422,JSON[_0xd54a('0x12')](_0x1466e6));_0x238f75(_0x1466e6);})[_0xd54a('0x17')](function(_0x461c88){logger[_0xd54a('0x13')](_0xd54a('0x18'),_0x461c88[_0xd54a('0x14')],_0x102422);_0x3d69c1(_0x564c06['error'](0x1f4,_0x461c88[_0xd54a('0x14')]));});});};exports['ShowMailQueue']=function(_0xfab85){var _0x18eb10=this;return new Promise(function(_0x28f100,_0x1f9c22){return db[_0xd54a('0x19')][_0xd54a('0x22')]({'raw':_0xfab85[_0xd54a('0x1a')]?_0xfab85[_0xd54a('0x1a')][_0xd54a('0x1b')]===undefined?!![]:![]:!![],'where':_0xfab85[_0xd54a('0x1a')]?_0xfab85[_0xd54a('0x1a')]['where']||null:null,'attributes':_0xfab85[_0xd54a('0x1a')]?_0xfab85[_0xd54a('0x1a')][_0xd54a('0x1d')]||null:null,'include':_0xfab85[_0xd54a('0x1a')]?_0xfab85['options'][_0xd54a('0x1e')]?_[_0xd54a('0x20')](_0xfab85[_0xd54a('0x1a')]['include'],function(_0x130cc8){return{'model':db[_0x130cc8[_0xd54a('0x1f')]],'as':_0x130cc8['as'],'attributes':_0x130cc8[_0xd54a('0x1d')],'include':_0x130cc8[_0xd54a('0x1e')]?_[_0xd54a('0x20')](_0x130cc8[_0xd54a('0x1e')],function(_0x53a157){return{'model':db[_0x53a157[_0xd54a('0x1f')]],'as':_0x53a157['as'],'attributes':_0x53a157[_0xd54a('0x1d')],'include':_0x53a157['include']?_[_0xd54a('0x20')](_0x53a157[_0xd54a('0x1e')],function(_0x52b03d){return{'model':db[_0x52b03d['model']],'as':_0x52b03d['as'],'attributes':_0x52b03d['attributes']};}):[]};}):[]};}):[]:[]})[_0xd54a('0xe')](function(_0x2f5270){logger['info'](_0xd54a('0x23'),_0xfab85);logger[_0xd54a('0x21')](_0xd54a('0x23'),_0xfab85,JSON[_0xd54a('0x12')](_0x2f5270));_0x28f100(_0x2f5270);})[_0xd54a('0x17')](function(_0xaf136d){logger[_0xd54a('0x13')](_0xd54a('0x23'),_0xaf136d[_0xd54a('0x14')],_0xfab85);_0x1f9c22(_0x18eb10[_0xd54a('0x13')](0x1f4,_0xaf136d[_0xd54a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 1c8a342..745a04f 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 _0x25c0=['update','emit','removeListener','register','length','mailQueue:','./mailQueue.events','save','remove'];(function(_0x172441,_0x56ccee){var _0x3feeb0=function(_0x248999){while(--_0x248999){_0x172441['push'](_0x172441['shift']());}};_0x3feeb0(++_0x56ccee);}(_0x25c0,0x153));var _0x025c=function(_0x5b80f6,_0x553fa6){_0x5b80f6=_0x5b80f6-0x0;var _0xd57c33=_0x25c0[_0x5b80f6];return _0xd57c33;};'use strict';var MailQueueEvents=require(_0x025c('0x0'));var events=[_0x025c('0x1'),_0x025c('0x2'),_0x025c('0x3')];function createListener(_0x38fd69,_0x436047){return function(_0x405bd1){_0x436047[_0x025c('0x4')](_0x38fd69,_0x405bd1);};}function removeListener(_0xd48b9e,_0x2ffbcf){return function(){MailQueueEvents[_0x025c('0x5')](_0xd48b9e,_0x2ffbcf);};}exports[_0x025c('0x6')]=function(_0x249c19){for(var _0x4d6d37=0x0,_0x3d7d82=events[_0x025c('0x7')];_0x4d6d37<_0x3d7d82;_0x4d6d37++){var _0x432964=events[_0x4d6d37];var _0x453ddb=createListener(_0x025c('0x8')+_0x432964,_0x249c19);MailQueueEvents['on'](_0x432964,_0x453ddb);}}; \ No newline at end of file +var _0xb18f=['./mailQueue.events','remove','removeListener','length','mailQueue:'];(function(_0x47b1a9,_0x14e74f){var _0x1be6e2=function(_0x8c39be){while(--_0x8c39be){_0x47b1a9['push'](_0x47b1a9['shift']());}};_0x1be6e2(++_0x14e74f);}(_0xb18f,0x82));var _0xfb18=function(_0x10df05,_0x5d1b29){_0x10df05=_0x10df05-0x0;var _0xd7b725=_0xb18f[_0x10df05];return _0xd7b725;};'use strict';var MailQueueEvents=require(_0xfb18('0x0'));var events=['save',_0xfb18('0x1'),'update'];function createListener(_0x376140,_0x143714){return function(_0x3786b7){_0x143714['emit'](_0x376140,_0x3786b7);};}function removeListener(_0x45077e,_0x4311d0){return function(){MailQueueEvents[_0xfb18('0x2')](_0x45077e,_0x4311d0);};}exports['register']=function(_0x3877a4){for(var _0x49ace4=0x0,_0x50756e=events[_0xfb18('0x3')];_0x49ace4<_0x50756e;_0x49ace4++){var _0xedf806=events[_0x49ace4];var _0x38da21=createListener(_0xfb18('0x4')+_0xedf806,_0x3877a4);MailQueueEvents['on'](_0xedf806,_0x38da21);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index d504ee9..1e3eaa0 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 _0x0911=['/describe','describe','/:id','show','post','create','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index'];(function(_0x936c4f,_0x2d9a68){var _0x2c6779=function(_0x3d2a2d){while(--_0x3d2a2d){_0x936c4f['push'](_0x936c4f['shift']());}};_0x2c6779(++_0x2d9a68);}(_0x0911,0x1a9));var _0x1091=function(_0x109dbd,_0x290d2b){_0x109dbd=_0x109dbd-0x0;var _0x395644=_0x0911[_0x109dbd];return _0x395644;};'use strict';var multer=require(_0x1091('0x0'));var util=require(_0x1091('0x1'));var path=require(_0x1091('0x2'));var timeout=require(_0x1091('0x3'));var express=require(_0x1091('0x4'));var router=express['Router']();var fs_extra=require(_0x1091('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1091('0x6'));var config=require(_0x1091('0x7'));var controller=require(_0x1091('0x8'));router[_0x1091('0x9')]('/',auth[_0x1091('0xa')](),controller[_0x1091('0xb')]);router[_0x1091('0x9')](_0x1091('0xc'),auth[_0x1091('0xa')](),controller[_0x1091('0xd')]);router['get'](_0x1091('0xe'),auth[_0x1091('0xa')](),controller[_0x1091('0xf')]);router[_0x1091('0x10')]('/',auth[_0x1091('0xa')](),controller[_0x1091('0x11')]);router['put'](_0x1091('0xe'),auth[_0x1091('0xa')](),controller['update']);router['delete'](_0x1091('0xe'),auth['isAuthenticated'](),controller[_0x1091('0x12')]);module['exports']=router; \ No newline at end of file +var _0xc8b0=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/:id','create','put','update','delete','exports'];(function(_0x53f740,_0x1c689c){var _0x50636a=function(_0x304fbc){while(--_0x304fbc){_0x53f740['push'](_0x53f740['shift']());}};_0x50636a(++_0x1c689c);}(_0xc8b0,0x1cc));var _0x0c8b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc8b0[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x0c8b('0x0'));var util=require(_0x0c8b('0x1'));var path=require(_0x0c8b('0x2'));var timeout=require(_0x0c8b('0x3'));var express=require(_0x0c8b('0x4'));var router=express[_0x0c8b('0x5')]();var fs_extra=require(_0x0c8b('0x6'));var auth=require(_0x0c8b('0x7'));var interaction=require(_0x0c8b('0x8'));var config=require(_0x0c8b('0x9'));var controller=require(_0x0c8b('0xa'));router[_0x0c8b('0xb')]('/',auth[_0x0c8b('0xc')](),controller[_0x0c8b('0xd')]);router[_0x0c8b('0xb')]('/describe',auth[_0x0c8b('0xc')](),controller['describe']);router[_0x0c8b('0xb')](_0x0c8b('0xe'),auth[_0x0c8b('0xc')](),controller['show']);router['post']('/',auth[_0x0c8b('0xc')](),controller[_0x0c8b('0xf')]);router[_0x0c8b('0x10')]('/:id',auth[_0x0c8b('0xc')](),controller[_0x0c8b('0x11')]);router[_0x0c8b('0x12')](_0x0c8b('0xe'),auth[_0x0c8b('0xc')](),controller['destroy']);module[_0x0c8b('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 5591d16..d9818bb 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 _0x53c4=['STRING','DATE','moment','sequelize','exports'];(function(_0x429948,_0x1a6851){var _0x35d5d1=function(_0x574853){while(--_0x574853){_0x429948['push'](_0x429948['shift']());}};_0x35d5d1(++_0x1a6851);}(_0x53c4,0x89));var _0x453c=function(_0x3356d9,_0xaf071){_0x3356d9=_0x3356d9-0x0;var _0x17039f=_0x53c4[_0x3356d9];return _0x17039f;};'use strict';var moment=require(_0x453c('0x0'));var Sequelize=require(_0x453c('0x1'));module[_0x453c('0x2')]={'uniqueid':{'type':Sequelize[_0x453c('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x453c('0x3')]},'joinAt':{'type':Sequelize[_0x453c('0x4')]},'leaveAt':{'type':Sequelize[_0x453c('0x4')]},'acceptAt':{'type':Sequelize[_0x453c('0x4')]},'exitAt':{'type':Sequelize[_0x453c('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe375=['exports','STRING','DATE','moment','sequelize'];(function(_0x264418,_0x281612){var _0x29ba24=function(_0x32a261){while(--_0x32a261){_0x264418['push'](_0x264418['shift']());}};_0x29ba24(++_0x281612);}(_0xe375,0x157));var _0x5e37=function(_0x44bec9,_0x5ce5f4){_0x44bec9=_0x44bec9-0x0;var _0x533898=_0xe375[_0x44bec9];return _0x533898;};'use strict';var moment=require(_0x5e37('0x0'));var Sequelize=require(_0x5e37('0x1'));module[_0x5e37('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5e37('0x3')]},'joinAt':{'type':Sequelize[_0x5e37('0x4')]},'leaveAt':{'type':Sequelize[_0x5e37('0x4')]},'acceptAt':{'type':Sequelize[_0x5e37('0x4')]},'exitAt':{'type':Sequelize[_0x5e37('0x4')]},'reason':{'type':Sequelize[_0x5e37('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index fd2a745..729107e 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 _0xa70d=['count','offset','limit','status','Content-Range','apply','save','destroy','then','error','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','fields','options','find','create','body','update','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json'];(function(_0x1d368b,_0x401254){var _0x4ff1c1=function(_0x45b679){while(--_0x45b679){_0x1d368b['push'](_0x1d368b['shift']());}};_0x4ff1c1(++_0x401254);}(_0xa70d,0x1a8));var _0xda70=function(_0x27c677,_0xe28520){_0x27c677=_0x27c677-0x0;var _0x2553fe=_0xa70d[_0x27c677];return _0x2553fe;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xda70('0x0'));var jsonpatch=require(_0xda70('0x1'));var rp=require(_0xda70('0x2'));var moment=require(_0xda70('0x3'));var BPromise=require(_0xda70('0x4'));var Mustache=require(_0xda70('0x5'));var util=require(_0xda70('0x6'));var path=require('path');var sox=require(_0xda70('0x7'));var csv=require('to-csv');var ejs=require(_0xda70('0x8'));var fs=require('fs');var fs_extra=require(_0xda70('0x9'));var _=require(_0xda70('0xa'));var squel=require(_0xda70('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xda70('0xc'));var toCsv=require(_0xda70('0xd'));var querystring=require(_0xda70('0xe'));var Papa=require(_0xda70('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xda70('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda70('0x11'));var logger=require(_0xda70('0x12'))(_0xda70('0x13'));var utils=require(_0xda70('0x14'));var config=require(_0xda70('0x15'));var licenseUtil=require(_0xda70('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x529c86,_0x5abba4){_0x5abba4=_0x5abba4||0xcc;return function(_0x4cc271){if(_0x4cc271){return _0x529c86[_0xda70('0x17')](_0x5abba4);}return _0x529c86['status'](_0x5abba4)[_0xda70('0x18')]();};}function respondWithResult(_0x80794e,_0x59c311){_0x59c311=_0x59c311||0xc8;return function(_0x1d1c7c){if(_0x1d1c7c){return _0x80794e['status'](_0x59c311)[_0xda70('0x19')](_0x1d1c7c);}};}function respondWithFilteredResult(_0x5f4774,_0x3f5761){return function(_0x1b0fe0){if(_0x1b0fe0){var _0x54e7ca=_0x1b0fe0[_0xda70('0x1a')],_0x259745=_0x3f5761[_0xda70('0x1b')],_0x4c5085=_0x3f5761[_0xda70('0x1b')]+_0x3f5761[_0xda70('0x1c')],_0x5f207d;if(_0x4c5085>=_0x54e7ca){_0x4c5085=_0x54e7ca;_0x5f207d=0xc8;}else{_0x5f207d=0xce;}_0x5f4774[_0xda70('0x1d')](_0x5f207d);return _0x5f4774['set'](_0xda70('0x1e'),_0x259745+'-'+_0x4c5085+'/'+_0x54e7ca)[_0xda70('0x19')](_0x1b0fe0);}return null;};}function patchUpdates(_0x48e658){return function(_0x186675){try{jsonpatch[_0xda70('0x1f')](_0x186675,_0x48e658,!![]);}catch(_0x367a1b){return BPromise['reject'](_0x367a1b);}return _0x186675[_0xda70('0x20')]();};}function saveUpdates(_0x5c6b16,_0x8d7c59){return function(_0x1fcdfc){if(_0x1fcdfc){return _0x1fcdfc['update'](_0x5c6b16)['then'](function(_0xfecd){return _0xfecd;});}return null;};}function removeEntity(_0x29615a,_0x21e069){return function(_0x32970f){if(_0x32970f){return _0x32970f[_0xda70('0x21')]()[_0xda70('0x22')](function(){_0x29615a[_0xda70('0x1d')](0xcc)[_0xda70('0x18')]();});}};}function handleEntityNotFound(_0x5daec7,_0x4065ec){return function(_0x1aba3a){if(!_0x1aba3a){_0x5daec7['sendStatus'](0x194);}return _0x1aba3a;};}function handleError(_0x4c4df7,_0x9d088e){_0x9d088e=_0x9d088e||0x1f4;return function(_0x2248df){logger[_0xda70('0x23')](_0x2248df[_0xda70('0x24')]);if(_0x2248df['name']){delete _0x2248df[_0xda70('0x25')];}_0x4c4df7[_0xda70('0x1d')](_0x9d088e)[_0xda70('0x26')](_0x2248df);};}exports[_0xda70('0x27')]=function(_0x25a3ac,_0x3633a3){var _0x2708f0={},_0x17d840={},_0x2a6b55={'count':0x0,'rows':[]};var _0x3ed545=_['map'](db[_0xda70('0x28')][_0xda70('0x29')],function(_0x5ae6f9){return{'name':_0x5ae6f9[_0xda70('0x2a')],'type':_0x5ae6f9['type'][_0xda70('0x2b')]};});_0x17d840[_0xda70('0x2c')]=_['map'](_0x3ed545,'name');_0x17d840[_0xda70('0x2d')]=_[_0xda70('0x2e')](_0x25a3ac[_0xda70('0x2d')]);_0x17d840['filters']=_[_0xda70('0x2f')](_0x17d840[_0xda70('0x2c')],_0x17d840[_0xda70('0x2d')]);_0x2708f0[_0xda70('0x30')]=_[_0xda70('0x2f')](_0x17d840[_0xda70('0x2c')],qs['fields'](_0x25a3ac[_0xda70('0x2d')]['fields']));_0x2708f0[_0xda70('0x30')]=_0x2708f0['attributes'][_0xda70('0x31')]?_0x2708f0[_0xda70('0x30')]:_0x17d840[_0xda70('0x2c')];if(!_0x25a3ac['query'][_0xda70('0x32')](_0xda70('0x33'))){_0x2708f0[_0xda70('0x1c')]=qs[_0xda70('0x1c')](_0x25a3ac[_0xda70('0x2d')]['limit']);_0x2708f0['offset']=qs[_0xda70('0x1b')](_0x25a3ac[_0xda70('0x2d')][_0xda70('0x1b')]);}_0x2708f0[_0xda70('0x34')]=qs['sort'](_0x25a3ac[_0xda70('0x2d')][_0xda70('0x35')]);_0x2708f0[_0xda70('0x36')]=qs[_0xda70('0x37')](_[_0xda70('0x38')](_0x25a3ac[_0xda70('0x2d')],_0x17d840[_0xda70('0x37')]),_0x3ed545);if(_0x25a3ac[_0xda70('0x2d')][_0xda70('0x39')]){_0x2708f0[_0xda70('0x36')]=_[_0xda70('0x3a')](_0x2708f0[_0xda70('0x36')],{'$or':_['map'](_0x3ed545,function(_0x24ee24){if(_0x24ee24[_0xda70('0x3b')]!==_0xda70('0x3c')){var _0x2a3ce8={};_0x2a3ce8[_0x24ee24[_0xda70('0x25')]]={'$like':'%'+_0x25a3ac[_0xda70('0x2d')][_0xda70('0x39')]+'%'};return _0x2a3ce8;}})});}_0x2708f0=_[_0xda70('0x3a')]({},_0x2708f0,_0x25a3ac['options']);var _0x1baa7f={'where':_0x2708f0[_0xda70('0x36')]};return db[_0xda70('0x28')][_0xda70('0x1a')](_0x1baa7f)[_0xda70('0x22')](function(_0x3f3059){_0x2a6b55[_0xda70('0x1a')]=_0x3f3059;if(_0x25a3ac['query'][_0xda70('0x3d')]){_0x2708f0[_0xda70('0x3e')]=[{'all':!![]}];}return db['MailQueueReport'][_0xda70('0x3f')](_0x2708f0);})[_0xda70('0x22')](function(_0x558e7b){_0x2a6b55[_0xda70('0x40')]=_0x558e7b;return _0x2a6b55;})[_0xda70('0x22')](respondWithFilteredResult(_0x3633a3,_0x2708f0))[_0xda70('0x41')](handleError(_0x3633a3,null));};exports[_0xda70('0x42')]=function(_0x8c4e1,_0x3e5e49){var _0x9befe4={'raw':!![],'where':{'id':_0x8c4e1[_0xda70('0x43')]['id']}},_0x17e303={};_0x17e303[_0xda70('0x2c')]=_[_0xda70('0x2e')](db[_0xda70('0x28')][_0xda70('0x29')]);_0x17e303['query']=_[_0xda70('0x2e')](_0x8c4e1[_0xda70('0x2d')]);_0x17e303['filters']=_[_0xda70('0x2f')](_0x17e303[_0xda70('0x2c')],_0x17e303['query']);_0x9befe4[_0xda70('0x30')]=_[_0xda70('0x2f')](_0x17e303[_0xda70('0x2c')],qs[_0xda70('0x44')](_0x8c4e1[_0xda70('0x2d')][_0xda70('0x44')]));_0x9befe4[_0xda70('0x30')]=_0x9befe4['attributes'][_0xda70('0x31')]?_0x9befe4[_0xda70('0x30')]:_0x17e303[_0xda70('0x2c')];if(_0x8c4e1[_0xda70('0x2d')][_0xda70('0x3d')]){_0x9befe4[_0xda70('0x3e')]=[{'all':!![]}];}_0x9befe4=_['merge']({},_0x9befe4,_0x8c4e1[_0xda70('0x45')]);return db[_0xda70('0x28')][_0xda70('0x46')](_0x9befe4)[_0xda70('0x22')](handleEntityNotFound(_0x3e5e49,null))['then'](respondWithResult(_0x3e5e49,null))[_0xda70('0x41')](handleError(_0x3e5e49,null));};exports[_0xda70('0x47')]=function(_0x49f48f,_0x15e87b){return db[_0xda70('0x28')][_0xda70('0x47')](_0x49f48f[_0xda70('0x48')],{})[_0xda70('0x22')](respondWithResult(_0x15e87b,0xc9))[_0xda70('0x41')](handleError(_0x15e87b,null));};exports[_0xda70('0x49')]=function(_0x2a1910,_0x38a5d8){if(_0x2a1910[_0xda70('0x48')]['id']){delete _0x2a1910[_0xda70('0x48')]['id'];}return db[_0xda70('0x28')][_0xda70('0x46')]({'where':{'id':_0x2a1910[_0xda70('0x43')]['id']}})[_0xda70('0x22')](handleEntityNotFound(_0x38a5d8,null))[_0xda70('0x22')](saveUpdates(_0x2a1910[_0xda70('0x48')],null))[_0xda70('0x22')](respondWithResult(_0x38a5d8,null))[_0xda70('0x41')](handleError(_0x38a5d8,null));};exports[_0xda70('0x21')]=function(_0x32123a,_0x2c4ba9){return db[_0xda70('0x28')]['find']({'where':{'id':_0x32123a['params']['id']}})[_0xda70('0x22')](handleEntityNotFound(_0x2c4ba9,null))[_0xda70('0x22')](removeEntity(_0x2c4ba9,null))[_0xda70('0x41')](handleError(_0x2c4ba9,null));};exports[_0xda70('0x4a')]=function(_0x233c12,_0xd9da26){return db[_0xda70('0x28')]['describe']()['then'](respondWithResult(_0xd9da26,null))[_0xda70('0x41')](handleError(_0xd9da26,null));}; \ No newline at end of file +var _0xa8d6=['bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','save','update','then','stack','name','send','map','MailQueueReport','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise'];(function(_0x3d9a4d,_0x3df1d4){var _0x15e6d5=function(_0x39cf31){while(--_0x39cf31){_0x3d9a4d['push'](_0x3d9a4d['shift']());}};_0x15e6d5(++_0x3df1d4);}(_0xa8d6,0xd7));var _0x6a8d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa8d6[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x6a8d('0x0'));var rimraf=require(_0x6a8d('0x1'));var zipdir=require(_0x6a8d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a8d('0x3'));var moment=require('moment');var BPromise=require(_0x6a8d('0x4'));var Mustache=require(_0x6a8d('0x5'));var util=require(_0x6a8d('0x6'));var path=require(_0x6a8d('0x7'));var sox=require(_0x6a8d('0x8'));var csv=require(_0x6a8d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a8d('0xa'));var _=require('lodash');var squel=require(_0x6a8d('0xb'));var crypto=require('crypto');var jsforce=require(_0x6a8d('0xc'));var deskjs=require(_0x6a8d('0xd'));var toCsv=require(_0x6a8d('0x9'));var querystring=require('querystring');var Papa=require(_0x6a8d('0xe'));var Redis=require(_0x6a8d('0xf'));var authService=require(_0x6a8d('0x10'));var qs=require(_0x6a8d('0x11'));var as=require(_0x6a8d('0x12'));var hardwareService=require(_0x6a8d('0x13'));var logger=require('../../config/logger')(_0x6a8d('0x14'));var utils=require(_0x6a8d('0x15'));var config=require(_0x6a8d('0x16'));var licenseUtil=require(_0x6a8d('0x17'));var db=require(_0x6a8d('0x18'))['db'];function respondWithStatusCode(_0x552547,_0x4373e7){_0x4373e7=_0x4373e7||0xcc;return function(_0xd12733){if(_0xd12733){return _0x552547[_0x6a8d('0x19')](_0x4373e7);}return _0x552547[_0x6a8d('0x1a')](_0x4373e7)[_0x6a8d('0x1b')]();};}function respondWithResult(_0x162ad3,_0xf1861a){_0xf1861a=_0xf1861a||0xc8;return function(_0x243daa){if(_0x243daa){return _0x162ad3['status'](_0xf1861a)['json'](_0x243daa);}};}function respondWithFilteredResult(_0x57defe,_0x50f96f){return function(_0x191ed2){if(_0x191ed2){var _0x59d029=_0x191ed2[_0x6a8d('0x1c')],_0x18aafc=_0x50f96f[_0x6a8d('0x1d')],_0x18e91a=_0x50f96f['offset']+_0x50f96f[_0x6a8d('0x1e')],_0x5d23de;if(_0x18e91a>=_0x59d029){_0x18e91a=_0x59d029;_0x5d23de=0xc8;}else{_0x5d23de=0xce;}_0x57defe[_0x6a8d('0x1a')](_0x5d23de);return _0x57defe['set'](_0x6a8d('0x1f'),_0x18aafc+'-'+_0x18e91a+'/'+_0x59d029)[_0x6a8d('0x20')](_0x191ed2);}return null;};}function patchUpdates(_0x31624e){return function(_0x77aebc){try{jsonpatch['apply'](_0x77aebc,_0x31624e,!![]);}catch(_0x301fe3){return BPromise[_0x6a8d('0x21')](_0x301fe3);}return _0x77aebc[_0x6a8d('0x22')]();};}function saveUpdates(_0x47f8a9,_0x1d9041){return function(_0x5a4202){if(_0x5a4202){return _0x5a4202[_0x6a8d('0x23')](_0x47f8a9)[_0x6a8d('0x24')](function(_0x3cdd34){return _0x3cdd34;});}return null;};}function removeEntity(_0x22fae5,_0x5e742a){return function(_0x172fea){if(_0x172fea){return _0x172fea['destroy']()[_0x6a8d('0x24')](function(){_0x22fae5[_0x6a8d('0x1a')](0xcc)[_0x6a8d('0x1b')]();});}};}function handleEntityNotFound(_0x76baf2,_0x511945){return function(_0x73a2eb){if(!_0x73a2eb){_0x76baf2['sendStatus'](0x194);}return _0x73a2eb;};}function handleError(_0x55090d,_0x542b81){_0x542b81=_0x542b81||0x1f4;return function(_0x5df837){logger['error'](_0x5df837[_0x6a8d('0x25')]);if(_0x5df837[_0x6a8d('0x26')]){delete _0x5df837['name'];}_0x55090d[_0x6a8d('0x1a')](_0x542b81)[_0x6a8d('0x27')](_0x5df837);};}exports['index']=function(_0x16dd4c,_0x12eca){var _0x3ea97e={},_0x3a6d48={},_0x4e214f={'count':0x0,'rows':[]};var _0x16028f=_[_0x6a8d('0x28')](db[_0x6a8d('0x29')][_0x6a8d('0x2a')],function(_0x5bce72){return{'name':_0x5bce72['fieldName'],'type':_0x5bce72['type'][_0x6a8d('0x2b')]};});_0x3a6d48[_0x6a8d('0x2c')]=_[_0x6a8d('0x28')](_0x16028f,_0x6a8d('0x26'));_0x3a6d48[_0x6a8d('0x2d')]=_[_0x6a8d('0x2e')](_0x16dd4c[_0x6a8d('0x2d')]);_0x3a6d48[_0x6a8d('0x2f')]=_[_0x6a8d('0x30')](_0x3a6d48[_0x6a8d('0x2c')],_0x3a6d48[_0x6a8d('0x2d')]);_0x3ea97e['attributes']=_[_0x6a8d('0x30')](_0x3a6d48[_0x6a8d('0x2c')],qs[_0x6a8d('0x31')](_0x16dd4c[_0x6a8d('0x2d')][_0x6a8d('0x31')]));_0x3ea97e[_0x6a8d('0x32')]=_0x3ea97e['attributes'][_0x6a8d('0x33')]?_0x3ea97e[_0x6a8d('0x32')]:_0x3a6d48[_0x6a8d('0x2c')];if(!_0x16dd4c[_0x6a8d('0x2d')][_0x6a8d('0x34')](_0x6a8d('0x35'))){_0x3ea97e['limit']=qs['limit'](_0x16dd4c[_0x6a8d('0x2d')]['limit']);_0x3ea97e['offset']=qs[_0x6a8d('0x1d')](_0x16dd4c[_0x6a8d('0x2d')]['offset']);}_0x3ea97e[_0x6a8d('0x36')]=qs[_0x6a8d('0x37')](_0x16dd4c[_0x6a8d('0x2d')][_0x6a8d('0x37')]);_0x3ea97e['where']=qs[_0x6a8d('0x2f')](_['pick'](_0x16dd4c[_0x6a8d('0x2d')],_0x3a6d48[_0x6a8d('0x2f')]),_0x16028f);if(_0x16dd4c[_0x6a8d('0x2d')][_0x6a8d('0x38')]){_0x3ea97e[_0x6a8d('0x39')]=_[_0x6a8d('0x3a')](_0x3ea97e['where'],{'$or':_[_0x6a8d('0x28')](_0x16028f,function(_0x2bafe5){if(_0x2bafe5['type']!==_0x6a8d('0x3b')){var _0x3f59dd={};_0x3f59dd[_0x2bafe5[_0x6a8d('0x26')]]={'$like':'%'+_0x16dd4c[_0x6a8d('0x2d')]['filter']+'%'};return _0x3f59dd;}})});}_0x3ea97e=_['merge']({},_0x3ea97e,_0x16dd4c['options']);var _0x1a114a={'where':_0x3ea97e['where']};return db[_0x6a8d('0x29')][_0x6a8d('0x1c')](_0x1a114a)['then'](function(_0x3391a2){_0x4e214f[_0x6a8d('0x1c')]=_0x3391a2;if(_0x16dd4c[_0x6a8d('0x2d')][_0x6a8d('0x3c')]){_0x3ea97e[_0x6a8d('0x3d')]=[{'all':!![]}];}return db[_0x6a8d('0x29')][_0x6a8d('0x3e')](_0x3ea97e);})['then'](function(_0x352eed){_0x4e214f[_0x6a8d('0x3f')]=_0x352eed;return _0x4e214f;})['then'](respondWithFilteredResult(_0x12eca,_0x3ea97e))[_0x6a8d('0x40')](handleError(_0x12eca,null));};exports[_0x6a8d('0x41')]=function(_0x1aa840,_0x146a2f){var _0x5bb5e8={'raw':!![],'where':{'id':_0x1aa840[_0x6a8d('0x42')]['id']}},_0x5e3f95={};_0x5e3f95['model']=_[_0x6a8d('0x2e')](db[_0x6a8d('0x29')][_0x6a8d('0x2a')]);_0x5e3f95[_0x6a8d('0x2d')]=_[_0x6a8d('0x2e')](_0x1aa840[_0x6a8d('0x2d')]);_0x5e3f95['filters']=_[_0x6a8d('0x30')](_0x5e3f95[_0x6a8d('0x2c')],_0x5e3f95[_0x6a8d('0x2d')]);_0x5bb5e8[_0x6a8d('0x32')]=_[_0x6a8d('0x30')](_0x5e3f95[_0x6a8d('0x2c')],qs['fields'](_0x1aa840[_0x6a8d('0x2d')][_0x6a8d('0x31')]));_0x5bb5e8[_0x6a8d('0x32')]=_0x5bb5e8[_0x6a8d('0x32')]['length']?_0x5bb5e8[_0x6a8d('0x32')]:_0x5e3f95[_0x6a8d('0x2c')];if(_0x1aa840[_0x6a8d('0x2d')]['includeAll']){_0x5bb5e8['include']=[{'all':!![]}];}_0x5bb5e8=_['merge']({},_0x5bb5e8,_0x1aa840[_0x6a8d('0x43')]);return db[_0x6a8d('0x29')][_0x6a8d('0x44')](_0x5bb5e8)[_0x6a8d('0x24')](handleEntityNotFound(_0x146a2f,null))[_0x6a8d('0x24')](respondWithResult(_0x146a2f,null))['catch'](handleError(_0x146a2f,null));};exports['create']=function(_0x38bcb3,_0x37eac8){return db['MailQueueReport'][_0x6a8d('0x45')](_0x38bcb3['body'],{})['then'](respondWithResult(_0x37eac8,0xc9))[_0x6a8d('0x40')](handleError(_0x37eac8,null));};exports['update']=function(_0x406811,_0x8d2cf3){if(_0x406811[_0x6a8d('0x46')]['id']){delete _0x406811[_0x6a8d('0x46')]['id'];}return db['MailQueueReport'][_0x6a8d('0x44')]({'where':{'id':_0x406811[_0x6a8d('0x42')]['id']}})[_0x6a8d('0x24')](handleEntityNotFound(_0x8d2cf3,null))['then'](saveUpdates(_0x406811[_0x6a8d('0x46')],null))[_0x6a8d('0x24')](respondWithResult(_0x8d2cf3,null))[_0x6a8d('0x40')](handleError(_0x8d2cf3,null));};exports[_0x6a8d('0x47')]=function(_0x5eb2c3,_0x344bfa){return db[_0x6a8d('0x29')][_0x6a8d('0x44')]({'where':{'id':_0x5eb2c3['params']['id']}})[_0x6a8d('0x24')](handleEntityNotFound(_0x344bfa,null))['then'](removeEntity(_0x344bfa,null))['catch'](handleError(_0x344bfa,null));};exports[_0x6a8d('0x48')]=function(_0x543b72,_0x1fb88c){return db['MailQueueReport'][_0x6a8d('0x48')]()[_0x6a8d('0x24')](respondWithResult(_0x1fb88c,null))['catch'](handleError(_0x1fb88c,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 5ab097d..5a6effe 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 _0x201c=['MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','bluebird','request-promise','path','rimraf','./mailQueueReport.attributes','define'];(function(_0x2f92f4,_0x44cce6){var _0x18fd96=function(_0x41ec4f){while(--_0x41ec4f){_0x2f92f4['push'](_0x2f92f4['shift']());}};_0x18fd96(++_0x44cce6);}(_0x201c,0x10b));var _0xc201=function(_0xa2b416,_0x2a3507){_0xa2b416=_0xa2b416-0x0;var _0x5a0aa6=_0x201c[_0xa2b416];return _0x5a0aa6;};'use strict';var _=require(_0xc201('0x0'));var util=require('util');var logger=require(_0xc201('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc201('0x2'));var rp=require(_0xc201('0x3'));var fs=require('fs');var path=require(_0xc201('0x4'));var rimraf=require(_0xc201('0x5'));var config=require('../../config/environment');var attributes=require(_0xc201('0x6'));module['exports']=function(_0x16fea7,_0x53a626){return _0x16fea7[_0xc201('0x7')](_0xc201('0x8'),attributes,{'tableName':_0xc201('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc201('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc063=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xc063,0xb6));var _0x3c06=function(_0x569d0f,_0x224a07){_0x569d0f=_0x569d0f-0x0;var _0x26d516=_0xc063[_0x569d0f];return _0x26d516;};'use strict';var _=require(_0x3c06('0x0'));var util=require(_0x3c06('0x1'));var logger=require(_0x3c06('0x2'))(_0x3c06('0x3'));var moment=require('moment');var BPromise=require(_0x3c06('0x4'));var rp=require(_0x3c06('0x5'));var fs=require('fs');var path=require(_0x3c06('0x6'));var rimraf=require(_0x3c06('0x7'));var config=require(_0x3c06('0x8'));var attributes=require(_0x3c06('0x9'));module[_0x3c06('0xa')]=function(_0x1df708,_0x1027b1){return _0x1df708['define'](_0x3c06('0xb'),attributes,{'tableName':_0x3c06('0xc'),'paranoid':![],'indexes':[{'name':_0x3c06('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 689da44..0f0c4d1 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 _0x178a=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','create','options','raw','UpdateMailQueueReport','update','attributes','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x3cb3c6,_0x18d23e){var _0x52fbbf=function(_0x37231d){while(--_0x37231d){_0x3cb3c6['push'](_0x3cb3c6['shift']());}};_0x52fbbf(++_0x18d23e);}(_0x178a,0x13a));var _0xa178=function(_0x49dc47,_0x575fc4){_0x49dc47=_0x49dc47-0x0;var _0x2ef2e1=_0x178a[_0x49dc47];return _0x2ef2e1;};'use strict';var _=require('lodash');var util=require(_0xa178('0x0'));var moment=require(_0xa178('0x1'));var BPromise=require(_0xa178('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa178('0x3'));var db=require(_0xa178('0x4'))['db'];var utils=require(_0xa178('0x5'));var logger=require(_0xa178('0x6'))(_0xa178('0x7'));var config=require(_0xa178('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa178('0x9')][_0xa178('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x90708d,_0x1787d6,_0x472145){return new BPromise(function(_0x274498,_0x2af8db){return client[_0xa178('0xb')](_0x90708d,_0x472145)[_0xa178('0xc')](function(_0x2f0cd2){logger[_0xa178('0xd')](_0xa178('0xe'),_0x1787d6,_0xa178('0xf'));logger[_0xa178('0x10')](_0xa178('0x11'),_0x1787d6,'request\x20sent',JSON[_0xa178('0x12')](_0x2f0cd2));if(_0x2f0cd2[_0xa178('0x13')]){if(_0x2f0cd2['error'][_0xa178('0x14')]===0x1f4){logger[_0xa178('0x13')]('MailQueueReport,\x20%s,\x20%s',_0x1787d6,_0x2f0cd2[_0xa178('0x13')][_0xa178('0x15')]);return _0x2af8db(_0x2f0cd2[_0xa178('0x13')][_0xa178('0x15')]);}logger[_0xa178('0x13')](_0xa178('0xe'),_0x1787d6,_0x2f0cd2['error'][_0xa178('0x15')]);return _0x274498(_0x2f0cd2[_0xa178('0x13')][_0xa178('0x15')]);}else{logger[_0xa178('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x1787d6,_0xa178('0xf'));_0x274498(_0x2f0cd2[_0xa178('0x16')][_0xa178('0x15')]);}})[_0xa178('0x17')](function(_0x221268){logger[_0xa178('0x13')](_0xa178('0xe'),_0x1787d6,_0x221268);_0x2af8db(_0x221268);});});}exports[_0xa178('0x18')]=function(_0x588c35){var _0x2fab51=this;return new Promise(function(_0x2d7697,_0x3c98a2){return db[_0xa178('0x19')][_0xa178('0x1a')](_0x588c35['body'],{'raw':_0x588c35[_0xa178('0x1b')]?_0x588c35[_0xa178('0x1b')][_0xa178('0x1c')]===undefined?!![]:![]:!![]})[_0xa178('0xc')](function(_0x3ef43c){logger[_0xa178('0xd')](_0xa178('0x18'),_0x588c35);logger['debug'](_0xa178('0x18'),_0x588c35,JSON[_0xa178('0x12')](_0x3ef43c));_0x2d7697(_0x3ef43c);})[_0xa178('0x17')](function(_0x18288e){logger[_0xa178('0x13')](_0xa178('0x18'),_0x18288e[_0xa178('0x15')],_0x588c35);_0x3c98a2(_0x2fab51[_0xa178('0x13')](0x1f4,_0x18288e[_0xa178('0x15')]));});});};exports[_0xa178('0x1d')]=function(_0x367687){var _0x522d62=this;return new Promise(function(_0x4ad779,_0x287259){return db['MailQueueReport'][_0xa178('0x1e')](_0x367687['body'],{'raw':_0x367687['options']?_0x367687[_0xa178('0x1b')][_0xa178('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x367687[_0xa178('0x1b')]?_0x367687[_0xa178('0x1b')]['where']||null:null,'attributes':_0x367687[_0xa178('0x1b')]?_0x367687[_0xa178('0x1b')][_0xa178('0x1f')]||null:null,'limit':_0x367687[_0xa178('0x1b')]?_0x367687[_0xa178('0x1b')]['limit']||null:null})[_0xa178('0xc')](function(_0x33a7ea){logger[_0xa178('0xd')](_0xa178('0x1d'),_0x367687);logger[_0xa178('0x10')](_0xa178('0x1d'),_0x367687,JSON['stringify'](_0x33a7ea));_0x4ad779(_0x33a7ea);})[_0xa178('0x17')](function(_0x779e12){logger['error'](_0xa178('0x1d'),_0x779e12[_0xa178('0x15')],_0x367687);_0x287259(_0x522d62[_0xa178('0x13')](0x1f4,_0x779e12[_0xa178('0x15')]));});});}; \ No newline at end of file +var _0x0ef8=['moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueueReport,\x20%s,\x20%s','message','catch','MailQueueReport','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','limit','debug','util'];(function(_0x588ed6,_0x346f81){var _0x870992=function(_0x4f965c){while(--_0x4f965c){_0x588ed6['push'](_0x588ed6['shift']());}};_0x870992(++_0x346f81);}(_0x0ef8,0x15e));var _0x80ef=function(_0xe24bed,_0x56b955){_0xe24bed=_0xe24bed-0x0;var _0x139077=_0x0ef8[_0xe24bed];return _0x139077;};'use strict';var _=require('lodash');var util=require(_0x80ef('0x0'));var moment=require(_0x80ef('0x1'));var BPromise=require('bluebird');var rs=require(_0x80ef('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x80ef('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x80ef('0x4'))(_0x80ef('0x5'));var config=require(_0x80ef('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x80ef('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14be93,_0x44bbd9,_0x825620){return new BPromise(function(_0x45bd59,_0x1560f1){return client[_0x80ef('0x8')](_0x14be93,_0x825620)[_0x80ef('0x9')](function(_0x48fd31){logger[_0x80ef('0xa')]('MailQueueReport,\x20%s,\x20%s',_0x44bbd9,_0x80ef('0xb'));logger['debug'](_0x80ef('0xc'),_0x44bbd9,_0x80ef('0xb'),JSON[_0x80ef('0xd')](_0x48fd31));if(_0x48fd31[_0x80ef('0xe')]){if(_0x48fd31[_0x80ef('0xe')][_0x80ef('0xf')]===0x1f4){logger[_0x80ef('0xe')](_0x80ef('0x10'),_0x44bbd9,_0x48fd31[_0x80ef('0xe')][_0x80ef('0x11')]);return _0x1560f1(_0x48fd31[_0x80ef('0xe')][_0x80ef('0x11')]);}logger[_0x80ef('0xe')](_0x80ef('0x10'),_0x44bbd9,_0x48fd31[_0x80ef('0xe')][_0x80ef('0x11')]);return _0x45bd59(_0x48fd31[_0x80ef('0xe')][_0x80ef('0x11')]);}else{logger[_0x80ef('0xa')](_0x80ef('0x10'),_0x44bbd9,_0x80ef('0xb'));_0x45bd59(_0x48fd31['result']['message']);}})[_0x80ef('0x12')](function(_0x5e86a1){logger[_0x80ef('0xe')](_0x80ef('0x10'),_0x44bbd9,_0x5e86a1);_0x1560f1(_0x5e86a1);});});}exports['CreateMailQueueReport']=function(_0x3b10fd){var _0x3c478e=this;return new Promise(function(_0x18fa40,_0x2a4afc){return db[_0x80ef('0x13')]['create'](_0x3b10fd[_0x80ef('0x14')],{'raw':_0x3b10fd['options']?_0x3b10fd[_0x80ef('0x15')][_0x80ef('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x2b5576){logger[_0x80ef('0xa')](_0x80ef('0x17'),_0x3b10fd);logger['debug']('CreateMailQueueReport',_0x3b10fd,JSON[_0x80ef('0xd')](_0x2b5576));_0x18fa40(_0x2b5576);})[_0x80ef('0x12')](function(_0x3e6524){logger[_0x80ef('0xe')](_0x80ef('0x17'),_0x3e6524['message'],_0x3b10fd);_0x2a4afc(_0x3c478e[_0x80ef('0xe')](0x1f4,_0x3e6524['message']));});});};exports[_0x80ef('0x18')]=function(_0x4e55f9){var _0x46a142=this;return new Promise(function(_0x2eaaec,_0x29fedb){return db['MailQueueReport']['update'](_0x4e55f9['body'],{'raw':_0x4e55f9['options']?_0x4e55f9['options'][_0x80ef('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e55f9[_0x80ef('0x15')]?_0x4e55f9[_0x80ef('0x15')]['where']||null:null,'attributes':_0x4e55f9[_0x80ef('0x15')]?_0x4e55f9[_0x80ef('0x15')]['attributes']||null:null,'limit':_0x4e55f9[_0x80ef('0x15')]?_0x4e55f9[_0x80ef('0x15')][_0x80ef('0x19')]||null:null})[_0x80ef('0x9')](function(_0x1cdb6e){logger[_0x80ef('0xa')]('UpdateMailQueueReport',_0x4e55f9);logger[_0x80ef('0x1a')]('UpdateMailQueueReport',_0x4e55f9,JSON['stringify'](_0x1cdb6e));_0x2eaaec(_0x1cdb6e);})[_0x80ef('0x12')](function(_0x2bf4d0){logger[_0x80ef('0xe')]('UpdateMailQueueReport',_0x2bf4d0[_0x80ef('0x11')],_0x4e55f9);_0x29fedb(_0x46a142[_0x80ef('0xe')](0x1f4,_0x2bf4d0['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 69674d3..f216326 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 _0x12c9=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x2bd88d,_0x2d5dc3){var _0x5516d4=function(_0x1272c8){while(--_0x1272c8){_0x2bd88d['push'](_0x2bd88d['shift']());}};_0x5516d4(++_0x2d5dc3);}(_0x12c9,0x9f));var _0x912c=function(_0x398d3a,_0x55623f){_0x398d3a=_0x398d3a-0x0;var _0x42ba54=_0x12c9[_0x398d3a];return _0x42ba54;};'use strict';var multer=require(_0x912c('0x0'));var util=require('util');var path=require(_0x912c('0x1'));var timeout=require('connect-timeout');var express=require(_0x912c('0x2'));var router=express['Router']();var fs_extra=require(_0x912c('0x3'));var auth=require(_0x912c('0x4'));var interaction=require(_0x912c('0x5'));var config=require(_0x912c('0x6'));module[_0x912c('0x7')]=router; \ No newline at end of file +var _0x60d7=['exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3f563a,_0x3704df){var _0x5e8c9f=function(_0x176792){while(--_0x176792){_0x3f563a['push'](_0x3f563a['shift']());}};_0x5e8c9f(++_0x3704df);}(_0x60d7,0x139));var _0x760d=function(_0x21e562,_0x7af00b){_0x21e562=_0x21e562-0x0;var _0x56acb9=_0x60d7[_0x21e562];return _0x56acb9;};'use strict';var multer=require(_0x760d('0x0'));var util=require(_0x760d('0x1'));var path=require('path');var timeout=require(_0x760d('0x2'));var express=require('express');var router=express[_0x760d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x760d('0x4'));var interaction=require(_0x760d('0x5'));var config=require(_0x760d('0x6'));module[_0x760d('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index a07e233..908e4ae 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 _0x4b0e=['INTEGER','STRING','BOOLEAN'];(function(_0x1954b7,_0x16e672){var _0x2f57b3=function(_0x2437b5){while(--_0x2437b5){_0x1954b7['push'](_0x1954b7['shift']());}};_0x2f57b3(++_0x16e672);}(_0x4b0e,0x1ae));var _0xe4b0=function(_0x1dafd4,_0x213e0f){_0x1dafd4=_0x1dafd4-0x0;var _0x2c04cd=_0x4b0e[_0x1dafd4];return _0x2c04cd;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xe4b0('0x0')]},'authentication':{'type':Sequelize[_0xe4b0('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0xe4b0('0x0')]},'password':{'type':Sequelize[_0xe4b0('0x0')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xe4b0('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xe4b0('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xe4b0('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0xe4b0('0x0')]}}; \ No newline at end of file +var _0xecd4=['INTEGER','sequelize','exports','STRING','BOOLEAN','INBOX'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xecd4,0x18d));var _0x4ecd=function(_0x5c2206,_0x1bc105){_0x5c2206=_0x5c2206-0x0;var _0xfb9e38=_0xecd4[_0x5c2206];return _0xfb9e38;};'use strict';var Sequelize=require(_0x4ecd('0x0'));module[_0x4ecd('0x1')]={'description':{'type':Sequelize[_0x4ecd('0x2')]},'host':{'type':Sequelize[_0x4ecd('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x4ecd('0x2')]},'password':{'type':Sequelize[_0x4ecd('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x4ecd('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4ecd('0x2')],'defaultValue':_0x4ecd('0x4')},'connTimeout':{'type':Sequelize[_0x4ecd('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x4ecd('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0x4ecd('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 8cce782..b4e7e8a 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 _0x8603=['util','../../config/logger','api','request-promise','path','rimraf','./mailServerIn.attributes','define','MailServerIn','mail_servers_in'];(function(_0x27475e,_0x30e722){var _0x2b321c=function(_0x1c95b9){while(--_0x1c95b9){_0x27475e['push'](_0x27475e['shift']());}};_0x2b321c(++_0x30e722);}(_0x8603,0x190));var _0x3860=function(_0xa6a23e,_0x8b657a){_0xa6a23e=_0xa6a23e-0x0;var _0x210e65=_0x8603[_0xa6a23e];return _0x210e65;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var logger=require(_0x3860('0x1'))(_0x3860('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3860('0x3'));var fs=require('fs');var path=require(_0x3860('0x4'));var rimraf=require(_0x3860('0x5'));var config=require('../../config/environment');var attributes=require(_0x3860('0x6'));module['exports']=function(_0xb0fc24,_0x40739b){return _0xb0fc24[_0x3860('0x7')](_0x3860('0x8'),attributes,{'tableName':_0x3860('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7462=['path','rimraf','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','moment'];(function(_0xe97a96,_0x37a14c){var _0x99600f=function(_0x134d3d){while(--_0x134d3d){_0xe97a96['push'](_0xe97a96['shift']());}};_0x99600f(++_0x37a14c);}(_0x7462,0x165));var _0x2746=function(_0x50e40b,_0x338d17){_0x50e40b=_0x50e40b-0x0;var _0x2608b7=_0x7462[_0x50e40b];return _0x2608b7;};'use strict';var _=require(_0x2746('0x0'));var util=require(_0x2746('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2746('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2746('0x3'));var rimraf=require(_0x2746('0x4'));var config=require('../../config/environment');var attributes=require(_0x2746('0x5'));module[_0x2746('0x6')]=function(_0x1c3371,_0x280dfb){return _0x1c3371[_0x2746('0x7')](_0x2746('0x8'),attributes,{'tableName':_0x2746('0x9'),'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 d468bf6..3ac2c2b 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 _0x37c2=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','debug','catch','lodash','util','bluebird','ioredis'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x37c2,0x1d8));var _0x237c=function(_0x558f00,_0x4b9b34){_0x558f00=_0x558f00-0x0;var _0x3fd4f6=_0x37c2[_0x558f00];return _0x3fd4f6;};'use strict';var _=require(_0x237c('0x0'));var util=require(_0x237c('0x1'));var moment=require('moment');var BPromise=require(_0x237c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x237c('0x3'));var db=require(_0x237c('0x4'))['db'];var utils=require(_0x237c('0x5'));var logger=require(_0x237c('0x6'))('rpc');var config=require(_0x237c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x237c('0x8')][_0x237c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ae22e,_0x3200d2,_0x2e3535){return new BPromise(function(_0x190aac,_0x1a2d25){return client[_0x237c('0xa')](_0x3ae22e,_0x2e3535)[_0x237c('0xb')](function(_0x59f298){logger[_0x237c('0xc')](_0x237c('0xd'),_0x3200d2,_0x237c('0xe'));logger['debug'](_0x237c('0xf'),_0x3200d2,_0x237c('0xe'),JSON[_0x237c('0x10')](_0x59f298));if(_0x59f298['error']){if(_0x59f298[_0x237c('0x11')][_0x237c('0x12')]===0x1f4){logger[_0x237c('0x11')](_0x237c('0xd'),_0x3200d2,_0x59f298['error'][_0x237c('0x13')]);return _0x1a2d25(_0x59f298[_0x237c('0x11')][_0x237c('0x13')]);}logger['error'](_0x237c('0xd'),_0x3200d2,_0x59f298[_0x237c('0x11')][_0x237c('0x13')]);return _0x190aac(_0x59f298[_0x237c('0x11')][_0x237c('0x13')]);}else{logger['info'](_0x237c('0xd'),_0x3200d2,_0x237c('0xe'));_0x190aac(_0x59f298[_0x237c('0x14')]['message']);}})['catch'](function(_0x5945ba){logger[_0x237c('0x11')](_0x237c('0xd'),_0x3200d2,_0x5945ba);_0x1a2d25(_0x5945ba);});});}exports[_0x237c('0x15')]=function(_0x3068a4){var _0x5a891a=this;return new Promise(function(_0x13b5f6,_0x436308){return db[_0x237c('0x16')][_0x237c('0x17')]({'raw':_0x3068a4[_0x237c('0x18')]?_0x3068a4[_0x237c('0x18')][_0x237c('0x19')]===undefined?!![]:![]:!![],'where':_0x3068a4[_0x237c('0x18')]?_0x3068a4[_0x237c('0x18')][_0x237c('0x1a')]||null:null,'attributes':_0x3068a4[_0x237c('0x18')]?_0x3068a4[_0x237c('0x18')][_0x237c('0x1b')]||null:null,'limit':_0x3068a4[_0x237c('0x18')]?_0x3068a4[_0x237c('0x18')][_0x237c('0x1c')]||null:null,'include':_0x3068a4[_0x237c('0x18')]?_0x3068a4['options'][_0x237c('0x1d')]?_['map'](_0x3068a4[_0x237c('0x18')]['include'],function(_0x3e2492){return{'model':db[_0x3e2492['model']],'as':_0x3e2492['as'],'attributes':_0x3e2492[_0x237c('0x1b')],'include':_0x3e2492[_0x237c('0x1d')]?_['map'](_0x3e2492[_0x237c('0x1d')],function(_0x288c0d){return{'model':db[_0x288c0d['model']],'as':_0x288c0d['as'],'attributes':_0x288c0d[_0x237c('0x1b')],'include':_0x288c0d[_0x237c('0x1d')]?_[_0x237c('0x1e')](_0x288c0d[_0x237c('0x1d')],function(_0x5927de){return{'model':db[_0x5927de[_0x237c('0x1f')]],'as':_0x5927de['as'],'attributes':_0x5927de[_0x237c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x237c('0xb')](function(_0x45ea34){logger['info']('GetMailServerIn',_0x3068a4);logger[_0x237c('0x20')](_0x237c('0x15'),_0x3068a4,JSON[_0x237c('0x10')](_0x45ea34));_0x13b5f6(_0x45ea34);})[_0x237c('0x21')](function(_0x2ca166){logger['error'](_0x237c('0x15'),_0x2ca166['message'],_0x3068a4);_0x436308(_0x5a891a[_0x237c('0x11')](0x1f4,_0x2ca166['message']));});});}; \ No newline at end of file +var _0x2fb2=['attributes','limit','include','map','model','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetMailServerIn','MailServerIn','findAll','options','raw','where'];(function(_0x22334b,_0x4e7696){var _0x3a5b46=function(_0x326393){while(--_0x326393){_0x22334b['push'](_0x22334b['shift']());}};_0x3a5b46(++_0x4e7696);}(_0x2fb2,0x146));var _0x22fb=function(_0x4d1e31,_0x4ef26d){_0x4d1e31=_0x4d1e31-0x0;var _0x4423c9=_0x2fb2[_0x4d1e31];return _0x4423c9;};'use strict';var _=require(_0x22fb('0x0'));var util=require(_0x22fb('0x1'));var moment=require('moment');var BPromise=require(_0x22fb('0x2'));var rs=require(_0x22fb('0x3'));var fs=require('fs');var Redis=require(_0x22fb('0x4'));var db=require(_0x22fb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x22fb('0x6'));var config=require('../../config/environment');var jayson=require(_0x22fb('0x7'));var client=jayson[_0x22fb('0x8')][_0x22fb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9cf5bc,_0xe04a3d,_0x239fb9){return new BPromise(function(_0x1f0992,_0x588697){return client['request'](_0x9cf5bc,_0x239fb9)[_0x22fb('0xa')](function(_0x6d449b){logger[_0x22fb('0xb')](_0x22fb('0xc'),_0xe04a3d,_0x22fb('0xd'));logger[_0x22fb('0xe')](_0x22fb('0xf'),_0xe04a3d,_0x22fb('0xd'),JSON[_0x22fb('0x10')](_0x6d449b));if(_0x6d449b[_0x22fb('0x11')]){if(_0x6d449b[_0x22fb('0x11')][_0x22fb('0x12')]===0x1f4){logger[_0x22fb('0x11')](_0x22fb('0xc'),_0xe04a3d,_0x6d449b[_0x22fb('0x11')][_0x22fb('0x13')]);return _0x588697(_0x6d449b[_0x22fb('0x11')]['message']);}logger['error']('MailServerIn,\x20%s,\x20%s',_0xe04a3d,_0x6d449b[_0x22fb('0x11')][_0x22fb('0x13')]);return _0x1f0992(_0x6d449b[_0x22fb('0x11')][_0x22fb('0x13')]);}else{logger['info'](_0x22fb('0xc'),_0xe04a3d,_0x22fb('0xd'));_0x1f0992(_0x6d449b['result'][_0x22fb('0x13')]);}})['catch'](function(_0x5b5288){logger[_0x22fb('0x11')](_0x22fb('0xc'),_0xe04a3d,_0x5b5288);_0x588697(_0x5b5288);});});}exports[_0x22fb('0x14')]=function(_0x3f6125){var _0x556c44=this;return new Promise(function(_0x44cc86,_0x1dbcba){return db[_0x22fb('0x15')][_0x22fb('0x16')]({'raw':_0x3f6125['options']?_0x3f6125[_0x22fb('0x17')][_0x22fb('0x18')]===undefined?!![]:![]:!![],'where':_0x3f6125[_0x22fb('0x17')]?_0x3f6125[_0x22fb('0x17')][_0x22fb('0x19')]||null:null,'attributes':_0x3f6125[_0x22fb('0x17')]?_0x3f6125['options'][_0x22fb('0x1a')]||null:null,'limit':_0x3f6125[_0x22fb('0x17')]?_0x3f6125[_0x22fb('0x17')][_0x22fb('0x1b')]||null:null,'include':_0x3f6125[_0x22fb('0x17')]?_0x3f6125['options'][_0x22fb('0x1c')]?_[_0x22fb('0x1d')](_0x3f6125[_0x22fb('0x17')][_0x22fb('0x1c')],function(_0x3890de){return{'model':db[_0x3890de[_0x22fb('0x1e')]],'as':_0x3890de['as'],'attributes':_0x3890de[_0x22fb('0x1a')],'include':_0x3890de[_0x22fb('0x1c')]?_[_0x22fb('0x1d')](_0x3890de[_0x22fb('0x1c')],function(_0x30f0f8){return{'model':db[_0x30f0f8[_0x22fb('0x1e')]],'as':_0x30f0f8['as'],'attributes':_0x30f0f8[_0x22fb('0x1a')],'include':_0x30f0f8['include']?_[_0x22fb('0x1d')](_0x30f0f8[_0x22fb('0x1c')],function(_0x32f714){return{'model':db[_0x32f714[_0x22fb('0x1e')]],'as':_0x32f714['as'],'attributes':_0x32f714[_0x22fb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x22fb('0xa')](function(_0x2726f1){logger['info'](_0x22fb('0x14'),_0x3f6125);logger[_0x22fb('0xe')](_0x22fb('0x14'),_0x3f6125,JSON[_0x22fb('0x10')](_0x2726f1));_0x44cc86(_0x2726f1);})[_0x22fb('0x1f')](function(_0x2bce30){logger[_0x22fb('0x11')]('GetMailServerIn',_0x2bce30[_0x22fb('0x13')],_0x3f6125);_0x1dbcba(_0x556c44[_0x22fb('0x11')](0x1f4,_0x2bce30[_0x22fb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 7e6729a..b1c314e 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 _0x55e0=['/:id','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','show','post','create'];(function(_0x535380,_0x11e0cb){var _0x27a230=function(_0xcee857){while(--_0xcee857){_0x535380['push'](_0x535380['shift']());}};_0x27a230(++_0x11e0cb);}(_0x55e0,0xdc));var _0x055e=function(_0x20e84d,_0x2f0b85){_0x20e84d=_0x20e84d-0x0;var _0x3c64c9=_0x55e0[_0x20e84d];return _0x3c64c9;};'use strict';var multer=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var path=require(_0x055e('0x2'));var timeout=require(_0x055e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x055e('0x4'));var auth=require(_0x055e('0x5'));var interaction=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var controller=require(_0x055e('0x8'));router[_0x055e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x055e('0x9')]('/:id',auth[_0x055e('0xa')](),controller[_0x055e('0xb')]);router[_0x055e('0xc')]('/',auth[_0x055e('0xa')](),controller[_0x055e('0xd')]);router['put'](_0x055e('0xe'),auth[_0x055e('0xa')](),controller[_0x055e('0xf')]);router[_0x055e('0x10')](_0x055e('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x055e('0x11')]=router; \ No newline at end of file +var _0xa75b=['/:id','post','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index'];(function(_0x92d0c0,_0x4b1bde){var _0x3aa755=function(_0x118404){while(--_0x118404){_0x92d0c0['push'](_0x92d0c0['shift']());}};_0x3aa755(++_0x4b1bde);}(_0xa75b,0x170));var _0xba75=function(_0x14124b,_0x3fd967){_0x14124b=_0x14124b-0x0;var _0x5e0e2c=_0xa75b[_0x14124b];return _0x5e0e2c;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xba75('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xba75('0xe')]('/:id',auth[_0xba75('0xa')](),controller[_0xba75('0xf')]);router[_0xba75('0x10')](_0xba75('0xc'),auth[_0xba75('0xa')](),controller[_0xba75('0x11')]);module[_0xba75('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index e612329..31c8433 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 _0xa498=['BOOLEAN','sequelize','exports','STRING'];(function(_0x19b8cb,_0x31e362){var _0x491ad2=function(_0xd4b2da){while(--_0xd4b2da){_0x19b8cb['push'](_0x19b8cb['shift']());}};_0x491ad2(++_0x31e362);}(_0xa498,0x179));var _0x8a49=function(_0x340756,_0xad31ae){_0x340756=_0x340756-0x0;var _0x2ef745=_0xa498[_0x340756];return _0x2ef745;};'use strict';var Sequelize=require(_0x8a49('0x0'));module[_0x8a49('0x1')]={'description':{'type':Sequelize[_0x8a49('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x8a49('0x2')]},'pass':{'type':Sequelize[_0x8a49('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x8a49('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x8a49('0x2')]},'authentication':{'type':Sequelize[_0x8a49('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2d78=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2d78,0x199));var _0x82d7=function(_0x3c1ca2,_0x3428ae){_0x3c1ca2=_0x3c1ca2-0x0;var _0x310c01=_0x2d78[_0x3c1ca2];return _0x310c01;};'use strict';var Sequelize=require(_0x82d7('0x0'));module[_0x82d7('0x1')]={'description':{'type':Sequelize[_0x82d7('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x82d7('0x2')]},'pass':{'type':Sequelize[_0x82d7('0x2')]},'port':{'type':Sequelize[_0x82d7('0x3')]},'secure':{'type':Sequelize[_0x82d7('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x82d7('0x2')]},'authentication':{'type':Sequelize[_0x82d7('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 f1e2e30..8cb4179 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 _0xe670=['rows','catch','show','params','intersection','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll'];(function(_0x4172b0,_0x23d783){var _0x2961ec=function(_0x5ffd91){while(--_0x5ffd91){_0x4172b0['push'](_0x4172b0['shift']());}};_0x2961ec(++_0x23d783);}(_0xe670,0x16b));var _0x0e67=function(_0x12c280,_0x51dd07){_0x12c280=_0x12c280-0x0;var _0x3638d3=_0xe670[_0x12c280];return _0x3638d3;};'use strict';var emlformat=require(_0x0e67('0x0'));var rimraf=require(_0x0e67('0x1'));var zipdir=require(_0x0e67('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0e67('0x3'));var moment=require(_0x0e67('0x4'));var BPromise=require(_0x0e67('0x5'));var Mustache=require(_0x0e67('0x6'));var util=require(_0x0e67('0x7'));var path=require('path');var sox=require(_0x0e67('0x8'));var csv=require('to-csv');var ejs=require(_0x0e67('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e67('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0e67('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0e67('0xc'));var Redis=require(_0x0e67('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x0e67('0xe'));var as=require(_0x0e67('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e67('0x10'))(_0x0e67('0x11'));var utils=require('../../config/utils');var config=require(_0x0e67('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x0e67('0x13'))['db'];function respondWithStatusCode(_0x2626a5,_0x1d1e92){_0x1d1e92=_0x1d1e92||0xcc;return function(_0x36d623){if(_0x36d623){return _0x2626a5[_0x0e67('0x14')](_0x1d1e92);}return _0x2626a5[_0x0e67('0x15')](_0x1d1e92)[_0x0e67('0x16')]();};}function respondWithResult(_0x5c09c7,_0xc07ee2){_0xc07ee2=_0xc07ee2||0xc8;return function(_0x1f8da1){if(_0x1f8da1){return _0x5c09c7[_0x0e67('0x15')](_0xc07ee2)[_0x0e67('0x17')](_0x1f8da1);}};}function respondWithFilteredResult(_0x26dbdb,_0x49fbd6){return function(_0x337840){if(_0x337840){var _0x2cff20=_0x337840['count'],_0x295b3c=_0x49fbd6[_0x0e67('0x18')],_0x3679ef=_0x49fbd6[_0x0e67('0x18')]+_0x49fbd6['limit'],_0x47f068;if(_0x3679ef>=_0x2cff20){_0x3679ef=_0x2cff20;_0x47f068=0xc8;}else{_0x47f068=0xce;}_0x26dbdb[_0x0e67('0x15')](_0x47f068);return _0x26dbdb[_0x0e67('0x19')](_0x0e67('0x1a'),_0x295b3c+'-'+_0x3679ef+'/'+_0x2cff20)[_0x0e67('0x17')](_0x337840);}return null;};}function patchUpdates(_0xecf7ba){return function(_0xceb4e1){try{jsonpatch[_0x0e67('0x1b')](_0xceb4e1,_0xecf7ba,!![]);}catch(_0x6e37b5){return BPromise[_0x0e67('0x1c')](_0x6e37b5);}return _0xceb4e1[_0x0e67('0x1d')]();};}function saveUpdates(_0x2092ea,_0x2b937d){return function(_0x5c35e6){if(_0x5c35e6){return _0x5c35e6[_0x0e67('0x1e')](_0x2092ea)[_0x0e67('0x1f')](function(_0x356109){return _0x356109;});}return null;};}function removeEntity(_0x3738ad,_0x181b52){return function(_0x321d15){if(_0x321d15){return _0x321d15[_0x0e67('0x20')]()[_0x0e67('0x1f')](function(){_0x3738ad['status'](0xcc)[_0x0e67('0x16')]();});}};}function handleEntityNotFound(_0x5e7ae0,_0x20bdb8){return function(_0x1efefb){if(!_0x1efefb){_0x5e7ae0[_0x0e67('0x14')](0x194);}return _0x1efefb;};}function handleError(_0x159a97,_0x47061b){_0x47061b=_0x47061b||0x1f4;return function(_0x57c498){logger[_0x0e67('0x21')](_0x57c498[_0x0e67('0x22')]);if(_0x57c498[_0x0e67('0x23')]){delete _0x57c498[_0x0e67('0x23')];}_0x159a97['status'](_0x47061b)['send'](_0x57c498);};}exports['index']=function(_0x389b12,_0xaded8e){var _0x43ecaa={},_0x4f56c1={},_0x182be8={'count':0x0,'rows':[]};var _0x9d2c60=_[_0x0e67('0x24')](db[_0x0e67('0x25')][_0x0e67('0x26')],function(_0x336b62){return{'name':_0x336b62[_0x0e67('0x27')],'type':_0x336b62[_0x0e67('0x28')][_0x0e67('0x29')]};});_0x4f56c1[_0x0e67('0x2a')]=_[_0x0e67('0x24')](_0x9d2c60,_0x0e67('0x23'));_0x4f56c1[_0x0e67('0x2b')]=_[_0x0e67('0x2c')](_0x389b12['query']);_0x4f56c1[_0x0e67('0x2d')]=_['intersection'](_0x4f56c1[_0x0e67('0x2a')],_0x4f56c1[_0x0e67('0x2b')]);_0x43ecaa[_0x0e67('0x2e')]=_['intersection'](_0x4f56c1[_0x0e67('0x2a')],qs[_0x0e67('0x2f')](_0x389b12[_0x0e67('0x2b')][_0x0e67('0x2f')]));_0x43ecaa[_0x0e67('0x2e')]=_0x43ecaa[_0x0e67('0x2e')][_0x0e67('0x30')]?_0x43ecaa[_0x0e67('0x2e')]:_0x4f56c1[_0x0e67('0x2a')];if(!_0x389b12['query']['hasOwnProperty'](_0x0e67('0x31'))){_0x43ecaa[_0x0e67('0x32')]=qs[_0x0e67('0x32')](_0x389b12[_0x0e67('0x2b')][_0x0e67('0x32')]);_0x43ecaa[_0x0e67('0x18')]=qs['offset'](_0x389b12[_0x0e67('0x2b')][_0x0e67('0x18')]);}_0x43ecaa[_0x0e67('0x33')]=qs[_0x0e67('0x34')](_0x389b12[_0x0e67('0x2b')][_0x0e67('0x34')]);_0x43ecaa[_0x0e67('0x35')]=qs[_0x0e67('0x2d')](_[_0x0e67('0x36')](_0x389b12[_0x0e67('0x2b')],_0x4f56c1['filters']),_0x9d2c60);if(_0x389b12[_0x0e67('0x2b')][_0x0e67('0x37')]){_0x43ecaa[_0x0e67('0x35')]=_[_0x0e67('0x38')](_0x43ecaa[_0x0e67('0x35')],{'$or':_[_0x0e67('0x24')](_0x9d2c60,function(_0x79a7d9){if(_0x79a7d9[_0x0e67('0x28')]!==_0x0e67('0x39')){var _0x246475={};_0x246475[_0x79a7d9[_0x0e67('0x23')]]={'$like':'%'+_0x389b12[_0x0e67('0x2b')][_0x0e67('0x37')]+'%'};return _0x246475;}})});}_0x43ecaa=_[_0x0e67('0x38')]({},_0x43ecaa,_0x389b12[_0x0e67('0x3a')]);var _0x237e8e={'where':_0x43ecaa[_0x0e67('0x35')]};return db[_0x0e67('0x25')][_0x0e67('0x3b')](_0x237e8e)[_0x0e67('0x1f')](function(_0x326486){_0x182be8[_0x0e67('0x3b')]=_0x326486;if(_0x389b12[_0x0e67('0x2b')][_0x0e67('0x3c')]){_0x43ecaa[_0x0e67('0x3d')]=[{'all':!![]}];}return db[_0x0e67('0x25')][_0x0e67('0x3e')](_0x43ecaa);})[_0x0e67('0x1f')](function(_0x504313){_0x182be8[_0x0e67('0x3f')]=_0x504313;return _0x182be8;})['then'](respondWithFilteredResult(_0xaded8e,_0x43ecaa))[_0x0e67('0x40')](handleError(_0xaded8e,null));};exports[_0x0e67('0x41')]=function(_0x2f299f,_0x1415d7){var _0x115707={'raw':!![],'where':{'id':_0x2f299f[_0x0e67('0x42')]['id']}},_0x42c70b={};_0x42c70b[_0x0e67('0x2a')]=_[_0x0e67('0x2c')](db[_0x0e67('0x25')][_0x0e67('0x26')]);_0x42c70b[_0x0e67('0x2b')]=_['keys'](_0x2f299f[_0x0e67('0x2b')]);_0x42c70b[_0x0e67('0x2d')]=_[_0x0e67('0x43')](_0x42c70b['model'],_0x42c70b[_0x0e67('0x2b')]);_0x115707[_0x0e67('0x2e')]=_[_0x0e67('0x43')](_0x42c70b[_0x0e67('0x2a')],qs['fields'](_0x2f299f[_0x0e67('0x2b')][_0x0e67('0x2f')]));_0x115707[_0x0e67('0x2e')]=_0x115707[_0x0e67('0x2e')][_0x0e67('0x30')]?_0x115707['attributes']:_0x42c70b[_0x0e67('0x2a')];if(_0x2f299f[_0x0e67('0x2b')][_0x0e67('0x3c')]){_0x115707[_0x0e67('0x3d')]=[{'all':!![]}];}_0x115707=_['merge']({},_0x115707,_0x2f299f[_0x0e67('0x3a')]);return db[_0x0e67('0x25')][_0x0e67('0x44')](_0x115707)['then'](handleEntityNotFound(_0x1415d7,null))[_0x0e67('0x1f')](respondWithResult(_0x1415d7,null))[_0x0e67('0x40')](handleError(_0x1415d7,null));};exports[_0x0e67('0x45')]=function(_0x3ca8bd,_0x208052){return db[_0x0e67('0x25')]['create'](_0x3ca8bd[_0x0e67('0x46')],{})['then'](respondWithResult(_0x208052,0xc9))[_0x0e67('0x40')](handleError(_0x208052,null));};exports['update']=function(_0x425916,_0x134482){if(_0x425916['body']['id']){delete _0x425916[_0x0e67('0x46')]['id'];}return db[_0x0e67('0x25')][_0x0e67('0x44')]({'where':{'id':_0x425916[_0x0e67('0x42')]['id']}})[_0x0e67('0x1f')](handleEntityNotFound(_0x134482,null))[_0x0e67('0x1f')](saveUpdates(_0x425916['body'],null))[_0x0e67('0x1f')](respondWithResult(_0x134482,null))[_0x0e67('0x40')](handleError(_0x134482,null));};exports[_0x0e67('0x20')]=function(_0x45d11a,_0x3cc866){return db[_0x0e67('0x25')][_0x0e67('0x44')]({'where':{'id':_0x45d11a[_0x0e67('0x42')]['id']}})[_0x0e67('0x1f')](handleEntityNotFound(_0x3cc866,null))[_0x0e67('0x1f')](removeEntity(_0x3cc866,null))[_0x0e67('0x40')](handleError(_0x3cc866,null));}; \ No newline at end of file +var _0x55e2=['VIRTUAL','options','MailServerOut','include','then','catch','show','length','includeAll','merge','find','create','update','body','params','eml-format','rimraf','zip-dir','moment','bluebird','util','to-csv','ejs','fs-extra','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','end','json','count','limit','set','apply','reject','save','destroy','name','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','nolimit','offset','order','sort','where','pick','filter'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x55e2,0xd8));var _0x255e=function(_0x3cc0f7,_0x19921f){_0x3cc0f7=_0x3cc0f7-0x0;var _0x377ce8=_0x55e2[_0x3cc0f7];return _0x377ce8;};'use strict';var emlformat=require(_0x255e('0x0'));var rimraf=require(_0x255e('0x1'));var zipdir=require(_0x255e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x255e('0x3'));var BPromise=require(_0x255e('0x4'));var Mustache=require('mustache');var util=require(_0x255e('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x255e('0x6'));var ejs=require(_0x255e('0x7'));var fs=require('fs');var fs_extra=require(_0x255e('0x8'));var _=require('lodash');var squel=require(_0x255e('0x9'));var crypto=require(_0x255e('0xa'));var jsforce=require(_0x255e('0xb'));var deskjs=require(_0x255e('0xc'));var toCsv=require(_0x255e('0x6'));var querystring=require(_0x255e('0xd'));var Papa=require(_0x255e('0xe'));var Redis=require(_0x255e('0xf'));var authService=require(_0x255e('0x10'));var qs=require(_0x255e('0x11'));var as=require(_0x255e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x255e('0x13'))(_0x255e('0x14'));var utils=require(_0x255e('0x15'));var config=require(_0x255e('0x16'));var licenseUtil=require(_0x255e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e78d6,_0x37cb25){_0x37cb25=_0x37cb25||0xcc;return function(_0x2e1862){if(_0x2e1862){return _0x4e78d6[_0x255e('0x18')](_0x37cb25);}return _0x4e78d6[_0x255e('0x19')](_0x37cb25)[_0x255e('0x1a')]();};}function respondWithResult(_0x4acafd,_0x2f91d6){_0x2f91d6=_0x2f91d6||0xc8;return function(_0x1ef9c9){if(_0x1ef9c9){return _0x4acafd[_0x255e('0x19')](_0x2f91d6)[_0x255e('0x1b')](_0x1ef9c9);}};}function respondWithFilteredResult(_0x5a799e,_0x3b226c){return function(_0x30828f){if(_0x30828f){var _0xe0e1d9=_0x30828f[_0x255e('0x1c')],_0x5718ee=_0x3b226c['offset'],_0x5efa29=_0x3b226c['offset']+_0x3b226c[_0x255e('0x1d')],_0x22ab5a;if(_0x5efa29>=_0xe0e1d9){_0x5efa29=_0xe0e1d9;_0x22ab5a=0xc8;}else{_0x22ab5a=0xce;}_0x5a799e['status'](_0x22ab5a);return _0x5a799e[_0x255e('0x1e')]('Content-Range',_0x5718ee+'-'+_0x5efa29+'/'+_0xe0e1d9)[_0x255e('0x1b')](_0x30828f);}return null;};}function patchUpdates(_0x20ac50){return function(_0x1d940c){try{jsonpatch[_0x255e('0x1f')](_0x1d940c,_0x20ac50,!![]);}catch(_0x2b313c){return BPromise[_0x255e('0x20')](_0x2b313c);}return _0x1d940c[_0x255e('0x21')]();};}function saveUpdates(_0x12ba37,_0x2d1d1a){return function(_0x14b9bd){if(_0x14b9bd){return _0x14b9bd['update'](_0x12ba37)['then'](function(_0x56cb26){return _0x56cb26;});}return null;};}function removeEntity(_0x51a958,_0x1ff4bf){return function(_0x3b3898){if(_0x3b3898){return _0x3b3898[_0x255e('0x22')]()['then'](function(){_0x51a958['status'](0xcc)[_0x255e('0x1a')]();});}};}function handleEntityNotFound(_0x189514,_0x662022){return function(_0x12277e){if(!_0x12277e){_0x189514[_0x255e('0x18')](0x194);}return _0x12277e;};}function handleError(_0x44fa6a,_0xa2ee81){_0xa2ee81=_0xa2ee81||0x1f4;return function(_0x588987){logger['error'](_0x588987['stack']);if(_0x588987[_0x255e('0x23')]){delete _0x588987[_0x255e('0x23')];}_0x44fa6a['status'](_0xa2ee81)['send'](_0x588987);};}exports['index']=function(_0x2acb12,_0x4a526f){var _0x10a14b={},_0x29bd01={},_0x316dcc={'count':0x0,'rows':[]};var _0x296f3a=_['map'](db['MailServerOut'][_0x255e('0x24')],function(_0x5d0e82){return{'name':_0x5d0e82['fieldName'],'type':_0x5d0e82['type']['key']};});_0x29bd01[_0x255e('0x25')]=_[_0x255e('0x26')](_0x296f3a,'name');_0x29bd01[_0x255e('0x27')]=_[_0x255e('0x28')](_0x2acb12[_0x255e('0x27')]);_0x29bd01[_0x255e('0x29')]=_[_0x255e('0x2a')](_0x29bd01['model'],_0x29bd01[_0x255e('0x27')]);_0x10a14b[_0x255e('0x2b')]=_[_0x255e('0x2a')](_0x29bd01[_0x255e('0x25')],qs[_0x255e('0x2c')](_0x2acb12[_0x255e('0x27')][_0x255e('0x2c')]));_0x10a14b[_0x255e('0x2b')]=_0x10a14b['attributes']['length']?_0x10a14b[_0x255e('0x2b')]:_0x29bd01[_0x255e('0x25')];if(!_0x2acb12[_0x255e('0x27')]['hasOwnProperty'](_0x255e('0x2d'))){_0x10a14b[_0x255e('0x1d')]=qs[_0x255e('0x1d')](_0x2acb12[_0x255e('0x27')][_0x255e('0x1d')]);_0x10a14b['offset']=qs[_0x255e('0x2e')](_0x2acb12[_0x255e('0x27')][_0x255e('0x2e')]);}_0x10a14b[_0x255e('0x2f')]=qs['sort'](_0x2acb12[_0x255e('0x27')][_0x255e('0x30')]);_0x10a14b[_0x255e('0x31')]=qs[_0x255e('0x29')](_[_0x255e('0x32')](_0x2acb12[_0x255e('0x27')],_0x29bd01['filters']),_0x296f3a);if(_0x2acb12['query'][_0x255e('0x33')]){_0x10a14b[_0x255e('0x31')]=_['merge'](_0x10a14b[_0x255e('0x31')],{'$or':_[_0x255e('0x26')](_0x296f3a,function(_0x2244df){if(_0x2244df['type']!==_0x255e('0x34')){var _0x4268ae={};_0x4268ae[_0x2244df[_0x255e('0x23')]]={'$like':'%'+_0x2acb12[_0x255e('0x27')]['filter']+'%'};return _0x4268ae;}})});}_0x10a14b=_['merge']({},_0x10a14b,_0x2acb12[_0x255e('0x35')]);var _0x7d0a7d={'where':_0x10a14b['where']};return db[_0x255e('0x36')][_0x255e('0x1c')](_0x7d0a7d)['then'](function(_0x62e3a5){_0x316dcc[_0x255e('0x1c')]=_0x62e3a5;if(_0x2acb12['query']['includeAll']){_0x10a14b[_0x255e('0x37')]=[{'all':!![]}];}return db[_0x255e('0x36')]['findAll'](_0x10a14b);})['then'](function(_0x5272cc){_0x316dcc['rows']=_0x5272cc;return _0x316dcc;})[_0x255e('0x38')](respondWithFilteredResult(_0x4a526f,_0x10a14b))[_0x255e('0x39')](handleError(_0x4a526f,null));};exports[_0x255e('0x3a')]=function(_0x541bb1,_0x595669){var _0x5772ad={'raw':!![],'where':{'id':_0x541bb1['params']['id']}},_0x5d4f19={};_0x5d4f19[_0x255e('0x25')]=_['keys'](db[_0x255e('0x36')][_0x255e('0x24')]);_0x5d4f19[_0x255e('0x27')]=_['keys'](_0x541bb1[_0x255e('0x27')]);_0x5d4f19[_0x255e('0x29')]=_[_0x255e('0x2a')](_0x5d4f19[_0x255e('0x25')],_0x5d4f19['query']);_0x5772ad['attributes']=_[_0x255e('0x2a')](_0x5d4f19[_0x255e('0x25')],qs['fields'](_0x541bb1[_0x255e('0x27')][_0x255e('0x2c')]));_0x5772ad[_0x255e('0x2b')]=_0x5772ad[_0x255e('0x2b')][_0x255e('0x3b')]?_0x5772ad[_0x255e('0x2b')]:_0x5d4f19[_0x255e('0x25')];if(_0x541bb1[_0x255e('0x27')][_0x255e('0x3c')]){_0x5772ad[_0x255e('0x37')]=[{'all':!![]}];}_0x5772ad=_[_0x255e('0x3d')]({},_0x5772ad,_0x541bb1[_0x255e('0x35')]);return db[_0x255e('0x36')][_0x255e('0x3e')](_0x5772ad)[_0x255e('0x38')](handleEntityNotFound(_0x595669,null))['then'](respondWithResult(_0x595669,null))[_0x255e('0x39')](handleError(_0x595669,null));};exports[_0x255e('0x3f')]=function(_0x2da624,_0x3b1c06){return db['MailServerOut'][_0x255e('0x3f')](_0x2da624['body'],{})[_0x255e('0x38')](respondWithResult(_0x3b1c06,0xc9))['catch'](handleError(_0x3b1c06,null));};exports[_0x255e('0x40')]=function(_0x214fb2,_0x34caf4){if(_0x214fb2[_0x255e('0x41')]['id']){delete _0x214fb2[_0x255e('0x41')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0x214fb2[_0x255e('0x42')]['id']}})[_0x255e('0x38')](handleEntityNotFound(_0x34caf4,null))[_0x255e('0x38')](saveUpdates(_0x214fb2[_0x255e('0x41')],null))[_0x255e('0x38')](respondWithResult(_0x34caf4,null))[_0x255e('0x39')](handleError(_0x34caf4,null));};exports['destroy']=function(_0x58a25a,_0xdd1dea){return db[_0x255e('0x36')][_0x255e('0x3e')]({'where':{'id':_0x58a25a[_0x255e('0x42')]['id']}})[_0x255e('0x38')](handleEntityNotFound(_0xdd1dea,null))[_0x255e('0x38')](removeEntity(_0xdd1dea,null))[_0x255e('0x39')](handleError(_0xdd1dea,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 4917ac3..40ea872 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 _0x4819=['mail_servers_out','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','MailServerOut'];(function(_0x3689fc,_0x35afcf){var _0x48d7b5=function(_0x117e77){while(--_0x117e77){_0x3689fc['push'](_0x3689fc['shift']());}};_0x48d7b5(++_0x35afcf);}(_0x4819,0xcd));var _0x9481=function(_0x478414,_0xcf142d){_0x478414=_0x478414-0x0;var _0x5eb6b9=_0x4819[_0x478414];return _0x5eb6b9;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['./mailServerOut.attributes','exports','define','MailServerOut','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x269b1c,_0x102f74){var _0x3a814f=function(_0x108b8d){while(--_0x108b8d){_0x269b1c['push'](_0x269b1c['shift']());}};_0x3a814f(++_0x102f74);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4711e3,_0x49069e){_0x4711e3=_0x4711e3-0x0;var _0x5542eb=_0x1cb9[_0x4711e3];return _0x5542eb;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'mail_servers_out','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 eb0f8f1..04257ed 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 _0x8586=['then','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x564dc2,_0x5c9c01){var _0x39361b=function(_0x191792){while(--_0x191792){_0x564dc2['push'](_0x564dc2['shift']());}};_0x39361b(++_0x5c9c01);}(_0x8586,0xd0));var _0x6858=function(_0x1ff2ec,_0x386e86){_0x1ff2ec=_0x1ff2ec-0x0;var _0x405683=_0x8586[_0x1ff2ec];return _0x405683;};'use strict';var _=require(_0x6858('0x0'));var util=require(_0x6858('0x1'));var moment=require(_0x6858('0x2'));var BPromise=require(_0x6858('0x3'));var rs=require(_0x6858('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6858('0x5'));var logger=require(_0x6858('0x6'))('rpc');var config=require(_0x6858('0x7'));var jayson=require(_0x6858('0x8'));var client=jayson[_0x6858('0x9')][_0x6858('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c3353,_0x1f21b4,_0x1a4f65){return new BPromise(function(_0x483e99,_0x183c25){return client[_0x6858('0xb')](_0x2c3353,_0x1a4f65)[_0x6858('0xc')](function(_0x338f78){logger['info'](_0x6858('0xd'),_0x1f21b4,_0x6858('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0x1f21b4,_0x6858('0xe'),JSON[_0x6858('0xf')](_0x338f78));if(_0x338f78[_0x6858('0x10')]){if(_0x338f78['error'][_0x6858('0x11')]===0x1f4){logger[_0x6858('0x10')](_0x6858('0xd'),_0x1f21b4,_0x338f78[_0x6858('0x10')][_0x6858('0x12')]);return _0x183c25(_0x338f78['error'][_0x6858('0x12')]);}logger[_0x6858('0x10')](_0x6858('0xd'),_0x1f21b4,_0x338f78['error'][_0x6858('0x12')]);return _0x483e99(_0x338f78[_0x6858('0x10')][_0x6858('0x12')]);}else{logger[_0x6858('0x13')](_0x6858('0xd'),_0x1f21b4,_0x6858('0xe'));_0x483e99(_0x338f78[_0x6858('0x14')][_0x6858('0x12')]);}})[_0x6858('0x15')](function(_0x295a0f){logger['error'](_0x6858('0xd'),_0x1f21b4,_0x295a0f);_0x183c25(_0x295a0f);});});} \ No newline at end of file +var _0xfaec=['debug','request\x20sent','stringify','error','code','MailServerOut,\x20%s,\x20%s','message','result','catch','lodash','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x54fe1c,_0x5d208c){var _0x460aaa=function(_0x430e7a){while(--_0x430e7a){_0x54fe1c['push'](_0x54fe1c['shift']());}};_0x460aaa(++_0x5d208c);}(_0xfaec,0x185));var _0xcfae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfaec[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xcfae('0x0'));var util=require('util');var moment=require(_0xcfae('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcfae('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xcfae('0x3'))(_0xcfae('0x4'));var config=require(_0xcfae('0x5'));var jayson=require(_0xcfae('0x6'));var client=jayson[_0xcfae('0x7')][_0xcfae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x22bf9b,_0x56533e,_0x41d9e5){return new BPromise(function(_0x550c66,_0x58f474){return client[_0xcfae('0x9')](_0x22bf9b,_0x41d9e5)['then'](function(_0x3d4604){logger[_0xcfae('0xa')]('MailServerOut,\x20%s,\x20%s',_0x56533e,'request\x20sent');logger[_0xcfae('0xb')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x56533e,_0xcfae('0xc'),JSON[_0xcfae('0xd')](_0x3d4604));if(_0x3d4604[_0xcfae('0xe')]){if(_0x3d4604[_0xcfae('0xe')][_0xcfae('0xf')]===0x1f4){logger[_0xcfae('0xe')](_0xcfae('0x10'),_0x56533e,_0x3d4604[_0xcfae('0xe')][_0xcfae('0x11')]);return _0x58f474(_0x3d4604['error'][_0xcfae('0x11')]);}logger[_0xcfae('0xe')](_0xcfae('0x10'),_0x56533e,_0x3d4604[_0xcfae('0xe')][_0xcfae('0x11')]);return _0x550c66(_0x3d4604['error'][_0xcfae('0x11')]);}else{logger[_0xcfae('0xa')]('MailServerOut,\x20%s,\x20%s',_0x56533e,_0xcfae('0xc'));_0x550c66(_0x3d4604[_0xcfae('0x12')][_0xcfae('0x11')]);}})[_0xcfae('0x13')](function(_0x37b667){logger['error'](_0xcfae('0x10'),_0x56533e,_0x37b667);_0x58f474(_0x37b667);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 32f395e..e8df2a7 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 _0x8768=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','show','post','put','/:id','update','delete','destroy','exports'];(function(_0x380c81,_0x4c9557){var _0x3a79f5=function(_0x8fd0fa){while(--_0x8fd0fa){_0x380c81['push'](_0x380c81['shift']());}};_0x3a79f5(++_0x4c9557);}(_0x8768,0xa1));var _0x8876=function(_0x4c0498,_0x6073cf){_0x4c0498=_0x4c0498-0x0;var _0xeeffd9=_0x8768[_0x4c0498];return _0xeeffd9;};'use strict';var multer=require(_0x8876('0x0'));var util=require(_0x8876('0x1'));var path=require(_0x8876('0x2'));var timeout=require(_0x8876('0x3'));var express=require(_0x8876('0x4'));var router=express[_0x8876('0x5')]();var fs_extra=require(_0x8876('0x6'));var auth=require(_0x8876('0x7'));var interaction=require(_0x8876('0x8'));var config=require(_0x8876('0x9'));var controller=require(_0x8876('0xa'));router[_0x8876('0xb')]('/',auth[_0x8876('0xc')](),controller['index']);router[_0x8876('0xb')](_0x8876('0xd'),auth[_0x8876('0xc')](),controller[_0x8876('0xe')]);router[_0x8876('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x8876('0xf')]);router[_0x8876('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8876('0x11')](_0x8876('0x12'),auth[_0x8876('0xc')](),controller[_0x8876('0x13')]);router[_0x8876('0x14')](_0x8876('0x12'),auth[_0x8876('0xc')](),controller[_0x8876('0x15')]);module[_0x8876('0x16')]=router; \ No newline at end of file +var _0x5eef=['put','update','destroy','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','/describe','describe','/:id','isAuthenticated','show','post','create'];(function(_0x1249f9,_0x26df04){var _0x7d2b=function(_0x12874a){while(--_0x12874a){_0x1249f9['push'](_0x1249f9['shift']());}};_0x7d2b(++_0x26df04);}(_0x5eef,0x9c));var _0xf5ee=function(_0xd9eae0,_0x79ac96){_0xd9eae0=_0xd9eae0-0x0;var _0x2e17fb=_0x5eef[_0xd9eae0];return _0x2e17fb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf5ee('0x0'));var timeout=require('connect-timeout');var express=require(_0xf5ee('0x1'));var router=express['Router']();var fs_extra=require(_0xf5ee('0x2'));var auth=require(_0xf5ee('0x3'));var interaction=require(_0xf5ee('0x4'));var config=require(_0xf5ee('0x5'));var controller=require(_0xf5ee('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf5ee('0x7')](_0xf5ee('0x8'),auth['isAuthenticated'](),controller[_0xf5ee('0x9')]);router[_0xf5ee('0x7')](_0xf5ee('0xa'),auth[_0xf5ee('0xb')](),controller[_0xf5ee('0xc')]);router[_0xf5ee('0xd')]('/',auth[_0xf5ee('0xb')](),controller[_0xf5ee('0xe')]);router[_0xf5ee('0xf')](_0xf5ee('0xa'),auth['isAuthenticated'](),controller[_0xf5ee('0x10')]);router['delete'](_0xf5ee('0xa'),auth['isAuthenticated'](),controller[_0xf5ee('0x11')]);module[_0xf5ee('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 48c0776..c07d7e7 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 _0xf2e3=['STRING','name','sequelize'];(function(_0x1f4326,_0xe6ba6a){var _0x3a78ab=function(_0x5c5e98){while(--_0x5c5e98){_0x1f4326['push'](_0x1f4326['shift']());}};_0x3a78ab(++_0xe6ba6a);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xf2e3[_0x3740fe];return _0x55492b;};'use strict';var Sequelize=require(_0x3f2e('0x0'));module['exports']={'name':{'type':Sequelize[_0x3f2e('0x1')],'unique':_0x3f2e('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3f2e('0x1')]}}; \ No newline at end of file +var _0x161a=['STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x161a,0x140));var _0xa161=function(_0x31abee,_0x11ff0c){_0x31abee=_0x31abee-0x0;var _0x3c1761=_0x161a[_0x31abee];return _0x3c1761;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa161('0x0')],'unique':_0xa161('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 58a1660..2c3b7b2 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 _0xb3df=['length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','save','update','destroy','then','error','name','send','map','MailSubstatus','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields'];(function(_0x3fb81b,_0x10d1b0){var _0x401825=function(_0x3a48e9){while(--_0x3a48e9){_0x3fb81b['push'](_0x3fb81b['shift']());}};_0x401825(++_0x10d1b0);}(_0xb3df,0x141));var _0xfb3d=function(_0x187e14,_0x44bd02){_0x187e14=_0x187e14-0x0;var _0x335081=_0xb3df[_0x187e14];return _0x335081;};'use strict';var emlformat=require(_0xfb3d('0x0'));var rimraf=require(_0xfb3d('0x1'));var zipdir=require(_0xfb3d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfb3d('0x3'));var moment=require(_0xfb3d('0x4'));var BPromise=require(_0xfb3d('0x5'));var Mustache=require('mustache');var util=require(_0xfb3d('0x6'));var path=require(_0xfb3d('0x7'));var sox=require(_0xfb3d('0x8'));var csv=require(_0xfb3d('0x9'));var ejs=require(_0xfb3d('0xa'));var fs=require('fs');var fs_extra=require(_0xfb3d('0xb'));var _=require(_0xfb3d('0xc'));var squel=require(_0xfb3d('0xd'));var crypto=require(_0xfb3d('0xe'));var jsforce=require(_0xfb3d('0xf'));var deskjs=require(_0xfb3d('0x10'));var toCsv=require('to-csv');var querystring=require(_0xfb3d('0x11'));var Papa=require(_0xfb3d('0x12'));var Redis=require(_0xfb3d('0x13'));var authService=require(_0xfb3d('0x14'));var qs=require(_0xfb3d('0x15'));var as=require(_0xfb3d('0x16'));var hardwareService=require(_0xfb3d('0x17'));var logger=require(_0xfb3d('0x18'))('api');var utils=require(_0xfb3d('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfb3d('0x1a'))['db'];function respondWithStatusCode(_0x1bd10c,_0x473ce9){_0x473ce9=_0x473ce9||0xcc;return function(_0x1c35e2){if(_0x1c35e2){return _0x1bd10c['sendStatus'](_0x473ce9);}return _0x1bd10c[_0xfb3d('0x1b')](_0x473ce9)[_0xfb3d('0x1c')]();};}function respondWithResult(_0x25eb10,_0x59585f){_0x59585f=_0x59585f||0xc8;return function(_0x23faef){if(_0x23faef){return _0x25eb10['status'](_0x59585f)[_0xfb3d('0x1d')](_0x23faef);}};}function respondWithFilteredResult(_0x153a3a,_0x45124a){return function(_0x501390){if(_0x501390){var _0x39200b=_0x501390[_0xfb3d('0x1e')],_0x2c7ed2=_0x45124a[_0xfb3d('0x1f')],_0x449f16=_0x45124a[_0xfb3d('0x1f')]+_0x45124a['limit'],_0x15b9af;if(_0x449f16>=_0x39200b){_0x449f16=_0x39200b;_0x15b9af=0xc8;}else{_0x15b9af=0xce;}_0x153a3a[_0xfb3d('0x1b')](_0x15b9af);return _0x153a3a[_0xfb3d('0x20')](_0xfb3d('0x21'),_0x2c7ed2+'-'+_0x449f16+'/'+_0x39200b)['json'](_0x501390);}return null;};}function patchUpdates(_0x5e5328){return function(_0x2e04e0){try{jsonpatch[_0xfb3d('0x22')](_0x2e04e0,_0x5e5328,!![]);}catch(_0x36993b){return BPromise['reject'](_0x36993b);}return _0x2e04e0[_0xfb3d('0x23')]();};}function saveUpdates(_0x5bee67,_0x50b438){return function(_0x36010a){if(_0x36010a){return _0x36010a[_0xfb3d('0x24')](_0x5bee67)['then'](function(_0x4ea4a5){return _0x4ea4a5;});}return null;};}function removeEntity(_0x144231,_0x1373d4){return function(_0x5b6557){if(_0x5b6557){return _0x5b6557[_0xfb3d('0x25')]()[_0xfb3d('0x26')](function(){_0x144231['status'](0xcc)[_0xfb3d('0x1c')]();});}};}function handleEntityNotFound(_0x5302ba,_0x5a4ca4){return function(_0x38a55c){if(!_0x38a55c){_0x5302ba['sendStatus'](0x194);}return _0x38a55c;};}function handleError(_0x511dde,_0x1ac1e3){_0x1ac1e3=_0x1ac1e3||0x1f4;return function(_0xecff41){logger[_0xfb3d('0x27')](_0xecff41['stack']);if(_0xecff41['name']){delete _0xecff41[_0xfb3d('0x28')];}_0x511dde[_0xfb3d('0x1b')](_0x1ac1e3)[_0xfb3d('0x29')](_0xecff41);};}exports['index']=function(_0x1ba427,_0x3664f9){var _0x25ea5b={},_0x361eb9={},_0x3093c8={'count':0x0,'rows':[]};var _0x3dd912=_[_0xfb3d('0x2a')](db[_0xfb3d('0x2b')]['rawAttributes'],function(_0x505f18){return{'name':_0x505f18[_0xfb3d('0x2c')],'type':_0x505f18[_0xfb3d('0x2d')][_0xfb3d('0x2e')]};});_0x361eb9[_0xfb3d('0x2f')]=_[_0xfb3d('0x2a')](_0x3dd912,'name');_0x361eb9[_0xfb3d('0x30')]=_[_0xfb3d('0x31')](_0x1ba427[_0xfb3d('0x30')]);_0x361eb9[_0xfb3d('0x32')]=_['intersection'](_0x361eb9[_0xfb3d('0x2f')],_0x361eb9[_0xfb3d('0x30')]);_0x25ea5b[_0xfb3d('0x33')]=_[_0xfb3d('0x34')](_0x361eb9[_0xfb3d('0x2f')],qs[_0xfb3d('0x35')](_0x1ba427['query'][_0xfb3d('0x35')]));_0x25ea5b[_0xfb3d('0x33')]=_0x25ea5b['attributes'][_0xfb3d('0x36')]?_0x25ea5b[_0xfb3d('0x33')]:_0x361eb9[_0xfb3d('0x2f')];if(!_0x1ba427[_0xfb3d('0x30')][_0xfb3d('0x37')](_0xfb3d('0x38'))){_0x25ea5b['limit']=qs[_0xfb3d('0x39')](_0x1ba427[_0xfb3d('0x30')][_0xfb3d('0x39')]);_0x25ea5b[_0xfb3d('0x1f')]=qs[_0xfb3d('0x1f')](_0x1ba427[_0xfb3d('0x30')][_0xfb3d('0x1f')]);}_0x25ea5b['order']=qs[_0xfb3d('0x3a')](_0x1ba427['query'][_0xfb3d('0x3a')]);_0x25ea5b[_0xfb3d('0x3b')]=qs['filters'](_[_0xfb3d('0x3c')](_0x1ba427['query'],_0x361eb9['filters']),_0x3dd912);if(_0x1ba427[_0xfb3d('0x30')][_0xfb3d('0x3d')]){_0x25ea5b[_0xfb3d('0x3b')]=_['merge'](_0x25ea5b[_0xfb3d('0x3b')],{'$or':_[_0xfb3d('0x2a')](_0x3dd912,function(_0x24b2f3){if(_0x24b2f3[_0xfb3d('0x2d')]!=='VIRTUAL'){var _0x541c14={};_0x541c14[_0x24b2f3[_0xfb3d('0x28')]]={'$like':'%'+_0x1ba427[_0xfb3d('0x30')]['filter']+'%'};return _0x541c14;}})});}_0x25ea5b=_[_0xfb3d('0x3e')]({},_0x25ea5b,_0x1ba427[_0xfb3d('0x3f')]);var _0x48231f={'where':_0x25ea5b[_0xfb3d('0x3b')]};return db[_0xfb3d('0x2b')]['count'](_0x48231f)[_0xfb3d('0x26')](function(_0x1040d1){_0x3093c8[_0xfb3d('0x1e')]=_0x1040d1;if(_0x1ba427['query'][_0xfb3d('0x40')]){_0x25ea5b['include']=[{'all':!![]}];}return db[_0xfb3d('0x2b')][_0xfb3d('0x41')](_0x25ea5b);})[_0xfb3d('0x26')](function(_0x363b91){_0x3093c8[_0xfb3d('0x42')]=_0x363b91;return _0x3093c8;})[_0xfb3d('0x26')](respondWithFilteredResult(_0x3664f9,_0x25ea5b))[_0xfb3d('0x43')](handleError(_0x3664f9,null));};exports[_0xfb3d('0x44')]=function(_0x4378a1,_0x4e6828){var _0x4164c1={'raw':!![],'where':{'id':_0x4378a1[_0xfb3d('0x45')]['id']}},_0x437522={};_0x437522['model']=_['keys'](db[_0xfb3d('0x2b')][_0xfb3d('0x46')]);_0x437522[_0xfb3d('0x30')]=_[_0xfb3d('0x31')](_0x4378a1['query']);_0x437522['filters']=_[_0xfb3d('0x34')](_0x437522[_0xfb3d('0x2f')],_0x437522['query']);_0x4164c1[_0xfb3d('0x33')]=_[_0xfb3d('0x34')](_0x437522[_0xfb3d('0x2f')],qs[_0xfb3d('0x35')](_0x4378a1[_0xfb3d('0x30')][_0xfb3d('0x35')]));_0x4164c1['attributes']=_0x4164c1[_0xfb3d('0x33')][_0xfb3d('0x36')]?_0x4164c1[_0xfb3d('0x33')]:_0x437522[_0xfb3d('0x2f')];if(_0x4378a1[_0xfb3d('0x30')][_0xfb3d('0x40')]){_0x4164c1[_0xfb3d('0x47')]=[{'all':!![]}];}_0x4164c1=_[_0xfb3d('0x3e')]({},_0x4164c1,_0x4378a1['options']);return db[_0xfb3d('0x2b')]['find'](_0x4164c1)[_0xfb3d('0x26')](handleEntityNotFound(_0x4e6828,null))['then'](respondWithResult(_0x4e6828,null))[_0xfb3d('0x43')](handleError(_0x4e6828,null));};exports['create']=function(_0x495269,_0x61d4cd){return db[_0xfb3d('0x2b')]['create'](_0x495269[_0xfb3d('0x48')],{})[_0xfb3d('0x26')](respondWithResult(_0x61d4cd,0xc9))['catch'](handleError(_0x61d4cd,null));};exports[_0xfb3d('0x24')]=function(_0x411b91,_0x38dac0){if(_0x411b91[_0xfb3d('0x48')]['id']){delete _0x411b91[_0xfb3d('0x48')]['id'];}return db['MailSubstatus'][_0xfb3d('0x49')]({'where':{'id':_0x411b91[_0xfb3d('0x45')]['id']}})[_0xfb3d('0x26')](handleEntityNotFound(_0x38dac0,null))['then'](saveUpdates(_0x411b91[_0xfb3d('0x48')],null))[_0xfb3d('0x26')](respondWithResult(_0x38dac0,null))[_0xfb3d('0x43')](handleError(_0x38dac0,null));};exports[_0xfb3d('0x25')]=function(_0x5c32f1,_0x5a81b4){return db[_0xfb3d('0x2b')]['find']({'where':{'id':_0x5c32f1[_0xfb3d('0x45')]['id']}})[_0xfb3d('0x26')](handleEntityNotFound(_0x5a81b4,null))[_0xfb3d('0x26')](removeEntity(_0x5a81b4,null))[_0xfb3d('0x43')](handleError(_0x5a81b4,null));};exports[_0xfb3d('0x4a')]=function(_0x3d5733,_0x22489a){return db[_0xfb3d('0x2b')][_0xfb3d('0x4a')]()[_0xfb3d('0x26')](respondWithResult(_0x22489a,null))[_0xfb3d('0x43')](handleError(_0x22489a,null));}; \ No newline at end of file +var _0x78ce=['destroy','then','error','stack','index','map','MailSubstatus','fieldName','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','params','keys','rawAttributes','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range'];(function(_0xa79977,_0x4f7f12){var _0x109f10=function(_0x56780f){while(--_0x56780f){_0xa79977['push'](_0xa79977['shift']());}};_0x109f10(++_0x4f7f12);}(_0x78ce,0x184));var _0xe78c=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0x78ce[_0x49d19d];return _0x4ebef1;};'use strict';var emlformat=require(_0xe78c('0x0'));var rimraf=require(_0xe78c('0x1'));var zipdir=require(_0xe78c('0x2'));var jsonpatch=require(_0xe78c('0x3'));var rp=require('request-promise');var moment=require(_0xe78c('0x4'));var BPromise=require(_0xe78c('0x5'));var Mustache=require(_0xe78c('0x6'));var util=require(_0xe78c('0x7'));var path=require(_0xe78c('0x8'));var sox=require(_0xe78c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe78c('0xa'));var squel=require(_0xe78c('0xb'));var crypto=require(_0xe78c('0xc'));var jsforce=require(_0xe78c('0xd'));var deskjs=require(_0xe78c('0xe'));var toCsv=require(_0xe78c('0xf'));var querystring=require(_0xe78c('0x10'));var Papa=require('papaparse');var Redis=require(_0xe78c('0x11'));var authService=require(_0xe78c('0x12'));var qs=require(_0xe78c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe78c('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xe78c('0x15'));var config=require(_0xe78c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe78c('0x17'))['db'];function respondWithStatusCode(_0x135ad8,_0xe5783f){_0xe5783f=_0xe5783f||0xcc;return function(_0x172f01){if(_0x172f01){return _0x135ad8[_0xe78c('0x18')](_0xe5783f);}return _0x135ad8[_0xe78c('0x19')](_0xe5783f)['end']();};}function respondWithResult(_0x1ad1e5,_0x4b4fc2){_0x4b4fc2=_0x4b4fc2||0xc8;return function(_0x5ecde8){if(_0x5ecde8){return _0x1ad1e5[_0xe78c('0x19')](_0x4b4fc2)[_0xe78c('0x1a')](_0x5ecde8);}};}function respondWithFilteredResult(_0x3e7c02,_0x380ccc){return function(_0x40fc4b){if(_0x40fc4b){var _0xec3cb7=_0x40fc4b[_0xe78c('0x1b')],_0x2bd687=_0x380ccc[_0xe78c('0x1c')],_0x18bfb5=_0x380ccc['offset']+_0x380ccc[_0xe78c('0x1d')],_0xa7a40c;if(_0x18bfb5>=_0xec3cb7){_0x18bfb5=_0xec3cb7;_0xa7a40c=0xc8;}else{_0xa7a40c=0xce;}_0x3e7c02['status'](_0xa7a40c);return _0x3e7c02[_0xe78c('0x1e')](_0xe78c('0x1f'),_0x2bd687+'-'+_0x18bfb5+'/'+_0xec3cb7)[_0xe78c('0x1a')](_0x40fc4b);}return null;};}function patchUpdates(_0x1fdb81){return function(_0x61bccf){try{jsonpatch['apply'](_0x61bccf,_0x1fdb81,!![]);}catch(_0x49eca1){return BPromise['reject'](_0x49eca1);}return _0x61bccf['save']();};}function saveUpdates(_0x4fb1c8,_0x17b84a){return function(_0x2561e3){if(_0x2561e3){return _0x2561e3['update'](_0x4fb1c8)['then'](function(_0x4abc14){return _0x4abc14;});}return null;};}function removeEntity(_0x1e28b4,_0x14823a){return function(_0x4b72f5){if(_0x4b72f5){return _0x4b72f5[_0xe78c('0x20')]()[_0xe78c('0x21')](function(){_0x1e28b4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3467dc,_0x3deeea){return function(_0x46b85f){if(!_0x46b85f){_0x3467dc['sendStatus'](0x194);}return _0x46b85f;};}function handleError(_0x390421,_0x32ed1a){_0x32ed1a=_0x32ed1a||0x1f4;return function(_0x39537d){logger[_0xe78c('0x22')](_0x39537d[_0xe78c('0x23')]);if(_0x39537d['name']){delete _0x39537d['name'];}_0x390421[_0xe78c('0x19')](_0x32ed1a)['send'](_0x39537d);};}exports[_0xe78c('0x24')]=function(_0xc338ae,_0x58c6a5){var _0x57ab59={},_0x529b99={},_0x337a62={'count':0x0,'rows':[]};var _0x4bf604=_[_0xe78c('0x25')](db[_0xe78c('0x26')]['rawAttributes'],function(_0x405c62){return{'name':_0x405c62[_0xe78c('0x27')],'type':_0x405c62['type']['key']};});_0x529b99['model']=_['map'](_0x4bf604,_0xe78c('0x28'));_0x529b99[_0xe78c('0x29')]=_['keys'](_0xc338ae[_0xe78c('0x29')]);_0x529b99[_0xe78c('0x2a')]=_[_0xe78c('0x2b')](_0x529b99[_0xe78c('0x2c')],_0x529b99[_0xe78c('0x29')]);_0x57ab59[_0xe78c('0x2d')]=_[_0xe78c('0x2b')](_0x529b99[_0xe78c('0x2c')],qs['fields'](_0xc338ae[_0xe78c('0x29')][_0xe78c('0x2e')]));_0x57ab59['attributes']=_0x57ab59[_0xe78c('0x2d')][_0xe78c('0x2f')]?_0x57ab59['attributes']:_0x529b99[_0xe78c('0x2c')];if(!_0xc338ae[_0xe78c('0x29')][_0xe78c('0x30')](_0xe78c('0x31'))){_0x57ab59[_0xe78c('0x1d')]=qs[_0xe78c('0x1d')](_0xc338ae[_0xe78c('0x29')][_0xe78c('0x1d')]);_0x57ab59[_0xe78c('0x1c')]=qs[_0xe78c('0x1c')](_0xc338ae['query']['offset']);}_0x57ab59['order']=qs[_0xe78c('0x32')](_0xc338ae[_0xe78c('0x29')][_0xe78c('0x32')]);_0x57ab59[_0xe78c('0x33')]=qs[_0xe78c('0x2a')](_[_0xe78c('0x34')](_0xc338ae[_0xe78c('0x29')],_0x529b99['filters']),_0x4bf604);if(_0xc338ae['query'][_0xe78c('0x35')]){_0x57ab59['where']=_[_0xe78c('0x36')](_0x57ab59['where'],{'$or':_[_0xe78c('0x25')](_0x4bf604,function(_0x2a1a18){if(_0x2a1a18[_0xe78c('0x37')]!==_0xe78c('0x38')){var _0x24bf4c={};_0x24bf4c[_0x2a1a18[_0xe78c('0x28')]]={'$like':'%'+_0xc338ae['query'][_0xe78c('0x35')]+'%'};return _0x24bf4c;}})});}_0x57ab59=_[_0xe78c('0x36')]({},_0x57ab59,_0xc338ae[_0xe78c('0x39')]);var _0x4c3955={'where':_0x57ab59[_0xe78c('0x33')]};return db['MailSubstatus'][_0xe78c('0x1b')](_0x4c3955)[_0xe78c('0x21')](function(_0x5714fe){_0x337a62[_0xe78c('0x1b')]=_0x5714fe;if(_0xc338ae[_0xe78c('0x29')]['includeAll']){_0x57ab59[_0xe78c('0x3a')]=[{'all':!![]}];}return db[_0xe78c('0x26')][_0xe78c('0x3b')](_0x57ab59);})['then'](function(_0x5ade6f){_0x337a62['rows']=_0x5ade6f;return _0x337a62;})[_0xe78c('0x21')](respondWithFilteredResult(_0x58c6a5,_0x57ab59))[_0xe78c('0x3c')](handleError(_0x58c6a5,null));};exports[_0xe78c('0x3d')]=function(_0x2e701,_0x2a73e7){var _0x12c522={'raw':!![],'where':{'id':_0x2e701[_0xe78c('0x3e')]['id']}},_0x283dd4={};_0x283dd4[_0xe78c('0x2c')]=_[_0xe78c('0x3f')](db['MailSubstatus'][_0xe78c('0x40')]);_0x283dd4[_0xe78c('0x29')]=_[_0xe78c('0x3f')](_0x2e701['query']);_0x283dd4[_0xe78c('0x2a')]=_[_0xe78c('0x2b')](_0x283dd4[_0xe78c('0x2c')],_0x283dd4[_0xe78c('0x29')]);_0x12c522['attributes']=_['intersection'](_0x283dd4['model'],qs['fields'](_0x2e701['query']['fields']));_0x12c522[_0xe78c('0x2d')]=_0x12c522['attributes'][_0xe78c('0x2f')]?_0x12c522[_0xe78c('0x2d')]:_0x283dd4['model'];if(_0x2e701[_0xe78c('0x29')][_0xe78c('0x41')]){_0x12c522[_0xe78c('0x3a')]=[{'all':!![]}];}_0x12c522=_['merge']({},_0x12c522,_0x2e701[_0xe78c('0x39')]);return db[_0xe78c('0x26')][_0xe78c('0x42')](_0x12c522)[_0xe78c('0x21')](handleEntityNotFound(_0x2a73e7,null))['then'](respondWithResult(_0x2a73e7,null))[_0xe78c('0x3c')](handleError(_0x2a73e7,null));};exports[_0xe78c('0x43')]=function(_0x1df94c,_0x4e6b45){return db[_0xe78c('0x26')][_0xe78c('0x43')](_0x1df94c[_0xe78c('0x44')],{})['then'](respondWithResult(_0x4e6b45,0xc9))[_0xe78c('0x3c')](handleError(_0x4e6b45,null));};exports['update']=function(_0x5b616b,_0x3b0937){if(_0x5b616b[_0xe78c('0x44')]['id']){delete _0x5b616b['body']['id'];}return db['MailSubstatus'][_0xe78c('0x42')]({'where':{'id':_0x5b616b['params']['id']}})[_0xe78c('0x21')](handleEntityNotFound(_0x3b0937,null))['then'](saveUpdates(_0x5b616b[_0xe78c('0x44')],null))[_0xe78c('0x21')](respondWithResult(_0x3b0937,null))[_0xe78c('0x3c')](handleError(_0x3b0937,null));};exports[_0xe78c('0x20')]=function(_0x306311,_0x2bada3){return db[_0xe78c('0x26')][_0xe78c('0x42')]({'where':{'id':_0x306311['params']['id']}})[_0xe78c('0x21')](handleEntityNotFound(_0x2bada3,null))[_0xe78c('0x21')](removeEntity(_0x2bada3,null))[_0xe78c('0x3c')](handleError(_0x2bada3,null));};exports['describe']=function(_0x529ab5,_0x41f410){return db[_0xe78c('0x26')][_0xe78c('0x45')]()[_0xe78c('0x21')](respondWithResult(_0x41f410,null))[_0xe78c('0x3c')](handleError(_0x41f410,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 8dcf4fc..34dd31d 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 _0x761c=['api','bluebird','request-promise','path','../../config/environment','exports','define','MailSubstatus','mail_substatuses','lodash','../../config/logger'];(function(_0x174390,_0x587f57){var _0x1ea387=function(_0x194067){while(--_0x194067){_0x174390['push'](_0x174390['shift']());}};_0x1ea387(++_0x587f57);}(_0x761c,0x18a));var _0xc761=function(_0x2816b3,_0x1a54c1){_0x2816b3=_0x2816b3-0x0;var _0x3af5e9=_0x761c[_0x2816b3];return _0x3af5e9;};'use strict';var _=require(_0xc761('0x0'));var util=require('util');var logger=require(_0xc761('0x1'))(_0xc761('0x2'));var moment=require('moment');var BPromise=require(_0xc761('0x3'));var rp=require(_0xc761('0x4'));var fs=require('fs');var path=require(_0xc761('0x5'));var rimraf=require('rimraf');var config=require(_0xc761('0x6'));var attributes=require('./mailSubstatus.attributes');module[_0xc761('0x7')]=function(_0x468f51,_0x23ba0b){return _0x468f51[_0xc761('0x8')](_0xc761('0x9'),attributes,{'tableName':_0xc761('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x056b=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses'];(function(_0x36a87e,_0x30bcd2){var _0x322b98=function(_0x415832){while(--_0x415832){_0x36a87e['push'](_0x36a87e['shift']());}};_0x322b98(++_0x30bcd2);}(_0x056b,0xb6));var _0xb056=function(_0x5f5b5c,_0x529e05){_0x5f5b5c=_0x5f5b5c-0x0;var _0x5339c0=_0x056b[_0x5f5b5c];return _0x5339c0;};'use strict';var _=require('lodash');var util=require(_0xb056('0x0'));var logger=require(_0xb056('0x1'))(_0xb056('0x2'));var moment=require(_0xb056('0x3'));var BPromise=require(_0xb056('0x4'));var rp=require(_0xb056('0x5'));var fs=require('fs');var path=require(_0xb056('0x6'));var rimraf=require(_0xb056('0x7'));var config=require(_0xb056('0x8'));var attributes=require(_0xb056('0x9'));module[_0xb056('0xa')]=function(_0x515612,_0x2d5e4f){return _0x515612[_0xb056('0xb')](_0xb056('0xc'),attributes,{'tableName':_0xb056('0xd'),'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 d942e8a..64c91a4 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 _0x9f62=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailSubstatus,\x20%s,\x20%s','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch'];(function(_0x59ab24,_0x172f42){var _0x1bbef4=function(_0x18cabb){while(--_0x18cabb){_0x59ab24['push'](_0x59ab24['shift']());}};_0x1bbef4(++_0x172f42);}(_0x9f62,0x154));var _0x29f6=function(_0x2ef3f5,_0x5a0e5b){_0x2ef3f5=_0x2ef3f5-0x0;var _0x162d35=_0x9f62[_0x2ef3f5];return _0x162d35;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x272876,_0x9a43fe,_0x2ba602){return new BPromise(function(_0x416c6c,_0x5e9945){return client['request'](_0x272876,_0x2ba602)['then'](function(_0x549f64){logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,'request\x20sent');logger['debug'](_0x29f6('0xb'),_0x9a43fe,_0x29f6('0xc'),JSON['stringify'](_0x549f64));if(_0x549f64[_0x29f6('0xd')]){if(_0x549f64[_0x29f6('0xd')]['code']===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x9a43fe,_0x549f64['error'][_0x29f6('0xe')]);return _0x5e9945(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}logger[_0x29f6('0xd')](_0x29f6('0xa'),_0x9a43fe,_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);return _0x416c6c(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}else{logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,_0x29f6('0xc'));_0x416c6c(_0x549f64[_0x29f6('0xf')][_0x29f6('0xe')]);}})[_0x29f6('0x10')](function(_0x14dd56){logger[_0x29f6('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x9a43fe,_0x14dd56);_0x5e9945(_0x14dd56);});});} \ No newline at end of file +var _0x3c81=['MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2adaea,_0x3bf83d){var _0x3c915b=function(_0x12fc13){while(--_0x12fc13){_0x2adaea['push'](_0x2adaea['shift']());}};_0x3c915b(++_0x3bf83d);}(_0x3c81,0x102));var _0x13c8=function(_0x17a32e,_0x501007){_0x17a32e=_0x17a32e-0x0;var _0x59851e=_0x3c81[_0x17a32e];return _0x59851e;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var moment=require('moment');var BPromise=require(_0x13c8('0x2'));var rs=require(_0x13c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x13c8('0x4'));var config=require(_0x13c8('0x5'));var jayson=require(_0x13c8('0x6'));var client=jayson[_0x13c8('0x7')][_0x13c8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f0bd2,_0x445b69,_0x4f7bcc){return new BPromise(function(_0x17c228,_0x4905c3){return client[_0x13c8('0x9')](_0x3f0bd2,_0x4f7bcc)[_0x13c8('0xa')](function(_0x189ce6){logger[_0x13c8('0xb')](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));logger[_0x13c8('0xe')](_0x13c8('0xf'),_0x445b69,_0x13c8('0xd'),JSON[_0x13c8('0x10')](_0x189ce6));if(_0x189ce6[_0x13c8('0x11')]){if(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x12')]===0x1f4){logger[_0x13c8('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x445b69,_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);return _0x4905c3(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);}logger['error'](_0x13c8('0xc'),_0x445b69,_0x189ce6['error']['message']);return _0x17c228(_0x189ce6['error'][_0x13c8('0x13')]);}else{logger['info'](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));_0x17c228(_0x189ce6[_0x13c8('0x14')][_0x13c8('0x13')]);}})['catch'](function(_0x13a9e1){logger[_0x13c8('0x11')](_0x13c8('0xc'),_0x445b69,_0x13a9e1);_0x4905c3(_0x13a9e1);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index ed0112b..162d3c4 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 _0xf7f3=['get','index','/:id','isAuthenticated','show','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x4d3a9b,_0x20b47d){var _0x1b5471=function(_0x51bf57){while(--_0x51bf57){_0x4d3a9b['push'](_0x4d3a9b['shift']());}};_0x1b5471(++_0x20b47d);}(_0xf7f3,0x12a));var _0x3f7f=function(_0x4c9a90,_0x177f67){_0x4c9a90=_0x4c9a90-0x0;var _0x13e558=_0xf7f3[_0x4c9a90];return _0x13e558;};'use strict';var multer=require(_0x3f7f('0x0'));var util=require(_0x3f7f('0x1'));var path=require(_0x3f7f('0x2'));var timeout=require(_0x3f7f('0x3'));var express=require(_0x3f7f('0x4'));var router=express[_0x3f7f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3f7f('0x6'));var config=require(_0x3f7f('0x7'));var controller=require('./mailTransferReport.controller');router[_0x3f7f('0x8')]('/',auth['isAuthenticated'](),controller[_0x3f7f('0x9')]);router[_0x3f7f('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x3f7f('0xa'),auth[_0x3f7f('0xb')](),controller[_0x3f7f('0xc')]);router[_0x3f7f('0xd')]('/',auth[_0x3f7f('0xb')](),controller[_0x3f7f('0xe')]);router[_0x3f7f('0xf')](_0x3f7f('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x3f7f('0x10')](_0x3f7f('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x3f7f('0x11')]=router; \ No newline at end of file +var _0x5825=['/describe','describe','show','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index'];(function(_0x439670,_0x41e93e){var _0x530cd2=function(_0x40fa19){while(--_0x40fa19){_0x439670['push'](_0x439670['shift']());}};_0x530cd2(++_0x41e93e);}(_0x5825,0x78));var _0x5582=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5825[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x5582('0x0'));var util=require(_0x5582('0x1'));var path=require(_0x5582('0x2'));var timeout=require(_0x5582('0x3'));var express=require('express');var router=express[_0x5582('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5582('0x5'));var interaction=require(_0x5582('0x6'));var config=require(_0x5582('0x7'));var controller=require(_0x5582('0x8'));router[_0x5582('0x9')]('/',auth[_0x5582('0xa')](),controller[_0x5582('0xb')]);router['get'](_0x5582('0xc'),auth[_0x5582('0xa')](),controller[_0x5582('0xd')]);router[_0x5582('0x9')]('/:id',auth[_0x5582('0xa')](),controller[_0x5582('0xe')]);router[_0x5582('0xf')]('/',auth['isAuthenticated'](),controller[_0x5582('0x10')]);router[_0x5582('0x11')](_0x5582('0x12'),auth['isAuthenticated'](),controller[_0x5582('0x13')]);router[_0x5582('0x14')]('/:id',auth[_0x5582('0xa')](),controller[_0x5582('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 3cc3560..b1081a7 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 _0xb2cb=['queue','DATE','NOW','moment','sequelize','exports','ENUM'];(function(_0x11d91a,_0x5f04a1){var _0x263df4=function(_0x1b0af6){while(--_0x1b0af6){_0x11d91a['push'](_0x11d91a['shift']());}};_0x263df4(++_0x5f04a1);}(_0xb2cb,0x199));var _0xbb2c=function(_0x35387d,_0x1ba72f){_0x35387d=_0x35387d-0x0;var _0x3aba56=_0xb2cb[_0x35387d];return _0x3aba56;};'use strict';var moment=require(_0xbb2c('0x0'));var Sequelize=require(_0xbb2c('0x1'));module[_0xbb2c('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xbb2c('0x3')]('account','agent','queue'),'allowNull':![],'defaultValue':_0xbb2c('0x4')},'transferredAt':{'type':Sequelize[_0xbb2c('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xbb2c('0x6')]}}; \ No newline at end of file +var _0xe9d9=['moment','sequelize','exports','ENUM','account','agent','queue','DATE','NOW'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xe9d9,0x1b9));var _0x9e9d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe9d9[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0x9e9d('0x0'));var Sequelize=require(_0x9e9d('0x1'));module[_0x9e9d('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x9e9d('0x3')](_0x9e9d('0x4'),_0x9e9d('0x5'),_0x9e9d('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x9e9d('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x9e9d('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 75a45ef..21edab3 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 _0x1215=['offset','order','sort','pick','filters','where','merge','options','count','includeAll','include','rows','show','params','find','catch','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','set','Content-Range','json','apply','then','end','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit'];(function(_0x1ba153,_0x202e73){var _0x3924b2=function(_0x4babc3){while(--_0x4babc3){_0x1ba153['push'](_0x1ba153['shift']());}};_0x3924b2(++_0x202e73);}(_0x1215,0x17d));var _0x5121=function(_0x281b4c,_0x2c8ae0){_0x281b4c=_0x281b4c-0x0;var _0x2f32d1=_0x1215[_0x281b4c];return _0x2f32d1;};'use strict';var emlformat=require(_0x5121('0x0'));var rimraf=require(_0x5121('0x1'));var zipdir=require(_0x5121('0x2'));var jsonpatch=require(_0x5121('0x3'));var rp=require(_0x5121('0x4'));var moment=require(_0x5121('0x5'));var BPromise=require(_0x5121('0x6'));var Mustache=require('mustache');var util=require(_0x5121('0x7'));var path=require(_0x5121('0x8'));var sox=require(_0x5121('0x9'));var csv=require(_0x5121('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5121('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5121('0xc'));var jsforce=require(_0x5121('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5121('0xa'));var querystring=require('querystring');var Papa=require(_0x5121('0xe'));var Redis=require(_0x5121('0xf'));var authService=require(_0x5121('0x10'));var qs=require(_0x5121('0x11'));var as=require(_0x5121('0x12'));var hardwareService=require(_0x5121('0x13'));var logger=require(_0x5121('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5121('0x15'));var db=require(_0x5121('0x16'))['db'];function respondWithStatusCode(_0x50089f,_0x4dd7f1){_0x4dd7f1=_0x4dd7f1||0xcc;return function(_0x1ba5c1){if(_0x1ba5c1){return _0x50089f[_0x5121('0x17')](_0x4dd7f1);}return _0x50089f[_0x5121('0x18')](_0x4dd7f1)['end']();};}function respondWithResult(_0x53a507,_0x3ad98d){_0x3ad98d=_0x3ad98d||0xc8;return function(_0x399cf7){if(_0x399cf7){return _0x53a507[_0x5121('0x18')](_0x3ad98d)['json'](_0x399cf7);}};}function respondWithFilteredResult(_0x18d9df,_0x4f8584){return function(_0x49d031){if(_0x49d031){var _0x3ddf03=_0x49d031['count'],_0x4e9368=_0x4f8584['offset'],_0x24a66e=_0x4f8584['offset']+_0x4f8584['limit'],_0x2b6102;if(_0x24a66e>=_0x3ddf03){_0x24a66e=_0x3ddf03;_0x2b6102=0xc8;}else{_0x2b6102=0xce;}_0x18d9df[_0x5121('0x18')](_0x2b6102);return _0x18d9df[_0x5121('0x19')](_0x5121('0x1a'),_0x4e9368+'-'+_0x24a66e+'/'+_0x3ddf03)[_0x5121('0x1b')](_0x49d031);}return null;};}function patchUpdates(_0x5a1ce9){return function(_0x556871){try{jsonpatch[_0x5121('0x1c')](_0x556871,_0x5a1ce9,!![]);}catch(_0x5a2aa2){return BPromise['reject'](_0x5a2aa2);}return _0x556871['save']();};}function saveUpdates(_0x45f349,_0x750281){return function(_0x414a8d){if(_0x414a8d){return _0x414a8d['update'](_0x45f349)[_0x5121('0x1d')](function(_0xb32a57){return _0xb32a57;});}return null;};}function removeEntity(_0x24e123,_0x5bce43){return function(_0x34f280){if(_0x34f280){return _0x34f280['destroy']()[_0x5121('0x1d')](function(){_0x24e123[_0x5121('0x18')](0xcc)[_0x5121('0x1e')]();});}};}function handleEntityNotFound(_0x3abd40,_0x111d41){return function(_0x42f849){if(!_0x42f849){_0x3abd40['sendStatus'](0x194);}return _0x42f849;};}function handleError(_0x2334e3,_0x2dadd1){_0x2dadd1=_0x2dadd1||0x1f4;return function(_0x1f20fa){logger[_0x5121('0x1f')](_0x1f20fa[_0x5121('0x20')]);if(_0x1f20fa[_0x5121('0x21')]){delete _0x1f20fa[_0x5121('0x21')];}_0x2334e3[_0x5121('0x18')](_0x2dadd1)[_0x5121('0x22')](_0x1f20fa);};}exports[_0x5121('0x23')]=function(_0x2dc258,_0x244fc3){var _0x2ee58e={},_0x466247={},_0x63db0d={'count':0x0,'rows':[]};var _0x7054eb=_[_0x5121('0x24')](db[_0x5121('0x25')][_0x5121('0x26')],function(_0x2eb108){return{'name':_0x2eb108[_0x5121('0x27')],'type':_0x2eb108[_0x5121('0x28')]['key']};});_0x466247[_0x5121('0x29')]=_[_0x5121('0x24')](_0x7054eb,_0x5121('0x21'));_0x466247[_0x5121('0x2a')]=_[_0x5121('0x2b')](_0x2dc258[_0x5121('0x2a')]);_0x466247['filters']=_[_0x5121('0x2c')](_0x466247[_0x5121('0x29')],_0x466247[_0x5121('0x2a')]);_0x2ee58e['attributes']=_[_0x5121('0x2c')](_0x466247[_0x5121('0x29')],qs[_0x5121('0x2d')](_0x2dc258['query'][_0x5121('0x2d')]));_0x2ee58e['attributes']=_0x2ee58e[_0x5121('0x2e')][_0x5121('0x2f')]?_0x2ee58e[_0x5121('0x2e')]:_0x466247[_0x5121('0x29')];if(!_0x2dc258[_0x5121('0x2a')][_0x5121('0x30')](_0x5121('0x31'))){_0x2ee58e[_0x5121('0x32')]=qs[_0x5121('0x32')](_0x2dc258['query']['limit']);_0x2ee58e[_0x5121('0x33')]=qs[_0x5121('0x33')](_0x2dc258[_0x5121('0x2a')][_0x5121('0x33')]);}_0x2ee58e[_0x5121('0x34')]=qs[_0x5121('0x35')](_0x2dc258[_0x5121('0x2a')][_0x5121('0x35')]);_0x2ee58e['where']=qs['filters'](_[_0x5121('0x36')](_0x2dc258[_0x5121('0x2a')],_0x466247[_0x5121('0x37')]),_0x7054eb);if(_0x2dc258[_0x5121('0x2a')]['filter']){_0x2ee58e[_0x5121('0x38')]=_[_0x5121('0x39')](_0x2ee58e[_0x5121('0x38')],{'$or':_[_0x5121('0x24')](_0x7054eb,function(_0x210863){if(_0x210863[_0x5121('0x28')]!=='VIRTUAL'){var _0x31fa39={};_0x31fa39[_0x210863[_0x5121('0x21')]]={'$like':'%'+_0x2dc258[_0x5121('0x2a')]['filter']+'%'};return _0x31fa39;}})});}_0x2ee58e=_[_0x5121('0x39')]({},_0x2ee58e,_0x2dc258[_0x5121('0x3a')]);var _0xda05b0={'where':_0x2ee58e[_0x5121('0x38')]};return db['MailTransferReport'][_0x5121('0x3b')](_0xda05b0)[_0x5121('0x1d')](function(_0x4b4fe2){_0x63db0d[_0x5121('0x3b')]=_0x4b4fe2;if(_0x2dc258[_0x5121('0x2a')][_0x5121('0x3c')]){_0x2ee58e[_0x5121('0x3d')]=[{'all':!![]}];}return db[_0x5121('0x25')]['findAll'](_0x2ee58e);})[_0x5121('0x1d')](function(_0x392b09){_0x63db0d[_0x5121('0x3e')]=_0x392b09;return _0x63db0d;})[_0x5121('0x1d')](respondWithFilteredResult(_0x244fc3,_0x2ee58e))['catch'](handleError(_0x244fc3,null));};exports[_0x5121('0x3f')]=function(_0x4846f1,_0x36ca53){var _0x348793={'raw':!![],'where':{'id':_0x4846f1[_0x5121('0x40')]['id']}},_0x5b4661={};_0x5b4661[_0x5121('0x29')]=_['keys'](db[_0x5121('0x25')]['rawAttributes']);_0x5b4661['query']=_[_0x5121('0x2b')](_0x4846f1[_0x5121('0x2a')]);_0x5b4661[_0x5121('0x37')]=_[_0x5121('0x2c')](_0x5b4661[_0x5121('0x29')],_0x5b4661[_0x5121('0x2a')]);_0x348793[_0x5121('0x2e')]=_[_0x5121('0x2c')](_0x5b4661[_0x5121('0x29')],qs[_0x5121('0x2d')](_0x4846f1[_0x5121('0x2a')][_0x5121('0x2d')]));_0x348793[_0x5121('0x2e')]=_0x348793['attributes'][_0x5121('0x2f')]?_0x348793['attributes']:_0x5b4661[_0x5121('0x29')];if(_0x4846f1[_0x5121('0x2a')]['includeAll']){_0x348793['include']=[{'all':!![]}];}_0x348793=_[_0x5121('0x39')]({},_0x348793,_0x4846f1[_0x5121('0x3a')]);return db[_0x5121('0x25')][_0x5121('0x41')](_0x348793)[_0x5121('0x1d')](handleEntityNotFound(_0x36ca53,null))[_0x5121('0x1d')](respondWithResult(_0x36ca53,null))[_0x5121('0x42')](handleError(_0x36ca53,null));};exports[_0x5121('0x43')]=function(_0x168640,_0x1c83c2){return db[_0x5121('0x25')][_0x5121('0x43')](_0x168640[_0x5121('0x44')],{})['then'](respondWithResult(_0x1c83c2,0xc9))[_0x5121('0x42')](handleError(_0x1c83c2,null));};exports[_0x5121('0x45')]=function(_0x49a8df,_0xdd308f){if(_0x49a8df[_0x5121('0x44')]['id']){delete _0x49a8df[_0x5121('0x44')]['id'];}return db[_0x5121('0x25')][_0x5121('0x41')]({'where':{'id':_0x49a8df[_0x5121('0x40')]['id']}})[_0x5121('0x1d')](handleEntityNotFound(_0xdd308f,null))[_0x5121('0x1d')](saveUpdates(_0x49a8df[_0x5121('0x44')],null))[_0x5121('0x1d')](respondWithResult(_0xdd308f,null))[_0x5121('0x42')](handleError(_0xdd308f,null));};exports[_0x5121('0x46')]=function(_0x5ef338,_0xf8f90){return db[_0x5121('0x25')]['find']({'where':{'id':_0x5ef338[_0x5121('0x40')]['id']}})[_0x5121('0x1d')](handleEntityNotFound(_0xf8f90,null))[_0x5121('0x1d')](removeEntity(_0xf8f90,null))[_0x5121('0x42')](handleError(_0xf8f90,null));};exports[_0x5121('0x47')]=function(_0x3e82d4,_0x11fe08){return db[_0x5121('0x25')][_0x5121('0x47')]()[_0x5121('0x1d')](respondWithResult(_0x11fe08,null))[_0x5121('0x42')](handleError(_0x11fe08,null));}; \ No newline at end of file +var _0x6f7a=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','then','destroy','error','stack','name','index','map','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','MailTransferReport','findAll','catch','show','keys','options','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x25bbd6,_0x18f6d3){var _0x3a4c78=function(_0x277579){while(--_0x277579){_0x25bbd6['push'](_0x25bbd6['shift']());}};_0x3a4c78(++_0x18f6d3);}(_0x6f7a,0x117));var _0xa6f7=function(_0x111272,_0x587225){_0x111272=_0x111272-0x0;var _0x1e5f5f=_0x6f7a[_0x111272];return _0x1e5f5f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa6f7('0x0'));var zipdir=require(_0xa6f7('0x1'));var jsonpatch=require(_0xa6f7('0x2'));var rp=require(_0xa6f7('0x3'));var moment=require(_0xa6f7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa6f7('0x5'));var util=require(_0xa6f7('0x6'));var path=require(_0xa6f7('0x7'));var sox=require(_0xa6f7('0x8'));var csv=require(_0xa6f7('0x9'));var ejs=require(_0xa6f7('0xa'));var fs=require('fs');var fs_extra=require(_0xa6f7('0xb'));var _=require(_0xa6f7('0xc'));var squel=require(_0xa6f7('0xd'));var crypto=require(_0xa6f7('0xe'));var jsforce=require(_0xa6f7('0xf'));var deskjs=require(_0xa6f7('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa6f7('0x11'));var Papa=require(_0xa6f7('0x12'));var Redis=require('ioredis');var authService=require(_0xa6f7('0x13'));var qs=require(_0xa6f7('0x14'));var as=require(_0xa6f7('0x15'));var hardwareService=require(_0xa6f7('0x16'));var logger=require(_0xa6f7('0x17'))(_0xa6f7('0x18'));var utils=require(_0xa6f7('0x19'));var config=require(_0xa6f7('0x1a'));var licenseUtil=require(_0xa6f7('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f51e4,_0x4af485){_0x4af485=_0x4af485||0xcc;return function(_0x55e79a){if(_0x55e79a){return _0x5f51e4[_0xa6f7('0x1c')](_0x4af485);}return _0x5f51e4[_0xa6f7('0x1d')](_0x4af485)[_0xa6f7('0x1e')]();};}function respondWithResult(_0x362287,_0x27b96c){_0x27b96c=_0x27b96c||0xc8;return function(_0x2ad504){if(_0x2ad504){return _0x362287['status'](_0x27b96c)['json'](_0x2ad504);}};}function respondWithFilteredResult(_0x4c6530,_0x41539d){return function(_0x706beb){if(_0x706beb){var _0x37a037=_0x706beb[_0xa6f7('0x1f')],_0x29d3b6=_0x41539d['offset'],_0x5c4aa7=_0x41539d[_0xa6f7('0x20')]+_0x41539d[_0xa6f7('0x21')],_0x43d2ab;if(_0x5c4aa7>=_0x37a037){_0x5c4aa7=_0x37a037;_0x43d2ab=0xc8;}else{_0x43d2ab=0xce;}_0x4c6530['status'](_0x43d2ab);return _0x4c6530[_0xa6f7('0x22')](_0xa6f7('0x23'),_0x29d3b6+'-'+_0x5c4aa7+'/'+_0x37a037)[_0xa6f7('0x24')](_0x706beb);}return null;};}function patchUpdates(_0x1a6991){return function(_0x4ad4c9){try{jsonpatch[_0xa6f7('0x25')](_0x4ad4c9,_0x1a6991,!![]);}catch(_0x55957b){return BPromise['reject'](_0x55957b);}return _0x4ad4c9[_0xa6f7('0x26')]();};}function saveUpdates(_0x2907aa,_0x238129){return function(_0x737781){if(_0x737781){return _0x737781['update'](_0x2907aa)[_0xa6f7('0x27')](function(_0x486d5d){return _0x486d5d;});}return null;};}function removeEntity(_0x3fd6a0,_0xf94cd0){return function(_0x2eaeaa){if(_0x2eaeaa){return _0x2eaeaa[_0xa6f7('0x28')]()[_0xa6f7('0x27')](function(){_0x3fd6a0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x35138b,_0x19be3d){return function(_0x326fc4){if(!_0x326fc4){_0x35138b[_0xa6f7('0x1c')](0x194);}return _0x326fc4;};}function handleError(_0x28bd2f,_0x51838b){_0x51838b=_0x51838b||0x1f4;return function(_0x260814){logger[_0xa6f7('0x29')](_0x260814[_0xa6f7('0x2a')]);if(_0x260814['name']){delete _0x260814[_0xa6f7('0x2b')];}_0x28bd2f['status'](_0x51838b)['send'](_0x260814);};}exports[_0xa6f7('0x2c')]=function(_0x49a4f4,_0x270529){var _0x42e094={},_0x410a24={},_0x5f30b8={'count':0x0,'rows':[]};var _0x2f9242=_[_0xa6f7('0x2d')](db['MailTransferReport']['rawAttributes'],function(_0x180c46){return{'name':_0x180c46[_0xa6f7('0x2e')],'type':_0x180c46['type']['key']};});_0x410a24[_0xa6f7('0x2f')]=_['map'](_0x2f9242,_0xa6f7('0x2b'));_0x410a24[_0xa6f7('0x30')]=_['keys'](_0x49a4f4[_0xa6f7('0x30')]);_0x410a24[_0xa6f7('0x31')]=_['intersection'](_0x410a24[_0xa6f7('0x2f')],_0x410a24[_0xa6f7('0x30')]);_0x42e094[_0xa6f7('0x32')]=_[_0xa6f7('0x33')](_0x410a24[_0xa6f7('0x2f')],qs[_0xa6f7('0x34')](_0x49a4f4[_0xa6f7('0x30')][_0xa6f7('0x34')]));_0x42e094[_0xa6f7('0x32')]=_0x42e094[_0xa6f7('0x32')][_0xa6f7('0x35')]?_0x42e094[_0xa6f7('0x32')]:_0x410a24[_0xa6f7('0x2f')];if(!_0x49a4f4[_0xa6f7('0x30')][_0xa6f7('0x36')](_0xa6f7('0x37'))){_0x42e094[_0xa6f7('0x21')]=qs['limit'](_0x49a4f4[_0xa6f7('0x30')][_0xa6f7('0x21')]);_0x42e094[_0xa6f7('0x20')]=qs[_0xa6f7('0x20')](_0x49a4f4[_0xa6f7('0x30')]['offset']);}_0x42e094[_0xa6f7('0x38')]=qs[_0xa6f7('0x39')](_0x49a4f4[_0xa6f7('0x30')]['sort']);_0x42e094[_0xa6f7('0x3a')]=qs[_0xa6f7('0x31')](_['pick'](_0x49a4f4[_0xa6f7('0x30')],_0x410a24['filters']),_0x2f9242);if(_0x49a4f4['query'][_0xa6f7('0x3b')]){_0x42e094[_0xa6f7('0x3a')]=_[_0xa6f7('0x3c')](_0x42e094[_0xa6f7('0x3a')],{'$or':_['map'](_0x2f9242,function(_0x16a30b){if(_0x16a30b[_0xa6f7('0x3d')]!==_0xa6f7('0x3e')){var _0x27fc63={};_0x27fc63[_0x16a30b[_0xa6f7('0x2b')]]={'$like':'%'+_0x49a4f4[_0xa6f7('0x30')]['filter']+'%'};return _0x27fc63;}})});}_0x42e094=_[_0xa6f7('0x3c')]({},_0x42e094,_0x49a4f4['options']);var _0x4ee6b9={'where':_0x42e094[_0xa6f7('0x3a')]};return db['MailTransferReport'][_0xa6f7('0x1f')](_0x4ee6b9)[_0xa6f7('0x27')](function(_0x46d588){_0x5f30b8[_0xa6f7('0x1f')]=_0x46d588;if(_0x49a4f4[_0xa6f7('0x30')][_0xa6f7('0x3f')]){_0x42e094[_0xa6f7('0x40')]=[{'all':!![]}];}return db[_0xa6f7('0x41')][_0xa6f7('0x42')](_0x42e094);})['then'](function(_0x474f21){_0x5f30b8['rows']=_0x474f21;return _0x5f30b8;})[_0xa6f7('0x27')](respondWithFilteredResult(_0x270529,_0x42e094))[_0xa6f7('0x43')](handleError(_0x270529,null));};exports[_0xa6f7('0x44')]=function(_0x1e954b,_0xc63aa7){var _0xba5116={'raw':!![],'where':{'id':_0x1e954b['params']['id']}},_0x948ef0={};_0x948ef0[_0xa6f7('0x2f')]=_[_0xa6f7('0x45')](db[_0xa6f7('0x41')]['rawAttributes']);_0x948ef0[_0xa6f7('0x30')]=_[_0xa6f7('0x45')](_0x1e954b[_0xa6f7('0x30')]);_0x948ef0[_0xa6f7('0x31')]=_[_0xa6f7('0x33')](_0x948ef0[_0xa6f7('0x2f')],_0x948ef0[_0xa6f7('0x30')]);_0xba5116[_0xa6f7('0x32')]=_['intersection'](_0x948ef0[_0xa6f7('0x2f')],qs[_0xa6f7('0x34')](_0x1e954b[_0xa6f7('0x30')][_0xa6f7('0x34')]));_0xba5116['attributes']=_0xba5116[_0xa6f7('0x32')]['length']?_0xba5116[_0xa6f7('0x32')]:_0x948ef0[_0xa6f7('0x2f')];if(_0x1e954b[_0xa6f7('0x30')][_0xa6f7('0x3f')]){_0xba5116[_0xa6f7('0x40')]=[{'all':!![]}];}_0xba5116=_[_0xa6f7('0x3c')]({},_0xba5116,_0x1e954b[_0xa6f7('0x46')]);return db[_0xa6f7('0x41')][_0xa6f7('0x47')](_0xba5116)[_0xa6f7('0x27')](handleEntityNotFound(_0xc63aa7,null))[_0xa6f7('0x27')](respondWithResult(_0xc63aa7,null))[_0xa6f7('0x43')](handleError(_0xc63aa7,null));};exports[_0xa6f7('0x48')]=function(_0x2d0395,_0x599059){return db[_0xa6f7('0x41')][_0xa6f7('0x48')](_0x2d0395[_0xa6f7('0x49')],{})['then'](respondWithResult(_0x599059,0xc9))[_0xa6f7('0x43')](handleError(_0x599059,null));};exports[_0xa6f7('0x4a')]=function(_0x53a752,_0x335143){if(_0x53a752[_0xa6f7('0x49')]['id']){delete _0x53a752['body']['id'];}return db['MailTransferReport'][_0xa6f7('0x47')]({'where':{'id':_0x53a752['params']['id']}})[_0xa6f7('0x27')](handleEntityNotFound(_0x335143,null))[_0xa6f7('0x27')](saveUpdates(_0x53a752['body'],null))[_0xa6f7('0x27')](respondWithResult(_0x335143,null))['catch'](handleError(_0x335143,null));};exports[_0xa6f7('0x28')]=function(_0x51d796,_0x3a5bf1){return db[_0xa6f7('0x41')]['find']({'where':{'id':_0x51d796['params']['id']}})['then'](handleEntityNotFound(_0x3a5bf1,null))[_0xa6f7('0x27')](removeEntity(_0x3a5bf1,null))[_0xa6f7('0x43')](handleError(_0x3a5bf1,null));};exports[_0xa6f7('0x4b')]=function(_0x404a23,_0x41deaf){return db['MailTransferReport'][_0xa6f7('0x4b')]()[_0xa6f7('0x27')](respondWithResult(_0x41deaf,null))[_0xa6f7('0x43')](handleError(_0x41deaf,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index d840aea..a014956 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 _0x40da=['./mailTransferReport.attributes','MailTransferReport','report_mail_transfer','uniqueid','lodash','api','rimraf'];(function(_0x404535,_0x2de636){var _0x6985de=function(_0x3fe1e9){while(--_0x3fe1e9){_0x404535['push'](_0x404535['shift']());}};_0x6985de(++_0x2de636);}(_0x40da,0xb3));var _0xa40d=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x40da[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xa40d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa40d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa40d('0x2'));var config=require('../../config/environment');var attributes=require(_0xa40d('0x3'));module['exports']=function(_0x19e0b5,_0x4b6f94){return _0x19e0b5['define'](_0xa40d('0x4'),attributes,{'tableName':_0xa40d('0x5'),'paranoid':![],'indexes':[{'name':_0xa40d('0x6'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2822=['MailTransferReport','uniqueid','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x2822,0x16a));var _0x2282=function(_0x296cd6,_0x4b6173){_0x296cd6=_0x296cd6-0x0;var _0x44538d=_0x2822[_0x296cd6];return _0x44538d;};'use strict';var _=require('lodash');var util=require(_0x2282('0x0'));var logger=require(_0x2282('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2282('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2282('0x3'));var rimraf=require(_0x2282('0x4'));var config=require(_0x2282('0x5'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x414123,_0x5c1c28){return _0x414123['define'](_0x2282('0x6'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2282('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index edcc4ea..9655cb0 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 _0xe45c=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','ioredis'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0xe45c,0x66));var _0xce45=function(_0x68d1a5,_0x2564e5){_0x68d1a5=_0x68d1a5-0x0;var _0x511300=_0xe45c[_0x68d1a5];return _0x511300;};'use strict';var _=require('lodash');var util=require(_0xce45('0x0'));var moment=require(_0xce45('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce45('0x2'));var db=require(_0xce45('0x3'))['db'];var utils=require(_0xce45('0x4'));var logger=require(_0xce45('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xce45('0x6'));var client=jayson[_0xce45('0x7')][_0xce45('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d33f6,_0x27e7f8,_0x3a34d7){return new BPromise(function(_0x4b398e,_0x5b0665){return client[_0xce45('0x9')](_0x1d33f6,_0x3a34d7)[_0xce45('0xa')](function(_0x3e0ca8){logger[_0xce45('0xb')](_0xce45('0xc'),_0x27e7f8,_0xce45('0xd'));logger[_0xce45('0xe')](_0xce45('0xf'),_0x27e7f8,'request\x20sent',JSON[_0xce45('0x10')](_0x3e0ca8));if(_0x3e0ca8[_0xce45('0x11')]){if(_0x3e0ca8['error']['code']===0x1f4){logger['error'](_0xce45('0xc'),_0x27e7f8,_0x3e0ca8[_0xce45('0x11')]['message']);return _0x5b0665(_0x3e0ca8[_0xce45('0x11')]['message']);}logger['error'](_0xce45('0xc'),_0x27e7f8,_0x3e0ca8[_0xce45('0x11')][_0xce45('0x12')]);return _0x4b398e(_0x3e0ca8['error']['message']);}else{logger[_0xce45('0xb')](_0xce45('0xc'),_0x27e7f8,'request\x20sent');_0x4b398e(_0x3e0ca8[_0xce45('0x13')][_0xce45('0x12')]);}})[_0xce45('0x14')](function(_0x4be360){logger[_0xce45('0x11')](_0xce45('0xc'),_0x27e7f8,_0x4be360);_0x5b0665(_0x4be360);});});} \ No newline at end of file +var _0xaf55=['error','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x647d84,_0x1cdf39){var _0x561814=function(_0x405019){while(--_0x405019){_0x647d84['push'](_0x647d84['shift']());}};_0x561814(++_0x1cdf39);}(_0xaf55,0x82));var _0x5af5=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xaf55[_0x51020b];return _0x371e47;};'use strict';var _=require(_0x5af5('0x0'));var util=require(_0x5af5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5af5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5af5('0x3'))['db'];var utils=require(_0x5af5('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5af5('0x5'));var client=jayson[_0x5af5('0x6')][_0x5af5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4450a6,_0x5870f7,_0x58dc0d){return new BPromise(function(_0x22ca09,_0x19db86){return client[_0x5af5('0x8')](_0x4450a6,_0x58dc0d)[_0x5af5('0x9')](function(_0x39503e){logger[_0x5af5('0xa')](_0x5af5('0xb'),_0x5870f7,_0x5af5('0xc'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x5870f7,_0x5af5('0xc'),JSON[_0x5af5('0xd')](_0x39503e));if(_0x39503e[_0x5af5('0xe')]){if(_0x39503e['error']['code']===0x1f4){logger['error'](_0x5af5('0xb'),_0x5870f7,_0x39503e[_0x5af5('0xe')][_0x5af5('0xf')]);return _0x19db86(_0x39503e[_0x5af5('0xe')]['message']);}logger[_0x5af5('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x5870f7,_0x39503e['error'][_0x5af5('0xf')]);return _0x22ca09(_0x39503e[_0x5af5('0xe')][_0x5af5('0xf')]);}else{logger[_0x5af5('0xa')]('MailTransferReport,\x20%s,\x20%s',_0x5870f7,'request\x20sent');_0x22ca09(_0x39503e[_0x5af5('0x10')][_0x5af5('0xf')]);}})[_0x5af5('0x11')](function(_0x3a3858){logger[_0x5af5('0xe')](_0x5af5('0xb'),_0x5870f7,_0x3a3858);_0x19db86(_0x3a3858);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 48741e1..e411a33 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 _0x229c=['express','../../components/auth/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated','/:id','post','put','update','delete','destroy','exports','util'];(function(_0x3fd9cc,_0x57816b){var _0x53e052=function(_0x5288f8){while(--_0x5288f8){_0x3fd9cc['push'](_0x3fd9cc['shift']());}};_0x53e052(++_0x57816b);}(_0x229c,0xcf));var _0xc229=function(_0x30075d,_0x2538e1){_0x30075d=_0x30075d-0x0;var _0x476de7=_0x229c[_0x30075d];return _0x476de7;};'use strict';var multer=require('multer');var util=require(_0xc229('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc229('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc229('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xc229('0x3'));var controller=require(_0xc229('0x4'));router[_0xc229('0x5')]('/',auth['isAuthenticated'](),controller[_0xc229('0x6')]);router['get'](_0xc229('0x7'),auth[_0xc229('0x8')](),controller['describe']);router[_0xc229('0x5')](_0xc229('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xc229('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc229('0xb')](_0xc229('0x9'),auth[_0xc229('0x8')](),controller[_0xc229('0xc')]);router[_0xc229('0xd')](_0xc229('0x9'),auth[_0xc229('0x8')](),controller[_0xc229('0xe')]);module[_0xc229('0xf')]=router; \ No newline at end of file +var _0x4ee5=['./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x53aacd,_0x1511ba){var _0x523e0c=function(_0x33d93e){while(--_0x33d93e){_0x53aacd['push'](_0x53aacd['shift']());}};_0x523e0c(++_0x1511ba);}(_0x4ee5,0xd4));var _0x54ee=function(_0x39233d,_0x53ecd9){_0x39233d=_0x39233d-0x0;var _0x10e271=_0x4ee5[_0x39233d];return _0x10e271;};'use strict';var multer=require(_0x54ee('0x0'));var util=require('util');var path=require(_0x54ee('0x1'));var timeout=require(_0x54ee('0x2'));var express=require('express');var router=express[_0x54ee('0x3')]();var fs_extra=require(_0x54ee('0x4'));var auth=require(_0x54ee('0x5'));var interaction=require(_0x54ee('0x6'));var config=require(_0x54ee('0x7'));var controller=require(_0x54ee('0x8'));router[_0x54ee('0x9')]('/',auth[_0x54ee('0xa')](),controller[_0x54ee('0xb')]);router['get'](_0x54ee('0xc'),auth[_0x54ee('0xa')](),controller[_0x54ee('0xd')]);router[_0x54ee('0x9')](_0x54ee('0xe'),auth[_0x54ee('0xa')](),controller[_0x54ee('0xf')]);router[_0x54ee('0x10')]('/',auth[_0x54ee('0xa')](),controller[_0x54ee('0x11')]);router[_0x54ee('0x12')](_0x54ee('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x54ee('0x13')](_0x54ee('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index f5fd221..83e6350 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 _0xd0c5=['talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[start]'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0xd0c5,0x10b));var _0x5d0c=function(_0x234f6f,_0x250d2a){_0x234f6f=_0x234f6f-0x0;var _0x4cb664=_0xd0c5[_0x234f6f];return _0x4cb664;};'use strict';var Sequelize=require(_0x5d0c('0x0'));var moment=require(_0x5d0c('0x1'));module['exports']={'channel':{'type':Sequelize[_0x5d0c('0x2')]},'membername':{'type':Sequelize[_0x5d0c('0x2')]},'interface':{'type':Sequelize[_0x5d0c('0x2')]},'type':{'type':Sequelize[_0x5d0c('0x2')],'defaultValue':_0x5d0c('0x3'),'comment':_0x5d0c('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x4fcf97){var _0x3b31ef=moment(_0x4fcf97);var _0x516c38=moment(this[_0x5d0c('0x5')](_0x5d0c('0x6')));var _0x24f5f1=_0x3b31ef[_0x5d0c('0x7')](_0x516c38,_0x5d0c('0x8'));this[_0x5d0c('0x9')](_0x5d0c('0xa'),_0x4fcf97);this['setDataValue'](_0x5d0c('0xb'),_0x24f5f1||null);}},'data1':{'type':Sequelize[_0x5d0c('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x5d0c('0x2')],'comment':_0x5d0c('0xc')},'data3':{'type':Sequelize[_0x5d0c('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x5d0c('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x5d0c('0x2')],'comment':_0x5d0c('0xd')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x5d0c('0x2')]}}; \ No newline at end of file +var _0x2065=['INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','duration','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2065,0xeb));var _0x5206=function(_0x2dab51,_0x507da2){_0x2dab51=_0x2dab51-0x0;var _0x4bf353=_0x2065[_0x2dab51];return _0x4bf353;};'use strict';var Sequelize=require(_0x5206('0x0'));var moment=require(_0x5206('0x1'));module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x5206('0x2')]},'interface':{'type':Sequelize[_0x5206('0x2')]},'type':{'type':Sequelize[_0x5206('0x2')],'defaultValue':_0x5206('0x3'),'comment':_0x5206('0x4')},'duration':{'type':Sequelize[_0x5206('0x5')]},'enterAt':{'type':Sequelize[_0x5206('0x6')]},'exitAt':{'type':Sequelize[_0x5206('0x6')],'set':function(_0x2e1cb9){var _0x534a4d=moment(_0x2e1cb9);var _0x3c2f0e=moment(this[_0x5206('0x7')](_0x5206('0x8')));var _0x24e7f9=_0x534a4d['diff'](_0x3c2f0e,_0x5206('0x9'));this['setDataValue']('exitAt',_0x2e1cb9);this[_0x5206('0xa')](_0x5206('0xb'),_0x24e7f9||null);}},'data1':{'type':Sequelize[_0x5206('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x5206('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':_0x5206('0xc')},'data4':{'type':Sequelize[_0x5206('0x2')],'comment':_0x5206('0xd')},'data5':{'type':Sequelize[_0x5206('0x2')],'comment':_0x5206('0xe')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x5206('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 39160b2..57d7d0f 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 _0x86e0=['../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','json','offset','limit','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs'];(function(_0x4b0af3,_0x256454){var _0x19c6d3=function(_0x38af48){while(--_0x38af48){_0x4b0af3['push'](_0x4b0af3['shift']());}};_0x19c6d3(++_0x256454);}(_0x86e0,0x1cf));var _0x086e=function(_0x403f10,_0x160299){_0x403f10=_0x403f10-0x0;var _0xcef29c=_0x86e0[_0x403f10];return _0xcef29c;};'use strict';var emlformat=require(_0x086e('0x0'));var rimraf=require(_0x086e('0x1'));var zipdir=require(_0x086e('0x2'));var jsonpatch=require(_0x086e('0x3'));var rp=require(_0x086e('0x4'));var moment=require(_0x086e('0x5'));var BPromise=require(_0x086e('0x6'));var Mustache=require(_0x086e('0x7'));var util=require('util');var path=require(_0x086e('0x8'));var sox=require(_0x086e('0x9'));var csv=require(_0x086e('0xa'));var ejs=require(_0x086e('0xb'));var fs=require('fs');var fs_extra=require(_0x086e('0xc'));var _=require(_0x086e('0xd'));var squel=require(_0x086e('0xe'));var crypto=require(_0x086e('0xf'));var jsforce=require(_0x086e('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x086e('0x11'));var Papa=require('papaparse');var Redis=require(_0x086e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x086e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x086e('0x14'));var logger=require('../../config/logger')(_0x086e('0x15'));var utils=require(_0x086e('0x16'));var config=require(_0x086e('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40b049,_0x3c6f09){_0x3c6f09=_0x3c6f09||0xcc;return function(_0x386f53){if(_0x386f53){return _0x40b049['sendStatus'](_0x3c6f09);}return _0x40b049[_0x086e('0x18')](_0x3c6f09)[_0x086e('0x19')]();};}function respondWithResult(_0x52515e,_0x4e256b){_0x4e256b=_0x4e256b||0xc8;return function(_0x1a7b88){if(_0x1a7b88){return _0x52515e[_0x086e('0x18')](_0x4e256b)[_0x086e('0x1a')](_0x1a7b88);}};}function respondWithFilteredResult(_0x5cf5a2,_0x5c1c48){return function(_0x210d22){if(_0x210d22){var _0xde5a0a=_0x210d22['count'],_0x2ce269=_0x5c1c48[_0x086e('0x1b')],_0x22aa07=_0x5c1c48[_0x086e('0x1b')]+_0x5c1c48[_0x086e('0x1c')],_0x1e8b5d;if(_0x22aa07>=_0xde5a0a){_0x22aa07=_0xde5a0a;_0x1e8b5d=0xc8;}else{_0x1e8b5d=0xce;}_0x5cf5a2[_0x086e('0x18')](_0x1e8b5d);return _0x5cf5a2['set'](_0x086e('0x1d'),_0x2ce269+'-'+_0x22aa07+'/'+_0xde5a0a)[_0x086e('0x1a')](_0x210d22);}return null;};}function patchUpdates(_0x13a78e){return function(_0x11fce0){try{jsonpatch['apply'](_0x11fce0,_0x13a78e,!![]);}catch(_0x155de3){return BPromise[_0x086e('0x1e')](_0x155de3);}return _0x11fce0[_0x086e('0x1f')]();};}function saveUpdates(_0x1c8fc5,_0x138a53){return function(_0x23edd1){if(_0x23edd1){return _0x23edd1[_0x086e('0x20')](_0x1c8fc5)[_0x086e('0x21')](function(_0x191e23){return _0x191e23;});}return null;};}function removeEntity(_0x47ae47,_0x3fa03d){return function(_0x26e93f){if(_0x26e93f){return _0x26e93f[_0x086e('0x22')]()['then'](function(){_0x47ae47['status'](0xcc)[_0x086e('0x19')]();});}};}function handleEntityNotFound(_0x17d7c3,_0x20d42d){return function(_0x324cf6){if(!_0x324cf6){_0x17d7c3[_0x086e('0x23')](0x194);}return _0x324cf6;};}function handleError(_0x49e0fa,_0x17e8a6){_0x17e8a6=_0x17e8a6||0x1f4;return function(_0x5d9212){logger['error'](_0x5d9212[_0x086e('0x24')]);if(_0x5d9212[_0x086e('0x25')]){delete _0x5d9212[_0x086e('0x25')];}_0x49e0fa[_0x086e('0x18')](_0x17e8a6)[_0x086e('0x26')](_0x5d9212);};}exports[_0x086e('0x27')]=function(_0x23e299,_0x333d53){var _0x2d50a2={},_0x5e5d18={},_0x4a134b={'count':0x0,'rows':[]};var _0x4b4315=_[_0x086e('0x28')](db[_0x086e('0x29')][_0x086e('0x2a')],function(_0x6baa10){return{'name':_0x6baa10['fieldName'],'type':_0x6baa10[_0x086e('0x2b')]['key']};});_0x5e5d18[_0x086e('0x2c')]=_[_0x086e('0x28')](_0x4b4315,_0x086e('0x25'));_0x5e5d18[_0x086e('0x2d')]=_[_0x086e('0x2e')](_0x23e299[_0x086e('0x2d')]);_0x5e5d18[_0x086e('0x2f')]=_['intersection'](_0x5e5d18['model'],_0x5e5d18['query']);_0x2d50a2[_0x086e('0x30')]=_[_0x086e('0x31')](_0x5e5d18[_0x086e('0x2c')],qs[_0x086e('0x32')](_0x23e299[_0x086e('0x2d')][_0x086e('0x32')]));_0x2d50a2['attributes']=_0x2d50a2[_0x086e('0x30')][_0x086e('0x33')]?_0x2d50a2[_0x086e('0x30')]:_0x5e5d18[_0x086e('0x2c')];if(!_0x23e299[_0x086e('0x2d')]['hasOwnProperty']('nolimit')){_0x2d50a2[_0x086e('0x1c')]=qs[_0x086e('0x1c')](_0x23e299[_0x086e('0x2d')]['limit']);_0x2d50a2['offset']=qs[_0x086e('0x1b')](_0x23e299[_0x086e('0x2d')][_0x086e('0x1b')]);}_0x2d50a2[_0x086e('0x34')]=qs[_0x086e('0x35')](_0x23e299[_0x086e('0x2d')][_0x086e('0x35')]);_0x2d50a2[_0x086e('0x36')]=qs['filters'](_['pick'](_0x23e299[_0x086e('0x2d')],_0x5e5d18['filters']),_0x4b4315);if(_0x23e299['query'][_0x086e('0x37')]){_0x2d50a2[_0x086e('0x36')]=_[_0x086e('0x38')](_0x2d50a2[_0x086e('0x36')],{'$or':_[_0x086e('0x28')](_0x4b4315,function(_0x4c3948){if(_0x4c3948[_0x086e('0x2b')]!==_0x086e('0x39')){var _0x16a1c5={};_0x16a1c5[_0x4c3948[_0x086e('0x25')]]={'$like':'%'+_0x23e299[_0x086e('0x2d')][_0x086e('0x37')]+'%'};return _0x16a1c5;}})});}_0x2d50a2=_['merge']({},_0x2d50a2,_0x23e299[_0x086e('0x3a')]);var _0x514a40={'where':_0x2d50a2[_0x086e('0x36')]};return db[_0x086e('0x29')]['count'](_0x514a40)[_0x086e('0x21')](function(_0x2a3852){_0x4a134b['count']=_0x2a3852;if(_0x23e299['query'][_0x086e('0x3b')]){_0x2d50a2['include']=[{'all':!![]}];}return db['MemberReport'][_0x086e('0x3c')](_0x2d50a2);})['then'](function(_0x2dd386){_0x4a134b[_0x086e('0x3d')]=_0x2dd386;return _0x4a134b;})[_0x086e('0x21')](respondWithFilteredResult(_0x333d53,_0x2d50a2))[_0x086e('0x3e')](handleError(_0x333d53,null));};exports['show']=function(_0x4445ef,_0x408afb){var _0x3514aa={'raw':!![],'where':{'id':_0x4445ef[_0x086e('0x3f')]['id']}},_0x2a8434={};_0x2a8434['model']=_['keys'](db[_0x086e('0x29')]['rawAttributes']);_0x2a8434['query']=_[_0x086e('0x2e')](_0x4445ef['query']);_0x2a8434['filters']=_[_0x086e('0x31')](_0x2a8434[_0x086e('0x2c')],_0x2a8434['query']);_0x3514aa['attributes']=_['intersection'](_0x2a8434['model'],qs[_0x086e('0x32')](_0x4445ef[_0x086e('0x2d')][_0x086e('0x32')]));_0x3514aa[_0x086e('0x30')]=_0x3514aa[_0x086e('0x30')][_0x086e('0x33')]?_0x3514aa[_0x086e('0x30')]:_0x2a8434[_0x086e('0x2c')];if(_0x4445ef[_0x086e('0x2d')][_0x086e('0x3b')]){_0x3514aa[_0x086e('0x40')]=[{'all':!![]}];}_0x3514aa=_['merge']({},_0x3514aa,_0x4445ef[_0x086e('0x3a')]);return db['MemberReport'][_0x086e('0x41')](_0x3514aa)[_0x086e('0x21')](handleEntityNotFound(_0x408afb,null))[_0x086e('0x21')](respondWithResult(_0x408afb,null))['catch'](handleError(_0x408afb,null));};exports[_0x086e('0x42')]=function(_0x3fe31e,_0x1ddeb8){return db[_0x086e('0x29')][_0x086e('0x42')](_0x3fe31e['body'],{})[_0x086e('0x21')](respondWithResult(_0x1ddeb8,0xc9))[_0x086e('0x3e')](handleError(_0x1ddeb8,null));};exports['update']=function(_0x3a0287,_0x3eb455){if(_0x3a0287[_0x086e('0x43')]['id']){delete _0x3a0287[_0x086e('0x43')]['id'];}return db[_0x086e('0x29')][_0x086e('0x41')]({'where':{'id':_0x3a0287['params']['id']}})[_0x086e('0x21')](handleEntityNotFound(_0x3eb455,null))[_0x086e('0x21')](saveUpdates(_0x3a0287[_0x086e('0x43')],null))['then'](respondWithResult(_0x3eb455,null))[_0x086e('0x3e')](handleError(_0x3eb455,null));};exports[_0x086e('0x22')]=function(_0x16d9c6,_0x2baa0d){return db['MemberReport'][_0x086e('0x41')]({'where':{'id':_0x16d9c6[_0x086e('0x3f')]['id']}})[_0x086e('0x21')](handleEntityNotFound(_0x2baa0d,null))[_0x086e('0x21')](removeEntity(_0x2baa0d,null))[_0x086e('0x3e')](handleError(_0x2baa0d,null));};exports['describe']=function(_0x30f3e8,_0x227f78){return db[_0x086e('0x29')][_0x086e('0x44')]()[_0x086e('0x21')](respondWithResult(_0x227f78,null))[_0x086e('0x3e')](handleError(_0x227f78,null));}; \ No newline at end of file +var _0xc8c3=['merge','find','create','body','params','describe','eml-format','rimraf','zip-dir','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','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','MemberReport','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','options','includeAll','include','rows','catch','show'];(function(_0x1e911c,_0x27c992){var _0x447c12=function(_0x555764){while(--_0x555764){_0x1e911c['push'](_0x1e911c['shift']());}};_0x447c12(++_0x27c992);}(_0xc8c3,0xea));var _0x3c8c=function(_0xfd9b19,_0x21d75f){_0xfd9b19=_0xfd9b19-0x0;var _0x514918=_0xc8c3[_0xfd9b19];return _0x514918;};'use strict';var emlformat=require(_0x3c8c('0x0'));var rimraf=require(_0x3c8c('0x1'));var zipdir=require(_0x3c8c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3c8c('0x3'));var BPromise=require(_0x3c8c('0x4'));var Mustache=require('mustache');var util=require(_0x3c8c('0x5'));var path=require(_0x3c8c('0x6'));var sox=require(_0x3c8c('0x7'));var csv=require(_0x3c8c('0x8'));var ejs=require(_0x3c8c('0x9'));var fs=require('fs');var fs_extra=require(_0x3c8c('0xa'));var _=require(_0x3c8c('0xb'));var squel=require(_0x3c8c('0xc'));var crypto=require(_0x3c8c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3c8c('0xe'));var toCsv=require(_0x3c8c('0x8'));var querystring=require(_0x3c8c('0xf'));var Papa=require(_0x3c8c('0x10'));var Redis=require(_0x3c8c('0x11'));var authService=require(_0x3c8c('0x12'));var qs=require(_0x3c8c('0x13'));var as=require(_0x3c8c('0x14'));var hardwareService=require(_0x3c8c('0x15'));var logger=require('../../config/logger')(_0x3c8c('0x16'));var utils=require(_0x3c8c('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3c8c('0x18'))['db'];function respondWithStatusCode(_0xc72f6c,_0x5870d7){_0x5870d7=_0x5870d7||0xcc;return function(_0x17e586){if(_0x17e586){return _0xc72f6c[_0x3c8c('0x19')](_0x5870d7);}return _0xc72f6c[_0x3c8c('0x1a')](_0x5870d7)['end']();};}function respondWithResult(_0x5bb186,_0x1bae84){_0x1bae84=_0x1bae84||0xc8;return function(_0x3d6fa7){if(_0x3d6fa7){return _0x5bb186[_0x3c8c('0x1a')](_0x1bae84)[_0x3c8c('0x1b')](_0x3d6fa7);}};}function respondWithFilteredResult(_0x4b730e,_0x4440f4){return function(_0xb2ff0f){if(_0xb2ff0f){var _0x137284=_0xb2ff0f[_0x3c8c('0x1c')],_0x272438=_0x4440f4[_0x3c8c('0x1d')],_0x2da9ba=_0x4440f4['offset']+_0x4440f4[_0x3c8c('0x1e')],_0x53aa06;if(_0x2da9ba>=_0x137284){_0x2da9ba=_0x137284;_0x53aa06=0xc8;}else{_0x53aa06=0xce;}_0x4b730e['status'](_0x53aa06);return _0x4b730e[_0x3c8c('0x1f')](_0x3c8c('0x20'),_0x272438+'-'+_0x2da9ba+'/'+_0x137284)[_0x3c8c('0x1b')](_0xb2ff0f);}return null;};}function patchUpdates(_0x33fc65){return function(_0x15e2f5){try{jsonpatch[_0x3c8c('0x21')](_0x15e2f5,_0x33fc65,!![]);}catch(_0x1186fd){return BPromise[_0x3c8c('0x22')](_0x1186fd);}return _0x15e2f5[_0x3c8c('0x23')]();};}function saveUpdates(_0x41f528,_0xe3749e){return function(_0x29056c){if(_0x29056c){return _0x29056c[_0x3c8c('0x24')](_0x41f528)[_0x3c8c('0x25')](function(_0x526d76){return _0x526d76;});}return null;};}function removeEntity(_0x90cfc4,_0x5619dc){return function(_0x5bfb0d){if(_0x5bfb0d){return _0x5bfb0d[_0x3c8c('0x26')]()[_0x3c8c('0x25')](function(){_0x90cfc4['status'](0xcc)[_0x3c8c('0x27')]();});}};}function handleEntityNotFound(_0x334665,_0x551bba){return function(_0xfd9ee1){if(!_0xfd9ee1){_0x334665[_0x3c8c('0x19')](0x194);}return _0xfd9ee1;};}function handleError(_0x465446,_0x7cbc8a){_0x7cbc8a=_0x7cbc8a||0x1f4;return function(_0x3d5134){logger[_0x3c8c('0x28')](_0x3d5134[_0x3c8c('0x29')]);if(_0x3d5134['name']){delete _0x3d5134[_0x3c8c('0x2a')];}_0x465446[_0x3c8c('0x1a')](_0x7cbc8a)[_0x3c8c('0x2b')](_0x3d5134);};}exports['index']=function(_0x351ba4,_0x2e4607){var _0x37bdd6={},_0x502956={},_0x300199={'count':0x0,'rows':[]};var _0x53815a=_['map'](db[_0x3c8c('0x2c')]['rawAttributes'],function(_0x334188){return{'name':_0x334188[_0x3c8c('0x2d')],'type':_0x334188[_0x3c8c('0x2e')][_0x3c8c('0x2f')]};});_0x502956[_0x3c8c('0x30')]=_[_0x3c8c('0x31')](_0x53815a,'name');_0x502956[_0x3c8c('0x32')]=_[_0x3c8c('0x33')](_0x351ba4[_0x3c8c('0x32')]);_0x502956[_0x3c8c('0x34')]=_['intersection'](_0x502956[_0x3c8c('0x30')],_0x502956[_0x3c8c('0x32')]);_0x37bdd6[_0x3c8c('0x35')]=_[_0x3c8c('0x36')](_0x502956['model'],qs[_0x3c8c('0x37')](_0x351ba4[_0x3c8c('0x32')]['fields']));_0x37bdd6['attributes']=_0x37bdd6['attributes'][_0x3c8c('0x38')]?_0x37bdd6[_0x3c8c('0x35')]:_0x502956[_0x3c8c('0x30')];if(!_0x351ba4['query'][_0x3c8c('0x39')](_0x3c8c('0x3a'))){_0x37bdd6['limit']=qs[_0x3c8c('0x1e')](_0x351ba4['query']['limit']);_0x37bdd6[_0x3c8c('0x1d')]=qs[_0x3c8c('0x1d')](_0x351ba4[_0x3c8c('0x32')]['offset']);}_0x37bdd6['order']=qs['sort'](_0x351ba4[_0x3c8c('0x32')][_0x3c8c('0x3b')]);_0x37bdd6['where']=qs[_0x3c8c('0x34')](_[_0x3c8c('0x3c')](_0x351ba4['query'],_0x502956['filters']),_0x53815a);if(_0x351ba4[_0x3c8c('0x32')][_0x3c8c('0x3d')]){_0x37bdd6[_0x3c8c('0x3e')]=_['merge'](_0x37bdd6[_0x3c8c('0x3e')],{'$or':_[_0x3c8c('0x31')](_0x53815a,function(_0x41aa55){if(_0x41aa55['type']!==_0x3c8c('0x3f')){var _0x1a42a7={};_0x1a42a7[_0x41aa55[_0x3c8c('0x2a')]]={'$like':'%'+_0x351ba4[_0x3c8c('0x32')]['filter']+'%'};return _0x1a42a7;}})});}_0x37bdd6=_['merge']({},_0x37bdd6,_0x351ba4[_0x3c8c('0x40')]);var _0x123ffc={'where':_0x37bdd6['where']};return db['MemberReport']['count'](_0x123ffc)[_0x3c8c('0x25')](function(_0x467069){_0x300199['count']=_0x467069;if(_0x351ba4[_0x3c8c('0x32')][_0x3c8c('0x41')]){_0x37bdd6[_0x3c8c('0x42')]=[{'all':!![]}];}return db[_0x3c8c('0x2c')]['findAll'](_0x37bdd6);})[_0x3c8c('0x25')](function(_0x5400e3){_0x300199[_0x3c8c('0x43')]=_0x5400e3;return _0x300199;})[_0x3c8c('0x25')](respondWithFilteredResult(_0x2e4607,_0x37bdd6))[_0x3c8c('0x44')](handleError(_0x2e4607,null));};exports[_0x3c8c('0x45')]=function(_0x23cc9e,_0x2ffc39){var _0xd60e70={'raw':!![],'where':{'id':_0x23cc9e['params']['id']}},_0x41df7b={};_0x41df7b['model']=_[_0x3c8c('0x33')](db[_0x3c8c('0x2c')]['rawAttributes']);_0x41df7b[_0x3c8c('0x32')]=_[_0x3c8c('0x33')](_0x23cc9e['query']);_0x41df7b['filters']=_[_0x3c8c('0x36')](_0x41df7b[_0x3c8c('0x30')],_0x41df7b[_0x3c8c('0x32')]);_0xd60e70['attributes']=_[_0x3c8c('0x36')](_0x41df7b[_0x3c8c('0x30')],qs['fields'](_0x23cc9e['query'][_0x3c8c('0x37')]));_0xd60e70[_0x3c8c('0x35')]=_0xd60e70[_0x3c8c('0x35')][_0x3c8c('0x38')]?_0xd60e70[_0x3c8c('0x35')]:_0x41df7b[_0x3c8c('0x30')];if(_0x23cc9e[_0x3c8c('0x32')][_0x3c8c('0x41')]){_0xd60e70['include']=[{'all':!![]}];}_0xd60e70=_[_0x3c8c('0x46')]({},_0xd60e70,_0x23cc9e['options']);return db[_0x3c8c('0x2c')][_0x3c8c('0x47')](_0xd60e70)[_0x3c8c('0x25')](handleEntityNotFound(_0x2ffc39,null))[_0x3c8c('0x25')](respondWithResult(_0x2ffc39,null))[_0x3c8c('0x44')](handleError(_0x2ffc39,null));};exports[_0x3c8c('0x48')]=function(_0x111f81,_0x2daee9){return db[_0x3c8c('0x2c')][_0x3c8c('0x48')](_0x111f81[_0x3c8c('0x49')],{})['then'](respondWithResult(_0x2daee9,0xc9))[_0x3c8c('0x44')](handleError(_0x2daee9,null));};exports[_0x3c8c('0x24')]=function(_0x1f3c87,_0x482797){if(_0x1f3c87[_0x3c8c('0x49')]['id']){delete _0x1f3c87[_0x3c8c('0x49')]['id'];}return db[_0x3c8c('0x2c')][_0x3c8c('0x47')]({'where':{'id':_0x1f3c87[_0x3c8c('0x4a')]['id']}})[_0x3c8c('0x25')](handleEntityNotFound(_0x482797,null))[_0x3c8c('0x25')](saveUpdates(_0x1f3c87[_0x3c8c('0x49')],null))[_0x3c8c('0x25')](respondWithResult(_0x482797,null))['catch'](handleError(_0x482797,null));};exports[_0x3c8c('0x26')]=function(_0x430567,_0x407835){return db[_0x3c8c('0x2c')][_0x3c8c('0x47')]({'where':{'id':_0x430567[_0x3c8c('0x4a')]['id']}})[_0x3c8c('0x25')](handleEntityNotFound(_0x407835,null))[_0x3c8c('0x25')](removeEntity(_0x407835,null))[_0x3c8c('0x44')](handleError(_0x407835,null));};exports[_0x3c8c('0x4b')]=function(_0x14652f,_0x135314){return db[_0x3c8c('0x2c')][_0x3c8c('0x4b')]()['then'](respondWithResult(_0x135314,null))[_0x3c8c('0x44')](handleError(_0x135314,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 87dd070..be7af7b 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 _0xdc63=['path','rimraf','../../config/environment','define','MemberReport','report_member','membername_interface','membername','api','moment','bluebird','request-promise'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0xdc63,0xbc));var _0x3dc6=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xdc63[_0x82129b];return _0x2ae5dc;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3dc6('0x0'));var moment=require(_0x3dc6('0x1'));var BPromise=require(_0x3dc6('0x2'));var rp=require(_0x3dc6('0x3'));var fs=require('fs');var path=require(_0x3dc6('0x4'));var rimraf=require(_0x3dc6('0x5'));var config=require(_0x3dc6('0x6'));var attributes=require('./memberReport.attributes');module['exports']=function(_0x35b85b,_0x56e325){return _0x35b85b[_0x3dc6('0x7')](_0x3dc6('0x8'),attributes,{'tableName':_0x3dc6('0x9'),'paranoid':![],'indexes':[{'name':_0x3dc6('0xa'),'fields':[_0x3dc6('0xb'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x28db=['MemberReport','membername_interface','interface','lodash','util','bluebird','request-promise','path','rimraf','./memberReport.attributes','exports','define'];(function(_0x401769,_0x902239){var _0x5696af=function(_0x5bf4ce){while(--_0x5bf4ce){_0x401769['push'](_0x401769['shift']());}};_0x5696af(++_0x902239);}(_0x28db,0x183));var _0xb28d=function(_0x2f30f6,_0x213c08){_0x2f30f6=_0x2f30f6-0x0;var _0x103921=_0x28db[_0x2f30f6];return _0x103921;};'use strict';var _=require(_0xb28d('0x0'));var util=require(_0xb28d('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb28d('0x2'));var rp=require(_0xb28d('0x3'));var fs=require('fs');var path=require(_0xb28d('0x4'));var rimraf=require(_0xb28d('0x5'));var config=require('../../config/environment');var attributes=require(_0xb28d('0x6'));module[_0xb28d('0x7')]=function(_0x4da999,_0xb09a10){return _0x4da999[_0xb28d('0x8')](_0xb28d('0x9'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xb28d('0xa'),'fields':['membername',_0xb28d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index bcfc7c8..393ec30 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 _0xe596=['stringify','error','code','message','result','catch','GetMemberReport','MemberReport','raw','options','where','attributes','include','map','model','CreateMemberReport','create','body','UpdateMemberReport','update','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x503d28,_0x2f7b19){var _0x45d14b=function(_0x3b3064){while(--_0x3b3064){_0x503d28['push'](_0x503d28['shift']());}};_0x45d14b(++_0x2f7b19);}(_0xe596,0x80));var _0x6e59=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xe596[_0x599f41];return _0x2e4d58;};'use strict';var _=require('lodash');var util=require(_0x6e59('0x0'));var moment=require(_0x6e59('0x1'));var BPromise=require(_0x6e59('0x2'));var rs=require(_0x6e59('0x3'));var fs=require('fs');var Redis=require(_0x6e59('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6e59('0x5'));var logger=require('../../config/logger')(_0x6e59('0x6'));var config=require('../../config/environment');var jayson=require(_0x6e59('0x7'));var client=jayson[_0x6e59('0x8')][_0x6e59('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe49d65,_0x323879,_0x530c5){return new BPromise(function(_0x180721,_0x43c474){return client['request'](_0xe49d65,_0x530c5)[_0x6e59('0xa')](function(_0x14a097){logger[_0x6e59('0xb')](_0x6e59('0xc'),_0x323879,'request\x20sent');logger[_0x6e59('0xd')](_0x6e59('0xe'),_0x323879,_0x6e59('0xf'),JSON[_0x6e59('0x10')](_0x14a097));if(_0x14a097['error']){if(_0x14a097[_0x6e59('0x11')][_0x6e59('0x12')]===0x1f4){logger[_0x6e59('0x11')](_0x6e59('0xc'),_0x323879,_0x14a097[_0x6e59('0x11')]['message']);return _0x43c474(_0x14a097[_0x6e59('0x11')][_0x6e59('0x13')]);}logger[_0x6e59('0x11')](_0x6e59('0xc'),_0x323879,_0x14a097['error'][_0x6e59('0x13')]);return _0x180721(_0x14a097[_0x6e59('0x11')]['message']);}else{logger['info'](_0x6e59('0xc'),_0x323879,'request\x20sent');_0x180721(_0x14a097[_0x6e59('0x14')][_0x6e59('0x13')]);}})[_0x6e59('0x15')](function(_0x564970){logger['error'](_0x6e59('0xc'),_0x323879,_0x564970);_0x43c474(_0x564970);});});}exports[_0x6e59('0x16')]=function(_0x228ccd){var _0x596411=this;return new Promise(function(_0x206055,_0x36e051){return db[_0x6e59('0x17')]['findAll']({'raw':_0x228ccd['options']?_0x228ccd['options'][_0x6e59('0x18')]===undefined?!![]:![]:!![],'where':_0x228ccd[_0x6e59('0x19')]?_0x228ccd[_0x6e59('0x19')][_0x6e59('0x1a')]||null:null,'attributes':_0x228ccd[_0x6e59('0x19')]?_0x228ccd[_0x6e59('0x19')][_0x6e59('0x1b')]||null:null,'limit':_0x228ccd[_0x6e59('0x19')]?_0x228ccd[_0x6e59('0x19')]['limit']||null:null,'include':_0x228ccd['options']?_0x228ccd[_0x6e59('0x19')][_0x6e59('0x1c')]?_[_0x6e59('0x1d')](_0x228ccd[_0x6e59('0x19')][_0x6e59('0x1c')],function(_0x35b4b1){return{'model':db[_0x35b4b1['model']],'as':_0x35b4b1['as'],'attributes':_0x35b4b1[_0x6e59('0x1b')],'include':_0x35b4b1[_0x6e59('0x1c')]?_[_0x6e59('0x1d')](_0x35b4b1[_0x6e59('0x1c')],function(_0x28824a){return{'model':db[_0x28824a['model']],'as':_0x28824a['as'],'attributes':_0x28824a[_0x6e59('0x1b')],'include':_0x28824a[_0x6e59('0x1c')]?_[_0x6e59('0x1d')](_0x28824a[_0x6e59('0x1c')],function(_0xb6af15){return{'model':db[_0xb6af15[_0x6e59('0x1e')]],'as':_0xb6af15['as'],'attributes':_0xb6af15[_0x6e59('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5de4c7){logger[_0x6e59('0xb')]('GetMemberReport',_0x228ccd);logger[_0x6e59('0xd')](_0x6e59('0x16'),_0x228ccd,JSON[_0x6e59('0x10')](_0x5de4c7));_0x206055(_0x5de4c7);})[_0x6e59('0x15')](function(_0x16ef7e){logger[_0x6e59('0x11')](_0x6e59('0x16'),_0x16ef7e['message'],_0x228ccd);_0x36e051(_0x596411[_0x6e59('0x11')](0x1f4,_0x16ef7e[_0x6e59('0x13')]));});});};exports[_0x6e59('0x1f')]=function(_0x2b5e6a){var _0x41cf92=this;return new Promise(function(_0x5886b8,_0x2e9056){return db[_0x6e59('0x17')][_0x6e59('0x20')](_0x2b5e6a[_0x6e59('0x21')],{'raw':_0x2b5e6a[_0x6e59('0x19')]?_0x2b5e6a[_0x6e59('0x19')][_0x6e59('0x18')]===undefined?!![]:![]:!![]})[_0x6e59('0xa')](function(_0x2328d1){logger[_0x6e59('0xb')]('CreateMemberReport',_0x2b5e6a);logger['debug']('CreateMemberReport',_0x2b5e6a,JSON[_0x6e59('0x10')](_0x2328d1));_0x5886b8(_0x2328d1);})[_0x6e59('0x15')](function(_0x41873e){logger['error'](_0x6e59('0x1f'),_0x41873e['message'],_0x2b5e6a);_0x2e9056(_0x41cf92[_0x6e59('0x11')](0x1f4,_0x41873e[_0x6e59('0x13')]));});});};exports[_0x6e59('0x22')]=function(_0x4d062d){var _0x41828d=this;return new Promise(function(_0x33fac6,_0x1a325b){return db[_0x6e59('0x17')][_0x6e59('0x23')](_0x4d062d[_0x6e59('0x21')],{'raw':_0x4d062d['options']?_0x4d062d['options'][_0x6e59('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d062d[_0x6e59('0x19')]?_0x4d062d[_0x6e59('0x19')]['where']||null:null,'attributes':_0x4d062d[_0x6e59('0x19')]?_0x4d062d[_0x6e59('0x19')]['attributes']||null:null,'limit':_0x4d062d[_0x6e59('0x19')]?_0x4d062d[_0x6e59('0x19')]['limit']||null:null})[_0x6e59('0xa')](function(_0x4146df){logger['info'](_0x6e59('0x22'),_0x4d062d);logger[_0x6e59('0xd')](_0x6e59('0x22'),_0x4d062d,JSON[_0x6e59('0x10')](_0x4146df));_0x33fac6(_0x4146df);})[_0x6e59('0x15')](function(_0x3be3a8){logger['error'](_0x6e59('0x22'),_0x3be3a8['message'],_0x4d062d);_0x1a325b(_0x41828d[_0x6e59('0x11')](0x1f4,_0x3be3a8['message']));});});}; \ No newline at end of file +var _0xe3cc=['http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','debug','create','body','CreateMemberReport','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client'];(function(_0x25a39d,_0x300b05){var _0x56a0ad=function(_0x55f620){while(--_0x55f620){_0x25a39d['push'](_0x25a39d['shift']());}};_0x56a0ad(++_0x300b05);}(_0xe3cc,0x172));var _0xce3c=function(_0x5d8ae3,_0x472200){_0x5d8ae3=_0x5d8ae3-0x0;var _0x364fc7=_0xe3cc[_0x5d8ae3];return _0x364fc7;};'use strict';var _=require(_0xce3c('0x0'));var util=require(_0xce3c('0x1'));var moment=require(_0xce3c('0x2'));var BPromise=require(_0xce3c('0x3'));var rs=require(_0xce3c('0x4'));var fs=require('fs');var Redis=require(_0xce3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xce3c('0x6'));var logger=require(_0xce3c('0x7'))(_0xce3c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xce3c('0x9')][_0xce3c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x514737,_0x25a372,_0x482908){return new BPromise(function(_0x5dae9b,_0x542f59){return client[_0xce3c('0xb')](_0x514737,_0x482908)[_0xce3c('0xc')](function(_0x22b70f){logger['info'](_0xce3c('0xd'),_0x25a372,_0xce3c('0xe'));logger['debug'](_0xce3c('0xf'),_0x25a372,'request\x20sent',JSON[_0xce3c('0x10')](_0x22b70f));if(_0x22b70f[_0xce3c('0x11')]){if(_0x22b70f[_0xce3c('0x11')]['code']===0x1f4){logger[_0xce3c('0x11')]('MemberReport,\x20%s,\x20%s',_0x25a372,_0x22b70f[_0xce3c('0x11')]['message']);return _0x542f59(_0x22b70f[_0xce3c('0x11')][_0xce3c('0x12')]);}logger[_0xce3c('0x11')](_0xce3c('0xd'),_0x25a372,_0x22b70f[_0xce3c('0x11')][_0xce3c('0x12')]);return _0x5dae9b(_0x22b70f[_0xce3c('0x11')][_0xce3c('0x12')]);}else{logger[_0xce3c('0x13')](_0xce3c('0xd'),_0x25a372,_0xce3c('0xe'));_0x5dae9b(_0x22b70f[_0xce3c('0x14')][_0xce3c('0x12')]);}})[_0xce3c('0x15')](function(_0x19ca60){logger['error'](_0xce3c('0xd'),_0x25a372,_0x19ca60);_0x542f59(_0x19ca60);});});}exports[_0xce3c('0x16')]=function(_0x14b061){var _0x253ea9=this;return new Promise(function(_0x44d361,_0x586d94){return db[_0xce3c('0x17')][_0xce3c('0x18')]({'raw':_0x14b061[_0xce3c('0x19')]?_0x14b061[_0xce3c('0x19')][_0xce3c('0x1a')]===undefined?!![]:![]:!![],'where':_0x14b061[_0xce3c('0x19')]?_0x14b061[_0xce3c('0x19')][_0xce3c('0x1b')]||null:null,'attributes':_0x14b061[_0xce3c('0x19')]?_0x14b061[_0xce3c('0x19')][_0xce3c('0x1c')]||null:null,'limit':_0x14b061[_0xce3c('0x19')]?_0x14b061[_0xce3c('0x19')][_0xce3c('0x1d')]||null:null,'include':_0x14b061[_0xce3c('0x19')]?_0x14b061[_0xce3c('0x19')][_0xce3c('0x1e')]?_[_0xce3c('0x1f')](_0x14b061['options'][_0xce3c('0x1e')],function(_0x4b9cb3){return{'model':db[_0x4b9cb3[_0xce3c('0x20')]],'as':_0x4b9cb3['as'],'attributes':_0x4b9cb3[_0xce3c('0x1c')],'include':_0x4b9cb3[_0xce3c('0x1e')]?_[_0xce3c('0x1f')](_0x4b9cb3[_0xce3c('0x1e')],function(_0x4e3b83){return{'model':db[_0x4e3b83[_0xce3c('0x20')]],'as':_0x4e3b83['as'],'attributes':_0x4e3b83[_0xce3c('0x1c')],'include':_0x4e3b83['include']?_[_0xce3c('0x1f')](_0x4e3b83[_0xce3c('0x1e')],function(_0x27d859){return{'model':db[_0x27d859['model']],'as':_0x27d859['as'],'attributes':_0x27d859[_0xce3c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xce3c('0xc')](function(_0x39876f){logger[_0xce3c('0x13')](_0xce3c('0x16'),_0x14b061);logger[_0xce3c('0x21')](_0xce3c('0x16'),_0x14b061,JSON['stringify'](_0x39876f));_0x44d361(_0x39876f);})[_0xce3c('0x15')](function(_0x484250){logger[_0xce3c('0x11')]('GetMemberReport',_0x484250['message'],_0x14b061);_0x586d94(_0x253ea9[_0xce3c('0x11')](0x1f4,_0x484250[_0xce3c('0x12')]));});});};exports['CreateMemberReport']=function(_0x5cd5e5){var _0x5613b8=this;return new Promise(function(_0x514caa,_0x2b69cd){return db['MemberReport'][_0xce3c('0x22')](_0x5cd5e5[_0xce3c('0x23')],{'raw':_0x5cd5e5['options']?_0x5cd5e5[_0xce3c('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xce3c('0xc')](function(_0x1c9fd5){logger['info'](_0xce3c('0x24'),_0x5cd5e5);logger[_0xce3c('0x21')](_0xce3c('0x24'),_0x5cd5e5,JSON[_0xce3c('0x10')](_0x1c9fd5));_0x514caa(_0x1c9fd5);})['catch'](function(_0x4f63e6){logger[_0xce3c('0x11')](_0xce3c('0x24'),_0x4f63e6[_0xce3c('0x12')],_0x5cd5e5);_0x2b69cd(_0x5613b8[_0xce3c('0x11')](0x1f4,_0x4f63e6['message']));});});};exports[_0xce3c('0x25')]=function(_0x4c3194){var _0x439996=this;return new Promise(function(_0x4637b9,_0x145760){return db[_0xce3c('0x17')]['update'](_0x4c3194['body'],{'raw':_0x4c3194['options']?_0x4c3194[_0xce3c('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c3194['options']?_0x4c3194[_0xce3c('0x19')][_0xce3c('0x1b')]||null:null,'attributes':_0x4c3194['options']?_0x4c3194[_0xce3c('0x19')][_0xce3c('0x1c')]||null:null,'limit':_0x4c3194[_0xce3c('0x19')]?_0x4c3194[_0xce3c('0x19')][_0xce3c('0x1d')]||null:null})[_0xce3c('0xc')](function(_0x2280e8){logger[_0xce3c('0x13')](_0xce3c('0x25'),_0x4c3194);logger[_0xce3c('0x21')]('UpdateMemberReport',_0x4c3194,JSON[_0xce3c('0x10')](_0x2280e8));_0x4637b9(_0x2280e8);})[_0xce3c('0x15')](function(_0x3f16fc){logger[_0xce3c('0x11')](_0xce3c('0x25'),_0x3f16fc[_0xce3c('0x12')],_0x4c3194);_0x145760(_0x439996[_0xce3c('0x11')](0x1f4,_0x3f16fc[_0xce3c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 779b0fa..eac9e16 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 _0xf006=['../../components/auth/service','./migration.controller','get','index','path','connect-timeout','Router'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0xf006,0x146));var _0x6f00=function(_0x44a169,_0x28609d){_0x44a169=_0x44a169-0x0;var _0x7022c1=_0xf006[_0x44a169];return _0x7022c1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6f00('0x0'));var timeout=require(_0x6f00('0x1'));var express=require('express');var router=express[_0x6f00('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6f00('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6f00('0x4'));router[_0x6f00('0x5')]('/',controller[_0x6f00('0x6')]);module['exports']=router; \ No newline at end of file +var _0x0c02=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x20c0('0x0'));var path=require(_0x20c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x20c0('0x2'));var router=express[_0x20c0('0x3')]();var fs_extra=require(_0x20c0('0x4'));var auth=require(_0x20c0('0x5'));var interaction=require(_0x20c0('0x6'));var config=require(_0x20c0('0x7'));var controller=require(_0x20c0('0x8'));router[_0x20c0('0x9')]('/',controller[_0x20c0('0xa')]);module[_0x20c0('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index c3f9a3a..c8f51e9 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 _0x0f87=['version'];(function(_0x1c3f44,_0x3b9db4){var _0x1bc285=function(_0x4f1781){while(--_0x4f1781){_0x1c3f44['push'](_0x1c3f44['shift']());}};_0x1bc285(++_0x3b9db4);}(_0x0f87,0x90));var _0x70f8=function(_0x576359,_0x17b0a1){_0x576359=_0x576359-0x0;var _0x531a89=_0x0f87[_0x576359];return _0x531a89;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0x70f8('0x0')}}; \ No newline at end of file +var _0x14d8=['version','sequelize','STRING'];(function(_0x5dd4f4,_0x386f43){var _0x2f05b1=function(_0x3954a4){while(--_0x3954a4){_0x5dd4f4['push'](_0x5dd4f4['shift']());}};_0x2f05b1(++_0x386f43);}(_0x14d8,0x190));var _0x814d=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x14d8[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0x814d('0x0'));module['exports']={'version':{'type':Sequelize[_0x814d('0x1')],'unique':_0x814d('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 6eb3d5d..fe9e70b 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 _0xca12=['include','findAll','rows','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','index','map','Migration','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll'];(function(_0x3736e1,_0x418664){var _0x17dcee=function(_0x403cd9){while(--_0x403cd9){_0x3736e1['push'](_0x3736e1['shift']());}};_0x17dcee(++_0x418664);}(_0xca12,0x139));var _0x2ca1=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xca12[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2ca1('0x0'));var jsonpatch=require(_0x2ca1('0x1'));var rp=require(_0x2ca1('0x2'));var moment=require(_0x2ca1('0x3'));var BPromise=require(_0x2ca1('0x4'));var Mustache=require(_0x2ca1('0x5'));var util=require(_0x2ca1('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2ca1('0x7'));var fs=require('fs');var fs_extra=require(_0x2ca1('0x8'));var _=require(_0x2ca1('0x9'));var squel=require(_0x2ca1('0xa'));var crypto=require(_0x2ca1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2ca1('0xc'));var toCsv=require(_0x2ca1('0xd'));var querystring=require(_0x2ca1('0xe'));var Papa=require(_0x2ca1('0xf'));var Redis=require('ioredis');var authService=require(_0x2ca1('0x10'));var qs=require(_0x2ca1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ca1('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x2ca1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2ca1('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e6701,_0x12ea55){_0x12ea55=_0x12ea55||0xcc;return function(_0x206d00){if(_0x206d00){return _0x4e6701['sendStatus'](_0x12ea55);}return _0x4e6701[_0x2ca1('0x15')](_0x12ea55)[_0x2ca1('0x16')]();};}function respondWithResult(_0x289c8b,_0x23eb8b){_0x23eb8b=_0x23eb8b||0xc8;return function(_0x4615a4){if(_0x4615a4){return _0x289c8b[_0x2ca1('0x15')](_0x23eb8b)[_0x2ca1('0x17')](_0x4615a4);}};}function respondWithFilteredResult(_0x1d5f1e,_0x57c4ce){return function(_0xc1b26a){if(_0xc1b26a){var _0xddc75f=_0xc1b26a[_0x2ca1('0x18')],_0x8d7a83=_0x57c4ce[_0x2ca1('0x19')],_0x3b247e=_0x57c4ce['offset']+_0x57c4ce[_0x2ca1('0x1a')],_0x561039;if(_0x3b247e>=_0xddc75f){_0x3b247e=_0xddc75f;_0x561039=0xc8;}else{_0x561039=0xce;}_0x1d5f1e[_0x2ca1('0x15')](_0x561039);return _0x1d5f1e[_0x2ca1('0x1b')](_0x2ca1('0x1c'),_0x8d7a83+'-'+_0x3b247e+'/'+_0xddc75f)[_0x2ca1('0x17')](_0xc1b26a);}return null;};}function patchUpdates(_0x3660bc){return function(_0x250f4d){try{jsonpatch[_0x2ca1('0x1d')](_0x250f4d,_0x3660bc,!![]);}catch(_0x18f580){return BPromise[_0x2ca1('0x1e')](_0x18f580);}return _0x250f4d['save']();};}function saveUpdates(_0x4e2a56,_0x3bc476){return function(_0x651621){if(_0x651621){return _0x651621[_0x2ca1('0x1f')](_0x4e2a56)[_0x2ca1('0x20')](function(_0x413292){return _0x413292;});}return null;};}function removeEntity(_0x26bd7d,_0xa265da){return function(_0x34bdb9){if(_0x34bdb9){return _0x34bdb9['destroy']()[_0x2ca1('0x20')](function(){_0x26bd7d[_0x2ca1('0x15')](0xcc)[_0x2ca1('0x16')]();});}};}function handleEntityNotFound(_0x3fd2cc,_0x5f5c05){return function(_0x4c55f2){if(!_0x4c55f2){_0x3fd2cc[_0x2ca1('0x21')](0x194);}return _0x4c55f2;};}function handleError(_0x2e4718,_0x1b199e){_0x1b199e=_0x1b199e||0x1f4;return function(_0x13b190){logger[_0x2ca1('0x22')](_0x13b190[_0x2ca1('0x23')]);if(_0x13b190[_0x2ca1('0x24')]){delete _0x13b190[_0x2ca1('0x24')];}_0x2e4718[_0x2ca1('0x15')](_0x1b199e)['send'](_0x13b190);};}exports[_0x2ca1('0x25')]=function(_0x32738c,_0x1e2181){var _0x2b4748={},_0x459b08={},_0x2916ca={'count':0x0,'rows':[]};var _0x121a08=_[_0x2ca1('0x26')](db[_0x2ca1('0x27')][_0x2ca1('0x28')],function(_0x31dc2e){return{'name':_0x31dc2e[_0x2ca1('0x29')],'type':_0x31dc2e[_0x2ca1('0x2a')][_0x2ca1('0x2b')]};});_0x459b08['model']=_[_0x2ca1('0x26')](_0x121a08,_0x2ca1('0x24'));_0x459b08['query']=_[_0x2ca1('0x2c')](_0x32738c[_0x2ca1('0x2d')]);_0x459b08[_0x2ca1('0x2e')]=_[_0x2ca1('0x2f')](_0x459b08[_0x2ca1('0x30')],_0x459b08[_0x2ca1('0x2d')]);_0x2b4748[_0x2ca1('0x31')]=_[_0x2ca1('0x2f')](_0x459b08[_0x2ca1('0x30')],qs['fields'](_0x32738c['query'][_0x2ca1('0x32')]));_0x2b4748[_0x2ca1('0x31')]=_0x2b4748[_0x2ca1('0x31')]['length']?_0x2b4748[_0x2ca1('0x31')]:_0x459b08[_0x2ca1('0x30')];if(!_0x32738c[_0x2ca1('0x2d')]['hasOwnProperty'](_0x2ca1('0x33'))){_0x2b4748[_0x2ca1('0x1a')]=qs[_0x2ca1('0x1a')](_0x32738c['query'][_0x2ca1('0x1a')]);_0x2b4748['offset']=qs[_0x2ca1('0x19')](_0x32738c[_0x2ca1('0x2d')][_0x2ca1('0x19')]);}_0x2b4748[_0x2ca1('0x34')]=qs[_0x2ca1('0x35')](_0x32738c[_0x2ca1('0x2d')][_0x2ca1('0x35')]);_0x2b4748[_0x2ca1('0x36')]=qs['filters'](_['pick'](_0x32738c['query'],_0x459b08[_0x2ca1('0x2e')]),_0x121a08);if(_0x32738c['query']['filter']){_0x2b4748[_0x2ca1('0x36')]=_[_0x2ca1('0x37')](_0x2b4748[_0x2ca1('0x36')],{'$or':_[_0x2ca1('0x26')](_0x121a08,function(_0x4cf111){if(_0x4cf111['type']!==_0x2ca1('0x38')){var _0x49956f={};_0x49956f[_0x4cf111[_0x2ca1('0x24')]]={'$like':'%'+_0x32738c[_0x2ca1('0x2d')][_0x2ca1('0x39')]+'%'};return _0x49956f;}})});}_0x2b4748=_[_0x2ca1('0x37')]({},_0x2b4748,_0x32738c['options']);var _0x109753={'where':_0x2b4748[_0x2ca1('0x36')]};return db['Migration'][_0x2ca1('0x18')](_0x109753)[_0x2ca1('0x20')](function(_0x45b57a){_0x2916ca[_0x2ca1('0x18')]=_0x45b57a;if(_0x32738c[_0x2ca1('0x2d')][_0x2ca1('0x3a')]){_0x2b4748[_0x2ca1('0x3b')]=[{'all':!![]}];}return db['Migration'][_0x2ca1('0x3c')](_0x2b4748);})['then'](function(_0x673b5d){_0x2916ca[_0x2ca1('0x3d')]=_0x673b5d;return _0x2916ca;})['then'](respondWithFilteredResult(_0x1e2181,_0x2b4748))['catch'](handleError(_0x1e2181,null));}; \ No newline at end of file +var _0x3f4a=['error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','keys','query','intersection','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','merge','options','includeAll','findAll','rows','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','update','then'];(function(_0x228058,_0x8058a3){var _0x1519b9=function(_0x144688){while(--_0x144688){_0x228058['push'](_0x228058['shift']());}};_0x1519b9(++_0x8058a3);}(_0x3f4a,0xa4));var _0xa3f4=function(_0x20558e,_0xe3dc88){_0x20558e=_0x20558e-0x0;var _0x104854=_0x3f4a[_0x20558e];return _0x104854;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa3f4('0x0'));var zipdir=require(_0xa3f4('0x1'));var jsonpatch=require(_0xa3f4('0x2'));var rp=require(_0xa3f4('0x3'));var moment=require(_0xa3f4('0x4'));var BPromise=require(_0xa3f4('0x5'));var Mustache=require(_0xa3f4('0x6'));var util=require(_0xa3f4('0x7'));var path=require('path');var sox=require(_0xa3f4('0x8'));var csv=require(_0xa3f4('0x9'));var ejs=require(_0xa3f4('0xa'));var fs=require('fs');var fs_extra=require(_0xa3f4('0xb'));var _=require(_0xa3f4('0xc'));var squel=require(_0xa3f4('0xd'));var crypto=require('crypto');var jsforce=require(_0xa3f4('0xe'));var deskjs=require(_0xa3f4('0xf'));var toCsv=require(_0xa3f4('0x9'));var querystring=require('querystring');var Papa=require(_0xa3f4('0x10'));var Redis=require(_0xa3f4('0x11'));var authService=require(_0xa3f4('0x12'));var qs=require(_0xa3f4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa3f4('0x14'));var logger=require(_0xa3f4('0x15'))(_0xa3f4('0x16'));var utils=require(_0xa3f4('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa3f4('0x18'));var db=require(_0xa3f4('0x19'))['db'];function respondWithStatusCode(_0x47fb68,_0x4c206a){_0x4c206a=_0x4c206a||0xcc;return function(_0x260e6d){if(_0x260e6d){return _0x47fb68[_0xa3f4('0x1a')](_0x4c206a);}return _0x47fb68[_0xa3f4('0x1b')](_0x4c206a)[_0xa3f4('0x1c')]();};}function respondWithResult(_0x54e876,_0x104e01){_0x104e01=_0x104e01||0xc8;return function(_0x5bc2d1){if(_0x5bc2d1){return _0x54e876[_0xa3f4('0x1b')](_0x104e01)[_0xa3f4('0x1d')](_0x5bc2d1);}};}function respondWithFilteredResult(_0x5354b1,_0x433b1f){return function(_0x33baaa){if(_0x33baaa){var _0x377e6d=_0x33baaa[_0xa3f4('0x1e')],_0x27fd4f=_0x433b1f[_0xa3f4('0x1f')],_0xa4ea0a=_0x433b1f[_0xa3f4('0x1f')]+_0x433b1f[_0xa3f4('0x20')],_0x4573b3;if(_0xa4ea0a>=_0x377e6d){_0xa4ea0a=_0x377e6d;_0x4573b3=0xc8;}else{_0x4573b3=0xce;}_0x5354b1[_0xa3f4('0x1b')](_0x4573b3);return _0x5354b1[_0xa3f4('0x21')]('Content-Range',_0x27fd4f+'-'+_0xa4ea0a+'/'+_0x377e6d)[_0xa3f4('0x1d')](_0x33baaa);}return null;};}function patchUpdates(_0x104a5b){return function(_0x194899){try{jsonpatch['apply'](_0x194899,_0x104a5b,!![]);}catch(_0x24f859){return BPromise[_0xa3f4('0x22')](_0x24f859);}return _0x194899['save']();};}function saveUpdates(_0x309e90,_0x2a8369){return function(_0x2fff31){if(_0x2fff31){return _0x2fff31[_0xa3f4('0x23')](_0x309e90)[_0xa3f4('0x24')](function(_0x580689){return _0x580689;});}return null;};}function removeEntity(_0x430abf,_0x39312b){return function(_0x86cae5){if(_0x86cae5){return _0x86cae5['destroy']()[_0xa3f4('0x24')](function(){_0x430abf[_0xa3f4('0x1b')](0xcc)[_0xa3f4('0x1c')]();});}};}function handleEntityNotFound(_0x1801eb,_0x1d5bfb){return function(_0xbf1e7c){if(!_0xbf1e7c){_0x1801eb['sendStatus'](0x194);}return _0xbf1e7c;};}function handleError(_0x5d9240,_0x243b15){_0x243b15=_0x243b15||0x1f4;return function(_0x32e582){logger[_0xa3f4('0x25')](_0x32e582[_0xa3f4('0x26')]);if(_0x32e582['name']){delete _0x32e582[_0xa3f4('0x27')];}_0x5d9240[_0xa3f4('0x1b')](_0x243b15)[_0xa3f4('0x28')](_0x32e582);};}exports[_0xa3f4('0x29')]=function(_0x1399ea,_0x51fbe4){var _0x540137={},_0xf3bb2={},_0x466f5a={'count':0x0,'rows':[]};var _0x1724f0=_[_0xa3f4('0x2a')](db[_0xa3f4('0x2b')][_0xa3f4('0x2c')],function(_0x30a133){return{'name':_0x30a133[_0xa3f4('0x2d')],'type':_0x30a133[_0xa3f4('0x2e')][_0xa3f4('0x2f')]};});_0xf3bb2['model']=_[_0xa3f4('0x2a')](_0x1724f0,'name');_0xf3bb2['query']=_[_0xa3f4('0x30')](_0x1399ea[_0xa3f4('0x31')]);_0xf3bb2['filters']=_[_0xa3f4('0x32')](_0xf3bb2[_0xa3f4('0x33')],_0xf3bb2[_0xa3f4('0x31')]);_0x540137['attributes']=_[_0xa3f4('0x32')](_0xf3bb2[_0xa3f4('0x33')],qs[_0xa3f4('0x34')](_0x1399ea[_0xa3f4('0x31')]['fields']));_0x540137[_0xa3f4('0x35')]=_0x540137[_0xa3f4('0x35')][_0xa3f4('0x36')]?_0x540137[_0xa3f4('0x35')]:_0xf3bb2[_0xa3f4('0x33')];if(!_0x1399ea[_0xa3f4('0x31')]['hasOwnProperty'](_0xa3f4('0x37'))){_0x540137[_0xa3f4('0x20')]=qs['limit'](_0x1399ea[_0xa3f4('0x31')]['limit']);_0x540137['offset']=qs[_0xa3f4('0x1f')](_0x1399ea[_0xa3f4('0x31')][_0xa3f4('0x1f')]);}_0x540137[_0xa3f4('0x38')]=qs['sort'](_0x1399ea[_0xa3f4('0x31')][_0xa3f4('0x39')]);_0x540137['where']=qs[_0xa3f4('0x3a')](_['pick'](_0x1399ea[_0xa3f4('0x31')],_0xf3bb2[_0xa3f4('0x3a')]),_0x1724f0);if(_0x1399ea['query'][_0xa3f4('0x3b')]){_0x540137[_0xa3f4('0x3c')]=_['merge'](_0x540137[_0xa3f4('0x3c')],{'$or':_[_0xa3f4('0x2a')](_0x1724f0,function(_0xa96d53){if(_0xa96d53['type']!=='VIRTUAL'){var _0x4190b0={};_0x4190b0[_0xa96d53[_0xa3f4('0x27')]]={'$like':'%'+_0x1399ea[_0xa3f4('0x31')][_0xa3f4('0x3b')]+'%'};return _0x4190b0;}})});}_0x540137=_[_0xa3f4('0x3d')]({},_0x540137,_0x1399ea[_0xa3f4('0x3e')]);var _0x2e7c7c={'where':_0x540137['where']};return db['Migration'][_0xa3f4('0x1e')](_0x2e7c7c)['then'](function(_0x53a312){_0x466f5a['count']=_0x53a312;if(_0x1399ea[_0xa3f4('0x31')][_0xa3f4('0x3f')]){_0x540137['include']=[{'all':!![]}];}return db[_0xa3f4('0x2b')][_0xa3f4('0x40')](_0x540137);})[_0xa3f4('0x24')](function(_0xdfe30e){_0x466f5a[_0xa3f4('0x41')]=_0xdfe30e;return _0x466f5a;})[_0xa3f4('0x24')](respondWithFilteredResult(_0x51fbe4,_0x540137))[_0xa3f4('0x42')](handleError(_0x51fbe4,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index b8c0946..a6f24f1 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 _0x3a49=['exports','define','migrations','lodash','util','path','../../config/environment','./migration.attributes'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x3a49,0xb3));var _0x93a4=function(_0xb7a6da,_0x31457d){_0xb7a6da=_0xb7a6da-0x0;var _0x1fb425=_0x3a49[_0xb7a6da];return _0x1fb425;};'use strict';var _=require(_0x93a4('0x0'));var util=require(_0x93a4('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x93a4('0x2'));var rimraf=require('rimraf');var config=require(_0x93a4('0x3'));var attributes=require(_0x93a4('0x4'));module[_0x93a4('0x5')]=function(_0x57e787,_0xa9654b){return _0x57e787[_0x93a4('0x6')]('Migration',attributes,{'tableName':_0x93a4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff24=['define','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./migration.attributes','exports'];(function(_0x1d871d,_0x3e64b9){var _0x1bbb2b=function(_0x1d6779){while(--_0x1d6779){_0x1d871d['push'](_0x1d871d['shift']());}};_0x1bbb2b(++_0x3e64b9);}(_0xff24,0x109));var _0x4ff2=function(_0x2db1fc,_0xfe0d93){_0x2db1fc=_0x2db1fc-0x0;var _0xa41aef=_0xff24[_0x2db1fc];return _0xa41aef;};'use strict';var _=require(_0x4ff2('0x0'));var util=require('util');var logger=require(_0x4ff2('0x1'))(_0x4ff2('0x2'));var moment=require(_0x4ff2('0x3'));var BPromise=require(_0x4ff2('0x4'));var rp=require(_0x4ff2('0x5'));var fs=require('fs');var path=require(_0x4ff2('0x6'));var rimraf=require(_0x4ff2('0x7'));var config=require('../../config/environment');var attributes=require(_0x4ff2('0x8'));module[_0x4ff2('0x9')]=function(_0x475977,_0xeb1399){return _0x475977[_0x4ff2('0xa')]('Migration',attributes,{'tableName':'migrations','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 60e0d1c..0d1d117 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 _0xcd1c=['request\x20sent','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Migration,\x20%s,\x20%s','debug'];(function(_0x18730a,_0x39e7e6){var _0x5b2ff1=function(_0x2358b5){while(--_0x2358b5){_0x18730a['push'](_0x18730a['shift']());}};_0x5b2ff1(++_0x39e7e6);}(_0xcd1c,0x125));var _0xccd1=function(_0x94e2e8,_0x45447a){_0x94e2e8=_0x94e2e8-0x0;var _0x2a6fcb=_0xcd1c[_0x94e2e8];return _0x2a6fcb;};'use strict';var _=require('lodash');var util=require(_0xccd1('0x0'));var moment=require('moment');var BPromise=require(_0xccd1('0x1'));var rs=require(_0xccd1('0x2'));var fs=require('fs');var Redis=require(_0xccd1('0x3'));var db=require(_0xccd1('0x4'))['db'];var utils=require(_0xccd1('0x5'));var logger=require(_0xccd1('0x6'))('rpc');var config=require(_0xccd1('0x7'));var jayson=require(_0xccd1('0x8'));var client=jayson['client'][_0xccd1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51d46a,_0x2bbdbc,_0x2548a4){return new BPromise(function(_0x1a2577,_0x432fcb){return client[_0xccd1('0xa')](_0x51d46a,_0x2548a4)[_0xccd1('0xb')](function(_0x5ea178){logger[_0xccd1('0xc')](_0xccd1('0xd'),_0x2bbdbc,'request\x20sent');logger[_0xccd1('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0x2bbdbc,_0xccd1('0xf'),JSON[_0xccd1('0x10')](_0x5ea178));if(_0x5ea178[_0xccd1('0x11')]){if(_0x5ea178[_0xccd1('0x11')][_0xccd1('0x12')]===0x1f4){logger[_0xccd1('0x11')]('Migration,\x20%s,\x20%s',_0x2bbdbc,_0x5ea178['error'][_0xccd1('0x13')]);return _0x432fcb(_0x5ea178[_0xccd1('0x11')][_0xccd1('0x13')]);}logger[_0xccd1('0x11')](_0xccd1('0xd'),_0x2bbdbc,_0x5ea178[_0xccd1('0x11')][_0xccd1('0x13')]);return _0x1a2577(_0x5ea178[_0xccd1('0x11')][_0xccd1('0x13')]);}else{logger[_0xccd1('0xc')](_0xccd1('0xd'),_0x2bbdbc,_0xccd1('0xf'));_0x1a2577(_0x5ea178[_0xccd1('0x14')][_0xccd1('0x13')]);}})[_0xccd1('0x15')](function(_0x3eef86){logger[_0xccd1('0x11')](_0xccd1('0xd'),_0x2bbdbc,_0x3eef86);_0x432fcb(_0x3eef86);});});} \ No newline at end of file +var _0x8d9e=['../../config/environment','client','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x515be2,_0x51b3ff){var _0x514679=function(_0x562c51){while(--_0x562c51){_0x515be2['push'](_0x515be2['shift']());}};_0x514679(++_0x51b3ff);}(_0x8d9e,0x150));var _0xe8d9=function(_0x53cf86,_0x56b23){_0x53cf86=_0x53cf86-0x0;var _0x172367=_0x8d9e[_0x53cf86];return _0x172367;};'use strict';var _=require(_0xe8d9('0x0'));var util=require(_0xe8d9('0x1'));var moment=require(_0xe8d9('0x2'));var BPromise=require('bluebird');var rs=require(_0xe8d9('0x3'));var fs=require('fs');var Redis=require(_0xe8d9('0x4'));var db=require(_0xe8d9('0x5'))['db'];var utils=require(_0xe8d9('0x6'));var logger=require(_0xe8d9('0x7'))(_0xe8d9('0x8'));var config=require(_0xe8d9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe8d9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5576b9,_0x128c15,_0x18950a){return new BPromise(function(_0x17d39f,_0x57ee77){return client['request'](_0x5576b9,_0x18950a)[_0xe8d9('0xb')](function(_0x4f02d3){logger[_0xe8d9('0xc')](_0xe8d9('0xd'),_0x128c15,'request\x20sent');logger[_0xe8d9('0xe')](_0xe8d9('0xf'),_0x128c15,_0xe8d9('0x10'),JSON[_0xe8d9('0x11')](_0x4f02d3));if(_0x4f02d3[_0xe8d9('0x12')]){if(_0x4f02d3[_0xe8d9('0x12')][_0xe8d9('0x13')]===0x1f4){logger['error'](_0xe8d9('0xd'),_0x128c15,_0x4f02d3[_0xe8d9('0x12')]['message']);return _0x57ee77(_0x4f02d3[_0xe8d9('0x12')][_0xe8d9('0x14')]);}logger[_0xe8d9('0x12')](_0xe8d9('0xd'),_0x128c15,_0x4f02d3[_0xe8d9('0x12')][_0xe8d9('0x14')]);return _0x17d39f(_0x4f02d3[_0xe8d9('0x12')][_0xe8d9('0x14')]);}else{logger[_0xe8d9('0xc')](_0xe8d9('0xd'),_0x128c15,_0xe8d9('0x10'));_0x17d39f(_0x4f02d3[_0xe8d9('0x15')][_0xe8d9('0x14')]);}})[_0xe8d9('0x16')](function(_0x6700ea){logger[_0xe8d9('0x12')](_0xe8d9('0xd'),_0x128c15,_0x6700ea);_0x57ee77(_0x6700ea);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 6610690..606321c 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 _0xb93d=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xb93d,0x14f));var _0xdb93=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xb93d[_0xfa634c];return _0x73e478;};'use strict';var multer=require(_0xdb93('0x0'));var util=require(_0xdb93('0x1'));var path=require('path');var timeout=require(_0xdb93('0x2'));var express=require(_0xdb93('0x3'));var router=express[_0xdb93('0x4')]();var fs_extra=require(_0xdb93('0x5'));var auth=require(_0xdb93('0x6'));var interaction=require(_0xdb93('0x7'));var config=require(_0xdb93('0x8'));var controller=require(_0xdb93('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xdb93('0xa')]);router[_0xdb93('0xb')](_0xdb93('0xc'),auth[_0xdb93('0xd')](),controller[_0xdb93('0xe')]);router[_0xdb93('0xf')]('/',auth[_0xdb93('0xd')](),controller[_0xdb93('0x10')]);router[_0xdb93('0x11')]('/:id',auth[_0xdb93('0xd')](),controller[_0xdb93('0x12')]);router[_0xdb93('0x13')]('/:id',auth[_0xdb93('0xd')](),controller[_0xdb93('0x14')]);module['exports']=router; \ No newline at end of file +var _0x076c=['../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0xceb35d,_0x5d35a6){var _0x126918=function(_0x16e8c3){while(--_0x16e8c3){_0xceb35d['push'](_0xceb35d['shift']());}};_0x126918(++_0x5d35a6);}(_0x076c,0x103));var _0xc076=function(_0x874cf1,_0x2a4954){_0x874cf1=_0x874cf1-0x0;var _0x233579=_0x076c[_0x874cf1];return _0x233579;};'use strict';var multer=require(_0xc076('0x0'));var util=require(_0xc076('0x1'));var path=require(_0xc076('0x2'));var timeout=require(_0xc076('0x3'));var express=require(_0xc076('0x4'));var router=express['Router']();var fs_extra=require(_0xc076('0x5'));var auth=require(_0xc076('0x6'));var interaction=require(_0xc076('0x7'));var config=require('../../config/environment');var controller=require('./network.controller');router[_0xc076('0x8')]('/',auth[_0xc076('0x9')](),controller[_0xc076('0xa')]);router[_0xc076('0x8')](_0xc076('0xb'),auth['isAuthenticated'](),controller[_0xc076('0xc')]);router[_0xc076('0xd')]('/',auth[_0xc076('0x9')](),controller[_0xc076('0xe')]);router['put'](_0xc076('0xb'),auth[_0xc076('0x9')](),controller[_0xc076('0xf')]);router[_0xc076('0x10')](_0xc076('0xb'),auth['isAuthenticated'](),controller[_0xc076('0x11')]);module[_0xc076('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index ee6aeed..0efd7c1 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(_0x1dcb49,_0x10a393){var _0x52b6a6=function(_0x4a4fc0){while(--_0x4a4fc0){_0x1dcb49['push'](_0x1dcb49['shift']());}};_0x52b6a6(++_0x10a393);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0x41f0b4,_0x49aa8b){var _0x285335=function(_0x21032e){while(--_0x21032e){_0x41f0b4['push'](_0x41f0b4['shift']());}};_0x285335(++_0x49aa8b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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 40bb983..0e16424 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 _0xf9f1=['error','code','message','info','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','map','Network','rawAttributes','fieldName','key','model','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','sequelize','transaction','create','body','STUN','root','utf8','render','writeFileSync','Reload','toUpperCase','TURN','readFileSync','join','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','format','chan_sip.so','/etc/asterisk/stun_xcally.conf','server/files/templates/turn_multiple.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','server/files/templates/stun_multiple.ejs','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','jayson/promise','http','request','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xf9f1,0x125));var _0x1f9f=function(_0x58b1d4,_0x1d3190){_0x58b1d4=_0x58b1d4-0x0;var _0x255de2=_0xf9f1[_0x58b1d4];return _0x255de2;};'use strict';var emlformat=require(_0x1f9f('0x0'));var rimraf=require(_0x1f9f('0x1'));var zipdir=require(_0x1f9f('0x2'));var jsonpatch=require(_0x1f9f('0x3'));var rp=require('request-promise');var moment=require(_0x1f9f('0x4'));var BPromise=require(_0x1f9f('0x5'));var Mustache=require(_0x1f9f('0x6'));var util=require('util');var path=require(_0x1f9f('0x7'));var sox=require(_0x1f9f('0x8'));var csv=require(_0x1f9f('0x9'));var ejs=require(_0x1f9f('0xa'));var fs=require('fs');var fs_extra=require(_0x1f9f('0xb'));var _=require('lodash');var squel=require(_0x1f9f('0xc'));var crypto=require(_0x1f9f('0xd'));var jsforce=require(_0x1f9f('0xe'));var deskjs=require(_0x1f9f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1f9f('0x10'));var Papa=require(_0x1f9f('0x11'));var Redis=require(_0x1f9f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1f9f('0x13'));var as=require(_0x1f9f('0x14'));var hardwareService=require(_0x1f9f('0x15'));var logger=require(_0x1f9f('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x1f9f('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x1f9f('0x18'));var client=jayson['client'][_0x1f9f('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5bfedb,_0x56641f,_0x2812ba,_0x56e22d){return new BPromise(function(_0xbfe94f,_0x3189fb){var _0x199fb3=_0x56e22d||client;return _0x199fb3[_0x1f9f('0x1a')](_0x5bfedb,_0x2812ba)['then'](function(_0x505d12){logger['info'](_0x1f9f('0x1b'),_0x56641f,_0x1f9f('0x1c'));logger['debug'](_0x1f9f('0x1d'),_0x56641f,_0x1f9f('0x1c'),JSON[_0x1f9f('0x1e')](_0x505d12));if(_0x505d12[_0x1f9f('0x1f')]){if(_0x505d12[_0x1f9f('0x1f')][_0x1f9f('0x20')]===0x1f4){logger[_0x1f9f('0x1f')](_0x1f9f('0x1b'),_0x56641f,_0x505d12[_0x1f9f('0x1f')][_0x1f9f('0x21')]);return _0x3189fb(_0x505d12[_0x1f9f('0x1f')][_0x1f9f('0x21')]);}logger[_0x1f9f('0x1f')](_0x1f9f('0x1b'),_0x56641f,_0x505d12[_0x1f9f('0x1f')]['message']);return _0xbfe94f(_0x505d12[_0x1f9f('0x1f')][_0x1f9f('0x21')]);}else{logger[_0x1f9f('0x22')](_0x1f9f('0x1b'),_0x56641f,'request\x20sent');_0xbfe94f(_0x505d12['result'][_0x1f9f('0x21')]);}})[_0x1f9f('0x23')](function(_0x4bea28){logger[_0x1f9f('0x1f')](_0x1f9f('0x1b'),_0x56641f,_0x4bea28);_0x3189fb(_0x4bea28);});});}function respondWithStatusCode(_0x40cd0c,_0x34a899){_0x34a899=_0x34a899||0xcc;return function(_0x456790){if(_0x456790){return _0x40cd0c[_0x1f9f('0x24')](_0x34a899);}return _0x40cd0c['status'](_0x34a899)[_0x1f9f('0x25')]();};}function respondWithResult(_0x9404a2,_0x4e93a4){_0x4e93a4=_0x4e93a4||0xc8;return function(_0x3fed7e){if(_0x3fed7e){return _0x9404a2['status'](_0x4e93a4)[_0x1f9f('0x26')](_0x3fed7e);}};}function respondWithFilteredResult(_0x3d5c70,_0x2bce5e){return function(_0x31c52a){if(_0x31c52a){var _0x1e4f2a=_0x31c52a[_0x1f9f('0x27')],_0x4f32a5=_0x2bce5e[_0x1f9f('0x28')],_0x47ccd7=_0x2bce5e['offset']+_0x2bce5e[_0x1f9f('0x29')],_0x582662;if(_0x47ccd7>=_0x1e4f2a){_0x47ccd7=_0x1e4f2a;_0x582662=0xc8;}else{_0x582662=0xce;}_0x3d5c70[_0x1f9f('0x2a')](_0x582662);return _0x3d5c70[_0x1f9f('0x2b')](_0x1f9f('0x2c'),_0x4f32a5+'-'+_0x47ccd7+'/'+_0x1e4f2a)[_0x1f9f('0x26')](_0x31c52a);}return null;};}function patchUpdates(_0x5ef5ae){return function(_0x52047d){try{jsonpatch[_0x1f9f('0x2d')](_0x52047d,_0x5ef5ae,!![]);}catch(_0x7d89ca){return BPromise[_0x1f9f('0x2e')](_0x7d89ca);}return _0x52047d['save']();};}function saveUpdates(_0x41cccd,_0x34c4c3){return function(_0x305b92){if(_0x305b92){return _0x305b92[_0x1f9f('0x2f')](_0x41cccd)['then'](function(_0x6db788){return _0x6db788;});}return null;};}function removeEntity(_0x56b2ab,_0x42a717){return function(_0x3cac2e){if(_0x3cac2e){return _0x3cac2e[_0x1f9f('0x30')]()[_0x1f9f('0x31')](function(){_0x56b2ab[_0x1f9f('0x2a')](0xcc)[_0x1f9f('0x25')]();});}};}function handleEntityNotFound(_0x484142,_0x5d12b8){return function(_0x13db6c){if(!_0x13db6c){_0x484142[_0x1f9f('0x24')](0x194);}return _0x13db6c;};}function handleError(_0x9624e0,_0x5abf51){_0x5abf51=_0x5abf51||0x1f4;return function(_0x505a3b){logger['error'](_0x505a3b[_0x1f9f('0x32')]);if(_0x505a3b[_0x1f9f('0x33')]){delete _0x505a3b['name'];}_0x9624e0[_0x1f9f('0x2a')](_0x5abf51)[_0x1f9f('0x34')](_0x505a3b);};}exports[_0x1f9f('0x35')]=function(_0x2ceace,_0x20bab6){var _0x4137f2={},_0x4c553b={},_0x826f66={'count':0x0,'rows':[]};var _0xc5c044=_[_0x1f9f('0x36')](db[_0x1f9f('0x37')][_0x1f9f('0x38')],function(_0x3f12c4){return{'name':_0x3f12c4[_0x1f9f('0x39')],'type':_0x3f12c4['type'][_0x1f9f('0x3a')]};});_0x4c553b[_0x1f9f('0x3b')]=_['map'](_0xc5c044,_0x1f9f('0x33'));_0x4c553b['query']=_[_0x1f9f('0x3c')](_0x2ceace['query']);_0x4c553b[_0x1f9f('0x3d')]=_[_0x1f9f('0x3e')](_0x4c553b[_0x1f9f('0x3b')],_0x4c553b['query']);_0x4137f2['attributes']=_[_0x1f9f('0x3e')](_0x4c553b[_0x1f9f('0x3b')],qs[_0x1f9f('0x3f')](_0x2ceace[_0x1f9f('0x40')][_0x1f9f('0x3f')]));_0x4137f2[_0x1f9f('0x41')]=_0x4137f2[_0x1f9f('0x41')][_0x1f9f('0x42')]?_0x4137f2[_0x1f9f('0x41')]:_0x4c553b[_0x1f9f('0x3b')];if(!_0x2ceace['query'][_0x1f9f('0x43')](_0x1f9f('0x44'))){_0x4137f2[_0x1f9f('0x29')]=qs['limit'](_0x2ceace[_0x1f9f('0x40')]['limit']);_0x4137f2[_0x1f9f('0x28')]=qs[_0x1f9f('0x28')](_0x2ceace[_0x1f9f('0x40')]['offset']);}_0x4137f2['order']=qs[_0x1f9f('0x45')](_0x2ceace[_0x1f9f('0x40')][_0x1f9f('0x45')]);_0x4137f2[_0x1f9f('0x46')]=qs[_0x1f9f('0x3d')](_[_0x1f9f('0x47')](_0x2ceace[_0x1f9f('0x40')],_0x4c553b[_0x1f9f('0x3d')]),_0xc5c044);if(_0x2ceace[_0x1f9f('0x40')][_0x1f9f('0x48')]){_0x4137f2[_0x1f9f('0x46')]=_[_0x1f9f('0x49')](_0x4137f2['where'],{'$or':_[_0x1f9f('0x36')](_0xc5c044,function(_0x3efa0e){if(_0x3efa0e[_0x1f9f('0x4a')]!==_0x1f9f('0x4b')){var _0x55cafa={};_0x55cafa[_0x3efa0e['name']]={'$like':'%'+_0x2ceace['query']['filter']+'%'};return _0x55cafa;}})});}_0x4137f2=_['merge']({},_0x4137f2,_0x2ceace[_0x1f9f('0x4c')]);var _0x55f87f={'where':_0x4137f2[_0x1f9f('0x46')]};return db[_0x1f9f('0x37')][_0x1f9f('0x27')](_0x55f87f)[_0x1f9f('0x31')](function(_0x4b3a15){_0x826f66[_0x1f9f('0x27')]=_0x4b3a15;if(_0x2ceace[_0x1f9f('0x40')]['includeAll']){_0x4137f2[_0x1f9f('0x4d')]=[{'all':!![]}];}return db['Network'][_0x1f9f('0x4e')](_0x4137f2);})['then'](function(_0x348e1a){_0x826f66[_0x1f9f('0x4f')]=_0x348e1a;return _0x826f66;})['then'](respondWithFilteredResult(_0x20bab6,_0x4137f2))[_0x1f9f('0x23')](handleError(_0x20bab6,null));};exports[_0x1f9f('0x50')]=function(_0x2e65fe,_0x1c7699){var _0x28601e={'raw':!![],'where':{'id':_0x2e65fe[_0x1f9f('0x51')]['id']}},_0x150451={};_0x150451[_0x1f9f('0x3b')]=_['keys'](db[_0x1f9f('0x37')][_0x1f9f('0x38')]);_0x150451[_0x1f9f('0x40')]=_['keys'](_0x2e65fe[_0x1f9f('0x40')]);_0x150451['filters']=_[_0x1f9f('0x3e')](_0x150451[_0x1f9f('0x3b')],_0x150451[_0x1f9f('0x40')]);_0x28601e[_0x1f9f('0x41')]=_[_0x1f9f('0x3e')](_0x150451[_0x1f9f('0x3b')],qs[_0x1f9f('0x3f')](_0x2e65fe[_0x1f9f('0x40')]['fields']));_0x28601e[_0x1f9f('0x41')]=_0x28601e[_0x1f9f('0x41')]['length']?_0x28601e[_0x1f9f('0x41')]:_0x150451[_0x1f9f('0x3b')];if(_0x2e65fe[_0x1f9f('0x40')][_0x1f9f('0x52')]){_0x28601e[_0x1f9f('0x4d')]=[{'all':!![]}];}_0x28601e=_[_0x1f9f('0x49')]({},_0x28601e,_0x2e65fe[_0x1f9f('0x4c')]);return db[_0x1f9f('0x37')][_0x1f9f('0x53')](_0x28601e)[_0x1f9f('0x31')](handleEntityNotFound(_0x1c7699,null))[_0x1f9f('0x31')](respondWithResult(_0x1c7699,null))[_0x1f9f('0x23')](handleError(_0x1c7699,null));};exports['create']=function(_0x256acf,_0x3ad1f0,_0x48a396){var _0x3d6b45;return db[_0x1f9f('0x54')][_0x1f9f('0x55')](function(_0x1b5d0d){return db[_0x1f9f('0x37')][_0x1f9f('0x56')](_0x256acf[_0x1f9f('0x57')],{'raw':!![]})[_0x1f9f('0x31')](function(_0x4acac7){_0x3d6b45=_0x4acac7;return db[_0x1f9f('0x37')][_0x1f9f('0x4e')]({'where':{'type':_0x256acf['body'][_0x1f9f('0x4a')]},'raw':!![]});})['then'](function(_0x267e2e){if(_0x3d6b45['type']['toUpperCase']()==_0x1f9f('0x58')){var _0x2e2570=fs['readFileSync'](path['join'](config[_0x1f9f('0x59')],'server/files/templates/stun_multiple.ejs'),_0x1f9f('0x5a'));var _0x5e219c=ejs[_0x1f9f('0x5b')](_0x2e2570,{'networks':_0x267e2e||[]});fs[_0x1f9f('0x5c')]('/etc/asterisk/stun_xcally.conf',_0x5e219c);return respondWithRpcPromise(_0x1f9f('0x5d'),'create',{'module':'res_stun_monitor.so'});}else if(_0x3d6b45[_0x1f9f('0x4a')][_0x1f9f('0x5e')]()==_0x1f9f('0x5f')){var _0x2e2f68=fs[_0x1f9f('0x60')](path[_0x1f9f('0x61')](config['root'],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x1ee79c=ejs[_0x1f9f('0x5b')](_0x2e2f68,{'networks':_0x267e2e||[]});fs[_0x1f9f('0x5c')](_0x1f9f('0x62'),_0x1ee79c);return respondWithRpcPromise(_0x1f9f('0x5d'),_0x1f9f('0x56'),{'module':_0x1f9f('0x63')});}else{var _0x38d062=fs[_0x1f9f('0x60')](path[_0x1f9f('0x61')](config[_0x1f9f('0x59')],_0x1f9f('0x64')),_0x1f9f('0x5a'));var _0x5b7c7b=ejs[_0x1f9f('0x5b')](_0x38d062,{'networks':_0x267e2e||[]});fs[_0x1f9f('0x5c')](util[_0x1f9f('0x65')]('/etc/asterisk/sip_xcally_%s.conf',_0x256acf[_0x1f9f('0x57')][_0x1f9f('0x4a')]['toLowerCase']()),_0x5b7c7b);return respondWithRpcPromise(_0x1f9f('0x5d'),_0x1f9f('0x56'),{'module':_0x1f9f('0x66')});}return null;})[_0x1f9f('0x31')](function(){return _0x3d6b45;});})['then'](respondWithResult(_0x3ad1f0,0xc9))[_0x1f9f('0x23')](handleError(_0x3ad1f0,null));};exports[_0x1f9f('0x2f')]=function(_0x3eb1db,_0x59dd35,_0x5e32bd){var _0x2b67ae;return db['sequelize'][_0x1f9f('0x55')](function(_0x59e4b4){return db[_0x1f9f('0x37')][_0x1f9f('0x53')]({'where':{'id':_0x3eb1db[_0x1f9f('0x51')]['id']}})['then'](handleEntityNotFound(_0x59dd35,null))[_0x1f9f('0x31')](saveUpdates(_0x3eb1db[_0x1f9f('0x57')],null))[_0x1f9f('0x31')](function(_0x46e705){if(_0x46e705){_0x2b67ae=_0x46e705;return db[_0x1f9f('0x37')][_0x1f9f('0x4e')]({'where':{'type':_0x2b67ae[_0x1f9f('0x4a')]},'raw':!![]});}return null;})[_0x1f9f('0x31')](function(_0x2fe638){if(_0x2b67ae['type']['toUpperCase']()==_0x1f9f('0x58')){var _0x124b82=fs[_0x1f9f('0x60')](path[_0x1f9f('0x61')](config[_0x1f9f('0x59')],'server/files/templates/stun_multiple.ejs'),_0x1f9f('0x5a'));var _0x16c137=ejs[_0x1f9f('0x5b')](_0x124b82,{'networks':_0x2fe638||[]});fs['writeFileSync'](_0x1f9f('0x67'),_0x16c137);return respondWithRpcPromise(_0x1f9f('0x5d'),_0x1f9f('0x2f'),{'module':_0x1f9f('0x63')});}else if(_0x2b67ae['type'][_0x1f9f('0x5e')]()==_0x1f9f('0x5f')){var _0x2ade90=fs[_0x1f9f('0x60')](path[_0x1f9f('0x61')](config[_0x1f9f('0x59')],_0x1f9f('0x68')),_0x1f9f('0x5a'));var _0x2e0f64=ejs[_0x1f9f('0x5b')](_0x2ade90,{'networks':_0x2fe638||[]});fs[_0x1f9f('0x5c')]('/etc/asterisk/turn_xcally.conf',_0x2e0f64);return respondWithRpcPromise(_0x1f9f('0x5d'),'update',{'module':_0x1f9f('0x63')});}else{var _0x21ad53=fs[_0x1f9f('0x60')](path[_0x1f9f('0x61')](config[_0x1f9f('0x59')],_0x1f9f('0x64')),_0x1f9f('0x5a'));var _0x38afc9=ejs['render'](_0x21ad53,{'networks':_0x2fe638||[]});fs[_0x1f9f('0x5c')](util[_0x1f9f('0x65')](_0x1f9f('0x69'),_0x3eb1db[_0x1f9f('0x57')]['type'][_0x1f9f('0x6a')]()),_0x38afc9);return respondWithRpcPromise('Reload',_0x1f9f('0x2f'),{'module':_0x1f9f('0x66')});}return null;})[_0x1f9f('0x31')](function(_0x59d33d){if(_0x59d33d){return _0x2b67ae;}return null;});})[_0x1f9f('0x31')](respondWithResult(_0x59dd35,null))[_0x1f9f('0x23')](handleError(_0x59dd35,null));};exports[_0x1f9f('0x30')]=function(_0x38b68b,_0x2ba55e,_0x303e75){var _0x9d1ee3;return db[_0x1f9f('0x37')][_0x1f9f('0x53')]({'where':{'id':_0x38b68b[_0x1f9f('0x51')]['id']}})[_0x1f9f('0x31')](function(_0x36fe0e){_0x9d1ee3=_0x36fe0e;return _0x36fe0e;})[_0x1f9f('0x31')](handleEntityNotFound(_0x2ba55e,null))[_0x1f9f('0x31')](removeEntity(_0x2ba55e,null))[_0x1f9f('0x31')](function(){if(_0x9d1ee3){return db[_0x1f9f('0x37')][_0x1f9f('0x4e')]({'where':{'type':_0x9d1ee3['type']},'raw':!![]});}})[_0x1f9f('0x31')](function(_0x45140b){if(_0x9d1ee3[_0x1f9f('0x4a')]['toUpperCase']()=='STUN'){var _0x40a1ac=fs[_0x1f9f('0x60')](path[_0x1f9f('0x61')](config['root'],_0x1f9f('0x6b')),_0x1f9f('0x5a'));var _0x30c686=ejs[_0x1f9f('0x5b')](_0x40a1ac,{'networks':_0x45140b||[]});fs[_0x1f9f('0x5c')](_0x1f9f('0x67'),_0x30c686);return respondWithRpcPromise('Reload',_0x1f9f('0x30'),{'module':'res_stun_monitor.so'});}else if(_0x9d1ee3[_0x1f9f('0x4a')][_0x1f9f('0x5e')]()=='TURN'){var _0x266d69=fs[_0x1f9f('0x60')](path[_0x1f9f('0x61')](config[_0x1f9f('0x59')],'server/files/templates/turn_multiple.ejs'),_0x1f9f('0x5a'));var _0x377f55=ejs[_0x1f9f('0x5b')](_0x266d69,{'networks':_0x45140b||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x377f55);return respondWithRpcPromise(_0x1f9f('0x5d'),_0x1f9f('0x30'),{'module':_0x1f9f('0x63')});}else{var _0x2181e8=fs['readFileSync'](path[_0x1f9f('0x61')](config[_0x1f9f('0x59')],_0x1f9f('0x64')),_0x1f9f('0x5a'));var _0x55329c=ejs[_0x1f9f('0x5b')](_0x2181e8,{'networks':_0x45140b||[]});fs[_0x1f9f('0x5c')](util['format'](_0x1f9f('0x69'),_0x38b68b[_0x1f9f('0x57')][_0x1f9f('0x4a')]['toLowerCase']()),_0x55329c);return respondWithRpcPromise('Reload','destroy',{'module':_0x1f9f('0x66')});}return null;})[_0x1f9f('0x23')](handleError(_0x2ba55e,null));}; \ No newline at end of file +var _0x208d=['Network,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','sendStatus','name','index','Network','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','params','find','create','sequelize','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','Reload','res_stun_monitor.so','TURN','utf8','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','server/files/templates/turn_multiple.ejs','format','/etc/asterisk/stun_xcally.conf','eml-format','rimraf','fast-json-patch','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x506d2f,_0x5ab76e){var _0x101255=function(_0x1596b1){while(--_0x1596b1){_0x506d2f['push'](_0x506d2f['shift']());}};_0x101255(++_0x5ab76e);}(_0x208d,0x1d0));var _0xd208=function(_0x29caf3,_0x88a317){_0x29caf3=_0x29caf3-0x0;var _0x3dc931=_0x208d[_0x29caf3];return _0x3dc931;};'use strict';var emlformat=require(_0xd208('0x0'));var rimraf=require(_0xd208('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd208('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd208('0x3'));var Mustache=require(_0xd208('0x4'));var util=require('util');var path=require('path');var sox=require(_0xd208('0x5'));var csv=require(_0xd208('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd208('0x7'));var _=require(_0xd208('0x8'));var squel=require(_0xd208('0x9'));var crypto=require('crypto');var jsforce=require(_0xd208('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd208('0x6'));var querystring=require(_0xd208('0xb'));var Papa=require(_0xd208('0xc'));var Redis=require('ioredis');var authService=require(_0xd208('0xd'));var qs=require(_0xd208('0xe'));var as=require(_0xd208('0xf'));var hardwareService=require(_0xd208('0x10'));var logger=require(_0xd208('0x11'))(_0xd208('0x12'));var utils=require(_0xd208('0x13'));var config=require(_0xd208('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd208('0x15'))['db'];var jayson=require(_0xd208('0x16'));var client=jayson[_0xd208('0x17')][_0xd208('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x41cdde,_0x4ead84,_0x3e13f3,_0x3b074f){return new BPromise(function(_0x5a3e14,_0xfc17c6){var _0x3ac40d=_0x3b074f||client;return _0x3ac40d[_0xd208('0x19')](_0x41cdde,_0x3e13f3)[_0xd208('0x1a')](function(_0x4a82e4){logger[_0xd208('0x1b')](_0xd208('0x1c'),_0x4ead84,_0xd208('0x1d'));logger[_0xd208('0x1e')](_0xd208('0x1f'),_0x4ead84,_0xd208('0x1d'),JSON[_0xd208('0x20')](_0x4a82e4));if(_0x4a82e4['error']){if(_0x4a82e4['error'][_0xd208('0x21')]===0x1f4){logger['error'](_0xd208('0x1c'),_0x4ead84,_0x4a82e4[_0xd208('0x22')][_0xd208('0x23')]);return _0xfc17c6(_0x4a82e4[_0xd208('0x22')][_0xd208('0x23')]);}logger[_0xd208('0x22')]('Network,\x20%s,\x20%s',_0x4ead84,_0x4a82e4['error'][_0xd208('0x23')]);return _0x5a3e14(_0x4a82e4[_0xd208('0x22')][_0xd208('0x23')]);}else{logger['info'](_0xd208('0x1c'),_0x4ead84,_0xd208('0x1d'));_0x5a3e14(_0x4a82e4[_0xd208('0x24')][_0xd208('0x23')]);}})[_0xd208('0x25')](function(_0x364c64){logger[_0xd208('0x22')](_0xd208('0x1c'),_0x4ead84,_0x364c64);_0xfc17c6(_0x364c64);});});}function respondWithStatusCode(_0x33cdfd,_0x91bdc4){_0x91bdc4=_0x91bdc4||0xcc;return function(_0x91d77a){if(_0x91d77a){return _0x33cdfd['sendStatus'](_0x91bdc4);}return _0x33cdfd['status'](_0x91bdc4)['end']();};}function respondWithResult(_0x5e3ede,_0x5918e8){_0x5918e8=_0x5918e8||0xc8;return function(_0x1d3dec){if(_0x1d3dec){return _0x5e3ede[_0xd208('0x26')](_0x5918e8)[_0xd208('0x27')](_0x1d3dec);}};}function respondWithFilteredResult(_0x577918,_0x3ae4b1){return function(_0x47b789){if(_0x47b789){var _0xa47d23=_0x47b789[_0xd208('0x28')],_0xf2d522=_0x3ae4b1[_0xd208('0x29')],_0x5dad07=_0x3ae4b1['offset']+_0x3ae4b1[_0xd208('0x2a')],_0x331a46;if(_0x5dad07>=_0xa47d23){_0x5dad07=_0xa47d23;_0x331a46=0xc8;}else{_0x331a46=0xce;}_0x577918[_0xd208('0x26')](_0x331a46);return _0x577918[_0xd208('0x2b')](_0xd208('0x2c'),_0xf2d522+'-'+_0x5dad07+'/'+_0xa47d23)['json'](_0x47b789);}return null;};}function patchUpdates(_0x3a4ce3){return function(_0x4bdbec){try{jsonpatch['apply'](_0x4bdbec,_0x3a4ce3,!![]);}catch(_0x2a231d){return BPromise[_0xd208('0x2d')](_0x2a231d);}return _0x4bdbec[_0xd208('0x2e')]();};}function saveUpdates(_0xa4d008,_0x403125){return function(_0x412020){if(_0x412020){return _0x412020[_0xd208('0x2f')](_0xa4d008)['then'](function(_0x5e2f46){return _0x5e2f46;});}return null;};}function removeEntity(_0x1f8dcd,_0x37bc66){return function(_0x291e79){if(_0x291e79){return _0x291e79[_0xd208('0x30')]()[_0xd208('0x1a')](function(){_0x1f8dcd[_0xd208('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e0f4c,_0x116132){return function(_0x293128){if(!_0x293128){_0x4e0f4c[_0xd208('0x31')](0x194);}return _0x293128;};}function handleError(_0x20830c,_0x103f03){_0x103f03=_0x103f03||0x1f4;return function(_0x2a0816){logger[_0xd208('0x22')](_0x2a0816['stack']);if(_0x2a0816[_0xd208('0x32')]){delete _0x2a0816[_0xd208('0x32')];}_0x20830c[_0xd208('0x26')](_0x103f03)['send'](_0x2a0816);};}exports[_0xd208('0x33')]=function(_0x325748,_0x27ce87){var _0x5652e6={},_0x4683d8={},_0x11bf76={'count':0x0,'rows':[]};var _0x5ccf6d=_['map'](db[_0xd208('0x34')][_0xd208('0x35')],function(_0x19e5d1){return{'name':_0x19e5d1[_0xd208('0x36')],'type':_0x19e5d1[_0xd208('0x37')]['key']};});_0x4683d8[_0xd208('0x38')]=_['map'](_0x5ccf6d,_0xd208('0x32'));_0x4683d8[_0xd208('0x39')]=_[_0xd208('0x3a')](_0x325748['query']);_0x4683d8['filters']=_[_0xd208('0x3b')](_0x4683d8['model'],_0x4683d8[_0xd208('0x39')]);_0x5652e6[_0xd208('0x3c')]=_[_0xd208('0x3b')](_0x4683d8['model'],qs[_0xd208('0x3d')](_0x325748[_0xd208('0x39')]['fields']));_0x5652e6[_0xd208('0x3c')]=_0x5652e6[_0xd208('0x3c')][_0xd208('0x3e')]?_0x5652e6[_0xd208('0x3c')]:_0x4683d8['model'];if(!_0x325748['query'][_0xd208('0x3f')]('nolimit')){_0x5652e6[_0xd208('0x2a')]=qs[_0xd208('0x2a')](_0x325748[_0xd208('0x39')][_0xd208('0x2a')]);_0x5652e6['offset']=qs[_0xd208('0x29')](_0x325748[_0xd208('0x39')][_0xd208('0x29')]);}_0x5652e6['order']=qs[_0xd208('0x40')](_0x325748[_0xd208('0x39')]['sort']);_0x5652e6[_0xd208('0x41')]=qs[_0xd208('0x42')](_['pick'](_0x325748[_0xd208('0x39')],_0x4683d8['filters']),_0x5ccf6d);if(_0x325748[_0xd208('0x39')][_0xd208('0x43')]){_0x5652e6[_0xd208('0x41')]=_[_0xd208('0x44')](_0x5652e6[_0xd208('0x41')],{'$or':_['map'](_0x5ccf6d,function(_0x1e3881){if(_0x1e3881[_0xd208('0x37')]!=='VIRTUAL'){var _0x3a4563={};_0x3a4563[_0x1e3881[_0xd208('0x32')]]={'$like':'%'+_0x325748[_0xd208('0x39')]['filter']+'%'};return _0x3a4563;}})});}_0x5652e6=_[_0xd208('0x44')]({},_0x5652e6,_0x325748[_0xd208('0x45')]);var _0x1e5562={'where':_0x5652e6[_0xd208('0x41')]};return db[_0xd208('0x34')][_0xd208('0x28')](_0x1e5562)[_0xd208('0x1a')](function(_0x13ec77){_0x11bf76[_0xd208('0x28')]=_0x13ec77;if(_0x325748['query'][_0xd208('0x46')]){_0x5652e6[_0xd208('0x47')]=[{'all':!![]}];}return db[_0xd208('0x34')][_0xd208('0x48')](_0x5652e6);})['then'](function(_0xa2aa09){_0x11bf76[_0xd208('0x49')]=_0xa2aa09;return _0x11bf76;})[_0xd208('0x1a')](respondWithFilteredResult(_0x27ce87,_0x5652e6))['catch'](handleError(_0x27ce87,null));};exports['show']=function(_0x35fe5d,_0x4c5b46){var _0x4f71ba={'raw':!![],'where':{'id':_0x35fe5d[_0xd208('0x4a')]['id']}},_0x2ae6c1={};_0x2ae6c1[_0xd208('0x38')]=_['keys'](db[_0xd208('0x34')][_0xd208('0x35')]);_0x2ae6c1[_0xd208('0x39')]=_['keys'](_0x35fe5d[_0xd208('0x39')]);_0x2ae6c1[_0xd208('0x42')]=_[_0xd208('0x3b')](_0x2ae6c1[_0xd208('0x38')],_0x2ae6c1[_0xd208('0x39')]);_0x4f71ba[_0xd208('0x3c')]=_[_0xd208('0x3b')](_0x2ae6c1[_0xd208('0x38')],qs[_0xd208('0x3d')](_0x35fe5d[_0xd208('0x39')][_0xd208('0x3d')]));_0x4f71ba['attributes']=_0x4f71ba[_0xd208('0x3c')][_0xd208('0x3e')]?_0x4f71ba[_0xd208('0x3c')]:_0x2ae6c1[_0xd208('0x38')];if(_0x35fe5d[_0xd208('0x39')]['includeAll']){_0x4f71ba['include']=[{'all':!![]}];}_0x4f71ba=_[_0xd208('0x44')]({},_0x4f71ba,_0x35fe5d[_0xd208('0x45')]);return db['Network'][_0xd208('0x4b')](_0x4f71ba)['then'](handleEntityNotFound(_0x4c5b46,null))[_0xd208('0x1a')](respondWithResult(_0x4c5b46,null))[_0xd208('0x25')](handleError(_0x4c5b46,null));};exports[_0xd208('0x4c')]=function(_0x137fce,_0x3f2561,_0x406482){var _0x135e90;return db[_0xd208('0x4d')]['transaction'](function(_0x185517){return db[_0xd208('0x34')][_0xd208('0x4c')](_0x137fce[_0xd208('0x4e')],{'raw':!![]})[_0xd208('0x1a')](function(_0x58d68b){_0x135e90=_0x58d68b;return db[_0xd208('0x34')][_0xd208('0x48')]({'where':{'type':_0x137fce['body'][_0xd208('0x37')]},'raw':!![]});})[_0xd208('0x1a')](function(_0x16259a){if(_0x135e90[_0xd208('0x37')][_0xd208('0x4f')]()==_0xd208('0x50')){var _0x3528e4=fs[_0xd208('0x51')](path[_0xd208('0x52')](config[_0xd208('0x53')],_0xd208('0x54')),'utf8');var _0x104e52=ejs[_0xd208('0x55')](_0x3528e4,{'networks':_0x16259a||[]});fs[_0xd208('0x56')]('/etc/asterisk/stun_xcally.conf',_0x104e52);return respondWithRpcPromise(_0xd208('0x57'),_0xd208('0x4c'),{'module':_0xd208('0x58')});}else if(_0x135e90['type']['toUpperCase']()==_0xd208('0x59')){var _0x2c4a33=fs[_0xd208('0x51')](path[_0xd208('0x52')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xd208('0x5a'));var _0x3c5cf5=ejs['render'](_0x2c4a33,{'networks':_0x16259a||[]});fs['writeFileSync'](_0xd208('0x5b'),_0x3c5cf5);return respondWithRpcPromise(_0xd208('0x57'),_0xd208('0x4c'),{'module':_0xd208('0x58')});}else{var _0x3fafb1=fs[_0xd208('0x51')](path[_0xd208('0x52')](config[_0xd208('0x53')],_0xd208('0x5c')),'utf8');var _0x26e9a6=ejs[_0xd208('0x55')](_0x3fafb1,{'networks':_0x16259a||[]});fs[_0xd208('0x56')](util['format'](_0xd208('0x5d'),_0x137fce['body'][_0xd208('0x37')][_0xd208('0x5e')]()),_0x26e9a6);return respondWithRpcPromise(_0xd208('0x57'),_0xd208('0x4c'),{'module':_0xd208('0x5f')});}return null;})[_0xd208('0x1a')](function(){return _0x135e90;});})['then'](respondWithResult(_0x3f2561,0xc9))[_0xd208('0x25')](handleError(_0x3f2561,null));};exports[_0xd208('0x2f')]=function(_0x2d5c7d,_0x4efc78,_0x17bb13){var _0xce4e7c;return db[_0xd208('0x4d')]['transaction'](function(_0x274ae9){return db[_0xd208('0x34')][_0xd208('0x4b')]({'where':{'id':_0x2d5c7d[_0xd208('0x4a')]['id']}})[_0xd208('0x1a')](handleEntityNotFound(_0x4efc78,null))[_0xd208('0x1a')](saveUpdates(_0x2d5c7d[_0xd208('0x4e')],null))[_0xd208('0x1a')](function(_0x1da4b4){if(_0x1da4b4){_0xce4e7c=_0x1da4b4;return db[_0xd208('0x34')]['findAll']({'where':{'type':_0xce4e7c[_0xd208('0x37')]},'raw':!![]});}return null;})[_0xd208('0x1a')](function(_0x4c61a5){if(_0xce4e7c[_0xd208('0x37')]['toUpperCase']()==_0xd208('0x50')){var _0x2249ac=fs[_0xd208('0x51')](path[_0xd208('0x52')](config[_0xd208('0x53')],_0xd208('0x54')),_0xd208('0x5a'));var _0x405000=ejs[_0xd208('0x55')](_0x2249ac,{'networks':_0x4c61a5||[]});fs[_0xd208('0x56')]('/etc/asterisk/stun_xcally.conf',_0x405000);return respondWithRpcPromise('Reload',_0xd208('0x2f'),{'module':_0xd208('0x58')});}else if(_0xce4e7c['type'][_0xd208('0x4f')]()=='TURN'){var _0x3145b8=fs[_0xd208('0x51')](path[_0xd208('0x52')](config[_0xd208('0x53')],_0xd208('0x60')),_0xd208('0x5a'));var _0x1fbbee=ejs[_0xd208('0x55')](_0x3145b8,{'networks':_0x4c61a5||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x1fbbee);return respondWithRpcPromise(_0xd208('0x57'),_0xd208('0x2f'),{'module':_0xd208('0x58')});}else{var _0x104ff5=fs[_0xd208('0x51')](path[_0xd208('0x52')](config[_0xd208('0x53')],_0xd208('0x5c')),_0xd208('0x5a'));var _0x2297f1=ejs[_0xd208('0x55')](_0x104ff5,{'networks':_0x4c61a5||[]});fs[_0xd208('0x56')](util[_0xd208('0x61')](_0xd208('0x5d'),_0x2d5c7d['body']['type'][_0xd208('0x5e')]()),_0x2297f1);return respondWithRpcPromise(_0xd208('0x57'),_0xd208('0x2f'),{'module':_0xd208('0x5f')});}return null;})['then'](function(_0x4b4618){if(_0x4b4618){return _0xce4e7c;}return null;});})[_0xd208('0x1a')](respondWithResult(_0x4efc78,null))[_0xd208('0x25')](handleError(_0x4efc78,null));};exports[_0xd208('0x30')]=function(_0x32d7cd,_0x19a788,_0x24c1ad){var _0x29d938;return db[_0xd208('0x34')][_0xd208('0x4b')]({'where':{'id':_0x32d7cd['params']['id']}})[_0xd208('0x1a')](function(_0x46dd00){_0x29d938=_0x46dd00;return _0x46dd00;})['then'](handleEntityNotFound(_0x19a788,null))['then'](removeEntity(_0x19a788,null))[_0xd208('0x1a')](function(){if(_0x29d938){return db['Network'][_0xd208('0x48')]({'where':{'type':_0x29d938[_0xd208('0x37')]},'raw':!![]});}})[_0xd208('0x1a')](function(_0x54f50f){if(_0x29d938['type'][_0xd208('0x4f')]()==_0xd208('0x50')){var _0x2cab66=fs[_0xd208('0x51')](path[_0xd208('0x52')](config[_0xd208('0x53')],'server/files/templates/stun_multiple.ejs'),_0xd208('0x5a'));var _0x5e13a0=ejs[_0xd208('0x55')](_0x2cab66,{'networks':_0x54f50f||[]});fs[_0xd208('0x56')](_0xd208('0x62'),_0x5e13a0);return respondWithRpcPromise(_0xd208('0x57'),_0xd208('0x30'),{'module':'res_stun_monitor.so'});}else if(_0x29d938[_0xd208('0x37')]['toUpperCase']()=='TURN'){var _0x260911=fs[_0xd208('0x51')](path[_0xd208('0x52')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xd208('0x5a'));var _0x58622d=ejs[_0xd208('0x55')](_0x260911,{'networks':_0x54f50f||[]});fs['writeFileSync'](_0xd208('0x5b'),_0x58622d);return respondWithRpcPromise(_0xd208('0x57'),_0xd208('0x30'),{'module':'res_stun_monitor.so'});}else{var _0x528829=fs[_0xd208('0x51')](path[_0xd208('0x52')](config[_0xd208('0x53')],_0xd208('0x5c')),_0xd208('0x5a'));var _0x4f1dde=ejs[_0xd208('0x55')](_0x528829,{'networks':_0x54f50f||[]});fs[_0xd208('0x56')](util[_0xd208('0x61')](_0xd208('0x5d'),_0x32d7cd[_0xd208('0x4e')][_0xd208('0x37')][_0xd208('0x5e')]()),_0x4f1dde);return respondWithRpcPromise(_0xd208('0x57'),_0xd208('0x30'),{'module':_0xd208('0x5f')});}return null;})[_0xd208('0x25')](handleError(_0x19a788,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index b3d4aae..6b7ba3f 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 _0xd017=['network','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network'];(function(_0x2dfbef,_0x5f2458){var _0x5624b1=function(_0x87323c){while(--_0x87323c){_0x2dfbef['push'](_0x2dfbef['shift']());}};_0x5624b1(++_0x5f2458);}(_0xd017,0x16d));var _0x7d01=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xd017[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x7d01('0x0'));var util=require(_0x7d01('0x1'));var logger=require(_0x7d01('0x2'))(_0x7d01('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7d01('0x4'));var fs=require('fs');var path=require(_0x7d01('0x5'));var rimraf=require(_0x7d01('0x6'));var config=require(_0x7d01('0x7'));var attributes=require(_0x7d01('0x8'));module[_0x7d01('0x9')]=function(_0x155ad8,_0xb020c){return _0x155ad8[_0x7d01('0xa')](_0x7d01('0xb'),attributes,{'tableName':_0x7d01('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc31=['exports','define','network','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./network.attributes'];(function(_0x3b1f2f,_0x13680a){var _0x51b416=function(_0x1db1c2){while(--_0x1db1c2){_0x3b1f2f['push'](_0x3b1f2f['shift']());}};_0x51b416(++_0x13680a);}(_0xdc31,0x13b));var _0x1dc3=function(_0x23e456,_0x30874f){_0x23e456=_0x23e456-0x0;var _0x1c70e1=_0xdc31[_0x23e456];return _0x1c70e1;};'use strict';var _=require(_0x1dc3('0x0'));var util=require(_0x1dc3('0x1'));var logger=require(_0x1dc3('0x2'))(_0x1dc3('0x3'));var moment=require(_0x1dc3('0x4'));var BPromise=require('bluebird');var rp=require(_0x1dc3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1dc3('0x6'));var config=require(_0x1dc3('0x7'));var attributes=require(_0x1dc3('0x8'));module[_0x1dc3('0x9')]=function(_0x209db3,_0x155362){return _0x209db3[_0x1dc3('0xa')]('Network',attributes,{'tableName':_0x1dc3('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 39818e6..7a0c4bb 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 _0xc6ba=['rpc','../../config/environment','jayson/promise','client','request','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xc6ba,0x129));var _0xac6b=function(_0x5563ce,_0x21af0b){_0x5563ce=_0x5563ce-0x0;var _0x219f63=_0xc6ba[_0x5563ce];return _0x219f63;};'use strict';var _=require(_0xac6b('0x0'));var util=require(_0xac6b('0x1'));var moment=require(_0xac6b('0x2'));var BPromise=require(_0xac6b('0x3'));var rs=require(_0xac6b('0x4'));var fs=require('fs');var Redis=require(_0xac6b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xac6b('0x6'))(_0xac6b('0x7'));var config=require(_0xac6b('0x8'));var jayson=require(_0xac6b('0x9'));var client=jayson[_0xac6b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5362de,_0x5cc6ea,_0x11caa7){return new BPromise(function(_0x3ad42e,_0x676d17){return client[_0xac6b('0xb')](_0x5362de,_0x11caa7)['then'](function(_0x1d6dfe){logger[_0xac6b('0xc')](_0xac6b('0xd'),_0x5cc6ea,_0xac6b('0xe'));logger['debug'](_0xac6b('0xf'),_0x5cc6ea,'request\x20sent',JSON[_0xac6b('0x10')](_0x1d6dfe));if(_0x1d6dfe['error']){if(_0x1d6dfe[_0xac6b('0x11')]['code']===0x1f4){logger['error'](_0xac6b('0xd'),_0x5cc6ea,_0x1d6dfe[_0xac6b('0x11')]['message']);return _0x676d17(_0x1d6dfe[_0xac6b('0x11')]['message']);}logger['error'](_0xac6b('0xd'),_0x5cc6ea,_0x1d6dfe[_0xac6b('0x11')][_0xac6b('0x12')]);return _0x3ad42e(_0x1d6dfe[_0xac6b('0x11')][_0xac6b('0x12')]);}else{logger[_0xac6b('0xc')](_0xac6b('0xd'),_0x5cc6ea,_0xac6b('0xe'));_0x3ad42e(_0x1d6dfe['result'][_0xac6b('0x12')]);}})['catch'](function(_0xa6ef24){logger[_0xac6b('0x11')](_0xac6b('0xd'),_0x5cc6ea,_0xa6ef24);_0x676d17(_0xa6ef24);});});} \ No newline at end of file +var _0x7c7d=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment'];(function(_0x4b2488,_0x1ca2b0){var _0x180128=function(_0x106333){while(--_0x106333){_0x4b2488['push'](_0x4b2488['shift']());}};_0x180128(++_0x1ca2b0);}(_0x7c7d,0x81));var _0xd7c7=function(_0x4119cd,_0x240bfa){_0x4119cd=_0x4119cd-0x0;var _0x47c043=_0x7c7d[_0x4119cd];return _0x47c043;};'use strict';var _=require(_0xd7c7('0x0'));var util=require(_0xd7c7('0x1'));var moment=require(_0xd7c7('0x2'));var BPromise=require(_0xd7c7('0x3'));var rs=require(_0xd7c7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd7c7('0x5'))['db'];var utils=require(_0xd7c7('0x6'));var logger=require(_0xd7c7('0x7'))('rpc');var config=require(_0xd7c7('0x8'));var jayson=require(_0xd7c7('0x9'));var client=jayson[_0xd7c7('0xa')][_0xd7c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x341478,_0x52c854,_0x138425){return new BPromise(function(_0x34fc8e,_0x42d8e8){return client[_0xd7c7('0xc')](_0x341478,_0x138425)['then'](function(_0x375720){logger[_0xd7c7('0xd')](_0xd7c7('0xe'),_0x52c854,_0xd7c7('0xf'));logger[_0xd7c7('0x10')](_0xd7c7('0x11'),_0x52c854,_0xd7c7('0xf'),JSON[_0xd7c7('0x12')](_0x375720));if(_0x375720[_0xd7c7('0x13')]){if(_0x375720[_0xd7c7('0x13')]['code']===0x1f4){logger[_0xd7c7('0x13')](_0xd7c7('0xe'),_0x52c854,_0x375720['error'][_0xd7c7('0x14')]);return _0x42d8e8(_0x375720[_0xd7c7('0x13')]['message']);}logger[_0xd7c7('0x13')]('Network,\x20%s,\x20%s',_0x52c854,_0x375720[_0xd7c7('0x13')][_0xd7c7('0x14')]);return _0x34fc8e(_0x375720['error'][_0xd7c7('0x14')]);}else{logger['info'](_0xd7c7('0xe'),_0x52c854,_0xd7c7('0xf'));_0x34fc8e(_0x375720['result'][_0xd7c7('0x14')]);}})[_0xd7c7('0x15')](function(_0x2b93b9){logger['error'](_0xd7c7('0xe'),_0x52c854,_0x2b93b9);_0x42d8e8(_0x2b93b9);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 1a41a50..ad7044f 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 _0x1cb9=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','getAgents','post','addAnswer','/:id/notify','notify','/:id/applications','addAgents','put','update','destroy','removeDispositions','delete','removeAnswers','/:id/users'];(function(_0x2bfcbd,_0x332653){var _0x316dbf=function(_0x3ddfcb){while(--_0x3ddfcb){_0x2bfcbd['push'](_0x2bfcbd['shift']());}};_0x316dbf(++_0x332653);}(_0x1cb9,0x14e));var _0x91cb=function(_0x1a1866,_0x592cdf){_0x1a1866=_0x1a1866-0x0;var _0x52d85d=_0x1cb9[_0x1a1866];return _0x52d85d;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0x8')](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x8')](_0x91cb('0x11'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x8')]('/:id/applications',auth[_0x91cb('0x9')](),controller[_0x91cb('0x13')]);router['get'](_0x91cb('0x14'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x15')]);router[_0x91cb('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x91cb('0x16')]);router[_0x91cb('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0x91cb('0x17')](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller['addDisposition']);router[_0x91cb('0x17')](_0x91cb('0x11'),auth['isAuthenticated'](),controller[_0x91cb('0x18')]);router[_0x91cb('0x17')](_0x91cb('0x19'),controller[_0x91cb('0x1a')]);router['post'](_0x91cb('0x1b'),auth[_0x91cb('0x9')](),controller['addApplications']);router[_0x91cb('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0x91cb('0x1c')]);router[_0x91cb('0x17')]('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0x91cb('0x1d')](_0x91cb('0xd'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x1e')]);router['delete'](_0x91cb('0xd'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x1f')]);router['delete'](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x20')]);router[_0x91cb('0x21')](_0x91cb('0x11'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x22')]);router[_0x91cb('0x21')](_0x91cb('0x23'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x91cb('0x24')]=router; \ No newline at end of file +var _0x7217=['Router','fs-extra','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','post','addDisposition','addAnswer','/:id/notify','addApplications','addAgents','/:id/send','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express'];(function(_0x312f70,_0x13aeb9){var _0x429d8d=function(_0x382eb9){while(--_0x382eb9){_0x312f70['push'](_0x312f70['shift']());}};_0x429d8d(++_0x13aeb9);}(_0x7217,0x19e));var _0x7721=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x7217[_0x4ea69d];return _0x5318e0;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getApplications']);router[_0x7721('0x8')](_0x7721('0x14'),auth['isAuthenticated'](),controller[_0x7721('0x15')]);router[_0x7721('0x8')](_0x7721('0x16'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x17')]('/',auth[_0x7721('0x9')](),controller['create']);router['post']('/:id/dispositions',auth[_0x7721('0x9')](),controller[_0x7721('0x18')]);router[_0x7721('0x17')](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router['post'](_0x7721('0x1a'),controller['notify']);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1b')]);router[_0x7721('0x17')](_0x7721('0x16'),auth[_0x7721('0x9')](),controller[_0x7721('0x1c')]);router[_0x7721('0x17')](_0x7721('0x1d'),auth['isAuthenticated'](),controller[_0x7721('0x1e')]);router[_0x7721('0x1f')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x20')]('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x21')]);router[_0x7721('0x20')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller[_0x7721('0x22')]);router[_0x7721('0x20')]('/:id/canned_answers',auth[_0x7721('0x9')](),controller[_0x7721('0x23')]);router[_0x7721('0x20')](_0x7721('0x16'),auth[_0x7721('0x9')](),controller[_0x7721('0x24')]);module[_0x7721('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index f05e223..7395069 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 _0x1979=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x36facf,_0x226026){var _0x19be93=function(_0x2e75c8){while(--_0x2e75c8){_0x36facf['push'](_0x36facf['shift']());}};_0x19be93(++_0x226026);}(_0x1979,0x118));var _0x9197=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x1979[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require(_0x9197('0x0'));var rs=require('randomstring');module[_0x9197('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x9197('0x2')]},'token':{'type':Sequelize[_0x9197('0x2')],'defaultValue':function(){return rs[_0x9197('0x3')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9197('0x4')],'defaultValue':function(){return _0x9197('0x5');}},'notificationSound':{'type':Sequelize[_0x9197('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x9197('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9197('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9197('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x9197('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9197('0x9'),'set':function(_0xbddfa7){if(!_0xbddfa7)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x9197('0xa')](_0x9197('0xb'),_0xbddfa7);}}}; \ No newline at end of file +var _0x675b=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','generate','STRING','TEXT','BOOLEAN'];(function(_0x3ecf95,_0x559a2c){var _0x3f1e72=function(_0x4160c0){while(--_0x4160c0){_0x3ecf95['push'](_0x3ecf95['shift']());}};_0x3f1e72(++_0x559a2c);}(_0x675b,0x17b));var _0xb675=function(_0x18191b,_0x46682b){_0x18191b=_0x18191b-0x0;var _0x2a149f=_0x675b[_0x18191b];return _0x2a149f;};'use strict';var Sequelize=require(_0xb675('0x0'));var rs=require('randomstring');module[_0xb675('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xb675('0x2')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xb675('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb675('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb675('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb675('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xb675('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb675('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb675('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb675('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xb675('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xb675('0x5')],'defaultValue':![],'comment':_0xb675('0x8'),'set':function(_0x2f5f70){if(!_0x2f5f70)this['setDataValue'](_0xb675('0x9'),null);this['setDataValue'](_0xb675('0xa'),_0x2f5f70);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 0d798f8..0fccb51 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 _0xc9b8=['count','include','show','params','mandatoryDispositionPause','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','addAnswer','getAnswers','CannedAnswer','findAll','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','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','from','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','created','autoclose','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','findAndCountAll','getApplications','getInteractions','Owner','fullname','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','Messages','dataValues','push','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','register','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','limit','set','apply','update','destroy','get','OpenchannelAccounts','end','stack','name','index','Pause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL'];(function(_0x4819ec,_0x2b34a7){var _0xddb58d=function(_0x1880de){while(--_0x1880de){_0x4819ec['push'](_0x4819ec['shift']());}};_0xddb58d(++_0x2b34a7);}(_0xc9b8,0x1e4));var _0x8c9b=function(_0x103aee,_0x2fb02b){_0x103aee=_0x103aee-0x0;var _0x31bf04=_0xc9b8[_0x103aee];return _0x31bf04;};'use strict';var emlformat=require(_0x8c9b('0x0'));var rimraf=require(_0x8c9b('0x1'));var zipdir=require(_0x8c9b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c9b('0x3'));var moment=require(_0x8c9b('0x4'));var BPromise=require(_0x8c9b('0x5'));var Mustache=require(_0x8c9b('0x6'));var util=require(_0x8c9b('0x7'));var path=require('path');var sox=require(_0x8c9b('0x8'));var csv=require(_0x8c9b('0x9'));var ejs=require(_0x8c9b('0xa'));var fs=require('fs');var fs_extra=require(_0x8c9b('0xb'));var _=require(_0x8c9b('0xc'));var squel=require('squel');var crypto=require(_0x8c9b('0xd'));var jsforce=require(_0x8c9b('0xe'));var deskjs=require(_0x8c9b('0xf'));var toCsv=require(_0x8c9b('0x9'));var querystring=require(_0x8c9b('0x10'));var Papa=require(_0x8c9b('0x11'));var Redis=require(_0x8c9b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8c9b('0x13'));var as=require(_0x8c9b('0x14'));var hardwareService=require(_0x8c9b('0x15'));var logger=require(_0x8c9b('0x16'))(_0x8c9b('0x17'));var utils=require(_0x8c9b('0x18'));var config=require(_0x8c9b('0x19'));var licenseUtil=require(_0x8c9b('0x1a'));var db=require('../../mysqldb')['db'];config[_0x8c9b('0x1b')]=_[_0x8c9b('0x1c')](config[_0x8c9b('0x1b')],{'host':_0x8c9b('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x8c9b('0x1e')](socket);var jayson=require(_0x8c9b('0x1f'));var client=jayson[_0x8c9b('0x20')][_0x8c9b('0x21')]({'port':0x232c});var client9002=jayson[_0x8c9b('0x20')][_0x8c9b('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x4c7767,_0x453924,_0x3f4399,_0x1b46ad){return new BPromise(function(_0x39c1ee,_0x4980c8){var _0x28ad63=_0x1b46ad||client;return _0x28ad63[_0x8c9b('0x22')](_0x4c7767,_0x3f4399)[_0x8c9b('0x23')](function(_0x26b570){logger[_0x8c9b('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x453924,_0x8c9b('0x25'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x453924,'request\x20sent',JSON[_0x8c9b('0x26')](_0x26b570));if(_0x26b570['error']){if(_0x26b570[_0x8c9b('0x27')][_0x8c9b('0x28')]===0x1f4){logger[_0x8c9b('0x27')](_0x8c9b('0x29'),_0x453924,_0x26b570['error'][_0x8c9b('0x2a')]);return _0x4980c8(_0x26b570[_0x8c9b('0x27')][_0x8c9b('0x2a')]);}logger[_0x8c9b('0x27')](_0x8c9b('0x29'),_0x453924,_0x26b570[_0x8c9b('0x27')][_0x8c9b('0x2a')]);return _0x39c1ee(_0x26b570[_0x8c9b('0x27')][_0x8c9b('0x2a')]);}else{logger[_0x8c9b('0x24')](_0x8c9b('0x29'),_0x453924,_0x8c9b('0x25'));_0x39c1ee(_0x26b570[_0x8c9b('0x2b')][_0x8c9b('0x2a')]);}})[_0x8c9b('0x2c')](function(_0x26cd8f){logger[_0x8c9b('0x27')](_0x8c9b('0x29'),_0x453924,_0x26cd8f);_0x4980c8(_0x26cd8f);});});}function respondWithStatusCode(_0xead5ca,_0x3bd771){_0x3bd771=_0x3bd771||0xcc;return function(_0x571624){if(_0x571624){return _0xead5ca[_0x8c9b('0x2d')](_0x3bd771);}return _0xead5ca[_0x8c9b('0x2e')](_0x3bd771)['end']();};}function respondWithResult(_0x414597,_0x18d03e){_0x18d03e=_0x18d03e||0xc8;return function(_0x16b3ba){if(_0x16b3ba){return _0x414597[_0x8c9b('0x2e')](_0x18d03e)[_0x8c9b('0x2f')](_0x16b3ba);}};}function respondWithFilteredResult(_0x57b367,_0x4672f5){return function(_0x37876e){if(_0x37876e){var _0x18dc22=_0x37876e['count'],_0x140c65=_0x4672f5[_0x8c9b('0x30')],_0x17bd92=_0x4672f5[_0x8c9b('0x30')]+_0x4672f5[_0x8c9b('0x31')],_0x4aa4b7;if(_0x17bd92>=_0x18dc22){_0x17bd92=_0x18dc22;_0x4aa4b7=0xc8;}else{_0x4aa4b7=0xce;}_0x57b367[_0x8c9b('0x2e')](_0x4aa4b7);return _0x57b367[_0x8c9b('0x32')]('Content-Range',_0x140c65+'-'+_0x17bd92+'/'+_0x18dc22)[_0x8c9b('0x2f')](_0x37876e);}return null;};}function patchUpdates(_0x24e94a){return function(_0x233730){try{jsonpatch[_0x8c9b('0x33')](_0x233730,_0x24e94a,!![]);}catch(_0x20ac61){return BPromise['reject'](_0x20ac61);}return _0x233730['save']();};}function saveUpdates(_0x3151ed,_0xb4c00f){return function(_0x5bb282){if(_0x5bb282){return _0x5bb282[_0x8c9b('0x34')](_0x3151ed)['then'](function(_0x3b183c){return _0x3b183c;});}return null;};}function removeEntity(_0x2cc7a0,_0x1258b4){return function(_0x3cb8de){if(_0x3cb8de){return _0x3cb8de[_0x8c9b('0x35')]()['then'](function(){var _0x39f3cf=_0x3cb8de[_0x8c9b('0x36')]({'plain':!![]});var _0x5cb1cb=_0x8c9b('0x37');return db['UserProfileResource'][_0x8c9b('0x35')]({'where':{'type':_0x5cb1cb,'resourceId':_0x39f3cf['id']}})[_0x8c9b('0x23')](function(){return _0x3cb8de;});})['then'](function(){_0x2cc7a0[_0x8c9b('0x2e')](0xcc)[_0x8c9b('0x38')]();});}};}function handleEntityNotFound(_0x49793f,_0x262e78){return function(_0x33164f){if(!_0x33164f){_0x49793f[_0x8c9b('0x2d')](0x194);}return _0x33164f;};}function handleError(_0x47f6b9,_0x31cb5c){_0x31cb5c=_0x31cb5c||0x1f4;return function(_0x3c38f5){logger[_0x8c9b('0x27')](_0x3c38f5[_0x8c9b('0x39')]);if(_0x3c38f5[_0x8c9b('0x3a')]){delete _0x3c38f5['name'];}_0x47f6b9[_0x8c9b('0x2e')](_0x31cb5c)['send'](_0x3c38f5);};}exports[_0x8c9b('0x3b')]=function(_0x506a70,_0x45eff3){var _0x17e17b={'include':[{'model':db[_0x8c9b('0x3c')],'as':'mandatoryDispositionPause'}]},_0x2b9680={},_0x343cec={'count':0x0,'rows':[]};var _0x2229ad=_[_0x8c9b('0x3d')](db[_0x8c9b('0x3e')][_0x8c9b('0x3f')],function(_0x593428){return{'name':_0x593428[_0x8c9b('0x40')],'type':_0x593428[_0x8c9b('0x41')][_0x8c9b('0x42')]};});_0x2b9680['model']=_[_0x8c9b('0x3d')](_0x2229ad,_0x8c9b('0x3a'));_0x2b9680[_0x8c9b('0x43')]=_[_0x8c9b('0x44')](_0x506a70[_0x8c9b('0x43')]);_0x2b9680[_0x8c9b('0x45')]=_[_0x8c9b('0x46')](_0x2b9680[_0x8c9b('0x47')],_0x2b9680['query']);_0x17e17b['attributes']=_[_0x8c9b('0x46')](_0x2b9680[_0x8c9b('0x47')],qs['fields'](_0x506a70[_0x8c9b('0x43')][_0x8c9b('0x48')]));_0x17e17b[_0x8c9b('0x49')]=_0x17e17b[_0x8c9b('0x49')][_0x8c9b('0x4a')]?_0x17e17b[_0x8c9b('0x49')]:_0x2b9680['model'];if(!_0x506a70[_0x8c9b('0x43')][_0x8c9b('0x4b')](_0x8c9b('0x4c'))){_0x17e17b[_0x8c9b('0x31')]=qs[_0x8c9b('0x31')](_0x506a70['query'][_0x8c9b('0x31')]);_0x17e17b[_0x8c9b('0x30')]=qs['offset'](_0x506a70[_0x8c9b('0x43')]['offset']);}_0x17e17b[_0x8c9b('0x4d')]=qs[_0x8c9b('0x4e')](_0x506a70[_0x8c9b('0x43')][_0x8c9b('0x4e')]);_0x17e17b['where']=qs[_0x8c9b('0x45')](_[_0x8c9b('0x4f')](_0x506a70[_0x8c9b('0x43')],_0x2b9680['filters']),_0x2229ad);if(_0x506a70[_0x8c9b('0x43')][_0x8c9b('0x50')]){_0x17e17b[_0x8c9b('0x51')]=_['merge'](_0x17e17b[_0x8c9b('0x51')],{'$or':_[_0x8c9b('0x3d')](_0x2229ad,function(_0x5ce5cd){if(_0x5ce5cd[_0x8c9b('0x41')]!==_0x8c9b('0x52')){var _0x8971f={};_0x8971f[_0x5ce5cd['name']]={'$like':'%'+_0x506a70[_0x8c9b('0x43')][_0x8c9b('0x50')]+'%'};return _0x8971f;}})});}_0x17e17b=_['merge']({},_0x17e17b,_0x506a70['options']);var _0x2e3b28={'where':_0x17e17b['where']};return db['OpenchannelAccount']['count'](_0x2e3b28)[_0x8c9b('0x23')](function(_0x4c6067){_0x343cec[_0x8c9b('0x53')]=_0x4c6067;if(_0x506a70['query']['includeAll']){_0x17e17b[_0x8c9b('0x54')]=[{'all':!![]}];}return db[_0x8c9b('0x3e')]['findAll'](_0x17e17b);})[_0x8c9b('0x23')](function(_0x5115ed){_0x343cec['rows']=_0x5115ed;return _0x343cec;})[_0x8c9b('0x23')](respondWithFilteredResult(_0x45eff3,_0x17e17b))[_0x8c9b('0x2c')](handleError(_0x45eff3,null));};exports[_0x8c9b('0x55')]=function(_0x54ffe0,_0x25c36e){var _0x27dc92={'raw':![],'where':{'id':_0x54ffe0[_0x8c9b('0x56')]['id']},'include':[{'model':db[_0x8c9b('0x3c')],'as':_0x8c9b('0x57')}]},_0x574053={};_0x574053[_0x8c9b('0x47')]=_[_0x8c9b('0x44')](db[_0x8c9b('0x3e')][_0x8c9b('0x3f')]);_0x574053[_0x8c9b('0x43')]=_[_0x8c9b('0x44')](_0x54ffe0[_0x8c9b('0x43')]);_0x574053[_0x8c9b('0x45')]=_[_0x8c9b('0x46')](_0x574053['model'],_0x574053[_0x8c9b('0x43')]);_0x27dc92[_0x8c9b('0x49')]=_[_0x8c9b('0x46')](_0x574053[_0x8c9b('0x47')],qs[_0x8c9b('0x48')](_0x54ffe0[_0x8c9b('0x43')][_0x8c9b('0x48')]));_0x27dc92[_0x8c9b('0x49')]=_0x27dc92[_0x8c9b('0x49')][_0x8c9b('0x4a')]?_0x27dc92[_0x8c9b('0x49')]:_0x574053[_0x8c9b('0x47')];if(_0x54ffe0[_0x8c9b('0x43')][_0x8c9b('0x58')]){_0x27dc92[_0x8c9b('0x54')]=[{'all':!![]}];}_0x27dc92=_[_0x8c9b('0x59')]({},_0x27dc92,_0x54ffe0[_0x8c9b('0x5a')]);return db[_0x8c9b('0x3e')][_0x8c9b('0x5b')](_0x27dc92)[_0x8c9b('0x23')](handleEntityNotFound(_0x25c36e,null))[_0x8c9b('0x23')](respondWithResult(_0x25c36e,null))[_0x8c9b('0x2c')](handleError(_0x25c36e,null));};exports['create']=function(_0x14aab0,_0x18c2b3){return db['OpenchannelAccount'][_0x8c9b('0x5c')](_0x14aab0[_0x8c9b('0x5d')],{})[_0x8c9b('0x23')](function(_0x284e7f){var _0x2a260d=_0x14aab0['user'][_0x8c9b('0x36')]({'plain':!![]});if(!_0x2a260d)throw new Error(_0x8c9b('0x5e'));if(_0x2a260d[_0x8c9b('0x5f')]===_0x8c9b('0x60')){var _0x41cb92=_0x284e7f[_0x8c9b('0x36')]({'plain':!![]});var _0x1ef3f8=_0x8c9b('0x37');return db['UserProfileSection'][_0x8c9b('0x5b')]({'where':{'name':_0x1ef3f8,'userProfileId':_0x2a260d[_0x8c9b('0x61')]},'raw':!![]})['then'](function(_0x2e5ae3){if(_0x2e5ae3&&_0x2e5ae3[_0x8c9b('0x62')]===0x0){return db[_0x8c9b('0x63')][_0x8c9b('0x5c')]({'name':_0x41cb92['name'],'resourceId':_0x41cb92['id'],'type':_0x2e5ae3[_0x8c9b('0x3a')],'sectionId':_0x2e5ae3['id']},{})['then'](function(){return _0x284e7f;});}else{return _0x284e7f;}})[_0x8c9b('0x2c')](function(_0x26c175){logger['error'](_0x8c9b('0x64'),_0x26c175);throw _0x26c175;});}return _0x284e7f;})[_0x8c9b('0x23')](respondWithResult(_0x18c2b3,0xc9))['catch'](handleError(_0x18c2b3,null));};exports[_0x8c9b('0x34')]=function(_0xf8c525,_0xa20cd3){if(_0xf8c525['body']['id']){delete _0xf8c525[_0x8c9b('0x5d')]['id'];}return db[_0x8c9b('0x3e')]['find']({'where':{'id':_0xf8c525['params']['id']},'include':[{'model':db[_0x8c9b('0x3c')],'as':'mandatoryDispositionPause'}]})[_0x8c9b('0x23')](handleEntityNotFound(_0xa20cd3,null))['then'](saveUpdates(_0xf8c525[_0x8c9b('0x5d')],null))[_0x8c9b('0x23')](respondWithResult(_0xa20cd3,null))[_0x8c9b('0x2c')](handleError(_0xa20cd3,null));};exports[_0x8c9b('0x35')]=function(_0x4f2e26,_0x2006ca){return db[_0x8c9b('0x3e')]['find']({'where':{'id':_0x4f2e26['params']['id']}})[_0x8c9b('0x23')](handleEntityNotFound(_0x2006ca,null))['then'](removeEntity(_0x2006ca,null))[_0x8c9b('0x2c')](handleError(_0x2006ca,null));};exports[_0x8c9b('0x65')]=function(_0x29a24d,_0x1437af){return db['OpenchannelAccount'][_0x8c9b('0x65')]()[_0x8c9b('0x23')](respondWithResult(_0x1437af,null))[_0x8c9b('0x2c')](handleError(_0x1437af,null));};exports[_0x8c9b('0x66')]=function(_0x240039,_0x5312a9,_0x2cccf3){if(_0x240039[_0x8c9b('0x5d')]['id']){delete _0x240039[_0x8c9b('0x5d')]['id'];}return db[_0x8c9b('0x3e')][_0x8c9b('0x5b')]({'where':{'id':_0x240039[_0x8c9b('0x56')]['id']}})[_0x8c9b('0x23')](handleEntityNotFound(_0x5312a9,null))[_0x8c9b('0x23')](function(_0x2c289c){if(_0x2c289c){_0x240039[_0x8c9b('0x5d')][_0x8c9b('0x67')]=_0x2c289c['id'];return db[_0x8c9b('0x68')]['create'](_0x240039[_0x8c9b('0x5d')]);}})[_0x8c9b('0x23')](respondWithResult(_0x5312a9,null))[_0x8c9b('0x2c')](handleError(_0x5312a9,null));};exports[_0x8c9b('0x69')]=function(_0x1d5baa,_0x147e6c,_0xef4c1a){var _0xd71ea0={'raw':![],'where':{}};var _0x1fd3a6={};var _0x36d260={'count':0x0,'rows':[]};return db[_0x8c9b('0x3e')][_0x8c9b('0x6a')]({'where':{'id':_0x1d5baa[_0x8c9b('0x56')]['id']}})['then'](handleEntityNotFound(_0x147e6c,null))[_0x8c9b('0x23')](function(_0x2f9495){if(_0x2f9495){_0x1fd3a6[_0x8c9b('0x47')]=_['keys'](db[_0x8c9b('0x68')][_0x8c9b('0x3f')]);_0x1fd3a6[_0x8c9b('0x43')]=_[_0x8c9b('0x44')](_0x1d5baa[_0x8c9b('0x43')]);_0x1fd3a6[_0x8c9b('0x45')]=_[_0x8c9b('0x46')](_0x1fd3a6[_0x8c9b('0x47')],_0x1fd3a6[_0x8c9b('0x43')]);_0xd71ea0[_0x8c9b('0x49')]=_[_0x8c9b('0x46')](_0x1fd3a6[_0x8c9b('0x47')],qs['fields'](_0x1d5baa[_0x8c9b('0x43')][_0x8c9b('0x48')]));_0xd71ea0[_0x8c9b('0x49')]=_0xd71ea0['attributes']['length']?_0xd71ea0['attributes']:_0x1fd3a6[_0x8c9b('0x47')];if(!_0x1d5baa[_0x8c9b('0x43')][_0x8c9b('0x4b')](_0x8c9b('0x4c'))){_0xd71ea0[_0x8c9b('0x31')]=qs[_0x8c9b('0x31')](_0x1d5baa[_0x8c9b('0x43')][_0x8c9b('0x31')]);_0xd71ea0[_0x8c9b('0x30')]=qs[_0x8c9b('0x30')](_0x1d5baa['query'][_0x8c9b('0x30')]);}_0xd71ea0[_0x8c9b('0x4d')]=qs[_0x8c9b('0x4e')](_0x1d5baa['query'][_0x8c9b('0x4e')]);_0xd71ea0[_0x8c9b('0x51')]=qs['filters'](_[_0x8c9b('0x4f')](_0x1d5baa[_0x8c9b('0x43')],_0x1fd3a6[_0x8c9b('0x45')]));_0xd71ea0['where']['OpenchannelAccountId']=_0x2f9495['id'];if(_0x1d5baa[_0x8c9b('0x43')][_0x8c9b('0x50')]){_0xd71ea0[_0x8c9b('0x51')]=_[_0x8c9b('0x59')](_0xd71ea0[_0x8c9b('0x51')],{'$or':_[_0x8c9b('0x3d')](_0xd71ea0[_0x8c9b('0x49')],function(_0x193fa1){var _0x532858={};_0x532858[_0x193fa1]={'$like':'%'+_0x1d5baa['query'][_0x8c9b('0x50')]+'%'};return _0x532858;})});}_0xd71ea0=_['merge']({},_0xd71ea0,_0x1d5baa['options']);return db[_0x8c9b('0x68')][_0x8c9b('0x53')]({'where':_0xd71ea0[_0x8c9b('0x51')]})[_0x8c9b('0x23')](function(_0x1e4e75){_0x36d260[_0x8c9b('0x53')]=_0x1e4e75;if(_0x1d5baa[_0x8c9b('0x43')][_0x8c9b('0x58')]){_0xd71ea0[_0x8c9b('0x54')]=[{'all':!![]}];}return db[_0x8c9b('0x68')]['findAll'](_0xd71ea0);})[_0x8c9b('0x23')](function(_0x5c0b66){_0x36d260[_0x8c9b('0x6b')]=_0x5c0b66;return _0x36d260;});}})[_0x8c9b('0x23')](respondWithFilteredResult(_0x147e6c,_0xd71ea0))[_0x8c9b('0x2c')](handleError(_0x147e6c,null));};exports[_0x8c9b('0x6c')]=function(_0x1484f2,_0x2d3239,_0x58ac0e){return db[_0x8c9b('0x3e')]['find']({'where':{'id':_0x1484f2[_0x8c9b('0x56')]['id']}})[_0x8c9b('0x23')](handleEntityNotFound(_0x2d3239,null))[_0x8c9b('0x23')](function(_0x3b6674){if(_0x3b6674){return _0x3b6674[_0x8c9b('0x6c')](_0x1484f2[_0x8c9b('0x43')]['ids']);}})[_0x8c9b('0x23')](respondWithStatusCode(_0x2d3239,null))['catch'](handleError(_0x2d3239,null));};exports[_0x8c9b('0x6d')]=function(_0x15c569,_0x49a3c1,_0x2d0bf3){if(_0x15c569[_0x8c9b('0x5d')]['id']){delete _0x15c569[_0x8c9b('0x5d')]['id'];}return db[_0x8c9b('0x3e')][_0x8c9b('0x5b')]({'where':{'id':_0x15c569['params']['id']}})[_0x8c9b('0x23')](handleEntityNotFound(_0x49a3c1,null))['then'](function(_0x2aab9e){if(_0x2aab9e){_0x15c569[_0x8c9b('0x5d')][_0x8c9b('0x67')]=_0x2aab9e['id'];return db['CannedAnswer'][_0x8c9b('0x5c')](_0x15c569[_0x8c9b('0x5d')]);}})[_0x8c9b('0x23')](respondWithResult(_0x49a3c1,null))[_0x8c9b('0x2c')](handleError(_0x49a3c1,null));};exports[_0x8c9b('0x6e')]=function(_0x102969,_0x11b7ab,_0x399ec7){var _0x387259={'raw':![],'where':{}};var _0x121bc8={};var _0x30dc3e={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x102969['params']['id']}})['then'](handleEntityNotFound(_0x11b7ab,null))['then'](function(_0x18e1bd){if(_0x18e1bd){_0x121bc8[_0x8c9b('0x47')]=_[_0x8c9b('0x44')](db[_0x8c9b('0x6f')][_0x8c9b('0x3f')]);_0x121bc8[_0x8c9b('0x43')]=_[_0x8c9b('0x44')](_0x102969[_0x8c9b('0x43')]);_0x121bc8[_0x8c9b('0x45')]=_[_0x8c9b('0x46')](_0x121bc8[_0x8c9b('0x47')],_0x121bc8[_0x8c9b('0x43')]);_0x387259[_0x8c9b('0x49')]=_[_0x8c9b('0x46')](_0x121bc8['model'],qs[_0x8c9b('0x48')](_0x102969['query'][_0x8c9b('0x48')]));_0x387259[_0x8c9b('0x49')]=_0x387259[_0x8c9b('0x49')][_0x8c9b('0x4a')]?_0x387259[_0x8c9b('0x49')]:_0x121bc8[_0x8c9b('0x47')];if(!_0x102969[_0x8c9b('0x43')]['hasOwnProperty'](_0x8c9b('0x4c'))){_0x387259[_0x8c9b('0x31')]=qs['limit'](_0x102969[_0x8c9b('0x43')][_0x8c9b('0x31')]);_0x387259['offset']=qs[_0x8c9b('0x30')](_0x102969['query']['offset']);}_0x387259['order']=qs[_0x8c9b('0x4e')](_0x102969[_0x8c9b('0x43')][_0x8c9b('0x4e')]);_0x387259[_0x8c9b('0x51')]=qs['filters'](_[_0x8c9b('0x4f')](_0x102969['query'],_0x121bc8['filters']));_0x387259[_0x8c9b('0x51')][_0x8c9b('0x67')]=_0x18e1bd['id'];if(_0x102969[_0x8c9b('0x43')][_0x8c9b('0x50')]){_0x387259[_0x8c9b('0x51')]=_[_0x8c9b('0x59')](_0x387259[_0x8c9b('0x51')],{'$or':_[_0x8c9b('0x3d')](_0x387259[_0x8c9b('0x49')],function(_0x3fcb5c){var _0x5217de={};_0x5217de[_0x3fcb5c]={'$like':'%'+_0x102969['query'][_0x8c9b('0x50')]+'%'};return _0x5217de;})});}_0x387259=_[_0x8c9b('0x59')]({},_0x387259,_0x102969[_0x8c9b('0x5a')]);return db[_0x8c9b('0x6f')][_0x8c9b('0x53')]({'where':_0x387259[_0x8c9b('0x51')]})[_0x8c9b('0x23')](function(_0x38e952){_0x30dc3e[_0x8c9b('0x53')]=_0x38e952;if(_0x102969[_0x8c9b('0x43')][_0x8c9b('0x58')]){_0x387259[_0x8c9b('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8c9b('0x70')](_0x387259);})['then'](function(_0x2d8eff){_0x30dc3e[_0x8c9b('0x6b')]=_0x2d8eff;return _0x30dc3e;});}})['then'](respondWithFilteredResult(_0x11b7ab,_0x387259))[_0x8c9b('0x2c')](handleError(_0x11b7ab,null));};exports[_0x8c9b('0x71')]=function(_0x365f99,_0x2cc151,_0x37b2df){return db[_0x8c9b('0x3e')]['find']({'where':{'id':_0x365f99[_0x8c9b('0x56')]['id']}})[_0x8c9b('0x23')](handleEntityNotFound(_0x2cc151,null))[_0x8c9b('0x23')](function(_0x1d830a){if(_0x1d830a){return _0x1d830a[_0x8c9b('0x71')](_0x365f99['query'][_0x8c9b('0x72')]);}})['then'](respondWithStatusCode(_0x2cc151,null))[_0x8c9b('0x2c')](handleError(_0x2cc151,null));};exports[_0x8c9b('0x73')]=function(_0x48b0d9,_0x1c9c47,_0x54d79c){var _0x2d6445={'body':_0x48b0d9[_0x8c9b('0x5d')],'channel':_0x8c9b('0x74')};var _0x38de6c=[];var _0xb962fa=[];var _0x4f66b6={};var _0x45fd59=![];return db[_0x8c9b('0x75')][_0x8c9b('0x65')]()['then'](function(_0x4298ee){if(!_0x4298ee){throw new db[(_0x8c9b('0x76'))][(_0x8c9b('0x77'))](_0x8c9b('0x78'));}_0x38de6c=_[_0x8c9b('0x79')](_[_0x8c9b('0x44')](_0x4298ee),[_0x8c9b('0x7a'),'updatedAt']);_0xb962fa=_[_0x8c9b('0x79')](_[_0x8c9b('0x44')](_0x4298ee),['createdAt',_0x8c9b('0x7b'),'CompanyId',_0x8c9b('0x7c')]);if(_0x48b0d9[_0x8c9b('0x5d')]['id']){delete _0x48b0d9[_0x8c9b('0x5d')]['id'];}if(_['isNil'](_0x48b0d9[_0x8c9b('0x5d')]['from'])){throw new db[(_0x8c9b('0x76'))][(_0x8c9b('0x77'))](_0x8c9b('0x7d'));}if(_[_0x8c9b('0x7e')](_0x48b0d9[_0x8c9b('0x5d')]['body'])||_0x48b0d9[_0x8c9b('0x5d')][_0x8c9b('0x5d')]===''){throw new db[(_0x8c9b('0x76'))]['ValidationError'](_0x8c9b('0x7f'));}if(_[_0x8c9b('0x7e')](_0x48b0d9[_0x8c9b('0x5d')][_0x8c9b('0x80')])){throw new db[(_0x8c9b('0x76'))][(_0x8c9b('0x77'))](_0x8c9b('0x81')+_0xb962fa);}if(!_[_0x8c9b('0x82')](_0xb962fa,_0x48b0d9[_0x8c9b('0x5d')][_0x8c9b('0x80')])){throw new db[(_0x8c9b('0x76'))][(_0x8c9b('0x77'))](_0x8c9b('0x83')+_0xb962fa);}_0x4f66b6[_0x48b0d9['body'][_0x8c9b('0x80')]]=_0x48b0d9['body'][_0x8c9b('0x84')];})['then'](function(){return db['OpenchannelAccount'][_0x8c9b('0x5b')]({'where':{'id':_0x48b0d9['params']['id']},'include':[{'model':db[_0x8c9b('0x85')],'as':_0x8c9b('0x86'),'include':[{'model':db[_0x8c9b('0x75')],'as':_0x8c9b('0x87'),'where':_0x4f66b6,'limit':0x1,'order':[[_0x8c9b('0x7b'),_0x8c9b('0x88')]]}]},{'model':db[_0x8c9b('0x89')],'as':_0x8c9b('0x8a')}]});})[_0x8c9b('0x23')](handleEntityNotFound(_0x1c9c47,null))[_0x8c9b('0x23')](function(_0x1a076b){if(_0x1a076b&&_0x1a076b[_0x8c9b('0x86')]){_0x2d6445[_0x8c9b('0x8b')]=_0x1a076b;_0x2d6445[_0x8c9b('0x8c')]=_0x1a076b[_0x8c9b('0x8a')];_0x2d6445[_0x8c9b('0x8d')]=_0x1a076b['List'];_0x2d6445[_0x8c9b('0x8c')]=_[_0x8c9b('0x8e')](_0x2d6445[_0x8c9b('0x8c')],[_0x8c9b('0x8f')],['asc']);if(_0x2d6445[_0x8c9b('0x8b')][_0x8c9b('0x8a')]){delete _0x2d6445[_0x8c9b('0x8b')][_0x8c9b('0x8a')];}if(_0x2d6445[_0x8c9b('0x8b')][_0x8c9b('0x86')]&&_0x2d6445['account'][_0x8c9b('0x86')][_0x8c9b('0x87')][_0x8c9b('0x4a')]){return _0x2d6445['account'][_0x8c9b('0x86')][_0x8c9b('0x87')][0x0];}var _0x1a80fe=_[_0x8c9b('0x1c')](_0x48b0d9['body'],{'firstName':_0x48b0d9[_0x8c9b('0x5d')]['from'],'ListId':_0x1a076b[_0x8c9b('0x7c')]});_0x1a80fe[_0x48b0d9[_0x8c9b('0x5d')][_0x8c9b('0x80')]]=_0x48b0d9[_0x8c9b('0x5d')]['from'];return db['CmContact'][_0x8c9b('0x5c')](_0x1a80fe,{'fields':_0x38de6c,'raw':!![]});}})['then'](handleEntityNotFound(_0x1c9c47,null))['then'](function(_0xa912d4){_0x2d6445['contact']=_0xa912d4;if(_0xa912d4){var _0x55427c={'ContactId':_0xa912d4['id'],'OpenchannelAccountId':_0x48b0d9[_0x8c9b('0x56')]['id'],'from':(_0xa912d4[_0x8c9b('0x90')]||'')+'\x20'+(_0xa912d4['lastName']||'')};var _0x1a24cc={'OpenchannelAccountId':_0x48b0d9['params']['id'],'closed':![]};if(_0x48b0d9[_0x8c9b('0x5d')][_0x8c9b('0x91')]){_0x1a24cc['threadId']=_0x48b0d9[_0x8c9b('0x5d')]['threadId'];return db[_0x8c9b('0x92')][_0x8c9b('0x5b')]({'where':_0x1a24cc})[_0x8c9b('0x23')](function(_0xfcad93){if(_0xfcad93){return[_0xfcad93,![]];}_0x55427c[_0x8c9b('0x91')]=_0x48b0d9[_0x8c9b('0x5d')][_0x8c9b('0x91')];_0x55427c[_0x8c9b('0x93')]=_0x48b0d9['body'][_0x8c9b('0x93')];return db[_0x8c9b('0x92')]['create'](_0x55427c)[_0x8c9b('0x23')](function(_0x1eb90a){return[_0x1eb90a,!![]];});});}else{_0x1a24cc[_0x8c9b('0x91')]=null;}_0x1a24cc[_0x8c9b('0x94')]=_0xa912d4['id'];return db[_0x8c9b('0x92')][_0x8c9b('0x5b')]({'where':_0x1a24cc})['then'](function(_0x2f5dc9){if(_0x2f5dc9){return[_0x2f5dc9,![]];}return db[_0x8c9b('0x92')][_0x8c9b('0x5c')](_0x55427c)[_0x8c9b('0x23')](function(_0x49bd82){return[_0x49bd82,!![]];});});}})[_0x8c9b('0x95')](function(_0x3157be,_0x30598d){if(_0x3157be){_0x45fd59=_0x30598d;if(!_0x30598d){var _0x2e511e={'from':(_0x2d6445['contact']['firstName']||'')+'\x20'+(_0x2d6445[_0x8c9b('0x96')]['lastName']||'')};if(_0x48b0d9[_0x8c9b('0x5d')][_0x8c9b('0x91')]&&_0x48b0d9['body'][_0x8c9b('0x97')]&&_0x48b0d9['body'][_0x8c9b('0x91')]!=_0x48b0d9[_0x8c9b('0x5d')]['messageId']){_0x2e511e[_0x8c9b('0x91')]=_0x48b0d9[_0x8c9b('0x5d')][_0x8c9b('0x97')];}return _0x3157be[_0x8c9b('0x34')](_0x2e511e);}else{return _0x3157be;}}})[_0x8c9b('0x23')](function(_0x4f621d){_0x2d6445[_0x8c9b('0x98')]=_0x4f621d[_0x8c9b('0x36')]({'plain':!![]});_0x2d6445[_0x8c9b('0x98')][_0x8c9b('0x99')]=_0x45fd59;if(_0x2d6445['interaction'][_0x8c9b('0x99')]){if(_0x2d6445[_0x8c9b('0x8b')][_0x8c9b('0x9a')]){_0x2d6445[_0x8c9b('0x8c')]['push']({'id':0x0,'priority':_0x2d6445['applications'][_0x8c9b('0x4a')]+0x1,'app':'close','appdata':_0x8c9b('0x9b'),'interval':'*,*,*,*'});}}return db[_0x8c9b('0x9c')]['create']({'body':_0x48b0d9['body'][_0x8c9b('0x5d')],'OpenchannelAccountId':_0x48b0d9[_0x8c9b('0x56')]['id'],'OpenchannelInteractionId':_0x4f621d['id'],'direction':'in','ContactId':_0x2d6445[_0x8c9b('0x96')]['id'],'AttachmentId':_0x48b0d9[_0x8c9b('0x5d')][_0x8c9b('0x9d')]});})[_0x8c9b('0x23')](function(_0x55f577){_0x2d6445['message']=_0x55f577;if(_0x2d6445[_0x8c9b('0x98')][_0x8c9b('0x9e')]){return db[_0x8c9b('0x9f')][_0x8c9b('0x5b')]({'attributes':['id',_0x8c9b('0x3a')],'where':{'id':_0x2d6445[_0x8c9b('0x98')][_0x8c9b('0x9e')]}})[_0x8c9b('0x23')](function(_0x4c5b1b){if(_0x4c5b1b){_0x2d6445[_0x8c9b('0x8c')][_0x8c9b('0xa0')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4c5b1b[_0x8c9b('0x3a')]+','+(_0x2d6445[_0x8c9b('0x8b')][_0x8c9b('0xa1')]||0xa),'interval':'*,*,*,*'});_0x2d6445[_0x8c9b('0xa2')]=![];}return respondWithRpcPromise(_0x8c9b('0xa3'),_0x8c9b('0xa4'),_0x2d6445);});}return respondWithRpcPromise('Start',_0x8c9b('0xa4'),_0x2d6445);})[_0x8c9b('0x23')](function(_0x5dd9b9){respondWithRpcPromise(_0x8c9b('0xa5'),_0x8c9b('0xa5'),{'event':_0x8c9b('0x73'),'message':_0x5dd9b9},client9002);return _0x5dd9b9;})['then'](respondWithResult(_0x1c9c47,null))['catch'](handleError(_0x1c9c47,null));};exports[_0x8c9b('0xa6')]=function(_0x5b5c47,_0x18c0b6,_0x39ea42){return db['OpenchannelAccount'][_0x8c9b('0x6a')]({'where':{'id':_0x5b5c47[_0x8c9b('0x56')]['id']}})[_0x8c9b('0x23')](handleEntityNotFound(_0x18c0b6,null))['then'](function(_0x3993fb){if(_0x3993fb){return db['sequelize'][_0x8c9b('0xa7')](function(_0x3b0c03){return db[_0x8c9b('0x89')][_0x8c9b('0x35')]({'where':{'OpenchannelAccountId':_0x5b5c47['params']['id']},'transaction':_0x3b0c03})[_0x8c9b('0x23')](function(_0x3ff102){var _0xd69fdd=_['map'](_0x5b5c47[_0x8c9b('0x5d')],function(_0x47dd60){_0x47dd60[_0x8c9b('0x67')]=_0x5b5c47[_0x8c9b('0x56')]['id'];return _0x47dd60;});return db['OpenchannelApplication']['bulkCreate'](_0xd69fdd,{'transaction':_0x3b0c03});});})[_0x8c9b('0x23')](function(){return db[_0x8c9b('0x89')][_0x8c9b('0xa8')]({'where':{'OpenchannelAccountId':_0x5b5c47[_0x8c9b('0x56')]['id']},'order':'priority'});});}})[_0x8c9b('0x23')](respondWithResult(_0x18c0b6,null))[_0x8c9b('0x2c')](handleError(_0x18c0b6,null));};exports[_0x8c9b('0xa9')]=function(_0xa661f5,_0x3c9bd6,_0x5a27c0){var _0x114dce={};var _0x1cbc1d={};var _0x2ca68e;var _0x2568bd;return db['OpenchannelAccount'][_0x8c9b('0x6a')]({'where':{'id':_0xa661f5[_0x8c9b('0x56')]['id']}})[_0x8c9b('0x23')](handleEntityNotFound(_0x3c9bd6,null))[_0x8c9b('0x23')](function(_0x5e5069){if(_0x5e5069){_0x2ca68e=_0x5e5069;_0x1cbc1d[_0x8c9b('0x47')]=_[_0x8c9b('0x44')](db[_0x8c9b('0x89')]['rawAttributes']);_0x1cbc1d[_0x8c9b('0x43')]=_[_0x8c9b('0x44')](_0xa661f5['query']);_0x1cbc1d[_0x8c9b('0x45')]=_['intersection'](_0x1cbc1d[_0x8c9b('0x47')],_0x1cbc1d[_0x8c9b('0x43')]);_0x114dce[_0x8c9b('0x49')]=_[_0x8c9b('0x46')](_0x1cbc1d[_0x8c9b('0x47')],qs[_0x8c9b('0x48')](_0xa661f5['query'][_0x8c9b('0x48')]));_0x114dce['attributes']=_0x114dce[_0x8c9b('0x49')][_0x8c9b('0x4a')]?_0x114dce['attributes']:_0x1cbc1d[_0x8c9b('0x47')];_0x114dce[_0x8c9b('0x4d')]=qs[_0x8c9b('0x4e')](_0xa661f5[_0x8c9b('0x43')][_0x8c9b('0x4e')]);_0x114dce[_0x8c9b('0x51')]=qs['filters'](_['pick'](_0xa661f5[_0x8c9b('0x43')],_0x1cbc1d['filters']));if(_0xa661f5[_0x8c9b('0x43')]['filter']){_0x114dce['where']=_[_0x8c9b('0x59')](_0x114dce[_0x8c9b('0x51')],{'$or':_[_0x8c9b('0x3d')](_0x114dce[_0x8c9b('0x49')],function(_0x1e3228){var _0x23dff5={};_0x23dff5[_0x1e3228]={'$like':'%'+_0xa661f5[_0x8c9b('0x43')][_0x8c9b('0x50')]+'%'};return _0x23dff5;})});}_0x114dce=_[_0x8c9b('0x59')]({},_0x114dce,_0xa661f5['options']);return _0x2ca68e[_0x8c9b('0xa9')](_0x114dce);}})[_0x8c9b('0x23')](function(_0x5d065){if(_0x5d065){_0x2568bd=_0x5d065[_0x8c9b('0x4a')];if(!_0xa661f5[_0x8c9b('0x43')]['hasOwnProperty'](_0x8c9b('0x4c'))){_0x114dce[_0x8c9b('0x31')]=qs['limit'](_0xa661f5[_0x8c9b('0x43')][_0x8c9b('0x31')]);_0x114dce[_0x8c9b('0x30')]=qs[_0x8c9b('0x30')](_0xa661f5[_0x8c9b('0x43')][_0x8c9b('0x30')]);}return _0x2ca68e['getApplications'](_0x114dce);}})['then'](function(_0x97ea6c){if(_0x97ea6c){return _0x97ea6c?{'count':_0x2568bd,'rows':_0x97ea6c}:null;}})[_0x8c9b('0x23')](respondWithResult(_0x3c9bd6,null))['catch'](handleError(_0x3c9bd6,null));};exports[_0x8c9b('0xaa')]=function(_0x430770,_0x1ffbbd,_0x149b6b){var _0x3fcafa={'raw':![],'where':{}};var _0x2e360d={};var _0x54466d={'count':0x0,'rows':[]};return db[_0x8c9b('0x3e')]['findOne']({'where':{'id':_0x430770[_0x8c9b('0x56')]['id']}})[_0x8c9b('0x23')](handleEntityNotFound(_0x1ffbbd,null))[_0x8c9b('0x23')](function(_0x599bde){if(_0x599bde){_0x2e360d[_0x8c9b('0x47')]=_['keys'](db[_0x8c9b('0x92')][_0x8c9b('0x3f')]);_0x2e360d[_0x8c9b('0x43')]=_[_0x8c9b('0x44')](_0x430770[_0x8c9b('0x43')]);_0x2e360d['filters']=_[_0x8c9b('0x46')](_0x2e360d[_0x8c9b('0x47')],_0x2e360d['query']);_0x3fcafa['attributes']=_[_0x8c9b('0x46')](_0x2e360d['model'],qs['fields'](_0x430770['query']['fields']));_0x3fcafa[_0x8c9b('0x49')]=_0x3fcafa[_0x8c9b('0x49')]['length']?_0x3fcafa[_0x8c9b('0x49')]:_0x2e360d['model'];if(!_0x430770[_0x8c9b('0x43')][_0x8c9b('0x4b')]('nolimit')){_0x3fcafa[_0x8c9b('0x31')]=qs[_0x8c9b('0x31')](_0x430770[_0x8c9b('0x43')][_0x8c9b('0x31')]);_0x3fcafa[_0x8c9b('0x30')]=qs[_0x8c9b('0x30')](_0x430770[_0x8c9b('0x43')][_0x8c9b('0x30')]);}_0x3fcafa[_0x8c9b('0x4d')]=qs['sort'](_0x430770[_0x8c9b('0x43')][_0x8c9b('0x4e')]);_0x3fcafa[_0x8c9b('0x51')]=qs[_0x8c9b('0x45')](_[_0x8c9b('0x4f')](_0x430770[_0x8c9b('0x43')],_0x2e360d[_0x8c9b('0x45')]));_0x3fcafa['where'][_0x8c9b('0x67')]=_0x599bde['id'];if(_0x430770['query'][_0x8c9b('0x50')]){_0x3fcafa[_0x8c9b('0x51')]=_[_0x8c9b('0x59')](_0x3fcafa[_0x8c9b('0x51')],{'$or':_[_0x8c9b('0x3d')](_0x3fcafa['attributes'],function(_0x1677bd){var _0x3ef6ee={};_0x3ef6ee[_0x1677bd]={'$like':'%'+_0x430770[_0x8c9b('0x43')]['filter']+'%'};return _0x3ef6ee;})});}_0x3fcafa=_[_0x8c9b('0x59')]({},_0x3fcafa,_0x430770['options']);return db[_0x8c9b('0x92')][_0x8c9b('0x53')]({'where':_0x3fcafa[_0x8c9b('0x51')]})['then'](function(_0x5b67a6){_0x54466d[_0x8c9b('0x53')]=_0x5b67a6;if(_0x430770[_0x8c9b('0x43')][_0x8c9b('0x58')]){_0x3fcafa[_0x8c9b('0x54')]=[{'model':db[_0x8c9b('0x75')],'as':'Contact','required':![]},{'model':db[_0x8c9b('0x9f')],'as':_0x8c9b('0xab'),'attributes':['name',_0x8c9b('0xac'),'internal'],'required':![]},{'model':db[_0x8c9b('0xad')],'as':_0x8c9b('0xae'),'attributes':['id',_0x8c9b('0x3a'),_0x8c9b('0xaf')],'where':_0x430770[_0x8c9b('0x43')][_0x8c9b('0xb0')]?{'id':_0x430770['query'][_0x8c9b('0xb0')]}:undefined,'required':_0x430770[_0x8c9b('0x43')][_0x8c9b('0xb0')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x8c9b('0x70')](_0x3fcafa);})[_0x8c9b('0x23')](function(_0x5caa45){_0x54466d[_0x8c9b('0x6b')]=_0x5caa45;return _0x54466d;});}})[_0x8c9b('0x23')](respondWithFilteredResult(_0x1ffbbd,_0x3fcafa))['catch'](handleError(_0x1ffbbd,null));};exports[_0x8c9b('0xb1')]=function(_0x5749a3,_0x29fc68,_0x4e643b){return db[_0x8c9b('0x3e')][_0x8c9b('0x5b')]({'where':{'id':_0x5749a3[_0x8c9b('0x56')]['id']}})[_0x8c9b('0x23')](handleEntityNotFound(_0x29fc68,null))[_0x8c9b('0x23')](function(_0x3277a0){if(_0x3277a0){return _0x3277a0[_0x8c9b('0xb1')](_0x5749a3['body'][_0x8c9b('0x72')],_[_0x8c9b('0xb2')](_0x5749a3[_0x8c9b('0x5d')],[_0x8c9b('0x72'),'id'])||{})[_0x8c9b('0x95')](function(_0x215ca3){for(var _0x492989=0x0;_0x492989<_0x5749a3[_0x8c9b('0x5d')][_0x8c9b('0x72')][_0x8c9b('0x4a')];_0x492989+=0x1){socket[_0x8c9b('0xb3')](_0x8c9b('0xb4'),{'UserId':_0x5749a3['body'][_0x8c9b('0x72')][_0x492989],'OpenchannelAccountId':_0x5749a3[_0x8c9b('0x56')]['id']});}return _0x215ca3;});}})[_0x8c9b('0x23')](respondWithResult(_0x29fc68,null))[_0x8c9b('0x2c')](handleError(_0x29fc68,null));};exports[_0x8c9b('0xb5')]=function(_0x5fcade,_0x3cfc4c,_0xf20482){return db[_0x8c9b('0x3e')][_0x8c9b('0x5b')]({'where':{'id':_0x5fcade['params']['id']}})[_0x8c9b('0x23')](handleEntityNotFound(_0x3cfc4c,null))[_0x8c9b('0x23')](function(_0x1c39ee){if(_0x1c39ee){return _0x1c39ee[_0x8c9b('0xb5')](_0x5fcade[_0x8c9b('0x43')][_0x8c9b('0x72')])['then'](function(){if(_[_0x8c9b('0xb6')](_0x5fcade[_0x8c9b('0x43')][_0x8c9b('0x72')])){for(var _0x3ca349=0x0;_0x3ca349<_0x5fcade[_0x8c9b('0x43')][_0x8c9b('0x72')][_0x8c9b('0x4a')];_0x3ca349+=0x1){socket[_0x8c9b('0xb3')](_0x8c9b('0xb7'),{'UserId':Number(_0x5fcade['query'][_0x8c9b('0x72')][_0x3ca349]),'OpenchannelAccountId':Number(_0x5fcade[_0x8c9b('0x56')]['id'])});}}else{socket[_0x8c9b('0xb3')](_0x8c9b('0xb7'),{'UserId':Number(_0x5fcade[_0x8c9b('0x43')][_0x8c9b('0x72')]),'OpenchannelAccountId':Number(_0x5fcade['params']['id'])});}});}})[_0x8c9b('0x23')](respondWithStatusCode(_0x3cfc4c,null))[_0x8c9b('0x2c')](handleError(_0x3cfc4c,null));};exports[_0x8c9b('0xb8')]=function(_0x595aa4,_0x4aa9d8,_0x260d51){var _0x14892e={};var _0x136db6={};var _0x142e66;var _0x2e2c75;return db[_0x8c9b('0x3e')][_0x8c9b('0x6a')]({'where':{'id':_0x595aa4[_0x8c9b('0x56')]['id']}})[_0x8c9b('0x23')](handleEntityNotFound(_0x4aa9d8,null))[_0x8c9b('0x23')](function(_0x3836de){if(_0x3836de){_0x142e66=_0x3836de;_0x136db6[_0x8c9b('0x47')]=_['keys'](db['User'][_0x8c9b('0x3f')]);_0x136db6[_0x8c9b('0x43')]=_[_0x8c9b('0x44')](_0x595aa4[_0x8c9b('0x43')]);_0x136db6[_0x8c9b('0x45')]=_[_0x8c9b('0x46')](_0x136db6[_0x8c9b('0x47')],_0x136db6[_0x8c9b('0x43')]);_0x14892e[_0x8c9b('0x49')]=_[_0x8c9b('0x46')](_0x136db6['model'],qs[_0x8c9b('0x48')](_0x595aa4['query'][_0x8c9b('0x48')]));_0x14892e[_0x8c9b('0x49')]=_0x14892e['attributes'][_0x8c9b('0x4a')]?_0x14892e[_0x8c9b('0x49')]:_0x136db6[_0x8c9b('0x47')];_0x14892e[_0x8c9b('0x4d')]=qs[_0x8c9b('0x4e')](_0x595aa4[_0x8c9b('0x43')]['sort']);_0x14892e[_0x8c9b('0x51')]=qs[_0x8c9b('0x45')](_['pick'](_0x595aa4[_0x8c9b('0x43')],_0x136db6[_0x8c9b('0x45')]));if(_0x595aa4[_0x8c9b('0x43')][_0x8c9b('0x50')]){_0x14892e[_0x8c9b('0x51')]=_['merge'](_0x14892e[_0x8c9b('0x51')],{'$or':_[_0x8c9b('0x3d')](_0x14892e[_0x8c9b('0x49')],function(_0x5481b3){var _0x3e9016={};_0x3e9016[_0x5481b3]={'$like':'%'+_0x595aa4[_0x8c9b('0x43')][_0x8c9b('0x50')]+'%'};return _0x3e9016;})});}_0x14892e=_['merge']({},_0x14892e,_0x595aa4['options']);return _0x142e66[_0x8c9b('0xb8')](_0x14892e);}})[_0x8c9b('0x23')](function(_0x3c2e2c){if(_0x3c2e2c){_0x2e2c75=_0x3c2e2c[_0x8c9b('0x4a')];if(!_0x595aa4[_0x8c9b('0x43')][_0x8c9b('0x4b')](_0x8c9b('0x4c'))){_0x14892e[_0x8c9b('0x31')]=qs[_0x8c9b('0x31')](_0x595aa4[_0x8c9b('0x43')][_0x8c9b('0x31')]);_0x14892e['offset']=qs[_0x8c9b('0x30')](_0x595aa4[_0x8c9b('0x43')][_0x8c9b('0x30')]);}return _0x142e66[_0x8c9b('0xb8')](_0x14892e);}})['then'](function(_0x3c9171){if(_0x3c9171){return _0x3c9171?{'count':_0x2e2c75,'rows':_0x3c9171}:null;}})[_0x8c9b('0x23')](respondWithResult(_0x4aa9d8,null))[_0x8c9b('0x2c')](handleError(_0x4aa9d8,null));};exports[_0x8c9b('0xb9')]=function(_0x376259,_0x4d255e,_0x5ee189){var _0x1cc5ba,_0x3d94e2,_0x57eb01;if(_[_0x8c9b('0x7e')](_0x376259[_0x8c9b('0x5d')][_0x8c9b('0x5d')])||_0x376259[_0x8c9b('0x5d')]['body']===''){throw new db['Sequelize']['ValidationError'](_0x8c9b('0x7f'));}if(_['isNil'](_0x376259[_0x8c9b('0x5d')]['to'])){}_0x1cc5ba=_0x376259['body']['to'];return db[_0x8c9b('0x3e')][_0x8c9b('0x6a')]({'where':{'id':_0x376259['params']['id']}})[_0x8c9b('0x23')](handleEntityNotFound(_0x4d255e,null))[_0x8c9b('0x23')](function(_0x4305cf){if(_0x4305cf){return db[_0x8c9b('0x3e')][_0x8c9b('0x5b')]({'where':{'id':_0x4305cf['id']},'include':[{'model':db['CmList'],'as':_0x8c9b('0x86'),'include':[{'model':db[_0x8c9b('0x75')],'as':_0x8c9b('0x87'),'where':{[_0x4305cf['mapKey']]:_0x1cc5ba},'limit':0x1,'order':[[_0x8c9b('0x7b'),_0x8c9b('0x88')]]}]}]})[_0x8c9b('0x23')](handleEntityNotFound(_0x4d255e,null))[_0x8c9b('0x23')](function(_0x6af1a4){if(_0x6af1a4&&_0x6af1a4[_0x8c9b('0x86')]){_0x3d94e2=_0x6af1a4['get']({'plain':!![]});if(_0x3d94e2[_0x8c9b('0x86')]&&_0x3d94e2[_0x8c9b('0x86')]['Contacts']['length']){return _0x3d94e2[_0x8c9b('0x86')]['Contacts'][0x0];}return db[_0x8c9b('0x75')][_0x8c9b('0x5c')](_[_0x8c9b('0x1c')](_0x376259['body'],{'firstName':_0x1cc5ba,[_0x6af1a4[_0x8c9b('0x80')]]:_0x1cc5ba,'phone':_0x1cc5ba,'ListId':_0x3d94e2[_0x8c9b('0x7c')]}));}})[_0x8c9b('0x23')](handleEntityNotFound(_0x4d255e,null))['then'](function(_0x4a892a){if(_0x4a892a){_0x57eb01=_0x4a892a;return db['OpenchannelInteraction'][_0x8c9b('0x5b')]({'where':{'ContactId':_0x57eb01['id'],'closed':![],'OpenchannelAccountId':_0x3d94e2['id']}})[_0x8c9b('0x23')](function(_0x56331c){if(_0x56331c){return[_0x56331c,![]];}return db['OpenchannelInteraction'][_0x8c9b('0x5c')]({'UserId':_0x376259[_0x8c9b('0x60')]['id'],'ContactId':_0x57eb01['id'],'OpenchannelAccountId':_0x3d94e2['id'],'lastMsgDirection':'out','Messages':[_[_0x8c9b('0x59')](_0x376259['body'],{'read':![],'body':_0x376259['body'][_0x8c9b('0x5d')],'OpenchannelAccountId':_0x3d94e2['id'],'UserId':_0x376259[_0x8c9b('0x60')]['id'],'ContactId':_0x57eb01['id']})]},{'include':[{'model':db[_0x8c9b('0x9c')],'as':_0x8c9b('0xba')}]})[_0x8c9b('0x23')](function(_0x212132){return[_0x212132,!![]];});});}})[_0x8c9b('0x95')](function(_0x4fed10,_0x5dc2bf){if(_0x5dc2bf){return _0x4fed10;}return db[_0x8c9b('0x9c')][_0x8c9b('0x5c')](_[_0x8c9b('0x59')](_0x376259['body'],{'read':![],'body':_0x376259[_0x8c9b('0x5d')][_0x8c9b('0x5d')],'OpenchannelAccountId':_0x3d94e2['id'],'OpenchannelInteractionId':_0x4fed10['id'],'UserId':_0x376259[_0x8c9b('0x60')]['id'],'ContactId':_0x57eb01['id']}))['then'](function(_0x521b3d){_0x4fed10[_0x8c9b('0xbb')][_0x8c9b('0xba')]=[];_0x4fed10[_0x8c9b('0xbb')][_0x8c9b('0xba')][_0x8c9b('0xbc')](_0x521b3d[_0x8c9b('0xbb')]);return _0x4fed10;});});}})['then'](respondWithResult(_0x4d255e,null))[_0x8c9b('0x2c')](handleError(_0x4d255e,null));}; \ No newline at end of file +var _0xbd1e=['reject','save','update','destroy','OpenchannelAccounts','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','rawAttributes','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','params','getAnswers','CannedAnswer','removeAnswers','ids','notify','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','isNil','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','AttachmentId','User','UserId','agent','Start','startRouting','EventManager','addApplications','transaction','findAndCountAll','getApplications','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','out','OpenchannelMessage','Messages','dataValues','push','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','then','request\x20sent','debug','stringify','error','message','OpenchannelAccount,\x20%s,\x20%s','info','result','sendStatus','status','json','count','offset','limit','set','Content-Range','apply'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xbd1e,0x13b));var _0xebd1=function(_0xb66df,_0x4fb5ce){_0xb66df=_0xb66df-0x0;var _0x42a702=_0xbd1e[_0xb66df];return _0x42a702;};'use strict';var emlformat=require(_0xebd1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xebd1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xebd1('0x2'));var moment=require('moment');var BPromise=require(_0xebd1('0x3'));var Mustache=require(_0xebd1('0x4'));var util=require(_0xebd1('0x5'));var path=require('path');var sox=require(_0xebd1('0x6'));var csv=require('to-csv');var ejs=require(_0xebd1('0x7'));var fs=require('fs');var fs_extra=require(_0xebd1('0x8'));var _=require(_0xebd1('0x9'));var squel=require(_0xebd1('0xa'));var crypto=require('crypto');var jsforce=require(_0xebd1('0xb'));var deskjs=require(_0xebd1('0xc'));var toCsv=require(_0xebd1('0xd'));var querystring=require('querystring');var Papa=require(_0xebd1('0xe'));var Redis=require(_0xebd1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xebd1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xebd1('0x11'))(_0xebd1('0x12'));var utils=require(_0xebd1('0x13'));var config=require(_0xebd1('0x14'));var licenseUtil=require(_0xebd1('0x15'));var db=require(_0xebd1('0x16'))['db'];config[_0xebd1('0x17')]=_[_0xebd1('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xebd1('0x19'))(new Redis(config[_0xebd1('0x17')]));require(_0xebd1('0x1a'))[_0xebd1('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xebd1('0x1c')][_0xebd1('0x1d')]({'port':0x232c});var client9002=jayson[_0xebd1('0x1c')][_0xebd1('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4b9d72,_0x27b3ab,_0x10d0b5,_0x2654e9){return new BPromise(function(_0x43bb93,_0x17b8b9){var _0x2410cf=_0x2654e9||client;return _0x2410cf[_0xebd1('0x1e')](_0x4b9d72,_0x10d0b5)[_0xebd1('0x1f')](function(_0x191bd8){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x27b3ab,_0xebd1('0x20'));logger[_0xebd1('0x21')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x27b3ab,_0xebd1('0x20'),JSON[_0xebd1('0x22')](_0x191bd8));if(_0x191bd8['error']){if(_0x191bd8[_0xebd1('0x23')]['code']===0x1f4){logger[_0xebd1('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x27b3ab,_0x191bd8[_0xebd1('0x23')][_0xebd1('0x24')]);return _0x17b8b9(_0x191bd8[_0xebd1('0x23')][_0xebd1('0x24')]);}logger[_0xebd1('0x23')](_0xebd1('0x25'),_0x27b3ab,_0x191bd8['error'][_0xebd1('0x24')]);return _0x43bb93(_0x191bd8[_0xebd1('0x23')][_0xebd1('0x24')]);}else{logger[_0xebd1('0x26')](_0xebd1('0x25'),_0x27b3ab,_0xebd1('0x20'));_0x43bb93(_0x191bd8[_0xebd1('0x27')][_0xebd1('0x24')]);}})['catch'](function(_0x446b96){logger['error'](_0xebd1('0x25'),_0x27b3ab,_0x446b96);_0x17b8b9(_0x446b96);});});}function respondWithStatusCode(_0xd2702f,_0x1d5753){_0x1d5753=_0x1d5753||0xcc;return function(_0x2cf97){if(_0x2cf97){return _0xd2702f[_0xebd1('0x28')](_0x1d5753);}return _0xd2702f[_0xebd1('0x29')](_0x1d5753)['end']();};}function respondWithResult(_0x196691,_0x3d8a25){_0x3d8a25=_0x3d8a25||0xc8;return function(_0x1b6419){if(_0x1b6419){return _0x196691[_0xebd1('0x29')](_0x3d8a25)[_0xebd1('0x2a')](_0x1b6419);}};}function respondWithFilteredResult(_0x2b8ccc,_0x3d31e1){return function(_0x341429){if(_0x341429){var _0x8eb1a9=_0x341429[_0xebd1('0x2b')],_0x2cb596=_0x3d31e1[_0xebd1('0x2c')],_0x19b02c=_0x3d31e1['offset']+_0x3d31e1[_0xebd1('0x2d')],_0x175b75;if(_0x19b02c>=_0x8eb1a9){_0x19b02c=_0x8eb1a9;_0x175b75=0xc8;}else{_0x175b75=0xce;}_0x2b8ccc[_0xebd1('0x29')](_0x175b75);return _0x2b8ccc[_0xebd1('0x2e')](_0xebd1('0x2f'),_0x2cb596+'-'+_0x19b02c+'/'+_0x8eb1a9)[_0xebd1('0x2a')](_0x341429);}return null;};}function patchUpdates(_0x12f616){return function(_0x5a767c){try{jsonpatch[_0xebd1('0x30')](_0x5a767c,_0x12f616,!![]);}catch(_0x3c0eb8){return BPromise[_0xebd1('0x31')](_0x3c0eb8);}return _0x5a767c[_0xebd1('0x32')]();};}function saveUpdates(_0x3a4743,_0x482f28){return function(_0x1e15ea){if(_0x1e15ea){return _0x1e15ea[_0xebd1('0x33')](_0x3a4743)['then'](function(_0x34f05f){return _0x34f05f;});}return null;};}function removeEntity(_0x34e666,_0x51ddee){return function(_0x36c496){if(_0x36c496){return _0x36c496[_0xebd1('0x34')]()[_0xebd1('0x1f')](function(){var _0x5acff9=_0x36c496['get']({'plain':!![]});var _0x6303a7=_0xebd1('0x35');return db['UserProfileResource']['destroy']({'where':{'type':_0x6303a7,'resourceId':_0x5acff9['id']}})[_0xebd1('0x1f')](function(){return _0x36c496;});})[_0xebd1('0x1f')](function(){_0x34e666['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x538d2d,_0x26d2a1){return function(_0x584481){if(!_0x584481){_0x538d2d[_0xebd1('0x28')](0x194);}return _0x584481;};}function handleError(_0x339063,_0x4b73ad){_0x4b73ad=_0x4b73ad||0x1f4;return function(_0x265017){logger[_0xebd1('0x23')](_0x265017['stack']);if(_0x265017[_0xebd1('0x36')]){delete _0x265017[_0xebd1('0x36')];}_0x339063[_0xebd1('0x29')](_0x4b73ad)[_0xebd1('0x37')](_0x265017);};}exports[_0xebd1('0x38')]=function(_0x5088ea,_0x2173a3){var _0x43e9b5={'include':[{'model':db[_0xebd1('0x39')],'as':_0xebd1('0x3a')}]},_0x2c61d9={},_0x8234a4={'count':0x0,'rows':[]};var _0x10b6ec=_[_0xebd1('0x3b')](db[_0xebd1('0x3c')]['rawAttributes'],function(_0x2f5891){return{'name':_0x2f5891[_0xebd1('0x3d')],'type':_0x2f5891['type'][_0xebd1('0x3e')]};});_0x2c61d9[_0xebd1('0x3f')]=_[_0xebd1('0x3b')](_0x10b6ec,_0xebd1('0x36'));_0x2c61d9[_0xebd1('0x40')]=_[_0xebd1('0x41')](_0x5088ea['query']);_0x2c61d9['filters']=_['intersection'](_0x2c61d9[_0xebd1('0x3f')],_0x2c61d9[_0xebd1('0x40')]);_0x43e9b5[_0xebd1('0x42')]=_[_0xebd1('0x43')](_0x2c61d9[_0xebd1('0x3f')],qs[_0xebd1('0x44')](_0x5088ea['query'][_0xebd1('0x44')]));_0x43e9b5[_0xebd1('0x42')]=_0x43e9b5[_0xebd1('0x42')][_0xebd1('0x45')]?_0x43e9b5[_0xebd1('0x42')]:_0x2c61d9['model'];if(!_0x5088ea[_0xebd1('0x40')][_0xebd1('0x46')](_0xebd1('0x47'))){_0x43e9b5[_0xebd1('0x2d')]=qs['limit'](_0x5088ea[_0xebd1('0x40')]['limit']);_0x43e9b5[_0xebd1('0x2c')]=qs[_0xebd1('0x2c')](_0x5088ea[_0xebd1('0x40')][_0xebd1('0x2c')]);}_0x43e9b5[_0xebd1('0x48')]=qs[_0xebd1('0x49')](_0x5088ea[_0xebd1('0x40')][_0xebd1('0x49')]);_0x43e9b5[_0xebd1('0x4a')]=qs[_0xebd1('0x4b')](_[_0xebd1('0x4c')](_0x5088ea['query'],_0x2c61d9[_0xebd1('0x4b')]),_0x10b6ec);if(_0x5088ea[_0xebd1('0x40')][_0xebd1('0x4d')]){_0x43e9b5[_0xebd1('0x4a')]=_[_0xebd1('0x4e')](_0x43e9b5['where'],{'$or':_[_0xebd1('0x3b')](_0x10b6ec,function(_0x1d3693){if(_0x1d3693['type']!==_0xebd1('0x4f')){var _0x3b0b06={};_0x3b0b06[_0x1d3693[_0xebd1('0x36')]]={'$like':'%'+_0x5088ea[_0xebd1('0x40')][_0xebd1('0x4d')]+'%'};return _0x3b0b06;}})});}_0x43e9b5=_[_0xebd1('0x4e')]({},_0x43e9b5,_0x5088ea['options']);var _0x22135b={'where':_0x43e9b5[_0xebd1('0x4a')]};return db['OpenchannelAccount'][_0xebd1('0x2b')](_0x22135b)[_0xebd1('0x1f')](function(_0x43778d){_0x8234a4[_0xebd1('0x2b')]=_0x43778d;if(_0x5088ea[_0xebd1('0x40')]['includeAll']){_0x43e9b5[_0xebd1('0x50')]=[{'all':!![]}];}return db[_0xebd1('0x3c')][_0xebd1('0x51')](_0x43e9b5);})[_0xebd1('0x1f')](function(_0x50b4bc){_0x8234a4[_0xebd1('0x52')]=_0x50b4bc;return _0x8234a4;})[_0xebd1('0x1f')](respondWithFilteredResult(_0x2173a3,_0x43e9b5))[_0xebd1('0x53')](handleError(_0x2173a3,null));};exports[_0xebd1('0x54')]=function(_0x45b797,_0x42743e){var _0x2b3db1={'raw':![],'where':{'id':_0x45b797['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x21286f={};_0x21286f[_0xebd1('0x3f')]=_[_0xebd1('0x41')](db[_0xebd1('0x3c')][_0xebd1('0x55')]);_0x21286f[_0xebd1('0x40')]=_[_0xebd1('0x41')](_0x45b797[_0xebd1('0x40')]);_0x21286f['filters']=_['intersection'](_0x21286f[_0xebd1('0x3f')],_0x21286f[_0xebd1('0x40')]);_0x2b3db1[_0xebd1('0x42')]=_[_0xebd1('0x43')](_0x21286f[_0xebd1('0x3f')],qs[_0xebd1('0x44')](_0x45b797[_0xebd1('0x40')]['fields']));_0x2b3db1[_0xebd1('0x42')]=_0x2b3db1[_0xebd1('0x42')][_0xebd1('0x45')]?_0x2b3db1[_0xebd1('0x42')]:_0x21286f[_0xebd1('0x3f')];if(_0x45b797[_0xebd1('0x40')][_0xebd1('0x56')]){_0x2b3db1[_0xebd1('0x50')]=[{'all':!![]}];}_0x2b3db1=_[_0xebd1('0x4e')]({},_0x2b3db1,_0x45b797[_0xebd1('0x57')]);return db[_0xebd1('0x3c')][_0xebd1('0x58')](_0x2b3db1)[_0xebd1('0x1f')](handleEntityNotFound(_0x42743e,null))[_0xebd1('0x1f')](respondWithResult(_0x42743e,null))[_0xebd1('0x53')](handleError(_0x42743e,null));};exports[_0xebd1('0x59')]=function(_0x30b73f,_0x4bf3de){return db[_0xebd1('0x3c')]['create'](_0x30b73f['body'],{})[_0xebd1('0x1f')](function(_0x58a10d){var _0x5992c0=_0x30b73f[_0xebd1('0x5a')]['get']({'plain':!![]});if(!_0x5992c0)throw new Error(_0xebd1('0x5b'));if(_0x5992c0[_0xebd1('0x5c')]===_0xebd1('0x5a')){var _0x4bdcbb=_0x58a10d[_0xebd1('0x5d')]({'plain':!![]});var _0x2958f2=_0xebd1('0x35');return db['UserProfileSection'][_0xebd1('0x58')]({'where':{'name':_0x2958f2,'userProfileId':_0x5992c0['userProfileId']},'raw':!![]})['then'](function(_0x871ffd){if(_0x871ffd&&_0x871ffd[_0xebd1('0x5e')]===0x0){return db[_0xebd1('0x5f')]['create']({'name':_0x4bdcbb[_0xebd1('0x36')],'resourceId':_0x4bdcbb['id'],'type':_0x871ffd[_0xebd1('0x36')],'sectionId':_0x871ffd['id']},{})[_0xebd1('0x1f')](function(){return _0x58a10d;});}else{return _0x58a10d;}})[_0xebd1('0x53')](function(_0x40061f){logger['error'](_0xebd1('0x60'),_0x40061f);throw _0x40061f;});}return _0x58a10d;})[_0xebd1('0x1f')](respondWithResult(_0x4bf3de,0xc9))[_0xebd1('0x53')](handleError(_0x4bf3de,null));};exports[_0xebd1('0x33')]=function(_0x1d441a,_0x294d23){if(_0x1d441a[_0xebd1('0x61')]['id']){delete _0x1d441a[_0xebd1('0x61')]['id'];}return db[_0xebd1('0x3c')][_0xebd1('0x58')]({'where':{'id':_0x1d441a['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x294d23,null))[_0xebd1('0x1f')](saveUpdates(_0x1d441a[_0xebd1('0x61')],null))[_0xebd1('0x1f')](respondWithResult(_0x294d23,null))[_0xebd1('0x53')](handleError(_0x294d23,null));};exports[_0xebd1('0x34')]=function(_0x4f9508,_0x48dfdd){return db[_0xebd1('0x3c')]['find']({'where':{'id':_0x4f9508['params']['id']}})[_0xebd1('0x1f')](handleEntityNotFound(_0x48dfdd,null))[_0xebd1('0x1f')](removeEntity(_0x48dfdd,null))[_0xebd1('0x53')](handleError(_0x48dfdd,null));};exports['describe']=function(_0x1d55b7,_0x1a01ca){return db[_0xebd1('0x3c')][_0xebd1('0x62')]()[_0xebd1('0x1f')](respondWithResult(_0x1a01ca,null))[_0xebd1('0x53')](handleError(_0x1a01ca,null));};exports['addDisposition']=function(_0x178ceb,_0x4cef21,_0x44119d){if(_0x178ceb[_0xebd1('0x61')]['id']){delete _0x178ceb[_0xebd1('0x61')]['id'];}return db['OpenchannelAccount'][_0xebd1('0x58')]({'where':{'id':_0x178ceb['params']['id']}})[_0xebd1('0x1f')](handleEntityNotFound(_0x4cef21,null))[_0xebd1('0x1f')](function(_0x5ec9f4){if(_0x5ec9f4){_0x178ceb['body'][_0xebd1('0x63')]=_0x5ec9f4['id'];return db[_0xebd1('0x64')][_0xebd1('0x59')](_0x178ceb[_0xebd1('0x61')]);}})[_0xebd1('0x1f')](respondWithResult(_0x4cef21,null))[_0xebd1('0x53')](handleError(_0x4cef21,null));};exports[_0xebd1('0x65')]=function(_0x553a57,_0x4488e0,_0xf76f49){var _0x5cead4={'raw':![],'where':{}};var _0x32c4e7={};var _0x12cfef={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xebd1('0x66')]({'where':{'id':_0x553a57['params']['id']}})[_0xebd1('0x1f')](handleEntityNotFound(_0x4488e0,null))['then'](function(_0x455511){if(_0x455511){_0x32c4e7[_0xebd1('0x3f')]=_['keys'](db[_0xebd1('0x64')][_0xebd1('0x55')]);_0x32c4e7[_0xebd1('0x40')]=_['keys'](_0x553a57[_0xebd1('0x40')]);_0x32c4e7[_0xebd1('0x4b')]=_['intersection'](_0x32c4e7['model'],_0x32c4e7['query']);_0x5cead4['attributes']=_[_0xebd1('0x43')](_0x32c4e7['model'],qs[_0xebd1('0x44')](_0x553a57[_0xebd1('0x40')][_0xebd1('0x44')]));_0x5cead4['attributes']=_0x5cead4[_0xebd1('0x42')]['length']?_0x5cead4['attributes']:_0x32c4e7['model'];if(!_0x553a57['query'][_0xebd1('0x46')](_0xebd1('0x47'))){_0x5cead4['limit']=qs['limit'](_0x553a57[_0xebd1('0x40')]['limit']);_0x5cead4[_0xebd1('0x2c')]=qs[_0xebd1('0x2c')](_0x553a57[_0xebd1('0x40')][_0xebd1('0x2c')]);}_0x5cead4['order']=qs['sort'](_0x553a57[_0xebd1('0x40')]['sort']);_0x5cead4['where']=qs[_0xebd1('0x4b')](_[_0xebd1('0x4c')](_0x553a57[_0xebd1('0x40')],_0x32c4e7[_0xebd1('0x4b')]));_0x5cead4[_0xebd1('0x4a')][_0xebd1('0x63')]=_0x455511['id'];if(_0x553a57[_0xebd1('0x40')]['filter']){_0x5cead4[_0xebd1('0x4a')]=_[_0xebd1('0x4e')](_0x5cead4[_0xebd1('0x4a')],{'$or':_[_0xebd1('0x3b')](_0x5cead4[_0xebd1('0x42')],function(_0x294e2d){var _0x4bc425={};_0x4bc425[_0x294e2d]={'$like':'%'+_0x553a57[_0xebd1('0x40')][_0xebd1('0x4d')]+'%'};return _0x4bc425;})});}_0x5cead4=_['merge']({},_0x5cead4,_0x553a57[_0xebd1('0x57')]);return db[_0xebd1('0x64')][_0xebd1('0x2b')]({'where':_0x5cead4[_0xebd1('0x4a')]})[_0xebd1('0x1f')](function(_0x160f20){_0x12cfef[_0xebd1('0x2b')]=_0x160f20;if(_0x553a57[_0xebd1('0x40')][_0xebd1('0x56')]){_0x5cead4['include']=[{'all':!![]}];}return db[_0xebd1('0x64')]['findAll'](_0x5cead4);})[_0xebd1('0x1f')](function(_0x190d75){_0x12cfef[_0xebd1('0x52')]=_0x190d75;return _0x12cfef;});}})[_0xebd1('0x1f')](respondWithFilteredResult(_0x4488e0,_0x5cead4))[_0xebd1('0x53')](handleError(_0x4488e0,null));};exports[_0xebd1('0x67')]=function(_0x4e3749,_0x5a2231,_0x1a1db0){return db[_0xebd1('0x3c')]['find']({'where':{'id':_0x4e3749['params']['id']}})[_0xebd1('0x1f')](handleEntityNotFound(_0x5a2231,null))['then'](function(_0x500f32){if(_0x500f32){return _0x500f32[_0xebd1('0x67')](_0x4e3749[_0xebd1('0x40')]['ids']);}})['then'](respondWithStatusCode(_0x5a2231,null))[_0xebd1('0x53')](handleError(_0x5a2231,null));};exports[_0xebd1('0x68')]=function(_0x457d3b,_0x2724af,_0x1ef3da){if(_0x457d3b['body']['id']){delete _0x457d3b['body']['id'];}return db[_0xebd1('0x3c')]['find']({'where':{'id':_0x457d3b[_0xebd1('0x69')]['id']}})[_0xebd1('0x1f')](handleEntityNotFound(_0x2724af,null))[_0xebd1('0x1f')](function(_0x33e858){if(_0x33e858){_0x457d3b[_0xebd1('0x61')][_0xebd1('0x63')]=_0x33e858['id'];return db['CannedAnswer'][_0xebd1('0x59')](_0x457d3b['body']);}})[_0xebd1('0x1f')](respondWithResult(_0x2724af,null))[_0xebd1('0x53')](handleError(_0x2724af,null));};exports[_0xebd1('0x6a')]=function(_0x1c2296,_0x1d6aab,_0x5d777f){var _0x3c4f39={'raw':![],'where':{}};var _0x55b14e={};var _0x399987={'count':0x0,'rows':[]};return db[_0xebd1('0x3c')][_0xebd1('0x66')]({'where':{'id':_0x1c2296[_0xebd1('0x69')]['id']}})[_0xebd1('0x1f')](handleEntityNotFound(_0x1d6aab,null))['then'](function(_0x221563){if(_0x221563){_0x55b14e[_0xebd1('0x3f')]=_[_0xebd1('0x41')](db[_0xebd1('0x6b')][_0xebd1('0x55')]);_0x55b14e[_0xebd1('0x40')]=_[_0xebd1('0x41')](_0x1c2296['query']);_0x55b14e[_0xebd1('0x4b')]=_['intersection'](_0x55b14e['model'],_0x55b14e[_0xebd1('0x40')]);_0x3c4f39[_0xebd1('0x42')]=_[_0xebd1('0x43')](_0x55b14e['model'],qs[_0xebd1('0x44')](_0x1c2296[_0xebd1('0x40')][_0xebd1('0x44')]));_0x3c4f39['attributes']=_0x3c4f39[_0xebd1('0x42')]['length']?_0x3c4f39[_0xebd1('0x42')]:_0x55b14e[_0xebd1('0x3f')];if(!_0x1c2296[_0xebd1('0x40')][_0xebd1('0x46')](_0xebd1('0x47'))){_0x3c4f39[_0xebd1('0x2d')]=qs[_0xebd1('0x2d')](_0x1c2296[_0xebd1('0x40')][_0xebd1('0x2d')]);_0x3c4f39[_0xebd1('0x2c')]=qs[_0xebd1('0x2c')](_0x1c2296[_0xebd1('0x40')]['offset']);}_0x3c4f39[_0xebd1('0x48')]=qs[_0xebd1('0x49')](_0x1c2296[_0xebd1('0x40')][_0xebd1('0x49')]);_0x3c4f39['where']=qs['filters'](_[_0xebd1('0x4c')](_0x1c2296[_0xebd1('0x40')],_0x55b14e[_0xebd1('0x4b')]));_0x3c4f39[_0xebd1('0x4a')][_0xebd1('0x63')]=_0x221563['id'];if(_0x1c2296[_0xebd1('0x40')][_0xebd1('0x4d')]){_0x3c4f39['where']=_[_0xebd1('0x4e')](_0x3c4f39[_0xebd1('0x4a')],{'$or':_[_0xebd1('0x3b')](_0x3c4f39['attributes'],function(_0x4575ae){var _0x5c7d16={};_0x5c7d16[_0x4575ae]={'$like':'%'+_0x1c2296['query'][_0xebd1('0x4d')]+'%'};return _0x5c7d16;})});}_0x3c4f39=_[_0xebd1('0x4e')]({},_0x3c4f39,_0x1c2296[_0xebd1('0x57')]);return db[_0xebd1('0x6b')][_0xebd1('0x2b')]({'where':_0x3c4f39['where']})['then'](function(_0x402804){_0x399987[_0xebd1('0x2b')]=_0x402804;if(_0x1c2296[_0xebd1('0x40')][_0xebd1('0x56')]){_0x3c4f39['include']=[{'all':!![]}];}return db[_0xebd1('0x6b')]['findAll'](_0x3c4f39);})['then'](function(_0x26eb66){_0x399987[_0xebd1('0x52')]=_0x26eb66;return _0x399987;});}})[_0xebd1('0x1f')](respondWithFilteredResult(_0x1d6aab,_0x3c4f39))[_0xebd1('0x53')](handleError(_0x1d6aab,null));};exports[_0xebd1('0x6c')]=function(_0x5cc980,_0x51b5f8,_0x47125e){return db['OpenchannelAccount'][_0xebd1('0x58')]({'where':{'id':_0x5cc980[_0xebd1('0x69')]['id']}})['then'](handleEntityNotFound(_0x51b5f8,null))[_0xebd1('0x1f')](function(_0x6946f4){if(_0x6946f4){return _0x6946f4[_0xebd1('0x6c')](_0x5cc980['query'][_0xebd1('0x6d')]);}})[_0xebd1('0x1f')](respondWithStatusCode(_0x51b5f8,null))[_0xebd1('0x53')](handleError(_0x51b5f8,null));};exports[_0xebd1('0x6e')]=function(_0x158c63,_0x254f66,_0x41591d){var _0xd1147d={'body':_0x158c63[_0xebd1('0x61')],'channel':'openchannel'};var _0x395a77=[];var _0x1570f3=[];var _0x37648e={};var _0x40517f=![];return db['CmContact'][_0xebd1('0x62')]()[_0xebd1('0x1f')](function(_0x5f0ea9){if(!_0x5f0ea9){throw new db[(_0xebd1('0x6f'))]['ValidationError'](_0xebd1('0x70'));}_0x395a77=_[_0xebd1('0x71')](_[_0xebd1('0x41')](_0x5f0ea9),['createdAt',_0xebd1('0x72')]);_0x1570f3=_[_0xebd1('0x71')](_['keys'](_0x5f0ea9),[_0xebd1('0x73'),_0xebd1('0x72'),_0xebd1('0x74'),_0xebd1('0x75')]);if(_0x158c63[_0xebd1('0x61')]['id']){delete _0x158c63[_0xebd1('0x61')]['id'];}if(_[_0xebd1('0x76')](_0x158c63[_0xebd1('0x61')][_0xebd1('0x77')])){throw new db[(_0xebd1('0x6f'))][(_0xebd1('0x78'))]('from\x20is\x20mandatory');}if(_[_0xebd1('0x76')](_0x158c63[_0xebd1('0x61')][_0xebd1('0x61')])||_0x158c63['body'][_0xebd1('0x61')]===''){throw new db[(_0xebd1('0x6f'))][(_0xebd1('0x78'))](_0xebd1('0x79'));}if(_[_0xebd1('0x76')](_0x158c63['body']['mapKey'])){throw new db[(_0xebd1('0x6f'))][(_0xebd1('0x78'))](_0xebd1('0x7a')+_0x1570f3);}if(!_[_0xebd1('0x7b')](_0x1570f3,_0x158c63[_0xebd1('0x61')][_0xebd1('0x7c')])){throw new db[(_0xebd1('0x6f'))][(_0xebd1('0x78'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1570f3);}_0x37648e[_0x158c63[_0xebd1('0x61')]['mapKey']]=_0x158c63[_0xebd1('0x61')][_0xebd1('0x77')];})[_0xebd1('0x1f')](function(){return db[_0xebd1('0x3c')][_0xebd1('0x58')]({'where':{'id':_0x158c63[_0xebd1('0x69')]['id']},'include':[{'model':db['CmList'],'as':_0xebd1('0x7d'),'include':[{'model':db[_0xebd1('0x7e')],'as':_0xebd1('0x7f'),'where':_0x37648e,'limit':0x1,'order':[[_0xebd1('0x72'),_0xebd1('0x80')]]}]},{'model':db[_0xebd1('0x81')],'as':_0xebd1('0x82')}]});})[_0xebd1('0x1f')](handleEntityNotFound(_0x254f66,null))[_0xebd1('0x1f')](function(_0x310bdc){if(_0x310bdc&&_0x310bdc[_0xebd1('0x7d')]){_0xd1147d[_0xebd1('0x83')]=_0x310bdc;_0xd1147d[_0xebd1('0x84')]=_0x310bdc[_0xebd1('0x82')];_0xd1147d['list']=_0x310bdc[_0xebd1('0x7d')];_0xd1147d['applications']=_[_0xebd1('0x85')](_0xd1147d[_0xebd1('0x84')],[_0xebd1('0x86')],[_0xebd1('0x87')]);if(_0xd1147d[_0xebd1('0x83')][_0xebd1('0x82')]){delete _0xd1147d[_0xebd1('0x83')][_0xebd1('0x82')];}if(_0xd1147d[_0xebd1('0x83')]['List']&&_0xd1147d[_0xebd1('0x83')][_0xebd1('0x7d')][_0xebd1('0x7f')][_0xebd1('0x45')]){return _0xd1147d['account'][_0xebd1('0x7d')][_0xebd1('0x7f')][0x0];}var _0x27be02=_[_0xebd1('0x18')](_0x158c63[_0xebd1('0x61')],{'firstName':_0x158c63[_0xebd1('0x61')][_0xebd1('0x77')],'ListId':_0x310bdc[_0xebd1('0x75')]});_0x27be02[_0x158c63[_0xebd1('0x61')][_0xebd1('0x7c')]]=_0x158c63['body'][_0xebd1('0x77')];return db[_0xebd1('0x7e')]['create'](_0x27be02,{'fields':_0x395a77,'raw':!![]});}})[_0xebd1('0x1f')](handleEntityNotFound(_0x254f66,null))[_0xebd1('0x1f')](function(_0x13596d){_0xd1147d[_0xebd1('0x88')]=_0x13596d;if(_0x13596d){var _0x3a500d={'ContactId':_0x13596d['id'],'OpenchannelAccountId':_0x158c63[_0xebd1('0x69')]['id'],'from':(_0x13596d['firstName']||'')+'\x20'+(_0x13596d[_0xebd1('0x89')]||'')};var _0x5c6777={'OpenchannelAccountId':_0x158c63[_0xebd1('0x69')]['id'],'closed':![]};if(_0x158c63[_0xebd1('0x61')]['threadId']){_0x5c6777[_0xebd1('0x8a')]=_0x158c63['body'][_0xebd1('0x8a')];return db[_0xebd1('0x8b')][_0xebd1('0x58')]({'where':_0x5c6777})[_0xebd1('0x1f')](function(_0x1ef58d){if(_0x1ef58d){return[_0x1ef58d,![]];}_0x3a500d[_0xebd1('0x8a')]=_0x158c63[_0xebd1('0x61')][_0xebd1('0x8a')];_0x3a500d[_0xebd1('0x8c')]=_0x158c63[_0xebd1('0x61')]['externalUrl'];return db[_0xebd1('0x8b')][_0xebd1('0x59')](_0x3a500d)[_0xebd1('0x1f')](function(_0x546aaf){return[_0x546aaf,!![]];});});}else{_0x5c6777[_0xebd1('0x8a')]=null;}_0x5c6777[_0xebd1('0x8d')]=_0x13596d['id'];return db[_0xebd1('0x8b')]['find']({'where':_0x5c6777})[_0xebd1('0x1f')](function(_0x55e73a){if(_0x55e73a){return[_0x55e73a,![]];}return db[_0xebd1('0x8b')]['create'](_0x3a500d)[_0xebd1('0x1f')](function(_0x35a615){return[_0x35a615,!![]];});});}})[_0xebd1('0x8e')](function(_0xca93c8,_0x16da63){if(_0xca93c8){_0x40517f=_0x16da63;if(!_0x16da63){var _0xd9d108={'from':(_0xd1147d[_0xebd1('0x88')][_0xebd1('0x8f')]||'')+'\x20'+(_0xd1147d[_0xebd1('0x88')]['lastName']||'')};if(_0x158c63[_0xebd1('0x61')]['threadId']&&_0x158c63[_0xebd1('0x61')][_0xebd1('0x90')]&&_0x158c63[_0xebd1('0x61')][_0xebd1('0x8a')]!=_0x158c63['body'][_0xebd1('0x90')]){_0xd9d108[_0xebd1('0x8a')]=_0x158c63['body'][_0xebd1('0x90')];}return _0xca93c8[_0xebd1('0x33')](_0xd9d108);}else{return _0xca93c8;}}})[_0xebd1('0x1f')](function(_0x55d6c7){_0xd1147d[_0xebd1('0x91')]=_0x55d6c7['get']({'plain':!![]});_0xd1147d[_0xebd1('0x91')][_0xebd1('0x92')]=_0x40517f;if(_0xd1147d[_0xebd1('0x91')][_0xebd1('0x92')]){if(_0xd1147d[_0xebd1('0x83')][_0xebd1('0x93')]){_0xd1147d[_0xebd1('0x84')]['push']({'id':0x0,'priority':_0xd1147d[_0xebd1('0x84')]['length']+0x1,'app':_0xebd1('0x94'),'appdata':_0xebd1('0x95'),'interval':_0xebd1('0x96')});}}return db['OpenchannelMessage']['create']({'body':_0x158c63[_0xebd1('0x61')]['body'],'OpenchannelAccountId':_0x158c63[_0xebd1('0x69')]['id'],'OpenchannelInteractionId':_0x55d6c7['id'],'direction':'in','ContactId':_0xd1147d[_0xebd1('0x88')]['id'],'AttachmentId':_0x158c63[_0xebd1('0x61')][_0xebd1('0x97')]});})[_0xebd1('0x1f')](function(_0x48ae90){_0xd1147d['message']=_0x48ae90;if(_0xd1147d[_0xebd1('0x91')]['UserId']){return db[_0xebd1('0x98')][_0xebd1('0x58')]({'attributes':['id',_0xebd1('0x36')],'where':{'id':_0xd1147d[_0xebd1('0x91')][_0xebd1('0x99')]}})[_0xebd1('0x1f')](function(_0x168d27){if(_0x168d27){_0xd1147d[_0xebd1('0x84')]['unshift']({'id':0x0,'priority':0x0,'app':_0xebd1('0x9a'),'appdata':_0x168d27[_0xebd1('0x36')]+','+(_0xd1147d[_0xebd1('0x83')]['waitForTheAssignedAgent']||0xa),'interval':_0xebd1('0x96')});_0xd1147d['forcedOwnership']=![];}return respondWithRpcPromise(_0xebd1('0x9b'),_0xebd1('0x9c'),_0xd1147d);});}return respondWithRpcPromise(_0xebd1('0x9b'),_0xebd1('0x9c'),_0xd1147d);})[_0xebd1('0x1f')](function(_0x7e5fa0){respondWithRpcPromise(_0xebd1('0x9d'),_0xebd1('0x9d'),{'event':_0xebd1('0x6e'),'message':_0x7e5fa0},client9002);return _0x7e5fa0;})[_0xebd1('0x1f')](respondWithResult(_0x254f66,null))[_0xebd1('0x53')](handleError(_0x254f66,null));};exports[_0xebd1('0x9e')]=function(_0x43c28f,_0x165ad8,_0x5a62c2){return db[_0xebd1('0x3c')][_0xebd1('0x66')]({'where':{'id':_0x43c28f[_0xebd1('0x69')]['id']}})[_0xebd1('0x1f')](handleEntityNotFound(_0x165ad8,null))['then'](function(_0xab4734){if(_0xab4734){return db['sequelize'][_0xebd1('0x9f')](function(_0x520a8e){return db[_0xebd1('0x81')][_0xebd1('0x34')]({'where':{'OpenchannelAccountId':_0x43c28f[_0xebd1('0x69')]['id']},'transaction':_0x520a8e})[_0xebd1('0x1f')](function(_0x10893c){var _0x4f4b54=_[_0xebd1('0x3b')](_0x43c28f[_0xebd1('0x61')],function(_0x586a2a){_0x586a2a['OpenchannelAccountId']=_0x43c28f[_0xebd1('0x69')]['id'];return _0x586a2a;});return db[_0xebd1('0x81')]['bulkCreate'](_0x4f4b54,{'transaction':_0x520a8e});});})[_0xebd1('0x1f')](function(){return db[_0xebd1('0x81')][_0xebd1('0xa0')]({'where':{'OpenchannelAccountId':_0x43c28f[_0xebd1('0x69')]['id']},'order':'priority'});});}})[_0xebd1('0x1f')](respondWithResult(_0x165ad8,null))[_0xebd1('0x53')](handleError(_0x165ad8,null));};exports['getApplications']=function(_0x2f144c,_0x4174ef,_0x427449){var _0x3ee6f1={};var _0x1e2395={};var _0x4f2dd3;var _0x5bd88b;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x2f144c['params']['id']}})['then'](handleEntityNotFound(_0x4174ef,null))[_0xebd1('0x1f')](function(_0x4b59f3){if(_0x4b59f3){_0x4f2dd3=_0x4b59f3;_0x1e2395[_0xebd1('0x3f')]=_['keys'](db[_0xebd1('0x81')][_0xebd1('0x55')]);_0x1e2395['query']=_[_0xebd1('0x41')](_0x2f144c['query']);_0x1e2395[_0xebd1('0x4b')]=_['intersection'](_0x1e2395[_0xebd1('0x3f')],_0x1e2395[_0xebd1('0x40')]);_0x3ee6f1[_0xebd1('0x42')]=_[_0xebd1('0x43')](_0x1e2395[_0xebd1('0x3f')],qs[_0xebd1('0x44')](_0x2f144c[_0xebd1('0x40')]['fields']));_0x3ee6f1[_0xebd1('0x42')]=_0x3ee6f1['attributes'][_0xebd1('0x45')]?_0x3ee6f1[_0xebd1('0x42')]:_0x1e2395['model'];_0x3ee6f1[_0xebd1('0x48')]=qs['sort'](_0x2f144c[_0xebd1('0x40')][_0xebd1('0x49')]);_0x3ee6f1[_0xebd1('0x4a')]=qs[_0xebd1('0x4b')](_[_0xebd1('0x4c')](_0x2f144c[_0xebd1('0x40')],_0x1e2395[_0xebd1('0x4b')]));if(_0x2f144c[_0xebd1('0x40')]['filter']){_0x3ee6f1[_0xebd1('0x4a')]=_[_0xebd1('0x4e')](_0x3ee6f1[_0xebd1('0x4a')],{'$or':_[_0xebd1('0x3b')](_0x3ee6f1[_0xebd1('0x42')],function(_0xc55f44){var _0xb0bb42={};_0xb0bb42[_0xc55f44]={'$like':'%'+_0x2f144c[_0xebd1('0x40')][_0xebd1('0x4d')]+'%'};return _0xb0bb42;})});}_0x3ee6f1=_[_0xebd1('0x4e')]({},_0x3ee6f1,_0x2f144c[_0xebd1('0x57')]);return _0x4f2dd3[_0xebd1('0xa1')](_0x3ee6f1);}})[_0xebd1('0x1f')](function(_0x33feee){if(_0x33feee){_0x5bd88b=_0x33feee[_0xebd1('0x45')];if(!_0x2f144c[_0xebd1('0x40')]['hasOwnProperty']('nolimit')){_0x3ee6f1['limit']=qs['limit'](_0x2f144c[_0xebd1('0x40')][_0xebd1('0x2d')]);_0x3ee6f1['offset']=qs[_0xebd1('0x2c')](_0x2f144c[_0xebd1('0x40')][_0xebd1('0x2c')]);}return _0x4f2dd3[_0xebd1('0xa1')](_0x3ee6f1);}})[_0xebd1('0x1f')](function(_0x1edea3){if(_0x1edea3){return _0x1edea3?{'count':_0x5bd88b,'rows':_0x1edea3}:null;}})[_0xebd1('0x1f')](respondWithResult(_0x4174ef,null))[_0xebd1('0x53')](handleError(_0x4174ef,null));};exports['getInteractions']=function(_0x5186e4,_0x4cfaea,_0x54d1d4){var _0x260b8b={'raw':![],'where':{}};var _0x106bb4={};var _0xce031b={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x5186e4[_0xebd1('0x69')]['id']}})[_0xebd1('0x1f')](handleEntityNotFound(_0x4cfaea,null))[_0xebd1('0x1f')](function(_0x323fa9){if(_0x323fa9){_0x106bb4[_0xebd1('0x3f')]=_[_0xebd1('0x41')](db[_0xebd1('0x8b')][_0xebd1('0x55')]);_0x106bb4[_0xebd1('0x40')]=_[_0xebd1('0x41')](_0x5186e4[_0xebd1('0x40')]);_0x106bb4['filters']=_[_0xebd1('0x43')](_0x106bb4[_0xebd1('0x3f')],_0x106bb4[_0xebd1('0x40')]);_0x260b8b[_0xebd1('0x42')]=_[_0xebd1('0x43')](_0x106bb4[_0xebd1('0x3f')],qs['fields'](_0x5186e4[_0xebd1('0x40')]['fields']));_0x260b8b[_0xebd1('0x42')]=_0x260b8b['attributes']['length']?_0x260b8b['attributes']:_0x106bb4['model'];if(!_0x5186e4[_0xebd1('0x40')][_0xebd1('0x46')](_0xebd1('0x47'))){_0x260b8b[_0xebd1('0x2d')]=qs[_0xebd1('0x2d')](_0x5186e4['query'][_0xebd1('0x2d')]);_0x260b8b[_0xebd1('0x2c')]=qs[_0xebd1('0x2c')](_0x5186e4[_0xebd1('0x40')][_0xebd1('0x2c')]);}_0x260b8b['order']=qs[_0xebd1('0x49')](_0x5186e4[_0xebd1('0x40')]['sort']);_0x260b8b['where']=qs[_0xebd1('0x4b')](_[_0xebd1('0x4c')](_0x5186e4['query'],_0x106bb4[_0xebd1('0x4b')]));_0x260b8b[_0xebd1('0x4a')][_0xebd1('0x63')]=_0x323fa9['id'];if(_0x5186e4[_0xebd1('0x40')]['filter']){_0x260b8b[_0xebd1('0x4a')]=_['merge'](_0x260b8b['where'],{'$or':_['map'](_0x260b8b[_0xebd1('0x42')],function(_0x28e4a2){var _0x5795ef={};_0x5795ef[_0x28e4a2]={'$like':'%'+_0x5186e4[_0xebd1('0x40')]['filter']+'%'};return _0x5795ef;})});}_0x260b8b=_[_0xebd1('0x4e')]({},_0x260b8b,_0x5186e4[_0xebd1('0x57')]);return db[_0xebd1('0x8b')][_0xebd1('0x2b')]({'where':_0x260b8b[_0xebd1('0x4a')]})[_0xebd1('0x1f')](function(_0x517f30){_0xce031b['count']=_0x517f30;if(_0x5186e4[_0xebd1('0x40')][_0xebd1('0x56')]){_0x260b8b[_0xebd1('0x50')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xebd1('0x98')],'as':_0xebd1('0xa2'),'attributes':[_0xebd1('0x36'),_0xebd1('0xa3'),_0xebd1('0xa4')],'required':![]},{'model':db[_0xebd1('0xa5')],'as':_0xebd1('0xa6'),'attributes':['id','name',_0xebd1('0xa7')],'where':_0x5186e4[_0xebd1('0x40')]['tag']?{'id':_0x5186e4['query']['tag']}:undefined,'required':_0x5186e4['query'][_0xebd1('0xa8')]?!![]:![]}];}return db[_0xebd1('0x8b')][_0xebd1('0x51')](_0x260b8b);})[_0xebd1('0x1f')](function(_0x1c5c47){_0xce031b[_0xebd1('0x52')]=_0x1c5c47;return _0xce031b;});}})[_0xebd1('0x1f')](respondWithFilteredResult(_0x4cfaea,_0x260b8b))[_0xebd1('0x53')](handleError(_0x4cfaea,null));};exports[_0xebd1('0xa9')]=function(_0x51e0f4,_0x2338fb,_0x3ade04){return db[_0xebd1('0x3c')][_0xebd1('0x58')]({'where':{'id':_0x51e0f4[_0xebd1('0x69')]['id']}})['then'](handleEntityNotFound(_0x2338fb,null))[_0xebd1('0x1f')](function(_0x2542db){if(_0x2542db){return _0x2542db[_0xebd1('0xa9')](_0x51e0f4['body'][_0xebd1('0x6d')],_['omit'](_0x51e0f4[_0xebd1('0x61')],[_0xebd1('0x6d'),'id'])||{})[_0xebd1('0x8e')](function(_0x238c81){for(var _0x3873e6=0x0;_0x3873e6<_0x51e0f4[_0xebd1('0x61')][_0xebd1('0x6d')][_0xebd1('0x45')];_0x3873e6+=0x1){socket[_0xebd1('0xaa')](_0xebd1('0xab'),{'UserId':_0x51e0f4[_0xebd1('0x61')]['ids'][_0x3873e6],'OpenchannelAccountId':_0x51e0f4[_0xebd1('0x69')]['id']});}return _0x238c81;});}})['then'](respondWithResult(_0x2338fb,null))[_0xebd1('0x53')](handleError(_0x2338fb,null));};exports[_0xebd1('0xac')]=function(_0x26c01f,_0x5c2002,_0x37d9ee){return db['OpenchannelAccount'][_0xebd1('0x58')]({'where':{'id':_0x26c01f[_0xebd1('0x69')]['id']}})[_0xebd1('0x1f')](handleEntityNotFound(_0x5c2002,null))[_0xebd1('0x1f')](function(_0x150c4f){if(_0x150c4f){return _0x150c4f[_0xebd1('0xac')](_0x26c01f[_0xebd1('0x40')]['ids'])[_0xebd1('0x1f')](function(){if(_[_0xebd1('0xad')](_0x26c01f[_0xebd1('0x40')]['ids'])){for(var _0x2f2476=0x0;_0x2f2476<_0x26c01f['query'][_0xebd1('0x6d')][_0xebd1('0x45')];_0x2f2476+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x26c01f['query'][_0xebd1('0x6d')][_0x2f2476]),'OpenchannelAccountId':Number(_0x26c01f[_0xebd1('0x69')]['id'])});}}else{socket['emit'](_0xebd1('0xae'),{'UserId':Number(_0x26c01f['query'][_0xebd1('0x6d')]),'OpenchannelAccountId':Number(_0x26c01f[_0xebd1('0x69')]['id'])});}});}})[_0xebd1('0x1f')](respondWithStatusCode(_0x5c2002,null))[_0xebd1('0x53')](handleError(_0x5c2002,null));};exports['getAgents']=function(_0x591c98,_0x2bf683,_0x7a0db3){var _0x52a883={};var _0x4b4254={};var _0x4d6d5f;var _0x51fda6;return db[_0xebd1('0x3c')][_0xebd1('0x66')]({'where':{'id':_0x591c98['params']['id']}})[_0xebd1('0x1f')](handleEntityNotFound(_0x2bf683,null))['then'](function(_0x19206f){if(_0x19206f){_0x4d6d5f=_0x19206f;_0x4b4254[_0xebd1('0x3f')]=_['keys'](db[_0xebd1('0x98')][_0xebd1('0x55')]);_0x4b4254[_0xebd1('0x40')]=_[_0xebd1('0x41')](_0x591c98[_0xebd1('0x40')]);_0x4b4254[_0xebd1('0x4b')]=_[_0xebd1('0x43')](_0x4b4254[_0xebd1('0x3f')],_0x4b4254[_0xebd1('0x40')]);_0x52a883[_0xebd1('0x42')]=_['intersection'](_0x4b4254['model'],qs[_0xebd1('0x44')](_0x591c98[_0xebd1('0x40')]['fields']));_0x52a883[_0xebd1('0x42')]=_0x52a883['attributes'][_0xebd1('0x45')]?_0x52a883[_0xebd1('0x42')]:_0x4b4254[_0xebd1('0x3f')];_0x52a883[_0xebd1('0x48')]=qs[_0xebd1('0x49')](_0x591c98[_0xebd1('0x40')][_0xebd1('0x49')]);_0x52a883['where']=qs[_0xebd1('0x4b')](_[_0xebd1('0x4c')](_0x591c98[_0xebd1('0x40')],_0x4b4254[_0xebd1('0x4b')]));if(_0x591c98[_0xebd1('0x40')]['filter']){_0x52a883[_0xebd1('0x4a')]=_[_0xebd1('0x4e')](_0x52a883['where'],{'$or':_[_0xebd1('0x3b')](_0x52a883[_0xebd1('0x42')],function(_0x463bcb){var _0x10cf6b={};_0x10cf6b[_0x463bcb]={'$like':'%'+_0x591c98['query']['filter']+'%'};return _0x10cf6b;})});}_0x52a883=_[_0xebd1('0x4e')]({},_0x52a883,_0x591c98[_0xebd1('0x57')]);return _0x4d6d5f['getAgents'](_0x52a883);}})['then'](function(_0x84c7f4){if(_0x84c7f4){_0x51fda6=_0x84c7f4[_0xebd1('0x45')];if(!_0x591c98[_0xebd1('0x40')]['hasOwnProperty'](_0xebd1('0x47'))){_0x52a883[_0xebd1('0x2d')]=qs[_0xebd1('0x2d')](_0x591c98[_0xebd1('0x40')][_0xebd1('0x2d')]);_0x52a883[_0xebd1('0x2c')]=qs[_0xebd1('0x2c')](_0x591c98[_0xebd1('0x40')]['offset']);}return _0x4d6d5f[_0xebd1('0xaf')](_0x52a883);}})['then'](function(_0x1a4f76){if(_0x1a4f76){return _0x1a4f76?{'count':_0x51fda6,'rows':_0x1a4f76}:null;}})[_0xebd1('0x1f')](respondWithResult(_0x2bf683,null))['catch'](handleError(_0x2bf683,null));};exports[_0xebd1('0x37')]=function(_0x4382ed,_0x25ec5a,_0x16d7f6){var _0xc007fc,_0x453d0d,_0x476f98;if(_[_0xebd1('0x76')](_0x4382ed[_0xebd1('0x61')][_0xebd1('0x61')])||_0x4382ed[_0xebd1('0x61')][_0xebd1('0x61')]===''){throw new db['Sequelize'][(_0xebd1('0x78'))](_0xebd1('0x79'));}if(_[_0xebd1('0x76')](_0x4382ed[_0xebd1('0x61')]['to'])){}_0xc007fc=_0x4382ed['body']['to'];return db[_0xebd1('0x3c')]['findOne']({'where':{'id':_0x4382ed[_0xebd1('0x69')]['id']}})[_0xebd1('0x1f')](handleEntityNotFound(_0x25ec5a,null))[_0xebd1('0x1f')](function(_0x31e3fd){if(_0x31e3fd){return db[_0xebd1('0x3c')]['find']({'where':{'id':_0x31e3fd['id']},'include':[{'model':db[_0xebd1('0xb0')],'as':'List','include':[{'model':db[_0xebd1('0x7e')],'as':_0xebd1('0x7f'),'where':{[_0x31e3fd[_0xebd1('0x7c')]]:_0xc007fc},'limit':0x1,'order':[['updatedAt',_0xebd1('0x80')]]}]}]})[_0xebd1('0x1f')](handleEntityNotFound(_0x25ec5a,null))['then'](function(_0x3d6999){if(_0x3d6999&&_0x3d6999[_0xebd1('0x7d')]){_0x453d0d=_0x3d6999[_0xebd1('0x5d')]({'plain':!![]});if(_0x453d0d[_0xebd1('0x7d')]&&_0x453d0d[_0xebd1('0x7d')]['Contacts'][_0xebd1('0x45')]){return _0x453d0d[_0xebd1('0x7d')][_0xebd1('0x7f')][0x0];}return db[_0xebd1('0x7e')][_0xebd1('0x59')](_[_0xebd1('0x18')](_0x4382ed[_0xebd1('0x61')],{'firstName':_0xc007fc,[_0x3d6999[_0xebd1('0x7c')]]:_0xc007fc,'phone':_0xc007fc,'ListId':_0x453d0d['ListId']}));}})['then'](handleEntityNotFound(_0x25ec5a,null))['then'](function(_0x199c99){if(_0x199c99){_0x476f98=_0x199c99;return db[_0xebd1('0x8b')][_0xebd1('0x58')]({'where':{'ContactId':_0x476f98['id'],'closed':![],'OpenchannelAccountId':_0x453d0d['id']}})['then'](function(_0x27a04e){if(_0x27a04e){return[_0x27a04e,![]];}return db[_0xebd1('0x8b')]['create']({'UserId':_0x4382ed[_0xebd1('0x5a')]['id'],'ContactId':_0x476f98['id'],'OpenchannelAccountId':_0x453d0d['id'],'lastMsgDirection':_0xebd1('0xb1'),'Messages':[_[_0xebd1('0x4e')](_0x4382ed[_0xebd1('0x61')],{'read':![],'body':_0x4382ed['body'][_0xebd1('0x61')],'OpenchannelAccountId':_0x453d0d['id'],'UserId':_0x4382ed[_0xebd1('0x5a')]['id'],'ContactId':_0x476f98['id']})]},{'include':[{'model':db[_0xebd1('0xb2')],'as':_0xebd1('0xb3')}]})[_0xebd1('0x1f')](function(_0x47f36d){return[_0x47f36d,!![]];});});}})[_0xebd1('0x8e')](function(_0x3eb47d,_0x4fe1d3){if(_0x4fe1d3){return _0x3eb47d;}return db[_0xebd1('0xb2')]['create'](_['merge'](_0x4382ed[_0xebd1('0x61')],{'read':![],'body':_0x4382ed[_0xebd1('0x61')][_0xebd1('0x61')],'OpenchannelAccountId':_0x453d0d['id'],'OpenchannelInteractionId':_0x3eb47d['id'],'UserId':_0x4382ed['user']['id'],'ContactId':_0x476f98['id']}))[_0xebd1('0x1f')](function(_0x51a8e8){_0x3eb47d[_0xebd1('0xb4')][_0xebd1('0xb3')]=[];_0x3eb47d[_0xebd1('0xb4')]['Messages'][_0xebd1('0xb5')](_0x51a8e8[_0xebd1('0xb4')]);return _0x3eb47d;});});}})[_0xebd1('0x1f')](respondWithResult(_0x25ec5a,null))[_0xebd1('0x53')](handleError(_0x25ec5a,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 58b7193..1337cda 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 _0x44bd=['events','setMaxListeners','save','emit','hasOwnProperty','exports'];(function(_0x1bf003,_0x42cb2f){var _0x1bc846=function(_0x4e397d){while(--_0x4e397d){_0x1bf003['push'](_0x1bf003['shift']());}};_0x1bc846(++_0x42cb2f);}(_0x44bd,0x198));var _0xd44b=function(_0x1db505,_0xe59764){_0x1db505=_0x1db505-0x0;var _0x4d71ea=_0x44bd[_0x1db505];return _0x4d71ea;};'use strict';var EventEmitter=require(_0xd44b('0x0'));var OpenchannelAccount=require('../../mysqldb')['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xd44b('0x1')](0x0);var events={'afterCreate':_0xd44b('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x35f8c9){return function(_0x2185d,_0x170846,_0x56cf09){OpenchannelAccountEvents[_0xd44b('0x3')](_0x35f8c9+':'+_0x2185d['id'],_0x2185d);OpenchannelAccountEvents[_0xd44b('0x3')](_0x35f8c9,_0x2185d);_0x56cf09(null);};}for(var e in events){if(events[_0xd44b('0x4')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xd44b('0x5')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xce17=['hook','exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x28fbe3,_0x4ac6f8){var _0x45db6a=function(_0x296ecb){while(--_0x296ecb){_0x28fbe3['push'](_0x28fbe3['shift']());}};_0x45db6a(++_0x4ac6f8);}(_0xce17,0x14f));var _0x7ce1=function(_0x1c6ef2,_0x8d926a){_0x1c6ef2=_0x1c6ef2-0x0;var _0x404b8c=_0xce17[_0x1c6ef2];return _0x404b8c;};'use strict';var EventEmitter=require(_0x7ce1('0x0'));var OpenchannelAccount=require(_0x7ce1('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7ce1('0x2'),'afterUpdate':_0x7ce1('0x3'),'afterDestroy':_0x7ce1('0x4')};function emitEvent(_0x32eef0){return function(_0x15ce60,_0x2a96b1,_0x108476){OpenchannelAccountEvents[_0x7ce1('0x5')](_0x32eef0+':'+_0x15ce60['id'],_0x15ce60);OpenchannelAccountEvents[_0x7ce1('0x5')](_0x32eef0,_0x15ce60);_0x108476(null);};}for(var e in events){if(events[_0x7ce1('0x6')](e)){var event=events[e];OpenchannelAccount[_0x7ce1('0x7')](e,emitEvent(event));}}module[_0x7ce1('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 469e4e9..f5088e7 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 _0xf717=['./openchannelAccount.attributes','exports','define','openchannel_accounts','util','../../config/logger','api','moment','bluebird','../../config/environment'];(function(_0x1d94a4,_0x294cca){var _0x299877=function(_0x4149a8){while(--_0x4149a8){_0x1d94a4['push'](_0x1d94a4['shift']());}};_0x299877(++_0x294cca);}(_0xf717,0x1c6));var _0x7f71=function(_0x3d1daa,_0x26c8b3){_0x3d1daa=_0x3d1daa-0x0;var _0x24bc34=_0xf717[_0x3d1daa];return _0x24bc34;};'use strict';var _=require('lodash');var util=require(_0x7f71('0x0'));var logger=require(_0x7f71('0x1'))(_0x7f71('0x2'));var moment=require(_0x7f71('0x3'));var BPromise=require(_0x7f71('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7f71('0x5'));var attributes=require(_0x7f71('0x6'));module[_0x7f71('0x7')]=function(_0x139b60,_0x4f52ba){return _0x139b60[_0x7f71('0x8')]('OpenchannelAccount',attributes,{'tableName':_0x7f71('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4626=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','OpenchannelAccount','lodash'];(function(_0x5d64f3,_0x2e9b48){var _0x33af5a=function(_0x3a932a){while(--_0x3a932a){_0x5d64f3['push'](_0x5d64f3['shift']());}};_0x33af5a(++_0x2e9b48);}(_0x4626,0x196));var _0x6462=function(_0x17ab02,_0xdca26){_0x17ab02=_0x17ab02-0x0;var _0x506e64=_0x4626[_0x17ab02];return _0x506e64;};'use strict';var _=require(_0x6462('0x0'));var util=require(_0x6462('0x1'));var logger=require(_0x6462('0x2'))(_0x6462('0x3'));var moment=require(_0x6462('0x4'));var BPromise=require(_0x6462('0x5'));var rp=require(_0x6462('0x6'));var fs=require('fs');var path=require(_0x6462('0x7'));var rimraf=require(_0x6462('0x8'));var config=require(_0x6462('0x9'));var attributes=require('./openchannelAccount.attributes');module['exports']=function(_0x496f46,_0x4ed1a1){return _0x496f46['define'](_0x6462('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 e630063..d32e050 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 _0xdcdf=['message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','defaults','socket.io-emitter','redis','./openchannelAccount.socket','register','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xdcdf,0x107));var _0xfdcd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdcdf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xfdcd('0x0'));var moment=require('moment');var BPromise=require(_0xfdcd('0x1'));var rs=require(_0xfdcd('0x2'));var fs=require('fs');var Redis=require(_0xfdcd('0x3'));var db=require(_0xfdcd('0x4'))['db'];var utils=require(_0xfdcd('0x5'));var logger=require(_0xfdcd('0x6'))(_0xfdcd('0x7'));var config=require(_0xfdcd('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xfdcd('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfdcd('0xa'))(new Redis(config[_0xfdcd('0xb')]));require(_0xfdcd('0xc'))[_0xfdcd('0xd')](socket);function respondWithRpcPromise(_0x54a90e,_0x54a251,_0x55ccc8){return new BPromise(function(_0x39a38d,_0x30733c){return client[_0xfdcd('0xe')](_0x54a90e,_0x55ccc8)['then'](function(_0x23dd7d){logger[_0xfdcd('0xf')](_0xfdcd('0x10'),_0x54a251,_0xfdcd('0x11'));logger[_0xfdcd('0x12')](_0xfdcd('0x13'),_0x54a251,_0xfdcd('0x11'),JSON[_0xfdcd('0x14')](_0x23dd7d));if(_0x23dd7d[_0xfdcd('0x15')]){if(_0x23dd7d[_0xfdcd('0x15')][_0xfdcd('0x16')]===0x1f4){logger['error'](_0xfdcd('0x10'),_0x54a251,_0x23dd7d[_0xfdcd('0x15')][_0xfdcd('0x17')]);return _0x30733c(_0x23dd7d[_0xfdcd('0x15')][_0xfdcd('0x17')]);}logger[_0xfdcd('0x15')](_0xfdcd('0x10'),_0x54a251,_0x23dd7d[_0xfdcd('0x15')]['message']);return _0x39a38d(_0x23dd7d['error'][_0xfdcd('0x17')]);}else{logger['info'](_0xfdcd('0x10'),_0x54a251,'request\x20sent');_0x39a38d(_0x23dd7d[_0xfdcd('0x18')][_0xfdcd('0x17')]);}})[_0xfdcd('0x19')](function(_0x511def){logger[_0xfdcd('0x15')](_0xfdcd('0x10'),_0x54a251,_0x511def);_0x30733c(_0x511def);});});} \ No newline at end of file +var _0x93b8=['debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelAccount,\x20%s,\x20%s'];(function(_0x4a06e2,_0x163c0b){var _0x1641b8=function(_0x37d5df){while(--_0x37d5df){_0x4a06e2['push'](_0x4a06e2['shift']());}};_0x1641b8(++_0x163c0b);}(_0x93b8,0x18d));var _0x893b=function(_0x2f7bee,_0x4af91f){_0x2f7bee=_0x2f7bee-0x0;var _0x268f5b=_0x93b8[_0x2f7bee];return _0x268f5b;};'use strict';var _=require(_0x893b('0x0'));var util=require('util');var moment=require(_0x893b('0x1'));var BPromise=require(_0x893b('0x2'));var rs=require(_0x893b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x893b('0x4'))['db'];var utils=require(_0x893b('0x5'));var logger=require(_0x893b('0x6'))(_0x893b('0x7'));var config=require(_0x893b('0x8'));var jayson=require(_0x893b('0x9'));var client=jayson[_0x893b('0xa')][_0x893b('0xb')]({'port':0x232a});config[_0x893b('0xc')]=_[_0x893b('0xd')](config[_0x893b('0xc')],{'host':_0x893b('0xe'),'port':0x18eb});var socket=require(_0x893b('0xf'))(new Redis(config[_0x893b('0xc')]));require('./openchannelAccount.socket')[_0x893b('0x10')](socket);function respondWithRpcPromise(_0x1e8224,_0x8333bd,_0xd74eb9){return new BPromise(function(_0x3f4de3,_0x2d3f56){return client['request'](_0x1e8224,_0xd74eb9)[_0x893b('0x11')](function(_0x507dda){logger['info'](_0x893b('0x12'),_0x8333bd,'request\x20sent');logger[_0x893b('0x13')](_0x893b('0x14'),_0x8333bd,'request\x20sent',JSON[_0x893b('0x15')](_0x507dda));if(_0x507dda[_0x893b('0x16')]){if(_0x507dda[_0x893b('0x16')][_0x893b('0x17')]===0x1f4){logger[_0x893b('0x16')](_0x893b('0x12'),_0x8333bd,_0x507dda[_0x893b('0x16')]['message']);return _0x2d3f56(_0x507dda[_0x893b('0x16')]['message']);}logger[_0x893b('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x8333bd,_0x507dda[_0x893b('0x16')][_0x893b('0x18')]);return _0x3f4de3(_0x507dda['error'][_0x893b('0x18')]);}else{logger[_0x893b('0x19')](_0x893b('0x12'),_0x8333bd,'request\x20sent');_0x3f4de3(_0x507dda['result'][_0x893b('0x18')]);}})['catch'](function(_0x35082c){logger[_0x893b('0x16')](_0x893b('0x12'),_0x8333bd,_0x35082c);_0x2d3f56(_0x35082c);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 2534dae..f4a3654 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 _0xb32f=['removeListener','register','openchannelAccount:','./openchannelAccount.events','save','remove','update','emit'];(function(_0x1ea6eb,_0x54beac){var _0x18db95=function(_0x5533d5){while(--_0x5533d5){_0x1ea6eb['push'](_0x1ea6eb['shift']());}};_0x18db95(++_0x54beac);}(_0xb32f,0x163));var _0xfb32=function(_0x54db33,_0x2ad28a){_0x54db33=_0x54db33-0x0;var _0x664403=_0xb32f[_0x54db33];return _0x664403;};'use strict';var OpenchannelAccountEvents=require(_0xfb32('0x0'));var events=[_0xfb32('0x1'),_0xfb32('0x2'),_0xfb32('0x3')];function createListener(_0x3f5d17,_0x40b01b){return function(_0x2cd6ab){_0x40b01b[_0xfb32('0x4')](_0x3f5d17,_0x2cd6ab);};}function removeListener(_0x8eeb06,_0x597a9a){return function(){OpenchannelAccountEvents[_0xfb32('0x5')](_0x8eeb06,_0x597a9a);};}exports[_0xfb32('0x6')]=function(_0x1588e5){for(var _0x39b205=0x0,_0x729c16=events['length'];_0x39b205<_0x729c16;_0x39b205++){var _0x4ce8e9=events[_0x39b205];var _0x189ed3=createListener(_0xfb32('0x7')+_0x4ce8e9,_0x1588e5);OpenchannelAccountEvents['on'](_0x4ce8e9,_0x189ed3);}}; \ No newline at end of file +var _0xf4a8=['openchannelAccount:','./openchannelAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x37010b,_0xaad129){var _0x2f5e36=function(_0x3b1ba3){while(--_0x3b1ba3){_0x37010b['push'](_0x37010b['shift']());}};_0x2f5e36(++_0xaad129);}(_0xf4a8,0x109));var _0x8f4a=function(_0x39cf70,_0x3ec55b){_0x39cf70=_0x39cf70-0x0;var _0x580424=_0xf4a8[_0x39cf70];return _0x580424;};'use strict';var OpenchannelAccountEvents=require(_0x8f4a('0x0'));var events=[_0x8f4a('0x1'),_0x8f4a('0x2'),_0x8f4a('0x3')];function createListener(_0xb12114,_0x9fefbf){return function(_0x58a112){_0x9fefbf[_0x8f4a('0x4')](_0xb12114,_0x58a112);};}function removeListener(_0x24d255,_0x55db2e){return function(){OpenchannelAccountEvents[_0x8f4a('0x5')](_0x24d255,_0x55db2e);};}exports[_0x8f4a('0x6')]=function(_0x35f3ef){for(var _0x3bc144=0x0,_0x187baf=events['length'];_0x3bc144<_0x187baf;_0x3bc144++){var _0x4a6bb9=events[_0x3bc144];var _0x5a83c7=createListener(_0x8f4a('0x7')+_0x4a6bb9,_0x35f3ef);OpenchannelAccountEvents['on'](_0x4a6bb9,_0x5a83c7);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 56575cb..cc5e84e 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 _0xea0a=['Router','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','index','show','create','/:id','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x1f9ffb,_0x88e50e){var _0x37835f=function(_0x62950b){while(--_0x62950b){_0x1f9ffb['push'](_0x1f9ffb['shift']());}};_0x37835f(++_0x88e50e);}(_0xea0a,0x193));var _0xaea0=function(_0x5ab340,_0x3bf3e4){_0x5ab340=_0x5ab340-0x0;var _0x2ed5b7=_0xea0a[_0x5ab340];return _0x2ed5b7;};'use strict';var multer=require(_0xaea0('0x0'));var util=require(_0xaea0('0x1'));var path=require(_0xaea0('0x2'));var timeout=require(_0xaea0('0x3'));var express=require(_0xaea0('0x4'));var router=express[_0xaea0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xaea0('0x6'));var interaction=require(_0xaea0('0x7'));var config=require('../../config/environment');var controller=require(_0xaea0('0x8'));router[_0xaea0('0x9')]('/',auth[_0xaea0('0xa')](),controller[_0xaea0('0xb')]);router[_0xaea0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xaea0('0xc')]);router['post']('/',auth[_0xaea0('0xa')](),controller[_0xaea0('0xd')]);router['put'](_0xaea0('0xe'),auth[_0xaea0('0xa')](),controller[_0xaea0('0xf')]);router['delete'](_0xaea0('0xe'),auth[_0xaea0('0xa')](),controller[_0xaea0('0x10')]);module['exports']=router; \ No newline at end of file +var _0xf827=['update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','get','/:id','post','put'];(function(_0x57aad4,_0x108f28){var _0x26b886=function(_0x222c41){while(--_0x222c41){_0x57aad4['push'](_0x57aad4['shift']());}};_0x26b886(++_0x108f28);}(_0xf827,0x1f4));var _0x7f82=function(_0x55eee7,_0x4b2caf){_0x55eee7=_0x55eee7-0x0;var _0x41e150=_0xf827[_0x55eee7];return _0x41e150;};'use strict';var multer=require('multer');var util=require(_0x7f82('0x0'));var path=require(_0x7f82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7f82('0x2'));var auth=require(_0x7f82('0x3'));var interaction=require(_0x7f82('0x4'));var config=require(_0x7f82('0x5'));var controller=require(_0x7f82('0x6'));router['get']('/',auth[_0x7f82('0x7')](),controller['index']);router[_0x7f82('0x8')](_0x7f82('0x9'),auth[_0x7f82('0x7')](),controller['show']);router[_0x7f82('0xa')]('/',auth[_0x7f82('0x7')](),controller['create']);router[_0x7f82('0xb')](_0x7f82('0x9'),auth['isAuthenticated'](),controller[_0x7f82('0xc')]);router[_0x7f82('0xd')](_0x7f82('0x9'),auth[_0x7f82('0x7')](),controller[_0x7f82('0xe')]);module[_0x7f82('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 567746c..c422316 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 _0x13fa=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x36a1d7,_0x2688d4){var _0x5591d4=function(_0x129b24){while(--_0x129b24){_0x36a1d7['push'](_0x36a1d7['shift']());}};_0x5591d4(++_0x2688d4);}(_0x13fa,0x65));var _0xa13f=function(_0x1be790,_0x112549){_0x1be790=_0x1be790-0x0;var _0x7668c8=_0x13fa[_0x1be790];return _0x7668c8;};'use strict';var Sequelize=require(_0xa13f('0x0'));module[_0xa13f('0x1')]={'priority':{'type':Sequelize[_0xa13f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa13f('0x3')],'allowNull':![],'defaultValue':_0xa13f('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa13f('0x5')}}; \ No newline at end of file +var _0x8453=['STRING','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x5e51d0,_0x4fc72b){var _0x14879c=function(_0x14f994){while(--_0x14f994){_0x5e51d0['push'](_0x5e51d0['shift']());}};_0x14879c(++_0x4fc72b);}(_0x8453,0x1e3));var _0x3845=function(_0x1e94b0,_0x50fce1){_0x1e94b0=_0x1e94b0-0x0;var _0x564ff1=_0x8453[_0x1e94b0];return _0x564ff1;};'use strict';var Sequelize=require(_0x3845('0x0'));module['exports']={'priority':{'type':Sequelize[_0x3845('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x3845('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3845('0x3')]()},'description':{'type':Sequelize[_0x3845('0x2')]},'interval':{'type':Sequelize[_0x3845('0x2')],'defaultValue':_0x3845('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index d68aaf5..1522301 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 _0x09ad=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x42c803,_0x114632){var _0x2a67cf=function(_0x564532){while(--_0x564532){_0x42c803['push'](_0x42c803['shift']());}};_0x2a67cf(++_0x114632);}(_0x09ad,0x168));var _0xd09a=function(_0x10a659,_0x54027e){_0x10a659=_0x10a659-0x0;var _0x1c84a0=_0x09ad[_0x10a659];return _0x1c84a0;};'use strict';var emlformat=require(_0xd09a('0x0'));var rimraf=require(_0xd09a('0x1'));var zipdir=require(_0xd09a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd09a('0x3'));var moment=require(_0xd09a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd09a('0x5'));var path=require('path');var sox=require(_0xd09a('0x6'));var csv=require(_0xd09a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd09a('0x8'));var _=require(_0xd09a('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd09a('0xa'));var deskjs=require(_0xd09a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xd09a('0xc'));var Papa=require(_0xd09a('0xd'));var Redis=require(_0xd09a('0xe'));var authService=require(_0xd09a('0xf'));var qs=require(_0xd09a('0x10'));var as=require(_0xd09a('0x11'));var hardwareService=require(_0xd09a('0x12'));var logger=require('../../config/logger')(_0xd09a('0x13'));var utils=require(_0xd09a('0x14'));var config=require(_0xd09a('0x15'));var licenseUtil=require(_0xd09a('0x16'));var db=require(_0xd09a('0x17'))['db'];function respondWithStatusCode(_0x3d8c2a,_0x1e5ee0){_0x1e5ee0=_0x1e5ee0||0xcc;return function(_0x45f53b){if(_0x45f53b){return _0x3d8c2a['sendStatus'](_0x1e5ee0);}return _0x3d8c2a[_0xd09a('0x18')](_0x1e5ee0)['end']();};}function respondWithResult(_0x2ece61,_0x3423e9){_0x3423e9=_0x3423e9||0xc8;return function(_0x16a278){if(_0x16a278){return _0x2ece61[_0xd09a('0x18')](_0x3423e9)['json'](_0x16a278);}};}function respondWithFilteredResult(_0x1dbfe0,_0x23b620){return function(_0x34e5d6){if(_0x34e5d6){var _0xe8fbed=_0x34e5d6['count'],_0x58b177=_0x23b620['offset'],_0x2fa0b5=_0x23b620[_0xd09a('0x19')]+_0x23b620[_0xd09a('0x1a')],_0x11cf58;if(_0x2fa0b5>=_0xe8fbed){_0x2fa0b5=_0xe8fbed;_0x11cf58=0xc8;}else{_0x11cf58=0xce;}_0x1dbfe0[_0xd09a('0x18')](_0x11cf58);return _0x1dbfe0[_0xd09a('0x1b')](_0xd09a('0x1c'),_0x58b177+'-'+_0x2fa0b5+'/'+_0xe8fbed)['json'](_0x34e5d6);}return null;};}function patchUpdates(_0x3b08c3){return function(_0x426fe5){try{jsonpatch['apply'](_0x426fe5,_0x3b08c3,!![]);}catch(_0x2dbb1b){return BPromise[_0xd09a('0x1d')](_0x2dbb1b);}return _0x426fe5[_0xd09a('0x1e')]();};}function saveUpdates(_0x464ef8,_0x4a0ef){return function(_0x217d7d){if(_0x217d7d){return _0x217d7d[_0xd09a('0x1f')](_0x464ef8)[_0xd09a('0x20')](function(_0x261deb){return _0x261deb;});}return null;};}function removeEntity(_0x48290a,_0x147218){return function(_0x2fd856){if(_0x2fd856){return _0x2fd856[_0xd09a('0x21')]()[_0xd09a('0x20')](function(){_0x48290a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ff5ad,_0x62f17e){return function(_0x58037b){if(!_0x58037b){_0x1ff5ad[_0xd09a('0x22')](0x194);}return _0x58037b;};}function handleError(_0x3142f1,_0x3c790a){_0x3c790a=_0x3c790a||0x1f4;return function(_0x2c80cc){logger[_0xd09a('0x23')](_0x2c80cc[_0xd09a('0x24')]);if(_0x2c80cc[_0xd09a('0x25')]){delete _0x2c80cc[_0xd09a('0x25')];}_0x3142f1[_0xd09a('0x18')](_0x3c790a)[_0xd09a('0x26')](_0x2c80cc);};}exports[_0xd09a('0x27')]=function(_0x2a50dc,_0x341dbd){var _0x100944={},_0x2e0194={},_0xdb1275={'count':0x0,'rows':[]};var _0x1b3457=_[_0xd09a('0x28')](db[_0xd09a('0x29')][_0xd09a('0x2a')],function(_0x59d12d){return{'name':_0x59d12d[_0xd09a('0x2b')],'type':_0x59d12d[_0xd09a('0x2c')][_0xd09a('0x2d')]};});_0x2e0194[_0xd09a('0x2e')]=_['map'](_0x1b3457,_0xd09a('0x25'));_0x2e0194[_0xd09a('0x2f')]=_[_0xd09a('0x30')](_0x2a50dc[_0xd09a('0x2f')]);_0x2e0194[_0xd09a('0x31')]=_[_0xd09a('0x32')](_0x2e0194[_0xd09a('0x2e')],_0x2e0194['query']);_0x100944[_0xd09a('0x33')]=_[_0xd09a('0x32')](_0x2e0194[_0xd09a('0x2e')],qs[_0xd09a('0x34')](_0x2a50dc[_0xd09a('0x2f')][_0xd09a('0x34')]));_0x100944[_0xd09a('0x33')]=_0x100944[_0xd09a('0x33')][_0xd09a('0x35')]?_0x100944[_0xd09a('0x33')]:_0x2e0194['model'];if(!_0x2a50dc[_0xd09a('0x2f')][_0xd09a('0x36')](_0xd09a('0x37'))){_0x100944[_0xd09a('0x1a')]=qs[_0xd09a('0x1a')](_0x2a50dc[_0xd09a('0x2f')][_0xd09a('0x1a')]);_0x100944[_0xd09a('0x19')]=qs['offset'](_0x2a50dc['query']['offset']);}_0x100944[_0xd09a('0x38')]=qs[_0xd09a('0x39')](_0x2a50dc[_0xd09a('0x2f')][_0xd09a('0x39')]);_0x100944[_0xd09a('0x3a')]=qs['filters'](_[_0xd09a('0x3b')](_0x2a50dc[_0xd09a('0x2f')],_0x2e0194[_0xd09a('0x31')]),_0x1b3457);if(_0x2a50dc[_0xd09a('0x2f')][_0xd09a('0x3c')]){_0x100944[_0xd09a('0x3a')]=_[_0xd09a('0x3d')](_0x100944[_0xd09a('0x3a')],{'$or':_[_0xd09a('0x28')](_0x1b3457,function(_0x2d0927){if(_0x2d0927[_0xd09a('0x2c')]!==_0xd09a('0x3e')){var _0x5ccb59={};_0x5ccb59[_0x2d0927['name']]={'$like':'%'+_0x2a50dc[_0xd09a('0x2f')][_0xd09a('0x3c')]+'%'};return _0x5ccb59;}})});}_0x100944=_[_0xd09a('0x3d')]({},_0x100944,_0x2a50dc[_0xd09a('0x3f')]);var _0x5d3980={'where':_0x100944['where']};return db[_0xd09a('0x29')][_0xd09a('0x40')](_0x5d3980)['then'](function(_0x1f246a){_0xdb1275[_0xd09a('0x40')]=_0x1f246a;if(_0x2a50dc['query'][_0xd09a('0x41')]){_0x100944[_0xd09a('0x42')]=[{'all':!![]}];}return db[_0xd09a('0x29')][_0xd09a('0x43')](_0x100944);})[_0xd09a('0x20')](function(_0x9d99c0){_0xdb1275[_0xd09a('0x44')]=_0x9d99c0;return _0xdb1275;})[_0xd09a('0x20')](respondWithFilteredResult(_0x341dbd,_0x100944))['catch'](handleError(_0x341dbd,null));};exports[_0xd09a('0x45')]=function(_0x216748,_0x48e8d0){var _0x49791e={'raw':!![],'where':{'id':_0x216748[_0xd09a('0x46')]['id']}},_0x3c1a27={};_0x3c1a27[_0xd09a('0x2e')]=_[_0xd09a('0x30')](db['OpenchannelApplication'][_0xd09a('0x2a')]);_0x3c1a27[_0xd09a('0x2f')]=_[_0xd09a('0x30')](_0x216748[_0xd09a('0x2f')]);_0x3c1a27[_0xd09a('0x31')]=_[_0xd09a('0x32')](_0x3c1a27[_0xd09a('0x2e')],_0x3c1a27[_0xd09a('0x2f')]);_0x49791e['attributes']=_[_0xd09a('0x32')](_0x3c1a27[_0xd09a('0x2e')],qs[_0xd09a('0x34')](_0x216748[_0xd09a('0x2f')][_0xd09a('0x34')]));_0x49791e[_0xd09a('0x33')]=_0x49791e[_0xd09a('0x33')]['length']?_0x49791e[_0xd09a('0x33')]:_0x3c1a27[_0xd09a('0x2e')];if(_0x216748[_0xd09a('0x2f')][_0xd09a('0x41')]){_0x49791e[_0xd09a('0x42')]=[{'all':!![]}];}_0x49791e=_['merge']({},_0x49791e,_0x216748[_0xd09a('0x3f')]);return db[_0xd09a('0x29')][_0xd09a('0x47')](_0x49791e)[_0xd09a('0x20')](handleEntityNotFound(_0x48e8d0,null))['then'](respondWithResult(_0x48e8d0,null))[_0xd09a('0x48')](handleError(_0x48e8d0,null));};exports[_0xd09a('0x49')]=function(_0x4c6005,_0x45dd36){return db[_0xd09a('0x29')]['create'](_0x4c6005[_0xd09a('0x4a')],{})[_0xd09a('0x20')](respondWithResult(_0x45dd36,0xc9))[_0xd09a('0x48')](handleError(_0x45dd36,null));};exports['update']=function(_0x28fd71,_0x197720){if(_0x28fd71[_0xd09a('0x4a')]['id']){delete _0x28fd71[_0xd09a('0x4a')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x28fd71['params']['id']}})['then'](handleEntityNotFound(_0x197720,null))['then'](saveUpdates(_0x28fd71[_0xd09a('0x4a')],null))['then'](respondWithResult(_0x197720,null))['catch'](handleError(_0x197720,null));};exports['destroy']=function(_0x5ce525,_0x369a92){return db['OpenchannelApplication'][_0xd09a('0x47')]({'where':{'id':_0x5ce525[_0xd09a('0x46')]['id']}})[_0xd09a('0x20')](handleEntityNotFound(_0x369a92,null))[_0xd09a('0x20')](removeEntity(_0x369a92,null))[_0xd09a('0x48')](handleError(_0x369a92,null));}; \ No newline at end of file +var _0x0432=['reject','save','update','then','destroy','name','send','index','map','OpenchannelApplication','fieldName','type','key','query','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','rawAttributes','keys','intersection','find','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','count','offset','limit','set','Content-Range','json','apply'];(function(_0x2b01a2,_0x3b4040){var _0xcce4ab=function(_0x34c777){while(--_0x34c777){_0x2b01a2['push'](_0x2b01a2['shift']());}};_0xcce4ab(++_0x3b4040);}(_0x0432,0xfd));var _0x2043=function(_0x37bc48,_0xba1e80){_0x37bc48=_0x37bc48-0x0;var _0xd250cf=_0x0432[_0x37bc48];return _0xd250cf;};'use strict';var emlformat=require(_0x2043('0x0'));var rimraf=require(_0x2043('0x1'));var zipdir=require(_0x2043('0x2'));var jsonpatch=require(_0x2043('0x3'));var rp=require('request-promise');var moment=require(_0x2043('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2043('0x5'));var path=require(_0x2043('0x6'));var sox=require(_0x2043('0x7'));var csv=require(_0x2043('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2043('0x9'));var _=require(_0x2043('0xa'));var squel=require(_0x2043('0xb'));var crypto=require('crypto');var jsforce=require(_0x2043('0xc'));var deskjs=require(_0x2043('0xd'));var toCsv=require(_0x2043('0x8'));var querystring=require(_0x2043('0xe'));var Papa=require('papaparse');var Redis=require(_0x2043('0xf'));var authService=require(_0x2043('0x10'));var qs=require(_0x2043('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2043('0x12'));var logger=require(_0x2043('0x13'))('api');var utils=require(_0x2043('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2043('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x219fff,_0x49a246){_0x49a246=_0x49a246||0xcc;return function(_0x408576){if(_0x408576){return _0x219fff[_0x2043('0x16')](_0x49a246);}return _0x219fff['status'](_0x49a246)['end']();};}function respondWithResult(_0x127543,_0x36c533){_0x36c533=_0x36c533||0xc8;return function(_0x2ccc89){if(_0x2ccc89){return _0x127543[_0x2043('0x17')](_0x36c533)['json'](_0x2ccc89);}};}function respondWithFilteredResult(_0x20db98,_0x156050){return function(_0x39a478){if(_0x39a478){var _0x4833f7=_0x39a478[_0x2043('0x18')],_0x1e0cc1=_0x156050[_0x2043('0x19')],_0x2aec65=_0x156050[_0x2043('0x19')]+_0x156050[_0x2043('0x1a')],_0xd0a185;if(_0x2aec65>=_0x4833f7){_0x2aec65=_0x4833f7;_0xd0a185=0xc8;}else{_0xd0a185=0xce;}_0x20db98[_0x2043('0x17')](_0xd0a185);return _0x20db98[_0x2043('0x1b')](_0x2043('0x1c'),_0x1e0cc1+'-'+_0x2aec65+'/'+_0x4833f7)[_0x2043('0x1d')](_0x39a478);}return null;};}function patchUpdates(_0xbf6990){return function(_0x1123dc){try{jsonpatch[_0x2043('0x1e')](_0x1123dc,_0xbf6990,!![]);}catch(_0x32017b){return BPromise[_0x2043('0x1f')](_0x32017b);}return _0x1123dc[_0x2043('0x20')]();};}function saveUpdates(_0x2e5900,_0x3a7f5e){return function(_0x16ab5a){if(_0x16ab5a){return _0x16ab5a[_0x2043('0x21')](_0x2e5900)[_0x2043('0x22')](function(_0x5f553c){return _0x5f553c;});}return null;};}function removeEntity(_0x387e1a,_0x1ef976){return function(_0x5e6f4b){if(_0x5e6f4b){return _0x5e6f4b[_0x2043('0x23')]()[_0x2043('0x22')](function(){_0x387e1a[_0x2043('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc3f9a6,_0x2d6079){return function(_0x43341b){if(!_0x43341b){_0xc3f9a6['sendStatus'](0x194);}return _0x43341b;};}function handleError(_0x4bf2a3,_0x3f9176){_0x3f9176=_0x3f9176||0x1f4;return function(_0x5de11d){logger['error'](_0x5de11d['stack']);if(_0x5de11d[_0x2043('0x24')]){delete _0x5de11d['name'];}_0x4bf2a3['status'](_0x3f9176)[_0x2043('0x25')](_0x5de11d);};}exports[_0x2043('0x26')]=function(_0x2c2bdc,_0x227532){var _0x4a5b41={},_0x40c004={},_0x462a07={'count':0x0,'rows':[]};var _0x299bdb=_[_0x2043('0x27')](db[_0x2043('0x28')]['rawAttributes'],function(_0xf91a42){return{'name':_0xf91a42[_0x2043('0x29')],'type':_0xf91a42[_0x2043('0x2a')][_0x2043('0x2b')]};});_0x40c004['model']=_['map'](_0x299bdb,_0x2043('0x24'));_0x40c004[_0x2043('0x2c')]=_['keys'](_0x2c2bdc[_0x2043('0x2c')]);_0x40c004['filters']=_['intersection'](_0x40c004['model'],_0x40c004['query']);_0x4a5b41[_0x2043('0x2d')]=_['intersection'](_0x40c004[_0x2043('0x2e')],qs[_0x2043('0x2f')](_0x2c2bdc[_0x2043('0x2c')][_0x2043('0x2f')]));_0x4a5b41[_0x2043('0x2d')]=_0x4a5b41[_0x2043('0x2d')][_0x2043('0x30')]?_0x4a5b41[_0x2043('0x2d')]:_0x40c004[_0x2043('0x2e')];if(!_0x2c2bdc[_0x2043('0x2c')][_0x2043('0x31')](_0x2043('0x32'))){_0x4a5b41[_0x2043('0x1a')]=qs[_0x2043('0x1a')](_0x2c2bdc[_0x2043('0x2c')][_0x2043('0x1a')]);_0x4a5b41['offset']=qs[_0x2043('0x19')](_0x2c2bdc[_0x2043('0x2c')][_0x2043('0x19')]);}_0x4a5b41[_0x2043('0x33')]=qs[_0x2043('0x34')](_0x2c2bdc[_0x2043('0x2c')][_0x2043('0x34')]);_0x4a5b41['where']=qs[_0x2043('0x35')](_[_0x2043('0x36')](_0x2c2bdc[_0x2043('0x2c')],_0x40c004[_0x2043('0x35')]),_0x299bdb);if(_0x2c2bdc['query']['filter']){_0x4a5b41[_0x2043('0x37')]=_[_0x2043('0x38')](_0x4a5b41['where'],{'$or':_[_0x2043('0x27')](_0x299bdb,function(_0x14713f){if(_0x14713f['type']!==_0x2043('0x39')){var _0x2ef9ab={};_0x2ef9ab[_0x14713f[_0x2043('0x24')]]={'$like':'%'+_0x2c2bdc[_0x2043('0x2c')][_0x2043('0x3a')]+'%'};return _0x2ef9ab;}})});}_0x4a5b41=_['merge']({},_0x4a5b41,_0x2c2bdc[_0x2043('0x3b')]);var _0x3b7c2e={'where':_0x4a5b41[_0x2043('0x37')]};return db[_0x2043('0x28')][_0x2043('0x18')](_0x3b7c2e)[_0x2043('0x22')](function(_0x630da3){_0x462a07[_0x2043('0x18')]=_0x630da3;if(_0x2c2bdc[_0x2043('0x2c')][_0x2043('0x3c')]){_0x4a5b41[_0x2043('0x3d')]=[{'all':!![]}];}return db[_0x2043('0x28')]['findAll'](_0x4a5b41);})[_0x2043('0x22')](function(_0x28d04e){_0x462a07[_0x2043('0x3e')]=_0x28d04e;return _0x462a07;})['then'](respondWithFilteredResult(_0x227532,_0x4a5b41))[_0x2043('0x3f')](handleError(_0x227532,null));};exports[_0x2043('0x40')]=function(_0x381206,_0x58525e){var _0x20f442={'raw':!![],'where':{'id':_0x381206['params']['id']}},_0x281fa4={};_0x281fa4[_0x2043('0x2e')]=_['keys'](db[_0x2043('0x28')][_0x2043('0x41')]);_0x281fa4[_0x2043('0x2c')]=_[_0x2043('0x42')](_0x381206[_0x2043('0x2c')]);_0x281fa4[_0x2043('0x35')]=_['intersection'](_0x281fa4[_0x2043('0x2e')],_0x281fa4[_0x2043('0x2c')]);_0x20f442['attributes']=_[_0x2043('0x43')](_0x281fa4[_0x2043('0x2e')],qs[_0x2043('0x2f')](_0x381206[_0x2043('0x2c')][_0x2043('0x2f')]));_0x20f442[_0x2043('0x2d')]=_0x20f442[_0x2043('0x2d')][_0x2043('0x30')]?_0x20f442['attributes']:_0x281fa4['model'];if(_0x381206[_0x2043('0x2c')][_0x2043('0x3c')]){_0x20f442[_0x2043('0x3d')]=[{'all':!![]}];}_0x20f442=_[_0x2043('0x38')]({},_0x20f442,_0x381206[_0x2043('0x3b')]);return db[_0x2043('0x28')][_0x2043('0x44')](_0x20f442)[_0x2043('0x22')](handleEntityNotFound(_0x58525e,null))['then'](respondWithResult(_0x58525e,null))[_0x2043('0x3f')](handleError(_0x58525e,null));};exports['create']=function(_0x5909f0,_0x1fcbea){return db[_0x2043('0x28')]['create'](_0x5909f0[_0x2043('0x45')],{})[_0x2043('0x22')](respondWithResult(_0x1fcbea,0xc9))[_0x2043('0x3f')](handleError(_0x1fcbea,null));};exports['update']=function(_0x5626fd,_0x2f9701){if(_0x5626fd[_0x2043('0x45')]['id']){delete _0x5626fd[_0x2043('0x45')]['id'];}return db[_0x2043('0x28')][_0x2043('0x44')]({'where':{'id':_0x5626fd[_0x2043('0x46')]['id']}})['then'](handleEntityNotFound(_0x2f9701,null))['then'](saveUpdates(_0x5626fd[_0x2043('0x45')],null))[_0x2043('0x22')](respondWithResult(_0x2f9701,null))[_0x2043('0x3f')](handleError(_0x2f9701,null));};exports[_0x2043('0x23')]=function(_0x218ef0,_0x2331ee){return db[_0x2043('0x28')]['find']({'where':{'id':_0x218ef0[_0x2043('0x46')]['id']}})[_0x2043('0x22')](handleEntityNotFound(_0x2331ee,null))[_0x2043('0x22')](removeEntity(_0x2331ee,null))['catch'](handleError(_0x2331ee,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index ee71ca8..5d86ec3 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 _0xca04=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication'];(function(_0x2f3327,_0xba3c98){var _0xade853=function(_0x396f9d){while(--_0x396f9d){_0x2f3327['push'](_0x2f3327['shift']());}};_0xade853(++_0xba3c98);}(_0xca04,0x9c));var _0x4ca0=function(_0xb9c9a4,_0x515ee9){_0xb9c9a4=_0xb9c9a4-0x0;var _0x4ae43a=_0xca04[_0xb9c9a4];return _0x4ae43a;};'use strict';var _=require(_0x4ca0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4ca0('0x1'));var moment=require(_0x4ca0('0x2'));var BPromise=require(_0x4ca0('0x3'));var rp=require(_0x4ca0('0x4'));var fs=require('fs');var path=require(_0x4ca0('0x5'));var rimraf=require(_0x4ca0('0x6'));var config=require(_0x4ca0('0x7'));var attributes=require(_0x4ca0('0x8'));module[_0x4ca0('0x9')]=function(_0x2c4a26,_0x59bece){return _0x2c4a26[_0x4ca0('0xa')](_0x4ca0('0xb'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x08fa=['api','moment','bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x1f7413,_0x3388c3){var _0x2d2775=function(_0x5e5b4){while(--_0x5e5b4){_0x1f7413['push'](_0x1f7413['shift']());}};_0x2d2775(++_0x3388c3);}(_0x08fa,0x19d));var _0xa08f=function(_0x30a52d,_0x422634){_0x30a52d=_0x30a52d-0x0;var _0xf938f3=_0x08fa[_0x30a52d];return _0xf938f3;};'use strict';var _=require(_0xa08f('0x0'));var util=require(_0xa08f('0x1'));var logger=require(_0xa08f('0x2'))(_0xa08f('0x3'));var moment=require(_0xa08f('0x4'));var BPromise=require(_0xa08f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa08f('0x6'));var rimraf=require(_0xa08f('0x7'));var config=require(_0xa08f('0x8'));var attributes=require(_0xa08f('0x9'));module[_0xa08f('0xa')]=function(_0x237d47,_0x2a4ab3){return _0x237d47[_0xa08f('0xb')](_0xa08f('0xc'),attributes,{'tableName':_0xa08f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa08f('0xe'),'collate':_0xa08f('0xf')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 0477d3e..eea55cc 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(_0x4df2f7,_0x355a93){var _0x5d8dd5=function(_0x5d15e5){while(--_0x5d15e5){_0x4df2f7['push'](_0x4df2f7['shift']());}};_0x5d8dd5(++_0x355a93);}(_0xb10b,0x12a));var _0xbb10=function(_0x39bc06,_0x18d7ff){_0x39bc06=_0x39bc06-0x0;var _0x131143=_0xb10b[_0x39bc06];return _0x131143;};'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 _0xd8b0=['OpenchannelApplication','body','options','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication'];(function(_0xffa198,_0x5a8940){var _0x1e4b50=function(_0x1f1c43){while(--_0x1f1c43){_0xffa198['push'](_0xffa198['shift']());}};_0x1e4b50(++_0x5a8940);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['update'](_0x5fecbd[_0x0d8b('0x18')],{'raw':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1b')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['attributes']||null:null,'limit':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['limit']||null:null})['then'](function(_0x238728){logger[_0x0d8b('0xb')](_0x0d8b('0x16'),_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON[_0x0d8b('0x10')](_0x238728));_0x18dd2d(_0x238728);})[_0x0d8b('0x15')](function(_0x4562cb){logger[_0x0d8b('0x11')]('UpdateOpenchannelApplication',_0x4562cb[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x4562cb['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 1e00d27..49f7fd7 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(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x4c7935,_0x4a53fb){var _0x30651d=function(_0x12f35f){while(--_0x12f35f){_0x4c7935['push'](_0x4c7935['shift']());}};_0x30651d(++_0x4a53fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 f533018..339898d 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 _0x7f91=['DATE','ENUM','sequelize','BOOLEAN','STRING'];(function(_0x2cb689,_0x59b4de){var _0x480caa=function(_0x21f353){while(--_0x21f353){_0x2cb689['push'](_0x2cb689['shift']());}};_0x480caa(++_0x59b4de);}(_0x7f91,0x93));var _0x17f9=function(_0x3b3210,_0x25e8ed){_0x3b3210=_0x3b3210-0x0;var _0x5b5484=_0x7f91[_0x3b3210];return _0x5b5484;};'use strict';var Sequelize=require(_0x17f9('0x0'));module['exports']={'closed':{'type':Sequelize[_0x17f9('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x17f9('0x2')]},'thirdDisposition':{'type':Sequelize[_0x17f9('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x17f9('0x3')]},'threadId':{'type':Sequelize[_0x17f9('0x2')]},'externalUrl':{'type':Sequelize[_0x17f9('0x2')]},'lastMsgAt':{'type':Sequelize[_0x17f9('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x17f9('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbd3a=['BOOLEAN','DATE','STRING','out','sequelize','exports'];(function(_0x577130,_0x27769d){var _0xd883c5=function(_0x31307f){while(--_0x31307f){_0x577130['push'](_0x577130['shift']());}};_0xd883c5(++_0x27769d);}(_0xbd3a,0x112));var _0xabd3=function(_0x42d54d,_0x1e6671){_0x42d54d=_0x42d54d-0x0;var _0x5bd179=_0xbd3a[_0x42d54d];return _0x5bd179;};'use strict';var Sequelize=require(_0xabd3('0x0'));module[_0xabd3('0x1')]={'closed':{'type':Sequelize[_0xabd3('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xabd3('0x3')]},'disposition':{'type':Sequelize[_0xabd3('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xabd3('0x4')]},'note':{'type':Sequelize[_0xabd3('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xabd3('0x4')]},'externalUrl':{'type':Sequelize[_0xabd3('0x4')]},'lastMsgAt':{'type':Sequelize[_0xabd3('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xabd3('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xabd3('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 92c17a8..0aea60f 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 _0xe8cf=['text','body','keys','some','compact','isEmpty','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','having','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','contactName','DESC','t.id\x20IN\x20?','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','merge','OpenchannelInteraction','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','groupBy','OpenchannelInteractionId','all','rows','params','rawAttributes','includeAll','create','update','describe','addMessage','OpenchannelMessage','ids','omit','YYYY-MM-DD\x20HH:mm:ss','options','include','addTags','setTags','spread','findAll','color','emit','removeTags','download','unix','join','root','tmp','files','transcript-%d-%s.zip','User','fullname','CmContact','firstName','lastName','Attachment','direction','secret','OpenchannelAccount','Account','Owner','get','Openchannel','N.A.','format','closed','closedAt','disposition','Public','Private','Messages','basename','createReadStream','pipe','createWriteStream','out','System','server','views','downloadInteraction.html','transcript-','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','sendStatus','error','stack','name','send','Tags','forEach','push','TagIds','catch','index','map','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','select','field','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','value','`\x20>\x200','Contact','operator','$substring','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId'];(function(_0x5c8827,_0x5bc5d7){var _0x50ffd5=function(_0x4121bc){while(--_0x4121bc){_0x5c8827['push'](_0x5c8827['shift']());}};_0x50ffd5(++_0x5bc5d7);}(_0xe8cf,0x16e));var _0xfe8c=function(_0x1c21cc,_0x322a71){_0x1c21cc=_0x1c21cc-0x0;var _0x7af1cb=_0xe8cf[_0x1c21cc];return _0x7af1cb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe8c('0x0'));var zipdir=require(_0xfe8c('0x1'));var jsonpatch=require(_0xfe8c('0x2'));var rp=require(_0xfe8c('0x3'));var moment=require(_0xfe8c('0x4'));var BPromise=require(_0xfe8c('0x5'));var Mustache=require(_0xfe8c('0x6'));var util=require(_0xfe8c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xfe8c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfe8c('0x9'));var _=require(_0xfe8c('0xa'));var squel=require(_0xfe8c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfe8c('0xc'));var toCsv=require(_0xfe8c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfe8c('0xd'));var authService=require(_0xfe8c('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xfe8c('0xf'));var hardwareService=require(_0xfe8c('0x10'));var logger=require(_0xfe8c('0x11'))(_0xfe8c('0x12'));var utils=require('../../config/utils');var config=require(_0xfe8c('0x13'));var licenseUtil=require(_0xfe8c('0x14'));var db=require(_0xfe8c('0x15'))['db'];config[_0xfe8c('0x16')]=_[_0xfe8c('0x17')](config['redis'],{'host':_0xfe8c('0x18'),'port':0x18eb});var socket=require(_0xfe8c('0x19'))(new Redis(config[_0xfe8c('0x16')]));require(_0xfe8c('0x1a'))[_0xfe8c('0x1b')](socket);function respondWithStatusCode(_0x248a0b,_0x36418f){_0x36418f=_0x36418f||0xcc;return function(_0x36177b){if(_0x36177b){return _0x248a0b['sendStatus'](_0x36418f);}return _0x248a0b[_0xfe8c('0x1c')](_0x36418f)[_0xfe8c('0x1d')]();};}function respondWithResult(_0x48911f,_0x39df91){_0x39df91=_0x39df91||0xc8;return function(_0x169952){if(_0x169952){return _0x48911f[_0xfe8c('0x1c')](_0x39df91)[_0xfe8c('0x1e')](_0x169952);}};}function respondWithFilteredResult(_0x18174e,_0x45dea0){return function(_0x483cc5){if(_0x483cc5){var _0xae3043=_0x483cc5[_0xfe8c('0x1f')],_0x35d0ed=_0x45dea0[_0xfe8c('0x20')],_0x4d659a=_0x45dea0[_0xfe8c('0x20')]+_0x45dea0[_0xfe8c('0x21')],_0xae2c68;if(_0x4d659a>=_0xae3043){_0x4d659a=_0xae3043;_0xae2c68=0xc8;}else{_0xae2c68=0xce;}_0x18174e[_0xfe8c('0x1c')](_0xae2c68);return _0x18174e[_0xfe8c('0x22')](_0xfe8c('0x23'),_0x35d0ed+'-'+_0x4d659a+'/'+_0xae3043)[_0xfe8c('0x1e')](_0x483cc5);}return null;};}function patchUpdates(_0x46360a){return function(_0x7fd8ef){try{jsonpatch[_0xfe8c('0x24')](_0x7fd8ef,_0x46360a,!![]);}catch(_0x37f87f){return BPromise[_0xfe8c('0x25')](_0x37f87f);}return _0x7fd8ef['save']();};}function saveUpdates(_0x3fdbd2,_0x3f1e6f){return function(_0x481d86){if(_0x481d86){return _0x481d86['update'](_0x3fdbd2)[_0xfe8c('0x26')](function(_0x4eab15){return _0x4eab15;});}return null;};}function removeEntity(_0x1b4ddf,_0x4476f0){return function(_0x3e7406){if(_0x3e7406){return _0x3e7406['destroy']()[_0xfe8c('0x26')](function(){_0x1b4ddf[_0xfe8c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e5751,_0x571f97){return function(_0x59cd99){if(!_0x59cd99){_0x1e5751[_0xfe8c('0x27')](0x194);}return _0x59cd99;};}function handleError(_0x3fc7d6,_0xa6bc48){_0xa6bc48=_0xa6bc48||0x1f4;return function(_0x199f27){logger[_0xfe8c('0x28')](_0x199f27[_0xfe8c('0x29')]);if(_0x199f27[_0xfe8c('0x2a')]){delete _0x199f27[_0xfe8c('0x2a')];}_0x3fc7d6[_0xfe8c('0x1c')](_0xa6bc48)[_0xfe8c('0x2b')](_0x199f27);};}function getInteractionUsers(_0x5e4ef8,_0x118032){return new BPromise(function(_0xc62b3,_0x55feb8){try{if(_0x118032[_0x5e4ef8['id']]){_0x5e4ef8['Users']=_['map'](_0x118032[_0x5e4ef8['id']],function(_0x184765){return{'id':_0x184765['id'],'fullname':_0x184765['fullname']};});}}catch(_0xd588c8){_0x55feb8(_0xd588c8);}_0xc62b3(_0x5e4ef8);});}function getInteractionTags(_0x27b7cb,_0x3575dd){return new BPromise(function(_0xdd9c9a,_0x380a44){try{if(_0x27b7cb['TagIds']){_0x27b7cb[_0xfe8c('0x2c')]=[];_0x27b7cb['TagIds']['split'](',')[_0xfe8c('0x2d')](function(_0x135850){_0x27b7cb[_0xfe8c('0x2c')][_0xfe8c('0x2e')](_0x3575dd[_0x135850]);});}delete _0x27b7cb[_0xfe8c('0x2f')];}catch(_0x5e19b7){_0x380a44(_0x5e19b7);}_0xdd9c9a(_0x27b7cb);});}function updateOpenchannelInteraction(_0x4b8874,_0x34900d,_0x38cbe0){return new BPromise(function(_0x355cb7,_0x37bb25){return getInteractionUsers(_0x4b8874,_0x38cbe0)[_0xfe8c('0x26')](function(_0x440f19){return getInteractionTags(_0x440f19,_0x34900d);})['then'](function(_0x56ae2e){_0x355cb7(_0x56ae2e);})[_0xfe8c('0x30')](function(_0x2a3419){_0x37bb25(_0x2a3419);});});}exports[_0xfe8c('0x31')]=function(_0x4936b3,_0x5c8b5a){var _0x461657={},_0x1e4846={},_0x1f8f36={'count':0x0,'rows':[]};var _0x4252db=_[_0xfe8c('0x32')](db['OpenchannelInteraction']['rawAttributes'],function(_0x249aa3){return{'name':_0x249aa3['fieldName'],'type':_0x249aa3[_0xfe8c('0x33')][_0xfe8c('0x34')]};});_0x1e4846[_0xfe8c('0x35')]=_[_0xfe8c('0x32')](_0x4252db,_0xfe8c('0x2a'));_0x1e4846['query']=_['keys'](_0x4936b3[_0xfe8c('0x36')]);_0x1e4846['filters']=_[_0xfe8c('0x37')](_0x1e4846[_0xfe8c('0x35')],_0x1e4846[_0xfe8c('0x36')]);_0x461657[_0xfe8c('0x38')]=_[_0xfe8c('0x37')](_0x1e4846[_0xfe8c('0x35')],qs['fields'](_0x4936b3[_0xfe8c('0x36')][_0xfe8c('0x39')]));_0x461657[_0xfe8c('0x38')]=_0x461657['attributes'][_0xfe8c('0x3a')]?_0x461657[_0xfe8c('0x38')]:_0x1e4846[_0xfe8c('0x35')];if(!_0x4936b3['query'][_0xfe8c('0x3b')](_0xfe8c('0x3c'))){_0x461657[_0xfe8c('0x21')]=qs[_0xfe8c('0x21')](_0x4936b3[_0xfe8c('0x36')][_0xfe8c('0x21')]);_0x461657[_0xfe8c('0x20')]=qs[_0xfe8c('0x20')](_0x4936b3[_0xfe8c('0x36')]['offset']);}_0x461657['order']=qs['sort'](_0x4936b3[_0xfe8c('0x36')][_0xfe8c('0x3d')]);_0x461657[_0xfe8c('0x3e')]=qs[_0xfe8c('0x3f')](_[_0xfe8c('0x40')](_0x4936b3[_0xfe8c('0x36')],_0x1e4846[_0xfe8c('0x3f')]),_0x4252db);var _0x4dc12e=[];var _0xca8501=squel[_0xfe8c('0x41')]()[_0xfe8c('0x42')]('id')[_0xfe8c('0x42')](_0xfe8c('0x2a'))['field']('color')[_0xfe8c('0x43')](_0xfe8c('0x44'));var _0x3b3f13=squel[_0xfe8c('0x41')]()[_0xfe8c('0x42')](_0xfe8c('0x45'))[_0xfe8c('0x42')](_0xfe8c('0x46'))[_0xfe8c('0x42')](_0xfe8c('0x47'))[_0xfe8c('0x43')](_0xfe8c('0x48'),'ui')['left_join'](_0xfe8c('0x49'),'u',_0xfe8c('0x4a'));var _0x548007=squel[_0xfe8c('0x41')]()[_0xfe8c('0x43')](_0xfe8c('0x4b'),'i')[_0xfe8c('0x4c')]('cm_contacts','c',_0xfe8c('0x4d'))['left_join']('users','o',_0xfe8c('0x4e'))[_0xfe8c('0x4c')]('openchannel_accounts','a',_0xfe8c('0x4f'))[_0xfe8c('0x4c')]('openchannel_messages','me',_0xfe8c('0x50'))[_0xfe8c('0x4c')](_0xfe8c('0x51'),'it',_0xfe8c('0x52'))[_0xfe8c('0x4c')](_0xfe8c('0x44'),'t',_0xfe8c('0x53'));var _0xc35828=squel['expr']();var _0x5f59fe=[];var _0x3b51c6=squel[_0xfe8c('0x54')]();var _0x388caa;if(_0x4936b3[_0xfe8c('0x36')]['search']){_0x388caa=as[_0xfe8c('0x55')](_0x4936b3[_0xfe8c('0x36')]['search']);var _0x2dfafb=_0x388caa[_0xfe8c('0x56')];for(var _0x7bda46=0x0;_0x7bda46<_0x388caa[_0xfe8c('0x57')]['length'];_0x7bda46++){var _0x170d41=_0x388caa['conditions'][_0x7bda46];var _0x58ae89='i';var _0x2acdf6=_['find'](_0x4252db,[_0xfe8c('0x2a'),_0x170d41['field']]);if(!_0x2acdf6){switch(_0x170d41[_0xfe8c('0x42')]){case'unreadMessages':if(_0x170d41[_0xfe8c('0x58')]==0x1){_0x548007['having']('`'+_0x170d41[_0xfe8c('0x42')]+'`\x20=\x200');}else{_0x548007['having']('`'+_0x170d41['field']+_0xfe8c('0x59'));}break;case _0xfe8c('0x5a'):if(_0x170d41[_0xfe8c('0x5b')]===_0xfe8c('0x5c')){if(_0x170d41[_0xfe8c('0x58')][_0xfe8c('0x5d')]('\x20')[_0xfe8c('0x3a')]>0x1){_0xc35828[_0x2dfafb]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xfe8c('0x5e')](_0x170d41[_0xfe8c('0x58')]),null);}else{var _0x5504f0='%'+_0x170d41[_0xfe8c('0x58')]+'%';_0xc35828[_0x2dfafb](_0xfe8c('0x5f'),_0x5504f0,_0x5504f0,_0x5504f0);}}else{_0x2acdf6=_[_0xfe8c('0x60')](_0x4252db,[_0xfe8c('0x2a'),'ContactId']);_0x170d41[_0xfe8c('0x42')]=_0xfe8c('0x61');_0x27c08e=as[_0xfe8c('0x62')](_0x58ae89,_0x2acdf6[_0xfe8c('0x33')],_0x170d41);_0xc35828[_0x2dfafb](_0x27c08e['text'],_0x27c08e[_0xfe8c('0x58')][_0xfe8c('0x63')],_0x27c08e[_0xfe8c('0x58')][_0xfe8c('0x1d')]);}break;case'Tag':var _0x12624f=_0x170d41[_0xfe8c('0x58')][_0xfe8c('0x5d')](',')['map'](function(_0x1e58ed){return Number(_0x1e58ed);});_0x12624f[_0xfe8c('0x2d')](function(_0x2c9e09){_0x3b51c6['or'](_0xfe8c('0x64'),'%,'+_0x2c9e09+',%');});_0x5f59fe=_[_0xfe8c('0x65')](_0x5f59fe,_0x12624f);break;case'User':if(_0x170d41[_0xfe8c('0x5b')]===_0xfe8c('0x5c')){_0xc35828[_0x2dfafb](_0xfe8c('0x66'),'%'+_0x170d41[_0xfe8c('0x58')]+'%',null);}else{_0x2acdf6=_['find'](_0x4252db,['name',_0xfe8c('0x67')]);_0x170d41['field']=_0xfe8c('0x67');_0x27c08e=as[_0xfe8c('0x62')](_0x58ae89,_0x2acdf6[_0xfe8c('0x33')],_0x170d41);_0xc35828[_0x2dfafb](_0x27c08e[_0xfe8c('0x68')],_0x27c08e[_0xfe8c('0x58')][_0xfe8c('0x63')],_0x27c08e[_0xfe8c('0x58')][_0xfe8c('0x1d')]);}break;case _0xfe8c('0x69'):_0x27c08e=as[_0xfe8c('0x62')]('me',null,_0x170d41);_0xc35828[_0x2dfafb](_0x27c08e[_0xfe8c('0x68')],_0x27c08e[_0xfe8c('0x58')][_0xfe8c('0x63')],_0x27c08e[_0xfe8c('0x58')][_0xfe8c('0x1d')]);break;}}else{var _0x27c08e=as['buildExpression'](_0x58ae89,_0x2acdf6['type'],_0x170d41);_0xc35828[_0x2dfafb](_0x27c08e['text'],_0x27c08e['value'][_0xfe8c('0x63')],_0x27c08e[_0xfe8c('0x58')]['end']);}}}else{var _0x4878a2=_(_0x4936b3[_0xfe8c('0x36')])[_0xfe8c('0x6a')]()[_0xfe8c('0x32')](function(_0x28fa48){return _[_0xfe8c('0x6b')](_0x4252db,[_0xfe8c('0x2a'),_0x28fa48])?_0x28fa48:undefined;})[_0xfe8c('0x6c')]()[_0xfe8c('0x58')]();if(!_[_0xfe8c('0x6d')](_0x4878a2)){_0x4878a2[_0xfe8c('0x2d')](function(_0x1bca80){if(_0x1bca80==='OpenchannelAccountId'){_0x548007[_0xfe8c('0x3e')]('i.OpenchannelAccountId\x20IN\x20?',[][_0xfe8c('0x6e')](_0x4936b3[_0xfe8c('0x36')][_0x1bca80]));}else if(_0x1bca80===_0xfe8c('0x6f')){var _0x17f302=JSON[_0xfe8c('0x70')](_0x4936b3['query'][_0x1bca80])[_0xfe8c('0x71')];var _0x4af6ca=JSON['parse'](_0x4936b3[_0xfe8c('0x36')][_0x1bca80])['$lte'];_0x548007[_0xfe8c('0x3e')](_0xfe8c('0x72'),_0x17f302,_0x4af6ca);}else{if(_0x4936b3['query'][_0x1bca80]===_0xfe8c('0x73')){_0x548007['where']('i.'+_0x1bca80+_0xfe8c('0x74'));}else{_0x548007[_0xfe8c('0x3e')]('i.'+_0x1bca80+_0xfe8c('0x75'),_0x4936b3[_0xfe8c('0x36')][_0x1bca80]);}}});}if(_0x4936b3[_0xfe8c('0x36')][_0xfe8c('0x76')]){if(_0x4936b3[_0xfe8c('0x36')][_0xfe8c('0x76')]==0x1){_0x548007['having'](_0xfe8c('0x77'));}else{_0x548007[_0xfe8c('0x78')](_0xfe8c('0x79'));}}if(_0x4936b3[_0xfe8c('0x36')][_0xfe8c('0x7a')]){_0x5f59fe=_[_0xfe8c('0x7b')](_0x4936b3[_0xfe8c('0x36')][_0xfe8c('0x7a')])?_0x4936b3[_0xfe8c('0x36')][_0xfe8c('0x7a')]:new Array(_0x4936b3[_0xfe8c('0x36')][_0xfe8c('0x7a')]);_0x5f59fe[_0xfe8c('0x2d')](function(_0xaeae05){_0x3b51c6['or'](_0xfe8c('0x64'),'%,'+_0xaeae05+',%');});}if(_0x4936b3[_0xfe8c('0x36')][_0xfe8c('0x7c')]){var _0x13f54d=_0x4936b3[_0xfe8c('0x36')]['filter'][_0xfe8c('0x7d')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xfe8c('0x7e')](_0x13f54d)){_0xc35828['or'](_0xfe8c('0x7f'),_0x13f54d+'%');}else{_0xc35828['or'](_0xfe8c('0x80'),qs[_0xfe8c('0x5e')](_0x13f54d))['or'](_0xfe8c('0x81'),_0x13f54d+'%')['or'](_0xfe8c('0x82'),_0x13f54d+'%');}}}_0x548007[_0xfe8c('0x3e')](_0xc35828);_0x548007[_0xfe8c('0x83')](_0xfe8c('0x84'));var _0x36d0cb={'type':db[_0xfe8c('0x85')][_0xfe8c('0x86')][_0xfe8c('0x87')],'raw':!![]};var _0x491cf4=_0x548007['clone']();_0x491cf4[_0xfe8c('0x42')]('i.id');_0x491cf4[_0xfe8c('0x42')](_0xfe8c('0x88'),_0xfe8c('0x89'));if(_0x461657[_0xfe8c('0x8a')]){_0x461657[_0xfe8c('0x8a')][_0xfe8c('0x2d')](function(_0x319cd1){var _0x43267d=_0x319cd1[0x0]===_0xfe8c('0x8b')?_0x319cd1[0x0]:'i.'+_0x319cd1[0x0];_0x548007[_0xfe8c('0x8a')](_0x43267d,_0x319cd1[0x1]===_0xfe8c('0x8c')?![]:!![]);});}if(!_[_0xfe8c('0x6d')](_0x5f59fe)){_0x548007[_0xfe8c('0x78')](_0x3b51c6);_0x491cf4[_0xfe8c('0x3e')](_0xfe8c('0x8d'),_0x5f59fe);}BPromise[_0xfe8c('0x8e')]()[_0xfe8c('0x26')](function(){if(!_0x388caa){if(_0x4936b3['query'][_0xfe8c('0x8f')])return;_0x491cf4[_0xfe8c('0x3e')](_0xfe8c('0x90'));_0x548007['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x4936b3[_0xfe8c('0x91')][_0xfe8c('0x92')]!==_0xfe8c('0x93'))return;return _0x4936b3[_0xfe8c('0x91')][_0xfe8c('0x94')]({'attributes':['id'],'raw':!![]})[_0xfe8c('0x26')](function(_0x531164){if(_['isEmpty'](_0x531164)){_0x491cf4[_0xfe8c('0x3e')](_0xfe8c('0x95'));_0x548007[_0xfe8c('0x3e')](_0xfe8c('0x95'));}else{_0x491cf4[_0xfe8c('0x3e')](_0xfe8c('0x96'),_[_0xfe8c('0x32')](_0x531164,'id'));_0x548007[_0xfe8c('0x3e')](_0xfe8c('0x96'),_['map'](_0x531164,'id'));}});})[_0xfe8c('0x26')](function(){if(_0x4936b3[_0xfe8c('0x91')][_0xfe8c('0x92')]===_0xfe8c('0x93')&&!_0x388caa&&!_0x4936b3[_0xfe8c('0x36')][_0xfe8c('0x8f')])return[];return db[_0xfe8c('0x97')][_0xfe8c('0x36')](_0x491cf4['toString'](),_0x36d0cb);})[_0xfe8c('0x26')](function(_0x2e7e6a){_0x1f8f36[_0xfe8c('0x1f')]=_0x2e7e6a[_0xfe8c('0x3a')];if(_0x1f8f36['count']===0x0)return[];return db[_0xfe8c('0x97')][_0xfe8c('0x36')](_0xca8501[_0xfe8c('0x98')](),_0x36d0cb)[_0xfe8c('0x26')](function(_0x7ad9c6){_0x4dc12e=_['keyBy'](_0x7ad9c6,'id');_0x36d0cb=_[_0xfe8c('0x99')](_0x36d0cb,{'model':db[_0xfe8c('0x9a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4936b3[_0xfe8c('0x36')][_0xfe8c('0x39')]){_0x461657[_0xfe8c('0x38')]['forEach'](function(_0x5e6e63){_0x548007['field']('i.'+_0x5e6e63);});}else{_0x548007[_0xfe8c('0x42')](_0xfe8c('0x88'),_0xfe8c('0x89'));_0x548007['field']('a.key','Account.key');_0x548007[_0xfe8c('0x42')](_0xfe8c('0x9b'),_0xfe8c('0x9c'));_0x548007[_0xfe8c('0x42')](_0xfe8c('0x9d'),_0xfe8c('0x8b'));_0x548007[_0xfe8c('0x42')](_0xfe8c('0x9e'));_0x548007[_0xfe8c('0x42')]('c.firstName',_0xfe8c('0x9f'));_0x548007[_0xfe8c('0x42')]('c.lastName',_0xfe8c('0xa0'));_0x548007[_0xfe8c('0x42')]('c.email',_0xfe8c('0xa1'));_0x548007['field'](_0xfe8c('0xa2'),'Contact.phone');_0x548007['field'](_0xfe8c('0xa3'),_0xfe8c('0xa4'));_0x548007[_0xfe8c('0x42')]('c.fax',_0xfe8c('0xa5'));_0x548007[_0xfe8c('0x42')](_0xfe8c('0xa6'),_0xfe8c('0xa7'));_0x548007[_0xfe8c('0x42')](_0xfe8c('0xa8'),'Owner.internal');_0x548007['field']('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x461657[_0xfe8c('0x21')])_0x548007[_0xfe8c('0x21')](_0x461657[_0xfe8c('0x21')]);if(_0x461657[_0xfe8c('0x20')])_0x548007['offset'](_0x461657['offset']);return db[_0xfe8c('0x97')]['query'](_0x548007['toString'](),_0x36d0cb);})['then'](function(_0x1e8fdb){_0x3b3f13['where']('ui.OpenchannelInteractionId\x20IN\x20?',_[_0xfe8c('0x32')](_0x1e8fdb,'id'));return db['sequelize'][_0xfe8c('0x36')](_0x3b3f13[_0xfe8c('0x98')](),_0x36d0cb)['then'](function(_0x59039a){var _0x460db3=_[_0xfe8c('0xa9')](_0x59039a,_0xfe8c('0xaa'));var _0x1a8b68=[];_0x1e8fdb['forEach'](function(_0x293a1f){_0x1a8b68[_0xfe8c('0x2e')](updateOpenchannelInteraction(_0x293a1f,_0x4dc12e,_0x460db3));});return BPromise[_0xfe8c('0xab')](_0x1a8b68);});});})[_0xfe8c('0x26')](function(_0x206a6f){_0x1f8f36[_0xfe8c('0xac')]=_0x206a6f;return _0x1f8f36;})[_0xfe8c('0x26')](respondWithFilteredResult(_0x5c8b5a,_0x461657))[_0xfe8c('0x30')](handleError(_0x5c8b5a,null));};exports['show']=function(_0x255078,_0x17070b){var _0xc1eb9e={};if(_0x255078[_0xfe8c('0x36')]['type']&&_0x255078[_0xfe8c('0x36')][_0xfe8c('0x33')]===_0xfe8c('0x43')){_0xc1eb9e[_0xfe8c('0x43')]=_0x255078[_0xfe8c('0xad')]['id'];}else{_0xc1eb9e['id']=_0x255078[_0xfe8c('0xad')]['id'];}var _0x388966={'raw':![],'where':_0xc1eb9e},_0x3612a1={};_0x3612a1[_0xfe8c('0x35')]=_[_0xfe8c('0x6a')](db[_0xfe8c('0x9a')][_0xfe8c('0xae')]);_0x3612a1['query']=_[_0xfe8c('0x6a')](_0x255078[_0xfe8c('0x36')]);_0x3612a1['filters']=_[_0xfe8c('0x37')](_0x3612a1[_0xfe8c('0x35')],_0x3612a1['query']);_0x388966[_0xfe8c('0x38')]=_['intersection'](_0x3612a1['model'],qs[_0xfe8c('0x39')](_0x255078[_0xfe8c('0x36')]['fields']));_0x388966[_0xfe8c('0x38')]=_0x388966[_0xfe8c('0x38')][_0xfe8c('0x3a')]?_0x388966[_0xfe8c('0x38')]:_0x3612a1[_0xfe8c('0x35')];if(_0x255078[_0xfe8c('0x36')][_0xfe8c('0xaf')]){_0x388966['include']=[{'all':!![]}];}_0x388966=_['merge']({},_0x388966,_0x255078['options']);return db[_0xfe8c('0x9a')][_0xfe8c('0x60')](_0x388966)['then'](handleEntityNotFound(_0x17070b,null))['then'](respondWithResult(_0x17070b,null))[_0xfe8c('0x30')](handleError(_0x17070b,null));};exports[_0xfe8c('0xb0')]=function(_0x201cdf,_0x55f9d1){return db[_0xfe8c('0x9a')]['create'](_0x201cdf[_0xfe8c('0x69')],{})[_0xfe8c('0x26')](respondWithResult(_0x55f9d1,0xc9))['catch'](handleError(_0x55f9d1,null));};exports[_0xfe8c('0xb1')]=function(_0x53a3f0,_0x102abd){if(_0x53a3f0[_0xfe8c('0x69')]['id']){delete _0x53a3f0[_0xfe8c('0x69')]['id'];}return db[_0xfe8c('0x9a')]['find']({'where':{'id':_0x53a3f0[_0xfe8c('0xad')]['id']}})[_0xfe8c('0x26')](handleEntityNotFound(_0x102abd,null))['then'](saveUpdates(_0x53a3f0[_0xfe8c('0x69')],null))[_0xfe8c('0x26')](respondWithResult(_0x102abd,null))['catch'](handleError(_0x102abd,null));};exports['destroy']=function(_0x1de76e,_0x5203a5){return db[_0xfe8c('0x9a')][_0xfe8c('0x60')]({'where':{'id':_0x1de76e['params']['id']}})[_0xfe8c('0x26')](handleEntityNotFound(_0x5203a5,null))['then'](removeEntity(_0x5203a5,null))['catch'](handleError(_0x5203a5,null));};exports['describe']=function(_0x25977b,_0x9a0442){return db[_0xfe8c('0x9a')][_0xfe8c('0xb2')]()[_0xfe8c('0x26')](respondWithResult(_0x9a0442,null))[_0xfe8c('0x30')](handleError(_0x9a0442,null));};exports[_0xfe8c('0xb3')]=function(_0xd48371,_0x52583a,_0x44bc0c){return db[_0xfe8c('0xb4')]['find']({'where':{'id':_0xd48371['params']['id']}})[_0xfe8c('0x26')](handleEntityNotFound(_0x52583a,null))[_0xfe8c('0x26')](function(_0x5e4bca){if(_0x5e4bca){return _0x5e4bca['addMessage'](_0xd48371[_0xfe8c('0x69')][_0xfe8c('0xb5')],_[_0xfe8c('0xb6')](_0xd48371[_0xfe8c('0x69')],[_0xfe8c('0xb5'),'id'])||{});}})[_0xfe8c('0x26')](respondWithResult(_0x52583a,null))[_0xfe8c('0x30')](handleError(_0x52583a,null));};exports['getMessages']=function(_0x5a6b1e,_0x5ee8b7,_0x21ca4a){var _0x5aa515={'raw':![],'where':{}};var _0xbc880c={};var _0x2613da={'count':0x0,'rows':[]};return db['OpenchannelInteraction']['findOne']({'where':{'id':_0x5a6b1e['params']['id']}})[_0xfe8c('0x26')](handleEntityNotFound(_0x5ee8b7,null))[_0xfe8c('0x26')](function(_0x111df6){if(_0x111df6){_0xbc880c['model']=_[_0xfe8c('0x6a')](db[_0xfe8c('0xb4')][_0xfe8c('0xae')]);_0xbc880c[_0xfe8c('0x36')]=_['keys'](_0x5a6b1e['query']);_0xbc880c['filters']=_[_0xfe8c('0x37')](_0xbc880c[_0xfe8c('0x35')],_0xbc880c['query']);_0x5aa515['attributes']=_[_0xfe8c('0x37')](_0xbc880c[_0xfe8c('0x35')],qs[_0xfe8c('0x39')](_0x5a6b1e['query'][_0xfe8c('0x39')]));_0x5aa515['attributes']=_0x5aa515[_0xfe8c('0x38')][_0xfe8c('0x3a')]?_0x5aa515[_0xfe8c('0x38')]:_0xbc880c[_0xfe8c('0x35')];if(!_0x5a6b1e[_0xfe8c('0x36')][_0xfe8c('0x3b')](_0xfe8c('0x3c'))){_0x5aa515[_0xfe8c('0x21')]=qs[_0xfe8c('0x21')](_0x5a6b1e[_0xfe8c('0x36')][_0xfe8c('0x21')]);_0x5aa515[_0xfe8c('0x20')]=qs[_0xfe8c('0x20')](_0x5a6b1e['query'][_0xfe8c('0x20')]);}_0x5aa515[_0xfe8c('0x8a')]=qs[_0xfe8c('0x3d')](_0x5a6b1e[_0xfe8c('0x36')][_0xfe8c('0x3d')]);_0x5aa515[_0xfe8c('0x3e')]=qs[_0xfe8c('0x3f')](_[_0xfe8c('0x40')](_0x5a6b1e[_0xfe8c('0x36')],_0xbc880c['filters']));_0x5aa515[_0xfe8c('0x3e')][_0xfe8c('0xaa')]=_0x111df6['id'];if(_0x5a6b1e[_0xfe8c('0x36')][_0xfe8c('0x7c')]){_0x5aa515[_0xfe8c('0x3e')]=_[_0xfe8c('0x99')](_0x5aa515[_0xfe8c('0x3e')],{'$or':_[_0xfe8c('0x32')](_0x5aa515[_0xfe8c('0x38')],function(_0x8a116d){var _0x1d2244={};_0x1d2244[_0x8a116d]={'$like':'%'+_0x5a6b1e['query']['filter']+'%'};return _0x1d2244;})});}if(_0x5a6b1e[_0xfe8c('0x36')][_0xfe8c('0x71')]){var _0x283673=_0x5a6b1e['query'][_0xfe8c('0x71')][_0xfe8c('0x5d')](',');var _0x3fec96={};_0x3fec96[_0x283673[0x0]]={'$gte':moment(_0x283673[0x1])['format'](_0xfe8c('0xb7'))};_0x5aa515['where']=_[_0xfe8c('0x99')](_0x5aa515[_0xfe8c('0x3e')],_0x3fec96);}_0x5aa515=_[_0xfe8c('0x99')]({},_0x5aa515,_0x5a6b1e[_0xfe8c('0xb8')]);return db[_0xfe8c('0xb4')][_0xfe8c('0x1f')]({'where':_0x5aa515[_0xfe8c('0x3e')]})[_0xfe8c('0x26')](function(_0x413a7b){_0x2613da['count']=_0x413a7b;if(_0x5a6b1e[_0xfe8c('0x36')]['includeAll']){_0x5aa515[_0xfe8c('0xb9')]=[{'all':!![]}];}return db[_0xfe8c('0xb4')]['findAll'](_0x5aa515);})['then'](function(_0x51854f){_0x2613da['rows']=_0x51854f;return _0x2613da;});}})[_0xfe8c('0x26')](respondWithFilteredResult(_0x5ee8b7,_0x5aa515))[_0xfe8c('0x30')](handleError(_0x5ee8b7,null));};exports[_0xfe8c('0xba')]=function(_0x47f1a7,_0x4d9d10,_0x21e359){return db['OpenchannelInteraction'][_0xfe8c('0x60')]({'where':{'id':_0x47f1a7[_0xfe8c('0xad')]['id']}})[_0xfe8c('0x26')](handleEntityNotFound(_0x4d9d10,null))[_0xfe8c('0x26')](function(_0x1a1104){if(_0x1a1104){return _0x1a1104[_0xfe8c('0xbb')](_0x47f1a7['body'][_0xfe8c('0xb5')],_[_0xfe8c('0xb6')](_0x47f1a7[_0xfe8c('0x69')],[_0xfe8c('0xb5'),'id'])||{})[_0xfe8c('0xbc')](function(){return db['Tag'][_0xfe8c('0xbd')]({'attributes':['id',_0xfe8c('0x2a'),_0xfe8c('0xbe')],'where':{'id':_0x47f1a7[_0xfe8c('0x69')][_0xfe8c('0xb5')]}});})[_0xfe8c('0x26')](function(_0x1cd765){socket[_0xfe8c('0xbf')]('openchannelInteractionTags:save',{'id':Number(_0x47f1a7[_0xfe8c('0xad')]['id']),'tags':_0x1cd765||[]});return{'id':Number(_0x47f1a7[_0xfe8c('0xad')]['id']),'tags':_0x1cd765||[]};});}})[_0xfe8c('0x26')](respondWithResult(_0x4d9d10,null))[_0xfe8c('0x30')](handleError(_0x4d9d10,null));};exports['removeTags']=function(_0x281133,_0x5c14f3,_0x4bf9a7){return db[_0xfe8c('0x9a')][_0xfe8c('0x60')]({'where':{'id':_0x281133[_0xfe8c('0xad')]['id']}})['then'](handleEntityNotFound(_0x5c14f3,null))[_0xfe8c('0x26')](function(_0x3203fd){if(_0x3203fd){return _0x3203fd[_0xfe8c('0xc0')](_0x281133['query'][_0xfe8c('0xb5')]);}})[_0xfe8c('0x26')](respondWithStatusCode(_0x5c14f3,null))[_0xfe8c('0x30')](handleError(_0x5c14f3,null));};exports[_0xfe8c('0xc1')]=function(_0x199e4d,_0x41f7a4){var _0x57994e=moment()[_0xfe8c('0xc2')]()[_0xfe8c('0x98')]();var _0x1a3b98=path[_0xfe8c('0xc3')](config[_0xfe8c('0xc4')],'server','files',_0xfe8c('0xc5'));var _0x1e00b9=path['join'](config[_0xfe8c('0xc4')],'server',_0xfe8c('0xc6'),'attachments');var _0x3e0b15=path['join'](_0x1a3b98,_0x57994e);var _0x22225e=util['format'](_0xfe8c('0xc7'),_0x199e4d[_0xfe8c('0xad')]['id'],_0x57994e);var _0x34c426=path['join'](_0x1a3b98,_0x22225e);var _0x2e14fe=[];_0x2e14fe['push']({'model':db['User'],'as':_0xfe8c('0xc8'),'attributes':['id',_0xfe8c('0xc9')],'raw':!![]});_0x2e14fe['push']({'model':db[_0xfe8c('0xca')],'as':_0xfe8c('0x5a'),'attributes':['id',_0xfe8c('0xcb'),_0xfe8c('0xcc')],'raw':!![]});if(_0x199e4d[_0xfe8c('0x36')]['attachments']){_0x2e14fe[_0xfe8c('0x2e')]({'model':db[_0xfe8c('0xcd')],'as':_0xfe8c('0xcd'),'raw':!![]});}var _0x40faa2=[{'model':db[_0xfe8c('0xb4')],'as':'Messages','attributes':['id',_0xfe8c('0x69'),_0xfe8c('0x6f'),_0xfe8c('0xce'),_0xfe8c('0xcf'),_0xfe8c('0x76')],'include':_0x2e14fe}];_0x40faa2[_0xfe8c('0x2e')]({'model':db[_0xfe8c('0xd0')],'as':_0xfe8c('0xd1'),'attributes':['id','name']});_0x40faa2[_0xfe8c('0x2e')]({'model':db[_0xfe8c('0xc8')],'as':_0xfe8c('0xd2'),'attributes':['id',_0xfe8c('0xc9')]});return db[_0xfe8c('0x9a')][_0xfe8c('0x60')]({'where':{'id':_0x199e4d['params']['id']},'include':_0x40faa2})['then'](handleEntityNotFound(_0x41f7a4,null))['then'](function(_0x448482){if(_0x448482){var _0x1602c0=_0x448482[_0xfe8c('0xd3')]({'plain':!![]});fs['mkdirSync'](_0x3e0b15);var _0x44ad77={'channel':_0xfe8c('0xd4'),'account':_0x1602c0['Account'][_0xfe8c('0x2a')],'agent':_0x1602c0[_0xfe8c('0xd2')]?_0x1602c0[_0xfe8c('0xd2')]['fullname']:_0xfe8c('0xd5'),'createdAt':moment(_0x1602c0[_0xfe8c('0x6f')])[_0xfe8c('0xd6')](_0xfe8c('0xb7'))[_0xfe8c('0x98')](),'closedAt':_0x1602c0[_0xfe8c('0xd7')]?moment(_0x1602c0[_0xfe8c('0xd8')])[_0xfe8c('0xd6')](_0xfe8c('0xb7'))['toString']():'','disposition':_0x1602c0[_0xfe8c('0xd9')],'visibility':_0x1602c0['threadId']?_0xfe8c('0xda'):_0xfe8c('0xdb'),'messages':_(_0x1602c0[_0xfe8c('0xdc')])[_0xfe8c('0x7c')]({'secret':![]})[_0xfe8c('0x32')](function(_0x14adc6){if(_0x14adc6[_0xfe8c('0xcd')]){var _0xd2c35a=path['join'](_0x1e00b9,_0x14adc6[_0xfe8c('0xcd')][_0xfe8c('0xdd')]);if(fs['existsSync'](_0xd2c35a)){fs[_0xfe8c('0xde')](_0xd2c35a)[_0xfe8c('0xdf')](fs[_0xfe8c('0xe0')](path[_0xfe8c('0xc3')](_0x3e0b15,_0x14adc6[_0xfe8c('0xcd')]['basename'])));}}return{'date':moment(_0x14adc6[_0xfe8c('0x6f')])[_0xfe8c('0xd6')](_0xfe8c('0xb7'))['toString'](),'sender':_0x14adc6[_0xfe8c('0xce')]===_0xfe8c('0xe1')?_0x14adc6[_0xfe8c('0xc8')]?_0x14adc6['User']['fullname']:_0xfe8c('0xe2'):_0x14adc6[_0xfe8c('0x5a')]['firstName']+(_0x14adc6[_0xfe8c('0x5a')][_0xfe8c('0xcc')]?'\x20'+_0x14adc6['Contact'][_0xfe8c('0xcc')]:''),'body':_0x14adc6[_0xfe8c('0xcd')]?_0x14adc6[_0xfe8c('0xcd')][_0xfe8c('0xdd')]:_0x14adc6[_0xfe8c('0x69')],'direction':_0x14adc6[_0xfe8c('0xce')]===_0xfe8c('0xe1')?'A':'C','secret':_0x14adc6['secret'],'read':_0x14adc6[_0xfe8c('0x76')],'attachment':_0x14adc6[_0xfe8c('0xcd')]};})[_0xfe8c('0x58')]()};return ejs['renderFile'](path[_0xfe8c('0xc3')](config[_0xfe8c('0xc4')],_0xfe8c('0xe3'),_0xfe8c('0xe4'),_0xfe8c('0xe5')),{'interaction':_0x44ad77})['then'](function(_0x5d544){var _0x688219=path[_0xfe8c('0xc3')](_0x3e0b15,_0xfe8c('0xe6')+_0x1602c0['id']+'-'+_0x57994e+'.pdf');var _0x15400e={'path':_0x688219,'channel':_0xfe8c('0xd4'),'interactionId':_0x1602c0['id']};return pdf[_0xfe8c('0xe7')](_0x5d544,_0x15400e);})['then'](function(){return new BPromise(function(_0x4b7c4d,_0x55061b){zipdir(_0x3e0b15,{'saveTo':_0x34c426},function(_0x359631,_0x3c2e51){if(_0x359631)return _0x55061b(_0x359631);return _0x4b7c4d(_0x3c2e51);});})[_0xfe8c('0x26')](function(){return new BPromise(function(_0x5c1ae3,_0x4d8f1d){rimraf(_0x3e0b15,function(_0x16b247){if(_0x16b247)_0x4d8f1d(_0x16b247);return _0x5c1ae3();});});})['then'](function(){return _0x41f7a4[_0xfe8c('0xc1')](_0x34c426,_0x22225e,function(_0x1d80bd){if(_0x1d80bd){console[_0xfe8c('0xe8')](_0xfe8c('0xe9'),_0x1d80bd);}else{fs[_0xfe8c('0xea')](_0x34c426);}});});});}else{return _0x41f7a4[_0xfe8c('0x27')](0xc8);}})['catch'](handleError(_0x41f7a4,null));}; \ No newline at end of file +var _0x79d3=['tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','i.id','Sequelize','QueryTypes','clone','contactName','DESC','isEmpty','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','rows','catch','show','params','include','options','create','body','describe','addMessage','ids','omit','findOne','OpenchannelMessage','OpenchannelInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','setTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','fullname','CmContact','Contact','firstName','Attachment','Messages','direction','secret','Account','Owner','get','mkdirSync','Openchannel','N.A.','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','lastName','downloadInteraction.html','.pdf','log','err','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','name','send','map','TagIds','Tags','split','forEach','push','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','select','field','from','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_messages','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','expr','search','parseSearch','sqlOperator','conditions','find','having','`\x20=\x200','`\x20>\x200','operator','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','value','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','keys','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20=\x20?','read','`unreadMessages`\x20>\x200'];(function(_0x22b6e5,_0x2819c8){var _0x1c21e5=function(_0x18a52c){while(--_0x18a52c){_0x22b6e5['push'](_0x22b6e5['shift']());}};_0x1c21e5(++_0x2819c8);}(_0x79d3,0x15f));var _0x379d=function(_0xc3f3bd,_0x20b7f5){_0xc3f3bd=_0xc3f3bd-0x0;var _0x27d0bd=_0x79d3[_0xc3f3bd];return _0x27d0bd;};'use strict';var emlformat=require(_0x379d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x379d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x379d('0x2'));var moment=require(_0x379d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x379d('0x4'));var util=require(_0x379d('0x5'));var path=require(_0x379d('0x6'));var sox=require(_0x379d('0x7'));var csv=require(_0x379d('0x8'));var ejs=require(_0x379d('0x9'));var fs=require('fs');var fs_extra=require(_0x379d('0xa'));var _=require('lodash');var squel=require(_0x379d('0xb'));var crypto=require('crypto');var jsforce=require(_0x379d('0xc'));var deskjs=require(_0x379d('0xd'));var toCsv=require(_0x379d('0x8'));var querystring=require('querystring');var Papa=require(_0x379d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x379d('0xf'));var pdf=require(_0x379d('0x10'));var hardwareService=require(_0x379d('0x11'));var logger=require('../../config/logger')(_0x379d('0x12'));var utils=require(_0x379d('0x13'));var config=require(_0x379d('0x14'));var licenseUtil=require(_0x379d('0x15'));var db=require('../../mysqldb')['db'];config[_0x379d('0x16')]=_[_0x379d('0x17')](config[_0x379d('0x16')],{'host':_0x379d('0x18'),'port':0x18eb});var socket=require(_0x379d('0x19'))(new Redis(config[_0x379d('0x16')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x368182,_0x54132b){_0x54132b=_0x54132b||0xcc;return function(_0x13ed31){if(_0x13ed31){return _0x368182[_0x379d('0x1a')](_0x54132b);}return _0x368182[_0x379d('0x1b')](_0x54132b)[_0x379d('0x1c')]();};}function respondWithResult(_0x4ed2af,_0x167acc){_0x167acc=_0x167acc||0xc8;return function(_0x5785b5){if(_0x5785b5){return _0x4ed2af['status'](_0x167acc)['json'](_0x5785b5);}};}function respondWithFilteredResult(_0x460ac3,_0xe53ada){return function(_0x14040c){if(_0x14040c){var _0x1ff2d2=_0x14040c[_0x379d('0x1d')],_0x268f42=_0xe53ada[_0x379d('0x1e')],_0x13a4da=_0xe53ada['offset']+_0xe53ada[_0x379d('0x1f')],_0x1154c0;if(_0x13a4da>=_0x1ff2d2){_0x13a4da=_0x1ff2d2;_0x1154c0=0xc8;}else{_0x1154c0=0xce;}_0x460ac3[_0x379d('0x1b')](_0x1154c0);return _0x460ac3[_0x379d('0x20')](_0x379d('0x21'),_0x268f42+'-'+_0x13a4da+'/'+_0x1ff2d2)[_0x379d('0x22')](_0x14040c);}return null;};}function patchUpdates(_0x27c1cf){return function(_0x11a3e0){try{jsonpatch[_0x379d('0x23')](_0x11a3e0,_0x27c1cf,!![]);}catch(_0x316f99){return BPromise[_0x379d('0x24')](_0x316f99);}return _0x11a3e0[_0x379d('0x25')]();};}function saveUpdates(_0x3923db,_0x338dc0){return function(_0x177df1){if(_0x177df1){return _0x177df1[_0x379d('0x26')](_0x3923db)['then'](function(_0x3c5109){return _0x3c5109;});}return null;};}function removeEntity(_0x3cfd46,_0x56f4b1){return function(_0xabb0ca){if(_0xabb0ca){return _0xabb0ca[_0x379d('0x27')]()[_0x379d('0x28')](function(){_0x3cfd46[_0x379d('0x1b')](0xcc)[_0x379d('0x1c')]();});}};}function handleEntityNotFound(_0x38a92f,_0x3eeff0){return function(_0x5e6855){if(!_0x5e6855){_0x38a92f[_0x379d('0x1a')](0x194);}return _0x5e6855;};}function handleError(_0x42d617,_0x9e755){_0x9e755=_0x9e755||0x1f4;return function(_0x279e1a){logger[_0x379d('0x29')](_0x279e1a['stack']);if(_0x279e1a[_0x379d('0x2a')]){delete _0x279e1a['name'];}_0x42d617['status'](_0x9e755)[_0x379d('0x2b')](_0x279e1a);};}function getInteractionUsers(_0x141a00,_0xb93461){return new BPromise(function(_0xdfc7ee,_0x2e55be){try{if(_0xb93461[_0x141a00['id']]){_0x141a00['Users']=_[_0x379d('0x2c')](_0xb93461[_0x141a00['id']],function(_0x1d5cac){return{'id':_0x1d5cac['id'],'fullname':_0x1d5cac['fullname']};});}}catch(_0x3e337f){_0x2e55be(_0x3e337f);}_0xdfc7ee(_0x141a00);});}function getInteractionTags(_0x41422e,_0x795dc0){return new BPromise(function(_0xfaf3b,_0x42d94a){try{if(_0x41422e[_0x379d('0x2d')]){_0x41422e[_0x379d('0x2e')]=[];_0x41422e['TagIds'][_0x379d('0x2f')](',')[_0x379d('0x30')](function(_0x5a8e6c){_0x41422e['Tags'][_0x379d('0x31')](_0x795dc0[_0x5a8e6c]);});}delete _0x41422e[_0x379d('0x2d')];}catch(_0x61c878){_0x42d94a(_0x61c878);}_0xfaf3b(_0x41422e);});}function updateOpenchannelInteraction(_0x3e725a,_0x1fc1c7,_0x58e137){return new BPromise(function(_0x2373df,_0x1f763b){return getInteractionUsers(_0x3e725a,_0x58e137)['then'](function(_0x22c2a3){return getInteractionTags(_0x22c2a3,_0x1fc1c7);})['then'](function(_0x163c30){_0x2373df(_0x163c30);})['catch'](function(_0x376bfe){_0x1f763b(_0x376bfe);});});}exports[_0x379d('0x32')]=function(_0x1fa420,_0x51c395){var _0x277e53={},_0x5745ad={},_0x25bee9={'count':0x0,'rows':[]};var _0xa55a14=_[_0x379d('0x2c')](db[_0x379d('0x33')][_0x379d('0x34')],function(_0x461661){return{'name':_0x461661[_0x379d('0x35')],'type':_0x461661[_0x379d('0x36')][_0x379d('0x37')]};});_0x5745ad['model']=_[_0x379d('0x2c')](_0xa55a14,_0x379d('0x2a'));_0x5745ad[_0x379d('0x38')]=_['keys'](_0x1fa420[_0x379d('0x38')]);_0x5745ad[_0x379d('0x39')]=_['intersection'](_0x5745ad[_0x379d('0x3a')],_0x5745ad[_0x379d('0x38')]);_0x277e53[_0x379d('0x3b')]=_[_0x379d('0x3c')](_0x5745ad[_0x379d('0x3a')],qs[_0x379d('0x3d')](_0x1fa420[_0x379d('0x38')][_0x379d('0x3d')]));_0x277e53[_0x379d('0x3b')]=_0x277e53['attributes'][_0x379d('0x3e')]?_0x277e53[_0x379d('0x3b')]:_0x5745ad['model'];if(!_0x1fa420[_0x379d('0x38')][_0x379d('0x3f')]('nolimit')){_0x277e53[_0x379d('0x1f')]=qs[_0x379d('0x1f')](_0x1fa420['query']['limit']);_0x277e53[_0x379d('0x1e')]=qs['offset'](_0x1fa420[_0x379d('0x38')][_0x379d('0x1e')]);}_0x277e53[_0x379d('0x40')]=qs['sort'](_0x1fa420[_0x379d('0x38')][_0x379d('0x41')]);_0x277e53[_0x379d('0x42')]=qs[_0x379d('0x39')](_[_0x379d('0x43')](_0x1fa420[_0x379d('0x38')],_0x5745ad[_0x379d('0x39')]),_0xa55a14);var _0x247caa=[];var _0x3ce5da=squel[_0x379d('0x44')]()[_0x379d('0x45')]('id')[_0x379d('0x45')](_0x379d('0x2a'))[_0x379d('0x45')]('color')[_0x379d('0x46')]('tools_tags');var _0x5cb7d2=squel[_0x379d('0x44')]()[_0x379d('0x45')]('u.id')[_0x379d('0x45')](_0x379d('0x47'))['field'](_0x379d('0x48'))[_0x379d('0x46')](_0x379d('0x49'),'ui')[_0x379d('0x4a')]('users','u',_0x379d('0x4b'));var _0x4a48bb=squel[_0x379d('0x44')]()[_0x379d('0x46')](_0x379d('0x4c'),'i')['left_join'](_0x379d('0x4d'),'c',_0x379d('0x4e'))[_0x379d('0x4a')](_0x379d('0x4f'),'o',_0x379d('0x50'))[_0x379d('0x4a')](_0x379d('0x51'),'a','a.id\x20=\x20i.OpenchannelAccountId')['left_join'](_0x379d('0x52'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x379d('0x4a')](_0x379d('0x53'),'it',_0x379d('0x54'))[_0x379d('0x4a')](_0x379d('0x55'),'t','t.id\x20=\x20it.TagId');var _0x1d0964=squel[_0x379d('0x56')]();var _0x1a8ebf=[];var _0x95034a=squel['expr']();var _0x3129c9;if(_0x1fa420[_0x379d('0x38')][_0x379d('0x57')]){_0x3129c9=as[_0x379d('0x58')](_0x1fa420[_0x379d('0x38')]['search']);var _0x149276=_0x3129c9[_0x379d('0x59')];for(var _0x30714f=0x0;_0x30714f<_0x3129c9['conditions'][_0x379d('0x3e')];_0x30714f++){var _0x594ef8=_0x3129c9[_0x379d('0x5a')][_0x30714f];var _0x2e7978='i';var _0x253437=_[_0x379d('0x5b')](_0xa55a14,[_0x379d('0x2a'),_0x594ef8[_0x379d('0x45')]]);if(!_0x253437){switch(_0x594ef8[_0x379d('0x45')]){case'unreadMessages':if(_0x594ef8['value']==0x1){_0x4a48bb[_0x379d('0x5c')]('`'+_0x594ef8[_0x379d('0x45')]+_0x379d('0x5d'));}else{_0x4a48bb['having']('`'+_0x594ef8[_0x379d('0x45')]+_0x379d('0x5e'));}break;case'Contact':if(_0x594ef8[_0x379d('0x5f')]===_0x379d('0x60')){if(_0x594ef8['value'][_0x379d('0x2f')]('\x20')[_0x379d('0x3e')]>0x1){_0x1d0964[_0x149276]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x594ef8['value']),null);}else{var _0x182e6e='%'+_0x594ef8['value']+'%';_0x1d0964[_0x149276](_0x379d('0x61'),_0x182e6e,_0x182e6e,_0x182e6e);}}else{_0x253437=_[_0x379d('0x5b')](_0xa55a14,[_0x379d('0x2a'),'ContactId']);_0x594ef8['field']=_0x379d('0x62');_0x31e551=as[_0x379d('0x63')](_0x2e7978,_0x253437[_0x379d('0x36')],_0x594ef8);_0x1d0964[_0x149276](_0x31e551[_0x379d('0x64')],_0x31e551[_0x379d('0x65')][_0x379d('0x66')],_0x31e551['value']['end']);}break;case _0x379d('0x67'):var _0x446130=_0x594ef8[_0x379d('0x65')][_0x379d('0x2f')](',')[_0x379d('0x2c')](function(_0x4c291d){return Number(_0x4c291d);});_0x446130[_0x379d('0x30')](function(_0x121bef){_0x95034a['or'](_0x379d('0x68'),'%,'+_0x121bef+',%');});_0x1a8ebf=_[_0x379d('0x69')](_0x1a8ebf,_0x446130);break;case _0x379d('0x6a'):if(_0x594ef8[_0x379d('0x5f')]===_0x379d('0x60')){_0x1d0964[_0x149276]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x594ef8[_0x379d('0x65')]+'%',null);}else{_0x253437=_[_0x379d('0x5b')](_0xa55a14,[_0x379d('0x2a'),_0x379d('0x6b')]);_0x594ef8[_0x379d('0x45')]='UserId';_0x31e551=as[_0x379d('0x63')](_0x2e7978,_0x253437[_0x379d('0x36')],_0x594ef8);_0x1d0964[_0x149276](_0x31e551['text'],_0x31e551[_0x379d('0x65')][_0x379d('0x66')],_0x31e551[_0x379d('0x65')]['end']);}break;case'body':_0x31e551=as['buildExpression']('me',null,_0x594ef8);_0x1d0964[_0x149276](_0x31e551[_0x379d('0x64')],_0x31e551[_0x379d('0x65')]['start'],_0x31e551[_0x379d('0x65')][_0x379d('0x1c')]);break;}}else{var _0x31e551=as[_0x379d('0x63')](_0x2e7978,_0x253437[_0x379d('0x36')],_0x594ef8);_0x1d0964[_0x149276](_0x31e551[_0x379d('0x64')],_0x31e551[_0x379d('0x65')][_0x379d('0x66')],_0x31e551['value'][_0x379d('0x1c')]);}}}else{var _0x90b490=_(_0x1fa420['query'])[_0x379d('0x6c')]()[_0x379d('0x2c')](function(_0x240d9b){return _['some'](_0xa55a14,[_0x379d('0x2a'),_0x240d9b])?_0x240d9b:undefined;})[_0x379d('0x6d')]()[_0x379d('0x65')]();if(!_['isEmpty'](_0x90b490)){_0x90b490[_0x379d('0x30')](function(_0x208906){if(_0x208906===_0x379d('0x6e')){_0x4a48bb['where'](_0x379d('0x6f'),[][_0x379d('0x70')](_0x1fa420[_0x379d('0x38')][_0x208906]));}else if(_0x208906===_0x379d('0x71')){var _0xcb93b1=JSON[_0x379d('0x72')](_0x1fa420[_0x379d('0x38')][_0x208906])[_0x379d('0x73')];var _0x2ba27e=JSON[_0x379d('0x72')](_0x1fa420[_0x379d('0x38')][_0x208906])[_0x379d('0x74')];_0x4a48bb[_0x379d('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xcb93b1,_0x2ba27e);}else{if(_0x1fa420[_0x379d('0x38')][_0x208906]===_0x379d('0x75')){_0x4a48bb[_0x379d('0x42')]('i.'+_0x208906+'\x20IS\x20NULL');}else{_0x4a48bb[_0x379d('0x42')]('i.'+_0x208906+_0x379d('0x76'),_0x1fa420['query'][_0x208906]);}}});}if(_0x1fa420[_0x379d('0x38')][_0x379d('0x77')]){if(_0x1fa420[_0x379d('0x38')]['read']==0x1){_0x4a48bb[_0x379d('0x5c')]('`unreadMessages`\x20=\x200');}else{_0x4a48bb[_0x379d('0x5c')](_0x379d('0x78'));}}if(_0x1fa420[_0x379d('0x38')][_0x379d('0x79')]){_0x1a8ebf=_[_0x379d('0x7a')](_0x1fa420['query']['tag'])?_0x1fa420['query'][_0x379d('0x79')]:new Array(_0x1fa420[_0x379d('0x38')][_0x379d('0x79')]);_0x1a8ebf[_0x379d('0x30')](function(_0x9a7ace){_0x95034a['or'](_0x379d('0x68'),'%,'+_0x9a7ace+',%');});}if(_0x1fa420[_0x379d('0x38')][_0x379d('0x7b')]){var _0x222803=_0x1fa420[_0x379d('0x38')][_0x379d('0x7b')]['replace']('\x5c','\x5c\x5c')[_0x379d('0x7c')](/'/g,'\x27\x27');if(qs[_0x379d('0x7d')](_0x222803)){_0x1d0964['or'](_0x379d('0x7e'),_0x222803+'%');}else{_0x1d0964['or'](_0x379d('0x7f'),qs[_0x379d('0x80')](_0x222803))['or']('i.from\x20LIKE\x20?',_0x222803+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x222803+'%');}}}_0x4a48bb[_0x379d('0x42')](_0x1d0964);_0x4a48bb[_0x379d('0x81')](_0x379d('0x82'));var _0x265193={'type':db[_0x379d('0x83')][_0x379d('0x84')]['SELECT'],'raw':!![]};var _0x5f1cdc=_0x4a48bb[_0x379d('0x85')]();_0x5f1cdc[_0x379d('0x45')](_0x379d('0x82'));_0x5f1cdc[_0x379d('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x277e53[_0x379d('0x40')]){_0x277e53[_0x379d('0x40')][_0x379d('0x30')](function(_0x38151e){var _0x385215=_0x38151e[0x0]===_0x379d('0x86')?_0x38151e[0x0]:'i.'+_0x38151e[0x0];_0x4a48bb['order'](_0x385215,_0x38151e[0x1]===_0x379d('0x87')?![]:!![]);});}if(!_[_0x379d('0x88')](_0x1a8ebf)){_0x4a48bb['having'](_0x95034a);_0x5f1cdc[_0x379d('0x42')]('t.id\x20IN\x20?',_0x1a8ebf);}BPromise['resolve']()[_0x379d('0x28')](function(){if(!_0x3129c9){if(_0x1fa420['query']['OpenchannelAccountId'])return;_0x5f1cdc[_0x379d('0x42')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x4a48bb['where'](_0x379d('0x89'));return;}if(_0x1fa420[_0x379d('0x8a')][_0x379d('0x8b')]!==_0x379d('0x8c'))return;return _0x1fa420[_0x379d('0x8a')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x379d('0x28')](function(_0x47bcc5){if(_[_0x379d('0x88')](_0x47bcc5)){_0x5f1cdc[_0x379d('0x42')](_0x379d('0x8d'));_0x4a48bb[_0x379d('0x42')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x5f1cdc['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0x379d('0x2c')](_0x47bcc5,'id'));_0x4a48bb[_0x379d('0x42')](_0x379d('0x6f'),_[_0x379d('0x2c')](_0x47bcc5,'id'));}});})[_0x379d('0x28')](function(){if(_0x1fa420['user'][_0x379d('0x8b')]===_0x379d('0x8c')&&!_0x3129c9&&!_0x1fa420['query'][_0x379d('0x6e')])return[];return db['sequelize']['query'](_0x5f1cdc[_0x379d('0x8e')](),_0x265193);})[_0x379d('0x28')](function(_0x289872){_0x25bee9[_0x379d('0x1d')]=_0x289872[_0x379d('0x3e')];if(_0x25bee9[_0x379d('0x1d')]===0x0)return[];return db[_0x379d('0x8f')][_0x379d('0x38')](_0x3ce5da[_0x379d('0x8e')](),_0x265193)[_0x379d('0x28')](function(_0x5871b4){_0x247caa=_[_0x379d('0x90')](_0x5871b4,'id');_0x265193=_[_0x379d('0x91')](_0x265193,{'model':db[_0x379d('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1fa420[_0x379d('0x38')][_0x379d('0x3d')]){_0x277e53[_0x379d('0x3b')][_0x379d('0x30')](function(_0xbadb01){_0x4a48bb['field']('i.'+_0xbadb01);});}else{_0x4a48bb[_0x379d('0x45')](_0x379d('0x92'),_0x379d('0x93'));_0x4a48bb[_0x379d('0x45')](_0x379d('0x94'),_0x379d('0x95'));_0x4a48bb[_0x379d('0x45')](_0x379d('0x96'),_0x379d('0x97'));_0x4a48bb[_0x379d('0x45')](_0x379d('0x98'),_0x379d('0x86'));_0x4a48bb[_0x379d('0x45')](_0x379d('0x99'));_0x4a48bb['field'](_0x379d('0x9a'),_0x379d('0x9b'));_0x4a48bb[_0x379d('0x45')]('c.lastName',_0x379d('0x9c'));_0x4a48bb['field'](_0x379d('0x9d'),'Contact.email');_0x4a48bb[_0x379d('0x45')](_0x379d('0x9e'),_0x379d('0x9f'));_0x4a48bb[_0x379d('0x45')](_0x379d('0xa0'),_0x379d('0xa1'));_0x4a48bb[_0x379d('0x45')](_0x379d('0xa2'),_0x379d('0xa3'));_0x4a48bb['field'](_0x379d('0xa4'),_0x379d('0xa5'));_0x4a48bb[_0x379d('0x45')](_0x379d('0xa6'),_0x379d('0xa7'));_0x4a48bb['field'](_0x379d('0xa8'),_0x379d('0x2d'));}if(_0x277e53[_0x379d('0x1f')])_0x4a48bb[_0x379d('0x1f')](_0x277e53['limit']);if(_0x277e53[_0x379d('0x1e')])_0x4a48bb[_0x379d('0x1e')](_0x277e53[_0x379d('0x1e')]);return db['sequelize'][_0x379d('0x38')](_0x4a48bb[_0x379d('0x8e')](),_0x265193);})[_0x379d('0x28')](function(_0x53c503){_0x5cb7d2[_0x379d('0x42')](_0x379d('0xa9'),_['map'](_0x53c503,'id'));return db[_0x379d('0x8f')]['query'](_0x5cb7d2[_0x379d('0x8e')](),_0x265193)[_0x379d('0x28')](function(_0x21ae6f){var _0x2b1d70=_[_0x379d('0xaa')](_0x21ae6f,'OpenchannelInteractionId');var _0x2d8245=[];_0x53c503[_0x379d('0x30')](function(_0x2648ba){_0x2d8245['push'](updateOpenchannelInteraction(_0x2648ba,_0x247caa,_0x2b1d70));});return BPromise['all'](_0x2d8245);});});})[_0x379d('0x28')](function(_0x2124cd){_0x25bee9[_0x379d('0xab')]=_0x2124cd;return _0x25bee9;})['then'](respondWithFilteredResult(_0x51c395,_0x277e53))[_0x379d('0xac')](handleError(_0x51c395,null));};exports[_0x379d('0xad')]=function(_0x4d0ee1,_0x39420){var _0x2c43f2={};if(_0x4d0ee1[_0x379d('0x38')][_0x379d('0x36')]&&_0x4d0ee1[_0x379d('0x38')][_0x379d('0x36')]==='from'){_0x2c43f2['from']=_0x4d0ee1['params']['id'];}else{_0x2c43f2['id']=_0x4d0ee1[_0x379d('0xae')]['id'];}var _0x4804d3={'raw':![],'where':_0x2c43f2},_0x583273={};_0x583273[_0x379d('0x3a')]=_['keys'](db[_0x379d('0x33')]['rawAttributes']);_0x583273['query']=_[_0x379d('0x6c')](_0x4d0ee1[_0x379d('0x38')]);_0x583273[_0x379d('0x39')]=_[_0x379d('0x3c')](_0x583273[_0x379d('0x3a')],_0x583273['query']);_0x4804d3['attributes']=_[_0x379d('0x3c')](_0x583273[_0x379d('0x3a')],qs['fields'](_0x4d0ee1[_0x379d('0x38')][_0x379d('0x3d')]));_0x4804d3[_0x379d('0x3b')]=_0x4804d3[_0x379d('0x3b')][_0x379d('0x3e')]?_0x4804d3['attributes']:_0x583273['model'];if(_0x4d0ee1['query']['includeAll']){_0x4804d3[_0x379d('0xaf')]=[{'all':!![]}];}_0x4804d3=_[_0x379d('0x91')]({},_0x4804d3,_0x4d0ee1[_0x379d('0xb0')]);return db[_0x379d('0x33')][_0x379d('0x5b')](_0x4804d3)[_0x379d('0x28')](handleEntityNotFound(_0x39420,null))[_0x379d('0x28')](respondWithResult(_0x39420,null))['catch'](handleError(_0x39420,null));};exports[_0x379d('0xb1')]=function(_0x583ac9,_0x34e99c){return db[_0x379d('0x33')][_0x379d('0xb1')](_0x583ac9[_0x379d('0xb2')],{})[_0x379d('0x28')](respondWithResult(_0x34e99c,0xc9))[_0x379d('0xac')](handleError(_0x34e99c,null));};exports[_0x379d('0x26')]=function(_0x4894bc,_0x546515){if(_0x4894bc[_0x379d('0xb2')]['id']){delete _0x4894bc[_0x379d('0xb2')]['id'];}return db['OpenchannelInteraction'][_0x379d('0x5b')]({'where':{'id':_0x4894bc[_0x379d('0xae')]['id']}})[_0x379d('0x28')](handleEntityNotFound(_0x546515,null))['then'](saveUpdates(_0x4894bc[_0x379d('0xb2')],null))[_0x379d('0x28')](respondWithResult(_0x546515,null))[_0x379d('0xac')](handleError(_0x546515,null));};exports[_0x379d('0x27')]=function(_0x35435f,_0x4fcbc4){return db[_0x379d('0x33')][_0x379d('0x5b')]({'where':{'id':_0x35435f[_0x379d('0xae')]['id']}})[_0x379d('0x28')](handleEntityNotFound(_0x4fcbc4,null))[_0x379d('0x28')](removeEntity(_0x4fcbc4,null))['catch'](handleError(_0x4fcbc4,null));};exports[_0x379d('0xb3')]=function(_0x2e226e,_0x227867){return db[_0x379d('0x33')]['describe']()[_0x379d('0x28')](respondWithResult(_0x227867,null))[_0x379d('0xac')](handleError(_0x227867,null));};exports['addMessage']=function(_0x9f5ac7,_0x4a462c,_0x5dc996){return db['OpenchannelMessage']['find']({'where':{'id':_0x9f5ac7['params']['id']}})[_0x379d('0x28')](handleEntityNotFound(_0x4a462c,null))[_0x379d('0x28')](function(_0x594ac9){if(_0x594ac9){return _0x594ac9[_0x379d('0xb4')](_0x9f5ac7['body'][_0x379d('0xb5')],_[_0x379d('0xb6')](_0x9f5ac7[_0x379d('0xb2')],[_0x379d('0xb5'),'id'])||{});}})[_0x379d('0x28')](respondWithResult(_0x4a462c,null))[_0x379d('0xac')](handleError(_0x4a462c,null));};exports['getMessages']=function(_0x469a59,_0x374fd1,_0x727569){var _0x5a340a={'raw':![],'where':{}};var _0x4cd426={};var _0x4e3e68={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x379d('0xb7')]({'where':{'id':_0x469a59['params']['id']}})[_0x379d('0x28')](handleEntityNotFound(_0x374fd1,null))['then'](function(_0x27c2bf){if(_0x27c2bf){_0x4cd426[_0x379d('0x3a')]=_[_0x379d('0x6c')](db[_0x379d('0xb8')][_0x379d('0x34')]);_0x4cd426[_0x379d('0x38')]=_[_0x379d('0x6c')](_0x469a59[_0x379d('0x38')]);_0x4cd426[_0x379d('0x39')]=_[_0x379d('0x3c')](_0x4cd426['model'],_0x4cd426['query']);_0x5a340a['attributes']=_['intersection'](_0x4cd426[_0x379d('0x3a')],qs['fields'](_0x469a59[_0x379d('0x38')][_0x379d('0x3d')]));_0x5a340a[_0x379d('0x3b')]=_0x5a340a[_0x379d('0x3b')][_0x379d('0x3e')]?_0x5a340a['attributes']:_0x4cd426[_0x379d('0x3a')];if(!_0x469a59['query']['hasOwnProperty']('nolimit')){_0x5a340a['limit']=qs[_0x379d('0x1f')](_0x469a59['query'][_0x379d('0x1f')]);_0x5a340a[_0x379d('0x1e')]=qs[_0x379d('0x1e')](_0x469a59['query'][_0x379d('0x1e')]);}_0x5a340a[_0x379d('0x40')]=qs[_0x379d('0x41')](_0x469a59[_0x379d('0x38')][_0x379d('0x41')]);_0x5a340a[_0x379d('0x42')]=qs[_0x379d('0x39')](_[_0x379d('0x43')](_0x469a59['query'],_0x4cd426[_0x379d('0x39')]));_0x5a340a[_0x379d('0x42')][_0x379d('0xb9')]=_0x27c2bf['id'];if(_0x469a59[_0x379d('0x38')][_0x379d('0x7b')]){_0x5a340a[_0x379d('0x42')]=_[_0x379d('0x91')](_0x5a340a[_0x379d('0x42')],{'$or':_[_0x379d('0x2c')](_0x5a340a['attributes'],function(_0x53dee0){var _0x5a38a2={};_0x5a38a2[_0x53dee0]={'$like':'%'+_0x469a59[_0x379d('0x38')][_0x379d('0x7b')]+'%'};return _0x5a38a2;})});}if(_0x469a59['query'][_0x379d('0x73')]){var _0x1cec23=_0x469a59[_0x379d('0x38')][_0x379d('0x73')][_0x379d('0x2f')](',');var _0x56639e={};_0x56639e[_0x1cec23[0x0]]={'$gte':moment(_0x1cec23[0x1])[_0x379d('0xba')](_0x379d('0xbb'))};_0x5a340a['where']=_[_0x379d('0x91')](_0x5a340a[_0x379d('0x42')],_0x56639e);}_0x5a340a=_[_0x379d('0x91')]({},_0x5a340a,_0x469a59[_0x379d('0xb0')]);return db['OpenchannelMessage'][_0x379d('0x1d')]({'where':_0x5a340a[_0x379d('0x42')]})[_0x379d('0x28')](function(_0xc4b5cc){_0x4e3e68[_0x379d('0x1d')]=_0xc4b5cc;if(_0x469a59[_0x379d('0x38')][_0x379d('0xbc')]){_0x5a340a[_0x379d('0xaf')]=[{'all':!![]}];}return db[_0x379d('0xb8')][_0x379d('0xbd')](_0x5a340a);})[_0x379d('0x28')](function(_0x3ab1e3){_0x4e3e68[_0x379d('0xab')]=_0x3ab1e3;return _0x4e3e68;});}})[_0x379d('0x28')](respondWithFilteredResult(_0x374fd1,_0x5a340a))[_0x379d('0xac')](handleError(_0x374fd1,null));};exports['addTags']=function(_0x203711,_0x4715d8,_0x5e3bdd){return db['OpenchannelInteraction'][_0x379d('0x5b')]({'where':{'id':_0x203711[_0x379d('0xae')]['id']}})[_0x379d('0x28')](handleEntityNotFound(_0x4715d8,null))['then'](function(_0x5d1479){if(_0x5d1479){return _0x5d1479[_0x379d('0xbe')](_0x203711[_0x379d('0xb2')][_0x379d('0xb5')],_[_0x379d('0xb6')](_0x203711['body'],[_0x379d('0xb5'),'id'])||{})[_0x379d('0xbf')](function(){return db[_0x379d('0x67')][_0x379d('0xbd')]({'attributes':['id',_0x379d('0x2a'),_0x379d('0xc0')],'where':{'id':_0x203711[_0x379d('0xb2')]['ids']}});})['then'](function(_0x14c739){socket[_0x379d('0xc1')](_0x379d('0xc2'),{'id':Number(_0x203711[_0x379d('0xae')]['id']),'tags':_0x14c739||[]});return{'id':Number(_0x203711[_0x379d('0xae')]['id']),'tags':_0x14c739||[]};});}})[_0x379d('0x28')](respondWithResult(_0x4715d8,null))[_0x379d('0xac')](handleError(_0x4715d8,null));};exports[_0x379d('0xc3')]=function(_0x45492b,_0xbb22fe,_0x13eff2){return db[_0x379d('0x33')]['find']({'where':{'id':_0x45492b[_0x379d('0xae')]['id']}})[_0x379d('0x28')](handleEntityNotFound(_0xbb22fe,null))['then'](function(_0x560923){if(_0x560923){return _0x560923[_0x379d('0xc3')](_0x45492b[_0x379d('0x38')][_0x379d('0xb5')]);}})['then'](respondWithStatusCode(_0xbb22fe,null))[_0x379d('0xac')](handleError(_0xbb22fe,null));};exports[_0x379d('0xc4')]=function(_0x288215,_0x337796){var _0x30a9ec=moment()[_0x379d('0xc5')]()[_0x379d('0x8e')]();var _0x53be2e=path[_0x379d('0xc6')](config['root'],_0x379d('0xc7'),_0x379d('0xc8'),_0x379d('0xc9'));var _0x201ed0=path['join'](config[_0x379d('0xca')],_0x379d('0xc7'),'files',_0x379d('0xcb'));var _0x3965bd=path['join'](_0x53be2e,_0x30a9ec);var _0x1d10a5=util[_0x379d('0xba')](_0x379d('0xcc'),_0x288215[_0x379d('0xae')]['id'],_0x30a9ec);var _0x20ca2e=path['join'](_0x53be2e,_0x1d10a5);var _0x2057fc=[];_0x2057fc['push']({'model':db[_0x379d('0x6a')],'as':'User','attributes':['id',_0x379d('0xcd')],'raw':!![]});_0x2057fc[_0x379d('0x31')]({'model':db[_0x379d('0xce')],'as':_0x379d('0xcf'),'attributes':['id',_0x379d('0xd0'),'lastName'],'raw':!![]});if(_0x288215[_0x379d('0x38')]['attachments']){_0x2057fc['push']({'model':db['Attachment'],'as':_0x379d('0xd1'),'raw':!![]});}var _0x1c285f=[{'model':db[_0x379d('0xb8')],'as':_0x379d('0xd2'),'attributes':['id',_0x379d('0xb2'),_0x379d('0x71'),_0x379d('0xd3'),_0x379d('0xd4'),_0x379d('0x77')],'include':_0x2057fc}];_0x1c285f[_0x379d('0x31')]({'model':db['OpenchannelAccount'],'as':_0x379d('0xd5'),'attributes':['id',_0x379d('0x2a')]});_0x1c285f[_0x379d('0x31')]({'model':db[_0x379d('0x6a')],'as':_0x379d('0xd6'),'attributes':['id',_0x379d('0xcd')]});return db[_0x379d('0x33')][_0x379d('0x5b')]({'where':{'id':_0x288215[_0x379d('0xae')]['id']},'include':_0x1c285f})['then'](handleEntityNotFound(_0x337796,null))['then'](function(_0x215a69){if(_0x215a69){var _0x283083=_0x215a69[_0x379d('0xd7')]({'plain':!![]});fs[_0x379d('0xd8')](_0x3965bd);var _0x4313b8={'channel':_0x379d('0xd9'),'account':_0x283083[_0x379d('0xd5')][_0x379d('0x2a')],'agent':_0x283083[_0x379d('0xd6')]?_0x283083[_0x379d('0xd6')]['fullname']:_0x379d('0xda'),'createdAt':moment(_0x283083[_0x379d('0x71')])['format'](_0x379d('0xbb'))['toString'](),'closedAt':_0x283083['closed']?moment(_0x283083[_0x379d('0xdb')])[_0x379d('0xba')](_0x379d('0xbb'))[_0x379d('0x8e')]():'','disposition':_0x283083[_0x379d('0xdc')],'visibility':_0x283083[_0x379d('0xdd')]?_0x379d('0xde'):_0x379d('0xdf'),'messages':_(_0x283083['Messages'])[_0x379d('0x7b')]({'secret':![]})['map'](function(_0x14ff04){if(_0x14ff04[_0x379d('0xd1')]){var _0x3b1bb3=path[_0x379d('0xc6')](_0x201ed0,_0x14ff04[_0x379d('0xd1')][_0x379d('0xe0')]);if(fs[_0x379d('0xe1')](_0x3b1bb3)){fs[_0x379d('0xe2')](_0x3b1bb3)[_0x379d('0xe3')](fs[_0x379d('0xe4')](path[_0x379d('0xc6')](_0x3965bd,_0x14ff04['Attachment']['basename'])));}}return{'date':moment(_0x14ff04[_0x379d('0x71')])[_0x379d('0xba')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x14ff04[_0x379d('0xd3')]===_0x379d('0xe5')?_0x14ff04[_0x379d('0x6a')]?_0x14ff04[_0x379d('0x6a')]['fullname']:_0x379d('0xe6'):_0x14ff04[_0x379d('0xcf')][_0x379d('0xd0')]+(_0x14ff04[_0x379d('0xcf')][_0x379d('0xe7')]?'\x20'+_0x14ff04['Contact'][_0x379d('0xe7')]:''),'body':_0x14ff04[_0x379d('0xd1')]?_0x14ff04[_0x379d('0xd1')][_0x379d('0xe0')]:_0x14ff04[_0x379d('0xb2')],'direction':_0x14ff04['direction']===_0x379d('0xe5')?'A':'C','secret':_0x14ff04[_0x379d('0xd4')],'read':_0x14ff04[_0x379d('0x77')],'attachment':_0x14ff04[_0x379d('0xd1')]};})[_0x379d('0x65')]()};return ejs['renderFile'](path[_0x379d('0xc6')](config[_0x379d('0xca')],_0x379d('0xc7'),'views',_0x379d('0xe8')),{'interaction':_0x4313b8})[_0x379d('0x28')](function(_0x200c9e){var _0x425c9f=path[_0x379d('0xc6')](_0x3965bd,'transcript-'+_0x283083['id']+'-'+_0x30a9ec+_0x379d('0xe9'));var _0x17481d={'path':_0x425c9f,'channel':_0x379d('0xd9'),'interactionId':_0x283083['id']};return pdf['createPdfFromHTML'](_0x200c9e,_0x17481d);})[_0x379d('0x28')](function(){return new BPromise(function(_0x1f4da5,_0x272ac7){zipdir(_0x3965bd,{'saveTo':_0x20ca2e},function(_0x425868,_0x5842ab){if(_0x425868)return _0x272ac7(_0x425868);return _0x1f4da5(_0x5842ab);});})[_0x379d('0x28')](function(){return new BPromise(function(_0x2d6ac1,_0x3570a5){rimraf(_0x3965bd,function(_0x5d24e0){if(_0x5d24e0)_0x3570a5(_0x5d24e0);return _0x2d6ac1();});});})[_0x379d('0x28')](function(){return _0x337796[_0x379d('0xc4')](_0x20ca2e,_0x1d10a5,function(_0x25b5f2){if(_0x25b5f2){console[_0x379d('0xea')](_0x379d('0xeb'),_0x25b5f2);}else{fs['unlinkSync'](_0x20ca2e);}});});});}else{return _0x337796[_0x379d('0x1a')](0xc8);}})[_0x379d('0xac')](handleError(_0x337796,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 8b9eebe..8227ea5 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 _0x71db=['map','findAll','then','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','update','remove','getUsers'];(function(_0x3801e8,_0x24475e){var _0x3b5990=function(_0x585518){while(--_0x585518){_0x3801e8['push'](_0x3801e8['shift']());}};_0x3b5990(++_0x24475e);}(_0x71db,0x1c3));var _0xb71d=function(_0x2c602e,_0x1d26f5){_0x2c602e=_0x2c602e-0x0;var _0x1a2650=_0x71db[_0x2c602e];return _0x1a2650;};'use strict';var EventEmitter=require(_0xb71d('0x0'));var OpenchannelInteraction=require(_0xb71d('0x1'))['db'][_0xb71d('0x2')];var OpenchannelMessage=require(_0xb71d('0x1'))['db'][_0xb71d('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb71d('0x4'),'afterUpdate':_0xb71d('0x5'),'afterDestroy':_0xb71d('0x6')};function emitEvent(_0x53fd36){return function(_0x2b191d,_0x40749b,_0x31ce15){_0x2b191d[_0xb71d('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5a63c7){_0x2b191d['setDataValue']('Users',_0x5a63c7[_0xb71d('0x8')](function(_0x6e3301){return{'id':_0x6e3301['id']};}));return OpenchannelMessage[_0xb71d('0x9')]({'where':{'OpenchannelInteractionId':_0x2b191d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb71d('0xa')](function(_0x50ee96){_0x2b191d['setDataValue'](_0xb71d('0xb'),_0x50ee96[_0xb71d('0xc')]);OpenchannelInteractionEvents[_0xb71d('0xd')](_0x53fd36+':'+_0x2b191d['id'],_0x2b191d);OpenchannelInteractionEvents[_0xb71d('0xd')](_0x53fd36,_0x2b191d);_0x31ce15(null);})['catch'](_0x31ce15(null));};}for(var e in events){if(events[_0xb71d('0xe')](e)){var event=events[e];OpenchannelInteraction[_0xb71d('0xf')](e,emitEvent(event));}}module[_0xb71d('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xc6ad=['exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook'];(function(_0x9d2bdc,_0x4f2b6a){var _0x410615=function(_0x56b661){while(--_0x56b661){_0x9d2bdc['push'](_0x9d2bdc['shift']());}};_0x410615(++_0x4f2b6a);}(_0xc6ad,0x145));var _0xdc6a=function(_0x164dea,_0x336595){_0x164dea=_0x164dea-0x0;var _0x480bad=_0xc6ad[_0x164dea];return _0x480bad;};'use strict';var EventEmitter=require(_0xdc6a('0x0'));var OpenchannelInteraction=require(_0xdc6a('0x1'))['db'][_0xdc6a('0x2')];var OpenchannelMessage=require(_0xdc6a('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xdc6a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdc6a('0x4'),'afterDestroy':_0xdc6a('0x5')};function emitEvent(_0x32f62f){return function(_0x1a76ef,_0x1ebfd3,_0x126e47){_0x1a76ef[_0xdc6a('0x6')]({'attributes':['id'],'raw':!![]})[_0xdc6a('0x7')](function(_0x3801dc){_0x1a76ef[_0xdc6a('0x8')](_0xdc6a('0x9'),_0x3801dc[_0xdc6a('0xa')](function(_0x472315){return{'id':_0x472315['id']};}));return OpenchannelMessage[_0xdc6a('0xb')]({'where':{'OpenchannelInteractionId':_0x1a76ef['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x31ec81){_0x1a76ef['setDataValue'](_0xdc6a('0xc'),_0x31ec81[_0xdc6a('0xd')]);OpenchannelInteractionEvents[_0xdc6a('0xe')](_0x32f62f+':'+_0x1a76ef['id'],_0x1a76ef);OpenchannelInteractionEvents[_0xdc6a('0xe')](_0x32f62f,_0x1a76ef);_0x126e47(null);})['catch'](_0x126e47(null));};}for(var e in events){if(events[_0xdc6a('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xdc6a('0x10')](e,emitEvent(event));}}module[_0xdc6a('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index b4a6981..dd0d2af 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 _0xb4c7=['api','moment','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','define','openchannel_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x353c7f,_0x21d761){var _0x4e2949=function(_0x14fe20){while(--_0x14fe20){_0x353c7f['push'](_0x353c7f['shift']());}};_0x4e2949(++_0x21d761);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x8a5d8a,_0x4bf33a){_0x8a5d8a=_0x8a5d8a-0x0;var _0x51570a=_0xb4c7[_0x8a5d8a];return _0x51570a;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var logger=require(_0x7b4c('0x2'))(_0x7b4c('0x3'));var moment=require(_0x7b4c('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b4c('0x5'));var fs=require('fs');var path=require(_0x7b4c('0x6'));var rimraf=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var attributes=require(_0x7b4c('0x9'));module['exports']=function(_0x1b0f57,_0x10e197){return _0x1b0f57[_0x7b4c('0xa')]('OpenchannelInteraction',attributes,{'tableName':_0x7b4c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x21687f,_0x570daa,_0x433aa2){if(_0x21687f[_0x7b4c('0xc')](_0x7b4c('0xd'))){_0x21687f[_0x7b4c('0xe')]=moment()[_0x7b4c('0xf')](_0x7b4c('0x10'));}_0x433aa2(null,_0x21687f);}}});}; \ No newline at end of file +var _0x0f4d=['define','OpenchannelInteraction','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports'];(function(_0xfaf625,_0x2caac9){var _0x4c4d76=function(_0x3dfbb5){while(--_0x3dfbb5){_0xfaf625['push'](_0xfaf625['shift']());}};_0x4c4d76(++_0x2caac9);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x24032a,_0x5c2c1d){_0x24032a=_0x24032a-0x0;var _0x38a3f3=_0x0f4d[_0x24032a];return _0x38a3f3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd0f4('0x0'));var moment=require('moment');var BPromise=require(_0xd0f4('0x1'));var rp=require(_0xd0f4('0x2'));var fs=require('fs');var path=require(_0xd0f4('0x3'));var rimraf=require(_0xd0f4('0x4'));var config=require(_0xd0f4('0x5'));var attributes=require(_0xd0f4('0x6'));module[_0xd0f4('0x7')]=function(_0x1d9a9d,_0x531f85){return _0x1d9a9d[_0xd0f4('0x8')](_0xd0f4('0x9'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3992be,_0x2a0057,_0x4c826e){if(_0x3992be[_0xd0f4('0xa')](_0xd0f4('0xb'))){_0x3992be['closedAt']=moment()[_0xd0f4('0xc')](_0xd0f4('0xd'));}_0x4c826e(null,_0x3992be);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 511b858..be6f6e8 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 _0x0188=['OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','attributes','limit','AddTagsToOpenchannelInteraction','where','addTags','omit','ids','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info'];(function(_0x450a1c,_0x3561c1){var _0x4a3126=function(_0x17495e){while(--_0x17495e){_0x450a1c['push'](_0x450a1c['shift']());}};_0x4a3126(++_0x3561c1);}(_0x0188,0x1a7));var _0x8018=function(_0x28f1de,_0x355054){_0x28f1de=_0x28f1de-0x0;var _0x5b5dad=_0x0188[_0x28f1de];return _0x5b5dad;};'use strict';var _=require(_0x8018('0x0'));var util=require('util');var moment=require(_0x8018('0x1'));var BPromise=require('bluebird');var rs=require(_0x8018('0x2'));var fs=require('fs');var Redis=require(_0x8018('0x3'));var db=require(_0x8018('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8018('0x5'))(_0x8018('0x6'));var config=require(_0x8018('0x7'));var jayson=require(_0x8018('0x8'));var client=jayson[_0x8018('0x9')][_0x8018('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x8018('0xb')],{'host':_0x8018('0xc'),'port':0x18eb});var socket=require(_0x8018('0xd'))(new Redis(config[_0x8018('0xb')]));require('./openchannelInteraction.socket')[_0x8018('0xe')](socket);function respondWithRpcPromise(_0x44f877,_0x733ea5,_0x523212){return new BPromise(function(_0x8e883,_0x483652){return client['request'](_0x44f877,_0x523212)[_0x8018('0xf')](function(_0x51bd6f){logger[_0x8018('0x10')](_0x8018('0x11'),_0x733ea5,'request\x20sent');logger[_0x8018('0x12')](_0x8018('0x13'),_0x733ea5,_0x8018('0x14'),JSON[_0x8018('0x15')](_0x51bd6f));if(_0x51bd6f[_0x8018('0x16')]){if(_0x51bd6f[_0x8018('0x16')]['code']===0x1f4){logger[_0x8018('0x16')](_0x8018('0x11'),_0x733ea5,_0x51bd6f['error'][_0x8018('0x17')]);return _0x483652(_0x51bd6f['error'][_0x8018('0x17')]);}logger['error'](_0x8018('0x11'),_0x733ea5,_0x51bd6f['error'][_0x8018('0x17')]);return _0x8e883(_0x51bd6f[_0x8018('0x16')][_0x8018('0x17')]);}else{logger['info'](_0x8018('0x11'),_0x733ea5,'request\x20sent');_0x8e883(_0x51bd6f['result'][_0x8018('0x17')]);}})[_0x8018('0x18')](function(_0xabfa48){logger[_0x8018('0x16')](_0x8018('0x11'),_0x733ea5,_0xabfa48);_0x483652(_0xabfa48);});});}exports[_0x8018('0x19')]=function(_0x218a04){var _0x20ca58=this;return new Promise(function(_0x5b72a6,_0x2543d6){return db[_0x8018('0x1a')][_0x8018('0x1b')](_0x218a04[_0x8018('0x1c')],{'raw':_0x218a04['options']?_0x218a04[_0x8018('0x1d')][_0x8018('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x218a04['options']?_0x218a04['options']['where']||null:null,'attributes':_0x218a04[_0x8018('0x1d')]?_0x218a04[_0x8018('0x1d')][_0x8018('0x1f')]||null:null,'limit':_0x218a04['options']?_0x218a04[_0x8018('0x1d')][_0x8018('0x20')]||null:null})[_0x8018('0xf')](function(_0x2173b0){logger[_0x8018('0x10')](_0x8018('0x19'),_0x218a04);logger[_0x8018('0x12')]('UpdateOpenchannelInteraction',_0x218a04,JSON['stringify'](_0x2173b0));_0x5b72a6(_0x2173b0);})['catch'](function(_0x264bb4){logger[_0x8018('0x16')](_0x8018('0x19'),_0x264bb4[_0x8018('0x17')],_0x218a04);_0x2543d6(_0x20ca58[_0x8018('0x16')](0x1f4,_0x264bb4[_0x8018('0x17')]));});});};exports[_0x8018('0x21')]=function(_0x18ee78){return new Promise(function(_0x2f3808,_0x590eba){return db[_0x8018('0x1a')]['find']({'where':_0x18ee78[_0x8018('0x1d')]?_0x18ee78[_0x8018('0x1d')][_0x8018('0x22')]||null:null})[_0x8018('0xf')](function(_0xbe9326){if(_0xbe9326){return _0xbe9326[_0x8018('0x23')](_0x18ee78[_0x8018('0x1c')]['ids'],_[_0x8018('0x24')](_0x18ee78[_0x8018('0x1c')],[_0x8018('0x25'),'id'])||{});}})[_0x8018('0x26')](function(_0x473af9){logger['info'](_0x8018('0x27'),_0x18ee78);logger['debug'](_0x8018('0x27'),_0x18ee78,JSON[_0x8018('0x15')](_0x473af9));_0x2f3808(_0x473af9);})[_0x8018('0x18')](function(_0x3a6f4c){logger[_0x8018('0x16')](_0x8018('0x27'),_0x3a6f4c[_0x8018('0x17')],_0x18ee78);_0x590eba(_this[_0x8018('0x16')](0x1f4,_0x3a6f4c[_0x8018('0x17')]));});});}; \ No newline at end of file +var _0xc2ed=['omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','OpenchannelInteraction','update','body','options','raw','attributes','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','addTags','ids'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc2ed,0x1c5));var _0xdc2e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xc2ed[_0x3b5250];return _0xc844a1;};'use strict';var _=require('lodash');var util=require(_0xdc2e('0x0'));var moment=require(_0xdc2e('0x1'));var BPromise=require(_0xdc2e('0x2'));var rs=require(_0xdc2e('0x3'));var fs=require('fs');var Redis=require(_0xdc2e('0x4'));var db=require(_0xdc2e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdc2e('0x6'))(_0xdc2e('0x7'));var config=require(_0xdc2e('0x8'));var jayson=require(_0xdc2e('0x9'));var client=jayson[_0xdc2e('0xa')][_0xdc2e('0xb')]({'port':0x232a});config[_0xdc2e('0xc')]=_[_0xdc2e('0xd')](config[_0xdc2e('0xc')],{'host':_0xdc2e('0xe'),'port':0x18eb});var socket=require(_0xdc2e('0xf'))(new Redis(config['redis']));require(_0xdc2e('0x10'))[_0xdc2e('0x11')](socket);function respondWithRpcPromise(_0x3c1367,_0x4da526,_0x309f93){return new BPromise(function(_0x3ff3ce,_0x575dac){return client[_0xdc2e('0x12')](_0x3c1367,_0x309f93)[_0xdc2e('0x13')](function(_0x2fa593){logger[_0xdc2e('0x14')](_0xdc2e('0x15'),_0x4da526,'request\x20sent');logger[_0xdc2e('0x16')](_0xdc2e('0x17'),_0x4da526,_0xdc2e('0x18'),JSON[_0xdc2e('0x19')](_0x2fa593));if(_0x2fa593[_0xdc2e('0x1a')]){if(_0x2fa593[_0xdc2e('0x1a')][_0xdc2e('0x1b')]===0x1f4){logger[_0xdc2e('0x1a')](_0xdc2e('0x15'),_0x4da526,_0x2fa593['error'][_0xdc2e('0x1c')]);return _0x575dac(_0x2fa593[_0xdc2e('0x1a')][_0xdc2e('0x1c')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x4da526,_0x2fa593['error'][_0xdc2e('0x1c')]);return _0x3ff3ce(_0x2fa593['error'][_0xdc2e('0x1c')]);}else{logger[_0xdc2e('0x14')](_0xdc2e('0x15'),_0x4da526,'request\x20sent');_0x3ff3ce(_0x2fa593['result'][_0xdc2e('0x1c')]);}})[_0xdc2e('0x1d')](function(_0x4f3abe){logger['error'](_0xdc2e('0x15'),_0x4da526,_0x4f3abe);_0x575dac(_0x4f3abe);});});}exports['UpdateOpenchannelInteraction']=function(_0x32e74c){var _0x4e4053=this;return new Promise(function(_0x39ca0e,_0xa2b901){return db[_0xdc2e('0x1e')][_0xdc2e('0x1f')](_0x32e74c[_0xdc2e('0x20')],{'raw':_0x32e74c['options']?_0x32e74c[_0xdc2e('0x21')][_0xdc2e('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32e74c[_0xdc2e('0x21')]?_0x32e74c['options']['where']||null:null,'attributes':_0x32e74c[_0xdc2e('0x21')]?_0x32e74c[_0xdc2e('0x21')][_0xdc2e('0x23')]||null:null,'limit':_0x32e74c[_0xdc2e('0x21')]?_0x32e74c[_0xdc2e('0x21')][_0xdc2e('0x24')]||null:null})[_0xdc2e('0x13')](function(_0x1132b5){logger['info'](_0xdc2e('0x25'),_0x32e74c);logger[_0xdc2e('0x16')](_0xdc2e('0x25'),_0x32e74c,JSON[_0xdc2e('0x19')](_0x1132b5));_0x39ca0e(_0x1132b5);})['catch'](function(_0x3f8644){logger[_0xdc2e('0x1a')](_0xdc2e('0x25'),_0x3f8644[_0xdc2e('0x1c')],_0x32e74c);_0xa2b901(_0x4e4053['error'](0x1f4,_0x3f8644['message']));});});};exports[_0xdc2e('0x26')]=function(_0x2356b3){return new Promise(function(_0x3ae08c,_0x2764bf){return db[_0xdc2e('0x1e')][_0xdc2e('0x27')]({'where':_0x2356b3[_0xdc2e('0x21')]?_0x2356b3[_0xdc2e('0x21')]['where']||null:null})['then'](function(_0x343bda){if(_0x343bda){return _0x343bda[_0xdc2e('0x28')](_0x2356b3[_0xdc2e('0x20')][_0xdc2e('0x29')],_[_0xdc2e('0x2a')](_0x2356b3['body'],['ids','id'])||{});}})[_0xdc2e('0x2b')](function(_0x3fc148){logger[_0xdc2e('0x14')](_0xdc2e('0x2c'),_0x2356b3);logger[_0xdc2e('0x16')]('AddTags',_0x2356b3,JSON[_0xdc2e('0x19')](_0x3fc148));_0x3ae08c(_0x3fc148);})[_0xdc2e('0x1d')](function(_0x2b6fc1){logger[_0xdc2e('0x1a')](_0xdc2e('0x2c'),_0x2b6fc1['message'],_0x2356b3);_0x2764bf(_this[_0xdc2e('0x1a')](0x1f4,_0x2b6fc1[_0xdc2e('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 4632455..f185724 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 _0x371a=['update','openchannelInteraction:','./openchannelInteraction.events','save','remove'];(function(_0x28325b,_0x4c12fc){var _0x4c17f4=function(_0x5c5cc2){while(--_0x5c5cc2){_0x28325b['push'](_0x28325b['shift']());}};_0x4c17f4(++_0x4c12fc);}(_0x371a,0x1c9));var _0xa371=function(_0x3edc13,_0xb2d4ee){_0x3edc13=_0x3edc13-0x0;var _0xaf37e3=_0x371a[_0x3edc13];return _0xaf37e3;};'use strict';var OpenchannelInteractionEvents=require(_0xa371('0x0'));var events=[_0xa371('0x1'),_0xa371('0x2'),_0xa371('0x3')];function createListener(_0x52def8,_0x1d5996){return function(_0x15e216){_0x1d5996['emit'](_0x52def8,_0x15e216);};}function removeListener(_0x528f10,_0x1690d6){return function(){OpenchannelInteractionEvents['removeListener'](_0x528f10,_0x1690d6);};}exports['register']=function(_0x178c22){for(var _0x37780e=0x0,_0x4c0268=events['length'];_0x37780e<_0x4c0268;_0x37780e++){var _0x44104f=events[_0x37780e];var _0x3ffdf2=createListener(_0xa371('0x4')+_0x44104f,_0x178c22);OpenchannelInteractionEvents['on'](_0x44104f,_0x3ffdf2);}}; \ No newline at end of file +var _0x1a06=['update','removeListener','register','length','openchannelInteraction:','save'];(function(_0x3605be,_0x244a25){var _0x29ac9a=function(_0x3816e4){while(--_0x3816e4){_0x3605be['push'](_0x3605be['shift']());}};_0x29ac9a(++_0x244a25);}(_0x1a06,0xa1));var _0x61a0=function(_0xc3ad33,_0x101d85){_0xc3ad33=_0xc3ad33-0x0;var _0x9dd921=_0x1a06[_0xc3ad33];return _0x9dd921;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x61a0('0x0'),'remove',_0x61a0('0x1')];function createListener(_0x5d1672,_0x2c4db6){return function(_0x205c2c){_0x2c4db6['emit'](_0x5d1672,_0x205c2c);};}function removeListener(_0x996e7f,_0x11a1ba){return function(){OpenchannelInteractionEvents[_0x61a0('0x2')](_0x996e7f,_0x11a1ba);};}exports[_0x61a0('0x3')]=function(_0xad5b55){for(var _0x373479=0x0,_0xd60b77=events[_0x61a0('0x4')];_0x373479<_0xd60b77;_0x373479++){var _0x48c706=events[_0x373479];var _0x3311d1=createListener(_0x61a0('0x5')+_0x48c706,_0xad5b55);OpenchannelInteractionEvents['on'](_0x48c706,_0x3311d1);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 481fcb9..7e8e16a 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 _0xce8d=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','tracked','create','update','put','accept','/:id/reject','reject','destroy','exports','util'];(function(_0x909dfe,_0x36e38a){var _0x5cb58f=function(_0x3f3000){while(--_0x3f3000){_0x909dfe['push'](_0x909dfe['shift']());}};_0x5cb58f(++_0x36e38a);}(_0xce8d,0x9b));var _0xdce8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce8d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xdce8('0x0'));var path=require(_0xdce8('0x1'));var timeout=require(_0xdce8('0x2'));var express=require(_0xdce8('0x3'));var router=express[_0xdce8('0x4')]();var fs_extra=require(_0xdce8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdce8('0x6'));var config=require(_0xdce8('0x7'));var controller=require(_0xdce8('0x8'));router['get']('/',auth[_0xdce8('0x9')](),controller[_0xdce8('0xa')]);router[_0xdce8('0xb')](_0xdce8('0xc'),auth[_0xdce8('0x9')](),controller[_0xdce8('0xd')]);router[_0xdce8('0xb')](_0xdce8('0xe'),auth[_0xdce8('0x9')](),controller[_0xdce8('0xf')]);router[_0xdce8('0x10')]('/',auth['isAuthenticated'](),interaction[_0xdce8('0x11')]('openchannel','openchannelmessage:create'),controller[_0xdce8('0x12')]);router['put'](_0xdce8('0xe'),auth['isAuthenticated'](),controller[_0xdce8('0x13')]);router[_0xdce8('0x14')]('/:id/accept',auth[_0xdce8('0x9')](),controller[_0xdce8('0x15')]);router[_0xdce8('0x14')](_0xdce8('0x16'),auth[_0xdce8('0x9')](),controller[_0xdce8('0x17')]);router['delete'](_0xdce8('0xe'),auth[_0xdce8('0x9')](),controller[_0xdce8('0x18')]);module[_0xdce8('0x19')]=router; \ No newline at end of file +var _0xbb15=['/:id','post','openchannel','put','/:id/accept','accept','/:id/reject','reject','destroy','exports','util','path','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x4549f9,_0x1f2c83){var _0x477f1d=function(_0x226197){while(--_0x226197){_0x4549f9['push'](_0x4549f9['shift']());}};_0x477f1d(++_0x1f2c83);}(_0xbb15,0x1c2));var _0x5bb1=function(_0x3baf61,_0x187408){_0x3baf61=_0x3baf61-0x0;var _0x515476=_0xbb15[_0x3baf61];return _0x515476;};'use strict';var multer=require('multer');var util=require(_0x5bb1('0x0'));var path=require(_0x5bb1('0x1'));var timeout=require('connect-timeout');var express=require(_0x5bb1('0x2'));var router=express[_0x5bb1('0x3')]();var fs_extra=require(_0x5bb1('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5bb1('0x5'));var controller=require('./openchannelMessage.controller');router[_0x5bb1('0x6')]('/',auth[_0x5bb1('0x7')](),controller[_0x5bb1('0x8')]);router[_0x5bb1('0x6')](_0x5bb1('0x9'),auth[_0x5bb1('0x7')](),controller['describe']);router[_0x5bb1('0x6')](_0x5bb1('0xa'),auth[_0x5bb1('0x7')](),controller['show']);router[_0x5bb1('0xb')]('/',auth[_0x5bb1('0x7')](),interaction['tracked'](_0x5bb1('0xc'),'openchannelmessage:create'),controller['create']);router[_0x5bb1('0xd')]('/:id',auth[_0x5bb1('0x7')](),controller['update']);router[_0x5bb1('0xd')](_0x5bb1('0xe'),auth[_0x5bb1('0x7')](),controller[_0x5bb1('0xf')]);router[_0x5bb1('0xd')](_0x5bb1('0x10'),auth['isAuthenticated'](),controller[_0x5bb1('0x11')]);router['delete'](_0x5bb1('0xa'),auth[_0x5bb1('0x7')](),controller[_0x5bb1('0x12')]);module[_0x5bb1('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index a8db011..a4332d5 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 _0xb717=['medium','BOOLEAN','ENUM','out','DATE','STRING','exports','TEXT'];(function(_0xe48d1c,_0x506c3e){var _0x814dd5=function(_0x5504e6){while(--_0x5504e6){_0xe48d1c['push'](_0xe48d1c['shift']());}};_0x814dd5(++_0x506c3e);}(_0xb717,0x1b6));var _0x7b71=function(_0x6a5347,_0x27074a){_0x6a5347=_0x6a5347-0x0;var _0x10f3d6=_0xb717[_0x6a5347];return _0x10f3d6;};'use strict';var Sequelize=require('sequelize');module[_0x7b71('0x0')]={'body':{'type':Sequelize[_0x7b71('0x1')](_0x7b71('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x7b71('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7b71('0x4')]('in','out'),'defaultValue':_0x7b71('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x7b71('0x6')]},'providerName':{'type':Sequelize[_0x7b71('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x12f8=['medium','BOOLEAN','ENUM','out','STRING','sequelize','exports','TEXT'];(function(_0xbebf50,_0x44ec09){var _0xce1496=function(_0x1bf94d){while(--_0x1bf94d){_0xbebf50['push'](_0xbebf50['shift']());}};_0xce1496(++_0x44ec09);}(_0x12f8,0x145));var _0x812f=function(_0x2e6396,_0x31498f){_0x2e6396=_0x2e6396-0x0;var _0x1f31be=_0x12f8[_0x2e6396];return _0x1f31be;};'use strict';var Sequelize=require(_0x812f('0x0'));module[_0x812f('0x1')]={'body':{'type':Sequelize[_0x812f('0x2')](_0x812f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x812f('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x812f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x812f('0x5')]('in','out'),'defaultValue':_0x812f('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x812f('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 573ea36..83603de 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 _0xe91c=['save','destroy','end','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','length','find','create','body','update','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','interaction','get','role','null','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','json','count','offset','limit','set','apply','reject'];(function(_0x48b582,_0x184935){var _0x3249b8=function(_0x15ecfb){while(--_0x15ecfb){_0x48b582['push'](_0x48b582['shift']());}};_0x3249b8(++_0x184935);}(_0xe91c,0xbd));var _0xce91=function(_0x19f9c2,_0x4f267c){_0x19f9c2=_0x19f9c2-0x0;var _0x29c852=_0xe91c[_0x19f9c2];return _0x29c852;};'use strict';var emlformat=require(_0xce91('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce91('0x1'));var jsonpatch=require(_0xce91('0x2'));var rp=require(_0xce91('0x3'));var moment=require(_0xce91('0x4'));var BPromise=require(_0xce91('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xce91('0x6'));var sox=require(_0xce91('0x7'));var csv=require(_0xce91('0x8'));var ejs=require(_0xce91('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce91('0xa'));var squel=require(_0xce91('0xb'));var crypto=require(_0xce91('0xc'));var jsforce=require(_0xce91('0xd'));var deskjs=require(_0xce91('0xe'));var toCsv=require(_0xce91('0x8'));var querystring=require(_0xce91('0xf'));var Papa=require(_0xce91('0x10'));var Redis=require(_0xce91('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xce91('0x12'));var as=require(_0xce91('0x13'));var hardwareService=require(_0xce91('0x14'));var logger=require('../../config/logger')(_0xce91('0x15'));var utils=require('../../config/utils');var config=require(_0xce91('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xce91('0x17')]=_[_0xce91('0x18')](config[_0xce91('0x17')],{'host':_0xce91('0x19'),'port':0x18eb});var socket=require(_0xce91('0x1a'))(new Redis(config[_0xce91('0x17')]));require('./openchannelMessage.socket')[_0xce91('0x1b')](socket);var jayson=require(_0xce91('0x1c'));var client=jayson[_0xce91('0x1d')][_0xce91('0x1e')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x357eae,_0x5e2fdc,_0x5492a4,_0x56e6e4){return new BPromise(function(_0x52d9da,_0x17ac1d){var _0x5b106d=_0x56e6e4||client;return _0x5b106d[_0xce91('0x1f')](_0x357eae,_0x5492a4)[_0xce91('0x20')](function(_0x39fcf3){logger[_0xce91('0x21')](_0xce91('0x22'),_0x5e2fdc,_0xce91('0x23'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x5e2fdc,_0xce91('0x23'),JSON[_0xce91('0x24')](_0x39fcf3));if(_0x39fcf3[_0xce91('0x25')]){if(_0x39fcf3[_0xce91('0x25')]['code']===0x1f4){logger[_0xce91('0x25')](_0xce91('0x22'),_0x5e2fdc,_0x39fcf3[_0xce91('0x25')][_0xce91('0x26')]);return _0x17ac1d(_0x39fcf3['error']['message']);}logger[_0xce91('0x25')](_0xce91('0x22'),_0x5e2fdc,_0x39fcf3[_0xce91('0x25')][_0xce91('0x26')]);return _0x52d9da(_0x39fcf3[_0xce91('0x25')][_0xce91('0x26')]);}else{logger['info'](_0xce91('0x22'),_0x5e2fdc,_0xce91('0x23'));_0x52d9da(_0x39fcf3['result']['message']);}})[_0xce91('0x27')](function(_0xed962e){logger[_0xce91('0x25')](_0xce91('0x22'),_0x5e2fdc,_0xed962e);_0x17ac1d(_0xed962e);});});}function respondWithStatusCode(_0x5936cc,_0x2a6b4b){_0x2a6b4b=_0x2a6b4b||0xcc;return function(_0x43d5f8){if(_0x43d5f8){return _0x5936cc[_0xce91('0x28')](_0x2a6b4b);}return _0x5936cc[_0xce91('0x29')](_0x2a6b4b)['end']();};}function respondWithResult(_0x2f3038,_0x53341d){_0x53341d=_0x53341d||0xc8;return function(_0x1e5e1e){if(_0x1e5e1e){return _0x2f3038['status'](_0x53341d)[_0xce91('0x2a')](_0x1e5e1e);}};}function respondWithFilteredResult(_0x45dd4e,_0xc098d2){return function(_0x4966d6){if(_0x4966d6){var _0x56f4b9=_0x4966d6[_0xce91('0x2b')],_0x2c628e=_0xc098d2[_0xce91('0x2c')],_0x11c76b=_0xc098d2[_0xce91('0x2c')]+_0xc098d2[_0xce91('0x2d')],_0x2487e0;if(_0x11c76b>=_0x56f4b9){_0x11c76b=_0x56f4b9;_0x2487e0=0xc8;}else{_0x2487e0=0xce;}_0x45dd4e['status'](_0x2487e0);return _0x45dd4e[_0xce91('0x2e')]('Content-Range',_0x2c628e+'-'+_0x11c76b+'/'+_0x56f4b9)[_0xce91('0x2a')](_0x4966d6);}return null;};}function patchUpdates(_0x9f8da4){return function(_0x3d3663){try{jsonpatch[_0xce91('0x2f')](_0x3d3663,_0x9f8da4,!![]);}catch(_0x263600){return BPromise[_0xce91('0x30')](_0x263600);}return _0x3d3663[_0xce91('0x31')]();};}function saveUpdates(_0x1b576a,_0x1d417a){return function(_0x4f8427){if(_0x4f8427){return _0x4f8427['update'](_0x1b576a)[_0xce91('0x20')](function(_0x1b6ca6){return _0x1b6ca6;});}return null;};}function removeEntity(_0x4fd75d,_0xea185d){return function(_0x5fb1f5){if(_0x5fb1f5){return _0x5fb1f5[_0xce91('0x32')]()[_0xce91('0x20')](function(){_0x4fd75d[_0xce91('0x29')](0xcc)[_0xce91('0x33')]();});}};}function handleEntityNotFound(_0x19a60b,_0x4bd866){return function(_0x2f4eae){if(!_0x2f4eae){_0x19a60b['sendStatus'](0x194);}return _0x2f4eae;};}function handleError(_0xf7deb1,_0x282258){_0x282258=_0x282258||0x1f4;return function(_0x2e63d3){logger[_0xce91('0x25')](_0x2e63d3[_0xce91('0x34')]);if(_0x2e63d3[_0xce91('0x35')]){delete _0x2e63d3['name'];}_0xf7deb1['status'](_0x282258)[_0xce91('0x36')](_0x2e63d3);};}exports[_0xce91('0x37')]=function(_0x5da662,_0x30212e){var _0x553a7={},_0x501aeb={},_0x25130a={'count':0x0,'rows':[]};var _0x484aa5=_['map'](db[_0xce91('0x38')][_0xce91('0x39')],function(_0x3a0261){return{'name':_0x3a0261[_0xce91('0x3a')],'type':_0x3a0261[_0xce91('0x3b')]['key']};});_0x501aeb['model']=_[_0xce91('0x3c')](_0x484aa5,_0xce91('0x35'));_0x501aeb[_0xce91('0x3d')]=_[_0xce91('0x3e')](_0x5da662['query']);_0x501aeb[_0xce91('0x3f')]=_[_0xce91('0x40')](_0x501aeb['model'],_0x501aeb['query']);_0x553a7[_0xce91('0x41')]=_[_0xce91('0x40')](_0x501aeb[_0xce91('0x42')],qs[_0xce91('0x43')](_0x5da662[_0xce91('0x3d')][_0xce91('0x43')]));_0x553a7['attributes']=_0x553a7[_0xce91('0x41')]['length']?_0x553a7[_0xce91('0x41')]:_0x501aeb['model'];if(!_0x5da662['query'][_0xce91('0x44')](_0xce91('0x45'))){_0x553a7[_0xce91('0x2d')]=qs[_0xce91('0x2d')](_0x5da662[_0xce91('0x3d')][_0xce91('0x2d')]);_0x553a7[_0xce91('0x2c')]=qs[_0xce91('0x2c')](_0x5da662[_0xce91('0x3d')]['offset']);}_0x553a7['order']=qs[_0xce91('0x46')](_0x5da662['query'][_0xce91('0x46')]);_0x553a7[_0xce91('0x47')]=qs[_0xce91('0x3f')](_[_0xce91('0x48')](_0x5da662[_0xce91('0x3d')],_0x501aeb[_0xce91('0x3f')]),_0x484aa5);if(_0x5da662[_0xce91('0x3d')][_0xce91('0x49')]){_0x553a7['where']=_['merge'](_0x553a7[_0xce91('0x47')],{'$or':_[_0xce91('0x3c')](_0x484aa5,function(_0x4f16aa){if(_0x4f16aa[_0xce91('0x3b')]!==_0xce91('0x4a')){var _0x1e401a={};_0x1e401a[_0x4f16aa['name']]={'$like':'%'+_0x5da662[_0xce91('0x3d')]['filter']+'%'};return _0x1e401a;}})});}_0x553a7=_[_0xce91('0x4b')]({},_0x553a7,_0x5da662[_0xce91('0x4c')]);var _0x116117={'where':_0x553a7['where']};return db[_0xce91('0x38')][_0xce91('0x2b')](_0x116117)[_0xce91('0x20')](function(_0x264ce3){_0x25130a['count']=_0x264ce3;if(_0x5da662['query']['includeAll']){_0x553a7[_0xce91('0x4d')]=[{'all':!![]}];}return db[_0xce91('0x38')][_0xce91('0x4e')](_0x553a7);})[_0xce91('0x20')](function(_0x557b54){_0x25130a[_0xce91('0x4f')]=_0x557b54;return _0x25130a;})[_0xce91('0x20')](respondWithFilteredResult(_0x30212e,_0x553a7))[_0xce91('0x27')](handleError(_0x30212e,null));};exports[_0xce91('0x50')]=function(_0x1d5c4b,_0x225f93){var _0x1d612c={'raw':!![],'where':{'id':_0x1d5c4b[_0xce91('0x51')]['id']}},_0x1cf15a={};_0x1cf15a[_0xce91('0x42')]=_[_0xce91('0x3e')](db[_0xce91('0x38')][_0xce91('0x39')]);_0x1cf15a['query']=_[_0xce91('0x3e')](_0x1d5c4b[_0xce91('0x3d')]);_0x1cf15a[_0xce91('0x3f')]=_[_0xce91('0x40')](_0x1cf15a[_0xce91('0x42')],_0x1cf15a[_0xce91('0x3d')]);_0x1d612c['attributes']=_['intersection'](_0x1cf15a[_0xce91('0x42')],qs[_0xce91('0x43')](_0x1d5c4b[_0xce91('0x3d')]['fields']));_0x1d612c[_0xce91('0x41')]=_0x1d612c[_0xce91('0x41')][_0xce91('0x52')]?_0x1d612c[_0xce91('0x41')]:_0x1cf15a[_0xce91('0x42')];if(_0x1d5c4b[_0xce91('0x3d')]['includeAll']){_0x1d612c['include']=[{'all':!![]}];}_0x1d612c=_[_0xce91('0x4b')]({},_0x1d612c,_0x1d5c4b['options']);return db[_0xce91('0x38')][_0xce91('0x53')](_0x1d612c)[_0xce91('0x20')](handleEntityNotFound(_0x225f93,null))['then'](respondWithResult(_0x225f93,null))[_0xce91('0x27')](handleError(_0x225f93,null));};exports[_0xce91('0x54')]=function(_0x43aa30,_0x1372de){return db['OpenchannelMessage'][_0xce91('0x54')](_0x43aa30[_0xce91('0x55')],{})[_0xce91('0x20')](respondWithResult(_0x1372de,0xc9))[_0xce91('0x27')](handleError(_0x1372de,null));};exports[_0xce91('0x56')]=function(_0x2f45cf,_0x1274a0){if(_0x2f45cf[_0xce91('0x55')]['id']){delete _0x2f45cf[_0xce91('0x55')]['id'];}return db['OpenchannelMessage'][_0xce91('0x53')]({'where':{'id':_0x2f45cf[_0xce91('0x51')]['id']}})[_0xce91('0x20')](handleEntityNotFound(_0x1274a0,null))['then'](saveUpdates(_0x2f45cf['body'],null))[_0xce91('0x20')](respondWithResult(_0x1274a0,null))[_0xce91('0x27')](handleError(_0x1274a0,null));};exports[_0xce91('0x32')]=function(_0x4fb770,_0x40ee23){return db[_0xce91('0x38')][_0xce91('0x53')]({'where':{'id':_0x4fb770[_0xce91('0x51')]['id']}})[_0xce91('0x20')](handleEntityNotFound(_0x40ee23,null))[_0xce91('0x20')](removeEntity(_0x40ee23,null))[_0xce91('0x27')](handleError(_0x40ee23,null));};exports[_0xce91('0x57')]=function(_0x566d23,_0x39a0cc){return db[_0xce91('0x38')][_0xce91('0x57')]()[_0xce91('0x20')](respondWithResult(_0x39a0cc,null))[_0xce91('0x27')](handleError(_0x39a0cc,null));};var interaction_log=require(_0xce91('0x58'))(_0xce91('0x59'));exports[_0xce91('0x5a')]=function(_0x51c1f8,_0x38af8e,_0x3463d6){var _0x3fe35b={'agent':{},'channel':_0xce91('0x5b')};if(_0x51c1f8[_0xce91('0x55')]['id']){delete _0x51c1f8[_0xce91('0x55')]['id'];}_0x51c1f8['body'][_0xce91('0x5c')]=!![];_0x51c1f8['body'][_0xce91('0x5d')]=moment()['format'](_0xce91('0x5e'));_0x51c1f8[_0xce91('0x55')][_0xce91('0x5f')]=_0x51c1f8['body'][_0xce91('0x5f')]||_0x51c1f8[_0xce91('0x60')]['id'];_0x3fe35b[_0xce91('0x61')]['id']=_0x51c1f8[_0xce91('0x55')][_0xce91('0x5f')];return db[_0xce91('0x38')][_0xce91('0x53')]({'where':{'id':_0x51c1f8['params']['id'],'UserId':null},'include':[{'model':db[_0xce91('0x62')],'as':_0xce91('0x63')}]})[_0xce91('0x20')](handleEntityNotFound(_0x38af8e,null))['then'](saveUpdates(_0x51c1f8[_0xce91('0x55')],null))[_0xce91('0x20')](function(_0x170bd1){if(_0x170bd1){_0x3fe35b[_0xce91('0x26')]=_0x170bd1['get']({'plain':!![]});return db[_0xce91('0x64')][_0xce91('0x53')]({'where':{'id':_0x170bd1[_0xce91('0x65')]}});}return null;})[_0xce91('0x20')](handleEntityNotFound(_0x38af8e,null))[_0xce91('0x20')](function(_0x478453){if(_0x478453){return _0x478453['update']({'UserId':_0x51c1f8[_0xce91('0x55')][_0xce91('0x5f')],'read1stAt':_[_0xce91('0x66')](_0x478453[_0xce91('0x67')])?moment()[_0xce91('0x68')](_0xce91('0x5e')):undefined});}return null;})[_0xce91('0x20')](function(_0xe37561){if(_0xe37561){_0x3fe35b[_0xce91('0x69')]=_0xe37561[_0xce91('0x6a')]({'plain':!![]});interaction_log[_0xce91('0x21')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x51c1f8['user']['id'],_0x51c1f8[_0xce91('0x60')]['name'],_0x51c1f8[_0xce91('0x60')][_0xce91('0x6b')],_0x3fe35b[_0xce91('0x69')]['id'],_0x51c1f8[_0xce91('0x55')]?JSON[_0xce91('0x24')](_0x51c1f8[_0xce91('0x55')]):_0xce91('0x6c'));return respondWithRpcPromise('AcceptMessage',_0xce91('0x6d'),_0x3fe35b);}return null;})[_0xce91('0x20')](function(_0x29737c){if(_0x29737c){if(_0x51c1f8[_0xce91('0x55')][_0xce91('0x6e')]){_0x3fe35b[_0xce91('0x26')][_0xce91('0x6f')]=util[_0xce91('0x68')](_0xce91('0x70'),_0x51c1f8[_0xce91('0x60')][_0xce91('0x35')]);_0x3fe35b['message'][_0xce91('0x71')]=_0x3fe35b[_0xce91('0x71')];_0x3fe35b['message'][_0xce91('0x72')]=_0xce91('0x5a');return respondWithRpcPromise(_0xce91('0x73'),'EventManager',{'event':'acceptmessage','message':_0x3fe35b[_0xce91('0x26')]},client9002)['then'](function(){return _0x3fe35b;});}return _0x3fe35b;}return null;})[_0xce91('0x20')](respondWithResult(_0x38af8e,null))[_0xce91('0x27')](handleError(_0x38af8e,null));};var interaction_log=require(_0xce91('0x58'))(_0xce91('0x59'));exports['reject']=function(_0x387932,_0x1e1651,_0x223507){var _0x362c54={'agent':{},'channel':_0xce91('0x5b')};if(_0x387932[_0xce91('0x55')]['id']){delete _0x387932[_0xce91('0x55')]['id'];}_0x387932[_0xce91('0x55')]['UserId']=_0x387932['body'][_0xce91('0x5f')]||_0x387932[_0xce91('0x60')]['id'];_0x362c54[_0xce91('0x61')]['id']=_0x387932['body']['UserId'];return db[_0xce91('0x38')]['find']({'where':{'id':_0x387932[_0xce91('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1e1651,null))[_0xce91('0x20')](function(_0x838c55){if(_0x838c55){_0x362c54['message']=_0x838c55[_0xce91('0x6a')]({'plain':!![]});return db[_0xce91('0x64')]['find']({'where':{'id':_0x838c55['OpenchannelInteractionId']}});}return null;})[_0xce91('0x20')](handleEntityNotFound(_0x1e1651,null))['then'](function(_0x29ed18){if(_0x29ed18){_0x362c54['interaction']=_0x29ed18[_0xce91('0x6a')]({'plain':!![]});interaction_log[_0xce91('0x21')](_0xce91('0x74'),_0x387932[_0xce91('0x60')]['id'],_0x387932[_0xce91('0x60')][_0xce91('0x35')],_0x387932[_0xce91('0x60')][_0xce91('0x6b')],_0x362c54[_0xce91('0x69')]['id'],_0x387932[_0xce91('0x55')]?JSON[_0xce91('0x24')](_0x387932[_0xce91('0x55')]):_0xce91('0x6c'));return respondWithRpcPromise(_0xce91('0x75'),_0xce91('0x76'),_0x362c54);}return null;})[_0xce91('0x20')](function(_0x38360d){if(_0x38360d){_0x38360d[_0xce91('0x26')][_0xce91('0x6f')]=util[_0xce91('0x68')](_0xce91('0x70'),_0x387932[_0xce91('0x60')][_0xce91('0x35')]);_0x38360d[_0xce91('0x26')]['channel']=_0x362c54[_0xce91('0x71')];_0x38360d[_0xce91('0x26')][_0xce91('0x72')]=_0xce91('0x30');respondWithRpcPromise(_0xce91('0x73'),_0xce91('0x73'),{'event':'rejectmessage','message':_0x38360d['message']},client9002);return _0x362c54;}return null;})[_0xce91('0x20')](respondWithResult(_0x1e1651,null))[_0xce91('0x27')](handleError(_0x1e1651,null));}; \ No newline at end of file +var _0x4268=['name','send','index','map','OpenchannelMessage','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','options','includeAll','rows','catch','show','rawAttributes','find','create','body','params','describe','openchannel-interactions','accept','openchannel','readAt','format','UserId','user','agent','CmContact','Contact','get','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','interface','SIP/%s','channel','event','EventManager','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','register','jayson/promise','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack'];(function(_0x266ceb,_0xc08497){var _0x36f725=function(_0x28e6dc){while(--_0x28e6dc){_0x266ceb['push'](_0x266ceb['shift']());}};_0x36f725(++_0xc08497);}(_0x4268,0x12f));var _0x8426=function(_0x4a9cb4,_0x100ca9){_0x4a9cb4=_0x4a9cb4-0x0;var _0x55a127=_0x4268[_0x4a9cb4];return _0x55a127;};'use strict';var emlformat=require(_0x8426('0x0'));var rimraf=require(_0x8426('0x1'));var zipdir=require(_0x8426('0x2'));var jsonpatch=require(_0x8426('0x3'));var rp=require(_0x8426('0x4'));var moment=require(_0x8426('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8426('0x6'));var util=require('util');var path=require(_0x8426('0x7'));var sox=require('sox');var csv=require(_0x8426('0x8'));var ejs=require(_0x8426('0x9'));var fs=require('fs');var fs_extra=require(_0x8426('0xa'));var _=require(_0x8426('0xb'));var squel=require(_0x8426('0xc'));var crypto=require(_0x8426('0xd'));var jsforce=require(_0x8426('0xe'));var deskjs=require(_0x8426('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8426('0x10'));var Papa=require(_0x8426('0x11'));var Redis=require(_0x8426('0x12'));var authService=require(_0x8426('0x13'));var qs=require(_0x8426('0x14'));var as=require(_0x8426('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8426('0x16'))(_0x8426('0x17'));var utils=require('../../config/utils');var config=require(_0x8426('0x18'));var licenseUtil=require(_0x8426('0x19'));var db=require(_0x8426('0x1a'))['db'];config[_0x8426('0x1b')]=_[_0x8426('0x1c')](config[_0x8426('0x1b')],{'host':_0x8426('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8426('0x1b')]));require(_0x8426('0x1e'))[_0x8426('0x1f')](socket);var jayson=require(_0x8426('0x20'));var client=jayson[_0x8426('0x21')][_0x8426('0x22')]({'port':0x232c});var client9002=jayson[_0x8426('0x21')][_0x8426('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x4ce3e0,_0x34a608,_0x536ec2,_0x351e62){return new BPromise(function(_0x112ce1,_0x2eb1f9){var _0x333b7e=_0x351e62||client;return _0x333b7e['request'](_0x4ce3e0,_0x536ec2)[_0x8426('0x23')](function(_0x4dda8a){logger[_0x8426('0x24')](_0x8426('0x25'),_0x34a608,_0x8426('0x26'));logger[_0x8426('0x27')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x34a608,'request\x20sent',JSON[_0x8426('0x28')](_0x4dda8a));if(_0x4dda8a[_0x8426('0x29')]){if(_0x4dda8a[_0x8426('0x29')][_0x8426('0x2a')]===0x1f4){logger[_0x8426('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x34a608,_0x4dda8a[_0x8426('0x29')][_0x8426('0x2b')]);return _0x2eb1f9(_0x4dda8a[_0x8426('0x29')][_0x8426('0x2b')]);}logger['error'](_0x8426('0x25'),_0x34a608,_0x4dda8a['error'][_0x8426('0x2b')]);return _0x112ce1(_0x4dda8a[_0x8426('0x29')][_0x8426('0x2b')]);}else{logger[_0x8426('0x24')](_0x8426('0x25'),_0x34a608,_0x8426('0x26'));_0x112ce1(_0x4dda8a[_0x8426('0x2c')][_0x8426('0x2b')]);}})['catch'](function(_0x47c0c7){logger[_0x8426('0x29')](_0x8426('0x25'),_0x34a608,_0x47c0c7);_0x2eb1f9(_0x47c0c7);});});}function respondWithStatusCode(_0x34829e,_0x37296e){_0x37296e=_0x37296e||0xcc;return function(_0x1b3816){if(_0x1b3816){return _0x34829e[_0x8426('0x2d')](_0x37296e);}return _0x34829e[_0x8426('0x2e')](_0x37296e)[_0x8426('0x2f')]();};}function respondWithResult(_0x7b7e37,_0x2415bf){_0x2415bf=_0x2415bf||0xc8;return function(_0xed91fb){if(_0xed91fb){return _0x7b7e37[_0x8426('0x2e')](_0x2415bf)[_0x8426('0x30')](_0xed91fb);}};}function respondWithFilteredResult(_0x3463f5,_0x5c44f2){return function(_0x480c68){if(_0x480c68){var _0x5b2472=_0x480c68[_0x8426('0x31')],_0x2b0c40=_0x5c44f2[_0x8426('0x32')],_0x12f00b=_0x5c44f2[_0x8426('0x32')]+_0x5c44f2[_0x8426('0x33')],_0x4bb904;if(_0x12f00b>=_0x5b2472){_0x12f00b=_0x5b2472;_0x4bb904=0xc8;}else{_0x4bb904=0xce;}_0x3463f5[_0x8426('0x2e')](_0x4bb904);return _0x3463f5[_0x8426('0x34')](_0x8426('0x35'),_0x2b0c40+'-'+_0x12f00b+'/'+_0x5b2472)[_0x8426('0x30')](_0x480c68);}return null;};}function patchUpdates(_0x20ecd9){return function(_0x20e534){try{jsonpatch[_0x8426('0x36')](_0x20e534,_0x20ecd9,!![]);}catch(_0x659e7c){return BPromise[_0x8426('0x37')](_0x659e7c);}return _0x20e534[_0x8426('0x38')]();};}function saveUpdates(_0x14ce62,_0x37096a){return function(_0x7f2f27){if(_0x7f2f27){return _0x7f2f27[_0x8426('0x39')](_0x14ce62)[_0x8426('0x23')](function(_0x49fbc8){return _0x49fbc8;});}return null;};}function removeEntity(_0x96d45a,_0x445eb9){return function(_0x5718be){if(_0x5718be){return _0x5718be[_0x8426('0x3a')]()['then'](function(){_0x96d45a[_0x8426('0x2e')](0xcc)[_0x8426('0x2f')]();});}};}function handleEntityNotFound(_0x3eb520,_0x46443a){return function(_0x762ea7){if(!_0x762ea7){_0x3eb520[_0x8426('0x2d')](0x194);}return _0x762ea7;};}function handleError(_0x4242cb,_0x52689d){_0x52689d=_0x52689d||0x1f4;return function(_0x77b812){logger[_0x8426('0x29')](_0x77b812[_0x8426('0x3b')]);if(_0x77b812[_0x8426('0x3c')]){delete _0x77b812[_0x8426('0x3c')];}_0x4242cb[_0x8426('0x2e')](_0x52689d)[_0x8426('0x3d')](_0x77b812);};}exports[_0x8426('0x3e')]=function(_0x5e969b,_0x3494d3){var _0x3c2d72={},_0x10d211={},_0x2f8ee3={'count':0x0,'rows':[]};var _0x424380=_[_0x8426('0x3f')](db[_0x8426('0x40')]['rawAttributes'],function(_0x433a82){return{'name':_0x433a82[_0x8426('0x41')],'type':_0x433a82['type'][_0x8426('0x42')]};});_0x10d211[_0x8426('0x43')]=_[_0x8426('0x3f')](_0x424380,'name');_0x10d211[_0x8426('0x44')]=_[_0x8426('0x45')](_0x5e969b[_0x8426('0x44')]);_0x10d211[_0x8426('0x46')]=_[_0x8426('0x47')](_0x10d211['model'],_0x10d211[_0x8426('0x44')]);_0x3c2d72[_0x8426('0x48')]=_[_0x8426('0x47')](_0x10d211['model'],qs[_0x8426('0x49')](_0x5e969b[_0x8426('0x44')][_0x8426('0x49')]));_0x3c2d72[_0x8426('0x48')]=_0x3c2d72[_0x8426('0x48')][_0x8426('0x4a')]?_0x3c2d72[_0x8426('0x48')]:_0x10d211[_0x8426('0x43')];if(!_0x5e969b[_0x8426('0x44')][_0x8426('0x4b')]('nolimit')){_0x3c2d72[_0x8426('0x33')]=qs[_0x8426('0x33')](_0x5e969b['query'][_0x8426('0x33')]);_0x3c2d72['offset']=qs[_0x8426('0x32')](_0x5e969b[_0x8426('0x44')]['offset']);}_0x3c2d72[_0x8426('0x4c')]=qs[_0x8426('0x4d')](_0x5e969b[_0x8426('0x44')][_0x8426('0x4d')]);_0x3c2d72['where']=qs['filters'](_[_0x8426('0x4e')](_0x5e969b[_0x8426('0x44')],_0x10d211[_0x8426('0x46')]),_0x424380);if(_0x5e969b[_0x8426('0x44')][_0x8426('0x4f')]){_0x3c2d72[_0x8426('0x50')]=_[_0x8426('0x51')](_0x3c2d72[_0x8426('0x50')],{'$or':_[_0x8426('0x3f')](_0x424380,function(_0x1269aa){if(_0x1269aa[_0x8426('0x52')]!=='VIRTUAL'){var _0x3c7bdd={};_0x3c7bdd[_0x1269aa[_0x8426('0x3c')]]={'$like':'%'+_0x5e969b[_0x8426('0x44')]['filter']+'%'};return _0x3c7bdd;}})});}_0x3c2d72=_[_0x8426('0x51')]({},_0x3c2d72,_0x5e969b[_0x8426('0x53')]);var _0x47f407={'where':_0x3c2d72['where']};return db['OpenchannelMessage'][_0x8426('0x31')](_0x47f407)[_0x8426('0x23')](function(_0x562e2d){_0x2f8ee3[_0x8426('0x31')]=_0x562e2d;if(_0x5e969b[_0x8426('0x44')][_0x8426('0x54')]){_0x3c2d72['include']=[{'all':!![]}];}return db[_0x8426('0x40')]['findAll'](_0x3c2d72);})[_0x8426('0x23')](function(_0x77b5a){_0x2f8ee3[_0x8426('0x55')]=_0x77b5a;return _0x2f8ee3;})[_0x8426('0x23')](respondWithFilteredResult(_0x3494d3,_0x3c2d72))[_0x8426('0x56')](handleError(_0x3494d3,null));};exports[_0x8426('0x57')]=function(_0x400228,_0x4485c7){var _0x42fd3f={'raw':!![],'where':{'id':_0x400228['params']['id']}},_0x4dfcb7={};_0x4dfcb7['model']=_[_0x8426('0x45')](db[_0x8426('0x40')][_0x8426('0x58')]);_0x4dfcb7[_0x8426('0x44')]=_['keys'](_0x400228[_0x8426('0x44')]);_0x4dfcb7[_0x8426('0x46')]=_[_0x8426('0x47')](_0x4dfcb7['model'],_0x4dfcb7['query']);_0x42fd3f[_0x8426('0x48')]=_['intersection'](_0x4dfcb7['model'],qs[_0x8426('0x49')](_0x400228['query'][_0x8426('0x49')]));_0x42fd3f['attributes']=_0x42fd3f[_0x8426('0x48')][_0x8426('0x4a')]?_0x42fd3f['attributes']:_0x4dfcb7['model'];if(_0x400228[_0x8426('0x44')][_0x8426('0x54')]){_0x42fd3f['include']=[{'all':!![]}];}_0x42fd3f=_[_0x8426('0x51')]({},_0x42fd3f,_0x400228[_0x8426('0x53')]);return db[_0x8426('0x40')][_0x8426('0x59')](_0x42fd3f)[_0x8426('0x23')](handleEntityNotFound(_0x4485c7,null))[_0x8426('0x23')](respondWithResult(_0x4485c7,null))[_0x8426('0x56')](handleError(_0x4485c7,null));};exports[_0x8426('0x5a')]=function(_0x22b239,_0x160277){return db[_0x8426('0x40')][_0x8426('0x5a')](_0x22b239[_0x8426('0x5b')],{})[_0x8426('0x23')](respondWithResult(_0x160277,0xc9))[_0x8426('0x56')](handleError(_0x160277,null));};exports['update']=function(_0x2182b6,_0x2bbdd0){if(_0x2182b6['body']['id']){delete _0x2182b6[_0x8426('0x5b')]['id'];}return db['OpenchannelMessage'][_0x8426('0x59')]({'where':{'id':_0x2182b6[_0x8426('0x5c')]['id']}})[_0x8426('0x23')](handleEntityNotFound(_0x2bbdd0,null))[_0x8426('0x23')](saveUpdates(_0x2182b6[_0x8426('0x5b')],null))['then'](respondWithResult(_0x2bbdd0,null))[_0x8426('0x56')](handleError(_0x2bbdd0,null));};exports[_0x8426('0x3a')]=function(_0x15bc45,_0x5b540b){return db[_0x8426('0x40')][_0x8426('0x59')]({'where':{'id':_0x15bc45[_0x8426('0x5c')]['id']}})[_0x8426('0x23')](handleEntityNotFound(_0x5b540b,null))[_0x8426('0x23')](removeEntity(_0x5b540b,null))[_0x8426('0x56')](handleError(_0x5b540b,null));};exports[_0x8426('0x5d')]=function(_0x1dbfb8,_0x350f11){return db[_0x8426('0x40')][_0x8426('0x5d')]()[_0x8426('0x23')](respondWithResult(_0x350f11,null))[_0x8426('0x56')](handleError(_0x350f11,null));};var interaction_log=require('../../config/logger')(_0x8426('0x5e'));exports[_0x8426('0x5f')]=function(_0x5dc4bd,_0x4dbf4f,_0x17104d){var _0x935d3c={'agent':{},'channel':_0x8426('0x60')};if(_0x5dc4bd[_0x8426('0x5b')]['id']){delete _0x5dc4bd[_0x8426('0x5b')]['id'];}_0x5dc4bd['body']['read']=!![];_0x5dc4bd[_0x8426('0x5b')][_0x8426('0x61')]=moment()[_0x8426('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x5dc4bd[_0x8426('0x5b')]['UserId']=_0x5dc4bd[_0x8426('0x5b')][_0x8426('0x63')]||_0x5dc4bd[_0x8426('0x64')]['id'];_0x935d3c[_0x8426('0x65')]['id']=_0x5dc4bd['body'][_0x8426('0x63')];return db[_0x8426('0x40')][_0x8426('0x59')]({'where':{'id':_0x5dc4bd[_0x8426('0x5c')]['id'],'UserId':null},'include':[{'model':db[_0x8426('0x66')],'as':_0x8426('0x67')}]})[_0x8426('0x23')](handleEntityNotFound(_0x4dbf4f,null))['then'](saveUpdates(_0x5dc4bd[_0x8426('0x5b')],null))[_0x8426('0x23')](function(_0x302bbd){if(_0x302bbd){_0x935d3c[_0x8426('0x2b')]=_0x302bbd[_0x8426('0x68')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x302bbd['OpenchannelInteractionId']}});}return null;})[_0x8426('0x23')](handleEntityNotFound(_0x4dbf4f,null))['then'](function(_0x29f564){if(_0x29f564){return _0x29f564[_0x8426('0x39')]({'UserId':_0x5dc4bd[_0x8426('0x5b')][_0x8426('0x63')],'read1stAt':_[_0x8426('0x69')](_0x29f564[_0x8426('0x6a')])?moment()['format'](_0x8426('0x6b')):undefined});}return null;})[_0x8426('0x23')](function(_0xacf20b){if(_0xacf20b){_0x935d3c[_0x8426('0x6c')]=_0xacf20b[_0x8426('0x68')]({'plain':!![]});interaction_log['info'](_0x8426('0x6d'),_0x5dc4bd[_0x8426('0x64')]['id'],_0x5dc4bd[_0x8426('0x64')]['name'],_0x5dc4bd[_0x8426('0x64')]['role'],_0x935d3c['interaction']['id'],_0x5dc4bd[_0x8426('0x5b')]?JSON['stringify'](_0x5dc4bd[_0x8426('0x5b')]):_0x8426('0x6e'));return respondWithRpcPromise(_0x8426('0x6f'),'acceptMessage',_0x935d3c);}return null;})['then'](function(_0x21b290){if(_0x21b290){if(_0x5dc4bd[_0x8426('0x5b')]['manual']){_0x935d3c[_0x8426('0x2b')][_0x8426('0x70')]=util[_0x8426('0x62')](_0x8426('0x71'),_0x5dc4bd[_0x8426('0x64')][_0x8426('0x3c')]);_0x935d3c['message']['channel']=_0x935d3c[_0x8426('0x72')];_0x935d3c[_0x8426('0x2b')][_0x8426('0x73')]='accept';return respondWithRpcPromise(_0x8426('0x74'),_0x8426('0x74'),{'event':'acceptmessage','message':_0x935d3c[_0x8426('0x2b')]},client9002)[_0x8426('0x23')](function(){return _0x935d3c;});}return _0x935d3c;}return null;})[_0x8426('0x23')](respondWithResult(_0x4dbf4f,null))[_0x8426('0x56')](handleError(_0x4dbf4f,null));};var interaction_log=require(_0x8426('0x16'))(_0x8426('0x5e'));exports[_0x8426('0x37')]=function(_0x41c4d1,_0x3a6444,_0x56ebf3){var _0x320b35={'agent':{},'channel':_0x8426('0x60')};if(_0x41c4d1['body']['id']){delete _0x41c4d1[_0x8426('0x5b')]['id'];}_0x41c4d1[_0x8426('0x5b')][_0x8426('0x63')]=_0x41c4d1['body']['UserId']||_0x41c4d1[_0x8426('0x64')]['id'];_0x320b35[_0x8426('0x65')]['id']=_0x41c4d1['body'][_0x8426('0x63')];return db[_0x8426('0x40')][_0x8426('0x59')]({'where':{'id':_0x41c4d1['params']['id'],'UserId':null}})[_0x8426('0x23')](handleEntityNotFound(_0x3a6444,null))['then'](function(_0x8e2e0f){if(_0x8e2e0f){_0x320b35[_0x8426('0x2b')]=_0x8e2e0f['get']({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x8e2e0f[_0x8426('0x75')]}});}return null;})[_0x8426('0x23')](handleEntityNotFound(_0x3a6444,null))[_0x8426('0x23')](function(_0x66828d){if(_0x66828d){_0x320b35[_0x8426('0x6c')]=_0x66828d[_0x8426('0x68')]({'plain':!![]});interaction_log['info'](_0x8426('0x76'),_0x41c4d1[_0x8426('0x64')]['id'],_0x41c4d1['user'][_0x8426('0x3c')],_0x41c4d1[_0x8426('0x64')]['role'],_0x320b35[_0x8426('0x6c')]['id'],_0x41c4d1[_0x8426('0x5b')]?JSON[_0x8426('0x28')](_0x41c4d1[_0x8426('0x5b')]):_0x8426('0x6e'));return respondWithRpcPromise(_0x8426('0x77'),'rejectMessage',_0x320b35);}return null;})[_0x8426('0x23')](function(_0x24bdd1){if(_0x24bdd1){_0x24bdd1[_0x8426('0x2b')][_0x8426('0x70')]=util[_0x8426('0x62')]('SIP/%s',_0x41c4d1[_0x8426('0x64')]['name']);_0x24bdd1[_0x8426('0x2b')][_0x8426('0x72')]=_0x320b35[_0x8426('0x72')];_0x24bdd1[_0x8426('0x2b')][_0x8426('0x73')]='reject';respondWithRpcPromise(_0x8426('0x74'),_0x8426('0x74'),{'event':_0x8426('0x78'),'message':_0x24bdd1[_0x8426('0x2b')]},client9002);return _0x320b35;}return null;})[_0x8426('0x23')](respondWithResult(_0x3a6444,null))[_0x8426('0x56')](handleError(_0x3a6444,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index d110b1d..c5d292c 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 _0x4b21=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0x4b21,0x1e8));var _0x14b2=function(_0x1bb64a,_0x3359b7){_0x1bb64a=_0x1bb64a-0x0;var _0x106b9c=_0x4b21[_0x1bb64a];return _0x106b9c;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x14b2('0x0'))['db'][_0x14b2('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x14b2('0x2')](0x0);var events={'afterCreate':_0x14b2('0x3'),'afterUpdate':_0x14b2('0x4'),'afterDestroy':_0x14b2('0x5')};function emitEvent(_0x36d119){return function(_0x4f5302,_0x267199,_0x3349fd){OpenchannelMessageEvents[_0x14b2('0x6')](_0x36d119+':'+_0x4f5302['id'],_0x4f5302);OpenchannelMessageEvents[_0x14b2('0x6')](_0x36d119,_0x4f5302);_0x3349fd(null);};}for(var e in events){if(events[_0x14b2('0x7')](e)){var event=events[e];OpenchannelMessage[_0x14b2('0x8')](e,emitEvent(event));}}module[_0x14b2('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x7d96=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d96,0xca));var _0x67d9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7d96[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x67d9('0x0'));var OpenchannelMessage=require(_0x67d9('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x67d9('0x2')](0x0);var events={'afterCreate':_0x67d9('0x3'),'afterUpdate':'update','afterDestroy':_0x67d9('0x4')};function emitEvent(_0x32f610){return function(_0x5674f3,_0x1d7da5,_0x1d5f23){OpenchannelMessageEvents[_0x67d9('0x5')](_0x32f610+':'+_0x5674f3['id'],_0x5674f3);OpenchannelMessageEvents[_0x67d9('0x5')](_0x32f610,_0x5674f3);_0x1d5f23(null);};}for(var e in events){if(events[_0x67d9('0x6')](e)){var event=events[e];OpenchannelMessage[_0x67d9('0x7')](e,emitEvent(event));}}module[_0x67d9('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 ca4ad42..fb5f296 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 _0xbeec=['get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','catch','error','CmContact','describe','OpenchannelAccount','find','Interactions','Contact','keys','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','method','GET','POST','OpenchannelMessage,\x20%s,\x20%s','threadId','update','inspect','finally','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models'];(function(_0x309de6,_0x50df46){var _0x3a2986=function(_0x525e65){while(--_0x525e65){_0x309de6['push'](_0x309de6['shift']());}};_0x3a2986(++_0x50df46);}(_0xbeec,0xbc));var _0xcbee=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbeec[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xcbee('0x0'));var logger=require(_0xcbee('0x1'))(_0xcbee('0x2'));var moment=require(_0xcbee('0x3'));var BPromise=require(_0xcbee('0x4'));var rp=require(_0xcbee('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbee('0x6'));var config=require(_0xcbee('0x7'));var attributes=require(_0xcbee('0x8'));module[_0xcbee('0x9')]=function(_0x43300d,_0x239025){return _0x43300d[_0xcbee('0xa')](_0xcbee('0xb'),attributes,{'tableName':_0xcbee('0xc'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xcbee('0xd')],'type':_0xcbee('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x38a57e,_0x1f907f,_0x4ec323){var _0x18af58=_0x43300d[_0xcbee('0xf')];var _0x51dce9=_0x38a57e[_0xcbee('0x10')]({'plain':!![]});if(_0x51dce9[_0xcbee('0x11')][_0xcbee('0x12')]()==='in'||_0x51dce9['direction']['toLowerCase']()===_0xcbee('0x13')&&!_0x51dce9[_0xcbee('0x14')]&&!_['isNil'](_0x51dce9[_0xcbee('0x15')])){_0x18af58[_0xcbee('0x16')][_0xcbee('0x17')]({'where':{'id':_0x51dce9[_0xcbee('0x18')]}})[_0xcbee('0x19')](function(_0x260ec8){if(_0x260ec8){_0x260ec8['update']({'lastMsgAt':_0x51dce9['createdAt'],'lastMsgDirection':_0x51dce9[_0xcbee('0x11')]['toLowerCase']()});}})[_0xcbee('0x1a')](function(_0xc22810){console[_0xcbee('0x1b')](_0xc22810);});}if(_0x51dce9[_0xcbee('0x11')]===_0xcbee('0x13')&&!_0x51dce9[_0xcbee('0x14')]){var _0x555afd;_0x18af58[_0xcbee('0x1c')][_0xcbee('0x1d')]()[_0xcbee('0x19')](function(_0x4f6540){return _0x18af58[_0xcbee('0x1e')][_0xcbee('0x1f')]({'where':{'id':_0x51dce9['OpenchannelAccountId']},'include':[{'model':_0x18af58[_0xcbee('0x16')],'as':_0xcbee('0x20'),'where':{'id':_0x51dce9[_0xcbee('0x18')]},'limit':0x1,'include':[{'model':_0x18af58[_0xcbee('0x1c')],'as':_0xcbee('0x21'),'attributes':_[_0xcbee('0x22')](_0x4f6540)}]}]});})[_0xcbee('0x19')](function(_0x268619){_0x555afd=_0x268619[_0xcbee('0x10')]({'plain':!![]});if(_0x555afd&&_0x555afd[_0xcbee('0x23')]){logger[_0xcbee('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0xcbee('0x25'),util[_0xcbee('0x26')](_0xcbee('0x27'),_0x51dce9['id'],_0x555afd[_0xcbee('0x23')]));if(_0x555afd['Interactions']&&_0x555afd[_0xcbee('0x20')][_0xcbee('0x28')]){_0x51dce9[_0xcbee('0x29')]=_[_0xcbee('0x2a')](_0x555afd[_0xcbee('0x20')][0x0],_0xcbee('0x21'));_0x51dce9[_0xcbee('0x21')]=_0x555afd['Interactions'][0x0][_0xcbee('0x21')];}var _0x1f907f={'method':'POST','uri':encodeURI(_0x555afd['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1f907f[_0xcbee('0x2b')]){case _0xcbee('0x2c'):_0x1f907f['qs']=_0x51dce9;break;case _0xcbee('0x2d'):_0x1f907f[_0xcbee('0xd')]=_0x51dce9;break;}return rp(_0x1f907f)['then'](function(_0x1ba88a){logger[_0xcbee('0x24')](_0xcbee('0x2e'),_0xcbee('0x25'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x51dce9['id'],_0x555afd['replyUri']));if(_0x1ba88a['body']['threadId']&&_0x1ba88a['body'][_0xcbee('0x2f')]!=_0x51dce9[_0xcbee('0x29')][_0xcbee('0x2f')]){return _0x18af58[_0xcbee('0x16')]['update']({'threadId':_0x1ba88a[_0xcbee('0xd')][_0xcbee('0x2f')]},{'logging':!![],'where':{'id':_0x51dce9[_0xcbee('0x29')]['id']}});}else{return;}})[_0xcbee('0x19')](function(){return _0x38a57e[_0xcbee('0x30')]({'read':!![]});})[_0xcbee('0x1a')](function(_0x1725be){logger[_0xcbee('0x1b')](_0xcbee('0x2e'),_0xcbee('0x25'),util[_0xcbee('0x31')](_0x1725be,{'showHidden':![],'depth':null}));_0x4ec323();});}else{_0x4ec323();}})[_0xcbee('0x32')](function(){_0x4ec323();});}else{_0x4ec323();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x23b4=['OpenchannelMessage','fti_openchannel_messages','FULLTEXT','get','direction','toLowerCase','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','createdAt','catch','secret','CmContact','describe','then','OpenchannelAccount','find','Interactions','Contact','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','omit','POST','method','Message\x20%d\x20forwarded\x20to\x20%s','body','threadId','Interaction','error','inspect','finally','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','define'];(function(_0x3b310d,_0x219918){var _0x199171=function(_0x38e62b){while(--_0x38e62b){_0x3b310d['push'](_0x3b310d['shift']());}};_0x199171(++_0x219918);}(_0x23b4,0x11c));var _0x423b=function(_0x3fbd02,_0x569ab3){_0x3fbd02=_0x3fbd02-0x0;var _0x460fea=_0x23b4[_0x3fbd02];return _0x460fea;};'use strict';var _=require(_0x423b('0x0'));var util=require(_0x423b('0x1'));var logger=require(_0x423b('0x2'))('api');var moment=require(_0x423b('0x3'));var BPromise=require(_0x423b('0x4'));var rp=require(_0x423b('0x5'));var fs=require('fs');var path=require(_0x423b('0x6'));var rimraf=require('rimraf');var config=require(_0x423b('0x7'));var attributes=require(_0x423b('0x8'));module['exports']=function(_0x19b488,_0x44e84f){return _0x19b488[_0x423b('0x9')](_0x423b('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x423b('0xb'),'fields':['body'],'type':_0x423b('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4bda96,_0x5b137d,_0x235c99){var _0x3a8814=_0x19b488['models'];var _0x53cacf=_0x4bda96[_0x423b('0xd')]({'plain':!![]});if(_0x53cacf[_0x423b('0xe')][_0x423b('0xf')]()==='in'||_0x53cacf[_0x423b('0xe')][_0x423b('0xf')]()==='out'&&!_0x53cacf['secret']&&!_[_0x423b('0x10')](_0x53cacf[_0x423b('0x11')])){_0x3a8814[_0x423b('0x12')][_0x423b('0x13')]({'where':{'id':_0x53cacf[_0x423b('0x14')]}})['then'](function(_0x218523){if(_0x218523){_0x218523['update']({'lastMsgAt':_0x53cacf[_0x423b('0x15')],'lastMsgDirection':_0x53cacf[_0x423b('0xe')][_0x423b('0xf')]()});}})[_0x423b('0x16')](function(_0x27f74f){console['error'](_0x27f74f);});}if(_0x53cacf[_0x423b('0xe')]==='out'&&!_0x53cacf[_0x423b('0x17')]){var _0x50b0ff;_0x3a8814[_0x423b('0x18')][_0x423b('0x19')]()[_0x423b('0x1a')](function(_0x4317c8){return _0x3a8814[_0x423b('0x1b')][_0x423b('0x1c')]({'where':{'id':_0x53cacf['OpenchannelAccountId']},'include':[{'model':_0x3a8814[_0x423b('0x12')],'as':_0x423b('0x1d'),'where':{'id':_0x53cacf[_0x423b('0x14')]},'limit':0x1,'include':[{'model':_0x3a8814[_0x423b('0x18')],'as':_0x423b('0x1e'),'attributes':_['keys'](_0x4317c8)}]}]});})[_0x423b('0x1a')](function(_0xd8cb20){_0x50b0ff=_0xd8cb20[_0x423b('0xd')]({'plain':!![]});if(_0x50b0ff&&_0x50b0ff['replyUri']){logger[_0x423b('0x1f')](_0x423b('0x20'),_0x423b('0x21'),util[_0x423b('0x22')](_0x423b('0x23'),_0x53cacf['id'],_0x50b0ff[_0x423b('0x24')]));if(_0x50b0ff[_0x423b('0x1d')]&&_0x50b0ff['Interactions'][_0x423b('0x25')]){_0x53cacf['Interaction']=_[_0x423b('0x26')](_0x50b0ff['Interactions'][0x0],_0x423b('0x1e'));_0x53cacf[_0x423b('0x1e')]=_0x50b0ff[_0x423b('0x1d')][0x0][_0x423b('0x1e')];}var _0x5b137d={'method':_0x423b('0x27'),'uri':encodeURI(_0x50b0ff[_0x423b('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5b137d[_0x423b('0x28')]){case'GET':_0x5b137d['qs']=_0x53cacf;break;case _0x423b('0x27'):_0x5b137d['body']=_0x53cacf;break;}return rp(_0x5b137d)['then'](function(_0x52765c){logger['info'](_0x423b('0x20'),_0x423b('0x21'),util[_0x423b('0x22')](_0x423b('0x29'),_0x53cacf['id'],_0x50b0ff['replyUri']));if(_0x52765c[_0x423b('0x2a')][_0x423b('0x2b')]&&_0x52765c[_0x423b('0x2a')][_0x423b('0x2b')]!=_0x53cacf[_0x423b('0x2c')][_0x423b('0x2b')]){return _0x3a8814[_0x423b('0x12')]['update']({'threadId':_0x52765c['body'][_0x423b('0x2b')]},{'logging':!![],'where':{'id':_0x53cacf['Interaction']['id']}});}else{return;}})['then'](function(){return _0x4bda96['update']({'read':!![]});})[_0x423b('0x16')](function(_0x5e6abb){logger[_0x423b('0x2d')](_0x423b('0x20'),_0x423b('0x21'),util[_0x423b('0x2e')](_0x5e6abb,{'showHidden':![],'depth':null}));_0x235c99();});}else{_0x235c99();}})[_0x423b('0x2f')](function(){_0x235c99();});}else{_0x235c99();}}},'charset':_0x423b('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 85f7c14..ae349a5 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(_0x8d05ba,_0x3194b7){var _0xa97338=function(_0x51b565){while(--_0x51b565){_0x8d05ba['push'](_0x8d05ba['shift']());}};_0xa97338(++_0x3194b7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x41d677,_0x17ad95){_0x41d677=_0x41d677-0x0;var _0x507986=_0x5f2f[_0x41d677];return _0x507986;};'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 _0xd8b0=['util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','./openchannelMessage.socket','register','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','options','lodash'];(function(_0x2cfbad,_0x506537){var _0x5515b5=function(_0x4eb087){while(--_0x4eb087){_0x2cfbad['push'](_0x2cfbad['shift']());}};_0x5515b5(++_0x506537);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});config[_0x0d8b('0x9')]=_['defaults'](config[_0x0d8b('0x9')],{'host':_0x0d8b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d8b('0x9')]));require(_0x0d8b('0xb'))[_0x0d8b('0xc')](socket);function respondWithRpcPromise(_0x1f4800,_0x28ff7f,_0x1cac62){return new BPromise(function(_0x2c5e9e,_0x28f87c){return client['request'](_0x1f4800,_0x1cac62)[_0x0d8b('0xd')](function(_0x4e0269){logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));logger[_0x0d8b('0x11')](_0x0d8b('0x12'),_0x28ff7f,_0x0d8b('0x10'),JSON[_0x0d8b('0x13')](_0x4e0269));if(_0x4e0269[_0x0d8b('0x14')]){if(_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x15')]===0x1f4){logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x28f87c(_0x4e0269['error'][_0x0d8b('0x16')]);}logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x2c5e9e(_0x4e0269['error'][_0x0d8b('0x16')]);}else{logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));_0x2c5e9e(_0x4e0269[_0x0d8b('0x17')][_0x0d8b('0x16')]);}})[_0x0d8b('0x18')](function(_0xa3612a){logger['error'](_0x0d8b('0xf'),_0x28ff7f,_0xa3612a);_0x28f87c(_0xa3612a);});});}exports[_0x0d8b('0x19')]=function(_0x196c0a){var _0x143372=this;return new Promise(function(_0x24e8ed,_0x5b709c){return db[_0x0d8b('0x1a')][_0x0d8b('0x1b')](_0x196c0a['body'],{'raw':_0x196c0a['options']?_0x196c0a[_0x0d8b('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5527d8){logger[_0x0d8b('0xe')](_0x0d8b('0x19'),_0x196c0a);logger[_0x0d8b('0x11')](_0x0d8b('0x19'),_0x196c0a,JSON[_0x0d8b('0x13')](_0x5527d8));_0x24e8ed(_0x5527d8);})[_0x0d8b('0x18')](function(_0x30980c){logger[_0x0d8b('0x14')](_0x0d8b('0x19'),_0x30980c['message'],_0x196c0a);_0x5b709c(_0x143372[_0x0d8b('0x14')](0x1f4,_0x30980c[_0x0d8b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 0e036cd..bd42793 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 _0xf4eb=['removeListener','register','./openchannelMessage.events'];(function(_0x4f7339,_0x1dc41e){var _0x241781=function(_0x50d5f2){while(--_0x50d5f2){_0x4f7339['push'](_0x4f7339['shift']());}};_0x241781(++_0x1dc41e);}(_0xf4eb,0xec));var _0xbf4e=function(_0x38650a,_0x287aa1){_0x38650a=_0x38650a-0x0;var _0x9b89cf=_0xf4eb[_0x38650a];return _0x9b89cf;};'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 +var _0xa9e0=['register','length','openchannelMessage:','./openchannelMessage.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(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var OpenchannelMessageEvents=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(){OpenchannelMessageEvents[_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);OpenchannelMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index b6adea1..fe96e0c 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(_0x4cfab0,_0x17dbfd){var _0x4211f2=function(_0x5dfa34){while(--_0x5dfa34){_0x4cfab0['push'](_0x4cfab0['shift']());}};_0x4211f2(++_0x17dbfd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x405ea7,_0x11dfb2){var _0x28af41=function(_0x309ccf){while(--_0x309ccf){_0x405ea7['push'](_0x405ea7['shift']());}};_0x28af41(++_0x11dfb2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 0209b27..cfda0ee 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 _0x2d03=['INTEGER','ENUM','rrmemory','beepall','exports','STRING','name'];(function(_0x289ad3,_0x49e9fb){var _0x498629=function(_0x4db1c0){while(--_0x4db1c0){_0x289ad3['push'](_0x289ad3['shift']());}};_0x498629(++_0x49e9fb);}(_0x2d03,0x1e7));var _0x32d0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2d03[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x32d0('0x0')]={'name':{'type':Sequelize[_0x32d0('0x1')],'unique':_0x32d0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x32d0('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x32d0('0x4')](_0x32d0('0x5'),_0x32d0('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x5fdc=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x53f37f,_0xfb0b18){var _0x2fe5f8=function(_0x76ef2d){while(--_0x76ef2d){_0x53f37f['push'](_0x53f37f['shift']());}};_0x2fe5f8(++_0xfb0b18);}(_0x5fdc,0x127));var _0xc5fd=function(_0x27b468,_0x3add42){_0x27b468=_0x27b468-0x0;var _0x608bc3=_0x5fdc[_0x27b468];return _0x608bc3;};'use strict';var Sequelize=require(_0xc5fd('0x0'));module[_0xc5fd('0x1')]={'name':{'type':Sequelize[_0xc5fd('0x2')],'unique':_0xc5fd('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc5fd('0x2')]},'timeout':{'type':Sequelize[_0xc5fd('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc5fd('0x5')](_0xc5fd('0x6'),_0xc5fd('0x7'),_0xc5fd('0x8'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index dd41768..b5cf9b8 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 _0x83f2=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','OpenchannelQueues','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','nolimit','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','%s/%s','SIP','getTeams','pick','addTeams','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','Team','ids','select','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','moment','bluebird','mustache','util','to-csv','ejs','fs-extra'];(function(_0x4abcb1,_0x1b577c){var _0x450402=function(_0x29ac29){while(--_0x29ac29){_0x4abcb1['push'](_0x4abcb1['shift']());}};_0x450402(++_0x1b577c);}(_0x83f2,0x87));var _0x283f=function(_0x493947,_0x2e0383){_0x493947=_0x493947-0x0;var _0x239dbd=_0x83f2[_0x493947];return _0x239dbd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x283f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x283f('0x1'));var BPromise=require(_0x283f('0x2'));var Mustache=require(_0x283f('0x3'));var util=require(_0x283f('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x283f('0x5'));var ejs=require(_0x283f('0x6'));var fs=require('fs');var fs_extra=require(_0x283f('0x7'));var _=require('lodash');var squel=require(_0x283f('0x8'));var crypto=require(_0x283f('0x9'));var jsforce=require(_0x283f('0xa'));var deskjs=require(_0x283f('0xb'));var toCsv=require(_0x283f('0x5'));var querystring=require(_0x283f('0xc'));var Papa=require(_0x283f('0xd'));var Redis=require(_0x283f('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x283f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x283f('0x10'))(_0x283f('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x283f('0x12'));var db=require(_0x283f('0x13'))['db'];config[_0x283f('0x14')]=_[_0x283f('0x15')](config[_0x283f('0x14')],{'host':_0x283f('0x16'),'port':0x18eb});var socket=require(_0x283f('0x17'))(new Redis(config['redis']));require(_0x283f('0x18'))[_0x283f('0x19')](socket);function respondWithStatusCode(_0x3f6f08,_0x3c341a){_0x3c341a=_0x3c341a||0xcc;return function(_0x2cf4e9){if(_0x2cf4e9){return _0x3f6f08['sendStatus'](_0x3c341a);}return _0x3f6f08[_0x283f('0x1a')](_0x3c341a)['end']();};}function respondWithResult(_0x146725,_0x3dcb52){_0x3dcb52=_0x3dcb52||0xc8;return function(_0x43d03e){if(_0x43d03e){return _0x146725['status'](_0x3dcb52)[_0x283f('0x1b')](_0x43d03e);}};}function respondWithFilteredResult(_0x189215,_0x563c38){return function(_0x191b4f){if(_0x191b4f){var _0x1078b1=_0x191b4f[_0x283f('0x1c')],_0x27dc0e=_0x563c38[_0x283f('0x1d')],_0x317c61=_0x563c38[_0x283f('0x1d')]+_0x563c38[_0x283f('0x1e')],_0x1ac440;if(_0x317c61>=_0x1078b1){_0x317c61=_0x1078b1;_0x1ac440=0xc8;}else{_0x1ac440=0xce;}_0x189215[_0x283f('0x1a')](_0x1ac440);return _0x189215['set'](_0x283f('0x1f'),_0x27dc0e+'-'+_0x317c61+'/'+_0x1078b1)[_0x283f('0x1b')](_0x191b4f);}return null;};}function patchUpdates(_0x22281d){return function(_0x56c2b2){try{jsonpatch[_0x283f('0x20')](_0x56c2b2,_0x22281d,!![]);}catch(_0x531da8){return BPromise[_0x283f('0x21')](_0x531da8);}return _0x56c2b2[_0x283f('0x22')]();};}function saveUpdates(_0x1f1f89,_0x56e5f8){return function(_0x4c4ccb){if(_0x4c4ccb){return _0x4c4ccb[_0x283f('0x23')](_0x1f1f89)[_0x283f('0x24')](function(_0x505dbe){return _0x505dbe;});}return null;};}function removeEntity(_0x1665a9,_0x1f3469){return function(_0xc8e40){if(_0xc8e40){return _0xc8e40[_0x283f('0x25')]()['then'](function(){var _0x5a2fe0=_0xc8e40['get']({'plain':!![]});var _0x4118bd=_0x283f('0x26');return db[_0x283f('0x27')][_0x283f('0x25')]({'where':{'type':_0x4118bd,'resourceId':_0x5a2fe0['id']}})[_0x283f('0x24')](function(){return _0xc8e40;});})[_0x283f('0x24')](function(){_0x1665a9[_0x283f('0x1a')](0xcc)[_0x283f('0x28')]();});}};}function handleEntityNotFound(_0x5e2d45,_0x5b2b1c){return function(_0x17d583){if(!_0x17d583){_0x5e2d45[_0x283f('0x29')](0x194);}return _0x17d583;};}function handleError(_0x33912f,_0x301224){_0x301224=_0x301224||0x1f4;return function(_0x5724b4){logger[_0x283f('0x2a')](_0x5724b4[_0x283f('0x2b')]);if(_0x5724b4['name']){delete _0x5724b4[_0x283f('0x2c')];}_0x33912f[_0x283f('0x1a')](_0x301224)[_0x283f('0x2d')](_0x5724b4);};}exports[_0x283f('0x2e')]=function(_0x5a13be,_0x4b3b41){var _0x1d8bb8={},_0x5f5538={},_0x1a0fc3={'count':0x0,'rows':[]};var _0xc4e06b=_[_0x283f('0x2f')](db[_0x283f('0x30')][_0x283f('0x31')],function(_0x243aeb){return{'name':_0x243aeb[_0x283f('0x32')],'type':_0x243aeb[_0x283f('0x33')][_0x283f('0x34')]};});_0x5f5538[_0x283f('0x35')]=_['map'](_0xc4e06b,_0x283f('0x2c'));_0x5f5538[_0x283f('0x36')]=_[_0x283f('0x37')](_0x5a13be['query']);_0x5f5538[_0x283f('0x38')]=_[_0x283f('0x39')](_0x5f5538[_0x283f('0x35')],_0x5f5538[_0x283f('0x36')]);_0x1d8bb8[_0x283f('0x3a')]=_['intersection'](_0x5f5538[_0x283f('0x35')],qs['fields'](_0x5a13be[_0x283f('0x36')][_0x283f('0x3b')]));_0x1d8bb8[_0x283f('0x3a')]=_0x1d8bb8[_0x283f('0x3a')][_0x283f('0x3c')]?_0x1d8bb8['attributes']:_0x5f5538[_0x283f('0x35')];if(!_0x5a13be[_0x283f('0x36')][_0x283f('0x3d')]('nolimit')){_0x1d8bb8[_0x283f('0x1e')]=qs[_0x283f('0x1e')](_0x5a13be[_0x283f('0x36')][_0x283f('0x1e')]);_0x1d8bb8[_0x283f('0x1d')]=qs[_0x283f('0x1d')](_0x5a13be[_0x283f('0x36')][_0x283f('0x1d')]);}_0x1d8bb8[_0x283f('0x3e')]=qs[_0x283f('0x3f')](_0x5a13be[_0x283f('0x36')][_0x283f('0x3f')]);_0x1d8bb8[_0x283f('0x40')]=qs['filters'](_['pick'](_0x5a13be[_0x283f('0x36')],_0x5f5538[_0x283f('0x38')]),_0xc4e06b);if(_0x5a13be[_0x283f('0x36')][_0x283f('0x41')]){_0x1d8bb8[_0x283f('0x40')]=_[_0x283f('0x42')](_0x1d8bb8[_0x283f('0x40')],{'$or':_[_0x283f('0x2f')](_0xc4e06b,function(_0x17a906){if(_0x17a906[_0x283f('0x33')]!==_0x283f('0x43')){var _0x17cd24={};_0x17cd24[_0x17a906[_0x283f('0x2c')]]={'$like':'%'+_0x5a13be[_0x283f('0x36')]['filter']+'%'};return _0x17cd24;}})});}_0x1d8bb8=_[_0x283f('0x42')]({},_0x1d8bb8,_0x5a13be[_0x283f('0x44')]);var _0x483e6b={'where':_0x1d8bb8[_0x283f('0x40')]};return db[_0x283f('0x30')]['count'](_0x483e6b)['then'](function(_0x42b306){_0x1a0fc3['count']=_0x42b306;if(_0x5a13be[_0x283f('0x36')]['includeAll']){_0x1d8bb8[_0x283f('0x45')]=[{'all':!![]}];}return db[_0x283f('0x30')][_0x283f('0x46')](_0x1d8bb8);})['then'](function(_0x6dff3e){_0x1a0fc3[_0x283f('0x47')]=_0x6dff3e;return _0x1a0fc3;})[_0x283f('0x24')](respondWithFilteredResult(_0x4b3b41,_0x1d8bb8))[_0x283f('0x48')](handleError(_0x4b3b41,null));};exports[_0x283f('0x49')]=function(_0x584ea5,_0x2d0ab7){var _0x2afaf2={'raw':!![],'where':{'id':_0x584ea5[_0x283f('0x4a')]['id']}},_0x5e17f9={};_0x5e17f9[_0x283f('0x35')]=_[_0x283f('0x37')](db[_0x283f('0x30')]['rawAttributes']);_0x5e17f9['query']=_[_0x283f('0x37')](_0x584ea5['query']);_0x5e17f9[_0x283f('0x38')]=_['intersection'](_0x5e17f9['model'],_0x5e17f9['query']);_0x2afaf2[_0x283f('0x3a')]=_[_0x283f('0x39')](_0x5e17f9['model'],qs[_0x283f('0x3b')](_0x584ea5[_0x283f('0x36')][_0x283f('0x3b')]));_0x2afaf2[_0x283f('0x3a')]=_0x2afaf2[_0x283f('0x3a')][_0x283f('0x3c')]?_0x2afaf2[_0x283f('0x3a')]:_0x5e17f9['model'];if(_0x584ea5[_0x283f('0x36')]['includeAll']){_0x2afaf2[_0x283f('0x45')]=[{'all':!![]}];}_0x2afaf2=_[_0x283f('0x42')]({},_0x2afaf2,_0x584ea5[_0x283f('0x44')]);return db[_0x283f('0x30')]['find'](_0x2afaf2)[_0x283f('0x24')](handleEntityNotFound(_0x2d0ab7,null))[_0x283f('0x24')](respondWithResult(_0x2d0ab7,null))['catch'](handleError(_0x2d0ab7,null));};exports[_0x283f('0x4b')]=function(_0x14ed92,_0x51c7d1){return db[_0x283f('0x30')][_0x283f('0x4b')](_0x14ed92[_0x283f('0x4c')],{})[_0x283f('0x24')](function(_0x3d37ee){var _0xf294f6=_0x14ed92[_0x283f('0x4d')][_0x283f('0x4e')]({'plain':!![]});if(!_0xf294f6)throw new Error(_0x283f('0x4f'));if(_0xf294f6[_0x283f('0x50')]===_0x283f('0x4d')){var _0x44c13c=_0x3d37ee[_0x283f('0x4e')]({'plain':!![]});var _0x50dc9c=_0x283f('0x26');return db[_0x283f('0x51')][_0x283f('0x52')]({'where':{'name':_0x50dc9c,'userProfileId':_0xf294f6[_0x283f('0x53')]},'raw':!![]})[_0x283f('0x24')](function(_0x12684c){if(_0x12684c&&_0x12684c['autoAssociation']===0x0){return db[_0x283f('0x27')][_0x283f('0x4b')]({'name':_0x44c13c[_0x283f('0x2c')],'resourceId':_0x44c13c['id'],'type':_0x12684c[_0x283f('0x2c')],'sectionId':_0x12684c['id']},{})[_0x283f('0x24')](function(){return _0x3d37ee;});}else{return _0x3d37ee;}})[_0x283f('0x48')](function(_0x1435f0){logger[_0x283f('0x2a')](_0x283f('0x54'),_0x1435f0);throw _0x1435f0;});}return _0x3d37ee;})['then'](respondWithResult(_0x51c7d1,0xc9))[_0x283f('0x48')](handleError(_0x51c7d1,null));};exports[_0x283f('0x23')]=function(_0x3455d4,_0x21c556){if(_0x3455d4[_0x283f('0x4c')]['id']){delete _0x3455d4['body']['id'];}return db[_0x283f('0x30')][_0x283f('0x52')]({'where':{'id':_0x3455d4[_0x283f('0x4a')]['id']}})[_0x283f('0x24')](handleEntityNotFound(_0x21c556,null))[_0x283f('0x24')](saveUpdates(_0x3455d4[_0x283f('0x4c')],null))[_0x283f('0x24')](respondWithResult(_0x21c556,null))['catch'](handleError(_0x21c556,null));};exports[_0x283f('0x25')]=function(_0x2e1185,_0x26336b){return db[_0x283f('0x30')][_0x283f('0x52')]({'where':{'id':_0x2e1185[_0x283f('0x4a')]['id']}})[_0x283f('0x24')](handleEntityNotFound(_0x26336b,null))[_0x283f('0x24')](removeEntity(_0x26336b,null))[_0x283f('0x48')](handleError(_0x26336b,null));};exports['describe']=function(_0xaaa425,_0x28fdc0){return db['OpenchannelQueue'][_0x283f('0x55')]()[_0x283f('0x24')](respondWithResult(_0x28fdc0,null))[_0x283f('0x48')](handleError(_0x28fdc0,null));};exports[_0x283f('0x56')]=function(_0x707899,_0x57d6a3,_0x25f5f){var _0x47e015={'raw':!![],'where':{}},_0x26aba2={},_0x50dbb5;return db[_0x283f('0x30')][_0x283f('0x57')]({'where':{'id':_0x707899[_0x283f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x57d6a3,null))[_0x283f('0x24')](function(_0x159bfb){if(_0x159bfb){_0x50dbb5=_0x159bfb['get']({'plain':!![]});_0x26aba2['model']=_[_0x283f('0x37')](db[_0x283f('0x58')][_0x283f('0x31')]);_0x26aba2[_0x283f('0x36')]=_['keys'](_0x707899[_0x283f('0x36')]);_0x26aba2['filters']=_[_0x283f('0x39')](_0x26aba2[_0x283f('0x35')],_0x26aba2[_0x283f('0x36')]);_0x47e015['attributes']=_[_0x283f('0x39')](_0x26aba2[_0x283f('0x35')],qs[_0x283f('0x3b')](_0x707899[_0x283f('0x36')][_0x283f('0x3b')]));_0x47e015['attributes']=_0x47e015[_0x283f('0x3a')][_0x283f('0x3c')]?_0x47e015[_0x283f('0x3a')]:_0x26aba2[_0x283f('0x35')];if(!_0x707899['query'][_0x283f('0x3d')](_0x283f('0x59'))){_0x47e015[_0x283f('0x1e')]=qs['limit'](_0x707899[_0x283f('0x36')][_0x283f('0x1e')]);_0x47e015[_0x283f('0x1d')]=qs['offset'](_0x707899['query'][_0x283f('0x1d')]);}_0x47e015[_0x283f('0x3e')]=qs['sort'](_0x707899[_0x283f('0x36')]['sort']);_0x47e015[_0x283f('0x40')]=qs[_0x283f('0x38')](_['pick'](_0x707899[_0x283f('0x36')],_0x26aba2['filters']));_0x47e015[_0x283f('0x40')][_0x283f('0x5a')]=_0x159bfb['id'];if(_0x707899[_0x283f('0x36')][_0x283f('0x41')]){_0x47e015[_0x283f('0x40')]=_[_0x283f('0x42')](_0x47e015[_0x283f('0x40')],{'$or':_['map'](_0x47e015[_0x283f('0x3a')],function(_0x849d77){var _0xce1dfe={};_0xce1dfe[_0x849d77]={'$like':'%'+_0x707899[_0x283f('0x36')][_0x283f('0x41')]+'%'};return _0xce1dfe;})});}_0x47e015=_[_0x283f('0x42')]({},_0x47e015,_0x707899[_0x283f('0x44')]);return db[_0x283f('0x58')][_0x283f('0x46')](_0x47e015);}})[_0x283f('0x24')](function(_0xc2cc5d){if(_0xc2cc5d){return db[_0x283f('0x5b')][_0x283f('0x5c')]({'where':{'id':_[_0x283f('0x2f')](_0xc2cc5d,_0x283f('0x5d')),'role':_0x283f('0x5e')},'attributes':['id',_0x283f('0x2c'),_0x283f('0x5f'),_0x283f('0x60'),_0x283f('0x61')]});}})['then'](function(_0x318865){if(_0x318865){return{'count':_0x318865['count'],'rows':_[_0x283f('0x2f')](_0x318865['rows'],function(_0x1fbb8c){return{'membername':_0x1fbb8c[_0x283f('0x2c')],'UserId':_0x1fbb8c['id'],'queue_name':_0x50dbb5['name'],'OpenchannelQueueId':_0x50dbb5['id'],'interface':util['format'](_0x283f('0x62'),_0x283f('0x63'),_0x1fbb8c[_0x283f('0x2c')]),'penalty':0x0,'paused':_0x1fbb8c[_0x283f('0x5f')],'createdAt':_0x1fbb8c['createdAt'],'updatedAt':_0x1fbb8c[_0x283f('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x283f('0x24')](respondWithFilteredResult(_0x57d6a3,_0x47e015))[_0x283f('0x48')](handleError(_0x57d6a3,null));};exports[_0x283f('0x64')]=function(_0x507ddc,_0x4d79b5,_0x5fa2d6){var _0x49ce98={};var _0x56aede={};var _0x2c4a55;var _0x238c5d;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x507ddc[_0x283f('0x4a')]['id']}})[_0x283f('0x24')](handleEntityNotFound(_0x4d79b5,null))[_0x283f('0x24')](function(_0x16c327){if(_0x16c327){_0x2c4a55=_0x16c327;_0x56aede[_0x283f('0x35')]=_[_0x283f('0x37')](db['Team'][_0x283f('0x31')]);_0x56aede[_0x283f('0x36')]=_['keys'](_0x507ddc['query']);_0x56aede[_0x283f('0x38')]=_[_0x283f('0x39')](_0x56aede[_0x283f('0x35')],_0x56aede[_0x283f('0x36')]);_0x49ce98[_0x283f('0x3a')]=_[_0x283f('0x39')](_0x56aede[_0x283f('0x35')],qs[_0x283f('0x3b')](_0x507ddc['query'][_0x283f('0x3b')]));_0x49ce98[_0x283f('0x3a')]=_0x49ce98['attributes']['length']?_0x49ce98[_0x283f('0x3a')]:_0x56aede[_0x283f('0x35')];_0x49ce98['order']=qs['sort'](_0x507ddc[_0x283f('0x36')][_0x283f('0x3f')]);_0x49ce98[_0x283f('0x40')]=qs['filters'](_[_0x283f('0x65')](_0x507ddc[_0x283f('0x36')],_0x56aede['filters']));if(_0x507ddc[_0x283f('0x36')][_0x283f('0x41')]){_0x49ce98[_0x283f('0x40')]=_[_0x283f('0x42')](_0x49ce98[_0x283f('0x40')],{'$or':_[_0x283f('0x2f')](_0x49ce98['attributes'],function(_0x2f37c2){var _0x2aa654={};_0x2aa654[_0x2f37c2]={'$like':'%'+_0x507ddc[_0x283f('0x36')][_0x283f('0x41')]+'%'};return _0x2aa654;})});}_0x49ce98=_[_0x283f('0x42')]({},_0x49ce98,_0x507ddc['options']);return _0x2c4a55[_0x283f('0x64')](_0x49ce98);}})['then'](function(_0x423234){if(_0x423234){_0x238c5d=_0x423234[_0x283f('0x3c')];if(!_0x507ddc['query'][_0x283f('0x3d')](_0x283f('0x59'))){_0x49ce98[_0x283f('0x1e')]=qs[_0x283f('0x1e')](_0x507ddc[_0x283f('0x36')]['limit']);_0x49ce98[_0x283f('0x1d')]=qs['offset'](_0x507ddc[_0x283f('0x36')][_0x283f('0x1d')]);}return _0x2c4a55[_0x283f('0x64')](_0x49ce98);}})['then'](function(_0x33b125){if(_0x33b125){return _0x33b125?{'count':_0x238c5d,'rows':_0x33b125}:null;}})[_0x283f('0x24')](respondWithResult(_0x4d79b5,null))[_0x283f('0x48')](handleError(_0x4d79b5,null));};exports[_0x283f('0x66')]=function(_0x353b82,_0x54ba42,_0xc10962){var _0x4a5567=_0x353b82[_0x283f('0x4c')]['ids'];return db['Team'][_0x283f('0x46')]({'where':{'id':_0x4a5567},'attributes':['id'],'include':[{'model':db[_0x283f('0x5b')],'as':_0x283f('0x67'),'attributes':['id',_0x283f('0x2c'),_0x283f('0x68'),'voicePause',_0x283f('0x69')],'raw':!![]}]})[_0x283f('0x24')](function(_0x248b4f){if(_0x248b4f){var _0x1758b0=_[_0x283f('0x6a')](_0x248b4f,function(_0x2aeecf){var _0x3f42c7=_0x2aeecf[_0x283f('0x4e')]({'plain':!![]});return _0x3f42c7['Agents'];});return db[_0x283f('0x30')][_0x283f('0x52')]({'where':{'id':_0x353b82[_0x283f('0x4a')]['id']}})['then'](function(_0x285b0a){return db[_0x283f('0x6b')][_0x283f('0x6c')](function(_0x28d498){return _0x285b0a['addTeams'](_0x4a5567,{'transaction':_0x28d498})[_0x283f('0x24')](function(){return BPromise[_0x283f('0x6d')](_0x1758b0,function(_0x89aedf){return db['UserOpenchannelQueue'][_0x283f('0x6e')]({'where':{'UserId':_0x89aedf['id'],'OpenchannelQueueId':_0x353b82[_0x283f('0x4a')]['id']},'transaction':_0x28d498});});})[_0x283f('0x24')](function(){_0x1758b0[_0x283f('0x6f')](function(_0x150a19){socket[_0x283f('0x70')](_0x283f('0x71'),{'UserId':_0x150a19['id'],'OpenchannelQueueId':_0x285b0a['id']});});});});});}})[_0x283f('0x24')](respondWithStatusCode(_0x54ba42,null))['catch'](handleError(_0x54ba42,null));};exports['removeTeams']=function(_0x2637c6,_0x18ad13,_0x2b3683){return db[_0x283f('0x72')][_0x283f('0x46')]({'where':{'id':_0x2637c6['query'][_0x283f('0x73')]},'attributes':['id'],'include':[{'model':db[_0x283f('0x5b')],'as':_0x283f('0x67'),'attributes':['id'],'raw':!![]}]})[_0x283f('0x24')](handleEntityNotFound(_0x18ad13,null))[_0x283f('0x24')](function(_0x4e9346){var _0x3ad61a=_[_0x283f('0x2f')](_0x4e9346,'id');var _0x22fe1b=[];var _0x16226f=[];var _0x948a6b=squel[_0x283f('0x74')]();_0x948a6b['field']('tq.TeamId')['from'](_0x283f('0x75'),'tq')[_0x283f('0x76')](_0x283f('0x77'),'ut',_0x283f('0x78'))['where'](_0x283f('0x79'),_0x2637c6[_0x283f('0x4a')]['id']);for(var _0x149b1e=0x0;_0x149b1e<_0x4e9346[_0x283f('0x3c')];_0x149b1e+=0x1){let _0x34f94c=_0x4e9346[_0x149b1e];for(var _0x4da2c1=0x0;_0x4da2c1<_0x34f94c[_0x283f('0x67')][_0x283f('0x3c')];_0x4da2c1+=0x1){let _0x3743c9=_0x34f94c[_0x283f('0x67')][_0x4da2c1];var _0x2596d3=_0x948a6b[_0x283f('0x7a')]();_0x2596d3[_0x283f('0x40')]('ut.UserId\x20=\x20?',_0x3743c9['id']);_0x16226f[_0x283f('0x7b')](db[_0x283f('0x6b')]['query'](_0x2596d3[_0x283f('0x7c')](),{'type':db['sequelize'][_0x283f('0x7d')][_0x283f('0x7e')]})[_0x283f('0x24')](function(_0x18b290){if(_0x18b290[_0x283f('0x3c')]===0x1){return _0x3743c9['id'];}else{var _0x31c62c=_[_0x283f('0x7f')](_['map'](_0x18b290,_0x283f('0x80')),function(_0x4f48de){return _[_0x283f('0x81')](_0x3ad61a,_0x4f48de);});if(_0x31c62c){return _0x3743c9['id'];}}}));}}return BPromise[_0x283f('0x82')](_0x16226f)[_0x283f('0x24')](function(_0x5d1bf8){_0x22fe1b=_(_0x22fe1b)[_0x283f('0x83')](_0x5d1bf8)[_0x283f('0x84')]()[_0x283f('0x85')]();return db[_0x283f('0x30')]['find']({'where':{'id':_0x2637c6['params']['id']}})['then'](function(_0x53aa7d){return db[_0x283f('0x6b')]['transaction'](function(_0x4d73d6){return _0x53aa7d[_0x283f('0x86')](_0x2637c6['query'][_0x283f('0x73')],{'transaction':_0x4d73d6})['then'](function(){if(!_[_0x283f('0x87')](_0x22fe1b)){return _0x53aa7d[_0x283f('0x88')](_0x22fe1b,{'transaction':_0x4d73d6});}})[_0x283f('0x24')](function(){_0x22fe1b[_0x283f('0x6f')](function(_0x408225){socket[_0x283f('0x70')](_0x283f('0x89'),{'UserId':_0x408225,'OpenchannelQueueId':_0x53aa7d['id']});});});});});});})[_0x283f('0x24')](respondWithStatusCode(_0x18ad13,null))[_0x283f('0x48')](handleError(_0x18ad13,null));};exports[_0x283f('0x8a')]=function(_0x1a243e,_0x57662c,_0x5a1629){return db[_0x283f('0x30')][_0x283f('0x52')]({'where':{'id':_0x1a243e[_0x283f('0x4a')]['id']}})[_0x283f('0x24')](handleEntityNotFound(_0x57662c,null))[_0x283f('0x24')](function(_0x2a37b1){if(_0x2a37b1){return _0x2a37b1[_0x283f('0x8a')](_0x1a243e[_0x283f('0x4c')][_0x283f('0x73')],_[_0x283f('0x8b')](_0x1a243e['body'],['ids','id'])||{})[_0x283f('0x8c')](function(_0xa297c){for(var _0x861604=0x0;_0x861604<_0x1a243e[_0x283f('0x4c')][_0x283f('0x73')][_0x283f('0x3c')];_0x861604+=0x1){socket[_0x283f('0x70')](_0x283f('0x71'),{'UserId':_0x1a243e[_0x283f('0x4c')][_0x283f('0x73')][_0x861604],'OpenchannelQueueId':_0x1a243e['params']['id']});}return _0xa297c;});}})['then'](respondWithResult(_0x57662c,null))[_0x283f('0x48')](handleError(_0x57662c,null));};exports[_0x283f('0x88')]=function(_0x40536b,_0x13853b,_0x5e225f){return db[_0x283f('0x30')][_0x283f('0x52')]({'where':{'id':_0x40536b[_0x283f('0x4a')]['id']}})[_0x283f('0x24')](handleEntityNotFound(_0x13853b,null))[_0x283f('0x24')](function(_0x1b85a3){if(_0x1b85a3){return _0x1b85a3[_0x283f('0x88')](_0x40536b[_0x283f('0x36')][_0x283f('0x73')])[_0x283f('0x24')](function(){if(_[_0x283f('0x8d')](_0x40536b['query'][_0x283f('0x73')])){for(var _0xcac800=0x0;_0xcac800<_0x40536b['query'][_0x283f('0x73')]['length'];_0xcac800+=0x1){socket[_0x283f('0x70')](_0x283f('0x89'),{'UserId':Number(_0x40536b[_0x283f('0x36')]['ids'][_0xcac800]),'OpenchannelQueueId':Number(_0x40536b[_0x283f('0x4a')]['id'])});}}else{socket[_0x283f('0x70')](_0x283f('0x89'),{'UserId':Number(_0x40536b[_0x283f('0x36')]['ids']),'OpenchannelQueueId':Number(_0x40536b[_0x283f('0x4a')]['id'])});}});}})[_0x283f('0x24')](respondWithStatusCode(_0x13853b,null))[_0x283f('0x48')](handleError(_0x13853b,null));};exports[_0x283f('0x8e')]=function(_0x2dc842,_0x1f4545,_0x160cdd){var _0x20a426={};var _0x38d810={};var _0x62ec77;var _0x2ea47b;return db[_0x283f('0x30')][_0x283f('0x57')]({'where':{'id':_0x2dc842[_0x283f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1f4545,null))[_0x283f('0x24')](function(_0x285faa){if(_0x285faa){_0x62ec77=_0x285faa;_0x38d810[_0x283f('0x35')]=_[_0x283f('0x37')](db[_0x283f('0x5b')][_0x283f('0x31')]);_0x38d810[_0x283f('0x36')]=_[_0x283f('0x37')](_0x2dc842[_0x283f('0x36')]);_0x38d810[_0x283f('0x38')]=_[_0x283f('0x39')](_0x38d810[_0x283f('0x35')],_0x38d810['query']);_0x20a426[_0x283f('0x3a')]=_[_0x283f('0x39')](_0x38d810[_0x283f('0x35')],qs[_0x283f('0x3b')](_0x2dc842[_0x283f('0x36')]['fields']));_0x20a426[_0x283f('0x3a')]=_0x20a426['attributes']['length']?_0x20a426['attributes']:_0x38d810[_0x283f('0x35')];_0x20a426[_0x283f('0x3e')]=qs[_0x283f('0x3f')](_0x2dc842['query'][_0x283f('0x3f')]);_0x20a426['where']=qs['filters'](_['pick'](_0x2dc842['query'],_0x38d810[_0x283f('0x38')]));if(_0x2dc842[_0x283f('0x36')][_0x283f('0x41')]){_0x20a426[_0x283f('0x40')]=_['merge'](_0x20a426[_0x283f('0x40')],{'$or':_['map'](_0x20a426[_0x283f('0x3a')],function(_0x52da7c){var _0x28e338={};_0x28e338[_0x52da7c]={'$like':'%'+_0x2dc842[_0x283f('0x36')][_0x283f('0x41')]+'%'};return _0x28e338;})});}_0x20a426=_['merge']({},_0x20a426,_0x2dc842[_0x283f('0x44')]);return _0x62ec77['getAgents'](_0x20a426);}})[_0x283f('0x24')](function(_0x3bf950){if(_0x3bf950){_0x2ea47b=_0x3bf950[_0x283f('0x3c')];if(!_0x2dc842['query'][_0x283f('0x3d')](_0x283f('0x59'))){_0x20a426[_0x283f('0x1e')]=qs[_0x283f('0x1e')](_0x2dc842[_0x283f('0x36')][_0x283f('0x1e')]);_0x20a426[_0x283f('0x1d')]=qs[_0x283f('0x1d')](_0x2dc842['query']['offset']);}return _0x62ec77[_0x283f('0x8e')](_0x20a426);}})[_0x283f('0x24')](function(_0x1d37b){if(_0x1d37b){return _0x1d37b?{'count':_0x2ea47b,'rows':_0x1d37b}:null;}})[_0x283f('0x24')](respondWithResult(_0x1f4545,null))[_0x283f('0x48')](handleError(_0x1f4545,null));}; \ No newline at end of file +var _0x9f04=['key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','OpenchannelQueue','count','include','findAll','rows','catch','show','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','OpenchannelQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','params','UserOpenchannelQueue','hasOwnProperty','order','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','transaction','addTeams','each','forEach','emit','userOpenchannelQueue:save','removeTeams','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','includes','all','union','compact','value','isEmpty','addAgents','omit','removeAgents','isArray','userOpenchannelQueue:remove','getAgents','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','offset','limit','set','apply','reject','save','update','then','get','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName'];(function(_0x20fceb,_0x5811fa){var _0x2a28fe=function(_0x28189e){while(--_0x28189e){_0x20fceb['push'](_0x20fceb['shift']());}};_0x2a28fe(++_0x5811fa);}(_0x9f04,0x178));var _0x49f0=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x9f04[_0x710815];return _0x5b3b89;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x49f0('0x0'));var zipdir=require(_0x49f0('0x1'));var jsonpatch=require(_0x49f0('0x2'));var rp=require(_0x49f0('0x3'));var moment=require(_0x49f0('0x4'));var BPromise=require(_0x49f0('0x5'));var Mustache=require(_0x49f0('0x6'));var util=require(_0x49f0('0x7'));var path=require(_0x49f0('0x8'));var sox=require(_0x49f0('0x9'));var csv=require(_0x49f0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x49f0('0xb'));var _=require(_0x49f0('0xc'));var squel=require(_0x49f0('0xd'));var crypto=require(_0x49f0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x49f0('0xf'));var toCsv=require('to-csv');var querystring=require(_0x49f0('0x10'));var Papa=require(_0x49f0('0x11'));var Redis=require(_0x49f0('0x12'));var authService=require(_0x49f0('0x13'));var qs=require(_0x49f0('0x14'));var as=require(_0x49f0('0x15'));var hardwareService=require(_0x49f0('0x16'));var logger=require(_0x49f0('0x17'))(_0x49f0('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49f0('0x19'));var db=require(_0x49f0('0x1a'))['db'];config[_0x49f0('0x1b')]=_[_0x49f0('0x1c')](config['redis'],{'host':_0x49f0('0x1d'),'port':0x18eb});var socket=require(_0x49f0('0x1e'))(new Redis(config[_0x49f0('0x1b')]));require(_0x49f0('0x1f'))[_0x49f0('0x20')](socket);function respondWithStatusCode(_0x36f220,_0x27b9fa){_0x27b9fa=_0x27b9fa||0xcc;return function(_0x5c5432){if(_0x5c5432){return _0x36f220[_0x49f0('0x21')](_0x27b9fa);}return _0x36f220[_0x49f0('0x22')](_0x27b9fa)[_0x49f0('0x23')]();};}function respondWithResult(_0x23f71c,_0x234e8e){_0x234e8e=_0x234e8e||0xc8;return function(_0x244f68){if(_0x244f68){return _0x23f71c[_0x49f0('0x22')](_0x234e8e)['json'](_0x244f68);}};}function respondWithFilteredResult(_0x3705f7,_0x288b70){return function(_0x125104){if(_0x125104){var _0x1ecb54=_0x125104['count'],_0x3c9bae=_0x288b70[_0x49f0('0x24')],_0x20cec0=_0x288b70[_0x49f0('0x24')]+_0x288b70[_0x49f0('0x25')],_0x381bcf;if(_0x20cec0>=_0x1ecb54){_0x20cec0=_0x1ecb54;_0x381bcf=0xc8;}else{_0x381bcf=0xce;}_0x3705f7['status'](_0x381bcf);return _0x3705f7[_0x49f0('0x26')]('Content-Range',_0x3c9bae+'-'+_0x20cec0+'/'+_0x1ecb54)['json'](_0x125104);}return null;};}function patchUpdates(_0x1673c4){return function(_0x1c7ae5){try{jsonpatch[_0x49f0('0x27')](_0x1c7ae5,_0x1673c4,!![]);}catch(_0x4058d8){return BPromise[_0x49f0('0x28')](_0x4058d8);}return _0x1c7ae5[_0x49f0('0x29')]();};}function saveUpdates(_0x493471,_0x5020ea){return function(_0x12faa1){if(_0x12faa1){return _0x12faa1[_0x49f0('0x2a')](_0x493471)[_0x49f0('0x2b')](function(_0x10ce7b){return _0x10ce7b;});}return null;};}function removeEntity(_0x40fa4f,_0x402f40){return function(_0x388d2e){if(_0x388d2e){return _0x388d2e['destroy']()[_0x49f0('0x2b')](function(){var _0x23c32b=_0x388d2e[_0x49f0('0x2c')]({'plain':!![]});var _0x1999f5='OpenchannelQueues';return db[_0x49f0('0x2d')]['destroy']({'where':{'type':_0x1999f5,'resourceId':_0x23c32b['id']}})[_0x49f0('0x2b')](function(){return _0x388d2e;});})['then'](function(){_0x40fa4f[_0x49f0('0x22')](0xcc)[_0x49f0('0x23')]();});}};}function handleEntityNotFound(_0x52ec0c,_0x5220c6){return function(_0x4dc9a9){if(!_0x4dc9a9){_0x52ec0c[_0x49f0('0x21')](0x194);}return _0x4dc9a9;};}function handleError(_0x136910,_0x255b08){_0x255b08=_0x255b08||0x1f4;return function(_0x27dcf6){logger[_0x49f0('0x2e')](_0x27dcf6['stack']);if(_0x27dcf6[_0x49f0('0x2f')]){delete _0x27dcf6['name'];}_0x136910['status'](_0x255b08)[_0x49f0('0x30')](_0x27dcf6);};}exports[_0x49f0('0x31')]=function(_0x7f368a,_0x2e2b3a){var _0x535a20={},_0x3a77fc={},_0x22e316={'count':0x0,'rows':[]};var _0x10e6e2=_[_0x49f0('0x32')](db['OpenchannelQueue'][_0x49f0('0x33')],function(_0x42c53a){return{'name':_0x42c53a[_0x49f0('0x34')],'type':_0x42c53a['type'][_0x49f0('0x35')]};});_0x3a77fc['model']=_[_0x49f0('0x32')](_0x10e6e2,_0x49f0('0x2f'));_0x3a77fc[_0x49f0('0x36')]=_[_0x49f0('0x37')](_0x7f368a[_0x49f0('0x36')]);_0x3a77fc['filters']=_[_0x49f0('0x38')](_0x3a77fc[_0x49f0('0x39')],_0x3a77fc['query']);_0x535a20[_0x49f0('0x3a')]=_[_0x49f0('0x38')](_0x3a77fc['model'],qs[_0x49f0('0x3b')](_0x7f368a[_0x49f0('0x36')][_0x49f0('0x3b')]));_0x535a20[_0x49f0('0x3a')]=_0x535a20[_0x49f0('0x3a')][_0x49f0('0x3c')]?_0x535a20[_0x49f0('0x3a')]:_0x3a77fc[_0x49f0('0x39')];if(!_0x7f368a[_0x49f0('0x36')]['hasOwnProperty'](_0x49f0('0x3d'))){_0x535a20[_0x49f0('0x25')]=qs[_0x49f0('0x25')](_0x7f368a[_0x49f0('0x36')][_0x49f0('0x25')]);_0x535a20[_0x49f0('0x24')]=qs['offset'](_0x7f368a[_0x49f0('0x36')][_0x49f0('0x24')]);}_0x535a20['order']=qs['sort'](_0x7f368a[_0x49f0('0x36')][_0x49f0('0x3e')]);_0x535a20[_0x49f0('0x3f')]=qs[_0x49f0('0x40')](_[_0x49f0('0x41')](_0x7f368a[_0x49f0('0x36')],_0x3a77fc[_0x49f0('0x40')]),_0x10e6e2);if(_0x7f368a['query'][_0x49f0('0x42')]){_0x535a20[_0x49f0('0x3f')]=_[_0x49f0('0x43')](_0x535a20[_0x49f0('0x3f')],{'$or':_[_0x49f0('0x32')](_0x10e6e2,function(_0x489418){if(_0x489418['type']!=='VIRTUAL'){var _0x585ce1={};_0x585ce1[_0x489418[_0x49f0('0x2f')]]={'$like':'%'+_0x7f368a[_0x49f0('0x36')][_0x49f0('0x42')]+'%'};return _0x585ce1;}})});}_0x535a20=_['merge']({},_0x535a20,_0x7f368a['options']);var _0x2e79b3={'where':_0x535a20[_0x49f0('0x3f')]};return db[_0x49f0('0x44')][_0x49f0('0x45')](_0x2e79b3)[_0x49f0('0x2b')](function(_0x47098a){_0x22e316[_0x49f0('0x45')]=_0x47098a;if(_0x7f368a['query']['includeAll']){_0x535a20[_0x49f0('0x46')]=[{'all':!![]}];}return db[_0x49f0('0x44')][_0x49f0('0x47')](_0x535a20);})[_0x49f0('0x2b')](function(_0x25fe88){_0x22e316[_0x49f0('0x48')]=_0x25fe88;return _0x22e316;})['then'](respondWithFilteredResult(_0x2e2b3a,_0x535a20))[_0x49f0('0x49')](handleError(_0x2e2b3a,null));};exports[_0x49f0('0x4a')]=function(_0x2d8d05,_0x1cc373){var _0x15114a={'raw':!![],'where':{'id':_0x2d8d05['params']['id']}},_0x1f3a24={};_0x1f3a24[_0x49f0('0x39')]=_['keys'](db[_0x49f0('0x44')]['rawAttributes']);_0x1f3a24['query']=_[_0x49f0('0x37')](_0x2d8d05[_0x49f0('0x36')]);_0x1f3a24[_0x49f0('0x40')]=_['intersection'](_0x1f3a24[_0x49f0('0x39')],_0x1f3a24['query']);_0x15114a[_0x49f0('0x3a')]=_[_0x49f0('0x38')](_0x1f3a24[_0x49f0('0x39')],qs['fields'](_0x2d8d05['query'][_0x49f0('0x3b')]));_0x15114a[_0x49f0('0x3a')]=_0x15114a['attributes'][_0x49f0('0x3c')]?_0x15114a['attributes']:_0x1f3a24[_0x49f0('0x39')];if(_0x2d8d05[_0x49f0('0x36')]['includeAll']){_0x15114a['include']=[{'all':!![]}];}_0x15114a=_['merge']({},_0x15114a,_0x2d8d05[_0x49f0('0x4b')]);return db[_0x49f0('0x44')][_0x49f0('0x4c')](_0x15114a)['then'](handleEntityNotFound(_0x1cc373,null))[_0x49f0('0x2b')](respondWithResult(_0x1cc373,null))[_0x49f0('0x49')](handleError(_0x1cc373,null));};exports[_0x49f0('0x4d')]=function(_0x59b2de,_0xe0220b){return db['OpenchannelQueue'][_0x49f0('0x4d')](_0x59b2de[_0x49f0('0x4e')],{})[_0x49f0('0x2b')](function(_0x222708){var _0x16f830=_0x59b2de['user']['get']({'plain':!![]});if(!_0x16f830)throw new Error(_0x49f0('0x4f'));if(_0x16f830['role']===_0x49f0('0x50')){var _0x28188c=_0x222708[_0x49f0('0x2c')]({'plain':!![]});var _0x22ffd7=_0x49f0('0x51');return db[_0x49f0('0x52')][_0x49f0('0x4c')]({'where':{'name':_0x22ffd7,'userProfileId':_0x16f830[_0x49f0('0x53')]},'raw':!![]})[_0x49f0('0x2b')](function(_0xf8bb4b){if(_0xf8bb4b&&_0xf8bb4b['autoAssociation']===0x0){return db[_0x49f0('0x2d')][_0x49f0('0x4d')]({'name':_0x28188c['name'],'resourceId':_0x28188c['id'],'type':_0xf8bb4b[_0x49f0('0x2f')],'sectionId':_0xf8bb4b['id']},{})['then'](function(){return _0x222708;});}else{return _0x222708;}})['catch'](function(_0x86558a){logger['error'](_0x49f0('0x54'),_0x86558a);throw _0x86558a;});}return _0x222708;})['then'](respondWithResult(_0xe0220b,0xc9))[_0x49f0('0x49')](handleError(_0xe0220b,null));};exports[_0x49f0('0x2a')]=function(_0x150d49,_0x2c4a30){if(_0x150d49['body']['id']){delete _0x150d49[_0x49f0('0x4e')]['id'];}return db['OpenchannelQueue'][_0x49f0('0x4c')]({'where':{'id':_0x150d49['params']['id']}})[_0x49f0('0x2b')](handleEntityNotFound(_0x2c4a30,null))['then'](saveUpdates(_0x150d49[_0x49f0('0x4e')],null))[_0x49f0('0x2b')](respondWithResult(_0x2c4a30,null))[_0x49f0('0x49')](handleError(_0x2c4a30,null));};exports[_0x49f0('0x55')]=function(_0x5df9d3,_0x8eb11a){return db[_0x49f0('0x44')][_0x49f0('0x4c')]({'where':{'id':_0x5df9d3['params']['id']}})[_0x49f0('0x2b')](handleEntityNotFound(_0x8eb11a,null))[_0x49f0('0x2b')](removeEntity(_0x8eb11a,null))['catch'](handleError(_0x8eb11a,null));};exports[_0x49f0('0x56')]=function(_0x3f1d42,_0x5c55d9){return db[_0x49f0('0x44')][_0x49f0('0x56')]()['then'](respondWithResult(_0x5c55d9,null))[_0x49f0('0x49')](handleError(_0x5c55d9,null));};exports[_0x49f0('0x57')]=function(_0x95073e,_0x2ead6b,_0x59c0f4){var _0xe8a941={'raw':!![],'where':{}},_0x2aaf49={},_0x49673a;return db[_0x49f0('0x44')]['findOne']({'where':{'id':_0x95073e[_0x49f0('0x58')]['id']}})[_0x49f0('0x2b')](handleEntityNotFound(_0x2ead6b,null))[_0x49f0('0x2b')](function(_0x5a7d69){if(_0x5a7d69){_0x49673a=_0x5a7d69[_0x49f0('0x2c')]({'plain':!![]});_0x2aaf49[_0x49f0('0x39')]=_['keys'](db[_0x49f0('0x59')][_0x49f0('0x33')]);_0x2aaf49['query']=_[_0x49f0('0x37')](_0x95073e[_0x49f0('0x36')]);_0x2aaf49[_0x49f0('0x40')]=_['intersection'](_0x2aaf49[_0x49f0('0x39')],_0x2aaf49[_0x49f0('0x36')]);_0xe8a941[_0x49f0('0x3a')]=_['intersection'](_0x2aaf49[_0x49f0('0x39')],qs[_0x49f0('0x3b')](_0x95073e[_0x49f0('0x36')][_0x49f0('0x3b')]));_0xe8a941[_0x49f0('0x3a')]=_0xe8a941[_0x49f0('0x3a')]['length']?_0xe8a941['attributes']:_0x2aaf49[_0x49f0('0x39')];if(!_0x95073e['query'][_0x49f0('0x5a')](_0x49f0('0x3d'))){_0xe8a941[_0x49f0('0x25')]=qs[_0x49f0('0x25')](_0x95073e['query'][_0x49f0('0x25')]);_0xe8a941[_0x49f0('0x24')]=qs[_0x49f0('0x24')](_0x95073e[_0x49f0('0x36')][_0x49f0('0x24')]);}_0xe8a941[_0x49f0('0x5b')]=qs['sort'](_0x95073e[_0x49f0('0x36')][_0x49f0('0x3e')]);_0xe8a941[_0x49f0('0x3f')]=qs['filters'](_[_0x49f0('0x41')](_0x95073e[_0x49f0('0x36')],_0x2aaf49[_0x49f0('0x40')]));_0xe8a941[_0x49f0('0x3f')][_0x49f0('0x5c')]=_0x5a7d69['id'];if(_0x95073e[_0x49f0('0x36')]['filter']){_0xe8a941['where']=_[_0x49f0('0x43')](_0xe8a941['where'],{'$or':_[_0x49f0('0x32')](_0xe8a941[_0x49f0('0x3a')],function(_0x153d9c){var _0x5b0604={};_0x5b0604[_0x153d9c]={'$like':'%'+_0x95073e[_0x49f0('0x36')][_0x49f0('0x42')]+'%'};return _0x5b0604;})});}_0xe8a941=_['merge']({},_0xe8a941,_0x95073e['options']);return db[_0x49f0('0x59')][_0x49f0('0x47')](_0xe8a941);}})[_0x49f0('0x2b')](function(_0x145b17){if(_0x145b17){return db[_0x49f0('0x5d')][_0x49f0('0x5e')]({'where':{'id':_[_0x49f0('0x32')](_0x145b17,_0x49f0('0x5f')),'role':_0x49f0('0x60')},'attributes':['id',_0x49f0('0x2f'),_0x49f0('0x61'),_0x49f0('0x62'),_0x49f0('0x63')]});}})['then'](function(_0x420c8e){if(_0x420c8e){return{'count':_0x420c8e[_0x49f0('0x45')],'rows':_[_0x49f0('0x32')](_0x420c8e[_0x49f0('0x48')],function(_0x120e85){return{'membername':_0x120e85['name'],'UserId':_0x120e85['id'],'queue_name':_0x49673a[_0x49f0('0x2f')],'OpenchannelQueueId':_0x49673a['id'],'interface':util['format'](_0x49f0('0x64'),_0x49f0('0x65'),_0x120e85[_0x49f0('0x2f')]),'penalty':0x0,'paused':_0x120e85[_0x49f0('0x61')],'createdAt':_0x120e85['createdAt'],'updatedAt':_0x120e85[_0x49f0('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2ead6b,_0xe8a941))[_0x49f0('0x49')](handleError(_0x2ead6b,null));};exports[_0x49f0('0x66')]=function(_0xa53f9a,_0x2da6a9,_0x3a1416){var _0x23ad2d={};var _0x32b2dd={};var _0x5bbd6a;var _0x20c1a7;return db['OpenchannelQueue']['findOne']({'where':{'id':_0xa53f9a[_0x49f0('0x58')]['id']}})[_0x49f0('0x2b')](handleEntityNotFound(_0x2da6a9,null))[_0x49f0('0x2b')](function(_0x3b241c){if(_0x3b241c){_0x5bbd6a=_0x3b241c;_0x32b2dd[_0x49f0('0x39')]=_[_0x49f0('0x37')](db[_0x49f0('0x67')]['rawAttributes']);_0x32b2dd[_0x49f0('0x36')]=_[_0x49f0('0x37')](_0xa53f9a[_0x49f0('0x36')]);_0x32b2dd[_0x49f0('0x40')]=_[_0x49f0('0x38')](_0x32b2dd[_0x49f0('0x39')],_0x32b2dd[_0x49f0('0x36')]);_0x23ad2d['attributes']=_[_0x49f0('0x38')](_0x32b2dd[_0x49f0('0x39')],qs['fields'](_0xa53f9a['query']['fields']));_0x23ad2d[_0x49f0('0x3a')]=_0x23ad2d['attributes'][_0x49f0('0x3c')]?_0x23ad2d[_0x49f0('0x3a')]:_0x32b2dd[_0x49f0('0x39')];_0x23ad2d[_0x49f0('0x5b')]=qs[_0x49f0('0x3e')](_0xa53f9a[_0x49f0('0x36')][_0x49f0('0x3e')]);_0x23ad2d[_0x49f0('0x3f')]=qs[_0x49f0('0x40')](_[_0x49f0('0x41')](_0xa53f9a[_0x49f0('0x36')],_0x32b2dd['filters']));if(_0xa53f9a[_0x49f0('0x36')]['filter']){_0x23ad2d['where']=_['merge'](_0x23ad2d['where'],{'$or':_[_0x49f0('0x32')](_0x23ad2d['attributes'],function(_0x238846){var _0x3c6847={};_0x3c6847[_0x238846]={'$like':'%'+_0xa53f9a[_0x49f0('0x36')][_0x49f0('0x42')]+'%'};return _0x3c6847;})});}_0x23ad2d=_[_0x49f0('0x43')]({},_0x23ad2d,_0xa53f9a[_0x49f0('0x4b')]);return _0x5bbd6a[_0x49f0('0x66')](_0x23ad2d);}})['then'](function(_0x2f520b){if(_0x2f520b){_0x20c1a7=_0x2f520b[_0x49f0('0x3c')];if(!_0xa53f9a[_0x49f0('0x36')][_0x49f0('0x5a')](_0x49f0('0x3d'))){_0x23ad2d[_0x49f0('0x25')]=qs[_0x49f0('0x25')](_0xa53f9a[_0x49f0('0x36')][_0x49f0('0x25')]);_0x23ad2d[_0x49f0('0x24')]=qs[_0x49f0('0x24')](_0xa53f9a[_0x49f0('0x36')][_0x49f0('0x24')]);}return _0x5bbd6a[_0x49f0('0x66')](_0x23ad2d);}})['then'](function(_0x531939){if(_0x531939){return _0x531939?{'count':_0x20c1a7,'rows':_0x531939}:null;}})[_0x49f0('0x2b')](respondWithResult(_0x2da6a9,null))['catch'](handleError(_0x2da6a9,null));};exports['addTeams']=function(_0x55c9db,_0x381533,_0x1c2a75){var _0x4dcf48=_0x55c9db[_0x49f0('0x4e')][_0x49f0('0x68')];return db[_0x49f0('0x67')][_0x49f0('0x47')]({'where':{'id':_0x4dcf48},'attributes':['id'],'include':[{'model':db[_0x49f0('0x5d')],'as':_0x49f0('0x69'),'attributes':['id',_0x49f0('0x2f'),_0x49f0('0x6a'),_0x49f0('0x6b'),_0x49f0('0x6c')],'raw':!![]}]})[_0x49f0('0x2b')](function(_0x182719){if(_0x182719){var _0x7ca511=_[_0x49f0('0x6d')](_0x182719,function(_0x45be3b){var _0x5d503f=_0x45be3b[_0x49f0('0x2c')]({'plain':!![]});return _0x5d503f['Agents'];});return db[_0x49f0('0x44')][_0x49f0('0x4c')]({'where':{'id':_0x55c9db[_0x49f0('0x58')]['id']}})['then'](function(_0x262078){return db['sequelize'][_0x49f0('0x6e')](function(_0x6e2518){return _0x262078[_0x49f0('0x6f')](_0x4dcf48,{'transaction':_0x6e2518})[_0x49f0('0x2b')](function(){return BPromise[_0x49f0('0x70')](_0x7ca511,function(_0x8ba572){return db[_0x49f0('0x59')]['findOrCreate']({'where':{'UserId':_0x8ba572['id'],'OpenchannelQueueId':_0x55c9db[_0x49f0('0x58')]['id']},'transaction':_0x6e2518});});})[_0x49f0('0x2b')](function(){_0x7ca511[_0x49f0('0x71')](function(_0x1b607b){socket[_0x49f0('0x72')](_0x49f0('0x73'),{'UserId':_0x1b607b['id'],'OpenchannelQueueId':_0x262078['id']});});});});});}})[_0x49f0('0x2b')](respondWithStatusCode(_0x381533,null))[_0x49f0('0x49')](handleError(_0x381533,null));};exports[_0x49f0('0x74')]=function(_0x125b3e,_0x5daf56,_0x45e7d6){return db['Team'][_0x49f0('0x47')]({'where':{'id':_0x125b3e[_0x49f0('0x36')][_0x49f0('0x68')]},'attributes':['id'],'include':[{'model':db[_0x49f0('0x5d')],'as':_0x49f0('0x69'),'attributes':['id'],'raw':!![]}]})[_0x49f0('0x2b')](handleEntityNotFound(_0x5daf56,null))[_0x49f0('0x2b')](function(_0x5bb584){var _0x210df1=_['map'](_0x5bb584,'id');var _0x540a71=[];var _0x1e78fd=[];var _0x42b8aa=squel['select']();_0x42b8aa[_0x49f0('0x75')](_0x49f0('0x76'))[_0x49f0('0x77')](_0x49f0('0x78'),'tq')[_0x49f0('0x79')](_0x49f0('0x7a'),'ut',_0x49f0('0x7b'))['where'](_0x49f0('0x7c'),_0x125b3e[_0x49f0('0x58')]['id']);for(var _0x406a6d=0x0;_0x406a6d<_0x5bb584['length'];_0x406a6d+=0x1){let _0x1bb735=_0x5bb584[_0x406a6d];for(var _0xb7651c=0x0;_0xb7651c<_0x1bb735['Agents'][_0x49f0('0x3c')];_0xb7651c+=0x1){let _0x1ad50e=_0x1bb735[_0x49f0('0x69')][_0xb7651c];var _0x38cd02=_0x42b8aa[_0x49f0('0x7d')]();_0x38cd02[_0x49f0('0x3f')](_0x49f0('0x7e'),_0x1ad50e['id']);_0x1e78fd['push'](db[_0x49f0('0x7f')][_0x49f0('0x36')](_0x38cd02[_0x49f0('0x80')](),{'type':db[_0x49f0('0x7f')][_0x49f0('0x81')]['SELECT']})[_0x49f0('0x2b')](function(_0x590a33){if(_0x590a33[_0x49f0('0x3c')]===0x1){return _0x1ad50e['id'];}else{var _0x51f391=_['every'](_[_0x49f0('0x32')](_0x590a33,'TeamId'),function(_0x461d43){return _[_0x49f0('0x82')](_0x210df1,_0x461d43);});if(_0x51f391){return _0x1ad50e['id'];}}}));}}return BPromise[_0x49f0('0x83')](_0x1e78fd)['then'](function(_0x1ea680){_0x540a71=_(_0x540a71)[_0x49f0('0x84')](_0x1ea680)[_0x49f0('0x85')]()[_0x49f0('0x86')]();return db[_0x49f0('0x44')][_0x49f0('0x4c')]({'where':{'id':_0x125b3e[_0x49f0('0x58')]['id']}})[_0x49f0('0x2b')](function(_0x532264){return db[_0x49f0('0x7f')][_0x49f0('0x6e')](function(_0x3a0937){return _0x532264[_0x49f0('0x74')](_0x125b3e[_0x49f0('0x36')]['ids'],{'transaction':_0x3a0937})[_0x49f0('0x2b')](function(){if(!_[_0x49f0('0x87')](_0x540a71)){return _0x532264['removeAgents'](_0x540a71,{'transaction':_0x3a0937});}})[_0x49f0('0x2b')](function(){_0x540a71[_0x49f0('0x71')](function(_0x49361b){socket[_0x49f0('0x72')]('userOpenchannelQueue:remove',{'UserId':_0x49361b,'OpenchannelQueueId':_0x532264['id']});});});});});});})[_0x49f0('0x2b')](respondWithStatusCode(_0x5daf56,null))[_0x49f0('0x49')](handleError(_0x5daf56,null));};exports[_0x49f0('0x88')]=function(_0x1dcfea,_0x3c2e29,_0x15396b){return db['OpenchannelQueue']['find']({'where':{'id':_0x1dcfea[_0x49f0('0x58')]['id']}})[_0x49f0('0x2b')](handleEntityNotFound(_0x3c2e29,null))[_0x49f0('0x2b')](function(_0x5c9cb8){if(_0x5c9cb8){return _0x5c9cb8[_0x49f0('0x88')](_0x1dcfea[_0x49f0('0x4e')]['ids'],_[_0x49f0('0x89')](_0x1dcfea['body'],['ids','id'])||{})['spread'](function(_0x570843){for(var _0x2487c9=0x0;_0x2487c9<_0x1dcfea[_0x49f0('0x4e')][_0x49f0('0x68')][_0x49f0('0x3c')];_0x2487c9+=0x1){socket[_0x49f0('0x72')](_0x49f0('0x73'),{'UserId':_0x1dcfea[_0x49f0('0x4e')][_0x49f0('0x68')][_0x2487c9],'OpenchannelQueueId':_0x1dcfea[_0x49f0('0x58')]['id']});}return _0x570843;});}})[_0x49f0('0x2b')](respondWithResult(_0x3c2e29,null))[_0x49f0('0x49')](handleError(_0x3c2e29,null));};exports[_0x49f0('0x8a')]=function(_0x521550,_0x1a3ff4,_0x3aaecb){return db['OpenchannelQueue'][_0x49f0('0x4c')]({'where':{'id':_0x521550[_0x49f0('0x58')]['id']}})[_0x49f0('0x2b')](handleEntityNotFound(_0x1a3ff4,null))[_0x49f0('0x2b')](function(_0x253dc8){if(_0x253dc8){return _0x253dc8[_0x49f0('0x8a')](_0x521550[_0x49f0('0x36')]['ids'])[_0x49f0('0x2b')](function(){if(_[_0x49f0('0x8b')](_0x521550[_0x49f0('0x36')][_0x49f0('0x68')])){for(var _0x4fb598=0x0;_0x4fb598<_0x521550[_0x49f0('0x36')][_0x49f0('0x68')][_0x49f0('0x3c')];_0x4fb598+=0x1){socket['emit'](_0x49f0('0x8c'),{'UserId':Number(_0x521550[_0x49f0('0x36')]['ids'][_0x4fb598]),'OpenchannelQueueId':Number(_0x521550['params']['id'])});}}else{socket['emit'](_0x49f0('0x8c'),{'UserId':Number(_0x521550[_0x49f0('0x36')]['ids']),'OpenchannelQueueId':Number(_0x521550[_0x49f0('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x1a3ff4,null))[_0x49f0('0x49')](handleError(_0x1a3ff4,null));};exports[_0x49f0('0x8d')]=function(_0x165564,_0x65a17c,_0x3f9df6){var _0x2acc42={};var _0x3f4e25={};var _0x546bfb;var _0x2c8b27;return db[_0x49f0('0x44')][_0x49f0('0x8e')]({'where':{'id':_0x165564[_0x49f0('0x58')]['id']}})[_0x49f0('0x2b')](handleEntityNotFound(_0x65a17c,null))[_0x49f0('0x2b')](function(_0x62c976){if(_0x62c976){_0x546bfb=_0x62c976;_0x3f4e25[_0x49f0('0x39')]=_['keys'](db[_0x49f0('0x5d')][_0x49f0('0x33')]);_0x3f4e25[_0x49f0('0x36')]=_[_0x49f0('0x37')](_0x165564[_0x49f0('0x36')]);_0x3f4e25[_0x49f0('0x40')]=_[_0x49f0('0x38')](_0x3f4e25[_0x49f0('0x39')],_0x3f4e25[_0x49f0('0x36')]);_0x2acc42[_0x49f0('0x3a')]=_['intersection'](_0x3f4e25['model'],qs['fields'](_0x165564['query'][_0x49f0('0x3b')]));_0x2acc42[_0x49f0('0x3a')]=_0x2acc42['attributes'][_0x49f0('0x3c')]?_0x2acc42['attributes']:_0x3f4e25[_0x49f0('0x39')];_0x2acc42[_0x49f0('0x5b')]=qs[_0x49f0('0x3e')](_0x165564[_0x49f0('0x36')][_0x49f0('0x3e')]);_0x2acc42[_0x49f0('0x3f')]=qs['filters'](_[_0x49f0('0x41')](_0x165564[_0x49f0('0x36')],_0x3f4e25[_0x49f0('0x40')]));if(_0x165564[_0x49f0('0x36')][_0x49f0('0x42')]){_0x2acc42[_0x49f0('0x3f')]=_[_0x49f0('0x43')](_0x2acc42[_0x49f0('0x3f')],{'$or':_[_0x49f0('0x32')](_0x2acc42[_0x49f0('0x3a')],function(_0x4de1cc){var _0x4fca2e={};_0x4fca2e[_0x4de1cc]={'$like':'%'+_0x165564[_0x49f0('0x36')][_0x49f0('0x42')]+'%'};return _0x4fca2e;})});}_0x2acc42=_[_0x49f0('0x43')]({},_0x2acc42,_0x165564['options']);return _0x546bfb[_0x49f0('0x8d')](_0x2acc42);}})[_0x49f0('0x2b')](function(_0x51328e){if(_0x51328e){_0x2c8b27=_0x51328e[_0x49f0('0x3c')];if(!_0x165564[_0x49f0('0x36')][_0x49f0('0x5a')](_0x49f0('0x3d'))){_0x2acc42[_0x49f0('0x25')]=qs['limit'](_0x165564[_0x49f0('0x36')][_0x49f0('0x25')]);_0x2acc42['offset']=qs[_0x49f0('0x24')](_0x165564[_0x49f0('0x36')]['offset']);}return _0x546bfb[_0x49f0('0x8d')](_0x2acc42);}})['then'](function(_0x16d88e){if(_0x16d88e){return _0x16d88e?{'count':_0x2c8b27,'rows':_0x16d88e}:null;}})[_0x49f0('0x2b')](respondWithResult(_0x65a17c,null))['catch'](handleError(_0x65a17c,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 217f6e9..c7745fa 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 _0x0613=['hook','events','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x175d8d,_0x508006){var _0x1e723a=function(_0x2219ba){while(--_0x2219ba){_0x175d8d['push'](_0x175d8d['shift']());}};_0x1e723a(++_0x508006);}(_0x0613,0xf4));var _0x3061=function(_0x50068c,_0x38a87a){_0x50068c=_0x50068c-0x0;var _0x11826a=_0x0613[_0x50068c];return _0x11826a;};'use strict';var EventEmitter=require(_0x3061('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x3061('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x3061('0x2')](0x0);var events={'afterCreate':_0x3061('0x3'),'afterUpdate':_0x3061('0x4'),'afterDestroy':_0x3061('0x5')};function emitEvent(_0x3c8a8a){return function(_0x14d3f1,_0x27aea3,_0x32cc01){OpenchannelQueueEvents['emit'](_0x3c8a8a+':'+_0x14d3f1['id'],_0x14d3f1);OpenchannelQueueEvents[_0x3061('0x6')](_0x3c8a8a,_0x14d3f1);_0x32cc01(null);};}for(var e in events){if(events[_0x3061('0x7')](e)){var event=events[e];OpenchannelQueue[_0x3061('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x8e5d=['events','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1eb4db,_0x38edc1){var _0x9e0d45=function(_0x108d29){while(--_0x108d29){_0x1eb4db['push'](_0x1eb4db['shift']());}};_0x9e0d45(++_0x38edc1);}(_0x8e5d,0x1ef));var _0xd8e5=function(_0x2a238a,_0x1d5054){_0x2a238a=_0x2a238a-0x0;var _0xeef802=_0x8e5d[_0x2a238a];return _0xeef802;};'use strict';var EventEmitter=require(_0xd8e5('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xd8e5('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xd8e5('0x2')](0x0);var events={'afterCreate':_0xd8e5('0x3'),'afterUpdate':_0xd8e5('0x4'),'afterDestroy':_0xd8e5('0x5')};function emitEvent(_0x4dc25f){return function(_0x49dbe1,_0x5451f8,_0x5a1f0a){OpenchannelQueueEvents[_0xd8e5('0x6')](_0x4dc25f+':'+_0x49dbe1['id'],_0x49dbe1);OpenchannelQueueEvents[_0xd8e5('0x6')](_0x4dc25f,_0x49dbe1);_0x5a1f0a(null);};}for(var e in events){if(events[_0xd8e5('0x7')](e)){var event=events[e];OpenchannelQueue[_0xd8e5('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 90f3a87..377b88e 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 _0x4522=['path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','../../config/logger','api','moment','request-promise'];(function(_0x50cee2,_0x56709e){var _0x3875c3=function(_0x2812af){while(--_0x2812af){_0x50cee2['push'](_0x50cee2['shift']());}};_0x3875c3(++_0x56709e);}(_0x4522,0x1a0));var _0x2452=function(_0x37df60,_0x4f6e96){_0x37df60=_0x37df60-0x0;var _0x522474=_0x4522[_0x37df60];return _0x522474;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2452('0x0'))(_0x2452('0x1'));var moment=require(_0x2452('0x2'));var BPromise=require('bluebird');var rp=require(_0x2452('0x3'));var fs=require('fs');var path=require(_0x2452('0x4'));var rimraf=require(_0x2452('0x5'));var config=require(_0x2452('0x6'));var attributes=require(_0x2452('0x7'));module[_0x2452('0x8')]=function(_0x15fc69,_0x226578){return _0x15fc69[_0x2452('0x9')](_0x2452('0xa'),attributes,{'tableName':_0x2452('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5c1=['request-promise','path','../../config/environment','./openchannelQueue.attributes','../../config/logger','api','bluebird'];(function(_0x567632,_0x4c4183){var _0x126650=function(_0xc046d1){while(--_0xc046d1){_0x567632['push'](_0x567632['shift']());}};_0x126650(++_0x4c4183);}(_0xd5c1,0xc1));var _0x1d5c=function(_0x36456f,_0xcfa3a7){_0x36456f=_0x36456f-0x0;var _0x20193b=_0xd5c1[_0x36456f];return _0x20193b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1d5c('0x0'))(_0x1d5c('0x1'));var moment=require('moment');var BPromise=require(_0x1d5c('0x2'));var rp=require(_0x1d5c('0x3'));var fs=require('fs');var path=require(_0x1d5c('0x4'));var rimraf=require('rimraf');var config=require(_0x1d5c('0x5'));var attributes=require(_0x1d5c('0x6'));module['exports']=function(_0x1b0b70,_0x527c84){return _0x1b0b70['define']('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index f72b063..777ef3c 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 _0xd01b=['stringify','error','code','message','OpenchannelQueue,\x20%s,\x20%s','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','limit','include','model','attributes','map','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2f2360,_0x151089){var _0x1cc8d3=function(_0x5e356f){while(--_0x5e356f){_0x2f2360['push'](_0x2f2360['shift']());}};_0x1cc8d3(++_0x151089);}(_0xd01b,0x18c));var _0xbd01=function(_0x249bee,_0x30f020){_0x249bee=_0x249bee-0x0;var _0x405711=_0xd01b[_0x249bee];return _0x405711;};'use strict';var _=require(_0xbd01('0x0'));var util=require(_0xbd01('0x1'));var moment=require(_0xbd01('0x2'));var BPromise=require(_0xbd01('0x3'));var rs=require(_0xbd01('0x4'));var fs=require('fs');var Redis=require(_0xbd01('0x5'));var db=require(_0xbd01('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd01('0x7'))(_0xbd01('0x8'));var config=require(_0xbd01('0x9'));var jayson=require(_0xbd01('0xa'));var client=jayson[_0xbd01('0xb')]['http']({'port':0x232a});config[_0xbd01('0xc')]=_[_0xbd01('0xd')](config['redis'],{'host':_0xbd01('0xe'),'port':0x18eb});var socket=require(_0xbd01('0xf'))(new Redis(config['redis']));require(_0xbd01('0x10'))[_0xbd01('0x11')](socket);function respondWithRpcPromise(_0x3e65d0,_0x66d7d3,_0x12689f){return new BPromise(function(_0x170329,_0x24c360){return client[_0xbd01('0x12')](_0x3e65d0,_0x12689f)[_0xbd01('0x13')](function(_0x42ea4a){logger[_0xbd01('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x66d7d3,'request\x20sent');logger[_0xbd01('0x15')](_0xbd01('0x16'),_0x66d7d3,_0xbd01('0x17'),JSON[_0xbd01('0x18')](_0x42ea4a));if(_0x42ea4a[_0xbd01('0x19')]){if(_0x42ea4a['error'][_0xbd01('0x1a')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x66d7d3,_0x42ea4a[_0xbd01('0x19')]['message']);return _0x24c360(_0x42ea4a[_0xbd01('0x19')][_0xbd01('0x1b')]);}logger[_0xbd01('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x66d7d3,_0x42ea4a['error'][_0xbd01('0x1b')]);return _0x170329(_0x42ea4a[_0xbd01('0x19')][_0xbd01('0x1b')]);}else{logger['info'](_0xbd01('0x1c'),_0x66d7d3,'request\x20sent');_0x170329(_0x42ea4a[_0xbd01('0x1d')][_0xbd01('0x1b')]);}})[_0xbd01('0x1e')](function(_0x416e21){logger[_0xbd01('0x19')](_0xbd01('0x1c'),_0x66d7d3,_0x416e21);_0x24c360(_0x416e21);});});}exports[_0xbd01('0x1f')]=function(_0x5cc1dc){var _0x360696=this;return new Promise(function(_0x3769c0,_0x44915b){return db[_0xbd01('0x20')]['findAll']({'raw':_0x5cc1dc[_0xbd01('0x21')]?_0x5cc1dc['options'][_0xbd01('0x22')]===undefined?!![]:![]:!![],'where':_0x5cc1dc[_0xbd01('0x21')]?_0x5cc1dc[_0xbd01('0x21')]['where']||null:null,'attributes':_0x5cc1dc[_0xbd01('0x21')]?_0x5cc1dc['options']['attributes']||null:null,'limit':_0x5cc1dc[_0xbd01('0x21')]?_0x5cc1dc[_0xbd01('0x21')][_0xbd01('0x23')]||null:null,'include':_0x5cc1dc['options']?_0x5cc1dc[_0xbd01('0x21')][_0xbd01('0x24')]?_['map'](_0x5cc1dc[_0xbd01('0x21')][_0xbd01('0x24')],function(_0x1f7675){return{'model':db[_0x1f7675[_0xbd01('0x25')]],'as':_0x1f7675['as'],'attributes':_0x1f7675[_0xbd01('0x26')],'include':_0x1f7675['include']?_['map'](_0x1f7675[_0xbd01('0x24')],function(_0x18af18){return{'model':db[_0x18af18[_0xbd01('0x25')]],'as':_0x18af18['as'],'attributes':_0x18af18['attributes'],'include':_0x18af18[_0xbd01('0x24')]?_[_0xbd01('0x27')](_0x18af18[_0xbd01('0x24')],function(_0x43f865){return{'model':db[_0x43f865[_0xbd01('0x25')]],'as':_0x43f865['as'],'attributes':_0x43f865[_0xbd01('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a7097){logger['info'](_0xbd01('0x1f'),_0x5cc1dc);logger[_0xbd01('0x15')]('GetOpenchannelQueue',_0x5cc1dc,JSON[_0xbd01('0x18')](_0x4a7097));_0x3769c0(_0x4a7097);})[_0xbd01('0x1e')](function(_0x4b29de){logger[_0xbd01('0x19')](_0xbd01('0x1f'),_0x4b29de[_0xbd01('0x1b')],_0x5cc1dc);_0x44915b(_0x360696['error'](0x1f4,_0x4b29de[_0xbd01('0x1b')]));});});};exports[_0xbd01('0x28')]=function(_0x56bc8b){var _0x199489=this;return new Promise(function(_0x2b6955,_0x3597fb){return db[_0xbd01('0x20')][_0xbd01('0x29')]({'raw':_0x56bc8b[_0xbd01('0x21')]?_0x56bc8b[_0xbd01('0x21')][_0xbd01('0x22')]===undefined?!![]:![]:!![],'where':_0x56bc8b[_0xbd01('0x21')]?_0x56bc8b[_0xbd01('0x21')]['where']||null:null,'attributes':_0x56bc8b[_0xbd01('0x21')]?_0x56bc8b[_0xbd01('0x21')][_0xbd01('0x26')]||null:null,'include':_0x56bc8b['options']?_0x56bc8b[_0xbd01('0x21')]['include']?_[_0xbd01('0x27')](_0x56bc8b[_0xbd01('0x21')][_0xbd01('0x24')],function(_0x836de7){return{'model':db[_0x836de7['model']],'as':_0x836de7['as'],'attributes':_0x836de7['attributes'],'include':_0x836de7[_0xbd01('0x24')]?_[_0xbd01('0x27')](_0x836de7[_0xbd01('0x24')],function(_0x5c77bd){return{'model':db[_0x5c77bd['model']],'as':_0x5c77bd['as'],'attributes':_0x5c77bd[_0xbd01('0x26')],'include':_0x5c77bd['include']?_[_0xbd01('0x27')](_0x5c77bd[_0xbd01('0x24')],function(_0x44e407){return{'model':db[_0x44e407[_0xbd01('0x25')]],'as':_0x44e407['as'],'attributes':_0x44e407[_0xbd01('0x26')]};}):[]};}):[]};}):[]:[]})[_0xbd01('0x13')](function(_0x204700){logger[_0xbd01('0x14')](_0xbd01('0x28'),_0x56bc8b);logger[_0xbd01('0x15')]('ShowOpenchannelQueue',_0x56bc8b,JSON[_0xbd01('0x18')](_0x204700));_0x2b6955(_0x204700);})[_0xbd01('0x1e')](function(_0x522096){logger[_0xbd01('0x19')]('ShowOpenchannelQueue',_0x522096[_0xbd01('0x1b')],_0x56bc8b);_0x3597fb(_0x199489[_0xbd01('0x19')](0x1f4,_0x522096['message']));});});}; \ No newline at end of file +var _0x4a77=['rpc','../../config/environment','redis','socket.io-emitter','./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','limit','include','map','model','debug','ShowOpenchannelQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x460fc1,_0x2dda9e){var _0x234ba6=function(_0x2f60eb){while(--_0x2f60eb){_0x460fc1['push'](_0x460fc1['shift']());}};_0x234ba6(++_0x2dda9e);}(_0x4a77,0xf5));var _0x74a7=function(_0x4a8ef1,_0x435532){_0x4a8ef1=_0x4a8ef1-0x0;var _0x425006=_0x4a77[_0x4a8ef1];return _0x425006;};'use strict';var _=require(_0x74a7('0x0'));var util=require(_0x74a7('0x1'));var moment=require(_0x74a7('0x2'));var BPromise=require('bluebird');var rs=require(_0x74a7('0x3'));var fs=require('fs');var Redis=require(_0x74a7('0x4'));var db=require(_0x74a7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x74a7('0x6'))(_0x74a7('0x7'));var config=require(_0x74a7('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x74a7('0x9')]=_['defaults'](config[_0x74a7('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x74a7('0xa'))(new Redis(config['redis']));require(_0x74a7('0xb'))[_0x74a7('0xc')](socket);function respondWithRpcPromise(_0xeefc50,_0x3345c6,_0x176381){return new BPromise(function(_0x5013b3,_0x1b0564){return client['request'](_0xeefc50,_0x176381)[_0x74a7('0xd')](function(_0x74c546){logger[_0x74a7('0xe')](_0x74a7('0xf'),_0x3345c6,'request\x20sent');logger['debug'](_0x74a7('0x10'),_0x3345c6,'request\x20sent',JSON[_0x74a7('0x11')](_0x74c546));if(_0x74c546[_0x74a7('0x12')]){if(_0x74c546['error'][_0x74a7('0x13')]===0x1f4){logger[_0x74a7('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x3345c6,_0x74c546[_0x74a7('0x12')][_0x74a7('0x14')]);return _0x1b0564(_0x74c546['error'][_0x74a7('0x14')]);}logger['error'](_0x74a7('0xf'),_0x3345c6,_0x74c546['error']['message']);return _0x5013b3(_0x74c546['error'][_0x74a7('0x14')]);}else{logger[_0x74a7('0xe')](_0x74a7('0xf'),_0x3345c6,'request\x20sent');_0x5013b3(_0x74c546[_0x74a7('0x15')]['message']);}})[_0x74a7('0x16')](function(_0x211d4a){logger[_0x74a7('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x3345c6,_0x211d4a);_0x1b0564(_0x211d4a);});});}exports[_0x74a7('0x17')]=function(_0x3ac536){var _0x274fcc=this;return new Promise(function(_0x3761a7,_0x329254){return db[_0x74a7('0x18')]['findAll']({'raw':_0x3ac536[_0x74a7('0x19')]?_0x3ac536[_0x74a7('0x19')][_0x74a7('0x1a')]===undefined?!![]:![]:!![],'where':_0x3ac536['options']?_0x3ac536['options'][_0x74a7('0x1b')]||null:null,'attributes':_0x3ac536[_0x74a7('0x19')]?_0x3ac536[_0x74a7('0x19')][_0x74a7('0x1c')]||null:null,'limit':_0x3ac536['options']?_0x3ac536[_0x74a7('0x19')][_0x74a7('0x1d')]||null:null,'include':_0x3ac536[_0x74a7('0x19')]?_0x3ac536[_0x74a7('0x19')][_0x74a7('0x1e')]?_[_0x74a7('0x1f')](_0x3ac536[_0x74a7('0x19')][_0x74a7('0x1e')],function(_0x432c9a){return{'model':db[_0x432c9a[_0x74a7('0x20')]],'as':_0x432c9a['as'],'attributes':_0x432c9a[_0x74a7('0x1c')],'include':_0x432c9a['include']?_['map'](_0x432c9a[_0x74a7('0x1e')],function(_0x89f58c){return{'model':db[_0x89f58c[_0x74a7('0x20')]],'as':_0x89f58c['as'],'attributes':_0x89f58c['attributes'],'include':_0x89f58c[_0x74a7('0x1e')]?_['map'](_0x89f58c[_0x74a7('0x1e')],function(_0x4618e3){return{'model':db[_0x4618e3[_0x74a7('0x20')]],'as':_0x4618e3['as'],'attributes':_0x4618e3[_0x74a7('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xda822f){logger[_0x74a7('0xe')](_0x74a7('0x17'),_0x3ac536);logger[_0x74a7('0x21')](_0x74a7('0x17'),_0x3ac536,JSON[_0x74a7('0x11')](_0xda822f));_0x3761a7(_0xda822f);})[_0x74a7('0x16')](function(_0x237d16){logger[_0x74a7('0x12')](_0x74a7('0x17'),_0x237d16['message'],_0x3ac536);_0x329254(_0x274fcc[_0x74a7('0x12')](0x1f4,_0x237d16[_0x74a7('0x14')]));});});};exports[_0x74a7('0x22')]=function(_0x54ba4c){var _0x5cd153=this;return new Promise(function(_0x121eb7,_0x1661f2){return db['OpenchannelQueue'][_0x74a7('0x23')]({'raw':_0x54ba4c['options']?_0x54ba4c['options'][_0x74a7('0x1a')]===undefined?!![]:![]:!![],'where':_0x54ba4c[_0x74a7('0x19')]?_0x54ba4c[_0x74a7('0x19')]['where']||null:null,'attributes':_0x54ba4c[_0x74a7('0x19')]?_0x54ba4c[_0x74a7('0x19')]['attributes']||null:null,'include':_0x54ba4c[_0x74a7('0x19')]?_0x54ba4c[_0x74a7('0x19')][_0x74a7('0x1e')]?_[_0x74a7('0x1f')](_0x54ba4c[_0x74a7('0x19')][_0x74a7('0x1e')],function(_0x5cf645){return{'model':db[_0x5cf645[_0x74a7('0x20')]],'as':_0x5cf645['as'],'attributes':_0x5cf645[_0x74a7('0x1c')],'include':_0x5cf645[_0x74a7('0x1e')]?_['map'](_0x5cf645[_0x74a7('0x1e')],function(_0x5bd23e){return{'model':db[_0x5bd23e['model']],'as':_0x5bd23e['as'],'attributes':_0x5bd23e['attributes'],'include':_0x5bd23e[_0x74a7('0x1e')]?_[_0x74a7('0x1f')](_0x5bd23e['include'],function(_0x3d0e43){return{'model':db[_0x3d0e43[_0x74a7('0x20')]],'as':_0x3d0e43['as'],'attributes':_0x3d0e43[_0x74a7('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20f43e){logger[_0x74a7('0xe')](_0x74a7('0x22'),_0x54ba4c);logger[_0x74a7('0x21')](_0x74a7('0x22'),_0x54ba4c,JSON[_0x74a7('0x11')](_0x20f43e));_0x121eb7(_0x20f43e);})[_0x74a7('0x16')](function(_0xa6f0ca){logger['error'](_0x74a7('0x22'),_0xa6f0ca[_0x74a7('0x14')],_0x54ba4c);_0x1661f2(_0x5cd153['error'](0x1f4,_0xa6f0ca['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index ad9ff56..1948eb3 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 _0x6c6a=['remove','update','removeListener','openchannelQueue:'];(function(_0x1796c1,_0x290664){var _0x49c61b=function(_0x3c5ab2){while(--_0x3c5ab2){_0x1796c1['push'](_0x1796c1['shift']());}};_0x49c61b(++_0x290664);}(_0x6c6a,0x1cc));var _0xa6c6=function(_0x41a31d,_0x586a94){_0x41a31d=_0x41a31d-0x0;var _0x26f03d=_0x6c6a[_0x41a31d];return _0x26f03d;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save',_0xa6c6('0x0'),_0xa6c6('0x1')];function createListener(_0x55bde4,_0x30eb4d){return function(_0x389f9f){_0x30eb4d['emit'](_0x55bde4,_0x389f9f);};}function removeListener(_0x1e3b3e,_0x14a359){return function(){OpenchannelQueueEvents[_0xa6c6('0x2')](_0x1e3b3e,_0x14a359);};}exports['register']=function(_0x171533){for(var _0x13817b=0x0,_0x25bcd7=events['length'];_0x13817b<_0x25bcd7;_0x13817b++){var _0x1b0e06=events[_0x13817b];var _0x1ce187=createListener(_0xa6c6('0x3')+_0x1b0e06,_0x171533);OpenchannelQueueEvents['on'](_0x1b0e06,_0x1ce187);}}; \ No newline at end of file +var _0xff86=['removeListener','length','./openchannelQueue.events','save','update','emit'];(function(_0x121ec2,_0x159bcf){var _0x1acbf1=function(_0x1b6678){while(--_0x1b6678){_0x121ec2['push'](_0x121ec2['shift']());}};_0x1acbf1(++_0x159bcf);}(_0xff86,0x68));var _0x6ff8=function(_0x400b8a,_0x172760){_0x400b8a=_0x400b8a-0x0;var _0x185d30=_0xff86[_0x400b8a];return _0x185d30;};'use strict';var OpenchannelQueueEvents=require(_0x6ff8('0x0'));var events=[_0x6ff8('0x1'),'remove',_0x6ff8('0x2')];function createListener(_0x2df491,_0x55757a){return function(_0x58aad0){_0x55757a[_0x6ff8('0x3')](_0x2df491,_0x58aad0);};}function removeListener(_0xfb01b7,_0x15f4fc){return function(){OpenchannelQueueEvents[_0x6ff8('0x4')](_0xfb01b7,_0x15f4fc);};}exports['register']=function(_0x1cc94e){for(var _0x4670ac=0x0,_0x176ecc=events[_0x6ff8('0x5')];_0x4670ac<_0x176ecc;_0x4670ac++){var _0x47248c=events[_0x4670ac];var _0x289318=createListener('openchannelQueue:'+_0x47248c,_0x1cc94e);OpenchannelQueueEvents['on'](_0x47248c,_0x289318);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 99af4ce..c91d4ef 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 _0x9bb3=['isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller'];(function(_0x5c49ad,_0x33630b){var _0x3050e3=function(_0x505e65){while(--_0x505e65){_0x5c49ad['push'](_0x5c49ad['shift']());}};_0x3050e3(++_0x33630b);}(_0x9bb3,0xff));var _0x39bb=function(_0x5a4bcc,_0x310079){_0x5a4bcc=_0x5a4bcc-0x0;var _0x337b3d=_0x9bb3[_0x5a4bcc];return _0x337b3d;};'use strict';var multer=require(_0x39bb('0x0'));var util=require(_0x39bb('0x1'));var path=require(_0x39bb('0x2'));var timeout=require(_0x39bb('0x3'));var express=require('express');var router=express[_0x39bb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x39bb('0x5'));var interaction=require(_0x39bb('0x6'));var config=require(_0x39bb('0x7'));var controller=require(_0x39bb('0x8'));router['get']('/',auth[_0x39bb('0x9')](),controller[_0x39bb('0xa')]);router[_0x39bb('0xb')]('/describe',auth[_0x39bb('0x9')](),controller[_0x39bb('0xc')]);router[_0x39bb('0xb')](_0x39bb('0xd'),auth[_0x39bb('0x9')](),controller[_0x39bb('0xe')]);router[_0x39bb('0xf')]('/',auth[_0x39bb('0x9')](),controller[_0x39bb('0x10')]);router[_0x39bb('0x11')](_0x39bb('0xd'),auth[_0x39bb('0x9')](),controller[_0x39bb('0x12')]);router[_0x39bb('0x13')]('/:id',auth[_0x39bb('0x9')](),controller[_0x39bb('0x14')]);module[_0x39bb('0x15')]=router; \ No newline at end of file +var _0x77e9=['fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','/describe','isAuthenticated','describe','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router'];(function(_0x25b241,_0x12c243){var _0x4d1425=function(_0x3f8f3d){while(--_0x3f8f3d){_0x25b241['push'](_0x25b241['shift']());}};_0x4d1425(++_0x12c243);}(_0x77e9,0x113));var _0x977e=function(_0x51f674,_0x135878){_0x51f674=_0x51f674-0x0;var _0x23ecaa=_0x77e9[_0x51f674];return _0x23ecaa;};'use strict';var multer=require(_0x977e('0x0'));var util=require(_0x977e('0x1'));var path=require(_0x977e('0x2'));var timeout=require(_0x977e('0x3'));var express=require('express');var router=express[_0x977e('0x4')]();var fs_extra=require(_0x977e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x977e('0x6'));var config=require(_0x977e('0x7'));var controller=require(_0x977e('0x8'));router[_0x977e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x977e('0xa'),auth[_0x977e('0xb')](),controller[_0x977e('0xc')]);router[_0x977e('0x9')]('/:id',auth[_0x977e('0xb')](),controller['show']);router[_0x977e('0xd')]('/',auth[_0x977e('0xb')](),controller[_0x977e('0xe')]);router[_0x977e('0xf')](_0x977e('0x10'),auth[_0x977e('0xb')](),controller[_0x977e('0x11')]);router[_0x977e('0x12')](_0x977e('0x10'),auth[_0x977e('0xb')](),controller[_0x977e('0x13')]);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 44ae415..33ba958 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 _0x568a=['STRING','DATE','exports'];(function(_0x3c252a,_0x2c3a18){var _0x35295c=function(_0x7630b0){while(--_0x7630b0){_0x3c252a['push'](_0x3c252a['shift']());}};_0x35295c(++_0x2c3a18);}(_0x568a,0xf5));var _0xa568=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x568a[_0x39d544];return _0x5a5ff2;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xa568('0x0')]={'uniqueid':{'type':Sequelize[_0xa568('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xa568('0x1')]},'joinAt':{'type':Sequelize[_0xa568('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa568('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa568('0x1')]}}; \ No newline at end of file +var _0x5009=['DATE','moment','sequelize','STRING'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x5009,0x191));var _0x9500=function(_0x157991,_0x81cb66){_0x157991=_0x157991-0x0;var _0x8fe4c2=_0x5009[_0x157991];return _0x8fe4c2;};'use strict';var moment=require(_0x9500('0x0'));var Sequelize=require(_0x9500('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x9500('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9500('0x3')]},'leaveAt':{'type':Sequelize[_0x9500('0x3')]},'acceptAt':{'type':Sequelize[_0x9500('0x3')]},'exitAt':{'type':Sequelize[_0x9500('0x3')]},'reason':{'type':Sequelize[_0x9500('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 6de5b5d..9a8fbe6 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 _0x054e=['keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','apply','reject','update','then','destroy','end','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query'];(function(_0x6ecc24,_0x2e806f){var _0x5e077e=function(_0x2efea8){while(--_0x2efea8){_0x6ecc24['push'](_0x6ecc24['shift']());}};_0x5e077e(++_0x2e806f);}(_0x054e,0xf2));var _0xe054=function(_0x525b28,_0x5cf5a0){_0x525b28=_0x525b28-0x0;var _0x180178=_0x054e[_0x525b28];return _0x180178;};'use strict';var emlformat=require(_0xe054('0x0'));var rimraf=require(_0xe054('0x1'));var zipdir=require(_0xe054('0x2'));var jsonpatch=require(_0xe054('0x3'));var rp=require(_0xe054('0x4'));var moment=require(_0xe054('0x5'));var BPromise=require(_0xe054('0x6'));var Mustache=require('mustache');var util=require(_0xe054('0x7'));var path=require(_0xe054('0x8'));var sox=require(_0xe054('0x9'));var csv=require(_0xe054('0xa'));var ejs=require(_0xe054('0xb'));var fs=require('fs');var fs_extra=require(_0xe054('0xc'));var _=require(_0xe054('0xd'));var squel=require(_0xe054('0xe'));var crypto=require(_0xe054('0xf'));var jsforce=require(_0xe054('0x10'));var deskjs=require(_0xe054('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe054('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe054('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe054('0x14'));var logger=require(_0xe054('0x15'))('api');var utils=require(_0xe054('0x16'));var config=require(_0xe054('0x17'));var licenseUtil=require(_0xe054('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49c9c2,_0x478ac1){_0x478ac1=_0x478ac1||0xcc;return function(_0x87202c){if(_0x87202c){return _0x49c9c2[_0xe054('0x19')](_0x478ac1);}return _0x49c9c2[_0xe054('0x1a')](_0x478ac1)['end']();};}function respondWithResult(_0x4e4a19,_0x5d58f9){_0x5d58f9=_0x5d58f9||0xc8;return function(_0x576a13){if(_0x576a13){return _0x4e4a19[_0xe054('0x1a')](_0x5d58f9)[_0xe054('0x1b')](_0x576a13);}};}function respondWithFilteredResult(_0x30c9fc,_0x4c3d8d){return function(_0x3a95e3){if(_0x3a95e3){var _0x597f3d=_0x3a95e3[_0xe054('0x1c')],_0x32c92d=_0x4c3d8d[_0xe054('0x1d')],_0x4f66f5=_0x4c3d8d[_0xe054('0x1d')]+_0x4c3d8d[_0xe054('0x1e')],_0x8da1db;if(_0x4f66f5>=_0x597f3d){_0x4f66f5=_0x597f3d;_0x8da1db=0xc8;}else{_0x8da1db=0xce;}_0x30c9fc[_0xe054('0x1a')](_0x8da1db);return _0x30c9fc[_0xe054('0x1f')]('Content-Range',_0x32c92d+'-'+_0x4f66f5+'/'+_0x597f3d)['json'](_0x3a95e3);}return null;};}function patchUpdates(_0x23403c){return function(_0x45a9b4){try{jsonpatch[_0xe054('0x20')](_0x45a9b4,_0x23403c,!![]);}catch(_0x145449){return BPromise[_0xe054('0x21')](_0x145449);}return _0x45a9b4['save']();};}function saveUpdates(_0x3fc565,_0xf4489b){return function(_0x33b8ef){if(_0x33b8ef){return _0x33b8ef[_0xe054('0x22')](_0x3fc565)[_0xe054('0x23')](function(_0x30fa86){return _0x30fa86;});}return null;};}function removeEntity(_0x431d6b,_0x56d8db){return function(_0x444177){if(_0x444177){return _0x444177[_0xe054('0x24')]()[_0xe054('0x23')](function(){_0x431d6b['status'](0xcc)[_0xe054('0x25')]();});}};}function handleEntityNotFound(_0x35767f,_0x20fd2d){return function(_0x26174c){if(!_0x26174c){_0x35767f[_0xe054('0x19')](0x194);}return _0x26174c;};}function handleError(_0x11d5ad,_0x5c03e8){_0x5c03e8=_0x5c03e8||0x1f4;return function(_0x3fe768){logger[_0xe054('0x26')](_0x3fe768[_0xe054('0x27')]);if(_0x3fe768[_0xe054('0x28')]){delete _0x3fe768[_0xe054('0x28')];}_0x11d5ad[_0xe054('0x1a')](_0x5c03e8)[_0xe054('0x29')](_0x3fe768);};}exports[_0xe054('0x2a')]=function(_0x24ae00,_0x30aa46){var _0x14db06={},_0x3fd497={},_0xb97bc8={'count':0x0,'rows':[]};var _0x68ad51=_['map'](db[_0xe054('0x2b')][_0xe054('0x2c')],function(_0xa3b732){return{'name':_0xa3b732[_0xe054('0x2d')],'type':_0xa3b732[_0xe054('0x2e')][_0xe054('0x2f')]};});_0x3fd497[_0xe054('0x30')]=_['map'](_0x68ad51,'name');_0x3fd497[_0xe054('0x31')]=_[_0xe054('0x32')](_0x24ae00['query']);_0x3fd497['filters']=_[_0xe054('0x33')](_0x3fd497['model'],_0x3fd497[_0xe054('0x31')]);_0x14db06[_0xe054('0x34')]=_[_0xe054('0x33')](_0x3fd497['model'],qs['fields'](_0x24ae00[_0xe054('0x31')][_0xe054('0x35')]));_0x14db06[_0xe054('0x34')]=_0x14db06[_0xe054('0x34')][_0xe054('0x36')]?_0x14db06[_0xe054('0x34')]:_0x3fd497[_0xe054('0x30')];if(!_0x24ae00['query'][_0xe054('0x37')]('nolimit')){_0x14db06[_0xe054('0x1e')]=qs[_0xe054('0x1e')](_0x24ae00['query'][_0xe054('0x1e')]);_0x14db06['offset']=qs[_0xe054('0x1d')](_0x24ae00[_0xe054('0x31')][_0xe054('0x1d')]);}_0x14db06['order']=qs['sort'](_0x24ae00[_0xe054('0x31')][_0xe054('0x38')]);_0x14db06[_0xe054('0x39')]=qs[_0xe054('0x3a')](_[_0xe054('0x3b')](_0x24ae00[_0xe054('0x31')],_0x3fd497['filters']),_0x68ad51);if(_0x24ae00[_0xe054('0x31')][_0xe054('0x3c')]){_0x14db06[_0xe054('0x39')]=_[_0xe054('0x3d')](_0x14db06[_0xe054('0x39')],{'$or':_['map'](_0x68ad51,function(_0x40dac5){if(_0x40dac5[_0xe054('0x2e')]!=='VIRTUAL'){var _0x24bb1a={};_0x24bb1a[_0x40dac5[_0xe054('0x28')]]={'$like':'%'+_0x24ae00['query']['filter']+'%'};return _0x24bb1a;}})});}_0x14db06=_[_0xe054('0x3d')]({},_0x14db06,_0x24ae00[_0xe054('0x3e')]);var _0x5aaa24={'where':_0x14db06[_0xe054('0x39')]};return db[_0xe054('0x2b')]['count'](_0x5aaa24)['then'](function(_0x5eee57){_0xb97bc8[_0xe054('0x1c')]=_0x5eee57;if(_0x24ae00[_0xe054('0x31')][_0xe054('0x3f')]){_0x14db06[_0xe054('0x40')]=[{'all':!![]}];}return db[_0xe054('0x2b')][_0xe054('0x41')](_0x14db06);})[_0xe054('0x23')](function(_0x636eb){_0xb97bc8[_0xe054('0x42')]=_0x636eb;return _0xb97bc8;})[_0xe054('0x23')](respondWithFilteredResult(_0x30aa46,_0x14db06))[_0xe054('0x43')](handleError(_0x30aa46,null));};exports[_0xe054('0x44')]=function(_0xefcfac,_0xe0af52){var _0x1b3c13={'raw':!![],'where':{'id':_0xefcfac[_0xe054('0x45')]['id']}},_0x5f2f0f={};_0x5f2f0f[_0xe054('0x30')]=_[_0xe054('0x32')](db['OpenchannelQueueReport'][_0xe054('0x2c')]);_0x5f2f0f[_0xe054('0x31')]=_[_0xe054('0x32')](_0xefcfac[_0xe054('0x31')]);_0x5f2f0f[_0xe054('0x3a')]=_[_0xe054('0x33')](_0x5f2f0f[_0xe054('0x30')],_0x5f2f0f['query']);_0x1b3c13[_0xe054('0x34')]=_['intersection'](_0x5f2f0f[_0xe054('0x30')],qs['fields'](_0xefcfac['query'][_0xe054('0x35')]));_0x1b3c13[_0xe054('0x34')]=_0x1b3c13['attributes'][_0xe054('0x36')]?_0x1b3c13[_0xe054('0x34')]:_0x5f2f0f[_0xe054('0x30')];if(_0xefcfac[_0xe054('0x31')][_0xe054('0x3f')]){_0x1b3c13['include']=[{'all':!![]}];}_0x1b3c13=_[_0xe054('0x3d')]({},_0x1b3c13,_0xefcfac[_0xe054('0x3e')]);return db[_0xe054('0x2b')][_0xe054('0x46')](_0x1b3c13)[_0xe054('0x23')](handleEntityNotFound(_0xe0af52,null))[_0xe054('0x23')](respondWithResult(_0xe0af52,null))[_0xe054('0x43')](handleError(_0xe0af52,null));};exports[_0xe054('0x47')]=function(_0x4f8769,_0x5a3723){return db[_0xe054('0x2b')][_0xe054('0x47')](_0x4f8769[_0xe054('0x48')],{})[_0xe054('0x23')](respondWithResult(_0x5a3723,0xc9))['catch'](handleError(_0x5a3723,null));};exports['update']=function(_0x5e09ae,_0x4ef757){if(_0x5e09ae[_0xe054('0x48')]['id']){delete _0x5e09ae[_0xe054('0x48')]['id'];}return db[_0xe054('0x2b')][_0xe054('0x46')]({'where':{'id':_0x5e09ae[_0xe054('0x45')]['id']}})[_0xe054('0x23')](handleEntityNotFound(_0x4ef757,null))[_0xe054('0x23')](saveUpdates(_0x5e09ae[_0xe054('0x48')],null))[_0xe054('0x23')](respondWithResult(_0x4ef757,null))[_0xe054('0x43')](handleError(_0x4ef757,null));};exports[_0xe054('0x24')]=function(_0x4add18,_0x59cf02){return db[_0xe054('0x2b')]['find']({'where':{'id':_0x4add18['params']['id']}})[_0xe054('0x23')](handleEntityNotFound(_0x59cf02,null))[_0xe054('0x23')](removeEntity(_0x59cf02,null))[_0xe054('0x43')](handleError(_0x59cf02,null));};exports['describe']=function(_0x34f317,_0x190704){return db['OpenchannelQueueReport']['describe']()[_0xe054('0x23')](respondWithResult(_0x190704,null))[_0xe054('0x43')](handleError(_0x190704,null));}; \ No newline at end of file +var _0xbe99=['error','stack','name','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','OpenchannelQueueReport','findAll','show','params','keys','find','create','body','catch','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','save','update','then','destroy'];(function(_0x54c7ff,_0x4b3a6e){var _0x48f83a=function(_0x3f875a){while(--_0x3f875a){_0x54c7ff['push'](_0x54c7ff['shift']());}};_0x48f83a(++_0x4b3a6e);}(_0xbe99,0x190));var _0x9be9=function(_0x139394,_0x1ddbc1){_0x139394=_0x139394-0x0;var _0x1dcc21=_0xbe99[_0x139394];return _0x1dcc21;};'use strict';var emlformat=require(_0x9be9('0x0'));var rimraf=require(_0x9be9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9be9('0x2'));var rp=require('request-promise');var moment=require(_0x9be9('0x3'));var BPromise=require(_0x9be9('0x4'));var Mustache=require(_0x9be9('0x5'));var util=require('util');var path=require(_0x9be9('0x6'));var sox=require(_0x9be9('0x7'));var csv=require(_0x9be9('0x8'));var ejs=require(_0x9be9('0x9'));var fs=require('fs');var fs_extra=require(_0x9be9('0xa'));var _=require(_0x9be9('0xb'));var squel=require(_0x9be9('0xc'));var crypto=require(_0x9be9('0xd'));var jsforce=require(_0x9be9('0xe'));var deskjs=require(_0x9be9('0xf'));var toCsv=require(_0x9be9('0x8'));var querystring=require(_0x9be9('0x10'));var Papa=require(_0x9be9('0x11'));var Redis=require(_0x9be9('0x12'));var authService=require(_0x9be9('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9be9('0x14'));var logger=require(_0x9be9('0x15'))(_0x9be9('0x16'));var utils=require(_0x9be9('0x17'));var config=require(_0x9be9('0x18'));var licenseUtil=require(_0x9be9('0x19'));var db=require(_0x9be9('0x1a'))['db'];function respondWithStatusCode(_0x432899,_0xde322){_0xde322=_0xde322||0xcc;return function(_0xbeebab){if(_0xbeebab){return _0x432899[_0x9be9('0x1b')](_0xde322);}return _0x432899[_0x9be9('0x1c')](_0xde322)['end']();};}function respondWithResult(_0x3d1094,_0x348a91){_0x348a91=_0x348a91||0xc8;return function(_0x15c796){if(_0x15c796){return _0x3d1094['status'](_0x348a91)[_0x9be9('0x1d')](_0x15c796);}};}function respondWithFilteredResult(_0x5e8ab9,_0xab94b2){return function(_0x142a97){if(_0x142a97){var _0x55b51b=_0x142a97[_0x9be9('0x1e')],_0x5c4f12=_0xab94b2[_0x9be9('0x1f')],_0x289215=_0xab94b2[_0x9be9('0x1f')]+_0xab94b2[_0x9be9('0x20')],_0x26727a;if(_0x289215>=_0x55b51b){_0x289215=_0x55b51b;_0x26727a=0xc8;}else{_0x26727a=0xce;}_0x5e8ab9['status'](_0x26727a);return _0x5e8ab9['set']('Content-Range',_0x5c4f12+'-'+_0x289215+'/'+_0x55b51b)[_0x9be9('0x1d')](_0x142a97);}return null;};}function patchUpdates(_0x21c5d8){return function(_0x4719e4){try{jsonpatch[_0x9be9('0x21')](_0x4719e4,_0x21c5d8,!![]);}catch(_0x180e13){return BPromise['reject'](_0x180e13);}return _0x4719e4[_0x9be9('0x22')]();};}function saveUpdates(_0x25bd35,_0x5a5aca){return function(_0x3bec83){if(_0x3bec83){return _0x3bec83[_0x9be9('0x23')](_0x25bd35)[_0x9be9('0x24')](function(_0x347601){return _0x347601;});}return null;};}function removeEntity(_0x1ae679,_0x5ee819){return function(_0x182dbf){if(_0x182dbf){return _0x182dbf[_0x9be9('0x25')]()[_0x9be9('0x24')](function(){_0x1ae679[_0x9be9('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55c91a,_0x5ff398){return function(_0x388084){if(!_0x388084){_0x55c91a[_0x9be9('0x1b')](0x194);}return _0x388084;};}function handleError(_0x5d1ae2,_0x5c5aa6){_0x5c5aa6=_0x5c5aa6||0x1f4;return function(_0x3f6acf){logger[_0x9be9('0x26')](_0x3f6acf[_0x9be9('0x27')]);if(_0x3f6acf[_0x9be9('0x28')]){delete _0x3f6acf['name'];}_0x5d1ae2[_0x9be9('0x1c')](_0x5c5aa6)['send'](_0x3f6acf);};}exports['index']=function(_0x3b045e,_0x2dc336){var _0xea60f1={},_0x325f62={},_0x273d96={'count':0x0,'rows':[]};var _0x248449=_[_0x9be9('0x29')](db['OpenchannelQueueReport'][_0x9be9('0x2a')],function(_0x489326){return{'name':_0x489326[_0x9be9('0x2b')],'type':_0x489326[_0x9be9('0x2c')][_0x9be9('0x2d')]};});_0x325f62['model']=_['map'](_0x248449,_0x9be9('0x28'));_0x325f62[_0x9be9('0x2e')]=_['keys'](_0x3b045e[_0x9be9('0x2e')]);_0x325f62[_0x9be9('0x2f')]=_[_0x9be9('0x30')](_0x325f62[_0x9be9('0x31')],_0x325f62[_0x9be9('0x2e')]);_0xea60f1[_0x9be9('0x32')]=_[_0x9be9('0x30')](_0x325f62[_0x9be9('0x31')],qs['fields'](_0x3b045e[_0x9be9('0x2e')]['fields']));_0xea60f1[_0x9be9('0x32')]=_0xea60f1[_0x9be9('0x32')][_0x9be9('0x33')]?_0xea60f1[_0x9be9('0x32')]:_0x325f62[_0x9be9('0x31')];if(!_0x3b045e[_0x9be9('0x2e')][_0x9be9('0x34')](_0x9be9('0x35'))){_0xea60f1[_0x9be9('0x20')]=qs[_0x9be9('0x20')](_0x3b045e['query']['limit']);_0xea60f1[_0x9be9('0x1f')]=qs[_0x9be9('0x1f')](_0x3b045e[_0x9be9('0x2e')][_0x9be9('0x1f')]);}_0xea60f1[_0x9be9('0x36')]=qs[_0x9be9('0x37')](_0x3b045e[_0x9be9('0x2e')]['sort']);_0xea60f1[_0x9be9('0x38')]=qs[_0x9be9('0x2f')](_[_0x9be9('0x39')](_0x3b045e[_0x9be9('0x2e')],_0x325f62[_0x9be9('0x2f')]),_0x248449);if(_0x3b045e[_0x9be9('0x2e')][_0x9be9('0x3a')]){_0xea60f1['where']=_['merge'](_0xea60f1[_0x9be9('0x38')],{'$or':_[_0x9be9('0x29')](_0x248449,function(_0x5a29a2){if(_0x5a29a2[_0x9be9('0x2c')]!==_0x9be9('0x3b')){var _0x36854e={};_0x36854e[_0x5a29a2['name']]={'$like':'%'+_0x3b045e['query']['filter']+'%'};return _0x36854e;}})});}_0xea60f1=_[_0x9be9('0x3c')]({},_0xea60f1,_0x3b045e['options']);var _0xcabeaf={'where':_0xea60f1[_0x9be9('0x38')]};return db['OpenchannelQueueReport']['count'](_0xcabeaf)[_0x9be9('0x24')](function(_0x3c07e8){_0x273d96['count']=_0x3c07e8;if(_0x3b045e['query'][_0x9be9('0x3d')]){_0xea60f1[_0x9be9('0x3e')]=[{'all':!![]}];}return db[_0x9be9('0x3f')][_0x9be9('0x40')](_0xea60f1);})[_0x9be9('0x24')](function(_0x4add3f){_0x273d96['rows']=_0x4add3f;return _0x273d96;})[_0x9be9('0x24')](respondWithFilteredResult(_0x2dc336,_0xea60f1))['catch'](handleError(_0x2dc336,null));};exports[_0x9be9('0x41')]=function(_0x115940,_0x461535){var _0x364b85={'raw':!![],'where':{'id':_0x115940[_0x9be9('0x42')]['id']}},_0x31e446={};_0x31e446[_0x9be9('0x31')]=_[_0x9be9('0x43')](db[_0x9be9('0x3f')][_0x9be9('0x2a')]);_0x31e446[_0x9be9('0x2e')]=_[_0x9be9('0x43')](_0x115940['query']);_0x31e446[_0x9be9('0x2f')]=_[_0x9be9('0x30')](_0x31e446[_0x9be9('0x31')],_0x31e446['query']);_0x364b85['attributes']=_[_0x9be9('0x30')](_0x31e446['model'],qs['fields'](_0x115940[_0x9be9('0x2e')]['fields']));_0x364b85[_0x9be9('0x32')]=_0x364b85['attributes'][_0x9be9('0x33')]?_0x364b85['attributes']:_0x31e446[_0x9be9('0x31')];if(_0x115940[_0x9be9('0x2e')]['includeAll']){_0x364b85[_0x9be9('0x3e')]=[{'all':!![]}];}_0x364b85=_[_0x9be9('0x3c')]({},_0x364b85,_0x115940['options']);return db['OpenchannelQueueReport'][_0x9be9('0x44')](_0x364b85)['then'](handleEntityNotFound(_0x461535,null))[_0x9be9('0x24')](respondWithResult(_0x461535,null))['catch'](handleError(_0x461535,null));};exports[_0x9be9('0x45')]=function(_0x716525,_0x52ce25){return db[_0x9be9('0x3f')][_0x9be9('0x45')](_0x716525[_0x9be9('0x46')],{})[_0x9be9('0x24')](respondWithResult(_0x52ce25,0xc9))[_0x9be9('0x47')](handleError(_0x52ce25,null));};exports[_0x9be9('0x23')]=function(_0x28a834,_0x4d5cc7){if(_0x28a834[_0x9be9('0x46')]['id']){delete _0x28a834[_0x9be9('0x46')]['id'];}return db[_0x9be9('0x3f')][_0x9be9('0x44')]({'where':{'id':_0x28a834[_0x9be9('0x42')]['id']}})['then'](handleEntityNotFound(_0x4d5cc7,null))[_0x9be9('0x24')](saveUpdates(_0x28a834[_0x9be9('0x46')],null))[_0x9be9('0x24')](respondWithResult(_0x4d5cc7,null))[_0x9be9('0x47')](handleError(_0x4d5cc7,null));};exports[_0x9be9('0x25')]=function(_0x7eb5c8,_0x81c260){return db['OpenchannelQueueReport'][_0x9be9('0x44')]({'where':{'id':_0x7eb5c8[_0x9be9('0x42')]['id']}})[_0x9be9('0x24')](handleEntityNotFound(_0x81c260,null))[_0x9be9('0x24')](removeEntity(_0x81c260,null))[_0x9be9('0x47')](handleError(_0x81c260,null));};exports[_0x9be9('0x48')]=function(_0x5cbd4c,_0x2c1555){return db[_0x9be9('0x3f')]['describe']()['then'](respondWithResult(_0x2c1555,null))[_0x9be9('0x47')](handleError(_0x2c1555,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index e4719b4..ebe4c1d 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 _0xb458=['path','rimraf','./openchannelQueueReport.attributes','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x429c55,_0x3ffb29){var _0x50efdb=function(_0x20a1aa){while(--_0x20a1aa){_0x429c55['push'](_0x429c55['shift']());}};_0x50efdb(++_0x3ffb29);}(_0xb458,0x103));var _0x8b45=function(_0x46d409,_0x2850c0){_0x46d409=_0x46d409-0x0;var _0x1bdf97=_0xb458[_0x46d409];return _0x1bdf97;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var logger=require(_0x8b45('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8b45('0x3'));var rp=require(_0x8b45('0x4'));var fs=require('fs');var path=require(_0x8b45('0x5'));var rimraf=require(_0x8b45('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b45('0x7'));module['exports']=function(_0x5cc2d5,_0xe8d774){return _0x5cc2d5[_0x8b45('0x8')](_0x8b45('0x9'),attributes,{'tableName':_0x8b45('0xa'),'paranoid':![],'indexes':[{'name':_0x8b45('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8075=['rimraf','../../config/environment','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','api','bluebird','request-promise'];(function(_0x368e09,_0x2c1517){var _0x14b7df=function(_0x5002af){while(--_0x5002af){_0x368e09['push'](_0x368e09['shift']());}};_0x14b7df(++_0x2c1517);}(_0x8075,0xab));var _0x5807=function(_0xd0df05,_0x200189){_0xd0df05=_0xd0df05-0x0;var _0x230c04=_0x8075[_0xd0df05];return _0x230c04;};'use strict';var _=require(_0x5807('0x0'));var util=require(_0x5807('0x1'));var logger=require('../../config/logger')(_0x5807('0x2'));var moment=require('moment');var BPromise=require(_0x5807('0x3'));var rp=require(_0x5807('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5807('0x5'));var config=require(_0x5807('0x6'));var attributes=require('./openchannelQueueReport.attributes');module['exports']=function(_0x984f3d,_0x5b471b){return _0x984f3d[_0x5807('0x7')](_0x5807('0x8'),attributes,{'tableName':_0x5807('0x9'),'paranoid':![],'indexes':[{'name':_0x5807('0xa'),'fields':[_0x5807('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index c69eca7..1437fae 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 _0x4d27=['request','then','OpenchannelQueueReport,\x20%s,\x20%s','debug','error','code','message','info','request\x20sent','result','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','stringify','catch','UpdateOpenchannelQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x4d27,0x7d));var _0x74d2=function(_0x202c26,_0x53ed77){_0x202c26=_0x202c26-0x0;var _0xbccf4=_0x4d27[_0x202c26];return _0xbccf4;};'use strict';var _=require(_0x74d2('0x0'));var util=require(_0x74d2('0x1'));var moment=require(_0x74d2('0x2'));var BPromise=require(_0x74d2('0x3'));var rs=require(_0x74d2('0x4'));var fs=require('fs');var Redis=require(_0x74d2('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x74d2('0x6'))(_0x74d2('0x7'));var config=require('../../config/environment');var jayson=require(_0x74d2('0x8'));var client=jayson[_0x74d2('0x9')][_0x74d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38a9ce,_0x70bdf1,_0x263069){return new BPromise(function(_0x20235d,_0x2144f6){return client[_0x74d2('0xb')](_0x38a9ce,_0x263069)[_0x74d2('0xc')](function(_0x67f831){logger['info'](_0x74d2('0xd'),_0x70bdf1,'request\x20sent');logger[_0x74d2('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x70bdf1,'request\x20sent',JSON['stringify'](_0x67f831));if(_0x67f831[_0x74d2('0xf')]){if(_0x67f831[_0x74d2('0xf')][_0x74d2('0x10')]===0x1f4){logger[_0x74d2('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x70bdf1,_0x67f831[_0x74d2('0xf')][_0x74d2('0x11')]);return _0x2144f6(_0x67f831['error']['message']);}logger['error'](_0x74d2('0xd'),_0x70bdf1,_0x67f831[_0x74d2('0xf')][_0x74d2('0x11')]);return _0x20235d(_0x67f831[_0x74d2('0xf')][_0x74d2('0x11')]);}else{logger[_0x74d2('0x12')](_0x74d2('0xd'),_0x70bdf1,_0x74d2('0x13'));_0x20235d(_0x67f831[_0x74d2('0x14')][_0x74d2('0x11')]);}})['catch'](function(_0x5bd1b0){logger[_0x74d2('0xf')](_0x74d2('0xd'),_0x70bdf1,_0x5bd1b0);_0x2144f6(_0x5bd1b0);});});}exports['CreateOpenchannelQueueReport']=function(_0x2aa8fc){var _0x5a1cff=this;return new Promise(function(_0x1ecaa4,_0x1a3630){return db[_0x74d2('0x15')][_0x74d2('0x16')](_0x2aa8fc[_0x74d2('0x17')],{'raw':_0x2aa8fc[_0x74d2('0x18')]?_0x2aa8fc['options'][_0x74d2('0x19')]===undefined?!![]:![]:!![]})[_0x74d2('0xc')](function(_0x2b5707){logger[_0x74d2('0x12')](_0x74d2('0x1a'),_0x2aa8fc);logger[_0x74d2('0xe')](_0x74d2('0x1a'),_0x2aa8fc,JSON[_0x74d2('0x1b')](_0x2b5707));_0x1ecaa4(_0x2b5707);})[_0x74d2('0x1c')](function(_0x55c78c){logger[_0x74d2('0xf')](_0x74d2('0x1a'),_0x55c78c[_0x74d2('0x11')],_0x2aa8fc);_0x1a3630(_0x5a1cff[_0x74d2('0xf')](0x1f4,_0x55c78c['message']));});});};exports[_0x74d2('0x1d')]=function(_0xd549c5){var _0x16d0b9=this;return new Promise(function(_0x599fc9,_0x18ddfe){return db['OpenchannelQueueReport'][_0x74d2('0x1e')](_0xd549c5['body'],{'raw':_0xd549c5[_0x74d2('0x18')]?_0xd549c5[_0x74d2('0x18')][_0x74d2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd549c5['options']?_0xd549c5[_0x74d2('0x18')][_0x74d2('0x1f')]||null:null,'attributes':_0xd549c5[_0x74d2('0x18')]?_0xd549c5[_0x74d2('0x18')][_0x74d2('0x20')]||null:null,'limit':_0xd549c5[_0x74d2('0x18')]?_0xd549c5[_0x74d2('0x18')][_0x74d2('0x21')]||null:null})['then'](function(_0xe7dfdf){logger[_0x74d2('0x12')]('UpdateOpenchannelQueueReport',_0xd549c5);logger[_0x74d2('0xe')](_0x74d2('0x1d'),_0xd549c5,JSON[_0x74d2('0x1b')](_0xe7dfdf));_0x599fc9(_0xe7dfdf);})[_0x74d2('0x1c')](function(_0x1151ee){logger[_0x74d2('0xf')]('UpdateOpenchannelQueueReport',_0x1151ee[_0x74d2('0x11')],_0xd549c5);_0x18ddfe(_0x16d0b9['error'](0x1f4,_0x1151ee[_0x74d2('0x11')]));});});}; \ No newline at end of file +var _0xbee8=['result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','update','attributes','limit','UpdateOpenchannelQueueReport','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message'];(function(_0x310223,_0x1fd62d){var _0x4d2dc2=function(_0x1a7263){while(--_0x1a7263){_0x310223['push'](_0x310223['shift']());}};_0x4d2dc2(++_0x1fd62d);}(_0xbee8,0xb6));var _0x8bee=function(_0x189d3c,_0x5efebf){_0x189d3c=_0x189d3c-0x0;var _0x485959=_0xbee8[_0x189d3c];return _0x485959;};'use strict';var _=require('lodash');var util=require(_0x8bee('0x0'));var moment=require(_0x8bee('0x1'));var BPromise=require(_0x8bee('0x2'));var rs=require(_0x8bee('0x3'));var fs=require('fs');var Redis=require(_0x8bee('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8bee('0x5'));var logger=require(_0x8bee('0x6'))('rpc');var config=require(_0x8bee('0x7'));var jayson=require(_0x8bee('0x8'));var client=jayson[_0x8bee('0x9')][_0x8bee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a7180,_0x21e101,_0x1bbc05){return new BPromise(function(_0x841b46,_0x91bede){return client[_0x8bee('0xb')](_0x3a7180,_0x1bbc05)[_0x8bee('0xc')](function(_0x13bcb6){logger[_0x8bee('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x21e101,'request\x20sent');logger[_0x8bee('0xe')](_0x8bee('0xf'),_0x21e101,_0x8bee('0x10'),JSON[_0x8bee('0x11')](_0x13bcb6));if(_0x13bcb6[_0x8bee('0x12')]){if(_0x13bcb6['error'][_0x8bee('0x13')]===0x1f4){logger[_0x8bee('0x12')](_0x8bee('0x14'),_0x21e101,_0x13bcb6[_0x8bee('0x12')]['message']);return _0x91bede(_0x13bcb6['error'][_0x8bee('0x15')]);}logger[_0x8bee('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x21e101,_0x13bcb6['error']['message']);return _0x841b46(_0x13bcb6[_0x8bee('0x12')]['message']);}else{logger[_0x8bee('0xd')](_0x8bee('0x14'),_0x21e101,'request\x20sent');_0x841b46(_0x13bcb6[_0x8bee('0x16')][_0x8bee('0x15')]);}})[_0x8bee('0x17')](function(_0x40632d){logger[_0x8bee('0x12')](_0x8bee('0x14'),_0x21e101,_0x40632d);_0x91bede(_0x40632d);});});}exports[_0x8bee('0x18')]=function(_0x3a8cf7){var _0x38c604=this;return new Promise(function(_0x5a0635,_0x10adae){return db[_0x8bee('0x19')][_0x8bee('0x1a')](_0x3a8cf7[_0x8bee('0x1b')],{'raw':_0x3a8cf7[_0x8bee('0x1c')]?_0x3a8cf7[_0x8bee('0x1c')][_0x8bee('0x1d')]===undefined?!![]:![]:!![]})[_0x8bee('0xc')](function(_0x4ace18){logger[_0x8bee('0xd')](_0x8bee('0x18'),_0x3a8cf7);logger[_0x8bee('0xe')](_0x8bee('0x18'),_0x3a8cf7,JSON[_0x8bee('0x11')](_0x4ace18));_0x5a0635(_0x4ace18);})['catch'](function(_0x52009c){logger[_0x8bee('0x12')](_0x8bee('0x18'),_0x52009c['message'],_0x3a8cf7);_0x10adae(_0x38c604[_0x8bee('0x12')](0x1f4,_0x52009c['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x45ce11){var _0x5a9909=this;return new Promise(function(_0x34d918,_0x506477){return db[_0x8bee('0x19')][_0x8bee('0x1e')](_0x45ce11[_0x8bee('0x1b')],{'raw':_0x45ce11[_0x8bee('0x1c')]?_0x45ce11[_0x8bee('0x1c')][_0x8bee('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45ce11['options']?_0x45ce11[_0x8bee('0x1c')]['where']||null:null,'attributes':_0x45ce11[_0x8bee('0x1c')]?_0x45ce11['options'][_0x8bee('0x1f')]||null:null,'limit':_0x45ce11[_0x8bee('0x1c')]?_0x45ce11[_0x8bee('0x1c')][_0x8bee('0x20')]||null:null})[_0x8bee('0xc')](function(_0x5a4b5d){logger[_0x8bee('0xd')](_0x8bee('0x21'),_0x45ce11);logger['debug'](_0x8bee('0x21'),_0x45ce11,JSON[_0x8bee('0x11')](_0x5a4b5d));_0x34d918(_0x5a4b5d);})[_0x8bee('0x17')](function(_0x58d32d){logger[_0x8bee('0x12')](_0x8bee('0x21'),_0x58d32d[_0x8bee('0x15')],_0x45ce11);_0x506477(_0x5a9909['error'](0x1f4,_0x58d32d[_0x8bee('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 70f76f2..ed8af60 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 _0x3b8c=['/describe','describe','/:id','show','post','create','put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3a68a5,_0x1a2d19){var _0x2eca6c=function(_0x549792){while(--_0x549792){_0x3a68a5['push'](_0x3a68a5['shift']());}};_0x2eca6c(++_0x1a2d19);}(_0x3b8c,0xef));var _0xc3b8=function(_0x1ca795,_0x541ee8){_0x1ca795=_0x1ca795-0x0;var _0x52e1d0=_0x3b8c[_0x1ca795];return _0x52e1d0;};'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[_0xc3b8('0x5')]();var fs_extra=require(_0xc3b8('0x6'));var auth=require(_0xc3b8('0x7'));var interaction=require(_0xc3b8('0x8'));var config=require(_0xc3b8('0x9'));var controller=require('./openchannelTransferReport.controller');router[_0xc3b8('0xa')]('/',auth[_0xc3b8('0xb')](),controller[_0xc3b8('0xc')]);router['get'](_0xc3b8('0xd'),auth[_0xc3b8('0xb')](),controller[_0xc3b8('0xe')]);router[_0xc3b8('0xa')](_0xc3b8('0xf'),auth[_0xc3b8('0xb')](),controller[_0xc3b8('0x10')]);router[_0xc3b8('0x11')]('/',auth[_0xc3b8('0xb')](),controller[_0xc3b8('0x12')]);router[_0xc3b8('0x13')]('/:id',auth[_0xc3b8('0xb')](),controller['update']);router['delete'](_0xc3b8('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xc3b8('0x14')]=router; \ No newline at end of file +var _0x527d=['delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','describe','/:id','isAuthenticated','show','post','put','update'];(function(_0x289402,_0x4985c7){var _0x51f20b=function(_0x35ef07){while(--_0x35ef07){_0x289402['push'](_0x289402['shift']());}};_0x51f20b(++_0x4985c7);}(_0x527d,0x169));var _0xd527=function(_0x786e9,_0x1a029){_0x786e9=_0x786e9-0x0;var _0x1f891b=_0x527d[_0x786e9];return _0x1f891b;};'use strict';var multer=require(_0xd527('0x0'));var util=require(_0xd527('0x1'));var path=require(_0xd527('0x2'));var timeout=require('connect-timeout');var express=require(_0xd527('0x3'));var router=express[_0xd527('0x4')]();var fs_extra=require(_0xd527('0x5'));var auth=require(_0xd527('0x6'));var interaction=require(_0xd527('0x7'));var config=require(_0xd527('0x8'));var controller=require('./openchannelTransferReport.controller');router[_0xd527('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xd527('0xa')]);router['get'](_0xd527('0xb'),auth[_0xd527('0xc')](),controller[_0xd527('0xd')]);router[_0xd527('0xe')]('/',auth[_0xd527('0xc')](),controller['create']);router[_0xd527('0xf')](_0xd527('0xb'),auth[_0xd527('0xc')](),controller[_0xd527('0x10')]);router[_0xd527('0x11')](_0xd527('0xb'),auth[_0xd527('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 48f1dd9..504d051 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 _0x6421=['DATE','NOW','moment','exports','STRING','account','agent','queue'];(function(_0x5e9055,_0x388e4a){var _0x86b4f=function(_0x173b2c){while(--_0x173b2c){_0x5e9055['push'](_0x5e9055['shift']());}};_0x86b4f(++_0x388e4a);}(_0x6421,0x1c2));var _0x1642=function(_0x4b952f,_0x50afd4){_0x4b952f=_0x4b952f-0x0;var _0x15b0b5=_0x6421[_0x4b952f];return _0x15b0b5;};'use strict';var moment=require(_0x1642('0x0'));var Sequelize=require('sequelize');module[_0x1642('0x1')]={'uniqueid':{'type':Sequelize[_0x1642('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1642('0x3'),_0x1642('0x4'),_0x1642('0x5')),'allowNull':![],'defaultValue':_0x1642('0x5')},'transferredAt':{'type':Sequelize[_0x1642('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x1642('0x7')]}}; \ No newline at end of file +var _0x07eb=['sequelize','exports','agent','DATE','moment'];(function(_0x474d03,_0x5291a1){var _0x562c21=function(_0x32cb22){while(--_0x32cb22){_0x474d03['push'](_0x474d03['shift']());}};_0x562c21(++_0x5291a1);}(_0x07eb,0xbd));var _0xb07e=function(_0x335271,_0x5025f2){_0x335271=_0x335271-0x0;var _0xa9fff8=_0x07eb[_0x335271];return _0xa9fff8;};'use strict';var moment=require(_0xb07e('0x0'));var Sequelize=require(_0xb07e('0x1'));module[_0xb07e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0xb07e('0x3'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb07e('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index f60f828..670890f 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 _0x5183=['fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','options','OpenchannelTransferReport','count','includeAll','include','catch','show','rawAttributes','create','body','update','find','destroy','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','then','error','stack','name','send','index','map'];(function(_0x49c8fb,_0x3621b9){var _0x283aca=function(_0xe4212a){while(--_0xe4212a){_0x49c8fb['push'](_0x49c8fb['shift']());}};_0x283aca(++_0x3621b9);}(_0x5183,0x13e));var _0x3518=function(_0x36b468,_0x257ec3){_0x36b468=_0x36b468-0x0;var _0x52e2c2=_0x5183[_0x36b468];return _0x52e2c2;};'use strict';var emlformat=require(_0x3518('0x0'));var rimraf=require(_0x3518('0x1'));var zipdir=require(_0x3518('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3518('0x3'));var BPromise=require(_0x3518('0x4'));var Mustache=require(_0x3518('0x5'));var util=require(_0x3518('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3518('0x7'));var ejs=require(_0x3518('0x8'));var fs=require('fs');var fs_extra=require(_0x3518('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3518('0xa'));var deskjs=require(_0x3518('0xb'));var toCsv=require(_0x3518('0x7'));var querystring=require('querystring');var Papa=require(_0x3518('0xc'));var Redis=require('ioredis');var authService=require(_0x3518('0xd'));var qs=require(_0x3518('0xe'));var as=require(_0x3518('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3518('0x10'))(_0x3518('0x11'));var utils=require('../../config/utils');var config=require(_0x3518('0x12'));var licenseUtil=require(_0x3518('0x13'));var db=require(_0x3518('0x14'))['db'];function respondWithStatusCode(_0x410b8f,_0x4913bb){_0x4913bb=_0x4913bb||0xcc;return function(_0x4ec528){if(_0x4ec528){return _0x410b8f[_0x3518('0x15')](_0x4913bb);}return _0x410b8f[_0x3518('0x16')](_0x4913bb)[_0x3518('0x17')]();};}function respondWithResult(_0x47e192,_0x563507){_0x563507=_0x563507||0xc8;return function(_0x4593cd){if(_0x4593cd){return _0x47e192[_0x3518('0x16')](_0x563507)[_0x3518('0x18')](_0x4593cd);}};}function respondWithFilteredResult(_0x488364,_0xcd8688){return function(_0x4ed175){if(_0x4ed175){var _0x1faa77=_0x4ed175['count'],_0x30a74d=_0xcd8688[_0x3518('0x19')],_0x58fbb0=_0xcd8688['offset']+_0xcd8688[_0x3518('0x1a')],_0xc7f658;if(_0x58fbb0>=_0x1faa77){_0x58fbb0=_0x1faa77;_0xc7f658=0xc8;}else{_0xc7f658=0xce;}_0x488364[_0x3518('0x16')](_0xc7f658);return _0x488364['set'](_0x3518('0x1b'),_0x30a74d+'-'+_0x58fbb0+'/'+_0x1faa77)[_0x3518('0x18')](_0x4ed175);}return null;};}function patchUpdates(_0x328f8f){return function(_0x8092d6){try{jsonpatch[_0x3518('0x1c')](_0x8092d6,_0x328f8f,!![]);}catch(_0x596902){return BPromise[_0x3518('0x1d')](_0x596902);}return _0x8092d6['save']();};}function saveUpdates(_0x29e696,_0x3af458){return function(_0x213955){if(_0x213955){return _0x213955['update'](_0x29e696)[_0x3518('0x1e')](function(_0x1646aa){return _0x1646aa;});}return null;};}function removeEntity(_0x2a3b9a,_0x1e25a9){return function(_0x1d76fe){if(_0x1d76fe){return _0x1d76fe['destroy']()[_0x3518('0x1e')](function(){_0x2a3b9a[_0x3518('0x16')](0xcc)[_0x3518('0x17')]();});}};}function handleEntityNotFound(_0x3082a7,_0x253f98){return function(_0x3aa4e0){if(!_0x3aa4e0){_0x3082a7[_0x3518('0x15')](0x194);}return _0x3aa4e0;};}function handleError(_0x930cb7,_0x8baad6){_0x8baad6=_0x8baad6||0x1f4;return function(_0x440920){logger[_0x3518('0x1f')](_0x440920[_0x3518('0x20')]);if(_0x440920[_0x3518('0x21')]){delete _0x440920[_0x3518('0x21')];}_0x930cb7[_0x3518('0x16')](_0x8baad6)[_0x3518('0x22')](_0x440920);};}exports[_0x3518('0x23')]=function(_0x30ebce,_0x25917c){var _0x3c8cb9={},_0x34a6d6={},_0x123230={'count':0x0,'rows':[]};var _0x41e02b=_[_0x3518('0x24')](db['OpenchannelTransferReport']['rawAttributes'],function(_0x3f8b72){return{'name':_0x3f8b72[_0x3518('0x25')],'type':_0x3f8b72['type'][_0x3518('0x26')]};});_0x34a6d6[_0x3518('0x27')]=_['map'](_0x41e02b,_0x3518('0x21'));_0x34a6d6['query']=_[_0x3518('0x28')](_0x30ebce['query']);_0x34a6d6[_0x3518('0x29')]=_[_0x3518('0x2a')](_0x34a6d6[_0x3518('0x27')],_0x34a6d6[_0x3518('0x2b')]);_0x3c8cb9[_0x3518('0x2c')]=_[_0x3518('0x2a')](_0x34a6d6['model'],qs[_0x3518('0x2d')](_0x30ebce['query'][_0x3518('0x2d')]));_0x3c8cb9[_0x3518('0x2c')]=_0x3c8cb9[_0x3518('0x2c')][_0x3518('0x2e')]?_0x3c8cb9[_0x3518('0x2c')]:_0x34a6d6[_0x3518('0x27')];if(!_0x30ebce[_0x3518('0x2b')][_0x3518('0x2f')](_0x3518('0x30'))){_0x3c8cb9[_0x3518('0x1a')]=qs[_0x3518('0x1a')](_0x30ebce[_0x3518('0x2b')][_0x3518('0x1a')]);_0x3c8cb9['offset']=qs[_0x3518('0x19')](_0x30ebce[_0x3518('0x2b')][_0x3518('0x19')]);}_0x3c8cb9[_0x3518('0x31')]=qs[_0x3518('0x32')](_0x30ebce[_0x3518('0x2b')][_0x3518('0x32')]);_0x3c8cb9['where']=qs[_0x3518('0x29')](_[_0x3518('0x33')](_0x30ebce[_0x3518('0x2b')],_0x34a6d6[_0x3518('0x29')]),_0x41e02b);if(_0x30ebce['query']['filter']){_0x3c8cb9[_0x3518('0x34')]=_[_0x3518('0x35')](_0x3c8cb9[_0x3518('0x34')],{'$or':_[_0x3518('0x24')](_0x41e02b,function(_0x5b76a5){if(_0x5b76a5[_0x3518('0x36')]!==_0x3518('0x37')){var _0x2c0ec5={};_0x2c0ec5[_0x5b76a5[_0x3518('0x21')]]={'$like':'%'+_0x30ebce[_0x3518('0x2b')]['filter']+'%'};return _0x2c0ec5;}})});}_0x3c8cb9=_[_0x3518('0x35')]({},_0x3c8cb9,_0x30ebce[_0x3518('0x38')]);var _0x231d65={'where':_0x3c8cb9[_0x3518('0x34')]};return db[_0x3518('0x39')][_0x3518('0x3a')](_0x231d65)[_0x3518('0x1e')](function(_0x39e420){_0x123230[_0x3518('0x3a')]=_0x39e420;if(_0x30ebce['query'][_0x3518('0x3b')]){_0x3c8cb9[_0x3518('0x3c')]=[{'all':!![]}];}return db[_0x3518('0x39')]['findAll'](_0x3c8cb9);})[_0x3518('0x1e')](function(_0x38403f){_0x123230['rows']=_0x38403f;return _0x123230;})['then'](respondWithFilteredResult(_0x25917c,_0x3c8cb9))[_0x3518('0x3d')](handleError(_0x25917c,null));};exports[_0x3518('0x3e')]=function(_0x12b7c6,_0x2d9f87){var _0x2af55f={'raw':!![],'where':{'id':_0x12b7c6['params']['id']}},_0x3bb411={};_0x3bb411[_0x3518('0x27')]=_[_0x3518('0x28')](db[_0x3518('0x39')][_0x3518('0x3f')]);_0x3bb411['query']=_[_0x3518('0x28')](_0x12b7c6[_0x3518('0x2b')]);_0x3bb411[_0x3518('0x29')]=_[_0x3518('0x2a')](_0x3bb411[_0x3518('0x27')],_0x3bb411[_0x3518('0x2b')]);_0x2af55f[_0x3518('0x2c')]=_[_0x3518('0x2a')](_0x3bb411[_0x3518('0x27')],qs[_0x3518('0x2d')](_0x12b7c6[_0x3518('0x2b')][_0x3518('0x2d')]));_0x2af55f['attributes']=_0x2af55f['attributes'][_0x3518('0x2e')]?_0x2af55f['attributes']:_0x3bb411['model'];if(_0x12b7c6['query'][_0x3518('0x3b')]){_0x2af55f[_0x3518('0x3c')]=[{'all':!![]}];}_0x2af55f=_[_0x3518('0x35')]({},_0x2af55f,_0x12b7c6[_0x3518('0x38')]);return db[_0x3518('0x39')]['find'](_0x2af55f)[_0x3518('0x1e')](handleEntityNotFound(_0x2d9f87,null))['then'](respondWithResult(_0x2d9f87,null))[_0x3518('0x3d')](handleError(_0x2d9f87,null));};exports[_0x3518('0x40')]=function(_0x5681e6,_0x5ea582){return db[_0x3518('0x39')][_0x3518('0x40')](_0x5681e6[_0x3518('0x41')],{})[_0x3518('0x1e')](respondWithResult(_0x5ea582,0xc9))['catch'](handleError(_0x5ea582,null));};exports[_0x3518('0x42')]=function(_0x2b7d33,_0x4c1948){if(_0x2b7d33[_0x3518('0x41')]['id']){delete _0x2b7d33['body']['id'];}return db[_0x3518('0x39')][_0x3518('0x43')]({'where':{'id':_0x2b7d33['params']['id']}})[_0x3518('0x1e')](handleEntityNotFound(_0x4c1948,null))[_0x3518('0x1e')](saveUpdates(_0x2b7d33['body'],null))['then'](respondWithResult(_0x4c1948,null))[_0x3518('0x3d')](handleError(_0x4c1948,null));};exports[_0x3518('0x44')]=function(_0x51fe45,_0x418518){return db['OpenchannelTransferReport'][_0x3518('0x43')]({'where':{'id':_0x51fe45[_0x3518('0x45')]['id']}})[_0x3518('0x1e')](handleEntityNotFound(_0x418518,null))[_0x3518('0x1e')](removeEntity(_0x418518,null))[_0x3518('0x3d')](handleError(_0x418518,null));};exports[_0x3518('0x46')]=function(_0x128a35,_0x4f58c4){return db[_0x3518('0x39')][_0x3518('0x46')]()['then'](respondWithResult(_0x4f58c4,null))[_0x3518('0x3d')](handleError(_0x4f58c4,null));}; \ No newline at end of file +var _0x49c4=['includeAll','find','create','body','catch','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','findAll','rows','params'];(function(_0x3dc142,_0xeb90de){var _0x4c2ca5=function(_0x502e13){while(--_0x502e13){_0x3dc142['push'](_0x3dc142['shift']());}};_0x4c2ca5(++_0xeb90de);}(_0x49c4,0x9b));var _0x449c=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x49c4[_0x6cf19c];return _0xce14f3;};'use strict';var emlformat=require(_0x449c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x449c('0x1'));var jsonpatch=require(_0x449c('0x2'));var rp=require(_0x449c('0x3'));var moment=require(_0x449c('0x4'));var BPromise=require(_0x449c('0x5'));var Mustache=require(_0x449c('0x6'));var util=require(_0x449c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x449c('0x8'));var ejs=require(_0x449c('0x9'));var fs=require('fs');var fs_extra=require(_0x449c('0xa'));var _=require(_0x449c('0xb'));var squel=require(_0x449c('0xc'));var crypto=require(_0x449c('0xd'));var jsforce=require(_0x449c('0xe'));var deskjs=require(_0x449c('0xf'));var toCsv=require(_0x449c('0x8'));var querystring=require(_0x449c('0x10'));var Papa=require(_0x449c('0x11'));var Redis=require(_0x449c('0x12'));var authService=require(_0x449c('0x13'));var qs=require(_0x449c('0x14'));var as=require(_0x449c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x449c('0x16'));var utils=require(_0x449c('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e6303,_0x2d5610){_0x2d5610=_0x2d5610||0xcc;return function(_0x181570){if(_0x181570){return _0x3e6303[_0x449c('0x18')](_0x2d5610);}return _0x3e6303['status'](_0x2d5610)[_0x449c('0x19')]();};}function respondWithResult(_0x4fce89,_0x1818a9){_0x1818a9=_0x1818a9||0xc8;return function(_0x5b3a85){if(_0x5b3a85){return _0x4fce89[_0x449c('0x1a')](_0x1818a9)[_0x449c('0x1b')](_0x5b3a85);}};}function respondWithFilteredResult(_0x258b57,_0x39a9c4){return function(_0x3510e1){if(_0x3510e1){var _0x80bdf5=_0x3510e1[_0x449c('0x1c')],_0x3369e3=_0x39a9c4['offset'],_0x634564=_0x39a9c4[_0x449c('0x1d')]+_0x39a9c4[_0x449c('0x1e')],_0x132a5b;if(_0x634564>=_0x80bdf5){_0x634564=_0x80bdf5;_0x132a5b=0xc8;}else{_0x132a5b=0xce;}_0x258b57[_0x449c('0x1a')](_0x132a5b);return _0x258b57[_0x449c('0x1f')](_0x449c('0x20'),_0x3369e3+'-'+_0x634564+'/'+_0x80bdf5)['json'](_0x3510e1);}return null;};}function patchUpdates(_0x41e52a){return function(_0x1b5b82){try{jsonpatch[_0x449c('0x21')](_0x1b5b82,_0x41e52a,!![]);}catch(_0x3d09ec){return BPromise[_0x449c('0x22')](_0x3d09ec);}return _0x1b5b82[_0x449c('0x23')]();};}function saveUpdates(_0x57c137,_0x3aee9c){return function(_0x43ff50){if(_0x43ff50){return _0x43ff50['update'](_0x57c137)[_0x449c('0x24')](function(_0x6ca12){return _0x6ca12;});}return null;};}function removeEntity(_0xdb81ec,_0x42c25f){return function(_0x243d68){if(_0x243d68){return _0x243d68[_0x449c('0x25')]()['then'](function(){_0xdb81ec[_0x449c('0x1a')](0xcc)[_0x449c('0x19')]();});}};}function handleEntityNotFound(_0x4f06b3,_0x4dff4c){return function(_0x4e983c){if(!_0x4e983c){_0x4f06b3[_0x449c('0x18')](0x194);}return _0x4e983c;};}function handleError(_0x47c13d,_0x325305){_0x325305=_0x325305||0x1f4;return function(_0x43fea6){logger[_0x449c('0x26')](_0x43fea6[_0x449c('0x27')]);if(_0x43fea6[_0x449c('0x28')]){delete _0x43fea6[_0x449c('0x28')];}_0x47c13d[_0x449c('0x1a')](_0x325305)[_0x449c('0x29')](_0x43fea6);};}exports[_0x449c('0x2a')]=function(_0x1140d2,_0xb85ce1){var _0x29e836={},_0x431ce0={},_0x52c0f5={'count':0x0,'rows':[]};var _0x586ef6=_[_0x449c('0x2b')](db[_0x449c('0x2c')][_0x449c('0x2d')],function(_0x35757b){return{'name':_0x35757b[_0x449c('0x2e')],'type':_0x35757b[_0x449c('0x2f')][_0x449c('0x30')]};});_0x431ce0[_0x449c('0x31')]=_[_0x449c('0x2b')](_0x586ef6,_0x449c('0x28'));_0x431ce0[_0x449c('0x32')]=_[_0x449c('0x33')](_0x1140d2[_0x449c('0x32')]);_0x431ce0[_0x449c('0x34')]=_[_0x449c('0x35')](_0x431ce0[_0x449c('0x31')],_0x431ce0[_0x449c('0x32')]);_0x29e836[_0x449c('0x36')]=_[_0x449c('0x35')](_0x431ce0[_0x449c('0x31')],qs[_0x449c('0x37')](_0x1140d2[_0x449c('0x32')][_0x449c('0x37')]));_0x29e836[_0x449c('0x36')]=_0x29e836[_0x449c('0x36')][_0x449c('0x38')]?_0x29e836[_0x449c('0x36')]:_0x431ce0['model'];if(!_0x1140d2[_0x449c('0x32')]['hasOwnProperty'](_0x449c('0x39'))){_0x29e836['limit']=qs['limit'](_0x1140d2['query'][_0x449c('0x1e')]);_0x29e836[_0x449c('0x1d')]=qs[_0x449c('0x1d')](_0x1140d2['query'][_0x449c('0x1d')]);}_0x29e836[_0x449c('0x3a')]=qs[_0x449c('0x3b')](_0x1140d2['query']['sort']);_0x29e836[_0x449c('0x3c')]=qs['filters'](_['pick'](_0x1140d2[_0x449c('0x32')],_0x431ce0[_0x449c('0x34')]),_0x586ef6);if(_0x1140d2[_0x449c('0x32')][_0x449c('0x3d')]){_0x29e836[_0x449c('0x3c')]=_[_0x449c('0x3e')](_0x29e836[_0x449c('0x3c')],{'$or':_[_0x449c('0x2b')](_0x586ef6,function(_0x434f4e){if(_0x434f4e['type']!=='VIRTUAL'){var _0xd317b1={};_0xd317b1[_0x434f4e[_0x449c('0x28')]]={'$like':'%'+_0x1140d2[_0x449c('0x32')][_0x449c('0x3d')]+'%'};return _0xd317b1;}})});}_0x29e836=_[_0x449c('0x3e')]({},_0x29e836,_0x1140d2[_0x449c('0x3f')]);var _0x1a721c={'where':_0x29e836['where']};return db[_0x449c('0x2c')][_0x449c('0x1c')](_0x1a721c)[_0x449c('0x24')](function(_0x2f509b){_0x52c0f5[_0x449c('0x1c')]=_0x2f509b;if(_0x1140d2[_0x449c('0x32')]['includeAll']){_0x29e836['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x449c('0x40')](_0x29e836);})[_0x449c('0x24')](function(_0x383eed){_0x52c0f5[_0x449c('0x41')]=_0x383eed;return _0x52c0f5;})[_0x449c('0x24')](respondWithFilteredResult(_0xb85ce1,_0x29e836))['catch'](handleError(_0xb85ce1,null));};exports['show']=function(_0x3d2dde,_0x2c6c03){var _0x1f64c6={'raw':!![],'where':{'id':_0x3d2dde[_0x449c('0x42')]['id']}},_0x1fd757={};_0x1fd757[_0x449c('0x31')]=_[_0x449c('0x33')](db[_0x449c('0x2c')]['rawAttributes']);_0x1fd757[_0x449c('0x32')]=_['keys'](_0x3d2dde[_0x449c('0x32')]);_0x1fd757[_0x449c('0x34')]=_[_0x449c('0x35')](_0x1fd757[_0x449c('0x31')],_0x1fd757['query']);_0x1f64c6[_0x449c('0x36')]=_['intersection'](_0x1fd757[_0x449c('0x31')],qs[_0x449c('0x37')](_0x3d2dde['query'][_0x449c('0x37')]));_0x1f64c6['attributes']=_0x1f64c6[_0x449c('0x36')][_0x449c('0x38')]?_0x1f64c6[_0x449c('0x36')]:_0x1fd757[_0x449c('0x31')];if(_0x3d2dde[_0x449c('0x32')][_0x449c('0x43')]){_0x1f64c6['include']=[{'all':!![]}];}_0x1f64c6=_[_0x449c('0x3e')]({},_0x1f64c6,_0x3d2dde['options']);return db[_0x449c('0x2c')][_0x449c('0x44')](_0x1f64c6)[_0x449c('0x24')](handleEntityNotFound(_0x2c6c03,null))[_0x449c('0x24')](respondWithResult(_0x2c6c03,null))['catch'](handleError(_0x2c6c03,null));};exports[_0x449c('0x45')]=function(_0x3e9841,_0x2a9a7d){return db['OpenchannelTransferReport']['create'](_0x3e9841[_0x449c('0x46')],{})[_0x449c('0x24')](respondWithResult(_0x2a9a7d,0xc9))[_0x449c('0x47')](handleError(_0x2a9a7d,null));};exports[_0x449c('0x48')]=function(_0x17ec70,_0x275521){if(_0x17ec70[_0x449c('0x46')]['id']){delete _0x17ec70['body']['id'];}return db[_0x449c('0x2c')][_0x449c('0x44')]({'where':{'id':_0x17ec70[_0x449c('0x42')]['id']}})[_0x449c('0x24')](handleEntityNotFound(_0x275521,null))[_0x449c('0x24')](saveUpdates(_0x17ec70[_0x449c('0x46')],null))[_0x449c('0x24')](respondWithResult(_0x275521,null))[_0x449c('0x47')](handleError(_0x275521,null));};exports[_0x449c('0x25')]=function(_0x272912,_0x35e1f0){return db[_0x449c('0x2c')][_0x449c('0x44')]({'where':{'id':_0x272912[_0x449c('0x42')]['id']}})[_0x449c('0x24')](handleEntityNotFound(_0x35e1f0,null))[_0x449c('0x24')](removeEntity(_0x35e1f0,null))[_0x449c('0x47')](handleError(_0x35e1f0,null));};exports[_0x449c('0x49')]=function(_0x220434,_0x5ea728){return db[_0x449c('0x2c')]['describe']()[_0x449c('0x24')](respondWithResult(_0x5ea728,null))['catch'](handleError(_0x5ea728,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index fc86638..bc501eb 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 _0xae5e=['./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4360c4,_0x2f8209){var _0x3168c8=function(_0x309523){while(--_0x309523){_0x4360c4['push'](_0x4360c4['shift']());}};_0x3168c8(++_0x2f8209);}(_0xae5e,0x101));var _0xeae5=function(_0x528058,_0x322297){_0x528058=_0x528058-0x0;var _0x3ffb88=_0xae5e[_0x528058];return _0x3ffb88;};'use strict';var _=require(_0xeae5('0x0'));var util=require(_0xeae5('0x1'));var logger=require(_0xeae5('0x2'))(_0xeae5('0x3'));var moment=require(_0xeae5('0x4'));var BPromise=require(_0xeae5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeae5('0x6'));var rimraf=require(_0xeae5('0x7'));var config=require(_0xeae5('0x8'));var attributes=require(_0xeae5('0x9'));module[_0xeae5('0xa')]=function(_0x4c0d45,_0x3f2a16){return _0x4c0d45['define'](_0xeae5('0xb'),attributes,{'tableName':_0xeae5('0xc'),'paranoid':![],'indexes':[{'name':_0xeae5('0xd'),'fields':[_0xeae5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc40f=['OpenchannelTransferReport','uniqueid','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc40f,0xa2));var _0xfc40=function(_0x15bdaf,_0x5b761e){_0x15bdaf=_0x15bdaf-0x0;var _0x2b031d=_0xc40f[_0x15bdaf];return _0x2b031d;};'use strict';var _=require(_0xfc40('0x0'));var util=require(_0xfc40('0x1'));var logger=require('../../config/logger')(_0xfc40('0x2'));var moment=require(_0xfc40('0x3'));var BPromise=require(_0xfc40('0x4'));var rp=require(_0xfc40('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfc40('0x6'));var attributes=require(_0xfc40('0x7'));module['exports']=function(_0x2f09d2,_0x26ca0b){return _0x2f09d2['define'](_0xfc40('0x8'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xfc40('0x9'),'fields':[_0xfc40('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 73f8ba2..7aba5fa 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 _0xe7bb=['stringify','error','code','message','result','catch','util','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','http','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x4662d7,_0x98005b){var _0x213f94=function(_0x172f83){while(--_0x172f83){_0x4662d7['push'](_0x4662d7['shift']());}};_0x213f94(++_0x98005b);}(_0xe7bb,0x1bb));var _0xbe7b=function(_0x16a599,_0x4e9cec){_0x16a599=_0x16a599-0x0;var _0x218dc=_0xe7bb[_0x16a599];return _0x218dc;};'use strict';var _=require('lodash');var util=require(_0xbe7b('0x0'));var moment=require('moment');var BPromise=require(_0xbe7b('0x1'));var rs=require(_0xbe7b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbe7b('0x3'));var logger=require('../../config/logger')(_0xbe7b('0x4'));var config=require('../../config/environment');var jayson=require(_0xbe7b('0x5'));var client=jayson[_0xbe7b('0x6')][_0xbe7b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5c4bad,_0x544ee7,_0x4085e4){return new BPromise(function(_0x228d1,_0x3ca6fb){return client['request'](_0x5c4bad,_0x4085e4)['then'](function(_0xe7445c){logger[_0xbe7b('0x8')](_0xbe7b('0x9'),_0x544ee7,_0xbe7b('0xa'));logger[_0xbe7b('0xb')](_0xbe7b('0xc'),_0x544ee7,_0xbe7b('0xa'),JSON[_0xbe7b('0xd')](_0xe7445c));if(_0xe7445c['error']){if(_0xe7445c[_0xbe7b('0xe')][_0xbe7b('0xf')]===0x1f4){logger[_0xbe7b('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x544ee7,_0xe7445c['error'][_0xbe7b('0x10')]);return _0x3ca6fb(_0xe7445c[_0xbe7b('0xe')]['message']);}logger[_0xbe7b('0xe')](_0xbe7b('0x9'),_0x544ee7,_0xe7445c[_0xbe7b('0xe')][_0xbe7b('0x10')]);return _0x228d1(_0xe7445c[_0xbe7b('0xe')][_0xbe7b('0x10')]);}else{logger[_0xbe7b('0x8')](_0xbe7b('0x9'),_0x544ee7,_0xbe7b('0xa'));_0x228d1(_0xe7445c[_0xbe7b('0x11')]['message']);}})[_0xbe7b('0x12')](function(_0xe6f577){logger[_0xbe7b('0xe')](_0xbe7b('0x9'),_0x544ee7,_0xe6f577);_0x3ca6fb(_0xe6f577);});});} \ No newline at end of file +var _0x1dba=['info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request'];(function(_0x15c8e0,_0x332c04){var _0xcf223b=function(_0x1dbadb){while(--_0x1dbadb){_0x15c8e0['push'](_0x15c8e0['shift']());}};_0xcf223b(++_0x332c04);}(_0x1dba,0x14a));var _0xa1db=function(_0x4c1e45,_0x23d919){_0x4c1e45=_0x4c1e45-0x0;var _0x142bc9=_0x1dba[_0x4c1e45];return _0x142bc9;};'use strict';var _=require('lodash');var util=require(_0xa1db('0x0'));var moment=require(_0xa1db('0x1'));var BPromise=require('bluebird');var rs=require(_0xa1db('0x2'));var fs=require('fs');var Redis=require(_0xa1db('0x3'));var db=require(_0xa1db('0x4'))['db'];var utils=require(_0xa1db('0x5'));var logger=require('../../config/logger')(_0xa1db('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa1db('0x7')][_0xa1db('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x250ec4,_0x41f67e,_0x5bc505){return new BPromise(function(_0x2f4617,_0x27630b){return client[_0xa1db('0x9')](_0x250ec4,_0x5bc505)['then'](function(_0x32f9a8){logger[_0xa1db('0xa')](_0xa1db('0xb'),_0x41f67e,_0xa1db('0xc'));logger[_0xa1db('0xd')](_0xa1db('0xe'),_0x41f67e,_0xa1db('0xc'),JSON[_0xa1db('0xf')](_0x32f9a8));if(_0x32f9a8[_0xa1db('0x10')]){if(_0x32f9a8[_0xa1db('0x10')][_0xa1db('0x11')]===0x1f4){logger['error'](_0xa1db('0xb'),_0x41f67e,_0x32f9a8[_0xa1db('0x10')][_0xa1db('0x12')]);return _0x27630b(_0x32f9a8['error'][_0xa1db('0x12')]);}logger[_0xa1db('0x10')](_0xa1db('0xb'),_0x41f67e,_0x32f9a8[_0xa1db('0x10')]['message']);return _0x2f4617(_0x32f9a8['error'][_0xa1db('0x12')]);}else{logger[_0xa1db('0xa')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x41f67e,_0xa1db('0xc'));_0x2f4617(_0x32f9a8[_0xa1db('0x13')][_0xa1db('0x12')]);}})['catch'](function(_0x35f88a){logger[_0xa1db('0x10')](_0xa1db('0xb'),_0x41f67e,_0x35f88a);_0x27630b(_0x35f88a);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 16d8f40..c7d7cdb 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 _0x9b69=['../../components/auth/service','../../config/environment','./pause.controller','get','isAuthenticated','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1dc6e5,_0x2131e1){var _0x1afab9=function(_0x525b48){while(--_0x525b48){_0x1dc6e5['push'](_0x1dc6e5['shift']());}};_0x1afab9(++_0x2131e1);}(_0x9b69,0x11a));var _0x99b6=function(_0x32ddc9,_0x201095){_0x32ddc9=_0x32ddc9-0x0;var _0x46663c=_0x9b69[_0x32ddc9];return _0x46663c;};'use strict';var multer=require(_0x99b6('0x0'));var util=require(_0x99b6('0x1'));var path=require(_0x99b6('0x2'));var timeout=require(_0x99b6('0x3'));var express=require(_0x99b6('0x4'));var router=express[_0x99b6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x99b6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x99b6('0x7'));var controller=require(_0x99b6('0x8'));router[_0x99b6('0x9')]('/',auth[_0x99b6('0xa')](),controller['index']);router[_0x99b6('0x9')](_0x99b6('0xb'),auth[_0x99b6('0xa')](),controller['show']);router[_0x99b6('0xc')]('/',auth['isAuthenticated'](),controller[_0x99b6('0xd')]);router['put'](_0x99b6('0xb'),auth['isAuthenticated'](),controller[_0x99b6('0xe')]);router[_0x99b6('0xf')]('/:id',auth[_0x99b6('0xa')](),controller[_0x99b6('0x10')]);module[_0x99b6('0x11')]=router; \ No newline at end of file +var _0x7e88=['post','create','put','update','delete','exports','util','path','Router','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated'];(function(_0x4a5a38,_0x2bff51){var _0x10820f=function(_0x2c841a){while(--_0x2c841a){_0x4a5a38['push'](_0x4a5a38['shift']());}};_0x10820f(++_0x2bff51);}(_0x7e88,0x19b));var _0x87e8=function(_0x7ade45,_0x11e098){_0x7ade45=_0x7ade45-0x0;var _0x23d9cb=_0x7e88[_0x7ade45];return _0x23d9cb;};'use strict';var multer=require('multer');var util=require(_0x87e8('0x0'));var path=require(_0x87e8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x87e8('0x2')]();var fs_extra=require(_0x87e8('0x3'));var auth=require(_0x87e8('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./pause.controller');router[_0x87e8('0x5')]('/',auth['isAuthenticated'](),controller[_0x87e8('0x6')]);router[_0x87e8('0x5')](_0x87e8('0x7'),auth[_0x87e8('0x8')](),controller['show']);router[_0x87e8('0x9')]('/',auth[_0x87e8('0x8')](),controller[_0x87e8('0xa')]);router[_0x87e8('0xb')](_0x87e8('0x7'),auth[_0x87e8('0x8')](),controller[_0x87e8('0xc')]);router[_0x87e8('0xd')](_0x87e8('0x7'),auth[_0x87e8('0x8')](),controller['destroy']);module[_0x87e8('0xe')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 06ddefd..e1747b8 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 _0x9156=['name','STRING','sequelize'];(function(_0x367de3,_0x2aa1c3){var _0x238a69=function(_0x2a9d26){while(--_0x2a9d26){_0x367de3['push'](_0x367de3['shift']());}};_0x238a69(++_0x2aa1c3);}(_0x9156,0x1a0));var _0x6915=function(_0x4b0563,_0x3a205c){_0x4b0563=_0x4b0563-0x0;var _0x10da6a=_0x9156[_0x4b0563];return _0x10da6a;};'use strict';var Sequelize=require(_0x6915('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x6915('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x6915('0x2')]}}; \ No newline at end of file +var _0xcfa5=['exports','name','STRING','sequelize'];(function(_0x38323b,_0x5f79df){var _0x2b9af5=function(_0x576caa){while(--_0x576caa){_0x38323b['push'](_0x38323b['shift']());}};_0x2b9af5(++_0x5f79df);}(_0xcfa5,0x1af));var _0x5cfa=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xcfa5[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0x5cfa('0x0'));module[_0x5cfa('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5cfa('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x5cfa('0x3')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 20f52a6..05d25e7 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 _0x4fd7=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','params','include','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x4fd7,0xe6));var _0x74fd=function(_0x783c95,_0x7f428b){_0x783c95=_0x783c95-0x0;var _0x31cce5=_0x4fd7[_0x783c95];return _0x31cce5;};'use strict';var emlformat=require(_0x74fd('0x0'));var rimraf=require(_0x74fd('0x1'));var zipdir=require(_0x74fd('0x2'));var jsonpatch=require(_0x74fd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x74fd('0x4'));var Mustache=require(_0x74fd('0x5'));var util=require('util');var path=require(_0x74fd('0x6'));var sox=require('sox');var csv=require(_0x74fd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x74fd('0x8'));var _=require(_0x74fd('0x9'));var squel=require('squel');var crypto=require(_0x74fd('0xa'));var jsforce=require(_0x74fd('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x74fd('0x7'));var querystring=require(_0x74fd('0xc'));var Papa=require(_0x74fd('0xd'));var Redis=require(_0x74fd('0xe'));var authService=require(_0x74fd('0xf'));var qs=require(_0x74fd('0x10'));var as=require(_0x74fd('0x11'));var hardwareService=require(_0x74fd('0x12'));var logger=require(_0x74fd('0x13'))(_0x74fd('0x14'));var utils=require(_0x74fd('0x15'));var config=require(_0x74fd('0x16'));var licenseUtil=require(_0x74fd('0x17'));var db=require(_0x74fd('0x18'))['db'];function respondWithStatusCode(_0x3fd552,_0x8fafcb){_0x8fafcb=_0x8fafcb||0xcc;return function(_0x4d250d){if(_0x4d250d){return _0x3fd552[_0x74fd('0x19')](_0x8fafcb);}return _0x3fd552[_0x74fd('0x1a')](_0x8fafcb)['end']();};}function respondWithResult(_0x47e63c,_0x3e1d11){_0x3e1d11=_0x3e1d11||0xc8;return function(_0x2a4d2e){if(_0x2a4d2e){return _0x47e63c[_0x74fd('0x1a')](_0x3e1d11)[_0x74fd('0x1b')](_0x2a4d2e);}};}function respondWithFilteredResult(_0x24639c,_0x29bbc2){return function(_0x22e64a){if(_0x22e64a){var _0x127353=_0x22e64a['count'],_0x57a832=_0x29bbc2[_0x74fd('0x1c')],_0x4301a7=_0x29bbc2[_0x74fd('0x1c')]+_0x29bbc2['limit'],_0x10621b;if(_0x4301a7>=_0x127353){_0x4301a7=_0x127353;_0x10621b=0xc8;}else{_0x10621b=0xce;}_0x24639c[_0x74fd('0x1a')](_0x10621b);return _0x24639c[_0x74fd('0x1d')](_0x74fd('0x1e'),_0x57a832+'-'+_0x4301a7+'/'+_0x127353)[_0x74fd('0x1b')](_0x22e64a);}return null;};}function patchUpdates(_0x1f09ec){return function(_0x299f76){try{jsonpatch[_0x74fd('0x1f')](_0x299f76,_0x1f09ec,!![]);}catch(_0x1e42c8){return BPromise[_0x74fd('0x20')](_0x1e42c8);}return _0x299f76[_0x74fd('0x21')]();};}function saveUpdates(_0x5fe487,_0xb23e0){return function(_0x28af28){if(_0x28af28){return _0x28af28[_0x74fd('0x22')](_0x5fe487)[_0x74fd('0x23')](function(_0xe363a3){return _0xe363a3;});}return null;};}function removeEntity(_0x1973a1,_0x204f5f){return function(_0x54fb4d){if(_0x54fb4d){return _0x54fb4d[_0x74fd('0x24')]()[_0x74fd('0x23')](function(){var _0xf2c6ce=_0x54fb4d[_0x74fd('0x25')]({'plain':!![]});var _0x371d9c='Pauses';return db[_0x74fd('0x26')][_0x74fd('0x24')]({'where':{'type':_0x371d9c,'resourceId':_0xf2c6ce['id']}})['then'](function(){return _0x54fb4d;});})[_0x74fd('0x23')](function(){_0x1973a1['status'](0xcc)[_0x74fd('0x27')]();});}};}function handleEntityNotFound(_0x23d0ce,_0x1a559d){return function(_0x33d3d9){if(!_0x33d3d9){_0x23d0ce[_0x74fd('0x19')](0x194);}return _0x33d3d9;};}function handleError(_0x272d16,_0x5e6fd1){_0x5e6fd1=_0x5e6fd1||0x1f4;return function(_0x30132a){logger[_0x74fd('0x28')](_0x30132a[_0x74fd('0x29')]);if(_0x30132a[_0x74fd('0x2a')]){delete _0x30132a['name'];}_0x272d16['status'](_0x5e6fd1)[_0x74fd('0x2b')](_0x30132a);};}exports[_0x74fd('0x2c')]=function(_0x51e574,_0x22a98c){var _0x57f0e6={},_0x4c0609={},_0x1f05ba={'count':0x0,'rows':[]};var _0x9dcd1c=_[_0x74fd('0x2d')](db[_0x74fd('0x2e')][_0x74fd('0x2f')],function(_0x540bfb){return{'name':_0x540bfb[_0x74fd('0x30')],'type':_0x540bfb['type']['key']};});_0x4c0609[_0x74fd('0x31')]=_[_0x74fd('0x2d')](_0x9dcd1c,_0x74fd('0x2a'));_0x4c0609[_0x74fd('0x32')]=_['keys'](_0x51e574[_0x74fd('0x32')]);_0x4c0609[_0x74fd('0x33')]=_[_0x74fd('0x34')](_0x4c0609[_0x74fd('0x31')],_0x4c0609[_0x74fd('0x32')]);_0x57f0e6[_0x74fd('0x35')]=_[_0x74fd('0x34')](_0x4c0609[_0x74fd('0x31')],qs[_0x74fd('0x36')](_0x51e574[_0x74fd('0x32')][_0x74fd('0x36')]));_0x57f0e6[_0x74fd('0x35')]=_0x57f0e6[_0x74fd('0x35')][_0x74fd('0x37')]?_0x57f0e6[_0x74fd('0x35')]:_0x4c0609['model'];if(!_0x51e574[_0x74fd('0x32')][_0x74fd('0x38')](_0x74fd('0x39'))){_0x57f0e6['limit']=qs[_0x74fd('0x3a')](_0x51e574[_0x74fd('0x32')][_0x74fd('0x3a')]);_0x57f0e6[_0x74fd('0x1c')]=qs[_0x74fd('0x1c')](_0x51e574['query'][_0x74fd('0x1c')]);}_0x57f0e6[_0x74fd('0x3b')]=qs[_0x74fd('0x3c')](_0x51e574[_0x74fd('0x32')][_0x74fd('0x3c')]);_0x57f0e6[_0x74fd('0x3d')]=qs[_0x74fd('0x33')](_[_0x74fd('0x3e')](_0x51e574[_0x74fd('0x32')],_0x4c0609[_0x74fd('0x33')]),_0x9dcd1c);if(_0x51e574[_0x74fd('0x32')][_0x74fd('0x3f')]){_0x57f0e6['where']=_[_0x74fd('0x40')](_0x57f0e6[_0x74fd('0x3d')],{'$or':_['map'](_0x9dcd1c,function(_0x4712d1){if(_0x4712d1[_0x74fd('0x41')]!==_0x74fd('0x42')){var _0x1c2808={};_0x1c2808[_0x4712d1[_0x74fd('0x2a')]]={'$like':'%'+_0x51e574[_0x74fd('0x32')]['filter']+'%'};return _0x1c2808;}})});}_0x57f0e6=_[_0x74fd('0x40')]({},_0x57f0e6,_0x51e574[_0x74fd('0x43')]);var _0x5bb3b1={'where':_0x57f0e6[_0x74fd('0x3d')]};return db[_0x74fd('0x2e')]['count'](_0x5bb3b1)[_0x74fd('0x23')](function(_0x403c4e){_0x1f05ba[_0x74fd('0x44')]=_0x403c4e;if(_0x51e574['query'][_0x74fd('0x45')]){_0x57f0e6['include']=[{'all':!![]}];}return db[_0x74fd('0x2e')][_0x74fd('0x46')](_0x57f0e6);})[_0x74fd('0x23')](function(_0x226675){_0x1f05ba['rows']=_0x226675;return _0x1f05ba;})[_0x74fd('0x23')](respondWithFilteredResult(_0x22a98c,_0x57f0e6))['catch'](handleError(_0x22a98c,null));};exports['show']=function(_0x59d957,_0x4fccd0){var _0x325598={'raw':!![],'where':{'id':_0x59d957[_0x74fd('0x47')]['id']}},_0x77c182={};_0x77c182[_0x74fd('0x31')]=_['keys'](db[_0x74fd('0x2e')]['rawAttributes']);_0x77c182[_0x74fd('0x32')]=_['keys'](_0x59d957[_0x74fd('0x32')]);_0x77c182[_0x74fd('0x33')]=_[_0x74fd('0x34')](_0x77c182[_0x74fd('0x31')],_0x77c182[_0x74fd('0x32')]);_0x325598[_0x74fd('0x35')]=_[_0x74fd('0x34')](_0x77c182[_0x74fd('0x31')],qs[_0x74fd('0x36')](_0x59d957[_0x74fd('0x32')][_0x74fd('0x36')]));_0x325598[_0x74fd('0x35')]=_0x325598[_0x74fd('0x35')][_0x74fd('0x37')]?_0x325598[_0x74fd('0x35')]:_0x77c182[_0x74fd('0x31')];if(_0x59d957[_0x74fd('0x32')][_0x74fd('0x45')]){_0x325598[_0x74fd('0x48')]=[{'all':!![]}];}_0x325598=_[_0x74fd('0x40')]({},_0x325598,_0x59d957[_0x74fd('0x43')]);return db[_0x74fd('0x2e')]['find'](_0x325598)['then'](handleEntityNotFound(_0x4fccd0,null))['then'](respondWithResult(_0x4fccd0,null))[_0x74fd('0x49')](handleError(_0x4fccd0,null));};exports[_0x74fd('0x4a')]=function(_0x2919a8,_0x4c6b1a){return db['Pause'][_0x74fd('0x4a')](_0x2919a8['body'],{})[_0x74fd('0x23')](function(_0x439978){var _0x649148=_0x2919a8[_0x74fd('0x4b')][_0x74fd('0x25')]({'plain':!![]});if(!_0x649148)throw new Error(_0x74fd('0x4c'));if(_0x649148[_0x74fd('0x4d')]===_0x74fd('0x4b')){var _0x54df0a=_0x439978['get']({'plain':!![]});var _0x260355=_0x74fd('0x4e');return db['UserProfileSection']['find']({'where':{'name':_0x260355,'userProfileId':_0x649148[_0x74fd('0x4f')]},'raw':!![]})[_0x74fd('0x23')](function(_0x18b361){if(_0x18b361&&_0x18b361['autoAssociation']===0x0){return db[_0x74fd('0x26')][_0x74fd('0x4a')]({'name':_0x54df0a['name'],'resourceId':_0x54df0a['id'],'type':_0x18b361[_0x74fd('0x2a')],'sectionId':_0x18b361['id']},{})[_0x74fd('0x23')](function(){return _0x439978;});}else{return _0x439978;}})['catch'](function(_0x470309){logger['error'](_0x74fd('0x50'),_0x470309);throw _0x470309;});}return _0x439978;})[_0x74fd('0x23')](respondWithResult(_0x4c6b1a,0xc9))[_0x74fd('0x49')](handleError(_0x4c6b1a,null));};exports[_0x74fd('0x22')]=function(_0x1cf948,_0x49cf03){if(_0x1cf948[_0x74fd('0x51')]['id']){delete _0x1cf948[_0x74fd('0x51')]['id'];}return db[_0x74fd('0x2e')][_0x74fd('0x52')]({'where':{'id':_0x1cf948['params']['id']}})[_0x74fd('0x23')](handleEntityNotFound(_0x49cf03,null))[_0x74fd('0x23')](saveUpdates(_0x1cf948[_0x74fd('0x51')],null))[_0x74fd('0x23')](respondWithResult(_0x49cf03,null))[_0x74fd('0x49')](handleError(_0x49cf03,null));};exports['destroy']=function(_0x5b7b1b,_0x4dda0e){return db[_0x74fd('0x2e')][_0x74fd('0x52')]({'where':{'id':_0x5b7b1b['params']['id']}})[_0x74fd('0x23')](handleEntityNotFound(_0x4dda0e,null))[_0x74fd('0x23')](removeEntity(_0x4dda0e,null))[_0x74fd('0x49')](handleError(_0x4dda0e,null));}; \ No newline at end of file +var _0xb205=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','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','sendStatus','status','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','Pauses','UserProfileResource','error','name','map','Pause','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','body'];(function(_0x2d8f50,_0x391eb1){var _0x2ab355=function(_0x567f16){while(--_0x567f16){_0x2d8f50['push'](_0x2d8f50['shift']());}};_0x2ab355(++_0x391eb1);}(_0xb205,0xf0));var _0x5b20=function(_0x418697,_0x578642){_0x418697=_0x418697-0x0;var _0x4f797f=_0xb205[_0x418697];return _0x4f797f;};'use strict';var emlformat=require(_0x5b20('0x0'));var rimraf=require(_0x5b20('0x1'));var zipdir=require(_0x5b20('0x2'));var jsonpatch=require(_0x5b20('0x3'));var rp=require(_0x5b20('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5b20('0x5'));var util=require('util');var path=require(_0x5b20('0x6'));var sox=require(_0x5b20('0x7'));var csv=require('to-csv');var ejs=require(_0x5b20('0x8'));var fs=require('fs');var fs_extra=require(_0x5b20('0x9'));var _=require(_0x5b20('0xa'));var squel=require('squel');var crypto=require(_0x5b20('0xb'));var jsforce=require(_0x5b20('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5b20('0xd'));var Papa=require(_0x5b20('0xe'));var Redis=require(_0x5b20('0xf'));var authService=require(_0x5b20('0x10'));var qs=require(_0x5b20('0x11'));var as=require(_0x5b20('0x12'));var hardwareService=require(_0x5b20('0x13'));var logger=require('../../config/logger')(_0x5b20('0x14'));var utils=require(_0x5b20('0x15'));var config=require(_0x5b20('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a13ac,_0x374632){_0x374632=_0x374632||0xcc;return function(_0xf721a0){if(_0xf721a0){return _0x2a13ac[_0x5b20('0x17')](_0x374632);}return _0x2a13ac[_0x5b20('0x18')](_0x374632)['end']();};}function respondWithResult(_0x42fbb0,_0x32c2df){_0x32c2df=_0x32c2df||0xc8;return function(_0x180185){if(_0x180185){return _0x42fbb0[_0x5b20('0x18')](_0x32c2df)['json'](_0x180185);}};}function respondWithFilteredResult(_0x5247f9,_0x25b9ab){return function(_0x47e80f){if(_0x47e80f){var _0x5ac9db=_0x47e80f[_0x5b20('0x19')],_0x31b9dd=_0x25b9ab[_0x5b20('0x1a')],_0x52042b=_0x25b9ab['offset']+_0x25b9ab[_0x5b20('0x1b')],_0x43b7b0;if(_0x52042b>=_0x5ac9db){_0x52042b=_0x5ac9db;_0x43b7b0=0xc8;}else{_0x43b7b0=0xce;}_0x5247f9[_0x5b20('0x18')](_0x43b7b0);return _0x5247f9[_0x5b20('0x1c')](_0x5b20('0x1d'),_0x31b9dd+'-'+_0x52042b+'/'+_0x5ac9db)['json'](_0x47e80f);}return null;};}function patchUpdates(_0x1754c1){return function(_0x55ae4d){try{jsonpatch[_0x5b20('0x1e')](_0x55ae4d,_0x1754c1,!![]);}catch(_0x30da3b){return BPromise['reject'](_0x30da3b);}return _0x55ae4d[_0x5b20('0x1f')]();};}function saveUpdates(_0x54cdf3,_0x3b7aea){return function(_0x4e9ae9){if(_0x4e9ae9){return _0x4e9ae9[_0x5b20('0x20')](_0x54cdf3)[_0x5b20('0x21')](function(_0x59f614){return _0x59f614;});}return null;};}function removeEntity(_0x2d404f,_0x52e27f){return function(_0x4f291e){if(_0x4f291e){return _0x4f291e[_0x5b20('0x22')]()['then'](function(){var _0x4b4076=_0x4f291e[_0x5b20('0x23')]({'plain':!![]});var _0x18f555=_0x5b20('0x24');return db[_0x5b20('0x25')][_0x5b20('0x22')]({'where':{'type':_0x18f555,'resourceId':_0x4b4076['id']}})[_0x5b20('0x21')](function(){return _0x4f291e;});})[_0x5b20('0x21')](function(){_0x2d404f[_0x5b20('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x285249,_0x102b05){return function(_0x205c11){if(!_0x205c11){_0x285249[_0x5b20('0x17')](0x194);}return _0x205c11;};}function handleError(_0x1ea098,_0x296ae4){_0x296ae4=_0x296ae4||0x1f4;return function(_0x50d335){logger[_0x5b20('0x26')](_0x50d335['stack']);if(_0x50d335[_0x5b20('0x27')]){delete _0x50d335[_0x5b20('0x27')];}_0x1ea098[_0x5b20('0x18')](_0x296ae4)['send'](_0x50d335);};}exports['index']=function(_0x15981f,_0x27aefb){var _0x508618={},_0x551224={},_0x38351c={'count':0x0,'rows':[]};var _0x5d7e6c=_[_0x5b20('0x28')](db[_0x5b20('0x29')][_0x5b20('0x2a')],function(_0x344688){return{'name':_0x344688['fieldName'],'type':_0x344688[_0x5b20('0x2b')][_0x5b20('0x2c')]};});_0x551224[_0x5b20('0x2d')]=_[_0x5b20('0x28')](_0x5d7e6c,'name');_0x551224[_0x5b20('0x2e')]=_[_0x5b20('0x2f')](_0x15981f[_0x5b20('0x2e')]);_0x551224[_0x5b20('0x30')]=_[_0x5b20('0x31')](_0x551224[_0x5b20('0x2d')],_0x551224[_0x5b20('0x2e')]);_0x508618[_0x5b20('0x32')]=_[_0x5b20('0x31')](_0x551224[_0x5b20('0x2d')],qs[_0x5b20('0x33')](_0x15981f[_0x5b20('0x2e')][_0x5b20('0x33')]));_0x508618[_0x5b20('0x32')]=_0x508618[_0x5b20('0x32')]['length']?_0x508618['attributes']:_0x551224['model'];if(!_0x15981f[_0x5b20('0x2e')][_0x5b20('0x34')](_0x5b20('0x35'))){_0x508618[_0x5b20('0x1b')]=qs[_0x5b20('0x1b')](_0x15981f['query'][_0x5b20('0x1b')]);_0x508618[_0x5b20('0x1a')]=qs[_0x5b20('0x1a')](_0x15981f[_0x5b20('0x2e')][_0x5b20('0x1a')]);}_0x508618[_0x5b20('0x36')]=qs[_0x5b20('0x37')](_0x15981f['query']['sort']);_0x508618['where']=qs[_0x5b20('0x30')](_[_0x5b20('0x38')](_0x15981f[_0x5b20('0x2e')],_0x551224[_0x5b20('0x30')]),_0x5d7e6c);if(_0x15981f[_0x5b20('0x2e')][_0x5b20('0x39')]){_0x508618['where']=_['merge'](_0x508618[_0x5b20('0x3a')],{'$or':_[_0x5b20('0x28')](_0x5d7e6c,function(_0x53abbf){if(_0x53abbf[_0x5b20('0x2b')]!==_0x5b20('0x3b')){var _0x1c9e86={};_0x1c9e86[_0x53abbf[_0x5b20('0x27')]]={'$like':'%'+_0x15981f[_0x5b20('0x2e')][_0x5b20('0x39')]+'%'};return _0x1c9e86;}})});}_0x508618=_[_0x5b20('0x3c')]({},_0x508618,_0x15981f[_0x5b20('0x3d')]);var _0xce0cec={'where':_0x508618[_0x5b20('0x3a')]};return db[_0x5b20('0x29')][_0x5b20('0x19')](_0xce0cec)['then'](function(_0x2cecc1){_0x38351c[_0x5b20('0x19')]=_0x2cecc1;if(_0x15981f[_0x5b20('0x2e')][_0x5b20('0x3e')]){_0x508618[_0x5b20('0x3f')]=[{'all':!![]}];}return db[_0x5b20('0x29')][_0x5b20('0x40')](_0x508618);})[_0x5b20('0x21')](function(_0x3ce01d){_0x38351c[_0x5b20('0x41')]=_0x3ce01d;return _0x38351c;})[_0x5b20('0x21')](respondWithFilteredResult(_0x27aefb,_0x508618))[_0x5b20('0x42')](handleError(_0x27aefb,null));};exports[_0x5b20('0x43')]=function(_0x2ea494,_0x831edd){var _0x3bfe09={'raw':!![],'where':{'id':_0x2ea494[_0x5b20('0x44')]['id']}},_0x8557e8={};_0x8557e8[_0x5b20('0x2d')]=_[_0x5b20('0x2f')](db[_0x5b20('0x29')][_0x5b20('0x2a')]);_0x8557e8[_0x5b20('0x2e')]=_[_0x5b20('0x2f')](_0x2ea494[_0x5b20('0x2e')]);_0x8557e8[_0x5b20('0x30')]=_[_0x5b20('0x31')](_0x8557e8['model'],_0x8557e8[_0x5b20('0x2e')]);_0x3bfe09[_0x5b20('0x32')]=_[_0x5b20('0x31')](_0x8557e8[_0x5b20('0x2d')],qs[_0x5b20('0x33')](_0x2ea494[_0x5b20('0x2e')][_0x5b20('0x33')]));_0x3bfe09['attributes']=_0x3bfe09[_0x5b20('0x32')][_0x5b20('0x45')]?_0x3bfe09[_0x5b20('0x32')]:_0x8557e8[_0x5b20('0x2d')];if(_0x2ea494[_0x5b20('0x2e')][_0x5b20('0x3e')]){_0x3bfe09[_0x5b20('0x3f')]=[{'all':!![]}];}_0x3bfe09=_['merge']({},_0x3bfe09,_0x2ea494[_0x5b20('0x3d')]);return db[_0x5b20('0x29')]['find'](_0x3bfe09)[_0x5b20('0x21')](handleEntityNotFound(_0x831edd,null))[_0x5b20('0x21')](respondWithResult(_0x831edd,null))['catch'](handleError(_0x831edd,null));};exports[_0x5b20('0x46')]=function(_0x365af7,_0x357ef0){return db[_0x5b20('0x29')][_0x5b20('0x46')](_0x365af7[_0x5b20('0x47')],{})[_0x5b20('0x21')](function(_0x36c204){var _0x58bd13=_0x365af7[_0x5b20('0x48')][_0x5b20('0x23')]({'plain':!![]});if(!_0x58bd13)throw new Error(_0x5b20('0x49'));if(_0x58bd13[_0x5b20('0x4a')]===_0x5b20('0x48')){var _0x380d76=_0x36c204['get']({'plain':!![]});var _0x4536ab=_0x5b20('0x24');return db['UserProfileSection'][_0x5b20('0x4b')]({'where':{'name':_0x4536ab,'userProfileId':_0x58bd13['userProfileId']},'raw':!![]})[_0x5b20('0x21')](function(_0x3c224d){if(_0x3c224d&&_0x3c224d[_0x5b20('0x4c')]===0x0){return db[_0x5b20('0x25')]['create']({'name':_0x380d76[_0x5b20('0x27')],'resourceId':_0x380d76['id'],'type':_0x3c224d[_0x5b20('0x27')],'sectionId':_0x3c224d['id']},{})[_0x5b20('0x21')](function(){return _0x36c204;});}else{return _0x36c204;}})[_0x5b20('0x42')](function(_0x2cd012){logger[_0x5b20('0x26')](_0x5b20('0x4d'),_0x2cd012);throw _0x2cd012;});}return _0x36c204;})['then'](respondWithResult(_0x357ef0,0xc9))['catch'](handleError(_0x357ef0,null));};exports[_0x5b20('0x20')]=function(_0x31d8b2,_0x162b7b){if(_0x31d8b2['body']['id']){delete _0x31d8b2[_0x5b20('0x47')]['id'];}return db[_0x5b20('0x29')][_0x5b20('0x4b')]({'where':{'id':_0x31d8b2['params']['id']}})[_0x5b20('0x21')](handleEntityNotFound(_0x162b7b,null))[_0x5b20('0x21')](saveUpdates(_0x31d8b2[_0x5b20('0x47')],null))['then'](respondWithResult(_0x162b7b,null))[_0x5b20('0x42')](handleError(_0x162b7b,null));};exports['destroy']=function(_0x3bdcca,_0x455e67){return db[_0x5b20('0x29')][_0x5b20('0x4b')]({'where':{'id':_0x3bdcca['params']['id']}})[_0x5b20('0x21')](handleEntityNotFound(_0x455e67,null))['then'](removeEntity(_0x455e67,null))[_0x5b20('0x42')](handleError(_0x455e67,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 29bb16f..64e6e2c 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 _0x5464=['moment','request-promise','rimraf','../../config/environment','./pause.attributes','exports','Pause','tools_pauses','lodash','util','../../config/logger'];(function(_0x46969b,_0x30a77a){var _0x40b2de=function(_0x5b53a5){while(--_0x5b53a5){_0x46969b['push'](_0x46969b['shift']());}};_0x40b2de(++_0x30a77a);}(_0x5464,0x15d));var _0x4546=function(_0x2e710b,_0x5f0c2a){_0x2e710b=_0x2e710b-0x0;var _0x1647fb=_0x5464[_0x2e710b];return _0x1647fb;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var logger=require(_0x4546('0x2'))('api');var moment=require(_0x4546('0x3'));var BPromise=require('bluebird');var rp=require(_0x4546('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4546('0x5'));var config=require(_0x4546('0x6'));var attributes=require(_0x4546('0x7'));module[_0x4546('0x8')]=function(_0x54228a,_0x57391f){return _0x54228a['define'](_0x4546('0x9'),attributes,{'tableName':_0x4546('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf567=['rimraf','../../config/environment','./pause.attributes','define','tools_pauses','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x1a229a,_0x3f1490){var _0x2aea6a=function(_0x325fdc){while(--_0x325fdc){_0x1a229a['push'](_0x1a229a['shift']());}};_0x2aea6a(++_0x3f1490);}(_0xf567,0x118));var _0x7f56=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf567[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x7f56('0x0'));var util=require(_0x7f56('0x1'));var logger=require(_0x7f56('0x2'))('api');var moment=require(_0x7f56('0x3'));var BPromise=require(_0x7f56('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f56('0x5'));var rimraf=require(_0x7f56('0x6'));var config=require(_0x7f56('0x7'));var attributes=require(_0x7f56('0x8'));module['exports']=function(_0x444b66,_0x215ff1){return _0x444b66[_0x7f56('0x9')]('Pause',attributes,{'tableName':_0x7f56('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 a251fc9..0f345d3 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 _0x4d7f=['find','options','where','include','map','model','attributes','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','ShowPause','Pause'];(function(_0x10560a,_0x194ba6){var _0x3b475d=function(_0x55c755){while(--_0x55c755){_0x10560a['push'](_0x10560a['shift']());}};_0x3b475d(++_0x194ba6);}(_0x4d7f,0xc1));var _0xf4d7=function(_0x334e58,_0x231265){_0x334e58=_0x334e58-0x0;var _0x581fd0=_0x4d7f[_0x334e58];return _0x581fd0;};'use strict';var _=require(_0xf4d7('0x0'));var util=require('util');var moment=require(_0xf4d7('0x1'));var BPromise=require('bluebird');var rs=require(_0xf4d7('0x2'));var fs=require('fs');var Redis=require(_0xf4d7('0x3'));var db=require(_0xf4d7('0x4'))['db'];var utils=require(_0xf4d7('0x5'));var logger=require(_0xf4d7('0x6'))('rpc');var config=require(_0xf4d7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf4d7('0x8')][_0xf4d7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15491f,_0x4c9ff8,_0x2d459e){return new BPromise(function(_0x43036b,_0x5cfee6){return client[_0xf4d7('0xa')](_0x15491f,_0x2d459e)[_0xf4d7('0xb')](function(_0x473d45){logger['info'](_0xf4d7('0xc'),_0x4c9ff8,_0xf4d7('0xd'));logger[_0xf4d7('0xe')](_0xf4d7('0xf'),_0x4c9ff8,_0xf4d7('0xd'),JSON[_0xf4d7('0x10')](_0x473d45));if(_0x473d45[_0xf4d7('0x11')]){if(_0x473d45['error'][_0xf4d7('0x12')]===0x1f4){logger['error'](_0xf4d7('0xc'),_0x4c9ff8,_0x473d45[_0xf4d7('0x11')][_0xf4d7('0x13')]);return _0x5cfee6(_0x473d45[_0xf4d7('0x11')][_0xf4d7('0x13')]);}logger[_0xf4d7('0x11')]('Pause,\x20%s,\x20%s',_0x4c9ff8,_0x473d45['error'][_0xf4d7('0x13')]);return _0x43036b(_0x473d45[_0xf4d7('0x11')][_0xf4d7('0x13')]);}else{logger[_0xf4d7('0x14')](_0xf4d7('0xc'),_0x4c9ff8,_0xf4d7('0xd'));_0x43036b(_0x473d45['result']['message']);}})[_0xf4d7('0x15')](function(_0x354d4a){logger['error'](_0xf4d7('0xc'),_0x4c9ff8,_0x354d4a);_0x5cfee6(_0x354d4a);});});}exports[_0xf4d7('0x16')]=function(_0x264fc3){var _0x35be3e=this;return new Promise(function(_0x4cb842,_0x3201f5){return db[_0xf4d7('0x17')][_0xf4d7('0x18')]({'raw':_0x264fc3['options']?_0x264fc3[_0xf4d7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x264fc3[_0xf4d7('0x19')]?_0x264fc3['options'][_0xf4d7('0x1a')]||null:null,'attributes':_0x264fc3[_0xf4d7('0x19')]?_0x264fc3[_0xf4d7('0x19')]['attributes']||null:null,'include':_0x264fc3['options']?_0x264fc3[_0xf4d7('0x19')][_0xf4d7('0x1b')]?_[_0xf4d7('0x1c')](_0x264fc3[_0xf4d7('0x19')][_0xf4d7('0x1b')],function(_0x4b6b6c){return{'model':db[_0x4b6b6c[_0xf4d7('0x1d')]],'as':_0x4b6b6c['as'],'attributes':_0x4b6b6c[_0xf4d7('0x1e')],'include':_0x4b6b6c[_0xf4d7('0x1b')]?_['map'](_0x4b6b6c[_0xf4d7('0x1b')],function(_0x25842f){return{'model':db[_0x25842f['model']],'as':_0x25842f['as'],'attributes':_0x25842f['attributes'],'include':_0x25842f[_0xf4d7('0x1b')]?_[_0xf4d7('0x1c')](_0x25842f[_0xf4d7('0x1b')],function(_0x55f775){return{'model':db[_0x55f775['model']],'as':_0x55f775['as'],'attributes':_0x55f775['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x924d71){logger[_0xf4d7('0x14')]('ShowPause',_0x264fc3);logger['debug']('ShowPause',_0x264fc3,JSON['stringify'](_0x924d71));_0x4cb842(_0x924d71);})[_0xf4d7('0x15')](function(_0x374ada){logger[_0xf4d7('0x11')]('ShowPause',_0x374ada[_0xf4d7('0x13')],_0x264fc3);_0x3201f5(_0x35be3e[_0xf4d7('0x11')](0x1f4,_0x374ada['message']));});});}; \ No newline at end of file +var _0x31f0=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowPause','find','options','raw','attributes','include','map','model'];(function(_0x6fa261,_0x596489){var _0x2938d3=function(_0x51fd60){while(--_0x51fd60){_0x6fa261['push'](_0x6fa261['shift']());}};_0x2938d3(++_0x596489);}(_0x31f0,0x1a0));var _0x031f=function(_0x4885a6,_0x18532f){_0x4885a6=_0x4885a6-0x0;var _0x900359=_0x31f0[_0x4885a6];return _0x900359;};'use strict';var _=require(_0x031f('0x0'));var util=require(_0x031f('0x1'));var moment=require('moment');var BPromise=require(_0x031f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var utils=require(_0x031f('0x5'));var logger=require(_0x031f('0x6'))(_0x031f('0x7'));var config=require(_0x031f('0x8'));var jayson=require(_0x031f('0x9'));var client=jayson['client'][_0x031f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10143d,_0x473bc0,_0x12f507){return new BPromise(function(_0x4bd5dd,_0xb856c1){return client[_0x031f('0xb')](_0x10143d,_0x12f507)[_0x031f('0xc')](function(_0xcfa1be){logger[_0x031f('0xd')](_0x031f('0xe'),_0x473bc0,_0x031f('0xf'));logger[_0x031f('0x10')](_0x031f('0x11'),_0x473bc0,_0x031f('0xf'),JSON[_0x031f('0x12')](_0xcfa1be));if(_0xcfa1be[_0x031f('0x13')]){if(_0xcfa1be[_0x031f('0x13')][_0x031f('0x14')]===0x1f4){logger['error'](_0x031f('0xe'),_0x473bc0,_0xcfa1be[_0x031f('0x13')][_0x031f('0x15')]);return _0xb856c1(_0xcfa1be[_0x031f('0x13')]['message']);}logger['error'](_0x031f('0xe'),_0x473bc0,_0xcfa1be[_0x031f('0x13')][_0x031f('0x15')]);return _0x4bd5dd(_0xcfa1be[_0x031f('0x13')][_0x031f('0x15')]);}else{logger[_0x031f('0xd')](_0x031f('0xe'),_0x473bc0,_0x031f('0xf'));_0x4bd5dd(_0xcfa1be[_0x031f('0x16')][_0x031f('0x15')]);}})[_0x031f('0x17')](function(_0x4958f7){logger['error'](_0x031f('0xe'),_0x473bc0,_0x4958f7);_0xb856c1(_0x4958f7);});});}exports[_0x031f('0x18')]=function(_0x52fd14){var _0x1f7120=this;return new Promise(function(_0x4e1cb1,_0x21b655){return db['Pause'][_0x031f('0x19')]({'raw':_0x52fd14[_0x031f('0x1a')]?_0x52fd14[_0x031f('0x1a')][_0x031f('0x1b')]===undefined?!![]:![]:!![],'where':_0x52fd14[_0x031f('0x1a')]?_0x52fd14['options']['where']||null:null,'attributes':_0x52fd14[_0x031f('0x1a')]?_0x52fd14[_0x031f('0x1a')][_0x031f('0x1c')]||null:null,'include':_0x52fd14[_0x031f('0x1a')]?_0x52fd14[_0x031f('0x1a')][_0x031f('0x1d')]?_[_0x031f('0x1e')](_0x52fd14['options'][_0x031f('0x1d')],function(_0x48e9c8){return{'model':db[_0x48e9c8[_0x031f('0x1f')]],'as':_0x48e9c8['as'],'attributes':_0x48e9c8['attributes'],'include':_0x48e9c8[_0x031f('0x1d')]?_[_0x031f('0x1e')](_0x48e9c8[_0x031f('0x1d')],function(_0x33e53d){return{'model':db[_0x33e53d[_0x031f('0x1f')]],'as':_0x33e53d['as'],'attributes':_0x33e53d[_0x031f('0x1c')],'include':_0x33e53d[_0x031f('0x1d')]?_['map'](_0x33e53d[_0x031f('0x1d')],function(_0xec0e21){return{'model':db[_0xec0e21[_0x031f('0x1f')]],'as':_0xec0e21['as'],'attributes':_0xec0e21['attributes']};}):[]};}):[]};}):[]:[]})[_0x031f('0xc')](function(_0xc13976){logger['info'](_0x031f('0x18'),_0x52fd14);logger[_0x031f('0x10')](_0x031f('0x18'),_0x52fd14,JSON[_0x031f('0x12')](_0xc13976));_0x4e1cb1(_0xc13976);})[_0x031f('0x17')](function(_0x1b36fb){logger['error']('ShowPause',_0x1b36fb[_0x031f('0x15')],_0x52fd14);_0x21b655(_0x1f7120[_0x031f('0x13')](0x1f4,_0x1b36fb[_0x031f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 5feaaa2..a2b1b3e 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 _0xf6dd=['download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','update','delete','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id','isAuthenticated','show','/:id/download'];(function(_0x1221ff,_0x456bf5){var _0x3c8ff7=function(_0x482746){while(--_0x482746){_0x1221ff['push'](_0x1221ff['shift']());}};_0x3c8ff7(++_0x456bf5);}(_0xf6dd,0x14e));var _0xdf6d=function(_0x260d17,_0x41db16){_0x260d17=_0x260d17-0x0;var _0x11dc8d=_0xf6dd[_0x260d17];return _0x11dc8d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdf6d('0x0'));var timeout=require(_0xdf6d('0x1'));var express=require(_0xdf6d('0x2'));var router=express['Router']();var fs_extra=require(_0xdf6d('0x3'));var auth=require(_0xdf6d('0x4'));var interaction=require(_0xdf6d('0x5'));var config=require(_0xdf6d('0x6'));var controller=require(_0xdf6d('0x7'));router[_0xdf6d('0x8')]('/',auth['isAuthenticated'](),controller[_0xdf6d('0x9')]);router[_0xdf6d('0x8')](_0xdf6d('0xa'),controller[_0xdf6d('0xb')]);router['get'](_0xdf6d('0xc'),auth[_0xdf6d('0xd')](),controller[_0xdf6d('0xe')]);router['get'](_0xdf6d('0xf'),auth['isAuthenticated'](),controller[_0xdf6d('0x10')]);var upload=multer({'storage':multer[_0xdf6d('0x11')]({'destination':function(_0x213ff7,_0x2d5fc5,_0xddee88){_0xddee88(null,path[_0xdf6d('0x12')](config[_0xdf6d('0x13')],'server/files/plugins'));},'filename':function(_0x4de30d,_0x185413,_0x4d6400){_0x185413['originalname']=_0x185413[_0xdf6d('0x14')][_0xdf6d('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4d6400(null,util[_0xdf6d('0x16')](_0xdf6d('0x17'),path[_0xdf6d('0x18')](_0x185413[_0xdf6d('0x14')],path[_0xdf6d('0x19')](_0x185413['originalname'])),Date[_0xdf6d('0x1a')](),path[_0xdf6d('0x19')](_0x185413[_0xdf6d('0x14')])));}})});router[_0xdf6d('0x1b')]('/',upload[_0xdf6d('0x1c')](_0xdf6d('0x1d')),controller[_0xdf6d('0x1e')]);router['post'](_0xdf6d('0xa'),controller[_0xdf6d('0x1f')]);router[_0xdf6d('0x20')](_0xdf6d('0xc'),auth['isAuthenticated'](),controller[_0xdf6d('0x21')]);router[_0xdf6d('0x22')](_0xdf6d('0xc'),auth['isAuthenticated'](),controller[_0xdf6d('0x22')]);module['exports']=router; \ No newline at end of file +var _0xa921=['now','post','single','file','upload','webhookPost','put','update','delete','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','index','get','/webhook','webhookGet','/:id','isAuthenticated','show','/:id/download','download','root','originalname','replace','format','%s-%s%s','basename','extname'];(function(_0x3b01db,_0x2b4cf5){var _0x554f13=function(_0x54108d){while(--_0x54108d){_0x3b01db['push'](_0x3b01db['shift']());}};_0x554f13(++_0x2b4cf5);}(_0xa921,0xaf));var _0x1a92=function(_0x34ddf5,_0x4e99f4){_0x34ddf5=_0x34ddf5-0x0;var _0x4e47e4=_0xa921[_0x34ddf5];return _0x4e47e4;};'use strict';var multer=require(_0x1a92('0x0'));var util=require(_0x1a92('0x1'));var path=require(_0x1a92('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1a92('0x3'));var interaction=require(_0x1a92('0x4'));var config=require(_0x1a92('0x5'));var controller=require(_0x1a92('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x1a92('0x7')]);router[_0x1a92('0x8')](_0x1a92('0x9'),controller[_0x1a92('0xa')]);router['get'](_0x1a92('0xb'),auth[_0x1a92('0xc')](),controller[_0x1a92('0xd')]);router[_0x1a92('0x8')](_0x1a92('0xe'),auth[_0x1a92('0xc')](),controller[_0x1a92('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2e22e8,_0xd92e03,_0x3f2d2b){_0x3f2d2b(null,path['join'](config[_0x1a92('0x10')],'server/files/plugins'));},'filename':function(_0x35570d,_0x3e4ffe,_0x4202bc){_0x3e4ffe[_0x1a92('0x11')]=_0x3e4ffe[_0x1a92('0x11')][_0x1a92('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4202bc(null,util[_0x1a92('0x13')](_0x1a92('0x14'),path[_0x1a92('0x15')](_0x3e4ffe[_0x1a92('0x11')],path[_0x1a92('0x16')](_0x3e4ffe[_0x1a92('0x11')])),Date[_0x1a92('0x17')](),path[_0x1a92('0x16')](_0x3e4ffe['originalname'])));}})});router[_0x1a92('0x18')]('/',upload[_0x1a92('0x19')](_0x1a92('0x1a')),controller[_0x1a92('0x1b')]);router[_0x1a92('0x18')](_0x1a92('0x9'),controller[_0x1a92('0x1c')]);router[_0x1a92('0x1d')](_0x1a92('0xb'),auth[_0x1a92('0xc')](),controller[_0x1a92('0x1e')]);router[_0x1a92('0x1f')]('/:id',auth[_0x1a92('0xc')](),controller[_0x1a92('0x1f')]);module[_0x1a92('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index e05bbe0..0843623 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 _0xc878=['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.','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x1ae615,_0x457be2){var _0x52baa1=function(_0x7ecaf5){while(--_0x7ecaf5){_0x1ae615['push'](_0x1ae615['shift']());}};_0x52baa1(++_0x457be2);}(_0xc878,0x10f));var _0x8c87=function(_0x36d203,_0x3653f3){_0x36d203=_0x36d203-0x0;var _0x2f9e62=_0xc878[_0x36d203];return _0x2f9e62;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8c87('0x0')]},'type':{'type':Sequelize[_0x8c87('0x1')](_0x8c87('0x2'),'script')},'description':{'type':Sequelize[_0x8c87('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x8c87('0x0')],'comment':_0x8c87('0x4')},'active':{'type':Sequelize[_0x8c87('0x5')],'defaultValue':0x0,'comment':_0x8c87('0x6')},'sidebar':{'type':Sequelize['ENUM'](_0x8c87('0x7'),_0x8c87('0x8'),_0x8c87('0x9'),_0x8c87('0xa')),'defaultValue':_0x8c87('0x9'),'comment':_0x8c87('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x8c87('0x0')]},'agentUrl':{'type':Sequelize[_0x8c87('0x0')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2c8d=['ENUM','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN'];(function(_0x480470,_0x36f644){var _0x4360a0=function(_0x32a63f){while(--_0x32a63f){_0x480470['push'](_0x480470['shift']());}};_0x4360a0(++_0x36f644);}(_0x2c8d,0x1a6));var _0xd2c8=function(_0x111e83,_0x2b0429){_0x111e83=_0x111e83-0x0;var _0x235ccd=_0x2c8d[_0x111e83];return _0x235ccd;};'use strict';var Sequelize=require('sequelize');module[_0xd2c8('0x0')]={'name':{'type':Sequelize[_0xd2c8('0x1')]},'type':{'type':Sequelize['ENUM'](_0xd2c8('0x2'),_0xd2c8('0x3'))},'description':{'type':Sequelize[_0xd2c8('0x4')]},'version':{'type':Sequelize[_0xd2c8('0x4')]},'path':{'type':Sequelize[_0xd2c8('0x1')],'comment':_0xd2c8('0x5')},'active':{'type':Sequelize[_0xd2c8('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xd2c8('0x7')](_0xd2c8('0x8'),_0xd2c8('0x9'),_0xd2c8('0xa'),_0xd2c8('0xb')),'defaultValue':_0xd2c8('0xa'),'comment':_0xd2c8('0xc')},'icon':{'type':Sequelize[_0xd2c8('0x1')]},'adminUrl':{'type':Sequelize[_0xd2c8('0x1')]},'agentUrl':{'type':Sequelize[_0xd2c8('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xd2c8('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 5d4384e..923a1c0 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 _0xe0ac=['icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','create','body','role','userProfileId','user','UserProfileSection','Plugins','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','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','method','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/util','../../mysqldb','defaults','localhost','redis','./plugin.socket','register','sendStatus','status','end','count','offset','set','Content-Range','json','apply','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','Plugin','fieldName','type','key','model','keys','filters','attributes','query','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','catch','params','intersection','fields','include','find','download','root','server/files/plugins','format','%s.zip','basename','zip','warning','code','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','dirname','attachments/**/*','finalize','Plugin\x20not\x20found','unlinkSync','info','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','some','Plugin\x20manifest\x20missing','manifest.json','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','undefined','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','always','icon'];(function(_0x463790,_0x2ed87b){var _0x52e9de=function(_0x2cde23){while(--_0x2cde23){_0x463790['push'](_0x463790['shift']());}};_0x52e9de(++_0x2ed87b);}(_0xe0ac,0x164));var _0xce0a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe0ac[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xce0a('0x0'));var zipdir=require(_0xce0a('0x1'));var jsonpatch=require(_0xce0a('0x2'));var rp=require(_0xce0a('0x3'));var moment=require(_0xce0a('0x4'));var BPromise=require(_0xce0a('0x5'));var Mustache=require(_0xce0a('0x6'));var util=require('util');var path=require(_0xce0a('0x7'));var sox=require(_0xce0a('0x8'));var csv=require(_0xce0a('0x9'));var ejs=require(_0xce0a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce0a('0xb'));var squel=require(_0xce0a('0xc'));var crypto=require(_0xce0a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xce0a('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0xce0a('0x0'));var archiver=require(_0xce0a('0xf'));var Redis=require(_0xce0a('0x10'));var authService=require(_0xce0a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xce0a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xce0a('0x13'));var db=require(_0xce0a('0x14'))['db'];config['redis']=_[_0xce0a('0x15')](config['redis'],{'host':_0xce0a('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xce0a('0x17')]));require(_0xce0a('0x18'))[_0xce0a('0x19')](socket);function respondWithStatusCode(_0x178d6f,_0x24e944){_0x24e944=_0x24e944||0xcc;return function(_0x874de1){if(_0x874de1){return _0x178d6f[_0xce0a('0x1a')](_0x24e944);}return _0x178d6f[_0xce0a('0x1b')](_0x24e944)[_0xce0a('0x1c')]();};}function respondWithResult(_0x5cde93,_0x189f3d){_0x189f3d=_0x189f3d||0xc8;return function(_0x5676e1){if(_0x5676e1){return _0x5cde93[_0xce0a('0x1b')](_0x189f3d)['json'](_0x5676e1);}};}function respondWithFilteredResult(_0x28c915,_0x227d4d){return function(_0x25269f){if(_0x25269f){var _0x38c21e=_0x25269f[_0xce0a('0x1d')],_0x483fd3=_0x227d4d[_0xce0a('0x1e')],_0x4699ae=_0x227d4d['offset']+_0x227d4d['limit'],_0x1802a3;if(_0x4699ae>=_0x38c21e){_0x4699ae=_0x38c21e;_0x1802a3=0xc8;}else{_0x1802a3=0xce;}_0x28c915[_0xce0a('0x1b')](_0x1802a3);return _0x28c915[_0xce0a('0x1f')](_0xce0a('0x20'),_0x483fd3+'-'+_0x4699ae+'/'+_0x38c21e)[_0xce0a('0x21')](_0x25269f);}return null;};}function patchUpdates(_0xc27348){return function(_0x40a24a){try{jsonpatch[_0xce0a('0x22')](_0x40a24a,_0xc27348,!![]);}catch(_0x406e29){return BPromise['reject'](_0x406e29);}return _0x40a24a[_0xce0a('0x23')]();};}function saveUpdates(_0x3aa7fb,_0x2529f6){return function(_0x389ce1){if(_0x389ce1){return _0x389ce1[_0xce0a('0x24')](_0x3aa7fb)[_0xce0a('0x25')](function(_0xa890a9){return _0xa890a9;});}return null;};}function removeEntity(_0x556bf5,_0x4507fd){return function(_0x532a55){if(_0x532a55){return _0x532a55[_0xce0a('0x26')]()[_0xce0a('0x25')](function(){var _0x1efc7a=_0x532a55[_0xce0a('0x27')]({'plain':!![]});var _0x472bf3='Plugins';return db[_0xce0a('0x28')][_0xce0a('0x26')]({'where':{'type':_0x472bf3,'resourceId':_0x1efc7a['id']}})[_0xce0a('0x25')](function(){return _0x532a55;});})[_0xce0a('0x25')](function(){_0x556bf5[_0xce0a('0x1b')](0xcc)[_0xce0a('0x1c')]();});}};}function handleEntityNotFound(_0x22b1b3,_0x1d71ea){return function(_0x32263e){if(!_0x32263e){_0x22b1b3[_0xce0a('0x1a')](0x194);}return _0x32263e;};}function handleError(_0x51b521,_0x423124){_0x423124=_0x423124||0x1f4;return function(_0x1b0455){logger['error'](_0x1b0455[_0xce0a('0x29')]);if(_0x1b0455['name']){delete _0x1b0455[_0xce0a('0x2a')];}_0x51b521[_0xce0a('0x1b')](_0x423124)[_0xce0a('0x2b')](_0x1b0455);};}exports[_0xce0a('0x2c')]=function(_0xa37723,_0x19748){var _0x4806e1={},_0x212ab6={},_0x3900e9={'count':0x0,'rows':[]};var _0x1703bb=_[_0xce0a('0x2d')](db[_0xce0a('0x2e')]['rawAttributes'],function(_0x4f9e02){return{'name':_0x4f9e02[_0xce0a('0x2f')],'type':_0x4f9e02[_0xce0a('0x30')][_0xce0a('0x31')]};});_0x212ab6[_0xce0a('0x32')]=_[_0xce0a('0x2d')](_0x1703bb,'name');_0x212ab6['query']=_[_0xce0a('0x33')](_0xa37723['query']);_0x212ab6[_0xce0a('0x34')]=_['intersection'](_0x212ab6['model'],_0x212ab6['query']);_0x4806e1[_0xce0a('0x35')]=_['intersection'](_0x212ab6[_0xce0a('0x32')],qs['fields'](_0xa37723[_0xce0a('0x36')]['fields']));_0x4806e1[_0xce0a('0x35')]=_0x4806e1['attributes'][_0xce0a('0x37')]?_0x4806e1[_0xce0a('0x35')]:_0x212ab6[_0xce0a('0x32')];if(!_0xa37723[_0xce0a('0x36')][_0xce0a('0x38')](_0xce0a('0x39'))){_0x4806e1['limit']=qs[_0xce0a('0x3a')](_0xa37723[_0xce0a('0x36')][_0xce0a('0x3a')]);_0x4806e1[_0xce0a('0x1e')]=qs['offset'](_0xa37723[_0xce0a('0x36')][_0xce0a('0x1e')]);}_0x4806e1[_0xce0a('0x3b')]=qs[_0xce0a('0x3c')](_0xa37723[_0xce0a('0x36')][_0xce0a('0x3c')]);_0x4806e1[_0xce0a('0x3d')]=qs[_0xce0a('0x34')](_[_0xce0a('0x3e')](_0xa37723[_0xce0a('0x36')],_0x212ab6[_0xce0a('0x34')]),_0x1703bb);if(_0xa37723[_0xce0a('0x36')][_0xce0a('0x3f')]){_0x4806e1[_0xce0a('0x3d')]=_[_0xce0a('0x40')](_0x4806e1[_0xce0a('0x3d')],{'$or':_['map'](_0x1703bb,function(_0x1e7c34){if(_0x1e7c34['type']!==_0xce0a('0x41')){var _0x346d03={};_0x346d03[_0x1e7c34[_0xce0a('0x2a')]]={'$like':'%'+_0xa37723['query']['filter']+'%'};return _0x346d03;}})});}_0x4806e1=_['merge']({},_0x4806e1,_0xa37723['options']);var _0x21f427={'where':_0x4806e1[_0xce0a('0x3d')]};return db[_0xce0a('0x2e')]['count'](_0x21f427)[_0xce0a('0x25')](function(_0x201f68){_0x3900e9[_0xce0a('0x1d')]=_0x201f68;if(_0xa37723[_0xce0a('0x36')][_0xce0a('0x42')]){_0x4806e1['include']=[{'all':!![]}];}return db[_0xce0a('0x2e')]['findAll'](_0x4806e1);})[_0xce0a('0x25')](function(_0x174d8c){_0x3900e9['rows']=_0x174d8c;return _0x3900e9;})[_0xce0a('0x25')](respondWithFilteredResult(_0x19748,_0x4806e1))[_0xce0a('0x43')](handleError(_0x19748,null));};exports['show']=function(_0xc064ba,_0xf08ad5){var _0x2ea825={'raw':!![],'where':{'id':_0xc064ba[_0xce0a('0x44')]['id']}},_0x1d9add={};_0x1d9add['model']=_[_0xce0a('0x33')](db[_0xce0a('0x2e')]['rawAttributes']);_0x1d9add['query']=_['keys'](_0xc064ba['query']);_0x1d9add[_0xce0a('0x34')]=_[_0xce0a('0x45')](_0x1d9add[_0xce0a('0x32')],_0x1d9add[_0xce0a('0x36')]);_0x2ea825[_0xce0a('0x35')]=_[_0xce0a('0x45')](_0x1d9add[_0xce0a('0x32')],qs[_0xce0a('0x46')](_0xc064ba[_0xce0a('0x36')][_0xce0a('0x46')]));_0x2ea825['attributes']=_0x2ea825[_0xce0a('0x35')]['length']?_0x2ea825[_0xce0a('0x35')]:_0x1d9add[_0xce0a('0x32')];if(_0xc064ba[_0xce0a('0x36')][_0xce0a('0x42')]){_0x2ea825[_0xce0a('0x47')]=[{'all':!![]}];}_0x2ea825=_[_0xce0a('0x40')]({},_0x2ea825,_0xc064ba['options']);return db[_0xce0a('0x2e')][_0xce0a('0x48')](_0x2ea825)[_0xce0a('0x25')](handleEntityNotFound(_0xf08ad5,null))[_0xce0a('0x25')](respondWithResult(_0xf08ad5,null))[_0xce0a('0x43')](handleError(_0xf08ad5,null));};exports[_0xce0a('0x49')]=function(_0x2ab761,_0x30a49e,_0x36fb1d){return db['Plugin']['find']({'where':{'id':_0x2ab761[_0xce0a('0x44')]['id']},'attributes':[_0xce0a('0x2a'),_0xce0a('0x7')],'raw':!![]})[_0xce0a('0x25')](handleEntityNotFound(_0x30a49e,null))['then'](function(_0x537e38){if(_0x537e38){var _0x22ca80=path['join'](config[_0xce0a('0x4a')],_0xce0a('0x4b'),util[_0xce0a('0x4c')](_0xce0a('0x4d'),path[_0xce0a('0x4e')](_0x537e38['path'])));var _0x360a69=fs['createWriteStream'](_0x22ca80);var _0x498361=archiver(_0xce0a('0x4f'),{'zlib':{'level':0x9}});_0x498361['on'](_0xce0a('0x50'),function(_0x593a70){if(_0x593a70[_0xce0a('0x51')]===_0xce0a('0x52')){logger[_0xce0a('0x53')](_0x593a70);}else{throw new db[(_0xce0a('0x54'))][(_0xce0a('0x55'))](_0xce0a('0x56'));}});_0x498361['on'](_0xce0a('0x53'),function(_0x431a4a){throw new db[(_0xce0a('0x54'))][(_0xce0a('0x55'))](_0xce0a('0x56'));});_0x498361[_0xce0a('0x57')](_0x360a69);_0x498361[_0xce0a('0x58')](_0xce0a('0x59'),{'cwd':path[_0xce0a('0x5a')](config['root'],_0xce0a('0x4b'),path[_0xce0a('0x5b')](_0x537e38['path'])),'ignore':[path[_0xce0a('0x5a')](path['basename'](_0x537e38[_0xce0a('0x7')]),'node_modules/**/*'),path[_0xce0a('0x5a')](path['basename'](_0x537e38['path']),_0xce0a('0x5c'))],'nodir':!![]})[_0xce0a('0x5d')]();_0x360a69['on']('close',function(){if(!fs['existsSync'](_0x22ca80)){throw new db[(_0xce0a('0x54'))][(_0xce0a('0x55'))](_0xce0a('0x5e'));}return _0x30a49e['download'](_0x22ca80,util[_0xce0a('0x4c')](_0xce0a('0x4d'),path[_0xce0a('0x4e')](_0x537e38['path'])),function(_0x569a7b){if(_0x569a7b){throw new db[(_0xce0a('0x54'))][(_0xce0a('0x55'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xce0a('0x5f')](_0x22ca80);logger[_0xce0a('0x60')]('Download\x20completed');logger[_0xce0a('0x60')]('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x30a49e,null));};exports[_0xce0a('0x61')]=function(_0x3bde2b,_0x376f51,_0x4ce96c){var _0x2bfaad=path[_0xce0a('0x4e')](_0x3bde2b['file'][_0xce0a('0x62')],path[_0xce0a('0x63')](_0x3bde2b[_0xce0a('0x64')][_0xce0a('0x62')]));var _0x34ba5f=path[_0xce0a('0x5a')](config['root'],_0xce0a('0x4b'),_0x3bde2b['file'][_0xce0a('0x62')]);var _0x3ff583=path[_0xce0a('0x5a')](config[_0xce0a('0x4a')],_0xce0a('0x4b'),_0x2bfaad);logger[_0xce0a('0x60')](_0xce0a('0x65'),_0x34ba5f);logger[_0xce0a('0x60')](_0xce0a('0x66'),_0x3ff583);try{fs[_0xce0a('0x67')](_0x34ba5f,parseInt('0777',0x8));extract(_0x34ba5f,{'dir':_0x3ff583},function(_0xdec320){if(_0xdec320){logger[_0xce0a('0x53')](_0xdec320);handleError(_0xdec320,!![]);};var _0x28d0bc=fs[_0xce0a('0x68')](_0x3ff583);if(_0x28d0bc[_0xce0a('0x37')]>0x1){removeReferences(_0x34ba5f,_0x3ff583);logger[_0xce0a('0x53')](_0xce0a('0x69'));return _0x4ce96c(new Error(_0xce0a('0x69')));}var _0x16ea9b=fs[_0xce0a('0x6a')](path['join'](_0x3ff583,_0x28d0bc[0x0]));if(_0x16ea9b['isFile']()){removeReferences(_0x34ba5f,_0x3ff583);logger[_0xce0a('0x53')]('Invalid\x20plugin\x20structure');return _0x4ce96c(new Error(_0xce0a('0x69')));}if(_0x16ea9b['isDirectory']()){var _0x5d4b0f=fs[_0xce0a('0x68')](path[_0xce0a('0x5a')](_0x3ff583,_0x28d0bc[0x0]));if(_0x5d4b0f[_0xce0a('0x37')]===0x0){removeReferences(_0x34ba5f,_0x3ff583);logger['error'](_0xce0a('0x69'));return _0x4ce96c(new Error(_0xce0a('0x69')));}var _0x571dba=_0x5d4b0f[_0xce0a('0x6b')](function(_0x119aca){return _0x119aca==='manifest.json';});if(!_0x571dba){return _0x4ce96c(new Error(_0xce0a('0x6c')));}var _0x459cb0=fs['readFileSync'](path[_0xce0a('0x5a')](_0x3ff583,_0x28d0bc[0x0],_0xce0a('0x6d')));var _0x1afa48=JSON['parse'](_0x459cb0);if('undefined'==typeof _0x1afa48[_0xce0a('0x2a')]){return _0x4ce96c(new Error(_0xce0a('0x6e')));}if('undefined'==typeof _0x1afa48[_0xce0a('0x30')]){return _0x4ce96c(new Error(_0xce0a('0x6f')));}if('undefined'==typeof _0x1afa48[_0xce0a('0x70')]){return _0x4ce96c(new Error(_0xce0a('0x71')));}if(_0xce0a('0x72')==typeof _0x1afa48['parameters']){return _0x4ce96c(new Error(_0xce0a('0x73')));}if(_0x1afa48[_0xce0a('0x30')]===_0xce0a('0x74')){if(_0xce0a('0x72')==typeof _0x1afa48[_0xce0a('0x75')][_0xce0a('0x76')]){return _0x4ce96c(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xce0a('0x72')==typeof _0x1afa48['parameters'][_0xce0a('0x76')][_0xce0a('0x77')]&&'undefined'==typeof _0x1afa48[_0xce0a('0x75')][_0xce0a('0x76')][_0xce0a('0x78')]){return _0x4ce96c(new Error(_0xce0a('0x79')));}}else if(_0x1afa48[_0xce0a('0x30')]===_0xce0a('0x7a')){if('undefined'==typeof _0x1afa48[_0xce0a('0x75')][_0xce0a('0x7b')]){return _0x4ce96c(new Error(_0xce0a('0x7c')));}if(_0xce0a('0x72')==typeof _0x1afa48[_0xce0a('0x75')][_0xce0a('0x7d')]){return _0x4ce96c(new Error(_0xce0a('0x7e')));}}else{return _0x4ce96c(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x55c5c8=_0x1afa48[_0xce0a('0x2a')];var _0x47c696=_0x1afa48['description'];var _0x27607c=_0x1afa48[_0xce0a('0x30')];var _0x8c94cc=_0x1afa48[_0xce0a('0x7f')]?_0x1afa48[_0xce0a('0x7f')]:_0xce0a('0x80');var _0x2638ab=_0x1afa48['icon']?_0x1afa48[_0xce0a('0x81')]:_0xce0a('0x82');var _0x4fc3ac='';var _0x20d595='';var _0x5a8db4='';var _0xab8e18='';var _0x57e66d=_0x1afa48[_0xce0a('0x70')];if(_0x27607c===_0xce0a('0x74')){if('undefined'!=typeof _0x1afa48[_0xce0a('0x75')]['views'][_0xce0a('0x77')]){var _0x47b6d3=_0x1afa48['parameters'][_0xce0a('0x76')][_0xce0a('0x77')];if(!/^(f|ht)tps?:\/\//i['test'](_0x47b6d3)){_0x4fc3ac=path[_0xce0a('0x5a')](_0xce0a('0x83'),_0x2bfaad,_0x28d0bc[0x0],_0x47b6d3);}else{_0x4fc3ac=_0x47b6d3;}}else{logger[_0xce0a('0x60')](_0xce0a('0x84'));}if(_0xce0a('0x72')!=typeof _0x1afa48[_0xce0a('0x75')][_0xce0a('0x76')][_0xce0a('0x78')]){var _0x42e210=_0x1afa48[_0xce0a('0x75')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0xce0a('0x85')](_0x42e210)){_0x20d595=path[_0xce0a('0x5a')](_0xce0a('0x83'),_0x2bfaad,_0x28d0bc[0x0],_0x42e210);}else{_0x20d595=_0x42e210;}}else{logger[_0xce0a('0x60')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x27607c===_0xce0a('0x7a')){_0x5a8db4=_0x1afa48[_0xce0a('0x75')][_0xce0a('0x7b')];_0xab8e18=_0x1afa48['parameters'][_0xce0a('0x7d')];if(_0xce0a('0x72')!=typeof _0x1afa48[_0xce0a('0x75')][_0xce0a('0x76')]){if(_0xce0a('0x72')!=typeof _0x1afa48['parameters'][_0xce0a('0x76')][_0xce0a('0x77')]){var _0x47b6d3=_0x1afa48[_0xce0a('0x75')][_0xce0a('0x76')][_0xce0a('0x77')];if(!/^(f|ht)tps?:\/\//i[_0xce0a('0x85')](_0x47b6d3)){_0x4fc3ac=path[_0xce0a('0x5a')](_0xce0a('0x83'),_0x2bfaad,_0x28d0bc[0x0],_0x47b6d3);}else{_0x4fc3ac=_0x47b6d3;}}if('undefined'!=typeof _0x1afa48[_0xce0a('0x75')][_0xce0a('0x76')][_0xce0a('0x78')]){var _0x42e210=_0x1afa48[_0xce0a('0x75')][_0xce0a('0x76')][_0xce0a('0x78')];if(!/^(f|ht)tps?:\/\//i[_0xce0a('0x85')](_0x42e210)){_0x20d595=path[_0xce0a('0x5a')]('plugins',_0x2bfaad,_0x28d0bc[0x0],_0x42e210);}else{_0x20d595=_0x42e210;}}}}var _0x124e32={'name':_0x55c5c8,'description':_0x47c696,'path':path[_0xce0a('0x5a')](_0x2bfaad,_0x28d0bc[0x0]),'type':_0x27607c,'sidebar':_0x8c94cc,'icon':_0x2638ab,'adminUrl':_0x4fc3ac,'agentUrl':_0x20d595,'scriptName':_0x5a8db4,'scriptPath':_0xab8e18,'version':_0x57e66d};removeReferences(_0x34ba5f,null);return db[_0xce0a('0x2e')][_0xce0a('0x86')](_0x124e32)[_0xce0a('0x25')](function(_0x4b18ea){var _0x442976={'role':_0x3bde2b[_0xce0a('0x87')][_0xce0a('0x88')],'userProfileId':_0x3bde2b[_0xce0a('0x87')][_0xce0a('0x89')]};if(!_0x442976)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x442976['role']===_0xce0a('0x8a')){var _0x4edfbf=_0x4b18ea[_0xce0a('0x27')]({'plain':!![]});return db[_0xce0a('0x8b')][_0xce0a('0x48')]({'where':{'name':_0xce0a('0x8c'),'userProfileId':_0x442976[_0xce0a('0x89')]},'raw':!![]})['then'](function(_0x5314f4){if(_0x5314f4&&_0x5314f4[_0xce0a('0x8d')]===0x0){return db[_0xce0a('0x28')][_0xce0a('0x86')]({'name':_0x4edfbf[_0xce0a('0x2a')],'resourceId':_0x4edfbf['id'],'type':_0x5314f4[_0xce0a('0x2a')],'sectionId':_0x5314f4['id']},{})[_0xce0a('0x25')](function(){return _0x4b18ea;});}else{return _0x4b18ea;}})['catch'](function(_0x1db73d){logger[_0xce0a('0x53')](_0xce0a('0x8e'),_0x1db73d);throw _0x1db73d;});}return _0x4b18ea;})[_0xce0a('0x25')](respondWithResult(_0x376f51,null))[_0xce0a('0x43')](handleError(_0x376f51,null));}});}catch(_0x1d0be7){_0x376f51[_0xce0a('0x1b')](0x1f4)['send'](_0x1d0be7);}};function removeReferences(_0x2f024d,_0x40d694){try{if(_0x2f024d){fs[_0xce0a('0x5f')](_0x2f024d);logger[_0xce0a('0x60')](_0xce0a('0x8f'));}if(_0x40d694){rimraf(_0x40d694,function(){});logger[_0xce0a('0x60')](_0xce0a('0x90'));}}catch(_0xa1a3b){logger[_0xce0a('0x53')](_0xa1a3b);}}exports[_0xce0a('0x24')]=function(_0x319ba7,_0x25473a,_0x5796e4){return db[_0xce0a('0x2e')]['find']({'where':{'id':_0x319ba7[_0xce0a('0x44')]['id']}})[_0xce0a('0x25')](handleEntityNotFound(_0x25473a,null))['then'](saveUpdates(_0x319ba7['body'],null))[_0xce0a('0x25')](respondWithResult(_0x25473a,null))['catch'](handleError(_0x25473a,null));};exports[_0xce0a('0x91')]=function(_0x56f4c2,_0x3dcbf8,_0x56e818){return db['Plugin'][_0xce0a('0x48')]({'where':{'id':_0x56f4c2[_0xce0a('0x44')]['id']}})['then'](function(_0x5b4917){if(_0x5b4917){return _0x5b4917['destroy']();}})[_0xce0a('0x25')](function(_0x342475){rimraf(path[_0xce0a('0x5a')](config[_0xce0a('0x4a')],'server/files/plugins',path[_0xce0a('0x5b')](_0x342475[_0xce0a('0x7')])),function(){});return _0x342475;})[_0xce0a('0x25')](handleEntityNotFound(_0x3dcbf8,null))['then'](respondWithStatusCode(_0x3dcbf8,null))[_0xce0a('0x43')](handleError(_0x3dcbf8,null));};exports[_0xce0a('0x92')]=function(_0x5c32ea,_0x462d26,_0x5eed5f){return BPromise[_0xce0a('0x93')]()[_0xce0a('0x25')](function(){if(!_0x5c32ea[_0xce0a('0x36')]['path']){throw new Error(_0xce0a('0x94'));}if(!_0x5c32ea[_0xce0a('0x36')][_0xce0a('0x95')]){throw new Error(_0xce0a('0x96'));}var _0x5b32ce=_0x5c32ea[_0xce0a('0x36')]['hostname']?_0x5c32ea[_0xce0a('0x36')][_0xce0a('0x97')]+':'+_0x5c32ea[_0xce0a('0x36')][_0xce0a('0x95')]:_0xce0a('0x98')+_0x5c32ea[_0xce0a('0x36')][_0xce0a('0x95')];var _0x5a4277=_0x5c32ea[_0xce0a('0x36')]['json']?_0x5c32ea[_0xce0a('0x36')][_0xce0a('0x21')]:!![];var _0x2d9f45=_0x5c32ea[_0xce0a('0x36')][_0xce0a('0x99')]?_0x5c32ea['query']['encoding']:null;var _0x2ebb6a={'method':_0x5c32ea['method'],'uri':util['format'](_0xce0a('0x9a'),_0x5b32ce,_0x5c32ea['query'][_0xce0a('0x7')]),'json':_0x5a4277,'resolveWithFullResponse':!![],'encoding':_0x2d9f45,'qs':_0x5c32ea[_0xce0a('0x36')]};if(_0x5c32ea[_0xce0a('0x9b')]){_0x2ebb6a['headers']=_0x5c32ea[_0xce0a('0x9b')];if(_0x2ebb6a[_0xce0a('0x9b')][_0xce0a('0x9c')]){delete _0x2ebb6a[_0xce0a('0x9b')][_0xce0a('0x9c')];}}if(_0x2ebb6a['headers'][_0xce0a('0x9d')]){delete _0x2ebb6a[_0xce0a('0x9b')][_0xce0a('0x9d')];}return rp(_0x2ebb6a);})['then'](function(_0x2e431b){if(_0x2e431b){_0x462d26['set'](_0x2e431b[_0xce0a('0x9b')]);logger['info'](_0x2e431b[_0xce0a('0x87')]);if(_[_0xce0a('0x9e')](_0x5c32ea['query']['path'],_0xce0a('0x49'))&&_0x2e431b[_0xce0a('0x9f')]==0x1f4){return _0x462d26[_0xce0a('0x1a')](_0x2e431b[_0xce0a('0x9f')]);}else{return _0x462d26['status'](_0x2e431b[_0xce0a('0x9f')])[_0xce0a('0x2b')](_0x2e431b[_0xce0a('0x87')]);}}else{return _0x462d26[_0xce0a('0x1a')](0xc8);}})['catch'](handleError(_0x462d26,null));};exports[_0xce0a('0xa0')]=function(_0x3d3f5a,_0x148137,_0x35e808){return BPromise[_0xce0a('0x93')]()['then'](function(){if(!_0x3d3f5a['query'][_0xce0a('0x7')]){throw new Error(_0xce0a('0x94'));}if(!_0x3d3f5a['query']['port']){throw new Error(_0xce0a('0x96'));}var _0x6b067f=_0x3d3f5a['query'][_0xce0a('0x97')]?_0x3d3f5a[_0xce0a('0x36')][_0xce0a('0x97')]+':'+_0x3d3f5a['query'][_0xce0a('0x95')]:'http://localhost:'+_0x3d3f5a['query'][_0xce0a('0x95')];var _0x1b248d=_0x3d3f5a[_0xce0a('0x36')][_0xce0a('0x21')]?_0x3d3f5a[_0xce0a('0x36')][_0xce0a('0x21')]:!![];var _0xd961f8=_0x3d3f5a[_0xce0a('0x36')][_0xce0a('0x99')]?_0x3d3f5a[_0xce0a('0x36')][_0xce0a('0x99')]:null;var _0x3a5641={'method':_0x3d3f5a[_0xce0a('0xa1')],'uri':util[_0xce0a('0x4c')]('%s%s',_0x6b067f,_0x3d3f5a['query']['path']),'json':_0x1b248d,'resolveWithFullResponse':!![],'encoding':_0xd961f8,'body':_0x3d3f5a[_0xce0a('0x87')]};if(_0x3d3f5a[_0xce0a('0x9b')]){_0x3a5641[_0xce0a('0x9b')]=_0x3d3f5a[_0xce0a('0x9b')];if(_0x3a5641['headers']['content-length']){delete _0x3a5641['headers'][_0xce0a('0x9c')];}}if(_0x3a5641[_0xce0a('0x9b')][_0xce0a('0x9d')]){delete _0x3a5641[_0xce0a('0x9b')][_0xce0a('0x9d')];}return rp(_0x3a5641);})[_0xce0a('0x25')](function(_0x2bc23f){if(_0x2bc23f){_0x148137[_0xce0a('0x1f')](_0x2bc23f[_0xce0a('0x9b')]);logger[_0xce0a('0x60')](_0x2bc23f[_0xce0a('0x87')]);return _0x148137['status'](_0x2bc23f[_0xce0a('0x9f')])[_0xce0a('0x2b')](_0x2bc23f[_0xce0a('0x87')]);}else{return _0x148137[_0xce0a('0x1a')](0xc8);}})[_0xce0a('0x43')](handleError(_0x148137,null));}; \ No newline at end of file +var _0x14e6=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','../../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','./plugin.socket','register','sendStatus','status','end','json','count','offset','set','apply','update','then','destroy','get','Plugins','UserProfileResource','error','name','send','index','map','Plugin','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','pick','merge','where','VIRTUAL','filter','rows','catch','show','params','includeAll','include','find','path','join','root','server/files/plugins','format','%s.zip','basename','zip','warning','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','dirname','finalize','close','existsSync','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','extname','filename','file','Plugin\x20upload\x20filepath:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','script','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','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','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','headers','content-length','content-type','statusCode','webhookPost','http://localhost:','%s%s','eml-format','rimraf'];(function(_0x57eb55,_0x1101d3){var _0xc75909=function(_0x5d3e45){while(--_0x5d3e45){_0x57eb55['push'](_0x57eb55['shift']());}};_0xc75909(++_0x1101d3);}(_0x14e6,0x156));var _0x614e=function(_0x575446,_0x1a13fa){_0x575446=_0x575446-0x0;var _0x2fb644=_0x14e6[_0x575446];return _0x2fb644;};'use strict';var emlformat=require(_0x614e('0x0'));var rimraf=require(_0x614e('0x1'));var zipdir=require(_0x614e('0x2'));var jsonpatch=require(_0x614e('0x3'));var rp=require(_0x614e('0x4'));var moment=require(_0x614e('0x5'));var BPromise=require(_0x614e('0x6'));var Mustache=require(_0x614e('0x7'));var util=require(_0x614e('0x8'));var path=require('path');var sox=require(_0x614e('0x9'));var csv=require(_0x614e('0xa'));var ejs=require(_0x614e('0xb'));var fs=require('fs');var fs_extra=require(_0x614e('0xc'));var _=require(_0x614e('0xd'));var squel=require(_0x614e('0xe'));var crypto=require(_0x614e('0xf'));var jsforce=require(_0x614e('0x10'));var deskjs=require(_0x614e('0x11'));var toCsv=require(_0x614e('0xa'));var querystring=require(_0x614e('0x12'));var Papa=require(_0x614e('0x13'));var extract=require(_0x614e('0x14'));var rimraf=require(_0x614e('0x1'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0x614e('0x15'));var qs=require(_0x614e('0x16'));var as=require(_0x614e('0x17'));var hardwareService=require(_0x614e('0x18'));var logger=require(_0x614e('0x19'))(_0x614e('0x1a'));var utils=require(_0x614e('0x1b'));var config=require(_0x614e('0x1c'));var licenseUtil=require(_0x614e('0x1d'));var db=require(_0x614e('0x1e'))['db'];config['redis']=_['defaults'](config[_0x614e('0x1f')],{'host':_0x614e('0x20'),'port':0x18eb});var socket=require(_0x614e('0x21'))(new Redis(config[_0x614e('0x1f')]));require(_0x614e('0x22'))[_0x614e('0x23')](socket);function respondWithStatusCode(_0x34cc5d,_0x4adbb5){_0x4adbb5=_0x4adbb5||0xcc;return function(_0x23616a){if(_0x23616a){return _0x34cc5d[_0x614e('0x24')](_0x4adbb5);}return _0x34cc5d[_0x614e('0x25')](_0x4adbb5)[_0x614e('0x26')]();};}function respondWithResult(_0x38ad12,_0x1346e0){_0x1346e0=_0x1346e0||0xc8;return function(_0x79dcee){if(_0x79dcee){return _0x38ad12['status'](_0x1346e0)[_0x614e('0x27')](_0x79dcee);}};}function respondWithFilteredResult(_0x175c1f,_0x40fb81){return function(_0x284b2d){if(_0x284b2d){var _0x1ea599=_0x284b2d[_0x614e('0x28')],_0x3d8a9c=_0x40fb81[_0x614e('0x29')],_0x46405c=_0x40fb81[_0x614e('0x29')]+_0x40fb81['limit'],_0x786ccc;if(_0x46405c>=_0x1ea599){_0x46405c=_0x1ea599;_0x786ccc=0xc8;}else{_0x786ccc=0xce;}_0x175c1f[_0x614e('0x25')](_0x786ccc);return _0x175c1f[_0x614e('0x2a')]('Content-Range',_0x3d8a9c+'-'+_0x46405c+'/'+_0x1ea599)['json'](_0x284b2d);}return null;};}function patchUpdates(_0x13b787){return function(_0x3781ad){try{jsonpatch[_0x614e('0x2b')](_0x3781ad,_0x13b787,!![]);}catch(_0x1e6293){return BPromise['reject'](_0x1e6293);}return _0x3781ad['save']();};}function saveUpdates(_0x527172,_0x4311e2){return function(_0x48a147){if(_0x48a147){return _0x48a147[_0x614e('0x2c')](_0x527172)[_0x614e('0x2d')](function(_0x50cfc1){return _0x50cfc1;});}return null;};}function removeEntity(_0x5ad33e,_0x3900e0){return function(_0x477304){if(_0x477304){return _0x477304[_0x614e('0x2e')]()[_0x614e('0x2d')](function(){var _0x319f27=_0x477304[_0x614e('0x2f')]({'plain':!![]});var _0x20f107=_0x614e('0x30');return db[_0x614e('0x31')]['destroy']({'where':{'type':_0x20f107,'resourceId':_0x319f27['id']}})[_0x614e('0x2d')](function(){return _0x477304;});})[_0x614e('0x2d')](function(){_0x5ad33e[_0x614e('0x25')](0xcc)[_0x614e('0x26')]();});}};}function handleEntityNotFound(_0x2ba026,_0x5257e8){return function(_0x880b4d){if(!_0x880b4d){_0x2ba026[_0x614e('0x24')](0x194);}return _0x880b4d;};}function handleError(_0x5d97f5,_0x4db53a){_0x4db53a=_0x4db53a||0x1f4;return function(_0x1081c2){logger[_0x614e('0x32')](_0x1081c2['stack']);if(_0x1081c2['name']){delete _0x1081c2[_0x614e('0x33')];}_0x5d97f5[_0x614e('0x25')](_0x4db53a)[_0x614e('0x34')](_0x1081c2);};}exports[_0x614e('0x35')]=function(_0x49af53,_0x529105){var _0x28e990={},_0x4f2f99={},_0x419283={'count':0x0,'rows':[]};var _0x33ad7b=_[_0x614e('0x36')](db[_0x614e('0x37')][_0x614e('0x38')],function(_0x28e7d6){return{'name':_0x28e7d6['fieldName'],'type':_0x28e7d6[_0x614e('0x39')][_0x614e('0x3a')]};});_0x4f2f99[_0x614e('0x3b')]=_['map'](_0x33ad7b,_0x614e('0x33'));_0x4f2f99['query']=_[_0x614e('0x3c')](_0x49af53[_0x614e('0x3d')]);_0x4f2f99[_0x614e('0x3e')]=_[_0x614e('0x3f')](_0x4f2f99[_0x614e('0x3b')],_0x4f2f99[_0x614e('0x3d')]);_0x28e990[_0x614e('0x40')]=_[_0x614e('0x3f')](_0x4f2f99[_0x614e('0x3b')],qs['fields'](_0x49af53[_0x614e('0x3d')][_0x614e('0x41')]));_0x28e990[_0x614e('0x40')]=_0x28e990['attributes'][_0x614e('0x42')]?_0x28e990['attributes']:_0x4f2f99[_0x614e('0x3b')];if(!_0x49af53[_0x614e('0x3d')]['hasOwnProperty'](_0x614e('0x43'))){_0x28e990[_0x614e('0x44')]=qs[_0x614e('0x44')](_0x49af53['query'][_0x614e('0x44')]);_0x28e990['offset']=qs[_0x614e('0x29')](_0x49af53[_0x614e('0x3d')][_0x614e('0x29')]);}_0x28e990['order']=qs['sort'](_0x49af53[_0x614e('0x3d')]['sort']);_0x28e990['where']=qs[_0x614e('0x3e')](_[_0x614e('0x45')](_0x49af53[_0x614e('0x3d')],_0x4f2f99[_0x614e('0x3e')]),_0x33ad7b);if(_0x49af53['query']['filter']){_0x28e990['where']=_[_0x614e('0x46')](_0x28e990[_0x614e('0x47')],{'$or':_[_0x614e('0x36')](_0x33ad7b,function(_0x610e30){if(_0x610e30[_0x614e('0x39')]!==_0x614e('0x48')){var _0x4977e3={};_0x4977e3[_0x610e30[_0x614e('0x33')]]={'$like':'%'+_0x49af53['query'][_0x614e('0x49')]+'%'};return _0x4977e3;}})});}_0x28e990=_[_0x614e('0x46')]({},_0x28e990,_0x49af53['options']);var _0x1a9891={'where':_0x28e990[_0x614e('0x47')]};return db[_0x614e('0x37')][_0x614e('0x28')](_0x1a9891)['then'](function(_0x7d743){_0x419283['count']=_0x7d743;if(_0x49af53['query']['includeAll']){_0x28e990['include']=[{'all':!![]}];}return db[_0x614e('0x37')]['findAll'](_0x28e990);})['then'](function(_0x43e5f1){_0x419283[_0x614e('0x4a')]=_0x43e5f1;return _0x419283;})[_0x614e('0x2d')](respondWithFilteredResult(_0x529105,_0x28e990))[_0x614e('0x4b')](handleError(_0x529105,null));};exports[_0x614e('0x4c')]=function(_0x268b02,_0x153671){var _0xa7a498={'raw':!![],'where':{'id':_0x268b02[_0x614e('0x4d')]['id']}},_0x5db11d={};_0x5db11d[_0x614e('0x3b')]=_[_0x614e('0x3c')](db['Plugin']['rawAttributes']);_0x5db11d['query']=_['keys'](_0x268b02['query']);_0x5db11d[_0x614e('0x3e')]=_[_0x614e('0x3f')](_0x5db11d['model'],_0x5db11d['query']);_0xa7a498[_0x614e('0x40')]=_[_0x614e('0x3f')](_0x5db11d[_0x614e('0x3b')],qs[_0x614e('0x41')](_0x268b02[_0x614e('0x3d')][_0x614e('0x41')]));_0xa7a498[_0x614e('0x40')]=_0xa7a498['attributes']['length']?_0xa7a498[_0x614e('0x40')]:_0x5db11d[_0x614e('0x3b')];if(_0x268b02[_0x614e('0x3d')][_0x614e('0x4e')]){_0xa7a498[_0x614e('0x4f')]=[{'all':!![]}];}_0xa7a498=_[_0x614e('0x46')]({},_0xa7a498,_0x268b02['options']);return db['Plugin'][_0x614e('0x50')](_0xa7a498)['then'](handleEntityNotFound(_0x153671,null))['then'](respondWithResult(_0x153671,null))[_0x614e('0x4b')](handleError(_0x153671,null));};exports['download']=function(_0x217dd0,_0x42e1db,_0x2eaf3a){return db[_0x614e('0x37')]['find']({'where':{'id':_0x217dd0['params']['id']},'attributes':[_0x614e('0x33'),_0x614e('0x51')],'raw':!![]})[_0x614e('0x2d')](handleEntityNotFound(_0x42e1db,null))[_0x614e('0x2d')](function(_0x416a76){if(_0x416a76){var _0x1f0afc=path[_0x614e('0x52')](config[_0x614e('0x53')],_0x614e('0x54'),util[_0x614e('0x55')](_0x614e('0x56'),path[_0x614e('0x57')](_0x416a76[_0x614e('0x51')])));var _0x25678c=fs['createWriteStream'](_0x1f0afc);var _0x10d4b3=archiver(_0x614e('0x58'),{'zlib':{'level':0x9}});_0x10d4b3['on'](_0x614e('0x59'),function(_0x1eb00c){if(_0x1eb00c['code']==='ENOENT'){logger['error'](_0x1eb00c);}else{throw new db[(_0x614e('0x5a'))][(_0x614e('0x5b'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x10d4b3['on']('error',function(_0x430c18){throw new db[(_0x614e('0x5a'))][(_0x614e('0x5b'))](_0x614e('0x5c'));});_0x10d4b3[_0x614e('0x5d')](_0x25678c);_0x10d4b3[_0x614e('0x5e')]('**/*',{'cwd':path['join'](config[_0x614e('0x53')],_0x614e('0x54'),path[_0x614e('0x5f')](_0x416a76[_0x614e('0x51')])),'ignore':[path[_0x614e('0x52')](path[_0x614e('0x57')](_0x416a76[_0x614e('0x51')]),'node_modules/**/*'),path[_0x614e('0x52')](path[_0x614e('0x57')](_0x416a76[_0x614e('0x51')]),'attachments/**/*')],'nodir':!![]})[_0x614e('0x60')]();_0x25678c['on'](_0x614e('0x61'),function(){if(!fs[_0x614e('0x62')](_0x1f0afc)){throw new db[(_0x614e('0x5a'))][(_0x614e('0x5b'))](_0x614e('0x63'));}return _0x42e1db[_0x614e('0x64')](_0x1f0afc,util['format']('%s.zip',path[_0x614e('0x57')](_0x416a76[_0x614e('0x51')])),function(_0x3f7f68){if(_0x3f7f68){throw new db['Sequelize'][(_0x614e('0x5b'))](_0x614e('0x65'));}fs[_0x614e('0x66')](_0x1f0afc);logger[_0x614e('0x67')](_0x614e('0x68'));logger['info'](_0x614e('0x69'));});});}return null;})[_0x614e('0x4b')](handleError(_0x42e1db,null));};exports[_0x614e('0x6a')]=function(_0x215945,_0x2b4ffd,_0x325dcc){var _0x39e9ef=path[_0x614e('0x57')](_0x215945['file']['filename'],path[_0x614e('0x6b')](_0x215945['file'][_0x614e('0x6c')]));var _0x2613e5=path[_0x614e('0x52')](config[_0x614e('0x53')],_0x614e('0x54'),_0x215945[_0x614e('0x6d')][_0x614e('0x6c')]);var _0x40c7b4=path[_0x614e('0x52')](config[_0x614e('0x53')],_0x614e('0x54'),_0x39e9ef);logger[_0x614e('0x67')](_0x614e('0x6e'),_0x2613e5);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x40c7b4);try{fs['chmodSync'](_0x2613e5,parseInt(_0x614e('0x6f'),0x8));extract(_0x2613e5,{'dir':_0x40c7b4},function(_0xc308a4){if(_0xc308a4){logger[_0x614e('0x32')](_0xc308a4);handleError(_0xc308a4,!![]);};var _0x3623db=fs[_0x614e('0x70')](_0x40c7b4);if(_0x3623db[_0x614e('0x42')]>0x1){removeReferences(_0x2613e5,_0x40c7b4);logger[_0x614e('0x32')]('Invalid\x20plugin\x20structure');return _0x325dcc(new Error(_0x614e('0x71')));}var _0x3e5c33=fs[_0x614e('0x72')](path[_0x614e('0x52')](_0x40c7b4,_0x3623db[0x0]));if(_0x3e5c33[_0x614e('0x73')]()){removeReferences(_0x2613e5,_0x40c7b4);logger[_0x614e('0x32')](_0x614e('0x71'));return _0x325dcc(new Error(_0x614e('0x71')));}if(_0x3e5c33[_0x614e('0x74')]()){var _0x165480=fs[_0x614e('0x70')](path[_0x614e('0x52')](_0x40c7b4,_0x3623db[0x0]));if(_0x165480['length']===0x0){removeReferences(_0x2613e5,_0x40c7b4);logger['error']('Invalid\x20plugin\x20structure');return _0x325dcc(new Error(_0x614e('0x71')));}var _0x18b2a8=_0x165480['some'](function(_0x2157fb){return _0x2157fb===_0x614e('0x75');});if(!_0x18b2a8){return _0x325dcc(new Error(_0x614e('0x76')));}var _0x4018d0=fs['readFileSync'](path['join'](_0x40c7b4,_0x3623db[0x0],_0x614e('0x75')));var _0x2ccfe8=JSON[_0x614e('0x77')](_0x4018d0);if(_0x614e('0x78')==typeof _0x2ccfe8[_0x614e('0x33')]){return _0x325dcc(new Error(_0x614e('0x79')));}if(_0x614e('0x78')==typeof _0x2ccfe8['type']){return _0x325dcc(new Error(_0x614e('0x7a')));}if(_0x614e('0x78')==typeof _0x2ccfe8[_0x614e('0x7b')]){return _0x325dcc(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x614e('0x78')==typeof _0x2ccfe8[_0x614e('0x7c')]){return _0x325dcc(new Error(_0x614e('0x7d')));}if(_0x2ccfe8[_0x614e('0x39')]===_0x614e('0x7e')){if(_0x614e('0x78')==typeof _0x2ccfe8[_0x614e('0x7c')]['views']){return _0x325dcc(new Error(_0x614e('0x7f')));}if(_0x614e('0x78')==typeof _0x2ccfe8['parameters'][_0x614e('0x80')][_0x614e('0x81')]&&_0x614e('0x78')==typeof _0x2ccfe8['parameters'][_0x614e('0x80')][_0x614e('0x82')]){return _0x325dcc(new Error(_0x614e('0x83')));}}else if(_0x2ccfe8['type']==='script'){if(_0x614e('0x78')==typeof _0x2ccfe8[_0x614e('0x7c')][_0x614e('0x84')]){return _0x325dcc(new Error(_0x614e('0x85')));}if(_0x614e('0x78')==typeof _0x2ccfe8[_0x614e('0x7c')]['scriptPath']){return _0x325dcc(new Error(_0x614e('0x86')));}}else{return _0x325dcc(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x41bbd1=_0x2ccfe8[_0x614e('0x33')];var _0x59e510=_0x2ccfe8[_0x614e('0x87')];var _0x1bb8b0=_0x2ccfe8['type'];var _0x4e5f85=_0x2ccfe8[_0x614e('0x88')]?_0x2ccfe8['sidebar']:_0x614e('0x89');var _0xfc0843=_0x2ccfe8[_0x614e('0x8a')]?_0x2ccfe8[_0x614e('0x8a')]:_0x614e('0x8b');var _0x7fa280='';var _0x5792c9='';var _0x3e34f8='';var _0x4e8716='';var _0x12db02=_0x2ccfe8[_0x614e('0x7b')];if(_0x1bb8b0===_0x614e('0x7e')){if(_0x614e('0x78')!=typeof _0x2ccfe8[_0x614e('0x7c')][_0x614e('0x80')][_0x614e('0x81')]){var _0x5b6b1a=_0x2ccfe8[_0x614e('0x7c')][_0x614e('0x80')][_0x614e('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x614e('0x8c')](_0x5b6b1a)){_0x7fa280=path[_0x614e('0x52')]('plugins',_0x39e9ef,_0x3623db[0x0],_0x5b6b1a);}else{_0x7fa280=_0x5b6b1a;}}else{logger[_0x614e('0x67')](_0x614e('0x8d'));}if('undefined'!=typeof _0x2ccfe8[_0x614e('0x7c')][_0x614e('0x80')][_0x614e('0x82')]){var _0x4ac21a=_0x2ccfe8[_0x614e('0x7c')][_0x614e('0x80')][_0x614e('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4ac21a)){_0x5792c9=path[_0x614e('0x52')](_0x614e('0x8e'),_0x39e9ef,_0x3623db[0x0],_0x4ac21a);}else{_0x5792c9=_0x4ac21a;}}else{logger[_0x614e('0x67')](_0x614e('0x8f'));}}else if(_0x1bb8b0===_0x614e('0x90')){_0x3e34f8=_0x2ccfe8[_0x614e('0x7c')]['scriptName'];_0x4e8716=_0x2ccfe8[_0x614e('0x7c')]['scriptPath'];if(_0x614e('0x78')!=typeof _0x2ccfe8[_0x614e('0x7c')]['views']){if(_0x614e('0x78')!=typeof _0x2ccfe8[_0x614e('0x7c')][_0x614e('0x80')][_0x614e('0x81')]){var _0x5b6b1a=_0x2ccfe8['parameters']['views'][_0x614e('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x5b6b1a)){_0x7fa280=path[_0x614e('0x52')](_0x614e('0x8e'),_0x39e9ef,_0x3623db[0x0],_0x5b6b1a);}else{_0x7fa280=_0x5b6b1a;}}if(_0x614e('0x78')!=typeof _0x2ccfe8['parameters']['views'][_0x614e('0x82')]){var _0x4ac21a=_0x2ccfe8[_0x614e('0x7c')][_0x614e('0x80')][_0x614e('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4ac21a)){_0x5792c9=path[_0x614e('0x52')](_0x614e('0x8e'),_0x39e9ef,_0x3623db[0x0],_0x4ac21a);}else{_0x5792c9=_0x4ac21a;}}}}var _0x41e508={'name':_0x41bbd1,'description':_0x59e510,'path':path[_0x614e('0x52')](_0x39e9ef,_0x3623db[0x0]),'type':_0x1bb8b0,'sidebar':_0x4e5f85,'icon':_0xfc0843,'adminUrl':_0x7fa280,'agentUrl':_0x5792c9,'scriptName':_0x3e34f8,'scriptPath':_0x4e8716,'version':_0x12db02};removeReferences(_0x2613e5,null);return db[_0x614e('0x37')][_0x614e('0x91')](_0x41e508)['then'](function(_0x38da8a){var _0x3d23ea={'role':_0x215945[_0x614e('0x92')][_0x614e('0x93')],'userProfileId':_0x215945[_0x614e('0x92')][_0x614e('0x94')]};if(!_0x3d23ea)throw new Error(_0x614e('0x95'));if(_0x3d23ea[_0x614e('0x93')]===_0x614e('0x96')){var _0xc979df=_0x38da8a['get']({'plain':!![]});return db[_0x614e('0x97')][_0x614e('0x50')]({'where':{'name':'Plugins','userProfileId':_0x3d23ea[_0x614e('0x94')]},'raw':!![]})[_0x614e('0x2d')](function(_0x489107){if(_0x489107&&_0x489107[_0x614e('0x98')]===0x0){return db[_0x614e('0x31')][_0x614e('0x91')]({'name':_0xc979df[_0x614e('0x33')],'resourceId':_0xc979df['id'],'type':_0x489107['name'],'sectionId':_0x489107['id']},{})[_0x614e('0x2d')](function(){return _0x38da8a;});}else{return _0x38da8a;}})['catch'](function(_0xa42184){logger[_0x614e('0x32')](_0x614e('0x99'),_0xa42184);throw _0xa42184;});}return _0x38da8a;})['then'](respondWithResult(_0x2b4ffd,null))[_0x614e('0x4b')](handleError(_0x2b4ffd,null));}});}catch(_0x1db1d7){_0x2b4ffd[_0x614e('0x25')](0x1f4)[_0x614e('0x34')](_0x1db1d7);}};function removeReferences(_0x674b13,_0x2c9aa3){try{if(_0x674b13){fs[_0x614e('0x66')](_0x674b13);logger[_0x614e('0x67')](_0x614e('0x9a'));}if(_0x2c9aa3){rimraf(_0x2c9aa3,function(){});logger['info'](_0x614e('0x9b'));}}catch(_0x320078){logger[_0x614e('0x32')](_0x320078);}}exports[_0x614e('0x2c')]=function(_0x1bc222,_0x459f41,_0x458dc2){return db[_0x614e('0x37')][_0x614e('0x50')]({'where':{'id':_0x1bc222['params']['id']}})['then'](handleEntityNotFound(_0x459f41,null))['then'](saveUpdates(_0x1bc222['body'],null))[_0x614e('0x2d')](respondWithResult(_0x459f41,null))['catch'](handleError(_0x459f41,null));};exports[_0x614e('0x9c')]=function(_0x27f7a0,_0x5c21e6,_0xde955f){return db[_0x614e('0x37')][_0x614e('0x50')]({'where':{'id':_0x27f7a0[_0x614e('0x4d')]['id']}})['then'](function(_0x39707f){if(_0x39707f){return _0x39707f[_0x614e('0x2e')]();}})[_0x614e('0x2d')](function(_0x2faa5b){rimraf(path['join'](config['root'],_0x614e('0x54'),path['dirname'](_0x2faa5b[_0x614e('0x51')])),function(){});return _0x2faa5b;})['then'](handleEntityNotFound(_0x5c21e6,null))[_0x614e('0x2d')](respondWithStatusCode(_0x5c21e6,null))[_0x614e('0x4b')](handleError(_0x5c21e6,null));};exports[_0x614e('0x9d')]=function(_0x3386af,_0x3438c2,_0x4ac625){return BPromise[_0x614e('0x9e')]()[_0x614e('0x2d')](function(){if(!_0x3386af[_0x614e('0x3d')][_0x614e('0x51')]){throw new Error(_0x614e('0x9f'));}if(!_0x3386af['query'][_0x614e('0xa0')]){throw new Error(_0x614e('0xa1'));}var _0x2634e4=_0x3386af[_0x614e('0x3d')][_0x614e('0xa2')]?_0x3386af['query'][_0x614e('0xa2')]+':'+_0x3386af[_0x614e('0x3d')]['port']:'http://localhost:'+_0x3386af['query'][_0x614e('0xa0')];var _0x1f4848=_0x3386af[_0x614e('0x3d')]['json']?_0x3386af[_0x614e('0x3d')][_0x614e('0x27')]:!![];var _0x599e24=_0x3386af[_0x614e('0x3d')]['encoding']?_0x3386af[_0x614e('0x3d')][_0x614e('0xa3')]:null;var _0xcb095e={'method':_0x3386af[_0x614e('0xa4')],'uri':util[_0x614e('0x55')]('%s%s',_0x2634e4,_0x3386af[_0x614e('0x3d')]['path']),'json':_0x1f4848,'resolveWithFullResponse':!![],'encoding':_0x599e24,'qs':_0x3386af['query']};if(_0x3386af[_0x614e('0xa5')]){_0xcb095e['headers']=_0x3386af[_0x614e('0xa5')];if(_0xcb095e[_0x614e('0xa5')][_0x614e('0xa6')]){delete _0xcb095e[_0x614e('0xa5')]['content-length'];}}if(_0xcb095e['headers'][_0x614e('0xa7')]){delete _0xcb095e[_0x614e('0xa5')][_0x614e('0xa7')];}return rp(_0xcb095e);})[_0x614e('0x2d')](function(_0x10149a){if(_0x10149a){_0x3438c2[_0x614e('0x2a')](_0x10149a[_0x614e('0xa5')]);logger['info'](_0x10149a[_0x614e('0x92')]);if(_['endsWith'](_0x3386af[_0x614e('0x3d')]['path'],_0x614e('0x64'))&&_0x10149a[_0x614e('0xa8')]==0x1f4){return _0x3438c2[_0x614e('0x24')](_0x10149a[_0x614e('0xa8')]);}else{return _0x3438c2[_0x614e('0x25')](_0x10149a['statusCode'])[_0x614e('0x34')](_0x10149a[_0x614e('0x92')]);}}else{return _0x3438c2[_0x614e('0x24')](0xc8);}})[_0x614e('0x4b')](handleError(_0x3438c2,null));};exports[_0x614e('0xa9')]=function(_0x433a42,_0x44ac01,_0x8016f4){return BPromise[_0x614e('0x9e')]()[_0x614e('0x2d')](function(){if(!_0x433a42[_0x614e('0x3d')][_0x614e('0x51')]){throw new Error(_0x614e('0x9f'));}if(!_0x433a42[_0x614e('0x3d')][_0x614e('0xa0')]){throw new Error(_0x614e('0xa1'));}var _0x57429a=_0x433a42[_0x614e('0x3d')][_0x614e('0xa2')]?_0x433a42[_0x614e('0x3d')][_0x614e('0xa2')]+':'+_0x433a42[_0x614e('0x3d')][_0x614e('0xa0')]:_0x614e('0xaa')+_0x433a42[_0x614e('0x3d')][_0x614e('0xa0')];var _0x487902=_0x433a42[_0x614e('0x3d')]['json']?_0x433a42[_0x614e('0x3d')][_0x614e('0x27')]:!![];var _0x1cad32=_0x433a42[_0x614e('0x3d')][_0x614e('0xa3')]?_0x433a42['query'][_0x614e('0xa3')]:null;var _0x4782c4={'method':_0x433a42[_0x614e('0xa4')],'uri':util[_0x614e('0x55')](_0x614e('0xab'),_0x57429a,_0x433a42[_0x614e('0x3d')][_0x614e('0x51')]),'json':_0x487902,'resolveWithFullResponse':!![],'encoding':_0x1cad32,'body':_0x433a42[_0x614e('0x92')]};if(_0x433a42['headers']){_0x4782c4[_0x614e('0xa5')]=_0x433a42[_0x614e('0xa5')];if(_0x4782c4['headers'][_0x614e('0xa6')]){delete _0x4782c4[_0x614e('0xa5')][_0x614e('0xa6')];}}if(_0x4782c4[_0x614e('0xa5')][_0x614e('0xa7')]){delete _0x4782c4[_0x614e('0xa5')]['content-type'];}return rp(_0x4782c4);})[_0x614e('0x2d')](function(_0x188496){if(_0x188496){_0x44ac01[_0x614e('0x2a')](_0x188496['headers']);logger[_0x614e('0x67')](_0x188496[_0x614e('0x92')]);return _0x44ac01[_0x614e('0x25')](_0x188496[_0x614e('0xa8')])[_0x614e('0x34')](_0x188496[_0x614e('0x92')]);}else{return _0x44ac01[_0x614e('0x24')](0xc8);}})[_0x614e('0x4b')](handleError(_0x44ac01,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index ae64518..e9ee5a1 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 _0xd4a2=['setMaxListeners','update','emit','hasOwnProperty','exports','events'];(function(_0x56960d,_0x2e0cda){var _0x80381c=function(_0x48546b){while(--_0x48546b){_0x56960d['push'](_0x56960d['shift']());}};_0x80381c(++_0x2e0cda);}(_0xd4a2,0x173));var _0x2d4a=function(_0x1cbdec,_0x4b9e4f){_0x1cbdec=_0x1cbdec-0x0;var _0x22b3da=_0xd4a2[_0x1cbdec];return _0x22b3da;};'use strict';var EventEmitter=require(_0x2d4a('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x2d4a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2d4a('0x2'),'afterDestroy':'remove'};function emitEvent(_0x24810d){return function(_0x5d435a,_0x32af9e,_0x40d744){PluginEvents[_0x2d4a('0x3')](_0x24810d+':'+_0x5d435a['id'],_0x5d435a);PluginEvents[_0x2d4a('0x3')](_0x24810d,_0x5d435a);_0x40d744(null);};}for(var e in events){if(events[_0x2d4a('0x4')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x2d4a('0x5')]=PluginEvents; \ No newline at end of file +var _0xffd6=['../../mysqldb','Plugin','update','remove','emit','hook','exports','events'];(function(_0x5a26f5,_0x196300){var _0x2e9ef7=function(_0x593736){while(--_0x593736){_0x5a26f5['push'](_0x5a26f5['shift']());}};_0x2e9ef7(++_0x196300);}(_0xffd6,0x97));var _0x6ffd=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0xffd6[_0xabbd2f];return _0x34a040;};'use strict';var EventEmitter=require(_0x6ffd('0x0'));var Plugin=require(_0x6ffd('0x1'))['db'][_0x6ffd('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6ffd('0x3'),'afterDestroy':_0x6ffd('0x4')};function emitEvent(_0x39fd49){return function(_0x560afa,_0x1d12e3,_0x173979){PluginEvents[_0x6ffd('0x5')](_0x39fd49+':'+_0x560afa['id'],_0x560afa);PluginEvents[_0x6ffd('0x5')](_0x39fd49,_0x560afa);_0x173979(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x6ffd('0x6')](e,emitEvent(event));}}module[_0x6ffd('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 7a797c3..9c96617 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 _0x008c=['define','plugins','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports'];(function(_0x37d0bc,_0x109b96){var _0x170e60=function(_0xae2ad){while(--_0xae2ad){_0x37d0bc['push'](_0x37d0bc['shift']());}};_0x170e60(++_0x109b96);}(_0x008c,0x188));var _0xc008=function(_0x3b7a06,_0x41f79e){_0x3b7a06=_0x3b7a06-0x0;var _0x363e31=_0x008c[_0x3b7a06];return _0x363e31;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Plugin',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6d6=['path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x123a8f,_0x233d01){var _0x1c5e79=function(_0x3c8849){while(--_0x3c8849){_0x123a8f['push'](_0x123a8f['shift']());}};_0x1c5e79(++_0x233d01);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x9552c8,_0x156ebe){_0x9552c8=_0x9552c8-0x0;var _0x9f83ae=_0xd6d6[_0x9552c8];return _0x9f83ae;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'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 b2d0cf8..3fc520e 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 _0xe774=['client','http','redis','defaults','socket.io-emitter','./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','message','catch','Plugin','create','body','options','CreatePlugin','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xe774,0xc9));var _0x4e77=function(_0x2b2400,_0x1ae538){_0x2b2400=_0x2b2400-0x0;var _0x263a25=_0xe774[_0x2b2400];return _0x263a25;};'use strict';var _=require(_0x4e77('0x0'));var util=require(_0x4e77('0x1'));var moment=require(_0x4e77('0x2'));var BPromise=require(_0x4e77('0x3'));var rs=require(_0x4e77('0x4'));var fs=require('fs');var Redis=require(_0x4e77('0x5'));var db=require(_0x4e77('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4e77('0x7'));var config=require(_0x4e77('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4e77('0x9')][_0x4e77('0xa')]({'port':0x232a});config[_0x4e77('0xb')]=_[_0x4e77('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4e77('0xd'))(new Redis(config['redis']));require(_0x4e77('0xe'))[_0x4e77('0xf')](socket);function respondWithRpcPromise(_0x425f89,_0x13e10d,_0xfba4db){return new BPromise(function(_0x3764f3,_0x3fef13){return client['request'](_0x425f89,_0xfba4db)[_0x4e77('0x10')](function(_0x31f0f7){logger[_0x4e77('0x11')](_0x4e77('0x12'),_0x13e10d,_0x4e77('0x13'));logger[_0x4e77('0x14')](_0x4e77('0x15'),_0x13e10d,_0x4e77('0x13'),JSON['stringify'](_0x31f0f7));if(_0x31f0f7['error']){if(_0x31f0f7['error']['code']===0x1f4){logger[_0x4e77('0x16')](_0x4e77('0x12'),_0x13e10d,_0x31f0f7[_0x4e77('0x16')][_0x4e77('0x17')]);return _0x3fef13(_0x31f0f7[_0x4e77('0x16')][_0x4e77('0x17')]);}logger[_0x4e77('0x16')]('Plugin,\x20%s,\x20%s',_0x13e10d,_0x31f0f7[_0x4e77('0x16')][_0x4e77('0x17')]);return _0x3764f3(_0x31f0f7[_0x4e77('0x16')][_0x4e77('0x17')]);}else{logger['info'](_0x4e77('0x12'),_0x13e10d,_0x4e77('0x13'));_0x3764f3(_0x31f0f7['result'][_0x4e77('0x17')]);}})[_0x4e77('0x18')](function(_0x3b639e){logger[_0x4e77('0x16')](_0x4e77('0x12'),_0x13e10d,_0x3b639e);_0x3fef13(_0x3b639e);});});}exports['CreatePlugin']=function(_0x5d700b){var _0x5997d0=this;return new Promise(function(_0x1423dc,_0x1e4064){return db[_0x4e77('0x19')][_0x4e77('0x1a')](_0x5d700b[_0x4e77('0x1b')],{'raw':_0x5d700b[_0x4e77('0x1c')]?_0x5d700b[_0x4e77('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x4e77('0x10')](function(_0x507cc0){logger['info']('CreatePlugin',_0x5d700b);logger[_0x4e77('0x14')](_0x4e77('0x1d'),_0x5d700b,JSON['stringify'](_0x507cc0));_0x1423dc(_0x507cc0);})[_0x4e77('0x18')](function(_0x3ce2dd){logger['error']('CreatePlugin',_0x3ce2dd[_0x4e77('0x17')],_0x5d700b);_0x1e4064(_0x5997d0[_0x4e77('0x16')](0x1f4,_0x3ce2dd['message']));});});}; \ No newline at end of file +var _0x9acd=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','register','request','info','Plugin,\x20%s,\x20%s','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','create','options','raw','then','CreatePlugin','debug','stringify','lodash','util'];(function(_0x2f95b9,_0x56b270){var _0x2b31e2=function(_0x821258){while(--_0x821258){_0x2f95b9['push'](_0x2f95b9['shift']());}};_0x2b31e2(++_0x56b270);}(_0x9acd,0x103));var _0xd9ac=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9acd[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0xd9ac('0x0'));var util=require(_0xd9ac('0x1'));var moment=require(_0xd9ac('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ac('0x3'));var fs=require('fs');var Redis=require(_0xd9ac('0x4'));var db=require(_0xd9ac('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9ac('0x6'))(_0xd9ac('0x7'));var config=require(_0xd9ac('0x8'));var jayson=require(_0xd9ac('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xd9ac('0xa')](config[_0xd9ac('0xb')],{'host':_0xd9ac('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd9ac('0xb')]));require('./plugin.socket')[_0xd9ac('0xd')](socket);function respondWithRpcPromise(_0x299a8c,_0x35cc82,_0xbeb896){return new BPromise(function(_0x2301ef,_0xcda916){return client[_0xd9ac('0xe')](_0x299a8c,_0xbeb896)['then'](function(_0x17e9fe){logger[_0xd9ac('0xf')](_0xd9ac('0x10'),_0x35cc82,'request\x20sent');logger['debug'](_0xd9ac('0x11'),_0x35cc82,_0xd9ac('0x12'),JSON['stringify'](_0x17e9fe));if(_0x17e9fe[_0xd9ac('0x13')]){if(_0x17e9fe[_0xd9ac('0x13')]['code']===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x35cc82,_0x17e9fe[_0xd9ac('0x13')][_0xd9ac('0x14')]);return _0xcda916(_0x17e9fe[_0xd9ac('0x13')][_0xd9ac('0x14')]);}logger[_0xd9ac('0x13')](_0xd9ac('0x10'),_0x35cc82,_0x17e9fe[_0xd9ac('0x13')][_0xd9ac('0x14')]);return _0x2301ef(_0x17e9fe[_0xd9ac('0x13')][_0xd9ac('0x14')]);}else{logger[_0xd9ac('0xf')](_0xd9ac('0x10'),_0x35cc82,_0xd9ac('0x12'));_0x2301ef(_0x17e9fe['result']['message']);}})[_0xd9ac('0x15')](function(_0x5838e1){logger[_0xd9ac('0x13')](_0xd9ac('0x10'),_0x35cc82,_0x5838e1);_0xcda916(_0x5838e1);});});}exports['CreatePlugin']=function(_0x5b6183){var _0x1f460e=this;return new Promise(function(_0x569773,_0x1a7966){return db['Plugin'][_0xd9ac('0x16')](_0x5b6183['body'],{'raw':_0x5b6183[_0xd9ac('0x17')]?_0x5b6183[_0xd9ac('0x17')][_0xd9ac('0x18')]===undefined?!![]:![]:!![]})[_0xd9ac('0x19')](function(_0x221c82){logger[_0xd9ac('0xf')](_0xd9ac('0x1a'),_0x5b6183);logger[_0xd9ac('0x1b')](_0xd9ac('0x1a'),_0x5b6183,JSON[_0xd9ac('0x1c')](_0x221c82));_0x569773(_0x221c82);})[_0xd9ac('0x15')](function(_0x318857){logger[_0xd9ac('0x13')](_0xd9ac('0x1a'),_0x318857[_0xd9ac('0x14')],_0x5b6183);_0x1a7966(_0x1f460e[_0xd9ac('0x13')](0x1f4,_0x318857[_0xd9ac('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 1d44353..85e0312 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 _0x9809=['./plugin.events','save','remove','update','removeListener','register','length'];(function(_0x17643c,_0x4fb02f){var _0xfc476e=function(_0x3e3ba7){while(--_0x3e3ba7){_0x17643c['push'](_0x17643c['shift']());}};_0xfc476e(++_0x4fb02f);}(_0x9809,0x1b2));var _0x9980=function(_0x111abd,_0x4d1281){_0x111abd=_0x111abd-0x0;var _0x57b1c7=_0x9809[_0x111abd];return _0x57b1c7;};'use strict';var PluginEvents=require(_0x9980('0x0'));var events=[_0x9980('0x1'),_0x9980('0x2'),_0x9980('0x3')];function createListener(_0x5c7eab,_0x65648c){return function(_0x1e537b){_0x65648c['emit'](_0x5c7eab,_0x1e537b);};}function removeListener(_0x11305e,_0x3f772d){return function(){PluginEvents[_0x9980('0x4')](_0x11305e,_0x3f772d);};}exports[_0x9980('0x5')]=function(_0x333cf2){for(var _0x225429=0x0,_0x25d908=events[_0x9980('0x6')];_0x225429<_0x25d908;_0x225429++){var _0x63bf6b=events[_0x225429];var _0x4fc0be=createListener('plugin:'+_0x63bf6b,_0x333cf2);PluginEvents['on'](_0x63bf6b,_0x4fc0be);}}; \ No newline at end of file +var _0x3870=['remove','emit','removeListener','register','length','plugin:','./plugin.events','save'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x3870,0x146));var _0x0387=function(_0x21b762,_0x2743cf){_0x21b762=_0x21b762-0x0;var _0x3532a8=_0x3870[_0x21b762];return _0x3532a8;};'use strict';var PluginEvents=require(_0x0387('0x0'));var events=[_0x0387('0x1'),_0x0387('0x2'),'update'];function createListener(_0x46d9b1,_0x58b02a){return function(_0x310701){_0x58b02a[_0x0387('0x3')](_0x46d9b1,_0x310701);};}function removeListener(_0x5772dc,_0x2febe2){return function(){PluginEvents[_0x0387('0x4')](_0x5772dc,_0x2febe2);};}exports[_0x0387('0x5')]=function(_0x59294e){for(var _0x18976e=0x0,_0x25209b=events[_0x0387('0x6')];_0x18976e<_0x25209b;_0x18976e++){var _0x13073a=events[_0x18976e];var _0x594efe=createListener(_0x0387('0x7')+_0x13073a,_0x59294e);PluginEvents['on'](_0x13073a,_0x594efe);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 9977d48..0aa83c9 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 _0xffaf=['put','isAuthenticated','update','exports','express','Router','../../components/auth/service','./pm2.controller','get','/:id','show','post'];(function(_0x24201a,_0x3ed184){var _0x36a6b9=function(_0x300d74){while(--_0x300d74){_0x24201a['push'](_0x24201a['shift']());}};_0x36a6b9(++_0x3ed184);}(_0xffaf,0x19c));var _0xfffa=function(_0x21c6b8,_0x16d6f6){_0x21c6b8=_0x21c6b8-0x0;var _0x39d474=_0xffaf[_0x21c6b8];return _0x39d474;};'use strict';var express=require(_0xfffa('0x0'));var router=express[_0xfffa('0x1')]();var auth=require(_0xfffa('0x2'));var controller=require(_0xfffa('0x3'));router[_0xfffa('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfffa('0x4')](_0xfffa('0x5'),auth['isAuthenticated'](),controller[_0xfffa('0x6')]);router[_0xfffa('0x7')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfffa('0x8')](_0xfffa('0x5'),auth[_0xfffa('0x9')](),controller[_0xfffa('0xa')]);router['delete'](_0xfffa('0x5'),auth[_0xfffa('0x9')](),controller['destroy']);module[_0xfffa('0xb')]=router; \ No newline at end of file +var _0xf933=['get','isAuthenticated','index','/:id','create','put','delete','destroy','exports','express','Router','../../components/auth/service'];(function(_0x4b3e49,_0x9e566c){var _0x57e339=function(_0x1430e9){while(--_0x1430e9){_0x4b3e49['push'](_0x4b3e49['shift']());}};_0x57e339(++_0x9e566c);}(_0xf933,0x11d));var _0x3f93=function(_0x7cb10c,_0x2fcc3a){_0x7cb10c=_0x7cb10c-0x0;var _0x11df59=_0xf933[_0x7cb10c];return _0x11df59;};'use strict';var express=require(_0x3f93('0x0'));var router=express[_0x3f93('0x1')]();var auth=require(_0x3f93('0x2'));var controller=require('./pm2.controller');router[_0x3f93('0x3')]('/',auth[_0x3f93('0x4')](),controller[_0x3f93('0x5')]);router[_0x3f93('0x3')](_0x3f93('0x6'),auth[_0x3f93('0x4')](),controller['show']);router['post']('/',auth[_0x3f93('0x4')](),controller[_0x3f93('0x7')]);router[_0x3f93('0x8')](_0x3f93('0x6'),auth[_0x3f93('0x4')](),controller['update']);router[_0x3f93('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x3f93('0xa')]);module[_0x3f93('0xb')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index f027770..f50d02e 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 _0x716b=['body','script','join','../../files/plugins','cwd','chdir','start','dump','restart','stop','hasOwnProperty','destroy','delete','../../config/pm2','../../config/logger','child_process','bluebird','sendStatus','status','stack','name','send','info','index','list','then','reject','express','motion2','length','catch','show','describe','params','create'];(function(_0x149a0e,_0x33891a){var _0x44621c=function(_0x87d630){while(--_0x87d630){_0x149a0e['push'](_0x149a0e['shift']());}};_0x44621c(++_0x33891a);}(_0x716b,0x102));var _0xb716=function(_0x280438,_0x1a2b94){_0x280438=_0x280438-0x0;var _0x26c9d6=_0x716b[_0x280438];return _0x26c9d6;};'use strict';var _=require('lodash');var pm2=require(_0xb716('0x0'));var logger=require(_0xb716('0x1'))('api');var path=require('path');var exec=require(_0xb716('0x2'))['exec'];var BPromise=require(_0xb716('0x3'));function handleEntityNotFound(_0x1a0d0d,_0x4fe50a){return function(_0x7dbcf1){if(!_0x7dbcf1){_0x1a0d0d[_0xb716('0x4')](0x194);;}return _0x7dbcf1;};}function respondWithResult(_0x3d21ee,_0x60f357){_0x60f357=_0x60f357||0xc8;return function(_0x1cb453){if(_0x1cb453){return _0x3d21ee[_0xb716('0x5')](_0x60f357)['json'](_0x1cb453);}return null;};}function handleError(_0x453e30,_0x214c2d){_0x214c2d=_0x214c2d||0x1f4;return function(_0x340f8c){logger['error'](_0x340f8c[_0xb716('0x6')]);if(_0x340f8c[_0xb716('0x7')]){delete _0x340f8c[_0xb716('0x7')];}_0x453e30[_0xb716('0x5')](_0x214c2d)[_0xb716('0x8')](_0x340f8c);};}function execChildProcess(){return new BPromise(function(_0x3d24d0,_0x4b3e6c){exec('npm\x20install',function(_0xf36db3,_0x5644cf,_0x4a710b){logger[_0xb716('0x9')](_0x5644cf);logger[_0xb716('0x9')](_0x4a710b);if(_0xf36db3){logger['error'](_0xf36db3);return _0x4b3e6c(_0xf36db3);}return _0x3d24d0(_0x5644cf);});});}exports[_0xb716('0xa')]=function(_0x20e900,_0x5c7f8d){return pm2[_0xb716('0xb')]()[_0xb716('0xc')](function(_0x1ac7d6){if(_0x1ac7d6){var _0x1e9e2e=_[_0xb716('0xd')](_0x1ac7d6,function(_0x1c7a49){return _0x1c7a49[_0xb716('0x7')]===_0xb716('0xe')||_0x1c7a49['name']===_0xb716('0xf');});return{'rows':_0x1e9e2e,'count':_0x1e9e2e[_0xb716('0x10')]};}return null;})[_0xb716('0xc')](respondWithResult(_0x5c7f8d,null))[_0xb716('0x11')](handleError(_0x5c7f8d,null));};exports[_0xb716('0x12')]=function(_0x5979bd,_0x105307){return pm2[_0xb716('0x13')](_0x5979bd[_0xb716('0x14')]['id'])[_0xb716('0xc')](respondWithResult(_0x105307,null))[_0xb716('0xc')](handleEntityNotFound(_0x105307,null))[_0xb716('0x11')](handleError(_0x105307,null));};exports[_0xb716('0x15')]=function(_0x2d9638,_0x3796b5){if(_0x2d9638[_0xb716('0x16')]['name']&&_0x2d9638[_0xb716('0x16')][_0xb716('0x17')]){var _0x23d1e6=path[_0xb716('0x18')](__dirname,_0xb716('0x19'),_0x2d9638[_0xb716('0x16')][_0xb716('0x17')]);var _0x5f17fe=process[_0xb716('0x1a')]();process[_0xb716('0x1b')](path['dirname'](_0x23d1e6));return execChildProcess()['then'](function(_0xad169){process[_0xb716('0x1b')](_0x5f17fe);return pm2[_0xb716('0x1c')]({'name':_0x2d9638['body'][_0xb716('0x7')],'script':_0x23d1e6});})[_0xb716('0xc')](function(_0x380f2c){pm2[_0xb716('0x1d')]();return _0x380f2c[0x0];})[_0xb716('0xc')](respondWithResult(_0x3796b5,0xc9))[_0xb716('0x11')](handleError(_0x3796b5,null));}else{return _0x3796b5['status'](0x1f4)[_0xb716('0x8')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x4535e3,_0x26c300){if(_0x4535e3['body']['id']){delete _0x4535e3[_0xb716('0x16')]['id'];}var _0xf07292={'online':_0xb716('0x1e'),'stopped':_0xb716('0x1f')};if(_0xf07292[_0xb716('0x20')](_0x4535e3[_0xb716('0x16')][_0xb716('0x5')])){return pm2[_0xf07292[_0x4535e3[_0xb716('0x16')][_0xb716('0x5')]]](_0x4535e3[_0xb716('0x14')]['id'])[_0xb716('0xc')](respondWithResult(_0x26c300,0xc8))[_0xb716('0x11')](handleError(_0x26c300,null));}else{return _0x26c300[_0xb716('0x5')](0x1f4)['send']({'message':'Unknown\x20status'});}};exports[_0xb716('0x21')]=function(_0x18d369,_0x5bb21f){if(_0x18d369[_0xb716('0x16')]['id']){delete _0x18d369[_0xb716('0x16')]['id'];}if(_0x18d369[_0xb716('0x14')]['id']){return pm2[_0xb716('0x22')](_0x18d369[_0xb716('0x14')]['id'])[_0xb716('0xc')](function(_0x1586d3){pm2['dump']();return _0x1586d3[0x0];})['then'](respondWithResult(_0x5bb21f,null))['catch'](handleError(_0x5bb21f,null));}else{return _0x5bb21f[_0xb716('0x5')](0x1f4)[_0xb716('0x8')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xe158=['destroy','Unknown\x20id','../../config/pm2','path','child_process','exec','sendStatus','json','error','name','status','info','index','list','then','reject','motion2','length','show','describe','params','create','body','script','../../files/plugins','cwd','start','dump','catch','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe158,0x122));var _0x8e15=function(_0xed4881,_0x45771c){_0xed4881=_0xed4881-0x0;var _0x7fcbd5=_0xe158[_0xed4881];return _0x7fcbd5;};'use strict';var _=require('lodash');var pm2=require(_0x8e15('0x0'));var logger=require('../../config/logger')('api');var path=require(_0x8e15('0x1'));var exec=require(_0x8e15('0x2'))[_0x8e15('0x3')];var BPromise=require('bluebird');function handleEntityNotFound(_0x25dd8b,_0x32b844){return function(_0x5cadd2){if(!_0x5cadd2){_0x25dd8b[_0x8e15('0x4')](0x194);;}return _0x5cadd2;};}function respondWithResult(_0x34f4eb,_0x3fd340){_0x3fd340=_0x3fd340||0xc8;return function(_0x389a10){if(_0x389a10){return _0x34f4eb['status'](_0x3fd340)[_0x8e15('0x5')](_0x389a10);}return null;};}function handleError(_0x416e2a,_0x16b14d){_0x16b14d=_0x16b14d||0x1f4;return function(_0x3605ec){logger[_0x8e15('0x6')](_0x3605ec['stack']);if(_0x3605ec[_0x8e15('0x7')]){delete _0x3605ec['name'];}_0x416e2a[_0x8e15('0x8')](_0x16b14d)['send'](_0x3605ec);};}function execChildProcess(){return new BPromise(function(_0x1adeff,_0x2b94b3){exec('npm\x20install',function(_0x17a908,_0x5d0d91,_0x202ae3){logger[_0x8e15('0x9')](_0x5d0d91);logger[_0x8e15('0x9')](_0x202ae3);if(_0x17a908){logger[_0x8e15('0x6')](_0x17a908);return _0x2b94b3(_0x17a908);}return _0x1adeff(_0x5d0d91);});});}exports[_0x8e15('0xa')]=function(_0x4b90c6,_0x1803cc){return pm2[_0x8e15('0xb')]()[_0x8e15('0xc')](function(_0x5bb3fa){if(_0x5bb3fa){var _0x3e2a29=_[_0x8e15('0xd')](_0x5bb3fa,function(_0x1595a9){return _0x1595a9[_0x8e15('0x7')]==='express'||_0x1595a9[_0x8e15('0x7')]===_0x8e15('0xe');});return{'rows':_0x3e2a29,'count':_0x3e2a29[_0x8e15('0xf')]};}return null;})['then'](respondWithResult(_0x1803cc,null))['catch'](handleError(_0x1803cc,null));};exports[_0x8e15('0x10')]=function(_0x486374,_0x374d6b){return pm2[_0x8e15('0x11')](_0x486374[_0x8e15('0x12')]['id'])[_0x8e15('0xc')](respondWithResult(_0x374d6b,null))[_0x8e15('0xc')](handleEntityNotFound(_0x374d6b,null))['catch'](handleError(_0x374d6b,null));};exports[_0x8e15('0x13')]=function(_0x116708,_0x438c98){if(_0x116708[_0x8e15('0x14')][_0x8e15('0x7')]&&_0x116708[_0x8e15('0x14')][_0x8e15('0x15')]){var _0x22f977=path['join'](__dirname,_0x8e15('0x16'),_0x116708[_0x8e15('0x14')][_0x8e15('0x15')]);var _0x537778=process[_0x8e15('0x17')]();process['chdir'](path['dirname'](_0x22f977));return execChildProcess()[_0x8e15('0xc')](function(_0x481d6e){process['chdir'](_0x537778);return pm2[_0x8e15('0x18')]({'name':_0x116708['body'][_0x8e15('0x7')],'script':_0x22f977});})[_0x8e15('0xc')](function(_0x2ffc79){pm2[_0x8e15('0x19')]();return _0x2ffc79[0x0];})[_0x8e15('0xc')](respondWithResult(_0x438c98,0xc9))[_0x8e15('0x1a')](handleError(_0x438c98,null));}else{return _0x438c98[_0x8e15('0x8')](0x1f4)[_0x8e15('0x1b')]({'message':_0x8e15('0x1c')});}};exports[_0x8e15('0x1d')]=function(_0x155c39,_0x231529){if(_0x155c39[_0x8e15('0x14')]['id']){delete _0x155c39[_0x8e15('0x14')]['id'];}var _0x31931b={'online':_0x8e15('0x1e'),'stopped':_0x8e15('0x1f')};if(_0x31931b[_0x8e15('0x20')](_0x155c39[_0x8e15('0x14')][_0x8e15('0x8')])){return pm2[_0x31931b[_0x155c39[_0x8e15('0x14')][_0x8e15('0x8')]]](_0x155c39[_0x8e15('0x12')]['id'])[_0x8e15('0xc')](respondWithResult(_0x231529,0xc8))[_0x8e15('0x1a')](handleError(_0x231529,null));}else{return _0x231529[_0x8e15('0x8')](0x1f4)[_0x8e15('0x1b')]({'message':_0x8e15('0x21')});}};exports[_0x8e15('0x22')]=function(_0x46290e,_0x577bef){if(_0x46290e[_0x8e15('0x14')]['id']){delete _0x46290e[_0x8e15('0x14')]['id'];}if(_0x46290e[_0x8e15('0x12')]['id']){return pm2['delete'](_0x46290e['params']['id'])[_0x8e15('0xc')](function(_0x458e82){pm2[_0x8e15('0x19')]();return _0x458e82[0x0];})[_0x8e15('0xc')](respondWithResult(_0x577bef,null))['catch'](handleError(_0x577bef,null));}else{return _0x577bef[_0x8e15('0x8')](0x1f4)[_0x8e15('0x1b')]({'message':_0x8e15('0x23')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index ce486d0..6980127 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 _0xf17f=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','../../components/auth/service'];(function(_0x4cba28,_0x174f6d){var _0x540267=function(_0xe3244b){while(--_0xe3244b){_0x4cba28['push'](_0x4cba28['shift']());}};_0x540267(++_0x174f6d);}(_0xf17f,0x113));var _0xff17=function(_0x16795f,_0x533662){_0x16795f=_0x16795f-0x0;var _0x328f13=_0xf17f[_0x16795f];return _0x328f13;};'use strict';var multer=require(_0xff17('0x0'));var util=require(_0xff17('0x1'));var path=require(_0xff17('0x2'));var timeout=require('connect-timeout');var express=require(_0xff17('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xff17('0x4'));var interaction=require(_0xff17('0x5'));var config=require(_0xff17('0x6'));module[_0xff17('0x7')]=router; \ No newline at end of file +var _0x2f8b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','connect-timeout'];(function(_0x436e4d,_0x4d4724){var _0x2e0fc9=function(_0x4a3bf1){while(--_0x4a3bf1){_0x436e4d['push'](_0x436e4d['shift']());}};_0x2e0fc9(++_0x4d4724);}(_0x2f8b,0x96));var _0xb2f8=function(_0x288406,_0x4872f5){_0x288406=_0x288406-0x0;var _0x20351e=_0x2f8b[_0x288406];return _0x20351e;};'use strict';var multer=require(_0xb2f8('0x0'));var util=require(_0xb2f8('0x1'));var path=require('path');var timeout=require(_0xb2f8('0x2'));var express=require(_0xb2f8('0x3'));var router=express[_0xb2f8('0x4')]();var fs_extra=require(_0xb2f8('0x5'));var auth=require(_0xb2f8('0x6'));var interaction=require(_0xb2f8('0x7'));var config=require(_0xb2f8('0x8'));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 20d247b..8dd2210 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 _0xb7d7=['INTEGER','sequelize','exports','STRING'];(function(_0x152121,_0x120c53){var _0x592a85=function(_0x241cab){while(--_0x241cab){_0x152121['push'](_0x152121['shift']());}};_0x592a85(++_0x120c53);}(_0xb7d7,0x145));var _0x7b7d=function(_0x497c85,_0x36ae23){_0x497c85=_0x497c85-0x0;var _0xa5a546=_0xb7d7[_0x497c85];return _0xa5a546;};'use strict';var Sequelize=require(_0x7b7d('0x0'));module[_0x7b7d('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x7b7d('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x7b7d('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x7b7d('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x7b7d('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x39da=['DATE','sequelize','INTEGER','STRING'];(function(_0x2a8860,_0x2da926){var _0x2f47a4=function(_0x3b7f54){while(--_0x3b7f54){_0x2a8860['push'](_0x2a8860['shift']());}};_0x2f47a4(++_0x2da926);}(_0x39da,0x171));var _0xa39d=function(_0x3afea8,_0x5179e1){_0x3afea8=_0x3afea8-0x0;var _0x4599ac=_0x39da[_0x3afea8];return _0x4599ac;};'use strict';var Sequelize=require(_0xa39d('0x0'));module['exports']={'state':{'type':Sequelize[_0xa39d('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xa39d('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xa39d('0x2')]},'starttime':{'type':Sequelize[_0xa39d('0x3')]},'responsetime':{'type':Sequelize[_0xa39d('0x3')]},'ringtime':{'type':Sequelize[_0xa39d('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xa39d('0x2')]},'campaigntype':{'type':Sequelize[_0xa39d('0x2')]},'membername':{'type':Sequelize[_0xa39d('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 68b5a5c..33b55ea 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 _0x5d27=['bluebird','path','rimraf','../../config/environment','exports','define','ReportAgentPreview','report_agent_preview','util','api','moment'];(function(_0x35021c,_0x3c79cb){var _0x3497ae=function(_0x17dd36){while(--_0x17dd36){_0x35021c['push'](_0x35021c['shift']());}};_0x3497ae(++_0x3c79cb);}(_0x5d27,0x126));var _0x75d2=function(_0x23a959,_0x5c39dd){_0x23a959=_0x23a959-0x0;var _0x2b73dd=_0x5d27[_0x23a959];return _0x2b73dd;};'use strict';var _=require('lodash');var util=require(_0x75d2('0x0'));var logger=require('../../config/logger')(_0x75d2('0x1'));var moment=require(_0x75d2('0x2'));var BPromise=require(_0x75d2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x75d2('0x4'));var rimraf=require(_0x75d2('0x5'));var config=require(_0x75d2('0x6'));var attributes=require('./reportAgentPreview.attributes');module[_0x75d2('0x7')]=function(_0x3ca3a1,_0x2d33d6){return _0x3ca3a1[_0x75d2('0x8')](_0x75d2('0x9'),attributes,{'tableName':_0x75d2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1c9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xe1c9,0xf9));var _0x9e1c=function(_0x271537,_0x8b7b3b){_0x271537=_0x271537-0x0;var _0x19dc22=_0xe1c9[_0x271537];return _0x19dc22;};'use strict';var _=require(_0x9e1c('0x0'));var util=require(_0x9e1c('0x1'));var logger=require(_0x9e1c('0x2'))('api');var moment=require(_0x9e1c('0x3'));var BPromise=require(_0x9e1c('0x4'));var rp=require(_0x9e1c('0x5'));var fs=require('fs');var path=require(_0x9e1c('0x6'));var rimraf=require(_0x9e1c('0x7'));var config=require(_0x9e1c('0x8'));var attributes=require(_0x9e1c('0x9'));module[_0x9e1c('0xa')]=function(_0x3008a1,_0x25d63e){return _0x3008a1[_0x9e1c('0xb')](_0x9e1c('0xc'),attributes,{'tableName':_0x9e1c('0xd'),'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 d583c02..a34e4ff 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 _0xad91=['request','then','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','ReportAgentPreview','create','body','options','CreateReportAgentPreview','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0xad91,0xa8));var _0x1ad9=function(_0xd6ddab,_0x3f700e){_0xd6ddab=_0xd6ddab-0x0;var _0x81549e=_0xad91[_0xd6ddab];return _0x81549e;};'use strict';var _=require(_0x1ad9('0x0'));var util=require(_0x1ad9('0x1'));var moment=require('moment');var BPromise=require(_0x1ad9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ad9('0x3'));var db=require(_0x1ad9('0x4'))['db'];var utils=require(_0x1ad9('0x5'));var logger=require(_0x1ad9('0x6'))(_0x1ad9('0x7'));var config=require(_0x1ad9('0x8'));var jayson=require(_0x1ad9('0x9'));var client=jayson[_0x1ad9('0xa')][_0x1ad9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31d01d,_0x5b9b68,_0x1f1550){return new BPromise(function(_0x2ca541,_0x311e41){return client[_0x1ad9('0xc')](_0x31d01d,_0x1f1550)[_0x1ad9('0xd')](function(_0x41991d){logger['info'](_0x1ad9('0xe'),_0x5b9b68,'request\x20sent');logger[_0x1ad9('0xf')](_0x1ad9('0x10'),_0x5b9b68,_0x1ad9('0x11'),JSON[_0x1ad9('0x12')](_0x41991d));if(_0x41991d[_0x1ad9('0x13')]){if(_0x41991d[_0x1ad9('0x13')][_0x1ad9('0x14')]===0x1f4){logger['error'](_0x1ad9('0xe'),_0x5b9b68,_0x41991d[_0x1ad9('0x13')][_0x1ad9('0x15')]);return _0x311e41(_0x41991d[_0x1ad9('0x13')][_0x1ad9('0x15')]);}logger[_0x1ad9('0x13')](_0x1ad9('0xe'),_0x5b9b68,_0x41991d['error'][_0x1ad9('0x15')]);return _0x2ca541(_0x41991d[_0x1ad9('0x13')][_0x1ad9('0x15')]);}else{logger[_0x1ad9('0x16')](_0x1ad9('0xe'),_0x5b9b68,_0x1ad9('0x11'));_0x2ca541(_0x41991d[_0x1ad9('0x17')][_0x1ad9('0x15')]);}})[_0x1ad9('0x18')](function(_0x55e109){logger['error'](_0x1ad9('0xe'),_0x5b9b68,_0x55e109);_0x311e41(_0x55e109);});});}exports['CreateReportAgentPreview']=function(_0x1558fd){var _0x1f5e80=this;return new Promise(function(_0x7a378e,_0x3ef122){return db[_0x1ad9('0x19')][_0x1ad9('0x1a')](_0x1558fd[_0x1ad9('0x1b')],{'raw':_0x1558fd[_0x1ad9('0x1c')]?_0x1558fd[_0x1ad9('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x527e17){logger['info'](_0x1ad9('0x1d'),_0x1558fd);logger[_0x1ad9('0xf')](_0x1ad9('0x1d'),_0x1558fd,JSON[_0x1ad9('0x12')](_0x527e17));_0x7a378e(_0x527e17);})[_0x1ad9('0x18')](function(_0x55c4ba){logger[_0x1ad9('0x13')](_0x1ad9('0x1d'),_0x55c4ba[_0x1ad9('0x15')],_0x1558fd);_0x3ef122(_0x1f5e80[_0x1ad9('0x13')](0x1f4,_0x55c4ba[_0x1ad9('0x15')]));});});}; \ No newline at end of file +var _0x9627=['rpc','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateReportAgentPreview','create','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0xa07ce,_0x55d3e5){var _0x31d32f=function(_0x37dd52){while(--_0x37dd52){_0xa07ce['push'](_0xa07ce['shift']());}};_0x31d32f(++_0x55d3e5);}(_0x9627,0x1b9));var _0x7962=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x9627[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x7962('0x0'));var util=require(_0x7962('0x1'));var moment=require(_0x7962('0x2'));var BPromise=require(_0x7962('0x3'));var rs=require(_0x7962('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7962('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7962('0x6'))(_0x7962('0x7'));var config=require('../../config/environment');var jayson=require(_0x7962('0x8'));var client=jayson[_0x7962('0x9')][_0x7962('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39bc78,_0x3d3c48,_0x374fd6){return new BPromise(function(_0x3061a0,_0x5e136b){return client[_0x7962('0xb')](_0x39bc78,_0x374fd6)[_0x7962('0xc')](function(_0x1b2513){logger['info'](_0x7962('0xd'),_0x3d3c48,_0x7962('0xe'));logger[_0x7962('0xf')](_0x7962('0x10'),_0x3d3c48,_0x7962('0xe'),JSON[_0x7962('0x11')](_0x1b2513));if(_0x1b2513[_0x7962('0x12')]){if(_0x1b2513[_0x7962('0x12')][_0x7962('0x13')]===0x1f4){logger[_0x7962('0x12')](_0x7962('0xd'),_0x3d3c48,_0x1b2513[_0x7962('0x12')][_0x7962('0x14')]);return _0x5e136b(_0x1b2513[_0x7962('0x12')][_0x7962('0x14')]);}logger[_0x7962('0x12')](_0x7962('0xd'),_0x3d3c48,_0x1b2513['error']['message']);return _0x3061a0(_0x1b2513[_0x7962('0x12')][_0x7962('0x14')]);}else{logger[_0x7962('0x15')](_0x7962('0xd'),_0x3d3c48,_0x7962('0xe'));_0x3061a0(_0x1b2513[_0x7962('0x16')][_0x7962('0x14')]);}})[_0x7962('0x17')](function(_0x4574c1){logger[_0x7962('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x3d3c48,_0x4574c1);_0x5e136b(_0x4574c1);});});}exports[_0x7962('0x18')]=function(_0x4080d1){var _0x2314be=this;return new Promise(function(_0xfee26a,_0x3a052c){return db['ReportAgentPreview'][_0x7962('0x19')](_0x4080d1['body'],{'raw':_0x4080d1[_0x7962('0x1a')]?_0x4080d1['options'][_0x7962('0x1b')]===undefined?!![]:![]:!![]})[_0x7962('0xc')](function(_0x48f37d){logger[_0x7962('0x15')](_0x7962('0x18'),_0x4080d1);logger[_0x7962('0xf')](_0x7962('0x18'),_0x4080d1,JSON[_0x7962('0x11')](_0x48f37d));_0xfee26a(_0x48f37d);})[_0x7962('0x17')](function(_0x48f9ff){logger[_0x7962('0x12')]('CreateReportAgentPreview',_0x48f9ff['message'],_0x4080d1);_0x3a052c(_0x2314be[_0x7962('0x12')](0x1f4,_0x48f9ff[_0x7962('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 658284d..6e6fb15 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 _0x6f62=['outbound','outboundChannels','/agents','agents','/agents/:id/capacity','/telephones','/trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound'];(function(_0x5e174f,_0x44f7c4){var _0x79c856=function(_0xa1231){while(--_0xa1231){_0x5e174f['push'](_0x5e174f['shift']());}};_0x79c856(++_0x44f7c4);}(_0x6f62,0x12c));var _0x26f6=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0x6f62[_0xcf5436];return _0xc4f5c8;};'use strict';var multer=require(_0x26f6('0x0'));var util=require(_0x26f6('0x1'));var path=require('path');var express=require(_0x26f6('0x2'));var router=express[_0x26f6('0x3')]();var auth=require(_0x26f6('0x4'));var controller=require(_0x26f6('0x5'));router[_0x26f6('0x6')](_0x26f6('0x7'),auth['isAuthenticated'](),controller['voiceChannels']);router[_0x26f6('0x6')](_0x26f6('0x8'),auth[_0x26f6('0x9')](),controller[_0x26f6('0xa')]);router[_0x26f6('0x6')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x26f6('0x9')](),controller[_0x26f6('0xb')]);router[_0x26f6('0x6')](_0x26f6('0xc'),auth['isAuthenticated'](),controller[_0x26f6('0xd')]);router[_0x26f6('0x6')](_0x26f6('0xe'),auth[_0x26f6('0x9')](),controller[_0x26f6('0xf')]);router[_0x26f6('0x6')]('/mail/queues',auth[_0x26f6('0x9')](),controller[_0x26f6('0x10')]);router['get'](_0x26f6('0x11'),auth[_0x26f6('0x9')](),controller['mailAccounts']);router[_0x26f6('0x6')]('/openchannel/queues',auth['isAuthenticated'](),controller['openchannelQueues']);router[_0x26f6('0x6')](_0x26f6('0x12'),auth['isAuthenticated'](),controller[_0x26f6('0x13')]);router['get'](_0x26f6('0x14'),auth[_0x26f6('0x9')](),controller[_0x26f6('0x15')]);router[_0x26f6('0x6')]('/fax/queues',auth[_0x26f6('0x9')](),controller[_0x26f6('0x16')]);router[_0x26f6('0x6')](_0x26f6('0x17'),auth[_0x26f6('0x9')](),controller['voiceQueuesPreview']);router[_0x26f6('0x6')](_0x26f6('0x18'),auth[_0x26f6('0x9')](),controller[_0x26f6('0x19')]);router['get']('/voice/queues/channels/:uniqueid',auth[_0x26f6('0x9')](),controller[_0x26f6('0x1a')]);router[_0x26f6('0x6')](_0x26f6('0x1b'),auth[_0x26f6('0x9')](),controller[_0x26f6('0x1c')]);router['get'](_0x26f6('0x1d'),auth[_0x26f6('0x9')](),controller[_0x26f6('0x1e')]);router['get']('/voice/queues/:id',auth[_0x26f6('0x9')](),controller[_0x26f6('0x1f')]);router[_0x26f6('0x20')](_0x26f6('0x21'),auth[_0x26f6('0x9')](),controller[_0x26f6('0x22')]);router['get'](_0x26f6('0x23'),auth[_0x26f6('0x9')](),controller[_0x26f6('0x24')]);router[_0x26f6('0x6')]('/outbound/channels',auth[_0x26f6('0x9')](),controller[_0x26f6('0x25')]);router[_0x26f6('0x6')](_0x26f6('0x26'),auth[_0x26f6('0x9')](),controller[_0x26f6('0x27')]);router['put'](_0x26f6('0x28'),auth['isAuthenticated'](),controller['agentCapacity']);router[_0x26f6('0x6')](_0x26f6('0x29'),auth[_0x26f6('0x9')](),controller['telephones']);router[_0x26f6('0x6')](_0x26f6('0x2a'),auth['isAuthenticated'](),controller['trunks']);router[_0x26f6('0x6')](_0x26f6('0x2b'),auth[_0x26f6('0x9')](),controller[_0x26f6('0x2c')]);router[_0x26f6('0x6')]('/fax/accounts',auth[_0x26f6('0x9')](),controller[_0x26f6('0x2d')]);router[_0x26f6('0x6')](_0x26f6('0x2e'),auth[_0x26f6('0x9')](),controller[_0x26f6('0x2f')]);router[_0x26f6('0x6')](_0x26f6('0x30'),auth[_0x26f6('0x9')](),controller[_0x26f6('0x31')]);router[_0x26f6('0x6')](_0x26f6('0x32'),auth[_0x26f6('0x9')](),controller[_0x26f6('0x33')]);router['get'](_0x26f6('0x34'),auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x26f6('0x6')](_0x26f6('0x35'),auth[_0x26f6('0x9')](),controller[_0x26f6('0x36')]);router['get'](_0x26f6('0x37'),auth['isAuthenticated'](),controller[_0x26f6('0x38')]);router[_0x26f6('0x6')](_0x26f6('0x39'),auth[_0x26f6('0x9')](),controller[_0x26f6('0x3a')]);router['post'](_0x26f6('0x3b'),auth['isAuthenticated'](),controller[_0x26f6('0x3c')](_0x26f6('0x3d')));router['get']('/mail/queues/:id',auth[_0x26f6('0x9')](),controller[_0x26f6('0x3e')]);router[_0x26f6('0x3f')](_0x26f6('0x40'),auth[_0x26f6('0x9')](),controller[_0x26f6('0x3c')](_0x26f6('0x41')));router[_0x26f6('0x6')](_0x26f6('0x42'),auth[_0x26f6('0x9')](),controller[_0x26f6('0x43')]);router['post'](_0x26f6('0x44'),auth[_0x26f6('0x9')](),controller[_0x26f6('0x3c')](_0x26f6('0x45')));router[_0x26f6('0x6')](_0x26f6('0x46'),auth[_0x26f6('0x9')](),controller['showFaxQueues']);router[_0x26f6('0x3f')](_0x26f6('0x47'),auth[_0x26f6('0x9')](),controller[_0x26f6('0x3c')]('openchannel'));router[_0x26f6('0x6')](_0x26f6('0x48'),auth[_0x26f6('0x9')](),controller['showOpenchannelQueues']);router[_0x26f6('0x3f')](_0x26f6('0x49'),auth[_0x26f6('0x9')](),controller[_0x26f6('0x3c')](_0x26f6('0x4a')));router[_0x26f6('0x3f')](_0x26f6('0x4b'),auth[_0x26f6('0x9')](),controller[_0x26f6('0x3c')](_0x26f6('0x4c')));router['get'](_0x26f6('0x4d'),auth['isAuthenticated'](),controller[_0x26f6('0x4e')]);router['get'](_0x26f6('0x4f'),auth[_0x26f6('0x9')](),controller[_0x26f6('0x50')]);router[_0x26f6('0x3f')](_0x26f6('0x51'),auth[_0x26f6('0x9')](),controller[_0x26f6('0x52')]);module[_0x26f6('0x53')]=router; \ No newline at end of file +var _0x07e4=['/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','showVoiceQueues','put','updateVoiceQueue','outbound','/outbound/channels','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/chat/queues/:id/notify','chat','/chat/queues/:id'];(function(_0x5538d5,_0x190032){var _0x323b1a=function(_0x179caa){while(--_0x179caa){_0x5538d5['push'](_0x5538d5['shift']());}};_0x323b1a(++_0x190032);}(_0x07e4,0x1da));var _0x407e=function(_0x5132df,_0x24b568){_0x5132df=_0x5132df-0x0;var _0x358a2c=_0x07e4[_0x5132df];return _0x358a2c;};'use strict';var multer=require(_0x407e('0x0'));var util=require(_0x407e('0x1'));var path=require('path');var express=require(_0x407e('0x2'));var router=express[_0x407e('0x3')]();var auth=require(_0x407e('0x4'));var controller=require(_0x407e('0x5'));router[_0x407e('0x6')]('/voice/channels',auth[_0x407e('0x7')](),controller[_0x407e('0x8')]);router[_0x407e('0x6')](_0x407e('0x9'),auth[_0x407e('0x7')](),controller[_0x407e('0xa')]);router[_0x407e('0x6')](_0x407e('0xb'),auth[_0x407e('0x7')](),controller['voiceChannelStopMixMonitor']);router[_0x407e('0x6')]('/voice/queues',auth['isAuthenticated'](),controller['voiceQueues']);router['get']('/chat/queues',auth[_0x407e('0x7')](),controller[_0x407e('0xc')]);router[_0x407e('0x6')]('/mail/queues',auth[_0x407e('0x7')](),controller[_0x407e('0xd')]);router['get'](_0x407e('0xe'),auth[_0x407e('0x7')](),controller[_0x407e('0xf')]);router[_0x407e('0x6')](_0x407e('0x10'),auth[_0x407e('0x7')](),controller[_0x407e('0x11')]);router[_0x407e('0x6')]('/sms/queues',auth[_0x407e('0x7')](),controller[_0x407e('0x12')]);router[_0x407e('0x6')](_0x407e('0x13'),auth[_0x407e('0x7')](),controller[_0x407e('0x14')]);router[_0x407e('0x6')](_0x407e('0x15'),auth[_0x407e('0x7')](),controller['faxQueues']);router[_0x407e('0x6')](_0x407e('0x16'),auth[_0x407e('0x7')](),controller[_0x407e('0x17')]);router['get'](_0x407e('0x18'),auth['isAuthenticated'](),controller['voiceQueuesChannels']);router[_0x407e('0x6')](_0x407e('0x19'),auth['isAuthenticated'](),controller[_0x407e('0x1a')]);router[_0x407e('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x407e('0x7')](),controller[_0x407e('0x1b')]);router[_0x407e('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x407e('0x7')](),controller[_0x407e('0x1c')]);router[_0x407e('0x6')]('/voice/queues/:id',auth[_0x407e('0x7')](),controller[_0x407e('0x1d')]);router[_0x407e('0x1e')]('/voice/queues/:id',auth[_0x407e('0x7')](),controller[_0x407e('0x1f')]);router[_0x407e('0x6')]('/outbound',auth['isAuthenticated'](),controller[_0x407e('0x20')]);router[_0x407e('0x6')](_0x407e('0x21'),auth['isAuthenticated'](),controller['outboundChannels']);router['get']('/agents',auth[_0x407e('0x7')](),controller[_0x407e('0x22')]);router[_0x407e('0x1e')](_0x407e('0x23'),auth[_0x407e('0x7')](),controller[_0x407e('0x24')]);router[_0x407e('0x6')](_0x407e('0x25'),auth[_0x407e('0x7')](),controller[_0x407e('0x26')]);router[_0x407e('0x6')](_0x407e('0x27'),auth[_0x407e('0x7')](),controller[_0x407e('0x28')]);router['get'](_0x407e('0x29'),auth[_0x407e('0x7')](),controller[_0x407e('0x2a')]);router[_0x407e('0x6')]('/fax/accounts',auth['isAuthenticated'](),controller[_0x407e('0x2b')]);router[_0x407e('0x6')]('/chat/queues/waitinginteractions',auth[_0x407e('0x7')](),controller['chatQueuesWaitingInteractions']);router['get'](_0x407e('0x2c'),auth[_0x407e('0x7')](),controller[_0x407e('0x2d')]);router[_0x407e('0x6')](_0x407e('0x2e'),auth['isAuthenticated'](),controller[_0x407e('0x2f')]);router[_0x407e('0x6')]('/openchannel/queues/:id/waitinginteractions',auth[_0x407e('0x7')](),controller['openchannelQueuesIdWaitingInteractions']);router['get'](_0x407e('0x30'),auth[_0x407e('0x7')](),controller[_0x407e('0x31')]);router[_0x407e('0x6')]('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x407e('0x32')]);router[_0x407e('0x6')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0x407e('0x33')](_0x407e('0x34'),auth[_0x407e('0x7')](),controller[_0x407e('0x35')](_0x407e('0x36')));router[_0x407e('0x6')]('/mail/queues/:id',auth[_0x407e('0x7')](),controller['showMailQueues']);router[_0x407e('0x33')](_0x407e('0x37'),auth['isAuthenticated'](),controller[_0x407e('0x35')](_0x407e('0x38')));router['get'](_0x407e('0x39'),auth[_0x407e('0x7')](),controller['showChatQueues']);router['post'](_0x407e('0x3a'),auth['isAuthenticated'](),controller[_0x407e('0x35')](_0x407e('0x3b')));router[_0x407e('0x6')](_0x407e('0x3c'),auth[_0x407e('0x7')](),controller[_0x407e('0x3d')]);router[_0x407e('0x33')](_0x407e('0x3e'),auth['isAuthenticated'](),controller[_0x407e('0x35')](_0x407e('0x3f')));router['get'](_0x407e('0x40'),auth['isAuthenticated'](),controller[_0x407e('0x41')]);router[_0x407e('0x33')](_0x407e('0x42'),auth[_0x407e('0x7')](),controller[_0x407e('0x35')](_0x407e('0x43')));router[_0x407e('0x33')](_0x407e('0x44'),auth[_0x407e('0x7')](),controller['queueNotify'](_0x407e('0x45')));router[_0x407e('0x6')]('/sms/queues/:id',auth[_0x407e('0x7')](),controller[_0x407e('0x46')]);router['get'](_0x407e('0x47'),auth[_0x407e('0x7')](),controller[_0x407e('0x48')]);router[_0x407e('0x33')](_0x407e('0x49'),auth['isAuthenticated'](),controller[_0x407e('0x4a')]);module[_0x407e('0x4b')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index fde02ae..a0db00c 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 _0xf71e=['isNil','rows','find','voiceChannels','VoiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','VoiceChannelStopMixMonitor','params','showVoiceQueues','VoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','interaction','user','hasOwnProperty','MemberReport','findAll','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','interface','SIP/%s','format','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Account','Queue','findOne','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','TransferReport','Start','queueTransferTimeout','*,*,*,*','channel','User','agent','Agent\x20not\x20found','create','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','api','client','http','request','code','error','message','catch','status','sendStatus','stack','name','send'];(function(_0x6866e3,_0x3ddb25){var _0x394cfe=function(_0x893aa8){while(--_0x893aa8){_0x6866e3['push'](_0x6866e3['shift']());}};_0x394cfe(++_0x3ddb25);}(_0xf71e,0x68));var _0xef71=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xf71e[_0x2fc012];return _0x2891f9;};'use strict';var BPromise=require(_0xef71('0x0'));var moment=require(_0xef71('0x1'));var _=require(_0xef71('0x2'));var util=require(_0xef71('0x3'));var db=require(_0xef71('0x4'))['db'];var logger=require('../../config/logger')(_0xef71('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0xef71('0x6')][_0xef71('0x7')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson['client'][_0xef71('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x4c8253,_0x261004,_0x4c1ae){return new BPromise(function(_0x2dde27,_0x4e5233){var _0xe436b7=_0x4c1ae?_0x4c1ae:amiClient;return _0xe436b7[_0xef71('0x8')](_0x4c8253,_0x261004)['then'](function(_0x360b8e){if(_0x360b8e['error']){if(_0x360b8e['error'][_0xef71('0x9')]===0x1f4){return _0x4e5233(_0x360b8e[_0xef71('0xa')][_0xef71('0xb')]);}return _0x2dde27(_0x360b8e['error'][_0xef71('0xb')]);}else{_0x2dde27(_0x360b8e['result']);}})[_0xef71('0xc')](function(_0x3eec08){_0x4e5233(_0x3eec08);});});}function respondWithResult(_0x1763af,_0x35ea65){_0x35ea65=_0x35ea65||0xc8;return function(_0x5b7f29){if(_0x5b7f29){return _0x1763af[_0xef71('0xd')](_0x35ea65)['json'](_0x5b7f29);}return _0x1763af[_0xef71('0xe')](0x194);};}function handleError(_0x41cdb6,_0x330177){_0x330177=_0x330177||0x1f4;return function(_0x3cb997){logger[_0xef71('0xa')](_0x3cb997[_0xef71('0xf')]);if(_0x3cb997['name']){delete _0x3cb997[_0xef71('0x10')];}_0x41cdb6[_0xef71('0xd')](_0x330177)[_0xef71('0x11')](_0x3cb997);};}function findById(_0xbad119){return function(_0x585c41){if(!_[_0xef71('0x12')](_0xbad119)&&!_[_0xef71('0x12')](_0x585c41)&&!_['isNil'](_0x585c41[_0xef71('0x13')])){return _[_0xef71('0x14')](_0x585c41[_0xef71('0x13')],function(_0x1056c7){return _0x1056c7['id']==_0xbad119;});}return null;};}exports[_0xef71('0x15')]=function(_0x4f2777,_0xb08be9){return respondWithRpcPromise(_0xef71('0x16'),_0x4f2777[_0xef71('0x17')])[_0xef71('0x18')](respondWithResult(_0xb08be9,null))[_0xef71('0xc')](handleError(_0xb08be9,null));};exports[_0xef71('0x19')]=function(_0x541ea0,_0x12492f){return respondWithRpcPromise(_0xef71('0x1a'),_[_0xef71('0x1b')](_0x541ea0[_0xef71('0x17')],_0x541ea0['params']))[_0xef71('0x18')](respondWithResult(_0x12492f,null))[_0xef71('0xc')](handleError(_0x12492f,null));};exports['voiceChannelStopMixMonitor']=function(_0x10c706,_0x4d5a6d){return respondWithRpcPromise(_0xef71('0x1c'),_['merge'](_0x10c706[_0xef71('0x17')],_0x10c706[_0xef71('0x1d')]))[_0xef71('0x18')](respondWithResult(_0x4d5a6d,null))['catch'](handleError(_0x4d5a6d,null));};exports['voiceQueues']=function(_0x4085c9,_0x34b36b){return respondWithRpcPromise('VoiceQueues',_0x4085c9[_0xef71('0x17')])['then'](respondWithResult(_0x34b36b,null))[_0xef71('0xc')](handleError(_0x34b36b,null));};exports[_0xef71('0x1e')]=function(_0x130e51,_0x5f03bd){return respondWithRpcPromise(_0xef71('0x1f'),_0x130e51[_0xef71('0x17')])[_0xef71('0x18')](findById(_0x130e51[_0xef71('0x1d')]['id']))[_0xef71('0x18')](respondWithResult(_0x5f03bd,null))[_0xef71('0xc')](handleError(_0x5f03bd,null));};exports['updateVoiceQueue']=function(_0x34caf1,_0x15bd69){return respondWithRpcPromise(_0xef71('0x20'),_['merge'](_0x34caf1[_0xef71('0x21')],_0x34caf1[_0xef71('0x1d')]))[_0xef71('0x18')](respondWithResult(_0x15bd69,null))[_0xef71('0xc')](handleError(_0x15bd69,null));};exports[_0xef71('0x22')]=function(_0x3c5193,_0xfb43fa){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xef71('0x1b')](_0x3c5193['query'],_0x3c5193['params']))[_0xef71('0x18')](respondWithResult(_0xfb43fa,null))['catch'](handleError(_0xfb43fa,null));};exports[_0xef71('0x23')]=function(_0x417eae,_0x11a94b){return respondWithRpcPromise(_0xef71('0x24'),_0x417eae[_0xef71('0x17')])[_0xef71('0x18')](respondWithResult(_0x11a94b,null))[_0xef71('0xc')](handleError(_0x11a94b,null));};exports[_0xef71('0x25')]=function(_0x3c0eb7,_0x4286c0){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xef71('0x1b')](_0x3c0eb7[_0xef71('0x17')],_0x3c0eb7[_0xef71('0x1d')]))[_0xef71('0x18')](respondWithResult(_0x4286c0,null))['catch'](handleError(_0x4286c0,null));};exports[_0xef71('0x26')]=function(_0xa778f7,_0x33ee16){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xef71('0x1b')](_0xa778f7['query'],_0xa778f7[_0xef71('0x1d')]))['then'](respondWithResult(_0x33ee16,null))[_0xef71('0xc')](handleError(_0x33ee16,null));};exports[_0xef71('0x27')]=function(_0x579f8c,_0x4efea3){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xef71('0x1b')](_0x579f8c[_0xef71('0x17')],_0x579f8c[_0xef71('0x1d')]))[_0xef71('0x18')](respondWithResult(_0x4efea3,null))['catch'](handleError(_0x4efea3,null));};exports['outbound']=function(_0xd2b962,_0x1a125f){return respondWithRpcPromise(_0xef71('0x28'),_0xd2b962[_0xef71('0x17')])[_0xef71('0x18')](respondWithResult(_0x1a125f,null))['catch'](handleError(_0x1a125f,null));};exports[_0xef71('0x29')]=function(_0x2702e8,_0x115236){return respondWithRpcPromise(_0xef71('0x2a'),_0x2702e8[_0xef71('0x17')])['then'](respondWithResult(_0x115236,null))['catch'](handleError(_0x115236,null));};exports['agents']=function(_0x5e8d4e,_0x36d0c9){var _0x2e1ade;return respondWithRpcPromise(_0xef71('0x2b'),_0x5e8d4e[_0xef71('0x17')])[_0xef71('0x18')](function(_0x56298d){_0x2e1ade=_0x56298d;return respondWithRpcPromise(_0xef71('0x2b'),_0x5e8d4e[_0xef71('0x17')],routingClient);})[_0xef71('0x18')](function(_0x30e0a2){return _[_0xef71('0x1b')]({},_0x30e0a2,_0x2e1ade);})[_0xef71('0x18')](respondWithResult(_0x36d0c9,null))[_0xef71('0xc')](handleError(_0x36d0c9,null));};exports['agentCapacity']=function(_0x4b1e39,_0x46b374){if(_0x4b1e39['body']&&_0x4b1e39[_0xef71('0x21')][_0xef71('0x2c')]&&_0x4b1e39[_0xef71('0x2d')]&&_0x4b1e39['user'][_0xef71('0x10')]){for(var _0x68d96e in _0x4b1e39['body'][_0xef71('0x2c')]){if(_0x4b1e39[_0xef71('0x21')][_0xef71('0x2c')][_0xef71('0x2e')](_0x68d96e)){db[_0xef71('0x2f')][_0xef71('0x30')]({'where':{'channel':_0x68d96e,'membername':_0x4b1e39[_0xef71('0x2d')][_0xef71('0x10')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x4b1e39[_0xef71('0x21')][_0xef71('0x2c')][_0x68d96e]&&_0x4b1e39['body']['interaction'][_0x68d96e][_0xef71('0x31')]?{'$notIn':_0x4b1e39[_0xef71('0x21')]['interaction'][_0x68d96e]}:{'$ne':null}}})[_0xef71('0x18')](function(_0x3135d7){var _0x23cfec=moment()['format'](_0xef71('0x32'));for(var _0x28385a=0x0,_0x11ac84=_0x3135d7[_0xef71('0x31')];_0x28385a<_0x11ac84;_0x28385a+=0x1){_0x3135d7[_0x28385a][_0xef71('0x33')]({'exitAt':_0x23cfec});}});for(var _0x3ea4a2=0x0;_0x3ea4a2<_0x4b1e39[_0xef71('0x21')][_0xef71('0x2c')][_0x68d96e][_0xef71('0x31')];_0x3ea4a2+=0x1){db[_0xef71('0x2f')]['findOrCreate']({'where':{'channel':_0x68d96e,'membername':_0x4b1e39[_0xef71('0x2d')][_0xef71('0x10')],'type':_0xef71('0x34'),'uniqueid':_0x4b1e39[_0xef71('0x21')][_0xef71('0x2c')][_0x68d96e][_0x3ea4a2],'exitAt':null},'defaults':{'channel':_0x68d96e,'membername':_0x4b1e39[_0xef71('0x2d')][_0xef71('0x10')],'interface':_[_0xef71('0x12')](_0x4b1e39['user'][_0xef71('0x35')])?util['format'](_0xef71('0x36'),_0x4b1e39[_0xef71('0x2d')][_0xef71('0x10')]):_0x4b1e39[_0xef71('0x2d')][_0xef71('0x35')],'type':_0xef71('0x34'),'enterAt':moment()[_0xef71('0x37')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x4b1e39[_0xef71('0x2d')]['internal'],'uniqueid':_0x4b1e39[_0xef71('0x21')]['interaction'][_0x68d96e][_0x3ea4a2]}});}}}}return respondWithRpcPromise(_0xef71('0x38'),{'id':_0x4b1e39[_0xef71('0x1d')]['id'],'capacity':_0x4b1e39[_0xef71('0x21')][_0xef71('0x39')]},routingClient)[_0xef71('0x18')](respondWithResult(_0x46b374,null))[_0xef71('0xc')](handleError(_0x46b374,null));};exports[_0xef71('0x3a')]=function(_0xb09f6e,_0x5c7db3){return respondWithRpcPromise(_0xef71('0x3b'),_0xb09f6e[_0xef71('0x17')])['then'](respondWithResult(_0x5c7db3,null))[_0xef71('0xc')](handleError(_0x5c7db3,null));};exports[_0xef71('0x3c')]=function(_0x3f3f3c,_0x232e32){return respondWithRpcPromise(_0xef71('0x3d'),_0x3f3f3c[_0xef71('0x17')])[_0xef71('0x18')](respondWithResult(_0x232e32,null))[_0xef71('0xc')](handleError(_0x232e32,null));};exports[_0xef71('0x3e')]=function(_0x4f2afc,_0x4405ce){return respondWithRpcPromise(_0xef71('0x3f'),_0x4f2afc[_0xef71('0x17')])['then'](respondWithResult(_0x4405ce,null))[_0xef71('0xc')](handleError(_0x4405ce,null));};exports[_0xef71('0x40')]=function(_0x1cffbe,_0x36f988){return respondWithRpcPromise(_0xef71('0x41'),_0x1cffbe[_0xef71('0x17')],routingClient)[_0xef71('0x18')](respondWithResult(_0x36f988,null))['catch'](handleError(_0x36f988,null));};exports[_0xef71('0x42')]=function(_0x7fb866,_0x42c8fc){return respondWithRpcPromise(_0xef71('0x41'),_0x7fb866[_0xef71('0x17')],routingClient)[_0xef71('0x18')](findById(_0x7fb866['params']['id']))[_0xef71('0x18')](respondWithResult(_0x42c8fc,null))['catch'](handleError(_0x42c8fc,null));};exports['mailQueues']=function(_0x17b409,_0x4ba0d5){return respondWithRpcPromise('MailQueues',_0x17b409[_0xef71('0x17')],routingClient)[_0xef71('0x18')](respondWithResult(_0x4ba0d5,null))[_0xef71('0xc')](handleError(_0x4ba0d5,null));};exports['showMailQueues']=function(_0x12d600,_0x35faf7){return respondWithRpcPromise(_0xef71('0x43'),_0x12d600[_0xef71('0x17')],routingClient)[_0xef71('0x18')](findById(_0x12d600[_0xef71('0x1d')]['id']))[_0xef71('0x18')](respondWithResult(_0x35faf7,null))[_0xef71('0xc')](handleError(_0x35faf7,null));};exports[_0xef71('0x44')]=function(_0x22392f,_0x283618){return respondWithRpcPromise(_0xef71('0x45'),_0x22392f[_0xef71('0x17')],mailClient)[_0xef71('0x18')](respondWithResult(_0x283618,null))['catch'](handleError(_0x283618,null));};exports['openchannelQueues']=function(_0x1c5e90,_0x53441b){return respondWithRpcPromise(_0xef71('0x46'),_0x1c5e90['query'],routingClient)[_0xef71('0x18')](respondWithResult(_0x53441b,null))[_0xef71('0xc')](handleError(_0x53441b,null));};exports[_0xef71('0x47')]=function(_0x305c74,_0x3c4c5f){return respondWithRpcPromise('OpenchannelQueues',_0x305c74[_0xef71('0x17')],routingClient)['then'](findById(_0x305c74['params']['id']))[_0xef71('0x18')](respondWithResult(_0x3c4c5f,null))[_0xef71('0xc')](handleError(_0x3c4c5f,null));};exports['smsQueues']=function(_0x531fb9,_0x4e66b1){return respondWithRpcPromise('SmsQueues',_0x531fb9[_0xef71('0x17')],routingClient)[_0xef71('0x18')](respondWithResult(_0x4e66b1,null))[_0xef71('0xc')](handleError(_0x4e66b1,null));};exports['showSmsQueues']=function(_0x637d1f,_0x10abba){return respondWithRpcPromise(_0xef71('0x48'),_0x637d1f[_0xef71('0x17')],routingClient)[_0xef71('0x18')](findById(_0x637d1f[_0xef71('0x1d')]['id']))['then'](respondWithResult(_0x10abba,null))[_0xef71('0xc')](handleError(_0x10abba,null));};exports[_0xef71('0x49')]=function(_0x13014d,_0x124b05){return respondWithRpcPromise(_0xef71('0x4a'),_0x13014d['query'],routingClient)[_0xef71('0x18')](respondWithResult(_0x124b05,null))['catch'](handleError(_0x124b05,null));};exports['showWhatsappQueues']=function(_0x273415,_0x159176){return respondWithRpcPromise('WhatsappQueues',_0x273415['query'],routingClient)['then'](findById(_0x273415[_0xef71('0x1d')]['id']))[_0xef71('0x18')](respondWithResult(_0x159176,null))[_0xef71('0xc')](handleError(_0x159176,null));};exports[_0xef71('0x4b')]=function(_0xf27886,_0x1fef91){return respondWithRpcPromise(_0xef71('0x4c'),_0xf27886['query'],routingClient)[_0xef71('0x18')](respondWithResult(_0x1fef91,null))[_0xef71('0xc')](handleError(_0x1fef91,null));};exports[_0xef71('0x4d')]=function(_0x5c0f7b,_0x1d75e8){return respondWithRpcPromise(_0xef71('0x4c'),_0x5c0f7b[_0xef71('0x17')],routingClient)[_0xef71('0x18')](findById(_0x5c0f7b['params']['id']))[_0xef71('0x18')](respondWithResult(_0x1d75e8,null))[_0xef71('0xc')](handleError(_0x1d75e8,null));};exports['faxAccounts']=function(_0x6dbdd8,_0x1ee0cc){return respondWithRpcPromise(_0xef71('0x4e'),_0x6dbdd8[_0xef71('0x17')])[_0xef71('0x18')](respondWithResult(_0x1ee0cc,null))[_0xef71('0xc')](handleError(_0x1ee0cc,null));};exports[_0xef71('0x4f')]=function(_0x4bcdee,_0x47e26f){return respondWithRpcPromise(_0xef71('0x50'),_0x4bcdee['query'],routingClient)[_0xef71('0x18')](respondWithResult(_0x47e26f,null))[_0xef71('0xc')](handleError(_0x47e26f,null));};exports[_0xef71('0x51')]=function(_0x24416a,_0x1ad3d4){return respondWithRpcPromise(_0xef71('0x52'),_0x24416a[_0xef71('0x17')],routingClient)[_0xef71('0x18')](respondWithResult(_0x1ad3d4,null))[_0xef71('0xc')](handleError(_0x1ad3d4,null));};exports[_0xef71('0x53')]=function(_0x57d9e5,_0x213318){return respondWithRpcPromise(_0xef71('0x54'),_0x57d9e5[_0xef71('0x17')],routingClient)[_0xef71('0x18')](respondWithResult(_0x213318,null))['catch'](handleError(_0x213318,null));};exports[_0xef71('0x55')]=function(_0x1c88aa,_0xa112c1){return respondWithRpcPromise(_0xef71('0x54'),_0x1c88aa['query'],routingClient)[_0xef71('0x18')](function(_0xd91d0e){if(_0x1c88aa['query'][_0xef71('0x56')]!==undefined){var _0xdf8fd8=_(_0xd91d0e[_0xef71('0x13')])[_0xef71('0x57')]([_0x1c88aa[_0xef71('0x17')][_0xef71('0x56')],_0x1c88aa[_0xef71('0x1d')]['id']])[_0xef71('0x58')](_0xef71('0x59'))[_0xef71('0x5a')]()['value']();return _0xd91d0e[_0xef71('0x13')][_0xef71('0x57')](function(_0xd3047a){return _0xdf8fd8[_0xef71('0x5b')](_0xd3047a[_0xef71('0x59')])>-0x1;});}else{return _0xd91d0e[_0xef71('0x13')][_0xef71('0x57')](function(_0xd22bfe){return _0xd22bfe[_0xef71('0x59')]===parseInt(_0x1c88aa['params']['id']);});}})[_0xef71('0x18')](respondWithResult(_0xa112c1,null))['catch'](handleError(_0xa112c1,null));};exports[_0xef71('0x5c')]=function(_0x4bdcda,_0x13af14){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x4bdcda[_0xef71('0x17')],routingClient)['then'](respondWithResult(_0x13af14,null))[_0xef71('0xc')](handleError(_0x13af14,null));};exports[_0xef71('0x5d')]=function(_0x177746,_0x4242c1){return respondWithRpcPromise(_0xef71('0x5e'),_0x177746[_0xef71('0x17')],routingClient)[_0xef71('0x18')](respondWithResult(_0x4242c1,null))[_0xef71('0xc')](handleError(_0x4242c1,null));};exports[_0xef71('0x5f')]=function(_0x1ad113,_0x5a64ea){return respondWithRpcPromise(_0xef71('0x60'),_0x1ad113[_0xef71('0x17')],routingClient)[_0xef71('0x18')](respondWithResult(_0x5a64ea,null))[_0xef71('0xc')](handleError(_0x5a64ea,null));};exports[_0xef71('0x61')]=function(_0x21bd55){return function(_0x3fb527,_0xbfaa4e){var _0x438f02,_0x5e6912;var _0x4f1413=_[_0xef71('0x62')](_0x21bd55);var _0x38b677=_0x21bd55===_0xef71('0x63')?'Website':_0xef71('0x64');return db[_0x4f1413+_0xef71('0x65')][_0xef71('0x66')]({'raw':!![],'where':{'id':_0x3fb527[_0xef71('0x1d')]['id']}})[_0xef71('0x18')](function(_0x17622b){if(_['isNil'](_0x17622b)){throw new Error(_0x4f1413+'\x20Queue\x20not\x20found');}_0x438f02=_0x17622b;return db[_0x4f1413+_0xef71('0x67')][_0xef71('0x66')]({'where':{'id':_0x3fb527[_0xef71('0x21')][_0xef71('0x68')]},'include':[{'model':db[_0x4f1413+_0xef71('0x69')],'as':_0xef71('0x69')},{'model':db[_0x4f1413+_0x38b677],'as':_0xef71('0x64')}]});})[_0xef71('0x18')](function(_0x3e309){if(_[_0xef71('0x12')](_0x3e309)){throw new Error(_0x4f1413+_0xef71('0x6a'));}_0x5e6912=_0x3e309;return _0x3e309[_0xef71('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})[_0xef71('0x18')](function(){var _0x27b15a={'uniqueid':_0x21bd55+'.'+_0x5e6912['id']+'.'+_0x5e6912['Interaction']['id'],'FromUserId':_0x3fb527[_0xef71('0x2d')]['id'],'type':_0xef71('0x6c')};_0x27b15a[_0x4f1413+_0xef71('0x6d')]=_0x5e6912['id'];_0x27b15a[_0x4f1413+_0xef71('0x6e')]=_0x5e6912['Interaction']['id'];_0x27b15a[_0xef71('0x6f')+_0x4f1413+_0x38b677+'Id']=_0x5e6912[_0xef71('0x64')]['id'];_0x27b15a['To'+_0x4f1413+'QueueId']=_0x438f02['id'];return db[_0x4f1413+_0xef71('0x70')]['create'](_0x27b15a);})[_0xef71('0x18')](function(){return respondWithRpcPromise(_0xef71('0x71'),{'channel':_0x21bd55,'interaction':_0x5e6912[_0xef71('0x69')],'message':_0x5e6912,'account':_0x5e6912[_0xef71('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0xef71('0x6c'),'appdata':_0x438f02[_0xef71('0x10')]+','+(_0x5e6912['Account'][_0xef71('0x72')]||0x12c),'interval':_0xef71('0x73')}]},routingClient);})[_0xef71('0x18')](respondWithResult(_0xbfaa4e,null))[_0xef71('0xc')](handleError(_0xbfaa4e,null));};};exports['agentNotify']=function(_0x4417f6,_0x54fed7){var _0x2ef47f,_0x2df52a;if(_[_0xef71('0x12')](_0x4417f6[_0xef71('0x21')]['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x389c30=_0x4417f6['body'][_0xef71('0x74')];var _0x1c6563=_[_0xef71('0x62')](_0x389c30);var _0x481866=_0x389c30==='chat'?'Website':_0xef71('0x64');return db[_0xef71('0x75')][_0xef71('0x66')]({'raw':!![],'where':{'id':_0x4417f6[_0xef71('0x1d')]['id'],'role':_0xef71('0x76')}})[_0xef71('0x18')](function(_0x441b34){if(_[_0xef71('0x12')](_0x441b34)){throw new Error(_0xef71('0x77'));}_0x2ef47f=_0x441b34;return db[_0x1c6563+_0xef71('0x67')][_0xef71('0x66')]({'where':{'id':_0x4417f6[_0xef71('0x21')][_0xef71('0x68')]},'include':[{'model':db[_0x1c6563+'Interaction'],'as':_0xef71('0x69')},{'model':db[_0x1c6563+_0x481866],'as':_0xef71('0x64')}]});})[_0xef71('0x18')](function(_0x36f00c){if(_[_0xef71('0x12')](_0x36f00c)){throw new Error(_0x1c6563+'\x20Message\x20not\x20found');}_0x2df52a=_0x36f00c;return _0x36f00c[_0xef71('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x54129a={'uniqueid':_0x389c30+'.'+_0x2df52a['id']+'.'+_0x2df52a['Interaction']['id'],'FromUserId':_0x4417f6[_0xef71('0x2d')]['id'],'type':_0xef71('0x6c'),'ToUserId':_0x2ef47f['id']};_0x54129a[_0x1c6563+'MessageId']=_0x2df52a['id'];_0x54129a[_0x1c6563+_0xef71('0x6e')]=_0x2df52a[_0xef71('0x69')]['id'];_0x54129a[_0xef71('0x6f')+_0x1c6563+_0x481866+'Id']=_0x2df52a[_0xef71('0x64')]['id'];return db[_0x1c6563+'TransferReport'][_0xef71('0x78')](_0x54129a);})[_0xef71('0x18')](function(){return respondWithRpcPromise(_0xef71('0x71'),{'channel':_0x389c30,'interaction':_0x2df52a[_0xef71('0x69')],'message':_0x2df52a,'account':_0x2df52a[_0xef71('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0xef71('0x76'),'appdata':_0x2ef47f[_0xef71('0x10')]+','+(_0x2df52a[_0xef71('0x64')][_0xef71('0x79')]||0x12c),'interval':_0xef71('0x73')}]},routingClient);})[_0xef71('0x18')](respondWithResult(_0x54fed7,null))[_0xef71('0xc')](handleError(_0x54fed7,null));}; \ No newline at end of file +var _0xdc58=['agentCapacity','body','interaction','user','hasOwnProperty','findAll','INTERACTION','length','format','findOrCreate','interface','SIP/%s','internal','AgentCapacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','queue_id','uniq','value','indexOf','filter','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','chat','Website','Account','\x20Queue\x20not\x20found','Message','findOne','Interaction','update','MessageId','InteractionId','From','QueueId','TransferReport','Start','queue','queueTransferTimeout','*,*,*,*','channel','capitalize','User','agent','Agent\x20not\x20found','messageId','create','agentTransferTimeout','bluebird','lodash','util','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','stack','name','send','isNil','rows','find','query','voiceChannelMixMonitor','merge','params','catch','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','OutboundChannels','Agents'];(function(_0x54f7c0,_0x27af83){var _0x245d03=function(_0x1ad6c4){while(--_0x1ad6c4){_0x54f7c0['push'](_0x54f7c0['shift']());}};_0x245d03(++_0x27af83);}(_0xdc58,0xc9));var _0x8dc5=function(_0x3e9787,_0x4b4cf6){_0x3e9787=_0x3e9787-0x0;var _0x3d33c7=_0xdc58[_0x3e9787];return _0x3d33c7;};'use strict';var BPromise=require(_0x8dc5('0x0'));var moment=require('moment');var _=require(_0x8dc5('0x1'));var util=require(_0x8dc5('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x8dc5('0x3'))(_0x8dc5('0x4'));var jayson=require(_0x8dc5('0x5'));var amiClient=jayson[_0x8dc5('0x6')][_0x8dc5('0x7')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x8dc5('0x6')][_0x8dc5('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1b3f2a,_0x4dfb2e,_0xba6397){return new BPromise(function(_0x50fc01,_0x5a1436){var _0xc8eace=_0xba6397?_0xba6397:amiClient;return _0xc8eace[_0x8dc5('0x8')](_0x1b3f2a,_0x4dfb2e)[_0x8dc5('0x9')](function(_0x525610){if(_0x525610['error']){if(_0x525610[_0x8dc5('0xa')][_0x8dc5('0xb')]===0x1f4){return _0x5a1436(_0x525610['error']['message']);}return _0x50fc01(_0x525610['error']['message']);}else{_0x50fc01(_0x525610[_0x8dc5('0xc')]);}})['catch'](function(_0x3f1082){_0x5a1436(_0x3f1082);});});}function respondWithResult(_0x2c7556,_0x1035c7){_0x1035c7=_0x1035c7||0xc8;return function(_0x2bab5a){if(_0x2bab5a){return _0x2c7556['status'](_0x1035c7)['json'](_0x2bab5a);}return _0x2c7556['sendStatus'](0x194);};}function handleError(_0x1f5d4b,_0x2838fd){_0x2838fd=_0x2838fd||0x1f4;return function(_0x43a04c){logger[_0x8dc5('0xa')](_0x43a04c[_0x8dc5('0xd')]);if(_0x43a04c['name']){delete _0x43a04c[_0x8dc5('0xe')];}_0x1f5d4b['status'](_0x2838fd)[_0x8dc5('0xf')](_0x43a04c);};}function findById(_0x27ffd2){return function(_0x12fd0e){if(!_[_0x8dc5('0x10')](_0x27ffd2)&&!_[_0x8dc5('0x10')](_0x12fd0e)&&!_['isNil'](_0x12fd0e[_0x8dc5('0x11')])){return _[_0x8dc5('0x12')](_0x12fd0e[_0x8dc5('0x11')],function(_0x454ba1){return _0x454ba1['id']==_0x27ffd2;});}return null;};}exports['voiceChannels']=function(_0x4187c4,_0x188e21){return respondWithRpcPromise('VoiceChannels',_0x4187c4[_0x8dc5('0x13')])[_0x8dc5('0x9')](respondWithResult(_0x188e21,null))['catch'](handleError(_0x188e21,null));};exports[_0x8dc5('0x14')]=function(_0x7acc89,_0x3ba888){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x8dc5('0x15')](_0x7acc89[_0x8dc5('0x13')],_0x7acc89[_0x8dc5('0x16')]))[_0x8dc5('0x9')](respondWithResult(_0x3ba888,null))[_0x8dc5('0x17')](handleError(_0x3ba888,null));};exports[_0x8dc5('0x18')]=function(_0x22afd7,_0x1df4a8){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x8dc5('0x15')](_0x22afd7[_0x8dc5('0x13')],_0x22afd7[_0x8dc5('0x16')]))[_0x8dc5('0x9')](respondWithResult(_0x1df4a8,null))['catch'](handleError(_0x1df4a8,null));};exports[_0x8dc5('0x19')]=function(_0x29b8ca,_0x575490){return respondWithRpcPromise(_0x8dc5('0x1a'),_0x29b8ca[_0x8dc5('0x13')])[_0x8dc5('0x9')](respondWithResult(_0x575490,null))[_0x8dc5('0x17')](handleError(_0x575490,null));};exports[_0x8dc5('0x1b')]=function(_0x194e18,_0x2aea88){return respondWithRpcPromise(_0x8dc5('0x1a'),_0x194e18[_0x8dc5('0x13')])[_0x8dc5('0x9')](findById(_0x194e18[_0x8dc5('0x16')]['id']))[_0x8dc5('0x9')](respondWithResult(_0x2aea88,null))['catch'](handleError(_0x2aea88,null));};exports['updateVoiceQueue']=function(_0x250af2,_0x72c167){return respondWithRpcPromise(_0x8dc5('0x1c'),_[_0x8dc5('0x15')](_0x250af2['body'],_0x250af2[_0x8dc5('0x16')]))['then'](respondWithResult(_0x72c167,null))[_0x8dc5('0x17')](handleError(_0x72c167,null));};exports[_0x8dc5('0x1d')]=function(_0x3ed48f,_0x2a89c6){return respondWithRpcPromise(_0x8dc5('0x1e'),_[_0x8dc5('0x15')](_0x3ed48f[_0x8dc5('0x13')],_0x3ed48f[_0x8dc5('0x16')]))[_0x8dc5('0x9')](respondWithResult(_0x2a89c6,null))['catch'](handleError(_0x2a89c6,null));};exports['voiceQueuesChannels']=function(_0x4d16d7,_0xa50aef){return respondWithRpcPromise(_0x8dc5('0x1f'),_0x4d16d7['query'])[_0x8dc5('0x9')](respondWithResult(_0xa50aef,null))[_0x8dc5('0x17')](handleError(_0xa50aef,null));};exports[_0x8dc5('0x20')]=function(_0x13ae36,_0x153cd0){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x8dc5('0x15')](_0x13ae36[_0x8dc5('0x13')],_0x13ae36[_0x8dc5('0x16')]))[_0x8dc5('0x9')](respondWithResult(_0x153cd0,null))['catch'](handleError(_0x153cd0,null));};exports[_0x8dc5('0x21')]=function(_0x4b2adc,_0x5c0248){return respondWithRpcPromise(_0x8dc5('0x22'),_[_0x8dc5('0x15')](_0x4b2adc[_0x8dc5('0x13')],_0x4b2adc[_0x8dc5('0x16')]))['then'](respondWithResult(_0x5c0248,null))[_0x8dc5('0x17')](handleError(_0x5c0248,null));};exports['voiceQueuesChannelRedirect']=function(_0x51b68b,_0xeff75c){return respondWithRpcPromise(_0x8dc5('0x23'),_[_0x8dc5('0x15')](_0x51b68b[_0x8dc5('0x13')],_0x51b68b[_0x8dc5('0x16')]))[_0x8dc5('0x9')](respondWithResult(_0xeff75c,null))[_0x8dc5('0x17')](handleError(_0xeff75c,null));};exports[_0x8dc5('0x24')]=function(_0x3e298d,_0xd30d97){return respondWithRpcPromise('Outbound',_0x3e298d['query'])['then'](respondWithResult(_0xd30d97,null))['catch'](handleError(_0xd30d97,null));};exports['outboundChannels']=function(_0x21426f,_0x4cf643){return respondWithRpcPromise(_0x8dc5('0x25'),_0x21426f[_0x8dc5('0x13')])[_0x8dc5('0x9')](respondWithResult(_0x4cf643,null))[_0x8dc5('0x17')](handleError(_0x4cf643,null));};exports['agents']=function(_0xe71896,_0x4aa153){var _0x31603d;return respondWithRpcPromise(_0x8dc5('0x26'),_0xe71896[_0x8dc5('0x13')])[_0x8dc5('0x9')](function(_0x3d7a3f){_0x31603d=_0x3d7a3f;return respondWithRpcPromise(_0x8dc5('0x26'),_0xe71896[_0x8dc5('0x13')],routingClient);})[_0x8dc5('0x9')](function(_0x3bee98){return _['merge']({},_0x3bee98,_0x31603d);})['then'](respondWithResult(_0x4aa153,null))[_0x8dc5('0x17')](handleError(_0x4aa153,null));};exports[_0x8dc5('0x27')]=function(_0x5c9e05,_0x26b137){if(_0x5c9e05[_0x8dc5('0x28')]&&_0x5c9e05[_0x8dc5('0x28')][_0x8dc5('0x29')]&&_0x5c9e05[_0x8dc5('0x2a')]&&_0x5c9e05['user'][_0x8dc5('0xe')]){for(var _0x15677e in _0x5c9e05[_0x8dc5('0x28')][_0x8dc5('0x29')]){if(_0x5c9e05[_0x8dc5('0x28')][_0x8dc5('0x29')][_0x8dc5('0x2b')](_0x15677e)){db['MemberReport'][_0x8dc5('0x2c')]({'where':{'channel':_0x15677e,'membername':_0x5c9e05[_0x8dc5('0x2a')][_0x8dc5('0xe')],'type':_0x8dc5('0x2d'),'exitAt':null,'uniqueid':_0x5c9e05[_0x8dc5('0x28')][_0x8dc5('0x29')][_0x15677e]&&_0x5c9e05[_0x8dc5('0x28')]['interaction'][_0x15677e][_0x8dc5('0x2e')]?{'$notIn':_0x5c9e05['body'][_0x8dc5('0x29')][_0x15677e]}:{'$ne':null}}})[_0x8dc5('0x9')](function(_0x12d339){var _0x45b05f=moment()[_0x8dc5('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5950bb=0x0,_0x3a3e8e=_0x12d339[_0x8dc5('0x2e')];_0x5950bb<_0x3a3e8e;_0x5950bb+=0x1){_0x12d339[_0x5950bb]['updateAttributes']({'exitAt':_0x45b05f});}});for(var _0x200988=0x0;_0x200988<_0x5c9e05[_0x8dc5('0x28')][_0x8dc5('0x29')][_0x15677e][_0x8dc5('0x2e')];_0x200988+=0x1){db['MemberReport'][_0x8dc5('0x30')]({'where':{'channel':_0x15677e,'membername':_0x5c9e05[_0x8dc5('0x2a')]['name'],'type':_0x8dc5('0x2d'),'uniqueid':_0x5c9e05['body']['interaction'][_0x15677e][_0x200988],'exitAt':null},'defaults':{'channel':_0x15677e,'membername':_0x5c9e05[_0x8dc5('0x2a')]['name'],'interface':_[_0x8dc5('0x10')](_0x5c9e05[_0x8dc5('0x2a')][_0x8dc5('0x31')])?util[_0x8dc5('0x2f')](_0x8dc5('0x32'),_0x5c9e05['user'][_0x8dc5('0xe')]):_0x5c9e05['user']['interface'],'type':_0x8dc5('0x2d'),'enterAt':moment()[_0x8dc5('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x5c9e05[_0x8dc5('0x2a')][_0x8dc5('0x33')],'uniqueid':_0x5c9e05[_0x8dc5('0x28')][_0x8dc5('0x29')][_0x15677e][_0x200988]}});}}}}return respondWithRpcPromise(_0x8dc5('0x34'),{'id':_0x5c9e05[_0x8dc5('0x16')]['id'],'capacity':_0x5c9e05[_0x8dc5('0x28')]['capacity']},routingClient)[_0x8dc5('0x9')](respondWithResult(_0x26b137,null))[_0x8dc5('0x17')](handleError(_0x26b137,null));};exports[_0x8dc5('0x35')]=function(_0x50a903,_0x2b801b){return respondWithRpcPromise(_0x8dc5('0x36'),_0x50a903[_0x8dc5('0x13')])[_0x8dc5('0x9')](respondWithResult(_0x2b801b,null))['catch'](handleError(_0x2b801b,null));};exports[_0x8dc5('0x37')]=function(_0x262762,_0x9028a0){return respondWithRpcPromise(_0x8dc5('0x38'),_0x262762[_0x8dc5('0x13')])['then'](respondWithResult(_0x9028a0,null))[_0x8dc5('0x17')](handleError(_0x9028a0,null));};exports[_0x8dc5('0x39')]=function(_0x2d97d7,_0x4dbf66){return respondWithRpcPromise(_0x8dc5('0x3a'),_0x2d97d7['query'])[_0x8dc5('0x9')](respondWithResult(_0x4dbf66,null))[_0x8dc5('0x17')](handleError(_0x4dbf66,null));};exports[_0x8dc5('0x3b')]=function(_0x41dd6d,_0x45c791){return respondWithRpcPromise(_0x8dc5('0x3c'),_0x41dd6d[_0x8dc5('0x13')],routingClient)[_0x8dc5('0x9')](respondWithResult(_0x45c791,null))[_0x8dc5('0x17')](handleError(_0x45c791,null));};exports[_0x8dc5('0x3d')]=function(_0x2b3bf7,_0x441b0d){return respondWithRpcPromise(_0x8dc5('0x3c'),_0x2b3bf7[_0x8dc5('0x13')],routingClient)[_0x8dc5('0x9')](findById(_0x2b3bf7['params']['id']))[_0x8dc5('0x9')](respondWithResult(_0x441b0d,null))[_0x8dc5('0x17')](handleError(_0x441b0d,null));};exports['mailQueues']=function(_0x624b11,_0x2045aa){return respondWithRpcPromise(_0x8dc5('0x3e'),_0x624b11[_0x8dc5('0x13')],routingClient)['then'](respondWithResult(_0x2045aa,null))[_0x8dc5('0x17')](handleError(_0x2045aa,null));};exports[_0x8dc5('0x3f')]=function(_0x28dfef,_0x2f67fc){return respondWithRpcPromise('MailQueues',_0x28dfef[_0x8dc5('0x13')],routingClient)[_0x8dc5('0x9')](findById(_0x28dfef[_0x8dc5('0x16')]['id']))[_0x8dc5('0x9')](respondWithResult(_0x2f67fc,null))[_0x8dc5('0x17')](handleError(_0x2f67fc,null));};exports['mailAccounts']=function(_0x2e0642,_0x1ede79){return respondWithRpcPromise(_0x8dc5('0x40'),_0x2e0642['query'],mailClient)[_0x8dc5('0x9')](respondWithResult(_0x1ede79,null))[_0x8dc5('0x17')](handleError(_0x1ede79,null));};exports[_0x8dc5('0x41')]=function(_0xe4e673,_0x2f7858){return respondWithRpcPromise(_0x8dc5('0x42'),_0xe4e673['query'],routingClient)[_0x8dc5('0x9')](respondWithResult(_0x2f7858,null))[_0x8dc5('0x17')](handleError(_0x2f7858,null));};exports[_0x8dc5('0x43')]=function(_0x274ceb,_0x87af6){return respondWithRpcPromise(_0x8dc5('0x42'),_0x274ceb[_0x8dc5('0x13')],routingClient)[_0x8dc5('0x9')](findById(_0x274ceb[_0x8dc5('0x16')]['id']))[_0x8dc5('0x9')](respondWithResult(_0x87af6,null))['catch'](handleError(_0x87af6,null));};exports[_0x8dc5('0x44')]=function(_0x5efe6b,_0x2764a9){return respondWithRpcPromise(_0x8dc5('0x45'),_0x5efe6b['query'],routingClient)[_0x8dc5('0x9')](respondWithResult(_0x2764a9,null))['catch'](handleError(_0x2764a9,null));};exports['showSmsQueues']=function(_0x3867ce,_0x4c908a){return respondWithRpcPromise(_0x8dc5('0x45'),_0x3867ce[_0x8dc5('0x13')],routingClient)[_0x8dc5('0x9')](findById(_0x3867ce[_0x8dc5('0x16')]['id']))[_0x8dc5('0x9')](respondWithResult(_0x4c908a,null))[_0x8dc5('0x17')](handleError(_0x4c908a,null));};exports[_0x8dc5('0x46')]=function(_0x2ffb20,_0x5eae71){return respondWithRpcPromise(_0x8dc5('0x47'),_0x2ffb20[_0x8dc5('0x13')],routingClient)[_0x8dc5('0x9')](respondWithResult(_0x5eae71,null))['catch'](handleError(_0x5eae71,null));};exports[_0x8dc5('0x48')]=function(_0x3c573e,_0x48f13e){return respondWithRpcPromise(_0x8dc5('0x47'),_0x3c573e[_0x8dc5('0x13')],routingClient)[_0x8dc5('0x9')](findById(_0x3c573e[_0x8dc5('0x16')]['id']))[_0x8dc5('0x9')](respondWithResult(_0x48f13e,null))[_0x8dc5('0x17')](handleError(_0x48f13e,null));};exports['faxQueues']=function(_0x1874cf,_0x5c12ce){return respondWithRpcPromise(_0x8dc5('0x49'),_0x1874cf['query'],routingClient)[_0x8dc5('0x9')](respondWithResult(_0x5c12ce,null))['catch'](handleError(_0x5c12ce,null));};exports[_0x8dc5('0x4a')]=function(_0x250c1f,_0x1d486d){return respondWithRpcPromise(_0x8dc5('0x49'),_0x250c1f['query'],routingClient)[_0x8dc5('0x9')](findById(_0x250c1f['params']['id']))['then'](respondWithResult(_0x1d486d,null))[_0x8dc5('0x17')](handleError(_0x1d486d,null));};exports[_0x8dc5('0x4b')]=function(_0xde0b92,_0x45b1a5){return respondWithRpcPromise(_0x8dc5('0x4c'),_0xde0b92['query'])['then'](respondWithResult(_0x45b1a5,null))[_0x8dc5('0x17')](handleError(_0x45b1a5,null));};exports[_0x8dc5('0x4d')]=function(_0x24128b,_0x818675){return respondWithRpcPromise(_0x8dc5('0x4e'),_0x24128b[_0x8dc5('0x13')],routingClient)[_0x8dc5('0x9')](respondWithResult(_0x818675,null))['catch'](handleError(_0x818675,null));};exports[_0x8dc5('0x4f')]=function(_0x18828e,_0x2a8881){return respondWithRpcPromise(_0x8dc5('0x50'),_0x18828e[_0x8dc5('0x13')],routingClient)[_0x8dc5('0x9')](respondWithResult(_0x2a8881,null))['catch'](handleError(_0x2a8881,null));};exports[_0x8dc5('0x51')]=function(_0x506689,_0x2d9244){return respondWithRpcPromise(_0x8dc5('0x52'),_0x506689[_0x8dc5('0x13')],routingClient)['then'](respondWithResult(_0x2d9244,null))[_0x8dc5('0x17')](handleError(_0x2d9244,null));};exports[_0x8dc5('0x53')]=function(_0x1ae023,_0x7ec0a4){return respondWithRpcPromise(_0x8dc5('0x52'),_0x1ae023['query'],routingClient)[_0x8dc5('0x9')](function(_0x542416){if(_0x1ae023['query']['type']!==undefined){var _0x179b5e=_(_0x542416['rows'])['filter']([_0x1ae023[_0x8dc5('0x13')][_0x8dc5('0x54')],_0x1ae023['params']['id']])['map'](_0x8dc5('0x55'))[_0x8dc5('0x56')]()[_0x8dc5('0x57')]();return _0x542416[_0x8dc5('0x11')]['filter'](function(_0x29c140){return _0x179b5e[_0x8dc5('0x58')](_0x29c140[_0x8dc5('0x55')])>-0x1;});}else{return _0x542416['rows'][_0x8dc5('0x59')](function(_0x7d6bfa){return _0x7d6bfa[_0x8dc5('0x55')]===parseInt(_0x1ae023['params']['id']);});}})['then'](respondWithResult(_0x7ec0a4,null))[_0x8dc5('0x17')](handleError(_0x7ec0a4,null));};exports[_0x8dc5('0x5a')]=function(_0x1606a6,_0x175ec4){return respondWithRpcPromise(_0x8dc5('0x5b'),_0x1606a6[_0x8dc5('0x13')],routingClient)[_0x8dc5('0x9')](respondWithResult(_0x175ec4,null))[_0x8dc5('0x17')](handleError(_0x175ec4,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x43aba8,_0x2219b3){return respondWithRpcPromise(_0x8dc5('0x5c'),_0x43aba8[_0x8dc5('0x13')],routingClient)[_0x8dc5('0x9')](respondWithResult(_0x2219b3,null))[_0x8dc5('0x17')](handleError(_0x2219b3,null));};exports[_0x8dc5('0x5d')]=function(_0x15bc32,_0x28013c){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x15bc32[_0x8dc5('0x13')],routingClient)['then'](respondWithResult(_0x28013c,null))[_0x8dc5('0x17')](handleError(_0x28013c,null));};exports[_0x8dc5('0x5e')]=function(_0x5c2c02){return function(_0x3cf9f1,_0x562e2c){var _0xaa6335,_0x314f57;var _0x35ff4a=_['capitalize'](_0x5c2c02);var _0x3e69c8=_0x5c2c02===_0x8dc5('0x5f')?_0x8dc5('0x60'):_0x8dc5('0x61');return db[_0x35ff4a+'Queue']['findOne']({'raw':!![],'where':{'id':_0x3cf9f1['params']['id']}})[_0x8dc5('0x9')](function(_0x53bff0){if(_[_0x8dc5('0x10')](_0x53bff0)){throw new Error(_0x35ff4a+_0x8dc5('0x62'));}_0xaa6335=_0x53bff0;return db[_0x35ff4a+_0x8dc5('0x63')][_0x8dc5('0x64')]({'where':{'id':_0x3cf9f1['body']['messageId']},'include':[{'model':db[_0x35ff4a+_0x8dc5('0x65')],'as':_0x8dc5('0x65')},{'model':db[_0x35ff4a+_0x3e69c8],'as':_0x8dc5('0x61')}]});})[_0x8dc5('0x9')](function(_0x14e3e6){if(_[_0x8dc5('0x10')](_0x14e3e6)){throw new Error(_0x35ff4a+'\x20Message\x20not\x20found');}_0x314f57=_0x14e3e6;return _0x14e3e6[_0x8dc5('0x66')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8dc5('0x9')](function(){var _0x52722d={'uniqueid':_0x5c2c02+'.'+_0x314f57['id']+'.'+_0x314f57[_0x8dc5('0x65')]['id'],'FromUserId':_0x3cf9f1[_0x8dc5('0x2a')]['id'],'type':'queue'};_0x52722d[_0x35ff4a+_0x8dc5('0x67')]=_0x314f57['id'];_0x52722d[_0x35ff4a+_0x8dc5('0x68')]=_0x314f57[_0x8dc5('0x65')]['id'];_0x52722d[_0x8dc5('0x69')+_0x35ff4a+_0x3e69c8+'Id']=_0x314f57['Account']['id'];_0x52722d['To'+_0x35ff4a+_0x8dc5('0x6a')]=_0xaa6335['id'];return db[_0x35ff4a+_0x8dc5('0x6b')]['create'](_0x52722d);})[_0x8dc5('0x9')](function(){return respondWithRpcPromise(_0x8dc5('0x6c'),{'channel':_0x5c2c02,'interaction':_0x314f57['Interaction'],'message':_0x314f57,'account':_0x314f57[_0x8dc5('0x61')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8dc5('0x6d'),'appdata':_0xaa6335['name']+','+(_0x314f57[_0x8dc5('0x61')][_0x8dc5('0x6e')]||0x12c),'interval':_0x8dc5('0x6f')}]},routingClient);})[_0x8dc5('0x9')](respondWithResult(_0x562e2c,null))[_0x8dc5('0x17')](handleError(_0x562e2c,null));};};exports['agentNotify']=function(_0x29a3b4,_0x2bee5d){var _0x446811,_0x56fdd8;if(_['isNil'](_0x29a3b4[_0x8dc5('0x28')][_0x8dc5('0x70')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x4fcd6b=_0x29a3b4[_0x8dc5('0x28')][_0x8dc5('0x70')];var _0x4d6efc=_[_0x8dc5('0x71')](_0x4fcd6b);var _0x3016aa=_0x4fcd6b==='chat'?_0x8dc5('0x60'):_0x8dc5('0x61');return db[_0x8dc5('0x72')]['findOne']({'raw':!![],'where':{'id':_0x29a3b4[_0x8dc5('0x16')]['id'],'role':_0x8dc5('0x73')}})[_0x8dc5('0x9')](function(_0x696906){if(_[_0x8dc5('0x10')](_0x696906)){throw new Error(_0x8dc5('0x74'));}_0x446811=_0x696906;return db[_0x4d6efc+_0x8dc5('0x63')]['findOne']({'where':{'id':_0x29a3b4[_0x8dc5('0x28')][_0x8dc5('0x75')]},'include':[{'model':db[_0x4d6efc+_0x8dc5('0x65')],'as':'Interaction'},{'model':db[_0x4d6efc+_0x3016aa],'as':_0x8dc5('0x61')}]});})[_0x8dc5('0x9')](function(_0x4b6cbe){if(_[_0x8dc5('0x10')](_0x4b6cbe)){throw new Error(_0x4d6efc+'\x20Message\x20not\x20found');}_0x56fdd8=_0x4b6cbe;return _0x4b6cbe[_0x8dc5('0x66')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8dc5('0x9')](function(){var _0xee76e3={'uniqueid':_0x4fcd6b+'.'+_0x56fdd8['id']+'.'+_0x56fdd8[_0x8dc5('0x65')]['id'],'FromUserId':_0x29a3b4[_0x8dc5('0x2a')]['id'],'type':'queue','ToUserId':_0x446811['id']};_0xee76e3[_0x4d6efc+_0x8dc5('0x67')]=_0x56fdd8['id'];_0xee76e3[_0x4d6efc+_0x8dc5('0x68')]=_0x56fdd8[_0x8dc5('0x65')]['id'];_0xee76e3[_0x8dc5('0x69')+_0x4d6efc+_0x3016aa+'Id']=_0x56fdd8[_0x8dc5('0x61')]['id'];return db[_0x4d6efc+_0x8dc5('0x6b')][_0x8dc5('0x76')](_0xee76e3);})[_0x8dc5('0x9')](function(){return respondWithRpcPromise(_0x8dc5('0x6c'),{'channel':_0x4fcd6b,'interaction':_0x56fdd8[_0x8dc5('0x65')],'message':_0x56fdd8,'account':_0x56fdd8[_0x8dc5('0x61')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8dc5('0x73'),'appdata':_0x446811[_0x8dc5('0xe')]+','+(_0x56fdd8[_0x8dc5('0x61')][_0x8dc5('0x77')]||0x12c),'interval':_0x8dc5('0x6f')}]},routingClient);})['then'](respondWithResult(_0x2bee5d,null))['catch'](handleError(_0x2bee5d,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 1f19809..5a0c1bf 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 _0x5eb8=['isAuthenticated','index','get','show','/:id/run','post','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./schedule.controller'];(function(_0x109350,_0xa878d9){var _0x8e8bef=function(_0x4c0f31){while(--_0x4c0f31){_0x109350['push'](_0x109350['shift']());}};_0x8e8bef(++_0xa878d9);}(_0x5eb8,0xc8));var _0x85eb=function(_0x4e4061,_0x26503b){_0x4e4061=_0x4e4061-0x0;var _0x371dbd=_0x5eb8[_0x4e4061];return _0x371dbd;};'use strict';var multer=require(_0x85eb('0x0'));var util=require(_0x85eb('0x1'));var path=require(_0x85eb('0x2'));var timeout=require(_0x85eb('0x3'));var express=require(_0x85eb('0x4'));var router=express[_0x85eb('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x85eb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router['get']('/',auth[_0x85eb('0x9')](),controller[_0x85eb('0xa')]);router[_0x85eb('0xb')]('/:id',auth[_0x85eb('0x9')](),controller[_0x85eb('0xc')]);router[_0x85eb('0xb')](_0x85eb('0xd'),auth[_0x85eb('0x9')](),controller['run']);router[_0x85eb('0xe')]('/',auth[_0x85eb('0x9')](),controller['create']);router['put'](_0x85eb('0xf'),auth[_0x85eb('0x9')](),controller[_0x85eb('0x10')]);router['delete'](_0x85eb('0xf'),auth[_0x85eb('0x9')](),controller[_0x85eb('0x11')]);module[_0x85eb('0x12')]=router; \ No newline at end of file +var _0xe239=['/:id','show','/:id/run','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','get','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe239,0x19b));var _0x9e23=function(_0x52aba5,_0x467f8f){_0x52aba5=_0x52aba5-0x0;var _0x3c7fd6=_0xe239[_0x52aba5];return _0x3c7fd6;};'use strict';var multer=require(_0x9e23('0x0'));var util=require(_0x9e23('0x1'));var path=require(_0x9e23('0x2'));var timeout=require(_0x9e23('0x3'));var express=require(_0x9e23('0x4'));var router=express['Router']();var fs_extra=require(_0x9e23('0x5'));var auth=require(_0x9e23('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0x9e23('0x7')]('/',auth['isAuthenticated'](),controller[_0x9e23('0x8')]);router[_0x9e23('0x7')](_0x9e23('0x9'),auth['isAuthenticated'](),controller[_0x9e23('0xa')]);router[_0x9e23('0x7')](_0x9e23('0xb'),auth[_0x9e23('0xc')](),controller['run']);router[_0x9e23('0xd')]('/',auth[_0x9e23('0xc')](),controller[_0x9e23('0xe')]);router[_0x9e23('0xf')](_0x9e23('0x9'),auth['isAuthenticated'](),controller[_0x9e23('0x10')]);router[_0x9e23('0x11')](_0x9e23('0x9'),auth['isAuthenticated'](),controller[_0x9e23('0x12')]);module[_0x9e23('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index b2e624a..084b775 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 _0xc9c3=['csv','pdf','xlsx','custom','default','TEXT','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','weeks','days','hours','minutes'];(function(_0x29b35c,_0x2001c5){var _0x5ab131=function(_0x4afc0a){while(--_0x4afc0a){_0x29b35c['push'](_0x29b35c['shift']());}};_0x5ab131(++_0x2001c5);}(_0xc9c3,0x96));var _0x3c9c=function(_0x42471a,_0x765462){_0x42471a=_0x42471a-0x0;var _0x3bb7b0=_0xc9c3[_0x42471a];return _0x3bb7b0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3c9c('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x3c9c('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x3c9c('0x0')],'allowNull':![],'defaultValue':_0x3c9c('0x2')},'startAt':{'type':Sequelize[_0x3c9c('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x3c9c('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x3c9c('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x3c9c('0x5')]('years','quarters','months',_0x3c9c('0x6'),_0x3c9c('0x7'),_0x3c9c('0x8'),_0x3c9c('0x9')),'allowNull':![],'defaultValue':_0x3c9c('0x7')},'output':{'type':Sequelize[_0x3c9c('0x5')](_0x3c9c('0xa'),_0x3c9c('0xb'),_0x3c9c('0xc')),'allowNull':![],'defaultValue':_0x3c9c('0xa')},'type':{'type':Sequelize['ENUM'](_0x3c9c('0xd'),_0x3c9c('0xe')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x3c9c('0x1')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x3c9c('0xf')]},'bcc':{'type':Sequelize[_0x3c9c('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x3c9c('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x91c6=['custom','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','hours','minutes','days','pdf','xlsx','csv'];(function(_0x14c8ee,_0x34d4fb){var _0x51acc2=function(_0x4c1277){while(--_0x4c1277){_0x14c8ee['push'](_0x14c8ee['shift']());}};_0x51acc2(++_0x34d4fb);}(_0x91c6,0xf9));var _0x691c=function(_0x4480a4,_0x16ce51){_0x4480a4=_0x4480a4-0x0;var _0x1024ed=_0x91c6[_0x4480a4];return _0x1024ed;};'use strict';var Sequelize=require(_0x691c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x691c('0x1')]},'active':{'type':Sequelize[_0x691c('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x691c('0x1')],'allowNull':![],'defaultValue':_0x691c('0x3')},'startAt':{'type':Sequelize[_0x691c('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x691c('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x691c('0x6')](_0x691c('0x7'),_0x691c('0x8'),_0x691c('0x9'),_0x691c('0xa'),'days',_0x691c('0xb'),_0x691c('0xc')),'allowNull':![],'defaultValue':_0x691c('0xd')},'output':{'type':Sequelize[_0x691c('0x6')]('csv',_0x691c('0xe'),_0x691c('0xf')),'allowNull':![],'defaultValue':_0x691c('0x10')},'type':{'type':Sequelize['ENUM']('custom','default'),'allowNull':![],'defaultValue':_0x691c('0x11')},'sendMail':{'type':Sequelize[_0x691c('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x691c('0x1')]},'cc':{'type':Sequelize[_0x691c('0x12')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 0d719c0..3fe693b 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 _0x1268=['sox','lodash','squel','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','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','then','sendStatus','stack','name','map','Schedule','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','params','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Scheduler','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','run','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x5caced,_0xe500f6){var _0x906d16=function(_0x1081f3){while(--_0x1081f3){_0x5caced['push'](_0x5caced['shift']());}};_0x906d16(++_0xe500f6);}(_0x1268,0xf6));var _0x8126=function(_0x568065,_0x5f3952){_0x568065=_0x568065-0x0;var _0x13932f=_0x1268[_0x568065];return _0x13932f;};'use strict';var emlformat=require(_0x8126('0x0'));var rimraf=require(_0x8126('0x1'));var zipdir=require(_0x8126('0x2'));var jsonpatch=require(_0x8126('0x3'));var rp=require('request-promise');var moment=require(_0x8126('0x4'));var BPromise=require(_0x8126('0x5'));var Mustache=require(_0x8126('0x6'));var util=require(_0x8126('0x7'));var path=require(_0x8126('0x8'));var sox=require(_0x8126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8126('0xa'));var squel=require(_0x8126('0xb'));var crypto=require(_0x8126('0xc'));var jsforce=require(_0x8126('0xd'));var deskjs=require(_0x8126('0xe'));var toCsv=require(_0x8126('0xf'));var querystring=require(_0x8126('0x10'));var Papa=require(_0x8126('0x11'));var Redis=require(_0x8126('0x12'));var authService=require(_0x8126('0x13'));var qs=require(_0x8126('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8126('0x15'));var logger=require(_0x8126('0x16'))(_0x8126('0x17'));var utils=require(_0x8126('0x18'));var config=require(_0x8126('0x19'));var licenseUtil=require(_0x8126('0x1a'));var db=require(_0x8126('0x1b'))['db'];function respondWithStatusCode(_0x38a1ba,_0x16160a){_0x16160a=_0x16160a||0xcc;return function(_0x2e2632){if(_0x2e2632){return _0x38a1ba['sendStatus'](_0x16160a);}return _0x38a1ba[_0x8126('0x1c')](_0x16160a)[_0x8126('0x1d')]();};}function respondWithResult(_0x1947a4,_0x12bdc0){_0x12bdc0=_0x12bdc0||0xc8;return function(_0x4ba089){if(_0x4ba089){return _0x1947a4[_0x8126('0x1c')](_0x12bdc0)[_0x8126('0x1e')](_0x4ba089);}};}function respondWithFilteredResult(_0x2f2552,_0x48c427){return function(_0x3e65dd){if(_0x3e65dd){var _0x3ff761=_0x3e65dd[_0x8126('0x1f')],_0xc25bb6=_0x48c427[_0x8126('0x20')],_0x235f36=_0x48c427[_0x8126('0x20')]+_0x48c427['limit'],_0x1327f6;if(_0x235f36>=_0x3ff761){_0x235f36=_0x3ff761;_0x1327f6=0xc8;}else{_0x1327f6=0xce;}_0x2f2552['status'](_0x1327f6);return _0x2f2552[_0x8126('0x21')](_0x8126('0x22'),_0xc25bb6+'-'+_0x235f36+'/'+_0x3ff761)[_0x8126('0x1e')](_0x3e65dd);}return null;};}function patchUpdates(_0x5d4a4c){return function(_0x52c2ae){try{jsonpatch[_0x8126('0x23')](_0x52c2ae,_0x5d4a4c,!![]);}catch(_0x104fd6){return BPromise[_0x8126('0x24')](_0x104fd6);}return _0x52c2ae[_0x8126('0x25')]();};}function saveUpdates(_0x560b1b,_0x194b1e){return function(_0x1fa67b){if(_0x1fa67b){return _0x1fa67b['update'](_0x560b1b)['then'](function(_0x56951f){return _0x56951f;});}return null;};}function removeEntity(_0x29da5f,_0x40b98a){return function(_0x300942){if(_0x300942){return _0x300942[_0x8126('0x26')]()[_0x8126('0x27')](function(){var _0xeda8d5=_0x300942['get']({'plain':!![]});var _0x4eefa8='Scheduler';return db['UserProfileResource'][_0x8126('0x26')]({'where':{'type':_0x4eefa8,'resourceId':_0xeda8d5['id']}})['then'](function(){return _0x300942;});})['then'](function(){_0x29da5f[_0x8126('0x1c')](0xcc)[_0x8126('0x1d')]();});}};}function handleEntityNotFound(_0x1f811a,_0x100dca){return function(_0x4bf96a){if(!_0x4bf96a){_0x1f811a[_0x8126('0x28')](0x194);}return _0x4bf96a;};}function handleError(_0x59b0fa,_0xc8c982){_0xc8c982=_0xc8c982||0x1f4;return function(_0x54c250){logger['error'](_0x54c250[_0x8126('0x29')]);if(_0x54c250[_0x8126('0x2a')]){delete _0x54c250[_0x8126('0x2a')];}_0x59b0fa[_0x8126('0x1c')](_0xc8c982)['send'](_0x54c250);};}exports['index']=function(_0x1e5491,_0x53e945){var _0x15acda={},_0x4ec290={},_0x32e854={'count':0x0,'rows':[]};var _0x297403=_[_0x8126('0x2b')](db[_0x8126('0x2c')][_0x8126('0x2d')],function(_0x37b3bf){return{'name':_0x37b3bf[_0x8126('0x2e')],'type':_0x37b3bf[_0x8126('0x2f')]['key']};});_0x4ec290[_0x8126('0x30')]=_[_0x8126('0x2b')](_0x297403,_0x8126('0x2a'));_0x4ec290[_0x8126('0x31')]=_[_0x8126('0x32')](_0x1e5491[_0x8126('0x31')]);_0x4ec290[_0x8126('0x33')]=_[_0x8126('0x34')](_0x4ec290[_0x8126('0x30')],_0x4ec290[_0x8126('0x31')]);_0x15acda[_0x8126('0x35')]=_[_0x8126('0x34')](_0x4ec290[_0x8126('0x30')],qs[_0x8126('0x36')](_0x1e5491['query'][_0x8126('0x36')]));_0x15acda[_0x8126('0x35')]=_0x15acda['attributes'][_0x8126('0x37')]?_0x15acda[_0x8126('0x35')]:_0x4ec290[_0x8126('0x30')];if(!_0x1e5491[_0x8126('0x31')]['hasOwnProperty'](_0x8126('0x38'))){_0x15acda[_0x8126('0x39')]=qs[_0x8126('0x39')](_0x1e5491['query']['limit']);_0x15acda[_0x8126('0x20')]=qs['offset'](_0x1e5491['query']['offset']);}_0x15acda[_0x8126('0x3a')]=qs[_0x8126('0x3b')](_0x1e5491[_0x8126('0x31')][_0x8126('0x3b')]);_0x15acda[_0x8126('0x3c')]=qs[_0x8126('0x33')](_[_0x8126('0x3d')](_0x1e5491[_0x8126('0x31')],_0x4ec290[_0x8126('0x33')]),_0x297403);if(_0x1e5491[_0x8126('0x31')][_0x8126('0x3e')]){_0x15acda['where']=_[_0x8126('0x3f')](_0x15acda[_0x8126('0x3c')],{'$or':_['map'](_0x297403,function(_0x565acf){if(_0x565acf[_0x8126('0x2f')]!==_0x8126('0x40')){var _0x513b00={};_0x513b00[_0x565acf['name']]={'$like':'%'+_0x1e5491[_0x8126('0x31')][_0x8126('0x3e')]+'%'};return _0x513b00;}})});}_0x15acda=_[_0x8126('0x3f')]({},_0x15acda,_0x1e5491['options']);var _0x3700a1={'where':_0x15acda[_0x8126('0x3c')]};return db['Schedule'][_0x8126('0x1f')](_0x3700a1)[_0x8126('0x27')](function(_0x5680c1){_0x32e854[_0x8126('0x1f')]=_0x5680c1;if(_0x1e5491[_0x8126('0x31')][_0x8126('0x41')]){_0x15acda[_0x8126('0x42')]=[{'all':!![]}];}return db[_0x8126('0x2c')][_0x8126('0x43')](_0x15acda);})['then'](function(_0x21ffeb){_0x32e854['rows']=_0x21ffeb;return _0x32e854;})[_0x8126('0x27')](respondWithFilteredResult(_0x53e945,_0x15acda))['catch'](handleError(_0x53e945,null));};exports['show']=function(_0x3d1bc3,_0x4602dd){var _0x4da3ef={'raw':![],'where':{'id':_0x3d1bc3[_0x8126('0x44')]['id']}},_0x5898b0={};_0x5898b0[_0x8126('0x30')]=_[_0x8126('0x32')](db['Schedule'][_0x8126('0x2d')]);_0x5898b0[_0x8126('0x31')]=_[_0x8126('0x32')](_0x3d1bc3['query']);_0x5898b0[_0x8126('0x33')]=_[_0x8126('0x34')](_0x5898b0['model'],_0x5898b0[_0x8126('0x31')]);_0x4da3ef[_0x8126('0x35')]=_[_0x8126('0x34')](_0x5898b0[_0x8126('0x30')],qs[_0x8126('0x36')](_0x3d1bc3['query'][_0x8126('0x36')]));_0x4da3ef[_0x8126('0x35')]=_0x4da3ef[_0x8126('0x35')][_0x8126('0x37')]?_0x4da3ef['attributes']:_0x5898b0[_0x8126('0x30')];if(_0x3d1bc3[_0x8126('0x31')][_0x8126('0x41')]){_0x4da3ef[_0x8126('0x42')]=[{'all':!![]}];}_0x4da3ef=_['merge']({},_0x4da3ef,_0x3d1bc3[_0x8126('0x45')]);return db[_0x8126('0x2c')][_0x8126('0x46')](_0x4da3ef)[_0x8126('0x27')](handleEntityNotFound(_0x4602dd,null))[_0x8126('0x27')](respondWithResult(_0x4602dd,null))[_0x8126('0x47')](handleError(_0x4602dd,null));};exports[_0x8126('0x48')]=function(_0x321b5c,_0x32fe74){return db[_0x8126('0x2c')][_0x8126('0x48')](_0x321b5c[_0x8126('0x49')],{})[_0x8126('0x27')](function(_0x39903c){var _0x6e0db7=_0x321b5c[_0x8126('0x4a')][_0x8126('0x4b')]({'plain':!![]});if(!_0x6e0db7)throw new Error(_0x8126('0x4c'));if(_0x6e0db7['role']===_0x8126('0x4a')){var _0x181050=_0x39903c[_0x8126('0x4b')]({'plain':!![]});var _0x4a09f8=_0x8126('0x4d');return db[_0x8126('0x4e')][_0x8126('0x46')]({'where':{'name':_0x4a09f8,'userProfileId':_0x6e0db7[_0x8126('0x4f')]},'raw':!![]})['then'](function(_0x3d0c18){if(_0x3d0c18&&_0x3d0c18[_0x8126('0x50')]===0x0){return db[_0x8126('0x51')][_0x8126('0x48')]({'name':_0x181050[_0x8126('0x2a')],'resourceId':_0x181050['id'],'type':_0x3d0c18[_0x8126('0x2a')],'sectionId':_0x3d0c18['id']},{})[_0x8126('0x27')](function(){return _0x39903c;});}else{return _0x39903c;}})['catch'](function(_0x25cafe){logger['error'](_0x8126('0x52'),_0x25cafe);throw _0x25cafe;});}return _0x39903c;})[_0x8126('0x27')](respondWithResult(_0x32fe74,0xc9))[_0x8126('0x47')](handleError(_0x32fe74,null));};exports[_0x8126('0x53')]=function(_0x558d26,_0x554920){if(_0x558d26['body']['id']){delete _0x558d26[_0x8126('0x49')]['id'];}return db[_0x8126('0x2c')][_0x8126('0x46')]({'where':{'id':_0x558d26[_0x8126('0x44')]['id']}})['then'](handleEntityNotFound(_0x554920,null))[_0x8126('0x27')](saveUpdates(_0x558d26[_0x8126('0x49')],null))['then'](respondWithResult(_0x554920,null))['catch'](handleError(_0x554920,null));};exports['destroy']=function(_0x1d0ed0,_0x187737){return db['Schedule'][_0x8126('0x46')]({'where':{'id':_0x1d0ed0[_0x8126('0x44')]['id']}})[_0x8126('0x27')](handleEntityNotFound(_0x187737,null))[_0x8126('0x27')](removeEntity(_0x187737,null))[_0x8126('0x47')](handleError(_0x187737,null));};exports['run']=function(_0x86afe9,_0x31a6cd,_0x1a60ed){var _0x117a35=require('../../config/schedule');return db[_0x8126('0x2c')][_0x8126('0x46')]({'where':{'id':_0x86afe9[_0x8126('0x44')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x31a6cd,null))[_0x8126('0x27')](function(){_0x117a35[_0x8126('0x54')](_0x86afe9['params']['id']);})[_0x8126('0x27')](respondWithStatusCode(_0x31a6cd,null))[_0x8126('0x47')](handleError(_0x31a6cd,null));}; \ No newline at end of file +var _0x7e83=['moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','update','then','destroy','get','Scheduler','UserProfileResource','stack','name','map','Schedule','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','intersection','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3dc538,_0x4f7702){var _0x72c2fd=function(_0x5a7260){while(--_0x5a7260){_0x3dc538['push'](_0x3dc538['shift']());}};_0x72c2fd(++_0x4f7702);}(_0x7e83,0xdc));var _0x37e8=function(_0x52f159,_0x419d8a){_0x52f159=_0x52f159-0x0;var _0x156799=_0x7e83[_0x52f159];return _0x156799;};'use strict';var emlformat=require(_0x37e8('0x0'));var rimraf=require(_0x37e8('0x1'));var zipdir=require(_0x37e8('0x2'));var jsonpatch=require(_0x37e8('0x3'));var rp=require(_0x37e8('0x4'));var moment=require(_0x37e8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x37e8('0x6'));var util=require(_0x37e8('0x7'));var path=require(_0x37e8('0x8'));var sox=require(_0x37e8('0x9'));var csv=require(_0x37e8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x37e8('0xb'));var _=require(_0x37e8('0xc'));var squel=require(_0x37e8('0xd'));var crypto=require('crypto');var jsforce=require(_0x37e8('0xe'));var deskjs=require(_0x37e8('0xf'));var toCsv=require(_0x37e8('0xa'));var querystring=require(_0x37e8('0x10'));var Papa=require('papaparse');var Redis=require(_0x37e8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x37e8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x37e8('0x13'));var logger=require('../../config/logger')(_0x37e8('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x37e8('0x15'))['db'];function respondWithStatusCode(_0x4dfeec,_0x54e55d){_0x54e55d=_0x54e55d||0xcc;return function(_0x5dadf2){if(_0x5dadf2){return _0x4dfeec[_0x37e8('0x16')](_0x54e55d);}return _0x4dfeec[_0x37e8('0x17')](_0x54e55d)[_0x37e8('0x18')]();};}function respondWithResult(_0x5aebe6,_0x2500e7){_0x2500e7=_0x2500e7||0xc8;return function(_0x44b520){if(_0x44b520){return _0x5aebe6['status'](_0x2500e7)[_0x37e8('0x19')](_0x44b520);}};}function respondWithFilteredResult(_0x9a3a93,_0x4dd7ab){return function(_0x49db17){if(_0x49db17){var _0x469100=_0x49db17[_0x37e8('0x1a')],_0x50b30e=_0x4dd7ab[_0x37e8('0x1b')],_0x54aebe=_0x4dd7ab[_0x37e8('0x1b')]+_0x4dd7ab[_0x37e8('0x1c')],_0x20554d;if(_0x54aebe>=_0x469100){_0x54aebe=_0x469100;_0x20554d=0xc8;}else{_0x20554d=0xce;}_0x9a3a93[_0x37e8('0x17')](_0x20554d);return _0x9a3a93[_0x37e8('0x1d')]('Content-Range',_0x50b30e+'-'+_0x54aebe+'/'+_0x469100)[_0x37e8('0x19')](_0x49db17);}return null;};}function patchUpdates(_0x91b9db){return function(_0x4ce9a5){try{jsonpatch[_0x37e8('0x1e')](_0x4ce9a5,_0x91b9db,!![]);}catch(_0x3143f9){return BPromise['reject'](_0x3143f9);}return _0x4ce9a5['save']();};}function saveUpdates(_0x2ac487,_0x2b0759){return function(_0xf61b0b){if(_0xf61b0b){return _0xf61b0b[_0x37e8('0x1f')](_0x2ac487)[_0x37e8('0x20')](function(_0x1cb4af){return _0x1cb4af;});}return null;};}function removeEntity(_0x3fd0a4,_0x28517d){return function(_0x3ade7c){if(_0x3ade7c){return _0x3ade7c[_0x37e8('0x21')]()['then'](function(){var _0x26e31a=_0x3ade7c[_0x37e8('0x22')]({'plain':!![]});var _0x4da8c0=_0x37e8('0x23');return db[_0x37e8('0x24')]['destroy']({'where':{'type':_0x4da8c0,'resourceId':_0x26e31a['id']}})[_0x37e8('0x20')](function(){return _0x3ade7c;});})['then'](function(){_0x3fd0a4[_0x37e8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b8d73,_0x45eaee){return function(_0xb6fc91){if(!_0xb6fc91){_0x5b8d73['sendStatus'](0x194);}return _0xb6fc91;};}function handleError(_0x3080bf,_0xea3fcc){_0xea3fcc=_0xea3fcc||0x1f4;return function(_0x1c2aba){logger['error'](_0x1c2aba[_0x37e8('0x25')]);if(_0x1c2aba[_0x37e8('0x26')]){delete _0x1c2aba[_0x37e8('0x26')];}_0x3080bf[_0x37e8('0x17')](_0xea3fcc)['send'](_0x1c2aba);};}exports['index']=function(_0x56126b,_0x4aae86){var _0x22be1f={},_0x28ed87={},_0x4c1293={'count':0x0,'rows':[]};var _0xd0767e=_[_0x37e8('0x27')](db[_0x37e8('0x28')]['rawAttributes'],function(_0x2f3dad){return{'name':_0x2f3dad[_0x37e8('0x29')],'type':_0x2f3dad[_0x37e8('0x2a')][_0x37e8('0x2b')]};});_0x28ed87['model']=_[_0x37e8('0x27')](_0xd0767e,_0x37e8('0x26'));_0x28ed87[_0x37e8('0x2c')]=_[_0x37e8('0x2d')](_0x56126b['query']);_0x28ed87[_0x37e8('0x2e')]=_['intersection'](_0x28ed87[_0x37e8('0x2f')],_0x28ed87[_0x37e8('0x2c')]);_0x22be1f['attributes']=_['intersection'](_0x28ed87[_0x37e8('0x2f')],qs[_0x37e8('0x30')](_0x56126b[_0x37e8('0x2c')][_0x37e8('0x30')]));_0x22be1f[_0x37e8('0x31')]=_0x22be1f[_0x37e8('0x31')][_0x37e8('0x32')]?_0x22be1f[_0x37e8('0x31')]:_0x28ed87[_0x37e8('0x2f')];if(!_0x56126b['query'][_0x37e8('0x33')]('nolimit')){_0x22be1f['limit']=qs[_0x37e8('0x1c')](_0x56126b['query'][_0x37e8('0x1c')]);_0x22be1f[_0x37e8('0x1b')]=qs[_0x37e8('0x1b')](_0x56126b[_0x37e8('0x2c')][_0x37e8('0x1b')]);}_0x22be1f[_0x37e8('0x34')]=qs[_0x37e8('0x35')](_0x56126b[_0x37e8('0x2c')][_0x37e8('0x35')]);_0x22be1f[_0x37e8('0x36')]=qs['filters'](_[_0x37e8('0x37')](_0x56126b[_0x37e8('0x2c')],_0x28ed87[_0x37e8('0x2e')]),_0xd0767e);if(_0x56126b['query'][_0x37e8('0x38')]){_0x22be1f['where']=_['merge'](_0x22be1f[_0x37e8('0x36')],{'$or':_[_0x37e8('0x27')](_0xd0767e,function(_0x1f5f2d){if(_0x1f5f2d['type']!=='VIRTUAL'){var _0x418da6={};_0x418da6[_0x1f5f2d[_0x37e8('0x26')]]={'$like':'%'+_0x56126b[_0x37e8('0x2c')]['filter']+'%'};return _0x418da6;}})});}_0x22be1f=_[_0x37e8('0x39')]({},_0x22be1f,_0x56126b['options']);var _0x58dd5c={'where':_0x22be1f[_0x37e8('0x36')]};return db[_0x37e8('0x28')][_0x37e8('0x1a')](_0x58dd5c)[_0x37e8('0x20')](function(_0x45ca04){_0x4c1293[_0x37e8('0x1a')]=_0x45ca04;if(_0x56126b[_0x37e8('0x2c')][_0x37e8('0x3a')]){_0x22be1f[_0x37e8('0x3b')]=[{'all':!![]}];}return db[_0x37e8('0x28')][_0x37e8('0x3c')](_0x22be1f);})[_0x37e8('0x20')](function(_0x380719){_0x4c1293[_0x37e8('0x3d')]=_0x380719;return _0x4c1293;})[_0x37e8('0x20')](respondWithFilteredResult(_0x4aae86,_0x22be1f))[_0x37e8('0x3e')](handleError(_0x4aae86,null));};exports['show']=function(_0x4c8d49,_0x3b5049){var _0x1626e9={'raw':![],'where':{'id':_0x4c8d49['params']['id']}},_0x427ba1={};_0x427ba1['model']=_['keys'](db['Schedule']['rawAttributes']);_0x427ba1[_0x37e8('0x2c')]=_[_0x37e8('0x2d')](_0x4c8d49[_0x37e8('0x2c')]);_0x427ba1[_0x37e8('0x2e')]=_[_0x37e8('0x3f')](_0x427ba1['model'],_0x427ba1[_0x37e8('0x2c')]);_0x1626e9[_0x37e8('0x31')]=_[_0x37e8('0x3f')](_0x427ba1[_0x37e8('0x2f')],qs[_0x37e8('0x30')](_0x4c8d49[_0x37e8('0x2c')][_0x37e8('0x30')]));_0x1626e9[_0x37e8('0x31')]=_0x1626e9[_0x37e8('0x31')][_0x37e8('0x32')]?_0x1626e9[_0x37e8('0x31')]:_0x427ba1[_0x37e8('0x2f')];if(_0x4c8d49[_0x37e8('0x2c')]['includeAll']){_0x1626e9[_0x37e8('0x3b')]=[{'all':!![]}];}_0x1626e9=_[_0x37e8('0x39')]({},_0x1626e9,_0x4c8d49[_0x37e8('0x40')]);return db['Schedule'][_0x37e8('0x41')](_0x1626e9)[_0x37e8('0x20')](handleEntityNotFound(_0x3b5049,null))[_0x37e8('0x20')](respondWithResult(_0x3b5049,null))[_0x37e8('0x3e')](handleError(_0x3b5049,null));};exports[_0x37e8('0x42')]=function(_0xbd3544,_0xbc0835){return db[_0x37e8('0x28')][_0x37e8('0x42')](_0xbd3544[_0x37e8('0x43')],{})['then'](function(_0x2af72a){var _0x291841=_0xbd3544[_0x37e8('0x44')]['get']({'plain':!![]});if(!_0x291841)throw new Error(_0x37e8('0x45'));if(_0x291841['role']===_0x37e8('0x44')){var _0x27cf1e=_0x2af72a['get']({'plain':!![]});var _0x356d72='Scheduler';return db[_0x37e8('0x46')][_0x37e8('0x41')]({'where':{'name':_0x356d72,'userProfileId':_0x291841[_0x37e8('0x47')]},'raw':!![]})['then'](function(_0x55388f){if(_0x55388f&&_0x55388f[_0x37e8('0x48')]===0x0){return db[_0x37e8('0x24')][_0x37e8('0x42')]({'name':_0x27cf1e[_0x37e8('0x26')],'resourceId':_0x27cf1e['id'],'type':_0x55388f[_0x37e8('0x26')],'sectionId':_0x55388f['id']},{})[_0x37e8('0x20')](function(){return _0x2af72a;});}else{return _0x2af72a;}})['catch'](function(_0x178048){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x178048);throw _0x178048;});}return _0x2af72a;})[_0x37e8('0x20')](respondWithResult(_0xbc0835,0xc9))[_0x37e8('0x3e')](handleError(_0xbc0835,null));};exports[_0x37e8('0x1f')]=function(_0x27f129,_0x5ec2ca){if(_0x27f129[_0x37e8('0x43')]['id']){delete _0x27f129[_0x37e8('0x43')]['id'];}return db['Schedule'][_0x37e8('0x41')]({'where':{'id':_0x27f129['params']['id']}})['then'](handleEntityNotFound(_0x5ec2ca,null))[_0x37e8('0x20')](saveUpdates(_0x27f129[_0x37e8('0x43')],null))[_0x37e8('0x20')](respondWithResult(_0x5ec2ca,null))['catch'](handleError(_0x5ec2ca,null));};exports['destroy']=function(_0x627ad0,_0x536dd9){return db[_0x37e8('0x28')][_0x37e8('0x41')]({'where':{'id':_0x627ad0[_0x37e8('0x49')]['id']}})[_0x37e8('0x20')](handleEntityNotFound(_0x536dd9,null))[_0x37e8('0x20')](removeEntity(_0x536dd9,null))[_0x37e8('0x3e')](handleError(_0x536dd9,null));};exports[_0x37e8('0x4a')]=function(_0x3b5e91,_0x3329c4,_0x41dabf){var _0x2ea3a6=require('../../config/schedule');return db[_0x37e8('0x28')][_0x37e8('0x41')]({'where':{'id':_0x3b5e91[_0x37e8('0x49')]['id']},'raw':!![]})[_0x37e8('0x20')](handleEntityNotFound(_0x3329c4,null))[_0x37e8('0x20')](function(){_0x2ea3a6[_0x37e8('0x4a')](_0x3b5e91[_0x37e8('0x49')]['id']);})[_0x37e8('0x20')](respondWithStatusCode(_0x3329c4,null))['catch'](handleError(_0x3329c4,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index cb227b7..0df0eff 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 _0x5ab4=['util','../../config/logger','api','moment','bluebird','request-promise','path','./schedule.attributes','exports','define','Schedule','lodash'];(function(_0x6b1300,_0x24c741){var _0x1e3e7e=function(_0x2346c5){while(--_0x2346c5){_0x6b1300['push'](_0x6b1300['shift']());}};_0x1e3e7e(++_0x24c741);}(_0x5ab4,0x9b));var _0x45ab=function(_0x2556df,_0x46952f){_0x2556df=_0x2556df-0x0;var _0x5eb8db=_0x5ab4[_0x2556df];return _0x5eb8db;};'use strict';var _=require(_0x45ab('0x0'));var util=require(_0x45ab('0x1'));var logger=require(_0x45ab('0x2'))(_0x45ab('0x3'));var moment=require(_0x45ab('0x4'));var BPromise=require(_0x45ab('0x5'));var rp=require(_0x45ab('0x6'));var fs=require('fs');var path=require(_0x45ab('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x45ab('0x8'));module[_0x45ab('0x9')]=function(_0x458967,_0x1916e6){return _0x458967[_0x45ab('0xa')](_0x45ab('0xb'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74a3=['rimraf','define','Schedule','tools_schedules','lodash','util','api','bluebird','request-promise'];(function(_0xd13a88,_0x3c5269){var _0x1c993c=function(_0x245af5){while(--_0x245af5){_0xd13a88['push'](_0xd13a88['shift']());}};_0x1c993c(++_0x3c5269);}(_0x74a3,0x136));var _0x374a=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x74a3[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x374a('0x0'));var util=require(_0x374a('0x1'));var logger=require('../../config/logger')(_0x374a('0x2'));var moment=require('moment');var BPromise=require(_0x374a('0x3'));var rp=require(_0x374a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x374a('0x5'));var config=require('../../config/environment');var attributes=require('./schedule.attributes');module['exports']=function(_0x587570,_0x132182){return _0x587570[_0x374a('0x6')](_0x374a('0x7'),attributes,{'tableName':_0x374a('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 6d7eb4b..b8a0bb3 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 _0x69b1=['http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x69b1,0x1f1));var _0x169b=function(_0x2c5907,_0x44fb44){_0x2c5907=_0x2c5907-0x0;var _0x506d20=_0x69b1[_0x2c5907];return _0x506d20;};'use strict';var _=require(_0x169b('0x0'));var util=require(_0x169b('0x1'));var moment=require(_0x169b('0x2'));var BPromise=require(_0x169b('0x3'));var rs=require(_0x169b('0x4'));var fs=require('fs');var Redis=require(_0x169b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x169b('0x6'));var config=require(_0x169b('0x7'));var jayson=require(_0x169b('0x8'));var client=jayson['client'][_0x169b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d71e8,_0x52bb46,_0x112adf){return new BPromise(function(_0x17b287,_0x1cdd4b){return client['request'](_0x3d71e8,_0x112adf)[_0x169b('0xa')](function(_0x6477c){logger[_0x169b('0xb')](_0x169b('0xc'),_0x52bb46,_0x169b('0xd'));logger[_0x169b('0xe')](_0x169b('0xf'),_0x52bb46,'request\x20sent',JSON[_0x169b('0x10')](_0x6477c));if(_0x6477c[_0x169b('0x11')]){if(_0x6477c[_0x169b('0x11')][_0x169b('0x12')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x52bb46,_0x6477c[_0x169b('0x11')]['message']);return _0x1cdd4b(_0x6477c[_0x169b('0x11')][_0x169b('0x13')]);}logger[_0x169b('0x11')](_0x169b('0xc'),_0x52bb46,_0x6477c[_0x169b('0x11')]['message']);return _0x17b287(_0x6477c[_0x169b('0x11')][_0x169b('0x13')]);}else{logger['info'](_0x169b('0xc'),_0x52bb46,_0x169b('0xd'));_0x17b287(_0x6477c[_0x169b('0x14')][_0x169b('0x13')]);}})[_0x169b('0x15')](function(_0x3bceab){logger['error'](_0x169b('0xc'),_0x52bb46,_0x3bceab);_0x1cdd4b(_0x3bceab);});});} \ No newline at end of file +var _0xe39b=['../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe39b,0x160));var _0xbe39=function(_0x5cf748,_0x507acd){_0x5cf748=_0x5cf748-0x0;var _0x5b28f0=_0xe39b[_0x5cf748];return _0x5b28f0;};'use strict';var _=require('lodash');var util=require(_0xbe39('0x0'));var moment=require(_0xbe39('0x1'));var BPromise=require(_0xbe39('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe39('0x3'));var db=require(_0xbe39('0x4'))['db'];var utils=require(_0xbe39('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe39('0x6'));var jayson=require(_0xbe39('0x7'));var client=jayson[_0xbe39('0x8')][_0xbe39('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e493d,_0x618117,_0x5417ec){return new BPromise(function(_0x11366b,_0x1c6938){return client[_0xbe39('0xa')](_0x5e493d,_0x5417ec)['then'](function(_0x5ed5d5){logger[_0xbe39('0xb')](_0xbe39('0xc'),_0x618117,_0xbe39('0xd'));logger[_0xbe39('0xe')](_0xbe39('0xf'),_0x618117,_0xbe39('0xd'),JSON[_0xbe39('0x10')](_0x5ed5d5));if(_0x5ed5d5[_0xbe39('0x11')]){if(_0x5ed5d5['error'][_0xbe39('0x12')]===0x1f4){logger[_0xbe39('0x11')](_0xbe39('0xc'),_0x618117,_0x5ed5d5[_0xbe39('0x11')][_0xbe39('0x13')]);return _0x1c6938(_0x5ed5d5[_0xbe39('0x11')][_0xbe39('0x13')]);}logger[_0xbe39('0x11')]('Schedule,\x20%s,\x20%s',_0x618117,_0x5ed5d5[_0xbe39('0x11')]['message']);return _0x11366b(_0x5ed5d5['error'][_0xbe39('0x13')]);}else{logger['info'](_0xbe39('0xc'),_0x618117,_0xbe39('0xd'));_0x11366b(_0x5ed5d5[_0xbe39('0x14')]['message']);}})['catch'](function(_0x46780a){logger[_0xbe39('0x11')](_0xbe39('0xc'),_0x618117,_0x46780a);_0x1c6938(_0x46780a);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 46577af..7356f8b 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 _0xea92=['../../components/auth/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4600ba,_0x4667ad){var _0x42800f=function(_0x5423fe){while(--_0x5423fe){_0x4600ba['push'](_0x4600ba['shift']());}};_0x42800f(++_0x4667ad);}(_0xea92,0x189));var _0x2ea9=function(_0x55c503,_0x3af666){_0x55c503=_0x55c503-0x0;var _0x2fd46b=_0xea92[_0x55c503];return _0x2fd46b;};'use strict';var multer=require(_0x2ea9('0x0'));var util=require(_0x2ea9('0x1'));var path=require(_0x2ea9('0x2'));var timeout=require(_0x2ea9('0x3'));var express=require(_0x2ea9('0x4'));var router=express[_0x2ea9('0x5')]();var fs_extra=require(_0x2ea9('0x6'));var auth=require(_0x2ea9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2ea9('0x8'));var controller=require(_0x2ea9('0x9'));router[_0x2ea9('0xa')]('/',auth[_0x2ea9('0xb')](),controller[_0x2ea9('0xc')]);router[_0x2ea9('0xa')](_0x2ea9('0xd'),auth[_0x2ea9('0xb')](),controller[_0x2ea9('0xe')]);router['get'](_0x2ea9('0xf'),auth['isAuthenticated'](),controller[_0x2ea9('0x10')]);router[_0x2ea9('0xa')]('/:id/download',auth[_0x2ea9('0xb')](),controller[_0x2ea9('0x11')]);router[_0x2ea9('0x12')]('/',auth[_0x2ea9('0xb')](),controller[_0x2ea9('0x13')]);router[_0x2ea9('0x14')](_0x2ea9('0xf'),auth[_0x2ea9('0xb')](),controller[_0x2ea9('0x15')]);router[_0x2ea9('0x16')](_0x2ea9('0xf'),auth[_0x2ea9('0xb')](),controller[_0x2ea9('0x17')]);module[_0x2ea9('0x18')]=router; \ No newline at end of file +var _0x0664=['download','post','create','put','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x0664,0x1e1));var _0x4066=function(_0x2abb4d,_0xd23d68){_0x2abb4d=_0x2abb4d-0x0;var _0x8f2d56=_0x0664[_0x2abb4d];return _0x8f2d56;};'use strict';var multer=require(_0x4066('0x0'));var util=require(_0x4066('0x1'));var path=require(_0x4066('0x2'));var timeout=require(_0x4066('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4066('0x4'));var auth=require(_0x4066('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4066('0x6'));var controller=require('./screenRecording.controller');router[_0x4066('0x7')]('/',auth[_0x4066('0x8')](),controller[_0x4066('0x9')]);router[_0x4066('0x7')]('/describe',auth[_0x4066('0x8')](),controller[_0x4066('0xa')]);router[_0x4066('0x7')](_0x4066('0xb'),auth[_0x4066('0x8')](),controller[_0x4066('0xc')]);router[_0x4066('0x7')]('/:id/download',auth[_0x4066('0x8')](),controller[_0x4066('0xd')]);router[_0x4066('0xe')]('/',auth[_0x4066('0x8')](),controller[_0x4066('0xf')]);router[_0x4066('0x10')](_0x4066('0xb'),auth[_0x4066('0x8')](),controller['update']);router[_0x4066('0x11')](_0x4066('0xb'),auth[_0x4066('0x8')](),controller['destroy']);module[_0x4066('0x12')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 7e1a901..ccfcccf 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 _0x032e=['duration','DATE','MM-DD-YYYY\x20HH:mm','toString','format','createdAt','updatedAt','sequelize','path','../../config/environment','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','closedAt'];(function(_0x11c257,_0x266bef){var _0x756fc2=function(_0x2da1b8){while(--_0x2da1b8){_0x11c257['push'](_0x11c257['shift']());}};_0x756fc2(++_0x266bef);}(_0x032e,0x124));var _0xe032=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x032e[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0xe032('0x0'));var moment=require('moment');var path=require(_0xe032('0x1'));var config=require(_0xe032('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xe032('0x3')](_0xe032('0x4'))?path[_0xe032('0x5')](this[_0xe032('0x3')](_0xe032('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0xe032('0x6')]},'channel':{'type':Sequelize[_0xe032('0x6')]},'value':{'type':Sequelize[_0xe032('0x6')],'set':function(_0x37432f){var _0x1576c8=_0x37432f[_0xe032('0x7')](/\\/g,'/');this[_0xe032('0x8')](_0xe032('0x4'),_0x1576c8);}},'rating':{'type':Sequelize[_0xe032('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xe032('0x9')],'set':function(_0x2d8a14){this[_0xe032('0x8')](_0xe032('0xa'),moment()['subtract'](_0x2d8a14,'ms'));this[_0xe032('0x8')](_0xe032('0xb'),moment());this[_0xe032('0x8')](_0xe032('0xc'),_0x2d8a14);}},'startedAt':{'type':Sequelize[_0xe032('0xd')],'get':function(){return moment(this[_0xe032('0x3')](_0xe032('0xa')))['format'](_0xe032('0xe'))[_0xe032('0xf')]();}},'closedAt':{'type':Sequelize[_0xe032('0xd')],'get':function(){return moment(this[_0xe032('0x3')]('closedAt'))[_0xe032('0x10')](_0xe032('0xe'))[_0xe032('0xf')]();}},'createdAt':{'type':Sequelize[_0xe032('0xd')],'get':function(){return moment(this[_0xe032('0x3')](_0xe032('0x11')))[_0xe032('0x10')]('MM-DD-YYYY\x20HH:mm')[_0xe032('0xf')]();}},'updatedAt':{'type':Sequelize[_0xe032('0xd')],'get':function(){return moment(this[_0xe032('0x3')](_0xe032('0x12')))[_0xe032('0x10')](_0xe032('0xe'))['toString']();}}}; \ No newline at end of file +var _0x5fc3=['duration','startedAt','toString','closedAt','format','MM-DD-YYYY\x20HH:mm','DATE','updatedAt','sequelize','moment','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','subtract'];(function(_0x1fc871,_0x542cea){var _0x273d56=function(_0x311903){while(--_0x311903){_0x1fc871['push'](_0x1fc871['shift']());}};_0x273d56(++_0x542cea);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4bb145,_0x3e7d33){_0x4bb145=_0x4bb145-0x0;var _0x4db596=_0x5fc3[_0x4bb145];return _0x4db596;};'use strict';var Sequelize=require(_0x35fc('0x0'));var moment=require(_0x35fc('0x1'));var path=require('path');var config=require(_0x35fc('0x2'));module[_0x35fc('0x3')]={'format':{'type':Sequelize[_0x35fc('0x4')],'get':function(){return this[_0x35fc('0x5')](_0x35fc('0x6'))?path['extname'](this[_0x35fc('0x5')](_0x35fc('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x35fc('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x19a0d1){var _0x508b32=_0x19a0d1[_0x35fc('0x8')](/\\/g,'/');this[_0x35fc('0x9')](_0x35fc('0x6'),_0x508b32);}},'rating':{'type':Sequelize[_0x35fc('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x35fc('0xa')],'set':function(_0xf9d3a6){this[_0x35fc('0x9')]('startedAt',moment()[_0x35fc('0xb')](_0xf9d3a6,'ms'));this[_0x35fc('0x9')]('closedAt',moment());this[_0x35fc('0x9')](_0x35fc('0xc'),_0xf9d3a6);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x35fc('0x5')](_0x35fc('0xd')))['format']('MM-DD-YYYY\x20HH:mm')[_0x35fc('0xe')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x35fc('0x5')](_0x35fc('0xf')))[_0x35fc('0x10')](_0x35fc('0x11'))[_0x35fc('0xe')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('createdAt'))['format'](_0x35fc('0x11'))[_0x35fc('0xe')]();}},'updatedAt':{'type':Sequelize[_0x35fc('0x12')],'get':function(){return moment(this[_0x35fc('0x5')](_0x35fc('0x13')))[_0x35fc('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x35fc('0xe')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 49acab3..07ff1d9 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 _0x3297=['json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','name','index','map','ScreenRecording','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','VIRTUAL','merge','include','rows','catch','show','params','keys','includeAll','options','find','create','body','duration','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','unlinkSync','.cypher','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','end'];(function(_0x5c18ef,_0xa2e81d){var _0x33789d=function(_0x5761a9){while(--_0x5761a9){_0x5c18ef['push'](_0x5c18ef['shift']());}};_0x33789d(++_0xa2e81d);}(_0x3297,0xac));var _0x7329=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x3297[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7329('0x0'));var zipdir=require(_0x7329('0x1'));var jsonpatch=require(_0x7329('0x2'));var rp=require(_0x7329('0x3'));var moment=require('moment');var BPromise=require(_0x7329('0x4'));var Mustache=require(_0x7329('0x5'));var util=require(_0x7329('0x6'));var path=require(_0x7329('0x7'));var sox=require('sox');var csv=require(_0x7329('0x8'));var ejs=require(_0x7329('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7329('0xa'));var squel=require('squel');var crypto=require(_0x7329('0xb'));var jsforce=require(_0x7329('0xc'));var deskjs=require(_0x7329('0xd'));var toCsv=require(_0x7329('0x8'));var querystring=require(_0x7329('0xe'));var Papa=require(_0x7329('0xf'));var Redis=require(_0x7329('0x10'));var authService=require(_0x7329('0x11'));var qs=require(_0x7329('0x12'));var as=require(_0x7329('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7329('0x14'));var utils=require(_0x7329('0x15'));var config=require(_0x7329('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20cba7,_0x330dd3){_0x330dd3=_0x330dd3||0xcc;return function(_0x2e24bc){if(_0x2e24bc){return _0x20cba7[_0x7329('0x17')](_0x330dd3);}return _0x20cba7[_0x7329('0x18')](_0x330dd3)[_0x7329('0x19')]();};}function respondWithResult(_0x5f22ec,_0xb0e6f4){_0xb0e6f4=_0xb0e6f4||0xc8;return function(_0x3c3778){if(_0x3c3778){return _0x5f22ec[_0x7329('0x18')](_0xb0e6f4)[_0x7329('0x1a')](_0x3c3778);}};}function respondWithFilteredResult(_0x2a0ea0,_0x163d90){return function(_0x1986c5){if(_0x1986c5){var _0x4a5323=_0x1986c5[_0x7329('0x1b')],_0x2b3e4e=_0x163d90[_0x7329('0x1c')],_0x2adfc3=_0x163d90['offset']+_0x163d90[_0x7329('0x1d')],_0xc0a5b2;if(_0x2adfc3>=_0x4a5323){_0x2adfc3=_0x4a5323;_0xc0a5b2=0xc8;}else{_0xc0a5b2=0xce;}_0x2a0ea0['status'](_0xc0a5b2);return _0x2a0ea0['set'](_0x7329('0x1e'),_0x2b3e4e+'-'+_0x2adfc3+'/'+_0x4a5323)[_0x7329('0x1a')](_0x1986c5);}return null;};}function patchUpdates(_0x2c72d3){return function(_0x1e736a){try{jsonpatch[_0x7329('0x1f')](_0x1e736a,_0x2c72d3,!![]);}catch(_0x48e395){return BPromise[_0x7329('0x20')](_0x48e395);}return _0x1e736a[_0x7329('0x21')]();};}function saveUpdates(_0x3ba23c,_0x285b80){return function(_0x1bf3c1){if(_0x1bf3c1){return _0x1bf3c1[_0x7329('0x22')](_0x3ba23c)[_0x7329('0x23')](function(_0x22d2e0){return _0x22d2e0;});}return null;};}function removeEntity(_0x55230a,_0x17f334){return function(_0x57d4c1){if(_0x57d4c1){return _0x57d4c1[_0x7329('0x24')]()[_0x7329('0x23')](function(){_0x55230a['status'](0xcc)[_0x7329('0x19')]();});}};}function handleEntityNotFound(_0x5aff0b,_0x28e376){return function(_0x48a5ac){if(!_0x48a5ac){_0x5aff0b[_0x7329('0x17')](0x194);}return _0x48a5ac;};}function handleError(_0x51bcf7,_0x5ca1d2){_0x5ca1d2=_0x5ca1d2||0x1f4;return function(_0x9eda3e){logger['error'](_0x9eda3e['stack']);if(_0x9eda3e['name']){delete _0x9eda3e[_0x7329('0x25')];}_0x51bcf7[_0x7329('0x18')](_0x5ca1d2)['send'](_0x9eda3e);};}exports[_0x7329('0x26')]=function(_0x46e749,_0x45fa1d){var _0x5b76c8={},_0x5685ff={},_0x2ce558={'count':0x0,'rows':[]};var _0x55d015=_[_0x7329('0x27')](db[_0x7329('0x28')][_0x7329('0x29')],function(_0x4f076a){return{'name':_0x4f076a[_0x7329('0x2a')],'type':_0x4f076a[_0x7329('0x2b')]['key']};});_0x5685ff[_0x7329('0x2c')]=_['differenceBy'](_[_0x7329('0x27')](_0x55d015,_0x7329('0x25')),['format']);_0x5685ff[_0x7329('0x2d')]=_['keys'](_0x46e749[_0x7329('0x2d')]);_0x5685ff[_0x7329('0x2e')]=_[_0x7329('0x2f')](_0x5685ff[_0x7329('0x2c')],_0x5685ff[_0x7329('0x2d')]);_0x5b76c8[_0x7329('0x30')]=_[_0x7329('0x2f')](_0x5685ff[_0x7329('0x2c')],qs['fields'](_0x46e749['query'][_0x7329('0x31')]));_0x5b76c8['attributes']=_0x5b76c8['attributes'][_0x7329('0x32')]?_0x5b76c8['attributes']:_0x5685ff[_0x7329('0x2c')];if(!_0x46e749['query'][_0x7329('0x33')](_0x7329('0x34'))){_0x5b76c8[_0x7329('0x1d')]=qs[_0x7329('0x1d')](_0x46e749[_0x7329('0x2d')][_0x7329('0x1d')]);_0x5b76c8[_0x7329('0x1c')]=qs['offset'](_0x46e749['query'][_0x7329('0x1c')]);}_0x5b76c8[_0x7329('0x35')]=qs['sort'](_0x46e749[_0x7329('0x2d')]['sort']);_0x5b76c8[_0x7329('0x36')]=qs['filters'](_['pick'](_0x46e749[_0x7329('0x2d')],_0x5685ff[_0x7329('0x2e')]),_0x55d015);if(_0x46e749['query'][_0x7329('0x37')]){_0x5b76c8['where']=_['merge'](_0x5b76c8[_0x7329('0x36')],{'$or':_[_0x7329('0x27')](_0x55d015,function(_0x1f2833){if(_0x1f2833[_0x7329('0x2b')]!==_0x7329('0x38')){var _0x483616={};_0x483616[_0x1f2833[_0x7329('0x25')]]={'$like':'%'+_0x46e749[_0x7329('0x2d')][_0x7329('0x37')]+'%'};return _0x483616;}})});}_0x5b76c8=_[_0x7329('0x39')]({},_0x5b76c8,_0x46e749['options']);var _0x3cb4be={'where':_0x5b76c8[_0x7329('0x36')]};return db['ScreenRecording'][_0x7329('0x1b')](_0x3cb4be)[_0x7329('0x23')](function(_0x1f6139){_0x2ce558[_0x7329('0x1b')]=_0x1f6139;if(_0x46e749[_0x7329('0x2d')]['includeAll']){_0x5b76c8[_0x7329('0x3a')]=[{'all':!![]}];}return db[_0x7329('0x28')]['findAll'](_0x5b76c8);})[_0x7329('0x23')](function(_0x44af4d){_0x2ce558[_0x7329('0x3b')]=_0x44af4d;return _0x2ce558;})['then'](respondWithFilteredResult(_0x45fa1d,_0x5b76c8))[_0x7329('0x3c')](handleError(_0x45fa1d,null));};exports[_0x7329('0x3d')]=function(_0x5c8d6e,_0x217d58){var _0x1d10c0={'raw':![],'where':{'id':_0x5c8d6e[_0x7329('0x3e')]['id']}},_0x26d465={};_0x26d465[_0x7329('0x2c')]=_[_0x7329('0x3f')](db['ScreenRecording'][_0x7329('0x29')]);_0x26d465[_0x7329('0x2d')]=_['keys'](_0x5c8d6e[_0x7329('0x2d')]);_0x26d465[_0x7329('0x2e')]=_[_0x7329('0x2f')](_0x26d465['model'],_0x26d465['query']);_0x1d10c0[_0x7329('0x30')]=_[_0x7329('0x2f')](_0x26d465[_0x7329('0x2c')],qs[_0x7329('0x31')](_0x5c8d6e[_0x7329('0x2d')][_0x7329('0x31')]));_0x1d10c0[_0x7329('0x30')]=_0x1d10c0[_0x7329('0x30')][_0x7329('0x32')]?_0x1d10c0[_0x7329('0x30')]:_0x26d465[_0x7329('0x2c')];if(_0x5c8d6e[_0x7329('0x2d')][_0x7329('0x40')]){_0x1d10c0[_0x7329('0x3a')]=[{'all':!![]}];}_0x1d10c0=_['merge']({},_0x1d10c0,_0x5c8d6e[_0x7329('0x41')]);return db[_0x7329('0x28')][_0x7329('0x42')](_0x1d10c0)[_0x7329('0x23')](handleEntityNotFound(_0x217d58,null))[_0x7329('0x23')](respondWithResult(_0x217d58,null))[_0x7329('0x3c')](handleError(_0x217d58,null));};exports[_0x7329('0x43')]=function(_0x2b4fca,_0x4ea762){return db[_0x7329('0x28')]['create'](_0x2b4fca[_0x7329('0x44')],{})[_0x7329('0x23')](respondWithResult(_0x4ea762,0xc9))[_0x7329('0x3c')](handleError(_0x4ea762,null));};exports['update']=function(_0x29b146,_0x5a05a2){if(_0x29b146[_0x7329('0x44')]['id']){delete _0x29b146['body']['id'];}delete _0x29b146[_0x7329('0x44')][_0x7329('0x45')];delete _0x29b146[_0x7329('0x44')]['createdAt'];delete _0x29b146[_0x7329('0x44')]['closedAt'];delete _0x29b146[_0x7329('0x44')][_0x7329('0x46')];return db['ScreenRecording'][_0x7329('0x42')]({'where':{'id':_0x29b146[_0x7329('0x3e')]['id']}})[_0x7329('0x23')](handleEntityNotFound(_0x5a05a2,null))[_0x7329('0x23')](saveUpdates(_0x29b146[_0x7329('0x44')],null))['then'](respondWithResult(_0x5a05a2,null))[_0x7329('0x3c')](handleError(_0x5a05a2,null));};exports[_0x7329('0x47')]=function(_0x3769fd,_0x4a7799){return db['ScreenRecording']['describe']()['then'](respondWithResult(_0x4a7799,null))[_0x7329('0x3c')](handleError(_0x4a7799,null));};exports[_0x7329('0x48')]=function(_0x47d460,_0x54f45c,_0x25e18b){var _0x2b1e89=require(_0x7329('0x49'));var _0x24d4b4=![];var _0x10885a={};if(_0x47d460[_0x7329('0x2d')][_0x7329('0x2b')]&&_0x47d460['query'][_0x7329('0x2b')]===_0x7329('0x4a')){_0x10885a[_0x7329('0x4a')]=_0x47d460[_0x7329('0x3e')]['id'];}else{_0x10885a['id']=_0x47d460[_0x7329('0x3e')]['id'];}return db[_0x7329('0x28')][_0x7329('0x42')]({'where':_0x10885a,'attributes':['id','value'],'raw':!![]})[_0x7329('0x23')](handleEntityNotFound(_0x54f45c,null))[_0x7329('0x23')](function(_0x251ec3){if(_0x251ec3){var _0x86942f=path[_0x7329('0x4b')](config[_0x7329('0x4c')],_0x7329('0x4d'),_0x251ec3['value']);var _0x31e04b=util[_0x7329('0x4e')](_0x7329('0x4f'),_0x86942f);if(fs['existsSync'](_0x31e04b)){_0x24d4b4=!![];return _0x2b1e89[_0x7329('0x50')](_0x31e04b,_0x86942f,config[_0x7329('0x51')][_0x7329('0x52')])[_0x7329('0x23')](function(){return _0x251ec3;});}return _0x251ec3;}})[_0x7329('0x23')](function(_0x27303f){if(_0x27303f){var _0x476a96=path['join'](config['root'],_0x7329('0x4d'),_0x27303f[_0x7329('0x46')]);if(!fs[_0x7329('0x53')](_0x476a96)){throw new db[(_0x7329('0x54'))][(_0x7329('0x55'))](_0x7329('0x56'));}if(_0x27303f['filename']){return _0x54f45c['download'](_0x476a96,_0x27303f[_0x7329('0x57')]+path[_0x7329('0x58')](_0x476a96),function(){if(_0x24d4b4){fs['unlink'](_0x476a96);}});}else{return _0x54f45c[_0x7329('0x48')](_0x476a96,function(_0x241831){if(_0x24d4b4){fs[_0x7329('0x59')](_0x476a96);}});}}})[_0x7329('0x3c')](function(_0x512794){if(_0x512794[_0x7329('0x5a')]===_0x7329('0x56')){_0x54f45c[_0x7329('0x18')](0x194)[_0x7329('0x5b')]('Not\x20found');}else{return handleError(_0x54f45c,null);}});};exports[_0x7329('0x24')]=function(_0x59cb3d,_0x41918a){return db[_0x7329('0x28')]['find']({'where':{'id':_0x59cb3d[_0x7329('0x3e')]['id']}})[_0x7329('0x23')](function(_0x2c3112){if(!_0x2c3112)throw new ReferenceError(_0x7329('0x5c'));return _0x2c3112;})['then'](function(_0x94a101){var _0x2c5461=path['join'](config[_0x7329('0x4c')],_0x7329('0x4d'),_0x94a101[_0x7329('0x46')]);logger[_0x7329('0x5d')](_0x7329('0x5e'),_0x2c5461);if(!_['isNil'](_0x94a101['value'])&&fs[_0x7329('0x53')](_0x2c5461)){logger['info']('File:\x20\x22'+_0x2c5461+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x7329('0x5f')](_0x2c5461);}_0x2c5461=_0x2c5461+_0x7329('0x60');if(!_[_0x7329('0x61')](_0x94a101['value'])&&fs[_0x7329('0x53')](_0x2c5461)){logger[_0x7329('0x5d')]('File:\x20\x22'+_0x2c5461+_0x7329('0x62'));fs['unlinkSync'](_0x2c5461);}return _0x94a101;})[_0x7329('0x23')](function(_0x4dc78a){if(!_0x4dc78a)throw new InternalError();return _0x4dc78a[_0x7329('0x24')]();})[_0x7329('0x23')](function(){_0x41918a[_0x7329('0x18')](0xcc)[_0x7329('0x19')]();})[_0x7329('0x3c')](handleError(_0x41918a,null));}; \ No newline at end of file +var _0x8a5b=['util','path','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','stack','name','send','map','rawAttributes','fieldName','type','key','model','format','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','ScreenRecording','includeAll','findAll','rows','catch','params','length','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','join','root','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','destroy','eml-format','zip-dir','fast-json-patch','moment'];(function(_0x2c8242,_0x355f31){var _0x184695=function(_0x5abdb0){while(--_0x5abdb0){_0x2c8242['push'](_0x2c8242['shift']());}};_0x184695(++_0x355f31);}(_0x8a5b,0x116));var _0xb8a5=function(_0x40fcdf,_0x3ec4f0){_0x40fcdf=_0x40fcdf-0x0;var _0x4a0aee=_0x8a5b[_0x40fcdf];return _0x4a0aee;};'use strict';var emlformat=require(_0xb8a5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb8a5('0x1'));var jsonpatch=require(_0xb8a5('0x2'));var rp=require('request-promise');var moment=require(_0xb8a5('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb8a5('0x4'));var path=require(_0xb8a5('0x5'));var sox=require('sox');var csv=require(_0xb8a5('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb8a5('0x7'));var jsforce=require(_0xb8a5('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xb8a5('0x6'));var querystring=require(_0xb8a5('0x9'));var Papa=require(_0xb8a5('0xa'));var Redis=require(_0xb8a5('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xb8a5('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb8a5('0xd'));var logger=require(_0xb8a5('0xe'))(_0xb8a5('0xf'));var utils=require('../../config/utils');var config=require(_0xb8a5('0x10'));var licenseUtil=require(_0xb8a5('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4afc0a,_0x1e771b){_0x1e771b=_0x1e771b||0xcc;return function(_0x279b05){if(_0x279b05){return _0x4afc0a[_0xb8a5('0x12')](_0x1e771b);}return _0x4afc0a[_0xb8a5('0x13')](_0x1e771b)[_0xb8a5('0x14')]();};}function respondWithResult(_0x21bd93,_0x455b73){_0x455b73=_0x455b73||0xc8;return function(_0x2f514d){if(_0x2f514d){return _0x21bd93['status'](_0x455b73)[_0xb8a5('0x15')](_0x2f514d);}};}function respondWithFilteredResult(_0x8fd105,_0x4475dc){return function(_0x39f514){if(_0x39f514){var _0x513bc4=_0x39f514[_0xb8a5('0x16')],_0x3ac342=_0x4475dc['offset'],_0x28bbd9=_0x4475dc[_0xb8a5('0x17')]+_0x4475dc['limit'],_0x55191f;if(_0x28bbd9>=_0x513bc4){_0x28bbd9=_0x513bc4;_0x55191f=0xc8;}else{_0x55191f=0xce;}_0x8fd105[_0xb8a5('0x13')](_0x55191f);return _0x8fd105[_0xb8a5('0x18')](_0xb8a5('0x19'),_0x3ac342+'-'+_0x28bbd9+'/'+_0x513bc4)[_0xb8a5('0x15')](_0x39f514);}return null;};}function patchUpdates(_0xa915a4){return function(_0x5d573d){try{jsonpatch[_0xb8a5('0x1a')](_0x5d573d,_0xa915a4,!![]);}catch(_0xf85662){return BPromise[_0xb8a5('0x1b')](_0xf85662);}return _0x5d573d[_0xb8a5('0x1c')]();};}function saveUpdates(_0x3fa06d,_0x1e7d0e){return function(_0x4fbe13){if(_0x4fbe13){return _0x4fbe13['update'](_0x3fa06d)[_0xb8a5('0x1d')](function(_0xcd4eb7){return _0xcd4eb7;});}return null;};}function removeEntity(_0xc63fa1,_0x14f3f4){return function(_0x5317df){if(_0x5317df){return _0x5317df['destroy']()[_0xb8a5('0x1d')](function(){_0xc63fa1[_0xb8a5('0x13')](0xcc)[_0xb8a5('0x14')]();});}};}function handleEntityNotFound(_0x26b1e3,_0x2a47e7){return function(_0xb9b524){if(!_0xb9b524){_0x26b1e3[_0xb8a5('0x12')](0x194);}return _0xb9b524;};}function handleError(_0xe10667,_0x3aefe5){_0x3aefe5=_0x3aefe5||0x1f4;return function(_0x5e73bd){logger['error'](_0x5e73bd[_0xb8a5('0x1e')]);if(_0x5e73bd[_0xb8a5('0x1f')]){delete _0x5e73bd[_0xb8a5('0x1f')];}_0xe10667[_0xb8a5('0x13')](_0x3aefe5)[_0xb8a5('0x20')](_0x5e73bd);};}exports['index']=function(_0xaf5ba9,_0x4f8b03){var _0x18fe76={},_0x45aea9={},_0x5c21f2={'count':0x0,'rows':[]};var _0x4acfcf=_[_0xb8a5('0x21')](db['ScreenRecording'][_0xb8a5('0x22')],function(_0x2246ef){return{'name':_0x2246ef[_0xb8a5('0x23')],'type':_0x2246ef[_0xb8a5('0x24')][_0xb8a5('0x25')]};});_0x45aea9[_0xb8a5('0x26')]=_['differenceBy'](_[_0xb8a5('0x21')](_0x4acfcf,_0xb8a5('0x1f')),[_0xb8a5('0x27')]);_0x45aea9[_0xb8a5('0x28')]=_[_0xb8a5('0x29')](_0xaf5ba9[_0xb8a5('0x28')]);_0x45aea9[_0xb8a5('0x2a')]=_[_0xb8a5('0x2b')](_0x45aea9['model'],_0x45aea9[_0xb8a5('0x28')]);_0x18fe76['attributes']=_[_0xb8a5('0x2b')](_0x45aea9[_0xb8a5('0x26')],qs[_0xb8a5('0x2c')](_0xaf5ba9['query'][_0xb8a5('0x2c')]));_0x18fe76[_0xb8a5('0x2d')]=_0x18fe76[_0xb8a5('0x2d')]['length']?_0x18fe76['attributes']:_0x45aea9[_0xb8a5('0x26')];if(!_0xaf5ba9['query'][_0xb8a5('0x2e')](_0xb8a5('0x2f'))){_0x18fe76['limit']=qs[_0xb8a5('0x30')](_0xaf5ba9[_0xb8a5('0x28')]['limit']);_0x18fe76[_0xb8a5('0x17')]=qs[_0xb8a5('0x17')](_0xaf5ba9['query']['offset']);}_0x18fe76[_0xb8a5('0x31')]=qs[_0xb8a5('0x32')](_0xaf5ba9[_0xb8a5('0x28')][_0xb8a5('0x32')]);_0x18fe76[_0xb8a5('0x33')]=qs[_0xb8a5('0x2a')](_[_0xb8a5('0x34')](_0xaf5ba9['query'],_0x45aea9[_0xb8a5('0x2a')]),_0x4acfcf);if(_0xaf5ba9[_0xb8a5('0x28')][_0xb8a5('0x35')]){_0x18fe76[_0xb8a5('0x33')]=_[_0xb8a5('0x36')](_0x18fe76[_0xb8a5('0x33')],{'$or':_[_0xb8a5('0x21')](_0x4acfcf,function(_0x6d6809){if(_0x6d6809[_0xb8a5('0x24')]!==_0xb8a5('0x37')){var _0x6f8bc={};_0x6f8bc[_0x6d6809['name']]={'$like':'%'+_0xaf5ba9[_0xb8a5('0x28')]['filter']+'%'};return _0x6f8bc;}})});}_0x18fe76=_['merge']({},_0x18fe76,_0xaf5ba9[_0xb8a5('0x38')]);var _0x2e8341={'where':_0x18fe76[_0xb8a5('0x33')]};return db[_0xb8a5('0x39')][_0xb8a5('0x16')](_0x2e8341)['then'](function(_0x2b2220){_0x5c21f2[_0xb8a5('0x16')]=_0x2b2220;if(_0xaf5ba9['query'][_0xb8a5('0x3a')]){_0x18fe76['include']=[{'all':!![]}];}return db[_0xb8a5('0x39')][_0xb8a5('0x3b')](_0x18fe76);})[_0xb8a5('0x1d')](function(_0x22026b){_0x5c21f2[_0xb8a5('0x3c')]=_0x22026b;return _0x5c21f2;})['then'](respondWithFilteredResult(_0x4f8b03,_0x18fe76))[_0xb8a5('0x3d')](handleError(_0x4f8b03,null));};exports['show']=function(_0x2dee7f,_0x3676cd){var _0x3c0951={'raw':![],'where':{'id':_0x2dee7f[_0xb8a5('0x3e')]['id']}},_0x4884be={};_0x4884be['model']=_['keys'](db['ScreenRecording'][_0xb8a5('0x22')]);_0x4884be[_0xb8a5('0x28')]=_[_0xb8a5('0x29')](_0x2dee7f[_0xb8a5('0x28')]);_0x4884be[_0xb8a5('0x2a')]=_[_0xb8a5('0x2b')](_0x4884be[_0xb8a5('0x26')],_0x4884be[_0xb8a5('0x28')]);_0x3c0951['attributes']=_[_0xb8a5('0x2b')](_0x4884be['model'],qs['fields'](_0x2dee7f[_0xb8a5('0x28')]['fields']));_0x3c0951['attributes']=_0x3c0951[_0xb8a5('0x2d')][_0xb8a5('0x3f')]?_0x3c0951[_0xb8a5('0x2d')]:_0x4884be['model'];if(_0x2dee7f['query'][_0xb8a5('0x3a')]){_0x3c0951['include']=[{'all':!![]}];}_0x3c0951=_[_0xb8a5('0x36')]({},_0x3c0951,_0x2dee7f[_0xb8a5('0x38')]);return db[_0xb8a5('0x39')][_0xb8a5('0x40')](_0x3c0951)[_0xb8a5('0x1d')](handleEntityNotFound(_0x3676cd,null))[_0xb8a5('0x1d')](respondWithResult(_0x3676cd,null))[_0xb8a5('0x3d')](handleError(_0x3676cd,null));};exports[_0xb8a5('0x41')]=function(_0x5d2009,_0x2b86c2){return db['ScreenRecording']['create'](_0x5d2009[_0xb8a5('0x42')],{})[_0xb8a5('0x1d')](respondWithResult(_0x2b86c2,0xc9))[_0xb8a5('0x3d')](handleError(_0x2b86c2,null));};exports['update']=function(_0x413d9f,_0x5418e0){if(_0x413d9f[_0xb8a5('0x42')]['id']){delete _0x413d9f[_0xb8a5('0x42')]['id'];}delete _0x413d9f['body']['duration'];delete _0x413d9f[_0xb8a5('0x42')][_0xb8a5('0x43')];delete _0x413d9f[_0xb8a5('0x42')][_0xb8a5('0x44')];delete _0x413d9f[_0xb8a5('0x42')][_0xb8a5('0x45')];return db['ScreenRecording'][_0xb8a5('0x40')]({'where':{'id':_0x413d9f[_0xb8a5('0x3e')]['id']}})[_0xb8a5('0x1d')](handleEntityNotFound(_0x5418e0,null))[_0xb8a5('0x1d')](saveUpdates(_0x413d9f[_0xb8a5('0x42')],null))[_0xb8a5('0x1d')](respondWithResult(_0x5418e0,null))[_0xb8a5('0x3d')](handleError(_0x5418e0,null));};exports[_0xb8a5('0x46')]=function(_0x17a69e,_0x4f2b18){return db['ScreenRecording'][_0xb8a5('0x46')]()[_0xb8a5('0x1d')](respondWithResult(_0x4f2b18,null))[_0xb8a5('0x3d')](handleError(_0x4f2b18,null));};exports[_0xb8a5('0x47')]=function(_0x521a4b,_0x330482,_0x57be3d){var _0x5a3fa0=require(_0xb8a5('0x48'));var _0x2a9a69=![];var _0x1c9e36={};if(_0x521a4b[_0xb8a5('0x28')][_0xb8a5('0x24')]&&_0x521a4b[_0xb8a5('0x28')]['type']==='uniqueid'){_0x1c9e36['uniqueid']=_0x521a4b[_0xb8a5('0x3e')]['id'];}else{_0x1c9e36['id']=_0x521a4b[_0xb8a5('0x3e')]['id'];}return db['ScreenRecording'][_0xb8a5('0x40')]({'where':_0x1c9e36,'attributes':['id',_0xb8a5('0x45')],'raw':!![]})[_0xb8a5('0x1d')](handleEntityNotFound(_0x330482,null))[_0xb8a5('0x1d')](function(_0x5a8c8f){if(_0x5a8c8f){var _0x3624c3=path[_0xb8a5('0x49')](config[_0xb8a5('0x4a')],'server/files/screen_recordings',_0x5a8c8f['value']);var _0x106c6f=util[_0xb8a5('0x27')](_0xb8a5('0x4b'),_0x3624c3);if(fs[_0xb8a5('0x4c')](_0x106c6f)){_0x2a9a69=!![];return _0x5a3fa0[_0xb8a5('0x4d')](_0x106c6f,_0x3624c3,config[_0xb8a5('0x4e')][_0xb8a5('0x4f')])[_0xb8a5('0x1d')](function(){return _0x5a8c8f;});}return _0x5a8c8f;}})[_0xb8a5('0x1d')](function(_0x5c43bd){if(_0x5c43bd){var _0x3f9c28=path['join'](config[_0xb8a5('0x4a')],'server/files/screen_recordings',_0x5c43bd[_0xb8a5('0x45')]);if(!fs[_0xb8a5('0x4c')](_0x3f9c28)){throw new db[(_0xb8a5('0x50'))][(_0xb8a5('0x51'))](_0xb8a5('0x52'));}if(_0x5c43bd[_0xb8a5('0x53')]){return _0x330482[_0xb8a5('0x47')](_0x3f9c28,_0x5c43bd[_0xb8a5('0x53')]+path[_0xb8a5('0x54')](_0x3f9c28),function(){if(_0x2a9a69){fs[_0xb8a5('0x55')](_0x3f9c28);}});}else{return _0x330482[_0xb8a5('0x47')](_0x3f9c28,function(_0x1554f2){if(_0x2a9a69){fs[_0xb8a5('0x55')](_0x3f9c28);}});}}})[_0xb8a5('0x3d')](function(_0x5a97fe){if(_0x5a97fe['message']===_0xb8a5('0x52')){_0x330482[_0xb8a5('0x13')](0x194)[_0xb8a5('0x20')]('Not\x20found');}else{return handleError(_0x330482,null);}});};exports['destroy']=function(_0x1f417a,_0x28c09b){return db[_0xb8a5('0x39')][_0xb8a5('0x40')]({'where':{'id':_0x1f417a[_0xb8a5('0x3e')]['id']}})['then'](function(_0x490a26){if(!_0x490a26)throw new ReferenceError(_0xb8a5('0x56'));return _0x490a26;})[_0xb8a5('0x1d')](function(_0x289044){var _0x190de8=path[_0xb8a5('0x49')](config['root'],'server/files/screen_recordings',_0x289044[_0xb8a5('0x45')]);logger[_0xb8a5('0x57')](_0xb8a5('0x58'),_0x190de8);if(!_['isNil'](_0x289044[_0xb8a5('0x45')])&&fs[_0xb8a5('0x4c')](_0x190de8)){logger[_0xb8a5('0x57')](_0xb8a5('0x59')+_0x190de8+_0xb8a5('0x5a'));fs['unlinkSync'](_0x190de8);}_0x190de8=_0x190de8+_0xb8a5('0x5b');if(!_['isNil'](_0x289044[_0xb8a5('0x45')])&&fs['existsSync'](_0x190de8)){logger[_0xb8a5('0x57')](_0xb8a5('0x59')+_0x190de8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xb8a5('0x5c')](_0x190de8);}return _0x289044;})[_0xb8a5('0x1d')](function(_0x5d97e9){if(!_0x5d97e9)throw new InternalError();return _0x5d97e9[_0xb8a5('0x5d')]();})[_0xb8a5('0x1d')](function(){_0x28c09b[_0xb8a5('0x13')](0xcc)['end']();})[_0xb8a5('0x3d')](handleError(_0x28c09b,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 275c916..637959f 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 _0x42b5=['lodash','../../config/logger','moment','bluebird','path','rimraf','./screenRecording.attributes','ScreenRecording','interactionid'];(function(_0x44e0a4,_0x4dbc5a){var _0x16c53b=function(_0x460617){while(--_0x460617){_0x44e0a4['push'](_0x44e0a4['shift']());}};_0x16c53b(++_0x4dbc5a);}(_0x42b5,0x1c2));var _0x542b=function(_0x48e7f9,_0x498542){_0x48e7f9=_0x48e7f9-0x0;var _0x10f99e=_0x42b5[_0x48e7f9];return _0x10f99e;};'use strict';var _=require(_0x542b('0x0'));var util=require('util');var logger=require(_0x542b('0x1'))('api');var moment=require(_0x542b('0x2'));var BPromise=require(_0x542b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x542b('0x4'));var rimraf=require(_0x542b('0x5'));var config=require('../../config/environment');var attributes=require(_0x542b('0x6'));module['exports']=function(_0x51d7c5,_0x1fe66c){return _0x51d7c5['define'](_0x542b('0x7'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x542b('0x8'),'fields':[_0x542b('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3727=['api','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','util','../../config/logger'];(function(_0x1ef4ee,_0xd87a11){var _0xabf86f=function(_0x20a11a){while(--_0x20a11a){_0x1ef4ee['push'](_0x1ef4ee['shift']());}};_0xabf86f(++_0xd87a11);}(_0x3727,0x102));var _0x7372=function(_0x5449f7,_0x1074a9){_0x5449f7=_0x5449f7-0x0;var _0x4b7d17=_0x3727[_0x5449f7];return _0x4b7d17;};'use strict';var _=require('lodash');var util=require(_0x7372('0x0'));var logger=require(_0x7372('0x1'))(_0x7372('0x2'));var moment=require('moment');var BPromise=require(_0x7372('0x3'));var rp=require(_0x7372('0x4'));var fs=require('fs');var path=require(_0x7372('0x5'));var rimraf=require('rimraf');var config=require(_0x7372('0x6'));var attributes=require(_0x7372('0x7'));module[_0x7372('0x8')]=function(_0x22315c,_0x18e827){return _0x22315c[_0x7372('0x9')](_0x7372('0xa'),attributes,{'tableName':_0x7372('0xb'),'paranoid':![],'indexes':[{'name':_0x7372('0xc'),'fields':[_0x7372('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 81a9847..6a4e1d4 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(_0x22f214,_0x3fd7e7){var _0x315146=function(_0x4ee07f){while(--_0x4ee07f){_0x22f214['push'](_0x22f214['shift']());}};_0x315146(++_0x3fd7e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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(_0x79ef7b,_0x496416){var _0xd4d33=function(_0x2f97b3){while(--_0x2f97b3){_0x79ef7b['push'](_0x79ef7b['shift']());}};_0xd4d33(++_0x496416);}(_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);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 21575d6..8e348fd 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(_0x3f25b6,_0x27c453){var _0x1fe426=function(_0x1a8e93){while(--_0x1a8e93){_0x3f25b6['push'](_0x3f25b6['shift']());}};_0x1fe426(++_0x27c453);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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(_0x152ffe,_0x7e95d){var _0x35324c=function(_0x113208){while(--_0x113208){_0x152ffe['push'](_0x152ffe['shift']());}};_0x35324c(++_0x7e95d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 63a6d03..f37cf65 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 _0xe43a=['UNSIGNED','exports','INTEGER','min_mailbox','STRING','BOOLEAN','alternate'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xe43a,0x86));var _0xae43=function(_0x580ff7,_0x3a2698){_0x580ff7=_0x580ff7-0x0;var _0x50201c=_0xe43a[_0x580ff7];return _0x50201c;};'use strict';var Sequelize=require('sequelize');module[_0xae43('0x0')]={'min_internal':{'type':Sequelize[_0xae43('0x1')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0xae43('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xae43('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0xae43('0x3')]},'defaultLogo':{'type':Sequelize[_0xae43('0x4')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xae43('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0xae43('0x4')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xae43('0x4')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xae43('0x3')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xae43('0x3')]},'turnpassword':{'type':Sequelize[_0xae43('0x3')]},'pageTitle':{'type':Sequelize[_0xae43('0x3')]},'defaultPageTitle':{'type':Sequelize[_0xae43('0x4')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xae43('0x4')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xae43('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xae43('0x4')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xae43('0x3')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xae43('0x4')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xae43('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xae43('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xae43('0x3')],'defaultValue':_0xae43('0x5')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xae43('0x4')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xae43('0x3')]},'defaultPreferred':{'type':Sequelize[_0xae43('0x4')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xae43('0x4')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xae43('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0xae43('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xae43('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xae43('0x3')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xae43('0x4')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xae43('0x1')]},'transcribeRegion':{'type':Sequelize[_0xae43('0x3')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0xae43('0x3')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xae43('0x4')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xae43('0x1')](0x2)[_0xae43('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xae43('0x1')](0x2)[_0xae43('0x6')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xae43('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xae43('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xae43('0x4')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xae43('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xae43('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xae43('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xae43('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xae43('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xae43('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xe87d=['UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x35d1b4,_0x717559){var _0x273c5b=function(_0x4a7748){while(--_0x4a7748){_0x35d1b4['push'](_0x35d1b4['shift']());}};_0x273c5b(++_0x717559);}(_0xe87d,0x1de));var _0xde87=function(_0x2357c5,_0x2c75df){_0x2357c5=_0x2357c5-0x0;var _0x2605fc=_0xe87d[_0x2357c5];return _0x2605fc;};'use strict';var Sequelize=require(_0xde87('0x0'));module[_0xde87('0x1')]={'min_internal':{'type':Sequelize[_0xde87('0x2')](0xb),'unique':_0xde87('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xde87('0x2')](0xb),'unique':_0xde87('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xde87('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xde87('0x5')],'defaultValue':_0xde87('0x6')},'logo':{'type':Sequelize[_0xde87('0x5')]},'defaultLogo':{'type':Sequelize[_0xde87('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xde87('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xde87('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xde87('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xde87('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xde87('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xde87('0x5')]},'turnaddr':{'type':Sequelize[_0xde87('0x5')]},'turnusername':{'type':Sequelize[_0xde87('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xde87('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xde87('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xde87('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xde87('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xde87('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xde87('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xde87('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xde87('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0xde87('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xde87('0x5')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xde87('0x5')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xde87('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xde87('0x5')]},'defaultFavicon':{'type':Sequelize[_0xde87('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xde87('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xde87('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xde87('0x2')]},'transcribeRegion':{'type':Sequelize[_0xde87('0x5')]},'sentiment':{'type':Sequelize[_0xde87('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xde87('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xde87('0x2')]},'sentimentRegion':{'type':Sequelize[_0xde87('0x5')]},'language':{'type':Sequelize[_0xde87('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xde87('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0xde87('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xde87('0x2')](0x2)[_0xde87('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xde87('0x2')](0x2)[_0xde87('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xde87('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xde87('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xde87('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xde87('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xde87('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xde87('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index b7fa361..5aaeb1e 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 _0xc36d=['default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Setting,\x20%s,\x20%s','message','catch','sendStatus','end','status','offset','set','json','reject','destroy','stack','name','send','index','map','Setting','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','find','body','file','filename','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','default','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','custom','gdpr','securePassword','getPreferred','default_preferred.png','addFavicon','getFavicon'];(function(_0x38166d,_0x24be31){var _0x169263=function(_0x4a24bd){while(--_0x4a24bd){_0x38166d['push'](_0x38166d['shift']());}};_0x169263(++_0x24be31);}(_0xc36d,0x7d));var _0xdc36=function(_0x25280c,_0x2edec1){_0x25280c=_0x25280c-0x0;var _0x3a58c3=_0xc36d[_0x25280c];return _0x3a58c3;};'use strict';var emlformat=require(_0xdc36('0x0'));var rimraf=require(_0xdc36('0x1'));var zipdir=require(_0xdc36('0x2'));var jsonpatch=require(_0xdc36('0x3'));var rp=require(_0xdc36('0x4'));var moment=require(_0xdc36('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdc36('0x6'));var util=require(_0xdc36('0x7'));var path=require('path');var sox=require(_0xdc36('0x8'));var csv=require(_0xdc36('0x9'));var ejs=require(_0xdc36('0xa'));var fs=require('fs');var fs_extra=require(_0xdc36('0xb'));var _=require(_0xdc36('0xc'));var squel=require('squel');var crypto=require(_0xdc36('0xd'));var jsforce=require(_0xdc36('0xe'));var deskjs=require(_0xdc36('0xf'));var toCsv=require(_0xdc36('0x9'));var querystring=require('querystring');var Papa=require(_0xdc36('0x10'));var Redis=require(_0xdc36('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdc36('0x12'));var as=require(_0xdc36('0x13'));var hardwareService=require(_0xdc36('0x14'));var logger=require('../../config/logger')(_0xdc36('0x15'));var utils=require(_0xdc36('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdc36('0x17'))['db'];var jayson=require(_0xdc36('0x18'));var client=jayson[_0xdc36('0x19')][_0xdc36('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x522d33,_0x2b3f64,_0x3d36bc,_0x243d54){return new BPromise(function(_0xae6ad3,_0x30803d){var _0x25b900=_0x243d54||client;return _0x25b900[_0xdc36('0x1b')](_0x522d33,_0x3d36bc)[_0xdc36('0x1c')](function(_0x57ebde){logger[_0xdc36('0x1d')]('Setting,\x20%s,\x20%s',_0x2b3f64,'request\x20sent');logger['debug'](_0xdc36('0x1e'),_0x2b3f64,_0xdc36('0x1f'),JSON['stringify'](_0x57ebde));if(_0x57ebde[_0xdc36('0x20')]){if(_0x57ebde[_0xdc36('0x20')][_0xdc36('0x21')]===0x1f4){logger[_0xdc36('0x20')](_0xdc36('0x22'),_0x2b3f64,_0x57ebde[_0xdc36('0x20')]['message']);return _0x30803d(_0x57ebde[_0xdc36('0x20')][_0xdc36('0x23')]);}logger['error'](_0xdc36('0x22'),_0x2b3f64,_0x57ebde[_0xdc36('0x20')][_0xdc36('0x23')]);return _0xae6ad3(_0x57ebde['error'][_0xdc36('0x23')]);}else{logger[_0xdc36('0x1d')]('Setting,\x20%s,\x20%s',_0x2b3f64,_0xdc36('0x1f'));_0xae6ad3(_0x57ebde['result']['message']);}})[_0xdc36('0x24')](function(_0x2b39a2){logger[_0xdc36('0x20')](_0xdc36('0x22'),_0x2b3f64,_0x2b39a2);_0x30803d(_0x2b39a2);});});}function respondWithStatusCode(_0x2d83c0,_0x34d261){_0x34d261=_0x34d261||0xcc;return function(_0x14b595){if(_0x14b595){return _0x2d83c0[_0xdc36('0x25')](_0x34d261);}return _0x2d83c0['status'](_0x34d261)[_0xdc36('0x26')]();};}function respondWithResult(_0x4ea580,_0x2338d7){_0x2338d7=_0x2338d7||0xc8;return function(_0x38bd73){if(_0x38bd73){return _0x4ea580[_0xdc36('0x27')](_0x2338d7)['json'](_0x38bd73);}};}function respondWithFilteredResult(_0xbc4322,_0x6e3906){return function(_0x337091){if(_0x337091){var _0x525935=_0x337091['count'],_0x28a005=_0x6e3906[_0xdc36('0x28')],_0x2f3b6a=_0x6e3906[_0xdc36('0x28')]+_0x6e3906['limit'],_0x2a596d;if(_0x2f3b6a>=_0x525935){_0x2f3b6a=_0x525935;_0x2a596d=0xc8;}else{_0x2a596d=0xce;}_0xbc4322[_0xdc36('0x27')](_0x2a596d);return _0xbc4322[_0xdc36('0x29')]('Content-Range',_0x28a005+'-'+_0x2f3b6a+'/'+_0x525935)[_0xdc36('0x2a')](_0x337091);}return null;};}function patchUpdates(_0x5bba0b){return function(_0x49bbf2){try{jsonpatch['apply'](_0x49bbf2,_0x5bba0b,!![]);}catch(_0x3b0839){return BPromise[_0xdc36('0x2b')](_0x3b0839);}return _0x49bbf2['save']();};}function saveUpdates(_0x13bf82,_0x983eab){return function(_0x336447){if(_0x336447){return _0x336447['update'](_0x13bf82)[_0xdc36('0x1c')](function(_0xcfff77){return _0xcfff77;});}return null;};}function removeEntity(_0x1d010c,_0x15df5e){return function(_0x1758a0){if(_0x1758a0){return _0x1758a0[_0xdc36('0x2c')]()[_0xdc36('0x1c')](function(){_0x1d010c['status'](0xcc)[_0xdc36('0x26')]();});}};}function handleEntityNotFound(_0x2434ec,_0x4b90dc){return function(_0x53edce){if(!_0x53edce){_0x2434ec[_0xdc36('0x25')](0x194);}return _0x53edce;};}function handleError(_0x1ad342,_0x44bb45){_0x44bb45=_0x44bb45||0x1f4;return function(_0x58a899){logger['error'](_0x58a899[_0xdc36('0x2d')]);if(_0x58a899[_0xdc36('0x2e')]){delete _0x58a899[_0xdc36('0x2e')];}_0x1ad342[_0xdc36('0x27')](_0x44bb45)[_0xdc36('0x2f')](_0x58a899);};}exports[_0xdc36('0x30')]=function(_0xf80dc3,_0x16303c){var _0x734ad6={},_0x368c75={},_0x3fa358={'count':0x0,'rows':[]};var _0x599ef8=_[_0xdc36('0x31')](db[_0xdc36('0x32')][_0xdc36('0x33')],function(_0x413a00){return{'name':_0x413a00['fieldName'],'type':_0x413a00[_0xdc36('0x34')][_0xdc36('0x35')]};});_0x368c75[_0xdc36('0x36')]=_[_0xdc36('0x31')](_0x599ef8,'name');_0x368c75[_0xdc36('0x37')]=_['keys'](_0xf80dc3['query']);_0x368c75[_0xdc36('0x38')]=_[_0xdc36('0x39')](_0x368c75[_0xdc36('0x36')],_0x368c75['query']);_0x734ad6[_0xdc36('0x3a')]=_['intersection'](_0x368c75[_0xdc36('0x36')],qs[_0xdc36('0x3b')](_0xf80dc3[_0xdc36('0x37')]['fields']));_0x734ad6[_0xdc36('0x3a')]=_0x734ad6[_0xdc36('0x3a')][_0xdc36('0x3c')]?_0x734ad6[_0xdc36('0x3a')]:_0x368c75['model'];if(!_0xf80dc3[_0xdc36('0x37')][_0xdc36('0x3d')](_0xdc36('0x3e'))){_0x734ad6['limit']=qs['limit'](_0xf80dc3[_0xdc36('0x37')][_0xdc36('0x3f')]);_0x734ad6['offset']=qs['offset'](_0xf80dc3[_0xdc36('0x37')][_0xdc36('0x28')]);}_0x734ad6[_0xdc36('0x40')]=qs[_0xdc36('0x41')](_0xf80dc3[_0xdc36('0x37')][_0xdc36('0x41')]);_0x734ad6[_0xdc36('0x42')]=qs[_0xdc36('0x38')](_[_0xdc36('0x43')](_0xf80dc3[_0xdc36('0x37')],_0x368c75[_0xdc36('0x38')]),_0x599ef8);if(_0xf80dc3[_0xdc36('0x37')][_0xdc36('0x44')]){_0x734ad6[_0xdc36('0x42')]=_[_0xdc36('0x45')](_0x734ad6[_0xdc36('0x42')],{'$or':_[_0xdc36('0x31')](_0x599ef8,function(_0x16dcb7){if(_0x16dcb7[_0xdc36('0x34')]!==_0xdc36('0x46')){var _0x4d0acd={};_0x4d0acd[_0x16dcb7[_0xdc36('0x2e')]]={'$like':'%'+_0xf80dc3[_0xdc36('0x37')][_0xdc36('0x44')]+'%'};return _0x4d0acd;}})});}_0x734ad6=_[_0xdc36('0x45')]({},_0x734ad6,_0xf80dc3[_0xdc36('0x47')]);var _0x557375={'where':_0x734ad6[_0xdc36('0x42')]};return db[_0xdc36('0x32')]['count'](_0x557375)['then'](function(_0x3508c8){_0x3fa358['count']=_0x3508c8;if(_0xf80dc3[_0xdc36('0x37')]['includeAll']){_0x734ad6[_0xdc36('0x48')]=[{'all':!![]}];}return db[_0xdc36('0x32')][_0xdc36('0x49')](_0x734ad6);})[_0xdc36('0x1c')](function(_0x34af88){_0x3fa358[_0xdc36('0x4a')]=_0x34af88;return _0x3fa358;})[_0xdc36('0x1c')](respondWithFilteredResult(_0x16303c,_0x734ad6))[_0xdc36('0x24')](handleError(_0x16303c,null));};exports[_0xdc36('0x4b')]=function(_0x38c24b,_0x3c27c7){var _0xd3e651={'raw':![],'where':{'id':_0x38c24b[_0xdc36('0x4c')]['id']}},_0x5cd3d5={};_0x5cd3d5[_0xdc36('0x36')]=_[_0xdc36('0x4d')](db[_0xdc36('0x32')][_0xdc36('0x33')]);_0x5cd3d5['query']=_['keys'](_0x38c24b[_0xdc36('0x37')]);_0x5cd3d5[_0xdc36('0x38')]=_[_0xdc36('0x39')](_0x5cd3d5[_0xdc36('0x36')],_0x5cd3d5[_0xdc36('0x37')]);_0xd3e651[_0xdc36('0x3a')]=_['intersection'](_0x5cd3d5[_0xdc36('0x36')],qs[_0xdc36('0x3b')](_0x38c24b[_0xdc36('0x37')]['fields']));_0xd3e651[_0xdc36('0x3a')]=_0xd3e651[_0xdc36('0x3a')][_0xdc36('0x3c')]?_0xd3e651[_0xdc36('0x3a')]:_0x5cd3d5[_0xdc36('0x36')];if(_0x38c24b[_0xdc36('0x37')]['includeAll']){_0xd3e651[_0xdc36('0x48')]=[{'all':!![]}];}_0xd3e651=_[_0xdc36('0x45')]({},_0xd3e651,_0x38c24b[_0xdc36('0x47')]);return db[_0xdc36('0x32')][_0xdc36('0x4e')](_0xd3e651)[_0xdc36('0x1c')](handleEntityNotFound(_0x3c27c7,null))[_0xdc36('0x1c')](respondWithResult(_0x3c27c7,null))[_0xdc36('0x24')](handleError(_0x3c27c7,null));};exports['update']=function(_0x3b3aaa,_0x5bdc6){if(_0x3b3aaa[_0xdc36('0x4f')]['id']){delete _0x3b3aaa[_0xdc36('0x4f')]['id'];}return db[_0xdc36('0x32')][_0xdc36('0x4e')]({'where':{'id':_0x3b3aaa[_0xdc36('0x4c')]['id']}})[_0xdc36('0x1c')](handleEntityNotFound(_0x5bdc6,null))['then'](saveUpdates(_0x3b3aaa['body'],null))[_0xdc36('0x1c')](respondWithResult(_0x5bdc6,null))[_0xdc36('0x24')](handleError(_0x5bdc6,null));};exports['addLogo']=function(_0x2eace0,_0xd8af57,_0x502033){if(_0x2eace0['file']&&_0x2eace0[_0xdc36('0x50')]['filename']){_0x2eace0[_0xdc36('0x4f')]['logo']=_0x2eace0[_0xdc36('0x50')]['filename'];}return db['Setting'][_0xdc36('0x4e')]({'where':{'id':_0x2eace0['params']['id']}})[_0xdc36('0x1c')](handleEntityNotFound(_0xd8af57,null))[_0xdc36('0x1c')](saveUpdates(_0x2eace0[_0xdc36('0x4f')],null))[_0xdc36('0x1c')](respondWithResult(_0xd8af57,null))[_0xdc36('0x24')](handleError(_0xd8af57,null));};exports['addLogoLogin']=function(_0xf47d2a,_0x379a72,_0x42d0a6){if(_0xf47d2a['file']&&_0xf47d2a['file'][_0xdc36('0x51')]){_0xf47d2a['body'][_0xdc36('0x52')]=_0xf47d2a[_0xdc36('0x50')][_0xdc36('0x51')];}return db[_0xdc36('0x32')]['find']({'where':{'id':_0xf47d2a['params']['id']}})[_0xdc36('0x1c')](handleEntityNotFound(_0x379a72,null))[_0xdc36('0x1c')](saveUpdates(_0xf47d2a[_0xdc36('0x4f')],null))[_0xdc36('0x1c')](respondWithResult(_0x379a72,null))[_0xdc36('0x24')](handleError(_0x379a72,null));};var utilLicense=require(_0xdc36('0x53'));exports[_0xdc36('0x54')]=function(_0x178a28,_0x59318f,_0x119375){var _0x5a59f9=_0xdc36('0x55');var _0x4ea344={'custom':![]};return utilLicense[_0xdc36('0x56')]()[_0xdc36('0x1c')](function(_0x63528){if(_0x63528){_0x4ea344=_0x63528;}return db[_0xdc36('0x32')][_0xdc36('0x4e')]({'where':{'id':_0x178a28[_0xdc36('0x4c')]['id']},'attributes':[_0xdc36('0x57'),_0xdc36('0x52'),_0xdc36('0x58'),_0xdc36('0x59'),_0xdc36('0x5a'),_0xdc36('0x5b'),_0xdc36('0x5c'),_0xdc36('0x5d')],'raw':!![]});})[_0xdc36('0x1c')](handleEntityNotFound(_0x59318f,null))[_0xdc36('0x1c')](function(_0x43e23e){if(_0x43e23e){var _0x1994c6=_0x43e23e[_0xdc36('0x57')]&&fs[_0xdc36('0x5e')](path['join'](config[_0xdc36('0x5f')],_0x5a59f9,_[_0xdc36('0x60')](_0x43e23e[_0xdc36('0x57')])))?path[_0xdc36('0x61')](config[_0xdc36('0x5f')],_0x5a59f9,_[_0xdc36('0x60')](_0x43e23e['logo'])):path[_0xdc36('0x61')](config[_0xdc36('0x5f')],_0x5a59f9,_['toLower']('default_logo.svg'));var _0x267d62=_0xdc36('0x62')+_[_0xdc36('0x63')]('logo');if(_0x43e23e[_0x267d62]||!_0x4ea344['custom']){_0x1994c6=path[_0xdc36('0x61')](config[_0xdc36('0x5f')],_0x5a59f9,_['toLower']('default_logo.svg'));}if(!fs[_0xdc36('0x5e')](_0x1994c6)){throw new db[(_0xdc36('0x64'))][(_0xdc36('0x65'))](_[_0xdc36('0x63')](_0xdc36('0x57'))+_0xdc36('0x66'));}return _0x59318f[_0xdc36('0x67')](_0x1994c6);}})[_0xdc36('0x24')](handleError(_0x59318f,null));};var utilLicense=require('../../config/license/util');exports[_0xdc36('0x68')]=function(_0x5ef6db,_0x4b353d,_0x5a3c01){var _0x150515=_0xdc36('0x55');var _0x17aabd={'custom':![]};return utilLicense[_0xdc36('0x56')]()['then'](function(_0x1592d0){if(_0x1592d0){_0x17aabd=_0x1592d0;}return db[_0xdc36('0x32')][_0xdc36('0x4e')]({'where':{'id':_0x5ef6db[_0xdc36('0x4c')]['id']},'attributes':[_0xdc36('0x57'),'loginLogo','preferred','favicon','defaultLogo',_0xdc36('0x5b'),_0xdc36('0x5c'),_0xdc36('0x5d')],'raw':!![]});})[_0xdc36('0x1c')](handleEntityNotFound(_0x4b353d,null))[_0xdc36('0x1c')](function(_0x1badc9){if(_0x1badc9){var _0x182bce=_0x1badc9[_0xdc36('0x52')]&&fs[_0xdc36('0x5e')](path['join'](config[_0xdc36('0x5f')],_0x150515,_[_0xdc36('0x60')](_0x1badc9['loginLogo'])))?path['join'](config[_0xdc36('0x5f')],_0x150515,_['toLower'](_0x1badc9[_0xdc36('0x52')])):path['join'](config[_0xdc36('0x5f')],_0x150515,_[_0xdc36('0x60')](_0xdc36('0x69')));var _0x56931b='default'+_['upperFirst'](_0xdc36('0x52'));if(_0x1badc9[_0x56931b]||!_0x17aabd[_0xdc36('0x6a')]){_0x182bce=path[_0xdc36('0x61')](config[_0xdc36('0x5f')],_0x150515,_[_0xdc36('0x60')]('default_loginLogo.svg'));}if(!fs[_0xdc36('0x5e')](_0x182bce)){throw new db[(_0xdc36('0x64'))][(_0xdc36('0x65'))](_['upperFirst']('loginLogo')+_0xdc36('0x66'));}return _0x4b353d[_0xdc36('0x67')](_0x182bce);}})[_0xdc36('0x24')](handleError(_0x4b353d,null));};exports[_0xdc36('0x6b')]=function(_0x767d7e,_0x2f3946){return db[_0xdc36('0x32')][_0xdc36('0x4e')]({'where':{'id':_0x767d7e[_0xdc36('0x4c')]['id']},'attributes':[_0xdc36('0x6c')]})['then'](respondWithResult(_0x2f3946,null))['catch'](handleError(_0x2f3946,null));};exports['addPreferred']=function(_0x4f0bc1,_0x1baa96,_0x329b49){if(_0x4f0bc1[_0xdc36('0x50')]&&_0x4f0bc1['file'][_0xdc36('0x51')]){_0x4f0bc1[_0xdc36('0x4f')][_0xdc36('0x58')]=_0x4f0bc1[_0xdc36('0x50')]['filename'];}return db[_0xdc36('0x32')][_0xdc36('0x4e')]({'where':{'id':_0x4f0bc1[_0xdc36('0x4c')]['id']}})[_0xdc36('0x1c')](handleEntityNotFound(_0x1baa96,null))[_0xdc36('0x1c')](saveUpdates(_0x4f0bc1[_0xdc36('0x4f')],null))[_0xdc36('0x1c')](respondWithResult(_0x1baa96,null))[_0xdc36('0x24')](handleError(_0x1baa96,null));};var utilLicense=require(_0xdc36('0x53'));exports[_0xdc36('0x6d')]=function(_0x1097e0,_0x43dd88,_0x4b244a){var _0x368ba3=_0xdc36('0x55');var _0x1acf5b={'custom':![]};return utilLicense[_0xdc36('0x56')]()[_0xdc36('0x1c')](function(_0x58cd17){if(_0x58cd17){_0x1acf5b=_0x58cd17;}return db[_0xdc36('0x32')][_0xdc36('0x4e')]({'where':{'id':_0x1097e0['params']['id']},'attributes':[_0xdc36('0x57'),_0xdc36('0x52'),_0xdc36('0x58'),'favicon',_0xdc36('0x5a'),_0xdc36('0x5b'),_0xdc36('0x5c'),_0xdc36('0x5d')],'raw':!![]});})[_0xdc36('0x1c')](handleEntityNotFound(_0x43dd88,null))[_0xdc36('0x1c')](function(_0x365f42){if(_0x365f42){var _0x202cac=_0x365f42['preferred']&&fs[_0xdc36('0x5e')](path['join'](config[_0xdc36('0x5f')],_0x368ba3,_[_0xdc36('0x60')](_0x365f42[_0xdc36('0x58')])))?path[_0xdc36('0x61')](config[_0xdc36('0x5f')],_0x368ba3,_[_0xdc36('0x60')](_0x365f42[_0xdc36('0x58')])):path['join'](config[_0xdc36('0x5f')],_0x368ba3,_[_0xdc36('0x60')](_0xdc36('0x6e')));var _0x33660a='default'+_[_0xdc36('0x63')](_0xdc36('0x58'));if(_0x365f42[_0x33660a]||!_0x1acf5b[_0xdc36('0x6a')]||!_0x1acf5b[_0xdc36('0x58')]){_0x202cac=path[_0xdc36('0x61')](config['root'],_0x368ba3,_['toLower'](_0xdc36('0x6e')));}if(!fs[_0xdc36('0x5e')](_0x202cac)){throw new db['Sequelize'][(_0xdc36('0x65'))](_[_0xdc36('0x63')](_0xdc36('0x58'))+_0xdc36('0x66'));}return _0x43dd88[_0xdc36('0x67')](_0x202cac);}})['catch'](handleError(_0x43dd88,null));};exports[_0xdc36('0x6f')]=function(_0xb72679,_0x564eb0,_0x29edce){if(_0xb72679[_0xdc36('0x50')]&&_0xb72679[_0xdc36('0x50')][_0xdc36('0x51')]){_0xb72679[_0xdc36('0x4f')][_0xdc36('0x59')]=_0xb72679[_0xdc36('0x50')]['filename'];}return db[_0xdc36('0x32')][_0xdc36('0x4e')]({'where':{'id':_0xb72679[_0xdc36('0x4c')]['id']}})[_0xdc36('0x1c')](handleEntityNotFound(_0x564eb0,null))[_0xdc36('0x1c')](saveUpdates(_0xb72679['body'],null))[_0xdc36('0x1c')](respondWithResult(_0x564eb0,null))[_0xdc36('0x24')](handleError(_0x564eb0,null));};var utilLicense=require('../../config/license/util');exports[_0xdc36('0x70')]=function(_0xeaa10b,_0x446dff,_0x3f9450){var _0x4a0cde=_0xdc36('0x55');var _0x5b3499={'custom':![]};return utilLicense[_0xdc36('0x56')]()[_0xdc36('0x1c')](function(_0x3b59e5){if(_0x3b59e5){_0x5b3499=_0x3b59e5;}return db[_0xdc36('0x32')][_0xdc36('0x4e')]({'where':{'id':_0xeaa10b[_0xdc36('0x4c')]['id']},'attributes':[_0xdc36('0x57'),'loginLogo',_0xdc36('0x58'),_0xdc36('0x59'),_0xdc36('0x5a'),_0xdc36('0x5b'),_0xdc36('0x5c'),'defaultFavicon'],'raw':!![]});})[_0xdc36('0x1c')](handleEntityNotFound(_0x446dff,null))[_0xdc36('0x1c')](function(_0x11e301){if(_0x11e301){var _0x9e10cd=_0x11e301[_0xdc36('0x59')]&&fs[_0xdc36('0x5e')](path[_0xdc36('0x61')](config[_0xdc36('0x5f')],_0x4a0cde,_[_0xdc36('0x60')](_0x11e301[_0xdc36('0x59')])))?path[_0xdc36('0x61')](config['root'],_0x4a0cde,_['toLower'](_0x11e301[_0xdc36('0x59')])):path[_0xdc36('0x61')](config[_0xdc36('0x5f')],_0x4a0cde,_[_0xdc36('0x60')](_0xdc36('0x71')));var _0x4d27e9=_0xdc36('0x62')+_['upperFirst'](_0xdc36('0x59'));if(_0x11e301[_0x4d27e9]||!_0x5b3499[_0xdc36('0x6a')]){_0x9e10cd=path[_0xdc36('0x61')](config['root'],_0x4a0cde,_[_0xdc36('0x60')](_0xdc36('0x71')));}if(!fs[_0xdc36('0x5e')](_0x9e10cd)){throw new db[(_0xdc36('0x64'))][(_0xdc36('0x65'))](_[_0xdc36('0x63')](_0xdc36('0x59'))+_0xdc36('0x66'));}return _0x446dff['download'](_0x9e10cd);}})[_0xdc36('0x24')](handleError(_0x446dff,null));};exports[_0xdc36('0x72')]=function(_0x2d19da,_0x298cb2){var _0x57c9ad={'offset':moment()[_0xdc36('0x73')]()};_0x57c9ad[_0xdc36('0x74')]=moment()['utcOffset'](_0x57c9ad['offset'])[_0xdc36('0x75')](_0xdc36('0x76'));return _0x298cb2[_0xdc36('0x27')](0xc8)['send'](_0x57c9ad);}; \ No newline at end of file +var _0xfbac=['securePassword','getPreferred','defaultFavicon','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','send','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','end','status','count','offset','limit','set','Content-Range','save','update','stack','name','index','Setting','rawAttributes','fieldName','type','map','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','body','addLogo','file','filename','logo','loginLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','root','toLower','default','upperFirst','custom','Sequelize','ValidationError','getLogoLogin','getLicense','join','default_loginLogo.svg','\x20not\x20found','download','gdpr'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0xfbac,0x167));var _0xcfba=function(_0x5ea64f,_0x573e71){_0x5ea64f=_0x5ea64f-0x0;var _0xc9ebaf=_0xfbac[_0x5ea64f];return _0xc9ebaf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcfba('0x0'));var zipdir=require(_0xcfba('0x1'));var jsonpatch=require(_0xcfba('0x2'));var rp=require(_0xcfba('0x3'));var moment=require(_0xcfba('0x4'));var BPromise=require(_0xcfba('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcfba('0x6'));var sox=require(_0xcfba('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcfba('0x8'));var _=require('lodash');var squel=require(_0xcfba('0x9'));var crypto=require('crypto');var jsforce=require(_0xcfba('0xa'));var deskjs=require(_0xcfba('0xb'));var toCsv=require('to-csv');var querystring=require(_0xcfba('0xc'));var Papa=require(_0xcfba('0xd'));var Redis=require(_0xcfba('0xe'));var authService=require(_0xcfba('0xf'));var qs=require(_0xcfba('0x10'));var as=require(_0xcfba('0x11'));var hardwareService=require(_0xcfba('0x12'));var logger=require(_0xcfba('0x13'))(_0xcfba('0x14'));var utils=require(_0xcfba('0x15'));var config=require(_0xcfba('0x16'));var licenseUtil=require(_0xcfba('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xcfba('0x18')][_0xcfba('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4c2ae0,_0x42691d,_0xf4a1db,_0x335bfd){return new BPromise(function(_0x226e89,_0x2333ee){var _0x2db67a=_0x335bfd||client;return _0x2db67a[_0xcfba('0x1a')](_0x4c2ae0,_0xf4a1db)[_0xcfba('0x1b')](function(_0x2f497b){logger[_0xcfba('0x1c')](_0xcfba('0x1d'),_0x42691d,_0xcfba('0x1e'));logger[_0xcfba('0x1f')]('Setting,\x20%s,\x20%s,\x20%s',_0x42691d,_0xcfba('0x1e'),JSON[_0xcfba('0x20')](_0x2f497b));if(_0x2f497b[_0xcfba('0x21')]){if(_0x2f497b[_0xcfba('0x21')][_0xcfba('0x22')]===0x1f4){logger[_0xcfba('0x21')](_0xcfba('0x1d'),_0x42691d,_0x2f497b['error'][_0xcfba('0x23')]);return _0x2333ee(_0x2f497b[_0xcfba('0x21')][_0xcfba('0x23')]);}logger['error']('Setting,\x20%s,\x20%s',_0x42691d,_0x2f497b[_0xcfba('0x21')][_0xcfba('0x23')]);return _0x226e89(_0x2f497b[_0xcfba('0x21')][_0xcfba('0x23')]);}else{logger[_0xcfba('0x1c')](_0xcfba('0x1d'),_0x42691d,'request\x20sent');_0x226e89(_0x2f497b[_0xcfba('0x24')]['message']);}})[_0xcfba('0x25')](function(_0x1e187f){logger['error'](_0xcfba('0x1d'),_0x42691d,_0x1e187f);_0x2333ee(_0x1e187f);});});}function respondWithStatusCode(_0x42cf58,_0x14850f){_0x14850f=_0x14850f||0xcc;return function(_0x3fb061){if(_0x3fb061){return _0x42cf58['sendStatus'](_0x14850f);}return _0x42cf58['status'](_0x14850f)[_0xcfba('0x26')]();};}function respondWithResult(_0x119c6e,_0x200a77){_0x200a77=_0x200a77||0xc8;return function(_0x4c9098){if(_0x4c9098){return _0x119c6e[_0xcfba('0x27')](_0x200a77)['json'](_0x4c9098);}};}function respondWithFilteredResult(_0x3eb614,_0x5e79c7){return function(_0x4ee825){if(_0x4ee825){var _0xf2e3d5=_0x4ee825[_0xcfba('0x28')],_0x11f949=_0x5e79c7[_0xcfba('0x29')],_0x5a13ae=_0x5e79c7[_0xcfba('0x29')]+_0x5e79c7[_0xcfba('0x2a')],_0x2f7ac0;if(_0x5a13ae>=_0xf2e3d5){_0x5a13ae=_0xf2e3d5;_0x2f7ac0=0xc8;}else{_0x2f7ac0=0xce;}_0x3eb614[_0xcfba('0x27')](_0x2f7ac0);return _0x3eb614[_0xcfba('0x2b')](_0xcfba('0x2c'),_0x11f949+'-'+_0x5a13ae+'/'+_0xf2e3d5)['json'](_0x4ee825);}return null;};}function patchUpdates(_0x7c7d76){return function(_0x4aa981){try{jsonpatch['apply'](_0x4aa981,_0x7c7d76,!![]);}catch(_0x101749){return BPromise['reject'](_0x101749);}return _0x4aa981[_0xcfba('0x2d')]();};}function saveUpdates(_0x57e1c1,_0x22cb04){return function(_0x192d59){if(_0x192d59){return _0x192d59[_0xcfba('0x2e')](_0x57e1c1)[_0xcfba('0x1b')](function(_0x391e6d){return _0x391e6d;});}return null;};}function removeEntity(_0x1aaf34,_0x1a0a80){return function(_0x36ab05){if(_0x36ab05){return _0x36ab05['destroy']()['then'](function(){_0x1aaf34['status'](0xcc)[_0xcfba('0x26')]();});}};}function handleEntityNotFound(_0x1d9bef,_0x4e38f4){return function(_0x34f60b){if(!_0x34f60b){_0x1d9bef['sendStatus'](0x194);}return _0x34f60b;};}function handleError(_0x3a3366,_0x8c2f4){_0x8c2f4=_0x8c2f4||0x1f4;return function(_0x463a98){logger[_0xcfba('0x21')](_0x463a98[_0xcfba('0x2f')]);if(_0x463a98[_0xcfba('0x30')]){delete _0x463a98[_0xcfba('0x30')];}_0x3a3366[_0xcfba('0x27')](_0x8c2f4)['send'](_0x463a98);};}exports[_0xcfba('0x31')]=function(_0x1d23ea,_0x2d0085){var _0x3abf9d={},_0x77d6c={},_0x356f72={'count':0x0,'rows':[]};var _0x564e0a=_['map'](db[_0xcfba('0x32')][_0xcfba('0x33')],function(_0x3d713c){return{'name':_0x3d713c[_0xcfba('0x34')],'type':_0x3d713c[_0xcfba('0x35')]['key']};});_0x77d6c['model']=_[_0xcfba('0x36')](_0x564e0a,_0xcfba('0x30'));_0x77d6c[_0xcfba('0x37')]=_[_0xcfba('0x38')](_0x1d23ea['query']);_0x77d6c[_0xcfba('0x39')]=_[_0xcfba('0x3a')](_0x77d6c['model'],_0x77d6c['query']);_0x3abf9d[_0xcfba('0x3b')]=_[_0xcfba('0x3a')](_0x77d6c[_0xcfba('0x3c')],qs[_0xcfba('0x3d')](_0x1d23ea[_0xcfba('0x37')][_0xcfba('0x3d')]));_0x3abf9d[_0xcfba('0x3b')]=_0x3abf9d['attributes'][_0xcfba('0x3e')]?_0x3abf9d[_0xcfba('0x3b')]:_0x77d6c['model'];if(!_0x1d23ea[_0xcfba('0x37')]['hasOwnProperty'](_0xcfba('0x3f'))){_0x3abf9d['limit']=qs[_0xcfba('0x2a')](_0x1d23ea[_0xcfba('0x37')][_0xcfba('0x2a')]);_0x3abf9d[_0xcfba('0x29')]=qs[_0xcfba('0x29')](_0x1d23ea[_0xcfba('0x37')]['offset']);}_0x3abf9d[_0xcfba('0x40')]=qs['sort'](_0x1d23ea['query'][_0xcfba('0x41')]);_0x3abf9d[_0xcfba('0x42')]=qs[_0xcfba('0x39')](_[_0xcfba('0x43')](_0x1d23ea[_0xcfba('0x37')],_0x77d6c[_0xcfba('0x39')]),_0x564e0a);if(_0x1d23ea['query']['filter']){_0x3abf9d['where']=_[_0xcfba('0x44')](_0x3abf9d[_0xcfba('0x42')],{'$or':_[_0xcfba('0x36')](_0x564e0a,function(_0x2567e2){if(_0x2567e2[_0xcfba('0x35')]!==_0xcfba('0x45')){var _0x3fd89b={};_0x3fd89b[_0x2567e2[_0xcfba('0x30')]]={'$like':'%'+_0x1d23ea[_0xcfba('0x37')]['filter']+'%'};return _0x3fd89b;}})});}_0x3abf9d=_[_0xcfba('0x44')]({},_0x3abf9d,_0x1d23ea[_0xcfba('0x46')]);var _0xd2a387={'where':_0x3abf9d[_0xcfba('0x42')]};return db[_0xcfba('0x32')][_0xcfba('0x28')](_0xd2a387)[_0xcfba('0x1b')](function(_0x5a82fe){_0x356f72[_0xcfba('0x28')]=_0x5a82fe;if(_0x1d23ea[_0xcfba('0x37')][_0xcfba('0x47')]){_0x3abf9d[_0xcfba('0x48')]=[{'all':!![]}];}return db['Setting'][_0xcfba('0x49')](_0x3abf9d);})[_0xcfba('0x1b')](function(_0x3090d2){_0x356f72[_0xcfba('0x4a')]=_0x3090d2;return _0x356f72;})[_0xcfba('0x1b')](respondWithFilteredResult(_0x2d0085,_0x3abf9d))[_0xcfba('0x25')](handleError(_0x2d0085,null));};exports[_0xcfba('0x4b')]=function(_0x4b5e81,_0x4a48e0){var _0x11ad05={'raw':![],'where':{'id':_0x4b5e81[_0xcfba('0x4c')]['id']}},_0x10ad7f={};_0x10ad7f[_0xcfba('0x3c')]=_[_0xcfba('0x38')](db[_0xcfba('0x32')]['rawAttributes']);_0x10ad7f['query']=_['keys'](_0x4b5e81[_0xcfba('0x37')]);_0x10ad7f['filters']=_[_0xcfba('0x3a')](_0x10ad7f[_0xcfba('0x3c')],_0x10ad7f[_0xcfba('0x37')]);_0x11ad05[_0xcfba('0x3b')]=_['intersection'](_0x10ad7f['model'],qs[_0xcfba('0x3d')](_0x4b5e81[_0xcfba('0x37')][_0xcfba('0x3d')]));_0x11ad05[_0xcfba('0x3b')]=_0x11ad05[_0xcfba('0x3b')][_0xcfba('0x3e')]?_0x11ad05[_0xcfba('0x3b')]:_0x10ad7f[_0xcfba('0x3c')];if(_0x4b5e81['query']['includeAll']){_0x11ad05[_0xcfba('0x48')]=[{'all':!![]}];}_0x11ad05=_[_0xcfba('0x44')]({},_0x11ad05,_0x4b5e81[_0xcfba('0x46')]);return db[_0xcfba('0x32')][_0xcfba('0x4d')](_0x11ad05)[_0xcfba('0x1b')](handleEntityNotFound(_0x4a48e0,null))[_0xcfba('0x1b')](respondWithResult(_0x4a48e0,null))[_0xcfba('0x25')](handleError(_0x4a48e0,null));};exports[_0xcfba('0x2e')]=function(_0x28d7d5,_0x68130a){if(_0x28d7d5[_0xcfba('0x4e')]['id']){delete _0x28d7d5[_0xcfba('0x4e')]['id'];}return db[_0xcfba('0x32')]['find']({'where':{'id':_0x28d7d5['params']['id']}})[_0xcfba('0x1b')](handleEntityNotFound(_0x68130a,null))[_0xcfba('0x1b')](saveUpdates(_0x28d7d5[_0xcfba('0x4e')],null))[_0xcfba('0x1b')](respondWithResult(_0x68130a,null))['catch'](handleError(_0x68130a,null));};exports[_0xcfba('0x4f')]=function(_0x1a2803,_0x9d4404,_0x589e20){if(_0x1a2803[_0xcfba('0x50')]&&_0x1a2803[_0xcfba('0x50')][_0xcfba('0x51')]){_0x1a2803['body'][_0xcfba('0x52')]=_0x1a2803[_0xcfba('0x50')][_0xcfba('0x51')];}return db[_0xcfba('0x32')]['find']({'where':{'id':_0x1a2803['params']['id']}})[_0xcfba('0x1b')](handleEntityNotFound(_0x9d4404,null))[_0xcfba('0x1b')](saveUpdates(_0x1a2803['body'],null))['then'](respondWithResult(_0x9d4404,null))[_0xcfba('0x25')](handleError(_0x9d4404,null));};exports['addLogoLogin']=function(_0x3e9cf7,_0x28f591,_0x159eb6){if(_0x3e9cf7['file']&&_0x3e9cf7[_0xcfba('0x50')][_0xcfba('0x51')]){_0x3e9cf7[_0xcfba('0x4e')][_0xcfba('0x53')]=_0x3e9cf7['file'][_0xcfba('0x51')];}return db[_0xcfba('0x32')][_0xcfba('0x4d')]({'where':{'id':_0x3e9cf7[_0xcfba('0x4c')]['id']}})[_0xcfba('0x1b')](handleEntityNotFound(_0x28f591,null))[_0xcfba('0x1b')](saveUpdates(_0x3e9cf7['body'],null))[_0xcfba('0x1b')](respondWithResult(_0x28f591,null))[_0xcfba('0x25')](handleError(_0x28f591,null));};var utilLicense=require(_0xcfba('0x17'));exports['getLogo']=function(_0x3a32a6,_0x4c0288,_0x37a95e){var _0x1dc342=_0xcfba('0x54');var _0x43ea7c={'custom':![]};return utilLicense['getLicense']()[_0xcfba('0x1b')](function(_0x36b6ed){if(_0x36b6ed){_0x43ea7c=_0x36b6ed;}return db[_0xcfba('0x32')][_0xcfba('0x4d')]({'where':{'id':_0x3a32a6['params']['id']},'attributes':[_0xcfba('0x52'),'loginLogo',_0xcfba('0x55'),_0xcfba('0x56'),_0xcfba('0x57'),_0xcfba('0x58'),_0xcfba('0x59'),'defaultFavicon'],'raw':!![]});})[_0xcfba('0x1b')](handleEntityNotFound(_0x4c0288,null))['then'](function(_0x4112d6){if(_0x4112d6){var _0x2fb85f=_0x4112d6[_0xcfba('0x52')]&&fs[_0xcfba('0x5a')](path['join'](config[_0xcfba('0x5b')],_0x1dc342,_['toLower'](_0x4112d6[_0xcfba('0x52')])))?path['join'](config[_0xcfba('0x5b')],_0x1dc342,_[_0xcfba('0x5c')](_0x4112d6['logo'])):path['join'](config[_0xcfba('0x5b')],_0x1dc342,_[_0xcfba('0x5c')]('default_logo.svg'));var _0x1d856d=_0xcfba('0x5d')+_[_0xcfba('0x5e')](_0xcfba('0x52'));if(_0x4112d6[_0x1d856d]||!_0x43ea7c[_0xcfba('0x5f')]){_0x2fb85f=path['join'](config[_0xcfba('0x5b')],_0x1dc342,_[_0xcfba('0x5c')]('default_logo.svg'));}if(!fs['existsSync'](_0x2fb85f)){throw new db[(_0xcfba('0x60'))][(_0xcfba('0x61'))](_[_0xcfba('0x5e')](_0xcfba('0x52'))+'\x20not\x20found');}return _0x4c0288['download'](_0x2fb85f);}})['catch'](handleError(_0x4c0288,null));};var utilLicense=require('../../config/license/util');exports[_0xcfba('0x62')]=function(_0x223d03,_0x246c98,_0x3dfe40){var _0x407012=_0xcfba('0x54');var _0x1e582f={'custom':![]};return utilLicense[_0xcfba('0x63')]()['then'](function(_0xbfad3e){if(_0xbfad3e){_0x1e582f=_0xbfad3e;}return db[_0xcfba('0x32')][_0xcfba('0x4d')]({'where':{'id':_0x223d03[_0xcfba('0x4c')]['id']},'attributes':[_0xcfba('0x52'),_0xcfba('0x53'),_0xcfba('0x55'),_0xcfba('0x56'),_0xcfba('0x57'),_0xcfba('0x58'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xcfba('0x1b')](handleEntityNotFound(_0x246c98,null))[_0xcfba('0x1b')](function(_0x448ccc){if(_0x448ccc){var _0x201b20=_0x448ccc[_0xcfba('0x53')]&&fs[_0xcfba('0x5a')](path[_0xcfba('0x64')](config[_0xcfba('0x5b')],_0x407012,_[_0xcfba('0x5c')](_0x448ccc[_0xcfba('0x53')])))?path[_0xcfba('0x64')](config[_0xcfba('0x5b')],_0x407012,_[_0xcfba('0x5c')](_0x448ccc['loginLogo'])):path[_0xcfba('0x64')](config[_0xcfba('0x5b')],_0x407012,_[_0xcfba('0x5c')](_0xcfba('0x65')));var _0x5d5637=_0xcfba('0x5d')+_[_0xcfba('0x5e')](_0xcfba('0x53'));if(_0x448ccc[_0x5d5637]||!_0x1e582f[_0xcfba('0x5f')]){_0x201b20=path[_0xcfba('0x64')](config['root'],_0x407012,_[_0xcfba('0x5c')](_0xcfba('0x65')));}if(!fs[_0xcfba('0x5a')](_0x201b20)){throw new db[(_0xcfba('0x60'))][(_0xcfba('0x61'))](_[_0xcfba('0x5e')](_0xcfba('0x53'))+_0xcfba('0x66'));}return _0x246c98[_0xcfba('0x67')](_0x201b20);}})[_0xcfba('0x25')](handleError(_0x246c98,null));};exports[_0xcfba('0x68')]=function(_0x58b680,_0x1ba4f4){return db['Setting']['find']({'where':{'id':_0x58b680[_0xcfba('0x4c')]['id']},'attributes':[_0xcfba('0x69')]})[_0xcfba('0x1b')](respondWithResult(_0x1ba4f4,null))[_0xcfba('0x25')](handleError(_0x1ba4f4,null));};exports['addPreferred']=function(_0x2a8ca4,_0x1986c3,_0x34bf88){if(_0x2a8ca4[_0xcfba('0x50')]&&_0x2a8ca4[_0xcfba('0x50')][_0xcfba('0x51')]){_0x2a8ca4[_0xcfba('0x4e')][_0xcfba('0x55')]=_0x2a8ca4[_0xcfba('0x50')][_0xcfba('0x51')];}return db[_0xcfba('0x32')][_0xcfba('0x4d')]({'where':{'id':_0x2a8ca4[_0xcfba('0x4c')]['id']}})[_0xcfba('0x1b')](handleEntityNotFound(_0x1986c3,null))['then'](saveUpdates(_0x2a8ca4[_0xcfba('0x4e')],null))[_0xcfba('0x1b')](respondWithResult(_0x1986c3,null))[_0xcfba('0x25')](handleError(_0x1986c3,null));};var utilLicense=require(_0xcfba('0x17'));exports[_0xcfba('0x6a')]=function(_0x1e2fc4,_0x561d71,_0x59a275){var _0x3cbcd7=_0xcfba('0x54');var _0xd0ab81={'custom':![]};return utilLicense[_0xcfba('0x63')]()[_0xcfba('0x1b')](function(_0x5db3c2){if(_0x5db3c2){_0xd0ab81=_0x5db3c2;}return db['Setting'][_0xcfba('0x4d')]({'where':{'id':_0x1e2fc4[_0xcfba('0x4c')]['id']},'attributes':[_0xcfba('0x52'),'loginLogo',_0xcfba('0x55'),'favicon',_0xcfba('0x57'),'defaultLoginLogo',_0xcfba('0x59'),_0xcfba('0x6b')],'raw':!![]});})[_0xcfba('0x1b')](handleEntityNotFound(_0x561d71,null))[_0xcfba('0x1b')](function(_0x54b0c9){if(_0x54b0c9){var _0x3fdf2b=_0x54b0c9[_0xcfba('0x55')]&&fs[_0xcfba('0x5a')](path[_0xcfba('0x64')](config[_0xcfba('0x5b')],_0x3cbcd7,_[_0xcfba('0x5c')](_0x54b0c9[_0xcfba('0x55')])))?path['join'](config[_0xcfba('0x5b')],_0x3cbcd7,_['toLower'](_0x54b0c9[_0xcfba('0x55')])):path[_0xcfba('0x64')](config[_0xcfba('0x5b')],_0x3cbcd7,_[_0xcfba('0x5c')](_0xcfba('0x6c')));var _0x13ae86=_0xcfba('0x5d')+_['upperFirst'](_0xcfba('0x55'));if(_0x54b0c9[_0x13ae86]||!_0xd0ab81['custom']||!_0xd0ab81[_0xcfba('0x55')]){_0x3fdf2b=path[_0xcfba('0x64')](config[_0xcfba('0x5b')],_0x3cbcd7,_[_0xcfba('0x5c')](_0xcfba('0x6c')));}if(!fs[_0xcfba('0x5a')](_0x3fdf2b)){throw new db[(_0xcfba('0x60'))][(_0xcfba('0x61'))](_[_0xcfba('0x5e')](_0xcfba('0x55'))+_0xcfba('0x66'));}return _0x561d71['download'](_0x3fdf2b);}})['catch'](handleError(_0x561d71,null));};exports[_0xcfba('0x6d')]=function(_0x2dd7ba,_0x39084c,_0x26796b){if(_0x2dd7ba[_0xcfba('0x50')]&&_0x2dd7ba[_0xcfba('0x50')][_0xcfba('0x51')]){_0x2dd7ba['body'][_0xcfba('0x56')]=_0x2dd7ba['file']['filename'];}return db[_0xcfba('0x32')]['find']({'where':{'id':_0x2dd7ba[_0xcfba('0x4c')]['id']}})['then'](handleEntityNotFound(_0x39084c,null))[_0xcfba('0x1b')](saveUpdates(_0x2dd7ba['body'],null))[_0xcfba('0x1b')](respondWithResult(_0x39084c,null))[_0xcfba('0x25')](handleError(_0x39084c,null));};var utilLicense=require(_0xcfba('0x17'));exports[_0xcfba('0x6e')]=function(_0x417aa8,_0x160654,_0x59169d){var _0x15bd53=_0xcfba('0x54');var _0x332dfc={'custom':![]};return utilLicense[_0xcfba('0x63')]()[_0xcfba('0x1b')](function(_0x26bd98){if(_0x26bd98){_0x332dfc=_0x26bd98;}return db[_0xcfba('0x32')][_0xcfba('0x4d')]({'where':{'id':_0x417aa8[_0xcfba('0x4c')]['id']},'attributes':[_0xcfba('0x52'),_0xcfba('0x53'),_0xcfba('0x55'),'favicon',_0xcfba('0x57'),_0xcfba('0x58'),_0xcfba('0x59'),_0xcfba('0x6b')],'raw':!![]});})[_0xcfba('0x1b')](handleEntityNotFound(_0x160654,null))['then'](function(_0x166dae){if(_0x166dae){var _0xcbfa28=_0x166dae[_0xcfba('0x56')]&&fs[_0xcfba('0x5a')](path[_0xcfba('0x64')](config['root'],_0x15bd53,_[_0xcfba('0x5c')](_0x166dae[_0xcfba('0x56')])))?path['join'](config[_0xcfba('0x5b')],_0x15bd53,_[_0xcfba('0x5c')](_0x166dae['favicon'])):path[_0xcfba('0x64')](config['root'],_0x15bd53,_[_0xcfba('0x5c')]('default_favicon.ico'));var _0x76720e=_0xcfba('0x5d')+_[_0xcfba('0x5e')](_0xcfba('0x56'));if(_0x166dae[_0x76720e]||!_0x332dfc[_0xcfba('0x5f')]){_0xcbfa28=path[_0xcfba('0x64')](config[_0xcfba('0x5b')],_0x15bd53,_['toLower'](_0xcfba('0x6f')));}if(!fs[_0xcfba('0x5a')](_0xcbfa28)){throw new db[(_0xcfba('0x60'))][(_0xcfba('0x61'))](_[_0xcfba('0x5e')](_0xcfba('0x56'))+_0xcfba('0x66'));}return _0x160654['download'](_0xcbfa28);}})['catch'](handleError(_0x160654,null));};exports[_0xcfba('0x70')]=function(_0x4844b7,_0x3b1698){var _0xc1c365={'offset':moment()[_0xcfba('0x71')]()};_0xc1c365['now']=moment()[_0xcfba('0x71')](_0xc1c365[_0xcfba('0x29')])[_0xcfba('0x72')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x3b1698[_0xcfba('0x27')](0xc8)[_0xcfba('0x73')](_0xc1c365);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 8dc061d..7da1f9a 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 _0xdce3=['settings','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','Setting'];(function(_0x182103,_0x4312af){var _0xf0d059=function(_0x1d0f4d){while(--_0x1d0f4d){_0x182103['push'](_0x182103['shift']());}};_0xf0d059(++_0x4312af);}(_0xdce3,0x1cf));var _0x3dce=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xdce3[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x3dce('0x0'));var util=require('util');var logger=require(_0x3dce('0x1'))(_0x3dce('0x2'));var moment=require('moment');var BPromise=require(_0x3dce('0x3'));var rp=require(_0x3dce('0x4'));var fs=require('fs');var path=require(_0x3dce('0x5'));var rimraf=require(_0x3dce('0x6'));var config=require(_0x3dce('0x7'));var attributes=require(_0x3dce('0x8'));module['exports']=function(_0x50a02,_0x609147){return _0x50a02['define'](_0x3dce('0x9'),attributes,{'tableName':_0x3dce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf254=['rimraf','../../config/environment','./setting.attributes','exports','Setting','settings','util','../../config/logger','api','moment','bluebird','path'];(function(_0x20cc29,_0x30a46d){var _0x28d513=function(_0x179b06){while(--_0x179b06){_0x20cc29['push'](_0x20cc29['shift']());}};_0x28d513(++_0x30a46d);}(_0xf254,0x1e6));var _0x4f25=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xf254[_0x13ce0c];return _0x4388fb;};'use strict';var _=require('lodash');var util=require(_0x4f25('0x0'));var logger=require(_0x4f25('0x1'))(_0x4f25('0x2'));var moment=require(_0x4f25('0x3'));var BPromise=require(_0x4f25('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f25('0x5'));var rimraf=require(_0x4f25('0x6'));var config=require(_0x4f25('0x7'));var attributes=require(_0x4f25('0x8'));module[_0x4f25('0x9')]=function(_0x422614,_0x2df4d4){return _0x422614['define'](_0x4f25('0xa'),attributes,{'tableName':_0x4f25('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 3811f89..e2951b0 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 _0x491b=['jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','Setting','find','options','raw','where','attributes','include','model','ShowSetting','stringify','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x4fb318,_0x400df2){var _0x17da2d=function(_0x21f4be){while(--_0x21f4be){_0x4fb318['push'](_0x4fb318['shift']());}};_0x17da2d(++_0x400df2);}(_0x491b,0xfe));var _0xb491=function(_0x25e2ee,_0x49d785){_0x25e2ee=_0x25e2ee-0x0;var _0x39ef9b=_0x491b[_0x25e2ee];return _0x39ef9b;};'use strict';var _=require('lodash');var util=require(_0xb491('0x0'));var moment=require('moment');var BPromise=require(_0xb491('0x1'));var rs=require(_0xb491('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb491('0x3'))['db'];var utils=require(_0xb491('0x4'));var logger=require('../../config/logger')(_0xb491('0x5'));var config=require(_0xb491('0x6'));var jayson=require(_0xb491('0x7'));var client=jayson['client'][_0xb491('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e905a,_0x61a9d5,_0x224b73){return new BPromise(function(_0x180a76,_0x568723){return client[_0xb491('0x9')](_0x5e905a,_0x224b73)[_0xb491('0xa')](function(_0x4475f5){logger[_0xb491('0xb')](_0xb491('0xc'),_0x61a9d5,_0xb491('0xd'));logger['debug'](_0xb491('0xe'),_0x61a9d5,_0xb491('0xd'),JSON['stringify'](_0x4475f5));if(_0x4475f5['error']){if(_0x4475f5[_0xb491('0xf')][_0xb491('0x10')]===0x1f4){logger[_0xb491('0xf')]('Setting,\x20%s,\x20%s',_0x61a9d5,_0x4475f5[_0xb491('0xf')][_0xb491('0x11')]);return _0x568723(_0x4475f5[_0xb491('0xf')][_0xb491('0x11')]);}logger[_0xb491('0xf')](_0xb491('0xc'),_0x61a9d5,_0x4475f5['error']['message']);return _0x180a76(_0x4475f5[_0xb491('0xf')][_0xb491('0x11')]);}else{logger['info'](_0xb491('0xc'),_0x61a9d5,_0xb491('0xd'));_0x180a76(_0x4475f5[_0xb491('0x12')][_0xb491('0x11')]);}})['catch'](function(_0x18477c){logger[_0xb491('0xf')](_0xb491('0xc'),_0x61a9d5,_0x18477c);_0x568723(_0x18477c);});});}exports['ShowSetting']=function(_0x44f1c4){var _0x5e9c73=this;return new Promise(function(_0xd9f976,_0x1b8298){return db[_0xb491('0x13')][_0xb491('0x14')]({'raw':_0x44f1c4[_0xb491('0x15')]?_0x44f1c4[_0xb491('0x15')][_0xb491('0x16')]===undefined?!![]:![]:!![],'where':_0x44f1c4[_0xb491('0x15')]?_0x44f1c4[_0xb491('0x15')][_0xb491('0x17')]||null:null,'attributes':_0x44f1c4[_0xb491('0x15')]?_0x44f1c4[_0xb491('0x15')][_0xb491('0x18')]||null:null,'include':_0x44f1c4['options']?_0x44f1c4['options']['include']?_['map'](_0x44f1c4[_0xb491('0x15')][_0xb491('0x19')],function(_0x863a41){return{'model':db[_0x863a41[_0xb491('0x1a')]],'as':_0x863a41['as'],'attributes':_0x863a41[_0xb491('0x18')],'include':_0x863a41[_0xb491('0x19')]?_['map'](_0x863a41['include'],function(_0x2d668d){return{'model':db[_0x2d668d[_0xb491('0x1a')]],'as':_0x2d668d['as'],'attributes':_0x2d668d['attributes'],'include':_0x2d668d[_0xb491('0x19')]?_['map'](_0x2d668d[_0xb491('0x19')],function(_0x5dacc8){return{'model':db[_0x5dacc8['model']],'as':_0x5dacc8['as'],'attributes':_0x5dacc8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x52b06b){logger['info'](_0xb491('0x1b'),_0x44f1c4);logger['debug'](_0xb491('0x1b'),_0x44f1c4,JSON[_0xb491('0x1c')](_0x52b06b));_0xd9f976(_0x52b06b);})['catch'](function(_0x3db0cc){logger[_0xb491('0xf')](_0xb491('0x1b'),_0x3db0cc[_0xb491('0x11')],_0x44f1c4);_0x1b8298(_0x5e9c73[_0xb491('0xf')](0x1f4,_0x3db0cc[_0xb491('0x11')]));});});}; \ No newline at end of file +var _0x8f18=['model','attributes','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSetting','Setting','find','options','raw','where','map','include'];(function(_0x5bec4d,_0x4cef0f){var _0x44063a=function(_0x350dcf){while(--_0x350dcf){_0x5bec4d['push'](_0x5bec4d['shift']());}};_0x44063a(++_0x4cef0f);}(_0x8f18,0x141));var _0x88f1=function(_0x3223c7,_0x508a4d){_0x3223c7=_0x3223c7-0x0;var _0x2eea6f=_0x8f18[_0x3223c7];return _0x2eea6f;};'use strict';var _=require(_0x88f1('0x0'));var util=require(_0x88f1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x88f1('0x2'));var fs=require('fs');var Redis=require(_0x88f1('0x3'));var db=require(_0x88f1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x88f1('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x88f1('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d49fb,_0x3e8260,_0x463a90){return new BPromise(function(_0x1fe7a9,_0xc51eda){return client[_0x88f1('0x7')](_0x2d49fb,_0x463a90)[_0x88f1('0x8')](function(_0x2bce26){logger[_0x88f1('0x9')](_0x88f1('0xa'),_0x3e8260,_0x88f1('0xb'));logger[_0x88f1('0xc')](_0x88f1('0xd'),_0x3e8260,_0x88f1('0xb'),JSON[_0x88f1('0xe')](_0x2bce26));if(_0x2bce26[_0x88f1('0xf')]){if(_0x2bce26[_0x88f1('0xf')]['code']===0x1f4){logger[_0x88f1('0xf')](_0x88f1('0xa'),_0x3e8260,_0x2bce26[_0x88f1('0xf')][_0x88f1('0x10')]);return _0xc51eda(_0x2bce26[_0x88f1('0xf')][_0x88f1('0x10')]);}logger['error'](_0x88f1('0xa'),_0x3e8260,_0x2bce26['error'][_0x88f1('0x10')]);return _0x1fe7a9(_0x2bce26[_0x88f1('0xf')]['message']);}else{logger[_0x88f1('0x9')](_0x88f1('0xa'),_0x3e8260,_0x88f1('0xb'));_0x1fe7a9(_0x2bce26[_0x88f1('0x11')][_0x88f1('0x10')]);}})[_0x88f1('0x12')](function(_0xd7b4b3){logger[_0x88f1('0xf')]('Setting,\x20%s,\x20%s',_0x3e8260,_0xd7b4b3);_0xc51eda(_0xd7b4b3);});});}exports[_0x88f1('0x13')]=function(_0x234951){var _0x4f4c49=this;return new Promise(function(_0x34ea76,_0x7e361d){return db[_0x88f1('0x14')][_0x88f1('0x15')]({'raw':_0x234951['options']?_0x234951[_0x88f1('0x16')][_0x88f1('0x17')]===undefined?!![]:![]:!![],'where':_0x234951[_0x88f1('0x16')]?_0x234951[_0x88f1('0x16')][_0x88f1('0x18')]||null:null,'attributes':_0x234951[_0x88f1('0x16')]?_0x234951[_0x88f1('0x16')]['attributes']||null:null,'include':_0x234951['options']?_0x234951[_0x88f1('0x16')]['include']?_[_0x88f1('0x19')](_0x234951[_0x88f1('0x16')][_0x88f1('0x1a')],function(_0x21ade2){return{'model':db[_0x21ade2[_0x88f1('0x1b')]],'as':_0x21ade2['as'],'attributes':_0x21ade2[_0x88f1('0x1c')],'include':_0x21ade2[_0x88f1('0x1a')]?_['map'](_0x21ade2[_0x88f1('0x1a')],function(_0x5104bb){return{'model':db[_0x5104bb[_0x88f1('0x1b')]],'as':_0x5104bb['as'],'attributes':_0x5104bb[_0x88f1('0x1c')],'include':_0x5104bb[_0x88f1('0x1a')]?_[_0x88f1('0x19')](_0x5104bb[_0x88f1('0x1a')],function(_0x20d2d4){return{'model':db[_0x20d2d4[_0x88f1('0x1b')]],'as':_0x20d2d4['as'],'attributes':_0x20d2d4[_0x88f1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x88f1('0x8')](function(_0xc4328c){logger[_0x88f1('0x9')]('ShowSetting',_0x234951);logger['debug'](_0x88f1('0x13'),_0x234951,JSON[_0x88f1('0xe')](_0xc4328c));_0x34ea76(_0xc4328c);})[_0x88f1('0x12')](function(_0xf62a0){logger[_0x88f1('0xf')]('ShowSetting',_0xf62a0[_0x88f1('0x10')],_0x234951);_0x7e361d(_0x4f4c49[_0x88f1('0xf')](0x1f4,_0xf62a0[_0x88f1('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 508cbfe..d68b2d5 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 _0x9c46=['index','get','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','/:id/status','statusGet','getAgents','post','create','/:id/notify','addApplications','/:id/send','send','status','put','delete','destroy','removeDispositions','removeAnswers','/:id/users','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9c46,0xe0));var _0x69c4=function(_0x47882a,_0x4fefd0){_0x47882a=_0x47882a-0x0;var _0x4bef2f=_0x9c46[_0x47882a];return _0x4bef2f;};'use strict';var multer=require(_0x69c4('0x0'));var util=require('util');var path=require(_0x69c4('0x1'));var timeout=require(_0x69c4('0x2'));var express=require(_0x69c4('0x3'));var router=express[_0x69c4('0x4')]();var fs_extra=require(_0x69c4('0x5'));var auth=require(_0x69c4('0x6'));var interaction=require(_0x69c4('0x7'));var config=require(_0x69c4('0x8'));var controller=require(_0x69c4('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x69c4('0xa')]);router[_0x69c4('0xb')](_0x69c4('0xc'),auth[_0x69c4('0xd')](),controller[_0x69c4('0xe')]);router[_0x69c4('0xb')](_0x69c4('0xf'),auth[_0x69c4('0xd')](),controller['show']);router[_0x69c4('0xb')](_0x69c4('0x10'),auth[_0x69c4('0xd')](),controller[_0x69c4('0x11')]);router[_0x69c4('0xb')](_0x69c4('0x12'),auth[_0x69c4('0xd')](),controller['getAnswers']);router[_0x69c4('0xb')](_0x69c4('0x13'),auth['isAuthenticated'](),controller[_0x69c4('0x14')]);router['get'](_0x69c4('0x15'),auth[_0x69c4('0xd')](),controller['getInteractions']);router[_0x69c4('0xb')](_0x69c4('0x16'),controller[_0x69c4('0x17')]);router['get']('/:id/users',auth[_0x69c4('0xd')](),controller[_0x69c4('0x18')]);router[_0x69c4('0x19')]('/',auth['isAuthenticated'](),controller[_0x69c4('0x1a')]);router[_0x69c4('0x19')](_0x69c4('0x10'),auth[_0x69c4('0xd')](),controller['addDisposition']);router['post'](_0x69c4('0x12'),auth[_0x69c4('0xd')](),controller['addAnswer']);router[_0x69c4('0x19')](_0x69c4('0x1b'),controller['notify']);router[_0x69c4('0x19')](_0x69c4('0x13'),auth['isAuthenticated'](),controller[_0x69c4('0x1c')]);router[_0x69c4('0x19')](_0x69c4('0x1d'),auth[_0x69c4('0xd')](),controller[_0x69c4('0x1e')]);router[_0x69c4('0x19')]('/:id/status',controller[_0x69c4('0x1f')]);router[_0x69c4('0x19')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x69c4('0x20')]('/:id',auth[_0x69c4('0xd')](),controller['update']);router[_0x69c4('0x21')](_0x69c4('0xf'),auth[_0x69c4('0xd')](),controller[_0x69c4('0x22')]);router['delete']('/:id/dispositions',auth[_0x69c4('0xd')](),controller[_0x69c4('0x23')]);router[_0x69c4('0x21')](_0x69c4('0x12'),auth[_0x69c4('0xd')](),controller[_0x69c4('0x24')]);router[_0x69c4('0x21')](_0x69c4('0x25'),auth[_0x69c4('0xd')](),controller['removeAgents']);module[_0x69c4('0x26')]=router; \ No newline at end of file +var _0xd646=['getInteractions','/:id/status','statusGet','/:id/users','post','create','/:id/dispositions','addDisposition','addAnswer','notify','/:id/send','send','addAgents','put','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','getApplications'];(function(_0x617cf1,_0x45a179){var _0x410ef1=function(_0x24f3a5){while(--_0x24f3a5){_0x617cf1['push'](_0x617cf1['shift']());}};_0x410ef1(++_0x45a179);}(_0xd646,0x172));var _0x6d64=function(_0x45c10a,_0x4b9090){_0x45c10a=_0x45c10a-0x0;var _0x3f680=_0xd646[_0x45c10a];return _0x3f680;};'use strict';var multer=require(_0x6d64('0x0'));var util=require(_0x6d64('0x1'));var path=require(_0x6d64('0x2'));var timeout=require(_0x6d64('0x3'));var express=require(_0x6d64('0x4'));var router=express[_0x6d64('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6d64('0x6'));var interaction=require(_0x6d64('0x7'));var config=require('../../config/environment');var controller=require(_0x6d64('0x8'));router['get']('/',auth[_0x6d64('0x9')](),controller[_0x6d64('0xa')]);router[_0x6d64('0xb')](_0x6d64('0xc'),auth['isAuthenticated'](),controller[_0x6d64('0xd')]);router[_0x6d64('0xb')](_0x6d64('0xe'),auth[_0x6d64('0x9')](),controller[_0x6d64('0xf')]);router[_0x6d64('0xb')]('/:id/dispositions',auth[_0x6d64('0x9')](),controller[_0x6d64('0x10')]);router['get'](_0x6d64('0x11'),auth[_0x6d64('0x9')](),controller[_0x6d64('0x12')]);router[_0x6d64('0xb')]('/:id/applications',auth[_0x6d64('0x9')](),controller[_0x6d64('0x13')]);router['get']('/:id/interactions',auth[_0x6d64('0x9')](),controller[_0x6d64('0x14')]);router[_0x6d64('0xb')](_0x6d64('0x15'),controller[_0x6d64('0x16')]);router[_0x6d64('0xb')](_0x6d64('0x17'),auth['isAuthenticated'](),controller['getAgents']);router[_0x6d64('0x18')]('/',auth[_0x6d64('0x9')](),controller[_0x6d64('0x19')]);router['post'](_0x6d64('0x1a'),auth[_0x6d64('0x9')](),controller[_0x6d64('0x1b')]);router[_0x6d64('0x18')](_0x6d64('0x11'),auth[_0x6d64('0x9')](),controller[_0x6d64('0x1c')]);router[_0x6d64('0x18')]('/:id/notify',controller[_0x6d64('0x1d')]);router[_0x6d64('0x18')]('/:id/applications',auth[_0x6d64('0x9')](),controller['addApplications']);router['post'](_0x6d64('0x1e'),auth['isAuthenticated'](),controller[_0x6d64('0x1f')]);router[_0x6d64('0x18')](_0x6d64('0x15'),controller['status']);router[_0x6d64('0x18')](_0x6d64('0x17'),auth[_0x6d64('0x9')](),controller[_0x6d64('0x20')]);router[_0x6d64('0x21')](_0x6d64('0xe'),auth[_0x6d64('0x9')](),controller['update']);router[_0x6d64('0x22')](_0x6d64('0xe'),auth[_0x6d64('0x9')](),controller[_0x6d64('0x23')]);router[_0x6d64('0x22')](_0x6d64('0x1a'),auth[_0x6d64('0x9')](),controller['removeDispositions']);router[_0x6d64('0x22')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x6d64('0x24')]);router['delete'](_0x6d64('0x17'),auth[_0x6d64('0x9')](),controller[_0x6d64('0x25')]);module[_0x6d64('0x26')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index cbd91e0..388329a 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 _0x0b0d=['twilio','skebby','connectel','plivo','csc','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM'];(function(_0x6dce5e,_0x1fcf30){var _0x380732=function(_0x33bdd9){while(--_0x33bdd9){_0x6dce5e['push'](_0x6dce5e['shift']());}};_0x380732(++_0x1fcf30);}(_0x0b0d,0x117));var _0xd0b0=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x0b0d[_0x4b2863];return _0x567d67;};'use strict';var Sequelize=require(_0xd0b0('0x0'));var rs=require(_0xd0b0('0x1'));module[_0xd0b0('0x2')]={'name':{'type':Sequelize[_0xd0b0('0x3')],'unique':_0xd0b0('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xd0b0('0x3')],'defaultValue':function(){return rs[_0xd0b0('0x5')]();}},'phone':{'type':Sequelize[_0xd0b0('0x3')]},'type':{'type':Sequelize[_0xd0b0('0x6')](_0xd0b0('0x7'),_0xd0b0('0x8'),_0xd0b0('0x9'),'clicksend',_0xd0b0('0xa'),'clickatell','bandwidth',_0xd0b0('0xb'),_0xd0b0('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0xd0b0('0x3')]},'authId':{'type':Sequelize[_0xd0b0('0x3')]},'authToken':{'type':Sequelize[_0xd0b0('0x3')]},'smsMethod':{'type':Sequelize[_0xd0b0('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0xd0b0('0x3')]},'password':{'type':Sequelize[_0xd0b0('0x3')]},'apiKey':{'type':Sequelize[_0xd0b0('0x3')]},'applicationId':{'type':Sequelize[_0xd0b0('0x3')]},'accountId':{'type':Sequelize[_0xd0b0('0x3')]},'senderString':{'type':Sequelize[_0xd0b0('0x3')]},'deliveryReport':{'type':Sequelize[_0xd0b0('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0xd0b0('0x3')]},'notificationTemplate':{'type':Sequelize[_0xd0b0('0xe')],'defaultValue':function(){return _0xd0b0('0xf');}},'notificationSound':{'type':Sequelize[_0xd0b0('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd0b0('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd0b0('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd0b0('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd0b0('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd0b0('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xd0b0('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd0b0('0x10')],'comment':_0xd0b0('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xd0b0('0xd')],'defaultValue':![],'comment':_0xd0b0('0x12'),'set':function(_0x46179f){if(!_0x46179f)this[_0xd0b0('0x13')](_0xd0b0('0x14'),null);this[_0xd0b0('0x13')](_0xd0b0('0x15'),_0x46179f);}}}; \ No newline at end of file +var _0x56fe=['infobip','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','name','STRING','generate','ENUM','skebby','connectel','clicksend','clickatell','bandwidth','csc'];(function(_0x187266,_0x3f99df){var _0x1a83bc=function(_0x189626){while(--_0x189626){_0x187266['push'](_0x187266['shift']());}};_0x1a83bc(++_0x3f99df);}(_0x56fe,0xe4));var _0xe56f=function(_0x1d02ca,_0x3ab4d3){_0x1d02ca=_0x1d02ca-0x0;var _0x5bab9c=_0x56fe[_0x1d02ca];return _0x5bab9c;};'use strict';var Sequelize=require(_0xe56f('0x0'));var rs=require(_0xe56f('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xe56f('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xe56f('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xe56f('0x3')],'defaultValue':function(){return rs[_0xe56f('0x4')]();}},'phone':{'type':Sequelize[_0xe56f('0x3')]},'type':{'type':Sequelize[_0xe56f('0x5')]('twilio',_0xe56f('0x6'),_0xe56f('0x7'),_0xe56f('0x8'),'plivo',_0xe56f('0x9'),_0xe56f('0xa'),_0xe56f('0xb'),_0xe56f('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0xe56f('0x3')]},'authId':{'type':Sequelize[_0xe56f('0x3')]},'authToken':{'type':Sequelize[_0xe56f('0x3')]},'smsMethod':{'type':Sequelize[_0xe56f('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe56f('0x3')]},'apiKey':{'type':Sequelize[_0xe56f('0x3')]},'applicationId':{'type':Sequelize[_0xe56f('0x3')]},'accountId':{'type':Sequelize[_0xe56f('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xe56f('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0xe56f('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xe56f('0xe');}},'notificationSound':{'type':Sequelize[_0xe56f('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe56f('0xf')],'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['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xe56f('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe56f('0xf')],'comment':_0xe56f('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe56f('0x11'),'set':function(_0x78e227){if(!_0x78e227)this[_0xe56f('0x12')](_0xe56f('0x13'),null);this[_0xe56f('0x12')]('mandatoryDisposition',_0x78e227);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index c71730a..57e2e2e 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 _0xa9e0=['omit','SmsInteraction','spread','interaction','autoclose','close','*,*,*,*','created','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','receiveMessage','entity\x20found','twilio','text/xml','\x0a','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','Contact','Owner','fullname','internal','Tag','tag','findAll','to\x20is\x20mandatory','List','user','out','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','intelepeer','redif','error_code','results','inspect','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','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','./smsAccount.socket','register','jayson/promise','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map','type','VIRTUAL','merge','includeAll','include','rows','show','params','options','create','role','UserProfileSection','find','userProfileId','autoAssociation','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','notify','sms','SmsApplication','account','applications','orderBy','Applications','priority','asc','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','from','From','Body','messageId','MessageSid','skebby','text','connectel','clicksend','message_id','plivo','Text','infobip','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','refid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC'];(function(_0x2afeb7,_0x386204){var _0x3157f1=function(_0x303a5d){while(--_0x303a5d){_0x2afeb7['push'](_0x2afeb7['shift']());}};_0x3157f1(++_0x386204);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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});function respondWithRpcPromise(_0x52a03d,_0x22dccb,_0x5d0880,_0x1985b6){return new BPromise(function(_0x519dfd,_0x16033c){var _0x12066b=_0x1985b6||client;return _0x12066b['request'](_0x52a03d,_0x5d0880)[_0x0a9e('0x1d')](function(_0x5a0a06){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x22dccb,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x22dccb,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x5a0a06));if(_0x5a0a06[_0x0a9e('0x24')]){if(_0x5a0a06[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger[_0x0a9e('0x24')](_0x0a9e('0x1f'),_0x22dccb,_0x5a0a06['error'][_0x0a9e('0x26')]);return _0x16033c(_0x5a0a06[_0x0a9e('0x24')]['message']);}logger[_0x0a9e('0x24')]('SmsAccount,\x20%s,\x20%s',_0x22dccb,_0x5a0a06['error'][_0x0a9e('0x26')]);return _0x519dfd(_0x5a0a06[_0x0a9e('0x24')][_0x0a9e('0x26')]);}else{logger[_0x0a9e('0x1e')]('SmsAccount,\x20%s,\x20%s',_0x22dccb,_0x0a9e('0x20'));_0x519dfd(_0x5a0a06[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x370d86){logger[_0x0a9e('0x24')](_0x0a9e('0x1f'),_0x22dccb,_0x370d86);_0x16033c(_0x370d86);});});}function respondWithStatusCode(_0x5ea472,_0x59181e){_0x59181e=_0x59181e||0xcc;return function(_0x197ec0){if(_0x197ec0){return _0x5ea472[_0x0a9e('0x29')](_0x59181e);}return _0x5ea472[_0x0a9e('0x2a')](_0x59181e)[_0x0a9e('0x2b')]();};}function respondWithResult(_0x526cf3,_0x384319){_0x384319=_0x384319||0xc8;return function(_0x479bc4){if(_0x479bc4){return _0x526cf3[_0x0a9e('0x2a')](_0x384319)['json'](_0x479bc4);}};}function respondWithFilteredResult(_0x1dc186,_0x34dc65){return function(_0x25fba9){if(_0x25fba9){var _0x14433c=_0x25fba9[_0x0a9e('0x2c')],_0x140511=_0x34dc65['offset'],_0x1538a4=_0x34dc65[_0x0a9e('0x2d')]+_0x34dc65[_0x0a9e('0x2e')],_0x11c3b6;if(_0x1538a4>=_0x14433c){_0x1538a4=_0x14433c;_0x11c3b6=0xc8;}else{_0x11c3b6=0xce;}_0x1dc186[_0x0a9e('0x2a')](_0x11c3b6);return _0x1dc186[_0x0a9e('0x2f')]('Content-Range',_0x140511+'-'+_0x1538a4+'/'+_0x14433c)[_0x0a9e('0x30')](_0x25fba9);}return null;};}function patchUpdates(_0x40e7a3){return function(_0x1843b2){try{jsonpatch[_0x0a9e('0x31')](_0x1843b2,_0x40e7a3,!![]);}catch(_0x58b06f){return BPromise[_0x0a9e('0x32')](_0x58b06f);}return _0x1843b2[_0x0a9e('0x33')]();};}function saveUpdates(_0x2e8759,_0x1dbde2){return function(_0x540530){if(_0x540530){return _0x540530[_0x0a9e('0x34')](_0x2e8759)['then'](function(_0x2407f9){return _0x2407f9;});}return null;};}function removeEntity(_0x3ae878,_0x1122db){return function(_0x33bdb7){if(_0x33bdb7){return _0x33bdb7[_0x0a9e('0x35')]()['then'](function(){var _0x66c1d2=_0x33bdb7[_0x0a9e('0x36')]({'plain':!![]});var _0x40cb85=_0x0a9e('0x37');return db[_0x0a9e('0x38')][_0x0a9e('0x35')]({'where':{'type':_0x40cb85,'resourceId':_0x66c1d2['id']}})[_0x0a9e('0x1d')](function(){return _0x33bdb7;});})[_0x0a9e('0x1d')](function(){_0x3ae878['status'](0xcc)[_0x0a9e('0x2b')]();});}};}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('0x39')]);if(_0x191e91[_0x0a9e('0x3a')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x3b')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={'include':[{'model':db[_0x0a9e('0x3c')],'as':_0x0a9e('0x3d')}]},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x3cae=_['map'](db[_0x0a9e('0x3e')][_0x0a9e('0x3f')],function(_0x289467){return{'name':_0x289467['fieldName'],'type':_0x289467['type'][_0x0a9e('0x40')]};});_0x1ef87a[_0x0a9e('0x41')]=_['map'](_0x3cae,_0x0a9e('0x3a'));_0x1ef87a[_0x0a9e('0x42')]=_[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x42')]);_0x1ef87a['filters']=_['intersection'](_0x1ef87a[_0x0a9e('0x41')],_0x1ef87a[_0x0a9e('0x42')]);_0x381c37['attributes']=_[_0x0a9e('0x44')](_0x1ef87a[_0x0a9e('0x41')],qs[_0x0a9e('0x45')](_0x24936a['query'][_0x0a9e('0x45')]));_0x381c37[_0x0a9e('0x46')]=_0x381c37[_0x0a9e('0x46')][_0x0a9e('0x47')]?_0x381c37[_0x0a9e('0x46')]:_0x1ef87a[_0x0a9e('0x41')];if(!_0x24936a[_0x0a9e('0x42')][_0x0a9e('0x48')](_0x0a9e('0x49'))){_0x381c37[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x24936a[_0x0a9e('0x42')][_0x0a9e('0x2e')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a['query']['offset']);}_0x381c37[_0x0a9e('0x4a')]=qs[_0x0a9e('0x4b')](_0x24936a[_0x0a9e('0x42')][_0x0a9e('0x4b')]);_0x381c37[_0x0a9e('0x4c')]=qs[_0x0a9e('0x4d')](_[_0x0a9e('0x4e')](_0x24936a[_0x0a9e('0x42')],_0x1ef87a[_0x0a9e('0x4d')]),_0x3cae);if(_0x24936a[_0x0a9e('0x42')][_0x0a9e('0x4f')]){_0x381c37[_0x0a9e('0x4c')]=_['merge'](_0x381c37[_0x0a9e('0x4c')],{'$or':_[_0x0a9e('0x50')](_0x3cae,function(_0xdd268f){if(_0xdd268f[_0x0a9e('0x51')]!==_0x0a9e('0x52')){var _0xbe9d19={};_0xbe9d19[_0xdd268f[_0x0a9e('0x3a')]]={'$like':'%'+_0x24936a[_0x0a9e('0x42')]['filter']+'%'};return _0xbe9d19;}})});}_0x381c37=_[_0x0a9e('0x53')]({},_0x381c37,_0x24936a['options']);var _0x473dc8={'where':_0x381c37[_0x0a9e('0x4c')]};return db[_0x0a9e('0x3e')]['count'](_0x473dc8)[_0x0a9e('0x1d')](function(_0x7f6eb1){_0x4f41ae[_0x0a9e('0x2c')]=_0x7f6eb1;if(_0x24936a[_0x0a9e('0x42')][_0x0a9e('0x54')]){_0x381c37[_0x0a9e('0x55')]=[{'all':!![]}];}return db[_0x0a9e('0x3e')]['findAll'](_0x381c37);})[_0x0a9e('0x1d')](function(_0x1bde3c){_0x4f41ae[_0x0a9e('0x56')]=_0x1bde3c;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x57')]=function(_0x6054ee,_0x19383e){var _0x34febd={'raw':![],'where':{'id':_0x6054ee[_0x0a9e('0x58')]['id']},'include':[{'model':db[_0x0a9e('0x3c')],'as':'mandatoryDispositionPause'}]},_0x58a5c2={};_0x58a5c2['model']=_['keys'](db[_0x0a9e('0x3e')][_0x0a9e('0x3f')]);_0x58a5c2[_0x0a9e('0x42')]=_[_0x0a9e('0x43')](_0x6054ee[_0x0a9e('0x42')]);_0x58a5c2[_0x0a9e('0x4d')]=_[_0x0a9e('0x44')](_0x58a5c2[_0x0a9e('0x41')],_0x58a5c2['query']);_0x34febd['attributes']=_['intersection'](_0x58a5c2[_0x0a9e('0x41')],qs[_0x0a9e('0x45')](_0x6054ee[_0x0a9e('0x42')]['fields']));_0x34febd[_0x0a9e('0x46')]=_0x34febd[_0x0a9e('0x46')]['length']?_0x34febd['attributes']:_0x58a5c2[_0x0a9e('0x41')];if(_0x6054ee['query'][_0x0a9e('0x54')]){_0x34febd['include']=[{'all':!![]}];}_0x34febd=_[_0x0a9e('0x53')]({},_0x34febd,_0x6054ee[_0x0a9e('0x59')]);return db[_0x0a9e('0x3e')]['find'](_0x34febd)[_0x0a9e('0x1d')](handleEntityNotFound(_0x19383e,null))[_0x0a9e('0x1d')](respondWithResult(_0x19383e,null))['catch'](handleError(_0x19383e,null));};exports['create']=function(_0x128aa6,_0x3aedd0){return db['SmsAccount'][_0x0a9e('0x5a')](_0x128aa6['body'],{})[_0x0a9e('0x1d')](function(_0x523cd2){var _0xe22ccc=_0x128aa6['user']['get']({'plain':!![]});if(!_0xe22ccc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe22ccc[_0x0a9e('0x5b')]==='user'){var _0x2f7092=_0x523cd2[_0x0a9e('0x36')]({'plain':!![]});var _0x3cfd00=_0x0a9e('0x37');return db[_0x0a9e('0x5c')][_0x0a9e('0x5d')]({'where':{'name':_0x3cfd00,'userProfileId':_0xe22ccc[_0x0a9e('0x5e')]},'raw':!![]})[_0x0a9e('0x1d')](function(_0x4e67ab){if(_0x4e67ab&&_0x4e67ab[_0x0a9e('0x5f')]===0x0){return db[_0x0a9e('0x38')][_0x0a9e('0x5a')]({'name':_0x2f7092[_0x0a9e('0x3a')],'resourceId':_0x2f7092['id'],'type':_0x4e67ab[_0x0a9e('0x3a')],'sectionId':_0x4e67ab['id']},{})[_0x0a9e('0x1d')](function(){return _0x523cd2;});}else{return _0x523cd2;}})['catch'](function(_0x956fbe){logger[_0x0a9e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x956fbe);throw _0x956fbe;});}return _0x523cd2;})[_0x0a9e('0x1d')](respondWithResult(_0x3aedd0,0xc9))['catch'](handleError(_0x3aedd0,null));};exports[_0x0a9e('0x34')]=function(_0x5ba1f9,_0x4b3c1a){if(_0x5ba1f9['body']['id']){delete _0x5ba1f9[_0x0a9e('0x60')]['id'];}return db['SmsAccount'][_0x0a9e('0x5d')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x58')]['id']},'include':[{'model':db[_0x0a9e('0x3c')],'as':_0x0a9e('0x3d')}]})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))[_0x0a9e('0x1d')](saveUpdates(_0x5ba1f9['body'],null))[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};exports[_0x0a9e('0x35')]=function(_0x1f07cb,_0x51aaf7){return db['SmsAccount'][_0x0a9e('0x5d')]({'where':{'id':_0x1f07cb[_0x0a9e('0x58')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x51aaf7,null))[_0x0a9e('0x1d')](removeEntity(_0x51aaf7,null))['catch'](handleError(_0x51aaf7,null));};exports[_0x0a9e('0x61')]=function(_0xe05a5a,_0x54327c){return db[_0x0a9e('0x3e')][_0x0a9e('0x61')]()[_0x0a9e('0x1d')](respondWithResult(_0x54327c,null))[_0x0a9e('0x28')](handleError(_0x54327c,null));};exports[_0x0a9e('0x62')]=function(_0x4d4a35,_0x176840,_0x2937e0){if(_0x4d4a35[_0x0a9e('0x60')]['id']){delete _0x4d4a35['body']['id'];}return db[_0x0a9e('0x3e')]['find']({'where':{'id':_0x4d4a35['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x176840,null))[_0x0a9e('0x1d')](function(_0x9375fb){if(_0x9375fb){_0x4d4a35[_0x0a9e('0x60')][_0x0a9e('0x63')]=_0x9375fb['id'];return db[_0x0a9e('0x64')][_0x0a9e('0x5a')](_0x4d4a35[_0x0a9e('0x60')]);}})[_0x0a9e('0x1d')](respondWithResult(_0x176840,null))[_0x0a9e('0x28')](handleError(_0x176840,null));};exports[_0x0a9e('0x65')]=function(_0x19012b,_0x2bbb86,_0x2b8192){var _0x320898={'raw':![],'where':{}};var _0x412a72={};var _0x2a28c0={'count':0x0,'rows':[]};return db[_0x0a9e('0x3e')]['findOne']({'where':{'id':_0x19012b[_0x0a9e('0x58')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x2bbb86,null))[_0x0a9e('0x1d')](function(_0x4edbb0){if(_0x4edbb0){_0x412a72[_0x0a9e('0x41')]=_[_0x0a9e('0x43')](db['Disposition'][_0x0a9e('0x3f')]);_0x412a72[_0x0a9e('0x42')]=_[_0x0a9e('0x43')](_0x19012b[_0x0a9e('0x42')]);_0x412a72[_0x0a9e('0x4d')]=_['intersection'](_0x412a72['model'],_0x412a72['query']);_0x320898[_0x0a9e('0x46')]=_[_0x0a9e('0x44')](_0x412a72[_0x0a9e('0x41')],qs[_0x0a9e('0x45')](_0x19012b[_0x0a9e('0x42')][_0x0a9e('0x45')]));_0x320898[_0x0a9e('0x46')]=_0x320898[_0x0a9e('0x46')]['length']?_0x320898[_0x0a9e('0x46')]:_0x412a72[_0x0a9e('0x41')];if(!_0x19012b[_0x0a9e('0x42')]['hasOwnProperty'](_0x0a9e('0x49'))){_0x320898['limit']=qs[_0x0a9e('0x2e')](_0x19012b[_0x0a9e('0x42')]['limit']);_0x320898[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x19012b[_0x0a9e('0x42')][_0x0a9e('0x2d')]);}_0x320898['order']=qs[_0x0a9e('0x4b')](_0x19012b[_0x0a9e('0x42')][_0x0a9e('0x4b')]);_0x320898[_0x0a9e('0x4c')]=qs['filters'](_[_0x0a9e('0x4e')](_0x19012b[_0x0a9e('0x42')],_0x412a72[_0x0a9e('0x4d')]));_0x320898[_0x0a9e('0x4c')]['SmsAccountId']=_0x4edbb0['id'];if(_0x19012b[_0x0a9e('0x42')][_0x0a9e('0x4f')]){_0x320898[_0x0a9e('0x4c')]=_[_0x0a9e('0x53')](_0x320898[_0x0a9e('0x4c')],{'$or':_[_0x0a9e('0x50')](_0x320898[_0x0a9e('0x46')],function(_0x3df0e3){var _0x1a7b03={};_0x1a7b03[_0x3df0e3]={'$like':'%'+_0x19012b[_0x0a9e('0x42')][_0x0a9e('0x4f')]+'%'};return _0x1a7b03;})});}_0x320898=_[_0x0a9e('0x53')]({},_0x320898,_0x19012b[_0x0a9e('0x59')]);return db[_0x0a9e('0x64')]['count']({'where':_0x320898[_0x0a9e('0x4c')]})[_0x0a9e('0x1d')](function(_0xc599b3){_0x2a28c0['count']=_0xc599b3;if(_0x19012b[_0x0a9e('0x42')][_0x0a9e('0x54')]){_0x320898[_0x0a9e('0x55')]=[{'all':!![]}];}return db[_0x0a9e('0x64')]['findAll'](_0x320898);})['then'](function(_0x7ebea8){_0x2a28c0[_0x0a9e('0x56')]=_0x7ebea8;return _0x2a28c0;});}})['then'](respondWithFilteredResult(_0x2bbb86,_0x320898))[_0x0a9e('0x28')](handleError(_0x2bbb86,null));};exports['removeDispositions']=function(_0x260f4b,_0x8ebf02,_0x5637a1){return db[_0x0a9e('0x3e')][_0x0a9e('0x5d')]({'where':{'id':_0x260f4b[_0x0a9e('0x58')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x8ebf02,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){return _0x1f42a0[_0x0a9e('0x66')](_0x260f4b['query'][_0x0a9e('0x67')]);}})[_0x0a9e('0x1d')](respondWithStatusCode(_0x8ebf02,null))[_0x0a9e('0x28')](handleError(_0x8ebf02,null));};exports[_0x0a9e('0x68')]=function(_0x492543,_0xf51744,_0xf0db1){if(_0x492543['body']['id']){delete _0x492543[_0x0a9e('0x60')]['id'];}return db['SmsAccount'][_0x0a9e('0x5d')]({'where':{'id':_0x492543[_0x0a9e('0x58')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0xf51744,null))[_0x0a9e('0x1d')](function(_0x5af453){if(_0x5af453){_0x492543['body'][_0x0a9e('0x63')]=_0x5af453['id'];return db[_0x0a9e('0x69')][_0x0a9e('0x5a')](_0x492543['body']);}})[_0x0a9e('0x1d')](respondWithResult(_0xf51744,null))[_0x0a9e('0x28')](handleError(_0xf51744,null));};exports['getAnswers']=function(_0x4e46b2,_0xf0a802,_0x56acca){var _0x5ea541={'raw':![],'where':{}};var _0x4dc6b3={};var _0x81d748={'count':0x0,'rows':[]};return db[_0x0a9e('0x3e')][_0x0a9e('0x6a')]({'where':{'id':_0x4e46b2[_0x0a9e('0x58')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0xf0a802,null))[_0x0a9e('0x1d')](function(_0x5a8854){if(_0x5a8854){_0x4dc6b3[_0x0a9e('0x41')]=_['keys'](db[_0x0a9e('0x69')][_0x0a9e('0x3f')]);_0x4dc6b3[_0x0a9e('0x42')]=_[_0x0a9e('0x43')](_0x4e46b2['query']);_0x4dc6b3[_0x0a9e('0x4d')]=_[_0x0a9e('0x44')](_0x4dc6b3[_0x0a9e('0x41')],_0x4dc6b3['query']);_0x5ea541[_0x0a9e('0x46')]=_[_0x0a9e('0x44')](_0x4dc6b3[_0x0a9e('0x41')],qs[_0x0a9e('0x45')](_0x4e46b2[_0x0a9e('0x42')][_0x0a9e('0x45')]));_0x5ea541[_0x0a9e('0x46')]=_0x5ea541[_0x0a9e('0x46')]['length']?_0x5ea541[_0x0a9e('0x46')]:_0x4dc6b3[_0x0a9e('0x41')];if(!_0x4e46b2['query'][_0x0a9e('0x48')](_0x0a9e('0x49'))){_0x5ea541[_0x0a9e('0x2e')]=qs['limit'](_0x4e46b2[_0x0a9e('0x42')]['limit']);_0x5ea541[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x4e46b2[_0x0a9e('0x42')][_0x0a9e('0x2d')]);}_0x5ea541[_0x0a9e('0x4a')]=qs[_0x0a9e('0x4b')](_0x4e46b2[_0x0a9e('0x42')][_0x0a9e('0x4b')]);_0x5ea541['where']=qs[_0x0a9e('0x4d')](_[_0x0a9e('0x4e')](_0x4e46b2[_0x0a9e('0x42')],_0x4dc6b3[_0x0a9e('0x4d')]));_0x5ea541[_0x0a9e('0x4c')][_0x0a9e('0x63')]=_0x5a8854['id'];if(_0x4e46b2[_0x0a9e('0x42')][_0x0a9e('0x4f')]){_0x5ea541[_0x0a9e('0x4c')]=_[_0x0a9e('0x53')](_0x5ea541[_0x0a9e('0x4c')],{'$or':_[_0x0a9e('0x50')](_0x5ea541[_0x0a9e('0x46')],function(_0x4989f9){var _0xc81b64={};_0xc81b64[_0x4989f9]={'$like':'%'+_0x4e46b2[_0x0a9e('0x42')][_0x0a9e('0x4f')]+'%'};return _0xc81b64;})});}_0x5ea541=_[_0x0a9e('0x53')]({},_0x5ea541,_0x4e46b2[_0x0a9e('0x59')]);return db['CannedAnswer'][_0x0a9e('0x2c')]({'where':_0x5ea541[_0x0a9e('0x4c')]})['then'](function(_0x23b447){_0x81d748['count']=_0x23b447;if(_0x4e46b2[_0x0a9e('0x42')][_0x0a9e('0x54')]){_0x5ea541[_0x0a9e('0x55')]=[{'all':!![]}];}return db[_0x0a9e('0x69')]['findAll'](_0x5ea541);})[_0x0a9e('0x1d')](function(_0x4cf72d){_0x81d748[_0x0a9e('0x56')]=_0x4cf72d;return _0x81d748;});}})[_0x0a9e('0x1d')](respondWithFilteredResult(_0xf0a802,_0x5ea541))['catch'](handleError(_0xf0a802,null));};exports[_0x0a9e('0x6b')]=function(_0x63c9f7,_0x1dd541,_0x4ab276){return db['SmsAccount'][_0x0a9e('0x5d')]({'where':{'id':_0x63c9f7[_0x0a9e('0x58')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x1dd541,null))[_0x0a9e('0x1d')](function(_0x3f2f40){if(_0x3f2f40){return _0x3f2f40[_0x0a9e('0x6b')](_0x63c9f7[_0x0a9e('0x42')][_0x0a9e('0x67')]);}})[_0x0a9e('0x1d')](respondWithStatusCode(_0x1dd541,null))['catch'](handleError(_0x1dd541,null));};exports[_0x0a9e('0x6c')]=function(_0x517081,_0x287324,_0x2f7791){var _0x34e745={'channel':_0x0a9e('0x6d')};var _0x1b61d5=[];var _0x4e7273=[];var _0x436313={};return db[_0x0a9e('0x3e')][_0x0a9e('0x5d')]({'where':{'id':_0x517081[_0x0a9e('0x58')]['id']},'include':[{'model':db[_0x0a9e('0x6e')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x287324,null))[_0x0a9e('0x1d')](function(_0x583662){_0x34e745[_0x0a9e('0x6f')]=_0x583662;_0x34e745[_0x0a9e('0x70')]=_[_0x0a9e('0x71')](_0x583662[_0x0a9e('0x72')],[_0x0a9e('0x73')],[_0x0a9e('0x74')]);if(_0x34e745['account']['Applications']){delete _0x34e745[_0x0a9e('0x6f')]['Applications'];}return db[_0x0a9e('0x75')]['describe']();})[_0x0a9e('0x1d')](function(_0x564db2){if(!_0x564db2){throw new db['Sequelize'][(_0x0a9e('0x76'))](_0x0a9e('0x77'));}_0x1b61d5=_['difference'](_[_0x0a9e('0x43')](_0x564db2),[_0x0a9e('0x78'),_0x0a9e('0x79')]);_0x4e7273=_[_0x0a9e('0x7a')](_[_0x0a9e('0x43')](_0x564db2),['createdAt','updatedAt',_0x0a9e('0x7b'),_0x0a9e('0x7c')]);_0x34e745[_0x0a9e('0x60')]={'mapKey':_0x0a9e('0x7d')};if(_0x34e745[_0x0a9e('0x6f')]['type']){switch(_0x34e745[_0x0a9e('0x6f')][_0x0a9e('0x51')]){case'twilio':_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x7e')]=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x7f')];_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x60')]=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x80')];_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x81')]=_0x517081['body'][_0x0a9e('0x82')];break;case _0x0a9e('0x83'):_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x7e')]='+'+_0x517081[_0x0a9e('0x60')]['sender'];_0x34e745['body'][_0x0a9e('0x60')]=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x84')];break;case _0x0a9e('0x85'):_0x34e745[_0x0a9e('0x60')]['from']=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x7e')];_0x34e745[_0x0a9e('0x60')]['body']=_0x517081[_0x0a9e('0x60')]['message'];break;case _0x0a9e('0x86'):_0x34e745['body'][_0x0a9e('0x7e')]=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x7e')];_0x34e745['body'][_0x0a9e('0x60')]=_0x517081['body'][_0x0a9e('0x60')];_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x81')]=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x87')];break;case _0x0a9e('0x88'):_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x7e')]=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x7f')];_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x60')]=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x89')];_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x81')]=_0x517081['body']['MessageUUID'];break;case _0x0a9e('0x8a'):_0x34e745['body'][_0x0a9e('0x7e')]='+'+_0x517081[_0x0a9e('0x60')]['results'][0x0][_0x0a9e('0x7e')];_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x60')]=_0x517081[_0x0a9e('0x60')]['results'][0x0][_0x0a9e('0x84')];_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x81')]=_0x517081[_0x0a9e('0x60')]['results'][0x0][_0x0a9e('0x81')];break;case _0x0a9e('0x8b'):_0x34e745[_0x0a9e('0x60')]['from']=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x8c')];_0x34e745[_0x0a9e('0x60')]['body']=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x8d')][_0x0a9e('0x26')];break;case _0x0a9e('0x8e'):_0x34e745[_0x0a9e('0x60')]['from']=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x8f')];_0x34e745['body'][_0x0a9e('0x60')]=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x84')];_0x34e745['body']['messageId']=_0x517081['body'][_0x0a9e('0x90')];break;case _0x0a9e('0x91'):_0x34e745['body'][_0x0a9e('0x81')]=_0x517081[_0x0a9e('0x60')][0x0][_0x0a9e('0x26')]['id'];_0x34e745['body'][_0x0a9e('0x7e')]=_0x517081[_0x0a9e('0x60')][0x0][_0x0a9e('0x26')][_0x0a9e('0x7e')];_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x60')]=_0x517081[_0x0a9e('0x60')][0x0][_0x0a9e('0x26')][_0x0a9e('0x84')];break;case'intelepeer':_0x34e745[_0x0a9e('0x60')]['from']=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x7e')];_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x60')]=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x26')];_0x34e745['body'][_0x0a9e('0x81')]=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x92')];break;}}if(_0x34e745[_0x0a9e('0x60')]['id']){delete _0x34e745['body']['id'];}if(_[_0x0a9e('0x93')](_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x7e')])){throw new db[(_0x0a9e('0x94'))][(_0x0a9e('0x76'))](_0x0a9e('0x95'));}if(_[_0x0a9e('0x93')](_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x60')])||_0x34e745[_0x0a9e('0x60')]['body']===''){throw new db[(_0x0a9e('0x94'))][(_0x0a9e('0x76'))](_0x0a9e('0x96'));}if(_[_0x0a9e('0x93')](_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x97')])){throw new db[(_0x0a9e('0x94'))][(_0x0a9e('0x76'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e7273);}if(!_[_0x0a9e('0x98')](_0x4e7273,_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x97')])){throw new db['Sequelize'][(_0x0a9e('0x76'))](_0x0a9e('0x99')+_0x4e7273);}_0x436313[_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x97')]]=_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x7e')];return db[_0x0a9e('0x9a')][_0x0a9e('0x5d')]({'where':{'id':_0x34e745[_0x0a9e('0x6f')][_0x0a9e('0x7c')]},'include':[{'model':db['CmContact'],'as':_0x0a9e('0x9b'),'where':_0x436313,'limit':0x1,'order':[[_0x0a9e('0x79'),_0x0a9e('0x9c')]]}]});})[_0x0a9e('0x1d')](handleEntityNotFound(_0x287324,null))[_0x0a9e('0x1d')](function(_0x3942fd){if(_0x3942fd){_0x34e745['list']=_[_0x0a9e('0x9d')](_0x3942fd,['Contacts']);if(_0x3942fd['Contacts']['length']){return _0x3942fd[_0x0a9e('0x9b')][0x0];}var _0x3fa3f2=_[_0x0a9e('0x16')](_0x34e745[_0x0a9e('0x60')],{'firstName':_0x34e745['body'][_0x0a9e('0x7e')],'ListId':_0x3942fd['id']});_0x3fa3f2[_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x97')]]=_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x7e')];return db['CmContact']['create'](_0x3fa3f2,{'fields':_0x1b61d5,'raw':!![]});}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x287324,null))[_0x0a9e('0x1d')](function(_0x2a293f){if(_0x2a293f){_0x34e745['contact']=_0x2a293f;var _0x319752={'ContactId':_0x2a293f['id'],'phone':_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x7e')],'SmsAccountId':_0x517081['params']['id']};var _0x8ad1c0={'ContactId':_0x2a293f['id'],'SmsAccountId':_0x517081[_0x0a9e('0x58')]['id'],'closed':![]};return db[_0x0a9e('0x9e')]['find']({'where':_0x8ad1c0})[_0x0a9e('0x1d')](function(_0x336b30){if(_0x336b30){return[_0x336b30,![]];}return db[_0x0a9e('0x9e')]['create'](_0x319752)['then'](function(_0x53ef46){return[_0x53ef46,!![]];});});}})[_0x0a9e('0x9f')](function(_0x1f50db,_0xcbc73c){_0x34e745[_0x0a9e('0xa0')]=_0x1f50db['get']({'plain':!![]});_0x34e745[_0x0a9e('0xa0')]['created']=![];if(_0xcbc73c){if(_0x34e745[_0x0a9e('0x6f')][_0x0a9e('0xa1')]){_0x34e745[_0x0a9e('0x70')]['push']({'id':0x0,'priority':_0x34e745[_0x0a9e('0x70')][_0x0a9e('0x47')]+0x1,'app':_0x0a9e('0xa2'),'appdata':'unmanaged','interval':_0x0a9e('0xa3')});}_0x34e745['interaction'][_0x0a9e('0xa4')]=!![];}return db['SmsMessage'][_0x0a9e('0x5a')]({'phone':_0x34e745['body'][_0x0a9e('0x7e')],'messageId':_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x81')],'body':_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x60')],'SmsAccountId':_0x517081[_0x0a9e('0x58')]['id'],'SmsInteractionId':_0x1f50db['id'],'direction':'in','ContactId':_0x1f50db[_0x0a9e('0xa5')],'AttachmentId':_0x34e745['body'][_0x0a9e('0xa6')]});})[_0x0a9e('0x1d')](function(_0x567004){_0x34e745[_0x0a9e('0x26')]=_0x567004;if(_0x34e745[_0x0a9e('0xa0')]['UserId']){return db[_0x0a9e('0xa7')][_0x0a9e('0x5d')]({'attributes':['id',_0x0a9e('0x3a')],'where':{'id':_0x34e745['interaction'][_0x0a9e('0xa8')]}})[_0x0a9e('0x1d')](function(_0xdeb5e4){if(_0xdeb5e4){_0x34e745[_0x0a9e('0x70')][_0x0a9e('0xa9')]({'id':0x0,'priority':0x0,'app':_0x0a9e('0xaa'),'appdata':_0xdeb5e4[_0x0a9e('0x3a')]+','+(_0x34e745[_0x0a9e('0x6f')][_0x0a9e('0xab')]||0xa),'interval':_0x0a9e('0xa3')});}return respondWithRpcPromise('Start',_0x0a9e('0xac'),_0x34e745);});}return respondWithRpcPromise('Start',_0x0a9e('0xac'),_0x34e745);})[_0x0a9e('0x1d')](function(_0x5b9c76){if(_0x5b9c76){var _0x315e31=0xc8;var _0x5d577b=_0x0a9e('0xad');logger['info'](_0x0a9e('0x22'),_0x5d577b,_0x315e31,_0x0a9e('0xae'));logger[_0x0a9e('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x5d577b,_0x315e31,_0x0a9e('0xae'),JSON[_0x0a9e('0x23')](_0x5b9c76));if(_0x34e745[_0x0a9e('0x6f')][_0x0a9e('0x51')]===_0x0a9e('0xaf')){return _0x287324[_0x0a9e('0x2a')](_0x315e31)[_0x0a9e('0x2f')]('Content-Type',_0x0a9e('0xb0'))[_0x0a9e('0x3b')](_0x0a9e('0xb1'));}else{return _0x287324[_0x0a9e('0x2a')](_0x315e31)[_0x0a9e('0x30')](_0x5b9c76);}}})[_0x0a9e('0x28')](handleError(_0x287324,null));};exports[_0x0a9e('0xb2')]=function(_0x5d6a48,_0x5c8720,_0x10aa22){return db[_0x0a9e('0x3e')][_0x0a9e('0x6a')]({'where':{'id':_0x5d6a48[_0x0a9e('0x58')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x5c8720,null))[_0x0a9e('0x1d')](function(_0x609711){if(_0x609711){return db['sequelize'][_0x0a9e('0xb3')](function(_0x1d7fc4){return db[_0x0a9e('0x6e')][_0x0a9e('0x35')]({'where':{'SmsAccountId':_0x5d6a48[_0x0a9e('0x58')]['id']},'transaction':_0x1d7fc4})[_0x0a9e('0x1d')](function(_0x16be7e){var _0x54f0b8=_[_0x0a9e('0x50')](_0x5d6a48[_0x0a9e('0x60')],function(_0x231826){_0x231826['SmsAccountId']=_0x5d6a48[_0x0a9e('0x58')]['id'];return _0x231826;});return db[_0x0a9e('0x6e')][_0x0a9e('0xb4')](_0x54f0b8,{'transaction':_0x1d7fc4});});})[_0x0a9e('0x1d')](function(){return db['SmsApplication'][_0x0a9e('0xb5')]({'where':{'SmsAccountId':_0x5d6a48[_0x0a9e('0x58')]['id']},'order':_0x0a9e('0x73')});});}})[_0x0a9e('0x1d')](respondWithResult(_0x5c8720,null))[_0x0a9e('0x28')](handleError(_0x5c8720,null));};exports[_0x0a9e('0xb6')]=function(_0x3e365c,_0x385e5d,_0x4e5dec){var _0x3ede01={};var _0x266aa1={};var _0x25e41f;var _0x397771;return db['SmsAccount']['findOne']({'where':{'id':_0x3e365c[_0x0a9e('0x58')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x385e5d,null))[_0x0a9e('0x1d')](function(_0x596ba3){if(_0x596ba3){_0x25e41f=_0x596ba3;_0x266aa1[_0x0a9e('0x41')]=_[_0x0a9e('0x43')](db['SmsApplication'][_0x0a9e('0x3f')]);_0x266aa1['query']=_[_0x0a9e('0x43')](_0x3e365c['query']);_0x266aa1['filters']=_['intersection'](_0x266aa1[_0x0a9e('0x41')],_0x266aa1[_0x0a9e('0x42')]);_0x3ede01[_0x0a9e('0x46')]=_[_0x0a9e('0x44')](_0x266aa1[_0x0a9e('0x41')],qs[_0x0a9e('0x45')](_0x3e365c['query'][_0x0a9e('0x45')]));_0x3ede01[_0x0a9e('0x46')]=_0x3ede01[_0x0a9e('0x46')][_0x0a9e('0x47')]?_0x3ede01[_0x0a9e('0x46')]:_0x266aa1[_0x0a9e('0x41')];_0x3ede01[_0x0a9e('0x4a')]=qs['sort'](_0x3e365c['query'][_0x0a9e('0x4b')]);_0x3ede01['where']=qs[_0x0a9e('0x4d')](_[_0x0a9e('0x4e')](_0x3e365c[_0x0a9e('0x42')],_0x266aa1[_0x0a9e('0x4d')]));if(_0x3e365c[_0x0a9e('0x42')][_0x0a9e('0x4f')]){_0x3ede01['where']=_[_0x0a9e('0x53')](_0x3ede01['where'],{'$or':_['map'](_0x3ede01[_0x0a9e('0x46')],function(_0x593f9e){var _0x38dceb={};_0x38dceb[_0x593f9e]={'$like':'%'+_0x3e365c['query']['filter']+'%'};return _0x38dceb;})});}_0x3ede01=_[_0x0a9e('0x53')]({},_0x3ede01,_0x3e365c['options']);return _0x25e41f[_0x0a9e('0xb6')](_0x3ede01);}})[_0x0a9e('0x1d')](function(_0xe1ab0d){if(_0xe1ab0d){_0x397771=_0xe1ab0d['length'];if(!_0x3e365c[_0x0a9e('0x42')][_0x0a9e('0x48')](_0x0a9e('0x49'))){_0x3ede01['limit']=qs['limit'](_0x3e365c[_0x0a9e('0x42')][_0x0a9e('0x2e')]);_0x3ede01[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x3e365c[_0x0a9e('0x42')][_0x0a9e('0x2d')]);}return _0x25e41f[_0x0a9e('0xb6')](_0x3ede01);}})[_0x0a9e('0x1d')](function(_0x937b2a){if(_0x937b2a){return _0x937b2a?{'count':_0x397771,'rows':_0x937b2a}:null;}})[_0x0a9e('0x1d')](respondWithResult(_0x385e5d,null))['catch'](handleError(_0x385e5d,null));};exports['getInteractions']=function(_0x558171,_0x5975fa,_0x19dcc2){var _0x2ce30f={'raw':![],'where':{}};var _0x2d21c7={};var _0xb0e231={'count':0x0,'rows':[]};return db[_0x0a9e('0x3e')][_0x0a9e('0x6a')]({'where':{'id':_0x558171[_0x0a9e('0x58')]['id']}})['then'](handleEntityNotFound(_0x5975fa,null))['then'](function(_0x2869cc){if(_0x2869cc){_0x2d21c7[_0x0a9e('0x41')]=_['keys'](db[_0x0a9e('0x9e')][_0x0a9e('0x3f')]);_0x2d21c7[_0x0a9e('0x42')]=_[_0x0a9e('0x43')](_0x558171[_0x0a9e('0x42')]);_0x2d21c7[_0x0a9e('0x4d')]=_[_0x0a9e('0x44')](_0x2d21c7[_0x0a9e('0x41')],_0x2d21c7[_0x0a9e('0x42')]);_0x2ce30f[_0x0a9e('0x46')]=_[_0x0a9e('0x44')](_0x2d21c7[_0x0a9e('0x41')],qs['fields'](_0x558171[_0x0a9e('0x42')][_0x0a9e('0x45')]));_0x2ce30f[_0x0a9e('0x46')]=_0x2ce30f[_0x0a9e('0x46')][_0x0a9e('0x47')]?_0x2ce30f[_0x0a9e('0x46')]:_0x2d21c7[_0x0a9e('0x41')];if(!_0x558171[_0x0a9e('0x42')][_0x0a9e('0x48')](_0x0a9e('0x49'))){_0x2ce30f[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x558171['query']['limit']);_0x2ce30f[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x558171[_0x0a9e('0x42')][_0x0a9e('0x2d')]);}_0x2ce30f[_0x0a9e('0x4a')]=qs[_0x0a9e('0x4b')](_0x558171[_0x0a9e('0x42')]['sort']);_0x2ce30f[_0x0a9e('0x4c')]=qs['filters'](_[_0x0a9e('0x4e')](_0x558171[_0x0a9e('0x42')],_0x2d21c7[_0x0a9e('0x4d')]));_0x2ce30f[_0x0a9e('0x4c')][_0x0a9e('0x63')]=_0x2869cc['id'];if(_0x558171[_0x0a9e('0x42')][_0x0a9e('0x4f')]){_0x2ce30f[_0x0a9e('0x4c')]=_[_0x0a9e('0x53')](_0x2ce30f[_0x0a9e('0x4c')],{'$or':_[_0x0a9e('0x50')](_0x2ce30f[_0x0a9e('0x46')],function(_0x43111e){var _0x3f7cb6={};_0x3f7cb6[_0x43111e]={'$like':'%'+_0x558171[_0x0a9e('0x42')][_0x0a9e('0x4f')]+'%'};return _0x3f7cb6;})});}_0x2ce30f=_['merge']({},_0x2ce30f,_0x558171['options']);return db[_0x0a9e('0x9e')][_0x0a9e('0x2c')]({'where':_0x2ce30f['where']})['then'](function(_0x2cb05c){_0xb0e231[_0x0a9e('0x2c')]=_0x2cb05c;if(_0x558171[_0x0a9e('0x42')]['includeAll']){_0x2ce30f[_0x0a9e('0x55')]=[{'model':db['CmContact'],'as':_0x0a9e('0xb7'),'required':![]},{'model':db['User'],'as':_0x0a9e('0xb8'),'attributes':['name',_0x0a9e('0xb9'),_0x0a9e('0xba')],'required':![]},{'model':db[_0x0a9e('0xbb')],'as':'Tags','attributes':['id',_0x0a9e('0x3a'),'color'],'where':_0x558171['query'][_0x0a9e('0xbc')]?{'id':_0x558171[_0x0a9e('0x42')][_0x0a9e('0xbc')]}:undefined,'required':_0x558171[_0x0a9e('0x42')][_0x0a9e('0xbc')]?!![]:![]}];}return db[_0x0a9e('0x9e')][_0x0a9e('0xbd')](_0x2ce30f);})[_0x0a9e('0x1d')](function(_0x1a3143){_0xb0e231[_0x0a9e('0x56')]=_0x1a3143;return _0xb0e231;});}})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x5975fa,_0x2ce30f))[_0x0a9e('0x28')](handleError(_0x5975fa,null));};exports[_0x0a9e('0x3b')]=function(_0x19487d,_0xdc4b2f,_0x65141c){var _0x310026,_0x643f66,_0x153de1;if(_['isNil'](_0x19487d[_0x0a9e('0x60')][_0x0a9e('0x60')])||_0x19487d[_0x0a9e('0x60')][_0x0a9e('0x60')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0a9e('0x93')](_0x19487d['body']['to'])){throw new db[(_0x0a9e('0x94'))][(_0x0a9e('0x76'))](_0x0a9e('0xbe'));}_0x310026=_0x19487d[_0x0a9e('0x60')]['to'];return db[_0x0a9e('0x3e')][_0x0a9e('0x5d')]({'where':{'id':_0x19487d[_0x0a9e('0x58')]['id']},'include':[{'model':db[_0x0a9e('0x9a')],'as':_0x0a9e('0xbf'),'include':[{'model':db[_0x0a9e('0x75')],'as':'Contacts','where':{'mobile':_0x310026},'limit':0x1,'order':[[_0x0a9e('0x79'),'DESC']]}]}]})[_0x0a9e('0x1d')](handleEntityNotFound(_0xdc4b2f,null))['then'](function(_0xf4de86){if(_0xf4de86&&_0xf4de86[_0x0a9e('0xbf')]){_0x643f66=_0xf4de86[_0x0a9e('0x36')]({'plain':!![]});if(_0x643f66['List']&&_0x643f66[_0x0a9e('0xbf')][_0x0a9e('0x9b')]['length']){return _0x643f66['List'][_0x0a9e('0x9b')][0x0];}return db[_0x0a9e('0x75')][_0x0a9e('0x5a')](_['defaults'](_0x19487d['body'],{'firstName':_0x310026,'mobile':_0x310026,'phone':_0x310026,'ListId':_0x643f66['ListId']}));}})[_0x0a9e('0x1d')](handleEntityNotFound(_0xdc4b2f,null))[_0x0a9e('0x1d')](function(_0x2b7ba9){if(_0x2b7ba9){_0x153de1=_0x2b7ba9;return db[_0x0a9e('0x9e')][_0x0a9e('0x5d')]({'where':{'ContactId':_0x153de1['id'],'closed':![],'SmsAccountId':_0x643f66['id']}})[_0x0a9e('0x1d')](function(_0x183b9b){if(_0x183b9b){return[_0x183b9b,![]];}return db[_0x0a9e('0x9e')][_0x0a9e('0x5a')]({'UserId':_0x19487d[_0x0a9e('0xc0')]['id'],'ContactId':_0x153de1['id'],'SmsAccountId':_0x643f66['id'],'phone':_0x310026,'firstMsgDirection':_0x0a9e('0xc1'),'Messages':[_[_0x0a9e('0x53')](_0x19487d[_0x0a9e('0x60')],{'read':![],'body':_0x19487d[_0x0a9e('0x60')][_0x0a9e('0x60')],'phone':_0x310026,'SmsAccountId':_0x643f66['id'],'UserId':_0x19487d[_0x0a9e('0xc0')]['id'],'ContactId':_0x153de1['id']})]},{'include':[{'model':db[_0x0a9e('0xc2')],'as':_0x0a9e('0xc3')}]})['then'](function(_0xb33e27){return[_0xb33e27,!![]];});});}})[_0x0a9e('0x9f')](function(_0xf40862,_0x163c3f){if(_0x163c3f){return _0xf40862;}return db[_0x0a9e('0xc2')][_0x0a9e('0x5a')](_['merge'](_0x19487d[_0x0a9e('0x60')],{'read':![],'body':_0x19487d[_0x0a9e('0x60')][_0x0a9e('0x60')],'phone':_0x310026,'SmsAccountId':_0x643f66['id'],'SmsInteractionId':_0xf40862['id'],'UserId':_0x19487d[_0x0a9e('0xc0')]['id'],'ContactId':_0x153de1['id']}))[_0x0a9e('0x1d')](function(_0x3a7383){_0xf40862[_0x0a9e('0xc4')][_0x0a9e('0xc3')]=[];_0xf40862[_0x0a9e('0xc4')]['Messages']['push'](_0x3a7383[_0x0a9e('0xc4')]);return _0xf40862;});})[_0x0a9e('0x1d')](respondWithResult(_0xdc4b2f,null))['catch'](handleError(_0xdc4b2f,null));};exports[_0x0a9e('0x2a')]=function(_0x306aa5,_0x4c8d75,_0x1ca7c8){if(_0x306aa5['body']['id']){delete _0x306aa5[_0x0a9e('0x60')]['id'];}var _0x279c19,_0x58c53c,_0x27a41c;return db[_0x0a9e('0x3e')]['find']({'where':{'id':_0x306aa5[_0x0a9e('0x58')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4c8d75,null))['then'](function(_0x3259dc){if(_0x3259dc){_0x27a41c=_0x3259dc;logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x0a9e('0x2a'),_0x0a9e('0xc5'),_0x3259dc[_0x0a9e('0x51')],util['inspect'](_0x306aa5[_0x0a9e('0x60')],{'showHidden':![],'depth':null}));switch(_0x3259dc[_0x0a9e('0x51')]){case'skebby':if(_0x306aa5[_0x0a9e('0x60')][_0x0a9e('0xc6')]&&_0x306aa5[_0x0a9e('0x60')][_0x0a9e('0x2a')]){_0x58c53c=_0x306aa5[_0x0a9e('0x60')][_0x0a9e('0x2a')];return db[_0x0a9e('0xc2')]['find']({'where':{'messageId':_0x306aa5['body']['skebby_dispatch_id']}});}break;case'connectel':if(_0x306aa5['body'][_0x0a9e('0xc7')]&&_0x306aa5[_0x0a9e('0x60')]['statusInt']){_0x58c53c=_0x306aa5['body'][_0x0a9e('0xc8')];return db['SmsMessage'][_0x0a9e('0x5d')]({'where':{'messageId':_0x306aa5[_0x0a9e('0x60')][_0x0a9e('0xc7')]}});}break;case _0x0a9e('0x86'):if(_0x306aa5[_0x0a9e('0x60')][_0x0a9e('0x87')]&&_0x306aa5['body'][_0x0a9e('0xc9')]){_0x58c53c=_0x306aa5[_0x0a9e('0x60')]['status_code'];return db[_0x0a9e('0xc2')][_0x0a9e('0x5d')]({'where':{'messageId':_0x306aa5[_0x0a9e('0x60')][_0x0a9e('0x87')]}});}break;case _0x0a9e('0x8a'):var _0x2f1cc0=_0x306aa5[_0x0a9e('0x60')]['results'][0x0];if(_0x2f1cc0[_0x0a9e('0x81')]&&_0x2f1cc0['status'][_0x0a9e('0xca')]===_0x0a9e('0xcb')){_0x58c53c=_0x2f1cc0['status'][_0x0a9e('0xca')];return db[_0x0a9e('0xc2')]['find']({'where':{'messageId':_0x2f1cc0[_0x0a9e('0x81')]}});}break;case'clickatell':if(_0x306aa5[_0x0a9e('0x60')][_0x0a9e('0x81')]&&_0x306aa5['body'][_0x0a9e('0x2a')]){_0x58c53c=_0x306aa5['body'][_0x0a9e('0x2a')];return db[_0x0a9e('0xc2')][_0x0a9e('0x5d')]({'where':{'messageId':_0x306aa5[_0x0a9e('0x60')][_0x0a9e('0x81')]}});}break;case _0x0a9e('0x91'):if(_0x306aa5[_0x0a9e('0x60')][0x0]['message']['id']){_0x58c53c=_0x306aa5[_0x0a9e('0x60')][0x0][_0x0a9e('0x51')];return db[_0x0a9e('0xc2')][_0x0a9e('0x5d')]({'where':{'messageId':_0x306aa5[_0x0a9e('0x60')][0x0]['message']['id']}});}break;case _0x0a9e('0xcc'):if(_0x306aa5['body']['redif']&&_0x306aa5[_0x0a9e('0x60')]['status']){_0x58c53c=_0x306aa5[_0x0a9e('0x60')][_0x0a9e('0x2a')];return db['SmsMessage'][_0x0a9e('0x5d')]({'where':{'messageId':_0x306aa5[_0x0a9e('0x60')][_0x0a9e('0xcd')]}});}break;}}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4c8d75,null))[_0x0a9e('0x1d')](function(_0x25eb44){if(_0x25eb44){_0x279c19=_0x25eb44;switch(_0x27a41c[_0x0a9e('0x51')]){case _0x0a9e('0x83'):if(_0x58c53c===_0x0a9e('0xcb')){return _0x279c19['update']({'read':!![]});}else{logger[_0x0a9e('0x24')](_0x0a9e('0x22'),_0x0a9e('0x2a'),_0x0a9e('0x83'),util['inspect'](_0x306aa5[_0x0a9e('0x60')],{'showHidden':![],'depth':null}));}break;case _0x0a9e('0x85'):if(_0x58c53c==='1'){return _0x279c19[_0x0a9e('0x34')]({'read':!![]});}else{logger['error'](_0x0a9e('0x22'),_0x0a9e('0x2a'),_0x0a9e('0x83'),util['inspect'](_0x306aa5[_0x0a9e('0x60')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x306aa5[_0x0a9e('0x60')][_0x0a9e('0xce')]&&_0x58c53c>=0xc8&&_0x58c53c<=0xce){return _0x279c19[_0x0a9e('0x34')]({'read':!![]});}else{logger[_0x0a9e('0x24')](_0x0a9e('0x22'),_0x0a9e('0x2a'),_0x0a9e('0x86'),util['inspect'](_0x306aa5[_0x0a9e('0x60')],{'showHidden':![],'depth':null}));}break;case _0x0a9e('0x8a'):var _0x7c4db6=_0x306aa5[_0x0a9e('0x60')][_0x0a9e('0xcf')][0x0];if(_0x7c4db6[_0x0a9e('0x2a')][_0x0a9e('0xca')]===_0x0a9e('0xcb')){return _0x279c19[_0x0a9e('0x34')]({'read':!![]});}else{logger[_0x0a9e('0x24')](_0x0a9e('0x22'),_0x0a9e('0x2a'),_0x0a9e('0x8a'),util[_0x0a9e('0xd0')](_0x306aa5[_0x0a9e('0x60')],{'showHidden':![],'depth':null}));}break;case _0x0a9e('0x8e'):if(_0x58c53c==_0x0a9e('0xd1')||_0x58c53c==_0x0a9e('0xd2')){return _0x279c19[_0x0a9e('0x34')]({'read':!![]});}else{logger[_0x0a9e('0x24')](_0x0a9e('0x22'),_0x0a9e('0x2a'),_0x0a9e('0x8e'),util['inspect'](_0x306aa5[_0x0a9e('0x60')],{'showHidden':![],'depth':null}));}break;case _0x0a9e('0x91'):if(_0x58c53c==_0x0a9e('0xd3')){return _0x279c19['update']({'read':!![]});}else{logger[_0x0a9e('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0a9e('0x2a'),_0x0a9e('0x91'),util[_0x0a9e('0xd0')](_0x306aa5[_0x0a9e('0x60')],{'showHidden':![],'depth':null}));}break;case _0x0a9e('0xcc'):if(_0x58c53c===_0x0a9e('0xd4')||_0x58c53c===_0x0a9e('0xd5')){return _0x279c19[_0x0a9e('0x34')]({'read':!![]});}else{logger['error'](_0x0a9e('0x22'),_0x0a9e('0x2a'),'intelepeer',util[_0x0a9e('0xd0')](_0x306aa5[_0x0a9e('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x279c19;}})[_0x0a9e('0x1d')](respondWithResult(_0x4c8d75,null))['catch'](handleError(_0x4c8d75,null));};exports[_0x0a9e('0xd6')]=function(_0x4b7211,_0x315299,_0x1bf053){var _0x4803ce,_0x443208,_0x31648e;return db[_0x0a9e('0x3e')][_0x0a9e('0x5d')]({'where':{'id':_0x4b7211[_0x0a9e('0x58')]['id']}})['then'](handleEntityNotFound(_0x315299,null))[_0x0a9e('0x1d')](function(_0x3fc431){if(_0x3fc431){_0x31648e=_0x3fc431;logger['debug'](_0x0a9e('0x22'),_0x0a9e('0x2a'),_0x0a9e('0xc5'),_0x3fc431['type'],util['inspect'](_0x4b7211[_0x0a9e('0x42')],{'showHidden':![],'depth':null}));switch(_0x3fc431[_0x0a9e('0x51')]){case _0x0a9e('0x8b'):if(_0x4b7211[_0x0a9e('0x42')][_0x0a9e('0xd7')]&&_0x4b7211[_0x0a9e('0x42')][_0x0a9e('0xd8')]){_0x443208=_0x4b7211[_0x0a9e('0x42')]['state'];return db['SmsMessage'][_0x0a9e('0x5d')]({'where':{'messageId':_0x4b7211['query'][_0x0a9e('0xd7')]}});}break;}}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x315299,null))[_0x0a9e('0x1d')](function(_0x413f0f){if(_0x413f0f){_0x4803ce=_0x413f0f;switch(_0x31648e['type']){case _0x0a9e('0x8b'):if(_0x443208==='2'||_0x443208==='6'){return _0x4803ce[_0x0a9e('0x34')]({'read':!![]});}else{logger['error'](_0x0a9e('0x22'),'status',_0x0a9e('0x8b'),util[_0x0a9e('0xd0')](_0x4b7211[_0x0a9e('0x42')],{'showHidden':![],'depth':null}));};break;}return _0x4803ce;}})[_0x0a9e('0x1d')](respondWithResult(_0x315299,null))[_0x0a9e('0x28')](handleError(_0x315299,null));};exports[_0x0a9e('0xd9')]=function(_0x595efc,_0x16d50b,_0x580dd2){return db[_0x0a9e('0x3e')][_0x0a9e('0x5d')]({'where':{'id':_0x595efc[_0x0a9e('0x58')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x16d50b,null))[_0x0a9e('0x1d')](function(_0x393e9c){if(_0x393e9c){return _0x393e9c[_0x0a9e('0xd9')](_0x595efc['body'][_0x0a9e('0x67')],_[_0x0a9e('0x9d')](_0x595efc[_0x0a9e('0x60')],[_0x0a9e('0x67'),'id'])||{})[_0x0a9e('0x9f')](function(_0x534f61){for(var _0x3cd588=0x0;_0x3cd588<_0x595efc[_0x0a9e('0x60')]['ids']['length'];_0x3cd588+=0x1){socket[_0x0a9e('0xda')](_0x0a9e('0xdb'),{'UserId':_0x595efc[_0x0a9e('0x60')][_0x0a9e('0x67')][_0x3cd588],'SmsAccountId':_0x595efc[_0x0a9e('0x58')]['id']});}return _0x534f61;});}})[_0x0a9e('0x1d')](respondWithResult(_0x16d50b,null))['catch'](handleError(_0x16d50b,null));};exports[_0x0a9e('0xdc')]=function(_0x13782b,_0x2a9f6e,_0x4bf3c7){return db[_0x0a9e('0x3e')][_0x0a9e('0x5d')]({'where':{'id':_0x13782b[_0x0a9e('0x58')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x2a9f6e,null))['then'](function(_0x5d4935){if(_0x5d4935){return _0x5d4935[_0x0a9e('0xdc')](_0x13782b[_0x0a9e('0x42')][_0x0a9e('0x67')])[_0x0a9e('0x1d')](function(){if(_[_0x0a9e('0xdd')](_0x13782b[_0x0a9e('0x42')][_0x0a9e('0x67')])){for(var _0x23dd12=0x0;_0x23dd12<_0x13782b['query'][_0x0a9e('0x67')]['length'];_0x23dd12+=0x1){socket[_0x0a9e('0xda')](_0x0a9e('0xde'),{'UserId':Number(_0x13782b[_0x0a9e('0x42')]['ids'][_0x23dd12]),'SmsAccountId':Number(_0x13782b['params']['id'])});}}else{socket[_0x0a9e('0xda')]('userSmsAccount:remove',{'UserId':Number(_0x13782b[_0x0a9e('0x42')]['ids']),'SmsAccountId':Number(_0x13782b['params']['id'])});}});}})[_0x0a9e('0x1d')](respondWithStatusCode(_0x2a9f6e,null))[_0x0a9e('0x28')](handleError(_0x2a9f6e,null));};exports[_0x0a9e('0xdf')]=function(_0x2e6482,_0x1f0776,_0x2ac3dc){var _0x2f64ef={};var _0x36287b={};var _0x106e04;var _0x3b3e30;return db[_0x0a9e('0x3e')][_0x0a9e('0x6a')]({'where':{'id':_0x2e6482[_0x0a9e('0x58')]['id']}})['then'](handleEntityNotFound(_0x1f0776,null))['then'](function(_0x3bde76){if(_0x3bde76){_0x106e04=_0x3bde76;_0x36287b['model']=_[_0x0a9e('0x43')](db[_0x0a9e('0xa7')][_0x0a9e('0x3f')]);_0x36287b['query']=_['keys'](_0x2e6482[_0x0a9e('0x42')]);_0x36287b[_0x0a9e('0x4d')]=_[_0x0a9e('0x44')](_0x36287b[_0x0a9e('0x41')],_0x36287b[_0x0a9e('0x42')]);_0x2f64ef[_0x0a9e('0x46')]=_[_0x0a9e('0x44')](_0x36287b['model'],qs[_0x0a9e('0x45')](_0x2e6482['query'][_0x0a9e('0x45')]));_0x2f64ef[_0x0a9e('0x46')]=_0x2f64ef['attributes'][_0x0a9e('0x47')]?_0x2f64ef[_0x0a9e('0x46')]:_0x36287b[_0x0a9e('0x41')];_0x2f64ef[_0x0a9e('0x4a')]=qs[_0x0a9e('0x4b')](_0x2e6482[_0x0a9e('0x42')]['sort']);_0x2f64ef[_0x0a9e('0x4c')]=qs[_0x0a9e('0x4d')](_[_0x0a9e('0x4e')](_0x2e6482['query'],_0x36287b[_0x0a9e('0x4d')]));if(_0x2e6482[_0x0a9e('0x42')][_0x0a9e('0x4f')]){_0x2f64ef['where']=_[_0x0a9e('0x53')](_0x2f64ef[_0x0a9e('0x4c')],{'$or':_[_0x0a9e('0x50')](_0x2f64ef[_0x0a9e('0x46')],function(_0x1d39bd){var _0x20a792={};_0x20a792[_0x1d39bd]={'$like':'%'+_0x2e6482['query']['filter']+'%'};return _0x20a792;})});}_0x2f64ef=_[_0x0a9e('0x53')]({},_0x2f64ef,_0x2e6482[_0x0a9e('0x59')]);return _0x106e04['getAgents'](_0x2f64ef);}})[_0x0a9e('0x1d')](function(_0x356370){if(_0x356370){_0x3b3e30=_0x356370[_0x0a9e('0x47')];if(!_0x2e6482[_0x0a9e('0x42')][_0x0a9e('0x48')](_0x0a9e('0x49'))){_0x2f64ef['limit']=qs[_0x0a9e('0x2e')](_0x2e6482[_0x0a9e('0x42')][_0x0a9e('0x2e')]);_0x2f64ef['offset']=qs[_0x0a9e('0x2d')](_0x2e6482[_0x0a9e('0x42')][_0x0a9e('0x2d')]);}return _0x106e04[_0x0a9e('0xdf')](_0x2f64ef);}})['then'](function(_0x49bb4f){if(_0x49bb4f){return _0x49bb4f?{'count':_0x3b3e30,'rows':_0x49bb4f}:null;}})[_0x0a9e('0x1d')](respondWithResult(_0x1f0776,null))[_0x0a9e('0x28')](handleError(_0x1f0776,null));}; \ No newline at end of file +var _0xa9e0=['omit','SmsInteraction','spread','interaction','autoclose','close','*,*,*,*','created','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','receiveMessage','entity\x20found','twilio','text/xml','\x0a','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','Contact','Owner','fullname','internal','Tag','tag','findAll','to\x20is\x20mandatory','List','user','out','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','intelepeer','redif','error_code','results','inspect','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','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','./smsAccount.socket','register','jayson/promise','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map','type','VIRTUAL','merge','includeAll','include','rows','show','params','options','create','role','UserProfileSection','find','userProfileId','autoAssociation','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','notify','sms','SmsApplication','account','applications','orderBy','Applications','priority','asc','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','from','From','Body','messageId','MessageSid','skebby','text','connectel','clicksend','message_id','plivo','Text','infobip','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','refid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC'];(function(_0x5e4f80,_0x405409){var _0x56cadf=function(_0x406e22){while(--_0x406e22){_0x5e4f80['push'](_0x5e4f80['shift']());}};_0x56cadf(++_0x405409);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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});function respondWithRpcPromise(_0x52a03d,_0x22dccb,_0x5d0880,_0x1985b6){return new BPromise(function(_0x519dfd,_0x16033c){var _0x12066b=_0x1985b6||client;return _0x12066b['request'](_0x52a03d,_0x5d0880)[_0x0a9e('0x1d')](function(_0x5a0a06){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x22dccb,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x22dccb,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x5a0a06));if(_0x5a0a06[_0x0a9e('0x24')]){if(_0x5a0a06[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger[_0x0a9e('0x24')](_0x0a9e('0x1f'),_0x22dccb,_0x5a0a06['error'][_0x0a9e('0x26')]);return _0x16033c(_0x5a0a06[_0x0a9e('0x24')]['message']);}logger[_0x0a9e('0x24')]('SmsAccount,\x20%s,\x20%s',_0x22dccb,_0x5a0a06['error'][_0x0a9e('0x26')]);return _0x519dfd(_0x5a0a06[_0x0a9e('0x24')][_0x0a9e('0x26')]);}else{logger[_0x0a9e('0x1e')]('SmsAccount,\x20%s,\x20%s',_0x22dccb,_0x0a9e('0x20'));_0x519dfd(_0x5a0a06[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x370d86){logger[_0x0a9e('0x24')](_0x0a9e('0x1f'),_0x22dccb,_0x370d86);_0x16033c(_0x370d86);});});}function respondWithStatusCode(_0x5ea472,_0x59181e){_0x59181e=_0x59181e||0xcc;return function(_0x197ec0){if(_0x197ec0){return _0x5ea472[_0x0a9e('0x29')](_0x59181e);}return _0x5ea472[_0x0a9e('0x2a')](_0x59181e)[_0x0a9e('0x2b')]();};}function respondWithResult(_0x526cf3,_0x384319){_0x384319=_0x384319||0xc8;return function(_0x479bc4){if(_0x479bc4){return _0x526cf3[_0x0a9e('0x2a')](_0x384319)['json'](_0x479bc4);}};}function respondWithFilteredResult(_0x1dc186,_0x34dc65){return function(_0x25fba9){if(_0x25fba9){var _0x14433c=_0x25fba9[_0x0a9e('0x2c')],_0x140511=_0x34dc65['offset'],_0x1538a4=_0x34dc65[_0x0a9e('0x2d')]+_0x34dc65[_0x0a9e('0x2e')],_0x11c3b6;if(_0x1538a4>=_0x14433c){_0x1538a4=_0x14433c;_0x11c3b6=0xc8;}else{_0x11c3b6=0xce;}_0x1dc186[_0x0a9e('0x2a')](_0x11c3b6);return _0x1dc186[_0x0a9e('0x2f')]('Content-Range',_0x140511+'-'+_0x1538a4+'/'+_0x14433c)[_0x0a9e('0x30')](_0x25fba9);}return null;};}function patchUpdates(_0x40e7a3){return function(_0x1843b2){try{jsonpatch[_0x0a9e('0x31')](_0x1843b2,_0x40e7a3,!![]);}catch(_0x58b06f){return BPromise[_0x0a9e('0x32')](_0x58b06f);}return _0x1843b2[_0x0a9e('0x33')]();};}function saveUpdates(_0x2e8759,_0x1dbde2){return function(_0x540530){if(_0x540530){return _0x540530[_0x0a9e('0x34')](_0x2e8759)['then'](function(_0x2407f9){return _0x2407f9;});}return null;};}function removeEntity(_0x3ae878,_0x1122db){return function(_0x33bdb7){if(_0x33bdb7){return _0x33bdb7[_0x0a9e('0x35')]()['then'](function(){var _0x66c1d2=_0x33bdb7[_0x0a9e('0x36')]({'plain':!![]});var _0x40cb85=_0x0a9e('0x37');return db[_0x0a9e('0x38')][_0x0a9e('0x35')]({'where':{'type':_0x40cb85,'resourceId':_0x66c1d2['id']}})[_0x0a9e('0x1d')](function(){return _0x33bdb7;});})[_0x0a9e('0x1d')](function(){_0x3ae878['status'](0xcc)[_0x0a9e('0x2b')]();});}};}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('0x39')]);if(_0x191e91[_0x0a9e('0x3a')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x3b')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={'include':[{'model':db[_0x0a9e('0x3c')],'as':_0x0a9e('0x3d')}]},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x3cae=_['map'](db[_0x0a9e('0x3e')][_0x0a9e('0x3f')],function(_0x289467){return{'name':_0x289467['fieldName'],'type':_0x289467['type'][_0x0a9e('0x40')]};});_0x1ef87a[_0x0a9e('0x41')]=_['map'](_0x3cae,_0x0a9e('0x3a'));_0x1ef87a[_0x0a9e('0x42')]=_[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x42')]);_0x1ef87a['filters']=_['intersection'](_0x1ef87a[_0x0a9e('0x41')],_0x1ef87a[_0x0a9e('0x42')]);_0x381c37['attributes']=_[_0x0a9e('0x44')](_0x1ef87a[_0x0a9e('0x41')],qs[_0x0a9e('0x45')](_0x24936a['query'][_0x0a9e('0x45')]));_0x381c37[_0x0a9e('0x46')]=_0x381c37[_0x0a9e('0x46')][_0x0a9e('0x47')]?_0x381c37[_0x0a9e('0x46')]:_0x1ef87a[_0x0a9e('0x41')];if(!_0x24936a[_0x0a9e('0x42')][_0x0a9e('0x48')](_0x0a9e('0x49'))){_0x381c37[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x24936a[_0x0a9e('0x42')][_0x0a9e('0x2e')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a['query']['offset']);}_0x381c37[_0x0a9e('0x4a')]=qs[_0x0a9e('0x4b')](_0x24936a[_0x0a9e('0x42')][_0x0a9e('0x4b')]);_0x381c37[_0x0a9e('0x4c')]=qs[_0x0a9e('0x4d')](_[_0x0a9e('0x4e')](_0x24936a[_0x0a9e('0x42')],_0x1ef87a[_0x0a9e('0x4d')]),_0x3cae);if(_0x24936a[_0x0a9e('0x42')][_0x0a9e('0x4f')]){_0x381c37[_0x0a9e('0x4c')]=_['merge'](_0x381c37[_0x0a9e('0x4c')],{'$or':_[_0x0a9e('0x50')](_0x3cae,function(_0xdd268f){if(_0xdd268f[_0x0a9e('0x51')]!==_0x0a9e('0x52')){var _0xbe9d19={};_0xbe9d19[_0xdd268f[_0x0a9e('0x3a')]]={'$like':'%'+_0x24936a[_0x0a9e('0x42')]['filter']+'%'};return _0xbe9d19;}})});}_0x381c37=_[_0x0a9e('0x53')]({},_0x381c37,_0x24936a['options']);var _0x473dc8={'where':_0x381c37[_0x0a9e('0x4c')]};return db[_0x0a9e('0x3e')]['count'](_0x473dc8)[_0x0a9e('0x1d')](function(_0x7f6eb1){_0x4f41ae[_0x0a9e('0x2c')]=_0x7f6eb1;if(_0x24936a[_0x0a9e('0x42')][_0x0a9e('0x54')]){_0x381c37[_0x0a9e('0x55')]=[{'all':!![]}];}return db[_0x0a9e('0x3e')]['findAll'](_0x381c37);})[_0x0a9e('0x1d')](function(_0x1bde3c){_0x4f41ae[_0x0a9e('0x56')]=_0x1bde3c;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x57')]=function(_0x6054ee,_0x19383e){var _0x34febd={'raw':![],'where':{'id':_0x6054ee[_0x0a9e('0x58')]['id']},'include':[{'model':db[_0x0a9e('0x3c')],'as':'mandatoryDispositionPause'}]},_0x58a5c2={};_0x58a5c2['model']=_['keys'](db[_0x0a9e('0x3e')][_0x0a9e('0x3f')]);_0x58a5c2[_0x0a9e('0x42')]=_[_0x0a9e('0x43')](_0x6054ee[_0x0a9e('0x42')]);_0x58a5c2[_0x0a9e('0x4d')]=_[_0x0a9e('0x44')](_0x58a5c2[_0x0a9e('0x41')],_0x58a5c2['query']);_0x34febd['attributes']=_['intersection'](_0x58a5c2[_0x0a9e('0x41')],qs[_0x0a9e('0x45')](_0x6054ee[_0x0a9e('0x42')]['fields']));_0x34febd[_0x0a9e('0x46')]=_0x34febd[_0x0a9e('0x46')]['length']?_0x34febd['attributes']:_0x58a5c2[_0x0a9e('0x41')];if(_0x6054ee['query'][_0x0a9e('0x54')]){_0x34febd['include']=[{'all':!![]}];}_0x34febd=_[_0x0a9e('0x53')]({},_0x34febd,_0x6054ee[_0x0a9e('0x59')]);return db[_0x0a9e('0x3e')]['find'](_0x34febd)[_0x0a9e('0x1d')](handleEntityNotFound(_0x19383e,null))[_0x0a9e('0x1d')](respondWithResult(_0x19383e,null))['catch'](handleError(_0x19383e,null));};exports['create']=function(_0x128aa6,_0x3aedd0){return db['SmsAccount'][_0x0a9e('0x5a')](_0x128aa6['body'],{})[_0x0a9e('0x1d')](function(_0x523cd2){var _0xe22ccc=_0x128aa6['user']['get']({'plain':!![]});if(!_0xe22ccc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe22ccc[_0x0a9e('0x5b')]==='user'){var _0x2f7092=_0x523cd2[_0x0a9e('0x36')]({'plain':!![]});var _0x3cfd00=_0x0a9e('0x37');return db[_0x0a9e('0x5c')][_0x0a9e('0x5d')]({'where':{'name':_0x3cfd00,'userProfileId':_0xe22ccc[_0x0a9e('0x5e')]},'raw':!![]})[_0x0a9e('0x1d')](function(_0x4e67ab){if(_0x4e67ab&&_0x4e67ab[_0x0a9e('0x5f')]===0x0){return db[_0x0a9e('0x38')][_0x0a9e('0x5a')]({'name':_0x2f7092[_0x0a9e('0x3a')],'resourceId':_0x2f7092['id'],'type':_0x4e67ab[_0x0a9e('0x3a')],'sectionId':_0x4e67ab['id']},{})[_0x0a9e('0x1d')](function(){return _0x523cd2;});}else{return _0x523cd2;}})['catch'](function(_0x956fbe){logger[_0x0a9e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x956fbe);throw _0x956fbe;});}return _0x523cd2;})[_0x0a9e('0x1d')](respondWithResult(_0x3aedd0,0xc9))['catch'](handleError(_0x3aedd0,null));};exports[_0x0a9e('0x34')]=function(_0x5ba1f9,_0x4b3c1a){if(_0x5ba1f9['body']['id']){delete _0x5ba1f9[_0x0a9e('0x60')]['id'];}return db['SmsAccount'][_0x0a9e('0x5d')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x58')]['id']},'include':[{'model':db[_0x0a9e('0x3c')],'as':_0x0a9e('0x3d')}]})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))[_0x0a9e('0x1d')](saveUpdates(_0x5ba1f9['body'],null))[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};exports[_0x0a9e('0x35')]=function(_0x1f07cb,_0x51aaf7){return db['SmsAccount'][_0x0a9e('0x5d')]({'where':{'id':_0x1f07cb[_0x0a9e('0x58')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x51aaf7,null))[_0x0a9e('0x1d')](removeEntity(_0x51aaf7,null))['catch'](handleError(_0x51aaf7,null));};exports[_0x0a9e('0x61')]=function(_0xe05a5a,_0x54327c){return db[_0x0a9e('0x3e')][_0x0a9e('0x61')]()[_0x0a9e('0x1d')](respondWithResult(_0x54327c,null))[_0x0a9e('0x28')](handleError(_0x54327c,null));};exports[_0x0a9e('0x62')]=function(_0x4d4a35,_0x176840,_0x2937e0){if(_0x4d4a35[_0x0a9e('0x60')]['id']){delete _0x4d4a35['body']['id'];}return db[_0x0a9e('0x3e')]['find']({'where':{'id':_0x4d4a35['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x176840,null))[_0x0a9e('0x1d')](function(_0x9375fb){if(_0x9375fb){_0x4d4a35[_0x0a9e('0x60')][_0x0a9e('0x63')]=_0x9375fb['id'];return db[_0x0a9e('0x64')][_0x0a9e('0x5a')](_0x4d4a35[_0x0a9e('0x60')]);}})[_0x0a9e('0x1d')](respondWithResult(_0x176840,null))[_0x0a9e('0x28')](handleError(_0x176840,null));};exports[_0x0a9e('0x65')]=function(_0x19012b,_0x2bbb86,_0x2b8192){var _0x320898={'raw':![],'where':{}};var _0x412a72={};var _0x2a28c0={'count':0x0,'rows':[]};return db[_0x0a9e('0x3e')]['findOne']({'where':{'id':_0x19012b[_0x0a9e('0x58')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x2bbb86,null))[_0x0a9e('0x1d')](function(_0x4edbb0){if(_0x4edbb0){_0x412a72[_0x0a9e('0x41')]=_[_0x0a9e('0x43')](db['Disposition'][_0x0a9e('0x3f')]);_0x412a72[_0x0a9e('0x42')]=_[_0x0a9e('0x43')](_0x19012b[_0x0a9e('0x42')]);_0x412a72[_0x0a9e('0x4d')]=_['intersection'](_0x412a72['model'],_0x412a72['query']);_0x320898[_0x0a9e('0x46')]=_[_0x0a9e('0x44')](_0x412a72[_0x0a9e('0x41')],qs[_0x0a9e('0x45')](_0x19012b[_0x0a9e('0x42')][_0x0a9e('0x45')]));_0x320898[_0x0a9e('0x46')]=_0x320898[_0x0a9e('0x46')]['length']?_0x320898[_0x0a9e('0x46')]:_0x412a72[_0x0a9e('0x41')];if(!_0x19012b[_0x0a9e('0x42')]['hasOwnProperty'](_0x0a9e('0x49'))){_0x320898['limit']=qs[_0x0a9e('0x2e')](_0x19012b[_0x0a9e('0x42')]['limit']);_0x320898[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x19012b[_0x0a9e('0x42')][_0x0a9e('0x2d')]);}_0x320898['order']=qs[_0x0a9e('0x4b')](_0x19012b[_0x0a9e('0x42')][_0x0a9e('0x4b')]);_0x320898[_0x0a9e('0x4c')]=qs['filters'](_[_0x0a9e('0x4e')](_0x19012b[_0x0a9e('0x42')],_0x412a72[_0x0a9e('0x4d')]));_0x320898[_0x0a9e('0x4c')]['SmsAccountId']=_0x4edbb0['id'];if(_0x19012b[_0x0a9e('0x42')][_0x0a9e('0x4f')]){_0x320898[_0x0a9e('0x4c')]=_[_0x0a9e('0x53')](_0x320898[_0x0a9e('0x4c')],{'$or':_[_0x0a9e('0x50')](_0x320898[_0x0a9e('0x46')],function(_0x3df0e3){var _0x1a7b03={};_0x1a7b03[_0x3df0e3]={'$like':'%'+_0x19012b[_0x0a9e('0x42')][_0x0a9e('0x4f')]+'%'};return _0x1a7b03;})});}_0x320898=_[_0x0a9e('0x53')]({},_0x320898,_0x19012b[_0x0a9e('0x59')]);return db[_0x0a9e('0x64')]['count']({'where':_0x320898[_0x0a9e('0x4c')]})[_0x0a9e('0x1d')](function(_0xc599b3){_0x2a28c0['count']=_0xc599b3;if(_0x19012b[_0x0a9e('0x42')][_0x0a9e('0x54')]){_0x320898[_0x0a9e('0x55')]=[{'all':!![]}];}return db[_0x0a9e('0x64')]['findAll'](_0x320898);})['then'](function(_0x7ebea8){_0x2a28c0[_0x0a9e('0x56')]=_0x7ebea8;return _0x2a28c0;});}})['then'](respondWithFilteredResult(_0x2bbb86,_0x320898))[_0x0a9e('0x28')](handleError(_0x2bbb86,null));};exports['removeDispositions']=function(_0x260f4b,_0x8ebf02,_0x5637a1){return db[_0x0a9e('0x3e')][_0x0a9e('0x5d')]({'where':{'id':_0x260f4b[_0x0a9e('0x58')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x8ebf02,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){return _0x1f42a0[_0x0a9e('0x66')](_0x260f4b['query'][_0x0a9e('0x67')]);}})[_0x0a9e('0x1d')](respondWithStatusCode(_0x8ebf02,null))[_0x0a9e('0x28')](handleError(_0x8ebf02,null));};exports[_0x0a9e('0x68')]=function(_0x492543,_0xf51744,_0xf0db1){if(_0x492543['body']['id']){delete _0x492543[_0x0a9e('0x60')]['id'];}return db['SmsAccount'][_0x0a9e('0x5d')]({'where':{'id':_0x492543[_0x0a9e('0x58')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0xf51744,null))[_0x0a9e('0x1d')](function(_0x5af453){if(_0x5af453){_0x492543['body'][_0x0a9e('0x63')]=_0x5af453['id'];return db[_0x0a9e('0x69')][_0x0a9e('0x5a')](_0x492543['body']);}})[_0x0a9e('0x1d')](respondWithResult(_0xf51744,null))[_0x0a9e('0x28')](handleError(_0xf51744,null));};exports['getAnswers']=function(_0x4e46b2,_0xf0a802,_0x56acca){var _0x5ea541={'raw':![],'where':{}};var _0x4dc6b3={};var _0x81d748={'count':0x0,'rows':[]};return db[_0x0a9e('0x3e')][_0x0a9e('0x6a')]({'where':{'id':_0x4e46b2[_0x0a9e('0x58')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0xf0a802,null))[_0x0a9e('0x1d')](function(_0x5a8854){if(_0x5a8854){_0x4dc6b3[_0x0a9e('0x41')]=_['keys'](db[_0x0a9e('0x69')][_0x0a9e('0x3f')]);_0x4dc6b3[_0x0a9e('0x42')]=_[_0x0a9e('0x43')](_0x4e46b2['query']);_0x4dc6b3[_0x0a9e('0x4d')]=_[_0x0a9e('0x44')](_0x4dc6b3[_0x0a9e('0x41')],_0x4dc6b3['query']);_0x5ea541[_0x0a9e('0x46')]=_[_0x0a9e('0x44')](_0x4dc6b3[_0x0a9e('0x41')],qs[_0x0a9e('0x45')](_0x4e46b2[_0x0a9e('0x42')][_0x0a9e('0x45')]));_0x5ea541[_0x0a9e('0x46')]=_0x5ea541[_0x0a9e('0x46')]['length']?_0x5ea541[_0x0a9e('0x46')]:_0x4dc6b3[_0x0a9e('0x41')];if(!_0x4e46b2['query'][_0x0a9e('0x48')](_0x0a9e('0x49'))){_0x5ea541[_0x0a9e('0x2e')]=qs['limit'](_0x4e46b2[_0x0a9e('0x42')]['limit']);_0x5ea541[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x4e46b2[_0x0a9e('0x42')][_0x0a9e('0x2d')]);}_0x5ea541[_0x0a9e('0x4a')]=qs[_0x0a9e('0x4b')](_0x4e46b2[_0x0a9e('0x42')][_0x0a9e('0x4b')]);_0x5ea541['where']=qs[_0x0a9e('0x4d')](_[_0x0a9e('0x4e')](_0x4e46b2[_0x0a9e('0x42')],_0x4dc6b3[_0x0a9e('0x4d')]));_0x5ea541[_0x0a9e('0x4c')][_0x0a9e('0x63')]=_0x5a8854['id'];if(_0x4e46b2[_0x0a9e('0x42')][_0x0a9e('0x4f')]){_0x5ea541[_0x0a9e('0x4c')]=_[_0x0a9e('0x53')](_0x5ea541[_0x0a9e('0x4c')],{'$or':_[_0x0a9e('0x50')](_0x5ea541[_0x0a9e('0x46')],function(_0x4989f9){var _0xc81b64={};_0xc81b64[_0x4989f9]={'$like':'%'+_0x4e46b2[_0x0a9e('0x42')][_0x0a9e('0x4f')]+'%'};return _0xc81b64;})});}_0x5ea541=_[_0x0a9e('0x53')]({},_0x5ea541,_0x4e46b2[_0x0a9e('0x59')]);return db['CannedAnswer'][_0x0a9e('0x2c')]({'where':_0x5ea541[_0x0a9e('0x4c')]})['then'](function(_0x23b447){_0x81d748['count']=_0x23b447;if(_0x4e46b2[_0x0a9e('0x42')][_0x0a9e('0x54')]){_0x5ea541[_0x0a9e('0x55')]=[{'all':!![]}];}return db[_0x0a9e('0x69')]['findAll'](_0x5ea541);})[_0x0a9e('0x1d')](function(_0x4cf72d){_0x81d748[_0x0a9e('0x56')]=_0x4cf72d;return _0x81d748;});}})[_0x0a9e('0x1d')](respondWithFilteredResult(_0xf0a802,_0x5ea541))['catch'](handleError(_0xf0a802,null));};exports[_0x0a9e('0x6b')]=function(_0x63c9f7,_0x1dd541,_0x4ab276){return db['SmsAccount'][_0x0a9e('0x5d')]({'where':{'id':_0x63c9f7[_0x0a9e('0x58')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x1dd541,null))[_0x0a9e('0x1d')](function(_0x3f2f40){if(_0x3f2f40){return _0x3f2f40[_0x0a9e('0x6b')](_0x63c9f7[_0x0a9e('0x42')][_0x0a9e('0x67')]);}})[_0x0a9e('0x1d')](respondWithStatusCode(_0x1dd541,null))['catch'](handleError(_0x1dd541,null));};exports[_0x0a9e('0x6c')]=function(_0x517081,_0x287324,_0x2f7791){var _0x34e745={'channel':_0x0a9e('0x6d')};var _0x1b61d5=[];var _0x4e7273=[];var _0x436313={};return db[_0x0a9e('0x3e')][_0x0a9e('0x5d')]({'where':{'id':_0x517081[_0x0a9e('0x58')]['id']},'include':[{'model':db[_0x0a9e('0x6e')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x287324,null))[_0x0a9e('0x1d')](function(_0x583662){_0x34e745[_0x0a9e('0x6f')]=_0x583662;_0x34e745[_0x0a9e('0x70')]=_[_0x0a9e('0x71')](_0x583662[_0x0a9e('0x72')],[_0x0a9e('0x73')],[_0x0a9e('0x74')]);if(_0x34e745['account']['Applications']){delete _0x34e745[_0x0a9e('0x6f')]['Applications'];}return db[_0x0a9e('0x75')]['describe']();})[_0x0a9e('0x1d')](function(_0x564db2){if(!_0x564db2){throw new db['Sequelize'][(_0x0a9e('0x76'))](_0x0a9e('0x77'));}_0x1b61d5=_['difference'](_[_0x0a9e('0x43')](_0x564db2),[_0x0a9e('0x78'),_0x0a9e('0x79')]);_0x4e7273=_[_0x0a9e('0x7a')](_[_0x0a9e('0x43')](_0x564db2),['createdAt','updatedAt',_0x0a9e('0x7b'),_0x0a9e('0x7c')]);_0x34e745[_0x0a9e('0x60')]={'mapKey':_0x0a9e('0x7d')};if(_0x34e745[_0x0a9e('0x6f')]['type']){switch(_0x34e745[_0x0a9e('0x6f')][_0x0a9e('0x51')]){case'twilio':_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x7e')]=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x7f')];_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x60')]=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x80')];_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x81')]=_0x517081['body'][_0x0a9e('0x82')];break;case _0x0a9e('0x83'):_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x7e')]='+'+_0x517081[_0x0a9e('0x60')]['sender'];_0x34e745['body'][_0x0a9e('0x60')]=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x84')];break;case _0x0a9e('0x85'):_0x34e745[_0x0a9e('0x60')]['from']=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x7e')];_0x34e745[_0x0a9e('0x60')]['body']=_0x517081[_0x0a9e('0x60')]['message'];break;case _0x0a9e('0x86'):_0x34e745['body'][_0x0a9e('0x7e')]=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x7e')];_0x34e745['body'][_0x0a9e('0x60')]=_0x517081['body'][_0x0a9e('0x60')];_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x81')]=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x87')];break;case _0x0a9e('0x88'):_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x7e')]=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x7f')];_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x60')]=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x89')];_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x81')]=_0x517081['body']['MessageUUID'];break;case _0x0a9e('0x8a'):_0x34e745['body'][_0x0a9e('0x7e')]='+'+_0x517081[_0x0a9e('0x60')]['results'][0x0][_0x0a9e('0x7e')];_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x60')]=_0x517081[_0x0a9e('0x60')]['results'][0x0][_0x0a9e('0x84')];_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x81')]=_0x517081[_0x0a9e('0x60')]['results'][0x0][_0x0a9e('0x81')];break;case _0x0a9e('0x8b'):_0x34e745[_0x0a9e('0x60')]['from']=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x8c')];_0x34e745[_0x0a9e('0x60')]['body']=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x8d')][_0x0a9e('0x26')];break;case _0x0a9e('0x8e'):_0x34e745[_0x0a9e('0x60')]['from']=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x8f')];_0x34e745['body'][_0x0a9e('0x60')]=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x84')];_0x34e745['body']['messageId']=_0x517081['body'][_0x0a9e('0x90')];break;case _0x0a9e('0x91'):_0x34e745['body'][_0x0a9e('0x81')]=_0x517081[_0x0a9e('0x60')][0x0][_0x0a9e('0x26')]['id'];_0x34e745['body'][_0x0a9e('0x7e')]=_0x517081[_0x0a9e('0x60')][0x0][_0x0a9e('0x26')][_0x0a9e('0x7e')];_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x60')]=_0x517081[_0x0a9e('0x60')][0x0][_0x0a9e('0x26')][_0x0a9e('0x84')];break;case'intelepeer':_0x34e745[_0x0a9e('0x60')]['from']=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x7e')];_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x60')]=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x26')];_0x34e745['body'][_0x0a9e('0x81')]=_0x517081[_0x0a9e('0x60')][_0x0a9e('0x92')];break;}}if(_0x34e745[_0x0a9e('0x60')]['id']){delete _0x34e745['body']['id'];}if(_[_0x0a9e('0x93')](_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x7e')])){throw new db[(_0x0a9e('0x94'))][(_0x0a9e('0x76'))](_0x0a9e('0x95'));}if(_[_0x0a9e('0x93')](_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x60')])||_0x34e745[_0x0a9e('0x60')]['body']===''){throw new db[(_0x0a9e('0x94'))][(_0x0a9e('0x76'))](_0x0a9e('0x96'));}if(_[_0x0a9e('0x93')](_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x97')])){throw new db[(_0x0a9e('0x94'))][(_0x0a9e('0x76'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e7273);}if(!_[_0x0a9e('0x98')](_0x4e7273,_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x97')])){throw new db['Sequelize'][(_0x0a9e('0x76'))](_0x0a9e('0x99')+_0x4e7273);}_0x436313[_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x97')]]=_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x7e')];return db[_0x0a9e('0x9a')][_0x0a9e('0x5d')]({'where':{'id':_0x34e745[_0x0a9e('0x6f')][_0x0a9e('0x7c')]},'include':[{'model':db['CmContact'],'as':_0x0a9e('0x9b'),'where':_0x436313,'limit':0x1,'order':[[_0x0a9e('0x79'),_0x0a9e('0x9c')]]}]});})[_0x0a9e('0x1d')](handleEntityNotFound(_0x287324,null))[_0x0a9e('0x1d')](function(_0x3942fd){if(_0x3942fd){_0x34e745['list']=_[_0x0a9e('0x9d')](_0x3942fd,['Contacts']);if(_0x3942fd['Contacts']['length']){return _0x3942fd[_0x0a9e('0x9b')][0x0];}var _0x3fa3f2=_[_0x0a9e('0x16')](_0x34e745[_0x0a9e('0x60')],{'firstName':_0x34e745['body'][_0x0a9e('0x7e')],'ListId':_0x3942fd['id']});_0x3fa3f2[_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x97')]]=_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x7e')];return db['CmContact']['create'](_0x3fa3f2,{'fields':_0x1b61d5,'raw':!![]});}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x287324,null))[_0x0a9e('0x1d')](function(_0x2a293f){if(_0x2a293f){_0x34e745['contact']=_0x2a293f;var _0x319752={'ContactId':_0x2a293f['id'],'phone':_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x7e')],'SmsAccountId':_0x517081['params']['id']};var _0x8ad1c0={'ContactId':_0x2a293f['id'],'SmsAccountId':_0x517081[_0x0a9e('0x58')]['id'],'closed':![]};return db[_0x0a9e('0x9e')]['find']({'where':_0x8ad1c0})[_0x0a9e('0x1d')](function(_0x336b30){if(_0x336b30){return[_0x336b30,![]];}return db[_0x0a9e('0x9e')]['create'](_0x319752)['then'](function(_0x53ef46){return[_0x53ef46,!![]];});});}})[_0x0a9e('0x9f')](function(_0x1f50db,_0xcbc73c){_0x34e745[_0x0a9e('0xa0')]=_0x1f50db['get']({'plain':!![]});_0x34e745[_0x0a9e('0xa0')]['created']=![];if(_0xcbc73c){if(_0x34e745[_0x0a9e('0x6f')][_0x0a9e('0xa1')]){_0x34e745[_0x0a9e('0x70')]['push']({'id':0x0,'priority':_0x34e745[_0x0a9e('0x70')][_0x0a9e('0x47')]+0x1,'app':_0x0a9e('0xa2'),'appdata':'unmanaged','interval':_0x0a9e('0xa3')});}_0x34e745['interaction'][_0x0a9e('0xa4')]=!![];}return db['SmsMessage'][_0x0a9e('0x5a')]({'phone':_0x34e745['body'][_0x0a9e('0x7e')],'messageId':_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x81')],'body':_0x34e745[_0x0a9e('0x60')][_0x0a9e('0x60')],'SmsAccountId':_0x517081[_0x0a9e('0x58')]['id'],'SmsInteractionId':_0x1f50db['id'],'direction':'in','ContactId':_0x1f50db[_0x0a9e('0xa5')],'AttachmentId':_0x34e745['body'][_0x0a9e('0xa6')]});})[_0x0a9e('0x1d')](function(_0x567004){_0x34e745[_0x0a9e('0x26')]=_0x567004;if(_0x34e745[_0x0a9e('0xa0')]['UserId']){return db[_0x0a9e('0xa7')][_0x0a9e('0x5d')]({'attributes':['id',_0x0a9e('0x3a')],'where':{'id':_0x34e745['interaction'][_0x0a9e('0xa8')]}})[_0x0a9e('0x1d')](function(_0xdeb5e4){if(_0xdeb5e4){_0x34e745[_0x0a9e('0x70')][_0x0a9e('0xa9')]({'id':0x0,'priority':0x0,'app':_0x0a9e('0xaa'),'appdata':_0xdeb5e4[_0x0a9e('0x3a')]+','+(_0x34e745[_0x0a9e('0x6f')][_0x0a9e('0xab')]||0xa),'interval':_0x0a9e('0xa3')});}return respondWithRpcPromise('Start',_0x0a9e('0xac'),_0x34e745);});}return respondWithRpcPromise('Start',_0x0a9e('0xac'),_0x34e745);})[_0x0a9e('0x1d')](function(_0x5b9c76){if(_0x5b9c76){var _0x315e31=0xc8;var _0x5d577b=_0x0a9e('0xad');logger['info'](_0x0a9e('0x22'),_0x5d577b,_0x315e31,_0x0a9e('0xae'));logger[_0x0a9e('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x5d577b,_0x315e31,_0x0a9e('0xae'),JSON[_0x0a9e('0x23')](_0x5b9c76));if(_0x34e745[_0x0a9e('0x6f')][_0x0a9e('0x51')]===_0x0a9e('0xaf')){return _0x287324[_0x0a9e('0x2a')](_0x315e31)[_0x0a9e('0x2f')]('Content-Type',_0x0a9e('0xb0'))[_0x0a9e('0x3b')](_0x0a9e('0xb1'));}else{return _0x287324[_0x0a9e('0x2a')](_0x315e31)[_0x0a9e('0x30')](_0x5b9c76);}}})[_0x0a9e('0x28')](handleError(_0x287324,null));};exports[_0x0a9e('0xb2')]=function(_0x5d6a48,_0x5c8720,_0x10aa22){return db[_0x0a9e('0x3e')][_0x0a9e('0x6a')]({'where':{'id':_0x5d6a48[_0x0a9e('0x58')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x5c8720,null))[_0x0a9e('0x1d')](function(_0x609711){if(_0x609711){return db['sequelize'][_0x0a9e('0xb3')](function(_0x1d7fc4){return db[_0x0a9e('0x6e')][_0x0a9e('0x35')]({'where':{'SmsAccountId':_0x5d6a48[_0x0a9e('0x58')]['id']},'transaction':_0x1d7fc4})[_0x0a9e('0x1d')](function(_0x16be7e){var _0x54f0b8=_[_0x0a9e('0x50')](_0x5d6a48[_0x0a9e('0x60')],function(_0x231826){_0x231826['SmsAccountId']=_0x5d6a48[_0x0a9e('0x58')]['id'];return _0x231826;});return db[_0x0a9e('0x6e')][_0x0a9e('0xb4')](_0x54f0b8,{'transaction':_0x1d7fc4});});})[_0x0a9e('0x1d')](function(){return db['SmsApplication'][_0x0a9e('0xb5')]({'where':{'SmsAccountId':_0x5d6a48[_0x0a9e('0x58')]['id']},'order':_0x0a9e('0x73')});});}})[_0x0a9e('0x1d')](respondWithResult(_0x5c8720,null))[_0x0a9e('0x28')](handleError(_0x5c8720,null));};exports[_0x0a9e('0xb6')]=function(_0x3e365c,_0x385e5d,_0x4e5dec){var _0x3ede01={};var _0x266aa1={};var _0x25e41f;var _0x397771;return db['SmsAccount']['findOne']({'where':{'id':_0x3e365c[_0x0a9e('0x58')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x385e5d,null))[_0x0a9e('0x1d')](function(_0x596ba3){if(_0x596ba3){_0x25e41f=_0x596ba3;_0x266aa1[_0x0a9e('0x41')]=_[_0x0a9e('0x43')](db['SmsApplication'][_0x0a9e('0x3f')]);_0x266aa1['query']=_[_0x0a9e('0x43')](_0x3e365c['query']);_0x266aa1['filters']=_['intersection'](_0x266aa1[_0x0a9e('0x41')],_0x266aa1[_0x0a9e('0x42')]);_0x3ede01[_0x0a9e('0x46')]=_[_0x0a9e('0x44')](_0x266aa1[_0x0a9e('0x41')],qs[_0x0a9e('0x45')](_0x3e365c['query'][_0x0a9e('0x45')]));_0x3ede01[_0x0a9e('0x46')]=_0x3ede01[_0x0a9e('0x46')][_0x0a9e('0x47')]?_0x3ede01[_0x0a9e('0x46')]:_0x266aa1[_0x0a9e('0x41')];_0x3ede01[_0x0a9e('0x4a')]=qs['sort'](_0x3e365c['query'][_0x0a9e('0x4b')]);_0x3ede01['where']=qs[_0x0a9e('0x4d')](_[_0x0a9e('0x4e')](_0x3e365c[_0x0a9e('0x42')],_0x266aa1[_0x0a9e('0x4d')]));if(_0x3e365c[_0x0a9e('0x42')][_0x0a9e('0x4f')]){_0x3ede01['where']=_[_0x0a9e('0x53')](_0x3ede01['where'],{'$or':_['map'](_0x3ede01[_0x0a9e('0x46')],function(_0x593f9e){var _0x38dceb={};_0x38dceb[_0x593f9e]={'$like':'%'+_0x3e365c['query']['filter']+'%'};return _0x38dceb;})});}_0x3ede01=_[_0x0a9e('0x53')]({},_0x3ede01,_0x3e365c['options']);return _0x25e41f[_0x0a9e('0xb6')](_0x3ede01);}})[_0x0a9e('0x1d')](function(_0xe1ab0d){if(_0xe1ab0d){_0x397771=_0xe1ab0d['length'];if(!_0x3e365c[_0x0a9e('0x42')][_0x0a9e('0x48')](_0x0a9e('0x49'))){_0x3ede01['limit']=qs['limit'](_0x3e365c[_0x0a9e('0x42')][_0x0a9e('0x2e')]);_0x3ede01[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x3e365c[_0x0a9e('0x42')][_0x0a9e('0x2d')]);}return _0x25e41f[_0x0a9e('0xb6')](_0x3ede01);}})[_0x0a9e('0x1d')](function(_0x937b2a){if(_0x937b2a){return _0x937b2a?{'count':_0x397771,'rows':_0x937b2a}:null;}})[_0x0a9e('0x1d')](respondWithResult(_0x385e5d,null))['catch'](handleError(_0x385e5d,null));};exports['getInteractions']=function(_0x558171,_0x5975fa,_0x19dcc2){var _0x2ce30f={'raw':![],'where':{}};var _0x2d21c7={};var _0xb0e231={'count':0x0,'rows':[]};return db[_0x0a9e('0x3e')][_0x0a9e('0x6a')]({'where':{'id':_0x558171[_0x0a9e('0x58')]['id']}})['then'](handleEntityNotFound(_0x5975fa,null))['then'](function(_0x2869cc){if(_0x2869cc){_0x2d21c7[_0x0a9e('0x41')]=_['keys'](db[_0x0a9e('0x9e')][_0x0a9e('0x3f')]);_0x2d21c7[_0x0a9e('0x42')]=_[_0x0a9e('0x43')](_0x558171[_0x0a9e('0x42')]);_0x2d21c7[_0x0a9e('0x4d')]=_[_0x0a9e('0x44')](_0x2d21c7[_0x0a9e('0x41')],_0x2d21c7[_0x0a9e('0x42')]);_0x2ce30f[_0x0a9e('0x46')]=_[_0x0a9e('0x44')](_0x2d21c7[_0x0a9e('0x41')],qs['fields'](_0x558171[_0x0a9e('0x42')][_0x0a9e('0x45')]));_0x2ce30f[_0x0a9e('0x46')]=_0x2ce30f[_0x0a9e('0x46')][_0x0a9e('0x47')]?_0x2ce30f[_0x0a9e('0x46')]:_0x2d21c7[_0x0a9e('0x41')];if(!_0x558171[_0x0a9e('0x42')][_0x0a9e('0x48')](_0x0a9e('0x49'))){_0x2ce30f[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x558171['query']['limit']);_0x2ce30f[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x558171[_0x0a9e('0x42')][_0x0a9e('0x2d')]);}_0x2ce30f[_0x0a9e('0x4a')]=qs[_0x0a9e('0x4b')](_0x558171[_0x0a9e('0x42')]['sort']);_0x2ce30f[_0x0a9e('0x4c')]=qs['filters'](_[_0x0a9e('0x4e')](_0x558171[_0x0a9e('0x42')],_0x2d21c7[_0x0a9e('0x4d')]));_0x2ce30f[_0x0a9e('0x4c')][_0x0a9e('0x63')]=_0x2869cc['id'];if(_0x558171[_0x0a9e('0x42')][_0x0a9e('0x4f')]){_0x2ce30f[_0x0a9e('0x4c')]=_[_0x0a9e('0x53')](_0x2ce30f[_0x0a9e('0x4c')],{'$or':_[_0x0a9e('0x50')](_0x2ce30f[_0x0a9e('0x46')],function(_0x43111e){var _0x3f7cb6={};_0x3f7cb6[_0x43111e]={'$like':'%'+_0x558171[_0x0a9e('0x42')][_0x0a9e('0x4f')]+'%'};return _0x3f7cb6;})});}_0x2ce30f=_['merge']({},_0x2ce30f,_0x558171['options']);return db[_0x0a9e('0x9e')][_0x0a9e('0x2c')]({'where':_0x2ce30f['where']})['then'](function(_0x2cb05c){_0xb0e231[_0x0a9e('0x2c')]=_0x2cb05c;if(_0x558171[_0x0a9e('0x42')]['includeAll']){_0x2ce30f[_0x0a9e('0x55')]=[{'model':db['CmContact'],'as':_0x0a9e('0xb7'),'required':![]},{'model':db['User'],'as':_0x0a9e('0xb8'),'attributes':['name',_0x0a9e('0xb9'),_0x0a9e('0xba')],'required':![]},{'model':db[_0x0a9e('0xbb')],'as':'Tags','attributes':['id',_0x0a9e('0x3a'),'color'],'where':_0x558171['query'][_0x0a9e('0xbc')]?{'id':_0x558171[_0x0a9e('0x42')][_0x0a9e('0xbc')]}:undefined,'required':_0x558171[_0x0a9e('0x42')][_0x0a9e('0xbc')]?!![]:![]}];}return db[_0x0a9e('0x9e')][_0x0a9e('0xbd')](_0x2ce30f);})[_0x0a9e('0x1d')](function(_0x1a3143){_0xb0e231[_0x0a9e('0x56')]=_0x1a3143;return _0xb0e231;});}})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x5975fa,_0x2ce30f))[_0x0a9e('0x28')](handleError(_0x5975fa,null));};exports[_0x0a9e('0x3b')]=function(_0x19487d,_0xdc4b2f,_0x65141c){var _0x310026,_0x643f66,_0x153de1;if(_['isNil'](_0x19487d[_0x0a9e('0x60')][_0x0a9e('0x60')])||_0x19487d[_0x0a9e('0x60')][_0x0a9e('0x60')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0a9e('0x93')](_0x19487d['body']['to'])){throw new db[(_0x0a9e('0x94'))][(_0x0a9e('0x76'))](_0x0a9e('0xbe'));}_0x310026=_0x19487d[_0x0a9e('0x60')]['to'];return db[_0x0a9e('0x3e')][_0x0a9e('0x5d')]({'where':{'id':_0x19487d[_0x0a9e('0x58')]['id']},'include':[{'model':db[_0x0a9e('0x9a')],'as':_0x0a9e('0xbf'),'include':[{'model':db[_0x0a9e('0x75')],'as':'Contacts','where':{'mobile':_0x310026},'limit':0x1,'order':[[_0x0a9e('0x79'),'DESC']]}]}]})[_0x0a9e('0x1d')](handleEntityNotFound(_0xdc4b2f,null))['then'](function(_0xf4de86){if(_0xf4de86&&_0xf4de86[_0x0a9e('0xbf')]){_0x643f66=_0xf4de86[_0x0a9e('0x36')]({'plain':!![]});if(_0x643f66['List']&&_0x643f66[_0x0a9e('0xbf')][_0x0a9e('0x9b')]['length']){return _0x643f66['List'][_0x0a9e('0x9b')][0x0];}return db[_0x0a9e('0x75')][_0x0a9e('0x5a')](_['defaults'](_0x19487d['body'],{'firstName':_0x310026,'mobile':_0x310026,'phone':_0x310026,'ListId':_0x643f66['ListId']}));}})[_0x0a9e('0x1d')](handleEntityNotFound(_0xdc4b2f,null))[_0x0a9e('0x1d')](function(_0x2b7ba9){if(_0x2b7ba9){_0x153de1=_0x2b7ba9;return db[_0x0a9e('0x9e')][_0x0a9e('0x5d')]({'where':{'ContactId':_0x153de1['id'],'closed':![],'SmsAccountId':_0x643f66['id']}})[_0x0a9e('0x1d')](function(_0x183b9b){if(_0x183b9b){return[_0x183b9b,![]];}return db[_0x0a9e('0x9e')][_0x0a9e('0x5a')]({'UserId':_0x19487d[_0x0a9e('0xc0')]['id'],'ContactId':_0x153de1['id'],'SmsAccountId':_0x643f66['id'],'phone':_0x310026,'firstMsgDirection':_0x0a9e('0xc1'),'Messages':[_[_0x0a9e('0x53')](_0x19487d[_0x0a9e('0x60')],{'read':![],'body':_0x19487d[_0x0a9e('0x60')][_0x0a9e('0x60')],'phone':_0x310026,'SmsAccountId':_0x643f66['id'],'UserId':_0x19487d[_0x0a9e('0xc0')]['id'],'ContactId':_0x153de1['id']})]},{'include':[{'model':db[_0x0a9e('0xc2')],'as':_0x0a9e('0xc3')}]})['then'](function(_0xb33e27){return[_0xb33e27,!![]];});});}})[_0x0a9e('0x9f')](function(_0xf40862,_0x163c3f){if(_0x163c3f){return _0xf40862;}return db[_0x0a9e('0xc2')][_0x0a9e('0x5a')](_['merge'](_0x19487d[_0x0a9e('0x60')],{'read':![],'body':_0x19487d[_0x0a9e('0x60')][_0x0a9e('0x60')],'phone':_0x310026,'SmsAccountId':_0x643f66['id'],'SmsInteractionId':_0xf40862['id'],'UserId':_0x19487d[_0x0a9e('0xc0')]['id'],'ContactId':_0x153de1['id']}))[_0x0a9e('0x1d')](function(_0x3a7383){_0xf40862[_0x0a9e('0xc4')][_0x0a9e('0xc3')]=[];_0xf40862[_0x0a9e('0xc4')]['Messages']['push'](_0x3a7383[_0x0a9e('0xc4')]);return _0xf40862;});})[_0x0a9e('0x1d')](respondWithResult(_0xdc4b2f,null))['catch'](handleError(_0xdc4b2f,null));};exports[_0x0a9e('0x2a')]=function(_0x306aa5,_0x4c8d75,_0x1ca7c8){if(_0x306aa5['body']['id']){delete _0x306aa5[_0x0a9e('0x60')]['id'];}var _0x279c19,_0x58c53c,_0x27a41c;return db[_0x0a9e('0x3e')]['find']({'where':{'id':_0x306aa5[_0x0a9e('0x58')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4c8d75,null))['then'](function(_0x3259dc){if(_0x3259dc){_0x27a41c=_0x3259dc;logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x0a9e('0x2a'),_0x0a9e('0xc5'),_0x3259dc[_0x0a9e('0x51')],util['inspect'](_0x306aa5[_0x0a9e('0x60')],{'showHidden':![],'depth':null}));switch(_0x3259dc[_0x0a9e('0x51')]){case'skebby':if(_0x306aa5[_0x0a9e('0x60')][_0x0a9e('0xc6')]&&_0x306aa5[_0x0a9e('0x60')][_0x0a9e('0x2a')]){_0x58c53c=_0x306aa5[_0x0a9e('0x60')][_0x0a9e('0x2a')];return db[_0x0a9e('0xc2')]['find']({'where':{'messageId':_0x306aa5['body']['skebby_dispatch_id']}});}break;case'connectel':if(_0x306aa5['body'][_0x0a9e('0xc7')]&&_0x306aa5[_0x0a9e('0x60')]['statusInt']){_0x58c53c=_0x306aa5['body'][_0x0a9e('0xc8')];return db['SmsMessage'][_0x0a9e('0x5d')]({'where':{'messageId':_0x306aa5[_0x0a9e('0x60')][_0x0a9e('0xc7')]}});}break;case _0x0a9e('0x86'):if(_0x306aa5[_0x0a9e('0x60')][_0x0a9e('0x87')]&&_0x306aa5['body'][_0x0a9e('0xc9')]){_0x58c53c=_0x306aa5[_0x0a9e('0x60')]['status_code'];return db[_0x0a9e('0xc2')][_0x0a9e('0x5d')]({'where':{'messageId':_0x306aa5[_0x0a9e('0x60')][_0x0a9e('0x87')]}});}break;case _0x0a9e('0x8a'):var _0x2f1cc0=_0x306aa5[_0x0a9e('0x60')]['results'][0x0];if(_0x2f1cc0[_0x0a9e('0x81')]&&_0x2f1cc0['status'][_0x0a9e('0xca')]===_0x0a9e('0xcb')){_0x58c53c=_0x2f1cc0['status'][_0x0a9e('0xca')];return db[_0x0a9e('0xc2')]['find']({'where':{'messageId':_0x2f1cc0[_0x0a9e('0x81')]}});}break;case'clickatell':if(_0x306aa5[_0x0a9e('0x60')][_0x0a9e('0x81')]&&_0x306aa5['body'][_0x0a9e('0x2a')]){_0x58c53c=_0x306aa5['body'][_0x0a9e('0x2a')];return db[_0x0a9e('0xc2')][_0x0a9e('0x5d')]({'where':{'messageId':_0x306aa5[_0x0a9e('0x60')][_0x0a9e('0x81')]}});}break;case _0x0a9e('0x91'):if(_0x306aa5[_0x0a9e('0x60')][0x0]['message']['id']){_0x58c53c=_0x306aa5[_0x0a9e('0x60')][0x0][_0x0a9e('0x51')];return db[_0x0a9e('0xc2')][_0x0a9e('0x5d')]({'where':{'messageId':_0x306aa5[_0x0a9e('0x60')][0x0]['message']['id']}});}break;case _0x0a9e('0xcc'):if(_0x306aa5['body']['redif']&&_0x306aa5[_0x0a9e('0x60')]['status']){_0x58c53c=_0x306aa5[_0x0a9e('0x60')][_0x0a9e('0x2a')];return db['SmsMessage'][_0x0a9e('0x5d')]({'where':{'messageId':_0x306aa5[_0x0a9e('0x60')][_0x0a9e('0xcd')]}});}break;}}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4c8d75,null))[_0x0a9e('0x1d')](function(_0x25eb44){if(_0x25eb44){_0x279c19=_0x25eb44;switch(_0x27a41c[_0x0a9e('0x51')]){case _0x0a9e('0x83'):if(_0x58c53c===_0x0a9e('0xcb')){return _0x279c19['update']({'read':!![]});}else{logger[_0x0a9e('0x24')](_0x0a9e('0x22'),_0x0a9e('0x2a'),_0x0a9e('0x83'),util['inspect'](_0x306aa5[_0x0a9e('0x60')],{'showHidden':![],'depth':null}));}break;case _0x0a9e('0x85'):if(_0x58c53c==='1'){return _0x279c19[_0x0a9e('0x34')]({'read':!![]});}else{logger['error'](_0x0a9e('0x22'),_0x0a9e('0x2a'),_0x0a9e('0x83'),util['inspect'](_0x306aa5[_0x0a9e('0x60')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x306aa5[_0x0a9e('0x60')][_0x0a9e('0xce')]&&_0x58c53c>=0xc8&&_0x58c53c<=0xce){return _0x279c19[_0x0a9e('0x34')]({'read':!![]});}else{logger[_0x0a9e('0x24')](_0x0a9e('0x22'),_0x0a9e('0x2a'),_0x0a9e('0x86'),util['inspect'](_0x306aa5[_0x0a9e('0x60')],{'showHidden':![],'depth':null}));}break;case _0x0a9e('0x8a'):var _0x7c4db6=_0x306aa5[_0x0a9e('0x60')][_0x0a9e('0xcf')][0x0];if(_0x7c4db6[_0x0a9e('0x2a')][_0x0a9e('0xca')]===_0x0a9e('0xcb')){return _0x279c19[_0x0a9e('0x34')]({'read':!![]});}else{logger[_0x0a9e('0x24')](_0x0a9e('0x22'),_0x0a9e('0x2a'),_0x0a9e('0x8a'),util[_0x0a9e('0xd0')](_0x306aa5[_0x0a9e('0x60')],{'showHidden':![],'depth':null}));}break;case _0x0a9e('0x8e'):if(_0x58c53c==_0x0a9e('0xd1')||_0x58c53c==_0x0a9e('0xd2')){return _0x279c19[_0x0a9e('0x34')]({'read':!![]});}else{logger[_0x0a9e('0x24')](_0x0a9e('0x22'),_0x0a9e('0x2a'),_0x0a9e('0x8e'),util['inspect'](_0x306aa5[_0x0a9e('0x60')],{'showHidden':![],'depth':null}));}break;case _0x0a9e('0x91'):if(_0x58c53c==_0x0a9e('0xd3')){return _0x279c19['update']({'read':!![]});}else{logger[_0x0a9e('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0a9e('0x2a'),_0x0a9e('0x91'),util[_0x0a9e('0xd0')](_0x306aa5[_0x0a9e('0x60')],{'showHidden':![],'depth':null}));}break;case _0x0a9e('0xcc'):if(_0x58c53c===_0x0a9e('0xd4')||_0x58c53c===_0x0a9e('0xd5')){return _0x279c19[_0x0a9e('0x34')]({'read':!![]});}else{logger['error'](_0x0a9e('0x22'),_0x0a9e('0x2a'),'intelepeer',util[_0x0a9e('0xd0')](_0x306aa5[_0x0a9e('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x279c19;}})[_0x0a9e('0x1d')](respondWithResult(_0x4c8d75,null))['catch'](handleError(_0x4c8d75,null));};exports[_0x0a9e('0xd6')]=function(_0x4b7211,_0x315299,_0x1bf053){var _0x4803ce,_0x443208,_0x31648e;return db[_0x0a9e('0x3e')][_0x0a9e('0x5d')]({'where':{'id':_0x4b7211[_0x0a9e('0x58')]['id']}})['then'](handleEntityNotFound(_0x315299,null))[_0x0a9e('0x1d')](function(_0x3fc431){if(_0x3fc431){_0x31648e=_0x3fc431;logger['debug'](_0x0a9e('0x22'),_0x0a9e('0x2a'),_0x0a9e('0xc5'),_0x3fc431['type'],util['inspect'](_0x4b7211[_0x0a9e('0x42')],{'showHidden':![],'depth':null}));switch(_0x3fc431[_0x0a9e('0x51')]){case _0x0a9e('0x8b'):if(_0x4b7211[_0x0a9e('0x42')][_0x0a9e('0xd7')]&&_0x4b7211[_0x0a9e('0x42')][_0x0a9e('0xd8')]){_0x443208=_0x4b7211[_0x0a9e('0x42')]['state'];return db['SmsMessage'][_0x0a9e('0x5d')]({'where':{'messageId':_0x4b7211['query'][_0x0a9e('0xd7')]}});}break;}}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x315299,null))[_0x0a9e('0x1d')](function(_0x413f0f){if(_0x413f0f){_0x4803ce=_0x413f0f;switch(_0x31648e['type']){case _0x0a9e('0x8b'):if(_0x443208==='2'||_0x443208==='6'){return _0x4803ce[_0x0a9e('0x34')]({'read':!![]});}else{logger['error'](_0x0a9e('0x22'),'status',_0x0a9e('0x8b'),util[_0x0a9e('0xd0')](_0x4b7211[_0x0a9e('0x42')],{'showHidden':![],'depth':null}));};break;}return _0x4803ce;}})[_0x0a9e('0x1d')](respondWithResult(_0x315299,null))[_0x0a9e('0x28')](handleError(_0x315299,null));};exports[_0x0a9e('0xd9')]=function(_0x595efc,_0x16d50b,_0x580dd2){return db[_0x0a9e('0x3e')][_0x0a9e('0x5d')]({'where':{'id':_0x595efc[_0x0a9e('0x58')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x16d50b,null))[_0x0a9e('0x1d')](function(_0x393e9c){if(_0x393e9c){return _0x393e9c[_0x0a9e('0xd9')](_0x595efc['body'][_0x0a9e('0x67')],_[_0x0a9e('0x9d')](_0x595efc[_0x0a9e('0x60')],[_0x0a9e('0x67'),'id'])||{})[_0x0a9e('0x9f')](function(_0x534f61){for(var _0x3cd588=0x0;_0x3cd588<_0x595efc[_0x0a9e('0x60')]['ids']['length'];_0x3cd588+=0x1){socket[_0x0a9e('0xda')](_0x0a9e('0xdb'),{'UserId':_0x595efc[_0x0a9e('0x60')][_0x0a9e('0x67')][_0x3cd588],'SmsAccountId':_0x595efc[_0x0a9e('0x58')]['id']});}return _0x534f61;});}})[_0x0a9e('0x1d')](respondWithResult(_0x16d50b,null))['catch'](handleError(_0x16d50b,null));};exports[_0x0a9e('0xdc')]=function(_0x13782b,_0x2a9f6e,_0x4bf3c7){return db[_0x0a9e('0x3e')][_0x0a9e('0x5d')]({'where':{'id':_0x13782b[_0x0a9e('0x58')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x2a9f6e,null))['then'](function(_0x5d4935){if(_0x5d4935){return _0x5d4935[_0x0a9e('0xdc')](_0x13782b[_0x0a9e('0x42')][_0x0a9e('0x67')])[_0x0a9e('0x1d')](function(){if(_[_0x0a9e('0xdd')](_0x13782b[_0x0a9e('0x42')][_0x0a9e('0x67')])){for(var _0x23dd12=0x0;_0x23dd12<_0x13782b['query'][_0x0a9e('0x67')]['length'];_0x23dd12+=0x1){socket[_0x0a9e('0xda')](_0x0a9e('0xde'),{'UserId':Number(_0x13782b[_0x0a9e('0x42')]['ids'][_0x23dd12]),'SmsAccountId':Number(_0x13782b['params']['id'])});}}else{socket[_0x0a9e('0xda')]('userSmsAccount:remove',{'UserId':Number(_0x13782b[_0x0a9e('0x42')]['ids']),'SmsAccountId':Number(_0x13782b['params']['id'])});}});}})[_0x0a9e('0x1d')](respondWithStatusCode(_0x2a9f6e,null))[_0x0a9e('0x28')](handleError(_0x2a9f6e,null));};exports[_0x0a9e('0xdf')]=function(_0x2e6482,_0x1f0776,_0x2ac3dc){var _0x2f64ef={};var _0x36287b={};var _0x106e04;var _0x3b3e30;return db[_0x0a9e('0x3e')][_0x0a9e('0x6a')]({'where':{'id':_0x2e6482[_0x0a9e('0x58')]['id']}})['then'](handleEntityNotFound(_0x1f0776,null))['then'](function(_0x3bde76){if(_0x3bde76){_0x106e04=_0x3bde76;_0x36287b['model']=_[_0x0a9e('0x43')](db[_0x0a9e('0xa7')][_0x0a9e('0x3f')]);_0x36287b['query']=_['keys'](_0x2e6482[_0x0a9e('0x42')]);_0x36287b[_0x0a9e('0x4d')]=_[_0x0a9e('0x44')](_0x36287b[_0x0a9e('0x41')],_0x36287b[_0x0a9e('0x42')]);_0x2f64ef[_0x0a9e('0x46')]=_[_0x0a9e('0x44')](_0x36287b['model'],qs[_0x0a9e('0x45')](_0x2e6482['query'][_0x0a9e('0x45')]));_0x2f64ef[_0x0a9e('0x46')]=_0x2f64ef['attributes'][_0x0a9e('0x47')]?_0x2f64ef[_0x0a9e('0x46')]:_0x36287b[_0x0a9e('0x41')];_0x2f64ef[_0x0a9e('0x4a')]=qs[_0x0a9e('0x4b')](_0x2e6482[_0x0a9e('0x42')]['sort']);_0x2f64ef[_0x0a9e('0x4c')]=qs[_0x0a9e('0x4d')](_[_0x0a9e('0x4e')](_0x2e6482['query'],_0x36287b[_0x0a9e('0x4d')]));if(_0x2e6482[_0x0a9e('0x42')][_0x0a9e('0x4f')]){_0x2f64ef['where']=_[_0x0a9e('0x53')](_0x2f64ef[_0x0a9e('0x4c')],{'$or':_[_0x0a9e('0x50')](_0x2f64ef[_0x0a9e('0x46')],function(_0x1d39bd){var _0x20a792={};_0x20a792[_0x1d39bd]={'$like':'%'+_0x2e6482['query']['filter']+'%'};return _0x20a792;})});}_0x2f64ef=_[_0x0a9e('0x53')]({},_0x2f64ef,_0x2e6482[_0x0a9e('0x59')]);return _0x106e04['getAgents'](_0x2f64ef);}})[_0x0a9e('0x1d')](function(_0x356370){if(_0x356370){_0x3b3e30=_0x356370[_0x0a9e('0x47')];if(!_0x2e6482[_0x0a9e('0x42')][_0x0a9e('0x48')](_0x0a9e('0x49'))){_0x2f64ef['limit']=qs[_0x0a9e('0x2e')](_0x2e6482[_0x0a9e('0x42')][_0x0a9e('0x2e')]);_0x2f64ef['offset']=qs[_0x0a9e('0x2d')](_0x2e6482[_0x0a9e('0x42')][_0x0a9e('0x2d')]);}return _0x106e04[_0x0a9e('0xdf')](_0x2f64ef);}})['then'](function(_0x49bb4f){if(_0x49bb4f){return _0x49bb4f?{'count':_0x3b3e30,'rows':_0x49bb4f}:null;}})[_0x0a9e('0x1d')](respondWithResult(_0x1f0776,null))[_0x0a9e('0x28')](handleError(_0x1f0776,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 852d086..aad0406 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 _0xae2d=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x48b8c5,_0x5cddb9){var _0x44edc6=function(_0x309089){while(--_0x309089){_0x48b8c5['push'](_0x48b8c5['shift']());}};_0x44edc6(++_0x5cddb9);}(_0xae2d,0x96));var _0xdae2=function(_0x271060,_0x3f86b1){_0x271060=_0x271060-0x0;var _0x40540b=_0xae2d[_0x271060];return _0x40540b;};'use strict';var EventEmitter=require(_0xdae2('0x0'));var SmsAccount=require(_0xdae2('0x1'))['db'][_0xdae2('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xdae2('0x3')](0x0);var events={'afterCreate':_0xdae2('0x4'),'afterUpdate':_0xdae2('0x5'),'afterDestroy':_0xdae2('0x6')};function emitEvent(_0x5a0b12){return function(_0x325946,_0x449b79,_0x436319){SmsAccountEvents['emit'](_0x5a0b12+':'+_0x325946['id'],_0x325946);SmsAccountEvents[_0xdae2('0x7')](_0x5a0b12,_0x325946);_0x436319(null);};}for(var e in events){if(events[_0xdae2('0x8')](e)){var event=events[e];SmsAccount[_0xdae2('0x9')](e,emitEvent(event));}}module[_0xdae2('0xa')]=SmsAccountEvents; \ No newline at end of file +var _0x3464=['../../mysqldb','SmsAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x1c2d7f,_0x5e42ea){var _0x261bdd=function(_0x24d7ae){while(--_0x24d7ae){_0x1c2d7f['push'](_0x1c2d7f['shift']());}};_0x261bdd(++_0x5e42ea);}(_0x3464,0xdb));var _0x4346=function(_0x5ded4f,_0x4e6d3c){_0x5ded4f=_0x5ded4f-0x0;var _0x17e871=_0x3464[_0x5ded4f];return _0x17e871;};'use strict';var EventEmitter=require(_0x4346('0x0'));var SmsAccount=require(_0x4346('0x1'))['db'][_0x4346('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x4346('0x3')](0x0);var events={'afterCreate':_0x4346('0x4'),'afterUpdate':_0x4346('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3f18c0){return function(_0x417498,_0x3b71a3,_0x198d85){SmsAccountEvents[_0x4346('0x6')](_0x3f18c0+':'+_0x417498['id'],_0x417498);SmsAccountEvents[_0x4346('0x6')](_0x3f18c0,_0x417498);_0x198d85(null);};}for(var e in events){if(events[_0x4346('0x7')](e)){var event=events[e];SmsAccount[_0x4346('0x8')](e,emitEvent(event));}}module[_0x4346('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 a35c849..bab721f 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 _0x3476=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','lodash','util'];(function(_0x4e6427,_0x421f9e){var _0xfdf604=function(_0x247103){while(--_0x247103){_0x4e6427['push'](_0x4e6427['shift']());}};_0xfdf604(++_0x421f9e);}(_0x3476,0x152));var _0x6347=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x3476[_0x2642cb];return _0xe6e41;};'use strict';var _=require(_0x6347('0x0'));var util=require(_0x6347('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6347('0x2'));var BPromise=require(_0x6347('0x3'));var rp=require(_0x6347('0x4'));var fs=require('fs');var path=require(_0x6347('0x5'));var rimraf=require(_0x6347('0x6'));var config=require(_0x6347('0x7'));var attributes=require(_0x6347('0x8'));module[_0x6347('0x9')]=function(_0x49e0ae,_0x3e32d2){return _0x49e0ae['define']('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb3f=['bluebird','path','../../config/environment','./smsAccount.attributes','define','SmsAccount','lodash','util','../../config/logger','moment'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0xcb3f,0xa6));var _0xfcb3=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xcb3f[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xfcb3('0x0'));var util=require(_0xfcb3('0x1'));var logger=require(_0xfcb3('0x2'))('api');var moment=require(_0xfcb3('0x3'));var BPromise=require(_0xfcb3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcb3('0x5'));var rimraf=require('rimraf');var config=require(_0xfcb3('0x6'));var attributes=require(_0xfcb3('0x7'));module['exports']=function(_0x3d0fe4,_0x164e5b){return _0x3d0fe4[_0xfcb3('0x8')](_0xfcb3('0x9'),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 8e07fce..ba44e23 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 _0x3fab=['info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','ShowSmsAccount','find','options','raw','where','include','map','model','attributes','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x3fab,0xa7));var _0xb3fa=function(_0xc8d110,_0x283bf8){_0xc8d110=_0xc8d110-0x0;var _0x1c6b66=_0x3fab[_0xc8d110];return _0x1c6b66;};'use strict';var _=require(_0xb3fa('0x0'));var util=require('util');var moment=require(_0xb3fa('0x1'));var BPromise=require(_0xb3fa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3fa('0x3'))['db'];var utils=require(_0xb3fa('0x4'));var logger=require(_0xb3fa('0x5'))(_0xb3fa('0x6'));var config=require(_0xb3fa('0x7'));var jayson=require(_0xb3fa('0x8'));var client=jayson[_0xb3fa('0x9')][_0xb3fa('0xa')]({'port':0x232a});config[_0xb3fa('0xb')]=_['defaults'](config[_0xb3fa('0xb')],{'host':_0xb3fa('0xc'),'port':0x18eb});var socket=require(_0xb3fa('0xd'))(new Redis(config[_0xb3fa('0xb')]));require(_0xb3fa('0xe'))[_0xb3fa('0xf')](socket);function respondWithRpcPromise(_0x1ebb10,_0x4b63f8,_0x426be2){return new BPromise(function(_0x3a529f,_0x33cd2e){return client[_0xb3fa('0x10')](_0x1ebb10,_0x426be2)[_0xb3fa('0x11')](function(_0x1ec8be){logger[_0xb3fa('0x12')](_0xb3fa('0x13'),_0x4b63f8,_0xb3fa('0x14'));logger[_0xb3fa('0x15')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4b63f8,_0xb3fa('0x14'),JSON[_0xb3fa('0x16')](_0x1ec8be));if(_0x1ec8be[_0xb3fa('0x17')]){if(_0x1ec8be[_0xb3fa('0x17')][_0xb3fa('0x18')]===0x1f4){logger['error'](_0xb3fa('0x13'),_0x4b63f8,_0x1ec8be['error'][_0xb3fa('0x19')]);return _0x33cd2e(_0x1ec8be[_0xb3fa('0x17')]['message']);}logger['error'](_0xb3fa('0x13'),_0x4b63f8,_0x1ec8be['error']['message']);return _0x3a529f(_0x1ec8be[_0xb3fa('0x17')]['message']);}else{logger[_0xb3fa('0x12')](_0xb3fa('0x13'),_0x4b63f8,'request\x20sent');_0x3a529f(_0x1ec8be[_0xb3fa('0x1a')][_0xb3fa('0x19')]);}})['catch'](function(_0x2e65af){logger[_0xb3fa('0x17')](_0xb3fa('0x13'),_0x4b63f8,_0x2e65af);_0x33cd2e(_0x2e65af);});});}exports[_0xb3fa('0x1b')]=function(_0x599a02){var _0x486a68=this;return new Promise(function(_0x57173f,_0x217965){return db['SmsAccount'][_0xb3fa('0x1c')]({'raw':_0x599a02[_0xb3fa('0x1d')]?_0x599a02[_0xb3fa('0x1d')][_0xb3fa('0x1e')]===undefined?!![]:![]:!![],'where':_0x599a02['options']?_0x599a02['options'][_0xb3fa('0x1f')]||null:null,'attributes':_0x599a02[_0xb3fa('0x1d')]?_0x599a02[_0xb3fa('0x1d')]['attributes']||null:null,'include':_0x599a02[_0xb3fa('0x1d')]?_0x599a02[_0xb3fa('0x1d')][_0xb3fa('0x20')]?_[_0xb3fa('0x21')](_0x599a02['options'][_0xb3fa('0x20')],function(_0x51723b){return{'model':db[_0x51723b[_0xb3fa('0x22')]],'as':_0x51723b['as'],'attributes':_0x51723b[_0xb3fa('0x23')],'include':_0x51723b['include']?_[_0xb3fa('0x21')](_0x51723b[_0xb3fa('0x20')],function(_0x454472){return{'model':db[_0x454472[_0xb3fa('0x22')]],'as':_0x454472['as'],'attributes':_0x454472[_0xb3fa('0x23')],'include':_0x454472[_0xb3fa('0x20')]?_['map'](_0x454472[_0xb3fa('0x20')],function(_0xc32359){return{'model':db[_0xc32359[_0xb3fa('0x22')]],'as':_0xc32359['as'],'attributes':_0xc32359['attributes']};}):[]};}):[]};}):[]:[]})[_0xb3fa('0x11')](function(_0x2e95a6){logger[_0xb3fa('0x12')](_0xb3fa('0x1b'),_0x599a02);logger[_0xb3fa('0x15')](_0xb3fa('0x1b'),_0x599a02,JSON[_0xb3fa('0x16')](_0x2e95a6));_0x57173f(_0x2e95a6);})[_0xb3fa('0x24')](function(_0x16efd6){logger['error'](_0xb3fa('0x1b'),_0x16efd6[_0xb3fa('0x19')],_0x599a02);_0x217965(_0x486a68['error'](0x1f4,_0x16efd6['message']));});});}; \ No newline at end of file +var _0x458e=['include','map','model','ShowSmsAccount','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SmsAccount','find','options','where','attributes'];(function(_0x29a4ad,_0x33c4bf){var _0x2ac926=function(_0x4c199b){while(--_0x4c199b){_0x29a4ad['push'](_0x29a4ad['shift']());}};_0x2ac926(++_0x33c4bf);}(_0x458e,0x70));var _0xe458=function(_0x444931,_0x9e22c0){_0x444931=_0x444931-0x0;var _0x3ace8c=_0x458e[_0x444931];return _0x3ace8c;};'use strict';var _=require(_0xe458('0x0'));var util=require(_0xe458('0x1'));var moment=require(_0xe458('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe458('0x3'));var db=require(_0xe458('0x4'))['db'];var utils=require(_0xe458('0x5'));var logger=require('../../config/logger')(_0xe458('0x6'));var config=require(_0xe458('0x7'));var jayson=require(_0xe458('0x8'));var client=jayson[_0xe458('0x9')][_0xe458('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe458('0xb')],{'host':_0xe458('0xc'),'port':0x18eb});var socket=require(_0xe458('0xd'))(new Redis(config[_0xe458('0xb')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x1b956d,_0x44e182,_0x1eddbf){return new BPromise(function(_0x3d1a62,_0x21d8b6){return client[_0xe458('0xe')](_0x1b956d,_0x1eddbf)[_0xe458('0xf')](function(_0x1d43a0){logger[_0xe458('0x10')](_0xe458('0x11'),_0x44e182,'request\x20sent');logger[_0xe458('0x12')](_0xe458('0x13'),_0x44e182,_0xe458('0x14'),JSON[_0xe458('0x15')](_0x1d43a0));if(_0x1d43a0[_0xe458('0x16')]){if(_0x1d43a0['error'][_0xe458('0x17')]===0x1f4){logger[_0xe458('0x16')]('SmsAccount,\x20%s,\x20%s',_0x44e182,_0x1d43a0[_0xe458('0x16')]['message']);return _0x21d8b6(_0x1d43a0['error']['message']);}logger['error'](_0xe458('0x11'),_0x44e182,_0x1d43a0[_0xe458('0x16')][_0xe458('0x18')]);return _0x3d1a62(_0x1d43a0[_0xe458('0x16')][_0xe458('0x18')]);}else{logger['info'](_0xe458('0x11'),_0x44e182,_0xe458('0x14'));_0x3d1a62(_0x1d43a0[_0xe458('0x19')][_0xe458('0x18')]);}})[_0xe458('0x1a')](function(_0x3f2dc0){logger[_0xe458('0x16')](_0xe458('0x11'),_0x44e182,_0x3f2dc0);_0x21d8b6(_0x3f2dc0);});});}exports['ShowSmsAccount']=function(_0x2f4057){var _0x3a0368=this;return new Promise(function(_0x42f582,_0xaa667c){return db[_0xe458('0x1b')][_0xe458('0x1c')]({'raw':_0x2f4057[_0xe458('0x1d')]?_0x2f4057[_0xe458('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2f4057[_0xe458('0x1d')]?_0x2f4057[_0xe458('0x1d')][_0xe458('0x1e')]||null:null,'attributes':_0x2f4057[_0xe458('0x1d')]?_0x2f4057[_0xe458('0x1d')][_0xe458('0x1f')]||null:null,'include':_0x2f4057[_0xe458('0x1d')]?_0x2f4057['options'][_0xe458('0x20')]?_[_0xe458('0x21')](_0x2f4057[_0xe458('0x1d')]['include'],function(_0x5af049){return{'model':db[_0x5af049[_0xe458('0x22')]],'as':_0x5af049['as'],'attributes':_0x5af049['attributes'],'include':_0x5af049[_0xe458('0x20')]?_[_0xe458('0x21')](_0x5af049['include'],function(_0x3419ef){return{'model':db[_0x3419ef['model']],'as':_0x3419ef['as'],'attributes':_0x3419ef[_0xe458('0x1f')],'include':_0x3419ef[_0xe458('0x20')]?_['map'](_0x3419ef[_0xe458('0x20')],function(_0x455e07){return{'model':db[_0x455e07[_0xe458('0x22')]],'as':_0x455e07['as'],'attributes':_0x455e07[_0xe458('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe458('0xf')](function(_0x258532){logger['info'](_0xe458('0x23'),_0x2f4057);logger[_0xe458('0x12')](_0xe458('0x23'),_0x2f4057,JSON[_0xe458('0x15')](_0x258532));_0x42f582(_0x258532);})[_0xe458('0x1a')](function(_0x24165e){logger['error'](_0xe458('0x23'),_0x24165e[_0xe458('0x18')],_0x2f4057);_0xaa667c(_0x3a0368['error'](0x1f4,_0x24165e[_0xe458('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index ca44b63..4e3cf9e 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 _0x8caf=['save','remove','update','removeListener','register','length','smsAccount:'];(function(_0x41c44d,_0x37bfd3){var _0x593d50=function(_0x273dd8){while(--_0x273dd8){_0x41c44d['push'](_0x41c44d['shift']());}};_0x593d50(++_0x37bfd3);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x2e4809,_0x365e2a){_0x2e4809=_0x2e4809-0x0;var _0x4e9161=_0x8caf[_0x2e4809];return _0x4e9161;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0xf8ca('0x0'),_0xf8ca('0x1'),_0xf8ca('0x2')];function createListener(_0x2306e8,_0xedc446){return function(_0x35d47c){_0xedc446['emit'](_0x2306e8,_0x35d47c);};}function removeListener(_0x129ca9,_0x23939c){return function(){SmsAccountEvents[_0xf8ca('0x3')](_0x129ca9,_0x23939c);};}exports[_0xf8ca('0x4')]=function(_0x1e2888){for(var _0x20c10a=0x0,_0x562eea=events[_0xf8ca('0x5')];_0x20c10a<_0x562eea;_0x20c10a++){var _0x3abd58=events[_0x20c10a];var _0x3a91d3=createListener(_0xf8ca('0x6')+_0x3abd58,_0x1e2888);SmsAccountEvents['on'](_0x3abd58,_0x3a91d3);}}; \ No newline at end of file +var _0x6e5e=['length','smsAccount:','./smsAccount.events','save','update','emit','removeListener','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6e5e,0x1aa));var _0xe6e5=function(_0x1e87a4,_0x59e0a6){_0x1e87a4=_0x1e87a4-0x0;var _0x1d3ac9=_0x6e5e[_0x1e87a4];return _0x1d3ac9;};'use strict';var SmsAccountEvents=require(_0xe6e5('0x0'));var events=[_0xe6e5('0x1'),'remove',_0xe6e5('0x2')];function createListener(_0x3abe98,_0x1c6f40){return function(_0x55594b){_0x1c6f40[_0xe6e5('0x3')](_0x3abe98,_0x55594b);};}function removeListener(_0x2df31f,_0x2654ef){return function(){SmsAccountEvents[_0xe6e5('0x4')](_0x2df31f,_0x2654ef);};}exports[_0xe6e5('0x5')]=function(_0x49fd53){for(var _0x3e3333=0x0,_0x555282=events[_0xe6e5('0x6')];_0x3e3333<_0x555282;_0x3e3333++){var _0xcd08d5=events[_0x3e3333];var _0x1c2b64=createListener(_0xe6e5('0x7')+_0xcd08d5,_0x49fd53);SmsAccountEvents['on'](_0xcd08d5,_0x1c2b64);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 8d5403e..944acb4 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 _0x05d9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x05d9,0x18b));var _0x905d=function(_0x459663,_0x5f3226){_0x459663=_0x459663-0x0;var _0x24cd75=_0x05d9[_0x459663];return _0x24cd75;};'use strict';var multer=require(_0x905d('0x0'));var util=require(_0x905d('0x1'));var path=require(_0x905d('0x2'));var timeout=require(_0x905d('0x3'));var express=require(_0x905d('0x4'));var router=express[_0x905d('0x5')]();var fs_extra=require(_0x905d('0x6'));var auth=require(_0x905d('0x7'));var interaction=require(_0x905d('0x8'));var config=require(_0x905d('0x9'));var controller=require(_0x905d('0xa'));router[_0x905d('0xb')]('/',auth[_0x905d('0xc')](),controller[_0x905d('0xd')]);router[_0x905d('0xb')](_0x905d('0xe'),auth[_0x905d('0xc')](),controller[_0x905d('0xf')]);router[_0x905d('0x10')]('/',auth[_0x905d('0xc')](),controller[_0x905d('0x11')]);router[_0x905d('0x12')](_0x905d('0xe'),auth['isAuthenticated'](),controller[_0x905d('0x13')]);router[_0x905d('0x14')](_0x905d('0xe'),auth[_0x905d('0xc')](),controller['destroy']);module[_0x905d('0x15')]=router; \ No newline at end of file +var _0x56c8=['./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x128bbb,_0x571237){var _0x39e1c2=function(_0x2fb08d){while(--_0x2fb08d){_0x128bbb['push'](_0x128bbb['shift']());}};_0x39e1c2(++_0x571237);}(_0x56c8,0xab));var _0x856c=function(_0x1c218c,_0x2caff0){_0x1c218c=_0x1c218c-0x0;var _0x31c6e1=_0x56c8[_0x1c218c];return _0x31c6e1;};'use strict';var multer=require(_0x856c('0x0'));var util=require(_0x856c('0x1'));var path=require(_0x856c('0x2'));var timeout=require(_0x856c('0x3'));var express=require(_0x856c('0x4'));var router=express[_0x856c('0x5')]();var fs_extra=require(_0x856c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x856c('0x7'));var config=require(_0x856c('0x8'));var controller=require(_0x856c('0x9'));router[_0x856c('0xa')]('/',auth[_0x856c('0xb')](),controller[_0x856c('0xc')]);router[_0x856c('0xa')](_0x856c('0xd'),auth[_0x856c('0xb')](),controller[_0x856c('0xe')]);router[_0x856c('0xf')]('/',auth[_0x856c('0xb')](),controller[_0x856c('0x10')]);router['put'](_0x856c('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x856c('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 75cbcd1..da7db68 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 _0x42f6=['STRING','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x5aefee,_0x2d2071){var _0x1f255b=function(_0x27652d){while(--_0x27652d){_0x5aefee['push'](_0x5aefee['shift']());}};_0x1f255b(++_0x2d2071);}(_0x42f6,0x1b9));var _0x642f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x42f6[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x642f('0x0'));module[_0x642f('0x1')]={'priority':{'type':Sequelize[_0x642f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x642f('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x642f('0x4')]()},'description':{'type':Sequelize[_0x642f('0x3')]},'interval':{'type':Sequelize[_0x642f('0x3')],'defaultValue':_0x642f('0x5')}}; \ No newline at end of file +var _0x9929=['TEXT','STRING','sequelize','noop'];(function(_0x2f36e4,_0x13c1f5){var _0x51bf2f=function(_0x2c6c04){while(--_0x2c6c04){_0x2f36e4['push'](_0x2f36e4['shift']());}};_0x51bf2f(++_0x13c1f5);}(_0x9929,0x112));var _0x9992=function(_0x569246,_0x4a9f7b){_0x569246=_0x569246-0x0;var _0x5bf112=_0x9929[_0x569246];return _0x5bf112;};'use strict';var Sequelize=require(_0x9992('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9992('0x1')},'appdata':{'type':Sequelize[_0x9992('0x2')]()},'description':{'type':Sequelize[_0x9992('0x3')]},'interval':{'type':Sequelize[_0x9992('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 2649f8d..62876ed 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 _0x83bd=['keys','find','create','body','catch','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','order','sort','pick','where','filter','merge','options','includeAll','include','findAll','rows','show','params'];(function(_0x370b4b,_0x3f5208){var _0x1cc49c=function(_0x42529d){while(--_0x42529d){_0x370b4b['push'](_0x370b4b['shift']());}};_0x1cc49c(++_0x3f5208);}(_0x83bd,0xed));var _0xd83b=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0x83bd[_0x31b5b2];return _0x364f13;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd83b('0x0'));var zipdir=require(_0xd83b('0x1'));var jsonpatch=require(_0xd83b('0x2'));var rp=require(_0xd83b('0x3'));var moment=require(_0xd83b('0x4'));var BPromise=require(_0xd83b('0x5'));var Mustache=require(_0xd83b('0x6'));var util=require('util');var path=require(_0xd83b('0x7'));var sox=require(_0xd83b('0x8'));var csv=require(_0xd83b('0x9'));var ejs=require(_0xd83b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd83b('0xb'));var squel=require(_0xd83b('0xc'));var crypto=require(_0xd83b('0xd'));var jsforce=require(_0xd83b('0xe'));var deskjs=require(_0xd83b('0xf'));var toCsv=require(_0xd83b('0x9'));var querystring=require(_0xd83b('0x10'));var Papa=require(_0xd83b('0x11'));var Redis=require(_0xd83b('0x12'));var authService=require(_0xd83b('0x13'));var qs=require(_0xd83b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd83b('0x15'));var logger=require('../../config/logger')(_0xd83b('0x16'));var utils=require('../../config/utils');var config=require(_0xd83b('0x17'));var licenseUtil=require(_0xd83b('0x18'));var db=require(_0xd83b('0x19'))['db'];function respondWithStatusCode(_0x1270b6,_0x370b95){_0x370b95=_0x370b95||0xcc;return function(_0x407069){if(_0x407069){return _0x1270b6['sendStatus'](_0x370b95);}return _0x1270b6[_0xd83b('0x1a')](_0x370b95)[_0xd83b('0x1b')]();};}function respondWithResult(_0x7b2d8c,_0x5aa2e3){_0x5aa2e3=_0x5aa2e3||0xc8;return function(_0x832ad7){if(_0x832ad7){return _0x7b2d8c[_0xd83b('0x1a')](_0x5aa2e3)[_0xd83b('0x1c')](_0x832ad7);}};}function respondWithFilteredResult(_0x187018,_0x232fc7){return function(_0x5e2ef3){if(_0x5e2ef3){var _0x5aca8c=_0x5e2ef3[_0xd83b('0x1d')],_0x3d0c1b=_0x232fc7[_0xd83b('0x1e')],_0x57ddef=_0x232fc7[_0xd83b('0x1e')]+_0x232fc7[_0xd83b('0x1f')],_0x45f0bb;if(_0x57ddef>=_0x5aca8c){_0x57ddef=_0x5aca8c;_0x45f0bb=0xc8;}else{_0x45f0bb=0xce;}_0x187018['status'](_0x45f0bb);return _0x187018[_0xd83b('0x20')](_0xd83b('0x21'),_0x3d0c1b+'-'+_0x57ddef+'/'+_0x5aca8c)[_0xd83b('0x1c')](_0x5e2ef3);}return null;};}function patchUpdates(_0x1e37b4){return function(_0x470317){try{jsonpatch[_0xd83b('0x22')](_0x470317,_0x1e37b4,!![]);}catch(_0x47190c){return BPromise[_0xd83b('0x23')](_0x47190c);}return _0x470317[_0xd83b('0x24')]();};}function saveUpdates(_0x33b0dc,_0x926380){return function(_0x26ba1d){if(_0x26ba1d){return _0x26ba1d[_0xd83b('0x25')](_0x33b0dc)[_0xd83b('0x26')](function(_0x432efa){return _0x432efa;});}return null;};}function removeEntity(_0x9a9dde,_0x21bcfd){return function(_0x369563){if(_0x369563){return _0x369563['destroy']()[_0xd83b('0x26')](function(){_0x9a9dde[_0xd83b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4747d4,_0x358a4d){return function(_0x1ddc3a){if(!_0x1ddc3a){_0x4747d4[_0xd83b('0x27')](0x194);}return _0x1ddc3a;};}function handleError(_0x204c3f,_0x461a32){_0x461a32=_0x461a32||0x1f4;return function(_0x13cb28){logger[_0xd83b('0x28')](_0x13cb28[_0xd83b('0x29')]);if(_0x13cb28[_0xd83b('0x2a')]){delete _0x13cb28[_0xd83b('0x2a')];}_0x204c3f[_0xd83b('0x1a')](_0x461a32)[_0xd83b('0x2b')](_0x13cb28);};}exports[_0xd83b('0x2c')]=function(_0x23ccb1,_0xb1d4eb){var _0xdf91e7={},_0x47a699={},_0x8fcdeb={'count':0x0,'rows':[]};var _0xc6771f=_[_0xd83b('0x2d')](db[_0xd83b('0x2e')][_0xd83b('0x2f')],function(_0xcf3c78){return{'name':_0xcf3c78[_0xd83b('0x30')],'type':_0xcf3c78[_0xd83b('0x31')][_0xd83b('0x32')]};});_0x47a699['model']=_['map'](_0xc6771f,_0xd83b('0x2a'));_0x47a699[_0xd83b('0x33')]=_['keys'](_0x23ccb1[_0xd83b('0x33')]);_0x47a699[_0xd83b('0x34')]=_['intersection'](_0x47a699[_0xd83b('0x35')],_0x47a699[_0xd83b('0x33')]);_0xdf91e7[_0xd83b('0x36')]=_[_0xd83b('0x37')](_0x47a699[_0xd83b('0x35')],qs[_0xd83b('0x38')](_0x23ccb1[_0xd83b('0x33')][_0xd83b('0x38')]));_0xdf91e7[_0xd83b('0x36')]=_0xdf91e7[_0xd83b('0x36')][_0xd83b('0x39')]?_0xdf91e7[_0xd83b('0x36')]:_0x47a699[_0xd83b('0x35')];if(!_0x23ccb1[_0xd83b('0x33')]['hasOwnProperty']('nolimit')){_0xdf91e7[_0xd83b('0x1f')]=qs[_0xd83b('0x1f')](_0x23ccb1[_0xd83b('0x33')][_0xd83b('0x1f')]);_0xdf91e7[_0xd83b('0x1e')]=qs[_0xd83b('0x1e')](_0x23ccb1[_0xd83b('0x33')][_0xd83b('0x1e')]);}_0xdf91e7[_0xd83b('0x3a')]=qs[_0xd83b('0x3b')](_0x23ccb1[_0xd83b('0x33')][_0xd83b('0x3b')]);_0xdf91e7['where']=qs[_0xd83b('0x34')](_[_0xd83b('0x3c')](_0x23ccb1[_0xd83b('0x33')],_0x47a699[_0xd83b('0x34')]),_0xc6771f);if(_0x23ccb1['query']['filter']){_0xdf91e7['where']=_['merge'](_0xdf91e7[_0xd83b('0x3d')],{'$or':_[_0xd83b('0x2d')](_0xc6771f,function(_0x2e05e0){if(_0x2e05e0[_0xd83b('0x31')]!=='VIRTUAL'){var _0x6aae86={};_0x6aae86[_0x2e05e0[_0xd83b('0x2a')]]={'$like':'%'+_0x23ccb1['query'][_0xd83b('0x3e')]+'%'};return _0x6aae86;}})});}_0xdf91e7=_[_0xd83b('0x3f')]({},_0xdf91e7,_0x23ccb1[_0xd83b('0x40')]);var _0x44ca2a={'where':_0xdf91e7[_0xd83b('0x3d')]};return db[_0xd83b('0x2e')]['count'](_0x44ca2a)[_0xd83b('0x26')](function(_0x76ebd5){_0x8fcdeb[_0xd83b('0x1d')]=_0x76ebd5;if(_0x23ccb1['query'][_0xd83b('0x41')]){_0xdf91e7[_0xd83b('0x42')]=[{'all':!![]}];}return db['SmsApplication'][_0xd83b('0x43')](_0xdf91e7);})[_0xd83b('0x26')](function(_0x486804){_0x8fcdeb[_0xd83b('0x44')]=_0x486804;return _0x8fcdeb;})[_0xd83b('0x26')](respondWithFilteredResult(_0xb1d4eb,_0xdf91e7))['catch'](handleError(_0xb1d4eb,null));};exports[_0xd83b('0x45')]=function(_0x541e3e,_0x367632){var _0x4cbc9a={'raw':!![],'where':{'id':_0x541e3e[_0xd83b('0x46')]['id']}},_0x13fb6f={};_0x13fb6f[_0xd83b('0x35')]=_[_0xd83b('0x47')](db[_0xd83b('0x2e')][_0xd83b('0x2f')]);_0x13fb6f[_0xd83b('0x33')]=_['keys'](_0x541e3e[_0xd83b('0x33')]);_0x13fb6f['filters']=_[_0xd83b('0x37')](_0x13fb6f[_0xd83b('0x35')],_0x13fb6f[_0xd83b('0x33')]);_0x4cbc9a[_0xd83b('0x36')]=_[_0xd83b('0x37')](_0x13fb6f[_0xd83b('0x35')],qs[_0xd83b('0x38')](_0x541e3e['query'][_0xd83b('0x38')]));_0x4cbc9a[_0xd83b('0x36')]=_0x4cbc9a['attributes'][_0xd83b('0x39')]?_0x4cbc9a[_0xd83b('0x36')]:_0x13fb6f['model'];if(_0x541e3e[_0xd83b('0x33')]['includeAll']){_0x4cbc9a[_0xd83b('0x42')]=[{'all':!![]}];}_0x4cbc9a=_['merge']({},_0x4cbc9a,_0x541e3e['options']);return db[_0xd83b('0x2e')][_0xd83b('0x48')](_0x4cbc9a)[_0xd83b('0x26')](handleEntityNotFound(_0x367632,null))['then'](respondWithResult(_0x367632,null))['catch'](handleError(_0x367632,null));};exports['create']=function(_0x23a7ac,_0x514b72){return db[_0xd83b('0x2e')][_0xd83b('0x49')](_0x23a7ac[_0xd83b('0x4a')],{})[_0xd83b('0x26')](respondWithResult(_0x514b72,0xc9))[_0xd83b('0x4b')](handleError(_0x514b72,null));};exports[_0xd83b('0x25')]=function(_0x2a3b1e,_0x3695a1){if(_0x2a3b1e[_0xd83b('0x4a')]['id']){delete _0x2a3b1e[_0xd83b('0x4a')]['id'];}return db['SmsApplication']['find']({'where':{'id':_0x2a3b1e[_0xd83b('0x46')]['id']}})[_0xd83b('0x26')](handleEntityNotFound(_0x3695a1,null))[_0xd83b('0x26')](saveUpdates(_0x2a3b1e[_0xd83b('0x4a')],null))['then'](respondWithResult(_0x3695a1,null))['catch'](handleError(_0x3695a1,null));};exports[_0xd83b('0x4c')]=function(_0xc52d48,_0xfd1579){return db[_0xd83b('0x2e')][_0xd83b('0x48')]({'where':{'id':_0xc52d48[_0xd83b('0x46')]['id']}})['then'](handleEntityNotFound(_0xfd1579,null))[_0xd83b('0x26')](removeEntity(_0xfd1579,null))['catch'](handleError(_0xfd1579,null));}; \ No newline at end of file +var _0x00fc=['params','include','find','create','body','update','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','destroy','then','end','error','name','send','index','SmsApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show'];(function(_0x4ab053,_0x5b2487){var _0x484b68=function(_0x16cce0){while(--_0x16cce0){_0x4ab053['push'](_0x4ab053['shift']());}};_0x484b68(++_0x5b2487);}(_0x00fc,0x16e));var _0xc00f=function(_0x4c98b9,_0x1ad11b){_0x4c98b9=_0x4c98b9-0x0;var _0x3a257a=_0x00fc[_0x4c98b9];return _0x3a257a;};'use strict';var emlformat=require(_0xc00f('0x0'));var rimraf=require(_0xc00f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc00f('0x2'));var BPromise=require(_0xc00f('0x3'));var Mustache=require(_0xc00f('0x4'));var util=require(_0xc00f('0x5'));var path=require(_0xc00f('0x6'));var sox=require(_0xc00f('0x7'));var csv=require(_0xc00f('0x8'));var ejs=require(_0xc00f('0x9'));var fs=require('fs');var fs_extra=require(_0xc00f('0xa'));var _=require(_0xc00f('0xb'));var squel=require(_0xc00f('0xc'));var crypto=require('crypto');var jsforce=require(_0xc00f('0xd'));var deskjs=require(_0xc00f('0xe'));var toCsv=require(_0xc00f('0x8'));var querystring=require('querystring');var Papa=require(_0xc00f('0xf'));var Redis=require('ioredis');var authService=require(_0xc00f('0x10'));var qs=require(_0xc00f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc00f('0x12'))(_0xc00f('0x13'));var utils=require(_0xc00f('0x14'));var config=require(_0xc00f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc00f('0x16'))['db'];function respondWithStatusCode(_0x411798,_0x4c0d9d){_0x4c0d9d=_0x4c0d9d||0xcc;return function(_0x106555){if(_0x106555){return _0x411798[_0xc00f('0x17')](_0x4c0d9d);}return _0x411798[_0xc00f('0x18')](_0x4c0d9d)['end']();};}function respondWithResult(_0x84bc27,_0x3e4f0d){_0x3e4f0d=_0x3e4f0d||0xc8;return function(_0x75ee86){if(_0x75ee86){return _0x84bc27[_0xc00f('0x18')](_0x3e4f0d)[_0xc00f('0x19')](_0x75ee86);}};}function respondWithFilteredResult(_0x50b46e,_0xb9cf6b){return function(_0x3820bb){if(_0x3820bb){var _0x268eb7=_0x3820bb['count'],_0x57c340=_0xb9cf6b[_0xc00f('0x1a')],_0x35e76e=_0xb9cf6b[_0xc00f('0x1a')]+_0xb9cf6b[_0xc00f('0x1b')],_0x40d5da;if(_0x35e76e>=_0x268eb7){_0x35e76e=_0x268eb7;_0x40d5da=0xc8;}else{_0x40d5da=0xce;}_0x50b46e[_0xc00f('0x18')](_0x40d5da);return _0x50b46e[_0xc00f('0x1c')](_0xc00f('0x1d'),_0x57c340+'-'+_0x35e76e+'/'+_0x268eb7)[_0xc00f('0x19')](_0x3820bb);}return null;};}function patchUpdates(_0x566e3a){return function(_0x13b3dc){try{jsonpatch[_0xc00f('0x1e')](_0x13b3dc,_0x566e3a,!![]);}catch(_0x37b4cd){return BPromise['reject'](_0x37b4cd);}return _0x13b3dc['save']();};}function saveUpdates(_0x3594ab,_0x2ccff1){return function(_0x53a96f){if(_0x53a96f){return _0x53a96f['update'](_0x3594ab)['then'](function(_0x18ffe6){return _0x18ffe6;});}return null;};}function removeEntity(_0x5e0b9e,_0x221bf8){return function(_0x5b4d6b){if(_0x5b4d6b){return _0x5b4d6b[_0xc00f('0x1f')]()[_0xc00f('0x20')](function(){_0x5e0b9e['status'](0xcc)[_0xc00f('0x21')]();});}};}function handleEntityNotFound(_0x553f9e,_0x1d3635){return function(_0x1f0a58){if(!_0x1f0a58){_0x553f9e[_0xc00f('0x17')](0x194);}return _0x1f0a58;};}function handleError(_0x189137,_0x29a43c){_0x29a43c=_0x29a43c||0x1f4;return function(_0x5b5b87){logger[_0xc00f('0x22')](_0x5b5b87['stack']);if(_0x5b5b87[_0xc00f('0x23')]){delete _0x5b5b87[_0xc00f('0x23')];}_0x189137[_0xc00f('0x18')](_0x29a43c)[_0xc00f('0x24')](_0x5b5b87);};}exports[_0xc00f('0x25')]=function(_0x132ac5,_0x1dcbb2){var _0x51b739={},_0x49d0ca={},_0x1e98b6={'count':0x0,'rows':[]};var _0x4ba291=_['map'](db[_0xc00f('0x26')][_0xc00f('0x27')],function(_0x14bc1a){return{'name':_0x14bc1a[_0xc00f('0x28')],'type':_0x14bc1a[_0xc00f('0x29')][_0xc00f('0x2a')]};});_0x49d0ca[_0xc00f('0x2b')]=_[_0xc00f('0x2c')](_0x4ba291,_0xc00f('0x23'));_0x49d0ca[_0xc00f('0x2d')]=_[_0xc00f('0x2e')](_0x132ac5[_0xc00f('0x2d')]);_0x49d0ca[_0xc00f('0x2f')]=_[_0xc00f('0x30')](_0x49d0ca['model'],_0x49d0ca['query']);_0x51b739[_0xc00f('0x31')]=_[_0xc00f('0x30')](_0x49d0ca[_0xc00f('0x2b')],qs[_0xc00f('0x32')](_0x132ac5[_0xc00f('0x2d')][_0xc00f('0x32')]));_0x51b739[_0xc00f('0x31')]=_0x51b739[_0xc00f('0x31')][_0xc00f('0x33')]?_0x51b739[_0xc00f('0x31')]:_0x49d0ca[_0xc00f('0x2b')];if(!_0x132ac5['query'][_0xc00f('0x34')](_0xc00f('0x35'))){_0x51b739['limit']=qs[_0xc00f('0x1b')](_0x132ac5[_0xc00f('0x2d')]['limit']);_0x51b739[_0xc00f('0x1a')]=qs[_0xc00f('0x1a')](_0x132ac5[_0xc00f('0x2d')][_0xc00f('0x1a')]);}_0x51b739['order']=qs[_0xc00f('0x36')](_0x132ac5[_0xc00f('0x2d')][_0xc00f('0x36')]);_0x51b739[_0xc00f('0x37')]=qs[_0xc00f('0x2f')](_[_0xc00f('0x38')](_0x132ac5[_0xc00f('0x2d')],_0x49d0ca[_0xc00f('0x2f')]),_0x4ba291);if(_0x132ac5[_0xc00f('0x2d')][_0xc00f('0x39')]){_0x51b739[_0xc00f('0x37')]=_[_0xc00f('0x3a')](_0x51b739[_0xc00f('0x37')],{'$or':_[_0xc00f('0x2c')](_0x4ba291,function(_0x1a37b4){if(_0x1a37b4[_0xc00f('0x29')]!==_0xc00f('0x3b')){var _0x228bf5={};_0x228bf5[_0x1a37b4[_0xc00f('0x23')]]={'$like':'%'+_0x132ac5[_0xc00f('0x2d')]['filter']+'%'};return _0x228bf5;}})});}_0x51b739=_['merge']({},_0x51b739,_0x132ac5[_0xc00f('0x3c')]);var _0xb4f30a={'where':_0x51b739[_0xc00f('0x37')]};return db[_0xc00f('0x26')][_0xc00f('0x3d')](_0xb4f30a)[_0xc00f('0x20')](function(_0x7c42a9){_0x1e98b6[_0xc00f('0x3d')]=_0x7c42a9;if(_0x132ac5[_0xc00f('0x2d')][_0xc00f('0x3e')]){_0x51b739['include']=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x51b739);})[_0xc00f('0x20')](function(_0x4ec55c){_0x1e98b6[_0xc00f('0x3f')]=_0x4ec55c;return _0x1e98b6;})['then'](respondWithFilteredResult(_0x1dcbb2,_0x51b739))[_0xc00f('0x40')](handleError(_0x1dcbb2,null));};exports[_0xc00f('0x41')]=function(_0xe39684,_0x293c5b){var _0x4382fb={'raw':!![],'where':{'id':_0xe39684[_0xc00f('0x42')]['id']}},_0x3084b8={};_0x3084b8[_0xc00f('0x2b')]=_[_0xc00f('0x2e')](db['SmsApplication'][_0xc00f('0x27')]);_0x3084b8[_0xc00f('0x2d')]=_['keys'](_0xe39684[_0xc00f('0x2d')]);_0x3084b8[_0xc00f('0x2f')]=_['intersection'](_0x3084b8[_0xc00f('0x2b')],_0x3084b8[_0xc00f('0x2d')]);_0x4382fb[_0xc00f('0x31')]=_['intersection'](_0x3084b8[_0xc00f('0x2b')],qs[_0xc00f('0x32')](_0xe39684['query'][_0xc00f('0x32')]));_0x4382fb[_0xc00f('0x31')]=_0x4382fb[_0xc00f('0x31')][_0xc00f('0x33')]?_0x4382fb['attributes']:_0x3084b8[_0xc00f('0x2b')];if(_0xe39684['query'][_0xc00f('0x3e')]){_0x4382fb[_0xc00f('0x43')]=[{'all':!![]}];}_0x4382fb=_[_0xc00f('0x3a')]({},_0x4382fb,_0xe39684[_0xc00f('0x3c')]);return db['SmsApplication'][_0xc00f('0x44')](_0x4382fb)[_0xc00f('0x20')](handleEntityNotFound(_0x293c5b,null))[_0xc00f('0x20')](respondWithResult(_0x293c5b,null))[_0xc00f('0x40')](handleError(_0x293c5b,null));};exports[_0xc00f('0x45')]=function(_0xf88778,_0x5ac976){return db[_0xc00f('0x26')][_0xc00f('0x45')](_0xf88778[_0xc00f('0x46')],{})[_0xc00f('0x20')](respondWithResult(_0x5ac976,0xc9))[_0xc00f('0x40')](handleError(_0x5ac976,null));};exports[_0xc00f('0x47')]=function(_0x17cd93,_0x2bb9d1){if(_0x17cd93[_0xc00f('0x46')]['id']){delete _0x17cd93[_0xc00f('0x46')]['id'];}return db['SmsApplication'][_0xc00f('0x44')]({'where':{'id':_0x17cd93['params']['id']}})[_0xc00f('0x20')](handleEntityNotFound(_0x2bb9d1,null))[_0xc00f('0x20')](saveUpdates(_0x17cd93[_0xc00f('0x46')],null))[_0xc00f('0x20')](respondWithResult(_0x2bb9d1,null))[_0xc00f('0x40')](handleError(_0x2bb9d1,null));};exports[_0xc00f('0x1f')]=function(_0x155a5f,_0x3c6267){return db[_0xc00f('0x26')][_0xc00f('0x44')]({'where':{'id':_0x155a5f[_0xc00f('0x42')]['id']}})[_0xc00f('0x20')](handleEntityNotFound(_0x3c6267,null))[_0xc00f('0x20')](removeEntity(_0x3c6267,null))[_0xc00f('0x40')](handleError(_0x3c6267,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index a7277ee..b191c03 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 _0x3ae6=['SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x40a823,_0x3d3b66){var _0x2a12a2=function(_0x599254){while(--_0x599254){_0x40a823['push'](_0x40a823['shift']());}};_0x2a12a2(++_0x3d3b66);}(_0x3ae6,0xd0));var _0x63ae=function(_0x3b9fbc,_0x59c858){_0x3b9fbc=_0x3b9fbc-0x0;var _0x2365c0=_0x3ae6[_0x3b9fbc];return _0x2365c0;};'use strict';var _=require(_0x63ae('0x0'));var util=require(_0x63ae('0x1'));var logger=require('../../config/logger')(_0x63ae('0x2'));var moment=require(_0x63ae('0x3'));var BPromise=require(_0x63ae('0x4'));var rp=require(_0x63ae('0x5'));var fs=require('fs');var path=require(_0x63ae('0x6'));var rimraf=require('rimraf');var config=require(_0x63ae('0x7'));var attributes=require('./smsApplication.attributes');module['exports']=function(_0x4b7968,_0x2c386c){return _0x4b7968['define'](_0x63ae('0x8'),attributes,{'tableName':_0x63ae('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x63ae('0xa'),'collate':_0x63ae('0xb')});}; \ No newline at end of file +var _0x7fe9=['sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsApplication.attributes','define'];(function(_0x5bbfba,_0xad361c){var _0x43515c=function(_0x2569e4){while(--_0x2569e4){_0x5bbfba['push'](_0x5bbfba['shift']());}};_0x43515c(++_0xad361c);}(_0x7fe9,0xe7));var _0x97fe=function(_0x276c4b,_0x1db701){_0x276c4b=_0x276c4b-0x0;var _0x203581=_0x7fe9[_0x276c4b];return _0x203581;};'use strict';var _=require(_0x97fe('0x0'));var util=require(_0x97fe('0x1'));var logger=require(_0x97fe('0x2'))('api');var moment=require('moment');var BPromise=require(_0x97fe('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x97fe('0x4'));var rimraf=require(_0x97fe('0x5'));var config=require(_0x97fe('0x6'));var attributes=require(_0x97fe('0x7'));module['exports']=function(_0x39a12c,_0x31a594){return _0x39a12c[_0x97fe('0x8')]('SmsApplication',attributes,{'tableName':_0x97fe('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x97fe('0xa'),'collate':_0x97fe('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 00c073b..26e7943 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 _0xfd20=['result','catch','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','SmsApplication,\x20%s,\x20%s','message'];(function(_0x2a4f69,_0x45d550){var _0xccdfce=function(_0x8edaec){while(--_0x8edaec){_0x2a4f69['push'](_0x2a4f69['shift']());}};_0xccdfce(++_0x45d550);}(_0xfd20,0x66));var _0x0fd2=function(_0x1721b3,_0x1c18e5){_0x1721b3=_0x1721b3-0x0;var _0x184d78=_0xfd20[_0x1721b3];return _0x184d78;};'use strict';var _=require('lodash');var util=require(_0x0fd2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0fd2('0x1'));var fs=require('fs');var Redis=require(_0x0fd2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0fd2('0x3'));var logger=require('../../config/logger')(_0x0fd2('0x4'));var config=require(_0x0fd2('0x5'));var jayson=require(_0x0fd2('0x6'));var client=jayson[_0x0fd2('0x7')][_0x0fd2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d114c,_0x55467b,_0x32d460){return new BPromise(function(_0x15ba86,_0x24d6f4){return client[_0x0fd2('0x9')](_0x4d114c,_0x32d460)[_0x0fd2('0xa')](function(_0x195948){logger[_0x0fd2('0xb')]('SmsApplication,\x20%s,\x20%s',_0x55467b,_0x0fd2('0xc'));logger[_0x0fd2('0xd')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x55467b,_0x0fd2('0xc'),JSON['stringify'](_0x195948));if(_0x195948[_0x0fd2('0xe')]){if(_0x195948[_0x0fd2('0xe')][_0x0fd2('0xf')]===0x1f4){logger[_0x0fd2('0xe')](_0x0fd2('0x10'),_0x55467b,_0x195948[_0x0fd2('0xe')][_0x0fd2('0x11')]);return _0x24d6f4(_0x195948[_0x0fd2('0xe')]['message']);}logger['error'](_0x0fd2('0x10'),_0x55467b,_0x195948[_0x0fd2('0xe')][_0x0fd2('0x11')]);return _0x15ba86(_0x195948[_0x0fd2('0xe')]['message']);}else{logger[_0x0fd2('0xb')]('SmsApplication,\x20%s,\x20%s',_0x55467b,'request\x20sent');_0x15ba86(_0x195948[_0x0fd2('0x12')]['message']);}})[_0x0fd2('0x13')](function(_0x55e070){logger[_0x0fd2('0xe')]('SmsApplication,\x20%s,\x20%s',_0x55467b,_0x55e070);_0x24d6f4(_0x55e070);});});} \ No newline at end of file +var _0x737d=['catch','lodash','util','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','SmsApplication,\x20%s,\x20%s','message'];(function(_0x52eb4f,_0x1ec916){var _0x245d2d=function(_0x1397e4){while(--_0x1397e4){_0x52eb4f['push'](_0x52eb4f['shift']());}};_0x245d2d(++_0x1ec916);}(_0x737d,0xbc));var _0xd737=function(_0x31a7f5,_0x342e0b){_0x31a7f5=_0x31a7f5-0x0;var _0x17aaf7=_0x737d[_0x31a7f5];return _0x17aaf7;};'use strict';var _=require(_0xd737('0x0'));var util=require(_0xd737('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd737('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xd737('0x3'))('rpc');var config=require(_0xd737('0x4'));var jayson=require(_0xd737('0x5'));var client=jayson[_0xd737('0x6')][_0xd737('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x46f559,_0x3ee641,_0x3a78be){return new BPromise(function(_0xb077fb,_0x1034aa){return client[_0xd737('0x8')](_0x46f559,_0x3a78be)['then'](function(_0x2aa91f){logger[_0xd737('0x9')]('SmsApplication,\x20%s,\x20%s',_0x3ee641,_0xd737('0xa'));logger[_0xd737('0xb')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x3ee641,_0xd737('0xa'),JSON[_0xd737('0xc')](_0x2aa91f));if(_0x2aa91f['error']){if(_0x2aa91f[_0xd737('0xd')]['code']===0x1f4){logger[_0xd737('0xd')](_0xd737('0xe'),_0x3ee641,_0x2aa91f['error']['message']);return _0x1034aa(_0x2aa91f[_0xd737('0xd')][_0xd737('0xf')]);}logger['error'](_0xd737('0xe'),_0x3ee641,_0x2aa91f[_0xd737('0xd')][_0xd737('0xf')]);return _0xb077fb(_0x2aa91f[_0xd737('0xd')][_0xd737('0xf')]);}else{logger[_0xd737('0x9')](_0xd737('0xe'),_0x3ee641,_0xd737('0xa'));_0xb077fb(_0x2aa91f['result']['message']);}})[_0xd737('0x10')](function(_0x28238c){logger[_0xd737('0xd')](_0xd737('0xe'),_0x3ee641,_0x28238c);_0x1034aa(_0x28238c);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 5148ad4..d17b4f9 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 _0xacd6=['sms','smsinteraction:addtags','put','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','create','post','addMessage','/:id/tags','tracked'];(function(_0x47f07d,_0x195757){var _0x3fbb32=function(_0xcc9fb8){while(--_0xcc9fb8){_0x47f07d['push'](_0x47f07d['shift']());}};_0x3fbb32(++_0x195757);}(_0xacd6,0xef));var _0x6acd=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xacd6[_0x1c8c28];return _0x1f59b4;};'use strict';var multer=require(_0x6acd('0x0'));var util=require(_0x6acd('0x1'));var path=require(_0x6acd('0x2'));var timeout=require(_0x6acd('0x3'));var express=require(_0x6acd('0x4'));var router=express[_0x6acd('0x5')]();var fs_extra=require(_0x6acd('0x6'));var auth=require(_0x6acd('0x7'));var interaction=require(_0x6acd('0x8'));var config=require(_0x6acd('0x9'));var controller=require(_0x6acd('0xa'));router[_0x6acd('0xb')]('/',auth['isAuthenticated'](),controller[_0x6acd('0xc')]);router[_0x6acd('0xb')](_0x6acd('0xd'),auth[_0x6acd('0xe')](),controller[_0x6acd('0xf')]);router[_0x6acd('0xb')](_0x6acd('0x10'),auth[_0x6acd('0xe')](),controller['show']);router[_0x6acd('0xb')](_0x6acd('0x11'),auth[_0x6acd('0xe')](),controller[_0x6acd('0x12')]);router[_0x6acd('0xb')](_0x6acd('0x13'),auth[_0x6acd('0xe')](),controller['download']);router['post']('/',auth[_0x6acd('0xe')](),controller[_0x6acd('0x14')]);router[_0x6acd('0x15')]('/:id/messages',auth[_0x6acd('0xe')](),controller[_0x6acd('0x16')]);router[_0x6acd('0x15')](_0x6acd('0x17'),auth[_0x6acd('0xe')](),interaction[_0x6acd('0x18')](_0x6acd('0x19'),_0x6acd('0x1a')),controller['addTags']);router[_0x6acd('0x1b')](_0x6acd('0x10'),auth[_0x6acd('0xe')](),interaction[_0x6acd('0x18')](_0x6acd('0x19'),'smsinteraction:update'),controller['update']);router[_0x6acd('0x1c')](_0x6acd('0x10'),auth['isAuthenticated'](),interaction[_0x6acd('0x18')]('sms',_0x6acd('0x1d')),controller[_0x6acd('0x1e')]);router[_0x6acd('0x1c')](_0x6acd('0x17'),auth[_0x6acd('0xe')](),controller[_0x6acd('0x1f')]);module[_0x6acd('0x20')]=router; \ No newline at end of file +var _0x7b84=['put','smsinteraction:update','delete','smsinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','sms','addTags'];(function(_0xf1140b,_0x46f3da){var _0x1ba530=function(_0x5a828b){while(--_0x5a828b){_0xf1140b['push'](_0xf1140b['shift']());}};_0x1ba530(++_0x46f3da);}(_0x7b84,0x17c));var _0x47b8=function(_0x5a1ae6,_0x2314ba){_0x5a1ae6=_0x5a1ae6-0x0;var _0x4ef2d9=_0x7b84[_0x5a1ae6];return _0x4ef2d9;};'use strict';var multer=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var path=require(_0x47b8('0x2'));var timeout=require(_0x47b8('0x3'));var express=require(_0x47b8('0x4'));var router=express[_0x47b8('0x5')]();var fs_extra=require(_0x47b8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var controller=require(_0x47b8('0x9'));router[_0x47b8('0xa')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0xc')]);router['get'](_0x47b8('0xd'),auth[_0x47b8('0xb')](),controller[_0x47b8('0xe')]);router[_0x47b8('0xa')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x10')]);router[_0x47b8('0xa')](_0x47b8('0x11'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x12')]);router[_0x47b8('0xa')](_0x47b8('0x13'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x14')]);router[_0x47b8('0x15')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0x16')]);router[_0x47b8('0x15')](_0x47b8('0x11'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x17')]);router[_0x47b8('0x15')](_0x47b8('0x18'),auth[_0x47b8('0xb')](),interaction[_0x47b8('0x19')](_0x47b8('0x1a'),'smsinteraction:addtags'),controller[_0x47b8('0x1b')]);router[_0x47b8('0x1c')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),interaction[_0x47b8('0x19')](_0x47b8('0x1a'),_0x47b8('0x1d')),controller['update']);router[_0x47b8('0x1e')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x47b8('0x1a'),_0x47b8('0x1f')),controller[_0x47b8('0x20')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x47b8('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index d7a05eb..9010478 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 _0xfd6b=['sequelize','moment','BOOLEAN','DATE','STRING','ENUM'];(function(_0x5f283e,_0x23dbbc){var _0x125b20=function(_0x599ec1){while(--_0x599ec1){_0x5f283e['push'](_0x5f283e['shift']());}};_0x125b20(++_0x23dbbc);}(_0xfd6b,0x8a));var _0xbfd6=function(_0x43096d,_0x160f28){_0x43096d=_0x43096d-0x0;var _0x584092=_0xfd6b[_0x43096d];return _0x584092;};'use strict';var Sequelize=require(_0xbfd6('0x0'));var moment=require(_0xbfd6('0x1'));module['exports']={'closed':{'type':Sequelize[_0xbfd6('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbfd6('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xbfd6('0x4')]},'thirdDisposition':{'type':Sequelize[_0xbfd6('0x4')]},'note':{'type':Sequelize[_0xbfd6('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xbfd6('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xbfd6('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xcc1e=['STRING','DATE','ENUM','out','sequelize','moment','exports'];(function(_0x12e236,_0xd68529){var _0x3d988e=function(_0x3d2e1e){while(--_0x3d2e1e){_0x12e236['push'](_0x12e236['shift']());}};_0x3d988e(++_0xd68529);}(_0xcc1e,0x1b6));var _0xecc1=function(_0x1145eb,_0x1faceb){_0x1145eb=_0x1145eb-0x0;var _0x591c82=_0xcc1e[_0x1145eb];return _0x591c82;};'use strict';var Sequelize=require(_0xecc1('0x0'));var moment=require(_0xecc1('0x1'));module[_0xecc1('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xecc1('0x3')]},'note':{'type':Sequelize[_0xecc1('0x3')]},'phone':{'type':Sequelize[_0xecc1('0x3')]},'read1stAt':{'type':Sequelize[_0xecc1('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xecc1('0x5')]('in',_0xecc1('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xecc1('0x6')),'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 37f45d0..0db3b36 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 _0x7a54=['server','files','tmp','attachments','format','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','direction','SmsAccount','Sms','Account','Owner','createdAt','closed','disposition','out','System','secret','renderFile','views','downloadInteraction.html','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','forEach','catch','index','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','color','from','tools_tags','select','field','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','start','split','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','keys','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','SmsInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','push','show','params','intersection','includeAll','include','create','describe','SmsMessage','ids','omit','findOne','SmsInteractionId','merge','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','setTags','Tag','emit','smsInteractionTags:save','removeTags','download','unix','join','root'];(function(_0x21c2c8,_0x44257e){var _0x4dd745=function(_0x1b3196){while(--_0x1b3196){_0x21c2c8['push'](_0x21c2c8['shift']());}};_0x4dd745(++_0x44257e);}(_0x7a54,0x106));var _0x47a5=function(_0x7ededf,_0x1f9012){_0x7ededf=_0x7ededf-0x0;var _0x54bca5=_0x7a54[_0x7ededf];return _0x54bca5;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0x47a5('0x11'))(_0x47a5('0x12'));var utils=require(_0x47a5('0x13'));var config=require(_0x47a5('0x14'));var licenseUtil=require(_0x47a5('0x15'));var db=require(_0x47a5('0x16'))['db'];config[_0x47a5('0x17')]=_['defaults'](config[_0x47a5('0x17')],{'host':_0x47a5('0x18'),'port':0x18eb});var socket=require(_0x47a5('0x19'))(new Redis(config[_0x47a5('0x17')]));require(_0x47a5('0x1a'))[_0x47a5('0x1b')](socket);function respondWithStatusCode(_0x3c6c46,_0x190faa){_0x190faa=_0x190faa||0xcc;return function(_0x4e99a8){if(_0x4e99a8){return _0x3c6c46[_0x47a5('0x1c')](_0x190faa);}return _0x3c6c46[_0x47a5('0x1d')](_0x190faa)[_0x47a5('0x1e')]();};}function respondWithResult(_0x2a2cbb,_0x1ef44c){_0x1ef44c=_0x1ef44c||0xc8;return function(_0x574af6){if(_0x574af6){return _0x2a2cbb['status'](_0x1ef44c)[_0x47a5('0x1f')](_0x574af6);}};}function respondWithFilteredResult(_0x4b966e,_0x5247fd){return function(_0x423a81){if(_0x423a81){var _0xaf70a6=_0x423a81[_0x47a5('0x20')],_0x2ce454=_0x5247fd[_0x47a5('0x21')],_0x1ef371=_0x5247fd[_0x47a5('0x21')]+_0x5247fd[_0x47a5('0x22')],_0x477b1d;if(_0x1ef371>=_0xaf70a6){_0x1ef371=_0xaf70a6;_0x477b1d=0xc8;}else{_0x477b1d=0xce;}_0x4b966e['status'](_0x477b1d);return _0x4b966e[_0x47a5('0x23')](_0x47a5('0x24'),_0x2ce454+'-'+_0x1ef371+'/'+_0xaf70a6)['json'](_0x423a81);}return null;};}function patchUpdates(_0x2b0360){return function(_0x1f03f7){try{jsonpatch[_0x47a5('0x25')](_0x1f03f7,_0x2b0360,!![]);}catch(_0x4c5910){return BPromise[_0x47a5('0x26')](_0x4c5910);}return _0x1f03f7[_0x47a5('0x27')]();};}function saveUpdates(_0x23db32,_0x7a9f9e){return function(_0x5ef1b1){if(_0x5ef1b1){return _0x5ef1b1[_0x47a5('0x28')](_0x23db32)[_0x47a5('0x29')](function(_0x513981){return _0x513981;});}return null;};}function removeEntity(_0x28747d,_0xc4cd63){return function(_0x4437f1){if(_0x4437f1){return _0x4437f1[_0x47a5('0x2a')]()[_0x47a5('0x29')](function(){_0x28747d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x136745,_0x5686db){return function(_0x1ea9c8){if(!_0x1ea9c8){_0x136745['sendStatus'](0x194);}return _0x1ea9c8;};}function handleError(_0x23cb77,_0x378208){_0x378208=_0x378208||0x1f4;return function(_0x36ad34){logger[_0x47a5('0x2b')](_0x36ad34[_0x47a5('0x2c')]);if(_0x36ad34[_0x47a5('0x2d')]){delete _0x36ad34[_0x47a5('0x2d')];}_0x23cb77[_0x47a5('0x1d')](_0x378208)[_0x47a5('0x2e')](_0x36ad34);};}function getInteractionUsers(_0x361bfa,_0x1127f8){return new BPromise(function(_0x11a4fa,_0x3ad507){try{if(_0x1127f8[_0x361bfa['id']]){_0x361bfa['Users']=_[_0x47a5('0x2f')](_0x1127f8[_0x361bfa['id']],function(_0x51833b){return{'id':_0x51833b['id'],'fullname':_0x51833b[_0x47a5('0x30')]};});}}catch(_0x9ac908){_0x3ad507(_0x9ac908);}_0x11a4fa(_0x361bfa);});}function getInteractionTags(_0x16901f,_0x4d6b57){return new BPromise(function(_0x256650,_0x625952){try{if(_0x16901f[_0x47a5('0x31')]){_0x16901f[_0x47a5('0x32')]=[];_0x16901f['TagIds']['split'](',')[_0x47a5('0x33')](function(_0xfb5ddb){_0x16901f['Tags']['push'](_0x4d6b57[_0xfb5ddb]);});}delete _0x16901f[_0x47a5('0x31')];}catch(_0x51544e){_0x625952(_0x51544e);}_0x256650(_0x16901f);});}function updateSmsInteraction(_0x57bff6,_0x42f70c,_0x53119b){return new BPromise(function(_0x122ed6,_0xd972c){return getInteractionUsers(_0x57bff6,_0x53119b)['then'](function(_0x4843c0){return getInteractionTags(_0x4843c0,_0x42f70c);})[_0x47a5('0x29')](function(_0x5910bb){_0x122ed6(_0x5910bb);})[_0x47a5('0x34')](function(_0x87e4c9){_0xd972c(_0x87e4c9);});});}exports[_0x47a5('0x35')]=function(_0x52749b,_0x18f7e9){var _0x50c086={},_0x53c754={},_0x65542e={'count':0x0,'rows':[]};var _0x5a8a7c=_[_0x47a5('0x2f')](db['SmsInteraction'][_0x47a5('0x36')],function(_0x3534cb){return{'name':_0x3534cb[_0x47a5('0x37')],'type':_0x3534cb[_0x47a5('0x38')][_0x47a5('0x39')]};});_0x53c754[_0x47a5('0x3a')]=_[_0x47a5('0x2f')](_0x5a8a7c,_0x47a5('0x2d'));_0x53c754[_0x47a5('0x3b')]=_['keys'](_0x52749b[_0x47a5('0x3b')]);_0x53c754[_0x47a5('0x3c')]=_['intersection'](_0x53c754[_0x47a5('0x3a')],_0x53c754[_0x47a5('0x3b')]);_0x50c086[_0x47a5('0x3d')]=_['intersection'](_0x53c754[_0x47a5('0x3a')],qs[_0x47a5('0x3e')](_0x52749b['query'][_0x47a5('0x3e')]));_0x50c086[_0x47a5('0x3d')]=_0x50c086['attributes']['length']?_0x50c086['attributes']:_0x53c754[_0x47a5('0x3a')];if(!_0x52749b['query'][_0x47a5('0x3f')](_0x47a5('0x40'))){_0x50c086[_0x47a5('0x22')]=qs[_0x47a5('0x22')](_0x52749b[_0x47a5('0x3b')][_0x47a5('0x22')]);_0x50c086[_0x47a5('0x21')]=qs[_0x47a5('0x21')](_0x52749b[_0x47a5('0x3b')][_0x47a5('0x21')]);}_0x50c086[_0x47a5('0x41')]=qs[_0x47a5('0x42')](_0x52749b[_0x47a5('0x3b')]['sort']);_0x50c086[_0x47a5('0x43')]=qs[_0x47a5('0x3c')](_[_0x47a5('0x44')](_0x52749b[_0x47a5('0x3b')],_0x53c754['filters']),_0x5a8a7c);var _0x7de536=[];var _0x528ef3=squel['select']()['field']('id')['field'](_0x47a5('0x2d'))['field'](_0x47a5('0x45'))[_0x47a5('0x46')](_0x47a5('0x47'));var _0x494526=squel[_0x47a5('0x48')]()[_0x47a5('0x49')]('u.id')['field'](_0x47a5('0x4a'))['field'](_0x47a5('0x4b'))[_0x47a5('0x46')](_0x47a5('0x4c'),'ui')[_0x47a5('0x4d')](_0x47a5('0x4e'),'u',_0x47a5('0x4f'));var _0x434227=squel[_0x47a5('0x48')]()[_0x47a5('0x46')](_0x47a5('0x50'),'i')[_0x47a5('0x4d')](_0x47a5('0x51'),'c',_0x47a5('0x52'))[_0x47a5('0x4d')](_0x47a5('0x4e'),'o',_0x47a5('0x53'))['left_join'](_0x47a5('0x54'),'a',_0x47a5('0x55'))['left_join']('sms_messages','me',_0x47a5('0x56'))['left_join'](_0x47a5('0x57'),'it',_0x47a5('0x58'))['left_join']('tools_tags','t',_0x47a5('0x59'));var _0x52d409=squel[_0x47a5('0x5a')]();var _0x1d1039=[];var _0x3548bc=squel[_0x47a5('0x5a')]();var _0x44fe8a;if(_0x52749b[_0x47a5('0x3b')][_0x47a5('0x5b')]){_0x44fe8a=as['parseSearch'](_0x52749b['query'][_0x47a5('0x5b')]);var _0x411230=_0x44fe8a[_0x47a5('0x5c')];for(var _0x9ea93e=0x0;_0x9ea93e<_0x44fe8a[_0x47a5('0x5d')][_0x47a5('0x5e')];_0x9ea93e++){var _0x249de5=_0x44fe8a['conditions'][_0x9ea93e];var _0x45cca5='i';var _0x1c9a62=_[_0x47a5('0x5f')](_0x5a8a7c,['name',_0x249de5[_0x47a5('0x49')]]);if(!_0x1c9a62){switch(_0x249de5['field']){case _0x47a5('0x60'):if(_0x249de5[_0x47a5('0x61')]==0x1){_0x434227[_0x47a5('0x62')]('`'+_0x249de5[_0x47a5('0x49')]+'`\x20=\x200');}else{_0x434227[_0x47a5('0x62')]('`'+_0x249de5[_0x47a5('0x49')]+_0x47a5('0x63'));}break;case _0x47a5('0x64'):if(_0x249de5[_0x47a5('0x65')]===_0x47a5('0x66')){if(_0x249de5[_0x47a5('0x61')]['split']('\x20')[_0x47a5('0x5e')]>0x1){_0x52d409[_0x411230](_0x47a5('0x67'),qs[_0x47a5('0x68')](_0x249de5[_0x47a5('0x61')]),null);}else{var _0x3329aa='%'+_0x249de5[_0x47a5('0x61')]+'%';_0x52d409[_0x411230]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3329aa,_0x3329aa,_0x3329aa);}}else{_0x1c9a62=_[_0x47a5('0x5f')](_0x5a8a7c,[_0x47a5('0x2d'),_0x47a5('0x69')]);_0x249de5['field']=_0x47a5('0x69');_0x4f8564=as[_0x47a5('0x6a')](_0x45cca5,_0x1c9a62[_0x47a5('0x38')],_0x249de5);_0x52d409[_0x411230](_0x4f8564['text'],_0x4f8564['value'][_0x47a5('0x6b')],_0x4f8564[_0x47a5('0x61')]['end']);}break;case'Tag':var _0x6d6b2b=_0x249de5['value'][_0x47a5('0x6c')](',')['map'](function(_0x482de6){return Number(_0x482de6);});_0x6d6b2b[_0x47a5('0x33')](function(_0x46d2d3){_0x3548bc['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x46d2d3+',%');});_0x1d1039=_[_0x47a5('0x6d')](_0x1d1039,_0x6d6b2b);break;case _0x47a5('0x6e'):if(_0x249de5['operator']==='$substring'){_0x52d409[_0x411230](_0x47a5('0x6f'),'%'+_0x249de5[_0x47a5('0x61')]+'%',null);}else{_0x1c9a62=_[_0x47a5('0x5f')](_0x5a8a7c,[_0x47a5('0x2d'),'UserId']);_0x249de5[_0x47a5('0x49')]=_0x47a5('0x70');_0x4f8564=as[_0x47a5('0x6a')](_0x45cca5,_0x1c9a62['type'],_0x249de5);_0x52d409[_0x411230](_0x4f8564[_0x47a5('0x71')],_0x4f8564['value'][_0x47a5('0x6b')],_0x4f8564[_0x47a5('0x61')][_0x47a5('0x1e')]);}break;case _0x47a5('0x72'):_0x4f8564=as[_0x47a5('0x6a')]('me',null,_0x249de5);_0x52d409[_0x411230](_0x4f8564['text'],_0x4f8564[_0x47a5('0x61')]['start'],_0x4f8564['value']['end']);break;}}else{var _0x4f8564=as[_0x47a5('0x6a')](_0x45cca5,_0x1c9a62[_0x47a5('0x38')],_0x249de5);_0x52d409[_0x411230](_0x4f8564[_0x47a5('0x71')],_0x4f8564['value']['start'],_0x4f8564[_0x47a5('0x61')][_0x47a5('0x1e')]);}}}else{var _0x45d4b6=_(_0x52749b[_0x47a5('0x3b')])[_0x47a5('0x73')]()['map'](function(_0x3474b7){return _['some'](_0x5a8a7c,[_0x47a5('0x2d'),_0x3474b7])?_0x3474b7:undefined;})[_0x47a5('0x74')]()['value']();if(!_[_0x47a5('0x75')](_0x45d4b6)){_0x45d4b6[_0x47a5('0x33')](function(_0x132854){if(_0x132854===_0x47a5('0x76')){_0x434227[_0x47a5('0x43')](_0x47a5('0x77'),[][_0x47a5('0x78')](_0x52749b[_0x47a5('0x3b')][_0x132854]));}else if(_0x132854==='createdAt'){var _0x2dcc3b=JSON[_0x47a5('0x79')](_0x52749b[_0x47a5('0x3b')][_0x132854])[_0x47a5('0x7a')];var _0x396cb0=JSON['parse'](_0x52749b[_0x47a5('0x3b')][_0x132854])[_0x47a5('0x7b')];_0x434227[_0x47a5('0x43')](_0x47a5('0x7c'),_0x2dcc3b,_0x396cb0);}else{if(_0x52749b[_0x47a5('0x3b')][_0x132854]===_0x47a5('0x7d')){_0x434227[_0x47a5('0x43')]('i.'+_0x132854+_0x47a5('0x7e'));}else{_0x434227[_0x47a5('0x43')]('i.'+_0x132854+_0x47a5('0x7f'),_0x52749b[_0x47a5('0x3b')][_0x132854]);}}});}if(_0x52749b[_0x47a5('0x3b')][_0x47a5('0x80')]){if(_0x52749b[_0x47a5('0x3b')][_0x47a5('0x80')]==0x1){_0x434227['having'](_0x47a5('0x81'));}else{_0x434227[_0x47a5('0x62')](_0x47a5('0x82'));}}if(_0x52749b['query'][_0x47a5('0x83')]){_0x1d1039=_[_0x47a5('0x84')](_0x52749b[_0x47a5('0x3b')][_0x47a5('0x83')])?_0x52749b['query'][_0x47a5('0x83')]:new Array(_0x52749b['query'][_0x47a5('0x83')]);_0x1d1039['forEach'](function(_0x43f649){_0x3548bc['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x43f649+',%');});}if(_0x52749b[_0x47a5('0x3b')][_0x47a5('0x85')]){var _0x2578d6=_0x52749b['query']['filter']['replace']('\x5c','\x5c\x5c')[_0x47a5('0x86')](/'/g,'\x27\x27');if(qs[_0x47a5('0x87')](_0x2578d6)){_0x52d409['or'](_0x47a5('0x88'),_0x2578d6+'%')['or'](_0x47a5('0x89'),_0x2578d6+'%');}else{_0x52d409['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x47a5('0x68')](_0x2578d6))['or'](_0x47a5('0x8a'),_0x2578d6+'%');}}}_0x434227[_0x47a5('0x43')](_0x52d409);_0x434227[_0x47a5('0x8b')](_0x47a5('0x8c'));var _0xb9f589={'type':db[_0x47a5('0x8d')][_0x47a5('0x8e')][_0x47a5('0x8f')],'raw':!![]};var _0xc69a68=_0x434227[_0x47a5('0x90')]();_0xc69a68[_0x47a5('0x49')]('i.id');_0xc69a68[_0x47a5('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x47a5('0x60'));if(_0x50c086[_0x47a5('0x41')]){_0x50c086[_0x47a5('0x41')][_0x47a5('0x33')](function(_0x40e584){var _0xa9c853=_0x40e584[0x0]===_0x47a5('0x91')?_0x40e584[0x0]:'i.'+_0x40e584[0x0];_0x434227[_0x47a5('0x41')](_0xa9c853,_0x40e584[0x1]===_0x47a5('0x92')?![]:!![]);});}if(!_[_0x47a5('0x75')](_0x1d1039)){_0x434227[_0x47a5('0x62')](_0x3548bc);_0xc69a68[_0x47a5('0x43')](_0x47a5('0x93'),_0x1d1039);}BPromise[_0x47a5('0x94')]()[_0x47a5('0x29')](function(){if(!_0x44fe8a){if(_0x52749b['query']['SmsAccountId'])return;_0xc69a68['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x434227[_0x47a5('0x43')](_0x47a5('0x95'));return;}if(_0x52749b['user'][_0x47a5('0x96')]!==_0x47a5('0x97'))return;return _0x52749b[_0x47a5('0x98')][_0x47a5('0x99')]({'attributes':['id'],'raw':!![]})[_0x47a5('0x29')](function(_0x930d25){if(_[_0x47a5('0x75')](_0x930d25)){_0xc69a68[_0x47a5('0x43')](_0x47a5('0x9a'));_0x434227[_0x47a5('0x43')](_0x47a5('0x9a'));}else{_0xc69a68['where'](_0x47a5('0x77'),_[_0x47a5('0x2f')](_0x930d25,'id'));_0x434227[_0x47a5('0x43')]('i.SmsAccountId\x20IN\x20?',_[_0x47a5('0x2f')](_0x930d25,'id'));}});})[_0x47a5('0x29')](function(){if(_0x52749b[_0x47a5('0x98')]['role']===_0x47a5('0x97')&&!_0x44fe8a&&!_0x52749b['query']['SmsAccountId'])return[];return db[_0x47a5('0x9b')][_0x47a5('0x3b')](_0xc69a68[_0x47a5('0x9c')](),_0xb9f589);})[_0x47a5('0x29')](function(_0x164d42){_0x65542e[_0x47a5('0x20')]=_0x164d42['length'];if(_0x65542e['count']===0x0)return[];return db[_0x47a5('0x9b')]['query'](_0x528ef3[_0x47a5('0x9c')](),_0xb9f589)[_0x47a5('0x29')](function(_0x175dab){_0x7de536=_[_0x47a5('0x9d')](_0x175dab,'id');_0xb9f589=_['merge'](_0xb9f589,{'model':db[_0x47a5('0x9e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x52749b['query']['fields']){_0x50c086[_0x47a5('0x3d')][_0x47a5('0x33')](function(_0x5b91f7){_0x434227[_0x47a5('0x49')]('i.'+_0x5b91f7);});}else{_0x434227[_0x47a5('0x49')](_0x47a5('0x9f'),'unreadMessages');_0x434227[_0x47a5('0x49')]('a.key',_0x47a5('0xa0'));_0x434227[_0x47a5('0x49')](_0x47a5('0xa1'),'Account.mandatoryDisposition');_0x434227[_0x47a5('0x49')](_0x47a5('0xa2'),_0x47a5('0x91'));_0x434227['field'](_0x47a5('0xa3'));_0x434227['field'](_0x47a5('0xa4'),'Contact.firstName');_0x434227[_0x47a5('0x49')](_0x47a5('0xa5'),_0x47a5('0xa6'));_0x434227[_0x47a5('0x49')]('c.email',_0x47a5('0xa7'));_0x434227[_0x47a5('0x49')](_0x47a5('0xa8'),_0x47a5('0xa9'));_0x434227[_0x47a5('0x49')]('c.mobile','Contact.mobile');_0x434227[_0x47a5('0x49')]('c.fax',_0x47a5('0xaa'));_0x434227[_0x47a5('0x49')](_0x47a5('0xab'),'Owner.fullname');_0x434227[_0x47a5('0x49')](_0x47a5('0xac'),'Owner.internal');_0x434227[_0x47a5('0x49')](_0x47a5('0xad'),_0x47a5('0x31'));}if(_0x50c086[_0x47a5('0x22')])_0x434227['limit'](_0x50c086['limit']);if(_0x50c086[_0x47a5('0x21')])_0x434227[_0x47a5('0x21')](_0x50c086['offset']);return db[_0x47a5('0x9b')][_0x47a5('0x3b')](_0x434227['toString'](),_0xb9f589);})[_0x47a5('0x29')](function(_0x2a02cd){_0x494526[_0x47a5('0x43')]('ui.SmsInteractionId\x20IN\x20?',_[_0x47a5('0x2f')](_0x2a02cd,'id'));return db['sequelize'][_0x47a5('0x3b')](_0x494526['toString'](),_0xb9f589)[_0x47a5('0x29')](function(_0x3c620e){var _0x4995be=_[_0x47a5('0xae')](_0x3c620e,'SmsInteractionId');var _0x1eabef=[];_0x2a02cd[_0x47a5('0x33')](function(_0x37e045){_0x1eabef[_0x47a5('0xaf')](updateSmsInteraction(_0x37e045,_0x7de536,_0x4995be));});return BPromise['all'](_0x1eabef);});});})[_0x47a5('0x29')](function(_0x593426){_0x65542e['rows']=_0x593426;return _0x65542e;})[_0x47a5('0x29')](respondWithFilteredResult(_0x18f7e9,_0x50c086))[_0x47a5('0x34')](handleError(_0x18f7e9,null));};exports[_0x47a5('0xb0')]=function(_0x96fb22,_0x380c8b){var _0x5b1f5e={'raw':![],'where':{'id':_0x96fb22[_0x47a5('0xb1')]['id']}},_0x1522a6={};_0x1522a6[_0x47a5('0x3a')]=_[_0x47a5('0x73')](db['SmsInteraction'][_0x47a5('0x36')]);_0x1522a6['query']=_[_0x47a5('0x73')](_0x96fb22[_0x47a5('0x3b')]);_0x1522a6[_0x47a5('0x3c')]=_[_0x47a5('0xb2')](_0x1522a6[_0x47a5('0x3a')],_0x1522a6[_0x47a5('0x3b')]);_0x5b1f5e[_0x47a5('0x3d')]=_[_0x47a5('0xb2')](_0x1522a6[_0x47a5('0x3a')],qs['fields'](_0x96fb22[_0x47a5('0x3b')][_0x47a5('0x3e')]));_0x5b1f5e['attributes']=_0x5b1f5e[_0x47a5('0x3d')][_0x47a5('0x5e')]?_0x5b1f5e[_0x47a5('0x3d')]:_0x1522a6['model'];if(_0x96fb22['query'][_0x47a5('0xb3')]){_0x5b1f5e[_0x47a5('0xb4')]=[{'all':!![]}];}_0x5b1f5e=_['merge']({},_0x5b1f5e,_0x96fb22['options']);return db[_0x47a5('0x9e')][_0x47a5('0x5f')](_0x5b1f5e)['then'](handleEntityNotFound(_0x380c8b,null))[_0x47a5('0x29')](respondWithResult(_0x380c8b,null))[_0x47a5('0x34')](handleError(_0x380c8b,null));};exports['create']=function(_0x16097e,_0x427310){return db[_0x47a5('0x9e')][_0x47a5('0xb5')](_0x16097e[_0x47a5('0x72')],{})[_0x47a5('0x29')](respondWithResult(_0x427310,0xc9))['catch'](handleError(_0x427310,null));};exports['update']=function(_0x5bd86e,_0x133b7a){if(_0x5bd86e[_0x47a5('0x72')]['id']){delete _0x5bd86e['body']['id'];}return db[_0x47a5('0x9e')][_0x47a5('0x5f')]({'where':{'id':_0x5bd86e[_0x47a5('0xb1')]['id']}})[_0x47a5('0x29')](handleEntityNotFound(_0x133b7a,null))[_0x47a5('0x29')](saveUpdates(_0x5bd86e['body'],null))[_0x47a5('0x29')](respondWithResult(_0x133b7a,null))['catch'](handleError(_0x133b7a,null));};exports['destroy']=function(_0x5db0ed,_0x21cb5f){return db['SmsInteraction'][_0x47a5('0x5f')]({'where':{'id':_0x5db0ed[_0x47a5('0xb1')]['id']}})[_0x47a5('0x29')](handleEntityNotFound(_0x21cb5f,null))['then'](removeEntity(_0x21cb5f,null))[_0x47a5('0x34')](handleError(_0x21cb5f,null));};exports[_0x47a5('0xb6')]=function(_0x35bf37,_0x121750){return db[_0x47a5('0x9e')]['describe']()[_0x47a5('0x29')](respondWithResult(_0x121750,null))[_0x47a5('0x34')](handleError(_0x121750,null));};exports['addMessage']=function(_0x42ba59,_0x419870,_0xafa46f){return db[_0x47a5('0xb7')][_0x47a5('0x5f')]({'where':{'id':_0x42ba59[_0x47a5('0xb1')]['id']}})['then'](handleEntityNotFound(_0x419870,null))[_0x47a5('0x29')](function(_0x2e418d){if(_0x2e418d){return _0x2e418d['addMessage'](_0x42ba59[_0x47a5('0x72')][_0x47a5('0xb8')],_[_0x47a5('0xb9')](_0x42ba59[_0x47a5('0x72')],['ids','id'])||{});}})['then'](respondWithResult(_0x419870,null))['catch'](handleError(_0x419870,null));};exports['getMessages']=function(_0x1946c6,_0x27793e,_0x2c5785){var _0x30def7={'raw':![],'where':{}};var _0x31f896={};var _0x6bc37b={'count':0x0,'rows':[]};return db[_0x47a5('0x9e')][_0x47a5('0xba')]({'where':{'id':_0x1946c6['params']['id']}})[_0x47a5('0x29')](handleEntityNotFound(_0x27793e,null))[_0x47a5('0x29')](function(_0x2eef05){if(_0x2eef05){_0x31f896[_0x47a5('0x3a')]=_['keys'](db['SmsMessage'][_0x47a5('0x36')]);_0x31f896['query']=_['keys'](_0x1946c6[_0x47a5('0x3b')]);_0x31f896[_0x47a5('0x3c')]=_['intersection'](_0x31f896[_0x47a5('0x3a')],_0x31f896[_0x47a5('0x3b')]);_0x30def7[_0x47a5('0x3d')]=_['intersection'](_0x31f896[_0x47a5('0x3a')],qs[_0x47a5('0x3e')](_0x1946c6['query'][_0x47a5('0x3e')]));_0x30def7[_0x47a5('0x3d')]=_0x30def7[_0x47a5('0x3d')][_0x47a5('0x5e')]?_0x30def7[_0x47a5('0x3d')]:_0x31f896[_0x47a5('0x3a')];if(!_0x1946c6['query'][_0x47a5('0x3f')]('nolimit')){_0x30def7[_0x47a5('0x22')]=qs[_0x47a5('0x22')](_0x1946c6[_0x47a5('0x3b')][_0x47a5('0x22')]);_0x30def7['offset']=qs[_0x47a5('0x21')](_0x1946c6[_0x47a5('0x3b')][_0x47a5('0x21')]);}_0x30def7[_0x47a5('0x41')]=qs[_0x47a5('0x42')](_0x1946c6[_0x47a5('0x3b')][_0x47a5('0x42')]);_0x30def7[_0x47a5('0x43')]=qs[_0x47a5('0x3c')](_[_0x47a5('0x44')](_0x1946c6[_0x47a5('0x3b')],_0x31f896[_0x47a5('0x3c')]));_0x30def7['where'][_0x47a5('0xbb')]=_0x2eef05['id'];if(_0x1946c6[_0x47a5('0x3b')]['filter']){_0x30def7[_0x47a5('0x43')]=_[_0x47a5('0xbc')](_0x30def7[_0x47a5('0x43')],{'$or':_[_0x47a5('0x2f')](_0x30def7[_0x47a5('0x3d')],function(_0x58fac0){var _0x2dee0d={};_0x2dee0d[_0x58fac0]={'$like':'%'+_0x1946c6[_0x47a5('0x3b')][_0x47a5('0x85')]+'%'};return _0x2dee0d;})});}if(_0x1946c6[_0x47a5('0x3b')][_0x47a5('0x7a')]){var _0x363077=_0x1946c6[_0x47a5('0x3b')]['$gte']['split'](',');var _0xa3d578={};_0xa3d578[_0x363077[0x0]]={'$gte':moment(_0x363077[0x1])['format'](_0x47a5('0xbd'))};_0x30def7['where']=_[_0x47a5('0xbc')](_0x30def7[_0x47a5('0x43')],_0xa3d578);}_0x30def7=_[_0x47a5('0xbc')]({},_0x30def7,_0x1946c6[_0x47a5('0xbe')]);return db['SmsMessage'][_0x47a5('0x20')]({'where':_0x30def7[_0x47a5('0x43')]})[_0x47a5('0x29')](function(_0x5a150a){_0x6bc37b['count']=_0x5a150a;if(_0x1946c6[_0x47a5('0x3b')][_0x47a5('0xb3')]){_0x30def7[_0x47a5('0xb4')]=[{'all':!![]}];}return db[_0x47a5('0xb7')][_0x47a5('0xbf')](_0x30def7);})[_0x47a5('0x29')](function(_0x1c0323){_0x6bc37b[_0x47a5('0xc0')]=_0x1c0323;return _0x6bc37b;});}})['then'](respondWithFilteredResult(_0x27793e,_0x30def7))[_0x47a5('0x34')](handleError(_0x27793e,null));};exports['addTags']=function(_0x346322,_0xc3b5e1,_0x5b0b0b){return db['SmsInteraction'][_0x47a5('0x5f')]({'where':{'id':_0x346322[_0x47a5('0xb1')]['id']}})['then'](handleEntityNotFound(_0xc3b5e1,null))[_0x47a5('0x29')](function(_0x2b2693){if(_0x2b2693){return _0x2b2693[_0x47a5('0xc1')](_0x346322[_0x47a5('0x72')]['ids'],_[_0x47a5('0xb9')](_0x346322['body'],['ids','id'])||{})['spread'](function(){return db[_0x47a5('0xc2')]['findAll']({'attributes':['id',_0x47a5('0x2d'),_0x47a5('0x45')],'where':{'id':_0x346322[_0x47a5('0x72')][_0x47a5('0xb8')]}});})[_0x47a5('0x29')](function(_0x1dae08){socket[_0x47a5('0xc3')](_0x47a5('0xc4'),{'id':Number(_0x346322[_0x47a5('0xb1')]['id']),'tags':_0x1dae08||[]});return{'id':Number(_0x346322[_0x47a5('0xb1')]['id']),'tags':_0x1dae08||[]};});}})[_0x47a5('0x29')](respondWithResult(_0xc3b5e1,null))[_0x47a5('0x34')](handleError(_0xc3b5e1,null));};exports[_0x47a5('0xc5')]=function(_0x1bfa3b,_0xff64fb,_0x5e17cb){return db[_0x47a5('0x9e')][_0x47a5('0x5f')]({'where':{'id':_0x1bfa3b[_0x47a5('0xb1')]['id']}})[_0x47a5('0x29')](handleEntityNotFound(_0xff64fb,null))['then'](function(_0x367662){if(_0x367662){return _0x367662['removeTags'](_0x1bfa3b[_0x47a5('0x3b')]['ids']);}})[_0x47a5('0x29')](respondWithStatusCode(_0xff64fb,null))[_0x47a5('0x34')](handleError(_0xff64fb,null));};exports[_0x47a5('0xc6')]=function(_0x5c20aa,_0x35f735){var _0x217e04=moment()[_0x47a5('0xc7')]()['toString']();var _0x52798d=path[_0x47a5('0xc8')](config[_0x47a5('0xc9')],_0x47a5('0xca'),_0x47a5('0xcb'),_0x47a5('0xcc'));var _0x579e5c=path[_0x47a5('0xc8')](config['root'],_0x47a5('0xca'),_0x47a5('0xcb'),_0x47a5('0xcd'));var _0x2d6ae7=path['join'](_0x52798d,_0x217e04);var _0x4dc67c=util[_0x47a5('0xce')](_0x47a5('0xcf'),_0x5c20aa[_0x47a5('0xb1')]['id'],_0x217e04);var _0x4339d4=path[_0x47a5('0xc8')](_0x52798d,_0x4dc67c);var _0x36a44c=[];_0x36a44c[_0x47a5('0xaf')]({'model':db[_0x47a5('0x6e')],'as':_0x47a5('0x6e'),'attributes':['id','fullname'],'raw':!![]});_0x36a44c['push']({'model':db[_0x47a5('0xd0')],'as':'Contact','attributes':['id',_0x47a5('0xd1'),_0x47a5('0xd2')],'raw':!![]});var _0x1bae88=[{'model':db['SmsMessage'],'as':_0x47a5('0xd3'),'attributes':['id',_0x47a5('0x72'),'createdAt',_0x47a5('0xd4'),'secret',_0x47a5('0x80')],'include':_0x36a44c}];_0x1bae88[_0x47a5('0xaf')]({'model':db[_0x47a5('0xd5')],'as':'Account','attributes':['id','name']});_0x1bae88['push']({'model':db['User'],'as':'Owner','attributes':['id',_0x47a5('0x30')]});return db['SmsInteraction'][_0x47a5('0x5f')]({'where':{'id':_0x5c20aa[_0x47a5('0xb1')]['id']},'include':_0x1bae88})['then'](handleEntityNotFound(_0x35f735,null))['then'](function(_0x4b3529){if(_0x4b3529){var _0x2a6dca=_0x4b3529['get']({'plain':!![]});fs['mkdirSync'](_0x2d6ae7);var _0x5d17dc={'channel':_0x47a5('0xd6'),'account':_0x2a6dca[_0x47a5('0xd7')][_0x47a5('0x2d')],'agent':_0x2a6dca[_0x47a5('0xd8')]?_0x2a6dca['Owner'][_0x47a5('0x30')]:'N.A.','createdAt':moment(_0x2a6dca[_0x47a5('0xd9')])['format'](_0x47a5('0xbd'))[_0x47a5('0x9c')](),'closedAt':_0x2a6dca[_0x47a5('0xda')]?moment(_0x2a6dca['closedAt'])[_0x47a5('0xce')](_0x47a5('0xbd'))[_0x47a5('0x9c')]():'','disposition':_0x2a6dca[_0x47a5('0xdb')],'messages':_(_0x2a6dca['Messages'])[_0x47a5('0x85')]({'secret':![]})[_0x47a5('0x2f')](function(_0x4eebcd){return{'date':moment(_0x4eebcd[_0x47a5('0xd9')])[_0x47a5('0xce')](_0x47a5('0xbd'))['toString'](),'sender':_0x4eebcd[_0x47a5('0xd4')]===_0x47a5('0xdc')?_0x4eebcd[_0x47a5('0x6e')]?_0x4eebcd[_0x47a5('0x6e')][_0x47a5('0x30')]:_0x47a5('0xdd'):_0x4eebcd[_0x47a5('0x64')][_0x47a5('0xd1')]+(_0x4eebcd[_0x47a5('0x64')][_0x47a5('0xd2')]?'\x20'+_0x4eebcd[_0x47a5('0x64')][_0x47a5('0xd2')]:''),'body':_0x4eebcd[_0x47a5('0x72')],'direction':_0x4eebcd[_0x47a5('0xd4')]===_0x47a5('0xdc')?'A':'C','secret':_0x4eebcd[_0x47a5('0xde')],'read':_0x4eebcd[_0x47a5('0x80')]};})['value']()};return ejs[_0x47a5('0xdf')](path['join'](config['root'],_0x47a5('0xca'),_0x47a5('0xe0'),_0x47a5('0xe1')),{'interaction':_0x5d17dc})['then'](function(_0x1f8e28){var _0xd8381b=path[_0x47a5('0xc8')](_0x2d6ae7,_0x47a5('0xe2')+_0x2a6dca['id']+'-'+_0x217e04+_0x47a5('0xe3'));var _0x28ba38={'path':_0xd8381b,'channel':_0x47a5('0xd6'),'interactionId':_0x2a6dca['id']};return pdf[_0x47a5('0xe4')](_0x1f8e28,_0x28ba38);})[_0x47a5('0x29')](function(){return new BPromise(function(_0x15f273,_0x10952f){zipdir(_0x2d6ae7,{'saveTo':_0x4339d4},function(_0x399026,_0x203bc9){if(_0x399026)return _0x10952f(_0x399026);return _0x15f273(_0x203bc9);});})['then'](function(){return new BPromise(function(_0x4aad5f,_0x2884c9){rimraf(_0x2d6ae7,function(_0x5e7d56){if(_0x5e7d56)_0x2884c9(_0x5e7d56);return _0x4aad5f();});});})[_0x47a5('0x29')](function(){return _0x35f735[_0x47a5('0xc6')](_0x4339d4,_0x4dc67c,function(_0x1f776e){if(_0x1f776e){console[_0x47a5('0xe5')](_0x47a5('0xe6'),_0x1f776e);}else{fs[_0x47a5('0xe7')](_0x4339d4);}});});});}else{return _0x35f735['sendStatus'](0xc8);}})[_0x47a5('0x34')](handleError(_0x35f735,null));}; \ No newline at end of file +var _0x7a54=['server','files','tmp','attachments','format','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','direction','SmsAccount','Sms','Account','Owner','createdAt','closed','disposition','out','System','secret','renderFile','views','downloadInteraction.html','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','forEach','catch','index','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','color','from','tools_tags','select','field','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','start','split','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','keys','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','SmsInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','push','show','params','intersection','includeAll','include','create','describe','SmsMessage','ids','omit','findOne','SmsInteractionId','merge','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','setTags','Tag','emit','smsInteractionTags:save','removeTags','download','unix','join','root'];(function(_0x16cfb0,_0x28d646){var _0x3d8504=function(_0x415941){while(--_0x415941){_0x16cfb0['push'](_0x16cfb0['shift']());}};_0x3d8504(++_0x28d646);}(_0x7a54,0x106));var _0x47a5=function(_0x449e9e,_0xab583c){_0x449e9e=_0x449e9e-0x0;var _0x1ed023=_0x7a54[_0x449e9e];return _0x1ed023;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0x47a5('0x11'))(_0x47a5('0x12'));var utils=require(_0x47a5('0x13'));var config=require(_0x47a5('0x14'));var licenseUtil=require(_0x47a5('0x15'));var db=require(_0x47a5('0x16'))['db'];config[_0x47a5('0x17')]=_['defaults'](config[_0x47a5('0x17')],{'host':_0x47a5('0x18'),'port':0x18eb});var socket=require(_0x47a5('0x19'))(new Redis(config[_0x47a5('0x17')]));require(_0x47a5('0x1a'))[_0x47a5('0x1b')](socket);function respondWithStatusCode(_0x3c6c46,_0x190faa){_0x190faa=_0x190faa||0xcc;return function(_0x4e99a8){if(_0x4e99a8){return _0x3c6c46[_0x47a5('0x1c')](_0x190faa);}return _0x3c6c46[_0x47a5('0x1d')](_0x190faa)[_0x47a5('0x1e')]();};}function respondWithResult(_0x2a2cbb,_0x1ef44c){_0x1ef44c=_0x1ef44c||0xc8;return function(_0x574af6){if(_0x574af6){return _0x2a2cbb['status'](_0x1ef44c)[_0x47a5('0x1f')](_0x574af6);}};}function respondWithFilteredResult(_0x4b966e,_0x5247fd){return function(_0x423a81){if(_0x423a81){var _0xaf70a6=_0x423a81[_0x47a5('0x20')],_0x2ce454=_0x5247fd[_0x47a5('0x21')],_0x1ef371=_0x5247fd[_0x47a5('0x21')]+_0x5247fd[_0x47a5('0x22')],_0x477b1d;if(_0x1ef371>=_0xaf70a6){_0x1ef371=_0xaf70a6;_0x477b1d=0xc8;}else{_0x477b1d=0xce;}_0x4b966e['status'](_0x477b1d);return _0x4b966e[_0x47a5('0x23')](_0x47a5('0x24'),_0x2ce454+'-'+_0x1ef371+'/'+_0xaf70a6)['json'](_0x423a81);}return null;};}function patchUpdates(_0x2b0360){return function(_0x1f03f7){try{jsonpatch[_0x47a5('0x25')](_0x1f03f7,_0x2b0360,!![]);}catch(_0x4c5910){return BPromise[_0x47a5('0x26')](_0x4c5910);}return _0x1f03f7[_0x47a5('0x27')]();};}function saveUpdates(_0x23db32,_0x7a9f9e){return function(_0x5ef1b1){if(_0x5ef1b1){return _0x5ef1b1[_0x47a5('0x28')](_0x23db32)[_0x47a5('0x29')](function(_0x513981){return _0x513981;});}return null;};}function removeEntity(_0x28747d,_0xc4cd63){return function(_0x4437f1){if(_0x4437f1){return _0x4437f1[_0x47a5('0x2a')]()[_0x47a5('0x29')](function(){_0x28747d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x136745,_0x5686db){return function(_0x1ea9c8){if(!_0x1ea9c8){_0x136745['sendStatus'](0x194);}return _0x1ea9c8;};}function handleError(_0x23cb77,_0x378208){_0x378208=_0x378208||0x1f4;return function(_0x36ad34){logger[_0x47a5('0x2b')](_0x36ad34[_0x47a5('0x2c')]);if(_0x36ad34[_0x47a5('0x2d')]){delete _0x36ad34[_0x47a5('0x2d')];}_0x23cb77[_0x47a5('0x1d')](_0x378208)[_0x47a5('0x2e')](_0x36ad34);};}function getInteractionUsers(_0x361bfa,_0x1127f8){return new BPromise(function(_0x11a4fa,_0x3ad507){try{if(_0x1127f8[_0x361bfa['id']]){_0x361bfa['Users']=_[_0x47a5('0x2f')](_0x1127f8[_0x361bfa['id']],function(_0x51833b){return{'id':_0x51833b['id'],'fullname':_0x51833b[_0x47a5('0x30')]};});}}catch(_0x9ac908){_0x3ad507(_0x9ac908);}_0x11a4fa(_0x361bfa);});}function getInteractionTags(_0x16901f,_0x4d6b57){return new BPromise(function(_0x256650,_0x625952){try{if(_0x16901f[_0x47a5('0x31')]){_0x16901f[_0x47a5('0x32')]=[];_0x16901f['TagIds']['split'](',')[_0x47a5('0x33')](function(_0xfb5ddb){_0x16901f['Tags']['push'](_0x4d6b57[_0xfb5ddb]);});}delete _0x16901f[_0x47a5('0x31')];}catch(_0x51544e){_0x625952(_0x51544e);}_0x256650(_0x16901f);});}function updateSmsInteraction(_0x57bff6,_0x42f70c,_0x53119b){return new BPromise(function(_0x122ed6,_0xd972c){return getInteractionUsers(_0x57bff6,_0x53119b)['then'](function(_0x4843c0){return getInteractionTags(_0x4843c0,_0x42f70c);})[_0x47a5('0x29')](function(_0x5910bb){_0x122ed6(_0x5910bb);})[_0x47a5('0x34')](function(_0x87e4c9){_0xd972c(_0x87e4c9);});});}exports[_0x47a5('0x35')]=function(_0x52749b,_0x18f7e9){var _0x50c086={},_0x53c754={},_0x65542e={'count':0x0,'rows':[]};var _0x5a8a7c=_[_0x47a5('0x2f')](db['SmsInteraction'][_0x47a5('0x36')],function(_0x3534cb){return{'name':_0x3534cb[_0x47a5('0x37')],'type':_0x3534cb[_0x47a5('0x38')][_0x47a5('0x39')]};});_0x53c754[_0x47a5('0x3a')]=_[_0x47a5('0x2f')](_0x5a8a7c,_0x47a5('0x2d'));_0x53c754[_0x47a5('0x3b')]=_['keys'](_0x52749b[_0x47a5('0x3b')]);_0x53c754[_0x47a5('0x3c')]=_['intersection'](_0x53c754[_0x47a5('0x3a')],_0x53c754[_0x47a5('0x3b')]);_0x50c086[_0x47a5('0x3d')]=_['intersection'](_0x53c754[_0x47a5('0x3a')],qs[_0x47a5('0x3e')](_0x52749b['query'][_0x47a5('0x3e')]));_0x50c086[_0x47a5('0x3d')]=_0x50c086['attributes']['length']?_0x50c086['attributes']:_0x53c754[_0x47a5('0x3a')];if(!_0x52749b['query'][_0x47a5('0x3f')](_0x47a5('0x40'))){_0x50c086[_0x47a5('0x22')]=qs[_0x47a5('0x22')](_0x52749b[_0x47a5('0x3b')][_0x47a5('0x22')]);_0x50c086[_0x47a5('0x21')]=qs[_0x47a5('0x21')](_0x52749b[_0x47a5('0x3b')][_0x47a5('0x21')]);}_0x50c086[_0x47a5('0x41')]=qs[_0x47a5('0x42')](_0x52749b[_0x47a5('0x3b')]['sort']);_0x50c086[_0x47a5('0x43')]=qs[_0x47a5('0x3c')](_[_0x47a5('0x44')](_0x52749b[_0x47a5('0x3b')],_0x53c754['filters']),_0x5a8a7c);var _0x7de536=[];var _0x528ef3=squel['select']()['field']('id')['field'](_0x47a5('0x2d'))['field'](_0x47a5('0x45'))[_0x47a5('0x46')](_0x47a5('0x47'));var _0x494526=squel[_0x47a5('0x48')]()[_0x47a5('0x49')]('u.id')['field'](_0x47a5('0x4a'))['field'](_0x47a5('0x4b'))[_0x47a5('0x46')](_0x47a5('0x4c'),'ui')[_0x47a5('0x4d')](_0x47a5('0x4e'),'u',_0x47a5('0x4f'));var _0x434227=squel[_0x47a5('0x48')]()[_0x47a5('0x46')](_0x47a5('0x50'),'i')[_0x47a5('0x4d')](_0x47a5('0x51'),'c',_0x47a5('0x52'))[_0x47a5('0x4d')](_0x47a5('0x4e'),'o',_0x47a5('0x53'))['left_join'](_0x47a5('0x54'),'a',_0x47a5('0x55'))['left_join']('sms_messages','me',_0x47a5('0x56'))['left_join'](_0x47a5('0x57'),'it',_0x47a5('0x58'))['left_join']('tools_tags','t',_0x47a5('0x59'));var _0x52d409=squel[_0x47a5('0x5a')]();var _0x1d1039=[];var _0x3548bc=squel[_0x47a5('0x5a')]();var _0x44fe8a;if(_0x52749b[_0x47a5('0x3b')][_0x47a5('0x5b')]){_0x44fe8a=as['parseSearch'](_0x52749b['query'][_0x47a5('0x5b')]);var _0x411230=_0x44fe8a[_0x47a5('0x5c')];for(var _0x9ea93e=0x0;_0x9ea93e<_0x44fe8a[_0x47a5('0x5d')][_0x47a5('0x5e')];_0x9ea93e++){var _0x249de5=_0x44fe8a['conditions'][_0x9ea93e];var _0x45cca5='i';var _0x1c9a62=_[_0x47a5('0x5f')](_0x5a8a7c,['name',_0x249de5[_0x47a5('0x49')]]);if(!_0x1c9a62){switch(_0x249de5['field']){case _0x47a5('0x60'):if(_0x249de5[_0x47a5('0x61')]==0x1){_0x434227[_0x47a5('0x62')]('`'+_0x249de5[_0x47a5('0x49')]+'`\x20=\x200');}else{_0x434227[_0x47a5('0x62')]('`'+_0x249de5[_0x47a5('0x49')]+_0x47a5('0x63'));}break;case _0x47a5('0x64'):if(_0x249de5[_0x47a5('0x65')]===_0x47a5('0x66')){if(_0x249de5[_0x47a5('0x61')]['split']('\x20')[_0x47a5('0x5e')]>0x1){_0x52d409[_0x411230](_0x47a5('0x67'),qs[_0x47a5('0x68')](_0x249de5[_0x47a5('0x61')]),null);}else{var _0x3329aa='%'+_0x249de5[_0x47a5('0x61')]+'%';_0x52d409[_0x411230]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3329aa,_0x3329aa,_0x3329aa);}}else{_0x1c9a62=_[_0x47a5('0x5f')](_0x5a8a7c,[_0x47a5('0x2d'),_0x47a5('0x69')]);_0x249de5['field']=_0x47a5('0x69');_0x4f8564=as[_0x47a5('0x6a')](_0x45cca5,_0x1c9a62[_0x47a5('0x38')],_0x249de5);_0x52d409[_0x411230](_0x4f8564['text'],_0x4f8564['value'][_0x47a5('0x6b')],_0x4f8564[_0x47a5('0x61')]['end']);}break;case'Tag':var _0x6d6b2b=_0x249de5['value'][_0x47a5('0x6c')](',')['map'](function(_0x482de6){return Number(_0x482de6);});_0x6d6b2b[_0x47a5('0x33')](function(_0x46d2d3){_0x3548bc['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x46d2d3+',%');});_0x1d1039=_[_0x47a5('0x6d')](_0x1d1039,_0x6d6b2b);break;case _0x47a5('0x6e'):if(_0x249de5['operator']==='$substring'){_0x52d409[_0x411230](_0x47a5('0x6f'),'%'+_0x249de5[_0x47a5('0x61')]+'%',null);}else{_0x1c9a62=_[_0x47a5('0x5f')](_0x5a8a7c,[_0x47a5('0x2d'),'UserId']);_0x249de5[_0x47a5('0x49')]=_0x47a5('0x70');_0x4f8564=as[_0x47a5('0x6a')](_0x45cca5,_0x1c9a62['type'],_0x249de5);_0x52d409[_0x411230](_0x4f8564[_0x47a5('0x71')],_0x4f8564['value'][_0x47a5('0x6b')],_0x4f8564[_0x47a5('0x61')][_0x47a5('0x1e')]);}break;case _0x47a5('0x72'):_0x4f8564=as[_0x47a5('0x6a')]('me',null,_0x249de5);_0x52d409[_0x411230](_0x4f8564['text'],_0x4f8564[_0x47a5('0x61')]['start'],_0x4f8564['value']['end']);break;}}else{var _0x4f8564=as[_0x47a5('0x6a')](_0x45cca5,_0x1c9a62[_0x47a5('0x38')],_0x249de5);_0x52d409[_0x411230](_0x4f8564[_0x47a5('0x71')],_0x4f8564['value']['start'],_0x4f8564[_0x47a5('0x61')][_0x47a5('0x1e')]);}}}else{var _0x45d4b6=_(_0x52749b[_0x47a5('0x3b')])[_0x47a5('0x73')]()['map'](function(_0x3474b7){return _['some'](_0x5a8a7c,[_0x47a5('0x2d'),_0x3474b7])?_0x3474b7:undefined;})[_0x47a5('0x74')]()['value']();if(!_[_0x47a5('0x75')](_0x45d4b6)){_0x45d4b6[_0x47a5('0x33')](function(_0x132854){if(_0x132854===_0x47a5('0x76')){_0x434227[_0x47a5('0x43')](_0x47a5('0x77'),[][_0x47a5('0x78')](_0x52749b[_0x47a5('0x3b')][_0x132854]));}else if(_0x132854==='createdAt'){var _0x2dcc3b=JSON[_0x47a5('0x79')](_0x52749b[_0x47a5('0x3b')][_0x132854])[_0x47a5('0x7a')];var _0x396cb0=JSON['parse'](_0x52749b[_0x47a5('0x3b')][_0x132854])[_0x47a5('0x7b')];_0x434227[_0x47a5('0x43')](_0x47a5('0x7c'),_0x2dcc3b,_0x396cb0);}else{if(_0x52749b[_0x47a5('0x3b')][_0x132854]===_0x47a5('0x7d')){_0x434227[_0x47a5('0x43')]('i.'+_0x132854+_0x47a5('0x7e'));}else{_0x434227[_0x47a5('0x43')]('i.'+_0x132854+_0x47a5('0x7f'),_0x52749b[_0x47a5('0x3b')][_0x132854]);}}});}if(_0x52749b[_0x47a5('0x3b')][_0x47a5('0x80')]){if(_0x52749b[_0x47a5('0x3b')][_0x47a5('0x80')]==0x1){_0x434227['having'](_0x47a5('0x81'));}else{_0x434227[_0x47a5('0x62')](_0x47a5('0x82'));}}if(_0x52749b['query'][_0x47a5('0x83')]){_0x1d1039=_[_0x47a5('0x84')](_0x52749b[_0x47a5('0x3b')][_0x47a5('0x83')])?_0x52749b['query'][_0x47a5('0x83')]:new Array(_0x52749b['query'][_0x47a5('0x83')]);_0x1d1039['forEach'](function(_0x43f649){_0x3548bc['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x43f649+',%');});}if(_0x52749b[_0x47a5('0x3b')][_0x47a5('0x85')]){var _0x2578d6=_0x52749b['query']['filter']['replace']('\x5c','\x5c\x5c')[_0x47a5('0x86')](/'/g,'\x27\x27');if(qs[_0x47a5('0x87')](_0x2578d6)){_0x52d409['or'](_0x47a5('0x88'),_0x2578d6+'%')['or'](_0x47a5('0x89'),_0x2578d6+'%');}else{_0x52d409['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x47a5('0x68')](_0x2578d6))['or'](_0x47a5('0x8a'),_0x2578d6+'%');}}}_0x434227[_0x47a5('0x43')](_0x52d409);_0x434227[_0x47a5('0x8b')](_0x47a5('0x8c'));var _0xb9f589={'type':db[_0x47a5('0x8d')][_0x47a5('0x8e')][_0x47a5('0x8f')],'raw':!![]};var _0xc69a68=_0x434227[_0x47a5('0x90')]();_0xc69a68[_0x47a5('0x49')]('i.id');_0xc69a68[_0x47a5('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x47a5('0x60'));if(_0x50c086[_0x47a5('0x41')]){_0x50c086[_0x47a5('0x41')][_0x47a5('0x33')](function(_0x40e584){var _0xa9c853=_0x40e584[0x0]===_0x47a5('0x91')?_0x40e584[0x0]:'i.'+_0x40e584[0x0];_0x434227[_0x47a5('0x41')](_0xa9c853,_0x40e584[0x1]===_0x47a5('0x92')?![]:!![]);});}if(!_[_0x47a5('0x75')](_0x1d1039)){_0x434227[_0x47a5('0x62')](_0x3548bc);_0xc69a68[_0x47a5('0x43')](_0x47a5('0x93'),_0x1d1039);}BPromise[_0x47a5('0x94')]()[_0x47a5('0x29')](function(){if(!_0x44fe8a){if(_0x52749b['query']['SmsAccountId'])return;_0xc69a68['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x434227[_0x47a5('0x43')](_0x47a5('0x95'));return;}if(_0x52749b['user'][_0x47a5('0x96')]!==_0x47a5('0x97'))return;return _0x52749b[_0x47a5('0x98')][_0x47a5('0x99')]({'attributes':['id'],'raw':!![]})[_0x47a5('0x29')](function(_0x930d25){if(_[_0x47a5('0x75')](_0x930d25)){_0xc69a68[_0x47a5('0x43')](_0x47a5('0x9a'));_0x434227[_0x47a5('0x43')](_0x47a5('0x9a'));}else{_0xc69a68['where'](_0x47a5('0x77'),_[_0x47a5('0x2f')](_0x930d25,'id'));_0x434227[_0x47a5('0x43')]('i.SmsAccountId\x20IN\x20?',_[_0x47a5('0x2f')](_0x930d25,'id'));}});})[_0x47a5('0x29')](function(){if(_0x52749b[_0x47a5('0x98')]['role']===_0x47a5('0x97')&&!_0x44fe8a&&!_0x52749b['query']['SmsAccountId'])return[];return db[_0x47a5('0x9b')][_0x47a5('0x3b')](_0xc69a68[_0x47a5('0x9c')](),_0xb9f589);})[_0x47a5('0x29')](function(_0x164d42){_0x65542e[_0x47a5('0x20')]=_0x164d42['length'];if(_0x65542e['count']===0x0)return[];return db[_0x47a5('0x9b')]['query'](_0x528ef3[_0x47a5('0x9c')](),_0xb9f589)[_0x47a5('0x29')](function(_0x175dab){_0x7de536=_[_0x47a5('0x9d')](_0x175dab,'id');_0xb9f589=_['merge'](_0xb9f589,{'model':db[_0x47a5('0x9e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x52749b['query']['fields']){_0x50c086[_0x47a5('0x3d')][_0x47a5('0x33')](function(_0x5b91f7){_0x434227[_0x47a5('0x49')]('i.'+_0x5b91f7);});}else{_0x434227[_0x47a5('0x49')](_0x47a5('0x9f'),'unreadMessages');_0x434227[_0x47a5('0x49')]('a.key',_0x47a5('0xa0'));_0x434227[_0x47a5('0x49')](_0x47a5('0xa1'),'Account.mandatoryDisposition');_0x434227[_0x47a5('0x49')](_0x47a5('0xa2'),_0x47a5('0x91'));_0x434227['field'](_0x47a5('0xa3'));_0x434227['field'](_0x47a5('0xa4'),'Contact.firstName');_0x434227[_0x47a5('0x49')](_0x47a5('0xa5'),_0x47a5('0xa6'));_0x434227[_0x47a5('0x49')]('c.email',_0x47a5('0xa7'));_0x434227[_0x47a5('0x49')](_0x47a5('0xa8'),_0x47a5('0xa9'));_0x434227[_0x47a5('0x49')]('c.mobile','Contact.mobile');_0x434227[_0x47a5('0x49')]('c.fax',_0x47a5('0xaa'));_0x434227[_0x47a5('0x49')](_0x47a5('0xab'),'Owner.fullname');_0x434227[_0x47a5('0x49')](_0x47a5('0xac'),'Owner.internal');_0x434227[_0x47a5('0x49')](_0x47a5('0xad'),_0x47a5('0x31'));}if(_0x50c086[_0x47a5('0x22')])_0x434227['limit'](_0x50c086['limit']);if(_0x50c086[_0x47a5('0x21')])_0x434227[_0x47a5('0x21')](_0x50c086['offset']);return db[_0x47a5('0x9b')][_0x47a5('0x3b')](_0x434227['toString'](),_0xb9f589);})[_0x47a5('0x29')](function(_0x2a02cd){_0x494526[_0x47a5('0x43')]('ui.SmsInteractionId\x20IN\x20?',_[_0x47a5('0x2f')](_0x2a02cd,'id'));return db['sequelize'][_0x47a5('0x3b')](_0x494526['toString'](),_0xb9f589)[_0x47a5('0x29')](function(_0x3c620e){var _0x4995be=_[_0x47a5('0xae')](_0x3c620e,'SmsInteractionId');var _0x1eabef=[];_0x2a02cd[_0x47a5('0x33')](function(_0x37e045){_0x1eabef[_0x47a5('0xaf')](updateSmsInteraction(_0x37e045,_0x7de536,_0x4995be));});return BPromise['all'](_0x1eabef);});});})[_0x47a5('0x29')](function(_0x593426){_0x65542e['rows']=_0x593426;return _0x65542e;})[_0x47a5('0x29')](respondWithFilteredResult(_0x18f7e9,_0x50c086))[_0x47a5('0x34')](handleError(_0x18f7e9,null));};exports[_0x47a5('0xb0')]=function(_0x96fb22,_0x380c8b){var _0x5b1f5e={'raw':![],'where':{'id':_0x96fb22[_0x47a5('0xb1')]['id']}},_0x1522a6={};_0x1522a6[_0x47a5('0x3a')]=_[_0x47a5('0x73')](db['SmsInteraction'][_0x47a5('0x36')]);_0x1522a6['query']=_[_0x47a5('0x73')](_0x96fb22[_0x47a5('0x3b')]);_0x1522a6[_0x47a5('0x3c')]=_[_0x47a5('0xb2')](_0x1522a6[_0x47a5('0x3a')],_0x1522a6[_0x47a5('0x3b')]);_0x5b1f5e[_0x47a5('0x3d')]=_[_0x47a5('0xb2')](_0x1522a6[_0x47a5('0x3a')],qs['fields'](_0x96fb22[_0x47a5('0x3b')][_0x47a5('0x3e')]));_0x5b1f5e['attributes']=_0x5b1f5e[_0x47a5('0x3d')][_0x47a5('0x5e')]?_0x5b1f5e[_0x47a5('0x3d')]:_0x1522a6['model'];if(_0x96fb22['query'][_0x47a5('0xb3')]){_0x5b1f5e[_0x47a5('0xb4')]=[{'all':!![]}];}_0x5b1f5e=_['merge']({},_0x5b1f5e,_0x96fb22['options']);return db[_0x47a5('0x9e')][_0x47a5('0x5f')](_0x5b1f5e)['then'](handleEntityNotFound(_0x380c8b,null))[_0x47a5('0x29')](respondWithResult(_0x380c8b,null))[_0x47a5('0x34')](handleError(_0x380c8b,null));};exports['create']=function(_0x16097e,_0x427310){return db[_0x47a5('0x9e')][_0x47a5('0xb5')](_0x16097e[_0x47a5('0x72')],{})[_0x47a5('0x29')](respondWithResult(_0x427310,0xc9))['catch'](handleError(_0x427310,null));};exports['update']=function(_0x5bd86e,_0x133b7a){if(_0x5bd86e[_0x47a5('0x72')]['id']){delete _0x5bd86e['body']['id'];}return db[_0x47a5('0x9e')][_0x47a5('0x5f')]({'where':{'id':_0x5bd86e[_0x47a5('0xb1')]['id']}})[_0x47a5('0x29')](handleEntityNotFound(_0x133b7a,null))[_0x47a5('0x29')](saveUpdates(_0x5bd86e['body'],null))[_0x47a5('0x29')](respondWithResult(_0x133b7a,null))['catch'](handleError(_0x133b7a,null));};exports['destroy']=function(_0x5db0ed,_0x21cb5f){return db['SmsInteraction'][_0x47a5('0x5f')]({'where':{'id':_0x5db0ed[_0x47a5('0xb1')]['id']}})[_0x47a5('0x29')](handleEntityNotFound(_0x21cb5f,null))['then'](removeEntity(_0x21cb5f,null))[_0x47a5('0x34')](handleError(_0x21cb5f,null));};exports[_0x47a5('0xb6')]=function(_0x35bf37,_0x121750){return db[_0x47a5('0x9e')]['describe']()[_0x47a5('0x29')](respondWithResult(_0x121750,null))[_0x47a5('0x34')](handleError(_0x121750,null));};exports['addMessage']=function(_0x42ba59,_0x419870,_0xafa46f){return db[_0x47a5('0xb7')][_0x47a5('0x5f')]({'where':{'id':_0x42ba59[_0x47a5('0xb1')]['id']}})['then'](handleEntityNotFound(_0x419870,null))[_0x47a5('0x29')](function(_0x2e418d){if(_0x2e418d){return _0x2e418d['addMessage'](_0x42ba59[_0x47a5('0x72')][_0x47a5('0xb8')],_[_0x47a5('0xb9')](_0x42ba59[_0x47a5('0x72')],['ids','id'])||{});}})['then'](respondWithResult(_0x419870,null))['catch'](handleError(_0x419870,null));};exports['getMessages']=function(_0x1946c6,_0x27793e,_0x2c5785){var _0x30def7={'raw':![],'where':{}};var _0x31f896={};var _0x6bc37b={'count':0x0,'rows':[]};return db[_0x47a5('0x9e')][_0x47a5('0xba')]({'where':{'id':_0x1946c6['params']['id']}})[_0x47a5('0x29')](handleEntityNotFound(_0x27793e,null))[_0x47a5('0x29')](function(_0x2eef05){if(_0x2eef05){_0x31f896[_0x47a5('0x3a')]=_['keys'](db['SmsMessage'][_0x47a5('0x36')]);_0x31f896['query']=_['keys'](_0x1946c6[_0x47a5('0x3b')]);_0x31f896[_0x47a5('0x3c')]=_['intersection'](_0x31f896[_0x47a5('0x3a')],_0x31f896[_0x47a5('0x3b')]);_0x30def7[_0x47a5('0x3d')]=_['intersection'](_0x31f896[_0x47a5('0x3a')],qs[_0x47a5('0x3e')](_0x1946c6['query'][_0x47a5('0x3e')]));_0x30def7[_0x47a5('0x3d')]=_0x30def7[_0x47a5('0x3d')][_0x47a5('0x5e')]?_0x30def7[_0x47a5('0x3d')]:_0x31f896[_0x47a5('0x3a')];if(!_0x1946c6['query'][_0x47a5('0x3f')]('nolimit')){_0x30def7[_0x47a5('0x22')]=qs[_0x47a5('0x22')](_0x1946c6[_0x47a5('0x3b')][_0x47a5('0x22')]);_0x30def7['offset']=qs[_0x47a5('0x21')](_0x1946c6[_0x47a5('0x3b')][_0x47a5('0x21')]);}_0x30def7[_0x47a5('0x41')]=qs[_0x47a5('0x42')](_0x1946c6[_0x47a5('0x3b')][_0x47a5('0x42')]);_0x30def7[_0x47a5('0x43')]=qs[_0x47a5('0x3c')](_[_0x47a5('0x44')](_0x1946c6[_0x47a5('0x3b')],_0x31f896[_0x47a5('0x3c')]));_0x30def7['where'][_0x47a5('0xbb')]=_0x2eef05['id'];if(_0x1946c6[_0x47a5('0x3b')]['filter']){_0x30def7[_0x47a5('0x43')]=_[_0x47a5('0xbc')](_0x30def7[_0x47a5('0x43')],{'$or':_[_0x47a5('0x2f')](_0x30def7[_0x47a5('0x3d')],function(_0x58fac0){var _0x2dee0d={};_0x2dee0d[_0x58fac0]={'$like':'%'+_0x1946c6[_0x47a5('0x3b')][_0x47a5('0x85')]+'%'};return _0x2dee0d;})});}if(_0x1946c6[_0x47a5('0x3b')][_0x47a5('0x7a')]){var _0x363077=_0x1946c6[_0x47a5('0x3b')]['$gte']['split'](',');var _0xa3d578={};_0xa3d578[_0x363077[0x0]]={'$gte':moment(_0x363077[0x1])['format'](_0x47a5('0xbd'))};_0x30def7['where']=_[_0x47a5('0xbc')](_0x30def7[_0x47a5('0x43')],_0xa3d578);}_0x30def7=_[_0x47a5('0xbc')]({},_0x30def7,_0x1946c6[_0x47a5('0xbe')]);return db['SmsMessage'][_0x47a5('0x20')]({'where':_0x30def7[_0x47a5('0x43')]})[_0x47a5('0x29')](function(_0x5a150a){_0x6bc37b['count']=_0x5a150a;if(_0x1946c6[_0x47a5('0x3b')][_0x47a5('0xb3')]){_0x30def7[_0x47a5('0xb4')]=[{'all':!![]}];}return db[_0x47a5('0xb7')][_0x47a5('0xbf')](_0x30def7);})[_0x47a5('0x29')](function(_0x1c0323){_0x6bc37b[_0x47a5('0xc0')]=_0x1c0323;return _0x6bc37b;});}})['then'](respondWithFilteredResult(_0x27793e,_0x30def7))[_0x47a5('0x34')](handleError(_0x27793e,null));};exports['addTags']=function(_0x346322,_0xc3b5e1,_0x5b0b0b){return db['SmsInteraction'][_0x47a5('0x5f')]({'where':{'id':_0x346322[_0x47a5('0xb1')]['id']}})['then'](handleEntityNotFound(_0xc3b5e1,null))[_0x47a5('0x29')](function(_0x2b2693){if(_0x2b2693){return _0x2b2693[_0x47a5('0xc1')](_0x346322[_0x47a5('0x72')]['ids'],_[_0x47a5('0xb9')](_0x346322['body'],['ids','id'])||{})['spread'](function(){return db[_0x47a5('0xc2')]['findAll']({'attributes':['id',_0x47a5('0x2d'),_0x47a5('0x45')],'where':{'id':_0x346322[_0x47a5('0x72')][_0x47a5('0xb8')]}});})[_0x47a5('0x29')](function(_0x1dae08){socket[_0x47a5('0xc3')](_0x47a5('0xc4'),{'id':Number(_0x346322[_0x47a5('0xb1')]['id']),'tags':_0x1dae08||[]});return{'id':Number(_0x346322[_0x47a5('0xb1')]['id']),'tags':_0x1dae08||[]};});}})[_0x47a5('0x29')](respondWithResult(_0xc3b5e1,null))[_0x47a5('0x34')](handleError(_0xc3b5e1,null));};exports[_0x47a5('0xc5')]=function(_0x1bfa3b,_0xff64fb,_0x5e17cb){return db[_0x47a5('0x9e')][_0x47a5('0x5f')]({'where':{'id':_0x1bfa3b[_0x47a5('0xb1')]['id']}})[_0x47a5('0x29')](handleEntityNotFound(_0xff64fb,null))['then'](function(_0x367662){if(_0x367662){return _0x367662['removeTags'](_0x1bfa3b[_0x47a5('0x3b')]['ids']);}})[_0x47a5('0x29')](respondWithStatusCode(_0xff64fb,null))[_0x47a5('0x34')](handleError(_0xff64fb,null));};exports[_0x47a5('0xc6')]=function(_0x5c20aa,_0x35f735){var _0x217e04=moment()[_0x47a5('0xc7')]()['toString']();var _0x52798d=path[_0x47a5('0xc8')](config[_0x47a5('0xc9')],_0x47a5('0xca'),_0x47a5('0xcb'),_0x47a5('0xcc'));var _0x579e5c=path[_0x47a5('0xc8')](config['root'],_0x47a5('0xca'),_0x47a5('0xcb'),_0x47a5('0xcd'));var _0x2d6ae7=path['join'](_0x52798d,_0x217e04);var _0x4dc67c=util[_0x47a5('0xce')](_0x47a5('0xcf'),_0x5c20aa[_0x47a5('0xb1')]['id'],_0x217e04);var _0x4339d4=path[_0x47a5('0xc8')](_0x52798d,_0x4dc67c);var _0x36a44c=[];_0x36a44c[_0x47a5('0xaf')]({'model':db[_0x47a5('0x6e')],'as':_0x47a5('0x6e'),'attributes':['id','fullname'],'raw':!![]});_0x36a44c['push']({'model':db[_0x47a5('0xd0')],'as':'Contact','attributes':['id',_0x47a5('0xd1'),_0x47a5('0xd2')],'raw':!![]});var _0x1bae88=[{'model':db['SmsMessage'],'as':_0x47a5('0xd3'),'attributes':['id',_0x47a5('0x72'),'createdAt',_0x47a5('0xd4'),'secret',_0x47a5('0x80')],'include':_0x36a44c}];_0x1bae88[_0x47a5('0xaf')]({'model':db[_0x47a5('0xd5')],'as':'Account','attributes':['id','name']});_0x1bae88['push']({'model':db['User'],'as':'Owner','attributes':['id',_0x47a5('0x30')]});return db['SmsInteraction'][_0x47a5('0x5f')]({'where':{'id':_0x5c20aa[_0x47a5('0xb1')]['id']},'include':_0x1bae88})['then'](handleEntityNotFound(_0x35f735,null))['then'](function(_0x4b3529){if(_0x4b3529){var _0x2a6dca=_0x4b3529['get']({'plain':!![]});fs['mkdirSync'](_0x2d6ae7);var _0x5d17dc={'channel':_0x47a5('0xd6'),'account':_0x2a6dca[_0x47a5('0xd7')][_0x47a5('0x2d')],'agent':_0x2a6dca[_0x47a5('0xd8')]?_0x2a6dca['Owner'][_0x47a5('0x30')]:'N.A.','createdAt':moment(_0x2a6dca[_0x47a5('0xd9')])['format'](_0x47a5('0xbd'))[_0x47a5('0x9c')](),'closedAt':_0x2a6dca[_0x47a5('0xda')]?moment(_0x2a6dca['closedAt'])[_0x47a5('0xce')](_0x47a5('0xbd'))[_0x47a5('0x9c')]():'','disposition':_0x2a6dca[_0x47a5('0xdb')],'messages':_(_0x2a6dca['Messages'])[_0x47a5('0x85')]({'secret':![]})[_0x47a5('0x2f')](function(_0x4eebcd){return{'date':moment(_0x4eebcd[_0x47a5('0xd9')])[_0x47a5('0xce')](_0x47a5('0xbd'))['toString'](),'sender':_0x4eebcd[_0x47a5('0xd4')]===_0x47a5('0xdc')?_0x4eebcd[_0x47a5('0x6e')]?_0x4eebcd[_0x47a5('0x6e')][_0x47a5('0x30')]:_0x47a5('0xdd'):_0x4eebcd[_0x47a5('0x64')][_0x47a5('0xd1')]+(_0x4eebcd[_0x47a5('0x64')][_0x47a5('0xd2')]?'\x20'+_0x4eebcd[_0x47a5('0x64')][_0x47a5('0xd2')]:''),'body':_0x4eebcd[_0x47a5('0x72')],'direction':_0x4eebcd[_0x47a5('0xd4')]===_0x47a5('0xdc')?'A':'C','secret':_0x4eebcd[_0x47a5('0xde')],'read':_0x4eebcd[_0x47a5('0x80')]};})['value']()};return ejs[_0x47a5('0xdf')](path['join'](config['root'],_0x47a5('0xca'),_0x47a5('0xe0'),_0x47a5('0xe1')),{'interaction':_0x5d17dc})['then'](function(_0x1f8e28){var _0xd8381b=path[_0x47a5('0xc8')](_0x2d6ae7,_0x47a5('0xe2')+_0x2a6dca['id']+'-'+_0x217e04+_0x47a5('0xe3'));var _0x28ba38={'path':_0xd8381b,'channel':_0x47a5('0xd6'),'interactionId':_0x2a6dca['id']};return pdf[_0x47a5('0xe4')](_0x1f8e28,_0x28ba38);})[_0x47a5('0x29')](function(){return new BPromise(function(_0x15f273,_0x10952f){zipdir(_0x2d6ae7,{'saveTo':_0x4339d4},function(_0x399026,_0x203bc9){if(_0x399026)return _0x10952f(_0x399026);return _0x15f273(_0x203bc9);});})['then'](function(){return new BPromise(function(_0x4aad5f,_0x2884c9){rimraf(_0x2d6ae7,function(_0x5e7d56){if(_0x5e7d56)_0x2884c9(_0x5e7d56);return _0x4aad5f();});});})[_0x47a5('0x29')](function(){return _0x35f735[_0x47a5('0xc6')](_0x4339d4,_0x4dc67c,function(_0x1f776e){if(_0x1f776e){console[_0x47a5('0xe5')](_0x47a5('0xe6'),_0x1f776e);}else{fs[_0x47a5('0xe7')](_0x4339d4);}});});});}else{return _0x35f735['sendStatus'](0xc8);}})[_0x47a5('0x34')](handleError(_0x35f735,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index e291e73..9623cae 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 _0x6f47=['findAll','unreadMessages','length','catch','hasOwnProperty','hook','exports','../../mysqldb','SmsInteraction','SmsMessage','save','remove','getUsers','then','Users','map'];(function(_0x44c283,_0x222759){var _0x424c16=function(_0x213f78){while(--_0x213f78){_0x44c283['push'](_0x44c283['shift']());}};_0x424c16(++_0x222759);}(_0x6f47,0xc7));var _0x76f4=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x6f47[_0x4b2863];return _0x567d67;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x76f4('0x0'))['db'][_0x76f4('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0x76f4('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x76f4('0x3'),'afterUpdate':'update','afterDestroy':_0x76f4('0x4')};function emitEvent(_0xc5dddc){return function(_0x2795ee,_0x2523ba,_0x5754ca){_0x2795ee[_0x76f4('0x5')]({'attributes':['id'],'raw':!![]})[_0x76f4('0x6')](function(_0x2176a7){_0x2795ee['setDataValue'](_0x76f4('0x7'),_0x2176a7[_0x76f4('0x8')](function(_0x65d2c7){return{'id':_0x65d2c7['id']};}));return SmsMessage[_0x76f4('0x9')]({'where':{'SmsInteractionId':_0x2795ee['id'],'direction':'in','read':![]},'raw':!![]});})[_0x76f4('0x6')](function(_0x4c6b5c){_0x2795ee['setDataValue'](_0x76f4('0xa'),_0x4c6b5c[_0x76f4('0xb')]);SmsInteractionEvents['emit'](_0xc5dddc+':'+_0x2795ee['id'],_0x2795ee);SmsInteractionEvents['emit'](_0xc5dddc,_0x2795ee);_0x5754ca(null);})[_0x76f4('0xc')](_0x5754ca(null));};}for(var e in events){if(events[_0x76f4('0xd')](e)){var event=events[e];SmsInteraction[_0x76f4('0xe')](e,emitEvent(event));}}module[_0x76f4('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x1c9a=['Users','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','getUsers','then','setDataValue'];(function(_0x1eafb0,_0x321747){var _0x2e0d81=function(_0x190a38){while(--_0x190a38){_0x1eafb0['push'](_0x1eafb0['shift']());}};_0x2e0d81(++_0x321747);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x221c89,_0x46375d){_0x221c89=_0x221c89-0x0;var _0x9d4d43=_0x1c9a[_0x221c89];return _0x9d4d43;};'use strict';var EventEmitter=require(_0xa1c9('0x0'));var SmsInteraction=require(_0xa1c9('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0xa1c9('0x1'))['db'][_0xa1c9('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xa1c9('0x3')](0x0);var events={'afterCreate':_0xa1c9('0x4'),'afterUpdate':_0xa1c9('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2f883c){return function(_0x5bccfd,_0x1716cb,_0xdd22bf){_0x5bccfd[_0xa1c9('0x6')]({'attributes':['id'],'raw':!![]})[_0xa1c9('0x7')](function(_0x1a0364){_0x5bccfd[_0xa1c9('0x8')](_0xa1c9('0x9'),_0x1a0364[_0xa1c9('0xa')](function(_0x1b4b82){return{'id':_0x1b4b82['id']};}));return SmsMessage[_0xa1c9('0xb')]({'where':{'SmsInteractionId':_0x5bccfd['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa1c9('0x7')](function(_0xb96573){_0x5bccfd['setDataValue']('unreadMessages',_0xb96573[_0xa1c9('0xc')]);SmsInteractionEvents['emit'](_0x2f883c+':'+_0x5bccfd['id'],_0x5bccfd);SmsInteractionEvents[_0xa1c9('0xd')](_0x2f883c,_0x5bccfd);_0xdd22bf(null);})[_0xa1c9('0xe')](_0xdd22bf(null));};}for(var e in events){if(events[_0xa1c9('0xf')](e)){var event=events[e];SmsInteraction[_0xa1c9('0x10')](e,emitEvent(event));}}module[_0xa1c9('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 9067dae..819618a 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 _0x4d59=['./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x4d59,0x100));var _0x94d5=function(_0x5e7767,_0x327e8f){_0x5e7767=_0x5e7767-0x0;var _0x5994bc=_0x4d59[_0x5e7767];return _0x5994bc;};'use strict';var _=require(_0x94d5('0x0'));var util=require(_0x94d5('0x1'));var logger=require(_0x94d5('0x2'))(_0x94d5('0x3'));var moment=require(_0x94d5('0x4'));var BPromise=require(_0x94d5('0x5'));var rp=require(_0x94d5('0x6'));var fs=require('fs');var path=require(_0x94d5('0x7'));var rimraf=require(_0x94d5('0x8'));var config=require(_0x94d5('0x9'));var attributes=require(_0x94d5('0xa'));module[_0x94d5('0xb')]=function(_0x5a995f,_0x2747c3){return _0x5a995f['define'](_0x94d5('0xc'),attributes,{'tableName':_0x94d5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5aab88,_0x1521f7,_0x50f561){if(_0x5aab88[_0x94d5('0xe')](_0x94d5('0xf'))){_0x5aab88[_0x94d5('0x10')]=moment()[_0x94d5('0x11')](_0x94d5('0x12'));}_0x50f561(null,_0x5aab88);}}});}; \ No newline at end of file +var _0x2f7c=['./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closed','format','lodash','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x2f7c,0x69));var _0xc2f7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2f7c[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xc2f7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc2f7('0x1'));var moment=require(_0xc2f7('0x2'));var BPromise=require(_0xc2f7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc2f7('0x4'));var rimraf=require(_0xc2f7('0x5'));var config=require(_0xc2f7('0x6'));var attributes=require(_0xc2f7('0x7'));module[_0xc2f7('0x8')]=function(_0x3df2d8,_0x3e21f2){return _0x3df2d8['define'](_0xc2f7('0x9'),attributes,{'tableName':_0xc2f7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x410b2a,_0x448810,_0x28cf96){if(_0x410b2a[_0xc2f7('0xb')](_0xc2f7('0xc'))){_0x410b2a['closedAt']=moment()[_0xc2f7('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x28cf96(null,_0x410b2a);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 91445aa..4dfd4b7 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 _0x006d=['UpdateSmsInteraction','stringify','AddTagsToSmsInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','SmsInteraction','body','options','raw','where','attributes','limit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x006d,0x1e8));var _0xd006=function(_0x1d23b9,_0x2346ef){_0x1d23b9=_0x1d23b9-0x0;var _0x5c64d4=_0x006d[_0x1d23b9];return _0x5c64d4;};'use strict';var _=require(_0xd006('0x0'));var util=require(_0xd006('0x1'));var moment=require(_0xd006('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd006('0x3'))['db'];var utils=require(_0xd006('0x4'));var logger=require(_0xd006('0x5'))(_0xd006('0x6'));var config=require('../../config/environment');var jayson=require(_0xd006('0x7'));var client=jayson[_0xd006('0x8')][_0xd006('0x9')]({'port':0x232a});config[_0xd006('0xa')]=_[_0xd006('0xb')](config[_0xd006('0xa')],{'host':_0xd006('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd006('0xa')]));require(_0xd006('0xd'))['register'](socket);function respondWithRpcPromise(_0x258c50,_0x50086a,_0x69ced1){return new BPromise(function(_0x22f14e,_0x441f85){return client[_0xd006('0xe')](_0x258c50,_0x69ced1)[_0xd006('0xf')](function(_0x34f8dd){logger[_0xd006('0x10')](_0xd006('0x11'),_0x50086a,_0xd006('0x12'));logger[_0xd006('0x13')](_0xd006('0x14'),_0x50086a,_0xd006('0x12'),JSON['stringify'](_0x34f8dd));if(_0x34f8dd[_0xd006('0x15')]){if(_0x34f8dd['error'][_0xd006('0x16')]===0x1f4){logger[_0xd006('0x15')](_0xd006('0x11'),_0x50086a,_0x34f8dd['error'][_0xd006('0x17')]);return _0x441f85(_0x34f8dd['error'][_0xd006('0x17')]);}logger[_0xd006('0x15')](_0xd006('0x11'),_0x50086a,_0x34f8dd['error'][_0xd006('0x17')]);return _0x22f14e(_0x34f8dd[_0xd006('0x15')]['message']);}else{logger[_0xd006('0x10')](_0xd006('0x11'),_0x50086a,_0xd006('0x12'));_0x22f14e(_0x34f8dd['result'][_0xd006('0x17')]);}})[_0xd006('0x18')](function(_0x4675a6){logger[_0xd006('0x15')](_0xd006('0x11'),_0x50086a,_0x4675a6);_0x441f85(_0x4675a6);});});}exports['UpdateSmsInteraction']=function(_0x262a7c){var _0x1c76f6=this;return new Promise(function(_0x40a613,_0x241d6f){return db[_0xd006('0x19')]['update'](_0x262a7c[_0xd006('0x1a')],{'raw':_0x262a7c[_0xd006('0x1b')]?_0x262a7c[_0xd006('0x1b')][_0xd006('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x262a7c[_0xd006('0x1b')]?_0x262a7c[_0xd006('0x1b')][_0xd006('0x1d')]||null:null,'attributes':_0x262a7c['options']?_0x262a7c[_0xd006('0x1b')][_0xd006('0x1e')]||null:null,'limit':_0x262a7c[_0xd006('0x1b')]?_0x262a7c[_0xd006('0x1b')][_0xd006('0x1f')]||null:null})[_0xd006('0xf')](function(_0x2ed82d){logger[_0xd006('0x10')](_0xd006('0x20'),_0x262a7c);logger[_0xd006('0x13')](_0xd006('0x20'),_0x262a7c,JSON[_0xd006('0x21')](_0x2ed82d));_0x40a613(_0x2ed82d);})[_0xd006('0x18')](function(_0x190f9c){logger[_0xd006('0x15')](_0xd006('0x20'),_0x190f9c[_0xd006('0x17')],_0x262a7c);_0x241d6f(_0x1c76f6[_0xd006('0x15')](0x1f4,_0x190f9c['message']));});});};exports[_0xd006('0x22')]=function(_0x11e179){return new Promise(function(_0x49e271,_0x5a075e){return db[_0xd006('0x19')][_0xd006('0x23')]({'where':_0x11e179[_0xd006('0x1b')]?_0x11e179[_0xd006('0x1b')]['where']||null:null})[_0xd006('0xf')](function(_0x504a1a){if(_0x504a1a){return _0x504a1a[_0xd006('0x24')](_0x11e179[_0xd006('0x1a')][_0xd006('0x25')],_['omit'](_0x11e179['body'],[_0xd006('0x25'),'id'])||{});}})[_0xd006('0x26')](function(_0x1ad55d){logger['info'](_0xd006('0x27'),_0x11e179);logger[_0xd006('0x13')](_0xd006('0x27'),_0x11e179,JSON[_0xd006('0x21')](_0x1ad55d));_0x49e271(_0x1ad55d);})[_0xd006('0x18')](function(_0x54891f){logger[_0xd006('0x15')](_0xd006('0x27'),_0x54891f[_0xd006('0x17')],_0x11e179);_0x5a075e(_this['error'](0x1f4,_0x54891f['message']));});});}; \ No newline at end of file +var _0xcd95=['info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','stringify','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../config/utils','jayson/promise','client','defaults','redis','socket.io-emitter','register','request','then'];(function(_0x5dde67,_0x5c13d7){var _0x7a25cf=function(_0x9f7edb){while(--_0x9f7edb){_0x5dde67['push'](_0x5dde67['shift']());}};_0x7a25cf(++_0x5c13d7);}(_0xcd95,0x151));var _0x5cd9=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0xcd95[_0x3cb6dc];return _0x47ec89;};'use strict';var _=require(_0x5cd9('0x0'));var util=require(_0x5cd9('0x1'));var moment=require(_0x5cd9('0x2'));var BPromise=require(_0x5cd9('0x3'));var rs=require(_0x5cd9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5cd9('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5cd9('0x6'));var client=jayson[_0x5cd9('0x7')]['http']({'port':0x232a});config['redis']=_[_0x5cd9('0x8')](config[_0x5cd9('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x5cd9('0xa'))(new Redis(config[_0x5cd9('0x9')]));require('./smsInteraction.socket')[_0x5cd9('0xb')](socket);function respondWithRpcPromise(_0x52faa2,_0x3b8df9,_0xd64a69){return new BPromise(function(_0x40a20d,_0x5df5be){return client[_0x5cd9('0xc')](_0x52faa2,_0xd64a69)[_0x5cd9('0xd')](function(_0x6a8e8e){logger[_0x5cd9('0xe')](_0x5cd9('0xf'),_0x3b8df9,'request\x20sent');logger[_0x5cd9('0x10')](_0x5cd9('0x11'),_0x3b8df9,_0x5cd9('0x12'),JSON['stringify'](_0x6a8e8e));if(_0x6a8e8e[_0x5cd9('0x13')]){if(_0x6a8e8e[_0x5cd9('0x13')][_0x5cd9('0x14')]===0x1f4){logger[_0x5cd9('0x13')](_0x5cd9('0xf'),_0x3b8df9,_0x6a8e8e[_0x5cd9('0x13')][_0x5cd9('0x15')]);return _0x5df5be(_0x6a8e8e['error'][_0x5cd9('0x15')]);}logger[_0x5cd9('0x13')](_0x5cd9('0xf'),_0x3b8df9,_0x6a8e8e[_0x5cd9('0x13')][_0x5cd9('0x15')]);return _0x40a20d(_0x6a8e8e[_0x5cd9('0x13')][_0x5cd9('0x15')]);}else{logger['info'](_0x5cd9('0xf'),_0x3b8df9,'request\x20sent');_0x40a20d(_0x6a8e8e[_0x5cd9('0x16')]['message']);}})[_0x5cd9('0x17')](function(_0x2306bc){logger[_0x5cd9('0x13')](_0x5cd9('0xf'),_0x3b8df9,_0x2306bc);_0x5df5be(_0x2306bc);});});}exports[_0x5cd9('0x18')]=function(_0x2398a3){var _0x11b25d=this;return new Promise(function(_0x557b8c,_0x2b77e4){return db[_0x5cd9('0x19')][_0x5cd9('0x1a')](_0x2398a3[_0x5cd9('0x1b')],{'raw':_0x2398a3[_0x5cd9('0x1c')]?_0x2398a3['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2398a3['options']?_0x2398a3[_0x5cd9('0x1c')][_0x5cd9('0x1d')]||null:null,'attributes':_0x2398a3[_0x5cd9('0x1c')]?_0x2398a3[_0x5cd9('0x1c')][_0x5cd9('0x1e')]||null:null,'limit':_0x2398a3[_0x5cd9('0x1c')]?_0x2398a3[_0x5cd9('0x1c')]['limit']||null:null})[_0x5cd9('0xd')](function(_0x52ecc7){logger[_0x5cd9('0xe')]('UpdateSmsInteraction',_0x2398a3);logger['debug'](_0x5cd9('0x18'),_0x2398a3,JSON[_0x5cd9('0x1f')](_0x52ecc7));_0x557b8c(_0x52ecc7);})[_0x5cd9('0x17')](function(_0xd3f928){logger['error'](_0x5cd9('0x18'),_0xd3f928[_0x5cd9('0x15')],_0x2398a3);_0x2b77e4(_0x11b25d[_0x5cd9('0x13')](0x1f4,_0xd3f928[_0x5cd9('0x15')]));});});};exports[_0x5cd9('0x20')]=function(_0x5d9471){return new Promise(function(_0x3618b1,_0x34c15d){return db[_0x5cd9('0x19')][_0x5cd9('0x21')]({'where':_0x5d9471[_0x5cd9('0x1c')]?_0x5d9471['options']['where']||null:null})[_0x5cd9('0xd')](function(_0x16b373){if(_0x16b373){return _0x16b373[_0x5cd9('0x22')](_0x5d9471[_0x5cd9('0x1b')][_0x5cd9('0x23')],_[_0x5cd9('0x24')](_0x5d9471[_0x5cd9('0x1b')],[_0x5cd9('0x23'),'id'])||{});}})[_0x5cd9('0x25')](function(_0x23e358){logger[_0x5cd9('0xe')]('AddTags',_0x5d9471);logger[_0x5cd9('0x10')]('AddTags',_0x5d9471,JSON[_0x5cd9('0x1f')](_0x23e358));_0x3618b1(_0x23e358);})[_0x5cd9('0x17')](function(_0x2d4a61){logger[_0x5cd9('0x13')](_0x5cd9('0x26'),_0x2d4a61[_0x5cd9('0x15')],_0x5d9471);_0x34c15d(_this['error'](0x1f4,_0x2d4a61[_0x5cd9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index ec5f954..b24f225 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 _0x2032=['save','remove','update','removeListener','register','length','smsInteraction:'];(function(_0x37b3e5,_0x33b516){var _0x207f20=function(_0x5237fa){while(--_0x5237fa){_0x37b3e5['push'](_0x37b3e5['shift']());}};_0x207f20(++_0x33b516);}(_0x2032,0xd9));var _0x2203=function(_0x26e5a5,_0x54d68a){_0x26e5a5=_0x26e5a5-0x0;var _0x399d3e=_0x2032[_0x26e5a5];return _0x399d3e;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x2203('0x0'),_0x2203('0x1'),_0x2203('0x2')];function createListener(_0x4c28da,_0x486390){return function(_0x228a29){_0x486390['emit'](_0x4c28da,_0x228a29);};}function removeListener(_0x46c49a,_0x880dcd){return function(){SmsInteractionEvents[_0x2203('0x3')](_0x46c49a,_0x880dcd);};}exports[_0x2203('0x4')]=function(_0x3f7ba1){for(var _0x13367a=0x0,_0x2e0f63=events[_0x2203('0x5')];_0x13367a<_0x2e0f63;_0x13367a++){var _0x18c4d6=events[_0x13367a];var _0x2049ff=createListener(_0x2203('0x6')+_0x18c4d6,_0x3f7ba1);SmsInteractionEvents['on'](_0x18c4d6,_0x2049ff);}}; \ No newline at end of file +var _0x757a=['save','remove','emit','removeListener','register','smsInteraction:'];(function(_0x4edcc3,_0x4785c5){var _0x4db6f2=function(_0xa3afe9){while(--_0xa3afe9){_0x4edcc3['push'](_0x4edcc3['shift']());}};_0x4db6f2(++_0x4785c5);}(_0x757a,0xde));var _0xa757=function(_0x2dee10,_0x4917c3){_0x2dee10=_0x2dee10-0x0;var _0x52ec39=_0x757a[_0x2dee10];return _0x52ec39;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xa757('0x0'),_0xa757('0x1'),'update'];function createListener(_0x5c03c3,_0x5709ed){return function(_0x32be3b){_0x5709ed[_0xa757('0x2')](_0x5c03c3,_0x32be3b);};}function removeListener(_0x1c2932,_0x453d07){return function(){SmsInteractionEvents[_0xa757('0x3')](_0x1c2932,_0x453d07);};}exports[_0xa757('0x4')]=function(_0x5edca8){for(var _0xae0e7c=0x0,_0x4343b6=events['length'];_0xae0e7c<_0x4343b6;_0xae0e7c++){var _0x2930fa=events[_0xae0e7c];var _0x2f7793=createListener(_0xa757('0x5')+_0x2930fa,_0x5edca8);SmsInteractionEvents['on'](_0x2930fa,_0x2f7793);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 089ed70..f3c4b58 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 _0x4b02=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','describe','show','post','tracked','smsmessage:create','create','/:id/status','status','put','/:id','/:id/accept','accept','reject','delete','exports','multer'];(function(_0x4ad0aa,_0xbfdc3){var _0x16256a=function(_0x109a63){while(--_0x109a63){_0x4ad0aa['push'](_0x4ad0aa['shift']());}};_0x16256a(++_0xbfdc3);}(_0x4b02,0x14f));var _0x24b0=function(_0x3cb8ef,_0x56eaa1){_0x3cb8ef=_0x3cb8ef-0x0;var _0xf5df53=_0x4b02[_0x3cb8ef];return _0xf5df53;};'use strict';var multer=require(_0x24b0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x24b0('0x1'));var express=require(_0x24b0('0x2'));var router=express[_0x24b0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x24b0('0x4'));var interaction=require(_0x24b0('0x5'));var config=require('../../config/environment');var controller=require(_0x24b0('0x6'));router[_0x24b0('0x7')]('/',auth[_0x24b0('0x8')](),controller['index']);router[_0x24b0('0x7')]('/describe',auth[_0x24b0('0x8')](),controller[_0x24b0('0x9')]);router[_0x24b0('0x7')]('/:id',auth[_0x24b0('0x8')](),controller[_0x24b0('0xa')]);router[_0x24b0('0xb')]('/',auth[_0x24b0('0x8')](),interaction[_0x24b0('0xc')]('sms',_0x24b0('0xd')),controller[_0x24b0('0xe')]);router[_0x24b0('0xb')](_0x24b0('0xf'),controller[_0x24b0('0x10')]);router[_0x24b0('0x11')](_0x24b0('0x12'),auth[_0x24b0('0x8')](),controller['update']);router[_0x24b0('0x11')](_0x24b0('0x13'),auth[_0x24b0('0x8')](),controller[_0x24b0('0x14')]);router[_0x24b0('0x11')]('/:id/reject',auth['isAuthenticated'](),controller[_0x24b0('0x15')]);router[_0x24b0('0x16')](_0x24b0('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x24b0('0x17')]=router; \ No newline at end of file +var _0x49f0=['describe','/:id','show','post','tracked','sms','smsmessage:create','/:id/status','status','put','update','/:id/accept','accept','reject','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x3cab38,_0x439e61){var _0x187d60=function(_0x285a14){while(--_0x285a14){_0x3cab38['push'](_0x3cab38['shift']());}};_0x187d60(++_0x439e61);}(_0x49f0,0x1c4));var _0x049f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x49f0[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0x049f('0x0'));var path=require('path');var timeout=require(_0x049f('0x1'));var express=require(_0x049f('0x2'));var router=express['Router']();var fs_extra=require(_0x049f('0x3'));var auth=require(_0x049f('0x4'));var interaction=require(_0x049f('0x5'));var config=require(_0x049f('0x6'));var controller=require(_0x049f('0x7'));router[_0x049f('0x8')]('/',auth[_0x049f('0x9')](),controller[_0x049f('0xa')]);router[_0x049f('0x8')](_0x049f('0xb'),auth[_0x049f('0x9')](),controller[_0x049f('0xc')]);router[_0x049f('0x8')](_0x049f('0xd'),auth[_0x049f('0x9')](),controller[_0x049f('0xe')]);router[_0x049f('0xf')]('/',auth['isAuthenticated'](),interaction[_0x049f('0x10')](_0x049f('0x11'),_0x049f('0x12')),controller['create']);router[_0x049f('0xf')](_0x049f('0x13'),controller[_0x049f('0x14')]);router[_0x049f('0x15')](_0x049f('0xd'),auth[_0x049f('0x9')](),controller[_0x049f('0x16')]);router[_0x049f('0x15')](_0x049f('0x17'),auth[_0x049f('0x9')](),controller[_0x049f('0x18')]);router[_0x049f('0x15')]('/:id/reject',auth[_0x049f('0x9')](),controller[_0x049f('0x19')]);router[_0x049f('0x1a')](_0x049f('0xd'),auth[_0x049f('0x9')](),controller[_0x049f('0x1b')]);module[_0x049f('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index a7d2c88..8ef398f 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 _0xa8ab=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x3b08de,_0x63ddd0){var _0x53fbe4=function(_0x16eea2){while(--_0x16eea2){_0x3b08de['push'](_0x3b08de['shift']());}};_0x53fbe4(++_0x63ddd0);}(_0xa8ab,0x7f));var _0xba8a=function(_0x5321b8,_0x325ce4){_0x5321b8=_0x5321b8-0x0;var _0x4efd0d=_0xa8ab[_0x5321b8];return _0x4efd0d;};'use strict';var Sequelize=require(_0xba8a('0x0'));module[_0xba8a('0x1')]={'body':{'type':Sequelize[_0xba8a('0x2')](_0xba8a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xba8a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xba8a('0x5')]('in','out'),'defaultValue':_0xba8a('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xba8a('0x7')](0xbe)},'phone':{'type':Sequelize[_0xba8a('0x7')]},'readAt':{'type':Sequelize[_0xba8a('0x8')]},'secret':{'type':Sequelize[_0xba8a('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xba8a('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x0cab=['exports','TEXT','medium','ENUM','out','STRING','DATE','BOOLEAN'];(function(_0x442010,_0x2f30a5){var _0xa27255=function(_0x2fa0ac){while(--_0x2fa0ac){_0x442010['push'](_0x442010['shift']());}};_0xa27255(++_0x2f30a5);}(_0x0cab,0x118));var _0xb0ca=function(_0x174af1,_0x14db9){_0x174af1=_0x174af1-0x0;var _0x2cb2e1=_0x0cab[_0x174af1];return _0x2cb2e1;};'use strict';var Sequelize=require('sequelize');module[_0xb0ca('0x0')]={'body':{'type':Sequelize[_0xb0ca('0x1')](_0xb0ca('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xb0ca('0x3')]('in',_0xb0ca('0x4')),'defaultValue':_0xb0ca('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb0ca('0x5')](0xbe)},'phone':{'type':Sequelize[_0xb0ca('0x5')]},'readAt':{'type':Sequelize[_0xb0ca('0x6')]},'secret':{'type':Sequelize[_0xb0ca('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'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 71eceea..0738690 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 _0xace3=['include','create','body','find','params','describe','sms-interactions','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','SmsInteractionId','isNil','format','interaction','get','user','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','EventManager','acceptmessage','agent','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','event','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','indexOf','sent','delivered','Status','plivio','results','groupName','DELIVERED','infobip','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','localhost','redis','./smsMessage.socket','register','jayson/promise','client','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','end','status','count','offset','set','Content-Range','json','reject','save','update','destroy','name','index','SmsMessage','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','options','includeAll','rows','show','keys'];(function(_0x1b90e3,_0x37410c){var _0x198a15=function(_0x3e425d){while(--_0x3e425d){_0x1b90e3['push'](_0x1b90e3['shift']());}};_0x198a15(++_0x37410c);}(_0xace3,0x146));var _0x3ace=function(_0x2bfc05,_0x29c0f8){_0x2bfc05=_0x2bfc05-0x0;var _0x14459b=_0xace3[_0x2bfc05];return _0x14459b;};'use strict';var emlformat=require(_0x3ace('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3ace('0x1'));var jsonpatch=require(_0x3ace('0x2'));var rp=require(_0x3ace('0x3'));var moment=require(_0x3ace('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3ace('0x5'));var util=require(_0x3ace('0x6'));var path=require(_0x3ace('0x7'));var sox=require(_0x3ace('0x8'));var csv=require('to-csv');var ejs=require(_0x3ace('0x9'));var fs=require('fs');var fs_extra=require(_0x3ace('0xa'));var _=require(_0x3ace('0xb'));var squel=require(_0x3ace('0xc'));var crypto=require(_0x3ace('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3ace('0xe'));var toCsv=require(_0x3ace('0xf'));var querystring=require(_0x3ace('0x10'));var Papa=require(_0x3ace('0x11'));var Redis=require(_0x3ace('0x12'));var authService=require(_0x3ace('0x13'));var qs=require(_0x3ace('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ace('0x15'));var logger=require(_0x3ace('0x16'))(_0x3ace('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3ace('0x18'));var db=require(_0x3ace('0x19'))['db'];config['redis']=_[_0x3ace('0x1a')](config['redis'],{'host':_0x3ace('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3ace('0x1c')]));require(_0x3ace('0x1d'))[_0x3ace('0x1e')](socket);var jayson=require(_0x3ace('0x1f'));var client=jayson[_0x3ace('0x20')][_0x3ace('0x21')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5d0d7c,_0x15c91a,_0x4f9b30,_0x226282){return new BPromise(function(_0x353caf,_0x5b74eb){var _0x46c501=_0x226282||client;return _0x46c501[_0x3ace('0x22')](_0x5d0d7c,_0x4f9b30)[_0x3ace('0x23')](function(_0x247cc2){logger['info'](_0x3ace('0x24'),_0x15c91a,_0x3ace('0x25'));logger[_0x3ace('0x26')](_0x3ace('0x27'),_0x15c91a,'request\x20sent',JSON[_0x3ace('0x28')](_0x247cc2));if(_0x247cc2[_0x3ace('0x29')]){if(_0x247cc2[_0x3ace('0x29')][_0x3ace('0x2a')]===0x1f4){logger[_0x3ace('0x29')]('SmsMessage,\x20%s,\x20%s',_0x15c91a,_0x247cc2[_0x3ace('0x29')][_0x3ace('0x2b')]);return _0x5b74eb(_0x247cc2[_0x3ace('0x29')][_0x3ace('0x2b')]);}logger[_0x3ace('0x29')](_0x3ace('0x24'),_0x15c91a,_0x247cc2['error'][_0x3ace('0x2b')]);return _0x353caf(_0x247cc2['error'][_0x3ace('0x2b')]);}else{logger[_0x3ace('0x2c')](_0x3ace('0x24'),_0x15c91a,_0x3ace('0x25'));_0x353caf(_0x247cc2['result'][_0x3ace('0x2b')]);}})[_0x3ace('0x2d')](function(_0x12b901){logger[_0x3ace('0x29')](_0x3ace('0x24'),_0x15c91a,_0x12b901);_0x5b74eb(_0x12b901);});});}function respondWithStatusCode(_0x3956ce,_0xa5b76e){_0xa5b76e=_0xa5b76e||0xcc;return function(_0x534d89){if(_0x534d89){return _0x3956ce[_0x3ace('0x2e')](_0xa5b76e);}return _0x3956ce['status'](_0xa5b76e)[_0x3ace('0x2f')]();};}function respondWithResult(_0x551089,_0x329299){_0x329299=_0x329299||0xc8;return function(_0x5ce0cc){if(_0x5ce0cc){return _0x551089[_0x3ace('0x30')](_0x329299)['json'](_0x5ce0cc);}};}function respondWithFilteredResult(_0x10228f,_0x45c522){return function(_0x3bd875){if(_0x3bd875){var _0x428f9c=_0x3bd875[_0x3ace('0x31')],_0x216fb8=_0x45c522[_0x3ace('0x32')],_0x28cf20=_0x45c522['offset']+_0x45c522['limit'],_0x2f53a7;if(_0x28cf20>=_0x428f9c){_0x28cf20=_0x428f9c;_0x2f53a7=0xc8;}else{_0x2f53a7=0xce;}_0x10228f[_0x3ace('0x30')](_0x2f53a7);return _0x10228f[_0x3ace('0x33')](_0x3ace('0x34'),_0x216fb8+'-'+_0x28cf20+'/'+_0x428f9c)[_0x3ace('0x35')](_0x3bd875);}return null;};}function patchUpdates(_0x1e10fb){return function(_0x377988){try{jsonpatch['apply'](_0x377988,_0x1e10fb,!![]);}catch(_0x55fe8f){return BPromise[_0x3ace('0x36')](_0x55fe8f);}return _0x377988[_0x3ace('0x37')]();};}function saveUpdates(_0x3d67d5,_0x50556f){return function(_0x2dc28a){if(_0x2dc28a){return _0x2dc28a[_0x3ace('0x38')](_0x3d67d5)[_0x3ace('0x23')](function(_0x2becad){return _0x2becad;});}return null;};}function removeEntity(_0x1b971b,_0x196a88){return function(_0x31d5a5){if(_0x31d5a5){return _0x31d5a5[_0x3ace('0x39')]()[_0x3ace('0x23')](function(){_0x1b971b['status'](0xcc)[_0x3ace('0x2f')]();});}};}function handleEntityNotFound(_0x5dde9c,_0x17f4af){return function(_0x37fe2b){if(!_0x37fe2b){_0x5dde9c[_0x3ace('0x2e')](0x194);}return _0x37fe2b;};}function handleError(_0x5ddeb1,_0x51834b){_0x51834b=_0x51834b||0x1f4;return function(_0x347f30){logger[_0x3ace('0x29')](_0x347f30['stack']);if(_0x347f30[_0x3ace('0x3a')]){delete _0x347f30[_0x3ace('0x3a')];}_0x5ddeb1[_0x3ace('0x30')](_0x51834b)['send'](_0x347f30);};}exports[_0x3ace('0x3b')]=function(_0xbd2300,_0x188730){var _0x27a3c0={},_0x19d359={},_0x485e08={'count':0x0,'rows':[]};var _0x452306=_['map'](db[_0x3ace('0x3c')][_0x3ace('0x3d')],function(_0x3ce774){return{'name':_0x3ce774[_0x3ace('0x3e')],'type':_0x3ce774['type']['key']};});_0x19d359[_0x3ace('0x3f')]=_['map'](_0x452306,_0x3ace('0x3a'));_0x19d359['query']=_['keys'](_0xbd2300[_0x3ace('0x40')]);_0x19d359[_0x3ace('0x41')]=_[_0x3ace('0x42')](_0x19d359['model'],_0x19d359[_0x3ace('0x40')]);_0x27a3c0['attributes']=_['intersection'](_0x19d359['model'],qs['fields'](_0xbd2300[_0x3ace('0x40')][_0x3ace('0x43')]));_0x27a3c0[_0x3ace('0x44')]=_0x27a3c0[_0x3ace('0x44')][_0x3ace('0x45')]?_0x27a3c0[_0x3ace('0x44')]:_0x19d359[_0x3ace('0x3f')];if(!_0xbd2300[_0x3ace('0x40')][_0x3ace('0x46')](_0x3ace('0x47'))){_0x27a3c0[_0x3ace('0x48')]=qs['limit'](_0xbd2300[_0x3ace('0x40')]['limit']);_0x27a3c0[_0x3ace('0x32')]=qs[_0x3ace('0x32')](_0xbd2300[_0x3ace('0x40')][_0x3ace('0x32')]);}_0x27a3c0[_0x3ace('0x49')]=qs[_0x3ace('0x4a')](_0xbd2300[_0x3ace('0x40')][_0x3ace('0x4a')]);_0x27a3c0[_0x3ace('0x4b')]=qs[_0x3ace('0x41')](_[_0x3ace('0x4c')](_0xbd2300['query'],_0x19d359[_0x3ace('0x41')]),_0x452306);if(_0xbd2300[_0x3ace('0x40')][_0x3ace('0x4d')]){_0x27a3c0[_0x3ace('0x4b')]=_[_0x3ace('0x4e')](_0x27a3c0[_0x3ace('0x4b')],{'$or':_['map'](_0x452306,function(_0x27da4c){if(_0x27da4c[_0x3ace('0x4f')]!=='VIRTUAL'){var _0x59ef3e={};_0x59ef3e[_0x27da4c['name']]={'$like':'%'+_0xbd2300['query']['filter']+'%'};return _0x59ef3e;}})});}_0x27a3c0=_[_0x3ace('0x4e')]({},_0x27a3c0,_0xbd2300[_0x3ace('0x50')]);var _0x4bc92d={'where':_0x27a3c0[_0x3ace('0x4b')]};return db[_0x3ace('0x3c')][_0x3ace('0x31')](_0x4bc92d)[_0x3ace('0x23')](function(_0x29a665){_0x485e08[_0x3ace('0x31')]=_0x29a665;if(_0xbd2300[_0x3ace('0x40')][_0x3ace('0x51')]){_0x27a3c0['include']=[{'all':!![]}];}return db[_0x3ace('0x3c')]['findAll'](_0x27a3c0);})['then'](function(_0x5c5b73){_0x485e08[_0x3ace('0x52')]=_0x5c5b73;return _0x485e08;})[_0x3ace('0x23')](respondWithFilteredResult(_0x188730,_0x27a3c0))[_0x3ace('0x2d')](handleError(_0x188730,null));};exports[_0x3ace('0x53')]=function(_0x2973f5,_0x4dd56a){var _0x1aeea3={'raw':!![],'where':{'id':_0x2973f5['params']['id']}},_0x454801={};_0x454801[_0x3ace('0x3f')]=_[_0x3ace('0x54')](db[_0x3ace('0x3c')]['rawAttributes']);_0x454801[_0x3ace('0x40')]=_['keys'](_0x2973f5[_0x3ace('0x40')]);_0x454801['filters']=_[_0x3ace('0x42')](_0x454801['model'],_0x454801[_0x3ace('0x40')]);_0x1aeea3[_0x3ace('0x44')]=_['intersection'](_0x454801['model'],qs[_0x3ace('0x43')](_0x2973f5['query'][_0x3ace('0x43')]));_0x1aeea3[_0x3ace('0x44')]=_0x1aeea3[_0x3ace('0x44')][_0x3ace('0x45')]?_0x1aeea3['attributes']:_0x454801['model'];if(_0x2973f5[_0x3ace('0x40')]['includeAll']){_0x1aeea3[_0x3ace('0x55')]=[{'all':!![]}];}_0x1aeea3=_[_0x3ace('0x4e')]({},_0x1aeea3,_0x2973f5[_0x3ace('0x50')]);return db[_0x3ace('0x3c')]['find'](_0x1aeea3)[_0x3ace('0x23')](handleEntityNotFound(_0x4dd56a,null))[_0x3ace('0x23')](respondWithResult(_0x4dd56a,null))[_0x3ace('0x2d')](handleError(_0x4dd56a,null));};exports['create']=function(_0x11ed99,_0x366672){return db[_0x3ace('0x3c')][_0x3ace('0x56')](_0x11ed99['body'],{})['then'](respondWithResult(_0x366672,0xc9))[_0x3ace('0x2d')](handleError(_0x366672,null));};exports[_0x3ace('0x38')]=function(_0x4084b6,_0x171370){if(_0x4084b6['body']['id']){delete _0x4084b6[_0x3ace('0x57')]['id'];}return db[_0x3ace('0x3c')][_0x3ace('0x58')]({'where':{'id':_0x4084b6[_0x3ace('0x59')]['id']}})[_0x3ace('0x23')](handleEntityNotFound(_0x171370,null))[_0x3ace('0x23')](saveUpdates(_0x4084b6[_0x3ace('0x57')],null))['then'](respondWithResult(_0x171370,null))[_0x3ace('0x2d')](handleError(_0x171370,null));};exports[_0x3ace('0x39')]=function(_0x237c23,_0x101f61){return db[_0x3ace('0x3c')][_0x3ace('0x58')]({'where':{'id':_0x237c23[_0x3ace('0x59')]['id']}})[_0x3ace('0x23')](handleEntityNotFound(_0x101f61,null))['then'](removeEntity(_0x101f61,null))[_0x3ace('0x2d')](handleError(_0x101f61,null));};exports[_0x3ace('0x5a')]=function(_0x79dd1,_0x338168){return db['SmsMessage'][_0x3ace('0x5a')]()[_0x3ace('0x23')](respondWithResult(_0x338168,null))[_0x3ace('0x2d')](handleError(_0x338168,null));};var interaction_log=require('../../config/logger')(_0x3ace('0x5b'));exports['accept']=function(_0xcc89c4,_0x209c0e,_0xab1df4){var _0x5055e1={'agent':{},'channel':_0x3ace('0x5c')};if(_0xcc89c4[_0x3ace('0x57')]['id']){delete _0xcc89c4[_0x3ace('0x57')]['id'];}_0xcc89c4[_0x3ace('0x57')][_0x3ace('0x5d')]=!![];_0xcc89c4['body'][_0x3ace('0x5e')]=moment()['format'](_0x3ace('0x5f'));_0xcc89c4[_0x3ace('0x57')][_0x3ace('0x60')]=_0xcc89c4[_0x3ace('0x57')][_0x3ace('0x60')]||_0xcc89c4['user']['id'];_0x5055e1['agent']['id']=_0xcc89c4[_0x3ace('0x57')][_0x3ace('0x60')];return db[_0x3ace('0x3c')][_0x3ace('0x58')]({'where':{'id':_0xcc89c4[_0x3ace('0x59')]['id'],'UserId':null},'include':[{'model':db[_0x3ace('0x61')],'as':_0x3ace('0x62')}]})[_0x3ace('0x23')](handleEntityNotFound(_0x209c0e,null))['then'](saveUpdates(_0xcc89c4['body'],null))[_0x3ace('0x23')](function(_0x38ddf5){if(_0x38ddf5){_0x5055e1[_0x3ace('0x2b')]=_0x38ddf5['get']({'plain':!![]});return db['SmsInteraction'][_0x3ace('0x58')]({'where':{'id':_0x38ddf5[_0x3ace('0x63')]}});}return null;})[_0x3ace('0x23')](handleEntityNotFound(_0x209c0e,null))[_0x3ace('0x23')](function(_0x2583bf){if(_0x2583bf){return _0x2583bf['update']({'UserId':_0xcc89c4[_0x3ace('0x57')][_0x3ace('0x60')],'read1stAt':_[_0x3ace('0x64')](_0x2583bf['read1stAt'])?moment()[_0x3ace('0x65')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x3ace('0x23')](function(_0x52b946){if(_0x52b946){_0x5055e1[_0x3ace('0x66')]=_0x52b946[_0x3ace('0x67')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xcc89c4[_0x3ace('0x68')]['id'],_0xcc89c4[_0x3ace('0x68')][_0x3ace('0x3a')],_0xcc89c4['user']['role'],_0x5055e1[_0x3ace('0x66')]['id'],_0xcc89c4[_0x3ace('0x57')]?JSON[_0x3ace('0x28')](_0xcc89c4[_0x3ace('0x57')]):_0x3ace('0x69'));return respondWithRpcPromise(_0x3ace('0x6a'),_0x3ace('0x6b'),_0x5055e1);}return null;})[_0x3ace('0x23')](function(_0xdec2d5){if(_0xdec2d5){if(_0xcc89c4[_0x3ace('0x57')]['manual']){_0x5055e1['message'][_0x3ace('0x6c')]=util[_0x3ace('0x65')](_0x3ace('0x6d'),_0xcc89c4[_0x3ace('0x68')]['name']);_0x5055e1['message']['channel']=_0x5055e1[_0x3ace('0x6e')];_0x5055e1[_0x3ace('0x2b')]['event']='accept';return respondWithRpcPromise(_0x3ace('0x6f'),'EventManager',{'event':_0x3ace('0x70'),'message':_0x5055e1['message']},client9002)[_0x3ace('0x23')](function(){return _0x5055e1;});}return _0x5055e1;}return null;})[_0x3ace('0x23')](respondWithResult(_0x209c0e,null))[_0x3ace('0x2d')](handleError(_0x209c0e,null));};var interaction_log=require(_0x3ace('0x16'))(_0x3ace('0x5b'));exports['reject']=function(_0x12f10c,_0x33235b,_0xd71bf){var _0xbe176={'agent':{},'channel':_0x3ace('0x5c')};if(_0x12f10c[_0x3ace('0x57')]['id']){delete _0x12f10c[_0x3ace('0x57')]['id'];}_0x12f10c[_0x3ace('0x57')][_0x3ace('0x60')]=_0x12f10c[_0x3ace('0x57')][_0x3ace('0x60')]||_0x12f10c[_0x3ace('0x68')]['id'];_0xbe176[_0x3ace('0x71')]['id']=_0x12f10c[_0x3ace('0x57')][_0x3ace('0x60')];return db['SmsMessage']['find']({'where':{'id':_0x12f10c['params']['id'],'UserId':null}})[_0x3ace('0x23')](handleEntityNotFound(_0x33235b,null))['then'](function(_0x114539){if(_0x114539){_0xbe176[_0x3ace('0x2b')]=_0x114539['get']({'plain':!![]});return db[_0x3ace('0x72')][_0x3ace('0x58')]({'where':{'id':_0x114539[_0x3ace('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x33235b,null))[_0x3ace('0x23')](function(_0x475a29){if(_0x475a29){_0xbe176[_0x3ace('0x66')]=_0x475a29['get']({'plain':!![]});interaction_log[_0x3ace('0x2c')](_0x3ace('0x73'),_0x12f10c['user']['id'],_0x12f10c[_0x3ace('0x68')][_0x3ace('0x3a')],_0x12f10c[_0x3ace('0x68')][_0x3ace('0x74')],_0xbe176[_0x3ace('0x66')]['id'],_0x12f10c[_0x3ace('0x57')]?JSON[_0x3ace('0x28')](_0x12f10c[_0x3ace('0x57')]):_0x3ace('0x69'));return respondWithRpcPromise('RejectMessage',_0x3ace('0x75'),_0xbe176);}return null;})[_0x3ace('0x23')](function(_0x35b19e){if(_0x35b19e){_0x35b19e['message'][_0x3ace('0x6c')]=util[_0x3ace('0x65')](_0x3ace('0x6d'),_0x12f10c[_0x3ace('0x68')][_0x3ace('0x3a')]);_0x35b19e['message'][_0x3ace('0x6e')]=_0xbe176[_0x3ace('0x6e')];_0x35b19e[_0x3ace('0x2b')][_0x3ace('0x76')]=_0x3ace('0x36');respondWithRpcPromise(_0x3ace('0x6f'),'EventManager',{'event':'rejectmessage','message':_0x35b19e[_0x3ace('0x2b')]},client9002);return _0xbe176;}return null;})['then'](respondWithResult(_0x33235b,null))[_0x3ace('0x2d')](handleError(_0x33235b,null));};exports[_0x3ace('0x30')]=function(_0xc2ae2c,_0x256226,_0x18d638){if(_0xc2ae2c[_0x3ace('0x57')]['id']){delete _0xc2ae2c[_0x3ace('0x57')]['id'];}var _0x413d24;return db[_0x3ace('0x3c')][_0x3ace('0x58')]({'where':{'id':_0xc2ae2c[_0x3ace('0x59')]['id']}})['then'](handleEntityNotFound(_0x256226,null))['then'](function(_0xbfe8c2){if(_0xbfe8c2){_0x413d24=_0xbfe8c2;return db[_0x3ace('0x77')][_0x3ace('0x58')]({'where':{'id':_0xbfe8c2[_0x3ace('0x78')]}});}})['then'](handleEntityNotFound(_0x256226,null))[_0x3ace('0x23')](function(_0x25d59b){if(_0x25d59b){logger['debug'](_0x3ace('0x27'),_0x3ace('0x30'),_0x3ace('0x79'),_0x25d59b[_0x3ace('0x4f')],util[_0x3ace('0x7a')](_0xc2ae2c[_0x3ace('0x57')],{'showHidden':![],'depth':null}));switch(_0x25d59b['type']){case _0x3ace('0x7b'):if(_0xc2ae2c['body']['MessageSid']&&_0xc2ae2c[_0x3ace('0x57')][_0x3ace('0x7c')]===_0x413d24[_0x3ace('0x7d')]){return _0x413d24[_0x3ace('0x38')]({'read':!![]});}else{logger[_0x3ace('0x29')](_0x3ace('0x7e'),_0x3ace('0x30'),'twilio',util['inspect'](_0xc2ae2c[_0x3ace('0x57')],{'showHidden':![],'depth':null}));}break;case _0x3ace('0x7f'):if(_0xc2ae2c[_0x3ace('0x57')]['MessageUUID']&&_0xc2ae2c[_0x3ace('0x57')]['MessageUUID']===_0x413d24[_0x3ace('0x7d')]&&_[_0x3ace('0x80')]([_0x3ace('0x81'),_0x3ace('0x82')],_0xc2ae2c['body'][_0x3ace('0x83')])>=0x0){return _0x413d24[_0x3ace('0x38')]({'read':!![]});}else{logger[_0x3ace('0x29')](_0x3ace('0x7e'),_0x3ace('0x30'),_0x3ace('0x84'),util['inspect'](_0xc2ae2c[_0x3ace('0x57')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x233275=_0xc2ae2c[_0x3ace('0x57')][_0x3ace('0x85')][0x0];if(_0x233275['status'][_0x3ace('0x86')]===_0x3ace('0x87')){return _0x413d24[_0x3ace('0x38')]({'read':!![]});}else{logger[_0x3ace('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3ace('0x30'),_0x3ace('0x88'),util[_0x3ace('0x7a')](_0xc2ae2c[_0x3ace('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x413d24;}})[_0x3ace('0x23')](respondWithResult(_0x256226,null))[_0x3ace('0x2d')](handleError(_0x256226,null));}; \ No newline at end of file +var _0xb6a1=['pick','merge','VIRTUAL','filter','include','findAll','show','params','keys','rawAttributes','intersection','options','find','catch','create','body','describe','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteractionId','isNil','read1stAt','role','interaction','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','agent','SmsInteraction','RejectMessage','rejectMessage','interface','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','sent','delivered','plivio','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsMessage,\x20%s,\x20%s','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','SmsMessage','fieldName','type','key','query','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','filters'];(function(_0xc6fa11,_0x5c6eec){var _0x390fee=function(_0x4e3095){while(--_0x4e3095){_0xc6fa11['push'](_0xc6fa11['shift']());}};_0x390fee(++_0x5c6eec);}(_0xb6a1,0x14d));var _0x1b6a=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xb6a1[_0x5f0089];return _0x193892;};'use strict';var emlformat=require(_0x1b6a('0x0'));var rimraf=require(_0x1b6a('0x1'));var zipdir=require(_0x1b6a('0x2'));var jsonpatch=require(_0x1b6a('0x3'));var rp=require('request-promise');var moment=require(_0x1b6a('0x4'));var BPromise=require(_0x1b6a('0x5'));var Mustache=require(_0x1b6a('0x6'));var util=require('util');var path=require(_0x1b6a('0x7'));var sox=require('sox');var csv=require(_0x1b6a('0x8'));var ejs=require(_0x1b6a('0x9'));var fs=require('fs');var fs_extra=require(_0x1b6a('0xa'));var _=require('lodash');var squel=require(_0x1b6a('0xb'));var crypto=require('crypto');var jsforce=require(_0x1b6a('0xc'));var deskjs=require(_0x1b6a('0xd'));var toCsv=require(_0x1b6a('0x8'));var querystring=require('querystring');var Papa=require(_0x1b6a('0xe'));var Redis=require(_0x1b6a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1b6a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1b6a('0x11'))(_0x1b6a('0x12'));var utils=require(_0x1b6a('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1b6a('0x14'));var db=require(_0x1b6a('0x15'))['db'];config[_0x1b6a('0x16')]=_[_0x1b6a('0x17')](config[_0x1b6a('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x1b6a('0x18'))(new Redis(config[_0x1b6a('0x16')]));require('./smsMessage.socket')[_0x1b6a('0x19')](socket);var jayson=require(_0x1b6a('0x1a'));var client=jayson[_0x1b6a('0x1b')][_0x1b6a('0x1c')]({'port':0x232c});var client9002=jayson[_0x1b6a('0x1b')][_0x1b6a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x22f1d2,_0xf834aa,_0x179a26,_0x3b1064){return new BPromise(function(_0x2dbcd0,_0x26d22f){var _0x3062df=_0x3b1064||client;return _0x3062df[_0x1b6a('0x1d')](_0x22f1d2,_0x179a26)[_0x1b6a('0x1e')](function(_0x578961){logger[_0x1b6a('0x1f')]('SmsMessage,\x20%s,\x20%s',_0xf834aa,'request\x20sent');logger[_0x1b6a('0x20')](_0x1b6a('0x21'),_0xf834aa,_0x1b6a('0x22'),JSON[_0x1b6a('0x23')](_0x578961));if(_0x578961[_0x1b6a('0x24')]){if(_0x578961[_0x1b6a('0x24')]['code']===0x1f4){logger[_0x1b6a('0x24')](_0x1b6a('0x25'),_0xf834aa,_0x578961['error'][_0x1b6a('0x26')]);return _0x26d22f(_0x578961['error']['message']);}logger[_0x1b6a('0x24')](_0x1b6a('0x25'),_0xf834aa,_0x578961[_0x1b6a('0x24')][_0x1b6a('0x26')]);return _0x2dbcd0(_0x578961['error'][_0x1b6a('0x26')]);}else{logger[_0x1b6a('0x1f')](_0x1b6a('0x25'),_0xf834aa,_0x1b6a('0x22'));_0x2dbcd0(_0x578961['result'][_0x1b6a('0x26')]);}})['catch'](function(_0x5bb8da){logger[_0x1b6a('0x24')](_0x1b6a('0x25'),_0xf834aa,_0x5bb8da);_0x26d22f(_0x5bb8da);});});}function respondWithStatusCode(_0x51e8f7,_0x4972fc){_0x4972fc=_0x4972fc||0xcc;return function(_0x494e85){if(_0x494e85){return _0x51e8f7[_0x1b6a('0x27')](_0x4972fc);}return _0x51e8f7[_0x1b6a('0x28')](_0x4972fc)[_0x1b6a('0x29')]();};}function respondWithResult(_0x4009ef,_0x1b1280){_0x1b1280=_0x1b1280||0xc8;return function(_0x3dbd69){if(_0x3dbd69){return _0x4009ef[_0x1b6a('0x28')](_0x1b1280)[_0x1b6a('0x2a')](_0x3dbd69);}};}function respondWithFilteredResult(_0x1220e0,_0x6f3094){return function(_0x108cfa){if(_0x108cfa){var _0x461cde=_0x108cfa[_0x1b6a('0x2b')],_0x44b297=_0x6f3094[_0x1b6a('0x2c')],_0x44f409=_0x6f3094['offset']+_0x6f3094[_0x1b6a('0x2d')],_0x54cf33;if(_0x44f409>=_0x461cde){_0x44f409=_0x461cde;_0x54cf33=0xc8;}else{_0x54cf33=0xce;}_0x1220e0[_0x1b6a('0x28')](_0x54cf33);return _0x1220e0[_0x1b6a('0x2e')](_0x1b6a('0x2f'),_0x44b297+'-'+_0x44f409+'/'+_0x461cde)[_0x1b6a('0x2a')](_0x108cfa);}return null;};}function patchUpdates(_0x587498){return function(_0xa0425){try{jsonpatch[_0x1b6a('0x30')](_0xa0425,_0x587498,!![]);}catch(_0x3e51f1){return BPromise[_0x1b6a('0x31')](_0x3e51f1);}return _0xa0425[_0x1b6a('0x32')]();};}function saveUpdates(_0x4c91ae,_0x370aef){return function(_0xbfdf9a){if(_0xbfdf9a){return _0xbfdf9a[_0x1b6a('0x33')](_0x4c91ae)[_0x1b6a('0x1e')](function(_0x16cf23){return _0x16cf23;});}return null;};}function removeEntity(_0x56f994,_0xd9cf86){return function(_0x345ebe){if(_0x345ebe){return _0x345ebe[_0x1b6a('0x34')]()['then'](function(){_0x56f994[_0x1b6a('0x28')](0xcc)[_0x1b6a('0x29')]();});}};}function handleEntityNotFound(_0x155d3d,_0x44baf0){return function(_0x2096ab){if(!_0x2096ab){_0x155d3d[_0x1b6a('0x27')](0x194);}return _0x2096ab;};}function handleError(_0xcc48ea,_0x53a594){_0x53a594=_0x53a594||0x1f4;return function(_0x321011){logger[_0x1b6a('0x24')](_0x321011[_0x1b6a('0x35')]);if(_0x321011['name']){delete _0x321011[_0x1b6a('0x36')];}_0xcc48ea[_0x1b6a('0x28')](_0x53a594)[_0x1b6a('0x37')](_0x321011);};}exports[_0x1b6a('0x38')]=function(_0x312f17,_0x2ffa11){var _0x298a05={},_0x416e8c={},_0x967f24={'count':0x0,'rows':[]};var _0x4845fc=_[_0x1b6a('0x39')](db[_0x1b6a('0x3a')]['rawAttributes'],function(_0x30b5fc){return{'name':_0x30b5fc[_0x1b6a('0x3b')],'type':_0x30b5fc[_0x1b6a('0x3c')][_0x1b6a('0x3d')]};});_0x416e8c['model']=_[_0x1b6a('0x39')](_0x4845fc,_0x1b6a('0x36'));_0x416e8c[_0x1b6a('0x3e')]=_['keys'](_0x312f17[_0x1b6a('0x3e')]);_0x416e8c['filters']=_['intersection'](_0x416e8c['model'],_0x416e8c[_0x1b6a('0x3e')]);_0x298a05[_0x1b6a('0x3f')]=_['intersection'](_0x416e8c['model'],qs[_0x1b6a('0x40')](_0x312f17[_0x1b6a('0x3e')][_0x1b6a('0x40')]));_0x298a05[_0x1b6a('0x3f')]=_0x298a05[_0x1b6a('0x3f')][_0x1b6a('0x41')]?_0x298a05[_0x1b6a('0x3f')]:_0x416e8c[_0x1b6a('0x42')];if(!_0x312f17[_0x1b6a('0x3e')][_0x1b6a('0x43')](_0x1b6a('0x44'))){_0x298a05[_0x1b6a('0x2d')]=qs[_0x1b6a('0x2d')](_0x312f17[_0x1b6a('0x3e')]['limit']);_0x298a05[_0x1b6a('0x2c')]=qs['offset'](_0x312f17[_0x1b6a('0x3e')][_0x1b6a('0x2c')]);}_0x298a05['order']=qs[_0x1b6a('0x45')](_0x312f17[_0x1b6a('0x3e')][_0x1b6a('0x45')]);_0x298a05[_0x1b6a('0x46')]=qs[_0x1b6a('0x47')](_[_0x1b6a('0x48')](_0x312f17['query'],_0x416e8c[_0x1b6a('0x47')]),_0x4845fc);if(_0x312f17['query']['filter']){_0x298a05['where']=_[_0x1b6a('0x49')](_0x298a05[_0x1b6a('0x46')],{'$or':_[_0x1b6a('0x39')](_0x4845fc,function(_0x95b65d){if(_0x95b65d[_0x1b6a('0x3c')]!==_0x1b6a('0x4a')){var _0x2afb63={};_0x2afb63[_0x95b65d[_0x1b6a('0x36')]]={'$like':'%'+_0x312f17[_0x1b6a('0x3e')][_0x1b6a('0x4b')]+'%'};return _0x2afb63;}})});}_0x298a05=_[_0x1b6a('0x49')]({},_0x298a05,_0x312f17['options']);var _0x2c7c7d={'where':_0x298a05['where']};return db[_0x1b6a('0x3a')][_0x1b6a('0x2b')](_0x2c7c7d)[_0x1b6a('0x1e')](function(_0x112e4d){_0x967f24['count']=_0x112e4d;if(_0x312f17[_0x1b6a('0x3e')]['includeAll']){_0x298a05[_0x1b6a('0x4c')]=[{'all':!![]}];}return db[_0x1b6a('0x3a')][_0x1b6a('0x4d')](_0x298a05);})['then'](function(_0x4d9e0b){_0x967f24['rows']=_0x4d9e0b;return _0x967f24;})[_0x1b6a('0x1e')](respondWithFilteredResult(_0x2ffa11,_0x298a05))['catch'](handleError(_0x2ffa11,null));};exports[_0x1b6a('0x4e')]=function(_0x4e5fd5,_0x53818){var _0x347595={'raw':!![],'where':{'id':_0x4e5fd5[_0x1b6a('0x4f')]['id']}},_0x29bcb7={};_0x29bcb7[_0x1b6a('0x42')]=_[_0x1b6a('0x50')](db[_0x1b6a('0x3a')][_0x1b6a('0x51')]);_0x29bcb7['query']=_[_0x1b6a('0x50')](_0x4e5fd5[_0x1b6a('0x3e')]);_0x29bcb7['filters']=_[_0x1b6a('0x52')](_0x29bcb7[_0x1b6a('0x42')],_0x29bcb7[_0x1b6a('0x3e')]);_0x347595[_0x1b6a('0x3f')]=_[_0x1b6a('0x52')](_0x29bcb7[_0x1b6a('0x42')],qs[_0x1b6a('0x40')](_0x4e5fd5[_0x1b6a('0x3e')][_0x1b6a('0x40')]));_0x347595[_0x1b6a('0x3f')]=_0x347595[_0x1b6a('0x3f')][_0x1b6a('0x41')]?_0x347595[_0x1b6a('0x3f')]:_0x29bcb7[_0x1b6a('0x42')];if(_0x4e5fd5[_0x1b6a('0x3e')]['includeAll']){_0x347595[_0x1b6a('0x4c')]=[{'all':!![]}];}_0x347595=_[_0x1b6a('0x49')]({},_0x347595,_0x4e5fd5[_0x1b6a('0x53')]);return db['SmsMessage'][_0x1b6a('0x54')](_0x347595)[_0x1b6a('0x1e')](handleEntityNotFound(_0x53818,null))[_0x1b6a('0x1e')](respondWithResult(_0x53818,null))[_0x1b6a('0x55')](handleError(_0x53818,null));};exports[_0x1b6a('0x56')]=function(_0x349480,_0x216c6c){return db['SmsMessage'][_0x1b6a('0x56')](_0x349480['body'],{})[_0x1b6a('0x1e')](respondWithResult(_0x216c6c,0xc9))[_0x1b6a('0x55')](handleError(_0x216c6c,null));};exports['update']=function(_0x41da37,_0x235c93){if(_0x41da37['body']['id']){delete _0x41da37[_0x1b6a('0x57')]['id'];}return db[_0x1b6a('0x3a')][_0x1b6a('0x54')]({'where':{'id':_0x41da37[_0x1b6a('0x4f')]['id']}})[_0x1b6a('0x1e')](handleEntityNotFound(_0x235c93,null))[_0x1b6a('0x1e')](saveUpdates(_0x41da37[_0x1b6a('0x57')],null))['then'](respondWithResult(_0x235c93,null))['catch'](handleError(_0x235c93,null));};exports[_0x1b6a('0x34')]=function(_0x1bdde4,_0x3da3a6){return db[_0x1b6a('0x3a')][_0x1b6a('0x54')]({'where':{'id':_0x1bdde4[_0x1b6a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3da3a6,null))[_0x1b6a('0x1e')](removeEntity(_0x3da3a6,null))[_0x1b6a('0x55')](handleError(_0x3da3a6,null));};exports[_0x1b6a('0x58')]=function(_0xe9779a,_0x5f43d9){return db[_0x1b6a('0x3a')][_0x1b6a('0x58')]()[_0x1b6a('0x1e')](respondWithResult(_0x5f43d9,null))[_0x1b6a('0x55')](handleError(_0x5f43d9,null));};var interaction_log=require(_0x1b6a('0x11'))(_0x1b6a('0x59'));exports['accept']=function(_0x38e843,_0xe2fe1c,_0x520afa){var _0x5886a8={'agent':{},'channel':_0x1b6a('0x5a')};if(_0x38e843[_0x1b6a('0x57')]['id']){delete _0x38e843[_0x1b6a('0x57')]['id'];}_0x38e843[_0x1b6a('0x57')][_0x1b6a('0x5b')]=!![];_0x38e843[_0x1b6a('0x57')][_0x1b6a('0x5c')]=moment()[_0x1b6a('0x5d')](_0x1b6a('0x5e'));_0x38e843['body'][_0x1b6a('0x5f')]=_0x38e843['body'][_0x1b6a('0x5f')]||_0x38e843[_0x1b6a('0x60')]['id'];_0x5886a8['agent']['id']=_0x38e843[_0x1b6a('0x57')][_0x1b6a('0x5f')];return db[_0x1b6a('0x3a')][_0x1b6a('0x54')]({'where':{'id':_0x38e843[_0x1b6a('0x4f')]['id'],'UserId':null},'include':[{'model':db[_0x1b6a('0x61')],'as':_0x1b6a('0x62')}]})[_0x1b6a('0x1e')](handleEntityNotFound(_0xe2fe1c,null))['then'](saveUpdates(_0x38e843['body'],null))['then'](function(_0x23c820){if(_0x23c820){_0x5886a8[_0x1b6a('0x26')]=_0x23c820[_0x1b6a('0x63')]({'plain':!![]});return db['SmsInteraction'][_0x1b6a('0x54')]({'where':{'id':_0x23c820[_0x1b6a('0x64')]}});}return null;})[_0x1b6a('0x1e')](handleEntityNotFound(_0xe2fe1c,null))[_0x1b6a('0x1e')](function(_0x5b5072){if(_0x5b5072){return _0x5b5072[_0x1b6a('0x33')]({'UserId':_0x38e843[_0x1b6a('0x57')]['UserId'],'read1stAt':_[_0x1b6a('0x65')](_0x5b5072[_0x1b6a('0x66')])?moment()['format'](_0x1b6a('0x5e')):undefined});}return null;})[_0x1b6a('0x1e')](function(_0x909e49){if(_0x909e49){_0x5886a8['interaction']=_0x909e49[_0x1b6a('0x63')]({'plain':!![]});interaction_log[_0x1b6a('0x1f')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x38e843['user']['id'],_0x38e843['user']['name'],_0x38e843[_0x1b6a('0x60')][_0x1b6a('0x67')],_0x5886a8[_0x1b6a('0x68')]['id'],_0x38e843[_0x1b6a('0x57')]?JSON['stringify'](_0x38e843[_0x1b6a('0x57')]):_0x1b6a('0x69'));return respondWithRpcPromise(_0x1b6a('0x6a'),_0x1b6a('0x6b'),_0x5886a8);}return null;})['then'](function(_0xe8ea31){if(_0xe8ea31){if(_0x38e843[_0x1b6a('0x57')][_0x1b6a('0x6c')]){_0x5886a8[_0x1b6a('0x26')]['interface']=util['format'](_0x1b6a('0x6d'),_0x38e843['user']['name']);_0x5886a8[_0x1b6a('0x26')]['channel']=_0x5886a8[_0x1b6a('0x6e')];_0x5886a8[_0x1b6a('0x26')][_0x1b6a('0x6f')]='accept';return respondWithRpcPromise(_0x1b6a('0x70'),_0x1b6a('0x70'),{'event':_0x1b6a('0x71'),'message':_0x5886a8[_0x1b6a('0x26')]},client9002)[_0x1b6a('0x1e')](function(){return _0x5886a8;});}return _0x5886a8;}return null;})[_0x1b6a('0x1e')](respondWithResult(_0xe2fe1c,null))[_0x1b6a('0x55')](handleError(_0xe2fe1c,null));};var interaction_log=require(_0x1b6a('0x11'))(_0x1b6a('0x59'));exports['reject']=function(_0x25c143,_0x574a29,_0x384962){var _0x40e46c={'agent':{},'channel':_0x1b6a('0x5a')};if(_0x25c143[_0x1b6a('0x57')]['id']){delete _0x25c143[_0x1b6a('0x57')]['id'];}_0x25c143[_0x1b6a('0x57')][_0x1b6a('0x5f')]=_0x25c143[_0x1b6a('0x57')][_0x1b6a('0x5f')]||_0x25c143[_0x1b6a('0x60')]['id'];_0x40e46c[_0x1b6a('0x72')]['id']=_0x25c143['body'][_0x1b6a('0x5f')];return db[_0x1b6a('0x3a')]['find']({'where':{'id':_0x25c143[_0x1b6a('0x4f')]['id'],'UserId':null}})[_0x1b6a('0x1e')](handleEntityNotFound(_0x574a29,null))['then'](function(_0x2d3eff){if(_0x2d3eff){_0x40e46c[_0x1b6a('0x26')]=_0x2d3eff[_0x1b6a('0x63')]({'plain':!![]});return db[_0x1b6a('0x73')][_0x1b6a('0x54')]({'where':{'id':_0x2d3eff[_0x1b6a('0x64')]}});}return null;})[_0x1b6a('0x1e')](handleEntityNotFound(_0x574a29,null))[_0x1b6a('0x1e')](function(_0x22ac63){if(_0x22ac63){_0x40e46c[_0x1b6a('0x68')]=_0x22ac63[_0x1b6a('0x63')]({'plain':!![]});interaction_log[_0x1b6a('0x1f')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x25c143[_0x1b6a('0x60')]['id'],_0x25c143[_0x1b6a('0x60')][_0x1b6a('0x36')],_0x25c143[_0x1b6a('0x60')][_0x1b6a('0x67')],_0x40e46c['interaction']['id'],_0x25c143[_0x1b6a('0x57')]?JSON[_0x1b6a('0x23')](_0x25c143[_0x1b6a('0x57')]):'null');return respondWithRpcPromise(_0x1b6a('0x74'),_0x1b6a('0x75'),_0x40e46c);}return null;})[_0x1b6a('0x1e')](function(_0x2725f7){if(_0x2725f7){_0x2725f7[_0x1b6a('0x26')][_0x1b6a('0x76')]=util[_0x1b6a('0x5d')](_0x1b6a('0x6d'),_0x25c143[_0x1b6a('0x60')][_0x1b6a('0x36')]);_0x2725f7[_0x1b6a('0x26')][_0x1b6a('0x6e')]=_0x40e46c[_0x1b6a('0x6e')];_0x2725f7[_0x1b6a('0x26')][_0x1b6a('0x6f')]=_0x1b6a('0x31');respondWithRpcPromise('EventManager',_0x1b6a('0x70'),{'event':_0x1b6a('0x77'),'message':_0x2725f7[_0x1b6a('0x26')]},client9002);return _0x40e46c;}return null;})[_0x1b6a('0x1e')](respondWithResult(_0x574a29,null))[_0x1b6a('0x55')](handleError(_0x574a29,null));};exports[_0x1b6a('0x28')]=function(_0x1b83d4,_0x241e1a,_0x1e449f){if(_0x1b83d4[_0x1b6a('0x57')]['id']){delete _0x1b83d4[_0x1b6a('0x57')]['id'];}var _0x27561a;return db[_0x1b6a('0x3a')][_0x1b6a('0x54')]({'where':{'id':_0x1b83d4['params']['id']}})[_0x1b6a('0x1e')](handleEntityNotFound(_0x241e1a,null))['then'](function(_0x37d302){if(_0x37d302){_0x27561a=_0x37d302;return db[_0x1b6a('0x78')][_0x1b6a('0x54')]({'where':{'id':_0x37d302['SmsAccountId']}});}})[_0x1b6a('0x1e')](handleEntityNotFound(_0x241e1a,null))[_0x1b6a('0x1e')](function(_0x3b8948){if(_0x3b8948){logger[_0x1b6a('0x20')](_0x1b6a('0x21'),_0x1b6a('0x28'),_0x1b6a('0x79'),_0x3b8948[_0x1b6a('0x3c')],util[_0x1b6a('0x7a')](_0x1b83d4[_0x1b6a('0x57')],{'showHidden':![],'depth':null}));switch(_0x3b8948[_0x1b6a('0x3c')]){case'twilio':if(_0x1b83d4[_0x1b6a('0x57')][_0x1b6a('0x7b')]&&_0x1b83d4[_0x1b6a('0x57')][_0x1b6a('0x7b')]===_0x27561a[_0x1b6a('0x7c')]){return _0x27561a['update']({'read':!![]});}else{logger[_0x1b6a('0x24')](_0x1b6a('0x7d'),_0x1b6a('0x28'),_0x1b6a('0x7e'),util[_0x1b6a('0x7a')](_0x1b83d4[_0x1b6a('0x57')],{'showHidden':![],'depth':null}));}break;case _0x1b6a('0x7f'):if(_0x1b83d4[_0x1b6a('0x57')][_0x1b6a('0x80')]&&_0x1b83d4['body'][_0x1b6a('0x80')]===_0x27561a[_0x1b6a('0x7c')]&&_['indexOf']([_0x1b6a('0x81'),_0x1b6a('0x82')],_0x1b83d4[_0x1b6a('0x57')]['Status'])>=0x0){return _0x27561a[_0x1b6a('0x33')]({'read':!![]});}else{logger[_0x1b6a('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1b6a('0x28'),_0x1b6a('0x83'),util[_0x1b6a('0x7a')](_0x1b83d4[_0x1b6a('0x57')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x5b4194=_0x1b83d4['body'][_0x1b6a('0x84')][0x0];if(_0x5b4194['status'][_0x1b6a('0x85')]===_0x1b6a('0x86')){return _0x27561a[_0x1b6a('0x33')]({'read':!![]});}else{logger[_0x1b6a('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','infobip',util[_0x1b6a('0x7a')](_0x1b83d4[_0x1b6a('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x27561a;}})['then'](respondWithResult(_0x241e1a,null))[_0x1b6a('0x55')](handleError(_0x241e1a,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 7cfd22c..d7d4ebe 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 _0x6f50=['setMaxListeners','save','update','hook','../../mysqldb','SmsMessage'];(function(_0x1b8ef7,_0x3e54fc){var _0x4322f8=function(_0x2058e0){while(--_0x2058e0){_0x1b8ef7['push'](_0x1b8ef7['shift']());}};_0x4322f8(++_0x3e54fc);}(_0x6f50,0x190));var _0x06f5=function(_0x14ab01,_0x34fd2a){_0x14ab01=_0x14ab01-0x0;var _0x5ee177=_0x6f50[_0x14ab01];return _0x5ee177;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x06f5('0x0'))['db'][_0x06f5('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x06f5('0x2')](0x0);var events={'afterCreate':_0x06f5('0x3'),'afterUpdate':_0x06f5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5c909d){return function(_0x2d2461,_0x31820d,_0x245854){SmsMessageEvents['emit'](_0x5c909d+':'+_0x2d2461['id'],_0x2d2461);SmsMessageEvents['emit'](_0x5c909d,_0x2d2461);_0x245854(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x06f5('0x5')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x8222=['update','remove','emit','hasOwnProperty','events','../../mysqldb','SmsMessage','setMaxListeners','save'];(function(_0x5aeaa0,_0x3f5615){var _0x7633a7=function(_0x35f2b6){while(--_0x35f2b6){_0x5aeaa0['push'](_0x5aeaa0['shift']());}};_0x7633a7(++_0x3f5615);}(_0x8222,0x13f));var _0x2822=function(_0x484c01,_0x5e12a6){_0x484c01=_0x484c01-0x0;var _0x4f6b92=_0x8222[_0x484c01];return _0x4f6b92;};'use strict';var EventEmitter=require(_0x2822('0x0'));var SmsMessage=require(_0x2822('0x1'))['db'][_0x2822('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x2822('0x3')](0x0);var events={'afterCreate':_0x2822('0x4'),'afterUpdate':_0x2822('0x5'),'afterDestroy':_0x2822('0x6')};function emitEvent(_0x13e42c){return function(_0x1ae6d8,_0x513086,_0x10e7cd){SmsMessageEvents[_0x2822('0x7')](_0x13e42c+':'+_0x1ae6d8['id'],_0x1ae6d8);SmsMessageEvents['emit'](_0x13e42c,_0x1ae6d8);_0x10e7cd(null);};}for(var e in events){if(events[_0x2822('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 ed84652..d494f25 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 _0x97b4=['SmsMessage','sms_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','SmsAccount','SmsAccountId','type','twilio','authToken','accountSid','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','password','smsMethod','sender','phone','username','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','catch','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','https://rest.clicksend.com/v3/sms/send','format','toString','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','crypto','apiKey','login','text','timestamp','keys','length','createHash','md5','hex','signature=','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth','intelepeer','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','status','refid','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./smsMessage.attributes','exports','define'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x97b4,0xf1));var _0x497b=function(_0x3b6a00,_0x5f35e0){_0x3b6a00=_0x3b6a00-0x0;var _0x3333fc=_0x97b4[_0x3b6a00];return _0x3333fc;};'use strict';var _=require(_0x497b('0x0'));var util=require(_0x497b('0x1'));var logger=require(_0x497b('0x2'))(_0x497b('0x3'));var moment=require('moment');var BPromise=require(_0x497b('0x4'));var rp=require(_0x497b('0x5'));var fs=require('fs');var path=require(_0x497b('0x6'));var rimraf=require(_0x497b('0x7'));var config=require('../../config/environment');var attributes=require(_0x497b('0x8'));module[_0x497b('0x9')]=function(_0x11e20c,_0x27ae70){return _0x11e20c[_0x497b('0xa')](_0x497b('0xb'),attributes,{'tableName':_0x497b('0xc'),'paranoid':![],'indexes':[{'name':_0x497b('0xd'),'fields':['messageId']},{'name':'fti_sms_messages','fields':[_0x497b('0xe')],'type':_0x497b('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4bde9f,_0x25eab7,_0x4180d4){var _0x15bac1=_0x11e20c[_0x497b('0x10')];var _0x1ac09e=_0x4bde9f[_0x497b('0x11')]({'plain':!![]});if(_0x1ac09e[_0x497b('0x12')][_0x497b('0x13')]()==='in'||_0x1ac09e['direction'][_0x497b('0x13')]()===_0x497b('0x14')&&!_0x1ac09e[_0x497b('0x15')]&&!_[_0x497b('0x16')](_0x1ac09e[_0x497b('0x17')])){_0x15bac1[_0x497b('0x18')][_0x497b('0x19')]({'where':{'id':_0x1ac09e[_0x497b('0x1a')]}})[_0x497b('0x1b')](function(_0xf91275){if(_0xf91275){_0xf91275[_0x497b('0x1c')]({'lastMsgAt':_0x1ac09e[_0x497b('0x1d')],'lastMsgDirection':_0x1ac09e['direction'][_0x497b('0x13')]()});}})['catch'](function(_0x50cd8a){console['error'](_0x50cd8a);});}if(_0x1ac09e[_0x497b('0x12')]===_0x497b('0x14')&&!_0x1ac09e['secret']){var _0x18b8ed;_0x15bac1[_0x497b('0x1e')]['find']({'where':{'id':_0x1ac09e[_0x497b('0x1f')]},'raw':!![]})[_0x497b('0x1b')](function(_0x1f00a5){_0x18b8ed=_0x1f00a5;if(_0x18b8ed&&_0x18b8ed[_0x497b('0x20')]){switch(_0x18b8ed[_0x497b('0x20')]){case'twilio':var _0x2e5a23=require(_0x497b('0x21'));if(_0x18b8ed['accountSid']&&_0x18b8ed[_0x497b('0x22')]&&_0x18b8ed['phone']){var _0x33b88b=new _0x2e5a23(_0x18b8ed[_0x497b('0x23')],_0x18b8ed[_0x497b('0x22')]);_0x33b88b[_0x497b('0x24')][_0x497b('0x25')]({'body':_0x1ac09e[_0x497b('0xe')],'to':_0x1ac09e['phone'],'from':_0x18b8ed['phone'],'statusCallback':_0x18b8ed[_0x497b('0x26')]+_0x497b('0x27')+_0x1ac09e['id']+_0x497b('0x28')+_0x18b8ed[_0x497b('0x29')]})['then'](function(_0x7f1ec){if(_0x7f1ec[_0x497b('0x2a')]){return _0x4bde9f['update']({'messageId':_0x7f1ec['sid']});}})['catch'](function(_0x4b2b72){logger[_0x497b('0x2b')](_0x497b('0x2c'),_0x497b('0x2d'),_0x497b('0x21'),util['inspect'](_0x4b2b72,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x497b('0x2d'),_0x497b('0x21'),_0x497b('0x2e'));}break;case _0x497b('0x2f'):var _0x248069='https://api.skebby.it/API/v1.0/REST/';if(_0x18b8ed['username']&&_0x18b8ed[_0x497b('0x30')]){var _0x2a0de3={'recipient':[_0x1ac09e['phone']],'message':_0x1ac09e[_0x497b('0xe')],'message_type':_0x18b8ed[_0x497b('0x31')]};if(_0x18b8ed[_0x497b('0x31')]&&_0x18b8ed[_0x497b('0x31')]!=='SI'){_0x2a0de3[_0x497b('0x32')]=_0x18b8ed[_0x497b('0x33')];}var _0x5575c3={'url':_0x248069+'login?username='+_0x18b8ed[_0x497b('0x34')]+_0x497b('0x35')+_0x18b8ed[_0x497b('0x30')],'method':_0x497b('0x36')};rp(_0x5575c3)[_0x497b('0x1b')](function(_0x3be93d){var _0x417b0c=_0x3be93d[_0x497b('0x37')](';');var _0x2fb82d={'user_key':_0x417b0c[0x0],'session_key':_0x417b0c[0x1]};_0x5575c3={'url':_0x248069+_0x497b('0x38'),'method':_0x497b('0x39'),'headers':{'user_key':_0x2fb82d[_0x497b('0x3a')],'Session_key':_0x2fb82d[_0x497b('0x3b')]},'json':!![],'body':_0x2a0de3};return rp(_0x5575c3);})['then'](function(_0x17e4b0){if(_0x17e4b0[_0x497b('0x3c')]>=0x1){var _0xf0b39c={'messageId':_0x17e4b0[_0x497b('0x3d')]};if(_0x18b8ed['smsMethod']!=='GP'||!_0x18b8ed[_0x497b('0x3e')]){_0xf0b39c[_0x497b('0x3f')]=!![];}return _0x4bde9f['update'](_0xf0b39c);}else{return logger['error'](_0x497b('0x2c'),_0x497b('0x2d'),_0x497b('0x2f'),util[_0x497b('0x40')](_0x17e4b0,{'showHidden':![],'depth':null}));}})[_0x497b('0x41')](function(_0x1f2958){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x497b('0x2d'),_0x497b('0x2f'),util['inspect'](_0x1f2958,{'showHidden':![],'depth':null}));});}else{logger[_0x497b('0x2b')](_0x497b('0x2c'),_0x497b('0x2d'),_0x497b('0x2f'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x497b('0x42'):if(_0x18b8ed[_0x497b('0x22')]){var _0xa7209c={'recipient':_0x1ac09e[_0x497b('0x33')],'message':_0x1ac09e['body'],'sender':_0x18b8ed[_0x497b('0x43')]||_0x18b8ed[_0x497b('0x33')],'authorization':_0x18b8ed[_0x497b('0x22')]};var _0x25eab7={'method':_0x497b('0x39'),'uri':_0x497b('0x44'),'body':_0xa7209c,'json':!![]};rp(_0x25eab7)[_0x497b('0x1b')](function(_0x3a8e32){var _0x3373be={'messageId':_0x3a8e32[_0x497b('0x45')]};if(!_0x18b8ed['deliveryReport']){_0x3373be[_0x497b('0x3f')]=!![];}return _0x4bde9f[_0x497b('0x1c')](_0x3373be);})[_0x497b('0x41')](function(_0x12510d){logger['error'](_0x497b('0x2c'),'afterCreate',_0x497b('0x42'),util[_0x497b('0x40')](_0x12510d,{'showHidden':![],'depth':null}));});}else{logger[_0x497b('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x497b('0x2d'),_0x497b('0x42'),_0x497b('0x46'));}break;case'clicksend':if(_0x18b8ed[_0x497b('0x34')]&&_0x18b8ed[_0x497b('0x30')]){var _0xa7209c={'messages':[{'source':_0x497b('0x47'),'to':_0x1ac09e[_0x497b('0x33')],'body':_0x1ac09e[_0x497b('0xe')],'from':_0x18b8ed['senderString']||_0x18b8ed['phone']}]};var _0x14296c=util['format']('%s:%s',_0x18b8ed[_0x497b('0x34')],_0x18b8ed[_0x497b('0x30')]);var _0x25eab7={'method':'POST','uri':_0x497b('0x48'),'body':_0xa7209c,'headers':{'Authorization':util[_0x497b('0x49')]('Basic\x20%s',new Buffer(_0x14296c)[_0x497b('0x4a')](_0x497b('0x4b')))},'json':!![]};rp(_0x25eab7)['then'](function(_0x2c7051){if(_0x2c7051[_0x497b('0x4c')]>=0xc8&&_0x2c7051[_0x497b('0x4c')]<=0xce){if(_0x2c7051[_0x497b('0x4d')]&&_0x2c7051['data'][_0x497b('0x4e')]>0x0){var _0x17c8b8=_[_0x497b('0x4f')](_0x2c7051[_0x497b('0x4d')]['messages']);var _0x3f1a15={'messageId':_0x17c8b8[_0x497b('0x50')]};if(!_0x18b8ed[_0x497b('0x3e')]){_0x3f1a15[_0x497b('0x3f')]=!![];}return _0x4bde9f[_0x497b('0x1c')](_0x3f1a15);}else{logger[_0x497b('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x497b('0x51'),util[_0x497b('0x40')](_0x2c7051,{'showHidden':![],'depth':null}));}}else{logger[_0x497b('0x2b')](_0x497b('0x2c'),_0x497b('0x2d'),_0x497b('0x51'),util[_0x497b('0x40')](_0x2c7051,{'showHidden':![],'depth':null}));}})['catch'](function(_0xbc69a8){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x497b('0x2d'),_0x497b('0x51'),util['inspect'](_0xbc69a8,{'showHidden':![],'depth':null}));});}else{logger[_0x497b('0x2b')](_0x497b('0x2c'),_0x497b('0x2d'),'clickSend',_0x497b('0x52'));}break;case _0x497b('0x53'):if(_0x18b8ed[_0x497b('0x54')]&&_0x18b8ed[_0x497b('0x22')]){var _0xa7209c={'dst':_0x1ac09e['phone'],'text':_0x1ac09e['body'],'src':_0x18b8ed[_0x497b('0x43')]||_0x18b8ed[_0x497b('0x33')],'url':_0x18b8ed['remote']+_0x497b('0x27')+_0x1ac09e['id']+_0x497b('0x28')+_0x18b8ed['token']};var _0x14296c=util['format'](_0x497b('0x55'),_0x18b8ed[_0x497b('0x54')],_0x18b8ed[_0x497b('0x22')]);var _0x25eab7={'method':_0x497b('0x39'),'uri':util[_0x497b('0x49')](_0x497b('0x56'),_0x18b8ed['authId']),'body':_0xa7209c,'headers':{'Authorization':util[_0x497b('0x49')](_0x497b('0x57'),new Buffer(_0x14296c)[_0x497b('0x4a')](_0x497b('0x4b')))},'json':!![]};rp(_0x25eab7)[_0x497b('0x1b')](function(_0x5c7581){var _0x43a857={'messageId':_0x5c7581[_0x497b('0x58')][0x0]};return _0x4bde9f['update'](_0x43a857);})[_0x497b('0x41')](function(_0x5c2a5f){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x497b('0x2d'),'plivo',util[_0x497b('0x40')](_0x5c2a5f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x497b('0x2c'),_0x497b('0x2d'),_0x497b('0x53'),_0x497b('0x59'));}break;case _0x497b('0x5a'):if(_0x18b8ed[_0x497b('0x34')]&&_0x18b8ed[_0x497b('0x30')]){if(_0x18b8ed[_0x497b('0x5b')]){var _0x584467={'method':_0x497b('0x39'),'uri':_0x18b8ed[_0x497b('0x5b')]+_0x497b('0x5c'),'body':{'username':_0x18b8ed[_0x497b('0x34')],'password':_0x18b8ed['password']},'json':!![]};return rp(_0x584467)[_0x497b('0x1b')](function(_0xce020d){var _0x5bdca1={'method':_0x497b('0x39'),'uri':_0x18b8ed[_0x497b('0x5b')]+_0x497b('0x5d'),'body':{'messages':[{'from':_0x18b8ed[_0x497b('0x33')],'destinations':[{'to':_0x1ac09e[_0x497b('0x33')]}],'text':_0x1ac09e[_0x497b('0xe')],'notifyUrl':_0x18b8ed['remote']+_0x497b('0x27')+_0x1ac09e['id']+'/status?token='+_0x18b8ed['token'],'notifyContentType':_0x497b('0x5e'),'callbackData':_0x18b8ed['phone']+';'+_0x1ac09e['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0xce020d[_0x497b('0x29')]},'json':!![]};return rp(_0x5bdca1)['then'](function(_0x5c8355){if(_0x5c8355[_0x497b('0x24')]){var _0x5085f3={'messageId':_0x5c8355[_0x497b('0x24')][0x0]['messageId']};if(!_0x18b8ed['deliveryReport']){_0x5085f3[_0x497b('0x3f')]=!![];}return _0x4bde9f[_0x497b('0x1c')](_0x5085f3);}else{return logger[_0x497b('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x497b('0x2d'),_0x497b('0x5a'),util[_0x497b('0x40')](_0x5c8355,{'showHidden':![],'depth':null}));}});})[_0x497b('0x41')](function(_0x442e04){return logger[_0x497b('0x2b')](_0x497b('0x2c'),_0x497b('0x2d'),'infobip',util[_0x497b('0x40')](_0x442e04,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x497b('0x2c'),_0x497b('0x2d'),_0x497b('0x5a'),_0x497b('0x5f'));}}else{logger[_0x497b('0x2b')](_0x497b('0x2c'),'afterCreate','infobip',_0x497b('0x52'));}break;case'csc':var _0x4e8d2e=require(_0x497b('0x60'));if(_0x18b8ed[_0x497b('0x61')]){var _0x4a8d09={};_0x4a8d09[_0x497b('0x62')]=_0x18b8ed[_0x497b('0x34')];_0x4a8d09[_0x497b('0x33')]=_0x1ac09e[_0x497b('0x33')];_0x4a8d09[_0x497b('0x32')]=_0x18b8ed[_0x497b('0x33')];_0x4a8d09[_0x497b('0x63')]=_0x1ac09e[_0x497b('0xe')];_0x4a8d09[_0x497b('0x64')]=+new Date();var _0x1b81a6='';var _0x1e9924='';var _0x4e2cb0=Object[_0x497b('0x65')](_0x4a8d09);_0x4e2cb0['sort']();for(var _0x6cf0fc=0x0;_0x6cf0fc<_0x4e2cb0[_0x497b('0x66')];_0x6cf0fc++){if(_0x1b81a6!=''){_0x1b81a6+='&';}_0x1b81a6+=_0x4e2cb0[_0x6cf0fc]+'='+encodeURIComponent(_0x4a8d09[_0x4e2cb0[_0x6cf0fc]]);_0x1e9924+=_0x4a8d09[_0x4e2cb0[_0x6cf0fc]];}_0x1e9924+=_0x18b8ed[_0x497b('0x61')];_0x1e9924=_0x4e8d2e[_0x497b('0x67')](_0x497b('0x68'))[_0x497b('0x1c')](_0x1e9924)['digest'](_0x497b('0x69'));if(_0x1b81a6!==''){_0x1b81a6+='&';}_0x1b81a6+=_0x497b('0x6a')+_0x1e9924;var _0x5575c3={'method':_0x497b('0x36'),'uri':_0x18b8ed[_0x497b('0x5b')]+_0x497b('0x6b')+_0x1b81a6,'json':!![]};return rp(_0x5575c3)[_0x497b('0x1b')](function(_0x1ec5c3){var _0x29a762=Object[_0x497b('0x65')](_0x1ec5c3);if(_0x1ec5c3[_0x29a762[0x0]][_0x497b('0x2b')]&&parseInt(_0x1ec5c3[_0x29a762[0x0]][_0x497b('0x2b')])===0x0){var _0x1c5c42={'messageId':_0x1ec5c3[_0x29a762[0x0]][_0x497b('0x6c')]};if(!_0x18b8ed['deliveryReport']){_0x1c5c42[_0x497b('0x3f')]=!![];}return _0x4bde9f['update'](_0x1c5c42);}else{return logger[_0x497b('0x2b')](_0x497b('0x2c'),_0x497b('0x2d'),'csc',util[_0x497b('0x40')](_0x1ec5c3[_0x497b('0x2b')],{'showHidden':![],'depth':null}));}})[_0x497b('0x41')](function(_0x257f5e){return logger['error'](_0x497b('0x2c'),_0x497b('0x2d'),'csc',util[_0x497b('0x40')](_0x257f5e,{'showHidden':![],'depth':null}));});}else{logger[_0x497b('0x2b')](_0x497b('0x2c'),'afterCreate',_0x497b('0x6d'),_0x497b('0x6e'));}break;case _0x497b('0x6f'):if(_0x18b8ed['apiKey']){var _0x1c8b0d={'method':'POST','uri':_0x497b('0x70'),'headers':{'Authorization':_0x18b8ed[_0x497b('0x61')]},'body':{'content':_0x1ac09e['body'],'to':[_0x1ac09e[_0x497b('0x33')]],'from':_0x18b8ed[_0x497b('0x33')],'binary':![],'clientMessageId':_0x497b('0x71'),'charset':_0x497b('0x72')},'json':!![]};rp(_0x1c8b0d)['then'](function(_0x3100c4){if(!_0x3100c4['error']){var _0x508296={'messageId':_0x3100c4[_0x497b('0x24')][0x0]['apiMessageId']};if(!_0x18b8ed[_0x497b('0x3e')]){_0x508296['read']=!![];}return _0x4bde9f['update'](_0x508296);}else{return logger['error'](_0x497b('0x2c'),'afterCreate',_0x497b('0x6f'),util[_0x497b('0x40')](_0x3100c4[_0x497b('0x2b')],{'showHidden':![],'depth':null}));}})[_0x497b('0x41')](function(_0x724423){return logger['error'](_0x497b('0x2c'),_0x497b('0x2d'),_0x497b('0x6f'),util['inspect'](_0x724423,{'showHidden':![],'depth':null}));});}else{logger[_0x497b('0x2b')](_0x497b('0x2c'),_0x497b('0x2d'),_0x497b('0x6f'),_0x497b('0x6e'));}break;case _0x497b('0x73'):if(_0x18b8ed[_0x497b('0x34')]&&_0x18b8ed[_0x497b('0x30')]){var _0x14296c=util[_0x497b('0x49')](_0x497b('0x55'),_0x18b8ed['username'],_0x18b8ed['password']);var _0x25eab7={'method':_0x497b('0x39'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x18b8ed['accountId']+'/messages','body':{'to':[_0x1ac09e[_0x497b('0x33')]],'text':_0x1ac09e['body'],'from':_0x18b8ed['phone'],'applicationId':_0x18b8ed['applicationId']},'headers':{'Authorization':util['format'](_0x497b('0x57'),new Buffer(_0x14296c)[_0x497b('0x4a')]('base64'))},'json':!![]};rp(_0x25eab7)['then'](function(_0x3eb7af){if(_0x3eb7af['id']){var _0x37e174={'messageId':_0x3eb7af['id']};return _0x4bde9f[_0x497b('0x1c')](_0x37e174);}else{logger[_0x497b('0x2b')](_0x497b('0x2c'),_0x497b('0x2d'),'bandwidth',util[_0x497b('0x40')](_0x3eb7af,{'showHidden':![],'depth':null}));}})[_0x497b('0x41')](function(_0x1ba962){logger[_0x497b('0x2b')](_0x497b('0x2c'),_0x497b('0x2d'),_0x497b('0x73'),util[_0x497b('0x40')](_0x1ba962,{'showHidden':![],'depth':null}));});}else{logger[_0x497b('0x2b')](_0x497b('0x2c'),'afterCreate',_0x497b('0x73'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x497b('0x74'):if(_0x18b8ed[_0x497b('0x61')]){var _0x50adc3={};var _0x5575c3={'method':_0x497b('0x39'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x18b8ed[_0x497b('0x61')],'Content-Type':_0x497b('0x5e')},'body':{'from':_0x18b8ed[_0x497b('0x33')],'to':_0x1ac09e[_0x497b('0x33')],'text':_0x1ac09e[_0x497b('0xe')]},'json':!![]};return rp(_0x5575c3)['then'](function(_0x352228){if(_0x352228[_0x497b('0x75')]==0xca){_0x50adc3[_0x497b('0x76')]=_0x352228;var _0x3d18f5={'method':'POST','uri':_0x497b('0x77'),'headers':{'Authorization':_0x497b('0x78')+_0x18b8ed['apiKey'],'Content-Type':_0x497b('0x5e')},'body':{'refid':_0x50adc3['message']['refid']},'json':!![]};return rp(_0x3d18f5)[_0x497b('0x1b')](function(_0x44e01f){_0x50adc3[_0x497b('0x79')]=_0x44e01f;var _0x33e332={'messageId':_0x50adc3[_0x497b('0x76')][_0x497b('0x7a')],'read':!![]};return _0x4bde9f[_0x497b('0x1c')](_0x33e332);});}else{return logger[_0x497b('0x2b')](_0x497b('0x2c'),_0x497b('0x2d'),_0x497b('0x74'),util[_0x497b('0x40')](_0x352228,{'showHidden':![],'depth':null}));}})[_0x497b('0x41')](function(_0x516ac6){return logger[_0x497b('0x2b')](_0x497b('0x2c'),_0x497b('0x2d'),_0x497b('0x74'),util[_0x497b('0x40')](_0x516ac6,{'showHidden':![],'depth':null}));});}else{return logger[_0x497b('0x2b')](_0x497b('0x2c'),_0x497b('0x2d'),_0x497b('0x74'),_0x497b('0x7b'));}break;}}})['finally'](function(){_0x4180d4();});}else{_0x4180d4();}}},'charset':_0x497b('0x7c'),'collate':_0x497b('0x7d')});}; \ No newline at end of file +var _0x88f5=['Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','csc','crypto','apiKey','login','sender','text','timestamp','keys','sort','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','Basic\x20%s','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','Token\x20not\x20received','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','toLowerCase','direction','out','secret','isNil','UserId','SmsInteraction','SmsInteractionId','then','catch','error','SmsAccount','find','SmsAccountId','type','accountSid','authToken','phone','messages','remote','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','&password=','password','GET','split','sms','POST','total_sent','deliveryReport','read','inspect','skebby','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','base64','http_code','data','queued_count','head','clickSend','plivo','authId','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','message_uuid'];(function(_0x2a66df,_0x4e9b7b){var _0x3186b2=function(_0x17896b){while(--_0x17896b){_0x2a66df['push'](_0x2a66df['shift']());}};_0x3186b2(++_0x4e9b7b);}(_0x88f5,0xa7));var _0x588f=function(_0x5a58c7,_0x117f80){_0x5a58c7=_0x5a58c7-0x0;var _0x7f47e2=_0x88f5[_0x5a58c7];return _0x7f47e2;};'use strict';var _=require(_0x588f('0x0'));var util=require(_0x588f('0x1'));var logger=require(_0x588f('0x2'))(_0x588f('0x3'));var moment=require(_0x588f('0x4'));var BPromise=require(_0x588f('0x5'));var rp=require(_0x588f('0x6'));var fs=require('fs');var path=require(_0x588f('0x7'));var rimraf=require(_0x588f('0x8'));var config=require(_0x588f('0x9'));var attributes=require(_0x588f('0xa'));module['exports']=function(_0x29930d,_0x21b04b){return _0x29930d[_0x588f('0xb')]('SmsMessage',attributes,{'tableName':_0x588f('0xc'),'paranoid':![],'indexes':[{'name':_0x588f('0xd'),'fields':[_0x588f('0xd')]},{'name':_0x588f('0xe'),'fields':[_0x588f('0xf')],'type':_0x588f('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4184eb,_0x5a7f39,_0x2c7c95){var _0x282287=_0x29930d[_0x588f('0x11')];var _0x25f5df=_0x4184eb['get']({'plain':!![]});if(_0x25f5df['direction'][_0x588f('0x12')]()==='in'||_0x25f5df[_0x588f('0x13')]['toLowerCase']()===_0x588f('0x14')&&!_0x25f5df[_0x588f('0x15')]&&!_[_0x588f('0x16')](_0x25f5df[_0x588f('0x17')])){_0x282287[_0x588f('0x18')]['findOne']({'where':{'id':_0x25f5df[_0x588f('0x19')]}})[_0x588f('0x1a')](function(_0x35923b){if(_0x35923b){_0x35923b['update']({'lastMsgAt':_0x25f5df['createdAt'],'lastMsgDirection':_0x25f5df[_0x588f('0x13')]['toLowerCase']()});}})[_0x588f('0x1b')](function(_0x484a75){console[_0x588f('0x1c')](_0x484a75);});}if(_0x25f5df[_0x588f('0x13')]===_0x588f('0x14')&&!_0x25f5df[_0x588f('0x15')]){var _0x34727a;_0x282287[_0x588f('0x1d')][_0x588f('0x1e')]({'where':{'id':_0x25f5df[_0x588f('0x1f')]},'raw':!![]})[_0x588f('0x1a')](function(_0x3e5515){_0x34727a=_0x3e5515;if(_0x34727a&&_0x34727a[_0x588f('0x20')]){switch(_0x34727a['type']){case'twilio':var _0x2ba1ab=require('twilio');if(_0x34727a[_0x588f('0x21')]&&_0x34727a[_0x588f('0x22')]&&_0x34727a[_0x588f('0x23')]){var _0x55ad6b=new _0x2ba1ab(_0x34727a['accountSid'],_0x34727a[_0x588f('0x22')]);_0x55ad6b[_0x588f('0x24')]['create']({'body':_0x25f5df[_0x588f('0xf')],'to':_0x25f5df[_0x588f('0x23')],'from':_0x34727a[_0x588f('0x23')],'statusCallback':_0x34727a[_0x588f('0x25')]+'/api/sms/messages/'+_0x25f5df['id']+_0x588f('0x26')+_0x34727a[_0x588f('0x27')]})[_0x588f('0x1a')](function(_0x20775c){if(_0x20775c[_0x588f('0x28')]){return _0x4184eb[_0x588f('0x29')]({'messageId':_0x20775c[_0x588f('0x28')]});}})[_0x588f('0x1b')](function(_0x823a01){logger[_0x588f('0x1c')](_0x588f('0x2a'),'afterCreate','twilio',util['inspect'](_0x823a01,{'showHidden':![],'depth':null}));});}else{logger[_0x588f('0x1c')](_0x588f('0x2a'),_0x588f('0x2b'),_0x588f('0x2c'),_0x588f('0x2d'));}break;case'skebby':var _0x36472c=_0x588f('0x2e');if(_0x34727a[_0x588f('0x2f')]&&_0x34727a['password']){var _0x2a606f={'recipient':[_0x25f5df[_0x588f('0x23')]],'message':_0x25f5df[_0x588f('0xf')],'message_type':_0x34727a['smsMethod']};if(_0x34727a[_0x588f('0x30')]&&_0x34727a[_0x588f('0x30')]!=='SI'){_0x2a606f['sender']=_0x34727a[_0x588f('0x23')];}var _0x28d876={'url':_0x36472c+'login?username='+_0x34727a[_0x588f('0x2f')]+_0x588f('0x31')+_0x34727a[_0x588f('0x32')],'method':_0x588f('0x33')};rp(_0x28d876)['then'](function(_0x4c9906){var _0x2baf96=_0x4c9906[_0x588f('0x34')](';');var _0xbbfb85={'user_key':_0x2baf96[0x0],'session_key':_0x2baf96[0x1]};_0x28d876={'url':_0x36472c+_0x588f('0x35'),'method':_0x588f('0x36'),'headers':{'user_key':_0xbbfb85['user_key'],'Session_key':_0xbbfb85['session_key']},'json':!![],'body':_0x2a606f};return rp(_0x28d876);})[_0x588f('0x1a')](function(_0x36fd6b){if(_0x36fd6b[_0x588f('0x37')]>=0x1){var _0x1d7bdb={'messageId':_0x36fd6b['internal_order_id']};if(_0x34727a['smsMethod']!=='GP'||!_0x34727a[_0x588f('0x38')]){_0x1d7bdb[_0x588f('0x39')]=!![];}return _0x4184eb[_0x588f('0x29')](_0x1d7bdb);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x588f('0x2b'),'skebby',util[_0x588f('0x3a')](_0x36fd6b,{'showHidden':![],'depth':null}));}})[_0x588f('0x1b')](function(_0x4e09c6){return logger[_0x588f('0x1c')](_0x588f('0x2a'),_0x588f('0x2b'),_0x588f('0x3b'),util['inspect'](_0x4e09c6,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x588f('0x3b'),_0x588f('0x3c'));}break;case _0x588f('0x3d'):if(_0x34727a[_0x588f('0x22')]){var _0x59b22f={'recipient':_0x25f5df[_0x588f('0x23')],'message':_0x25f5df[_0x588f('0xf')],'sender':_0x34727a['senderString']||_0x34727a[_0x588f('0x23')],'authorization':_0x34727a[_0x588f('0x22')]};var _0x5a7f39={'method':'POST','uri':_0x588f('0x3e'),'body':_0x59b22f,'json':!![]};rp(_0x5a7f39)[_0x588f('0x1a')](function(_0x32b457){var _0x2a6747={'messageId':_0x32b457[_0x588f('0x3f')]};if(!_0x34727a[_0x588f('0x38')]){_0x2a6747[_0x588f('0x39')]=!![];}return _0x4184eb[_0x588f('0x29')](_0x2a6747);})[_0x588f('0x1b')](function(_0x200571){logger[_0x588f('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x588f('0x2b'),_0x588f('0x3d'),util[_0x588f('0x3a')](_0x200571,{'showHidden':![],'depth':null}));});}else{logger[_0x588f('0x1c')](_0x588f('0x2a'),'afterCreate','connectel',_0x588f('0x40'));}break;case'clicksend':if(_0x34727a[_0x588f('0x2f')]&&_0x34727a[_0x588f('0x32')]){var _0x59b22f={'messages':[{'source':_0x588f('0x41'),'to':_0x25f5df[_0x588f('0x23')],'body':_0x25f5df[_0x588f('0xf')],'from':_0x34727a[_0x588f('0x42')]||_0x34727a['phone']}]};var _0x34c62a=util[_0x588f('0x43')](_0x588f('0x44'),_0x34727a['username'],_0x34727a['password']);var _0x5a7f39={'method':'POST','uri':_0x588f('0x45'),'body':_0x59b22f,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x34c62a)['toString'](_0x588f('0x46')))},'json':!![]};rp(_0x5a7f39)['then'](function(_0x2d021d){if(_0x2d021d[_0x588f('0x47')]>=0xc8&&_0x2d021d[_0x588f('0x47')]<=0xce){if(_0x2d021d[_0x588f('0x48')]&&_0x2d021d[_0x588f('0x48')][_0x588f('0x49')]>0x0){var _0x3d54aa=_[_0x588f('0x4a')](_0x2d021d[_0x588f('0x48')]['messages']);var _0x1dbd35={'messageId':_0x3d54aa['message_id']};if(!_0x34727a[_0x588f('0x38')]){_0x1dbd35['read']=!![];}return _0x4184eb[_0x588f('0x29')](_0x1dbd35);}else{logger[_0x588f('0x1c')](_0x588f('0x2a'),_0x588f('0x2b'),_0x588f('0x4b'),util[_0x588f('0x3a')](_0x2d021d,{'showHidden':![],'depth':null}));}}else{logger[_0x588f('0x1c')](_0x588f('0x2a'),'afterCreate',_0x588f('0x4b'),util[_0x588f('0x3a')](_0x2d021d,{'showHidden':![],'depth':null}));}})[_0x588f('0x1b')](function(_0x4dda5a){logger[_0x588f('0x1c')](_0x588f('0x2a'),_0x588f('0x2b'),_0x588f('0x4b'),util[_0x588f('0x3a')](_0x4dda5a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x588f('0x2a'),_0x588f('0x2b'),_0x588f('0x4b'),_0x588f('0x3c'));}break;case _0x588f('0x4c'):if(_0x34727a[_0x588f('0x4d')]&&_0x34727a[_0x588f('0x22')]){var _0x59b22f={'dst':_0x25f5df[_0x588f('0x23')],'text':_0x25f5df['body'],'src':_0x34727a['senderString']||_0x34727a[_0x588f('0x23')],'url':_0x34727a[_0x588f('0x25')]+_0x588f('0x4e')+_0x25f5df['id']+_0x588f('0x26')+_0x34727a[_0x588f('0x27')]};var _0x34c62a=util[_0x588f('0x43')](_0x588f('0x44'),_0x34727a['authId'],_0x34727a[_0x588f('0x22')]);var _0x5a7f39={'method':_0x588f('0x36'),'uri':util['format'](_0x588f('0x4f'),_0x34727a['authId']),'body':_0x59b22f,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x34c62a)['toString'](_0x588f('0x46')))},'json':!![]};rp(_0x5a7f39)[_0x588f('0x1a')](function(_0x3256df){var _0x3d307a={'messageId':_0x3256df[_0x588f('0x50')][0x0]};return _0x4184eb[_0x588f('0x29')](_0x3d307a);})[_0x588f('0x1b')](function(_0x531f87){logger[_0x588f('0x1c')](_0x588f('0x2a'),_0x588f('0x2b'),_0x588f('0x4c'),util['inspect'](_0x531f87,{'showHidden':![],'depth':null}));});}else{logger[_0x588f('0x1c')](_0x588f('0x2a'),_0x588f('0x2b'),_0x588f('0x4c'),_0x588f('0x51'));}break;case _0x588f('0x52'):if(_0x34727a['username']&&_0x34727a[_0x588f('0x32')]){if(_0x34727a['baseUrl']){var _0x5ae48a={'method':_0x588f('0x36'),'uri':_0x34727a[_0x588f('0x53')]+_0x588f('0x54'),'body':{'username':_0x34727a[_0x588f('0x2f')],'password':_0x34727a[_0x588f('0x32')]},'json':!![]};return rp(_0x5ae48a)['then'](function(_0x3aa004){var _0x4cdf92={'method':'POST','uri':_0x34727a['baseUrl']+_0x588f('0x55'),'body':{'messages':[{'from':_0x34727a[_0x588f('0x23')],'destinations':[{'to':_0x25f5df[_0x588f('0x23')]}],'text':_0x25f5df[_0x588f('0xf')],'notifyUrl':_0x34727a[_0x588f('0x25')]+_0x588f('0x4e')+_0x25f5df['id']+'/status?token='+_0x34727a[_0x588f('0x27')],'notifyContentType':'application/json','callbackData':_0x34727a[_0x588f('0x23')]+';'+_0x25f5df['body']}]},'headers':{'Authorization':_0x588f('0x56')+_0x3aa004[_0x588f('0x27')]},'json':!![]};return rp(_0x4cdf92)[_0x588f('0x1a')](function(_0x34d0a3){if(_0x34d0a3[_0x588f('0x24')]){var _0x50abf2={'messageId':_0x34d0a3[_0x588f('0x24')][0x0]['messageId']};if(!_0x34727a['deliveryReport']){_0x50abf2['read']=!![];}return _0x4184eb[_0x588f('0x29')](_0x50abf2);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x588f('0x2b'),_0x588f('0x52'),util['inspect'](_0x34d0a3,{'showHidden':![],'depth':null}));}});})[_0x588f('0x1b')](function(_0x5d1e74){return logger[_0x588f('0x1c')](_0x588f('0x2a'),_0x588f('0x2b'),'infobip',util[_0x588f('0x3a')](_0x5d1e74,{'showHidden':![],'depth':null}));});}else{logger[_0x588f('0x1c')](_0x588f('0x2a'),_0x588f('0x2b'),_0x588f('0x52'),'Missing\x20parameters:\x20base_url');}}else{logger['error'](_0x588f('0x2a'),_0x588f('0x2b'),_0x588f('0x52'),_0x588f('0x3c'));}break;case _0x588f('0x57'):var _0x579160=require(_0x588f('0x58'));if(_0x34727a[_0x588f('0x59')]){var _0x9dc617={};_0x9dc617[_0x588f('0x5a')]=_0x34727a[_0x588f('0x2f')];_0x9dc617['phone']=_0x25f5df[_0x588f('0x23')];_0x9dc617[_0x588f('0x5b')]=_0x34727a[_0x588f('0x23')];_0x9dc617[_0x588f('0x5c')]=_0x25f5df[_0x588f('0xf')];_0x9dc617[_0x588f('0x5d')]=+new Date();var _0x4fcf2f='';var _0x392f89='';var _0x4a24a1=Object[_0x588f('0x5e')](_0x9dc617);_0x4a24a1[_0x588f('0x5f')]();for(var _0x235d0c=0x0;_0x235d0c<_0x4a24a1['length'];_0x235d0c++){if(_0x4fcf2f!=''){_0x4fcf2f+='&';}_0x4fcf2f+=_0x4a24a1[_0x235d0c]+'='+encodeURIComponent(_0x9dc617[_0x4a24a1[_0x235d0c]]);_0x392f89+=_0x9dc617[_0x4a24a1[_0x235d0c]];}_0x392f89+=_0x34727a[_0x588f('0x59')];_0x392f89=_0x579160[_0x588f('0x60')](_0x588f('0x61'))[_0x588f('0x29')](_0x392f89)[_0x588f('0x62')](_0x588f('0x63'));if(_0x4fcf2f!==''){_0x4fcf2f+='&';}_0x4fcf2f+=_0x588f('0x64')+_0x392f89;var _0x28d876={'method':_0x588f('0x33'),'uri':_0x34727a['baseUrl']+_0x588f('0x65')+_0x4fcf2f,'json':!![]};return rp(_0x28d876)[_0x588f('0x1a')](function(_0x11004a){var _0x1a0bfc=Object[_0x588f('0x5e')](_0x11004a);if(_0x11004a[_0x1a0bfc[0x0]][_0x588f('0x1c')]&&parseInt(_0x11004a[_0x1a0bfc[0x0]]['error'])===0x0){var _0x46febd={'messageId':_0x11004a[_0x1a0bfc[0x0]][_0x588f('0x66')]};if(!_0x34727a[_0x588f('0x38')]){_0x46febd[_0x588f('0x39')]=!![];}return _0x4184eb['update'](_0x46febd);}else{return logger[_0x588f('0x1c')](_0x588f('0x2a'),_0x588f('0x2b'),_0x588f('0x57'),util[_0x588f('0x3a')](_0x11004a[_0x588f('0x1c')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x31290a){return logger[_0x588f('0x1c')](_0x588f('0x2a'),_0x588f('0x2b'),_0x588f('0x57'),util[_0x588f('0x3a')](_0x31290a,{'showHidden':![],'depth':null}));});}else{logger[_0x588f('0x1c')](_0x588f('0x2a'),'afterCreate',_0x588f('0x57'),'Missing\x20parameters:\x20apiKey');}break;case _0x588f('0x67'):if(_0x34727a[_0x588f('0x59')]){var _0xa576e3={'method':_0x588f('0x36'),'uri':_0x588f('0x68'),'headers':{'Authorization':_0x34727a[_0x588f('0x59')]},'body':{'content':_0x25f5df[_0x588f('0xf')],'to':[_0x25f5df['phone']],'from':_0x34727a['phone'],'binary':![],'clientMessageId':_0x588f('0x69'),'charset':_0x588f('0x6a')},'json':!![]};rp(_0xa576e3)[_0x588f('0x1a')](function(_0x5c8dab){if(!_0x5c8dab[_0x588f('0x1c')]){var _0x5953d9={'messageId':_0x5c8dab['messages'][0x0][_0x588f('0x6b')]};if(!_0x34727a['deliveryReport']){_0x5953d9['read']=!![];}return _0x4184eb[_0x588f('0x29')](_0x5953d9);}else{return logger[_0x588f('0x1c')](_0x588f('0x2a'),_0x588f('0x2b'),_0x588f('0x67'),util[_0x588f('0x3a')](_0x5c8dab['error'],{'showHidden':![],'depth':null}));}})[_0x588f('0x1b')](function(_0x7e6f4d){return logger[_0x588f('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x588f('0x2b'),_0x588f('0x67'),util['inspect'](_0x7e6f4d,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell',_0x588f('0x6c'));}break;case _0x588f('0x6d'):if(_0x34727a[_0x588f('0x2f')]&&_0x34727a['password']){var _0x34c62a=util[_0x588f('0x43')](_0x588f('0x44'),_0x34727a[_0x588f('0x2f')],_0x34727a[_0x588f('0x32')]);var _0x5a7f39={'method':'POST','uri':_0x588f('0x6e')+_0x34727a[_0x588f('0x6f')]+_0x588f('0x70'),'body':{'to':[_0x25f5df[_0x588f('0x23')]],'text':_0x25f5df['body'],'from':_0x34727a[_0x588f('0x23')],'applicationId':_0x34727a[_0x588f('0x71')]},'headers':{'Authorization':util[_0x588f('0x43')](_0x588f('0x72'),new Buffer(_0x34c62a)['toString'](_0x588f('0x46')))},'json':!![]};rp(_0x5a7f39)[_0x588f('0x1a')](function(_0x34ea0f){if(_0x34ea0f['id']){var _0x4cf843={'messageId':_0x34ea0f['id']};return _0x4184eb[_0x588f('0x29')](_0x4cf843);}else{logger[_0x588f('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x588f('0x2b'),'bandwidth',util[_0x588f('0x3a')](_0x34ea0f,{'showHidden':![],'depth':null}));}})[_0x588f('0x1b')](function(_0x518479){logger[_0x588f('0x1c')](_0x588f('0x2a'),_0x588f('0x2b'),_0x588f('0x6d'),util[_0x588f('0x3a')](_0x518479,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x588f('0x2a'),_0x588f('0x2b'),_0x588f('0x6d'),_0x588f('0x3c'));}break;case _0x588f('0x73'):if(_0x34727a[_0x588f('0x59')]){var _0x25bc9b={};var _0x28d876={'method':'POST','uri':_0x588f('0x74'),'headers':{'Authorization':'Bearer\x20'+_0x34727a[_0x588f('0x59')],'Content-Type':_0x588f('0x75')},'body':{'from':_0x34727a[_0x588f('0x23')],'to':_0x25f5df[_0x588f('0x23')],'text':_0x25f5df[_0x588f('0xf')]},'json':!![]};return rp(_0x28d876)[_0x588f('0x1a')](function(_0x5ee433){if(_0x5ee433[_0x588f('0x76')]==0xca){_0x25bc9b[_0x588f('0x77')]=_0x5ee433;var _0x40ff0d={'method':'POST','uri':_0x588f('0x78'),'headers':{'Authorization':_0x588f('0x79')+_0x34727a['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x25bc9b['message'][_0x588f('0x7a')]},'json':!![]};return rp(_0x40ff0d)['then'](function(_0x25a587){_0x25bc9b['status']=_0x25a587;var _0x2829cc={'messageId':_0x25bc9b['message']['refid'],'read':!![]};return _0x4184eb[_0x588f('0x29')](_0x2829cc);});}else{return logger[_0x588f('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x588f('0x73'),util[_0x588f('0x3a')](_0x5ee433,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4db58b){return logger[_0x588f('0x1c')](_0x588f('0x2a'),'afterCreate','intelepeer',util[_0x588f('0x3a')](_0x4db58b,{'showHidden':![],'depth':null}));});}else{return logger[_0x588f('0x1c')](_0x588f('0x2a'),_0x588f('0x2b'),'intelepeer',_0x588f('0x7b'));}break;}}})['finally'](function(){_0x2c7c95();});}else{_0x2c7c95();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 6b5eb95..fdb4c53 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 _0x6011=['../../config/utils','../../config/logger','client','http','redis','localhost','socket.io-emitter','./smsMessage.socket','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x463683,_0x403c60){var _0x1c7fa1=function(_0x224c11){while(--_0x224c11){_0x463683['push'](_0x463683['shift']());}};_0x1c7fa1(++_0x403c60);}(_0x6011,0x1a6));var _0x1601=function(_0x5ac26c,_0xf0a3cd){_0x5ac26c=_0x5ac26c-0x0;var _0x18e103=_0x6011[_0x5ac26c];return _0x18e103;};'use strict';var _=require(_0x1601('0x0'));var util=require(_0x1601('0x1'));var moment=require(_0x1601('0x2'));var BPromise=require(_0x1601('0x3'));var rs=require(_0x1601('0x4'));var fs=require('fs');var Redis=require(_0x1601('0x5'));var db=require(_0x1601('0x6'))['db'];var utils=require(_0x1601('0x7'));var logger=require(_0x1601('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1601('0x9')][_0x1601('0xa')]({'port':0x232a});config[_0x1601('0xb')]=_['defaults'](config['redis'],{'host':_0x1601('0xc'),'port':0x18eb});var socket=require(_0x1601('0xd'))(new Redis(config[_0x1601('0xb')]));require(_0x1601('0xe'))['register'](socket);function respondWithRpcPromise(_0x1a0e17,_0x3176be,_0x1a383d){return new BPromise(function(_0x251917,_0x48b66b){return client[_0x1601('0xf')](_0x1a0e17,_0x1a383d)['then'](function(_0x5b03d0){logger[_0x1601('0x10')](_0x1601('0x11'),_0x3176be,_0x1601('0x12'));logger[_0x1601('0x13')](_0x1601('0x14'),_0x3176be,_0x1601('0x12'),JSON['stringify'](_0x5b03d0));if(_0x5b03d0[_0x1601('0x15')]){if(_0x5b03d0[_0x1601('0x15')]['code']===0x1f4){logger['error'](_0x1601('0x11'),_0x3176be,_0x5b03d0[_0x1601('0x15')][_0x1601('0x16')]);return _0x48b66b(_0x5b03d0[_0x1601('0x15')][_0x1601('0x16')]);}logger[_0x1601('0x15')](_0x1601('0x11'),_0x3176be,_0x5b03d0[_0x1601('0x15')][_0x1601('0x16')]);return _0x251917(_0x5b03d0[_0x1601('0x15')][_0x1601('0x16')]);}else{logger['info'](_0x1601('0x11'),_0x3176be,_0x1601('0x12'));_0x251917(_0x5b03d0[_0x1601('0x17')]['message']);}})[_0x1601('0x18')](function(_0x4d2131){logger[_0x1601('0x15')](_0x1601('0x11'),_0x3176be,_0x4d2131);_0x48b66b(_0x4d2131);});});}exports[_0x1601('0x19')]=function(_0x207733){var _0x1ec82a=this;return new Promise(function(_0x7d0992,_0x1858d8){return db[_0x1601('0x1a')][_0x1601('0x1b')](_0x207733[_0x1601('0x1c')],{'raw':_0x207733[_0x1601('0x1d')]?_0x207733[_0x1601('0x1d')][_0x1601('0x1e')]===undefined?!![]:![]:!![]})[_0x1601('0x1f')](function(_0x1cd7ea){logger[_0x1601('0x10')](_0x1601('0x19'),_0x207733);logger['debug'](_0x1601('0x19'),_0x207733,JSON[_0x1601('0x20')](_0x1cd7ea));_0x7d0992(_0x1cd7ea);})[_0x1601('0x18')](function(_0x14e185){logger[_0x1601('0x15')](_0x1601('0x19'),_0x14e185['message'],_0x207733);_0x1858d8(_0x1ec82a['error'](0x1f4,_0x14e185['message']));});});}; \ No newline at end of file +var _0xbcd7=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','body','options','raw','CreateSmsMessage','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x256640,_0x2fd8a9){var _0x1a8a44=function(_0x1ae31b){while(--_0x1ae31b){_0x256640['push'](_0x256640['shift']());}};_0x1a8a44(++_0x2fd8a9);}(_0xbcd7,0x103));var _0x7bcd=function(_0x4bd472,_0x15218a){_0x4bd472=_0x4bd472-0x0;var _0xda36b=_0xbcd7[_0x4bd472];return _0xda36b;};'use strict';var _=require(_0x7bcd('0x0'));var util=require(_0x7bcd('0x1'));var moment=require(_0x7bcd('0x2'));var BPromise=require(_0x7bcd('0x3'));var rs=require(_0x7bcd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7bcd('0x5'))['db'];var utils=require(_0x7bcd('0x6'));var logger=require(_0x7bcd('0x7'))(_0x7bcd('0x8'));var config=require(_0x7bcd('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7bcd('0xa')]['http']({'port':0x232a});config[_0x7bcd('0xb')]=_[_0x7bcd('0xc')](config[_0x7bcd('0xb')],{'host':_0x7bcd('0xd'),'port':0x18eb});var socket=require(_0x7bcd('0xe'))(new Redis(config[_0x7bcd('0xb')]));require(_0x7bcd('0xf'))[_0x7bcd('0x10')](socket);function respondWithRpcPromise(_0x67d519,_0x27a283,_0x1c8550){return new BPromise(function(_0x420847,_0x2396ca){return client[_0x7bcd('0x11')](_0x67d519,_0x1c8550)[_0x7bcd('0x12')](function(_0x4c7e18){logger['info']('SmsMessage,\x20%s,\x20%s',_0x27a283,_0x7bcd('0x13'));logger[_0x7bcd('0x14')](_0x7bcd('0x15'),_0x27a283,_0x7bcd('0x13'),JSON['stringify'](_0x4c7e18));if(_0x4c7e18[_0x7bcd('0x16')]){if(_0x4c7e18[_0x7bcd('0x16')][_0x7bcd('0x17')]===0x1f4){logger[_0x7bcd('0x16')](_0x7bcd('0x18'),_0x27a283,_0x4c7e18['error'][_0x7bcd('0x19')]);return _0x2396ca(_0x4c7e18[_0x7bcd('0x16')][_0x7bcd('0x19')]);}logger[_0x7bcd('0x16')](_0x7bcd('0x18'),_0x27a283,_0x4c7e18['error'][_0x7bcd('0x19')]);return _0x420847(_0x4c7e18['error'][_0x7bcd('0x19')]);}else{logger['info'](_0x7bcd('0x18'),_0x27a283,_0x7bcd('0x13'));_0x420847(_0x4c7e18[_0x7bcd('0x1a')][_0x7bcd('0x19')]);}})[_0x7bcd('0x1b')](function(_0x204406){logger['error'](_0x7bcd('0x18'),_0x27a283,_0x204406);_0x2396ca(_0x204406);});});}exports['CreateSmsMessage']=function(_0x4d975e){var _0xbb6ddc=this;return new Promise(function(_0x1bc196,_0x7c7f36){return db['SmsMessage']['create'](_0x4d975e[_0x7bcd('0x1c')],{'raw':_0x4d975e[_0x7bcd('0x1d')]?_0x4d975e[_0x7bcd('0x1d')][_0x7bcd('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x247089){logger['info']('CreateSmsMessage',_0x4d975e);logger[_0x7bcd('0x14')](_0x7bcd('0x1f'),_0x4d975e,JSON[_0x7bcd('0x20')](_0x247089));_0x1bc196(_0x247089);})[_0x7bcd('0x1b')](function(_0x4f8563){logger[_0x7bcd('0x16')]('CreateSmsMessage',_0x4f8563[_0x7bcd('0x19')],_0x4d975e);_0x7c7f36(_0xbb6ddc['error'](0x1f4,_0x4f8563[_0x7bcd('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 9adf93b..eec3d74 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 _0x63b1=['removeListener','smsMessage:','./smsMessage.events','save','remove','update'];(function(_0xb4fe2,_0x1d98ff){var _0x214772=function(_0xce6749){while(--_0xce6749){_0xb4fe2['push'](_0xb4fe2['shift']());}};_0x214772(++_0x1d98ff);}(_0x63b1,0x6e));var _0x163b=function(_0x1ec034,_0x328b69){_0x1ec034=_0x1ec034-0x0;var _0x4f9565=_0x63b1[_0x1ec034];return _0x4f9565;};'use strict';var SmsMessageEvents=require(_0x163b('0x0'));var events=[_0x163b('0x1'),_0x163b('0x2'),_0x163b('0x3')];function createListener(_0x205d8b,_0x2e299a){return function(_0x40c639){_0x2e299a['emit'](_0x205d8b,_0x40c639);};}function removeListener(_0x2094fd,_0x2195d1){return function(){SmsMessageEvents[_0x163b('0x4')](_0x2094fd,_0x2195d1);};}exports['register']=function(_0x3a1070){for(var _0x119a94=0x0,_0x150737=events['length'];_0x119a94<_0x150737;_0x119a94++){var _0x893465=events[_0x119a94];var _0x1d57c5=createListener(_0x163b('0x5')+_0x893465,_0x3a1070);SmsMessageEvents['on'](_0x893465,_0x1d57c5);}}; \ No newline at end of file +var _0xa78b=['emit','removeListener','register','smsMessage:','./smsMessage.events','save','update'];(function(_0x3b81fe,_0x14bfbb){var _0x594f52=function(_0x13d55e){while(--_0x13d55e){_0x3b81fe['push'](_0x3b81fe['shift']());}};_0x594f52(++_0x14bfbb);}(_0xa78b,0x82));var _0xba78=function(_0x5ccce8,_0xb6ac66){_0x5ccce8=_0x5ccce8-0x0;var _0xaf68af=_0xa78b[_0x5ccce8];return _0xaf68af;};'use strict';var SmsMessageEvents=require(_0xba78('0x0'));var events=[_0xba78('0x1'),'remove',_0xba78('0x2')];function createListener(_0x54d00b,_0x4c78da){return function(_0x4b68d8){_0x4c78da[_0xba78('0x3')](_0x54d00b,_0x4b68d8);};}function removeListener(_0x515330,_0x275348){return function(){SmsMessageEvents[_0xba78('0x4')](_0x515330,_0x275348);};}exports[_0xba78('0x5')]=function(_0xc9d0b3){for(var _0x19c03d=0x0,_0x19b129=events['length'];_0x19c03d<_0x19b129;_0x19c03d++){var _0x1ca73b=events[_0x19c03d];var _0x2fe974=createListener(_0xba78('0x6')+_0x1ca73b,_0xc9d0b3);SmsMessageEvents['on'](_0x1ca73b,_0x2fe974);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 3e93edb..c4ee428 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 _0x8922=['isAuthenticated','index','/describe','show','getMembers','/:id/users','getAgents','create','post','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get'];(function(_0x549898,_0x190708){var _0x83e98e=function(_0xcb79e0){while(--_0xcb79e0){_0x549898['push'](_0x549898['shift']());}};_0x83e98e(++_0x190708);}(_0x8922,0xa2));var _0x2892=function(_0xee6cc6,_0x2f3371){_0xee6cc6=_0xee6cc6-0x0;var _0x2b1161=_0x8922[_0xee6cc6];return _0x2b1161;};'use strict';var multer=require(_0x2892('0x0'));var util=require(_0x2892('0x1'));var path=require(_0x2892('0x2'));var timeout=require(_0x2892('0x3'));var express=require(_0x2892('0x4'));var router=express[_0x2892('0x5')]();var fs_extra=require(_0x2892('0x6'));var auth=require(_0x2892('0x7'));var interaction=require(_0x2892('0x8'));var config=require(_0x2892('0x9'));var controller=require(_0x2892('0xa'));router[_0x2892('0xb')]('/',auth[_0x2892('0xc')](),controller[_0x2892('0xd')]);router[_0x2892('0xb')](_0x2892('0xe'),auth[_0x2892('0xc')](),controller['describe']);router['get']('/:id',auth[_0x2892('0xc')](),controller[_0x2892('0xf')]);router[_0x2892('0xb')]('/:id/members',auth[_0x2892('0xc')](),controller[_0x2892('0x10')]);router[_0x2892('0xb')]('/:id/teams',auth[_0x2892('0xc')](),controller['getTeams']);router[_0x2892('0xb')](_0x2892('0x11'),auth['isAuthenticated'](),controller[_0x2892('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2892('0x13')]);router[_0x2892('0x14')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router['post'](_0x2892('0x11'),auth['isAuthenticated'](),controller[_0x2892('0x15')]);router[_0x2892('0x16')](_0x2892('0x17'),auth['isAuthenticated'](),controller['update']);router[_0x2892('0x18')](_0x2892('0x17'),auth[_0x2892('0xc')](),controller[_0x2892('0x19')]);router[_0x2892('0x18')](_0x2892('0x1a'),auth['isAuthenticated'](),controller[_0x2892('0x1b')]);router['delete']('/:id/users',auth[_0x2892('0xc')](),controller[_0x2892('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x46fa=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/members','getTeams','/:id/users','post','create','/:id/teams','addTeams','addAgents','put','update','removeTeams','delete'];(function(_0x2b9074,_0x428c90){var _0x56c99a=function(_0x57aec7){while(--_0x57aec7){_0x2b9074['push'](_0x2b9074['shift']());}};_0x56c99a(++_0x428c90);}(_0x46fa,0x144));var _0xa46f=function(_0x119491,_0x3c9796){_0x119491=_0x119491-0x0;var _0x42efda=_0x46fa[_0x119491];return _0x42efda;};'use strict';var multer=require('multer');var util=require(_0xa46f('0x0'));var path=require(_0xa46f('0x1'));var timeout=require(_0xa46f('0x2'));var express=require(_0xa46f('0x3'));var router=express[_0xa46f('0x4')]();var fs_extra=require(_0xa46f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa46f('0x6'));var config=require(_0xa46f('0x7'));var controller=require(_0xa46f('0x8'));router[_0xa46f('0x9')]('/',auth['isAuthenticated'](),controller[_0xa46f('0xa')]);router[_0xa46f('0x9')](_0xa46f('0xb'),auth[_0xa46f('0xc')](),controller[_0xa46f('0xd')]);router[_0xa46f('0x9')](_0xa46f('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xa46f('0x9')](_0xa46f('0xf'),auth['isAuthenticated'](),controller['getMembers']);router[_0xa46f('0x9')]('/:id/teams',auth[_0xa46f('0xc')](),controller[_0xa46f('0x10')]);router['get'](_0xa46f('0x11'),auth[_0xa46f('0xc')](),controller['getAgents']);router[_0xa46f('0x12')]('/',auth[_0xa46f('0xc')](),controller[_0xa46f('0x13')]);router['post'](_0xa46f('0x14'),auth[_0xa46f('0xc')](),controller[_0xa46f('0x15')]);router[_0xa46f('0x12')](_0xa46f('0x11'),auth[_0xa46f('0xc')](),controller[_0xa46f('0x16')]);router[_0xa46f('0x17')]('/:id',auth[_0xa46f('0xc')](),controller[_0xa46f('0x18')]);router['delete'](_0xa46f('0xe'),auth[_0xa46f('0xc')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xa46f('0xc')](),controller[_0xa46f('0x19')]);router[_0xa46f('0x1a')](_0xa46f('0x11'),auth[_0xa46f('0xc')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index ae5048a..865b3e2 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 _0x74d0=['STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x5eb736,_0x5dcac5){var _0x183a13=function(_0x25ab83){while(--_0x25ab83){_0x5eb736['push'](_0x5eb736['shift']());}};_0x183a13(++_0x5dcac5);}(_0x74d0,0x68));var _0x074d=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x74d0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x074d('0x0'));module['exports']={'name':{'type':Sequelize[_0x074d('0x1')],'unique':_0x074d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x074d('0x1')]},'timeout':{'type':Sequelize[_0x074d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x074d('0x4')](_0x074d('0x5'),'beepall',_0x074d('0x6'))}}; \ No newline at end of file +var _0x438e=['sequelize','exports','STRING','name','rrmemory','beepall','roundrobin'];(function(_0x5bfc0f,_0x22fd21){var _0x1d511f=function(_0x8c3a8c){while(--_0x8c3a8c){_0x5bfc0f['push'](_0x5bfc0f['shift']());}};_0x1d511f(++_0x22fd21);}(_0x438e,0x12d));var _0xe438=function(_0x39bfb6,_0x4272c8){_0x39bfb6=_0x39bfb6-0x0;var _0x23fef9=_0x438e[_0x39bfb6];return _0x23fef9;};'use strict';var Sequelize=require(_0xe438('0x0'));module[_0xe438('0x1')]={'name':{'type':Sequelize[_0xe438('0x2')],'unique':_0xe438('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xe438('0x4'),_0xe438('0x5'),_0xe438('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index a6fe477..d3cd01b 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 _0xa16c=['json','count','offset','set','Content-Range','reject','save','update','destroy','then','get','UserProfileResource','name','send','index','SmsQueue','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','SmsQueues','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserSmsQueue','SmsQueueId','findAll','findAndCountAll','agent','smsPause','createdAt','rows','format','%s/%s','updatedAt','getTeams','findOne','Team','addTeams','ids','User','Agents','voicePause','interface','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','every','TeamId','includes','all','union','compact','transaction','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end'];(function(_0x224f6f,_0x2e896c){var _0x19fba3=function(_0x1710d5){while(--_0x1710d5){_0x224f6f['push'](_0x224f6f['shift']());}};_0x19fba3(++_0x2e896c);}(_0xa16c,0xfb));var _0xca16=function(_0x4a048f,_0x569574){_0x4a048f=_0x4a048f-0x0;var _0x28ccef=_0xa16c[_0x4a048f];return _0x28ccef;};'use strict';var emlformat=require(_0xca16('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca16('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xca16('0x2'));var BPromise=require(_0xca16('0x3'));var Mustache=require(_0xca16('0x4'));var util=require(_0xca16('0x5'));var path=require(_0xca16('0x6'));var sox=require(_0xca16('0x7'));var csv=require('to-csv');var ejs=require(_0xca16('0x8'));var fs=require('fs');var fs_extra=require(_0xca16('0x9'));var _=require(_0xca16('0xa'));var squel=require('squel');var crypto=require(_0xca16('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xca16('0xc'));var Papa=require(_0xca16('0xd'));var Redis=require(_0xca16('0xe'));var authService=require(_0xca16('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xca16('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xca16('0x11'))(_0xca16('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xca16('0x13'));var db=require(_0xca16('0x14'))['db'];config['redis']=_[_0xca16('0x15')](config[_0xca16('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xca16('0x17'))(new Redis(config['redis']));require(_0xca16('0x18'))[_0xca16('0x19')](socket);function respondWithStatusCode(_0x3fd5e3,_0x549c8b){_0x549c8b=_0x549c8b||0xcc;return function(_0x2bbc2d){if(_0x2bbc2d){return _0x3fd5e3[_0xca16('0x1a')](_0x549c8b);}return _0x3fd5e3[_0xca16('0x1b')](_0x549c8b)[_0xca16('0x1c')]();};}function respondWithResult(_0xf5f09c,_0x2e9c43){_0x2e9c43=_0x2e9c43||0xc8;return function(_0x535837){if(_0x535837){return _0xf5f09c[_0xca16('0x1b')](_0x2e9c43)[_0xca16('0x1d')](_0x535837);}};}function respondWithFilteredResult(_0x565ad9,_0x269081){return function(_0x231309){if(_0x231309){var _0x94b9b5=_0x231309[_0xca16('0x1e')],_0x258065=_0x269081[_0xca16('0x1f')],_0x38b0c5=_0x269081['offset']+_0x269081['limit'],_0x352986;if(_0x38b0c5>=_0x94b9b5){_0x38b0c5=_0x94b9b5;_0x352986=0xc8;}else{_0x352986=0xce;}_0x565ad9['status'](_0x352986);return _0x565ad9[_0xca16('0x20')](_0xca16('0x21'),_0x258065+'-'+_0x38b0c5+'/'+_0x94b9b5)[_0xca16('0x1d')](_0x231309);}return null;};}function patchUpdates(_0x23be19){return function(_0x17524a){try{jsonpatch['apply'](_0x17524a,_0x23be19,!![]);}catch(_0x5478e4){return BPromise[_0xca16('0x22')](_0x5478e4);}return _0x17524a[_0xca16('0x23')]();};}function saveUpdates(_0x5e10ff,_0x5d7a44){return function(_0x57441e){if(_0x57441e){return _0x57441e[_0xca16('0x24')](_0x5e10ff)['then'](function(_0x53c747){return _0x53c747;});}return null;};}function removeEntity(_0x5e5a7f,_0x1e8ea2){return function(_0x132b0f){if(_0x132b0f){return _0x132b0f[_0xca16('0x25')]()[_0xca16('0x26')](function(){var _0x547c33=_0x132b0f[_0xca16('0x27')]({'plain':!![]});var _0x5dec06='SmsQueues';return db[_0xca16('0x28')][_0xca16('0x25')]({'where':{'type':_0x5dec06,'resourceId':_0x547c33['id']}})[_0xca16('0x26')](function(){return _0x132b0f;});})['then'](function(){_0x5e5a7f['status'](0xcc)[_0xca16('0x1c')]();});}};}function handleEntityNotFound(_0x1eab6b,_0x3b1a7c){return function(_0x38d0d2){if(!_0x38d0d2){_0x1eab6b[_0xca16('0x1a')](0x194);}return _0x38d0d2;};}function handleError(_0x1d76fc,_0x9a63d5){_0x9a63d5=_0x9a63d5||0x1f4;return function(_0x85c642){logger['error'](_0x85c642['stack']);if(_0x85c642[_0xca16('0x29')]){delete _0x85c642['name'];}_0x1d76fc[_0xca16('0x1b')](_0x9a63d5)[_0xca16('0x2a')](_0x85c642);};}exports[_0xca16('0x2b')]=function(_0x5b2880,_0x18ad97){var _0x525333={},_0x1f94d2={},_0x18a2ea={'count':0x0,'rows':[]};var _0x45f38e=_['map'](db[_0xca16('0x2c')][_0xca16('0x2d')],function(_0x3d3a0b){return{'name':_0x3d3a0b[_0xca16('0x2e')],'type':_0x3d3a0b[_0xca16('0x2f')][_0xca16('0x30')]};});_0x1f94d2[_0xca16('0x31')]=_[_0xca16('0x32')](_0x45f38e,'name');_0x1f94d2[_0xca16('0x33')]=_[_0xca16('0x34')](_0x5b2880[_0xca16('0x33')]);_0x1f94d2[_0xca16('0x35')]=_[_0xca16('0x36')](_0x1f94d2[_0xca16('0x31')],_0x1f94d2[_0xca16('0x33')]);_0x525333['attributes']=_['intersection'](_0x1f94d2[_0xca16('0x31')],qs['fields'](_0x5b2880[_0xca16('0x33')][_0xca16('0x37')]));_0x525333[_0xca16('0x38')]=_0x525333[_0xca16('0x38')][_0xca16('0x39')]?_0x525333[_0xca16('0x38')]:_0x1f94d2[_0xca16('0x31')];if(!_0x5b2880[_0xca16('0x33')][_0xca16('0x3a')](_0xca16('0x3b'))){_0x525333['limit']=qs['limit'](_0x5b2880[_0xca16('0x33')][_0xca16('0x3c')]);_0x525333['offset']=qs[_0xca16('0x1f')](_0x5b2880[_0xca16('0x33')][_0xca16('0x1f')]);}_0x525333[_0xca16('0x3d')]=qs[_0xca16('0x3e')](_0x5b2880[_0xca16('0x33')][_0xca16('0x3e')]);_0x525333[_0xca16('0x3f')]=qs['filters'](_[_0xca16('0x40')](_0x5b2880[_0xca16('0x33')],_0x1f94d2[_0xca16('0x35')]),_0x45f38e);if(_0x5b2880['query'][_0xca16('0x41')]){_0x525333[_0xca16('0x3f')]=_[_0xca16('0x42')](_0x525333[_0xca16('0x3f')],{'$or':_[_0xca16('0x32')](_0x45f38e,function(_0x1e618f){if(_0x1e618f['type']!==_0xca16('0x43')){var _0x298ade={};_0x298ade[_0x1e618f[_0xca16('0x29')]]={'$like':'%'+_0x5b2880[_0xca16('0x33')][_0xca16('0x41')]+'%'};return _0x298ade;}})});}_0x525333=_[_0xca16('0x42')]({},_0x525333,_0x5b2880[_0xca16('0x44')]);var _0x473912={'where':_0x525333[_0xca16('0x3f')]};return db[_0xca16('0x2c')]['count'](_0x473912)['then'](function(_0xc4679c){_0x18a2ea[_0xca16('0x1e')]=_0xc4679c;if(_0x5b2880[_0xca16('0x33')][_0xca16('0x45')]){_0x525333[_0xca16('0x46')]=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0x525333);})[_0xca16('0x26')](function(_0x4db766){_0x18a2ea['rows']=_0x4db766;return _0x18a2ea;})[_0xca16('0x26')](respondWithFilteredResult(_0x18ad97,_0x525333))[_0xca16('0x47')](handleError(_0x18ad97,null));};exports[_0xca16('0x48')]=function(_0x1cf31f,_0x410481){var _0x4c0385={'raw':!![],'where':{'id':_0x1cf31f[_0xca16('0x49')]['id']}},_0x46af46={};_0x46af46[_0xca16('0x31')]=_[_0xca16('0x34')](db['SmsQueue'][_0xca16('0x2d')]);_0x46af46[_0xca16('0x33')]=_[_0xca16('0x34')](_0x1cf31f['query']);_0x46af46[_0xca16('0x35')]=_['intersection'](_0x46af46['model'],_0x46af46[_0xca16('0x33')]);_0x4c0385[_0xca16('0x38')]=_[_0xca16('0x36')](_0x46af46[_0xca16('0x31')],qs[_0xca16('0x37')](_0x1cf31f[_0xca16('0x33')]['fields']));_0x4c0385[_0xca16('0x38')]=_0x4c0385[_0xca16('0x38')]['length']?_0x4c0385[_0xca16('0x38')]:_0x46af46[_0xca16('0x31')];if(_0x1cf31f['query'][_0xca16('0x45')]){_0x4c0385[_0xca16('0x46')]=[{'all':!![]}];}_0x4c0385=_[_0xca16('0x42')]({},_0x4c0385,_0x1cf31f[_0xca16('0x44')]);return db[_0xca16('0x2c')][_0xca16('0x4a')](_0x4c0385)[_0xca16('0x26')](handleEntityNotFound(_0x410481,null))['then'](respondWithResult(_0x410481,null))[_0xca16('0x47')](handleError(_0x410481,null));};exports['create']=function(_0x408b8f,_0x3939db){return db[_0xca16('0x2c')][_0xca16('0x4b')](_0x408b8f[_0xca16('0x4c')],{})[_0xca16('0x26')](function(_0x5e84ab){var _0x21e400=_0x408b8f['user'][_0xca16('0x27')]({'plain':!![]});if(!_0x21e400)throw new Error(_0xca16('0x4d'));if(_0x21e400['role']===_0xca16('0x4e')){var _0x238bd3=_0x5e84ab[_0xca16('0x27')]({'plain':!![]});var _0x44e70e=_0xca16('0x4f');return db[_0xca16('0x50')][_0xca16('0x4a')]({'where':{'name':_0x44e70e,'userProfileId':_0x21e400[_0xca16('0x51')]},'raw':!![]})[_0xca16('0x26')](function(_0x4cd005){if(_0x4cd005&&_0x4cd005[_0xca16('0x52')]===0x0){return db[_0xca16('0x28')][_0xca16('0x4b')]({'name':_0x238bd3[_0xca16('0x29')],'resourceId':_0x238bd3['id'],'type':_0x4cd005[_0xca16('0x29')],'sectionId':_0x4cd005['id']},{})['then'](function(){return _0x5e84ab;});}else{return _0x5e84ab;}})[_0xca16('0x47')](function(_0x10c2fc){logger[_0xca16('0x53')](_0xca16('0x54'),_0x10c2fc);throw _0x10c2fc;});}return _0x5e84ab;})['then'](respondWithResult(_0x3939db,0xc9))[_0xca16('0x47')](handleError(_0x3939db,null));};exports[_0xca16('0x24')]=function(_0x2058b1,_0x9d9d0b){if(_0x2058b1[_0xca16('0x4c')]['id']){delete _0x2058b1[_0xca16('0x4c')]['id'];}return db[_0xca16('0x2c')]['find']({'where':{'id':_0x2058b1['params']['id']}})[_0xca16('0x26')](handleEntityNotFound(_0x9d9d0b,null))[_0xca16('0x26')](saveUpdates(_0x2058b1[_0xca16('0x4c')],null))['then'](respondWithResult(_0x9d9d0b,null))[_0xca16('0x47')](handleError(_0x9d9d0b,null));};exports['destroy']=function(_0x4722a6,_0x3ac37e){return db[_0xca16('0x2c')][_0xca16('0x4a')]({'where':{'id':_0x4722a6[_0xca16('0x49')]['id']}})['then'](handleEntityNotFound(_0x3ac37e,null))[_0xca16('0x26')](removeEntity(_0x3ac37e,null))['catch'](handleError(_0x3ac37e,null));};exports[_0xca16('0x55')]=function(_0x45a246,_0x3f0ad8){return db[_0xca16('0x2c')][_0xca16('0x55')]()['then'](respondWithResult(_0x3f0ad8,null))['catch'](handleError(_0x3f0ad8,null));};exports[_0xca16('0x56')]=function(_0x345896,_0xd46ee7,_0x1c7f0a){var _0x128559={'raw':!![],'where':{}},_0x50b828={},_0x12ddd0;return db[_0xca16('0x2c')]['findOne']({'where':{'id':_0x345896['params']['id']}})['then'](handleEntityNotFound(_0xd46ee7,null))['then'](function(_0x34a5ee){if(_0x34a5ee){_0x12ddd0=_0x34a5ee['get']({'plain':!![]});_0x50b828[_0xca16('0x31')]=_[_0xca16('0x34')](db[_0xca16('0x57')][_0xca16('0x2d')]);_0x50b828[_0xca16('0x33')]=_[_0xca16('0x34')](_0x345896[_0xca16('0x33')]);_0x50b828['filters']=_['intersection'](_0x50b828[_0xca16('0x31')],_0x50b828[_0xca16('0x33')]);_0x128559[_0xca16('0x38')]=_[_0xca16('0x36')](_0x50b828['model'],qs[_0xca16('0x37')](_0x345896[_0xca16('0x33')][_0xca16('0x37')]));_0x128559['attributes']=_0x128559[_0xca16('0x38')][_0xca16('0x39')]?_0x128559[_0xca16('0x38')]:_0x50b828[_0xca16('0x31')];if(!_0x345896[_0xca16('0x33')][_0xca16('0x3a')](_0xca16('0x3b'))){_0x128559['limit']=qs[_0xca16('0x3c')](_0x345896['query'][_0xca16('0x3c')]);_0x128559[_0xca16('0x1f')]=qs['offset'](_0x345896[_0xca16('0x33')][_0xca16('0x1f')]);}_0x128559[_0xca16('0x3d')]=qs[_0xca16('0x3e')](_0x345896[_0xca16('0x33')][_0xca16('0x3e')]);_0x128559[_0xca16('0x3f')]=qs[_0xca16('0x35')](_[_0xca16('0x40')](_0x345896['query'],_0x50b828[_0xca16('0x35')]));_0x128559[_0xca16('0x3f')][_0xca16('0x58')]=_0x34a5ee['id'];if(_0x345896[_0xca16('0x33')][_0xca16('0x41')]){_0x128559['where']=_[_0xca16('0x42')](_0x128559[_0xca16('0x3f')],{'$or':_[_0xca16('0x32')](_0x128559['attributes'],function(_0x162d31){var _0x4678bb={};_0x4678bb[_0x162d31]={'$like':'%'+_0x345896[_0xca16('0x33')]['filter']+'%'};return _0x4678bb;})});}_0x128559=_[_0xca16('0x42')]({},_0x128559,_0x345896[_0xca16('0x44')]);return db[_0xca16('0x57')][_0xca16('0x59')](_0x128559);}})[_0xca16('0x26')](function(_0x335c01){if(_0x335c01){return db['User'][_0xca16('0x5a')]({'where':{'id':_[_0xca16('0x32')](_0x335c01,'UserId'),'role':_0xca16('0x5b')},'attributes':['id',_0xca16('0x29'),_0xca16('0x5c'),'updatedAt',_0xca16('0x5d')]});}})[_0xca16('0x26')](function(_0x4c4cc6){if(_0x4c4cc6){return{'count':_0x4c4cc6[_0xca16('0x1e')],'rows':_['map'](_0x4c4cc6[_0xca16('0x5e')],function(_0x385584){return{'membername':_0x385584['name'],'UserId':_0x385584['id'],'queue_name':_0x12ddd0['name'],'SmsQueueId':_0x12ddd0['id'],'interface':util[_0xca16('0x5f')](_0xca16('0x60'),'SIP',_0x385584[_0xca16('0x29')]),'penalty':0x0,'paused':_0x385584[_0xca16('0x5c')],'createdAt':_0x385584[_0xca16('0x5d')],'updatedAt':_0x385584[_0xca16('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xca16('0x26')](respondWithFilteredResult(_0xd46ee7,_0x128559))[_0xca16('0x47')](handleError(_0xd46ee7,null));};exports[_0xca16('0x62')]=function(_0x27ac08,_0x53c0ae,_0x59c716){var _0x84a8a2={};var _0x46d973={};var _0x25c6c5;var _0x21964c;return db['SmsQueue'][_0xca16('0x63')]({'where':{'id':_0x27ac08['params']['id']}})['then'](handleEntityNotFound(_0x53c0ae,null))[_0xca16('0x26')](function(_0x1ead4a){if(_0x1ead4a){_0x25c6c5=_0x1ead4a;_0x46d973['model']=_[_0xca16('0x34')](db[_0xca16('0x64')][_0xca16('0x2d')]);_0x46d973['query']=_[_0xca16('0x34')](_0x27ac08[_0xca16('0x33')]);_0x46d973[_0xca16('0x35')]=_[_0xca16('0x36')](_0x46d973[_0xca16('0x31')],_0x46d973[_0xca16('0x33')]);_0x84a8a2[_0xca16('0x38')]=_[_0xca16('0x36')](_0x46d973[_0xca16('0x31')],qs[_0xca16('0x37')](_0x27ac08[_0xca16('0x33')]['fields']));_0x84a8a2['attributes']=_0x84a8a2[_0xca16('0x38')][_0xca16('0x39')]?_0x84a8a2['attributes']:_0x46d973[_0xca16('0x31')];_0x84a8a2[_0xca16('0x3d')]=qs[_0xca16('0x3e')](_0x27ac08['query'][_0xca16('0x3e')]);_0x84a8a2[_0xca16('0x3f')]=qs[_0xca16('0x35')](_[_0xca16('0x40')](_0x27ac08[_0xca16('0x33')],_0x46d973[_0xca16('0x35')]));if(_0x27ac08['query'][_0xca16('0x41')]){_0x84a8a2['where']=_[_0xca16('0x42')](_0x84a8a2[_0xca16('0x3f')],{'$or':_[_0xca16('0x32')](_0x84a8a2[_0xca16('0x38')],function(_0x358d6f){var _0x4862d2={};_0x4862d2[_0x358d6f]={'$like':'%'+_0x27ac08[_0xca16('0x33')][_0xca16('0x41')]+'%'};return _0x4862d2;})});}_0x84a8a2=_[_0xca16('0x42')]({},_0x84a8a2,_0x27ac08['options']);return _0x25c6c5['getTeams'](_0x84a8a2);}})['then'](function(_0x41f131){if(_0x41f131){_0x21964c=_0x41f131[_0xca16('0x39')];if(!_0x27ac08[_0xca16('0x33')]['hasOwnProperty']('nolimit')){_0x84a8a2[_0xca16('0x3c')]=qs[_0xca16('0x3c')](_0x27ac08[_0xca16('0x33')][_0xca16('0x3c')]);_0x84a8a2[_0xca16('0x1f')]=qs[_0xca16('0x1f')](_0x27ac08['query'][_0xca16('0x1f')]);}return _0x25c6c5[_0xca16('0x62')](_0x84a8a2);}})[_0xca16('0x26')](function(_0x52ab3a){if(_0x52ab3a){return _0x52ab3a?{'count':_0x21964c,'rows':_0x52ab3a}:null;}})[_0xca16('0x26')](respondWithResult(_0x53c0ae,null))[_0xca16('0x47')](handleError(_0x53c0ae,null));};exports[_0xca16('0x65')]=function(_0x16dd42,_0x584d73,_0x1a90f1){var _0x1d179b=_0x16dd42['body'][_0xca16('0x66')];return db[_0xca16('0x64')][_0xca16('0x59')]({'where':{'id':_0x1d179b},'attributes':['id'],'include':[{'model':db[_0xca16('0x67')],'as':_0xca16('0x68'),'attributes':['id',_0xca16('0x29'),'online',_0xca16('0x69'),_0xca16('0x6a')],'raw':!![]}]})['then'](function(_0x2be749){if(_0x2be749){var _0x349492=_['flatMap'](_0x2be749,function(_0x5f5b40){var _0x127b6d=_0x5f5b40['get']({'plain':!![]});return _0x127b6d['Agents'];});return db['SmsQueue'][_0xca16('0x4a')]({'where':{'id':_0x16dd42['params']['id']}})[_0xca16('0x26')](function(_0x3dfa8e){return db['sequelize']['transaction'](function(_0x579aa8){return _0x3dfa8e[_0xca16('0x65')](_0x1d179b,{'transaction':_0x579aa8})['then'](function(){return BPromise[_0xca16('0x6b')](_0x349492,function(_0x81e38b){return db[_0xca16('0x57')][_0xca16('0x6c')]({'where':{'UserId':_0x81e38b['id'],'SmsQueueId':_0x16dd42['params']['id']},'transaction':_0x579aa8});});})['then'](function(){_0x349492[_0xca16('0x6d')](function(_0x3319e5){socket['emit'](_0xca16('0x6e'),{'UserId':_0x3319e5['id'],'SmsQueueId':_0x3dfa8e['id']});});});});});}})[_0xca16('0x26')](respondWithStatusCode(_0x584d73,null))[_0xca16('0x47')](handleError(_0x584d73,null));};exports[_0xca16('0x6f')]=function(_0x5d8f6b,_0x248e94,_0x5f51b5){return db[_0xca16('0x64')]['findAll']({'where':{'id':_0x5d8f6b[_0xca16('0x33')][_0xca16('0x66')]},'attributes':['id'],'include':[{'model':db[_0xca16('0x67')],'as':_0xca16('0x68'),'attributes':['id'],'raw':!![]}]})[_0xca16('0x26')](handleEntityNotFound(_0x248e94,null))[_0xca16('0x26')](function(_0x4d5fce){var _0x20761c=_['map'](_0x4d5fce,'id');var _0x4f223b=[];var _0xdc64ca=[];var _0xab2fe0=squel[_0xca16('0x70')]();_0xab2fe0[_0xca16('0x71')]('tq.TeamId')[_0xca16('0x72')]('team_has_sms_queues','tq')['join'](_0xca16('0x73'),'ut',_0xca16('0x74'))[_0xca16('0x3f')](_0xca16('0x75'),_0x5d8f6b[_0xca16('0x49')]['id']);for(var _0x2b53e1=0x0;_0x2b53e1<_0x4d5fce['length'];_0x2b53e1+=0x1){let _0x32e2a4=_0x4d5fce[_0x2b53e1];for(var _0x4a0671=0x0;_0x4a0671<_0x32e2a4[_0xca16('0x68')]['length'];_0x4a0671+=0x1){let _0x158bcf=_0x32e2a4[_0xca16('0x68')][_0x4a0671];var _0x23ee2c=_0xab2fe0[_0xca16('0x76')]();_0x23ee2c[_0xca16('0x3f')](_0xca16('0x77'),_0x158bcf['id']);_0xdc64ca[_0xca16('0x78')](db['sequelize']['query'](_0x23ee2c[_0xca16('0x79')](),{'type':db[_0xca16('0x7a')][_0xca16('0x7b')]['SELECT']})['then'](function(_0x49155c){if(_0x49155c[_0xca16('0x39')]===0x1){return _0x158bcf['id'];}else{var _0x2b0f96=_[_0xca16('0x7c')](_[_0xca16('0x32')](_0x49155c,_0xca16('0x7d')),function(_0x38e8a9){return _[_0xca16('0x7e')](_0x20761c,_0x38e8a9);});if(_0x2b0f96){return _0x158bcf['id'];}}}));}}return BPromise[_0xca16('0x7f')](_0xdc64ca)[_0xca16('0x26')](function(_0x4a51c3){_0x4f223b=_(_0x4f223b)[_0xca16('0x80')](_0x4a51c3)[_0xca16('0x81')]()['value']();return db[_0xca16('0x2c')][_0xca16('0x4a')]({'where':{'id':_0x5d8f6b[_0xca16('0x49')]['id']}})[_0xca16('0x26')](function(_0x5727d3){return db[_0xca16('0x7a')][_0xca16('0x82')](function(_0x16d4f3){return _0x5727d3[_0xca16('0x6f')](_0x5d8f6b[_0xca16('0x33')][_0xca16('0x66')],{'transaction':_0x16d4f3})[_0xca16('0x26')](function(){if(!_[_0xca16('0x83')](_0x4f223b)){return _0x5727d3[_0xca16('0x84')](_0x4f223b,{'transaction':_0x16d4f3});}})['then'](function(){_0x4f223b[_0xca16('0x6d')](function(_0x13b6ba){socket[_0xca16('0x85')](_0xca16('0x86'),{'UserId':_0x13b6ba,'SmsQueueId':_0x5727d3['id']});});});});});});})[_0xca16('0x26')](respondWithStatusCode(_0x248e94,null))[_0xca16('0x47')](handleError(_0x248e94,null));};exports[_0xca16('0x87')]=function(_0x52f3f2,_0x384c54,_0xd53135){return db[_0xca16('0x2c')][_0xca16('0x4a')]({'where':{'id':_0x52f3f2[_0xca16('0x49')]['id']}})[_0xca16('0x26')](handleEntityNotFound(_0x384c54,null))[_0xca16('0x26')](function(_0x294a45){if(_0x294a45){return _0x294a45['addAgents'](_0x52f3f2['body'][_0xca16('0x66')],_[_0xca16('0x88')](_0x52f3f2[_0xca16('0x4c')],[_0xca16('0x66'),'id'])||{})[_0xca16('0x89')](function(_0x3dc4a8){for(var _0x270314=0x0;_0x270314<_0x52f3f2[_0xca16('0x4c')][_0xca16('0x66')][_0xca16('0x39')];_0x270314+=0x1){socket[_0xca16('0x85')](_0xca16('0x6e'),{'UserId':_0x52f3f2['body']['ids'][_0x270314],'SmsQueueId':_0x52f3f2[_0xca16('0x49')]['id']});}return _0x3dc4a8;});}})[_0xca16('0x26')](respondWithResult(_0x384c54,null))[_0xca16('0x47')](handleError(_0x384c54,null));};exports['removeAgents']=function(_0x581522,_0x1f7fcf,_0x58e647){return db[_0xca16('0x2c')][_0xca16('0x4a')]({'where':{'id':_0x581522[_0xca16('0x49')]['id']}})['then'](handleEntityNotFound(_0x1f7fcf,null))[_0xca16('0x26')](function(_0x22cbb4){if(_0x22cbb4){return _0x22cbb4[_0xca16('0x84')](_0x581522['query'][_0xca16('0x66')])[_0xca16('0x26')](function(){if(_[_0xca16('0x8a')](_0x581522[_0xca16('0x33')][_0xca16('0x66')])){for(var _0xcce276=0x0;_0xcce276<_0x581522['query'][_0xca16('0x66')]['length'];_0xcce276+=0x1){socket[_0xca16('0x85')]('userSmsQueue:remove',{'UserId':Number(_0x581522['query'][_0xca16('0x66')][_0xcce276]),'SmsQueueId':Number(_0x581522[_0xca16('0x49')]['id'])});}}else{socket[_0xca16('0x85')]('userSmsQueue:remove',{'UserId':Number(_0x581522[_0xca16('0x33')][_0xca16('0x66')]),'SmsQueueId':Number(_0x581522[_0xca16('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x1f7fcf,null))[_0xca16('0x47')](handleError(_0x1f7fcf,null));};exports[_0xca16('0x8b')]=function(_0x4907ee,_0x5cb362,_0x22ed77){var _0x40c835={};var _0x244ee6={};var _0x54f5ef;var _0x54755c;return db['SmsQueue']['findOne']({'where':{'id':_0x4907ee[_0xca16('0x49')]['id']}})[_0xca16('0x26')](handleEntityNotFound(_0x5cb362,null))[_0xca16('0x26')](function(_0xb354e3){if(_0xb354e3){_0x54f5ef=_0xb354e3;_0x244ee6[_0xca16('0x31')]=_[_0xca16('0x34')](db['User'][_0xca16('0x2d')]);_0x244ee6[_0xca16('0x33')]=_[_0xca16('0x34')](_0x4907ee['query']);_0x244ee6[_0xca16('0x35')]=_[_0xca16('0x36')](_0x244ee6[_0xca16('0x31')],_0x244ee6['query']);_0x40c835[_0xca16('0x38')]=_[_0xca16('0x36')](_0x244ee6['model'],qs[_0xca16('0x37')](_0x4907ee[_0xca16('0x33')]['fields']));_0x40c835[_0xca16('0x38')]=_0x40c835[_0xca16('0x38')]['length']?_0x40c835[_0xca16('0x38')]:_0x244ee6[_0xca16('0x31')];_0x40c835[_0xca16('0x3d')]=qs[_0xca16('0x3e')](_0x4907ee[_0xca16('0x33')][_0xca16('0x3e')]);_0x40c835[_0xca16('0x3f')]=qs[_0xca16('0x35')](_[_0xca16('0x40')](_0x4907ee[_0xca16('0x33')],_0x244ee6[_0xca16('0x35')]));if(_0x4907ee['query'][_0xca16('0x41')]){_0x40c835['where']=_[_0xca16('0x42')](_0x40c835[_0xca16('0x3f')],{'$or':_[_0xca16('0x32')](_0x40c835[_0xca16('0x38')],function(_0x5f358b){var _0x3a3eda={};_0x3a3eda[_0x5f358b]={'$like':'%'+_0x4907ee[_0xca16('0x33')][_0xca16('0x41')]+'%'};return _0x3a3eda;})});}_0x40c835=_['merge']({},_0x40c835,_0x4907ee[_0xca16('0x44')]);return _0x54f5ef[_0xca16('0x8b')](_0x40c835);}})[_0xca16('0x26')](function(_0x3d0bcb){if(_0x3d0bcb){_0x54755c=_0x3d0bcb[_0xca16('0x39')];if(!_0x4907ee[_0xca16('0x33')][_0xca16('0x3a')](_0xca16('0x3b'))){_0x40c835[_0xca16('0x3c')]=qs[_0xca16('0x3c')](_0x4907ee[_0xca16('0x33')][_0xca16('0x3c')]);_0x40c835[_0xca16('0x1f')]=qs[_0xca16('0x1f')](_0x4907ee['query']['offset']);}return _0x54f5ef[_0xca16('0x8b')](_0x40c835);}})['then'](function(_0xfbd518){if(_0xfbd518){return _0xfbd518?{'count':_0x54755c,'rows':_0xfbd518}:null;}})[_0xca16('0x26')](respondWithResult(_0x5cb362,null))[_0xca16('0x47')](handleError(_0x5cb362,null));}; \ No newline at end of file +var _0xc34d=['jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./smsQueue.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','get','UserProfileResource','stack','name','send','index','map','SmsQueue','rawAttributes','type','model','query','filters','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','keys','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','UserProfileSection','userProfileId','autoAssociation','error','update','destroy','describe','getMembers','findOne','UserSmsQueue','length','SmsQueueId','findAndCountAll','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','User','Agents','online','voicePause','flatMap','sequelize','transaction','findOrCreate','forEach','emit','ids','select','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','omit','spread','userSmsQueue:save','isArray','userSmsQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','squel','crypto'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc34d,0x194));var _0xdc34=function(_0x31cd96,_0x2caa0a){_0x31cd96=_0x31cd96-0x0;var _0x5165a1=_0xc34d[_0x31cd96];return _0x5165a1;};'use strict';var emlformat=require(_0xdc34('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdc34('0x1'));var jsonpatch=require(_0xdc34('0x2'));var rp=require(_0xdc34('0x3'));var moment=require(_0xdc34('0x4'));var BPromise=require(_0xdc34('0x5'));var Mustache=require('mustache');var util=require(_0xdc34('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xdc34('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdc34('0x8'));var crypto=require(_0xdc34('0x9'));var jsforce=require(_0xdc34('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdc34('0xb'));var Papa=require(_0xdc34('0xc'));var Redis=require('ioredis');var authService=require(_0xdc34('0xd'));var qs=require(_0xdc34('0xe'));var as=require(_0xdc34('0xf'));var hardwareService=require(_0xdc34('0x10'));var logger=require(_0xdc34('0x11'))(_0xdc34('0x12'));var utils=require(_0xdc34('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xdc34('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xdc34('0x15')](config['redis'],{'host':_0xdc34('0x16'),'port':0x18eb});var socket=require(_0xdc34('0x17'))(new Redis(config[_0xdc34('0x18')]));require(_0xdc34('0x19'))[_0xdc34('0x1a')](socket);function respondWithStatusCode(_0x26ddc1,_0x387928){_0x387928=_0x387928||0xcc;return function(_0x49cdb8){if(_0x49cdb8){return _0x26ddc1[_0xdc34('0x1b')](_0x387928);}return _0x26ddc1[_0xdc34('0x1c')](_0x387928)[_0xdc34('0x1d')]();};}function respondWithResult(_0x5c31f8,_0x56cf3c){_0x56cf3c=_0x56cf3c||0xc8;return function(_0x39f29f){if(_0x39f29f){return _0x5c31f8['status'](_0x56cf3c)[_0xdc34('0x1e')](_0x39f29f);}};}function respondWithFilteredResult(_0x5dbffc,_0x3aa659){return function(_0x29ccf5){if(_0x29ccf5){var _0x28b7b1=_0x29ccf5[_0xdc34('0x1f')],_0x2c2b5a=_0x3aa659[_0xdc34('0x20')],_0x2fb5ff=_0x3aa659[_0xdc34('0x20')]+_0x3aa659['limit'],_0x2a4e15;if(_0x2fb5ff>=_0x28b7b1){_0x2fb5ff=_0x28b7b1;_0x2a4e15=0xc8;}else{_0x2a4e15=0xce;}_0x5dbffc[_0xdc34('0x1c')](_0x2a4e15);return _0x5dbffc[_0xdc34('0x21')](_0xdc34('0x22'),_0x2c2b5a+'-'+_0x2fb5ff+'/'+_0x28b7b1)[_0xdc34('0x1e')](_0x29ccf5);}return null;};}function patchUpdates(_0x3309dd){return function(_0x58d622){try{jsonpatch[_0xdc34('0x23')](_0x58d622,_0x3309dd,!![]);}catch(_0x199ad7){return BPromise[_0xdc34('0x24')](_0x199ad7);}return _0x58d622[_0xdc34('0x25')]();};}function saveUpdates(_0x2fa20e,_0x113573){return function(_0x30536d){if(_0x30536d){return _0x30536d['update'](_0x2fa20e)[_0xdc34('0x26')](function(_0x40224d){return _0x40224d;});}return null;};}function removeEntity(_0x252a26,_0x1f3bff){return function(_0x541514){if(_0x541514){return _0x541514['destroy']()['then'](function(){var _0x383622=_0x541514[_0xdc34('0x27')]({'plain':!![]});var _0x5e75f3='SmsQueues';return db[_0xdc34('0x28')]['destroy']({'where':{'type':_0x5e75f3,'resourceId':_0x383622['id']}})['then'](function(){return _0x541514;});})[_0xdc34('0x26')](function(){_0x252a26[_0xdc34('0x1c')](0xcc)[_0xdc34('0x1d')]();});}};}function handleEntityNotFound(_0x117f14,_0x2ecebb){return function(_0x4a86c4){if(!_0x4a86c4){_0x117f14[_0xdc34('0x1b')](0x194);}return _0x4a86c4;};}function handleError(_0x532ae0,_0xeab08){_0xeab08=_0xeab08||0x1f4;return function(_0x4a5e7b){logger['error'](_0x4a5e7b[_0xdc34('0x29')]);if(_0x4a5e7b[_0xdc34('0x2a')]){delete _0x4a5e7b[_0xdc34('0x2a')];}_0x532ae0[_0xdc34('0x1c')](_0xeab08)[_0xdc34('0x2b')](_0x4a5e7b);};}exports[_0xdc34('0x2c')]=function(_0x5cc43c,_0x3f6e65){var _0x273549={},_0x40a55b={},_0x47de56={'count':0x0,'rows':[]};var _0x4ad51f=_[_0xdc34('0x2d')](db[_0xdc34('0x2e')][_0xdc34('0x2f')],function(_0x4f030b){return{'name':_0x4f030b['fieldName'],'type':_0x4f030b[_0xdc34('0x30')]['key']};});_0x40a55b[_0xdc34('0x31')]=_[_0xdc34('0x2d')](_0x4ad51f,'name');_0x40a55b['query']=_['keys'](_0x5cc43c[_0xdc34('0x32')]);_0x40a55b[_0xdc34('0x33')]=_['intersection'](_0x40a55b[_0xdc34('0x31')],_0x40a55b[_0xdc34('0x32')]);_0x273549[_0xdc34('0x34')]=_['intersection'](_0x40a55b[_0xdc34('0x31')],qs[_0xdc34('0x35')](_0x5cc43c['query']['fields']));_0x273549['attributes']=_0x273549[_0xdc34('0x34')]['length']?_0x273549[_0xdc34('0x34')]:_0x40a55b[_0xdc34('0x31')];if(!_0x5cc43c[_0xdc34('0x32')][_0xdc34('0x36')](_0xdc34('0x37'))){_0x273549[_0xdc34('0x38')]=qs[_0xdc34('0x38')](_0x5cc43c[_0xdc34('0x32')]['limit']);_0x273549[_0xdc34('0x20')]=qs['offset'](_0x5cc43c[_0xdc34('0x32')][_0xdc34('0x20')]);}_0x273549[_0xdc34('0x39')]=qs[_0xdc34('0x3a')](_0x5cc43c[_0xdc34('0x32')][_0xdc34('0x3a')]);_0x273549[_0xdc34('0x3b')]=qs[_0xdc34('0x33')](_[_0xdc34('0x3c')](_0x5cc43c[_0xdc34('0x32')],_0x40a55b[_0xdc34('0x33')]),_0x4ad51f);if(_0x5cc43c['query'][_0xdc34('0x3d')]){_0x273549[_0xdc34('0x3b')]=_['merge'](_0x273549['where'],{'$or':_[_0xdc34('0x2d')](_0x4ad51f,function(_0x321d3d){if(_0x321d3d[_0xdc34('0x30')]!==_0xdc34('0x3e')){var _0xa44942={};_0xa44942[_0x321d3d[_0xdc34('0x2a')]]={'$like':'%'+_0x5cc43c[_0xdc34('0x32')][_0xdc34('0x3d')]+'%'};return _0xa44942;}})});}_0x273549=_[_0xdc34('0x3f')]({},_0x273549,_0x5cc43c[_0xdc34('0x40')]);var _0x409cca={'where':_0x273549[_0xdc34('0x3b')]};return db[_0xdc34('0x2e')][_0xdc34('0x1f')](_0x409cca)[_0xdc34('0x26')](function(_0x53c0fc){_0x47de56['count']=_0x53c0fc;if(_0x5cc43c[_0xdc34('0x32')][_0xdc34('0x41')]){_0x273549['include']=[{'all':!![]}];}return db[_0xdc34('0x2e')][_0xdc34('0x42')](_0x273549);})[_0xdc34('0x26')](function(_0x3f8c19){_0x47de56[_0xdc34('0x43')]=_0x3f8c19;return _0x47de56;})[_0xdc34('0x26')](respondWithFilteredResult(_0x3f6e65,_0x273549))[_0xdc34('0x44')](handleError(_0x3f6e65,null));};exports[_0xdc34('0x45')]=function(_0x4d9f66,_0x50d524){var _0x4044e1={'raw':!![],'where':{'id':_0x4d9f66[_0xdc34('0x46')]['id']}},_0x3e8172={};_0x3e8172['model']=_[_0xdc34('0x47')](db[_0xdc34('0x2e')][_0xdc34('0x2f')]);_0x3e8172['query']=_['keys'](_0x4d9f66[_0xdc34('0x32')]);_0x3e8172[_0xdc34('0x33')]=_['intersection'](_0x3e8172[_0xdc34('0x31')],_0x3e8172[_0xdc34('0x32')]);_0x4044e1[_0xdc34('0x34')]=_[_0xdc34('0x48')](_0x3e8172[_0xdc34('0x31')],qs[_0xdc34('0x35')](_0x4d9f66[_0xdc34('0x32')][_0xdc34('0x35')]));_0x4044e1[_0xdc34('0x34')]=_0x4044e1[_0xdc34('0x34')]['length']?_0x4044e1['attributes']:_0x3e8172['model'];if(_0x4d9f66[_0xdc34('0x32')][_0xdc34('0x41')]){_0x4044e1['include']=[{'all':!![]}];}_0x4044e1=_[_0xdc34('0x3f')]({},_0x4044e1,_0x4d9f66[_0xdc34('0x40')]);return db[_0xdc34('0x2e')][_0xdc34('0x49')](_0x4044e1)[_0xdc34('0x26')](handleEntityNotFound(_0x50d524,null))[_0xdc34('0x26')](respondWithResult(_0x50d524,null))[_0xdc34('0x44')](handleError(_0x50d524,null));};exports[_0xdc34('0x4a')]=function(_0x5ec5d5,_0x7a8e6f){return db[_0xdc34('0x2e')][_0xdc34('0x4a')](_0x5ec5d5[_0xdc34('0x4b')],{})[_0xdc34('0x26')](function(_0x50b7db){var _0x2d374c=_0x5ec5d5[_0xdc34('0x4c')][_0xdc34('0x27')]({'plain':!![]});if(!_0x2d374c)throw new Error(_0xdc34('0x4d'));if(_0x2d374c[_0xdc34('0x4e')]===_0xdc34('0x4c')){var _0x10fcce=_0x50b7db[_0xdc34('0x27')]({'plain':!![]});var _0x254d4b=_0xdc34('0x4f');return db[_0xdc34('0x50')][_0xdc34('0x49')]({'where':{'name':_0x254d4b,'userProfileId':_0x2d374c[_0xdc34('0x51')]},'raw':!![]})[_0xdc34('0x26')](function(_0xf5ff7b){if(_0xf5ff7b&&_0xf5ff7b[_0xdc34('0x52')]===0x0){return db[_0xdc34('0x28')][_0xdc34('0x4a')]({'name':_0x10fcce[_0xdc34('0x2a')],'resourceId':_0x10fcce['id'],'type':_0xf5ff7b['name'],'sectionId':_0xf5ff7b['id']},{})[_0xdc34('0x26')](function(){return _0x50b7db;});}else{return _0x50b7db;}})[_0xdc34('0x44')](function(_0x30afde){logger[_0xdc34('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30afde);throw _0x30afde;});}return _0x50b7db;})['then'](respondWithResult(_0x7a8e6f,0xc9))[_0xdc34('0x44')](handleError(_0x7a8e6f,null));};exports[_0xdc34('0x54')]=function(_0x19562a,_0x279b6b){if(_0x19562a['body']['id']){delete _0x19562a['body']['id'];}return db[_0xdc34('0x2e')][_0xdc34('0x49')]({'where':{'id':_0x19562a[_0xdc34('0x46')]['id']}})['then'](handleEntityNotFound(_0x279b6b,null))[_0xdc34('0x26')](saveUpdates(_0x19562a[_0xdc34('0x4b')],null))[_0xdc34('0x26')](respondWithResult(_0x279b6b,null))['catch'](handleError(_0x279b6b,null));};exports[_0xdc34('0x55')]=function(_0x1c2884,_0xeea3e8){return db[_0xdc34('0x2e')][_0xdc34('0x49')]({'where':{'id':_0x1c2884[_0xdc34('0x46')]['id']}})[_0xdc34('0x26')](handleEntityNotFound(_0xeea3e8,null))['then'](removeEntity(_0xeea3e8,null))[_0xdc34('0x44')](handleError(_0xeea3e8,null));};exports[_0xdc34('0x56')]=function(_0x279fc5,_0x2d5e2a){return db[_0xdc34('0x2e')][_0xdc34('0x56')]()[_0xdc34('0x26')](respondWithResult(_0x2d5e2a,null))[_0xdc34('0x44')](handleError(_0x2d5e2a,null));};exports[_0xdc34('0x57')]=function(_0x46768c,_0x189b3b,_0x186ef5){var _0x354f64={'raw':!![],'where':{}},_0x154fe5={},_0x5ad94c;return db[_0xdc34('0x2e')][_0xdc34('0x58')]({'where':{'id':_0x46768c[_0xdc34('0x46')]['id']}})['then'](handleEntityNotFound(_0x189b3b,null))[_0xdc34('0x26')](function(_0x31540e){if(_0x31540e){_0x5ad94c=_0x31540e[_0xdc34('0x27')]({'plain':!![]});_0x154fe5[_0xdc34('0x31')]=_[_0xdc34('0x47')](db[_0xdc34('0x59')][_0xdc34('0x2f')]);_0x154fe5[_0xdc34('0x32')]=_[_0xdc34('0x47')](_0x46768c[_0xdc34('0x32')]);_0x154fe5['filters']=_[_0xdc34('0x48')](_0x154fe5[_0xdc34('0x31')],_0x154fe5[_0xdc34('0x32')]);_0x354f64[_0xdc34('0x34')]=_[_0xdc34('0x48')](_0x154fe5[_0xdc34('0x31')],qs[_0xdc34('0x35')](_0x46768c[_0xdc34('0x32')][_0xdc34('0x35')]));_0x354f64[_0xdc34('0x34')]=_0x354f64[_0xdc34('0x34')][_0xdc34('0x5a')]?_0x354f64[_0xdc34('0x34')]:_0x154fe5[_0xdc34('0x31')];if(!_0x46768c[_0xdc34('0x32')][_0xdc34('0x36')]('nolimit')){_0x354f64[_0xdc34('0x38')]=qs[_0xdc34('0x38')](_0x46768c[_0xdc34('0x32')][_0xdc34('0x38')]);_0x354f64[_0xdc34('0x20')]=qs[_0xdc34('0x20')](_0x46768c[_0xdc34('0x32')][_0xdc34('0x20')]);}_0x354f64[_0xdc34('0x39')]=qs[_0xdc34('0x3a')](_0x46768c[_0xdc34('0x32')][_0xdc34('0x3a')]);_0x354f64['where']=qs['filters'](_[_0xdc34('0x3c')](_0x46768c[_0xdc34('0x32')],_0x154fe5['filters']));_0x354f64[_0xdc34('0x3b')][_0xdc34('0x5b')]=_0x31540e['id'];if(_0x46768c['query'][_0xdc34('0x3d')]){_0x354f64[_0xdc34('0x3b')]=_[_0xdc34('0x3f')](_0x354f64['where'],{'$or':_['map'](_0x354f64[_0xdc34('0x34')],function(_0x63124b){var _0x157b23={};_0x157b23[_0x63124b]={'$like':'%'+_0x46768c[_0xdc34('0x32')]['filter']+'%'};return _0x157b23;})});}_0x354f64=_[_0xdc34('0x3f')]({},_0x354f64,_0x46768c[_0xdc34('0x40')]);return db[_0xdc34('0x59')][_0xdc34('0x42')](_0x354f64);}})[_0xdc34('0x26')](function(_0x5181d5){if(_0x5181d5){return db['User'][_0xdc34('0x5c')]({'where':{'id':_[_0xdc34('0x2d')](_0x5181d5,'UserId'),'role':'agent'},'attributes':['id','name','smsPause',_0xdc34('0x5d'),_0xdc34('0x5e')]});}})['then'](function(_0x5209c3){if(_0x5209c3){return{'count':_0x5209c3[_0xdc34('0x1f')],'rows':_[_0xdc34('0x2d')](_0x5209c3[_0xdc34('0x43')],function(_0x196d20){return{'membername':_0x196d20['name'],'UserId':_0x196d20['id'],'queue_name':_0x5ad94c[_0xdc34('0x2a')],'SmsQueueId':_0x5ad94c['id'],'interface':util[_0xdc34('0x5f')](_0xdc34('0x60'),_0xdc34('0x61'),_0x196d20[_0xdc34('0x2a')]),'penalty':0x0,'paused':_0x196d20['smsPause'],'createdAt':_0x196d20[_0xdc34('0x5e')],'updatedAt':_0x196d20['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xdc34('0x26')](respondWithFilteredResult(_0x189b3b,_0x354f64))[_0xdc34('0x44')](handleError(_0x189b3b,null));};exports[_0xdc34('0x62')]=function(_0x3451fc,_0x4ca7ad,_0x407c13){var _0x27bc90={};var _0x541528={};var _0x1ff8a8;var _0x542e9d;return db[_0xdc34('0x2e')][_0xdc34('0x58')]({'where':{'id':_0x3451fc[_0xdc34('0x46')]['id']}})[_0xdc34('0x26')](handleEntityNotFound(_0x4ca7ad,null))[_0xdc34('0x26')](function(_0x39bfcc){if(_0x39bfcc){_0x1ff8a8=_0x39bfcc;_0x541528[_0xdc34('0x31')]=_[_0xdc34('0x47')](db[_0xdc34('0x63')][_0xdc34('0x2f')]);_0x541528[_0xdc34('0x32')]=_[_0xdc34('0x47')](_0x3451fc['query']);_0x541528['filters']=_[_0xdc34('0x48')](_0x541528['model'],_0x541528[_0xdc34('0x32')]);_0x27bc90[_0xdc34('0x34')]=_[_0xdc34('0x48')](_0x541528[_0xdc34('0x31')],qs['fields'](_0x3451fc[_0xdc34('0x32')][_0xdc34('0x35')]));_0x27bc90[_0xdc34('0x34')]=_0x27bc90['attributes'][_0xdc34('0x5a')]?_0x27bc90[_0xdc34('0x34')]:_0x541528[_0xdc34('0x31')];_0x27bc90[_0xdc34('0x39')]=qs[_0xdc34('0x3a')](_0x3451fc[_0xdc34('0x32')]['sort']);_0x27bc90['where']=qs['filters'](_[_0xdc34('0x3c')](_0x3451fc[_0xdc34('0x32')],_0x541528[_0xdc34('0x33')]));if(_0x3451fc[_0xdc34('0x32')][_0xdc34('0x3d')]){_0x27bc90[_0xdc34('0x3b')]=_[_0xdc34('0x3f')](_0x27bc90[_0xdc34('0x3b')],{'$or':_[_0xdc34('0x2d')](_0x27bc90[_0xdc34('0x34')],function(_0xc47e1c){var _0x158954={};_0x158954[_0xc47e1c]={'$like':'%'+_0x3451fc[_0xdc34('0x32')]['filter']+'%'};return _0x158954;})});}_0x27bc90=_[_0xdc34('0x3f')]({},_0x27bc90,_0x3451fc[_0xdc34('0x40')]);return _0x1ff8a8[_0xdc34('0x62')](_0x27bc90);}})[_0xdc34('0x26')](function(_0x11b74d){if(_0x11b74d){_0x542e9d=_0x11b74d['length'];if(!_0x3451fc[_0xdc34('0x32')][_0xdc34('0x36')](_0xdc34('0x37'))){_0x27bc90['limit']=qs[_0xdc34('0x38')](_0x3451fc[_0xdc34('0x32')][_0xdc34('0x38')]);_0x27bc90['offset']=qs[_0xdc34('0x20')](_0x3451fc['query'][_0xdc34('0x20')]);}return _0x1ff8a8[_0xdc34('0x62')](_0x27bc90);}})[_0xdc34('0x26')](function(_0x2faf84){if(_0x2faf84){return _0x2faf84?{'count':_0x542e9d,'rows':_0x2faf84}:null;}})[_0xdc34('0x26')](respondWithResult(_0x4ca7ad,null))[_0xdc34('0x44')](handleError(_0x4ca7ad,null));};exports[_0xdc34('0x64')]=function(_0x124bfb,_0x454f,_0x4fc375){var _0x4f74b5=_0x124bfb[_0xdc34('0x4b')]['ids'];return db[_0xdc34('0x63')][_0xdc34('0x42')]({'where':{'id':_0x4f74b5},'attributes':['id'],'include':[{'model':db[_0xdc34('0x65')],'as':_0xdc34('0x66'),'attributes':['id',_0xdc34('0x2a'),_0xdc34('0x67'),_0xdc34('0x68'),'interface'],'raw':!![]}]})[_0xdc34('0x26')](function(_0x442a62){if(_0x442a62){var _0x2ceb95=_[_0xdc34('0x69')](_0x442a62,function(_0x4d8643){var _0x5c00cd=_0x4d8643['get']({'plain':!![]});return _0x5c00cd['Agents'];});return db[_0xdc34('0x2e')][_0xdc34('0x49')]({'where':{'id':_0x124bfb[_0xdc34('0x46')]['id']}})['then'](function(_0x3c8d0e){return db[_0xdc34('0x6a')][_0xdc34('0x6b')](function(_0x4999c6){return _0x3c8d0e['addTeams'](_0x4f74b5,{'transaction':_0x4999c6})[_0xdc34('0x26')](function(){return BPromise['each'](_0x2ceb95,function(_0x111f0a){return db[_0xdc34('0x59')][_0xdc34('0x6c')]({'where':{'UserId':_0x111f0a['id'],'SmsQueueId':_0x124bfb['params']['id']},'transaction':_0x4999c6});});})[_0xdc34('0x26')](function(){_0x2ceb95[_0xdc34('0x6d')](function(_0x229bb4){socket[_0xdc34('0x6e')]('userSmsQueue:save',{'UserId':_0x229bb4['id'],'SmsQueueId':_0x3c8d0e['id']});});});});});}})[_0xdc34('0x26')](respondWithStatusCode(_0x454f,null))['catch'](handleError(_0x454f,null));};exports['removeTeams']=function(_0x1f01a2,_0x3c1531,_0x18e98e){return db[_0xdc34('0x63')][_0xdc34('0x42')]({'where':{'id':_0x1f01a2['query'][_0xdc34('0x6f')]},'attributes':['id'],'include':[{'model':db[_0xdc34('0x65')],'as':_0xdc34('0x66'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3c1531,null))[_0xdc34('0x26')](function(_0x46f400){var _0x24ec88=_[_0xdc34('0x2d')](_0x46f400,'id');var _0x174f47=[];var _0x3f53ae=[];var _0x93d20d=squel[_0xdc34('0x70')]();_0x93d20d['field'](_0xdc34('0x71'))[_0xdc34('0x72')](_0xdc34('0x73'),'tq')[_0xdc34('0x74')](_0xdc34('0x75'),'ut',_0xdc34('0x76'))[_0xdc34('0x3b')](_0xdc34('0x77'),_0x1f01a2[_0xdc34('0x46')]['id']);for(var _0x4120a9=0x0;_0x4120a9<_0x46f400[_0xdc34('0x5a')];_0x4120a9+=0x1){let _0x22095d=_0x46f400[_0x4120a9];for(var _0x3aa43a=0x0;_0x3aa43a<_0x22095d[_0xdc34('0x66')][_0xdc34('0x5a')];_0x3aa43a+=0x1){let _0x46f410=_0x22095d[_0xdc34('0x66')][_0x3aa43a];var _0x32ad5e=_0x93d20d['clone']();_0x32ad5e[_0xdc34('0x3b')](_0xdc34('0x78'),_0x46f410['id']);_0x3f53ae[_0xdc34('0x79')](db[_0xdc34('0x6a')][_0xdc34('0x32')](_0x32ad5e['toString'](),{'type':db[_0xdc34('0x6a')][_0xdc34('0x7a')][_0xdc34('0x7b')]})[_0xdc34('0x26')](function(_0x4eeeb1){if(_0x4eeeb1[_0xdc34('0x5a')]===0x1){return _0x46f410['id'];}else{var _0x1bed74=_[_0xdc34('0x7c')](_['map'](_0x4eeeb1,_0xdc34('0x7d')),function(_0x301079){return _[_0xdc34('0x7e')](_0x24ec88,_0x301079);});if(_0x1bed74){return _0x46f410['id'];}}}));}}return BPromise[_0xdc34('0x7f')](_0x3f53ae)[_0xdc34('0x26')](function(_0x5ed88f){_0x174f47=_(_0x174f47)[_0xdc34('0x80')](_0x5ed88f)['compact']()[_0xdc34('0x81')]();return db['SmsQueue'][_0xdc34('0x49')]({'where':{'id':_0x1f01a2[_0xdc34('0x46')]['id']}})[_0xdc34('0x26')](function(_0x3b1292){return db[_0xdc34('0x6a')]['transaction'](function(_0x5edc16){return _0x3b1292['removeTeams'](_0x1f01a2['query']['ids'],{'transaction':_0x5edc16})[_0xdc34('0x26')](function(){if(!_[_0xdc34('0x82')](_0x174f47)){return _0x3b1292[_0xdc34('0x83')](_0x174f47,{'transaction':_0x5edc16});}})[_0xdc34('0x26')](function(){_0x174f47[_0xdc34('0x6d')](function(_0x418f96){socket[_0xdc34('0x6e')]('userSmsQueue:remove',{'UserId':_0x418f96,'SmsQueueId':_0x3b1292['id']});});});});});});})['then'](respondWithStatusCode(_0x3c1531,null))[_0xdc34('0x44')](handleError(_0x3c1531,null));};exports['addAgents']=function(_0x39168b,_0x316191,_0x5ed34e){return db[_0xdc34('0x2e')][_0xdc34('0x49')]({'where':{'id':_0x39168b[_0xdc34('0x46')]['id']}})['then'](handleEntityNotFound(_0x316191,null))[_0xdc34('0x26')](function(_0x3b81b2){if(_0x3b81b2){return _0x3b81b2['addAgents'](_0x39168b['body'][_0xdc34('0x6f')],_[_0xdc34('0x84')](_0x39168b[_0xdc34('0x4b')],[_0xdc34('0x6f'),'id'])||{})[_0xdc34('0x85')](function(_0x6ccc79){for(var _0x367db5=0x0;_0x367db5<_0x39168b[_0xdc34('0x4b')][_0xdc34('0x6f')]['length'];_0x367db5+=0x1){socket[_0xdc34('0x6e')](_0xdc34('0x86'),{'UserId':_0x39168b['body']['ids'][_0x367db5],'SmsQueueId':_0x39168b['params']['id']});}return _0x6ccc79;});}})[_0xdc34('0x26')](respondWithResult(_0x316191,null))[_0xdc34('0x44')](handleError(_0x316191,null));};exports[_0xdc34('0x83')]=function(_0x560131,_0x1d1a8f,_0x1c474e){return db[_0xdc34('0x2e')][_0xdc34('0x49')]({'where':{'id':_0x560131[_0xdc34('0x46')]['id']}})[_0xdc34('0x26')](handleEntityNotFound(_0x1d1a8f,null))[_0xdc34('0x26')](function(_0x51cc84){if(_0x51cc84){return _0x51cc84[_0xdc34('0x83')](_0x560131['query'][_0xdc34('0x6f')])[_0xdc34('0x26')](function(){if(_[_0xdc34('0x87')](_0x560131[_0xdc34('0x32')][_0xdc34('0x6f')])){for(var _0x45d4a9=0x0;_0x45d4a9<_0x560131[_0xdc34('0x32')][_0xdc34('0x6f')][_0xdc34('0x5a')];_0x45d4a9+=0x1){socket[_0xdc34('0x6e')](_0xdc34('0x88'),{'UserId':Number(_0x560131[_0xdc34('0x32')][_0xdc34('0x6f')][_0x45d4a9]),'SmsQueueId':Number(_0x560131['params']['id'])});}}else{socket['emit'](_0xdc34('0x88'),{'UserId':Number(_0x560131['query'][_0xdc34('0x6f')]),'SmsQueueId':Number(_0x560131[_0xdc34('0x46')]['id'])});}});}})[_0xdc34('0x26')](respondWithStatusCode(_0x1d1a8f,null))[_0xdc34('0x44')](handleError(_0x1d1a8f,null));};exports['getAgents']=function(_0x25dd51,_0x253347,_0x170d61){var _0x5b2125={};var _0x10d838={};var _0x4fd7f5;var _0x392f09;return db[_0xdc34('0x2e')][_0xdc34('0x58')]({'where':{'id':_0x25dd51[_0xdc34('0x46')]['id']}})[_0xdc34('0x26')](handleEntityNotFound(_0x253347,null))[_0xdc34('0x26')](function(_0x2e5002){if(_0x2e5002){_0x4fd7f5=_0x2e5002;_0x10d838[_0xdc34('0x31')]=_['keys'](db[_0xdc34('0x65')][_0xdc34('0x2f')]);_0x10d838[_0xdc34('0x32')]=_[_0xdc34('0x47')](_0x25dd51[_0xdc34('0x32')]);_0x10d838[_0xdc34('0x33')]=_[_0xdc34('0x48')](_0x10d838[_0xdc34('0x31')],_0x10d838['query']);_0x5b2125[_0xdc34('0x34')]=_[_0xdc34('0x48')](_0x10d838[_0xdc34('0x31')],qs[_0xdc34('0x35')](_0x25dd51[_0xdc34('0x32')]['fields']));_0x5b2125[_0xdc34('0x34')]=_0x5b2125['attributes']['length']?_0x5b2125[_0xdc34('0x34')]:_0x10d838[_0xdc34('0x31')];_0x5b2125['order']=qs[_0xdc34('0x3a')](_0x25dd51[_0xdc34('0x32')][_0xdc34('0x3a')]);_0x5b2125[_0xdc34('0x3b')]=qs[_0xdc34('0x33')](_[_0xdc34('0x3c')](_0x25dd51[_0xdc34('0x32')],_0x10d838[_0xdc34('0x33')]));if(_0x25dd51[_0xdc34('0x32')][_0xdc34('0x3d')]){_0x5b2125[_0xdc34('0x3b')]=_[_0xdc34('0x3f')](_0x5b2125[_0xdc34('0x3b')],{'$or':_[_0xdc34('0x2d')](_0x5b2125[_0xdc34('0x34')],function(_0x564a5a){var _0x292d1d={};_0x292d1d[_0x564a5a]={'$like':'%'+_0x25dd51['query'][_0xdc34('0x3d')]+'%'};return _0x292d1d;})});}_0x5b2125=_[_0xdc34('0x3f')]({},_0x5b2125,_0x25dd51[_0xdc34('0x40')]);return _0x4fd7f5[_0xdc34('0x89')](_0x5b2125);}})[_0xdc34('0x26')](function(_0x29f394){if(_0x29f394){_0x392f09=_0x29f394[_0xdc34('0x5a')];if(!_0x25dd51[_0xdc34('0x32')][_0xdc34('0x36')](_0xdc34('0x37'))){_0x5b2125['limit']=qs['limit'](_0x25dd51[_0xdc34('0x32')]['limit']);_0x5b2125[_0xdc34('0x20')]=qs['offset'](_0x25dd51['query'][_0xdc34('0x20')]);}return _0x4fd7f5[_0xdc34('0x89')](_0x5b2125);}})['then'](function(_0x5a4a90){if(_0x5a4a90){return _0x5a4a90?{'count':_0x392f09,'rows':_0x5a4a90}:null;}})[_0xdc34('0x26')](respondWithResult(_0x253347,null))[_0xdc34('0x44')](handleError(_0x253347,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 1043716..7d4cca7 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 _0xbd38=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','update'];(function(_0x5b1c4f,_0x91fe11){var _0x179e79=function(_0x7370e9){while(--_0x7370e9){_0x5b1c4f['push'](_0x5b1c4f['shift']());}};_0x179e79(++_0x91fe11);}(_0xbd38,0xe1));var _0x8bd3=function(_0x2e2be8,_0x1ac634){_0x2e2be8=_0x2e2be8-0x0;var _0x4d0f7e=_0xbd38[_0x2e2be8];return _0x4d0f7e;};'use strict';var EventEmitter=require(_0x8bd3('0x0'));var SmsQueue=require(_0x8bd3('0x1'))['db'][_0x8bd3('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x8bd3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8bd3('0x4'),'afterDestroy':_0x8bd3('0x5')};function emitEvent(_0x19bb92){return function(_0x6fe070,_0x2d6344,_0x3394db){SmsQueueEvents[_0x8bd3('0x6')](_0x19bb92+':'+_0x6fe070['id'],_0x6fe070);SmsQueueEvents['emit'](_0x19bb92,_0x6fe070);_0x3394db(null);};}for(var e in events){if(events[_0x8bd3('0x7')](e)){var event=events[e];SmsQueue[_0x8bd3('0x8')](e,emitEvent(event));}}module[_0x8bd3('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x1176=['hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x430b2a,_0x516109){var _0x55e7b5=function(_0x1aaf5d){while(--_0x1aaf5d){_0x430b2a['push'](_0x430b2a['shift']());}};_0x55e7b5(++_0x516109);}(_0x1176,0x80));var _0x6117=function(_0x4fdff0,_0x21fabe){_0x4fdff0=_0x4fdff0-0x0;var _0x384344=_0x1176[_0x4fdff0];return _0x384344;};'use strict';var EventEmitter=require(_0x6117('0x0'));var SmsQueue=require(_0x6117('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x6117('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6117('0x3'),'afterDestroy':_0x6117('0x4')};function emitEvent(_0x2b745b){return function(_0xdea3e2,_0xd00726,_0x38ecec){SmsQueueEvents[_0x6117('0x5')](_0x2b745b+':'+_0xdea3e2['id'],_0xdea3e2);SmsQueueEvents[_0x6117('0x5')](_0x2b745b,_0xdea3e2);_0x38ecec(null);};}for(var e in events){if(events[_0x6117('0x6')](e)){var event=events[e];SmsQueue[_0x6117('0x7')](e,emitEvent(event));}}module[_0x6117('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index fffd511..eb5d194 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 _0x15a5=['../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3d9be2,_0x3796fb){var _0x4ab43c=function(_0x2a90c2){while(--_0x2a90c2){_0x3d9be2['push'](_0x3d9be2['shift']());}};_0x4ab43c(++_0x3796fb);}(_0x15a5,0x1e5));var _0x515a=function(_0x27c485,_0x30be8a){_0x27c485=_0x27c485-0x0;var _0x53aaf7=_0x15a5[_0x27c485];return _0x53aaf7;};'use strict';var _=require(_0x515a('0x0'));var util=require('util');var logger=require(_0x515a('0x1'))(_0x515a('0x2'));var moment=require(_0x515a('0x3'));var BPromise=require(_0x515a('0x4'));var rp=require(_0x515a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x515a('0x6'));var config=require(_0x515a('0x7'));var attributes=require(_0x515a('0x8'));module[_0x515a('0x9')]=function(_0x19b019,_0x19e52){return _0x19b019[_0x515a('0xa')](_0x515a('0xb'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e4b=['../../config/environment','./smsQueue.attributes','exports','SmsQueue','sms_queues','lodash','../../config/logger','bluebird','request-promise','path'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0x0e4b,0x1d1));var _0xb0e4=function(_0x2cd04b,_0xd130f9){_0x2cd04b=_0x2cd04b-0x0;var _0x213da5=_0x0e4b[_0x2cd04b];return _0x213da5;};'use strict';var _=require(_0xb0e4('0x0'));var util=require('util');var logger=require(_0xb0e4('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb0e4('0x2'));var rp=require(_0xb0e4('0x3'));var fs=require('fs');var path=require(_0xb0e4('0x4'));var rimraf=require('rimraf');var config=require(_0xb0e4('0x5'));var attributes=require(_0xb0e4('0x6'));module[_0xb0e4('0x7')]=function(_0x24b653,_0x396d97){return _0x24b653['define'](_0xb0e4('0x8'),attributes,{'tableName':_0xb0e4('0x9'),'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 683b375..2188835 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 _0x049f=['model','map','catch','find','ShowSmsQueue','stringify','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include'];(function(_0x45afec,_0x18bc92){var _0x5a841a=function(_0x47c272){while(--_0x47c272){_0x45afec['push'](_0x45afec['shift']());}};_0x5a841a(++_0x18bc92);}(_0x049f,0x1a8));var _0xf049=function(_0x232eb7,_0x199b07){_0x232eb7=_0x232eb7-0x0;var _0xd7fb8=_0x049f[_0x232eb7];return _0xd7fb8;};'use strict';var _=require(_0xf049('0x0'));var util=require(_0xf049('0x1'));var moment=require('moment');var BPromise=require(_0xf049('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf049('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf049('0x4'));var logger=require(_0xf049('0x5'))(_0xf049('0x6'));var config=require(_0xf049('0x7'));var jayson=require(_0xf049('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xf049('0x9')]=_[_0xf049('0xa')](config['redis'],{'host':_0xf049('0xb'),'port':0x18eb});var socket=require(_0xf049('0xc'))(new Redis(config['redis']));require(_0xf049('0xd'))[_0xf049('0xe')](socket);function respondWithRpcPromise(_0x50e55e,_0xa80729,_0x1e8b61){return new BPromise(function(_0x3638cf,_0x1289b0){return client[_0xf049('0xf')](_0x50e55e,_0x1e8b61)[_0xf049('0x10')](function(_0x218bbd){logger[_0xf049('0x11')](_0xf049('0x12'),_0xa80729,_0xf049('0x13'));logger[_0xf049('0x14')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0xa80729,_0xf049('0x13'),JSON['stringify'](_0x218bbd));if(_0x218bbd['error']){if(_0x218bbd[_0xf049('0x15')]['code']===0x1f4){logger[_0xf049('0x15')]('SmsQueue,\x20%s,\x20%s',_0xa80729,_0x218bbd['error'][_0xf049('0x16')]);return _0x1289b0(_0x218bbd[_0xf049('0x15')][_0xf049('0x16')]);}logger[_0xf049('0x15')](_0xf049('0x12'),_0xa80729,_0x218bbd['error'][_0xf049('0x16')]);return _0x3638cf(_0x218bbd['error'][_0xf049('0x16')]);}else{logger[_0xf049('0x11')](_0xf049('0x12'),_0xa80729,'request\x20sent');_0x3638cf(_0x218bbd['result'][_0xf049('0x16')]);}})['catch'](function(_0x36ea63){logger[_0xf049('0x15')](_0xf049('0x12'),_0xa80729,_0x36ea63);_0x1289b0(_0x36ea63);});});}exports[_0xf049('0x17')]=function(_0x260ba2){var _0x3bb217=this;return new Promise(function(_0x276d8c,_0x1fd6cc){return db[_0xf049('0x18')][_0xf049('0x19')]({'raw':_0x260ba2[_0xf049('0x1a')]?_0x260ba2[_0xf049('0x1a')][_0xf049('0x1b')]===undefined?!![]:![]:!![],'where':_0x260ba2[_0xf049('0x1a')]?_0x260ba2['options'][_0xf049('0x1c')]||null:null,'attributes':_0x260ba2[_0xf049('0x1a')]?_0x260ba2[_0xf049('0x1a')][_0xf049('0x1d')]||null:null,'limit':_0x260ba2['options']?_0x260ba2[_0xf049('0x1a')][_0xf049('0x1e')]||null:null,'include':_0x260ba2['options']?_0x260ba2[_0xf049('0x1a')][_0xf049('0x1f')]?_['map'](_0x260ba2[_0xf049('0x1a')][_0xf049('0x1f')],function(_0x1ae71b){return{'model':db[_0x1ae71b[_0xf049('0x20')]],'as':_0x1ae71b['as'],'attributes':_0x1ae71b[_0xf049('0x1d')],'include':_0x1ae71b[_0xf049('0x1f')]?_[_0xf049('0x21')](_0x1ae71b['include'],function(_0x5c62b8){return{'model':db[_0x5c62b8[_0xf049('0x20')]],'as':_0x5c62b8['as'],'attributes':_0x5c62b8[_0xf049('0x1d')],'include':_0x5c62b8['include']?_[_0xf049('0x21')](_0x5c62b8[_0xf049('0x1f')],function(_0x3eddc1){return{'model':db[_0x3eddc1['model']],'as':_0x3eddc1['as'],'attributes':_0x3eddc1[_0xf049('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf049('0x10')](function(_0x13935d){logger[_0xf049('0x11')]('GetSmsQueue',_0x260ba2);logger[_0xf049('0x14')](_0xf049('0x17'),_0x260ba2,JSON['stringify'](_0x13935d));_0x276d8c(_0x13935d);})[_0xf049('0x22')](function(_0x8cf92c){logger['error'](_0xf049('0x17'),_0x8cf92c['message'],_0x260ba2);_0x1fd6cc(_0x3bb217[_0xf049('0x15')](0x1f4,_0x8cf92c['message']));});});};exports['ShowSmsQueue']=function(_0x124211){var _0x2454d2=this;return new Promise(function(_0x5df20f,_0x765a38){return db[_0xf049('0x18')][_0xf049('0x23')]({'raw':_0x124211['options']?_0x124211['options'][_0xf049('0x1b')]===undefined?!![]:![]:!![],'where':_0x124211['options']?_0x124211['options'][_0xf049('0x1c')]||null:null,'attributes':_0x124211['options']?_0x124211['options'][_0xf049('0x1d')]||null:null,'include':_0x124211[_0xf049('0x1a')]?_0x124211[_0xf049('0x1a')][_0xf049('0x1f')]?_[_0xf049('0x21')](_0x124211[_0xf049('0x1a')]['include'],function(_0x415bc4){return{'model':db[_0x415bc4['model']],'as':_0x415bc4['as'],'attributes':_0x415bc4[_0xf049('0x1d')],'include':_0x415bc4['include']?_[_0xf049('0x21')](_0x415bc4[_0xf049('0x1f')],function(_0x13e983){return{'model':db[_0x13e983[_0xf049('0x20')]],'as':_0x13e983['as'],'attributes':_0x13e983[_0xf049('0x1d')],'include':_0x13e983[_0xf049('0x1f')]?_['map'](_0x13e983[_0xf049('0x1f')],function(_0x31cce3){return{'model':db[_0x31cce3['model']],'as':_0x31cce3['as'],'attributes':_0x31cce3['attributes']};}):[]};}):[]};}):[]:[]})[_0xf049('0x10')](function(_0xf8e2ec){logger[_0xf049('0x11')]('ShowSmsQueue',_0x124211);logger[_0xf049('0x14')](_0xf049('0x24'),_0x124211,JSON[_0xf049('0x25')](_0xf8e2ec));_0x5df20f(_0xf8e2ec);})[_0xf049('0x22')](function(_0x4bb310){logger[_0xf049('0x15')](_0xf049('0x24'),_0x4bb310[_0xf049('0x16')],_0x124211);_0x765a38(_0x2454d2[_0xf049('0x15')](0x1f4,_0x4bb310['message']));});});}; \ No newline at end of file +var _0x47fb=['message','SmsQueue,\x20%s,\x20%s','result','catch','GetSmsQueue','findAll','options','raw','where','attributes','limit','map','include','model','SmsQueue','ShowSmsQueue','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x421ee7,_0x5854a1){var _0x5062c1=function(_0x5ef42b){while(--_0x5ef42b){_0x421ee7['push'](_0x421ee7['shift']());}};_0x5062c1(++_0x5854a1);}(_0x47fb,0xce));var _0xb47f=function(_0x11a1fe,_0x572c9b){_0x11a1fe=_0x11a1fe-0x0;var _0x303f1c=_0x47fb[_0x11a1fe];return _0x303f1c;};'use strict';var _=require('lodash');var util=require(_0xb47f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb47f('0x1'));var fs=require('fs');var Redis=require(_0xb47f('0x2'));var db=require(_0xb47f('0x3'))['db'];var utils=require(_0xb47f('0x4'));var logger=require(_0xb47f('0x5'))('rpc');var config=require(_0xb47f('0x6'));var jayson=require(_0xb47f('0x7'));var client=jayson['client'][_0xb47f('0x8')]({'port':0x232a});config[_0xb47f('0x9')]=_['defaults'](config['redis'],{'host':_0xb47f('0xa'),'port':0x18eb});var socket=require(_0xb47f('0xb'))(new Redis(config[_0xb47f('0x9')]));require(_0xb47f('0xc'))[_0xb47f('0xd')](socket);function respondWithRpcPromise(_0x1b4ea3,_0x1a8832,_0x3d48a1){return new BPromise(function(_0x4090c1,_0x5af360){return client[_0xb47f('0xe')](_0x1b4ea3,_0x3d48a1)[_0xb47f('0xf')](function(_0x2d2b82){logger[_0xb47f('0x10')]('SmsQueue,\x20%s,\x20%s',_0x1a8832,_0xb47f('0x11'));logger[_0xb47f('0x12')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x1a8832,'request\x20sent',JSON[_0xb47f('0x13')](_0x2d2b82));if(_0x2d2b82[_0xb47f('0x14')]){if(_0x2d2b82['error'][_0xb47f('0x15')]===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0x1a8832,_0x2d2b82[_0xb47f('0x14')][_0xb47f('0x16')]);return _0x5af360(_0x2d2b82[_0xb47f('0x14')][_0xb47f('0x16')]);}logger[_0xb47f('0x14')](_0xb47f('0x17'),_0x1a8832,_0x2d2b82[_0xb47f('0x14')][_0xb47f('0x16')]);return _0x4090c1(_0x2d2b82[_0xb47f('0x14')][_0xb47f('0x16')]);}else{logger['info'](_0xb47f('0x17'),_0x1a8832,_0xb47f('0x11'));_0x4090c1(_0x2d2b82[_0xb47f('0x18')][_0xb47f('0x16')]);}})[_0xb47f('0x19')](function(_0x1be6da){logger[_0xb47f('0x14')]('SmsQueue,\x20%s,\x20%s',_0x1a8832,_0x1be6da);_0x5af360(_0x1be6da);});});}exports[_0xb47f('0x1a')]=function(_0x1b96f4){var _0x4acd15=this;return new Promise(function(_0x26d46c,_0x165dd4){return db['SmsQueue'][_0xb47f('0x1b')]({'raw':_0x1b96f4[_0xb47f('0x1c')]?_0x1b96f4['options'][_0xb47f('0x1d')]===undefined?!![]:![]:!![],'where':_0x1b96f4['options']?_0x1b96f4['options'][_0xb47f('0x1e')]||null:null,'attributes':_0x1b96f4[_0xb47f('0x1c')]?_0x1b96f4[_0xb47f('0x1c')][_0xb47f('0x1f')]||null:null,'limit':_0x1b96f4['options']?_0x1b96f4[_0xb47f('0x1c')][_0xb47f('0x20')]||null:null,'include':_0x1b96f4[_0xb47f('0x1c')]?_0x1b96f4[_0xb47f('0x1c')]['include']?_[_0xb47f('0x21')](_0x1b96f4['options'][_0xb47f('0x22')],function(_0x5c4087){return{'model':db[_0x5c4087['model']],'as':_0x5c4087['as'],'attributes':_0x5c4087[_0xb47f('0x1f')],'include':_0x5c4087[_0xb47f('0x22')]?_[_0xb47f('0x21')](_0x5c4087[_0xb47f('0x22')],function(_0x52b929){return{'model':db[_0x52b929[_0xb47f('0x23')]],'as':_0x52b929['as'],'attributes':_0x52b929[_0xb47f('0x1f')],'include':_0x52b929[_0xb47f('0x22')]?_[_0xb47f('0x21')](_0x52b929['include'],function(_0x269459){return{'model':db[_0x269459[_0xb47f('0x23')]],'as':_0x269459['as'],'attributes':_0x269459[_0xb47f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb47f('0xf')](function(_0x31f7d9){logger[_0xb47f('0x10')](_0xb47f('0x1a'),_0x1b96f4);logger['debug'](_0xb47f('0x1a'),_0x1b96f4,JSON[_0xb47f('0x13')](_0x31f7d9));_0x26d46c(_0x31f7d9);})[_0xb47f('0x19')](function(_0x5d3007){logger[_0xb47f('0x14')](_0xb47f('0x1a'),_0x5d3007[_0xb47f('0x16')],_0x1b96f4);_0x165dd4(_0x4acd15[_0xb47f('0x14')](0x1f4,_0x5d3007[_0xb47f('0x16')]));});});};exports['ShowSmsQueue']=function(_0x8b6a84){var _0x33d447=this;return new Promise(function(_0x3be598,_0x423482){return db[_0xb47f('0x24')]['find']({'raw':_0x8b6a84[_0xb47f('0x1c')]?_0x8b6a84['options'][_0xb47f('0x1d')]===undefined?!![]:![]:!![],'where':_0x8b6a84['options']?_0x8b6a84[_0xb47f('0x1c')][_0xb47f('0x1e')]||null:null,'attributes':_0x8b6a84[_0xb47f('0x1c')]?_0x8b6a84[_0xb47f('0x1c')][_0xb47f('0x1f')]||null:null,'include':_0x8b6a84[_0xb47f('0x1c')]?_0x8b6a84[_0xb47f('0x1c')][_0xb47f('0x22')]?_[_0xb47f('0x21')](_0x8b6a84[_0xb47f('0x1c')]['include'],function(_0x5a8a0d){return{'model':db[_0x5a8a0d['model']],'as':_0x5a8a0d['as'],'attributes':_0x5a8a0d[_0xb47f('0x1f')],'include':_0x5a8a0d[_0xb47f('0x22')]?_[_0xb47f('0x21')](_0x5a8a0d[_0xb47f('0x22')],function(_0x4f26cd){return{'model':db[_0x4f26cd[_0xb47f('0x23')]],'as':_0x4f26cd['as'],'attributes':_0x4f26cd[_0xb47f('0x1f')],'include':_0x4f26cd[_0xb47f('0x22')]?_[_0xb47f('0x21')](_0x4f26cd[_0xb47f('0x22')],function(_0x5d2e1c){return{'model':db[_0x5d2e1c[_0xb47f('0x23')]],'as':_0x5d2e1c['as'],'attributes':_0x5d2e1c[_0xb47f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb47f('0xf')](function(_0x1981a8){logger['info'](_0xb47f('0x25'),_0x8b6a84);logger['debug'](_0xb47f('0x25'),_0x8b6a84,JSON[_0xb47f('0x13')](_0x1981a8));_0x3be598(_0x1981a8);})[_0xb47f('0x19')](function(_0x1aab69){logger['error']('ShowSmsQueue',_0x1aab69[_0xb47f('0x16')],_0x8b6a84);_0x423482(_0x33d447['error'](0x1f4,_0x1aab69[_0xb47f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index bfa1158..7032be0 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 _0x3868=['removeListener','length','smsQueue:','./smsQueue.events','update','emit'];(function(_0x110e11,_0x2386fb){var _0x16d509=function(_0x58d8e7){while(--_0x58d8e7){_0x110e11['push'](_0x110e11['shift']());}};_0x16d509(++_0x2386fb);}(_0x3868,0x7b));var _0x8386=function(_0x4efcf7,_0x5972f1){_0x4efcf7=_0x4efcf7-0x0;var _0x48d4b9=_0x3868[_0x4efcf7];return _0x48d4b9;};'use strict';var SmsQueueEvents=require(_0x8386('0x0'));var events=['save','remove',_0x8386('0x1')];function createListener(_0x55f5a6,_0x1b4c12){return function(_0x55ad87){_0x1b4c12[_0x8386('0x2')](_0x55f5a6,_0x55ad87);};}function removeListener(_0x4c3116,_0x2e90a3){return function(){SmsQueueEvents[_0x8386('0x3')](_0x4c3116,_0x2e90a3);};}exports['register']=function(_0x4966fa){for(var _0x164492=0x0,_0x144714=events[_0x8386('0x4')];_0x164492<_0x144714;_0x164492++){var _0x3cc088=events[_0x164492];var _0x343bd6=createListener(_0x8386('0x5')+_0x3cc088,_0x4966fa);SmsQueueEvents['on'](_0x3cc088,_0x343bd6);}}; \ No newline at end of file +var _0x1907=['update','register','smsQueue:','./smsQueue.events','save','remove'];(function(_0x5ec453,_0x30b0ba){var _0x25548f=function(_0x387b62){while(--_0x387b62){_0x5ec453['push'](_0x5ec453['shift']());}};_0x25548f(++_0x30b0ba);}(_0x1907,0xb1));var _0x7190=function(_0x327ae5,_0x4268e0){_0x327ae5=_0x327ae5-0x0;var _0x402ec4=_0x1907[_0x327ae5];return _0x402ec4;};'use strict';var SmsQueueEvents=require(_0x7190('0x0'));var events=[_0x7190('0x1'),_0x7190('0x2'),_0x7190('0x3')];function createListener(_0x469a1c,_0x39ceb4){return function(_0x5cd76e){_0x39ceb4['emit'](_0x469a1c,_0x5cd76e);};}function removeListener(_0x599e20,_0xc5145d){return function(){SmsQueueEvents['removeListener'](_0x599e20,_0xc5145d);};}exports[_0x7190('0x4')]=function(_0x474a36){for(var _0x1e4c76=0x0,_0x1d1c31=events['length'];_0x1e4c76<_0x1d1c31;_0x1e4c76++){var _0x5147dd=events[_0x1e4c76];var _0x143ff0=createListener(_0x7190('0x5')+_0x5147dd,_0x474a36);SmsQueueEvents['on'](_0x5147dd,_0x143ff0);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 00350ce..a5ca68a 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 _0xedb3=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','put','update','delete'];(function(_0x46fc73,_0x5876f4){var _0x43c260=function(_0x4991e9){while(--_0x4991e9){_0x46fc73['push'](_0x46fc73['shift']());}};_0x43c260(++_0x5876f4);}(_0xedb3,0x10a));var _0x3edb=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xedb3[_0x1a9204];return _0x17ca68;};'use strict';var multer=require(_0x3edb('0x0'));var util=require(_0x3edb('0x1'));var path=require(_0x3edb('0x2'));var timeout=require(_0x3edb('0x3'));var express=require(_0x3edb('0x4'));var router=express[_0x3edb('0x5')]();var fs_extra=require(_0x3edb('0x6'));var auth=require(_0x3edb('0x7'));var interaction=require(_0x3edb('0x8'));var config=require(_0x3edb('0x9'));var controller=require(_0x3edb('0xa'));router['get']('/',auth[_0x3edb('0xb')](),controller[_0x3edb('0xc')]);router[_0x3edb('0xd')](_0x3edb('0xe'),auth[_0x3edb('0xb')](),controller['describe']);router['get'](_0x3edb('0xf'),auth[_0x3edb('0xb')](),controller[_0x3edb('0x10')]);router[_0x3edb('0x11')]('/',auth[_0x3edb('0xb')](),controller[_0x3edb('0x12')]);router[_0x3edb('0x13')](_0x3edb('0xf'),auth[_0x3edb('0xb')](),controller[_0x3edb('0x14')]);router[_0x3edb('0x15')](_0x3edb('0xf'),auth[_0x3edb('0xb')](),controller[_0x3edb('0x16')]);module[_0x3edb('0x17')]=router; \ No newline at end of file +var _0x3713=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','index','get','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3713,0x64));var _0x3371=function(_0x42ca59,_0x1d8ea0){_0x42ca59=_0x42ca59-0x0;var _0x3790a1=_0x3713[_0x42ca59];return _0x3790a1;};'use strict';var multer=require(_0x3371('0x0'));var util=require('util');var path=require(_0x3371('0x1'));var timeout=require(_0x3371('0x2'));var express=require(_0x3371('0x3'));var router=express[_0x3371('0x4')]();var fs_extra=require(_0x3371('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3371('0x6'));var config=require(_0x3371('0x7'));var controller=require(_0x3371('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x3371('0x9')]);router[_0x3371('0xa')]('/describe',auth[_0x3371('0xb')](),controller[_0x3371('0xc')]);router[_0x3371('0xa')](_0x3371('0xd'),auth[_0x3371('0xb')](),controller[_0x3371('0xe')]);router[_0x3371('0xf')]('/',auth['isAuthenticated'](),controller[_0x3371('0x10')]);router['put'](_0x3371('0xd'),auth['isAuthenticated'](),controller[_0x3371('0x11')]);router[_0x3371('0x12')](_0x3371('0xd'),auth[_0x3371('0xb')](),controller[_0x3371('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 7a64529..c91d191 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 _0x54b5=['moment','exports','STRING','DATE'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x54b5,0x198));var _0x554b=function(_0x27da15,_0x48f438){_0x27da15=_0x27da15-0x0;var _0x1251c7=_0x54b5[_0x27da15];return _0x1251c7;};'use strict';var moment=require(_0x554b('0x0'));var Sequelize=require('sequelize');module[_0x554b('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x554b('0x2')]},'joinAt':{'type':Sequelize[_0x554b('0x3')]},'leaveAt':{'type':Sequelize[_0x554b('0x3')]},'acceptAt':{'type':Sequelize[_0x554b('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8659=['exports','STRING','DATE','sequelize'];(function(_0x19f5d9,_0x1dc17f){var _0x3e5e0f=function(_0x1e8606){while(--_0x1e8606){_0x19f5d9['push'](_0x19f5d9['shift']());}};_0x3e5e0f(++_0x1dc17f);}(_0x8659,0x187));var _0x9865=function(_0xbf32b2,_0x5d2c71){_0xbf32b2=_0xbf32b2-0x0;var _0xf5974f=_0x8659[_0xbf32b2];return _0xf5974f;};'use strict';var moment=require('moment');var Sequelize=require(_0x9865('0x0'));module[_0x9865('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x9865('0x2')]},'joinAt':{'type':Sequelize[_0x9865('0x3')]},'leaveAt':{'type':Sequelize[_0x9865('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9865('0x3')]},'reason':{'type':Sequelize[_0x9865('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 5748acd..cd4bd85 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 _0xa832=['merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','create','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','destroy','then','stack','name','send','index','map','SmsQueueReport','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0xa832,0x1a1));var _0x2a83=function(_0x95a96c,_0xb0efff){_0x95a96c=_0x95a96c-0x0;var _0x372bd1=_0xa832[_0x95a96c];return _0x372bd1;};'use strict';var emlformat=require(_0x2a83('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2a83('0x1'));var jsonpatch=require(_0x2a83('0x2'));var rp=require('request-promise');var moment=require(_0x2a83('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2a83('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2a83('0x5'));var _=require(_0x2a83('0x6'));var squel=require(_0x2a83('0x7'));var crypto=require(_0x2a83('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2a83('0x9'));var Papa=require('papaparse');var Redis=require(_0x2a83('0xa'));var authService=require(_0x2a83('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0x2a83('0xc'));var hardwareService=require(_0x2a83('0xd'));var logger=require('../../config/logger')(_0x2a83('0xe'));var utils=require('../../config/utils');var config=require(_0x2a83('0xf'));var licenseUtil=require(_0x2a83('0x10'));var db=require(_0x2a83('0x11'))['db'];function respondWithStatusCode(_0x4a28e7,_0x30a312){_0x30a312=_0x30a312||0xcc;return function(_0x4162c4){if(_0x4162c4){return _0x4a28e7[_0x2a83('0x12')](_0x30a312);}return _0x4a28e7[_0x2a83('0x13')](_0x30a312)[_0x2a83('0x14')]();};}function respondWithResult(_0x4448d1,_0x3b6210){_0x3b6210=_0x3b6210||0xc8;return function(_0x343fbb){if(_0x343fbb){return _0x4448d1[_0x2a83('0x13')](_0x3b6210)[_0x2a83('0x15')](_0x343fbb);}};}function respondWithFilteredResult(_0x22219f,_0x123f4a){return function(_0x327b6b){if(_0x327b6b){var _0x27b199=_0x327b6b[_0x2a83('0x16')],_0x24f76c=_0x123f4a[_0x2a83('0x17')],_0x5e505a=_0x123f4a['offset']+_0x123f4a[_0x2a83('0x18')],_0x945e8c;if(_0x5e505a>=_0x27b199){_0x5e505a=_0x27b199;_0x945e8c=0xc8;}else{_0x945e8c=0xce;}_0x22219f['status'](_0x945e8c);return _0x22219f[_0x2a83('0x19')]('Content-Range',_0x24f76c+'-'+_0x5e505a+'/'+_0x27b199)['json'](_0x327b6b);}return null;};}function patchUpdates(_0x5afd1f){return function(_0x12ee7f){try{jsonpatch['apply'](_0x12ee7f,_0x5afd1f,!![]);}catch(_0x627752){return BPromise[_0x2a83('0x1a')](_0x627752);}return _0x12ee7f[_0x2a83('0x1b')]();};}function saveUpdates(_0x53e80d,_0x5ed83b){return function(_0x115867){if(_0x115867){return _0x115867['update'](_0x53e80d)['then'](function(_0x30ab31){return _0x30ab31;});}return null;};}function removeEntity(_0x204d33,_0x38dd02){return function(_0x4b791d){if(_0x4b791d){return _0x4b791d[_0x2a83('0x1c')]()[_0x2a83('0x1d')](function(){_0x204d33[_0x2a83('0x13')](0xcc)[_0x2a83('0x14')]();});}};}function handleEntityNotFound(_0x2dfc84,_0x54ee23){return function(_0x20a9cb){if(!_0x20a9cb){_0x2dfc84[_0x2a83('0x12')](0x194);}return _0x20a9cb;};}function handleError(_0x5dd518,_0x5ebc45){_0x5ebc45=_0x5ebc45||0x1f4;return function(_0x498c1e){logger['error'](_0x498c1e[_0x2a83('0x1e')]);if(_0x498c1e['name']){delete _0x498c1e[_0x2a83('0x1f')];}_0x5dd518[_0x2a83('0x13')](_0x5ebc45)[_0x2a83('0x20')](_0x498c1e);};}exports[_0x2a83('0x21')]=function(_0x287fb8,_0x4150c8){var _0x1159e3={},_0xaed502={},_0xd15b19={'count':0x0,'rows':[]};var _0x235531=_[_0x2a83('0x22')](db[_0x2a83('0x23')]['rawAttributes'],function(_0x18fe93){return{'name':_0x18fe93['fieldName'],'type':_0x18fe93[_0x2a83('0x24')][_0x2a83('0x25')]};});_0xaed502['model']=_[_0x2a83('0x22')](_0x235531,_0x2a83('0x1f'));_0xaed502['query']=_['keys'](_0x287fb8[_0x2a83('0x26')]);_0xaed502[_0x2a83('0x27')]=_[_0x2a83('0x28')](_0xaed502[_0x2a83('0x29')],_0xaed502[_0x2a83('0x26')]);_0x1159e3[_0x2a83('0x2a')]=_[_0x2a83('0x28')](_0xaed502[_0x2a83('0x29')],qs[_0x2a83('0x2b')](_0x287fb8[_0x2a83('0x26')]['fields']));_0x1159e3[_0x2a83('0x2a')]=_0x1159e3[_0x2a83('0x2a')][_0x2a83('0x2c')]?_0x1159e3[_0x2a83('0x2a')]:_0xaed502[_0x2a83('0x29')];if(!_0x287fb8[_0x2a83('0x26')][_0x2a83('0x2d')](_0x2a83('0x2e'))){_0x1159e3['limit']=qs['limit'](_0x287fb8['query'][_0x2a83('0x18')]);_0x1159e3[_0x2a83('0x17')]=qs[_0x2a83('0x17')](_0x287fb8[_0x2a83('0x26')][_0x2a83('0x17')]);}_0x1159e3[_0x2a83('0x2f')]=qs[_0x2a83('0x30')](_0x287fb8[_0x2a83('0x26')][_0x2a83('0x30')]);_0x1159e3[_0x2a83('0x31')]=qs[_0x2a83('0x27')](_[_0x2a83('0x32')](_0x287fb8['query'],_0xaed502[_0x2a83('0x27')]),_0x235531);if(_0x287fb8[_0x2a83('0x26')][_0x2a83('0x33')]){_0x1159e3[_0x2a83('0x31')]=_[_0x2a83('0x34')](_0x1159e3[_0x2a83('0x31')],{'$or':_[_0x2a83('0x22')](_0x235531,function(_0xb744e4){if(_0xb744e4[_0x2a83('0x24')]!==_0x2a83('0x35')){var _0x3dc0ec={};_0x3dc0ec[_0xb744e4[_0x2a83('0x1f')]]={'$like':'%'+_0x287fb8[_0x2a83('0x26')]['filter']+'%'};return _0x3dc0ec;}})});}_0x1159e3=_['merge']({},_0x1159e3,_0x287fb8['options']);var _0x2cd008={'where':_0x1159e3[_0x2a83('0x31')]};return db[_0x2a83('0x23')]['count'](_0x2cd008)[_0x2a83('0x1d')](function(_0x375474){_0xd15b19[_0x2a83('0x16')]=_0x375474;if(_0x287fb8[_0x2a83('0x26')][_0x2a83('0x36')]){_0x1159e3[_0x2a83('0x37')]=[{'all':!![]}];}return db[_0x2a83('0x23')][_0x2a83('0x38')](_0x1159e3);})[_0x2a83('0x1d')](function(_0x195986){_0xd15b19[_0x2a83('0x39')]=_0x195986;return _0xd15b19;})[_0x2a83('0x1d')](respondWithFilteredResult(_0x4150c8,_0x1159e3))[_0x2a83('0x3a')](handleError(_0x4150c8,null));};exports[_0x2a83('0x3b')]=function(_0x201c15,_0x5b49c0){var _0x483e4e={'raw':!![],'where':{'id':_0x201c15[_0x2a83('0x3c')]['id']}},_0x4d915f={};_0x4d915f['model']=_[_0x2a83('0x3d')](db[_0x2a83('0x23')][_0x2a83('0x3e')]);_0x4d915f[_0x2a83('0x26')]=_[_0x2a83('0x3d')](_0x201c15[_0x2a83('0x26')]);_0x4d915f[_0x2a83('0x27')]=_['intersection'](_0x4d915f[_0x2a83('0x29')],_0x4d915f[_0x2a83('0x26')]);_0x483e4e['attributes']=_[_0x2a83('0x28')](_0x4d915f['model'],qs[_0x2a83('0x2b')](_0x201c15[_0x2a83('0x26')]['fields']));_0x483e4e[_0x2a83('0x2a')]=_0x483e4e['attributes'][_0x2a83('0x2c')]?_0x483e4e[_0x2a83('0x2a')]:_0x4d915f['model'];if(_0x201c15[_0x2a83('0x26')][_0x2a83('0x36')]){_0x483e4e['include']=[{'all':!![]}];}_0x483e4e=_[_0x2a83('0x34')]({},_0x483e4e,_0x201c15['options']);return db[_0x2a83('0x23')]['find'](_0x483e4e)[_0x2a83('0x1d')](handleEntityNotFound(_0x5b49c0,null))[_0x2a83('0x1d')](respondWithResult(_0x5b49c0,null))[_0x2a83('0x3a')](handleError(_0x5b49c0,null));};exports[_0x2a83('0x3f')]=function(_0x51e430,_0x5e0e63){return db[_0x2a83('0x23')][_0x2a83('0x3f')](_0x51e430['body'],{})[_0x2a83('0x1d')](respondWithResult(_0x5e0e63,0xc9))[_0x2a83('0x3a')](handleError(_0x5e0e63,null));};exports['update']=function(_0x321b73,_0x33210a){if(_0x321b73['body']['id']){delete _0x321b73[_0x2a83('0x40')]['id'];}return db[_0x2a83('0x23')][_0x2a83('0x41')]({'where':{'id':_0x321b73[_0x2a83('0x3c')]['id']}})[_0x2a83('0x1d')](handleEntityNotFound(_0x33210a,null))[_0x2a83('0x1d')](saveUpdates(_0x321b73['body'],null))['then'](respondWithResult(_0x33210a,null))['catch'](handleError(_0x33210a,null));};exports[_0x2a83('0x1c')]=function(_0x25121d,_0x11ef5b){return db['SmsQueueReport']['find']({'where':{'id':_0x25121d[_0x2a83('0x3c')]['id']}})[_0x2a83('0x1d')](handleEntityNotFound(_0x11ef5b,null))[_0x2a83('0x1d')](removeEntity(_0x11ef5b,null))[_0x2a83('0x3a')](handleError(_0x11ef5b,null));};exports['describe']=function(_0x306d5d,_0x3e2f16){return db[_0x2a83('0x23')][_0x2a83('0x42')]()[_0x2a83('0x1d')](respondWithResult(_0x3e2f16,null))[_0x2a83('0x3a')](handleError(_0x3e2f16,null));}; \ No newline at end of file +var _0xd94c=['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/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','SmsQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','catch','create','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x2acdaf,_0x28e636){var _0x4815d4=function(_0xc1b898){while(--_0xc1b898){_0x2acdaf['push'](_0x2acdaf['shift']());}};_0x4815d4(++_0x28e636);}(_0xd94c,0x93));var _0xcd94=function(_0x1aa5c9,_0x3229d9){_0x1aa5c9=_0x1aa5c9-0x0;var _0x137bf7=_0xd94c[_0x1aa5c9];return _0x137bf7;};'use strict';var emlformat=require(_0xcd94('0x0'));var rimraf=require(_0xcd94('0x1'));var zipdir=require(_0xcd94('0x2'));var jsonpatch=require(_0xcd94('0x3'));var rp=require('request-promise');var moment=require(_0xcd94('0x4'));var BPromise=require(_0xcd94('0x5'));var Mustache=require(_0xcd94('0x6'));var util=require(_0xcd94('0x7'));var path=require(_0xcd94('0x8'));var sox=require('sox');var csv=require(_0xcd94('0x9'));var ejs=require(_0xcd94('0xa'));var fs=require('fs');var fs_extra=require(_0xcd94('0xb'));var _=require(_0xcd94('0xc'));var squel=require('squel');var crypto=require(_0xcd94('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xcd94('0xe'));var toCsv=require(_0xcd94('0x9'));var querystring=require(_0xcd94('0xf'));var Papa=require(_0xcd94('0x10'));var Redis=require(_0xcd94('0x11'));var authService=require(_0xcd94('0x12'));var qs=require(_0xcd94('0x13'));var as=require(_0xcd94('0x14'));var hardwareService=require(_0xcd94('0x15'));var logger=require(_0xcd94('0x16'))(_0xcd94('0x17'));var utils=require(_0xcd94('0x18'));var config=require(_0xcd94('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xcd94('0x1a'))['db'];function respondWithStatusCode(_0x7aec0c,_0x14098f){_0x14098f=_0x14098f||0xcc;return function(_0x4bf8a8){if(_0x4bf8a8){return _0x7aec0c['sendStatus'](_0x14098f);}return _0x7aec0c['status'](_0x14098f)[_0xcd94('0x1b')]();};}function respondWithResult(_0x19f066,_0x44e39d){_0x44e39d=_0x44e39d||0xc8;return function(_0x455b59){if(_0x455b59){return _0x19f066[_0xcd94('0x1c')](_0x44e39d)[_0xcd94('0x1d')](_0x455b59);}};}function respondWithFilteredResult(_0x4d0643,_0x1da4fb){return function(_0x28b856){if(_0x28b856){var _0x576b87=_0x28b856[_0xcd94('0x1e')],_0x2e8c12=_0x1da4fb[_0xcd94('0x1f')],_0x3fbe21=_0x1da4fb[_0xcd94('0x1f')]+_0x1da4fb[_0xcd94('0x20')],_0x156eee;if(_0x3fbe21>=_0x576b87){_0x3fbe21=_0x576b87;_0x156eee=0xc8;}else{_0x156eee=0xce;}_0x4d0643[_0xcd94('0x1c')](_0x156eee);return _0x4d0643[_0xcd94('0x21')](_0xcd94('0x22'),_0x2e8c12+'-'+_0x3fbe21+'/'+_0x576b87)[_0xcd94('0x1d')](_0x28b856);}return null;};}function patchUpdates(_0x2076ac){return function(_0x4dc786){try{jsonpatch[_0xcd94('0x23')](_0x4dc786,_0x2076ac,!![]);}catch(_0x36d057){return BPromise[_0xcd94('0x24')](_0x36d057);}return _0x4dc786[_0xcd94('0x25')]();};}function saveUpdates(_0x3f82ad,_0xa5b9de){return function(_0xe1dae8){if(_0xe1dae8){return _0xe1dae8[_0xcd94('0x26')](_0x3f82ad)['then'](function(_0x4a1e90){return _0x4a1e90;});}return null;};}function removeEntity(_0x16a62c,_0x4805c4){return function(_0x453dcd){if(_0x453dcd){return _0x453dcd['destroy']()[_0xcd94('0x27')](function(){_0x16a62c[_0xcd94('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c597c,_0x3181f2){return function(_0x596e55){if(!_0x596e55){_0x1c597c[_0xcd94('0x28')](0x194);}return _0x596e55;};}function handleError(_0x15764c,_0x5196c6){_0x5196c6=_0x5196c6||0x1f4;return function(_0x3bd176){logger['error'](_0x3bd176[_0xcd94('0x29')]);if(_0x3bd176[_0xcd94('0x2a')]){delete _0x3bd176[_0xcd94('0x2a')];}_0x15764c[_0xcd94('0x1c')](_0x5196c6)[_0xcd94('0x2b')](_0x3bd176);};}exports[_0xcd94('0x2c')]=function(_0x115e77,_0x3f646b){var _0x6d2169={},_0x15a039={},_0x29b225={'count':0x0,'rows':[]};var _0x592c75=_['map'](db[_0xcd94('0x2d')][_0xcd94('0x2e')],function(_0x3bffe0){return{'name':_0x3bffe0[_0xcd94('0x2f')],'type':_0x3bffe0[_0xcd94('0x30')][_0xcd94('0x31')]};});_0x15a039[_0xcd94('0x32')]=_[_0xcd94('0x33')](_0x592c75,'name');_0x15a039[_0xcd94('0x34')]=_[_0xcd94('0x35')](_0x115e77[_0xcd94('0x34')]);_0x15a039[_0xcd94('0x36')]=_[_0xcd94('0x37')](_0x15a039[_0xcd94('0x32')],_0x15a039[_0xcd94('0x34')]);_0x6d2169[_0xcd94('0x38')]=_[_0xcd94('0x37')](_0x15a039[_0xcd94('0x32')],qs[_0xcd94('0x39')](_0x115e77[_0xcd94('0x34')][_0xcd94('0x39')]));_0x6d2169[_0xcd94('0x38')]=_0x6d2169[_0xcd94('0x38')][_0xcd94('0x3a')]?_0x6d2169[_0xcd94('0x38')]:_0x15a039[_0xcd94('0x32')];if(!_0x115e77[_0xcd94('0x34')][_0xcd94('0x3b')](_0xcd94('0x3c'))){_0x6d2169[_0xcd94('0x20')]=qs[_0xcd94('0x20')](_0x115e77['query'][_0xcd94('0x20')]);_0x6d2169[_0xcd94('0x1f')]=qs['offset'](_0x115e77[_0xcd94('0x34')][_0xcd94('0x1f')]);}_0x6d2169['order']=qs[_0xcd94('0x3d')](_0x115e77[_0xcd94('0x34')][_0xcd94('0x3d')]);_0x6d2169[_0xcd94('0x3e')]=qs['filters'](_[_0xcd94('0x3f')](_0x115e77['query'],_0x15a039[_0xcd94('0x36')]),_0x592c75);if(_0x115e77['query']['filter']){_0x6d2169[_0xcd94('0x3e')]=_[_0xcd94('0x40')](_0x6d2169[_0xcd94('0x3e')],{'$or':_[_0xcd94('0x33')](_0x592c75,function(_0x21e728){if(_0x21e728['type']!==_0xcd94('0x41')){var _0x23cbc5={};_0x23cbc5[_0x21e728[_0xcd94('0x2a')]]={'$like':'%'+_0x115e77['query'][_0xcd94('0x42')]+'%'};return _0x23cbc5;}})});}_0x6d2169=_[_0xcd94('0x40')]({},_0x6d2169,_0x115e77[_0xcd94('0x43')]);var _0x14fc5c={'where':_0x6d2169[_0xcd94('0x3e')]};return db[_0xcd94('0x2d')][_0xcd94('0x1e')](_0x14fc5c)['then'](function(_0xac4bba){_0x29b225['count']=_0xac4bba;if(_0x115e77['query'][_0xcd94('0x44')]){_0x6d2169[_0xcd94('0x45')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xcd94('0x46')](_0x6d2169);})[_0xcd94('0x27')](function(_0x915926){_0x29b225[_0xcd94('0x47')]=_0x915926;return _0x29b225;})['then'](respondWithFilteredResult(_0x3f646b,_0x6d2169))['catch'](handleError(_0x3f646b,null));};exports['show']=function(_0x1e0652,_0xc25222){var _0x407fbd={'raw':!![],'where':{'id':_0x1e0652[_0xcd94('0x48')]['id']}},_0xa994d7={};_0xa994d7[_0xcd94('0x32')]=_['keys'](db[_0xcd94('0x2d')][_0xcd94('0x2e')]);_0xa994d7['query']=_[_0xcd94('0x35')](_0x1e0652[_0xcd94('0x34')]);_0xa994d7[_0xcd94('0x36')]=_[_0xcd94('0x37')](_0xa994d7['model'],_0xa994d7[_0xcd94('0x34')]);_0x407fbd[_0xcd94('0x38')]=_[_0xcd94('0x37')](_0xa994d7[_0xcd94('0x32')],qs['fields'](_0x1e0652[_0xcd94('0x34')]['fields']));_0x407fbd[_0xcd94('0x38')]=_0x407fbd['attributes'][_0xcd94('0x3a')]?_0x407fbd[_0xcd94('0x38')]:_0xa994d7[_0xcd94('0x32')];if(_0x1e0652[_0xcd94('0x34')][_0xcd94('0x44')]){_0x407fbd[_0xcd94('0x45')]=[{'all':!![]}];}_0x407fbd=_['merge']({},_0x407fbd,_0x1e0652[_0xcd94('0x43')]);return db['SmsQueueReport'][_0xcd94('0x49')](_0x407fbd)[_0xcd94('0x27')](handleEntityNotFound(_0xc25222,null))[_0xcd94('0x27')](respondWithResult(_0xc25222,null))[_0xcd94('0x4a')](handleError(_0xc25222,null));};exports[_0xcd94('0x4b')]=function(_0x4b20ff,_0x33286b){return db[_0xcd94('0x2d')][_0xcd94('0x4b')](_0x4b20ff['body'],{})[_0xcd94('0x27')](respondWithResult(_0x33286b,0xc9))['catch'](handleError(_0x33286b,null));};exports['update']=function(_0x48022f,_0x47821e){if(_0x48022f['body']['id']){delete _0x48022f['body']['id'];}return db[_0xcd94('0x2d')][_0xcd94('0x49')]({'where':{'id':_0x48022f[_0xcd94('0x48')]['id']}})[_0xcd94('0x27')](handleEntityNotFound(_0x47821e,null))['then'](saveUpdates(_0x48022f['body'],null))[_0xcd94('0x27')](respondWithResult(_0x47821e,null))[_0xcd94('0x4a')](handleError(_0x47821e,null));};exports[_0xcd94('0x4c')]=function(_0x5bbbbc,_0x2fe548){return db['SmsQueueReport'][_0xcd94('0x49')]({'where':{'id':_0x5bbbbc[_0xcd94('0x48')]['id']}})['then'](handleEntityNotFound(_0x2fe548,null))[_0xcd94('0x27')](removeEntity(_0x2fe548,null))[_0xcd94('0x4a')](handleError(_0x2fe548,null));};exports[_0xcd94('0x4d')]=function(_0x687548,_0x5f3e57){return db['SmsQueueReport'][_0xcd94('0x4d')]()[_0xcd94('0x27')](respondWithResult(_0x5f3e57,null))[_0xcd94('0x4a')](handleError(_0x5f3e57,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index ce8cd2b..0d5574f 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 _0xcc19=['path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xcc19,0xbd));var _0x9cc1=function(_0x545433,_0xe238b6){_0x545433=_0x545433-0x0;var _0x1d7243=_0xcc19[_0x545433];return _0x1d7243;};'use strict';var _=require(_0x9cc1('0x0'));var util=require(_0x9cc1('0x1'));var logger=require('../../config/logger')(_0x9cc1('0x2'));var moment=require(_0x9cc1('0x3'));var BPromise=require(_0x9cc1('0x4'));var rp=require(_0x9cc1('0x5'));var fs=require('fs');var path=require(_0x9cc1('0x6'));var rimraf=require(_0x9cc1('0x7'));var config=require(_0x9cc1('0x8'));var attributes=require(_0x9cc1('0x9'));module[_0x9cc1('0xa')]=function(_0x516f91,_0x4cd57e){return _0x516f91[_0x9cc1('0xb')](_0x9cc1('0xc'),attributes,{'tableName':_0x9cc1('0xd'),'paranoid':![],'indexes':[{'name':_0x9cc1('0xe'),'fields':[_0x9cc1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa1bb=['uniqueid','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','report_sms_queue'];(function(_0x384b64,_0x4f0784){var _0x3a8f2c=function(_0xc28196){while(--_0xc28196){_0x384b64['push'](_0x384b64['shift']());}};_0x3a8f2c(++_0x4f0784);}(_0xa1bb,0x9b));var _0xba1b=function(_0x23268d,_0x39b074){_0x23268d=_0x23268d-0x0;var _0x13fa18=_0xa1bb[_0x23268d];return _0x13fa18;};'use strict';var _=require(_0xba1b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xba1b('0x1'));var moment=require(_0xba1b('0x2'));var BPromise=require(_0xba1b('0x3'));var rp=require(_0xba1b('0x4'));var fs=require('fs');var path=require(_0xba1b('0x5'));var rimraf=require(_0xba1b('0x6'));var config=require(_0xba1b('0x7'));var attributes=require(_0xba1b('0x8'));module['exports']=function(_0x57ece2,_0x44dab7){return _0x57ece2['define']('SmsQueueReport',attributes,{'tableName':_0xba1b('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xba1b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index a118288..f93b435 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 _0xbc11=['debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSmsQueueReport','create','options','raw','UpdateSmsQueueReport','SmsQueueReport','update','body','where','limit','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x6c229d,_0x4bea12){var _0x1fead4=function(_0x5958b2){while(--_0x5958b2){_0x6c229d['push'](_0x6c229d['shift']());}};_0x1fead4(++_0x4bea12);}(_0xbc11,0x9e));var _0x1bc1=function(_0x4c4c84,_0x5bc088){_0x4c4c84=_0x4c4c84-0x0;var _0x4984b0=_0xbc11[_0x4c4c84];return _0x4984b0;};'use strict';var _=require(_0x1bc1('0x0'));var util=require(_0x1bc1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1bc1('0x2'));var fs=require('fs');var Redis=require(_0x1bc1('0x3'));var db=require(_0x1bc1('0x4'))['db'];var utils=require(_0x1bc1('0x5'));var logger=require(_0x1bc1('0x6'))(_0x1bc1('0x7'));var config=require(_0x1bc1('0x8'));var jayson=require(_0x1bc1('0x9'));var client=jayson[_0x1bc1('0xa')][_0x1bc1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44f16a,_0x1f62ec,_0x33a7b8){return new BPromise(function(_0x5f5407,_0x221cdf){return client[_0x1bc1('0xc')](_0x44f16a,_0x33a7b8)[_0x1bc1('0xd')](function(_0x82ea8b){logger[_0x1bc1('0xe')](_0x1bc1('0xf'),_0x1f62ec,_0x1bc1('0x10'));logger[_0x1bc1('0x11')](_0x1bc1('0x12'),_0x1f62ec,_0x1bc1('0x10'),JSON[_0x1bc1('0x13')](_0x82ea8b));if(_0x82ea8b['error']){if(_0x82ea8b[_0x1bc1('0x14')][_0x1bc1('0x15')]===0x1f4){logger['error'](_0x1bc1('0xf'),_0x1f62ec,_0x82ea8b['error'][_0x1bc1('0x16')]);return _0x221cdf(_0x82ea8b[_0x1bc1('0x14')][_0x1bc1('0x16')]);}logger[_0x1bc1('0x14')](_0x1bc1('0xf'),_0x1f62ec,_0x82ea8b[_0x1bc1('0x14')]['message']);return _0x5f5407(_0x82ea8b[_0x1bc1('0x14')][_0x1bc1('0x16')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x1f62ec,_0x1bc1('0x10'));_0x5f5407(_0x82ea8b[_0x1bc1('0x17')][_0x1bc1('0x16')]);}})['catch'](function(_0x1f1b84){logger['error'](_0x1bc1('0xf'),_0x1f62ec,_0x1f1b84);_0x221cdf(_0x1f1b84);});});}exports[_0x1bc1('0x18')]=function(_0x227969){var _0x3a8edc=this;return new Promise(function(_0x2a864e,_0xf847de){return db['SmsQueueReport'][_0x1bc1('0x19')](_0x227969['body'],{'raw':_0x227969[_0x1bc1('0x1a')]?_0x227969['options'][_0x1bc1('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4c45df){logger[_0x1bc1('0xe')](_0x1bc1('0x18'),_0x227969);logger[_0x1bc1('0x11')]('CreateSmsQueueReport',_0x227969,JSON[_0x1bc1('0x13')](_0x4c45df));_0x2a864e(_0x4c45df);})['catch'](function(_0x1ea0c9){logger[_0x1bc1('0x14')]('CreateSmsQueueReport',_0x1ea0c9[_0x1bc1('0x16')],_0x227969);_0xf847de(_0x3a8edc[_0x1bc1('0x14')](0x1f4,_0x1ea0c9[_0x1bc1('0x16')]));});});};exports[_0x1bc1('0x1c')]=function(_0x14244d){var _0x209538=this;return new Promise(function(_0x2fec4d,_0x438717){return db[_0x1bc1('0x1d')][_0x1bc1('0x1e')](_0x14244d[_0x1bc1('0x1f')],{'raw':_0x14244d[_0x1bc1('0x1a')]?_0x14244d[_0x1bc1('0x1a')][_0x1bc1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14244d[_0x1bc1('0x1a')]?_0x14244d[_0x1bc1('0x1a')][_0x1bc1('0x20')]||null:null,'attributes':_0x14244d[_0x1bc1('0x1a')]?_0x14244d['options']['attributes']||null:null,'limit':_0x14244d[_0x1bc1('0x1a')]?_0x14244d[_0x1bc1('0x1a')][_0x1bc1('0x21')]||null:null})[_0x1bc1('0xd')](function(_0x46daf8){logger[_0x1bc1('0xe')]('UpdateSmsQueueReport',_0x14244d);logger[_0x1bc1('0x11')](_0x1bc1('0x1c'),_0x14244d,JSON[_0x1bc1('0x13')](_0x46daf8));_0x2fec4d(_0x46daf8);})[_0x1bc1('0x22')](function(_0x2fb85e){logger[_0x1bc1('0x14')](_0x1bc1('0x1c'),_0x2fb85e['message'],_0x14244d);_0x438717(_0x209538[_0x1bc1('0x14')](0x1f4,_0x2fb85e['message']));});});}; \ No newline at end of file +var _0x55dd=['CreateSmsQueueReport','UpdateSmsQueueReport','SmsQueueReport','update','where','limit','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','create','body','options','raw','info'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x55dd,0x15b));var _0xd55d=function(_0x1fb1c1,_0x4ebe69){_0x1fb1c1=_0x1fb1c1-0x0;var _0x1622df=_0x55dd[_0x1fb1c1];return _0x1622df;};'use strict';var _=require(_0xd55d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd55d('0x1'));var fs=require('fs');var Redis=require(_0xd55d('0x2'));var db=require(_0xd55d('0x3'))['db'];var utils=require(_0xd55d('0x4'));var logger=require(_0xd55d('0x5'))('rpc');var config=require(_0xd55d('0x6'));var jayson=require(_0xd55d('0x7'));var client=jayson[_0xd55d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf29bb7,_0x148227,_0x339c14){return new BPromise(function(_0x376edd,_0x3b78a0){return client[_0xd55d('0x9')](_0xf29bb7,_0x339c14)[_0xd55d('0xa')](function(_0x4d9799){logger['info'](_0xd55d('0xb'),_0x148227,_0xd55d('0xc'));logger[_0xd55d('0xd')](_0xd55d('0xe'),_0x148227,'request\x20sent',JSON[_0xd55d('0xf')](_0x4d9799));if(_0x4d9799[_0xd55d('0x10')]){if(_0x4d9799['error']['code']===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x148227,_0x4d9799['error'][_0xd55d('0x11')]);return _0x3b78a0(_0x4d9799['error'][_0xd55d('0x11')]);}logger[_0xd55d('0x10')](_0xd55d('0xb'),_0x148227,_0x4d9799['error'][_0xd55d('0x11')]);return _0x376edd(_0x4d9799[_0xd55d('0x10')]['message']);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x148227,_0xd55d('0xc'));_0x376edd(_0x4d9799[_0xd55d('0x12')][_0xd55d('0x11')]);}})[_0xd55d('0x13')](function(_0x4b946b){logger[_0xd55d('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x148227,_0x4b946b);_0x3b78a0(_0x4b946b);});});}exports['CreateSmsQueueReport']=function(_0x366770){var _0x20fd03=this;return new Promise(function(_0x108201,_0x13c604){return db['SmsQueueReport'][_0xd55d('0x14')](_0x366770[_0xd55d('0x15')],{'raw':_0x366770[_0xd55d('0x16')]?_0x366770['options'][_0xd55d('0x17')]===undefined?!![]:![]:!![]})[_0xd55d('0xa')](function(_0x511083){logger[_0xd55d('0x18')](_0xd55d('0x19'),_0x366770);logger[_0xd55d('0xd')]('CreateSmsQueueReport',_0x366770,JSON[_0xd55d('0xf')](_0x511083));_0x108201(_0x511083);})[_0xd55d('0x13')](function(_0x30603c){logger['error'](_0xd55d('0x19'),_0x30603c[_0xd55d('0x11')],_0x366770);_0x13c604(_0x20fd03['error'](0x1f4,_0x30603c['message']));});});};exports[_0xd55d('0x1a')]=function(_0x168c9b){var _0x5d1c2e=this;return new Promise(function(_0x2b8f4a,_0x400beb){return db[_0xd55d('0x1b')][_0xd55d('0x1c')](_0x168c9b[_0xd55d('0x15')],{'raw':_0x168c9b['options']?_0x168c9b[_0xd55d('0x16')][_0xd55d('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x168c9b['options']?_0x168c9b[_0xd55d('0x16')][_0xd55d('0x1d')]||null:null,'attributes':_0x168c9b['options']?_0x168c9b['options']['attributes']||null:null,'limit':_0x168c9b['options']?_0x168c9b[_0xd55d('0x16')][_0xd55d('0x1e')]||null:null})[_0xd55d('0xa')](function(_0x3413ff){logger['info'](_0xd55d('0x1a'),_0x168c9b);logger[_0xd55d('0xd')](_0xd55d('0x1a'),_0x168c9b,JSON[_0xd55d('0xf')](_0x3413ff));_0x2b8f4a(_0x3413ff);})[_0xd55d('0x13')](function(_0xae22f3){logger[_0xd55d('0x10')](_0xd55d('0x1a'),_0xae22f3['message'],_0x168c9b);_0x400beb(_0x5d1c2e[_0xd55d('0x10')](0x1f4,_0xae22f3[_0xd55d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 1dd1297..04fc90e 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 _0x54cc=['connect-timeout','express','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x3a1e42,_0xb37717){var _0x1b29d5=function(_0x2ede9c){while(--_0x2ede9c){_0x3a1e42['push'](_0x3a1e42['shift']());}};_0x1b29d5(++_0xb37717);}(_0x54cc,0xd6));var _0xc54c=function(_0x40ff60,_0x41e7bb){_0x40ff60=_0x40ff60-0x0;var _0x7a5b02=_0x54cc[_0x40ff60];return _0x7a5b02;};'use strict';var multer=require(_0xc54c('0x0'));var util=require(_0xc54c('0x1'));var path=require('path');var timeout=require(_0xc54c('0x2'));var express=require(_0xc54c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc54c('0x4'));var config=require(_0xc54c('0x5'));var controller=require(_0xc54c('0x6'));router[_0xc54c('0x7')]('/',auth[_0xc54c('0x8')](),controller['index']);router[_0xc54c('0x7')](_0xc54c('0x9'),auth[_0xc54c('0x8')](),controller['describe']);router[_0xc54c('0x7')](_0xc54c('0xa'),auth[_0xc54c('0x8')](),controller[_0xc54c('0xb')]);router[_0xc54c('0xc')]('/',auth[_0xc54c('0x8')](),controller[_0xc54c('0xd')]);router[_0xc54c('0xe')](_0xc54c('0xa'),auth['isAuthenticated'](),controller[_0xc54c('0xf')]);router[_0xc54c('0x10')](_0xc54c('0xa'),auth[_0xc54c('0x8')](),controller[_0xc54c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x662d=['show','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0xfd34d7,_0x5eba9a){var _0x39232d=function(_0x331b9b){while(--_0x331b9b){_0xfd34d7['push'](_0xfd34d7['shift']());}};_0x39232d(++_0x5eba9a);}(_0x662d,0x1a6));var _0xd662=function(_0x336642,_0x322685){_0x336642=_0x336642-0x0;var _0x4fa0d4=_0x662d[_0x336642];return _0x4fa0d4;};'use strict';var multer=require(_0xd662('0x0'));var util=require('util');var path=require(_0xd662('0x1'));var timeout=require(_0xd662('0x2'));var express=require(_0xd662('0x3'));var router=express[_0xd662('0x4')]();var fs_extra=require(_0xd662('0x5'));var auth=require(_0xd662('0x6'));var interaction=require(_0xd662('0x7'));var config=require(_0xd662('0x8'));var controller=require(_0xd662('0x9'));router[_0xd662('0xa')]('/',auth['isAuthenticated'](),controller[_0xd662('0xb')]);router[_0xd662('0xa')](_0xd662('0xc'),auth[_0xd662('0xd')](),controller[_0xd662('0xe')]);router[_0xd662('0xa')]('/:id',auth[_0xd662('0xd')](),controller[_0xd662('0xf')]);router[_0xd662('0x10')]('/',auth[_0xd662('0xd')](),controller[_0xd662('0x11')]);router[_0xd662('0x12')](_0xd662('0x13'),auth[_0xd662('0xd')](),controller[_0xd662('0x14')]);router[_0xd662('0x15')]('/:id',auth[_0xd662('0xd')](),controller['destroy']);module[_0xd662('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index fede0ac..536ed2f 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 _0xeb64=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING','ENUM'];(function(_0x1ad754,_0x336a0b){var _0x255a9c=function(_0x404c62){while(--_0x404c62){_0x1ad754['push'](_0x1ad754['shift']());}};_0x255a9c(++_0x336a0b);}(_0xeb64,0x19f));var _0x4eb6=function(_0x173b4e,_0x23e00e){_0x173b4e=_0x173b4e-0x0;var _0x24ca2f=_0xeb64[_0x173b4e];return _0x24ca2f;};'use strict';var moment=require(_0x4eb6('0x0'));var Sequelize=require(_0x4eb6('0x1'));module[_0x4eb6('0x2')]={'uniqueid':{'type':Sequelize[_0x4eb6('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x4eb6('0x4')](_0x4eb6('0x5'),_0x4eb6('0x6'),_0x4eb6('0x7')),'allowNull':![],'defaultValue':_0x4eb6('0x7')},'transferredAt':{'type':Sequelize[_0x4eb6('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x4eb6('0x9')]}}; \ No newline at end of file +var _0x169d=['sequelize','STRING','account','agent','queue','DATE','NOW','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x169d,0xe7));var _0xd169=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x169d[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xd169('0x0'));var Sequelize=require(_0xd169('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xd169('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xd169('0x3'),_0xd169('0x4'),_0xd169('0x5')),'allowNull':![],'defaultValue':_0xd169('0x5')},'transferredAt':{'type':Sequelize[_0xd169('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xd169('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 9868f2b..15420f3 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 _0x19e1=['mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','filter','options','SmsTransferReport','findAll','then','rows','catch','show','params','includeAll','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x19e1,0x163));var _0x119e=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0x19e1[_0x56fe98];return _0x212f4f;};'use strict';var emlformat=require(_0x119e('0x0'));var rimraf=require(_0x119e('0x1'));var zipdir=require(_0x119e('0x2'));var jsonpatch=require(_0x119e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x119e('0x4'));var Mustache=require(_0x119e('0x5'));var util=require('util');var path=require(_0x119e('0x6'));var sox=require(_0x119e('0x7'));var csv=require('to-csv');var ejs=require(_0x119e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x119e('0x9'));var squel=require(_0x119e('0xa'));var crypto=require(_0x119e('0xb'));var jsforce=require(_0x119e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x119e('0xd'));var querystring=require(_0x119e('0xe'));var Papa=require(_0x119e('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x119e('0x10'));var as=require(_0x119e('0x11'));var hardwareService=require(_0x119e('0x12'));var logger=require(_0x119e('0x13'))(_0x119e('0x14'));var utils=require(_0x119e('0x15'));var config=require(_0x119e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x119e('0x17'))['db'];function respondWithStatusCode(_0x62d949,_0x1b0482){_0x1b0482=_0x1b0482||0xcc;return function(_0x2fee8b){if(_0x2fee8b){return _0x62d949[_0x119e('0x18')](_0x1b0482);}return _0x62d949[_0x119e('0x19')](_0x1b0482)['end']();};}function respondWithResult(_0x1d46eb,_0x8a9fad){_0x8a9fad=_0x8a9fad||0xc8;return function(_0x1c6fd5){if(_0x1c6fd5){return _0x1d46eb[_0x119e('0x19')](_0x8a9fad)[_0x119e('0x1a')](_0x1c6fd5);}};}function respondWithFilteredResult(_0x3bac54,_0x285148){return function(_0x791000){if(_0x791000){var _0x2c5902=_0x791000[_0x119e('0x1b')],_0x42acfd=_0x285148[_0x119e('0x1c')],_0x41f329=_0x285148[_0x119e('0x1c')]+_0x285148[_0x119e('0x1d')],_0x54c326;if(_0x41f329>=_0x2c5902){_0x41f329=_0x2c5902;_0x54c326=0xc8;}else{_0x54c326=0xce;}_0x3bac54[_0x119e('0x19')](_0x54c326);return _0x3bac54[_0x119e('0x1e')](_0x119e('0x1f'),_0x42acfd+'-'+_0x41f329+'/'+_0x2c5902)[_0x119e('0x1a')](_0x791000);}return null;};}function patchUpdates(_0x40528a){return function(_0x2e0096){try{jsonpatch[_0x119e('0x20')](_0x2e0096,_0x40528a,!![]);}catch(_0x485004){return BPromise[_0x119e('0x21')](_0x485004);}return _0x2e0096['save']();};}function saveUpdates(_0xd4c2d5,_0x523a8d){return function(_0x3cb1bb){if(_0x3cb1bb){return _0x3cb1bb[_0x119e('0x22')](_0xd4c2d5)['then'](function(_0x4d41f0){return _0x4d41f0;});}return null;};}function removeEntity(_0x1ee79b,_0x29de19){return function(_0x37b07e){if(_0x37b07e){return _0x37b07e['destroy']()['then'](function(){_0x1ee79b[_0x119e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a8a24,_0x21fb19){return function(_0x198f7b){if(!_0x198f7b){_0x1a8a24['sendStatus'](0x194);}return _0x198f7b;};}function handleError(_0x1e4c98,_0x59fc43){_0x59fc43=_0x59fc43||0x1f4;return function(_0x1e2dd8){logger['error'](_0x1e2dd8['stack']);if(_0x1e2dd8[_0x119e('0x23')]){delete _0x1e2dd8[_0x119e('0x23')];}_0x1e4c98[_0x119e('0x19')](_0x59fc43)[_0x119e('0x24')](_0x1e2dd8);};}exports[_0x119e('0x25')]=function(_0x3a9588,_0x47af82){var _0xc23289={},_0x1b2aea={},_0x58aa83={'count':0x0,'rows':[]};var _0x3ba6ee=_[_0x119e('0x26')](db['SmsTransferReport'][_0x119e('0x27')],function(_0x513843){return{'name':_0x513843[_0x119e('0x28')],'type':_0x513843[_0x119e('0x29')][_0x119e('0x2a')]};});_0x1b2aea[_0x119e('0x2b')]=_[_0x119e('0x26')](_0x3ba6ee,'name');_0x1b2aea[_0x119e('0x2c')]=_[_0x119e('0x2d')](_0x3a9588[_0x119e('0x2c')]);_0x1b2aea[_0x119e('0x2e')]=_[_0x119e('0x2f')](_0x1b2aea[_0x119e('0x2b')],_0x1b2aea['query']);_0xc23289['attributes']=_['intersection'](_0x1b2aea['model'],qs[_0x119e('0x30')](_0x3a9588[_0x119e('0x2c')]['fields']));_0xc23289['attributes']=_0xc23289[_0x119e('0x31')][_0x119e('0x32')]?_0xc23289['attributes']:_0x1b2aea[_0x119e('0x2b')];if(!_0x3a9588[_0x119e('0x2c')]['hasOwnProperty'](_0x119e('0x33'))){_0xc23289[_0x119e('0x1d')]=qs[_0x119e('0x1d')](_0x3a9588[_0x119e('0x2c')][_0x119e('0x1d')]);_0xc23289[_0x119e('0x1c')]=qs[_0x119e('0x1c')](_0x3a9588[_0x119e('0x2c')][_0x119e('0x1c')]);}_0xc23289[_0x119e('0x34')]=qs[_0x119e('0x35')](_0x3a9588[_0x119e('0x2c')][_0x119e('0x35')]);_0xc23289[_0x119e('0x36')]=qs[_0x119e('0x2e')](_['pick'](_0x3a9588[_0x119e('0x2c')],_0x1b2aea[_0x119e('0x2e')]),_0x3ba6ee);if(_0x3a9588[_0x119e('0x2c')]['filter']){_0xc23289[_0x119e('0x36')]=_[_0x119e('0x37')](_0xc23289[_0x119e('0x36')],{'$or':_[_0x119e('0x26')](_0x3ba6ee,function(_0x20c2bd){if(_0x20c2bd['type']!=='VIRTUAL'){var _0x32ba2f={};_0x32ba2f[_0x20c2bd[_0x119e('0x23')]]={'$like':'%'+_0x3a9588[_0x119e('0x2c')][_0x119e('0x38')]+'%'};return _0x32ba2f;}})});}_0xc23289=_[_0x119e('0x37')]({},_0xc23289,_0x3a9588[_0x119e('0x39')]);var _0x42f0eb={'where':_0xc23289['where']};return db['SmsTransferReport'][_0x119e('0x1b')](_0x42f0eb)['then'](function(_0x57844b){_0x58aa83[_0x119e('0x1b')]=_0x57844b;if(_0x3a9588['query']['includeAll']){_0xc23289['include']=[{'all':!![]}];}return db[_0x119e('0x3a')][_0x119e('0x3b')](_0xc23289);})[_0x119e('0x3c')](function(_0x39f10b){_0x58aa83[_0x119e('0x3d')]=_0x39f10b;return _0x58aa83;})[_0x119e('0x3c')](respondWithFilteredResult(_0x47af82,_0xc23289))[_0x119e('0x3e')](handleError(_0x47af82,null));};exports[_0x119e('0x3f')]=function(_0x132b86,_0x1de95d){var _0x3d25a8={'raw':!![],'where':{'id':_0x132b86[_0x119e('0x40')]['id']}},_0x276d82={};_0x276d82[_0x119e('0x2b')]=_['keys'](db[_0x119e('0x3a')][_0x119e('0x27')]);_0x276d82[_0x119e('0x2c')]=_[_0x119e('0x2d')](_0x132b86[_0x119e('0x2c')]);_0x276d82[_0x119e('0x2e')]=_['intersection'](_0x276d82[_0x119e('0x2b')],_0x276d82['query']);_0x3d25a8[_0x119e('0x31')]=_[_0x119e('0x2f')](_0x276d82[_0x119e('0x2b')],qs[_0x119e('0x30')](_0x132b86[_0x119e('0x2c')][_0x119e('0x30')]));_0x3d25a8[_0x119e('0x31')]=_0x3d25a8['attributes']['length']?_0x3d25a8[_0x119e('0x31')]:_0x276d82[_0x119e('0x2b')];if(_0x132b86[_0x119e('0x2c')][_0x119e('0x41')]){_0x3d25a8[_0x119e('0x42')]=[{'all':!![]}];}_0x3d25a8=_[_0x119e('0x37')]({},_0x3d25a8,_0x132b86[_0x119e('0x39')]);return db[_0x119e('0x3a')][_0x119e('0x43')](_0x3d25a8)[_0x119e('0x3c')](handleEntityNotFound(_0x1de95d,null))[_0x119e('0x3c')](respondWithResult(_0x1de95d,null))[_0x119e('0x3e')](handleError(_0x1de95d,null));};exports[_0x119e('0x44')]=function(_0x265c15,_0x54246a){return db[_0x119e('0x3a')][_0x119e('0x44')](_0x265c15['body'],{})[_0x119e('0x3c')](respondWithResult(_0x54246a,0xc9))['catch'](handleError(_0x54246a,null));};exports[_0x119e('0x22')]=function(_0x103a7d,_0x10d862){if(_0x103a7d['body']['id']){delete _0x103a7d[_0x119e('0x45')]['id'];}return db[_0x119e('0x3a')]['find']({'where':{'id':_0x103a7d[_0x119e('0x40')]['id']}})[_0x119e('0x3c')](handleEntityNotFound(_0x10d862,null))[_0x119e('0x3c')](saveUpdates(_0x103a7d['body'],null))['then'](respondWithResult(_0x10d862,null))['catch'](handleError(_0x10d862,null));};exports[_0x119e('0x46')]=function(_0x2c1eb1,_0x4ef35a){return db[_0x119e('0x3a')]['find']({'where':{'id':_0x2c1eb1[_0x119e('0x40')]['id']}})['then'](handleEntityNotFound(_0x4ef35a,null))[_0x119e('0x3c')](removeEntity(_0x4ef35a,null))[_0x119e('0x3e')](handleError(_0x4ef35a,null));};exports['describe']=function(_0x49309e,_0x4caed1){return db[_0x119e('0x3a')][_0x119e('0x47')]()[_0x119e('0x3c')](respondWithResult(_0x4caed1,null))[_0x119e('0x3e')](handleError(_0x4caed1,null));}; \ No newline at end of file +var _0xfe39=['bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SmsTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','rawAttributes','find','create','body','catch','describe','eml-format','rimraf','fast-json-patch'];(function(_0x4c13cd,_0x690896){var _0x28d939=function(_0x3f3c62){while(--_0x3f3c62){_0x4c13cd['push'](_0x4c13cd['shift']());}};_0x28d939(++_0x690896);}(_0xfe39,0x1b3));var _0x9fe3=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xfe39[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require(_0x9fe3('0x0'));var rimraf=require(_0x9fe3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9fe3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9fe3('0x3'));var Mustache=require(_0x9fe3('0x4'));var util=require('util');var path=require('path');var sox=require(_0x9fe3('0x5'));var csv=require(_0x9fe3('0x6'));var ejs=require(_0x9fe3('0x7'));var fs=require('fs');var fs_extra=require(_0x9fe3('0x8'));var _=require(_0x9fe3('0x9'));var squel=require(_0x9fe3('0xa'));var crypto=require(_0x9fe3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9fe3('0xc'));var toCsv=require(_0x9fe3('0x6'));var querystring=require(_0x9fe3('0xd'));var Papa=require(_0x9fe3('0xe'));var Redis=require(_0x9fe3('0xf'));var authService=require(_0x9fe3('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9fe3('0x11'));var logger=require(_0x9fe3('0x12'))('api');var utils=require(_0x9fe3('0x13'));var config=require(_0x9fe3('0x14'));var licenseUtil=require(_0x9fe3('0x15'));var db=require(_0x9fe3('0x16'))['db'];function respondWithStatusCode(_0x51d1cb,_0x37bfef){_0x37bfef=_0x37bfef||0xcc;return function(_0x155013){if(_0x155013){return _0x51d1cb[_0x9fe3('0x17')](_0x37bfef);}return _0x51d1cb[_0x9fe3('0x18')](_0x37bfef)['end']();};}function respondWithResult(_0x4e4dcc,_0x329032){_0x329032=_0x329032||0xc8;return function(_0x31bbf3){if(_0x31bbf3){return _0x4e4dcc[_0x9fe3('0x18')](_0x329032)[_0x9fe3('0x19')](_0x31bbf3);}};}function respondWithFilteredResult(_0x1b2057,_0x5f5b58){return function(_0x5f0067){if(_0x5f0067){var _0x207eef=_0x5f0067['count'],_0x2a4567=_0x5f5b58[_0x9fe3('0x1a')],_0x1fe7bf=_0x5f5b58[_0x9fe3('0x1a')]+_0x5f5b58[_0x9fe3('0x1b')],_0x2d28d4;if(_0x1fe7bf>=_0x207eef){_0x1fe7bf=_0x207eef;_0x2d28d4=0xc8;}else{_0x2d28d4=0xce;}_0x1b2057['status'](_0x2d28d4);return _0x1b2057[_0x9fe3('0x1c')](_0x9fe3('0x1d'),_0x2a4567+'-'+_0x1fe7bf+'/'+_0x207eef)['json'](_0x5f0067);}return null;};}function patchUpdates(_0x7a1ed2){return function(_0x4f272c){try{jsonpatch[_0x9fe3('0x1e')](_0x4f272c,_0x7a1ed2,!![]);}catch(_0x509438){return BPromise[_0x9fe3('0x1f')](_0x509438);}return _0x4f272c[_0x9fe3('0x20')]();};}function saveUpdates(_0x302d5c,_0x5b53f3){return function(_0x546d06){if(_0x546d06){return _0x546d06[_0x9fe3('0x21')](_0x302d5c)[_0x9fe3('0x22')](function(_0x501df5){return _0x501df5;});}return null;};}function removeEntity(_0x328989,_0x2e9ae5){return function(_0x587e43){if(_0x587e43){return _0x587e43[_0x9fe3('0x23')]()[_0x9fe3('0x22')](function(){_0x328989['status'](0xcc)[_0x9fe3('0x24')]();});}};}function handleEntityNotFound(_0x2fb7a9,_0x3fd88e){return function(_0x3d80e9){if(!_0x3d80e9){_0x2fb7a9[_0x9fe3('0x17')](0x194);}return _0x3d80e9;};}function handleError(_0x1c4665,_0x3249d3){_0x3249d3=_0x3249d3||0x1f4;return function(_0x4c1a30){logger[_0x9fe3('0x25')](_0x4c1a30[_0x9fe3('0x26')]);if(_0x4c1a30[_0x9fe3('0x27')]){delete _0x4c1a30[_0x9fe3('0x27')];}_0x1c4665['status'](_0x3249d3)[_0x9fe3('0x28')](_0x4c1a30);};}exports[_0x9fe3('0x29')]=function(_0x25695a,_0x559cc1){var _0x14ee5b={},_0x8b85ea={},_0xd7447c={'count':0x0,'rows':[]};var _0x45086e=_[_0x9fe3('0x2a')](db[_0x9fe3('0x2b')]['rawAttributes'],function(_0xa4d56e){return{'name':_0xa4d56e[_0x9fe3('0x2c')],'type':_0xa4d56e[_0x9fe3('0x2d')][_0x9fe3('0x2e')]};});_0x8b85ea[_0x9fe3('0x2f')]=_[_0x9fe3('0x2a')](_0x45086e,'name');_0x8b85ea[_0x9fe3('0x30')]=_[_0x9fe3('0x31')](_0x25695a['query']);_0x8b85ea[_0x9fe3('0x32')]=_[_0x9fe3('0x33')](_0x8b85ea[_0x9fe3('0x2f')],_0x8b85ea[_0x9fe3('0x30')]);_0x14ee5b[_0x9fe3('0x34')]=_[_0x9fe3('0x33')](_0x8b85ea['model'],qs[_0x9fe3('0x35')](_0x25695a[_0x9fe3('0x30')][_0x9fe3('0x35')]));_0x14ee5b['attributes']=_0x14ee5b['attributes']['length']?_0x14ee5b[_0x9fe3('0x34')]:_0x8b85ea['model'];if(!_0x25695a[_0x9fe3('0x30')][_0x9fe3('0x36')](_0x9fe3('0x37'))){_0x14ee5b[_0x9fe3('0x1b')]=qs[_0x9fe3('0x1b')](_0x25695a[_0x9fe3('0x30')][_0x9fe3('0x1b')]);_0x14ee5b[_0x9fe3('0x1a')]=qs[_0x9fe3('0x1a')](_0x25695a['query'][_0x9fe3('0x1a')]);}_0x14ee5b['order']=qs['sort'](_0x25695a[_0x9fe3('0x30')][_0x9fe3('0x38')]);_0x14ee5b[_0x9fe3('0x39')]=qs[_0x9fe3('0x32')](_['pick'](_0x25695a[_0x9fe3('0x30')],_0x8b85ea[_0x9fe3('0x32')]),_0x45086e);if(_0x25695a[_0x9fe3('0x30')]['filter']){_0x14ee5b[_0x9fe3('0x39')]=_[_0x9fe3('0x3a')](_0x14ee5b[_0x9fe3('0x39')],{'$or':_[_0x9fe3('0x2a')](_0x45086e,function(_0x52b828){if(_0x52b828[_0x9fe3('0x2d')]!==_0x9fe3('0x3b')){var _0x55ed55={};_0x55ed55[_0x52b828['name']]={'$like':'%'+_0x25695a[_0x9fe3('0x30')]['filter']+'%'};return _0x55ed55;}})});}_0x14ee5b=_[_0x9fe3('0x3a')]({},_0x14ee5b,_0x25695a[_0x9fe3('0x3c')]);var _0x294073={'where':_0x14ee5b[_0x9fe3('0x39')]};return db[_0x9fe3('0x2b')][_0x9fe3('0x3d')](_0x294073)[_0x9fe3('0x22')](function(_0x4c2f67){_0xd7447c['count']=_0x4c2f67;if(_0x25695a[_0x9fe3('0x30')][_0x9fe3('0x3e')]){_0x14ee5b[_0x9fe3('0x3f')]=[{'all':!![]}];}return db[_0x9fe3('0x2b')][_0x9fe3('0x40')](_0x14ee5b);})[_0x9fe3('0x22')](function(_0x154d98){_0xd7447c[_0x9fe3('0x41')]=_0x154d98;return _0xd7447c;})[_0x9fe3('0x22')](respondWithFilteredResult(_0x559cc1,_0x14ee5b))['catch'](handleError(_0x559cc1,null));};exports['show']=function(_0x5979fe,_0x4d96b8){var _0x299ce5={'raw':!![],'where':{'id':_0x5979fe[_0x9fe3('0x42')]['id']}},_0x3dbb5e={};_0x3dbb5e[_0x9fe3('0x2f')]=_[_0x9fe3('0x31')](db['SmsTransferReport'][_0x9fe3('0x43')]);_0x3dbb5e[_0x9fe3('0x30')]=_[_0x9fe3('0x31')](_0x5979fe['query']);_0x3dbb5e[_0x9fe3('0x32')]=_[_0x9fe3('0x33')](_0x3dbb5e[_0x9fe3('0x2f')],_0x3dbb5e['query']);_0x299ce5['attributes']=_['intersection'](_0x3dbb5e[_0x9fe3('0x2f')],qs['fields'](_0x5979fe[_0x9fe3('0x30')][_0x9fe3('0x35')]));_0x299ce5['attributes']=_0x299ce5['attributes']['length']?_0x299ce5['attributes']:_0x3dbb5e[_0x9fe3('0x2f')];if(_0x5979fe[_0x9fe3('0x30')][_0x9fe3('0x3e')]){_0x299ce5[_0x9fe3('0x3f')]=[{'all':!![]}];}_0x299ce5=_[_0x9fe3('0x3a')]({},_0x299ce5,_0x5979fe[_0x9fe3('0x3c')]);return db[_0x9fe3('0x2b')][_0x9fe3('0x44')](_0x299ce5)['then'](handleEntityNotFound(_0x4d96b8,null))['then'](respondWithResult(_0x4d96b8,null))['catch'](handleError(_0x4d96b8,null));};exports[_0x9fe3('0x45')]=function(_0x4b4d11,_0x3d4e16){return db[_0x9fe3('0x2b')][_0x9fe3('0x45')](_0x4b4d11[_0x9fe3('0x46')],{})[_0x9fe3('0x22')](respondWithResult(_0x3d4e16,0xc9))['catch'](handleError(_0x3d4e16,null));};exports[_0x9fe3('0x21')]=function(_0x20e713,_0xc0f9ad){if(_0x20e713[_0x9fe3('0x46')]['id']){delete _0x20e713[_0x9fe3('0x46')]['id'];}return db[_0x9fe3('0x2b')]['find']({'where':{'id':_0x20e713['params']['id']}})['then'](handleEntityNotFound(_0xc0f9ad,null))[_0x9fe3('0x22')](saveUpdates(_0x20e713['body'],null))[_0x9fe3('0x22')](respondWithResult(_0xc0f9ad,null))[_0x9fe3('0x47')](handleError(_0xc0f9ad,null));};exports[_0x9fe3('0x23')]=function(_0x413889,_0x18f3ad){return db[_0x9fe3('0x2b')]['find']({'where':{'id':_0x413889[_0x9fe3('0x42')]['id']}})['then'](handleEntityNotFound(_0x18f3ad,null))[_0x9fe3('0x22')](removeEntity(_0x18f3ad,null))[_0x9fe3('0x47')](handleError(_0x18f3ad,null));};exports['describe']=function(_0x2a4a7d,_0x5f2bb1){return db[_0x9fe3('0x2b')][_0x9fe3('0x48')]()[_0x9fe3('0x22')](respondWithResult(_0x5f2bb1,null))['catch'](handleError(_0x5f2bb1,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 872a5ac..a28bdc6 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 _0xd8fb=['exports','SmsTransferReport','uniqueid','lodash','util','../../config/logger','api','path','rimraf','./smsTransferReport.attributes'];(function(_0x4fb2e0,_0x5d0b8d){var _0xfe567d=function(_0x54c23b){while(--_0x54c23b){_0x4fb2e0['push'](_0x4fb2e0['shift']());}};_0xfe567d(++_0x5d0b8d);}(_0xd8fb,0x99));var _0xbd8f=function(_0x31e1c5,_0x3769c9){_0x31e1c5=_0x31e1c5-0x0;var _0x1e0141=_0xd8fb[_0x31e1c5];return _0x1e0141;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xbd8f('0x9'),'fields':[_0xbd8f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5d17=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define'];(function(_0x526b25,_0x23e438){var _0x451513=function(_0x2fdd89){while(--_0x2fdd89){_0x526b25['push'](_0x526b25['shift']());}};_0x451513(++_0x23e438);}(_0x5d17,0x114));var _0x75d1=function(_0x2da45d,_0x35397b){_0x2da45d=_0x2da45d-0x0;var _0x1012a0=_0x5d17[_0x2da45d];return _0x1012a0;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x75d1('0x2'));var BPromise=require(_0x75d1('0x3'));var rp=require(_0x75d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var attributes=require(_0x75d1('0x7'));module[_0x75d1('0x8')]=function(_0x56ac0a,_0x458681){return _0x56ac0a[_0x75d1('0x9')](_0x75d1('0xa'),attributes,{'tableName':_0x75d1('0xb'),'paranoid':![],'indexes':[{'name':_0x75d1('0xc'),'fields':[_0x75d1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 5ed6af1..47eebc0 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 _0x0e3a=['rpc','../../config/environment','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x67f95e,_0x3ca797){var _0x538f5a=function(_0xc919e9){while(--_0xc919e9){_0x67f95e['push'](_0x67f95e['shift']());}};_0x538f5a(++_0x3ca797);}(_0x0e3a,0x10d));var _0xa0e3=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0e3a[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0xa0e3('0x0'));var moment=require(_0xa0e3('0x1'));var BPromise=require('bluebird');var rs=require(_0xa0e3('0x2'));var fs=require('fs');var Redis=require(_0xa0e3('0x3'));var db=require(_0xa0e3('0x4'))['db'];var utils=require(_0xa0e3('0x5'));var logger=require(_0xa0e3('0x6'))(_0xa0e3('0x7'));var config=require(_0xa0e3('0x8'));var jayson=require(_0xa0e3('0x9'));var client=jayson[_0xa0e3('0xa')][_0xa0e3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5aa85d,_0x17c6ef,_0x4bde58){return new BPromise(function(_0x27e719,_0x29775a){return client[_0xa0e3('0xc')](_0x5aa85d,_0x4bde58)[_0xa0e3('0xd')](function(_0x291b6c){logger['info'](_0xa0e3('0xe'),_0x17c6ef,_0xa0e3('0xf'));logger['debug'](_0xa0e3('0x10'),_0x17c6ef,_0xa0e3('0xf'),JSON[_0xa0e3('0x11')](_0x291b6c));if(_0x291b6c[_0xa0e3('0x12')]){if(_0x291b6c[_0xa0e3('0x12')]['code']===0x1f4){logger[_0xa0e3('0x12')](_0xa0e3('0xe'),_0x17c6ef,_0x291b6c[_0xa0e3('0x12')][_0xa0e3('0x13')]);return _0x29775a(_0x291b6c[_0xa0e3('0x12')][_0xa0e3('0x13')]);}logger['error'](_0xa0e3('0xe'),_0x17c6ef,_0x291b6c[_0xa0e3('0x12')][_0xa0e3('0x13')]);return _0x27e719(_0x291b6c[_0xa0e3('0x12')][_0xa0e3('0x13')]);}else{logger[_0xa0e3('0x14')](_0xa0e3('0xe'),_0x17c6ef,_0xa0e3('0xf'));_0x27e719(_0x291b6c[_0xa0e3('0x15')][_0xa0e3('0x13')]);}})[_0xa0e3('0x16')](function(_0x2c9723){logger[_0xa0e3('0x12')](_0xa0e3('0xe'),_0x17c6ef,_0x2c9723);_0x29775a(_0x2c9723);});});} \ No newline at end of file +var _0x5394=['jayson/promise','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2673a4,_0x4d0b8d){var _0x5e3a6a=function(_0x59e268){while(--_0x59e268){_0x2673a4['push'](_0x2673a4['shift']());}};_0x5e3a6a(++_0x4d0b8d);}(_0x5394,0x16e));var _0x4539=function(_0x51a1e7,_0x54cc87){_0x51a1e7=_0x51a1e7-0x0;var _0x4980d2=_0x5394[_0x51a1e7];return _0x4980d2;};'use strict';var _=require(_0x4539('0x0'));var util=require(_0x4539('0x1'));var moment=require(_0x4539('0x2'));var BPromise=require(_0x4539('0x3'));var rs=require(_0x4539('0x4'));var fs=require('fs');var Redis=require(_0x4539('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4539('0x6'));var logger=require(_0x4539('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4539('0x8'));var client=jayson['client'][_0x4539('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fb622,_0x289be5,_0x1fa16a){return new BPromise(function(_0x1a0628,_0x233ddd){return client[_0x4539('0xa')](_0x2fb622,_0x1fa16a)['then'](function(_0x21b07b){logger[_0x4539('0xb')](_0x4539('0xc'),_0x289be5,_0x4539('0xd'));logger[_0x4539('0xe')](_0x4539('0xf'),_0x289be5,_0x4539('0xd'),JSON[_0x4539('0x10')](_0x21b07b));if(_0x21b07b[_0x4539('0x11')]){if(_0x21b07b[_0x4539('0x11')][_0x4539('0x12')]===0x1f4){logger[_0x4539('0x11')](_0x4539('0xc'),_0x289be5,_0x21b07b[_0x4539('0x11')]['message']);return _0x233ddd(_0x21b07b['error'][_0x4539('0x13')]);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x289be5,_0x21b07b[_0x4539('0x11')][_0x4539('0x13')]);return _0x1a0628(_0x21b07b[_0x4539('0x11')][_0x4539('0x13')]);}else{logger['info'](_0x4539('0xc'),_0x289be5,_0x4539('0xd'));_0x1a0628(_0x21b07b[_0x4539('0x14')][_0x4539('0x13')]);}})[_0x4539('0x15')](function(_0x3984a1){logger[_0x4539('0x11')](_0x4539('0xc'),_0x289be5,_0x3984a1);_0x233ddd(_0x3984a1);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index a189647..e7127c6 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 _0x5b17=['%s-%s%s','basename','extname','post','file','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','/:id/download','isAuthenticated','root','server/files/sounds/original/','originalname','format'];(function(_0xf1fcf8,_0x505b9b){var _0x4b2012=function(_0x640eea){while(--_0x640eea){_0xf1fcf8['push'](_0xf1fcf8['shift']());}};_0x4b2012(++_0x505b9b);}(_0x5b17,0x1a0));var _0x75b1=function(_0x4d9bff,_0x22233c){_0x4d9bff=_0x4d9bff-0x0;var _0x5eb0cf=_0x5b17[_0x4d9bff];return _0x5eb0cf;};'use strict';var multer=require(_0x75b1('0x0'));var util=require(_0x75b1('0x1'));var path=require(_0x75b1('0x2'));var timeout=require(_0x75b1('0x3'));var express=require(_0x75b1('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x75b1('0x5'));var interaction=require(_0x75b1('0x6'));var config=require(_0x75b1('0x7'));var controller=require('./sound.controller');router[_0x75b1('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x75b1('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x75b1('0x8')](_0x75b1('0xa'),auth[_0x75b1('0xb')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2b6515,_0x45bf6e,_0x1b4d10){_0x1b4d10(null,path['join'](config[_0x75b1('0xc')],_0x75b1('0xd')));},'filename':function(_0x228c50,_0x1e11d4,_0x7b20f7){_0x1e11d4[_0x75b1('0xe')]=_0x1e11d4[_0x75b1('0xe')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x7b20f7(null,util[_0x75b1('0xf')](_0x75b1('0x10'),path[_0x75b1('0x11')](_0x1e11d4['originalname'],path['extname'](_0x1e11d4[_0x75b1('0xe')])),Date['now'](),path[_0x75b1('0x12')](_0x1e11d4[_0x75b1('0xe')])));}})});router[_0x75b1('0x13')]('/',upload['single'](_0x75b1('0x14')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x75b1('0x15')]);router[_0x75b1('0x16')](_0x75b1('0x9'),auth[_0x75b1('0xb')](),controller[_0x75b1('0x16')]);module[_0x75b1('0x17')]=router; \ No newline at end of file +var _0x9ec3=['root','server/files/sounds/original/','originalname','format','basename','now','extname','single','file','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','isAuthenticated','index','get','/:id','show','/:id/download','diskStorage','join'];(function(_0x152861,_0x2343d6){var _0x21367f=function(_0x39d5c9){while(--_0x39d5c9){_0x152861['push'](_0x152861['shift']());}};_0x21367f(++_0x2343d6);}(_0x9ec3,0xc8));var _0x39ec=function(_0x412942,_0x3b9cbb){_0x412942=_0x412942-0x0;var _0x32ce0d=_0x9ec3[_0x412942];return _0x32ce0d;};'use strict';var multer=require(_0x39ec('0x0'));var util=require(_0x39ec('0x1'));var path=require('path');var timeout=require(_0x39ec('0x2'));var express=require(_0x39ec('0x3'));var router=express[_0x39ec('0x4')]();var fs_extra=require(_0x39ec('0x5'));var auth=require(_0x39ec('0x6'));var interaction=require(_0x39ec('0x7'));var config=require('../../config/environment');var controller=require(_0x39ec('0x8'));router['get']('/',auth[_0x39ec('0x9')](),controller[_0x39ec('0xa')]);router[_0x39ec('0xb')](_0x39ec('0xc'),auth[_0x39ec('0x9')](),controller[_0x39ec('0xd')]);router['get'](_0x39ec('0xe'),auth[_0x39ec('0x9')](),controller['download']);var upload=multer({'storage':multer[_0x39ec('0xf')]({'destination':function(_0x6c8255,_0x510b72,_0x4f8496){_0x4f8496(null,path[_0x39ec('0x10')](config[_0x39ec('0x11')],_0x39ec('0x12')));},'filename':function(_0x5429d1,_0x3115f4,_0x13e3fb){_0x3115f4[_0x39ec('0x13')]=_0x3115f4[_0x39ec('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x13e3fb(null,util[_0x39ec('0x14')]('%s-%s%s',path[_0x39ec('0x15')](_0x3115f4[_0x39ec('0x13')],path['extname'](_0x3115f4[_0x39ec('0x13')])),Date[_0x39ec('0x16')](),path[_0x39ec('0x17')](_0x3115f4[_0x39ec('0x13')])));}})});router['post']('/',upload[_0x39ec('0x18')](_0x39ec('0x19')),controller[_0x39ec('0x1a')]);router[_0x39ec('0x1b')]('/:id',auth[_0x39ec('0x9')](),controller[_0x39ec('0x1c')]);router[_0x39ec('0x1d')]('/:id',auth[_0x39ec('0x9')](),controller[_0x39ec('0x1d')]);module[_0x39ec('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 819c977..3b3d990 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 _0x49d5=['STRING','name','INTEGER','BIGINT','FLOAT','sequelize'];(function(_0x36d2e4,_0x49819a){var _0x3c32ae=function(_0xc36aaa){while(--_0xc36aaa){_0x36d2e4['push'](_0x36d2e4['shift']());}};_0x3c32ae(++_0x49819a);}(_0x49d5,0x1d3));var _0x549d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x49d5[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x549d('0x0'));module['exports']={'name':{'type':Sequelize[_0x549d('0x1')],'unique':_0x549d('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x549d('0x1')]},'original_format':{'type':Sequelize[_0x549d('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x549d('0x3')]},'original_bitRate':{'type':Sequelize[_0x549d('0x4')]},'original_sampleRate':{'type':Sequelize[_0x549d('0x3')]},'converted_format':{'type':Sequelize[_0x549d('0x1')]},'converted_duration':{'type':Sequelize[_0x549d('0x5')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x549d('0x3')]},'converted_bitRate':{'type':Sequelize[_0x549d('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x549d('0x3')]}}; \ No newline at end of file +var _0x9055=['INTEGER','exports','STRING','FLOAT','BIGINT'];(function(_0x9bf43e,_0x564472){var _0x218869=function(_0x21dedb){while(--_0x21dedb){_0x9bf43e['push'](_0x9bf43e['shift']());}};_0x218869(++_0x564472);}(_0x9055,0xb5));var _0x5905=function(_0x18c4bf,_0x56dfe5){_0x18c4bf=_0x18c4bf-0x0;var _0x5c9674=_0x9055[_0x18c4bf];return _0x5c9674;};'use strict';var Sequelize=require('sequelize');module[_0x5905('0x0')]={'name':{'type':Sequelize[_0x5905('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x5905('0x1')]},'display_name':{'type':Sequelize[_0x5905('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x5905('0x1')]},'original_format':{'type':Sequelize[_0x5905('0x1')]},'original_duration':{'type':Sequelize[_0x5905('0x2')]},'original_sampleCount':{'type':Sequelize[_0x5905('0x3')]},'original_channelCount':{'type':Sequelize[_0x5905('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x5905('0x4')]},'converted_format':{'type':Sequelize[_0x5905('0x1')]},'converted_duration':{'type':Sequelize[_0x5905('0x2')]},'converted_sampleCount':{'type':Sequelize[_0x5905('0x3')]},'converted_channelCount':{'type':Sequelize[_0x5905('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 0d77b19..a46bc81 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 _0x625f=['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/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','set','apply','save','update','then','get','Sounds','UserProfileResource','destroy','end','error','stack','name','send','map','Sound','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','rawAttributes','include','download','find','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','join','format','%s.%s','file','originalname','extname','basename','filename','substring','wav','server/files/sounds/original','info','chmodSync','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','0777','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','start','description','delete','original_format','eml-format','zip-dir','moment','bluebird','mustache','util'];(function(_0x49481b,_0x148f8a){var _0x1f693f=function(_0x184f09){while(--_0x184f09){_0x49481b['push'](_0x49481b['shift']());}};_0x1f693f(++_0x148f8a);}(_0x625f,0x7b));var _0xf625=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x625f[_0x4a7631];return _0x1a5a6f;};'use strict';var emlformat=require(_0xf625('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf625('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf625('0x2'));var BPromise=require(_0xf625('0x3'));var Mustache=require(_0xf625('0x4'));var util=require(_0xf625('0x5'));var path=require(_0xf625('0x6'));var sox=require('sox');var csv=require(_0xf625('0x7'));var ejs=require(_0xf625('0x8'));var fs=require('fs');var fs_extra=require(_0xf625('0x9'));var _=require(_0xf625('0xa'));var squel=require(_0xf625('0xb'));var crypto=require(_0xf625('0xc'));var jsforce=require(_0xf625('0xd'));var deskjs=require(_0xf625('0xe'));var toCsv=require(_0xf625('0x7'));var querystring=require(_0xf625('0xf'));var Papa=require('papaparse');var Redis=require(_0xf625('0x10'));var authService=require(_0xf625('0x11'));var qs=require(_0xf625('0x12'));var as=require(_0xf625('0x13'));var hardwareService=require(_0xf625('0x14'));var logger=require(_0xf625('0x15'))(_0xf625('0x16'));var utils=require('../../config/utils');var config=require(_0xf625('0x17'));var licenseUtil=require(_0xf625('0x18'));var db=require(_0xf625('0x19'))['db'];function respondWithStatusCode(_0x291d54,_0x28ac92){_0x28ac92=_0x28ac92||0xcc;return function(_0x2e7efc){if(_0x2e7efc){return _0x291d54[_0xf625('0x1a')](_0x28ac92);}return _0x291d54[_0xf625('0x1b')](_0x28ac92)['end']();};}function respondWithResult(_0x256d90,_0x1491f3){_0x1491f3=_0x1491f3||0xc8;return function(_0x22842c){if(_0x22842c){return _0x256d90[_0xf625('0x1b')](_0x1491f3)[_0xf625('0x1c')](_0x22842c);}};}function respondWithFilteredResult(_0xed51a2,_0x45d23d){return function(_0x576d23){if(_0x576d23){var _0x4fab70=_0x576d23['count'],_0x212815=_0x45d23d[_0xf625('0x1d')],_0x399a63=_0x45d23d['offset']+_0x45d23d['limit'],_0x50eb0b;if(_0x399a63>=_0x4fab70){_0x399a63=_0x4fab70;_0x50eb0b=0xc8;}else{_0x50eb0b=0xce;}_0xed51a2['status'](_0x50eb0b);return _0xed51a2[_0xf625('0x1e')]('Content-Range',_0x212815+'-'+_0x399a63+'/'+_0x4fab70)[_0xf625('0x1c')](_0x576d23);}return null;};}function patchUpdates(_0x49e7c8){return function(_0x1297a5){try{jsonpatch[_0xf625('0x1f')](_0x1297a5,_0x49e7c8,!![]);}catch(_0x572826){return BPromise['reject'](_0x572826);}return _0x1297a5[_0xf625('0x20')]();};}function saveUpdates(_0x2e1ec4,_0x26c3bd){return function(_0x5fc1b9){if(_0x5fc1b9){return _0x5fc1b9[_0xf625('0x21')](_0x2e1ec4)['then'](function(_0x3bf968){return _0x3bf968;});}return null;};}function removeEntity(_0x206334,_0x2e9cb4){return function(_0x5395fa){if(_0x5395fa){return _0x5395fa['destroy']()[_0xf625('0x22')](function(){var _0x3e26c3=_0x5395fa[_0xf625('0x23')]({'plain':!![]});var _0x5b42fb=_0xf625('0x24');return db[_0xf625('0x25')][_0xf625('0x26')]({'where':{'type':_0x5b42fb,'resourceId':_0x3e26c3['id']}})['then'](function(){return _0x5395fa;});})['then'](function(){_0x206334[_0xf625('0x1b')](0xcc)[_0xf625('0x27')]();});}};}function handleEntityNotFound(_0x4d25e3,_0x1c6ae4){return function(_0x396661){if(!_0x396661){_0x4d25e3[_0xf625('0x1a')](0x194);}return _0x396661;};}function handleError(_0x306f1c,_0x3b5aee){_0x3b5aee=_0x3b5aee||0x1f4;return function(_0x8d28a3){logger[_0xf625('0x28')](_0x8d28a3[_0xf625('0x29')]);if(_0x8d28a3[_0xf625('0x2a')]){delete _0x8d28a3[_0xf625('0x2a')];}_0x306f1c['status'](_0x3b5aee)[_0xf625('0x2b')](_0x8d28a3);};}exports['index']=function(_0x3af238,_0x358dd2){var _0x3a2b7a={},_0x4355fb={},_0xe516c0={'count':0x0,'rows':[]};var _0x35fa38=_[_0xf625('0x2c')](db[_0xf625('0x2d')]['rawAttributes'],function(_0x263476){return{'name':_0x263476[_0xf625('0x2e')],'type':_0x263476[_0xf625('0x2f')][_0xf625('0x30')]};});_0x4355fb[_0xf625('0x31')]=_[_0xf625('0x2c')](_0x35fa38,_0xf625('0x2a'));_0x4355fb[_0xf625('0x32')]=_[_0xf625('0x33')](_0x3af238['query']);_0x4355fb[_0xf625('0x34')]=_['intersection'](_0x4355fb['model'],_0x4355fb[_0xf625('0x32')]);_0x3a2b7a[_0xf625('0x35')]=_[_0xf625('0x36')](_0x4355fb[_0xf625('0x31')],qs['fields'](_0x3af238['query'][_0xf625('0x37')]));_0x3a2b7a['attributes']=_0x3a2b7a[_0xf625('0x35')][_0xf625('0x38')]?_0x3a2b7a[_0xf625('0x35')]:_0x4355fb['model'];if(!_0x3af238['query']['hasOwnProperty'](_0xf625('0x39'))){_0x3a2b7a['limit']=qs[_0xf625('0x3a')](_0x3af238[_0xf625('0x32')][_0xf625('0x3a')]);_0x3a2b7a[_0xf625('0x1d')]=qs[_0xf625('0x1d')](_0x3af238['query']['offset']);}_0x3a2b7a[_0xf625('0x3b')]=qs[_0xf625('0x3c')](_0x3af238[_0xf625('0x32')][_0xf625('0x3c')]);_0x3a2b7a['where']=qs['filters'](_[_0xf625('0x3d')](_0x3af238['query'],_0x4355fb['filters']),_0x35fa38);if(_0x3af238['query'][_0xf625('0x3e')]){_0x3a2b7a['where']=_[_0xf625('0x3f')](_0x3a2b7a[_0xf625('0x40')],{'$or':_[_0xf625('0x2c')](_0x35fa38,function(_0x841024){if(_0x841024[_0xf625('0x2f')]!==_0xf625('0x41')){var _0x4e1436={};_0x4e1436[_0x841024['name']]={'$like':'%'+_0x3af238[_0xf625('0x32')][_0xf625('0x3e')]+'%'};return _0x4e1436;}})});}_0x3a2b7a=_['merge']({},_0x3a2b7a,_0x3af238[_0xf625('0x42')]);var _0x23b133={'where':_0x3a2b7a[_0xf625('0x40')]};return db[_0xf625('0x2d')][_0xf625('0x43')](_0x23b133)[_0xf625('0x22')](function(_0x3148d3){_0xe516c0[_0xf625('0x43')]=_0x3148d3;if(_0x3af238[_0xf625('0x32')][_0xf625('0x44')]){_0x3a2b7a['include']=[{'all':!![]}];}return db[_0xf625('0x2d')][_0xf625('0x45')](_0x3a2b7a);})['then'](function(_0x2ddd8e){_0xe516c0[_0xf625('0x46')]=_0x2ddd8e;return _0xe516c0;})[_0xf625('0x22')](respondWithFilteredResult(_0x358dd2,_0x3a2b7a))[_0xf625('0x47')](handleError(_0x358dd2,null));};exports[_0xf625('0x48')]=function(_0x3dc007,_0x3f42ae){var _0x1ac7e1={'raw':!![],'where':{'id':_0x3dc007[_0xf625('0x49')]['id']}},_0x882eca={};_0x882eca[_0xf625('0x31')]=_[_0xf625('0x33')](db[_0xf625('0x2d')][_0xf625('0x4a')]);_0x882eca[_0xf625('0x32')]=_[_0xf625('0x33')](_0x3dc007[_0xf625('0x32')]);_0x882eca[_0xf625('0x34')]=_[_0xf625('0x36')](_0x882eca[_0xf625('0x31')],_0x882eca[_0xf625('0x32')]);_0x1ac7e1[_0xf625('0x35')]=_[_0xf625('0x36')](_0x882eca[_0xf625('0x31')],qs[_0xf625('0x37')](_0x3dc007[_0xf625('0x32')][_0xf625('0x37')]));_0x1ac7e1[_0xf625('0x35')]=_0x1ac7e1[_0xf625('0x35')]['length']?_0x1ac7e1[_0xf625('0x35')]:_0x882eca[_0xf625('0x31')];if(_0x3dc007[_0xf625('0x32')]['includeAll']){_0x1ac7e1[_0xf625('0x4b')]=[{'all':!![]}];}_0x1ac7e1=_['merge']({},_0x1ac7e1,_0x3dc007[_0xf625('0x42')]);return db[_0xf625('0x2d')]['find'](_0x1ac7e1)[_0xf625('0x22')](handleEntityNotFound(_0x3f42ae,null))[_0xf625('0x22')](respondWithResult(_0x3f42ae,null))[_0xf625('0x47')](handleError(_0x3f42ae,null));};exports[_0xf625('0x4c')]=function(_0x5cc8d4,_0x148ccb,_0x2a488c){return db[_0xf625('0x2d')][_0xf625('0x4d')]({'where':{'id':_0x5cc8d4[_0xf625('0x49')]['id']},'attributes':[_0xf625('0x2a'),_0xf625('0x4e'),_0xf625('0x4f')],'raw':!![]})[_0xf625('0x22')](handleEntityNotFound(_0x148ccb,null))[_0xf625('0x22')](function(_0x7f0123){if(_0x7f0123){if(!fs[_0xf625('0x50')](path['join'](config[_0xf625('0x51')],_0xf625('0x52'),_0x7f0123[_0xf625('0x4e')]+'.'+_0x7f0123[_0xf625('0x4f')]))){throw new db[(_0xf625('0x53'))]['ValidationError'](_0xf625('0x54'));}return _0x148ccb['download'](path[_0xf625('0x55')](config[_0xf625('0x51')],_0xf625('0x52'),util[_0xf625('0x56')](_0xf625('0x57'),_0x7f0123['save_name'],_0x7f0123['converted_format'])),util[_0xf625('0x56')](_0xf625('0x57'),_0x7f0123['name'],_0x7f0123[_0xf625('0x4f')]));}return null;})[_0xf625('0x47')](handleError(_0x148ccb,null));};exports['create']=function(_0x3b62bc,_0x1f35e7,_0x4e42d0){var _0x298471={'name':path['basename'](_0x3b62bc[_0xf625('0x58')][_0xf625('0x59')],path[_0xf625('0x5a')](_0x3b62bc[_0xf625('0x58')][_0xf625('0x59')])),'save_name':path[_0xf625('0x5b')](_0x3b62bc[_0xf625('0x58')][_0xf625('0x5c')],path[_0xf625('0x5a')](_0x3b62bc[_0xf625('0x58')][_0xf625('0x5c')])),'original_format':path[_0xf625('0x5a')](_0x3b62bc[_0xf625('0x58')][_0xf625('0x59')])[_0xf625('0x5d')](0x1),'converted_format':_0xf625('0x5e')};var _0x29b0e2=path['join'](config[_0xf625('0x51')],_0xf625('0x5f'),_0x3b62bc[_0xf625('0x58')][_0xf625('0x5c')]);var _0x1f2789=path[_0xf625('0x55')](config[_0xf625('0x51')],_0xf625('0x52'),util[_0xf625('0x56')](_0xf625('0x57'),path['basename'](_0x3b62bc[_0xf625('0x58')]['filename'],path[_0xf625('0x5a')](_0x3b62bc[_0xf625('0x58')][_0xf625('0x5c')])),_0x298471[_0xf625('0x4f')]));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x29b0e2);logger[_0xf625('0x60')]('Sound\x20upload\x20destination:\x20%s',_0x1f2789);try{fs[_0xf625('0x61')](_0x29b0e2,parseInt('0777',0x8));var _0x2947d0=sox['transcode'](_0x29b0e2,_0x1f2789,{'sampleRate':0x1f40,'format':_0xf625('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2947d0['on'](_0xf625('0x28'),function(_0xe2db77){fs[_0xf625('0x62')](_0x29b0e2);_0x1f35e7[_0xf625('0x1b')](0x1f4)[_0xf625('0x2b')](_0xe2db77);});_0x2947d0['on'](_0xf625('0x63'),function(_0x5f2d09){_0x298471[_0xf625('0x64')]=isNaN(_0x5f2d09[_0xf625('0x65')])?null:_0x5f2d09[_0xf625('0x65')]*0x3e8;_0x298471[_0xf625('0x66')]=isNaN(_0x5f2d09[_0xf625('0x67')])?null:_0x5f2d09[_0xf625('0x67')];_0x298471[_0xf625('0x68')]=isNaN(_0x5f2d09[_0xf625('0x69')])?null:_0x5f2d09[_0xf625('0x69')];_0x298471[_0xf625('0x6a')]=isNaN(_0x5f2d09['bitRate'])?null:_0x5f2d09[_0xf625('0x6b')];_0x298471[_0xf625('0x6c')]=isNaN(_0x5f2d09[_0xf625('0x6d')])?null:_0x5f2d09[_0xf625('0x6d')];});_0x2947d0['on'](_0xf625('0x6e'),function(_0x31990e){_0x298471[_0xf625('0x6f')]=isNaN(_0x31990e[_0xf625('0x65')])?null:_0x31990e[_0xf625('0x65')]*0x3e8;_0x298471[_0xf625('0x70')]=isNaN(_0x31990e[_0xf625('0x67')])?null:_0x31990e[_0xf625('0x67')];_0x298471[_0xf625('0x71')]=isNaN(_0x31990e[_0xf625('0x69')])?null:_0x31990e[_0xf625('0x69')];_0x298471[_0xf625('0x72')]=isNaN(_0x31990e[_0xf625('0x6b')])?null:_0x31990e['bitRate'];_0x298471[_0xf625('0x73')]=isNaN(_0x31990e[_0xf625('0x6d')])?null:_0x31990e['sampleRate'];});_0x2947d0['on'](_0xf625('0x27'),function(){fs[_0xf625('0x61')](_0x1f2789,parseInt(_0xf625('0x74'),0x8));return db[_0xf625('0x2d')][_0xf625('0x75')](_0x298471)['then'](function(_0x4a4978){var _0x2ddf22={'role':_0x3b62bc[_0xf625('0x76')][_0xf625('0x77')],'userProfileId':_0x3b62bc['body']['userProfileId']};if(!_0x2ddf22)throw new Error(_0xf625('0x78'));if(_0x2ddf22['role']===_0xf625('0x79')){var _0x3628e9=_0x4a4978[_0xf625('0x23')]({'plain':!![]});return db[_0xf625('0x7a')]['find']({'where':{'name':_0xf625('0x24'),'userProfileId':_0x2ddf22[_0xf625('0x7b')]},'raw':!![]})['then'](function(_0x168ae4){if(_0x168ae4&&_0x168ae4[_0xf625('0x7c')]===0x0){return db[_0xf625('0x25')][_0xf625('0x75')]({'name':_0x3628e9[_0xf625('0x2a')],'resourceId':_0x3628e9['id'],'type':_0x168ae4['name'],'sectionId':_0x168ae4['id']},{})['then'](function(){return _0x4a4978;});}else{return _0x4a4978;}})[_0xf625('0x47')](function(_0x31fe0c){logger[_0xf625('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31fe0c);throw _0x31fe0c;});}return _0x4a4978;})[_0xf625('0x22')](respondWithResult(_0x1f35e7,null))['catch'](handleError(_0x1f35e7,null));});_0x2947d0[_0xf625('0x7d')]();}catch(_0x368897){_0x1f35e7[_0xf625('0x1b')](0x1f4)[_0xf625('0x2b')](_0x368897);}};exports[_0xf625('0x21')]=function(_0x2db180,_0x4210b9,_0x342c0b){return db['Sound'][_0xf625('0x4d')]({'where':{'id':_0x2db180['params']['id']}})[_0xf625('0x22')](handleEntityNotFound(_0x4210b9,null))[_0xf625('0x22')](saveUpdates(_[_0xf625('0x3d')](_0x2db180[_0xf625('0x76')],[_0xf625('0x2a'),_0xf625('0x7e')]),null))[_0xf625('0x22')](respondWithResult(_0x4210b9,null))[_0xf625('0x47')](handleError(_0x4210b9,null));};exports[_0xf625('0x7f')]=function(_0x3bdc56,_0x3a69ca,_0x5416a2){return db[_0xf625('0x2d')][_0xf625('0x4d')]({'where':{'id':_0x3bdc56['params']['id']}})[_0xf625('0x22')](function(_0x14b403){if(_0x14b403){return _0x14b403[_0xf625('0x26')]();}})[_0xf625('0x22')](function(_0x44748b){var _0x485ce8=path[_0xf625('0x55')](config[_0xf625('0x51')],'server/files/sounds/original',util[_0xf625('0x56')]('%s.%s',_0x44748b[_0xf625('0x4e')],_0x44748b[_0xf625('0x80')]));var _0x23b6c2=path[_0xf625('0x55')](config[_0xf625('0x51')],_0xf625('0x52'),util[_0xf625('0x56')](_0xf625('0x57'),_0x44748b[_0xf625('0x4e')],_0x44748b[_0xf625('0x4f')]));fs[_0xf625('0x62')](_0x485ce8);fs[_0xf625('0x62')](_0x23b6c2);return _0x44748b;})[_0xf625('0x22')](function(_0x326e68){if(_0x326e68){return _0x3a69ca[_0xf625('0x1b')](0xcc)[_0xf625('0x27')]();}})[_0xf625('0x22')](handleEntityNotFound(_0x3a69ca,null))[_0xf625('0x47')](handleError(_0x3a69ca,null));}; \ No newline at end of file +var _0xbea8=['basename','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_bitRate','converted_sampleRate','create','body','role','userProfileId','user','get','UserProfileSection','UserProfileResource','start','update','delete','original_format','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','Sounds','destroy','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','keys','query','attributes','intersection','model','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','include','findAll','catch','params','fields','length','options','find','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','Sequelize','ValidationError','download','format','%s.%s','file','originalname','extname'];(function(_0x13a802,_0x482a8a){var _0x3f9663=function(_0x557fdc){while(--_0x557fdc){_0x13a802['push'](_0x13a802['shift']());}};_0x3f9663(++_0x482a8a);}(_0xbea8,0x11f));var _0x8bea=function(_0x500812,_0x296a3c){_0x500812=_0x500812-0x0;var _0x4add02=_0xbea8[_0x500812];return _0x4add02;};'use strict';var emlformat=require(_0x8bea('0x0'));var rimraf=require(_0x8bea('0x1'));var zipdir=require(_0x8bea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8bea('0x3'));var BPromise=require(_0x8bea('0x4'));var Mustache=require(_0x8bea('0x5'));var util=require(_0x8bea('0x6'));var path=require(_0x8bea('0x7'));var sox=require(_0x8bea('0x8'));var csv=require(_0x8bea('0x9'));var ejs=require(_0x8bea('0xa'));var fs=require('fs');var fs_extra=require(_0x8bea('0xb'));var _=require(_0x8bea('0xc'));var squel=require(_0x8bea('0xd'));var crypto=require(_0x8bea('0xe'));var jsforce=require(_0x8bea('0xf'));var deskjs=require(_0x8bea('0x10'));var toCsv=require(_0x8bea('0x9'));var querystring=require(_0x8bea('0x11'));var Papa=require('papaparse');var Redis=require(_0x8bea('0x12'));var authService=require(_0x8bea('0x13'));var qs=require(_0x8bea('0x14'));var as=require(_0x8bea('0x15'));var hardwareService=require(_0x8bea('0x16'));var logger=require(_0x8bea('0x17'))(_0x8bea('0x18'));var utils=require(_0x8bea('0x19'));var config=require(_0x8bea('0x1a'));var licenseUtil=require(_0x8bea('0x1b'));var db=require(_0x8bea('0x1c'))['db'];function respondWithStatusCode(_0x3ac733,_0x1c24da){_0x1c24da=_0x1c24da||0xcc;return function(_0x69044d){if(_0x69044d){return _0x3ac733[_0x8bea('0x1d')](_0x1c24da);}return _0x3ac733[_0x8bea('0x1e')](_0x1c24da)[_0x8bea('0x1f')]();};}function respondWithResult(_0xc60783,_0x1ccf99){_0x1ccf99=_0x1ccf99||0xc8;return function(_0x266158){if(_0x266158){return _0xc60783[_0x8bea('0x1e')](_0x1ccf99)[_0x8bea('0x20')](_0x266158);}};}function respondWithFilteredResult(_0x2a2e9b,_0x1f0feb){return function(_0x55f741){if(_0x55f741){var _0x159e96=_0x55f741[_0x8bea('0x21')],_0x5e5e18=_0x1f0feb['offset'],_0x201464=_0x1f0feb[_0x8bea('0x22')]+_0x1f0feb[_0x8bea('0x23')],_0x54da19;if(_0x201464>=_0x159e96){_0x201464=_0x159e96;_0x54da19=0xc8;}else{_0x54da19=0xce;}_0x2a2e9b[_0x8bea('0x1e')](_0x54da19);return _0x2a2e9b[_0x8bea('0x24')](_0x8bea('0x25'),_0x5e5e18+'-'+_0x201464+'/'+_0x159e96)[_0x8bea('0x20')](_0x55f741);}return null;};}function patchUpdates(_0x5493a2){return function(_0x158c11){try{jsonpatch[_0x8bea('0x26')](_0x158c11,_0x5493a2,!![]);}catch(_0x89f23f){return BPromise[_0x8bea('0x27')](_0x89f23f);}return _0x158c11[_0x8bea('0x28')]();};}function saveUpdates(_0x32a6e3,_0x1d5bba){return function(_0x2d8be7){if(_0x2d8be7){return _0x2d8be7['update'](_0x32a6e3)['then'](function(_0x18f803){return _0x18f803;});}return null;};}function removeEntity(_0x1a61a8,_0x3c20e4){return function(_0x419f1c){if(_0x419f1c){return _0x419f1c['destroy']()[_0x8bea('0x29')](function(){var _0x3d9bf5=_0x419f1c['get']({'plain':!![]});var _0x3c8d5f=_0x8bea('0x2a');return db['UserProfileResource'][_0x8bea('0x2b')]({'where':{'type':_0x3c8d5f,'resourceId':_0x3d9bf5['id']}})['then'](function(){return _0x419f1c;});})['then'](function(){_0x1a61a8[_0x8bea('0x1e')](0xcc)[_0x8bea('0x1f')]();});}};}function handleEntityNotFound(_0x24d1ac,_0x33e49a){return function(_0x4eb869){if(!_0x4eb869){_0x24d1ac[_0x8bea('0x1d')](0x194);}return _0x4eb869;};}function handleError(_0x57e10b,_0x30ea37){_0x30ea37=_0x30ea37||0x1f4;return function(_0x2737b0){logger['error'](_0x2737b0[_0x8bea('0x2c')]);if(_0x2737b0['name']){delete _0x2737b0[_0x8bea('0x2d')];}_0x57e10b['status'](_0x30ea37)[_0x8bea('0x2e')](_0x2737b0);};}exports[_0x8bea('0x2f')]=function(_0x32844,_0x10529c){var _0x2f8d3d={},_0x41b6bc={},_0x5da25d={'count':0x0,'rows':[]};var _0xe02d00=_[_0x8bea('0x30')](db[_0x8bea('0x31')][_0x8bea('0x32')],function(_0x1dcc2b){return{'name':_0x1dcc2b[_0x8bea('0x33')],'type':_0x1dcc2b[_0x8bea('0x34')]['key']};});_0x41b6bc['model']=_[_0x8bea('0x30')](_0xe02d00,_0x8bea('0x2d'));_0x41b6bc['query']=_[_0x8bea('0x35')](_0x32844['query']);_0x41b6bc['filters']=_['intersection'](_0x41b6bc['model'],_0x41b6bc[_0x8bea('0x36')]);_0x2f8d3d[_0x8bea('0x37')]=_[_0x8bea('0x38')](_0x41b6bc[_0x8bea('0x39')],qs['fields'](_0x32844[_0x8bea('0x36')]['fields']));_0x2f8d3d[_0x8bea('0x37')]=_0x2f8d3d[_0x8bea('0x37')]['length']?_0x2f8d3d[_0x8bea('0x37')]:_0x41b6bc[_0x8bea('0x39')];if(!_0x32844[_0x8bea('0x36')][_0x8bea('0x3a')](_0x8bea('0x3b'))){_0x2f8d3d[_0x8bea('0x23')]=qs[_0x8bea('0x23')](_0x32844[_0x8bea('0x36')][_0x8bea('0x23')]);_0x2f8d3d[_0x8bea('0x22')]=qs['offset'](_0x32844['query']['offset']);}_0x2f8d3d[_0x8bea('0x3c')]=qs['sort'](_0x32844[_0x8bea('0x36')][_0x8bea('0x3d')]);_0x2f8d3d[_0x8bea('0x3e')]=qs[_0x8bea('0x3f')](_['pick'](_0x32844[_0x8bea('0x36')],_0x41b6bc[_0x8bea('0x3f')]),_0xe02d00);if(_0x32844['query']['filter']){_0x2f8d3d[_0x8bea('0x3e')]=_[_0x8bea('0x40')](_0x2f8d3d[_0x8bea('0x3e')],{'$or':_[_0x8bea('0x30')](_0xe02d00,function(_0x281630){if(_0x281630[_0x8bea('0x34')]!=='VIRTUAL'){var _0x2be6a0={};_0x2be6a0[_0x281630[_0x8bea('0x2d')]]={'$like':'%'+_0x32844['query'][_0x8bea('0x41')]+'%'};return _0x2be6a0;}})});}_0x2f8d3d=_[_0x8bea('0x40')]({},_0x2f8d3d,_0x32844['options']);var _0x2f5557={'where':_0x2f8d3d['where']};return db[_0x8bea('0x31')][_0x8bea('0x21')](_0x2f5557)[_0x8bea('0x29')](function(_0x2a0226){_0x5da25d[_0x8bea('0x21')]=_0x2a0226;if(_0x32844[_0x8bea('0x36')]['includeAll']){_0x2f8d3d[_0x8bea('0x42')]=[{'all':!![]}];}return db['Sound'][_0x8bea('0x43')](_0x2f8d3d);})[_0x8bea('0x29')](function(_0x14a00b){_0x5da25d['rows']=_0x14a00b;return _0x5da25d;})[_0x8bea('0x29')](respondWithFilteredResult(_0x10529c,_0x2f8d3d))[_0x8bea('0x44')](handleError(_0x10529c,null));};exports['show']=function(_0x4f7450,_0x5ab122){var _0x643997={'raw':!![],'where':{'id':_0x4f7450[_0x8bea('0x45')]['id']}},_0x357068={};_0x357068[_0x8bea('0x39')]=_[_0x8bea('0x35')](db[_0x8bea('0x31')][_0x8bea('0x32')]);_0x357068[_0x8bea('0x36')]=_['keys'](_0x4f7450[_0x8bea('0x36')]);_0x357068['filters']=_['intersection'](_0x357068[_0x8bea('0x39')],_0x357068['query']);_0x643997[_0x8bea('0x37')]=_[_0x8bea('0x38')](_0x357068[_0x8bea('0x39')],qs['fields'](_0x4f7450['query'][_0x8bea('0x46')]));_0x643997[_0x8bea('0x37')]=_0x643997[_0x8bea('0x37')][_0x8bea('0x47')]?_0x643997[_0x8bea('0x37')]:_0x357068[_0x8bea('0x39')];if(_0x4f7450['query']['includeAll']){_0x643997['include']=[{'all':!![]}];}_0x643997=_['merge']({},_0x643997,_0x4f7450[_0x8bea('0x48')]);return db[_0x8bea('0x31')][_0x8bea('0x49')](_0x643997)[_0x8bea('0x29')](handleEntityNotFound(_0x5ab122,null))[_0x8bea('0x29')](respondWithResult(_0x5ab122,null))['catch'](handleError(_0x5ab122,null));};exports['download']=function(_0x2932ff,_0x200857,_0x4bb698){return db[_0x8bea('0x31')][_0x8bea('0x49')]({'where':{'id':_0x2932ff['params']['id']},'attributes':[_0x8bea('0x2d'),_0x8bea('0x4a'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x200857,null))[_0x8bea('0x29')](function(_0x17058f){if(_0x17058f){if(!fs[_0x8bea('0x4b')](path[_0x8bea('0x4c')](config[_0x8bea('0x4d')],_0x8bea('0x4e'),_0x17058f[_0x8bea('0x4a')]+'.'+_0x17058f[_0x8bea('0x4f')]))){throw new db[(_0x8bea('0x50'))][(_0x8bea('0x51'))]('Sound\x20not\x20found');}return _0x200857[_0x8bea('0x52')](path[_0x8bea('0x4c')](config['root'],_0x8bea('0x4e'),util[_0x8bea('0x53')](_0x8bea('0x54'),_0x17058f[_0x8bea('0x4a')],_0x17058f[_0x8bea('0x4f')])),util[_0x8bea('0x53')]('%s.%s',_0x17058f[_0x8bea('0x2d')],_0x17058f[_0x8bea('0x4f')]));}return null;})[_0x8bea('0x44')](handleError(_0x200857,null));};exports['create']=function(_0x48b7b4,_0x4ce078,_0x83f9aa){var _0x5b2772={'name':path['basename'](_0x48b7b4[_0x8bea('0x55')][_0x8bea('0x56')],path[_0x8bea('0x57')](_0x48b7b4[_0x8bea('0x55')][_0x8bea('0x56')])),'save_name':path[_0x8bea('0x58')](_0x48b7b4[_0x8bea('0x55')]['filename'],path[_0x8bea('0x57')](_0x48b7b4[_0x8bea('0x55')][_0x8bea('0x59')])),'original_format':path[_0x8bea('0x57')](_0x48b7b4[_0x8bea('0x55')]['originalname'])[_0x8bea('0x5a')](0x1),'converted_format':_0x8bea('0x5b')};var _0xa29493=path['join'](config[_0x8bea('0x4d')],_0x8bea('0x5c'),_0x48b7b4[_0x8bea('0x55')][_0x8bea('0x59')]);var _0x52acd7=path['join'](config[_0x8bea('0x4d')],'server/files/sounds/converted',util[_0x8bea('0x53')](_0x8bea('0x54'),path['basename'](_0x48b7b4['file'][_0x8bea('0x59')],path[_0x8bea('0x57')](_0x48b7b4[_0x8bea('0x55')]['filename'])),_0x5b2772[_0x8bea('0x4f')]));logger[_0x8bea('0x5d')](_0x8bea('0x5e'),_0xa29493);logger[_0x8bea('0x5d')](_0x8bea('0x5f'),_0x52acd7);try{fs[_0x8bea('0x60')](_0xa29493,parseInt(_0x8bea('0x61'),0x8));var _0x38342f=sox[_0x8bea('0x62')](_0xa29493,_0x52acd7,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x38342f['on'](_0x8bea('0x63'),function(_0xe7fc51){fs['unlinkSync'](_0xa29493);_0x4ce078['status'](0x1f4)[_0x8bea('0x2e')](_0xe7fc51);});_0x38342f['on']('src',function(_0x40e5e5){_0x5b2772[_0x8bea('0x64')]=isNaN(_0x40e5e5[_0x8bea('0x65')])?null:_0x40e5e5[_0x8bea('0x65')]*0x3e8;_0x5b2772[_0x8bea('0x66')]=isNaN(_0x40e5e5[_0x8bea('0x67')])?null:_0x40e5e5[_0x8bea('0x67')];_0x5b2772['original_channelCount']=isNaN(_0x40e5e5[_0x8bea('0x68')])?null:_0x40e5e5[_0x8bea('0x68')];_0x5b2772[_0x8bea('0x69')]=isNaN(_0x40e5e5[_0x8bea('0x6a')])?null:_0x40e5e5[_0x8bea('0x6a')];_0x5b2772[_0x8bea('0x6b')]=isNaN(_0x40e5e5[_0x8bea('0x6c')])?null:_0x40e5e5[_0x8bea('0x6c')];});_0x38342f['on'](_0x8bea('0x6d'),function(_0x48fa9d){_0x5b2772[_0x8bea('0x6e')]=isNaN(_0x48fa9d[_0x8bea('0x65')])?null:_0x48fa9d[_0x8bea('0x65')]*0x3e8;_0x5b2772['converted_sampleCount']=isNaN(_0x48fa9d['sampleCount'])?null:_0x48fa9d[_0x8bea('0x67')];_0x5b2772['converted_channelCount']=isNaN(_0x48fa9d[_0x8bea('0x68')])?null:_0x48fa9d[_0x8bea('0x68')];_0x5b2772[_0x8bea('0x6f')]=isNaN(_0x48fa9d[_0x8bea('0x6a')])?null:_0x48fa9d[_0x8bea('0x6a')];_0x5b2772[_0x8bea('0x70')]=isNaN(_0x48fa9d[_0x8bea('0x6c')])?null:_0x48fa9d[_0x8bea('0x6c')];});_0x38342f['on'](_0x8bea('0x1f'),function(){fs[_0x8bea('0x60')](_0x52acd7,parseInt(_0x8bea('0x61'),0x8));return db['Sound'][_0x8bea('0x71')](_0x5b2772)['then'](function(_0x42fb52){var _0x47227d={'role':_0x48b7b4[_0x8bea('0x72')][_0x8bea('0x73')],'userProfileId':_0x48b7b4[_0x8bea('0x72')][_0x8bea('0x74')]};if(!_0x47227d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47227d['role']===_0x8bea('0x75')){var _0xb0b442=_0x42fb52[_0x8bea('0x76')]({'plain':!![]});return db[_0x8bea('0x77')][_0x8bea('0x49')]({'where':{'name':_0x8bea('0x2a'),'userProfileId':_0x47227d[_0x8bea('0x74')]},'raw':!![]})[_0x8bea('0x29')](function(_0x533735){if(_0x533735&&_0x533735['autoAssociation']===0x0){return db[_0x8bea('0x78')]['create']({'name':_0xb0b442[_0x8bea('0x2d')],'resourceId':_0xb0b442['id'],'type':_0x533735[_0x8bea('0x2d')],'sectionId':_0x533735['id']},{})[_0x8bea('0x29')](function(){return _0x42fb52;});}else{return _0x42fb52;}})[_0x8bea('0x44')](function(_0x56c190){logger[_0x8bea('0x63')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56c190);throw _0x56c190;});}return _0x42fb52;})[_0x8bea('0x29')](respondWithResult(_0x4ce078,null))[_0x8bea('0x44')](handleError(_0x4ce078,null));});_0x38342f[_0x8bea('0x79')]();}catch(_0x35ee8c){_0x4ce078[_0x8bea('0x1e')](0x1f4)[_0x8bea('0x2e')](_0x35ee8c);}};exports[_0x8bea('0x7a')]=function(_0x20ab18,_0x38846e,_0x29d896){return db[_0x8bea('0x31')][_0x8bea('0x49')]({'where':{'id':_0x20ab18[_0x8bea('0x45')]['id']}})['then'](handleEntityNotFound(_0x38846e,null))[_0x8bea('0x29')](saveUpdates(_['pick'](_0x20ab18[_0x8bea('0x72')],[_0x8bea('0x2d'),'description']),null))[_0x8bea('0x29')](respondWithResult(_0x38846e,null))[_0x8bea('0x44')](handleError(_0x38846e,null));};exports[_0x8bea('0x7b')]=function(_0x5be3a7,_0x4f59bd,_0x22d557){return db[_0x8bea('0x31')]['find']({'where':{'id':_0x5be3a7['params']['id']}})['then'](function(_0x45c95c){if(_0x45c95c){return _0x45c95c[_0x8bea('0x2b')]();}})[_0x8bea('0x29')](function(_0x586bc4){var _0x3b563c=path[_0x8bea('0x4c')](config[_0x8bea('0x4d')],'server/files/sounds/original',util[_0x8bea('0x53')](_0x8bea('0x54'),_0x586bc4[_0x8bea('0x4a')],_0x586bc4[_0x8bea('0x7c')]));var _0x2d7d75=path['join'](config[_0x8bea('0x4d')],'server/files/sounds/converted',util['format'](_0x8bea('0x54'),_0x586bc4[_0x8bea('0x4a')],_0x586bc4['converted_format']));fs['unlinkSync'](_0x3b563c);fs['unlinkSync'](_0x2d7d75);return _0x586bc4;})['then'](function(_0xd4ba85){if(_0xd4ba85){return _0x4f59bd['status'](0xcc)[_0x8bea('0x1f')]();}})['then'](handleEntityNotFound(_0x4f59bd,null))[_0x8bea('0x44')](handleError(_0x4f59bd,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index f8d482a..7a49654 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 _0xa9af=['../../config/environment','./sound.attributes','exports','tools_sounds','lodash','util','moment','request-promise','path','rimraf'];(function(_0x5ddbc6,_0x1d2e17){var _0x1e4d66=function(_0x3299ef){while(--_0x3299ef){_0x5ddbc6['push'](_0x5ddbc6['shift']());}};_0x1e4d66(++_0x1d2e17);}(_0xa9af,0x158));var _0xfa9a=function(_0x3b428b,_0xaf2f38){_0x3b428b=_0x3b428b-0x0;var _0x11a0c4=_0xa9af[_0x3b428b];return _0x11a0c4;};'use strict';var _=require(_0xfa9a('0x0'));var util=require(_0xfa9a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfa9a('0x2'));var BPromise=require('bluebird');var rp=require(_0xfa9a('0x3'));var fs=require('fs');var path=require(_0xfa9a('0x4'));var rimraf=require(_0xfa9a('0x5'));var config=require(_0xfa9a('0x6'));var attributes=require(_0xfa9a('0x7'));module[_0xfa9a('0x8')]=function(_0x3d87ce,_0x120e09){return _0x3d87ce['define']('Sound',attributes,{'tableName':_0xfa9a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5340=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./sound.attributes','define','tools_sounds'];(function(_0x461e0f,_0x372b1a){var _0x290778=function(_0x431bb5){while(--_0x431bb5){_0x461e0f['push'](_0x461e0f['shift']());}};_0x290778(++_0x372b1a);}(_0x5340,0x155));var _0x0534=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5340[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0534('0x0'));var util=require(_0x0534('0x1'));var logger=require(_0x0534('0x2'))(_0x0534('0x3'));var moment=require(_0x0534('0x4'));var BPromise=require(_0x0534('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0534('0x6'));var rimraf=require(_0x0534('0x7'));var config=require('../../config/environment');var attributes=require(_0x0534('0x8'));module['exports']=function(_0x3090e7,_0x12474c){return _0x3090e7[_0x0534('0x9')]('Sound',attributes,{'tableName':_0x0534('0xa'),'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 39c52ea..43646dc 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 _0x91ba=['error','code','message','request\x20sent','result','catch','ShowSound','Sound','find','options','raw','where','include','map','attributes','model','then','stringify','util','moment','ioredis','../../mysqldb','../../config/logger','client','http','info','Sound,\x20%s,\x20%s','debug'];(function(_0x53c8c7,_0x348f83){var _0x4f9626=function(_0x25c457){while(--_0x25c457){_0x53c8c7['push'](_0x53c8c7['shift']());}};_0x4f9626(++_0x348f83);}(_0x91ba,0xd6));var _0xa91b=function(_0x2b054a,_0x222f99){_0x2b054a=_0x2b054a-0x0;var _0x2853a6=_0x91ba[_0x2b054a];return _0x2853a6;};'use strict';var _=require('lodash');var util=require(_0xa91b('0x0'));var moment=require(_0xa91b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa91b('0x2'));var db=require(_0xa91b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa91b('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa91b('0x5')][_0xa91b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x37f3f7,_0x3adca0,_0x3796e0){return new BPromise(function(_0x2f0be7,_0x25ee38){return client['request'](_0x37f3f7,_0x3796e0)['then'](function(_0x1fefda){logger[_0xa91b('0x7')](_0xa91b('0x8'),_0x3adca0,'request\x20sent');logger[_0xa91b('0x9')]('Sound,\x20%s,\x20%s,\x20%s',_0x3adca0,'request\x20sent',JSON['stringify'](_0x1fefda));if(_0x1fefda[_0xa91b('0xa')]){if(_0x1fefda[_0xa91b('0xa')][_0xa91b('0xb')]===0x1f4){logger['error'](_0xa91b('0x8'),_0x3adca0,_0x1fefda['error'][_0xa91b('0xc')]);return _0x25ee38(_0x1fefda[_0xa91b('0xa')]['message']);}logger['error']('Sound,\x20%s,\x20%s',_0x3adca0,_0x1fefda[_0xa91b('0xa')][_0xa91b('0xc')]);return _0x2f0be7(_0x1fefda[_0xa91b('0xa')][_0xa91b('0xc')]);}else{logger[_0xa91b('0x7')](_0xa91b('0x8'),_0x3adca0,_0xa91b('0xd'));_0x2f0be7(_0x1fefda[_0xa91b('0xe')][_0xa91b('0xc')]);}})[_0xa91b('0xf')](function(_0x2c4ebf){logger['error'](_0xa91b('0x8'),_0x3adca0,_0x2c4ebf);_0x25ee38(_0x2c4ebf);});});}exports[_0xa91b('0x10')]=function(_0x4730d1){var _0x393e21=this;return new Promise(function(_0x376074,_0x2b09e2){return db[_0xa91b('0x11')][_0xa91b('0x12')]({'raw':_0x4730d1[_0xa91b('0x13')]?_0x4730d1[_0xa91b('0x13')][_0xa91b('0x14')]===undefined?!![]:![]:!![],'where':_0x4730d1[_0xa91b('0x13')]?_0x4730d1[_0xa91b('0x13')][_0xa91b('0x15')]||null:null,'attributes':_0x4730d1[_0xa91b('0x13')]?_0x4730d1[_0xa91b('0x13')]['attributes']||null:null,'include':_0x4730d1['options']?_0x4730d1[_0xa91b('0x13')][_0xa91b('0x16')]?_[_0xa91b('0x17')](_0x4730d1[_0xa91b('0x13')]['include'],function(_0x562114){return{'model':db[_0x562114['model']],'as':_0x562114['as'],'attributes':_0x562114[_0xa91b('0x18')],'include':_0x562114['include']?_[_0xa91b('0x17')](_0x562114[_0xa91b('0x16')],function(_0x33237c){return{'model':db[_0x33237c[_0xa91b('0x19')]],'as':_0x33237c['as'],'attributes':_0x33237c['attributes'],'include':_0x33237c[_0xa91b('0x16')]?_['map'](_0x33237c[_0xa91b('0x16')],function(_0x318f19){return{'model':db[_0x318f19[_0xa91b('0x19')]],'as':_0x318f19['as'],'attributes':_0x318f19[_0xa91b('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa91b('0x1a')](function(_0x27f1e6){logger[_0xa91b('0x7')](_0xa91b('0x10'),_0x4730d1);logger[_0xa91b('0x9')]('ShowSound',_0x4730d1,JSON[_0xa91b('0x1b')](_0x27f1e6));_0x376074(_0x27f1e6);})['catch'](function(_0x46fc3a){logger[_0xa91b('0xa')](_0xa91b('0x10'),_0x46fc3a[_0xa91b('0xc')],_0x4730d1);_0x2b09e2(_0x393e21[_0xa91b('0xa')](0x1f4,_0x46fc3a[_0xa91b('0xc')]));});});}; \ No newline at end of file +var _0x89f9=['http','request','then','info','request\x20sent','stringify','error','code','message','Sound,\x20%s,\x20%s','result','ShowSound','Sound','find','options','raw','where','attributes','include','model','map','debug','catch','lodash','util','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x116667,_0x2d870a){var _0x526af9=function(_0x8062e7){while(--_0x8062e7){_0x116667['push'](_0x116667['shift']());}};_0x526af9(++_0x2d870a);}(_0x89f9,0x1e8));var _0x989f=function(_0x30a4f1,_0x3cd9f9){_0x30a4f1=_0x30a4f1-0x0;var _0x1ba39e=_0x89f9[_0x30a4f1];return _0x1ba39e;};'use strict';var _=require(_0x989f('0x0'));var util=require(_0x989f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x989f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x989f('0x3'))(_0x989f('0x4'));var config=require(_0x989f('0x5'));var jayson=require(_0x989f('0x6'));var client=jayson[_0x989f('0x7')][_0x989f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41160f,_0xb0d25b,_0x366729){return new BPromise(function(_0x33e897,_0x16de1a){return client[_0x989f('0x9')](_0x41160f,_0x366729)[_0x989f('0xa')](function(_0x37b122){logger[_0x989f('0xb')]('Sound,\x20%s,\x20%s',_0xb0d25b,_0x989f('0xc'));logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0xb0d25b,_0x989f('0xc'),JSON[_0x989f('0xd')](_0x37b122));if(_0x37b122[_0x989f('0xe')]){if(_0x37b122[_0x989f('0xe')][_0x989f('0xf')]===0x1f4){logger[_0x989f('0xe')]('Sound,\x20%s,\x20%s',_0xb0d25b,_0x37b122['error'][_0x989f('0x10')]);return _0x16de1a(_0x37b122[_0x989f('0xe')][_0x989f('0x10')]);}logger['error'](_0x989f('0x11'),_0xb0d25b,_0x37b122[_0x989f('0xe')][_0x989f('0x10')]);return _0x33e897(_0x37b122[_0x989f('0xe')][_0x989f('0x10')]);}else{logger[_0x989f('0xb')](_0x989f('0x11'),_0xb0d25b,_0x989f('0xc'));_0x33e897(_0x37b122[_0x989f('0x12')][_0x989f('0x10')]);}})['catch'](function(_0x3d271b){logger[_0x989f('0xe')](_0x989f('0x11'),_0xb0d25b,_0x3d271b);_0x16de1a(_0x3d271b);});});}exports[_0x989f('0x13')]=function(_0x24de52){var _0x1075da=this;return new Promise(function(_0x40a10e,_0x5d520f){return db[_0x989f('0x14')][_0x989f('0x15')]({'raw':_0x24de52[_0x989f('0x16')]?_0x24de52[_0x989f('0x16')][_0x989f('0x17')]===undefined?!![]:![]:!![],'where':_0x24de52[_0x989f('0x16')]?_0x24de52[_0x989f('0x16')][_0x989f('0x18')]||null:null,'attributes':_0x24de52[_0x989f('0x16')]?_0x24de52[_0x989f('0x16')][_0x989f('0x19')]||null:null,'include':_0x24de52['options']?_0x24de52['options'][_0x989f('0x1a')]?_['map'](_0x24de52['options'][_0x989f('0x1a')],function(_0x4b3ce6){return{'model':db[_0x4b3ce6[_0x989f('0x1b')]],'as':_0x4b3ce6['as'],'attributes':_0x4b3ce6[_0x989f('0x19')],'include':_0x4b3ce6['include']?_[_0x989f('0x1c')](_0x4b3ce6[_0x989f('0x1a')],function(_0x49e422){return{'model':db[_0x49e422['model']],'as':_0x49e422['as'],'attributes':_0x49e422[_0x989f('0x19')],'include':_0x49e422[_0x989f('0x1a')]?_[_0x989f('0x1c')](_0x49e422['include'],function(_0x501954){return{'model':db[_0x501954[_0x989f('0x1b')]],'as':_0x501954['as'],'attributes':_0x501954['attributes']};}):[]};}):[]};}):[]:[]})[_0x989f('0xa')](function(_0x4be391){logger[_0x989f('0xb')]('ShowSound',_0x24de52);logger[_0x989f('0x1d')](_0x989f('0x13'),_0x24de52,JSON[_0x989f('0xd')](_0x4be391));_0x40a10e(_0x4be391);})[_0x989f('0x1e')](function(_0x33a2e9){logger[_0x989f('0xe')]('ShowSound',_0x33a2e9[_0x989f('0x10')],_0x24de52);_0x5d520f(_0x1075da['error'](0x1f4,_0x33a2e9[_0x989f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 3ed7b3b..6630e7b 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 _0x9bca=['isAuthenticated','show','post','create','put','/:id','update','destroy','exports','multer','util','path','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9bca,0xf7));var _0xa9bc=function(_0x177505,_0x56497f){_0x177505=_0x177505-0x0;var _0x240414=_0x9bca[_0x177505];return _0x240414;};'use strict';var multer=require(_0xa9bc('0x0'));var util=require(_0xa9bc('0x1'));var path=require(_0xa9bc('0x2'));var timeout=require('connect-timeout');var express=require(_0xa9bc('0x3'));var router=express[_0xa9bc('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa9bc('0x5'));var controller=require(_0xa9bc('0x6'));router[_0xa9bc('0x7')]('/',auth[_0xa9bc('0x8')](),controller['index']);router[_0xa9bc('0x7')]('/:id',auth[_0xa9bc('0x8')](),controller[_0xa9bc('0x9')]);router[_0xa9bc('0xa')]('/',auth[_0xa9bc('0x8')](),controller[_0xa9bc('0xb')]);router[_0xa9bc('0xc')](_0xa9bc('0xd'),auth['isAuthenticated'](),controller[_0xa9bc('0xe')]);router['delete'](_0xa9bc('0xd'),auth[_0xa9bc('0x8')](),controller[_0xa9bc('0xf')]);module[_0xa9bc('0x10')]=router; \ No newline at end of file +var _0x01e3=['/:id','delete','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','show','post','create','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01e3,0x122));var _0x301e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x01e3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x301e('0x0'));var util=require(_0x301e('0x1'));var path=require(_0x301e('0x2'));var timeout=require(_0x301e('0x3'));var express=require(_0x301e('0x4'));var router=express['Router']();var fs_extra=require(_0x301e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x301e('0x6'));var controller=require('./squareMessage.controller');router[_0x301e('0x7')]('/',auth[_0x301e('0x8')](),controller[_0x301e('0x9')]);router[_0x301e('0x7')]('/:id',auth[_0x301e('0x8')](),controller[_0x301e('0xa')]);router[_0x301e('0xb')]('/',auth[_0x301e('0x8')](),controller[_0x301e('0xc')]);router[_0x301e('0xd')](_0x301e('0xe'),auth[_0x301e('0x8')](),controller['update']);router[_0x301e('0xf')](_0x301e('0xe'),auth['isAuthenticated'](),controller['destroy']);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 4b865a6..412affc 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 _0xaba6=['out','TEXT','sequelize','exports'];(function(_0x1c5db5,_0x2c94b2){var _0x8e22f0=function(_0x5848c0){while(--_0x5848c0){_0x1c5db5['push'](_0x1c5db5['shift']());}};_0x8e22f0(++_0x2c94b2);}(_0xaba6,0xe2));var _0x6aba=function(_0x1ffb94,_0x54ebd6){_0x1ffb94=_0x1ffb94-0x0;var _0x2cef67=_0xaba6[_0x1ffb94];return _0x2cef67;};'use strict';var Sequelize=require(_0x6aba('0x0'));module[_0x6aba('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x6aba('0x2')),'defaultValue':_0x6aba('0x2'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x6aba('0x3')]}}; \ No newline at end of file +var _0x207c=['ENUM','out','exports','STRING','TEXT','medium'];(function(_0x52a857,_0xc99fa1){var _0x4e2aae=function(_0x5410d9){while(--_0x5410d9){_0x52a857['push'](_0x52a857['shift']());}};_0x4e2aae(++_0xc99fa1);}(_0x207c,0x1e8));var _0xc207=function(_0x2c0964,_0x504d2f){_0x2c0964=_0x2c0964-0x0;var _0x3c6616=_0x207c[_0x2c0964];return _0x3c6616;};'use strict';var Sequelize=require('sequelize');module[_0xc207('0x0')]={'uniqueid':{'type':Sequelize[_0xc207('0x1')]},'body':{'type':Sequelize[_0xc207('0x2')](_0xc207('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xc207('0x4')]('in',_0xc207('0x5')),'defaultValue':_0xc207('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc207('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index cecca1a..6e44681 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 _0x52ea=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','set','Content-Range','save','update','then','end','error','stack','name','send','index','map','SquareMessage','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','destroy','eml-format','rimraf','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5333c4,_0x3b53d1){var _0x510317=function(_0x556988){while(--_0x556988){_0x5333c4['push'](_0x5333c4['shift']());}};_0x510317(++_0x3b53d1);}(_0x52ea,0x157));var _0xa52e=function(_0x39a04c,_0x2b4002){_0x39a04c=_0x39a04c-0x0;var _0x580cb0=_0x52ea[_0x39a04c];return _0x580cb0;};'use strict';var emlformat=require(_0xa52e('0x0'));var rimraf=require(_0xa52e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa52e('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa52e('0x3'));var sox=require(_0xa52e('0x4'));var csv=require(_0xa52e('0x5'));var ejs=require(_0xa52e('0x6'));var fs=require('fs');var fs_extra=require(_0xa52e('0x7'));var _=require(_0xa52e('0x8'));var squel=require(_0xa52e('0x9'));var crypto=require('crypto');var jsforce=require(_0xa52e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa52e('0x5'));var querystring=require(_0xa52e('0xb'));var Papa=require(_0xa52e('0xc'));var Redis=require(_0xa52e('0xd'));var authService=require(_0xa52e('0xe'));var qs=require(_0xa52e('0xf'));var as=require(_0xa52e('0x10'));var hardwareService=require(_0xa52e('0x11'));var logger=require(_0xa52e('0x12'))(_0xa52e('0x13'));var utils=require(_0xa52e('0x14'));var config=require(_0xa52e('0x15'));var licenseUtil=require(_0xa52e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1642cc,_0x8af249){_0x8af249=_0x8af249||0xcc;return function(_0x2be003){if(_0x2be003){return _0x1642cc['sendStatus'](_0x8af249);}return _0x1642cc[_0xa52e('0x17')](_0x8af249)['end']();};}function respondWithResult(_0x203b10,_0x349feb){_0x349feb=_0x349feb||0xc8;return function(_0x5b26da){if(_0x5b26da){return _0x203b10['status'](_0x349feb)[_0xa52e('0x18')](_0x5b26da);}};}function respondWithFilteredResult(_0x2b5422,_0x1aa1fa){return function(_0xd2e949){if(_0xd2e949){var _0x1ea5f0=_0xd2e949['count'],_0x5678f5=_0x1aa1fa[_0xa52e('0x19')],_0x2664af=_0x1aa1fa[_0xa52e('0x19')]+_0x1aa1fa[_0xa52e('0x1a')],_0x7551c5;if(_0x2664af>=_0x1ea5f0){_0x2664af=_0x1ea5f0;_0x7551c5=0xc8;}else{_0x7551c5=0xce;}_0x2b5422['status'](_0x7551c5);return _0x2b5422[_0xa52e('0x1b')](_0xa52e('0x1c'),_0x5678f5+'-'+_0x2664af+'/'+_0x1ea5f0)[_0xa52e('0x18')](_0xd2e949);}return null;};}function patchUpdates(_0x2e7f6b){return function(_0x5e9d96){try{jsonpatch['apply'](_0x5e9d96,_0x2e7f6b,!![]);}catch(_0x4e4e47){return BPromise['reject'](_0x4e4e47);}return _0x5e9d96[_0xa52e('0x1d')]();};}function saveUpdates(_0x1b5f0d,_0xe72d06){return function(_0x3c220b){if(_0x3c220b){return _0x3c220b[_0xa52e('0x1e')](_0x1b5f0d)[_0xa52e('0x1f')](function(_0x2c9b41){return _0x2c9b41;});}return null;};}function removeEntity(_0x1dc355,_0x658efa){return function(_0x54c9ad){if(_0x54c9ad){return _0x54c9ad['destroy']()['then'](function(){_0x1dc355['status'](0xcc)[_0xa52e('0x20')]();});}};}function handleEntityNotFound(_0x1b3c9c,_0x400e7){return function(_0x36aecb){if(!_0x36aecb){_0x1b3c9c['sendStatus'](0x194);}return _0x36aecb;};}function handleError(_0x34480d,_0x3a1f4b){_0x3a1f4b=_0x3a1f4b||0x1f4;return function(_0x4f2703){logger[_0xa52e('0x21')](_0x4f2703[_0xa52e('0x22')]);if(_0x4f2703['name']){delete _0x4f2703[_0xa52e('0x23')];}_0x34480d[_0xa52e('0x17')](_0x3a1f4b)[_0xa52e('0x24')](_0x4f2703);};}exports[_0xa52e('0x25')]=function(_0x1587f0,_0x3a4737){var _0x2f195b={},_0x5a4d53={},_0x362f9b={'count':0x0,'rows':[]};var _0x4934cb=_[_0xa52e('0x26')](db[_0xa52e('0x27')]['rawAttributes'],function(_0x14f935){return{'name':_0x14f935['fieldName'],'type':_0x14f935[_0xa52e('0x28')][_0xa52e('0x29')]};});_0x5a4d53[_0xa52e('0x2a')]=_['map'](_0x4934cb,_0xa52e('0x23'));_0x5a4d53[_0xa52e('0x2b')]=_[_0xa52e('0x2c')](_0x1587f0['query']);_0x5a4d53[_0xa52e('0x2d')]=_[_0xa52e('0x2e')](_0x5a4d53['model'],_0x5a4d53[_0xa52e('0x2b')]);_0x2f195b['attributes']=_[_0xa52e('0x2e')](_0x5a4d53[_0xa52e('0x2a')],qs['fields'](_0x1587f0['query'][_0xa52e('0x2f')]));_0x2f195b[_0xa52e('0x30')]=_0x2f195b[_0xa52e('0x30')][_0xa52e('0x31')]?_0x2f195b[_0xa52e('0x30')]:_0x5a4d53['model'];if(!_0x1587f0[_0xa52e('0x2b')][_0xa52e('0x32')](_0xa52e('0x33'))){_0x2f195b[_0xa52e('0x1a')]=qs[_0xa52e('0x1a')](_0x1587f0[_0xa52e('0x2b')][_0xa52e('0x1a')]);_0x2f195b[_0xa52e('0x19')]=qs[_0xa52e('0x19')](_0x1587f0[_0xa52e('0x2b')][_0xa52e('0x19')]);}_0x2f195b[_0xa52e('0x34')]=qs[_0xa52e('0x35')](_0x1587f0['query'][_0xa52e('0x35')]);_0x2f195b[_0xa52e('0x36')]=qs[_0xa52e('0x2d')](_[_0xa52e('0x37')](_0x1587f0['query'],_0x5a4d53['filters']),_0x4934cb);if(_0x1587f0['query'][_0xa52e('0x38')]){_0x2f195b['where']=_[_0xa52e('0x39')](_0x2f195b[_0xa52e('0x36')],{'$or':_[_0xa52e('0x26')](_0x4934cb,function(_0x1f3521){if(_0x1f3521[_0xa52e('0x28')]!==_0xa52e('0x3a')){var _0x3afe38={};_0x3afe38[_0x1f3521[_0xa52e('0x23')]]={'$like':'%'+_0x1587f0[_0xa52e('0x2b')][_0xa52e('0x38')]+'%'};return _0x3afe38;}})});}_0x2f195b=_[_0xa52e('0x39')]({},_0x2f195b,_0x1587f0[_0xa52e('0x3b')]);var _0x555120={'where':_0x2f195b[_0xa52e('0x36')]};return db['SquareMessage']['count'](_0x555120)[_0xa52e('0x1f')](function(_0x1a453f){_0x362f9b[_0xa52e('0x3c')]=_0x1a453f;if(_0x1587f0['query'][_0xa52e('0x3d')]){_0x2f195b[_0xa52e('0x3e')]=[{'all':!![]}];}return db[_0xa52e('0x27')][_0xa52e('0x3f')](_0x2f195b);})[_0xa52e('0x1f')](function(_0x1d23f0){_0x362f9b[_0xa52e('0x40')]=_0x1d23f0;return _0x362f9b;})['then'](respondWithFilteredResult(_0x3a4737,_0x2f195b))[_0xa52e('0x41')](handleError(_0x3a4737,null));};exports['show']=function(_0x11e837,_0x412039){var _0x508ece={'raw':!![],'where':{'id':_0x11e837[_0xa52e('0x42')]['id']}},_0x33d538={};_0x33d538[_0xa52e('0x2a')]=_[_0xa52e('0x2c')](db[_0xa52e('0x27')][_0xa52e('0x43')]);_0x33d538[_0xa52e('0x2b')]=_[_0xa52e('0x2c')](_0x11e837[_0xa52e('0x2b')]);_0x33d538[_0xa52e('0x2d')]=_['intersection'](_0x33d538[_0xa52e('0x2a')],_0x33d538[_0xa52e('0x2b')]);_0x508ece[_0xa52e('0x30')]=_[_0xa52e('0x2e')](_0x33d538[_0xa52e('0x2a')],qs[_0xa52e('0x2f')](_0x11e837[_0xa52e('0x2b')][_0xa52e('0x2f')]));_0x508ece['attributes']=_0x508ece[_0xa52e('0x30')][_0xa52e('0x31')]?_0x508ece[_0xa52e('0x30')]:_0x33d538[_0xa52e('0x2a')];if(_0x11e837[_0xa52e('0x2b')][_0xa52e('0x3d')]){_0x508ece[_0xa52e('0x3e')]=[{'all':!![]}];}_0x508ece=_[_0xa52e('0x39')]({},_0x508ece,_0x11e837[_0xa52e('0x3b')]);return db[_0xa52e('0x27')][_0xa52e('0x44')](_0x508ece)[_0xa52e('0x1f')](handleEntityNotFound(_0x412039,null))[_0xa52e('0x1f')](respondWithResult(_0x412039,null))[_0xa52e('0x41')](handleError(_0x412039,null));};exports[_0xa52e('0x45')]=function(_0x1cd601,_0x4ad044){return db[_0xa52e('0x27')][_0xa52e('0x45')](_0x1cd601[_0xa52e('0x46')],{})['then'](respondWithResult(_0x4ad044,0xc9))[_0xa52e('0x41')](handleError(_0x4ad044,null));};exports[_0xa52e('0x1e')]=function(_0x1ca814,_0x3b7448){if(_0x1ca814[_0xa52e('0x46')]['id']){delete _0x1ca814[_0xa52e('0x46')]['id'];}return db[_0xa52e('0x27')]['find']({'where':{'id':_0x1ca814[_0xa52e('0x42')]['id']}})[_0xa52e('0x1f')](handleEntityNotFound(_0x3b7448,null))[_0xa52e('0x1f')](saveUpdates(_0x1ca814[_0xa52e('0x46')],null))[_0xa52e('0x1f')](respondWithResult(_0x3b7448,null))[_0xa52e('0x41')](handleError(_0x3b7448,null));};exports[_0xa52e('0x47')]=function(_0x3503da,_0x4bc0a3){return db[_0xa52e('0x27')][_0xa52e('0x44')]({'where':{'id':_0x3503da[_0xa52e('0x42')]['id']}})['then'](handleEntityNotFound(_0x4bc0a3,null))[_0xa52e('0x1f')](removeEntity(_0x4bc0a3,null))[_0xa52e('0x41')](handleError(_0x4bc0a3,null));}; \ No newline at end of file +var _0x9bb3=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SquareMessage','fieldName','type','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','find','create','body','params','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','../../components/auth/service'];(function(_0x3ed389,_0x5f2402){var _0x1483f4=function(_0x27558f){while(--_0x27558f){_0x3ed389['push'](_0x3ed389['shift']());}};_0x1483f4(++_0x5f2402);}(_0x9bb3,0x1ad));var _0x39bb=function(_0x2b9f81,_0x5d633a){_0x2b9f81=_0x2b9f81-0x0;var _0x14e8d0=_0x9bb3[_0x2b9f81];return _0x14e8d0;};'use strict';var emlformat=require(_0x39bb('0x0'));var rimraf=require(_0x39bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x39bb('0x2'));var rp=require(_0x39bb('0x3'));var moment=require(_0x39bb('0x4'));var BPromise=require(_0x39bb('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x39bb('0x6'));var sox=require(_0x39bb('0x7'));var csv=require(_0x39bb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x39bb('0x9'));var _=require(_0x39bb('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x39bb('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x39bb('0x8'));var querystring=require(_0x39bb('0xc'));var Papa=require(_0x39bb('0xd'));var Redis=require('ioredis');var authService=require(_0x39bb('0xe'));var qs=require(_0x39bb('0xf'));var as=require(_0x39bb('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39bb('0x11'))(_0x39bb('0x12'));var utils=require(_0x39bb('0x13'));var config=require(_0x39bb('0x14'));var licenseUtil=require(_0x39bb('0x15'));var db=require(_0x39bb('0x16'))['db'];function respondWithStatusCode(_0x509431,_0x197d1f){_0x197d1f=_0x197d1f||0xcc;return function(_0x1e0347){if(_0x1e0347){return _0x509431[_0x39bb('0x17')](_0x197d1f);}return _0x509431['status'](_0x197d1f)['end']();};}function respondWithResult(_0x3ed1c2,_0x4b984a){_0x4b984a=_0x4b984a||0xc8;return function(_0x1f37ed){if(_0x1f37ed){return _0x3ed1c2[_0x39bb('0x18')](_0x4b984a)[_0x39bb('0x19')](_0x1f37ed);}};}function respondWithFilteredResult(_0x3dfa79,_0x4d6389){return function(_0x5bc736){if(_0x5bc736){var _0x58536b=_0x5bc736[_0x39bb('0x1a')],_0x397c83=_0x4d6389[_0x39bb('0x1b')],_0xe049ea=_0x4d6389['offset']+_0x4d6389['limit'],_0x1281ec;if(_0xe049ea>=_0x58536b){_0xe049ea=_0x58536b;_0x1281ec=0xc8;}else{_0x1281ec=0xce;}_0x3dfa79[_0x39bb('0x18')](_0x1281ec);return _0x3dfa79[_0x39bb('0x1c')](_0x39bb('0x1d'),_0x397c83+'-'+_0xe049ea+'/'+_0x58536b)[_0x39bb('0x19')](_0x5bc736);}return null;};}function patchUpdates(_0x3078bb){return function(_0x2b52ec){try{jsonpatch[_0x39bb('0x1e')](_0x2b52ec,_0x3078bb,!![]);}catch(_0x2dbbea){return BPromise[_0x39bb('0x1f')](_0x2dbbea);}return _0x2b52ec[_0x39bb('0x20')]();};}function saveUpdates(_0x131d9c,_0x2b02be){return function(_0x41461c){if(_0x41461c){return _0x41461c[_0x39bb('0x21')](_0x131d9c)[_0x39bb('0x22')](function(_0x3dad22){return _0x3dad22;});}return null;};}function removeEntity(_0xbc326a,_0xf4215d){return function(_0x5c6530){if(_0x5c6530){return _0x5c6530[_0x39bb('0x23')]()[_0x39bb('0x22')](function(){_0xbc326a[_0x39bb('0x18')](0xcc)[_0x39bb('0x24')]();});}};}function handleEntityNotFound(_0x2cb88b,_0x580c26){return function(_0x5cc1d3){if(!_0x5cc1d3){_0x2cb88b[_0x39bb('0x17')](0x194);}return _0x5cc1d3;};}function handleError(_0x3b6c2e,_0x57c38e){_0x57c38e=_0x57c38e||0x1f4;return function(_0xa87316){logger[_0x39bb('0x25')](_0xa87316[_0x39bb('0x26')]);if(_0xa87316[_0x39bb('0x27')]){delete _0xa87316[_0x39bb('0x27')];}_0x3b6c2e[_0x39bb('0x18')](_0x57c38e)[_0x39bb('0x28')](_0xa87316);};}exports[_0x39bb('0x29')]=function(_0xed4d25,_0x1f1840){var _0x40d27e={},_0x212d85={},_0x405ff0={'count':0x0,'rows':[]};var _0x1bb809=_[_0x39bb('0x2a')](db[_0x39bb('0x2b')]['rawAttributes'],function(_0x5305f4){return{'name':_0x5305f4[_0x39bb('0x2c')],'type':_0x5305f4[_0x39bb('0x2d')]['key']};});_0x212d85[_0x39bb('0x2e')]=_[_0x39bb('0x2a')](_0x1bb809,_0x39bb('0x27'));_0x212d85['query']=_[_0x39bb('0x2f')](_0xed4d25[_0x39bb('0x30')]);_0x212d85['filters']=_['intersection'](_0x212d85[_0x39bb('0x2e')],_0x212d85[_0x39bb('0x30')]);_0x40d27e[_0x39bb('0x31')]=_[_0x39bb('0x32')](_0x212d85[_0x39bb('0x2e')],qs[_0x39bb('0x33')](_0xed4d25[_0x39bb('0x30')][_0x39bb('0x33')]));_0x40d27e[_0x39bb('0x31')]=_0x40d27e[_0x39bb('0x31')][_0x39bb('0x34')]?_0x40d27e[_0x39bb('0x31')]:_0x212d85['model'];if(!_0xed4d25['query'][_0x39bb('0x35')](_0x39bb('0x36'))){_0x40d27e[_0x39bb('0x37')]=qs[_0x39bb('0x37')](_0xed4d25[_0x39bb('0x30')]['limit']);_0x40d27e[_0x39bb('0x1b')]=qs['offset'](_0xed4d25[_0x39bb('0x30')][_0x39bb('0x1b')]);}_0x40d27e[_0x39bb('0x38')]=qs[_0x39bb('0x39')](_0xed4d25[_0x39bb('0x30')][_0x39bb('0x39')]);_0x40d27e[_0x39bb('0x3a')]=qs[_0x39bb('0x3b')](_[_0x39bb('0x3c')](_0xed4d25[_0x39bb('0x30')],_0x212d85['filters']),_0x1bb809);if(_0xed4d25[_0x39bb('0x30')][_0x39bb('0x3d')]){_0x40d27e[_0x39bb('0x3a')]=_[_0x39bb('0x3e')](_0x40d27e[_0x39bb('0x3a')],{'$or':_[_0x39bb('0x2a')](_0x1bb809,function(_0x213dbf){if(_0x213dbf[_0x39bb('0x2d')]!==_0x39bb('0x3f')){var _0x16cd78={};_0x16cd78[_0x213dbf[_0x39bb('0x27')]]={'$like':'%'+_0xed4d25[_0x39bb('0x30')]['filter']+'%'};return _0x16cd78;}})});}_0x40d27e=_[_0x39bb('0x3e')]({},_0x40d27e,_0xed4d25[_0x39bb('0x40')]);var _0x7fe310={'where':_0x40d27e[_0x39bb('0x3a')]};return db[_0x39bb('0x2b')][_0x39bb('0x1a')](_0x7fe310)['then'](function(_0x3913fb){_0x405ff0['count']=_0x3913fb;if(_0xed4d25[_0x39bb('0x30')][_0x39bb('0x41')]){_0x40d27e[_0x39bb('0x42')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x40d27e);})['then'](function(_0x3b7e16){_0x405ff0[_0x39bb('0x43')]=_0x3b7e16;return _0x405ff0;})[_0x39bb('0x22')](respondWithFilteredResult(_0x1f1840,_0x40d27e))['catch'](handleError(_0x1f1840,null));};exports[_0x39bb('0x44')]=function(_0x26e10a,_0x3956ed){var _0x2aba22={'raw':!![],'where':{'id':_0x26e10a['params']['id']}},_0x32fc47={};_0x32fc47[_0x39bb('0x2e')]=_['keys'](db[_0x39bb('0x2b')]['rawAttributes']);_0x32fc47['query']=_[_0x39bb('0x2f')](_0x26e10a[_0x39bb('0x30')]);_0x32fc47[_0x39bb('0x3b')]=_[_0x39bb('0x32')](_0x32fc47[_0x39bb('0x2e')],_0x32fc47['query']);_0x2aba22[_0x39bb('0x31')]=_['intersection'](_0x32fc47[_0x39bb('0x2e')],qs[_0x39bb('0x33')](_0x26e10a[_0x39bb('0x30')][_0x39bb('0x33')]));_0x2aba22[_0x39bb('0x31')]=_0x2aba22[_0x39bb('0x31')][_0x39bb('0x34')]?_0x2aba22[_0x39bb('0x31')]:_0x32fc47['model'];if(_0x26e10a[_0x39bb('0x30')][_0x39bb('0x41')]){_0x2aba22['include']=[{'all':!![]}];}_0x2aba22=_[_0x39bb('0x3e')]({},_0x2aba22,_0x26e10a[_0x39bb('0x40')]);return db[_0x39bb('0x2b')][_0x39bb('0x45')](_0x2aba22)[_0x39bb('0x22')](handleEntityNotFound(_0x3956ed,null))[_0x39bb('0x22')](respondWithResult(_0x3956ed,null))['catch'](handleError(_0x3956ed,null));};exports[_0x39bb('0x46')]=function(_0x5d492d,_0x4f86ed){return db[_0x39bb('0x2b')][_0x39bb('0x46')](_0x5d492d[_0x39bb('0x47')],{})['then'](respondWithResult(_0x4f86ed,0xc9))['catch'](handleError(_0x4f86ed,null));};exports[_0x39bb('0x21')]=function(_0x4b0fe0,_0x2467e7){if(_0x4b0fe0['body']['id']){delete _0x4b0fe0[_0x39bb('0x47')]['id'];}return db['SquareMessage'][_0x39bb('0x45')]({'where':{'id':_0x4b0fe0[_0x39bb('0x48')]['id']}})[_0x39bb('0x22')](handleEntityNotFound(_0x2467e7,null))[_0x39bb('0x22')](saveUpdates(_0x4b0fe0[_0x39bb('0x47')],null))[_0x39bb('0x22')](respondWithResult(_0x2467e7,null))[_0x39bb('0x49')](handleError(_0x2467e7,null));};exports[_0x39bb('0x23')]=function(_0x18671d,_0x573c62){return db[_0x39bb('0x2b')][_0x39bb('0x45')]({'where':{'id':_0x18671d[_0x39bb('0x48')]['id']}})[_0x39bb('0x22')](handleEntityNotFound(_0x573c62,null))['then'](removeEntity(_0x573c62,null))[_0x39bb('0x49')](handleError(_0x573c62,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 0241b7f..fe4a43d 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 _0x5423=['define','SquareMessage','square_messages','lodash','../../config/logger','api','path','rimraf','../../config/environment','./squareMessage.attributes','exports'];(function(_0xb5e37f,_0xc624f1){var _0x23f431=function(_0x3ec670){while(--_0x3ec670){_0xb5e37f['push'](_0xb5e37f['shift']());}};_0x23f431(++_0xc624f1);}(_0x5423,0x7c));var _0x3542=function(_0xedc95f,_0x47be5f){_0xedc95f=_0xedc95f-0x0;var _0x366e6f=_0x5423[_0xedc95f];return _0x366e6f;};'use strict';var _=require(_0x3542('0x0'));var util=require('util');var logger=require(_0x3542('0x1'))(_0x3542('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3542('0x3'));var rimraf=require(_0x3542('0x4'));var config=require(_0x3542('0x5'));var attributes=require(_0x3542('0x6'));module[_0x3542('0x7')]=function(_0x1c4a9a,_0x1e5f7e){return _0x1c4a9a[_0x3542('0x8')](_0x3542('0x9'),attributes,{'tableName':_0x3542('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88f3=['../../config/environment','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x21f7d4,_0x3fb9df){var _0x143fa7=function(_0x4ace03){while(--_0x4ace03){_0x21f7d4['push'](_0x21f7d4['shift']());}};_0x143fa7(++_0x3fb9df);}(_0x88f3,0xb8));var _0x388f=function(_0x569425,_0x58b4ea){_0x569425=_0x569425-0x0;var _0x3c6f2b=_0x88f3[_0x569425];return _0x3c6f2b;};'use strict';var _=require(_0x388f('0x0'));var util=require(_0x388f('0x1'));var logger=require(_0x388f('0x2'))(_0x388f('0x3'));var moment=require('moment');var BPromise=require(_0x388f('0x4'));var rp=require(_0x388f('0x5'));var fs=require('fs');var path=require(_0x388f('0x6'));var rimraf=require(_0x388f('0x7'));var config=require(_0x388f('0x8'));var attributes=require('./squareMessage.attributes');module['exports']=function(_0x6e1e1d,_0x1d8470){return _0x6e1e1d[_0x388f('0x9')](_0x388f('0xa'),attributes,{'tableName':_0x388f('0xb'),'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 f5ef64e..6681b3a 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(_0x3000f4,_0x371094){var _0x47e88c=function(_0xa9d5d){while(--_0xa9d5d){_0x3000f4['push'](_0x3000f4['shift']());}};_0x47e88c(++_0x371094);}(_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);});});}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(_0x5d48c9,_0xbfea8f){var _0x32bdd0=function(_0x4fc224){while(--_0x4fc224){_0x5d48c9['push'](_0x5d48c9['shift']());}};_0x32bdd0(++_0xbfea8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 bd092f7..b555e64 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 _0xb986=['index','/:id','isAuthenticated','/:id/test','15s','test','post','create','put','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get'];(function(_0x27d258,_0x4c66fb){var _0x4475ba=function(_0x1be8fb){while(--_0x1be8fb){_0x27d258['push'](_0x27d258['shift']());}};_0x4475ba(++_0x4c66fb);}(_0xb986,0xb2));var _0x6b98=function(_0x29b0b0,_0x22e155){_0x29b0b0=_0x29b0b0-0x0;var _0x75997c=_0xb986[_0x29b0b0];return _0x75997c;};'use strict';var multer=require(_0x6b98('0x0'));var util=require(_0x6b98('0x1'));var path=require(_0x6b98('0x2'));var timeout=require(_0x6b98('0x3'));var express=require(_0x6b98('0x4'));var router=express[_0x6b98('0x5')]();var fs_extra=require(_0x6b98('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6b98('0x7'));var config=require(_0x6b98('0x8'));var controller=require(_0x6b98('0x9'));router[_0x6b98('0xa')]('/',auth['isAuthenticated'](),controller[_0x6b98('0xb')]);router[_0x6b98('0xa')](_0x6b98('0xc'),auth[_0x6b98('0xd')](),controller['show']);router[_0x6b98('0xa')](_0x6b98('0xe'),auth['isAuthenticated'](),timeout(_0x6b98('0xf')),controller[_0x6b98('0x10')]);router[_0x6b98('0x11')]('/',auth[_0x6b98('0xd')](),controller[_0x6b98('0x12')]);router[_0x6b98('0x13')](_0x6b98('0xc'),auth[_0x6b98('0xd')](),controller['update']);router['delete'](_0x6b98('0xc'),auth['isAuthenticated'](),controller[_0x6b98('0x14')]);module['exports']=router; \ No newline at end of file +var _0xad0c=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','/:id','isAuthenticated','show','/:id/test','15s','test','post','create','put','update','delete'];(function(_0x398c90,_0x5e7d93){var _0x99f3e7=function(_0x5b0ee0){while(--_0x5b0ee0){_0x398c90['push'](_0x398c90['shift']());}};_0x99f3e7(++_0x5e7d93);}(_0xad0c,0xe3));var _0xcad0=function(_0x2f0c5f,_0x43ab88){_0x2f0c5f=_0x2f0c5f-0x0;var _0x3787d6=_0xad0c[_0x2f0c5f];return _0x3787d6;};'use strict';var multer=require(_0xcad0('0x0'));var util=require(_0xcad0('0x1'));var path=require(_0xcad0('0x2'));var timeout=require(_0xcad0('0x3'));var express=require('express');var router=express[_0xcad0('0x4')]();var fs_extra=require(_0xcad0('0x5'));var auth=require(_0xcad0('0x6'));var interaction=require(_0xcad0('0x7'));var config=require(_0xcad0('0x8'));var controller=require(_0xcad0('0x9'));router[_0xcad0('0xa')]('/',auth['isAuthenticated'](),controller[_0xcad0('0xb')]);router[_0xcad0('0xa')](_0xcad0('0xc'),auth[_0xcad0('0xd')](),controller[_0xcad0('0xe')]);router['get'](_0xcad0('0xf'),auth[_0xcad0('0xd')](),timeout(_0xcad0('0x10')),controller[_0xcad0('0x11')]);router[_0xcad0('0x12')]('/',auth[_0xcad0('0xd')](),controller[_0xcad0('0x13')]);router[_0xcad0('0x14')](_0xcad0('0xc'),auth['isAuthenticated'](),controller[_0xcad0('0x15')]);router[_0xcad0('0x16')](_0xcad0('0xc'),auth[_0xcad0('0xd')](),controller[_0xcad0('0x17')]);module[_0xcad0('0x18')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index bd15938..b48f7d2 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 _0xd83a=['STRING','sequelize'];(function(_0x167cc6,_0x1e49c0){var _0x30e544=function(_0x30e3e5){while(--_0x30e3e5){_0x167cc6['push'](_0x167cc6['shift']());}};_0x30e544(++_0x1e49c0);}(_0xd83a,0x141));var _0xad83=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xd83a[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0xad83('0x0'));module['exports']={'name':{'type':Sequelize[_0xad83('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x131a=['sequelize','exports','STRING','name'];(function(_0x17c487,_0x2b72f1){var _0x3feeb8=function(_0x49aaa1){while(--_0x49aaa1){_0x17c487['push'](_0x17c487['shift']());}};_0x3feeb8(++_0x2b72f1);}(_0x131a,0xc0));var _0xa131=function(_0x40d30c,_0x314e53){_0x40d30c=_0x40d30c-0x0;var _0x34c226=_0x131a[_0x40d30c];return _0x34c226;};'use strict';var Sequelize=require(_0xa131('0x0'));module[_0xa131('0x1')]={'name':{'type':Sequelize[_0xa131('0x2')],'unique':_0xa131('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xa131('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 9e611be..1691058 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 _0x6753=['rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','set','json','apply','save','update','then','destroy','get','ODBC','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','options','SquareOdbc','includeAll','catch','keys','length','include','find','create','body','user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','odbc','eml-format'];(function(_0x1487e1,_0x373c69){var _0x278e9d=function(_0x255ef7){while(--_0x255ef7){_0x1487e1['push'](_0x1487e1['shift']());}};_0x278e9d(++_0x373c69);}(_0x6753,0xa1));var _0x3675=function(_0x1246f2,_0x423e7c){_0x1246f2=_0x1246f2-0x0;var _0x1fba7e=_0x6753[_0x1246f2];return _0x1fba7e;};'use strict';var emlformat=require(_0x3675('0x0'));var rimraf=require(_0x3675('0x1'));var zipdir=require(_0x3675('0x2'));var jsonpatch=require(_0x3675('0x3'));var rp=require('request-promise');var moment=require(_0x3675('0x4'));var BPromise=require(_0x3675('0x5'));var Mustache=require('mustache');var util=require(_0x3675('0x6'));var path=require(_0x3675('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3675('0x8'));var _=require(_0x3675('0x9'));var squel=require(_0x3675('0xa'));var crypto=require(_0x3675('0xb'));var jsforce=require(_0x3675('0xc'));var deskjs=require(_0x3675('0xd'));var toCsv=require(_0x3675('0xe'));var querystring=require(_0x3675('0xf'));var Papa=require(_0x3675('0x10'));var Redis=require(_0x3675('0x11'));var authService=require(_0x3675('0x12'));var qs=require(_0x3675('0x13'));var as=require(_0x3675('0x14'));var hardwareService=require(_0x3675('0x15'));var logger=require('../../config/logger')(_0x3675('0x16'));var utils=require(_0x3675('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3675('0x18'));var db=require(_0x3675('0x19'))['db'];function respondWithStatusCode(_0x3eace2,_0x23f2ec){_0x23f2ec=_0x23f2ec||0xcc;return function(_0x3acacb){if(_0x3acacb){return _0x3eace2[_0x3675('0x1a')](_0x23f2ec);}return _0x3eace2[_0x3675('0x1b')](_0x23f2ec)['end']();};}function respondWithResult(_0x2ff7d6,_0x2de42d){_0x2de42d=_0x2de42d||0xc8;return function(_0x1297e2){if(_0x1297e2){return _0x2ff7d6[_0x3675('0x1b')](_0x2de42d)['json'](_0x1297e2);}};}function respondWithFilteredResult(_0x185f30,_0xba8a2a){return function(_0x2c7b7c){if(_0x2c7b7c){var _0x27e5bb=_0x2c7b7c[_0x3675('0x1c')],_0x510233=_0xba8a2a[_0x3675('0x1d')],_0x3bf7c5=_0xba8a2a[_0x3675('0x1d')]+_0xba8a2a['limit'],_0x4c4017;if(_0x3bf7c5>=_0x27e5bb){_0x3bf7c5=_0x27e5bb;_0x4c4017=0xc8;}else{_0x4c4017=0xce;}_0x185f30[_0x3675('0x1b')](_0x4c4017);return _0x185f30[_0x3675('0x1e')]('Content-Range',_0x510233+'-'+_0x3bf7c5+'/'+_0x27e5bb)[_0x3675('0x1f')](_0x2c7b7c);}return null;};}function patchUpdates(_0x511b33){return function(_0x49292b){try{jsonpatch[_0x3675('0x20')](_0x49292b,_0x511b33,!![]);}catch(_0x54d793){return BPromise['reject'](_0x54d793);}return _0x49292b[_0x3675('0x21')]();};}function saveUpdates(_0x2f2faf,_0x44689c){return function(_0x56dad7){if(_0x56dad7){return _0x56dad7[_0x3675('0x22')](_0x2f2faf)[_0x3675('0x23')](function(_0x4834e5){return _0x4834e5;});}return null;};}function removeEntity(_0x4faa51,_0x4dcc95){return function(_0x129078){if(_0x129078){return _0x129078[_0x3675('0x24')]()[_0x3675('0x23')](function(){var _0x45f57=_0x129078[_0x3675('0x25')]({'plain':!![]});var _0x296fd4=_0x3675('0x26');return db[_0x3675('0x27')][_0x3675('0x24')]({'where':{'type':_0x296fd4,'resourceId':_0x45f57['id']}})[_0x3675('0x23')](function(){return _0x129078;});})[_0x3675('0x23')](function(){_0x4faa51['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16637e,_0x461fc9){return function(_0x47b74e){if(!_0x47b74e){_0x16637e[_0x3675('0x1a')](0x194);}return _0x47b74e;};}function handleError(_0x2a9e65,_0x4a096d){_0x4a096d=_0x4a096d||0x1f4;return function(_0x49afa9){logger['error'](_0x49afa9[_0x3675('0x28')]);if(_0x49afa9[_0x3675('0x29')]){delete _0x49afa9['name'];}_0x2a9e65[_0x3675('0x1b')](_0x4a096d)[_0x3675('0x2a')](_0x49afa9);};}exports[_0x3675('0x2b')]=function(_0x310cbb,_0x5bcb7b){var _0x55cf6a={},_0x3ab457={},_0x5d4f34={'count':0x0,'rows':[]};var _0x46efd3=_[_0x3675('0x2c')](db['SquareOdbc'][_0x3675('0x2d')],function(_0x578ace){return{'name':_0x578ace[_0x3675('0x2e')],'type':_0x578ace[_0x3675('0x2f')][_0x3675('0x30')]};});_0x3ab457[_0x3675('0x31')]=_['map'](_0x46efd3,_0x3675('0x29'));_0x3ab457[_0x3675('0x32')]=_['keys'](_0x310cbb[_0x3675('0x32')]);_0x3ab457[_0x3675('0x33')]=_[_0x3675('0x34')](_0x3ab457['model'],_0x3ab457[_0x3675('0x32')]);_0x55cf6a[_0x3675('0x35')]=_['intersection'](_0x3ab457[_0x3675('0x31')],qs[_0x3675('0x36')](_0x310cbb[_0x3675('0x32')][_0x3675('0x36')]));_0x55cf6a[_0x3675('0x35')]=_0x55cf6a[_0x3675('0x35')]['length']?_0x55cf6a[_0x3675('0x35')]:_0x3ab457[_0x3675('0x31')];if(!_0x310cbb[_0x3675('0x32')][_0x3675('0x37')](_0x3675('0x38'))){_0x55cf6a[_0x3675('0x39')]=qs['limit'](_0x310cbb[_0x3675('0x32')][_0x3675('0x39')]);_0x55cf6a[_0x3675('0x1d')]=qs['offset'](_0x310cbb[_0x3675('0x32')][_0x3675('0x1d')]);}_0x55cf6a['order']=qs['sort'](_0x310cbb[_0x3675('0x32')][_0x3675('0x3a')]);_0x55cf6a['where']=qs[_0x3675('0x33')](_[_0x3675('0x3b')](_0x310cbb[_0x3675('0x32')],_0x3ab457['filters']),_0x46efd3);if(_0x310cbb[_0x3675('0x32')][_0x3675('0x3c')]){_0x55cf6a[_0x3675('0x3d')]=_[_0x3675('0x3e')](_0x55cf6a[_0x3675('0x3d')],{'$or':_['map'](_0x46efd3,function(_0x55b7c7){if(_0x55b7c7['type']!=='VIRTUAL'){var _0x2cfa5e={};_0x2cfa5e[_0x55b7c7[_0x3675('0x29')]]={'$like':'%'+_0x310cbb[_0x3675('0x32')][_0x3675('0x3c')]+'%'};return _0x2cfa5e;}})});}_0x55cf6a=_['merge']({},_0x55cf6a,_0x310cbb[_0x3675('0x3f')]);var _0x2037ba={'where':_0x55cf6a[_0x3675('0x3d')]};return db[_0x3675('0x40')][_0x3675('0x1c')](_0x2037ba)[_0x3675('0x23')](function(_0x1af3a6){_0x5d4f34[_0x3675('0x1c')]=_0x1af3a6;if(_0x310cbb[_0x3675('0x32')][_0x3675('0x41')]){_0x55cf6a['include']=[{'all':!![]}];}return db[_0x3675('0x40')]['findAll'](_0x55cf6a);})['then'](function(_0x45c947){_0x5d4f34['rows']=_0x45c947;return _0x5d4f34;})[_0x3675('0x23')](respondWithFilteredResult(_0x5bcb7b,_0x55cf6a))[_0x3675('0x42')](handleError(_0x5bcb7b,null));};exports['show']=function(_0x2fc574,_0x5356aa){var _0x1f5669={'raw':!![],'where':{'id':_0x2fc574['params']['id']}},_0x3c4b13={};_0x3c4b13[_0x3675('0x31')]=_[_0x3675('0x43')](db[_0x3675('0x40')][_0x3675('0x2d')]);_0x3c4b13[_0x3675('0x32')]=_['keys'](_0x2fc574[_0x3675('0x32')]);_0x3c4b13[_0x3675('0x33')]=_[_0x3675('0x34')](_0x3c4b13[_0x3675('0x31')],_0x3c4b13['query']);_0x1f5669[_0x3675('0x35')]=_[_0x3675('0x34')](_0x3c4b13[_0x3675('0x31')],qs[_0x3675('0x36')](_0x2fc574['query']['fields']));_0x1f5669[_0x3675('0x35')]=_0x1f5669[_0x3675('0x35')][_0x3675('0x44')]?_0x1f5669[_0x3675('0x35')]:_0x3c4b13[_0x3675('0x31')];if(_0x2fc574['query'][_0x3675('0x41')]){_0x1f5669[_0x3675('0x45')]=[{'all':!![]}];}_0x1f5669=_[_0x3675('0x3e')]({},_0x1f5669,_0x2fc574['options']);return db[_0x3675('0x40')][_0x3675('0x46')](_0x1f5669)[_0x3675('0x23')](handleEntityNotFound(_0x5356aa,null))['then'](respondWithResult(_0x5356aa,null))[_0x3675('0x42')](handleError(_0x5356aa,null));};exports['create']=function(_0x23b6b9,_0x45f3c9){return db[_0x3675('0x40')][_0x3675('0x47')](_0x23b6b9[_0x3675('0x48')],{})[_0x3675('0x23')](function(_0x5420a1){var _0x497e48=_0x23b6b9[_0x3675('0x49')][_0x3675('0x25')]({'plain':!![]});if(!_0x497e48)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x497e48[_0x3675('0x4a')]==='user'){var _0x14d9e1=_0x5420a1[_0x3675('0x25')]({'plain':!![]});var _0x2f69cc=_0x3675('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x2f69cc,'userProfileId':_0x497e48[_0x3675('0x4b')]},'raw':!![]})[_0x3675('0x23')](function(_0x5d6c3b){if(_0x5d6c3b&&_0x5d6c3b['autoAssociation']===0x0){return db[_0x3675('0x27')][_0x3675('0x47')]({'name':_0x14d9e1[_0x3675('0x29')],'resourceId':_0x14d9e1['id'],'type':_0x5d6c3b[_0x3675('0x29')],'sectionId':_0x5d6c3b['id']},{})['then'](function(){return _0x5420a1;});}else{return _0x5420a1;}})['catch'](function(_0x1abe28){logger[_0x3675('0x4c')](_0x3675('0x4d'),_0x1abe28);throw _0x1abe28;});}return _0x5420a1;})[_0x3675('0x23')](respondWithResult(_0x45f3c9,0xc9))[_0x3675('0x42')](handleError(_0x45f3c9,null));};exports[_0x3675('0x22')]=function(_0x539080,_0x2f4118){if(_0x539080['body']['id']){delete _0x539080[_0x3675('0x48')]['id'];}return db[_0x3675('0x40')][_0x3675('0x46')]({'where':{'id':_0x539080[_0x3675('0x4e')]['id']}})[_0x3675('0x23')](handleEntityNotFound(_0x2f4118,null))[_0x3675('0x23')](saveUpdates(_0x539080[_0x3675('0x48')],null))[_0x3675('0x23')](respondWithResult(_0x2f4118,null))[_0x3675('0x42')](handleError(_0x2f4118,null));};exports[_0x3675('0x24')]=function(_0x1d017e,_0x3e4024){return db[_0x3675('0x40')][_0x3675('0x46')]({'where':{'id':_0x1d017e['params']['id']}})[_0x3675('0x23')](handleEntityNotFound(_0x3e4024,null))['then'](removeEntity(_0x3e4024,null))['catch'](handleError(_0x3e4024,null));};exports[_0x3675('0x4f')]=function(_0x249e1a,_0x196ce2,_0x4309d6){var _0x245a30;return db[_0x3675('0x40')][_0x3675('0x46')]({'where':{'id':_0x249e1a['params']['id']},'attributes':['id','dsn']})[_0x3675('0x23')](handleEntityNotFound(_0x196ce2,null))['then'](function(_0x3a8202){if(_0x3a8202){var _0x3cec82=require(_0x3675('0x50'))();_0x3cec82['openSync'](_0x3a8202['dsn']);_0x3cec82['closeSync']();return _0x3a8202;}})[_0x3675('0x23')](respondWithResult(_0x196ce2,null))[_0x3675('0x42')](handleError(_0x196ce2,null));}; \ No newline at end of file +var _0x7e9f=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','offset','limit','status','Content-Range','json','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','params','attributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1b6ab9,_0x44c97b){var _0x5b6504=function(_0x4f6323){while(--_0x4f6323){_0x1b6ab9['push'](_0x1b6ab9['shift']());}};_0x5b6504(++_0x44c97b);}(_0x7e9f,0xf2));var _0xf7e9=function(_0x50b0f7,_0x1d2a00){_0x50b0f7=_0x50b0f7-0x0;var _0x38e514=_0x7e9f[_0x50b0f7];return _0x38e514;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf7e9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf7e9('0x1'));var rp=require(_0xf7e9('0x2'));var moment=require(_0xf7e9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf7e9('0x4'));var util=require(_0xf7e9('0x5'));var path=require(_0xf7e9('0x6'));var sox=require('sox');var csv=require(_0xf7e9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf7e9('0x8'));var _=require(_0xf7e9('0x9'));var squel=require(_0xf7e9('0xa'));var crypto=require(_0xf7e9('0xb'));var jsforce=require(_0xf7e9('0xc'));var deskjs=require(_0xf7e9('0xd'));var toCsv=require(_0xf7e9('0x7'));var querystring=require(_0xf7e9('0xe'));var Papa=require(_0xf7e9('0xf'));var Redis=require(_0xf7e9('0x10'));var authService=require(_0xf7e9('0x11'));var qs=require(_0xf7e9('0x12'));var as=require(_0xf7e9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf7e9('0x14'))(_0xf7e9('0x15'));var utils=require(_0xf7e9('0x16'));var config=require(_0xf7e9('0x17'));var licenseUtil=require(_0xf7e9('0x18'));var db=require(_0xf7e9('0x19'))['db'];function respondWithStatusCode(_0x3a1585,_0x3274ff){_0x3274ff=_0x3274ff||0xcc;return function(_0x4d4f6e){if(_0x4d4f6e){return _0x3a1585['sendStatus'](_0x3274ff);}return _0x3a1585['status'](_0x3274ff)[_0xf7e9('0x1a')]();};}function respondWithResult(_0x20184b,_0x2785ed){_0x2785ed=_0x2785ed||0xc8;return function(_0x3fe8b0){if(_0x3fe8b0){return _0x20184b['status'](_0x2785ed)['json'](_0x3fe8b0);}};}function respondWithFilteredResult(_0x1bef4f,_0x5d1cf3){return function(_0x14ff33){if(_0x14ff33){var _0x3ae1fc=_0x14ff33['count'],_0x1e9168=_0x5d1cf3[_0xf7e9('0x1b')],_0x1b26f2=_0x5d1cf3[_0xf7e9('0x1b')]+_0x5d1cf3[_0xf7e9('0x1c')],_0x4b6e11;if(_0x1b26f2>=_0x3ae1fc){_0x1b26f2=_0x3ae1fc;_0x4b6e11=0xc8;}else{_0x4b6e11=0xce;}_0x1bef4f[_0xf7e9('0x1d')](_0x4b6e11);return _0x1bef4f['set'](_0xf7e9('0x1e'),_0x1e9168+'-'+_0x1b26f2+'/'+_0x3ae1fc)[_0xf7e9('0x1f')](_0x14ff33);}return null;};}function patchUpdates(_0x8a99df){return function(_0x3a0fbb){try{jsonpatch[_0xf7e9('0x20')](_0x3a0fbb,_0x8a99df,!![]);}catch(_0x229c1d){return BPromise['reject'](_0x229c1d);}return _0x3a0fbb[_0xf7e9('0x21')]();};}function saveUpdates(_0x1e4011,_0x1326f5){return function(_0x4ae2de){if(_0x4ae2de){return _0x4ae2de[_0xf7e9('0x22')](_0x1e4011)[_0xf7e9('0x23')](function(_0x5cdeac){return _0x5cdeac;});}return null;};}function removeEntity(_0x256e5d,_0x5c3f8d){return function(_0x5dfb16){if(_0x5dfb16){return _0x5dfb16[_0xf7e9('0x24')]()[_0xf7e9('0x23')](function(){var _0x17e6ea=_0x5dfb16[_0xf7e9('0x25')]({'plain':!![]});var _0x28722b='ODBC';return db[_0xf7e9('0x26')][_0xf7e9('0x24')]({'where':{'type':_0x28722b,'resourceId':_0x17e6ea['id']}})[_0xf7e9('0x23')](function(){return _0x5dfb16;});})['then'](function(){_0x256e5d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x454503,_0x5a3638){return function(_0x3d97d3){if(!_0x3d97d3){_0x454503['sendStatus'](0x194);}return _0x3d97d3;};}function handleError(_0x2cbf65,_0x3b9f8c){_0x3b9f8c=_0x3b9f8c||0x1f4;return function(_0x474974){logger[_0xf7e9('0x27')](_0x474974[_0xf7e9('0x28')]);if(_0x474974[_0xf7e9('0x29')]){delete _0x474974[_0xf7e9('0x29')];}_0x2cbf65['status'](_0x3b9f8c)[_0xf7e9('0x2a')](_0x474974);};}exports[_0xf7e9('0x2b')]=function(_0x3f2b9f,_0x1b7ffc){var _0x558e10={},_0x537bd7={},_0x553b72={'count':0x0,'rows':[]};var _0x537309=_[_0xf7e9('0x2c')](db[_0xf7e9('0x2d')][_0xf7e9('0x2e')],function(_0x4ecb52){return{'name':_0x4ecb52[_0xf7e9('0x2f')],'type':_0x4ecb52[_0xf7e9('0x30')][_0xf7e9('0x31')]};});_0x537bd7[_0xf7e9('0x32')]=_[_0xf7e9('0x2c')](_0x537309,_0xf7e9('0x29'));_0x537bd7[_0xf7e9('0x33')]=_[_0xf7e9('0x34')](_0x3f2b9f[_0xf7e9('0x33')]);_0x537bd7[_0xf7e9('0x35')]=_[_0xf7e9('0x36')](_0x537bd7[_0xf7e9('0x32')],_0x537bd7[_0xf7e9('0x33')]);_0x558e10['attributes']=_[_0xf7e9('0x36')](_0x537bd7[_0xf7e9('0x32')],qs[_0xf7e9('0x37')](_0x3f2b9f[_0xf7e9('0x33')][_0xf7e9('0x37')]));_0x558e10['attributes']=_0x558e10['attributes'][_0xf7e9('0x38')]?_0x558e10['attributes']:_0x537bd7['model'];if(!_0x3f2b9f[_0xf7e9('0x33')]['hasOwnProperty'](_0xf7e9('0x39'))){_0x558e10[_0xf7e9('0x1c')]=qs[_0xf7e9('0x1c')](_0x3f2b9f[_0xf7e9('0x33')][_0xf7e9('0x1c')]);_0x558e10['offset']=qs['offset'](_0x3f2b9f[_0xf7e9('0x33')][_0xf7e9('0x1b')]);}_0x558e10['order']=qs[_0xf7e9('0x3a')](_0x3f2b9f[_0xf7e9('0x33')]['sort']);_0x558e10[_0xf7e9('0x3b')]=qs['filters'](_['pick'](_0x3f2b9f[_0xf7e9('0x33')],_0x537bd7[_0xf7e9('0x35')]),_0x537309);if(_0x3f2b9f[_0xf7e9('0x33')][_0xf7e9('0x3c')]){_0x558e10[_0xf7e9('0x3b')]=_[_0xf7e9('0x3d')](_0x558e10[_0xf7e9('0x3b')],{'$or':_[_0xf7e9('0x2c')](_0x537309,function(_0x1069a9){if(_0x1069a9[_0xf7e9('0x30')]!==_0xf7e9('0x3e')){var _0x156651={};_0x156651[_0x1069a9[_0xf7e9('0x29')]]={'$like':'%'+_0x3f2b9f[_0xf7e9('0x33')][_0xf7e9('0x3c')]+'%'};return _0x156651;}})});}_0x558e10=_[_0xf7e9('0x3d')]({},_0x558e10,_0x3f2b9f[_0xf7e9('0x3f')]);var _0x2fcc63={'where':_0x558e10[_0xf7e9('0x3b')]};return db[_0xf7e9('0x2d')][_0xf7e9('0x40')](_0x2fcc63)[_0xf7e9('0x23')](function(_0x4bb9bc){_0x553b72[_0xf7e9('0x40')]=_0x4bb9bc;if(_0x3f2b9f[_0xf7e9('0x33')][_0xf7e9('0x41')]){_0x558e10[_0xf7e9('0x42')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x558e10);})[_0xf7e9('0x23')](function(_0xb0bfbd){_0x553b72[_0xf7e9('0x43')]=_0xb0bfbd;return _0x553b72;})[_0xf7e9('0x23')](respondWithFilteredResult(_0x1b7ffc,_0x558e10))[_0xf7e9('0x44')](handleError(_0x1b7ffc,null));};exports['show']=function(_0x1de070,_0x56d96a){var _0x3a5e98={'raw':!![],'where':{'id':_0x1de070[_0xf7e9('0x45')]['id']}},_0x3e9dcc={};_0x3e9dcc['model']=_['keys'](db[_0xf7e9('0x2d')][_0xf7e9('0x2e')]);_0x3e9dcc[_0xf7e9('0x33')]=_[_0xf7e9('0x34')](_0x1de070[_0xf7e9('0x33')]);_0x3e9dcc[_0xf7e9('0x35')]=_[_0xf7e9('0x36')](_0x3e9dcc[_0xf7e9('0x32')],_0x3e9dcc['query']);_0x3a5e98[_0xf7e9('0x46')]=_[_0xf7e9('0x36')](_0x3e9dcc['model'],qs['fields'](_0x1de070['query'][_0xf7e9('0x37')]));_0x3a5e98[_0xf7e9('0x46')]=_0x3a5e98[_0xf7e9('0x46')][_0xf7e9('0x38')]?_0x3a5e98[_0xf7e9('0x46')]:_0x3e9dcc[_0xf7e9('0x32')];if(_0x1de070['query']['includeAll']){_0x3a5e98[_0xf7e9('0x42')]=[{'all':!![]}];}_0x3a5e98=_[_0xf7e9('0x3d')]({},_0x3a5e98,_0x1de070[_0xf7e9('0x3f')]);return db[_0xf7e9('0x2d')][_0xf7e9('0x47')](_0x3a5e98)[_0xf7e9('0x23')](handleEntityNotFound(_0x56d96a,null))[_0xf7e9('0x23')](respondWithResult(_0x56d96a,null))['catch'](handleError(_0x56d96a,null));};exports['create']=function(_0x2b3e83,_0x4c7930){return db[_0xf7e9('0x2d')][_0xf7e9('0x48')](_0x2b3e83[_0xf7e9('0x49')],{})[_0xf7e9('0x23')](function(_0x1a3043){var _0x57d317=_0x2b3e83[_0xf7e9('0x4a')][_0xf7e9('0x25')]({'plain':!![]});if(!_0x57d317)throw new Error(_0xf7e9('0x4b'));if(_0x57d317[_0xf7e9('0x4c')]==='user'){var _0x1672c2=_0x1a3043[_0xf7e9('0x25')]({'plain':!![]});var _0x42afa0=_0xf7e9('0x4d');return db[_0xf7e9('0x4e')][_0xf7e9('0x47')]({'where':{'name':_0x42afa0,'userProfileId':_0x57d317[_0xf7e9('0x4f')]},'raw':!![]})[_0xf7e9('0x23')](function(_0x3e966a){if(_0x3e966a&&_0x3e966a[_0xf7e9('0x50')]===0x0){return db[_0xf7e9('0x26')][_0xf7e9('0x48')]({'name':_0x1672c2[_0xf7e9('0x29')],'resourceId':_0x1672c2['id'],'type':_0x3e966a[_0xf7e9('0x29')],'sectionId':_0x3e966a['id']},{})[_0xf7e9('0x23')](function(){return _0x1a3043;});}else{return _0x1a3043;}})[_0xf7e9('0x44')](function(_0x4d99a8){logger['error'](_0xf7e9('0x51'),_0x4d99a8);throw _0x4d99a8;});}return _0x1a3043;})[_0xf7e9('0x23')](respondWithResult(_0x4c7930,0xc9))[_0xf7e9('0x44')](handleError(_0x4c7930,null));};exports[_0xf7e9('0x22')]=function(_0x44005a,_0x2b16cc){if(_0x44005a[_0xf7e9('0x49')]['id']){delete _0x44005a[_0xf7e9('0x49')]['id'];}return db[_0xf7e9('0x2d')][_0xf7e9('0x47')]({'where':{'id':_0x44005a[_0xf7e9('0x45')]['id']}})['then'](handleEntityNotFound(_0x2b16cc,null))[_0xf7e9('0x23')](saveUpdates(_0x44005a['body'],null))['then'](respondWithResult(_0x2b16cc,null))[_0xf7e9('0x44')](handleError(_0x2b16cc,null));};exports[_0xf7e9('0x24')]=function(_0x106169,_0x35933a){return db[_0xf7e9('0x2d')][_0xf7e9('0x47')]({'where':{'id':_0x106169['params']['id']}})[_0xf7e9('0x23')](handleEntityNotFound(_0x35933a,null))[_0xf7e9('0x23')](removeEntity(_0x35933a,null))[_0xf7e9('0x44')](handleError(_0x35933a,null));};exports[_0xf7e9('0x52')]=function(_0xfe7d7d,_0x41a9c2,_0x50e688){var _0xe72ce8;return db[_0xf7e9('0x2d')][_0xf7e9('0x47')]({'where':{'id':_0xfe7d7d['params']['id']},'attributes':['id',_0xf7e9('0x53')]})[_0xf7e9('0x23')](handleEntityNotFound(_0x41a9c2,null))[_0xf7e9('0x23')](function(_0x1d498b){if(_0x1d498b){var _0x1b0e0b=require(_0xf7e9('0x54'))();_0x1b0e0b[_0xf7e9('0x55')](_0x1d498b[_0xf7e9('0x53')]);_0x1b0e0b[_0xf7e9('0x56')]();return _0x1d498b;}})[_0xf7e9('0x23')](respondWithResult(_0x41a9c2,null))[_0xf7e9('0x44')](handleError(_0x41a9c2,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index b3ef41e..b1517ef 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 _0x5d3b=['path','../../config/environment','define','lodash','../../config/logger','api','moment','request-promise'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x5d3b,0x1d3));var _0xb5d3=function(_0x4ff71c,_0x267c27){_0x4ff71c=_0x4ff71c-0x0;var _0x430932=_0x5d3b[_0x4ff71c];return _0x430932;};'use strict';var _=require(_0xb5d3('0x0'));var util=require('util');var logger=require(_0xb5d3('0x1'))(_0xb5d3('0x2'));var moment=require(_0xb5d3('0x3'));var BPromise=require('bluebird');var rp=require(_0xb5d3('0x4'));var fs=require('fs');var path=require(_0xb5d3('0x5'));var rimraf=require('rimraf');var config=require(_0xb5d3('0x6'));var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x24a401,_0x55dd1a){return _0x24a401[_0xb5d3('0x7')]('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5493=['util','moment','bluebird','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','square_odbc'];(function(_0x1cf9ac,_0x1fd008){var _0x2cb9b4=function(_0x4cf1a7){while(--_0x4cf1a7){_0x1cf9ac['push'](_0x1cf9ac['shift']());}};_0x2cb9b4(++_0x1fd008);}(_0x5493,0x1cb));var _0x3549=function(_0x1a887c,_0x129884){_0x1a887c=_0x1a887c-0x0;var _0x9813ae=_0x5493[_0x1a887c];return _0x9813ae;};'use strict';var _=require('lodash');var util=require(_0x3549('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3549('0x1'));var BPromise=require(_0x3549('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3549('0x3'));var rimraf=require(_0x3549('0x4'));var config=require(_0x3549('0x5'));var attributes=require(_0x3549('0x6'));module[_0x3549('0x7')]=function(_0x138740,_0x129d5d){return _0x138740['define']('SquareOdbc',attributes,{'tableName':_0x3549('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 9973381..1322159 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(_0x3f95c4,_0xfe7a1){var _0x3425d7=function(_0x1d2703){while(--_0x1d2703){_0x3f95c4['push'](_0x3f95c4['shift']());}};_0x3425d7(++_0xfe7a1);}(_0xe14b,0x93));var _0xbe14=function(_0x4a70aa,_0x1f7ee8){_0x4a70aa=_0x4a70aa-0x0;var _0x345c61=_0xe14b[_0x4a70aa];return _0x345c61;};'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 _0x9957=['stringify','error','code','message','result','catch','ShowSquareOdbc','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0x4e791d,_0x2c4a2b){var _0x3ed6cb=function(_0x5d3b32){while(--_0x5d3b32){_0x4e791d['push'](_0x4e791d['shift']());}};_0x3ed6cb(++_0x2c4a2b);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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']('SquareOdbc,\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['SquareOdbc'][_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,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowSquareOdbc',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index c345426..296b404 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 _0x76ec=['../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','getUsers','post','create','addUsers','put','delete','destroy','removeUsers','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x5bb127,_0x370a8a){var _0x2611cd=function(_0x3a562d){while(--_0x3a562d){_0x5bb127['push'](_0x5bb127['shift']());}};_0x2611cd(++_0x370a8a);}(_0x76ec,0x1dd));var _0xc76e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x76ec[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0xc76e('0x0'));var path=require(_0xc76e('0x1'));var timeout=require(_0xc76e('0x2'));var express=require(_0xc76e('0x3'));var router=express['Router']();var fs_extra=require(_0xc76e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc76e('0x5'));var config=require(_0xc76e('0x6'));var controller=require(_0xc76e('0x7'));router[_0xc76e('0x8')]('/',auth[_0xc76e('0x9')](),controller[_0xc76e('0xa')]);router['get'](_0xc76e('0xb'),auth[_0xc76e('0x9')](),controller[_0xc76e('0xc')]);router[_0xc76e('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0xc76e('0xd')]);router[_0xc76e('0xe')]('/',auth[_0xc76e('0x9')](),controller[_0xc76e('0xf')]);router[_0xc76e('0xe')]('/:id/users',auth[_0xc76e('0x9')](),controller[_0xc76e('0x10')]);router[_0xc76e('0x11')](_0xc76e('0xb'),auth[_0xc76e('0x9')](),controller['update']);router[_0xc76e('0x12')](_0xc76e('0xb'),auth[_0xc76e('0x9')](),controller[_0xc76e('0x13')]);router['delete']('/:id/users',auth[_0xc76e('0x9')](),controller[_0xc76e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc60e=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','/:id','show','/:id/users','getUsers','create','addUsers','put','update','delete','destroy','removeUsers','exports','multer','path'];(function(_0x11615d,_0x2e6388){var _0x188bbf=function(_0x326b22){while(--_0x326b22){_0x11615d['push'](_0x11615d['shift']());}};_0x188bbf(++_0x2e6388);}(_0xc60e,0x1e1));var _0xec60=function(_0x4ba467,_0x48ee3a){_0x4ba467=_0x4ba467-0x0;var _0x559dff=_0xc60e[_0x4ba467];return _0x559dff;};'use strict';var multer=require(_0xec60('0x0'));var util=require('util');var path=require(_0xec60('0x1'));var timeout=require(_0xec60('0x2'));var express=require(_0xec60('0x3'));var router=express[_0xec60('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xec60('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xec60('0x6'));var controller=require(_0xec60('0x7'));router['get']('/',auth[_0xec60('0x8')](),controller[_0xec60('0x9')]);router[_0xec60('0xa')](_0xec60('0xb'),auth[_0xec60('0x8')](),controller[_0xec60('0xc')]);router[_0xec60('0xa')](_0xec60('0xd'),auth[_0xec60('0x8')](),controller[_0xec60('0xe')]);router['post']('/',auth[_0xec60('0x8')](),controller[_0xec60('0xf')]);router['post']('/:id/users',auth[_0xec60('0x8')](),controller[_0xec60('0x10')]);router[_0xec60('0x11')](_0xec60('0xb'),auth[_0xec60('0x8')](),controller[_0xec60('0x12')]);router[_0xec60('0x13')](_0xec60('0xb'),auth[_0xec60('0x8')](),controller[_0xec60('0x14')]);router[_0xec60('0x13')](_0xec60('0xd'),auth[_0xec60('0x8')](),controller[_0xec60('0x15')]);module[_0xec60('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index a52f5de..c66e5b8 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 _0x128c=['STRING','TEXT','BLOB','long','getDataValue','toString','utf8','production','DATE'];(function(_0x53e83a,_0x3e21c0){var _0x12c7a4=function(_0x5155fd){while(--_0x5155fd){_0x53e83a['push'](_0x53e83a['shift']());}};_0x12c7a4(++_0x3e21c0);}(_0x128c,0x168));var _0xc128=function(_0xb6b07d,_0x36082f){_0xb6b07d=_0xb6b07d-0x0;var _0x2880c0=_0x128c[_0xb6b07d];return _0x2880c0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc128('0x0')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xc128('0x0')]},'notes':{'type':Sequelize[_0xc128('0x1')]},'preproduction':{'type':Sequelize[_0xc128('0x2')](_0xc128('0x3')),'get':function(){if(this[_0xc128('0x4')]('preproduction')){return this[_0xc128('0x4')]('preproduction')[_0xc128('0x5')](_0xc128('0x6'));}}},'production':{'type':Sequelize[_0xc128('0x2')](_0xc128('0x3')),'get':function(){if(this[_0xc128('0x4')](_0xc128('0x7'))){return this['getDataValue'](_0xc128('0x7'))['toString'](_0xc128('0x6'));}}},'savedAt':{'type':Sequelize[_0xc128('0x8')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x06bc=['DATE','sequelize','STRING','name','BLOB','long','preproduction','getDataValue','toString','utf8','production'];(function(_0x3d742a,_0x13e4ff){var _0x26ccb9=function(_0x5e1634){while(--_0x5e1634){_0x3d742a['push'](_0x3d742a['shift']());}};_0x26ccb9(++_0x13e4ff);}(_0x06bc,0x90));var _0xc06b=function(_0x560774,_0x323b87){_0x560774=_0x560774-0x0;var _0x1b136e=_0x06bc[_0x560774];return _0x1b136e;};'use strict';var Sequelize=require(_0xc06b('0x0'));module['exports']={'name':{'type':Sequelize[_0xc06b('0x1')],'unique':_0xc06b('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xc06b('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xc06b('0x3')](_0xc06b('0x4')),'get':function(){if(this['getDataValue'](_0xc06b('0x5'))){return this[_0xc06b('0x6')](_0xc06b('0x5'))[_0xc06b('0x7')](_0xc06b('0x8'));}}},'production':{'type':Sequelize[_0xc06b('0x3')](_0xc06b('0x4')),'get':function(){if(this[_0xc06b('0x6')](_0xc06b('0x9'))){return this[_0xc06b('0x6')](_0xc06b('0x9'))['toString'](_0xc06b('0x8'));}}},'savedAt':{'type':Sequelize[_0xc06b('0xa')]},'publishedAt':{'type':Sequelize[_0xc06b('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index cf5d54a..9704169 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 _0x52ab=['../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./squareProject.socket','sendStatus','end','status','json','count','offset','set','apply','reject','save','update','then','destroy','get','SquareProjects','error','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','options','include','findAll','rows','catch','show','filters','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','addUsers','ids','isArray','emit','userSquareProject:remove','getUsers','findOne','User','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x21ab0c,_0x5b34e0){var _0x4d2625=function(_0x403e6f){while(--_0x403e6f){_0x21ab0c['push'](_0x21ab0c['shift']());}};_0x4d2625(++_0x5b34e0);}(_0x52ab,0x10f));var _0xb52a=function(_0x2439cc,_0x3ab5d8){_0x2439cc=_0x2439cc-0x0;var _0x50f07e=_0x52ab[_0x2439cc];return _0x50f07e;};'use strict';var emlformat=require(_0xb52a('0x0'));var rimraf=require(_0xb52a('0x1'));var zipdir=require(_0xb52a('0x2'));var jsonpatch=require(_0xb52a('0x3'));var rp=require('request-promise');var moment=require(_0xb52a('0x4'));var BPromise=require(_0xb52a('0x5'));var Mustache=require(_0xb52a('0x6'));var util=require(_0xb52a('0x7'));var path=require(_0xb52a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb52a('0x9'));var fs=require('fs');var fs_extra=require(_0xb52a('0xa'));var _=require(_0xb52a('0xb'));var squel=require('squel');var crypto=require(_0xb52a('0xc'));var jsforce=require(_0xb52a('0xd'));var deskjs=require(_0xb52a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb52a('0xf'));var Papa=require(_0xb52a('0x10'));var Redis=require(_0xb52a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb52a('0x12'));var hardwareService=require(_0xb52a('0x13'));var logger=require(_0xb52a('0x14'))(_0xb52a('0x15'));var utils=require(_0xb52a('0x16'));var config=require(_0xb52a('0x17'));var licenseUtil=require(_0xb52a('0x18'));var db=require(_0xb52a('0x19'))['db'];config['redis']=_[_0xb52a('0x1a')](config[_0xb52a('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xb52a('0x1c'))(new Redis(config[_0xb52a('0x1b')]));require(_0xb52a('0x1d'))['register'](socket);function respondWithStatusCode(_0x39a8ba,_0x558a6d){_0x558a6d=_0x558a6d||0xcc;return function(_0x1baee3){if(_0x1baee3){return _0x39a8ba[_0xb52a('0x1e')](_0x558a6d);}return _0x39a8ba['status'](_0x558a6d)[_0xb52a('0x1f')]();};}function respondWithResult(_0x561952,_0x4ed6f2){_0x4ed6f2=_0x4ed6f2||0xc8;return function(_0x21cabb){if(_0x21cabb){return _0x561952[_0xb52a('0x20')](_0x4ed6f2)[_0xb52a('0x21')](_0x21cabb);}};}function respondWithFilteredResult(_0x57398a,_0x5bb7f0){return function(_0x406960){if(_0x406960){var _0x21c066=_0x406960[_0xb52a('0x22')],_0x259044=_0x5bb7f0[_0xb52a('0x23')],_0x31869a=_0x5bb7f0['offset']+_0x5bb7f0['limit'],_0x16902b;if(_0x31869a>=_0x21c066){_0x31869a=_0x21c066;_0x16902b=0xc8;}else{_0x16902b=0xce;}_0x57398a[_0xb52a('0x20')](_0x16902b);return _0x57398a[_0xb52a('0x24')]('Content-Range',_0x259044+'-'+_0x31869a+'/'+_0x21c066)[_0xb52a('0x21')](_0x406960);}return null;};}function patchUpdates(_0x20337b){return function(_0x4b47e9){try{jsonpatch[_0xb52a('0x25')](_0x4b47e9,_0x20337b,!![]);}catch(_0x4d20cf){return BPromise[_0xb52a('0x26')](_0x4d20cf);}return _0x4b47e9[_0xb52a('0x27')]();};}function saveUpdates(_0x1f4bf5,_0xec6c95){return function(_0x152e78){if(_0x152e78){return _0x152e78[_0xb52a('0x28')](_0x1f4bf5)[_0xb52a('0x29')](function(_0x4993f9){return _0x4993f9;});}return null;};}function removeEntity(_0x34bfd8,_0x223324){return function(_0x4210d6){if(_0x4210d6){return _0x4210d6[_0xb52a('0x2a')]()[_0xb52a('0x29')](function(){var _0x25ed24=_0x4210d6[_0xb52a('0x2b')]({'plain':!![]});var _0x57f358=_0xb52a('0x2c');return db['UserProfileResource'][_0xb52a('0x2a')]({'where':{'type':_0x57f358,'resourceId':_0x25ed24['id']}})[_0xb52a('0x29')](function(){return _0x4210d6;});})[_0xb52a('0x29')](function(){_0x34bfd8[_0xb52a('0x20')](0xcc)[_0xb52a('0x1f')]();});}};}function handleEntityNotFound(_0x24f070,_0x187716){return function(_0x26b4bd){if(!_0x26b4bd){_0x24f070[_0xb52a('0x1e')](0x194);}return _0x26b4bd;};}function handleError(_0x214239,_0x2ef559){_0x2ef559=_0x2ef559||0x1f4;return function(_0xcd6144){logger[_0xb52a('0x2d')](_0xcd6144['stack']);if(_0xcd6144[_0xb52a('0x2e')]){delete _0xcd6144['name'];}_0x214239[_0xb52a('0x20')](_0x2ef559)[_0xb52a('0x2f')](_0xcd6144);};}exports[_0xb52a('0x30')]=function(_0x4d5fc0,_0x5a1113){var _0x221246={},_0x2aaea5={},_0x5809d0={'count':0x0,'rows':[]};var _0x4ac9cd=_[_0xb52a('0x31')](db[_0xb52a('0x32')][_0xb52a('0x33')],function(_0x6673ad){return{'name':_0x6673ad[_0xb52a('0x34')],'type':_0x6673ad[_0xb52a('0x35')][_0xb52a('0x36')]};});_0x2aaea5['model']=_[_0xb52a('0x31')](_0x4ac9cd,_0xb52a('0x2e'));_0x2aaea5[_0xb52a('0x37')]=_[_0xb52a('0x38')](_0x4d5fc0[_0xb52a('0x37')]);_0x2aaea5['filters']=_['intersection'](_0x2aaea5['model'],_0x2aaea5[_0xb52a('0x37')]);_0x221246['attributes']=_[_0xb52a('0x39')](_0x2aaea5[_0xb52a('0x3a')],qs[_0xb52a('0x3b')](_0x4d5fc0[_0xb52a('0x37')][_0xb52a('0x3b')]));_0x221246[_0xb52a('0x3c')]=_0x221246[_0xb52a('0x3c')]['length']?_0x221246[_0xb52a('0x3c')]:_0x2aaea5[_0xb52a('0x3a')];if(!_0x4d5fc0[_0xb52a('0x37')]['hasOwnProperty'](_0xb52a('0x3d'))){_0x221246[_0xb52a('0x3e')]=qs[_0xb52a('0x3e')](_0x4d5fc0[_0xb52a('0x37')][_0xb52a('0x3e')]);_0x221246[_0xb52a('0x23')]=qs[_0xb52a('0x23')](_0x4d5fc0[_0xb52a('0x37')][_0xb52a('0x23')]);}_0x221246[_0xb52a('0x3f')]=qs[_0xb52a('0x40')](_0x4d5fc0[_0xb52a('0x37')]['sort']);_0x221246['where']=qs['filters'](_[_0xb52a('0x41')](_0x4d5fc0['query'],_0x2aaea5['filters']),_0x4ac9cd);if(_0x4d5fc0['query'][_0xb52a('0x42')]){_0x221246[_0xb52a('0x43')]=_['merge'](_0x221246[_0xb52a('0x43')],{'$or':_[_0xb52a('0x31')](_0x4ac9cd,function(_0x59cc57){if(_0x59cc57[_0xb52a('0x35')]!==_0xb52a('0x44')){var _0x41d290={};_0x41d290[_0x59cc57[_0xb52a('0x2e')]]={'$like':'%'+_0x4d5fc0[_0xb52a('0x37')][_0xb52a('0x42')]+'%'};return _0x41d290;}})});}_0x221246=_['merge']({},_0x221246,_0x4d5fc0[_0xb52a('0x45')]);var _0x38ab2d={'where':_0x221246['where']};return db['SquareProject'][_0xb52a('0x22')](_0x38ab2d)['then'](function(_0x36ea62){_0x5809d0[_0xb52a('0x22')]=_0x36ea62;if(_0x4d5fc0[_0xb52a('0x37')]['includeAll']){_0x221246[_0xb52a('0x46')]=[{'all':!![]}];}return db['SquareProject'][_0xb52a('0x47')](_0x221246);})[_0xb52a('0x29')](function(_0x2614cc){_0x5809d0[_0xb52a('0x48')]=_0x2614cc;return _0x5809d0;})['then'](respondWithFilteredResult(_0x5a1113,_0x221246))[_0xb52a('0x49')](handleError(_0x5a1113,null));};exports[_0xb52a('0x4a')]=function(_0x9ce59,_0x2d8c29){var _0x4b4d8c={'raw':![],'where':{'id':_0x9ce59['params']['id']}},_0x42af3a={};_0x42af3a[_0xb52a('0x3a')]=_[_0xb52a('0x38')](db['SquareProject'][_0xb52a('0x33')]);_0x42af3a[_0xb52a('0x37')]=_[_0xb52a('0x38')](_0x9ce59[_0xb52a('0x37')]);_0x42af3a[_0xb52a('0x4b')]=_[_0xb52a('0x39')](_0x42af3a['model'],_0x42af3a['query']);_0x4b4d8c[_0xb52a('0x3c')]=_['intersection'](_0x42af3a[_0xb52a('0x3a')],qs[_0xb52a('0x3b')](_0x9ce59[_0xb52a('0x37')]['fields']));_0x4b4d8c[_0xb52a('0x3c')]=_0x4b4d8c[_0xb52a('0x3c')][_0xb52a('0x4c')]?_0x4b4d8c[_0xb52a('0x3c')]:_0x42af3a['model'];if(_0x9ce59['query'][_0xb52a('0x4d')]){_0x4b4d8c[_0xb52a('0x46')]=[{'all':!![]}];}_0x4b4d8c=_[_0xb52a('0x4e')]({},_0x4b4d8c,_0x9ce59[_0xb52a('0x45')]);return db[_0xb52a('0x32')][_0xb52a('0x4f')](_0x4b4d8c)['then'](handleEntityNotFound(_0x2d8c29,null))[_0xb52a('0x29')](respondWithResult(_0x2d8c29,null))[_0xb52a('0x49')](handleError(_0x2d8c29,null));};exports[_0xb52a('0x50')]=function(_0x4c2b43,_0x489d72){return db[_0xb52a('0x32')]['create'](_0x4c2b43[_0xb52a('0x51')],{})[_0xb52a('0x29')](function(_0x522b72){var _0x29f669=_0x4c2b43[_0xb52a('0x52')][_0xb52a('0x2b')]({'plain':!![]});if(!_0x29f669)throw new Error(_0xb52a('0x53'));if(_0x29f669[_0xb52a('0x54')]===_0xb52a('0x52')){var _0x238601=_0x522b72[_0xb52a('0x2b')]({'plain':!![]});var _0x32b862=_0xb52a('0x2c');return db[_0xb52a('0x55')][_0xb52a('0x4f')]({'where':{'name':_0x32b862,'userProfileId':_0x29f669[_0xb52a('0x56')]},'raw':!![]})[_0xb52a('0x29')](function(_0x2cd5e0){if(_0x2cd5e0&&_0x2cd5e0[_0xb52a('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x238601[_0xb52a('0x2e')],'resourceId':_0x238601['id'],'type':_0x2cd5e0[_0xb52a('0x2e')],'sectionId':_0x2cd5e0['id']},{})[_0xb52a('0x29')](function(){return _0x522b72;});}else{return _0x522b72;}})['catch'](function(_0x50d391){logger[_0xb52a('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50d391);throw _0x50d391;});}return _0x522b72;})[_0xb52a('0x29')](respondWithResult(_0x489d72,0xc9))['catch'](handleError(_0x489d72,null));};exports[_0xb52a('0x28')]=function(_0x3bb178,_0x2ddf33){if(_0x3bb178[_0xb52a('0x51')]['id']){delete _0x3bb178['body']['id'];}return db['SquareProject'][_0xb52a('0x4f')]({'where':{'id':_0x3bb178[_0xb52a('0x58')]['id']}})[_0xb52a('0x29')](handleEntityNotFound(_0x2ddf33,null))[_0xb52a('0x29')](saveUpdates(_0x3bb178['body'],null))[_0xb52a('0x29')](respondWithResult(_0x2ddf33,null))['catch'](handleError(_0x2ddf33,null));};exports['destroy']=function(_0x285f89,_0x4c91aa){return db[_0xb52a('0x32')][_0xb52a('0x4f')]({'where':{'id':_0x285f89[_0xb52a('0x58')]['id']}})['then'](handleEntityNotFound(_0x4c91aa,null))[_0xb52a('0x29')](removeEntity(_0x4c91aa,null))['catch'](handleError(_0x4c91aa,null));};exports[_0xb52a('0x59')]=function(_0x5dce60,_0x49587f,_0x156ed3){return db[_0xb52a('0x32')][_0xb52a('0x4f')]({'where':{'id':_0x5dce60[_0xb52a('0x58')]['id']}})['then'](handleEntityNotFound(_0x49587f,null))['then'](function(_0x673e8d){if(_0x673e8d){return _0x673e8d[_0xb52a('0x59')](_0x5dce60['body'][_0xb52a('0x5a')],_['omit'](_0x5dce60['body'],[_0xb52a('0x5a'),'id'])||{});}})[_0xb52a('0x29')](respondWithResult(_0x49587f,null))[_0xb52a('0x49')](handleError(_0x49587f,null));};exports['removeUsers']=function(_0x592e7e,_0x1d7a8f,_0x45ab99){return db[_0xb52a('0x32')][_0xb52a('0x4f')]({'where':{'id':_0x592e7e[_0xb52a('0x58')]['id']}})[_0xb52a('0x29')](handleEntityNotFound(_0x1d7a8f,null))['then'](function(_0x47731d){if(_0x47731d){return _0x47731d['removeUsers'](_0x592e7e[_0xb52a('0x37')]['ids'])[_0xb52a('0x29')](function(){if(_[_0xb52a('0x5b')](_0x592e7e[_0xb52a('0x37')][_0xb52a('0x5a')])){for(var _0x4206c0=0x0;_0x4206c0<_0x592e7e['query'][_0xb52a('0x5a')][_0xb52a('0x4c')];_0x4206c0+=0x1){socket[_0xb52a('0x5c')](_0xb52a('0x5d'),{'UserId':Number(_0x592e7e['query']['ids'][_0x4206c0]),'SquareProjectId':Number(_0x592e7e[_0xb52a('0x58')]['id'])});}}else{socket['emit']('userSquareProject:remove',{'UserId':Number(_0x592e7e[_0xb52a('0x37')][_0xb52a('0x5a')]),'SquareProjectId':Number(_0x592e7e[_0xb52a('0x58')]['id'])});}});}})[_0xb52a('0x29')](respondWithStatusCode(_0x1d7a8f,null))[_0xb52a('0x49')](handleError(_0x1d7a8f,null));};exports[_0xb52a('0x5e')]=function(_0x561982,_0x314a74,_0x46db2e){var _0x45c21f={};var _0x1ec969={};var _0x58482b;var _0x5463b3;return db[_0xb52a('0x32')][_0xb52a('0x5f')]({'where':{'id':_0x561982['params']['id']}})[_0xb52a('0x29')](handleEntityNotFound(_0x314a74,null))[_0xb52a('0x29')](function(_0x383977){if(_0x383977){_0x58482b=_0x383977;_0x1ec969[_0xb52a('0x3a')]=_[_0xb52a('0x38')](db[_0xb52a('0x60')][_0xb52a('0x33')]);_0x1ec969[_0xb52a('0x37')]=_[_0xb52a('0x38')](_0x561982[_0xb52a('0x37')]);_0x1ec969['filters']=_[_0xb52a('0x39')](_0x1ec969[_0xb52a('0x3a')],_0x1ec969[_0xb52a('0x37')]);_0x45c21f[_0xb52a('0x3c')]=_[_0xb52a('0x39')](_0x1ec969[_0xb52a('0x3a')],qs[_0xb52a('0x3b')](_0x561982['query'][_0xb52a('0x3b')]));_0x45c21f['attributes']=_0x45c21f['attributes'][_0xb52a('0x4c')]?_0x45c21f['attributes']:_0x1ec969[_0xb52a('0x3a')];_0x45c21f['order']=qs[_0xb52a('0x40')](_0x561982[_0xb52a('0x37')][_0xb52a('0x40')]);_0x45c21f[_0xb52a('0x43')]=qs[_0xb52a('0x4b')](_[_0xb52a('0x41')](_0x561982[_0xb52a('0x37')],_0x1ec969[_0xb52a('0x4b')]));if(_0x561982['query'][_0xb52a('0x42')]){_0x45c21f[_0xb52a('0x43')]=_['merge'](_0x45c21f[_0xb52a('0x43')],{'$or':_[_0xb52a('0x31')](_0x45c21f[_0xb52a('0x3c')],function(_0x35ba41){var _0x59fc9c={};_0x59fc9c[_0x35ba41]={'$like':'%'+_0x561982['query'][_0xb52a('0x42')]+'%'};return _0x59fc9c;})});}_0x45c21f=_[_0xb52a('0x4e')]({},_0x45c21f,_0x561982['options']);return _0x58482b[_0xb52a('0x5e')](_0x45c21f);}})['then'](function(_0x47d2b1){if(_0x47d2b1){_0x5463b3=_0x47d2b1[_0xb52a('0x4c')];if(!_0x561982[_0xb52a('0x37')][_0xb52a('0x61')](_0xb52a('0x3d'))){_0x45c21f['limit']=qs[_0xb52a('0x3e')](_0x561982[_0xb52a('0x37')][_0xb52a('0x3e')]);_0x45c21f['offset']=qs[_0xb52a('0x23')](_0x561982[_0xb52a('0x37')][_0xb52a('0x23')]);}return _0x58482b[_0xb52a('0x5e')](_0x45c21f);}})[_0xb52a('0x29')](function(_0x34361a){if(_0x34361a){return _0x34361a?{'count':_0x5463b3,'rows':_0x34361a}:null;}})[_0xb52a('0x29')](respondWithResult(_0x314a74,null))['catch'](handleError(_0x314a74,null));}; \ No newline at end of file +var _0x0556=['fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','register','sendStatus','status','json','count','offset','set','Content-Range','apply','save','update','then','destroy','SquareProjects','end','error','stack','send','SquareProject','model','map','name','query','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','ids','isArray','emit','userSquareProject:remove','getUsers','User','order','pick','nolimit','eml-format','rimraf','fast-json-patch','request-promise','util','path','to-csv','ejs'];(function(_0x55f47b,_0x58b84b){var _0x163c2e=function(_0x1662b6){while(--_0x1662b6){_0x55f47b['push'](_0x55f47b['shift']());}};_0x163c2e(++_0x58b84b);}(_0x0556,0x160));var _0x6055=function(_0xb68695,_0x1881a4){_0xb68695=_0xb68695-0x0;var _0x15a817=_0x0556[_0xb68695];return _0x15a817;};'use strict';var emlformat=require(_0x6055('0x0'));var rimraf=require(_0x6055('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6055('0x2'));var rp=require(_0x6055('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6055('0x4'));var path=require(_0x6055('0x5'));var sox=require('sox');var csv=require(_0x6055('0x6'));var ejs=require(_0x6055('0x7'));var fs=require('fs');var fs_extra=require(_0x6055('0x8'));var _=require(_0x6055('0x9'));var squel=require(_0x6055('0xa'));var crypto=require('crypto');var jsforce=require(_0x6055('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6055('0xc'));var Papa=require(_0x6055('0xd'));var Redis=require(_0x6055('0xe'));var authService=require(_0x6055('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6055('0x10'));var logger=require('../../config/logger')(_0x6055('0x11'));var utils=require(_0x6055('0x12'));var config=require(_0x6055('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6055('0x14'))['db'];config[_0x6055('0x15')]=_[_0x6055('0x16')](config[_0x6055('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x6055('0x17'))(new Redis(config['redis']));require(_0x6055('0x18'))[_0x6055('0x19')](socket);function respondWithStatusCode(_0x373085,_0x382faa){_0x382faa=_0x382faa||0xcc;return function(_0x47b153){if(_0x47b153){return _0x373085[_0x6055('0x1a')](_0x382faa);}return _0x373085['status'](_0x382faa)['end']();};}function respondWithResult(_0x32cf21,_0x55ced8){_0x55ced8=_0x55ced8||0xc8;return function(_0x198511){if(_0x198511){return _0x32cf21[_0x6055('0x1b')](_0x55ced8)[_0x6055('0x1c')](_0x198511);}};}function respondWithFilteredResult(_0x3e4c04,_0x52829c){return function(_0x14aac0){if(_0x14aac0){var _0x4f342e=_0x14aac0[_0x6055('0x1d')],_0xda205a=_0x52829c[_0x6055('0x1e')],_0x8395f0=_0x52829c[_0x6055('0x1e')]+_0x52829c['limit'],_0x1867c2;if(_0x8395f0>=_0x4f342e){_0x8395f0=_0x4f342e;_0x1867c2=0xc8;}else{_0x1867c2=0xce;}_0x3e4c04['status'](_0x1867c2);return _0x3e4c04[_0x6055('0x1f')](_0x6055('0x20'),_0xda205a+'-'+_0x8395f0+'/'+_0x4f342e)[_0x6055('0x1c')](_0x14aac0);}return null;};}function patchUpdates(_0x173da0){return function(_0x3f5eed){try{jsonpatch[_0x6055('0x21')](_0x3f5eed,_0x173da0,!![]);}catch(_0x4e4e47){return BPromise['reject'](_0x4e4e47);}return _0x3f5eed[_0x6055('0x22')]();};}function saveUpdates(_0x3ac59c,_0x2d0518){return function(_0x52220f){if(_0x52220f){return _0x52220f[_0x6055('0x23')](_0x3ac59c)[_0x6055('0x24')](function(_0x3768eb){return _0x3768eb;});}return null;};}function removeEntity(_0x212feb,_0x3496c9){return function(_0x7965fa){if(_0x7965fa){return _0x7965fa[_0x6055('0x25')]()[_0x6055('0x24')](function(){var _0x5eb5bd=_0x7965fa['get']({'plain':!![]});var _0x1882bd=_0x6055('0x26');return db['UserProfileResource'][_0x6055('0x25')]({'where':{'type':_0x1882bd,'resourceId':_0x5eb5bd['id']}})['then'](function(){return _0x7965fa;});})[_0x6055('0x24')](function(){_0x212feb['status'](0xcc)[_0x6055('0x27')]();});}};}function handleEntityNotFound(_0x44022f,_0x2255d2){return function(_0x4513ab){if(!_0x4513ab){_0x44022f[_0x6055('0x1a')](0x194);}return _0x4513ab;};}function handleError(_0x4c87e6,_0x2a0b20){_0x2a0b20=_0x2a0b20||0x1f4;return function(_0x328a7e){logger[_0x6055('0x28')](_0x328a7e[_0x6055('0x29')]);if(_0x328a7e['name']){delete _0x328a7e['name'];}_0x4c87e6[_0x6055('0x1b')](_0x2a0b20)[_0x6055('0x2a')](_0x328a7e);};}exports['index']=function(_0x344fae,_0x2f1134){var _0x4f738a={},_0x45a7c9={},_0xac8197={'count':0x0,'rows':[]};var _0x2181e7=_['map'](db[_0x6055('0x2b')]['rawAttributes'],function(_0x8ccc49){return{'name':_0x8ccc49['fieldName'],'type':_0x8ccc49['type']['key']};});_0x45a7c9[_0x6055('0x2c')]=_[_0x6055('0x2d')](_0x2181e7,_0x6055('0x2e'));_0x45a7c9[_0x6055('0x2f')]=_['keys'](_0x344fae[_0x6055('0x2f')]);_0x45a7c9[_0x6055('0x30')]=_[_0x6055('0x31')](_0x45a7c9[_0x6055('0x2c')],_0x45a7c9[_0x6055('0x2f')]);_0x4f738a[_0x6055('0x32')]=_[_0x6055('0x31')](_0x45a7c9[_0x6055('0x2c')],qs['fields'](_0x344fae['query'][_0x6055('0x33')]));_0x4f738a[_0x6055('0x32')]=_0x4f738a['attributes']['length']?_0x4f738a[_0x6055('0x32')]:_0x45a7c9[_0x6055('0x2c')];if(!_0x344fae['query'][_0x6055('0x34')]('nolimit')){_0x4f738a[_0x6055('0x35')]=qs[_0x6055('0x35')](_0x344fae[_0x6055('0x2f')]['limit']);_0x4f738a[_0x6055('0x1e')]=qs[_0x6055('0x1e')](_0x344fae[_0x6055('0x2f')]['offset']);}_0x4f738a['order']=qs[_0x6055('0x36')](_0x344fae[_0x6055('0x2f')][_0x6055('0x36')]);_0x4f738a['where']=qs['filters'](_['pick'](_0x344fae[_0x6055('0x2f')],_0x45a7c9[_0x6055('0x30')]),_0x2181e7);if(_0x344fae[_0x6055('0x2f')][_0x6055('0x37')]){_0x4f738a[_0x6055('0x38')]=_[_0x6055('0x39')](_0x4f738a[_0x6055('0x38')],{'$or':_['map'](_0x2181e7,function(_0x216fe2){if(_0x216fe2[_0x6055('0x3a')]!==_0x6055('0x3b')){var _0x18714f={};_0x18714f[_0x216fe2['name']]={'$like':'%'+_0x344fae['query'][_0x6055('0x37')]+'%'};return _0x18714f;}})});}_0x4f738a=_[_0x6055('0x39')]({},_0x4f738a,_0x344fae[_0x6055('0x3c')]);var _0x33d43e={'where':_0x4f738a[_0x6055('0x38')]};return db[_0x6055('0x2b')][_0x6055('0x1d')](_0x33d43e)[_0x6055('0x24')](function(_0x47f104){_0xac8197['count']=_0x47f104;if(_0x344fae[_0x6055('0x2f')][_0x6055('0x3d')]){_0x4f738a['include']=[{'all':!![]}];}return db[_0x6055('0x2b')][_0x6055('0x3e')](_0x4f738a);})['then'](function(_0x3ba622){_0xac8197[_0x6055('0x3f')]=_0x3ba622;return _0xac8197;})[_0x6055('0x24')](respondWithFilteredResult(_0x2f1134,_0x4f738a))[_0x6055('0x40')](handleError(_0x2f1134,null));};exports[_0x6055('0x41')]=function(_0x7cc71,_0x5bf50e){var _0x35c8b1={'raw':![],'where':{'id':_0x7cc71[_0x6055('0x42')]['id']}},_0x2914af={};_0x2914af['model']=_[_0x6055('0x43')](db['SquareProject'][_0x6055('0x44')]);_0x2914af[_0x6055('0x2f')]=_[_0x6055('0x43')](_0x7cc71[_0x6055('0x2f')]);_0x2914af[_0x6055('0x30')]=_[_0x6055('0x31')](_0x2914af[_0x6055('0x2c')],_0x2914af[_0x6055('0x2f')]);_0x35c8b1['attributes']=_['intersection'](_0x2914af[_0x6055('0x2c')],qs[_0x6055('0x33')](_0x7cc71[_0x6055('0x2f')]['fields']));_0x35c8b1['attributes']=_0x35c8b1[_0x6055('0x32')][_0x6055('0x45')]?_0x35c8b1[_0x6055('0x32')]:_0x2914af[_0x6055('0x2c')];if(_0x7cc71[_0x6055('0x2f')][_0x6055('0x3d')]){_0x35c8b1['include']=[{'all':!![]}];}_0x35c8b1=_[_0x6055('0x39')]({},_0x35c8b1,_0x7cc71[_0x6055('0x3c')]);return db['SquareProject'][_0x6055('0x46')](_0x35c8b1)[_0x6055('0x24')](handleEntityNotFound(_0x5bf50e,null))[_0x6055('0x24')](respondWithResult(_0x5bf50e,null))['catch'](handleError(_0x5bf50e,null));};exports[_0x6055('0x47')]=function(_0x8bfa2c,_0x262685){return db[_0x6055('0x2b')][_0x6055('0x47')](_0x8bfa2c['body'],{})[_0x6055('0x24')](function(_0x39bbdd){var _0x4f87a8=_0x8bfa2c[_0x6055('0x48')][_0x6055('0x49')]({'plain':!![]});if(!_0x4f87a8)throw new Error(_0x6055('0x4a'));if(_0x4f87a8[_0x6055('0x4b')]===_0x6055('0x48')){var _0x323d43=_0x39bbdd[_0x6055('0x49')]({'plain':!![]});var _0x4b2cd1=_0x6055('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x4b2cd1,'userProfileId':_0x4f87a8[_0x6055('0x4c')]},'raw':!![]})['then'](function(_0x49fc53){if(_0x49fc53&&_0x49fc53[_0x6055('0x4d')]===0x0){return db['UserProfileResource'][_0x6055('0x47')]({'name':_0x323d43[_0x6055('0x2e')],'resourceId':_0x323d43['id'],'type':_0x49fc53[_0x6055('0x2e')],'sectionId':_0x49fc53['id']},{})[_0x6055('0x24')](function(){return _0x39bbdd;});}else{return _0x39bbdd;}})[_0x6055('0x40')](function(_0x11f01e){logger['error'](_0x6055('0x4e'),_0x11f01e);throw _0x11f01e;});}return _0x39bbdd;})[_0x6055('0x24')](respondWithResult(_0x262685,0xc9))[_0x6055('0x40')](handleError(_0x262685,null));};exports[_0x6055('0x23')]=function(_0x6eb72f,_0x3f5b7e){if(_0x6eb72f['body']['id']){delete _0x6eb72f['body']['id'];}return db[_0x6055('0x2b')][_0x6055('0x46')]({'where':{'id':_0x6eb72f['params']['id']}})[_0x6055('0x24')](handleEntityNotFound(_0x3f5b7e,null))[_0x6055('0x24')](saveUpdates(_0x6eb72f[_0x6055('0x4f')],null))[_0x6055('0x24')](respondWithResult(_0x3f5b7e,null))[_0x6055('0x40')](handleError(_0x3f5b7e,null));};exports[_0x6055('0x25')]=function(_0x247880,_0x32a565){return db[_0x6055('0x2b')][_0x6055('0x46')]({'where':{'id':_0x247880['params']['id']}})['then'](handleEntityNotFound(_0x32a565,null))[_0x6055('0x24')](removeEntity(_0x32a565,null))['catch'](handleError(_0x32a565,null));};exports['addUsers']=function(_0x31084b,_0x4398ad,_0x3224ff){return db['SquareProject'][_0x6055('0x46')]({'where':{'id':_0x31084b[_0x6055('0x42')]['id']}})[_0x6055('0x24')](handleEntityNotFound(_0x4398ad,null))[_0x6055('0x24')](function(_0x18156c){if(_0x18156c){return _0x18156c[_0x6055('0x50')](_0x31084b[_0x6055('0x4f')][_0x6055('0x51')],_['omit'](_0x31084b[_0x6055('0x4f')],[_0x6055('0x51'),'id'])||{});}})[_0x6055('0x24')](respondWithResult(_0x4398ad,null))[_0x6055('0x40')](handleError(_0x4398ad,null));};exports['removeUsers']=function(_0x5ad9e1,_0x29d3be,_0x437eab){return db[_0x6055('0x2b')][_0x6055('0x46')]({'where':{'id':_0x5ad9e1[_0x6055('0x42')]['id']}})[_0x6055('0x24')](handleEntityNotFound(_0x29d3be,null))[_0x6055('0x24')](function(_0x4aa7cc){if(_0x4aa7cc){return _0x4aa7cc['removeUsers'](_0x5ad9e1[_0x6055('0x2f')][_0x6055('0x51')])[_0x6055('0x24')](function(){if(_[_0x6055('0x52')](_0x5ad9e1[_0x6055('0x2f')][_0x6055('0x51')])){for(var _0x20cfbd=0x0;_0x20cfbd<_0x5ad9e1[_0x6055('0x2f')][_0x6055('0x51')][_0x6055('0x45')];_0x20cfbd+=0x1){socket[_0x6055('0x53')](_0x6055('0x54'),{'UserId':Number(_0x5ad9e1[_0x6055('0x2f')]['ids'][_0x20cfbd]),'SquareProjectId':Number(_0x5ad9e1['params']['id'])});}}else{socket[_0x6055('0x53')](_0x6055('0x54'),{'UserId':Number(_0x5ad9e1[_0x6055('0x2f')][_0x6055('0x51')]),'SquareProjectId':Number(_0x5ad9e1[_0x6055('0x42')]['id'])});}});}})[_0x6055('0x24')](respondWithStatusCode(_0x29d3be,null))[_0x6055('0x40')](handleError(_0x29d3be,null));};exports[_0x6055('0x55')]=function(_0x1fae67,_0xc29ed3,_0xe041dc){var _0x9300f4={};var _0x4040a5={};var _0x36e83b;var _0x2bb6df;return db['SquareProject']['findOne']({'where':{'id':_0x1fae67[_0x6055('0x42')]['id']}})[_0x6055('0x24')](handleEntityNotFound(_0xc29ed3,null))[_0x6055('0x24')](function(_0x5d6a53){if(_0x5d6a53){_0x36e83b=_0x5d6a53;_0x4040a5['model']=_['keys'](db[_0x6055('0x56')][_0x6055('0x44')]);_0x4040a5[_0x6055('0x2f')]=_['keys'](_0x1fae67[_0x6055('0x2f')]);_0x4040a5['filters']=_[_0x6055('0x31')](_0x4040a5[_0x6055('0x2c')],_0x4040a5[_0x6055('0x2f')]);_0x9300f4['attributes']=_[_0x6055('0x31')](_0x4040a5['model'],qs['fields'](_0x1fae67[_0x6055('0x2f')][_0x6055('0x33')]));_0x9300f4[_0x6055('0x32')]=_0x9300f4[_0x6055('0x32')][_0x6055('0x45')]?_0x9300f4[_0x6055('0x32')]:_0x4040a5[_0x6055('0x2c')];_0x9300f4[_0x6055('0x57')]=qs[_0x6055('0x36')](_0x1fae67['query'][_0x6055('0x36')]);_0x9300f4[_0x6055('0x38')]=qs[_0x6055('0x30')](_[_0x6055('0x58')](_0x1fae67['query'],_0x4040a5[_0x6055('0x30')]));if(_0x1fae67[_0x6055('0x2f')][_0x6055('0x37')]){_0x9300f4['where']=_[_0x6055('0x39')](_0x9300f4[_0x6055('0x38')],{'$or':_['map'](_0x9300f4[_0x6055('0x32')],function(_0x550e99){var _0x105456={};_0x105456[_0x550e99]={'$like':'%'+_0x1fae67[_0x6055('0x2f')]['filter']+'%'};return _0x105456;})});}_0x9300f4=_[_0x6055('0x39')]({},_0x9300f4,_0x1fae67[_0x6055('0x3c')]);return _0x36e83b[_0x6055('0x55')](_0x9300f4);}})[_0x6055('0x24')](function(_0x36b4d7){if(_0x36b4d7){_0x2bb6df=_0x36b4d7['length'];if(!_0x1fae67[_0x6055('0x2f')][_0x6055('0x34')](_0x6055('0x59'))){_0x9300f4[_0x6055('0x35')]=qs[_0x6055('0x35')](_0x1fae67['query'][_0x6055('0x35')]);_0x9300f4[_0x6055('0x1e')]=qs[_0x6055('0x1e')](_0x1fae67[_0x6055('0x2f')][_0x6055('0x1e')]);}return _0x36e83b['getUsers'](_0x9300f4);}})['then'](function(_0x41cfbb){if(_0x41cfbb){return _0x41cfbb?{'count':_0x2bb6df,'rows':_0x41cfbb}:null;}})[_0x6055('0x24')](respondWithResult(_0xc29ed3,null))[_0x6055('0x40')](handleError(_0xc29ed3,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 534a6da..01dddc8 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 _0x97e5=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','SquareProject'];(function(_0x64edb0,_0x4dd13c){var _0x580a4b=function(_0x3e6636){while(--_0x3e6636){_0x64edb0['push'](_0x64edb0['shift']());}};_0x580a4b(++_0x4dd13c);}(_0x97e5,0xcd));var _0x597e=function(_0x336ee4,_0x1b1d83){_0x336ee4=_0x336ee4-0x0;var _0x172096=_0x97e5[_0x336ee4];return _0x172096;};'use strict';var EventEmitter=require(_0x597e('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x597e('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x597e('0x2')](0x0);var events={'afterCreate':_0x597e('0x3'),'afterUpdate':'update','afterDestroy':_0x597e('0x4')};function emitEvent(_0x123df8){return function(_0x1f3b43,_0x16b722,_0x1cbfc6){SquareProjectEvents[_0x597e('0x5')](_0x123df8+':'+_0x1f3b43['id'],_0x1f3b43);SquareProjectEvents[_0x597e('0x5')](_0x123df8,_0x1f3b43);_0x1cbfc6(null);};}for(var e in events){if(events[_0x597e('0x6')](e)){var event=events[e];SquareProject[_0x597e('0x7')](e,emitEvent(event));}}module[_0x597e('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x3572=['remove','emit','hook','exports','SquareProject','setMaxListeners','save'];(function(_0x1e48d3,_0x5d8c43){var _0x2852b1=function(_0x11d7b3){while(--_0x11d7b3){_0x1e48d3['push'](_0x1e48d3['shift']());}};_0x2852b1(++_0x5d8c43);}(_0x3572,0x15b));var _0x2357=function(_0x3f5fa3,_0x198337){_0x3f5fa3=_0x3f5fa3-0x0;var _0x57a4f8=_0x3572[_0x3f5fa3];return _0x57a4f8;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0x2357('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x2357('0x1')](0x0);var events={'afterCreate':_0x2357('0x2'),'afterUpdate':'update','afterDestroy':_0x2357('0x3')};function emitEvent(_0x34694d){return function(_0x5cf0d8,_0x30eb80,_0x4726c0){SquareProjectEvents[_0x2357('0x4')](_0x34694d+':'+_0x5cf0d8['id'],_0x5cf0d8);SquareProjectEvents[_0x2357('0x4')](_0x34694d,_0x5cf0d8);_0x4726c0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x2357('0x5')](e,emitEvent(event));}}module[_0x2357('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 86a4d68..40146c7 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 _0x8ece=['define','SquareProject','square_projects','changed','savedAt','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','format','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./squareProject.attributes'];(function(_0x11d92e,_0x4b07e3){var _0x59f98e=function(_0x414bd0){while(--_0x414bd0){_0x11d92e['push'](_0x11d92e['shift']());}};_0x59f98e(++_0x4b07e3);}(_0x8ece,0x195));var _0xe8ec=function(_0x58da8d,_0x9dfa17){_0x58da8d=_0x58da8d-0x0;var _0x1b1682=_0x8ece[_0x58da8d];return _0x1b1682;};'use strict';var _=require(_0xe8ec('0x0'));var util=require(_0xe8ec('0x1'));var logger=require(_0xe8ec('0x2'))(_0xe8ec('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe8ec('0x4'));var fs=require('fs');var path=require(_0xe8ec('0x5'));var rimraf=require(_0xe8ec('0x6'));var config=require(_0xe8ec('0x7'));var attributes=require(_0xe8ec('0x8'));module['exports']=function(_0x346577,_0x23fa35){return _0x346577[_0xe8ec('0x9')](_0xe8ec('0xa'),attributes,{'tableName':_0xe8ec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x122f36,_0x406f7e,_0x5525f8){if(_0x122f36[_0xe8ec('0xc')]('preproduction')){_0x122f36[_0xe8ec('0xd')]=moment()['format'](_0xe8ec('0xe'));}if(_0x122f36[_0xe8ec('0xc')](_0xe8ec('0xf'))){_0x122f36[_0xe8ec('0x10')]=moment()[_0xe8ec('0x11')](_0xe8ec('0xe'));}_0x5525f8(null,_0x122f36);}}});}; \ No newline at end of file +var _0xa566=['publishedAt','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','define','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production'];(function(_0xadde91,_0x41a43b){var _0x315610=function(_0xc57677){while(--_0xc57677){_0xadde91['push'](_0xadde91['shift']());}};_0x315610(++_0x41a43b);}(_0xa566,0x1c1));var _0x6a56=function(_0x4236ac,_0x1ae4db){_0x4236ac=_0x4236ac-0x0;var _0x2aa2fd=_0xa566[_0x4236ac];return _0x2aa2fd;};'use strict';var _=require(_0x6a56('0x0'));var util=require(_0x6a56('0x1'));var logger=require(_0x6a56('0x2'))('api');var moment=require(_0x6a56('0x3'));var BPromise=require(_0x6a56('0x4'));var rp=require(_0x6a56('0x5'));var fs=require('fs');var path=require(_0x6a56('0x6'));var rimraf=require('rimraf');var config=require(_0x6a56('0x7'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x4c58b0,_0x47ecb8){return _0x4c58b0[_0x6a56('0x8')]('SquareProject',attributes,{'tableName':_0x6a56('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4947a9,_0x33240c,_0x299e89){if(_0x4947a9['changed'](_0x6a56('0xa'))){_0x4947a9[_0x6a56('0xb')]=moment()[_0x6a56('0xc')](_0x6a56('0xd'));}if(_0x4947a9['changed'](_0x6a56('0xe'))){_0x4947a9[_0x6a56('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x299e89(null,_0x4947a9);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 34cd3c1..aa5e05e 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 _0xba3e=['debug','stringify','error','code','message','catch','ShowSquareProject','find','options','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba3e,0xe5));var _0xeba3=function(_0x40a7af,_0x4f10b4){_0x40a7af=_0x40a7af-0x0;var _0x23103a=_0xba3e[_0x40a7af];return _0x23103a;};'use strict';var _=require(_0xeba3('0x0'));var util=require(_0xeba3('0x1'));var moment=require(_0xeba3('0x2'));var BPromise=require(_0xeba3('0x3'));var rs=require(_0xeba3('0x4'));var fs=require('fs');var Redis=require(_0xeba3('0x5'));var db=require(_0xeba3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xeba3('0x7'))(_0xeba3('0x8'));var config=require(_0xeba3('0x9'));var jayson=require(_0xeba3('0xa'));var client=jayson['client'][_0xeba3('0xb')]({'port':0x232a});config[_0xeba3('0xc')]=_[_0xeba3('0xd')](config['redis'],{'host':_0xeba3('0xe'),'port':0x18eb});var socket=require(_0xeba3('0xf'))(new Redis(config[_0xeba3('0xc')]));require(_0xeba3('0x10'))[_0xeba3('0x11')](socket);function respondWithRpcPromise(_0x942c43,_0x57cf72,_0x41992b){return new BPromise(function(_0x202016,_0xcb3e6a){return client[_0xeba3('0x12')](_0x942c43,_0x41992b)[_0xeba3('0x13')](function(_0xb60a05){logger[_0xeba3('0x14')](_0xeba3('0x15'),_0x57cf72,_0xeba3('0x16'));logger[_0xeba3('0x17')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x57cf72,_0xeba3('0x16'),JSON[_0xeba3('0x18')](_0xb60a05));if(_0xb60a05[_0xeba3('0x19')]){if(_0xb60a05[_0xeba3('0x19')][_0xeba3('0x1a')]===0x1f4){logger[_0xeba3('0x19')](_0xeba3('0x15'),_0x57cf72,_0xb60a05[_0xeba3('0x19')][_0xeba3('0x1b')]);return _0xcb3e6a(_0xb60a05[_0xeba3('0x19')][_0xeba3('0x1b')]);}logger[_0xeba3('0x19')](_0xeba3('0x15'),_0x57cf72,_0xb60a05[_0xeba3('0x19')][_0xeba3('0x1b')]);return _0x202016(_0xb60a05['error'][_0xeba3('0x1b')]);}else{logger[_0xeba3('0x14')](_0xeba3('0x15'),_0x57cf72,_0xeba3('0x16'));_0x202016(_0xb60a05['result'][_0xeba3('0x1b')]);}})[_0xeba3('0x1c')](function(_0x2bee0c){logger[_0xeba3('0x19')](_0xeba3('0x15'),_0x57cf72,_0x2bee0c);_0xcb3e6a(_0x2bee0c);});});}exports[_0xeba3('0x1d')]=function(_0x14ba1e){var _0x50ee21=this;return new Promise(function(_0x52aa63,_0x13d5a2){return db['SquareProject'][_0xeba3('0x1e')]({'raw':_0x14ba1e[_0xeba3('0x1f')]?_0x14ba1e[_0xeba3('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x14ba1e['options']?_0x14ba1e['options']['where']||null:null,'attributes':_0x14ba1e[_0xeba3('0x1f')]?_0x14ba1e[_0xeba3('0x1f')][_0xeba3('0x20')]||null:null,'include':_0x14ba1e[_0xeba3('0x1f')]?_0x14ba1e[_0xeba3('0x1f')]['include']?_[_0xeba3('0x21')](_0x14ba1e[_0xeba3('0x1f')][_0xeba3('0x22')],function(_0x69e731){return{'model':db[_0x69e731[_0xeba3('0x23')]],'as':_0x69e731['as'],'attributes':_0x69e731[_0xeba3('0x20')],'include':_0x69e731[_0xeba3('0x22')]?_[_0xeba3('0x21')](_0x69e731[_0xeba3('0x22')],function(_0x55f334){return{'model':db[_0x55f334['model']],'as':_0x55f334['as'],'attributes':_0x55f334['attributes'],'include':_0x55f334[_0xeba3('0x22')]?_[_0xeba3('0x21')](_0x55f334['include'],function(_0x3037b0){return{'model':db[_0x3037b0[_0xeba3('0x23')]],'as':_0x3037b0['as'],'attributes':_0x3037b0[_0xeba3('0x20')]};}):[]};}):[]};}):[]:[]})[_0xeba3('0x13')](function(_0x59372e){logger[_0xeba3('0x14')](_0xeba3('0x1d'),_0x14ba1e);logger[_0xeba3('0x17')](_0xeba3('0x1d'),_0x14ba1e,JSON[_0xeba3('0x18')](_0x59372e));_0x52aa63(_0x59372e);})['catch'](function(_0x39c05a){logger[_0xeba3('0x19')](_0xeba3('0x1d'),_0x39c05a[_0xeba3('0x1b')],_0x14ba1e);_0x13d5a2(_0x50ee21[_0xeba3('0x19')](0x1f4,_0x39c05a['message']));});});}; \ No newline at end of file +var _0xbc45=['result','catch','ShowSquareProject','find','options','where','map','include','model','attributes','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','register','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x30fda3,_0x22d57b){var _0x5d09c7=function(_0x5e8d18){while(--_0x5e8d18){_0x30fda3['push'](_0x30fda3['shift']());}};_0x5d09c7(++_0x22d57b);}(_0xbc45,0xb5));var _0x5bc4=function(_0x1e8e29,_0x544135){_0x1e8e29=_0x1e8e29-0x0;var _0x294e14=_0xbc45[_0x1e8e29];return _0x294e14;};'use strict';var _=require('lodash');var util=require(_0x5bc4('0x0'));var moment=require(_0x5bc4('0x1'));var BPromise=require(_0x5bc4('0x2'));var rs=require(_0x5bc4('0x3'));var fs=require('fs');var Redis=require(_0x5bc4('0x4'));var db=require(_0x5bc4('0x5'))['db'];var utils=require(_0x5bc4('0x6'));var logger=require('../../config/logger')(_0x5bc4('0x7'));var config=require(_0x5bc4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5bc4('0x9')][_0x5bc4('0xa')]({'port':0x232a});config[_0x5bc4('0xb')]=_[_0x5bc4('0xc')](config[_0x5bc4('0xb')],{'host':_0x5bc4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./squareProject.socket')[_0x5bc4('0xe')](socket);function respondWithRpcPromise(_0x2f91b2,_0x34118e,_0x2dde26){return new BPromise(function(_0x1e41f4,_0x58559d){return client[_0x5bc4('0xf')](_0x2f91b2,_0x2dde26)[_0x5bc4('0x10')](function(_0x38b135){logger['info'](_0x5bc4('0x11'),_0x34118e,_0x5bc4('0x12'));logger[_0x5bc4('0x13')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x34118e,'request\x20sent',JSON[_0x5bc4('0x14')](_0x38b135));if(_0x38b135['error']){if(_0x38b135[_0x5bc4('0x15')]['code']===0x1f4){logger[_0x5bc4('0x15')](_0x5bc4('0x11'),_0x34118e,_0x38b135[_0x5bc4('0x15')]['message']);return _0x58559d(_0x38b135[_0x5bc4('0x15')][_0x5bc4('0x16')]);}logger[_0x5bc4('0x15')](_0x5bc4('0x11'),_0x34118e,_0x38b135[_0x5bc4('0x15')]['message']);return _0x1e41f4(_0x38b135[_0x5bc4('0x15')][_0x5bc4('0x16')]);}else{logger['info'](_0x5bc4('0x11'),_0x34118e,_0x5bc4('0x12'));_0x1e41f4(_0x38b135[_0x5bc4('0x17')][_0x5bc4('0x16')]);}})[_0x5bc4('0x18')](function(_0x9ff217){logger[_0x5bc4('0x15')](_0x5bc4('0x11'),_0x34118e,_0x9ff217);_0x58559d(_0x9ff217);});});}exports[_0x5bc4('0x19')]=function(_0x1c4a82){var _0x3c0e7d=this;return new Promise(function(_0x5e5f37,_0x5b5f3b){return db['SquareProject'][_0x5bc4('0x1a')]({'raw':_0x1c4a82[_0x5bc4('0x1b')]?_0x1c4a82[_0x5bc4('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1c4a82[_0x5bc4('0x1b')]?_0x1c4a82[_0x5bc4('0x1b')][_0x5bc4('0x1c')]||null:null,'attributes':_0x1c4a82[_0x5bc4('0x1b')]?_0x1c4a82[_0x5bc4('0x1b')]['attributes']||null:null,'include':_0x1c4a82[_0x5bc4('0x1b')]?_0x1c4a82[_0x5bc4('0x1b')]['include']?_[_0x5bc4('0x1d')](_0x1c4a82[_0x5bc4('0x1b')][_0x5bc4('0x1e')],function(_0x5f9086){return{'model':db[_0x5f9086[_0x5bc4('0x1f')]],'as':_0x5f9086['as'],'attributes':_0x5f9086['attributes'],'include':_0x5f9086[_0x5bc4('0x1e')]?_['map'](_0x5f9086[_0x5bc4('0x1e')],function(_0x28202f){return{'model':db[_0x28202f[_0x5bc4('0x1f')]],'as':_0x28202f['as'],'attributes':_0x28202f['attributes'],'include':_0x28202f[_0x5bc4('0x1e')]?_[_0x5bc4('0x1d')](_0x28202f['include'],function(_0x35b676){return{'model':db[_0x35b676[_0x5bc4('0x1f')]],'as':_0x35b676['as'],'attributes':_0x35b676[_0x5bc4('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40f7de){logger[_0x5bc4('0x21')](_0x5bc4('0x19'),_0x1c4a82);logger['debug']('ShowSquareProject',_0x1c4a82,JSON[_0x5bc4('0x14')](_0x40f7de));_0x5e5f37(_0x40f7de);})[_0x5bc4('0x18')](function(_0x125ddb){logger['error'](_0x5bc4('0x19'),_0x125ddb[_0x5bc4('0x16')],_0x1c4a82);_0x5b5f3b(_0x3c0e7d[_0x5bc4('0x15')](0x1f4,_0x125ddb['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 546ab1f..2723ee1 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 _0xe3da=['length','squareProject:','./squareProject.events','save','remove','update','emit','removeListener','register'];(function(_0x50890a,_0x32fbea){var _0x144f31=function(_0xc88865){while(--_0xc88865){_0x50890a['push'](_0x50890a['shift']());}};_0x144f31(++_0x32fbea);}(_0xe3da,0x1cd));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var SquareProjectEvents=require(_0xae3d('0x0'));var events=[_0xae3d('0x1'),_0xae3d('0x2'),_0xae3d('0x3')];function createListener(_0x2bba92,_0x190f0d){return function(_0x109dca){_0x190f0d[_0xae3d('0x4')](_0x2bba92,_0x109dca);};}function removeListener(_0xb2dfd3,_0x22bacf){return function(){SquareProjectEvents[_0xae3d('0x5')](_0xb2dfd3,_0x22bacf);};}exports[_0xae3d('0x6')]=function(_0xa9a1a){for(var _0xa54808=0x0,_0x476579=events[_0xae3d('0x7')];_0xa54808<_0x476579;_0xa54808++){var _0x583b98=events[_0xa54808];var _0x2a5c45=createListener(_0xae3d('0x8')+_0x583b98,_0xa9a1a);SquareProjectEvents['on'](_0x583b98,_0x2a5c45);}}; \ No newline at end of file +var _0x33af=['emit','removeListener','register','length','squareProject:','save','update'];(function(_0x28b472,_0x2f78f6){var _0x29060c=function(_0x3ecbef){while(--_0x3ecbef){_0x28b472['push'](_0x28b472['shift']());}};_0x29060c(++_0x2f78f6);}(_0x33af,0xec));var _0xf33a=function(_0xa74e4c,_0x152094){_0xa74e4c=_0xa74e4c-0x0;var _0x5aceaa=_0x33af[_0xa74e4c];return _0x5aceaa;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xf33a('0x0'),'remove',_0xf33a('0x1')];function createListener(_0x1111c6,_0x267057){return function(_0x4303f1){_0x267057[_0xf33a('0x2')](_0x1111c6,_0x4303f1);};}function removeListener(_0x25f156,_0x4c734e){return function(){SquareProjectEvents[_0xf33a('0x3')](_0x25f156,_0x4c734e);};}exports[_0xf33a('0x4')]=function(_0x583e54){for(var _0xc0dd13=0x0,_0x384b14=events[_0xf33a('0x5')];_0xc0dd13<_0x384b14;_0xc0dd13++){var _0x2f3730=events[_0xc0dd13];var _0x2baabb=createListener(_0xf33a('0x6')+_0x2f3730,_0x583e54);SquareProjectEvents['on'](_0x2f3730,_0x2baabb);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index ff5f4f1..7103db8 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 _0x84f7=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','put','/:id','update','/:id/delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x14d89a,_0x15260f){var _0x57e141=function(_0x79ed71){while(--_0x79ed71){_0x14d89a['push'](_0x14d89a['shift']());}};_0x57e141(++_0x15260f);}(_0x84f7,0x11c));var _0x784f=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0x84f7[_0x49c057];return _0xd8f0e6;};'use strict';var multer=require(_0x784f('0x0'));var util=require(_0x784f('0x1'));var path=require(_0x784f('0x2'));var timeout=require(_0x784f('0x3'));var express=require(_0x784f('0x4'));var router=express['Router']();var fs_extra=require(_0x784f('0x5'));var auth=require(_0x784f('0x6'));var interaction=require(_0x784f('0x7'));var config=require(_0x784f('0x8'));var controller=require(_0x784f('0x9'));router[_0x784f('0xa')]('/',auth[_0x784f('0xb')](),controller[_0x784f('0xc')]);router[_0x784f('0xa')]('/:id',auth[_0x784f('0xb')](),controller[_0x784f('0xd')]);router[_0x784f('0xa')](_0x784f('0xe'),auth[_0x784f('0xb')](),controller[_0x784f('0xf')]);router[_0x784f('0x10')]('/',auth['isAuthenticated'](),controller[_0x784f('0x11')]);router[_0x784f('0x12')](_0x784f('0x13'),auth['isAuthenticated'](),controller[_0x784f('0x14')]);router['delete'](_0x784f('0x15'),auth[_0x784f('0xb')](),controller[_0x784f('0x16')]);module[_0x784f('0x17')]=router; \ No newline at end of file +var _0x9403=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareRecording.controller','isAuthenticated','index','get','/:id','/:id/download','download','put','update','/:id/delete','destroy','multer','util','path'];(function(_0x534fb9,_0x466466){var _0x57d679=function(_0x3ae759){while(--_0x3ae759){_0x534fb9['push'](_0x534fb9['shift']());}};_0x57d679(++_0x466466);}(_0x9403,0x1c5));var _0x3940=function(_0x10ac27,_0x299afd){_0x10ac27=_0x10ac27-0x0;var _0x247f76=_0x9403[_0x10ac27];return _0x247f76;};'use strict';var multer=require(_0x3940('0x0'));var util=require(_0x3940('0x1'));var path=require(_0x3940('0x2'));var timeout=require(_0x3940('0x3'));var express=require('express');var router=express[_0x3940('0x4')]();var fs_extra=require(_0x3940('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3940('0x6'));var config=require(_0x3940('0x7'));var controller=require(_0x3940('0x8'));router['get']('/',auth[_0x3940('0x9')](),controller[_0x3940('0xa')]);router[_0x3940('0xb')](_0x3940('0xc'),auth[_0x3940('0x9')](),controller['show']);router[_0x3940('0xb')](_0x3940('0xd'),auth['isAuthenticated'](),controller[_0x3940('0xe')]);router['post']('/',auth[_0x3940('0x9')](),controller['create']);router[_0x3940('0xf')](_0x3940('0xc'),auth[_0x3940('0x9')](),controller[_0x3940('0x10')]);router['delete'](_0x3940('0x11'),auth[_0x3940('0x9')](),controller[_0x3940('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index af6e1be..195d262 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 _0x6a0b=['lastIndexOf','sequelize','STRING','VIRTUAL','getDataValue','savePath','substring'];(function(_0x7e573f,_0x40589a){var _0x32eae1=function(_0x41a8f3){while(--_0x41a8f3){_0x7e573f['push'](_0x7e573f['shift']());}};_0x32eae1(++_0x40589a);}(_0x6a0b,0xf6));var _0xb6a0=function(_0x11014f,_0x29caef){_0x11014f=_0x11014f-0x0;var _0x3f5807=_0x6a0b[_0x11014f];return _0x3f5807;};'use strict';var Sequelize=require(_0xb6a0('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xb6a0('0x1')]},'calleridname':{'type':Sequelize[_0xb6a0('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xb6a0('0x1')]},'priority':{'type':Sequelize[_0xb6a0('0x1')]},'accountcode':{'type':Sequelize[_0xb6a0('0x1')]},'dnid':{'type':Sequelize[_0xb6a0('0x1')]},'projectName':{'type':Sequelize[_0xb6a0('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xb6a0('0x1')]},'savePath':{'type':Sequelize[_0xb6a0('0x1')]},'format':{'type':Sequelize[_0xb6a0('0x2')],'get':function(){var _0xef4451='';var _0xb107bd=this[_0xb6a0('0x3')](_0xb6a0('0x4'));if(_0xb107bd){_0xef4451=_0xb107bd[_0xb6a0('0x5')](_0xb107bd[_0xb6a0('0x6')]('.'));}return _0xef4451;}}}; \ No newline at end of file +var _0x0024=['exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x0024,0xa8));var _0x4002=function(_0x374f27,_0x1d3bd5){_0x374f27=_0x374f27-0x0;var _0x568d07=_0x0024[_0x374f27];return _0x568d07;};'use strict';var Sequelize=require('sequelize');module[_0x4002('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x4002('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4002('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4002('0x1')]},'dnid':{'type':Sequelize[_0x4002('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x4002('0x1')]},'savePath':{'type':Sequelize[_0x4002('0x1')]},'format':{'type':Sequelize[_0x4002('0x2')],'get':function(){var _0x29fdc4='';var _0x47b0bb=this[_0x4002('0x3')](_0x4002('0x4'));if(_0x47b0bb){_0x29fdc4=_0x47b0bb[_0x4002('0x5')](_0x47b0bb[_0x4002('0x6')]('.'));}return _0x29fdc4;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 79e9a95..5a18047 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 _0x2806=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','catch','show','length','include','find','create','body','params','download','../../components/encryptor','uniqueid','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','savePath','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x23884b,_0x50c307){var _0x28113b=function(_0xce3fea){while(--_0xce3fea){_0x23884b['push'](_0x23884b['shift']());}};_0x28113b(++_0x50c307);}(_0x2806,0x126));var _0x6280=function(_0x27f962,_0x536b34){_0x27f962=_0x27f962-0x0;var _0x20989f=_0x2806[_0x27f962];return _0x20989f;};'use strict';var emlformat=require(_0x6280('0x0'));var rimraf=require(_0x6280('0x1'));var zipdir=require(_0x6280('0x2'));var jsonpatch=require(_0x6280('0x3'));var rp=require(_0x6280('0x4'));var moment=require(_0x6280('0x5'));var BPromise=require(_0x6280('0x6'));var Mustache=require(_0x6280('0x7'));var util=require(_0x6280('0x8'));var path=require(_0x6280('0x9'));var sox=require(_0x6280('0xa'));var csv=require(_0x6280('0xb'));var ejs=require(_0x6280('0xc'));var fs=require('fs');var fs_extra=require(_0x6280('0xd'));var _=require(_0x6280('0xe'));var squel=require(_0x6280('0xf'));var crypto=require(_0x6280('0x10'));var jsforce=require(_0x6280('0x11'));var deskjs=require(_0x6280('0x12'));var toCsv=require(_0x6280('0xb'));var querystring=require(_0x6280('0x13'));var Papa=require(_0x6280('0x14'));var Redis=require(_0x6280('0x15'));var authService=require(_0x6280('0x16'));var qs=require(_0x6280('0x17'));var as=require(_0x6280('0x18'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6280('0x19'))('api');var utils=require(_0x6280('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x6280('0x1b'));var db=require(_0x6280('0x1c'))['db'];function respondWithStatusCode(_0x35a882,_0x449027){_0x449027=_0x449027||0xcc;return function(_0x35ff1f){if(_0x35ff1f){return _0x35a882[_0x6280('0x1d')](_0x449027);}return _0x35a882[_0x6280('0x1e')](_0x449027)[_0x6280('0x1f')]();};}function respondWithResult(_0x2976c7,_0x5d5fa7){_0x5d5fa7=_0x5d5fa7||0xc8;return function(_0x357f5f){if(_0x357f5f){return _0x2976c7[_0x6280('0x1e')](_0x5d5fa7)['json'](_0x357f5f);}};}function respondWithFilteredResult(_0x59e68e,_0x13c534){return function(_0x2e00d8){if(_0x2e00d8){var _0xfc19bc=_0x2e00d8[_0x6280('0x20')],_0x597e98=_0x13c534[_0x6280('0x21')],_0x39fd6a=_0x13c534[_0x6280('0x21')]+_0x13c534[_0x6280('0x22')],_0x1239ed;if(_0x39fd6a>=_0xfc19bc){_0x39fd6a=_0xfc19bc;_0x1239ed=0xc8;}else{_0x1239ed=0xce;}_0x59e68e[_0x6280('0x1e')](_0x1239ed);return _0x59e68e[_0x6280('0x23')](_0x6280('0x24'),_0x597e98+'-'+_0x39fd6a+'/'+_0xfc19bc)[_0x6280('0x25')](_0x2e00d8);}return null;};}function patchUpdates(_0x516106){return function(_0x26d135){try{jsonpatch['apply'](_0x26d135,_0x516106,!![]);}catch(_0x4bb4f5){return BPromise[_0x6280('0x26')](_0x4bb4f5);}return _0x26d135[_0x6280('0x27')]();};}function saveUpdates(_0x1d9f5d,_0x27571a){return function(_0x4f59e1){if(_0x4f59e1){return _0x4f59e1[_0x6280('0x28')](_0x1d9f5d)[_0x6280('0x29')](function(_0x5744ad){return _0x5744ad;});}return null;};}function removeEntity(_0x47ab28,_0x444478){return function(_0x3e2510){if(_0x3e2510){return _0x3e2510[_0x6280('0x2a')]()[_0x6280('0x29')](function(){_0x47ab28[_0x6280('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a2450,_0x49b117){return function(_0x39b520){if(!_0x39b520){_0x2a2450['sendStatus'](0x194);}return _0x39b520;};}function handleError(_0x3693ed,_0x2485e8){_0x2485e8=_0x2485e8||0x1f4;return function(_0x26672f){logger[_0x6280('0x2b')](_0x26672f[_0x6280('0x2c')]);if(_0x26672f[_0x6280('0x2d')]){delete _0x26672f[_0x6280('0x2d')];}_0x3693ed[_0x6280('0x1e')](_0x2485e8)[_0x6280('0x2e')](_0x26672f);};}exports[_0x6280('0x2f')]=function(_0xcbf6b5,_0x54c3ee){var _0x327d31={},_0xfb18b9={},_0x5ab6e4={'count':0x0,'rows':[]};var _0x2b3ce5=_[_0x6280('0x30')](db[_0x6280('0x31')][_0x6280('0x32')],function(_0x2bb4d1){return{'name':_0x2bb4d1[_0x6280('0x33')],'type':_0x2bb4d1[_0x6280('0x34')][_0x6280('0x35')]};});_0xfb18b9[_0x6280('0x36')]=_[_0x6280('0x30')](_0x2b3ce5,'name');_0xfb18b9[_0x6280('0x37')]=_[_0x6280('0x38')](_0xcbf6b5[_0x6280('0x37')]);_0xfb18b9['filters']=_['intersection'](_0xfb18b9[_0x6280('0x36')],_0xfb18b9[_0x6280('0x37')]);_0x327d31[_0x6280('0x39')]=_[_0x6280('0x3a')](_0xfb18b9[_0x6280('0x36')],qs[_0x6280('0x3b')](_0xcbf6b5[_0x6280('0x37')][_0x6280('0x3b')]));_0x327d31[_0x6280('0x39')]=_0x327d31['attributes']['length']?_0x327d31['attributes']:_0xfb18b9[_0x6280('0x36')];if(!_0xcbf6b5[_0x6280('0x37')]['hasOwnProperty'](_0x6280('0x3c'))){_0x327d31['limit']=qs['limit'](_0xcbf6b5[_0x6280('0x37')][_0x6280('0x22')]);_0x327d31['offset']=qs[_0x6280('0x21')](_0xcbf6b5['query'][_0x6280('0x21')]);}_0x327d31[_0x6280('0x3d')]=qs[_0x6280('0x3e')](_0xcbf6b5[_0x6280('0x37')][_0x6280('0x3e')]);_0x327d31[_0x6280('0x3f')]=qs['filters'](_['pick'](_0xcbf6b5[_0x6280('0x37')],_0xfb18b9[_0x6280('0x40')]),_0x2b3ce5);if(_0xcbf6b5[_0x6280('0x37')][_0x6280('0x41')]){_0x327d31[_0x6280('0x3f')]=_[_0x6280('0x42')](_0x327d31[_0x6280('0x3f')],{'$or':_['map'](_0x2b3ce5,function(_0x560134){if(_0x560134['type']!==_0x6280('0x43')){var _0x1678cd={};_0x1678cd[_0x560134['name']]={'$like':'%'+_0xcbf6b5[_0x6280('0x37')][_0x6280('0x41')]+'%'};return _0x1678cd;}})});}_0x327d31=_['merge']({},_0x327d31,_0xcbf6b5['options']);var _0x3051ce={'where':_0x327d31[_0x6280('0x3f')]};return db[_0x6280('0x31')]['count'](_0x3051ce)[_0x6280('0x29')](function(_0x388e9d){_0x5ab6e4[_0x6280('0x20')]=_0x388e9d;if(_0xcbf6b5[_0x6280('0x37')][_0x6280('0x44')]){_0x327d31['include']=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x327d31);})[_0x6280('0x29')](function(_0x5d57ec){_0x5ab6e4['rows']=_0x5d57ec;return _0x5ab6e4;})['then'](respondWithFilteredResult(_0x54c3ee,_0x327d31))[_0x6280('0x45')](handleError(_0x54c3ee,null));};exports[_0x6280('0x46')]=function(_0x104864,_0x4fa0a7){var _0x18d940={'raw':!![],'where':{'id':_0x104864['params']['id']}},_0x1c526e={};_0x1c526e['model']=_['keys'](db[_0x6280('0x31')]['rawAttributes']);_0x1c526e['query']=_[_0x6280('0x38')](_0x104864['query']);_0x1c526e[_0x6280('0x40')]=_[_0x6280('0x3a')](_0x1c526e['model'],_0x1c526e[_0x6280('0x37')]);_0x18d940[_0x6280('0x39')]=_[_0x6280('0x3a')](_0x1c526e['model'],qs[_0x6280('0x3b')](_0x104864[_0x6280('0x37')][_0x6280('0x3b')]));_0x18d940[_0x6280('0x39')]=_0x18d940[_0x6280('0x39')][_0x6280('0x47')]?_0x18d940[_0x6280('0x39')]:_0x1c526e[_0x6280('0x36')];if(_0x104864['query']['includeAll']){_0x18d940[_0x6280('0x48')]=[{'all':!![]}];}_0x18d940=_[_0x6280('0x42')]({},_0x18d940,_0x104864['options']);return db[_0x6280('0x31')][_0x6280('0x49')](_0x18d940)[_0x6280('0x29')](handleEntityNotFound(_0x4fa0a7,null))['then'](respondWithResult(_0x4fa0a7,null))['catch'](handleError(_0x4fa0a7,null));};exports[_0x6280('0x4a')]=function(_0x5a6058,_0x507363){return db[_0x6280('0x31')][_0x6280('0x4a')](_0x5a6058[_0x6280('0x4b')],{})[_0x6280('0x29')](respondWithResult(_0x507363,0xc9))[_0x6280('0x45')](handleError(_0x507363,null));};exports[_0x6280('0x28')]=function(_0x115338,_0x5263e5){if(_0x115338['body']['id']){delete _0x115338['body']['id'];}return db[_0x6280('0x31')][_0x6280('0x49')]({'where':{'id':_0x115338[_0x6280('0x4c')]['id']}})[_0x6280('0x29')](handleEntityNotFound(_0x5263e5,null))[_0x6280('0x29')](saveUpdates(_0x115338['body'],null))[_0x6280('0x29')](respondWithResult(_0x5263e5,null))[_0x6280('0x45')](handleError(_0x5263e5,null));};exports[_0x6280('0x4d')]=function(_0x293622,_0x5a7006,_0x27261a){var _0x20114a=require(_0x6280('0x4e'));var _0xe95377=![];var _0x42ec45={};if(_0x293622[_0x6280('0x37')][_0x6280('0x34')]&&_0x293622[_0x6280('0x37')]['type']===_0x6280('0x4f')){_0x42ec45['uniqueid']=_0x293622[_0x6280('0x4c')]['id'];}else{_0x42ec45['id']=_0x293622[_0x6280('0x4c')]['id'];}return db[_0x6280('0x31')][_0x6280('0x49')]({'where':_0x42ec45,'attributes':['id','savePath','filename'],'raw':!![]})[_0x6280('0x29')](handleEntityNotFound(_0x5a7006,null))['then'](function(_0x1c8904){if(_0x1c8904){var _0x499939=_0x1c8904['savePath'];var _0x139866=util[_0x6280('0x50')](_0x6280('0x51'),_0x499939);if(fs['existsSync'](_0x139866)){_0xe95377=!![];return _0x20114a[_0x6280('0x52')](_0x139866,_0x499939,config[_0x6280('0x53')][_0x6280('0x54')])[_0x6280('0x29')](function(){return _0x1c8904;});}return _0x1c8904;}})[_0x6280('0x29')](function(_0x4a540c){if(_0x4a540c){var _0x4e8b84=_0x4a540c['savePath'];if(!fs[_0x6280('0x55')](_0x4e8b84)){throw new db[(_0x6280('0x56'))][(_0x6280('0x57'))](_0x6280('0x58'));}if(_0x4a540c['filename']){return _0x5a7006[_0x6280('0x4d')](_0x4e8b84,_0x4a540c[_0x6280('0x59')]+path[_0x6280('0x5a')](_0x4e8b84),function(){if(_0xe95377){fs[_0x6280('0x5b')](_0x4e8b84);}});}else{return _0x5a7006[_0x6280('0x4d')](_0x4e8b84,function(_0x26462c){if(_0xe95377){fs[_0x6280('0x5b')](_0x4e8b84);}});}}})['catch'](function(_0x5a997a){if(_0x5a997a[_0x6280('0x5c')]==='SquareRecording\x20not\x20found'){_0x5a7006[_0x6280('0x1e')](0x194)[_0x6280('0x2e')](_0x6280('0x5d'));}else{return handleError(_0x5a7006,null);}});};exports[_0x6280('0x2a')]=function(_0x1a09e6,_0x1aeb6b){return db[_0x6280('0x31')][_0x6280('0x49')]({'where':{'id':_0x1a09e6[_0x6280('0x4c')]['id']}})[_0x6280('0x29')](function(_0x59b765){if(!_0x59b765)throw new ReferenceError('Entity\x20not\x20found');return _0x59b765;})[_0x6280('0x29')](function(_0x4139bd){var _0x1720c1=_0x4139bd[_0x6280('0x5e')];logger[_0x6280('0x5f')](_0x6280('0x60'),_0x1720c1);if(!_[_0x6280('0x61')](_0x4139bd['savePath'])&&fs[_0x6280('0x55')](_0x1720c1)){logger[_0x6280('0x5f')]('File:\x20\x22'+_0x1720c1+_0x6280('0x62'));fs[_0x6280('0x63')](_0x1720c1);}_0x1720c1=_0x1720c1+_0x6280('0x64');if(!_[_0x6280('0x61')](_0x4139bd[_0x6280('0x5e')])&&fs[_0x6280('0x55')](_0x1720c1)){logger[_0x6280('0x5f')](_0x6280('0x65')+_0x1720c1+_0x6280('0x62'));fs['unlinkSync'](_0x1720c1);}return _0x4139bd;})[_0x6280('0x29')](function(_0x5ee684){if(!_0x5ee684)throw new InternalError();return _0x5ee684[_0x6280('0x2a')]();})[_0x6280('0x29')](function(){_0x1aeb6b[_0x6280('0x1e')](0xcc)[_0x6280('0x1f')]();})[_0x6280('0x45')](handleError(_0x1aeb6b,null));}; \ No newline at end of file +var _0xedbd=['limit','reject','save','update','destroy','error','stack','name','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','then','rows','catch','params','create','body','download','../../components/encryptor','uniqueid','find','format','existsSync','decryptFile','secrets','savePath','ValidationError','SquareRecording\x20not\x20found','filename','unlink','message','send','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x2d8723,_0x549860){var _0x307fb1=function(_0x1b0dbe){while(--_0x1b0dbe){_0x2d8723['push'](_0x2d8723['shift']());}};_0x307fb1(++_0x549860);}(_0xedbd,0x9a));var _0xdedb=function(_0x567993,_0x161fa4){_0x567993=_0x567993-0x0;var _0x4d4c61=_0xedbd[_0x567993];return _0x4d4c61;};'use strict';var emlformat=require(_0xdedb('0x0'));var rimraf=require(_0xdedb('0x1'));var zipdir=require(_0xdedb('0x2'));var jsonpatch=require(_0xdedb('0x3'));var rp=require(_0xdedb('0x4'));var moment=require(_0xdedb('0x5'));var BPromise=require(_0xdedb('0x6'));var Mustache=require(_0xdedb('0x7'));var util=require(_0xdedb('0x8'));var path=require(_0xdedb('0x9'));var sox=require(_0xdedb('0xa'));var csv=require('to-csv');var ejs=require(_0xdedb('0xb'));var fs=require('fs');var fs_extra=require(_0xdedb('0xc'));var _=require(_0xdedb('0xd'));var squel=require(_0xdedb('0xe'));var crypto=require(_0xdedb('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdedb('0x10'));var Papa=require(_0xdedb('0x11'));var Redis=require('ioredis');var authService=require(_0xdedb('0x12'));var qs=require(_0xdedb('0x13'));var as=require(_0xdedb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdedb('0x15'))(_0xdedb('0x16'));var utils=require('../../config/utils');var config=require(_0xdedb('0x17'));var licenseUtil=require(_0xdedb('0x18'));var db=require(_0xdedb('0x19'))['db'];function respondWithStatusCode(_0x4ac044,_0x5698d7){_0x5698d7=_0x5698d7||0xcc;return function(_0x507b41){if(_0x507b41){return _0x4ac044[_0xdedb('0x1a')](_0x5698d7);}return _0x4ac044[_0xdedb('0x1b')](_0x5698d7)[_0xdedb('0x1c')]();};}function respondWithResult(_0x1794c0,_0x1c425c){_0x1c425c=_0x1c425c||0xc8;return function(_0x12c71b){if(_0x12c71b){return _0x1794c0[_0xdedb('0x1b')](_0x1c425c)[_0xdedb('0x1d')](_0x12c71b);}};}function respondWithFilteredResult(_0x5debbe,_0x2753a3){return function(_0x3b4dd0){if(_0x3b4dd0){var _0x58d29b=_0x3b4dd0[_0xdedb('0x1e')],_0x23cf31=_0x2753a3[_0xdedb('0x1f')],_0x4bb4d0=_0x2753a3[_0xdedb('0x1f')]+_0x2753a3[_0xdedb('0x20')],_0x37207d;if(_0x4bb4d0>=_0x58d29b){_0x4bb4d0=_0x58d29b;_0x37207d=0xc8;}else{_0x37207d=0xce;}_0x5debbe['status'](_0x37207d);return _0x5debbe['set']('Content-Range',_0x23cf31+'-'+_0x4bb4d0+'/'+_0x58d29b)[_0xdedb('0x1d')](_0x3b4dd0);}return null;};}function patchUpdates(_0x27d7e8){return function(_0xbb02d5){try{jsonpatch['apply'](_0xbb02d5,_0x27d7e8,!![]);}catch(_0x3cdc04){return BPromise[_0xdedb('0x21')](_0x3cdc04);}return _0xbb02d5[_0xdedb('0x22')]();};}function saveUpdates(_0x4d1abe,_0x3b5ca7){return function(_0x521186){if(_0x521186){return _0x521186[_0xdedb('0x23')](_0x4d1abe)['then'](function(_0x451543){return _0x451543;});}return null;};}function removeEntity(_0x3b3cb2,_0x5c0ded){return function(_0x3a7270){if(_0x3a7270){return _0x3a7270[_0xdedb('0x24')]()['then'](function(){_0x3b3cb2[_0xdedb('0x1b')](0xcc)[_0xdedb('0x1c')]();});}};}function handleEntityNotFound(_0x22cb70,_0x2327ed){return function(_0x43044a){if(!_0x43044a){_0x22cb70['sendStatus'](0x194);}return _0x43044a;};}function handleError(_0x572ef2,_0x1e76ab){_0x1e76ab=_0x1e76ab||0x1f4;return function(_0x5d5435){logger[_0xdedb('0x25')](_0x5d5435[_0xdedb('0x26')]);if(_0x5d5435[_0xdedb('0x27')]){delete _0x5d5435[_0xdedb('0x27')];}_0x572ef2[_0xdedb('0x1b')](_0x1e76ab)['send'](_0x5d5435);};}exports[_0xdedb('0x28')]=function(_0xeb1080,_0x3a7bfe){var _0x957547={},_0x1e39aa={},_0x4e0312={'count':0x0,'rows':[]};var _0x26301d=_[_0xdedb('0x29')](db[_0xdedb('0x2a')][_0xdedb('0x2b')],function(_0x2f615a){return{'name':_0x2f615a[_0xdedb('0x2c')],'type':_0x2f615a[_0xdedb('0x2d')][_0xdedb('0x2e')]};});_0x1e39aa[_0xdedb('0x2f')]=_[_0xdedb('0x29')](_0x26301d,_0xdedb('0x27'));_0x1e39aa['query']=_[_0xdedb('0x30')](_0xeb1080[_0xdedb('0x31')]);_0x1e39aa[_0xdedb('0x32')]=_[_0xdedb('0x33')](_0x1e39aa[_0xdedb('0x2f')],_0x1e39aa['query']);_0x957547['attributes']=_['intersection'](_0x1e39aa['model'],qs[_0xdedb('0x34')](_0xeb1080[_0xdedb('0x31')]['fields']));_0x957547[_0xdedb('0x35')]=_0x957547['attributes'][_0xdedb('0x36')]?_0x957547[_0xdedb('0x35')]:_0x1e39aa[_0xdedb('0x2f')];if(!_0xeb1080[_0xdedb('0x31')][_0xdedb('0x37')](_0xdedb('0x38'))){_0x957547[_0xdedb('0x20')]=qs[_0xdedb('0x20')](_0xeb1080[_0xdedb('0x31')][_0xdedb('0x20')]);_0x957547[_0xdedb('0x1f')]=qs[_0xdedb('0x1f')](_0xeb1080[_0xdedb('0x31')][_0xdedb('0x1f')]);}_0x957547['order']=qs[_0xdedb('0x39')](_0xeb1080['query'][_0xdedb('0x39')]);_0x957547['where']=qs[_0xdedb('0x32')](_['pick'](_0xeb1080[_0xdedb('0x31')],_0x1e39aa['filters']),_0x26301d);if(_0xeb1080[_0xdedb('0x31')][_0xdedb('0x3a')]){_0x957547[_0xdedb('0x3b')]=_[_0xdedb('0x3c')](_0x957547[_0xdedb('0x3b')],{'$or':_[_0xdedb('0x29')](_0x26301d,function(_0xe42e99){if(_0xe42e99['type']!==_0xdedb('0x3d')){var _0x2e71d6={};_0x2e71d6[_0xe42e99[_0xdedb('0x27')]]={'$like':'%'+_0xeb1080['query'][_0xdedb('0x3a')]+'%'};return _0x2e71d6;}})});}_0x957547=_[_0xdedb('0x3c')]({},_0x957547,_0xeb1080[_0xdedb('0x3e')]);var _0x5c9ed9={'where':_0x957547[_0xdedb('0x3b')]};return db[_0xdedb('0x2a')]['count'](_0x5c9ed9)['then'](function(_0x2c3abb){_0x4e0312[_0xdedb('0x1e')]=_0x2c3abb;if(_0xeb1080['query'][_0xdedb('0x3f')]){_0x957547['include']=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x957547);})[_0xdedb('0x40')](function(_0x5ecfd0){_0x4e0312[_0xdedb('0x41')]=_0x5ecfd0;return _0x4e0312;})['then'](respondWithFilteredResult(_0x3a7bfe,_0x957547))[_0xdedb('0x42')](handleError(_0x3a7bfe,null));};exports['show']=function(_0x21da6b,_0x35a86f){var _0x201bd9={'raw':!![],'where':{'id':_0x21da6b[_0xdedb('0x43')]['id']}},_0x7696ef={};_0x7696ef[_0xdedb('0x2f')]=_[_0xdedb('0x30')](db['SquareRecording'][_0xdedb('0x2b')]);_0x7696ef['query']=_['keys'](_0x21da6b[_0xdedb('0x31')]);_0x7696ef[_0xdedb('0x32')]=_['intersection'](_0x7696ef[_0xdedb('0x2f')],_0x7696ef[_0xdedb('0x31')]);_0x201bd9[_0xdedb('0x35')]=_[_0xdedb('0x33')](_0x7696ef[_0xdedb('0x2f')],qs[_0xdedb('0x34')](_0x21da6b[_0xdedb('0x31')]['fields']));_0x201bd9[_0xdedb('0x35')]=_0x201bd9['attributes'][_0xdedb('0x36')]?_0x201bd9['attributes']:_0x7696ef[_0xdedb('0x2f')];if(_0x21da6b['query'][_0xdedb('0x3f')]){_0x201bd9['include']=[{'all':!![]}];}_0x201bd9=_['merge']({},_0x201bd9,_0x21da6b['options']);return db[_0xdedb('0x2a')]['find'](_0x201bd9)[_0xdedb('0x40')](handleEntityNotFound(_0x35a86f,null))[_0xdedb('0x40')](respondWithResult(_0x35a86f,null))['catch'](handleError(_0x35a86f,null));};exports['create']=function(_0x4ce20d,_0x506c13){return db[_0xdedb('0x2a')][_0xdedb('0x44')](_0x4ce20d[_0xdedb('0x45')],{})[_0xdedb('0x40')](respondWithResult(_0x506c13,0xc9))[_0xdedb('0x42')](handleError(_0x506c13,null));};exports[_0xdedb('0x23')]=function(_0x2e4060,_0x3dc415){if(_0x2e4060['body']['id']){delete _0x2e4060[_0xdedb('0x45')]['id'];}return db[_0xdedb('0x2a')]['find']({'where':{'id':_0x2e4060[_0xdedb('0x43')]['id']}})[_0xdedb('0x40')](handleEntityNotFound(_0x3dc415,null))['then'](saveUpdates(_0x2e4060[_0xdedb('0x45')],null))['then'](respondWithResult(_0x3dc415,null))[_0xdedb('0x42')](handleError(_0x3dc415,null));};exports[_0xdedb('0x46')]=function(_0x30419a,_0x48e602,_0x168295){var _0x2b8da4=require(_0xdedb('0x47'));var _0x362ea0=![];var _0x31b5df={};if(_0x30419a[_0xdedb('0x31')][_0xdedb('0x2d')]&&_0x30419a[_0xdedb('0x31')][_0xdedb('0x2d')]==='uniqueid'){_0x31b5df[_0xdedb('0x48')]=_0x30419a[_0xdedb('0x43')]['id'];}else{_0x31b5df['id']=_0x30419a[_0xdedb('0x43')]['id'];}return db['SquareRecording'][_0xdedb('0x49')]({'where':_0x31b5df,'attributes':['id','savePath','filename'],'raw':!![]})[_0xdedb('0x40')](handleEntityNotFound(_0x48e602,null))[_0xdedb('0x40')](function(_0x4b2037){if(_0x4b2037){var _0x265d36=_0x4b2037['savePath'];var _0x3ca12c=util[_0xdedb('0x4a')]('%s.cypher',_0x265d36);if(fs[_0xdedb('0x4b')](_0x3ca12c)){_0x362ea0=!![];return _0x2b8da4[_0xdedb('0x4c')](_0x3ca12c,_0x265d36,config[_0xdedb('0x4d')]['recording'])[_0xdedb('0x40')](function(){return _0x4b2037;});}return _0x4b2037;}})[_0xdedb('0x40')](function(_0x568e62){if(_0x568e62){var _0x18fda9=_0x568e62[_0xdedb('0x4e')];if(!fs[_0xdedb('0x4b')](_0x18fda9)){throw new db['Sequelize'][(_0xdedb('0x4f'))](_0xdedb('0x50'));}if(_0x568e62[_0xdedb('0x51')]){return _0x48e602[_0xdedb('0x46')](_0x18fda9,_0x568e62[_0xdedb('0x51')]+path['extname'](_0x18fda9),function(){if(_0x362ea0){fs[_0xdedb('0x52')](_0x18fda9);}});}else{return _0x48e602[_0xdedb('0x46')](_0x18fda9,function(_0x5de8fa){if(_0x362ea0){fs[_0xdedb('0x52')](_0x18fda9);}});}}})[_0xdedb('0x42')](function(_0x7ca04){if(_0x7ca04[_0xdedb('0x53')]===_0xdedb('0x50')){_0x48e602[_0xdedb('0x1b')](0x194)[_0xdedb('0x54')](_0xdedb('0x55'));}else{return handleError(_0x48e602,null);}});};exports[_0xdedb('0x24')]=function(_0xf86dd8,_0x18d6bc){return db[_0xdedb('0x2a')][_0xdedb('0x49')]({'where':{'id':_0xf86dd8[_0xdedb('0x43')]['id']}})[_0xdedb('0x40')](function(_0x1a3e47){if(!_0x1a3e47)throw new ReferenceError(_0xdedb('0x56'));return _0x1a3e47;})[_0xdedb('0x40')](function(_0x45c2c8){var _0x42cc1d=_0x45c2c8[_0xdedb('0x4e')];logger[_0xdedb('0x57')](_0xdedb('0x58'),_0x42cc1d);if(!_[_0xdedb('0x59')](_0x45c2c8[_0xdedb('0x4e')])&&fs[_0xdedb('0x4b')](_0x42cc1d)){logger[_0xdedb('0x57')]('File:\x20\x22'+_0x42cc1d+_0xdedb('0x5a'));fs[_0xdedb('0x5b')](_0x42cc1d);}_0x42cc1d=_0x42cc1d+_0xdedb('0x5c');if(!_['isNil'](_0x45c2c8[_0xdedb('0x4e')])&&fs[_0xdedb('0x4b')](_0x42cc1d)){logger[_0xdedb('0x57')]('File:\x20\x22'+_0x42cc1d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xdedb('0x5b')](_0x42cc1d);}return _0x45c2c8;})['then'](function(_0x38a346){if(!_0x38a346)throw new InternalError();return _0x38a346[_0xdedb('0x24')]();})[_0xdedb('0x40')](function(){_0x18d6bc[_0xdedb('0x1b')](0xcc)[_0xdedb('0x1c')]();})[_0xdedb('0x42')](handleError(_0x18d6bc,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 999ed69..833e4b7 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 _0xd824=['rimraf','../../config/environment','SquareRecording','square_recordings','lodash','util','moment','bluebird','request-promise','path'];(function(_0xc9afd7,_0x4014a4){var _0x1a0691=function(_0x7f580c){while(--_0x7f580c){_0xc9afd7['push'](_0xc9afd7['shift']());}};_0x1a0691(++_0x4014a4);}(_0xd824,0xc2));var _0x4d82=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd824[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4d82('0x2'));var BPromise=require(_0x4d82('0x3'));var rp=require(_0x4d82('0x4'));var fs=require('fs');var path=require(_0x4d82('0x5'));var rimraf=require(_0x4d82('0x6'));var config=require(_0x4d82('0x7'));var attributes=require('./squareRecording.attributes');module['exports']=function(_0xd00023,_0x583c7c){return _0xd00023['define'](_0x4d82('0x8'),attributes,{'tableName':_0x4d82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x531a=['exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0x531a,0x100));var _0xa531=function(_0x68a0b0,_0x2bba91){_0x68a0b0=_0x68a0b0-0x0;var _0x4b4ee6=_0x531a[_0x68a0b0];return _0x4b4ee6;};'use strict';var _=require(_0xa531('0x0'));var util=require(_0xa531('0x1'));var logger=require(_0xa531('0x2'))(_0xa531('0x3'));var moment=require(_0xa531('0x4'));var BPromise=require(_0xa531('0x5'));var rp=require(_0xa531('0x6'));var fs=require('fs');var path=require(_0xa531('0x7'));var rimraf=require(_0xa531('0x8'));var config=require(_0xa531('0x9'));var attributes=require('./squareRecording.attributes');module[_0xa531('0xa')]=function(_0x4ec419,_0x266b43){return _0x4ec419[_0xa531('0xb')](_0xa531('0xc'),attributes,{'tableName':_0xa531('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 3ae5cde..83997ed 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 _0x3872=['request\x20sent','stringify','error','SquareRecording,\x20%s,\x20%s','message','catch','create','options','raw','CreateSquareRecording','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info'];(function(_0x49f8c2,_0x5166b7){var _0x3e63ec=function(_0x575c26){while(--_0x575c26){_0x49f8c2['push'](_0x49f8c2['shift']());}};_0x3e63ec(++_0x5166b7);}(_0x3872,0x1ac));var _0x2387=function(_0x227f96,_0x209e34){_0x227f96=_0x227f96-0x0;var _0x36ede5=_0x3872[_0x227f96];return _0x36ede5;};'use strict';var _=require(_0x2387('0x0'));var util=require(_0x2387('0x1'));var moment=require(_0x2387('0x2'));var BPromise=require(_0x2387('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2387('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2387('0x5'));var logger=require('../../config/logger')(_0x2387('0x6'));var config=require(_0x2387('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2387('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e8fa9,_0xa65109,_0x284248){return new BPromise(function(_0x3c9a6f,_0x51be3f){return client[_0x2387('0x9')](_0x3e8fa9,_0x284248)[_0x2387('0xa')](function(_0x2b5fd7){logger[_0x2387('0xb')]('SquareRecording,\x20%s,\x20%s',_0xa65109,_0x2387('0xc'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0xa65109,_0x2387('0xc'),JSON[_0x2387('0xd')](_0x2b5fd7));if(_0x2b5fd7[_0x2387('0xe')]){if(_0x2b5fd7[_0x2387('0xe')]['code']===0x1f4){logger['error'](_0x2387('0xf'),_0xa65109,_0x2b5fd7['error'][_0x2387('0x10')]);return _0x51be3f(_0x2b5fd7[_0x2387('0xe')]['message']);}logger[_0x2387('0xe')](_0x2387('0xf'),_0xa65109,_0x2b5fd7['error'][_0x2387('0x10')]);return _0x3c9a6f(_0x2b5fd7['error'][_0x2387('0x10')]);}else{logger['info'](_0x2387('0xf'),_0xa65109,_0x2387('0xc'));_0x3c9a6f(_0x2b5fd7['result'][_0x2387('0x10')]);}})[_0x2387('0x11')](function(_0x16d190){logger[_0x2387('0xe')](_0x2387('0xf'),_0xa65109,_0x16d190);_0x51be3f(_0x16d190);});});}exports['CreateSquareRecording']=function(_0x2ec782){var _0x5c1123=this;return new Promise(function(_0x3fc7d3,_0x31d65f){return db['SquareRecording'][_0x2387('0x12')](_0x2ec782['body'],{'raw':_0x2ec782[_0x2387('0x13')]?_0x2ec782[_0x2387('0x13')][_0x2387('0x14')]===undefined?!![]:![]:!![]})['then'](function(_0x261df7){logger[_0x2387('0xb')]('CreateSquareRecording',_0x2ec782);logger['debug'](_0x2387('0x15'),_0x2ec782,JSON[_0x2387('0xd')](_0x261df7));_0x3fc7d3(_0x261df7);})[_0x2387('0x11')](function(_0x39a057){logger[_0x2387('0xe')](_0x2387('0x15'),_0x39a057[_0x2387('0x10')],_0x2ec782);_0x31d65f(_0x5c1123['error'](0x1f4,_0x39a057[_0x2387('0x10')]));});});}; \ No newline at end of file +var _0x8e45=['then','SquareRecording,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','catch','CreateSquareRecording','SquareRecording','body','options','raw','debug','stringify','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','request'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x8e45,0xf1));var _0x58e4=function(_0x33bc5,_0x34b826){_0x33bc5=_0x33bc5-0x0;var _0x4c4312=_0x8e45[_0x33bc5];return _0x4c4312;};'use strict';var _=require('lodash');var util=require(_0x58e4('0x0'));var moment=require(_0x58e4('0x1'));var BPromise=require(_0x58e4('0x2'));var rs=require(_0x58e4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x58e4('0x4'));var logger=require(_0x58e4('0x5'))(_0x58e4('0x6'));var config=require('../../config/environment');var jayson=require(_0x58e4('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x192747,_0x1bca0c,_0xfd5c18){return new BPromise(function(_0x15b7e3,_0x28b2b8){return client[_0x58e4('0x8')](_0x192747,_0xfd5c18)[_0x58e4('0x9')](function(_0x1ce8bb){logger['info'](_0x58e4('0xa'),_0x1bca0c,_0x58e4('0xb'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x1bca0c,_0x58e4('0xb'),JSON['stringify'](_0x1ce8bb));if(_0x1ce8bb['error']){if(_0x1ce8bb['error'][_0x58e4('0xc')]===0x1f4){logger[_0x58e4('0xd')](_0x58e4('0xa'),_0x1bca0c,_0x1ce8bb['error'][_0x58e4('0xe')]);return _0x28b2b8(_0x1ce8bb['error'][_0x58e4('0xe')]);}logger[_0x58e4('0xd')](_0x58e4('0xa'),_0x1bca0c,_0x1ce8bb[_0x58e4('0xd')][_0x58e4('0xe')]);return _0x15b7e3(_0x1ce8bb[_0x58e4('0xd')][_0x58e4('0xe')]);}else{logger[_0x58e4('0xf')]('SquareRecording,\x20%s,\x20%s',_0x1bca0c,_0x58e4('0xb'));_0x15b7e3(_0x1ce8bb[_0x58e4('0x10')]['message']);}})[_0x58e4('0x11')](function(_0x74786a){logger[_0x58e4('0xd')](_0x58e4('0xa'),_0x1bca0c,_0x74786a);_0x28b2b8(_0x74786a);});});}exports[_0x58e4('0x12')]=function(_0x172dae){var _0x4239eb=this;return new Promise(function(_0x34aa5e,_0x41dc60){return db[_0x58e4('0x13')]['create'](_0x172dae[_0x58e4('0x14')],{'raw':_0x172dae[_0x58e4('0x15')]?_0x172dae[_0x58e4('0x15')][_0x58e4('0x16')]===undefined?!![]:![]:!![]})[_0x58e4('0x9')](function(_0x48565e){logger[_0x58e4('0xf')](_0x58e4('0x12'),_0x172dae);logger[_0x58e4('0x17')](_0x58e4('0x12'),_0x172dae,JSON[_0x58e4('0x18')](_0x48565e));_0x34aa5e(_0x48565e);})[_0x58e4('0x11')](function(_0xa63fd1){logger[_0x58e4('0xd')]('CreateSquareRecording',_0xa63fd1[_0x58e4('0xe')],_0x172dae);_0x41dc60(_0x4239eb['error'](0x1f4,_0xa63fd1[_0x58e4('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 2bdf690..0b20fac 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 _0x55ac=['../../components/interaction/service','./squareReport.controller','index','get','/describe','describe','/:id','isAuthenticated','post','create','put','delete','destroy','exports','express','Router','fs-extra','../../components/auth/service'];(function(_0x2fca34,_0x151dc4){var _0x4413c1=function(_0x37f8ff){while(--_0x37f8ff){_0x2fca34['push'](_0x2fca34['shift']());}};_0x4413c1(++_0x151dc4);}(_0x55ac,0x8c));var _0xc55a=function(_0x5c2f09,_0x1a80eb){_0x5c2f09=_0x5c2f09-0x0;var _0x402719=_0x55ac[_0x5c2f09];return _0x402719;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc55a('0x0'));var router=express[_0xc55a('0x1')]();var fs_extra=require(_0xc55a('0x2'));var auth=require(_0xc55a('0x3'));var interaction=require(_0xc55a('0x4'));var config=require('../../config/environment');var controller=require(_0xc55a('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xc55a('0x6')]);router[_0xc55a('0x7')](_0xc55a('0x8'),auth['isAuthenticated'](),controller[_0xc55a('0x9')]);router['get'](_0xc55a('0xa'),auth[_0xc55a('0xb')](),controller['show']);router[_0xc55a('0xc')]('/',auth['isAuthenticated'](),controller[_0xc55a('0xd')]);router[_0xc55a('0xe')](_0xc55a('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xc55a('0xf')](_0xc55a('0xa'),auth['isAuthenticated'](),controller[_0xc55a('0x10')]);module[_0xc55a('0x11')]=router; \ No newline at end of file +var _0x565e=['put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0xfcf737,_0x132075){var _0x5eccbe=function(_0x2dc482){while(--_0x2dc482){_0xfcf737['push'](_0xfcf737['shift']());}};_0x5eccbe(++_0x132075);}(_0x565e,0xb7));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe565('0x0'));var util=require(_0xe565('0x1'));var path=require('path');var timeout=require(_0xe565('0x2'));var express=require(_0xe565('0x3'));var router=express[_0xe565('0x4')]();var fs_extra=require(_0xe565('0x5'));var auth=require(_0xe565('0x6'));var interaction=require(_0xe565('0x7'));var config=require(_0xe565('0x8'));var controller=require('./squareReport.controller');router['get']('/',auth[_0xe565('0x9')](),controller[_0xe565('0xa')]);router['get'](_0xe565('0xb'),auth['isAuthenticated'](),controller[_0xe565('0xc')]);router['get'](_0xe565('0xd'),auth[_0xe565('0x9')](),controller[_0xe565('0xe')]);router[_0xe565('0xf')]('/',auth['isAuthenticated'](),controller[_0xe565('0x10')]);router[_0xe565('0x11')](_0xe565('0xd'),auth[_0xe565('0x9')](),controller['update']);router['delete'](_0xe565('0xd'),auth[_0xe565('0x9')](),controller[_0xe565('0x12')]);module[_0xe565('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 0913092..9f40ee6 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 _0x6a1e=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x3185ad,_0x5e5ca2){var _0x4f77fb=function(_0x435aca){while(--_0x435aca){_0x3185ad['push'](_0x3185ad['shift']());}};_0x4f77fb(++_0x5e5ca2);}(_0x6a1e,0xb7));var _0xe6a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a1e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe6a1('0x0'));module[_0xe6a1('0x1')]={'network':{'type':Sequelize[_0xe6a1('0x2')]},'network_script':{'type':Sequelize[_0xe6a1('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe6a1('0x2')]},'type':{'type':Sequelize[_0xe6a1('0x2')]},'uniqueid':{'type':Sequelize[_0xe6a1('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xe6a1('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xe6a1('0x2')]},'callingtns':{'type':Sequelize[_0xe6a1('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xe6a1('0x2')]},'context':{'type':Sequelize[_0xe6a1('0x2')]},'extension':{'type':Sequelize[_0xe6a1('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xe6a1('0x2')]},'accountcode':{'type':Sequelize[_0xe6a1('0x2')]},'threadid':{'type':Sequelize[_0xe6a1('0x2')]},'project_name':{'type':Sequelize[_0xe6a1('0x2')]},'joinAt':{'type':Sequelize[_0xe6a1('0x3')]},'leaveAt':{'type':Sequelize[_0xe6a1('0x3')]},'bot':{'type':Sequelize[_0xe6a1('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x5b6c=['BOOLEAN','sequelize','exports','STRING'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x5b6c,0x16d));var _0xc5b6=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x5b6c[_0x26f702];return _0x11417d;};'use strict';var Sequelize=require(_0xc5b6('0x0'));module[_0xc5b6('0x1')]={'network':{'type':Sequelize[_0xc5b6('0x2')]},'network_script':{'type':Sequelize[_0xc5b6('0x2')]},'request':{'type':Sequelize[_0xc5b6('0x2')]},'channel':{'type':Sequelize[_0xc5b6('0x2')]},'language':{'type':Sequelize[_0xc5b6('0x2')]},'type':{'type':Sequelize[_0xc5b6('0x2')]},'uniqueid':{'type':Sequelize[_0xc5b6('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xc5b6('0x2')]},'callingani2':{'type':Sequelize[_0xc5b6('0x2')]},'callington':{'type':Sequelize[_0xc5b6('0x2')]},'callingtns':{'type':Sequelize[_0xc5b6('0x2')]},'dnid':{'type':Sequelize[_0xc5b6('0x2')]},'rdnis':{'type':Sequelize[_0xc5b6('0x2')]},'context':{'type':Sequelize[_0xc5b6('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc5b6('0x2')]},'enhanced':{'type':Sequelize[_0xc5b6('0x2')]},'accountcode':{'type':Sequelize[_0xc5b6('0x2')]},'threadid':{'type':Sequelize[_0xc5b6('0x2')]},'project_name':{'type':Sequelize[_0xc5b6('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xc5b6('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index fe90a7d..76a26b9 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 _0x036d=['model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','intersection','merge','options','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key'];(function(_0x12efb2,_0x252659){var _0x20264c=function(_0x26c273){while(--_0x26c273){_0x12efb2['push'](_0x12efb2['shift']());}};_0x20264c(++_0x252659);}(_0x036d,0x15d));var _0xd036=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x036d[_0x255d5b];return _0x3e141a;};'use strict';var emlformat=require(_0xd036('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd036('0x1'));var jsonpatch=require(_0xd036('0x2'));var rp=require(_0xd036('0x3'));var moment=require(_0xd036('0x4'));var BPromise=require(_0xd036('0x5'));var Mustache=require('mustache');var util=require(_0xd036('0x6'));var path=require(_0xd036('0x7'));var sox=require(_0xd036('0x8'));var csv=require(_0xd036('0x9'));var ejs=require(_0xd036('0xa'));var fs=require('fs');var fs_extra=require(_0xd036('0xb'));var _=require(_0xd036('0xc'));var squel=require('squel');var crypto=require(_0xd036('0xd'));var jsforce=require(_0xd036('0xe'));var deskjs=require(_0xd036('0xf'));var toCsv=require(_0xd036('0x9'));var querystring=require(_0xd036('0x10'));var Papa=require(_0xd036('0x11'));var Redis=require(_0xd036('0x12'));var authService=require(_0xd036('0x13'));var qs=require(_0xd036('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd036('0x15'));var logger=require(_0xd036('0x16'))(_0xd036('0x17'));var utils=require(_0xd036('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd036('0x19'))['db'];function respondWithStatusCode(_0x5b5b70,_0x195dfc){_0x195dfc=_0x195dfc||0xcc;return function(_0x24cf8b){if(_0x24cf8b){return _0x5b5b70[_0xd036('0x1a')](_0x195dfc);}return _0x5b5b70['status'](_0x195dfc)[_0xd036('0x1b')]();};}function respondWithResult(_0x4e4035,_0x3f325e){_0x3f325e=_0x3f325e||0xc8;return function(_0x2cc23d){if(_0x2cc23d){return _0x4e4035[_0xd036('0x1c')](_0x3f325e)[_0xd036('0x1d')](_0x2cc23d);}};}function respondWithFilteredResult(_0x153059,_0x3f9c83){return function(_0x192283){if(_0x192283){var _0x38df24=_0x192283[_0xd036('0x1e')],_0x18bbd5=_0x3f9c83[_0xd036('0x1f')],_0x15514b=_0x3f9c83[_0xd036('0x1f')]+_0x3f9c83[_0xd036('0x20')],_0x20d49d;if(_0x15514b>=_0x38df24){_0x15514b=_0x38df24;_0x20d49d=0xc8;}else{_0x20d49d=0xce;}_0x153059['status'](_0x20d49d);return _0x153059[_0xd036('0x21')](_0xd036('0x22'),_0x18bbd5+'-'+_0x15514b+'/'+_0x38df24)[_0xd036('0x1d')](_0x192283);}return null;};}function patchUpdates(_0x4301e3){return function(_0x476dd4){try{jsonpatch[_0xd036('0x23')](_0x476dd4,_0x4301e3,!![]);}catch(_0x2a54ef){return BPromise[_0xd036('0x24')](_0x2a54ef);}return _0x476dd4[_0xd036('0x25')]();};}function saveUpdates(_0x160ac6,_0x373aff){return function(_0xec12ac){if(_0xec12ac){return _0xec12ac[_0xd036('0x26')](_0x160ac6)['then'](function(_0x2f241e){return _0x2f241e;});}return null;};}function removeEntity(_0x138cec,_0x2ccbfa){return function(_0xd4df9c){if(_0xd4df9c){return _0xd4df9c[_0xd036('0x27')]()[_0xd036('0x28')](function(){_0x138cec[_0xd036('0x1c')](0xcc)[_0xd036('0x1b')]();});}};}function handleEntityNotFound(_0x3cc779,_0x343d53){return function(_0x31237b){if(!_0x31237b){_0x3cc779[_0xd036('0x1a')](0x194);}return _0x31237b;};}function handleError(_0xfac3e6,_0x239d1b){_0x239d1b=_0x239d1b||0x1f4;return function(_0x593427){logger[_0xd036('0x29')](_0x593427['stack']);if(_0x593427[_0xd036('0x2a')]){delete _0x593427[_0xd036('0x2a')];}_0xfac3e6['status'](_0x239d1b)[_0xd036('0x2b')](_0x593427);};}exports[_0xd036('0x2c')]=function(_0x552272,_0x12c662){var _0x5d0f0={},_0x809879={},_0x2ae8f4={'count':0x0,'rows':[]};var _0x534c66=_[_0xd036('0x2d')](db[_0xd036('0x2e')][_0xd036('0x2f')],function(_0x61bb26){return{'name':_0x61bb26[_0xd036('0x30')],'type':_0x61bb26[_0xd036('0x31')][_0xd036('0x32')]};});_0x809879[_0xd036('0x33')]=_[_0xd036('0x2d')](_0x534c66,_0xd036('0x2a'));_0x809879['query']=_[_0xd036('0x34')](_0x552272[_0xd036('0x35')]);_0x809879[_0xd036('0x36')]=_['intersection'](_0x809879[_0xd036('0x33')],_0x809879[_0xd036('0x35')]);_0x5d0f0['attributes']=_['intersection'](_0x809879[_0xd036('0x33')],qs[_0xd036('0x37')](_0x552272[_0xd036('0x35')][_0xd036('0x37')]));_0x5d0f0[_0xd036('0x38')]=_0x5d0f0[_0xd036('0x38')][_0xd036('0x39')]?_0x5d0f0[_0xd036('0x38')]:_0x809879[_0xd036('0x33')];if(!_0x552272['query'][_0xd036('0x3a')](_0xd036('0x3b'))){_0x5d0f0['limit']=qs[_0xd036('0x20')](_0x552272[_0xd036('0x35')][_0xd036('0x20')]);_0x5d0f0['offset']=qs['offset'](_0x552272[_0xd036('0x35')][_0xd036('0x1f')]);}_0x5d0f0[_0xd036('0x3c')]=qs[_0xd036('0x3d')](_0x552272['query'][_0xd036('0x3d')]);_0x5d0f0[_0xd036('0x3e')]=qs['filters'](_[_0xd036('0x3f')](_0x552272[_0xd036('0x35')],_0x809879[_0xd036('0x36')]),_0x534c66);if(_0x552272[_0xd036('0x35')][_0xd036('0x40')]){_0x5d0f0[_0xd036('0x3e')]=_['merge'](_0x5d0f0[_0xd036('0x3e')],{'$or':_['map'](_0x534c66,function(_0x3b46fb){if(_0x3b46fb['type']!==_0xd036('0x41')){var _0x3bc157={};_0x3bc157[_0x3b46fb['name']]={'$like':'%'+_0x552272['query'][_0xd036('0x40')]+'%'};return _0x3bc157;}})});}_0x5d0f0=_['merge']({},_0x5d0f0,_0x552272['options']);var _0x419df9={'where':_0x5d0f0[_0xd036('0x3e')]};return db[_0xd036('0x2e')][_0xd036('0x1e')](_0x419df9)[_0xd036('0x28')](function(_0x2d6ef4){_0x2ae8f4[_0xd036('0x1e')]=_0x2d6ef4;if(_0x552272['query'][_0xd036('0x42')]){_0x5d0f0[_0xd036('0x43')]=[{'all':!![]}];}return db['SquareReport'][_0xd036('0x44')](_0x5d0f0);})[_0xd036('0x28')](function(_0x519ce3){_0x2ae8f4[_0xd036('0x45')]=_0x519ce3;return _0x2ae8f4;})[_0xd036('0x28')](respondWithFilteredResult(_0x12c662,_0x5d0f0))[_0xd036('0x46')](handleError(_0x12c662,null));};exports[_0xd036('0x47')]=function(_0xc2a751,_0x1b3f17){var _0x202842={'raw':!![],'where':{'id':_0xc2a751[_0xd036('0x48')]['id']}},_0x14ba12={};_0x14ba12['model']=_[_0xd036('0x34')](db[_0xd036('0x2e')][_0xd036('0x2f')]);_0x14ba12[_0xd036('0x35')]=_[_0xd036('0x34')](_0xc2a751[_0xd036('0x35')]);_0x14ba12[_0xd036('0x36')]=_[_0xd036('0x49')](_0x14ba12[_0xd036('0x33')],_0x14ba12[_0xd036('0x35')]);_0x202842[_0xd036('0x38')]=_[_0xd036('0x49')](_0x14ba12[_0xd036('0x33')],qs['fields'](_0xc2a751[_0xd036('0x35')][_0xd036('0x37')]));_0x202842[_0xd036('0x38')]=_0x202842[_0xd036('0x38')][_0xd036('0x39')]?_0x202842['attributes']:_0x14ba12['model'];if(_0xc2a751[_0xd036('0x35')][_0xd036('0x42')]){_0x202842[_0xd036('0x43')]=[{'all':!![]}];}_0x202842=_[_0xd036('0x4a')]({},_0x202842,_0xc2a751[_0xd036('0x4b')]);return db[_0xd036('0x2e')]['find'](_0x202842)['then'](handleEntityNotFound(_0x1b3f17,null))[_0xd036('0x28')](respondWithResult(_0x1b3f17,null))[_0xd036('0x46')](handleError(_0x1b3f17,null));};exports[_0xd036('0x4c')]=function(_0x477031,_0x6be396){return db['SquareReport'][_0xd036('0x4c')](_0x477031[_0xd036('0x4d')],{})[_0xd036('0x28')](respondWithResult(_0x6be396,0xc9))['catch'](handleError(_0x6be396,null));};exports[_0xd036('0x26')]=function(_0x38d453,_0x5c0b33){if(_0x38d453[_0xd036('0x4d')]['id']){delete _0x38d453[_0xd036('0x4d')]['id'];}return db[_0xd036('0x2e')]['find']({'where':{'id':_0x38d453[_0xd036('0x48')]['id']}})[_0xd036('0x28')](handleEntityNotFound(_0x5c0b33,null))['then'](saveUpdates(_0x38d453[_0xd036('0x4d')],null))[_0xd036('0x28')](respondWithResult(_0x5c0b33,null))[_0xd036('0x46')](handleError(_0x5c0b33,null));};exports[_0xd036('0x27')]=function(_0x2c94a0,_0x4659b3){return db[_0xd036('0x2e')][_0xd036('0x4e')]({'where':{'id':_0x2c94a0['params']['id']}})[_0xd036('0x28')](handleEntityNotFound(_0x4659b3,null))[_0xd036('0x28')](removeEntity(_0x4659b3,null))[_0xd036('0x46')](handleError(_0x4659b3,null));};exports[_0xd036('0x4f')]=function(_0x2520ca,_0x291d60){return db[_0xd036('0x2e')][_0xd036('0x4f')]()[_0xd036('0x28')](respondWithResult(_0x291d60,null))[_0xd036('0x46')](handleError(_0x291d60,null));}; \ No newline at end of file +var _0x552a=['error','name','send','map','SquareReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','then','destroy'];(function(_0x280bb5,_0x4a1aff){var _0x2b760c=function(_0x53b65a){while(--_0x53b65a){_0x280bb5['push'](_0x280bb5['shift']());}};_0x2b760c(++_0x4a1aff);}(_0x552a,0xaf));var _0xa552=function(_0x52a941,_0x33ab69){_0x52a941=_0x52a941-0x0;var _0x54bd86=_0x552a[_0x52a941];return _0x54bd86;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa552('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa552('0x1'));var moment=require(_0xa552('0x2'));var BPromise=require(_0xa552('0x3'));var Mustache=require(_0xa552('0x4'));var util=require('util');var path=require(_0xa552('0x5'));var sox=require('sox');var csv=require(_0xa552('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa552('0x7'));var crypto=require(_0xa552('0x8'));var jsforce=require(_0xa552('0x9'));var deskjs=require(_0xa552('0xa'));var toCsv=require(_0xa552('0x6'));var querystring=require(_0xa552('0xb'));var Papa=require(_0xa552('0xc'));var Redis=require('ioredis');var authService=require(_0xa552('0xd'));var qs=require(_0xa552('0xe'));var as=require(_0xa552('0xf'));var hardwareService=require(_0xa552('0x10'));var logger=require(_0xa552('0x11'))(_0xa552('0x12'));var utils=require(_0xa552('0x13'));var config=require(_0xa552('0x14'));var licenseUtil=require(_0xa552('0x15'));var db=require(_0xa552('0x16'))['db'];function respondWithStatusCode(_0x4a891e,_0x203b8f){_0x203b8f=_0x203b8f||0xcc;return function(_0x422ffe){if(_0x422ffe){return _0x4a891e[_0xa552('0x17')](_0x203b8f);}return _0x4a891e[_0xa552('0x18')](_0x203b8f)[_0xa552('0x19')]();};}function respondWithResult(_0x5d6f32,_0x297556){_0x297556=_0x297556||0xc8;return function(_0x44b321){if(_0x44b321){return _0x5d6f32[_0xa552('0x18')](_0x297556)[_0xa552('0x1a')](_0x44b321);}};}function respondWithFilteredResult(_0x55e882,_0x3c2a89){return function(_0x14be0b){if(_0x14be0b){var _0x31828e=_0x14be0b[_0xa552('0x1b')],_0x3c7649=_0x3c2a89[_0xa552('0x1c')],_0x52240b=_0x3c2a89[_0xa552('0x1c')]+_0x3c2a89['limit'],_0x169be4;if(_0x52240b>=_0x31828e){_0x52240b=_0x31828e;_0x169be4=0xc8;}else{_0x169be4=0xce;}_0x55e882[_0xa552('0x18')](_0x169be4);return _0x55e882[_0xa552('0x1d')](_0xa552('0x1e'),_0x3c7649+'-'+_0x52240b+'/'+_0x31828e)[_0xa552('0x1a')](_0x14be0b);}return null;};}function patchUpdates(_0x22c3b4){return function(_0x2e6716){try{jsonpatch['apply'](_0x2e6716,_0x22c3b4,!![]);}catch(_0x3e24ec){return BPromise['reject'](_0x3e24ec);}return _0x2e6716[_0xa552('0x1f')]();};}function saveUpdates(_0x9ac27d,_0x3463b3){return function(_0x5c94bd){if(_0x5c94bd){return _0x5c94bd[_0xa552('0x20')](_0x9ac27d)[_0xa552('0x21')](function(_0x3b8d07){return _0x3b8d07;});}return null;};}function removeEntity(_0x3cac07,_0x106097){return function(_0xd36a91){if(_0xd36a91){return _0xd36a91[_0xa552('0x22')]()['then'](function(){_0x3cac07[_0xa552('0x18')](0xcc)[_0xa552('0x19')]();});}};}function handleEntityNotFound(_0x575a62,_0x920756){return function(_0x53658b){if(!_0x53658b){_0x575a62[_0xa552('0x17')](0x194);}return _0x53658b;};}function handleError(_0x2f3064,_0x1d4b8c){_0x1d4b8c=_0x1d4b8c||0x1f4;return function(_0xf4d071){logger[_0xa552('0x23')](_0xf4d071['stack']);if(_0xf4d071[_0xa552('0x24')]){delete _0xf4d071['name'];}_0x2f3064['status'](_0x1d4b8c)[_0xa552('0x25')](_0xf4d071);};}exports['index']=function(_0x3e87d7,_0x3e7df9){var _0x5e20e2={},_0x3901de={},_0x2139ae={'count':0x0,'rows':[]};var _0x35257f=_[_0xa552('0x26')](db[_0xa552('0x27')][_0xa552('0x28')],function(_0xd1afcf){return{'name':_0xd1afcf[_0xa552('0x29')],'type':_0xd1afcf['type'][_0xa552('0x2a')]};});_0x3901de[_0xa552('0x2b')]=_[_0xa552('0x26')](_0x35257f,'name');_0x3901de[_0xa552('0x2c')]=_[_0xa552('0x2d')](_0x3e87d7['query']);_0x3901de[_0xa552('0x2e')]=_[_0xa552('0x2f')](_0x3901de[_0xa552('0x2b')],_0x3901de['query']);_0x5e20e2[_0xa552('0x30')]=_[_0xa552('0x2f')](_0x3901de[_0xa552('0x2b')],qs[_0xa552('0x31')](_0x3e87d7['query'][_0xa552('0x31')]));_0x5e20e2[_0xa552('0x30')]=_0x5e20e2[_0xa552('0x30')]['length']?_0x5e20e2[_0xa552('0x30')]:_0x3901de[_0xa552('0x2b')];if(!_0x3e87d7[_0xa552('0x2c')][_0xa552('0x32')]('nolimit')){_0x5e20e2[_0xa552('0x33')]=qs[_0xa552('0x33')](_0x3e87d7[_0xa552('0x2c')][_0xa552('0x33')]);_0x5e20e2[_0xa552('0x1c')]=qs[_0xa552('0x1c')](_0x3e87d7[_0xa552('0x2c')][_0xa552('0x1c')]);}_0x5e20e2['order']=qs[_0xa552('0x34')](_0x3e87d7[_0xa552('0x2c')][_0xa552('0x34')]);_0x5e20e2[_0xa552('0x35')]=qs[_0xa552('0x2e')](_[_0xa552('0x36')](_0x3e87d7[_0xa552('0x2c')],_0x3901de[_0xa552('0x2e')]),_0x35257f);if(_0x3e87d7[_0xa552('0x2c')][_0xa552('0x37')]){_0x5e20e2[_0xa552('0x35')]=_['merge'](_0x5e20e2[_0xa552('0x35')],{'$or':_[_0xa552('0x26')](_0x35257f,function(_0x30d667){if(_0x30d667['type']!==_0xa552('0x38')){var _0x83094d={};_0x83094d[_0x30d667['name']]={'$like':'%'+_0x3e87d7['query'][_0xa552('0x37')]+'%'};return _0x83094d;}})});}_0x5e20e2=_[_0xa552('0x39')]({},_0x5e20e2,_0x3e87d7[_0xa552('0x3a')]);var _0x2eb422={'where':_0x5e20e2[_0xa552('0x35')]};return db['SquareReport'][_0xa552('0x1b')](_0x2eb422)[_0xa552('0x21')](function(_0x3f70c4){_0x2139ae[_0xa552('0x1b')]=_0x3f70c4;if(_0x3e87d7[_0xa552('0x2c')][_0xa552('0x3b')]){_0x5e20e2[_0xa552('0x3c')]=[{'all':!![]}];}return db[_0xa552('0x27')][_0xa552('0x3d')](_0x5e20e2);})[_0xa552('0x21')](function(_0x2579a0){_0x2139ae[_0xa552('0x3e')]=_0x2579a0;return _0x2139ae;})[_0xa552('0x21')](respondWithFilteredResult(_0x3e7df9,_0x5e20e2))[_0xa552('0x3f')](handleError(_0x3e7df9,null));};exports[_0xa552('0x40')]=function(_0x35ea70,_0x59e229){var _0x51eb6f={'raw':!![],'where':{'id':_0x35ea70[_0xa552('0x41')]['id']}},_0x24feda={};_0x24feda[_0xa552('0x2b')]=_[_0xa552('0x2d')](db[_0xa552('0x27')]['rawAttributes']);_0x24feda[_0xa552('0x2c')]=_['keys'](_0x35ea70['query']);_0x24feda[_0xa552('0x2e')]=_[_0xa552('0x2f')](_0x24feda[_0xa552('0x2b')],_0x24feda[_0xa552('0x2c')]);_0x51eb6f['attributes']=_['intersection'](_0x24feda['model'],qs[_0xa552('0x31')](_0x35ea70['query'][_0xa552('0x31')]));_0x51eb6f[_0xa552('0x30')]=_0x51eb6f[_0xa552('0x30')]['length']?_0x51eb6f[_0xa552('0x30')]:_0x24feda[_0xa552('0x2b')];if(_0x35ea70[_0xa552('0x2c')]['includeAll']){_0x51eb6f[_0xa552('0x3c')]=[{'all':!![]}];}_0x51eb6f=_[_0xa552('0x39')]({},_0x51eb6f,_0x35ea70[_0xa552('0x3a')]);return db['SquareReport'][_0xa552('0x42')](_0x51eb6f)[_0xa552('0x21')](handleEntityNotFound(_0x59e229,null))[_0xa552('0x21')](respondWithResult(_0x59e229,null))[_0xa552('0x3f')](handleError(_0x59e229,null));};exports['create']=function(_0x2fac12,_0x1d952f){return db[_0xa552('0x27')][_0xa552('0x43')](_0x2fac12['body'],{})[_0xa552('0x21')](respondWithResult(_0x1d952f,0xc9))[_0xa552('0x3f')](handleError(_0x1d952f,null));};exports[_0xa552('0x20')]=function(_0xefd4f0,_0x5cc5db){if(_0xefd4f0['body']['id']){delete _0xefd4f0[_0xa552('0x44')]['id'];}return db[_0xa552('0x27')][_0xa552('0x42')]({'where':{'id':_0xefd4f0[_0xa552('0x41')]['id']}})[_0xa552('0x21')](handleEntityNotFound(_0x5cc5db,null))[_0xa552('0x21')](saveUpdates(_0xefd4f0[_0xa552('0x44')],null))[_0xa552('0x21')](respondWithResult(_0x5cc5db,null))[_0xa552('0x3f')](handleError(_0x5cc5db,null));};exports[_0xa552('0x22')]=function(_0x47b7f1,_0x39cf4e){return db[_0xa552('0x27')]['find']({'where':{'id':_0x47b7f1[_0xa552('0x41')]['id']}})['then'](handleEntityNotFound(_0x39cf4e,null))['then'](removeEntity(_0x39cf4e,null))[_0xa552('0x3f')](handleError(_0x39cf4e,null));};exports['describe']=function(_0x24fef9,_0x55a877){return db[_0xa552('0x27')][_0xa552('0x45')]()['then'](respondWithResult(_0x55a877,null))[_0xa552('0x3f')](handleError(_0x55a877,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 38b7def..b9f8229 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 _0x4182=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','util'];(function(_0x5520b6,_0x403438){var _0x4cb159=function(_0x52e12c){while(--_0x52e12c){_0x5520b6['push'](_0x5520b6['shift']());}};_0x4cb159(++_0x403438);}(_0x4182,0xa9));var _0x2418=function(_0x1d1219,_0x23fc71){_0x1d1219=_0x1d1219-0x0;var _0x5b5b89=_0x4182[_0x1d1219];return _0x5b5b89;};'use strict';var _=require('lodash');var util=require(_0x2418('0x0'));var logger=require(_0x2418('0x1'))(_0x2418('0x2'));var moment=require(_0x2418('0x3'));var BPromise=require(_0x2418('0x4'));var rp=require(_0x2418('0x5'));var fs=require('fs');var path=require(_0x2418('0x6'));var rimraf=require('rimraf');var config=require(_0x2418('0x7'));var attributes=require(_0x2418('0x8'));module[_0x2418('0x9')]=function(_0x1bad59,_0x193733){return _0x1bad59[_0x2418('0xa')](_0x2418('0xb'),attributes,{'tableName':_0x2418('0xc'),'paranoid':![],'indexes':[{'name':_0x2418('0xd'),'fields':[_0x2418('0xe'),_0x2418('0xf')]},{'name':_0x2418('0x10'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x72e0=['util','bluebird','request-promise','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uniqueid','project_name','leaveAt','lodash'];(function(_0x40cc54,_0x112d26){var _0x4740db=function(_0x46a0cd){while(--_0x46a0cd){_0x40cc54['push'](_0x40cc54['shift']());}};_0x4740db(++_0x112d26);}(_0x72e0,0xf6));var _0x072e=function(_0x2012ed,_0x3e04c7){_0x2012ed=_0x2012ed-0x0;var _0x1cd6fc=_0x72e0[_0x2012ed];return _0x1cd6fc;};'use strict';var _=require(_0x072e('0x0'));var util=require(_0x072e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x072e('0x2'));var rp=require(_0x072e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x072e('0x4'));var config=require(_0x072e('0x5'));var attributes=require(_0x072e('0x6'));module[_0x072e('0x7')]=function(_0x578ef7,_0x4b3c92){return _0x578ef7['define'](_0x072e('0x8'),attributes,{'tableName':_0x072e('0x9'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x072e('0xa'),_0x072e('0xb')]},{'name':'leaveAt','fields':[_0x072e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 4aae8b3..9830ab6 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 _0x6aa7=['client','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareReport','create','body','options','raw','UpdateSquareReport','SquareReport','update','where','attributes','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x10bb26,_0x3de948){var _0x5ed3ba=function(_0x7dce14){while(--_0x7dce14){_0x10bb26['push'](_0x10bb26['shift']());}};_0x5ed3ba(++_0x3de948);}(_0x6aa7,0x178));var _0x76aa=function(_0x334fb8,_0xa4a9a6){_0x334fb8=_0x334fb8-0x0;var _0xd1c3b1=_0x6aa7[_0x334fb8];return _0xd1c3b1;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['SquareReport'][_0x76aa('0x17')](_0x21c16d[_0x76aa('0x18')],{'raw':_0x21c16d[_0x76aa('0x19')]?_0x21c16d[_0x76aa('0x19')][_0x76aa('0x1a')]===undefined?!![]:![]:!![]})[_0x76aa('0xa')](function(_0x19af92){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger['debug'](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0x19af92));_0x3ead3f(_0x19af92);})[_0x76aa('0x15')](function(_0x5b3f55){logger[_0x76aa('0x11')](_0x76aa('0x16'),_0x5b3f55[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x5b3f55[_0x76aa('0x13')]));});});};exports[_0x76aa('0x1b')]=function(_0x3cd039){var _0x3363b3=this;return new Promise(function(_0x32bf9f,_0x2cba6d){return db[_0x76aa('0x1c')][_0x76aa('0x1d')](_0x3cd039[_0x76aa('0x18')],{'raw':_0x3cd039['options']?_0x3cd039[_0x76aa('0x19')][_0x76aa('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cd039[_0x76aa('0x19')]?_0x3cd039[_0x76aa('0x19')][_0x76aa('0x1e')]||null:null,'attributes':_0x3cd039[_0x76aa('0x19')]?_0x3cd039[_0x76aa('0x19')][_0x76aa('0x1f')]||null:null,'limit':_0x3cd039[_0x76aa('0x19')]?_0x3cd039[_0x76aa('0x19')]['limit']||null:null})[_0x76aa('0xa')](function(_0x5a8030){logger[_0x76aa('0xb')](_0x76aa('0x1b'),_0x3cd039);logger[_0x76aa('0xe')](_0x76aa('0x1b'),_0x3cd039,JSON[_0x76aa('0x10')](_0x5a8030));_0x32bf9f(_0x5a8030);})[_0x76aa('0x15')](function(_0x2ee0f9){logger[_0x76aa('0x11')](_0x76aa('0x1b'),_0x2ee0f9[_0x76aa('0x13')],_0x3cd039);_0x2cba6d(_0x3363b3['error'](0x1f4,_0x2ee0f9[_0x76aa('0x13')]));});});}; \ No newline at end of file +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(_0x152121,_0x120c53){var _0x592a85=function(_0x241cab){while(--_0x241cab){_0x152121['push'](_0x152121['shift']());}};_0x592a85(++_0x120c53);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4fe56b,_0x53d094){_0x4fe56b=_0x4fe56b-0x0;var _0x238f05=_0x7fbe[_0x4fe56b];return _0x238f05;};'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 diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 8b89e1f..3c9b0a3 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 _0x7249=['fs-extra','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','describe','/:id','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7249,0xff));var _0x9724=function(_0x242fcc,_0x217422){_0x242fcc=_0x242fcc-0x0;var _0x3549f2=_0x7249[_0x242fcc];return _0x3549f2;};'use strict';var multer=require(_0x9724('0x0'));var util=require(_0x9724('0x1'));var path=require('path');var timeout=require(_0x9724('0x2'));var express=require(_0x9724('0x3'));var router=express[_0x9724('0x4')]();var fs_extra=require(_0x9724('0x5'));var auth=require(_0x9724('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9724('0x7'));var controller=require(_0x9724('0x8'));router[_0x9724('0x9')]('/',auth[_0x9724('0xa')](),controller[_0x9724('0xb')]);router[_0x9724('0x9')]('/describe',auth[_0x9724('0xa')](),controller[_0x9724('0xc')]);router[_0x9724('0x9')](_0x9724('0xd'),auth[_0x9724('0xa')](),controller['show']);router[_0x9724('0xe')]('/',auth[_0x9724('0xa')](),controller[_0x9724('0xf')]);router['put']('/:id',auth[_0x9724('0xa')](),controller[_0x9724('0x10')]);router[_0x9724('0x11')](_0x9724('0xd'),auth[_0x9724('0xa')](),controller[_0x9724('0x12')]);module[_0x9724('0x13')]=router; \ No newline at end of file +var _0x8f8c=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','path','connect-timeout'];(function(_0x5dd2a7,_0x59f0d){var _0x513185=function(_0xe2aa16){while(--_0xe2aa16){_0x5dd2a7['push'](_0x5dd2a7['shift']());}};_0x513185(++_0x59f0d);}(_0x8f8c,0x1dd));var _0xc8f8=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x8f8c[_0x2fc012];return _0x2891f9;};'use strict';var multer=require(_0xc8f8('0x0'));var util=require('util');var path=require(_0xc8f8('0x1'));var timeout=require(_0xc8f8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc8f8('0x3'));var auth=require(_0xc8f8('0x4'));var interaction=require(_0xc8f8('0x5'));var config=require(_0xc8f8('0x6'));var controller=require(_0xc8f8('0x7'));router['get']('/',auth[_0xc8f8('0x8')](),controller[_0xc8f8('0x9')]);router[_0xc8f8('0xa')](_0xc8f8('0xb'),auth[_0xc8f8('0x8')](),controller[_0xc8f8('0xc')]);router[_0xc8f8('0xa')](_0xc8f8('0xd'),auth[_0xc8f8('0x8')](),controller[_0xc8f8('0xe')]);router['post']('/',auth[_0xc8f8('0x8')](),controller[_0xc8f8('0xf')]);router[_0xc8f8('0x10')](_0xc8f8('0xd'),auth['isAuthenticated'](),controller[_0xc8f8('0x11')]);router[_0xc8f8('0x12')](_0xc8f8('0xd'),auth[_0xc8f8('0x8')](),controller[_0xc8f8('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index acf3434..8440892 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 _0x62f2=['exports','STRING','sequelize'];(function(_0x1064bc,_0x206f12){var _0x5edc45=function(_0x5087bd){while(--_0x5087bd){_0x1064bc['push'](_0x1064bc['shift']());}};_0x5edc45(++_0x206f12);}(_0x62f2,0x125));var _0x262f=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x62f2[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x262f('0x0'));module[_0x262f('0x1')]={'uniqueid':{'type':Sequelize[_0x262f('0x2')]},'node':{'type':Sequelize[_0x262f('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x262f('0x2')]}}; \ No newline at end of file +var _0xe336=['STRING','TEXT','sequelize'];(function(_0x2f46eb,_0x53d27b){var _0x44c7f3=function(_0x2bd43e){while(--_0x2bd43e){_0x2f46eb['push'](_0x2f46eb['shift']());}};_0x44c7f3(++_0x53d27b);}(_0xe336,0x170));var _0x6e33=function(_0x48240a,_0x213c56){_0x48240a=_0x48240a-0x0;var _0x444d9f=_0xe336[_0x48240a];return _0x444d9f;};'use strict';var Sequelize=require(_0x6e33('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x6e33('0x1')]},'node':{'type':Sequelize[_0x6e33('0x1')]},'application':{'type':Sequelize[_0x6e33('0x1')]},'data':{'type':Sequelize[_0x6e33('0x2')]},'project_name':{'type':Sequelize[_0x6e33('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 3bc55ab..7d50c3a 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 _0x9a49=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','SquareDetailsReport','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','apply','reject','save','update','then','destroy','error','stack','send','rawAttributes','type','model','map','name'];(function(_0x45a86f,_0x4395c9){var _0x540720=function(_0x5c6e8b){while(--_0x5c6e8b){_0x45a86f['push'](_0x45a86f['shift']());}};_0x540720(++_0x4395c9);}(_0x9a49,0x18b));var _0x99a4=function(_0x8cb8ed,_0x59acb4){_0x8cb8ed=_0x8cb8ed-0x0;var _0x7f279d=_0x9a49[_0x8cb8ed];return _0x7f279d;};'use strict';var emlformat=require(_0x99a4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x99a4('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x99a4('0x2'));var Mustache=require(_0x99a4('0x3'));var util=require(_0x99a4('0x4'));var path=require(_0x99a4('0x5'));var sox=require(_0x99a4('0x6'));var csv=require(_0x99a4('0x7'));var ejs=require(_0x99a4('0x8'));var fs=require('fs');var fs_extra=require(_0x99a4('0x9'));var _=require('lodash');var squel=require(_0x99a4('0xa'));var crypto=require(_0x99a4('0xb'));var jsforce=require(_0x99a4('0xc'));var deskjs=require(_0x99a4('0xd'));var toCsv=require(_0x99a4('0x7'));var querystring=require(_0x99a4('0xe'));var Papa=require('papaparse');var Redis=require(_0x99a4('0xf'));var authService=require(_0x99a4('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x99a4('0x11'));var logger=require(_0x99a4('0x12'))(_0x99a4('0x13'));var utils=require('../../config/utils');var config=require(_0x99a4('0x14'));var licenseUtil=require(_0x99a4('0x15'));var db=require(_0x99a4('0x16'))['db'];function respondWithStatusCode(_0x68738,_0x437953){_0x437953=_0x437953||0xcc;return function(_0x16e50b){if(_0x16e50b){return _0x68738[_0x99a4('0x17')](_0x437953);}return _0x68738[_0x99a4('0x18')](_0x437953)['end']();};}function respondWithResult(_0x2b4678,_0x2c93ff){_0x2c93ff=_0x2c93ff||0xc8;return function(_0x51af3b){if(_0x51af3b){return _0x2b4678[_0x99a4('0x18')](_0x2c93ff)[_0x99a4('0x19')](_0x51af3b);}};}function respondWithFilteredResult(_0x3d7ca5,_0x501960){return function(_0x36a15f){if(_0x36a15f){var _0x575237=_0x36a15f[_0x99a4('0x1a')],_0x31505a=_0x501960[_0x99a4('0x1b')],_0x4c4de9=_0x501960[_0x99a4('0x1b')]+_0x501960['limit'],_0x491ecf;if(_0x4c4de9>=_0x575237){_0x4c4de9=_0x575237;_0x491ecf=0xc8;}else{_0x491ecf=0xce;}_0x3d7ca5[_0x99a4('0x18')](_0x491ecf);return _0x3d7ca5[_0x99a4('0x1c')]('Content-Range',_0x31505a+'-'+_0x4c4de9+'/'+_0x575237)[_0x99a4('0x19')](_0x36a15f);}return null;};}function patchUpdates(_0x2b13e8){return function(_0x5e6cab){try{jsonpatch[_0x99a4('0x1d')](_0x5e6cab,_0x2b13e8,!![]);}catch(_0x63146b){return BPromise[_0x99a4('0x1e')](_0x63146b);}return _0x5e6cab[_0x99a4('0x1f')]();};}function saveUpdates(_0x15021c,_0x8d581b){return function(_0x4afc8a){if(_0x4afc8a){return _0x4afc8a[_0x99a4('0x20')](_0x15021c)[_0x99a4('0x21')](function(_0xdc2a52){return _0xdc2a52;});}return null;};}function removeEntity(_0x44d6d1,_0x369bb8){return function(_0x45fe4d){if(_0x45fe4d){return _0x45fe4d[_0x99a4('0x22')]()[_0x99a4('0x21')](function(){_0x44d6d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7d71bd,_0x3e25c2){return function(_0x1831fe){if(!_0x1831fe){_0x7d71bd[_0x99a4('0x17')](0x194);}return _0x1831fe;};}function handleError(_0x496dc8,_0x2552d9){_0x2552d9=_0x2552d9||0x1f4;return function(_0x2f1c65){logger[_0x99a4('0x23')](_0x2f1c65[_0x99a4('0x24')]);if(_0x2f1c65['name']){delete _0x2f1c65['name'];}_0x496dc8[_0x99a4('0x18')](_0x2552d9)[_0x99a4('0x25')](_0x2f1c65);};}exports['index']=function(_0x303abd,_0x47dfcf){var _0x5f3225={},_0x510155={},_0x50a651={'count':0x0,'rows':[]};var _0x576c9c=_['map'](db['SquareDetailsReport'][_0x99a4('0x26')],function(_0x2ef073){return{'name':_0x2ef073['fieldName'],'type':_0x2ef073[_0x99a4('0x27')]['key']};});_0x510155[_0x99a4('0x28')]=_[_0x99a4('0x29')](_0x576c9c,_0x99a4('0x2a'));_0x510155[_0x99a4('0x2b')]=_[_0x99a4('0x2c')](_0x303abd[_0x99a4('0x2b')]);_0x510155[_0x99a4('0x2d')]=_[_0x99a4('0x2e')](_0x510155[_0x99a4('0x28')],_0x510155['query']);_0x5f3225['attributes']=_[_0x99a4('0x2e')](_0x510155[_0x99a4('0x28')],qs[_0x99a4('0x2f')](_0x303abd[_0x99a4('0x2b')][_0x99a4('0x2f')]));_0x5f3225[_0x99a4('0x30')]=_0x5f3225[_0x99a4('0x30')][_0x99a4('0x31')]?_0x5f3225[_0x99a4('0x30')]:_0x510155[_0x99a4('0x28')];if(!_0x303abd[_0x99a4('0x2b')][_0x99a4('0x32')](_0x99a4('0x33'))){_0x5f3225[_0x99a4('0x34')]=qs[_0x99a4('0x34')](_0x303abd['query'][_0x99a4('0x34')]);_0x5f3225[_0x99a4('0x1b')]=qs['offset'](_0x303abd[_0x99a4('0x2b')][_0x99a4('0x1b')]);}_0x5f3225[_0x99a4('0x35')]=qs[_0x99a4('0x36')](_0x303abd[_0x99a4('0x2b')][_0x99a4('0x36')]);_0x5f3225['where']=qs[_0x99a4('0x2d')](_[_0x99a4('0x37')](_0x303abd[_0x99a4('0x2b')],_0x510155[_0x99a4('0x2d')]),_0x576c9c);if(_0x303abd[_0x99a4('0x2b')][_0x99a4('0x38')]){_0x5f3225[_0x99a4('0x39')]=_[_0x99a4('0x3a')](_0x5f3225[_0x99a4('0x39')],{'$or':_[_0x99a4('0x29')](_0x576c9c,function(_0x17af08){if(_0x17af08[_0x99a4('0x27')]!==_0x99a4('0x3b')){var _0x1f0392={};_0x1f0392[_0x17af08[_0x99a4('0x2a')]]={'$like':'%'+_0x303abd[_0x99a4('0x2b')][_0x99a4('0x38')]+'%'};return _0x1f0392;}})});}_0x5f3225=_[_0x99a4('0x3a')]({},_0x5f3225,_0x303abd[_0x99a4('0x3c')]);var _0x100f4c={'where':_0x5f3225[_0x99a4('0x39')]};return db[_0x99a4('0x3d')][_0x99a4('0x1a')](_0x100f4c)['then'](function(_0x24779b){_0x50a651[_0x99a4('0x1a')]=_0x24779b;if(_0x303abd[_0x99a4('0x2b')][_0x99a4('0x3e')]){_0x5f3225[_0x99a4('0x3f')]=[{'all':!![]}];}return db[_0x99a4('0x3d')][_0x99a4('0x40')](_0x5f3225);})[_0x99a4('0x21')](function(_0x2ebfdd){_0x50a651[_0x99a4('0x41')]=_0x2ebfdd;return _0x50a651;})[_0x99a4('0x21')](respondWithFilteredResult(_0x47dfcf,_0x5f3225))['catch'](handleError(_0x47dfcf,null));};exports[_0x99a4('0x42')]=function(_0x1362c0,_0x1b4474){var _0x393460={'raw':!![],'where':{'id':_0x1362c0[_0x99a4('0x43')]['id']}},_0x4baa77={};_0x4baa77[_0x99a4('0x28')]=_[_0x99a4('0x2c')](db[_0x99a4('0x3d')][_0x99a4('0x26')]);_0x4baa77[_0x99a4('0x2b')]=_[_0x99a4('0x2c')](_0x1362c0[_0x99a4('0x2b')]);_0x4baa77[_0x99a4('0x2d')]=_['intersection'](_0x4baa77[_0x99a4('0x28')],_0x4baa77[_0x99a4('0x2b')]);_0x393460['attributes']=_[_0x99a4('0x2e')](_0x4baa77[_0x99a4('0x28')],qs[_0x99a4('0x2f')](_0x1362c0['query'][_0x99a4('0x2f')]));_0x393460['attributes']=_0x393460['attributes'][_0x99a4('0x31')]?_0x393460['attributes']:_0x4baa77[_0x99a4('0x28')];if(_0x1362c0['query'][_0x99a4('0x3e')]){_0x393460['include']=[{'all':!![]}];}_0x393460=_[_0x99a4('0x3a')]({},_0x393460,_0x1362c0[_0x99a4('0x3c')]);return db[_0x99a4('0x3d')][_0x99a4('0x44')](_0x393460)[_0x99a4('0x21')](handleEntityNotFound(_0x1b4474,null))[_0x99a4('0x21')](respondWithResult(_0x1b4474,null))[_0x99a4('0x45')](handleError(_0x1b4474,null));};exports['create']=function(_0x1a0261,_0x2ecb90){return db[_0x99a4('0x3d')][_0x99a4('0x46')](_0x1a0261['body'],{})[_0x99a4('0x21')](respondWithResult(_0x2ecb90,0xc9))[_0x99a4('0x45')](handleError(_0x2ecb90,null));};exports[_0x99a4('0x20')]=function(_0x4eb766,_0x4ebc60){if(_0x4eb766[_0x99a4('0x47')]['id']){delete _0x4eb766['body']['id'];}return db[_0x99a4('0x3d')][_0x99a4('0x44')]({'where':{'id':_0x4eb766[_0x99a4('0x43')]['id']}})[_0x99a4('0x21')](handleEntityNotFound(_0x4ebc60,null))[_0x99a4('0x21')](saveUpdates(_0x4eb766[_0x99a4('0x47')],null))[_0x99a4('0x21')](respondWithResult(_0x4ebc60,null))[_0x99a4('0x45')](handleError(_0x4ebc60,null));};exports[_0x99a4('0x22')]=function(_0xcb9d64,_0x30d739){return db[_0x99a4('0x3d')][_0x99a4('0x44')]({'where':{'id':_0xcb9d64[_0x99a4('0x43')]['id']}})[_0x99a4('0x21')](handleEntityNotFound(_0x30d739,null))[_0x99a4('0x21')](removeEntity(_0x30d739,null))[_0x99a4('0x45')](handleError(_0x30d739,null));};exports['describe']=function(_0x3b7708,_0x14dd3a){return db[_0x99a4('0x3d')][_0x99a4('0x48')]()[_0x99a4('0x21')](respondWithResult(_0x14dd3a,null))[_0x99a4('0x45')](handleError(_0x14dd3a,null));}; \ No newline at end of file +var _0x68b6=['mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','limit','Content-Range','json','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','map','SquareDetailsReport','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','rawAttributes','include','find','create','body','params','describe','rimraf','fast-json-patch'];(function(_0x284807,_0x4be925){var _0x50c774=function(_0xf56cf7){while(--_0xf56cf7){_0x284807['push'](_0x284807['shift']());}};_0x50c774(++_0x4be925);}(_0x68b6,0xd0));var _0x668b=function(_0x6b6bce,_0x35cbcd){_0x6b6bce=_0x6b6bce-0x0;var _0x4076b6=_0x68b6[_0x6b6bce];return _0x4076b6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x668b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x668b('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x668b('0x2'));var util=require(_0x668b('0x3'));var path=require(_0x668b('0x4'));var sox=require(_0x668b('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x668b('0x6'));var _=require(_0x668b('0x7'));var squel=require(_0x668b('0x8'));var crypto=require('crypto');var jsforce=require(_0x668b('0x9'));var deskjs=require(_0x668b('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x668b('0xb'));var authService=require(_0x668b('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x668b('0xd'));var hardwareService=require(_0x668b('0xe'));var logger=require(_0x668b('0xf'))(_0x668b('0x10'));var utils=require(_0x668b('0x11'));var config=require(_0x668b('0x12'));var licenseUtil=require(_0x668b('0x13'));var db=require(_0x668b('0x14'))['db'];function respondWithStatusCode(_0x1c4619,_0xeba2c3){_0xeba2c3=_0xeba2c3||0xcc;return function(_0x35a41a){if(_0x35a41a){return _0x1c4619['sendStatus'](_0xeba2c3);}return _0x1c4619[_0x668b('0x15')](_0xeba2c3)[_0x668b('0x16')]();};}function respondWithResult(_0x31985e,_0x168b46){_0x168b46=_0x168b46||0xc8;return function(_0x185471){if(_0x185471){return _0x31985e[_0x668b('0x15')](_0x168b46)['json'](_0x185471);}};}function respondWithFilteredResult(_0x4ff9c8,_0x116288){return function(_0x396659){if(_0x396659){var _0x2b89c7=_0x396659['count'],_0x1fb9e5=_0x116288['offset'],_0x3e7c0c=_0x116288['offset']+_0x116288[_0x668b('0x17')],_0x2bd42f;if(_0x3e7c0c>=_0x2b89c7){_0x3e7c0c=_0x2b89c7;_0x2bd42f=0xc8;}else{_0x2bd42f=0xce;}_0x4ff9c8[_0x668b('0x15')](_0x2bd42f);return _0x4ff9c8['set'](_0x668b('0x18'),_0x1fb9e5+'-'+_0x3e7c0c+'/'+_0x2b89c7)[_0x668b('0x19')](_0x396659);}return null;};}function patchUpdates(_0x47abb7){return function(_0x226712){try{jsonpatch[_0x668b('0x1a')](_0x226712,_0x47abb7,!![]);}catch(_0x50e33c){return BPromise[_0x668b('0x1b')](_0x50e33c);}return _0x226712[_0x668b('0x1c')]();};}function saveUpdates(_0x3a496d,_0x2a0e9b){return function(_0x2f18f5){if(_0x2f18f5){return _0x2f18f5['update'](_0x3a496d)['then'](function(_0xf6118d){return _0xf6118d;});}return null;};}function removeEntity(_0x2d114a,_0x339d42){return function(_0x4b5e46){if(_0x4b5e46){return _0x4b5e46[_0x668b('0x1d')]()[_0x668b('0x1e')](function(){_0x2d114a[_0x668b('0x15')](0xcc)[_0x668b('0x16')]();});}};}function handleEntityNotFound(_0x1e5485,_0x167c6e){return function(_0x3965e1){if(!_0x3965e1){_0x1e5485[_0x668b('0x1f')](0x194);}return _0x3965e1;};}function handleError(_0x232c17,_0x165687){_0x165687=_0x165687||0x1f4;return function(_0x89672b){logger[_0x668b('0x20')](_0x89672b[_0x668b('0x21')]);if(_0x89672b['name']){delete _0x89672b[_0x668b('0x22')];}_0x232c17[_0x668b('0x15')](_0x165687)[_0x668b('0x23')](_0x89672b);};}exports['index']=function(_0x4ec31a,_0x40969e){var _0x3c9779={},_0x2cb97c={},_0x405979={'count':0x0,'rows':[]};var _0x4b6ff9=_[_0x668b('0x24')](db[_0x668b('0x25')]['rawAttributes'],function(_0x44c211){return{'name':_0x44c211['fieldName'],'type':_0x44c211[_0x668b('0x26')][_0x668b('0x27')]};});_0x2cb97c[_0x668b('0x28')]=_[_0x668b('0x24')](_0x4b6ff9,_0x668b('0x22'));_0x2cb97c[_0x668b('0x29')]=_[_0x668b('0x2a')](_0x4ec31a[_0x668b('0x29')]);_0x2cb97c[_0x668b('0x2b')]=_[_0x668b('0x2c')](_0x2cb97c[_0x668b('0x28')],_0x2cb97c[_0x668b('0x29')]);_0x3c9779['attributes']=_[_0x668b('0x2c')](_0x2cb97c[_0x668b('0x28')],qs[_0x668b('0x2d')](_0x4ec31a['query'][_0x668b('0x2d')]));_0x3c9779[_0x668b('0x2e')]=_0x3c9779[_0x668b('0x2e')][_0x668b('0x2f')]?_0x3c9779['attributes']:_0x2cb97c['model'];if(!_0x4ec31a[_0x668b('0x29')][_0x668b('0x30')](_0x668b('0x31'))){_0x3c9779[_0x668b('0x17')]=qs[_0x668b('0x17')](_0x4ec31a[_0x668b('0x29')][_0x668b('0x17')]);_0x3c9779['offset']=qs['offset'](_0x4ec31a[_0x668b('0x29')]['offset']);}_0x3c9779[_0x668b('0x32')]=qs['sort'](_0x4ec31a['query'][_0x668b('0x33')]);_0x3c9779['where']=qs[_0x668b('0x2b')](_[_0x668b('0x34')](_0x4ec31a[_0x668b('0x29')],_0x2cb97c['filters']),_0x4b6ff9);if(_0x4ec31a[_0x668b('0x29')][_0x668b('0x35')]){_0x3c9779[_0x668b('0x36')]=_['merge'](_0x3c9779['where'],{'$or':_[_0x668b('0x24')](_0x4b6ff9,function(_0x26621a){if(_0x26621a['type']!==_0x668b('0x37')){var _0xeaccf={};_0xeaccf[_0x26621a[_0x668b('0x22')]]={'$like':'%'+_0x4ec31a[_0x668b('0x29')][_0x668b('0x35')]+'%'};return _0xeaccf;}})});}_0x3c9779=_[_0x668b('0x38')]({},_0x3c9779,_0x4ec31a[_0x668b('0x39')]);var _0x324586={'where':_0x3c9779['where']};return db[_0x668b('0x25')][_0x668b('0x3a')](_0x324586)['then'](function(_0x10730e){_0x405979[_0x668b('0x3a')]=_0x10730e;if(_0x4ec31a[_0x668b('0x29')][_0x668b('0x3b')]){_0x3c9779['include']=[{'all':!![]}];}return db[_0x668b('0x25')][_0x668b('0x3c')](_0x3c9779);})[_0x668b('0x1e')](function(_0x166444){_0x405979[_0x668b('0x3d')]=_0x166444;return _0x405979;})[_0x668b('0x1e')](respondWithFilteredResult(_0x40969e,_0x3c9779))[_0x668b('0x3e')](handleError(_0x40969e,null));};exports['show']=function(_0x4e6c10,_0x12a78f){var _0x590364={'raw':!![],'where':{'id':_0x4e6c10['params']['id']}},_0x1f90d3={};_0x1f90d3[_0x668b('0x28')]=_[_0x668b('0x2a')](db[_0x668b('0x25')][_0x668b('0x3f')]);_0x1f90d3['query']=_['keys'](_0x4e6c10[_0x668b('0x29')]);_0x1f90d3['filters']=_[_0x668b('0x2c')](_0x1f90d3[_0x668b('0x28')],_0x1f90d3[_0x668b('0x29')]);_0x590364[_0x668b('0x2e')]=_['intersection'](_0x1f90d3[_0x668b('0x28')],qs['fields'](_0x4e6c10[_0x668b('0x29')]['fields']));_0x590364[_0x668b('0x2e')]=_0x590364['attributes'][_0x668b('0x2f')]?_0x590364[_0x668b('0x2e')]:_0x1f90d3[_0x668b('0x28')];if(_0x4e6c10['query']['includeAll']){_0x590364[_0x668b('0x40')]=[{'all':!![]}];}_0x590364=_['merge']({},_0x590364,_0x4e6c10[_0x668b('0x39')]);return db[_0x668b('0x25')][_0x668b('0x41')](_0x590364)[_0x668b('0x1e')](handleEntityNotFound(_0x12a78f,null))[_0x668b('0x1e')](respondWithResult(_0x12a78f,null))[_0x668b('0x3e')](handleError(_0x12a78f,null));};exports[_0x668b('0x42')]=function(_0x2989d2,_0x3f9c19){return db[_0x668b('0x25')]['create'](_0x2989d2[_0x668b('0x43')],{})[_0x668b('0x1e')](respondWithResult(_0x3f9c19,0xc9))[_0x668b('0x3e')](handleError(_0x3f9c19,null));};exports['update']=function(_0x42e1a7,_0x400c69){if(_0x42e1a7[_0x668b('0x43')]['id']){delete _0x42e1a7[_0x668b('0x43')]['id'];}return db[_0x668b('0x25')][_0x668b('0x41')]({'where':{'id':_0x42e1a7['params']['id']}})[_0x668b('0x1e')](handleEntityNotFound(_0x400c69,null))[_0x668b('0x1e')](saveUpdates(_0x42e1a7[_0x668b('0x43')],null))['then'](respondWithResult(_0x400c69,null))[_0x668b('0x3e')](handleError(_0x400c69,null));};exports[_0x668b('0x1d')]=function(_0x4b2c5a,_0x18d0da){return db[_0x668b('0x25')][_0x668b('0x41')]({'where':{'id':_0x4b2c5a[_0x668b('0x44')]['id']}})[_0x668b('0x1e')](handleEntityNotFound(_0x18d0da,null))['then'](removeEntity(_0x18d0da,null))[_0x668b('0x3e')](handleError(_0x18d0da,null));};exports[_0x668b('0x45')]=function(_0x6930a7,_0x51c664){return db['SquareDetailsReport'][_0x668b('0x45')]()['then'](respondWithResult(_0x51c664,null))['catch'](handleError(_0x51c664,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index cbae3dd..6cf82ee 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 _0x340f=['rimraf','./squareReportDetail.attributes','exports','define','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x340f,0x157));var _0xf340=function(_0x52df07,_0x4e1cab){_0x52df07=_0x52df07-0x0;var _0x3da42b=_0x340f[_0x52df07];return _0x3da42b;};'use strict';var _=require(_0xf340('0x0'));var util=require(_0xf340('0x1'));var logger=require(_0xf340('0x2'))(_0xf340('0x3'));var moment=require(_0xf340('0x4'));var BPromise=require(_0xf340('0x5'));var rp=require(_0xf340('0x6'));var fs=require('fs');var path=require(_0xf340('0x7'));var rimraf=require(_0xf340('0x8'));var config=require('../../config/environment');var attributes=require(_0xf340('0x9'));module[_0xf340('0xa')]=function(_0x4ad76a,_0x4696f3){return _0x4ad76a[_0xf340('0xb')]('SquareDetailsReport',attributes,{'tableName':_0xf340('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7535=['path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','api','bluebird','request-promise'];(function(_0x3d5ebc,_0x354479){var _0x1a9911=function(_0x1da1ea){while(--_0x1da1ea){_0x3d5ebc['push'](_0x3d5ebc['shift']());}};_0x1a9911(++_0x354479);}(_0x7535,0x19b));var _0x5753=function(_0xdefbc3,_0x1ea49a){_0xdefbc3=_0xdefbc3-0x0;var _0x367798=_0x7535[_0xdefbc3];return _0x367798;};'use strict';var _=require(_0x5753('0x0'));var util=require(_0x5753('0x1'));var logger=require('../../config/logger')(_0x5753('0x2'));var moment=require('moment');var BPromise=require(_0x5753('0x3'));var rp=require(_0x5753('0x4'));var fs=require('fs');var path=require(_0x5753('0x5'));var rimraf=require(_0x5753('0x6'));var config=require(_0x5753('0x7'));var attributes=require(_0x5753('0x8'));module[_0x5753('0x9')]=function(_0x50430c,_0x4895aa){return _0x50430c[_0x5753('0xa')](_0x5753('0xb'),attributes,{'tableName':_0x5753('0xc'),'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 f586b95..bdec9c9 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 _0xf8cc=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','debug','lodash'];(function(_0x4da6ba,_0x554ea7){var _0x4b8317=function(_0x573de2){while(--_0x573de2){_0x4da6ba['push'](_0x4da6ba['shift']());}};_0x4b8317(++_0x554ea7);}(_0xf8cc,0x1df));var _0xcf8c=function(_0x502542,_0x5c5b7a){_0x502542=_0x502542-0x0;var _0x17eab3=_0xf8cc[_0x502542];return _0x17eab3;};'use strict';var _=require(_0xcf8c('0x0'));var util=require(_0xcf8c('0x1'));var moment=require(_0xcf8c('0x2'));var BPromise=require(_0xcf8c('0x3'));var rs=require(_0xcf8c('0x4'));var fs=require('fs');var Redis=require(_0xcf8c('0x5'));var db=require(_0xcf8c('0x6'))['db'];var utils=require(_0xcf8c('0x7'));var logger=require(_0xcf8c('0x8'))(_0xcf8c('0x9'));var config=require(_0xcf8c('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xcf8c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x333359,_0x4853b1,_0x590ab3){return new BPromise(function(_0x9a6f51,_0xd6fefd){return client[_0xcf8c('0xc')](_0x333359,_0x590ab3)[_0xcf8c('0xd')](function(_0x35e530){logger[_0xcf8c('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x4853b1,'request\x20sent');logger['debug'](_0xcf8c('0xf'),_0x4853b1,_0xcf8c('0x10'),JSON[_0xcf8c('0x11')](_0x35e530));if(_0x35e530[_0xcf8c('0x12')]){if(_0x35e530['error'][_0xcf8c('0x13')]===0x1f4){logger[_0xcf8c('0x12')](_0xcf8c('0x14'),_0x4853b1,_0x35e530[_0xcf8c('0x12')]['message']);return _0xd6fefd(_0x35e530['error'][_0xcf8c('0x15')]);}logger[_0xcf8c('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x4853b1,_0x35e530['error'][_0xcf8c('0x15')]);return _0x9a6f51(_0x35e530['error']['message']);}else{logger[_0xcf8c('0xe')](_0xcf8c('0x14'),_0x4853b1,'request\x20sent');_0x9a6f51(_0x35e530[_0xcf8c('0x16')][_0xcf8c('0x15')]);}})[_0xcf8c('0x17')](function(_0x4be687){logger['error'](_0xcf8c('0x14'),_0x4853b1,_0x4be687);_0xd6fefd(_0x4be687);});});}exports[_0xcf8c('0x18')]=function(_0x4c7c96){var _0x4d4e31=this;return new Promise(function(_0x8d85da,_0x556de1){return db[_0xcf8c('0x19')][_0xcf8c('0x1a')](_0x4c7c96[_0xcf8c('0x1b')],{'raw':_0x4c7c96[_0xcf8c('0x1c')]?_0x4c7c96[_0xcf8c('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xcf8c('0xd')](function(_0x5378ff){logger[_0xcf8c('0xe')](_0xcf8c('0x18'),_0x4c7c96);logger[_0xcf8c('0x1d')](_0xcf8c('0x18'),_0x4c7c96,JSON[_0xcf8c('0x11')](_0x5378ff));_0x8d85da(_0x5378ff);})[_0xcf8c('0x17')](function(_0x2fd7ac){logger[_0xcf8c('0x12')]('CreateSquareDetailsReport',_0x2fd7ac[_0xcf8c('0x15')],_0x4c7c96);_0x556de1(_0x4d4e31[_0xcf8c('0x12')](0x1f4,_0x2fd7ac[_0xcf8c('0x15')]));});});}; \ No newline at end of file +var _0xac8c=['../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0xac8c,0xf6));var _0xcac8=function(_0x29c261,_0x3af39a){_0x29c261=_0x29c261-0x0;var _0x1a9335=_0xac8c[_0x29c261];return _0x1a9335;};'use strict';var _=require(_0xcac8('0x0'));var util=require(_0xcac8('0x1'));var moment=require(_0xcac8('0x2'));var BPromise=require(_0xcac8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcac8('0x4'));var db=require(_0xcac8('0x5'))['db'];var utils=require(_0xcac8('0x6'));var logger=require(_0xcac8('0x7'))('rpc');var config=require(_0xcac8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcac8('0x9')][_0xcac8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42445a,_0x141e27,_0x4e08e0){return new BPromise(function(_0x17e82,_0x4eb26e){return client[_0xcac8('0xb')](_0x42445a,_0x4e08e0)[_0xcac8('0xc')](function(_0x339213){logger[_0xcac8('0xd')](_0xcac8('0xe'),_0x141e27,_0xcac8('0xf'));logger[_0xcac8('0x10')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x141e27,_0xcac8('0xf'),JSON['stringify'](_0x339213));if(_0x339213[_0xcac8('0x11')]){if(_0x339213[_0xcac8('0x11')][_0xcac8('0x12')]===0x1f4){logger[_0xcac8('0x11')](_0xcac8('0xe'),_0x141e27,_0x339213[_0xcac8('0x11')]['message']);return _0x4eb26e(_0x339213['error'][_0xcac8('0x13')]);}logger['error'](_0xcac8('0xe'),_0x141e27,_0x339213['error'][_0xcac8('0x13')]);return _0x17e82(_0x339213['error'][_0xcac8('0x13')]);}else{logger[_0xcac8('0xd')](_0xcac8('0xe'),_0x141e27,'request\x20sent');_0x17e82(_0x339213[_0xcac8('0x14')][_0xcac8('0x13')]);}})[_0xcac8('0x15')](function(_0x28b45d){logger[_0xcac8('0x11')](_0xcac8('0xe'),_0x141e27,_0x28b45d);_0x4eb26e(_0x28b45d);});});}exports[_0xcac8('0x16')]=function(_0x19ce0f){var _0x2a35b7=this;return new Promise(function(_0xe5abcd,_0xccde86){return db[_0xcac8('0x17')][_0xcac8('0x18')](_0x19ce0f[_0xcac8('0x19')],{'raw':_0x19ce0f['options']?_0x19ce0f['options'][_0xcac8('0x1a')]===undefined?!![]:![]:!![]})[_0xcac8('0xc')](function(_0x2f09d3){logger[_0xcac8('0xd')](_0xcac8('0x16'),_0x19ce0f);logger[_0xcac8('0x10')](_0xcac8('0x16'),_0x19ce0f,JSON[_0xcac8('0x1b')](_0x2f09d3));_0xe5abcd(_0x2f09d3);})[_0xcac8('0x15')](function(_0x4447a1){logger[_0xcac8('0x11')](_0xcac8('0x16'),_0x4447a1[_0xcac8('0x13')],_0x19ce0f);_0xccde86(_0x2a35b7['error'](0x1f4,_0x4447a1[_0xcac8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index d6a4c68..75367f2 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 _0xcef7=['isAuthenticated','/process/:pid/kill','exports','Router','../../components/auth/service','./system.controller','get'];(function(_0x508cbb,_0x20a9cc){var _0x4aeee4=function(_0x1f721e){while(--_0x1f721e){_0x508cbb['push'](_0x508cbb['shift']());}};_0x4aeee4(++_0x20a9cc);}(_0xcef7,0xe3));var _0x7cef=function(_0x56533f,_0xe3f977){_0x56533f=_0x56533f-0x0;var _0x2620a9=_0xcef7[_0x56533f];return _0x2620a9;};'use strict';var express=require('express');var router=express[_0x7cef('0x0')]();var auth=require(_0x7cef('0x1'));var controller=require(_0x7cef('0x2'));router[_0x7cef('0x3')]('/',auth[_0x7cef('0x4')](),controller['index']);router[_0x7cef('0x3')](_0x7cef('0x5'),auth['isAuthenticated'](),controller['killProcess']);module[_0x7cef('0x6')]=router; \ No newline at end of file +var _0x8747=['killProcess','exports','express','Router','../../components/auth/service','./system.controller','get','/process/:pid/kill'];(function(_0x3832f9,_0x59c443){var _0x37418c=function(_0x133ee9){while(--_0x133ee9){_0x3832f9['push'](_0x3832f9['shift']());}};_0x37418c(++_0x59c443);}(_0x8747,0x1ba));var _0x7874=function(_0x42ebba,_0x4cbf87){_0x42ebba=_0x42ebba-0x0;var _0x3fd2af=_0x8747[_0x42ebba];return _0x3fd2af;};'use strict';var express=require(_0x7874('0x0'));var router=express[_0x7874('0x1')]();var auth=require(_0x7874('0x2'));var controller=require(_0x7874('0x3'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7874('0x4')](_0x7874('0x5'),auth['isAuthenticated'](),controller[_0x7874('0x6')]);module[_0x7874('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 dc31d04..19b37fe 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 _0x9e24=['../../config/logger','util','bluebird','lodash','error','status','index','then','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','systeminformation','exec'];(function(_0x56b3b3,_0x3a3709){var _0x27a6ae=function(_0x357151){while(--_0x357151){_0x56b3b3['push'](_0x56b3b3['shift']());}};_0x27a6ae(++_0x3a3709);}(_0x9e24,0xc4));var _0x49e2=function(_0x2ade6c,_0x2d42f2){_0x2ade6c=_0x2ade6c-0x0;var _0x2cb372=_0x9e24[_0x2ade6c];return _0x2cb372;};'use strict';var info=require(_0x49e2('0x0'));var exec=require('child_process')[_0x49e2('0x1')];var logger=require(_0x49e2('0x2'))('api');var util=require(_0x49e2('0x3'));var BPromise=require(_0x49e2('0x4'));var _=require(_0x49e2('0x5'));function handleError(_0x368baf,_0x1c7694,_0x4e59c9){_0x1c7694=_0x1c7694||0x1f4;return function(_0x306c0d){logger[_0x49e2('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x4e59c9,_0x1c7694,util['inspect'](_0x306c0d,{'showHidden':![],'depth':null}));delete _0x306c0d['name'];_0x368baf[_0x49e2('0x7')](_0x1c7694)['send'](_0x306c0d);};}exports[_0x49e2('0x8')]=function(_0xccb69d,_0x49995a){return info['getAllData']()[_0x49e2('0x9')](function(_0xc15bb){return _0x49995a[_0x49e2('0x7')](0xc8)[_0x49e2('0xa')](_0xc15bb);})[_0x49e2('0xb')](function(_0x31a29f){return _0x49995a[_0x49e2('0x7')](0x1f4)[_0x49e2('0xa')](_0x31a29f);});};exports[_0x49e2('0xc')]=function(_0x30d9d8,_0x103372){var _0x4b4598=['components/import/cm'];return new BPromise(function(_0x43a666,_0x553120){return exec(util[_0x49e2('0xd')](_0x49e2('0xe'),_0x30d9d8['params'][_0x49e2('0xf')]),function(_0xe06e5a,_0xc93a7f,_0x25192f){if(_0xe06e5a){return _0x553120(_0xe06e5a);}return _0x43a666(_0xc93a7f);});})[_0x49e2('0x9')](function(_0x3de693){var _0xdceb37=![];var _0x2a97b3=_0x3de693['split'](/\n/);for(var _0x367cc3=0x0,_0x3de20d=_0x4b4598[_0x49e2('0x10')];_0x367cc3<_0x3de20d,_0xdceb37===![];_0x367cc3+=0x1){if(_0x3de693[_0x49e2('0x11')](_0x4b4598[_0x367cc3])>=0x0){_0xdceb37=!![];}}if(!_0xdceb37){throw new Error(util[_0x49e2('0xd')](_0x49e2('0x12'),_0x30d9d8[_0x49e2('0x13')][_0x49e2('0xf')]));}process[_0x49e2('0x14')](_0x30d9d8['params']['pid'],_0x49e2('0x15'));return _0x103372[_0x49e2('0x7')](0xc8)['json']({'message':util[_0x49e2('0xd')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x30d9d8['params'][_0x49e2('0xf')])});})['catch'](handleError(_0x103372,null,'killProcess'));}; \ No newline at end of file +var _0xe7c2=['Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','killProcess','format','params','pid','indexOf','SIGINT'];(function(_0x305c31,_0x466b17){var _0x17f39f=function(_0x53ae03){while(--_0x53ae03){_0x305c31['push'](_0x305c31['shift']());}};_0x17f39f(++_0x466b17);}(_0xe7c2,0x114));var _0x2e7c=function(_0x5e5627,_0x52aabd){_0x5e5627=_0x5e5627-0x0;var _0x7382b5=_0xe7c2[_0x5e5627];return _0x7382b5;};'use strict';var info=require(_0x2e7c('0x0'));var exec=require(_0x2e7c('0x1'))[_0x2e7c('0x2')];var logger=require(_0x2e7c('0x3'))(_0x2e7c('0x4'));var util=require(_0x2e7c('0x5'));var BPromise=require(_0x2e7c('0x6'));var _=require(_0x2e7c('0x7'));function handleError(_0x53a2c6,_0x309909,_0xc4db56){_0x309909=_0x309909||0x1f4;return function(_0x3d56ca){logger['error'](_0x2e7c('0x8'),_0xc4db56,_0x309909,util[_0x2e7c('0x9')](_0x3d56ca,{'showHidden':![],'depth':null}));delete _0x3d56ca[_0x2e7c('0xa')];_0x53a2c6[_0x2e7c('0xb')](_0x309909)[_0x2e7c('0xc')](_0x3d56ca);};}exports[_0x2e7c('0xd')]=function(_0x18dff9,_0x552ccb){return info[_0x2e7c('0xe')]()[_0x2e7c('0xf')](function(_0x56dede){return _0x552ccb['status'](0xc8)[_0x2e7c('0x10')](_0x56dede);})[_0x2e7c('0x11')](function(_0x3b9f1d){return _0x552ccb[_0x2e7c('0xb')](0x1f4)[_0x2e7c('0x10')](_0x3b9f1d);});};exports[_0x2e7c('0x12')]=function(_0x53b1fd,_0x3e8be2){var _0x8a5d85=['components/import/cm'];return new BPromise(function(_0x3d8bae,_0x2314f6){return exec(util[_0x2e7c('0x13')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x53b1fd[_0x2e7c('0x14')][_0x2e7c('0x15')]),function(_0x2a8537,_0x428dd8,_0x48505b){if(_0x2a8537){return _0x2314f6(_0x2a8537);}return _0x3d8bae(_0x428dd8);});})[_0x2e7c('0xf')](function(_0x113825){var _0x423fe9=![];var _0x11d765=_0x113825['split'](/\n/);for(var _0x3996ce=0x0,_0x1a8790=_0x8a5d85['length'];_0x3996ce<_0x1a8790,_0x423fe9===![];_0x3996ce+=0x1){if(_0x113825[_0x2e7c('0x16')](_0x8a5d85[_0x3996ce])>=0x0){_0x423fe9=!![];}}if(!_0x423fe9){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x53b1fd[_0x2e7c('0x14')]['pid']));}process['kill'](_0x53b1fd[_0x2e7c('0x14')][_0x2e7c('0x15')],_0x2e7c('0x17'));return _0x3e8be2[_0x2e7c('0xb')](0xc8)[_0x2e7c('0x10')]({'message':util['format'](_0x2e7c('0x18'),_0x53b1fd[_0x2e7c('0x14')][_0x2e7c('0x15')])});})[_0x2e7c('0x11')](handleError(_0x3e8be2,null,_0x2e7c('0x12')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 12b3f59..198ca64 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 _0x22ef=['isAuthenticated','index','/:id','show','post','create','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get'];(function(_0x3998ff,_0x58f511){var _0xfd997d=function(_0x114dc6){while(--_0x114dc6){_0x3998ff['push'](_0x3998ff['shift']());}};_0xfd997d(++_0x58f511);}(_0x22ef,0xd8));var _0xf22e=function(_0x4b662b,_0x24d004){_0x4b662b=_0x4b662b-0x0;var _0x1b58b7=_0x22ef[_0x4b662b];return _0x1b58b7;};'use strict';var multer=require(_0xf22e('0x0'));var util=require(_0xf22e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf22e('0x2'));var router=express[_0xf22e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf22e('0x4'));var interaction=require(_0xf22e('0x5'));var config=require(_0xf22e('0x6'));var controller=require(_0xf22e('0x7'));router[_0xf22e('0x8')]('/',auth[_0xf22e('0x9')](),controller[_0xf22e('0xa')]);router[_0xf22e('0x8')](_0xf22e('0xb'),auth[_0xf22e('0x9')](),controller[_0xf22e('0xc')]);router[_0xf22e('0xd')]('/',auth[_0xf22e('0x9')](),controller[_0xf22e('0xe')]);router['put'](_0xf22e('0xb'),auth[_0xf22e('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xda33=['/:id','post','create','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated'];(function(_0xbf802e,_0x329296){var _0x19e99b=function(_0x36e374){while(--_0x36e374){_0xbf802e['push'](_0xbf802e['shift']());}};_0x19e99b(++_0x329296);}(_0xda33,0x1b7));var _0x3da3=function(_0xadb54a,_0x1dd2d1){_0xadb54a=_0xadb54a-0x0;var _0x38a79a=_0xda33[_0xadb54a];return _0x38a79a;};'use strict';var multer=require(_0x3da3('0x0'));var util=require(_0x3da3('0x1'));var path=require(_0x3da3('0x2'));var timeout=require('connect-timeout');var express=require(_0x3da3('0x3'));var router=express[_0x3da3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3da3('0x5'));var interaction=require(_0x3da3('0x6'));var config=require(_0x3da3('0x7'));var controller=require(_0x3da3('0x8'));router[_0x3da3('0x9')]('/',auth[_0x3da3('0xa')](),controller['index']);router[_0x3da3('0x9')](_0x3da3('0xb'),auth[_0x3da3('0xa')](),controller['show']);router[_0x3da3('0xc')]('/',auth['isAuthenticated'](),controller[_0x3da3('0xd')]);router[_0x3da3('0xe')]('/:id',auth[_0x3da3('0xa')](),controller[_0x3da3('0xf')]);router[_0x3da3('0x10')]('/:id',auth[_0x3da3('0xa')](),controller[_0x3da3('0x11')]);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 4755151..55e0073 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 _0xb10b=['name','sequelize','STRING'];(function(_0x4d5fb6,_0x23eb20){var _0x37ff0e=function(_0x8ad1f2){while(--_0x8ad1f2){_0x4d5fb6['push'](_0x4d5fb6['shift']());}};_0x37ff0e(++_0x23eb20);}(_0xb10b,0x12a));var _0xbb10=function(_0x435e3c,_0x4ffd0b){_0x435e3c=_0x435e3c-0x0;var _0x5250b9=_0xb10b[_0x435e3c];return _0x5250b9;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'unique':_0xbb10('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xd7d1=['sequelize','exports','STRING','name','#0091EA'];(function(_0x2ee0bf,_0x2bf774){var _0x24e45c=function(_0x58704f){while(--_0x58704f){_0x2ee0bf['push'](_0x2ee0bf['shift']());}};_0x24e45c(++_0x2bf774);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x1a2264,_0x42c4a7){_0x1a2264=_0x1a2264-0x0;var _0x5a591e=_0xd7d1[_0x1a2264];return _0x5a591e;};'use strict';var Sequelize=require(_0x1d7d('0x0'));module[_0x1d7d('0x1')]={'name':{'type':Sequelize[_0x1d7d('0x2')],'unique':_0x1d7d('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x1d7d('0x2')],'defaultValue':_0x1d7d('0x4')},'description':{'type':Sequelize[_0x1d7d('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 3e161d2..94555d2 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 _0xda58=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','Tag','findAll','rows','show','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x448e2d,_0x5d9276){var _0x48ef4c=function(_0x1e2c0d){while(--_0x1e2c0d){_0x448e2d['push'](_0x448e2d['shift']());}};_0x48ef4c(++_0x5d9276);}(_0xda58,0xea));var _0x8da5=function(_0x211658,_0x224b80){_0x211658=_0x211658-0x0;var _0x452b27=_0xda58[_0x211658];return _0x452b27;};'use strict';var emlformat=require(_0x8da5('0x0'));var rimraf=require(_0x8da5('0x1'));var zipdir=require(_0x8da5('0x2'));var jsonpatch=require(_0x8da5('0x3'));var rp=require(_0x8da5('0x4'));var moment=require(_0x8da5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8da5('0x6'));var util=require('util');var path=require(_0x8da5('0x7'));var sox=require('sox');var csv=require(_0x8da5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8da5('0x9'));var _=require(_0x8da5('0xa'));var squel=require(_0x8da5('0xb'));var crypto=require('crypto');var jsforce=require(_0x8da5('0xc'));var deskjs=require(_0x8da5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8da5('0xe'));var Papa=require(_0x8da5('0xf'));var Redis=require('ioredis');var authService=require(_0x8da5('0x10'));var qs=require(_0x8da5('0x11'));var as=require(_0x8da5('0x12'));var hardwareService=require(_0x8da5('0x13'));var logger=require(_0x8da5('0x14'))('api');var utils=require(_0x8da5('0x15'));var config=require(_0x8da5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8da5('0x17'))['db'];function respondWithStatusCode(_0x92589,_0x3d2d86){_0x3d2d86=_0x3d2d86||0xcc;return function(_0x55eac4){if(_0x55eac4){return _0x92589[_0x8da5('0x18')](_0x3d2d86);}return _0x92589[_0x8da5('0x19')](_0x3d2d86)[_0x8da5('0x1a')]();};}function respondWithResult(_0x263107,_0x2fe567){_0x2fe567=_0x2fe567||0xc8;return function(_0x322ae5){if(_0x322ae5){return _0x263107[_0x8da5('0x19')](_0x2fe567)[_0x8da5('0x1b')](_0x322ae5);}};}function respondWithFilteredResult(_0x3f3b6c,_0x4e2567){return function(_0x550fc9){if(_0x550fc9){var _0xa27e35=_0x550fc9[_0x8da5('0x1c')],_0xfe6fa2=_0x4e2567['offset'],_0x3da833=_0x4e2567[_0x8da5('0x1d')]+_0x4e2567[_0x8da5('0x1e')],_0x5f2933;if(_0x3da833>=_0xa27e35){_0x3da833=_0xa27e35;_0x5f2933=0xc8;}else{_0x5f2933=0xce;}_0x3f3b6c[_0x8da5('0x19')](_0x5f2933);return _0x3f3b6c[_0x8da5('0x1f')](_0x8da5('0x20'),_0xfe6fa2+'-'+_0x3da833+'/'+_0xa27e35)[_0x8da5('0x1b')](_0x550fc9);}return null;};}function patchUpdates(_0xb76239){return function(_0x181975){try{jsonpatch[_0x8da5('0x21')](_0x181975,_0xb76239,!![]);}catch(_0x27e25e){return BPromise[_0x8da5('0x22')](_0x27e25e);}return _0x181975[_0x8da5('0x23')]();};}function saveUpdates(_0x5129a9,_0x872c90){return function(_0x396779){if(_0x396779){return _0x396779[_0x8da5('0x24')](_0x5129a9)[_0x8da5('0x25')](function(_0x4dff0d){return _0x4dff0d;});}return null;};}function removeEntity(_0x51c8e1,_0x28944c){return function(_0x55988a){if(_0x55988a){return _0x55988a[_0x8da5('0x26')]()[_0x8da5('0x25')](function(){var _0x198728=_0x55988a[_0x8da5('0x27')]({'plain':!![]});var _0x5099e6=_0x8da5('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x5099e6,'resourceId':_0x198728['id']}})[_0x8da5('0x25')](function(){return _0x55988a;});})[_0x8da5('0x25')](function(){_0x51c8e1[_0x8da5('0x19')](0xcc)[_0x8da5('0x1a')]();});}};}function handleEntityNotFound(_0x1bbb86,_0x52a8c1){return function(_0x5424f1){if(!_0x5424f1){_0x1bbb86[_0x8da5('0x18')](0x194);}return _0x5424f1;};}function handleError(_0xdc4326,_0xed9e2f){_0xed9e2f=_0xed9e2f||0x1f4;return function(_0x5c2b90){logger['error'](_0x5c2b90['stack']);if(_0x5c2b90[_0x8da5('0x29')]){delete _0x5c2b90['name'];}_0xdc4326[_0x8da5('0x19')](_0xed9e2f)[_0x8da5('0x2a')](_0x5c2b90);};}exports['index']=function(_0x56a425,_0x4a5dc3){var _0x268242={},_0x3c44fa={},_0x3b3776={'count':0x0,'rows':[]};var _0x154626=_[_0x8da5('0x2b')](db['Tag'][_0x8da5('0x2c')],function(_0x52e5e0){return{'name':_0x52e5e0[_0x8da5('0x2d')],'type':_0x52e5e0[_0x8da5('0x2e')][_0x8da5('0x2f')]};});_0x3c44fa[_0x8da5('0x30')]=_[_0x8da5('0x2b')](_0x154626,_0x8da5('0x29'));_0x3c44fa[_0x8da5('0x31')]=_[_0x8da5('0x32')](_0x56a425['query']);_0x3c44fa[_0x8da5('0x33')]=_[_0x8da5('0x34')](_0x3c44fa[_0x8da5('0x30')],_0x3c44fa[_0x8da5('0x31')]);_0x268242[_0x8da5('0x35')]=_[_0x8da5('0x34')](_0x3c44fa[_0x8da5('0x30')],qs[_0x8da5('0x36')](_0x56a425['query'][_0x8da5('0x36')]));_0x268242['attributes']=_0x268242[_0x8da5('0x35')]['length']?_0x268242[_0x8da5('0x35')]:_0x3c44fa[_0x8da5('0x30')];if(!_0x56a425[_0x8da5('0x31')][_0x8da5('0x37')](_0x8da5('0x38'))){_0x268242[_0x8da5('0x1e')]=qs[_0x8da5('0x1e')](_0x56a425['query'][_0x8da5('0x1e')]);_0x268242['offset']=qs[_0x8da5('0x1d')](_0x56a425['query']['offset']);}_0x268242[_0x8da5('0x39')]=qs[_0x8da5('0x3a')](_0x56a425['query'][_0x8da5('0x3a')]);_0x268242[_0x8da5('0x3b')]=qs[_0x8da5('0x33')](_[_0x8da5('0x3c')](_0x56a425['query'],_0x3c44fa['filters']),_0x154626);if(_0x56a425[_0x8da5('0x31')]['filter']){_0x268242['where']=_[_0x8da5('0x3d')](_0x268242[_0x8da5('0x3b')],{'$or':_[_0x8da5('0x2b')](_0x154626,function(_0x45c381){if(_0x45c381[_0x8da5('0x2e')]!==_0x8da5('0x3e')){var _0x5f1652={};_0x5f1652[_0x45c381[_0x8da5('0x29')]]={'$like':'%'+_0x56a425[_0x8da5('0x31')][_0x8da5('0x3f')]+'%'};return _0x5f1652;}})});}_0x268242=_[_0x8da5('0x3d')]({},_0x268242,_0x56a425[_0x8da5('0x40')]);var _0x575a46={'where':_0x268242[_0x8da5('0x3b')]};return db['Tag'][_0x8da5('0x1c')](_0x575a46)[_0x8da5('0x25')](function(_0x11dc08){_0x3b3776[_0x8da5('0x1c')]=_0x11dc08;if(_0x56a425[_0x8da5('0x31')][_0x8da5('0x41')]){_0x268242[_0x8da5('0x42')]=[{'all':!![]}];}return db[_0x8da5('0x43')][_0x8da5('0x44')](_0x268242);})['then'](function(_0x559af6){_0x3b3776[_0x8da5('0x45')]=_0x559af6;return _0x3b3776;})['then'](respondWithFilteredResult(_0x4a5dc3,_0x268242))['catch'](handleError(_0x4a5dc3,null));};exports[_0x8da5('0x46')]=function(_0x7aeda,_0x8ecfcb){var _0x1d5b74={'raw':!![],'where':{'id':_0x7aeda[_0x8da5('0x47')]['id']}},_0x5a50fb={};_0x5a50fb[_0x8da5('0x30')]=_['keys'](db[_0x8da5('0x43')][_0x8da5('0x2c')]);_0x5a50fb[_0x8da5('0x31')]=_[_0x8da5('0x32')](_0x7aeda[_0x8da5('0x31')]);_0x5a50fb[_0x8da5('0x33')]=_[_0x8da5('0x34')](_0x5a50fb[_0x8da5('0x30')],_0x5a50fb['query']);_0x1d5b74[_0x8da5('0x35')]=_[_0x8da5('0x34')](_0x5a50fb[_0x8da5('0x30')],qs['fields'](_0x7aeda[_0x8da5('0x31')]['fields']));_0x1d5b74[_0x8da5('0x35')]=_0x1d5b74['attributes'][_0x8da5('0x48')]?_0x1d5b74[_0x8da5('0x35')]:_0x5a50fb['model'];if(_0x7aeda[_0x8da5('0x31')][_0x8da5('0x41')]){_0x1d5b74[_0x8da5('0x42')]=[{'all':!![]}];}_0x1d5b74=_[_0x8da5('0x3d')]({},_0x1d5b74,_0x7aeda['options']);return db['Tag'][_0x8da5('0x49')](_0x1d5b74)['then'](handleEntityNotFound(_0x8ecfcb,null))[_0x8da5('0x25')](respondWithResult(_0x8ecfcb,null))[_0x8da5('0x4a')](handleError(_0x8ecfcb,null));};exports['create']=function(_0xab72f5,_0x46631c){return db[_0x8da5('0x43')][_0x8da5('0x4b')](_0xab72f5[_0x8da5('0x4c')],{})[_0x8da5('0x25')](function(_0x18d33d){var _0x4642f1=_0xab72f5[_0x8da5('0x4d')][_0x8da5('0x27')]({'plain':!![]});if(!_0x4642f1)throw new Error(_0x8da5('0x4e'));if(_0x4642f1[_0x8da5('0x4f')]===_0x8da5('0x4d')){var _0x1ed182=_0x18d33d['get']({'plain':!![]});var _0x92b997=_0x8da5('0x28');return db[_0x8da5('0x50')][_0x8da5('0x49')]({'where':{'name':_0x92b997,'userProfileId':_0x4642f1['userProfileId']},'raw':!![]})[_0x8da5('0x25')](function(_0x4eec7b){if(_0x4eec7b&&_0x4eec7b[_0x8da5('0x51')]===0x0){return db[_0x8da5('0x52')][_0x8da5('0x4b')]({'name':_0x1ed182[_0x8da5('0x29')],'resourceId':_0x1ed182['id'],'type':_0x4eec7b[_0x8da5('0x29')],'sectionId':_0x4eec7b['id']},{})[_0x8da5('0x25')](function(){return _0x18d33d;});}else{return _0x18d33d;}})[_0x8da5('0x4a')](function(_0x50fc64){logger[_0x8da5('0x53')](_0x8da5('0x54'),_0x50fc64);throw _0x50fc64;});}return _0x18d33d;})[_0x8da5('0x25')](respondWithResult(_0x46631c,0xc9))[_0x8da5('0x4a')](handleError(_0x46631c,null));};exports[_0x8da5('0x24')]=function(_0x27fda8,_0x415dcf){if(_0x27fda8[_0x8da5('0x4c')]['id']){delete _0x27fda8[_0x8da5('0x4c')]['id'];}return db[_0x8da5('0x43')][_0x8da5('0x49')]({'where':{'id':_0x27fda8['params']['id']}})[_0x8da5('0x25')](handleEntityNotFound(_0x415dcf,null))[_0x8da5('0x25')](saveUpdates(_0x27fda8['body'],null))['then'](respondWithResult(_0x415dcf,null))['catch'](handleError(_0x415dcf,null));};exports[_0x8da5('0x26')]=function(_0x13478a,_0x81fe69){return db[_0x8da5('0x43')]['find']({'where':{'id':_0x13478a['params']['id']}})[_0x8da5('0x25')](handleEntityNotFound(_0x81fe69,null))[_0x8da5('0x25')](removeEntity(_0x81fe69,null))['catch'](handleError(_0x81fe69,null));}; \ No newline at end of file +var _0x575c=['merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','Tag','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','save','update','then','destroy','Tags','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick'];(function(_0x157f45,_0x10278a){var _0x31b08a=function(_0x5bd05e){while(--_0x5bd05e){_0x157f45['push'](_0x157f45['shift']());}};_0x31b08a(++_0x10278a);}(_0x575c,0x1ab));var _0xc575=function(_0x83c1c8,_0xa5cbf5){_0x83c1c8=_0x83c1c8-0x0;var _0xfded3b=_0x575c[_0x83c1c8];return _0xfded3b;};'use strict';var emlformat=require(_0xc575('0x0'));var rimraf=require(_0xc575('0x1'));var zipdir=require(_0xc575('0x2'));var jsonpatch=require(_0xc575('0x3'));var rp=require(_0xc575('0x4'));var moment=require(_0xc575('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc575('0x6'));var util=require(_0xc575('0x7'));var path=require(_0xc575('0x8'));var sox=require(_0xc575('0x9'));var csv=require(_0xc575('0xa'));var ejs=require(_0xc575('0xb'));var fs=require('fs');var fs_extra=require(_0xc575('0xc'));var _=require(_0xc575('0xd'));var squel=require(_0xc575('0xe'));var crypto=require(_0xc575('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xc575('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc575('0x11'));var as=require(_0xc575('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc575('0x13'))('api');var utils=require(_0xc575('0x14'));var config=require(_0xc575('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc575('0x16'))['db'];function respondWithStatusCode(_0x7d128f,_0x32c607){_0x32c607=_0x32c607||0xcc;return function(_0x4c76ce){if(_0x4c76ce){return _0x7d128f[_0xc575('0x17')](_0x32c607);}return _0x7d128f[_0xc575('0x18')](_0x32c607)[_0xc575('0x19')]();};}function respondWithResult(_0x29b5f1,_0x4b7884){_0x4b7884=_0x4b7884||0xc8;return function(_0x41584d){if(_0x41584d){return _0x29b5f1['status'](_0x4b7884)[_0xc575('0x1a')](_0x41584d);}};}function respondWithFilteredResult(_0x20dcd9,_0xf52469){return function(_0x407a08){if(_0x407a08){var _0x4339b3=_0x407a08['count'],_0x2f0011=_0xf52469[_0xc575('0x1b')],_0x5057d8=_0xf52469[_0xc575('0x1b')]+_0xf52469['limit'],_0x55b172;if(_0x5057d8>=_0x4339b3){_0x5057d8=_0x4339b3;_0x55b172=0xc8;}else{_0x55b172=0xce;}_0x20dcd9['status'](_0x55b172);return _0x20dcd9[_0xc575('0x1c')](_0xc575('0x1d'),_0x2f0011+'-'+_0x5057d8+'/'+_0x4339b3)[_0xc575('0x1a')](_0x407a08);}return null;};}function patchUpdates(_0x5d74ae){return function(_0x1b395d){try{jsonpatch['apply'](_0x1b395d,_0x5d74ae,!![]);}catch(_0x415a07){return BPromise['reject'](_0x415a07);}return _0x1b395d[_0xc575('0x1e')]();};}function saveUpdates(_0x5574b4,_0x10ca55){return function(_0xd0f8b4){if(_0xd0f8b4){return _0xd0f8b4[_0xc575('0x1f')](_0x5574b4)[_0xc575('0x20')](function(_0x2cb3b7){return _0x2cb3b7;});}return null;};}function removeEntity(_0x3be5ff,_0x3fcc71){return function(_0xf50080){if(_0xf50080){return _0xf50080[_0xc575('0x21')]()[_0xc575('0x20')](function(){var _0x3c4dc2=_0xf50080['get']({'plain':!![]});var _0x3a0854=_0xc575('0x22');return db['UserProfileResource'][_0xc575('0x21')]({'where':{'type':_0x3a0854,'resourceId':_0x3c4dc2['id']}})[_0xc575('0x20')](function(){return _0xf50080;});})[_0xc575('0x20')](function(){_0x3be5ff[_0xc575('0x18')](0xcc)[_0xc575('0x19')]();});}};}function handleEntityNotFound(_0x3f5082,_0x39ff16){return function(_0x3d760a){if(!_0x3d760a){_0x3f5082[_0xc575('0x17')](0x194);}return _0x3d760a;};}function handleError(_0x22b532,_0x5aa816){_0x5aa816=_0x5aa816||0x1f4;return function(_0x1f0ad3){logger[_0xc575('0x23')](_0x1f0ad3[_0xc575('0x24')]);if(_0x1f0ad3[_0xc575('0x25')]){delete _0x1f0ad3['name'];}_0x22b532[_0xc575('0x18')](_0x5aa816)[_0xc575('0x26')](_0x1f0ad3);};}exports['index']=function(_0x2f8959,_0x5a1e2d){var _0xf01091={},_0x5a540b={},_0x10e9b3={'count':0x0,'rows':[]};var _0x59dd80=_[_0xc575('0x27')](db['Tag'][_0xc575('0x28')],function(_0x156dee){return{'name':_0x156dee[_0xc575('0x29')],'type':_0x156dee[_0xc575('0x2a')][_0xc575('0x2b')]};});_0x5a540b[_0xc575('0x2c')]=_['map'](_0x59dd80,_0xc575('0x25'));_0x5a540b[_0xc575('0x2d')]=_[_0xc575('0x2e')](_0x2f8959[_0xc575('0x2d')]);_0x5a540b[_0xc575('0x2f')]=_[_0xc575('0x30')](_0x5a540b[_0xc575('0x2c')],_0x5a540b[_0xc575('0x2d')]);_0xf01091['attributes']=_[_0xc575('0x30')](_0x5a540b[_0xc575('0x2c')],qs['fields'](_0x2f8959[_0xc575('0x2d')][_0xc575('0x31')]));_0xf01091[_0xc575('0x32')]=_0xf01091[_0xc575('0x32')][_0xc575('0x33')]?_0xf01091[_0xc575('0x32')]:_0x5a540b[_0xc575('0x2c')];if(!_0x2f8959['query'][_0xc575('0x34')](_0xc575('0x35'))){_0xf01091[_0xc575('0x36')]=qs[_0xc575('0x36')](_0x2f8959[_0xc575('0x2d')][_0xc575('0x36')]);_0xf01091[_0xc575('0x1b')]=qs['offset'](_0x2f8959['query']['offset']);}_0xf01091[_0xc575('0x37')]=qs[_0xc575('0x38')](_0x2f8959['query'][_0xc575('0x38')]);_0xf01091[_0xc575('0x39')]=qs[_0xc575('0x2f')](_[_0xc575('0x3a')](_0x2f8959[_0xc575('0x2d')],_0x5a540b[_0xc575('0x2f')]),_0x59dd80);if(_0x2f8959[_0xc575('0x2d')]['filter']){_0xf01091[_0xc575('0x39')]=_[_0xc575('0x3b')](_0xf01091[_0xc575('0x39')],{'$or':_[_0xc575('0x27')](_0x59dd80,function(_0x5354c6){if(_0x5354c6[_0xc575('0x2a')]!==_0xc575('0x3c')){var _0x325ed1={};_0x325ed1[_0x5354c6[_0xc575('0x25')]]={'$like':'%'+_0x2f8959['query'][_0xc575('0x3d')]+'%'};return _0x325ed1;}})});}_0xf01091=_['merge']({},_0xf01091,_0x2f8959[_0xc575('0x3e')]);var _0x583af4={'where':_0xf01091[_0xc575('0x39')]};return db['Tag']['count'](_0x583af4)[_0xc575('0x20')](function(_0x11315a){_0x10e9b3[_0xc575('0x3f')]=_0x11315a;if(_0x2f8959[_0xc575('0x2d')][_0xc575('0x40')]){_0xf01091[_0xc575('0x41')]=[{'all':!![]}];}return db['Tag'][_0xc575('0x42')](_0xf01091);})['then'](function(_0x375fc0){_0x10e9b3[_0xc575('0x43')]=_0x375fc0;return _0x10e9b3;})['then'](respondWithFilteredResult(_0x5a1e2d,_0xf01091))[_0xc575('0x44')](handleError(_0x5a1e2d,null));};exports[_0xc575('0x45')]=function(_0x5653fc,_0x26c0d9){var _0xf4fe4c={'raw':!![],'where':{'id':_0x5653fc[_0xc575('0x46')]['id']}},_0x555f59={};_0x555f59[_0xc575('0x2c')]=_[_0xc575('0x2e')](db[_0xc575('0x47')][_0xc575('0x28')]);_0x555f59[_0xc575('0x2d')]=_[_0xc575('0x2e')](_0x5653fc[_0xc575('0x2d')]);_0x555f59[_0xc575('0x2f')]=_[_0xc575('0x30')](_0x555f59[_0xc575('0x2c')],_0x555f59['query']);_0xf4fe4c[_0xc575('0x32')]=_[_0xc575('0x30')](_0x555f59[_0xc575('0x2c')],qs[_0xc575('0x31')](_0x5653fc['query'][_0xc575('0x31')]));_0xf4fe4c[_0xc575('0x32')]=_0xf4fe4c[_0xc575('0x32')][_0xc575('0x33')]?_0xf4fe4c[_0xc575('0x32')]:_0x555f59[_0xc575('0x2c')];if(_0x5653fc[_0xc575('0x2d')]['includeAll']){_0xf4fe4c[_0xc575('0x41')]=[{'all':!![]}];}_0xf4fe4c=_[_0xc575('0x3b')]({},_0xf4fe4c,_0x5653fc[_0xc575('0x3e')]);return db[_0xc575('0x47')][_0xc575('0x48')](_0xf4fe4c)[_0xc575('0x20')](handleEntityNotFound(_0x26c0d9,null))[_0xc575('0x20')](respondWithResult(_0x26c0d9,null))[_0xc575('0x44')](handleError(_0x26c0d9,null));};exports['create']=function(_0x408cf4,_0x131b0b){return db[_0xc575('0x47')][_0xc575('0x49')](_0x408cf4['body'],{})['then'](function(_0x15445e){var _0x1f0bf7=_0x408cf4['user'][_0xc575('0x4a')]({'plain':!![]});if(!_0x1f0bf7)throw new Error(_0xc575('0x4b'));if(_0x1f0bf7[_0xc575('0x4c')]==='user'){var _0x38ec22=_0x15445e[_0xc575('0x4a')]({'plain':!![]});var _0x49e44f=_0xc575('0x22');return db['UserProfileSection']['find']({'where':{'name':_0x49e44f,'userProfileId':_0x1f0bf7[_0xc575('0x4d')]},'raw':!![]})[_0xc575('0x20')](function(_0x5dfe82){if(_0x5dfe82&&_0x5dfe82[_0xc575('0x4e')]===0x0){return db[_0xc575('0x4f')][_0xc575('0x49')]({'name':_0x38ec22[_0xc575('0x25')],'resourceId':_0x38ec22['id'],'type':_0x5dfe82['name'],'sectionId':_0x5dfe82['id']},{})['then'](function(){return _0x15445e;});}else{return _0x15445e;}})[_0xc575('0x44')](function(_0x1bc1ac){logger[_0xc575('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bc1ac);throw _0x1bc1ac;});}return _0x15445e;})['then'](respondWithResult(_0x131b0b,0xc9))[_0xc575('0x44')](handleError(_0x131b0b,null));};exports[_0xc575('0x1f')]=function(_0xa788bf,_0x14e143){if(_0xa788bf[_0xc575('0x50')]['id']){delete _0xa788bf[_0xc575('0x50')]['id'];}return db['Tag'][_0xc575('0x48')]({'where':{'id':_0xa788bf['params']['id']}})[_0xc575('0x20')](handleEntityNotFound(_0x14e143,null))['then'](saveUpdates(_0xa788bf[_0xc575('0x50')],null))[_0xc575('0x20')](respondWithResult(_0x14e143,null))[_0xc575('0x44')](handleError(_0x14e143,null));};exports[_0xc575('0x21')]=function(_0x1671c2,_0x280d3d){return db['Tag'][_0xc575('0x48')]({'where':{'id':_0x1671c2['params']['id']}})[_0xc575('0x20')](handleEntityNotFound(_0x280d3d,null))['then'](removeEntity(_0x280d3d,null))[_0xc575('0x44')](handleError(_0x280d3d,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index c845eb8..c8867fd 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 _0x2129=['util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./tag.attributes','exports','Tag','tools_tags'];(function(_0x5cae30,_0x5001c3){var _0x47404a=function(_0x185e16){while(--_0x185e16){_0x5cae30['push'](_0x5cae30['shift']());}};_0x47404a(++_0x5001c3);}(_0x2129,0x1ea));var _0x9212=function(_0xc79c7d,_0xe75e15){_0xc79c7d=_0xc79c7d-0x0;var _0x38be6c=_0x2129[_0xc79c7d];return _0x38be6c;};'use strict';var _=require('lodash');var util=require(_0x9212('0x0'));var logger=require(_0x9212('0x1'))('api');var moment=require(_0x9212('0x2'));var BPromise=require(_0x9212('0x3'));var rp=require(_0x9212('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9212('0x5'));var attributes=require(_0x9212('0x6'));module[_0x9212('0x7')]=function(_0x32d5c8,_0x400a5e){return _0x32d5c8['define'](_0x9212('0x8'),attributes,{'tableName':_0x9212('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefc3=['tools_tags','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define','Tag'];(function(_0x12c005,_0x398274){var _0x3edc45=function(_0x2d96a0){while(--_0x2d96a0){_0x12c005['push'](_0x12c005['shift']());}};_0x3edc45(++_0x398274);}(_0xefc3,0xa9));var _0x3efc=function(_0x3cbf51,_0x27c41a){_0x3cbf51=_0x3cbf51-0x0;var _0x33826c=_0xefc3[_0x3cbf51];return _0x33826c;};'use strict';var _=require(_0x3efc('0x0'));var util=require(_0x3efc('0x1'));var logger=require(_0x3efc('0x2'))(_0x3efc('0x3'));var moment=require(_0x3efc('0x4'));var BPromise=require(_0x3efc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3efc('0x6'));var rimraf=require(_0x3efc('0x7'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0x3efc('0x8')]=function(_0x3def2a,_0x5a6982){return _0x3def2a[_0x3efc('0x9')](_0x3efc('0xa'),attributes,{'tableName':_0x3efc('0xb'),'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 85be092..9feb0a8 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 _0x7072=['randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird'];(function(_0x48bd63,_0x5f8e86){var _0x4eaade=function(_0x5cf196){while(--_0x5cf196){_0x48bd63['push'](_0x48bd63['shift']());}};_0x4eaade(++_0x5f8e86);}(_0x7072,0x138));var _0x2707=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x7072[_0x2064e5];return _0x21a233;};'use strict';var _=require('lodash');var util=require(_0x2707('0x0'));var moment=require(_0x2707('0x1'));var BPromise=require(_0x2707('0x2'));var rs=require(_0x2707('0x3'));var fs=require('fs');var Redis=require(_0x2707('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2707('0x5'))('rpc');var config=require(_0x2707('0x6'));var jayson=require(_0x2707('0x7'));var client=jayson[_0x2707('0x8')][_0x2707('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fd8ff,_0x128205,_0x21b0a0){return new BPromise(function(_0x745cfd,_0x4062b6){return client[_0x2707('0xa')](_0x2fd8ff,_0x21b0a0)['then'](function(_0x597ff9){logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));logger[_0x2707('0xe')](_0x2707('0xf'),_0x128205,_0x2707('0xd'),JSON[_0x2707('0x10')](_0x597ff9));if(_0x597ff9[_0x2707('0x11')]){if(_0x597ff9[_0x2707('0x11')][_0x2707('0x12')]===0x1f4){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')]['message']);return _0x4062b6(_0x597ff9[_0x2707('0x11')]['message']);}logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')][_0x2707('0x13')]);return _0x745cfd(_0x597ff9[_0x2707('0x11')]['message']);}else{logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));_0x745cfd(_0x597ff9['result'][_0x2707('0x13')]);}})[_0x2707('0x14')](function(_0x1a979e){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x1a979e);_0x4062b6(_0x1a979e);});});} \ No newline at end of file +var _0x55e0=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x55e0,0xdc));var _0x055e=function(_0x3fad3f,_0x4101dd){_0x3fad3f=_0x3fad3f-0x0;var _0x3d398d=_0x55e0[_0x3fad3f];return _0x3d398d;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4384ff,_0x4a442e,_0x8e7824){return new BPromise(function(_0x3c4cf,_0x376618){return client[_0x055e('0xa')](_0x4384ff,_0x8e7824)[_0x055e('0xb')](function(_0x49540c){logger[_0x055e('0xc')](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));logger[_0x055e('0xf')](_0x055e('0x10'),_0x4a442e,'request\x20sent',JSON['stringify'](_0x49540c));if(_0x49540c[_0x055e('0x11')]){if(_0x49540c['error'][_0x055e('0x12')]===0x1f4){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x376618(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}logger['error'](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x3c4cf(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}else{logger['info'](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));_0x3c4cf(_0x49540c[_0x055e('0x14')]['message']);}})[_0x055e('0x15')](function(_0x2c377c){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x2c377c);_0x376618(_0x2c377c);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index d77f4a8..3e3f329 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 _0x5f01=['post','/:id/users','addAgents','put','/:id','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./team.controller','get','isAuthenticated','show','/:id/queues','getQueues','getAgents'];(function(_0x56943a,_0x33b228){var _0x373d88=function(_0x178858){while(--_0x178858){_0x56943a['push'](_0x56943a['shift']());}};_0x373d88(++_0x33b228);}(_0x5f01,0xb2));var _0x15f0=function(_0x44d7a8,_0x4c4976){_0x44d7a8=_0x44d7a8-0x0;var _0x2a85e7=_0x5f01[_0x44d7a8];return _0x2a85e7;};'use strict';var multer=require(_0x15f0('0x0'));var util=require(_0x15f0('0x1'));var path=require(_0x15f0('0x2'));var timeout=require(_0x15f0('0x3'));var express=require('express');var router=express[_0x15f0('0x4')]();var fs_extra=require(_0x15f0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x15f0('0x6'));var config=require('../../config/environment');var controller=require(_0x15f0('0x7'));router[_0x15f0('0x8')]('/',auth[_0x15f0('0x9')](),controller['index']);router[_0x15f0('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x15f0('0xa')]);router['get'](_0x15f0('0xb'),auth[_0x15f0('0x9')](),controller[_0x15f0('0xc')]);router['get']('/:id/users',auth[_0x15f0('0x9')](),controller[_0x15f0('0xd')]);router[_0x15f0('0xe')]('/',auth[_0x15f0('0x9')](),controller['create']);router[_0x15f0('0xe')](_0x15f0('0xb'),auth[_0x15f0('0x9')](),controller['addQueues']);router[_0x15f0('0xe')](_0x15f0('0xf'),auth[_0x15f0('0x9')](),controller[_0x15f0('0x10')]);router[_0x15f0('0x11')](_0x15f0('0x12'),auth[_0x15f0('0x9')](),controller[_0x15f0('0x13')]);router[_0x15f0('0x14')]('/:id',auth[_0x15f0('0x9')](),controller[_0x15f0('0x15')]);router[_0x15f0('0x14')](_0x15f0('0xb'),auth['isAuthenticated'](),controller['removeQueues']);router['delete'](_0x15f0('0xf'),auth[_0x15f0('0x9')](),controller[_0x15f0('0x16')]);module[_0x15f0('0x17')]=router; \ No newline at end of file +var _0xc2a4=['isAuthenticated','getQueues','getAgents','post','create','addQueues','/:id/users','addAgents','/:id','update','destroy','delete','/:id/queues','removeAgents','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get'];(function(_0x4bbfc1,_0x33f00c){var _0x410ebc=function(_0x2d23b3){while(--_0x2d23b3){_0x4bbfc1['push'](_0x4bbfc1['shift']());}};_0x410ebc(++_0x33f00c);}(_0xc2a4,0x1bf));var _0x4c2a=function(_0x58e6d9,_0x51161d){_0x58e6d9=_0x58e6d9-0x0;var _0x2abd12=_0xc2a4[_0x58e6d9];return _0x2abd12;};'use strict';var multer=require(_0x4c2a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4c2a('0x1'));var express=require('express');var router=express[_0x4c2a('0x2')]();var fs_extra=require(_0x4c2a('0x3'));var auth=require(_0x4c2a('0x4'));var interaction=require(_0x4c2a('0x5'));var config=require(_0x4c2a('0x6'));var controller=require(_0x4c2a('0x7'));router[_0x4c2a('0x8')]('/',auth[_0x4c2a('0x9')](),controller['index']);router[_0x4c2a('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4c2a('0x8')]('/:id/queues',auth[_0x4c2a('0x9')](),controller[_0x4c2a('0xa')]);router[_0x4c2a('0x8')]('/:id/users',auth[_0x4c2a('0x9')](),controller[_0x4c2a('0xb')]);router[_0x4c2a('0xc')]('/',auth[_0x4c2a('0x9')](),controller[_0x4c2a('0xd')]);router['post']('/:id/queues',auth[_0x4c2a('0x9')](),controller[_0x4c2a('0xe')]);router['post'](_0x4c2a('0xf'),auth[_0x4c2a('0x9')](),controller[_0x4c2a('0x10')]);router['put'](_0x4c2a('0x11'),auth[_0x4c2a('0x9')](),controller[_0x4c2a('0x12')]);router['delete'](_0x4c2a('0x11'),auth[_0x4c2a('0x9')](),controller[_0x4c2a('0x13')]);router[_0x4c2a('0x14')](_0x4c2a('0x15'),auth[_0x4c2a('0x9')](),controller['removeQueues']);router[_0x4c2a('0x14')]('/:id/users',auth[_0x4c2a('0x9')](),controller[_0x4c2a('0x16')]);module[_0x4c2a('0x17')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 3b53a3d..0305aef 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 _0x92ec=['STRING','name','exports'];(function(_0x31e5cb,_0x2f5adf){var _0x4170df=function(_0x31c53e){while(--_0x31c53e){_0x31e5cb['push'](_0x31e5cb['shift']());}};_0x4170df(++_0x2f5adf);}(_0x92ec,0x19a));var _0xc92e=function(_0x260199,_0x4d37a3){_0x260199=_0x260199-0x0;var _0x270e80=_0x92ec[_0x260199];return _0x270e80;};'use strict';var Sequelize=require('sequelize');module[_0xc92e('0x0')]={'name':{'type':Sequelize[_0xc92e('0x1')],'allowNull':![],'unique':_0xc92e('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf744=['STRING','name','sequelize','exports'];(function(_0x14f1c7,_0x5eae6b){var _0x35f232=function(_0x5bbbfe){while(--_0x5bbbfe){_0x14f1c7['push'](_0x14f1c7['shift']());}};_0x35f232(++_0x5eae6b);}(_0xf744,0x1aa));var _0x4f74=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xf744[_0x525c7b];return _0x27b33e;};'use strict';var Sequelize=require(_0x4f74('0x0'));module[_0x4f74('0x1')]={'name':{'type':Sequelize[_0x4f74('0x2')],'allowNull':![],'unique':_0x4f74('0x3')},'description':{'type':Sequelize[_0x4f74('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index e8b3197..1f8196d 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 _0x4545=['hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','length','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','body','destroy','getQueues','findOne','channel','Sequelize','ValidationError','toLowerCase','Queue','capitalize','Queues','addQueues','isValidChannel','Unknown\x20channel','add','ids','removeQueues','remove','addAgents','Voice','Mail','Sms','Fax','Whatsapp','sequelize','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','spread','removeAgents','Chat','Openchannel','transaction','parse','Queue:remove','getAgents','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','get','Teams','UserProfileResource','error','name','index','map','Team','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x3de873,_0x174b5f){var _0x380b8c=function(_0x313dea){while(--_0x313dea){_0x3de873['push'](_0x3de873['shift']());}};_0x380b8c(++_0x174b5f);}(_0x4545,0x152));var _0x5454=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4545[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0x5454('0x0'));var rimraf=require(_0x5454('0x1'));var zipdir=require(_0x5454('0x2'));var jsonpatch=require(_0x5454('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5454('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5454('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5454('0x6'));var fs=require('fs');var fs_extra=require(_0x5454('0x7'));var _=require(_0x5454('0x8'));var squel=require(_0x5454('0x9'));var crypto=require(_0x5454('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5454('0xb'));var Papa=require('papaparse');var Redis=require(_0x5454('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5454('0xd'));var logger=require(_0x5454('0xe'))(_0x5454('0xf'));var utils=require('../../config/utils');var config=require(_0x5454('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x5454('0x11'))['db'];config[_0x5454('0x12')]=_[_0x5454('0x13')](config[_0x5454('0x12')],{'host':_0x5454('0x14'),'port':0x18eb});var socket=require(_0x5454('0x15'))(new Redis(config[_0x5454('0x12')]));require(_0x5454('0x16'))[_0x5454('0x17')](socket);function respondWithStatusCode(_0x3a044,_0x430686){_0x430686=_0x430686||0xcc;return function(_0x4d27b1){if(_0x4d27b1){return _0x3a044[_0x5454('0x18')](_0x430686);}return _0x3a044[_0x5454('0x19')](_0x430686)[_0x5454('0x1a')]();};}function respondWithResult(_0xd664db,_0x47d9d9){_0x47d9d9=_0x47d9d9||0xc8;return function(_0x455eb8){if(_0x455eb8){return _0xd664db[_0x5454('0x19')](_0x47d9d9)[_0x5454('0x1b')](_0x455eb8);}};}function respondWithFilteredResult(_0x3ed73d,_0x2a922d){return function(_0x7408d9){if(_0x7408d9){var _0x3d402e=_0x7408d9[_0x5454('0x1c')],_0x181627=_0x2a922d[_0x5454('0x1d')],_0x1a9308=_0x2a922d[_0x5454('0x1d')]+_0x2a922d[_0x5454('0x1e')],_0xee1e3d;if(_0x1a9308>=_0x3d402e){_0x1a9308=_0x3d402e;_0xee1e3d=0xc8;}else{_0xee1e3d=0xce;}_0x3ed73d[_0x5454('0x19')](_0xee1e3d);return _0x3ed73d[_0x5454('0x1f')]('Content-Range',_0x181627+'-'+_0x1a9308+'/'+_0x3d402e)[_0x5454('0x1b')](_0x7408d9);}return null;};}function patchUpdates(_0x1c9e36){return function(_0x13b9bf){try{jsonpatch[_0x5454('0x20')](_0x13b9bf,_0x1c9e36,!![]);}catch(_0x2f3236){return BPromise[_0x5454('0x21')](_0x2f3236);}return _0x13b9bf[_0x5454('0x22')]();};}function saveUpdates(_0x5996fc,_0x25ed2d){return function(_0x4c93c4){if(_0x4c93c4){return _0x4c93c4[_0x5454('0x23')](_0x5996fc)[_0x5454('0x24')](function(_0x424aaf){return _0x424aaf;});}return null;};}function removeEntity(_0x59a12c,_0x156149){return function(_0x199b91){if(_0x199b91){return _0x199b91['destroy']()['then'](function(){var _0x3594dd=_0x199b91[_0x5454('0x25')]({'plain':!![]});var _0x105ad4=_0x5454('0x26');return db[_0x5454('0x27')]['destroy']({'where':{'type':_0x105ad4,'resourceId':_0x3594dd['id']}})[_0x5454('0x24')](function(){return _0x199b91;});})['then'](function(){_0x59a12c[_0x5454('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfd1d2e,_0x2aaabc){return function(_0x44c34a){if(!_0x44c34a){_0xfd1d2e[_0x5454('0x18')](0x194);}return _0x44c34a;};}function handleError(_0x1b6ea4,_0x198e00){_0x198e00=_0x198e00||0x1f4;return function(_0x98485b){logger[_0x5454('0x28')](_0x98485b['stack']);if(_0x98485b[_0x5454('0x29')]){delete _0x98485b[_0x5454('0x29')];}_0x1b6ea4[_0x5454('0x19')](_0x198e00)['send'](_0x98485b);};}exports[_0x5454('0x2a')]=function(_0x5ec1c9,_0x358b0f){var _0x1d45ff={},_0x2c2423={},_0x397075={'count':0x0,'rows':[]};var _0x2310a4=_[_0x5454('0x2b')](db[_0x5454('0x2c')]['rawAttributes'],function(_0x4cec56){return{'name':_0x4cec56[_0x5454('0x2d')],'type':_0x4cec56[_0x5454('0x2e')][_0x5454('0x2f')]};});_0x2c2423[_0x5454('0x30')]=_[_0x5454('0x2b')](_0x2310a4,_0x5454('0x29'));_0x2c2423[_0x5454('0x31')]=_[_0x5454('0x32')](_0x5ec1c9['query']);_0x2c2423[_0x5454('0x33')]=_[_0x5454('0x34')](_0x2c2423[_0x5454('0x30')],_0x2c2423[_0x5454('0x31')]);_0x1d45ff[_0x5454('0x35')]=_[_0x5454('0x34')](_0x2c2423[_0x5454('0x30')],qs[_0x5454('0x36')](_0x5ec1c9[_0x5454('0x31')][_0x5454('0x36')]));_0x1d45ff[_0x5454('0x35')]=_0x1d45ff[_0x5454('0x35')]['length']?_0x1d45ff[_0x5454('0x35')]:_0x2c2423[_0x5454('0x30')];if(!_0x5ec1c9['query'][_0x5454('0x37')]('nolimit')){_0x1d45ff[_0x5454('0x1e')]=qs[_0x5454('0x1e')](_0x5ec1c9[_0x5454('0x31')][_0x5454('0x1e')]);_0x1d45ff[_0x5454('0x1d')]=qs[_0x5454('0x1d')](_0x5ec1c9['query'][_0x5454('0x1d')]);}_0x1d45ff[_0x5454('0x38')]=qs[_0x5454('0x39')](_0x5ec1c9[_0x5454('0x31')][_0x5454('0x39')]);_0x1d45ff[_0x5454('0x3a')]=qs['filters'](_[_0x5454('0x3b')](_0x5ec1c9['query'],_0x2c2423[_0x5454('0x33')]),_0x2310a4);if(_0x5ec1c9[_0x5454('0x31')][_0x5454('0x3c')]){_0x1d45ff[_0x5454('0x3a')]=_[_0x5454('0x3d')](_0x1d45ff[_0x5454('0x3a')],{'$or':_[_0x5454('0x2b')](_0x2310a4,function(_0xa10d34){if(_0xa10d34[_0x5454('0x2e')]!==_0x5454('0x3e')){var _0x15ef54={};_0x15ef54[_0xa10d34[_0x5454('0x29')]]={'$like':'%'+_0x5ec1c9[_0x5454('0x31')][_0x5454('0x3c')]+'%'};return _0x15ef54;}})});}_0x1d45ff=_[_0x5454('0x3d')]({},_0x1d45ff,_0x5ec1c9[_0x5454('0x3f')]);var _0x184916={'where':_0x1d45ff[_0x5454('0x3a')]};return db[_0x5454('0x2c')][_0x5454('0x1c')](_0x184916)['then'](function(_0x5bad05){_0x397075['count']=_0x5bad05;if(_0x5ec1c9[_0x5454('0x31')][_0x5454('0x40')]){_0x1d45ff[_0x5454('0x41')]=[{'all':!![]}];}return db[_0x5454('0x2c')][_0x5454('0x42')](_0x1d45ff);})[_0x5454('0x24')](function(_0xaeefeb){_0x397075[_0x5454('0x43')]=_0xaeefeb;return _0x397075;})[_0x5454('0x24')](respondWithFilteredResult(_0x358b0f,_0x1d45ff))['catch'](handleError(_0x358b0f,null));};exports['show']=function(_0x36c1bc,_0x5f2eb2){var _0x567451={'raw':![],'where':{'id':_0x36c1bc[_0x5454('0x44')]['id']}},_0x107241={};_0x107241[_0x5454('0x30')]=_[_0x5454('0x32')](db[_0x5454('0x2c')][_0x5454('0x45')]);_0x107241[_0x5454('0x31')]=_['keys'](_0x36c1bc[_0x5454('0x31')]);_0x107241[_0x5454('0x33')]=_[_0x5454('0x34')](_0x107241['model'],_0x107241[_0x5454('0x31')]);_0x567451[_0x5454('0x35')]=_[_0x5454('0x34')](_0x107241[_0x5454('0x30')],qs[_0x5454('0x36')](_0x36c1bc[_0x5454('0x31')][_0x5454('0x36')]));_0x567451['attributes']=_0x567451[_0x5454('0x35')][_0x5454('0x46')]?_0x567451['attributes']:_0x107241['model'];if(_0x36c1bc['query'][_0x5454('0x40')]){_0x567451[_0x5454('0x41')]=[{'all':!![]}];}_0x567451=_[_0x5454('0x3d')]({},_0x567451,_0x36c1bc[_0x5454('0x3f')]);return db[_0x5454('0x2c')]['find'](_0x567451)[_0x5454('0x24')](handleEntityNotFound(_0x5f2eb2,null))[_0x5454('0x24')](respondWithResult(_0x5f2eb2,null))[_0x5454('0x47')](handleError(_0x5f2eb2,null));};exports['create']=function(_0x53528f,_0x522840){return db[_0x5454('0x2c')][_0x5454('0x48')](_0x53528f['body'],{})[_0x5454('0x24')](function(_0x4341d2){var _0x4ae445=_0x53528f[_0x5454('0x49')][_0x5454('0x25')]({'plain':!![]});if(!_0x4ae445)throw new Error(_0x5454('0x4a'));if(_0x4ae445[_0x5454('0x4b')]==='user'){var _0x5021df=_0x4341d2[_0x5454('0x25')]({'plain':!![]});var _0x11dfde=_0x5454('0x26');return db[_0x5454('0x4c')][_0x5454('0x4d')]({'where':{'name':_0x11dfde,'userProfileId':_0x4ae445[_0x5454('0x4e')]},'raw':!![]})[_0x5454('0x24')](function(_0xad6eda){if(_0xad6eda&&_0xad6eda[_0x5454('0x4f')]===0x0){return db[_0x5454('0x27')]['create']({'name':_0x5021df[_0x5454('0x29')],'resourceId':_0x5021df['id'],'type':_0xad6eda['name'],'sectionId':_0xad6eda['id']},{})[_0x5454('0x24')](function(){return _0x4341d2;});}else{return _0x4341d2;}})[_0x5454('0x47')](function(_0x1b50ee){logger[_0x5454('0x28')](_0x5454('0x50'),_0x1b50ee);throw _0x1b50ee;});}return _0x4341d2;})[_0x5454('0x24')](respondWithResult(_0x522840,0xc9))[_0x5454('0x47')](handleError(_0x522840,null));};exports[_0x5454('0x23')]=function(_0x2fc834,_0x4f9b11){if(_0x2fc834['body']['id']){delete _0x2fc834[_0x5454('0x51')]['id'];}return db[_0x5454('0x2c')]['find']({'where':{'id':_0x2fc834['params']['id']}})[_0x5454('0x24')](handleEntityNotFound(_0x4f9b11,null))[_0x5454('0x24')](saveUpdates(_0x2fc834[_0x5454('0x51')],null))[_0x5454('0x24')](respondWithResult(_0x4f9b11,null))[_0x5454('0x47')](handleError(_0x4f9b11,null));};exports[_0x5454('0x52')]=function(_0x23e81b,_0x1fd74f){return db['Team'][_0x5454('0x4d')]({'where':{'id':_0x23e81b[_0x5454('0x44')]['id']}})['then'](handleEntityNotFound(_0x1fd74f,null))[_0x5454('0x24')](removeEntity(_0x1fd74f,null))['catch'](handleError(_0x1fd74f,null));};exports[_0x5454('0x53')]=function(_0x29e38f,_0x5b83e1,_0x3c6bda){return db[_0x5454('0x2c')][_0x5454('0x54')]({'where':{'id':_0x29e38f[_0x5454('0x44')]['id']}})[_0x5454('0x24')](handleEntityNotFound(_0x5b83e1,null))[_0x5454('0x24')](function(_0x185590){if(!_0x29e38f[_0x5454('0x31')][_0x5454('0x55')]||!utils['isValidChannel'](_0x29e38f[_0x5454('0x31')][_0x5454('0x55')])){throw new db[(_0x5454('0x56'))][(_0x5454('0x57'))]('Unknown\x20channel');}var _0x3e16ea={};var _0x3866af={};_0x3866af[_0x5454('0x30')]=_[_0x5454('0x32')](db[_['capitalize'](_0x29e38f['query'][_0x5454('0x55')][_0x5454('0x58')]())+_0x5454('0x59')]['rawAttributes']);_0x3866af[_0x5454('0x31')]=_['keys'](_0x29e38f[_0x5454('0x31')]);_0x3866af[_0x5454('0x33')]=_[_0x5454('0x34')](_0x3866af[_0x5454('0x30')],_0x3866af[_0x5454('0x31')]);_0x3e16ea[_0x5454('0x35')]=_[_0x5454('0x34')](_0x3866af[_0x5454('0x30')],qs[_0x5454('0x36')](_0x29e38f[_0x5454('0x31')][_0x5454('0x36')]));_0x3e16ea['attributes']=_0x3e16ea[_0x5454('0x35')][_0x5454('0x46')]?_0x3e16ea['attributes']:_0x3866af[_0x5454('0x30')];_0x3e16ea[_0x5454('0x1e')]=qs[_0x5454('0x1e')](_0x29e38f['query'][_0x5454('0x1e')]);_0x3e16ea[_0x5454('0x1d')]=qs[_0x5454('0x1d')](_0x29e38f[_0x5454('0x31')][_0x5454('0x1d')]);_0x3e16ea[_0x5454('0x38')]=qs[_0x5454('0x39')](_0x29e38f['query'][_0x5454('0x39')]);_0x3e16ea[_0x5454('0x3a')]=qs[_0x5454('0x33')](_[_0x5454('0x3b')](_0x29e38f[_0x5454('0x31')],_0x3866af['filters']));_0x3e16ea=_[_0x5454('0x3d')]({},_0x3e16ea,_0x29e38f[_0x5454('0x3f')]);return _0x185590[_0x5454('0x25')+_[_0x5454('0x5a')](_0x29e38f['query']['channel'][_0x5454('0x58')]())+_0x5454('0x5b')](_0x3e16ea);})[_0x5454('0x24')](respondWithResult(_0x5b83e1,null))['catch'](handleError(_0x5b83e1,null));};exports[_0x5454('0x5c')]=function(_0x6e0899,_0x4ac3d5,_0x945e08){return db['Team']['findOne']({'where':{'id':_0x6e0899[_0x5454('0x44')]['id']}})[_0x5454('0x24')](function(_0x285625){if(_0x285625){if(!_0x6e0899['body'][_0x5454('0x55')]||!utils[_0x5454('0x5d')](_0x6e0899[_0x5454('0x51')]['channel'])){throw new db[(_0x5454('0x56'))]['ValidationError'](_0x5454('0x5e'));}return _0x285625[_0x5454('0x5f')+_[_0x5454('0x5a')](_0x6e0899[_0x5454('0x51')][_0x5454('0x55')][_0x5454('0x58')]())+'Queues'](_0x6e0899[_0x5454('0x51')][_0x5454('0x60')]);}return null;})[_0x5454('0x24')](handleEntityNotFound(_0x4ac3d5,null))[_0x5454('0x24')](respondWithStatusCode(_0x4ac3d5,null))[_0x5454('0x47')](handleError(_0x4ac3d5,null));};exports[_0x5454('0x61')]=function(_0x375b6a,_0x58ba29,_0x5202e1){return db[_0x5454('0x2c')][_0x5454('0x54')]({'where':{'id':_0x375b6a[_0x5454('0x44')]['id']}})['then'](function(_0x2e10bd){if(_0x2e10bd){if(!_0x375b6a[_0x5454('0x31')]['channel']||!utils[_0x5454('0x5d')](_0x375b6a[_0x5454('0x31')][_0x5454('0x55')])){throw new db[(_0x5454('0x56'))][(_0x5454('0x57'))](_0x5454('0x5e'));}return _0x2e10bd[_0x5454('0x62')+_[_0x5454('0x5a')](_0x375b6a[_0x5454('0x31')]['channel'][_0x5454('0x58')]())+_0x5454('0x5b')](_0x375b6a[_0x5454('0x31')]['ids']);}return null;})['then'](handleEntityNotFound(_0x58ba29,null))[_0x5454('0x24')](respondWithStatusCode(_0x58ba29,null))[_0x5454('0x47')](handleError(_0x58ba29,null));};exports[_0x5454('0x63')]=function(_0x476aec,_0x4959bf){return db['Team'][_0x5454('0x4d')]({'where':{'id':_0x476aec[_0x5454('0x44')]['id']}})[_0x5454('0x24')](handleEntityNotFound(_0x4959bf,null))[_0x5454('0x24')](function(_0x4c7def){if(_0x4c7def){var _0x12bc27=[_0x5454('0x64'),'Chat',_0x5454('0x65'),_0x5454('0x66'),_0x5454('0x67'),'Openchannel',_0x5454('0x68')];return db[_0x5454('0x69')]['transaction'](function(_0x5c509a){var _0x1a3567=_[_0x5454('0x2b')](_0x12bc27,function(_0x433e88){var _0x94241c={'attributes':['id','name']};if(_0x433e88===_0x5454('0x64')){_0x94241c['through']={'attributes':['penalty']};}return _0x4c7def[_0x5454('0x25')+_0x433e88+'Queues'](_0x94241c)[_0x5454('0x24')](function(_0x157c9e){var _0x371938=_[_0x5454('0x2b')](_0x157c9e,function(_0xf4dc6){var _0x469a9e=_[_0x5454('0x2b')](_0x476aec[_0x5454('0x51')][_0x5454('0x60')],function(_0x4e07fe){var _0x5c854b={'where':{'UserId':_0x4e07fe,[_0x433e88+_0x5454('0x6a')]:_0xf4dc6['id']},'transaction':_0x5c509a};if(_0x433e88===_0x5454('0x64')){_0x5c854b[_0x5454('0x13')]={'penalty':_0xf4dc6[_0x5454('0x6b')][_0x5454('0x6c')]};}return db[_0x5454('0x6d')+_0x433e88+_0x5454('0x59')][_0x5454('0x6e')](_0x5c854b)[_0x5454('0x24')](function(){socket[_0x5454('0x6f')](_0x5454('0x49')+_0x433e88+_0x5454('0x70'),{'UserId':_0x4e07fe,[_0x433e88+_0x5454('0x6a')]:_0xf4dc6['id']});if(_0x433e88!=='Voice')return;return db[_0x5454('0x6d')]['findAll']({'where':{'id':_0x476aec[_0x5454('0x51')][_0x5454('0x60')],'online':0x1},'attributes':['id',_0x5454('0x29'),_0x5454('0x71'),_0x5454('0x72'),_0x5454('0x73')],'raw':!![]})['then'](function(_0x64190a){var _0x1f6d61=_[_0x5454('0x2b')](_0x64190a,function(_0x49c7c7){return db[_0x5454('0x74')][_0x5454('0x75')]({'membername':_0x49c7c7[_0x5454('0x29')],'UserId':_0x49c7c7['id'],'queue_name':_0xf4dc6['name'],'VoiceQueueId':_0xf4dc6['id'],'interface':_[_0x5454('0x76')](_0x49c7c7['interface'])?util[_0x5454('0x77')](_0x5454('0x78'),_0x49c7c7['name']):_0x49c7c7[_0x5454('0x73')],'paused':_0x49c7c7[_0x5454('0x72')]||![],'penalty':_0xf4dc6['TeamVoiceQueue'][_0x5454('0x6c')]},{'transaction':_0x5c509a});});return Promise['all'](_0x1f6d61);});});});return Promise[_0x5454('0x79')](_0x469a9e);});return Promise[_0x5454('0x79')](_0x371938);});});return Promise[_0x5454('0x79')](_0x1a3567)[_0x5454('0x24')](function(){return _0x4c7def[_0x5454('0x63')](_0x476aec[_0x5454('0x51')][_0x5454('0x60')],{'transaction':_0x5c509a})[_0x5454('0x7a')](function(_0x5f55a8){return _0x5f55a8;});});});}})['then'](respondWithResult(_0x4959bf,null))[_0x5454('0x47')](handleError(_0x4959bf,null));};exports[_0x5454('0x7b')]=function(_0x366880,_0x674fce){return db[_0x5454('0x2c')][_0x5454('0x4d')]({'where':{'id':_0x366880[_0x5454('0x44')]['id']}})[_0x5454('0x24')](handleEntityNotFound(_0x674fce,null))['then'](function(_0xcfddba){if(_0xcfddba){var _0x179e0a=[_0x5454('0x64'),_0x5454('0x7c'),_0x5454('0x65'),_0x5454('0x66'),_0x5454('0x67'),_0x5454('0x7d'),'Whatsapp'];return db[_0x5454('0x69')][_0x5454('0x7e')](function(_0x56f1b8){var _0x3869d7=_['map'](_0x179e0a,function(_0x351a11){var _0x499ec9={'attributes':['id','name']};return _0xcfddba[_0x5454('0x25')+_0x351a11+_0x5454('0x5b')](_0x499ec9)['then'](function(_0x48082a){var _0x316a9b=_[_0x5454('0x2b')](_0x48082a,function(_0x5e0c57){return _0x5e0c57[_0x5454('0x7b')](_0x366880[_0x5454('0x31')][_0x5454('0x60')],{'transaction':_0x56f1b8})[_0x5454('0x24')](function(){var _0x364909=JSON[_0x5454('0x7f')]('['+_0x366880['query'][_0x5454('0x60')]+']');var _0x8e3ad8=_[_0x5454('0x2b')](_0x364909,function(_0x197335){socket[_0x5454('0x6f')](_0x5454('0x49')+_0x351a11+_0x5454('0x80'),{'UserId':Number(_0x197335),[_0x351a11+'QueueId']:_0x5e0c57['id']});if(_0x351a11!==_0x5454('0x64'))return;return db[_0x5454('0x74')][_0x5454('0x52')]({'where':{'VoiceQueueId':_0x5e0c57['id'],'UserId':_0x197335},'transaction':_0x56f1b8});});return Promise[_0x5454('0x79')](_0x8e3ad8);});});return Promise[_0x5454('0x79')](_0x316a9b);});});return Promise[_0x5454('0x79')](_0x3869d7)[_0x5454('0x24')](function(){return _0xcfddba[_0x5454('0x7b')](_0x366880[_0x5454('0x31')][_0x5454('0x60')],{'transaction':_0x56f1b8});});});}})[_0x5454('0x24')](respondWithStatusCode(_0x674fce,null))[_0x5454('0x47')](handleError(_0x674fce,null));};exports['getAgents']=function(_0x10c20d,_0x3aac93,_0x2d02ab){var _0xf13ad9={};var _0x420217={};var _0x4a86f6;var _0xebb180;return db[_0x5454('0x2c')][_0x5454('0x54')]({'where':{'id':_0x10c20d['params']['id']}})[_0x5454('0x24')](handleEntityNotFound(_0x3aac93,null))['then'](function(_0x443c19){if(_0x443c19){_0x4a86f6=_0x443c19;_0x420217[_0x5454('0x30')]=_[_0x5454('0x32')](db[_0x5454('0x6d')][_0x5454('0x45')]);_0x420217[_0x5454('0x31')]=_[_0x5454('0x32')](_0x10c20d['query']);_0x420217[_0x5454('0x33')]=_[_0x5454('0x34')](_0x420217[_0x5454('0x30')],_0x420217[_0x5454('0x31')]);_0xf13ad9['attributes']=_['intersection'](_0x420217[_0x5454('0x30')],qs[_0x5454('0x36')](_0x10c20d[_0x5454('0x31')]['fields']));_0xf13ad9[_0x5454('0x35')]=_0xf13ad9['attributes'][_0x5454('0x46')]?_0xf13ad9[_0x5454('0x35')]:_0x420217['model'];_0xf13ad9[_0x5454('0x38')]=qs['sort'](_0x10c20d[_0x5454('0x31')]['sort']);_0xf13ad9[_0x5454('0x3a')]=qs[_0x5454('0x33')](_['pick'](_0x10c20d[_0x5454('0x31')],_0x420217['filters']));if(_0x10c20d[_0x5454('0x31')][_0x5454('0x3c')]){_0xf13ad9[_0x5454('0x3a')]=_['merge'](_0xf13ad9['where'],{'$or':_['map'](_0xf13ad9[_0x5454('0x35')],function(_0x210c8c){var _0x45cf11={};_0x45cf11[_0x210c8c]={'$like':'%'+_0x10c20d[_0x5454('0x31')][_0x5454('0x3c')]+'%'};return _0x45cf11;})});}_0xf13ad9=_[_0x5454('0x3d')]({},_0xf13ad9,_0x10c20d[_0x5454('0x3f')]);return _0x4a86f6[_0x5454('0x81')](_0xf13ad9);}})[_0x5454('0x24')](function(_0x455b50){if(_0x455b50){_0xebb180=_0x455b50[_0x5454('0x46')];if(!_0x10c20d['query']['hasOwnProperty'](_0x5454('0x82'))){_0xf13ad9[_0x5454('0x1e')]=qs['limit'](_0x10c20d['query'][_0x5454('0x1e')]);_0xf13ad9['offset']=qs[_0x5454('0x1d')](_0x10c20d[_0x5454('0x31')][_0x5454('0x1d')]);}return _0x4a86f6[_0x5454('0x81')](_0xf13ad9);}})['then'](function(_0x4180f5){if(_0x4180f5){return _0x4180f5?{'count':_0xebb180,'rows':_0x4180f5}:null;}})[_0x5454('0x24')](respondWithResult(_0x3aac93,null))[_0x5454('0x47')](handleError(_0x3aac93,null));}; \ No newline at end of file +var _0x58ad=['get','Teams','UserProfileResource','error','name','send','index','Team','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','include','rows','catch','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','params','isValidChannel','channel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','rawAttributes','Queues','addQueues','findOne','add','ids','removeQueues','remove','addAgents','Chat','Mail','Sms','Fax','Openchannel','sequelize','transaction','through','penalty','QueueId','Voice','User','Queue','findOrCreate','emit','findAll','online','voicePause','interface','UserVoiceQueueRt','upsert','format','SIP/%s','TeamVoiceQueue','all','removeAgents','Whatsapp','parse','Queue:remove','destroy','getAgents','eml-format','zip-dir','bluebird','mustache','util','path','to-csv','ejs','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then'];(function(_0x5c6913,_0x2bfeec){var _0x590967=function(_0x390c9e){while(--_0x390c9e){_0x5c6913['push'](_0x5c6913['shift']());}};_0x590967(++_0x2bfeec);}(_0x58ad,0x15c));var _0xd58a=function(_0x526110,_0x25e876){_0x526110=_0x526110-0x0;var _0x436254=_0x58ad[_0x526110];return _0x436254;};'use strict';var emlformat=require(_0xd58a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd58a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd58a('0x2'));var Mustache=require(_0xd58a('0x3'));var util=require(_0xd58a('0x4'));var path=require(_0xd58a('0x5'));var sox=require('sox');var csv=require(_0xd58a('0x6'));var ejs=require(_0xd58a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd58a('0x8'));var deskjs=require(_0xd58a('0x9'));var toCsv=require(_0xd58a('0x6'));var querystring=require(_0xd58a('0xa'));var Papa=require('papaparse');var Redis=require(_0xd58a('0xb'));var authService=require(_0xd58a('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xd58a('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd58a('0xe'))(_0xd58a('0xf'));var utils=require(_0xd58a('0x10'));var config=require(_0xd58a('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xd58a('0x12')](config[_0xd58a('0x13')],{'host':_0xd58a('0x14'),'port':0x18eb});var socket=require(_0xd58a('0x15'))(new Redis(config[_0xd58a('0x13')]));require(_0xd58a('0x16'))[_0xd58a('0x17')](socket);function respondWithStatusCode(_0x215d1d,_0x3896ec){_0x3896ec=_0x3896ec||0xcc;return function(_0x21bab3){if(_0x21bab3){return _0x215d1d[_0xd58a('0x18')](_0x3896ec);}return _0x215d1d[_0xd58a('0x19')](_0x3896ec)[_0xd58a('0x1a')]();};}function respondWithResult(_0x2f77ac,_0x8121c7){_0x8121c7=_0x8121c7||0xc8;return function(_0x5ddac5){if(_0x5ddac5){return _0x2f77ac[_0xd58a('0x19')](_0x8121c7)[_0xd58a('0x1b')](_0x5ddac5);}};}function respondWithFilteredResult(_0x20d117,_0x325463){return function(_0x2e1acd){if(_0x2e1acd){var _0x459c6a=_0x2e1acd['count'],_0x552a24=_0x325463[_0xd58a('0x1c')],_0xdbb11d=_0x325463['offset']+_0x325463[_0xd58a('0x1d')],_0x2b835d;if(_0xdbb11d>=_0x459c6a){_0xdbb11d=_0x459c6a;_0x2b835d=0xc8;}else{_0x2b835d=0xce;}_0x20d117[_0xd58a('0x19')](_0x2b835d);return _0x20d117[_0xd58a('0x1e')]('Content-Range',_0x552a24+'-'+_0xdbb11d+'/'+_0x459c6a)['json'](_0x2e1acd);}return null;};}function patchUpdates(_0x26b7b1){return function(_0x4962e9){try{jsonpatch[_0xd58a('0x1f')](_0x4962e9,_0x26b7b1,!![]);}catch(_0x19f8d9){return BPromise[_0xd58a('0x20')](_0x19f8d9);}return _0x4962e9[_0xd58a('0x21')]();};}function saveUpdates(_0x1c582d,_0x48e668){return function(_0x4fad3d){if(_0x4fad3d){return _0x4fad3d[_0xd58a('0x22')](_0x1c582d)[_0xd58a('0x23')](function(_0x2cb5c0){return _0x2cb5c0;});}return null;};}function removeEntity(_0x126d95,_0x4b6776){return function(_0x4c5574){if(_0x4c5574){return _0x4c5574['destroy']()['then'](function(){var _0x19ed05=_0x4c5574[_0xd58a('0x24')]({'plain':!![]});var _0xe1a190=_0xd58a('0x25');return db[_0xd58a('0x26')]['destroy']({'where':{'type':_0xe1a190,'resourceId':_0x19ed05['id']}})[_0xd58a('0x23')](function(){return _0x4c5574;});})[_0xd58a('0x23')](function(){_0x126d95[_0xd58a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x458bf1,_0x27104e){return function(_0x1c18a8){if(!_0x1c18a8){_0x458bf1['sendStatus'](0x194);}return _0x1c18a8;};}function handleError(_0x53f689,_0x2fb7a5){_0x2fb7a5=_0x2fb7a5||0x1f4;return function(_0x3f0f37){logger[_0xd58a('0x27')](_0x3f0f37['stack']);if(_0x3f0f37[_0xd58a('0x28')]){delete _0x3f0f37['name'];}_0x53f689[_0xd58a('0x19')](_0x2fb7a5)[_0xd58a('0x29')](_0x3f0f37);};}exports[_0xd58a('0x2a')]=function(_0x3b08bd,_0x3a5c2d){var _0x4d0202={},_0x53fc9b={},_0x5745cf={'count':0x0,'rows':[]};var _0x3a7354=_['map'](db[_0xd58a('0x2b')]['rawAttributes'],function(_0x70043e){return{'name':_0x70043e[_0xd58a('0x2c')],'type':_0x70043e['type'][_0xd58a('0x2d')]};});_0x53fc9b[_0xd58a('0x2e')]=_[_0xd58a('0x2f')](_0x3a7354,_0xd58a('0x28'));_0x53fc9b['query']=_[_0xd58a('0x30')](_0x3b08bd[_0xd58a('0x31')]);_0x53fc9b[_0xd58a('0x32')]=_[_0xd58a('0x33')](_0x53fc9b[_0xd58a('0x2e')],_0x53fc9b['query']);_0x4d0202[_0xd58a('0x34')]=_[_0xd58a('0x33')](_0x53fc9b[_0xd58a('0x2e')],qs[_0xd58a('0x35')](_0x3b08bd[_0xd58a('0x31')][_0xd58a('0x35')]));_0x4d0202[_0xd58a('0x34')]=_0x4d0202[_0xd58a('0x34')][_0xd58a('0x36')]?_0x4d0202['attributes']:_0x53fc9b[_0xd58a('0x2e')];if(!_0x3b08bd[_0xd58a('0x31')][_0xd58a('0x37')](_0xd58a('0x38'))){_0x4d0202[_0xd58a('0x1d')]=qs['limit'](_0x3b08bd[_0xd58a('0x31')][_0xd58a('0x1d')]);_0x4d0202[_0xd58a('0x1c')]=qs['offset'](_0x3b08bd[_0xd58a('0x31')]['offset']);}_0x4d0202[_0xd58a('0x39')]=qs[_0xd58a('0x3a')](_0x3b08bd[_0xd58a('0x31')]['sort']);_0x4d0202[_0xd58a('0x3b')]=qs[_0xd58a('0x32')](_[_0xd58a('0x3c')](_0x3b08bd[_0xd58a('0x31')],_0x53fc9b[_0xd58a('0x32')]),_0x3a7354);if(_0x3b08bd[_0xd58a('0x31')][_0xd58a('0x3d')]){_0x4d0202[_0xd58a('0x3b')]=_['merge'](_0x4d0202['where'],{'$or':_['map'](_0x3a7354,function(_0x3e5e93){if(_0x3e5e93['type']!==_0xd58a('0x3e')){var _0x5a9aa5={};_0x5a9aa5[_0x3e5e93[_0xd58a('0x28')]]={'$like':'%'+_0x3b08bd[_0xd58a('0x31')][_0xd58a('0x3d')]+'%'};return _0x5a9aa5;}})});}_0x4d0202=_[_0xd58a('0x3f')]({},_0x4d0202,_0x3b08bd['options']);var _0x2fd4c8={'where':_0x4d0202[_0xd58a('0x3b')]};return db[_0xd58a('0x2b')][_0xd58a('0x40')](_0x2fd4c8)[_0xd58a('0x23')](function(_0x4b0be0){_0x5745cf[_0xd58a('0x40')]=_0x4b0be0;if(_0x3b08bd[_0xd58a('0x31')][_0xd58a('0x41')]){_0x4d0202[_0xd58a('0x42')]=[{'all':!![]}];}return db[_0xd58a('0x2b')]['findAll'](_0x4d0202);})[_0xd58a('0x23')](function(_0x36e2f9){_0x5745cf[_0xd58a('0x43')]=_0x36e2f9;return _0x5745cf;})[_0xd58a('0x23')](respondWithFilteredResult(_0x3a5c2d,_0x4d0202))[_0xd58a('0x44')](handleError(_0x3a5c2d,null));};exports['show']=function(_0x1f9beb,_0x4ca22d){var _0x2673e6={'raw':![],'where':{'id':_0x1f9beb['params']['id']}},_0x31f26a={};_0x31f26a[_0xd58a('0x2e')]=_[_0xd58a('0x30')](db[_0xd58a('0x2b')]['rawAttributes']);_0x31f26a['query']=_[_0xd58a('0x30')](_0x1f9beb['query']);_0x31f26a[_0xd58a('0x32')]=_['intersection'](_0x31f26a['model'],_0x31f26a[_0xd58a('0x31')]);_0x2673e6['attributes']=_[_0xd58a('0x33')](_0x31f26a[_0xd58a('0x2e')],qs[_0xd58a('0x35')](_0x1f9beb['query']['fields']));_0x2673e6[_0xd58a('0x34')]=_0x2673e6['attributes'][_0xd58a('0x36')]?_0x2673e6['attributes']:_0x31f26a[_0xd58a('0x2e')];if(_0x1f9beb[_0xd58a('0x31')]['includeAll']){_0x2673e6['include']=[{'all':!![]}];}_0x2673e6=_[_0xd58a('0x3f')]({},_0x2673e6,_0x1f9beb[_0xd58a('0x45')]);return db[_0xd58a('0x2b')][_0xd58a('0x46')](_0x2673e6)[_0xd58a('0x23')](handleEntityNotFound(_0x4ca22d,null))[_0xd58a('0x23')](respondWithResult(_0x4ca22d,null))[_0xd58a('0x44')](handleError(_0x4ca22d,null));};exports[_0xd58a('0x47')]=function(_0x249fe2,_0x21d8ad){return db[_0xd58a('0x2b')][_0xd58a('0x47')](_0x249fe2[_0xd58a('0x48')],{})['then'](function(_0x45d12f){var _0x4767d0=_0x249fe2[_0xd58a('0x49')][_0xd58a('0x24')]({'plain':!![]});if(!_0x4767d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4767d0[_0xd58a('0x4a')]===_0xd58a('0x49')){var _0x4b098a=_0x45d12f[_0xd58a('0x24')]({'plain':!![]});var _0x47ee55=_0xd58a('0x25');return db[_0xd58a('0x4b')][_0xd58a('0x46')]({'where':{'name':_0x47ee55,'userProfileId':_0x4767d0[_0xd58a('0x4c')]},'raw':!![]})['then'](function(_0x55c688){if(_0x55c688&&_0x55c688[_0xd58a('0x4d')]===0x0){return db[_0xd58a('0x26')][_0xd58a('0x47')]({'name':_0x4b098a[_0xd58a('0x28')],'resourceId':_0x4b098a['id'],'type':_0x55c688[_0xd58a('0x28')],'sectionId':_0x55c688['id']},{})[_0xd58a('0x23')](function(){return _0x45d12f;});}else{return _0x45d12f;}})[_0xd58a('0x44')](function(_0x3818d1){logger[_0xd58a('0x27')](_0xd58a('0x4e'),_0x3818d1);throw _0x3818d1;});}return _0x45d12f;})[_0xd58a('0x23')](respondWithResult(_0x21d8ad,0xc9))['catch'](handleError(_0x21d8ad,null));};exports[_0xd58a('0x22')]=function(_0x2b6458,_0x1a25fd){if(_0x2b6458[_0xd58a('0x48')]['id']){delete _0x2b6458[_0xd58a('0x48')]['id'];}return db[_0xd58a('0x2b')][_0xd58a('0x46')]({'where':{'id':_0x2b6458['params']['id']}})[_0xd58a('0x23')](handleEntityNotFound(_0x1a25fd,null))['then'](saveUpdates(_0x2b6458['body'],null))[_0xd58a('0x23')](respondWithResult(_0x1a25fd,null))['catch'](handleError(_0x1a25fd,null));};exports['destroy']=function(_0x113332,_0x2074ab){return db[_0xd58a('0x2b')][_0xd58a('0x46')]({'where':{'id':_0x113332['params']['id']}})['then'](handleEntityNotFound(_0x2074ab,null))[_0xd58a('0x23')](removeEntity(_0x2074ab,null))[_0xd58a('0x44')](handleError(_0x2074ab,null));};exports[_0xd58a('0x4f')]=function(_0x46d49a,_0x1c206b,_0x59fc73){return db[_0xd58a('0x2b')]['findOne']({'where':{'id':_0x46d49a[_0xd58a('0x50')]['id']}})[_0xd58a('0x23')](handleEntityNotFound(_0x1c206b,null))[_0xd58a('0x23')](function(_0x257264){if(!_0x46d49a['query']['channel']||!utils[_0xd58a('0x51')](_0x46d49a[_0xd58a('0x31')][_0xd58a('0x52')])){throw new db[(_0xd58a('0x53'))][(_0xd58a('0x54'))](_0xd58a('0x55'));}var _0x2fc881={};var _0x57b81a={};_0x57b81a[_0xd58a('0x2e')]=_['keys'](db[_[_0xd58a('0x56')](_0x46d49a['query'][_0xd58a('0x52')][_0xd58a('0x57')]())+'Queue'][_0xd58a('0x58')]);_0x57b81a[_0xd58a('0x31')]=_['keys'](_0x46d49a['query']);_0x57b81a['filters']=_[_0xd58a('0x33')](_0x57b81a[_0xd58a('0x2e')],_0x57b81a['query']);_0x2fc881[_0xd58a('0x34')]=_['intersection'](_0x57b81a[_0xd58a('0x2e')],qs[_0xd58a('0x35')](_0x46d49a[_0xd58a('0x31')]['fields']));_0x2fc881[_0xd58a('0x34')]=_0x2fc881['attributes']['length']?_0x2fc881[_0xd58a('0x34')]:_0x57b81a['model'];_0x2fc881[_0xd58a('0x1d')]=qs[_0xd58a('0x1d')](_0x46d49a[_0xd58a('0x31')][_0xd58a('0x1d')]);_0x2fc881[_0xd58a('0x1c')]=qs[_0xd58a('0x1c')](_0x46d49a['query'][_0xd58a('0x1c')]);_0x2fc881[_0xd58a('0x39')]=qs['sort'](_0x46d49a['query'][_0xd58a('0x3a')]);_0x2fc881[_0xd58a('0x3b')]=qs[_0xd58a('0x32')](_['pick'](_0x46d49a[_0xd58a('0x31')],_0x57b81a[_0xd58a('0x32')]));_0x2fc881=_[_0xd58a('0x3f')]({},_0x2fc881,_0x46d49a['options']);return _0x257264[_0xd58a('0x24')+_[_0xd58a('0x56')](_0x46d49a[_0xd58a('0x31')][_0xd58a('0x52')][_0xd58a('0x57')]())+_0xd58a('0x59')](_0x2fc881);})[_0xd58a('0x23')](respondWithResult(_0x1c206b,null))[_0xd58a('0x44')](handleError(_0x1c206b,null));};exports[_0xd58a('0x5a')]=function(_0x3ba9f5,_0x58bd8f,_0x252c57){return db[_0xd58a('0x2b')][_0xd58a('0x5b')]({'where':{'id':_0x3ba9f5['params']['id']}})[_0xd58a('0x23')](function(_0x1b1b47){if(_0x1b1b47){if(!_0x3ba9f5[_0xd58a('0x48')][_0xd58a('0x52')]||!utils[_0xd58a('0x51')](_0x3ba9f5[_0xd58a('0x48')][_0xd58a('0x52')])){throw new db[(_0xd58a('0x53'))][(_0xd58a('0x54'))]('Unknown\x20channel');}return _0x1b1b47[_0xd58a('0x5c')+_[_0xd58a('0x56')](_0x3ba9f5['body'][_0xd58a('0x52')][_0xd58a('0x57')]())+_0xd58a('0x59')](_0x3ba9f5[_0xd58a('0x48')][_0xd58a('0x5d')]);}return null;})['then'](handleEntityNotFound(_0x58bd8f,null))[_0xd58a('0x23')](respondWithStatusCode(_0x58bd8f,null))[_0xd58a('0x44')](handleError(_0x58bd8f,null));};exports[_0xd58a('0x5e')]=function(_0x42b65d,_0x10a21c,_0x11daed){return db['Team'][_0xd58a('0x5b')]({'where':{'id':_0x42b65d[_0xd58a('0x50')]['id']}})[_0xd58a('0x23')](function(_0x248a2b){if(_0x248a2b){if(!_0x42b65d[_0xd58a('0x31')]['channel']||!utils[_0xd58a('0x51')](_0x42b65d[_0xd58a('0x31')]['channel'])){throw new db[(_0xd58a('0x53'))][(_0xd58a('0x54'))]('Unknown\x20channel');}return _0x248a2b[_0xd58a('0x5f')+_[_0xd58a('0x56')](_0x42b65d[_0xd58a('0x31')][_0xd58a('0x52')][_0xd58a('0x57')]())+_0xd58a('0x59')](_0x42b65d[_0xd58a('0x31')]['ids']);}return null;})[_0xd58a('0x23')](handleEntityNotFound(_0x10a21c,null))[_0xd58a('0x23')](respondWithStatusCode(_0x10a21c,null))[_0xd58a('0x44')](handleError(_0x10a21c,null));};exports[_0xd58a('0x60')]=function(_0x2e153c,_0x2f9cd6){return db[_0xd58a('0x2b')][_0xd58a('0x46')]({'where':{'id':_0x2e153c[_0xd58a('0x50')]['id']}})[_0xd58a('0x23')](handleEntityNotFound(_0x2f9cd6,null))[_0xd58a('0x23')](function(_0x33996b){if(_0x33996b){var _0x4dfd51=['Voice',_0xd58a('0x61'),_0xd58a('0x62'),_0xd58a('0x63'),_0xd58a('0x64'),_0xd58a('0x65'),'Whatsapp'];return db[_0xd58a('0x66')][_0xd58a('0x67')](function(_0x4d709d){var _0x3cb8b6=_[_0xd58a('0x2f')](_0x4dfd51,function(_0x10d41f){var _0x1d0e4f={'attributes':['id','name']};if(_0x10d41f==='Voice'){_0x1d0e4f[_0xd58a('0x68')]={'attributes':[_0xd58a('0x69')]};}return _0x33996b[_0xd58a('0x24')+_0x10d41f+_0xd58a('0x59')](_0x1d0e4f)[_0xd58a('0x23')](function(_0x100e52){var _0x54cc9b=_[_0xd58a('0x2f')](_0x100e52,function(_0x553e47){var _0x1097b7=_[_0xd58a('0x2f')](_0x2e153c['body'][_0xd58a('0x5d')],function(_0x2df247){var _0x4d2ea4={'where':{'UserId':_0x2df247,[_0x10d41f+_0xd58a('0x6a')]:_0x553e47['id']},'transaction':_0x4d709d};if(_0x10d41f===_0xd58a('0x6b')){_0x4d2ea4[_0xd58a('0x12')]={'penalty':_0x553e47['TeamVoiceQueue'][_0xd58a('0x69')]};}return db[_0xd58a('0x6c')+_0x10d41f+_0xd58a('0x6d')][_0xd58a('0x6e')](_0x4d2ea4)[_0xd58a('0x23')](function(){socket[_0xd58a('0x6f')]('user'+_0x10d41f+'Queue:save',{'UserId':_0x2df247,[_0x10d41f+_0xd58a('0x6a')]:_0x553e47['id']});if(_0x10d41f!==_0xd58a('0x6b'))return;return db['User'][_0xd58a('0x70')]({'where':{'id':_0x2e153c[_0xd58a('0x48')][_0xd58a('0x5d')],'online':0x1},'attributes':['id',_0xd58a('0x28'),_0xd58a('0x71'),_0xd58a('0x72'),_0xd58a('0x73')],'raw':!![]})['then'](function(_0x4ab847){var _0xf7342=_[_0xd58a('0x2f')](_0x4ab847,function(_0xb5c7a8){return db[_0xd58a('0x74')][_0xd58a('0x75')]({'membername':_0xb5c7a8[_0xd58a('0x28')],'UserId':_0xb5c7a8['id'],'queue_name':_0x553e47[_0xd58a('0x28')],'VoiceQueueId':_0x553e47['id'],'interface':_['isNil'](_0xb5c7a8[_0xd58a('0x73')])?util[_0xd58a('0x76')](_0xd58a('0x77'),_0xb5c7a8[_0xd58a('0x28')]):_0xb5c7a8['interface'],'paused':_0xb5c7a8[_0xd58a('0x72')]||![],'penalty':_0x553e47[_0xd58a('0x78')][_0xd58a('0x69')]},{'transaction':_0x4d709d});});return Promise[_0xd58a('0x79')](_0xf7342);});});});return Promise[_0xd58a('0x79')](_0x1097b7);});return Promise[_0xd58a('0x79')](_0x54cc9b);});});return Promise['all'](_0x3cb8b6)['then'](function(){return _0x33996b[_0xd58a('0x60')](_0x2e153c[_0xd58a('0x48')][_0xd58a('0x5d')],{'transaction':_0x4d709d})['spread'](function(_0x4de9a3){return _0x4de9a3;});});});}})[_0xd58a('0x23')](respondWithResult(_0x2f9cd6,null))[_0xd58a('0x44')](handleError(_0x2f9cd6,null));};exports[_0xd58a('0x7a')]=function(_0x47ac10,_0x5cfcba){return db[_0xd58a('0x2b')][_0xd58a('0x46')]({'where':{'id':_0x47ac10[_0xd58a('0x50')]['id']}})[_0xd58a('0x23')](handleEntityNotFound(_0x5cfcba,null))['then'](function(_0x222140){if(_0x222140){var _0x1b7a19=[_0xd58a('0x6b'),'Chat',_0xd58a('0x62'),_0xd58a('0x63'),_0xd58a('0x64'),_0xd58a('0x65'),_0xd58a('0x7b')];return db[_0xd58a('0x66')]['transaction'](function(_0x1613d5){var _0x439c5d=_['map'](_0x1b7a19,function(_0x2848a2){var _0x1548c0={'attributes':['id','name']};return _0x222140[_0xd58a('0x24')+_0x2848a2+_0xd58a('0x59')](_0x1548c0)[_0xd58a('0x23')](function(_0x3c9c5c){var _0xe33c76=_[_0xd58a('0x2f')](_0x3c9c5c,function(_0x42b940){return _0x42b940[_0xd58a('0x7a')](_0x47ac10[_0xd58a('0x31')][_0xd58a('0x5d')],{'transaction':_0x1613d5})[_0xd58a('0x23')](function(){var _0x2f7402=JSON[_0xd58a('0x7c')]('['+_0x47ac10['query'][_0xd58a('0x5d')]+']');var _0x34bd96=_[_0xd58a('0x2f')](_0x2f7402,function(_0x4be566){socket[_0xd58a('0x6f')](_0xd58a('0x49')+_0x2848a2+_0xd58a('0x7d'),{'UserId':Number(_0x4be566),[_0x2848a2+'QueueId']:_0x42b940['id']});if(_0x2848a2!==_0xd58a('0x6b'))return;return db['UserVoiceQueueRt'][_0xd58a('0x7e')]({'where':{'VoiceQueueId':_0x42b940['id'],'UserId':_0x4be566},'transaction':_0x1613d5});});return Promise['all'](_0x34bd96);});});return Promise[_0xd58a('0x79')](_0xe33c76);});});return Promise['all'](_0x439c5d)['then'](function(){return _0x222140[_0xd58a('0x7a')](_0x47ac10[_0xd58a('0x31')][_0xd58a('0x5d')],{'transaction':_0x1613d5});});});}})['then'](respondWithStatusCode(_0x5cfcba,null))[_0xd58a('0x44')](handleError(_0x5cfcba,null));};exports[_0xd58a('0x7f')]=function(_0x163735,_0x10ef00,_0x5c70a1){var _0x1001e6={};var _0x525eac={};var _0x4594d8;var _0x49f1e2;return db[_0xd58a('0x2b')][_0xd58a('0x5b')]({'where':{'id':_0x163735[_0xd58a('0x50')]['id']}})[_0xd58a('0x23')](handleEntityNotFound(_0x10ef00,null))['then'](function(_0x17af67){if(_0x17af67){_0x4594d8=_0x17af67;_0x525eac[_0xd58a('0x2e')]=_['keys'](db[_0xd58a('0x6c')][_0xd58a('0x58')]);_0x525eac[_0xd58a('0x31')]=_['keys'](_0x163735[_0xd58a('0x31')]);_0x525eac[_0xd58a('0x32')]=_[_0xd58a('0x33')](_0x525eac[_0xd58a('0x2e')],_0x525eac[_0xd58a('0x31')]);_0x1001e6[_0xd58a('0x34')]=_[_0xd58a('0x33')](_0x525eac['model'],qs[_0xd58a('0x35')](_0x163735[_0xd58a('0x31')]['fields']));_0x1001e6[_0xd58a('0x34')]=_0x1001e6[_0xd58a('0x34')]['length']?_0x1001e6[_0xd58a('0x34')]:_0x525eac['model'];_0x1001e6[_0xd58a('0x39')]=qs[_0xd58a('0x3a')](_0x163735['query']['sort']);_0x1001e6[_0xd58a('0x3b')]=qs[_0xd58a('0x32')](_[_0xd58a('0x3c')](_0x163735[_0xd58a('0x31')],_0x525eac['filters']));if(_0x163735[_0xd58a('0x31')]['filter']){_0x1001e6[_0xd58a('0x3b')]=_[_0xd58a('0x3f')](_0x1001e6['where'],{'$or':_[_0xd58a('0x2f')](_0x1001e6[_0xd58a('0x34')],function(_0x200f54){var _0x53b312={};_0x53b312[_0x200f54]={'$like':'%'+_0x163735[_0xd58a('0x31')][_0xd58a('0x3d')]+'%'};return _0x53b312;})});}_0x1001e6=_[_0xd58a('0x3f')]({},_0x1001e6,_0x163735['options']);return _0x4594d8[_0xd58a('0x7f')](_0x1001e6);}})['then'](function(_0xba32de){if(_0xba32de){_0x49f1e2=_0xba32de[_0xd58a('0x36')];if(!_0x163735['query'][_0xd58a('0x37')](_0xd58a('0x38'))){_0x1001e6[_0xd58a('0x1d')]=qs['limit'](_0x163735[_0xd58a('0x31')][_0xd58a('0x1d')]);_0x1001e6[_0xd58a('0x1c')]=qs[_0xd58a('0x1c')](_0x163735[_0xd58a('0x31')]['offset']);}return _0x4594d8[_0xd58a('0x7f')](_0x1001e6);}})[_0xd58a('0x23')](function(_0x41d2e0){if(_0x41d2e0){return _0x41d2e0?{'count':_0x49f1e2,'rows':_0x41d2e0}:null;}})[_0xd58a('0x23')](respondWithResult(_0x10ef00,null))[_0xd58a('0x44')](handleError(_0x10ef00,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 6c1d17a..8a5389d 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 _0x3bad=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x4884a7,_0x18e38a){var _0x56b60e=function(_0x2ba8a3){while(--_0x2ba8a3){_0x4884a7['push'](_0x4884a7['shift']());}};_0x56b60e(++_0x18e38a);}(_0x3bad,0xaf));var _0xd3ba=function(_0x3203f3,_0x1ce266){_0x3203f3=_0x3203f3-0x0;var _0x22edb5=_0x3bad[_0x3203f3];return _0x22edb5;};'use strict';var EventEmitter=require('events');var Team=require(_0xd3ba('0x0'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xd3ba('0x1')](0x0);var events={'afterCreate':_0xd3ba('0x2'),'afterUpdate':_0xd3ba('0x3'),'afterDestroy':_0xd3ba('0x4')};function emitEvent(_0x5db371){return function(_0x4ccfdd,_0x339689,_0x9c1ac0){TeamEvents[_0xd3ba('0x5')](_0x5db371+':'+_0x4ccfdd['id'],_0x4ccfdd);TeamEvents[_0xd3ba('0x5')](_0x5db371,_0x4ccfdd);_0x9c1ac0(null);};}for(var e in events){if(events[_0xd3ba('0x6')](e)){var event=events[e];Team[_0xd3ba('0x7')](e,emitEvent(event));}}module[_0xd3ba('0x8')]=TeamEvents; \ No newline at end of file +var _0x33f2=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners','save'];(function(_0x232b89,_0x4fa90c){var _0x1a7a79=function(_0x2fdd43){while(--_0x2fdd43){_0x232b89['push'](_0x232b89['shift']());}};_0x1a7a79(++_0x4fa90c);}(_0x33f2,0x1bd));var _0x233f=function(_0x58ee19,_0xdf0765){_0x58ee19=_0x58ee19-0x0;var _0x49af25=_0x33f2[_0x58ee19];return _0x49af25;};'use strict';var EventEmitter=require(_0x233f('0x0'));var Team=require(_0x233f('0x1'))['db'][_0x233f('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x233f('0x3')](0x0);var events={'afterCreate':_0x233f('0x4'),'afterUpdate':'update','afterDestroy':_0x233f('0x5')};function emitEvent(_0x5ba325){return function(_0x217705,_0x14af5b,_0x2b81fd){TeamEvents['emit'](_0x5ba325+':'+_0x217705['id'],_0x217705);TeamEvents[_0x233f('0x6')](_0x5ba325,_0x217705);_0x2b81fd(null);};}for(var e in events){if(events[_0x233f('0x7')](e)){var event=events[e];Team[_0x233f('0x8')](e,emitEvent(event));}}module[_0x233f('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 8d5fe29..ed42e90 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 _0x9730=['request-promise','path','../../config/environment','exports','define','teams','util','../../config/logger','api','moment','bluebird'];(function(_0x17fd23,_0x1ee6eb){var _0x2857c6=function(_0x353f34){while(--_0x353f34){_0x17fd23['push'](_0x17fd23['shift']());}};_0x2857c6(++_0x1ee6eb);}(_0x9730,0xa0));var _0x0973=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9730[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x0973('0x0'));var logger=require(_0x0973('0x1'))(_0x0973('0x2'));var moment=require(_0x0973('0x3'));var BPromise=require(_0x0973('0x4'));var rp=require(_0x0973('0x5'));var fs=require('fs');var path=require(_0x0973('0x6'));var rimraf=require('rimraf');var config=require(_0x0973('0x7'));var attributes=require('./team.attributes');module[_0x0973('0x8')]=function(_0x443549,_0x1a8a90){return _0x443549[_0x0973('0x9')]('Team',attributes,{'tableName':_0x0973('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x690c=['./team.attributes','exports','define','Team','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x690c,0xba));var _0xc690=function(_0x35b47c,_0x4669a6){_0x35b47c=_0x35b47c-0x0;var _0x128d77=_0x690c[_0x35b47c];return _0x128d77;};'use strict';var _=require(_0xc690('0x0'));var util=require(_0xc690('0x1'));var logger=require(_0xc690('0x2'))(_0xc690('0x3'));var moment=require(_0xc690('0x4'));var BPromise=require(_0xc690('0x5'));var rp=require(_0xc690('0x6'));var fs=require('fs');var path=require(_0xc690('0x7'));var rimraf=require(_0xc690('0x8'));var config=require('../../config/environment');var attributes=require(_0xc690('0x9'));module[_0xc690('0xa')]=function(_0x53a8be,_0x28a479){return _0x53a8be[_0xc690('0xb')](_0xc690('0xc'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index dfa2233..3bf64a8 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 _0x4b11=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x586319,_0xf3ac9a){var _0x2127d2=function(_0x543805){while(--_0x543805){_0x586319['push'](_0x586319['shift']());}};_0x2127d2(++_0xf3ac9a);}(_0x4b11,0x107));var _0x14b1=function(_0x434f28,_0x1f3a2a){_0x434f28=_0x434f28-0x0;var _0x4a8c7b=_0x4b11[_0x434f28];return _0x4a8c7b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x14b1('0x0'));var BPromise=require(_0x14b1('0x1'));var rs=require(_0x14b1('0x2'));var fs=require('fs');var Redis=require(_0x14b1('0x3'));var db=require(_0x14b1('0x4'))['db'];var utils=require(_0x14b1('0x5'));var logger=require(_0x14b1('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x14b1('0x7'));var client=jayson[_0x14b1('0x8')][_0x14b1('0x9')]({'port':0x232a});config[_0x14b1('0xa')]=_[_0x14b1('0xb')](config['redis'],{'host':_0x14b1('0xc'),'port':0x18eb});var socket=require(_0x14b1('0xd'))(new Redis(config[_0x14b1('0xa')]));require(_0x14b1('0xe'))['register'](socket);function respondWithRpcPromise(_0x42577e,_0x1adaea,_0x5d72c8){return new BPromise(function(_0x5ae187,_0x2fdd13){return client[_0x14b1('0xf')](_0x42577e,_0x5d72c8)[_0x14b1('0x10')](function(_0x21efda){logger['info'](_0x14b1('0x11'),_0x1adaea,_0x14b1('0x12'));logger[_0x14b1('0x13')](_0x14b1('0x14'),_0x1adaea,'request\x20sent',JSON[_0x14b1('0x15')](_0x21efda));if(_0x21efda['error']){if(_0x21efda[_0x14b1('0x16')][_0x14b1('0x17')]===0x1f4){logger['error'](_0x14b1('0x11'),_0x1adaea,_0x21efda[_0x14b1('0x16')][_0x14b1('0x18')]);return _0x2fdd13(_0x21efda[_0x14b1('0x16')][_0x14b1('0x18')]);}logger['error'](_0x14b1('0x11'),_0x1adaea,_0x21efda['error'][_0x14b1('0x18')]);return _0x5ae187(_0x21efda[_0x14b1('0x16')][_0x14b1('0x18')]);}else{logger['info'](_0x14b1('0x11'),_0x1adaea,_0x14b1('0x12'));_0x5ae187(_0x21efda[_0x14b1('0x19')]['message']);}})[_0x14b1('0x1a')](function(_0x58405b){logger[_0x14b1('0x16')]('Team,\x20%s,\x20%s',_0x1adaea,_0x58405b);_0x2fdd13(_0x58405b);});});} \ No newline at end of file +var _0xe434=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Team,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xe434,0xf7));var _0x4e43=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xe434[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x4e43('0x0'));var util=require(_0x4e43('0x1'));var moment=require(_0x4e43('0x2'));var BPromise=require(_0x4e43('0x3'));var rs=require(_0x4e43('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4e43('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e43('0x6'))('rpc');var config=require(_0x4e43('0x7'));var jayson=require(_0x4e43('0x8'));var client=jayson[_0x4e43('0x9')][_0x4e43('0xa')]({'port':0x232a});config[_0x4e43('0xb')]=_[_0x4e43('0xc')](config[_0x4e43('0xb')],{'host':_0x4e43('0xd'),'port':0x18eb});var socket=require(_0x4e43('0xe'))(new Redis(config[_0x4e43('0xb')]));require(_0x4e43('0xf'))[_0x4e43('0x10')](socket);function respondWithRpcPromise(_0x359af8,_0x439393,_0x3fc477){return new BPromise(function(_0xd0288c,_0x3ac751){return client['request'](_0x359af8,_0x3fc477)['then'](function(_0x2fb672){logger['info']('Team,\x20%s,\x20%s',_0x439393,'request\x20sent');logger[_0x4e43('0x11')](_0x4e43('0x12'),_0x439393,_0x4e43('0x13'),JSON[_0x4e43('0x14')](_0x2fb672));if(_0x2fb672['error']){if(_0x2fb672[_0x4e43('0x15')][_0x4e43('0x16')]===0x1f4){logger['error'](_0x4e43('0x17'),_0x439393,_0x2fb672[_0x4e43('0x15')][_0x4e43('0x18')]);return _0x3ac751(_0x2fb672[_0x4e43('0x15')][_0x4e43('0x18')]);}logger[_0x4e43('0x15')](_0x4e43('0x17'),_0x439393,_0x2fb672['error'][_0x4e43('0x18')]);return _0xd0288c(_0x2fb672['error'][_0x4e43('0x18')]);}else{logger[_0x4e43('0x19')](_0x4e43('0x17'),_0x439393,_0x4e43('0x13'));_0xd0288c(_0x2fb672[_0x4e43('0x1a')][_0x4e43('0x18')]);}})[_0x4e43('0x1b')](function(_0x20bdd6){logger[_0x4e43('0x15')]('Team,\x20%s,\x20%s',_0x439393,_0x20bdd6);_0x3ac751(_0x20bdd6);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 9b8cd75..d3caee4 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 _0x6365=['remove','update','emit','register','./team.events','save'];(function(_0x4937b2,_0x2599cf){var _0x8da2fb=function(_0x1c875f){while(--_0x1c875f){_0x4937b2['push'](_0x4937b2['shift']());}};_0x8da2fb(++_0x2599cf);}(_0x6365,0x148));var _0x5636=function(_0x575d14,_0x53b2d6){_0x575d14=_0x575d14-0x0;var _0x39291f=_0x6365[_0x575d14];return _0x39291f;};'use strict';var TeamEvents=require(_0x5636('0x0'));var events=[_0x5636('0x1'),_0x5636('0x2'),_0x5636('0x3')];function createListener(_0x596313,_0x2bda2f){return function(_0x1560c9){_0x2bda2f[_0x5636('0x4')](_0x596313,_0x1560c9);};}function removeListener(_0x27e6da,_0x34ca1e){return function(){TeamEvents['removeListener'](_0x27e6da,_0x34ca1e);};}exports[_0x5636('0x5')]=function(_0x230d78){for(var _0x2a12df=0x0,_0x3575b7=events['length'];_0x2a12df<_0x3575b7;_0x2a12df++){var _0x17439f=events[_0x2a12df];var _0x10769f=createListener('team:'+_0x17439f,_0x230d78);TeamEvents['on'](_0x17439f,_0x10769f);}}; \ No newline at end of file +var _0x1122=['update','register','length','team:','./team.events','remove'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1122,0xac));var _0x2112=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1122[_0x3dd15e];return _0x231fd0;};'use strict';var TeamEvents=require(_0x2112('0x0'));var events=['save',_0x2112('0x1'),_0x2112('0x2')];function createListener(_0x184b3,_0x23225b){return function(_0x4782d2){_0x23225b['emit'](_0x184b3,_0x4782d2);};}function removeListener(_0x5e16d6,_0x20d49a){return function(){TeamEvents['removeListener'](_0x5e16d6,_0x20d49a);};}exports[_0x2112('0x3')]=function(_0x224776){for(var _0x4c7ac4=0x0,_0xcca285=events[_0x2112('0x4')];_0x4c7ac4<_0xcca285;_0x4c7ac4++){var _0x3f0a81=events[_0x4c7ac4];var _0x272bdb=createListener(_0x2112('0x5')+_0x3f0a81,_0x224776);TeamEvents['on'](_0x3f0a81,_0x272bdb);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 84e58f1..d0f495a 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 _0x99cd=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x49b733,_0x3c1e57){var _0x38a351=function(_0x41bc9f){while(--_0x41bc9f){_0x49b733['push'](_0x49b733['shift']());}};_0x38a351(++_0x3c1e57);}(_0x99cd,0x1df));var _0xd99c=function(_0x5328c8,_0x2152f0){_0x5328c8=_0x5328c8-0x0;var _0x51e75e=_0x99cd[_0x5328c8];return _0x51e75e;};'use strict';var multer=require(_0xd99c('0x0'));var util=require('util');var path=require(_0xd99c('0x1'));var timeout=require(_0xd99c('0x2'));var express=require(_0xd99c('0x3'));var router=express[_0xd99c('0x4')]();var fs_extra=require(_0xd99c('0x5'));var auth=require(_0xd99c('0x6'));var interaction=require(_0xd99c('0x7'));var config=require(_0xd99c('0x8'));module[_0xd99c('0x9')]=router; \ No newline at end of file +var _0xa1aa=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','util','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa1aa,0x19b));var _0xaa1a=function(_0x275002,_0x1b4b68){_0x275002=_0x275002-0x0;var _0xb639e9=_0xa1aa[_0x275002];return _0xb639e9;};'use strict';var multer=require('multer');var util=require(_0xaa1a('0x0'));var path=require(_0xaa1a('0x1'));var timeout=require(_0xaa1a('0x2'));var express=require(_0xaa1a('0x3'));var router=express[_0xaa1a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaa1a('0x5'));var config=require(_0xaa1a('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 3aa61ac..15c6131 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 _0xbaf0=['exports','INTEGER'];(function(_0xdaf736,_0xd8c667){var _0x1090b3=function(_0x2eab2e){while(--_0x2eab2e){_0xdaf736['push'](_0xdaf736['shift']());}};_0x1090b3(++_0xd8c667);}(_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 _0xb10b=['sequelize','INTEGER'];(function(_0x3d9222,_0x11d9b5){var _0x3081e3=function(_0x2079d7){while(--_0x2079d7){_0x3d9222['push'](_0x3d9222['shift']());}};_0x3081e3(++_0x11d9b5);}(_0xb10b,0x12a));var _0xbb10=function(_0x25eb68,_0x2b9197){_0x25eb68=_0x25eb68-0x0;var _0x359151=_0xb10b[_0x25eb68];return _0x359151;};'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/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 48229fc..aa5f08d 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 _0xf909=['define','TeamVoiceQueue','team_has_voice_queues','lodash','util','api','moment','bluebird','path','rimraf','./teamVoiceQueue.attributes'];(function(_0x53946c,_0x5421bb){var _0x5c7b09=function(_0x24fbd4){while(--_0x24fbd4){_0x53946c['push'](_0x53946c['shift']());}};_0x5c7b09(++_0x5421bb);}(_0xf909,0x100));var _0x9f90=function(_0x2f71ca,_0x352644){_0x2f71ca=_0x2f71ca-0x0;var _0x51caba=_0xf909[_0x2f71ca];return _0x51caba;};'use strict';var _=require(_0x9f90('0x0'));var util=require(_0x9f90('0x1'));var logger=require('../../config/logger')(_0x9f90('0x2'));var moment=require(_0x9f90('0x3'));var BPromise=require(_0x9f90('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f90('0x5'));var rimraf=require(_0x9f90('0x6'));var config=require('../../config/environment');var attributes=require(_0x9f90('0x7'));module['exports']=function(_0x226dd6,_0x12a159){return _0x226dd6[_0x9f90('0x8')](_0x9f90('0x9'),attributes,{'tableName':_0x9f90('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa812=['path','rimraf','../../config/environment','define','team_has_voice_queues','lodash','util','api','moment','bluebird','request-promise'];(function(_0x17645e,_0xf90c5){var _0x2ea936=function(_0x306a96){while(--_0x306a96){_0x17645e['push'](_0x17645e['shift']());}};_0x2ea936(++_0xf90c5);}(_0xa812,0x144));var _0x2a81=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xa812[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x2a81('0x0'));var util=require(_0x2a81('0x1'));var logger=require('../../config/logger')(_0x2a81('0x2'));var moment=require(_0x2a81('0x3'));var BPromise=require(_0x2a81('0x4'));var rp=require(_0x2a81('0x5'));var fs=require('fs');var path=require(_0x2a81('0x6'));var rimraf=require(_0x2a81('0x7'));var config=require(_0x2a81('0x8'));var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0x56783a,_0x4088cb){return _0x56783a[_0x2a81('0x9')]('TeamVoiceQueue',attributes,{'tableName':_0x2a81('0xa'),'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 24f5618..9c82222 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 _0xb953=['catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x487a0b,_0x33c302){var _0x4cb1ba=function(_0x2a3615){while(--_0x2a3615){_0x487a0b['push'](_0x487a0b['shift']());}};_0x4cb1ba(++_0x33c302);}(_0xb953,0xa9));var _0x3b95=function(_0xc42b35,_0x4f749c){_0xc42b35=_0xc42b35-0x0;var _0xe89d1f=_0xb953[_0xc42b35];return _0xe89d1f;};'use strict';var _=require('lodash');var util=require(_0x3b95('0x0'));var moment=require('moment');var BPromise=require(_0x3b95('0x1'));var rs=require(_0x3b95('0x2'));var fs=require('fs');var Redis=require(_0x3b95('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b95('0x4'));var logger=require(_0x3b95('0x5'))('rpc');var config=require(_0x3b95('0x6'));var jayson=require(_0x3b95('0x7'));var client=jayson[_0x3b95('0x8')][_0x3b95('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2931a2,_0x568df6,_0x63090a){return new BPromise(function(_0x30c0c9,_0x189c6a){return client[_0x3b95('0xa')](_0x2931a2,_0x63090a)[_0x3b95('0xb')](function(_0x3eca9b){logger[_0x3b95('0xc')](_0x3b95('0xd'),_0x568df6,_0x3b95('0xe'));logger[_0x3b95('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x568df6,_0x3b95('0xe'),JSON['stringify'](_0x3eca9b));if(_0x3eca9b[_0x3b95('0x10')]){if(_0x3eca9b[_0x3b95('0x10')][_0x3b95('0x11')]===0x1f4){logger['error'](_0x3b95('0xd'),_0x568df6,_0x3eca9b[_0x3b95('0x10')][_0x3b95('0x12')]);return _0x189c6a(_0x3eca9b[_0x3b95('0x10')]['message']);}logger[_0x3b95('0x10')](_0x3b95('0xd'),_0x568df6,_0x3eca9b[_0x3b95('0x10')]['message']);return _0x30c0c9(_0x3eca9b[_0x3b95('0x10')][_0x3b95('0x12')]);}else{logger[_0x3b95('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x568df6,_0x3b95('0xe'));_0x30c0c9(_0x3eca9b[_0x3b95('0x13')]['message']);}})[_0x3b95('0x14')](function(_0x328906){logger[_0x3b95('0x10')](_0x3b95('0xd'),_0x568df6,_0x328906);_0x189c6a(_0x328906);});});} \ No newline at end of file +var _0x0358=['http','info','request\x20sent','stringify','error','TeamVoiceQueue,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x316e95,_0x32a3f8){var _0x48aa0b=function(_0x68653b){while(--_0x68653b){_0x316e95['push'](_0x316e95['shift']());}};_0x48aa0b(++_0x32a3f8);}(_0x0358,0x1e4));var _0x8035=function(_0x190677,_0x2c77b7){_0x190677=_0x190677-0x0;var _0x171a86=_0x0358[_0x190677];return _0x171a86;};'use strict';var _=require(_0x8035('0x0'));var util=require(_0x8035('0x1'));var moment=require(_0x8035('0x2'));var BPromise=require('bluebird');var rs=require(_0x8035('0x3'));var fs=require('fs');var Redis=require(_0x8035('0x4'));var db=require(_0x8035('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8035('0x6'))(_0x8035('0x7'));var config=require(_0x8035('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8035('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x116b5f,_0x30cfcd,_0x574997){return new BPromise(function(_0x5658c5,_0x25494e){return client['request'](_0x116b5f,_0x574997)['then'](function(_0x354b53){logger[_0x8035('0xa')]('TeamVoiceQueue,\x20%s,\x20%s',_0x30cfcd,_0x8035('0xb'));logger['debug']('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x30cfcd,_0x8035('0xb'),JSON[_0x8035('0xc')](_0x354b53));if(_0x354b53[_0x8035('0xd')]){if(_0x354b53[_0x8035('0xd')]['code']===0x1f4){logger[_0x8035('0xd')](_0x8035('0xe'),_0x30cfcd,_0x354b53['error'][_0x8035('0xf')]);return _0x25494e(_0x354b53['error']['message']);}logger[_0x8035('0xd')](_0x8035('0xe'),_0x30cfcd,_0x354b53[_0x8035('0xd')][_0x8035('0xf')]);return _0x5658c5(_0x354b53[_0x8035('0xd')][_0x8035('0xf')]);}else{logger[_0x8035('0xa')](_0x8035('0xe'),_0x30cfcd,_0x8035('0xb'));_0x5658c5(_0x354b53[_0x8035('0x10')][_0x8035('0xf')]);}})['catch'](function(_0x1f37d3){logger[_0x8035('0xd')](_0x8035('0xe'),_0x30cfcd,_0x1f37d3);_0x25494e(_0x1f37d3);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index fa4c76e..aeb8eef 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 _0x7dfd=['isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get'];(function(_0x2e9ca1,_0x575d62){var _0x2d2ba4=function(_0x449815){while(--_0x449815){_0x2e9ca1['push'](_0x2e9ca1['shift']());}};_0x2d2ba4(++_0x575d62);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var path=require(_0xd7df('0x2'));var timeout=require(_0xd7df('0x3'));var express=require(_0xd7df('0x4'));var router=express[_0xd7df('0x5')]();var fs_extra=require(_0xd7df('0x6'));var auth=require(_0xd7df('0x7'));var interaction=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var controller=require(_0xd7df('0xa'));router[_0xd7df('0xb')]('/',auth[_0xd7df('0xc')](),controller[_0xd7df('0xd')]);router[_0xd7df('0xb')](_0xd7df('0xe'),auth[_0xd7df('0xc')](),controller['show']);router[_0xd7df('0xf')]('/',auth[_0xd7df('0xc')](),controller[_0xd7df('0x10')]);router[_0xd7df('0x11')]('/:id',auth[_0xd7df('0xc')](),controller['update']);router[_0xd7df('0x12')]('/:id',auth[_0xd7df('0xc')](),controller[_0xd7df('0x13')]);module[_0xd7df('0x14')]=router; \ No newline at end of file +var _0xa630=['delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','show','post','put','update'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xa630,0xbe));var _0x0a63=function(_0x109187,_0x18af71){_0x109187=_0x109187-0x0;var _0x46eded=_0xa630[_0x109187];return _0x46eded;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var fs_extra=require(_0x0a63('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var controller=require(_0x0a63('0x6'));router[_0x0a63('0x7')]('/',auth[_0x0a63('0x8')](),controller['index']);router[_0x0a63('0x7')](_0x0a63('0x9'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xa')]);router[_0x0a63('0xb')]('/',auth[_0x0a63('0x8')](),controller['create']);router[_0x0a63('0xc')](_0x0a63('0x9'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xd')]);router[_0x0a63('0xe')](_0x0a63('0x9'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xf')]);module[_0x0a63('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index a000785..1d023d2 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 _0x7be9=['TEXT','sequelize','exports','STRING'];(function(_0x24ce1b,_0x885966){var _0x106cd6=function(_0x5a295a){while(--_0x5a295a){_0x24ce1b['push'](_0x24ce1b['shift']());}};_0x106cd6(++_0x885966);}(_0x7be9,0x1ed));var _0x97be=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x7be9[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require(_0x97be('0x0'));module[_0x97be('0x1')]={'name':{'type':Sequelize[_0x97be('0x2')]},'description':{'type':Sequelize[_0x97be('0x2')]},'html':{'type':Sequelize[_0x97be('0x3')]}}; \ No newline at end of file +var _0xeb6c=['exports','STRING','TEXT','sequelize'];(function(_0x5aa288,_0x3c0b39){var _0x1a1cdc=function(_0x21428b){while(--_0x21428b){_0x5aa288['push'](_0x5aa288['shift']());}};_0x1a1cdc(++_0x3c0b39);}(_0xeb6c,0x1a7));var _0xceb6=function(_0x3d7ef2,_0x5d4ec1){_0x3d7ef2=_0x3d7ef2-0x0;var _0x58824e=_0xeb6c[_0x3d7ef2];return _0x58824e;};'use strict';var Sequelize=require(_0xceb6('0x0'));module[_0xceb6('0x1')]={'name':{'type':Sequelize[_0xceb6('0x2')]},'description':{'type':Sequelize[_0xceb6('0x2')]},'html':{'type':Sequelize[_0xceb6('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index bacd6d8..ef28ff8 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 _0xd52a=['Content-Range','apply','reject','update','then','destroy','get','Templates','UserProfileResource','error','name','send','map','Template','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','count','includeAll','findAll','catch','show','params','rawAttributes','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','limit','set'];(function(_0x101a43,_0x13d92d){var _0x34f875=function(_0x4d85ba){while(--_0x4d85ba){_0x101a43['push'](_0x101a43['shift']());}};_0x34f875(++_0x13d92d);}(_0xd52a,0xca));var _0xad52=function(_0x3e6f58,_0x4d1d23){_0x3e6f58=_0x3e6f58-0x0;var _0x43807f=_0xd52a[_0x3e6f58];return _0x43807f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xad52('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xad52('0x1'));var rp=require(_0xad52('0x2'));var moment=require(_0xad52('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xad52('0x4'));var util=require(_0xad52('0x5'));var path=require(_0xad52('0x6'));var sox=require(_0xad52('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xad52('0x8'));var squel=require('squel');var crypto=require(_0xad52('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xad52('0xa'));var toCsv=require(_0xad52('0xb'));var querystring=require('querystring');var Papa=require(_0xad52('0xc'));var Redis=require('ioredis');var authService=require(_0xad52('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xad52('0xe'));var hardwareService=require(_0xad52('0xf'));var logger=require(_0xad52('0x10'))(_0xad52('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xad52('0x12'))['db'];function respondWithStatusCode(_0x79b1e7,_0x378b0c){_0x378b0c=_0x378b0c||0xcc;return function(_0x41331e){if(_0x41331e){return _0x79b1e7[_0xad52('0x13')](_0x378b0c);}return _0x79b1e7[_0xad52('0x14')](_0x378b0c)[_0xad52('0x15')]();};}function respondWithResult(_0xd04cde,_0x3d2df6){_0x3d2df6=_0x3d2df6||0xc8;return function(_0x5727a2){if(_0x5727a2){return _0xd04cde[_0xad52('0x14')](_0x3d2df6)[_0xad52('0x16')](_0x5727a2);}};}function respondWithFilteredResult(_0x3bc8f6,_0x42eb20){return function(_0x38be7e){if(_0x38be7e){var _0xcb6cd5=_0x38be7e['count'],_0x2bbaad=_0x42eb20['offset'],_0x3aed76=_0x42eb20[_0xad52('0x17')]+_0x42eb20[_0xad52('0x18')],_0x450099;if(_0x3aed76>=_0xcb6cd5){_0x3aed76=_0xcb6cd5;_0x450099=0xc8;}else{_0x450099=0xce;}_0x3bc8f6[_0xad52('0x14')](_0x450099);return _0x3bc8f6[_0xad52('0x19')](_0xad52('0x1a'),_0x2bbaad+'-'+_0x3aed76+'/'+_0xcb6cd5)['json'](_0x38be7e);}return null;};}function patchUpdates(_0x5696a4){return function(_0x5a71c4){try{jsonpatch[_0xad52('0x1b')](_0x5a71c4,_0x5696a4,!![]);}catch(_0xd4bb69){return BPromise[_0xad52('0x1c')](_0xd4bb69);}return _0x5a71c4['save']();};}function saveUpdates(_0x24fb52,_0x593dfd){return function(_0x1bc745){if(_0x1bc745){return _0x1bc745[_0xad52('0x1d')](_0x24fb52)[_0xad52('0x1e')](function(_0x23cfee){return _0x23cfee;});}return null;};}function removeEntity(_0x2c182f,_0x2f1526){return function(_0x4b5f2f){if(_0x4b5f2f){return _0x4b5f2f[_0xad52('0x1f')]()['then'](function(){var _0x1aac2e=_0x4b5f2f[_0xad52('0x20')]({'plain':!![]});var _0x2fa90c=_0xad52('0x21');return db[_0xad52('0x22')]['destroy']({'where':{'type':_0x2fa90c,'resourceId':_0x1aac2e['id']}})['then'](function(){return _0x4b5f2f;});})[_0xad52('0x1e')](function(){_0x2c182f['status'](0xcc)[_0xad52('0x15')]();});}};}function handleEntityNotFound(_0x3a54a1,_0x537df0){return function(_0x58adf5){if(!_0x58adf5){_0x3a54a1[_0xad52('0x13')](0x194);}return _0x58adf5;};}function handleError(_0x31b5e0,_0x42db69){_0x42db69=_0x42db69||0x1f4;return function(_0x50431e){logger[_0xad52('0x23')](_0x50431e['stack']);if(_0x50431e[_0xad52('0x24')]){delete _0x50431e[_0xad52('0x24')];}_0x31b5e0[_0xad52('0x14')](_0x42db69)[_0xad52('0x25')](_0x50431e);};}exports['index']=function(_0x426106,_0x2a604c){var _0x534cc5={},_0x3f5757={},_0x3a0fd6={'count':0x0,'rows':[]};var _0x41d11b=_[_0xad52('0x26')](db[_0xad52('0x27')]['rawAttributes'],function(_0x5ccd33){return{'name':_0x5ccd33['fieldName'],'type':_0x5ccd33[_0xad52('0x28')][_0xad52('0x29')]};});_0x3f5757[_0xad52('0x2a')]=_['map'](_0x41d11b,'name');_0x3f5757[_0xad52('0x2b')]=_[_0xad52('0x2c')](_0x426106[_0xad52('0x2b')]);_0x3f5757[_0xad52('0x2d')]=_[_0xad52('0x2e')](_0x3f5757[_0xad52('0x2a')],_0x3f5757['query']);_0x534cc5[_0xad52('0x2f')]=_[_0xad52('0x2e')](_0x3f5757[_0xad52('0x2a')],qs[_0xad52('0x30')](_0x426106[_0xad52('0x2b')][_0xad52('0x30')]));_0x534cc5[_0xad52('0x2f')]=_0x534cc5[_0xad52('0x2f')][_0xad52('0x31')]?_0x534cc5[_0xad52('0x2f')]:_0x3f5757[_0xad52('0x2a')];if(!_0x426106['query'][_0xad52('0x32')](_0xad52('0x33'))){_0x534cc5[_0xad52('0x18')]=qs[_0xad52('0x18')](_0x426106[_0xad52('0x2b')][_0xad52('0x18')]);_0x534cc5['offset']=qs[_0xad52('0x17')](_0x426106[_0xad52('0x2b')][_0xad52('0x17')]);}_0x534cc5['order']=qs[_0xad52('0x34')](_0x426106[_0xad52('0x2b')][_0xad52('0x34')]);_0x534cc5['where']=qs[_0xad52('0x2d')](_[_0xad52('0x35')](_0x426106[_0xad52('0x2b')],_0x3f5757['filters']),_0x41d11b);if(_0x426106[_0xad52('0x2b')][_0xad52('0x36')]){_0x534cc5[_0xad52('0x37')]=_[_0xad52('0x38')](_0x534cc5[_0xad52('0x37')],{'$or':_[_0xad52('0x26')](_0x41d11b,function(_0x51b311){if(_0x51b311[_0xad52('0x28')]!=='VIRTUAL'){var _0x30362e={};_0x30362e[_0x51b311[_0xad52('0x24')]]={'$like':'%'+_0x426106[_0xad52('0x2b')][_0xad52('0x36')]+'%'};return _0x30362e;}})});}_0x534cc5=_[_0xad52('0x38')]({},_0x534cc5,_0x426106['options']);var _0x12c7d8={'where':_0x534cc5[_0xad52('0x37')]};return db[_0xad52('0x27')]['count'](_0x12c7d8)[_0xad52('0x1e')](function(_0x10b4d4){_0x3a0fd6[_0xad52('0x39')]=_0x10b4d4;if(_0x426106['query'][_0xad52('0x3a')]){_0x534cc5['include']=[{'all':!![]}];}return db[_0xad52('0x27')][_0xad52('0x3b')](_0x534cc5);})[_0xad52('0x1e')](function(_0xa1c4a9){_0x3a0fd6['rows']=_0xa1c4a9;return _0x3a0fd6;})[_0xad52('0x1e')](respondWithFilteredResult(_0x2a604c,_0x534cc5))[_0xad52('0x3c')](handleError(_0x2a604c,null));};exports[_0xad52('0x3d')]=function(_0x2bd94a,_0x3886ec){var _0x44a56b={'raw':!![],'where':{'id':_0x2bd94a[_0xad52('0x3e')]['id']}},_0x262cb6={};_0x262cb6['model']=_[_0xad52('0x2c')](db['Template'][_0xad52('0x3f')]);_0x262cb6[_0xad52('0x2b')]=_[_0xad52('0x2c')](_0x2bd94a[_0xad52('0x2b')]);_0x262cb6[_0xad52('0x2d')]=_[_0xad52('0x2e')](_0x262cb6[_0xad52('0x2a')],_0x262cb6[_0xad52('0x2b')]);_0x44a56b[_0xad52('0x2f')]=_[_0xad52('0x2e')](_0x262cb6[_0xad52('0x2a')],qs[_0xad52('0x30')](_0x2bd94a[_0xad52('0x2b')][_0xad52('0x30')]));_0x44a56b[_0xad52('0x2f')]=_0x44a56b[_0xad52('0x2f')][_0xad52('0x31')]?_0x44a56b[_0xad52('0x2f')]:_0x262cb6[_0xad52('0x2a')];if(_0x2bd94a[_0xad52('0x2b')]['includeAll']){_0x44a56b[_0xad52('0x40')]=[{'all':!![]}];}_0x44a56b=_[_0xad52('0x38')]({},_0x44a56b,_0x2bd94a[_0xad52('0x41')]);return db['Template'][_0xad52('0x42')](_0x44a56b)['then'](handleEntityNotFound(_0x3886ec,null))[_0xad52('0x1e')](respondWithResult(_0x3886ec,null))['catch'](handleError(_0x3886ec,null));};exports['create']=function(_0x35eaac,_0x1746b0){return db[_0xad52('0x27')][_0xad52('0x43')](_0x35eaac['body'],{})['then'](function(_0x254416){var _0x5dede4=_0x35eaac[_0xad52('0x44')]['get']({'plain':!![]});if(!_0x5dede4)throw new Error(_0xad52('0x45'));if(_0x5dede4[_0xad52('0x46')]===_0xad52('0x44')){var _0x15d989=_0x254416[_0xad52('0x20')]({'plain':!![]});var _0x382b60='Templates';return db[_0xad52('0x47')][_0xad52('0x42')]({'where':{'name':_0x382b60,'userProfileId':_0x5dede4[_0xad52('0x48')]},'raw':!![]})[_0xad52('0x1e')](function(_0x4ab950){if(_0x4ab950&&_0x4ab950[_0xad52('0x49')]===0x0){return db[_0xad52('0x22')][_0xad52('0x43')]({'name':_0x15d989['name'],'resourceId':_0x15d989['id'],'type':_0x4ab950[_0xad52('0x24')],'sectionId':_0x4ab950['id']},{})[_0xad52('0x1e')](function(){return _0x254416;});}else{return _0x254416;}})[_0xad52('0x3c')](function(_0xe9baec){logger['error'](_0xad52('0x4a'),_0xe9baec);throw _0xe9baec;});}return _0x254416;})[_0xad52('0x1e')](respondWithResult(_0x1746b0,0xc9))[_0xad52('0x3c')](handleError(_0x1746b0,null));};exports[_0xad52('0x1d')]=function(_0x197fac,_0x57fe66){if(_0x197fac['body']['id']){delete _0x197fac[_0xad52('0x4b')]['id'];}return db[_0xad52('0x27')][_0xad52('0x42')]({'where':{'id':_0x197fac[_0xad52('0x3e')]['id']}})[_0xad52('0x1e')](handleEntityNotFound(_0x57fe66,null))['then'](saveUpdates(_0x197fac[_0xad52('0x4b')],null))['then'](respondWithResult(_0x57fe66,null))[_0xad52('0x3c')](handleError(_0x57fe66,null));};exports[_0xad52('0x1f')]=function(_0x96bc15,_0x4ae2fe){return db[_0xad52('0x27')]['find']({'where':{'id':_0x96bc15[_0xad52('0x3e')]['id']}})[_0xad52('0x1e')](handleEntityNotFound(_0x4ae2fe,null))[_0xad52('0x1e')](removeEntity(_0x4ae2fe,null))['catch'](handleError(_0x4ae2fe,null));}; \ No newline at end of file +var _0x524a=['moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','get','Templates','error','stack','name','send','map','Template','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x524a,0xf5));var _0xa524=function(_0x4cd857,_0x5c2872){_0x4cd857=_0x4cd857-0x0;var _0x4cd541=_0x524a[_0x4cd857];return _0x4cd541;};'use strict';var emlformat=require(_0xa524('0x0'));var rimraf=require(_0xa524('0x1'));var zipdir=require(_0xa524('0x2'));var jsonpatch=require(_0xa524('0x3'));var rp=require('request-promise');var moment=require(_0xa524('0x4'));var BPromise=require(_0xa524('0x5'));var Mustache=require(_0xa524('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa524('0x7'));var csv=require(_0xa524('0x8'));var ejs=require(_0xa524('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa524('0xa'));var squel=require('squel');var crypto=require(_0xa524('0xb'));var jsforce=require(_0xa524('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa524('0x8'));var querystring=require(_0xa524('0xd'));var Papa=require(_0xa524('0xe'));var Redis=require(_0xa524('0xf'));var authService=require(_0xa524('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa524('0x11'));var hardwareService=require(_0xa524('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xa524('0x13'));var config=require(_0xa524('0x14'));var licenseUtil=require(_0xa524('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55117f,_0x14a0d6){_0x14a0d6=_0x14a0d6||0xcc;return function(_0x4aa46d){if(_0x4aa46d){return _0x55117f[_0xa524('0x16')](_0x14a0d6);}return _0x55117f['status'](_0x14a0d6)[_0xa524('0x17')]();};}function respondWithResult(_0x5c7e6a,_0x75bfe8){_0x75bfe8=_0x75bfe8||0xc8;return function(_0x281137){if(_0x281137){return _0x5c7e6a['status'](_0x75bfe8)[_0xa524('0x18')](_0x281137);}};}function respondWithFilteredResult(_0x15b14c,_0xe85361){return function(_0x1de01e){if(_0x1de01e){var _0x45347f=_0x1de01e[_0xa524('0x19')],_0x433c8a=_0xe85361[_0xa524('0x1a')],_0x371385=_0xe85361[_0xa524('0x1a')]+_0xe85361[_0xa524('0x1b')],_0x4fc42f;if(_0x371385>=_0x45347f){_0x371385=_0x45347f;_0x4fc42f=0xc8;}else{_0x4fc42f=0xce;}_0x15b14c[_0xa524('0x1c')](_0x4fc42f);return _0x15b14c[_0xa524('0x1d')](_0xa524('0x1e'),_0x433c8a+'-'+_0x371385+'/'+_0x45347f)[_0xa524('0x18')](_0x1de01e);}return null;};}function patchUpdates(_0x54b249){return function(_0x304dea){try{jsonpatch[_0xa524('0x1f')](_0x304dea,_0x54b249,!![]);}catch(_0xb31e2d){return BPromise[_0xa524('0x20')](_0xb31e2d);}return _0x304dea['save']();};}function saveUpdates(_0x5510fa,_0x40f4bd){return function(_0xc560dd){if(_0xc560dd){return _0xc560dd[_0xa524('0x21')](_0x5510fa)[_0xa524('0x22')](function(_0x1e6abb){return _0x1e6abb;});}return null;};}function removeEntity(_0x3866e2,_0x4abffe){return function(_0x262eac){if(_0x262eac){return _0x262eac[_0xa524('0x23')]()[_0xa524('0x22')](function(){var _0x40fb4b=_0x262eac[_0xa524('0x24')]({'plain':!![]});var _0x45cdcc=_0xa524('0x25');return db['UserProfileResource'][_0xa524('0x23')]({'where':{'type':_0x45cdcc,'resourceId':_0x40fb4b['id']}})[_0xa524('0x22')](function(){return _0x262eac;});})['then'](function(){_0x3866e2['status'](0xcc)[_0xa524('0x17')]();});}};}function handleEntityNotFound(_0x2ed3b0,_0x156b8b){return function(_0x364b8c){if(!_0x364b8c){_0x2ed3b0[_0xa524('0x16')](0x194);}return _0x364b8c;};}function handleError(_0x546060,_0x4f484a){_0x4f484a=_0x4f484a||0x1f4;return function(_0x1aeabc){logger[_0xa524('0x26')](_0x1aeabc[_0xa524('0x27')]);if(_0x1aeabc[_0xa524('0x28')]){delete _0x1aeabc['name'];}_0x546060[_0xa524('0x1c')](_0x4f484a)[_0xa524('0x29')](_0x1aeabc);};}exports['index']=function(_0x27f53a,_0x147094){var _0x4c587b={},_0x393813={},_0x5f03ad={'count':0x0,'rows':[]};var _0x24005e=_[_0xa524('0x2a')](db[_0xa524('0x2b')][_0xa524('0x2c')],function(_0x136e83){return{'name':_0x136e83[_0xa524('0x2d')],'type':_0x136e83[_0xa524('0x2e')][_0xa524('0x2f')]};});_0x393813[_0xa524('0x30')]=_['map'](_0x24005e,'name');_0x393813[_0xa524('0x31')]=_['keys'](_0x27f53a['query']);_0x393813[_0xa524('0x32')]=_[_0xa524('0x33')](_0x393813[_0xa524('0x30')],_0x393813[_0xa524('0x31')]);_0x4c587b['attributes']=_['intersection'](_0x393813[_0xa524('0x30')],qs['fields'](_0x27f53a['query'][_0xa524('0x34')]));_0x4c587b[_0xa524('0x35')]=_0x4c587b[_0xa524('0x35')][_0xa524('0x36')]?_0x4c587b[_0xa524('0x35')]:_0x393813[_0xa524('0x30')];if(!_0x27f53a[_0xa524('0x31')][_0xa524('0x37')](_0xa524('0x38'))){_0x4c587b[_0xa524('0x1b')]=qs[_0xa524('0x1b')](_0x27f53a[_0xa524('0x31')]['limit']);_0x4c587b['offset']=qs['offset'](_0x27f53a[_0xa524('0x31')][_0xa524('0x1a')]);}_0x4c587b['order']=qs[_0xa524('0x39')](_0x27f53a['query'][_0xa524('0x39')]);_0x4c587b[_0xa524('0x3a')]=qs['filters'](_[_0xa524('0x3b')](_0x27f53a[_0xa524('0x31')],_0x393813[_0xa524('0x32')]),_0x24005e);if(_0x27f53a['query'][_0xa524('0x3c')]){_0x4c587b[_0xa524('0x3a')]=_['merge'](_0x4c587b[_0xa524('0x3a')],{'$or':_[_0xa524('0x2a')](_0x24005e,function(_0x532ff7){if(_0x532ff7[_0xa524('0x2e')]!==_0xa524('0x3d')){var _0x49f275={};_0x49f275[_0x532ff7[_0xa524('0x28')]]={'$like':'%'+_0x27f53a[_0xa524('0x31')][_0xa524('0x3c')]+'%'};return _0x49f275;}})});}_0x4c587b=_[_0xa524('0x3e')]({},_0x4c587b,_0x27f53a[_0xa524('0x3f')]);var _0x38f87a={'where':_0x4c587b[_0xa524('0x3a')]};return db[_0xa524('0x2b')][_0xa524('0x19')](_0x38f87a)[_0xa524('0x22')](function(_0x38e745){_0x5f03ad['count']=_0x38e745;if(_0x27f53a[_0xa524('0x31')]['includeAll']){_0x4c587b[_0xa524('0x40')]=[{'all':!![]}];}return db[_0xa524('0x2b')][_0xa524('0x41')](_0x4c587b);})[_0xa524('0x22')](function(_0x33068e){_0x5f03ad[_0xa524('0x42')]=_0x33068e;return _0x5f03ad;})[_0xa524('0x22')](respondWithFilteredResult(_0x147094,_0x4c587b))[_0xa524('0x43')](handleError(_0x147094,null));};exports[_0xa524('0x44')]=function(_0x2dc240,_0x4a87d4){var _0x43b659={'raw':!![],'where':{'id':_0x2dc240['params']['id']}},_0x2425da={};_0x2425da[_0xa524('0x30')]=_[_0xa524('0x45')](db['Template']['rawAttributes']);_0x2425da['query']=_['keys'](_0x2dc240['query']);_0x2425da[_0xa524('0x32')]=_[_0xa524('0x33')](_0x2425da[_0xa524('0x30')],_0x2425da[_0xa524('0x31')]);_0x43b659['attributes']=_[_0xa524('0x33')](_0x2425da[_0xa524('0x30')],qs[_0xa524('0x34')](_0x2dc240[_0xa524('0x31')]['fields']));_0x43b659[_0xa524('0x35')]=_0x43b659[_0xa524('0x35')][_0xa524('0x36')]?_0x43b659[_0xa524('0x35')]:_0x2425da[_0xa524('0x30')];if(_0x2dc240['query'][_0xa524('0x46')]){_0x43b659[_0xa524('0x40')]=[{'all':!![]}];}_0x43b659=_[_0xa524('0x3e')]({},_0x43b659,_0x2dc240[_0xa524('0x3f')]);return db[_0xa524('0x2b')][_0xa524('0x47')](_0x43b659)[_0xa524('0x22')](handleEntityNotFound(_0x4a87d4,null))[_0xa524('0x22')](respondWithResult(_0x4a87d4,null))[_0xa524('0x43')](handleError(_0x4a87d4,null));};exports['create']=function(_0x4b1207,_0x14ab60){return db[_0xa524('0x2b')][_0xa524('0x48')](_0x4b1207[_0xa524('0x49')],{})[_0xa524('0x22')](function(_0xddc80){var _0x56e570=_0x4b1207[_0xa524('0x4a')][_0xa524('0x24')]({'plain':!![]});if(!_0x56e570)throw new Error(_0xa524('0x4b'));if(_0x56e570[_0xa524('0x4c')]===_0xa524('0x4a')){var _0x451bbe=_0xddc80['get']({'plain':!![]});var _0x39ba9c=_0xa524('0x25');return db[_0xa524('0x4d')][_0xa524('0x47')]({'where':{'name':_0x39ba9c,'userProfileId':_0x56e570[_0xa524('0x4e')]},'raw':!![]})[_0xa524('0x22')](function(_0xef18b7){if(_0xef18b7&&_0xef18b7[_0xa524('0x4f')]===0x0){return db[_0xa524('0x50')][_0xa524('0x48')]({'name':_0x451bbe[_0xa524('0x28')],'resourceId':_0x451bbe['id'],'type':_0xef18b7[_0xa524('0x28')],'sectionId':_0xef18b7['id']},{})[_0xa524('0x22')](function(){return _0xddc80;});}else{return _0xddc80;}})[_0xa524('0x43')](function(_0x25e04b){logger['error'](_0xa524('0x51'),_0x25e04b);throw _0x25e04b;});}return _0xddc80;})[_0xa524('0x22')](respondWithResult(_0x14ab60,0xc9))['catch'](handleError(_0x14ab60,null));};exports['update']=function(_0x32844c,_0x1ecdcc){if(_0x32844c[_0xa524('0x49')]['id']){delete _0x32844c[_0xa524('0x49')]['id'];}return db[_0xa524('0x2b')][_0xa524('0x47')]({'where':{'id':_0x32844c[_0xa524('0x52')]['id']}})['then'](handleEntityNotFound(_0x1ecdcc,null))[_0xa524('0x22')](saveUpdates(_0x32844c[_0xa524('0x49')],null))[_0xa524('0x22')](respondWithResult(_0x1ecdcc,null))[_0xa524('0x43')](handleError(_0x1ecdcc,null));};exports[_0xa524('0x23')]=function(_0x481e0d,_0x1c017d){return db['Template'][_0xa524('0x47')]({'where':{'id':_0x481e0d[_0xa524('0x52')]['id']}})[_0xa524('0x22')](handleEntityNotFound(_0x1c017d,null))[_0xa524('0x22')](removeEntity(_0x1c017d,null))[_0xa524('0x43')](handleError(_0x1c017d,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index aefb0fa..039783e 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 _0x7cee=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./template.attributes','exports','Template','tools_templates'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x7cee,0x6c));var _0xe7ce=function(_0x35d59c,_0x341ef9){_0x35d59c=_0x35d59c-0x0;var _0x18cd27=_0x7cee[_0x35d59c];return _0x18cd27;};'use strict';var _=require(_0xe7ce('0x0'));var util=require(_0xe7ce('0x1'));var logger=require(_0xe7ce('0x2'))(_0xe7ce('0x3'));var moment=require(_0xe7ce('0x4'));var BPromise=require('bluebird');var rp=require(_0xe7ce('0x5'));var fs=require('fs');var path=require(_0xe7ce('0x6'));var rimraf=require('rimraf');var config=require(_0xe7ce('0x7'));var attributes=require(_0xe7ce('0x8'));module[_0xe7ce('0x9')]=function(_0x462dc0,_0x56d971){return _0x462dc0['define'](_0xe7ce('0xa'),attributes,{'tableName':_0xe7ce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57fd=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x57fd,0xc0));var _0xd57f=function(_0x3d6801,_0x30806a){_0x3d6801=_0x3d6801-0x0;var _0x53b3b7=_0x57fd[_0x3d6801];return _0x53b3b7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd57f('0x0'))(_0xd57f('0x1'));var moment=require('moment');var BPromise=require(_0xd57f('0x2'));var rp=require(_0xd57f('0x3'));var fs=require('fs');var path=require(_0xd57f('0x4'));var rimraf=require(_0xd57f('0x5'));var config=require(_0xd57f('0x6'));var attributes=require(_0xd57f('0x7'));module[_0xd57f('0x8')]=function(_0x3a3440,_0x4e3c9c){return _0x3a3440[_0xd57f('0x9')](_0xd57f('0xa'),attributes,{'tableName':_0xd57f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 6379083..ab3f403 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 _0x378b=['model','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTemplate','options','where','attributes','limit','include'];(function(_0x46cfb7,_0x5dbaf2){var _0x35399d=function(_0x2475fc){while(--_0x2475fc){_0x46cfb7['push'](_0x46cfb7['shift']());}};_0x35399d(++_0x5dbaf2);}(_0x378b,0x8d));var _0xb378=function(_0x17c093,_0x5b5f4d){_0x17c093=_0x17c093-0x0;var _0x53ec68=_0x378b[_0x17c093];return _0x53ec68;};'use strict';var _=require(_0xb378('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb378('0x1'));var rs=require(_0xb378('0x2'));var fs=require('fs');var Redis=require(_0xb378('0x3'));var db=require(_0xb378('0x4'))['db'];var utils=require(_0xb378('0x5'));var logger=require(_0xb378('0x6'))(_0xb378('0x7'));var config=require('../../config/environment');var jayson=require(_0xb378('0x8'));var client=jayson[_0xb378('0x9')][_0xb378('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43ecd0,_0x3880ac,_0x3c8a1b){return new BPromise(function(_0x57cdd4,_0x322425){return client[_0xb378('0xb')](_0x43ecd0,_0x3c8a1b)[_0xb378('0xc')](function(_0x16efd9){logger[_0xb378('0xd')](_0xb378('0xe'),_0x3880ac,_0xb378('0xf'));logger['debug'](_0xb378('0x10'),_0x3880ac,_0xb378('0xf'),JSON[_0xb378('0x11')](_0x16efd9));if(_0x16efd9[_0xb378('0x12')]){if(_0x16efd9[_0xb378('0x12')]['code']===0x1f4){logger[_0xb378('0x12')](_0xb378('0xe'),_0x3880ac,_0x16efd9['error'][_0xb378('0x13')]);return _0x322425(_0x16efd9[_0xb378('0x12')][_0xb378('0x13')]);}logger[_0xb378('0x12')](_0xb378('0xe'),_0x3880ac,_0x16efd9[_0xb378('0x12')][_0xb378('0x13')]);return _0x57cdd4(_0x16efd9[_0xb378('0x12')][_0xb378('0x13')]);}else{logger[_0xb378('0xd')](_0xb378('0xe'),_0x3880ac,_0xb378('0xf'));_0x57cdd4(_0x16efd9['result']['message']);}})[_0xb378('0x14')](function(_0x113f83){logger[_0xb378('0x12')](_0xb378('0xe'),_0x3880ac,_0x113f83);_0x322425(_0x113f83);});});}exports[_0xb378('0x15')]=function(_0x4cd6bf){var _0x5003cc=this;return new Promise(function(_0x4858b4,_0x5340f6){return db['Template']['findAll']({'raw':_0x4cd6bf['options']?_0x4cd6bf[_0xb378('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4cd6bf['options']?_0x4cd6bf[_0xb378('0x16')][_0xb378('0x17')]||null:null,'attributes':_0x4cd6bf[_0xb378('0x16')]?_0x4cd6bf[_0xb378('0x16')][_0xb378('0x18')]||null:null,'limit':_0x4cd6bf['options']?_0x4cd6bf['options'][_0xb378('0x19')]||null:null,'include':_0x4cd6bf[_0xb378('0x16')]?_0x4cd6bf[_0xb378('0x16')][_0xb378('0x1a')]?_['map'](_0x4cd6bf[_0xb378('0x16')][_0xb378('0x1a')],function(_0x49029e){return{'model':db[_0x49029e['model']],'as':_0x49029e['as'],'attributes':_0x49029e[_0xb378('0x18')],'include':_0x49029e[_0xb378('0x1a')]?_['map'](_0x49029e[_0xb378('0x1a')],function(_0x1ff9fd){return{'model':db[_0x1ff9fd[_0xb378('0x1b')]],'as':_0x1ff9fd['as'],'attributes':_0x1ff9fd[_0xb378('0x18')],'include':_0x1ff9fd['include']?_['map'](_0x1ff9fd[_0xb378('0x1a')],function(_0xaeae83){return{'model':db[_0xaeae83[_0xb378('0x1b')]],'as':_0xaeae83['as'],'attributes':_0xaeae83[_0xb378('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb378('0xc')](function(_0x1e7f43){logger[_0xb378('0xd')](_0xb378('0x15'),_0x4cd6bf);logger['debug'](_0xb378('0x15'),_0x4cd6bf,JSON['stringify'](_0x1e7f43));_0x4858b4(_0x1e7f43);})[_0xb378('0x14')](function(_0x32a977){logger[_0xb378('0x12')]('GetTemplate',_0x32a977['message'],_0x4cd6bf);_0x5340f6(_0x5003cc['error'](0x1f4,_0x32a977[_0xb378('0x13')]));});});}; \ No newline at end of file +var _0xbd8e=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','code','error','message','Template,\x20%s,\x20%s','result','catch','GetTemplate','Template','options','raw','where','attributes','map','include','model'];(function(_0xdcb0a9,_0x1c7af5){var _0x4ad06b=function(_0xbf141){while(--_0xbf141){_0xdcb0a9['push'](_0xdcb0a9['shift']());}};_0x4ad06b(++_0x1c7af5);}(_0xbd8e,0x1f0));var _0xebd8=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xbd8e[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xebd8('0x0'));var util=require(_0xebd8('0x1'));var moment=require(_0xebd8('0x2'));var BPromise=require(_0xebd8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xebd8('0x4'))['db'];var utils=require(_0xebd8('0x5'));var logger=require(_0xebd8('0x6'))('rpc');var config=require(_0xebd8('0x7'));var jayson=require(_0xebd8('0x8'));var client=jayson[_0xebd8('0x9')][_0xebd8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f3397,_0x5bbc05,_0x19bcba){return new BPromise(function(_0x4c8f09,_0x28d3cb){return client['request'](_0x2f3397,_0x19bcba)[_0xebd8('0xb')](function(_0x419543){logger[_0xebd8('0xc')]('Template,\x20%s,\x20%s',_0x5bbc05,_0xebd8('0xd'));logger[_0xebd8('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x5bbc05,_0xebd8('0xd'),JSON[_0xebd8('0xf')](_0x419543));if(_0x419543['error']){if(_0x419543['error'][_0xebd8('0x10')]===0x1f4){logger[_0xebd8('0x11')]('Template,\x20%s,\x20%s',_0x5bbc05,_0x419543[_0xebd8('0x11')][_0xebd8('0x12')]);return _0x28d3cb(_0x419543[_0xebd8('0x11')]['message']);}logger['error']('Template,\x20%s,\x20%s',_0x5bbc05,_0x419543[_0xebd8('0x11')][_0xebd8('0x12')]);return _0x4c8f09(_0x419543[_0xebd8('0x11')][_0xebd8('0x12')]);}else{logger[_0xebd8('0xc')](_0xebd8('0x13'),_0x5bbc05,'request\x20sent');_0x4c8f09(_0x419543[_0xebd8('0x14')]['message']);}})[_0xebd8('0x15')](function(_0x5db6a4){logger[_0xebd8('0x11')](_0xebd8('0x13'),_0x5bbc05,_0x5db6a4);_0x28d3cb(_0x5db6a4);});});}exports[_0xebd8('0x16')]=function(_0x10c5c1){var _0x3a7872=this;return new Promise(function(_0x4f428c,_0x161529){return db[_0xebd8('0x17')]['findAll']({'raw':_0x10c5c1[_0xebd8('0x18')]?_0x10c5c1['options'][_0xebd8('0x19')]===undefined?!![]:![]:!![],'where':_0x10c5c1[_0xebd8('0x18')]?_0x10c5c1['options'][_0xebd8('0x1a')]||null:null,'attributes':_0x10c5c1[_0xebd8('0x18')]?_0x10c5c1[_0xebd8('0x18')][_0xebd8('0x1b')]||null:null,'limit':_0x10c5c1['options']?_0x10c5c1[_0xebd8('0x18')]['limit']||null:null,'include':_0x10c5c1[_0xebd8('0x18')]?_0x10c5c1[_0xebd8('0x18')]['include']?_[_0xebd8('0x1c')](_0x10c5c1['options'][_0xebd8('0x1d')],function(_0x4d3d1f){return{'model':db[_0x4d3d1f[_0xebd8('0x1e')]],'as':_0x4d3d1f['as'],'attributes':_0x4d3d1f[_0xebd8('0x1b')],'include':_0x4d3d1f[_0xebd8('0x1d')]?_['map'](_0x4d3d1f[_0xebd8('0x1d')],function(_0x9e1eee){return{'model':db[_0x9e1eee[_0xebd8('0x1e')]],'as':_0x9e1eee['as'],'attributes':_0x9e1eee['attributes'],'include':_0x9e1eee[_0xebd8('0x1d')]?_['map'](_0x9e1eee[_0xebd8('0x1d')],function(_0x50cdfe){return{'model':db[_0x50cdfe[_0xebd8('0x1e')]],'as':_0x50cdfe['as'],'attributes':_0x50cdfe[_0xebd8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xebd8('0xb')](function(_0x11e78c){logger['info']('GetTemplate',_0x10c5c1);logger[_0xebd8('0xe')](_0xebd8('0x16'),_0x10c5c1,JSON[_0xebd8('0xf')](_0x11e78c));_0x4f428c(_0x11e78c);})['catch'](function(_0x2c2260){logger['error']('GetTemplate',_0x2c2260[_0xebd8('0x12')],_0x10c5c1);_0x161529(_0x3a7872[_0xebd8('0x11')](0x1f4,_0x2c2260[_0xebd8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 5bb487a..7e5dcd6 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 _0x9867=['isAuthenticated','index','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','getActions','post','create','addAllCondition','addAction','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','get'];(function(_0x13abfc,_0x2013d6){var _0x52eed9=function(_0x3a2b95){while(--_0x3a2b95){_0x13abfc['push'](_0x13abfc['shift']());}};_0x52eed9(++_0x2013d6);}(_0x9867,0x1b1));var _0x7986=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9867[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x7986('0x0'));var util=require('util');var path=require(_0x7986('0x1'));var timeout=require(_0x7986('0x2'));var express=require('express');var router=express[_0x7986('0x3')]();var fs_extra=require(_0x7986('0x4'));var auth=require(_0x7986('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7986('0x6'));var controller=require(_0x7986('0x7'));router[_0x7986('0x8')]('/',auth[_0x7986('0x9')](),controller[_0x7986('0xa')]);router[_0x7986('0x8')]('/:id',auth[_0x7986('0x9')](),controller[_0x7986('0xb')]);router[_0x7986('0x8')](_0x7986('0xc'),auth[_0x7986('0x9')](),controller['getAllConditions']);router[_0x7986('0x8')](_0x7986('0xd'),auth[_0x7986('0x9')](),controller[_0x7986('0xe')]);router[_0x7986('0x8')]('/:id/actions',auth[_0x7986('0x9')](),controller[_0x7986('0xf')]);router[_0x7986('0x10')]('/',auth[_0x7986('0x9')](),controller[_0x7986('0x11')]);router[_0x7986('0x10')](_0x7986('0xc'),auth[_0x7986('0x9')](),controller[_0x7986('0x12')]);router[_0x7986('0x10')](_0x7986('0xd'),auth[_0x7986('0x9')](),controller['addAnyCondition']);router[_0x7986('0x10')]('/:id/actions',auth['isAuthenticated'](),controller[_0x7986('0x13')]);router[_0x7986('0x14')](_0x7986('0x15'),auth[_0x7986('0x9')](),controller[_0x7986('0x16')]);router[_0x7986('0x17')](_0x7986('0x15'),auth[_0x7986('0x9')](),controller[_0x7986('0x18')]);module[_0x7986('0x19')]=router; \ No newline at end of file +var _0x016c=['./trigger.controller','isAuthenticated','get','show','getAllConditions','getAnyConditions','create','addAllCondition','post','/:id/any_conditions','addAnyCondition','/:id/actions','addAction','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x25b6d3,_0x3dad96){var _0x2cfc7b=function(_0x5c1c91){while(--_0x5c1c91){_0x25b6d3['push'](_0x25b6d3['shift']());}};_0x2cfc7b(++_0x3dad96);}(_0x016c,0x1a7));var _0xc016=function(_0x141555,_0x4a32f6){_0x141555=_0x141555-0x0;var _0x36d01d=_0x016c[_0x141555];return _0x36d01d;};'use strict';var multer=require(_0xc016('0x0'));var util=require(_0xc016('0x1'));var path=require('path');var timeout=require(_0xc016('0x2'));var express=require(_0xc016('0x3'));var router=express[_0xc016('0x4')]();var fs_extra=require(_0xc016('0x5'));var auth=require(_0xc016('0x6'));var interaction=require(_0xc016('0x7'));var config=require(_0xc016('0x8'));var controller=require(_0xc016('0x9'));router['get']('/',auth[_0xc016('0xa')](),controller['index']);router[_0xc016('0xb')]('/:id',auth[_0xc016('0xa')](),controller[_0xc016('0xc')]);router['get']('/:id/all_conditions',auth[_0xc016('0xa')](),controller[_0xc016('0xd')]);router[_0xc016('0xb')]('/:id/any_conditions',auth[_0xc016('0xa')](),controller[_0xc016('0xe')]);router[_0xc016('0xb')]('/:id/actions',auth[_0xc016('0xa')](),controller['getActions']);router['post']('/',auth[_0xc016('0xa')](),controller[_0xc016('0xf')]);router['post']('/:id/all_conditions',auth[_0xc016('0xa')](),controller[_0xc016('0x10')]);router[_0xc016('0x11')](_0xc016('0x12'),auth['isAuthenticated'](),controller[_0xc016('0x13')]);router[_0xc016('0x11')](_0xc016('0x14'),auth[_0xc016('0xa')](),controller[_0xc016('0x15')]);router[_0xc016('0x16')](_0xc016('0x17'),auth[_0xc016('0xa')](),controller['update']);router[_0xc016('0x18')](_0xc016('0x17'),auth[_0xc016('0xa')](),controller[_0xc016('0x19')]);module[_0xc016('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index aead544..4b3bdaf 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 _0x2658=['BOOLEAN','sequelize','exports','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2658,0x1e9));var _0x8265=function(_0x16d1ff,_0x2889da){_0x16d1ff=_0x16d1ff-0x0;var _0x3b5f24=_0x2658[_0x16d1ff];return _0x3b5f24;};'use strict';var Sequelize=require(_0x8265('0x0'));module[_0x8265('0x1')]={'name':{'type':Sequelize[_0x8265('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x8265('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9a0e=['exports','STRING','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a0e,0xf3));var _0xe9a0=function(_0x2891cc,_0x52dcd0){_0x2891cc=_0x2891cc-0x0;var _0x43b7d6=_0x9a0e[_0x2891cc];return _0x43b7d6;};'use strict';var Sequelize=require(_0xe9a0('0x0'));module[_0xe9a0('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe9a0('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xe9a0('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 0c0dfb9..c29b0e7 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 _0x6aaf=['create','body','user','get','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','TriggerAnyId','getAllConditions','findOne','keys','length','getAnyConditions','TriggerId','getActions','Action','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','Triggers','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Trigger','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','includeAll','include','merge','find'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x6aaf,0xc9));var _0xf6aa=function(_0x366e75,_0x533d1d){_0x366e75=_0x366e75-0x0;var _0x3b167b=_0x6aaf[_0x366e75];return _0x3b167b;};'use strict';var emlformat=require(_0xf6aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf6aa('0x1'));var jsonpatch=require(_0xf6aa('0x2'));var rp=require(_0xf6aa('0x3'));var moment=require(_0xf6aa('0x4'));var BPromise=require(_0xf6aa('0x5'));var Mustache=require(_0xf6aa('0x6'));var util=require('util');var path=require(_0xf6aa('0x7'));var sox=require(_0xf6aa('0x8'));var csv=require(_0xf6aa('0x9'));var ejs=require(_0xf6aa('0xa'));var fs=require('fs');var fs_extra=require(_0xf6aa('0xb'));var _=require(_0xf6aa('0xc'));var squel=require(_0xf6aa('0xd'));var crypto=require(_0xf6aa('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf6aa('0xf'));var toCsv=require(_0xf6aa('0x9'));var querystring=require(_0xf6aa('0x10'));var Papa=require('papaparse');var Redis=require(_0xf6aa('0x11'));var authService=require(_0xf6aa('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf6aa('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf6aa('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf6aa('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d877f,_0x2a90d3){_0x2a90d3=_0x2a90d3||0xcc;return function(_0x27db3b){if(_0x27db3b){return _0x3d877f['sendStatus'](_0x2a90d3);}return _0x3d877f['status'](_0x2a90d3)['end']();};}function respondWithResult(_0xd8fa61,_0x3a27cd){_0x3a27cd=_0x3a27cd||0xc8;return function(_0x1d7a60){if(_0x1d7a60){return _0xd8fa61[_0xf6aa('0x16')](_0x3a27cd)[_0xf6aa('0x17')](_0x1d7a60);}};}function respondWithFilteredResult(_0xef9338,_0x39e6ba){return function(_0x46d0b6){if(_0x46d0b6){var _0x100db9=_0x46d0b6[_0xf6aa('0x18')],_0x59c4fb=_0x39e6ba[_0xf6aa('0x19')],_0x2d80f9=_0x39e6ba[_0xf6aa('0x19')]+_0x39e6ba[_0xf6aa('0x1a')],_0xe837e0;if(_0x2d80f9>=_0x100db9){_0x2d80f9=_0x100db9;_0xe837e0=0xc8;}else{_0xe837e0=0xce;}_0xef9338['status'](_0xe837e0);return _0xef9338[_0xf6aa('0x1b')](_0xf6aa('0x1c'),_0x59c4fb+'-'+_0x2d80f9+'/'+_0x100db9)[_0xf6aa('0x17')](_0x46d0b6);}return null;};}function patchUpdates(_0x5d6c5e){return function(_0x1918d3){try{jsonpatch[_0xf6aa('0x1d')](_0x1918d3,_0x5d6c5e,!![]);}catch(_0x5c6bf6){return BPromise[_0xf6aa('0x1e')](_0x5c6bf6);}return _0x1918d3[_0xf6aa('0x1f')]();};}function saveUpdates(_0x3d3912,_0x3c90e5){return function(_0x5c3e5e){if(_0x5c3e5e){return _0x5c3e5e['update'](_0x3d3912)[_0xf6aa('0x20')](function(_0x36d1fd){return _0x36d1fd;});}return null;};}function removeEntity(_0x42656c,_0x3b524e){return function(_0x1b22ff){if(_0x1b22ff){return _0x1b22ff[_0xf6aa('0x21')]()['then'](function(){var _0x15e696=_0x1b22ff['get']({'plain':!![]});var _0x1cecb8=_0xf6aa('0x22');return db[_0xf6aa('0x23')]['destroy']({'where':{'type':_0x1cecb8,'resourceId':_0x15e696['id']}})['then'](function(){return _0x1b22ff;});})[_0xf6aa('0x20')](function(){_0x42656c[_0xf6aa('0x16')](0xcc)[_0xf6aa('0x24')]();});}};}function handleEntityNotFound(_0x6d0b08,_0x2be145){return function(_0x4fe25f){if(!_0x4fe25f){_0x6d0b08[_0xf6aa('0x25')](0x194);}return _0x4fe25f;};}function handleError(_0x1962bc,_0x5e4d70){_0x5e4d70=_0x5e4d70||0x1f4;return function(_0x26328b){logger[_0xf6aa('0x26')](_0x26328b[_0xf6aa('0x27')]);if(_0x26328b[_0xf6aa('0x28')]){delete _0x26328b[_0xf6aa('0x28')];}_0x1962bc[_0xf6aa('0x16')](_0x5e4d70)[_0xf6aa('0x29')](_0x26328b);};}exports[_0xf6aa('0x2a')]=function(_0x2166c4,_0x17bb26){var _0x4fc2d7={},_0x11fefc={},_0x2e18c1={'count':0x0,'rows':[]};var _0x535443=_[_0xf6aa('0x2b')](db[_0xf6aa('0x2c')]['rawAttributes'],function(_0x17b247){return{'name':_0x17b247['fieldName'],'type':_0x17b247[_0xf6aa('0x2d')][_0xf6aa('0x2e')]};});_0x11fefc[_0xf6aa('0x2f')]=_[_0xf6aa('0x2b')](_0x535443,_0xf6aa('0x28'));_0x11fefc[_0xf6aa('0x30')]=_['keys'](_0x2166c4[_0xf6aa('0x30')]);_0x11fefc['filters']=_[_0xf6aa('0x31')](_0x11fefc[_0xf6aa('0x2f')],_0x11fefc[_0xf6aa('0x30')]);_0x4fc2d7[_0xf6aa('0x32')]=_['intersection'](_0x11fefc[_0xf6aa('0x2f')],qs[_0xf6aa('0x33')](_0x2166c4[_0xf6aa('0x30')][_0xf6aa('0x33')]));_0x4fc2d7['attributes']=_0x4fc2d7['attributes']['length']?_0x4fc2d7[_0xf6aa('0x32')]:_0x11fefc[_0xf6aa('0x2f')];if(!_0x2166c4[_0xf6aa('0x30')][_0xf6aa('0x34')](_0xf6aa('0x35'))){_0x4fc2d7[_0xf6aa('0x1a')]=qs['limit'](_0x2166c4[_0xf6aa('0x30')][_0xf6aa('0x1a')]);_0x4fc2d7[_0xf6aa('0x19')]=qs[_0xf6aa('0x19')](_0x2166c4[_0xf6aa('0x30')][_0xf6aa('0x19')]);}_0x4fc2d7[_0xf6aa('0x36')]=qs[_0xf6aa('0x37')](_0x2166c4[_0xf6aa('0x30')]['sort']);_0x4fc2d7[_0xf6aa('0x38')]=qs[_0xf6aa('0x39')](_[_0xf6aa('0x3a')](_0x2166c4[_0xf6aa('0x30')],_0x11fefc[_0xf6aa('0x39')]),_0x535443);if(_0x2166c4[_0xf6aa('0x30')][_0xf6aa('0x3b')]){_0x4fc2d7[_0xf6aa('0x38')]=_['merge'](_0x4fc2d7[_0xf6aa('0x38')],{'$or':_[_0xf6aa('0x2b')](_0x535443,function(_0x1dc647){if(_0x1dc647['type']!==_0xf6aa('0x3c')){var _0x5dfdd0={};_0x5dfdd0[_0x1dc647[_0xf6aa('0x28')]]={'$like':'%'+_0x2166c4[_0xf6aa('0x30')][_0xf6aa('0x3b')]+'%'};return _0x5dfdd0;}})});}_0x4fc2d7=_['merge']({},_0x4fc2d7,_0x2166c4[_0xf6aa('0x3d')]);var _0x1f66d1={'where':_0x4fc2d7['where']};return db[_0xf6aa('0x2c')][_0xf6aa('0x18')](_0x1f66d1)[_0xf6aa('0x20')](function(_0x519ef2){_0x2e18c1[_0xf6aa('0x18')]=_0x519ef2;if(_0x2166c4[_0xf6aa('0x30')]['includeAll']){_0x4fc2d7['include']=[{'all':!![]}];}return db['Trigger'][_0xf6aa('0x3e')](_0x4fc2d7);})['then'](function(_0x89f80a){_0x2e18c1[_0xf6aa('0x3f')]=_0x89f80a;return _0x2e18c1;})['then'](respondWithFilteredResult(_0x17bb26,_0x4fc2d7))[_0xf6aa('0x40')](handleError(_0x17bb26,null));};exports[_0xf6aa('0x41')]=function(_0xd838c7,_0x2a8174){var _0x4ff044={'raw':![],'where':{'id':_0xd838c7[_0xf6aa('0x42')]['id']}},_0x4bafc2={};_0x4bafc2[_0xf6aa('0x2f')]=_['keys'](db[_0xf6aa('0x2c')][_0xf6aa('0x43')]);_0x4bafc2[_0xf6aa('0x30')]=_['keys'](_0xd838c7[_0xf6aa('0x30')]);_0x4bafc2[_0xf6aa('0x39')]=_[_0xf6aa('0x31')](_0x4bafc2['model'],_0x4bafc2[_0xf6aa('0x30')]);_0x4ff044[_0xf6aa('0x32')]=_[_0xf6aa('0x31')](_0x4bafc2['model'],qs[_0xf6aa('0x33')](_0xd838c7['query'][_0xf6aa('0x33')]));_0x4ff044[_0xf6aa('0x32')]=_0x4ff044['attributes']['length']?_0x4ff044['attributes']:_0x4bafc2[_0xf6aa('0x2f')];if(_0xd838c7[_0xf6aa('0x30')][_0xf6aa('0x44')]){_0x4ff044[_0xf6aa('0x45')]=[{'all':!![]}];}_0x4ff044=_[_0xf6aa('0x46')]({},_0x4ff044,_0xd838c7[_0xf6aa('0x3d')]);return db[_0xf6aa('0x2c')][_0xf6aa('0x47')](_0x4ff044)[_0xf6aa('0x20')](handleEntityNotFound(_0x2a8174,null))['then'](respondWithResult(_0x2a8174,null))[_0xf6aa('0x40')](handleError(_0x2a8174,null));};exports[_0xf6aa('0x48')]=function(_0x301adf,_0x4e0e94){return db['Trigger'][_0xf6aa('0x48')](_0x301adf[_0xf6aa('0x49')],{})[_0xf6aa('0x20')](function(_0x5da2dc){var _0x5979be=_0x301adf[_0xf6aa('0x4a')][_0xf6aa('0x4b')]({'plain':!![]});if(!_0x5979be)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5979be[_0xf6aa('0x4c')]===_0xf6aa('0x4a')){var _0x24cbb3=_0x5da2dc[_0xf6aa('0x4b')]({'plain':!![]});var _0x2b1e8b=_0xf6aa('0x22');return db[_0xf6aa('0x4d')][_0xf6aa('0x47')]({'where':{'name':_0x2b1e8b,'userProfileId':_0x5979be['userProfileId']},'raw':!![]})[_0xf6aa('0x20')](function(_0x3b5724){if(_0x3b5724&&_0x3b5724[_0xf6aa('0x4e')]===0x0){return db['UserProfileResource'][_0xf6aa('0x48')]({'name':_0x24cbb3[_0xf6aa('0x28')],'resourceId':_0x24cbb3['id'],'type':_0x3b5724['name'],'sectionId':_0x3b5724['id']},{})[_0xf6aa('0x20')](function(){return _0x5da2dc;});}else{return _0x5da2dc;}})['catch'](function(_0x442dd5){logger[_0xf6aa('0x26')](_0xf6aa('0x4f'),_0x442dd5);throw _0x442dd5;});}return _0x5da2dc;})[_0xf6aa('0x20')](respondWithResult(_0x4e0e94,0xc9))[_0xf6aa('0x40')](handleError(_0x4e0e94,null));};exports['update']=function(_0x34c02c,_0x284225){if(_0x34c02c[_0xf6aa('0x49')]['id']){delete _0x34c02c[_0xf6aa('0x49')]['id'];}return db[_0xf6aa('0x2c')][_0xf6aa('0x47')]({'where':{'id':_0x34c02c[_0xf6aa('0x42')]['id']}})[_0xf6aa('0x20')](handleEntityNotFound(_0x284225,null))['then'](saveUpdates(_0x34c02c[_0xf6aa('0x49')],null))['then'](respondWithResult(_0x284225,null))[_0xf6aa('0x40')](handleError(_0x284225,null));};exports[_0xf6aa('0x21')]=function(_0x3a5fe3,_0x4d25c2){return db[_0xf6aa('0x2c')][_0xf6aa('0x47')]({'where':{'id':_0x3a5fe3['params']['id']}})[_0xf6aa('0x20')](handleEntityNotFound(_0x4d25c2,null))[_0xf6aa('0x20')](removeEntity(_0x4d25c2,null))[_0xf6aa('0x40')](handleError(_0x4d25c2,null));};exports[_0xf6aa('0x50')]=function(_0x156fff,_0x3a5276,_0x3e9375){if(_0x156fff['body']['id']){delete _0x156fff['body']['id'];}return db[_0xf6aa('0x2c')][_0xf6aa('0x47')]({'where':{'id':_0x156fff[_0xf6aa('0x42')]['id']}})[_0xf6aa('0x20')](handleEntityNotFound(_0x3a5276,null))[_0xf6aa('0x20')](function(_0x37727a){if(_0x37727a){_0x156fff[_0xf6aa('0x49')]['TriggerAllId']=_0x37727a['id'];return db[_0xf6aa('0x51')][_0xf6aa('0x48')](_0x156fff['body']);}})[_0xf6aa('0x20')](respondWithResult(_0x3a5276,null))[_0xf6aa('0x40')](handleError(_0x3a5276,null));};exports['addAnyCondition']=function(_0x2f2231,_0xb7df22,_0x1d8845){if(_0x2f2231['body']['id']){delete _0x2f2231[_0xf6aa('0x49')]['id'];}return db[_0xf6aa('0x2c')][_0xf6aa('0x47')]({'where':{'id':_0x2f2231[_0xf6aa('0x42')]['id']}})[_0xf6aa('0x20')](handleEntityNotFound(_0xb7df22,null))[_0xf6aa('0x20')](function(_0x26e122){if(_0x26e122){_0x2f2231[_0xf6aa('0x49')][_0xf6aa('0x52')]=_0x26e122['id'];return db[_0xf6aa('0x51')][_0xf6aa('0x48')](_0x2f2231[_0xf6aa('0x49')]);}})[_0xf6aa('0x20')](respondWithResult(_0xb7df22,null))['catch'](handleError(_0xb7df22,null));};exports[_0xf6aa('0x53')]=function(_0x589509,_0x2e0f23,_0x1b9e92){var _0x27ed10={};var _0x24aeb5={};var _0x560ac4;var _0x5b7819;return db[_0xf6aa('0x2c')][_0xf6aa('0x54')]({'where':{'id':_0x589509['params']['id']}})[_0xf6aa('0x20')](handleEntityNotFound(_0x2e0f23,null))[_0xf6aa('0x20')](function(_0x50bfe4){if(_0x50bfe4){_0x560ac4=_0x50bfe4;_0x24aeb5[_0xf6aa('0x2f')]=_[_0xf6aa('0x55')](db[_0xf6aa('0x51')][_0xf6aa('0x43')]);_0x24aeb5[_0xf6aa('0x30')]=_[_0xf6aa('0x55')](_0x589509[_0xf6aa('0x30')]);_0x24aeb5[_0xf6aa('0x39')]=_[_0xf6aa('0x31')](_0x24aeb5['model'],_0x24aeb5[_0xf6aa('0x30')]);_0x27ed10[_0xf6aa('0x32')]=_['intersection'](_0x24aeb5['model'],qs[_0xf6aa('0x33')](_0x589509[_0xf6aa('0x30')][_0xf6aa('0x33')]));_0x27ed10[_0xf6aa('0x32')]=_0x27ed10['attributes'][_0xf6aa('0x56')]?_0x27ed10[_0xf6aa('0x32')]:_0x24aeb5[_0xf6aa('0x2f')];_0x27ed10[_0xf6aa('0x36')]=qs[_0xf6aa('0x37')](_0x589509[_0xf6aa('0x30')]['sort']);_0x27ed10[_0xf6aa('0x38')]=qs[_0xf6aa('0x39')](_[_0xf6aa('0x3a')](_0x589509['query'],_0x24aeb5[_0xf6aa('0x39')]));if(_0x589509['query']['filter']){_0x27ed10[_0xf6aa('0x38')]=_['merge'](_0x27ed10['where'],{'$or':_[_0xf6aa('0x2b')](_0x27ed10[_0xf6aa('0x32')],function(_0x5ef34d){var _0x2e7160={};_0x2e7160[_0x5ef34d]={'$like':'%'+_0x589509[_0xf6aa('0x30')][_0xf6aa('0x3b')]+'%'};return _0x2e7160;})});}_0x27ed10=_['merge']({},_0x27ed10,_0x589509['options']);return _0x560ac4[_0xf6aa('0x53')](_0x27ed10);}})['then'](function(_0xc31227){if(_0xc31227){_0x5b7819=_0xc31227[_0xf6aa('0x56')];if(!_0x589509[_0xf6aa('0x30')][_0xf6aa('0x34')]('nolimit')){_0x27ed10[_0xf6aa('0x1a')]=qs['limit'](_0x589509[_0xf6aa('0x30')]['limit']);_0x27ed10[_0xf6aa('0x19')]=qs[_0xf6aa('0x19')](_0x589509[_0xf6aa('0x30')][_0xf6aa('0x19')]);}return _0x560ac4['getAllConditions'](_0x27ed10);}})[_0xf6aa('0x20')](function(_0x1ffbef){if(_0x1ffbef){return _0x1ffbef?{'count':_0x5b7819,'rows':_0x1ffbef}:null;}})[_0xf6aa('0x20')](respondWithResult(_0x2e0f23,null))['catch'](handleError(_0x2e0f23,null));};exports[_0xf6aa('0x57')]=function(_0x3cc9fb,_0x4d11ed,_0xc5333){var _0x5b737d={};var _0x26d8ad={};var _0x34dd8e;var _0x39b4c1;return db[_0xf6aa('0x2c')][_0xf6aa('0x54')]({'where':{'id':_0x3cc9fb[_0xf6aa('0x42')]['id']}})[_0xf6aa('0x20')](handleEntityNotFound(_0x4d11ed,null))[_0xf6aa('0x20')](function(_0x5136b0){if(_0x5136b0){_0x34dd8e=_0x5136b0;_0x26d8ad[_0xf6aa('0x2f')]=_[_0xf6aa('0x55')](db[_0xf6aa('0x51')]['rawAttributes']);_0x26d8ad[_0xf6aa('0x30')]=_[_0xf6aa('0x55')](_0x3cc9fb[_0xf6aa('0x30')]);_0x26d8ad[_0xf6aa('0x39')]=_['intersection'](_0x26d8ad['model'],_0x26d8ad[_0xf6aa('0x30')]);_0x5b737d[_0xf6aa('0x32')]=_[_0xf6aa('0x31')](_0x26d8ad['model'],qs[_0xf6aa('0x33')](_0x3cc9fb[_0xf6aa('0x30')][_0xf6aa('0x33')]));_0x5b737d[_0xf6aa('0x32')]=_0x5b737d[_0xf6aa('0x32')][_0xf6aa('0x56')]?_0x5b737d[_0xf6aa('0x32')]:_0x26d8ad[_0xf6aa('0x2f')];_0x5b737d['order']=qs['sort'](_0x3cc9fb[_0xf6aa('0x30')][_0xf6aa('0x37')]);_0x5b737d[_0xf6aa('0x38')]=qs[_0xf6aa('0x39')](_[_0xf6aa('0x3a')](_0x3cc9fb[_0xf6aa('0x30')],_0x26d8ad[_0xf6aa('0x39')]));if(_0x3cc9fb[_0xf6aa('0x30')][_0xf6aa('0x3b')]){_0x5b737d[_0xf6aa('0x38')]=_[_0xf6aa('0x46')](_0x5b737d[_0xf6aa('0x38')],{'$or':_[_0xf6aa('0x2b')](_0x5b737d[_0xf6aa('0x32')],function(_0x5b7d72){var _0xecf4a3={};_0xecf4a3[_0x5b7d72]={'$like':'%'+_0x3cc9fb['query']['filter']+'%'};return _0xecf4a3;})});}_0x5b737d=_[_0xf6aa('0x46')]({},_0x5b737d,_0x3cc9fb[_0xf6aa('0x3d')]);return _0x34dd8e[_0xf6aa('0x57')](_0x5b737d);}})[_0xf6aa('0x20')](function(_0x23a84c){if(_0x23a84c){_0x39b4c1=_0x23a84c[_0xf6aa('0x56')];if(!_0x3cc9fb[_0xf6aa('0x30')]['hasOwnProperty']('nolimit')){_0x5b737d[_0xf6aa('0x1a')]=qs['limit'](_0x3cc9fb['query'][_0xf6aa('0x1a')]);_0x5b737d['offset']=qs[_0xf6aa('0x19')](_0x3cc9fb[_0xf6aa('0x30')][_0xf6aa('0x19')]);}return _0x34dd8e[_0xf6aa('0x57')](_0x5b737d);}})['then'](function(_0x2978da){if(_0x2978da){return _0x2978da?{'count':_0x39b4c1,'rows':_0x2978da}:null;}})['then'](respondWithResult(_0x4d11ed,null))[_0xf6aa('0x40')](handleError(_0x4d11ed,null));};exports['addAction']=function(_0x1cb7ab,_0x4de5cb,_0x1e85ef){if(_0x1cb7ab['body']['id']){delete _0x1cb7ab[_0xf6aa('0x49')]['id'];}return db[_0xf6aa('0x2c')][_0xf6aa('0x47')]({'where':{'id':_0x1cb7ab[_0xf6aa('0x42')]['id']}})[_0xf6aa('0x20')](handleEntityNotFound(_0x4de5cb,null))[_0xf6aa('0x20')](function(_0x1294fc){if(_0x1294fc){_0x1cb7ab['body'][_0xf6aa('0x58')]=_0x1294fc['id'];return db['Action']['create'](_0x1cb7ab[_0xf6aa('0x49')]);}})[_0xf6aa('0x20')](respondWithResult(_0x4de5cb,null))['catch'](handleError(_0x4de5cb,null));};exports[_0xf6aa('0x59')]=function(_0x436e0a,_0x3d0899,_0x1c3b4d){var _0x3119e5={};var _0x38a4f8={};var _0x523470;var _0x2c7ff7;return db[_0xf6aa('0x2c')][_0xf6aa('0x54')]({'where':{'id':_0x436e0a[_0xf6aa('0x42')]['id']}})[_0xf6aa('0x20')](handleEntityNotFound(_0x3d0899,null))[_0xf6aa('0x20')](function(_0x3698f1){if(_0x3698f1){_0x523470=_0x3698f1;_0x38a4f8[_0xf6aa('0x2f')]=_[_0xf6aa('0x55')](db[_0xf6aa('0x5a')][_0xf6aa('0x43')]);_0x38a4f8[_0xf6aa('0x30')]=_[_0xf6aa('0x55')](_0x436e0a[_0xf6aa('0x30')]);_0x38a4f8[_0xf6aa('0x39')]=_[_0xf6aa('0x31')](_0x38a4f8['model'],_0x38a4f8['query']);_0x3119e5['attributes']=_[_0xf6aa('0x31')](_0x38a4f8['model'],qs[_0xf6aa('0x33')](_0x436e0a[_0xf6aa('0x30')]['fields']));_0x3119e5[_0xf6aa('0x32')]=_0x3119e5[_0xf6aa('0x32')]['length']?_0x3119e5[_0xf6aa('0x32')]:_0x38a4f8[_0xf6aa('0x2f')];_0x3119e5[_0xf6aa('0x36')]=qs['sort'](_0x436e0a[_0xf6aa('0x30')][_0xf6aa('0x37')]);_0x3119e5[_0xf6aa('0x38')]=qs['filters'](_[_0xf6aa('0x3a')](_0x436e0a[_0xf6aa('0x30')],_0x38a4f8[_0xf6aa('0x39')]));if(_0x436e0a[_0xf6aa('0x30')][_0xf6aa('0x3b')]){_0x3119e5[_0xf6aa('0x38')]=_[_0xf6aa('0x46')](_0x3119e5[_0xf6aa('0x38')],{'$or':_[_0xf6aa('0x2b')](_0x3119e5[_0xf6aa('0x32')],function(_0x2c956f){var _0x21473c={};_0x21473c[_0x2c956f]={'$like':'%'+_0x436e0a[_0xf6aa('0x30')][_0xf6aa('0x3b')]+'%'};return _0x21473c;})});}_0x3119e5=_[_0xf6aa('0x46')]({},_0x3119e5,_0x436e0a[_0xf6aa('0x3d')]);return _0x523470[_0xf6aa('0x59')](_0x3119e5);}})[_0xf6aa('0x20')](function(_0x416607){if(_0x416607){_0x2c7ff7=_0x416607[_0xf6aa('0x56')];if(!_0x436e0a[_0xf6aa('0x30')][_0xf6aa('0x34')](_0xf6aa('0x35'))){_0x3119e5['limit']=qs[_0xf6aa('0x1a')](_0x436e0a[_0xf6aa('0x30')][_0xf6aa('0x1a')]);_0x3119e5['offset']=qs[_0xf6aa('0x19')](_0x436e0a[_0xf6aa('0x30')][_0xf6aa('0x19')]);}return _0x523470['getActions'](_0x3119e5);}})[_0xf6aa('0x20')](function(_0x3011c9){if(_0x3011c9){return _0x3011c9?{'count':_0x2c7ff7,'rows':_0x3011c9}:null;}})[_0xf6aa('0x20')](respondWithResult(_0x3d0899,null))[_0xf6aa('0x40')](handleError(_0x3d0899,null));}; \ No newline at end of file +var _0x3bcb=['pick','filter','merge','where','VIRTUAL','findAll','rows','rawAttributes','intersection','length','includeAll','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Triggers','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','Action','getActions','eml-format','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','stack','name','send','index','map','Trigger','fieldName','type','key','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x22c08b,_0x4c89df){var _0xe69f72=function(_0x43d4d0){while(--_0x43d4d0){_0x22c08b['push'](_0x22c08b['shift']());}};_0xe69f72(++_0x4c89df);}(_0x3bcb,0xd8));var _0xb3bc=function(_0x24ad5f,_0x4fcf81){_0x24ad5f=_0x24ad5f-0x0;var _0xabb54e=_0x3bcb[_0x24ad5f];return _0xabb54e;};'use strict';var emlformat=require(_0xb3bc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb3bc('0x1'));var jsonpatch=require(_0xb3bc('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb3bc('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb3bc('0x4'));var sox=require(_0xb3bc('0x5'));var csv=require(_0xb3bc('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb3bc('0x7'));var jsforce=require(_0xb3bc('0x8'));var deskjs=require(_0xb3bc('0x9'));var toCsv=require(_0xb3bc('0x6'));var querystring=require('querystring');var Papa=require(_0xb3bc('0xa'));var Redis=require('ioredis');var authService=require(_0xb3bc('0xb'));var qs=require(_0xb3bc('0xc'));var as=require(_0xb3bc('0xd'));var hardwareService=require(_0xb3bc('0xe'));var logger=require(_0xb3bc('0xf'))('api');var utils=require(_0xb3bc('0x10'));var config=require(_0xb3bc('0x11'));var licenseUtil=require(_0xb3bc('0x12'));var db=require(_0xb3bc('0x13'))['db'];function respondWithStatusCode(_0x429d7a,_0x23a2df){_0x23a2df=_0x23a2df||0xcc;return function(_0x32ca0f){if(_0x32ca0f){return _0x429d7a[_0xb3bc('0x14')](_0x23a2df);}return _0x429d7a[_0xb3bc('0x15')](_0x23a2df)[_0xb3bc('0x16')]();};}function respondWithResult(_0x4b34d0,_0x453ec5){_0x453ec5=_0x453ec5||0xc8;return function(_0x252e0b){if(_0x252e0b){return _0x4b34d0['status'](_0x453ec5)['json'](_0x252e0b);}};}function respondWithFilteredResult(_0x295113,_0x32ec3a){return function(_0x1fc254){if(_0x1fc254){var _0x42b7c4=_0x1fc254[_0xb3bc('0x17')],_0x3ebdc0=_0x32ec3a[_0xb3bc('0x18')],_0x2aa751=_0x32ec3a[_0xb3bc('0x18')]+_0x32ec3a[_0xb3bc('0x19')],_0x5f36fb;if(_0x2aa751>=_0x42b7c4){_0x2aa751=_0x42b7c4;_0x5f36fb=0xc8;}else{_0x5f36fb=0xce;}_0x295113[_0xb3bc('0x15')](_0x5f36fb);return _0x295113[_0xb3bc('0x1a')](_0xb3bc('0x1b'),_0x3ebdc0+'-'+_0x2aa751+'/'+_0x42b7c4)['json'](_0x1fc254);}return null;};}function patchUpdates(_0x4bf102){return function(_0x1bdff5){try{jsonpatch[_0xb3bc('0x1c')](_0x1bdff5,_0x4bf102,!![]);}catch(_0x149119){return BPromise[_0xb3bc('0x1d')](_0x149119);}return _0x1bdff5[_0xb3bc('0x1e')]();};}function saveUpdates(_0xce45b7,_0x10a9b8){return function(_0x556e0e){if(_0x556e0e){return _0x556e0e[_0xb3bc('0x1f')](_0xce45b7)[_0xb3bc('0x20')](function(_0x1e0751){return _0x1e0751;});}return null;};}function removeEntity(_0x36c05c,_0x82a5){return function(_0x113446){if(_0x113446){return _0x113446[_0xb3bc('0x21')]()[_0xb3bc('0x20')](function(){var _0x3a3417=_0x113446[_0xb3bc('0x22')]({'plain':!![]});var _0x469d3a='Triggers';return db['UserProfileResource']['destroy']({'where':{'type':_0x469d3a,'resourceId':_0x3a3417['id']}})[_0xb3bc('0x20')](function(){return _0x113446;});})[_0xb3bc('0x20')](function(){_0x36c05c[_0xb3bc('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fb99e,_0x59513f){return function(_0x5ef9b6){if(!_0x5ef9b6){_0x1fb99e[_0xb3bc('0x14')](0x194);}return _0x5ef9b6;};}function handleError(_0x232f9a,_0x5ba35d){_0x5ba35d=_0x5ba35d||0x1f4;return function(_0x1a0122){logger['error'](_0x1a0122[_0xb3bc('0x23')]);if(_0x1a0122[_0xb3bc('0x24')]){delete _0x1a0122[_0xb3bc('0x24')];}_0x232f9a[_0xb3bc('0x15')](_0x5ba35d)[_0xb3bc('0x25')](_0x1a0122);};}exports[_0xb3bc('0x26')]=function(_0x267f9c,_0x26de93){var _0xd6aa99={},_0x3d790c={},_0x167566={'count':0x0,'rows':[]};var _0x527c8e=_[_0xb3bc('0x27')](db[_0xb3bc('0x28')]['rawAttributes'],function(_0x11ff03){return{'name':_0x11ff03[_0xb3bc('0x29')],'type':_0x11ff03[_0xb3bc('0x2a')][_0xb3bc('0x2b')]};});_0x3d790c['model']=_[_0xb3bc('0x27')](_0x527c8e,'name');_0x3d790c[_0xb3bc('0x2c')]=_[_0xb3bc('0x2d')](_0x267f9c[_0xb3bc('0x2c')]);_0x3d790c[_0xb3bc('0x2e')]=_['intersection'](_0x3d790c[_0xb3bc('0x2f')],_0x3d790c[_0xb3bc('0x2c')]);_0xd6aa99[_0xb3bc('0x30')]=_['intersection'](_0x3d790c[_0xb3bc('0x2f')],qs[_0xb3bc('0x31')](_0x267f9c[_0xb3bc('0x2c')]['fields']));_0xd6aa99[_0xb3bc('0x30')]=_0xd6aa99['attributes']['length']?_0xd6aa99[_0xb3bc('0x30')]:_0x3d790c['model'];if(!_0x267f9c[_0xb3bc('0x2c')][_0xb3bc('0x32')](_0xb3bc('0x33'))){_0xd6aa99[_0xb3bc('0x19')]=qs['limit'](_0x267f9c[_0xb3bc('0x2c')][_0xb3bc('0x19')]);_0xd6aa99['offset']=qs['offset'](_0x267f9c['query'][_0xb3bc('0x18')]);}_0xd6aa99[_0xb3bc('0x34')]=qs['sort'](_0x267f9c['query'][_0xb3bc('0x35')]);_0xd6aa99['where']=qs[_0xb3bc('0x2e')](_[_0xb3bc('0x36')](_0x267f9c[_0xb3bc('0x2c')],_0x3d790c[_0xb3bc('0x2e')]),_0x527c8e);if(_0x267f9c[_0xb3bc('0x2c')][_0xb3bc('0x37')]){_0xd6aa99['where']=_[_0xb3bc('0x38')](_0xd6aa99[_0xb3bc('0x39')],{'$or':_[_0xb3bc('0x27')](_0x527c8e,function(_0x1702ec){if(_0x1702ec[_0xb3bc('0x2a')]!==_0xb3bc('0x3a')){var _0x6df0={};_0x6df0[_0x1702ec[_0xb3bc('0x24')]]={'$like':'%'+_0x267f9c[_0xb3bc('0x2c')]['filter']+'%'};return _0x6df0;}})});}_0xd6aa99=_[_0xb3bc('0x38')]({},_0xd6aa99,_0x267f9c['options']);var _0x414220={'where':_0xd6aa99[_0xb3bc('0x39')]};return db[_0xb3bc('0x28')][_0xb3bc('0x17')](_0x414220)[_0xb3bc('0x20')](function(_0x3189fd){_0x167566[_0xb3bc('0x17')]=_0x3189fd;if(_0x267f9c['query']['includeAll']){_0xd6aa99['include']=[{'all':!![]}];}return db[_0xb3bc('0x28')][_0xb3bc('0x3b')](_0xd6aa99);})[_0xb3bc('0x20')](function(_0x1e6eec){_0x167566[_0xb3bc('0x3c')]=_0x1e6eec;return _0x167566;})[_0xb3bc('0x20')](respondWithFilteredResult(_0x26de93,_0xd6aa99))['catch'](handleError(_0x26de93,null));};exports['show']=function(_0x17bb03,_0x5d1a32){var _0x3ecc3b={'raw':![],'where':{'id':_0x17bb03['params']['id']}},_0x324d75={};_0x324d75[_0xb3bc('0x2f')]=_['keys'](db[_0xb3bc('0x28')][_0xb3bc('0x3d')]);_0x324d75[_0xb3bc('0x2c')]=_['keys'](_0x17bb03[_0xb3bc('0x2c')]);_0x324d75['filters']=_[_0xb3bc('0x3e')](_0x324d75[_0xb3bc('0x2f')],_0x324d75[_0xb3bc('0x2c')]);_0x3ecc3b['attributes']=_['intersection'](_0x324d75[_0xb3bc('0x2f')],qs[_0xb3bc('0x31')](_0x17bb03['query'][_0xb3bc('0x31')]));_0x3ecc3b[_0xb3bc('0x30')]=_0x3ecc3b['attributes'][_0xb3bc('0x3f')]?_0x3ecc3b['attributes']:_0x324d75[_0xb3bc('0x2f')];if(_0x17bb03['query'][_0xb3bc('0x40')]){_0x3ecc3b['include']=[{'all':!![]}];}_0x3ecc3b=_['merge']({},_0x3ecc3b,_0x17bb03[_0xb3bc('0x41')]);return db[_0xb3bc('0x28')][_0xb3bc('0x42')](_0x3ecc3b)[_0xb3bc('0x20')](handleEntityNotFound(_0x5d1a32,null))[_0xb3bc('0x20')](respondWithResult(_0x5d1a32,null))[_0xb3bc('0x43')](handleError(_0x5d1a32,null));};exports[_0xb3bc('0x44')]=function(_0x4b9e2e,_0x1cad7f){return db['Trigger'][_0xb3bc('0x44')](_0x4b9e2e[_0xb3bc('0x45')],{})[_0xb3bc('0x20')](function(_0x15fe6a){var _0x54283f=_0x4b9e2e['user'][_0xb3bc('0x22')]({'plain':!![]});if(!_0x54283f)throw new Error(_0xb3bc('0x46'));if(_0x54283f[_0xb3bc('0x47')]===_0xb3bc('0x48')){var _0x1c010d=_0x15fe6a[_0xb3bc('0x22')]({'plain':!![]});var _0x4a814a=_0xb3bc('0x49');return db['UserProfileSection'][_0xb3bc('0x42')]({'where':{'name':_0x4a814a,'userProfileId':_0x54283f['userProfileId']},'raw':!![]})[_0xb3bc('0x20')](function(_0xc8dfe){if(_0xc8dfe&&_0xc8dfe[_0xb3bc('0x4a')]===0x0){return db[_0xb3bc('0x4b')][_0xb3bc('0x44')]({'name':_0x1c010d['name'],'resourceId':_0x1c010d['id'],'type':_0xc8dfe[_0xb3bc('0x24')],'sectionId':_0xc8dfe['id']},{})[_0xb3bc('0x20')](function(){return _0x15fe6a;});}else{return _0x15fe6a;}})[_0xb3bc('0x43')](function(_0x52cfc3){logger[_0xb3bc('0x4c')](_0xb3bc('0x4d'),_0x52cfc3);throw _0x52cfc3;});}return _0x15fe6a;})[_0xb3bc('0x20')](respondWithResult(_0x1cad7f,0xc9))[_0xb3bc('0x43')](handleError(_0x1cad7f,null));};exports['update']=function(_0x108bf0,_0xd3b546){if(_0x108bf0[_0xb3bc('0x45')]['id']){delete _0x108bf0[_0xb3bc('0x45')]['id'];}return db[_0xb3bc('0x28')][_0xb3bc('0x42')]({'where':{'id':_0x108bf0['params']['id']}})[_0xb3bc('0x20')](handleEntityNotFound(_0xd3b546,null))[_0xb3bc('0x20')](saveUpdates(_0x108bf0[_0xb3bc('0x45')],null))[_0xb3bc('0x20')](respondWithResult(_0xd3b546,null))['catch'](handleError(_0xd3b546,null));};exports[_0xb3bc('0x21')]=function(_0x236e02,_0x355db2){return db[_0xb3bc('0x28')][_0xb3bc('0x42')]({'where':{'id':_0x236e02[_0xb3bc('0x4e')]['id']}})[_0xb3bc('0x20')](handleEntityNotFound(_0x355db2,null))[_0xb3bc('0x20')](removeEntity(_0x355db2,null))[_0xb3bc('0x43')](handleError(_0x355db2,null));};exports[_0xb3bc('0x4f')]=function(_0x3fda5b,_0x700227,_0x4dae05){if(_0x3fda5b[_0xb3bc('0x45')]['id']){delete _0x3fda5b['body']['id'];}return db[_0xb3bc('0x28')][_0xb3bc('0x42')]({'where':{'id':_0x3fda5b['params']['id']}})['then'](handleEntityNotFound(_0x700227,null))[_0xb3bc('0x20')](function(_0x4239bb){if(_0x4239bb){_0x3fda5b[_0xb3bc('0x45')][_0xb3bc('0x50')]=_0x4239bb['id'];return db[_0xb3bc('0x51')]['create'](_0x3fda5b[_0xb3bc('0x45')]);}})[_0xb3bc('0x20')](respondWithResult(_0x700227,null))[_0xb3bc('0x43')](handleError(_0x700227,null));};exports[_0xb3bc('0x52')]=function(_0x326907,_0x261960,_0x363a3b){if(_0x326907[_0xb3bc('0x45')]['id']){delete _0x326907[_0xb3bc('0x45')]['id'];}return db[_0xb3bc('0x28')][_0xb3bc('0x42')]({'where':{'id':_0x326907[_0xb3bc('0x4e')]['id']}})[_0xb3bc('0x20')](handleEntityNotFound(_0x261960,null))[_0xb3bc('0x20')](function(_0x8acc9){if(_0x8acc9){_0x326907[_0xb3bc('0x45')][_0xb3bc('0x53')]=_0x8acc9['id'];return db[_0xb3bc('0x51')][_0xb3bc('0x44')](_0x326907[_0xb3bc('0x45')]);}})['then'](respondWithResult(_0x261960,null))[_0xb3bc('0x43')](handleError(_0x261960,null));};exports[_0xb3bc('0x54')]=function(_0xbb1fa5,_0x46e507,_0xc0bfff){var _0x480504={};var _0x588803={};var _0x1b0a41;var _0x3c3b07;return db[_0xb3bc('0x28')][_0xb3bc('0x55')]({'where':{'id':_0xbb1fa5[_0xb3bc('0x4e')]['id']}})[_0xb3bc('0x20')](handleEntityNotFound(_0x46e507,null))[_0xb3bc('0x20')](function(_0x51a94e){if(_0x51a94e){_0x1b0a41=_0x51a94e;_0x588803[_0xb3bc('0x2f')]=_[_0xb3bc('0x2d')](db[_0xb3bc('0x51')]['rawAttributes']);_0x588803['query']=_[_0xb3bc('0x2d')](_0xbb1fa5[_0xb3bc('0x2c')]);_0x588803[_0xb3bc('0x2e')]=_[_0xb3bc('0x3e')](_0x588803['model'],_0x588803[_0xb3bc('0x2c')]);_0x480504[_0xb3bc('0x30')]=_[_0xb3bc('0x3e')](_0x588803['model'],qs['fields'](_0xbb1fa5[_0xb3bc('0x2c')][_0xb3bc('0x31')]));_0x480504[_0xb3bc('0x30')]=_0x480504[_0xb3bc('0x30')]['length']?_0x480504[_0xb3bc('0x30')]:_0x588803['model'];_0x480504['order']=qs['sort'](_0xbb1fa5['query'][_0xb3bc('0x35')]);_0x480504['where']=qs[_0xb3bc('0x2e')](_[_0xb3bc('0x36')](_0xbb1fa5['query'],_0x588803['filters']));if(_0xbb1fa5[_0xb3bc('0x2c')][_0xb3bc('0x37')]){_0x480504[_0xb3bc('0x39')]=_['merge'](_0x480504[_0xb3bc('0x39')],{'$or':_['map'](_0x480504[_0xb3bc('0x30')],function(_0x49ac23){var _0x483ecb={};_0x483ecb[_0x49ac23]={'$like':'%'+_0xbb1fa5[_0xb3bc('0x2c')][_0xb3bc('0x37')]+'%'};return _0x483ecb;})});}_0x480504=_[_0xb3bc('0x38')]({},_0x480504,_0xbb1fa5['options']);return _0x1b0a41[_0xb3bc('0x54')](_0x480504);}})[_0xb3bc('0x20')](function(_0x1ea3d5){if(_0x1ea3d5){_0x3c3b07=_0x1ea3d5[_0xb3bc('0x3f')];if(!_0xbb1fa5[_0xb3bc('0x2c')][_0xb3bc('0x32')](_0xb3bc('0x33'))){_0x480504[_0xb3bc('0x19')]=qs[_0xb3bc('0x19')](_0xbb1fa5[_0xb3bc('0x2c')]['limit']);_0x480504['offset']=qs[_0xb3bc('0x18')](_0xbb1fa5['query'][_0xb3bc('0x18')]);}return _0x1b0a41[_0xb3bc('0x54')](_0x480504);}})[_0xb3bc('0x20')](function(_0x41e1c1){if(_0x41e1c1){return _0x41e1c1?{'count':_0x3c3b07,'rows':_0x41e1c1}:null;}})['then'](respondWithResult(_0x46e507,null))[_0xb3bc('0x43')](handleError(_0x46e507,null));};exports[_0xb3bc('0x56')]=function(_0x24ff29,_0x193ba4,_0x5a381c){var _0x166d72={};var _0xf13fb5={};var _0x550cd4;var _0x28f95c;return db[_0xb3bc('0x28')][_0xb3bc('0x55')]({'where':{'id':_0x24ff29[_0xb3bc('0x4e')]['id']}})['then'](handleEntityNotFound(_0x193ba4,null))[_0xb3bc('0x20')](function(_0x25eff5){if(_0x25eff5){_0x550cd4=_0x25eff5;_0xf13fb5[_0xb3bc('0x2f')]=_['keys'](db['Condition'][_0xb3bc('0x3d')]);_0xf13fb5['query']=_[_0xb3bc('0x2d')](_0x24ff29[_0xb3bc('0x2c')]);_0xf13fb5['filters']=_[_0xb3bc('0x3e')](_0xf13fb5[_0xb3bc('0x2f')],_0xf13fb5[_0xb3bc('0x2c')]);_0x166d72[_0xb3bc('0x30')]=_[_0xb3bc('0x3e')](_0xf13fb5[_0xb3bc('0x2f')],qs[_0xb3bc('0x31')](_0x24ff29[_0xb3bc('0x2c')][_0xb3bc('0x31')]));_0x166d72[_0xb3bc('0x30')]=_0x166d72[_0xb3bc('0x30')]['length']?_0x166d72[_0xb3bc('0x30')]:_0xf13fb5[_0xb3bc('0x2f')];_0x166d72[_0xb3bc('0x34')]=qs[_0xb3bc('0x35')](_0x24ff29[_0xb3bc('0x2c')][_0xb3bc('0x35')]);_0x166d72['where']=qs[_0xb3bc('0x2e')](_[_0xb3bc('0x36')](_0x24ff29[_0xb3bc('0x2c')],_0xf13fb5[_0xb3bc('0x2e')]));if(_0x24ff29[_0xb3bc('0x2c')][_0xb3bc('0x37')]){_0x166d72[_0xb3bc('0x39')]=_[_0xb3bc('0x38')](_0x166d72[_0xb3bc('0x39')],{'$or':_[_0xb3bc('0x27')](_0x166d72['attributes'],function(_0x415a37){var _0x2f6265={};_0x2f6265[_0x415a37]={'$like':'%'+_0x24ff29[_0xb3bc('0x2c')][_0xb3bc('0x37')]+'%'};return _0x2f6265;})});}_0x166d72=_[_0xb3bc('0x38')]({},_0x166d72,_0x24ff29[_0xb3bc('0x41')]);return _0x550cd4['getAnyConditions'](_0x166d72);}})['then'](function(_0x5958a9){if(_0x5958a9){_0x28f95c=_0x5958a9[_0xb3bc('0x3f')];if(!_0x24ff29[_0xb3bc('0x2c')]['hasOwnProperty'](_0xb3bc('0x33'))){_0x166d72[_0xb3bc('0x19')]=qs['limit'](_0x24ff29[_0xb3bc('0x2c')][_0xb3bc('0x19')]);_0x166d72[_0xb3bc('0x18')]=qs[_0xb3bc('0x18')](_0x24ff29['query'][_0xb3bc('0x18')]);}return _0x550cd4[_0xb3bc('0x56')](_0x166d72);}})[_0xb3bc('0x20')](function(_0x1cd725){if(_0x1cd725){return _0x1cd725?{'count':_0x28f95c,'rows':_0x1cd725}:null;}})[_0xb3bc('0x20')](respondWithResult(_0x193ba4,null))[_0xb3bc('0x43')](handleError(_0x193ba4,null));};exports[_0xb3bc('0x57')]=function(_0x483e58,_0x2923ef,_0x43bae2){if(_0x483e58['body']['id']){delete _0x483e58[_0xb3bc('0x45')]['id'];}return db[_0xb3bc('0x28')][_0xb3bc('0x42')]({'where':{'id':_0x483e58['params']['id']}})[_0xb3bc('0x20')](handleEntityNotFound(_0x2923ef,null))[_0xb3bc('0x20')](function(_0x134676){if(_0x134676){_0x483e58[_0xb3bc('0x45')]['TriggerId']=_0x134676['id'];return db[_0xb3bc('0x58')][_0xb3bc('0x44')](_0x483e58['body']);}})[_0xb3bc('0x20')](respondWithResult(_0x2923ef,null))[_0xb3bc('0x43')](handleError(_0x2923ef,null));};exports[_0xb3bc('0x59')]=function(_0x1fa1c2,_0x49a23c,_0x25619a){var _0x1c270b={};var _0x23cbf1={};var _0x4f2942;var _0x77825e;return db['Trigger'][_0xb3bc('0x55')]({'where':{'id':_0x1fa1c2['params']['id']}})[_0xb3bc('0x20')](handleEntityNotFound(_0x49a23c,null))[_0xb3bc('0x20')](function(_0x36faf6){if(_0x36faf6){_0x4f2942=_0x36faf6;_0x23cbf1[_0xb3bc('0x2f')]=_[_0xb3bc('0x2d')](db[_0xb3bc('0x58')][_0xb3bc('0x3d')]);_0x23cbf1[_0xb3bc('0x2c')]=_[_0xb3bc('0x2d')](_0x1fa1c2['query']);_0x23cbf1['filters']=_[_0xb3bc('0x3e')](_0x23cbf1[_0xb3bc('0x2f')],_0x23cbf1['query']);_0x1c270b[_0xb3bc('0x30')]=_[_0xb3bc('0x3e')](_0x23cbf1[_0xb3bc('0x2f')],qs['fields'](_0x1fa1c2[_0xb3bc('0x2c')][_0xb3bc('0x31')]));_0x1c270b[_0xb3bc('0x30')]=_0x1c270b[_0xb3bc('0x30')][_0xb3bc('0x3f')]?_0x1c270b[_0xb3bc('0x30')]:_0x23cbf1[_0xb3bc('0x2f')];_0x1c270b[_0xb3bc('0x34')]=qs[_0xb3bc('0x35')](_0x1fa1c2[_0xb3bc('0x2c')][_0xb3bc('0x35')]);_0x1c270b[_0xb3bc('0x39')]=qs[_0xb3bc('0x2e')](_[_0xb3bc('0x36')](_0x1fa1c2[_0xb3bc('0x2c')],_0x23cbf1[_0xb3bc('0x2e')]));if(_0x1fa1c2[_0xb3bc('0x2c')][_0xb3bc('0x37')]){_0x1c270b['where']=_[_0xb3bc('0x38')](_0x1c270b[_0xb3bc('0x39')],{'$or':_[_0xb3bc('0x27')](_0x1c270b['attributes'],function(_0x448aa5){var _0x4733d3={};_0x4733d3[_0x448aa5]={'$like':'%'+_0x1fa1c2['query']['filter']+'%'};return _0x4733d3;})});}_0x1c270b=_[_0xb3bc('0x38')]({},_0x1c270b,_0x1fa1c2[_0xb3bc('0x41')]);return _0x4f2942[_0xb3bc('0x59')](_0x1c270b);}})[_0xb3bc('0x20')](function(_0x23e1cb){if(_0x23e1cb){_0x77825e=_0x23e1cb['length'];if(!_0x1fa1c2['query']['hasOwnProperty'](_0xb3bc('0x33'))){_0x1c270b[_0xb3bc('0x19')]=qs['limit'](_0x1fa1c2['query'][_0xb3bc('0x19')]);_0x1c270b['offset']=qs[_0xb3bc('0x18')](_0x1fa1c2[_0xb3bc('0x2c')]['offset']);}return _0x4f2942[_0xb3bc('0x59')](_0x1c270b);}})[_0xb3bc('0x20')](function(_0x13dc9d){if(_0x13dc9d){return _0x13dc9d?{'count':_0x77825e,'rows':_0x13dc9d}:null;}})[_0xb3bc('0x20')](respondWithResult(_0x49a23c,null))[_0xb3bc('0x43')](handleError(_0x49a23c,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index e9ef87e..ae65713 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 _0x7cb0=['rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5a135c,_0x30b41d){var _0x523d9e=function(_0x24b954){while(--_0x24b954){_0x5a135c['push'](_0x5a135c['shift']());}};_0x523d9e(++_0x30b41d);}(_0x7cb0,0x88));var _0x07cb=function(_0x404eed,_0x5390c5){_0x404eed=_0x404eed-0x0;var _0xd45887=_0x7cb0[_0x404eed];return _0xd45887;};'use strict';var _=require(_0x07cb('0x0'));var util=require(_0x07cb('0x1'));var logger=require(_0x07cb('0x2'))(_0x07cb('0x3'));var moment=require('moment');var BPromise=require(_0x07cb('0x4'));var rp=require(_0x07cb('0x5'));var fs=require('fs');var path=require(_0x07cb('0x6'));var rimraf=require(_0x07cb('0x7'));var config=require(_0x07cb('0x8'));var attributes=require(_0x07cb('0x9'));module[_0x07cb('0xa')]=function(_0x30799c,_0x3a8e52){return _0x30799c[_0x07cb('0xb')](_0x07cb('0xc'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2544=['util','../../config/logger','api','request-promise','path','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2544,0x6b));var _0x4254=function(_0x32520c,_0x313fca){_0x32520c=_0x32520c-0x0;var _0x24d81=_0x2544[_0x32520c];return _0x24d81;};'use strict';var _=require(_0x4254('0x0'));var util=require(_0x4254('0x1'));var logger=require(_0x4254('0x2'))(_0x4254('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4254('0x4'));var fs=require('fs');var path=require(_0x4254('0x5'));var rimraf=require('rimraf');var config=require(_0x4254('0x6'));var attributes=require(_0x4254('0x7'));module[_0x4254('0x8')]=function(_0x52cbfd,_0x2f0433){return _0x52cbfd[_0x4254('0x9')](_0x4254('0xa'),attributes,{'tableName':_0x4254('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 3c6466b..cf6e3fd 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 _0xb58b=['model','map','debug','catch','ShowTrigger','find','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTrigger','Trigger','findAll','options','raw','attributes','limit','include'];(function(_0x1e5068,_0x31e9c4){var _0x2230b6=function(_0xaa2ee){while(--_0xaa2ee){_0x1e5068['push'](_0x1e5068['shift']());}};_0x2230b6(++_0x31e9c4);}(_0xb58b,0x1f1));var _0xbb58=function(_0x1ebc64,_0x39153d){_0x1ebc64=_0x1ebc64-0x0;var _0x418516=_0xb58b[_0x1ebc64];return _0x418516;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var moment=require(_0xbb58('0x1'));var BPromise=require(_0xbb58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb58('0x3'));var db=require(_0xbb58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb58('0x5'))('rpc');var config=require(_0xbb58('0x6'));var jayson=require(_0xbb58('0x7'));var client=jayson[_0xbb58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27cbda,_0x323066,_0xe874f2){return new BPromise(function(_0x5d7fe8,_0xd94f1){return client[_0xbb58('0x9')](_0x27cbda,_0xe874f2)[_0xbb58('0xa')](function(_0x36ca50){logger[_0xbb58('0xb')](_0xbb58('0xc'),_0x323066,_0xbb58('0xd'));logger['debug'](_0xbb58('0xe'),_0x323066,'request\x20sent',JSON[_0xbb58('0xf')](_0x36ca50));if(_0x36ca50[_0xbb58('0x10')]){if(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x11')]===0x1f4){logger['error'](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0xd94f1(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}logger[_0xbb58('0x10')](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0x5d7fe8(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x323066,_0xbb58('0xd'));_0x5d7fe8(_0x36ca50[_0xbb58('0x13')][_0xbb58('0x12')]);}})['catch'](function(_0x5edc97){logger['error']('Trigger,\x20%s,\x20%s',_0x323066,_0x5edc97);_0xd94f1(_0x5edc97);});});}exports[_0xbb58('0x14')]=function(_0x3134ea){var _0x48f3e0=this;return new Promise(function(_0xbee66,_0x497653){return db[_0xbb58('0x15')][_0xbb58('0x16')]({'raw':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x18')]===undefined?!![]:![]:!![],'where':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')]['where']||null:null,'attributes':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x19')]||null:null,'limit':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x1a')]||null:null,'include':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x1b')]?_['map'](_0x3134ea[_0xbb58('0x17')]['include'],function(_0x21964d){return{'model':db[_0x21964d[_0xbb58('0x1c')]],'as':_0x21964d['as'],'attributes':_0x21964d[_0xbb58('0x19')],'include':_0x21964d[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x21964d[_0xbb58('0x1b')],function(_0x2d556a){return{'model':db[_0x2d556a[_0xbb58('0x1c')]],'as':_0x2d556a['as'],'attributes':_0x2d556a['attributes'],'include':_0x2d556a[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x2d556a[_0xbb58('0x1b')],function(_0x129094){return{'model':db[_0x129094[_0xbb58('0x1c')]],'as':_0x129094['as'],'attributes':_0x129094[_0xbb58('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbb58('0xa')](function(_0x2ce7c3){logger[_0xbb58('0xb')](_0xbb58('0x14'),_0x3134ea);logger[_0xbb58('0x1e')](_0xbb58('0x14'),_0x3134ea,JSON[_0xbb58('0xf')](_0x2ce7c3));_0xbee66(_0x2ce7c3);})[_0xbb58('0x1f')](function(_0x3559b6){logger['error'](_0xbb58('0x14'),_0x3559b6[_0xbb58('0x12')],_0x3134ea);_0x497653(_0x48f3e0[_0xbb58('0x10')](0x1f4,_0x3559b6[_0xbb58('0x12')]));});});};exports[_0xbb58('0x20')]=function(_0x9d379f){var _0x1ba526=this;return new Promise(function(_0x643e0e,_0x3f8db3){return db['Trigger'][_0xbb58('0x21')]({'raw':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x18')]===undefined?!![]:![]:!![],'where':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x22')]||null:null,'attributes':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x19')]||null:null,'include':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x1b')]?_['map'](_0x9d379f['options']['include'],function(_0x1def9f){return{'model':db[_0x1def9f[_0xbb58('0x1c')]],'as':_0x1def9f['as'],'attributes':_0x1def9f[_0xbb58('0x19')],'include':_0x1def9f[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x1def9f[_0xbb58('0x1b')],function(_0x3093bf){return{'model':db[_0x3093bf[_0xbb58('0x1c')]],'as':_0x3093bf['as'],'attributes':_0x3093bf['attributes'],'include':_0x3093bf[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x3093bf['include'],function(_0x33ec68){return{'model':db[_0x33ec68['model']],'as':_0x33ec68['as'],'attributes':_0x33ec68[_0xbb58('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x86372e){logger[_0xbb58('0xb')]('ShowTrigger',_0x9d379f);logger[_0xbb58('0x1e')](_0xbb58('0x20'),_0x9d379f,JSON[_0xbb58('0xf')](_0x86372e));_0x643e0e(_0x86372e);})[_0xbb58('0x1f')](function(_0x1b86a6){logger[_0xbb58('0x10')](_0xbb58('0x20'),_0x1b86a6[_0xbb58('0x12')],_0x9d379f);_0x3f8db3(_0x1ba526['error'](0x1f4,_0x1b86a6[_0xbb58('0x12')]));});});}; \ No newline at end of file +var _0x3423=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Trigger,\x20%s,\x20%s','stringify','error','code','message','info','result','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowTrigger','find','debug','moment','bluebird','randomstring','ioredis'];(function(_0x10c5fd,_0x15a9b6){var _0x2be2a7=function(_0x1183b2){while(--_0x1183b2){_0x10c5fd['push'](_0x10c5fd['shift']());}};_0x2be2a7(++_0x15a9b6);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3342('0x0'));var BPromise=require(_0x3342('0x1'));var rs=require(_0x3342('0x2'));var fs=require('fs');var Redis=require(_0x3342('0x3'));var db=require(_0x3342('0x4'))['db'];var utils=require(_0x3342('0x5'));var logger=require(_0x3342('0x6'))(_0x3342('0x7'));var config=require(_0x3342('0x8'));var jayson=require(_0x3342('0x9'));var client=jayson[_0x3342('0xa')][_0x3342('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29c40c,_0x420d4b,_0x76422d){return new BPromise(function(_0xce08ab,_0x305d13){return client[_0x3342('0xc')](_0x29c40c,_0x76422d)[_0x3342('0xd')](function(_0x4ae4f3){logger['info'](_0x3342('0xe'),_0x420d4b,'request\x20sent');logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x420d4b,'request\x20sent',JSON[_0x3342('0xf')](_0x4ae4f3));if(_0x4ae4f3[_0x3342('0x10')]){if(_0x4ae4f3['error'][_0x3342('0x11')]===0x1f4){logger['error'](_0x3342('0xe'),_0x420d4b,_0x4ae4f3[_0x3342('0x10')]['message']);return _0x305d13(_0x4ae4f3[_0x3342('0x10')][_0x3342('0x12')]);}logger[_0x3342('0x10')](_0x3342('0xe'),_0x420d4b,_0x4ae4f3[_0x3342('0x10')][_0x3342('0x12')]);return _0xce08ab(_0x4ae4f3[_0x3342('0x10')]['message']);}else{logger[_0x3342('0x13')](_0x3342('0xe'),_0x420d4b,'request\x20sent');_0xce08ab(_0x4ae4f3[_0x3342('0x14')][_0x3342('0x12')]);}})['catch'](function(_0x554f9c){logger[_0x3342('0x10')](_0x3342('0xe'),_0x420d4b,_0x554f9c);_0x305d13(_0x554f9c);});});}exports[_0x3342('0x15')]=function(_0x2075cb){var _0x12947a=this;return new Promise(function(_0x156c24,_0x45a3ca){return db[_0x3342('0x16')][_0x3342('0x17')]({'raw':_0x2075cb['options']?_0x2075cb[_0x3342('0x18')][_0x3342('0x19')]===undefined?!![]:![]:!![],'where':_0x2075cb[_0x3342('0x18')]?_0x2075cb['options'][_0x3342('0x1a')]||null:null,'attributes':_0x2075cb[_0x3342('0x18')]?_0x2075cb['options'][_0x3342('0x1b')]||null:null,'limit':_0x2075cb[_0x3342('0x18')]?_0x2075cb['options'][_0x3342('0x1c')]||null:null,'include':_0x2075cb['options']?_0x2075cb[_0x3342('0x18')][_0x3342('0x1d')]?_[_0x3342('0x1e')](_0x2075cb[_0x3342('0x18')][_0x3342('0x1d')],function(_0x2925a2){return{'model':db[_0x2925a2[_0x3342('0x1f')]],'as':_0x2925a2['as'],'attributes':_0x2925a2[_0x3342('0x1b')],'include':_0x2925a2['include']?_[_0x3342('0x1e')](_0x2925a2['include'],function(_0x51cf45){return{'model':db[_0x51cf45[_0x3342('0x1f')]],'as':_0x51cf45['as'],'attributes':_0x51cf45['attributes'],'include':_0x51cf45['include']?_[_0x3342('0x1e')](_0x51cf45['include'],function(_0x37df78){return{'model':db[_0x37df78['model']],'as':_0x37df78['as'],'attributes':_0x37df78['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1497d9){logger[_0x3342('0x13')](_0x3342('0x15'),_0x2075cb);logger['debug'](_0x3342('0x15'),_0x2075cb,JSON[_0x3342('0xf')](_0x1497d9));_0x156c24(_0x1497d9);})[_0x3342('0x20')](function(_0x272a52){logger['error'](_0x3342('0x15'),_0x272a52[_0x3342('0x12')],_0x2075cb);_0x45a3ca(_0x12947a[_0x3342('0x10')](0x1f4,_0x272a52[_0x3342('0x12')]));});});};exports[_0x3342('0x21')]=function(_0x2cc691){var _0x135760=this;return new Promise(function(_0x47b2a0,_0x2e0bde){return db['Trigger'][_0x3342('0x22')]({'raw':_0x2cc691[_0x3342('0x18')]?_0x2cc691['options'][_0x3342('0x19')]===undefined?!![]:![]:!![],'where':_0x2cc691[_0x3342('0x18')]?_0x2cc691[_0x3342('0x18')][_0x3342('0x1a')]||null:null,'attributes':_0x2cc691['options']?_0x2cc691[_0x3342('0x18')][_0x3342('0x1b')]||null:null,'include':_0x2cc691[_0x3342('0x18')]?_0x2cc691[_0x3342('0x18')][_0x3342('0x1d')]?_[_0x3342('0x1e')](_0x2cc691[_0x3342('0x18')][_0x3342('0x1d')],function(_0x2531fb){return{'model':db[_0x2531fb[_0x3342('0x1f')]],'as':_0x2531fb['as'],'attributes':_0x2531fb[_0x3342('0x1b')],'include':_0x2531fb[_0x3342('0x1d')]?_['map'](_0x2531fb['include'],function(_0x1dc9b3){return{'model':db[_0x1dc9b3['model']],'as':_0x1dc9b3['as'],'attributes':_0x1dc9b3[_0x3342('0x1b')],'include':_0x1dc9b3[_0x3342('0x1d')]?_[_0x3342('0x1e')](_0x1dc9b3[_0x3342('0x1d')],function(_0x2dbc02){return{'model':db[_0x2dbc02[_0x3342('0x1f')]],'as':_0x2dbc02['as'],'attributes':_0x2dbc02[_0x3342('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4754d9){logger[_0x3342('0x13')](_0x3342('0x21'),_0x2cc691);logger[_0x3342('0x23')](_0x3342('0x21'),_0x2cc691,JSON['stringify'](_0x4754d9));_0x47b2a0(_0x4754d9);})[_0x3342('0x20')](function(_0x4d1a59){logger[_0x3342('0x10')](_0x3342('0x21'),_0x4d1a59[_0x3342('0x12')],_0x2cc691);_0x2e0bde(_0x135760[_0x3342('0x10')](0x1f4,_0x4d1a59['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index c268f31..f770ab2 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 _0xcda9=['express','Router','fs-extra','./trunk.controller','get','isAuthenticated','/:id','post','/:id/clone','put','update','destroy','exports','util','connect-timeout'];(function(_0x152078,_0x4b90c5){var _0x1f6c2b=function(_0x2fac4b){while(--_0x2fac4b){_0x152078['push'](_0x152078['shift']());}};_0x1f6c2b(++_0x4b90c5);}(_0xcda9,0xb2));var _0x9cda=function(_0x588457,_0x2a1fe9){_0x588457=_0x588457-0x0;var _0x642552=_0xcda9[_0x588457];return _0x642552;};'use strict';var multer=require('multer');var util=require(_0x9cda('0x0'));var path=require('path');var timeout=require(_0x9cda('0x1'));var express=require(_0x9cda('0x2'));var router=express[_0x9cda('0x3')]();var fs_extra=require(_0x9cda('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9cda('0x5'));router[_0x9cda('0x6')]('/',auth[_0x9cda('0x7')](),controller['index']);router['get'](_0x9cda('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x9cda('0x9')](_0x9cda('0xa'),auth['isAuthenticated'](),controller['clone']);router[_0x9cda('0x9')]('/',auth[_0x9cda('0x7')](),controller['create']);router[_0x9cda('0xb')](_0x9cda('0x8'),auth[_0x9cda('0x7')](),controller[_0x9cda('0xc')]);router['delete'](_0x9cda('0x8'),auth['isAuthenticated'](),controller[_0x9cda('0xd')]);module[_0x9cda('0xe')]=router; \ No newline at end of file +var _0x79e5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id/clone','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x595bd1,_0xb1e7a){var _0xd0344f=function(_0x5eb2fd){while(--_0x5eb2fd){_0x595bd1['push'](_0x595bd1['shift']());}};_0xd0344f(++_0xb1e7a);}(_0x79e5,0x164));var _0x579e=function(_0xe9719d,_0x455de9){_0xe9719d=_0xe9719d-0x0;var _0x6feead=_0x79e5[_0xe9719d];return _0x6feead;};'use strict';var multer=require(_0x579e('0x0'));var util=require(_0x579e('0x1'));var path=require('path');var timeout=require(_0x579e('0x2'));var express=require(_0x579e('0x3'));var router=express[_0x579e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x579e('0x5'));var interaction=require(_0x579e('0x6'));var config=require(_0x579e('0x7'));var controller=require(_0x579e('0x8'));router[_0x579e('0x9')]('/',auth[_0x579e('0xa')](),controller[_0x579e('0xb')]);router[_0x579e('0x9')]('/:id',auth[_0x579e('0xa')](),controller['show']);router['post'](_0x579e('0xc'),auth[_0x579e('0xa')](),controller['clone']);router['post']('/',auth[_0x579e('0xa')](),controller[_0x579e('0xd')]);router[_0x579e('0xe')](_0x579e('0xf'),auth[_0x579e('0xa')](),controller[_0x579e('0x10')]);router[_0x579e('0x11')](_0x579e('0xf'),auth[_0x579e('0xa')](),controller[_0x579e('0x12')]);module[_0x579e('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index f4aa9b7..86a2e5f 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 _0xb6f9=['outgoing','setDataValue','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','yes','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','originate','uas','pai','fingerprint','certificate','active','passive','dynamic','BOOLEAN','sequelize','exports','ENUM','friend','user','peer','STRING','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','split','rfc2833','info','shortinfo','inband','auto','nonat','update'];(function(_0x3c0a69,_0x3d812b){var _0x272af2=function(_0x3389df){while(--_0x3389df){_0x3c0a69['push'](_0x3c0a69['shift']());}};_0x272af2(++_0x3d812b);}(_0xb6f9,0x10e));var _0x9b6f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb6f9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9b6f('0x0'));module[_0x9b6f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9b6f('0x2')](_0x9b6f('0x3'),_0x9b6f('0x4'),_0x9b6f('0x5')),'allowNull':![],'defaultValue':_0x9b6f('0x3')},'context':{'type':Sequelize[_0x9b6f('0x6')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0x9b6f('0x7'),_0x9b6f('0x8'),_0x9b6f('0x9'),_0x9b6f('0xa'),_0x9b6f('0xb'),_0x9b6f('0xc'),_0x9b6f('0xd'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x9b6f('0x6')]},'secret':{'type':Sequelize[_0x9b6f('0x6')]},'md5secret':{'type':Sequelize[_0x9b6f('0x6')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x9b6f('0x6')],'defaultValue':_0x9b6f('0xe'),'set':function(_0x2db4b6){this['setDataValue'](_0x9b6f('0xf'),_0x2db4b6?_0x2db4b6['join'](','):null);},'get':function(){return this['getDataValue'](_0x9b6f('0xf'))?this['getDataValue'](_0x9b6f('0xf'))[_0x9b6f('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x9b6f('0x2')](_0x9b6f('0x11'),_0x9b6f('0x12'),_0x9b6f('0x13'),_0x9b6f('0x14'),_0x9b6f('0x15')),'defaultValue':_0x9b6f('0x11')},'directmedia':{'type':Sequelize[_0x9b6f('0x2')]('yes','no',_0x9b6f('0x16'),_0x9b6f('0x17'),_0x9b6f('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9b6f('0x2')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9b6f('0x6')]},'directmediadeny':{'type':Sequelize[_0x9b6f('0x6')]},'nat':{'type':Sequelize[_0x9b6f('0x6')],'defaultValue':'force_rport,comedia','set':function(_0x4f954f){this[_0x9b6f('0x19')]('nat',_0x4f954f?_0x4f954f[_0x9b6f('0x1a')](','):null);},'get':function(){return this[_0x9b6f('0x1b')]('nat')?this['getDataValue']('nat')[_0x9b6f('0x10')](','):null;},'comment':_0x9b6f('0x1c')},'callgroup':{'type':Sequelize[_0x9b6f('0x6')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x9b6f('0x6')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9b6f('0x6')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x9b6f('0x6')],'defaultValue':_0x9b6f('0x1d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9b6f('0x1e'),'set':function(_0x15c1e1){this[_0x9b6f('0x19')](_0x9b6f('0x1f'),_0x15c1e1?_0x15c1e1[_0x9b6f('0x1a')](';'):_0x9b6f('0x1e'));},'get':function(){return this[_0x9b6f('0x1b')](_0x9b6f('0x1f'))?this[_0x9b6f('0x1b')](_0x9b6f('0x1f'))[_0x9b6f('0x10')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x9b6f('0x2')](_0x9b6f('0x20'),'no')},'insecure':{'type':Sequelize[_0x9b6f('0x6')],'defaultValue':_0x9b6f('0x21'),'set':function(_0x373b94){this[_0x9b6f('0x19')](_0x9b6f('0x22'),_0x373b94?_0x373b94[_0x9b6f('0x1a')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x9b6f('0x1b')](_0x9b6f('0x22'))['split'](','):null;},'comment':_0x9b6f('0x23')},'trustrpid':{'type':Sequelize[_0x9b6f('0x2')](_0x9b6f('0x20'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9b6f('0x2')](_0x9b6f('0x20'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9b6f('0x2')](_0x9b6f('0x20'),'no','never')},'promiscredir':{'type':Sequelize[_0x9b6f('0x2')](_0x9b6f('0x20'),'no')},'useclientcode':{'type':Sequelize[_0x9b6f('0x2')]('yes','no')},'accountcode':{'type':Sequelize[_0x9b6f('0x24')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9b6f('0x6')],'defaultValue':_0x9b6f('0x25')},'amaflags':{'type':Sequelize[_0x9b6f('0x6')]},'callcounter':{'type':Sequelize['ENUM'](_0x9b6f('0x20'),'no'),'defaultValue':_0x9b6f('0x20')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x9b6f('0x20'),'no')},'allowsubscribe':{'type':Sequelize[_0x9b6f('0x2')](_0x9b6f('0x20'),'no')},'allowtransfer':{'type':Sequelize[_0x9b6f('0x2')](_0x9b6f('0x20'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x9b6f('0x20'),'no')},'subscribecontext':{'type':Sequelize[_0x9b6f('0x6')]},'template':{'type':Sequelize[_0x9b6f('0x6')]},'videosupport':{'type':Sequelize['ENUM'](_0x9b6f('0x20'),'no',_0x9b6f('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9b6f('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x9b6f('0x2')]('yes','no')},'mailbox':{'type':Sequelize[_0x9b6f('0x6')]},'session_timers':{'type':Sequelize[_0x9b6f('0x2')](_0x9b6f('0x27'),'refuse',_0x9b6f('0x28'))},'session_expires':{'type':Sequelize[_0x9b6f('0x24')](0xb)},'session_minse':{'type':Sequelize[_0x9b6f('0x24')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac',_0x9b6f('0x29')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x9b6f('0x6')]},'fromdomain':{'type':Sequelize[_0x9b6f('0x6')]},'fromuser':{'type':Sequelize[_0x9b6f('0x6')]},'port':{'type':Sequelize[_0x9b6f('0x24')](0x5)},'qualify':{'type':Sequelize[_0x9b6f('0x2')]('yes','no'),'defaultValue':_0x9b6f('0x20')},'keepalive':{'type':Sequelize[_0x9b6f('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x9b6f('0x6')]},'defaultuser':{'type':Sequelize[_0x9b6f('0x6')]},'rtptimeout':{'type':Sequelize[_0x9b6f('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x9b6f('0x20'),'no',_0x9b6f('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9b6f('0x6')]},'callbackextension':{'type':Sequelize[_0x9b6f('0x6')]},'timert1':{'type':Sequelize[_0x9b6f('0x24')](0xb)},'timerb':{'type':Sequelize[_0x9b6f('0x24')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x9b6f('0x6')]},'contactdeny':{'type':Sequelize[_0x9b6f('0x6')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x9b6f('0x6')]},'use_q850_reason':{'type':Sequelize[_0x9b6f('0x6')]},'maxforwards':{'type':Sequelize[_0x9b6f('0x24')](0xb)},'encryption':{'type':Sequelize[_0x9b6f('0x2')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9b6f('0x2')](_0x9b6f('0x20'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x9b6f('0x20'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x9b6f('0x20'),'no')},'dtlsenable':{'type':Sequelize[_0x9b6f('0x2')](_0x9b6f('0x20'),'no')},'dtlsverify':{'type':Sequelize[_0x9b6f('0x2')](_0x9b6f('0x20'),'no',_0x9b6f('0x2b'),_0x9b6f('0x2c'))},'dtlsrekey':{'type':Sequelize[_0x9b6f('0x24')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x9b6f('0x6')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x9b6f('0x6')]},'dtlssetup':{'type':Sequelize[_0x9b6f('0x2')](_0x9b6f('0x2d'),_0x9b6f('0x2e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9b6f('0x6')]},'usereqphone':{'type':Sequelize[_0x9b6f('0x2')](_0x9b6f('0x20'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9b6f('0x6')]},'recordofffeature':{'type':Sequelize[_0x9b6f('0x6')]},'call_limit':{'type':Sequelize[_0x9b6f('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x9b6f('0x2')](_0x9b6f('0x20'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x9b6f('0x20'),'no')},'vmexten':{'type':Sequelize[_0x9b6f('0x6')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x9b6f('0x6')]},'parkinglot':{'type':Sequelize[_0x9b6f('0x6')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x9b6f('0x2f')},'canreinvite':{'type':Sequelize['ENUM'](_0x9b6f('0x20'),'no',_0x9b6f('0x16'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x9b6f('0x6')]},'otherFields':{'type':Sequelize[_0x9b6f('0x6')]},'active':{'type':Sequelize[_0x9b6f('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xc2f3=['setDataValue','transport','join','getDataValue','split','rfc2833','auto','yes','update','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','accept','refuse','uac','uas','pai','fingerprint','active','actpass','dynamic','nonat','update,nonat','BOOLEAN','exports','name','ENUM','peer','STRING','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','PROHIB'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc2f3,0x1ee));var _0x3c2f=function(_0x24b541,_0x36acf3){_0x24b541=_0x24b541-0x0;var _0x278938=_0xc2f3[_0x24b541];return _0x278938;};'use strict';var Sequelize=require('sequelize');module[_0x3c2f('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3c2f('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3c2f('0x2')]('friend','user',_0x3c2f('0x3')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x3c2f('0x4')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x3c2f('0x2')](_0x3c2f('0x5'),_0x3c2f('0x6'),'ALLOWED_FAILED_SCREEN',_0x3c2f('0x7'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0x3c2f('0x8'),_0x3c2f('0x9'))},'deny':{'type':Sequelize[_0x3c2f('0x4')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x3c2f('0x4')]},'remotesecret':{'type':Sequelize[_0x3c2f('0x4')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x3c8eba){this[_0x3c2f('0xa')](_0x3c2f('0xb'),_0x3c8eba?_0x3c8eba[_0x3c2f('0xc')](','):null);},'get':function(){return this[_0x3c2f('0xd')](_0x3c2f('0xb'))?this['getDataValue'](_0x3c2f('0xb'))[_0x3c2f('0xe')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x3c2f('0x2')](_0x3c2f('0xf'),'info','shortinfo','inband',_0x3c2f('0x10')),'defaultValue':_0x3c2f('0xf')},'directmedia':{'type':Sequelize[_0x3c2f('0x2')](_0x3c2f('0x11'),'no','nonat',_0x3c2f('0x12'),_0x3c2f('0x13')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3c2f('0x2')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x3c2f('0x4')]},'nat':{'type':Sequelize[_0x3c2f('0x4')],'defaultValue':_0x3c2f('0x14'),'set':function(_0x581d2b){this[_0x3c2f('0xa')](_0x3c2f('0x15'),_0x581d2b?_0x581d2b['join'](','):null);},'get':function(){return this[_0x3c2f('0xd')](_0x3c2f('0x15'))?this[_0x3c2f('0xd')](_0x3c2f('0x15'))[_0x3c2f('0xe')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x3c2f('0x4')]},'pickupgroup':{'type':Sequelize[_0x3c2f('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x3c2f('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3c2f('0x4')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x3c2f('0x4')],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3c2f('0x16'),'set':function(_0x536cbb){this[_0x3c2f('0xa')](_0x3c2f('0x17'),_0x536cbb?_0x536cbb['join'](';'):_0x3c2f('0x16'));},'get':function(){return this[_0x3c2f('0xd')](_0x3c2f('0x17'))?this[_0x3c2f('0xd')](_0x3c2f('0x17'))[_0x3c2f('0xe')](';'):null;},'comment':_0x3c2f('0x18')},'autoframing':{'type':Sequelize[_0x3c2f('0x2')](_0x3c2f('0x11'),'no')},'insecure':{'type':Sequelize[_0x3c2f('0x4')],'defaultValue':'port,invite','set':function(_0x529a65){this[_0x3c2f('0xa')](_0x3c2f('0x19'),_0x529a65?_0x529a65[_0x3c2f('0xc')](','):null);},'get':function(){return this[_0x3c2f('0xd')](_0x3c2f('0x19'))?this['getDataValue'](_0x3c2f('0x19'))[_0x3c2f('0xe')](','):null;},'comment':_0x3c2f('0x1a')},'trustrpid':{'type':Sequelize[_0x3c2f('0x2')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3c2f('0x2')](_0x3c2f('0x11'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3c2f('0x2')](_0x3c2f('0x11'),'no',_0x3c2f('0x1b'))},'promiscredir':{'type':Sequelize[_0x3c2f('0x2')](_0x3c2f('0x11'),'no')},'useclientcode':{'type':Sequelize[_0x3c2f('0x2')]('yes','no')},'accountcode':{'type':Sequelize[_0x3c2f('0x1c')](0xb)},'setvar':{'type':Sequelize[_0x3c2f('0x4')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x3c2f('0x1d')},'amaflags':{'type':Sequelize[_0x3c2f('0x4')]},'callcounter':{'type':Sequelize[_0x3c2f('0x2')](_0x3c2f('0x11'),'no'),'defaultValue':_0x3c2f('0x11')},'busylevel':{'type':Sequelize[_0x3c2f('0x1c')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x3c2f('0x11'),'no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0x3c2f('0x2')](_0x3c2f('0x11'),'no')},'ignoresdpversion':{'type':Sequelize[_0x3c2f('0x2')](_0x3c2f('0x11'),'no')},'subscribecontext':{'type':Sequelize[_0x3c2f('0x4')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM']('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3c2f('0x2')](_0x3c2f('0x11'),'no')},'mailbox':{'type':Sequelize[_0x3c2f('0x4')]},'session_timers':{'type':Sequelize[_0x3c2f('0x2')](_0x3c2f('0x1e'),_0x3c2f('0x1f'),'originate')},'session_expires':{'type':Sequelize[_0x3c2f('0x1c')](0xb)},'session_minse':{'type':Sequelize[_0x3c2f('0x1c')](0xb)},'session_refresher':{'type':Sequelize[_0x3c2f('0x2')](_0x3c2f('0x20'),_0x3c2f('0x21')),'defaultValue':_0x3c2f('0x21')},'t38pt_usertpsource':{'type':Sequelize[_0x3c2f('0x4')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x3c2f('0x4')]},'fromuser':{'type':Sequelize[_0x3c2f('0x4')]},'port':{'type':Sequelize[_0x3c2f('0x1c')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x3c2f('0x11'),'no'),'defaultValue':_0x3c2f('0x11')},'keepalive':{'type':Sequelize[_0x3c2f('0x1c')](0xb)},'defaultip':{'type':Sequelize[_0x3c2f('0x4')]},'defaultuser':{'type':Sequelize[_0x3c2f('0x4')]},'rtptimeout':{'type':Sequelize[_0x3c2f('0x1c')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3c2f('0x1c')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x3c2f('0x2')](_0x3c2f('0x11'),'no',_0x3c2f('0x22')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3c2f('0x4')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x3c2f('0x1c')](0xb)},'timerb':{'type':Sequelize[_0x3c2f('0x1c')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3c2f('0x1c')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x3c2f('0x4')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x3c2f('0x4')]},'use_q850_reason':{'type':Sequelize[_0x3c2f('0x4')]},'maxforwards':{'type':Sequelize[_0x3c2f('0x1c')](0xb)},'encryption':{'type':Sequelize[_0x3c2f('0x2')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3c2f('0x2')](_0x3c2f('0x11'),'no')},'force_avp':{'type':Sequelize[_0x3c2f('0x2')](_0x3c2f('0x11'),'no')},'icesupport':{'type':Sequelize[_0x3c2f('0x2')](_0x3c2f('0x11'),'no')},'dtlsenable':{'type':Sequelize[_0x3c2f('0x2')](_0x3c2f('0x11'),'no')},'dtlsverify':{'type':Sequelize[_0x3c2f('0x2')](_0x3c2f('0x11'),'no',_0x3c2f('0x23'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x3c2f('0x1c')](0xb)},'dtlscertfile':{'type':Sequelize[_0x3c2f('0x4')]},'dtlsprivatekey':{'type':Sequelize[_0x3c2f('0x4')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x3c2f('0x4')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x3c2f('0x24'),'passive',_0x3c2f('0x25')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3c2f('0x4')]},'usereqphone':{'type':Sequelize[_0x3c2f('0x2')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x3c2f('0x4')]},'call_limit':{'type':Sequelize[_0x3c2f('0x1c')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3c2f('0x2')](_0x3c2f('0x11'),'no')},'subscribemwi':{'type':Sequelize[_0x3c2f('0x2')](_0x3c2f('0x11'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x3c2f('0x4')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x3c2f('0x4')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x3c2f('0x4')],'defaultValue':_0x3c2f('0x26')},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x3c2f('0x27'),_0x3c2f('0x12'),_0x3c2f('0x28')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x3c2f('0x4')]},'otherFields':{'type':Sequelize[_0x3c2f('0x4')]},'active':{'type':Sequelize[_0x3c2f('0x29')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x3c2f('0x4')],'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 8620225..fd25d64 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 _0x248f=['code','message','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','destroy','Trunks','stack','name','send','map','Trunk','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','find','get','createdAt','updatedAt','omit','body','create','user','role','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_registers.conf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3906f4,_0x394d5a){var _0x48fba9=function(_0xce0f4c){while(--_0xce0f4c){_0x3906f4['push'](_0x3906f4['shift']());}};_0x48fba9(++_0x394d5a);}(_0x248f,0xb8));var _0xf248=function(_0x52df16,_0x7f90cf){_0x52df16=_0x52df16-0x0;var _0x34fc58=_0x248f[_0x52df16];return _0x34fc58;};'use strict';var emlformat=require(_0xf248('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf248('0x1'));var jsonpatch=require(_0xf248('0x2'));var rp=require(_0xf248('0x3'));var moment=require(_0xf248('0x4'));var BPromise=require(_0xf248('0x5'));var Mustache=require(_0xf248('0x6'));var util=require('util');var path=require(_0xf248('0x7'));var sox=require('sox');var csv=require(_0xf248('0x8'));var ejs=require(_0xf248('0x9'));var fs=require('fs');var fs_extra=require(_0xf248('0xa'));var _=require(_0xf248('0xb'));var squel=require('squel');var crypto=require(_0xf248('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf248('0xd'));var toCsv=require(_0xf248('0x8'));var querystring=require('querystring');var Papa=require(_0xf248('0xe'));var Redis=require(_0xf248('0xf'));var authService=require(_0xf248('0x10'));var qs=require(_0xf248('0x11'));var as=require(_0xf248('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf248('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xf248('0x14'));var licenseUtil=require(_0xf248('0x15'));var db=require(_0xf248('0x16'))['db'];var jayson=require(_0xf248('0x17'));var client=jayson[_0xf248('0x18')][_0xf248('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2915a7,_0x5da82c,_0x212e8a,_0x351057){return new BPromise(function(_0x3ee4b6,_0xe62cc8){var _0x24faed=_0x351057||client;return _0x24faed['request'](_0x2915a7,_0x212e8a)[_0xf248('0x1a')](function(_0x53a2fd){logger[_0xf248('0x1b')](_0xf248('0x1c'),_0x5da82c,_0xf248('0x1d'));logger[_0xf248('0x1e')](_0xf248('0x1f'),_0x5da82c,_0xf248('0x1d'),JSON[_0xf248('0x20')](_0x53a2fd));if(_0x53a2fd['error']){if(_0x53a2fd[_0xf248('0x21')][_0xf248('0x22')]===0x1f4){logger[_0xf248('0x21')](_0xf248('0x1c'),_0x5da82c,_0x53a2fd[_0xf248('0x21')][_0xf248('0x23')]);return _0xe62cc8(_0x53a2fd[_0xf248('0x21')][_0xf248('0x23')]);}logger[_0xf248('0x21')](_0xf248('0x1c'),_0x5da82c,_0x53a2fd[_0xf248('0x21')][_0xf248('0x23')]);return _0x3ee4b6(_0x53a2fd['error'][_0xf248('0x23')]);}else{logger[_0xf248('0x1b')](_0xf248('0x1c'),_0x5da82c,_0xf248('0x1d'));_0x3ee4b6(_0x53a2fd['result'][_0xf248('0x23')]);}})['catch'](function(_0x2d3a7a){logger['error'](_0xf248('0x1c'),_0x5da82c,_0x2d3a7a);_0xe62cc8(_0x2d3a7a);});});}function respondWithStatusCode(_0x385ace,_0xea885d){_0xea885d=_0xea885d||0xcc;return function(_0x19ceab){if(_0x19ceab){return _0x385ace[_0xf248('0x24')](_0xea885d);}return _0x385ace[_0xf248('0x25')](_0xea885d)[_0xf248('0x26')]();};}function respondWithResult(_0x20e77e,_0x524d61){_0x524d61=_0x524d61||0xc8;return function(_0x2b662c){if(_0x2b662c){return _0x20e77e[_0xf248('0x25')](_0x524d61)[_0xf248('0x27')](_0x2b662c);}};}function respondWithFilteredResult(_0x114246,_0x20b561){return function(_0x6773e8){if(_0x6773e8){var _0x27812c=_0x6773e8[_0xf248('0x28')],_0x599a8a=_0x20b561[_0xf248('0x29')],_0x3641a7=_0x20b561[_0xf248('0x29')]+_0x20b561[_0xf248('0x2a')],_0x597b14;if(_0x3641a7>=_0x27812c){_0x3641a7=_0x27812c;_0x597b14=0xc8;}else{_0x597b14=0xce;}_0x114246[_0xf248('0x25')](_0x597b14);return _0x114246[_0xf248('0x2b')]('Content-Range',_0x599a8a+'-'+_0x3641a7+'/'+_0x27812c)[_0xf248('0x27')](_0x6773e8);}return null;};}function patchUpdates(_0x12ac25){return function(_0x264f80){try{jsonpatch['apply'](_0x264f80,_0x12ac25,!![]);}catch(_0x22feb7){return BPromise[_0xf248('0x2c')](_0x22feb7);}return _0x264f80[_0xf248('0x2d')]();};}function saveUpdates(_0x5eb04d,_0x4556c1){return function(_0x35153f){if(_0x35153f){return _0x35153f[_0xf248('0x2e')](_0x5eb04d)[_0xf248('0x1a')](function(_0x3c3e9e){return _0x3c3e9e;});}return null;};}function removeEntity(_0x45720e,_0x23b3d0){return function(_0x54f821){if(_0x54f821){return _0x54f821[_0xf248('0x2f')]()[_0xf248('0x1a')](function(){var _0x11b252=_0x54f821['get']({'plain':!![]});var _0x4835c3=_0xf248('0x30');return db['UserProfileResource']['destroy']({'where':{'type':_0x4835c3,'resourceId':_0x11b252['id']}})[_0xf248('0x1a')](function(){return _0x54f821;});})[_0xf248('0x1a')](function(){_0x45720e['status'](0xcc)[_0xf248('0x26')]();});}};}function handleEntityNotFound(_0x4535c8,_0x4104b1){return function(_0x135e25){if(!_0x135e25){_0x4535c8[_0xf248('0x24')](0x194);}return _0x135e25;};}function handleError(_0x294c95,_0x2376ba){_0x2376ba=_0x2376ba||0x1f4;return function(_0x15d6b4){logger[_0xf248('0x21')](_0x15d6b4[_0xf248('0x31')]);if(_0x15d6b4[_0xf248('0x32')]){delete _0x15d6b4[_0xf248('0x32')];}_0x294c95['status'](_0x2376ba)[_0xf248('0x33')](_0x15d6b4);};}exports['index']=function(_0x306504,_0x547277){var _0x355c93={},_0x5472ac={},_0x4744bc={'count':0x0,'rows':[]};var _0x183dab=_[_0xf248('0x34')](db[_0xf248('0x35')][_0xf248('0x36')],function(_0x55ce6a){return{'name':_0x55ce6a[_0xf248('0x37')],'type':_0x55ce6a[_0xf248('0x38')][_0xf248('0x39')]};});_0x5472ac[_0xf248('0x3a')]=_[_0xf248('0x34')](_0x183dab,'name');_0x5472ac['query']=_['keys'](_0x306504[_0xf248('0x3b')]);_0x5472ac[_0xf248('0x3c')]=_[_0xf248('0x3d')](_0x5472ac[_0xf248('0x3a')],_0x5472ac['query']);_0x355c93[_0xf248('0x3e')]=_[_0xf248('0x3d')](_0x5472ac['model'],qs[_0xf248('0x3f')](_0x306504[_0xf248('0x3b')][_0xf248('0x3f')]));_0x355c93['attributes']=_0x355c93[_0xf248('0x3e')][_0xf248('0x40')]?_0x355c93['attributes']:_0x5472ac['model'];if(!_0x306504[_0xf248('0x3b')][_0xf248('0x41')](_0xf248('0x42'))){_0x355c93[_0xf248('0x2a')]=qs[_0xf248('0x2a')](_0x306504[_0xf248('0x3b')][_0xf248('0x2a')]);_0x355c93[_0xf248('0x29')]=qs['offset'](_0x306504[_0xf248('0x3b')][_0xf248('0x29')]);}_0x355c93[_0xf248('0x43')]=qs['sort'](_0x306504[_0xf248('0x3b')][_0xf248('0x44')]);_0x355c93[_0xf248('0x45')]=qs['filters'](_['pick'](_0x306504[_0xf248('0x3b')],_0x5472ac['filters']),_0x183dab);if(_0x306504['query'][_0xf248('0x46')]){_0x355c93[_0xf248('0x45')]=_[_0xf248('0x47')](_0x355c93[_0xf248('0x45')],{'$or':_[_0xf248('0x34')](_0x183dab,function(_0x3ce016){if(_0x3ce016[_0xf248('0x38')]!=='VIRTUAL'){var _0x181752={};_0x181752[_0x3ce016[_0xf248('0x32')]]={'$like':'%'+_0x306504['query'][_0xf248('0x46')]+'%'};return _0x181752;}})});}_0x355c93=_[_0xf248('0x47')]({},_0x355c93,_0x306504[_0xf248('0x48')]);var _0x2d491f={'where':_0x355c93[_0xf248('0x45')]};return db[_0xf248('0x35')][_0xf248('0x28')](_0x2d491f)[_0xf248('0x1a')](function(_0x3df9a0){_0x4744bc[_0xf248('0x28')]=_0x3df9a0;if(_0x306504[_0xf248('0x3b')][_0xf248('0x49')]){_0x355c93['include']=[{'all':!![]}];}return db[_0xf248('0x35')][_0xf248('0x4a')](_0x355c93);})[_0xf248('0x1a')](function(_0x28f645){_0x4744bc[_0xf248('0x4b')]=_0x28f645;return _0x4744bc;})[_0xf248('0x1a')](respondWithFilteredResult(_0x547277,_0x355c93))[_0xf248('0x4c')](handleError(_0x547277,null));};exports[_0xf248('0x4d')]=function(_0x32b3e8,_0x17af41){var _0x1264f4={'raw':![],'where':{'id':_0x32b3e8[_0xf248('0x4e')]['id']}},_0x5404eb={};_0x5404eb[_0xf248('0x3a')]=_['keys'](db[_0xf248('0x35')][_0xf248('0x36')]);_0x5404eb[_0xf248('0x3b')]=_[_0xf248('0x4f')](_0x32b3e8['query']);_0x5404eb[_0xf248('0x3c')]=_[_0xf248('0x3d')](_0x5404eb[_0xf248('0x3a')],_0x5404eb[_0xf248('0x3b')]);_0x1264f4[_0xf248('0x3e')]=_[_0xf248('0x3d')](_0x5404eb[_0xf248('0x3a')],qs[_0xf248('0x3f')](_0x32b3e8['query'][_0xf248('0x3f')]));_0x1264f4[_0xf248('0x3e')]=_0x1264f4[_0xf248('0x3e')][_0xf248('0x40')]?_0x1264f4['attributes']:_0x5404eb[_0xf248('0x3a')];if(_0x32b3e8[_0xf248('0x3b')]['includeAll']){_0x1264f4[_0xf248('0x50')]=[{'all':!![]}];}_0x1264f4=_[_0xf248('0x47')]({},_0x1264f4,_0x32b3e8['options']);return db['Trunk']['find'](_0x1264f4)[_0xf248('0x1a')](handleEntityNotFound(_0x17af41,null))[_0xf248('0x1a')](respondWithResult(_0x17af41,null))[_0xf248('0x4c')](handleError(_0x17af41,null));};exports['clone']=function(_0x19fd5e,_0xe7150){var _0x26b2e7={'where':{'id':_0x19fd5e[_0xf248('0x4e')]['id']}},_0x140bd2={};_0x140bd2[_0xf248('0x3a')]=_[_0xf248('0x4f')](db['Trunk'][_0xf248('0x36')]);_0x26b2e7[_0xf248('0x3e')]=_['intersection'](_0x140bd2[_0xf248('0x3a')],qs[_0xf248('0x3f')](_0x19fd5e[_0xf248('0x3b')][_0xf248('0x3f')]));_0x26b2e7[_0xf248('0x3e')]=_0x26b2e7[_0xf248('0x3e')]['length']?_0x26b2e7[_0xf248('0x3e')]:_0x140bd2[_0xf248('0x3a')];if(_0x19fd5e[_0xf248('0x3b')]['includeAll']){_0x26b2e7[_0xf248('0x50')]=[{'all':!![]}];}_0x26b2e7=_[_0xf248('0x47')]({},_0x26b2e7,_0x19fd5e[_0xf248('0x48')]);return db[_0xf248('0x35')][_0xf248('0x51')](_0x26b2e7)[_0xf248('0x1a')](handleEntityNotFound(_0xe7150,null))[_0xf248('0x1a')](function(_0x3ef39c){if(_0x3ef39c){var _0x292f1a=_0x3ef39c[_0xf248('0x52')]({'plain':!![]});_0x292f1a=qs['omit'](_0x292f1a,['id',_0xf248('0x53'),_0xf248('0x54')]);_0x19fd5e['body']=_[_0xf248('0x55')](_0x19fd5e[_0xf248('0x56')],['id',_0xf248('0x53'),'updatedAt']);return db[_0xf248('0x35')][_0xf248('0x57')](_[_0xf248('0x47')](_0x292f1a,_0x19fd5e['body']),{'include':_0x19fd5e['query'][_0xf248('0x49')]?[{'all':!![]}]:undefined})[_0xf248('0x1a')](function(_0x289fab){var _0x3f022d=_0x19fd5e[_0xf248('0x58')]['get']({'plain':!![]});if(!_0x3f022d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f022d[_0xf248('0x59')]===_0xf248('0x58')){var _0x414bec=_0x289fab['get']({'plain':!![]});var _0x28be5b='Trunks';return db['UserProfileSection'][_0xf248('0x51')]({'where':{'name':_0x28be5b,'userProfileId':_0x3f022d['userProfileId']},'raw':!![]})['then'](function(_0x5a9b28){if(_0x5a9b28&&_0x5a9b28['autoAssociation']===0x0){return db[_0xf248('0x5a')][_0xf248('0x57')]({'name':_0x414bec['name'],'resourceId':_0x414bec['id'],'type':_0x5a9b28['name'],'sectionId':_0x5a9b28['id']},{})[_0xf248('0x1a')](function(){return _0x289fab;});}else{return _0x289fab;}})[_0xf248('0x4c')](function(_0x2671af){logger['error'](_0xf248('0x5b'),_0x2671af);throw _0x2671af;});}return _0x289fab;});}})[_0xf248('0x1a')](respondWithResult(_0xe7150,0xc9))['catch'](handleError(_0xe7150,null));};exports[_0xf248('0x57')]=function(_0x2bf5ff,_0x42d7ff,_0x9e1aad){var _0x4c742c;return db[_0xf248('0x35')][_0xf248('0x57')](_0x2bf5ff[_0xf248('0x56')],{'raw':!![]})[_0xf248('0x1a')](function(_0x52c13a){_0x4c742c=_0x52c13a;return db[_0xf248('0x35')][_0xf248('0x4a')]({'raw':!![]});})['then'](function(_0x17c733){var _0x478969=fs['readFileSync'](path[_0xf248('0x5c')](config[_0xf248('0x5d')],_0xf248('0x5e')),_0xf248('0x5f'));var _0x52bbde=fs[_0xf248('0x60')](path[_0xf248('0x5c')](config[_0xf248('0x5d')],'server/files/templates/registry.ejs'),_0xf248('0x5f'));var _0x3f0acd=ejs[_0xf248('0x61')](_0x478969,{'trunks':_0x17c733||[]});fs[_0xf248('0x62')](_0xf248('0x63'),_0x3f0acd);if(_0x4c742c[_0xf248('0x64')]){var _0x591d41=ejs[_0xf248('0x61')](_0x52bbde,{'trunks':_0x17c733||[]});fs[_0xf248('0x62')]('/etc/asterisk/sip_xcally_registers.conf',_0x591d41);}})[_0xf248('0x1a')](function(){return respondWithRpcPromise(_0xf248('0x65'),_0xf248('0x57'),{'module':_0xf248('0x66')});})[_0xf248('0x1a')](function(){var _0x19434a=_0x2bf5ff[_0xf248('0x58')][_0xf248('0x52')]({'plain':!![]});if(!_0x19434a)throw new Error(_0xf248('0x67'));if(_0x19434a[_0xf248('0x59')]==='user'){var _0x35dbea=_0x4c742c[_0xf248('0x52')]({'plain':!![]});return db[_0xf248('0x68')][_0xf248('0x51')]({'where':{'name':_0xf248('0x30'),'userProfileId':_0x19434a[_0xf248('0x69')]},'raw':!![]})['then'](function(_0x1715e1){if(_0x1715e1&&_0x1715e1[_0xf248('0x6a')]===0x0){return db[_0xf248('0x5a')][_0xf248('0x57')]({'name':_0x35dbea['name'],'resourceId':_0x35dbea['id'],'type':_0x1715e1[_0xf248('0x32')],'sectionId':_0x1715e1['id']},{})['then'](function(){return _0x4c742c;});}else{return _0x4c742c;}})[_0xf248('0x4c')](function(_0x4471e8){logger['error'](_0xf248('0x5b'),_0x4471e8);throw _0x4471e8;});}return _0x4c742c;})[_0xf248('0x1a')](respondWithResult(_0x42d7ff,0xc9))[_0xf248('0x4c')](handleError(_0x42d7ff,null));};exports['update']=function(_0x45e454,_0x29f43a,_0x55ae1a){var _0xd89a5;return db[_0xf248('0x35')][_0xf248('0x51')]({'where':{'id':_0x45e454['params']['id']}})[_0xf248('0x1a')](handleEntityNotFound(_0x29f43a,null))['then'](saveUpdates(_0x45e454[_0xf248('0x56')],null))[_0xf248('0x1a')](function(_0xeab452){if(_0xeab452){_0xd89a5=_0xeab452;return db[_0xf248('0x35')][_0xf248('0x4a')]({'raw':!![]});}})[_0xf248('0x1a')](function(_0xf4bff5){if(_0xf4bff5){var _0xfe18b5=fs['readFileSync'](path[_0xf248('0x5c')](config[_0xf248('0x5d')],_0xf248('0x5e')),'utf8');var _0x4bf993=fs[_0xf248('0x60')](path[_0xf248('0x5c')](config[_0xf248('0x5d')],_0xf248('0x6b')),_0xf248('0x5f'));var _0x207702=ejs['render'](_0xfe18b5,{'trunks':_0xf4bff5||[]});fs[_0xf248('0x62')]('/etc/asterisk/sip_xcally_trunks.conf',_0x207702);var _0x3485fb=ejs[_0xf248('0x61')](_0x4bf993,{'trunks':_0xf4bff5||[]});fs[_0xf248('0x62')]('/etc/asterisk/sip_xcally_registers.conf',_0x3485fb);return respondWithRpcPromise(_0xf248('0x65'),_0xf248('0x2e'),{'module':'chan_sip.so'});}return null;})[_0xf248('0x1a')](function(_0x314976){if(_0x314976){return _0xd89a5;}})['then'](respondWithResult(_0x29f43a,null))[_0xf248('0x4c')](handleError(_0x29f43a,null));};exports[_0xf248('0x2f')]=function(_0x3edde3,_0x5a0274,_0x4214ca){var _0x41c4b7;return db[_0xf248('0x35')]['find']({'where':{'id':_0x3edde3[_0xf248('0x4e')]['id']}})[_0xf248('0x1a')](handleEntityNotFound(_0x5a0274,null))[_0xf248('0x1a')](removeEntity(_0x5a0274,null))[_0xf248('0x1a')](function(){return db['Trunk'][_0xf248('0x4a')]({'raw':!![]});})['then'](function(_0x328a64){var _0x3a0c2b=fs[_0xf248('0x60')](path[_0xf248('0x5c')](config[_0xf248('0x5d')],_0xf248('0x5e')),_0xf248('0x5f'));var _0x4bf2ff=fs[_0xf248('0x60')](path[_0xf248('0x5c')](config['root'],_0xf248('0x6b')),_0xf248('0x5f'));var _0x534c1e=ejs[_0xf248('0x61')](_0x3a0c2b,{'trunks':_0x328a64});var _0xe0b772=ejs[_0xf248('0x61')](_0x4bf2ff,{'trunks':_0x328a64});fs[_0xf248('0x62')](_0xf248('0x63'),_0x534c1e);fs['writeFileSync'](_0xf248('0x6c'),_0xe0b772);return respondWithRpcPromise(_0xf248('0x65'),'destroy',{'module':_0xf248('0x66')});})[_0xf248('0x4c')](handleError(_0x5a0274,null));}; \ No newline at end of file +var _0x4c33=['fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','params','include','find','clone','rawAttributes','omit','createdAt','body','updatedAt','create','user','get','Trunks','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','autoAssociation','root','Reload','zip-dir','moment','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','error','message','request\x20sent','result','catch','status','json','count','offset','limit','Content-Range','apply','reject','update','destroy','UserProfileResource','sendStatus','stack','name','send','index','map','Trunk'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x4c33,0x1d9));var _0x34c3=function(_0x5a5db1,_0x241f14){_0x5a5db1=_0x5a5db1-0x0;var _0xcb472d=_0x4c33[_0x5a5db1];return _0xcb472d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x34c3('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x34c3('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x34c3('0x2'));var path=require(_0x34c3('0x3'));var sox=require(_0x34c3('0x4'));var csv=require(_0x34c3('0x5'));var ejs=require(_0x34c3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34c3('0x7'));var squel=require(_0x34c3('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x34c3('0x9'));var toCsv=require('to-csv');var querystring=require(_0x34c3('0xa'));var Papa=require(_0x34c3('0xb'));var Redis=require(_0x34c3('0xc'));var authService=require(_0x34c3('0xd'));var qs=require(_0x34c3('0xe'));var as=require(_0x34c3('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x34c3('0x10'))('api');var utils=require(_0x34c3('0x11'));var config=require(_0x34c3('0x12'));var licenseUtil=require(_0x34c3('0x13'));var db=require(_0x34c3('0x14'))['db'];var jayson=require(_0x34c3('0x15'));var client=jayson[_0x34c3('0x16')][_0x34c3('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x2fe6b0,_0x7e242c,_0x58e658,_0x700a43){return new BPromise(function(_0x2fcc6f,_0x5e359d){var _0xa7a1a3=_0x700a43||client;return _0xa7a1a3[_0x34c3('0x18')](_0x2fe6b0,_0x58e658)[_0x34c3('0x19')](function(_0x349be0){logger[_0x34c3('0x1a')](_0x34c3('0x1b'),_0x7e242c,'request\x20sent');logger[_0x34c3('0x1c')]('Trunk,\x20%s,\x20%s,\x20%s',_0x7e242c,'request\x20sent',JSON['stringify'](_0x349be0));if(_0x349be0[_0x34c3('0x1d')]){if(_0x349be0['error']['code']===0x1f4){logger['error'](_0x34c3('0x1b'),_0x7e242c,_0x349be0[_0x34c3('0x1d')][_0x34c3('0x1e')]);return _0x5e359d(_0x349be0['error']['message']);}logger[_0x34c3('0x1d')](_0x34c3('0x1b'),_0x7e242c,_0x349be0[_0x34c3('0x1d')][_0x34c3('0x1e')]);return _0x2fcc6f(_0x349be0[_0x34c3('0x1d')][_0x34c3('0x1e')]);}else{logger[_0x34c3('0x1a')](_0x34c3('0x1b'),_0x7e242c,_0x34c3('0x1f'));_0x2fcc6f(_0x349be0[_0x34c3('0x20')][_0x34c3('0x1e')]);}})[_0x34c3('0x21')](function(_0x2df81a){logger[_0x34c3('0x1d')](_0x34c3('0x1b'),_0x7e242c,_0x2df81a);_0x5e359d(_0x2df81a);});});}function respondWithStatusCode(_0x28d7d3,_0x3e3457){_0x3e3457=_0x3e3457||0xcc;return function(_0x1255ff){if(_0x1255ff){return _0x28d7d3['sendStatus'](_0x3e3457);}return _0x28d7d3[_0x34c3('0x22')](_0x3e3457)['end']();};}function respondWithResult(_0x30ba81,_0x204fce){_0x204fce=_0x204fce||0xc8;return function(_0x18dae3){if(_0x18dae3){return _0x30ba81[_0x34c3('0x22')](_0x204fce)[_0x34c3('0x23')](_0x18dae3);}};}function respondWithFilteredResult(_0x5ece6b,_0x99b64c){return function(_0x627d7c){if(_0x627d7c){var _0x288885=_0x627d7c[_0x34c3('0x24')],_0x339d41=_0x99b64c['offset'],_0x3225d5=_0x99b64c[_0x34c3('0x25')]+_0x99b64c[_0x34c3('0x26')],_0x4eb8fa;if(_0x3225d5>=_0x288885){_0x3225d5=_0x288885;_0x4eb8fa=0xc8;}else{_0x4eb8fa=0xce;}_0x5ece6b[_0x34c3('0x22')](_0x4eb8fa);return _0x5ece6b['set'](_0x34c3('0x27'),_0x339d41+'-'+_0x3225d5+'/'+_0x288885)[_0x34c3('0x23')](_0x627d7c);}return null;};}function patchUpdates(_0x3797c6){return function(_0x2c540d){try{jsonpatch[_0x34c3('0x28')](_0x2c540d,_0x3797c6,!![]);}catch(_0x1f62f6){return BPromise[_0x34c3('0x29')](_0x1f62f6);}return _0x2c540d['save']();};}function saveUpdates(_0x5d03fa,_0x4e6de0){return function(_0x1df21d){if(_0x1df21d){return _0x1df21d[_0x34c3('0x2a')](_0x5d03fa)[_0x34c3('0x19')](function(_0x22db01){return _0x22db01;});}return null;};}function removeEntity(_0x4bc846,_0x44718f){return function(_0x5a1c31){if(_0x5a1c31){return _0x5a1c31[_0x34c3('0x2b')]()[_0x34c3('0x19')](function(){var _0x4c899b=_0x5a1c31['get']({'plain':!![]});var _0x2a05c3='Trunks';return db[_0x34c3('0x2c')]['destroy']({'where':{'type':_0x2a05c3,'resourceId':_0x4c899b['id']}})[_0x34c3('0x19')](function(){return _0x5a1c31;});})['then'](function(){_0x4bc846['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50aa27,_0x23c535){return function(_0x4d41e2){if(!_0x4d41e2){_0x50aa27[_0x34c3('0x2d')](0x194);}return _0x4d41e2;};}function handleError(_0x13bba6,_0x2fe28f){_0x2fe28f=_0x2fe28f||0x1f4;return function(_0x194a06){logger[_0x34c3('0x1d')](_0x194a06[_0x34c3('0x2e')]);if(_0x194a06[_0x34c3('0x2f')]){delete _0x194a06[_0x34c3('0x2f')];}_0x13bba6[_0x34c3('0x22')](_0x2fe28f)[_0x34c3('0x30')](_0x194a06);};}exports[_0x34c3('0x31')]=function(_0x30322e,_0x31e814){var _0x11692a={},_0x14c2c6={},_0x1e15eb={'count':0x0,'rows':[]};var _0x26dfde=_[_0x34c3('0x32')](db[_0x34c3('0x33')]['rawAttributes'],function(_0x8d3ff4){return{'name':_0x8d3ff4[_0x34c3('0x34')],'type':_0x8d3ff4[_0x34c3('0x35')][_0x34c3('0x36')]};});_0x14c2c6['model']=_[_0x34c3('0x32')](_0x26dfde,_0x34c3('0x2f'));_0x14c2c6[_0x34c3('0x37')]=_[_0x34c3('0x38')](_0x30322e['query']);_0x14c2c6[_0x34c3('0x39')]=_[_0x34c3('0x3a')](_0x14c2c6[_0x34c3('0x3b')],_0x14c2c6[_0x34c3('0x37')]);_0x11692a[_0x34c3('0x3c')]=_[_0x34c3('0x3a')](_0x14c2c6[_0x34c3('0x3b')],qs[_0x34c3('0x3d')](_0x30322e['query']['fields']));_0x11692a[_0x34c3('0x3c')]=_0x11692a[_0x34c3('0x3c')][_0x34c3('0x3e')]?_0x11692a[_0x34c3('0x3c')]:_0x14c2c6['model'];if(!_0x30322e['query']['hasOwnProperty'](_0x34c3('0x3f'))){_0x11692a['limit']=qs[_0x34c3('0x26')](_0x30322e[_0x34c3('0x37')]['limit']);_0x11692a[_0x34c3('0x25')]=qs[_0x34c3('0x25')](_0x30322e['query']['offset']);}_0x11692a[_0x34c3('0x40')]=qs['sort'](_0x30322e['query'][_0x34c3('0x41')]);_0x11692a[_0x34c3('0x42')]=qs[_0x34c3('0x39')](_[_0x34c3('0x43')](_0x30322e[_0x34c3('0x37')],_0x14c2c6[_0x34c3('0x39')]),_0x26dfde);if(_0x30322e[_0x34c3('0x37')]['filter']){_0x11692a[_0x34c3('0x42')]=_[_0x34c3('0x44')](_0x11692a[_0x34c3('0x42')],{'$or':_['map'](_0x26dfde,function(_0x342942){if(_0x342942[_0x34c3('0x35')]!==_0x34c3('0x45')){var _0x38fc99={};_0x38fc99[_0x342942[_0x34c3('0x2f')]]={'$like':'%'+_0x30322e['query'][_0x34c3('0x46')]+'%'};return _0x38fc99;}})});}_0x11692a=_[_0x34c3('0x44')]({},_0x11692a,_0x30322e[_0x34c3('0x47')]);var _0x18fd72={'where':_0x11692a[_0x34c3('0x42')]};return db['Trunk'][_0x34c3('0x24')](_0x18fd72)[_0x34c3('0x19')](function(_0x306318){_0x1e15eb[_0x34c3('0x24')]=_0x306318;if(_0x30322e['query'][_0x34c3('0x48')]){_0x11692a['include']=[{'all':!![]}];}return db[_0x34c3('0x33')][_0x34c3('0x49')](_0x11692a);})[_0x34c3('0x19')](function(_0x46f187){_0x1e15eb['rows']=_0x46f187;return _0x1e15eb;})[_0x34c3('0x19')](respondWithFilteredResult(_0x31e814,_0x11692a))[_0x34c3('0x21')](handleError(_0x31e814,null));};exports['show']=function(_0x582c12,_0x16b1a5){var _0x2c660d={'raw':![],'where':{'id':_0x582c12[_0x34c3('0x4a')]['id']}},_0x33e680={};_0x33e680[_0x34c3('0x3b')]=_[_0x34c3('0x38')](db[_0x34c3('0x33')]['rawAttributes']);_0x33e680[_0x34c3('0x37')]=_[_0x34c3('0x38')](_0x582c12[_0x34c3('0x37')]);_0x33e680['filters']=_[_0x34c3('0x3a')](_0x33e680[_0x34c3('0x3b')],_0x33e680[_0x34c3('0x37')]);_0x2c660d['attributes']=_[_0x34c3('0x3a')](_0x33e680['model'],qs[_0x34c3('0x3d')](_0x582c12[_0x34c3('0x37')]['fields']));_0x2c660d[_0x34c3('0x3c')]=_0x2c660d[_0x34c3('0x3c')]['length']?_0x2c660d[_0x34c3('0x3c')]:_0x33e680[_0x34c3('0x3b')];if(_0x582c12[_0x34c3('0x37')][_0x34c3('0x48')]){_0x2c660d[_0x34c3('0x4b')]=[{'all':!![]}];}_0x2c660d=_[_0x34c3('0x44')]({},_0x2c660d,_0x582c12[_0x34c3('0x47')]);return db[_0x34c3('0x33')][_0x34c3('0x4c')](_0x2c660d)[_0x34c3('0x19')](handleEntityNotFound(_0x16b1a5,null))[_0x34c3('0x19')](respondWithResult(_0x16b1a5,null))[_0x34c3('0x21')](handleError(_0x16b1a5,null));};exports[_0x34c3('0x4d')]=function(_0x4b57f2,_0x1e74ba){var _0x161d96={'where':{'id':_0x4b57f2[_0x34c3('0x4a')]['id']}},_0x21ee26={};_0x21ee26['model']=_[_0x34c3('0x38')](db[_0x34c3('0x33')][_0x34c3('0x4e')]);_0x161d96[_0x34c3('0x3c')]=_[_0x34c3('0x3a')](_0x21ee26[_0x34c3('0x3b')],qs[_0x34c3('0x3d')](_0x4b57f2['query']['fields']));_0x161d96['attributes']=_0x161d96[_0x34c3('0x3c')]['length']?_0x161d96['attributes']:_0x21ee26['model'];if(_0x4b57f2[_0x34c3('0x37')]['includeAll']){_0x161d96['include']=[{'all':!![]}];}_0x161d96=_[_0x34c3('0x44')]({},_0x161d96,_0x4b57f2[_0x34c3('0x47')]);return db['Trunk'][_0x34c3('0x4c')](_0x161d96)['then'](handleEntityNotFound(_0x1e74ba,null))[_0x34c3('0x19')](function(_0x327343){if(_0x327343){var _0x4a607b=_0x327343['get']({'plain':!![]});_0x4a607b=qs[_0x34c3('0x4f')](_0x4a607b,['id',_0x34c3('0x50'),'updatedAt']);_0x4b57f2['body']=_[_0x34c3('0x4f')](_0x4b57f2[_0x34c3('0x51')],['id',_0x34c3('0x50'),_0x34c3('0x52')]);return db['Trunk'][_0x34c3('0x53')](_[_0x34c3('0x44')](_0x4a607b,_0x4b57f2[_0x34c3('0x51')]),{'include':_0x4b57f2[_0x34c3('0x37')][_0x34c3('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x15856f){var _0x3cae06=_0x4b57f2[_0x34c3('0x54')][_0x34c3('0x55')]({'plain':!![]});if(!_0x3cae06)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3cae06['role']===_0x34c3('0x54')){var _0x467d99=_0x15856f['get']({'plain':!![]});var _0x2b0dde=_0x34c3('0x56');return db[_0x34c3('0x57')][_0x34c3('0x4c')]({'where':{'name':_0x2b0dde,'userProfileId':_0x3cae06[_0x34c3('0x58')]},'raw':!![]})[_0x34c3('0x19')](function(_0x3f230){if(_0x3f230&&_0x3f230['autoAssociation']===0x0){return db[_0x34c3('0x2c')][_0x34c3('0x53')]({'name':_0x467d99[_0x34c3('0x2f')],'resourceId':_0x467d99['id'],'type':_0x3f230['name'],'sectionId':_0x3f230['id']},{})['then'](function(){return _0x15856f;});}else{return _0x15856f;}})['catch'](function(_0x538b67){logger[_0x34c3('0x1d')](_0x34c3('0x59'),_0x538b67);throw _0x538b67;});}return _0x15856f;});}})[_0x34c3('0x19')](respondWithResult(_0x1e74ba,0xc9))[_0x34c3('0x21')](handleError(_0x1e74ba,null));};exports['create']=function(_0x52f408,_0x4378bf,_0x340d8b){var _0x46b257;return db[_0x34c3('0x33')][_0x34c3('0x53')](_0x52f408[_0x34c3('0x51')],{'raw':!![]})['then'](function(_0x20f7f0){_0x46b257=_0x20f7f0;return db[_0x34c3('0x33')][_0x34c3('0x49')]({'raw':!![]});})['then'](function(_0x3a873c){var _0x5c8198=fs[_0x34c3('0x5a')](path[_0x34c3('0x5b')](config['root'],_0x34c3('0x5c')),_0x34c3('0x5d'));var _0x1f82c0=fs[_0x34c3('0x5a')](path[_0x34c3('0x5b')](config['root'],_0x34c3('0x5e')),'utf8');var _0x3a94df=ejs[_0x34c3('0x5f')](_0x5c8198,{'trunks':_0x3a873c||[]});fs['writeFileSync'](_0x34c3('0x60'),_0x3a94df);if(_0x46b257[_0x34c3('0x61')]){var _0x153172=ejs[_0x34c3('0x5f')](_0x1f82c0,{'trunks':_0x3a873c||[]});fs[_0x34c3('0x62')](_0x34c3('0x63'),_0x153172);}})[_0x34c3('0x19')](function(){return respondWithRpcPromise('Reload',_0x34c3('0x53'),{'module':_0x34c3('0x64')});})[_0x34c3('0x19')](function(){var _0x2a1102=_0x52f408[_0x34c3('0x54')][_0x34c3('0x55')]({'plain':!![]});if(!_0x2a1102)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a1102[_0x34c3('0x65')]===_0x34c3('0x54')){var _0x72ed9=_0x46b257[_0x34c3('0x55')]({'plain':!![]});return db[_0x34c3('0x57')][_0x34c3('0x4c')]({'where':{'name':_0x34c3('0x56'),'userProfileId':_0x2a1102[_0x34c3('0x58')]},'raw':!![]})[_0x34c3('0x19')](function(_0x4b4950){if(_0x4b4950&&_0x4b4950[_0x34c3('0x66')]===0x0){return db[_0x34c3('0x2c')][_0x34c3('0x53')]({'name':_0x72ed9[_0x34c3('0x2f')],'resourceId':_0x72ed9['id'],'type':_0x4b4950['name'],'sectionId':_0x4b4950['id']},{})[_0x34c3('0x19')](function(){return _0x46b257;});}else{return _0x46b257;}})['catch'](function(_0x5cbefe){logger[_0x34c3('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5cbefe);throw _0x5cbefe;});}return _0x46b257;})[_0x34c3('0x19')](respondWithResult(_0x4378bf,0xc9))[_0x34c3('0x21')](handleError(_0x4378bf,null));};exports[_0x34c3('0x2a')]=function(_0x1e7935,_0x47352e,_0x116034){var _0x3039fa;return db[_0x34c3('0x33')][_0x34c3('0x4c')]({'where':{'id':_0x1e7935[_0x34c3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x47352e,null))['then'](saveUpdates(_0x1e7935[_0x34c3('0x51')],null))['then'](function(_0x42bb8d){if(_0x42bb8d){_0x3039fa=_0x42bb8d;return db['Trunk']['findAll']({'raw':!![]});}})[_0x34c3('0x19')](function(_0x1c5ab3){if(_0x1c5ab3){var _0x32c862=fs[_0x34c3('0x5a')](path[_0x34c3('0x5b')](config[_0x34c3('0x67')],_0x34c3('0x5c')),_0x34c3('0x5d'));var _0xa084e6=fs['readFileSync'](path[_0x34c3('0x5b')](config[_0x34c3('0x67')],_0x34c3('0x5e')),_0x34c3('0x5d'));var _0x31163a=ejs['render'](_0x32c862,{'trunks':_0x1c5ab3||[]});fs[_0x34c3('0x62')](_0x34c3('0x60'),_0x31163a);var _0x1dd8b9=ejs['render'](_0xa084e6,{'trunks':_0x1c5ab3||[]});fs[_0x34c3('0x62')](_0x34c3('0x63'),_0x1dd8b9);return respondWithRpcPromise(_0x34c3('0x68'),'update',{'module':_0x34c3('0x64')});}return null;})[_0x34c3('0x19')](function(_0x284962){if(_0x284962){return _0x3039fa;}})[_0x34c3('0x19')](respondWithResult(_0x47352e,null))[_0x34c3('0x21')](handleError(_0x47352e,null));};exports[_0x34c3('0x2b')]=function(_0x39766c,_0x554870,_0x5b86ae){var _0x152713;return db[_0x34c3('0x33')]['find']({'where':{'id':_0x39766c['params']['id']}})[_0x34c3('0x19')](handleEntityNotFound(_0x554870,null))['then'](removeEntity(_0x554870,null))['then'](function(){return db[_0x34c3('0x33')][_0x34c3('0x49')]({'raw':!![]});})[_0x34c3('0x19')](function(_0x4a5762){var _0x3df065=fs[_0x34c3('0x5a')](path['join'](config[_0x34c3('0x67')],_0x34c3('0x5c')),_0x34c3('0x5d'));var _0x413bff=fs[_0x34c3('0x5a')](path['join'](config[_0x34c3('0x67')],_0x34c3('0x5e')),_0x34c3('0x5d'));var _0x47e4c8=ejs['render'](_0x3df065,{'trunks':_0x4a5762});var _0x221f81=ejs[_0x34c3('0x5f')](_0x413bff,{'trunks':_0x4a5762});fs[_0x34c3('0x62')](_0x34c3('0x60'),_0x47e4c8);fs['writeFileSync'](_0x34c3('0x63'),_0x221f81);return respondWithRpcPromise(_0x34c3('0x68'),'destroy',{'module':'chan_sip.so'});})[_0x34c3('0x21')](handleError(_0x554870,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 667f419..ccae7fd 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 _0xe0f4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Trunk','tools_trunks'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xe0f4,0x8c));var _0x4e0f=function(_0x2b013e,_0x24bc14){_0x2b013e=_0x2b013e-0x0;var _0x129988=_0xe0f4[_0x2b013e];return _0x129988;};'use strict';var _=require(_0x4e0f('0x0'));var util=require(_0x4e0f('0x1'));var logger=require(_0x4e0f('0x2'))(_0x4e0f('0x3'));var moment=require(_0x4e0f('0x4'));var BPromise=require(_0x4e0f('0x5'));var rp=require(_0x4e0f('0x6'));var fs=require('fs');var path=require(_0x4e0f('0x7'));var rimraf=require(_0x4e0f('0x8'));var config=require(_0x4e0f('0x9'));var attributes=require('./trunk.attributes');module[_0x4e0f('0xa')]=function(_0x21ada0,_0x161ed2){return _0x21ada0[_0x4e0f('0xb')](_0x4e0f('0xc'),attributes,{'tableName':_0x4e0f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa40a=['../../config/environment','./trunk.attributes','exports','tools_trunks','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x3dc6ab,_0xd7fe59){var _0x16c136=function(_0x4d27cc){while(--_0x4d27cc){_0x3dc6ab['push'](_0x3dc6ab['shift']());}};_0x16c136(++_0xd7fe59);}(_0xa40a,0xea));var _0xaa40=function(_0x40527b,_0x3017cf){_0x40527b=_0x40527b-0x0;var _0x501557=_0xa40a[_0x40527b];return _0x501557;};'use strict';var _=require('lodash');var util=require(_0xaa40('0x0'));var logger=require(_0xaa40('0x1'))('api');var moment=require(_0xaa40('0x2'));var BPromise=require(_0xaa40('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa40('0x4'));var rimraf=require(_0xaa40('0x5'));var config=require(_0xaa40('0x6'));var attributes=require(_0xaa40('0x7'));module[_0xaa40('0x8')]=function(_0x5a84d9,_0x282858){return _0x5a84d9['define']('Trunk',attributes,{'tableName':_0xaa40('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index dc707d1..21c884e 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 _0x4fc2=['rpc','../../config/environment','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','where','attributes','include','model','map','GetTrunk','Trunk','find','raw','ShowTrunk','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0xe1770a,_0x4fc5d6){var _0x3e6274=function(_0x1a016f){while(--_0x1a016f){_0xe1770a['push'](_0xe1770a['shift']());}};_0x3e6274(++_0x4fc5d6);}(_0x4fc2,0x111));var _0x24fc=function(_0x52a4d8,_0x307d98){_0x52a4d8=_0x52a4d8-0x0;var _0x2e66a6=_0x4fc2[_0x52a4d8];return _0x2e66a6;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4889f4,_0x115851,_0x22a0c8){return new BPromise(function(_0x220f9a,_0x123eff){return client[_0x24fc('0xb')](_0x4889f4,_0x22a0c8)[_0x24fc('0xc')](function(_0x5afdf1){logger[_0x24fc('0xd')](_0x24fc('0xe'),_0x115851,_0x24fc('0xf'));logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x115851,_0x24fc('0xf'),JSON[_0x24fc('0x12')](_0x5afdf1));if(_0x5afdf1[_0x24fc('0x13')]){if(_0x5afdf1['error'][_0x24fc('0x14')]===0x1f4){logger[_0x24fc('0x13')]('Trunk,\x20%s,\x20%s',_0x115851,_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);return _0x123eff(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x5afdf1['error'][_0x24fc('0x15')]);return _0x220f9a(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}else{logger[_0x24fc('0xd')]('Trunk,\x20%s,\x20%s',_0x115851,_0x24fc('0xf'));_0x220f9a(_0x5afdf1['result'][_0x24fc('0x15')]);}})[_0x24fc('0x16')](function(_0x218fb6){logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x218fb6);_0x123eff(_0x218fb6);});});}exports['GetTrunk']=function(_0x23873c){var _0x1cb3d0=this;return new Promise(function(_0x6cfa0a,_0x8ac114){return db['Trunk'][_0x24fc('0x17')]({'raw':_0x23873c[_0x24fc('0x18')]?_0x23873c[_0x24fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x23873c[_0x24fc('0x18')]?_0x23873c[_0x24fc('0x18')][_0x24fc('0x19')]||null:null,'attributes':_0x23873c[_0x24fc('0x18')]?_0x23873c['options'][_0x24fc('0x1a')]||null:null,'limit':_0x23873c['options']?_0x23873c[_0x24fc('0x18')]['limit']||null:null,'include':_0x23873c[_0x24fc('0x18')]?_0x23873c[_0x24fc('0x18')][_0x24fc('0x1b')]?_['map'](_0x23873c[_0x24fc('0x18')]['include'],function(_0x35a9c7){return{'model':db[_0x35a9c7[_0x24fc('0x1c')]],'as':_0x35a9c7['as'],'attributes':_0x35a9c7[_0x24fc('0x1a')],'include':_0x35a9c7[_0x24fc('0x1b')]?_[_0x24fc('0x1d')](_0x35a9c7[_0x24fc('0x1b')],function(_0x3f0875){return{'model':db[_0x3f0875[_0x24fc('0x1c')]],'as':_0x3f0875['as'],'attributes':_0x3f0875[_0x24fc('0x1a')],'include':_0x3f0875[_0x24fc('0x1b')]?_['map'](_0x3f0875[_0x24fc('0x1b')],function(_0x16f27f){return{'model':db[_0x16f27f[_0x24fc('0x1c')]],'as':_0x16f27f['as'],'attributes':_0x16f27f['attributes']};}):[]};}):[]};}):[]:[]})[_0x24fc('0xc')](function(_0x3d1ec8){logger[_0x24fc('0xd')](_0x24fc('0x1e'),_0x23873c);logger[_0x24fc('0x10')](_0x24fc('0x1e'),_0x23873c,JSON['stringify'](_0x3d1ec8));_0x6cfa0a(_0x3d1ec8);})[_0x24fc('0x16')](function(_0x29a461){logger[_0x24fc('0x13')](_0x24fc('0x1e'),_0x29a461[_0x24fc('0x15')],_0x23873c);_0x8ac114(_0x1cb3d0['error'](0x1f4,_0x29a461['message']));});});};exports['ShowTrunk']=function(_0x3df6f4){var _0x574ba3=this;return new Promise(function(_0x3f2464,_0x3e6389){return db[_0x24fc('0x1f')][_0x24fc('0x20')]({'raw':_0x3df6f4['options']?_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x21')]===undefined?!![]:![]:!![],'where':_0x3df6f4['options']?_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x19')]||null:null,'attributes':_0x3df6f4['options']?_0x3df6f4['options'][_0x24fc('0x1a')]||null:null,'include':_0x3df6f4['options']?_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x1b')]?_['map'](_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x1b')],function(_0x3b2862){return{'model':db[_0x3b2862[_0x24fc('0x1c')]],'as':_0x3b2862['as'],'attributes':_0x3b2862[_0x24fc('0x1a')],'include':_0x3b2862[_0x24fc('0x1b')]?_[_0x24fc('0x1d')](_0x3b2862[_0x24fc('0x1b')],function(_0x379a4a){return{'model':db[_0x379a4a['model']],'as':_0x379a4a['as'],'attributes':_0x379a4a[_0x24fc('0x1a')],'include':_0x379a4a[_0x24fc('0x1b')]?_[_0x24fc('0x1d')](_0x379a4a[_0x24fc('0x1b')],function(_0x242bd5){return{'model':db[_0x242bd5['model']],'as':_0x242bd5['as'],'attributes':_0x242bd5['attributes']};}):[]};}):[]};}):[]:[]})[_0x24fc('0xc')](function(_0x5d48fe){logger[_0x24fc('0xd')](_0x24fc('0x22'),_0x3df6f4);logger[_0x24fc('0x10')](_0x24fc('0x22'),_0x3df6f4,JSON['stringify'](_0x5d48fe));_0x3f2464(_0x5d48fe);})[_0x24fc('0x16')](function(_0x4f4ec8){logger[_0x24fc('0x13')](_0x24fc('0x22'),_0x4f4ec8[_0x24fc('0x15')],_0x3df6f4);_0x3e6389(_0x574ba3[_0x24fc('0x13')](0x1f4,_0x4f4ec8[_0x24fc('0x15')]));});});}; \ No newline at end of file +var _0x14a0=['limit','include','model','map','find','ShowTrunk','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','Trunk,\x20%s,\x20%s','message','info','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes'];(function(_0x2223b5,_0xef4e77){var _0x8cf3ac=function(_0xc23236){while(--_0xc23236){_0x2223b5['push'](_0x2223b5['shift']());}};_0x8cf3ac(++_0xef4e77);}(_0x14a0,0x8e));var _0x014a=function(_0x30d7bd,_0x521a33){_0x30d7bd=_0x30d7bd-0x0;var _0x4bd842=_0x14a0[_0x30d7bd];return _0x4bd842;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('Trunk,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('Trunk,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('Trunk,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});}exports[_0x014a('0x15')]=function(_0x12d339){var _0x61ec9f=this;return new Promise(function(_0x263b07,_0x16490a){return db[_0x014a('0x16')][_0x014a('0x17')]({'raw':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x19')]===undefined?!![]:![]:!![],'where':_0x12d339['options']?_0x12d339[_0x014a('0x18')][_0x014a('0x1a')]||null:null,'attributes':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x1b')]||null:null,'limit':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x1c')]||null:null,'include':_0x12d339[_0x014a('0x18')]?_0x12d339['options'][_0x014a('0x1d')]?_['map'](_0x12d339[_0x014a('0x18')][_0x014a('0x1d')],function(_0x44d921){return{'model':db[_0x44d921[_0x014a('0x1e')]],'as':_0x44d921['as'],'attributes':_0x44d921[_0x014a('0x1b')],'include':_0x44d921[_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x44d921[_0x014a('0x1d')],function(_0x165a42){return{'model':db[_0x165a42['model']],'as':_0x165a42['as'],'attributes':_0x165a42[_0x014a('0x1b')],'include':_0x165a42['include']?_[_0x014a('0x1f')](_0x165a42[_0x014a('0x1d')],function(_0x4f1c44){return{'model':db[_0x4f1c44['model']],'as':_0x4f1c44['as'],'attributes':_0x4f1c44[_0x014a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x014a('0xa')](function(_0x143346){logger['info'](_0x014a('0x15'),_0x12d339);logger[_0x014a('0xb')]('GetTrunk',_0x12d339,JSON[_0x014a('0xd')](_0x143346));_0x263b07(_0x143346);})[_0x014a('0x14')](function(_0x496040){logger['error'](_0x014a('0x15'),_0x496040[_0x014a('0x11')],_0x12d339);_0x16490a(_0x61ec9f[_0x014a('0xe')](0x1f4,_0x496040[_0x014a('0x11')]));});});};exports['ShowTrunk']=function(_0x434038){var _0x147e7e=this;return new Promise(function(_0x15af07,_0x402d3b){return db[_0x014a('0x16')][_0x014a('0x20')]({'raw':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x19')]===undefined?!![]:![]:!![],'where':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')]['where']||null:null,'attributes':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x1b')]||null:null,'include':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x434038['options'][_0x014a('0x1d')],function(_0x325b3c){return{'model':db[_0x325b3c['model']],'as':_0x325b3c['as'],'attributes':_0x325b3c[_0x014a('0x1b')],'include':_0x325b3c[_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x325b3c[_0x014a('0x1d')],function(_0x329136){return{'model':db[_0x329136[_0x014a('0x1e')]],'as':_0x329136['as'],'attributes':_0x329136[_0x014a('0x1b')],'include':_0x329136[_0x014a('0x1d')]?_['map'](_0x329136[_0x014a('0x1d')],function(_0x1dfe6e){return{'model':db[_0x1dfe6e[_0x014a('0x1e')]],'as':_0x1dfe6e['as'],'attributes':_0x1dfe6e[_0x014a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x427c7a){logger[_0x014a('0x12')](_0x014a('0x21'),_0x434038);logger[_0x014a('0xb')](_0x014a('0x21'),_0x434038,JSON[_0x014a('0xd')](_0x427c7a));_0x15af07(_0x427c7a);})[_0x014a('0x14')](function(_0x36187b){logger[_0x014a('0xe')]('ShowTrunk',_0x36187b[_0x014a('0x11')],_0x434038);_0x402d3b(_0x147e7e['error'](0x1f4,_0x36187b[_0x014a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 53df451..0bd93d7 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 _0xd246=['addSquareProjects','/:id','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/whoami','show','/:id/avatar','/:id/open_tabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','/:id/queues','addQueues','diskStorage','server/files/images/','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts'];(function(_0x15ee91,_0x421d14){var _0x7633c2=function(_0x531a62){while(--_0x531a62){_0x15ee91['push'](_0x15ee91['shift']());}};_0x7633c2(++_0x421d14);}(_0xd246,0xf5));var _0x6d24=function(_0x2e38e0,_0x5841ba){_0x2e38e0=_0x2e38e0-0x0;var _0x173804=_0xd246[_0x2e38e0];return _0x173804;};'use strict';var multer=require(_0x6d24('0x0'));var util=require(_0x6d24('0x1'));var path=require(_0x6d24('0x2'));var timeout=require(_0x6d24('0x3'));var express=require(_0x6d24('0x4'));var router=express[_0x6d24('0x5')]();var fs_extra=require(_0x6d24('0x6'));var auth=require(_0x6d24('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6d24('0x8'));var controller=require('./user.controller');router[_0x6d24('0x9')]('/',auth['isAuthenticated'](),controller[_0x6d24('0xa')]);router[_0x6d24('0x9')](_0x6d24('0xb'),auth[_0x6d24('0xc')](),controller[_0x6d24('0xd')]);router[_0x6d24('0x9')](_0x6d24('0xe'),auth['isAuthenticated'](),controller['whoami']);router[_0x6d24('0x9')]('/presence',auth[_0x6d24('0xc')](),controller['getPresence']);router[_0x6d24('0x9')]('/:id',auth[_0x6d24('0xc')](),controller[_0x6d24('0xf')]);router['get'](_0x6d24('0x10'),controller['getAvatar']);router[_0x6d24('0x9')](_0x6d24('0x11'),auth['isAuthenticated'](),controller['getOpenTabs']);router['get'](_0x6d24('0x12'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x13')]);router[_0x6d24('0x9')]('/:id/queues',auth['isAuthenticated'](),controller[_0x6d24('0x14')]);router[_0x6d24('0x9')](_0x6d24('0x15'),auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0x6d24('0x9')](_0x6d24('0x16'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x17')]);router[_0x6d24('0x9')](_0x6d24('0x18'),auth['isAuthenticated'](),controller['getRecordings']);router[_0x6d24('0x9')](_0x6d24('0x19'),auth[_0x6d24('0xc')](),controller['getScreenRecordings']);router[_0x6d24('0x9')](_0x6d24('0x1a'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x1b')]);router[_0x6d24('0x9')]('/:id/openchannel/interactions',auth[_0x6d24('0xc')](),controller[_0x6d24('0x1c')]);router['get'](_0x6d24('0x1d'),auth['isAuthenticated'](),controller[_0x6d24('0x1e')]);router[_0x6d24('0x9')](_0x6d24('0x1f'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x20')]);router[_0x6d24('0x9')](_0x6d24('0x21'),auth['isAuthenticated'](),controller[_0x6d24('0x22')]);router[_0x6d24('0x9')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller['getWhatsappInteractions']);router[_0x6d24('0x9')](_0x6d24('0x23'),auth['isAuthenticated'](),controller['getTeams']);router[_0x6d24('0x9')](_0x6d24('0x24'),auth[_0x6d24('0xc')](),controller['getLists']);router[_0x6d24('0x9')](_0x6d24('0x25'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x26')]);router['get'](_0x6d24('0x27'),auth['isAuthenticated'](),controller[_0x6d24('0x28')]);router[_0x6d24('0x9')](_0x6d24('0x29'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x2a')]);router[_0x6d24('0x9')](_0x6d24('0x2b'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x2c')]);router[_0x6d24('0x9')](_0x6d24('0x2d'),auth['isAuthenticated'](),controller[_0x6d24('0x2e')]);router[_0x6d24('0x9')](_0x6d24('0x2f'),auth[_0x6d24('0xc')](),controller['getSmsAccounts']);router['get'](_0x6d24('0x30'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x31')]);router[_0x6d24('0x9')](_0x6d24('0x32'),auth['isAuthenticated'](),controller[_0x6d24('0x33')]);router['get'](_0x6d24('0x34'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x35')]);router[_0x6d24('0x9')](_0x6d24('0x36'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x37')]);router[_0x6d24('0x9')](_0x6d24('0x38'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x39')]);router[_0x6d24('0x3a')]('/:id/contacts',auth[_0x6d24('0xc')](),controller[_0x6d24('0x3b')]);router['post']('/',auth[_0x6d24('0xc')](),controller[_0x6d24('0x3c')]);router[_0x6d24('0x3a')](_0x6d24('0x3d'),auth[_0x6d24('0xc')](),controller['bulkCreate']);router['post'](_0x6d24('0x3e'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x3f')]);var upload=multer({'storage':multer[_0x6d24('0x40')]({'destination':function(_0x9ee326,_0x4f360,_0x3769ea){_0x3769ea(null,path['join'](config['root'],_0x6d24('0x41')));},'filename':function(_0x46d112,_0x2ee9d5,_0x2fc562){_0x2fc562(null,util['format'](_0x6d24('0x42'),Date[_0x6d24('0x43')](),_0x2ee9d5[_0x6d24('0x44')]));}})});router[_0x6d24('0x3a')](_0x6d24('0x10'),upload[_0x6d24('0x45')](_0x6d24('0x46')),controller[_0x6d24('0x47')]);router[_0x6d24('0x3a')](_0x6d24('0x48'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x49')]);router[_0x6d24('0x3a')](_0x6d24('0x4a'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x4b')]);router[_0x6d24('0x3a')](_0x6d24('0x4c'),auth['isAuthenticated'](),controller[_0x6d24('0x4d')]);router[_0x6d24('0x3a')](_0x6d24('0x4e'),auth[_0x6d24('0xc')](),controller['unpause']);router[_0x6d24('0x3a')](_0x6d24('0x23'),auth['isAuthenticated'](),controller[_0x6d24('0x4f')]);router[_0x6d24('0x3a')](_0x6d24('0x50'),auth[_0x6d24('0xc')](),controller['addChatInteractions']);router[_0x6d24('0x3a')](_0x6d24('0x51'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x52')]);router['post'](_0x6d24('0x53'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x54')]);router[_0x6d24('0x3a')]('/:id/sms_interactions',auth[_0x6d24('0xc')](),controller[_0x6d24('0x55')]);router[_0x6d24('0x3a')](_0x6d24('0x56'),auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0x6d24('0x3a')](_0x6d24('0x57'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x58')]);router['post'](_0x6d24('0x29'),auth[_0x6d24('0xc')](),controller['addFaxAccounts']);router[_0x6d24('0x3a')](_0x6d24('0x2b'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x59')]);router[_0x6d24('0x3a')](_0x6d24('0x2d'),auth['isAuthenticated'](),controller[_0x6d24('0x5a')]);router[_0x6d24('0x3a')](_0x6d24('0x2f'),auth['isAuthenticated'](),controller[_0x6d24('0x5b')]);router[_0x6d24('0x3a')](_0x6d24('0x30'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x5c')]);router['post'](_0x6d24('0x32'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x5d')]);router[_0x6d24('0x3a')](_0x6d24('0x34'),auth['isAuthenticated'](),controller[_0x6d24('0x5e')]);router[_0x6d24('0x3a')](_0x6d24('0x38'),auth['isAuthenticated'](),controller['createApiKey']);router['put'](_0x6d24('0x5f'),auth[_0x6d24('0xc')](),controller['update']);router['put'](_0x6d24('0x60'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x61')]);router[_0x6d24('0x62')]('/:id/queues',auth['isAuthenticated'](),controller[_0x6d24('0x63')]);router[_0x6d24('0x62')]('/:id/teams',auth[_0x6d24('0xc')](),controller[_0x6d24('0x64')]);router[_0x6d24('0x62')](_0x6d24('0x5f'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x65')]);router['delete'](_0x6d24('0x50'),auth['isAuthenticated'](),controller['removeChatInteractions']);router['delete'](_0x6d24('0x51'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x66')]);router['delete'](_0x6d24('0x53'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x67')]);router[_0x6d24('0x62')](_0x6d24('0x68'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x69')]);router['delete'](_0x6d24('0x56'),auth['isAuthenticated'](),controller[_0x6d24('0x6a')]);router['delete']('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x6d24('0x6b')]);router['delete']('/:id/fax_accounts',auth[_0x6d24('0xc')](),controller['removeFaxAccounts']);router[_0x6d24('0x62')](_0x6d24('0x2b'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x6c')]);router['delete'](_0x6d24('0x2d'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x6d')]);router[_0x6d24('0x62')](_0x6d24('0x2f'),auth[_0x6d24('0xc')](),controller['removeSmsAccounts']);router['delete'](_0x6d24('0x30'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x6e')]);router[_0x6d24('0x62')](_0x6d24('0x32'),auth[_0x6d24('0xc')](),controller[_0x6d24('0x6f')]);router[_0x6d24('0x62')](_0x6d24('0x34'),auth[_0x6d24('0xc')](),controller['removeSquareProjects']);router[_0x6d24('0x62')](_0x6d24('0x38'),auth[_0x6d24('0xc')](),controller['removeApiKey']);module[_0x6d24('0x70')]=router; \ No newline at end of file +var _0x5a01=['/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','/:id/api_key','addContacts','post','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id/password','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./user.controller','index','get','/describe','describe','/whoami','isAuthenticated','whoami','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a01,0x1af));var _0x15a0=function(_0x170bba,_0x2be92f){_0x170bba=_0x170bba-0x0;var _0xa7c249=_0x5a01[_0x170bba];return _0xa7c249;};'use strict';var multer=require(_0x15a0('0x0'));var util=require(_0x15a0('0x1'));var path=require(_0x15a0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x15a0('0x3')]();var fs_extra=require(_0x15a0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x15a0('0x5'));var config=require(_0x15a0('0x6'));var controller=require(_0x15a0('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x15a0('0x8')]);router[_0x15a0('0x9')](_0x15a0('0xa'),auth['isAuthenticated'](),controller[_0x15a0('0xb')]);router[_0x15a0('0x9')](_0x15a0('0xc'),auth[_0x15a0('0xd')](),controller[_0x15a0('0xe')]);router['get']('/presence',auth[_0x15a0('0xd')](),controller[_0x15a0('0xf')]);router[_0x15a0('0x9')](_0x15a0('0x10'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x11')]);router[_0x15a0('0x9')](_0x15a0('0x12'),controller[_0x15a0('0x13')]);router[_0x15a0('0x9')](_0x15a0('0x14'),auth[_0x15a0('0xd')](),controller['getOpenTabs']);router['get'](_0x15a0('0x15'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x16')]);router[_0x15a0('0x9')](_0x15a0('0x17'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x18')]);router[_0x15a0('0x9')](_0x15a0('0x19'),auth['isAuthenticated'](),controller[_0x15a0('0x1a')]);router['get']('/:id/groups',auth[_0x15a0('0xd')](),controller[_0x15a0('0x1b')]);router[_0x15a0('0x9')](_0x15a0('0x1c'),auth['isAuthenticated'](),controller['getRecordings']);router[_0x15a0('0x9')](_0x15a0('0x1d'),auth['isAuthenticated'](),controller[_0x15a0('0x1e')]);router['get'](_0x15a0('0x1f'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x20')]);router[_0x15a0('0x9')](_0x15a0('0x21'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x22')]);router['get']('/:id/mail/interactions',auth[_0x15a0('0xd')](),controller[_0x15a0('0x23')]);router[_0x15a0('0x9')](_0x15a0('0x24'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x25')]);router[_0x15a0('0x9')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0x15a0('0x26')]);router['get'](_0x15a0('0x27'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x28')]);router[_0x15a0('0x9')](_0x15a0('0x29'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x2a')]);router[_0x15a0('0x9')](_0x15a0('0x2b'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x2c')]);router['get'](_0x15a0('0x2d'),auth['isAuthenticated'](),controller[_0x15a0('0x2e')]);router['get'](_0x15a0('0x2f'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x30')]);router[_0x15a0('0x9')](_0x15a0('0x31'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x32')]);router[_0x15a0('0x9')](_0x15a0('0x33'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x34')]);router[_0x15a0('0x9')](_0x15a0('0x35'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x36')]);router['get'](_0x15a0('0x37'),auth[_0x15a0('0xd')](),controller['getSmsAccounts']);router['get'](_0x15a0('0x38'),auth[_0x15a0('0xd')](),controller['getChatWebsites']);router[_0x15a0('0x9')](_0x15a0('0x39'),auth['isAuthenticated'](),controller[_0x15a0('0x3a')]);router[_0x15a0('0x9')](_0x15a0('0x3b'),auth['isAuthenticated'](),controller[_0x15a0('0x3c')]);router[_0x15a0('0x9')](_0x15a0('0x3d'),auth[_0x15a0('0xd')](),controller['getScheduledCalls']);router[_0x15a0('0x9')](_0x15a0('0x3e'),auth['isAuthenticated'](),controller['getApiKey']);router['post'](_0x15a0('0x15'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x3f')]);router[_0x15a0('0x40')]('/',auth[_0x15a0('0xd')](),controller[_0x15a0('0x41')]);router[_0x15a0('0x40')](_0x15a0('0x42'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x43')]);router[_0x15a0('0x40')](_0x15a0('0x17'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x44')]);var upload=multer({'storage':multer[_0x15a0('0x45')]({'destination':function(_0x203564,_0x25136f,_0x44e59f){_0x44e59f(null,path[_0x15a0('0x46')](config[_0x15a0('0x47')],_0x15a0('0x48')));},'filename':function(_0x3b2856,_0x484fdc,_0x3af5ab){_0x3af5ab(null,util[_0x15a0('0x49')](_0x15a0('0x4a'),Date[_0x15a0('0x4b')](),_0x484fdc[_0x15a0('0x4c')]));}})});router['post'](_0x15a0('0x12'),upload[_0x15a0('0x4d')](_0x15a0('0x4e')),controller[_0x15a0('0x4f')]);router['post'](_0x15a0('0x50'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x51')]);router[_0x15a0('0x40')](_0x15a0('0x52'),auth[_0x15a0('0xd')](),controller['logout']);router[_0x15a0('0x40')](_0x15a0('0x53'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x54')]);router['post'](_0x15a0('0x55'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x56')]);router['post'](_0x15a0('0x29'),auth['isAuthenticated'](),controller[_0x15a0('0x57')]);router[_0x15a0('0x40')](_0x15a0('0x58'),auth[_0x15a0('0xd')](),controller['addChatInteractions']);router[_0x15a0('0x40')](_0x15a0('0x59'),auth['isAuthenticated'](),controller['addMailInteractions']);router['post']('/:id/fax_interactions',auth[_0x15a0('0xd')](),controller[_0x15a0('0x5a')]);router[_0x15a0('0x40')](_0x15a0('0x5b'),auth['isAuthenticated'](),controller[_0x15a0('0x5c')]);router[_0x15a0('0x40')](_0x15a0('0x5d'),auth[_0x15a0('0xd')](),controller['addOpenchannelInteractions']);router[_0x15a0('0x40')]('/:id/whatsapp_interactions',auth[_0x15a0('0xd')](),controller[_0x15a0('0x5e')]);router[_0x15a0('0x40')](_0x15a0('0x31'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x5f')]);router[_0x15a0('0x40')]('/:id/mail_accounts',auth[_0x15a0('0xd')](),controller[_0x15a0('0x60')]);router[_0x15a0('0x40')](_0x15a0('0x35'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x61')]);router[_0x15a0('0x40')](_0x15a0('0x37'),auth[_0x15a0('0xd')](),controller['addSmsAccounts']);router['post'](_0x15a0('0x38'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x62')]);router[_0x15a0('0x40')](_0x15a0('0x39'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x63')]);router[_0x15a0('0x40')](_0x15a0('0x3b'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x64')]);router[_0x15a0('0x40')](_0x15a0('0x3e'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x65')]);router[_0x15a0('0x66')]('/:id',auth[_0x15a0('0xd')](),controller['update']);router[_0x15a0('0x66')](_0x15a0('0x67'),auth['isAuthenticated'](),controller[_0x15a0('0x68')]);router[_0x15a0('0x69')](_0x15a0('0x17'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x6a')]);router[_0x15a0('0x69')](_0x15a0('0x29'),auth['isAuthenticated'](),controller[_0x15a0('0x6b')]);router['delete'](_0x15a0('0x10'),auth['isAuthenticated'](),controller['destroy']);router[_0x15a0('0x69')](_0x15a0('0x58'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x6c')]);router[_0x15a0('0x69')](_0x15a0('0x59'),auth['isAuthenticated'](),controller[_0x15a0('0x6d')]);router['delete']('/:id/fax_interactions',auth[_0x15a0('0xd')](),controller[_0x15a0('0x6e')]);router[_0x15a0('0x69')](_0x15a0('0x5b'),auth['isAuthenticated'](),controller[_0x15a0('0x6f')]);router[_0x15a0('0x69')](_0x15a0('0x5d'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x70')]);router[_0x15a0('0x69')](_0x15a0('0x71'),auth[_0x15a0('0xd')](),controller['removeWhatsappInteractions']);router[_0x15a0('0x69')](_0x15a0('0x31'),auth[_0x15a0('0xd')](),controller['removeFaxAccounts']);router['delete'](_0x15a0('0x33'),auth['isAuthenticated'](),controller[_0x15a0('0x72')]);router[_0x15a0('0x69')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x15a0('0x73')]);router['delete'](_0x15a0('0x37'),auth['isAuthenticated'](),controller[_0x15a0('0x74')]);router[_0x15a0('0x69')](_0x15a0('0x38'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x75')]);router['delete'](_0x15a0('0x39'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x76')]);router['delete'](_0x15a0('0x3b'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x77')]);router[_0x15a0('0x69')]('/:id/api_key',auth[_0x15a0('0xd')](),controller[_0x15a0('0x78')]);module[_0x15a0('0x79')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 089e976..32a4084 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 _0xd5df=['yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','certificate','passive','actpass','DATE','showWebBar','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','loginAttempts','moment','util','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','accountcode','fullname','BOOLEAN','INTEGER','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_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','info','inband','auto','nonat','outgoing'];(function(_0x50eea2,_0x215614){var _0x5f2077=function(_0x1b7184){while(--_0x1b7184){_0x50eea2['push'](_0x50eea2['shift']());}};_0x5f2077(++_0x215614);}(_0xd5df,0xda));var _0xfd5d=function(_0x439bf4,_0x319fbc){_0x439bf4=_0x439bf4-0x0;var _0x4d8d48=_0xd5df[_0x439bf4];return _0x4d8d48;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xfd5d('0x0'));var util=require(_0xfd5d('0x1'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':![],'unique':_0xfd5d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1158e8){this[_0xfd5d('0x4')](_0xfd5d('0x3'),_0x1158e8);this[_0xfd5d('0x4')]('defaultuser',_0x1158e8);},'comment':_0xfd5d('0x5')},'fullname':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':![],'set':function(_0x2ac166){this[_0xfd5d('0x4')]('fullname',_0x2ac166);this[_0xfd5d('0x4')](_0xfd5d('0x6'),util[_0xfd5d('0x7')](_0xfd5d('0x8'),_0x2ac166,this[_0xfd5d('0x9')](_0xfd5d('0xa'))));}},'alias':{'type':Sequelize[_0xfd5d('0x2')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfd5d('0xb'),'validate':{'isEmail':!![]},'set':function(_0x5c7a8f){if(_0x5c7a8f){this[_0xfd5d('0x4')](_0xfd5d('0xb'),_0x5c7a8f[_0xfd5d('0xc')]());}}},'role':{'type':Sequelize[_0xfd5d('0xd')](_0xfd5d('0xe'),_0xfd5d('0xf'),_0xfd5d('0x10'),_0xfd5d('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xfd5d('0x2')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xfd5d('0xa'),'set':function(_0xb7682e){this[_0xfd5d('0x4')](_0xfd5d('0xa'),_0xb7682e);this[_0xfd5d('0x4')](_0xfd5d('0x12'),_0xb7682e);this[_0xfd5d('0x4')]('callerid',util[_0xfd5d('0x7')](_0xfd5d('0x8'),this['getDataValue'](_0xfd5d('0x13')),_0xb7682e));}},'salt':{'type':Sequelize[_0xfd5d('0x2')]},'phone':{'type':Sequelize[_0xfd5d('0x2')]},'mobile':{'type':Sequelize[_0xfd5d('0x2')]},'address':{'type':Sequelize[_0xfd5d('0x2')]},'zipcode':{'type':Sequelize[_0xfd5d('0x2')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xfd5d('0x2')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xfd5d('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xfd5d('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xfd5d('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xfd5d('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xfd5d('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xfd5d('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xfd5d('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xfd5d('0x16')},'ipaddr':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'port':{'type':Sequelize[_0xfd5d('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xfd5d('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xfd5d('0xd')]('friend',_0xfd5d('0xf'),'peer'),'allowNull':!![],'defaultValue':_0xfd5d('0x17')},'context':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![],'defaultValue':_0xfd5d('0x18')},'callingpres':{'type':Sequelize[_0xfd5d('0xd')](_0xfd5d('0x19'),_0xfd5d('0x1a'),'ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xfd5d('0x1b'),_0xfd5d('0x1c')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'transport':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![],'defaultValue':_0xfd5d('0x1d'),'set':function(_0x5489e4){this[_0xfd5d('0x4')]('transport',_0x5489e4?_0x5489e4[_0xfd5d('0x1e')](','):null);},'get':function(){return this[_0xfd5d('0x9')](_0xfd5d('0x1f'))?this[_0xfd5d('0x9')](_0xfd5d('0x1f'))[_0xfd5d('0x20')](','):null;},'comment':_0xfd5d('0x21')},'dtmfmode':{'type':Sequelize['ENUM'](_0xfd5d('0x22'),_0xfd5d('0x23'),'shortinfo',_0xfd5d('0x24'),_0xfd5d('0x25')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xfd5d('0xd')]('yes','no',_0xfd5d('0x26'),'update',_0xfd5d('0x27')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xfd5d('0xd')](_0xfd5d('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'nat':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![],'defaultValue':_0xfd5d('0x29'),'set':function(_0x2e859d){this[_0xfd5d('0x4')](_0xfd5d('0x2a'),_0x2e859d?_0x2e859d[_0xfd5d('0x1e')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0xfd5d('0x9')](_0xfd5d('0x2a'))['split'](','):null;},'comment':_0xfd5d('0x2b')},'callgroup':{'type':Sequelize[_0xfd5d('0x2')]},'namedcallgroup':{'type':Sequelize[_0xfd5d('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xfd5d('0x2')]},'language':{'type':Sequelize[_0xfd5d('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':![],'defaultValue':_0xfd5d('0x2c')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfd5d('0x2d'),'set':function(_0x497d49){this['setDataValue'](_0xfd5d('0x2e'),_0x497d49?_0x497d49['join'](';'):_0xfd5d('0x2d'));},'get':function(){return this[_0xfd5d('0x9')](_0xfd5d('0x2e'))?this[_0xfd5d('0x9')](_0xfd5d('0x2e'))[_0xfd5d('0x20')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xfd5d('0xd')](_0xfd5d('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![],'set':function(_0xb314aa){this['setDataValue']('insecure',_0xb314aa?_0xb314aa['join'](','):null);},'get':function(){return this[_0xfd5d('0x9')](_0xfd5d('0x2f'))?this[_0xfd5d('0x9')](_0xfd5d('0x2f'))[_0xfd5d('0x20')](','):null;},'comment':_0xfd5d('0x30')},'trustrpid':{'type':Sequelize[_0xfd5d('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xfd5d('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xfd5d('0xd')](_0xfd5d('0x28'),'no',_0xfd5d('0x31')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xfd5d('0xd')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xfd5d('0xd')](_0xfd5d('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xfd5d('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![],'defaultValue':_0xfd5d('0x32')},'amaflags':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xfd5d('0x28'),'no'),'allowNull':!![],'defaultValue':_0xfd5d('0x28')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xfd5d('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xfd5d('0xd')](_0xfd5d('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xfd5d('0xd')](_0xfd5d('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xfd5d('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xfd5d('0xd')](_0xfd5d('0x28'),'no',_0xfd5d('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xfd5d('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xfd5d('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xfd5d('0x34'),_0xfd5d('0x35'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xfd5d('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xfd5d('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xfd5d('0xd')](_0xfd5d('0x36'),_0xfd5d('0x37')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xfd5d('0xd')](_0xfd5d('0x28'),'no'),'allowNull':!![],'defaultValue':_0xfd5d('0x28')},'keepalive':{'type':Sequelize[_0xfd5d('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xfd5d('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xfd5d('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xfd5d('0xd')](_0xfd5d('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xfd5d('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xfd5d('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xfd5d('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xfd5d('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xfd5d('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xfd5d('0xd')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xfd5d('0xd')](_0xfd5d('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xfd5d('0xd')](_0xfd5d('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xfd5d('0xd')](_0xfd5d('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xfd5d('0x28'),'no',_0xfd5d('0x38'),_0xfd5d('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xfd5d('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xfd5d('0xd')]('active',_0xfd5d('0x3a'),_0xfd5d('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xfd5d('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xfd5d('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xfd5d('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xfd5d('0xd')](_0xfd5d('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xfd5d('0xd')](_0xfd5d('0x28'),'no','nonat','update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xfd5d('0x2')]},'resetPasswordExpires':{'type':Sequelize[_0xfd5d('0x3c')]},'passwordResetAt':{'type':Sequelize[_0xfd5d('0x3c')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xfd5d('0x2')]},'showWebBar':{'type':Sequelize[_0xfd5d('0x15')],'defaultValue':0x0,'set':function(_0x55fb9b){this[_0xfd5d('0x4')](_0xfd5d('0x3d'),_0x55fb9b);var _0x75846f=this['get']({'plain':!![]});switch(_0x55fb9b){case 0x0:case 0x1:var _0x131ff2=_0x75846f[_0xfd5d('0x1f')]?_[_0xfd5d('0x3e')](_0x75846f[_0xfd5d('0x1f')])?_0x75846f[_0xfd5d('0x1f')][_0xfd5d('0x1e')]():_0x75846f[_0xfd5d('0x1f')]:_0xfd5d('0x1d');if(_0x131ff2===_0xfd5d('0x3f')){_0x131ff2='udp';}this['setDataValue'](_0xfd5d('0x1f'),_0x131ff2);this[_0xfd5d('0x4')](_0xfd5d('0x40'),'no');this[_0xfd5d('0x4')](_0xfd5d('0x41'),null);this[_0xfd5d('0x4')](_0xfd5d('0x42'),null);this[_0xfd5d('0x4')](_0xfd5d('0x43'),null);this[_0xfd5d('0x4')](_0xfd5d('0x44'),null);this[_0xfd5d('0x4')](_0xfd5d('0x45'),null);this['setDataValue'](_0xfd5d('0x46'),null);this[_0xfd5d('0x4')](_0xfd5d('0x47'),null);this[_0xfd5d('0x4')](_0xfd5d('0x48'),null);this[_0xfd5d('0x4')]('rtcp_mux','no');break;case 0x2:this[_0xfd5d('0x4')](_0xfd5d('0x1f'),_0xfd5d('0x3f'));this[_0xfd5d('0x4')]('encryption',_0xfd5d('0x28'));this[_0xfd5d('0x4')](_0xfd5d('0x41'),_0xfd5d('0x28'));this[_0xfd5d('0x4')](_0xfd5d('0x42'),'yes');this[_0xfd5d('0x4')]('icesupport',_0xfd5d('0x28'));this[_0xfd5d('0x4')](_0xfd5d('0x44'),_0xfd5d('0x28'));this['setDataValue'](_0xfd5d('0x45'),'no');this[_0xfd5d('0x4')](_0xfd5d('0x46'),_0xfd5d('0x3b'));this[_0xfd5d('0x4')](_0xfd5d('0x47'),_0x75846f['dtlscertfile']||_0xfd5d('0x49'));this[_0xfd5d('0x4')](_0xfd5d('0x48'),_0x75846f[_0xfd5d('0x48')]||_0xfd5d('0x4a'));this[_0xfd5d('0x4')](_0xfd5d('0x4b'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x2db33f){this[_0xfd5d('0x4')](_0xfd5d('0x4c'),_0x2db33f?_0x2db33f[_0xfd5d('0x1e')](','):[]);},'get':function(){return this[_0xfd5d('0x9')](_0xfd5d('0x4c'))?_[_0xfd5d('0x4d')](this[_0xfd5d('0x9')](_0xfd5d('0x4c'))[_0xfd5d('0x20')](','),function(_0x244927){return parseInt(_0x244927,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xfd5d('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xfd5d('0x2')]},'phoneBarBusyNumber':{'type':Sequelize[_0xfd5d('0x2')]},'phoneBarUnconditional':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xfd5d('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xfd5d('0x2')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xfd5d('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xfd5d('0xd')](_0xfd5d('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xfd5d('0x2')]},'phoneBarEnableJaws':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xfd5d('0x4e')],'get':function(){return this[_0xfd5d('0x9')](_0xfd5d('0x4f'))?this['getDataValue']('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xfd5d('0x2')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x1f0986){if(typeof _0x1f0986===_0xfd5d('0x50')){var _0x5c0e80=_0x1f0986==='1'?!![]:_0x1f0986==='0'?![]:_0x1f0986===_0xfd5d('0x51')?!![]:_0x1f0986==='false'?![]:![];this[_0xfd5d('0x4')](_0xfd5d('0x52'),_0x5c0e80);}else{this['setDataValue'](_0xfd5d('0x52'),_0x1f0986);}}},'blocked':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':![],'set':function(_0x230bdf){this[_0xfd5d('0x4')](_0xfd5d('0x53'),_0x230bdf);if(_0x230bdf===!![]){this[_0xfd5d('0x4')](_0xfd5d('0x54'),moment());this['setDataValue'](_0xfd5d('0x55'),0x0);}else{this['setDataValue'](_0xfd5d('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0xfd5d('0x3c')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xfd5d('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xfd5d('0x14')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd7d9=['accountcode','BOOLEAN','DATE','dynamic','peer','friend','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','update','outgoing','yes','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','refuse','uac','uas','fingerprint','active','passive','nonat','get','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','wss','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','TEXT','permissions','phoneBarEnableScreenRecordingByAgent','string','screenrecording','blockedAt','loginAttempts','sequelize','moment','util','exports','STRING','name','setDataValue','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','local','INTEGER'];(function(_0x412fbb,_0x18ca2a){var _0x3002f1=function(_0x194856){while(--_0x194856){_0x412fbb['push'](_0x412fbb['shift']());}};_0x3002f1(++_0x18ca2a);}(_0xd7d9,0xe4));var _0x9d7d=function(_0x218697,_0xea54bf){_0x218697=_0x218697-0x0;var _0x29cac1=_0xd7d9[_0x218697];return _0x29cac1;};'use strict';var Sequelize=require(_0x9d7d('0x0'));var moment=require(_0x9d7d('0x1'));var util=require(_0x9d7d('0x2'));var _=require('lodash');module[_0x9d7d('0x3')]={'name':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':![],'unique':_0x9d7d('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x46eb27){this[_0x9d7d('0x6')]('name',_0x46eb27);this['setDataValue']('defaultuser',_0x46eb27);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':![],'set':function(_0xcf77b5){this[_0x9d7d('0x6')](_0x9d7d('0x7'),_0xcf77b5);this[_0x9d7d('0x6')](_0x9d7d('0x8'),util[_0x9d7d('0x9')](_0x9d7d('0xa'),_0xcf77b5,this[_0x9d7d('0xb')](_0x9d7d('0xc'))));}},'alias':{'type':Sequelize[_0x9d7d('0x4')]},'email':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':![],'unique':_0x9d7d('0xd'),'validate':{'isEmail':!![]},'set':function(_0x2da60b){if(_0x2da60b){this[_0x9d7d('0x6')](_0x9d7d('0xd'),_0x2da60b[_0x9d7d('0xe')]());}}},'role':{'type':Sequelize[_0x9d7d('0xf')](_0x9d7d('0x10'),_0x9d7d('0x11'),_0x9d7d('0x12'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x9d7d('0x4')],'defaultValue':_0x9d7d('0x13')},'internal':{'type':Sequelize[_0x9d7d('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x334d55){this[_0x9d7d('0x6')](_0x9d7d('0xc'),_0x334d55);this[_0x9d7d('0x6')](_0x9d7d('0x15'),_0x334d55);this['setDataValue'](_0x9d7d('0x8'),util[_0x9d7d('0x9')](_0x9d7d('0xa'),this[_0x9d7d('0xb')]('fullname'),_0x334d55));}},'salt':{'type':Sequelize[_0x9d7d('0x4')]},'phone':{'type':Sequelize[_0x9d7d('0x4')]},'mobile':{'type':Sequelize[_0x9d7d('0x4')]},'address':{'type':Sequelize[_0x9d7d('0x4')]},'zipcode':{'type':Sequelize[_0x9d7d('0x4')]},'userpic':{'type':Sequelize[_0x9d7d('0x4')]},'city':{'type':Sequelize[_0x9d7d('0x4')]},'country':{'type':Sequelize[_0x9d7d('0x4')]},'online':{'type':Sequelize[_0x9d7d('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x9d7d('0x17')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x9d7d('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x9d7d('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x9d7d('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x9d7d('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x9d7d('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x9d7d('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x9d7d('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x9d7d('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x9d7d('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x9d7d('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x9d7d('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x9d7d('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x9d7d('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x9d7d('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x9d7d('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x9d7d('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![],'defaultValue':_0x9d7d('0x18')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x9d7d('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x9d7d('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x9d7d('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x9d7d('0xf')]('friend','user',_0x9d7d('0x19')),'allowNull':!![],'defaultValue':_0x9d7d('0x1a')},'context':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize['ENUM'](_0x9d7d('0x1b'),'ALLOWED_PASSED_SCREEN',_0x9d7d('0x1c'),'ALLOWED',_0x9d7d('0x1d'),_0x9d7d('0x1e'),_0x9d7d('0x1f'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![],'defaultValue':'udp','set':function(_0x2e282d){this['setDataValue'](_0x9d7d('0x20'),_0x2e282d?_0x2e282d[_0x9d7d('0x21')](','):null);},'get':function(){return this[_0x9d7d('0xb')](_0x9d7d('0x20'))?this['getDataValue'](_0x9d7d('0x20'))[_0x9d7d('0x22')](','):null;},'comment':_0x9d7d('0x23')},'dtmfmode':{'type':Sequelize[_0x9d7d('0xf')](_0x9d7d('0x24'),_0x9d7d('0x25'),_0x9d7d('0x26'),_0x9d7d('0x27'),'auto'),'allowNull':!![],'defaultValue':_0x9d7d('0x24')},'directmedia':{'type':Sequelize['ENUM']('yes','no','nonat',_0x9d7d('0x28'),_0x9d7d('0x29')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9d7d('0xf')](_0x9d7d('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9d7d('0x2b'),'set':function(_0x3f5be3){this[_0x9d7d('0x6')](_0x9d7d('0x2c'),_0x3f5be3?_0x3f5be3['join'](','):null);},'get':function(){return this[_0x9d7d('0xb')](_0x9d7d('0x2c'))?this[_0x9d7d('0xb')](_0x9d7d('0x2c'))[_0x9d7d('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x9d7d('0x4')]},'namedcallgroup':{'type':Sequelize[_0x9d7d('0x4')]},'pickupgroup':{'type':Sequelize[_0x9d7d('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x9d7d('0x4')]},'language':{'type':Sequelize[_0x9d7d('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':![],'defaultValue':_0x9d7d('0x2d')},'allow':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':![],'defaultValue':_0x9d7d('0x2e'),'set':function(_0x567d11){this[_0x9d7d('0x6')](_0x9d7d('0x2f'),_0x567d11?_0x567d11[_0x9d7d('0x21')](';'):_0x9d7d('0x2e'));},'get':function(){return this[_0x9d7d('0xb')](_0x9d7d('0x2f'))?this[_0x9d7d('0xb')]('allow')[_0x9d7d('0x22')](';'):null;},'comment':_0x9d7d('0x30')},'autoframing':{'type':Sequelize[_0x9d7d('0xf')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x584919){this[_0x9d7d('0x6')](_0x9d7d('0x31'),_0x584919?_0x584919[_0x9d7d('0x21')](','):null);},'get':function(){return this['getDataValue'](_0x9d7d('0x31'))?this[_0x9d7d('0xb')](_0x9d7d('0x31'))[_0x9d7d('0x22')](','):null;},'comment':_0x9d7d('0x32')},'trustrpid':{'type':Sequelize[_0x9d7d('0xf')](_0x9d7d('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9d7d('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9d7d('0xf')](_0x9d7d('0x2a'),'no',_0x9d7d('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x9d7d('0xf')](_0x9d7d('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x9d7d('0xf')](_0x9d7d('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x9d7d('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x9d7d('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x9d7d('0x2a')},'busylevel':{'type':Sequelize[_0x9d7d('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x9d7d('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x9d7d('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x9d7d('0xf')](_0x9d7d('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x9d7d('0xf')](_0x9d7d('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x9d7d('0xf')](_0x9d7d('0x2a'),'no',_0x9d7d('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9d7d('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x9d7d('0xf')](_0x9d7d('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x9d7d('0x35'),_0x9d7d('0x36'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x9d7d('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x9d7d('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x9d7d('0xf')](_0x9d7d('0x37'),_0x9d7d('0x38')),'allowNull':!![],'defaultValue':_0x9d7d('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x9d7d('0x2a'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x9d7d('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x9d7d('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x9d7d('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x9d7d('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x9d7d('0xf')](_0x9d7d('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x9d7d('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x9d7d('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x9d7d('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x9d7d('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x9d7d('0xf')](_0x9d7d('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9d7d('0xf')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x9d7d('0xf')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x9d7d('0xf')](_0x9d7d('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x9d7d('0xf')](_0x9d7d('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x9d7d('0xf')](_0x9d7d('0x2a'),'no',_0x9d7d('0x39'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x9d7d('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x9d7d('0xf')](_0x9d7d('0x3a'),_0x9d7d('0x3b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x9d7d('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x9d7d('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x9d7d('0xf')](_0x9d7d('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x9d7d('0xf')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x9d7d('0xf')]('yes','no',_0x9d7d('0x3c'),_0x9d7d('0x28'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x9d7d('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x9d7d('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x9d7d('0x17')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize['STRING']},'showWebBar':{'type':Sequelize[_0x9d7d('0x14')],'defaultValue':0x0,'set':function(_0x2d6441){this[_0x9d7d('0x6')]('showWebBar',_0x2d6441);var _0x46f6dd=this[_0x9d7d('0x3d')]({'plain':!![]});switch(_0x2d6441){case 0x0:case 0x1:var _0xaf426f=_0x46f6dd[_0x9d7d('0x20')]?_['isArray'](_0x46f6dd['transport'])?_0x46f6dd[_0x9d7d('0x20')][_0x9d7d('0x21')]():_0x46f6dd[_0x9d7d('0x20')]:'udp';if(_0xaf426f==='wss'){_0xaf426f='udp';}this[_0x9d7d('0x6')]('transport',_0xaf426f);this[_0x9d7d('0x6')](_0x9d7d('0x3e'),'no');this[_0x9d7d('0x6')](_0x9d7d('0x3f'),null);this[_0x9d7d('0x6')](_0x9d7d('0x40'),null);this[_0x9d7d('0x6')](_0x9d7d('0x41'),null);this[_0x9d7d('0x6')](_0x9d7d('0x42'),null);this[_0x9d7d('0x6')](_0x9d7d('0x43'),null);this[_0x9d7d('0x6')](_0x9d7d('0x44'),null);this['setDataValue'](_0x9d7d('0x45'),null);this[_0x9d7d('0x6')](_0x9d7d('0x46'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0x9d7d('0x6')]('transport',_0x9d7d('0x47'));this[_0x9d7d('0x6')](_0x9d7d('0x3e'),_0x9d7d('0x2a'));this[_0x9d7d('0x6')](_0x9d7d('0x3f'),_0x9d7d('0x2a'));this['setDataValue'](_0x9d7d('0x40'),'yes');this[_0x9d7d('0x6')]('icesupport',_0x9d7d('0x2a'));this[_0x9d7d('0x6')]('dtlsenable','yes');this[_0x9d7d('0x6')](_0x9d7d('0x43'),'no');this[_0x9d7d('0x6')](_0x9d7d('0x44'),_0x9d7d('0x48'));this[_0x9d7d('0x6')](_0x9d7d('0x45'),_0x46f6dd[_0x9d7d('0x45')]||_0x9d7d('0x49'));this[_0x9d7d('0x6')]('dtlsprivatekey',_0x46f6dd[_0x9d7d('0x46')]||_0x9d7d('0x4a'));this[_0x9d7d('0x6')](_0x9d7d('0x4b'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x9d7d('0x4c')],'set':function(_0x50bed4){this[_0x9d7d('0x6')](_0x9d7d('0x4d'),_0x50bed4?_0x50bed4[_0x9d7d('0x21')](','):[]);},'get':function(){return this[_0x9d7d('0xb')](_0x9d7d('0x4d'))?_['map'](this[_0x9d7d('0xb')](_0x9d7d('0x4d'))[_0x9d7d('0x22')](','),function(_0x1faa81){return parseInt(_0x1faa81,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x9d7d('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x9d7d('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x9d7d('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x9d7d('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x9d7d('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x9d7d('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x9d7d('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x9d7d('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x9d7d('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x9d7d('0xb')](_0x9d7d('0x4e'))?this['getDataValue'](_0x9d7d('0x4e')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x9d7d('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x9d7d('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x9d7d('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0x9d7d('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x9d7d('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x9d7d('0x16')],'defaultValue':![],'set':function(_0x440782){if(typeof _0x440782===_0x9d7d('0x4f')){var _0x3a74cd=_0x440782==='1'?!![]:_0x440782==='0'?![]:_0x440782==='true'?!![]:_0x440782==='false'?![]:![];this[_0x9d7d('0x6')](_0x9d7d('0x50'),_0x3a74cd);}else{this[_0x9d7d('0x6')](_0x9d7d('0x50'),_0x440782);}}},'blocked':{'type':Sequelize[_0x9d7d('0x16')],'defaultValue':![],'set':function(_0x99141c){this[_0x9d7d('0x6')]('blocked',_0x99141c);if(_0x99141c===!![]){this[_0x9d7d('0x6')](_0x9d7d('0x51'),moment());this['setDataValue'](_0x9d7d('0x52'),0x0);}else{this[_0x9d7d('0x6')](_0x9d7d('0x51'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x9d7d('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x9d7d('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x9d7d('0x16')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 0fae209..0a217e8 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 _0x289d=['API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','resolve','queues','teams','inbound','asc','desc','uniqBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','ringing','busy','slice','charAt','toUpperCase','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./user.socket','register','client','http','request','then','User,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','status','end','count','offset','set','Content-Range','update','destroy','get','role','admin','user','agent','Telephones','telephone','filter','ignore','value','name','UserProfileResource','sendStatus','send','index','map','User','rawAttributes','type','key','model','differenceBy','salt','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','sequelize','col','lower','merge','includeAll','include','includes','push','findAll','rows','true','chat','dataValues','fax','mail','openchannel','whatsapp','all','show','keys','password','options','find','sms','body','params','describe','addContacts','ids','internal','Setting','findById','securePassword','validatePasswordPattern','isNil','min_internal','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','permissions','102','103','110','104','105','108','109','100','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','settingsEnabled','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','isEmpty','Agents','compact','changePassword','newPassword','Sequelize','ValidationError','authenticate','Wrong\x20credentials','oldPassword','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','add','capitalize','toLowerCase','spread','QueueId','emit','Queue:save','voice','VoiceQueue','format','SIP/%s','penalty','UserVoiceQueueRt','Unknown\x20channel','remove','Queues','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','download','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','getContacts','CmContact','CmList','Tag','Tags','color','tag','nolimit','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','getScreenRecordings','ScreenRecording','UserId','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','intrf','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','UserVoiceQueue.penalty','upsert','forEach','YYYY-MM-DD\x20HH:mm:ss','LOGIN','PAUSE','LOGININPAUSE','MemberReport','bulkCreate','concat','logout','QueuePause','pause','updateAttributes','DEFAULT\x20PAUSE','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','lastPauseAt','unpause','manual','Team','getTeams','addTeams','omit','getVoiceQueues','setDataValue','Chat','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','addAgent','getDataValue','Voice','removeTeams','getChatQueues','getMailQueues','flatten','removeAgent','getLists','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','getScheduledCalls','CmHopper','$and','$gt','$gte','$lt','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','firstName','Contact','dialActive','retrieveApiKey','json','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','nonce','apiKeyNonce','apiKeyIat'];(function(_0x2bdb28,_0x140b07){var _0xec9a20=function(_0x12783c){while(--_0x12783c){_0x2bdb28['push'](_0x2bdb28['shift']());}};_0xec9a20(++_0x140b07);}(_0x289d,0x1b6));var _0xd289=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x289d[_0x92c450];return _0x2a9599;};'use strict';var emlformat=require(_0xd289('0x0'));var rimraf=require(_0xd289('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd289('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd289('0x3'));var Mustache=require(_0xd289('0x4'));var util=require(_0xd289('0x5'));var path=require('path');var sox=require(_0xd289('0x6'));var csv=require('to-csv');var ejs=require(_0xd289('0x7'));var fs=require('fs');var fs_extra=require(_0xd289('0x8'));var _=require('lodash');var squel=require(_0xd289('0x9'));var crypto=require('crypto');var jsforce=require(_0xd289('0xa'));var deskjs=require(_0xd289('0xb'));var toCsv=require(_0xd289('0xc'));var querystring=require('querystring');var Papa=require(_0xd289('0xd'));var Redis=require('ioredis');var values;var authService=require(_0xd289('0xe'));var qs=require(_0xd289('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd289('0x10'));var logger=require(_0xd289('0x11'))(_0xd289('0x12'));var utils=require('../../config/utils');var config=require(_0xd289('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xd289('0x14'))['db'];config[_0xd289('0x15')]=_[_0xd289('0x16')](config[_0xd289('0x15')],{'host':_0xd289('0x17'),'port':0x18eb});var socket=require(_0xd289('0x18'))(new Redis(config[_0xd289('0x15')]));require(_0xd289('0x19'))[_0xd289('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd289('0x1b')][_0xd289('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x35fba4,_0x18e25c,_0x3e088a,_0x4cf953){return new BPromise(function(_0x3ee0ec,_0x2d89f5){var _0x354155=_0x4cf953||client;return _0x354155[_0xd289('0x1d')](_0x35fba4,_0x3e088a)[_0xd289('0x1e')](function(_0x4541f3){logger['info'](_0xd289('0x1f'),_0x18e25c,'request\x20sent');logger[_0xd289('0x20')]('User,\x20%s,\x20%s,\x20%s',_0x18e25c,_0xd289('0x21'),JSON[_0xd289('0x22')](_0x4541f3));if(_0x4541f3[_0xd289('0x23')]){if(_0x4541f3[_0xd289('0x23')]['code']===0x1f4){logger['error'](_0xd289('0x1f'),_0x18e25c,_0x4541f3[_0xd289('0x23')][_0xd289('0x24')]);return _0x2d89f5(_0x4541f3['error']['message']);}logger[_0xd289('0x23')](_0xd289('0x1f'),_0x18e25c,_0x4541f3[_0xd289('0x23')][_0xd289('0x24')]);return _0x3ee0ec(_0x4541f3['error'][_0xd289('0x24')]);}else{logger[_0xd289('0x25')](_0xd289('0x1f'),_0x18e25c,_0xd289('0x21'));_0x3ee0ec(_0x4541f3[_0xd289('0x26')][_0xd289('0x24')]);}})[_0xd289('0x27')](function(_0x54d8b7){logger[_0xd289('0x23')]('User,\x20%s,\x20%s',_0x18e25c,_0x54d8b7);_0x2d89f5(_0x54d8b7);});});}function respondWithStatusCode(_0x2cd1e3,_0x38ef04){_0x38ef04=_0x38ef04||0xcc;return function(_0x5cbe35){if(_0x5cbe35){return _0x2cd1e3['sendStatus'](_0x38ef04);}return _0x2cd1e3[_0xd289('0x28')](_0x38ef04)[_0xd289('0x29')]();};}function respondWithResult(_0x39568c,_0x23158f){_0x23158f=_0x23158f||0xc8;return function(_0x41c8ab){if(_0x41c8ab){return _0x39568c[_0xd289('0x28')](_0x23158f)['json'](_0x41c8ab);}};}function respondWithFilteredResult(_0x1b8b0f,_0x511835){return function(_0x5d3b45){if(_0x5d3b45){var _0x8d379c=_0x5d3b45[_0xd289('0x2a')],_0x194ffd=_0x511835['offset'],_0x30f181=_0x511835[_0xd289('0x2b')]+_0x511835['limit'],_0x54c8aa;if(_0x30f181>=_0x8d379c){_0x30f181=_0x8d379c;_0x54c8aa=0xc8;}else{_0x54c8aa=0xce;}_0x1b8b0f['status'](_0x54c8aa);return _0x1b8b0f[_0xd289('0x2c')](_0xd289('0x2d'),_0x194ffd+'-'+_0x30f181+'/'+_0x8d379c)['json'](_0x5d3b45);}return null;};}function patchUpdates(_0x4e522a){return function(_0x1cb32d){try{jsonpatch['apply'](_0x1cb32d,_0x4e522a,!![]);}catch(_0x1058c8){return BPromise['reject'](_0x1058c8);}return _0x1cb32d['save']();};}function saveUpdates(_0xf1b9a9,_0x3f59b5){return function(_0x49a98a){if(_0x49a98a){return _0x49a98a[_0xd289('0x2e')](_0xf1b9a9)['then'](function(_0x1750fd){return _0x1750fd;});}return null;};}function removeEntity(_0x515ab6,_0x212f7e){return function(_0x495a38){if(_0x495a38){return _0x495a38[_0xd289('0x2f')]()[_0xd289('0x1e')](function(){var _0x391b2e=_0x495a38[_0xd289('0x30')]({'plain':!![]});if(_0x391b2e[_0xd289('0x31')]===_0xd289('0x32'))return;var _0x87782a=[{'name':'Users','value':_0xd289('0x33'),'ignore':!![]},{'name':'Agents','value':_0xd289('0x34'),'ignore':![]},{'name':_0xd289('0x35'),'value':_0xd289('0x36'),'ignore':![]}];var _0x40d07c=_(_0x87782a)[_0xd289('0x37')](_0xd289('0x38'))['map'](_0xd289('0x39'))['value']();if(_['includes'](_0x40d07c,_0x391b2e['role'])){return;}var _0x6c1690=_['find'](_0x87782a,[_0xd289('0x39'),_0x391b2e[_0xd289('0x31')]])[_0xd289('0x3a')];return db[_0xd289('0x3b')][_0xd289('0x2f')]({'where':{'type':_0x6c1690,'resourceId':_0x391b2e['id']}})['then'](function(){return _0x495a38;});})[_0xd289('0x1e')](function(){_0x515ab6[_0xd289('0x28')](0xcc)[_0xd289('0x29')]();});}};}function handleEntityNotFound(_0x1af8a6,_0x2307f0){return function(_0xdd54b1){if(!_0xdd54b1){_0x1af8a6[_0xd289('0x3c')](0x194);}return _0xdd54b1;};}function handleError(_0x534e4d,_0x6cc500){_0x6cc500=_0x6cc500||0x1f4;return function(_0x210875){logger['error'](_0x210875['stack']);if(_0x210875['name']){delete _0x210875[_0xd289('0x3a')];}_0x534e4d['status'](_0x6cc500)[_0xd289('0x3d')](_0x210875);};}exports[_0xd289('0x3e')]=function(_0x58cc8e,_0x2141ef){var _0x2734d4={},_0x5e2674={},_0x4d75d5={'count':0x0,'rows':[]};var _0x3b52dc=_[_0xd289('0x3f')](db[_0xd289('0x40')][_0xd289('0x41')],function(_0x1d1ff9){return{'name':_0x1d1ff9['fieldName'],'type':_0x1d1ff9[_0xd289('0x42')][_0xd289('0x43')]};});_0x5e2674[_0xd289('0x44')]=_[_0xd289('0x45')](_[_0xd289('0x3f')](_0x3b52dc,_0xd289('0x3a')),['password',_0xd289('0x46')]);_0x5e2674[_0xd289('0x47')]=_['keys'](_0x58cc8e[_0xd289('0x47')]);_0x5e2674[_0xd289('0x48')]=_['intersection'](_0x5e2674['model'],_0x5e2674[_0xd289('0x47')]);_0x2734d4['attributes']=_[_0xd289('0x49')](_0x5e2674['model'],qs['fields'](_0x58cc8e['query'][_0xd289('0x4a')]));_0x2734d4[_0xd289('0x4b')]=_0x2734d4[_0xd289('0x4b')][_0xd289('0x4c')]?_0x2734d4[_0xd289('0x4b')]:_0x5e2674[_0xd289('0x44')];if(!_0x58cc8e['query'][_0xd289('0x4d')]('nolimit')){_0x2734d4[_0xd289('0x4e')]=qs['limit'](_0x58cc8e[_0xd289('0x47')][_0xd289('0x4e')]);_0x2734d4['offset']=qs[_0xd289('0x2b')](_0x58cc8e[_0xd289('0x47')][_0xd289('0x2b')]);}_0x2734d4[_0xd289('0x4f')]=qs[_0xd289('0x50')](_0x58cc8e[_0xd289('0x47')][_0xd289('0x50')]);_0x2734d4[_0xd289('0x51')]=qs[_0xd289('0x48')](_[_0xd289('0x52')](_0x58cc8e[_0xd289('0x47')],_0x5e2674['filters']),_0x3b52dc);if(_0x58cc8e[_0xd289('0x47')][_0xd289('0x37')]){_0x2734d4[_0xd289('0x51')]=_['merge'](_0x2734d4['where'],{'$or':_[_0xd289('0x3f')](_0x3b52dc,function(_0x1a766a){if(_0x1a766a['type']!=='VIRTUAL'){return db['sequelize'][_0xd289('0x51')](db[_0xd289('0x53')]['fn']('lower',db[_0xd289('0x53')][_0xd289('0x54')](_0x1a766a[_0xd289('0x3a')])),{'$like':db[_0xd289('0x53')]['fn'](_0xd289('0x55'),'%'+_0x58cc8e[_0xd289('0x47')][_0xd289('0x37')]+'%')});}})});}_0x2734d4=_[_0xd289('0x56')]({},_0x2734d4,_0x58cc8e['options']);var _0xbc0290={'where':_0x2734d4[_0xd289('0x51')]};return db[_0xd289('0x40')][_0xd289('0x2a')](_0xbc0290)['then'](function(_0x553405){_0x4d75d5[_0xd289('0x2a')]=_0x553405;if(_0x58cc8e['query'][_0xd289('0x57')]){_0x2734d4[_0xd289('0x58')]=[{'all':!![]}];}if(!_[_0xd289('0x59')](_0x2734d4[_0xd289('0x4b')],'id')){_0x2734d4[_0xd289('0x4b')][_0xd289('0x5a')]('id');}return db[_0xd289('0x40')][_0xd289('0x5b')](_0x2734d4);})[_0xd289('0x1e')](function(_0x52938f){_0x4d75d5[_0xd289('0x5c')]=_0x52938f;if(_0x58cc8e[_0xd289('0x47')]['openTabs']===_0xd289('0x5d')){var _0xea8b93=[];for(var _0x49be24=0x0;_0x49be24<_0x4d75d5['rows'][_0xd289('0x4c')];_0x49be24++){_0xea8b93['push'](get_open_tabs(_0xd289('0x5e'),_0x4d75d5[_0xd289('0x5c')][_0x49be24][_0xd289('0x5f')]));_0xea8b93[_0xd289('0x5a')](get_open_tabs('sms',_0x4d75d5[_0xd289('0x5c')][_0x49be24][_0xd289('0x5f')]));_0xea8b93[_0xd289('0x5a')](get_open_tabs(_0xd289('0x60'),_0x4d75d5[_0xd289('0x5c')][_0x49be24][_0xd289('0x5f')]));_0xea8b93[_0xd289('0x5a')](get_open_tabs(_0xd289('0x61'),_0x4d75d5['rows'][_0x49be24][_0xd289('0x5f')]));_0xea8b93[_0xd289('0x5a')](get_open_tabs(_0xd289('0x62'),_0x4d75d5[_0xd289('0x5c')][_0x49be24]['dataValues']));_0xea8b93[_0xd289('0x5a')](get_open_tabs(_0xd289('0x63'),_0x4d75d5[_0xd289('0x5c')][_0x49be24][_0xd289('0x5f')]));}return BPromise[_0xd289('0x64')](_0xea8b93)[_0xd289('0x1e')](function(_0x2ce17b){return _0x4d75d5;});}else{return _0x4d75d5;}})['then'](respondWithFilteredResult(_0x2141ef,_0x2734d4))[_0xd289('0x27')](handleError(_0x2141ef,null));};exports[_0xd289('0x65')]=function(_0x51cc44,_0x435a4e){var _0x56a049={'raw':![],'where':{'id':_0x51cc44['params']['id']}},_0x147c28={};_0x147c28[_0xd289('0x44')]=_[_0xd289('0x45')](_[_0xd289('0x66')](db['User']['rawAttributes']),[_0xd289('0x67'),_0xd289('0x46')]);_0x147c28[_0xd289('0x47')]=_['keys'](_0x51cc44['query']);_0x147c28['filters']=_[_0xd289('0x49')](_0x147c28[_0xd289('0x44')],_0x147c28[_0xd289('0x47')]);_0x56a049[_0xd289('0x4b')]=_[_0xd289('0x49')](_0x147c28['model'],qs[_0xd289('0x4a')](_0x51cc44[_0xd289('0x47')][_0xd289('0x4a')]));_0x56a049[_0xd289('0x4b')]=_0x56a049['attributes']['length']?_0x56a049['attributes']:_0x147c28[_0xd289('0x44')];if(_0x51cc44[_0xd289('0x47')]['includeAll']){_0x56a049[_0xd289('0x58')]=[{'all':!![]}];}_0x56a049=_[_0xd289('0x56')]({},_0x56a049,_0x51cc44[_0xd289('0x68')]);if(!_[_0xd289('0x59')](_0x56a049[_0xd289('0x4b')],'id')){_0x56a049[_0xd289('0x4b')][_0xd289('0x5a')]('id');}return db['User'][_0xd289('0x69')](_0x56a049)[_0xd289('0x1e')](handleEntityNotFound(_0x435a4e,null))['then'](function(_0x1b681c){var _0x9d0299=[];values=_0x1b681c;if(_0x51cc44[_0xd289('0x47')]['openTabs']===_0xd289('0x5d')){_0x9d0299[_0xd289('0x5a')](get_open_tabs(_0xd289('0x5e'),_0x1b681c[_0xd289('0x5f')]));_0x9d0299[_0xd289('0x5a')](get_open_tabs(_0xd289('0x6a'),_0x1b681c[_0xd289('0x5f')]));_0x9d0299[_0xd289('0x5a')](get_open_tabs(_0xd289('0x62'),_0x1b681c[_0xd289('0x5f')]));_0x9d0299['push'](get_open_tabs(_0xd289('0x63'),_0x1b681c[_0xd289('0x5f')]));_0x9d0299['push'](get_open_tabs(_0xd289('0x60'),_0x1b681c['dataValues']));_0x9d0299[_0xd289('0x5a')](get_open_tabs(_0xd289('0x61'),_0x1b681c[_0xd289('0x5f')]));return BPromise[_0xd289('0x64')](_0x9d0299);}else{return values;}})[_0xd289('0x1e')](function(_0x2637dd){return values;})[_0xd289('0x1e')](respondWithResult(_0x435a4e,null))[_0xd289('0x27')](handleError(_0x435a4e,null));};exports[_0xd289('0x2e')]=function(_0x1d8df0,_0x1279ff){if(_0x1d8df0[_0xd289('0x6b')]['id']){delete _0x1d8df0[_0xd289('0x6b')]['id'];}delete _0x1d8df0[_0xd289('0x6b')]['role'];return db['User']['find']({'where':{'id':_0x1d8df0[_0xd289('0x6c')]['id']}})['then'](handleEntityNotFound(_0x1279ff,null))[_0xd289('0x1e')](saveUpdates(_0x1d8df0['body'],null))['then'](respondWithResult(_0x1279ff,null))['catch'](handleError(_0x1279ff,null));};exports[_0xd289('0x6d')]=function(_0x5a2a9d,_0x3a7c9b){return db[_0xd289('0x40')][_0xd289('0x6d')]()[_0xd289('0x1e')](respondWithResult(_0x3a7c9b,null))[_0xd289('0x27')](handleError(_0x3a7c9b,null));};exports[_0xd289('0x6e')]=function(_0x2ef0bf,_0x4e0a43,_0x2a779d){return db['User'][_0xd289('0x69')]({'where':{'id':_0x2ef0bf[_0xd289('0x6c')]['id']}})[_0xd289('0x1e')](handleEntityNotFound(_0x4e0a43,null))[_0xd289('0x1e')](function(_0x144044){if(_0x144044){return _0x144044[_0xd289('0x6e')](_0x2ef0bf[_0xd289('0x6b')][_0xd289('0x6f')],_['omit'](_0x2ef0bf[_0xd289('0x6b')],[_0xd289('0x6f'),'id'])||{});}})[_0xd289('0x1e')](respondWithResult(_0x4e0a43,null))[_0xd289('0x27')](handleError(_0x4e0a43,null));};function validateUser(_0x17274a){return new BPromise(function(_0x7e8e8d,_0x3216c1){if(_0x17274a[_0xd289('0x70')])return _0x7e8e8d(_0x17274a);return db[_0xd289('0x71')][_0xd289('0x72')](0x1)['then'](function(_0x5080cd){if(_0x5080cd[_0xd289('0x73')])authService[_0xd289('0x74')](_0x17274a['password']);db[_0xd289('0x40')]['max']('internal')['then'](function(_0xcfb7d){if(_[_0xd289('0x75')](_0xcfb7d)){_0x17274a[_0xd289('0x70')]=_0x5080cd['min_internal']||0x1;return;}if(_[_0xd289('0x75')](_0x5080cd[_0xd289('0x76')])||_0x5080cd[_0xd289('0x76')]===_0xcfb7d){_0x17274a[_0xd289('0x70')]=_0xcfb7d+0x1;return;}if(_0x5080cd[_0xd289('0x76')]>_0xcfb7d){_0x17274a[_0xd289('0x70')]=_0x5080cd['min_internal'];return;}return db['sequelize']['query']('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0xd289('0x53')][_0xd289('0x77')][_0xd289('0x78')]})[_0xd289('0x1e')](function(_0x574bd7){if(_0x574bd7&&_0x574bd7[_0xd289('0x4c')]){for(var _0x19b520=0x0,_0x15e46f=_0x574bd7['length'];_0x19b520<_0x15e46f&&_['isNil'](_0x17274a['internal']);_0x19b520++){if(_0x5080cd[_0xd289('0x76')]<=_0x574bd7[_0x19b520][_0xd289('0x79')]){_0x17274a['internal']=_0x574bd7[_0x19b520][_0xd289('0x79')];}else if(_0x5080cd['min_internal']>_0x574bd7[_0x19b520][_0xd289('0x79')]&&_0x5080cd[_0xd289('0x76')]<=_0x574bd7[_0x19b520]['to']){_0x17274a[_0xd289('0x70')]=_0x5080cd[_0xd289('0x76')];}}}if(_[_0xd289('0x75')](_0x17274a[_0xd289('0x70')])){_0x17274a[_0xd289('0x70')]=_0xcfb7d+0x1;}return _0x7e8e8d(_0x17274a);});});})[_0xd289('0x27')](function(_0x41df6b){_0x3216c1(_0x41df6b);});});}function updateUser(_0x52d7a4){return new BPromise(function(_0x27a84d,_0x2dc141){try{if(_0x52d7a4[_0xd289('0x7a')]){_0x52d7a4[_0xd289('0x7b')]=_0x52d7a4[_0xd289('0x70')];_0x52d7a4[_0xd289('0x7c')]={'mailbox':_0x52d7a4[_0xd289('0x70')],'password':_0x52d7a4[_0xd289('0x67')],'fullname':_0x52d7a4[_0xd289('0x7d')],'email':_0x52d7a4['email']};}if(_0x52d7a4[_0xd289('0x31')]==='agent'){if(!_0x52d7a4[_0xd289('0x7e')])_0x52d7a4['permissions']=['101',_0xd289('0x7f'),_0xd289('0x80'),'113',_0xd289('0x81'),_0xd289('0x82'),_0xd289('0x83'),'106','107',_0xd289('0x84'),_0xd289('0x85'),_0xd289('0x86'),_0xd289('0x87'),_0xd289('0x88'),_0xd289('0x89')];}_0x27a84d(_0x52d7a4);}catch(_0x3dfeb8){_0x2dc141(_0x3dfeb8);}});}exports[_0xd289('0x8a')]=function(_0x496fa9,_0x4d03c7){if(_0x496fa9[_0xd289('0x33')][_0xd289('0x31')]==='agent')throw new Error(_0xd289('0x8b'));if(_0x496fa9[_0xd289('0x6b')][_0xd289('0x31')]===_0xd289('0x33')&&_0x496fa9['user']['role']!==_0xd289('0x32')){throw new Error(_0xd289('0x8c'));}if(_0x496fa9[_0xd289('0x6b')][_0xd289('0x31')]==='admin'&&_0x496fa9[_0xd289('0x33')]['role']!==_0xd289('0x32')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil['checkUserLimits']([_0x496fa9['body']])[_0xd289('0x1e')](function(){return validateUser(_0x496fa9[_0xd289('0x6b')]);})[_0xd289('0x1e')](function(_0x2e0c76){return updateUser(_0x2e0c76)[_0xd289('0x1e')](function(_0x3bf356){if(_0x3bf356['role']===_0xd289('0x32')){_0x3bf356[_0xd289('0x8d')]=_0x496fa9[_0xd289('0x33')]['settingsEnabled'];delete _0x3bf356['userProfileId'];}return _0x3bf356;});})[_0xd289('0x1e')](function(_0x39d2c1){return db['User']['create'](_0x39d2c1,{'include':[{'model':db['VoiceMail'],'as':_0xd289('0x7c')}]});})[_0xd289('0x1e')](function(_0x30a092){if(_0x496fa9[_0xd289('0x6b')][_0xd289('0x31')]==='user')return _0x30a092;if(_0x496fa9[_0xd289('0x33')][_0xd289('0x31')]!==_0xd289('0x33'))return _0x30a092;return db[_0xd289('0x8e')][_0xd289('0x69')]({'where':{'name':_0x30a092['role']===_0xd289('0x34')?'Agents':_0xd289('0x35'),'userProfileId':_0x496fa9[_0xd289('0x33')][_0xd289('0x8f')]},'raw':!![]})[_0xd289('0x1e')](function(_0x10f207){if(!_0x10f207||_0x10f207[_0xd289('0x90')]!=0x0)return _0x30a092;return db[_0xd289('0x3b')][_0xd289('0x8a')]({'name':_0x30a092[_0xd289('0x3a')],'resourceId':_0x30a092['id'],'type':_0x10f207['name'],'sectionId':_0x10f207['id']},{})['then'](function(){return _0x30a092;});})[_0xd289('0x27')](function(_0x5127a7){logger[_0xd289('0x23')](_0xd289('0x91'),_0x5127a7);throw _0x5127a7;});})[_0xd289('0x1e')](respondWithResult(_0x4d03c7,0xc9))[_0xd289('0x27')](handleError(_0x4d03c7,null));};exports['bulkCreate']=function(_0x12fc73,_0x52b07c){var _0x6a32fb=_0x12fc73['body'];var _0x263ca2=[];if(_0x12fc73['user'][_0xd289('0x31')]===_0xd289('0x34'))throw new Error(_0xd289('0x8b'));if(_[_0xd289('0x92')](_0x6a32fb,[_0xd289('0x31'),'user'])&&_0x12fc73[_0xd289('0x33')][_0xd289('0x31')]!=='admin'){throw new Error(_0xd289('0x8c'));}if(_[_0xd289('0x92')](_0x6a32fb,[_0xd289('0x31'),_0xd289('0x32')])&&_0x12fc73[_0xd289('0x33')]['role']!==_0xd289('0x32')){throw new Error(_0xd289('0x93'));}return licenseUtil['checkUserLimits'](_0x6a32fb)[_0xd289('0x1e')](function(){return validateUser(_0x6a32fb[0x0]);})[_0xd289('0x1e')](function(){for(var _0x2e86ee=0x1;_0x2e86ee<_0x6a32fb[_0xd289('0x4c')];_0x2e86ee++){var _0x14d04f=_0x6a32fb[_0x2e86ee-0x1][_0xd289('0x70')];if(!_0x6a32fb[_0x2e86ee]['internal'])_0x6a32fb[_0x2e86ee]['internal']=_0x14d04f+0x1;_0x263ca2[_0xd289('0x5a')](validateUser(_0x6a32fb[_0x2e86ee]));}return BPromise[_0xd289('0x64')](_0x263ca2);})[_0xd289('0x1e')](function(){_0x263ca2=[];for(var _0x1e50ac=0x0;_0x1e50ac<_0x6a32fb[_0xd289('0x4c')];_0x1e50ac++){_0x263ca2[_0xd289('0x5a')](updateUser(_0x6a32fb[_0x1e50ac]));}return BPromise[_0xd289('0x64')](_0x263ca2);})[_0xd289('0x1e')](function(){return BPromise[_0xd289('0x94')](_0x6a32fb,function(_0x162c87){return db[_0xd289('0x40')]['create'](_0x162c87,{'include':[{'model':db['VoiceMail'],'as':_0xd289('0x7c')}]})[_0xd289('0x1e')](function(_0x5f609f){_0x162c87['id']=_0x5f609f['id'];return _0x162c87;});});})[_0xd289('0x1e')](function(_0x104ff5){if(_0x12fc73[_0xd289('0x6b')][_0xd289('0x31')]===_0xd289('0x33'))return _0x104ff5;if(_0x12fc73[_0xd289('0x33')]['role']!==_0xd289('0x33'))return _0x104ff5;var _0x472140=_['some'](_0x104ff5,function(_0xc16cac){return _0xc16cac['role']===_0xd289('0x34')||_0xc16cac['role']===_0xd289('0x36');});if(!_0x472140)return _0x104ff5;return db['UserProfileSection'][_0xd289('0x5b')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x12fc73[_0xd289('0x33')][_0xd289('0x8f')]},'raw':!![]})[_0xd289('0x1e')](function(_0x4af532){if(_[_0xd289('0x95')](_0x4af532)||!_['some'](_0x4af532,['autoAssociation',0x0]))return _0x104ff5;_0x263ca2=[];var _0x21d4eb=_(_0x4af532)[_0xd289('0x3f')](function(_0x10619f){if(_0x10619f[_0xd289('0x90')]===0x1)return;return _0x10619f['name']===_0xd289('0x96')?_0xd289('0x34'):_0xd289('0x36');})[_0xd289('0x97')]()[_0xd289('0x39')]();for(var _0x53ce68=0x0;_0x53ce68<_0x104ff5['length'];_0x53ce68++){if(!_[_0xd289('0x59')](_0x21d4eb,_0x104ff5[_0x53ce68]['role']))return;var _0x48f3cc=_0x104ff5[_0x53ce68][_0xd289('0x31')]===_0xd289('0x34')?_0xd289('0x96'):_0xd289('0x35');_0x263ca2[_0xd289('0x5a')](db[_0xd289('0x3b')][_0xd289('0x8a')]({'name':_0x104ff5[_0x53ce68][_0xd289('0x3a')],'resourceId':_0x104ff5[_0x53ce68]['id'],'type':_0x48f3cc,'sectionId':_['find'](_0x4af532,['name',_0x48f3cc])['id']},{}));}return BPromise[_0xd289('0x64')](_0x263ca2);});})[_0xd289('0x1e')](respondWithResult(_0x52b07c,0xc9))[_0xd289('0x27')](handleError(_0x52b07c,null));};exports[_0xd289('0x98')]=function(_0x3263e6,_0x49b1d7,_0x4a93ca){if(_0x3263e6[_0xd289('0x6b')]['id']){delete _0x3263e6['body']['id'];}return db['User']['find']({'where':{'id':_0x3263e6['params']['id']}})['then'](function(_0x5f58ab){if(!_0x5f58ab)return null;if(_0x5f58ab['id']===_0x3263e6[_0xd289('0x33')]['id']){if(!_0x3263e6[_0xd289('0x6b')]['oldPassword']||!_0x3263e6[_0xd289('0x6b')][_0xd289('0x99')]){throw new db[(_0xd289('0x9a'))][(_0xd289('0x9b'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x5f58ab[_0xd289('0x9c')](_0x3263e6[_0xd289('0x6b')]['oldPassword'])){throw new db[(_0xd289('0x9a'))]['ValidationError'](_0xd289('0x9d'));}if(_0x3263e6[_0xd289('0x6b')][_0xd289('0x9e')]===_0x3263e6[_0xd289('0x6b')][_0xd289('0x99')]){throw new db['Sequelize']['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x3263e6[_0xd289('0x33')][_0xd289('0x31')]===_0xd289('0x32')){if(!_0x3263e6['body']['newPassword']){throw new db[(_0xd289('0x9a'))][(_0xd289('0x9b'))](_0xd289('0x9f'));}}else if(_0x3263e6['user'][_0xd289('0x31')]===_0xd289('0x33')){if(!_0x3263e6[_0xd289('0x6b')][_0xd289('0x99')]){throw new db[(_0xd289('0x9a'))][(_0xd289('0x9b'))](_0xd289('0x9f'));}if(_0x5f58ab[_0xd289('0x31')]!==_0xd289('0x34')){throw new db[(_0xd289('0x9a'))][(_0xd289('0x9b'))](_0xd289('0x8b'));}}else{throw new db[(_0xd289('0x9a'))][(_0xd289('0x9b'))](_0xd289('0x8b'));}return _0x5f58ab;})[_0xd289('0x1e')](handleEntityNotFound(_0x49b1d7,null))[_0xd289('0x1e')](function(_0x4141b5){return db[_0xd289('0x71')][_0xd289('0xa0')]({'attributes':['id',_0xd289('0x73'),_0xd289('0xa1'),_0xd289('0xa2')]})[_0xd289('0x1e')](function(_0x32d369){if(_0x32d369['securePassword'])authService[_0xd289('0x74')](_0x3263e6[_0xd289('0x6b')][_0xd289('0x99')]);if(!_0x32d369[_0xd289('0xa1')]||!_0x4141b5['previousPasswords'])return _0x4141b5;authService['validatePasswordHistory'](_0x3263e6[_0xd289('0x6b')]['newPassword'],_0x4141b5['previousPasswords'],_0x32d369[_0xd289('0xa2')]);return _0x4141b5;})[_0xd289('0x1e')](saveUpdates({'password':_0x3263e6[_0xd289('0x6b')][_0xd289('0x99')],'passwordResetAt':_0x3263e6[_0xd289('0x33')]['id']==_0x3263e6[_0xd289('0x6c')]['id']?moment():null,'previousPasswords':authService[_0xd289('0xa3')](_0x3263e6[_0xd289('0x6b')][_0xd289('0x99')],_0x4141b5['previousPasswords'])},null));})[_0xd289('0x1e')](respondWithResult(_0x49b1d7,null))[_0xd289('0x27')](handleError(_0x49b1d7,null));};exports[_0xd289('0xa4')]=function(_0x497a3b,_0xd5b9a3,_0x708920){var _0x4dce4d=_0x497a3b[_0xd289('0x6b')][_0xd289('0xa5')];return db[_0xd289('0x40')][_0xd289('0x69')]({'where':{'id':_0x497a3b[_0xd289('0x6c')]['id']},'attributes':['id',_0xd289('0x3a'),_0xd289('0x31'),_0xd289('0xa6'),_0xd289('0xa7'),_0xd289('0xa8'),_0xd289('0xa9')]})['then'](handleEntityNotFound(_0xd5b9a3,null))[_0xd289('0x1e')](function(_0x3afeb5){if(_0x3afeb5){if(!utils[_0xd289('0xaa')](_0x4dce4d)){throw new db['Sequelize'][(_0xd289('0x9b'))]('Unknown\x20channel');}return _0x3afeb5[_0xd289('0xab')+_[_0xd289('0xac')](_0x4dce4d[_0xd289('0xad')]())+'Queues'](_0x497a3b[_0xd289('0x6b')]['ids'],{'penalty':_0x497a3b[_0xd289('0x6b')]['penalty']||0x0})[_0xd289('0xae')](function(_0x334574){for(var _0x32e3ae=0x0;_0x32e3ae<_0x497a3b[_0xd289('0x6b')]['ids'][_0xd289('0x4c')];_0x32e3ae+=0x1){var _0x2aa50e={'UserId':_0x497a3b['params']['id']};_0x2aa50e[_[_0xd289('0xac')](_0x4dce4d['toLowerCase']())+_0xd289('0xaf')]=_0x497a3b[_0xd289('0x6b')][_0xd289('0x6f')][_0x32e3ae];socket[_0xd289('0xb0')](_0xd289('0x33')+_[_0xd289('0xac')](_0x4dce4d[_0xd289('0xad')]())+_0xd289('0xb1'),_0x2aa50e);}return _0x334574;})[_0xd289('0x1e')](function(){if(_0x4dce4d===_0xd289('0xb2')){return db[_0xd289('0xb3')]['findAll']({'where':{'id':_0x497a3b[_0xd289('0x6b')][_0xd289('0x6f')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xd289('0x1e')](function(_0x94abc2){var _0x4cf7f7=_0x3afeb5[_0xd289('0x30')]({'plain':!![]});var _0x72ea5d=[];if(_0x4dce4d==='voice'&&_0x4cf7f7[_0xd289('0x31')]===_0xd289('0x34')&&_0x4cf7f7[_0xd289('0xa6')]){for(var _0x12b4b9=0x0;_0x12b4b9<_0x94abc2['length'];_0x12b4b9+=0x1){_0x72ea5d['push']({'membername':_0x4cf7f7[_0xd289('0x3a')],'UserId':_0x4cf7f7['id'],'queue_name':_0x94abc2[_0x12b4b9]['name'],'VoiceQueueId':_0x94abc2[_0x12b4b9]['id'],'interface':_['isNil'](_0x4cf7f7[_0xd289('0xa9')])?util[_0xd289('0xb4')](_0xd289('0xb5'),_0x4cf7f7['name']):_0x4cf7f7['interface'],'paused':_0x4cf7f7[_0xd289('0xa8')]||![],'penalty':_0x497a3b[_0xd289('0x6b')][_0xd289('0xb6')]||0x0});}return BPromise[_0xd289('0x94')](_0x72ea5d,function(_0x4aeeb5){return db[_0xd289('0xb7')]['upsert'](_0x4aeeb5);});}return _0x3afeb5;});}})['then'](respondWithStatusCode(_0xd5b9a3,null))[_0xd289('0x27')](handleError(_0xd5b9a3,null));};exports['removeQueues']=function(_0x22a2dd,_0x5096e4,_0x3944a2){var _0x123feb;return db[_0xd289('0x40')]['find']({'where':{'id':_0x22a2dd[_0xd289('0x6c')]['id']},'attributes':['id',_0xd289('0x3a'),_0xd289('0x31')]})['then'](handleEntityNotFound(_0x5096e4,null))['then'](function(_0x3457bb){if(_0x3457bb){_0x123feb=_0x3457bb;if(!_0x22a2dd['query'][_0xd289('0xa5')]||!utils[_0xd289('0xaa')](_0x22a2dd[_0xd289('0x47')][_0xd289('0xa5')])){throw new db[(_0xd289('0x9a'))]['ValidationError'](_0xd289('0xb8'));}return _0x3457bb[_0xd289('0xb9')+_[_0xd289('0xac')](_0x22a2dd[_0xd289('0x47')][_0xd289('0xa5')]['toLowerCase']())+_0xd289('0xba')](_0x22a2dd[_0xd289('0x47')][_0xd289('0x6f')]);}})[_0xd289('0x1e')](function(_0x13c19f){for(var _0x198a8f=0x0;_0x198a8f<_0x22a2dd['query'][_0xd289('0x6f')]['length'];_0x198a8f+=0x1){var _0x21250e={'UserId':_0x22a2dd[_0xd289('0x6c')]['id']};_0x21250e[_[_0xd289('0xac')](_0x22a2dd[_0xd289('0x47')][_0xd289('0xa5')][_0xd289('0xad')]())+'QueueId']=_0x22a2dd[_0xd289('0x47')][_0xd289('0x6f')][_0x198a8f];socket[_0xd289('0xb0')]('user'+_[_0xd289('0xac')](_0x22a2dd[_0xd289('0x47')][_0xd289('0xa5')][_0xd289('0xad')]())+_0xd289('0xbb'),_0x21250e);}return _0x13c19f;})[_0xd289('0x1e')](function(){if(_0x22a2dd[_0xd289('0x47')][_0xd289('0xa5')]==='voice'){return db[_0xd289('0xb7')][_0xd289('0x2f')]({'where':{'UserId':_0x22a2dd['params']['id'],'VoiceQueueId':_0x22a2dd['query'][_0xd289('0x6f')]},'individualHooks':!![]})[_0xd289('0x1e')](function(){return _0x123feb;});}return _0x123feb;})[_0xd289('0x1e')](respondWithStatusCode(_0x5096e4,null))[_0xd289('0x27')](handleError(_0x5096e4,null));};exports[_0xd289('0xbc')]=function(_0x537496,_0x2a4e0e,_0x215063){_0x537496[_0xd289('0x6b')][_0xd289('0xbd')]=_0x537496[_0xd289('0xbe')][_0xd289('0xbf')];return db[_0xd289('0x40')][_0xd289('0x69')]({'where':{'id':_0x537496[_0xd289('0x6c')]['id']}})[_0xd289('0x1e')](handleEntityNotFound(_0x2a4e0e,null))['then'](saveUpdates(_0x537496[_0xd289('0x6b')],null))[_0xd289('0x1e')](respondWithResult(_0x2a4e0e,null))[_0xd289('0x27')](handleError(_0x2a4e0e,null));};exports[_0xd289('0xc0')]=function(_0x343fde,_0x1f3ee,_0x5642ea){var _0x4b9d04=path[_0xd289('0xc1')](config[_0xd289('0xc2')],'server/files/images/logos/default_profile.png');return db[_0xd289('0x40')][_0xd289('0x69')]({'where':{'id':_0x343fde[_0xd289('0x6c')]['id']},'attributes':['id',_0xd289('0xbd')],'raw':!![]})[_0xd289('0x1e')](handleEntityNotFound(_0x1f3ee,null))[_0xd289('0x1e')](function(_0x53d2a3){if(_0x53d2a3){if(_[_0xd289('0x75')](_0x53d2a3['userpic'])){return _0x1f3ee[_0xd289('0xc3')](_0x4b9d04);}else{if(!fs[_0xd289('0xc4')](path[_0xd289('0xc1')](config[_0xd289('0xc2')],_0xd289('0xc5'),_0x53d2a3[_0xd289('0xbd')]))){return _0x1f3ee['download'](_0x4b9d04);}return _0x1f3ee[_0xd289('0xc3')](path[_0xd289('0xc1')](config['root'],_0xd289('0xc5'),_0x53d2a3['userpic']));}}})[_0xd289('0x27')](handleError(_0x1f3ee,null));};exports[_0xd289('0xc6')]=function(_0x1c7e54,_0x397ba6,_0xf3176){return db[_0xd289('0x40')][_0xd289('0x69')]({'where':{'id':_0x1c7e54['params']['id']},'attributes':['id']})[_0xd289('0x1e')](handleEntityNotFound(_0x397ba6,null))['then'](function(_0x21e2b7){var _0x364f1c=[];values=_0x21e2b7[_0xd289('0x5f')];_0x364f1c[_0xd289('0x5a')](get_open_tabs(_0xd289('0x5e'),_0x21e2b7[_0xd289('0x5f')]));_0x364f1c['push'](get_open_tabs(_0xd289('0x6a'),_0x21e2b7['dataValues']));_0x364f1c['push'](get_open_tabs(_0xd289('0x62'),_0x21e2b7[_0xd289('0x5f')]));_0x364f1c[_0xd289('0x5a')](get_open_tabs(_0xd289('0x63'),_0x21e2b7[_0xd289('0x5f')]));_0x364f1c[_0xd289('0x5a')](get_open_tabs(_0xd289('0x60'),_0x21e2b7[_0xd289('0x5f')]));_0x364f1c[_0xd289('0x5a')](get_open_tabs(_0xd289('0x61'),_0x21e2b7[_0xd289('0x5f')]));return BPromise['all'](_0x364f1c);})['then'](function(_0x48f58d){var _0x5bbf3c=[];if(_0x48f58d){for(var _0x19f950=0x0;_0x19f950=_0x34151b){_0x528447=_0x34151b;_0x4e9a9e=0xc8;}else{_0x4e9a9e=0xce;}_0x455cea[_0x823e('0x25')](_0x4e9a9e);return _0x455cea[_0x823e('0x29')](_0x823e('0x2a'),_0x97943c+'-'+_0x528447+'/'+_0x34151b)['json'](_0x2fefb3);}return null;};}function patchUpdates(_0x4fd21d){return function(_0x2ffa0d){try{jsonpatch[_0x823e('0x2b')](_0x2ffa0d,_0x4fd21d,!![]);}catch(_0x75523c){return BPromise[_0x823e('0x2c')](_0x75523c);}return _0x2ffa0d[_0x823e('0x2d')]();};}function saveUpdates(_0x5b3f0b,_0x21ce60){return function(_0x4e1d5f){if(_0x4e1d5f){return _0x4e1d5f[_0x823e('0x2e')](_0x5b3f0b)['then'](function(_0x5be159){return _0x5be159;});}return null;};}function removeEntity(_0x542d74,_0x4653b3){return function(_0x4ac109){if(_0x4ac109){return _0x4ac109[_0x823e('0x2f')]()[_0x823e('0x1a')](function(){var _0x1f9b16=_0x4ac109[_0x823e('0x30')]({'plain':!![]});if(_0x1f9b16[_0x823e('0x31')]==='admin')return;var _0x2eb593=[{'name':_0x823e('0x32'),'value':_0x823e('0x33'),'ignore':!![]},{'name':_0x823e('0x34'),'value':_0x823e('0x35'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x5554bf=_(_0x2eb593)['filter'](_0x823e('0x36'))[_0x823e('0x37')]('value')['value']();if(_[_0x823e('0x38')](_0x5554bf,_0x1f9b16['role'])){return;}var _0x1a10bb=_[_0x823e('0x39')](_0x2eb593,[_0x823e('0x3a'),_0x1f9b16[_0x823e('0x31')]])[_0x823e('0x3b')];return db[_0x823e('0x3c')]['destroy']({'where':{'type':_0x1a10bb,'resourceId':_0x1f9b16['id']}})[_0x823e('0x1a')](function(){return _0x4ac109;});})['then'](function(){_0x542d74[_0x823e('0x25')](0xcc)[_0x823e('0x3d')]();});}};}function handleEntityNotFound(_0x3a206d,_0x52860a){return function(_0x470284){if(!_0x470284){_0x3a206d[_0x823e('0x24')](0x194);}return _0x470284;};}function handleError(_0x508ccd,_0x1df71e){_0x1df71e=_0x1df71e||0x1f4;return function(_0xbcfae8){logger[_0x823e('0x1e')](_0xbcfae8[_0x823e('0x3e')]);if(_0xbcfae8[_0x823e('0x3b')]){delete _0xbcfae8[_0x823e('0x3b')];}_0x508ccd[_0x823e('0x25')](_0x1df71e)['send'](_0xbcfae8);};}exports[_0x823e('0x3f')]=function(_0x102123,_0x15d66a){var _0x1be3e6={},_0x48368d={},_0x14f4ff={'count':0x0,'rows':[]};var _0x3ba7b4=_[_0x823e('0x37')](db['User'][_0x823e('0x40')],function(_0x268eaa){return{'name':_0x268eaa[_0x823e('0x41')],'type':_0x268eaa[_0x823e('0x42')]['key']};});_0x48368d[_0x823e('0x43')]=_[_0x823e('0x44')](_['map'](_0x3ba7b4,_0x823e('0x3b')),[_0x823e('0x45'),_0x823e('0x46')]);_0x48368d[_0x823e('0x47')]=_[_0x823e('0x48')](_0x102123[_0x823e('0x47')]);_0x48368d[_0x823e('0x49')]=_[_0x823e('0x4a')](_0x48368d['model'],_0x48368d[_0x823e('0x47')]);_0x1be3e6[_0x823e('0x4b')]=_[_0x823e('0x4a')](_0x48368d['model'],qs[_0x823e('0x4c')](_0x102123[_0x823e('0x47')][_0x823e('0x4c')]));_0x1be3e6[_0x823e('0x4b')]=_0x1be3e6[_0x823e('0x4b')][_0x823e('0x4d')]?_0x1be3e6[_0x823e('0x4b')]:_0x48368d[_0x823e('0x43')];if(!_0x102123[_0x823e('0x47')][_0x823e('0x4e')]('nolimit')){_0x1be3e6[_0x823e('0x28')]=qs[_0x823e('0x28')](_0x102123['query'][_0x823e('0x28')]);_0x1be3e6[_0x823e('0x27')]=qs[_0x823e('0x27')](_0x102123[_0x823e('0x47')][_0x823e('0x27')]);}_0x1be3e6[_0x823e('0x4f')]=qs[_0x823e('0x50')](_0x102123['query'][_0x823e('0x50')]);_0x1be3e6['where']=qs['filters'](_[_0x823e('0x51')](_0x102123[_0x823e('0x47')],_0x48368d[_0x823e('0x49')]),_0x3ba7b4);if(_0x102123[_0x823e('0x47')]['filter']){_0x1be3e6[_0x823e('0x52')]=_[_0x823e('0x53')](_0x1be3e6[_0x823e('0x52')],{'$or':_[_0x823e('0x37')](_0x3ba7b4,function(_0x425a5e){if(_0x425a5e[_0x823e('0x42')]!==_0x823e('0x54')){return db[_0x823e('0x55')][_0x823e('0x52')](db[_0x823e('0x55')]['fn'](_0x823e('0x56'),db['sequelize'][_0x823e('0x57')](_0x425a5e['name'])),{'$like':db[_0x823e('0x55')]['fn'](_0x823e('0x56'),'%'+_0x102123[_0x823e('0x47')][_0x823e('0x58')]+'%')});}})});}_0x1be3e6=_[_0x823e('0x53')]({},_0x1be3e6,_0x102123['options']);var _0x4d8276={'where':_0x1be3e6[_0x823e('0x52')]};return db[_0x823e('0x59')][_0x823e('0x26')](_0x4d8276)[_0x823e('0x1a')](function(_0x162513){_0x14f4ff[_0x823e('0x26')]=_0x162513;if(_0x102123[_0x823e('0x47')][_0x823e('0x5a')]){_0x1be3e6[_0x823e('0x5b')]=[{'all':!![]}];}if(!_['includes'](_0x1be3e6[_0x823e('0x4b')],'id')){_0x1be3e6[_0x823e('0x4b')]['push']('id');}return db['User'][_0x823e('0x5c')](_0x1be3e6);})[_0x823e('0x1a')](function(_0x2ccb7f){_0x14f4ff[_0x823e('0x5d')]=_0x2ccb7f;if(_0x102123[_0x823e('0x47')][_0x823e('0x5e')]==='true'){var _0x8412f8=[];for(var _0x5017a8=0x0;_0x5017a8<_0x14f4ff[_0x823e('0x5d')][_0x823e('0x4d')];_0x5017a8++){_0x8412f8[_0x823e('0x5f')](get_open_tabs(_0x823e('0x60'),_0x14f4ff['rows'][_0x5017a8][_0x823e('0x61')]));_0x8412f8['push'](get_open_tabs(_0x823e('0x62'),_0x14f4ff[_0x823e('0x5d')][_0x5017a8][_0x823e('0x61')]));_0x8412f8[_0x823e('0x5f')](get_open_tabs(_0x823e('0x63'),_0x14f4ff['rows'][_0x5017a8][_0x823e('0x61')]));_0x8412f8['push'](get_open_tabs(_0x823e('0x64'),_0x14f4ff[_0x823e('0x5d')][_0x5017a8][_0x823e('0x61')]));_0x8412f8[_0x823e('0x5f')](get_open_tabs(_0x823e('0x65'),_0x14f4ff[_0x823e('0x5d')][_0x5017a8][_0x823e('0x61')]));_0x8412f8[_0x823e('0x5f')](get_open_tabs(_0x823e('0x66'),_0x14f4ff[_0x823e('0x5d')][_0x5017a8]['dataValues']));}return BPromise[_0x823e('0x67')](_0x8412f8)[_0x823e('0x1a')](function(_0x57dfd5){return _0x14f4ff;});}else{return _0x14f4ff;}})['then'](respondWithFilteredResult(_0x15d66a,_0x1be3e6))[_0x823e('0x23')](handleError(_0x15d66a,null));};exports[_0x823e('0x68')]=function(_0x40c3a0,_0x411e57){var _0x32216b={'raw':![],'where':{'id':_0x40c3a0['params']['id']}},_0x1f7b89={};_0x1f7b89[_0x823e('0x43')]=_[_0x823e('0x44')](_[_0x823e('0x48')](db[_0x823e('0x59')][_0x823e('0x40')]),['password',_0x823e('0x46')]);_0x1f7b89[_0x823e('0x47')]=_['keys'](_0x40c3a0['query']);_0x1f7b89[_0x823e('0x49')]=_['intersection'](_0x1f7b89[_0x823e('0x43')],_0x1f7b89[_0x823e('0x47')]);_0x32216b[_0x823e('0x4b')]=_[_0x823e('0x4a')](_0x1f7b89[_0x823e('0x43')],qs[_0x823e('0x4c')](_0x40c3a0[_0x823e('0x47')][_0x823e('0x4c')]));_0x32216b[_0x823e('0x4b')]=_0x32216b[_0x823e('0x4b')]['length']?_0x32216b[_0x823e('0x4b')]:_0x1f7b89['model'];if(_0x40c3a0['query'][_0x823e('0x5a')]){_0x32216b[_0x823e('0x5b')]=[{'all':!![]}];}_0x32216b=_['merge']({},_0x32216b,_0x40c3a0[_0x823e('0x69')]);if(!_[_0x823e('0x38')](_0x32216b['attributes'],'id')){_0x32216b[_0x823e('0x4b')]['push']('id');}return db['User'][_0x823e('0x39')](_0x32216b)[_0x823e('0x1a')](handleEntityNotFound(_0x411e57,null))[_0x823e('0x1a')](function(_0xf80c1c){var _0x40d6b7=[];values=_0xf80c1c;if(_0x40c3a0['query'][_0x823e('0x5e')]===_0x823e('0x6a')){_0x40d6b7[_0x823e('0x5f')](get_open_tabs('chat',_0xf80c1c[_0x823e('0x61')]));_0x40d6b7['push'](get_open_tabs(_0x823e('0x62'),_0xf80c1c[_0x823e('0x61')]));_0x40d6b7[_0x823e('0x5f')](get_open_tabs(_0x823e('0x65'),_0xf80c1c['dataValues']));_0x40d6b7[_0x823e('0x5f')](get_open_tabs(_0x823e('0x66'),_0xf80c1c[_0x823e('0x61')]));_0x40d6b7[_0x823e('0x5f')](get_open_tabs(_0x823e('0x63'),_0xf80c1c[_0x823e('0x61')]));_0x40d6b7[_0x823e('0x5f')](get_open_tabs(_0x823e('0x64'),_0xf80c1c[_0x823e('0x61')]));return BPromise[_0x823e('0x67')](_0x40d6b7);}else{return values;}})[_0x823e('0x1a')](function(_0x3cab3){return values;})[_0x823e('0x1a')](respondWithResult(_0x411e57,null))['catch'](handleError(_0x411e57,null));};exports[_0x823e('0x2e')]=function(_0x33e262,_0x53b1d2){if(_0x33e262[_0x823e('0x6b')]['id']){delete _0x33e262['body']['id'];}delete _0x33e262[_0x823e('0x6b')][_0x823e('0x31')];return db[_0x823e('0x59')][_0x823e('0x39')]({'where':{'id':_0x33e262[_0x823e('0x6c')]['id']}})[_0x823e('0x1a')](handleEntityNotFound(_0x53b1d2,null))[_0x823e('0x1a')](saveUpdates(_0x33e262['body'],null))[_0x823e('0x1a')](respondWithResult(_0x53b1d2,null))['catch'](handleError(_0x53b1d2,null));};exports['describe']=function(_0x5a0a3c,_0x5f3675){return db['User'][_0x823e('0x6d')]()[_0x823e('0x1a')](respondWithResult(_0x5f3675,null))[_0x823e('0x23')](handleError(_0x5f3675,null));};exports[_0x823e('0x6e')]=function(_0x411889,_0x201698,_0x15d512){return db[_0x823e('0x59')][_0x823e('0x39')]({'where':{'id':_0x411889[_0x823e('0x6c')]['id']}})[_0x823e('0x1a')](handleEntityNotFound(_0x201698,null))[_0x823e('0x1a')](function(_0x349825){if(_0x349825){return _0x349825['addContacts'](_0x411889[_0x823e('0x6b')][_0x823e('0x6f')],_[_0x823e('0x70')](_0x411889[_0x823e('0x6b')],[_0x823e('0x6f'),'id'])||{});}})[_0x823e('0x1a')](respondWithResult(_0x201698,null))[_0x823e('0x23')](handleError(_0x201698,null));};function validateUser(_0x180392){return new BPromise(function(_0x25377c,_0x462730){if(_0x180392[_0x823e('0x71')])return _0x25377c(_0x180392);return db[_0x823e('0x72')][_0x823e('0x73')](0x1)[_0x823e('0x1a')](function(_0x4849bf){if(_0x4849bf[_0x823e('0x74')])authService['validatePasswordPattern'](_0x180392['password']);db[_0x823e('0x59')][_0x823e('0x75')](_0x823e('0x71'))[_0x823e('0x1a')](function(_0x1ebb7d){if(_[_0x823e('0x76')](_0x1ebb7d)){_0x180392['internal']=_0x4849bf[_0x823e('0x77')]||0x1;return;}if(_[_0x823e('0x76')](_0x4849bf['min_internal'])||_0x4849bf['min_internal']===_0x1ebb7d){_0x180392['internal']=_0x1ebb7d+0x1;return;}if(_0x4849bf[_0x823e('0x77')]>_0x1ebb7d){_0x180392[_0x823e('0x71')]=_0x4849bf[_0x823e('0x77')];return;}return db[_0x823e('0x55')]['query'](_0x823e('0x78'),{'type':db[_0x823e('0x55')][_0x823e('0x79')]['SELECT']})[_0x823e('0x1a')](function(_0x37b323){if(_0x37b323&&_0x37b323[_0x823e('0x4d')]){for(var _0x44c3a2=0x0,_0x185583=_0x37b323['length'];_0x44c3a2<_0x185583&&_[_0x823e('0x76')](_0x180392['internal']);_0x44c3a2++){if(_0x4849bf[_0x823e('0x77')]<=_0x37b323[_0x44c3a2]['from']){_0x180392[_0x823e('0x71')]=_0x37b323[_0x44c3a2][_0x823e('0x7a')];}else if(_0x4849bf[_0x823e('0x77')]>_0x37b323[_0x44c3a2][_0x823e('0x7a')]&&_0x4849bf[_0x823e('0x77')]<=_0x37b323[_0x44c3a2]['to']){_0x180392['internal']=_0x4849bf[_0x823e('0x77')];}}}if(_[_0x823e('0x76')](_0x180392[_0x823e('0x71')])){_0x180392[_0x823e('0x71')]=_0x1ebb7d+0x1;}return _0x25377c(_0x180392);});});})[_0x823e('0x23')](function(_0xe90696){_0x462730(_0xe90696);});});}function updateUser(_0x3d3bf2){return new BPromise(function(_0x1b69bb,_0x5cadd8){try{if(_0x3d3bf2['voicemail']){_0x3d3bf2['mailbox']=_0x3d3bf2[_0x823e('0x71')];_0x3d3bf2[_0x823e('0x7b')]={'mailbox':_0x3d3bf2[_0x823e('0x71')],'password':_0x3d3bf2[_0x823e('0x45')],'fullname':_0x3d3bf2[_0x823e('0x7c')],'email':_0x3d3bf2[_0x823e('0x7d')]};}if(_0x3d3bf2[_0x823e('0x31')]==='agent'){if(!_0x3d3bf2[_0x823e('0x7e')])_0x3d3bf2[_0x823e('0x7e')]=[_0x823e('0x7f'),_0x823e('0x80'),'103',_0x823e('0x81'),_0x823e('0x82'),_0x823e('0x83'),_0x823e('0x84'),_0x823e('0x85'),_0x823e('0x86'),'108',_0x823e('0x87'),_0x823e('0x88'),_0x823e('0x89'),_0x823e('0x8a'),_0x823e('0x8b')];}_0x1b69bb(_0x3d3bf2);}catch(_0x391928){_0x5cadd8(_0x391928);}});}exports[_0x823e('0x8c')]=function(_0x94cd59,_0x5142e7){if(_0x94cd59[_0x823e('0x33')][_0x823e('0x31')]===_0x823e('0x35'))throw new Error(_0x823e('0x8d'));if(_0x94cd59[_0x823e('0x6b')][_0x823e('0x31')]==='user'&&_0x94cd59[_0x823e('0x33')][_0x823e('0x31')]!==_0x823e('0x8e')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x94cd59[_0x823e('0x6b')][_0x823e('0x31')]===_0x823e('0x8e')&&_0x94cd59['user'][_0x823e('0x31')]!==_0x823e('0x8e')){throw new Error(_0x823e('0x8f'));}return licenseUtil['checkUserLimits']([_0x94cd59[_0x823e('0x6b')]])[_0x823e('0x1a')](function(){return validateUser(_0x94cd59[_0x823e('0x6b')]);})[_0x823e('0x1a')](function(_0x548766){return updateUser(_0x548766)[_0x823e('0x1a')](function(_0x2ab682){if(_0x2ab682['role']===_0x823e('0x8e')){_0x2ab682[_0x823e('0x90')]=_0x94cd59['user']['settingsEnabled'];delete _0x2ab682[_0x823e('0x91')];}return _0x2ab682;});})['then'](function(_0x5a40b6){return db[_0x823e('0x59')][_0x823e('0x8c')](_0x5a40b6,{'include':[{'model':db[_0x823e('0x7b')],'as':_0x823e('0x7b')}]});})['then'](function(_0x5ae974){if(_0x94cd59['body'][_0x823e('0x31')]===_0x823e('0x33'))return _0x5ae974;if(_0x94cd59[_0x823e('0x33')][_0x823e('0x31')]!==_0x823e('0x33'))return _0x5ae974;return db[_0x823e('0x92')][_0x823e('0x39')]({'where':{'name':_0x5ae974[_0x823e('0x31')]===_0x823e('0x35')?_0x823e('0x34'):_0x823e('0x93'),'userProfileId':_0x94cd59['user']['userProfileId']},'raw':!![]})['then'](function(_0x4e00d6){if(!_0x4e00d6||_0x4e00d6['autoAssociation']!=0x0)return _0x5ae974;return db[_0x823e('0x3c')][_0x823e('0x8c')]({'name':_0x5ae974['name'],'resourceId':_0x5ae974['id'],'type':_0x4e00d6[_0x823e('0x3b')],'sectionId':_0x4e00d6['id']},{})[_0x823e('0x1a')](function(){return _0x5ae974;});})[_0x823e('0x23')](function(_0x1a86b1){logger['error'](_0x823e('0x94'),_0x1a86b1);throw _0x1a86b1;});})['then'](respondWithResult(_0x5142e7,0xc9))[_0x823e('0x23')](handleError(_0x5142e7,null));};exports[_0x823e('0x95')]=function(_0x5cc581,_0x488b59){var _0x3cc8e2=_0x5cc581[_0x823e('0x6b')];var _0x27a78b=[];if(_0x5cc581['user'][_0x823e('0x31')]===_0x823e('0x35'))throw new Error(_0x823e('0x8d'));if(_[_0x823e('0x96')](_0x3cc8e2,[_0x823e('0x31'),_0x823e('0x33')])&&_0x5cc581['user'][_0x823e('0x31')]!==_0x823e('0x8e')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x823e('0x96')](_0x3cc8e2,[_0x823e('0x31'),_0x823e('0x8e')])&&_0x5cc581['user'][_0x823e('0x31')]!==_0x823e('0x8e')){throw new Error(_0x823e('0x97'));}return licenseUtil[_0x823e('0x98')](_0x3cc8e2)[_0x823e('0x1a')](function(){return validateUser(_0x3cc8e2[0x0]);})[_0x823e('0x1a')](function(){for(var _0x5196e3=0x1;_0x5196e3<_0x3cc8e2[_0x823e('0x4d')];_0x5196e3++){var _0x23c109=_0x3cc8e2[_0x5196e3-0x1][_0x823e('0x71')];if(!_0x3cc8e2[_0x5196e3][_0x823e('0x71')])_0x3cc8e2[_0x5196e3][_0x823e('0x71')]=_0x23c109+0x1;_0x27a78b['push'](validateUser(_0x3cc8e2[_0x5196e3]));}return BPromise[_0x823e('0x67')](_0x27a78b);})['then'](function(){_0x27a78b=[];for(var _0x3bd1fa=0x0;_0x3bd1fa<_0x3cc8e2['length'];_0x3bd1fa++){_0x27a78b[_0x823e('0x5f')](updateUser(_0x3cc8e2[_0x3bd1fa]));}return BPromise[_0x823e('0x67')](_0x27a78b);})[_0x823e('0x1a')](function(){return BPromise[_0x823e('0x99')](_0x3cc8e2,function(_0x5c480b){return db['User']['create'](_0x5c480b,{'include':[{'model':db[_0x823e('0x7b')],'as':'VoiceMail'}]})['then'](function(_0x4db08f){_0x5c480b['id']=_0x4db08f['id'];return _0x5c480b;});});})[_0x823e('0x1a')](function(_0x340066){if(_0x5cc581[_0x823e('0x6b')][_0x823e('0x31')]===_0x823e('0x33'))return _0x340066;if(_0x5cc581[_0x823e('0x33')]['role']!==_0x823e('0x33'))return _0x340066;var _0x275282=_[_0x823e('0x96')](_0x340066,function(_0x1a324d){return _0x1a324d[_0x823e('0x31')]===_0x823e('0x35')||_0x1a324d[_0x823e('0x31')]==='telephone';});if(!_0x275282)return _0x340066;return db['UserProfileSection'][_0x823e('0x5c')]({'where':{'name':{'$or':[_0x823e('0x34'),_0x823e('0x93')]},'userProfileId':_0x5cc581['user'][_0x823e('0x91')]},'raw':!![]})[_0x823e('0x1a')](function(_0x47f542){if(_['isEmpty'](_0x47f542)||!_[_0x823e('0x96')](_0x47f542,[_0x823e('0x9a'),0x0]))return _0x340066;_0x27a78b=[];var _0x1ac2c7=_(_0x47f542)[_0x823e('0x37')](function(_0x61994b){if(_0x61994b[_0x823e('0x9a')]===0x1)return;return _0x61994b[_0x823e('0x3b')]===_0x823e('0x34')?'agent':_0x823e('0x9b');})[_0x823e('0x9c')]()[_0x823e('0x3a')]();for(var _0x3d2f14=0x0;_0x3d2f14<_0x340066[_0x823e('0x4d')];_0x3d2f14++){if(!_[_0x823e('0x38')](_0x1ac2c7,_0x340066[_0x3d2f14][_0x823e('0x31')]))return;var _0x565e85=_0x340066[_0x3d2f14][_0x823e('0x31')]==='agent'?'Agents':_0x823e('0x93');_0x27a78b[_0x823e('0x5f')](db[_0x823e('0x3c')][_0x823e('0x8c')]({'name':_0x340066[_0x3d2f14]['name'],'resourceId':_0x340066[_0x3d2f14]['id'],'type':_0x565e85,'sectionId':_['find'](_0x47f542,[_0x823e('0x3b'),_0x565e85])['id']},{}));}return BPromise[_0x823e('0x67')](_0x27a78b);});})[_0x823e('0x1a')](respondWithResult(_0x488b59,0xc9))[_0x823e('0x23')](handleError(_0x488b59,null));};exports[_0x823e('0x9d')]=function(_0x34d5bc,_0x382a91,_0x7bfa99){if(_0x34d5bc['body']['id']){delete _0x34d5bc[_0x823e('0x6b')]['id'];}return db['User'][_0x823e('0x39')]({'where':{'id':_0x34d5bc[_0x823e('0x6c')]['id']}})['then'](function(_0x11502c){if(!_0x11502c)return null;if(_0x11502c['id']===_0x34d5bc[_0x823e('0x33')]['id']){if(!_0x34d5bc['body'][_0x823e('0x9e')]||!_0x34d5bc[_0x823e('0x6b')][_0x823e('0x9f')]){throw new db[(_0x823e('0xa0'))][(_0x823e('0xa1'))](_0x823e('0xa2'));}if(!_0x11502c[_0x823e('0xa3')](_0x34d5bc[_0x823e('0x6b')][_0x823e('0x9e')])){throw new db[(_0x823e('0xa0'))][(_0x823e('0xa1'))]('Wrong\x20credentials');}if(_0x34d5bc['body'][_0x823e('0x9e')]===_0x34d5bc['body']['newPassword']){throw new db['Sequelize']['ValidationError'](_0x823e('0xa4'));}}else if(_0x34d5bc[_0x823e('0x33')][_0x823e('0x31')]===_0x823e('0x8e')){if(!_0x34d5bc[_0x823e('0x6b')][_0x823e('0x9f')]){throw new db[(_0x823e('0xa0'))][(_0x823e('0xa1'))](_0x823e('0xa5'));}}else if(_0x34d5bc[_0x823e('0x33')][_0x823e('0x31')]===_0x823e('0x33')){if(!_0x34d5bc['body'][_0x823e('0x9f')]){throw new db[(_0x823e('0xa0'))]['ValidationError'](_0x823e('0xa5'));}if(_0x11502c[_0x823e('0x31')]!=='agent'){throw new db['Sequelize'][(_0x823e('0xa1'))](_0x823e('0x8d'));}}else{throw new db[(_0x823e('0xa0'))][(_0x823e('0xa1'))](_0x823e('0x8d'));}return _0x11502c;})[_0x823e('0x1a')](handleEntityNotFound(_0x382a91,null))[_0x823e('0x1a')](function(_0x5e312b){return db['Setting']['findOne']({'attributes':['id',_0x823e('0x74'),_0x823e('0xa6'),_0x823e('0xa7')]})[_0x823e('0x1a')](function(_0x5e198a){if(_0x5e198a[_0x823e('0x74')])authService[_0x823e('0xa8')](_0x34d5bc[_0x823e('0x6b')]['newPassword']);if(!_0x5e198a['enforcePasswordHistory']||!_0x5e312b[_0x823e('0xa9')])return _0x5e312b;authService[_0x823e('0xaa')](_0x34d5bc[_0x823e('0x6b')][_0x823e('0x9f')],_0x5e312b[_0x823e('0xa9')],_0x5e198a['passwordHistoryLimit']);return _0x5e312b;})['then'](saveUpdates({'password':_0x34d5bc[_0x823e('0x6b')]['newPassword'],'passwordResetAt':_0x34d5bc[_0x823e('0x33')]['id']==_0x34d5bc[_0x823e('0x6c')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x34d5bc[_0x823e('0x6b')][_0x823e('0x9f')],_0x5e312b['previousPasswords'])},null));})['then'](respondWithResult(_0x382a91,null))['catch'](handleError(_0x382a91,null));};exports[_0x823e('0xab')]=function(_0x865869,_0x1bb20a,_0x41a742){var _0x22d130=_0x865869['body'][_0x823e('0xac')];return db['User']['find']({'where':{'id':_0x865869[_0x823e('0x6c')]['id']},'attributes':['id','name','role',_0x823e('0xad'),_0x823e('0xae'),_0x823e('0xaf'),_0x823e('0xb0')]})[_0x823e('0x1a')](handleEntityNotFound(_0x1bb20a,null))[_0x823e('0x1a')](function(_0x30181d){if(_0x30181d){if(!utils['isValidChannel'](_0x22d130)){throw new db['Sequelize'][(_0x823e('0xa1'))](_0x823e('0xb1'));}return _0x30181d[_0x823e('0xb2')+_[_0x823e('0xb3')](_0x22d130['toLowerCase']())+'Queues'](_0x865869['body']['ids'],{'penalty':_0x865869['body'][_0x823e('0xb4')]||0x0})['spread'](function(_0x35999c){for(var _0x1c9cb0=0x0;_0x1c9cb0<_0x865869['body'][_0x823e('0x6f')]['length'];_0x1c9cb0+=0x1){var _0x1ce532={'UserId':_0x865869[_0x823e('0x6c')]['id']};_0x1ce532[_[_0x823e('0xb3')](_0x22d130[_0x823e('0xb5')]())+_0x823e('0xb6')]=_0x865869['body'][_0x823e('0x6f')][_0x1c9cb0];socket[_0x823e('0xb7')]('user'+_[_0x823e('0xb3')](_0x22d130[_0x823e('0xb5')]())+_0x823e('0xb8'),_0x1ce532);}return _0x35999c;})[_0x823e('0x1a')](function(){if(_0x22d130===_0x823e('0xb9')){return db[_0x823e('0xba')][_0x823e('0x5c')]({'where':{'id':_0x865869[_0x823e('0x6b')][_0x823e('0x6f')]||[]},'raw':!![],'attributes':['id',_0x823e('0x3b')]});}})[_0x823e('0x1a')](function(_0x4574e7){var _0x37cb68=_0x30181d['get']({'plain':!![]});var _0x4f1afb=[];if(_0x22d130===_0x823e('0xb9')&&_0x37cb68['role']===_0x823e('0x35')&&_0x37cb68[_0x823e('0xad')]){for(var _0x846caf=0x0;_0x846caf<_0x4574e7[_0x823e('0x4d')];_0x846caf+=0x1){_0x4f1afb[_0x823e('0x5f')]({'membername':_0x37cb68['name'],'UserId':_0x37cb68['id'],'queue_name':_0x4574e7[_0x846caf][_0x823e('0x3b')],'VoiceQueueId':_0x4574e7[_0x846caf]['id'],'interface':_[_0x823e('0x76')](_0x37cb68[_0x823e('0xb0')])?util['format'](_0x823e('0xbb'),_0x37cb68['name']):_0x37cb68[_0x823e('0xb0')],'paused':_0x37cb68['voicePause']||![],'penalty':_0x865869[_0x823e('0x6b')][_0x823e('0xb4')]||0x0});}return BPromise[_0x823e('0x99')](_0x4f1afb,function(_0x5708da){return db['UserVoiceQueueRt'][_0x823e('0xbc')](_0x5708da);});}return _0x30181d;});}})[_0x823e('0x1a')](respondWithStatusCode(_0x1bb20a,null))[_0x823e('0x23')](handleError(_0x1bb20a,null));};exports[_0x823e('0xbd')]=function(_0x27f01b,_0x32ca89,_0x430c1f){var _0x47bf7c;return db['User'][_0x823e('0x39')]({'where':{'id':_0x27f01b[_0x823e('0x6c')]['id']},'attributes':['id',_0x823e('0x3b'),'role']})['then'](handleEntityNotFound(_0x32ca89,null))[_0x823e('0x1a')](function(_0x530a12){if(_0x530a12){_0x47bf7c=_0x530a12;if(!_0x27f01b[_0x823e('0x47')][_0x823e('0xac')]||!utils[_0x823e('0xbe')](_0x27f01b[_0x823e('0x47')][_0x823e('0xac')])){throw new db['Sequelize'][(_0x823e('0xa1'))]('Unknown\x20channel');}return _0x530a12[_0x823e('0xbf')+_[_0x823e('0xb3')](_0x27f01b[_0x823e('0x47')][_0x823e('0xac')][_0x823e('0xb5')]())+_0x823e('0xc0')](_0x27f01b['query'][_0x823e('0x6f')]);}})[_0x823e('0x1a')](function(_0x29c771){for(var _0x3f3cd3=0x0;_0x3f3cd3<_0x27f01b['query']['ids'][_0x823e('0x4d')];_0x3f3cd3+=0x1){var _0x181fe7={'UserId':_0x27f01b[_0x823e('0x6c')]['id']};_0x181fe7[_['capitalize'](_0x27f01b[_0x823e('0x47')][_0x823e('0xac')]['toLowerCase']())+_0x823e('0xb6')]=_0x27f01b[_0x823e('0x47')][_0x823e('0x6f')][_0x3f3cd3];socket[_0x823e('0xb7')](_0x823e('0x33')+_[_0x823e('0xb3')](_0x27f01b['query']['channel'][_0x823e('0xb5')]())+_0x823e('0xc1'),_0x181fe7);}return _0x29c771;})['then'](function(){if(_0x27f01b[_0x823e('0x47')][_0x823e('0xac')]===_0x823e('0xb9')){return db[_0x823e('0xc2')]['destroy']({'where':{'UserId':_0x27f01b['params']['id'],'VoiceQueueId':_0x27f01b[_0x823e('0x47')][_0x823e('0x6f')]},'individualHooks':!![]})['then'](function(){return _0x47bf7c;});}return _0x47bf7c;})[_0x823e('0x1a')](respondWithStatusCode(_0x32ca89,null))[_0x823e('0x23')](handleError(_0x32ca89,null));};exports['addAvatar']=function(_0x4ecef1,_0xddfc1,_0xbf20ff){_0x4ecef1[_0x823e('0x6b')][_0x823e('0xc3')]=_0x4ecef1[_0x823e('0xc4')][_0x823e('0xc5')];return db[_0x823e('0x59')][_0x823e('0x39')]({'where':{'id':_0x4ecef1['params']['id']}})['then'](handleEntityNotFound(_0xddfc1,null))[_0x823e('0x1a')](saveUpdates(_0x4ecef1['body'],null))[_0x823e('0x1a')](respondWithResult(_0xddfc1,null))[_0x823e('0x23')](handleError(_0xddfc1,null));};exports[_0x823e('0xc6')]=function(_0x133fe0,_0x303a18,_0x589883){var _0x2c356b=path[_0x823e('0xc7')](config['root'],'server/files/images/logos/default_profile.png');return db[_0x823e('0x59')]['find']({'where':{'id':_0x133fe0[_0x823e('0x6c')]['id']},'attributes':['id',_0x823e('0xc3')],'raw':!![]})['then'](handleEntityNotFound(_0x303a18,null))[_0x823e('0x1a')](function(_0x274db1){if(_0x274db1){if(_[_0x823e('0x76')](_0x274db1[_0x823e('0xc3')])){return _0x303a18['download'](_0x2c356b);}else{if(!fs[_0x823e('0xc8')](path[_0x823e('0xc7')](config[_0x823e('0xc9')],_0x823e('0xca'),_0x274db1[_0x823e('0xc3')]))){return _0x303a18[_0x823e('0xcb')](_0x2c356b);}return _0x303a18[_0x823e('0xcb')](path['join'](config[_0x823e('0xc9')],_0x823e('0xca'),_0x274db1[_0x823e('0xc3')]));}}})[_0x823e('0x23')](handleError(_0x303a18,null));};exports['getOpenTabs']=function(_0xdc65ba,_0x5bd8db,_0x5bd960){return db['User'][_0x823e('0x39')]({'where':{'id':_0xdc65ba[_0x823e('0x6c')]['id']},'attributes':['id']})[_0x823e('0x1a')](handleEntityNotFound(_0x5bd8db,null))[_0x823e('0x1a')](function(_0x1f415e){var _0x323cbe=[];values=_0x1f415e['dataValues'];_0x323cbe[_0x823e('0x5f')](get_open_tabs(_0x823e('0x60'),_0x1f415e[_0x823e('0x61')]));_0x323cbe[_0x823e('0x5f')](get_open_tabs('sms',_0x1f415e[_0x823e('0x61')]));_0x323cbe[_0x823e('0x5f')](get_open_tabs('openchannel',_0x1f415e['dataValues']));_0x323cbe[_0x823e('0x5f')](get_open_tabs('whatsapp',_0x1f415e[_0x823e('0x61')]));_0x323cbe[_0x823e('0x5f')](get_open_tabs('fax',_0x1f415e[_0x823e('0x61')]));_0x323cbe[_0x823e('0x5f')](get_open_tabs('mail',_0x1f415e[_0x823e('0x61')]));return BPromise['all'](_0x323cbe);})[_0x823e('0x1a')](function(_0x5cc7a5){var _0x523371=[];if(_0x5cc7a5){for(var _0x416441=0x0;_0x416441=_0x27c934[_0xe45a('0x52')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xe45a('0x12')](function(){if(_0x5d02d1){return db[_0xe45a('0x2e')][_0xe45a('0x53')]({'where':{'membername':_0x5d02d1[_0xe45a('0x2b')]},'individualHooks':!![]});}})[_0xe45a('0x12')](function(){if(_0x5d02d1){return _0x5d02d1['getVoiceQueues']({'raw':!![]});}})[_0xe45a('0x12')](function(_0x4ed1c3){if(_0x5d02d1){if(_0x4ed1c3){var _0x531be2=[];_0x1797b2=_0x4ed1c3;if(_0x1797b2['length']){for(var _0x304ea4=0x0;_0x304ea4<_0x1797b2[_0xe45a('0x33')];_0x304ea4++){_0x531be2[_0xe45a('0x49')](db[_0xe45a('0x2e')]['upsert']({'membername':_0x5d02d1[_0xe45a('0x2b')],'UserId':_0x5d02d1['id'],'queue_name':_0x1797b2[_0x304ea4][_0xe45a('0x2b')],'VoiceQueueId':_0x1797b2[_0x304ea4]['id'],'interface':_0x173cb4,'paused':_0x5d02d1['loginInPause']||![],'penalty':_0x1797b2[_0x304ea4][_0xe45a('0x54')]||0x0}));}return BPromise[_0xe45a('0x4a')](_0x531be2);}}}})[_0xe45a('0x12')](function(){if(_0x5d02d1){return db['MemberReport']['findAll']({'where':{'membername':_0x5d02d1[_0xe45a('0x2b')],'exitAt':null}});}})[_0xe45a('0x12')](function(_0x1f22c4){if(_0x5d02d1){if(_0x1f22c4&&_0x1f22c4['length']){var _0x56e805=[];_0x1f22c4['forEach'](function(_0x5c17fa){_0x56e805[_0xe45a('0x49')](_0x5c17fa[_0xe45a('0x2f')]({'exitAt':moment()[_0xe45a('0x31')](_0xe45a('0x32'))}));});return BPromise['all'](_0x56e805);}}})[_0xe45a('0x12')](function(_0x5da007){if(_0x5d02d1){var _0x132f02=[];var _0x3a9229=[];var _0x46c46e=utils[_0xe45a('0x55')]();var _0x26e136={'membername':_0x5d02d1[_0xe45a('0x2b')],'interface':_0x173cb4,'enterAt':moment()['format'](_0xe45a('0x32')),'role':_0x5d02d1['role'],'internal':_0x5d02d1[_0xe45a('0x2c')]};_0x46c46e['forEach'](function(_0x32849e){_0x132f02[_0xe45a('0x49')](_[_0xe45a('0x56')]({'channel':_0x32849e,'type':_0xe45a('0x57'),'data1':_0xe45a('0x58'),'data2':_0x173cb4},_0x26e136));if(_0x5d02d1[_0xe45a('0x59')]){_0x3a9229[_0xe45a('0x49')](_[_0xe45a('0x56')]({'channel':_0x32849e,'type':_0xe45a('0x35'),'data1':_0xe45a('0x5a')},_0x26e136));}});return db[_0xe45a('0x30')][_0xe45a('0x39')](_0x132f02[_0xe45a('0x5b')](_0x3a9229),{'individualHooks':!![]});}})[_0xe45a('0x12')](function(){if(_0x5d02d1){return _0x5d02d1[_0xe45a('0x2f')]({'online':!![],'lastLoginAt':moment()[_0xe45a('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5d02d1['loginInPause']||![],'mailPause':_0x5d02d1[_0xe45a('0x59')]||![],'chatPause':_0x5d02d1[_0xe45a('0x59')]||![],'faxPause':_0x5d02d1[_0xe45a('0x59')]||![],'smsPause':_0x5d02d1[_0xe45a('0x59')]||![],'openchannelPause':_0x5d02d1[_0xe45a('0x59')]||![],'pauseType':_0x5d02d1[_0xe45a('0x59')]?_0xe45a('0x5a'):null,'lastPauseAt':moment()[_0xe45a('0x31')](_0xe45a('0x32')),'interface':_0x173cb4});}})[_0xe45a('0x12')](function(_0x226498){_0xc4803d(_0x226498);})[_0xe45a('0x1c')](function(_0x2e9a99){_0x1c670e(_0x3b1191['error'](0x1f4,_0x2e9a99[_0xe45a('0x1a')]));});});}; \ No newline at end of file +var _0x26b8=['info','User,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','User','options','raw','where','attributes','limit','include','map','model','GetUser','ShowUser','find','name','role','internal','interface','UserVoiceQueueRt','update','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','body','type','MemberReport','DEFAULT\x20PAUSE','UnpauseUser','channel','Unknown\x20channel','voice','mail','chat','sms','openchannel','whatsapp','system','set','%s%s','Pause','all','LogoutUser','findOne','findAll','mobile','phone','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','bulkCreate','concat','loginInPause','LOGININPAUSE','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','request','then'];(function(_0x10d34b,_0x4fef76){var _0x92b0bf=function(_0x16e291){while(--_0x16e291){_0x10d34b['push'](_0x10d34b['shift']());}};_0x92b0bf(++_0x4fef76);}(_0x26b8,0x15f));var _0x826b=function(_0x3116c0,_0x3e5dc9){_0x3116c0=_0x3116c0-0x0;var _0x4c92e1=_0x26b8[_0x3116c0];return _0x4c92e1;};'use strict';var _=require(_0x826b('0x0'));var util=require('util');var moment=require(_0x826b('0x1'));var BPromise=require(_0x826b('0x2'));var rs=require(_0x826b('0x3'));var fs=require('fs');var Redis=require(_0x826b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x826b('0x5'));var logger=require(_0x826b('0x6'))(_0x826b('0x7'));var config=require(_0x826b('0x8'));var jayson=require(_0x826b('0x9'));var client=jayson[_0x826b('0xa')]['http']({'port':0x232a});config[_0x826b('0xb')]=_[_0x826b('0xc')](config[_0x826b('0xb')],{'host':_0x826b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x826b('0xb')]));require('./user.socket')[_0x826b('0xe')](socket);function respondWithRpcPromise(_0x16fa2b,_0x48d657,_0x29765d){return new BPromise(function(_0x308893,_0x1fa83a){return client[_0x826b('0xf')](_0x16fa2b,_0x29765d)[_0x826b('0x10')](function(_0x425254){logger[_0x826b('0x11')](_0x826b('0x12'),_0x48d657,_0x826b('0x13'));logger[_0x826b('0x14')]('User,\x20%s,\x20%s,\x20%s',_0x48d657,'request\x20sent',JSON[_0x826b('0x15')](_0x425254));if(_0x425254['error']){if(_0x425254['error'][_0x826b('0x16')]===0x1f4){logger[_0x826b('0x17')](_0x826b('0x12'),_0x48d657,_0x425254['error'][_0x826b('0x18')]);return _0x1fa83a(_0x425254[_0x826b('0x17')][_0x826b('0x18')]);}logger[_0x826b('0x17')](_0x826b('0x12'),_0x48d657,_0x425254[_0x826b('0x17')]['message']);return _0x308893(_0x425254[_0x826b('0x17')]['message']);}else{logger[_0x826b('0x11')]('User,\x20%s,\x20%s',_0x48d657,_0x826b('0x13'));_0x308893(_0x425254[_0x826b('0x19')]['message']);}})[_0x826b('0x1a')](function(_0x39cecc){logger[_0x826b('0x17')]('User,\x20%s,\x20%s',_0x48d657,_0x39cecc);_0x1fa83a(_0x39cecc);});});}exports['GetUser']=function(_0x1437fb){var _0x168ffb=this;return new Promise(function(_0x4a72b5,_0x458727){return db[_0x826b('0x1b')]['findAll']({'raw':_0x1437fb[_0x826b('0x1c')]?_0x1437fb['options'][_0x826b('0x1d')]===undefined?!![]:![]:!![],'where':_0x1437fb['options']?_0x1437fb['options'][_0x826b('0x1e')]||null:null,'attributes':_0x1437fb['options']?_0x1437fb[_0x826b('0x1c')][_0x826b('0x1f')]||null:null,'limit':_0x1437fb[_0x826b('0x1c')]?_0x1437fb['options'][_0x826b('0x20')]||null:null,'include':_0x1437fb['options']?_0x1437fb[_0x826b('0x1c')][_0x826b('0x21')]?_[_0x826b('0x22')](_0x1437fb[_0x826b('0x1c')][_0x826b('0x21')],function(_0xfb6c8e){return{'model':db[_0xfb6c8e[_0x826b('0x23')]],'as':_0xfb6c8e['as'],'attributes':_0xfb6c8e[_0x826b('0x1f')],'include':_0xfb6c8e[_0x826b('0x21')]?_['map'](_0xfb6c8e[_0x826b('0x21')],function(_0x48a4c6){return{'model':db[_0x48a4c6[_0x826b('0x23')]],'as':_0x48a4c6['as'],'attributes':_0x48a4c6['attributes'],'include':_0x48a4c6[_0x826b('0x21')]?_[_0x826b('0x22')](_0x48a4c6[_0x826b('0x21')],function(_0x251986){return{'model':db[_0x251986[_0x826b('0x23')]],'as':_0x251986['as'],'attributes':_0x251986[_0x826b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x826b('0x10')](function(_0x367c64){logger[_0x826b('0x11')](_0x826b('0x24'),_0x1437fb);logger['debug'](_0x826b('0x24'),_0x1437fb,JSON[_0x826b('0x15')](_0x367c64));_0x4a72b5(_0x367c64);})[_0x826b('0x1a')](function(_0x52cff4){logger[_0x826b('0x17')]('GetUser',_0x52cff4[_0x826b('0x18')],_0x1437fb);_0x458727(_0x168ffb['error'](0x1f4,_0x52cff4[_0x826b('0x18')]));});});};exports[_0x826b('0x25')]=function(_0x429dba){var _0x51b64b=this;return new Promise(function(_0x5b0f06,_0x17d13b){return db[_0x826b('0x1b')]['find']({'raw':_0x429dba[_0x826b('0x1c')]?_0x429dba[_0x826b('0x1c')][_0x826b('0x1d')]===undefined?!![]:![]:!![],'where':_0x429dba[_0x826b('0x1c')]?_0x429dba[_0x826b('0x1c')][_0x826b('0x1e')]||null:null,'attributes':_0x429dba[_0x826b('0x1c')]?_0x429dba[_0x826b('0x1c')][_0x826b('0x1f')]||null:null,'include':_0x429dba[_0x826b('0x1c')]?_0x429dba['options'][_0x826b('0x21')]?_[_0x826b('0x22')](_0x429dba['options'][_0x826b('0x21')],function(_0x5f436e){return{'model':db[_0x5f436e[_0x826b('0x23')]],'as':_0x5f436e['as'],'attributes':_0x5f436e[_0x826b('0x1f')],'include':_0x5f436e[_0x826b('0x21')]?_[_0x826b('0x22')](_0x5f436e['include'],function(_0x468bbe){return{'model':db[_0x468bbe['model']],'as':_0x468bbe['as'],'attributes':_0x468bbe[_0x826b('0x1f')],'include':_0x468bbe[_0x826b('0x21')]?_[_0x826b('0x22')](_0x468bbe[_0x826b('0x21')],function(_0x2f2914){return{'model':db[_0x2f2914['model']],'as':_0x2f2914['as'],'attributes':_0x2f2914['attributes']};}):[]};}):[]};}):[]:[]})[_0x826b('0x10')](function(_0x378748){logger[_0x826b('0x11')](_0x826b('0x25'),_0x429dba);logger['debug']('ShowUser',_0x429dba,JSON[_0x826b('0x15')](_0x378748));_0x5b0f06(_0x378748);})['catch'](function(_0x39fbe7){logger['error'](_0x826b('0x25'),_0x39fbe7[_0x826b('0x18')],_0x429dba);_0x17d13b(_0x51b64b[_0x826b('0x17')](0x1f4,_0x39fbe7['message']));});});};exports['PauseUser']=function(_0xb303bf){var _0x77f398=this;return new Promise(function(_0x913f4c,_0x368487){var _0x1db376;return db[_0x826b('0x1b')][_0x826b('0x26')]({'where':_0xb303bf[_0x826b('0x1c')][_0x826b('0x1e')]||{},'attributes':['id',_0x826b('0x27'),_0x826b('0x28'),_0x826b('0x29'),_0x826b('0x2a')]})['then'](function(_0x29eebf){if(_0x29eebf){_0x1db376=_0x29eebf;return db[_0x826b('0x2b')][_0x826b('0x2c')]({'paused':0x1},{'where':{'UserId':_0x1db376['id']},'individualHooks':!![]});}})[_0x826b('0x10')](function(){if(_0x1db376){return db['MemberReport']['findAll']({'where':{'membername':_0x1db376['name'],'type':_0x826b('0x2d'),'exitAt':null}});}})[_0x826b('0x10')](function(_0x144e40){if(_0x1db376){if(_0x144e40&&_0x144e40[_0x826b('0x2e')]){var _0x2a48e3=moment()[_0x826b('0x2f')](_0x826b('0x30'));for(var _0x268b74=0x0,_0x48b13a=_0x144e40[_0x826b('0x2e')];_0x268b74<_0x48b13a;_0x268b74++){_0x144e40[_0x268b74][_0x826b('0x31')]({'exitAt':_0x2a48e3});}}}})[_0x826b('0x10')](function(){if(_0x1db376){var _0x2ca745=[];var _0x2260c9=utils[_0x826b('0x32')]();_0x2260c9[_0x826b('0x33')](function(_0xc71216){_0x2ca745[_0x826b('0x34')]({'channel':_0xc71216,'membername':_0x1db376[_0x826b('0x27')],'interface':_[_0x826b('0x35')](_0x1db376[_0x826b('0x2a')])?util['format'](_0x826b('0x36'),_0x1db376[_0x826b('0x27')]):_0x1db376['interface'],'type':'PAUSE','enterAt':moment()[_0x826b('0x2f')](_0x826b('0x30')),'data1':_0xb303bf[_0x826b('0x37')][_0x826b('0x38')]||'DEFAULT\x20PAUSE','role':_0x1db376[_0x826b('0x28')],'internal':_0x1db376['internal'],'uniqueid':_0xb303bf['body']['uniqueid']||null});});return db[_0x826b('0x39')]['bulkCreate'](_0x2ca745,{'individualHooks':!![]});}})[_0x826b('0x10')](function(){if(_0x1db376){return _0x1db376[_0x826b('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0xb303bf['body'][_0x826b('0x38')]||_0x826b('0x3a'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x826b('0x10')](function(_0x4f6821){_0x913f4c(_0x4f6821);})[_0x826b('0x1a')](function(_0x54a2d4){_0x368487(_0x77f398[_0x826b('0x17')](0x1f4,_0x54a2d4['message']));});});};exports[_0x826b('0x3b')]=function(_0x50dbf2){var _0x127acc=this;return new Promise(function(_0x1b1a5c,_0x270ea0){var _0x1d07de;return db[_0x826b('0x1b')]['findOne']({'where':_0x50dbf2[_0x826b('0x1c')][_0x826b('0x1e')]||{},'attributes':['id','name']})[_0x826b('0x10')](function(_0x31fc42){if(_0x31fc42){_0x1d07de=_0x31fc42;if(_0x50dbf2[_0x826b('0x37')][_0x826b('0x3c')]&&!utils['isValidChannel'](_0x50dbf2[_0x826b('0x37')][_0x826b('0x3c')])){throw new Error(_0x826b('0x3d'));}switch(_0x50dbf2[_0x826b('0x37')][_0x826b('0x3c')]){case _0x826b('0x3e'):return db[_0x826b('0x2b')][_0x826b('0x2c')]({'paused':0x0},{'where':{'UserId':_0x1d07de['id']}})[_0x826b('0x10')](function(){return db[_0x826b('0x39')][_0x826b('0x26')]({'where':{'channel':_0x50dbf2['body'][_0x826b('0x3c')],'membername':_0x1d07de[_0x826b('0x27')],'type':_0x826b('0x2d'),'exitAt':null}});})[_0x826b('0x10')](function(_0x4bd5f1){if(_0x4bd5f1){return _0x4bd5f1[_0x826b('0x2c')]({'exitAt':moment()[_0x826b('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});}return null;})['then'](function(){return _0x1d07de[_0x826b('0x2c')]({'voicePause':![]});});case _0x826b('0x3f'):case _0x826b('0x40'):case'fax':case _0x826b('0x41'):case _0x826b('0x42'):case _0x826b('0x43'):return db[_0x826b('0x39')][_0x826b('0x26')]({'where':{'channel':_0x50dbf2[_0x826b('0x37')][_0x826b('0x3c')],'membername':_0x1d07de[_0x826b('0x27')],'type':_0x826b('0x2d'),'exitAt':null}})[_0x826b('0x10')](function(_0x333d9e){return _0x333d9e[_0x826b('0x2c')]({'exitAt':moment()[_0x826b('0x2f')](_0x826b('0x30')),'data2':_0x826b('0x44')},{'individualHooks':!![]});})[_0x826b('0x10')](function(){var _0x22e1c3={};_[_0x826b('0x45')](_0x22e1c3,util[_0x826b('0x2f')](_0x826b('0x46'),_0x50dbf2[_0x826b('0x37')][_0x826b('0x3c')],_0x826b('0x47')),![]);return _0x1d07de[_0x826b('0x2c')](_0x22e1c3);});default:return db['UserVoiceQueueRt'][_0x826b('0x2c')]({'paused':0x0},{'where':{'UserId':_0x1d07de['id']}})[_0x826b('0x10')](function(){return db[_0x826b('0x39')]['findAll']({'where':{'membername':_0x1d07de[_0x826b('0x27')],'type':_0x826b('0x2d'),'exitAt':null}});})[_0x826b('0x10')](function(_0x388648){var _0x35c961=[];_0x388648['forEach'](function(_0x15da4b){_0x35c961[_0x826b('0x34')](_0x15da4b[_0x826b('0x2c')]({'exitAt':moment()[_0x826b('0x2f')](_0x826b('0x30')),'data2':_0x826b('0x44')}));});return BPromise[_0x826b('0x48')](_0x35c961);})[_0x826b('0x10')](function(){return _0x1d07de['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0x277e44){_0x1b1a5c(_0x277e44);})[_0x826b('0x1a')](function(_0x27e6c8){_0x270ea0(_0x127acc[_0x826b('0x17')](0x1f4,_0x27e6c8[_0x826b('0x18')]));});});};exports[_0x826b('0x49')]=function(_0x518301){var _0x54c342=this;return new Promise(function(_0x511530,_0x252954){var _0xbcbd3c;return db['User'][_0x826b('0x4a')]({'where':_0x518301[_0x826b('0x1c')][_0x826b('0x1e')]||{},'attributes':['id',_0x826b('0x27')]})[_0x826b('0x10')](function(_0x4db181){if(_0x4db181){_0xbcbd3c=_0x4db181;return db[_0x826b('0x2b')]['destroy']({'where':{'membername':_0xbcbd3c[_0x826b('0x27')]},'individualHooks':!![]});}})['then'](function(){if(_0xbcbd3c){return db[_0x826b('0x39')][_0x826b('0x4b')]({'where':{'membername':_0xbcbd3c[_0x826b('0x27')],'exitAt':null}});}})['then'](function(_0x158715){if(_0xbcbd3c){if(_0x158715&&_0x158715[_0x826b('0x2e')]){var _0x3dbc51=[];_0x158715[_0x826b('0x33')](function(_0x4a2e37){_0x3dbc51[_0x826b('0x34')](_0x4a2e37[_0x826b('0x2c')]({'exitAt':moment()[_0x826b('0x2f')](_0x826b('0x30'))}));});return BPromise['all'](_0x3dbc51);}}})[_0x826b('0x10')](function(){if(_0xbcbd3c){return _0xbcbd3c['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x58cc0d){_0x511530(_0x58cc0d);})[_0x826b('0x1a')](function(_0x256a0f){_0x252954(_0x54c342[_0x826b('0x17')](0x1f4,_0x256a0f[_0x826b('0x18')]));});});};exports['LoginUser']=function(_0x21c387){var _0x59db05=this;return new Promise(function(_0x4d58a1,_0x329021){var _0x55a44d;var _0x16a6fc;var _0x3cd3f6;var _0x232667;return db[_0x826b('0x1b')][_0x826b('0x4a')]({'where':_0x21c387[_0x826b('0x1c')][_0x826b('0x1e')]||{},'attributes':['id',_0x826b('0x27'),_0x826b('0x28'),_0x826b('0x4c'),_0x826b('0x4d'),'internal','loginInPause',_0x826b('0x2a')]})['then'](function(_0x219bee){if(_0x219bee){_0x55a44d=_0x219bee;_0x232667=_0x21c387[_0x826b('0x37')][_0x826b('0x2a')]?_0x21c387[_0x826b('0x37')][_0x826b('0x2a')]:util[_0x826b('0x2f')]('SIP/%s',_0x55a44d[_0x826b('0x27')]);return db[_0x826b('0x1b')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x55a44d['id']}}});}})[_0x826b('0x10')](function(_0x17f438){if(_0x17f438){_0x3cd3f6=_0x17f438;return require(_0x826b('0x4e'))[_0x826b('0x4f')]();}})[_0x826b('0x10')](function(_0x257c54){if(_0x257c54&&_0x257c54['agents']&&_0x3cd3f6>=_0x257c54[_0x826b('0x50')]){throw new Error(_0x826b('0x51'));}})[_0x826b('0x10')](function(){if(_0x55a44d){return db[_0x826b('0x2b')]['destroy']({'where':{'membername':_0x55a44d[_0x826b('0x27')]},'individualHooks':!![]});}})['then'](function(){if(_0x55a44d){return _0x55a44d[_0x826b('0x52')]({'raw':!![]});}})['then'](function(_0xa2a171){if(_0x55a44d){if(_0xa2a171){var _0x3307b2=[];_0x16a6fc=_0xa2a171;if(_0x16a6fc[_0x826b('0x2e')]){for(var _0x5d07c7=0x0;_0x5d07c7<_0x16a6fc[_0x826b('0x2e')];_0x5d07c7++){_0x3307b2['push'](db[_0x826b('0x2b')][_0x826b('0x53')]({'membername':_0x55a44d[_0x826b('0x27')],'UserId':_0x55a44d['id'],'queue_name':_0x16a6fc[_0x5d07c7][_0x826b('0x27')],'VoiceQueueId':_0x16a6fc[_0x5d07c7]['id'],'interface':_0x232667,'paused':_0x55a44d['loginInPause']||![],'penalty':_0x16a6fc[_0x5d07c7][_0x826b('0x54')]||0x0}));}return BPromise[_0x826b('0x48')](_0x3307b2);}}}})['then'](function(){if(_0x55a44d){return db['MemberReport'][_0x826b('0x4b')]({'where':{'membername':_0x55a44d[_0x826b('0x27')],'exitAt':null}});}})[_0x826b('0x10')](function(_0x5bc914){if(_0x55a44d){if(_0x5bc914&&_0x5bc914['length']){var _0x152276=[];_0x5bc914[_0x826b('0x33')](function(_0x324bba){_0x152276[_0x826b('0x34')](_0x324bba['update']({'exitAt':moment()[_0x826b('0x2f')](_0x826b('0x30'))}));});return BPromise[_0x826b('0x48')](_0x152276);}}})[_0x826b('0x10')](function(_0x1c1f8a){if(_0x55a44d){var _0x57c3f8=[];var _0x2919b3=[];var _0x508326=utils['getChannels']();var _0x37e107={'membername':_0x55a44d['name'],'interface':_0x232667,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x55a44d[_0x826b('0x28')],'internal':_0x55a44d['internal']};_0x508326['forEach'](function(_0x55b76f){_0x57c3f8[_0x826b('0x34')](_[_0x826b('0x55')]({'channel':_0x55b76f,'type':_0x826b('0x56'),'data1':_0x826b('0x57'),'data2':_0x232667},_0x37e107));if(_0x55a44d['loginInPause']){_0x2919b3[_0x826b('0x34')](_[_0x826b('0x55')]({'channel':_0x55b76f,'type':_0x826b('0x2d'),'data1':'LOGININPAUSE'},_0x37e107));}});return db[_0x826b('0x39')][_0x826b('0x58')](_0x57c3f8[_0x826b('0x59')](_0x2919b3),{'individualHooks':!![]});}})[_0x826b('0x10')](function(){if(_0x55a44d){return _0x55a44d[_0x826b('0x2c')]({'online':!![],'lastLoginAt':moment()[_0x826b('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x55a44d[_0x826b('0x5a')]||![],'mailPause':_0x55a44d['loginInPause']||![],'chatPause':_0x55a44d[_0x826b('0x5a')]||![],'faxPause':_0x55a44d['loginInPause']||![],'smsPause':_0x55a44d['loginInPause']||![],'openchannelPause':_0x55a44d[_0x826b('0x5a')]||![],'pauseType':_0x55a44d['loginInPause']?_0x826b('0x5b'):null,'lastPauseAt':moment()[_0x826b('0x2f')](_0x826b('0x30')),'interface':_0x232667});}})[_0x826b('0x10')](function(_0x2dd8be){_0x4d58a1(_0x2dd8be);})[_0x826b('0x1a')](function(_0x33910e){_0x329021(_0x59db05[_0x826b('0x17')](0x1f4,_0x33910e[_0x826b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index fa1d47b..a368bf2 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 _0xacfb=['register','user:','./user.events','update','emit','removeListener'];(function(_0x3a919f,_0x336815){var _0x16638a=function(_0x24d3a4){while(--_0x24d3a4){_0x3a919f['push'](_0x3a919f['shift']());}};_0x16638a(++_0x336815);}(_0xacfb,0xda));var _0xbacf=function(_0x4515a8,_0x290d72){_0x4515a8=_0x4515a8-0x0;var _0x3c04bb=_0xacfb[_0x4515a8];return _0x3c04bb;};'use strict';var UserEvents=require(_0xbacf('0x0'));var events=['save','remove',_0xbacf('0x1')];function createListener(_0x3e15d3,_0x54a1cc){return function(_0x29f655){_0x54a1cc[_0xbacf('0x2')](_0x3e15d3,_0x29f655);};}function removeListener(_0x4b8106,_0xdee51a){return function(){UserEvents[_0xbacf('0x3')](_0x4b8106,_0xdee51a);};}exports[_0xbacf('0x4')]=function(_0xec3c25){for(var _0x12a90e=0x0,_0x1fb330=events['length'];_0x12a90e<_0x1fb330;_0x12a90e++){var _0x285fcb=events[_0x12a90e];var _0x291820=createListener(_0xbacf('0x5')+_0x285fcb,_0xec3c25);UserEvents['on'](_0x285fcb,_0x291820);}}; \ No newline at end of file +var _0xf02b=['update','removeListener','register','length','./user.events','save'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0xf02b,0x154));var _0xbf02=function(_0xac0de1,_0x12d3d9){_0xac0de1=_0xac0de1-0x0;var _0x1c1995=_0xf02b[_0xac0de1];return _0x1c1995;};'use strict';var UserEvents=require(_0xbf02('0x0'));var events=[_0xbf02('0x1'),'remove',_0xbf02('0x2')];function createListener(_0x1bb177,_0x2e1017){return function(_0x3ed18a){_0x2e1017['emit'](_0x1bb177,_0x3ed18a);};}function removeListener(_0x55ff8d,_0x17d71d){return function(){UserEvents[_0xbf02('0x3')](_0x55ff8d,_0x17d71d);};}exports[_0xbf02('0x4')]=function(_0x608bc4){for(var _0x142e4a=0x0,_0x34082a=events[_0xbf02('0x5')];_0x142e4a<_0x34082a;_0x142e4a++){var _0x212bd3=events[_0x142e4a];var _0x5a93f5=createListener('user:'+_0x212bd3,_0x608bc4);UserEvents['on'](_0x212bd3,_0x5a93f5);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 531ad3c..c14a444 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 _0xe1e3=['../../config/environment','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service'];(function(_0xee2616,_0x33d39b){var _0x50fed8=function(_0x5eb727){while(--_0x5eb727){_0xee2616['push'](_0xee2616['shift']());}};_0x50fed8(++_0x33d39b);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0xc4f4df,_0x3bcc65){_0xc4f4df=_0xc4f4df-0x0;var _0x9414f6=_0xe1e3[_0xc4f4df];return _0x9414f6;};'use strict';var multer=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var path=require('path');var timeout=require(_0x3e1e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3e1e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3e1e('0x4'));var config=require(_0x3e1e('0x5'));module[_0x3e1e('0x6')]=router; \ No newline at end of file +var _0x3e22=['util','connect-timeout','express','Router','fs-extra','../../config/environment','exports'];(function(_0xb24dc7,_0x37d32e){var _0x581d26=function(_0x4023ed){while(--_0x4023ed){_0xb24dc7['push'](_0xb24dc7['shift']());}};_0x581d26(++_0x37d32e);}(_0x3e22,0xa8));var _0x23e2=function(_0x593f03,_0x4af84a){_0x593f03=_0x593f03-0x0;var _0x178299=_0x3e22[_0x593f03];return _0x178299;};'use strict';var multer=require('multer');var util=require(_0x23e2('0x0'));var path=require('path');var timeout=require(_0x23e2('0x1'));var express=require(_0x23e2('0x2'));var router=express[_0x23e2('0x3')]();var fs_extra=require(_0x23e2('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x23e2('0x5'));module[_0x23e2('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index b0af5bf..2aae5b7 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(_0x225915,_0x2eaa2f){var _0x3b8d10=function(_0x4c9dd5){while(--_0x4c9dd5){_0x225915['push'](_0x225915['shift']());}};_0x3b8d10(++_0x2eaa2f);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x3d43ce,_0x433f16){var _0x5069e8=function(_0xc0b970){while(--_0xc0b970){_0x3d43ce['push'](_0x3d43ce['shift']());}};_0x5069e8(++_0x433f16);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 55b482b..f67f300 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 _0xee1e=['./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x571c1d,_0x3b0586){var _0x33c609=function(_0x226499){while(--_0x226499){_0x571c1d['push'](_0x571c1d['shift']());}};_0x33c609(++_0x3b0586);}(_0xee1e,0x109));var _0xeee1=function(_0x5bf18d,_0x264c55){_0x5bf18d=_0x5bf18d-0x0;var _0x1d6cc0=_0xee1e[_0x5bf18d];return _0x1d6cc0;};'use strict';var _=require(_0xeee1('0x0'));var util=require('util');var logger=require(_0xeee1('0x1'))(_0xeee1('0x2'));var moment=require(_0xeee1('0x3'));var BPromise=require(_0xeee1('0x4'));var rp=require(_0xeee1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeee1('0x6'));var config=require(_0xeee1('0x7'));var attributes=require(_0xeee1('0x8'));module[_0xeee1('0x9')]=function(_0x1649b9,_0x350e7a){return _0x1649b9[_0xeee1('0xa')](_0xeee1('0xb'),attributes,{'tableName':_0xeee1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf0f=['lodash','api','bluebird','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues'];(function(_0x22cc36,_0x2c8292){var _0x7fc85=function(_0x4e476d){while(--_0x4e476d){_0x22cc36['push'](_0x22cc36['shift']());}};_0x7fc85(++_0x2c8292);}(_0xdf0f,0x10e));var _0xfdf0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdf0f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xfdf0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfdf0('0x1'));var moment=require('moment');var BPromise=require(_0xfdf0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfdf0('0x3'));var attributes=require(_0xfdf0('0x4'));module[_0xfdf0('0x5')]=function(_0xf6f7e9,_0xb01dec){return _0xf6f7e9[_0xfdf0('0x6')](_0xfdf0('0x7'),attributes,{'tableName':_0xfdf0('0x8'),'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 ef8b5b1..ef7b00b 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 _0xcc34=['stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x3d69ca,_0x5efe5c){var _0x2dfbdf=function(_0xc78b10){while(--_0xc78b10){_0x3d69ca['push'](_0x3d69ca['shift']());}};_0x2dfbdf(++_0x5efe5c);}(_0xcc34,0x1bd));var _0x4cc3=function(_0x99b927,_0x653705){_0x99b927=_0x99b927-0x0;var _0x333828=_0xcc34[_0x99b927];return _0x333828;};'use strict';var _=require('lodash');var util=require(_0x4cc3('0x0'));var moment=require(_0x4cc3('0x1'));var BPromise=require('bluebird');var rs=require(_0x4cc3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4cc3('0x3'))['db'];var utils=require(_0x4cc3('0x4'));var logger=require(_0x4cc3('0x5'))(_0x4cc3('0x6'));var config=require(_0x4cc3('0x7'));var jayson=require(_0x4cc3('0x8'));var client=jayson[_0x4cc3('0x9')][_0x4cc3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c83ca,_0x360bc3,_0x2a6257){return new BPromise(function(_0x4c0969,_0x11fa02){return client[_0x4cc3('0xb')](_0x1c83ca,_0x2a6257)[_0x4cc3('0xc')](function(_0x160556){logger[_0x4cc3('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x360bc3,'request\x20sent');logger['debug'](_0x4cc3('0xe'),_0x360bc3,'request\x20sent',JSON[_0x4cc3('0xf')](_0x160556));if(_0x160556[_0x4cc3('0x10')]){if(_0x160556[_0x4cc3('0x10')][_0x4cc3('0x11')]===0x1f4){logger[_0x4cc3('0x10')](_0x4cc3('0x12'),_0x360bc3,_0x160556[_0x4cc3('0x10')][_0x4cc3('0x13')]);return _0x11fa02(_0x160556[_0x4cc3('0x10')][_0x4cc3('0x13')]);}logger[_0x4cc3('0x10')](_0x4cc3('0x12'),_0x360bc3,_0x160556[_0x4cc3('0x10')][_0x4cc3('0x13')]);return _0x4c0969(_0x160556['error'][_0x4cc3('0x13')]);}else{logger[_0x4cc3('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x360bc3,_0x4cc3('0x14'));_0x4c0969(_0x160556[_0x4cc3('0x15')]['message']);}})[_0x4cc3('0x16')](function(_0x7096ae){logger[_0x4cc3('0x10')](_0x4cc3('0x12'),_0x360bc3,_0x7096ae);_0x11fa02(_0x7096ae);});});} \ No newline at end of file +var _0x0adf=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x1a1e93,_0x1ce068){var _0x1d23e8=function(_0x3fcd82){while(--_0x3fcd82){_0x1a1e93['push'](_0x1a1e93['shift']());}};_0x1d23e8(++_0x1ce068);}(_0x0adf,0x1b9));var _0xf0ad=function(_0x67f6fd,_0x24727e){_0x67f6fd=_0x67f6fd-0x0;var _0x1f8ec8=_0x0adf[_0x67f6fd];return _0x1f8ec8;};'use strict';var _=require(_0xf0ad('0x0'));var util=require('util');var moment=require(_0xf0ad('0x1'));var BPromise=require(_0xf0ad('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0ad('0x3'));var db=require(_0xf0ad('0x4'))['db'];var utils=require(_0xf0ad('0x5'));var logger=require(_0xf0ad('0x6'))(_0xf0ad('0x7'));var config=require(_0xf0ad('0x8'));var jayson=require(_0xf0ad('0x9'));var client=jayson[_0xf0ad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x204242,_0x3946a7,_0x40534b){return new BPromise(function(_0x523c97,_0x4e1e88){return client[_0xf0ad('0xb')](_0x204242,_0x40534b)[_0xf0ad('0xc')](function(_0x2420f9){logger[_0xf0ad('0xd')](_0xf0ad('0xe'),_0x3946a7,_0xf0ad('0xf'));logger['debug'](_0xf0ad('0x10'),_0x3946a7,'request\x20sent',JSON[_0xf0ad('0x11')](_0x2420f9));if(_0x2420f9['error']){if(_0x2420f9[_0xf0ad('0x12')]['code']===0x1f4){logger[_0xf0ad('0x12')](_0xf0ad('0xe'),_0x3946a7,_0x2420f9[_0xf0ad('0x12')][_0xf0ad('0x13')]);return _0x4e1e88(_0x2420f9[_0xf0ad('0x12')][_0xf0ad('0x13')]);}logger[_0xf0ad('0x12')](_0xf0ad('0xe'),_0x3946a7,_0x2420f9[_0xf0ad('0x12')][_0xf0ad('0x13')]);return _0x523c97(_0x2420f9['error']['message']);}else{logger[_0xf0ad('0xd')](_0xf0ad('0xe'),_0x3946a7,'request\x20sent');_0x523c97(_0x2420f9['result']['message']);}})[_0xf0ad('0x14')](function(_0x1bd579){logger[_0xf0ad('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x3946a7,_0x1bd579);_0x4e1e88(_0x1bd579);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 15643e1..5752c56 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 _0xdc25=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x1c441e,_0x214b0c){var _0x13c858=function(_0x39df60){while(--_0x39df60){_0x1c441e['push'](_0x1c441e['shift']());}};_0x13c858(++_0x214b0c);}(_0xdc25,0x128));var _0x5dc2=function(_0x1f4344,_0x2f9d6a){_0x1f4344=_0x1f4344-0x0;var _0x198f96=_0xdc25[_0x1f4344];return _0x198f96;};'use strict';var multer=require(_0x5dc2('0x0'));var util=require(_0x5dc2('0x1'));var path=require(_0x5dc2('0x2'));var timeout=require(_0x5dc2('0x3'));var express=require('express');var router=express[_0x5dc2('0x4')]();var fs_extra=require(_0x5dc2('0x5'));var auth=require(_0x5dc2('0x6'));var interaction=require(_0x5dc2('0x7'));var config=require(_0x5dc2('0x8'));module[_0x5dc2('0x9')]=router; \ No newline at end of file +var _0xb6da=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','multer','path'];(function(_0x1db29d,_0x997d67){var _0x154518=function(_0x57ad3e){while(--_0x57ad3e){_0x1db29d['push'](_0x1db29d['shift']());}};_0x154518(++_0x997d67);}(_0xb6da,0x8e));var _0xab6d=function(_0x66e24d,_0x58d83c){_0x66e24d=_0x66e24d-0x0;var _0x135b63=_0xb6da[_0x66e24d];return _0x135b63;};'use strict';var multer=require(_0xab6d('0x0'));var util=require('util');var path=require(_0xab6d('0x1'));var timeout=require(_0xab6d('0x2'));var express=require(_0xab6d('0x3'));var router=express[_0xab6d('0x4')]();var fs_extra=require(_0xab6d('0x5'));var auth=require(_0xab6d('0x6'));var interaction=require(_0xab6d('0x7'));var config=require('../../config/environment');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 07fc0a3..4bd73a7 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 _0x8f4c=['exports','INTEGER','STRING','sequelize'];(function(_0x46a63d,_0x4b0e13){var _0x32eb5a=function(_0x5c5637){while(--_0x5c5637){_0x46a63d['push'](_0x46a63d['shift']());}};_0x32eb5a(++_0x4b0e13);}(_0x8f4c,0x113));var _0xc8f4=function(_0x223729,_0x470bb5){_0x223729=_0x223729-0x0;var _0x2119b6=_0x8f4c[_0x223729];return _0x2119b6;};'use strict';var Sequelize=require(_0xc8f4('0x0'));module[_0xc8f4('0x1')]={'penalty':{'type':Sequelize[_0xc8f4('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc8f4('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xc8f4('0x3')]}}; \ No newline at end of file +var _0xb03e=['INTEGER','STRING','exports'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xb03e,0x1eb));var _0xeb03=function(_0x57e29f,_0x3371d0){_0x57e29f=_0x57e29f-0x0;var _0x275acb=_0xb03e[_0x57e29f];return _0x275acb;};'use strict';var Sequelize=require('sequelize');module[_0xeb03('0x0')]={'penalty':{'type':Sequelize[_0xeb03('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xeb03('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xeb03('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 16bfc3e..2bd4d2c 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 _0xf098=['../../config/environment','exports','user_has_fax_queues','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x4e1cae,_0x405726){var _0x269585=function(_0x385201){while(--_0x385201){_0x4e1cae['push'](_0x4e1cae['shift']());}};_0x269585(++_0x405726);}(_0xf098,0x139));var _0x8f09=function(_0x4b0e9f,_0x319536){_0x4b0e9f=_0x4b0e9f-0x0;var _0x218127=_0xf098[_0x4b0e9f];return _0x218127;};'use strict';var _=require(_0x8f09('0x0'));var util=require(_0x8f09('0x1'));var logger=require(_0x8f09('0x2'))(_0x8f09('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8f09('0x4'));var fs=require('fs');var path=require(_0x8f09('0x5'));var rimraf=require(_0x8f09('0x6'));var config=require(_0x8f09('0x7'));var attributes=require('./userFaxQueue.attributes');module[_0x8f09('0x8')]=function(_0x2fe60b,_0x23afa5){return _0x2fe60b['define']('UserFaxQueue',attributes,{'tableName':_0x8f09('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdaac=['UserFaxQueue','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define'];(function(_0x4eeb38,_0x118305){var _0x5c3be1=function(_0xfb21){while(--_0xfb21){_0x4eeb38['push'](_0x4eeb38['shift']());}};_0x5c3be1(++_0x118305);}(_0xdaac,0xf1));var _0xcdaa=function(_0xfafa1f,_0x2bfd14){_0xfafa1f=_0xfafa1f-0x0;var _0x4c882e=_0xdaac[_0xfafa1f];return _0x4c882e;};'use strict';var _=require(_0xcdaa('0x0'));var util=require(_0xcdaa('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcdaa('0x2'));var BPromise=require(_0xcdaa('0x3'));var rp=require(_0xcdaa('0x4'));var fs=require('fs');var path=require(_0xcdaa('0x5'));var rimraf=require(_0xcdaa('0x6'));var config=require(_0xcdaa('0x7'));var attributes=require(_0xcdaa('0x8'));module[_0xcdaa('0x9')]=function(_0x226ca9,_0x1a7b94){return _0x226ca9[_0xcdaa('0xa')](_0xcdaa('0xb'),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 fccfea5..2d850d6 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 _0x8eb7=['http','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x26d386,_0x1660c0){var _0x4ef9a8=function(_0x55e2d3){while(--_0x55e2d3){_0x26d386['push'](_0x26d386['shift']());}};_0x4ef9a8(++_0x1660c0);}(_0x8eb7,0xfb));var _0x78eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8eb7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x78eb('0x0'));var util=require('util');var moment=require(_0x78eb('0x1'));var BPromise=require(_0x78eb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78eb('0x3'));var db=require(_0x78eb('0x4'))['db'];var utils=require(_0x78eb('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x78eb('0x6'));var jayson=require(_0x78eb('0x7'));var client=jayson[_0x78eb('0x8')][_0x78eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x468ffa,_0x19d59f,_0x8d497d){return new BPromise(function(_0x3ede7d,_0x143cdf){return client['request'](_0x468ffa,_0x8d497d)[_0x78eb('0xa')](function(_0x35b322){logger['info'](_0x78eb('0xb'),_0x19d59f,_0x78eb('0xc'));logger[_0x78eb('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x19d59f,'request\x20sent',JSON[_0x78eb('0xe')](_0x35b322));if(_0x35b322[_0x78eb('0xf')]){if(_0x35b322[_0x78eb('0xf')][_0x78eb('0x10')]===0x1f4){logger[_0x78eb('0xf')](_0x78eb('0xb'),_0x19d59f,_0x35b322[_0x78eb('0xf')][_0x78eb('0x11')]);return _0x143cdf(_0x35b322[_0x78eb('0xf')][_0x78eb('0x11')]);}logger[_0x78eb('0xf')](_0x78eb('0xb'),_0x19d59f,_0x35b322[_0x78eb('0xf')][_0x78eb('0x11')]);return _0x3ede7d(_0x35b322[_0x78eb('0xf')][_0x78eb('0x11')]);}else{logger['info'](_0x78eb('0xb'),_0x19d59f,'request\x20sent');_0x3ede7d(_0x35b322[_0x78eb('0x12')][_0x78eb('0x11')]);}})[_0x78eb('0x13')](function(_0x3d60dd){logger[_0x78eb('0xf')](_0x78eb('0xb'),_0x19d59f,_0x3d60dd);_0x143cdf(_0x3d60dd);});});} \ No newline at end of file +var _0x4628=['jayson/promise','client','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x381fac,_0x2c7e36){var _0xdb89c4=function(_0x413f48){while(--_0x413f48){_0x381fac['push'](_0x381fac['shift']());}};_0xdb89c4(++_0x2c7e36);}(_0x4628,0xd3));var _0x8462=function(_0x245e6c,_0x4d22c9){_0x245e6c=_0x245e6c-0x0;var _0x226cfe=_0x4628[_0x245e6c];return _0x226cfe;};'use strict';var _=require(_0x8462('0x0'));var util=require(_0x8462('0x1'));var moment=require('moment');var BPromise=require(_0x8462('0x2'));var rs=require(_0x8462('0x3'));var fs=require('fs');var Redis=require(_0x8462('0x4'));var db=require(_0x8462('0x5'))['db'];var utils=require(_0x8462('0x6'));var logger=require('../../config/logger')(_0x8462('0x7'));var config=require(_0x8462('0x8'));var jayson=require(_0x8462('0x9'));var client=jayson[_0x8462('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12dad7,_0x4b92a7,_0x162bea){return new BPromise(function(_0x4b987a,_0x314c4c){return client[_0x8462('0xb')](_0x12dad7,_0x162bea)['then'](function(_0x58ec31){logger[_0x8462('0xc')](_0x8462('0xd'),_0x4b92a7,_0x8462('0xe'));logger[_0x8462('0xf')](_0x8462('0x10'),_0x4b92a7,_0x8462('0xe'),JSON['stringify'](_0x58ec31));if(_0x58ec31[_0x8462('0x11')]){if(_0x58ec31[_0x8462('0x11')]['code']===0x1f4){logger[_0x8462('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x4b92a7,_0x58ec31['error']['message']);return _0x314c4c(_0x58ec31[_0x8462('0x11')][_0x8462('0x12')]);}logger[_0x8462('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x4b92a7,_0x58ec31[_0x8462('0x11')][_0x8462('0x12')]);return _0x4b987a(_0x58ec31[_0x8462('0x11')][_0x8462('0x12')]);}else{logger['info'](_0x8462('0xd'),_0x4b92a7,_0x8462('0xe'));_0x4b987a(_0x58ec31['result'][_0x8462('0x12')]);}})[_0x8462('0x13')](function(_0xabd292){logger[_0x8462('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x4b92a7,_0xabd292);_0x314c4c(_0xabd292);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 2b7f6ee..5de5fa2 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 _0xf7b4=['../../config/environment','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x49e0b9,_0x3986f9){var _0x351647=function(_0x475bf9){while(--_0x475bf9){_0x49e0b9['push'](_0x49e0b9['shift']());}};_0x351647(++_0x3986f9);}(_0xf7b4,0x152));var _0x4f7b=function(_0x4eeb7a,_0x56493c){_0x4eeb7a=_0x4eeb7a-0x0;var _0x4c3ab5=_0xf7b4[_0x4eeb7a];return _0x4c3ab5;};'use strict';var multer=require(_0x4f7b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f7b('0x1'));var express=require(_0x4f7b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f7b('0x3'));var interaction=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));module[_0x4f7b('0x6')]=router; \ No newline at end of file +var _0xb98e=['fs-extra','../../components/interaction/service','../../config/environment','exports','multer','util','express','Router'];(function(_0x356aab,_0x448e6b){var _0x1220c8=function(_0x5e839b){while(--_0x5e839b){_0x356aab['push'](_0x356aab['shift']());}};_0x1220c8(++_0x448e6b);}(_0xb98e,0x184));var _0xeb98=function(_0x5f578b,_0x379008){_0x5f578b=_0x5f578b-0x0;var _0x4eef13=_0xb98e[_0x5f578b];return _0x4eef13;};'use strict';var multer=require(_0xeb98('0x0'));var util=require(_0xeb98('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xeb98('0x2'));var router=express[_0xeb98('0x3')]();var fs_extra=require(_0xeb98('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xeb98('0x5'));var config=require(_0xeb98('0x6'));module[_0xeb98('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index e2e5b25..d56a974 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x1e627b,_0x349e1b){var _0x5afca7=function(_0x3fedf4){while(--_0x3fedf4){_0x1e627b['push'](_0x1e627b['shift']());}};_0x5afca7(++_0x349e1b);}(_0xe706,0xa3));var _0x6e70=function(_0x10d244,_0x49c680){_0x10d244=_0x10d244-0x0;var _0x67755d=_0xe706[_0x10d244];return _0x67755d;};'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(_0x4744b1,_0x1f53ed){var _0xa1e07=function(_0x3a1e89){while(--_0x3a1e89){_0x4744b1['push'](_0x4744b1['shift']());}};_0xa1e07(++_0x1f53ed);}(_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/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 38aeb1c..2898f89 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 _0xd8b0=['define','user_has_mail_queues','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4473b3,_0x4f0c16){var _0x3df727=function(_0x4a56e1){while(--_0x4a56e1){_0x4473b3['push'](_0x4473b3['shift']());}};_0x3df727(++_0x4f0c16);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('UserMailQueue',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x9dc2d0,_0x4f3f25){var _0xd3c9a3=function(_0x2516ed){while(--_0x2516ed){_0x9dc2d0['push'](_0x9dc2d0['shift']());}};_0xd3c9a3(++_0x4f3f25);}(_0xe706,0xa3));var _0x6e70=function(_0x16bf05,_0x4f70da){_0x16bf05=_0x16bf05-0x0;var _0xbcf546=_0xe706[_0x16bf05];return _0xbcf546;};'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 diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 2e31f3e..b5c081f 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 _0x13c5=['request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x5c961c,_0x340e26){var _0x9d8eeb=function(_0x430fab){while(--_0x430fab){_0x5c961c['push'](_0x5c961c['shift']());}};_0x9d8eeb(++_0x340e26);}(_0x13c5,0x7a));var _0x513c=function(_0x3a0ada,_0x325982){_0x3a0ada=_0x3a0ada-0x0;var _0x5df806=_0x13c5[_0x3a0ada];return _0x5df806;};'use strict';var _=require(_0x513c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x513c('0x1'));var logger=require('../../config/logger')('rpc');var config=require(_0x513c('0x2'));var jayson=require(_0x513c('0x3'));var client=jayson[_0x513c('0x4')][_0x513c('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x51309d,_0x59ccbb,_0x40be91){return new BPromise(function(_0x3fc015,_0x42da79){return client[_0x513c('0x6')](_0x51309d,_0x40be91)[_0x513c('0x7')](function(_0x3126f2){logger[_0x513c('0x8')](_0x513c('0x9'),_0x59ccbb,'request\x20sent');logger[_0x513c('0xa')](_0x513c('0xb'),_0x59ccbb,'request\x20sent',JSON['stringify'](_0x3126f2));if(_0x3126f2[_0x513c('0xc')]){if(_0x3126f2[_0x513c('0xc')]['code']===0x1f4){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x59ccbb,_0x3126f2[_0x513c('0xc')]['message']);return _0x42da79(_0x3126f2[_0x513c('0xc')][_0x513c('0xd')]);}logger['error'](_0x513c('0x9'),_0x59ccbb,_0x3126f2[_0x513c('0xc')][_0x513c('0xd')]);return _0x3fc015(_0x3126f2[_0x513c('0xc')][_0x513c('0xd')]);}else{logger['info'](_0x513c('0x9'),_0x59ccbb,'request\x20sent');_0x3fc015(_0x3126f2[_0x513c('0xe')][_0x513c('0xd')]);}})[_0x513c('0xf')](function(_0x2fd03e){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x59ccbb,_0x2fd03e);_0x42da79(_0x2fd03e);});});} \ No newline at end of file +var _0xcd0e=['request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s'];(function(_0x5c5b4d,_0x3b4781){var _0x448a9e=function(_0x44710f){while(--_0x44710f){_0x5c5b4d['push'](_0x5c5b4d['shift']());}};_0x448a9e(++_0x3b4781);}(_0xcd0e,0xe9));var _0xecd0=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xcd0e[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0xecd0('0x0'));var util=require(_0xecd0('0x1'));var moment=require(_0xecd0('0x2'));var BPromise=require(_0xecd0('0x3'));var rs=require(_0xecd0('0x4'));var fs=require('fs');var Redis=require(_0xecd0('0x5'));var db=require(_0xecd0('0x6'))['db'];var utils=require(_0xecd0('0x7'));var logger=require(_0xecd0('0x8'))(_0xecd0('0x9'));var config=require(_0xecd0('0xa'));var jayson=require(_0xecd0('0xb'));var client=jayson[_0xecd0('0xc')][_0xecd0('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x279ee9,_0x4250c7,_0xc7e3e6){return new BPromise(function(_0x3bea02,_0x7663e3){return client['request'](_0x279ee9,_0xc7e3e6)[_0xecd0('0xe')](function(_0x1fc7e9){logger[_0xecd0('0xf')](_0xecd0('0x10'),_0x4250c7,_0xecd0('0x11'));logger[_0xecd0('0x12')](_0xecd0('0x13'),_0x4250c7,_0xecd0('0x11'),JSON[_0xecd0('0x14')](_0x1fc7e9));if(_0x1fc7e9['error']){if(_0x1fc7e9['error']['code']===0x1f4){logger[_0xecd0('0x15')](_0xecd0('0x10'),_0x4250c7,_0x1fc7e9[_0xecd0('0x15')][_0xecd0('0x16')]);return _0x7663e3(_0x1fc7e9[_0xecd0('0x15')][_0xecd0('0x16')]);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0x4250c7,_0x1fc7e9[_0xecd0('0x15')][_0xecd0('0x16')]);return _0x3bea02(_0x1fc7e9['error'][_0xecd0('0x16')]);}else{logger[_0xecd0('0xf')]('UserMailQueue,\x20%s,\x20%s',_0x4250c7,'request\x20sent');_0x3bea02(_0x1fc7e9[_0xecd0('0x17')]['message']);}})[_0xecd0('0x18')](function(_0x3e033b){logger['error'](_0xecd0('0x10'),_0x4250c7,_0x3e033b);_0x7663e3(_0x3e033b);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 39fbc20..e709879 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 _0xe4ca=['../../components/auth/service','./userNotification.controller','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x409b87,_0x5ef488){var _0x46fa68=function(_0x2ddda7){while(--_0x2ddda7){_0x409b87['push'](_0x409b87['shift']());}};_0x46fa68(++_0x5ef488);}(_0xe4ca,0x65));var _0xae4c=function(_0x25f8cb,_0x1a2e14){_0x25f8cb=_0x25f8cb-0x0;var _0x3afb8c=_0xe4ca[_0x25f8cb];return _0x3afb8c;};'use strict';var multer=require(_0xae4c('0x0'));var util=require(_0xae4c('0x1'));var path=require(_0xae4c('0x2'));var timeout=require(_0xae4c('0x3'));var express=require(_0xae4c('0x4'));var router=express[_0xae4c('0x5')]();var fs_extra=require(_0xae4c('0x6'));var auth=require(_0xae4c('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xae4c('0x8'));router['post']('/',auth[_0xae4c('0x9')](),controller[_0xae4c('0xa')]);module[_0xae4c('0xb')]=router; \ No newline at end of file +var _0x2b00=['post','sendUserNotification','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment'];(function(_0x265693,_0xa230cc){var _0x1d3a14=function(_0xf54ecf){while(--_0xf54ecf){_0x265693['push'](_0x265693['shift']());}};_0x1d3a14(++_0xa230cc);}(_0x2b00,0x1c4));var _0x02b0=function(_0x353da0,_0x109fe){_0x353da0=_0x353da0-0x0;var _0x14d23f=_0x2b00[_0x353da0];return _0x14d23f;};'use strict';var multer=require(_0x02b0('0x0'));var util=require(_0x02b0('0x1'));var path=require(_0x02b0('0x2'));var timeout=require(_0x02b0('0x3'));var express=require('express');var router=express[_0x02b0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x02b0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x02b0('0x6'));var controller=require('./userNotification.controller');router[_0x02b0('0x7')]('/',auth['isAuthenticated'](),controller[_0x02b0('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 80de90b..df3912d 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 _0x333b=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x2cc119,_0x468257){var _0x4d72e=function(_0x380535){while(--_0x380535){_0x2cc119['push'](_0x2cc119['shift']());}};_0x4d72e(++_0x468257);}(_0x333b,0x154));var _0xb333=function(_0x202c61,_0x3673e0){_0x202c61=_0x202c61-0x0;var _0x540691=_0x333b[_0x202c61];return _0x540691;};'use strict';var Sequelize=require(_0xb333('0x0'));module[_0xb333('0x1')]={'body':{'type':Sequelize[_0xb333('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xb333('0x2')]},'recipientsDescription':{'type':Sequelize[_0xb333('0x3')]},'beep':{'type':Sequelize[_0xb333('0x4')]}}; \ No newline at end of file +var _0xc977=['STRING','BOOLEAN','exports','TEXT'];(function(_0x52e21f,_0x4d420a){var _0x12d255=function(_0x220818){while(--_0x220818){_0x52e21f['push'](_0x52e21f['shift']());}};_0x12d255(++_0x4d420a);}(_0xc977,0xf6));var _0x7c97=function(_0x11a962,_0x3cc338){_0x11a962=_0x11a962-0x0;var _0x55d423=_0xc977[_0x11a962];return _0x55d423;};'use strict';var Sequelize=require('sequelize');module[_0x7c97('0x0')]={'body':{'type':Sequelize[_0x7c97('0x1')]},'senderName':{'type':Sequelize[_0x7c97('0x2')]},'recipientsId':{'type':Sequelize[_0x7c97('0x1')]},'recipientsDescription':{'type':Sequelize[_0x7c97('0x2')]},'beep':{'type':Sequelize[_0x7c97('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 97a1ddd..dee695a 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 _0x1364=['catch','text','Template','findOne','html','startCase','User','union','ids','queue','replace','Queue','push','flatten','getAgents','map','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','localhost','./userNotification.socket','register','sendStatus','status','end','offset','limit','Content-Range','reject','update','then','error','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','recipientsId','sequelize','transaction','UserNotification','create','forEach','recipient','userNotification:send'];(function(_0x56f927,_0x301301){var _0x1b23f2=function(_0x4d12a3){while(--_0x4d12a3){_0x56f927['push'](_0x56f927['shift']());}};_0x1b23f2(++_0x301301);}(_0x1364,0x1eb));var _0x4136=function(_0x3d3310,_0x91f3de){_0x3d3310=_0x3d3310-0x0;var _0x372361=_0x1364[_0x3d3310];return _0x372361;};'use strict';var emlformat=require(_0x4136('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4136('0x1'));var jsonpatch=require(_0x4136('0x2'));var rp=require('request-promise');var moment=require(_0x4136('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4136('0x4'));var util=require(_0x4136('0x5'));var path=require(_0x4136('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4136('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4136('0x8'));var squel=require(_0x4136('0x9'));var crypto=require(_0x4136('0xa'));var jsforce=require(_0x4136('0xb'));var deskjs=require(_0x4136('0xc'));var toCsv=require(_0x4136('0xd'));var querystring=require('querystring');var Papa=require(_0x4136('0xe'));var Redis=require(_0x4136('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4136('0x10'));var as=require(_0x4136('0x11'));var hardwareService=require(_0x4136('0x12'));var logger=require(_0x4136('0x13'))(_0x4136('0x14'));var utils=require('../../config/utils');var config=require(_0x4136('0x15'));var licenseUtil=require(_0x4136('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4136('0x17')](config[_0x4136('0x18')],{'host':_0x4136('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4136('0x18')]));require(_0x4136('0x1a'))[_0x4136('0x1b')](socket);function respondWithStatusCode(_0x1ef62d,_0x4f0aba){_0x4f0aba=_0x4f0aba||0xcc;return function(_0x240352){if(_0x240352){return _0x1ef62d[_0x4136('0x1c')](_0x4f0aba);}return _0x1ef62d[_0x4136('0x1d')](_0x4f0aba)[_0x4136('0x1e')]();};}function respondWithResult(_0x3b3292,_0x548da2){_0x548da2=_0x548da2||0xc8;return function(_0x655e37){if(_0x655e37){return _0x3b3292['status'](_0x548da2)['json'](_0x655e37);}};}function respondWithFilteredResult(_0x348bb2,_0x29ea4c){return function(_0x566544){if(_0x566544){var _0x482703=_0x566544['count'],_0x55f05a=_0x29ea4c[_0x4136('0x1f')],_0x37eb43=_0x29ea4c[_0x4136('0x1f')]+_0x29ea4c[_0x4136('0x20')],_0x37877a;if(_0x37eb43>=_0x482703){_0x37eb43=_0x482703;_0x37877a=0xc8;}else{_0x37877a=0xce;}_0x348bb2['status'](_0x37877a);return _0x348bb2['set'](_0x4136('0x21'),_0x55f05a+'-'+_0x37eb43+'/'+_0x482703)['json'](_0x566544);}return null;};}function patchUpdates(_0x46eb0b){return function(_0x994ac3){try{jsonpatch['apply'](_0x994ac3,_0x46eb0b,!![]);}catch(_0x1af7e7){return BPromise[_0x4136('0x22')](_0x1af7e7);}return _0x994ac3['save']();};}function saveUpdates(_0x2e6a48,_0x115e94){return function(_0x3de5f6){if(_0x3de5f6){return _0x3de5f6[_0x4136('0x23')](_0x2e6a48)[_0x4136('0x24')](function(_0x14ca0b){return _0x14ca0b;});}return null;};}function removeEntity(_0x4155ea,_0x3a1614){return function(_0xcafa6f){if(_0xcafa6f){return _0xcafa6f['destroy']()[_0x4136('0x24')](function(){_0x4155ea['status'](0xcc)[_0x4136('0x1e')]();});}};}function handleEntityNotFound(_0x367aa1,_0x51ab21){return function(_0x3027e9){if(!_0x3027e9){_0x367aa1[_0x4136('0x1c')](0x194);}return _0x3027e9;};}function handleError(_0x485a3d,_0x4701e2){_0x4701e2=_0x4701e2||0x1f4;return function(_0x492d89){logger[_0x4136('0x25')](_0x492d89['stack']);if(_0x492d89[_0x4136('0x26')]){delete _0x492d89[_0x4136('0x26')];}_0x485a3d['status'](_0x4701e2)[_0x4136('0x27')](_0x492d89);};}exports[_0x4136('0x28')]=function(_0x763ae3,_0x21942d,_0x5333f2){if(!_0x763ae3[_0x4136('0x29')][_0x4136('0x2a')]('text')&&!_0x763ae3[_0x4136('0x29')]['hasOwnProperty'](_0x4136('0x2b'))){throw new db[(_0x4136('0x2c'))][(_0x4136('0x2d'))](_0x4136('0x2e'));}else{if(_0x763ae3[_0x4136('0x29')]['hasOwnProperty'](_0x4136('0x2b'))&&!_0x763ae3[_0x4136('0x29')][_0x4136('0x2a')](_0x4136('0x2f'))){throw new db[(_0x4136('0x2c'))][(_0x4136('0x2d'))](_0x4136('0x30'));}if(!_0x763ae3[_0x4136('0x29')][_0x4136('0x2a')](_0x4136('0x31'))){throw new db['Sequelize'][(_0x4136('0x2d'))](_0x4136('0x32'));}else{try{var _0x2ac307=JSON[_0x4136('0x33')](_0x763ae3[_0x4136('0x29')][_0x4136('0x31')]);}catch(_0x2ae95c){logger[_0x4136('0x25')](_0x2ae95c);throw new db[(_0x4136('0x2c'))][(_0x4136('0x2d'))](_0x4136('0x34'));}var _0x5034d2=[_0x4136('0x35'),_0x4136('0x36'),_0x4136('0x37'),_0x4136('0x38'),'smsqueue',_0x4136('0x39'),_0x4136('0x3a'),_0x4136('0x3b'),_0x4136('0x3c')];if(_[_0x4136('0x3d')](_0x2ac307,function(_0x1472f3){return!_[_0x4136('0x3e')](_0x5034d2,_0x1472f3[_0x4136('0x3f')][_0x4136('0x40')]());})){throw new db[(_0x4136('0x2c'))][(_0x4136('0x2d'))](_0x4136('0x41'));}}}var _0x5272b6={};_0x5272b6[_0x4136('0x42')]=_0x763ae3[_0x4136('0x29')]['hasOwnProperty'](_0x4136('0x42'))?_0x763ae3['body'][_0x4136('0x42')]:_0x763ae3['user'][_0x4136('0x43')];_0x5272b6[_0x4136('0x44')]=_[_0x4136('0x45')](_0x763ae3[_0x4136('0x29')][_0x4136('0x44')])?null:_0x763ae3[_0x4136('0x29')]['recipientsDescription'];_0x5272b6[_0x4136('0x46')]=_0x763ae3['body'][_0x4136('0x46')]||![];_0x5272b6['SenderId']=_0x763ae3[_0x4136('0x3c')]['id'];return getContent(_0x763ae3['body'])[_0x4136('0x24')](function(_0x392e3d){_0x5272b6[_0x4136('0x29')]=_0x392e3d;return getRecipients(_0x2ac307);})[_0x4136('0x24')](function(_0x220462){_0x5272b6[_0x4136('0x47')]=_['sortBy'](_0x220462)['join'](',');return db[_0x4136('0x48')][_0x4136('0x49')](function(_0x308299){return db[_0x4136('0x4a')][_0x4136('0x4b')](_0x5272b6,{'raw':!![],'transaction':_0x308299})[_0x4136('0x24')](function(_0x11c0c7){var _0x257bae={'sender':_0x5272b6[_0x4136('0x42')],'description':_0x5272b6['recipientsDescription'],'content':_0x5272b6[_0x4136('0x29')],'beep':_0x5272b6['beep']};_0x220462[_0x4136('0x4c')](function(_0x5b9891){_0x257bae[_0x4136('0x4d')]=_0x5b9891;socket['emit'](_0x4136('0x4e'),_0x257bae);});return _0x11c0c7;});});})[_0x4136('0x24')](respondWithResult(_0x21942d,0xc9))[_0x4136('0x4f')](handleError(_0x21942d,null));};function getContent(_0x47d9a5){return new BPromise(function(_0x4beb55,_0x468e07){if(_0x47d9a5[_0x4136('0x50')]){_0x4beb55(_0x47d9a5[_0x4136('0x50')]);return;}return db[_0x4136('0x51')][_0x4136('0x52')]({'attributes':[_0x4136('0x53')],'where':{'id':_0x47d9a5[_0x4136('0x2b')]},'raw':!![]})[_0x4136('0x24')](function(_0x20ba5e){if(!_0x20ba5e)throw new db[(_0x4136('0x2c'))][(_0x4136('0x2d'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x402d35=Mustache['render'](_0x20ba5e[_0x4136('0x53')],_0x47d9a5[_0x4136('0x2f')]);_0x4beb55(_0x402d35);})[_0x4136('0x4f')](function(_0x215c8f){_0x468e07(_0x215c8f);});});}function getRecipients(_0x329384){return new BPromise(function(_0x20487f,_0x4a0755){var _0x5d4990=[];var _0x34ece2=[];_0x329384[_0x4136('0x4c')](function(_0x837cd9){var _0xf57c03=_[_0x4136('0x54')](_0x837cd9[_0x4136('0x3f')][_0x4136('0x40')]());if(_0xf57c03===_0x4136('0x55')){_0x5d4990=_[_0x4136('0x56')](_0x5d4990,_0x837cd9[_0x4136('0x57')]);}else{if(_['includes'](_0xf57c03,_0x4136('0x58')))_0xf57c03=_0xf57c03[_0x4136('0x59')](_0x4136('0x58'),_0x4136('0x5a'));_0x837cd9[_0x4136('0x57')][_0x4136('0x4c')](function(_0x2e9621){_0x34ece2[_0x4136('0x5b')](getAgents(_0xf57c03,_0x2e9621));});}});return BPromise['all'](_0x34ece2)[_0x4136('0x24')](function(_0x1fa2cc){_0x5d4990=_['union'](_0x5d4990,_[_0x4136('0x5c')](_0x1fa2cc));_0x20487f(_0x5d4990);})[_0x4136('0x4f')](function(_0x4597d5){_0x4a0755(_0x4597d5);});});}function getAgents(_0x2f0bf8,_0x16fb63){return new BPromise(function(_0x57b92c,_0x3d282e){return db[_0x2f0bf8][_0x4136('0x52')]({'where':{'id':_0x16fb63}})['then'](function(_0x300f46){return _0x300f46[_0x4136('0x5d')]({'attributes':['id'],'raw':!![]})[_0x4136('0x24')](function(_0x8a9e6e){var _0x4b896a=_[_0x4136('0x5e')](_0x8a9e6e,'id');_0x57b92c(_0x4b896a);});})[_0x4136('0x4f')](function(_0x20d120){_0x3d282e(_0x20d120);});});} \ No newline at end of file +var _0x370f=['mailqueue','openchannelqueue','voicequeue','whatsappqueue','user','some','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sequelize','transaction','UserNotification','forEach','recipient','emit','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','toLowerCase','User','union','ids','includes','queue','all','flatten','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','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','./userNotification.socket','status','json','offset','limit','apply','reject','save','update','then','end','sendStatus','error','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','faxqueue'];(function(_0x348184,_0xd1cb3){var _0x21fe6f=function(_0x5286a4){while(--_0x5286a4){_0x348184['push'](_0x348184['shift']());}};_0x21fe6f(++_0xd1cb3);}(_0x370f,0x132));var _0xf370=function(_0x3cef4d,_0x3f3516){_0x3cef4d=_0x3cef4d-0x0;var _0x8c5437=_0x370f[_0x3cef4d];return _0x8c5437;};'use strict';var emlformat=require(_0xf370('0x0'));var rimraf=require(_0xf370('0x1'));var zipdir=require(_0xf370('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf370('0x3'));var BPromise=require(_0xf370('0x4'));var Mustache=require(_0xf370('0x5'));var util=require(_0xf370('0x6'));var path=require(_0xf370('0x7'));var sox=require('sox');var csv=require(_0xf370('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf370('0x9'));var squel=require(_0xf370('0xa'));var crypto=require('crypto');var jsforce=require(_0xf370('0xb'));var deskjs=require(_0xf370('0xc'));var toCsv=require(_0xf370('0x8'));var querystring=require('querystring');var Papa=require(_0xf370('0xd'));var Redis=require(_0xf370('0xe'));var authService=require(_0xf370('0xf'));var qs=require(_0xf370('0x10'));var as=require(_0xf370('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf370('0x12'))(_0xf370('0x13'));var utils=require(_0xf370('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf370('0x15'));var db=require(_0xf370('0x16'))['db'];config[_0xf370('0x17')]=_['defaults'](config[_0xf370('0x17')],{'host':_0xf370('0x18'),'port':0x18eb});var socket=require(_0xf370('0x19'))(new Redis(config[_0xf370('0x17')]));require(_0xf370('0x1a'))['register'](socket);function respondWithStatusCode(_0x2ba409,_0x2bc114){_0x2bc114=_0x2bc114||0xcc;return function(_0x326329){if(_0x326329){return _0x2ba409['sendStatus'](_0x2bc114);}return _0x2ba409['status'](_0x2bc114)['end']();};}function respondWithResult(_0x272fa3,_0x1c9a8e){_0x1c9a8e=_0x1c9a8e||0xc8;return function(_0x90ff4b){if(_0x90ff4b){return _0x272fa3[_0xf370('0x1b')](_0x1c9a8e)[_0xf370('0x1c')](_0x90ff4b);}};}function respondWithFilteredResult(_0x32537e,_0x2cfeaa){return function(_0x3a963a){if(_0x3a963a){var _0x3c9a6f=_0x3a963a['count'],_0x79fb7d=_0x2cfeaa[_0xf370('0x1d')],_0x26d48f=_0x2cfeaa['offset']+_0x2cfeaa[_0xf370('0x1e')],_0x3078e1;if(_0x26d48f>=_0x3c9a6f){_0x26d48f=_0x3c9a6f;_0x3078e1=0xc8;}else{_0x3078e1=0xce;}_0x32537e[_0xf370('0x1b')](_0x3078e1);return _0x32537e['set']('Content-Range',_0x79fb7d+'-'+_0x26d48f+'/'+_0x3c9a6f)[_0xf370('0x1c')](_0x3a963a);}return null;};}function patchUpdates(_0x432a39){return function(_0x51540f){try{jsonpatch[_0xf370('0x1f')](_0x51540f,_0x432a39,!![]);}catch(_0x181790){return BPromise[_0xf370('0x20')](_0x181790);}return _0x51540f[_0xf370('0x21')]();};}function saveUpdates(_0x139ad9,_0x965d01){return function(_0x3ffcf1){if(_0x3ffcf1){return _0x3ffcf1[_0xf370('0x22')](_0x139ad9)[_0xf370('0x23')](function(_0x5ec478){return _0x5ec478;});}return null;};}function removeEntity(_0x1a8dfd,_0x1d0885){return function(_0x45fece){if(_0x45fece){return _0x45fece['destroy']()['then'](function(){_0x1a8dfd['status'](0xcc)[_0xf370('0x24')]();});}};}function handleEntityNotFound(_0x4846ff,_0x40cdf7){return function(_0x4c1767){if(!_0x4c1767){_0x4846ff[_0xf370('0x25')](0x194);}return _0x4c1767;};}function handleError(_0x78c8ec,_0x22837d){_0x22837d=_0x22837d||0x1f4;return function(_0x33b7fa){logger[_0xf370('0x26')](_0x33b7fa['stack']);if(_0x33b7fa['name']){delete _0x33b7fa[_0xf370('0x27')];}_0x78c8ec[_0xf370('0x1b')](_0x22837d)['send'](_0x33b7fa);};}exports[_0xf370('0x28')]=function(_0x5e7945,_0x340624,_0x5308ab){if(!_0x5e7945[_0xf370('0x29')][_0xf370('0x2a')](_0xf370('0x2b'))&&!_0x5e7945[_0xf370('0x29')][_0xf370('0x2a')](_0xf370('0x2c'))){throw new db['Sequelize'][(_0xf370('0x2d'))](_0xf370('0x2e'));}else{if(_0x5e7945[_0xf370('0x29')]['hasOwnProperty'](_0xf370('0x2c'))&&!_0x5e7945['body'][_0xf370('0x2a')](_0xf370('0x2f'))){throw new db[(_0xf370('0x30'))][(_0xf370('0x2d'))](_0xf370('0x31'));}if(!_0x5e7945[_0xf370('0x29')][_0xf370('0x2a')](_0xf370('0x32'))){throw new db[(_0xf370('0x30'))][(_0xf370('0x2d'))](_0xf370('0x33'));}else{try{var _0x1eeca2=JSON[_0xf370('0x34')](_0x5e7945[_0xf370('0x29')][_0xf370('0x32')]);}catch(_0x5f31fc){logger[_0xf370('0x26')](_0x5f31fc);throw new db[(_0xf370('0x30'))][(_0xf370('0x2d'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x1f4244=['chatqueue',_0xf370('0x35'),_0xf370('0x36'),_0xf370('0x37'),'smsqueue',_0xf370('0x38'),_0xf370('0x39'),'team',_0xf370('0x3a')];if(_[_0xf370('0x3b')](_0x1eeca2,function(_0x555f27){return!_['includes'](_0x1f4244,_0x555f27[_0xf370('0x3c')]['toLowerCase']());})){throw new db['Sequelize'][(_0xf370('0x2d'))](_0xf370('0x3d'));}}}var _0x1c648e={};_0x1c648e['senderName']=_0x5e7945[_0xf370('0x29')][_0xf370('0x2a')](_0xf370('0x3e'))?_0x5e7945[_0xf370('0x29')][_0xf370('0x3e')]:_0x5e7945['user'][_0xf370('0x3f')];_0x1c648e[_0xf370('0x40')]=_[_0xf370('0x41')](_0x5e7945[_0xf370('0x29')][_0xf370('0x40')])?null:_0x5e7945[_0xf370('0x29')]['recipientsDescription'];_0x1c648e[_0xf370('0x42')]=_0x5e7945[_0xf370('0x29')][_0xf370('0x42')]||![];_0x1c648e[_0xf370('0x43')]=_0x5e7945[_0xf370('0x3a')]['id'];return getContent(_0x5e7945['body'])[_0xf370('0x23')](function(_0xe801cf){_0x1c648e[_0xf370('0x29')]=_0xe801cf;return getRecipients(_0x1eeca2);})[_0xf370('0x23')](function(_0x4994ca){_0x1c648e[_0xf370('0x44')]=_['sortBy'](_0x4994ca)['join'](',');return db[_0xf370('0x45')][_0xf370('0x46')](function(_0x2ec29e){return db[_0xf370('0x47')]['create'](_0x1c648e,{'raw':!![],'transaction':_0x2ec29e})[_0xf370('0x23')](function(_0x3117ee){var _0x307cec={'sender':_0x1c648e[_0xf370('0x3e')],'description':_0x1c648e[_0xf370('0x40')],'content':_0x1c648e[_0xf370('0x29')],'beep':_0x1c648e[_0xf370('0x42')]};_0x4994ca[_0xf370('0x48')](function(_0x5c9153){_0x307cec[_0xf370('0x49')]=_0x5c9153;socket[_0xf370('0x4a')]('userNotification:send',_0x307cec);});return _0x3117ee;});});})['then'](respondWithResult(_0x340624,0xc9))['catch'](handleError(_0x340624,null));};function getContent(_0x2f097a){return new BPromise(function(_0x44f45e,_0x1f0d37){if(_0x2f097a[_0xf370('0x2b')]){_0x44f45e(_0x2f097a[_0xf370('0x2b')]);return;}return db[_0xf370('0x4b')]['findOne']({'attributes':[_0xf370('0x4c')],'where':{'id':_0x2f097a[_0xf370('0x2c')]},'raw':!![]})[_0xf370('0x23')](function(_0x3ac595){if(!_0x3ac595)throw new db[(_0xf370('0x30'))][(_0xf370('0x2d'))](_0xf370('0x4d'));var _0x2694a3=Mustache[_0xf370('0x4e')](_0x3ac595['html'],_0x2f097a[_0xf370('0x2f')]);_0x44f45e(_0x2694a3);})[_0xf370('0x4f')](function(_0x3e0ab9){_0x1f0d37(_0x3e0ab9);});});}function getRecipients(_0x424999){return new BPromise(function(_0x57b104,_0x5cf4a0){var _0x18b301=[];var _0x1aadee=[];_0x424999[_0xf370('0x48')](function(_0x2f8d40){var _0xeae3d5=_[_0xf370('0x50')](_0x2f8d40[_0xf370('0x3c')][_0xf370('0x51')]());if(_0xeae3d5===_0xf370('0x52')){_0x18b301=_[_0xf370('0x53')](_0x18b301,_0x2f8d40[_0xf370('0x54')]);}else{if(_[_0xf370('0x55')](_0xeae3d5,_0xf370('0x56')))_0xeae3d5=_0xeae3d5['replace'](_0xf370('0x56'),'Queue');_0x2f8d40[_0xf370('0x54')][_0xf370('0x48')](function(_0x146833){_0x1aadee['push'](getAgents(_0xeae3d5,_0x146833));});}});return BPromise[_0xf370('0x57')](_0x1aadee)['then'](function(_0x1c54d1){_0x18b301=_[_0xf370('0x53')](_0x18b301,_[_0xf370('0x58')](_0x1c54d1));_0x57b104(_0x18b301);})[_0xf370('0x4f')](function(_0x209031){_0x5cf4a0(_0x209031);});});}function getAgents(_0x1db8a5,_0x33a218){return new BPromise(function(_0x3ee99a,_0x4929b8){return db[_0x1db8a5]['findOne']({'where':{'id':_0x33a218}})[_0xf370('0x23')](function(_0x184164){return _0x184164[_0xf370('0x59')]({'attributes':['id'],'raw':!![]})[_0xf370('0x23')](function(_0x41915d){var _0x1f7773=_['map'](_0x41915d,'id');_0x3ee99a(_0x1f7773);});})[_0xf370('0x4f')](function(_0x5627a1){_0x4929b8(_0x5627a1);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index fd4ff21..e43f98e 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 _0xb458=['hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','update','remove'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xb458,0x103));var _0x8b45=function(_0x3e7c61,_0xb44529){_0x3e7c61=_0x3e7c61-0x0;var _0x41662f=_0xb458[_0x3e7c61];return _0x41662f;};'use strict';var EventEmitter=require(_0x8b45('0x0'));var UserNotification=require(_0x8b45('0x1'))['db'][_0x8b45('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8b45('0x3'),'afterDestroy':_0x8b45('0x4')};function emitEvent(_0x141a44){return function(_0x13a8c6,_0x5d51e4,_0x333bc7){UserNotificationEvents['emit'](_0x141a44+':'+_0x13a8c6['id'],_0x13a8c6);UserNotificationEvents['emit'](_0x141a44,_0x13a8c6);_0x333bc7(null);};}for(var e in events){if(events[_0x8b45('0x5')](e)){var event=events[e];UserNotification[_0x8b45('0x6')](e,emitEvent(event));}}module[_0x8b45('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0xfd28=['UserNotification','save','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x1e7517,_0x4b03c9){var _0x522f4c=function(_0x4b056b){while(--_0x4b056b){_0x1e7517['push'](_0x1e7517['shift']());}};_0x522f4c(++_0x4b03c9);}(_0xfd28,0x148));var _0x8fd2=function(_0x257495,_0x18269b){_0x257495=_0x257495-0x0;var _0x3849aa=_0xfd28[_0x257495];return _0x3849aa;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x8fd2('0x0'))['db'][_0x8fd2('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8fd2('0x2'),'afterUpdate':'update','afterDestroy':_0x8fd2('0x3')};function emitEvent(_0xf7417d){return function(_0x4e2108,_0x4b22ae,_0x155f46){UserNotificationEvents[_0x8fd2('0x4')](_0xf7417d+':'+_0x4e2108['id'],_0x4e2108);UserNotificationEvents[_0x8fd2('0x4')](_0xf7417d,_0x4e2108);_0x155f46(null);};}for(var e in events){if(events[_0x8fd2('0x5')](e)){var event=events[e];UserNotification[_0x8fd2('0x6')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index d86f0d3..6b15140 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 _0x9189=['../../config/logger','api','moment','bluebird','path','./userNotification.attributes','exports','define','UserNotification'];(function(_0x357614,_0x44a2ad){var _0x3c77dd=function(_0x5d55b5){while(--_0x5d55b5){_0x357614['push'](_0x357614['shift']());}};_0x3c77dd(++_0x44a2ad);}(_0x9189,0x1b0));var _0x9918=function(_0x2464c2,_0x278c2a){_0x2464c2=_0x2464c2-0x0;var _0x3119db=_0x9189[_0x2464c2];return _0x3119db;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9918('0x0'))(_0x9918('0x1'));var moment=require(_0x9918('0x2'));var BPromise=require(_0x9918('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9918('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9918('0x5'));module[_0x9918('0x6')]=function(_0x4a47d4,_0x3ba4a8){return _0x4a47d4[_0x9918('0x7')](_0x9918('0x8'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7be1=['moment','bluebird','request-promise','path','rimraf','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x37e0a8,_0x184bc8){var _0x5ca63c=function(_0x1af002){while(--_0x1af002){_0x37e0a8['push'](_0x37e0a8['shift']());}};_0x5ca63c(++_0x184bc8);}(_0x7be1,0x165));var _0x17be=function(_0x459349,_0x2e6797){_0x459349=_0x459349-0x0;var _0x35de00=_0x7be1[_0x459349];return _0x35de00;};'use strict';var _=require(_0x17be('0x0'));var util=require(_0x17be('0x1'));var logger=require(_0x17be('0x2'))('api');var moment=require(_0x17be('0x3'));var BPromise=require(_0x17be('0x4'));var rp=require(_0x17be('0x5'));var fs=require('fs');var path=require(_0x17be('0x6'));var rimraf=require(_0x17be('0x7'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module['exports']=function(_0x2fed12,_0x40f3f9){return _0x2fed12['define'](_0x17be('0x8'),attributes,{'tableName':_0x17be('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x17be('0xa'),'collate':_0x17be('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 394ebd8..6fd9603 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 _0xb777=['debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent'];(function(_0x2fe2df,_0x341974){var _0x243a2b=function(_0x422f95){while(--_0x422f95){_0x2fe2df['push'](_0x2fe2df['shift']());}};_0x243a2b(++_0x341974);}(_0xb777,0xda));var _0x7b77=function(_0x131eb1,_0x55b270){_0x131eb1=_0x131eb1-0x0;var _0x3a3b7a=_0xb777[_0x131eb1];return _0x3a3b7a;};'use strict';var _=require('lodash');var util=require(_0x7b77('0x0'));var moment=require(_0x7b77('0x1'));var BPromise=require(_0x7b77('0x2'));var rs=require(_0x7b77('0x3'));var fs=require('fs');var Redis=require(_0x7b77('0x4'));var db=require(_0x7b77('0x5'))['db'];var utils=require(_0x7b77('0x6'));var logger=require('../../config/logger')(_0x7b77('0x7'));var config=require(_0x7b77('0x8'));var jayson=require(_0x7b77('0x9'));var client=jayson[_0x7b77('0xa')][_0x7b77('0xb')]({'port':0x232a});config[_0x7b77('0xc')]=_[_0x7b77('0xd')](config[_0x7b77('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7b77('0xe'))(new Redis(config['redis']));require(_0x7b77('0xf'))[_0x7b77('0x10')](socket);function respondWithRpcPromise(_0xff5b8c,_0x2648ee,_0x27731a){return new BPromise(function(_0x5ad72c,_0x574689){return client[_0x7b77('0x11')](_0xff5b8c,_0x27731a)[_0x7b77('0x12')](function(_0x56ff12){logger[_0x7b77('0x13')](_0x7b77('0x14'),_0x2648ee,_0x7b77('0x15'));logger[_0x7b77('0x16')](_0x7b77('0x17'),_0x2648ee,_0x7b77('0x15'),JSON[_0x7b77('0x18')](_0x56ff12));if(_0x56ff12[_0x7b77('0x19')]){if(_0x56ff12[_0x7b77('0x19')][_0x7b77('0x1a')]===0x1f4){logger[_0x7b77('0x19')](_0x7b77('0x14'),_0x2648ee,_0x56ff12[_0x7b77('0x19')][_0x7b77('0x1b')]);return _0x574689(_0x56ff12[_0x7b77('0x19')][_0x7b77('0x1b')]);}logger[_0x7b77('0x19')](_0x7b77('0x14'),_0x2648ee,_0x56ff12[_0x7b77('0x19')][_0x7b77('0x1b')]);return _0x5ad72c(_0x56ff12['error']['message']);}else{logger[_0x7b77('0x13')](_0x7b77('0x14'),_0x2648ee,_0x7b77('0x15'));_0x5ad72c(_0x56ff12[_0x7b77('0x1c')][_0x7b77('0x1b')]);}})[_0x7b77('0x1d')](function(_0x44661f){logger[_0x7b77('0x19')]('UserNotification,\x20%s,\x20%s',_0x2648ee,_0x44661f);_0x574689(_0x44661f);});});} \ No newline at end of file +var _0xa924=['then','info','request\x20sent','stringify','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xa924,0x176));var _0x4a92=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xa924[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0x4a92('0x0'));var util=require('util');var moment=require(_0x4a92('0x1'));var BPromise=require(_0x4a92('0x2'));var rs=require(_0x4a92('0x3'));var fs=require('fs');var Redis=require(_0x4a92('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4a92('0x5'));var logger=require(_0x4a92('0x6'))(_0x4a92('0x7'));var config=require(_0x4a92('0x8'));var jayson=require(_0x4a92('0x9'));var client=jayson[_0x4a92('0xa')][_0x4a92('0xb')]({'port':0x232a});config[_0x4a92('0xc')]=_['defaults'](config[_0x4a92('0xc')],{'host':_0x4a92('0xd'),'port':0x18eb});var socket=require(_0x4a92('0xe'))(new Redis(config[_0x4a92('0xc')]));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x60323f,_0x359b28,_0x5d5d80){return new BPromise(function(_0x447f05,_0x2bda76){return client[_0x4a92('0xf')](_0x60323f,_0x5d5d80)[_0x4a92('0x10')](function(_0x2c6046){logger[_0x4a92('0x11')]('UserNotification,\x20%s,\x20%s',_0x359b28,_0x4a92('0x12'));logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x359b28,_0x4a92('0x12'),JSON[_0x4a92('0x13')](_0x2c6046));if(_0x2c6046[_0x4a92('0x14')]){if(_0x2c6046['error'][_0x4a92('0x15')]===0x1f4){logger[_0x4a92('0x14')](_0x4a92('0x16'),_0x359b28,_0x2c6046[_0x4a92('0x14')][_0x4a92('0x17')]);return _0x2bda76(_0x2c6046[_0x4a92('0x14')][_0x4a92('0x17')]);}logger[_0x4a92('0x14')](_0x4a92('0x16'),_0x359b28,_0x2c6046[_0x4a92('0x14')][_0x4a92('0x17')]);return _0x447f05(_0x2c6046['error'][_0x4a92('0x17')]);}else{logger[_0x4a92('0x11')](_0x4a92('0x16'),_0x359b28,_0x4a92('0x12'));_0x447f05(_0x2c6046[_0x4a92('0x18')]['message']);}})[_0x4a92('0x19')](function(_0x192cd4){logger[_0x4a92('0x14')](_0x4a92('0x16'),_0x359b28,_0x192cd4);_0x2bda76(_0x192cd4);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index db2db3c..651b79b 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 _0x4be6=['removeListener','save','remove','update','emit'];(function(_0x3deeb3,_0x3591bb){var _0x1f4390=function(_0x4ff924){while(--_0x4ff924){_0x3deeb3['push'](_0x3deeb3['shift']());}};_0x1f4390(++_0x3591bb);}(_0x4be6,0xb5));var _0x64be=function(_0x5b9ac9,_0x374422){_0x5b9ac9=_0x5b9ac9-0x0;var _0x7e6db3=_0x4be6[_0x5b9ac9];return _0x7e6db3;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x64be('0x0'),_0x64be('0x1'),_0x64be('0x2')];function createListener(_0x2bbd6b,_0x1cb7dd){return function(_0x2dea47){_0x1cb7dd[_0x64be('0x3')](_0x2bbd6b,_0x2dea47);};}function removeListener(_0x85d7a2,_0x217ce6){return function(){UserNotificationEvents[_0x64be('0x4')](_0x85d7a2,_0x217ce6);};}exports['register']=function(_0x131822){for(var _0x2430e2=0x0,_0x3e8639=events['length'];_0x2430e2<_0x3e8639;_0x2430e2++){var _0x19bdb3=events[_0x2430e2];var _0x21fcb7=createListener('userNotification:'+_0x19bdb3,_0x131822);UserNotificationEvents['on'](_0x19bdb3,_0x21fcb7);}}; \ No newline at end of file +var _0x103f=['remove','update','emit','register','length','userNotification:','./userNotification.events','save'];(function(_0x1fb932,_0x53964f){var _0x1b3d86=function(_0x4dec72){while(--_0x4dec72){_0x1fb932['push'](_0x1fb932['shift']());}};_0x1b3d86(++_0x53964f);}(_0x103f,0x13e));var _0xf103=function(_0x1fc047,_0x1c7807){_0x1fc047=_0x1fc047-0x0;var _0x2c717e=_0x103f[_0x1fc047];return _0x2c717e;};'use strict';var UserNotificationEvents=require(_0xf103('0x0'));var events=[_0xf103('0x1'),_0xf103('0x2'),_0xf103('0x3')];function createListener(_0xbaee4b,_0x15ff90){return function(_0x3eca86){_0x15ff90[_0xf103('0x4')](_0xbaee4b,_0x3eca86);};}function removeListener(_0x2db927,_0x2e15c9){return function(){UserNotificationEvents['removeListener'](_0x2db927,_0x2e15c9);};}exports[_0xf103('0x5')]=function(_0x30ae90){for(var _0x1cb07e=0x0,_0x211dbc=events[_0xf103('0x6')];_0x1cb07e<_0x211dbc;_0x1cb07e++){var _0x3cfbd1=events[_0x1cb07e];var _0x37e92b=createListener(_0xf103('0x7')+_0x3cfbd1,_0x30ae90);UserNotificationEvents['on'](_0x3cfbd1,_0x37e92b);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index deac257..3300ad2 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 _0xb6fa=['multer','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb6fa,0x1c2));var _0xab6f=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0xb6fa[_0x1992f1];return _0x413dfe;};'use strict';var multer=require(_0xab6f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xab6f('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xab6f('0x2'));var auth=require(_0xab6f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xab6f('0x4'));module[_0xab6f('0x5')]=router; \ No newline at end of file +var _0x4e61=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','Router'];(function(_0x128802,_0x44df91){var _0x41f25d=function(_0x39c09){while(--_0x39c09){_0x128802['push'](_0x128802['shift']());}};_0x41f25d(++_0x44df91);}(_0x4e61,0x8c));var _0x14e6=function(_0x417baa,_0x3923d0){_0x417baa=_0x417baa-0x0;var _0x42724f=_0x4e61[_0x417baa];return _0x42724f;};'use strict';var multer=require(_0x14e6('0x0'));var util=require(_0x14e6('0x1'));var path=require(_0x14e6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x14e6('0x3')]();var fs_extra=require(_0x14e6('0x4'));var auth=require(_0x14e6('0x5'));var interaction=require(_0x14e6('0x6'));var config=require(_0x14e6('0x7'));module[_0x14e6('0x8')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 8d7b387..3c9f66b 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 _0xb10b=['sequelize','INTEGER'];(function(_0x4c8d00,_0x55cb56){var _0x4ced83=function(_0x19cd71){while(--_0x19cd71){_0x4c8d00['push'](_0x4c8d00['shift']());}};_0x4ced83(++_0x55cb56);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a2266,_0x53e92f){_0x4a2266=_0x4a2266-0x0;var _0x1d7b9f=_0xb10b[_0x4a2266];return _0x1d7b9f;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x39bc44,_0x1d4373){var _0x2916d8=function(_0x1767ac){while(--_0x1767ac){_0x39bc44['push'](_0x39bc44['shift']());}};_0x2916d8(++_0x1d4373);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'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/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index da638d2..7838d14 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 _0x7baf=['UserOpenchannelQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','define'];(function(_0x577d42,_0x3b3069){var _0x3ade05=function(_0x16518e){while(--_0x16518e){_0x577d42['push'](_0x577d42['shift']());}};_0x3ade05(++_0x3b3069);}(_0x7baf,0xd2));var _0xf7ba=function(_0x63161e,_0x3a88a5){_0x63161e=_0x63161e-0x0;var _0x47dc09=_0x7baf[_0x63161e];return _0x47dc09;};'use strict';var _=require(_0xf7ba('0x0'));var util=require(_0xf7ba('0x1'));var logger=require(_0xf7ba('0x2'))('api');var moment=require(_0xf7ba('0x3'));var BPromise=require(_0xf7ba('0x4'));var rp=require(_0xf7ba('0x5'));var fs=require('fs');var path=require(_0xf7ba('0x6'));var rimraf=require(_0xf7ba('0x7'));var config=require('../../config/environment');var attributes=require(_0xf7ba('0x8'));module['exports']=function(_0x33f732,_0x396f70){return _0x33f732[_0xf7ba('0x9')](_0xf7ba('0xa'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2236=['exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x25ea9a,_0x255a21){var _0x3485da=function(_0x4133f3){while(--_0x4133f3){_0x25ea9a['push'](_0x25ea9a['shift']());}};_0x3485da(++_0x255a21);}(_0x2236,0x1dd));var _0x6223=function(_0x42bb6d,_0x412255){_0x42bb6d=_0x42bb6d-0x0;var _0x1db89b=_0x2236[_0x42bb6d];return _0x1db89b;};'use strict';var _=require(_0x6223('0x0'));var util=require(_0x6223('0x1'));var logger=require(_0x6223('0x2'))(_0x6223('0x3'));var moment=require('moment');var BPromise=require(_0x6223('0x4'));var rp=require(_0x6223('0x5'));var fs=require('fs');var path=require(_0x6223('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userOpenchannelQueue.attributes');module[_0x6223('0x7')]=function(_0x7517a9,_0x2d4765){return _0x7517a9[_0x6223('0x8')](_0x6223('0x9'),attributes,{'tableName':_0x6223('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 192e012..a6d1274 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 _0x4d30=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','bluebird'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x4d30,0x18d));var _0x04d3=function(_0x1460ab,_0x547f51){_0x1460ab=_0x1460ab-0x0;var _0x540e12=_0x4d30[_0x1460ab];return _0x540e12;};'use strict';var _=require(_0x04d3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x04d3('0x1'));var rs=require(_0x04d3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x04d3('0x3'))['db'];var utils=require(_0x04d3('0x4'));var logger=require(_0x04d3('0x5'))(_0x04d3('0x6'));var config=require(_0x04d3('0x7'));var jayson=require(_0x04d3('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a9b3f,_0x372965,_0x3aca17){return new BPromise(function(_0x57a99f,_0xf782ca){return client['request'](_0x5a9b3f,_0x3aca17)['then'](function(_0x4ec960){logger[_0x04d3('0x9')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x372965,_0x04d3('0xa'));logger[_0x04d3('0xb')](_0x04d3('0xc'),_0x372965,_0x04d3('0xa'),JSON['stringify'](_0x4ec960));if(_0x4ec960['error']){if(_0x4ec960[_0x04d3('0xd')][_0x04d3('0xe')]===0x1f4){logger['error'](_0x04d3('0xf'),_0x372965,_0x4ec960[_0x04d3('0xd')][_0x04d3('0x10')]);return _0xf782ca(_0x4ec960[_0x04d3('0xd')][_0x04d3('0x10')]);}logger[_0x04d3('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x372965,_0x4ec960[_0x04d3('0xd')][_0x04d3('0x10')]);return _0x57a99f(_0x4ec960[_0x04d3('0xd')][_0x04d3('0x10')]);}else{logger['info'](_0x04d3('0xf'),_0x372965,_0x04d3('0xa'));_0x57a99f(_0x4ec960[_0x04d3('0x11')][_0x04d3('0x10')]);}})[_0x04d3('0x12')](function(_0x4a9b8c){logger['error'](_0x04d3('0xf'),_0x372965,_0x4a9b8c);_0xf782ca(_0x4a9b8c);});});} \ No newline at end of file +var _0x1119=['rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x4cfe4b,_0x45474c){var _0x3ab57a=function(_0x2fe642){while(--_0x2fe642){_0x4cfe4b['push'](_0x4cfe4b['shift']());}};_0x3ab57a(++_0x45474c);}(_0x1119,0x189));var _0x9111=function(_0x66ef11,_0x42f78b){_0x66ef11=_0x66ef11-0x0;var _0x318579=_0x1119[_0x66ef11];return _0x318579;};'use strict';var _=require(_0x9111('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9111('0x1'));var rs=require(_0x9111('0x2'));var fs=require('fs');var Redis=require(_0x9111('0x3'));var db=require(_0x9111('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9111('0x5'))(_0x9111('0x6'));var config=require(_0x9111('0x7'));var jayson=require(_0x9111('0x8'));var client=jayson[_0x9111('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x108a0c,_0x512e24,_0x310c7e){return new BPromise(function(_0x518eb7,_0x5db448){return client[_0x9111('0xa')](_0x108a0c,_0x310c7e)[_0x9111('0xb')](function(_0x5393f4){logger[_0x9111('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x512e24,_0x9111('0xd'));logger[_0x9111('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x512e24,_0x9111('0xd'),JSON[_0x9111('0xf')](_0x5393f4));if(_0x5393f4[_0x9111('0x10')]){if(_0x5393f4[_0x9111('0x10')][_0x9111('0x11')]===0x1f4){logger[_0x9111('0x10')](_0x9111('0x12'),_0x512e24,_0x5393f4[_0x9111('0x10')][_0x9111('0x13')]);return _0x5db448(_0x5393f4['error']['message']);}logger[_0x9111('0x10')](_0x9111('0x12'),_0x512e24,_0x5393f4['error']['message']);return _0x518eb7(_0x5393f4['error'][_0x9111('0x13')]);}else{logger[_0x9111('0xc')](_0x9111('0x12'),_0x512e24,_0x9111('0xd'));_0x518eb7(_0x5393f4['result'][_0x9111('0x13')]);}})[_0x9111('0x14')](function(_0x5e132d){logger[_0x9111('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x512e24,_0x5e132d);_0x5db448(_0x5e132d);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 7fbc478..16319ab 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 _0x1bd7=['get','isAuthenticated','index','/describe','describe','/:id','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addResources','put','update','removeSections','removeResources','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller'];(function(_0x32729c,_0xf5afd8){var _0x482cfd=function(_0x231471){while(--_0x231471){_0x32729c['push'](_0x32729c['shift']());}};_0x482cfd(++_0xf5afd8);}(_0x1bd7,0x107));var _0x71bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1bd7[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x71bd('0x0'));var path=require(_0x71bd('0x1'));var timeout=require(_0x71bd('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x71bd('0x3'));var interaction=require(_0x71bd('0x4'));var config=require(_0x71bd('0x5'));var controller=require(_0x71bd('0x6'));router[_0x71bd('0x7')]('/',auth[_0x71bd('0x8')](),controller[_0x71bd('0x9')]);router[_0x71bd('0x7')](_0x71bd('0xa'),auth['isAuthenticated'](),controller[_0x71bd('0xb')]);router[_0x71bd('0x7')](_0x71bd('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x71bd('0xd'),auth[_0x71bd('0x8')](),controller[_0x71bd('0xe')]);router[_0x71bd('0x7')](_0x71bd('0xf'),auth[_0x71bd('0x8')](),controller[_0x71bd('0x10')]);router[_0x71bd('0x11')]('/',auth[_0x71bd('0x8')](),controller[_0x71bd('0x12')]);router['post'](_0x71bd('0x13'),auth[_0x71bd('0x8')](),controller[_0x71bd('0x14')]);router[_0x71bd('0x11')]('/:id/sections',auth['isAuthenticated'](),controller['addSections']);router[_0x71bd('0x11')](_0x71bd('0xf'),auth[_0x71bd('0x8')](),controller[_0x71bd('0x15')]);router[_0x71bd('0x16')](_0x71bd('0xc'),auth[_0x71bd('0x8')](),controller[_0x71bd('0x17')]);router['delete'](_0x71bd('0xc'),auth[_0x71bd('0x8')](),controller['destroy']);router['delete'](_0x71bd('0xd'),auth[_0x71bd('0x8')](),controller[_0x71bd('0x18')]);router['delete'](_0x71bd('0xf'),auth['isAuthenticated'](),controller[_0x71bd('0x19')]);module[_0x71bd('0x1a')]=router; \ No newline at end of file +var _0x42c5=['/:id','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','addResources','put','update','delete','removeResources','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5e5301,_0x12a801){var _0x508fb2=function(_0x3f758b){while(--_0x3f758b){_0x5e5301['push'](_0x5e5301['shift']());}};_0x508fb2(++_0x12a801);}(_0x42c5,0xca));var _0x542c=function(_0x4ea357,_0xf605df){_0x4ea357=_0x4ea357-0x0;var _0x4468ee=_0x42c5[_0x4ea357];return _0x4468ee;};'use strict';var multer=require(_0x542c('0x0'));var util=require(_0x542c('0x1'));var path=require(_0x542c('0x2'));var timeout=require(_0x542c('0x3'));var express=require(_0x542c('0x4'));var router=express[_0x542c('0x5')]();var fs_extra=require(_0x542c('0x6'));var auth=require(_0x542c('0x7'));var interaction=require(_0x542c('0x8'));var config=require('../../config/environment');var controller=require(_0x542c('0x9'));router[_0x542c('0xa')]('/',auth[_0x542c('0xb')](),controller[_0x542c('0xc')]);router[_0x542c('0xa')](_0x542c('0xd'),auth['isAuthenticated'](),controller[_0x542c('0xe')]);router[_0x542c('0xa')](_0x542c('0xf'),auth[_0x542c('0xb')](),controller['show']);router[_0x542c('0xa')](_0x542c('0x10'),auth[_0x542c('0xb')](),controller[_0x542c('0x11')]);router['get'](_0x542c('0x12'),auth[_0x542c('0xb')](),controller[_0x542c('0x13')]);router[_0x542c('0x14')]('/',auth['isAuthenticated'](),controller[_0x542c('0x15')]);router[_0x542c('0x14')](_0x542c('0x16'),auth[_0x542c('0xb')](),controller[_0x542c('0x17')]);router[_0x542c('0x14')](_0x542c('0x10'),auth[_0x542c('0xb')](),controller[_0x542c('0x18')]);router[_0x542c('0x14')](_0x542c('0x12'),auth[_0x542c('0xb')](),controller[_0x542c('0x19')]);router[_0x542c('0x1a')](_0x542c('0xf'),auth[_0x542c('0xb')](),controller[_0x542c('0x1b')]);router[_0x542c('0x1c')]('/:id',auth[_0x542c('0xb')](),controller['destroy']);router[_0x542c('0x1c')]('/:id/sections',auth['isAuthenticated'](),controller['removeSections']);router[_0x542c('0x1c')](_0x542c('0x12'),auth[_0x542c('0xb')](),controller[_0x542c('0x1d')]);module[_0x542c('0x1e')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index a24721a..f38ecac 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 _0xb49a=['exports','STRING','name','setDataValue','crudPermissions','getDataValue','split','BOOLEAN','sequelize'];(function(_0x9408df,_0x4f27b9){var _0xd5c87=function(_0x3da2c9){while(--_0x3da2c9){_0x9408df['push'](_0x9408df['shift']());}};_0xd5c87(++_0x4f27b9);}(_0xb49a,0xfb));var _0xab49=function(_0x520c24,_0x3fb9af){_0x520c24=_0x520c24-0x0;var _0x377104=_0xb49a[_0x520c24];return _0x377104;};'use strict';var Sequelize=require(_0xab49('0x0'));module[_0xab49('0x1')]={'name':{'type':Sequelize[_0xab49('0x2')],'allowNull':![],'unique':_0xab49('0x3')},'crudPermissions':{'type':Sequelize[_0xab49('0x2')],'set':function(_0x55d01b){this[_0xab49('0x4')](_0xab49('0x5'),_0x55d01b?_0x55d01b['join'](''):[]);},'get':function(){return this['getDataValue'](_0xab49('0x5'))?this[_0xab49('0x6')](_0xab49('0x5'))[_0xab49('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xab49('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xab49('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xde2c=['BOOLEAN','sequelize','exports','STRING','name','setDataValue','crudPermissions','getDataValue','split'];(function(_0x2a18b7,_0x5041c8){var _0x45e74e=function(_0x1d32d6){while(--_0x1d32d6){_0x2a18b7['push'](_0x2a18b7['shift']());}};_0x45e74e(++_0x5041c8);}(_0xde2c,0x7f));var _0xcde2=function(_0x393500,_0x1037af){_0x393500=_0x393500-0x0;var _0x120d3b=_0xde2c[_0x393500];return _0x120d3b;};'use strict';var Sequelize=require(_0xcde2('0x0'));module[_0xcde2('0x1')]={'name':{'type':Sequelize[_0xcde2('0x2')],'allowNull':![],'unique':_0xcde2('0x3')},'crudPermissions':{'type':Sequelize[_0xcde2('0x2')],'set':function(_0x40fa0a){this[_0xcde2('0x4')](_0xcde2('0x5'),_0x40fa0a?_0x40fa0a['join'](''):[]);},'get':function(){return this[_0xcde2('0x6')](_0xcde2('0x5'))?this[_0xcde2('0x6')](_0xcde2('0x5'))[_0xcde2('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xcde2('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 46f3652..0a099be 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 _0x24d1=['type','VIRTUAL','options','UserProfile','includeAll','include','findAll','rows','catch','show','params','find','create','body','clone','get','createdAt','updatedAt','crudPermissions','omit','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','push','removeSections','ids','getSections','includes','subsections','enabled','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','undefined','mergeResources','childModel','Invalid\x20section\x20\x27','isEmpty','parentSections','all','ignore','union','field','AnalyticExtractedReport','foreignKey','associatedResources','default','DefaultReports','custom','reportId','CustomReports','CmContact','Tag','Tags','color','tag','ThroughTags','value','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','Agents','membername','User','role','Telephones','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','Sound','tags','templates','Template','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','whatsappaccounts','eml-format','rimraf','zip-dir','moment','path','sox','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','status','error','name','send','index','map','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x399131,_0x2db855){var _0xce76e2=function(_0x175a64){while(--_0x175a64){_0x399131['push'](_0x399131['shift']());}};_0xce76e2(++_0x2db855);}(_0x24d1,0x1a4));var _0x124d=function(_0x1d1263,_0xf865b){_0x1d1263=_0x1d1263-0x0;var _0x20af97=_0x24d1[_0x1d1263];return _0x20af97;};'use strict';var emlformat=require(_0x124d('0x0'));var rimraf=require(_0x124d('0x1'));var zipdir=require(_0x124d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x124d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x124d('0x4'));var sox=require(_0x124d('0x5'));var csv=require(_0x124d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x124d('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x124d('0x8'));var jsforce=require(_0x124d('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x124d('0x6'));var querystring=require(_0x124d('0xa'));var Papa=require(_0x124d('0xb'));var Redis=require('ioredis');var authService=require(_0x124d('0xc'));var qs=require(_0x124d('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x124d('0xe'));var logger=require('../../config/logger')(_0x124d('0xf'));var utils=require(_0x124d('0x10'));var config=require(_0x124d('0x11'));var licenseUtil=require(_0x124d('0x12'));var db=require(_0x124d('0x13'))['db'];config[_0x124d('0x14')]=_[_0x124d('0x15')](config[_0x124d('0x14')],{'host':_0x124d('0x16'),'port':0x18eb});var socket=require(_0x124d('0x17'))(new Redis(config[_0x124d('0x14')]));require(_0x124d('0x18'))[_0x124d('0x19')](socket);function respondWithStatusCode(_0x416978,_0x1d120e){_0x1d120e=_0x1d120e||0xcc;return function(_0x7b52c9){if(_0x7b52c9){return _0x416978[_0x124d('0x1a')](_0x1d120e);}return _0x416978['status'](_0x1d120e)[_0x124d('0x1b')]();};}function respondWithResult(_0x1d5e5d,_0x1e0985){_0x1e0985=_0x1e0985||0xc8;return function(_0x276c7d){if(_0x276c7d){return _0x1d5e5d['status'](_0x1e0985)[_0x124d('0x1c')](_0x276c7d);}};}function respondWithFilteredResult(_0x36c04c,_0x49e35f){return function(_0x3457e4){if(_0x3457e4){var _0x29f1b8=_0x3457e4[_0x124d('0x1d')],_0x3c6657=_0x49e35f[_0x124d('0x1e')],_0x41f15c=_0x49e35f[_0x124d('0x1e')]+_0x49e35f[_0x124d('0x1f')],_0x38031d;if(_0x41f15c>=_0x29f1b8){_0x41f15c=_0x29f1b8;_0x38031d=0xc8;}else{_0x38031d=0xce;}_0x36c04c['status'](_0x38031d);return _0x36c04c[_0x124d('0x20')](_0x124d('0x21'),_0x3c6657+'-'+_0x41f15c+'/'+_0x29f1b8)[_0x124d('0x1c')](_0x3457e4);}return null;};}function patchUpdates(_0x28f12c){return function(_0x433c9f){try{jsonpatch[_0x124d('0x22')](_0x433c9f,_0x28f12c,!![]);}catch(_0x12e004){return BPromise[_0x124d('0x23')](_0x12e004);}return _0x433c9f[_0x124d('0x24')]();};}function saveUpdates(_0x1a3cd7,_0x2efe7e){return function(_0x18668b){if(_0x18668b){return _0x18668b[_0x124d('0x25')](_0x1a3cd7)[_0x124d('0x26')](function(_0x239e76){return _0x239e76;});}return null;};}function removeEntity(_0x18f009,_0x48db73){return function(_0x12a771){if(_0x12a771){return _0x12a771[_0x124d('0x27')]()[_0x124d('0x26')](function(){_0x18f009[_0x124d('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x686609,_0x3a960c){return function(_0x442e08){if(!_0x442e08){_0x686609['sendStatus'](0x194);}return _0x442e08;};}function handleError(_0x30d6ae,_0x15bad3){_0x15bad3=_0x15bad3||0x1f4;return function(_0x355619){logger[_0x124d('0x29')](_0x355619['stack']);if(_0x355619[_0x124d('0x2a')]){delete _0x355619[_0x124d('0x2a')];}_0x30d6ae['status'](_0x15bad3)[_0x124d('0x2b')](_0x355619);};}exports[_0x124d('0x2c')]=function(_0x34ad6b,_0x49439f){var _0x49d90f={},_0x4a8d34={},_0x58167c={'count':0x0,'rows':[]};var _0x69b8db=_[_0x124d('0x2d')](db['UserProfile'][_0x124d('0x2e')],function(_0x1f2867){return{'name':_0x1f2867['fieldName'],'type':_0x1f2867['type'][_0x124d('0x2f')]};});_0x4a8d34['model']=_[_0x124d('0x2d')](_0x69b8db,'name');_0x4a8d34[_0x124d('0x30')]=_[_0x124d('0x31')](_0x34ad6b['query']);_0x4a8d34[_0x124d('0x32')]=_[_0x124d('0x33')](_0x4a8d34[_0x124d('0x34')],_0x4a8d34[_0x124d('0x30')]);_0x49d90f['attributes']=_[_0x124d('0x33')](_0x4a8d34[_0x124d('0x34')],qs[_0x124d('0x35')](_0x34ad6b[_0x124d('0x30')][_0x124d('0x35')]));_0x49d90f[_0x124d('0x36')]=_0x49d90f[_0x124d('0x36')][_0x124d('0x37')]?_0x49d90f[_0x124d('0x36')]:_0x4a8d34[_0x124d('0x34')];if(!_0x34ad6b[_0x124d('0x30')][_0x124d('0x38')](_0x124d('0x39'))){_0x49d90f['limit']=qs['limit'](_0x34ad6b[_0x124d('0x30')][_0x124d('0x1f')]);_0x49d90f[_0x124d('0x1e')]=qs[_0x124d('0x1e')](_0x34ad6b[_0x124d('0x30')][_0x124d('0x1e')]);}_0x49d90f[_0x124d('0x3a')]=qs[_0x124d('0x3b')](_0x34ad6b[_0x124d('0x30')]['sort']);_0x49d90f[_0x124d('0x3c')]=qs[_0x124d('0x32')](_[_0x124d('0x3d')](_0x34ad6b['query'],_0x4a8d34[_0x124d('0x32')]),_0x69b8db);if(_0x34ad6b[_0x124d('0x30')][_0x124d('0x3e')]){_0x49d90f[_0x124d('0x3c')]=_[_0x124d('0x3f')](_0x49d90f[_0x124d('0x3c')],{'$or':_[_0x124d('0x2d')](_0x69b8db,function(_0x33a3a3){if(_0x33a3a3[_0x124d('0x40')]!==_0x124d('0x41')){var _0x1731ce={};_0x1731ce[_0x33a3a3[_0x124d('0x2a')]]={'$like':'%'+_0x34ad6b[_0x124d('0x30')][_0x124d('0x3e')]+'%'};return _0x1731ce;}})});}_0x49d90f=_['merge']({},_0x49d90f,_0x34ad6b[_0x124d('0x42')]);var _0x2f4d6d={'where':_0x49d90f['where']};return db[_0x124d('0x43')][_0x124d('0x1d')](_0x2f4d6d)[_0x124d('0x26')](function(_0x41becf){_0x58167c[_0x124d('0x1d')]=_0x41becf;if(_0x34ad6b['query'][_0x124d('0x44')]){_0x49d90f[_0x124d('0x45')]=[{'all':!![]}];}return db[_0x124d('0x43')][_0x124d('0x46')](_0x49d90f);})['then'](function(_0x4d5e3a){_0x58167c[_0x124d('0x47')]=_0x4d5e3a;return _0x58167c;})[_0x124d('0x26')](respondWithFilteredResult(_0x49439f,_0x49d90f))[_0x124d('0x48')](handleError(_0x49439f,null));};exports[_0x124d('0x49')]=function(_0x3e0ba4,_0x4135db){var _0x309544={'raw':![],'where':{'id':_0x3e0ba4[_0x124d('0x4a')]['id']}},_0x419ede={};_0x419ede[_0x124d('0x34')]=_[_0x124d('0x31')](db[_0x124d('0x43')]['rawAttributes']);_0x419ede[_0x124d('0x30')]=_[_0x124d('0x31')](_0x3e0ba4['query']);_0x419ede['filters']=_[_0x124d('0x33')](_0x419ede['model'],_0x419ede['query']);_0x309544['attributes']=_[_0x124d('0x33')](_0x419ede[_0x124d('0x34')],qs['fields'](_0x3e0ba4[_0x124d('0x30')]['fields']));_0x309544[_0x124d('0x36')]=_0x309544['attributes'][_0x124d('0x37')]?_0x309544['attributes']:_0x419ede[_0x124d('0x34')];if(_0x3e0ba4[_0x124d('0x30')]['includeAll']){_0x309544['include']=[{'all':!![]}];}_0x309544=_[_0x124d('0x3f')]({},_0x309544,_0x3e0ba4[_0x124d('0x42')]);return db[_0x124d('0x43')][_0x124d('0x4b')](_0x309544)[_0x124d('0x26')](handleEntityNotFound(_0x4135db,null))[_0x124d('0x26')](respondWithResult(_0x4135db,null))['catch'](handleError(_0x4135db,null));};exports['create']=function(_0x25963a,_0x24e77f){return db['UserProfile'][_0x124d('0x4c')](_0x25963a[_0x124d('0x4d')],{})['then'](respondWithResult(_0x24e77f,0xc9))['catch'](handleError(_0x24e77f,null));};exports[_0x124d('0x4e')]=function(_0x310fa4,_0x3ed2df){var _0x39f9ab={'where':{'id':_0x310fa4[_0x124d('0x4a')]['id']}},_0xb270ab={};_0xb270ab[_0x124d('0x34')]=_[_0x124d('0x31')](db[_0x124d('0x43')]['rawAttributes']);_0x39f9ab[_0x124d('0x36')]=_[_0x124d('0x33')](_0xb270ab[_0x124d('0x34')],qs[_0x124d('0x35')](_0x310fa4[_0x124d('0x30')][_0x124d('0x35')]));_0x39f9ab[_0x124d('0x36')]=_0x39f9ab[_0x124d('0x36')][_0x124d('0x37')]?_0x39f9ab[_0x124d('0x36')]:_0xb270ab[_0x124d('0x34')];if(_0x310fa4[_0x124d('0x30')][_0x124d('0x44')]){_0x39f9ab[_0x124d('0x45')]=[{'all':!![]}];}_0x39f9ab=_[_0x124d('0x3f')]({},_0x39f9ab,_0x310fa4[_0x124d('0x42')]);return db[_0x124d('0x43')][_0x124d('0x4b')](_0x39f9ab)[_0x124d('0x26')](handleEntityNotFound(_0x3ed2df,null))[_0x124d('0x26')](function(_0x59c164){if(_0x59c164){var _0xd12c29=_0x59c164[_0x124d('0x4f')]({'plain':!![]});_0xd12c29=qs['omit'](_0xd12c29,['id',_0x124d('0x50'),_0x124d('0x51'),_0x124d('0x52')]);_0x310fa4['body']=_[_0x124d('0x53')](_0x310fa4['body'],['id',_0x124d('0x50'),_0x124d('0x51')]);return db[_0x124d('0x54')][_0x124d('0x55')](function(_0x2beff7){return db[_0x124d('0x43')][_0x124d('0x4c')](_[_0x124d('0x3f')](_0xd12c29,_0x310fa4[_0x124d('0x4d')]),{'include':_0x310fa4[_0x124d('0x30')][_0x124d('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x2beff7})[_0x124d('0x26')](function(_0x219d00){var _0x2bb5a9=_0x219d00['get']({'plain':!![]});return db[_0x124d('0x56')][_0x124d('0x46')]({'where':{'userProfileId':_0x310fa4[_0x124d('0x4a')]['id']},'raw':!![]})[_0x124d('0x26')](function(_0x589331){if(_0x589331){return BPromise[_0x124d('0x57')](_0x589331,function(_0x120194){return new BPromise(function(_0x459c74,_0x4a20e9){if(_0x120194[_0x124d('0x58')]===null||_0x120194[_0x124d('0x58')]===0x1)_0x459c74(null);return db[_0x124d('0x59')][_0x124d('0x46')]({'where':{'sectionId':_0x120194['id']},'raw':!![]})[_0x124d('0x26')](function(_0x259f79){var _0x119cc3=_[_0x124d('0x2d')](_0x259f79,function(_0x4ad385){return qs[_0x124d('0x53')](_0x4ad385,['id',_0x124d('0x50'),'updatedAt',_0x124d('0x5a')]);});_0x459c74(_0x119cc3);})[_0x124d('0x48')](function(_0x33e16d){_0x4a20e9(_0x33e16d);});})[_0x124d('0x26')](function(_0x5bff4e){var _0x403b3c=qs['omit'](_0x120194,['id',_0x124d('0x50'),_0x124d('0x51')]);_0x403b3c[_0x124d('0x5b')]=_0x2bb5a9['id'];if(_0x5bff4e)_0x403b3c['Resources']=_0x5bff4e;return _0x403b3c;})[_0x124d('0x26')](function(_0x4db01b){return db['UserProfileSection'][_0x124d('0x4c')](_0x4db01b,{'include':[{'model':db[_0x124d('0x59')],'as':_0x124d('0x5c')}],'raw':!![],'transaction':_0x2beff7});});})[_0x124d('0x26')](function(){return _0x2bb5a9;});}});});});}})[_0x124d('0x26')](respondWithResult(_0x3ed2df,0xc9))[_0x124d('0x48')](handleError(_0x3ed2df,null));};exports[_0x124d('0x25')]=function(_0x1ef243,_0x27c906){if(_0x1ef243[_0x124d('0x4d')]['id']){delete _0x1ef243[_0x124d('0x4d')]['id'];}return db[_0x124d('0x43')]['find']({'where':{'id':_0x1ef243[_0x124d('0x4a')]['id']}})[_0x124d('0x26')](handleEntityNotFound(_0x27c906,null))[_0x124d('0x26')](saveUpdates(_0x1ef243[_0x124d('0x4d')],null))[_0x124d('0x26')](respondWithResult(_0x27c906,null))[_0x124d('0x48')](handleError(_0x27c906,null));};exports[_0x124d('0x27')]=function(_0x26fd43,_0xc54c13){return db[_0x124d('0x43')][_0x124d('0x4b')]({'where':{'id':_0x26fd43[_0x124d('0x4a')]['id']}})['then'](handleEntityNotFound(_0xc54c13,null))[_0x124d('0x26')](removeEntity(_0xc54c13,null))[_0x124d('0x48')](handleError(_0xc54c13,null));};exports[_0x124d('0x5d')]=function(_0x3e0958,_0x3f7479){return db[_0x124d('0x43')][_0x124d('0x5d')]()[_0x124d('0x26')](respondWithResult(_0x3f7479,null))[_0x124d('0x48')](handleError(_0x3f7479,null));};exports['addSections']=function(_0x470d1b,_0x48c74b){var _0x566f36=_0x470d1b[_0x124d('0x4d')];return db['UserProfile']['find']({'where':{'id':_0x470d1b[_0x124d('0x4a')]['id']}})[_0x124d('0x26')](handleEntityNotFound(_0x48c74b,null))['then'](function(_0xba9584){if(_0xba9584){return db[_0x124d('0x54')][_0x124d('0x55')](function(_0x47b8d9){return db['UserProfileSection'][_0x124d('0x27')]({'where':{'userProfileId':_0x470d1b[_0x124d('0x4a')]['id'],'sectionId':_[_0x124d('0x2d')](_0x566f36,function(_0x36a612){return _0x36a612['sectionId'];})},'transaction':_0x47b8d9})[_0x124d('0x26')](function(){var _0x32ac51=_[_0x124d('0x2d')](_0x566f36,function(_0x3de672){_0x3de672[_0x124d('0x5b')]=_0x470d1b[_0x124d('0x4a')]['id'];return _0x3de672;});var _0xe959a5=[];return BPromise['each'](_0x32ac51,function(_0x38f8f5){return db['UserProfileSection'][_0x124d('0x4c')](_0x38f8f5,{'include':[{'model':db['UserProfileResource'],'as':_0x124d('0x5c')}],'raw':!![],'transaction':_0x47b8d9})[_0x124d('0x26')](function(_0x1f42b6){_0xe959a5[_0x124d('0x5e')](_0x1f42b6[_0x124d('0x4f')]({'plain':!![]}));});})[_0x124d('0x26')](function(){return _0xe959a5;});});});}})[_0x124d('0x26')](function(_0x4defd7){return _0x4defd7;})[_0x124d('0x26')](respondWithResult(_0x48c74b,null))[_0x124d('0x48')](handleError(_0x48c74b,null));};exports[_0x124d('0x5f')]=function(_0x81ba04,_0x2b8e4c){var _0x1c4827;return db[_0x124d('0x43')][_0x124d('0x4b')]({'where':{'id':_0x81ba04[_0x124d('0x4a')]['id']},'attributes':['id',_0x124d('0x2a')]})['then'](handleEntityNotFound(_0x2b8e4c,null))[_0x124d('0x26')](function(_0x1cd765){if(_0x1cd765){_0x1c4827=_0x1cd765;return db['UserProfileSection'][_0x124d('0x27')]({'where':{'userProfileId':_0x81ba04[_0x124d('0x4a')]['id'],'sectionId':_0x81ba04[_0x124d('0x30')][_0x124d('0x60')]}});}})[_0x124d('0x26')](function(){return _0x1c4827;})['then'](respondWithStatusCode(_0x2b8e4c,null))[_0x124d('0x48')](handleError(_0x2b8e4c,null));};exports[_0x124d('0x61')]=function(_0x2c9d76,_0x573ef8){var _0x4709c4=[];var _0xb489aa=[];return db[_0x124d('0x56')][_0x124d('0x46')]({'where':{'userProfileId':_0x2c9d76['params']['id']},'raw':!![]})[_0x124d('0x26')](function(_0x221e53){_0x4709c4=_[_0x124d('0x3e')](_0x221e53,function(_0x239137){return _0x239137['enabled']===0x1||_[_0x124d('0x62')]([0x3eb,0x709],_0x239137['sectionId']);});if(!_['isEmpty'](_0x4709c4)){return _[_0x124d('0x2d')](_0x4709c4,function(_0x5b8efc){return _0x5b8efc[_0x124d('0x5a')];});}else{return;}})[_0x124d('0x26')](function(_0x492012){if(_0x492012)_0xb489aa=_0x492012;if(_[_0x124d('0x62')](_0xb489aa,0x64)){var _0xf1dfeb=_[_0x124d('0x4b')](_0x4709c4,{'sectionId':0x64});return hasDefaultDashboard(_0xf1dfeb)[_0x124d('0x26')](function(_0x39bb05){return _['map'](_0x4709c4,function(_0x3218ff){if(_0x3218ff['sectionId']===0x64){_0x3218ff['subsections']=_0x39bb05;}return _0x3218ff;});});}else{return;}})[_0x124d('0x26')](function(_0x564a0c){if(_0x564a0c)_0x4709c4=_0x564a0c;if(_[_0x124d('0x62')](_0xb489aa,0x3eb)){var _0x472530=_['find'](_0x4709c4,{'sectionId':0x3eb});return getCustomDashboards(_0x472530)[_0x124d('0x26')](function(_0x211bf8){return _['map'](_0x4709c4,function(_0x35259a){if(_0x472530['enabled']){if(_0x35259a[_0x124d('0x5a')]===0x3eb){_0x35259a[_0x124d('0x63')]=_0x211bf8;}}else{if(_0x35259a[_0x124d('0x5a')]===0x64){_0x35259a[_0x124d('0x63')]=_0x211bf8;}}return _0x35259a;});});}else{return;}})[_0x124d('0x26')](function(_0x199a32){if(_0x199a32)_0x4709c4=_0x199a32;if(_[_0x124d('0x62')](_0xb489aa,0x709)){var _0x11cbab=_[_0x124d('0x4b')](_0x4709c4,{'sectionId':0x709});return getPlugins(_0x11cbab)[_0x124d('0x26')](function(_0x304c5e){if(_0x11cbab[_0x124d('0x64')]){return _['map'](_0x4709c4,function(_0x41648a){if(_0x41648a[_0x124d('0x5a')]===0x709){_0x41648a[_0x124d('0x63')]=_0x304c5e;}return _0x41648a;});}else{var _0x51bb1a={'sectionId':0x76c,'enabled':0x1,'subsections':_0x304c5e};var _0x348ca6=_[_0x124d('0x2d')](_0x4709c4);_0x348ca6[_0x124d('0x5e')](_0x51bb1a);return _0x348ca6;}});}else{return;}})[_0x124d('0x26')](function(_0xc3f8ab){if(_0xc3f8ab)_0x4709c4=_0xc3f8ab;return _[_0x124d('0x3e')](_0x4709c4,[_0x124d('0x64'),0x1]);})['then'](respondWithResult(_0x573ef8,null))[_0x124d('0x48')](handleError(_0x573ef8,null));};function hasDefaultDashboard(_0x37031e){var _0x1c9230=[0x65];return new BPromise(function(_0x915e42,_0x346316){try{if(_0x37031e[_0x124d('0x58')]){_0x915e42(_0x1c9230);}else{return db['UserProfileResource'][_0x124d('0x65')]({'where':{'sectionId':_0x37031e['id']},'raw':!![]})[_0x124d('0x26')](function(_0x527eb1){_0x527eb1?_0x915e42(_0x1c9230):_0x915e42();});}}catch(_0x467ce2){_0x346316(_0x467ce2);}});}function getCustomDashboards(_0x4233ab){var _0x1ff962=[];return new BPromise(function(_0x34f653,_0x488568){try{if(_0x4233ab[_0x124d('0x58')]){return db[_0x124d('0x66')][_0x124d('0x46')]({'raw':!![]})[_0x124d('0x26')](function(_0x4ad3e5){_0x4ad3e5[_0x124d('0x67')](function(_0xe8868c){_0x1ff962[_0x124d('0x5e')](_0xe8868c['id']+0x1869f);});_0x34f653(_0x1ff962);});}else{return db[_0x124d('0x59')][_0x124d('0x46')]({'where':{'sectionId':_0x4233ab['id']},'raw':!![]})['then'](function(_0x473a10){_0x473a10[_0x124d('0x67')](function(_0x3c80d9){_0x1ff962['push'](_0x3c80d9[_0x124d('0x68')]+0x1869f);});_0x34f653(_0x1ff962);});}}catch(_0x1782ef){_0x488568(_0x1782ef);}});}function getPlugins(_0x2d0fc6){var _0x1a5291=[];return new BPromise(function(_0x5d9ff5,_0x5e1b8f){try{if(_0x2d0fc6[_0x124d('0x58')]){return db[_0x124d('0x69')][_0x124d('0x46')]({'raw':!![]})[_0x124d('0x26')](function(_0x30b75e){_0x30b75e[_0x124d('0x67')](function(_0x50312a){_0x1a5291[_0x124d('0x5e')](_0x50312a['id']+0x15b38);});_0x5d9ff5(_0x1a5291);});}else{return db[_0x124d('0x59')][_0x124d('0x46')]({'where':{'sectionId':_0x2d0fc6['id']},'raw':!![]})[_0x124d('0x26')](function(_0x35fb18){_0x35fb18[_0x124d('0x67')](function(_0x442fe6){_0x1a5291[_0x124d('0x5e')](_0x442fe6[_0x124d('0x68')]+0x15b38);});_0x5d9ff5(_0x1a5291);});}}catch(_0x56763f){_0x5e1b8f(_0x56763f);}});}exports[_0x124d('0x6a')]=function(_0xfe9bce,_0x33315f){return db[_0x124d('0x43')][_0x124d('0x4b')]({'where':{'id':_0xfe9bce[_0x124d('0x4a')]['id']}})[_0x124d('0x26')](handleEntityNotFound(_0x33315f,null))[_0x124d('0x26')](function(_0xc5f0b6){if(_0xc5f0b6){return db['sequelize'][_0x124d('0x55')](function(_0x1ab78d){return db[_0x124d('0x56')][_0x124d('0x46')]({'where':{'userProfileId':_0xfe9bce[_0x124d('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0x124d('0x26')](function(_0x4f977c){if(_0x4f977c){return db[_0x124d('0x56')][_0x124d('0x27')]({'where':{'userProfileId':_0xfe9bce[_0x124d('0x4a')]['id'],'id':_[_0x124d('0x2d')](_0x4f977c,function(_0x186fde){return _0x186fde['id'];})},'transaction':_0x1ab78d});}})[_0x124d('0x26')](function(_0x4aaa69){var _0x16ebd0=_[_0x124d('0x2d')](_0xfe9bce[_0x124d('0x4d')],function(_0x2cf63e){_0x2cf63e[_0x124d('0x5b')]=_0xfe9bce['params']['id'];return _0x2cf63e;});return db[_0x124d('0x56')][_0x124d('0x6b')](_0x16ebd0,{'raw':!![],'transaction':_0x1ab78d});})[_0x124d('0x26')](function(_0x3787a2){var _0x47ef06=_[_0x124d('0x3e')](_[_0x124d('0x2d')](_0x3787a2,function(_0x1bf362){return _0x1bf362[_0x124d('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x47ef06){return db['UserProfileSection'][_0x124d('0x46')]({'where':{'userProfileId':_0xfe9bce[_0x124d('0x4a')]['id'],'sectionId':_['map'](_0x47ef06,function(_0x3430e4){return _0x3430e4[_0x124d('0x5a')];})},'attributes':['id',_0x124d('0x5a')],'raw':!![]})['then'](function(_0x429ca8){var _0x1a0eec=_[_0x124d('0x2d')](_0xfe9bce[_0x124d('0x4d')],function(_0x1f05e5){_0x1f05e5[_0x124d('0x5b')]=_0xfe9bce[_0x124d('0x4a')]['id'];return _0x1f05e5;});return db[_0x124d('0x59')]['bulkCreate'](_0x1a0eec,{'raw':!![],'transaction':_0x1ab78d});});}})[_0x124d('0x48')](handleError(_0x33315f,null));});}})[_0x124d('0x26')](function(_0x1091dd){var _0x45c555=_[_0x124d('0x2d')](_0x1091dd,function(_0x4f057a){return _0x4f057a[_0x124d('0x4f')]({'plain':!![]});});})[_0x124d('0x26')](respondWithResult(_0x33315f,null))[_0x124d('0x48')](handleError(_0x33315f,null));};exports[_0x124d('0x6c')]=function(_0x376940,_0x280f41,_0x392581){return db[_0x124d('0x43')][_0x124d('0x4b')]({'where':{'id':_0x376940[_0x124d('0x4a')]['id']}})[_0x124d('0x26')](handleEntityNotFound(_0x280f41,null))[_0x124d('0x26')](function(_0x24efe6){if(_0x24efe6){return _0x24efe6['removeResources'](_0x376940[_0x124d('0x30')][_0x124d('0x60')]);}})[_0x124d('0x26')](respondWithStatusCode(_0x280f41,null))[_0x124d('0x48')](handleError(_0x280f41,null));};exports['getResources']=function(_0x5f0bd6,_0x45f4c4){var _0x20cee1={'raw':![],'where':{}};var _0x29be8d={};var _0x19a82b={'count':0x0,'rows':[]};var _0x46afb3=_0x5f0bd6['query']['section'];if(typeof _0x46afb3===_0x124d('0x6d')){throw new db['Sequelize']['ValidationError']('Unknown\x20section');}var _0x35e156=_0x5f0bd6[_0x124d('0x30')][_0x124d('0x6e')]||![];var _0x3a3997=getQueryModels(_0x46afb3,_0x35e156);if(typeof _0x3a3997[_0x124d('0x6f')]===_0x124d('0x6d')){throw new db['Sequelize']['ValidationError'](_0x124d('0x70')+_0x46afb3+'\x27');}var _0x3629e9=[];if(!_[_0x124d('0x71')](_0x3a3997[_0x124d('0x72')])){_0x3629e9=_0x3a3997[_0x124d('0x72')];}else{_0x3629e9=[{'name':_0x46afb3}];}return db[_0x124d('0x43')][_0x124d('0x65')]({'where':{'id':_0x5f0bd6[_0x124d('0x4a')]['id']}})[_0x124d('0x26')](handleEntityNotFound(_0x45f4c4,null))['then'](function(_0x4c6620){if(_0x4c6620){var _0x33bd1a=[];for(var _0x9633c3=0x0;_0x9633c3<_0x3629e9['length'];_0x9633c3++){_0x33bd1a[_0x124d('0x5e')](db['UserProfileSection'][_0x124d('0x65')]({'where':{'userProfileId':_0x4c6620['id'],'name':_0x3629e9[_0x9633c3]['name']},'raw':!![]}));}return BPromise[_0x124d('0x73')](_0x33bd1a);}})[_0x124d('0x26')](function(_0x502e21){var _0x5115a8=_['filter'](_0x502e21,function(_0x28dc0b){return _0x28dc0b?_0x28dc0b:undefined;});var _0x1d755d=_[_0x124d('0x3e')](_0x3629e9,[_0x124d('0x74'),!![]]);var _0x352582=_[_0x124d('0x71')](_0x5115a8)&&_[_0x124d('0x71')](_0x1d755d)?null:_[_0x124d('0x75')](_0x1d755d,_0x5115a8);if(_0x352582){var _0x4cd7ef=[];for(var _0x5e05c1=0x0;_0x5e05c1<_0x352582[_0x124d('0x37')];_0x5e05c1++){var _0x3ac7f3=_[_0x124d('0x4b')](_0x3629e9,function(_0x40d679){return _0x352582[_0x5e05c1]?_0x40d679['name']===_0x352582[_0x5e05c1][_0x124d('0x2a')]:null;});if(_0x3ac7f3){if(_0x352582[_0x5e05c1]['ignore']){_0x4cd7ef[_0x124d('0x5e')](getAllResources(_0x3a3997[_0x124d('0x6f')],_0x352582[_0x5e05c1]));}else{if(!_0x352582[_0x5e05c1][_0x124d('0x58')]){_0x4cd7ef['push'](getAllowedResources(_0x3ac7f3,_0x352582[_0x5e05c1],_0x3a3997[_0x124d('0x6f')]));}else{if(_0x3ac7f3[_0x124d('0x34')]){_0x4cd7ef[_0x124d('0x5e')](getAllFilteredResources(_0x3ac7f3,_0x352582[_0x5e05c1]));}}}}}return BPromise[_0x124d('0x73')](_0x4cd7ef);}else{return null;}})[_0x124d('0x26')](function(_0x49d5b2){var _0x1e2c86=_0x49d5b2;var _0x1ca067=null;if(_0x1e2c86){_0x1ca067=_0x1e2c86['length']===0x1?_0x1e2c86[0x0]:null;}if(_0x1ca067||_0x1e2c86){var _0x434a3f=db[_0x3a3997[_0x124d('0x6f')]]['rawAttributes'];_0x29be8d['model']=_[_0x124d('0x31')](_0x434a3f);_0x29be8d['query']=_[_0x124d('0x31')](_0x5f0bd6[_0x124d('0x30')]);_0x29be8d[_0x124d('0x32')]=_[_0x124d('0x33')](_0x29be8d[_0x124d('0x34')],_0x29be8d[_0x124d('0x30')]);_0x20cee1[_0x124d('0x36')]=_[_0x124d('0x33')](_0x29be8d[_0x124d('0x34')],qs['fields'](_0x5f0bd6['query'][_0x124d('0x35')]));_0x20cee1['attributes']=_0x20cee1['attributes'][_0x124d('0x37')]?_0x20cee1[_0x124d('0x36')]:_0x29be8d[_0x124d('0x34')];if(!_0x5f0bd6[_0x124d('0x30')][_0x124d('0x38')](_0x124d('0x39'))){_0x20cee1[_0x124d('0x1f')]=qs[_0x124d('0x1f')](_0x5f0bd6['query'][_0x124d('0x1f')]);_0x20cee1[_0x124d('0x1e')]=qs[_0x124d('0x1e')](_0x5f0bd6[_0x124d('0x30')][_0x124d('0x1e')]);}_0x20cee1[_0x124d('0x3a')]=qs[_0x124d('0x3b')](_0x5f0bd6[_0x124d('0x30')]['sort']);_0x20cee1['where']=qs[_0x124d('0x32')](_[_0x124d('0x3d')](_0x5f0bd6['query'],_0x29be8d[_0x124d('0x32')]));if(_0x5f0bd6[_0x124d('0x30')][_0x124d('0x3e')]){_0x20cee1[_0x124d('0x3c')]=_[_0x124d('0x3f')](_0x20cee1[_0x124d('0x3c')],{'$or':_[_0x124d('0x2d')](_0x434a3f,function(_0x289801){if(_0x289801[_0x124d('0x40')][_0x124d('0x2f')]!==_0x124d('0x41')){var _0x15bd7d={};_0x15bd7d[_0x289801[_0x124d('0x76')]]={'$like':'%'+_0x5f0bd6[_0x124d('0x30')][_0x124d('0x3e')]+'%'};return _0x15bd7d;}})});}var _0x4247d2=[];if(_0x1ca067){var _0x4b7e05=_[_0x124d('0x4b')](_0x3629e9,['name',_0x1ca067[_0x124d('0x2a')]]);if(_0x4b7e05['field']){var _0x2cd0f9={};if(_0x3a3997['childModel']===_0x124d('0x77')){_0x2cd0f9[_0x4b7e05[_0x124d('0x78')]]=_[_0x124d('0x2d')](_0x1ca067[_0x124d('0x79')],'id');}else{_0x2cd0f9[_0x4b7e05[_0x124d('0x78')]]=_0x1ca067[_0x124d('0x79')];}_0x4247d2[_0x124d('0x5e')](_0x2cd0f9);}else{_0x20cee1[_0x124d('0x3c')]['id']=_0x1ca067[_0x124d('0x79')];}}else{for(var _0x25f672=0x0;_0x25f672<_0x1e2c86[_0x124d('0x37')];_0x25f672++){var _0x4b7e05=_[_0x124d('0x4b')](_0x3629e9,['name',_0x1e2c86[_0x25f672][_0x124d('0x2a')]]);if(_0x4b7e05[_0x124d('0x76')]){var _0x2cd0f9={};_0x2cd0f9[_0x4b7e05[_0x124d('0x78')]]=_0x1e2c86[_0x25f672][_0x124d('0x79')];_0x4247d2[_0x124d('0x5e')](_0x2cd0f9);}else{if(!_0x20cee1['where']['id'])_0x20cee1[_0x124d('0x3c')]['id']=[];_0x1e2c86[_0x25f672][_0x124d('0x79')][_0x124d('0x67')](function(_0x505e18){_0x20cee1[_0x124d('0x3c')]['id'][_0x124d('0x5e')](_0x505e18);});}}}if(!_['isEmpty'](_0x4247d2)){_0x20cee1['where']=_[_0x124d('0x3f')](_0x20cee1[_0x124d('0x3c')],{'$and':{'$or':_0x4247d2}});}_0x20cee1=_['merge']({},_0x20cee1,_0x5f0bd6[_0x124d('0x42')]);if(_0x1ca067&&!_0x1ca067['autoAssociation']&&_0x3a3997[_0x124d('0x6f')]===_0x124d('0x77')){if(_0x5f0bd6[_0x124d('0x30')][_0x124d('0x44')]){_0x20cee1[_0x124d('0x45')]=[{'all':!![]}];}return db[_0x3a3997['childModel']]['findAll'](_0x20cee1)[_0x124d('0x26')](function(_0x13229b){var _0x225143=[];_0x13229b['forEach'](function(_0x43755d){var _0x26ae80;switch(_0x43755d['reportType']){case _0x124d('0x7a'):_0x26ae80=_[_0x124d('0x4b')](_0x1ca067[_0x124d('0x79')],function(_0x503335){return _0x503335['id']===_0x43755d['reportId']&&_0x503335[_0x124d('0x40')]===_0x124d('0x7b');});break;case _0x124d('0x7c'):_0x26ae80=_['find'](_0x1ca067[_0x124d('0x79')],function(_0x12c97b){return _0x12c97b['id']===_0x43755d[_0x124d('0x7d')]&&_0x12c97b[_0x124d('0x40')]===_0x124d('0x7e');});break;}if(_0x26ae80)_0x225143[_0x124d('0x5e')](_0x43755d);});_0x19a82b['count']=_0x225143['length'];_0x19a82b[_0x124d('0x47')]=_0x225143;return _0x19a82b;});}else{return db[_0x3a3997[_0x124d('0x6f')]]['count']({'where':_0x20cee1['where']})[_0x124d('0x26')](function(_0x4141c6){_0x19a82b[_0x124d('0x1d')]=_0x4141c6;if(_0x5f0bd6['query'][_0x124d('0x44')]){if(_0x3a3997['childModel']===_0x124d('0x7f')){_0x20cee1[_0x124d('0x45')]=[{'model':db[_0x124d('0x80')],'as':_0x124d('0x81'),'attributes':['id',_0x124d('0x2a'),_0x124d('0x82')],'required':_0x5f0bd6['query'][_0x124d('0x83')]?!![]:![]},{'model':db[_0x124d('0x80')],'as':_0x124d('0x84'),'attributes':['id',_0x124d('0x2a'),_0x124d('0x82')],'through':_0x5f0bd6[_0x124d('0x30')][_0x124d('0x83')]?{'attributes':[],'where':{'TagId':_0x5f0bd6[_0x124d('0x30')][_0x124d('0x83')]||undefined}}:{},'required':_0x5f0bd6[_0x124d('0x30')][_0x124d('0x83')]?!![]:![]}];}else{_0x20cee1[_0x124d('0x45')]=[{'all':!![]}];}}return db[_0x3a3997['childModel']][_0x124d('0x46')](_0x20cee1);})[_0x124d('0x26')](function(_0x35be84){_0x19a82b[_0x124d('0x47')]=_0x35be84;return _0x19a82b;});}}else{return _0x19a82b;}})['then'](respondWithFilteredResult(_0x45f4c4,_0x20cee1))[_0x124d('0x48')](handleError(_0x45f4c4,null));};function getAllResources(_0x4987da,_0x3d47c3){return new BPromise(function(_0x2bcd1e,_0x52afc6){if(_0x3d47c3){var _0x417017=_0x3d47c3['filter']?{[_0x3d47c3[_0x124d('0x3e')][_0x124d('0x76')]]:_0x3d47c3[_0x124d('0x3e')][_0x124d('0x85')]}:undefined;return db[_0x4987da]['findAll']({'where':_0x417017,'raw':!![]})[_0x124d('0x26')](function(_0x52987b){_0x3d47c3[_0x124d('0x79')]=_['map'](_0x52987b,'id');_0x2bcd1e(_0x3d47c3);})[_0x124d('0x48')](function(_0x2fe076){_0x52afc6(_0x2fe076);});}else{_0x2bcd1e(null);}});}function getAllFilteredResources(_0x55cad3,_0x13d592){return new BPromise(function(_0x38ff38,_0x2a2ade){var _0x5e3664=_0x55cad3['filter']?{[_0x55cad3[_0x124d('0x3e')][_0x124d('0x76')]]:_0x55cad3[_0x124d('0x3e')]['value']}:undefined;return db[_0x55cad3['model']]['findAll']({'where':_0x5e3664,'raw':!![]})['then'](function(_0x1f7f32){_0x13d592[_0x124d('0x79')]=_[_0x124d('0x2d')](_0x1f7f32,function(_0xc8fde){return _0xc8fde['name'];});_0x38ff38(_0x13d592);})[_0x124d('0x48')](function(_0x29b1f1){_0x2a2ade(_0x29b1f1);});});}function getAllowedResources(_0x352347,_0x49130c,_0x37f462){return new BPromise(function(_0x104dd5,_0x12c25d){if(_0x49130c){return db[_0x124d('0x59')]['findAll']({'where':{'sectionId':_0x49130c['id']},'raw':!![]})['then'](function(_0x1cce44){if(_0x352347[_0x124d('0x76')]&&_0x352347['field']!=='id'){_0x49130c[_0x124d('0x79')]=_[_0x124d('0x2d')](_0x1cce44,function(_0x479ffe){return _0x479ffe[_0x352347['field']];});}else{if(_0x37f462===_0x124d('0x77')){_0x49130c['associatedResources']=_['map'](_0x1cce44,function(_0x4f8208){return{'id':_0x4f8208['resourceId'],'type':_0x4f8208[_0x124d('0x40')]};});}else{_0x49130c['associatedResources']=_[_0x124d('0x2d')](_0x1cce44,function(_0xb43c5c){return _0xb43c5c['resourceId'];});}}_0x104dd5(_0x49130c);})[_0x124d('0x48')](function(_0xe9fb78){_0x12c25d(_0xe9fb78);});}else{_0x104dd5(null);}});}function getQueryModels(_0x4997e4,_0x1ae6d1){var _0x92961b=_0x4997e4[_0x124d('0x86')]();var _0x2656b1={'childModel':undefined,'parentSections':[]};switch(_0x92961b){case _0x124d('0x87'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0x88');break;case _0x124d('0x89'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0x8a');break;case _0x124d('0x8b'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0x8c');_0x2656b1[_0x124d('0x72')]=[{'name':_0x124d('0x8d'),'field':_0x124d('0x2a'),'foreignKey':_0x124d('0x8e')}];break;case _0x124d('0x8f'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0x90');break;case _0x124d('0x91'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0x7f');_0x2656b1[_0x124d('0x72')]=[{'name':_0x124d('0x92'),'field':'id','foreignKey':_0x124d('0x93')}];break;case _0x124d('0x94'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0x95');break;case'companies':_0x2656b1[_0x124d('0x6f')]=_0x124d('0x96');break;case _0x124d('0x97'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0x98');break;case _0x124d('0x99'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0x9a');break;case _0x124d('0x9b'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0x9c');break;case _0x124d('0x9d'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0x9e');break;case _0x124d('0x9f'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0xa0');break;case'inboundroutes':case _0x124d('0xa1'):case _0x124d('0xa2'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0xa3');break;case'contexts':_0x2656b1[_0x124d('0x6f')]=_0x124d('0xa4');break;case _0x124d('0xa5'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0xa6');break;case'voicerecordings':_0x2656b1['childModel']='VoiceRecording';_0x2656b1['parentSections']=[{'name':_0x124d('0xa7'),'field':_0x124d('0x2a'),'foreignKey':_0x124d('0xa8'),'model':_0x124d('0xa9'),'filter':{'field':_0x124d('0xaa'),'value':['agent']}},{'name':_0x124d('0xab'),'field':_0x124d('0x2a'),'foreignKey':'membername','model':'User','filter':{'field':_0x124d('0xaa'),'value':[_0x124d('0xac')]}},{'name':_0x124d('0xad'),'field':_0x124d('0x2a'),'foreignKey':'queue','model':_0x124d('0xae'),'filter':{'field':_0x124d('0x40'),'value':[_0x124d('0xaf')]}},{'name':_0x124d('0xb0'),'field':_0x124d('0x2a'),'foreignKey':_0x124d('0xb1'),'model':_0x124d('0xae'),'filter':{'field':_0x124d('0x40'),'value':[_0x124d('0xb2')]}}];break;case'musiconholds':_0x2656b1[_0x124d('0x6f')]=_0x124d('0xb3');break;case _0x124d('0xb4'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0xb5');break;case'voiceprefixes':_0x2656b1[_0x124d('0x6f')]=_0x124d('0xb6');break;case'ivrcampaigns':_0x2656b1[_0x124d('0x6f')]=_0x124d('0xb7');break;case _0x124d('0xb8'):_0x2656b1['childModel']=_0x124d('0xb9');break;case'mailaccounts':_0x2656b1[_0x124d('0x6f')]=_0x124d('0xba');break;case _0x124d('0xbb'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0xbc');break;case _0x124d('0xbd'):_0x2656b1['childModel']=_0x124d('0xbe');break;case'openchannelaccounts':_0x2656b1[_0x124d('0x6f')]=_0x124d('0xbf');break;case _0x124d('0xc0'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0xc1');break;case _0x124d('0xc2'):_0x2656b1[_0x124d('0x6f')]='SmsAccount';break;case _0x124d('0xc3'):_0x2656b1['childModel']=_0x124d('0xc4');break;case'whatsappaccounts':_0x2656b1[_0x124d('0x6f')]=_0x124d('0xc5');break;case _0x124d('0xc6'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0xc7');break;case _0x124d('0xc8'):case _0x124d('0xc9'):_0x2656b1['childModel']=_0x124d('0xae');if(_0x1ae6d1){_0x2656b1['parentSections']=[{'name':_0x124d('0xad')},{'name':_0x124d('0xb0')}];}break;case _0x124d('0xca'):case _0x124d('0xcb'):case _0x124d('0xcc'):_0x2656b1['childModel']=_0x124d('0xa9');if(_0x1ae6d1){_0x2656b1[_0x124d('0x72')]=[{'name':_0x124d('0xcd'),'filter':{'field':_0x124d('0xaa'),'value':['admin',_0x124d('0xce')]},'ignore':!![]},{'name':_0x124d('0xa7')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x2656b1[_0x124d('0x6f')]=_0x124d('0xcf');break;case _0x124d('0xd0'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0xd1');break;case'freshdeskaccounts':_0x2656b1[_0x124d('0x6f')]=_0x124d('0xd2');break;case _0x124d('0xd3'):_0x2656b1['childModel']=_0x124d('0xd4');break;case _0x124d('0xd5'):_0x2656b1['childModel']=_0x124d('0xd6');break;case _0x124d('0xd7'):_0x2656b1['childModel']=_0x124d('0xd8');break;case _0x124d('0xd9'):_0x2656b1['childModel']=_0x124d('0xa9');break;case'cannedanswers':_0x2656b1['childModel']='CannedAnswer';break;case _0x124d('0xda'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0xdb');break;case _0x124d('0xdc'):_0x2656b1['childModel']='Dashboard';break;case _0x124d('0xdd'):_0x2656b1['childModel']=_0x124d('0xde');break;case _0x124d('0xdf'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0xe0');break;case _0x124d('0xe1'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0xe2');break;case'sounds':_0x2656b1['childModel']=_0x124d('0xe3');break;case _0x124d('0xe4'):_0x2656b1[_0x124d('0x6f')]='Tag';break;case _0x124d('0xe5'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0xe6');break;case'triggers':_0x2656b1[_0x124d('0x6f')]=_0x124d('0xe7');break;case _0x124d('0xe8'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0xe9');break;case _0x124d('0xea'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0xeb');break;case _0x124d('0xec'):_0x2656b1[_0x124d('0x6f')]=_0x124d('0x69');break;case _0x124d('0xed'):_0x2656b1[_0x124d('0x6f')]='AnalyticExtractedReport';_0x2656b1[_0x124d('0x72')]=[{'name':_0x124d('0xee'),'field':'id','foreignKey':_0x124d('0x7d')}];break;case _0x124d('0xef'):_0x2656b1['childModel']=_0x124d('0xf0');break;case _0x124d('0xf1'):_0x2656b1[_0x124d('0x6f')]='WhatsappAccount';break;default:return _0x2656b1;}return _0x2656b1;} \ No newline at end of file +var _0xb56b=['fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','UserProfile','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','options','create','body','clone','find','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','get','each','autoAssociation','sectionId','userProfileId','UserProfileSection','UserProfileResource','Resources','destroy','describe','removeSections','ids','enabled','includes','subsections','push','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','Invalid\x20section\x20\x27','isEmpty','parentSections','all','ignore','childModel','field','foreignKey','associatedResources','reportType','custom','reportId','CustomReports','CmContact','Tag','color','ThroughTags','tag','value','AnalyticExtractedReport','toLowerCase','squareprojects','SquareProject','odbc','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','companies','CmCompany','ChatWebsite','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','voicerecordings','VoiceRecording','Agents','User','role','agent','Telephones','membername','telephone','VoiceQueue','queue','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','smsqueues','SmsAccount','whatsappqueues','WhatsappQueue','teams','voicequeues','queuecampaigns','VoiceQueues','QueueCampaigns','users','agents','telephones','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','templates','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','metrics','AnalyticMetric','whatsappaccounts','WhatsappAccount','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs'];(function(_0x4a6992,_0x15fed3){var _0x5cbaee=function(_0x40e075){while(--_0x40e075){_0x4a6992['push'](_0x4a6992['shift']());}};_0x5cbaee(++_0x15fed3);}(_0xb56b,0xdc));var _0xbb56=function(_0x5b406e,_0xcd06bc){_0x5b406e=_0x5b406e-0x0;var _0xe7d242=_0xb56b[_0x5b406e];return _0xe7d242;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbb56('0x0'));var jsonpatch=require(_0xbb56('0x1'));var rp=require(_0xbb56('0x2'));var moment=require(_0xbb56('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbb56('0x4'));var util=require(_0xbb56('0x5'));var path=require('path');var sox=require(_0xbb56('0x6'));var csv=require(_0xbb56('0x7'));var ejs=require(_0xbb56('0x8'));var fs=require('fs');var fs_extra=require(_0xbb56('0x9'));var _=require(_0xbb56('0xa'));var squel=require(_0xbb56('0xb'));var crypto=require(_0xbb56('0xc'));var jsforce=require(_0xbb56('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbb56('0xe'));var Papa=require(_0xbb56('0xf'));var Redis=require('ioredis');var authService=require(_0xbb56('0x10'));var qs=require(_0xbb56('0x11'));var as=require(_0xbb56('0x12'));var hardwareService=require(_0xbb56('0x13'));var logger=require('../../config/logger')(_0xbb56('0x14'));var utils=require(_0xbb56('0x15'));var config=require(_0xbb56('0x16'));var licenseUtil=require(_0xbb56('0x17'));var db=require(_0xbb56('0x18'))['db'];config['redis']=_[_0xbb56('0x19')](config[_0xbb56('0x1a')],{'host':_0xbb56('0x1b'),'port':0x18eb});var socket=require(_0xbb56('0x1c'))(new Redis(config[_0xbb56('0x1a')]));require('./userProfile.socket')[_0xbb56('0x1d')](socket);function respondWithStatusCode(_0x25088f,_0x2cd5b4){_0x2cd5b4=_0x2cd5b4||0xcc;return function(_0x39489d){if(_0x39489d){return _0x25088f[_0xbb56('0x1e')](_0x2cd5b4);}return _0x25088f[_0xbb56('0x1f')](_0x2cd5b4)['end']();};}function respondWithResult(_0x2ec6b6,_0x4d5ac4){_0x4d5ac4=_0x4d5ac4||0xc8;return function(_0x185532){if(_0x185532){return _0x2ec6b6[_0xbb56('0x1f')](_0x4d5ac4)[_0xbb56('0x20')](_0x185532);}};}function respondWithFilteredResult(_0x516e9b,_0x141cfa){return function(_0x2e9af0){if(_0x2e9af0){var _0x2900f6=_0x2e9af0[_0xbb56('0x21')],_0x4a44b3=_0x141cfa['offset'],_0x50d68a=_0x141cfa[_0xbb56('0x22')]+_0x141cfa[_0xbb56('0x23')],_0x733fc3;if(_0x50d68a>=_0x2900f6){_0x50d68a=_0x2900f6;_0x733fc3=0xc8;}else{_0x733fc3=0xce;}_0x516e9b[_0xbb56('0x1f')](_0x733fc3);return _0x516e9b['set'](_0xbb56('0x24'),_0x4a44b3+'-'+_0x50d68a+'/'+_0x2900f6)[_0xbb56('0x20')](_0x2e9af0);}return null;};}function patchUpdates(_0x503ad6){return function(_0x38831e){try{jsonpatch[_0xbb56('0x25')](_0x38831e,_0x503ad6,!![]);}catch(_0x2b4503){return BPromise[_0xbb56('0x26')](_0x2b4503);}return _0x38831e[_0xbb56('0x27')]();};}function saveUpdates(_0x1e473d,_0x168aef){return function(_0x1df1db){if(_0x1df1db){return _0x1df1db[_0xbb56('0x28')](_0x1e473d)[_0xbb56('0x29')](function(_0x3dc286){return _0x3dc286;});}return null;};}function removeEntity(_0x5ab8ae,_0x2c946a){return function(_0x2f93e4){if(_0x2f93e4){return _0x2f93e4['destroy']()[_0xbb56('0x29')](function(){_0x5ab8ae['status'](0xcc)[_0xbb56('0x2a')]();});}};}function handleEntityNotFound(_0x99d6c6,_0x5aa644){return function(_0x201f28){if(!_0x201f28){_0x99d6c6[_0xbb56('0x1e')](0x194);}return _0x201f28;};}function handleError(_0x22d0fa,_0x12ba98){_0x12ba98=_0x12ba98||0x1f4;return function(_0x4a9f8d){logger[_0xbb56('0x2b')](_0x4a9f8d[_0xbb56('0x2c')]);if(_0x4a9f8d['name']){delete _0x4a9f8d[_0xbb56('0x2d')];}_0x22d0fa[_0xbb56('0x1f')](_0x12ba98)[_0xbb56('0x2e')](_0x4a9f8d);};}exports[_0xbb56('0x2f')]=function(_0x1475b2,_0x331399){var _0xbabafe={},_0x522488={},_0x13a8a9={'count':0x0,'rows':[]};var _0x3cdd68=_['map'](db[_0xbb56('0x30')]['rawAttributes'],function(_0x35976d){return{'name':_0x35976d['fieldName'],'type':_0x35976d['type'][_0xbb56('0x31')]};});_0x522488[_0xbb56('0x32')]=_[_0xbb56('0x33')](_0x3cdd68,_0xbb56('0x2d'));_0x522488[_0xbb56('0x34')]=_[_0xbb56('0x35')](_0x1475b2['query']);_0x522488['filters']=_[_0xbb56('0x36')](_0x522488['model'],_0x522488[_0xbb56('0x34')]);_0xbabafe[_0xbb56('0x37')]=_[_0xbb56('0x36')](_0x522488[_0xbb56('0x32')],qs[_0xbb56('0x38')](_0x1475b2[_0xbb56('0x34')][_0xbb56('0x38')]));_0xbabafe[_0xbb56('0x37')]=_0xbabafe['attributes']['length']?_0xbabafe[_0xbb56('0x37')]:_0x522488[_0xbb56('0x32')];if(!_0x1475b2[_0xbb56('0x34')][_0xbb56('0x39')](_0xbb56('0x3a'))){_0xbabafe[_0xbb56('0x23')]=qs[_0xbb56('0x23')](_0x1475b2['query'][_0xbb56('0x23')]);_0xbabafe['offset']=qs[_0xbb56('0x22')](_0x1475b2['query']['offset']);}_0xbabafe[_0xbb56('0x3b')]=qs['sort'](_0x1475b2[_0xbb56('0x34')][_0xbb56('0x3c')]);_0xbabafe[_0xbb56('0x3d')]=qs[_0xbb56('0x3e')](_[_0xbb56('0x3f')](_0x1475b2[_0xbb56('0x34')],_0x522488[_0xbb56('0x3e')]),_0x3cdd68);if(_0x1475b2[_0xbb56('0x34')]['filter']){_0xbabafe[_0xbb56('0x3d')]=_[_0xbb56('0x40')](_0xbabafe[_0xbb56('0x3d')],{'$or':_['map'](_0x3cdd68,function(_0x154915){if(_0x154915[_0xbb56('0x41')]!==_0xbb56('0x42')){var _0x5b4890={};_0x5b4890[_0x154915[_0xbb56('0x2d')]]={'$like':'%'+_0x1475b2[_0xbb56('0x34')][_0xbb56('0x43')]+'%'};return _0x5b4890;}})});}_0xbabafe=_[_0xbb56('0x40')]({},_0xbabafe,_0x1475b2['options']);var _0x37f4cd={'where':_0xbabafe[_0xbb56('0x3d')]};return db[_0xbb56('0x30')][_0xbb56('0x21')](_0x37f4cd)['then'](function(_0x505a00){_0x13a8a9[_0xbb56('0x21')]=_0x505a00;if(_0x1475b2[_0xbb56('0x34')][_0xbb56('0x44')]){_0xbabafe['include']=[{'all':!![]}];}return db[_0xbb56('0x30')][_0xbb56('0x45')](_0xbabafe);})['then'](function(_0x5ed856){_0x13a8a9[_0xbb56('0x46')]=_0x5ed856;return _0x13a8a9;})[_0xbb56('0x29')](respondWithFilteredResult(_0x331399,_0xbabafe))[_0xbb56('0x47')](handleError(_0x331399,null));};exports[_0xbb56('0x48')]=function(_0x25096d,_0x40b481){var _0x30ddd7={'raw':![],'where':{'id':_0x25096d[_0xbb56('0x49')]['id']}},_0x36c8db={};_0x36c8db['model']=_['keys'](db[_0xbb56('0x30')][_0xbb56('0x4a')]);_0x36c8db[_0xbb56('0x34')]=_[_0xbb56('0x35')](_0x25096d[_0xbb56('0x34')]);_0x36c8db[_0xbb56('0x3e')]=_[_0xbb56('0x36')](_0x36c8db['model'],_0x36c8db['query']);_0x30ddd7[_0xbb56('0x37')]=_[_0xbb56('0x36')](_0x36c8db[_0xbb56('0x32')],qs[_0xbb56('0x38')](_0x25096d['query'][_0xbb56('0x38')]));_0x30ddd7[_0xbb56('0x37')]=_0x30ddd7[_0xbb56('0x37')][_0xbb56('0x4b')]?_0x30ddd7[_0xbb56('0x37')]:_0x36c8db[_0xbb56('0x32')];if(_0x25096d[_0xbb56('0x34')]['includeAll']){_0x30ddd7[_0xbb56('0x4c')]=[{'all':!![]}];}_0x30ddd7=_[_0xbb56('0x40')]({},_0x30ddd7,_0x25096d[_0xbb56('0x4d')]);return db[_0xbb56('0x30')]['find'](_0x30ddd7)[_0xbb56('0x29')](handleEntityNotFound(_0x40b481,null))[_0xbb56('0x29')](respondWithResult(_0x40b481,null))[_0xbb56('0x47')](handleError(_0x40b481,null));};exports[_0xbb56('0x4e')]=function(_0x39aef7,_0x106657){return db[_0xbb56('0x30')]['create'](_0x39aef7[_0xbb56('0x4f')],{})[_0xbb56('0x29')](respondWithResult(_0x106657,0xc9))['catch'](handleError(_0x106657,null));};exports[_0xbb56('0x50')]=function(_0x4bab81,_0x54350a){var _0x364044={'where':{'id':_0x4bab81[_0xbb56('0x49')]['id']}},_0x418be1={};_0x418be1['model']=_[_0xbb56('0x35')](db['UserProfile'][_0xbb56('0x4a')]);_0x364044[_0xbb56('0x37')]=_[_0xbb56('0x36')](_0x418be1[_0xbb56('0x32')],qs['fields'](_0x4bab81['query'][_0xbb56('0x38')]));_0x364044[_0xbb56('0x37')]=_0x364044[_0xbb56('0x37')][_0xbb56('0x4b')]?_0x364044['attributes']:_0x418be1[_0xbb56('0x32')];if(_0x4bab81[_0xbb56('0x34')][_0xbb56('0x44')]){_0x364044[_0xbb56('0x4c')]=[{'all':!![]}];}_0x364044=_[_0xbb56('0x40')]({},_0x364044,_0x4bab81[_0xbb56('0x4d')]);return db[_0xbb56('0x30')][_0xbb56('0x51')](_0x364044)[_0xbb56('0x29')](handleEntityNotFound(_0x54350a,null))[_0xbb56('0x29')](function(_0x360517){if(_0x360517){var _0x1e8deb=_0x360517['get']({'plain':!![]});_0x1e8deb=qs[_0xbb56('0x52')](_0x1e8deb,['id','createdAt',_0xbb56('0x53'),_0xbb56('0x54')]);_0x4bab81['body']=_['omit'](_0x4bab81[_0xbb56('0x4f')],['id',_0xbb56('0x55'),'updatedAt']);return db[_0xbb56('0x56')][_0xbb56('0x57')](function(_0x141e1f){return db[_0xbb56('0x30')][_0xbb56('0x4e')](_[_0xbb56('0x40')](_0x1e8deb,_0x4bab81[_0xbb56('0x4f')]),{'include':_0x4bab81[_0xbb56('0x34')][_0xbb56('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x141e1f})[_0xbb56('0x29')](function(_0x41f95d){var _0x6ead20=_0x41f95d[_0xbb56('0x58')]({'plain':!![]});return db['UserProfileSection'][_0xbb56('0x45')]({'where':{'userProfileId':_0x4bab81[_0xbb56('0x49')]['id']},'raw':!![]})[_0xbb56('0x29')](function(_0x24b872){if(_0x24b872){return BPromise[_0xbb56('0x59')](_0x24b872,function(_0x1e776d){return new BPromise(function(_0x2fd2e2,_0x1eae79){if(_0x1e776d[_0xbb56('0x5a')]===null||_0x1e776d[_0xbb56('0x5a')]===0x1)_0x2fd2e2(null);return db['UserProfileResource'][_0xbb56('0x45')]({'where':{'sectionId':_0x1e776d['id']},'raw':!![]})['then'](function(_0xeea962){var _0x4662cd=_[_0xbb56('0x33')](_0xeea962,function(_0x6ae4c1){return qs[_0xbb56('0x52')](_0x6ae4c1,['id',_0xbb56('0x55'),_0xbb56('0x53'),_0xbb56('0x5b')]);});_0x2fd2e2(_0x4662cd);})[_0xbb56('0x47')](function(_0x4949d3){_0x1eae79(_0x4949d3);});})[_0xbb56('0x29')](function(_0x1b9dc3){var _0x5a2efb=qs[_0xbb56('0x52')](_0x1e776d,['id',_0xbb56('0x55'),_0xbb56('0x53')]);_0x5a2efb[_0xbb56('0x5c')]=_0x6ead20['id'];if(_0x1b9dc3)_0x5a2efb['Resources']=_0x1b9dc3;return _0x5a2efb;})[_0xbb56('0x29')](function(_0x1d2a48){return db[_0xbb56('0x5d')][_0xbb56('0x4e')](_0x1d2a48,{'include':[{'model':db[_0xbb56('0x5e')],'as':_0xbb56('0x5f')}],'raw':!![],'transaction':_0x141e1f});});})[_0xbb56('0x29')](function(){return _0x6ead20;});}});});});}})[_0xbb56('0x29')](respondWithResult(_0x54350a,0xc9))[_0xbb56('0x47')](handleError(_0x54350a,null));};exports['update']=function(_0x4162b2,_0x2c3c41){if(_0x4162b2[_0xbb56('0x4f')]['id']){delete _0x4162b2['body']['id'];}return db[_0xbb56('0x30')][_0xbb56('0x51')]({'where':{'id':_0x4162b2['params']['id']}})[_0xbb56('0x29')](handleEntityNotFound(_0x2c3c41,null))['then'](saveUpdates(_0x4162b2[_0xbb56('0x4f')],null))[_0xbb56('0x29')](respondWithResult(_0x2c3c41,null))['catch'](handleError(_0x2c3c41,null));};exports[_0xbb56('0x60')]=function(_0x1ae955,_0x2dd378){return db[_0xbb56('0x30')]['find']({'where':{'id':_0x1ae955[_0xbb56('0x49')]['id']}})['then'](handleEntityNotFound(_0x2dd378,null))[_0xbb56('0x29')](removeEntity(_0x2dd378,null))[_0xbb56('0x47')](handleError(_0x2dd378,null));};exports['describe']=function(_0xffd69,_0xf6f7b6){return db[_0xbb56('0x30')][_0xbb56('0x61')]()['then'](respondWithResult(_0xf6f7b6,null))[_0xbb56('0x47')](handleError(_0xf6f7b6,null));};exports['addSections']=function(_0x451526,_0x2b29cd){var _0x31716d=_0x451526[_0xbb56('0x4f')];return db[_0xbb56('0x30')][_0xbb56('0x51')]({'where':{'id':_0x451526[_0xbb56('0x49')]['id']}})[_0xbb56('0x29')](handleEntityNotFound(_0x2b29cd,null))[_0xbb56('0x29')](function(_0x34ecdc){if(_0x34ecdc){return db[_0xbb56('0x56')]['transaction'](function(_0x2f71a7){return db[_0xbb56('0x5d')][_0xbb56('0x60')]({'where':{'userProfileId':_0x451526['params']['id'],'sectionId':_['map'](_0x31716d,function(_0x31748b){return _0x31748b[_0xbb56('0x5b')];})},'transaction':_0x2f71a7})[_0xbb56('0x29')](function(){var _0x3c4420=_[_0xbb56('0x33')](_0x31716d,function(_0x1c6c30){_0x1c6c30[_0xbb56('0x5c')]=_0x451526[_0xbb56('0x49')]['id'];return _0x1c6c30;});var _0x4e1de1=[];return BPromise[_0xbb56('0x59')](_0x3c4420,function(_0x232223){return db[_0xbb56('0x5d')][_0xbb56('0x4e')](_0x232223,{'include':[{'model':db['UserProfileResource'],'as':_0xbb56('0x5f')}],'raw':!![],'transaction':_0x2f71a7})[_0xbb56('0x29')](function(_0x3bddf4){_0x4e1de1['push'](_0x3bddf4['get']({'plain':!![]}));});})[_0xbb56('0x29')](function(){return _0x4e1de1;});});});}})['then'](function(_0x3e89d6){return _0x3e89d6;})[_0xbb56('0x29')](respondWithResult(_0x2b29cd,null))['catch'](handleError(_0x2b29cd,null));};exports[_0xbb56('0x62')]=function(_0x52f77c,_0x38ac46){var _0x6c3357;return db[_0xbb56('0x30')][_0xbb56('0x51')]({'where':{'id':_0x52f77c[_0xbb56('0x49')]['id']},'attributes':['id',_0xbb56('0x2d')]})['then'](handleEntityNotFound(_0x38ac46,null))[_0xbb56('0x29')](function(_0x345f12){if(_0x345f12){_0x6c3357=_0x345f12;return db[_0xbb56('0x5d')][_0xbb56('0x60')]({'where':{'userProfileId':_0x52f77c[_0xbb56('0x49')]['id'],'sectionId':_0x52f77c[_0xbb56('0x34')][_0xbb56('0x63')]}});}})[_0xbb56('0x29')](function(){return _0x6c3357;})[_0xbb56('0x29')](respondWithStatusCode(_0x38ac46,null))[_0xbb56('0x47')](handleError(_0x38ac46,null));};exports['getSections']=function(_0x5e1587,_0x29aa55){var _0x31f2b0=[];var _0x5a78b6=[];return db[_0xbb56('0x5d')][_0xbb56('0x45')]({'where':{'userProfileId':_0x5e1587['params']['id']},'raw':!![]})[_0xbb56('0x29')](function(_0x278001){_0x31f2b0=_[_0xbb56('0x43')](_0x278001,function(_0x25d09b){return _0x25d09b[_0xbb56('0x64')]===0x1||_[_0xbb56('0x65')]([0x3eb,0x709],_0x25d09b['sectionId']);});if(!_['isEmpty'](_0x31f2b0)){return _[_0xbb56('0x33')](_0x31f2b0,function(_0x28d7ef){return _0x28d7ef[_0xbb56('0x5b')];});}else{return;}})['then'](function(_0x4e6cf3){if(_0x4e6cf3)_0x5a78b6=_0x4e6cf3;if(_[_0xbb56('0x65')](_0x5a78b6,0x64)){var _0x4348f9=_[_0xbb56('0x51')](_0x31f2b0,{'sectionId':0x64});return hasDefaultDashboard(_0x4348f9)[_0xbb56('0x29')](function(_0x3166d4){return _[_0xbb56('0x33')](_0x31f2b0,function(_0xc46e04){if(_0xc46e04[_0xbb56('0x5b')]===0x64){_0xc46e04[_0xbb56('0x66')]=_0x3166d4;}return _0xc46e04;});});}else{return;}})[_0xbb56('0x29')](function(_0x1806a4){if(_0x1806a4)_0x31f2b0=_0x1806a4;if(_[_0xbb56('0x65')](_0x5a78b6,0x3eb)){var _0x4342a9=_[_0xbb56('0x51')](_0x31f2b0,{'sectionId':0x3eb});return getCustomDashboards(_0x4342a9)['then'](function(_0xaf8778){return _[_0xbb56('0x33')](_0x31f2b0,function(_0x48d275){if(_0x4342a9[_0xbb56('0x64')]){if(_0x48d275[_0xbb56('0x5b')]===0x3eb){_0x48d275[_0xbb56('0x66')]=_0xaf8778;}}else{if(_0x48d275['sectionId']===0x64){_0x48d275[_0xbb56('0x66')]=_0xaf8778;}}return _0x48d275;});});}else{return;}})[_0xbb56('0x29')](function(_0x59ceee){if(_0x59ceee)_0x31f2b0=_0x59ceee;if(_[_0xbb56('0x65')](_0x5a78b6,0x709)){var _0x3e5371=_[_0xbb56('0x51')](_0x31f2b0,{'sectionId':0x709});return getPlugins(_0x3e5371)['then'](function(_0x3c1585){if(_0x3e5371[_0xbb56('0x64')]){return _['map'](_0x31f2b0,function(_0x155253){if(_0x155253[_0xbb56('0x5b')]===0x709){_0x155253[_0xbb56('0x66')]=_0x3c1585;}return _0x155253;});}else{var _0x547afe={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3c1585};var _0x2f4cbd=_[_0xbb56('0x33')](_0x31f2b0);_0x2f4cbd[_0xbb56('0x67')](_0x547afe);return _0x2f4cbd;}});}else{return;}})[_0xbb56('0x29')](function(_0x2ea3c2){if(_0x2ea3c2)_0x31f2b0=_0x2ea3c2;return _[_0xbb56('0x43')](_0x31f2b0,[_0xbb56('0x64'),0x1]);})[_0xbb56('0x29')](respondWithResult(_0x29aa55,null))['catch'](handleError(_0x29aa55,null));};function hasDefaultDashboard(_0xc17164){var _0xa009f5=[0x65];return new BPromise(function(_0xc585d2,_0xf5456d){try{if(_0xc17164['autoAssociation']){_0xc585d2(_0xa009f5);}else{return db[_0xbb56('0x5e')][_0xbb56('0x68')]({'where':{'sectionId':_0xc17164['id']},'raw':!![]})[_0xbb56('0x29')](function(_0x233737){_0x233737?_0xc585d2(_0xa009f5):_0xc585d2();});}}catch(_0x211c76){_0xf5456d(_0x211c76);}});}function getCustomDashboards(_0x124539){var _0x2ff727=[];return new BPromise(function(_0x45799a,_0x404d6d){try{if(_0x124539[_0xbb56('0x5a')]){return db['Dashboard'][_0xbb56('0x45')]({'raw':!![]})[_0xbb56('0x29')](function(_0x1f307f){_0x1f307f[_0xbb56('0x69')](function(_0x6afb63){_0x2ff727[_0xbb56('0x67')](_0x6afb63['id']+0x1869f);});_0x45799a(_0x2ff727);});}else{return db[_0xbb56('0x5e')][_0xbb56('0x45')]({'where':{'sectionId':_0x124539['id']},'raw':!![]})[_0xbb56('0x29')](function(_0x288f7e){_0x288f7e['forEach'](function(_0x1460cf){_0x2ff727[_0xbb56('0x67')](_0x1460cf[_0xbb56('0x6a')]+0x1869f);});_0x45799a(_0x2ff727);});}}catch(_0x4f14c8){_0x404d6d(_0x4f14c8);}});}function getPlugins(_0x37bced){var _0x459e16=[];return new BPromise(function(_0x38d076,_0x1f9600){try{if(_0x37bced['autoAssociation']){return db[_0xbb56('0x6b')][_0xbb56('0x45')]({'raw':!![]})[_0xbb56('0x29')](function(_0x5184b3){_0x5184b3[_0xbb56('0x69')](function(_0x1dc80c){_0x459e16['push'](_0x1dc80c['id']+0x15b38);});_0x38d076(_0x459e16);});}else{return db['UserProfileResource'][_0xbb56('0x45')]({'where':{'sectionId':_0x37bced['id']},'raw':!![]})[_0xbb56('0x29')](function(_0x48242f){_0x48242f['forEach'](function(_0x1e1b0e){_0x459e16[_0xbb56('0x67')](_0x1e1b0e[_0xbb56('0x6a')]+0x15b38);});_0x38d076(_0x459e16);});}}catch(_0x4bc3e7){_0x1f9600(_0x4bc3e7);}});}exports[_0xbb56('0x6c')]=function(_0x4e5392,_0x3cf2c3){return db[_0xbb56('0x30')][_0xbb56('0x51')]({'where':{'id':_0x4e5392[_0xbb56('0x49')]['id']}})['then'](handleEntityNotFound(_0x3cf2c3,null))[_0xbb56('0x29')](function(_0x3fe477){if(_0x3fe477){return db[_0xbb56('0x56')]['transaction'](function(_0x4ddab2){return db[_0xbb56('0x5d')]['findAll']({'where':{'userProfileId':_0x4e5392[_0xbb56('0x49')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x107946){if(_0x107946){return db[_0xbb56('0x5d')]['destroy']({'where':{'userProfileId':_0x4e5392[_0xbb56('0x49')]['id'],'id':_[_0xbb56('0x33')](_0x107946,function(_0x3bc011){return _0x3bc011['id'];})},'transaction':_0x4ddab2});}})[_0xbb56('0x29')](function(_0x5a0ff8){var _0x5672ac=_[_0xbb56('0x33')](_0x4e5392[_0xbb56('0x4f')],function(_0xbfbc92){_0xbfbc92[_0xbb56('0x5c')]=_0x4e5392[_0xbb56('0x49')]['id'];return _0xbfbc92;});return db[_0xbb56('0x5d')][_0xbb56('0x6d')](_0x5672ac,{'raw':!![],'transaction':_0x4ddab2});})['then'](function(_0x11fc4c){var _0x210d71=_[_0xbb56('0x43')](_[_0xbb56('0x33')](_0x11fc4c,function(_0x404788){return _0x404788[_0xbb56('0x58')]({'plain':!![]});}),{'includeAll':![]});if(_0x210d71){return db[_0xbb56('0x5d')][_0xbb56('0x45')]({'where':{'userProfileId':_0x4e5392[_0xbb56('0x49')]['id'],'sectionId':_[_0xbb56('0x33')](_0x210d71,function(_0x113f22){return _0x113f22['sectionId'];})},'attributes':['id',_0xbb56('0x5b')],'raw':!![]})['then'](function(_0x212eca){var _0x4dcab7=_['map'](_0x4e5392[_0xbb56('0x4f')],function(_0x28ef3b){_0x28ef3b[_0xbb56('0x5c')]=_0x4e5392[_0xbb56('0x49')]['id'];return _0x28ef3b;});return db[_0xbb56('0x5e')][_0xbb56('0x6d')](_0x4dcab7,{'raw':!![],'transaction':_0x4ddab2});});}})[_0xbb56('0x47')](handleError(_0x3cf2c3,null));});}})[_0xbb56('0x29')](function(_0x2758a4){var _0x1fa251=_[_0xbb56('0x33')](_0x2758a4,function(_0x31fcdd){return _0x31fcdd[_0xbb56('0x58')]({'plain':!![]});});})[_0xbb56('0x29')](respondWithResult(_0x3cf2c3,null))[_0xbb56('0x47')](handleError(_0x3cf2c3,null));};exports[_0xbb56('0x6e')]=function(_0x1a6b89,_0x260794,_0x36d784){return db['UserProfile'][_0xbb56('0x51')]({'where':{'id':_0x1a6b89[_0xbb56('0x49')]['id']}})['then'](handleEntityNotFound(_0x260794,null))[_0xbb56('0x29')](function(_0x219d66){if(_0x219d66){return _0x219d66[_0xbb56('0x6e')](_0x1a6b89[_0xbb56('0x34')]['ids']);}})[_0xbb56('0x29')](respondWithStatusCode(_0x260794,null))['catch'](handleError(_0x260794,null));};exports[_0xbb56('0x6f')]=function(_0x36b0c0,_0x2befdd){var _0x5dc89f={'raw':![],'where':{}};var _0x38d8ea={};var _0x390489={'count':0x0,'rows':[]};var _0xba5538=_0x36b0c0[_0xbb56('0x34')][_0xbb56('0x70')];if(typeof _0xba5538===_0xbb56('0x71')){throw new db[(_0xbb56('0x72'))][(_0xbb56('0x73'))](_0xbb56('0x74'));}var _0x2853a5=_0x36b0c0['query'][_0xbb56('0x75')]||![];var _0x117304=getQueryModels(_0xba5538,_0x2853a5);if(typeof _0x117304['childModel']==='undefined'){throw new db['Sequelize'][(_0xbb56('0x73'))](_0xbb56('0x76')+_0xba5538+'\x27');}var _0x2b4df9=[];if(!_[_0xbb56('0x77')](_0x117304['parentSections'])){_0x2b4df9=_0x117304[_0xbb56('0x78')];}else{_0x2b4df9=[{'name':_0xba5538}];}return db[_0xbb56('0x30')][_0xbb56('0x68')]({'where':{'id':_0x36b0c0[_0xbb56('0x49')]['id']}})[_0xbb56('0x29')](handleEntityNotFound(_0x2befdd,null))[_0xbb56('0x29')](function(_0xdbf937){if(_0xdbf937){var _0x5531d5=[];for(var _0x1a89d6=0x0;_0x1a89d6<_0x2b4df9['length'];_0x1a89d6++){_0x5531d5[_0xbb56('0x67')](db[_0xbb56('0x5d')][_0xbb56('0x68')]({'where':{'userProfileId':_0xdbf937['id'],'name':_0x2b4df9[_0x1a89d6][_0xbb56('0x2d')]},'raw':!![]}));}return BPromise[_0xbb56('0x79')](_0x5531d5);}})[_0xbb56('0x29')](function(_0x2c30f2){var _0x55bbb5=_['filter'](_0x2c30f2,function(_0x49e0dc){return _0x49e0dc?_0x49e0dc:undefined;});var _0x590225=_[_0xbb56('0x43')](_0x2b4df9,[_0xbb56('0x7a'),!![]]);var _0x3e7bcf=_[_0xbb56('0x77')](_0x55bbb5)&&_[_0xbb56('0x77')](_0x590225)?null:_['union'](_0x590225,_0x55bbb5);if(_0x3e7bcf){var _0x587234=[];for(var _0x142dc9=0x0;_0x142dc9<_0x3e7bcf['length'];_0x142dc9++){var _0x558636=_['find'](_0x2b4df9,function(_0x5cef36){return _0x3e7bcf[_0x142dc9]?_0x5cef36['name']===_0x3e7bcf[_0x142dc9]['name']:null;});if(_0x558636){if(_0x3e7bcf[_0x142dc9][_0xbb56('0x7a')]){_0x587234[_0xbb56('0x67')](getAllResources(_0x117304[_0xbb56('0x7b')],_0x3e7bcf[_0x142dc9]));}else{if(!_0x3e7bcf[_0x142dc9][_0xbb56('0x5a')]){_0x587234[_0xbb56('0x67')](getAllowedResources(_0x558636,_0x3e7bcf[_0x142dc9],_0x117304[_0xbb56('0x7b')]));}else{if(_0x558636['model']){_0x587234[_0xbb56('0x67')](getAllFilteredResources(_0x558636,_0x3e7bcf[_0x142dc9]));}}}}}return BPromise['all'](_0x587234);}else{return null;}})['then'](function(_0x5c9810){var _0x24fbfe=_0x5c9810;var _0x1a0aa5=null;if(_0x24fbfe){_0x1a0aa5=_0x24fbfe[_0xbb56('0x4b')]===0x1?_0x24fbfe[0x0]:null;}if(_0x1a0aa5||_0x24fbfe){var _0x361ae3=db[_0x117304[_0xbb56('0x7b')]][_0xbb56('0x4a')];_0x38d8ea[_0xbb56('0x32')]=_['keys'](_0x361ae3);_0x38d8ea['query']=_[_0xbb56('0x35')](_0x36b0c0[_0xbb56('0x34')]);_0x38d8ea['filters']=_[_0xbb56('0x36')](_0x38d8ea[_0xbb56('0x32')],_0x38d8ea['query']);_0x5dc89f[_0xbb56('0x37')]=_[_0xbb56('0x36')](_0x38d8ea[_0xbb56('0x32')],qs[_0xbb56('0x38')](_0x36b0c0[_0xbb56('0x34')][_0xbb56('0x38')]));_0x5dc89f[_0xbb56('0x37')]=_0x5dc89f[_0xbb56('0x37')][_0xbb56('0x4b')]?_0x5dc89f[_0xbb56('0x37')]:_0x38d8ea[_0xbb56('0x32')];if(!_0x36b0c0[_0xbb56('0x34')][_0xbb56('0x39')](_0xbb56('0x3a'))){_0x5dc89f[_0xbb56('0x23')]=qs[_0xbb56('0x23')](_0x36b0c0[_0xbb56('0x34')]['limit']);_0x5dc89f[_0xbb56('0x22')]=qs['offset'](_0x36b0c0[_0xbb56('0x34')][_0xbb56('0x22')]);}_0x5dc89f[_0xbb56('0x3b')]=qs[_0xbb56('0x3c')](_0x36b0c0[_0xbb56('0x34')]['sort']);_0x5dc89f[_0xbb56('0x3d')]=qs[_0xbb56('0x3e')](_[_0xbb56('0x3f')](_0x36b0c0[_0xbb56('0x34')],_0x38d8ea[_0xbb56('0x3e')]));if(_0x36b0c0[_0xbb56('0x34')][_0xbb56('0x43')]){_0x5dc89f[_0xbb56('0x3d')]=_[_0xbb56('0x40')](_0x5dc89f[_0xbb56('0x3d')],{'$or':_[_0xbb56('0x33')](_0x361ae3,function(_0x2f9fb5){if(_0x2f9fb5[_0xbb56('0x41')][_0xbb56('0x31')]!==_0xbb56('0x42')){var _0x5daf61={};_0x5daf61[_0x2f9fb5[_0xbb56('0x7c')]]={'$like':'%'+_0x36b0c0[_0xbb56('0x34')][_0xbb56('0x43')]+'%'};return _0x5daf61;}})});}var _0x489d10=[];if(_0x1a0aa5){var _0x2d6251=_[_0xbb56('0x51')](_0x2b4df9,[_0xbb56('0x2d'),_0x1a0aa5[_0xbb56('0x2d')]]);if(_0x2d6251[_0xbb56('0x7c')]){var _0x5861bf={};if(_0x117304[_0xbb56('0x7b')]==='AnalyticExtractedReport'){_0x5861bf[_0x2d6251[_0xbb56('0x7d')]]=_['map'](_0x1a0aa5[_0xbb56('0x7e')],'id');}else{_0x5861bf[_0x2d6251[_0xbb56('0x7d')]]=_0x1a0aa5['associatedResources'];}_0x489d10[_0xbb56('0x67')](_0x5861bf);}else{_0x5dc89f['where']['id']=_0x1a0aa5['associatedResources'];}}else{for(var _0x2eceec=0x0;_0x2eceec<_0x24fbfe[_0xbb56('0x4b')];_0x2eceec++){var _0x2d6251=_[_0xbb56('0x51')](_0x2b4df9,[_0xbb56('0x2d'),_0x24fbfe[_0x2eceec][_0xbb56('0x2d')]]);if(_0x2d6251[_0xbb56('0x7c')]){var _0x5861bf={};_0x5861bf[_0x2d6251[_0xbb56('0x7d')]]=_0x24fbfe[_0x2eceec]['associatedResources'];_0x489d10['push'](_0x5861bf);}else{if(!_0x5dc89f[_0xbb56('0x3d')]['id'])_0x5dc89f[_0xbb56('0x3d')]['id']=[];_0x24fbfe[_0x2eceec][_0xbb56('0x7e')][_0xbb56('0x69')](function(_0x5d68b1){_0x5dc89f[_0xbb56('0x3d')]['id'][_0xbb56('0x67')](_0x5d68b1);});}}}if(!_[_0xbb56('0x77')](_0x489d10)){_0x5dc89f[_0xbb56('0x3d')]=_['merge'](_0x5dc89f['where'],{'$and':{'$or':_0x489d10}});}_0x5dc89f=_[_0xbb56('0x40')]({},_0x5dc89f,_0x36b0c0[_0xbb56('0x4d')]);if(_0x1a0aa5&&!_0x1a0aa5[_0xbb56('0x5a')]&&_0x117304['childModel']==='AnalyticExtractedReport'){if(_0x36b0c0[_0xbb56('0x34')]['includeAll']){_0x5dc89f['include']=[{'all':!![]}];}return db[_0x117304['childModel']][_0xbb56('0x45')](_0x5dc89f)[_0xbb56('0x29')](function(_0x2543cf){var _0x30814a=[];_0x2543cf[_0xbb56('0x69')](function(_0x583da0){var _0x5401d0;switch(_0x583da0[_0xbb56('0x7f')]){case'default':_0x5401d0=_[_0xbb56('0x51')](_0x1a0aa5[_0xbb56('0x7e')],function(_0x4dfd0b){return _0x4dfd0b['id']===_0x583da0['reportId']&&_0x4dfd0b['type']==='DefaultReports';});break;case _0xbb56('0x80'):_0x5401d0=_[_0xbb56('0x51')](_0x1a0aa5[_0xbb56('0x7e')],function(_0x142feb){return _0x142feb['id']===_0x583da0[_0xbb56('0x81')]&&_0x142feb[_0xbb56('0x41')]===_0xbb56('0x82');});break;}if(_0x5401d0)_0x30814a[_0xbb56('0x67')](_0x583da0);});_0x390489['count']=_0x30814a[_0xbb56('0x4b')];_0x390489['rows']=_0x30814a;return _0x390489;});}else{return db[_0x117304[_0xbb56('0x7b')]][_0xbb56('0x21')]({'where':_0x5dc89f['where']})[_0xbb56('0x29')](function(_0x2d9953){_0x390489['count']=_0x2d9953;if(_0x36b0c0[_0xbb56('0x34')][_0xbb56('0x44')]){if(_0x117304[_0xbb56('0x7b')]===_0xbb56('0x83')){_0x5dc89f['include']=[{'model':db[_0xbb56('0x84')],'as':'Tags','attributes':['id',_0xbb56('0x2d'),_0xbb56('0x85')],'required':_0x36b0c0[_0xbb56('0x34')]['tag']?!![]:![]},{'model':db['Tag'],'as':_0xbb56('0x86'),'attributes':['id',_0xbb56('0x2d'),_0xbb56('0x85')],'through':_0x36b0c0[_0xbb56('0x34')][_0xbb56('0x87')]?{'attributes':[],'where':{'TagId':_0x36b0c0[_0xbb56('0x34')]['tag']||undefined}}:{},'required':_0x36b0c0[_0xbb56('0x34')][_0xbb56('0x87')]?!![]:![]}];}else{_0x5dc89f[_0xbb56('0x4c')]=[{'all':!![]}];}}return db[_0x117304[_0xbb56('0x7b')]][_0xbb56('0x45')](_0x5dc89f);})[_0xbb56('0x29')](function(_0xb6b446){_0x390489['rows']=_0xb6b446;return _0x390489;});}}else{return _0x390489;}})['then'](respondWithFilteredResult(_0x2befdd,_0x5dc89f))[_0xbb56('0x47')](handleError(_0x2befdd,null));};function getAllResources(_0x28a6b3,_0x4337d9){return new BPromise(function(_0x4cca5f,_0x1ff183){if(_0x4337d9){var _0x33cff3=_0x4337d9[_0xbb56('0x43')]?{[_0x4337d9[_0xbb56('0x43')][_0xbb56('0x7c')]]:_0x4337d9[_0xbb56('0x43')][_0xbb56('0x88')]}:undefined;return db[_0x28a6b3][_0xbb56('0x45')]({'where':_0x33cff3,'raw':!![]})[_0xbb56('0x29')](function(_0x1143a1){_0x4337d9[_0xbb56('0x7e')]=_[_0xbb56('0x33')](_0x1143a1,'id');_0x4cca5f(_0x4337d9);})[_0xbb56('0x47')](function(_0x5af70e){_0x1ff183(_0x5af70e);});}else{_0x4cca5f(null);}});}function getAllFilteredResources(_0x57449e,_0x4a5b64){return new BPromise(function(_0x1328a8,_0x305ca4){var _0x2596b9=_0x57449e[_0xbb56('0x43')]?{[_0x57449e[_0xbb56('0x43')][_0xbb56('0x7c')]]:_0x57449e[_0xbb56('0x43')][_0xbb56('0x88')]}:undefined;return db[_0x57449e[_0xbb56('0x32')]]['findAll']({'where':_0x2596b9,'raw':!![]})[_0xbb56('0x29')](function(_0x382082){_0x4a5b64[_0xbb56('0x7e')]=_['map'](_0x382082,function(_0x38b2a2){return _0x38b2a2['name'];});_0x1328a8(_0x4a5b64);})[_0xbb56('0x47')](function(_0x5eff31){_0x305ca4(_0x5eff31);});});}function getAllowedResources(_0x26cb41,_0x2bf63b,_0x445d53){return new BPromise(function(_0x3e4569,_0x1b5c66){if(_0x2bf63b){return db[_0xbb56('0x5e')][_0xbb56('0x45')]({'where':{'sectionId':_0x2bf63b['id']},'raw':!![]})[_0xbb56('0x29')](function(_0x3ad099){if(_0x26cb41['field']&&_0x26cb41[_0xbb56('0x7c')]!=='id'){_0x2bf63b[_0xbb56('0x7e')]=_[_0xbb56('0x33')](_0x3ad099,function(_0x6ed9cd){return _0x6ed9cd[_0x26cb41[_0xbb56('0x7c')]];});}else{if(_0x445d53===_0xbb56('0x89')){_0x2bf63b[_0xbb56('0x7e')]=_[_0xbb56('0x33')](_0x3ad099,function(_0x54c970){return{'id':_0x54c970[_0xbb56('0x6a')],'type':_0x54c970[_0xbb56('0x41')]};});}else{_0x2bf63b['associatedResources']=_['map'](_0x3ad099,function(_0x4b7fdc){return _0x4b7fdc['resourceId'];});}}_0x3e4569(_0x2bf63b);})[_0xbb56('0x47')](function(_0x398001){_0x1b5c66(_0x398001);});}else{_0x3e4569(null);}});}function getQueryModels(_0x541676,_0x279cfc){var _0x3a6041=_0x541676[_0xbb56('0x8a')]();var _0x58a712={'childModel':undefined,'parentSections':[]};switch(_0x3a6041){case _0xbb56('0x8b'):_0x58a712[_0xbb56('0x7b')]=_0xbb56('0x8c');break;case _0xbb56('0x8d'):_0x58a712['childModel']='SquareOdbc';break;case'squarerecordings':_0x58a712[_0xbb56('0x7b')]=_0xbb56('0x8e');_0x58a712[_0xbb56('0x78')]=[{'name':_0xbb56('0x8f'),'field':'name','foreignKey':_0xbb56('0x90')}];break;case _0xbb56('0x91'):_0x58a712[_0xbb56('0x7b')]=_0xbb56('0x92');break;case _0xbb56('0x93'):_0x58a712['childModel']=_0xbb56('0x83');_0x58a712[_0xbb56('0x78')]=[{'name':_0xbb56('0x94'),'field':'id','foreignKey':_0xbb56('0x95')}];break;case _0xbb56('0x96'):_0x58a712['childModel']='CmList';break;case _0xbb56('0x97'):_0x58a712[_0xbb56('0x7b')]=_0xbb56('0x98');break;case'globalcustomfields':_0x58a712[_0xbb56('0x7b')]='CmCustomField';break;case'chatqueues':_0x58a712[_0xbb56('0x7b')]='ChatQueue';break;case'chatwebsites':_0x58a712[_0xbb56('0x7b')]=_0xbb56('0x99');break;case _0xbb56('0x9a'):_0x58a712['childModel']=_0xbb56('0x9b');break;case _0xbb56('0x9c'):_0x58a712['childModel']='FaxAccount';break;case _0xbb56('0x9d'):case _0xbb56('0x9e'):case _0xbb56('0x9f'):_0x58a712['childModel']=_0xbb56('0xa0');break;case _0xbb56('0xa1'):_0x58a712['childModel']='VoiceContext';break;case'voicemails':_0x58a712[_0xbb56('0x7b')]='VoiceMail';break;case _0xbb56('0xa2'):_0x58a712[_0xbb56('0x7b')]=_0xbb56('0xa3');_0x58a712[_0xbb56('0x78')]=[{'name':_0xbb56('0xa4'),'field':_0xbb56('0x2d'),'foreignKey':'membername','model':_0xbb56('0xa5'),'filter':{'field':_0xbb56('0xa6'),'value':[_0xbb56('0xa7')]}},{'name':_0xbb56('0xa8'),'field':_0xbb56('0x2d'),'foreignKey':_0xbb56('0xa9'),'model':_0xbb56('0xa5'),'filter':{'field':_0xbb56('0xa6'),'value':[_0xbb56('0xaa')]}},{'name':'VoiceQueues','field':_0xbb56('0x2d'),'foreignKey':'queue','model':_0xbb56('0xab'),'filter':{'field':_0xbb56('0x41'),'value':['inbound']}},{'name':'QueueCampaigns','field':_0xbb56('0x2d'),'foreignKey':_0xbb56('0xac'),'model':_0xbb56('0xab'),'filter':{'field':_0xbb56('0x41'),'value':['outbound']}}];break;case'musiconholds':_0x58a712[_0xbb56('0x7b')]='VoiceMusicOnHold';break;case _0xbb56('0xad'):_0x58a712[_0xbb56('0x7b')]=_0xbb56('0xae');break;case _0xbb56('0xaf'):_0x58a712['childModel']=_0xbb56('0xb0');break;case'ivrcampaigns':_0x58a712[_0xbb56('0x7b')]=_0xbb56('0xb1');break;case _0xbb56('0xb2'):_0x58a712[_0xbb56('0x7b')]=_0xbb56('0xb3');break;case'mailaccounts':_0x58a712[_0xbb56('0x7b')]=_0xbb56('0xb4');break;case _0xbb56('0xb5'):_0x58a712[_0xbb56('0x7b')]=_0xbb56('0xb6');break;case _0xbb56('0xb7'):_0x58a712[_0xbb56('0x7b')]='OpenchannelQueue';break;case _0xbb56('0xb8'):_0x58a712[_0xbb56('0x7b')]='OpenchannelAccount';break;case _0xbb56('0xb9'):_0x58a712[_0xbb56('0x7b')]='SmsQueue';break;case'smsaccounts':_0x58a712['childModel']=_0xbb56('0xba');break;case _0xbb56('0xbb'):_0x58a712[_0xbb56('0x7b')]=_0xbb56('0xbc');break;case'whatsappaccounts':_0x58a712[_0xbb56('0x7b')]='WhatsappAccount';break;case _0xbb56('0xbd'):_0x58a712[_0xbb56('0x7b')]='Team';break;case _0xbb56('0xbe'):case _0xbb56('0xbf'):_0x58a712[_0xbb56('0x7b')]='VoiceQueue';if(_0x279cfc){_0x58a712[_0xbb56('0x78')]=[{'name':_0xbb56('0xc0')},{'name':_0xbb56('0xc1')}];}break;case _0xbb56('0xc2'):case _0xbb56('0xc3'):case _0xbb56('0xc4'):_0x58a712[_0xbb56('0x7b')]=_0xbb56('0xa5');if(_0x279cfc){_0x58a712['parentSections']=[{'name':'Users','filter':{'field':_0xbb56('0xa6'),'value':['admin','user']},'ignore':!![]},{'name':'Agents'},{'name':_0xbb56('0xa8')}];}break;case'zendeskaccounts':_0x58a712[_0xbb56('0x7b')]='ZendeskAccount';break;case'salesforceaccounts':_0x58a712[_0xbb56('0x7b')]=_0xbb56('0xc5');break;case _0xbb56('0xc6'):_0x58a712['childModel']=_0xbb56('0xc7');break;case _0xbb56('0xc8'):_0x58a712[_0xbb56('0x7b')]=_0xbb56('0xc9');break;case _0xbb56('0xca'):_0x58a712[_0xbb56('0x7b')]=_0xbb56('0xcb');break;case'zohoaccounts':_0x58a712[_0xbb56('0x7b')]=_0xbb56('0xcc');break;case _0xbb56('0xcd'):_0x58a712[_0xbb56('0x7b')]=_0xbb56('0xa5');break;case'cannedanswers':_0x58a712[_0xbb56('0x7b')]=_0xbb56('0xce');break;case _0xbb56('0xcf'):_0x58a712[_0xbb56('0x7b')]=_0xbb56('0xd0');break;case'customdashboards':_0x58a712[_0xbb56('0x7b')]='Dashboard';break;case _0xbb56('0xd1'):_0x58a712[_0xbb56('0x7b')]=_0xbb56('0xd2');break;case _0xbb56('0xd3'):_0x58a712['childModel']=_0xbb56('0xd4');break;case _0xbb56('0xd5'):_0x58a712[_0xbb56('0x7b')]=_0xbb56('0xd6');break;case _0xbb56('0xd7'):_0x58a712[_0xbb56('0x7b')]=_0xbb56('0xd8');break;case'tags':_0x58a712[_0xbb56('0x7b')]='Tag';break;case _0xbb56('0xd9'):_0x58a712['childModel']='Template';break;case'triggers':_0x58a712[_0xbb56('0x7b')]=_0xbb56('0xda');break;case _0xbb56('0xdb'):_0x58a712[_0xbb56('0x7b')]=_0xbb56('0xdc');break;case _0xbb56('0xdd'):_0x58a712[_0xbb56('0x7b')]=_0xbb56('0xde');break;case _0xbb56('0xdf'):_0x58a712[_0xbb56('0x7b')]=_0xbb56('0x6b');break;case _0xbb56('0xe0'):_0x58a712[_0xbb56('0x7b')]='AnalyticExtractedReport';_0x58a712[_0xbb56('0x78')]=[{'name':'Reports','field':'id','foreignKey':_0xbb56('0x81')}];break;case _0xbb56('0xe1'):_0x58a712[_0xbb56('0x7b')]=_0xbb56('0xe2');break;case _0xbb56('0xe3'):_0x58a712[_0xbb56('0x7b')]=_0xbb56('0xe4');break;default:return _0x58a712;}return _0x58a712;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 9f0de25..c246fa5 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 _0xe874=['remove','emit','hasOwnProperty','events','../../mysqldb','setMaxListeners','update'];(function(_0x5746a1,_0x11eab1){var _0x551a43=function(_0x7ddcbe){while(--_0x7ddcbe){_0x5746a1['push'](_0x5746a1['shift']());}};_0x551a43(++_0x11eab1);}(_0xe874,0x1ae));var _0x4e87=function(_0x5614a3,_0x1ebbb3){_0x5614a3=_0x5614a3-0x0;var _0x15f60c=_0xe874[_0x5614a3];return _0x15f60c;};'use strict';var EventEmitter=require(_0x4e87('0x0'));var UserProfile=require(_0x4e87('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x4e87('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4e87('0x3'),'afterDestroy':_0x4e87('0x4')};function emitEvent(_0x48be26){return function(_0x42c101,_0x38d603,_0x357479){UserProfileEvents['emit'](_0x48be26+':'+_0x42c101['id'],_0x42c101);UserProfileEvents[_0x4e87('0x5')](_0x48be26,_0x42c101);_0x357479(null);};}for(var e in events){if(events[_0x4e87('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xc4fd=['../../mysqldb','UserProfile','setMaxListeners','save','emit','hook','exports'];(function(_0x235cb0,_0x197da3){var _0x18302d=function(_0x5f3b78){while(--_0x5f3b78){_0x235cb0['push'](_0x235cb0['shift']());}};_0x18302d(++_0x197da3);}(_0xc4fd,0x118));var _0xdc4f=function(_0x4d674b,_0x176474){_0x4d674b=_0x4d674b-0x0;var _0x535a1f=_0xc4fd[_0x4d674b];return _0x535a1f;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xdc4f('0x0'))['db'][_0xdc4f('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xdc4f('0x2')](0x0);var events={'afterCreate':_0xdc4f('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2a8651){return function(_0x328a58,_0x1bbb17,_0x229976){UserProfileEvents[_0xdc4f('0x4')](_0x2a8651+':'+_0x328a58['id'],_0x328a58);UserProfileEvents[_0xdc4f('0x4')](_0x2a8651,_0x328a58);_0x229976(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xdc4f('0x5')](e,emitEvent(event));}}module[_0xdc4f('0x6')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 93506c0..a53fabf 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 _0xd9dc=['request-promise','rimraf','../../config/environment','./userProfile.attributes','exports','define','UserProfile','user_profiles','models','User','update','privacyEnabled','then','catch','util','../../config/logger','moment','bluebird'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xd9dc,0x1be));var _0xcd9d=function(_0x45a813,_0x13e302){_0x45a813=_0x45a813-0x0;var _0x41e082=_0xd9dc[_0x45a813];return _0x41e082;};'use strict';var _=require('lodash');var util=require(_0xcd9d('0x0'));var logger=require(_0xcd9d('0x1'))('api');var moment=require(_0xcd9d('0x2'));var BPromise=require(_0xcd9d('0x3'));var rp=require(_0xcd9d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd9d('0x5'));var config=require(_0xcd9d('0x6'));var attributes=require(_0xcd9d('0x7'));module[_0xcd9d('0x8')]=function(_0x8cc2e4,_0x50f1e2){return _0x8cc2e4[_0xcd9d('0x9')](_0xcd9d('0xa'),attributes,{'tableName':_0xcd9d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x285e75,_0x45130c,_0x549558){var _0x1e6612=_0x8cc2e4[_0xcd9d('0xc')];_0x1e6612[_0xcd9d('0xd')][_0xcd9d('0xe')]({'privacyEnabled':_0x285e75[_0xcd9d('0xf')]},{'where':{'UserProfileId':_0x285e75['id']}})[_0xcd9d('0x10')](function(){_0x549558();})[_0xcd9d('0x11')](function(_0x257586){_0x549558(_0x257586);});}}});}; \ No newline at end of file +var _0x5423=['privacyEnabled','then','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','UserProfile','models','User'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x5423,0xe3));var _0x3542=function(_0x5da1ed,_0x1de0f4){_0x5da1ed=_0x5da1ed-0x0;var _0x517bcb=_0x5423[_0x5da1ed];return _0x517bcb;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var logger=require('../../config/logger')(_0x3542('0x2'));var moment=require(_0x3542('0x3'));var BPromise=require('bluebird');var rp=require(_0x3542('0x4'));var fs=require('fs');var path=require(_0x3542('0x5'));var rimraf=require(_0x3542('0x6'));var config=require(_0x3542('0x7'));var attributes=require('./userProfile.attributes');module[_0x3542('0x8')]=function(_0x2d2ae9,_0x15ee3b){return _0x2d2ae9[_0x3542('0x9')](_0x3542('0xa'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4cdc86,_0xbc51ab,_0xa5ff96){var _0x53ece9=_0x2d2ae9[_0x3542('0xb')];_0x53ece9[_0x3542('0xc')]['update']({'privacyEnabled':_0x4cdc86[_0x3542('0xd')]},{'where':{'UserProfileId':_0x4cdc86['id']}})[_0x3542('0xe')](function(){_0xa5ff96();})['catch'](function(_0x1d3180){_0xa5ff96(_0x1d3180);});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index cd763d6..57fad93 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 _0x7217=['then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request'];(function(_0x2d0434,_0x289dda){var _0x566be6=function(_0x4d12ba){while(--_0x4d12ba){_0x2d0434['push'](_0x2d0434['shift']());}};_0x566be6(++_0x289dda);}(_0x7217,0x19e));var _0x7721=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x7217[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});config[_0x7721('0xb')]=_[_0x7721('0xc')](config[_0x7721('0xb')],{'host':_0x7721('0xd'),'port':0x18eb});var socket=require(_0x7721('0xe'))(new Redis(config[_0x7721('0xb')]));require(_0x7721('0xf'))[_0x7721('0x10')](socket);function respondWithRpcPromise(_0x138740,_0x2c3986,_0x578d59){return new BPromise(function(_0x461d1a,_0x29bc8f){return client[_0x7721('0x11')](_0x138740,_0x578d59)[_0x7721('0x12')](function(_0xa8977c){logger[_0x7721('0x13')](_0x7721('0x14'),_0x2c3986,_0x7721('0x15'));logger['debug'](_0x7721('0x16'),_0x2c3986,_0x7721('0x15'),JSON['stringify'](_0xa8977c));if(_0xa8977c[_0x7721('0x17')]){if(_0xa8977c[_0x7721('0x17')][_0x7721('0x18')]===0x1f4){logger[_0x7721('0x17')]('UserProfile,\x20%s,\x20%s',_0x2c3986,_0xa8977c[_0x7721('0x17')][_0x7721('0x19')]);return _0x29bc8f(_0xa8977c['error']['message']);}logger['error'](_0x7721('0x14'),_0x2c3986,_0xa8977c[_0x7721('0x17')][_0x7721('0x19')]);return _0x461d1a(_0xa8977c[_0x7721('0x17')]['message']);}else{logger[_0x7721('0x13')]('UserProfile,\x20%s,\x20%s',_0x2c3986,_0x7721('0x15'));_0x461d1a(_0xa8977c['result'][_0x7721('0x19')]);}})[_0x7721('0x1a')](function(_0x3ab5a5){logger[_0x7721('0x17')](_0x7721('0x14'),_0x2c3986,_0x3ab5a5);_0x29bc8f(_0x3ab5a5);});});} \ No newline at end of file +var _0x9c5a=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5a5796,_0x2a496d){var _0x127e53=function(_0x3e3544){while(--_0x3e3544){_0x5a5796['push'](_0x5a5796['shift']());}};_0x127e53(++_0x2a496d);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x2003d0,_0x1ba853){_0x2003d0=_0x2003d0-0x0;var _0x4b08b0=_0x9c5a[_0x2003d0];return _0x4b08b0;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var moment=require('moment');var BPromise=require(_0xa9c5('0x2'));var rs=require(_0xa9c5('0x3'));var fs=require('fs');var Redis=require(_0xa9c5('0x4'));var db=require(_0xa9c5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9c5('0x6'))(_0xa9c5('0x7'));var config=require('../../config/environment');var jayson=require(_0xa9c5('0x8'));var client=jayson['client'][_0xa9c5('0x9')]({'port':0x232a});config[_0xa9c5('0xa')]=_['defaults'](config['redis'],{'host':_0xa9c5('0xb'),'port':0x18eb});var socket=require(_0xa9c5('0xc'))(new Redis(config['redis']));require(_0xa9c5('0xd'))[_0xa9c5('0xe')](socket);function respondWithRpcPromise(_0x51c14c,_0x2e4f45,_0x40a79d){return new BPromise(function(_0x4a19c0,_0x4c55e9){return client[_0xa9c5('0xf')](_0x51c14c,_0x40a79d)[_0xa9c5('0x10')](function(_0x45f8d8){logger[_0xa9c5('0x11')](_0xa9c5('0x12'),_0x2e4f45,_0xa9c5('0x13'));logger[_0xa9c5('0x14')](_0xa9c5('0x15'),_0x2e4f45,_0xa9c5('0x13'),JSON[_0xa9c5('0x16')](_0x45f8d8));if(_0x45f8d8['error']){if(_0x45f8d8[_0xa9c5('0x17')][_0xa9c5('0x18')]===0x1f4){logger[_0xa9c5('0x17')](_0xa9c5('0x12'),_0x2e4f45,_0x45f8d8[_0xa9c5('0x17')][_0xa9c5('0x19')]);return _0x4c55e9(_0x45f8d8[_0xa9c5('0x17')][_0xa9c5('0x19')]);}logger[_0xa9c5('0x17')](_0xa9c5('0x12'),_0x2e4f45,_0x45f8d8['error'][_0xa9c5('0x19')]);return _0x4a19c0(_0x45f8d8[_0xa9c5('0x17')][_0xa9c5('0x19')]);}else{logger['info'](_0xa9c5('0x12'),_0x2e4f45,_0xa9c5('0x13'));_0x4a19c0(_0x45f8d8[_0xa9c5('0x1a')][_0xa9c5('0x19')]);}})[_0xa9c5('0x1b')](function(_0x349f27){logger[_0xa9c5('0x17')](_0xa9c5('0x12'),_0x2e4f45,_0x349f27);_0x4c55e9(_0x349f27);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 5b155d8..1f97a7c 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 _0xbd07=['emit','removeListener','register','userProfile:','./userProfile.events','save','remove','update'];(function(_0xacd45,_0x2c609e){var _0x48f549=function(_0x155a8b){while(--_0x155a8b){_0xacd45['push'](_0xacd45['shift']());}};_0x48f549(++_0x2c609e);}(_0xbd07,0xac));var _0x7bd0=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xbd07[_0x209941];return _0x1e8729;};'use strict';var UserProfileEvents=require(_0x7bd0('0x0'));var events=[_0x7bd0('0x1'),_0x7bd0('0x2'),_0x7bd0('0x3')];function createListener(_0xacaf62,_0x18388d){return function(_0x14ca00){_0x18388d[_0x7bd0('0x4')](_0xacaf62,_0x14ca00);};}function removeListener(_0x1e38fe,_0x3bb461){return function(){UserProfileEvents[_0x7bd0('0x5')](_0x1e38fe,_0x3bb461);};}exports[_0x7bd0('0x6')]=function(_0x5b7179){for(var _0x206880=0x0,_0xab4c0b=events['length'];_0x206880<_0xab4c0b;_0x206880++){var _0xf0306f=events[_0x206880];var _0x4c74be=createListener(_0x7bd0('0x7')+_0xf0306f,_0x5b7179);UserProfileEvents['on'](_0xf0306f,_0x4c74be);}}; \ No newline at end of file +var _0xf827=['./userProfile.events','emit','removeListener','register','length','userProfile:'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xf827,0x14a));var _0x7f82=function(_0x366070,_0x39b4d9){_0x366070=_0x366070-0x0;var _0x1d88b6=_0xf827[_0x366070];return _0x1d88b6;};'use strict';var UserProfileEvents=require(_0x7f82('0x0'));var events=['save','remove','update'];function createListener(_0x51bd08,_0x180dfa){return function(_0x2007e9){_0x180dfa[_0x7f82('0x1')](_0x51bd08,_0x2007e9);};}function removeListener(_0x5f4642,_0x358a44){return function(){UserProfileEvents[_0x7f82('0x2')](_0x5f4642,_0x358a44);};}exports[_0x7f82('0x3')]=function(_0x6a14f5){for(var _0x2cc3a7=0x0,_0x341f25=events[_0x7f82('0x4')];_0x2cc3a7<_0x341f25;_0x2cc3a7++){var _0x52f081=events[_0x2cc3a7];var _0x4d4796=createListener(_0x7f82('0x5')+_0x52f081,_0x6a14f5);UserProfileEvents['on'](_0x52f081,_0x4d4796);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index b135201..049135c 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 _0xfd7e=['post','create','put','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x434b43,_0x2e0a0d){var _0x179ecc=function(_0x22b528){while(--_0x22b528){_0x434b43['push'](_0x434b43['shift']());}};_0x179ecc(++_0x2e0a0d);}(_0xfd7e,0x83));var _0xefd7=function(_0x13b603,_0x370e5c){_0x13b603=_0x13b603-0x0;var _0x1a3510=_0xfd7e[_0x13b603];return _0x1a3510;};'use strict';var multer=require(_0xefd7('0x0'));var util=require(_0xefd7('0x1'));var path=require(_0xefd7('0x2'));var timeout=require(_0xefd7('0x3'));var express=require('express');var router=express[_0xefd7('0x4')]();var fs_extra=require(_0xefd7('0x5'));var auth=require(_0xefd7('0x6'));var interaction=require(_0xefd7('0x7'));var config=require('../../config/environment');var controller=require(_0xefd7('0x8'));router[_0xefd7('0x9')]('/',auth[_0xefd7('0xa')](),controller[_0xefd7('0xb')]);router[_0xefd7('0x9')](_0xefd7('0xc'),auth['isAuthenticated'](),controller[_0xefd7('0xd')]);router[_0xefd7('0x9')](_0xefd7('0xe'),auth[_0xefd7('0xa')](),controller[_0xefd7('0xf')]);router[_0xefd7('0x10')]('/',auth[_0xefd7('0xa')](),controller[_0xefd7('0x11')]);router[_0xefd7('0x12')](_0xefd7('0xe'),auth[_0xefd7('0xa')](),controller['update']);router[_0xefd7('0x13')]('/:id',auth[_0xefd7('0xa')](),controller[_0xefd7('0x14')]);module['exports']=router; \ No newline at end of file +var _0x513f=['post','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x3334f2,_0x2f4335){var _0x45fab3=function(_0x5e2fef){while(--_0x5e2fef){_0x3334f2['push'](_0x3334f2['shift']());}};_0x45fab3(++_0x2f4335);}(_0x513f,0xce));var _0xf513=function(_0x49716f,_0x5cacb2){_0x49716f=_0x49716f-0x0;var _0x3c89a7=_0x513f[_0x49716f];return _0x3c89a7;};'use strict';var multer=require('multer');var util=require(_0xf513('0x0'));var path=require(_0xf513('0x1'));var timeout=require('connect-timeout');var express=require(_0xf513('0x2'));var router=express[_0xf513('0x3')]();var fs_extra=require(_0xf513('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf513('0x5'));var controller=require(_0xf513('0x6'));router[_0xf513('0x7')]('/',auth[_0xf513('0x8')](),controller[_0xf513('0x9')]);router[_0xf513('0x7')](_0xf513('0xa'),auth[_0xf513('0x8')](),controller[_0xf513('0xb')]);router[_0xf513('0x7')](_0xf513('0xc'),auth[_0xf513('0x8')](),controller[_0xf513('0xd')]);router[_0xf513('0xe')]('/',auth[_0xf513('0x8')](),controller['create']);router[_0xf513('0xf')](_0xf513('0xc'),auth[_0xf513('0x8')](),controller[_0xf513('0x10')]);router[_0xf513('0x11')](_0xf513('0xc'),auth['isAuthenticated'](),controller[_0xf513('0x12')]);module[_0xf513('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 2758abc..2f8067f 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 _0x255f=['exports','STRING'];(function(_0x490178,_0x5b0d78){var _0x4399e1=function(_0x404a0e){while(--_0x404a0e){_0x490178['push'](_0x490178['shift']());}};_0x4399e1(++_0x5b0d78);}(_0x255f,0x6c));var _0xf255=function(_0x658390,_0x4f795d){_0x658390=_0x658390-0x0;var _0x2c949f=_0x255f[_0x658390];return _0x2c949f;};'use strict';var Sequelize=require('sequelize');module[_0xf255('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xf255('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x36b9=['exports','INTEGER','sequelize'];(function(_0x509908,_0x2e4e16){var _0x2db579=function(_0x58d338){while(--_0x58d338){_0x509908['push'](_0x509908['shift']());}};_0x2db579(++_0x2e4e16);}(_0x36b9,0x1a0));var _0x936b=function(_0x3fe517,_0x34afd4){_0x3fe517=_0x3fe517-0x0;var _0x3d85f1=_0x36b9[_0x3fe517];return _0x3d85f1;};'use strict';var Sequelize=require(_0x936b('0x0'));module[_0x936b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x936b('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index d47ccfd..5c0ae5b 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 _0x2ef3=['UserProfileResource','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map'];(function(_0x16fe34,_0x5c3271){var _0xe7132d=function(_0xa57fc4){while(--_0xa57fc4){_0x16fe34['push'](_0x16fe34['shift']());}};_0xe7132d(++_0x5c3271);}(_0x2ef3,0xba));var _0x32ef=function(_0x4c71f5,_0x3e9e24){_0x4c71f5=_0x4c71f5-0x0;var _0x58111b=_0x2ef3[_0x4c71f5];return _0x58111b;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=_0x55bf0b['count'],_0x13db1a=_0x57aff1['offset'],_0x3950e6=_0x57aff1[_0x32ef('0x1b')]+_0x57aff1[_0x32ef('0x1c')],_0xb5aed2;if(_0x3950e6>=_0x531e30){_0x3950e6=_0x531e30;_0xb5aed2=0xc8;}else{_0xb5aed2=0xce;}_0x54c7f5[_0x32ef('0x19')](_0xb5aed2);return _0x54c7f5['set'](_0x32ef('0x1d'),_0x13db1a+'-'+_0x3950e6+'/'+_0x531e30)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x4f4c98){return function(_0x304505){try{jsonpatch[_0x32ef('0x1e')](_0x304505,_0x4f4c98,!![]);}catch(_0x26aff3){return BPromise[_0x32ef('0x1f')](_0x26aff3);}return _0x304505[_0x32ef('0x20')]();};}function saveUpdates(_0x3aec05,_0x4de441){return function(_0x3c5b78){if(_0x3c5b78){return _0x3c5b78['update'](_0x3aec05)[_0x32ef('0x21')](function(_0x3a20ca){return _0x3a20ca;});}return null;};}function removeEntity(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x22')]()['then'](function(){_0x49f2d8['status'](0xcc)[_0x32ef('0x23')]();});}};}function handleEntityNotFound(_0xb30fab,_0x225feb){return function(_0x478bef){if(!_0x478bef){_0xb30fab['sendStatus'](0x194);}return _0x478bef;};}function handleError(_0x19ea6,_0x4d584b){_0x4d584b=_0x4d584b||0x1f4;return function(_0x51a412){logger[_0x32ef('0x24')](_0x51a412[_0x32ef('0x25')]);if(_0x51a412[_0x32ef('0x26')]){delete _0x51a412[_0x32ef('0x26')];}_0x19ea6[_0x32ef('0x19')](_0x4d584b)[_0x32ef('0x27')](_0x51a412);};}exports[_0x32ef('0x28')]=function(_0x38aed5,_0x338f19){var _0x2f52d7={},_0x1335e2={},_0xba4b3f={'count':0x0,'rows':[]};var _0x5a88a5=_[_0x32ef('0x29')](db[_0x32ef('0x2a')]['rawAttributes'],function(_0x12de1a){return{'name':_0x12de1a[_0x32ef('0x2b')],'type':_0x12de1a[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x1335e2['model']=_[_0x32ef('0x29')](_0x5a88a5,_0x32ef('0x26'));_0x1335e2[_0x32ef('0x2e')]=_[_0x32ef('0x2f')](_0x38aed5[_0x32ef('0x2e')]);_0x1335e2[_0x32ef('0x30')]=_[_0x32ef('0x31')](_0x1335e2['model'],_0x1335e2[_0x32ef('0x2e')]);_0x2f52d7['attributes']=_[_0x32ef('0x31')](_0x1335e2[_0x32ef('0x32')],qs['fields'](_0x38aed5[_0x32ef('0x2e')][_0x32ef('0x33')]));_0x2f52d7[_0x32ef('0x34')]=_0x2f52d7[_0x32ef('0x34')][_0x32ef('0x35')]?_0x2f52d7['attributes']:_0x1335e2['model'];if(!_0x38aed5[_0x32ef('0x2e')]['hasOwnProperty'](_0x32ef('0x36'))){_0x2f52d7[_0x32ef('0x1c')]=qs[_0x32ef('0x1c')](_0x38aed5[_0x32ef('0x2e')][_0x32ef('0x1c')]);_0x2f52d7[_0x32ef('0x1b')]=qs['offset'](_0x38aed5['query']['offset']);}_0x2f52d7[_0x32ef('0x37')]=qs[_0x32ef('0x38')](_0x38aed5[_0x32ef('0x2e')]['sort']);_0x2f52d7['where']=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0x38aed5[_0x32ef('0x2e')],_0x1335e2['filters']),_0x5a88a5);if(_0x38aed5['query'][_0x32ef('0x3a')]){_0x2f52d7[_0x32ef('0x3b')]=_[_0x32ef('0x3c')](_0x2f52d7[_0x32ef('0x3b')],{'$or':_[_0x32ef('0x29')](_0x5a88a5,function(_0x211c79){if(_0x211c79[_0x32ef('0x2c')]!==_0x32ef('0x3d')){var _0x7f2319={};_0x7f2319[_0x211c79['name']]={'$like':'%'+_0x38aed5[_0x32ef('0x2e')][_0x32ef('0x3a')]+'%'};return _0x7f2319;}})});}_0x2f52d7=_[_0x32ef('0x3c')]({},_0x2f52d7,_0x38aed5['options']);var _0x365125={'where':_0x2f52d7[_0x32ef('0x3b')]};return db[_0x32ef('0x2a')][_0x32ef('0x3e')](_0x365125)[_0x32ef('0x21')](function(_0x33a0fb){_0xba4b3f[_0x32ef('0x3e')]=_0x33a0fb;if(_0x38aed5[_0x32ef('0x2e')][_0x32ef('0x3f')]){_0x2f52d7[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x2a')][_0x32ef('0x41')](_0x2f52d7);})['then'](function(_0x3cac2e){_0xba4b3f[_0x32ef('0x42')]=_0x3cac2e;return _0xba4b3f;})[_0x32ef('0x21')](respondWithFilteredResult(_0x338f19,_0x2f52d7))[_0x32ef('0x43')](handleError(_0x338f19,null));};exports[_0x32ef('0x44')]=function(_0x2ca66b,_0x3c0e44){var _0x596d5a={'raw':![],'where':{'id':_0x2ca66b[_0x32ef('0x45')]['id']}},_0x538758={};_0x538758[_0x32ef('0x32')]=_[_0x32ef('0x2f')](db[_0x32ef('0x2a')]['rawAttributes']);_0x538758[_0x32ef('0x2e')]=_[_0x32ef('0x2f')](_0x2ca66b['query']);_0x538758[_0x32ef('0x30')]=_['intersection'](_0x538758[_0x32ef('0x32')],_0x538758[_0x32ef('0x2e')]);_0x596d5a[_0x32ef('0x34')]=_[_0x32ef('0x31')](_0x538758[_0x32ef('0x32')],qs[_0x32ef('0x33')](_0x2ca66b[_0x32ef('0x2e')][_0x32ef('0x33')]));_0x596d5a[_0x32ef('0x34')]=_0x596d5a[_0x32ef('0x34')]['length']?_0x596d5a[_0x32ef('0x34')]:_0x538758['model'];if(_0x2ca66b[_0x32ef('0x2e')][_0x32ef('0x3f')]){_0x596d5a[_0x32ef('0x40')]=[{'all':!![]}];}_0x596d5a=_['merge']({},_0x596d5a,_0x2ca66b[_0x32ef('0x46')]);return db[_0x32ef('0x2a')][_0x32ef('0x47')](_0x596d5a)[_0x32ef('0x21')](handleEntityNotFound(_0x3c0e44,null))[_0x32ef('0x21')](respondWithResult(_0x3c0e44,null))[_0x32ef('0x43')](handleError(_0x3c0e44,null));};exports[_0x32ef('0x48')]=function(_0x47dbe1,_0x5cb6fc){return db[_0x32ef('0x2a')][_0x32ef('0x48')](_0x47dbe1[_0x32ef('0x49')],{})[_0x32ef('0x21')](respondWithResult(_0x5cb6fc,0xc9))[_0x32ef('0x43')](handleError(_0x5cb6fc,null));};exports[_0x32ef('0x4a')]=function(_0x44ad11,_0x115fa3){if(_0x44ad11[_0x32ef('0x49')]['id']){delete _0x44ad11[_0x32ef('0x49')]['id'];}return db[_0x32ef('0x2a')][_0x32ef('0x47')]({'where':{'id':_0x44ad11[_0x32ef('0x45')]['id']}})['then'](handleEntityNotFound(_0x115fa3,null))[_0x32ef('0x21')](saveUpdates(_0x44ad11[_0x32ef('0x49')],null))[_0x32ef('0x21')](respondWithResult(_0x115fa3,null))[_0x32ef('0x43')](handleError(_0x115fa3,null));};exports[_0x32ef('0x22')]=function(_0x4353f0,_0x278696){return db[_0x32ef('0x2a')][_0x32ef('0x47')]({'where':{'id':_0x4353f0[_0x32ef('0x45')]['id']}})[_0x32ef('0x21')](handleEntityNotFound(_0x278696,null))[_0x32ef('0x21')](removeEntity(_0x278696,null))[_0x32ef('0x43')](handleError(_0x278696,null));};exports[_0x32ef('0x4b')]=function(_0x307ac8,_0x3fb4d8){return db[_0x32ef('0x2a')][_0x32ef('0x4b')]()['then'](respondWithResult(_0x3fb4d8,null))['catch'](handleError(_0x3fb4d8,null));}; \ No newline at end of file +var _0xc2c7=['moment','bluebird','mustache','util','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','UserProfileResource','rawAttributes','type','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','show','params','attributes','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1871b5,_0x1f1096){var _0xda35f=function(_0x4bf867){while(--_0x4bf867){_0x1871b5['push'](_0x1871b5['shift']());}};_0xda35f(++_0x1f1096);}(_0xc2c7,0x134));var _0x7c2c=function(_0x4d5cca,_0x34bfe4){_0x4d5cca=_0x4d5cca-0x0;var _0x2d71fd=_0xc2c7[_0x4d5cca];return _0x2d71fd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c2c('0x0'));var zipdir=require(_0x7c2c('0x1'));var jsonpatch=require(_0x7c2c('0x2'));var rp=require(_0x7c2c('0x3'));var moment=require(_0x7c2c('0x4'));var BPromise=require(_0x7c2c('0x5'));var Mustache=require(_0x7c2c('0x6'));var util=require(_0x7c2c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7c2c('0x8'));var ejs=require(_0x7c2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7c2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x8'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var licenseUtil=require(_0x7c2c('0x17'));var db=require(_0x7c2c('0x18'))['db'];function respondWithStatusCode(_0xae8441,_0x45847d){_0x45847d=_0x45847d||0xcc;return function(_0x68398a){if(_0x68398a){return _0xae8441[_0x7c2c('0x19')](_0x45847d);}return _0xae8441[_0x7c2c('0x1a')](_0x45847d)[_0x7c2c('0x1b')]();};}function respondWithResult(_0x4c4aaf,_0x5b5729){_0x5b5729=_0x5b5729||0xc8;return function(_0x102778){if(_0x102778){return _0x4c4aaf[_0x7c2c('0x1a')](_0x5b5729)[_0x7c2c('0x1c')](_0x102778);}};}function respondWithFilteredResult(_0x5ae94f,_0x11424c){return function(_0x206ecd){if(_0x206ecd){var _0x5e55e0=_0x206ecd['count'],_0x88f54b=_0x11424c[_0x7c2c('0x1d')],_0x5a5fe2=_0x11424c[_0x7c2c('0x1d')]+_0x11424c[_0x7c2c('0x1e')],_0x1aa355;if(_0x5a5fe2>=_0x5e55e0){_0x5a5fe2=_0x5e55e0;_0x1aa355=0xc8;}else{_0x1aa355=0xce;}_0x5ae94f[_0x7c2c('0x1a')](_0x1aa355);return _0x5ae94f[_0x7c2c('0x1f')](_0x7c2c('0x20'),_0x88f54b+'-'+_0x5a5fe2+'/'+_0x5e55e0)[_0x7c2c('0x1c')](_0x206ecd);}return null;};}function patchUpdates(_0x1ce7e1){return function(_0x2d356e){try{jsonpatch[_0x7c2c('0x21')](_0x2d356e,_0x1ce7e1,!![]);}catch(_0x40eaef){return BPromise[_0x7c2c('0x22')](_0x40eaef);}return _0x2d356e['save']();};}function saveUpdates(_0x1c5491,_0x4adb62){return function(_0x506d47){if(_0x506d47){return _0x506d47[_0x7c2c('0x23')](_0x1c5491)[_0x7c2c('0x24')](function(_0x2a9ae2){return _0x2a9ae2;});}return null;};}function removeEntity(_0x38ae30,_0x41552f){return function(_0x1883b5){if(_0x1883b5){return _0x1883b5[_0x7c2c('0x25')]()['then'](function(){_0x38ae30[_0x7c2c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x302c93,_0x57f510){return function(_0x3d4387){if(!_0x3d4387){_0x302c93[_0x7c2c('0x19')](0x194);}return _0x3d4387;};}function handleError(_0x3126d,_0x481867){_0x481867=_0x481867||0x1f4;return function(_0x4d6ec7){logger[_0x7c2c('0x26')](_0x4d6ec7[_0x7c2c('0x27')]);if(_0x4d6ec7[_0x7c2c('0x28')]){delete _0x4d6ec7[_0x7c2c('0x28')];}_0x3126d[_0x7c2c('0x1a')](_0x481867)[_0x7c2c('0x29')](_0x4d6ec7);};}exports[_0x7c2c('0x2a')]=function(_0x4b1dd0,_0x358c67){var _0xf39941={},_0x3b2652={},_0x22d03f={'count':0x0,'rows':[]};var _0x145788=_[_0x7c2c('0x2b')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')],function(_0xa040ff){return{'name':_0xa040ff['fieldName'],'type':_0xa040ff[_0x7c2c('0x2e')][_0x7c2c('0x2f')]};});_0x3b2652[_0x7c2c('0x30')]=_[_0x7c2c('0x2b')](_0x145788,'name');_0x3b2652[_0x7c2c('0x31')]=_[_0x7c2c('0x32')](_0x4b1dd0[_0x7c2c('0x31')]);_0x3b2652[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x3b2652[_0x7c2c('0x30')],_0x3b2652[_0x7c2c('0x31')]);_0xf39941['attributes']=_[_0x7c2c('0x34')](_0x3b2652[_0x7c2c('0x30')],qs[_0x7c2c('0x35')](_0x4b1dd0[_0x7c2c('0x31')][_0x7c2c('0x35')]));_0xf39941['attributes']=_0xf39941['attributes'][_0x7c2c('0x36')]?_0xf39941['attributes']:_0x3b2652['model'];if(!_0x4b1dd0[_0x7c2c('0x31')][_0x7c2c('0x37')](_0x7c2c('0x38'))){_0xf39941[_0x7c2c('0x1e')]=qs['limit'](_0x4b1dd0[_0x7c2c('0x31')][_0x7c2c('0x1e')]);_0xf39941[_0x7c2c('0x1d')]=qs[_0x7c2c('0x1d')](_0x4b1dd0[_0x7c2c('0x31')][_0x7c2c('0x1d')]);}_0xf39941[_0x7c2c('0x39')]=qs[_0x7c2c('0x3a')](_0x4b1dd0[_0x7c2c('0x31')][_0x7c2c('0x3a')]);_0xf39941[_0x7c2c('0x3b')]=qs[_0x7c2c('0x33')](_[_0x7c2c('0x3c')](_0x4b1dd0['query'],_0x3b2652['filters']),_0x145788);if(_0x4b1dd0[_0x7c2c('0x31')]['filter']){_0xf39941['where']=_['merge'](_0xf39941[_0x7c2c('0x3b')],{'$or':_[_0x7c2c('0x2b')](_0x145788,function(_0x129bf0){if(_0x129bf0[_0x7c2c('0x2e')]!==_0x7c2c('0x3d')){var _0x151eb2={};_0x151eb2[_0x129bf0[_0x7c2c('0x28')]]={'$like':'%'+_0x4b1dd0[_0x7c2c('0x31')][_0x7c2c('0x3e')]+'%'};return _0x151eb2;}})});}_0xf39941=_[_0x7c2c('0x3f')]({},_0xf39941,_0x4b1dd0[_0x7c2c('0x40')]);var _0x58696a={'where':_0xf39941['where']};return db[_0x7c2c('0x2c')][_0x7c2c('0x41')](_0x58696a)[_0x7c2c('0x24')](function(_0x57bead){_0x22d03f['count']=_0x57bead;if(_0x4b1dd0[_0x7c2c('0x31')][_0x7c2c('0x42')]){_0xf39941[_0x7c2c('0x43')]=[{'all':!![]}];}return db[_0x7c2c('0x2c')][_0x7c2c('0x44')](_0xf39941);})[_0x7c2c('0x24')](function(_0x12c9cd){_0x22d03f[_0x7c2c('0x45')]=_0x12c9cd;return _0x22d03f;})[_0x7c2c('0x24')](respondWithFilteredResult(_0x358c67,_0xf39941))['catch'](handleError(_0x358c67,null));};exports[_0x7c2c('0x46')]=function(_0x5aba9a,_0x2c3f40){var _0x322704={'raw':![],'where':{'id':_0x5aba9a[_0x7c2c('0x47')]['id']}},_0x51e150={};_0x51e150['model']=_[_0x7c2c('0x32')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')]);_0x51e150[_0x7c2c('0x31')]=_['keys'](_0x5aba9a[_0x7c2c('0x31')]);_0x51e150['filters']=_['intersection'](_0x51e150[_0x7c2c('0x30')],_0x51e150[_0x7c2c('0x31')]);_0x322704[_0x7c2c('0x48')]=_['intersection'](_0x51e150[_0x7c2c('0x30')],qs[_0x7c2c('0x35')](_0x5aba9a['query'][_0x7c2c('0x35')]));_0x322704['attributes']=_0x322704[_0x7c2c('0x48')][_0x7c2c('0x36')]?_0x322704['attributes']:_0x51e150['model'];if(_0x5aba9a[_0x7c2c('0x31')][_0x7c2c('0x42')]){_0x322704['include']=[{'all':!![]}];}_0x322704=_[_0x7c2c('0x3f')]({},_0x322704,_0x5aba9a['options']);return db['UserProfileResource'][_0x7c2c('0x49')](_0x322704)[_0x7c2c('0x24')](handleEntityNotFound(_0x2c3f40,null))[_0x7c2c('0x24')](respondWithResult(_0x2c3f40,null))[_0x7c2c('0x4a')](handleError(_0x2c3f40,null));};exports[_0x7c2c('0x4b')]=function(_0x23121f,_0x2b0781){return db[_0x7c2c('0x2c')][_0x7c2c('0x4b')](_0x23121f['body'],{})['then'](respondWithResult(_0x2b0781,0xc9))[_0x7c2c('0x4a')](handleError(_0x2b0781,null));};exports[_0x7c2c('0x23')]=function(_0x3ce2fb,_0x4f95a1){if(_0x3ce2fb['body']['id']){delete _0x3ce2fb[_0x7c2c('0x4c')]['id'];}return db[_0x7c2c('0x2c')][_0x7c2c('0x49')]({'where':{'id':_0x3ce2fb[_0x7c2c('0x47')]['id']}})['then'](handleEntityNotFound(_0x4f95a1,null))['then'](saveUpdates(_0x3ce2fb['body'],null))[_0x7c2c('0x24')](respondWithResult(_0x4f95a1,null))[_0x7c2c('0x4a')](handleError(_0x4f95a1,null));};exports[_0x7c2c('0x25')]=function(_0x27a096,_0x438cbd){return db['UserProfileResource'][_0x7c2c('0x49')]({'where':{'id':_0x27a096[_0x7c2c('0x47')]['id']}})['then'](handleEntityNotFound(_0x438cbd,null))[_0x7c2c('0x24')](removeEntity(_0x438cbd,null))['catch'](handleError(_0x438cbd,null));};exports[_0x7c2c('0x4d')]=function(_0x3806f4,_0x3427fc){return db['UserProfileResource']['describe']()[_0x7c2c('0x24')](respondWithResult(_0x3427fc,null))['catch'](handleError(_0x3427fc,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index fd48f47..7041e4f 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 _0x8869=['define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x26f5ad,_0x4760a3){var _0x3b8b89=function(_0x38c334){while(--_0x38c334){_0x26f5ad['push'](_0x26f5ad['shift']());}};_0x3b8b89(++_0x4760a3);}(_0x8869,0x6e));var _0x9886=function(_0x19d9e5,_0x1367a8){_0x19d9e5=_0x19d9e5-0x0;var _0x4742c9=_0x8869[_0x19d9e5];return _0x4742c9;};'use strict';var _=require(_0x9886('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9886('0x1'));var moment=require(_0x9886('0x2'));var BPromise=require(_0x9886('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9886('0x4'));var rimraf=require(_0x9886('0x5'));var config=require(_0x9886('0x6'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x150364,_0x228526){return _0x150364[_0x9886('0x7')](_0x9886('0x8'),attributes,{'tableName':_0x9886('0x9'),'paranoid':![],'indexes':[{'name':_0x9886('0xa'),'fields':[_0x9886('0xb'),_0x9886('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf7b1=['request-promise','./userProfileResource.attributes','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','lodash','util','../../config/logger','bluebird'];(function(_0x1e5e75,_0x545d30){var _0x1b3def=function(_0x289309){while(--_0x289309){_0x1e5e75['push'](_0x1e5e75['shift']());}};_0x1b3def(++_0x545d30);}(_0xf7b1,0xe2));var _0x1f7b=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xf7b1[_0x5416db];return _0x243e35;};'use strict';var _=require(_0x1f7b('0x0'));var util=require(_0x1f7b('0x1'));var logger=require(_0x1f7b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1f7b('0x3'));var rp=require(_0x1f7b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1f7b('0x5'));module['exports']=function(_0x17ebe7,_0x1b71c2){return _0x17ebe7['define'](_0x1f7b('0x6'),attributes,{'tableName':_0x1f7b('0x7'),'paranoid':![],'indexes':[{'name':_0x1f7b('0x8'),'fields':[_0x1f7b('0x9'),'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 e7bfbd2..b5b174f 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 _0xa7e3=['request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s'];(function(_0x4b77bd,_0x184760){var _0x50d12d=function(_0x18800b){while(--_0x18800b){_0x4b77bd['push'](_0x4b77bd['shift']());}};_0x50d12d(++_0x184760);}(_0xa7e3,0xd0));var _0x3a7e=function(_0x281f96,_0x5db2bf){_0x281f96=_0x281f96-0x0;var _0x50c879=_0xa7e3[_0x281f96];return _0x50c879;};'use strict';var _=require(_0x3a7e('0x0'));var util=require(_0x3a7e('0x1'));var moment=require(_0x3a7e('0x2'));var BPromise=require(_0x3a7e('0x3'));var rs=require(_0x3a7e('0x4'));var fs=require('fs');var Redis=require(_0x3a7e('0x5'));var db=require(_0x3a7e('0x6'))['db'];var utils=require(_0x3a7e('0x7'));var logger=require(_0x3a7e('0x8'))(_0x3a7e('0x9'));var config=require('../../config/environment');var jayson=require(_0x3a7e('0xa'));var client=jayson[_0x3a7e('0xb')][_0x3a7e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2fb453,_0x336aa5,_0x2dd462){return new BPromise(function(_0x597f9a,_0xd50ced){return client[_0x3a7e('0xd')](_0x2fb453,_0x2dd462)[_0x3a7e('0xe')](function(_0x445c67){logger[_0x3a7e('0xf')](_0x3a7e('0x10'),_0x336aa5,_0x3a7e('0x11'));logger[_0x3a7e('0x12')](_0x3a7e('0x13'),_0x336aa5,_0x3a7e('0x11'),JSON[_0x3a7e('0x14')](_0x445c67));if(_0x445c67[_0x3a7e('0x15')]){if(_0x445c67[_0x3a7e('0x15')]['code']===0x1f4){logger[_0x3a7e('0x15')]('UserProfileResource,\x20%s,\x20%s',_0x336aa5,_0x445c67[_0x3a7e('0x15')]['message']);return _0xd50ced(_0x445c67['error']['message']);}logger[_0x3a7e('0x15')](_0x3a7e('0x10'),_0x336aa5,_0x445c67['error'][_0x3a7e('0x16')]);return _0x597f9a(_0x445c67['error'][_0x3a7e('0x16')]);}else{logger['info'](_0x3a7e('0x10'),_0x336aa5,_0x3a7e('0x11'));_0x597f9a(_0x445c67[_0x3a7e('0x17')][_0x3a7e('0x16')]);}})[_0x3a7e('0x18')](function(_0x421399){logger[_0x3a7e('0x15')](_0x3a7e('0x10'),_0x336aa5,_0x421399);_0xd50ced(_0x421399);});});} \ No newline at end of file +var _0x7f54=['message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5a4a6c,_0x1d29a0){var _0x4ba0a4=function(_0x1a340d){while(--_0x1a340d){_0x5a4a6c['push'](_0x5a4a6c['shift']());}};_0x4ba0a4(++_0x1d29a0);}(_0x7f54,0xcc));var _0x47f5=function(_0x27fff7,_0x53f97e){_0x27fff7=_0x27fff7-0x0;var _0x412923=_0x7f54[_0x27fff7];return _0x412923;};'use strict';var _=require(_0x47f5('0x0'));var util=require(_0x47f5('0x1'));var moment=require(_0x47f5('0x2'));var BPromise=require(_0x47f5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47f5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47f5('0x5'));var logger=require(_0x47f5('0x6'))(_0x47f5('0x7'));var config=require(_0x47f5('0x8'));var jayson=require(_0x47f5('0x9'));var client=jayson[_0x47f5('0xa')][_0x47f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x421680,_0x566186,_0x347b34){return new BPromise(function(_0xb43334,_0x2a39bf){return client[_0x47f5('0xc')](_0x421680,_0x347b34)[_0x47f5('0xd')](function(_0x31487c){logger['info'](_0x47f5('0xe'),_0x566186,'request\x20sent');logger[_0x47f5('0xf')](_0x47f5('0x10'),_0x566186,_0x47f5('0x11'),JSON[_0x47f5('0x12')](_0x31487c));if(_0x31487c[_0x47f5('0x13')]){if(_0x31487c[_0x47f5('0x13')][_0x47f5('0x14')]===0x1f4){logger['error'](_0x47f5('0xe'),_0x566186,_0x31487c[_0x47f5('0x13')]['message']);return _0x2a39bf(_0x31487c[_0x47f5('0x13')]['message']);}logger[_0x47f5('0x13')](_0x47f5('0xe'),_0x566186,_0x31487c[_0x47f5('0x13')][_0x47f5('0x15')]);return _0xb43334(_0x31487c[_0x47f5('0x13')][_0x47f5('0x15')]);}else{logger[_0x47f5('0x16')](_0x47f5('0xe'),_0x566186,_0x47f5('0x11'));_0xb43334(_0x31487c[_0x47f5('0x17')]['message']);}})[_0x47f5('0x18')](function(_0x46a1c){logger[_0x47f5('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x566186,_0x46a1c);_0x2a39bf(_0x46a1c);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index a9001b4..3c5267f 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 _0xf6ee=['post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xf6ee,0x6e));var _0xef6e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf6ee[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xef6e('0x0'));var util=require(_0xef6e('0x1'));var path=require(_0xef6e('0x2'));var timeout=require(_0xef6e('0x3'));var express=require(_0xef6e('0x4'));var router=express[_0xef6e('0x5')]();var fs_extra=require(_0xef6e('0x6'));var auth=require(_0xef6e('0x7'));var interaction=require(_0xef6e('0x8'));var config=require(_0xef6e('0x9'));var controller=require(_0xef6e('0xa'));router[_0xef6e('0xb')]('/',auth['isAuthenticated'](),controller[_0xef6e('0xc')]);router[_0xef6e('0xb')](_0xef6e('0xd'),auth[_0xef6e('0xe')](),controller['describe']);router[_0xef6e('0xb')](_0xef6e('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xef6e('0x10')]('/',auth[_0xef6e('0xe')](),controller[_0xef6e('0x11')]);router[_0xef6e('0x12')]('/:id',auth[_0xef6e('0xe')](),controller['update']);router[_0xef6e('0x13')](_0xef6e('0xf'),auth['isAuthenticated'](),controller[_0xef6e('0x14')]);module['exports']=router; \ No newline at end of file +var _0x7c3a=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./userProfileSection.controller'];(function(_0x2891d1,_0x2ddd3e){var _0x486948=function(_0x13fa0f){while(--_0x13fa0f){_0x2891d1['push'](_0x2891d1['shift']());}};_0x486948(++_0x2ddd3e);}(_0x7c3a,0x1c6));var _0xa7c3=function(_0x2181b1,_0x569637){_0x2181b1=_0x2181b1-0x0;var _0x530548=_0x7c3a[_0x2181b1];return _0x530548;};'use strict';var multer=require(_0xa7c3('0x0'));var util=require(_0xa7c3('0x1'));var path=require('path');var timeout=require(_0xa7c3('0x2'));var express=require(_0xa7c3('0x3'));var router=express[_0xa7c3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa7c3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa7c3('0x6'));var controller=require(_0xa7c3('0x7'));router[_0xa7c3('0x8')]('/',auth[_0xa7c3('0x9')](),controller[_0xa7c3('0xa')]);router[_0xa7c3('0x8')](_0xa7c3('0xb'),auth[_0xa7c3('0x9')](),controller[_0xa7c3('0xc')]);router['get'](_0xa7c3('0xd'),auth[_0xa7c3('0x9')](),controller[_0xa7c3('0xe')]);router[_0xa7c3('0xf')]('/',auth[_0xa7c3('0x9')](),controller[_0xa7c3('0x10')]);router['put'](_0xa7c3('0xd'),auth[_0xa7c3('0x9')](),controller[_0xa7c3('0x11')]);router[_0xa7c3('0x12')]('/:id',auth[_0xa7c3('0x9')](),controller[_0xa7c3('0x13')]);module[_0xa7c3('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 52e1e7e..c3a3b0a 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 _0x4b68=['sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','join','getDataValue','split'];(function(_0x5d0e5c,_0x1eb95f){var _0x2c4bd4=function(_0x5528dd){while(--_0x5528dd){_0x5d0e5c['push'](_0x5d0e5c['shift']());}};_0x2c4bd4(++_0x1eb95f);}(_0x4b68,0x129));var _0x84b6=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4b68[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x84b6('0x0'));module[_0x84b6('0x1')]={'name':{'type':Sequelize[_0x84b6('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x84b6('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x84b6('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x84b6('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x84b6('0x2')],'set':function(_0x431bcf){this[_0x84b6('0x5')]('crudPermissions',_0x431bcf?_0x431bcf[_0x84b6('0x6')](''):[]);},'get':function(){return this[_0x84b6('0x7')]('crudPermissions')?this[_0x84b6('0x7')]('crudPermissions')[_0x84b6('0x8')](''):[];}}}; \ No newline at end of file +var _0x8979=['INTEGER','BOOLEAN','crudPermissions','join','getDataValue','split','sequelize','exports','STRING'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x8979,0x16e));var _0x9897=function(_0x3271fb,_0x3bd711){_0x3271fb=_0x3271fb-0x0;var _0x4d90a4=_0x8979[_0x3271fb];return _0x4d90a4;};'use strict';var Sequelize=require(_0x9897('0x0'));module[_0x9897('0x1')]={'name':{'type':Sequelize[_0x9897('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x9897('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x9897('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x1e20e4){this['setDataValue'](_0x9897('0x5'),_0x1e20e4?_0x1e20e4[_0x9897('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x9897('0x5'))?this[_0x9897('0x7')]('crudPermissions')[_0x9897('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 225855b..f11cf28 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 _0x2faf=['intersection','fields','length','hasOwnProperty','nolimit','limit','order','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0xf71d79,_0x20bf46){var _0x375292=function(_0x269dbf){while(--_0x269dbf){_0xf71d79['push'](_0xf71d79['shift']());}};_0x375292(++_0x20bf46);}(_0x2faf,0x133));var _0xf2fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2faf[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf2fa('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf2fa('0x1'));var moment=require('moment');var BPromise=require(_0xf2fa('0x2'));var Mustache=require(_0xf2fa('0x3'));var util=require(_0xf2fa('0x4'));var path=require(_0xf2fa('0x5'));var sox=require(_0xf2fa('0x6'));var csv=require(_0xf2fa('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf2fa('0x8'));var _=require(_0xf2fa('0x9'));var squel=require(_0xf2fa('0xa'));var crypto=require(_0xf2fa('0xb'));var jsforce=require(_0xf2fa('0xc'));var deskjs=require(_0xf2fa('0xd'));var toCsv=require(_0xf2fa('0x7'));var querystring=require(_0xf2fa('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf2fa('0xf'));var qs=require(_0xf2fa('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf2fa('0x11'))(_0xf2fa('0x12'));var utils=require('../../config/utils');var config=require(_0xf2fa('0x13'));var licenseUtil=require(_0xf2fa('0x14'));var db=require(_0xf2fa('0x15'))['db'];function respondWithStatusCode(_0x332b84,_0x59b109){_0x59b109=_0x59b109||0xcc;return function(_0x190a48){if(_0x190a48){return _0x332b84['sendStatus'](_0x59b109);}return _0x332b84[_0xf2fa('0x16')](_0x59b109)['end']();};}function respondWithResult(_0x25d94b,_0x4e0a34){_0x4e0a34=_0x4e0a34||0xc8;return function(_0x392134){if(_0x392134){return _0x25d94b[_0xf2fa('0x16')](_0x4e0a34)[_0xf2fa('0x17')](_0x392134);}};}function respondWithFilteredResult(_0x1957e2,_0x17013c){return function(_0x3439a5){if(_0x3439a5){var _0x3fd151=_0x3439a5[_0xf2fa('0x18')],_0x3cc4ad=_0x17013c['offset'],_0x316c68=_0x17013c[_0xf2fa('0x19')]+_0x17013c['limit'],_0x301497;if(_0x316c68>=_0x3fd151){_0x316c68=_0x3fd151;_0x301497=0xc8;}else{_0x301497=0xce;}_0x1957e2[_0xf2fa('0x16')](_0x301497);return _0x1957e2[_0xf2fa('0x1a')](_0xf2fa('0x1b'),_0x3cc4ad+'-'+_0x316c68+'/'+_0x3fd151)[_0xf2fa('0x17')](_0x3439a5);}return null;};}function patchUpdates(_0x1d2421){return function(_0x3d0a7c){try{jsonpatch[_0xf2fa('0x1c')](_0x3d0a7c,_0x1d2421,!![]);}catch(_0x156987){return BPromise[_0xf2fa('0x1d')](_0x156987);}return _0x3d0a7c['save']();};}function saveUpdates(_0x1305e7,_0x513bfb){return function(_0x480756){if(_0x480756){return _0x480756[_0xf2fa('0x1e')](_0x1305e7)[_0xf2fa('0x1f')](function(_0x2ed9f3){return _0x2ed9f3;});}return null;};}function removeEntity(_0x4750a0,_0x2dc62a){return function(_0x536abe){if(_0x536abe){return _0x536abe[_0xf2fa('0x20')]()[_0xf2fa('0x1f')](function(){_0x4750a0[_0xf2fa('0x16')](0xcc)[_0xf2fa('0x21')]();});}};}function handleEntityNotFound(_0x572a9c,_0x4c3991){return function(_0x128865){if(!_0x128865){_0x572a9c['sendStatus'](0x194);}return _0x128865;};}function handleError(_0x4dec8d,_0x3757e8){_0x3757e8=_0x3757e8||0x1f4;return function(_0x4d9276){logger[_0xf2fa('0x22')](_0x4d9276[_0xf2fa('0x23')]);if(_0x4d9276[_0xf2fa('0x24')]){delete _0x4d9276[_0xf2fa('0x24')];}_0x4dec8d[_0xf2fa('0x16')](_0x3757e8)['send'](_0x4d9276);};}exports['index']=function(_0x49f101,_0x271aac){var _0x553793={},_0x52fa0f={},_0x163678={'count':0x0,'rows':[]};var _0x316f54=_[_0xf2fa('0x25')](db[_0xf2fa('0x26')][_0xf2fa('0x27')],function(_0x1cb157){return{'name':_0x1cb157[_0xf2fa('0x28')],'type':_0x1cb157[_0xf2fa('0x29')][_0xf2fa('0x2a')]};});_0x52fa0f[_0xf2fa('0x2b')]=_[_0xf2fa('0x25')](_0x316f54,'name');_0x52fa0f[_0xf2fa('0x2c')]=_[_0xf2fa('0x2d')](_0x49f101['query']);_0x52fa0f[_0xf2fa('0x2e')]=_['intersection'](_0x52fa0f[_0xf2fa('0x2b')],_0x52fa0f['query']);_0x553793[_0xf2fa('0x2f')]=_[_0xf2fa('0x30')](_0x52fa0f[_0xf2fa('0x2b')],qs[_0xf2fa('0x31')](_0x49f101['query'][_0xf2fa('0x31')]));_0x553793[_0xf2fa('0x2f')]=_0x553793[_0xf2fa('0x2f')][_0xf2fa('0x32')]?_0x553793[_0xf2fa('0x2f')]:_0x52fa0f[_0xf2fa('0x2b')];if(!_0x49f101[_0xf2fa('0x2c')][_0xf2fa('0x33')](_0xf2fa('0x34'))){_0x553793[_0xf2fa('0x35')]=qs[_0xf2fa('0x35')](_0x49f101[_0xf2fa('0x2c')][_0xf2fa('0x35')]);_0x553793[_0xf2fa('0x19')]=qs[_0xf2fa('0x19')](_0x49f101[_0xf2fa('0x2c')][_0xf2fa('0x19')]);}_0x553793[_0xf2fa('0x36')]=qs['sort'](_0x49f101[_0xf2fa('0x2c')]['sort']);_0x553793[_0xf2fa('0x37')]=qs[_0xf2fa('0x2e')](_['pick'](_0x49f101[_0xf2fa('0x2c')],_0x52fa0f[_0xf2fa('0x2e')]),_0x316f54);if(_0x49f101[_0xf2fa('0x2c')][_0xf2fa('0x38')]){_0x553793['where']=_[_0xf2fa('0x39')](_0x553793[_0xf2fa('0x37')],{'$or':_['map'](_0x316f54,function(_0x84ec7b){if(_0x84ec7b[_0xf2fa('0x29')]!==_0xf2fa('0x3a')){var _0x4a04d8={};_0x4a04d8[_0x84ec7b[_0xf2fa('0x24')]]={'$like':'%'+_0x49f101[_0xf2fa('0x2c')][_0xf2fa('0x38')]+'%'};return _0x4a04d8;}})});}_0x553793=_['merge']({},_0x553793,_0x49f101[_0xf2fa('0x3b')]);var _0x5e4f43={'where':_0x553793[_0xf2fa('0x37')]};return db['UserProfileSection'][_0xf2fa('0x18')](_0x5e4f43)[_0xf2fa('0x1f')](function(_0x44255e){_0x163678[_0xf2fa('0x18')]=_0x44255e;if(_0x49f101[_0xf2fa('0x2c')][_0xf2fa('0x3c')]){_0x553793[_0xf2fa('0x3d')]=[{'all':!![]}];}return db[_0xf2fa('0x26')][_0xf2fa('0x3e')](_0x553793);})[_0xf2fa('0x1f')](function(_0x290d8e){_0x163678[_0xf2fa('0x3f')]=_0x290d8e;return _0x163678;})['then'](respondWithFilteredResult(_0x271aac,_0x553793))['catch'](handleError(_0x271aac,null));};exports[_0xf2fa('0x40')]=function(_0x481308,_0x3e2b1f){var _0x5f4e5a={'raw':![],'where':{'id':_0x481308[_0xf2fa('0x41')]['id']}},_0x320e3a={};_0x320e3a['model']=_[_0xf2fa('0x2d')](db['UserProfileSection'][_0xf2fa('0x27')]);_0x320e3a[_0xf2fa('0x2c')]=_[_0xf2fa('0x2d')](_0x481308[_0xf2fa('0x2c')]);_0x320e3a[_0xf2fa('0x2e')]=_[_0xf2fa('0x30')](_0x320e3a[_0xf2fa('0x2b')],_0x320e3a[_0xf2fa('0x2c')]);_0x5f4e5a[_0xf2fa('0x2f')]=_[_0xf2fa('0x30')](_0x320e3a['model'],qs[_0xf2fa('0x31')](_0x481308[_0xf2fa('0x2c')][_0xf2fa('0x31')]));_0x5f4e5a[_0xf2fa('0x2f')]=_0x5f4e5a[_0xf2fa('0x2f')][_0xf2fa('0x32')]?_0x5f4e5a[_0xf2fa('0x2f')]:_0x320e3a[_0xf2fa('0x2b')];if(_0x481308['query'][_0xf2fa('0x3c')]){_0x5f4e5a[_0xf2fa('0x3d')]=[{'all':!![]}];}_0x5f4e5a=_[_0xf2fa('0x39')]({},_0x5f4e5a,_0x481308['options']);return db[_0xf2fa('0x26')][_0xf2fa('0x42')](_0x5f4e5a)[_0xf2fa('0x1f')](handleEntityNotFound(_0x3e2b1f,null))['then'](respondWithResult(_0x3e2b1f,null))[_0xf2fa('0x43')](handleError(_0x3e2b1f,null));};exports[_0xf2fa('0x44')]=function(_0x500748,_0x156e86){return db[_0xf2fa('0x26')]['create'](_0x500748['body'],{})[_0xf2fa('0x1f')](respondWithResult(_0x156e86,0xc9))['catch'](handleError(_0x156e86,null));};exports['update']=function(_0x2cbd94,_0x18ea91){if(_0x2cbd94['body']['id']){delete _0x2cbd94[_0xf2fa('0x45')]['id'];}return db['UserProfileSection'][_0xf2fa('0x42')]({'where':{'id':_0x2cbd94[_0xf2fa('0x41')]['id']}})[_0xf2fa('0x1f')](handleEntityNotFound(_0x18ea91,null))['then'](saveUpdates(_0x2cbd94[_0xf2fa('0x45')],null))[_0xf2fa('0x1f')](respondWithResult(_0x18ea91,null))[_0xf2fa('0x43')](handleError(_0x18ea91,null));};exports[_0xf2fa('0x20')]=function(_0x2a5269,_0x2da95a){return db[_0xf2fa('0x26')][_0xf2fa('0x42')]({'where':{'id':_0x2a5269[_0xf2fa('0x41')]['id']}})[_0xf2fa('0x1f')](handleEntityNotFound(_0x2da95a,null))[_0xf2fa('0x1f')](removeEntity(_0x2da95a,null))['catch'](handleError(_0x2da95a,null));};exports[_0xf2fa('0x46')]=function(_0x2fb806,_0xde9d6b){return db[_0xf2fa('0x26')][_0xf2fa('0x46')]()[_0xf2fa('0x1f')](respondWithResult(_0xde9d6b,null))['catch'](handleError(_0xde9d6b,null));}; \ No newline at end of file +var _0xb117=['intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','then','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','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/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','index','map','UserProfileSection','rawAttributes','fieldName','key','model','query','keys','filters'];(function(_0x190617,_0x3d28d3){var _0x867b0d=function(_0x3fa9ed){while(--_0x3fa9ed){_0x190617['push'](_0x190617['shift']());}};_0x867b0d(++_0x3d28d3);}(_0xb117,0x196));var _0x7b11=function(_0xcb287f,_0x4722f4){_0xcb287f=_0xcb287f-0x0;var _0x4f6ff9=_0xb117[_0xcb287f];return _0x4f6ff9;};'use strict';var emlformat=require(_0x7b11('0x0'));var rimraf=require(_0x7b11('0x1'));var zipdir=require(_0x7b11('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b11('0x3'));var moment=require(_0x7b11('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7b11('0x5'));var util=require(_0x7b11('0x6'));var path=require(_0x7b11('0x7'));var sox=require(_0x7b11('0x8'));var csv=require(_0x7b11('0x9'));var ejs=require(_0x7b11('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b11('0xb'));var squel=require(_0x7b11('0xc'));var crypto=require(_0x7b11('0xd'));var jsforce=require(_0x7b11('0xe'));var deskjs=require(_0x7b11('0xf'));var toCsv=require(_0x7b11('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7b11('0x10'));var authService=require(_0x7b11('0x11'));var qs=require(_0x7b11('0x12'));var as=require(_0x7b11('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b11('0x14'))('api');var utils=require(_0x7b11('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7b11('0x16'));var db=require(_0x7b11('0x17'))['db'];function respondWithStatusCode(_0xf9a2a6,_0x52967d){_0x52967d=_0x52967d||0xcc;return function(_0x3869dc){if(_0x3869dc){return _0xf9a2a6[_0x7b11('0x18')](_0x52967d);}return _0xf9a2a6['status'](_0x52967d)['end']();};}function respondWithResult(_0x21f5af,_0x3f2a75){_0x3f2a75=_0x3f2a75||0xc8;return function(_0x4fa202){if(_0x4fa202){return _0x21f5af[_0x7b11('0x19')](_0x3f2a75)[_0x7b11('0x1a')](_0x4fa202);}};}function respondWithFilteredResult(_0x19415b,_0x33e71f){return function(_0x1595aa){if(_0x1595aa){var _0x5afbd9=_0x1595aa[_0x7b11('0x1b')],_0x1fb7c5=_0x33e71f['offset'],_0x47eefb=_0x33e71f[_0x7b11('0x1c')]+_0x33e71f[_0x7b11('0x1d')],_0x1d22ed;if(_0x47eefb>=_0x5afbd9){_0x47eefb=_0x5afbd9;_0x1d22ed=0xc8;}else{_0x1d22ed=0xce;}_0x19415b['status'](_0x1d22ed);return _0x19415b[_0x7b11('0x1e')](_0x7b11('0x1f'),_0x1fb7c5+'-'+_0x47eefb+'/'+_0x5afbd9)['json'](_0x1595aa);}return null;};}function patchUpdates(_0x5d111d){return function(_0xf19730){try{jsonpatch[_0x7b11('0x20')](_0xf19730,_0x5d111d,!![]);}catch(_0x1f4ecf){return BPromise[_0x7b11('0x21')](_0x1f4ecf);}return _0xf19730[_0x7b11('0x22')]();};}function saveUpdates(_0x4f70c9,_0x1231ba){return function(_0x554abb){if(_0x554abb){return _0x554abb[_0x7b11('0x23')](_0x4f70c9)['then'](function(_0x57d349){return _0x57d349;});}return null;};}function removeEntity(_0x20e4f5,_0xaecaa5){return function(_0x355746){if(_0x355746){return _0x355746[_0x7b11('0x24')]()['then'](function(){_0x20e4f5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1717b3,_0x584315){return function(_0x4e0902){if(!_0x4e0902){_0x1717b3[_0x7b11('0x18')](0x194);}return _0x4e0902;};}function handleError(_0x373d68,_0x280f83){_0x280f83=_0x280f83||0x1f4;return function(_0x38cd7c){logger[_0x7b11('0x25')](_0x38cd7c[_0x7b11('0x26')]);if(_0x38cd7c['name']){delete _0x38cd7c[_0x7b11('0x27')];}_0x373d68['status'](_0x280f83)['send'](_0x38cd7c);};}exports[_0x7b11('0x28')]=function(_0x49169c,_0x41c4b1){var _0x32abed={},_0x2608e5={},_0x2d2582={'count':0x0,'rows':[]};var _0x29a282=_[_0x7b11('0x29')](db[_0x7b11('0x2a')][_0x7b11('0x2b')],function(_0x1c67ca){return{'name':_0x1c67ca[_0x7b11('0x2c')],'type':_0x1c67ca['type'][_0x7b11('0x2d')]};});_0x2608e5[_0x7b11('0x2e')]=_[_0x7b11('0x29')](_0x29a282,_0x7b11('0x27'));_0x2608e5[_0x7b11('0x2f')]=_[_0x7b11('0x30')](_0x49169c[_0x7b11('0x2f')]);_0x2608e5[_0x7b11('0x31')]=_[_0x7b11('0x32')](_0x2608e5[_0x7b11('0x2e')],_0x2608e5[_0x7b11('0x2f')]);_0x32abed[_0x7b11('0x33')]=_[_0x7b11('0x32')](_0x2608e5[_0x7b11('0x2e')],qs['fields'](_0x49169c['query']['fields']));_0x32abed['attributes']=_0x32abed[_0x7b11('0x33')][_0x7b11('0x34')]?_0x32abed[_0x7b11('0x33')]:_0x2608e5[_0x7b11('0x2e')];if(!_0x49169c[_0x7b11('0x2f')][_0x7b11('0x35')](_0x7b11('0x36'))){_0x32abed[_0x7b11('0x1d')]=qs[_0x7b11('0x1d')](_0x49169c['query'][_0x7b11('0x1d')]);_0x32abed['offset']=qs[_0x7b11('0x1c')](_0x49169c['query'][_0x7b11('0x1c')]);}_0x32abed['order']=qs[_0x7b11('0x37')](_0x49169c[_0x7b11('0x2f')][_0x7b11('0x37')]);_0x32abed['where']=qs[_0x7b11('0x31')](_[_0x7b11('0x38')](_0x49169c[_0x7b11('0x2f')],_0x2608e5['filters']),_0x29a282);if(_0x49169c[_0x7b11('0x2f')][_0x7b11('0x39')]){_0x32abed[_0x7b11('0x3a')]=_[_0x7b11('0x3b')](_0x32abed['where'],{'$or':_[_0x7b11('0x29')](_0x29a282,function(_0x55f7d7){if(_0x55f7d7[_0x7b11('0x3c')]!==_0x7b11('0x3d')){var _0x24ee0d={};_0x24ee0d[_0x55f7d7[_0x7b11('0x27')]]={'$like':'%'+_0x49169c[_0x7b11('0x2f')]['filter']+'%'};return _0x24ee0d;}})});}_0x32abed=_[_0x7b11('0x3b')]({},_0x32abed,_0x49169c[_0x7b11('0x3e')]);var _0x560637={'where':_0x32abed[_0x7b11('0x3a')]};return db['UserProfileSection'][_0x7b11('0x1b')](_0x560637)[_0x7b11('0x3f')](function(_0x4559fc){_0x2d2582['count']=_0x4559fc;if(_0x49169c['query'][_0x7b11('0x40')]){_0x32abed['include']=[{'all':!![]}];}return db[_0x7b11('0x2a')][_0x7b11('0x41')](_0x32abed);})[_0x7b11('0x3f')](function(_0x2d9976){_0x2d2582[_0x7b11('0x42')]=_0x2d9976;return _0x2d2582;})[_0x7b11('0x3f')](respondWithFilteredResult(_0x41c4b1,_0x32abed))[_0x7b11('0x43')](handleError(_0x41c4b1,null));};exports[_0x7b11('0x44')]=function(_0x458b34,_0x77e980){var _0x1e3d9b={'raw':![],'where':{'id':_0x458b34[_0x7b11('0x45')]['id']}},_0x3e1da3={};_0x3e1da3[_0x7b11('0x2e')]=_[_0x7b11('0x30')](db[_0x7b11('0x2a')][_0x7b11('0x2b')]);_0x3e1da3[_0x7b11('0x2f')]=_['keys'](_0x458b34[_0x7b11('0x2f')]);_0x3e1da3[_0x7b11('0x31')]=_['intersection'](_0x3e1da3[_0x7b11('0x2e')],_0x3e1da3['query']);_0x1e3d9b[_0x7b11('0x33')]=_[_0x7b11('0x32')](_0x3e1da3[_0x7b11('0x2e')],qs[_0x7b11('0x46')](_0x458b34[_0x7b11('0x2f')][_0x7b11('0x46')]));_0x1e3d9b['attributes']=_0x1e3d9b[_0x7b11('0x33')][_0x7b11('0x34')]?_0x1e3d9b[_0x7b11('0x33')]:_0x3e1da3[_0x7b11('0x2e')];if(_0x458b34[_0x7b11('0x2f')][_0x7b11('0x40')]){_0x1e3d9b[_0x7b11('0x47')]=[{'all':!![]}];}_0x1e3d9b=_['merge']({},_0x1e3d9b,_0x458b34['options']);return db[_0x7b11('0x2a')][_0x7b11('0x48')](_0x1e3d9b)[_0x7b11('0x3f')](handleEntityNotFound(_0x77e980,null))['then'](respondWithResult(_0x77e980,null))[_0x7b11('0x43')](handleError(_0x77e980,null));};exports[_0x7b11('0x49')]=function(_0x3131cd,_0x538382){return db[_0x7b11('0x2a')][_0x7b11('0x49')](_0x3131cd[_0x7b11('0x4a')],{})['then'](respondWithResult(_0x538382,0xc9))[_0x7b11('0x43')](handleError(_0x538382,null));};exports[_0x7b11('0x23')]=function(_0x38c465,_0x45bf9d){if(_0x38c465[_0x7b11('0x4a')]['id']){delete _0x38c465[_0x7b11('0x4a')]['id'];}return db[_0x7b11('0x2a')]['find']({'where':{'id':_0x38c465[_0x7b11('0x45')]['id']}})[_0x7b11('0x3f')](handleEntityNotFound(_0x45bf9d,null))[_0x7b11('0x3f')](saveUpdates(_0x38c465[_0x7b11('0x4a')],null))[_0x7b11('0x3f')](respondWithResult(_0x45bf9d,null))[_0x7b11('0x43')](handleError(_0x45bf9d,null));};exports['destroy']=function(_0x1fa47e,_0x343ecf){return db['UserProfileSection']['find']({'where':{'id':_0x1fa47e[_0x7b11('0x45')]['id']}})['then'](handleEntityNotFound(_0x343ecf,null))[_0x7b11('0x3f')](removeEntity(_0x343ecf,null))[_0x7b11('0x43')](handleError(_0x343ecf,null));};exports['describe']=function(_0x5df2d8,_0xd16220){return db[_0x7b11('0x2a')][_0x7b11('0x4b')]()[_0x7b11('0x3f')](respondWithResult(_0xd16220,null))[_0x7b11('0x43')](handleError(_0xd16220,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index dfaf628..5e34989 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 _0xe148=['compositeIndex','sectionId','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','UserProfileSection','user_profile_has_sections'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe148,0x9e));var _0x8e14=function(_0x43de22,_0x1eced6){_0x43de22=_0x43de22-0x0;var _0x4b15ee=_0xe148[_0x43de22];return _0x4b15ee;};'use strict';var _=require(_0x8e14('0x0'));var util=require(_0x8e14('0x1'));var logger=require('../../config/logger')(_0x8e14('0x2'));var moment=require(_0x8e14('0x3'));var BPromise=require('bluebird');var rp=require(_0x8e14('0x4'));var fs=require('fs');var path=require(_0x8e14('0x5'));var rimraf=require(_0x8e14('0x6'));var config=require(_0x8e14('0x7'));var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x33307e,_0x1f5039){return _0x33307e['define'](_0x8e14('0x8'),attributes,{'tableName':_0x8e14('0x9'),'paranoid':![],'indexes':[{'name':_0x8e14('0xa'),'fields':[_0x8e14('0xb'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd827=['sectionId','userProfileId','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./userProfileSection.attributes','exports'];(function(_0x4ad10c,_0x55a996){var _0x36c0df=function(_0x43821b){while(--_0x43821b){_0x4ad10c['push'](_0x4ad10c['shift']());}};_0x36c0df(++_0x55a996);}(_0xd827,0x115));var _0x7d82=function(_0x3d3531,_0x1e4748){_0x3d3531=_0x3d3531-0x0;var _0x299781=_0xd827[_0x3d3531];return _0x299781;};'use strict';var _=require(_0x7d82('0x0'));var util=require(_0x7d82('0x1'));var logger=require(_0x7d82('0x2'))(_0x7d82('0x3'));var moment=require('moment');var BPromise=require(_0x7d82('0x4'));var rp=require(_0x7d82('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7d82('0x6'));var attributes=require(_0x7d82('0x7'));module[_0x7d82('0x8')]=function(_0x37f66b,_0x38328f){return _0x37f66b['define']('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x7d82('0x9'),_0x7d82('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index f2deb6d..7d2069c 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 _0xd9b5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash'];(function(_0x99868f,_0xbdb8e7){var _0x27a71b=function(_0x41feca){while(--_0x41feca){_0x99868f['push'](_0x99868f['shift']());}};_0x27a71b(++_0xbdb8e7);}(_0xd9b5,0x7d));var _0x5d9b=function(_0x375600,_0x383a7b){_0x375600=_0x375600-0x0;var _0x441596=_0xd9b5[_0x375600];return _0x441596;};'use strict';var _=require(_0x5d9b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5d9b('0x1'));var fs=require('fs');var Redis=require(_0x5d9b('0x2'));var db=require(_0x5d9b('0x3'))['db'];var utils=require(_0x5d9b('0x4'));var logger=require(_0x5d9b('0x5'))(_0x5d9b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5d9b('0x7')][_0x5d9b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x22b01b,_0x53cdff,_0x51caec){return new BPromise(function(_0x4f8f0d,_0x495dbb){return client[_0x5d9b('0x9')](_0x22b01b,_0x51caec)[_0x5d9b('0xa')](function(_0x254d53){logger[_0x5d9b('0xb')](_0x5d9b('0xc'),_0x53cdff,'request\x20sent');logger[_0x5d9b('0xd')](_0x5d9b('0xe'),_0x53cdff,_0x5d9b('0xf'),JSON[_0x5d9b('0x10')](_0x254d53));if(_0x254d53[_0x5d9b('0x11')]){if(_0x254d53['error'][_0x5d9b('0x12')]===0x1f4){logger[_0x5d9b('0x11')](_0x5d9b('0xc'),_0x53cdff,_0x254d53[_0x5d9b('0x11')]['message']);return _0x495dbb(_0x254d53[_0x5d9b('0x11')]['message']);}logger[_0x5d9b('0x11')](_0x5d9b('0xc'),_0x53cdff,_0x254d53[_0x5d9b('0x11')]['message']);return _0x4f8f0d(_0x254d53[_0x5d9b('0x11')]['message']);}else{logger[_0x5d9b('0xb')](_0x5d9b('0xc'),_0x53cdff,_0x5d9b('0xf'));_0x4f8f0d(_0x254d53['result'][_0x5d9b('0x13')]);}})[_0x5d9b('0x14')](function(_0x3614e0){logger[_0x5d9b('0x11')](_0x5d9b('0xc'),_0x53cdff,_0x3614e0);_0x495dbb(_0x3614e0);});});} \ No newline at end of file +var _0xe963=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment'];(function(_0x4001ad,_0x1e22dd){var _0x4c7ec2=function(_0x24cb8a){while(--_0x24cb8a){_0x4001ad['push'](_0x4001ad['shift']());}};_0x4c7ec2(++_0x1e22dd);}(_0xe963,0xfa));var _0x3e96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe963[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3e96('0x0'));var moment=require(_0x3e96('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e96('0x2'));var db=require(_0x3e96('0x3'))['db'];var utils=require(_0x3e96('0x4'));var logger=require(_0x3e96('0x5'))(_0x3e96('0x6'));var config=require(_0x3e96('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3e96('0x8')][_0x3e96('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40c61f,_0x20923c,_0x4536fa){return new BPromise(function(_0x37bd3c,_0x11cf2a){return client['request'](_0x40c61f,_0x4536fa)[_0x3e96('0xa')](function(_0x307f28){logger[_0x3e96('0xb')](_0x3e96('0xc'),_0x20923c,'request\x20sent');logger[_0x3e96('0xd')](_0x3e96('0xe'),_0x20923c,'request\x20sent',JSON[_0x3e96('0xf')](_0x307f28));if(_0x307f28[_0x3e96('0x10')]){if(_0x307f28['error'][_0x3e96('0x11')]===0x1f4){logger[_0x3e96('0x10')](_0x3e96('0xc'),_0x20923c,_0x307f28[_0x3e96('0x10')][_0x3e96('0x12')]);return _0x11cf2a(_0x307f28['error'][_0x3e96('0x12')]);}logger[_0x3e96('0x10')](_0x3e96('0xc'),_0x20923c,_0x307f28[_0x3e96('0x10')][_0x3e96('0x12')]);return _0x37bd3c(_0x307f28[_0x3e96('0x10')][_0x3e96('0x12')]);}else{logger[_0x3e96('0xb')](_0x3e96('0xc'),_0x20923c,'request\x20sent');_0x37bd3c(_0x307f28[_0x3e96('0x13')][_0x3e96('0x12')]);}})[_0x3e96('0x14')](function(_0x401dbc){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x20923c,_0x401dbc);_0x11cf2a(_0x401dbc);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index a8f71b4..d1b22d9 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 _0xb676=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','multer'];(function(_0x2006b0,_0xefc16e){var _0x2a0e91=function(_0x2f9555){while(--_0x2f9555){_0x2006b0['push'](_0x2006b0['shift']());}};_0x2a0e91(++_0xefc16e);}(_0xb676,0xbc));var _0x6b67=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0xb676[_0x11a220];return _0x20d8fe;};'use strict';var multer=require(_0x6b67('0x0'));var util=require('util');var path=require(_0x6b67('0x1'));var timeout=require(_0x6b67('0x2'));var express=require(_0x6b67('0x3'));var router=express[_0x6b67('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6b67('0x5'));var config=require(_0x6b67('0x6'));module['exports']=router; \ No newline at end of file +var _0x6f2f=['Router','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x919bbb,_0x55ef48){var _0x40971a=function(_0xc823b6){while(--_0xc823b6){_0x919bbb['push'](_0x919bbb['shift']());}};_0x40971a(++_0x55ef48);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x6f2f[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require(_0xf6f2('0x0'));var util=require(_0xf6f2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf6f2('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf6f2('0x3'));var config=require(_0xf6f2('0x4'));module[_0xf6f2('0x5')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 70ceebc..9f359b9 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 _0xb10b=['sequelize','INTEGER'];(function(_0x1a05b5,_0x1abf6b){var _0x5add69=function(_0x136f6e){while(--_0x136f6e){_0x1a05b5['push'](_0x1a05b5['shift']());}};_0x5add69(++_0x1abf6b);}(_0xb10b,0x12a));var _0xbb10=function(_0x54cda0,_0x3bf6e9){_0x54cda0=_0x54cda0-0x0;var _0x26f2c2=_0xb10b[_0x54cda0];return _0x26f2c2;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x31999,_0x52ef16){var _0xdb781d=function(_0x4b21bd){while(--_0x4b21bd){_0x31999['push'](_0x31999['shift']());}};_0xdb781d(++_0x52ef16);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 7cfea8e..343a193 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 _0xa0a9=['../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0xa0a9,0x147));var _0x9a0a=function(_0x1bbef3,_0xed4f27){_0x1bbef3=_0x1bbef3-0x0;var _0xf44fdd=_0xa0a9[_0x1bbef3];return _0xf44fdd;};'use strict';var _=require(_0x9a0a('0x0'));var util=require(_0x9a0a('0x1'));var logger=require(_0x9a0a('0x2'))(_0x9a0a('0x3'));var moment=require(_0x9a0a('0x4'));var BPromise=require(_0x9a0a('0x5'));var rp=require(_0x9a0a('0x6'));var fs=require('fs');var path=require(_0x9a0a('0x7'));var rimraf=require(_0x9a0a('0x8'));var config=require(_0x9a0a('0x9'));var attributes=require(_0x9a0a('0xa'));module[_0x9a0a('0xb')]=function(_0x27b0e4,_0x4ada04){return _0x27b0e4[_0x9a0a('0xc')](_0x9a0a('0xd'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74ca=['define','user_has_sms_queues','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2c8f74,_0x3f0b3e){var _0x4a708c=function(_0x536c04){while(--_0x536c04){_0x2c8f74['push'](_0x2c8f74['shift']());}};_0x4a708c(++_0x3f0b3e);}(_0x74ca,0xca));var _0xa74c=function(_0x5beb1d,_0x46ec37){_0x5beb1d=_0x5beb1d-0x0;var _0x2ab7c6=_0x74ca[_0x5beb1d];return _0x2ab7c6;};'use strict';var _=require(_0xa74c('0x0'));var util=require(_0xa74c('0x1'));var logger=require(_0xa74c('0x2'))('api');var moment=require(_0xa74c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa74c('0x4'));var fs=require('fs');var path=require(_0xa74c('0x5'));var rimraf=require(_0xa74c('0x6'));var config=require(_0xa74c('0x7'));var attributes=require('./userSmsQueue.attributes');module['exports']=function(_0x4a1d9c,_0x21131d){return _0x4a1d9c[_0xa74c('0x8')]('UserSmsQueue',attributes,{'tableName':_0xa74c('0x9'),'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 f70a1dd..04eb18f 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 _0x24af=['UserSmsQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2b0ea8,_0xc2bdce){var _0x25414d=function(_0xfa06cd){while(--_0xfa06cd){_0x2b0ea8['push'](_0x2b0ea8['shift']());}};_0x25414d(++_0xc2bdce);}(_0x24af,0x101));var _0xf24a=function(_0x3abe58,_0x184dd9){_0x3abe58=_0x3abe58-0x0;var _0x457389=_0x24af[_0x3abe58];return _0x457389;};'use strict';var _=require(_0xf24a('0x0'));var util=require(_0xf24a('0x1'));var moment=require('moment');var BPromise=require(_0xf24a('0x2'));var rs=require(_0xf24a('0x3'));var fs=require('fs');var Redis=require(_0xf24a('0x4'));var db=require(_0xf24a('0x5'))['db'];var utils=require(_0xf24a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf24a('0x7'));var jayson=require(_0xf24a('0x8'));var client=jayson['client'][_0xf24a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x203b5b,_0x21ec4b,_0x154932){return new BPromise(function(_0x2fff9e,_0x593e13){return client[_0xf24a('0xa')](_0x203b5b,_0x154932)[_0xf24a('0xb')](function(_0x337efd){logger[_0xf24a('0xc')](_0xf24a('0xd'),_0x21ec4b,_0xf24a('0xe'));logger[_0xf24a('0xf')](_0xf24a('0x10'),_0x21ec4b,_0xf24a('0xe'),JSON['stringify'](_0x337efd));if(_0x337efd[_0xf24a('0x11')]){if(_0x337efd[_0xf24a('0x11')]['code']===0x1f4){logger[_0xf24a('0x11')](_0xf24a('0xd'),_0x21ec4b,_0x337efd[_0xf24a('0x11')][_0xf24a('0x12')]);return _0x593e13(_0x337efd[_0xf24a('0x11')]['message']);}logger[_0xf24a('0x11')](_0xf24a('0xd'),_0x21ec4b,_0x337efd[_0xf24a('0x11')][_0xf24a('0x12')]);return _0x2fff9e(_0x337efd[_0xf24a('0x11')]['message']);}else{logger[_0xf24a('0xc')](_0xf24a('0xd'),_0x21ec4b,_0xf24a('0xe'));_0x2fff9e(_0x337efd[_0xf24a('0x13')]['message']);}})[_0xf24a('0x14')](function(_0x4af23f){logger[_0xf24a('0x11')](_0xf24a('0xd'),_0x21ec4b,_0x4af23f);_0x593e13(_0x4af23f);});});} \ No newline at end of file +var _0x1ae0=['result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x602ca8,_0x568e82){var _0x26e8ab=function(_0x3fb700){while(--_0x3fb700){_0x602ca8['push'](_0x602ca8['shift']());}};_0x26e8ab(++_0x568e82);}(_0x1ae0,0x128));var _0x01ae=function(_0x31bfe0,_0x2fe2bb){_0x31bfe0=_0x31bfe0-0x0;var _0x87bd7d=_0x1ae0[_0x31bfe0];return _0x87bd7d;};'use strict';var _=require(_0x01ae('0x0'));var util=require('util');var moment=require(_0x01ae('0x1'));var BPromise=require('bluebird');var rs=require(_0x01ae('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x01ae('0x3'))['db'];var utils=require(_0x01ae('0x4'));var logger=require('../../config/logger')(_0x01ae('0x5'));var config=require(_0x01ae('0x6'));var jayson=require(_0x01ae('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x564a5b,_0x40411c,_0x338db5){return new BPromise(function(_0x18301d,_0x448610){return client[_0x01ae('0x8')](_0x564a5b,_0x338db5)[_0x01ae('0x9')](function(_0x34b3e3){logger[_0x01ae('0xa')](_0x01ae('0xb'),_0x40411c,_0x01ae('0xc'));logger[_0x01ae('0xd')](_0x01ae('0xe'),_0x40411c,'request\x20sent',JSON[_0x01ae('0xf')](_0x34b3e3));if(_0x34b3e3['error']){if(_0x34b3e3[_0x01ae('0x10')][_0x01ae('0x11')]===0x1f4){logger[_0x01ae('0x10')](_0x01ae('0xb'),_0x40411c,_0x34b3e3['error'][_0x01ae('0x12')]);return _0x448610(_0x34b3e3[_0x01ae('0x10')][_0x01ae('0x12')]);}logger['error'](_0x01ae('0xb'),_0x40411c,_0x34b3e3[_0x01ae('0x10')][_0x01ae('0x12')]);return _0x18301d(_0x34b3e3[_0x01ae('0x10')][_0x01ae('0x12')]);}else{logger['info'](_0x01ae('0xb'),_0x40411c,_0x01ae('0xc'));_0x18301d(_0x34b3e3[_0x01ae('0x13')][_0x01ae('0x12')]);}})[_0x01ae('0x14')](function(_0x2113ec){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x40411c,_0x2113ec);_0x448610(_0x2113ec);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index ca27ec3..9e2768e 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 _0x851a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','path','connect-timeout'];(function(_0x1c6471,_0x29f86e){var _0x474a68=function(_0x2a14d4){while(--_0x2a14d4){_0x1c6471['push'](_0x1c6471['shift']());}};_0x474a68(++_0x29f86e);}(_0x851a,0x19b));var _0xa851=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x851a[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0xa851('0x0'));var util=require('util');var path=require(_0xa851('0x1'));var timeout=require(_0xa851('0x2'));var express=require(_0xa851('0x3'));var router=express[_0xa851('0x4')]();var fs_extra=require(_0xa851('0x5'));var auth=require(_0xa851('0x6'));var interaction=require(_0xa851('0x7'));var config=require(_0xa851('0x8'));module['exports']=router; \ No newline at end of file +var _0x215d=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','multer'];(function(_0x2cc612,_0xa13df0){var _0x452150=function(_0x34be69){while(--_0x34be69){_0x2cc612['push'](_0x2cc612['shift']());}};_0x452150(++_0xa13df0);}(_0x215d,0x187));var _0xd215=function(_0x46b844,_0x55133f){_0x46b844=_0x46b844-0x0;var _0x5c32c9=_0x215d[_0x46b844];return _0x5c32c9;};'use strict';var multer=require(_0xd215('0x0'));var util=require('util');var path=require(_0xd215('0x1'));var timeout=require(_0xd215('0x2'));var express=require(_0xd215('0x3'));var router=express[_0xd215('0x4')]();var fs_extra=require(_0xd215('0x5'));var auth=require(_0xd215('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd215('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 287bb7b..fd096df 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x3a1a4e,_0x4ce67f){var _0x2c0eb8=function(_0x1ec8e1){while(--_0x1ec8e1){_0x3a1a4e['push'](_0x3a1a4e['shift']());}};_0x2c0eb8(++_0x4ce67f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x36e23f,_0x388b59){var _0x5b7846=function(_0x4b3abe){while(--_0x4b3abe){_0x36e23f['push'](_0x36e23f['shift']());}};_0x5b7846(++_0x388b59);}(_0xe706,0xa3));var _0x6e70=function(_0x5815af,_0x361f0b){_0x5815af=_0x5815af-0x0;var _0x3f14cb=_0xe706[_0x5815af];return _0x3f14cb;};'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 2889349..02846db 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 _0x8ef6=['exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes'];(function(_0x8359b,_0x42cbf9){var _0x1d3c4b=function(_0x14f548){while(--_0x14f548){_0x8359b['push'](_0x8359b['shift']());}};_0x1d3c4b(++_0x42cbf9);}(_0x8ef6,0xf2));var _0x68ef=function(_0x29db2e,_0x18eedd){_0x29db2e=_0x29db2e-0x0;var _0x595d8e=_0x8ef6[_0x29db2e];return _0x595d8e;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x950a=['../../config/logger','api','bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes','exports','define','lodash','util'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0x950a,0x111));var _0xa950=function(_0x14a1f3,_0x2d313a){_0x14a1f3=_0x14a1f3-0x0;var _0x1e04cd=_0x950a[_0x14a1f3];return _0x1e04cd;};'use strict';var _=require(_0xa950('0x0'));var util=require(_0xa950('0x1'));var logger=require(_0xa950('0x2'))(_0xa950('0x3'));var moment=require('moment');var BPromise=require(_0xa950('0x4'));var rp=require(_0xa950('0x5'));var fs=require('fs');var path=require(_0xa950('0x6'));var rimraf=require(_0xa950('0x7'));var config=require('../../config/environment');var attributes=require(_0xa950('0x8'));module[_0xa950('0x9')]=function(_0x512c0e,_0x14b4ac){return _0x512c0e[_0xa950('0xa')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 295afd7..c1884cf 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 _0x7101=['message','UserVoiceQueue,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4b7b69,_0x3ab075){var _0x173b4c=function(_0x234d5f){while(--_0x234d5f){_0x4b7b69['push'](_0x4b7b69['shift']());}};_0x173b4c(++_0x3ab075);}(_0x7101,0x164));var _0x1710=function(_0x1da436,_0x2fab9d){_0x1da436=_0x1da436-0x0;var _0xe4468d=_0x7101[_0x1da436];return _0xe4468d;};'use strict';var _=require(_0x1710('0x0'));var util=require(_0x1710('0x1'));var moment=require('moment');var BPromise=require(_0x1710('0x2'));var rs=require(_0x1710('0x3'));var fs=require('fs');var Redis=require(_0x1710('0x4'));var db=require(_0x1710('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1710('0x6'))(_0x1710('0x7'));var config=require(_0x1710('0x8'));var jayson=require(_0x1710('0x9'));var client=jayson[_0x1710('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4dff46,_0x4f2211,_0x4fcf7d){return new BPromise(function(_0x4fee50,_0x281520){return client[_0x1710('0xb')](_0x4dff46,_0x4fcf7d)[_0x1710('0xc')](function(_0xf2368){logger[_0x1710('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x4f2211,_0x1710('0xe'));logger['debug'](_0x1710('0xf'),_0x4f2211,'request\x20sent',JSON['stringify'](_0xf2368));if(_0xf2368['error']){if(_0xf2368[_0x1710('0x10')][_0x1710('0x11')]===0x1f4){logger[_0x1710('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x4f2211,_0xf2368['error'][_0x1710('0x12')]);return _0x281520(_0xf2368[_0x1710('0x10')][_0x1710('0x12')]);}logger[_0x1710('0x10')](_0x1710('0x13'),_0x4f2211,_0xf2368[_0x1710('0x10')][_0x1710('0x12')]);return _0x4fee50(_0xf2368[_0x1710('0x10')][_0x1710('0x12')]);}else{logger[_0x1710('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x4f2211,'request\x20sent');_0x4fee50(_0xf2368[_0x1710('0x14')][_0x1710('0x12')]);}})[_0x1710('0x15')](function(_0x24e064){logger['error'](_0x1710('0x13'),_0x4f2211,_0x24e064);_0x281520(_0x24e064);});});} \ No newline at end of file +var _0x81a6=['code','message','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x1b2083,_0x58af10){var _0x25274a=function(_0xfae2db){while(--_0xfae2db){_0x1b2083['push'](_0x1b2083['shift']());}};_0x25274a(++_0x58af10);}(_0x81a6,0x75));var _0x681a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x81a6[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x681a('0x0'));var util=require('util');var moment=require(_0x681a('0x1'));var BPromise=require('bluebird');var rs=require(_0x681a('0x2'));var fs=require('fs');var Redis=require(_0x681a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x681a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x681a('0x5'));var jayson=require(_0x681a('0x6'));var client=jayson[_0x681a('0x7')][_0x681a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33aaa2,_0xa3a934,_0x1c798f){return new BPromise(function(_0x110ce2,_0x4052aa){return client[_0x681a('0x9')](_0x33aaa2,_0x1c798f)['then'](function(_0x22e45c){logger[_0x681a('0xa')](_0x681a('0xb'),_0xa3a934,_0x681a('0xc'));logger[_0x681a('0xd')](_0x681a('0xe'),_0xa3a934,_0x681a('0xc'),JSON['stringify'](_0x22e45c));if(_0x22e45c['error']){if(_0x22e45c[_0x681a('0xf')][_0x681a('0x10')]===0x1f4){logger[_0x681a('0xf')](_0x681a('0xb'),_0xa3a934,_0x22e45c[_0x681a('0xf')][_0x681a('0x11')]);return _0x4052aa(_0x22e45c[_0x681a('0xf')]['message']);}logger[_0x681a('0xf')](_0x681a('0xb'),_0xa3a934,_0x22e45c[_0x681a('0xf')]['message']);return _0x110ce2(_0x22e45c[_0x681a('0xf')][_0x681a('0x11')]);}else{logger[_0x681a('0xa')](_0x681a('0xb'),_0xa3a934,'request\x20sent');_0x110ce2(_0x22e45c[_0x681a('0x12')]['message']);}})['catch'](function(_0x25b2f5){logger[_0x681a('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0xa3a934,_0x25b2f5);_0x4052aa(_0x25b2f5);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 7ddf3e3..a9ec265 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 _0xfff0=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0xd4b05,_0x62a13f){var _0x2f02f0=function(_0xc2c037){while(--_0xc2c037){_0xd4b05['push'](_0xd4b05['shift']());}};_0x2f02f0(++_0x62a13f);}(_0xfff0,0x139));var _0x0fff=function(_0xff55d,_0x518984){_0xff55d=_0xff55d-0x0;var _0x5fe7d7=_0xfff0[_0xff55d];return _0x5fe7d7;};'use strict';var multer=require('multer');var util=require(_0x0fff('0x0'));var path=require(_0x0fff('0x1'));var timeout=require(_0x0fff('0x2'));var express=require('express');var router=express[_0x0fff('0x3')]();var fs_extra=require(_0x0fff('0x4'));var auth=require(_0x0fff('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0fff('0x6'));module[_0x0fff('0x7')]=router; \ No newline at end of file +var _0x6b20=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0xaa73b5,_0x4a7f38){var _0xe469be=function(_0x5dfadb){while(--_0x5dfadb){_0xaa73b5['push'](_0xaa73b5['shift']());}};_0xe469be(++_0x4a7f38);}(_0x6b20,0xd1));var _0x06b2=function(_0x36e20a,_0x3a0f6e){_0x36e20a=_0x36e20a-0x0;var _0x5b8c0a=_0x6b20[_0x36e20a];return _0x5b8c0a;};'use strict';var multer=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var path=require('path');var timeout=require(_0x06b2('0x2'));var express=require('express');var router=express[_0x06b2('0x3')]();var fs_extra=require(_0x06b2('0x4'));var auth=require(_0x06b2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x06b2('0x6'));module[_0x06b2('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 3e20b0e..3d7107a 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 _0xfcdc=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x462650,_0x5c23a5){var _0x781ddd=function(_0x5d8cd8){while(--_0x5d8cd8){_0x462650['push'](_0x462650['shift']());}};_0x781ddd(++_0x5c23a5);}(_0xfcdc,0x9d));var _0xcfcd=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xfcdc[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xcfcd('0x0'));module[_0xcfcd('0x1')]={'uniqueid':{'type':Sequelize[_0xcfcd('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xcfcd('0x3')},'membername':{'type':Sequelize[_0xcfcd('0x4')],'allowNull':![],'comment':_0xcfcd('0x3')},'UserId':{'type':Sequelize[_0xcfcd('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xcfcd('0x4')],'allowNull':![],'unique':_0xcfcd('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xcfcd('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xcfcd('0x4')],'allowNull':![],'unique':_0xcfcd('0x5'),'comment':_0xcfcd('0x3')},'penalty':{'type':Sequelize[_0xcfcd('0x2')](0xb),'defaultValue':0x0,'comment':_0xcfcd('0x3')},'paused':{'type':Sequelize[_0xcfcd('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x9416=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x4539c5,_0x10af53){var _0x1dfcdb=function(_0x4626be){while(--_0x4626be){_0x4539c5['push'](_0x4539c5['shift']());}};_0x1dfcdb(++_0x10af53);}(_0x9416,0x1a8));var _0x6941=function(_0x4b5a95,_0x10eb5e){_0x4b5a95=_0x4b5a95-0x0;var _0x9540dc=_0x9416[_0x4b5a95];return _0x9540dc;};'use strict';var Sequelize=require(_0x6941('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x6941('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x6941('0x2')},'membername':{'type':Sequelize[_0x6941('0x3')],'allowNull':![],'comment':_0x6941('0x2')},'UserId':{'type':Sequelize[_0x6941('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x6941('0x3')],'allowNull':![],'unique':_0x6941('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x6941('0x1')](0xb),'defaultValue':0x0,'comment':_0x6941('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x6941('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 78333cd..4b8cb8f 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 _0x5a59=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x29fa94,_0x422d7c){var _0x3ef8e9=function(_0x72b20e){while(--_0x72b20e){_0x29fa94['push'](_0x29fa94['shift']());}};_0x3ef8e9(++_0x422d7c);}(_0x5a59,0x87));var _0x95a5=function(_0x334dd6,_0x33f834){_0x334dd6=_0x334dd6-0x0;var _0x562376=_0x5a59[_0x334dd6];return _0x562376;};'use strict';var EventEmitter=require(_0x95a5('0x0'));var UserVoiceQueueRt=require(_0x95a5('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x95a5('0x2')](0x0);var events={'afterCreate':_0x95a5('0x3'),'afterUpdate':_0x95a5('0x4'),'afterDestroy':_0x95a5('0x5')};function emitEvent(_0x53786d){return function(_0x3ceb9c,_0x3ada2a,_0x2d9449){UserVoiceQueueRtEvents[_0x95a5('0x6')](_0x53786d+':'+_0x3ceb9c['id'],_0x3ceb9c);UserVoiceQueueRtEvents[_0x95a5('0x6')](_0x53786d,_0x3ceb9c);_0x2d9449(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x95a5('0x7')](e,emitEvent(event));}}module[_0x95a5('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xb4d6=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserVoiceQueueRt'];(function(_0x196159,_0x4733f2){var _0x57d54b=function(_0x266d9c){while(--_0x266d9c){_0x196159['push'](_0x196159['shift']());}};_0x57d54b(++_0x4733f2);}(_0xb4d6,0xf7));var _0x6b4d=function(_0x4f02ac,_0x5b385e){_0x4f02ac=_0x4f02ac-0x0;var _0x463598=_0xb4d6[_0x4f02ac];return _0x463598;};'use strict';var EventEmitter=require(_0x6b4d('0x0'));var UserVoiceQueueRt=require(_0x6b4d('0x1'))['db'][_0x6b4d('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x6b4d('0x3')](0x0);var events={'afterCreate':_0x6b4d('0x4'),'afterUpdate':_0x6b4d('0x5'),'afterDestroy':_0x6b4d('0x6')};function emitEvent(_0x33dcf8){return function(_0x185140,_0xfe4293,_0x265a3c){UserVoiceQueueRtEvents['emit'](_0x33dcf8+':'+_0x185140['id'],_0x185140);UserVoiceQueueRtEvents[_0x6b4d('0x7')](_0x33dcf8,_0x185140);_0x265a3c(null);};}for(var e in events){if(events[_0x6b4d('0x8')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x6b4d('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 4339a5a..4ff99fa 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 _0x7a61=['bluebird','request-promise','rimraf','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment'];(function(_0x15a9f1,_0x2232ea){var _0x2adb78=function(_0x37bd86){while(--_0x37bd86){_0x15a9f1['push'](_0x15a9f1['shift']());}};_0x2adb78(++_0x2232ea);}(_0x7a61,0x1cf));var _0x17a6=function(_0x390b60,_0x134f75){_0x390b60=_0x390b60-0x0;var _0x516ce4=_0x7a61[_0x390b60];return _0x516ce4;};'use strict';var _=require(_0x17a6('0x0'));var util=require(_0x17a6('0x1'));var logger=require(_0x17a6('0x2'))(_0x17a6('0x3'));var moment=require(_0x17a6('0x4'));var BPromise=require(_0x17a6('0x5'));var rp=require(_0x17a6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17a6('0x7'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module[_0x17a6('0x8')]=function(_0x13bb76,_0x24802a){return _0x13bb76[_0x17a6('0x9')](_0x17a6('0xa'),attributes,{'tableName':_0x17a6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2fdb=['exports','define','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x50f17d,_0x260de1){var _0x207fb8=function(_0x50456a){while(--_0x50456a){_0x50f17d['push'](_0x50f17d['shift']());}};_0x207fb8(++_0x260de1);}(_0x2fdb,0x98));var _0xb2fd=function(_0x4c52f2,_0x3e2b22){_0x4c52f2=_0x4c52f2-0x0;var _0x303bd7=_0x2fdb[_0x4c52f2];return _0x303bd7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb2fd('0x0'))(_0xb2fd('0x1'));var moment=require(_0xb2fd('0x2'));var BPromise=require('bluebird');var rp=require(_0xb2fd('0x3'));var fs=require('fs');var path=require(_0xb2fd('0x4'));var rimraf=require(_0xb2fd('0x5'));var config=require(_0xb2fd('0x6'));var attributes=require(_0xb2fd('0x7'));module[_0xb2fd('0x8')]=function(_0x3eab41,_0x44b5f2){return _0x3eab41[_0xb2fd('0x9')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index a793158..91c372b 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 _0xeaa4=['redis','defaults','localhost','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x23ed31,_0x20e66c){var _0x291622=function(_0x5d023d){while(--_0x5d023d){_0x23ed31['push'](_0x23ed31['shift']());}};_0x291622(++_0x20e66c);}(_0xeaa4,0xc1));var _0x4eaa=function(_0x4693b8,_0x5183be){_0x4693b8=_0x4693b8-0x0;var _0x2b6119=_0xeaa4[_0x4693b8];return _0x2b6119;};'use strict';var _=require(_0x4eaa('0x0'));var util=require(_0x4eaa('0x1'));var moment=require(_0x4eaa('0x2'));var BPromise=require('bluebird');var rs=require(_0x4eaa('0x3'));var fs=require('fs');var Redis=require(_0x4eaa('0x4'));var db=require(_0x4eaa('0x5'))['db'];var utils=require(_0x4eaa('0x6'));var logger=require('../../config/logger')(_0x4eaa('0x7'));var config=require(_0x4eaa('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4eaa('0x9')][_0x4eaa('0xa')]({'port':0x232a});config[_0x4eaa('0xb')]=_[_0x4eaa('0xc')](config['redis'],{'host':_0x4eaa('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4eaa('0xb')]));require(_0x4eaa('0xe'))[_0x4eaa('0xf')](socket);function respondWithRpcPromise(_0x17f787,_0x5b51e6,_0x22c6c6){return new BPromise(function(_0xd76663,_0x42859f){return client['request'](_0x17f787,_0x22c6c6)[_0x4eaa('0x10')](function(_0x431e3e){logger[_0x4eaa('0x11')](_0x4eaa('0x12'),_0x5b51e6,'request\x20sent');logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x5b51e6,_0x4eaa('0x13'),JSON['stringify'](_0x431e3e));if(_0x431e3e[_0x4eaa('0x14')]){if(_0x431e3e['error'][_0x4eaa('0x15')]===0x1f4){logger[_0x4eaa('0x14')](_0x4eaa('0x12'),_0x5b51e6,_0x431e3e[_0x4eaa('0x14')][_0x4eaa('0x16')]);return _0x42859f(_0x431e3e['error'][_0x4eaa('0x16')]);}logger[_0x4eaa('0x14')](_0x4eaa('0x12'),_0x5b51e6,_0x431e3e[_0x4eaa('0x14')][_0x4eaa('0x16')]);return _0xd76663(_0x431e3e['error'][_0x4eaa('0x16')]);}else{logger[_0x4eaa('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5b51e6,_0x4eaa('0x13'));_0xd76663(_0x431e3e['result'][_0x4eaa('0x16')]);}})[_0x4eaa('0x17')](function(_0x3b9f8d){logger[_0x4eaa('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5b51e6,_0x3b9f8d);_0x42859f(_0x3b9f8d);});});}exports[_0x4eaa('0x18')]=function(_0x2e8d1a){var _0x3266f1=this;return new Promise(function(_0x5a7301,_0x53de9d){return db[_0x4eaa('0x19')][_0x4eaa('0x1a')]({'raw':_0x2e8d1a[_0x4eaa('0x1b')]?_0x2e8d1a[_0x4eaa('0x1b')][_0x4eaa('0x1c')]===undefined?!![]:![]:!![],'where':_0x2e8d1a[_0x4eaa('0x1b')]?_0x2e8d1a[_0x4eaa('0x1b')]['where']||null:null,'attributes':[[db[_0x4eaa('0x1d')]['fn']('COUNT',db[_0x4eaa('0x1d')]['fn']('IF',db[_0x4eaa('0x1d')][_0x4eaa('0x1e')](_0x4eaa('0x1f')))),_0x4eaa('0x20')]]})[_0x4eaa('0x10')](function(_0x515412){logger['info'](_0x4eaa('0x18'),_0x2e8d1a);logger[_0x4eaa('0x21')](_0x4eaa('0x18'),_0x2e8d1a,JSON['stringify'](_0x515412));_0x5a7301(_0x515412);})['catch'](function(_0x12cfbb){logger[_0x4eaa('0x14')](_0x4eaa('0x18'),_0x12cfbb[_0x4eaa('0x16')],_0x2e8d1a);_0x53de9d(_0x3266f1[_0x4eaa('0x14')](0x1f4,_0x12cfbb[_0x4eaa('0x16')]));});});}; \ No newline at end of file +var _0xd7fb=['where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueRtPauses','options','raw'];(function(_0x4b7f10,_0x23de60){var _0x507b56=function(_0x22ff47){while(--_0x22ff47){_0x4b7f10['push'](_0x4b7f10['shift']());}};_0x507b56(++_0x23de60);}(_0xd7fb,0x72));var _0xbd7f=function(_0x2ae404,_0x381212){_0x2ae404=_0x2ae404-0x0;var _0x25b0cf=_0xd7fb[_0x2ae404];return _0x25b0cf;};'use strict';var _=require(_0xbd7f('0x0'));var util=require(_0xbd7f('0x1'));var moment=require(_0xbd7f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd7f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd7f('0x4'));var logger=require(_0xbd7f('0x5'))(_0xbd7f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbd7f('0x7')][_0xbd7f('0x8')]({'port':0x232a});config[_0xbd7f('0x9')]=_[_0xbd7f('0xa')](config[_0xbd7f('0x9')],{'host':_0xbd7f('0xb'),'port':0x18eb});var socket=require(_0xbd7f('0xc'))(new Redis(config[_0xbd7f('0x9')]));require(_0xbd7f('0xd'))[_0xbd7f('0xe')](socket);function respondWithRpcPromise(_0x1ee8bb,_0x167747,_0xc9e508){return new BPromise(function(_0x550dbc,_0x3e698e){return client[_0xbd7f('0xf')](_0x1ee8bb,_0xc9e508)[_0xbd7f('0x10')](function(_0x980488){logger[_0xbd7f('0x11')](_0xbd7f('0x12'),_0x167747,_0xbd7f('0x13'));logger[_0xbd7f('0x14')](_0xbd7f('0x15'),_0x167747,_0xbd7f('0x13'),JSON[_0xbd7f('0x16')](_0x980488));if(_0x980488[_0xbd7f('0x17')]){if(_0x980488[_0xbd7f('0x17')]['code']===0x1f4){logger[_0xbd7f('0x17')](_0xbd7f('0x12'),_0x167747,_0x980488[_0xbd7f('0x17')][_0xbd7f('0x18')]);return _0x3e698e(_0x980488['error'][_0xbd7f('0x18')]);}logger[_0xbd7f('0x17')](_0xbd7f('0x12'),_0x167747,_0x980488[_0xbd7f('0x17')][_0xbd7f('0x18')]);return _0x550dbc(_0x980488[_0xbd7f('0x17')][_0xbd7f('0x18')]);}else{logger['info'](_0xbd7f('0x12'),_0x167747,'request\x20sent');_0x550dbc(_0x980488[_0xbd7f('0x19')][_0xbd7f('0x18')]);}})[_0xbd7f('0x1a')](function(_0x296a70){logger[_0xbd7f('0x17')](_0xbd7f('0x12'),_0x167747,_0x296a70);_0x3e698e(_0x296a70);});});}exports[_0xbd7f('0x1b')]=function(_0x24003e){var _0x3c8620=this;return new Promise(function(_0x4f4128,_0x1ce8ec){return db['UserVoiceQueueRt']['findAll']({'raw':_0x24003e[_0xbd7f('0x1c')]?_0x24003e[_0xbd7f('0x1c')][_0xbd7f('0x1d')]===undefined?!![]:![]:!![],'where':_0x24003e[_0xbd7f('0x1c')]?_0x24003e['options'][_0xbd7f('0x1e')]||null:null,'attributes':[[db[_0xbd7f('0x1f')]['fn'](_0xbd7f('0x20'),db[_0xbd7f('0x1f')]['fn']('IF',db[_0xbd7f('0x1f')][_0xbd7f('0x21')](_0xbd7f('0x22')))),_0xbd7f('0x23')]]})['then'](function(_0x573ac6){logger['info']('GetVoiceQueueRtPauses',_0x24003e);logger[_0xbd7f('0x14')](_0xbd7f('0x1b'),_0x24003e,JSON[_0xbd7f('0x16')](_0x573ac6));_0x4f4128(_0x573ac6);})['catch'](function(_0x5efc93){logger['error'](_0xbd7f('0x1b'),_0x5efc93['message'],_0x24003e);_0x1ce8ec(_0x3c8620[_0xbd7f('0x17')](0x1f4,_0x5efc93[_0xbd7f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 00077ae..335adb5 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 _0x1506=['remove','update','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x313c06,_0x36bffa){var _0x4e039f=function(_0x354d23){while(--_0x354d23){_0x313c06['push'](_0x313c06['shift']());}};_0x4e039f(++_0x36bffa);}(_0x1506,0x136));var _0x6150=function(_0x562db8,_0x985e64){_0x562db8=_0x562db8-0x0;var _0x1463da=_0x1506[_0x562db8];return _0x1463da;};'use strict';var UserVoiceQueueRtEvents=require(_0x6150('0x0'));var events=[_0x6150('0x1'),_0x6150('0x2'),_0x6150('0x3')];function createListener(_0xa86f1f,_0x1998cf){return function(_0x703030){_0x1998cf['emit'](_0xa86f1f,_0x703030);};}function removeListener(_0x197857,_0x283fc6){return function(){UserVoiceQueueRtEvents[_0x6150('0x4')](_0x197857,_0x283fc6);};}exports[_0x6150('0x5')]=function(_0xcfd0b1){for(var _0x2f24a9=0x0,_0x1f87da=events[_0x6150('0x6')];_0x2f24a9<_0x1f87da;_0x2f24a9++){var _0x55326c=events[_0x2f24a9];var _0x23c874=createListener(_0x6150('0x7')+_0x55326c,_0xcfd0b1);UserVoiceQueueRtEvents['on'](_0x55326c,_0x23c874);}}; \ No newline at end of file +var _0xd2eb=['./userVoiceQueueRt.events','save','remove','emit','removeListener','userVoiceQueueRt:'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd2eb,0x9c));var _0xbd2e=function(_0x1d37f7,_0x33d2e0){_0x1d37f7=_0x1d37f7-0x0;var _0x13ca65=_0xd2eb[_0x1d37f7];return _0x13ca65;};'use strict';var UserVoiceQueueRtEvents=require(_0xbd2e('0x0'));var events=[_0xbd2e('0x1'),_0xbd2e('0x2'),'update'];function createListener(_0x56f24c,_0x4d9852){return function(_0x5b1b71){_0x4d9852[_0xbd2e('0x3')](_0x56f24c,_0x5b1b71);};}function removeListener(_0x358ef4,_0xc80cc0){return function(){UserVoiceQueueRtEvents[_0xbd2e('0x4')](_0x358ef4,_0xc80cc0);};}exports['register']=function(_0x25982f){for(var _0x1e2c57=0x0,_0x120051=events['length'];_0x1e2c57<_0x120051;_0x1e2c57++){var _0x3386e1=events[_0x1e2c57];var _0x4fc7c5=createListener(_0xbd2e('0x5')+_0x3386e1,_0x25982f);UserVoiceQueueRtEvents['on'](_0x3386e1,_0x4fc7c5);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 93a05e6..5c91429 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 _0x390a=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x25bb2f,_0x21c4ff){var _0x208b06=function(_0x2ca264){while(--_0x2ca264){_0x25bb2f['push'](_0x25bb2f['shift']());}};_0x208b06(++_0x21c4ff);}(_0x390a,0xc9));var _0xa390=function(_0x3f55cf,_0x2b17b8){_0x3f55cf=_0x3f55cf-0x0;var _0x5b7f57=_0x390a[_0x3f55cf];return _0x5b7f57;};'use strict';var multer=require(_0xa390('0x0'));var util=require(_0xa390('0x1'));var path=require(_0xa390('0x2'));var timeout=require(_0xa390('0x3'));var express=require('express');var router=express[_0xa390('0x4')]();var fs_extra=require(_0xa390('0x5'));var auth=require(_0xa390('0x6'));var interaction=require(_0xa390('0x7'));var config=require('../../config/environment');module[_0xa390('0x8')]=router; \ No newline at end of file +var _0x2547=['../../components/interaction/service','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0x2547,0x1cd));var _0x7254=function(_0x1cb392,_0x5957a5){_0x1cb392=_0x1cb392-0x0;var _0x498cb6=_0x2547[_0x1cb392];return _0x498cb6;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var fs_extra=require(_0x7254('0x5'));var auth=require(_0x7254('0x6'));var interaction=require(_0x7254('0x7'));var config=require('../../config/environment');module[_0x7254('0x8')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 48220c1..5fb897c 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x59db34,_0x593726){var _0x568a53=function(_0x2bf3b4){while(--_0x2bf3b4){_0x59db34['push'](_0x59db34['shift']());}};_0x568a53(++_0x593726);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x10acb2,_0x3ca870){var _0x186379=function(_0x294bbd){while(--_0x294bbd){_0x10acb2['push'](_0x10acb2['shift']());}};_0x186379(++_0x3ca870);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index d904062..7287a6e 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 _0x351d=['../../config/environment','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x47b1c4,_0x519f19){var _0x28b9a5=function(_0x5bb076){while(--_0x5bb076){_0x47b1c4['push'](_0x47b1c4['shift']());}};_0x28b9a5(++_0x519f19);}(_0x351d,0x90));var _0xd351=function(_0x2f56d1,_0x4ff341){_0x2f56d1=_0x2f56d1-0x0;var _0x10f30b=_0x351d[_0x2f56d1];return _0x10f30b;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var logger=require(_0xd351('0x1'))(_0xd351('0x2'));var moment=require(_0xd351('0x3'));var BPromise=require('bluebird');var rp=require(_0xd351('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd351('0x5'));var config=require(_0xd351('0x6'));var attributes=require('./userWhatsappQueue.attributes');module[_0xd351('0x7')]=function(_0x45e9e5,_0x88bd2b){return _0x45e9e5['define'](_0xd351('0x8'),attributes,{'tableName':_0xd351('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa571=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash'];(function(_0x4dfb63,_0x4162a0){var _0x3cf9ab=function(_0x2a84dc){while(--_0x2a84dc){_0x4dfb63['push'](_0x4dfb63['shift']());}};_0x3cf9ab(++_0x4162a0);}(_0xa571,0x107));var _0x1a57=function(_0x785612,_0x44643f){_0x785612=_0x785612-0x0;var _0x3e589b=_0xa571[_0x785612];return _0x3e589b;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var logger=require(_0x1a57('0x2'))(_0x1a57('0x3'));var moment=require('moment');var BPromise=require(_0x1a57('0x4'));var rp=require(_0x1a57('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1a57('0x6'));var attributes=require('./userWhatsappQueue.attributes');module[_0x1a57('0x7')]=function(_0xd97a33,_0x22ca20){return _0xd97a33[_0x1a57('0x8')](_0x1a57('0x9'),attributes,{'tableName':_0x1a57('0xa'),'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 0c61535..6d9e8eb 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(_0x3f0e3f,_0x258f4a){var _0x1ea313=function(_0x2127b9){while(--_0x2127b9){_0x3f0e3f['push'](_0x3f0e3f['shift']());}};_0x1ea313(++_0x258f4a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x5e114b,_0x108e87){var _0x545f26=function(_0x9d9a93){while(--_0x9d9a93){_0x5e114b['push'](_0x5e114b['shift']());}};_0x545f26(++_0x108e87);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 2c69957..b9c7467 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 _0x7571=['delete','exports','multer','util','path','express','Router','../../components/auth/service','get','isAuthenticated','index','/:id','put'];(function(_0x4ffe1f,_0x3ec928){var _0x1664e2=function(_0x4d4e33){while(--_0x4d4e33){_0x4ffe1f['push'](_0x4ffe1f['shift']());}};_0x1664e2(++_0x3ec928);}(_0x7571,0x12d));var _0x1757=function(_0x4fe5f0,_0x366d90){_0x4fe5f0=_0x4fe5f0-0x0;var _0x44970c=_0x7571[_0x4fe5f0];return _0x44970c;};'use strict';var multer=require(_0x1757('0x0'));var util=require(_0x1757('0x1'));var path=require(_0x1757('0x2'));var timeout=require('connect-timeout');var express=require(_0x1757('0x3'));var router=express[_0x1757('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1757('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./variable.controller');router[_0x1757('0x6')]('/',auth[_0x1757('0x7')](),controller[_0x1757('0x8')]);router[_0x1757('0x6')](_0x1757('0x9'),auth[_0x1757('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1757('0xa')](_0x1757('0x9'),auth[_0x1757('0x7')](),controller['update']);router[_0x1757('0xb')]('/:id',auth[_0x1757('0x7')](),controller['destroy']);module[_0x1757('0xc')]=router; \ No newline at end of file +var _0x7dd5=['/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated'];(function(_0xb35e9d,_0x1cac18){var _0x25d505=function(_0x1f4dba){while(--_0x1f4dba){_0xb35e9d['push'](_0xb35e9d['shift']());}};_0x25d505(++_0x1cac18);}(_0x7dd5,0x183));var _0x57dd=function(_0x2a3c34,_0x30748d){_0x2a3c34=_0x2a3c34-0x0;var _0xeb02a5=_0x7dd5[_0x2a3c34];return _0xeb02a5;};'use strict';var multer=require(_0x57dd('0x0'));var util=require(_0x57dd('0x1'));var path=require(_0x57dd('0x2'));var timeout=require(_0x57dd('0x3'));var express=require(_0x57dd('0x4'));var router=express[_0x57dd('0x5')]();var fs_extra=require(_0x57dd('0x6'));var auth=require(_0x57dd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x57dd('0x8'));var controller=require(_0x57dd('0x9'));router[_0x57dd('0xa')]('/',auth[_0x57dd('0xb')](),controller['index']);router[_0x57dd('0xa')](_0x57dd('0xc'),auth[_0x57dd('0xb')](),controller[_0x57dd('0xd')]);router['post']('/',auth[_0x57dd('0xb')](),controller[_0x57dd('0xe')]);router[_0x57dd('0xf')](_0x57dd('0xc'),auth[_0x57dd('0xb')](),controller[_0x57dd('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x57dd('0x11')]);module[_0x57dd('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 8b00a6b..6c26ca6 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 _0xf007=['STRING'];(function(_0x41f998,_0x1e6715){var _0x36b3fb=function(_0x165576){while(--_0x165576){_0x41f998['push'](_0x41f998['shift']());}};_0x36b3fb(++_0x1e6715);}(_0xf007,0xb3));var _0x7f00=function(_0x2656a4,_0x28dd1b){_0x2656a4=_0x2656a4-0x0;var _0x48ce85=_0xf007[_0x2656a4];return _0x48ce85;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7f00('0x0')]}}; \ No newline at end of file +var _0xdd3f=['STRING'];(function(_0x165189,_0x19a741){var _0x44826b=function(_0x25bf5a){while(--_0x25bf5a){_0x165189['push'](_0x165189['shift']());}};_0x44826b(++_0x19a741);}(_0xdd3f,0xae));var _0xfdd3=function(_0x15aefa,_0x26490c){_0x15aefa=_0x15aefa-0x0;var _0x5ec10a=_0xdd3f[_0x15aefa];return _0x5ec10a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfdd3('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfdd3('0x0')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 22c4bb2..48f711e 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 _0x4d94=['create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','status','json','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','Variables','end','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','Variable','rows','catch','show','params','filters','find','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource'];(function(_0xdb943e,_0x3e43de){var _0x827832=function(_0x4db661){while(--_0x4db661){_0xdb943e['push'](_0xdb943e['shift']());}};_0x827832(++_0x3e43de);}(_0x4d94,0x1dd));var _0x44d9=function(_0x7c1d8d,_0x1f9446){_0x7c1d8d=_0x7c1d8d-0x0;var _0x3f2ceb=_0x4d94[_0x7c1d8d];return _0x3f2ceb;};'use strict';var emlformat=require(_0x44d9('0x0'));var rimraf=require(_0x44d9('0x1'));var zipdir=require(_0x44d9('0x2'));var jsonpatch=require(_0x44d9('0x3'));var rp=require(_0x44d9('0x4'));var moment=require(_0x44d9('0x5'));var BPromise=require(_0x44d9('0x6'));var Mustache=require(_0x44d9('0x7'));var util=require(_0x44d9('0x8'));var path=require(_0x44d9('0x9'));var sox=require('sox');var csv=require(_0x44d9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x44d9('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x44d9('0xa'));var querystring=require('querystring');var Papa=require(_0x44d9('0xc'));var Redis=require('ioredis');var authService=require(_0x44d9('0xd'));var qs=require(_0x44d9('0xe'));var as=require(_0x44d9('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x44d9('0x10'))(_0x44d9('0x11'));var utils=require(_0x44d9('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x44d9('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28198d,_0x52f8d7){_0x52f8d7=_0x52f8d7||0xcc;return function(_0x4a620e){if(_0x4a620e){return _0x28198d['sendStatus'](_0x52f8d7);}return _0x28198d[_0x44d9('0x14')](_0x52f8d7)['end']();};}function respondWithResult(_0x4f9961,_0x90a3ac){_0x90a3ac=_0x90a3ac||0xc8;return function(_0xcb2b90){if(_0xcb2b90){return _0x4f9961[_0x44d9('0x14')](_0x90a3ac)[_0x44d9('0x15')](_0xcb2b90);}};}function respondWithFilteredResult(_0x2be07b,_0x37f48d){return function(_0x452c26){if(_0x452c26){var _0x4f6d99=_0x452c26['count'],_0x5cc65c=_0x37f48d[_0x44d9('0x16')],_0x4bd1a2=_0x37f48d[_0x44d9('0x16')]+_0x37f48d['limit'],_0x21af42;if(_0x4bd1a2>=_0x4f6d99){_0x4bd1a2=_0x4f6d99;_0x21af42=0xc8;}else{_0x21af42=0xce;}_0x2be07b[_0x44d9('0x14')](_0x21af42);return _0x2be07b[_0x44d9('0x17')](_0x44d9('0x18'),_0x5cc65c+'-'+_0x4bd1a2+'/'+_0x4f6d99)[_0x44d9('0x15')](_0x452c26);}return null;};}function patchUpdates(_0x11ba40){return function(_0x4af228){try{jsonpatch[_0x44d9('0x19')](_0x4af228,_0x11ba40,!![]);}catch(_0x294a87){return BPromise[_0x44d9('0x1a')](_0x294a87);}return _0x4af228[_0x44d9('0x1b')]();};}function saveUpdates(_0x2f9769,_0x129018){return function(_0x16b154){if(_0x16b154){return _0x16b154[_0x44d9('0x1c')](_0x2f9769)['then'](function(_0x13b3bc){return _0x13b3bc;});}return null;};}function removeEntity(_0x50582e,_0x198234){return function(_0x5dd718){if(_0x5dd718){return _0x5dd718[_0x44d9('0x1d')]()[_0x44d9('0x1e')](function(){var _0x1cfad7=_0x5dd718[_0x44d9('0x1f')]({'plain':!![]});var _0x5ac9db=_0x44d9('0x20');return db['UserProfileResource'][_0x44d9('0x1d')]({'where':{'type':_0x5ac9db,'resourceId':_0x1cfad7['id']}})[_0x44d9('0x1e')](function(){return _0x5dd718;});})['then'](function(){_0x50582e[_0x44d9('0x14')](0xcc)[_0x44d9('0x21')]();});}};}function handleEntityNotFound(_0x2a5948,_0x5e9870){return function(_0x4b142c){if(!_0x4b142c){_0x2a5948[_0x44d9('0x22')](0x194);}return _0x4b142c;};}function handleError(_0x4ca353,_0x2e89d3){_0x2e89d3=_0x2e89d3||0x1f4;return function(_0xd22ae7){logger[_0x44d9('0x23')](_0xd22ae7['stack']);if(_0xd22ae7[_0x44d9('0x24')]){delete _0xd22ae7[_0x44d9('0x24')];}_0x4ca353[_0x44d9('0x14')](_0x2e89d3)[_0x44d9('0x25')](_0xd22ae7);};}exports[_0x44d9('0x26')]=function(_0x17122,_0x5f08d6){var _0x40a180={},_0x47186a={},_0x248ee1={'count':0x0,'rows':[]};var _0x58ab47=_[_0x44d9('0x27')](db['Variable'][_0x44d9('0x28')],function(_0x45836f){return{'name':_0x45836f[_0x44d9('0x29')],'type':_0x45836f[_0x44d9('0x2a')]['key']};});_0x47186a['model']=_[_0x44d9('0x27')](_0x58ab47,_0x44d9('0x24'));_0x47186a[_0x44d9('0x2b')]=_[_0x44d9('0x2c')](_0x17122['query']);_0x47186a['filters']=_[_0x44d9('0x2d')](_0x47186a[_0x44d9('0x2e')],_0x47186a['query']);_0x40a180[_0x44d9('0x2f')]=_[_0x44d9('0x2d')](_0x47186a[_0x44d9('0x2e')],qs[_0x44d9('0x30')](_0x17122['query'][_0x44d9('0x30')]));_0x40a180[_0x44d9('0x2f')]=_0x40a180[_0x44d9('0x2f')][_0x44d9('0x31')]?_0x40a180['attributes']:_0x47186a[_0x44d9('0x2e')];if(!_0x17122['query'][_0x44d9('0x32')]('nolimit')){_0x40a180[_0x44d9('0x33')]=qs[_0x44d9('0x33')](_0x17122[_0x44d9('0x2b')][_0x44d9('0x33')]);_0x40a180[_0x44d9('0x16')]=qs[_0x44d9('0x16')](_0x17122[_0x44d9('0x2b')][_0x44d9('0x16')]);}_0x40a180[_0x44d9('0x34')]=qs[_0x44d9('0x35')](_0x17122[_0x44d9('0x2b')][_0x44d9('0x35')]);_0x40a180[_0x44d9('0x36')]=qs['filters'](_[_0x44d9('0x37')](_0x17122[_0x44d9('0x2b')],_0x47186a['filters']),_0x58ab47);if(_0x17122[_0x44d9('0x2b')][_0x44d9('0x38')]){_0x40a180['where']=_[_0x44d9('0x39')](_0x40a180[_0x44d9('0x36')],{'$or':_[_0x44d9('0x27')](_0x58ab47,function(_0x5c220){if(_0x5c220['type']!==_0x44d9('0x3a')){var _0x282c74={};_0x282c74[_0x5c220[_0x44d9('0x24')]]={'$like':'%'+_0x17122[_0x44d9('0x2b')][_0x44d9('0x38')]+'%'};return _0x282c74;}})});}_0x40a180=_[_0x44d9('0x39')]({},_0x40a180,_0x17122[_0x44d9('0x3b')]);var _0x5be51e={'where':_0x40a180['where']};return db['Variable'][_0x44d9('0x3c')](_0x5be51e)[_0x44d9('0x1e')](function(_0x5eb82b){_0x248ee1[_0x44d9('0x3c')]=_0x5eb82b;if(_0x17122[_0x44d9('0x2b')][_0x44d9('0x3d')]){_0x40a180[_0x44d9('0x3e')]=[{'all':!![]}];}return db[_0x44d9('0x3f')]['findAll'](_0x40a180);})[_0x44d9('0x1e')](function(_0x5d0ca0){_0x248ee1[_0x44d9('0x40')]=_0x5d0ca0;return _0x248ee1;})[_0x44d9('0x1e')](respondWithFilteredResult(_0x5f08d6,_0x40a180))[_0x44d9('0x41')](handleError(_0x5f08d6,null));};exports[_0x44d9('0x42')]=function(_0x27bb8d,_0x4683ca){var _0xf9a581={'raw':!![],'where':{'id':_0x27bb8d[_0x44d9('0x43')]['id']}},_0x2c24b0={};_0x2c24b0[_0x44d9('0x2e')]=_['keys'](db[_0x44d9('0x3f')][_0x44d9('0x28')]);_0x2c24b0[_0x44d9('0x2b')]=_[_0x44d9('0x2c')](_0x27bb8d[_0x44d9('0x2b')]);_0x2c24b0[_0x44d9('0x44')]=_[_0x44d9('0x2d')](_0x2c24b0[_0x44d9('0x2e')],_0x2c24b0[_0x44d9('0x2b')]);_0xf9a581[_0x44d9('0x2f')]=_['intersection'](_0x2c24b0['model'],qs[_0x44d9('0x30')](_0x27bb8d[_0x44d9('0x2b')][_0x44d9('0x30')]));_0xf9a581[_0x44d9('0x2f')]=_0xf9a581[_0x44d9('0x2f')][_0x44d9('0x31')]?_0xf9a581[_0x44d9('0x2f')]:_0x2c24b0[_0x44d9('0x2e')];if(_0x27bb8d['query']['includeAll']){_0xf9a581[_0x44d9('0x3e')]=[{'all':!![]}];}_0xf9a581=_['merge']({},_0xf9a581,_0x27bb8d[_0x44d9('0x3b')]);return db[_0x44d9('0x3f')][_0x44d9('0x45')](_0xf9a581)['then'](handleEntityNotFound(_0x4683ca,null))[_0x44d9('0x1e')](respondWithResult(_0x4683ca,null))[_0x44d9('0x41')](handleError(_0x4683ca,null));};exports['create']=function(_0x4e4581,_0x22443a){return db[_0x44d9('0x3f')]['create'](_0x4e4581['body'],{})[_0x44d9('0x1e')](function(_0xc3e6e1){var _0x536ae0=_0x4e4581['user'][_0x44d9('0x1f')]({'plain':!![]});if(!_0x536ae0)throw new Error(_0x44d9('0x46'));if(_0x536ae0[_0x44d9('0x47')]===_0x44d9('0x48')){var _0x44fb78=_0xc3e6e1[_0x44d9('0x1f')]({'plain':!![]});var _0x9bef23=_0x44d9('0x20');return db[_0x44d9('0x49')][_0x44d9('0x45')]({'where':{'name':_0x9bef23,'userProfileId':_0x536ae0[_0x44d9('0x4a')]},'raw':!![]})[_0x44d9('0x1e')](function(_0x4ef94e){if(_0x4ef94e&&_0x4ef94e['autoAssociation']===0x0){return db[_0x44d9('0x4b')][_0x44d9('0x4c')]({'name':_0x44fb78['name'],'resourceId':_0x44fb78['id'],'type':_0x4ef94e[_0x44d9('0x24')],'sectionId':_0x4ef94e['id']},{})[_0x44d9('0x1e')](function(){return _0xc3e6e1;});}else{return _0xc3e6e1;}})['catch'](function(_0x1555db){logger[_0x44d9('0x23')](_0x44d9('0x4d'),_0x1555db);throw _0x1555db;});}return _0xc3e6e1;})[_0x44d9('0x1e')](respondWithResult(_0x22443a,0xc9))['catch'](handleError(_0x22443a,null));};exports[_0x44d9('0x1c')]=function(_0x34bffe,_0x48175b){if(_0x34bffe[_0x44d9('0x4e')]['id']){delete _0x34bffe[_0x44d9('0x4e')]['id'];}return db[_0x44d9('0x3f')]['find']({'where':{'id':_0x34bffe[_0x44d9('0x43')]['id']}})[_0x44d9('0x1e')](handleEntityNotFound(_0x48175b,null))['then'](saveUpdates(_0x34bffe['body'],null))[_0x44d9('0x1e')](respondWithResult(_0x48175b,null))[_0x44d9('0x41')](handleError(_0x48175b,null));};exports[_0x44d9('0x1d')]=function(_0x8d5a9c,_0x1dc6c4){return db[_0x44d9('0x3f')]['find']({'where':{'id':_0x8d5a9c[_0x44d9('0x43')]['id']}})[_0x44d9('0x1e')](handleEntityNotFound(_0x1dc6c4,null))[_0x44d9('0x1e')](removeEntity(_0x1dc6c4,null))[_0x44d9('0x41')](handleError(_0x1dc6c4,null));}; \ No newline at end of file +var _0xbca4=['../../config/license/util','status','end','json','offset','limit','set','reject','save','then','destroy','get','Variables','UserProfileResource','sendStatus','error','stack','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','fields','attributes','query','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','Variable','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','moment','bluebird','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'];(function(_0x3a3c3d,_0x3b8542){var _0xf3142f=function(_0x479bb0){while(--_0x479bb0){_0x3a3c3d['push'](_0x3a3c3d['shift']());}};_0xf3142f(++_0x3b8542);}(_0xbca4,0x13a));var _0x4bca=function(_0x4050fe,_0x180e44){_0x4050fe=_0x4050fe-0x0;var _0x27fb93=_0xbca4[_0x4050fe];return _0x27fb93;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4bca('0x0'));var zipdir=require(_0x4bca('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4bca('0x2'));var BPromise=require(_0x4bca('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4bca('0x4'));var csv=require(_0x4bca('0x5'));var ejs=require(_0x4bca('0x6'));var fs=require('fs');var fs_extra=require(_0x4bca('0x7'));var _=require('lodash');var squel=require(_0x4bca('0x8'));var crypto=require(_0x4bca('0x9'));var jsforce=require(_0x4bca('0xa'));var deskjs=require(_0x4bca('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4bca('0xc'));var Papa=require(_0x4bca('0xd'));var Redis=require(_0x4bca('0xe'));var authService=require(_0x4bca('0xf'));var qs=require(_0x4bca('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4bca('0x11'));var logger=require(_0x4bca('0x12'))(_0x4bca('0x13'));var utils=require(_0x4bca('0x14'));var config=require(_0x4bca('0x15'));var licenseUtil=require(_0x4bca('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x396376,_0x24921e){_0x24921e=_0x24921e||0xcc;return function(_0x31d734){if(_0x31d734){return _0x396376['sendStatus'](_0x24921e);}return _0x396376[_0x4bca('0x17')](_0x24921e)[_0x4bca('0x18')]();};}function respondWithResult(_0x47dc0d,_0x1f31d3){_0x1f31d3=_0x1f31d3||0xc8;return function(_0x3d84f5){if(_0x3d84f5){return _0x47dc0d['status'](_0x1f31d3)[_0x4bca('0x19')](_0x3d84f5);}};}function respondWithFilteredResult(_0x50f442,_0xd96d3a){return function(_0x3b7667){if(_0x3b7667){var _0x59bc2f=_0x3b7667['count'],_0x5a3227=_0xd96d3a[_0x4bca('0x1a')],_0x40e487=_0xd96d3a['offset']+_0xd96d3a[_0x4bca('0x1b')],_0x5506c2;if(_0x40e487>=_0x59bc2f){_0x40e487=_0x59bc2f;_0x5506c2=0xc8;}else{_0x5506c2=0xce;}_0x50f442[_0x4bca('0x17')](_0x5506c2);return _0x50f442[_0x4bca('0x1c')]('Content-Range',_0x5a3227+'-'+_0x40e487+'/'+_0x59bc2f)[_0x4bca('0x19')](_0x3b7667);}return null;};}function patchUpdates(_0x5bf849){return function(_0x2c2fc6){try{jsonpatch['apply'](_0x2c2fc6,_0x5bf849,!![]);}catch(_0x3f61c6){return BPromise[_0x4bca('0x1d')](_0x3f61c6);}return _0x2c2fc6[_0x4bca('0x1e')]();};}function saveUpdates(_0x2fac10,_0x377bc0){return function(_0x44f7df){if(_0x44f7df){return _0x44f7df['update'](_0x2fac10)[_0x4bca('0x1f')](function(_0x23097e){return _0x23097e;});}return null;};}function removeEntity(_0x269864,_0x108cdd){return function(_0x4bd036){if(_0x4bd036){return _0x4bd036[_0x4bca('0x20')]()[_0x4bca('0x1f')](function(){var _0x445166=_0x4bd036[_0x4bca('0x21')]({'plain':!![]});var _0x4afe27=_0x4bca('0x22');return db[_0x4bca('0x23')]['destroy']({'where':{'type':_0x4afe27,'resourceId':_0x445166['id']}})[_0x4bca('0x1f')](function(){return _0x4bd036;});})[_0x4bca('0x1f')](function(){_0x269864[_0x4bca('0x17')](0xcc)[_0x4bca('0x18')]();});}};}function handleEntityNotFound(_0x7a912a,_0x1805b5){return function(_0x9fe52f){if(!_0x9fe52f){_0x7a912a[_0x4bca('0x24')](0x194);}return _0x9fe52f;};}function handleError(_0x449c3a,_0x3a4454){_0x3a4454=_0x3a4454||0x1f4;return function(_0x3a0462){logger[_0x4bca('0x25')](_0x3a0462[_0x4bca('0x26')]);if(_0x3a0462[_0x4bca('0x27')]){delete _0x3a0462[_0x4bca('0x27')];}_0x449c3a[_0x4bca('0x17')](_0x3a4454)[_0x4bca('0x28')](_0x3a0462);};}exports[_0x4bca('0x29')]=function(_0x10943c,_0x4ba2cb){var _0x3eb709={},_0x168c36={},_0x5c54ed={'count':0x0,'rows':[]};var _0x4e264d=_['map'](db['Variable']['rawAttributes'],function(_0xc22360){return{'name':_0xc22360[_0x4bca('0x2a')],'type':_0xc22360[_0x4bca('0x2b')][_0x4bca('0x2c')]};});_0x168c36[_0x4bca('0x2d')]=_[_0x4bca('0x2e')](_0x4e264d,_0x4bca('0x27'));_0x168c36['query']=_[_0x4bca('0x2f')](_0x10943c['query']);_0x168c36[_0x4bca('0x30')]=_['intersection'](_0x168c36['model'],_0x168c36['query']);_0x3eb709['attributes']=_[_0x4bca('0x31')](_0x168c36[_0x4bca('0x2d')],qs[_0x4bca('0x32')](_0x10943c['query']['fields']));_0x3eb709[_0x4bca('0x33')]=_0x3eb709['attributes']['length']?_0x3eb709['attributes']:_0x168c36['model'];if(!_0x10943c[_0x4bca('0x34')][_0x4bca('0x35')](_0x4bca('0x36'))){_0x3eb709[_0x4bca('0x1b')]=qs[_0x4bca('0x1b')](_0x10943c['query'][_0x4bca('0x1b')]);_0x3eb709[_0x4bca('0x1a')]=qs[_0x4bca('0x1a')](_0x10943c[_0x4bca('0x34')][_0x4bca('0x1a')]);}_0x3eb709[_0x4bca('0x37')]=qs[_0x4bca('0x38')](_0x10943c[_0x4bca('0x34')]['sort']);_0x3eb709[_0x4bca('0x39')]=qs[_0x4bca('0x30')](_[_0x4bca('0x3a')](_0x10943c[_0x4bca('0x34')],_0x168c36['filters']),_0x4e264d);if(_0x10943c['query'][_0x4bca('0x3b')]){_0x3eb709[_0x4bca('0x39')]=_['merge'](_0x3eb709['where'],{'$or':_[_0x4bca('0x2e')](_0x4e264d,function(_0x1af94a){if(_0x1af94a[_0x4bca('0x2b')]!==_0x4bca('0x3c')){var _0x18e8d2={};_0x18e8d2[_0x1af94a[_0x4bca('0x27')]]={'$like':'%'+_0x10943c[_0x4bca('0x34')]['filter']+'%'};return _0x18e8d2;}})});}_0x3eb709=_[_0x4bca('0x3d')]({},_0x3eb709,_0x10943c[_0x4bca('0x3e')]);var _0x3389f9={'where':_0x3eb709[_0x4bca('0x39')]};return db[_0x4bca('0x3f')][_0x4bca('0x40')](_0x3389f9)[_0x4bca('0x1f')](function(_0x7377cc){_0x5c54ed['count']=_0x7377cc;if(_0x10943c[_0x4bca('0x34')][_0x4bca('0x41')]){_0x3eb709[_0x4bca('0x42')]=[{'all':!![]}];}return db[_0x4bca('0x3f')][_0x4bca('0x43')](_0x3eb709);})['then'](function(_0xe631d2){_0x5c54ed[_0x4bca('0x44')]=_0xe631d2;return _0x5c54ed;})[_0x4bca('0x1f')](respondWithFilteredResult(_0x4ba2cb,_0x3eb709))[_0x4bca('0x45')](handleError(_0x4ba2cb,null));};exports[_0x4bca('0x46')]=function(_0x528ec1,_0x2e40f4){var _0x4d209f={'raw':!![],'where':{'id':_0x528ec1[_0x4bca('0x47')]['id']}},_0x2f51ba={};_0x2f51ba[_0x4bca('0x2d')]=_[_0x4bca('0x2f')](db['Variable'][_0x4bca('0x48')]);_0x2f51ba[_0x4bca('0x34')]=_[_0x4bca('0x2f')](_0x528ec1[_0x4bca('0x34')]);_0x2f51ba[_0x4bca('0x30')]=_[_0x4bca('0x31')](_0x2f51ba[_0x4bca('0x2d')],_0x2f51ba[_0x4bca('0x34')]);_0x4d209f['attributes']=_[_0x4bca('0x31')](_0x2f51ba[_0x4bca('0x2d')],qs[_0x4bca('0x32')](_0x528ec1['query'][_0x4bca('0x32')]));_0x4d209f[_0x4bca('0x33')]=_0x4d209f[_0x4bca('0x33')][_0x4bca('0x49')]?_0x4d209f[_0x4bca('0x33')]:_0x2f51ba['model'];if(_0x528ec1['query']['includeAll']){_0x4d209f[_0x4bca('0x42')]=[{'all':!![]}];}_0x4d209f=_['merge']({},_0x4d209f,_0x528ec1[_0x4bca('0x3e')]);return db[_0x4bca('0x3f')][_0x4bca('0x4a')](_0x4d209f)['then'](handleEntityNotFound(_0x2e40f4,null))[_0x4bca('0x1f')](respondWithResult(_0x2e40f4,null))[_0x4bca('0x45')](handleError(_0x2e40f4,null));};exports[_0x4bca('0x4b')]=function(_0x4dcbe6,_0x47adec){return db[_0x4bca('0x3f')][_0x4bca('0x4b')](_0x4dcbe6[_0x4bca('0x4c')],{})[_0x4bca('0x1f')](function(_0x5492ee){var _0x53668f=_0x4dcbe6[_0x4bca('0x4d')][_0x4bca('0x21')]({'plain':!![]});if(!_0x53668f)throw new Error(_0x4bca('0x4e'));if(_0x53668f[_0x4bca('0x4f')]===_0x4bca('0x4d')){var _0x24218e=_0x5492ee[_0x4bca('0x21')]({'plain':!![]});var _0x288909=_0x4bca('0x22');return db[_0x4bca('0x50')][_0x4bca('0x4a')]({'where':{'name':_0x288909,'userProfileId':_0x53668f[_0x4bca('0x51')]},'raw':!![]})[_0x4bca('0x1f')](function(_0x50f631){if(_0x50f631&&_0x50f631[_0x4bca('0x52')]===0x0){return db['UserProfileResource'][_0x4bca('0x4b')]({'name':_0x24218e[_0x4bca('0x27')],'resourceId':_0x24218e['id'],'type':_0x50f631['name'],'sectionId':_0x50f631['id']},{})[_0x4bca('0x1f')](function(){return _0x5492ee;});}else{return _0x5492ee;}})['catch'](function(_0x454cfc){logger[_0x4bca('0x25')](_0x4bca('0x53'),_0x454cfc);throw _0x454cfc;});}return _0x5492ee;})[_0x4bca('0x1f')](respondWithResult(_0x47adec,0xc9))[_0x4bca('0x45')](handleError(_0x47adec,null));};exports['update']=function(_0x125403,_0x2859a4){if(_0x125403[_0x4bca('0x4c')]['id']){delete _0x125403[_0x4bca('0x4c')]['id'];}return db[_0x4bca('0x3f')][_0x4bca('0x4a')]({'where':{'id':_0x125403[_0x4bca('0x47')]['id']}})['then'](handleEntityNotFound(_0x2859a4,null))[_0x4bca('0x1f')](saveUpdates(_0x125403[_0x4bca('0x4c')],null))[_0x4bca('0x1f')](respondWithResult(_0x2859a4,null))[_0x4bca('0x45')](handleError(_0x2859a4,null));};exports[_0x4bca('0x20')]=function(_0x5d1928,_0x52c20b){return db['Variable']['find']({'where':{'id':_0x5d1928['params']['id']}})[_0x4bca('0x1f')](handleEntityNotFound(_0x52c20b,null))[_0x4bca('0x1f')](removeEntity(_0x52c20b,null))[_0x4bca('0x45')](handleError(_0x52c20b,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 7ac081b..e08b4b4 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 _0xcc94=['api','moment','bluebird','request-promise','../../config/environment','./variable.attributes','exports','Variable','util','../../config/logger'];(function(_0x3f108c,_0x318e70){var _0x491bb2=function(_0x1c88c8){while(--_0x1c88c8){_0x3f108c['push'](_0x3f108c['shift']());}};_0x491bb2(++_0x318e70);}(_0xcc94,0xee));var _0x4cc9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcc94[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x4cc9('0x0'));var logger=require(_0x4cc9('0x1'))(_0x4cc9('0x2'));var moment=require(_0x4cc9('0x3'));var BPromise=require(_0x4cc9('0x4'));var rp=require(_0x4cc9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4cc9('0x6'));var attributes=require(_0x4cc9('0x7'));module[_0x4cc9('0x8')]=function(_0x190ec7,_0x154d80){return _0x190ec7['define'](_0x4cc9('0x9'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5668=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','lodash'];(function(_0xc7348b,_0x145880){var _0x307cec=function(_0x4f1554){while(--_0x4f1554){_0xc7348b['push'](_0xc7348b['shift']());}};_0x307cec(++_0x145880);}(_0x5668,0x8b));var _0x8566=function(_0x57645f,_0x14f458){_0x57645f=_0x57645f-0x0;var _0x860cfc=_0x5668[_0x57645f];return _0x860cfc;};'use strict';var _=require(_0x8566('0x0'));var util=require(_0x8566('0x1'));var logger=require(_0x8566('0x2'))(_0x8566('0x3'));var moment=require(_0x8566('0x4'));var BPromise=require(_0x8566('0x5'));var rp=require(_0x8566('0x6'));var fs=require('fs');var path=require(_0x8566('0x7'));var rimraf=require(_0x8566('0x8'));var config=require(_0x8566('0x9'));var attributes=require(_0x8566('0xa'));module[_0x8566('0xb')]=function(_0x2f958c,_0x4885d6){return _0x2f958c[_0x8566('0xc')](_0x8566('0xd'),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 3103e29..377d22d 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 _0x775a=['catch','ShowVariable','Variable','find','options','raw','where','include','model','attributes','map','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','http','request','then','info','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','Variable,\x20%s,\x20%s','result'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x775a,0x1dc));var _0xa775=function(_0x10bf12,_0x30ce22){_0x10bf12=_0x10bf12-0x0;var _0x5076ad=_0x775a[_0x10bf12];return _0x5076ad;};'use strict';var _=require('lodash');var util=require(_0xa775('0x0'));var moment=require(_0xa775('0x1'));var BPromise=require(_0xa775('0x2'));var rs=require(_0xa775('0x3'));var fs=require('fs');var Redis=require(_0xa775('0x4'));var db=require(_0xa775('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa775('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa775('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ebe1f,_0x415015,_0x3812aa){return new BPromise(function(_0x55f4a2,_0x31b98e){return client[_0xa775('0x8')](_0x1ebe1f,_0x3812aa)[_0xa775('0x9')](function(_0x1a4f51){logger[_0xa775('0xa')]('Variable,\x20%s,\x20%s',_0x415015,'request\x20sent');logger[_0xa775('0xb')](_0xa775('0xc'),_0x415015,_0xa775('0xd'),JSON[_0xa775('0xe')](_0x1a4f51));if(_0x1a4f51['error']){if(_0x1a4f51['error'][_0xa775('0xf')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x415015,_0x1a4f51[_0xa775('0x10')][_0xa775('0x11')]);return _0x31b98e(_0x1a4f51[_0xa775('0x10')]['message']);}logger[_0xa775('0x10')](_0xa775('0x12'),_0x415015,_0x1a4f51[_0xa775('0x10')][_0xa775('0x11')]);return _0x55f4a2(_0x1a4f51[_0xa775('0x10')][_0xa775('0x11')]);}else{logger[_0xa775('0xa')]('Variable,\x20%s,\x20%s',_0x415015,'request\x20sent');_0x55f4a2(_0x1a4f51[_0xa775('0x13')][_0xa775('0x11')]);}})[_0xa775('0x14')](function(_0x170f1d){logger[_0xa775('0x10')]('Variable,\x20%s,\x20%s',_0x415015,_0x170f1d);_0x31b98e(_0x170f1d);});});}exports[_0xa775('0x15')]=function(_0x5f51a9){var _0x4e8225=this;return new Promise(function(_0x5cee02,_0x49fe50){return db[_0xa775('0x16')][_0xa775('0x17')]({'raw':_0x5f51a9[_0xa775('0x18')]?_0x5f51a9['options'][_0xa775('0x19')]===undefined?!![]:![]:!![],'where':_0x5f51a9['options']?_0x5f51a9[_0xa775('0x18')][_0xa775('0x1a')]||null:null,'attributes':_0x5f51a9[_0xa775('0x18')]?_0x5f51a9['options']['attributes']||null:null,'include':_0x5f51a9[_0xa775('0x18')]?_0x5f51a9[_0xa775('0x18')][_0xa775('0x1b')]?_['map'](_0x5f51a9[_0xa775('0x18')][_0xa775('0x1b')],function(_0x4c3f34){return{'model':db[_0x4c3f34[_0xa775('0x1c')]],'as':_0x4c3f34['as'],'attributes':_0x4c3f34[_0xa775('0x1d')],'include':_0x4c3f34[_0xa775('0x1b')]?_['map'](_0x4c3f34['include'],function(_0x371e4e){return{'model':db[_0x371e4e[_0xa775('0x1c')]],'as':_0x371e4e['as'],'attributes':_0x371e4e[_0xa775('0x1d')],'include':_0x371e4e[_0xa775('0x1b')]?_[_0xa775('0x1e')](_0x371e4e[_0xa775('0x1b')],function(_0x4b3c35){return{'model':db[_0x4b3c35[_0xa775('0x1c')]],'as':_0x4b3c35['as'],'attributes':_0x4b3c35['attributes']};}):[]};}):[]};}):[]:[]})[_0xa775('0x9')](function(_0x1649b4){logger[_0xa775('0xa')](_0xa775('0x15'),_0x5f51a9);logger['debug'](_0xa775('0x15'),_0x5f51a9,JSON[_0xa775('0xe')](_0x1649b4));_0x5cee02(_0x1649b4);})[_0xa775('0x14')](function(_0x45ed48){logger['error']('ShowVariable',_0x45ed48[_0xa775('0x11')],_0x5f51a9);_0x49fe50(_0x4e8225[_0xa775('0x10')](0x1f4,_0x45ed48['message']));});});}; \ No newline at end of file +var _0x1045=['code','message','result','catch','ShowVariable','find','options','raw','where','attributes','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1045,0x115));var _0x5104=function(_0x1e0aa3,_0x461c9a){_0x1e0aa3=_0x1e0aa3-0x0;var _0x45b898=_0x1045[_0x1e0aa3];return _0x45b898;};'use strict';var _=require(_0x5104('0x0'));var util=require(_0x5104('0x1'));var moment=require(_0x5104('0x2'));var BPromise=require(_0x5104('0x3'));var rs=require(_0x5104('0x4'));var fs=require('fs');var Redis=require(_0x5104('0x5'));var db=require(_0x5104('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5104('0x7'))('rpc');var config=require(_0x5104('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5104('0x9')][_0x5104('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe0e6ca,_0x23db12,_0x516fd3){return new BPromise(function(_0x11a6af,_0x8849ef){return client[_0x5104('0xb')](_0xe0e6ca,_0x516fd3)[_0x5104('0xc')](function(_0x2165fd){logger[_0x5104('0xd')](_0x5104('0xe'),_0x23db12,_0x5104('0xf'));logger[_0x5104('0x10')](_0x5104('0x11'),_0x23db12,_0x5104('0xf'),JSON[_0x5104('0x12')](_0x2165fd));if(_0x2165fd[_0x5104('0x13')]){if(_0x2165fd[_0x5104('0x13')][_0x5104('0x14')]===0x1f4){logger['error'](_0x5104('0xe'),_0x23db12,_0x2165fd[_0x5104('0x13')][_0x5104('0x15')]);return _0x8849ef(_0x2165fd['error']['message']);}logger[_0x5104('0x13')]('Variable,\x20%s,\x20%s',_0x23db12,_0x2165fd[_0x5104('0x13')][_0x5104('0x15')]);return _0x11a6af(_0x2165fd['error'][_0x5104('0x15')]);}else{logger[_0x5104('0xd')](_0x5104('0xe'),_0x23db12,_0x5104('0xf'));_0x11a6af(_0x2165fd[_0x5104('0x16')][_0x5104('0x15')]);}})[_0x5104('0x17')](function(_0xffbb26){logger[_0x5104('0x13')](_0x5104('0xe'),_0x23db12,_0xffbb26);_0x8849ef(_0xffbb26);});});}exports[_0x5104('0x18')]=function(_0x56921b){var _0x58d1d3=this;return new Promise(function(_0x37a594,_0x20ea77){return db['Variable'][_0x5104('0x19')]({'raw':_0x56921b[_0x5104('0x1a')]?_0x56921b[_0x5104('0x1a')][_0x5104('0x1b')]===undefined?!![]:![]:!![],'where':_0x56921b[_0x5104('0x1a')]?_0x56921b['options'][_0x5104('0x1c')]||null:null,'attributes':_0x56921b[_0x5104('0x1a')]?_0x56921b[_0x5104('0x1a')][_0x5104('0x1d')]||null:null,'include':_0x56921b[_0x5104('0x1a')]?_0x56921b[_0x5104('0x1a')][_0x5104('0x1e')]?_['map'](_0x56921b[_0x5104('0x1a')][_0x5104('0x1e')],function(_0xd46029){return{'model':db[_0xd46029[_0x5104('0x1f')]],'as':_0xd46029['as'],'attributes':_0xd46029[_0x5104('0x1d')],'include':_0xd46029[_0x5104('0x1e')]?_['map'](_0xd46029['include'],function(_0x12c277){return{'model':db[_0x12c277[_0x5104('0x1f')]],'as':_0x12c277['as'],'attributes':_0x12c277['attributes'],'include':_0x12c277[_0x5104('0x1e')]?_[_0x5104('0x20')](_0x12c277[_0x5104('0x1e')],function(_0x23b481){return{'model':db[_0x23b481[_0x5104('0x1f')]],'as':_0x23b481['as'],'attributes':_0x23b481[_0x5104('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36bcfa){logger[_0x5104('0xd')](_0x5104('0x18'),_0x56921b);logger[_0x5104('0x10')](_0x5104('0x18'),_0x56921b,JSON[_0x5104('0x12')](_0x36bcfa));_0x37a594(_0x36bcfa);})[_0x5104('0x17')](function(_0x4973a4){logger[_0x5104('0x13')](_0x5104('0x18'),_0x4973a4[_0x5104('0x15')],_0x56921b);_0x20ea77(_0x58d1d3[_0x5104('0x13')](0x1f4,_0x4973a4[_0x5104('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 8baa398..af2a729 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 _0xefcb=['exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','canUpdate','fetch','/reset','/pull','pull','/restart','restart','/migrations','migrations'];(function(_0x4e58f1,_0x3ab6ad){var _0x481bd9=function(_0x5ab8a9){while(--_0x5ab8a9){_0x4e58f1['push'](_0x4e58f1['shift']());}};_0x481bd9(++_0x3ab6ad);}(_0xefcb,0x144));var _0xbefc=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xefcb[_0x160c73];return _0xd9302;};'use strict';var express=require(_0xbefc('0x0'));var router=express[_0xbefc('0x1')]();var auth=require(_0xbefc('0x2'));var controller=require(_0xbefc('0x3'));router[_0xbefc('0x4')]('/',controller[_0xbefc('0x5')]);router[_0xbefc('0x4')](_0xbefc('0x6'),auth['isAuthenticated'](),auth[_0xbefc('0x7')](),controller[_0xbefc('0x8')]);router[_0xbefc('0x4')](_0xbefc('0x9'),auth['isAuthenticated'](),auth['canUpdate'](),controller['reset']);router[_0xbefc('0x4')](_0xbefc('0xa'),auth['isAuthenticated'](),auth[_0xbefc('0x7')](),controller[_0xbefc('0xb')]);router[_0xbefc('0x4')](_0xbefc('0xc'),auth['isAuthenticated'](),controller[_0xbefc('0xd')]);router[_0xbefc('0x4')](_0xbefc('0xe'),controller[_0xbefc('0xf')]);module[_0xbefc('0x10')]=router; \ No newline at end of file +var _0xf4fb=['/reset','/pull','pull','/restart','restart','/migrations','migrations','exports','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','canUpdate','fetch'];(function(_0x181777,_0x226350){var _0x43c330=function(_0x4056c4){while(--_0x4056c4){_0x181777['push'](_0x181777['shift']());}};_0x43c330(++_0x226350);}(_0xf4fb,0xe9));var _0xbf4f=function(_0x280bd5,_0x1bee2b){_0x280bd5=_0x280bd5-0x0;var _0x3ce761=_0xf4fb[_0x280bd5];return _0x3ce761;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xbf4f('0x0'));var controller=require(_0xbf4f('0x1'));router[_0xbf4f('0x2')]('/',controller['index']);router[_0xbf4f('0x2')](_0xbf4f('0x3'),auth[_0xbf4f('0x4')](),auth[_0xbf4f('0x5')](),controller[_0xbf4f('0x6')]);router['get'](_0xbf4f('0x7'),auth[_0xbf4f('0x4')](),auth[_0xbf4f('0x5')](),controller['reset']);router[_0xbf4f('0x2')](_0xbf4f('0x8'),auth[_0xbf4f('0x4')](),auth[_0xbf4f('0x5')](),controller[_0xbf4f('0x9')]);router[_0xbf4f('0x2')](_0xbf4f('0xa'),auth[_0xbf4f('0x4')](),controller[_0xbf4f('0xb')]);router[_0xbf4f('0x2')](_0xbf4f('0xc'),controller[_0xbf4f('0xd')]);module[_0xbf4f('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 9a33547..df5eb2a 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 _0x002d=['json','origin','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','server','length','replace','push','sort','sequelize','Migration','getQueryInterface','constructor','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','version','query','fetch','tags','latest','2.0.0','status'];(function(_0x29fc2c,_0x4ff86a){var _0x1adbc8=function(_0x596f87){while(--_0x596f87){_0x29fc2c['push'](_0x29fc2c['shift']());}};_0x1adbc8(++_0x4ff86a);}(_0x002d,0xca));var _0xd002=function(_0x4c214f,_0x5367f2){_0x4c214f=_0x4c214f-0x0;var _0x4d4192=_0x002d[_0x4c214f];return _0x4d4192;};'use strict';var Umzug=require(_0xd002('0x0'));var path=require(_0xd002('0x1'));var fs=require('fs');var _=require(_0xd002('0x2'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0xd002('0x3'));var exec=require(_0xd002('0x4'))[_0xd002('0x5')];var db=require(_0xd002('0x6'))['db'];var config=require(_0xd002('0x7'));var pm2=require(_0xd002('0x8'));var logger=require(_0xd002('0x9'))(_0xd002('0xa'));var git=require(_0xd002('0xb'))(config[_0xd002('0xc')]);exports[_0xd002('0xd')]=function(_0x45d45f,_0x18df0a){var _0x166980={'current':module[_0xd002('0xe')][_0xd002('0xf')],'phonebar':0x2};if(_0x45d45f[_0xd002('0x10')]&&_0x45d45f['query']['latest']){return git[_0xd002('0x11')]()[_0xd002('0x12')](function(_0x2be09b,_0x50ba00){_0x166980[_0xd002('0x13')]=(_0x2be09b?module[_0xd002('0xe')][_0xd002('0xf')]:_0x50ba00[_0xd002('0x13')])||_0xd002('0x14');return _0x18df0a[_0xd002('0x15')](0xc8)[_0xd002('0x16')](_0x166980);});}else{return _0x18df0a[_0xd002('0x15')](0xc8)[_0xd002('0x16')](_0x166980);}};exports[_0xd002('0x11')]=function(_0x2df661,_0x4de1c3){return git[_0xd002('0x11')]([_0xd002('0x17'),'master'],function(_0x498590){if(_0x498590){logger['error'](_0x498590);return _0x4de1c3[_0xd002('0x15')](0x1f4)['json'](_0x498590);}logger[_0xd002('0x18')](_0xd002('0x19'));return _0x4de1c3[_0xd002('0x15')](0xc8)[_0xd002('0x16')]({'output':_0xd002('0x1a')});});};exports[_0xd002('0x1b')]=function(_0x241c80,_0x5e1f31){return git[_0xd002('0x1b')]([_0xd002('0x1c'),_0xd002('0x1d')],function(_0x3b1725){if(_0x3b1725){logger[_0xd002('0x1e')](_0x3b1725);return _0x5e1f31['status'](0x1f4)[_0xd002('0x16')](_0x3b1725);}logger[_0xd002('0x18')](_0xd002('0x1f'));return _0x5e1f31[_0xd002('0x15')](0xc8)[_0xd002('0x16')]({'output':_0xd002('0x20')});});};exports['pull']=function(_0x490310,_0xa57f52){exec(_0xd002('0x21'),function(_0x1bfa76,_0x45cd2e,_0x28cfb1){logger[_0xd002('0x18')](_0x45cd2e);logger[_0xd002('0x18')](_0x28cfb1);if(_0x1bfa76){logger[_0xd002('0x1e')](_0x1bfa76);return _0xa57f52[_0xd002('0x15')](0x1f4)[_0xd002('0x16')](_0x1bfa76);}return _0xa57f52[_0xd002('0x15')](0xc8)[_0xd002('0x16')]({'output':_0x45cd2e});});};exports['restart']=function(_0x25a29d,_0x24155f){return pm2['restart'](_0xd002('0x22'))[_0xd002('0x23')](function(_0x1f1e72){logger['info'](_0xd002('0x24'),_0x1f1e72);return _0x24155f['status'](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xd002('0x25')](function(_0x45745c){logger[_0xd002('0x1e')](_0x45745c);return _0x24155f[_0xd002('0x15')](0x1f4)[_0xd002('0x16')](_0x45745c);});};exports[_0xd002('0x26')]=function(_0x1648e1,_0x3e0cc2){var _0x9999ea=fs[_0xd002('0x27')](path['join'](config[_0xd002('0xc')],_0xd002('0x28'),_0xd002('0x26')));var _0x3b6653=[];for(var _0x4d863e=0x0;_0x4d863e<_0x9999ea[_0xd002('0x29')];_0x4d863e++){var _0x568d90=_0x9999ea[_0x4d863e][_0xd002('0x2a')]('.js','');if(compareVersions(module[_0xd002('0xe')][_0xd002('0xf')],_0x568d90)===-0x1){_0x3b6653[_0xd002('0x2b')](_0x568d90);}}if(_0x3b6653[_0xd002('0x29')]){var _0x15c485=_0x3b6653[_0xd002('0x2c')](compareVersions);var _0x160d12=new Umzug({'storage':_0xd002('0x2d'),'storageOptions':{'model':db['Migration'],'modelName':_0xd002('0x2e'),'columnName':_0xd002('0xf')},'migrations':{'params':[db[_0xd002('0x2d')][_0xd002('0x2f')](),db[_0xd002('0x2d')][_0xd002('0x30')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path['join'](config['root'],_0xd002('0x28'),'migrations'),'pattern':/\.js$/}});_0x160d12['up']({'migrations':_[_0xd002('0x31')](_0x15c485,function(_0x115090){return _0x115090+_0xd002('0x32');})})[_0xd002('0x23')](function(){return _0x3e0cc2[_0xd002('0x15')](0xc8)[_0xd002('0x16')]({'output':_0xd002('0x33')+module[_0xd002('0xe')]['version']+_0xd002('0x34')+_[_0xd002('0x35')](_0x15c485),'migrations':_['join'](_0x15c485)});})['catch'](function(_0x221e51){if(_0x221e51 instanceof db[_0xd002('0x2d')][_0xd002('0x36')]){return _0x3e0cc2[_0xd002('0x15')](0xc8)['json']({'output':_0xd002('0x37')});}else{return _0x3e0cc2['status'](0x1f4)[_0xd002('0x16')](_0x221e51);}});}else{return _0x3e0cc2[_0xd002('0x15')](0xc8)[_0xd002('0x16')]({'output':_0xd002('0x37')});}}; \ No newline at end of file +var _0x94ff=['map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/logger','update','root','exports','query','fetch','tags','latest','2.0.0','json','status','origin','master','error','git\x20fetch','--hard','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','restart','motion2','migrations','join','server','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.'];(function(_0x389832,_0x10a4a9){var _0x59429e=function(_0x5f3562){while(--_0x5f3562){_0x389832['push'](_0x389832['shift']());}};_0x59429e(++_0x10a4a9);}(_0x94ff,0xc3));var _0xf94f=function(_0x187e96,_0x1aac2a){_0x187e96=_0x187e96-0x0;var _0x509857=_0x94ff[_0x187e96];return _0x509857;};'use strict';var Umzug=require(_0xf94f('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0xf94f('0x1'));var compareVersions=require(_0xf94f('0x2'));var exec=require(_0xf94f('0x3'))['exec'];var db=require(_0xf94f('0x4'))['db'];var config=require(_0xf94f('0x5'));var pm2=require('../../config/pm2');var logger=require(_0xf94f('0x6'))(_0xf94f('0x7'));var git=require('simple-git')(config[_0xf94f('0x8')]);exports['index']=function(_0x192f2c,_0x2a1923){var _0x5bb8ee={'current':module[_0xf94f('0x9')][_0xf94f('0x1')],'phonebar':0x2};if(_0x192f2c[_0xf94f('0xa')]&&_0x192f2c['query']['latest']){return git[_0xf94f('0xb')]()[_0xf94f('0xc')](function(_0x234f34,_0x286ad9){_0x5bb8ee[_0xf94f('0xd')]=(_0x234f34?module[_0xf94f('0x9')][_0xf94f('0x1')]:_0x286ad9[_0xf94f('0xd')])||_0xf94f('0xe');return _0x2a1923['status'](0xc8)[_0xf94f('0xf')](_0x5bb8ee);});}else{return _0x2a1923[_0xf94f('0x10')](0xc8)[_0xf94f('0xf')](_0x5bb8ee);}};exports[_0xf94f('0xb')]=function(_0x4ab810,_0x16766e){return git[_0xf94f('0xb')]([_0xf94f('0x11'),_0xf94f('0x12')],function(_0x3505e2){if(_0x3505e2){logger[_0xf94f('0x13')](_0x3505e2);return _0x16766e['status'](0x1f4)[_0xf94f('0xf')](_0x3505e2);}logger['info'](_0xf94f('0x14'));return _0x16766e[_0xf94f('0x10')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports['reset']=function(_0x457463,_0x4fa016){return git['reset']([_0xf94f('0x15'),'FETCH_HEAD'],function(_0x33defc){if(_0x33defc){logger['error'](_0x33defc);return _0x4fa016[_0xf94f('0x10')](0x1f4)['json'](_0x33defc);}logger[_0xf94f('0x16')](_0xf94f('0x17'));return _0x4fa016['status'](0xc8)[_0xf94f('0xf')]({'output':_0xf94f('0x18')});});};exports['pull']=function(_0x3c275b,_0x86e36f){exec('npm\x20install\x20--production',function(_0x15db29,_0x3aa34b,_0x5beb9c){logger[_0xf94f('0x16')](_0x3aa34b);logger[_0xf94f('0x16')](_0x5beb9c);if(_0x15db29){logger[_0xf94f('0x13')](_0x15db29);return _0x86e36f[_0xf94f('0x10')](0x1f4)[_0xf94f('0xf')](_0x15db29);}return _0x86e36f['status'](0xc8)[_0xf94f('0xf')]({'output':_0x3aa34b});});};exports[_0xf94f('0x19')]=function(_0x4048f1,_0x4def6f){return pm2[_0xf94f('0x19')](_0xf94f('0x1a'))['then'](function(_0x1cb6e5){logger['info']('pm2\x20restart\x20motion\x20%s',_0x1cb6e5);return _0x4def6f[_0xf94f('0x10')](0xc8)[_0xf94f('0xf')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x9cdeeb){logger[_0xf94f('0x13')](_0x9cdeeb);return _0x4def6f['status'](0x1f4)[_0xf94f('0xf')](_0x9cdeeb);});};exports[_0xf94f('0x1b')]=function(_0x341cac,_0x5939dd){var _0x18b013=fs['readdirSync'](path[_0xf94f('0x1c')](config[_0xf94f('0x8')],_0xf94f('0x1d'),'migrations'));var _0x1175fc=[];for(var _0xe3e35=0x0;_0xe3e35<_0x18b013[_0xf94f('0x1e')];_0xe3e35++){var _0x3adb65=_0x18b013[_0xe3e35][_0xf94f('0x1f')](_0xf94f('0x20'),'');if(compareVersions(module[_0xf94f('0x9')]['version'],_0x3adb65)===-0x1){_0x1175fc[_0xf94f('0x21')](_0x3adb65);}}if(_0x1175fc[_0xf94f('0x1e')]){var _0x29ae73=_0x1175fc[_0xf94f('0x22')](compareVersions);var _0x27e391=new Umzug({'storage':_0xf94f('0x23'),'storageOptions':{'model':db[_0xf94f('0x24')],'modelName':_0xf94f('0x24'),'columnName':_0xf94f('0x1')},'migrations':{'params':[db[_0xf94f('0x23')][_0xf94f('0x25')](),db['sequelize'][_0xf94f('0x26')],function(){throw new Error(_0xf94f('0x27'));}],'path':path[_0xf94f('0x1c')](config['root'],_0xf94f('0x1d'),_0xf94f('0x1b')),'pattern':/\.js$/}});_0x27e391['up']({'migrations':_[_0xf94f('0x28')](_0x29ae73,function(_0x378810){return _0x378810+_0xf94f('0x20');})})[_0xf94f('0x29')](function(){return _0x5939dd[_0xf94f('0x10')](0xc8)[_0xf94f('0xf')]({'output':_0xf94f('0x2a')+module[_0xf94f('0x9')]['version']+'\x20to\x20'+_[_0xf94f('0x2b')](_0x29ae73),'migrations':_[_0xf94f('0x1c')](_0x29ae73)});})[_0xf94f('0x2c')](function(_0x30abd8){if(_0x30abd8 instanceof db[_0xf94f('0x23')][_0xf94f('0x2d')]){return _0x5939dd['status'](0xc8)[_0xf94f('0xf')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x5939dd['status'](0x1f4)[_0xf94f('0xf')](_0x30abd8);}});}else{return _0x5939dd[_0xf94f('0x10')](0xc8)[_0xf94f('0xf')]({'output':_0xf94f('0x2e')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 1d7c023..de401f0 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 _0x0b0e=['get','isAuthenticated','index','describe','/:id','post','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller'];(function(_0xba3a9a,_0x3e844a){var _0x19a71c=function(_0x1c5980){while(--_0x1c5980){_0xba3a9a['push'](_0xba3a9a['shift']());}};_0x19a71c(++_0x3e844a);}(_0x0b0e,0x187));var _0xe0b0=function(_0x81fe53,_0x5b8f05){_0x81fe53=_0x81fe53-0x0;var _0x56f7a7=_0x0b0e[_0x81fe53];return _0x56f7a7;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['show']);router[_0xe0b0('0xe')]('/',auth[_0xe0b0('0xa')](),controller['create']);router[_0xe0b0('0xf')](_0xe0b0('0xd'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')](_0xe0b0('0xd'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);module[_0xe0b0('0x13')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x4aadbc,_0x4afc4d){var _0x372f33=function(_0xc50454){while(--_0xc50454){_0x4aadbc['push'](_0x4aadbc['shift']());}};_0x372f33(++_0x4afc4d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index b48c884..29e54e8 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 _0x6f47=['FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0xab6f17,_0x4b0777){var _0x4b7ea7=function(_0x3caa9e){while(--_0x3caa9e){_0xab6f17['push'](_0xab6f17['shift']());}};_0x4b7ea7(++_0x4b0777);}(_0x6f47,0xc7));var _0x76f4=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x6f47[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'type':{'type':Sequelize[_0x76f4('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x76f4('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x76f4('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x76f4('0x1')]},'agentcalledAt':{'type':Sequelize[_0x76f4('0x2')]},'agentconnectAt':{'type':Sequelize[_0x76f4('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x76f4('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x76f4('0x2')]},'holdtime':{'type':Sequelize[_0x76f4('0x3')]},'agentcomplete':{'type':Sequelize[_0x76f4('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x76f4('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x76f4('0x3')]},'agentacw':{'type':Sequelize[_0x76f4('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x76f4('0x3')]},'reason':{'type':Sequelize[_0x76f4('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x76f4('0x3')]},'channelstatedesc':{'type':Sequelize[_0x76f4('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x76f4('0x1')]},'accountcode':{'type':Sequelize[_0x76f4('0x1')]},'context':{'type':Sequelize[_0x76f4('0x1')]},'exten':{'type':Sequelize[_0x76f4('0x1')]},'priority':{'type':Sequelize[_0x76f4('0x1')]},'destchannel':{'type':Sequelize[_0x76f4('0x1')]},'destchannelstate':{'type':Sequelize[_0x76f4('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x76f4('0x1')]},'destcalleridnum':{'type':Sequelize[_0x76f4('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x76f4('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x76f4('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x76f4('0x1')]},'destpriority':{'type':Sequelize[_0x76f4('0x1')]},'destuniqueid':{'type':Sequelize[_0x76f4('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x76f4('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x76f4('0x1')]},'transfer':{'type':Sequelize[_0x76f4('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x76f4('0x1')],'comment':_0x76f4('0x5')},'transferexten':{'type':Sequelize[_0x76f4('0x1')]},'transferuniqueid':{'type':Sequelize[_0x76f4('0x1')]},'agententerreason':{'type':Sequelize[_0x76f4('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8fb=['DATE','BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0xd0f42d,_0x5beaab){var _0x26534c=function(_0x281ccb){while(--_0x281ccb){_0xd0f42d['push'](_0xd0f42d['shift']());}};_0x26534c(++_0x5beaab);}(_0xd8fb,0x99));var _0xbd8f=function(_0x3703ef,_0xd32289){_0x3703ef=_0x3703ef-0x0;var _0x5b39f2=_0xd8fb[_0x3703ef];return _0x5b39f2;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'type':{'type':Sequelize[_0xbd8f('0x2')]},'uniqueid':{'type':Sequelize[_0xbd8f('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xbd8f('0x2')]},'membername':{'type':Sequelize[_0xbd8f('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xbd8f('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xbd8f('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xbd8f('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xbd8f('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xbd8f('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xbd8f('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xbd8f('0x2')]},'lastevent':{'type':Sequelize[_0xbd8f('0x2')]},'channel':{'type':Sequelize[_0xbd8f('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xbd8f('0x2')]},'connectedlinenum':{'type':Sequelize[_0xbd8f('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbd8f('0x2')]},'context':{'type':Sequelize[_0xbd8f('0x2')]},'exten':{'type':Sequelize[_0xbd8f('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xbd8f('0x2')]},'destchannelstate':{'type':Sequelize[_0xbd8f('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xbd8f('0x2')]},'destcalleridnum':{'type':Sequelize[_0xbd8f('0x2')]},'destcalleridname':{'type':Sequelize[_0xbd8f('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xbd8f('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xbd8f('0x2')]},'destlanguage':{'type':Sequelize[_0xbd8f('0x2')]},'destaccountcode':{'type':Sequelize[_0xbd8f('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xbd8f('0x2')]},'destpriority':{'type':Sequelize[_0xbd8f('0x2')]},'destuniqueid':{'type':Sequelize[_0xbd8f('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xbd8f('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xbd8f('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xbd8f('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xbd8f('0x2')]},'transferuniqueid':{'type':Sequelize[_0xbd8f('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 9260d2b..f202ef7 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 _0x73a3=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','then','error','stack','name','map','VoiceAgentReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x12391d,_0x21186d){var _0xb9ffb9=function(_0x52079d){while(--_0x52079d){_0x12391d['push'](_0x12391d['shift']());}};_0xb9ffb9(++_0x21186d);}(_0x73a3,0x14e));var _0x373a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x73a3[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x373a('0x0'));var rimraf=require(_0x373a('0x1'));var zipdir=require(_0x373a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x373a('0x3'));var moment=require(_0x373a('0x4'));var BPromise=require(_0x373a('0x5'));var Mustache=require(_0x373a('0x6'));var util=require(_0x373a('0x7'));var path=require(_0x373a('0x8'));var sox=require(_0x373a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x373a('0xa'));var _=require(_0x373a('0xb'));var squel=require(_0x373a('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x373a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x373a('0xe'));var Papa=require(_0x373a('0xf'));var Redis=require(_0x373a('0x10'));var authService=require(_0x373a('0x11'));var qs=require(_0x373a('0x12'));var as=require(_0x373a('0x13'));var hardwareService=require(_0x373a('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x373a('0x15'));var config=require(_0x373a('0x16'));var licenseUtil=require(_0x373a('0x17'));var db=require(_0x373a('0x18'))['db'];function respondWithStatusCode(_0x4e866d,_0x6640c0){_0x6640c0=_0x6640c0||0xcc;return function(_0x343b05){if(_0x343b05){return _0x4e866d[_0x373a('0x19')](_0x6640c0);}return _0x4e866d[_0x373a('0x1a')](_0x6640c0)[_0x373a('0x1b')]();};}function respondWithResult(_0x57e1be,_0x23cdc5){_0x23cdc5=_0x23cdc5||0xc8;return function(_0xffee92){if(_0xffee92){return _0x57e1be[_0x373a('0x1a')](_0x23cdc5)['json'](_0xffee92);}};}function respondWithFilteredResult(_0x248024,_0xc81908){return function(_0x5f28dd){if(_0x5f28dd){var _0x778b60=_0x5f28dd[_0x373a('0x1c')],_0x5a72d0=_0xc81908[_0x373a('0x1d')],_0x5adfd3=_0xc81908['offset']+_0xc81908[_0x373a('0x1e')],_0x1006d5;if(_0x5adfd3>=_0x778b60){_0x5adfd3=_0x778b60;_0x1006d5=0xc8;}else{_0x1006d5=0xce;}_0x248024['status'](_0x1006d5);return _0x248024[_0x373a('0x1f')](_0x373a('0x20'),_0x5a72d0+'-'+_0x5adfd3+'/'+_0x778b60)[_0x373a('0x21')](_0x5f28dd);}return null;};}function patchUpdates(_0x5c69f4){return function(_0x3f3a38){try{jsonpatch['apply'](_0x3f3a38,_0x5c69f4,!![]);}catch(_0x398daf){return BPromise['reject'](_0x398daf);}return _0x3f3a38['save']();};}function saveUpdates(_0x49c495,_0x172004){return function(_0x20e91e){if(_0x20e91e){return _0x20e91e['update'](_0x49c495)[_0x373a('0x22')](function(_0x9c5045){return _0x9c5045;});}return null;};}function removeEntity(_0x448310,_0x2e01cf){return function(_0x4e174b){if(_0x4e174b){return _0x4e174b['destroy']()['then'](function(){_0x448310[_0x373a('0x1a')](0xcc)[_0x373a('0x1b')]();});}};}function handleEntityNotFound(_0xc8662e,_0x852597){return function(_0x5ea6c2){if(!_0x5ea6c2){_0xc8662e[_0x373a('0x19')](0x194);}return _0x5ea6c2;};}function handleError(_0xc9e11e,_0x444853){_0x444853=_0x444853||0x1f4;return function(_0x811c7b){logger[_0x373a('0x23')](_0x811c7b[_0x373a('0x24')]);if(_0x811c7b[_0x373a('0x25')]){delete _0x811c7b[_0x373a('0x25')];}_0xc9e11e[_0x373a('0x1a')](_0x444853)['send'](_0x811c7b);};}exports['index']=function(_0x17a5e2,_0x978b05){var _0x509380={},_0x25d38f={},_0x346f9f={'count':0x0,'rows':[]};var _0x4b5de4=_[_0x373a('0x26')](db[_0x373a('0x27')][_0x373a('0x28')],function(_0x26ced7){return{'name':_0x26ced7[_0x373a('0x29')],'type':_0x26ced7[_0x373a('0x2a')][_0x373a('0x2b')]};});_0x25d38f[_0x373a('0x2c')]=_['map'](_0x4b5de4,_0x373a('0x25'));_0x25d38f[_0x373a('0x2d')]=_[_0x373a('0x2e')](_0x17a5e2[_0x373a('0x2d')]);_0x25d38f['filters']=_[_0x373a('0x2f')](_0x25d38f[_0x373a('0x2c')],_0x25d38f[_0x373a('0x2d')]);_0x509380[_0x373a('0x30')]=_[_0x373a('0x2f')](_0x25d38f[_0x373a('0x2c')],qs[_0x373a('0x31')](_0x17a5e2[_0x373a('0x2d')]['fields']));_0x509380[_0x373a('0x30')]=_0x509380['attributes'][_0x373a('0x32')]?_0x509380['attributes']:_0x25d38f[_0x373a('0x2c')];if(!_0x17a5e2[_0x373a('0x2d')]['hasOwnProperty'](_0x373a('0x33'))){_0x509380[_0x373a('0x1e')]=qs[_0x373a('0x1e')](_0x17a5e2[_0x373a('0x2d')][_0x373a('0x1e')]);_0x509380[_0x373a('0x1d')]=qs['offset'](_0x17a5e2['query'][_0x373a('0x1d')]);}_0x509380[_0x373a('0x34')]=qs[_0x373a('0x35')](_0x17a5e2[_0x373a('0x2d')][_0x373a('0x35')]);_0x509380[_0x373a('0x36')]=qs[_0x373a('0x37')](_[_0x373a('0x38')](_0x17a5e2[_0x373a('0x2d')],_0x25d38f[_0x373a('0x37')]),_0x4b5de4);if(_0x17a5e2[_0x373a('0x2d')][_0x373a('0x39')]){_0x509380[_0x373a('0x36')]=_[_0x373a('0x3a')](_0x509380[_0x373a('0x36')],{'$or':_[_0x373a('0x26')](_0x4b5de4,function(_0x1b7713){if(_0x1b7713['type']!==_0x373a('0x3b')){var _0x23f0d5={};_0x23f0d5[_0x1b7713['name']]={'$like':'%'+_0x17a5e2[_0x373a('0x2d')][_0x373a('0x39')]+'%'};return _0x23f0d5;}})});}_0x509380=_[_0x373a('0x3a')]({},_0x509380,_0x17a5e2[_0x373a('0x3c')]);var _0x38bdbd={'where':_0x509380[_0x373a('0x36')]};return db[_0x373a('0x27')][_0x373a('0x1c')](_0x38bdbd)[_0x373a('0x22')](function(_0x227e94){_0x346f9f[_0x373a('0x1c')]=_0x227e94;if(_0x17a5e2[_0x373a('0x2d')][_0x373a('0x3d')]){_0x509380['include']=[{'all':!![]}];}return db[_0x373a('0x27')][_0x373a('0x3e')](_0x509380);})[_0x373a('0x22')](function(_0x537dea){_0x346f9f[_0x373a('0x3f')]=_0x537dea;return _0x346f9f;})['then'](respondWithFilteredResult(_0x978b05,_0x509380))[_0x373a('0x40')](handleError(_0x978b05,null));};exports[_0x373a('0x41')]=function(_0x18805b,_0x2958f7){var _0x22aacd={'raw':![],'where':{'id':_0x18805b[_0x373a('0x42')]['id']}},_0x2e5d8c={};_0x2e5d8c[_0x373a('0x2c')]=_[_0x373a('0x2e')](db[_0x373a('0x27')]['rawAttributes']);_0x2e5d8c[_0x373a('0x2d')]=_['keys'](_0x18805b[_0x373a('0x2d')]);_0x2e5d8c[_0x373a('0x37')]=_[_0x373a('0x2f')](_0x2e5d8c['model'],_0x2e5d8c[_0x373a('0x2d')]);_0x22aacd['attributes']=_['intersection'](_0x2e5d8c[_0x373a('0x2c')],qs[_0x373a('0x31')](_0x18805b[_0x373a('0x2d')][_0x373a('0x31')]));_0x22aacd['attributes']=_0x22aacd[_0x373a('0x30')][_0x373a('0x32')]?_0x22aacd[_0x373a('0x30')]:_0x2e5d8c[_0x373a('0x2c')];if(_0x18805b[_0x373a('0x2d')][_0x373a('0x3d')]){_0x22aacd['include']=[{'all':!![]}];}_0x22aacd=_[_0x373a('0x3a')]({},_0x22aacd,_0x18805b['options']);return db['VoiceAgentReport'][_0x373a('0x43')](_0x22aacd)[_0x373a('0x22')](handleEntityNotFound(_0x2958f7,null))['then'](respondWithResult(_0x2958f7,null))[_0x373a('0x40')](handleError(_0x2958f7,null));};exports[_0x373a('0x44')]=function(_0x3f7667,_0x4c69a1){return db[_0x373a('0x27')][_0x373a('0x44')](_0x3f7667['body'],{})['then'](respondWithResult(_0x4c69a1,0xc9))['catch'](handleError(_0x4c69a1,null));};exports['update']=function(_0x503e9e,_0x15b227){if(_0x503e9e[_0x373a('0x45')]['id']){delete _0x503e9e[_0x373a('0x45')]['id'];}return db['VoiceAgentReport'][_0x373a('0x43')]({'where':{'id':_0x503e9e[_0x373a('0x42')]['id']}})[_0x373a('0x22')](handleEntityNotFound(_0x15b227,null))[_0x373a('0x22')](saveUpdates(_0x503e9e[_0x373a('0x45')],null))['then'](respondWithResult(_0x15b227,null))[_0x373a('0x40')](handleError(_0x15b227,null));};exports['destroy']=function(_0x1a0914,_0x4ff005){return db[_0x373a('0x27')][_0x373a('0x43')]({'where':{'id':_0x1a0914['params']['id']}})[_0x373a('0x22')](handleEntityNotFound(_0x4ff005,null))[_0x373a('0x22')](removeEntity(_0x4ff005,null))['catch'](handleError(_0x4ff005,null));};exports[_0x373a('0x46')]=function(_0xa5a4fe,_0x8380cf){return db[_0x373a('0x27')]['describe']()[_0x373a('0x22')](respondWithResult(_0x8380cf,null))[_0x373a('0x40')](handleError(_0x8380cf,null));}; \ No newline at end of file +var _0xec90=['ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','map','query','filters','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','VoiceAgentReport','includeAll','include','findAll','catch','show','keys','intersection','length','options','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv'];(function(_0x528a11,_0x25ca52){var _0x5df1c4=function(_0x5374c8){while(--_0x5374c8){_0x528a11['push'](_0x528a11['shift']());}};_0x5df1c4(++_0x25ca52);}(_0xec90,0x1ca));var _0x0ec9=function(_0x1c3281,_0x5c69a0){_0x1c3281=_0x1c3281-0x0;var _0x27588d=_0xec90[_0x1c3281];return _0x27588d;};'use strict';var emlformat=require(_0x0ec9('0x0'));var rimraf=require(_0x0ec9('0x1'));var zipdir=require(_0x0ec9('0x2'));var jsonpatch=require(_0x0ec9('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0ec9('0x4'));var Mustache=require(_0x0ec9('0x5'));var util=require(_0x0ec9('0x6'));var path=require(_0x0ec9('0x7'));var sox=require(_0x0ec9('0x8'));var csv=require(_0x0ec9('0x9'));var ejs=require(_0x0ec9('0xa'));var fs=require('fs');var fs_extra=require(_0x0ec9('0xb'));var _=require(_0x0ec9('0xc'));var squel=require('squel');var crypto=require(_0x0ec9('0xd'));var jsforce=require(_0x0ec9('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0ec9('0xf'));var Papa=require(_0x0ec9('0x10'));var Redis=require(_0x0ec9('0x11'));var authService=require(_0x0ec9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0ec9('0x13'));var hardwareService=require(_0x0ec9('0x14'));var logger=require('../../config/logger')(_0x0ec9('0x15'));var utils=require(_0x0ec9('0x16'));var config=require(_0x0ec9('0x17'));var licenseUtil=require(_0x0ec9('0x18'));var db=require(_0x0ec9('0x19'))['db'];function respondWithStatusCode(_0x24e94b,_0x598ddd){_0x598ddd=_0x598ddd||0xcc;return function(_0x12a171){if(_0x12a171){return _0x24e94b['sendStatus'](_0x598ddd);}return _0x24e94b[_0x0ec9('0x1a')](_0x598ddd)[_0x0ec9('0x1b')]();};}function respondWithResult(_0x279ccb,_0x15aed7){_0x15aed7=_0x15aed7||0xc8;return function(_0x1d57de){if(_0x1d57de){return _0x279ccb[_0x0ec9('0x1a')](_0x15aed7)[_0x0ec9('0x1c')](_0x1d57de);}};}function respondWithFilteredResult(_0x44f38f,_0x3aeb97){return function(_0x43ffcf){if(_0x43ffcf){var _0x3a8a86=_0x43ffcf[_0x0ec9('0x1d')],_0x458f19=_0x3aeb97[_0x0ec9('0x1e')],_0x2282dc=_0x3aeb97['offset']+_0x3aeb97['limit'],_0x3cc9eb;if(_0x2282dc>=_0x3a8a86){_0x2282dc=_0x3a8a86;_0x3cc9eb=0xc8;}else{_0x3cc9eb=0xce;}_0x44f38f['status'](_0x3cc9eb);return _0x44f38f[_0x0ec9('0x1f')](_0x0ec9('0x20'),_0x458f19+'-'+_0x2282dc+'/'+_0x3a8a86)['json'](_0x43ffcf);}return null;};}function patchUpdates(_0x27ac2b){return function(_0x3f53c2){try{jsonpatch[_0x0ec9('0x21')](_0x3f53c2,_0x27ac2b,!![]);}catch(_0x2145c0){return BPromise[_0x0ec9('0x22')](_0x2145c0);}return _0x3f53c2['save']();};}function saveUpdates(_0x3d31fd,_0x4286d0){return function(_0x4c3f7f){if(_0x4c3f7f){return _0x4c3f7f['update'](_0x3d31fd)[_0x0ec9('0x23')](function(_0xa98177){return _0xa98177;});}return null;};}function removeEntity(_0xe95b6,_0x291f72){return function(_0x389bd7){if(_0x389bd7){return _0x389bd7[_0x0ec9('0x24')]()['then'](function(){_0xe95b6[_0x0ec9('0x1a')](0xcc)[_0x0ec9('0x1b')]();});}};}function handleEntityNotFound(_0x5f8f8f,_0x1c014a){return function(_0x532d6e){if(!_0x532d6e){_0x5f8f8f[_0x0ec9('0x25')](0x194);}return _0x532d6e;};}function handleError(_0x27f5b1,_0x4b15bb){_0x4b15bb=_0x4b15bb||0x1f4;return function(_0x3f9c5a){logger[_0x0ec9('0x26')](_0x3f9c5a[_0x0ec9('0x27')]);if(_0x3f9c5a[_0x0ec9('0x28')]){delete _0x3f9c5a[_0x0ec9('0x28')];}_0x27f5b1[_0x0ec9('0x1a')](_0x4b15bb)[_0x0ec9('0x29')](_0x3f9c5a);};}exports[_0x0ec9('0x2a')]=function(_0x2420df,_0xa4be71){var _0xae4b9e={},_0x4ec5a6={},_0x92386d={'count':0x0,'rows':[]};var _0x1e16e3=_['map'](db['VoiceAgentReport'][_0x0ec9('0x2b')],function(_0x1ad38a){return{'name':_0x1ad38a['fieldName'],'type':_0x1ad38a[_0x0ec9('0x2c')][_0x0ec9('0x2d')]};});_0x4ec5a6['model']=_[_0x0ec9('0x2e')](_0x1e16e3,_0x0ec9('0x28'));_0x4ec5a6[_0x0ec9('0x2f')]=_['keys'](_0x2420df[_0x0ec9('0x2f')]);_0x4ec5a6[_0x0ec9('0x30')]=_['intersection'](_0x4ec5a6[_0x0ec9('0x31')],_0x4ec5a6['query']);_0xae4b9e[_0x0ec9('0x32')]=_['intersection'](_0x4ec5a6[_0x0ec9('0x31')],qs[_0x0ec9('0x33')](_0x2420df['query']['fields']));_0xae4b9e['attributes']=_0xae4b9e['attributes']['length']?_0xae4b9e[_0x0ec9('0x32')]:_0x4ec5a6[_0x0ec9('0x31')];if(!_0x2420df[_0x0ec9('0x2f')][_0x0ec9('0x34')](_0x0ec9('0x35'))){_0xae4b9e[_0x0ec9('0x36')]=qs[_0x0ec9('0x36')](_0x2420df[_0x0ec9('0x2f')][_0x0ec9('0x36')]);_0xae4b9e[_0x0ec9('0x1e')]=qs[_0x0ec9('0x1e')](_0x2420df[_0x0ec9('0x2f')]['offset']);}_0xae4b9e[_0x0ec9('0x37')]=qs[_0x0ec9('0x38')](_0x2420df['query']['sort']);_0xae4b9e['where']=qs[_0x0ec9('0x30')](_[_0x0ec9('0x39')](_0x2420df[_0x0ec9('0x2f')],_0x4ec5a6['filters']),_0x1e16e3);if(_0x2420df[_0x0ec9('0x2f')][_0x0ec9('0x3a')]){_0xae4b9e[_0x0ec9('0x3b')]=_[_0x0ec9('0x3c')](_0xae4b9e[_0x0ec9('0x3b')],{'$or':_[_0x0ec9('0x2e')](_0x1e16e3,function(_0x1f5fb1){if(_0x1f5fb1[_0x0ec9('0x2c')]!==_0x0ec9('0x3d')){var _0x3f29b9={};_0x3f29b9[_0x1f5fb1[_0x0ec9('0x28')]]={'$like':'%'+_0x2420df['query'][_0x0ec9('0x3a')]+'%'};return _0x3f29b9;}})});}_0xae4b9e=_[_0x0ec9('0x3c')]({},_0xae4b9e,_0x2420df['options']);var _0x2c34b8={'where':_0xae4b9e[_0x0ec9('0x3b')]};return db[_0x0ec9('0x3e')][_0x0ec9('0x1d')](_0x2c34b8)[_0x0ec9('0x23')](function(_0x18af9c){_0x92386d['count']=_0x18af9c;if(_0x2420df['query'][_0x0ec9('0x3f')]){_0xae4b9e[_0x0ec9('0x40')]=[{'all':!![]}];}return db[_0x0ec9('0x3e')][_0x0ec9('0x41')](_0xae4b9e);})[_0x0ec9('0x23')](function(_0x3929bc){_0x92386d['rows']=_0x3929bc;return _0x92386d;})[_0x0ec9('0x23')](respondWithFilteredResult(_0xa4be71,_0xae4b9e))[_0x0ec9('0x42')](handleError(_0xa4be71,null));};exports[_0x0ec9('0x43')]=function(_0x307a9e,_0x373ab7){var _0x37b6d4={'raw':![],'where':{'id':_0x307a9e['params']['id']}},_0x5f0df8={};_0x5f0df8[_0x0ec9('0x31')]=_[_0x0ec9('0x44')](db[_0x0ec9('0x3e')]['rawAttributes']);_0x5f0df8[_0x0ec9('0x2f')]=_[_0x0ec9('0x44')](_0x307a9e[_0x0ec9('0x2f')]);_0x5f0df8['filters']=_[_0x0ec9('0x45')](_0x5f0df8[_0x0ec9('0x31')],_0x5f0df8['query']);_0x37b6d4[_0x0ec9('0x32')]=_[_0x0ec9('0x45')](_0x5f0df8[_0x0ec9('0x31')],qs['fields'](_0x307a9e['query'][_0x0ec9('0x33')]));_0x37b6d4['attributes']=_0x37b6d4[_0x0ec9('0x32')][_0x0ec9('0x46')]?_0x37b6d4['attributes']:_0x5f0df8[_0x0ec9('0x31')];if(_0x307a9e[_0x0ec9('0x2f')]['includeAll']){_0x37b6d4['include']=[{'all':!![]}];}_0x37b6d4=_[_0x0ec9('0x3c')]({},_0x37b6d4,_0x307a9e[_0x0ec9('0x47')]);return db[_0x0ec9('0x3e')][_0x0ec9('0x48')](_0x37b6d4)[_0x0ec9('0x23')](handleEntityNotFound(_0x373ab7,null))[_0x0ec9('0x23')](respondWithResult(_0x373ab7,null))[_0x0ec9('0x42')](handleError(_0x373ab7,null));};exports[_0x0ec9('0x49')]=function(_0x38fa5e,_0x23e69c){return db[_0x0ec9('0x3e')][_0x0ec9('0x49')](_0x38fa5e[_0x0ec9('0x4a')],{})[_0x0ec9('0x23')](respondWithResult(_0x23e69c,0xc9))[_0x0ec9('0x42')](handleError(_0x23e69c,null));};exports[_0x0ec9('0x4b')]=function(_0x5a78b0,_0x5ca7f7){if(_0x5a78b0[_0x0ec9('0x4a')]['id']){delete _0x5a78b0[_0x0ec9('0x4a')]['id'];}return db['VoiceAgentReport']['find']({'where':{'id':_0x5a78b0[_0x0ec9('0x4c')]['id']}})[_0x0ec9('0x23')](handleEntityNotFound(_0x5ca7f7,null))[_0x0ec9('0x23')](saveUpdates(_0x5a78b0['body'],null))[_0x0ec9('0x23')](respondWithResult(_0x5ca7f7,null))[_0x0ec9('0x42')](handleError(_0x5ca7f7,null));};exports[_0x0ec9('0x24')]=function(_0x4b119b,_0x200f14){return db[_0x0ec9('0x3e')][_0x0ec9('0x48')]({'where':{'id':_0x4b119b[_0x0ec9('0x4c')]['id']}})[_0x0ec9('0x23')](handleEntityNotFound(_0x200f14,null))['then'](removeEntity(_0x200f14,null))[_0x0ec9('0x42')](handleError(_0x200f14,null));};exports[_0x0ec9('0x4d')]=function(_0x3ec59e,_0x5bfaea){return db[_0x0ec9('0x3e')][_0x0ec9('0x4d')]()[_0x0ec9('0x23')](respondWithResult(_0x5bfaea,null))['catch'](handleError(_0x5bfaea,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 8b5bc0b..434e26d 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 _0xacc6=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','destuniqueid'];(function(_0x5d0354,_0x4cfec4){var _0x367575=function(_0x58a202){while(--_0x58a202){_0x5d0354['push'](_0x5d0354['shift']());}};_0x367575(++_0x4cfec4);}(_0xacc6,0x11d));var _0x6acc=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0xacc6[_0x3e6d5d];return _0x238923;};'use strict';var _=require(_0x6acc('0x0'));var util=require(_0x6acc('0x1'));var logger=require(_0x6acc('0x2'))(_0x6acc('0x3'));var moment=require(_0x6acc('0x4'));var BPromise=require(_0x6acc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6acc('0x6'));var rimraf=require(_0x6acc('0x7'));var config=require(_0x6acc('0x8'));var attributes=require(_0x6acc('0x9'));module[_0x6acc('0xa')]=function(_0x21cc28,_0x21ca1b){return _0x21cc28[_0x6acc('0xb')]('VoiceAgentReport',attributes,{'tableName':_0x6acc('0xc'),'paranoid':![],'indexes':[{'fields':[_0x6acc('0xd'),_0x6acc('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x871d=['exports','define','VoiceAgentReport','report_agent','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes'];(function(_0x325caf,_0x6b841c){var _0x5f0360=function(_0x88c01){while(--_0x88c01){_0x325caf['push'](_0x325caf['shift']());}};_0x5f0360(++_0x6b841c);}(_0x871d,0x95));var _0xd871=function(_0x1153b9,_0x2272b0){_0x1153b9=_0x1153b9-0x0;var _0x29f95c=_0x871d[_0x1153b9];return _0x29f95c;};'use strict';var _=require(_0xd871('0x0'));var util=require(_0xd871('0x1'));var logger=require(_0xd871('0x2'))(_0xd871('0x3'));var moment=require(_0xd871('0x4'));var BPromise=require(_0xd871('0x5'));var rp=require(_0xd871('0x6'));var fs=require('fs');var path=require(_0xd871('0x7'));var rimraf=require(_0xd871('0x8'));var config=require(_0xd871('0x9'));var attributes=require(_0xd871('0xa'));module[_0xd871('0xb')]=function(_0x5c53a9,_0x1dff6a){return _0x5c53a9[_0xd871('0xc')](_0xd871('0xd'),attributes,{'tableName':_0xd871('0xe'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xd871('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 482974d..eeb26bc 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 _0xfdcf=['CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','update','body','where','attributes','limit','UpdateVoiceAgentReport','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x38c407,_0x2999ed){var _0x3e27e6=function(_0xf17126){while(--_0xf17126){_0x38c407['push'](_0x38c407['shift']());}};_0x3e27e6(++_0x2999ed);}(_0xfdcf,0xdd));var _0xffdc=function(_0x2469b3,_0x3266e8){_0x2469b3=_0x2469b3-0x0;var _0x4cac69=_0xfdcf[_0x2469b3];return _0x4cac69;};'use strict';var _=require('lodash');var util=require(_0xffdc('0x0'));var moment=require(_0xffdc('0x1'));var BPromise=require(_0xffdc('0x2'));var rs=require(_0xffdc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xffdc('0x4'))['db'];var utils=require(_0xffdc('0x5'));var logger=require(_0xffdc('0x6'))(_0xffdc('0x7'));var config=require('../../config/environment');var jayson=require(_0xffdc('0x8'));var client=jayson[_0xffdc('0x9')][_0xffdc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ce639,_0xa43fed,_0x57fab4){return new BPromise(function(_0x39a3f3,_0x2fe531){return client[_0xffdc('0xb')](_0x2ce639,_0x57fab4)[_0xffdc('0xc')](function(_0x1b9b20){logger[_0xffdc('0xd')](_0xffdc('0xe'),_0xa43fed,_0xffdc('0xf'));logger[_0xffdc('0x10')](_0xffdc('0x11'),_0xa43fed,_0xffdc('0xf'),JSON[_0xffdc('0x12')](_0x1b9b20));if(_0x1b9b20[_0xffdc('0x13')]){if(_0x1b9b20[_0xffdc('0x13')][_0xffdc('0x14')]===0x1f4){logger[_0xffdc('0x13')](_0xffdc('0xe'),_0xa43fed,_0x1b9b20[_0xffdc('0x13')][_0xffdc('0x15')]);return _0x2fe531(_0x1b9b20[_0xffdc('0x13')][_0xffdc('0x15')]);}logger[_0xffdc('0x13')](_0xffdc('0xe'),_0xa43fed,_0x1b9b20[_0xffdc('0x13')][_0xffdc('0x15')]);return _0x39a3f3(_0x1b9b20[_0xffdc('0x13')][_0xffdc('0x15')]);}else{logger['info'](_0xffdc('0xe'),_0xa43fed,'request\x20sent');_0x39a3f3(_0x1b9b20[_0xffdc('0x16')][_0xffdc('0x15')]);}})[_0xffdc('0x17')](function(_0x36b130){logger['error'](_0xffdc('0xe'),_0xa43fed,_0x36b130);_0x2fe531(_0x36b130);});});}exports[_0xffdc('0x18')]=function(_0x17d421){var _0x15d769=this;return new Promise(function(_0x69dae5,_0x37d9e6){return db[_0xffdc('0x19')][_0xffdc('0x1a')](_0x17d421['body'],{'raw':_0x17d421[_0xffdc('0x1b')]?_0x17d421['options'][_0xffdc('0x1c')]===undefined?!![]:![]:!![]})[_0xffdc('0xc')](function(_0x41c9d6){logger[_0xffdc('0xd')](_0xffdc('0x18'),_0x17d421);logger[_0xffdc('0x10')](_0xffdc('0x18'),_0x17d421,JSON['stringify'](_0x41c9d6));_0x69dae5(_0x41c9d6);})[_0xffdc('0x17')](function(_0x3ca311){logger[_0xffdc('0x13')](_0xffdc('0x18'),_0x3ca311[_0xffdc('0x15')],_0x17d421);_0x37d9e6(_0x15d769['error'](0x1f4,_0x3ca311[_0xffdc('0x15')]));});});};exports['UpdateVoiceAgentReport']=function(_0x4e7dc4){var _0x92ec7e=this;return new Promise(function(_0x2c29f4,_0x21af49){return db[_0xffdc('0x19')][_0xffdc('0x1d')](_0x4e7dc4[_0xffdc('0x1e')],{'raw':_0x4e7dc4[_0xffdc('0x1b')]?_0x4e7dc4[_0xffdc('0x1b')][_0xffdc('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e7dc4['options']?_0x4e7dc4['options'][_0xffdc('0x1f')]||null:null,'attributes':_0x4e7dc4[_0xffdc('0x1b')]?_0x4e7dc4[_0xffdc('0x1b')][_0xffdc('0x20')]||null:null,'limit':_0x4e7dc4[_0xffdc('0x1b')]?_0x4e7dc4[_0xffdc('0x1b')][_0xffdc('0x21')]||null:null})['then'](function(_0x3903c8){logger[_0xffdc('0xd')](_0xffdc('0x22'),_0x4e7dc4);logger[_0xffdc('0x10')]('UpdateVoiceAgentReport',_0x4e7dc4,JSON[_0xffdc('0x12')](_0x3903c8));_0x2c29f4(_0x3903c8);})['catch'](function(_0x38c7da){logger[_0xffdc('0x13')](_0xffdc('0x22'),_0x38c7da[_0xffdc('0x15')],_0x4e7dc4);_0x21af49(_0x92ec7e['error'](0x1f4,_0x38c7da['message']));});});}; \ No newline at end of file +var _0x3041=['VoiceAgentReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','CreateVoiceAgentReport','create','body','options','catch','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1038f0,_0xbc0b97){var _0x5b7431=function(_0x3f5558){while(--_0x3f5558){_0x1038f0['push'](_0x1038f0['shift']());}};_0x5b7431(++_0xbc0b97);}(_0x3041,0x1c0));var _0x1304=function(_0x190725,_0x4c879f){_0x190725=_0x190725-0x0;var _0x4fe2de=_0x3041[_0x190725];return _0x4fe2de;};'use strict';var _=require(_0x1304('0x0'));var util=require(_0x1304('0x1'));var moment=require(_0x1304('0x2'));var BPromise=require(_0x1304('0x3'));var rs=require(_0x1304('0x4'));var fs=require('fs');var Redis=require(_0x1304('0x5'));var db=require(_0x1304('0x6'))['db'];var utils=require(_0x1304('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x1304('0x8'));var jayson=require(_0x1304('0x9'));var client=jayson[_0x1304('0xa')][_0x1304('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x493aad,_0x284498,_0x14d3af){return new BPromise(function(_0x35e0f2,_0xe2c85c){return client[_0x1304('0xc')](_0x493aad,_0x14d3af)[_0x1304('0xd')](function(_0x19a946){logger['info'](_0x1304('0xe'),_0x284498,'request\x20sent');logger[_0x1304('0xf')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x284498,_0x1304('0x10'),JSON[_0x1304('0x11')](_0x19a946));if(_0x19a946[_0x1304('0x12')]){if(_0x19a946[_0x1304('0x12')][_0x1304('0x13')]===0x1f4){logger[_0x1304('0x12')](_0x1304('0xe'),_0x284498,_0x19a946['error'][_0x1304('0x14')]);return _0xe2c85c(_0x19a946[_0x1304('0x12')][_0x1304('0x14')]);}logger['error'](_0x1304('0xe'),_0x284498,_0x19a946[_0x1304('0x12')]['message']);return _0x35e0f2(_0x19a946['error'][_0x1304('0x14')]);}else{logger[_0x1304('0x15')]('VoiceAgentReport,\x20%s,\x20%s',_0x284498,_0x1304('0x10'));_0x35e0f2(_0x19a946['result'][_0x1304('0x14')]);}})['catch'](function(_0x137faf){logger[_0x1304('0x12')](_0x1304('0xe'),_0x284498,_0x137faf);_0xe2c85c(_0x137faf);});});}exports[_0x1304('0x16')]=function(_0x1f6dc1){var _0x38777c=this;return new Promise(function(_0x30027f,_0x51fa45){return db['VoiceAgentReport'][_0x1304('0x17')](_0x1f6dc1[_0x1304('0x18')],{'raw':_0x1f6dc1[_0x1304('0x19')]?_0x1f6dc1['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x25a8b9){logger[_0x1304('0x15')](_0x1304('0x16'),_0x1f6dc1);logger[_0x1304('0xf')]('CreateVoiceAgentReport',_0x1f6dc1,JSON['stringify'](_0x25a8b9));_0x30027f(_0x25a8b9);})[_0x1304('0x1a')](function(_0x5ceb26){logger[_0x1304('0x12')]('CreateVoiceAgentReport',_0x5ceb26[_0x1304('0x14')],_0x1f6dc1);_0x51fa45(_0x38777c[_0x1304('0x12')](0x1f4,_0x5ceb26['message']));});});};exports[_0x1304('0x1b')]=function(_0x48038c){var _0x2023b9=this;return new Promise(function(_0x518d46,_0x1c992c){return db[_0x1304('0x1c')][_0x1304('0x1d')](_0x48038c[_0x1304('0x18')],{'raw':_0x48038c['options']?_0x48038c[_0x1304('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48038c[_0x1304('0x19')]?_0x48038c['options'][_0x1304('0x1e')]||null:null,'attributes':_0x48038c['options']?_0x48038c['options'][_0x1304('0x1f')]||null:null,'limit':_0x48038c[_0x1304('0x19')]?_0x48038c[_0x1304('0x19')][_0x1304('0x20')]||null:null})[_0x1304('0xd')](function(_0x532f85){logger['info']('UpdateVoiceAgentReport',_0x48038c);logger[_0x1304('0xf')](_0x1304('0x1b'),_0x48038c,JSON[_0x1304('0x11')](_0x532f85));_0x518d46(_0x532f85);})['catch'](function(_0x1d5024){logger[_0x1304('0x12')](_0x1304('0x1b'),_0x1d5024[_0x1304('0x14')],_0x48038c);_0x1c992c(_0x2023b9[_0x1304('0x12')](0x1f4,_0x1d5024[_0x1304('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index ee1280f..2cc782f 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(_0x187279,_0x26d152){var _0x3da59d=function(_0x41c808){while(--_0x41c808){_0x187279['push'](_0x187279['shift']());}};_0x3da59d(++_0x26d152);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('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 872c14a..6aa4238 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 _0xe14b=['STRING','DATE','INTEGER','sequelize','exports','inbound','internal','inbound-fax'];(function(_0x59ee41,_0xaf7db8){var _0x3ecd3e=function(_0x2f9291){while(--_0x2f9291){_0x59ee41['push'](_0x59ee41['shift']());}};_0x3ecd3e(++_0xaf7db8);}(_0xe14b,0x93));var _0xbe14=function(_0x3a975e,_0x29614d){_0x3a975e=_0x3a975e-0x0;var _0x19ccab=_0xe14b[_0x3a975e];return _0x19ccab;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xbe14('0x2'),_0xbe14('0x3'),'outbound',_0xbe14('0x4'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0xbe14('0x5')]},'accountcode':{'type':Sequelize[_0xbe14('0x5')]},'source':{'type':Sequelize[_0xbe14('0x5')]},'destination':{'type':Sequelize[_0xbe14('0x5')]},'destinationcontext':{'type':Sequelize[_0xbe14('0x5')]},'callerid':{'type':Sequelize[_0xbe14('0x5')]},'channel':{'type':Sequelize[_0xbe14('0x5')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xbe14('0x6')]},'systemanswertime':{'type':Sequelize[_0xbe14('0x6')]},'answertime':{'type':Sequelize[_0xbe14('0x6')]},'endtime':{'type':Sequelize[_0xbe14('0x6')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xbe14('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xbe14('0x5')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xbe14('0x5')]},'userDisposition':{'type':Sequelize[_0xbe14('0x5')]},'userSecondDisposition':{'type':Sequelize[_0xbe14('0x5')]},'userThirdDisposition':{'type':Sequelize[_0xbe14('0x5')]},'note':{'type':Sequelize[_0xbe14('0x5')]},'prefix':{'type':Sequelize[_0xbe14('0x5')]},'routeid':{'type':Sequelize[_0xbe14('0x7')]},'sipcallid':{'type':Sequelize[_0xbe14('0x5')]}}; \ No newline at end of file +var _0xed1f=['DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT'];(function(_0x370c5c,_0x517cff){var _0x5bbd89=function(_0x4132c2){while(--_0x4132c2){_0x370c5c['push'](_0x370c5c['shift']());}};_0x5bbd89(++_0x517cff);}(_0xed1f,0x6a));var _0xfed1=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xed1f[_0x24f31b];return _0x488401;};'use strict';var Sequelize=require(_0xfed1('0x0'));module[_0xfed1('0x1')]={'uniqueid':{'type':Sequelize[_0xfed1('0x2')]},'type':{'type':Sequelize[_0xfed1('0x3')](_0xfed1('0x4'),_0xfed1('0x5'),_0xfed1('0x6'),_0xfed1('0x7'),_0xfed1('0x8'),_0xfed1('0x9'))},'tag':{'type':Sequelize[_0xfed1('0x2')]},'accountcode':{'type':Sequelize[_0xfed1('0x2')]},'source':{'type':Sequelize[_0xfed1('0x2')]},'destination':{'type':Sequelize[_0xfed1('0x2')]},'destinationcontext':{'type':Sequelize[_0xfed1('0x2')]},'callerid':{'type':Sequelize[_0xfed1('0x2')]},'channel':{'type':Sequelize[_0xfed1('0x2')]},'destinationchannel':{'type':Sequelize[_0xfed1('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xfed1('0xa')]},'starttime':{'type':Sequelize[_0xfed1('0xb')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xfed1('0xb')]},'endtime':{'type':Sequelize[_0xfed1('0xb')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xfed1('0xc')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xfed1('0x2')]},'amaflags':{'type':Sequelize[_0xfed1('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xfed1('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xfed1('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xfed1('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 3b087b7..8c8ed96 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 _0xca02=['fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','merge','where','filter','options','then','includeAll','include','fullname','alias','rows','catch','show','create','params','describe','body','uniqueid','find','user','eml-format','rimraf','zip-dir','request-promise','moment','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','error','stack','name','send','index','map','VoiceCallReport','rawAttributes'];(function(_0x1f1e69,_0x25416d){var _0x179eb0=function(_0x130ff2){while(--_0x130ff2){_0x1f1e69['push'](_0x1f1e69['shift']());}};_0x179eb0(++_0x25416d);}(_0xca02,0xbb));var _0x2ca0=function(_0x3cac48,_0x2a25e7){_0x3cac48=_0x3cac48-0x0;var _0x410a20=_0xca02[_0x3cac48];return _0x410a20;};'use strict';var emlformat=require(_0x2ca0('0x0'));var rimraf=require(_0x2ca0('0x1'));var zipdir=require(_0x2ca0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2ca0('0x3'));var moment=require(_0x2ca0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2ca0('0x5'));var sox=require('sox');var csv=require(_0x2ca0('0x6'));var ejs=require(_0x2ca0('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ca0('0x8'));var squel=require(_0x2ca0('0x9'));var crypto=require('crypto');var jsforce=require(_0x2ca0('0xa'));var deskjs=require(_0x2ca0('0xb'));var toCsv=require(_0x2ca0('0x6'));var querystring=require(_0x2ca0('0xc'));var Papa=require(_0x2ca0('0xd'));var Redis=require(_0x2ca0('0xe'));var authService=require(_0x2ca0('0xf'));var qs=require(_0x2ca0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ca0('0x11'));var logger=require(_0x2ca0('0x12'))(_0x2ca0('0x13'));var utils=require(_0x2ca0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2ca0('0x15'));var db=require(_0x2ca0('0x16'))['db'];function respondWithStatusCode(_0x1f113e,_0x287b1c){_0x287b1c=_0x287b1c||0xcc;return function(_0x4b6f48){if(_0x4b6f48){return _0x1f113e[_0x2ca0('0x17')](_0x287b1c);}return _0x1f113e[_0x2ca0('0x18')](_0x287b1c)[_0x2ca0('0x19')]();};}function respondWithResult(_0x395acc,_0x5bbd96){_0x5bbd96=_0x5bbd96||0xc8;return function(_0x29a123){if(_0x29a123){return _0x395acc[_0x2ca0('0x18')](_0x5bbd96)[_0x2ca0('0x1a')](_0x29a123);}};}function respondWithFilteredResult(_0x8e4cb0,_0x5d7c8b){return function(_0x474155){if(_0x474155){var _0x4867f0=_0x474155[_0x2ca0('0x1b')],_0xd67161=_0x5d7c8b[_0x2ca0('0x1c')],_0x6962f6=_0x5d7c8b[_0x2ca0('0x1c')]+_0x5d7c8b[_0x2ca0('0x1d')],_0x1f0669;if(_0x6962f6>=_0x4867f0){_0x6962f6=_0x4867f0;_0x1f0669=0xc8;}else{_0x1f0669=0xce;}_0x8e4cb0[_0x2ca0('0x18')](_0x1f0669);return _0x8e4cb0[_0x2ca0('0x1e')](_0x2ca0('0x1f'),_0xd67161+'-'+_0x6962f6+'/'+_0x4867f0)['json'](_0x474155);}return null;};}function patchUpdates(_0x27d3c1){return function(_0x1cc2b2){try{jsonpatch['apply'](_0x1cc2b2,_0x27d3c1,!![]);}catch(_0x2d76f5){return BPromise[_0x2ca0('0x20')](_0x2d76f5);}return _0x1cc2b2[_0x2ca0('0x21')]();};}function saveUpdates(_0xacf9d4,_0x286df7){return function(_0x3560dc){if(_0x3560dc){return _0x3560dc[_0x2ca0('0x22')](_0xacf9d4)['then'](function(_0x579855){return _0x579855;});}return null;};}function removeEntity(_0x357aaf,_0x15f306){return function(_0x16337d){if(_0x16337d){return _0x16337d[_0x2ca0('0x23')]()['then'](function(){_0x357aaf[_0x2ca0('0x18')](0xcc)[_0x2ca0('0x19')]();});}};}function handleEntityNotFound(_0x18c096,_0x37841e){return function(_0x32621a){if(!_0x32621a){_0x18c096[_0x2ca0('0x17')](0x194);}return _0x32621a;};}function handleError(_0x1eb504,_0x5867a1){_0x5867a1=_0x5867a1||0x1f4;return function(_0x5ce4bf){logger[_0x2ca0('0x24')](_0x5ce4bf[_0x2ca0('0x25')]);if(_0x5ce4bf[_0x2ca0('0x26')]){delete _0x5ce4bf[_0x2ca0('0x26')];}_0x1eb504['status'](_0x5867a1)[_0x2ca0('0x27')](_0x5ce4bf);};}exports[_0x2ca0('0x28')]=function(_0x5b6d21,_0xb5b57a){var _0x123a22={},_0x5d5fda={},_0x2ab452={'count':0x0,'rows':[]};var _0x51baeb=_[_0x2ca0('0x29')](db[_0x2ca0('0x2a')][_0x2ca0('0x2b')],function(_0x48434d){return{'name':_0x48434d[_0x2ca0('0x2c')],'type':_0x48434d['type'][_0x2ca0('0x2d')]};});_0x5d5fda[_0x2ca0('0x2e')]=_[_0x2ca0('0x29')](_0x51baeb,'name');_0x5d5fda[_0x2ca0('0x2f')]=_[_0x2ca0('0x30')](_0x5b6d21['query']);_0x5d5fda[_0x2ca0('0x31')]=_[_0x2ca0('0x32')](_0x5d5fda[_0x2ca0('0x2e')],_0x5d5fda['query']);_0x123a22[_0x2ca0('0x33')]=_['intersection'](_0x5d5fda[_0x2ca0('0x2e')],qs[_0x2ca0('0x34')](_0x5b6d21[_0x2ca0('0x2f')][_0x2ca0('0x34')]));_0x123a22[_0x2ca0('0x33')]=_0x123a22[_0x2ca0('0x33')][_0x2ca0('0x35')]?_0x123a22['attributes']:_0x5d5fda[_0x2ca0('0x2e')];if(!_0x5b6d21[_0x2ca0('0x2f')][_0x2ca0('0x36')]('nolimit')){_0x123a22[_0x2ca0('0x1d')]=qs[_0x2ca0('0x1d')](_0x5b6d21[_0x2ca0('0x2f')][_0x2ca0('0x1d')]);_0x123a22['offset']=qs[_0x2ca0('0x1c')](_0x5b6d21['query'][_0x2ca0('0x1c')]);}_0x123a22[_0x2ca0('0x37')]=qs[_0x2ca0('0x38')](_0x5b6d21[_0x2ca0('0x2f')][_0x2ca0('0x38')]);_0x123a22['where']=qs[_0x2ca0('0x31')](_[_0x2ca0('0x39')](_0x5b6d21['query'],_0x5d5fda[_0x2ca0('0x31')]),_0x51baeb);if(_0x5b6d21[_0x2ca0('0x2f')]['filter']){_0x123a22['where']=_[_0x2ca0('0x3a')](_0x123a22[_0x2ca0('0x3b')],{'$or':_[_0x2ca0('0x29')](_0x51baeb,function(_0x1a8182){if(_0x1a8182['type']!=='VIRTUAL'){var _0x8b2dbb={};_0x8b2dbb[_0x1a8182[_0x2ca0('0x26')]]={'$like':'%'+_0x5b6d21[_0x2ca0('0x2f')][_0x2ca0('0x3c')]+'%'};return _0x8b2dbb;}})});}_0x123a22=_[_0x2ca0('0x3a')]({},_0x123a22,_0x5b6d21[_0x2ca0('0x3d')]);var _0x238db0={'where':_0x123a22[_0x2ca0('0x3b')]};return db[_0x2ca0('0x2a')][_0x2ca0('0x1b')](_0x238db0)[_0x2ca0('0x3e')](function(_0x209e96){_0x2ab452['count']=_0x209e96;if(_0x5b6d21['query'][_0x2ca0('0x3f')]){_0x123a22[_0x2ca0('0x40')]=[{'attributes':['id',_0x2ca0('0x26'),_0x2ca0('0x41'),_0x2ca0('0x42')],'model':db['User'],'as':'User'}];}return db['VoiceCallReport']['findAll'](_0x123a22);})[_0x2ca0('0x3e')](function(_0x4b6755){_0x2ab452[_0x2ca0('0x43')]=_0x4b6755;return _0x2ab452;})[_0x2ca0('0x3e')](respondWithFilteredResult(_0xb5b57a,_0x123a22))[_0x2ca0('0x44')](handleError(_0xb5b57a,null));};exports[_0x2ca0('0x45')]=function(_0x1503cd,_0x2e74c5){var _0x1ca917={'raw':!![],'where':{'id':_0x1503cd['params']['id']}},_0x2b9cc8={};_0x2b9cc8[_0x2ca0('0x2e')]=_[_0x2ca0('0x30')](db['VoiceCallReport']['rawAttributes']);_0x2b9cc8[_0x2ca0('0x2f')]=_[_0x2ca0('0x30')](_0x1503cd[_0x2ca0('0x2f')]);_0x2b9cc8['filters']=_[_0x2ca0('0x32')](_0x2b9cc8[_0x2ca0('0x2e')],_0x2b9cc8['query']);_0x1ca917[_0x2ca0('0x33')]=_[_0x2ca0('0x32')](_0x2b9cc8[_0x2ca0('0x2e')],qs['fields'](_0x1503cd['query'][_0x2ca0('0x34')]));_0x1ca917[_0x2ca0('0x33')]=_0x1ca917['attributes']['length']?_0x1ca917['attributes']:_0x2b9cc8[_0x2ca0('0x2e')];if(_0x1503cd[_0x2ca0('0x2f')][_0x2ca0('0x3f')]){_0x1ca917[_0x2ca0('0x40')]=[{'all':!![]}];}_0x1ca917=_['merge']({},_0x1ca917,_0x1503cd[_0x2ca0('0x3d')]);return db['VoiceCallReport']['find'](_0x1ca917)[_0x2ca0('0x3e')](handleEntityNotFound(_0x2e74c5,null))[_0x2ca0('0x3e')](respondWithResult(_0x2e74c5,null))[_0x2ca0('0x44')](handleError(_0x2e74c5,null));};exports['create']=function(_0x5205f4,_0x510900){return db[_0x2ca0('0x2a')][_0x2ca0('0x46')](_0x5205f4['body'],{})[_0x2ca0('0x3e')](respondWithResult(_0x510900,0xc9))[_0x2ca0('0x44')](handleError(_0x510900,null));};exports[_0x2ca0('0x23')]=function(_0x3dba26,_0x228ddb){return db['VoiceCallReport']['find']({'where':{'id':_0x3dba26[_0x2ca0('0x47')]['id']}})['then'](handleEntityNotFound(_0x228ddb,null))[_0x2ca0('0x3e')](removeEntity(_0x228ddb,null))[_0x2ca0('0x44')](handleError(_0x228ddb,null));};exports['describe']=function(_0x394966,_0x9a44fe){return db[_0x2ca0('0x2a')][_0x2ca0('0x48')]()[_0x2ca0('0x3e')](respondWithResult(_0x9a44fe,null))[_0x2ca0('0x44')](handleError(_0x9a44fe,null));};exports[_0x2ca0('0x22')]=function(_0x4a0cfd,_0x18a3c6){if(_0x4a0cfd[_0x2ca0('0x49')][_0x2ca0('0x4a')]){delete _0x4a0cfd[_0x2ca0('0x49')][_0x2ca0('0x4a')];}return db[_0x2ca0('0x2a')][_0x2ca0('0x4b')]({'where':{'uniqueid':_0x4a0cfd[_0x2ca0('0x47')]['id'],'UserId':{'$or':[null,_0x4a0cfd[_0x2ca0('0x4c')]['id']]}}})[_0x2ca0('0x3e')](handleEntityNotFound(_0x18a3c6,null))[_0x2ca0('0x3e')](saveUpdates(_0x4a0cfd['body'],null))[_0x2ca0('0x3e')](respondWithResult(_0x18a3c6,null))[_0x2ca0('0x44')](handleError(_0x18a3c6,null));}; \ No newline at end of file +var _0x89d4=['../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','fullname','User','findAll','rows','catch','params','keys','create','find','describe','update','body','uniqueid','user','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x38559e,_0x18def6){var _0x1f8471=function(_0x3fac06){while(--_0x3fac06){_0x38559e['push'](_0x38559e['shift']());}};_0x1f8471(++_0x18def6);}(_0x89d4,0x88));var _0x489d=function(_0x671369,_0x433da5){_0x671369=_0x671369-0x0;var _0x33f2b4=_0x89d4[_0x671369];return _0x33f2b4;};'use strict';var emlformat=require(_0x489d('0x0'));var rimraf=require(_0x489d('0x1'));var zipdir=require(_0x489d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x489d('0x3'));var moment=require('moment');var BPromise=require(_0x489d('0x4'));var Mustache=require(_0x489d('0x5'));var util=require('util');var path=require('path');var sox=require(_0x489d('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x489d('0x7'));var _=require(_0x489d('0x8'));var squel=require(_0x489d('0x9'));var crypto=require(_0x489d('0xa'));var jsforce=require(_0x489d('0xb'));var deskjs=require(_0x489d('0xc'));var toCsv=require(_0x489d('0xd'));var querystring=require(_0x489d('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x489d('0xf'));var qs=require(_0x489d('0x10'));var as=require(_0x489d('0x11'));var hardwareService=require(_0x489d('0x12'));var logger=require('../../config/logger')(_0x489d('0x13'));var utils=require('../../config/utils');var config=require(_0x489d('0x14'));var licenseUtil=require(_0x489d('0x15'));var db=require(_0x489d('0x16'))['db'];function respondWithStatusCode(_0x24f354,_0x1e7c18){_0x1e7c18=_0x1e7c18||0xcc;return function(_0x5e732f){if(_0x5e732f){return _0x24f354['sendStatus'](_0x1e7c18);}return _0x24f354['status'](_0x1e7c18)[_0x489d('0x17')]();};}function respondWithResult(_0x27f731,_0x29451b){_0x29451b=_0x29451b||0xc8;return function(_0x5113b8){if(_0x5113b8){return _0x27f731[_0x489d('0x18')](_0x29451b)[_0x489d('0x19')](_0x5113b8);}};}function respondWithFilteredResult(_0x29a409,_0x5e2142){return function(_0x2891d7){if(_0x2891d7){var _0x495b37=_0x2891d7[_0x489d('0x1a')],_0x5a510b=_0x5e2142[_0x489d('0x1b')],_0x275f7d=_0x5e2142[_0x489d('0x1b')]+_0x5e2142[_0x489d('0x1c')],_0x53b9c9;if(_0x275f7d>=_0x495b37){_0x275f7d=_0x495b37;_0x53b9c9=0xc8;}else{_0x53b9c9=0xce;}_0x29a409[_0x489d('0x18')](_0x53b9c9);return _0x29a409[_0x489d('0x1d')](_0x489d('0x1e'),_0x5a510b+'-'+_0x275f7d+'/'+_0x495b37)[_0x489d('0x19')](_0x2891d7);}return null;};}function patchUpdates(_0x3fe0eb){return function(_0x211a61){try{jsonpatch[_0x489d('0x1f')](_0x211a61,_0x3fe0eb,!![]);}catch(_0x338dc1){return BPromise[_0x489d('0x20')](_0x338dc1);}return _0x211a61[_0x489d('0x21')]();};}function saveUpdates(_0x58c9e9,_0x33b1a2){return function(_0x3346a6){if(_0x3346a6){return _0x3346a6['update'](_0x58c9e9)[_0x489d('0x22')](function(_0x1831ae){return _0x1831ae;});}return null;};}function removeEntity(_0x374d58,_0x1fdd3e){return function(_0x2acadd){if(_0x2acadd){return _0x2acadd[_0x489d('0x23')]()[_0x489d('0x22')](function(){_0x374d58[_0x489d('0x18')](0xcc)[_0x489d('0x17')]();});}};}function handleEntityNotFound(_0x843b8a,_0x4f2bd9){return function(_0x4a1edd){if(!_0x4a1edd){_0x843b8a['sendStatus'](0x194);}return _0x4a1edd;};}function handleError(_0x189b82,_0x581b59){_0x581b59=_0x581b59||0x1f4;return function(_0x42f831){logger[_0x489d('0x24')](_0x42f831[_0x489d('0x25')]);if(_0x42f831[_0x489d('0x26')]){delete _0x42f831[_0x489d('0x26')];}_0x189b82['status'](_0x581b59)['send'](_0x42f831);};}exports[_0x489d('0x27')]=function(_0x5031b8,_0x4d179e){var _0x346994={},_0x966c86={},_0xdb59bd={'count':0x0,'rows':[]};var _0x55653b=_[_0x489d('0x28')](db[_0x489d('0x29')][_0x489d('0x2a')],function(_0x2ee623){return{'name':_0x2ee623[_0x489d('0x2b')],'type':_0x2ee623[_0x489d('0x2c')][_0x489d('0x2d')]};});_0x966c86[_0x489d('0x2e')]=_[_0x489d('0x28')](_0x55653b,'name');_0x966c86[_0x489d('0x2f')]=_['keys'](_0x5031b8['query']);_0x966c86[_0x489d('0x30')]=_[_0x489d('0x31')](_0x966c86['model'],_0x966c86[_0x489d('0x2f')]);_0x346994['attributes']=_[_0x489d('0x31')](_0x966c86['model'],qs[_0x489d('0x32')](_0x5031b8[_0x489d('0x2f')][_0x489d('0x32')]));_0x346994['attributes']=_0x346994[_0x489d('0x33')][_0x489d('0x34')]?_0x346994[_0x489d('0x33')]:_0x966c86[_0x489d('0x2e')];if(!_0x5031b8[_0x489d('0x2f')][_0x489d('0x35')](_0x489d('0x36'))){_0x346994[_0x489d('0x1c')]=qs['limit'](_0x5031b8[_0x489d('0x2f')]['limit']);_0x346994[_0x489d('0x1b')]=qs['offset'](_0x5031b8['query'][_0x489d('0x1b')]);}_0x346994[_0x489d('0x37')]=qs[_0x489d('0x38')](_0x5031b8[_0x489d('0x2f')][_0x489d('0x38')]);_0x346994[_0x489d('0x39')]=qs['filters'](_[_0x489d('0x3a')](_0x5031b8['query'],_0x966c86[_0x489d('0x30')]),_0x55653b);if(_0x5031b8[_0x489d('0x2f')][_0x489d('0x3b')]){_0x346994[_0x489d('0x39')]=_[_0x489d('0x3c')](_0x346994[_0x489d('0x39')],{'$or':_[_0x489d('0x28')](_0x55653b,function(_0x520c08){if(_0x520c08['type']!==_0x489d('0x3d')){var _0x165f8f={};_0x165f8f[_0x520c08['name']]={'$like':'%'+_0x5031b8['query'][_0x489d('0x3b')]+'%'};return _0x165f8f;}})});}_0x346994=_['merge']({},_0x346994,_0x5031b8['options']);var _0x189378={'where':_0x346994[_0x489d('0x39')]};return db[_0x489d('0x29')][_0x489d('0x1a')](_0x189378)['then'](function(_0x4175d9){_0xdb59bd['count']=_0x4175d9;if(_0x5031b8['query'][_0x489d('0x3e')]){_0x346994[_0x489d('0x3f')]=[{'attributes':['id',_0x489d('0x26'),_0x489d('0x40'),'alias'],'model':db[_0x489d('0x41')],'as':'User'}];}return db[_0x489d('0x29')][_0x489d('0x42')](_0x346994);})['then'](function(_0x4989fc){_0xdb59bd[_0x489d('0x43')]=_0x4989fc;return _0xdb59bd;})['then'](respondWithFilteredResult(_0x4d179e,_0x346994))[_0x489d('0x44')](handleError(_0x4d179e,null));};exports['show']=function(_0x51f54f,_0x3e1700){var _0x498f6a={'raw':!![],'where':{'id':_0x51f54f[_0x489d('0x45')]['id']}},_0x43e18e={};_0x43e18e['model']=_[_0x489d('0x46')](db[_0x489d('0x29')][_0x489d('0x2a')]);_0x43e18e[_0x489d('0x2f')]=_[_0x489d('0x46')](_0x51f54f[_0x489d('0x2f')]);_0x43e18e[_0x489d('0x30')]=_[_0x489d('0x31')](_0x43e18e[_0x489d('0x2e')],_0x43e18e[_0x489d('0x2f')]);_0x498f6a[_0x489d('0x33')]=_[_0x489d('0x31')](_0x43e18e[_0x489d('0x2e')],qs['fields'](_0x51f54f[_0x489d('0x2f')][_0x489d('0x32')]));_0x498f6a['attributes']=_0x498f6a['attributes'][_0x489d('0x34')]?_0x498f6a[_0x489d('0x33')]:_0x43e18e['model'];if(_0x51f54f[_0x489d('0x2f')][_0x489d('0x3e')]){_0x498f6a[_0x489d('0x3f')]=[{'all':!![]}];}_0x498f6a=_[_0x489d('0x3c')]({},_0x498f6a,_0x51f54f['options']);return db[_0x489d('0x29')]['find'](_0x498f6a)[_0x489d('0x22')](handleEntityNotFound(_0x3e1700,null))[_0x489d('0x22')](respondWithResult(_0x3e1700,null))[_0x489d('0x44')](handleError(_0x3e1700,null));};exports[_0x489d('0x47')]=function(_0x23fc94,_0x1b73ab){return db[_0x489d('0x29')][_0x489d('0x47')](_0x23fc94['body'],{})['then'](respondWithResult(_0x1b73ab,0xc9))[_0x489d('0x44')](handleError(_0x1b73ab,null));};exports[_0x489d('0x23')]=function(_0x440eed,_0x3c0f78){return db[_0x489d('0x29')][_0x489d('0x48')]({'where':{'id':_0x440eed['params']['id']}})[_0x489d('0x22')](handleEntityNotFound(_0x3c0f78,null))[_0x489d('0x22')](removeEntity(_0x3c0f78,null))[_0x489d('0x44')](handleError(_0x3c0f78,null));};exports[_0x489d('0x49')]=function(_0x30c00e,_0x394f7d){return db[_0x489d('0x29')][_0x489d('0x49')]()[_0x489d('0x22')](respondWithResult(_0x394f7d,null))['catch'](handleError(_0x394f7d,null));};exports[_0x489d('0x4a')]=function(_0x5f2324,_0x2ccc7c){if(_0x5f2324['body']['uniqueid']){delete _0x5f2324[_0x489d('0x4b')][_0x489d('0x4c')];}return db[_0x489d('0x29')]['find']({'where':{'uniqueid':_0x5f2324[_0x489d('0x45')]['id'],'UserId':{'$or':[null,_0x5f2324[_0x489d('0x4d')]['id']]}}})[_0x489d('0x22')](handleEntityNotFound(_0x2ccc7c,null))[_0x489d('0x22')](saveUpdates(_0x5f2324[_0x489d('0x4b')],null))[_0x489d('0x22')](respondWithResult(_0x2ccc7c,null))[_0x489d('0x44')](handleError(_0x2ccc7c,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index e3d9bef..9d2540a 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 _0x9a42=['rimraf','./voiceCallReport.attributes','report_call','uniqueid','util','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a42,0xb8));var _0x29a4=function(_0xb9aa47,_0xec4855){_0xb9aa47=_0xb9aa47-0x0;var _0x1925f0=_0x9a42[_0xb9aa47];return _0x1925f0;};'use strict';var _=require('lodash');var util=require(_0x29a4('0x0'));var logger=require('../../config/logger')(_0x29a4('0x1'));var moment=require(_0x29a4('0x2'));var BPromise=require(_0x29a4('0x3'));var rp=require(_0x29a4('0x4'));var fs=require('fs');var path=require(_0x29a4('0x5'));var rimraf=require(_0x29a4('0x6'));var config=require('../../config/environment');var attributes=require(_0x29a4('0x7'));module['exports']=function(_0x3bb0cd,_0x235f93){return _0x3bb0cd['define']('VoiceCallReport',attributes,{'tableName':_0x29a4('0x8'),'paranoid':![],'indexes':[{'fields':[_0x29a4('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7247=['../../config/logger','api','bluebird','request-promise','../../config/environment','define','VoiceCallReport','report_call','lodash','util'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7247,0xb2));var _0x7724=function(_0x147ca5,_0x30b9a9){_0x147ca5=_0x147ca5-0x0;var _0x28ace2=_0x7247[_0x147ca5];return _0x28ace2;};'use strict';var _=require(_0x7724('0x0'));var util=require(_0x7724('0x1'));var logger=require(_0x7724('0x2'))(_0x7724('0x3'));var moment=require('moment');var BPromise=require(_0x7724('0x4'));var rp=require(_0x7724('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7724('0x6'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0xfa5cd,_0x5e4dc3){return _0xfa5cd[_0x7724('0x7')](_0x7724('0x8'),attributes,{'tableName':_0x7724('0x9'),'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 1263f7c..8b7c2ce 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 _0x1c35=['UpdateVoiceCallReport','update','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','where','attributes','limit','include','map','model','then','CreateVoiceCallReport','create','body','stringify'];(function(_0x5755bf,_0x5a50ba){var _0x156408=function(_0x432024){while(--_0x432024){_0x5755bf['push'](_0x5755bf['shift']());}};_0x156408(++_0x5a50ba);}(_0x1c35,0x75));var _0x51c3=function(_0x295aa7,_0x5dbe6c){_0x295aa7=_0x295aa7-0x0;var _0x4731d2=_0x1c35[_0x295aa7];return _0x4731d2;};'use strict';var _=require(_0x51c3('0x0'));var util=require('util');var moment=require(_0x51c3('0x1'));var BPromise=require('bluebird');var rs=require(_0x51c3('0x2'));var fs=require('fs');var Redis=require(_0x51c3('0x3'));var db=require(_0x51c3('0x4'))['db'];var utils=require(_0x51c3('0x5'));var logger=require('../../config/logger')(_0x51c3('0x6'));var config=require(_0x51c3('0x7'));var jayson=require(_0x51c3('0x8'));var client=jayson[_0x51c3('0x9')][_0x51c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a6a4a,_0x349d6c,_0x422815){return new BPromise(function(_0x59e259,_0x2371c7){return client['request'](_0x4a6a4a,_0x422815)['then'](function(_0x49afb4){logger[_0x51c3('0xb')](_0x51c3('0xc'),_0x349d6c,_0x51c3('0xd'));logger[_0x51c3('0xe')](_0x51c3('0xf'),_0x349d6c,_0x51c3('0xd'),JSON['stringify'](_0x49afb4));if(_0x49afb4['error']){if(_0x49afb4[_0x51c3('0x10')][_0x51c3('0x11')]===0x1f4){logger['error'](_0x51c3('0xc'),_0x349d6c,_0x49afb4['error'][_0x51c3('0x12')]);return _0x2371c7(_0x49afb4[_0x51c3('0x10')][_0x51c3('0x12')]);}logger[_0x51c3('0x10')](_0x51c3('0xc'),_0x349d6c,_0x49afb4['error'][_0x51c3('0x12')]);return _0x59e259(_0x49afb4[_0x51c3('0x10')][_0x51c3('0x12')]);}else{logger[_0x51c3('0xb')](_0x51c3('0xc'),_0x349d6c,_0x51c3('0xd'));_0x59e259(_0x49afb4[_0x51c3('0x13')]['message']);}})[_0x51c3('0x14')](function(_0xff6c6d){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x349d6c,_0xff6c6d);_0x2371c7(_0xff6c6d);});});}exports[_0x51c3('0x15')]=function(_0x1d7a1f){var _0x307299=this;return new Promise(function(_0x523dfd,_0x15d2fa){return db[_0x51c3('0x16')]['findAll']({'raw':_0x1d7a1f[_0x51c3('0x17')]?_0x1d7a1f[_0x51c3('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1d7a1f[_0x51c3('0x17')]?_0x1d7a1f[_0x51c3('0x17')][_0x51c3('0x18')]||null:null,'attributes':_0x1d7a1f[_0x51c3('0x17')]?_0x1d7a1f['options'][_0x51c3('0x19')]||null:null,'limit':_0x1d7a1f['options']?_0x1d7a1f[_0x51c3('0x17')][_0x51c3('0x1a')]||null:null,'include':_0x1d7a1f['options']?_0x1d7a1f[_0x51c3('0x17')][_0x51c3('0x1b')]?_[_0x51c3('0x1c')](_0x1d7a1f[_0x51c3('0x17')][_0x51c3('0x1b')],function(_0x1c75ad){return{'model':db[_0x1c75ad[_0x51c3('0x1d')]],'as':_0x1c75ad['as'],'attributes':_0x1c75ad[_0x51c3('0x19')],'include':_0x1c75ad[_0x51c3('0x1b')]?_[_0x51c3('0x1c')](_0x1c75ad[_0x51c3('0x1b')],function(_0x2628d9){return{'model':db[_0x2628d9[_0x51c3('0x1d')]],'as':_0x2628d9['as'],'attributes':_0x2628d9[_0x51c3('0x19')],'include':_0x2628d9[_0x51c3('0x1b')]?_['map'](_0x2628d9[_0x51c3('0x1b')],function(_0x40aad9){return{'model':db[_0x40aad9[_0x51c3('0x1d')]],'as':_0x40aad9['as'],'attributes':_0x40aad9[_0x51c3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x51c3('0x1e')](function(_0x5cdbcd){logger[_0x51c3('0xb')](_0x51c3('0x15'),_0x1d7a1f);logger[_0x51c3('0xe')](_0x51c3('0x15'),_0x1d7a1f,JSON['stringify'](_0x5cdbcd));_0x523dfd(_0x5cdbcd);})[_0x51c3('0x14')](function(_0x11b8cc){logger[_0x51c3('0x10')](_0x51c3('0x15'),_0x11b8cc[_0x51c3('0x12')],_0x1d7a1f);_0x15d2fa(_0x307299['error'](0x1f4,_0x11b8cc['message']));});});};exports[_0x51c3('0x1f')]=function(_0x1223d9){var _0x13aed1=this;return new Promise(function(_0x231bf5,_0x1afe4a){return db[_0x51c3('0x16')][_0x51c3('0x20')](_0x1223d9[_0x51c3('0x21')],{'raw':_0x1223d9[_0x51c3('0x17')]?_0x1223d9['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x477a89){logger['info'](_0x51c3('0x1f'),_0x1223d9);logger[_0x51c3('0xe')](_0x51c3('0x1f'),_0x1223d9,JSON[_0x51c3('0x22')](_0x477a89));_0x231bf5(_0x477a89);})['catch'](function(_0x3dee3d){logger['error'](_0x51c3('0x1f'),_0x3dee3d[_0x51c3('0x12')],_0x1223d9);_0x1afe4a(_0x13aed1[_0x51c3('0x10')](0x1f4,_0x3dee3d[_0x51c3('0x12')]));});});};exports[_0x51c3('0x23')]=function(_0x3fb5e2){var _0x315a6a=this;return new Promise(function(_0x41c305,_0x4a5165){return db[_0x51c3('0x16')][_0x51c3('0x24')](_0x3fb5e2[_0x51c3('0x21')],{'raw':_0x3fb5e2[_0x51c3('0x17')]?_0x3fb5e2[_0x51c3('0x17')][_0x51c3('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fb5e2[_0x51c3('0x17')]?_0x3fb5e2['options'][_0x51c3('0x18')]||null:null,'attributes':_0x3fb5e2[_0x51c3('0x17')]?_0x3fb5e2[_0x51c3('0x17')][_0x51c3('0x19')]||null:null,'limit':_0x3fb5e2[_0x51c3('0x17')]?_0x3fb5e2[_0x51c3('0x17')][_0x51c3('0x1a')]||null:null})[_0x51c3('0x1e')](function(_0x11fe71){logger[_0x51c3('0xb')](_0x51c3('0x23'),_0x3fb5e2);logger[_0x51c3('0xe')](_0x51c3('0x23'),_0x3fb5e2,JSON[_0x51c3('0x22')](_0x11fe71));_0x41c305(_0x11fe71);})[_0x51c3('0x14')](function(_0x1f28aa){logger[_0x51c3('0x10')]('UpdateVoiceCallReport',_0x1f28aa[_0x51c3('0x12')],_0x3fb5e2);_0x4a5165(_0x315a6a[_0x51c3('0x10')](0x1f4,_0x1f28aa['message']));});});}; \ No newline at end of file +var _0x4298=['jayson/promise','client','http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','attributes','include','map','model','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','update','limit','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc'];(function(_0x22889a,_0x4b75f7){var _0x763d34=function(_0x2040e5){while(--_0x2040e5){_0x22889a['push'](_0x22889a['shift']());}};_0x763d34(++_0x4b75f7);}(_0x4298,0x190));var _0x8429=function(_0x367c61,_0x26038c){_0x367c61=_0x367c61-0x0;var _0x390beb=_0x4298[_0x367c61];return _0x390beb;};'use strict';var _=require(_0x8429('0x0'));var util=require(_0x8429('0x1'));var moment=require(_0x8429('0x2'));var BPromise=require(_0x8429('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8429('0x4'))['db'];var utils=require(_0x8429('0x5'));var logger=require('../../config/logger')(_0x8429('0x6'));var config=require('../../config/environment');var jayson=require(_0x8429('0x7'));var client=jayson[_0x8429('0x8')][_0x8429('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ed049,_0x278831,_0xe63d8b){return new BPromise(function(_0x172f25,_0x434da3){return client['request'](_0x5ed049,_0xe63d8b)[_0x8429('0xa')](function(_0x4ccc56){logger[_0x8429('0xb')](_0x8429('0xc'),_0x278831,_0x8429('0xd'));logger[_0x8429('0xe')](_0x8429('0xf'),_0x278831,'request\x20sent',JSON[_0x8429('0x10')](_0x4ccc56));if(_0x4ccc56[_0x8429('0x11')]){if(_0x4ccc56[_0x8429('0x11')][_0x8429('0x12')]===0x1f4){logger['error'](_0x8429('0xc'),_0x278831,_0x4ccc56[_0x8429('0x11')][_0x8429('0x13')]);return _0x434da3(_0x4ccc56[_0x8429('0x11')][_0x8429('0x13')]);}logger[_0x8429('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x278831,_0x4ccc56['error']['message']);return _0x172f25(_0x4ccc56[_0x8429('0x11')][_0x8429('0x13')]);}else{logger[_0x8429('0xb')](_0x8429('0xc'),_0x278831,_0x8429('0xd'));_0x172f25(_0x4ccc56['result'][_0x8429('0x13')]);}})[_0x8429('0x14')](function(_0x1789c7){logger['error'](_0x8429('0xc'),_0x278831,_0x1789c7);_0x434da3(_0x1789c7);});});}exports[_0x8429('0x15')]=function(_0x1056a7){var _0xc1c160=this;return new Promise(function(_0x3b945b,_0x5d81cb){return db[_0x8429('0x16')][_0x8429('0x17')]({'raw':_0x1056a7['options']?_0x1056a7[_0x8429('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1056a7[_0x8429('0x18')]?_0x1056a7[_0x8429('0x18')][_0x8429('0x19')]||null:null,'attributes':_0x1056a7[_0x8429('0x18')]?_0x1056a7[_0x8429('0x18')][_0x8429('0x1a')]||null:null,'limit':_0x1056a7[_0x8429('0x18')]?_0x1056a7[_0x8429('0x18')]['limit']||null:null,'include':_0x1056a7['options']?_0x1056a7[_0x8429('0x18')][_0x8429('0x1b')]?_[_0x8429('0x1c')](_0x1056a7[_0x8429('0x18')][_0x8429('0x1b')],function(_0x5eda63){return{'model':db[_0x5eda63[_0x8429('0x1d')]],'as':_0x5eda63['as'],'attributes':_0x5eda63['attributes'],'include':_0x5eda63[_0x8429('0x1b')]?_[_0x8429('0x1c')](_0x5eda63[_0x8429('0x1b')],function(_0x27322e){return{'model':db[_0x27322e[_0x8429('0x1d')]],'as':_0x27322e['as'],'attributes':_0x27322e[_0x8429('0x1a')],'include':_0x27322e['include']?_[_0x8429('0x1c')](_0x27322e[_0x8429('0x1b')],function(_0x4681b1){return{'model':db[_0x4681b1['model']],'as':_0x4681b1['as'],'attributes':_0x4681b1[_0x8429('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8429('0xa')](function(_0x168d4d){logger[_0x8429('0xb')]('GetVoiceCallReport',_0x1056a7);logger['debug'](_0x8429('0x15'),_0x1056a7,JSON[_0x8429('0x10')](_0x168d4d));_0x3b945b(_0x168d4d);})[_0x8429('0x14')](function(_0x574567){logger['error'](_0x8429('0x15'),_0x574567['message'],_0x1056a7);_0x5d81cb(_0xc1c160[_0x8429('0x11')](0x1f4,_0x574567[_0x8429('0x13')]));});});};exports[_0x8429('0x1e')]=function(_0x4b1b45){var _0xf4ec89=this;return new Promise(function(_0x11ab1f,_0x5ca602){return db[_0x8429('0x16')][_0x8429('0x1f')](_0x4b1b45[_0x8429('0x20')],{'raw':_0x4b1b45[_0x8429('0x18')]?_0x4b1b45[_0x8429('0x18')][_0x8429('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x1bb65e){logger[_0x8429('0xb')](_0x8429('0x1e'),_0x4b1b45);logger[_0x8429('0xe')]('CreateVoiceCallReport',_0x4b1b45,JSON[_0x8429('0x10')](_0x1bb65e));_0x11ab1f(_0x1bb65e);})['catch'](function(_0x4ac38a){logger[_0x8429('0x11')]('CreateVoiceCallReport',_0x4ac38a[_0x8429('0x13')],_0x4b1b45);_0x5ca602(_0xf4ec89[_0x8429('0x11')](0x1f4,_0x4ac38a[_0x8429('0x13')]));});});};exports[_0x8429('0x22')]=function(_0x2629c0){var _0x1dfadf=this;return new Promise(function(_0x4e8854,_0x13d752){return db[_0x8429('0x16')][_0x8429('0x23')](_0x2629c0[_0x8429('0x20')],{'raw':_0x2629c0['options']?_0x2629c0[_0x8429('0x18')][_0x8429('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2629c0[_0x8429('0x18')]?_0x2629c0[_0x8429('0x18')]['where']||null:null,'attributes':_0x2629c0[_0x8429('0x18')]?_0x2629c0[_0x8429('0x18')][_0x8429('0x1a')]||null:null,'limit':_0x2629c0[_0x8429('0x18')]?_0x2629c0[_0x8429('0x18')][_0x8429('0x24')]||null:null})[_0x8429('0xa')](function(_0x544cc0){logger[_0x8429('0xb')]('UpdateVoiceCallReport',_0x2629c0);logger[_0x8429('0xe')](_0x8429('0x22'),_0x2629c0,JSON[_0x8429('0x10')](_0x544cc0));_0x4e8854(_0x544cc0);})[_0x8429('0x14')](function(_0x20cc1a){logger[_0x8429('0x11')](_0x8429('0x22'),_0x20cc1a[_0x8429('0x13')],_0x2629c0);_0x13d752(_0x1dfadf['error'](0x1f4,_0x20cc1a[_0x8429('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index aadc535..1a633fc 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 _0xf1ad=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','show','post','create','put','/:id','destroy','exports','multer','connect-timeout'];(function(_0x38fd57,_0xc5f61a){var _0x42ebce=function(_0x4f9947){while(--_0x4f9947){_0x38fd57['push'](_0x38fd57['shift']());}};_0x42ebce(++_0xc5f61a);}(_0xf1ad,0xe2));var _0xdf1a=function(_0x239ce8,_0x191cb8){_0x239ce8=_0x239ce8-0x0;var _0x37963f=_0xf1ad[_0x239ce8];return _0x37963f;};'use strict';var multer=require(_0xdf1a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdf1a('0x1'));var express=require(_0xdf1a('0x2'));var router=express[_0xdf1a('0x3')]();var fs_extra=require(_0xdf1a('0x4'));var auth=require(_0xdf1a('0x5'));var interaction=require(_0xdf1a('0x6'));var config=require(_0xdf1a('0x7'));var controller=require(_0xdf1a('0x8'));router[_0xdf1a('0x9')]('/',auth[_0xdf1a('0xa')](),controller[_0xdf1a('0xb')]);router[_0xdf1a('0x9')]('/:id',auth[_0xdf1a('0xa')](),controller[_0xdf1a('0xc')]);router[_0xdf1a('0xd')]('/',auth[_0xdf1a('0xa')](),controller[_0xdf1a('0xe')]);router[_0xdf1a('0xf')](_0xdf1a('0x10'),auth[_0xdf1a('0xa')](),controller['update']);router['delete'](_0xdf1a('0x10'),auth['isAuthenticated'](),controller[_0xdf1a('0x11')]);module[_0xdf1a('0x12')]=router; \ No newline at end of file +var _0xcc4c=['get','/:id','isAuthenticated','post','create','put','update','delete','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller'];(function(_0x290b68,_0x1f82af){var _0x2f23af=function(_0x5efc22){while(--_0x5efc22){_0x290b68['push'](_0x290b68['shift']());}};_0x2f23af(++_0x1f82af);}(_0xcc4c,0x1b2));var _0xccc4=function(_0x3d17fb,_0x31a4f3){_0x3d17fb=_0x3d17fb-0x0;var _0x507821=_0xcc4c[_0x3d17fb];return _0x507821;};'use strict';var multer=require(_0xccc4('0x0'));var util=require('util');var path=require(_0xccc4('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xccc4('0x2')]();var fs_extra=require(_0xccc4('0x3'));var auth=require(_0xccc4('0x4'));var interaction=require(_0xccc4('0x5'));var config=require(_0xccc4('0x6'));var controller=require(_0xccc4('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xccc4('0x8')](_0xccc4('0x9'),auth[_0xccc4('0xa')](),controller['show']);router[_0xccc4('0xb')]('/',auth[_0xccc4('0xa')](),controller[_0xccc4('0xc')]);router[_0xccc4('0xd')](_0xccc4('0x9'),auth[_0xccc4('0xa')](),controller[_0xccc4('0xe')]);router[_0xccc4('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xccc4('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index d15dc88..2a5183a 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 _0xc3a2=['getDataValue','BOOLEAN','sequelize','exports','STRING','name','setDataValue','options','join'];(function(_0x168dab,_0x4abfce){var _0x166a20=function(_0x4540f1){while(--_0x4540f1){_0x168dab['push'](_0x168dab['shift']());}};_0x166a20(++_0x4abfce);}(_0xc3a2,0x14f));var _0x2c3a=function(_0x5e841e,_0x1637f7){_0x5e841e=_0x5e841e-0x0;var _0x1a80aa=_0xc3a2[_0x5e841e];return _0x1a80aa;};'use strict';var Sequelize=require(_0x2c3a('0x0'));module[_0x2c3a('0x1')]={'name':{'type':Sequelize[_0x2c3a('0x2')]},'prefix':{'type':Sequelize[_0x2c3a('0x2')],'unique':_0x2c3a('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x2c3a('0x2')],'set':function(_0x4b64ac){this[_0x2c3a('0x4')](_0x2c3a('0x5'),_0x4b64ac?_0x4b64ac[_0x2c3a('0x6')](''):[]);},'get':function(){return this[_0x2c3a('0x7')](_0x2c3a('0x5'))?this[_0x2c3a('0x7')](_0x2c3a('0x5'))['split'](''):[];}},'auth':{'type':Sequelize[_0x2c3a('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x2c3a('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x2c3a('0x2')]},'description':{'type':Sequelize[_0x2c3a('0x2')]}}; \ No newline at end of file +var _0x3ffc=['split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','options','getDataValue'];(function(_0x879e31,_0x139d02){var _0x3467e8=function(_0x544fc6){while(--_0x544fc6){_0x879e31['push'](_0x879e31['shift']());}};_0x3467e8(++_0x139d02);}(_0x3ffc,0x134));var _0xc3ff=function(_0x5a7650,_0x454cd1){_0x5a7650=_0x5a7650-0x0;var _0x1b8bfc=_0x3ffc[_0x5a7650];return _0x1b8bfc;};'use strict';var Sequelize=require(_0xc3ff('0x0'));module[_0xc3ff('0x1')]={'name':{'type':Sequelize[_0xc3ff('0x2')]},'prefix':{'type':Sequelize[_0xc3ff('0x2')],'unique':_0xc3ff('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x524387){this[_0xc3ff('0x4')](_0xc3ff('0x5'),_0x524387?_0x524387['join'](''):[]);},'get':function(){return this[_0xc3ff('0x6')]('options')?this[_0xc3ff('0x6')](_0xc3ff('0x5'))[_0xc3ff('0x7')](''):[];}},'auth':{'type':Sequelize[_0xc3ff('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xc3ff('0x2')]},'record':{'type':Sequelize[_0xc3ff('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xc3ff('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index e7afb40..ce1e6f4 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 _0xdf2e=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','status','end','json','offset','limit','set','Content-Range','reject','save','then','get','ChanSpies','destroy','sendStatus','error','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','include','findAll','rows','catch','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xdf2e,0xd9));var _0xedf2=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xdf2e[_0x346737];return _0x1ade2e;};'use strict';var emlformat=require(_0xedf2('0x0'));var rimraf=require(_0xedf2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xedf2('0x2'));var rp=require(_0xedf2('0x3'));var moment=require('moment');var BPromise=require(_0xedf2('0x4'));var Mustache=require(_0xedf2('0x5'));var util=require('util');var path=require(_0xedf2('0x6'));var sox=require(_0xedf2('0x7'));var csv=require('to-csv');var ejs=require(_0xedf2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xedf2('0x9'));var squel=require('squel');var crypto=require(_0xedf2('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xedf2('0xb'));var toCsv=require(_0xedf2('0xc'));var querystring=require(_0xedf2('0xd'));var Papa=require(_0xedf2('0xe'));var Redis=require(_0xedf2('0xf'));var authService=require(_0xedf2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xedf2('0x11'));var hardwareService=require(_0xedf2('0x12'));var logger=require(_0xedf2('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xedf2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47b32e,_0x558891){_0x558891=_0x558891||0xcc;return function(_0x2f09d4){if(_0x2f09d4){return _0x47b32e['sendStatus'](_0x558891);}return _0x47b32e[_0xedf2('0x15')](_0x558891)[_0xedf2('0x16')]();};}function respondWithResult(_0x2c8f73,_0xd56c4){_0xd56c4=_0xd56c4||0xc8;return function(_0x5736e1){if(_0x5736e1){return _0x2c8f73[_0xedf2('0x15')](_0xd56c4)[_0xedf2('0x17')](_0x5736e1);}};}function respondWithFilteredResult(_0x2e5ae4,_0x3d754d){return function(_0x36dd8e){if(_0x36dd8e){var _0x2bb588=_0x36dd8e['count'],_0x39627b=_0x3d754d[_0xedf2('0x18')],_0xb38ec=_0x3d754d[_0xedf2('0x18')]+_0x3d754d[_0xedf2('0x19')],_0x4b9821;if(_0xb38ec>=_0x2bb588){_0xb38ec=_0x2bb588;_0x4b9821=0xc8;}else{_0x4b9821=0xce;}_0x2e5ae4['status'](_0x4b9821);return _0x2e5ae4[_0xedf2('0x1a')](_0xedf2('0x1b'),_0x39627b+'-'+_0xb38ec+'/'+_0x2bb588)[_0xedf2('0x17')](_0x36dd8e);}return null;};}function patchUpdates(_0x4abdd1){return function(_0x268bf7){try{jsonpatch['apply'](_0x268bf7,_0x4abdd1,!![]);}catch(_0x22f595){return BPromise[_0xedf2('0x1c')](_0x22f595);}return _0x268bf7[_0xedf2('0x1d')]();};}function saveUpdates(_0x5415e1,_0x537ae3){return function(_0x57ba3b){if(_0x57ba3b){return _0x57ba3b['update'](_0x5415e1)['then'](function(_0x26aa74){return _0x26aa74;});}return null;};}function removeEntity(_0x5394ee,_0x1fcf17){return function(_0x3aeb61){if(_0x3aeb61){return _0x3aeb61['destroy']()[_0xedf2('0x1e')](function(){var _0x1af67f=_0x3aeb61[_0xedf2('0x1f')]({'plain':!![]});var _0xca1155=_0xedf2('0x20');return db['UserProfileResource'][_0xedf2('0x21')]({'where':{'type':_0xca1155,'resourceId':_0x1af67f['id']}})['then'](function(){return _0x3aeb61;});})[_0xedf2('0x1e')](function(){_0x5394ee[_0xedf2('0x15')](0xcc)[_0xedf2('0x16')]();});}};}function handleEntityNotFound(_0x107ba4,_0x3891ed){return function(_0xba58ec){if(!_0xba58ec){_0x107ba4[_0xedf2('0x22')](0x194);}return _0xba58ec;};}function handleError(_0x488f32,_0x2f2f34){_0x2f2f34=_0x2f2f34||0x1f4;return function(_0x491fad){logger[_0xedf2('0x23')](_0x491fad[_0xedf2('0x24')]);if(_0x491fad[_0xedf2('0x25')]){delete _0x491fad['name'];}_0x488f32[_0xedf2('0x15')](_0x2f2f34)[_0xedf2('0x26')](_0x491fad);};}exports['index']=function(_0x2f3019,_0x5a8638){var _0x3c37c5={},_0x2ba548={},_0x5b72fb={'count':0x0,'rows':[]};var _0x18baa3=_[_0xedf2('0x27')](db[_0xedf2('0x28')][_0xedf2('0x29')],function(_0x1e2369){return{'name':_0x1e2369[_0xedf2('0x2a')],'type':_0x1e2369[_0xedf2('0x2b')][_0xedf2('0x2c')]};});_0x2ba548[_0xedf2('0x2d')]=_[_0xedf2('0x27')](_0x18baa3,_0xedf2('0x25'));_0x2ba548['query']=_[_0xedf2('0x2e')](_0x2f3019[_0xedf2('0x2f')]);_0x2ba548['filters']=_[_0xedf2('0x30')](_0x2ba548[_0xedf2('0x2d')],_0x2ba548[_0xedf2('0x2f')]);_0x3c37c5['attributes']=_[_0xedf2('0x30')](_0x2ba548['model'],qs[_0xedf2('0x31')](_0x2f3019[_0xedf2('0x2f')][_0xedf2('0x31')]));_0x3c37c5[_0xedf2('0x32')]=_0x3c37c5[_0xedf2('0x32')][_0xedf2('0x33')]?_0x3c37c5[_0xedf2('0x32')]:_0x2ba548[_0xedf2('0x2d')];if(!_0x2f3019[_0xedf2('0x2f')][_0xedf2('0x34')]('nolimit')){_0x3c37c5[_0xedf2('0x19')]=qs[_0xedf2('0x19')](_0x2f3019[_0xedf2('0x2f')][_0xedf2('0x19')]);_0x3c37c5[_0xedf2('0x18')]=qs[_0xedf2('0x18')](_0x2f3019['query'][_0xedf2('0x18')]);}_0x3c37c5['order']=qs['sort'](_0x2f3019[_0xedf2('0x2f')][_0xedf2('0x35')]);_0x3c37c5[_0xedf2('0x36')]=qs[_0xedf2('0x37')](_[_0xedf2('0x38')](_0x2f3019['query'],_0x2ba548[_0xedf2('0x37')]),_0x18baa3);if(_0x2f3019[_0xedf2('0x2f')][_0xedf2('0x39')]){_0x3c37c5[_0xedf2('0x36')]=_['merge'](_0x3c37c5[_0xedf2('0x36')],{'$or':_[_0xedf2('0x27')](_0x18baa3,function(_0x3f6f77){if(_0x3f6f77[_0xedf2('0x2b')]!==_0xedf2('0x3a')){var _0x52a5a9={};_0x52a5a9[_0x3f6f77[_0xedf2('0x25')]]={'$like':'%'+_0x2f3019[_0xedf2('0x2f')]['filter']+'%'};return _0x52a5a9;}})});}_0x3c37c5=_[_0xedf2('0x3b')]({},_0x3c37c5,_0x2f3019[_0xedf2('0x3c')]);var _0x2067e1={'where':_0x3c37c5[_0xedf2('0x36')]};return db[_0xedf2('0x28')][_0xedf2('0x3d')](_0x2067e1)[_0xedf2('0x1e')](function(_0x2a1bef){_0x5b72fb[_0xedf2('0x3d')]=_0x2a1bef;if(_0x2f3019['query']['includeAll']){_0x3c37c5[_0xedf2('0x3e')]=[{'all':!![]}];}return db[_0xedf2('0x28')][_0xedf2('0x3f')](_0x3c37c5);})[_0xedf2('0x1e')](function(_0x314c57){_0x5b72fb[_0xedf2('0x40')]=_0x314c57;return _0x5b72fb;})[_0xedf2('0x1e')](respondWithFilteredResult(_0x5a8638,_0x3c37c5))[_0xedf2('0x41')](handleError(_0x5a8638,null));};exports['show']=function(_0x9416b2,_0x5befe9){var _0x3de6b3={'raw':![],'where':{'id':_0x9416b2[_0xedf2('0x42')]['id']}},_0x3f1459={};_0x3f1459[_0xedf2('0x2d')]=_['keys'](db[_0xedf2('0x28')][_0xedf2('0x29')]);_0x3f1459[_0xedf2('0x2f')]=_['keys'](_0x9416b2[_0xedf2('0x2f')]);_0x3f1459[_0xedf2('0x37')]=_[_0xedf2('0x30')](_0x3f1459[_0xedf2('0x2d')],_0x3f1459[_0xedf2('0x2f')]);_0x3de6b3[_0xedf2('0x32')]=_['intersection'](_0x3f1459[_0xedf2('0x2d')],qs[_0xedf2('0x31')](_0x9416b2['query'][_0xedf2('0x31')]));_0x3de6b3[_0xedf2('0x32')]=_0x3de6b3[_0xedf2('0x32')]['length']?_0x3de6b3[_0xedf2('0x32')]:_0x3f1459[_0xedf2('0x2d')];if(_0x9416b2[_0xedf2('0x2f')][_0xedf2('0x43')]){_0x3de6b3[_0xedf2('0x3e')]=[{'all':!![]}];}_0x3de6b3=_['merge']({},_0x3de6b3,_0x9416b2['options']);return db[_0xedf2('0x28')][_0xedf2('0x44')](_0x3de6b3)[_0xedf2('0x1e')](handleEntityNotFound(_0x5befe9,null))['then'](respondWithResult(_0x5befe9,null))[_0xedf2('0x41')](handleError(_0x5befe9,null));};exports[_0xedf2('0x45')]=function(_0x2ea5f8,_0x561227){return db[_0xedf2('0x28')]['create'](_0x2ea5f8['body'],{})[_0xedf2('0x1e')](function(_0x3abf0a){var _0x42291b=_0x2ea5f8[_0xedf2('0x46')][_0xedf2('0x1f')]({'plain':!![]});if(!_0x42291b)throw new Error(_0xedf2('0x47'));if(_0x42291b['role']==='user'){var _0x27665b=_0x3abf0a[_0xedf2('0x1f')]({'plain':!![]});var _0x5cbb63=_0xedf2('0x20');return db[_0xedf2('0x48')][_0xedf2('0x44')]({'where':{'name':_0x5cbb63,'userProfileId':_0x42291b['userProfileId']},'raw':!![]})['then'](function(_0x28e838){if(_0x28e838&&_0x28e838['autoAssociation']===0x0){return db[_0xedf2('0x49')]['create']({'name':_0x27665b[_0xedf2('0x25')],'resourceId':_0x27665b['id'],'type':_0x28e838[_0xedf2('0x25')],'sectionId':_0x28e838['id']},{})[_0xedf2('0x1e')](function(){return _0x3abf0a;});}else{return _0x3abf0a;}})[_0xedf2('0x41')](function(_0x583767){logger[_0xedf2('0x23')](_0xedf2('0x4a'),_0x583767);throw _0x583767;});}return _0x3abf0a;})[_0xedf2('0x1e')](respondWithResult(_0x561227,0xc9))[_0xedf2('0x41')](handleError(_0x561227,null));};exports[_0xedf2('0x4b')]=function(_0x43c34b,_0x2ad9d4){if(_0x43c34b[_0xedf2('0x4c')]['id']){delete _0x43c34b[_0xedf2('0x4c')]['id'];}return db[_0xedf2('0x28')][_0xedf2('0x44')]({'where':{'id':_0x43c34b[_0xedf2('0x42')]['id']}})[_0xedf2('0x1e')](handleEntityNotFound(_0x2ad9d4,null))[_0xedf2('0x1e')](saveUpdates(_0x43c34b[_0xedf2('0x4c')],null))[_0xedf2('0x1e')](respondWithResult(_0x2ad9d4,null))[_0xedf2('0x41')](handleError(_0x2ad9d4,null));};exports['destroy']=function(_0x3aa58f,_0x1b2390){return db[_0xedf2('0x28')][_0xedf2('0x44')]({'where':{'id':_0x3aa58f[_0xedf2('0x42')]['id']}})['then'](handleEntityNotFound(_0x1b2390,null))[_0xedf2('0x1e')](removeEntity(_0x1b2390,null))[_0xedf2('0x41')](handleError(_0x1b2390,null));}; \ No newline at end of file +var _0x0077=['order','sort','filter','where','merge','options','include','findAll','rows','show','params','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','body','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0xb91f94,_0x1c0bc1){var _0x46badb=function(_0x2e5fb7){while(--_0x2e5fb7){_0xb91f94['push'](_0xb91f94['shift']());}};_0x46badb(++_0x1c0bc1);}(_0x0077,0x64));var _0x7007=function(_0x1669dc,_0x3075ab){_0x1669dc=_0x1669dc-0x0;var _0x2ab1d6=_0x0077[_0x1669dc];return _0x2ab1d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7007('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7007('0x1'));var rp=require('request-promise');var moment=require(_0x7007('0x2'));var BPromise=require(_0x7007('0x3'));var Mustache=require('mustache');var util=require(_0x7007('0x4'));var path=require('path');var sox=require(_0x7007('0x5'));var csv=require(_0x7007('0x6'));var ejs=require(_0x7007('0x7'));var fs=require('fs');var fs_extra=require(_0x7007('0x8'));var _=require(_0x7007('0x9'));var squel=require('squel');var crypto=require(_0x7007('0xa'));var jsforce=require(_0x7007('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7007('0xc'));var Papa=require('papaparse');var Redis=require(_0x7007('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x7007('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7007('0xf'));var utils=require(_0x7007('0x10'));var config=require(_0x7007('0x11'));var licenseUtil=require(_0x7007('0x12'));var db=require(_0x7007('0x13'))['db'];function respondWithStatusCode(_0x34b12a,_0xbaa791){_0xbaa791=_0xbaa791||0xcc;return function(_0x3aa432){if(_0x3aa432){return _0x34b12a[_0x7007('0x14')](_0xbaa791);}return _0x34b12a[_0x7007('0x15')](_0xbaa791)[_0x7007('0x16')]();};}function respondWithResult(_0x1ea577,_0x50fd35){_0x50fd35=_0x50fd35||0xc8;return function(_0x37b47a){if(_0x37b47a){return _0x1ea577['status'](_0x50fd35)[_0x7007('0x17')](_0x37b47a);}};}function respondWithFilteredResult(_0x2af740,_0x5ef9b5){return function(_0x159ee9){if(_0x159ee9){var _0xaab524=_0x159ee9[_0x7007('0x18')],_0x4ffd9d=_0x5ef9b5[_0x7007('0x19')],_0x318a58=_0x5ef9b5[_0x7007('0x19')]+_0x5ef9b5[_0x7007('0x1a')],_0x185b92;if(_0x318a58>=_0xaab524){_0x318a58=_0xaab524;_0x185b92=0xc8;}else{_0x185b92=0xce;}_0x2af740[_0x7007('0x15')](_0x185b92);return _0x2af740[_0x7007('0x1b')](_0x7007('0x1c'),_0x4ffd9d+'-'+_0x318a58+'/'+_0xaab524)['json'](_0x159ee9);}return null;};}function patchUpdates(_0x33ae2d){return function(_0x2e1fd7){try{jsonpatch[_0x7007('0x1d')](_0x2e1fd7,_0x33ae2d,!![]);}catch(_0xd61e82){return BPromise[_0x7007('0x1e')](_0xd61e82);}return _0x2e1fd7[_0x7007('0x1f')]();};}function saveUpdates(_0x285b47,_0x29450e){return function(_0x48d47e){if(_0x48d47e){return _0x48d47e[_0x7007('0x20')](_0x285b47)[_0x7007('0x21')](function(_0x56b110){return _0x56b110;});}return null;};}function removeEntity(_0x3c8f7b,_0x4082df){return function(_0xad16e6){if(_0xad16e6){return _0xad16e6[_0x7007('0x22')]()[_0x7007('0x21')](function(){var _0x25427f=_0xad16e6[_0x7007('0x23')]({'plain':!![]});var _0x53ba8f=_0x7007('0x24');return db[_0x7007('0x25')][_0x7007('0x22')]({'where':{'type':_0x53ba8f,'resourceId':_0x25427f['id']}})[_0x7007('0x21')](function(){return _0xad16e6;});})[_0x7007('0x21')](function(){_0x3c8f7b[_0x7007('0x15')](0xcc)[_0x7007('0x16')]();});}};}function handleEntityNotFound(_0x1a4795,_0x4ca0e1){return function(_0x30bded){if(!_0x30bded){_0x1a4795['sendStatus'](0x194);}return _0x30bded;};}function handleError(_0x233b06,_0x5acdf8){_0x5acdf8=_0x5acdf8||0x1f4;return function(_0x1fa839){logger[_0x7007('0x26')](_0x1fa839[_0x7007('0x27')]);if(_0x1fa839[_0x7007('0x28')]){delete _0x1fa839[_0x7007('0x28')];}_0x233b06[_0x7007('0x15')](_0x5acdf8)[_0x7007('0x29')](_0x1fa839);};}exports[_0x7007('0x2a')]=function(_0x23487c,_0x2c9a7f){var _0x27dc75={},_0x597d10={},_0x20428c={'count':0x0,'rows':[]};var _0x4ebe76=_[_0x7007('0x2b')](db[_0x7007('0x2c')][_0x7007('0x2d')],function(_0x5def18){return{'name':_0x5def18[_0x7007('0x2e')],'type':_0x5def18[_0x7007('0x2f')][_0x7007('0x30')]};});_0x597d10['model']=_['map'](_0x4ebe76,_0x7007('0x28'));_0x597d10[_0x7007('0x31')]=_[_0x7007('0x32')](_0x23487c['query']);_0x597d10[_0x7007('0x33')]=_[_0x7007('0x34')](_0x597d10[_0x7007('0x35')],_0x597d10['query']);_0x27dc75[_0x7007('0x36')]=_[_0x7007('0x34')](_0x597d10[_0x7007('0x35')],qs[_0x7007('0x37')](_0x23487c[_0x7007('0x31')]['fields']));_0x27dc75[_0x7007('0x36')]=_0x27dc75[_0x7007('0x36')][_0x7007('0x38')]?_0x27dc75[_0x7007('0x36')]:_0x597d10[_0x7007('0x35')];if(!_0x23487c[_0x7007('0x31')][_0x7007('0x39')]('nolimit')){_0x27dc75[_0x7007('0x1a')]=qs['limit'](_0x23487c[_0x7007('0x31')][_0x7007('0x1a')]);_0x27dc75[_0x7007('0x19')]=qs[_0x7007('0x19')](_0x23487c[_0x7007('0x31')][_0x7007('0x19')]);}_0x27dc75[_0x7007('0x3a')]=qs[_0x7007('0x3b')](_0x23487c[_0x7007('0x31')]['sort']);_0x27dc75['where']=qs['filters'](_['pick'](_0x23487c[_0x7007('0x31')],_0x597d10[_0x7007('0x33')]),_0x4ebe76);if(_0x23487c[_0x7007('0x31')][_0x7007('0x3c')]){_0x27dc75[_0x7007('0x3d')]=_[_0x7007('0x3e')](_0x27dc75['where'],{'$or':_[_0x7007('0x2b')](_0x4ebe76,function(_0x1e47a6){if(_0x1e47a6[_0x7007('0x2f')]!=='VIRTUAL'){var _0x22eb44={};_0x22eb44[_0x1e47a6['name']]={'$like':'%'+_0x23487c[_0x7007('0x31')][_0x7007('0x3c')]+'%'};return _0x22eb44;}})});}_0x27dc75=_[_0x7007('0x3e')]({},_0x27dc75,_0x23487c[_0x7007('0x3f')]);var _0x56c454={'where':_0x27dc75[_0x7007('0x3d')]};return db[_0x7007('0x2c')][_0x7007('0x18')](_0x56c454)[_0x7007('0x21')](function(_0x144907){_0x20428c['count']=_0x144907;if(_0x23487c[_0x7007('0x31')]['includeAll']){_0x27dc75[_0x7007('0x40')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x7007('0x41')](_0x27dc75);})[_0x7007('0x21')](function(_0xaeec28){_0x20428c[_0x7007('0x42')]=_0xaeec28;return _0x20428c;})[_0x7007('0x21')](respondWithFilteredResult(_0x2c9a7f,_0x27dc75))['catch'](handleError(_0x2c9a7f,null));};exports[_0x7007('0x43')]=function(_0x3286a5,_0x40c958){var _0x288516={'raw':![],'where':{'id':_0x3286a5[_0x7007('0x44')]['id']}},_0x300f18={};_0x300f18[_0x7007('0x35')]=_['keys'](db['VoiceChanSpy'][_0x7007('0x2d')]);_0x300f18[_0x7007('0x31')]=_[_0x7007('0x32')](_0x3286a5[_0x7007('0x31')]);_0x300f18[_0x7007('0x33')]=_[_0x7007('0x34')](_0x300f18['model'],_0x300f18[_0x7007('0x31')]);_0x288516['attributes']=_['intersection'](_0x300f18['model'],qs[_0x7007('0x37')](_0x3286a5['query'][_0x7007('0x37')]));_0x288516[_0x7007('0x36')]=_0x288516['attributes'][_0x7007('0x38')]?_0x288516[_0x7007('0x36')]:_0x300f18[_0x7007('0x35')];if(_0x3286a5[_0x7007('0x31')]['includeAll']){_0x288516[_0x7007('0x40')]=[{'all':!![]}];}_0x288516=_['merge']({},_0x288516,_0x3286a5['options']);return db[_0x7007('0x2c')][_0x7007('0x45')](_0x288516)[_0x7007('0x21')](handleEntityNotFound(_0x40c958,null))[_0x7007('0x21')](respondWithResult(_0x40c958,null))[_0x7007('0x46')](handleError(_0x40c958,null));};exports[_0x7007('0x47')]=function(_0x1a46bf,_0x22411d){return db['VoiceChanSpy'][_0x7007('0x47')](_0x1a46bf['body'],{})[_0x7007('0x21')](function(_0x565c07){var _0xc63fee=_0x1a46bf['user']['get']({'plain':!![]});if(!_0xc63fee)throw new Error(_0x7007('0x48'));if(_0xc63fee[_0x7007('0x49')]===_0x7007('0x4a')){var _0xd91fe2=_0x565c07[_0x7007('0x23')]({'plain':!![]});var _0x34c7c5=_0x7007('0x24');return db[_0x7007('0x4b')][_0x7007('0x45')]({'where':{'name':_0x34c7c5,'userProfileId':_0xc63fee[_0x7007('0x4c')]},'raw':!![]})['then'](function(_0x4c0d21){if(_0x4c0d21&&_0x4c0d21[_0x7007('0x4d')]===0x0){return db['UserProfileResource'][_0x7007('0x47')]({'name':_0xd91fe2['name'],'resourceId':_0xd91fe2['id'],'type':_0x4c0d21['name'],'sectionId':_0x4c0d21['id']},{})[_0x7007('0x21')](function(){return _0x565c07;});}else{return _0x565c07;}})['catch'](function(_0x50f924){logger[_0x7007('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50f924);throw _0x50f924;});}return _0x565c07;})[_0x7007('0x21')](respondWithResult(_0x22411d,0xc9))[_0x7007('0x46')](handleError(_0x22411d,null));};exports[_0x7007('0x20')]=function(_0x542891,_0x5e4928){if(_0x542891[_0x7007('0x4e')]['id']){delete _0x542891[_0x7007('0x4e')]['id'];}return db[_0x7007('0x2c')][_0x7007('0x45')]({'where':{'id':_0x542891[_0x7007('0x44')]['id']}})[_0x7007('0x21')](handleEntityNotFound(_0x5e4928,null))[_0x7007('0x21')](saveUpdates(_0x542891[_0x7007('0x4e')],null))[_0x7007('0x21')](respondWithResult(_0x5e4928,null))['catch'](handleError(_0x5e4928,null));};exports[_0x7007('0x22')]=function(_0x32595d,_0x57907b){return db[_0x7007('0x2c')]['find']({'where':{'id':_0x32595d[_0x7007('0x44')]['id']}})['then'](handleEntityNotFound(_0x57907b,null))[_0x7007('0x21')](removeEntity(_0x57907b,null))['catch'](handleError(_0x57907b,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index fa50a7f..e46669f 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 _0x3238=['system','merge','CDR(type)=%s','chanspy','record','push','MixMonitor','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','concat','internal','User','findAll','catch','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','length','bulkCreate','destroy','lodash','bluebird','./voiceChanSpy.attributes','format','%s%s','prefix'];(function(_0x4ce3b6,_0x1512d6){var _0x3f3bbb=function(_0x372c89){while(--_0x372c89){_0x4ce3b6['push'](_0x4ce3b6['shift']());}};_0x3f3bbb(++_0x1512d6);}(_0x3238,0x13e));var _0x8323=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3238[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8323('0x0'));var util=require('util');var BPromise=require(_0x8323('0x1'));var attributes=require(_0x8323('0x2'));var getUserApplications=function(_0xd581b1,_0x5ef9f4,_0x46e31e){var _0x24543a=0x1;var _0xb41ea9=[];var _0xce566d={'context':_0x5ef9f4['context']||'from-sip','exten':util[_0x8323('0x3')](_0x8323('0x4'),_0xd581b1[_0x8323('0x5')],_0x46e31e),'type':_0x8323('0x6'),'isApp':![],'ChanSpyId':_0xd581b1['id'],'UserId':_0x5ef9f4['id']};_0xb41ea9['push'](_[_0x8323('0x7')]({'app':'Set','appdata':util[_0x8323('0x3')](_0x8323('0x8'),_0x8323('0x9')),'priority':_0x24543a++},_0xce566d));if(_0xd581b1[_0x8323('0xa')]){_0xb41ea9[_0x8323('0xb')](_[_0x8323('0x7')]({'app':_0x8323('0xc'),'appdata':util[_0x8323('0x3')]('${UNIQUEID}.%s,a',_0xd581b1[_0x8323('0xd')]),'priority':_0x24543a++},_0xce566d));}if(_0xd581b1[_0x8323('0xe')]){_0xb41ea9[_0x8323('0xb')](_['merge']({'app':_0x8323('0xf'),'appdata':_0xd581b1[_0x8323('0x10')],'priority':_0x24543a++},_0xce566d));}_0xb41ea9[_0x8323('0xb')](_[_0x8323('0x7')]({'app':_0x8323('0x11'),'appdata':util[_0x8323('0x3')](_0x8323('0x12'),_0x5ef9f4[_0x8323('0x13')],_0xd581b1[_0x8323('0x14')]?_0xd581b1[_0x8323('0x14')][_0x8323('0x15')](''):''),'priority':_0x24543a++},_0xce566d));if(_0xd581b1[_0x8323('0xa')]){_0xb41ea9[_0x8323('0xb')](_[_0x8323('0x7')]({'app':'StopMixMonitor','priority':_0x24543a++},_0xce566d));}return _0xb41ea9;};var getChanSpyApplications=function(_0x639383,_0x361c3f){var _0x5021c2=[];for(var _0x320e7f=0x0,_0x48b200=0x1;_0x320e7f<_0x361c3f['length'];_0x320e7f++,_0x48b200=0x1){_0x5021c2=_0x5021c2[_0x8323('0x16')](getUserApplications(_0x639383,_0x361c3f[_0x320e7f],_0x361c3f[_0x320e7f][_0x8323('0x17')]));if(_0x361c3f[_0x320e7f][_0x8323('0x17')]!=_0x361c3f[_0x320e7f][_0x8323('0x13')]){_0x5021c2=_0x5021c2[_0x8323('0x16')](getUserApplications(_0x639383,_0x361c3f[_0x320e7f],_0x361c3f[_0x320e7f][_0x8323('0x13')]));}}return _0x5021c2;};var getChanSpyPromise=function(_0x5cb339,_0x31a69a){return new BPromise(function(_0x4f638e,_0x1d6e73){return _0x5cb339[_0x8323('0x18')][_0x8323('0x19')]({'attributes':['id','name',_0x8323('0x17')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x3b6c09){if(_0x3b6c09){return _0x4f638e(getChanSpyApplications(_0x31a69a,_0x3b6c09));}return _0x4f638e([]);})[_0x8323('0x1a')](function(_0x7c84f9){_0x1d6e73(_0x7c84f9);});});};module['exports']=function(_0x56a516,_0x1c297c){var _0x183e38=_0x56a516[_0x8323('0x1b')];return _0x56a516[_0x8323('0x1c')](_0x8323('0x1d'),attributes,{'tableName':_0x8323('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3185d3,_0xe839b3,_0x2ded41){return getChanSpyPromise(_0x183e38,_0x3185d3)['then'](function(_0x27155d){if(_0x27155d&&_0x27155d['length']){return _0x183e38['VoiceExtension']['bulkCreate'](_0x27155d);}})[_0x8323('0x1f')](function(){_0x2ded41();})[_0x8323('0x1a')](function(_0x16a2d0){_0x2ded41(_0x16a2d0);});},'afterUpdate':function(_0x474f2a,_0x49cc85,_0x21273e){return _0x183e38[_0x8323('0x20')]['destroy']({'where':{'ChanSpyId':_0x474f2a['id']}})[_0x8323('0x1f')](function(){return getChanSpyPromise(_0x183e38,_0x474f2a);})[_0x8323('0x1f')](function(_0x23c344){if(_0x23c344&&_0x23c344[_0x8323('0x21')]){return _0x183e38[_0x8323('0x20')][_0x8323('0x22')](_0x23c344);}})[_0x8323('0x1f')](function(){_0x21273e();})['catch'](function(_0x267d52){_0x21273e(_0x267d52);});},'afterDestroy':function(_0xe31501,_0x5c7e72,_0x29fd44){return _0x183e38[_0x8323('0x20')][_0x8323('0x23')]({'where':{'ChanSpyId':_0xe31501['id']}})[_0x8323('0x1f')](function(){_0x29fd44();})[_0x8323('0x1a')](function(_0x5241c2){_0x29fd44(_0x5241c2);});}}});}; \ No newline at end of file +var _0x4065=['voice_chanspy','VoiceExtension','bulkCreate','destroy','./voiceChanSpy.attributes','context','format','%s%s','prefix','system','push','merge','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','recordingFormat','auth','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','then','catch','exports','models','VoiceChanSpy'];(function(_0x57bc76,_0x532cc4){var _0x466b5e=function(_0x31af48){while(--_0x31af48){_0x57bc76['push'](_0x57bc76['shift']());}};_0x466b5e(++_0x532cc4);}(_0x4065,0xdc));var _0x5406=function(_0x1ca5e9,_0x11fb96){_0x1ca5e9=_0x1ca5e9-0x0;var _0x51ec61=_0x4065[_0x1ca5e9];return _0x51ec61;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require('bluebird');var attributes=require(_0x5406('0x0'));var getUserApplications=function(_0x582af0,_0x43096a,_0x46186c){var _0x3bed8a=0x1;var _0x5dde3e=[];var _0xc5c0b5={'context':_0x43096a[_0x5406('0x1')]||'from-sip','exten':util[_0x5406('0x2')](_0x5406('0x3'),_0x582af0[_0x5406('0x4')],_0x46186c),'type':_0x5406('0x5'),'isApp':![],'ChanSpyId':_0x582af0['id'],'UserId':_0x43096a['id']};_0x5dde3e[_0x5406('0x6')](_[_0x5406('0x7')]({'app':'Set','appdata':util[_0x5406('0x2')](_0x5406('0x8'),_0x5406('0x9')),'priority':_0x3bed8a++},_0xc5c0b5));if(_0x582af0[_0x5406('0xa')]){_0x5dde3e[_0x5406('0x6')](_[_0x5406('0x7')]({'app':'MixMonitor','appdata':util[_0x5406('0x2')](_0x5406('0xb'),_0x582af0[_0x5406('0xc')]),'priority':_0x3bed8a++},_0xc5c0b5));}if(_0x582af0[_0x5406('0xd')]){_0x5dde3e[_0x5406('0x6')](_[_0x5406('0x7')]({'app':'Authenticate','appdata':_0x582af0[_0x5406('0xe')],'priority':_0x3bed8a++},_0xc5c0b5));}_0x5dde3e[_0x5406('0x6')](_['merge']({'app':_0x5406('0xf'),'appdata':util[_0x5406('0x2')](_0x5406('0x10'),_0x43096a[_0x5406('0x11')],_0x582af0[_0x5406('0x12')]?_0x582af0[_0x5406('0x12')][_0x5406('0x13')](''):''),'priority':_0x3bed8a++},_0xc5c0b5));if(_0x582af0[_0x5406('0xa')]){_0x5dde3e[_0x5406('0x6')](_['merge']({'app':_0x5406('0x14'),'priority':_0x3bed8a++},_0xc5c0b5));}return _0x5dde3e;};var getChanSpyApplications=function(_0x17806b,_0xb982cc){var _0xb25b29=[];for(var _0x505b25=0x0,_0x135b1a=0x1;_0x505b25<_0xb982cc[_0x5406('0x15')];_0x505b25++,_0x135b1a=0x1){_0xb25b29=_0xb25b29[_0x5406('0x16')](getUserApplications(_0x17806b,_0xb982cc[_0x505b25],_0xb982cc[_0x505b25][_0x5406('0x17')]));if(_0xb982cc[_0x505b25][_0x5406('0x17')]!=_0xb982cc[_0x505b25][_0x5406('0x11')]){_0xb25b29=_0xb25b29[_0x5406('0x16')](getUserApplications(_0x17806b,_0xb982cc[_0x505b25],_0xb982cc[_0x505b25][_0x5406('0x11')]));}}return _0xb25b29;};var getChanSpyPromise=function(_0x5119ae,_0x453ee5){return new BPromise(function(_0x3ce1d1,_0x498a7c){return _0x5119ae[_0x5406('0x18')][_0x5406('0x19')]({'attributes':['id',_0x5406('0x11'),'internal'],'where':{'role':_0x5406('0x1a'),'chanspy':!![]},'raw':!![]})[_0x5406('0x1b')](function(_0x35c706){if(_0x35c706){return _0x3ce1d1(getChanSpyApplications(_0x453ee5,_0x35c706));}return _0x3ce1d1([]);})[_0x5406('0x1c')](function(_0x41f681){_0x498a7c(_0x41f681);});});};module[_0x5406('0x1d')]=function(_0x12c6b6,_0x4225e7){var _0x5bf411=_0x12c6b6[_0x5406('0x1e')];return _0x12c6b6['define'](_0x5406('0x1f'),attributes,{'tableName':_0x5406('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x57c331,_0x471032,_0x371438){return getChanSpyPromise(_0x5bf411,_0x57c331)[_0x5406('0x1b')](function(_0xc3e2e8){if(_0xc3e2e8&&_0xc3e2e8[_0x5406('0x15')]){return _0x5bf411[_0x5406('0x21')][_0x5406('0x22')](_0xc3e2e8);}})[_0x5406('0x1b')](function(){_0x371438();})['catch'](function(_0x2256bd){_0x371438(_0x2256bd);});},'afterUpdate':function(_0x13796c,_0xfba3e7,_0x2b4449){return _0x5bf411[_0x5406('0x21')][_0x5406('0x23')]({'where':{'ChanSpyId':_0x13796c['id']}})[_0x5406('0x1b')](function(){return getChanSpyPromise(_0x5bf411,_0x13796c);})[_0x5406('0x1b')](function(_0x52822a){if(_0x52822a&&_0x52822a[_0x5406('0x15')]){return _0x5bf411['VoiceExtension'][_0x5406('0x22')](_0x52822a);}})['then'](function(){_0x2b4449();})[_0x5406('0x1c')](function(_0x3cf64f){_0x2b4449(_0x3cf64f);});},'afterDestroy':function(_0x3e0b7f,_0x24255f,_0x213bf4){return _0x5bf411[_0x5406('0x21')][_0x5406('0x23')]({'where':{'ChanSpyId':_0x3e0b7f['id']}})[_0x5406('0x1b')](function(){_0x213bf4();})['catch'](function(_0x2daf47){_0x213bf4(_0x2daf47);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index bf14c5c..923069f 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 _0x0635=['error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3bf8ae,_0x548fb7){var _0x3b8469=function(_0x3b4378){while(--_0x3b4378){_0x3bf8ae['push'](_0x3bf8ae['shift']());}};_0x3b8469(++_0x548fb7);}(_0x0635,0x100));var _0x5063=function(_0x3037f9,_0x5308be){_0x3037f9=_0x3037f9-0x0;var _0x157b84=_0x0635[_0x3037f9];return _0x157b84;};'use strict';var _=require(_0x5063('0x0'));var util=require(_0x5063('0x1'));var moment=require(_0x5063('0x2'));var BPromise=require(_0x5063('0x3'));var rs=require(_0x5063('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5063('0x5'))['db'];var utils=require(_0x5063('0x6'));var logger=require(_0x5063('0x7'))(_0x5063('0x8'));var config=require(_0x5063('0x9'));var jayson=require(_0x5063('0xa'));var client=jayson[_0x5063('0xb')][_0x5063('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x454bdd,_0x54a032,_0x52908c){return new BPromise(function(_0x158fa6,_0x89134e){return client[_0x5063('0xd')](_0x454bdd,_0x52908c)[_0x5063('0xe')](function(_0x1d52ae){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x54a032,'request\x20sent');logger[_0x5063('0xf')](_0x5063('0x10'),_0x54a032,_0x5063('0x11'),JSON[_0x5063('0x12')](_0x1d52ae));if(_0x1d52ae[_0x5063('0x13')]){if(_0x1d52ae[_0x5063('0x13')][_0x5063('0x14')]===0x1f4){logger[_0x5063('0x13')](_0x5063('0x15'),_0x54a032,_0x1d52ae[_0x5063('0x13')]['message']);return _0x89134e(_0x1d52ae[_0x5063('0x13')]['message']);}logger[_0x5063('0x13')](_0x5063('0x15'),_0x54a032,_0x1d52ae[_0x5063('0x13')][_0x5063('0x16')]);return _0x158fa6(_0x1d52ae[_0x5063('0x13')][_0x5063('0x16')]);}else{logger['info'](_0x5063('0x15'),_0x54a032,'request\x20sent');_0x158fa6(_0x1d52ae[_0x5063('0x17')][_0x5063('0x16')]);}})[_0x5063('0x18')](function(_0x2eebc2){logger[_0x5063('0x13')](_0x5063('0x15'),_0x54a032,_0x2eebc2);_0x89134e(_0x2eebc2);});});} \ No newline at end of file +var _0x961d=['then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request'];(function(_0x1c2431,_0x342d5b){var _0x4f84a9=function(_0x5da775){while(--_0x5da775){_0x1c2431['push'](_0x1c2431['shift']());}};_0x4f84a9(++_0x342d5b);}(_0x961d,0x1af));var _0xd961=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0x961d[_0x209fcd];return _0x501d5e;};'use strict';var _=require(_0xd961('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd961('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd961('0x2'));var db=require(_0xd961('0x3'))['db'];var utils=require(_0xd961('0x4'));var logger=require(_0xd961('0x5'))(_0xd961('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd961('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28f371,_0x5f54a8,_0x24f47f){return new BPromise(function(_0x4a5b70,_0xc17afa){return client[_0xd961('0x8')](_0x28f371,_0x24f47f)[_0xd961('0x9')](function(_0x3235f0){logger[_0xd961('0xa')](_0xd961('0xb'),_0x5f54a8,_0xd961('0xc'));logger[_0xd961('0xd')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x5f54a8,_0xd961('0xc'),JSON[_0xd961('0xe')](_0x3235f0));if(_0x3235f0[_0xd961('0xf')]){if(_0x3235f0[_0xd961('0xf')][_0xd961('0x10')]===0x1f4){logger[_0xd961('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x5f54a8,_0x3235f0[_0xd961('0xf')]['message']);return _0xc17afa(_0x3235f0[_0xd961('0xf')]['message']);}logger[_0xd961('0xf')](_0xd961('0xb'),_0x5f54a8,_0x3235f0[_0xd961('0xf')][_0xd961('0x11')]);return _0x4a5b70(_0x3235f0[_0xd961('0xf')][_0xd961('0x11')]);}else{logger[_0xd961('0xa')]('VoiceChanSpy,\x20%s,\x20%s',_0x5f54a8,'request\x20sent');_0x4a5b70(_0x3235f0[_0xd961('0x12')]['message']);}})[_0xd961('0x13')](function(_0x4456f3){logger[_0xd961('0xf')](_0xd961('0xb'),_0x5f54a8,_0x4456f3);_0xc17afa(_0x4456f3);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index e16020f..8655a47 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 _0xb13b=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','create','put','update'];(function(_0x28d225,_0x43be18){var _0x1f79e1=function(_0x362c23){while(--_0x362c23){_0x28d225['push'](_0x28d225['shift']());}};_0x1f79e1(++_0x43be18);}(_0xb13b,0x1de));var _0xbb13=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xb13b[_0x1203f];return _0x365f0a;};'use strict';var multer=require(_0xbb13('0x0'));var util=require(_0xbb13('0x1'));var path=require(_0xbb13('0x2'));var timeout=require(_0xbb13('0x3'));var express=require(_0xbb13('0x4'));var router=express['Router']();var fs_extra=require(_0xbb13('0x5'));var auth=require(_0xbb13('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbb13('0x7'));var controller=require(_0xbb13('0x8'));router[_0xbb13('0x9')]('/',auth[_0xbb13('0xa')](),controller[_0xbb13('0xb')]);router[_0xbb13('0x9')](_0xbb13('0xc'),auth[_0xbb13('0xa')](),controller['show']);router['post']('/',auth[_0xbb13('0xa')](),controller[_0xbb13('0xd')]);router[_0xbb13('0xe')](_0xbb13('0xc'),auth[_0xbb13('0xa')](),controller[_0xbb13('0xf')]);router[_0xbb13('0x10')]('/:id',auth[_0xbb13('0xa')](),controller[_0xbb13('0x11')]);module[_0xbb13('0x12')]=router; \ No newline at end of file +var _0x3ae9=['delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','update'];(function(_0x144b30,_0x77072d){var _0x1bb7bc=function(_0x1082cc){while(--_0x1082cc){_0x144b30['push'](_0x144b30['shift']());}};_0x1bb7bc(++_0x77072d);}(_0x3ae9,0xdb));var _0x93ae=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x3ae9[_0x122096];return _0x3d1966;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x93ae('0x0'));var timeout=require(_0x93ae('0x1'));var express=require(_0x93ae('0x2'));var router=express['Router']();var fs_extra=require(_0x93ae('0x3'));var auth=require(_0x93ae('0x4'));var interaction=require(_0x93ae('0x5'));var config=require(_0x93ae('0x6'));var controller=require('./voiceContext.controller');router[_0x93ae('0x7')]('/',auth['isAuthenticated'](),controller[_0x93ae('0x8')]);router[_0x93ae('0x7')](_0x93ae('0x9'),auth[_0x93ae('0xa')](),controller[_0x93ae('0xb')]);router[_0x93ae('0xc')]('/',auth['isAuthenticated'](),controller[_0x93ae('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x93ae('0xe')]);router[_0x93ae('0xf')](_0x93ae('0x9'),auth[_0x93ae('0xa')](),controller[_0x93ae('0x10')]);module[_0x93ae('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 47da71f..e665f72 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 _0x3e74=['name','sequelize','STRING'];(function(_0x355065,_0x1c0032){var _0x23743f=function(_0x460910){while(--_0x460910){_0x355065['push'](_0x355065['shift']());}};_0x23743f(++_0x1c0032);}(_0x3e74,0x175));var _0x43e7=function(_0x3105e8,_0x2ffab2){_0x3105e8=_0x3105e8-0x0;var _0x3afe95=_0x3e74[_0x3105e8];return _0x3afe95;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e74=['name','sequelize','STRING'];(function(_0x54ba5b,_0x5b7508){var _0x5e16ac=function(_0x131aed){while(--_0x131aed){_0x54ba5b['push'](_0x54ba5b['shift']());}};_0x5e16ac(++_0x5b7508);}(_0x3e74,0x175));var _0x43e7=function(_0x2b6020,_0x3c4a46){_0x2b6020=_0x2b6020-0x0;var _0x1c00ac=_0x3e74[_0x2b6020];return _0x1c00ac;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index c1fdb01..00267ee 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 _0x6d4f=['includeAll','include','find','create','body','findAll','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','VoiceContext,\x20%s,\x20%s','result','catch','sendStatus','status','count','offset','Content-Range','json','apply','reject','save','update','get','Contexts','UserProfileResource','destroy','end','stack','name','index','map','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','type','VIRTUAL','VoiceContext','rows','show','params','rawAttributes'];(function(_0x296c73,_0x4ebf51){var _0x537616=function(_0x3e812c){while(--_0x3e812c){_0x296c73['push'](_0x296c73['shift']());}};_0x537616(++_0x4ebf51);}(_0x6d4f,0x13d));var _0xf6d4=function(_0x482214,_0x2550ff){_0x482214=_0x482214-0x0;var _0x38d0cb=_0x6d4f[_0x482214];return _0x38d0cb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf6d4('0x0'));var zipdir=require(_0xf6d4('0x1'));var jsonpatch=require(_0xf6d4('0x2'));var rp=require(_0xf6d4('0x3'));var moment=require('moment');var BPromise=require(_0xf6d4('0x4'));var Mustache=require(_0xf6d4('0x5'));var util=require(_0xf6d4('0x6'));var path=require(_0xf6d4('0x7'));var sox=require(_0xf6d4('0x8'));var csv=require(_0xf6d4('0x9'));var ejs=require(_0xf6d4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf6d4('0xb'));var crypto=require('crypto');var jsforce=require(_0xf6d4('0xc'));var deskjs=require(_0xf6d4('0xd'));var toCsv=require(_0xf6d4('0x9'));var querystring=require(_0xf6d4('0xe'));var Papa=require('papaparse');var Redis=require(_0xf6d4('0xf'));var authService=require(_0xf6d4('0x10'));var qs=require(_0xf6d4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6d4('0x12'));var logger=require('../../config/logger')(_0xf6d4('0x13'));var utils=require('../../config/utils');var config=require(_0xf6d4('0x14'));var licenseUtil=require(_0xf6d4('0x15'));var db=require(_0xf6d4('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xf6d4('0x17')][_0xf6d4('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x310a82,_0x4e64c8,_0x25e1e4,_0x481681){return new BPromise(function(_0x4d70ed,_0x44d970){var _0x4a3333=_0x481681||client;return _0x4a3333[_0xf6d4('0x19')](_0x310a82,_0x25e1e4)[_0xf6d4('0x1a')](function(_0x207e6d){logger[_0xf6d4('0x1b')]('VoiceContext,\x20%s,\x20%s',_0x4e64c8,_0xf6d4('0x1c'));logger[_0xf6d4('0x1d')](_0xf6d4('0x1e'),_0x4e64c8,_0xf6d4('0x1c'),JSON['stringify'](_0x207e6d));if(_0x207e6d[_0xf6d4('0x1f')]){if(_0x207e6d['error'][_0xf6d4('0x20')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x4e64c8,_0x207e6d['error'][_0xf6d4('0x21')]);return _0x44d970(_0x207e6d[_0xf6d4('0x1f')][_0xf6d4('0x21')]);}logger[_0xf6d4('0x1f')](_0xf6d4('0x22'),_0x4e64c8,_0x207e6d[_0xf6d4('0x1f')][_0xf6d4('0x21')]);return _0x4d70ed(_0x207e6d[_0xf6d4('0x1f')]['message']);}else{logger['info'](_0xf6d4('0x22'),_0x4e64c8,_0xf6d4('0x1c'));_0x4d70ed(_0x207e6d[_0xf6d4('0x23')][_0xf6d4('0x21')]);}})[_0xf6d4('0x24')](function(_0x384b2e){logger[_0xf6d4('0x1f')](_0xf6d4('0x22'),_0x4e64c8,_0x384b2e);_0x44d970(_0x384b2e);});});}function respondWithStatusCode(_0x27735e,_0x465065){_0x465065=_0x465065||0xcc;return function(_0x3ee1cc){if(_0x3ee1cc){return _0x27735e[_0xf6d4('0x25')](_0x465065);}return _0x27735e[_0xf6d4('0x26')](_0x465065)['end']();};}function respondWithResult(_0x36aabb,_0x1a52f9){_0x1a52f9=_0x1a52f9||0xc8;return function(_0x5587ff){if(_0x5587ff){return _0x36aabb[_0xf6d4('0x26')](_0x1a52f9)['json'](_0x5587ff);}};}function respondWithFilteredResult(_0x5747e2,_0x40a1f1){return function(_0x593881){if(_0x593881){var _0x2e323b=_0x593881[_0xf6d4('0x27')],_0xfb6a63=_0x40a1f1[_0xf6d4('0x28')],_0xc6cf54=_0x40a1f1['offset']+_0x40a1f1['limit'],_0x92af02;if(_0xc6cf54>=_0x2e323b){_0xc6cf54=_0x2e323b;_0x92af02=0xc8;}else{_0x92af02=0xce;}_0x5747e2[_0xf6d4('0x26')](_0x92af02);return _0x5747e2['set'](_0xf6d4('0x29'),_0xfb6a63+'-'+_0xc6cf54+'/'+_0x2e323b)[_0xf6d4('0x2a')](_0x593881);}return null;};}function patchUpdates(_0x20385e){return function(_0x33c642){try{jsonpatch[_0xf6d4('0x2b')](_0x33c642,_0x20385e,!![]);}catch(_0x2a441e){return BPromise[_0xf6d4('0x2c')](_0x2a441e);}return _0x33c642[_0xf6d4('0x2d')]();};}function saveUpdates(_0x34d082,_0x2da5bd){return function(_0x4d0ca6){if(_0x4d0ca6){return _0x4d0ca6[_0xf6d4('0x2e')](_0x34d082)[_0xf6d4('0x1a')](function(_0x49d335){return _0x49d335;});}return null;};}function removeEntity(_0x4a43f0,_0x34bb66){return function(_0x16988a){if(_0x16988a){return _0x16988a['destroy']()[_0xf6d4('0x1a')](function(){var _0x50d61e=_0x16988a[_0xf6d4('0x2f')]({'plain':!![]});var _0x240efa=_0xf6d4('0x30');return db[_0xf6d4('0x31')][_0xf6d4('0x32')]({'where':{'type':_0x240efa,'resourceId':_0x50d61e['id']}})['then'](function(){return _0x16988a;});})[_0xf6d4('0x1a')](function(){_0x4a43f0['status'](0xcc)[_0xf6d4('0x33')]();});}};}function handleEntityNotFound(_0xe090b6,_0x1830da){return function(_0x17b8ab){if(!_0x17b8ab){_0xe090b6[_0xf6d4('0x25')](0x194);}return _0x17b8ab;};}function handleError(_0x41a8fb,_0x2f5cb5){_0x2f5cb5=_0x2f5cb5||0x1f4;return function(_0x1148b1){logger[_0xf6d4('0x1f')](_0x1148b1[_0xf6d4('0x34')]);if(_0x1148b1['name']){delete _0x1148b1[_0xf6d4('0x35')];}_0x41a8fb['status'](_0x2f5cb5)['send'](_0x1148b1);};}exports[_0xf6d4('0x36')]=function(_0x5adca3,_0x582d18){var _0xed6f63={},_0x2d2282={},_0x40b8f3={'count':0x0,'rows':[]};var _0x256ec6=_[_0xf6d4('0x37')](db['VoiceContext']['rawAttributes'],function(_0x5ddb7f){return{'name':_0x5ddb7f['fieldName'],'type':_0x5ddb7f['type']['key']};});_0x2d2282['model']=_['map'](_0x256ec6,_0xf6d4('0x35'));_0x2d2282['query']=_[_0xf6d4('0x38')](_0x5adca3[_0xf6d4('0x39')]);_0x2d2282[_0xf6d4('0x3a')]=_['intersection'](_0x2d2282[_0xf6d4('0x3b')],_0x2d2282['query']);_0xed6f63['attributes']=_[_0xf6d4('0x3c')](_0x2d2282[_0xf6d4('0x3b')],qs[_0xf6d4('0x3d')](_0x5adca3['query'][_0xf6d4('0x3d')]));_0xed6f63[_0xf6d4('0x3e')]=_0xed6f63[_0xf6d4('0x3e')][_0xf6d4('0x3f')]?_0xed6f63[_0xf6d4('0x3e')]:_0x2d2282[_0xf6d4('0x3b')];if(!_0x5adca3[_0xf6d4('0x39')][_0xf6d4('0x40')](_0xf6d4('0x41'))){_0xed6f63[_0xf6d4('0x42')]=qs[_0xf6d4('0x42')](_0x5adca3[_0xf6d4('0x39')]['limit']);_0xed6f63['offset']=qs[_0xf6d4('0x28')](_0x5adca3[_0xf6d4('0x39')][_0xf6d4('0x28')]);}_0xed6f63['order']=qs[_0xf6d4('0x43')](_0x5adca3[_0xf6d4('0x39')]['sort']);_0xed6f63['where']=qs['filters'](_[_0xf6d4('0x44')](_0x5adca3[_0xf6d4('0x39')],_0x2d2282[_0xf6d4('0x3a')]),_0x256ec6);if(_0x5adca3[_0xf6d4('0x39')][_0xf6d4('0x45')]){_0xed6f63[_0xf6d4('0x46')]=_[_0xf6d4('0x47')](_0xed6f63[_0xf6d4('0x46')],{'$or':_[_0xf6d4('0x37')](_0x256ec6,function(_0xc6c53d){if(_0xc6c53d[_0xf6d4('0x48')]!==_0xf6d4('0x49')){var _0x444c89={};_0x444c89[_0xc6c53d[_0xf6d4('0x35')]]={'$like':'%'+_0x5adca3[_0xf6d4('0x39')][_0xf6d4('0x45')]+'%'};return _0x444c89;}})});}_0xed6f63=_[_0xf6d4('0x47')]({},_0xed6f63,_0x5adca3['options']);var _0x126aaa={'where':_0xed6f63[_0xf6d4('0x46')]};return db[_0xf6d4('0x4a')][_0xf6d4('0x27')](_0x126aaa)['then'](function(_0x4d3eff){_0x40b8f3[_0xf6d4('0x27')]=_0x4d3eff;if(_0x5adca3[_0xf6d4('0x39')]['includeAll']){_0xed6f63['include']=[{'all':!![]}];}return db[_0xf6d4('0x4a')]['findAll'](_0xed6f63);})[_0xf6d4('0x1a')](function(_0x19426a){_0x40b8f3[_0xf6d4('0x4b')]=_0x19426a;return _0x40b8f3;})[_0xf6d4('0x1a')](respondWithFilteredResult(_0x582d18,_0xed6f63))[_0xf6d4('0x24')](handleError(_0x582d18,null));};exports[_0xf6d4('0x4c')]=function(_0x343d3c,_0x4e06ed){var _0x2503e7={'raw':![],'where':{'id':_0x343d3c[_0xf6d4('0x4d')]['id']}},_0x2d6307={};_0x2d6307[_0xf6d4('0x3b')]=_[_0xf6d4('0x38')](db[_0xf6d4('0x4a')][_0xf6d4('0x4e')]);_0x2d6307['query']=_[_0xf6d4('0x38')](_0x343d3c[_0xf6d4('0x39')]);_0x2d6307[_0xf6d4('0x3a')]=_[_0xf6d4('0x3c')](_0x2d6307[_0xf6d4('0x3b')],_0x2d6307['query']);_0x2503e7['attributes']=_[_0xf6d4('0x3c')](_0x2d6307[_0xf6d4('0x3b')],qs[_0xf6d4('0x3d')](_0x343d3c[_0xf6d4('0x39')]['fields']));_0x2503e7[_0xf6d4('0x3e')]=_0x2503e7[_0xf6d4('0x3e')]['length']?_0x2503e7['attributes']:_0x2d6307['model'];if(_0x343d3c['query'][_0xf6d4('0x4f')]){_0x2503e7[_0xf6d4('0x50')]=[{'all':!![]}];}_0x2503e7=_[_0xf6d4('0x47')]({},_0x2503e7,_0x343d3c['options']);return db[_0xf6d4('0x4a')][_0xf6d4('0x51')](_0x2503e7)[_0xf6d4('0x1a')](handleEntityNotFound(_0x4e06ed,null))[_0xf6d4('0x1a')](respondWithResult(_0x4e06ed,null))[_0xf6d4('0x24')](handleError(_0x4e06ed,null));};exports[_0xf6d4('0x52')]=function(_0x1a3148,_0x24f2ff,_0x2ed35e){var _0x8ca1eb;return db['VoiceContext'][_0xf6d4('0x52')](_0x1a3148[_0xf6d4('0x53')],{'raw':!![]})[_0xf6d4('0x1a')](function(_0x23f465){_0x8ca1eb=_0x23f465;return db[_0xf6d4('0x4a')][_0xf6d4('0x54')]({'raw':!![]});})[_0xf6d4('0x1a')](function(_0x374380){var _0x53283b=fs[_0xf6d4('0x55')](path[_0xf6d4('0x56')](config[_0xf6d4('0x57')],_0xf6d4('0x58')),_0xf6d4('0x59'));var _0xb44382=ejs[_0xf6d4('0x5a')](_0x53283b,{'contexts':_0x374380||[]});fs[_0xf6d4('0x5b')](_0xf6d4('0x5c'),_0xb44382);})['then'](function(){return respondWithRpcPromise('Reload',_0xf6d4('0x52'),{'module':_0xf6d4('0x5d')});})[_0xf6d4('0x1a')](function(){var _0x14d576=_0x1a3148['user']['get']({'plain':!![]});if(!_0x14d576)throw new Error(_0xf6d4('0x5e'));if(_0x14d576['role']===_0xf6d4('0x5f')){var _0x28773d=_0x8ca1eb[_0xf6d4('0x2f')]({'plain':!![]});return db[_0xf6d4('0x60')]['find']({'where':{'name':_0xf6d4('0x30'),'userProfileId':_0x14d576[_0xf6d4('0x61')]},'raw':!![]})['then'](function(_0x136727){if(_0x136727&&_0x136727['autoAssociation']===0x0){return db[_0xf6d4('0x31')][_0xf6d4('0x52')]({'name':_0x28773d[_0xf6d4('0x35')],'resourceId':_0x28773d['id'],'type':_0x136727[_0xf6d4('0x35')],'sectionId':_0x136727['id']},{})['then'](function(){return _0x8ca1eb;});}else{return _0x8ca1eb;}})['catch'](function(_0x4ee187){logger['error'](_0xf6d4('0x62'),_0x4ee187);throw _0x4ee187;});}return _0x8ca1eb;})['then'](respondWithResult(_0x24f2ff,0xc9))['catch'](handleError(_0x24f2ff,null));};exports[_0xf6d4('0x2e')]=function(_0x4a9f5f,_0x26d511,_0x4bbb92){var _0x15d341;return db[_0xf6d4('0x4a')]['find']({'where':{'id':_0x4a9f5f['params']['id']}})[_0xf6d4('0x1a')](handleEntityNotFound(_0x26d511,null))[_0xf6d4('0x1a')](saveUpdates(_0x4a9f5f['body'],null))[_0xf6d4('0x1a')](function(_0x1ca565){if(_0x1ca565){_0x15d341=_0x1ca565;return db[_0xf6d4('0x4a')]['findAll']({'raw':!![]});}})[_0xf6d4('0x1a')](function(_0x329761){var _0x5292a3=fs[_0xf6d4('0x55')](path[_0xf6d4('0x56')](config['root'],_0xf6d4('0x58')),_0xf6d4('0x59'));var _0x1a44a2=ejs['render'](_0x5292a3,{'contexts':_0x329761||[]});fs[_0xf6d4('0x5b')](_0xf6d4('0x5c'),_0x1a44a2);})[_0xf6d4('0x1a')](function(){return respondWithRpcPromise('Reload',_0xf6d4('0x2e'),{'module':_0xf6d4('0x5d')});})[_0xf6d4('0x1a')](function(){return _0x15d341;})['then'](respondWithResult(_0x26d511,null))['catch'](handleError(_0x26d511,null));};exports['destroy']=function(_0x2f8cf2,_0x3cfc3d,_0x49ce43){var _0x2d73d8;return db[_0xf6d4('0x4a')]['find']({'where':{'id':_0x2f8cf2[_0xf6d4('0x4d')]['id']}})[_0xf6d4('0x1a')](handleEntityNotFound(_0x3cfc3d,null))[_0xf6d4('0x1a')](removeEntity(_0x3cfc3d,null))[_0xf6d4('0x1a')](function(){return db[_0xf6d4('0x4a')][_0xf6d4('0x54')]({'raw':!![]});})[_0xf6d4('0x1a')](function(_0x3b7be3){var _0x454502=fs[_0xf6d4('0x55')](path['join'](config['root'],_0xf6d4('0x58')),_0xf6d4('0x59'));var _0x3c2901=ejs['render'](_0x454502,{'contexts':_0x3b7be3});fs[_0xf6d4('0x5b')](_0xf6d4('0x5c'),_0x3c2901);return respondWithRpcPromise('Reload',_0xf6d4('0x32'),{'module':_0xf6d4('0x5d')});})[_0xf6d4('0x24')](handleError(_0x3cfc3d,null));}; \ No newline at end of file +var _0x9e06=['squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','get','stack','name','send','index','map','VoiceContext','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','create','readFileSync','join','root','utf8','render','writeFileSync','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','body','server/files/templates/context.ejs','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0x9e06,0x1a0));var _0x69e0=function(_0x3750ea,_0x544f49){_0x3750ea=_0x3750ea-0x0;var _0x37480a=_0x9e06[_0x3750ea];return _0x37480a;};'use strict';var emlformat=require(_0x69e0('0x0'));var rimraf=require(_0x69e0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x69e0('0x2'));var moment=require(_0x69e0('0x3'));var BPromise=require(_0x69e0('0x4'));var Mustache=require(_0x69e0('0x5'));var util=require(_0x69e0('0x6'));var path=require(_0x69e0('0x7'));var sox=require(_0x69e0('0x8'));var csv=require('to-csv');var ejs=require(_0x69e0('0x9'));var fs=require('fs');var fs_extra=require(_0x69e0('0xa'));var _=require(_0x69e0('0xb'));var squel=require(_0x69e0('0xc'));var crypto=require(_0x69e0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x69e0('0xe'));var toCsv=require(_0x69e0('0xf'));var querystring=require(_0x69e0('0x10'));var Papa=require(_0x69e0('0x11'));var Redis=require(_0x69e0('0x12'));var authService=require(_0x69e0('0x13'));var qs=require(_0x69e0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x69e0('0x15'))(_0x69e0('0x16'));var utils=require(_0x69e0('0x17'));var config=require(_0x69e0('0x18'));var licenseUtil=require(_0x69e0('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x69e0('0x1a'));var client=jayson[_0x69e0('0x1b')][_0x69e0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x59eda4,_0x5012f4,_0x281a4e,_0x47ca56){return new BPromise(function(_0x42201f,_0x3517f2){var _0x10435c=_0x47ca56||client;return _0x10435c[_0x69e0('0x1d')](_0x59eda4,_0x281a4e)['then'](function(_0x3d7da5){logger[_0x69e0('0x1e')](_0x69e0('0x1f'),_0x5012f4,_0x69e0('0x20'));logger['debug'](_0x69e0('0x21'),_0x5012f4,'request\x20sent',JSON['stringify'](_0x3d7da5));if(_0x3d7da5[_0x69e0('0x22')]){if(_0x3d7da5[_0x69e0('0x22')][_0x69e0('0x23')]===0x1f4){logger[_0x69e0('0x22')](_0x69e0('0x1f'),_0x5012f4,_0x3d7da5[_0x69e0('0x22')][_0x69e0('0x24')]);return _0x3517f2(_0x3d7da5[_0x69e0('0x22')][_0x69e0('0x24')]);}logger['error'](_0x69e0('0x1f'),_0x5012f4,_0x3d7da5[_0x69e0('0x22')][_0x69e0('0x24')]);return _0x42201f(_0x3d7da5[_0x69e0('0x22')]['message']);}else{logger[_0x69e0('0x1e')](_0x69e0('0x1f'),_0x5012f4,_0x69e0('0x20'));_0x42201f(_0x3d7da5['result'][_0x69e0('0x24')]);}})[_0x69e0('0x25')](function(_0x1830fb){logger[_0x69e0('0x22')]('VoiceContext,\x20%s,\x20%s',_0x5012f4,_0x1830fb);_0x3517f2(_0x1830fb);});});}function respondWithStatusCode(_0x346b5a,_0x41dd7e){_0x41dd7e=_0x41dd7e||0xcc;return function(_0x4bfd25){if(_0x4bfd25){return _0x346b5a[_0x69e0('0x26')](_0x41dd7e);}return _0x346b5a['status'](_0x41dd7e)[_0x69e0('0x27')]();};}function respondWithResult(_0x17ca9c,_0x32e519){_0x32e519=_0x32e519||0xc8;return function(_0x319bb3){if(_0x319bb3){return _0x17ca9c['status'](_0x32e519)[_0x69e0('0x28')](_0x319bb3);}};}function respondWithFilteredResult(_0x4190f9,_0x333e4c){return function(_0x43f4f7){if(_0x43f4f7){var _0x15f795=_0x43f4f7['count'],_0x454338=_0x333e4c[_0x69e0('0x29')],_0x3e00c2=_0x333e4c[_0x69e0('0x29')]+_0x333e4c[_0x69e0('0x2a')],_0x2244e6;if(_0x3e00c2>=_0x15f795){_0x3e00c2=_0x15f795;_0x2244e6=0xc8;}else{_0x2244e6=0xce;}_0x4190f9[_0x69e0('0x2b')](_0x2244e6);return _0x4190f9[_0x69e0('0x2c')](_0x69e0('0x2d'),_0x454338+'-'+_0x3e00c2+'/'+_0x15f795)[_0x69e0('0x28')](_0x43f4f7);}return null;};}function patchUpdates(_0x1db427){return function(_0x4d512c){try{jsonpatch[_0x69e0('0x2e')](_0x4d512c,_0x1db427,!![]);}catch(_0xb5f26){return BPromise[_0x69e0('0x2f')](_0xb5f26);}return _0x4d512c[_0x69e0('0x30')]();};}function saveUpdates(_0x48d784,_0x36cf04){return function(_0x121a35){if(_0x121a35){return _0x121a35[_0x69e0('0x31')](_0x48d784)[_0x69e0('0x32')](function(_0x1217f7){return _0x1217f7;});}return null;};}function removeEntity(_0x1979e1,_0x4d3c31){return function(_0x20ad7e){if(_0x20ad7e){return _0x20ad7e[_0x69e0('0x33')]()[_0x69e0('0x32')](function(){var _0x1563b9=_0x20ad7e[_0x69e0('0x34')]({'plain':!![]});var _0x3e8205='Contexts';return db['UserProfileResource'][_0x69e0('0x33')]({'where':{'type':_0x3e8205,'resourceId':_0x1563b9['id']}})[_0x69e0('0x32')](function(){return _0x20ad7e;});})[_0x69e0('0x32')](function(){_0x1979e1[_0x69e0('0x2b')](0xcc)[_0x69e0('0x27')]();});}};}function handleEntityNotFound(_0xd96034,_0xed9ba){return function(_0x238e08){if(!_0x238e08){_0xd96034[_0x69e0('0x26')](0x194);}return _0x238e08;};}function handleError(_0x1872ea,_0x339fcd){_0x339fcd=_0x339fcd||0x1f4;return function(_0x3a9b02){logger[_0x69e0('0x22')](_0x3a9b02[_0x69e0('0x35')]);if(_0x3a9b02[_0x69e0('0x36')]){delete _0x3a9b02['name'];}_0x1872ea[_0x69e0('0x2b')](_0x339fcd)[_0x69e0('0x37')](_0x3a9b02);};}exports[_0x69e0('0x38')]=function(_0x357039,_0x5e3b38){var _0x2c7f6a={},_0x567303={},_0x27d094={'count':0x0,'rows':[]};var _0x5e9966=_[_0x69e0('0x39')](db[_0x69e0('0x3a')]['rawAttributes'],function(_0x1ee86a){return{'name':_0x1ee86a[_0x69e0('0x3b')],'type':_0x1ee86a['type'][_0x69e0('0x3c')]};});_0x567303[_0x69e0('0x3d')]=_[_0x69e0('0x39')](_0x5e9966,_0x69e0('0x36'));_0x567303[_0x69e0('0x3e')]=_[_0x69e0('0x3f')](_0x357039[_0x69e0('0x3e')]);_0x567303[_0x69e0('0x40')]=_[_0x69e0('0x41')](_0x567303[_0x69e0('0x3d')],_0x567303['query']);_0x2c7f6a[_0x69e0('0x42')]=_[_0x69e0('0x41')](_0x567303[_0x69e0('0x3d')],qs['fields'](_0x357039['query'][_0x69e0('0x43')]));_0x2c7f6a[_0x69e0('0x42')]=_0x2c7f6a['attributes']['length']?_0x2c7f6a[_0x69e0('0x42')]:_0x567303[_0x69e0('0x3d')];if(!_0x357039[_0x69e0('0x3e')][_0x69e0('0x44')](_0x69e0('0x45'))){_0x2c7f6a['limit']=qs['limit'](_0x357039[_0x69e0('0x3e')][_0x69e0('0x2a')]);_0x2c7f6a[_0x69e0('0x29')]=qs[_0x69e0('0x29')](_0x357039[_0x69e0('0x3e')][_0x69e0('0x29')]);}_0x2c7f6a[_0x69e0('0x46')]=qs[_0x69e0('0x47')](_0x357039[_0x69e0('0x3e')][_0x69e0('0x47')]);_0x2c7f6a[_0x69e0('0x48')]=qs[_0x69e0('0x40')](_[_0x69e0('0x49')](_0x357039[_0x69e0('0x3e')],_0x567303[_0x69e0('0x40')]),_0x5e9966);if(_0x357039[_0x69e0('0x3e')][_0x69e0('0x4a')]){_0x2c7f6a[_0x69e0('0x48')]=_[_0x69e0('0x4b')](_0x2c7f6a[_0x69e0('0x48')],{'$or':_['map'](_0x5e9966,function(_0x3a8513){if(_0x3a8513[_0x69e0('0x4c')]!==_0x69e0('0x4d')){var _0x21ab15={};_0x21ab15[_0x3a8513[_0x69e0('0x36')]]={'$like':'%'+_0x357039['query'][_0x69e0('0x4a')]+'%'};return _0x21ab15;}})});}_0x2c7f6a=_['merge']({},_0x2c7f6a,_0x357039[_0x69e0('0x4e')]);var _0x2df54e={'where':_0x2c7f6a[_0x69e0('0x48')]};return db['VoiceContext'][_0x69e0('0x4f')](_0x2df54e)[_0x69e0('0x32')](function(_0x2f14e0){_0x27d094[_0x69e0('0x4f')]=_0x2f14e0;if(_0x357039['query'][_0x69e0('0x50')]){_0x2c7f6a[_0x69e0('0x51')]=[{'all':!![]}];}return db[_0x69e0('0x3a')][_0x69e0('0x52')](_0x2c7f6a);})['then'](function(_0x458104){_0x27d094[_0x69e0('0x53')]=_0x458104;return _0x27d094;})['then'](respondWithFilteredResult(_0x5e3b38,_0x2c7f6a))[_0x69e0('0x25')](handleError(_0x5e3b38,null));};exports[_0x69e0('0x54')]=function(_0x33629f,_0x40a434){var _0x28dc20={'raw':![],'where':{'id':_0x33629f[_0x69e0('0x55')]['id']}},_0x139af4={};_0x139af4[_0x69e0('0x3d')]=_[_0x69e0('0x3f')](db['VoiceContext'][_0x69e0('0x56')]);_0x139af4['query']=_[_0x69e0('0x3f')](_0x33629f[_0x69e0('0x3e')]);_0x139af4[_0x69e0('0x40')]=_[_0x69e0('0x41')](_0x139af4['model'],_0x139af4[_0x69e0('0x3e')]);_0x28dc20[_0x69e0('0x42')]=_[_0x69e0('0x41')](_0x139af4[_0x69e0('0x3d')],qs[_0x69e0('0x43')](_0x33629f['query']['fields']));_0x28dc20[_0x69e0('0x42')]=_0x28dc20[_0x69e0('0x42')]['length']?_0x28dc20[_0x69e0('0x42')]:_0x139af4[_0x69e0('0x3d')];if(_0x33629f[_0x69e0('0x3e')][_0x69e0('0x50')]){_0x28dc20['include']=[{'all':!![]}];}_0x28dc20=_[_0x69e0('0x4b')]({},_0x28dc20,_0x33629f[_0x69e0('0x4e')]);return db[_0x69e0('0x3a')]['find'](_0x28dc20)[_0x69e0('0x32')](handleEntityNotFound(_0x40a434,null))[_0x69e0('0x32')](respondWithResult(_0x40a434,null))[_0x69e0('0x25')](handleError(_0x40a434,null));};exports[_0x69e0('0x57')]=function(_0x2f3805,_0x4b3250,_0x232d5d){var _0x1e6dc8;return db[_0x69e0('0x3a')][_0x69e0('0x57')](_0x2f3805['body'],{'raw':!![]})['then'](function(_0x52f8e0){_0x1e6dc8=_0x52f8e0;return db[_0x69e0('0x3a')]['findAll']({'raw':!![]});})['then'](function(_0x139a84){var _0x2274d7=fs[_0x69e0('0x58')](path[_0x69e0('0x59')](config[_0x69e0('0x5a')],'server/files/templates/context.ejs'),_0x69e0('0x5b'));var _0x1b3290=ejs[_0x69e0('0x5c')](_0x2274d7,{'contexts':_0x139a84||[]});fs[_0x69e0('0x5d')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x1b3290);})['then'](function(){return respondWithRpcPromise(_0x69e0('0x5e'),'create',{'module':_0x69e0('0x5f')});})[_0x69e0('0x32')](function(){var _0x4539a4=_0x2f3805['user'][_0x69e0('0x34')]({'plain':!![]});if(!_0x4539a4)throw new Error(_0x69e0('0x60'));if(_0x4539a4[_0x69e0('0x61')]===_0x69e0('0x62')){var _0x1fdb92=_0x1e6dc8[_0x69e0('0x34')]({'plain':!![]});return db[_0x69e0('0x63')]['find']({'where':{'name':'Contexts','userProfileId':_0x4539a4[_0x69e0('0x64')]},'raw':!![]})[_0x69e0('0x32')](function(_0x247089){if(_0x247089&&_0x247089['autoAssociation']===0x0){return db[_0x69e0('0x65')][_0x69e0('0x57')]({'name':_0x1fdb92[_0x69e0('0x36')],'resourceId':_0x1fdb92['id'],'type':_0x247089[_0x69e0('0x36')],'sectionId':_0x247089['id']},{})[_0x69e0('0x32')](function(){return _0x1e6dc8;});}else{return _0x1e6dc8;}})[_0x69e0('0x25')](function(_0x47fcb6){logger[_0x69e0('0x22')](_0x69e0('0x66'),_0x47fcb6);throw _0x47fcb6;});}return _0x1e6dc8;})[_0x69e0('0x32')](respondWithResult(_0x4b3250,0xc9))['catch'](handleError(_0x4b3250,null));};exports[_0x69e0('0x31')]=function(_0x569016,_0x470b99,_0x30c91d){var _0x30d90c;return db['VoiceContext'][_0x69e0('0x67')]({'where':{'id':_0x569016['params']['id']}})[_0x69e0('0x32')](handleEntityNotFound(_0x470b99,null))[_0x69e0('0x32')](saveUpdates(_0x569016[_0x69e0('0x68')],null))[_0x69e0('0x32')](function(_0x7e66){if(_0x7e66){_0x30d90c=_0x7e66;return db[_0x69e0('0x3a')][_0x69e0('0x52')]({'raw':!![]});}})[_0x69e0('0x32')](function(_0x1624a9){var _0x4af1eb=fs[_0x69e0('0x58')](path[_0x69e0('0x59')](config[_0x69e0('0x5a')],_0x69e0('0x69')),_0x69e0('0x5b'));var _0xca4aeb=ejs[_0x69e0('0x5c')](_0x4af1eb,{'contexts':_0x1624a9||[]});fs[_0x69e0('0x5d')](_0x69e0('0x6a'),_0xca4aeb);})[_0x69e0('0x32')](function(){return respondWithRpcPromise('Reload',_0x69e0('0x31'),{'module':'chan_sip.so'});})[_0x69e0('0x32')](function(){return _0x30d90c;})[_0x69e0('0x32')](respondWithResult(_0x470b99,null))[_0x69e0('0x25')](handleError(_0x470b99,null));};exports[_0x69e0('0x33')]=function(_0x5144bb,_0x42c273,_0x83205a){var _0x44fc9b;return db[_0x69e0('0x3a')][_0x69e0('0x67')]({'where':{'id':_0x5144bb[_0x69e0('0x55')]['id']}})['then'](handleEntityNotFound(_0x42c273,null))['then'](removeEntity(_0x42c273,null))[_0x69e0('0x32')](function(){return db[_0x69e0('0x3a')][_0x69e0('0x52')]({'raw':!![]});})['then'](function(_0x1f149b){var _0x53b5cc=fs[_0x69e0('0x58')](path[_0x69e0('0x59')](config[_0x69e0('0x5a')],'server/files/templates/context.ejs'),_0x69e0('0x5b'));var _0x574fe1=ejs[_0x69e0('0x5c')](_0x53b5cc,{'contexts':_0x1f149b});fs[_0x69e0('0x5d')](_0x69e0('0x6a'),_0x574fe1);return respondWithRpcPromise(_0x69e0('0x5e'),_0x69e0('0x33'),{'module':_0x69e0('0x5f')});})['catch'](handleError(_0x42c273,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 8570cc8..eb8338c 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 _0x46c5=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x46c5,0x118));var _0x546c=function(_0x117d90,_0x143bab){_0x117d90=_0x117d90-0x0;var _0x143a1b=_0x46c5[_0x117d90];return _0x143a1b;};'use strict';var _=require(_0x546c('0x0'));var util=require(_0x546c('0x1'));var logger=require(_0x546c('0x2'))(_0x546c('0x3'));var moment=require(_0x546c('0x4'));var BPromise=require(_0x546c('0x5'));var rp=require(_0x546c('0x6'));var fs=require('fs');var path=require(_0x546c('0x7'));var rimraf=require(_0x546c('0x8'));var config=require(_0x546c('0x9'));var attributes=require(_0x546c('0xa'));module[_0x546c('0xb')]=function(_0x28c1a5,_0x3642fd){return _0x28c1a5[_0x546c('0xc')](_0x546c('0xd'),attributes,{'tableName':_0x546c('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xccd5=['./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xccd5,0x17e));var _0x5ccd=function(_0x3dc53b,_0x5271aa){_0x3dc53b=_0x3dc53b-0x0;var _0xe99dcb=_0xccd5[_0x3dc53b];return _0xe99dcb;};'use strict';var _=require(_0x5ccd('0x0'));var util=require(_0x5ccd('0x1'));var logger=require(_0x5ccd('0x2'))(_0x5ccd('0x3'));var moment=require(_0x5ccd('0x4'));var BPromise=require(_0x5ccd('0x5'));var rp=require(_0x5ccd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5ccd('0x7'));var attributes=require(_0x5ccd('0x8'));module[_0x5ccd('0x9')]=function(_0x5bf5d7,_0x3323fd){return _0x5bf5d7[_0x5ccd('0xa')](_0x5ccd('0xb'),attributes,{'tableName':_0x5ccd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 6c6bdd5..7809df9 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 _0xb0c5=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','randomstring'];(function(_0x818500,_0xe7620c){var _0x342023=function(_0x17c939){while(--_0x17c939){_0x818500['push'](_0x818500['shift']());}};_0x342023(++_0xe7620c);}(_0xb0c5,0xfa));var _0x5b0c=function(_0x2cb689,_0x59b4de){_0x2cb689=_0x2cb689-0x0;var _0x480caa=_0xb0c5[_0x2cb689];return _0x480caa;};'use strict';var _=require(_0x5b0c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5b0c('0x1'));var fs=require('fs');var Redis=require(_0x5b0c('0x2'));var db=require(_0x5b0c('0x3'))['db'];var utils=require(_0x5b0c('0x4'));var logger=require(_0x5b0c('0x5'))(_0x5b0c('0x6'));var config=require(_0x5b0c('0x7'));var jayson=require(_0x5b0c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5b84a2,_0x294cf9,_0x28ea40){return new BPromise(function(_0x5162f8,_0x282a90){return client['request'](_0x5b84a2,_0x28ea40)[_0x5b0c('0x9')](function(_0x139649){logger['info'](_0x5b0c('0xa'),_0x294cf9,_0x5b0c('0xb'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x294cf9,_0x5b0c('0xb'),JSON[_0x5b0c('0xc')](_0x139649));if(_0x139649[_0x5b0c('0xd')]){if(_0x139649[_0x5b0c('0xd')][_0x5b0c('0xe')]===0x1f4){logger[_0x5b0c('0xd')](_0x5b0c('0xa'),_0x294cf9,_0x139649[_0x5b0c('0xd')][_0x5b0c('0xf')]);return _0x282a90(_0x139649['error'][_0x5b0c('0xf')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x294cf9,_0x139649[_0x5b0c('0xd')]['message']);return _0x5162f8(_0x139649[_0x5b0c('0xd')][_0x5b0c('0xf')]);}else{logger['info'](_0x5b0c('0xa'),_0x294cf9,_0x5b0c('0xb'));_0x5162f8(_0x139649[_0x5b0c('0x10')][_0x5b0c('0xf')]);}})[_0x5b0c('0x11')](function(_0x2bf76){logger[_0x5b0c('0xd')]('VoiceContext,\x20%s,\x20%s',_0x294cf9,_0x2bf76);_0x282a90(_0x2bf76);});});} \ No newline at end of file +var _0xf544=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x1ed91a,_0x5eaafb){var _0x47a652=function(_0x414621){while(--_0x414621){_0x1ed91a['push'](_0x1ed91a['shift']());}};_0x47a652(++_0x5eaafb);}(_0xf544,0x99));var _0x4f54=function(_0x37d0bc,_0x109b96){_0x37d0bc=_0x37d0bc-0x0;var _0x170e60=_0xf544[_0x37d0bc];return _0x170e60;};'use strict';var _=require(_0x4f54('0x0'));var util=require('util');var moment=require(_0x4f54('0x1'));var BPromise=require(_0x4f54('0x2'));var rs=require(_0x4f54('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f54('0x4'))['db'];var utils=require(_0x4f54('0x5'));var logger=require(_0x4f54('0x6'))(_0x4f54('0x7'));var config=require(_0x4f54('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4f54('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a0630,_0x2fd179,_0x128f2e){return new BPromise(function(_0x24d805,_0x3e935b){return client[_0x4f54('0xa')](_0x1a0630,_0x128f2e)[_0x4f54('0xb')](function(_0x1fd26c){logger[_0x4f54('0xc')](_0x4f54('0xd'),_0x2fd179,_0x4f54('0xe'));logger[_0x4f54('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x2fd179,_0x4f54('0xe'),JSON[_0x4f54('0x10')](_0x1fd26c));if(_0x1fd26c[_0x4f54('0x11')]){if(_0x1fd26c[_0x4f54('0x11')][_0x4f54('0x12')]===0x1f4){logger[_0x4f54('0x11')](_0x4f54('0xd'),_0x2fd179,_0x1fd26c[_0x4f54('0x11')]['message']);return _0x3e935b(_0x1fd26c['error'][_0x4f54('0x13')]);}logger[_0x4f54('0x11')](_0x4f54('0xd'),_0x2fd179,_0x1fd26c[_0x4f54('0x11')]['message']);return _0x24d805(_0x1fd26c['error'][_0x4f54('0x13')]);}else{logger[_0x4f54('0xc')]('VoiceContext,\x20%s,\x20%s',_0x2fd179,_0x4f54('0xe'));_0x24d805(_0x1fd26c[_0x4f54('0x14')][_0x4f54('0x13')]);}})[_0x4f54('0x15')](function(_0x268008){logger[_0x4f54('0x11')](_0x4f54('0xd'),_0x2fd179,_0x268008);_0x3e935b(_0x268008);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 53a5638..de50339 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 _0xc978=['/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x44e72e,_0x164d55){var _0xdf042c=function(_0x38f055){while(--_0x38f055){_0x44e72e['push'](_0x44e72e['shift']());}};_0xdf042c(++_0x164d55);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var path=require(_0x8c97('0x2'));var timeout=require(_0x8c97('0x3'));var express=require(_0x8c97('0x4'));var router=express[_0x8c97('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8c97('0x6'));var interaction=require(_0x8c97('0x7'));var config=require(_0x8c97('0x8'));var controller=require(_0x8c97('0x9'));router[_0x8c97('0xa')]('/',auth[_0x8c97('0xb')](),controller[_0x8c97('0xc')]);router['get'](_0x8c97('0xd'),auth[_0x8c97('0xb')](),controller[_0x8c97('0xe')]);router[_0x8c97('0xa')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x10')]);router['post']('/',auth[_0x8c97('0xb')](),controller[_0x8c97('0x11')]);router[_0x8c97('0x12')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x13')]);router[_0x8c97('0x14')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller['destroy']);module[_0x8c97('0x15')]=router; \ No newline at end of file +var _0x2123=['../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x572c23,_0x148587){var _0x29211b=function(_0x5be58a){while(--_0x5be58a){_0x572c23['push'](_0x572c23['shift']());}};_0x29211b(++_0x148587);}(_0x2123,0x190));var _0x3212=function(_0x1f724e,_0x1c613a){_0x1f724e=_0x1f724e-0x0;var _0x3e06c4=_0x2123[_0x1f724e];return _0x3e06c4;};'use strict';var multer=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var path=require(_0x3212('0x2'));var timeout=require(_0x3212('0x3'));var express=require(_0x3212('0x4'));var router=express[_0x3212('0x5')]();var fs_extra=require(_0x3212('0x6'));var auth=require(_0x3212('0x7'));var interaction=require(_0x3212('0x8'));var config=require(_0x3212('0x9'));var controller=require(_0x3212('0xa'));router[_0x3212('0xb')]('/',auth['isAuthenticated'](),controller[_0x3212('0xc')]);router[_0x3212('0xb')](_0x3212('0xd'),auth['isAuthenticated'](),controller[_0x3212('0xe')]);router['get'](_0x3212('0xf'),auth[_0x3212('0x10')](),controller[_0x3212('0x11')]);router[_0x3212('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3212('0x13')](_0x3212('0xf'),auth[_0x3212('0x10')](),controller[_0x3212('0x14')]);router[_0x3212('0x15')](_0x3212('0xf'),auth[_0x3212('0x10')](),controller[_0x3212('0x16')]);module[_0x3212('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index c6f0506..004ee20 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 _0x6862=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x6862,0x115));var _0x2686=function(_0x2faa73,_0x5f248a){_0x2faa73=_0x2faa73-0x0;var _0x154814=_0x6862[_0x2faa73];return _0x154814;};'use strict';var Sequelize=require(_0x2686('0x0'));module[_0x2686('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2686('0x2')]},'channelstate':{'type':Sequelize[_0x2686('0x3')]},'channelstatedesc':{'type':Sequelize[_0x2686('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2686('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x2686('0x2')]},'priority':{'type':Sequelize[_0x2686('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x2686('0x2')]},'destchannel':{'type':Sequelize[_0x2686('0x2')]},'destchannelstate':{'type':Sequelize[_0x2686('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x2686('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x2686('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x2686('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x2686('0x2')]},'destaccountcode':{'type':Sequelize[_0x2686('0x2')]},'destcontext':{'type':Sequelize[_0x2686('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x2686('0x3')]},'destuniqueid':{'type':Sequelize[_0x2686('0x2')]},'destlinkedid':{'type':Sequelize[_0x2686('0x2')]},'dialstring':{'type':Sequelize[_0x2686('0x2')]},'dialstatus':{'type':Sequelize[_0x2686('0x2')]},'starttime':{'type':Sequelize[_0x2686('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x2686('0x4')]},'lastevent':{'type':Sequelize[_0x2686('0x2')],'comment':_0x2686('0x5')},'routeId':{'type':Sequelize[_0x2686('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x99f4=['sequelize','exports','STRING','INTEGER','DATE'];(function(_0x189b1d,_0x1df005){var _0x3d8ab0=function(_0x59a27f){while(--_0x59a27f){_0x189b1d['push'](_0x189b1d['shift']());}};_0x3d8ab0(++_0x1df005);}(_0x99f4,0x154));var _0x499f=function(_0x93d86c,_0x54e7ee){_0x93d86c=_0x93d86c-0x0;var _0x58e497=_0x99f4[_0x93d86c];return _0x58e497;};'use strict';var Sequelize=require(_0x499f('0x0'));module[_0x499f('0x1')]={'privilege':{'type':Sequelize[_0x499f('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x499f('0x2')]},'calleridnum':{'type':Sequelize[_0x499f('0x2')]},'calleridname':{'type':Sequelize[_0x499f('0x2')]},'connectedlinenum':{'type':Sequelize[_0x499f('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x499f('0x2')]},'accountcode':{'type':Sequelize[_0x499f('0x2')]},'context':{'type':Sequelize[_0x499f('0x2')]},'exten':{'type':Sequelize[_0x499f('0x2')]},'priority':{'type':Sequelize[_0x499f('0x3')]},'uniqueid':{'type':Sequelize[_0x499f('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x499f('0x2')]},'destchannelstate':{'type':Sequelize[_0x499f('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x499f('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x499f('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x499f('0x2')]},'destlanguage':{'type':Sequelize[_0x499f('0x2')]},'destaccountcode':{'type':Sequelize[_0x499f('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x499f('0x2')]},'destpriority':{'type':Sequelize[_0x499f('0x3')]},'destuniqueid':{'type':Sequelize[_0x499f('0x2')]},'destlinkedid':{'type':Sequelize[_0x499f('0x2')]},'dialstring':{'type':Sequelize[_0x499f('0x2')]},'dialstatus':{'type':Sequelize[_0x499f('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x499f('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x499f('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x499f('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index bb8ea90..9b68ba7 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 _0x0288=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','rows','catch','show','include','find','create','body','params','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','apply','reject','save','update','then','error','stack','index','VoiceDialReport','rawAttributes','fieldName','type','model','map','name'];(function(_0x5e5218,_0x4226ef){var _0x2dcd35=function(_0x11049f){while(--_0x11049f){_0x5e5218['push'](_0x5e5218['shift']());}};_0x2dcd35(++_0x4226ef);}(_0x0288,0x182));var _0x8028=function(_0x5ba446,_0x399d24){_0x5ba446=_0x5ba446-0x0;var _0x30c3e0=_0x0288[_0x5ba446];return _0x30c3e0;};'use strict';var emlformat=require(_0x8028('0x0'));var rimraf=require(_0x8028('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8028('0x2'));var rp=require(_0x8028('0x3'));var moment=require(_0x8028('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8028('0x5'));var util=require(_0x8028('0x6'));var path=require(_0x8028('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8028('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8028('0x9'));var crypto=require(_0x8028('0xa'));var jsforce=require(_0x8028('0xb'));var deskjs=require(_0x8028('0xc'));var toCsv=require(_0x8028('0xd'));var querystring=require(_0x8028('0xe'));var Papa=require(_0x8028('0xf'));var Redis=require('ioredis');var authService=require(_0x8028('0x10'));var qs=require(_0x8028('0x11'));var as=require(_0x8028('0x12'));var hardwareService=require(_0x8028('0x13'));var logger=require(_0x8028('0x14'))(_0x8028('0x15'));var utils=require(_0x8028('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8028('0x17'))['db'];function respondWithStatusCode(_0x18baf9,_0x5eb104){_0x5eb104=_0x5eb104||0xcc;return function(_0x2d4eec){if(_0x2d4eec){return _0x18baf9[_0x8028('0x18')](_0x5eb104);}return _0x18baf9[_0x8028('0x19')](_0x5eb104)[_0x8028('0x1a')]();};}function respondWithResult(_0x136221,_0x4c63d9){_0x4c63d9=_0x4c63d9||0xc8;return function(_0x43222a){if(_0x43222a){return _0x136221[_0x8028('0x19')](_0x4c63d9)['json'](_0x43222a);}};}function respondWithFilteredResult(_0x35a6a1,_0x18b1a){return function(_0x2326ac){if(_0x2326ac){var _0x1c9c7b=_0x2326ac[_0x8028('0x1b')],_0x19a07f=_0x18b1a[_0x8028('0x1c')],_0x26d1a2=_0x18b1a[_0x8028('0x1c')]+_0x18b1a[_0x8028('0x1d')],_0xc94efe;if(_0x26d1a2>=_0x1c9c7b){_0x26d1a2=_0x1c9c7b;_0xc94efe=0xc8;}else{_0xc94efe=0xce;}_0x35a6a1[_0x8028('0x19')](_0xc94efe);return _0x35a6a1[_0x8028('0x1e')]('Content-Range',_0x19a07f+'-'+_0x26d1a2+'/'+_0x1c9c7b)['json'](_0x2326ac);}return null;};}function patchUpdates(_0x10bf10){return function(_0x20fce2){try{jsonpatch[_0x8028('0x1f')](_0x20fce2,_0x10bf10,!![]);}catch(_0x5e0650){return BPromise[_0x8028('0x20')](_0x5e0650);}return _0x20fce2[_0x8028('0x21')]();};}function saveUpdates(_0x2349a5,_0x4f78f2){return function(_0x2c9ef6){if(_0x2c9ef6){return _0x2c9ef6[_0x8028('0x22')](_0x2349a5)[_0x8028('0x23')](function(_0x2cd972){return _0x2cd972;});}return null;};}function removeEntity(_0x1b9ee2,_0x17b13d){return function(_0x36687b){if(_0x36687b){return _0x36687b['destroy']()[_0x8028('0x23')](function(){_0x1b9ee2[_0x8028('0x19')](0xcc)[_0x8028('0x1a')]();});}};}function handleEntityNotFound(_0x53e8c2,_0x44b16f){return function(_0xb73de0){if(!_0xb73de0){_0x53e8c2[_0x8028('0x18')](0x194);}return _0xb73de0;};}function handleError(_0x465321,_0x167330){_0x167330=_0x167330||0x1f4;return function(_0x3d2b32){logger[_0x8028('0x24')](_0x3d2b32[_0x8028('0x25')]);if(_0x3d2b32['name']){delete _0x3d2b32['name'];}_0x465321[_0x8028('0x19')](_0x167330)['send'](_0x3d2b32);};}exports[_0x8028('0x26')]=function(_0x24281e,_0x4eafb5){var _0x2a3aa2={},_0x3d99a0={},_0x5aeb9c={'count':0x0,'rows':[]};var _0x4f90e3=_['map'](db[_0x8028('0x27')][_0x8028('0x28')],function(_0x30cde5){return{'name':_0x30cde5[_0x8028('0x29')],'type':_0x30cde5[_0x8028('0x2a')]['key']};});_0x3d99a0[_0x8028('0x2b')]=_[_0x8028('0x2c')](_0x4f90e3,_0x8028('0x2d'));_0x3d99a0[_0x8028('0x2e')]=_[_0x8028('0x2f')](_0x24281e['query']);_0x3d99a0[_0x8028('0x30')]=_[_0x8028('0x31')](_0x3d99a0[_0x8028('0x2b')],_0x3d99a0[_0x8028('0x2e')]);_0x2a3aa2[_0x8028('0x32')]=_['intersection'](_0x3d99a0[_0x8028('0x2b')],qs[_0x8028('0x33')](_0x24281e[_0x8028('0x2e')]['fields']));_0x2a3aa2[_0x8028('0x32')]=_0x2a3aa2[_0x8028('0x32')][_0x8028('0x34')]?_0x2a3aa2[_0x8028('0x32')]:_0x3d99a0[_0x8028('0x2b')];if(!_0x24281e[_0x8028('0x2e')][_0x8028('0x35')](_0x8028('0x36'))){_0x2a3aa2[_0x8028('0x1d')]=qs[_0x8028('0x1d')](_0x24281e['query'][_0x8028('0x1d')]);_0x2a3aa2['offset']=qs['offset'](_0x24281e[_0x8028('0x2e')]['offset']);}_0x2a3aa2[_0x8028('0x37')]=qs['sort'](_0x24281e['query'][_0x8028('0x38')]);_0x2a3aa2['where']=qs[_0x8028('0x30')](_[_0x8028('0x39')](_0x24281e[_0x8028('0x2e')],_0x3d99a0['filters']),_0x4f90e3);if(_0x24281e[_0x8028('0x2e')][_0x8028('0x3a')]){_0x2a3aa2[_0x8028('0x3b')]=_['merge'](_0x2a3aa2['where'],{'$or':_[_0x8028('0x2c')](_0x4f90e3,function(_0x37e2f6){if(_0x37e2f6['type']!=='VIRTUAL'){var _0x5920cf={};_0x5920cf[_0x37e2f6[_0x8028('0x2d')]]={'$like':'%'+_0x24281e[_0x8028('0x2e')]['filter']+'%'};return _0x5920cf;}})});}_0x2a3aa2=_[_0x8028('0x3c')]({},_0x2a3aa2,_0x24281e[_0x8028('0x3d')]);var _0x45a6c2={'where':_0x2a3aa2[_0x8028('0x3b')]};return db['VoiceDialReport'][_0x8028('0x1b')](_0x45a6c2)[_0x8028('0x23')](function(_0x5030a8){_0x5aeb9c[_0x8028('0x1b')]=_0x5030a8;if(_0x24281e[_0x8028('0x2e')][_0x8028('0x3e')]){_0x2a3aa2['include']=[{'all':!![]}];}return db[_0x8028('0x27')]['findAll'](_0x2a3aa2);})[_0x8028('0x23')](function(_0x774fea){_0x5aeb9c[_0x8028('0x3f')]=_0x774fea;return _0x5aeb9c;})['then'](respondWithFilteredResult(_0x4eafb5,_0x2a3aa2))[_0x8028('0x40')](handleError(_0x4eafb5,null));};exports[_0x8028('0x41')]=function(_0x568b76,_0x153579){var _0x2b090a={'raw':!![],'where':{'id':_0x568b76['params']['id']}},_0x11ecaa={};_0x11ecaa[_0x8028('0x2b')]=_[_0x8028('0x2f')](db[_0x8028('0x27')][_0x8028('0x28')]);_0x11ecaa[_0x8028('0x2e')]=_['keys'](_0x568b76['query']);_0x11ecaa['filters']=_['intersection'](_0x11ecaa['model'],_0x11ecaa[_0x8028('0x2e')]);_0x2b090a[_0x8028('0x32')]=_['intersection'](_0x11ecaa[_0x8028('0x2b')],qs[_0x8028('0x33')](_0x568b76[_0x8028('0x2e')]['fields']));_0x2b090a[_0x8028('0x32')]=_0x2b090a[_0x8028('0x32')]['length']?_0x2b090a[_0x8028('0x32')]:_0x11ecaa[_0x8028('0x2b')];if(_0x568b76[_0x8028('0x2e')]['includeAll']){_0x2b090a[_0x8028('0x42')]=[{'all':!![]}];}_0x2b090a=_[_0x8028('0x3c')]({},_0x2b090a,_0x568b76['options']);return db['VoiceDialReport'][_0x8028('0x43')](_0x2b090a)[_0x8028('0x23')](handleEntityNotFound(_0x153579,null))[_0x8028('0x23')](respondWithResult(_0x153579,null))['catch'](handleError(_0x153579,null));};exports[_0x8028('0x44')]=function(_0x7ace41,_0x3c8c6b){return db[_0x8028('0x27')][_0x8028('0x44')](_0x7ace41['body'],{})[_0x8028('0x23')](respondWithResult(_0x3c8c6b,0xc9))[_0x8028('0x40')](handleError(_0x3c8c6b,null));};exports[_0x8028('0x22')]=function(_0x4f7bfd,_0xaa98da){if(_0x4f7bfd[_0x8028('0x45')]['id']){delete _0x4f7bfd[_0x8028('0x45')]['id'];}return db[_0x8028('0x27')]['find']({'where':{'id':_0x4f7bfd[_0x8028('0x46')]['id']}})[_0x8028('0x23')](handleEntityNotFound(_0xaa98da,null))[_0x8028('0x23')](saveUpdates(_0x4f7bfd['body'],null))['then'](respondWithResult(_0xaa98da,null))[_0x8028('0x40')](handleError(_0xaa98da,null));};exports[_0x8028('0x47')]=function(_0x298e10,_0x2c3de1){return db[_0x8028('0x27')][_0x8028('0x43')]({'where':{'id':_0x298e10[_0x8028('0x46')]['id']}})[_0x8028('0x23')](handleEntityNotFound(_0x2c3de1,null))[_0x8028('0x23')](removeEntity(_0x2c3de1,null))['catch'](handleError(_0x2c3de1,null));};exports['describe']=function(_0x13fabf,_0xaa21e0){return db['VoiceDialReport']['describe']()[_0x8028('0x23')](respondWithResult(_0xaa21e0,null))[_0x8028('0x40')](handleError(_0xaa21e0,null));}; \ No newline at end of file +var _0x60e0=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','stack','name','VoiceDialReport','rawAttributes','type','model','map','keys','query','filters','intersection','attributes','fields'];(function(_0xb0de07,_0x3ca2a0){var _0x4633d8=function(_0x2368e0){while(--_0x2368e0){_0xb0de07['push'](_0xb0de07['shift']());}};_0x4633d8(++_0x3ca2a0);}(_0x60e0,0x174));var _0x060e=function(_0x3c9631,_0x16d2fd){_0x3c9631=_0x3c9631-0x0;var _0x4eef72=_0x60e0[_0x3c9631];return _0x4eef72;};'use strict';var emlformat=require(_0x060e('0x0'));var rimraf=require(_0x060e('0x1'));var zipdir=require(_0x060e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x060e('0x3'));var moment=require(_0x060e('0x4'));var BPromise=require(_0x060e('0x5'));var Mustache=require(_0x060e('0x6'));var util=require(_0x060e('0x7'));var path=require(_0x060e('0x8'));var sox=require('sox');var csv=require(_0x060e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x060e('0xa'));var squel=require(_0x060e('0xb'));var crypto=require(_0x060e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x060e('0xd'));var toCsv=require(_0x060e('0x9'));var querystring=require(_0x060e('0xe'));var Papa=require('papaparse');var Redis=require(_0x060e('0xf'));var authService=require(_0x060e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x060e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x060e('0x12'))('api');var utils=require(_0x060e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x060e('0x14'));var db=require(_0x060e('0x15'))['db'];function respondWithStatusCode(_0x3a1ddb,_0xf48251){_0xf48251=_0xf48251||0xcc;return function(_0x2d453c){if(_0x2d453c){return _0x3a1ddb[_0x060e('0x16')](_0xf48251);}return _0x3a1ddb[_0x060e('0x17')](_0xf48251)[_0x060e('0x18')]();};}function respondWithResult(_0x3a12b4,_0x28f65d){_0x28f65d=_0x28f65d||0xc8;return function(_0xfde5f9){if(_0xfde5f9){return _0x3a12b4[_0x060e('0x17')](_0x28f65d)[_0x060e('0x19')](_0xfde5f9);}};}function respondWithFilteredResult(_0x4d0074,_0xaaf4a0){return function(_0x6cbc02){if(_0x6cbc02){var _0x4b81e=_0x6cbc02[_0x060e('0x1a')],_0x12a9fb=_0xaaf4a0[_0x060e('0x1b')],_0x3039ff=_0xaaf4a0['offset']+_0xaaf4a0[_0x060e('0x1c')],_0x995436;if(_0x3039ff>=_0x4b81e){_0x3039ff=_0x4b81e;_0x995436=0xc8;}else{_0x995436=0xce;}_0x4d0074['status'](_0x995436);return _0x4d0074[_0x060e('0x1d')]('Content-Range',_0x12a9fb+'-'+_0x3039ff+'/'+_0x4b81e)[_0x060e('0x19')](_0x6cbc02);}return null;};}function patchUpdates(_0x2c1ded){return function(_0x432ca2){try{jsonpatch[_0x060e('0x1e')](_0x432ca2,_0x2c1ded,!![]);}catch(_0x1707d4){return BPromise[_0x060e('0x1f')](_0x1707d4);}return _0x432ca2[_0x060e('0x20')]();};}function saveUpdates(_0x16c94d,_0xd46e74){return function(_0x9fb2ab){if(_0x9fb2ab){return _0x9fb2ab[_0x060e('0x21')](_0x16c94d)[_0x060e('0x22')](function(_0x4f3419){return _0x4f3419;});}return null;};}function removeEntity(_0x3dd11b,_0x30eaf8){return function(_0x5d427f){if(_0x5d427f){return _0x5d427f['destroy']()['then'](function(){_0x3dd11b[_0x060e('0x17')](0xcc)[_0x060e('0x18')]();});}};}function handleEntityNotFound(_0x23de18,_0x336e16){return function(_0x27ab83){if(!_0x27ab83){_0x23de18[_0x060e('0x16')](0x194);}return _0x27ab83;};}function handleError(_0x4f5f4a,_0x9ab239){_0x9ab239=_0x9ab239||0x1f4;return function(_0xaa477a){logger['error'](_0xaa477a[_0x060e('0x23')]);if(_0xaa477a[_0x060e('0x24')]){delete _0xaa477a[_0x060e('0x24')];}_0x4f5f4a[_0x060e('0x17')](_0x9ab239)['send'](_0xaa477a);};}exports['index']=function(_0x23f35f,_0x4984d8){var _0x45f2ca={},_0xacd490={},_0x127c8e={'count':0x0,'rows':[]};var _0x1afa68=_['map'](db[_0x060e('0x25')][_0x060e('0x26')],function(_0x1bcf7d){return{'name':_0x1bcf7d['fieldName'],'type':_0x1bcf7d[_0x060e('0x27')]['key']};});_0xacd490[_0x060e('0x28')]=_[_0x060e('0x29')](_0x1afa68,'name');_0xacd490['query']=_[_0x060e('0x2a')](_0x23f35f[_0x060e('0x2b')]);_0xacd490[_0x060e('0x2c')]=_[_0x060e('0x2d')](_0xacd490[_0x060e('0x28')],_0xacd490[_0x060e('0x2b')]);_0x45f2ca[_0x060e('0x2e')]=_[_0x060e('0x2d')](_0xacd490[_0x060e('0x28')],qs[_0x060e('0x2f')](_0x23f35f[_0x060e('0x2b')][_0x060e('0x2f')]));_0x45f2ca['attributes']=_0x45f2ca['attributes'][_0x060e('0x30')]?_0x45f2ca[_0x060e('0x2e')]:_0xacd490[_0x060e('0x28')];if(!_0x23f35f[_0x060e('0x2b')][_0x060e('0x31')](_0x060e('0x32'))){_0x45f2ca[_0x060e('0x1c')]=qs['limit'](_0x23f35f[_0x060e('0x2b')][_0x060e('0x1c')]);_0x45f2ca[_0x060e('0x1b')]=qs[_0x060e('0x1b')](_0x23f35f['query'][_0x060e('0x1b')]);}_0x45f2ca[_0x060e('0x33')]=qs[_0x060e('0x34')](_0x23f35f[_0x060e('0x2b')][_0x060e('0x34')]);_0x45f2ca[_0x060e('0x35')]=qs[_0x060e('0x2c')](_[_0x060e('0x36')](_0x23f35f[_0x060e('0x2b')],_0xacd490[_0x060e('0x2c')]),_0x1afa68);if(_0x23f35f['query'][_0x060e('0x37')]){_0x45f2ca[_0x060e('0x35')]=_[_0x060e('0x38')](_0x45f2ca[_0x060e('0x35')],{'$or':_[_0x060e('0x29')](_0x1afa68,function(_0x2530e5){if(_0x2530e5['type']!==_0x060e('0x39')){var _0x12b189={};_0x12b189[_0x2530e5[_0x060e('0x24')]]={'$like':'%'+_0x23f35f['query'][_0x060e('0x37')]+'%'};return _0x12b189;}})});}_0x45f2ca=_['merge']({},_0x45f2ca,_0x23f35f[_0x060e('0x3a')]);var _0x38b967={'where':_0x45f2ca[_0x060e('0x35')]};return db[_0x060e('0x25')][_0x060e('0x1a')](_0x38b967)[_0x060e('0x22')](function(_0x350a1c){_0x127c8e[_0x060e('0x1a')]=_0x350a1c;if(_0x23f35f['query'][_0x060e('0x3b')]){_0x45f2ca['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0x060e('0x3c')](_0x45f2ca);})['then'](function(_0xd5da5a){_0x127c8e['rows']=_0xd5da5a;return _0x127c8e;})['then'](respondWithFilteredResult(_0x4984d8,_0x45f2ca))[_0x060e('0x3d')](handleError(_0x4984d8,null));};exports[_0x060e('0x3e')]=function(_0x9f58b7,_0x479032){var _0xa9c1b9={'raw':!![],'where':{'id':_0x9f58b7[_0x060e('0x3f')]['id']}},_0x3decd2={};_0x3decd2['model']=_[_0x060e('0x2a')](db[_0x060e('0x25')]['rawAttributes']);_0x3decd2[_0x060e('0x2b')]=_[_0x060e('0x2a')](_0x9f58b7[_0x060e('0x2b')]);_0x3decd2['filters']=_['intersection'](_0x3decd2[_0x060e('0x28')],_0x3decd2[_0x060e('0x2b')]);_0xa9c1b9[_0x060e('0x2e')]=_[_0x060e('0x2d')](_0x3decd2[_0x060e('0x28')],qs['fields'](_0x9f58b7[_0x060e('0x2b')][_0x060e('0x2f')]));_0xa9c1b9['attributes']=_0xa9c1b9['attributes'][_0x060e('0x30')]?_0xa9c1b9['attributes']:_0x3decd2[_0x060e('0x28')];if(_0x9f58b7['query']['includeAll']){_0xa9c1b9[_0x060e('0x40')]=[{'all':!![]}];}_0xa9c1b9=_[_0x060e('0x38')]({},_0xa9c1b9,_0x9f58b7[_0x060e('0x3a')]);return db[_0x060e('0x25')][_0x060e('0x41')](_0xa9c1b9)['then'](handleEntityNotFound(_0x479032,null))[_0x060e('0x22')](respondWithResult(_0x479032,null))[_0x060e('0x3d')](handleError(_0x479032,null));};exports[_0x060e('0x42')]=function(_0xba012c,_0x24bd09){return db[_0x060e('0x25')][_0x060e('0x42')](_0xba012c[_0x060e('0x43')],{})[_0x060e('0x22')](respondWithResult(_0x24bd09,0xc9))['catch'](handleError(_0x24bd09,null));};exports[_0x060e('0x21')]=function(_0x31bfe7,_0xd350a9){if(_0x31bfe7[_0x060e('0x43')]['id']){delete _0x31bfe7[_0x060e('0x43')]['id'];}return db['VoiceDialReport'][_0x060e('0x41')]({'where':{'id':_0x31bfe7['params']['id']}})['then'](handleEntityNotFound(_0xd350a9,null))[_0x060e('0x22')](saveUpdates(_0x31bfe7[_0x060e('0x43')],null))['then'](respondWithResult(_0xd350a9,null))[_0x060e('0x3d')](handleError(_0xd350a9,null));};exports[_0x060e('0x44')]=function(_0x1c6df7,_0x3e75ff){return db[_0x060e('0x25')][_0x060e('0x41')]({'where':{'id':_0x1c6df7['params']['id']}})['then'](handleEntityNotFound(_0x3e75ff,null))['then'](removeEntity(_0x3e75ff,null))[_0x060e('0x3d')](handleError(_0x3e75ff,null));};exports[_0x060e('0x45')]=function(_0x31f1ed,_0x4c0959){return db[_0x060e('0x25')][_0x060e('0x45')]()[_0x060e('0x22')](respondWithResult(_0x4c0959,null))[_0x060e('0x3d')](handleError(_0x4c0959,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index c534311..614c2a0 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 _0x0c32=['rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x487e9e,_0x4b084f){var _0x131ee3=function(_0x5d0402){while(--_0x5d0402){_0x487e9e['push'](_0x487e9e['shift']());}};_0x131ee3(++_0x4b084f);}(_0x0c32,0x162));var _0x20c3=function(_0x32c7e5,_0x35246f){_0x32c7e5=_0x32c7e5-0x0;var _0x29735c=_0x0c32[_0x32c7e5];return _0x29735c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x20c3('0x0'))(_0x20c3('0x1'));var moment=require(_0x20c3('0x2'));var BPromise=require(_0x20c3('0x3'));var rp=require(_0x20c3('0x4'));var fs=require('fs');var path=require(_0x20c3('0x5'));var rimraf=require(_0x20c3('0x6'));var config=require(_0x20c3('0x7'));var attributes=require(_0x20c3('0x8'));module[_0x20c3('0x9')]=function(_0x4a7b0d,_0x24e25b){return _0x4a7b0d[_0x20c3('0xa')]('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x20c3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb23b=['request-promise','rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x389832,_0x10a4a9){var _0x59429e=function(_0x5f3562){while(--_0x5f3562){_0x389832['push'](_0x389832['shift']());}};_0x59429e(++_0x10a4a9);}(_0xb23b,0x1dc));var _0xbb23=function(_0xdf4058,_0x3d913d){_0xdf4058=_0xdf4058-0x0;var _0x141888=_0xb23b[_0xdf4058];return _0x141888;};'use strict';var _=require(_0xbb23('0x0'));var util=require(_0xbb23('0x1'));var logger=require(_0xbb23('0x2'))(_0xbb23('0x3'));var moment=require('moment');var BPromise=require(_0xbb23('0x4'));var rp=require(_0xbb23('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb23('0x6'));var config=require('../../config/environment');var attributes=require(_0xbb23('0x7'));module[_0xbb23('0x8')]=function(_0x2bc04e,_0x2b4549){return _0x2bc04e[_0xbb23('0x9')](_0xbb23('0xa'),attributes,{'tableName':_0xbb23('0xb'),'paranoid':![],'indexes':[{'fields':[_0xbb23('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 973a808..e26dbfc 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 _0xeed3=['body','options','raw','stringify','UpdateVoiceDialReport','update','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','CreateVoiceDialReport','VoiceDialReport','create'];(function(_0x161d41,_0x306119){var _0x21daf6=function(_0x1429fa){while(--_0x1429fa){_0x161d41['push'](_0x161d41['shift']());}};_0x21daf6(++_0x306119);}(_0xeed3,0xd5));var _0x3eed=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xeed3[_0x344a3f];return _0x264712;};'use strict';var _=require(_0x3eed('0x0'));var util=require(_0x3eed('0x1'));var moment=require(_0x3eed('0x2'));var BPromise=require(_0x3eed('0x3'));var rs=require(_0x3eed('0x4'));var fs=require('fs');var Redis=require(_0x3eed('0x5'));var db=require(_0x3eed('0x6'))['db'];var utils=require(_0x3eed('0x7'));var logger=require('../../config/logger')(_0x3eed('0x8'));var config=require(_0x3eed('0x9'));var jayson=require(_0x3eed('0xa'));var client=jayson[_0x3eed('0xb')][_0x3eed('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf9dbc3,_0x20b156,_0x651c18){return new BPromise(function(_0x2c90b2,_0x13a9c6){return client['request'](_0xf9dbc3,_0x651c18)['then'](function(_0x445a66){logger['info'](_0x3eed('0xd'),_0x20b156,_0x3eed('0xe'));logger[_0x3eed('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x20b156,_0x3eed('0xe'),JSON['stringify'](_0x445a66));if(_0x445a66['error']){if(_0x445a66[_0x3eed('0x10')][_0x3eed('0x11')]===0x1f4){logger[_0x3eed('0x10')](_0x3eed('0xd'),_0x20b156,_0x445a66['error'][_0x3eed('0x12')]);return _0x13a9c6(_0x445a66[_0x3eed('0x10')][_0x3eed('0x12')]);}logger[_0x3eed('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x20b156,_0x445a66[_0x3eed('0x10')][_0x3eed('0x12')]);return _0x2c90b2(_0x445a66[_0x3eed('0x10')][_0x3eed('0x12')]);}else{logger[_0x3eed('0x13')](_0x3eed('0xd'),_0x20b156,_0x3eed('0xe'));_0x2c90b2(_0x445a66[_0x3eed('0x14')][_0x3eed('0x12')]);}})[_0x3eed('0x15')](function(_0x22eaad){logger['error'](_0x3eed('0xd'),_0x20b156,_0x22eaad);_0x13a9c6(_0x22eaad);});});}exports[_0x3eed('0x16')]=function(_0x330872){var _0x2cd313=this;return new Promise(function(_0x381215,_0x710b31){return db[_0x3eed('0x17')][_0x3eed('0x18')](_0x330872[_0x3eed('0x19')],{'raw':_0x330872[_0x3eed('0x1a')]?_0x330872['options'][_0x3eed('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3b445f){logger[_0x3eed('0x13')](_0x3eed('0x16'),_0x330872);logger[_0x3eed('0xf')](_0x3eed('0x16'),_0x330872,JSON[_0x3eed('0x1c')](_0x3b445f));_0x381215(_0x3b445f);})[_0x3eed('0x15')](function(_0x444e37){logger[_0x3eed('0x10')](_0x3eed('0x16'),_0x444e37[_0x3eed('0x12')],_0x330872);_0x710b31(_0x2cd313[_0x3eed('0x10')](0x1f4,_0x444e37[_0x3eed('0x12')]));});});};exports[_0x3eed('0x1d')]=function(_0x510295){var _0x4d8e39=this;return new Promise(function(_0x4fe25f,_0x36a681){return db[_0x3eed('0x17')][_0x3eed('0x1e')](_0x510295[_0x3eed('0x19')],{'raw':_0x510295[_0x3eed('0x1a')]?_0x510295[_0x3eed('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x510295[_0x3eed('0x1a')]?_0x510295[_0x3eed('0x1a')]['where']||null:null,'attributes':_0x510295[_0x3eed('0x1a')]?_0x510295['options'][_0x3eed('0x1f')]||null:null,'limit':_0x510295[_0x3eed('0x1a')]?_0x510295['options'][_0x3eed('0x20')]||null:null})[_0x3eed('0x21')](function(_0x15e326){logger[_0x3eed('0x13')](_0x3eed('0x1d'),_0x510295);logger[_0x3eed('0xf')](_0x3eed('0x1d'),_0x510295,JSON[_0x3eed('0x1c')](_0x15e326));_0x4fe25f(_0x15e326);})[_0x3eed('0x15')](function(_0x18a9aa){logger[_0x3eed('0x10')]('UpdateVoiceDialReport',_0x18a9aa['message'],_0x510295);_0x36a681(_0x4d8e39[_0x3eed('0x10')](0x1f4,_0x18a9aa[_0x3eed('0x12')]));});});}; \ No newline at end of file +var _0xe62b=['catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','stringify','UpdateVoiceDialReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x3ab4d7,_0x19c75c){var _0x26015a=function(_0x2df7c2){while(--_0x2df7c2){_0x3ab4d7['push'](_0x3ab4d7['shift']());}};_0x26015a(++_0x19c75c);}(_0xe62b,0x123));var _0xbe62=function(_0x222550,_0x3c0a0c){_0x222550=_0x222550-0x0;var _0x58ac61=_0xe62b[_0x222550];return _0x58ac61;};'use strict';var _=require(_0xbe62('0x0'));var util=require(_0xbe62('0x1'));var moment=require(_0xbe62('0x2'));var BPromise=require(_0xbe62('0x3'));var rs=require(_0xbe62('0x4'));var fs=require('fs');var Redis=require(_0xbe62('0x5'));var db=require(_0xbe62('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xbe62('0x7'));var client=jayson['client'][_0xbe62('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x55040c,_0x4ed974,_0x4e88aa){return new BPromise(function(_0x1c68ef,_0x223856){return client['request'](_0x55040c,_0x4e88aa)[_0xbe62('0x9')](function(_0x38fc3c){logger[_0xbe62('0xa')](_0xbe62('0xb'),_0x4ed974,_0xbe62('0xc'));logger[_0xbe62('0xd')](_0xbe62('0xe'),_0x4ed974,_0xbe62('0xc'),JSON['stringify'](_0x38fc3c));if(_0x38fc3c[_0xbe62('0xf')]){if(_0x38fc3c[_0xbe62('0xf')][_0xbe62('0x10')]===0x1f4){logger['error'](_0xbe62('0xb'),_0x4ed974,_0x38fc3c[_0xbe62('0xf')]['message']);return _0x223856(_0x38fc3c['error'][_0xbe62('0x11')]);}logger[_0xbe62('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x4ed974,_0x38fc3c[_0xbe62('0xf')][_0xbe62('0x11')]);return _0x1c68ef(_0x38fc3c[_0xbe62('0xf')][_0xbe62('0x11')]);}else{logger[_0xbe62('0xa')](_0xbe62('0xb'),_0x4ed974,'request\x20sent');_0x1c68ef(_0x38fc3c[_0xbe62('0x12')][_0xbe62('0x11')]);}})[_0xbe62('0x13')](function(_0x8ad6ba){logger[_0xbe62('0xf')](_0xbe62('0xb'),_0x4ed974,_0x8ad6ba);_0x223856(_0x8ad6ba);});});}exports[_0xbe62('0x14')]=function(_0x498a9d){var _0x3577b6=this;return new Promise(function(_0x492a46,_0x57b05f){return db[_0xbe62('0x15')][_0xbe62('0x16')](_0x498a9d[_0xbe62('0x17')],{'raw':_0x498a9d[_0xbe62('0x18')]?_0x498a9d[_0xbe62('0x18')][_0xbe62('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x43e070){logger[_0xbe62('0xa')](_0xbe62('0x14'),_0x498a9d);logger[_0xbe62('0xd')](_0xbe62('0x14'),_0x498a9d,JSON[_0xbe62('0x1a')](_0x43e070));_0x492a46(_0x43e070);})[_0xbe62('0x13')](function(_0x1f7101){logger[_0xbe62('0xf')](_0xbe62('0x14'),_0x1f7101[_0xbe62('0x11')],_0x498a9d);_0x57b05f(_0x3577b6[_0xbe62('0xf')](0x1f4,_0x1f7101[_0xbe62('0x11')]));});});};exports[_0xbe62('0x1b')]=function(_0x1e9cfe){var _0x298b04=this;return new Promise(function(_0x46195d,_0x3af207){return db['VoiceDialReport'][_0xbe62('0x1c')](_0x1e9cfe['body'],{'raw':_0x1e9cfe['options']?_0x1e9cfe[_0xbe62('0x18')][_0xbe62('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e9cfe[_0xbe62('0x18')]?_0x1e9cfe[_0xbe62('0x18')][_0xbe62('0x1d')]||null:null,'attributes':_0x1e9cfe[_0xbe62('0x18')]?_0x1e9cfe['options'][_0xbe62('0x1e')]||null:null,'limit':_0x1e9cfe['options']?_0x1e9cfe[_0xbe62('0x18')]['limit']||null:null})[_0xbe62('0x9')](function(_0x196202){logger[_0xbe62('0xa')](_0xbe62('0x1b'),_0x1e9cfe);logger[_0xbe62('0xd')]('UpdateVoiceDialReport',_0x1e9cfe,JSON['stringify'](_0x196202));_0x46195d(_0x196202);})[_0xbe62('0x13')](function(_0x5859c4){logger[_0xbe62('0xf')](_0xbe62('0x1b'),_0x5859c4[_0xbe62('0x11')],_0x1e9cfe);_0x3af207(_0x298b04['error'](0x1f4,_0x5859c4[_0xbe62('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index f96b05f..f7adf87 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 _0x65a0=['addApplications','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','/:id','isAuthenticated','show','post','create','/:id/applications'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x65a0,0x1a9));var _0x065a=function(_0x5ceaad,_0x4c8400){_0x5ceaad=_0x5ceaad-0x0;var _0x424d04=_0x65a0[_0x5ceaad];return _0x424d04;};'use strict';var multer=require(_0x065a('0x0'));var util=require('util');var path=require(_0x065a('0x1'));var timeout=require(_0x065a('0x2'));var express=require(_0x065a('0x3'));var router=express[_0x065a('0x4')]();var fs_extra=require(_0x065a('0x5'));var auth=require(_0x065a('0x6'));var interaction=require(_0x065a('0x7'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x065a('0x8')]);router['get'](_0x065a('0x9'),auth[_0x065a('0xa')](),controller[_0x065a('0xb')]);router[_0x065a('0xc')]('/',auth[_0x065a('0xa')](),controller[_0x065a('0xd')]);router[_0x065a('0xc')](_0x065a('0xe'),auth[_0x065a('0xa')](),controller[_0x065a('0xf')]);router['put'](_0x065a('0x9'),auth[_0x065a('0xa')](),controller[_0x065a('0x10')]);router[_0x065a('0x11')](_0x065a('0x9'),auth['isAuthenticated'](),controller[_0x065a('0x12')]);module[_0x065a('0x13')]=router; \ No newline at end of file +var _0xb593=['../../config/environment','./voiceExtension.controller','get','index','/:id','show','post','isAuthenticated','/:id/applications','addApplications','put','update','delete','destroy','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x564523,_0x5db1c8){var _0x404d2a=function(_0x346236){while(--_0x346236){_0x564523['push'](_0x564523['shift']());}};_0x404d2a(++_0x5db1c8);}(_0xb593,0x9a));var _0x3b59=function(_0x27669b,_0x306a2c){_0x27669b=_0x27669b-0x0;var _0x31ed6e=_0xb593[_0x27669b];return _0x31ed6e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3b59('0x0'));var timeout=require('connect-timeout');var express=require(_0x3b59('0x1'));var router=express[_0x3b59('0x2')]();var fs_extra=require(_0x3b59('0x3'));var auth=require(_0x3b59('0x4'));var interaction=require(_0x3b59('0x5'));var config=require(_0x3b59('0x6'));var controller=require(_0x3b59('0x7'));router[_0x3b59('0x8')]('/',auth['isAuthenticated'](),controller[_0x3b59('0x9')]);router[_0x3b59('0x8')](_0x3b59('0xa'),auth['isAuthenticated'](),controller[_0x3b59('0xb')]);router[_0x3b59('0xc')]('/',auth[_0x3b59('0xd')](),controller['create']);router[_0x3b59('0xc')](_0x3b59('0xe'),auth['isAuthenticated'](),controller[_0x3b59('0xf')]);router[_0x3b59('0x10')](_0x3b59('0xa'),auth[_0x3b59('0xd')](),controller[_0x3b59('0x11')]);router[_0x3b59('0x12')](_0x3b59('0xa'),auth[_0x3b59('0xd')](),controller[_0x3b59('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 74f3858..1e8eef9 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(_0x377ba8,_0x375bfd){var _0x298e8e=function(_0x43436b){while(--_0x43436b){_0x377ba8['push'](_0x377ba8['shift']());}};_0x298e8e(++_0x375bfd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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(_0x35f188,_0x4f70a7){var _0x284e96=function(_0x281f73){while(--_0x281f73){_0x35f188['push'](_0x35f188['shift']());}};_0x284e96(++_0x4f70a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 694a487..9c83b81 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 _0x17f2=['UserProfileResource','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','options','VoiceExtension','count','includeAll','findAll','catch','show','params','include','create','body','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','recordingFormat','cutdigits','context','sequelize','transaction','bulkCreate','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','set','Content-Range','reject','save','update','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','internal','filter','ignore','value','includes','type','find'];(function(_0x488cb5,_0x4b9bac){var _0x490c00=function(_0x1057a3){while(--_0x1057a3){_0x488cb5['push'](_0x488cb5['shift']());}};_0x490c00(++_0x4b9bac);}(_0x17f2,0x9b));var _0x217f=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0x17f2[_0x35f7f5];return _0x5567a4;};'use strict';var emlformat=require(_0x217f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x217f('0x1'));var rp=require(_0x217f('0x2'));var moment=require(_0x217f('0x3'));var BPromise=require(_0x217f('0x4'));var Mustache=require(_0x217f('0x5'));var util=require(_0x217f('0x6'));var path=require(_0x217f('0x7'));var sox=require('sox');var csv=require(_0x217f('0x8'));var ejs=require(_0x217f('0x9'));var fs=require('fs');var fs_extra=require(_0x217f('0xa'));var _=require(_0x217f('0xb'));var squel=require(_0x217f('0xc'));var crypto=require(_0x217f('0xd'));var jsforce=require(_0x217f('0xe'));var deskjs=require(_0x217f('0xf'));var toCsv=require(_0x217f('0x8'));var querystring=require(_0x217f('0x10'));var Papa=require(_0x217f('0x11'));var Redis=require(_0x217f('0x12'));var authService=require(_0x217f('0x13'));var qs=require(_0x217f('0x14'));var as=require(_0x217f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x217f('0x16'))(_0x217f('0x17'));var utils=require(_0x217f('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x217f('0x19'))['db'];config[_0x217f('0x1a')]=_[_0x217f('0x1b')](config['redis'],{'host':_0x217f('0x1c'),'port':0x18eb});var socket=require(_0x217f('0x1d'))(new Redis(config[_0x217f('0x1a')]));require('./voiceExtension.socket')[_0x217f('0x1e')](socket);function respondWithStatusCode(_0x40d487,_0x1df50e){_0x1df50e=_0x1df50e||0xcc;return function(_0x574273){if(_0x574273){return _0x40d487['sendStatus'](_0x1df50e);}return _0x40d487[_0x217f('0x1f')](_0x1df50e)[_0x217f('0x20')]();};}function respondWithResult(_0xb07226,_0x4a421a){_0x4a421a=_0x4a421a||0xc8;return function(_0x523fde){if(_0x523fde){return _0xb07226['status'](_0x4a421a)[_0x217f('0x21')](_0x523fde);}};}function respondWithFilteredResult(_0x127eca,_0x10d57d){return function(_0x263219){if(_0x263219){var _0x2845ea=_0x263219['count'],_0x33e00b=_0x10d57d[_0x217f('0x22')],_0x503e7c=_0x10d57d[_0x217f('0x22')]+_0x10d57d['limit'],_0x3970c1;if(_0x503e7c>=_0x2845ea){_0x503e7c=_0x2845ea;_0x3970c1=0xc8;}else{_0x3970c1=0xce;}_0x127eca[_0x217f('0x1f')](_0x3970c1);return _0x127eca[_0x217f('0x23')](_0x217f('0x24'),_0x33e00b+'-'+_0x503e7c+'/'+_0x2845ea)[_0x217f('0x21')](_0x263219);}return null;};}function patchUpdates(_0x2a0141){return function(_0x5dad3a){try{jsonpatch['apply'](_0x5dad3a,_0x2a0141,!![]);}catch(_0x181f96){return BPromise[_0x217f('0x25')](_0x181f96);}return _0x5dad3a[_0x217f('0x26')]();};}function saveUpdates(_0x2ff52c,_0x55997e){return function(_0x51af45){if(_0x51af45){return _0x51af45[_0x217f('0x27')](_0x2ff52c)['then'](function(_0x3e05c8){return _0x3e05c8;});}return null;};}function removeEntity(_0x3461d5,_0x498bd2){return function(_0x478534){if(_0x478534){return _0x478534['destroy']()[_0x217f('0x28')](function(){var _0x58b213=_0x478534[_0x217f('0x29')]({'plain':!![]});var _0x556d35=[{'name':_0x217f('0x2a'),'value':_0x217f('0x2b'),'ignore':![]},{'name':_0x217f('0x2c'),'value':_0x217f('0x2d'),'ignore':![]},{'name':'InternalRoutes','value':_0x217f('0x2e'),'ignore':![]}];var _0x1534e2=_(_0x556d35)[_0x217f('0x2f')](_0x217f('0x30'))['map'](_0x217f('0x31'))[_0x217f('0x31')]();if(_[_0x217f('0x32')](_0x1534e2,_0x58b213[_0x217f('0x33')])){return;}var _0xf38066=_[_0x217f('0x34')](_0x556d35,[_0x217f('0x31'),_0x58b213[_0x217f('0x33')]])['name'];return db[_0x217f('0x35')][_0x217f('0x36')]({'where':{'type':_0xf38066,'resourceId':_0x58b213['id']}})[_0x217f('0x28')](function(){return _0x478534;});})[_0x217f('0x28')](function(){_0x3461d5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x49e112,_0x1d2a30){return function(_0x29b05e){if(!_0x29b05e){_0x49e112[_0x217f('0x37')](0x194);}return _0x29b05e;};}function handleError(_0x33673a,_0x18f054){_0x18f054=_0x18f054||0x1f4;return function(_0x472334){logger[_0x217f('0x38')](_0x472334['stack']);if(_0x472334['name']){delete _0x472334[_0x217f('0x39')];}_0x33673a['status'](_0x18f054)[_0x217f('0x3a')](_0x472334);};}exports[_0x217f('0x3b')]=function(_0x3042e0,_0x8f778e){var _0x42bdc5={},_0x1a2002={},_0x56e67f={'count':0x0,'rows':[]};var _0x20477d=_[_0x217f('0x3c')](db['VoiceExtension'][_0x217f('0x3d')],function(_0x10be2a){return{'name':_0x10be2a[_0x217f('0x3e')],'type':_0x10be2a['type'][_0x217f('0x3f')]};});_0x1a2002['model']=_[_0x217f('0x3c')](_0x20477d,_0x217f('0x39'));_0x1a2002[_0x217f('0x40')]=_[_0x217f('0x41')](_0x3042e0[_0x217f('0x40')]);_0x1a2002['filters']=_['intersection'](_0x1a2002[_0x217f('0x42')],_0x1a2002[_0x217f('0x40')]);_0x42bdc5['attributes']=_[_0x217f('0x43')](_0x1a2002[_0x217f('0x42')],qs[_0x217f('0x44')](_0x3042e0[_0x217f('0x40')][_0x217f('0x44')]));_0x42bdc5[_0x217f('0x45')]=_0x42bdc5[_0x217f('0x45')][_0x217f('0x46')]?_0x42bdc5[_0x217f('0x45')]:_0x1a2002[_0x217f('0x42')];if(!_0x3042e0['query'][_0x217f('0x47')](_0x217f('0x48'))){_0x42bdc5[_0x217f('0x49')]=qs[_0x217f('0x49')](_0x3042e0[_0x217f('0x40')]['limit']);_0x42bdc5['offset']=qs[_0x217f('0x22')](_0x3042e0[_0x217f('0x40')][_0x217f('0x22')]);}_0x42bdc5[_0x217f('0x4a')]=qs[_0x217f('0x4b')](_0x3042e0[_0x217f('0x40')]['sort']);_0x42bdc5['where']=qs[_0x217f('0x4c')](_[_0x217f('0x4d')](_0x3042e0[_0x217f('0x40')],_0x1a2002[_0x217f('0x4c')]),_0x20477d);if(_0x3042e0[_0x217f('0x40')][_0x217f('0x2f')]){_0x42bdc5[_0x217f('0x4e')]=_['merge'](_0x42bdc5[_0x217f('0x4e')],{'$or':_[_0x217f('0x3c')](_0x20477d,function(_0x2447b1){if(_0x2447b1[_0x217f('0x33')]!=='VIRTUAL'){var _0x42230e={};_0x42230e[_0x2447b1[_0x217f('0x39')]]={'$like':'%'+_0x3042e0['query'][_0x217f('0x2f')]+'%'};return _0x42230e;}})});}_0x42bdc5=_['merge']({},_0x42bdc5,_0x3042e0[_0x217f('0x4f')]);var _0x19e809={'where':_0x42bdc5['where']};return db[_0x217f('0x50')][_0x217f('0x51')](_0x19e809)[_0x217f('0x28')](function(_0x526072){_0x56e67f[_0x217f('0x51')]=_0x526072;if(_0x3042e0[_0x217f('0x40')][_0x217f('0x52')]){_0x42bdc5['include']=[{'all':!![]}];}return db['VoiceExtension'][_0x217f('0x53')](_0x42bdc5);})[_0x217f('0x28')](function(_0x54afe6){_0x56e67f['rows']=_0x54afe6;return _0x56e67f;})[_0x217f('0x28')](respondWithFilteredResult(_0x8f778e,_0x42bdc5))[_0x217f('0x54')](handleError(_0x8f778e,null));};exports[_0x217f('0x55')]=function(_0x218a45,_0x34a387){var _0x2dfdbf={'raw':![],'where':{'id':_0x218a45[_0x217f('0x56')]['id']}},_0x56fe1e={};_0x56fe1e['model']=_[_0x217f('0x41')](db['VoiceExtension'][_0x217f('0x3d')]);_0x56fe1e['query']=_[_0x217f('0x41')](_0x218a45['query']);_0x56fe1e[_0x217f('0x4c')]=_[_0x217f('0x43')](_0x56fe1e['model'],_0x56fe1e[_0x217f('0x40')]);_0x2dfdbf[_0x217f('0x45')]=_[_0x217f('0x43')](_0x56fe1e[_0x217f('0x42')],qs[_0x217f('0x44')](_0x218a45[_0x217f('0x40')][_0x217f('0x44')]));_0x2dfdbf['attributes']=_0x2dfdbf['attributes'][_0x217f('0x46')]?_0x2dfdbf[_0x217f('0x45')]:_0x56fe1e['model'];if(_0x218a45[_0x217f('0x40')][_0x217f('0x52')]){_0x2dfdbf[_0x217f('0x57')]=[{'all':!![]}];}_0x2dfdbf=_['merge']({},_0x2dfdbf,_0x218a45['options']);return db[_0x217f('0x50')][_0x217f('0x34')](_0x2dfdbf)[_0x217f('0x28')](handleEntityNotFound(_0x34a387,null))[_0x217f('0x28')](respondWithResult(_0x34a387,null))[_0x217f('0x54')](handleError(_0x34a387,null));};exports[_0x217f('0x36')]=function(_0x5a17fd,_0x4da38a){return db[_0x217f('0x50')][_0x217f('0x34')]({'where':{'id':_0x5a17fd[_0x217f('0x56')]['id']}})[_0x217f('0x28')](handleEntityNotFound(_0x4da38a,null))[_0x217f('0x28')](removeEntity(_0x4da38a,null))[_0x217f('0x54')](handleError(_0x4da38a,null));};exports[_0x217f('0x58')]=function(_0x549187,_0x57d191){if(_0x549187[_0x217f('0x59')][_0x217f('0x33')]==='outbound'&&!_['startsWith'](_0x549187['body']['exten'],'_')){_0x549187[_0x217f('0x59')][_0x217f('0x5a')]='_'['concat'](_0x549187[_0x217f('0x59')][_0x217f('0x5a')]);}return db[_0x217f('0x50')]['create'](_0x549187[_0x217f('0x59')],{'raw':![]})[_0x217f('0x28')](function(_0x267e41){var _0x226603=_0x549187['user']['get']({'plain':!![]});if(!_0x226603)throw new Error(_0x217f('0x5b'));if(_0x226603['role']===_0x217f('0x5c')){var _0x507ea4=_0x267e41[_0x217f('0x29')]({'plain':!![]});var _0x358dfc=[{'name':'InboundRoutes','value':'inbound'},{'name':_0x217f('0x2c'),'value':'outbound'},{'name':'InternalRoutes','value':_0x217f('0x2e')}];var _0x3b7887=_[_0x217f('0x34')](_0x358dfc,[_0x217f('0x31'),_0x507ea4[_0x217f('0x33')]])[_0x217f('0x39')];return db[_0x217f('0x5d')]['find']({'where':{'name':_0x3b7887,'userProfileId':_0x226603[_0x217f('0x5e')]},'raw':!![]})[_0x217f('0x28')](function(_0x2730a6){if(_0x2730a6&&_0x2730a6[_0x217f('0x5f')]===0x0){return db['UserProfileResource']['create']({'name':_0x507ea4[_0x217f('0x39')],'resourceId':_0x507ea4['id'],'type':_0x2730a6['name'],'sectionId':_0x2730a6['id']},{})[_0x217f('0x28')](function(){return _0x267e41;});}else{return _0x267e41;}})['catch'](function(_0x4b3264){logger[_0x217f('0x38')](_0x217f('0x60'),_0x4b3264);throw _0x4b3264;});}return _0x267e41;})[_0x217f('0x28')](respondWithResult(_0x57d191,0xc9))['catch'](handleError(_0x57d191,null));};exports[_0x217f('0x27')]=function(_0x174437,_0x34499f){if(_0x174437['body']['id']){delete _0x174437[_0x217f('0x59')]['id'];}return db['VoiceExtension'][_0x217f('0x34')]({'where':{'id':_0x174437[_0x217f('0x56')]['id']}})['then'](handleEntityNotFound(_0x34499f,null))[_0x217f('0x28')](function(_0x3c9624){if(_0x3c9624){return db[_0x217f('0x50')][_0x217f('0x27')](_[_0x217f('0x4d')](_0x174437[_0x217f('0x59')],[_0x217f('0x5a'),'context',_0x217f('0x61'),_0x217f('0x62'),_0x217f('0x63'),'mandatoryDisposition']),{'where':{'context':_0x3c9624[_0x217f('0x64')],'exten':_0x3c9624['exten']},'individualHooks':!![]})[_0x217f('0x28')](function(_0x34685f){return _0x34685f;});}return null;})[_0x217f('0x28')](respondWithStatusCode(_0x34499f,null))['catch'](handleError(_0x34499f,null));};exports['addApplications']=function(_0x19b084,_0x5b064a,_0x1675b0){return db[_0x217f('0x50')]['findOne']({'where':{'id':_0x19b084[_0x217f('0x56')]['id']}})[_0x217f('0x28')](handleEntityNotFound(_0x5b064a,null))[_0x217f('0x28')](function(_0x2c9a3a){if(_0x2c9a3a){return db[_0x217f('0x65')][_0x217f('0x66')](function(_0x234aee){return db[_0x217f('0x50')][_0x217f('0x36')]({'where':{'VoiceExtensionId':_0x19b084[_0x217f('0x56')]['id']},'transaction':_0x234aee})[_0x217f('0x28')](function(_0x126bc1){var _0xccf39=_['map'](_0x19b084[_0x217f('0x59')],function(_0xf5d3){_0xf5d3['VoiceExtensionId']=_0x19b084['params']['id'];return _0xf5d3;});return db['VoiceExtension'][_0x217f('0x67')](_0xccf39,{'transaction':_0x234aee});});})['then'](function(){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x19b084[_0x217f('0x56')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x217f('0x28')](respondWithResult(_0x5b064a,null))[_0x217f('0x54')](handleError(_0x5b064a,null));}; \ No newline at end of file +var _0xe002=['update','destroy','then','OutboundRoutes','InternalRoutes','ignore','map','value','includes','find','type','name','UserProfileResource','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','keys','intersection','include','create','body','outbound','startsWith','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','internal','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','mandatoryDisposition','addApplications','sequelize','transaction','VoiceExtensionId','bulkCreate','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe002,0x177));var _0x2e00=function(_0x171fdc,_0x16ae91){_0x171fdc=_0x171fdc-0x0;var _0x3782ea=_0xe002[_0x171fdc];return _0x3782ea;};'use strict';var emlformat=require(_0x2e00('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2e00('0x1'));var jsonpatch=require(_0x2e00('0x2'));var rp=require(_0x2e00('0x3'));var moment=require(_0x2e00('0x4'));var BPromise=require(_0x2e00('0x5'));var Mustache=require(_0x2e00('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2e00('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2e00('0x8'));var squel=require(_0x2e00('0x9'));var crypto=require(_0x2e00('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2e00('0xb'));var toCsv=require(_0x2e00('0xc'));var querystring=require(_0x2e00('0xd'));var Papa=require(_0x2e00('0xe'));var Redis=require(_0x2e00('0xf'));var authService=require(_0x2e00('0x10'));var qs=require(_0x2e00('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2e00('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x2e00('0x13'));var config=require(_0x2e00('0x14'));var licenseUtil=require(_0x2e00('0x15'));var db=require(_0x2e00('0x16'))['db'];config['redis']=_['defaults'](config[_0x2e00('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x2e00('0x18'))(new Redis(config[_0x2e00('0x17')]));require('./voiceExtension.socket')[_0x2e00('0x19')](socket);function respondWithStatusCode(_0x367577,_0x18e290){_0x18e290=_0x18e290||0xcc;return function(_0xf1e7ec){if(_0xf1e7ec){return _0x367577[_0x2e00('0x1a')](_0x18e290);}return _0x367577[_0x2e00('0x1b')](_0x18e290)[_0x2e00('0x1c')]();};}function respondWithResult(_0x382c4b,_0x704520){_0x704520=_0x704520||0xc8;return function(_0x2c52ad){if(_0x2c52ad){return _0x382c4b[_0x2e00('0x1b')](_0x704520)['json'](_0x2c52ad);}};}function respondWithFilteredResult(_0x3d7db6,_0x4a283c){return function(_0xd1d002){if(_0xd1d002){var _0x199482=_0xd1d002[_0x2e00('0x1d')],_0x4f4fd9=_0x4a283c[_0x2e00('0x1e')],_0x50ef42=_0x4a283c[_0x2e00('0x1e')]+_0x4a283c[_0x2e00('0x1f')],_0x3e5495;if(_0x50ef42>=_0x199482){_0x50ef42=_0x199482;_0x3e5495=0xc8;}else{_0x3e5495=0xce;}_0x3d7db6[_0x2e00('0x1b')](_0x3e5495);return _0x3d7db6['set'](_0x2e00('0x20'),_0x4f4fd9+'-'+_0x50ef42+'/'+_0x199482)[_0x2e00('0x21')](_0xd1d002);}return null;};}function patchUpdates(_0x38105a){return function(_0x487b38){try{jsonpatch[_0x2e00('0x22')](_0x487b38,_0x38105a,!![]);}catch(_0x4d86d0){return BPromise[_0x2e00('0x23')](_0x4d86d0);}return _0x487b38[_0x2e00('0x24')]();};}function saveUpdates(_0x2e13a1,_0x3cbe7d){return function(_0x421418){if(_0x421418){return _0x421418[_0x2e00('0x25')](_0x2e13a1)['then'](function(_0x47c829){return _0x47c829;});}return null;};}function removeEntity(_0x1a0459,_0x79e0d0){return function(_0x13c18a){if(_0x13c18a){return _0x13c18a[_0x2e00('0x26')]()[_0x2e00('0x27')](function(){var _0x4b8180=_0x13c18a['get']({'plain':!![]});var _0x5e987f=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x2e00('0x28'),'value':'outbound','ignore':![]},{'name':_0x2e00('0x29'),'value':'internal','ignore':![]}];var _0x1a1a4c=_(_0x5e987f)['filter'](_0x2e00('0x2a'))[_0x2e00('0x2b')](_0x2e00('0x2c'))[_0x2e00('0x2c')]();if(_[_0x2e00('0x2d')](_0x1a1a4c,_0x4b8180['type'])){return;}var _0x5ea5d4=_[_0x2e00('0x2e')](_0x5e987f,[_0x2e00('0x2c'),_0x4b8180[_0x2e00('0x2f')]])[_0x2e00('0x30')];return db[_0x2e00('0x31')]['destroy']({'where':{'type':_0x5ea5d4,'resourceId':_0x4b8180['id']}})[_0x2e00('0x27')](function(){return _0x13c18a;});})['then'](function(){_0x1a0459['status'](0xcc)[_0x2e00('0x1c')]();});}};}function handleEntityNotFound(_0x127698,_0x2ae968){return function(_0x16ba14){if(!_0x16ba14){_0x127698['sendStatus'](0x194);}return _0x16ba14;};}function handleError(_0x4578dd,_0x2f2d7d){_0x2f2d7d=_0x2f2d7d||0x1f4;return function(_0x4fd80b){logger['error'](_0x4fd80b[_0x2e00('0x32')]);if(_0x4fd80b[_0x2e00('0x30')]){delete _0x4fd80b[_0x2e00('0x30')];}_0x4578dd['status'](_0x2f2d7d)[_0x2e00('0x33')](_0x4fd80b);};}exports[_0x2e00('0x34')]=function(_0x33ab6e,_0x5034aa){var _0x559294={},_0xfbc6d6={},_0x96472d={'count':0x0,'rows':[]};var _0x63b60e=_[_0x2e00('0x2b')](db[_0x2e00('0x35')][_0x2e00('0x36')],function(_0x589d5c){return{'name':_0x589d5c[_0x2e00('0x37')],'type':_0x589d5c[_0x2e00('0x2f')][_0x2e00('0x38')]};});_0xfbc6d6[_0x2e00('0x39')]=_[_0x2e00('0x2b')](_0x63b60e,_0x2e00('0x30'));_0xfbc6d6[_0x2e00('0x3a')]=_['keys'](_0x33ab6e[_0x2e00('0x3a')]);_0xfbc6d6[_0x2e00('0x3b')]=_['intersection'](_0xfbc6d6[_0x2e00('0x39')],_0xfbc6d6[_0x2e00('0x3a')]);_0x559294['attributes']=_['intersection'](_0xfbc6d6[_0x2e00('0x39')],qs[_0x2e00('0x3c')](_0x33ab6e[_0x2e00('0x3a')][_0x2e00('0x3c')]));_0x559294[_0x2e00('0x3d')]=_0x559294[_0x2e00('0x3d')][_0x2e00('0x3e')]?_0x559294[_0x2e00('0x3d')]:_0xfbc6d6[_0x2e00('0x39')];if(!_0x33ab6e[_0x2e00('0x3a')][_0x2e00('0x3f')](_0x2e00('0x40'))){_0x559294['limit']=qs[_0x2e00('0x1f')](_0x33ab6e[_0x2e00('0x3a')][_0x2e00('0x1f')]);_0x559294[_0x2e00('0x1e')]=qs[_0x2e00('0x1e')](_0x33ab6e[_0x2e00('0x3a')][_0x2e00('0x1e')]);}_0x559294[_0x2e00('0x41')]=qs[_0x2e00('0x42')](_0x33ab6e['query'][_0x2e00('0x42')]);_0x559294[_0x2e00('0x43')]=qs[_0x2e00('0x3b')](_[_0x2e00('0x44')](_0x33ab6e[_0x2e00('0x3a')],_0xfbc6d6[_0x2e00('0x3b')]),_0x63b60e);if(_0x33ab6e[_0x2e00('0x3a')][_0x2e00('0x45')]){_0x559294[_0x2e00('0x43')]=_[_0x2e00('0x46')](_0x559294[_0x2e00('0x43')],{'$or':_[_0x2e00('0x2b')](_0x63b60e,function(_0x4ec81e){if(_0x4ec81e['type']!==_0x2e00('0x47')){var _0x5eccfc={};_0x5eccfc[_0x4ec81e[_0x2e00('0x30')]]={'$like':'%'+_0x33ab6e[_0x2e00('0x3a')][_0x2e00('0x45')]+'%'};return _0x5eccfc;}})});}_0x559294=_[_0x2e00('0x46')]({},_0x559294,_0x33ab6e['options']);var _0x561681={'where':_0x559294['where']};return db[_0x2e00('0x35')][_0x2e00('0x1d')](_0x561681)[_0x2e00('0x27')](function(_0x21e15d){_0x96472d['count']=_0x21e15d;if(_0x33ab6e[_0x2e00('0x3a')][_0x2e00('0x48')]){_0x559294['include']=[{'all':!![]}];}return db['VoiceExtension'][_0x2e00('0x49')](_0x559294);})['then'](function(_0x178a65){_0x96472d['rows']=_0x178a65;return _0x96472d;})[_0x2e00('0x27')](respondWithFilteredResult(_0x5034aa,_0x559294))[_0x2e00('0x4a')](handleError(_0x5034aa,null));};exports[_0x2e00('0x4b')]=function(_0x3e0ace,_0x5bdab5){var _0x5aaa26={'raw':![],'where':{'id':_0x3e0ace[_0x2e00('0x4c')]['id']}},_0x23d629={};_0x23d629[_0x2e00('0x39')]=_[_0x2e00('0x4d')](db[_0x2e00('0x35')][_0x2e00('0x36')]);_0x23d629['query']=_[_0x2e00('0x4d')](_0x3e0ace[_0x2e00('0x3a')]);_0x23d629[_0x2e00('0x3b')]=_[_0x2e00('0x4e')](_0x23d629[_0x2e00('0x39')],_0x23d629[_0x2e00('0x3a')]);_0x5aaa26['attributes']=_[_0x2e00('0x4e')](_0x23d629[_0x2e00('0x39')],qs[_0x2e00('0x3c')](_0x3e0ace['query'][_0x2e00('0x3c')]));_0x5aaa26[_0x2e00('0x3d')]=_0x5aaa26['attributes'][_0x2e00('0x3e')]?_0x5aaa26[_0x2e00('0x3d')]:_0x23d629[_0x2e00('0x39')];if(_0x3e0ace[_0x2e00('0x3a')][_0x2e00('0x48')]){_0x5aaa26[_0x2e00('0x4f')]=[{'all':!![]}];}_0x5aaa26=_[_0x2e00('0x46')]({},_0x5aaa26,_0x3e0ace['options']);return db['VoiceExtension']['find'](_0x5aaa26)[_0x2e00('0x27')](handleEntityNotFound(_0x5bdab5,null))[_0x2e00('0x27')](respondWithResult(_0x5bdab5,null))[_0x2e00('0x4a')](handleError(_0x5bdab5,null));};exports[_0x2e00('0x26')]=function(_0xf88f9b,_0x10b09c){return db[_0x2e00('0x35')]['find']({'where':{'id':_0xf88f9b[_0x2e00('0x4c')]['id']}})[_0x2e00('0x27')](handleEntityNotFound(_0x10b09c,null))[_0x2e00('0x27')](removeEntity(_0x10b09c,null))[_0x2e00('0x4a')](handleError(_0x10b09c,null));};exports[_0x2e00('0x50')]=function(_0x87f558,_0xf5ddff){if(_0x87f558[_0x2e00('0x51')][_0x2e00('0x2f')]===_0x2e00('0x52')&&!_[_0x2e00('0x53')](_0x87f558['body'][_0x2e00('0x54')],'_')){_0x87f558['body'][_0x2e00('0x54')]='_'[_0x2e00('0x55')](_0x87f558[_0x2e00('0x51')][_0x2e00('0x54')]);}return db[_0x2e00('0x35')][_0x2e00('0x50')](_0x87f558[_0x2e00('0x51')],{'raw':![]})[_0x2e00('0x27')](function(_0x23bad5){var _0xfc1e91=_0x87f558[_0x2e00('0x56')][_0x2e00('0x57')]({'plain':!![]});if(!_0xfc1e91)throw new Error(_0x2e00('0x58'));if(_0xfc1e91[_0x2e00('0x59')]==='user'){var _0x1165c4=_0x23bad5[_0x2e00('0x57')]({'plain':!![]});var _0x22c1e5=[{'name':_0x2e00('0x5a'),'value':'inbound'},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x2e00('0x29'),'value':_0x2e00('0x5b')}];var _0x28247c=_['find'](_0x22c1e5,[_0x2e00('0x2c'),_0x1165c4[_0x2e00('0x2f')]])[_0x2e00('0x30')];return db[_0x2e00('0x5c')][_0x2e00('0x2e')]({'where':{'name':_0x28247c,'userProfileId':_0xfc1e91[_0x2e00('0x5d')]},'raw':!![]})[_0x2e00('0x27')](function(_0x51ce71){if(_0x51ce71&&_0x51ce71[_0x2e00('0x5e')]===0x0){return db[_0x2e00('0x31')][_0x2e00('0x50')]({'name':_0x1165c4[_0x2e00('0x30')],'resourceId':_0x1165c4['id'],'type':_0x51ce71[_0x2e00('0x30')],'sectionId':_0x51ce71['id']},{})['then'](function(){return _0x23bad5;});}else{return _0x23bad5;}})[_0x2e00('0x4a')](function(_0x1e5ac5){logger['error'](_0x2e00('0x5f'),_0x1e5ac5);throw _0x1e5ac5;});}return _0x23bad5;})[_0x2e00('0x27')](respondWithResult(_0xf5ddff,0xc9))[_0x2e00('0x4a')](handleError(_0xf5ddff,null));};exports[_0x2e00('0x25')]=function(_0x47dff6,_0x1c9e9f){if(_0x47dff6[_0x2e00('0x51')]['id']){delete _0x47dff6['body']['id'];}return db[_0x2e00('0x35')][_0x2e00('0x2e')]({'where':{'id':_0x47dff6[_0x2e00('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1c9e9f,null))['then'](function(_0x5c35ba){if(_0x5c35ba){return db['VoiceExtension']['update'](_['pick'](_0x47dff6[_0x2e00('0x51')],[_0x2e00('0x54'),_0x2e00('0x60'),'description','recordingFormat','cutdigits',_0x2e00('0x61')]),{'where':{'context':_0x5c35ba['context'],'exten':_0x5c35ba[_0x2e00('0x54')]},'individualHooks':!![]})[_0x2e00('0x27')](function(_0x29700c){return _0x29700c;});}return null;})[_0x2e00('0x27')](respondWithStatusCode(_0x1c9e9f,null))[_0x2e00('0x4a')](handleError(_0x1c9e9f,null));};exports[_0x2e00('0x62')]=function(_0x423597,_0x322f2e,_0x402f7f){return db[_0x2e00('0x35')]['findOne']({'where':{'id':_0x423597[_0x2e00('0x4c')]['id']}})[_0x2e00('0x27')](handleEntityNotFound(_0x322f2e,null))[_0x2e00('0x27')](function(_0x102891){if(_0x102891){return db[_0x2e00('0x63')][_0x2e00('0x64')](function(_0x3dc5dd){return db[_0x2e00('0x35')][_0x2e00('0x26')]({'where':{'VoiceExtensionId':_0x423597[_0x2e00('0x4c')]['id']},'transaction':_0x3dc5dd})[_0x2e00('0x27')](function(_0x3d7600){var _0x14f0cb=_[_0x2e00('0x2b')](_0x423597[_0x2e00('0x51')],function(_0x5286e2){_0x5286e2[_0x2e00('0x65')]=_0x423597['params']['id'];return _0x5286e2;});return db[_0x2e00('0x35')][_0x2e00('0x66')](_0x14f0cb,{'transaction':_0x3dc5dd});});})[_0x2e00('0x27')](function(){return db[_0x2e00('0x35')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x423597[_0x2e00('0x4c')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})['then'](respondWithResult(_0x322f2e,null))['catch'](handleError(_0x322f2e,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 0c43bed..1b56421 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 _0xd6a7=['VoiceExtension','setMaxListeners','update','remove','emit','hook','exports','events'];(function(_0x5eb4db,_0x3fac39){var _0x3c880f=function(_0x4d51a3){while(--_0x4d51a3){_0x5eb4db['push'](_0x5eb4db['shift']());}};_0x3c880f(++_0x3fac39);}(_0xd6a7,0x18f));var _0x7d6a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd6a7[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require(_0x7d6a('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x7d6a('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x7d6a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7d6a('0x3'),'afterDestroy':_0x7d6a('0x4')};function emitEvent(_0x1138c2){return function(_0x266bb7,_0x531c88,_0x8e29db){VoiceExtensionEvents[_0x7d6a('0x5')](_0x1138c2+':'+_0x266bb7['id'],_0x266bb7);VoiceExtensionEvents[_0x7d6a('0x5')](_0x1138c2,_0x266bb7);_0x8e29db(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x7d6a('0x6')](e,emitEvent(event));}}module[_0x7d6a('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x5480=['hasOwnProperty','hook','events','../../mysqldb','VoiceExtension','update','emit'];(function(_0x23a6db,_0x3bc0cd){var _0x5e543e=function(_0x129de4){while(--_0x129de4){_0x23a6db['push'](_0x23a6db['shift']());}};_0x5e543e(++_0x3bc0cd);}(_0x5480,0x18a));var _0x0548=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5480[_0x432682];return _0x463d05;};'use strict';var EventEmitter=require(_0x0548('0x0'));var VoiceExtension=require(_0x0548('0x1'))['db'][_0x0548('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0548('0x3'),'afterDestroy':'remove'};function emitEvent(_0x473ab1){return function(_0x42fe2e,_0x4ebd5a,_0x474e1d){VoiceExtensionEvents[_0x0548('0x4')](_0x473ab1+':'+_0x42fe2e['id'],_0x42fe2e);VoiceExtensionEvents[_0x0548('0x4')](_0x473ab1,_0x42fe2e);_0x474e1d(null);};}for(var e in events){if(events[_0x0548('0x5')](e)){var event=events[e];VoiceExtension[_0x0548('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index fcfae3b..6ed0d5b 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 _0x5363=['path','rimraf','../../config/environment','./voiceExtension.attributes','VoiceExtension','voice_extensions','../../config/logger','api','moment','bluebird'];(function(_0xa1671c,_0x57700d){var _0x2107f0=function(_0x436e27){while(--_0x436e27){_0xa1671c['push'](_0xa1671c['shift']());}};_0x2107f0(++_0x57700d);}(_0x5363,0x146));var _0x3536=function(_0x5ca500,_0x51a7c6){_0x5ca500=_0x5ca500-0x0;var _0x5d9e92=_0x5363[_0x5ca500];return _0x5d9e92;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3536('0x0'))(_0x3536('0x1'));var moment=require(_0x3536('0x2'));var BPromise=require(_0x3536('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3536('0x4'));var rimraf=require(_0x3536('0x5'));var config=require(_0x3536('0x6'));var attributes=require(_0x3536('0x7'));module['exports']=function(_0x3d1b46,_0x5bca28){return _0x3d1b46['define'](_0x3536('0x8'),attributes,{'tableName':_0x3536('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfba6=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./voiceExtension.attributes','exports','VoiceExtension','voice_extensions','lodash'];(function(_0x5daab7,_0x1590e0){var _0x34d292=function(_0x41131c){while(--_0x41131c){_0x5daab7['push'](_0x5daab7['shift']());}};_0x34d292(++_0x1590e0);}(_0xfba6,0x8f));var _0x6fba=function(_0x4aac5a,_0x15b04c){_0x4aac5a=_0x4aac5a-0x0;var _0x42e7bc=_0xfba6[_0x4aac5a];return _0x42e7bc;};'use strict';var _=require(_0x6fba('0x0'));var util=require(_0x6fba('0x1'));var logger=require(_0x6fba('0x2'))(_0x6fba('0x3'));var moment=require(_0x6fba('0x4'));var BPromise=require('bluebird');var rp=require(_0x6fba('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6fba('0x6'));var config=require(_0x6fba('0x7'));var attributes=require(_0x6fba('0x8'));module[_0x6fba('0x9')]=function(_0x481bd6,_0x158d76){return _0x481bd6['define'](_0x6fba('0xa'),attributes,{'tableName':_0x6fba('0xb'),'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 5e833aa..76b0efe 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 _0x77a9=['limit','include','map','model','attributes','GetVoiceExtension','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','VoiceExtension','options','raw','where'];(function(_0x4eea5f,_0x32ef96){var _0x4a7b8e=function(_0x5c848e){while(--_0x5c848e){_0x4eea5f['push'](_0x4eea5f['shift']());}};_0x4a7b8e(++_0x32ef96);}(_0x77a9,0x154));var _0x977a=function(_0x3a62fd,_0xe43891){_0x3a62fd=_0x3a62fd-0x0;var _0x12d99b=_0x77a9[_0x3a62fd];return _0x12d99b;};'use strict';var _=require(_0x977a('0x0'));var util=require('util');var moment=require(_0x977a('0x1'));var BPromise=require(_0x977a('0x2'));var rs=require(_0x977a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x977a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x977a('0x5'))(_0x977a('0x6'));var config=require(_0x977a('0x7'));var jayson=require(_0x977a('0x8'));var client=jayson[_0x977a('0x9')][_0x977a('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x977a('0xb')],{'host':_0x977a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x977a('0xb')]));require('./voiceExtension.socket')[_0x977a('0xd')](socket);function respondWithRpcPromise(_0x1c0d7a,_0x5b4608,_0x3ab213){return new BPromise(function(_0x4e91bb,_0x1bde94){return client[_0x977a('0xe')](_0x1c0d7a,_0x3ab213)[_0x977a('0xf')](function(_0xba1cde){logger[_0x977a('0x10')](_0x977a('0x11'),_0x5b4608,_0x977a('0x12'));logger[_0x977a('0x13')](_0x977a('0x14'),_0x5b4608,_0x977a('0x12'),JSON[_0x977a('0x15')](_0xba1cde));if(_0xba1cde[_0x977a('0x16')]){if(_0xba1cde[_0x977a('0x16')][_0x977a('0x17')]===0x1f4){logger['error'](_0x977a('0x11'),_0x5b4608,_0xba1cde[_0x977a('0x16')]['message']);return _0x1bde94(_0xba1cde['error'][_0x977a('0x18')]);}logger[_0x977a('0x16')](_0x977a('0x11'),_0x5b4608,_0xba1cde['error'][_0x977a('0x18')]);return _0x4e91bb(_0xba1cde[_0x977a('0x16')][_0x977a('0x18')]);}else{logger[_0x977a('0x10')](_0x977a('0x11'),_0x5b4608,_0x977a('0x12'));_0x4e91bb(_0xba1cde[_0x977a('0x19')][_0x977a('0x18')]);}})['catch'](function(_0x57ddb5){logger['error'](_0x977a('0x11'),_0x5b4608,_0x57ddb5);_0x1bde94(_0x57ddb5);});});}exports['GetVoiceExtension']=function(_0x59ac40){var _0x391618=this;return new Promise(function(_0x325905,_0x33cc7b){return db[_0x977a('0x1a')]['findAll']({'raw':_0x59ac40[_0x977a('0x1b')]?_0x59ac40[_0x977a('0x1b')][_0x977a('0x1c')]===undefined?!![]:![]:!![],'where':_0x59ac40[_0x977a('0x1b')]?_0x59ac40[_0x977a('0x1b')][_0x977a('0x1d')]||null:null,'attributes':_0x59ac40[_0x977a('0x1b')]?_0x59ac40[_0x977a('0x1b')]['attributes']||null:null,'limit':_0x59ac40[_0x977a('0x1b')]?_0x59ac40[_0x977a('0x1b')][_0x977a('0x1e')]||null:null,'include':_0x59ac40['options']?_0x59ac40[_0x977a('0x1b')][_0x977a('0x1f')]?_[_0x977a('0x20')](_0x59ac40[_0x977a('0x1b')][_0x977a('0x1f')],function(_0x4d8cd4){return{'model':db[_0x4d8cd4[_0x977a('0x21')]],'as':_0x4d8cd4['as'],'attributes':_0x4d8cd4[_0x977a('0x22')],'include':_0x4d8cd4[_0x977a('0x1f')]?_['map'](_0x4d8cd4[_0x977a('0x1f')],function(_0x54479f){return{'model':db[_0x54479f[_0x977a('0x21')]],'as':_0x54479f['as'],'attributes':_0x54479f['attributes'],'include':_0x54479f[_0x977a('0x1f')]?_[_0x977a('0x20')](_0x54479f[_0x977a('0x1f')],function(_0x2077eb){return{'model':db[_0x2077eb[_0x977a('0x21')]],'as':_0x2077eb['as'],'attributes':_0x2077eb['attributes']};}):[]};}):[]};}):[]:[]})[_0x977a('0xf')](function(_0x4ac794){logger[_0x977a('0x10')](_0x977a('0x23'),_0x59ac40);logger['debug']('GetVoiceExtension',_0x59ac40,JSON['stringify'](_0x4ac794));_0x325905(_0x4ac794);})[_0x977a('0x24')](function(_0x577262){logger[_0x977a('0x16')](_0x977a('0x23'),_0x577262[_0x977a('0x18')],_0x59ac40);_0x33cc7b(_0x391618[_0x977a('0x16')](0x1f4,_0x577262['message']));});});}; \ No newline at end of file +var _0x4e76=['attributes','model','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','include','map'];(function(_0xa0f0d7,_0x32be9b){var _0x4b84d8=function(_0x4d6d7e){while(--_0x4d6d7e){_0xa0f0d7['push'](_0xa0f0d7['shift']());}};_0x4b84d8(++_0x32be9b);}(_0x4e76,0x72));var _0x64e7=function(_0x18c85d,_0x176d6b){_0x18c85d=_0x18c85d-0x0;var _0x4d94b3=_0x4e76[_0x18c85d];return _0x4d94b3;};'use strict';var _=require(_0x64e7('0x0'));var util=require(_0x64e7('0x1'));var moment=require(_0x64e7('0x2'));var BPromise=require('bluebird');var rs=require(_0x64e7('0x3'));var fs=require('fs');var Redis=require(_0x64e7('0x4'));var db=require(_0x64e7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x64e7('0x6'));var jayson=require(_0x64e7('0x7'));var client=jayson[_0x64e7('0x8')]['http']({'port':0x232a});config[_0x64e7('0x9')]=_[_0x64e7('0xa')](config[_0x64e7('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x64e7('0xb'))(new Redis(config['redis']));require(_0x64e7('0xc'))[_0x64e7('0xd')](socket);function respondWithRpcPromise(_0x8b8a73,_0x16fb69,_0x25f6e1){return new BPromise(function(_0x3bc545,_0x4f63a8){return client[_0x64e7('0xe')](_0x8b8a73,_0x25f6e1)[_0x64e7('0xf')](function(_0x36dc7f){logger[_0x64e7('0x10')](_0x64e7('0x11'),_0x16fb69,_0x64e7('0x12'));logger[_0x64e7('0x13')](_0x64e7('0x14'),_0x16fb69,_0x64e7('0x12'),JSON[_0x64e7('0x15')](_0x36dc7f));if(_0x36dc7f[_0x64e7('0x16')]){if(_0x36dc7f[_0x64e7('0x16')][_0x64e7('0x17')]===0x1f4){logger[_0x64e7('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x16fb69,_0x36dc7f[_0x64e7('0x16')][_0x64e7('0x18')]);return _0x4f63a8(_0x36dc7f['error'][_0x64e7('0x18')]);}logger[_0x64e7('0x16')](_0x64e7('0x11'),_0x16fb69,_0x36dc7f[_0x64e7('0x16')][_0x64e7('0x18')]);return _0x3bc545(_0x36dc7f[_0x64e7('0x16')]['message']);}else{logger[_0x64e7('0x10')](_0x64e7('0x11'),_0x16fb69,'request\x20sent');_0x3bc545(_0x36dc7f['result'][_0x64e7('0x18')]);}})['catch'](function(_0x4ef156){logger[_0x64e7('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x16fb69,_0x4ef156);_0x4f63a8(_0x4ef156);});});}exports[_0x64e7('0x19')]=function(_0x4412ec){var _0x515bda=this;return new Promise(function(_0x553e1f,_0x212089){return db[_0x64e7('0x1a')][_0x64e7('0x1b')]({'raw':_0x4412ec[_0x64e7('0x1c')]?_0x4412ec['options'][_0x64e7('0x1d')]===undefined?!![]:![]:!![],'where':_0x4412ec[_0x64e7('0x1c')]?_0x4412ec[_0x64e7('0x1c')][_0x64e7('0x1e')]||null:null,'attributes':_0x4412ec[_0x64e7('0x1c')]?_0x4412ec['options']['attributes']||null:null,'limit':_0x4412ec[_0x64e7('0x1c')]?_0x4412ec[_0x64e7('0x1c')][_0x64e7('0x1f')]||null:null,'include':_0x4412ec[_0x64e7('0x1c')]?_0x4412ec['options'][_0x64e7('0x20')]?_[_0x64e7('0x21')](_0x4412ec['options'][_0x64e7('0x20')],function(_0x236440){return{'model':db[_0x236440['model']],'as':_0x236440['as'],'attributes':_0x236440[_0x64e7('0x22')],'include':_0x236440[_0x64e7('0x20')]?_[_0x64e7('0x21')](_0x236440[_0x64e7('0x20')],function(_0x280479){return{'model':db[_0x280479[_0x64e7('0x23')]],'as':_0x280479['as'],'attributes':_0x280479[_0x64e7('0x22')],'include':_0x280479['include']?_[_0x64e7('0x21')](_0x280479[_0x64e7('0x20')],function(_0x111672){return{'model':db[_0x111672[_0x64e7('0x23')]],'as':_0x111672['as'],'attributes':_0x111672[_0x64e7('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x179b31){logger[_0x64e7('0x10')]('GetVoiceExtension',_0x4412ec);logger[_0x64e7('0x13')]('GetVoiceExtension',_0x4412ec,JSON[_0x64e7('0x15')](_0x179b31));_0x553e1f(_0x179b31);})[_0x64e7('0x24')](function(_0x54d69d){logger['error'](_0x64e7('0x19'),_0x54d69d[_0x64e7('0x18')],_0x4412ec);_0x212089(_0x515bda[_0x64e7('0x16')](0x1f4,_0x54d69d[_0x64e7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index da1c7e9..20586a4 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 _0x1ff2=['save','remove','update','removeListener','./voiceExtension.events'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x1ff2,0x1c6));var _0x21ff=function(_0x567e9b,_0x52757c){_0x567e9b=_0x567e9b-0x0;var _0x46b667=_0x1ff2[_0x567e9b];return _0x46b667;};'use strict';var VoiceExtensionEvents=require(_0x21ff('0x0'));var events=[_0x21ff('0x1'),_0x21ff('0x2'),_0x21ff('0x3')];function createListener(_0x2e9ae4,_0x2b0ac0){return function(_0x4cea64){_0x2b0ac0['emit'](_0x2e9ae4,_0x4cea64);};}function removeListener(_0x1872d5,_0x53000c){return function(){VoiceExtensionEvents[_0x21ff('0x4')](_0x1872d5,_0x53000c);};}exports['register']=function(_0x1a4f8f){for(var _0x2f54f5=0x0,_0x3b2de4=events['length'];_0x2f54f5<_0x3b2de4;_0x2f54f5++){var _0x38f03c=events[_0x2f54f5];var _0xd809b2=createListener('voiceExtension:'+_0x38f03c,_0x1a4f8f);VoiceExtensionEvents['on'](_0x38f03c,_0xd809b2);}}; \ No newline at end of file +var _0xe38a=['save','remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events'];(function(_0x2e2307,_0xdfdaac){var _0x1dd941=function(_0x1025ab){while(--_0x1025ab){_0x2e2307['push'](_0x2e2307['shift']());}};_0x1dd941(++_0xdfdaac);}(_0xe38a,0xa7));var _0xae38=function(_0x17158c,_0x58cb92){_0x17158c=_0x17158c-0x0;var _0x734f31=_0xe38a[_0x17158c];return _0x734f31;};'use strict';var VoiceExtensionEvents=require(_0xae38('0x0'));var events=[_0xae38('0x1'),_0xae38('0x2'),'update'];function createListener(_0x3353b4,_0x1b55e9){return function(_0x11a395){_0x1b55e9[_0xae38('0x3')](_0x3353b4,_0x11a395);};}function removeListener(_0x1477f,_0x5b56ac){return function(){VoiceExtensionEvents[_0xae38('0x4')](_0x1477f,_0x5b56ac);};}exports[_0xae38('0x5')]=function(_0x22d03a){for(var _0x50634b=0x0,_0x4830cf=events[_0xae38('0x6')];_0x50634b<_0x4830cf;_0x50634b++){var _0x586384=events[_0x50634b];var _0x4d9830=createListener(_0xae38('0x7')+_0x586384,_0x22d03a);VoiceExtensionEvents['on'](_0x586384,_0x4d9830);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 102880f..ac928c3 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 _0x3609=['../../components/interaction/service','../../config/environment','./voiceMail.controller','get','/:id','show','/:id/messages','isAuthenticated','getMessages','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2fd56e,_0x168395){var _0x8562e8=function(_0x2aa0e8){while(--_0x2aa0e8){_0x2fd56e['push'](_0x2fd56e['shift']());}};_0x8562e8(++_0x168395);}(_0x3609,0x101));var _0x9360=function(_0x29b6bd,_0x514696){_0x29b6bd=_0x29b6bd-0x0;var _0x100683=_0x3609[_0x29b6bd];return _0x100683;};'use strict';var multer=require(_0x9360('0x0'));var util=require(_0x9360('0x1'));var path=require(_0x9360('0x2'));var timeout=require(_0x9360('0x3'));var express=require(_0x9360('0x4'));var router=express[_0x9360('0x5')]();var fs_extra=require(_0x9360('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9360('0x7'));var config=require(_0x9360('0x8'));var controller=require(_0x9360('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9360('0xa')](_0x9360('0xb'),auth['isAuthenticated'](),controller[_0x9360('0xc')]);router[_0x9360('0xa')](_0x9360('0xd'),auth[_0x9360('0xe')](),controller[_0x9360('0xf')]);router[_0x9360('0x10')]('/',auth[_0x9360('0xe')](),controller[_0x9360('0x11')]);router['put']('/:id',auth[_0x9360('0xe')](),controller[_0x9360('0x12')]);router[_0x9360('0x13')]('/:id',auth[_0x9360('0xe')](),controller[_0x9360('0x14')]);module[_0x9360('0x15')]=router; \ No newline at end of file +var _0x082b=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getMessages','post','put','update','delete','destroy','exports','multer','util'];(function(_0x46869d,_0x4bf52f){var _0x5d3a0e=function(_0x4ed8d7){while(--_0x4ed8d7){_0x46869d['push'](_0x46869d['shift']());}};_0x5d3a0e(++_0x4bf52f);}(_0x082b,0x1ec));var _0xb082=function(_0x338b26,_0x45d064){_0x338b26=_0x338b26-0x0;var _0x21d9da=_0x082b[_0x338b26];return _0x21d9da;};'use strict';var multer=require(_0xb082('0x0'));var util=require(_0xb082('0x1'));var path=require(_0xb082('0x2'));var timeout=require(_0xb082('0x3'));var express=require('express');var router=express[_0xb082('0x4')]();var fs_extra=require(_0xb082('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb082('0x6'));var config=require(_0xb082('0x7'));var controller=require('./voiceMail.controller');router[_0xb082('0x8')]('/',auth[_0xb082('0x9')](),controller[_0xb082('0xa')]);router[_0xb082('0x8')]('/:id',auth[_0xb082('0x9')](),controller[_0xb082('0xb')]);router[_0xb082('0x8')]('/:id/messages',auth[_0xb082('0x9')](),controller[_0xb082('0xc')]);router[_0xb082('0xd')]('/',auth[_0xb082('0x9')](),controller['create']);router[_0xb082('0xe')]('/:id',auth[_0xb082('0x9')](),controller[_0xb082('0xf')]);router[_0xb082('0x10')]('/:id',auth[_0xb082('0x9')](),controller[_0xb082('0x11')]);module[_0xb082('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 4f23c4e..54c967f 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 _0x6324=['ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','mailbox','sequelize','exports','STRING','contest_mailbox','setDataValue','email','string','trim'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x6324,0x142));var _0x4632=function(_0x9e575,_0x5894d4){_0x9e575=_0x9e575-0x0;var _0x522277=_0x6324[_0x9e575];return _0x522277;};'use strict';var Sequelize=require(_0x4632('0x0'));module[_0x4632('0x1')]={'customer_id':{'type':Sequelize[_0x4632('0x2')]},'context':{'type':Sequelize[_0x4632('0x2')],'defaultValue':'from-voicemail','unique':_0x4632('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x4632('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x4632('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x140bc7){this[_0x4632('0x4')](_0x4632('0x5'),typeof _0x140bc7===_0x4632('0x6')&&_0x140bc7['trim']()?_0x140bc7[_0x4632('0x7')]():null);}},'pager':{'type':Sequelize[_0x4632('0x2')]},'tz':{'type':Sequelize[_0x4632('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x4632('0x8')](_0x4632('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x4632('0x9'),'no'),'defaultValue':_0x4632('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x4632('0x2')]},'callback':{'type':Sequelize[_0x4632('0x2')]},'review':{'type':Sequelize[_0x4632('0x8')](_0x4632('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x4632('0x8')](_0x4632('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x4632('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x4632('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x4632('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x4632('0x8')](_0x4632('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x4632('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x4632('0x8')](_0x4632('0x9'),'no'),'defaultValue':_0x4632('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x4632('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x4632('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x4632('0x8')](_0x4632('0x9'),'no'),'defaultValue':_0x4632('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x4632('0x2')]},'emailbody':{'type':Sequelize[_0x4632('0x2')]},'maxsecs':{'type':Sequelize[_0x4632('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x4632('0xc')],'get':function(){return this[_0x4632('0xd')]('fullname')+'\x20-\x20'+this[_0x4632('0xd')](_0x4632('0xe'));}}}; \ No newline at end of file +var _0x4213=['trim','central','yes','ENUM','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email'];(function(_0x42f840,_0x1aa32e){var _0x47539f=function(_0x390a4b){while(--_0x390a4b){_0x42f840['push'](_0x42f840['shift']());}};_0x47539f(++_0x1aa32e);}(_0x4213,0x77));var _0x3421=function(_0x25ba51,_0x46af47){_0x25ba51=_0x25ba51-0x0;var _0x2466d4=_0x4213[_0x25ba51];return _0x2466d4;};'use strict';var Sequelize=require(_0x3421('0x0'));module[_0x3421('0x1')]={'customer_id':{'type':Sequelize[_0x3421('0x2')]},'context':{'type':Sequelize[_0x3421('0x2')],'defaultValue':_0x3421('0x3'),'unique':_0x3421('0x4')},'mailbox':{'type':Sequelize[_0x3421('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x3421('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3421('0x2')],'validate':{'isEmail':!![]},'set':function(_0xfe969c){this[_0x3421('0x5')](_0x3421('0x6'),typeof _0xfe969c==='string'&&_0xfe969c[_0x3421('0x7')]()?_0xfe969c[_0x3421('0x7')]():null);}},'pager':{'type':Sequelize[_0x3421('0x2')]},'tz':{'type':Sequelize[_0x3421('0x2')],'defaultValue':_0x3421('0x8')},'attach':{'type':Sequelize['ENUM'](_0x3421('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x3421('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x3421('0x2')]},'callback':{'type':Sequelize[_0x3421('0x2')]},'review':{'type':Sequelize[_0x3421('0xa')](_0x3421('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3421('0xa')](_0x3421('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3421('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3421('0xa')](_0x3421('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3421('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3421('0xa')](_0x3421('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x3421('0xa')](_0x3421('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x3421('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x3421('0xa')](_0x3421('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x3421('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x3421('0x9'),'no'),'defaultValue':_0x3421('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x3421('0x2')]},'emailbody':{'type':Sequelize[_0x3421('0x2')]},'maxsecs':{'type':Sequelize[_0x3421('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x3421('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x3421('0xd')],'get':function(){return this[_0x3421('0xe')](_0x3421('0xf'))+_0x3421('0x10')+this[_0x3421('0xe')](_0x3421('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 78c269a..568b2e7 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 _0x46a4=['rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','merge','where','VIRTUAL','filter','includeAll','include','rows','catch','show','options','find','create','body','get','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','mailbox','findAndCountAll','eml-format','rimraf','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','update','destroy','then','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail'];(function(_0x3ffa62,_0x3f51cc){var _0x5a114d=function(_0x24afd0){while(--_0x24afd0){_0x3ffa62['push'](_0x3ffa62['shift']());}};_0x5a114d(++_0x3f51cc);}(_0x46a4,0x190));var _0x446a=function(_0xdf2da3,_0x14bc27){_0xdf2da3=_0xdf2da3-0x0;var _0x29c48c=_0x46a4[_0xdf2da3];return _0x29c48c;};'use strict';var emlformat=require(_0x446a('0x0'));var rimraf=require(_0x446a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x446a('0x2'));var rp=require(_0x446a('0x3'));var moment=require(_0x446a('0x4'));var BPromise=require(_0x446a('0x5'));var Mustache=require(_0x446a('0x6'));var util=require(_0x446a('0x7'));var path=require(_0x446a('0x8'));var sox=require('sox');var csv=require(_0x446a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x446a('0xa'));var _=require(_0x446a('0xb'));var squel=require(_0x446a('0xc'));var crypto=require(_0x446a('0xd'));var jsforce=require(_0x446a('0xe'));var deskjs=require(_0x446a('0xf'));var toCsv=require(_0x446a('0x9'));var querystring=require(_0x446a('0x10'));var Papa=require(_0x446a('0x11'));var Redis=require(_0x446a('0x12'));var authService=require(_0x446a('0x13'));var qs=require(_0x446a('0x14'));var as=require(_0x446a('0x15'));var hardwareService=require(_0x446a('0x16'));var logger=require(_0x446a('0x17'))(_0x446a('0x18'));var utils=require(_0x446a('0x19'));var config=require(_0x446a('0x1a'));var licenseUtil=require(_0x446a('0x1b'));var db=require(_0x446a('0x1c'))['db'];function respondWithStatusCode(_0xbfb43c,_0x20f2d7){_0x20f2d7=_0x20f2d7||0xcc;return function(_0x3dde48){if(_0x3dde48){return _0xbfb43c[_0x446a('0x1d')](_0x20f2d7);}return _0xbfb43c[_0x446a('0x1e')](_0x20f2d7)[_0x446a('0x1f')]();};}function respondWithResult(_0x52ea3f,_0x5bdae6){_0x5bdae6=_0x5bdae6||0xc8;return function(_0x160f6f){if(_0x160f6f){return _0x52ea3f[_0x446a('0x1e')](_0x5bdae6)[_0x446a('0x20')](_0x160f6f);}};}function respondWithFilteredResult(_0x2a1bb1,_0x8fbac0){return function(_0x1a62a7){if(_0x1a62a7){var _0x434c3f=_0x1a62a7[_0x446a('0x21')],_0x5e70d9=_0x8fbac0[_0x446a('0x22')],_0x9360e9=_0x8fbac0[_0x446a('0x22')]+_0x8fbac0['limit'],_0x3c879e;if(_0x9360e9>=_0x434c3f){_0x9360e9=_0x434c3f;_0x3c879e=0xc8;}else{_0x3c879e=0xce;}_0x2a1bb1[_0x446a('0x1e')](_0x3c879e);return _0x2a1bb1[_0x446a('0x23')]('Content-Range',_0x5e70d9+'-'+_0x9360e9+'/'+_0x434c3f)[_0x446a('0x20')](_0x1a62a7);}return null;};}function patchUpdates(_0x3b5460){return function(_0xbe272e){try{jsonpatch[_0x446a('0x24')](_0xbe272e,_0x3b5460,!![]);}catch(_0x119577){return BPromise[_0x446a('0x25')](_0x119577);}return _0xbe272e['save']();};}function saveUpdates(_0x55df04,_0x16d8b1){return function(_0xff40d1){if(_0xff40d1){return _0xff40d1[_0x446a('0x26')](_0x55df04)['then'](function(_0x13f3e5){return _0x13f3e5;});}return null;};}function removeEntity(_0x25ed06,_0x2c18b1){return function(_0x4bf97c){if(_0x4bf97c){return _0x4bf97c[_0x446a('0x27')]()[_0x446a('0x28')](function(){var _0x7a7952=_0x4bf97c['get']({'plain':!![]});var _0x5d81f6=_0x446a('0x29');return db[_0x446a('0x2a')][_0x446a('0x27')]({'where':{'type':_0x5d81f6,'resourceId':_0x7a7952['id']}})[_0x446a('0x28')](function(){return _0x4bf97c;});})[_0x446a('0x28')](function(){_0x25ed06[_0x446a('0x1e')](0xcc)[_0x446a('0x1f')]();});}};}function handleEntityNotFound(_0x4a055a,_0x1a8952){return function(_0x2e987c){if(!_0x2e987c){_0x4a055a[_0x446a('0x1d')](0x194);}return _0x2e987c;};}function handleError(_0x12626c,_0x221b35){_0x221b35=_0x221b35||0x1f4;return function(_0x119aba){logger[_0x446a('0x2b')](_0x119aba[_0x446a('0x2c')]);if(_0x119aba[_0x446a('0x2d')]){delete _0x119aba[_0x446a('0x2d')];}_0x12626c[_0x446a('0x1e')](_0x221b35)[_0x446a('0x2e')](_0x119aba);};}exports[_0x446a('0x2f')]=function(_0x3063f6,_0x6e69d1){var _0x5a191a={},_0x5642f7={},_0x5d39df={'count':0x0,'rows':[]};var _0x18da40=_[_0x446a('0x30')](db[_0x446a('0x31')][_0x446a('0x32')],function(_0x16c94e){return{'name':_0x16c94e[_0x446a('0x33')],'type':_0x16c94e[_0x446a('0x34')]['key']};});_0x5642f7[_0x446a('0x35')]=_['map'](_0x18da40,_0x446a('0x2d'));_0x5642f7[_0x446a('0x36')]=_[_0x446a('0x37')](_0x3063f6['query']);_0x5642f7['filters']=_[_0x446a('0x38')](_0x5642f7[_0x446a('0x35')],_0x5642f7['query']);_0x5a191a[_0x446a('0x39')]=_[_0x446a('0x38')](_0x5642f7['model'],qs['fields'](_0x3063f6[_0x446a('0x36')][_0x446a('0x3a')]));_0x5a191a[_0x446a('0x39')]=_0x5a191a[_0x446a('0x39')][_0x446a('0x3b')]?_0x5a191a[_0x446a('0x39')]:_0x5642f7[_0x446a('0x35')];if(!_0x3063f6['query'][_0x446a('0x3c')](_0x446a('0x3d'))){_0x5a191a[_0x446a('0x3e')]=qs[_0x446a('0x3e')](_0x3063f6[_0x446a('0x36')][_0x446a('0x3e')]);_0x5a191a[_0x446a('0x22')]=qs['offset'](_0x3063f6[_0x446a('0x36')][_0x446a('0x22')]);}_0x5a191a[_0x446a('0x3f')]=qs['sort'](_0x3063f6[_0x446a('0x36')][_0x446a('0x40')]);_0x5a191a['where']=qs[_0x446a('0x41')](_[_0x446a('0x42')](_0x3063f6[_0x446a('0x36')],_0x5642f7['filters']),_0x18da40);if(_0x3063f6[_0x446a('0x36')]['filter']){_0x5a191a['where']=_[_0x446a('0x43')](_0x5a191a[_0x446a('0x44')],{'$or':_['map'](_0x18da40,function(_0x237742){if(_0x237742[_0x446a('0x34')]!==_0x446a('0x45')){var _0x456882={};_0x456882[_0x237742[_0x446a('0x2d')]]={'$like':'%'+_0x3063f6['query'][_0x446a('0x46')]+'%'};return _0x456882;}})});}_0x5a191a=_[_0x446a('0x43')]({},_0x5a191a,_0x3063f6['options']);var _0x43a4d7={'where':_0x5a191a[_0x446a('0x44')]};return db[_0x446a('0x31')][_0x446a('0x21')](_0x43a4d7)[_0x446a('0x28')](function(_0x5b15f9){_0x5d39df[_0x446a('0x21')]=_0x5b15f9;if(_0x3063f6[_0x446a('0x36')][_0x446a('0x47')]){_0x5a191a[_0x446a('0x48')]=[{'all':!![]}];}return db[_0x446a('0x31')]['findAll'](_0x5a191a);})[_0x446a('0x28')](function(_0x41bf19){_0x5d39df[_0x446a('0x49')]=_0x41bf19;return _0x5d39df;})[_0x446a('0x28')](respondWithFilteredResult(_0x6e69d1,_0x5a191a))[_0x446a('0x4a')](handleError(_0x6e69d1,null));};exports[_0x446a('0x4b')]=function(_0xccd1f7,_0x2d74f9){var _0x2cdcc3={'raw':!![],'where':{'id':_0xccd1f7['params']['id']}},_0x567c1c={};_0x567c1c[_0x446a('0x35')]=_[_0x446a('0x37')](db[_0x446a('0x31')]['rawAttributes']);_0x567c1c['query']=_[_0x446a('0x37')](_0xccd1f7[_0x446a('0x36')]);_0x567c1c[_0x446a('0x41')]=_[_0x446a('0x38')](_0x567c1c[_0x446a('0x35')],_0x567c1c['query']);_0x2cdcc3[_0x446a('0x39')]=_['intersection'](_0x567c1c['model'],qs[_0x446a('0x3a')](_0xccd1f7['query']['fields']));_0x2cdcc3['attributes']=_0x2cdcc3[_0x446a('0x39')][_0x446a('0x3b')]?_0x2cdcc3[_0x446a('0x39')]:_0x567c1c[_0x446a('0x35')];if(_0xccd1f7[_0x446a('0x36')][_0x446a('0x47')]){_0x2cdcc3[_0x446a('0x48')]=[{'all':!![]}];}_0x2cdcc3=_[_0x446a('0x43')]({},_0x2cdcc3,_0xccd1f7[_0x446a('0x4c')]);return db[_0x446a('0x31')][_0x446a('0x4d')](_0x2cdcc3)[_0x446a('0x28')](handleEntityNotFound(_0x2d74f9,null))[_0x446a('0x28')](respondWithResult(_0x2d74f9,null))[_0x446a('0x4a')](handleError(_0x2d74f9,null));};exports[_0x446a('0x4e')]=function(_0x5ae394,_0xbb0545){return db[_0x446a('0x31')][_0x446a('0x4e')](_0x5ae394[_0x446a('0x4f')],{})['then'](function(_0x2eb966){var _0xeacedd=_0x5ae394['user'][_0x446a('0x50')]({'plain':!![]});if(!_0xeacedd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xeacedd['role']===_0x446a('0x51')){var _0x257bae=_0x2eb966[_0x446a('0x50')]({'plain':!![]});var _0x573a1f=_0x446a('0x29');return db[_0x446a('0x52')]['find']({'where':{'name':_0x573a1f,'userProfileId':_0xeacedd[_0x446a('0x53')]},'raw':!![]})[_0x446a('0x28')](function(_0x168eca){if(_0x168eca&&_0x168eca[_0x446a('0x54')]===0x0){return db[_0x446a('0x2a')][_0x446a('0x4e')]({'name':_0x257bae[_0x446a('0x2d')],'resourceId':_0x257bae['id'],'type':_0x168eca[_0x446a('0x2d')],'sectionId':_0x168eca['id']},{})['then'](function(){return _0x2eb966;});}else{return _0x2eb966;}})[_0x446a('0x4a')](function(_0x2b69a1){logger[_0x446a('0x2b')](_0x446a('0x55'),_0x2b69a1);throw _0x2b69a1;});}return _0x2eb966;})[_0x446a('0x28')](respondWithResult(_0xbb0545,0xc9))[_0x446a('0x4a')](handleError(_0xbb0545,null));};exports[_0x446a('0x26')]=function(_0x43b304,_0x34ce21){if(_0x43b304['body']['id']){delete _0x43b304[_0x446a('0x4f')]['id'];}return db[_0x446a('0x31')][_0x446a('0x4d')]({'where':{'id':_0x43b304[_0x446a('0x56')]['id']}})[_0x446a('0x28')](handleEntityNotFound(_0x34ce21,null))[_0x446a('0x28')](saveUpdates(_0x43b304[_0x446a('0x4f')],null))[_0x446a('0x28')](respondWithResult(_0x34ce21,null))[_0x446a('0x4a')](handleError(_0x34ce21,null));};exports[_0x446a('0x27')]=function(_0x397954,_0x75ccd3){return db[_0x446a('0x31')][_0x446a('0x4d')]({'where':{'id':_0x397954['params']['id']}})[_0x446a('0x28')](handleEntityNotFound(_0x75ccd3,null))[_0x446a('0x28')](removeEntity(_0x75ccd3,null))[_0x446a('0x4a')](handleError(_0x75ccd3,null));};exports[_0x446a('0x57')]=function(_0x4409b2,_0x523de7,_0x444f3b){return db['VoiceMail']['findOne']({'where':{'id':_0x4409b2['params']['id']}})[_0x446a('0x28')](handleEntityNotFound(_0x523de7,null))[_0x446a('0x28')](function(_0x4e23ee){var _0x202ab0;var _0x23fbd9={},_0x2682ee={};_0x2682ee[_0x446a('0x35')]=_[_0x446a('0x37')](db['VoiceMailMessage'][_0x446a('0x32')]);_0x2682ee[_0x446a('0x36')]=_[_0x446a('0x37')](_0x4409b2['query']);_0x2682ee['filters']=_[_0x446a('0x38')](_0x2682ee[_0x446a('0x35')],_0x2682ee[_0x446a('0x36')]);_0x23fbd9[_0x446a('0x39')]=_['intersection'](_0x2682ee[_0x446a('0x35')],qs[_0x446a('0x3a')](_0x4409b2['query']['fields']));_0x23fbd9[_0x446a('0x39')]=_0x23fbd9[_0x446a('0x39')][_0x446a('0x3b')]?_0x23fbd9['attributes']:_0x2682ee[_0x446a('0x35')];if(!_0x4409b2[_0x446a('0x36')][_0x446a('0x3c')]('nolimit')){_0x23fbd9['limit']=qs['limit'](_0x4409b2[_0x446a('0x36')][_0x446a('0x3e')]);_0x23fbd9[_0x446a('0x22')]=qs[_0x446a('0x22')](_0x4409b2[_0x446a('0x36')]['offset']);}_0x23fbd9[_0x446a('0x3f')]=qs[_0x446a('0x40')](_0x4409b2[_0x446a('0x36')][_0x446a('0x40')]);_0x23fbd9[_0x446a('0x44')]=qs[_0x446a('0x41')](_[_0x446a('0x42')](_0x4409b2[_0x446a('0x36')],_0x2682ee[_0x446a('0x41')]));if(_0x4409b2['query'][_0x446a('0x46')]){_0x23fbd9[_0x446a('0x44')]=_[_0x446a('0x43')](_0x23fbd9[_0x446a('0x44')],{'$or':_['map'](_0x23fbd9['attributes'],function(_0x2b47fc){var _0xc40704={};_0xc40704[_0x2b47fc]={'$like':'%'+_0x4409b2['query']['filter']+'%'};return _0xc40704;})});}_0x23fbd9[_0x446a('0x44')]=_[_0x446a('0x43')](_0x23fbd9['where'],{'mailboxuser':_0x4e23ee[_0x446a('0x58')]});_0x23fbd9=_[_0x446a('0x43')]({},_0x23fbd9,_0x4409b2[_0x446a('0x4c')]);return db['VoiceMailMessage'][_0x446a('0x59')](_0x23fbd9)[_0x446a('0x28')](respondWithFilteredResult(_0x523de7,_0x23fbd9));})[_0x446a('0x4a')](handleError(_0x523de7,null));}; \ No newline at end of file +var _0xae1a=['json','apply','reject','save','update','then','get','Voicemails','UserProfileResource','stack','name','send','index','VoiceMail','fieldName','type','model','map','query','keys','intersection','length','attributes','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','fields','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','getMessages','hasOwnProperty','order','VoiceMailMessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range'];(function(_0xf4c077,_0x2f30dc){var _0x28a7fe=function(_0x3faa50){while(--_0x3faa50){_0xf4c077['push'](_0xf4c077['shift']());}};_0x28a7fe(++_0x2f30dc);}(_0xae1a,0x19f));var _0xaae1=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xae1a[_0x92c450];return _0x2a9599;};'use strict';var emlformat=require(_0xaae1('0x0'));var rimraf=require(_0xaae1('0x1'));var zipdir=require(_0xaae1('0x2'));var jsonpatch=require(_0xaae1('0x3'));var rp=require(_0xaae1('0x4'));var moment=require(_0xaae1('0x5'));var BPromise=require(_0xaae1('0x6'));var Mustache=require('mustache');var util=require(_0xaae1('0x7'));var path=require('path');var sox=require(_0xaae1('0x8'));var csv=require(_0xaae1('0x9'));var ejs=require(_0xaae1('0xa'));var fs=require('fs');var fs_extra=require(_0xaae1('0xb'));var _=require(_0xaae1('0xc'));var squel=require(_0xaae1('0xd'));var crypto=require(_0xaae1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xaae1('0xf'));var toCsv=require('to-csv');var querystring=require(_0xaae1('0x10'));var Papa=require(_0xaae1('0x11'));var Redis=require('ioredis');var authService=require(_0xaae1('0x12'));var qs=require(_0xaae1('0x13'));var as=require(_0xaae1('0x14'));var hardwareService=require(_0xaae1('0x15'));var logger=require('../../config/logger')(_0xaae1('0x16'));var utils=require(_0xaae1('0x17'));var config=require(_0xaae1('0x18'));var licenseUtil=require(_0xaae1('0x19'));var db=require(_0xaae1('0x1a'))['db'];function respondWithStatusCode(_0x529042,_0x5f0f8e){_0x5f0f8e=_0x5f0f8e||0xcc;return function(_0x1d62a1){if(_0x1d62a1){return _0x529042[_0xaae1('0x1b')](_0x5f0f8e);}return _0x529042[_0xaae1('0x1c')](_0x5f0f8e)[_0xaae1('0x1d')]();};}function respondWithResult(_0x2d0d49,_0x34eecf){_0x34eecf=_0x34eecf||0xc8;return function(_0x14fe21){if(_0x14fe21){return _0x2d0d49[_0xaae1('0x1c')](_0x34eecf)['json'](_0x14fe21);}};}function respondWithFilteredResult(_0x163e8d,_0x63c14b){return function(_0xaa9ccd){if(_0xaa9ccd){var _0x4d9851=_0xaa9ccd[_0xaae1('0x1e')],_0x59963c=_0x63c14b[_0xaae1('0x1f')],_0x59daef=_0x63c14b['offset']+_0x63c14b[_0xaae1('0x20')],_0x50bc7e;if(_0x59daef>=_0x4d9851){_0x59daef=_0x4d9851;_0x50bc7e=0xc8;}else{_0x50bc7e=0xce;}_0x163e8d['status'](_0x50bc7e);return _0x163e8d[_0xaae1('0x21')](_0xaae1('0x22'),_0x59963c+'-'+_0x59daef+'/'+_0x4d9851)[_0xaae1('0x23')](_0xaa9ccd);}return null;};}function patchUpdates(_0x3e0ea5){return function(_0x58d1b1){try{jsonpatch[_0xaae1('0x24')](_0x58d1b1,_0x3e0ea5,!![]);}catch(_0x36dcd6){return BPromise[_0xaae1('0x25')](_0x36dcd6);}return _0x58d1b1[_0xaae1('0x26')]();};}function saveUpdates(_0x475d9a,_0x1e8d59){return function(_0x22a653){if(_0x22a653){return _0x22a653[_0xaae1('0x27')](_0x475d9a)[_0xaae1('0x28')](function(_0x1342cd){return _0x1342cd;});}return null;};}function removeEntity(_0x2dd53a,_0x199ff2){return function(_0x223172){if(_0x223172){return _0x223172['destroy']()['then'](function(){var _0x39b1ab=_0x223172[_0xaae1('0x29')]({'plain':!![]});var _0x482510=_0xaae1('0x2a');return db[_0xaae1('0x2b')]['destroy']({'where':{'type':_0x482510,'resourceId':_0x39b1ab['id']}})['then'](function(){return _0x223172;});})[_0xaae1('0x28')](function(){_0x2dd53a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44cf28,_0x17d1ed){return function(_0x3d0ae6){if(!_0x3d0ae6){_0x44cf28['sendStatus'](0x194);}return _0x3d0ae6;};}function handleError(_0x2826d0,_0x3b8a3f){_0x3b8a3f=_0x3b8a3f||0x1f4;return function(_0x6ed564){logger['error'](_0x6ed564[_0xaae1('0x2c')]);if(_0x6ed564[_0xaae1('0x2d')]){delete _0x6ed564[_0xaae1('0x2d')];}_0x2826d0[_0xaae1('0x1c')](_0x3b8a3f)[_0xaae1('0x2e')](_0x6ed564);};}exports[_0xaae1('0x2f')]=function(_0x3f685d,_0x3a2d43){var _0x4b2324={},_0xc0d021={},_0x10816b={'count':0x0,'rows':[]};var _0x34cf20=_['map'](db[_0xaae1('0x30')]['rawAttributes'],function(_0x405830){return{'name':_0x405830[_0xaae1('0x31')],'type':_0x405830[_0xaae1('0x32')]['key']};});_0xc0d021[_0xaae1('0x33')]=_[_0xaae1('0x34')](_0x34cf20,_0xaae1('0x2d'));_0xc0d021[_0xaae1('0x35')]=_[_0xaae1('0x36')](_0x3f685d['query']);_0xc0d021['filters']=_['intersection'](_0xc0d021['model'],_0xc0d021['query']);_0x4b2324['attributes']=_[_0xaae1('0x37')](_0xc0d021['model'],qs['fields'](_0x3f685d['query']['fields']));_0x4b2324['attributes']=_0x4b2324['attributes'][_0xaae1('0x38')]?_0x4b2324[_0xaae1('0x39')]:_0xc0d021[_0xaae1('0x33')];if(!_0x3f685d[_0xaae1('0x35')]['hasOwnProperty'](_0xaae1('0x3a'))){_0x4b2324['limit']=qs[_0xaae1('0x20')](_0x3f685d[_0xaae1('0x35')][_0xaae1('0x20')]);_0x4b2324['offset']=qs[_0xaae1('0x1f')](_0x3f685d[_0xaae1('0x35')][_0xaae1('0x1f')]);}_0x4b2324['order']=qs[_0xaae1('0x3b')](_0x3f685d[_0xaae1('0x35')][_0xaae1('0x3b')]);_0x4b2324[_0xaae1('0x3c')]=qs[_0xaae1('0x3d')](_[_0xaae1('0x3e')](_0x3f685d[_0xaae1('0x35')],_0xc0d021['filters']),_0x34cf20);if(_0x3f685d[_0xaae1('0x35')][_0xaae1('0x3f')]){_0x4b2324['where']=_[_0xaae1('0x40')](_0x4b2324[_0xaae1('0x3c')],{'$or':_[_0xaae1('0x34')](_0x34cf20,function(_0x56d830){if(_0x56d830['type']!==_0xaae1('0x41')){var _0x32e3d5={};_0x32e3d5[_0x56d830[_0xaae1('0x2d')]]={'$like':'%'+_0x3f685d[_0xaae1('0x35')][_0xaae1('0x3f')]+'%'};return _0x32e3d5;}})});}_0x4b2324=_[_0xaae1('0x40')]({},_0x4b2324,_0x3f685d[_0xaae1('0x42')]);var _0x401d24={'where':_0x4b2324[_0xaae1('0x3c')]};return db[_0xaae1('0x30')]['count'](_0x401d24)[_0xaae1('0x28')](function(_0x54206c){_0x10816b[_0xaae1('0x1e')]=_0x54206c;if(_0x3f685d[_0xaae1('0x35')][_0xaae1('0x43')]){_0x4b2324[_0xaae1('0x44')]=[{'all':!![]}];}return db[_0xaae1('0x30')][_0xaae1('0x45')](_0x4b2324);})[_0xaae1('0x28')](function(_0x23d194){_0x10816b[_0xaae1('0x46')]=_0x23d194;return _0x10816b;})[_0xaae1('0x28')](respondWithFilteredResult(_0x3a2d43,_0x4b2324))[_0xaae1('0x47')](handleError(_0x3a2d43,null));};exports[_0xaae1('0x48')]=function(_0xdbcda,_0x3eb084){var _0x106317={'raw':!![],'where':{'id':_0xdbcda['params']['id']}},_0x35974b={};_0x35974b[_0xaae1('0x33')]=_[_0xaae1('0x36')](db[_0xaae1('0x30')][_0xaae1('0x49')]);_0x35974b[_0xaae1('0x35')]=_[_0xaae1('0x36')](_0xdbcda[_0xaae1('0x35')]);_0x35974b[_0xaae1('0x3d')]=_['intersection'](_0x35974b[_0xaae1('0x33')],_0x35974b[_0xaae1('0x35')]);_0x106317['attributes']=_['intersection'](_0x35974b['model'],qs[_0xaae1('0x4a')](_0xdbcda['query'][_0xaae1('0x4a')]));_0x106317[_0xaae1('0x39')]=_0x106317[_0xaae1('0x39')][_0xaae1('0x38')]?_0x106317[_0xaae1('0x39')]:_0x35974b[_0xaae1('0x33')];if(_0xdbcda['query'][_0xaae1('0x43')]){_0x106317[_0xaae1('0x44')]=[{'all':!![]}];}_0x106317=_[_0xaae1('0x40')]({},_0x106317,_0xdbcda['options']);return db[_0xaae1('0x30')][_0xaae1('0x4b')](_0x106317)[_0xaae1('0x28')](handleEntityNotFound(_0x3eb084,null))[_0xaae1('0x28')](respondWithResult(_0x3eb084,null))['catch'](handleError(_0x3eb084,null));};exports[_0xaae1('0x4c')]=function(_0x36aac6,_0xf54353){return db[_0xaae1('0x30')]['create'](_0x36aac6['body'],{})['then'](function(_0x58b2f5){var _0x4d6bbc=_0x36aac6[_0xaae1('0x4d')][_0xaae1('0x29')]({'plain':!![]});if(!_0x4d6bbc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d6bbc[_0xaae1('0x4e')]==='user'){var _0x4efe2c=_0x58b2f5[_0xaae1('0x29')]({'plain':!![]});var _0x4ef91e=_0xaae1('0x2a');return db[_0xaae1('0x4f')][_0xaae1('0x4b')]({'where':{'name':_0x4ef91e,'userProfileId':_0x4d6bbc[_0xaae1('0x50')]},'raw':!![]})['then'](function(_0x4d2bc0){if(_0x4d2bc0&&_0x4d2bc0[_0xaae1('0x51')]===0x0){return db[_0xaae1('0x2b')][_0xaae1('0x4c')]({'name':_0x4efe2c['name'],'resourceId':_0x4efe2c['id'],'type':_0x4d2bc0[_0xaae1('0x2d')],'sectionId':_0x4d2bc0['id']},{})[_0xaae1('0x28')](function(){return _0x58b2f5;});}else{return _0x58b2f5;}})[_0xaae1('0x47')](function(_0x375451){logger[_0xaae1('0x52')](_0xaae1('0x53'),_0x375451);throw _0x375451;});}return _0x58b2f5;})['then'](respondWithResult(_0xf54353,0xc9))['catch'](handleError(_0xf54353,null));};exports[_0xaae1('0x27')]=function(_0x195490,_0x20e4dd){if(_0x195490[_0xaae1('0x54')]['id']){delete _0x195490[_0xaae1('0x54')]['id'];}return db[_0xaae1('0x30')]['find']({'where':{'id':_0x195490['params']['id']}})[_0xaae1('0x28')](handleEntityNotFound(_0x20e4dd,null))['then'](saveUpdates(_0x195490[_0xaae1('0x54')],null))['then'](respondWithResult(_0x20e4dd,null))[_0xaae1('0x47')](handleError(_0x20e4dd,null));};exports['destroy']=function(_0x5e414c,_0x2e2fed){return db[_0xaae1('0x30')]['find']({'where':{'id':_0x5e414c[_0xaae1('0x55')]['id']}})[_0xaae1('0x28')](handleEntityNotFound(_0x2e2fed,null))['then'](removeEntity(_0x2e2fed,null))['catch'](handleError(_0x2e2fed,null));};exports[_0xaae1('0x56')]=function(_0xf686e9,_0x54ef82,_0x12e531){return db[_0xaae1('0x30')]['findOne']({'where':{'id':_0xf686e9[_0xaae1('0x55')]['id']}})[_0xaae1('0x28')](handleEntityNotFound(_0x54ef82,null))['then'](function(_0x2a44bb){var _0x35f57f;var _0x4da28b={},_0x2f2107={};_0x2f2107[_0xaae1('0x33')]=_[_0xaae1('0x36')](db['VoiceMailMessage'][_0xaae1('0x49')]);_0x2f2107[_0xaae1('0x35')]=_['keys'](_0xf686e9[_0xaae1('0x35')]);_0x2f2107[_0xaae1('0x3d')]=_[_0xaae1('0x37')](_0x2f2107['model'],_0x2f2107[_0xaae1('0x35')]);_0x4da28b['attributes']=_['intersection'](_0x2f2107[_0xaae1('0x33')],qs[_0xaae1('0x4a')](_0xf686e9[_0xaae1('0x35')][_0xaae1('0x4a')]));_0x4da28b['attributes']=_0x4da28b['attributes'][_0xaae1('0x38')]?_0x4da28b['attributes']:_0x2f2107[_0xaae1('0x33')];if(!_0xf686e9[_0xaae1('0x35')][_0xaae1('0x57')](_0xaae1('0x3a'))){_0x4da28b['limit']=qs[_0xaae1('0x20')](_0xf686e9[_0xaae1('0x35')][_0xaae1('0x20')]);_0x4da28b[_0xaae1('0x1f')]=qs[_0xaae1('0x1f')](_0xf686e9[_0xaae1('0x35')]['offset']);}_0x4da28b[_0xaae1('0x58')]=qs[_0xaae1('0x3b')](_0xf686e9[_0xaae1('0x35')][_0xaae1('0x3b')]);_0x4da28b['where']=qs[_0xaae1('0x3d')](_[_0xaae1('0x3e')](_0xf686e9[_0xaae1('0x35')],_0x2f2107[_0xaae1('0x3d')]));if(_0xf686e9['query'][_0xaae1('0x3f')]){_0x4da28b[_0xaae1('0x3c')]=_[_0xaae1('0x40')](_0x4da28b['where'],{'$or':_['map'](_0x4da28b[_0xaae1('0x39')],function(_0x286cfd){var _0x452587={};_0x452587[_0x286cfd]={'$like':'%'+_0xf686e9[_0xaae1('0x35')]['filter']+'%'};return _0x452587;})});}_0x4da28b[_0xaae1('0x3c')]=_[_0xaae1('0x40')](_0x4da28b[_0xaae1('0x3c')],{'mailboxuser':_0x2a44bb['mailbox']});_0x4da28b=_['merge']({},_0x4da28b,_0xf686e9[_0xaae1('0x42')]);return db[_0xaae1('0x59')]['findAndCountAll'](_0x4da28b)['then'](respondWithFilteredResult(_0x54ef82,_0x4da28b));})['catch'](handleError(_0x54ef82,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 62162e7..b3ed289 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 _0xbdc4=['context','util','../../config/logger','api','moment','rimraf','../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context','mailbox'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xbdc4,0xaa));var _0x4bdc=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xbdc4[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require('lodash');var util=require(_0x4bdc('0x0'));var logger=require(_0x4bdc('0x1'))(_0x4bdc('0x2'));var moment=require(_0x4bdc('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4bdc('0x4'));var config=require(_0x4bdc('0x5'));var attributes=require(_0x4bdc('0x6'));module[_0x4bdc('0x7')]=function(_0x117731,_0x3a3322){return _0x117731[_0x4bdc('0x8')]('VoiceMail',attributes,{'tableName':_0x4bdc('0x9'),'paranoid':![],'indexes':[{'name':_0x4bdc('0xa'),'fields':[_0x4bdc('0xb'),_0x4bdc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7aa1=['request-promise','path','rimraf','../../config/environment','exports','define','VoiceMail','voice_voicemail','mailbox','context','lodash','util','api','bluebird'];(function(_0x572ffb,_0x1ec514){var _0x4617b2=function(_0x3087e4){while(--_0x3087e4){_0x572ffb['push'](_0x572ffb['shift']());}};_0x4617b2(++_0x1ec514);}(_0x7aa1,0x184));var _0x17aa=function(_0x4889b1,_0x2183bb){_0x4889b1=_0x4889b1-0x0;var _0x254ff0=_0x7aa1[_0x4889b1];return _0x254ff0;};'use strict';var _=require(_0x17aa('0x0'));var util=require(_0x17aa('0x1'));var logger=require('../../config/logger')(_0x17aa('0x2'));var moment=require('moment');var BPromise=require(_0x17aa('0x3'));var rp=require(_0x17aa('0x4'));var fs=require('fs');var path=require(_0x17aa('0x5'));var rimraf=require(_0x17aa('0x6'));var config=require(_0x17aa('0x7'));var attributes=require('./voiceMail.attributes');module[_0x17aa('0x8')]=function(_0x4d4082,_0x330a0e){return _0x4d4082[_0x17aa('0x9')](_0x17aa('0xa'),attributes,{'tableName':_0x17aa('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x17aa('0xc'),_0x17aa('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index a2c3838..9789244 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 _0xf91c=['rpc','../../config/environment','jayson/promise','client','http','info','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x36daf3,_0x2ea0dd){var _0x3e4e26=function(_0x31999a){while(--_0x31999a){_0x36daf3['push'](_0x36daf3['shift']());}};_0x3e4e26(++_0x2ea0dd);}(_0xf91c,0x12c));var _0xcf91=function(_0x434db2,_0x113541){_0x434db2=_0x434db2-0x0;var _0x4e9284=_0xf91c[_0x434db2];return _0x4e9284;};'use strict';var _=require('lodash');var util=require(_0xcf91('0x0'));var moment=require(_0xcf91('0x1'));var BPromise=require(_0xcf91('0x2'));var rs=require(_0xcf91('0x3'));var fs=require('fs');var Redis=require(_0xcf91('0x4'));var db=require(_0xcf91('0x5'))['db'];var utils=require(_0xcf91('0x6'));var logger=require(_0xcf91('0x7'))(_0xcf91('0x8'));var config=require(_0xcf91('0x9'));var jayson=require(_0xcf91('0xa'));var client=jayson[_0xcf91('0xb')][_0xcf91('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b083e,_0x2104e1,_0x4f9833){return new BPromise(function(_0x127dc1,_0x240143){return client['request'](_0x4b083e,_0x4f9833)['then'](function(_0xbdb9b8){logger[_0xcf91('0xd')](_0xcf91('0xe'),_0x2104e1,_0xcf91('0xf'));logger['debug'](_0xcf91('0x10'),_0x2104e1,_0xcf91('0xf'),JSON['stringify'](_0xbdb9b8));if(_0xbdb9b8[_0xcf91('0x11')]){if(_0xbdb9b8[_0xcf91('0x11')][_0xcf91('0x12')]===0x1f4){logger[_0xcf91('0x11')]('VoiceMail,\x20%s,\x20%s',_0x2104e1,_0xbdb9b8[_0xcf91('0x11')][_0xcf91('0x13')]);return _0x240143(_0xbdb9b8[_0xcf91('0x11')][_0xcf91('0x13')]);}logger['error'](_0xcf91('0xe'),_0x2104e1,_0xbdb9b8[_0xcf91('0x11')][_0xcf91('0x13')]);return _0x127dc1(_0xbdb9b8[_0xcf91('0x11')][_0xcf91('0x13')]);}else{logger[_0xcf91('0xd')](_0xcf91('0xe'),_0x2104e1,_0xcf91('0xf'));_0x127dc1(_0xbdb9b8[_0xcf91('0x14')][_0xcf91('0x13')]);}})[_0xcf91('0x15')](function(_0x4bea76){logger[_0xcf91('0x11')](_0xcf91('0xe'),_0x2104e1,_0x4bea76);_0x240143(_0x4bea76);});});} \ No newline at end of file +var _0x010c=['http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x010c,0x1c5));var _0xc010=function(_0x30137a,_0x46e4c1){_0x30137a=_0x30137a-0x0;var _0x44ddb8=_0x010c[_0x30137a];return _0x44ddb8;};'use strict';var _=require('lodash');var util=require(_0xc010('0x0'));var moment=require(_0xc010('0x1'));var BPromise=require(_0xc010('0x2'));var rs=require(_0xc010('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc010('0x4'))['db'];var utils=require(_0xc010('0x5'));var logger=require('../../config/logger')(_0xc010('0x6'));var config=require(_0xc010('0x7'));var jayson=require(_0xc010('0x8'));var client=jayson['client'][_0xc010('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ac2d5,_0x5b6f31,_0x497904){return new BPromise(function(_0x3300fd,_0x5e7ca0){return client[_0xc010('0xa')](_0x4ac2d5,_0x497904)[_0xc010('0xb')](function(_0x111c30){logger[_0xc010('0xc')](_0xc010('0xd'),_0x5b6f31,_0xc010('0xe'));logger[_0xc010('0xf')](_0xc010('0x10'),_0x5b6f31,'request\x20sent',JSON[_0xc010('0x11')](_0x111c30));if(_0x111c30['error']){if(_0x111c30['error'][_0xc010('0x12')]===0x1f4){logger[_0xc010('0x13')]('VoiceMail,\x20%s,\x20%s',_0x5b6f31,_0x111c30[_0xc010('0x13')]['message']);return _0x5e7ca0(_0x111c30[_0xc010('0x13')][_0xc010('0x14')]);}logger[_0xc010('0x13')](_0xc010('0xd'),_0x5b6f31,_0x111c30[_0xc010('0x13')]['message']);return _0x3300fd(_0x111c30[_0xc010('0x13')]['message']);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x5b6f31,'request\x20sent');_0x3300fd(_0x111c30[_0xc010('0x15')][_0xc010('0x14')]);}})['catch'](function(_0x5bad59){logger['error'](_0xc010('0xd'),_0x5b6f31,_0x5bad59);_0x5e7ca0(_0x5bad59);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 9715779..621bac1 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 _0x3c14=['multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','create','update','delete','destroy'];(function(_0x41008e,_0xa94cdf){var _0x490536=function(_0x55fe78){while(--_0x55fe78){_0x41008e['push'](_0x41008e['shift']());}};_0x490536(++_0xa94cdf);}(_0x3c14,0x186));var _0x43c1=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0x3c14[_0x178856];return _0x3c7fe7;};'use strict';var multer=require(_0x43c1('0x0'));var util=require('util');var path=require(_0x43c1('0x1'));var timeout=require(_0x43c1('0x2'));var express=require(_0x43c1('0x3'));var router=express['Router']();var fs_extra=require(_0x43c1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x43c1('0x5'));var config=require(_0x43c1('0x6'));var controller=require(_0x43c1('0x7'));router[_0x43c1('0x8')]('/',auth[_0x43c1('0x9')](),controller[_0x43c1('0xa')]);router[_0x43c1('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/download',auth[_0x43c1('0x9')](),controller['download']);router['post']('/',auth[_0x43c1('0x9')](),controller[_0x43c1('0xb')]);router['put']('/:id',auth[_0x43c1('0x9')](),controller[_0x43c1('0xc')]);router[_0x43c1('0xd')]('/:id',auth[_0x43c1('0x9')](),controller[_0x43c1('0xe')]);module['exports']=router; \ No newline at end of file +var _0xc44e=['destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','/:id','/:id/download','isAuthenticated','put','update','delete'];(function(_0x3b2d98,_0xaa0b26){var _0x256bf1=function(_0x1fe933){while(--_0x1fe933){_0x3b2d98['push'](_0x3b2d98['shift']());}};_0x256bf1(++_0xaa0b26);}(_0xc44e,0x162));var _0xec44=function(_0x4ee89a,_0x56d642){_0x4ee89a=_0x4ee89a-0x0;var _0x42aca9=_0xc44e[_0x4ee89a];return _0x42aca9;};'use strict';var multer=require('multer');var util=require(_0xec44('0x0'));var path=require(_0xec44('0x1'));var timeout=require('connect-timeout');var express=require(_0xec44('0x2'));var router=express[_0xec44('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xec44('0x4'));var interaction=require(_0xec44('0x5'));var config=require('../../config/environment');var controller=require(_0xec44('0x6'));router[_0xec44('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xec44('0x7')](_0xec44('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xec44('0x7')](_0xec44('0x9'),auth[_0xec44('0xa')](),controller['download']);router['post']('/',auth[_0xec44('0xa')](),controller['create']);router[_0xec44('0xb')](_0xec44('0x8'),auth[_0xec44('0xa')](),controller[_0xec44('0xc')]);router[_0xec44('0xd')](_0xec44('0x8'),auth['isAuthenticated'](),controller[_0xec44('0xe')]);module[_0xec44('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 9b9de9f..3650207 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 _0xbc2a=['INTEGER','STRING','BLOB','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x129f1d,_0x4f9c2a){var _0x407926=function(_0x3cccd7){while(--_0x3cccd7){_0x129f1d['push'](_0x129f1d['shift']());}};_0x407926(++_0x4f9c2a);}(_0xbc2a,0x178));var _0xabc2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc2a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xabc2('0x0'));module[_0xabc2('0x1')]={'name':{'type':Sequelize[_0xabc2('0x2')],'get':function(_0x5e5d08){return this[_0xabc2('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xabc2('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xabc2('0x5')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xabc2('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xabc2('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xabc2('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xabc2('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xabc2('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xabc2('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xabc2('0x6')](_0xabc2('0x7')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xabc2('0x8'),'defaultValue':Sequelize['literal'](_0xabc2('0x9'))}}; \ No newline at end of file +var _0xa650=['STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue','INTEGER'];(function(_0x48d828,_0x1e71e0){var _0x5237d8=function(_0x1b5217){while(--_0x1b5217){_0x48d828['push'](_0x48d828['shift']());}};_0x5237d8(++_0x1e71e0);}(_0xa650,0x18c));var _0x0a65=function(_0x16e276,_0x114095){_0x16e276=_0x16e276-0x0;var _0xbd16c4=_0xa650[_0x16e276];return _0xbd16c4;};'use strict';var Sequelize=require(_0x0a65('0x0'));module[_0x0a65('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x56e7d5){return this[_0x0a65('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x0a65('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x0a65('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x0a65('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x0a65('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x0a65('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x0a65('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x0a65('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x0a65('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x0a65('0x5')](_0x0a65('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x0a65('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x0a65('0x4')],'defaultValue':''},'stamp':{'type':_0x0a65('0x7'),'defaultValue':Sequelize[_0x0a65('0x8')](_0x0a65('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 59166a6..da168bd 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 _0x736c=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','reject','update','then','destroy','stack','send','VoiceMailMessage','rawAttributes','fieldName','type','model','differenceBy','map','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','name','options','findAll','rows','catch','show','keys','includeAll','include','find','create','params','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','.wav\x22'];(function(_0x3cb3c1,_0x4f4054){var _0x2dd468=function(_0xfbfb5a){while(--_0xfbfb5a){_0x3cb3c1['push'](_0x3cb3c1['shift']());}};_0x2dd468(++_0x4f4054);}(_0x736c,0x190));var _0xc736=function(_0x223a99,_0x1ddaff){_0x223a99=_0x223a99-0x0;var _0x5a2346=_0x736c[_0x223a99];return _0x5a2346;};'use strict';var emlformat=require(_0xc736('0x0'));var rimraf=require(_0xc736('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc736('0x2'));var rp=require(_0xc736('0x3'));var moment=require(_0xc736('0x4'));var BPromise=require(_0xc736('0x5'));var Mustache=require(_0xc736('0x6'));var util=require(_0xc736('0x7'));var path=require(_0xc736('0x8'));var sox=require(_0xc736('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc736('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc736('0xb'));var deskjs=require(_0xc736('0xc'));var toCsv=require(_0xc736('0xd'));var querystring=require(_0xc736('0xe'));var Papa=require(_0xc736('0xf'));var Redis=require(_0xc736('0x10'));var authService=require(_0xc736('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc736('0x12'));var hardwareService=require(_0xc736('0x13'));var logger=require(_0xc736('0x14'))(_0xc736('0x15'));var utils=require(_0xc736('0x16'));var config=require(_0xc736('0x17'));var licenseUtil=require(_0xc736('0x18'));var db=require(_0xc736('0x19'))['db'];function respondWithStatusCode(_0x3c3cf7,_0xcd41e8){_0xcd41e8=_0xcd41e8||0xcc;return function(_0x47ad6f){if(_0x47ad6f){return _0x3c3cf7[_0xc736('0x1a')](_0xcd41e8);}return _0x3c3cf7[_0xc736('0x1b')](_0xcd41e8)[_0xc736('0x1c')]();};}function respondWithResult(_0x150b93,_0x457ab7){_0x457ab7=_0x457ab7||0xc8;return function(_0x890df6){if(_0x890df6){return _0x150b93[_0xc736('0x1b')](_0x457ab7)['json'](_0x890df6);}};}function respondWithFilteredResult(_0x3dc6c7,_0x1dcf3d){return function(_0x1fd8c8){if(_0x1fd8c8){var _0x3248f4=_0x1fd8c8[_0xc736('0x1d')],_0x1c6e2a=_0x1dcf3d[_0xc736('0x1e')],_0x41019b=_0x1dcf3d[_0xc736('0x1e')]+_0x1dcf3d[_0xc736('0x1f')],_0x107826;if(_0x41019b>=_0x3248f4){_0x41019b=_0x3248f4;_0x107826=0xc8;}else{_0x107826=0xce;}_0x3dc6c7[_0xc736('0x1b')](_0x107826);return _0x3dc6c7[_0xc736('0x20')]('Content-Range',_0x1c6e2a+'-'+_0x41019b+'/'+_0x3248f4)['json'](_0x1fd8c8);}return null;};}function patchUpdates(_0xa77c){return function(_0x1fa44d){try{jsonpatch['apply'](_0x1fa44d,_0xa77c,!![]);}catch(_0xa5408c){return BPromise[_0xc736('0x21')](_0xa5408c);}return _0x1fa44d['save']();};}function saveUpdates(_0x2c5469,_0x591493){return function(_0x2a0aa2){if(_0x2a0aa2){return _0x2a0aa2[_0xc736('0x22')](_0x2c5469)[_0xc736('0x23')](function(_0xf72ad3){return _0xf72ad3;});}return null;};}function removeEntity(_0x239f79,_0x137d0d){return function(_0x56450b){if(_0x56450b){return _0x56450b[_0xc736('0x24')]()[_0xc736('0x23')](function(){_0x239f79[_0xc736('0x1b')](0xcc)[_0xc736('0x1c')]();});}};}function handleEntityNotFound(_0x59d6c2,_0x469e5e){return function(_0x2cebc9){if(!_0x2cebc9){_0x59d6c2[_0xc736('0x1a')](0x194);}return _0x2cebc9;};}function handleError(_0x11fa7a,_0x34eca3){_0x34eca3=_0x34eca3||0x1f4;return function(_0xa8f3a7){logger['error'](_0xa8f3a7[_0xc736('0x25')]);if(_0xa8f3a7['name']){delete _0xa8f3a7['name'];}_0x11fa7a['status'](_0x34eca3)[_0xc736('0x26')](_0xa8f3a7);};}exports['index']=function(_0x403fda,_0x6292b1){var _0x18d9a4={},_0x19a671={},_0x3f9625={'count':0x0,'rows':[]};var _0x20fd4c=_['map'](db[_0xc736('0x27')][_0xc736('0x28')],function(_0x2f6b3d){return{'name':_0x2f6b3d[_0xc736('0x29')],'type':_0x2f6b3d[_0xc736('0x2a')]['key']};});_0x19a671[_0xc736('0x2b')]=_[_0xc736('0x2c')](_[_0xc736('0x2d')](_0x20fd4c,'name'),['name']);_0x19a671['query']=_['keys'](_0x403fda[_0xc736('0x2e')]);_0x19a671[_0xc736('0x2f')]=_[_0xc736('0x30')](_0x19a671[_0xc736('0x2b')],_0x19a671[_0xc736('0x2e')]);_0x18d9a4[_0xc736('0x31')]=_['intersection'](_0x19a671[_0xc736('0x2b')],qs[_0xc736('0x32')](_0x403fda[_0xc736('0x2e')][_0xc736('0x32')]));_0x18d9a4[_0xc736('0x31')]=_0x18d9a4[_0xc736('0x31')][_0xc736('0x33')]?_0x18d9a4[_0xc736('0x31')]:_0x19a671['model'];if(!_0x403fda[_0xc736('0x2e')]['hasOwnProperty']('nolimit')){_0x18d9a4[_0xc736('0x1f')]=qs[_0xc736('0x1f')](_0x403fda[_0xc736('0x2e')]['limit']);_0x18d9a4[_0xc736('0x1e')]=qs[_0xc736('0x1e')](_0x403fda[_0xc736('0x2e')]['offset']);}_0x18d9a4['order']=qs[_0xc736('0x34')](_0x403fda['query'][_0xc736('0x34')]);_0x18d9a4[_0xc736('0x35')]=qs[_0xc736('0x2f')](_[_0xc736('0x36')](_0x403fda[_0xc736('0x2e')],_0x19a671[_0xc736('0x2f')]),_0x20fd4c);if(_0x403fda[_0xc736('0x2e')][_0xc736('0x37')]){_0x18d9a4['where']=_[_0xc736('0x38')](_0x18d9a4['where'],{'$or':_[_0xc736('0x2d')](_0x20fd4c,function(_0x33f1bd){if(_0x33f1bd[_0xc736('0x2a')]!==_0xc736('0x39')){var _0x576204={};_0x576204[_0x33f1bd[_0xc736('0x3a')]]={'$like':'%'+_0x403fda['query']['filter']+'%'};return _0x576204;}})});}_0x18d9a4=_['merge']({},_0x18d9a4,_0x403fda[_0xc736('0x3b')]);var _0x1cd0cf={'where':_0x18d9a4[_0xc736('0x35')]};return db['VoiceMailMessage']['count'](_0x1cd0cf)[_0xc736('0x23')](function(_0x4016d3){_0x3f9625[_0xc736('0x1d')]=_0x4016d3;if(_0x403fda[_0xc736('0x2e')]['includeAll']){_0x18d9a4['include']=[{'all':!![]}];}return db[_0xc736('0x27')][_0xc736('0x3c')](_0x18d9a4);})['then'](function(_0x32f939){_0x3f9625[_0xc736('0x3d')]=_0x32f939;return _0x3f9625;})['then'](respondWithFilteredResult(_0x6292b1,_0x18d9a4))[_0xc736('0x3e')](handleError(_0x6292b1,null));};exports[_0xc736('0x3f')]=function(_0x3096bb,_0x4edba6){var _0x33e792={'raw':!![],'where':{'id':_0x3096bb['params']['id']}},_0x2a827d={};_0x2a827d['model']=_['keys'](db[_0xc736('0x27')][_0xc736('0x28')]);_0x2a827d[_0xc736('0x2e')]=_[_0xc736('0x40')](_0x3096bb[_0xc736('0x2e')]);_0x2a827d['filters']=_['intersection'](_0x2a827d[_0xc736('0x2b')],_0x2a827d[_0xc736('0x2e')]);_0x33e792[_0xc736('0x31')]=_['intersection'](_0x2a827d[_0xc736('0x2b')],qs['fields'](_0x3096bb[_0xc736('0x2e')]['fields']));_0x33e792[_0xc736('0x31')]=_0x33e792['attributes']['length']?_0x33e792[_0xc736('0x31')]:_0x2a827d[_0xc736('0x2b')];if(_0x3096bb[_0xc736('0x2e')][_0xc736('0x41')]){_0x33e792[_0xc736('0x42')]=[{'all':!![]}];}_0x33e792=_[_0xc736('0x38')]({},_0x33e792,_0x3096bb[_0xc736('0x3b')]);return db[_0xc736('0x27')][_0xc736('0x43')](_0x33e792)['then'](handleEntityNotFound(_0x4edba6,null))[_0xc736('0x23')](respondWithResult(_0x4edba6,null))[_0xc736('0x3e')](handleError(_0x4edba6,null));};exports[_0xc736('0x44')]=function(_0x7c4ece,_0x2df89e){return db[_0xc736('0x27')][_0xc736('0x44')](_0x7c4ece['body'],{})[_0xc736('0x23')](respondWithResult(_0x2df89e,0xc9))[_0xc736('0x3e')](handleError(_0x2df89e,null));};exports[_0xc736('0x22')]=function(_0x2d26ad,_0x376bee){if(_0x2d26ad['body']['id']){delete _0x2d26ad['body']['id'];}return db[_0xc736('0x27')][_0xc736('0x43')]({'where':{'id':_0x2d26ad[_0xc736('0x45')]['id']}})['then'](handleEntityNotFound(_0x376bee,null))[_0xc736('0x23')](saveUpdates(_0x2d26ad[_0xc736('0x46')],null))['then'](respondWithResult(_0x376bee,null))['catch'](handleError(_0x376bee,null));};exports[_0xc736('0x24')]=function(_0x32beba,_0xb1f13d){return db[_0xc736('0x27')][_0xc736('0x43')]({'where':{'id':_0x32beba[_0xc736('0x45')]['id']}})['then'](handleEntityNotFound(_0xb1f13d,null))[_0xc736('0x23')](removeEntity(_0xb1f13d,null))[_0xc736('0x3e')](handleError(_0xb1f13d,null));};exports[_0xc736('0x47')]=function(_0x189d0f,_0x39ac40,_0x1bff1b){return db[_0xc736('0x27')][_0xc736('0x43')]({'where':{'id':_0x189d0f[_0xc736('0x45')]['id']},'attributes':['id',_0xc736('0x48'),_0xc736('0x49')]})[_0xc736('0x23')](handleEntityNotFound(_0x39ac40,null))['then'](function(_0x1fe27f){if(_0x1fe27f){if(!_0x1fe27f[_0xc736('0x48')]){throw new db[(_0xc736('0x4a'))][(_0xc736('0x4b'))](_0xc736('0x4c'));}var _0x247006={'Content-Type':'audio/wav','Content-Disposition':_0xc736('0x4d')};if(_0x1fe27f[_0xc736('0x49')]){_0x247006[_0xc736('0x4e')]='attachment;\x20filename=\x22'+_0x1fe27f['msg_id']+_0xc736('0x4f');}_0x39ac40[_0xc736('0x20')](_0x247006);return _0x39ac40[_0xc736('0x26')](new Buffer(_0x1fe27f[_0xc736('0x48')]));}})['catch'](handleError(_0x39ac40,null));}; \ No newline at end of file +var _0x6bfc=['reject','save','update','then','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','VoiceMailMessage','rows','catch','show','find','create','body','params','download','recording','msg_id','Sequelize','audio/wav','attachment','attachment;\x20filename=\x22','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x6bfc,0x159));var _0xc6bf=function(_0x17c02b,_0x2767bc){_0x17c02b=_0x17c02b-0x0;var _0x4d1d2b=_0x6bfc[_0x17c02b];return _0x4d1d2b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc6bf('0x0'));var zipdir=require(_0xc6bf('0x1'));var jsonpatch=require(_0xc6bf('0x2'));var rp=require('request-promise');var moment=require(_0xc6bf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc6bf('0x4'));var util=require('util');var path=require(_0xc6bf('0x5'));var sox=require(_0xc6bf('0x6'));var csv=require(_0xc6bf('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc6bf('0x8'));var _=require(_0xc6bf('0x9'));var squel=require(_0xc6bf('0xa'));var crypto=require(_0xc6bf('0xb'));var jsforce=require(_0xc6bf('0xc'));var deskjs=require(_0xc6bf('0xd'));var toCsv=require(_0xc6bf('0x7'));var querystring=require(_0xc6bf('0xe'));var Papa=require('papaparse');var Redis=require(_0xc6bf('0xf'));var authService=require(_0xc6bf('0x10'));var qs=require(_0xc6bf('0x11'));var as=require(_0xc6bf('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc6bf('0x13'));var utils=require(_0xc6bf('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc6bf('0x15'))['db'];function respondWithStatusCode(_0x303ae7,_0x49db35){_0x49db35=_0x49db35||0xcc;return function(_0x1cbc07){if(_0x1cbc07){return _0x303ae7[_0xc6bf('0x16')](_0x49db35);}return _0x303ae7[_0xc6bf('0x17')](_0x49db35)[_0xc6bf('0x18')]();};}function respondWithResult(_0x42e25e,_0x503364){_0x503364=_0x503364||0xc8;return function(_0x58dd19){if(_0x58dd19){return _0x42e25e[_0xc6bf('0x17')](_0x503364)[_0xc6bf('0x19')](_0x58dd19);}};}function respondWithFilteredResult(_0x5b5567,_0x18f81c){return function(_0x331f31){if(_0x331f31){var _0x368195=_0x331f31['count'],_0x478f6=_0x18f81c['offset'],_0x54d6a8=_0x18f81c[_0xc6bf('0x1a')]+_0x18f81c[_0xc6bf('0x1b')],_0x23498a;if(_0x54d6a8>=_0x368195){_0x54d6a8=_0x368195;_0x23498a=0xc8;}else{_0x23498a=0xce;}_0x5b5567['status'](_0x23498a);return _0x5b5567[_0xc6bf('0x1c')](_0xc6bf('0x1d'),_0x478f6+'-'+_0x54d6a8+'/'+_0x368195)['json'](_0x331f31);}return null;};}function patchUpdates(_0x279e01){return function(_0x4adc0a){try{jsonpatch['apply'](_0x4adc0a,_0x279e01,!![]);}catch(_0x501a3b){return BPromise[_0xc6bf('0x1e')](_0x501a3b);}return _0x4adc0a[_0xc6bf('0x1f')]();};}function saveUpdates(_0x5ac1b0,_0x539ef2){return function(_0x156131){if(_0x156131){return _0x156131[_0xc6bf('0x20')](_0x5ac1b0)['then'](function(_0x4633cf){return _0x4633cf;});}return null;};}function removeEntity(_0x41ca5a,_0x1e2110){return function(_0x56e899){if(_0x56e899){return _0x56e899['destroy']()[_0xc6bf('0x21')](function(){_0x41ca5a[_0xc6bf('0x17')](0xcc)[_0xc6bf('0x18')]();});}};}function handleEntityNotFound(_0x1a0a50,_0x3b5dd7){return function(_0x2df59e){if(!_0x2df59e){_0x1a0a50[_0xc6bf('0x16')](0x194);}return _0x2df59e;};}function handleError(_0x1cf65d,_0x5a5d51){_0x5a5d51=_0x5a5d51||0x1f4;return function(_0x312138){logger[_0xc6bf('0x22')](_0x312138[_0xc6bf('0x23')]);if(_0x312138['name']){delete _0x312138[_0xc6bf('0x24')];}_0x1cf65d[_0xc6bf('0x17')](_0x5a5d51)[_0xc6bf('0x25')](_0x312138);};}exports[_0xc6bf('0x26')]=function(_0x1346d5,_0x15396c){var _0x5abf52={},_0x4b092f={},_0x1b6e7c={'count':0x0,'rows':[]};var _0x519dc8=_[_0xc6bf('0x27')](db['VoiceMailMessage']['rawAttributes'],function(_0x2806e6){return{'name':_0x2806e6[_0xc6bf('0x28')],'type':_0x2806e6[_0xc6bf('0x29')][_0xc6bf('0x2a')]};});_0x4b092f['model']=_['differenceBy'](_['map'](_0x519dc8,'name'),[_0xc6bf('0x24')]);_0x4b092f[_0xc6bf('0x2b')]=_[_0xc6bf('0x2c')](_0x1346d5[_0xc6bf('0x2b')]);_0x4b092f[_0xc6bf('0x2d')]=_[_0xc6bf('0x2e')](_0x4b092f[_0xc6bf('0x2f')],_0x4b092f[_0xc6bf('0x2b')]);_0x5abf52[_0xc6bf('0x30')]=_[_0xc6bf('0x2e')](_0x4b092f[_0xc6bf('0x2f')],qs[_0xc6bf('0x31')](_0x1346d5[_0xc6bf('0x2b')][_0xc6bf('0x31')]));_0x5abf52[_0xc6bf('0x30')]=_0x5abf52['attributes'][_0xc6bf('0x32')]?_0x5abf52[_0xc6bf('0x30')]:_0x4b092f[_0xc6bf('0x2f')];if(!_0x1346d5[_0xc6bf('0x2b')]['hasOwnProperty']('nolimit')){_0x5abf52[_0xc6bf('0x1b')]=qs[_0xc6bf('0x1b')](_0x1346d5[_0xc6bf('0x2b')][_0xc6bf('0x1b')]);_0x5abf52[_0xc6bf('0x1a')]=qs['offset'](_0x1346d5[_0xc6bf('0x2b')]['offset']);}_0x5abf52['order']=qs[_0xc6bf('0x33')](_0x1346d5[_0xc6bf('0x2b')][_0xc6bf('0x33')]);_0x5abf52[_0xc6bf('0x34')]=qs[_0xc6bf('0x2d')](_['pick'](_0x1346d5[_0xc6bf('0x2b')],_0x4b092f[_0xc6bf('0x2d')]),_0x519dc8);if(_0x1346d5['query'][_0xc6bf('0x35')]){_0x5abf52[_0xc6bf('0x34')]=_[_0xc6bf('0x36')](_0x5abf52['where'],{'$or':_['map'](_0x519dc8,function(_0x4fb13b){if(_0x4fb13b[_0xc6bf('0x29')]!==_0xc6bf('0x37')){var _0x2e9458={};_0x2e9458[_0x4fb13b['name']]={'$like':'%'+_0x1346d5[_0xc6bf('0x2b')]['filter']+'%'};return _0x2e9458;}})});}_0x5abf52=_['merge']({},_0x5abf52,_0x1346d5[_0xc6bf('0x38')]);var _0x43b84c={'where':_0x5abf52[_0xc6bf('0x34')]};return db['VoiceMailMessage']['count'](_0x43b84c)[_0xc6bf('0x21')](function(_0x3f2ec6){_0x1b6e7c[_0xc6bf('0x39')]=_0x3f2ec6;if(_0x1346d5[_0xc6bf('0x2b')][_0xc6bf('0x3a')]){_0x5abf52[_0xc6bf('0x3b')]=[{'all':!![]}];}return db[_0xc6bf('0x3c')]['findAll'](_0x5abf52);})[_0xc6bf('0x21')](function(_0x31d8ef){_0x1b6e7c[_0xc6bf('0x3d')]=_0x31d8ef;return _0x1b6e7c;})['then'](respondWithFilteredResult(_0x15396c,_0x5abf52))[_0xc6bf('0x3e')](handleError(_0x15396c,null));};exports[_0xc6bf('0x3f')]=function(_0x3d408,_0x52b6f3){var _0x4dc6da={'raw':!![],'where':{'id':_0x3d408['params']['id']}},_0x48a81d={};_0x48a81d[_0xc6bf('0x2f')]=_[_0xc6bf('0x2c')](db['VoiceMailMessage']['rawAttributes']);_0x48a81d[_0xc6bf('0x2b')]=_[_0xc6bf('0x2c')](_0x3d408[_0xc6bf('0x2b')]);_0x48a81d['filters']=_[_0xc6bf('0x2e')](_0x48a81d[_0xc6bf('0x2f')],_0x48a81d[_0xc6bf('0x2b')]);_0x4dc6da[_0xc6bf('0x30')]=_[_0xc6bf('0x2e')](_0x48a81d[_0xc6bf('0x2f')],qs[_0xc6bf('0x31')](_0x3d408['query']['fields']));_0x4dc6da[_0xc6bf('0x30')]=_0x4dc6da[_0xc6bf('0x30')][_0xc6bf('0x32')]?_0x4dc6da[_0xc6bf('0x30')]:_0x48a81d[_0xc6bf('0x2f')];if(_0x3d408[_0xc6bf('0x2b')][_0xc6bf('0x3a')]){_0x4dc6da[_0xc6bf('0x3b')]=[{'all':!![]}];}_0x4dc6da=_[_0xc6bf('0x36')]({},_0x4dc6da,_0x3d408[_0xc6bf('0x38')]);return db[_0xc6bf('0x3c')][_0xc6bf('0x40')](_0x4dc6da)[_0xc6bf('0x21')](handleEntityNotFound(_0x52b6f3,null))[_0xc6bf('0x21')](respondWithResult(_0x52b6f3,null))[_0xc6bf('0x3e')](handleError(_0x52b6f3,null));};exports[_0xc6bf('0x41')]=function(_0x3456e3,_0x5e75dd){return db[_0xc6bf('0x3c')][_0xc6bf('0x41')](_0x3456e3[_0xc6bf('0x42')],{})[_0xc6bf('0x21')](respondWithResult(_0x5e75dd,0xc9))['catch'](handleError(_0x5e75dd,null));};exports[_0xc6bf('0x20')]=function(_0x29b6cf,_0x1e95f5){if(_0x29b6cf['body']['id']){delete _0x29b6cf[_0xc6bf('0x42')]['id'];}return db[_0xc6bf('0x3c')][_0xc6bf('0x40')]({'where':{'id':_0x29b6cf[_0xc6bf('0x43')]['id']}})['then'](handleEntityNotFound(_0x1e95f5,null))[_0xc6bf('0x21')](saveUpdates(_0x29b6cf[_0xc6bf('0x42')],null))[_0xc6bf('0x21')](respondWithResult(_0x1e95f5,null))['catch'](handleError(_0x1e95f5,null));};exports['destroy']=function(_0x4eb844,_0x3bcce0){return db['VoiceMailMessage']['find']({'where':{'id':_0x4eb844[_0xc6bf('0x43')]['id']}})['then'](handleEntityNotFound(_0x3bcce0,null))[_0xc6bf('0x21')](removeEntity(_0x3bcce0,null))[_0xc6bf('0x3e')](handleError(_0x3bcce0,null));};exports[_0xc6bf('0x44')]=function(_0x352abe,_0x3b3e28,_0x2a54b8){return db[_0xc6bf('0x3c')][_0xc6bf('0x40')]({'where':{'id':_0x352abe[_0xc6bf('0x43')]['id']},'attributes':['id',_0xc6bf('0x45'),_0xc6bf('0x46')]})['then'](handleEntityNotFound(_0x3b3e28,null))['then'](function(_0x47b359){if(_0x47b359){if(!_0x47b359[_0xc6bf('0x45')]){throw new db[(_0xc6bf('0x47'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0x52e124={'Content-Type':_0xc6bf('0x48'),'Content-Disposition':_0xc6bf('0x49')};if(_0x47b359[_0xc6bf('0x46')]){_0x52e124['Content-Disposition']=_0xc6bf('0x4a')+_0x47b359[_0xc6bf('0x46')]+'.wav\x22';}_0x3b3e28[_0xc6bf('0x1c')](_0x52e124);return _0x3b3e28[_0xc6bf('0x25')](new Buffer(_0x47b359[_0xc6bf('0x45')]));}})[_0xc6bf('0x3e')](handleError(_0x3b3e28,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 3d5553b..cec2ab1 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 _0xbac7=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash'];(function(_0x229101,_0x31339d){var _0xc93cb=function(_0x461394){while(--_0x461394){_0x229101['push'](_0x229101['shift']());}};_0xc93cb(++_0x31339d);}(_0xbac7,0x15d));var _0x7bac=function(_0xba50f9,_0x17e663){_0xba50f9=_0xba50f9-0x0;var _0xd68a76=_0xbac7[_0xba50f9];return _0xd68a76;};'use strict';var _=require(_0x7bac('0x0'));var util=require(_0x7bac('0x1'));var logger=require(_0x7bac('0x2'))(_0x7bac('0x3'));var moment=require('moment');var BPromise=require(_0x7bac('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7bac('0x5'));var rimraf=require(_0x7bac('0x6'));var config=require(_0x7bac('0x7'));var attributes=require(_0x7bac('0x8'));module[_0x7bac('0x9')]=function(_0x1d6177,_0x5b05f9){return _0x1d6177[_0x7bac('0xa')](_0x7bac('0xb'),attributes,{'tableName':_0x7bac('0xc'),'paranoid':![],'indexes':[{'name':_0x7bac('0xd'),'fields':[_0x7bac('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4b96=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir','util','../../config/logger','api'];(function(_0x2257c7,_0x4ef073){var _0x6017b4=function(_0x311ba3){while(--_0x311ba3){_0x2257c7['push'](_0x2257c7['shift']());}};_0x6017b4(++_0x4ef073);}(_0x4b96,0xda));var _0x64b9=function(_0x2618fa,_0x3c7f2a){_0x2618fa=_0x2618fa-0x0;var _0x3107d3=_0x4b96[_0x2618fa];return _0x3107d3;};'use strict';var _=require('lodash');var util=require(_0x64b9('0x0'));var logger=require(_0x64b9('0x1'))(_0x64b9('0x2'));var moment=require('moment');var BPromise=require(_0x64b9('0x3'));var rp=require(_0x64b9('0x4'));var fs=require('fs');var path=require(_0x64b9('0x5'));var rimraf=require(_0x64b9('0x6'));var config=require(_0x64b9('0x7'));var attributes=require(_0x64b9('0x8'));module[_0x64b9('0x9')]=function(_0x2cbe6b,_0x199b29){return _0x2cbe6b[_0x64b9('0xa')]('VoiceMailMessage',attributes,{'tableName':_0x64b9('0xb'),'paranoid':![],'indexes':[{'name':_0x64b9('0xc'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 6fa5f20..b530ceb 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x5a9ce8,_0x36d785){var _0x3ca8df=function(_0x6d15c1){while(--_0x6d15c1){_0x5a9ce8['push'](_0x5a9ce8['shift']());}};_0x3ca8df(++_0x36d785);}(_0xdb28,0x106));var _0x8db2=function(_0x5f3f5e,_0x4cc99e){_0x5f3f5e=_0x5f3f5e-0x0;var _0xf4aabb=_0xdb28[_0x5f3f5e];return _0xf4aabb;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _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(_0x3582a1,_0x38314a){var _0x5054c0=function(_0x4bc158){while(--_0x4bc158){_0x3582a1['push'](_0x3582a1['shift']());}};_0x5054c0(++_0x38314a);}(_0x14a0,0x8e));var _0x014a=function(_0x43aed5,_0x32ed37){_0x43aed5=_0x43aed5-0x0;var _0x4da8e4=_0x14a0[_0x43aed5];return _0x4da8e4;};'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 1a6effd..54df49a 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 _0x2677=['fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','create','post','addSound','update','destroy','delete','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x34d7f0,_0x4da069){var _0x347649=function(_0xe644af){while(--_0xe644af){_0x34d7f0['push'](_0x34d7f0['shift']());}};_0x347649(++_0x4da069);}(_0x2677,0x192));var _0x7267=function(_0x47dcb1,_0x2e7067){_0x47dcb1=_0x47dcb1-0x0;var _0x532b9f=_0x2677[_0x47dcb1];return _0x532b9f;};'use strict';var multer=require(_0x7267('0x0'));var util=require(_0x7267('0x1'));var path=require(_0x7267('0x2'));var timeout=require(_0x7267('0x3'));var express=require(_0x7267('0x4'));var router=express[_0x7267('0x5')]();var fs_extra=require(_0x7267('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7267('0x7'));var config=require(_0x7267('0x8'));var controller=require(_0x7267('0x9'));router[_0x7267('0xa')]('/',auth[_0x7267('0xb')](),controller[_0x7267('0xc')]);router[_0x7267('0xa')](_0x7267('0xd'),auth[_0x7267('0xb')](),controller['show']);router[_0x7267('0xa')](_0x7267('0xe'),auth[_0x7267('0xb')](),controller['getSounds']);router['post']('/',auth[_0x7267('0xb')](),controller[_0x7267('0xf')]);router[_0x7267('0x10')](_0x7267('0xe'),auth['isAuthenticated'](),controller[_0x7267('0x11')]);router['put'](_0x7267('0xd'),auth[_0x7267('0xb')](),controller[_0x7267('0x12')]);router['delete']('/:id',auth[_0x7267('0xb')](),controller[_0x7267('0x13')]);router[_0x7267('0x14')](_0x7267('0x15'),auth[_0x7267('0xb')](),controller[_0x7267('0x16')]);module[_0x7267('0x17')]=router; \ No newline at end of file +var _0x82d8=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','show','/:id/sounds','post','create','addSound','put','/:id','update','delete','destroy','removeSound'];(function(_0x33aed8,_0x5a0ea2){var _0x229e3f=function(_0x27d641){while(--_0x27d641){_0x33aed8['push'](_0x33aed8['shift']());}};_0x229e3f(++_0x5a0ea2);}(_0x82d8,0x169));var _0x882d=function(_0x1a529d,_0x4ff832){_0x1a529d=_0x1a529d-0x0;var _0x4d808a=_0x82d8[_0x1a529d];return _0x4d808a;};'use strict';var multer=require(_0x882d('0x0'));var util=require(_0x882d('0x1'));var path=require(_0x882d('0x2'));var timeout=require(_0x882d('0x3'));var express=require('express');var router=express[_0x882d('0x4')]();var fs_extra=require(_0x882d('0x5'));var auth=require(_0x882d('0x6'));var interaction=require(_0x882d('0x7'));var config=require(_0x882d('0x8'));var controller=require(_0x882d('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x882d('0xa')]('/:id',auth[_0x882d('0xb')](),controller[_0x882d('0xc')]);router[_0x882d('0xa')](_0x882d('0xd'),auth['isAuthenticated'](),controller['getSounds']);router[_0x882d('0xe')]('/',auth[_0x882d('0xb')](),controller[_0x882d('0xf')]);router[_0x882d('0xe')]('/:id/sounds',auth['isAuthenticated'](),controller[_0x882d('0x10')]);router[_0x882d('0x11')](_0x882d('0x12'),auth[_0x882d('0xb')](),controller[_0x882d('0x13')]);router[_0x882d('0x14')](_0x882d('0x12'),auth[_0x882d('0xb')](),controller[_0x882d('0x15')]);router[_0x882d('0x14')]('/:id/sounds/:id2',auth[_0x882d('0xb')](),controller[_0x882d('0x16')]);module[_0x882d('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 1bbb908..24685e9 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 _0xf1aa=['sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','BOOLEAN'];(function(_0x32ce8a,_0x1120a2){var _0x36b9d4=function(_0x2901d9){while(--_0x2901d9){_0x32ce8a['push'](_0x32ce8a['shift']());}};_0x36b9d4(++_0x1120a2);}(_0xf1aa,0x9c));var _0xaf1a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf1aa[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0xaf1a('0x0'));module[_0xaf1a('0x1')]={'name':{'type':Sequelize[_0xaf1a('0x2')],'allowNull':![],'unique':_0xaf1a('0x3')},'mode':{'type':Sequelize[_0xaf1a('0x4')](_0xaf1a('0x5'),_0xaf1a('0x6'),_0xaf1a('0x7'),_0xaf1a('0x8'),_0xaf1a('0x9'),_0xaf1a('0xa')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xaf1a('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xaf1a('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xaf1a('0x2')],'allowNull':!![],'defaultValue':_0xaf1a('0xb')},'format':{'type':Sequelize[_0xaf1a('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xaf1a('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xce83=['mp3','STRING','alpha','TIMESTAMP','sequelize','exports','files','mp3nb','quietmp3nb','quietmp3'];(function(_0x45f2a8,_0xb9af18){var _0x6de609=function(_0x2f20f6){while(--_0x2f20f6){_0x45f2a8['push'](_0x45f2a8['shift']());}};_0x6de609(++_0xb9af18);}(_0xce83,0x19e));var _0x3ce8=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0xce83[_0x38537f];return _0x141e23;};'use strict';var Sequelize=require(_0x3ce8('0x0'));module[_0x3ce8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM']('custom',_0x3ce8('0x2'),_0x3ce8('0x3'),_0x3ce8('0x4'),_0x3ce8('0x5'),_0x3ce8('0x6')),'allowNull':!![],'defaultValue':_0x3ce8('0x2')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x3ce8('0x7')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x3ce8('0x8')},'format':{'type':Sequelize[_0x3ce8('0x7')],'allowNull':!![]},'stamp':{'type':_0x3ce8('0x9')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 a9a7b0e..b9f62ca 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 _0xa9e0=['json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','MusicOnHolds','UserProfileResource','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','body','find','create','sequelize','directory','join','root','server/files/moh','mode','files','0777','get','role','UserProfileSection','userProfileId','autoAssociation','transaction','readdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','removeSound','id2','getSounds','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);delete _0x140511['query'][_0x0a9e('0x38')];_0x11c3b6['where']=qs[_0x0a9e('0x39')](_[_0x0a9e('0x3a')](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511['query'][_0x0a9e('0x3b')]){_0x11c3b6[_0x0a9e('0x3c')]=_[_0x0a9e('0x3d')](_0x11c3b6['where'],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x1a180b){if(_0x1a180b[_0x0a9e('0x2d')]!=='VIRTUAL'){var _0x546ef8={};_0x546ef8[_0x1a180b[_0x0a9e('0x26')]]={'$like':'%'+_0x140511[_0x0a9e('0x30')]['filter']+'%'};return _0x546ef8;}})});}_0x11c3b6=_[_0x0a9e('0x3d')]({},_0x11c3b6,_0x140511[_0x0a9e('0x3e')]);var _0x2e1b3a={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db['VoiceMusicOnHold']['count'](_0x2e1b3a)[_0x0a9e('0x22')](function(_0x45b3d0){_0x5a101a['count']=_0x45b3d0;if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3f')]){_0x11c3b6[_0x0a9e('0x40')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x0a9e('0x41')](_0x11c3b6);})[_0x0a9e('0x22')](function(_0x274e8e){_0x5a101a[_0x0a9e('0x42')]=_0x274e8e;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x43')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x44')]=function(_0x45a9b8,_0x23b089){var _0x3da2cd={'raw':![],'where':{'id':_0x45a9b8[_0x0a9e('0x45')]['id']}},_0x2c3711={};_0x2c3711[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')]['rawAttributes']);_0x2c3711['query']=_[_0x0a9e('0x31')](_0x45a9b8[_0x0a9e('0x30')]);_0x2c3711[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x2c3711[_0x0a9e('0x2f')],_0x2c3711[_0x0a9e('0x30')]);_0x3da2cd[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x2c3711[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x45a9b8[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x3da2cd['attributes']=_0x3da2cd[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x3da2cd[_0x0a9e('0x33')]:_0x2c3711[_0x0a9e('0x2f')];if(_0x45a9b8[_0x0a9e('0x30')][_0x0a9e('0x3f')]){_0x3da2cd[_0x0a9e('0x40')]=[{'all':!![]}];}_0x3da2cd=_[_0x0a9e('0x3d')]({},_0x3da2cd,_0x45a9b8['options']);return db[_0x0a9e('0x2a')]['find'](_0x3da2cd)[_0x0a9e('0x22')](handleEntityNotFound(_0x23b089,null))[_0x0a9e('0x22')](respondWithResult(_0x23b089,null))[_0x0a9e('0x43')](handleError(_0x23b089,null));};exports['update']=function(_0x14bec2,_0x7f6eb1){if(_0x14bec2[_0x0a9e('0x46')]['id']){delete _0x14bec2[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x47')]({'where':{'id':_0x14bec2[_0x0a9e('0x45')]['id']}})['then'](handleEntityNotFound(_0x7f6eb1,null))[_0x0a9e('0x22')](saveUpdates(_0x14bec2[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x7f6eb1,null))[_0x0a9e('0x43')](handleError(_0x7f6eb1,null));};exports[_0x0a9e('0x48')]=function(_0x992c77,_0x6054ee,_0x19383e){return db[_0x0a9e('0x49')]['transaction'](function(_0xe401a){if(_0x992c77[_0x0a9e('0x46')]['mode']==='files'){_0x992c77['body'][_0x0a9e('0x4a')]=path[_0x0a9e('0x4b')](config[_0x0a9e('0x4c')],_0x0a9e('0x4d'),_0x992c77[_0x0a9e('0x46')][_0x0a9e('0x26')]);}return db[_0x0a9e('0x2a')][_0x0a9e('0x48')](_0x992c77['body'],{'transaction':_0xe401a})['then'](function(_0x53975a){if(_0x992c77[_0x0a9e('0x46')][_0x0a9e('0x4e')]===_0x0a9e('0x4f')){fs['mkdirSync'](_0x53975a[_0x0a9e('0x4a')],parseInt(_0x0a9e('0x50'),0x8));}var _0x53d113=_0x992c77['user'][_0x0a9e('0x51')]({'plain':!![]});if(!_0x53d113)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53d113[_0x0a9e('0x52')]==='user'){var _0x2e5e62=_0x53975a[_0x0a9e('0x51')]({'plain':!![]});return db[_0x0a9e('0x53')]['find']({'where':{'name':_0x0a9e('0x23'),'userProfileId':_0x53d113[_0x0a9e('0x54')]},'raw':!![]})['then'](function(_0x50f687){if(_0x50f687&&_0x50f687[_0x0a9e('0x55')]===0x0){return db[_0x0a9e('0x24')]['create']({'name':_0x2e5e62[_0x0a9e('0x26')],'resourceId':_0x2e5e62['id'],'type':_0x50f687['name'],'sectionId':_0x50f687['id']},{})[_0x0a9e('0x22')](function(){return _0x53975a;});}else{return _0x53975a;}})['catch'](function(_0xe22ccc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe22ccc);});}return _0x53975a;});})['then'](respondWithResult(_0x6054ee,0xc9))[_0x0a9e('0x43')](handleError(_0x6054ee,null));};exports['destroy']=function(_0x2f7092,_0x65432,_0x3cfd00){var _0x19b4df;return db[_0x0a9e('0x2a')][_0x0a9e('0x47')]({'where':{'id':_0x2f7092[_0x0a9e('0x45')]['id']}})[_0x0a9e('0x22')](function(_0x4e67ab){if(_0x4e67ab){return db[_0x0a9e('0x49')][_0x0a9e('0x56')](function(_0x2642bb){return _0x4e67ab[_0x0a9e('0x21')]({'transaction':_0x2642bb,'raw':!![]})[_0x0a9e('0x22')](function(_0x156662){if(_0x156662['directory']){fs[_0x0a9e('0x57')](_0x156662[_0x0a9e('0x4a')])['forEach'](function(_0x3649cc){fs['unlinkSync'](path[_0x0a9e('0x4b')](_0x156662['directory'],_0x3649cc));});fs['rmdirSync'](_0x156662['directory']);}return _0x156662;});})[_0x0a9e('0x43')](function(_0x49d231){throw new db[(_0x0a9e('0x58'))][(_0x0a9e('0x59'))](_0x49d231[_0x0a9e('0x5a')]);});}})[_0x0a9e('0x22')](handleEntityNotFound(_0x65432,null))[_0x0a9e('0x22')](removeEntity(_0x65432,null))[_0x0a9e('0x43')](handleError(_0x65432,null));};exports['addSound']=function(_0x1627a7,_0x5854cc,_0xca4ade){return db[_0x0a9e('0x49')][_0x0a9e('0x56')](function(_0x5adf8f){var _0x453360;return db[_0x0a9e('0x2a')][_0x0a9e('0x47')]({'where':{'id':_0x1627a7[_0x0a9e('0x45')]['id']}})['then'](function(_0x1d0dc8){if(_0x1d0dc8){_0x453360=_0x1d0dc8;return _0x1d0dc8[_0x0a9e('0x5b')](_0x1627a7['body']['id'],{'transaction':_0x5adf8f});}})[_0x0a9e('0x22')](function(_0x17e88c){if(_0x17e88c){return db[_0x0a9e('0x5c')][_0x0a9e('0x5d')]({'where':{'id':_0x1627a7[_0x0a9e('0x46')]['id']},'attributes':['id','name',_0x0a9e('0x5e'),_0x0a9e('0x5f'),_0x0a9e('0x60')],'raw':!![]});}})['then'](function(_0x3528b7){if(_0x3528b7){var _0x4f1e60=path['join'](config[_0x0a9e('0x4c')],_0x0a9e('0x61'),util[_0x0a9e('0x62')](_0x0a9e('0x63'),path[_0x0a9e('0x64')](_0x3528b7[_0x0a9e('0x5e')],path[_0x0a9e('0x65')](_0x3528b7[_0x0a9e('0x5e')])),_0x3528b7[_0x0a9e('0x5f')]));var _0x1cc4f3=path[_0x0a9e('0x4b')](config[_0x0a9e('0x4c')],_0x0a9e('0x4d'),_0x453360[_0x0a9e('0x26')],util[_0x0a9e('0x62')](_0x0a9e('0x63'),_0x3528b7[_0x0a9e('0x26')],_0x3528b7[_0x0a9e('0x5f')]));fs['symlinkSync'](_0x4f1e60,_0x1cc4f3);return _0x3528b7;}})[_0x0a9e('0x43')](function(_0x295763){throw new db[(_0x0a9e('0x58'))]['ValidationError'](_0x295763[_0x0a9e('0x5a')]);});})[_0x0a9e('0x22')](handleEntityNotFound(_0x5854cc,null))['then'](respondWithResult(_0x5854cc,0xc9))[_0x0a9e('0x43')](handleError(_0x5854cc,null));};exports[_0x0a9e('0x66')]=function(_0x3ef315,_0x427946,_0x13b5c0){return db['sequelize']['transaction'](function(_0x4a2438){var _0x40fb85;return db[_0x0a9e('0x2a')][_0x0a9e('0x5d')]({'where':{'id':_0x3ef315[_0x0a9e('0x45')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x427946,null))[_0x0a9e('0x22')](function(_0xeef20){if(_0xeef20){_0x40fb85=_0xeef20;return _0xeef20[_0x0a9e('0x66')](_0x3ef315['params'][_0x0a9e('0x67')]);}})[_0x0a9e('0x22')](function(_0x12ccdb){if(_0x12ccdb){return db['Sound'][_0x0a9e('0x5d')]({'where':{'id':_0x3ef315['params'][_0x0a9e('0x67')]},'attributes':['id',_0x0a9e('0x26'),'save_name',_0x0a9e('0x5f'),_0x0a9e('0x60')],'raw':!![]});}})[_0x0a9e('0x22')](function(_0x317c0c){if(_0x317c0c){fs['unlinkSync'](path[_0x0a9e('0x4b')](_0x40fb85[_0x0a9e('0x4a')],util[_0x0a9e('0x62')](_0x0a9e('0x63'),_0x317c0c['name'],_0x317c0c[_0x0a9e('0x5f')])));return _0x317c0c;}})[_0x0a9e('0x43')](function(_0x2d5506){throw new db[(_0x0a9e('0x58'))]['ValidationError'](_0x2d5506[_0x0a9e('0x5a')]);});})[_0x0a9e('0x22')](handleEntityNotFound(_0x427946,null))[_0x0a9e('0x22')](respondWithStatusCode(_0x427946,0xcc))[_0x0a9e('0x43')](handleError(_0x427946,null));};exports[_0x0a9e('0x68')]=function(_0xdb98ca,_0x40fc56,_0x3df0e3){var _0x1a7b03={};var _0x336dc3={};var _0xc4c230;var _0x1f10ef;return db[_0x0a9e('0x2a')][_0x0a9e('0x5d')]({'where':{'id':_0xdb98ca['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x40fc56,null))[_0x0a9e('0x22')](function(_0xc599b3){if(_0xc599b3){_0xc4c230=_0xc599b3;_0x336dc3['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x5c')][_0x0a9e('0x2b')]);_0x336dc3[_0x0a9e('0x30')]=_['keys'](_0xdb98ca['query']);_0x336dc3[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x336dc3['model'],_0x336dc3[_0x0a9e('0x30')]);_0x1a7b03['attributes']=_[_0x0a9e('0x32')](_0x336dc3[_0x0a9e('0x2f')],qs['fields'](_0xdb98ca[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x1a7b03[_0x0a9e('0x33')]=_0x1a7b03[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x1a7b03[_0x0a9e('0x33')]:_0x336dc3[_0x0a9e('0x2f')];_0x1a7b03['order']=qs[_0x0a9e('0x38')](_0xdb98ca[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x1a7b03[_0x0a9e('0x3c')]=qs['filters'](_[_0x0a9e('0x3a')](_0xdb98ca[_0x0a9e('0x30')],_0x336dc3['filters']));if(_0xdb98ca[_0x0a9e('0x30')]['filter']){_0x1a7b03[_0x0a9e('0x3c')]=_[_0x0a9e('0x3d')](_0x1a7b03[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x1a7b03['attributes'],function(_0x51ccd7){var _0x353384={};_0x353384[_0x51ccd7]={'$like':'%'+_0xdb98ca[_0x0a9e('0x30')][_0x0a9e('0x3b')]+'%'};return _0x353384;})});}_0x1a7b03=_['merge']({},_0x1a7b03,_0xdb98ca[_0x0a9e('0x3e')]);return _0xc4c230[_0x0a9e('0x68')](_0x1a7b03);}})['then'](function(_0x4e46b2){if(_0x4e46b2){_0x1f10ef=_0x4e46b2[_0x0a9e('0x35')];if(!_0xdb98ca['query']['hasOwnProperty']('nolimit')){_0x1a7b03[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0xdb98ca[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x1a7b03[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0xdb98ca['query'][_0x0a9e('0x19')]);}return _0xc4c230['getSounds'](_0x1a7b03);}})[_0x0a9e('0x22')](function(_0x2aabab){if(_0x2aabab){return _0x2aabab?{'count':_0x1f10ef,'rows':_0x2aabab}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x40fc56,null))[_0x0a9e('0x43')](handleError(_0x40fc56,null));}; \ No newline at end of file +var _0xa9e0=['json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','MusicOnHolds','UserProfileResource','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','body','find','create','sequelize','directory','join','root','server/files/moh','mode','files','0777','get','role','UserProfileSection','userProfileId','autoAssociation','transaction','readdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','removeSound','id2','getSounds','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x4ed1d4,_0x512d9a){var _0x28e363=function(_0x2bdfb7){while(--_0x2bdfb7){_0x4ed1d4['push'](_0x4ed1d4['shift']());}};_0x28e363(++_0x512d9a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);delete _0x140511['query'][_0x0a9e('0x38')];_0x11c3b6['where']=qs[_0x0a9e('0x39')](_[_0x0a9e('0x3a')](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511['query'][_0x0a9e('0x3b')]){_0x11c3b6[_0x0a9e('0x3c')]=_[_0x0a9e('0x3d')](_0x11c3b6['where'],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x1a180b){if(_0x1a180b[_0x0a9e('0x2d')]!=='VIRTUAL'){var _0x546ef8={};_0x546ef8[_0x1a180b[_0x0a9e('0x26')]]={'$like':'%'+_0x140511[_0x0a9e('0x30')]['filter']+'%'};return _0x546ef8;}})});}_0x11c3b6=_[_0x0a9e('0x3d')]({},_0x11c3b6,_0x140511[_0x0a9e('0x3e')]);var _0x2e1b3a={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db['VoiceMusicOnHold']['count'](_0x2e1b3a)[_0x0a9e('0x22')](function(_0x45b3d0){_0x5a101a['count']=_0x45b3d0;if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3f')]){_0x11c3b6[_0x0a9e('0x40')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x0a9e('0x41')](_0x11c3b6);})[_0x0a9e('0x22')](function(_0x274e8e){_0x5a101a[_0x0a9e('0x42')]=_0x274e8e;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x43')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x44')]=function(_0x45a9b8,_0x23b089){var _0x3da2cd={'raw':![],'where':{'id':_0x45a9b8[_0x0a9e('0x45')]['id']}},_0x2c3711={};_0x2c3711[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')]['rawAttributes']);_0x2c3711['query']=_[_0x0a9e('0x31')](_0x45a9b8[_0x0a9e('0x30')]);_0x2c3711[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x2c3711[_0x0a9e('0x2f')],_0x2c3711[_0x0a9e('0x30')]);_0x3da2cd[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x2c3711[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x45a9b8[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x3da2cd['attributes']=_0x3da2cd[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x3da2cd[_0x0a9e('0x33')]:_0x2c3711[_0x0a9e('0x2f')];if(_0x45a9b8[_0x0a9e('0x30')][_0x0a9e('0x3f')]){_0x3da2cd[_0x0a9e('0x40')]=[{'all':!![]}];}_0x3da2cd=_[_0x0a9e('0x3d')]({},_0x3da2cd,_0x45a9b8['options']);return db[_0x0a9e('0x2a')]['find'](_0x3da2cd)[_0x0a9e('0x22')](handleEntityNotFound(_0x23b089,null))[_0x0a9e('0x22')](respondWithResult(_0x23b089,null))[_0x0a9e('0x43')](handleError(_0x23b089,null));};exports['update']=function(_0x14bec2,_0x7f6eb1){if(_0x14bec2[_0x0a9e('0x46')]['id']){delete _0x14bec2[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x47')]({'where':{'id':_0x14bec2[_0x0a9e('0x45')]['id']}})['then'](handleEntityNotFound(_0x7f6eb1,null))[_0x0a9e('0x22')](saveUpdates(_0x14bec2[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x7f6eb1,null))[_0x0a9e('0x43')](handleError(_0x7f6eb1,null));};exports[_0x0a9e('0x48')]=function(_0x992c77,_0x6054ee,_0x19383e){return db[_0x0a9e('0x49')]['transaction'](function(_0xe401a){if(_0x992c77[_0x0a9e('0x46')]['mode']==='files'){_0x992c77['body'][_0x0a9e('0x4a')]=path[_0x0a9e('0x4b')](config[_0x0a9e('0x4c')],_0x0a9e('0x4d'),_0x992c77[_0x0a9e('0x46')][_0x0a9e('0x26')]);}return db[_0x0a9e('0x2a')][_0x0a9e('0x48')](_0x992c77['body'],{'transaction':_0xe401a})['then'](function(_0x53975a){if(_0x992c77[_0x0a9e('0x46')][_0x0a9e('0x4e')]===_0x0a9e('0x4f')){fs['mkdirSync'](_0x53975a[_0x0a9e('0x4a')],parseInt(_0x0a9e('0x50'),0x8));}var _0x53d113=_0x992c77['user'][_0x0a9e('0x51')]({'plain':!![]});if(!_0x53d113)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53d113[_0x0a9e('0x52')]==='user'){var _0x2e5e62=_0x53975a[_0x0a9e('0x51')]({'plain':!![]});return db[_0x0a9e('0x53')]['find']({'where':{'name':_0x0a9e('0x23'),'userProfileId':_0x53d113[_0x0a9e('0x54')]},'raw':!![]})['then'](function(_0x50f687){if(_0x50f687&&_0x50f687[_0x0a9e('0x55')]===0x0){return db[_0x0a9e('0x24')]['create']({'name':_0x2e5e62[_0x0a9e('0x26')],'resourceId':_0x2e5e62['id'],'type':_0x50f687['name'],'sectionId':_0x50f687['id']},{})[_0x0a9e('0x22')](function(){return _0x53975a;});}else{return _0x53975a;}})['catch'](function(_0xe22ccc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe22ccc);});}return _0x53975a;});})['then'](respondWithResult(_0x6054ee,0xc9))[_0x0a9e('0x43')](handleError(_0x6054ee,null));};exports['destroy']=function(_0x2f7092,_0x65432,_0x3cfd00){var _0x19b4df;return db[_0x0a9e('0x2a')][_0x0a9e('0x47')]({'where':{'id':_0x2f7092[_0x0a9e('0x45')]['id']}})[_0x0a9e('0x22')](function(_0x4e67ab){if(_0x4e67ab){return db[_0x0a9e('0x49')][_0x0a9e('0x56')](function(_0x2642bb){return _0x4e67ab[_0x0a9e('0x21')]({'transaction':_0x2642bb,'raw':!![]})[_0x0a9e('0x22')](function(_0x156662){if(_0x156662['directory']){fs[_0x0a9e('0x57')](_0x156662[_0x0a9e('0x4a')])['forEach'](function(_0x3649cc){fs['unlinkSync'](path[_0x0a9e('0x4b')](_0x156662['directory'],_0x3649cc));});fs['rmdirSync'](_0x156662['directory']);}return _0x156662;});})[_0x0a9e('0x43')](function(_0x49d231){throw new db[(_0x0a9e('0x58'))][(_0x0a9e('0x59'))](_0x49d231[_0x0a9e('0x5a')]);});}})[_0x0a9e('0x22')](handleEntityNotFound(_0x65432,null))[_0x0a9e('0x22')](removeEntity(_0x65432,null))[_0x0a9e('0x43')](handleError(_0x65432,null));};exports['addSound']=function(_0x1627a7,_0x5854cc,_0xca4ade){return db[_0x0a9e('0x49')][_0x0a9e('0x56')](function(_0x5adf8f){var _0x453360;return db[_0x0a9e('0x2a')][_0x0a9e('0x47')]({'where':{'id':_0x1627a7[_0x0a9e('0x45')]['id']}})['then'](function(_0x1d0dc8){if(_0x1d0dc8){_0x453360=_0x1d0dc8;return _0x1d0dc8[_0x0a9e('0x5b')](_0x1627a7['body']['id'],{'transaction':_0x5adf8f});}})[_0x0a9e('0x22')](function(_0x17e88c){if(_0x17e88c){return db[_0x0a9e('0x5c')][_0x0a9e('0x5d')]({'where':{'id':_0x1627a7[_0x0a9e('0x46')]['id']},'attributes':['id','name',_0x0a9e('0x5e'),_0x0a9e('0x5f'),_0x0a9e('0x60')],'raw':!![]});}})['then'](function(_0x3528b7){if(_0x3528b7){var _0x4f1e60=path['join'](config[_0x0a9e('0x4c')],_0x0a9e('0x61'),util[_0x0a9e('0x62')](_0x0a9e('0x63'),path[_0x0a9e('0x64')](_0x3528b7[_0x0a9e('0x5e')],path[_0x0a9e('0x65')](_0x3528b7[_0x0a9e('0x5e')])),_0x3528b7[_0x0a9e('0x5f')]));var _0x1cc4f3=path[_0x0a9e('0x4b')](config[_0x0a9e('0x4c')],_0x0a9e('0x4d'),_0x453360[_0x0a9e('0x26')],util[_0x0a9e('0x62')](_0x0a9e('0x63'),_0x3528b7[_0x0a9e('0x26')],_0x3528b7[_0x0a9e('0x5f')]));fs['symlinkSync'](_0x4f1e60,_0x1cc4f3);return _0x3528b7;}})[_0x0a9e('0x43')](function(_0x295763){throw new db[(_0x0a9e('0x58'))]['ValidationError'](_0x295763[_0x0a9e('0x5a')]);});})[_0x0a9e('0x22')](handleEntityNotFound(_0x5854cc,null))['then'](respondWithResult(_0x5854cc,0xc9))[_0x0a9e('0x43')](handleError(_0x5854cc,null));};exports[_0x0a9e('0x66')]=function(_0x3ef315,_0x427946,_0x13b5c0){return db['sequelize']['transaction'](function(_0x4a2438){var _0x40fb85;return db[_0x0a9e('0x2a')][_0x0a9e('0x5d')]({'where':{'id':_0x3ef315[_0x0a9e('0x45')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x427946,null))[_0x0a9e('0x22')](function(_0xeef20){if(_0xeef20){_0x40fb85=_0xeef20;return _0xeef20[_0x0a9e('0x66')](_0x3ef315['params'][_0x0a9e('0x67')]);}})[_0x0a9e('0x22')](function(_0x12ccdb){if(_0x12ccdb){return db['Sound'][_0x0a9e('0x5d')]({'where':{'id':_0x3ef315['params'][_0x0a9e('0x67')]},'attributes':['id',_0x0a9e('0x26'),'save_name',_0x0a9e('0x5f'),_0x0a9e('0x60')],'raw':!![]});}})[_0x0a9e('0x22')](function(_0x317c0c){if(_0x317c0c){fs['unlinkSync'](path[_0x0a9e('0x4b')](_0x40fb85[_0x0a9e('0x4a')],util[_0x0a9e('0x62')](_0x0a9e('0x63'),_0x317c0c['name'],_0x317c0c[_0x0a9e('0x5f')])));return _0x317c0c;}})[_0x0a9e('0x43')](function(_0x2d5506){throw new db[(_0x0a9e('0x58'))]['ValidationError'](_0x2d5506[_0x0a9e('0x5a')]);});})[_0x0a9e('0x22')](handleEntityNotFound(_0x427946,null))[_0x0a9e('0x22')](respondWithStatusCode(_0x427946,0xcc))[_0x0a9e('0x43')](handleError(_0x427946,null));};exports[_0x0a9e('0x68')]=function(_0xdb98ca,_0x40fc56,_0x3df0e3){var _0x1a7b03={};var _0x336dc3={};var _0xc4c230;var _0x1f10ef;return db[_0x0a9e('0x2a')][_0x0a9e('0x5d')]({'where':{'id':_0xdb98ca['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x40fc56,null))[_0x0a9e('0x22')](function(_0xc599b3){if(_0xc599b3){_0xc4c230=_0xc599b3;_0x336dc3['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x5c')][_0x0a9e('0x2b')]);_0x336dc3[_0x0a9e('0x30')]=_['keys'](_0xdb98ca['query']);_0x336dc3[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x336dc3['model'],_0x336dc3[_0x0a9e('0x30')]);_0x1a7b03['attributes']=_[_0x0a9e('0x32')](_0x336dc3[_0x0a9e('0x2f')],qs['fields'](_0xdb98ca[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x1a7b03[_0x0a9e('0x33')]=_0x1a7b03[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x1a7b03[_0x0a9e('0x33')]:_0x336dc3[_0x0a9e('0x2f')];_0x1a7b03['order']=qs[_0x0a9e('0x38')](_0xdb98ca[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x1a7b03[_0x0a9e('0x3c')]=qs['filters'](_[_0x0a9e('0x3a')](_0xdb98ca[_0x0a9e('0x30')],_0x336dc3['filters']));if(_0xdb98ca[_0x0a9e('0x30')]['filter']){_0x1a7b03[_0x0a9e('0x3c')]=_[_0x0a9e('0x3d')](_0x1a7b03[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x1a7b03['attributes'],function(_0x51ccd7){var _0x353384={};_0x353384[_0x51ccd7]={'$like':'%'+_0xdb98ca[_0x0a9e('0x30')][_0x0a9e('0x3b')]+'%'};return _0x353384;})});}_0x1a7b03=_['merge']({},_0x1a7b03,_0xdb98ca[_0x0a9e('0x3e')]);return _0xc4c230[_0x0a9e('0x68')](_0x1a7b03);}})['then'](function(_0x4e46b2){if(_0x4e46b2){_0x1f10ef=_0x4e46b2[_0x0a9e('0x35')];if(!_0xdb98ca['query']['hasOwnProperty']('nolimit')){_0x1a7b03[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0xdb98ca[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x1a7b03[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0xdb98ca['query'][_0x0a9e('0x19')]);}return _0xc4c230['getSounds'](_0x1a7b03);}})[_0x0a9e('0x22')](function(_0x2aabab){if(_0x2aabab){return _0x2aabab?{'count':_0x1f10ef,'rows':_0x2aabab}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x40fc56,null))[_0x0a9e('0x43')](handleError(_0x40fc56,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index efbd691..d829283 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 _0x6c15=['../../config/environment','./voiceMusicOnHold.attributes','define','voice_musiconhold','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1cbc43,_0x5d0f5d){var _0x3d0913=function(_0x36708f){while(--_0x36708f){_0x1cbc43['push'](_0x1cbc43['shift']());}};_0x3d0913(++_0x5d0f5d);}(_0x6c15,0x143));var _0x56c1=function(_0x481de7,_0x214a51){_0x481de7=_0x481de7-0x0;var _0x231d2e=_0x6c15[_0x481de7];return _0x231d2e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x56c1('0x0'))(_0x56c1('0x1'));var moment=require(_0x56c1('0x2'));var BPromise=require(_0x56c1('0x3'));var rp=require(_0x56c1('0x4'));var fs=require('fs');var path=require(_0x56c1('0x5'));var rimraf=require(_0x56c1('0x6'));var config=require(_0x56c1('0x7'));var attributes=require(_0x56c1('0x8'));module['exports']=function(_0x574d52,_0x11c035){return _0x574d52[_0x56c1('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0x56c1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6027=['exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes'];(function(_0x4611c8,_0x315f8e){var _0x2128b6=function(_0x5f238b){while(--_0x5f238b){_0x4611c8['push'](_0x4611c8['shift']());}};_0x2128b6(++_0x315f8e);}(_0x6027,0x18c));var _0x7602=function(_0x2b6600,_0x24c497){_0x2b6600=_0x2b6600-0x0;var _0x912ee2=_0x6027[_0x2b6600];return _0x912ee2;};'use strict';var _=require(_0x7602('0x0'));var util=require(_0x7602('0x1'));var logger=require(_0x7602('0x2'))(_0x7602('0x3'));var moment=require(_0x7602('0x4'));var BPromise=require(_0x7602('0x5'));var rp=require(_0x7602('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7602('0x7'));var config=require(_0x7602('0x8'));var attributes=require(_0x7602('0x9'));module[_0x7602('0xa')]=function(_0x2d80c5,_0x52f238){return _0x2d80c5[_0x7602('0xb')](_0x7602('0xc'),attributes,{'tableName':_0x7602('0xd'),'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 5233c3e..0c8f51c 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 _0x34e7=['VoiceMusicOnHold,\x20%s,\x20%s','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x222a4e,_0x5da519){var _0x383d20=function(_0x2cf2e2){while(--_0x2cf2e2){_0x222a4e['push'](_0x222a4e['shift']());}};_0x383d20(++_0x5da519);}(_0x34e7,0x136));var _0x734e=function(_0x43379c,_0x271d36){_0x43379c=_0x43379c-0x0;var _0x495648=_0x34e7[_0x43379c];return _0x495648;};'use strict';var _=require('lodash');var util=require(_0x734e('0x0'));var moment=require(_0x734e('0x1'));var BPromise=require(_0x734e('0x2'));var rs=require(_0x734e('0x3'));var fs=require('fs');var Redis=require(_0x734e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x734e('0x5'));var logger=require(_0x734e('0x6'))(_0x734e('0x7'));var config=require(_0x734e('0x8'));var jayson=require(_0x734e('0x9'));var client=jayson[_0x734e('0xa')][_0x734e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e9f42,_0x21f7e1,_0xe9a8e1){return new BPromise(function(_0x488734,_0x2fb555){return client[_0x734e('0xc')](_0x1e9f42,_0xe9a8e1)[_0x734e('0xd')](function(_0x408688){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x21f7e1,'request\x20sent');logger['debug'](_0x734e('0xe'),_0x21f7e1,_0x734e('0xf'),JSON[_0x734e('0x10')](_0x408688));if(_0x408688[_0x734e('0x11')]){if(_0x408688[_0x734e('0x11')][_0x734e('0x12')]===0x1f4){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x21f7e1,_0x408688[_0x734e('0x11')]['message']);return _0x2fb555(_0x408688[_0x734e('0x11')][_0x734e('0x13')]);}logger['error'](_0x734e('0x14'),_0x21f7e1,_0x408688[_0x734e('0x11')][_0x734e('0x13')]);return _0x488734(_0x408688[_0x734e('0x11')][_0x734e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x21f7e1,'request\x20sent');_0x488734(_0x408688['result'][_0x734e('0x13')]);}})[_0x734e('0x15')](function(_0x28e241){logger[_0x734e('0x11')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x21f7e1,_0x28e241);_0x2fb555(_0x28e241);});});} \ No newline at end of file +var _0xea83=['VoiceMusicOnHold,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x2aea92,_0x3da838){var _0x211cb9=function(_0x34e81a){while(--_0x34e81a){_0x2aea92['push'](_0x2aea92['shift']());}};_0x211cb9(++_0x3da838);}(_0xea83,0x1d7));var _0x3ea8=function(_0xc93556,_0x840f41){_0xc93556=_0xc93556-0x0;var _0x4453a1=_0xea83[_0xc93556];return _0x4453a1;};'use strict';var _=require(_0x3ea8('0x0'));var util=require('util');var moment=require(_0x3ea8('0x1'));var BPromise=require(_0x3ea8('0x2'));var rs=require(_0x3ea8('0x3'));var fs=require('fs');var Redis=require(_0x3ea8('0x4'));var db=require(_0x3ea8('0x5'))['db'];var utils=require(_0x3ea8('0x6'));var logger=require(_0x3ea8('0x7'))(_0x3ea8('0x8'));var config=require('../../config/environment');var jayson=require(_0x3ea8('0x9'));var client=jayson['client'][_0x3ea8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36756d,_0x1ed1a4,_0x1a6781){return new BPromise(function(_0x4c4b2e,_0x20ba3e){return client[_0x3ea8('0xb')](_0x36756d,_0x1a6781)[_0x3ea8('0xc')](function(_0x54ba72){logger['info'](_0x3ea8('0xd'),_0x1ed1a4,'request\x20sent');logger[_0x3ea8('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x1ed1a4,_0x3ea8('0xf'),JSON[_0x3ea8('0x10')](_0x54ba72));if(_0x54ba72['error']){if(_0x54ba72[_0x3ea8('0x11')][_0x3ea8('0x12')]===0x1f4){logger[_0x3ea8('0x11')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x1ed1a4,_0x54ba72[_0x3ea8('0x11')][_0x3ea8('0x13')]);return _0x20ba3e(_0x54ba72[_0x3ea8('0x11')][_0x3ea8('0x13')]);}logger[_0x3ea8('0x11')](_0x3ea8('0xd'),_0x1ed1a4,_0x54ba72[_0x3ea8('0x11')][_0x3ea8('0x13')]);return _0x4c4b2e(_0x54ba72[_0x3ea8('0x11')][_0x3ea8('0x13')]);}else{logger[_0x3ea8('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x1ed1a4,_0x3ea8('0xf'));_0x4c4b2e(_0x54ba72[_0x3ea8('0x15')][_0x3ea8('0x13')]);}})['catch'](function(_0x3d8538){logger[_0x3ea8('0x11')](_0x3ea8('0xd'),_0x1ed1a4,_0x3d8538);_0x20ba3e(_0x3d8538);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 3a34682..9ccf281 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 _0x01d9=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/users','getAgents','post','addAgents','put','update','delete','destroy','removeAgents','exports'];(function(_0x58ff73,_0x486674){var _0x490502=function(_0x45adad){while(--_0x45adad){_0x58ff73['push'](_0x58ff73['shift']());}};_0x490502(++_0x486674);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var path=require(_0x901d('0x2'));var timeout=require(_0x901d('0x3'));var express=require('express');var router=express[_0x901d('0x4')]();var fs_extra=require(_0x901d('0x5'));var auth=require(_0x901d('0x6'));var interaction=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var controller=require(_0x901d('0x9'));router[_0x901d('0xa')]('/',auth['isAuthenticated'](),controller[_0x901d('0xb')]);router[_0x901d('0xa')](_0x901d('0xc'),auth[_0x901d('0xd')](),controller[_0x901d('0xe')]);router[_0x901d('0xa')](_0x901d('0xf'),auth[_0x901d('0xd')](),controller[_0x901d('0x10')]);router[_0x901d('0xa')](_0x901d('0x11'),auth[_0x901d('0xd')](),controller[_0x901d('0x12')]);router['post']('/',auth[_0x901d('0xd')](),controller['create']);router[_0x901d('0x13')](_0x901d('0x11'),auth[_0x901d('0xd')](),controller[_0x901d('0x14')]);router[_0x901d('0x15')]('/:id',auth[_0x901d('0xd')](),controller[_0x901d('0x16')]);router[_0x901d('0x17')](_0x901d('0xf'),auth[_0x901d('0xd')](),controller[_0x901d('0x18')]);router['delete'](_0x901d('0x11'),auth[_0x901d('0xd')](),controller[_0x901d('0x19')]);module[_0x901d('0x1a')]=router; \ No newline at end of file +var _0x277c=['show','/:id/users','create','post','addAgents','update','delete','destroy','removeAgents','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','/:id'];(function(_0x32f05c,_0x273aef){var _0x4307ed=function(_0x1be4da){while(--_0x1be4da){_0x32f05c['push'](_0x32f05c['shift']());}};_0x4307ed(++_0x273aef);}(_0x277c,0x153));var _0xc277=function(_0x1197ec,_0x26406f){_0x1197ec=_0x1197ec-0x0;var _0x269262=_0x277c[_0x1197ec];return _0x269262;};'use strict';var multer=require(_0xc277('0x0'));var util=require('util');var path=require(_0xc277('0x1'));var timeout=require(_0xc277('0x2'));var express=require(_0xc277('0x3'));var router=express[_0xc277('0x4')]();var fs_extra=require(_0xc277('0x5'));var auth=require(_0xc277('0x6'));var interaction=require(_0xc277('0x7'));var config=require(_0xc277('0x8'));var controller=require('./voicePrefix.controller');router['get']('/',auth[_0xc277('0x9')](),controller['index']);router[_0xc277('0xa')]('/describe',auth[_0xc277('0x9')](),controller[_0xc277('0xb')]);router['get'](_0xc277('0xc'),auth[_0xc277('0x9')](),controller[_0xc277('0xd')]);router[_0xc277('0xa')](_0xc277('0xe'),auth[_0xc277('0x9')](),controller['getAgents']);router['post']('/',auth[_0xc277('0x9')](),controller[_0xc277('0xf')]);router[_0xc277('0x10')](_0xc277('0xe'),auth['isAuthenticated'](),controller[_0xc277('0x11')]);router['put'](_0xc277('0xc'),auth[_0xc277('0x9')](),controller[_0xc277('0x12')]);router[_0xc277('0x13')]('/:id',auth[_0xc277('0x9')](),controller[_0xc277('0x14')]);router[_0xc277('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0xc277('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index f37b8d9..5bd63b1 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 _0xd373=['getDataValue','STRING','exports','name','VIRTUAL','system-'];(function(_0x2bb282,_0x45951e){var _0x124556=function(_0x122f24){while(--_0x122f24){_0x2bb282['push'](_0x2bb282['shift']());}};_0x124556(++_0x45951e);}(_0xd373,0x9e));var _0x3d37=function(_0x29eceb,_0x30b449){_0x29eceb=_0x29eceb-0x0;var _0x547c67=_0xd373[_0x29eceb];return _0x547c67;};'use strict';var Sequelize=require('sequelize');module[_0x3d37('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3d37('0x1')},'prefix':{'type':Sequelize[_0x3d37('0x2')],'get':function(_0x36bed1){return _0x3d37('0x3')+this[_0x3d37('0x4')](_0x3d37('0x1'))+'-';}},'description':{'type':Sequelize[_0x3d37('0x5')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xac54=['STRING','sequelize','exports','name','VIRTUAL','system-','getDataValue'];(function(_0x42da24,_0x8150ac){var _0x344b44=function(_0x26f7dc){while(--_0x26f7dc){_0x42da24['push'](_0x42da24['shift']());}};_0x344b44(++_0x8150ac);}(_0xac54,0xb0));var _0x4ac5=function(_0x2034e0,_0x583cd1){_0x2034e0=_0x2034e0-0x0;var _0xc207a8=_0xac54[_0x2034e0];return _0xc207a8;};'use strict';var Sequelize=require(_0x4ac5('0x0'));module[_0x4ac5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4ac5('0x2')},'prefix':{'type':Sequelize[_0x4ac5('0x3')],'get':function(_0x543ece){return _0x4ac5('0x4')+this[_0x4ac5('0x5')](_0x4ac5('0x2'))+'-';}},'description':{'type':Sequelize[_0x4ac5('0x6')]},'callerIdAll':{'type':Sequelize[_0x4ac5('0x6')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index cdf2366..82786c0 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 _0xeb82=['redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','save','then','VoicePrefixes','UserProfileResource','destroy','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','VoicePrefix','count','includeAll','catch','show','include','options','find','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','push','callerIdAll','No\x20callerid\x20available','${EXTEN:','charAt','system-','findById','params','addAgents','body','ids','spread','emit','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','pick','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xeb82,0xdb));var _0x2eb8=function(_0x36a984,_0xc7c343){_0x36a984=_0x36a984-0x0;var _0xc2d3e0=_0xeb82[_0x36a984];return _0xc2d3e0;};'use strict';var emlformat=require(_0x2eb8('0x0'));var rimraf=require(_0x2eb8('0x1'));var zipdir=require(_0x2eb8('0x2'));var jsonpatch=require(_0x2eb8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2eb8('0x4'));var Mustache=require(_0x2eb8('0x5'));var util=require(_0x2eb8('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x2eb8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2eb8('0x8'));var squel=require(_0x2eb8('0x9'));var crypto=require(_0x2eb8('0xa'));var jsforce=require(_0x2eb8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2eb8('0x7'));var querystring=require(_0x2eb8('0xc'));var Papa=require('papaparse');var Redis=require(_0x2eb8('0xd'));var authService=require(_0x2eb8('0xe'));var qs=require(_0x2eb8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2eb8('0x10'));var logger=require(_0x2eb8('0x11'))(_0x2eb8('0x12'));var utils=require(_0x2eb8('0x13'));var config=require(_0x2eb8('0x14'));var licenseUtil=require(_0x2eb8('0x15'));var db=require(_0x2eb8('0x16'))['db'];config[_0x2eb8('0x17')]=_[_0x2eb8('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2eb8('0x19'))(new Redis(config[_0x2eb8('0x17')]));require(_0x2eb8('0x1a'))[_0x2eb8('0x1b')](socket);function respondWithStatusCode(_0x18be83,_0x147c66){_0x147c66=_0x147c66||0xcc;return function(_0x330328){if(_0x330328){return _0x18be83[_0x2eb8('0x1c')](_0x147c66);}return _0x18be83[_0x2eb8('0x1d')](_0x147c66)[_0x2eb8('0x1e')]();};}function respondWithResult(_0x1fee82,_0x5494b5){_0x5494b5=_0x5494b5||0xc8;return function(_0x3dab97){if(_0x3dab97){return _0x1fee82[_0x2eb8('0x1d')](_0x5494b5)['json'](_0x3dab97);}};}function respondWithFilteredResult(_0x4cfc07,_0x157947){return function(_0x72a0d6){if(_0x72a0d6){var _0x239fcd=_0x72a0d6['count'],_0x2be2b8=_0x157947['offset'],_0x13e740=_0x157947[_0x2eb8('0x1f')]+_0x157947['limit'],_0x282199;if(_0x13e740>=_0x239fcd){_0x13e740=_0x239fcd;_0x282199=0xc8;}else{_0x282199=0xce;}_0x4cfc07[_0x2eb8('0x1d')](_0x282199);return _0x4cfc07[_0x2eb8('0x20')](_0x2eb8('0x21'),_0x2be2b8+'-'+_0x13e740+'/'+_0x239fcd)[_0x2eb8('0x22')](_0x72a0d6);}return null;};}function patchUpdates(_0x58a1b8){return function(_0x109a08){try{jsonpatch[_0x2eb8('0x23')](_0x109a08,_0x58a1b8,!![]);}catch(_0x83a018){return BPromise[_0x2eb8('0x24')](_0x83a018);}return _0x109a08[_0x2eb8('0x25')]();};}function saveUpdates(_0x4c0deb,_0x27cc29){return function(_0x111cde){if(_0x111cde){return _0x111cde['update'](_0x4c0deb)[_0x2eb8('0x26')](function(_0x119ec2){return _0x119ec2;});}return null;};}function removeEntity(_0x4de8c1,_0x323e0c){return function(_0x3a2d9c){if(_0x3a2d9c){return _0x3a2d9c['destroy']()[_0x2eb8('0x26')](function(){var _0x13160e=_0x3a2d9c['get']({'plain':!![]});var _0x136b1a=_0x2eb8('0x27');return db[_0x2eb8('0x28')][_0x2eb8('0x29')]({'where':{'type':_0x136b1a,'resourceId':_0x13160e['id']}})[_0x2eb8('0x26')](function(){return _0x3a2d9c;});})[_0x2eb8('0x26')](function(){_0x4de8c1['status'](0xcc)[_0x2eb8('0x1e')]();});}};}function handleEntityNotFound(_0x1b00aa,_0x3d3358){return function(_0x2ac4f9){if(!_0x2ac4f9){_0x1b00aa[_0x2eb8('0x1c')](0x194);}return _0x2ac4f9;};}function handleError(_0x18a6ce,_0x5446ed){_0x5446ed=_0x5446ed||0x1f4;return function(_0x7fc83b){logger[_0x2eb8('0x2a')](_0x7fc83b['stack']);if(_0x7fc83b[_0x2eb8('0x2b')]){delete _0x7fc83b['name'];}_0x18a6ce['status'](_0x5446ed)[_0x2eb8('0x2c')](_0x7fc83b);};}exports['index']=function(_0x1b6f20,_0x7552a5){var _0x14889f={},_0x482dd1={},_0x578b0e={'count':0x0,'rows':[]};var _0x3f0c58=_[_0x2eb8('0x2d')](db['VoicePrefix'][_0x2eb8('0x2e')],function(_0x2c9ffb){return{'name':_0x2c9ffb[_0x2eb8('0x2f')],'type':_0x2c9ffb[_0x2eb8('0x30')][_0x2eb8('0x31')]};});_0x482dd1[_0x2eb8('0x32')]=_[_0x2eb8('0x2d')](_0x3f0c58,_0x2eb8('0x2b'));_0x482dd1[_0x2eb8('0x33')]=_[_0x2eb8('0x34')](_0x1b6f20[_0x2eb8('0x33')]);_0x482dd1[_0x2eb8('0x35')]=_[_0x2eb8('0x36')](_0x482dd1['model'],_0x482dd1[_0x2eb8('0x33')]);_0x14889f[_0x2eb8('0x37')]=_[_0x2eb8('0x36')](_0x482dd1['model'],qs[_0x2eb8('0x38')](_0x1b6f20['query'][_0x2eb8('0x38')]));_0x14889f[_0x2eb8('0x37')]=_0x14889f[_0x2eb8('0x37')][_0x2eb8('0x39')]?_0x14889f[_0x2eb8('0x37')]:_0x482dd1['model'];if(!_0x1b6f20[_0x2eb8('0x33')][_0x2eb8('0x3a')](_0x2eb8('0x3b'))){_0x14889f['limit']=qs[_0x2eb8('0x3c')](_0x1b6f20['query'][_0x2eb8('0x3c')]);_0x14889f[_0x2eb8('0x1f')]=qs['offset'](_0x1b6f20[_0x2eb8('0x33')][_0x2eb8('0x1f')]);}_0x14889f[_0x2eb8('0x3d')]=qs['sort'](_0x1b6f20[_0x2eb8('0x33')][_0x2eb8('0x3e')]);_0x14889f[_0x2eb8('0x3f')]=qs[_0x2eb8('0x35')](_['pick'](_0x1b6f20[_0x2eb8('0x33')],_0x482dd1[_0x2eb8('0x35')]),_0x3f0c58);if(_0x1b6f20[_0x2eb8('0x33')][_0x2eb8('0x40')]){_0x14889f[_0x2eb8('0x3f')]=_['merge'](_0x14889f[_0x2eb8('0x3f')],{'$or':_[_0x2eb8('0x2d')](_0x3f0c58,function(_0x56225f){if(_0x56225f[_0x2eb8('0x30')]!==_0x2eb8('0x41')){var _0x13abfd={};_0x13abfd[_0x56225f[_0x2eb8('0x2b')]]={'$like':'%'+_0x1b6f20[_0x2eb8('0x33')][_0x2eb8('0x40')]+'%'};return _0x13abfd;}})});}_0x14889f=_[_0x2eb8('0x42')]({},_0x14889f,_0x1b6f20['options']);var _0x378a78={'where':_0x14889f[_0x2eb8('0x3f')]};return db[_0x2eb8('0x43')][_0x2eb8('0x44')](_0x378a78)[_0x2eb8('0x26')](function(_0x4f6f94){_0x578b0e[_0x2eb8('0x44')]=_0x4f6f94;if(_0x1b6f20[_0x2eb8('0x33')][_0x2eb8('0x45')]){_0x14889f['include']=[{'all':!![]}];}return db[_0x2eb8('0x43')]['findAll'](_0x14889f);})[_0x2eb8('0x26')](function(_0x16e632){_0x578b0e['rows']=_0x16e632;return _0x578b0e;})[_0x2eb8('0x26')](respondWithFilteredResult(_0x7552a5,_0x14889f))[_0x2eb8('0x46')](handleError(_0x7552a5,null));};exports[_0x2eb8('0x47')]=function(_0x4273fb,_0x742205){var _0x5e79bc={'raw':![],'where':{'id':_0x4273fb['params']['id']}},_0x18e584={};_0x18e584[_0x2eb8('0x32')]=_[_0x2eb8('0x34')](db[_0x2eb8('0x43')]['rawAttributes']);_0x18e584[_0x2eb8('0x33')]=_[_0x2eb8('0x34')](_0x4273fb[_0x2eb8('0x33')]);_0x18e584[_0x2eb8('0x35')]=_[_0x2eb8('0x36')](_0x18e584[_0x2eb8('0x32')],_0x18e584[_0x2eb8('0x33')]);_0x5e79bc['attributes']=_['intersection'](_0x18e584['model'],qs['fields'](_0x4273fb[_0x2eb8('0x33')][_0x2eb8('0x38')]));_0x5e79bc[_0x2eb8('0x37')]=_0x5e79bc[_0x2eb8('0x37')][_0x2eb8('0x39')]?_0x5e79bc[_0x2eb8('0x37')]:_0x18e584[_0x2eb8('0x32')];if(_0x4273fb[_0x2eb8('0x33')][_0x2eb8('0x45')]){_0x5e79bc[_0x2eb8('0x48')]=[{'all':!![]}];}_0x5e79bc=_['merge']({},_0x5e79bc,_0x4273fb[_0x2eb8('0x49')]);return db[_0x2eb8('0x43')][_0x2eb8('0x4a')](_0x5e79bc)['then'](handleEntityNotFound(_0x742205,null))[_0x2eb8('0x26')](respondWithResult(_0x742205,null))[_0x2eb8('0x46')](handleError(_0x742205,null));};exports[_0x2eb8('0x29')]=function(_0x3c761b,_0x193ad7){return db[_0x2eb8('0x43')][_0x2eb8('0x4a')]({'where':{'id':_0x3c761b['params']['id']}})['then'](handleEntityNotFound(_0x193ad7,null))[_0x2eb8('0x26')](removeEntity(_0x193ad7,null))[_0x2eb8('0x46')](handleError(_0x193ad7,null));};exports['describe']=function(_0x51013c,_0x5313b7){return db['VoicePrefix'][_0x2eb8('0x4b')]()[_0x2eb8('0x26')](respondWithResult(_0x5313b7,null))[_0x2eb8('0x46')](handleError(_0x5313b7,null));};exports[_0x2eb8('0x4c')]=function(_0x1ec702,_0x2eee88){var _0x24c21d;return db[_0x2eb8('0x4d')][_0x2eb8('0x4e')](function(_0x2252e6){return db['VoicePrefix']['create'](_0x1ec702['body'],{'transaction':_0x2252e6})[_0x2eb8('0x26')](function(_0x4bdee1){_0x24c21d=_0x4bdee1['get']({'plain':!![]});return db[_0x2eb8('0x4f')][_0x2eb8('0x4a')]({'where':{'id':_0x24c21d[_0x2eb8('0x50')]},'raw':!![]})[_0x2eb8('0x26')](function(_0x562da8){return createVoicePrefixExtensions(_0x24c21d,_0x562da8,_0x2252e6);});});})['then'](function(){var _0x1a242e=_0x1ec702['user'][_0x2eb8('0x51')]({'plain':!![]});if(!_0x1a242e)throw new Error(_0x2eb8('0x52'));if(_0x1a242e[_0x2eb8('0x53')]===_0x2eb8('0x54')){var _0x1f1b97=_0x24c21d;return db[_0x2eb8('0x55')]['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x1a242e[_0x2eb8('0x56')]},'raw':!![]})[_0x2eb8('0x26')](function(_0x455f69){if(_0x455f69&&_0x455f69['autoAssociation']===0x0){return db[_0x2eb8('0x28')][_0x2eb8('0x4c')]({'name':_0x1f1b97[_0x2eb8('0x2b')],'resourceId':_0x1f1b97['id'],'type':_0x455f69[_0x2eb8('0x2b')],'sectionId':_0x455f69['id']},{})[_0x2eb8('0x26')](function(){return _0x24c21d;});}else{return _0x24c21d;}})[_0x2eb8('0x46')](function(_0x5da015){logger['error'](_0x2eb8('0x57'),_0x5da015);throw _0x5da015;});}return _0x24c21d;})[_0x2eb8('0x26')](respondWithResult(_0x2eee88,null))[_0x2eb8('0x46')](handleError(_0x2eee88,null));};function Extension(_0x74df54,_0x3e6fe6,_0x1c5c23,_0x23c8e0){this[_0x2eb8('0x58')]=_0x2eb8('0x59');this[_0x2eb8('0x5a')]=_0x74df54;this[_0x2eb8('0x5b')]=_0x1c5c23;this[_0x2eb8('0x30')]=_0x2eb8('0x5c');this[_0x2eb8('0x5d')]='Voice\x20Prefix\x20Extension';this['priority']=_0x3e6fe6;this['appdata']=_0x23c8e0;}function createVoicePrefixExtensions(_0x3504eb,_0x1c9adc,_0x19cb3e){return new BPromise(function(_0x1e65ac,_0x5e7510){var _0x55308f=new Extension(formatPrefixName(_0x3504eb[_0x2eb8('0x5e')]),0x1,_0x2eb8('0x5f'),_0x2eb8('0x60'));_0x55308f[_0x2eb8('0x61')]=_0x3504eb['id'];return db[_0x2eb8('0x4f')][_0x2eb8('0x4c')](_0x55308f,{'transaction':_0x19cb3e})[_0x2eb8('0x26')](function(_0x230b6e){var _0x4f90b7=_0x230b6e[_0x2eb8('0x51')]({'plain':!![]});var _0x52fa36=_[_0x2eb8('0x2d')](addVoicePrefixExtensions(_0x3504eb,_0x1c9adc),function(_0x32a272){_0x32a272[_0x2eb8('0x50')]=_0x4f90b7['id'];_0x32a272['VoicePrefixId']=_0x3504eb['id'];return _0x32a272;});return db[_0x2eb8('0x4f')][_0x2eb8('0x62')](_0x52fa36,{'transaction':_0x19cb3e})[_0x2eb8('0x26')](function(_0x404736){if(!_0x404736){return _0x5e7510(_0x2eb8('0x63'));}else{return _0x1e65ac(_0x404736);}})[_0x2eb8('0x46')](function(_0x5d5a68){return _0x5e7510(_0x5d5a68);});});;});};function addVoicePrefixExtensions(_0x54ca4b,_0x575523){var _0x1accfc=[];var _0x3c21fc=formatPrefixName(_0x54ca4b['prefix']);_0x1accfc['push'](new Extension(_0x3c21fc,0x2,_0x2eb8('0x64'),_0x2eb8('0x65')+_0x54ca4b[_0x2eb8('0x2b')]));if(_0x54ca4b['callerIdAll']){_0x1accfc[_0x2eb8('0x66')](new Extension(_0x3c21fc,0x3,_0x2eb8('0x64'),'PREFIX-CALLERIDALL='+_0x54ca4b[_0x2eb8('0x67')]));}else{_0x1accfc[_0x2eb8('0x66')](new Extension(_0x3c21fc,0x3,_0x2eb8('0x5f'),_0x2eb8('0x68')));}_0x1accfc[_0x2eb8('0x66')](new Extension(_0x3c21fc,0x4,'goto',_0x575523[_0x2eb8('0x58')]+','+_0x2eb8('0x69')+(0x8+_0x54ca4b['name'][_0x2eb8('0x39')])+'}'+','+0x1));return _0x1accfc;}function formatPrefixName(_0x44659e){var _0x507fc1='_';for(var _0xadca90=0x0;_0xadca90<_0x44659e['length'];_0xadca90++){if(_0x44659e['charAt'](_0xadca90)=='-'){_0x507fc1+=_0x44659e['charAt'](_0xadca90);}else{_0x507fc1+='['+_0x44659e[_0x2eb8('0x6a')](_0xadca90)+']';}}_0x507fc1+='.';return _0x507fc1;}exports['update']=function(_0xc09a25,_0x4f1160,_0x49ba7f){var _0x33db88=_0xc09a25['body'];_0x33db88[_0x2eb8('0x5e')]=_0x2eb8('0x6b')+_0x33db88[_0x2eb8('0x2b')]+'-';return db['sequelize'][_0x2eb8('0x4e')](function(_0x335be1){return db['VoicePrefix']['update'](_0x33db88,{'where':{'id':_0x33db88['id']},'transaction':_0x335be1})[_0x2eb8('0x26')](function(){return db[_0x2eb8('0x4f')][_0x2eb8('0x29')]({'where':{'VoicePrefixId':_0x33db88['id']},'transaction':_0x335be1})[_0x2eb8('0x26')](function(){return db[_0x2eb8('0x4f')][_0x2eb8('0x4a')]({'where':{'id':_0x33db88[_0x2eb8('0x50')]},'raw':!![]})['then'](function(_0x4c5b41){return createVoicePrefixExtensions(_0x33db88,_0x4c5b41,_0x335be1);});});});})[_0x2eb8('0x26')](function(){return db[_0x2eb8('0x43')][_0x2eb8('0x6c')](_0x33db88['id']);})[_0x2eb8('0x26')](respondWithResult(_0x4f1160,null))[_0x2eb8('0x46')](handleError(_0x4f1160,null));};exports['addAgents']=function(_0x177637,_0x3d387d,_0xb20a7){return db[_0x2eb8('0x43')][_0x2eb8('0x4a')]({'where':{'id':_0x177637[_0x2eb8('0x6d')]['id']}})[_0x2eb8('0x26')](handleEntityNotFound(_0x3d387d,null))[_0x2eb8('0x26')](function(_0x432b79){if(_0x432b79){return _0x432b79[_0x2eb8('0x6e')](_0x177637[_0x2eb8('0x6f')][_0x2eb8('0x70')],_['omit'](_0x177637[_0x2eb8('0x6f')],[_0x2eb8('0x70'),'id'])||{})[_0x2eb8('0x71')](function(_0x49a942){for(var _0x52860e=0x0;_0x52860e<_0x177637[_0x2eb8('0x6f')][_0x2eb8('0x70')][_0x2eb8('0x39')];_0x52860e+=0x1){socket[_0x2eb8('0x72')]('userVoicePrefix:save',{'UserId':_0x177637[_0x2eb8('0x6f')][_0x2eb8('0x70')][_0x52860e],'VoicePrefixId':_0x177637[_0x2eb8('0x6d')]['id']});}return _0x49a942;});}})['then'](respondWithResult(_0x3d387d,null))['catch'](handleError(_0x3d387d,null));};exports[_0x2eb8('0x73')]=function(_0x4a8fcb,_0x4685cb,_0x7c7cce){return db[_0x2eb8('0x43')][_0x2eb8('0x4a')]({'where':{'id':_0x4a8fcb[_0x2eb8('0x6d')]['id']}})['then'](handleEntityNotFound(_0x4685cb,null))['then'](function(_0x4f7ef1){if(_0x4f7ef1){return _0x4f7ef1[_0x2eb8('0x73')](_0x4a8fcb[_0x2eb8('0x33')][_0x2eb8('0x70')])[_0x2eb8('0x26')](function(){if(_['isArray'](_0x4a8fcb[_0x2eb8('0x33')][_0x2eb8('0x70')])){for(var _0x30a555=0x0;_0x30a555<_0x4a8fcb[_0x2eb8('0x33')]['ids'][_0x2eb8('0x39')];_0x30a555+=0x1){socket[_0x2eb8('0x72')](_0x2eb8('0x74'),{'UserId':Number(_0x4a8fcb[_0x2eb8('0x33')][_0x2eb8('0x70')][_0x30a555]),'VoicePrefixId':Number(_0x4a8fcb[_0x2eb8('0x6d')]['id'])});}}else{socket[_0x2eb8('0x72')]('userVoicePrefix:remove',{'UserId':Number(_0x4a8fcb[_0x2eb8('0x33')][_0x2eb8('0x70')]),'VoicePrefixId':Number(_0x4a8fcb[_0x2eb8('0x6d')]['id'])});}});}})[_0x2eb8('0x26')](respondWithStatusCode(_0x4685cb,null))[_0x2eb8('0x46')](handleError(_0x4685cb,null));};exports[_0x2eb8('0x75')]=function(_0x5b6388,_0x221e64,_0x3cc232){var _0x941fd1={};var _0x4739e3={};var _0x2810a2;var _0x368a96;return db[_0x2eb8('0x43')][_0x2eb8('0x76')]({'where':{'id':_0x5b6388['params']['id']}})[_0x2eb8('0x26')](handleEntityNotFound(_0x221e64,null))[_0x2eb8('0x26')](function(_0x3b2202){if(_0x3b2202){_0x2810a2=_0x3b2202;_0x4739e3[_0x2eb8('0x32')]=_[_0x2eb8('0x34')](db[_0x2eb8('0x77')][_0x2eb8('0x2e')]);_0x4739e3[_0x2eb8('0x33')]=_[_0x2eb8('0x34')](_0x5b6388[_0x2eb8('0x33')]);_0x4739e3['filters']=_[_0x2eb8('0x36')](_0x4739e3[_0x2eb8('0x32')],_0x4739e3['query']);_0x941fd1[_0x2eb8('0x37')]=_[_0x2eb8('0x36')](_0x4739e3[_0x2eb8('0x32')],qs[_0x2eb8('0x38')](_0x5b6388[_0x2eb8('0x33')][_0x2eb8('0x38')]));_0x941fd1[_0x2eb8('0x37')]=_0x941fd1[_0x2eb8('0x37')][_0x2eb8('0x39')]?_0x941fd1['attributes']:_0x4739e3[_0x2eb8('0x32')];_0x941fd1['order']=qs[_0x2eb8('0x3e')](_0x5b6388[_0x2eb8('0x33')][_0x2eb8('0x3e')]);_0x941fd1[_0x2eb8('0x3f')]=qs['filters'](_[_0x2eb8('0x78')](_0x5b6388[_0x2eb8('0x33')],_0x4739e3[_0x2eb8('0x35')]));if(_0x5b6388[_0x2eb8('0x33')][_0x2eb8('0x40')]){_0x941fd1[_0x2eb8('0x3f')]=_[_0x2eb8('0x42')](_0x941fd1['where'],{'$or':_['map'](_0x941fd1[_0x2eb8('0x37')],function(_0x54c2c8){var _0x2e8ef9={};_0x2e8ef9[_0x54c2c8]={'$like':'%'+_0x5b6388['query'][_0x2eb8('0x40')]+'%'};return _0x2e8ef9;})});}_0x941fd1=_[_0x2eb8('0x42')]({},_0x941fd1,_0x5b6388[_0x2eb8('0x49')]);return _0x2810a2[_0x2eb8('0x75')](_0x941fd1);}})[_0x2eb8('0x26')](function(_0x3b2220){if(_0x3b2220){_0x368a96=_0x3b2220[_0x2eb8('0x39')];if(!_0x5b6388[_0x2eb8('0x33')][_0x2eb8('0x3a')]('nolimit')){_0x941fd1['limit']=qs['limit'](_0x5b6388[_0x2eb8('0x33')]['limit']);_0x941fd1[_0x2eb8('0x1f')]=qs[_0x2eb8('0x1f')](_0x5b6388[_0x2eb8('0x33')]['offset']);}return _0x2810a2['getAgents'](_0x941fd1);}})[_0x2eb8('0x26')](function(_0x1359f8){if(_0x1359f8){return _0x1359f8?{'count':_0x368a96,'rows':_0x1359f8}:null;}})[_0x2eb8('0x26')](respondWithResult(_0x221e64,null))[_0x2eb8('0x46')](handleError(_0x221e64,null));}; \ No newline at end of file +var _0x777d=['limit','Content-Range','json','apply','save','then','destroy','get','VoicePrefixes','UserProfileResource','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','catch','describe','create','sequelize','transaction','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','type','system','description','priority','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','goto','${EXTEN:','charAt','body','system-','update','VoiceExtensionId','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','sort','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','count','offset'];(function(_0x400b43,_0x55da4e){var _0x3c330f=function(_0x5bbd52){while(--_0x5bbd52){_0x400b43['push'](_0x400b43['shift']());}};_0x3c330f(++_0x55da4e);}(_0x777d,0x1e0));var _0xd777=function(_0x4a5f6c,_0x4f532e){_0x4a5f6c=_0x4a5f6c-0x0;var _0x281ffd=_0x777d[_0x4a5f6c];return _0x281ffd;};'use strict';var emlformat=require(_0xd777('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd777('0x1'));var jsonpatch=require(_0xd777('0x2'));var rp=require(_0xd777('0x3'));var moment=require(_0xd777('0x4'));var BPromise=require(_0xd777('0x5'));var Mustache=require(_0xd777('0x6'));var util=require(_0xd777('0x7'));var path=require(_0xd777('0x8'));var sox=require(_0xd777('0x9'));var csv=require(_0xd777('0xa'));var ejs=require(_0xd777('0xb'));var fs=require('fs');var fs_extra=require(_0xd777('0xc'));var _=require(_0xd777('0xd'));var squel=require(_0xd777('0xe'));var crypto=require(_0xd777('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xd777('0x10'));var toCsv=require(_0xd777('0xa'));var querystring=require(_0xd777('0x11'));var Papa=require('papaparse');var Redis=require(_0xd777('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd777('0x13'));var hardwareService=require(_0xd777('0x14'));var logger=require('../../config/logger')(_0xd777('0x15'));var utils=require(_0xd777('0x16'));var config=require(_0xd777('0x17'));var licenseUtil=require(_0xd777('0x18'));var db=require(_0xd777('0x19'))['db'];config[_0xd777('0x1a')]=_[_0xd777('0x1b')](config[_0xd777('0x1a')],{'host':_0xd777('0x1c'),'port':0x18eb});var socket=require(_0xd777('0x1d'))(new Redis(config[_0xd777('0x1a')]));require('./voicePrefix.socket')[_0xd777('0x1e')](socket);function respondWithStatusCode(_0x61c71f,_0x11c5b1){_0x11c5b1=_0x11c5b1||0xcc;return function(_0x3e128f){if(_0x3e128f){return _0x61c71f[_0xd777('0x1f')](_0x11c5b1);}return _0x61c71f[_0xd777('0x20')](_0x11c5b1)[_0xd777('0x21')]();};}function respondWithResult(_0xa71a3e,_0x3c0839){_0x3c0839=_0x3c0839||0xc8;return function(_0xe3ae92){if(_0xe3ae92){return _0xa71a3e[_0xd777('0x20')](_0x3c0839)['json'](_0xe3ae92);}};}function respondWithFilteredResult(_0x44a873,_0x59db80){return function(_0x5c7dcb){if(_0x5c7dcb){var _0x382d4f=_0x5c7dcb[_0xd777('0x22')],_0x31eec1=_0x59db80[_0xd777('0x23')],_0x350a98=_0x59db80[_0xd777('0x23')]+_0x59db80[_0xd777('0x24')],_0x1fd3ea;if(_0x350a98>=_0x382d4f){_0x350a98=_0x382d4f;_0x1fd3ea=0xc8;}else{_0x1fd3ea=0xce;}_0x44a873[_0xd777('0x20')](_0x1fd3ea);return _0x44a873['set'](_0xd777('0x25'),_0x31eec1+'-'+_0x350a98+'/'+_0x382d4f)[_0xd777('0x26')](_0x5c7dcb);}return null;};}function patchUpdates(_0x390624){return function(_0x2c5c5c){try{jsonpatch[_0xd777('0x27')](_0x2c5c5c,_0x390624,!![]);}catch(_0x318afe){return BPromise['reject'](_0x318afe);}return _0x2c5c5c[_0xd777('0x28')]();};}function saveUpdates(_0x3a475f,_0x48f3db){return function(_0x361803){if(_0x361803){return _0x361803['update'](_0x3a475f)[_0xd777('0x29')](function(_0x180069){return _0x180069;});}return null;};}function removeEntity(_0x9a2eab,_0x425c53){return function(_0x692128){if(_0x692128){return _0x692128[_0xd777('0x2a')]()[_0xd777('0x29')](function(){var _0x270a1a=_0x692128[_0xd777('0x2b')]({'plain':!![]});var _0x5d89c8=_0xd777('0x2c');return db[_0xd777('0x2d')][_0xd777('0x2a')]({'where':{'type':_0x5d89c8,'resourceId':_0x270a1a['id']}})[_0xd777('0x29')](function(){return _0x692128;});})[_0xd777('0x29')](function(){_0x9a2eab['status'](0xcc)[_0xd777('0x21')]();});}};}function handleEntityNotFound(_0x3b7853,_0x3f3d7c){return function(_0x113839){if(!_0x113839){_0x3b7853['sendStatus'](0x194);}return _0x113839;};}function handleError(_0xa09048,_0x5a0de8){_0x5a0de8=_0x5a0de8||0x1f4;return function(_0x9eb30f){logger['error'](_0x9eb30f[_0xd777('0x2e')]);if(_0x9eb30f[_0xd777('0x2f')]){delete _0x9eb30f[_0xd777('0x2f')];}_0xa09048[_0xd777('0x20')](_0x5a0de8)[_0xd777('0x30')](_0x9eb30f);};}exports[_0xd777('0x31')]=function(_0x4e3df1,_0x5488b5){var _0x11cbe7={},_0x3e412e={},_0x5a6888={'count':0x0,'rows':[]};var _0xd6fea6=_[_0xd777('0x32')](db[_0xd777('0x33')][_0xd777('0x34')],function(_0x530c61){return{'name':_0x530c61[_0xd777('0x35')],'type':_0x530c61['type'][_0xd777('0x36')]};});_0x3e412e['model']=_[_0xd777('0x32')](_0xd6fea6,_0xd777('0x2f'));_0x3e412e[_0xd777('0x37')]=_[_0xd777('0x38')](_0x4e3df1[_0xd777('0x37')]);_0x3e412e[_0xd777('0x39')]=_[_0xd777('0x3a')](_0x3e412e[_0xd777('0x3b')],_0x3e412e[_0xd777('0x37')]);_0x11cbe7[_0xd777('0x3c')]=_[_0xd777('0x3a')](_0x3e412e['model'],qs[_0xd777('0x3d')](_0x4e3df1['query']['fields']));_0x11cbe7[_0xd777('0x3c')]=_0x11cbe7['attributes'][_0xd777('0x3e')]?_0x11cbe7[_0xd777('0x3c')]:_0x3e412e['model'];if(!_0x4e3df1[_0xd777('0x37')][_0xd777('0x3f')](_0xd777('0x40'))){_0x11cbe7[_0xd777('0x24')]=qs['limit'](_0x4e3df1[_0xd777('0x37')][_0xd777('0x24')]);_0x11cbe7[_0xd777('0x23')]=qs[_0xd777('0x23')](_0x4e3df1[_0xd777('0x37')][_0xd777('0x23')]);}_0x11cbe7[_0xd777('0x41')]=qs['sort'](_0x4e3df1[_0xd777('0x37')]['sort']);_0x11cbe7[_0xd777('0x42')]=qs[_0xd777('0x39')](_[_0xd777('0x43')](_0x4e3df1['query'],_0x3e412e['filters']),_0xd6fea6);if(_0x4e3df1[_0xd777('0x37')]['filter']){_0x11cbe7[_0xd777('0x42')]=_[_0xd777('0x44')](_0x11cbe7[_0xd777('0x42')],{'$or':_['map'](_0xd6fea6,function(_0x140257){if(_0x140257['type']!==_0xd777('0x45')){var _0x4108bf={};_0x4108bf[_0x140257['name']]={'$like':'%'+_0x4e3df1[_0xd777('0x37')][_0xd777('0x46')]+'%'};return _0x4108bf;}})});}_0x11cbe7=_[_0xd777('0x44')]({},_0x11cbe7,_0x4e3df1[_0xd777('0x47')]);var _0x263765={'where':_0x11cbe7[_0xd777('0x42')]};return db['VoicePrefix'][_0xd777('0x22')](_0x263765)[_0xd777('0x29')](function(_0x26080c){_0x5a6888[_0xd777('0x22')]=_0x26080c;if(_0x4e3df1[_0xd777('0x37')][_0xd777('0x48')]){_0x11cbe7['include']=[{'all':!![]}];}return db['VoicePrefix'][_0xd777('0x49')](_0x11cbe7);})[_0xd777('0x29')](function(_0x320af1){_0x5a6888[_0xd777('0x4a')]=_0x320af1;return _0x5a6888;})[_0xd777('0x29')](respondWithFilteredResult(_0x5488b5,_0x11cbe7))['catch'](handleError(_0x5488b5,null));};exports[_0xd777('0x4b')]=function(_0x416013,_0x3828ad){var _0x382165={'raw':![],'where':{'id':_0x416013[_0xd777('0x4c')]['id']}},_0x3e249c={};_0x3e249c[_0xd777('0x3b')]=_[_0xd777('0x38')](db[_0xd777('0x33')][_0xd777('0x34')]);_0x3e249c['query']=_[_0xd777('0x38')](_0x416013[_0xd777('0x37')]);_0x3e249c[_0xd777('0x39')]=_[_0xd777('0x3a')](_0x3e249c[_0xd777('0x3b')],_0x3e249c[_0xd777('0x37')]);_0x382165[_0xd777('0x3c')]=_['intersection'](_0x3e249c[_0xd777('0x3b')],qs[_0xd777('0x3d')](_0x416013['query'][_0xd777('0x3d')]));_0x382165[_0xd777('0x3c')]=_0x382165['attributes'][_0xd777('0x3e')]?_0x382165[_0xd777('0x3c')]:_0x3e249c[_0xd777('0x3b')];if(_0x416013['query'][_0xd777('0x48')]){_0x382165[_0xd777('0x4d')]=[{'all':!![]}];}_0x382165=_[_0xd777('0x44')]({},_0x382165,_0x416013['options']);return db[_0xd777('0x33')][_0xd777('0x4e')](_0x382165)[_0xd777('0x29')](handleEntityNotFound(_0x3828ad,null))[_0xd777('0x29')](respondWithResult(_0x3828ad,null))[_0xd777('0x4f')](handleError(_0x3828ad,null));};exports['destroy']=function(_0x1f80f6,_0xb02b8){return db[_0xd777('0x33')][_0xd777('0x4e')]({'where':{'id':_0x1f80f6['params']['id']}})[_0xd777('0x29')](handleEntityNotFound(_0xb02b8,null))[_0xd777('0x29')](removeEntity(_0xb02b8,null))['catch'](handleError(_0xb02b8,null));};exports[_0xd777('0x50')]=function(_0x2a8fb0,_0x4b9682){return db[_0xd777('0x33')][_0xd777('0x50')]()[_0xd777('0x29')](respondWithResult(_0x4b9682,null))[_0xd777('0x4f')](handleError(_0x4b9682,null));};exports[_0xd777('0x51')]=function(_0x23a669,_0x3df2fb){var _0x1a64f6;return db[_0xd777('0x52')][_0xd777('0x53')](function(_0xd07746){return db[_0xd777('0x33')][_0xd777('0x51')](_0x23a669['body'],{'transaction':_0xd07746})[_0xd777('0x29')](function(_0x4e6403){_0x1a64f6=_0x4e6403[_0xd777('0x2b')]({'plain':!![]});return db['VoiceExtension'][_0xd777('0x4e')]({'where':{'id':_0x1a64f6['VoiceExtensionId']},'raw':!![]})[_0xd777('0x29')](function(_0x4e949b){return createVoicePrefixExtensions(_0x1a64f6,_0x4e949b,_0xd07746);});});})[_0xd777('0x29')](function(){var _0x510c51=_0x23a669[_0xd777('0x54')][_0xd777('0x2b')]({'plain':!![]});if(!_0x510c51)throw new Error(_0xd777('0x55'));if(_0x510c51[_0xd777('0x56')]===_0xd777('0x54')){var _0xd12f30=_0x1a64f6;return db[_0xd777('0x57')][_0xd777('0x4e')]({'where':{'name':_0xd777('0x2c'),'userProfileId':_0x510c51['userProfileId']},'raw':!![]})[_0xd777('0x29')](function(_0x2f97ef){if(_0x2f97ef&&_0x2f97ef[_0xd777('0x58')]===0x0){return db[_0xd777('0x2d')]['create']({'name':_0xd12f30[_0xd777('0x2f')],'resourceId':_0xd12f30['id'],'type':_0x2f97ef[_0xd777('0x2f')],'sectionId':_0x2f97ef['id']},{})[_0xd777('0x29')](function(){return _0x1a64f6;});}else{return _0x1a64f6;}})[_0xd777('0x4f')](function(_0x20a639){logger[_0xd777('0x59')](_0xd777('0x5a'),_0x20a639);throw _0x20a639;});}return _0x1a64f6;})['then'](respondWithResult(_0x3df2fb,null))['catch'](handleError(_0x3df2fb,null));};function Extension(_0x36e3bb,_0x549d6c,_0x39340c,_0x497637){this[_0xd777('0x5b')]='from-sip';this[_0xd777('0x5c')]=_0x36e3bb;this[_0xd777('0x5d')]=_0x39340c;this[_0xd777('0x5e')]=_0xd777('0x5f');this[_0xd777('0x60')]='Voice\x20Prefix\x20Extension';this[_0xd777('0x61')]=_0x549d6c;this['appdata']=_0x497637;}function createVoicePrefixExtensions(_0x484551,_0x737581,_0x38a938){return new BPromise(function(_0x5cd68b,_0x172e31){var _0x33196c=new Extension(formatPrefixName(_0x484551[_0xd777('0x62')]),0x1,_0xd777('0x63'),_0xd777('0x64'));_0x33196c[_0xd777('0x65')]=_0x484551['id'];return db[_0xd777('0x66')][_0xd777('0x51')](_0x33196c,{'transaction':_0x38a938})[_0xd777('0x29')](function(_0x2a6c4c){var _0x5c4b35=_0x2a6c4c[_0xd777('0x2b')]({'plain':!![]});var _0x24238e=_[_0xd777('0x32')](addVoicePrefixExtensions(_0x484551,_0x737581),function(_0x3ac6b9){_0x3ac6b9['VoiceExtensionId']=_0x5c4b35['id'];_0x3ac6b9[_0xd777('0x65')]=_0x484551['id'];return _0x3ac6b9;});return db[_0xd777('0x66')]['bulkCreate'](_0x24238e,{'transaction':_0x38a938})[_0xd777('0x29')](function(_0x58c01b){if(!_0x58c01b){return _0x172e31(_0xd777('0x67'));}else{return _0x5cd68b(_0x58c01b);}})[_0xd777('0x4f')](function(_0x20b955){return _0x172e31(_0x20b955);});});;});};function addVoicePrefixExtensions(_0x102ffe,_0x1f3637){var _0x40c42e=[];var _0x202ade=formatPrefixName(_0x102ffe[_0xd777('0x62')]);_0x40c42e[_0xd777('0x68')](new Extension(_0x202ade,0x2,_0xd777('0x69'),_0xd777('0x6a')+_0x102ffe[_0xd777('0x2f')]));if(_0x102ffe[_0xd777('0x6b')]){_0x40c42e[_0xd777('0x68')](new Extension(_0x202ade,0x3,'Set',_0xd777('0x6c')+_0x102ffe[_0xd777('0x6b')]));}else{_0x40c42e[_0xd777('0x68')](new Extension(_0x202ade,0x3,'NoOp','No\x20callerid\x20available'));}_0x40c42e['push'](new Extension(_0x202ade,0x4,_0xd777('0x6d'),_0x1f3637[_0xd777('0x5b')]+','+_0xd777('0x6e')+(0x8+_0x102ffe[_0xd777('0x2f')][_0xd777('0x3e')])+'}'+','+0x1));return _0x40c42e;}function formatPrefixName(_0x32d8a5){var _0x2c9d70='_';for(var _0x39f74a=0x0;_0x39f74a<_0x32d8a5[_0xd777('0x3e')];_0x39f74a++){if(_0x32d8a5[_0xd777('0x6f')](_0x39f74a)=='-'){_0x2c9d70+=_0x32d8a5['charAt'](_0x39f74a);}else{_0x2c9d70+='['+_0x32d8a5[_0xd777('0x6f')](_0x39f74a)+']';}}_0x2c9d70+='.';return _0x2c9d70;}exports['update']=function(_0x50bec6,_0x2eebd0,_0x5f85d){var _0x208a50=_0x50bec6[_0xd777('0x70')];_0x208a50[_0xd777('0x62')]=_0xd777('0x71')+_0x208a50['name']+'-';return db[_0xd777('0x52')][_0xd777('0x53')](function(_0x2bff60){return db[_0xd777('0x33')][_0xd777('0x72')](_0x208a50,{'where':{'id':_0x208a50['id']},'transaction':_0x2bff60})[_0xd777('0x29')](function(){return db[_0xd777('0x66')][_0xd777('0x2a')]({'where':{'VoicePrefixId':_0x208a50['id']},'transaction':_0x2bff60})[_0xd777('0x29')](function(){return db[_0xd777('0x66')]['find']({'where':{'id':_0x208a50[_0xd777('0x73')]},'raw':!![]})[_0xd777('0x29')](function(_0x524dcd){return createVoicePrefixExtensions(_0x208a50,_0x524dcd,_0x2bff60);});});});})[_0xd777('0x29')](function(){return db[_0xd777('0x33')][_0xd777('0x74')](_0x208a50['id']);})[_0xd777('0x29')](respondWithResult(_0x2eebd0,null))[_0xd777('0x4f')](handleError(_0x2eebd0,null));};exports[_0xd777('0x75')]=function(_0x3fc98d,_0x5cf1ff,_0x5b4840){return db[_0xd777('0x33')][_0xd777('0x4e')]({'where':{'id':_0x3fc98d[_0xd777('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5cf1ff,null))[_0xd777('0x29')](function(_0x546a61){if(_0x546a61){return _0x546a61[_0xd777('0x75')](_0x3fc98d[_0xd777('0x70')][_0xd777('0x76')],_[_0xd777('0x77')](_0x3fc98d[_0xd777('0x70')],[_0xd777('0x76'),'id'])||{})[_0xd777('0x78')](function(_0x3b7643){for(var _0x19590a=0x0;_0x19590a<_0x3fc98d[_0xd777('0x70')][_0xd777('0x76')][_0xd777('0x3e')];_0x19590a+=0x1){socket[_0xd777('0x79')](_0xd777('0x7a'),{'UserId':_0x3fc98d[_0xd777('0x70')][_0xd777('0x76')][_0x19590a],'VoicePrefixId':_0x3fc98d[_0xd777('0x4c')]['id']});}return _0x3b7643;});}})[_0xd777('0x29')](respondWithResult(_0x5cf1ff,null))[_0xd777('0x4f')](handleError(_0x5cf1ff,null));};exports[_0xd777('0x7b')]=function(_0x3f6e31,_0x569475,_0x40871a){return db[_0xd777('0x33')][_0xd777('0x4e')]({'where':{'id':_0x3f6e31[_0xd777('0x4c')]['id']}})[_0xd777('0x29')](handleEntityNotFound(_0x569475,null))[_0xd777('0x29')](function(_0x4cda0a){if(_0x4cda0a){return _0x4cda0a[_0xd777('0x7b')](_0x3f6e31['query']['ids'])[_0xd777('0x29')](function(){if(_[_0xd777('0x7c')](_0x3f6e31['query'][_0xd777('0x76')])){for(var _0x27495c=0x0;_0x27495c<_0x3f6e31[_0xd777('0x37')][_0xd777('0x76')]['length'];_0x27495c+=0x1){socket[_0xd777('0x79')](_0xd777('0x7d'),{'UserId':Number(_0x3f6e31['query']['ids'][_0x27495c]),'VoicePrefixId':Number(_0x3f6e31[_0xd777('0x4c')]['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x3f6e31['query']['ids']),'VoicePrefixId':Number(_0x3f6e31['params']['id'])});}});}})[_0xd777('0x29')](respondWithStatusCode(_0x569475,null))[_0xd777('0x4f')](handleError(_0x569475,null));};exports[_0xd777('0x7e')]=function(_0x38e851,_0x25c88b,_0x33b32f){var _0x4d2e25={};var _0x446e49={};var _0x1093db;var _0x51c325;return db[_0xd777('0x33')][_0xd777('0x7f')]({'where':{'id':_0x38e851['params']['id']}})['then'](handleEntityNotFound(_0x25c88b,null))[_0xd777('0x29')](function(_0x4b1eca){if(_0x4b1eca){_0x1093db=_0x4b1eca;_0x446e49[_0xd777('0x3b')]=_['keys'](db['User'][_0xd777('0x34')]);_0x446e49[_0xd777('0x37')]=_['keys'](_0x38e851[_0xd777('0x37')]);_0x446e49[_0xd777('0x39')]=_[_0xd777('0x3a')](_0x446e49[_0xd777('0x3b')],_0x446e49['query']);_0x4d2e25[_0xd777('0x3c')]=_[_0xd777('0x3a')](_0x446e49['model'],qs[_0xd777('0x3d')](_0x38e851[_0xd777('0x37')][_0xd777('0x3d')]));_0x4d2e25[_0xd777('0x3c')]=_0x4d2e25[_0xd777('0x3c')][_0xd777('0x3e')]?_0x4d2e25[_0xd777('0x3c')]:_0x446e49[_0xd777('0x3b')];_0x4d2e25[_0xd777('0x41')]=qs[_0xd777('0x80')](_0x38e851['query']['sort']);_0x4d2e25[_0xd777('0x42')]=qs[_0xd777('0x39')](_[_0xd777('0x43')](_0x38e851['query'],_0x446e49['filters']));if(_0x38e851['query'][_0xd777('0x46')]){_0x4d2e25['where']=_['merge'](_0x4d2e25['where'],{'$or':_[_0xd777('0x32')](_0x4d2e25[_0xd777('0x3c')],function(_0x152e09){var _0x479890={};_0x479890[_0x152e09]={'$like':'%'+_0x38e851[_0xd777('0x37')]['filter']+'%'};return _0x479890;})});}_0x4d2e25=_['merge']({},_0x4d2e25,_0x38e851[_0xd777('0x47')]);return _0x1093db[_0xd777('0x7e')](_0x4d2e25);}})[_0xd777('0x29')](function(_0x82928f){if(_0x82928f){_0x51c325=_0x82928f[_0xd777('0x3e')];if(!_0x38e851[_0xd777('0x37')]['hasOwnProperty'](_0xd777('0x40'))){_0x4d2e25[_0xd777('0x24')]=qs[_0xd777('0x24')](_0x38e851['query'][_0xd777('0x24')]);_0x4d2e25[_0xd777('0x23')]=qs['offset'](_0x38e851['query'][_0xd777('0x23')]);}return _0x1093db[_0xd777('0x7e')](_0x4d2e25);}})['then'](function(_0x49afa2){if(_0x49afa2){return _0x49afa2?{'count':_0x51c325,'rows':_0x49afa2}:null;}})[_0xd777('0x29')](respondWithResult(_0x25c88b,null))[_0xd777('0x4f')](handleError(_0x25c88b,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index a8fa8d4..9a82bba 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x1a7060,_0xe16ab5){var _0x1cf0d1=function(_0x17d197){while(--_0x17d197){_0x1a7060['push'](_0x1a7060['shift']());}};_0x1cf0d1(++_0xe16ab5);}(_0x008c,0x188));var _0xc008=function(_0x32be82,_0x21b592){_0x32be82=_0x32be82-0x0;var _0x35aa04=_0x008c[_0x32be82];return _0x35aa04;};'use strict';var EventEmitter=require(_0xc008('0x0'));var VoicePrefix=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){VoicePrefixEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);VoicePrefixEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];VoicePrefix[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','VoicePrefix','setMaxListeners'];(function(_0x47dded,_0x148b63){var _0x10578=function(_0x20dea8){while(--_0x20dea8){_0x47dded['push'](_0x47dded['shift']());}};_0x10578(++_0x148b63);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x49c4('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){VoicePrefixEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);VoicePrefixEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];VoicePrefix[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('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 97b2c38..db4be19 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 _0x3adc=['VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes'];(function(_0x1d5285,_0x45401d){var _0x2babb9=function(_0x7a9912){while(--_0x7a9912){_0x1d5285['push'](_0x1d5285['shift']());}};_0x2babb9(++_0x45401d);}(_0x3adc,0x86));var _0xc3ad=function(_0x343be8,_0x529fd2){_0x343be8=_0x343be8-0x0;var _0x3074df=_0x3adc[_0x343be8];return _0x3074df;};'use strict';var _=require(_0xc3ad('0x0'));var util=require(_0xc3ad('0x1'));var logger=require(_0xc3ad('0x2'))(_0xc3ad('0x3'));var moment=require(_0xc3ad('0x4'));var BPromise=require('bluebird');var rp=require(_0xc3ad('0x5'));var fs=require('fs');var path=require(_0xc3ad('0x6'));var rimraf=require(_0xc3ad('0x7'));var config=require(_0xc3ad('0x8'));var attributes=require(_0xc3ad('0x9'));module['exports']=function(_0x4b3dab,_0x33714f){return _0x4b3dab['define'](_0xc3ad('0xa'),attributes,{'tableName':_0xc3ad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0777=['bluebird','path','../../config/environment','exports','define','VoicePrefix','lodash','api'];(function(_0x2a81cb,_0xa8c94a){var _0xe02861=function(_0x642309){while(--_0x642309){_0x2a81cb['push'](_0x2a81cb['shift']());}};_0xe02861(++_0xa8c94a);}(_0x0777,0x1e6));var _0x7077=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x0777[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x7077('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7077('0x1'));var moment=require('moment');var BPromise=require(_0x7077('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7077('0x3'));var rimraf=require('rimraf');var config=require(_0x7077('0x4'));var attributes=require('./voicePrefix.attributes');module[_0x7077('0x5')]=function(_0x58bce8,_0x3320d2){return _0x58bce8[_0x7077('0x6')](_0x7077('0x7'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 5731ce4..afe31d7 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 _0x4af8=['client','localhost','socket.io-emitter','redis','./voicePrefix.socket','request','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x424357,_0x9ebe3e){var _0x29c68e=function(_0x663b5d){while(--_0x663b5d){_0x424357['push'](_0x424357['shift']());}};_0x29c68e(++_0x9ebe3e);}(_0x4af8,0x81));var _0x84af=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x4af8[_0x53cf8e];return _0x459197;};'use strict';var _=require(_0x84af('0x0'));var util=require(_0x84af('0x1'));var moment=require(_0x84af('0x2'));var BPromise=require(_0x84af('0x3'));var rs=require(_0x84af('0x4'));var fs=require('fs');var Redis=require(_0x84af('0x5'));var db=require(_0x84af('0x6'))['db'];var utils=require(_0x84af('0x7'));var logger=require(_0x84af('0x8'))('rpc');var config=require(_0x84af('0x9'));var jayson=require(_0x84af('0xa'));var client=jayson[_0x84af('0xb')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x84af('0xc'),'port':0x18eb});var socket=require(_0x84af('0xd'))(new Redis(config[_0x84af('0xe')]));require(_0x84af('0xf'))['register'](socket);function respondWithRpcPromise(_0x3f907f,_0x32e89f,_0x41e55f){return new BPromise(function(_0x1e82ce,_0x4a3060){return client[_0x84af('0x10')](_0x3f907f,_0x41e55f)[_0x84af('0x11')](function(_0x3fd098){logger[_0x84af('0x12')](_0x84af('0x13'),_0x32e89f,'request\x20sent');logger[_0x84af('0x14')](_0x84af('0x15'),_0x32e89f,_0x84af('0x16'),JSON[_0x84af('0x17')](_0x3fd098));if(_0x3fd098[_0x84af('0x18')]){if(_0x3fd098['error']['code']===0x1f4){logger[_0x84af('0x18')](_0x84af('0x13'),_0x32e89f,_0x3fd098[_0x84af('0x18')][_0x84af('0x19')]);return _0x4a3060(_0x3fd098[_0x84af('0x18')][_0x84af('0x19')]);}logger[_0x84af('0x18')](_0x84af('0x13'),_0x32e89f,_0x3fd098[_0x84af('0x18')][_0x84af('0x19')]);return _0x1e82ce(_0x3fd098['error']['message']);}else{logger[_0x84af('0x12')](_0x84af('0x13'),_0x32e89f,_0x84af('0x16'));_0x1e82ce(_0x3fd098[_0x84af('0x1a')][_0x84af('0x19')]);}})[_0x84af('0x1b')](function(_0x173f41){logger['error'](_0x84af('0x13'),_0x32e89f,_0x173f41);_0x4a3060(_0x173f41);});});} \ No newline at end of file +var _0x61c7=['info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./voicePrefix.socket','register','request'];(function(_0x59b12b,_0x231385){var _0x3e8589=function(_0x583cf3){while(--_0x583cf3){_0x59b12b['push'](_0x59b12b['shift']());}};_0x3e8589(++_0x231385);}(_0x61c7,0x176));var _0x761c=function(_0x23d10d,_0x19536e){_0x23d10d=_0x23d10d-0x0;var _0x259b8a=_0x61c7[_0x23d10d];return _0x259b8a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x761c('0x0'));var BPromise=require(_0x761c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x761c('0x2'));var db=require(_0x761c('0x3'))['db'];var utils=require(_0x761c('0x4'));var logger=require(_0x761c('0x5'))(_0x761c('0x6'));var config=require(_0x761c('0x7'));var jayson=require(_0x761c('0x8'));var client=jayson[_0x761c('0x9')]['http']({'port':0x232a});config[_0x761c('0xa')]=_[_0x761c('0xb')](config[_0x761c('0xa')],{'host':_0x761c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x761c('0xa')]));require(_0x761c('0xd'))[_0x761c('0xe')](socket);function respondWithRpcPromise(_0x4fdaea,_0x6e476c,_0x210a16){return new BPromise(function(_0xdfcd0c,_0x52c733){return client[_0x761c('0xf')](_0x4fdaea,_0x210a16)['then'](function(_0x24d55c){logger[_0x761c('0x10')](_0x761c('0x11'),_0x6e476c,_0x761c('0x12'));logger['debug'](_0x761c('0x13'),_0x6e476c,_0x761c('0x12'),JSON[_0x761c('0x14')](_0x24d55c));if(_0x24d55c['error']){if(_0x24d55c['error'][_0x761c('0x15')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x6e476c,_0x24d55c['error']['message']);return _0x52c733(_0x24d55c[_0x761c('0x16')][_0x761c('0x17')]);}logger[_0x761c('0x16')](_0x761c('0x11'),_0x6e476c,_0x24d55c[_0x761c('0x16')][_0x761c('0x17')]);return _0xdfcd0c(_0x24d55c[_0x761c('0x16')][_0x761c('0x17')]);}else{logger[_0x761c('0x10')](_0x761c('0x11'),_0x6e476c,_0x761c('0x12'));_0xdfcd0c(_0x24d55c[_0x761c('0x18')]['message']);}})[_0x761c('0x19')](function(_0x455269){logger[_0x761c('0x16')](_0x761c('0x11'),_0x6e476c,_0x455269);_0x52c733(_0x455269);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index f7303a1..e041265 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 _0x75a7=['length','voicePrefix:','./voicePrefix.events','save','emit','removeListener','register'];(function(_0x57fcc0,_0x585004){var _0x5270df=function(_0x5f2db0){while(--_0x5f2db0){_0x57fcc0['push'](_0x57fcc0['shift']());}};_0x5270df(++_0x585004);}(_0x75a7,0x175));var _0x775a=function(_0x1ebbde,_0x3b931d){_0x1ebbde=_0x1ebbde-0x0;var _0x3b7369=_0x75a7[_0x1ebbde];return _0x3b7369;};'use strict';var VoicePrefixEvents=require(_0x775a('0x0'));var events=[_0x775a('0x1'),'remove','update'];function createListener(_0x579e29,_0x45ecfb){return function(_0x2e8236){_0x45ecfb[_0x775a('0x2')](_0x579e29,_0x2e8236);};}function removeListener(_0x2da300,_0x8634bf){return function(){VoicePrefixEvents[_0x775a('0x3')](_0x2da300,_0x8634bf);};}exports[_0x775a('0x4')]=function(_0x2d599e){for(var _0x5d223f=0x0,_0x3ba8c2=events[_0x775a('0x5')];_0x5d223f<_0x3ba8c2;_0x5d223f++){var _0x2e012a=events[_0x5d223f];var _0x515072=createListener(_0x775a('0x6')+_0x2e012a,_0x2d599e);VoicePrefixEvents['on'](_0x2e012a,_0x515072);}}; \ No newline at end of file +var _0x5467=['removeListener','register','voicePrefix:','save','update','emit'];(function(_0x10d0f4,_0xc00e3){var _0x21a1c1=function(_0x3e6322){while(--_0x3e6322){_0x10d0f4['push'](_0x10d0f4['shift']());}};_0x21a1c1(++_0xc00e3);}(_0x5467,0x10b));var _0x7546=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x5467[_0xbca1b1];return _0x4e1686;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x7546('0x0'),'remove',_0x7546('0x1')];function createListener(_0x1e77d8,_0x2aefa8){return function(_0x8ffe14){_0x2aefa8[_0x7546('0x2')](_0x1e77d8,_0x8ffe14);};}function removeListener(_0x33ad6d,_0x54b18d){return function(){VoicePrefixEvents[_0x7546('0x3')](_0x33ad6d,_0x54b18d);};}exports[_0x7546('0x4')]=function(_0x2d8a9c){for(var _0x1c92b6=0x0,_0x29eaaf=events['length'];_0x1c92b6<_0x29eaaf;_0x1c92b6++){var _0x2e5c0e=events[_0x1c92b6];var _0x25b2c3=createListener(_0x7546('0x5')+_0x2e5c0e,_0x2d8a9c);VoicePrefixEvents['on'](_0x2e5c0e,_0x25b2c3);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 731c658..caea5a1 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 _0xedc4=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','getMembers','/:id/lists','/:id/blacklists','create','post','/:id/clone','clone','/:id/users','addAgents','addLists','addBlackLists','put','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','path','connect-timeout'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xedc4,0x166));var _0x4edc=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xedc4[_0x21a9d9];return _0x46adce;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4edc('0x0'));var timeout=require(_0x4edc('0x1'));var express=require(_0x4edc('0x2'));var router=express[_0x4edc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4edc('0x4'));var interaction=require(_0x4edc('0x5'));var config=require(_0x4edc('0x6'));var controller=require(_0x4edc('0x7'));router[_0x4edc('0x8')]('/',auth[_0x4edc('0x9')](),controller[_0x4edc('0xa')]);router[_0x4edc('0x8')](_0x4edc('0xb'),auth[_0x4edc('0x9')](),controller['show']);router[_0x4edc('0x8')](_0x4edc('0xc'),auth[_0x4edc('0x9')](),controller[_0x4edc('0xd')]);router[_0x4edc('0x8')](_0x4edc('0xe'),auth['isAuthenticated'](),controller[_0x4edc('0xf')]);router['get']('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router[_0x4edc('0x8')](_0x4edc('0x10'),auth[_0x4edc('0x9')](),controller[_0x4edc('0x11')]);router['get'](_0x4edc('0x12'),auth[_0x4edc('0x9')](),controller[_0x4edc('0x13')]);router[_0x4edc('0x8')]('/:id/users',auth[_0x4edc('0x9')](),controller['getAgents']);router['get']('/:id/members',auth[_0x4edc('0x9')](),controller[_0x4edc('0x14')]);router['get'](_0x4edc('0x15'),auth['isAuthenticated'](),controller['getLists']);router['get'](_0x4edc('0x16'),auth[_0x4edc('0x9')](),controller['getBlackLists']);router['post']('/',auth[_0x4edc('0x9')](),controller[_0x4edc('0x17')]);router[_0x4edc('0x18')](_0x4edc('0x19'),auth[_0x4edc('0x9')](),controller[_0x4edc('0x1a')]);router[_0x4edc('0x18')](_0x4edc('0x12'),auth['isAuthenticated'](),controller['addTeams']);router[_0x4edc('0x18')](_0x4edc('0x1b'),auth['isAuthenticated'](),controller[_0x4edc('0x1c')]);router[_0x4edc('0x18')](_0x4edc('0x15'),auth['isAuthenticated'](),controller[_0x4edc('0x1d')]);router[_0x4edc('0x18')](_0x4edc('0x16'),auth[_0x4edc('0x9')](),controller[_0x4edc('0x1e')]);router[_0x4edc('0x1f')](_0x4edc('0xb'),auth['isAuthenticated'](),controller[_0x4edc('0x20')]);router[_0x4edc('0x21')]('/:id',auth[_0x4edc('0x9')](),controller[_0x4edc('0x22')]);router['delete'](_0x4edc('0x12'),auth[_0x4edc('0x9')](),controller[_0x4edc('0x23')]);router[_0x4edc('0x21')](_0x4edc('0x1b'),auth[_0x4edc('0x9')](),controller[_0x4edc('0x24')]);router[_0x4edc('0x21')](_0x4edc('0x15'),auth[_0x4edc('0x9')](),controller[_0x4edc('0x25')]);router['delete'](_0x4edc('0x16'),auth['isAuthenticated'](),controller[_0x4edc('0x26')]);module[_0x4edc('0x27')]=router; \ No newline at end of file +var _0x7a3e=['/:id/blacklists','getBlackLists','create','/:id/clone','post','/:id/teams','addLists','addBlackLists','put','update','delete','destroy','removeTeams','removeLists','removeBlackLists','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceQueue.controller','isAuthenticated','index','get','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getTeams','/:id/users','/:id/members','getMembers','/:id/lists','getLists'];(function(_0x569065,_0x2847b4){var _0x5f69cd=function(_0x5325ac){while(--_0x5325ac){_0x569065['push'](_0x569065['shift']());}};_0x5f69cd(++_0x2847b4);}(_0x7a3e,0x18a));var _0xe7a3=function(_0x4f39c5,_0x11fef4){_0x4f39c5=_0x4f39c5-0x0;var _0x16902c=_0x7a3e[_0x4f39c5];return _0x16902c;};'use strict';var multer=require(_0xe7a3('0x0'));var util=require(_0xe7a3('0x1'));var path=require(_0xe7a3('0x2'));var timeout=require('connect-timeout');var express=require(_0xe7a3('0x3'));var router=express[_0xe7a3('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe7a3('0x5'));var config=require(_0xe7a3('0x6'));var controller=require(_0xe7a3('0x7'));router['get']('/',auth[_0xe7a3('0x8')](),controller[_0xe7a3('0x9')]);router[_0xe7a3('0xa')](_0xe7a3('0xb'),auth[_0xe7a3('0x8')](),controller['show']);router[_0xe7a3('0xa')](_0xe7a3('0xc'),auth[_0xe7a3('0x8')](),controller[_0xe7a3('0xd')]);router['get'](_0xe7a3('0xe'),auth[_0xe7a3('0x8')](),controller[_0xe7a3('0xf')]);router[_0xe7a3('0xa')](_0xe7a3('0x10'),auth[_0xe7a3('0x8')](),controller[_0xe7a3('0x11')]);router[_0xe7a3('0xa')](_0xe7a3('0x12'),auth[_0xe7a3('0x8')](),controller[_0xe7a3('0x13')]);router[_0xe7a3('0xa')]('/:id/teams',auth[_0xe7a3('0x8')](),controller[_0xe7a3('0x14')]);router[_0xe7a3('0xa')](_0xe7a3('0x15'),auth['isAuthenticated'](),controller['getAgents']);router[_0xe7a3('0xa')](_0xe7a3('0x16'),auth[_0xe7a3('0x8')](),controller[_0xe7a3('0x17')]);router[_0xe7a3('0xa')](_0xe7a3('0x18'),auth[_0xe7a3('0x8')](),controller[_0xe7a3('0x19')]);router[_0xe7a3('0xa')](_0xe7a3('0x1a'),auth['isAuthenticated'](),controller[_0xe7a3('0x1b')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe7a3('0x1c')]);router['post'](_0xe7a3('0x1d'),auth[_0xe7a3('0x8')](),controller['clone']);router[_0xe7a3('0x1e')](_0xe7a3('0x1f'),auth[_0xe7a3('0x8')](),controller['addTeams']);router[_0xe7a3('0x1e')](_0xe7a3('0x15'),auth[_0xe7a3('0x8')](),controller['addAgents']);router[_0xe7a3('0x1e')]('/:id/lists',auth[_0xe7a3('0x8')](),controller[_0xe7a3('0x20')]);router[_0xe7a3('0x1e')](_0xe7a3('0x1a'),auth[_0xe7a3('0x8')](),controller[_0xe7a3('0x21')]);router[_0xe7a3('0x22')](_0xe7a3('0xb'),auth['isAuthenticated'](),controller[_0xe7a3('0x23')]);router[_0xe7a3('0x24')](_0xe7a3('0xb'),auth['isAuthenticated'](),controller[_0xe7a3('0x25')]);router[_0xe7a3('0x24')](_0xe7a3('0x1f'),auth[_0xe7a3('0x8')](),controller[_0xe7a3('0x26')]);router['delete'](_0xe7a3('0x15'),auth[_0xe7a3('0x8')](),controller['removeAgents']);router[_0xe7a3('0x24')]('/:id/lists',auth[_0xe7a3('0x8')](),controller[_0xe7a3('0x27')]);router[_0xe7a3('0x24')](_0xe7a3('0x1a'),auth['isAuthenticated'](),controller[_0xe7a3('0x28')]);module[_0xe7a3('0x29')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 15cd307..5116da2 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(_0x4c6abb,_0x8f43d5){var _0x3d1312=function(_0x497240){while(--_0x497240){_0x4c6abb['push'](_0x4c6abb['shift']());}};_0x3d1312(++_0x8f43d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x34c8ff,_0x674110){var _0x42601c=function(_0x3e2ce5){while(--_0x3e2ce5){_0x34c8ff['push'](_0x34c8ff['shift']());}};_0x42601c(++_0x674110);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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 11f338b..c3e0967 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 _0x1290=['where','filters','pick','merge','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','QueueCampaigns','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','createdAt','updatedAt','user','role','destroy','getHoppers','CmHopper','sort','VoiceQueueId','findAll','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueue','findOrCreate','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','all','union','compact','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','getLists','CmList','addLists','omit','dialCheckDuplicateType','insert','cm_hopper','scheduledAt','ListId','phone','NOW()','CmListId','toString','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','into','fromQuery','ContactId','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','VoiceQueues','outbound','filter','ignore','map','value','type','find','end','error','stack','name','send','index','VoiceQueue','fieldName','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x1290,0x136));var _0x0129=function(_0x51d713,_0x104c9c){_0x51d713=_0x51d713-0x0;var _0x12f99c=_0x1290[_0x51d713];return _0x12f99c;};'use strict';var emlformat=require(_0x0129('0x0'));var rimraf=require(_0x0129('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0129('0x2'));var rp=require('request-promise');var moment=require(_0x0129('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0129('0x4'));var util=require(_0x0129('0x5'));var path=require(_0x0129('0x6'));var sox=require(_0x0129('0x7'));var csv=require(_0x0129('0x8'));var ejs=require(_0x0129('0x9'));var fs=require('fs');var fs_extra=require(_0x0129('0xa'));var _=require(_0x0129('0xb'));var squel=require(_0x0129('0xc'));var crypto=require(_0x0129('0xd'));var jsforce=require(_0x0129('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0129('0x8'));var querystring=require(_0x0129('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0129('0x10'));var as=require(_0x0129('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0129('0x12'));var utils=require(_0x0129('0x13'));var config=require(_0x0129('0x14'));var licenseUtil=require(_0x0129('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x0129('0x16')],{'host':_0x0129('0x17'),'port':0x18eb});var socket=require(_0x0129('0x18'))(new Redis(config[_0x0129('0x16')]));require('./voiceQueue.socket')[_0x0129('0x19')](socket);function respondWithStatusCode(_0x27c53b,_0x915be1){_0x915be1=_0x915be1||0xcc;return function(_0x571962){if(_0x571962){return _0x27c53b[_0x0129('0x1a')](_0x915be1);}return _0x27c53b[_0x0129('0x1b')](_0x915be1)['end']();};}function respondWithResult(_0x234a68,_0x1c3f7a){_0x1c3f7a=_0x1c3f7a||0xc8;return function(_0x1402e1){if(_0x1402e1){return _0x234a68[_0x0129('0x1b')](_0x1c3f7a)[_0x0129('0x1c')](_0x1402e1);}};}function respondWithFilteredResult(_0x22c4d9,_0xb2f0a5){return function(_0x2f7e51){if(_0x2f7e51){var _0x2064d0=_0x2f7e51[_0x0129('0x1d')],_0x2b8af9=_0xb2f0a5[_0x0129('0x1e')],_0x27e018=_0xb2f0a5[_0x0129('0x1e')]+_0xb2f0a5[_0x0129('0x1f')],_0x85594f;if(_0x27e018>=_0x2064d0){_0x27e018=_0x2064d0;_0x85594f=0xc8;}else{_0x85594f=0xce;}_0x22c4d9[_0x0129('0x1b')](_0x85594f);return _0x22c4d9[_0x0129('0x20')](_0x0129('0x21'),_0x2b8af9+'-'+_0x27e018+'/'+_0x2064d0)[_0x0129('0x1c')](_0x2f7e51);}return null;};}function patchUpdates(_0x81f82b){return function(_0x37acf2){try{jsonpatch[_0x0129('0x22')](_0x37acf2,_0x81f82b,!![]);}catch(_0x569a2a){return BPromise[_0x0129('0x23')](_0x569a2a);}return _0x37acf2[_0x0129('0x24')]();};}function saveUpdates(_0x1c0c2e,_0x290cbd){return function(_0x1378cb){if(_0x1378cb){return _0x1378cb[_0x0129('0x25')](_0x1c0c2e)[_0x0129('0x26')](function(_0x1bf5ee){return _0x1bf5ee;});}return null;};}function removeEntity(_0x45a0bf,_0x5ab917){return function(_0x4e8e65){if(_0x4e8e65){return _0x4e8e65['destroy']()[_0x0129('0x26')](function(){var _0x87aeb3=_0x4e8e65[_0x0129('0x27')]({'plain':!![]});var _0x25e6dc=[{'name':_0x0129('0x28'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':_0x0129('0x29'),'ignore':![]}];var _0x4f919d=_(_0x25e6dc)[_0x0129('0x2a')](_0x0129('0x2b'))[_0x0129('0x2c')](_0x0129('0x2d'))['value']();if(_['includes'](_0x4f919d,_0x87aeb3[_0x0129('0x2e')])){return;}var _0x24abac=_[_0x0129('0x2f')](_0x25e6dc,[_0x0129('0x2d'),_0x87aeb3[_0x0129('0x2e')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x24abac,'resourceId':_0x87aeb3['id']}})[_0x0129('0x26')](function(){return _0x4e8e65;});})[_0x0129('0x26')](function(){_0x45a0bf[_0x0129('0x1b')](0xcc)[_0x0129('0x30')]();});}};}function handleEntityNotFound(_0x317a64,_0x47f9af){return function(_0x32445d){if(!_0x32445d){_0x317a64[_0x0129('0x1a')](0x194);}return _0x32445d;};}function handleError(_0x427225,_0x18a88a){_0x18a88a=_0x18a88a||0x1f4;return function(_0x2ece51){logger[_0x0129('0x31')](_0x2ece51[_0x0129('0x32')]);if(_0x2ece51[_0x0129('0x33')]){delete _0x2ece51['name'];}_0x427225[_0x0129('0x1b')](_0x18a88a)[_0x0129('0x34')](_0x2ece51);};}exports[_0x0129('0x35')]=function(_0x28156f,_0x4982b1){var _0x343bbe={},_0x359353={},_0xc2a12a={'count':0x0,'rows':[]};var _0x1b4ddf=_[_0x0129('0x2c')](db[_0x0129('0x36')]['rawAttributes'],function(_0x3a686a){return{'name':_0x3a686a[_0x0129('0x37')],'type':_0x3a686a[_0x0129('0x2e')][_0x0129('0x38')]};});_0x359353[_0x0129('0x39')]=_['map'](_0x1b4ddf,'name');_0x359353[_0x0129('0x3a')]=_[_0x0129('0x3b')](_0x28156f['query']);_0x359353['filters']=_['intersection'](_0x359353['model'],_0x359353[_0x0129('0x3a')]);_0x343bbe[_0x0129('0x3c')]=_[_0x0129('0x3d')](_0x359353['model'],qs[_0x0129('0x3e')](_0x28156f[_0x0129('0x3a')][_0x0129('0x3e')]));_0x343bbe[_0x0129('0x3c')]=_0x343bbe[_0x0129('0x3c')]['length']?_0x343bbe[_0x0129('0x3c')]:_0x359353['model'];if(!_0x28156f[_0x0129('0x3a')][_0x0129('0x3f')](_0x0129('0x40'))){_0x343bbe[_0x0129('0x1f')]=qs[_0x0129('0x1f')](_0x28156f['query'][_0x0129('0x1f')]);_0x343bbe[_0x0129('0x1e')]=qs[_0x0129('0x1e')](_0x28156f[_0x0129('0x3a')][_0x0129('0x1e')]);}_0x343bbe[_0x0129('0x41')]=qs['sort'](_0x28156f[_0x0129('0x3a')]['sort']);_0x343bbe[_0x0129('0x42')]=qs[_0x0129('0x43')](_[_0x0129('0x44')](_0x28156f[_0x0129('0x3a')],_0x359353[_0x0129('0x43')]),_0x1b4ddf);if(_0x28156f[_0x0129('0x3a')][_0x0129('0x2a')]){_0x343bbe[_0x0129('0x42')]=_[_0x0129('0x45')](_0x343bbe['where'],{'$or':_[_0x0129('0x2c')](_0x1b4ddf,function(_0x246550){if(_0x246550[_0x0129('0x2e')]!==_0x0129('0x46')){var _0x2da866={};_0x2da866[_0x246550[_0x0129('0x33')]]={'$like':'%'+_0x28156f[_0x0129('0x3a')]['filter']+'%'};return _0x2da866;}})});}_0x343bbe=_[_0x0129('0x45')]({},_0x343bbe,_0x28156f[_0x0129('0x47')]);var _0x5ee1fc={'where':_0x343bbe['where']};return db[_0x0129('0x36')][_0x0129('0x1d')](_0x5ee1fc)[_0x0129('0x26')](function(_0x5b0bc3){_0xc2a12a[_0x0129('0x1d')]=_0x5b0bc3;if(_0x28156f[_0x0129('0x3a')][_0x0129('0x48')]){_0x343bbe['include']=[{'all':!![]}];}return db['VoiceQueue']['findAll'](_0x343bbe);})['then'](function(_0xd831e8){_0xc2a12a[_0x0129('0x49')]=_0xd831e8;return _0xc2a12a;})[_0x0129('0x26')](respondWithFilteredResult(_0x4982b1,_0x343bbe))[_0x0129('0x4a')](handleError(_0x4982b1,null));};exports[_0x0129('0x4b')]=function(_0x3a5cfe,_0x3ab614){var _0x108b24={'raw':![],'where':{'id':_0x3a5cfe[_0x0129('0x4c')]['id']}},_0x156fa5={};_0x156fa5['model']=_['keys'](db[_0x0129('0x36')][_0x0129('0x4d')]);_0x156fa5[_0x0129('0x3a')]=_[_0x0129('0x3b')](_0x3a5cfe[_0x0129('0x3a')]);_0x156fa5['filters']=_[_0x0129('0x3d')](_0x156fa5['model'],_0x156fa5[_0x0129('0x3a')]);_0x108b24['attributes']=_[_0x0129('0x3d')](_0x156fa5[_0x0129('0x39')],qs[_0x0129('0x3e')](_0x3a5cfe[_0x0129('0x3a')][_0x0129('0x3e')]));_0x108b24['attributes']=_0x108b24[_0x0129('0x3c')][_0x0129('0x4e')]?_0x108b24[_0x0129('0x3c')]:_0x156fa5[_0x0129('0x39')];if(_0x3a5cfe[_0x0129('0x3a')][_0x0129('0x48')]){_0x108b24['include']=[{'all':!![]}];}_0x108b24=_['merge']({},_0x108b24,_0x3a5cfe[_0x0129('0x47')]);return db[_0x0129('0x36')]['find'](_0x108b24)[_0x0129('0x26')](handleEntityNotFound(_0x3ab614,null))[_0x0129('0x26')](respondWithResult(_0x3ab614,null))['catch'](handleError(_0x3ab614,null));};exports[_0x0129('0x4f')]=function(_0x5c1ee9,_0x430811){return db['VoiceQueue'][_0x0129('0x4f')](_0x5c1ee9[_0x0129('0x50')],{})[_0x0129('0x26')](function(_0x158034){var _0x2e4972=_0x5c1ee9['user'][_0x0129('0x27')]({'plain':!![]});if(!_0x2e4972)throw new Error(_0x0129('0x51'));if(_0x2e4972['role']==='user'){var _0x184717=_0x158034[_0x0129('0x27')]({'plain':!![]});var _0x240e5d=[{'name':_0x0129('0x28'),'value':_0x0129('0x52')},{'name':_0x0129('0x53'),'value':_0x0129('0x29')}];var _0x1afd31=_[_0x0129('0x2f')](_0x240e5d,[_0x0129('0x2d'),_0x184717[_0x0129('0x2e')]])[_0x0129('0x33')];return db['UserProfileSection'][_0x0129('0x2f')]({'where':{'name':_0x1afd31,'userProfileId':_0x2e4972[_0x0129('0x54')]},'raw':!![]})[_0x0129('0x26')](function(_0x7d295a){if(_0x7d295a&&_0x7d295a[_0x0129('0x55')]===0x0){return db[_0x0129('0x56')][_0x0129('0x4f')]({'name':_0x184717[_0x0129('0x33')],'resourceId':_0x184717['id'],'type':_0x7d295a[_0x0129('0x33')],'sectionId':_0x7d295a['id']},{})[_0x0129('0x26')](function(){return _0x158034;});}else{return _0x158034;}})['catch'](function(_0x1a7cef){logger['error'](_0x0129('0x57'),_0x1a7cef);throw _0x1a7cef;});}return _0x158034;})[_0x0129('0x26')](respondWithResult(_0x430811,0xc9))[_0x0129('0x4a')](handleError(_0x430811,null));};exports[_0x0129('0x58')]=function(_0x39704a,_0x557ed8){var _0x302cfc={'where':{'id':_0x39704a[_0x0129('0x4c')]['id']}},_0x585d4f={};_0x585d4f[_0x0129('0x39')]=_[_0x0129('0x3b')](db[_0x0129('0x36')]['rawAttributes']);_0x302cfc['attributes']=_['intersection'](_0x585d4f[_0x0129('0x39')],qs[_0x0129('0x3e')](_0x39704a[_0x0129('0x3a')][_0x0129('0x3e')]));_0x302cfc[_0x0129('0x3c')]=_0x302cfc[_0x0129('0x3c')][_0x0129('0x4e')]?_0x302cfc['attributes']:_0x585d4f[_0x0129('0x39')];if(_0x39704a[_0x0129('0x3a')][_0x0129('0x48')]){_0x302cfc[_0x0129('0x59')]=[{'all':!![]}];}_0x302cfc=_[_0x0129('0x45')]({},_0x302cfc,_0x39704a[_0x0129('0x47')]);return db[_0x0129('0x36')][_0x0129('0x2f')](_0x302cfc)['then'](handleEntityNotFound(_0x557ed8,null))['then'](function(_0x414467){if(_0x414467){var _0x3b637d=_0x414467['get']({'plain':!![]});_0x3b637d=qs['omit'](_0x3b637d,['id',_0x0129('0x5a'),_0x0129('0x5b')]);_0x39704a[_0x0129('0x50')]=_['omit'](_0x39704a['body'],['id',_0x0129('0x5a'),_0x0129('0x5b')]);return db[_0x0129('0x36')][_0x0129('0x4f')](_['merge'](_0x3b637d,_0x39704a['body']),{'include':_0x39704a['query']['includeAll']?[{'all':!![]}]:undefined})[_0x0129('0x26')](function(_0x43442a){var _0x4b1732=_0x39704a[_0x0129('0x5c')]['get']({'plain':!![]});if(!_0x4b1732)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b1732[_0x0129('0x5d')]==='user'){var _0x3806af=_0x43442a[_0x0129('0x27')]({'plain':!![]});var _0x5bcc97=[{'name':_0x0129('0x28'),'value':_0x0129('0x52')},{'name':_0x0129('0x53'),'value':'outbound'}];var _0x31a562=_['find'](_0x5bcc97,['value',_0x3806af[_0x0129('0x2e')]])[_0x0129('0x33')];return db['UserProfileSection'][_0x0129('0x2f')]({'where':{'name':_0x31a562,'userProfileId':_0x4b1732[_0x0129('0x54')]},'raw':!![]})[_0x0129('0x26')](function(_0x4d4d45){if(_0x4d4d45&&_0x4d4d45[_0x0129('0x55')]===0x0){return db['UserProfileResource'][_0x0129('0x4f')]({'name':_0x3806af['name'],'resourceId':_0x3806af['id'],'type':_0x4d4d45[_0x0129('0x33')],'sectionId':_0x4d4d45['id']},{})[_0x0129('0x26')](function(){return _0x43442a;});}else{return _0x43442a;}})[_0x0129('0x4a')](function(_0x3acbdb){logger[_0x0129('0x31')](_0x0129('0x57'),_0x3acbdb);throw _0x3acbdb;});}return _0x43442a;});}})[_0x0129('0x26')](respondWithResult(_0x557ed8,0xc9))[_0x0129('0x4a')](handleError(_0x557ed8,null));};exports['update']=function(_0x550c39,_0x1d6b12){if(_0x550c39['body']['id']){delete _0x550c39[_0x0129('0x50')]['id'];}return db[_0x0129('0x36')][_0x0129('0x2f')]({'where':{'id':_0x550c39[_0x0129('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1d6b12,null))[_0x0129('0x26')](saveUpdates(_0x550c39[_0x0129('0x50')],null))[_0x0129('0x26')](respondWithResult(_0x1d6b12,null))[_0x0129('0x4a')](handleError(_0x1d6b12,null));};exports[_0x0129('0x5e')]=function(_0x4fb9f1,_0x57ab50){return db[_0x0129('0x36')][_0x0129('0x2f')]({'where':{'id':_0x4fb9f1[_0x0129('0x4c')]['id']}})[_0x0129('0x26')](handleEntityNotFound(_0x57ab50,null))[_0x0129('0x26')](removeEntity(_0x57ab50,null))[_0x0129('0x4a')](handleError(_0x57ab50,null));};exports[_0x0129('0x5f')]=function(_0x20ca98,_0x2d852f,_0x110cc0){var _0x3a32f0={'raw':![],'where':{}};var _0x1133d1={};var _0x227ede={'count':0x0,'rows':[]};return db[_0x0129('0x36')]['findOne']({'where':{'id':_0x20ca98[_0x0129('0x4c')]['id']}})[_0x0129('0x26')](handleEntityNotFound(_0x2d852f,null))[_0x0129('0x26')](function(_0x54997d){if(_0x54997d){_0x1133d1['model']=_[_0x0129('0x3b')](db[_0x0129('0x60')][_0x0129('0x4d')]);_0x1133d1['query']=_[_0x0129('0x3b')](_0x20ca98[_0x0129('0x3a')]);_0x1133d1[_0x0129('0x43')]=_[_0x0129('0x3d')](_0x1133d1[_0x0129('0x39')],_0x1133d1['query']);_0x3a32f0[_0x0129('0x3c')]=_['intersection'](_0x1133d1[_0x0129('0x39')],qs['fields'](_0x20ca98[_0x0129('0x3a')][_0x0129('0x3e')]));_0x3a32f0[_0x0129('0x3c')]=_0x3a32f0[_0x0129('0x3c')][_0x0129('0x4e')]?_0x3a32f0['attributes']:_0x1133d1[_0x0129('0x39')];if(!_0x20ca98['query'][_0x0129('0x3f')]('nolimit')){_0x3a32f0[_0x0129('0x1f')]=qs[_0x0129('0x1f')](_0x20ca98[_0x0129('0x3a')][_0x0129('0x1f')]);_0x3a32f0[_0x0129('0x1e')]=qs[_0x0129('0x1e')](_0x20ca98['query'][_0x0129('0x1e')]);}_0x3a32f0['order']=qs[_0x0129('0x61')](_0x20ca98[_0x0129('0x3a')][_0x0129('0x61')]);_0x3a32f0[_0x0129('0x42')]=qs[_0x0129('0x43')](_[_0x0129('0x44')](_0x20ca98[_0x0129('0x3a')],_0x1133d1[_0x0129('0x43')]));_0x3a32f0['where'][_0x0129('0x62')]=_0x54997d['id'];if(_0x20ca98[_0x0129('0x3a')][_0x0129('0x2a')]){_0x3a32f0[_0x0129('0x42')]=_[_0x0129('0x45')](_0x3a32f0[_0x0129('0x42')],{'$or':_[_0x0129('0x2c')](_0x3a32f0[_0x0129('0x3c')],function(_0x402d4e){var _0x207bc3={};_0x207bc3[_0x402d4e]={'$like':'%'+_0x20ca98[_0x0129('0x3a')][_0x0129('0x2a')]+'%'};return _0x207bc3;})});}_0x3a32f0=_['merge']({},_0x3a32f0,_0x20ca98['options']);return db[_0x0129('0x60')][_0x0129('0x1d')]({'where':_0x3a32f0[_0x0129('0x42')]})[_0x0129('0x26')](function(_0x5620fd){_0x227ede[_0x0129('0x1d')]=_0x5620fd;if(_0x20ca98[_0x0129('0x3a')]['includeAll']){_0x3a32f0[_0x0129('0x59')]=[{'all':!![]}];}return db[_0x0129('0x60')][_0x0129('0x63')](_0x3a32f0);})[_0x0129('0x26')](function(_0x1d5dd3){_0x227ede[_0x0129('0x49')]=_0x1d5dd3;return _0x227ede;});}})['then'](respondWithFilteredResult(_0x2d852f,_0x3a32f0))['catch'](handleError(_0x2d852f,null));};exports[_0x0129('0x64')]=function(_0xf2a6d,_0xee171b,_0x6d240f){var _0x1b562f={'raw':!![],'where':{}};var _0x2b9959={};var _0x41a976={'count':0x0,'rows':[]};return db[_0x0129('0x36')][_0x0129('0x65')]({'where':{'id':_0xf2a6d[_0x0129('0x4c')]['id']}})[_0x0129('0x26')](handleEntityNotFound(_0xee171b,null))[_0x0129('0x26')](function(_0x1c8782){if(_0x1c8782){_0x2b9959['model']=_[_0x0129('0x3b')](db['CmHopperHistory'][_0x0129('0x4d')]);_0x2b9959['query']=_[_0x0129('0x3b')](_0xf2a6d['query']);_0x2b9959[_0x0129('0x43')]=_['intersection'](_0x2b9959[_0x0129('0x39')],_0x2b9959[_0x0129('0x3a')]);_0x1b562f[_0x0129('0x3c')]=_['intersection'](_0x2b9959['model'],qs['fields'](_0xf2a6d['query'][_0x0129('0x3e')]));_0x1b562f['attributes']=_0x1b562f['attributes'][_0x0129('0x4e')]?_0x1b562f['attributes']:_0x2b9959['model'];if(!_0xf2a6d[_0x0129('0x3a')]['hasOwnProperty'](_0x0129('0x40'))){_0x1b562f[_0x0129('0x1f')]=qs['limit'](_0xf2a6d[_0x0129('0x3a')][_0x0129('0x1f')]);_0x1b562f[_0x0129('0x1e')]=qs[_0x0129('0x1e')](_0xf2a6d['query']['offset']);}_0x1b562f[_0x0129('0x41')]=qs[_0x0129('0x61')](_0xf2a6d[_0x0129('0x3a')]['sort']);_0x1b562f[_0x0129('0x42')]=qs[_0x0129('0x43')](_[_0x0129('0x44')](_0xf2a6d['query'],_0x2b9959[_0x0129('0x43')]));_0x1b562f[_0x0129('0x42')][_0x0129('0x62')]=_0x1c8782['id'];if(_0xf2a6d[_0x0129('0x3a')]['filter']){_0x1b562f[_0x0129('0x42')]=_[_0x0129('0x45')](_0x1b562f[_0x0129('0x42')],{'$or':_[_0x0129('0x2c')](_0x1b562f[_0x0129('0x3c')],function(_0x384574){var _0xfa9a34={};_0xfa9a34[_0x384574]={'$like':'%'+_0xf2a6d[_0x0129('0x3a')]['filter']+'%'};return _0xfa9a34;})});}_0x1b562f=_[_0x0129('0x45')]({},_0x1b562f,_0xf2a6d[_0x0129('0x47')]);return db[_0x0129('0x66')][_0x0129('0x1d')]({'where':_0x1b562f['where']})[_0x0129('0x26')](function(_0x277db4){_0x41a976[_0x0129('0x1d')]=_0x277db4;if(_0xf2a6d['query']['includeAll']){_0x1b562f[_0x0129('0x59')]=[{'all':!![]}];}return db[_0x0129('0x66')][_0x0129('0x63')](_0x1b562f);})[_0x0129('0x26')](function(_0x36cde9){_0x41a976['rows']=_0x36cde9;return _0x41a976;});}})['then'](respondWithFilteredResult(_0xee171b,_0x1b562f))[_0x0129('0x4a')](handleError(_0xee171b,null));};exports['getHopperFinals']=function(_0x46f080,_0x4597a8,_0x10fe58){var _0x372603={'raw':!![],'where':{}};var _0xbd905={};var _0x5b3649={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x46f080[_0x0129('0x4c')]['id']}})[_0x0129('0x26')](handleEntityNotFound(_0x4597a8,null))['then'](function(_0x1c1f6e){if(_0x1c1f6e){_0xbd905[_0x0129('0x39')]=_['keys'](db['CmHopperFinal'][_0x0129('0x4d')]);_0xbd905[_0x0129('0x3a')]=_['keys'](_0x46f080[_0x0129('0x3a')]);_0xbd905['filters']=_[_0x0129('0x3d')](_0xbd905[_0x0129('0x39')],_0xbd905[_0x0129('0x3a')]);_0x372603[_0x0129('0x3c')]=_['intersection'](_0xbd905[_0x0129('0x39')],qs[_0x0129('0x3e')](_0x46f080[_0x0129('0x3a')][_0x0129('0x3e')]));_0x372603[_0x0129('0x3c')]=_0x372603[_0x0129('0x3c')]['length']?_0x372603[_0x0129('0x3c')]:_0xbd905['model'];if(!_0x46f080[_0x0129('0x3a')][_0x0129('0x3f')](_0x0129('0x40'))){_0x372603[_0x0129('0x1f')]=qs[_0x0129('0x1f')](_0x46f080[_0x0129('0x3a')][_0x0129('0x1f')]);_0x372603[_0x0129('0x1e')]=qs[_0x0129('0x1e')](_0x46f080['query']['offset']);}_0x372603[_0x0129('0x41')]=qs[_0x0129('0x61')](_0x46f080[_0x0129('0x3a')][_0x0129('0x61')]);_0x372603[_0x0129('0x42')]=qs[_0x0129('0x43')](_[_0x0129('0x44')](_0x46f080[_0x0129('0x3a')],_0xbd905[_0x0129('0x43')]));_0x372603[_0x0129('0x42')][_0x0129('0x62')]=_0x1c1f6e['id'];if(_0x46f080['query']['filter']){_0x372603['where']=_[_0x0129('0x45')](_0x372603['where'],{'$or':_['map'](_0x372603[_0x0129('0x3c')],function(_0x2be9f1){var _0x1558c0={};_0x1558c0[_0x2be9f1]={'$like':'%'+_0x46f080[_0x0129('0x3a')][_0x0129('0x2a')]+'%'};return _0x1558c0;})});}_0x372603=_[_0x0129('0x45')]({},_0x372603,_0x46f080['options']);return db[_0x0129('0x67')][_0x0129('0x1d')]({'where':_0x372603[_0x0129('0x42')]})[_0x0129('0x26')](function(_0xba80f4){_0x5b3649[_0x0129('0x1d')]=_0xba80f4;if(_0x46f080[_0x0129('0x3a')][_0x0129('0x48')]){_0x372603[_0x0129('0x59')]=[{'all':!![]}];}return db[_0x0129('0x67')][_0x0129('0x63')](_0x372603);})[_0x0129('0x26')](function(_0x1a6dab){_0x5b3649[_0x0129('0x49')]=_0x1a6dab;return _0x5b3649;});}})[_0x0129('0x26')](respondWithFilteredResult(_0x4597a8,_0x372603))[_0x0129('0x4a')](handleError(_0x4597a8,null));};exports[_0x0129('0x68')]=function(_0xab246b,_0x5c9860,_0x2379ea){var _0x58f6c9={'raw':!![],'where':{}};var _0x28084a={};var _0x367be3={'count':0x0,'rows':[]};return db[_0x0129('0x36')][_0x0129('0x65')]({'where':{'id':_0xab246b['params']['id']}})[_0x0129('0x26')](handleEntityNotFound(_0x5c9860,null))['then'](function(_0x5ef689){if(_0x5ef689){_0x28084a[_0x0129('0x39')]=_['keys'](db[_0x0129('0x69')]['rawAttributes']);_0x28084a['query']=_['keys'](_0xab246b[_0x0129('0x3a')]);_0x28084a[_0x0129('0x43')]=_[_0x0129('0x3d')](_0x28084a[_0x0129('0x39')],_0x28084a[_0x0129('0x3a')]);_0x58f6c9[_0x0129('0x3c')]=_[_0x0129('0x3d')](_0x28084a['model'],qs[_0x0129('0x3e')](_0xab246b['query'][_0x0129('0x3e')]));_0x58f6c9['attributes']=_0x58f6c9[_0x0129('0x3c')][_0x0129('0x4e')]?_0x58f6c9[_0x0129('0x3c')]:_0x28084a[_0x0129('0x39')];if(!_0xab246b['query']['hasOwnProperty'](_0x0129('0x40'))){_0x58f6c9[_0x0129('0x1f')]=qs[_0x0129('0x1f')](_0xab246b[_0x0129('0x3a')][_0x0129('0x1f')]);_0x58f6c9[_0x0129('0x1e')]=qs['offset'](_0xab246b[_0x0129('0x3a')]['offset']);}_0x58f6c9[_0x0129('0x41')]=qs[_0x0129('0x61')](_0xab246b[_0x0129('0x3a')][_0x0129('0x61')]);_0x58f6c9['where']=qs['filters'](_[_0x0129('0x44')](_0xab246b[_0x0129('0x3a')],_0x28084a['filters']));_0x58f6c9[_0x0129('0x42')][_0x0129('0x62')]=_0x5ef689['id'];if(_0xab246b[_0x0129('0x3a')][_0x0129('0x2a')]){_0x58f6c9['where']=_['merge'](_0x58f6c9['where'],{'$or':_['map'](_0x58f6c9['attributes'],function(_0x4a84c7){var _0x5310f6={};_0x5310f6[_0x4a84c7]={'$like':'%'+_0xab246b['query'][_0x0129('0x2a')]+'%'};return _0x5310f6;})});}_0x58f6c9=_[_0x0129('0x45')]({},_0x58f6c9,_0xab246b[_0x0129('0x47')]);return db[_0x0129('0x69')][_0x0129('0x1d')]({'where':_0x58f6c9[_0x0129('0x42')]})[_0x0129('0x26')](function(_0x56e94c){_0x367be3[_0x0129('0x1d')]=_0x56e94c;if(_0xab246b['query']['includeAll']){_0x58f6c9[_0x0129('0x59')]=[{'all':!![]}];}return db[_0x0129('0x69')][_0x0129('0x63')](_0x58f6c9);})[_0x0129('0x26')](function(_0x46d2c7){_0x367be3[_0x0129('0x49')]=_0x46d2c7;return _0x367be3;});}})['then'](respondWithFilteredResult(_0x5c9860,_0x58f6c9))[_0x0129('0x4a')](handleError(_0x5c9860,null));};exports[_0x0129('0x6a')]=function(_0x53f243,_0x108b22,_0x5d417e){var _0x3f1b5d={};var _0x5030f2={};var _0x27d95f;var _0x425a50;return db['VoiceQueue'][_0x0129('0x65')]({'where':{'id':_0x53f243[_0x0129('0x4c')]['id']}})[_0x0129('0x26')](handleEntityNotFound(_0x108b22,null))[_0x0129('0x26')](function(_0x379b0d){if(_0x379b0d){_0x27d95f=_0x379b0d;_0x5030f2[_0x0129('0x39')]=_[_0x0129('0x3b')](db[_0x0129('0x6b')]['rawAttributes']);_0x5030f2[_0x0129('0x3a')]=_[_0x0129('0x3b')](_0x53f243[_0x0129('0x3a')]);_0x5030f2['filters']=_[_0x0129('0x3d')](_0x5030f2['model'],_0x5030f2['query']);_0x3f1b5d[_0x0129('0x3c')]=_[_0x0129('0x3d')](_0x5030f2['model'],qs['fields'](_0x53f243[_0x0129('0x3a')][_0x0129('0x3e')]));_0x3f1b5d[_0x0129('0x3c')]=_0x3f1b5d[_0x0129('0x3c')][_0x0129('0x4e')]?_0x3f1b5d['attributes']:_0x5030f2[_0x0129('0x39')];_0x3f1b5d['order']=qs[_0x0129('0x61')](_0x53f243[_0x0129('0x3a')][_0x0129('0x61')]);_0x3f1b5d[_0x0129('0x42')]=qs[_0x0129('0x43')](_[_0x0129('0x44')](_0x53f243[_0x0129('0x3a')],_0x5030f2['filters']));if(_0x53f243[_0x0129('0x3a')][_0x0129('0x2a')]){_0x3f1b5d[_0x0129('0x42')]=_[_0x0129('0x45')](_0x3f1b5d[_0x0129('0x42')],{'$or':_[_0x0129('0x2c')](_0x3f1b5d[_0x0129('0x3c')],function(_0x41400a){var _0x33ff32={};_0x33ff32[_0x41400a]={'$like':'%'+_0x53f243[_0x0129('0x3a')]['filter']+'%'};return _0x33ff32;})});}_0x3f1b5d=_[_0x0129('0x45')]({},_0x3f1b5d,_0x53f243[_0x0129('0x47')]);return _0x27d95f['getTeams'](_0x3f1b5d);}})['then'](function(_0x2ef672){if(_0x2ef672){_0x425a50=_0x2ef672['length'];if(!_0x53f243[_0x0129('0x3a')]['hasOwnProperty'](_0x0129('0x40'))){_0x3f1b5d['limit']=qs[_0x0129('0x1f')](_0x53f243[_0x0129('0x3a')][_0x0129('0x1f')]);_0x3f1b5d[_0x0129('0x1e')]=qs['offset'](_0x53f243['query']['offset']);}return _0x27d95f[_0x0129('0x6a')](_0x3f1b5d);}})[_0x0129('0x26')](function(_0x5994ba){if(_0x5994ba){return _0x5994ba?{'count':_0x425a50,'rows':_0x5994ba}:null;}})['then'](respondWithResult(_0x108b22,null))[_0x0129('0x4a')](handleError(_0x108b22,null));};exports[_0x0129('0x6c')]=function(_0x6dea38,_0x1c35f7,_0x495502){var _0x2822fd=_0x6dea38[_0x0129('0x50')][_0x0129('0x6d')];var _0x49ecdf=_['map'](_0x2822fd,'id');return db['Team'][_0x0129('0x63')]({'where':{'id':_0x49ecdf},'attributes':['id'],'include':[{'model':db[_0x0129('0x6e')],'as':_0x0129('0x6f'),'attributes':['id','name',_0x0129('0x70'),_0x0129('0x71'),_0x0129('0x72')],'raw':!![]}]})['then'](function(_0x535f20){if(_0x535f20){var _0x2f1dd1=_[_0x0129('0x73')](_0x535f20,function(_0x4d68d7){var _0x3e2405=_0x4d68d7[_0x0129('0x27')]({'plain':!![]});_0x3e2405['Agents'][_0x0129('0x74')](function(_0x5b05cf){_0x5b05cf[_0x0129('0x75')]=_[_0x0129('0x2f')](_0x2822fd,{'id':_0x3e2405['id']})['penalty'];});return _0x3e2405[_0x0129('0x6f')];});return db[_0x0129('0x36')][_0x0129('0x2f')]({'where':{'id':_0x6dea38[_0x0129('0x4c')]['id']}})[_0x0129('0x26')](function(_0x41d2c5){return db[_0x0129('0x76')][_0x0129('0x77')](function(_0x5bb923){return _0x41d2c5[_0x0129('0x6c')](_0x49ecdf,{'transaction':_0x5bb923})['then'](function(){return BPromise[_0x0129('0x78')](_0x2822fd,function(_0x196aa5){return db['TeamVoiceQueue'][_0x0129('0x79')]({'TeamId':_0x196aa5['id'],'VoiceQueueId':_0x6dea38['params']['id'],'penalty':_0x196aa5[_0x0129('0x75')]},{'transaction':_0x5bb923});});})[_0x0129('0x26')](function(){return BPromise[_0x0129('0x78')](_0x2f1dd1,function(_0x50bc5b){return db[_0x0129('0x7a')][_0x0129('0x7b')]({'where':{'UserId':_0x50bc5b['id'],'VoiceQueueId':_0x6dea38[_0x0129('0x4c')]['id']},'defaults':{'penalty':_0x50bc5b[_0x0129('0x75')]},'transaction':_0x5bb923});});})[_0x0129('0x26')](function(){return BPromise[_0x0129('0x78')](_['filter'](_0x2f1dd1,{'online':!![]}),function(_0x2eab51){return db['UserVoiceQueueRt'][_0x0129('0x79')]({'membername':_0x2eab51[_0x0129('0x33')],'UserId':_0x2eab51['id'],'queue_name':_0x41d2c5['name'],'VoiceQueueId':_0x41d2c5['id'],'interface':_[_0x0129('0x7c')](_0x2eab51[_0x0129('0x72')])?util[_0x0129('0x7d')](_0x0129('0x7e'),_0x2eab51[_0x0129('0x33')]):_0x2eab51[_0x0129('0x72')],'paused':_0x2eab51['voicePause']||![],'penalty':_0x2eab51['penalty']},{'transaction':_0x5bb923});});})[_0x0129('0x26')](function(){_0x2f1dd1[_0x0129('0x74')](function(_0x131ab8){socket[_0x0129('0x7f')](_0x0129('0x80'),{'UserId':_0x131ab8['id'],'VoiceQueueId':_0x41d2c5['id']});});});});});}})[_0x0129('0x26')](respondWithStatusCode(_0x1c35f7,null))[_0x0129('0x4a')](handleError(_0x1c35f7,null));};exports[_0x0129('0x81')]=function(_0x186e94,_0x2e5ac1,_0x136a34){return db[_0x0129('0x6b')]['findAll']({'where':{'id':_0x186e94[_0x0129('0x3a')][_0x0129('0x82')]},'attributes':['id'],'include':[{'model':db[_0x0129('0x6e')],'as':_0x0129('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x0129('0x26')](handleEntityNotFound(_0x2e5ac1,null))['then'](function(_0x3653b9){var _0x4e8f66=_[_0x0129('0x2c')](_0x3653b9,'id');var _0x4d5c50=[];var _0x1bbab6=[];var _0x5bcab1=squel[_0x0129('0x83')]();_0x5bcab1[_0x0129('0x84')](_0x0129('0x85'))['from'](_0x0129('0x86'),'tq')[_0x0129('0x87')](_0x0129('0x88'),'ut',_0x0129('0x89'))[_0x0129('0x42')](_0x0129('0x8a'),_0x186e94[_0x0129('0x4c')]['id']);for(var _0x15f42c=0x0;_0x15f42c<_0x3653b9['length'];_0x15f42c+=0x1){let _0x19e7df=_0x3653b9[_0x15f42c];for(var _0x4ebfc4=0x0;_0x4ebfc4<_0x19e7df[_0x0129('0x6f')]['length'];_0x4ebfc4+=0x1){let _0x411d00=_0x19e7df[_0x0129('0x6f')][_0x4ebfc4];var _0x551967=_0x5bcab1['clone']();_0x551967['where'](_0x0129('0x8b'),_0x411d00['id']);_0x1bbab6[_0x0129('0x8c')](db[_0x0129('0x76')][_0x0129('0x3a')](_0x551967['toString'](),{'type':db['sequelize'][_0x0129('0x8d')][_0x0129('0x8e')]})[_0x0129('0x26')](function(_0x322795){if(_0x322795['length']===0x1){return _0x411d00['id'];}else{var _0x3386fd=_[_0x0129('0x8f')](_[_0x0129('0x2c')](_0x322795,'TeamId'),function(_0x118865){return _[_0x0129('0x90')](_0x4e8f66,_0x118865);});if(_0x3386fd){return _0x411d00['id'];}}}));}}return BPromise[_0x0129('0x91')](_0x1bbab6)[_0x0129('0x26')](function(_0x28b737){_0x4d5c50=_(_0x4d5c50)[_0x0129('0x92')](_0x28b737)[_0x0129('0x93')]()['value']();return db[_0x0129('0x36')][_0x0129('0x2f')]({'where':{'id':_0x186e94['params']['id']}})[_0x0129('0x26')](function(_0x586592){return db['sequelize'][_0x0129('0x77')](function(_0x45c9d3){return _0x586592[_0x0129('0x81')](_0x186e94[_0x0129('0x3a')][_0x0129('0x82')],{'transaction':_0x45c9d3})[_0x0129('0x26')](function(){if(!_[_0x0129('0x94')](_0x4d5c50)){return _0x586592[_0x0129('0x95')](_0x4d5c50,{'transaction':_0x45c9d3})['then'](function(){return db[_0x0129('0x96')][_0x0129('0x5e')]({'where':{'VoiceQueueId':_0x186e94['params']['id'],'UserId':_0x4d5c50},'transaction':_0x45c9d3});});}})['then'](function(){_0x4d5c50[_0x0129('0x74')](function(_0x4f8103){socket[_0x0129('0x7f')](_0x0129('0x97'),{'UserId':_0x4f8103,'VoiceQueueId':_0x586592['id']});});});});});});})[_0x0129('0x26')](respondWithStatusCode(_0x2e5ac1,null))[_0x0129('0x4a')](handleError(_0x2e5ac1,null));};exports[_0x0129('0x98')]=function(_0x30de7f,_0x36cba7,_0x497911){var _0x215aa2,_0x1b16fb;return db[_0x0129('0x36')][_0x0129('0x2f')]({'where':{'id':_0x30de7f['params']['id']}})[_0x0129('0x26')](handleEntityNotFound(_0x36cba7,null))[_0x0129('0x26')](function(_0x5afe4e){if(_0x5afe4e){_0x1b16fb=_0x5afe4e;return _0x5afe4e[_0x0129('0x98')](_0x30de7f['body'][_0x0129('0x82')],_['omit'](_0x30de7f['body'],['ids','id'])||{})[_0x0129('0x99')](function(_0xe98537){for(var _0x17d1af=0x0;_0x17d1af<_0x30de7f[_0x0129('0x50')]['ids'][_0x0129('0x4e')];_0x17d1af+=0x1){socket[_0x0129('0x7f')]('userVoiceQueue:save',{'UserId':_0x30de7f[_0x0129('0x50')]['ids'][_0x17d1af],'VoiceQueueId':_0x30de7f['params']['id']});}return _0xe98537;});}})[_0x0129('0x26')](function(_0x143e7e){_0x215aa2=_0x143e7e||[];if(_0x1b16fb){return db['User'][_0x0129('0x63')]({'where':{'id':_0x30de7f[_0x0129('0x50')][_0x0129('0x82')]},'attributes':['id',_0x0129('0x33'),_0x0129('0x70'),'voicePause',_0x0129('0x72')],'raw':!![]});}})['then'](function(_0x1402f9){if(!_[_0x0129('0x94')](_0x1402f9)){var _0x333ccb=[];for(var _0x3693f0=0x0;_0x3693f0<_0x1402f9[_0x0129('0x4e')];_0x3693f0++){if(_0x1402f9[_0x3693f0][_0x0129('0x70')]){_0x333ccb[_0x0129('0x8c')](db[_0x0129('0x96')][_0x0129('0x79')]({'membername':_0x1402f9[_0x3693f0][_0x0129('0x33')],'UserId':_0x1402f9[_0x3693f0]['id'],'queue_name':_0x1b16fb[_0x0129('0x33')],'VoiceQueueId':_0x1b16fb['id'],'interface':_[_0x0129('0x7c')](_0x1402f9[_0x3693f0][_0x0129('0x72')])?util['format'](_0x0129('0x7e'),_0x1402f9[_0x3693f0][_0x0129('0x33')]):_0x1402f9[_0x3693f0]['interface'],'paused':_0x1402f9[_0x3693f0][_0x0129('0x71')]||![],'penalty':_0x30de7f[_0x0129('0x50')][_0x0129('0x75')]||0x0}));}}return BPromise[_0x0129('0x91')](_0x333ccb);}})['then'](function(){return _0x215aa2;})[_0x0129('0x26')](respondWithResult(_0x36cba7,null))['catch'](handleError(_0x36cba7,null));};exports[_0x0129('0x95')]=function(_0x3e8d24,_0x3cba97,_0x1a2ac5){return db[_0x0129('0x36')][_0x0129('0x2f')]({'where':{'id':_0x3e8d24[_0x0129('0x4c')]['id']}})[_0x0129('0x26')](handleEntityNotFound(_0x3cba97,null))[_0x0129('0x26')](function(_0x57b336){if(_0x57b336){return _0x57b336[_0x0129('0x95')](_0x3e8d24['query'][_0x0129('0x82')])[_0x0129('0x26')](function(){if(_[_0x0129('0x9a')](_0x3e8d24[_0x0129('0x3a')]['ids'])){for(var _0x4c485d=0x0;_0x4c485d<_0x3e8d24[_0x0129('0x3a')]['ids'][_0x0129('0x4e')];_0x4c485d+=0x1){socket[_0x0129('0x7f')](_0x0129('0x97'),{'UserId':Number(_0x3e8d24['query'][_0x0129('0x82')][_0x4c485d]),'VoiceQueueId':Number(_0x3e8d24[_0x0129('0x4c')]['id'])});}}else{socket[_0x0129('0x7f')](_0x0129('0x97'),{'UserId':Number(_0x3e8d24[_0x0129('0x3a')][_0x0129('0x82')]),'VoiceQueueId':Number(_0x3e8d24['params']['id'])});}});}})[_0x0129('0x26')](function(_0x24e5f6){return db[_0x0129('0x96')]['destroy']({'where':{'VoiceQueueId':_0x3e8d24[_0x0129('0x4c')]['id'],'UserId':_0x3e8d24['query'][_0x0129('0x82')]}})['then'](function(){return _0x24e5f6;});})[_0x0129('0x26')](respondWithStatusCode(_0x3cba97,null))['catch'](handleError(_0x3cba97,null));};exports[_0x0129('0x9b')]=function(_0x2ac581,_0x2606e7,_0x285cda){var _0x48657e={};var _0x52a1a4={};var _0x318a7e;var _0x8f7921;return db[_0x0129('0x36')][_0x0129('0x65')]({'where':{'id':_0x2ac581[_0x0129('0x4c')]['id']}})[_0x0129('0x26')](handleEntityNotFound(_0x2606e7,null))[_0x0129('0x26')](function(_0x3bf424){if(_0x3bf424){_0x318a7e=_0x3bf424;_0x52a1a4[_0x0129('0x39')]=_[_0x0129('0x3b')](db['User'][_0x0129('0x4d')]);_0x52a1a4['query']=_[_0x0129('0x3b')](_0x2ac581[_0x0129('0x3a')]);_0x52a1a4['filters']=_[_0x0129('0x3d')](_0x52a1a4['model'],_0x52a1a4[_0x0129('0x3a')]);_0x48657e[_0x0129('0x3c')]=_[_0x0129('0x3d')](_0x52a1a4[_0x0129('0x39')],qs[_0x0129('0x3e')](_0x2ac581['query'][_0x0129('0x3e')]));_0x48657e[_0x0129('0x3c')]=_0x48657e[_0x0129('0x3c')][_0x0129('0x4e')]?_0x48657e['attributes']:_0x52a1a4[_0x0129('0x39')];_0x48657e[_0x0129('0x41')]=qs[_0x0129('0x61')](_0x2ac581[_0x0129('0x3a')][_0x0129('0x61')]);_0x48657e[_0x0129('0x42')]=qs['filters'](_[_0x0129('0x44')](_0x2ac581[_0x0129('0x3a')],_0x52a1a4[_0x0129('0x43')]));if(_0x2ac581['query']['filter']){_0x48657e[_0x0129('0x42')]=_[_0x0129('0x45')](_0x48657e[_0x0129('0x42')],{'$or':_[_0x0129('0x2c')](_0x48657e['attributes'],function(_0x28df0b){var _0x353831={};_0x353831[_0x28df0b]={'$like':'%'+_0x2ac581[_0x0129('0x3a')][_0x0129('0x2a')]+'%'};return _0x353831;})});}_0x48657e=_[_0x0129('0x45')]({},_0x48657e,_0x2ac581['options']);return _0x318a7e[_0x0129('0x9b')](_0x48657e);}})['then'](function(_0xb1012d){if(_0xb1012d){_0x8f7921=_0xb1012d[_0x0129('0x4e')];if(!_0x2ac581[_0x0129('0x3a')][_0x0129('0x3f')]('nolimit')){_0x48657e[_0x0129('0x1f')]=qs[_0x0129('0x1f')](_0x2ac581[_0x0129('0x3a')][_0x0129('0x1f')]);_0x48657e[_0x0129('0x1e')]=qs[_0x0129('0x1e')](_0x2ac581[_0x0129('0x3a')]['offset']);}return _0x318a7e['getAgents'](_0x48657e);}})[_0x0129('0x26')](function(_0x9ed583){if(_0x9ed583){return _0x9ed583?{'count':_0x8f7921,'rows':_0x9ed583}:null;}})[_0x0129('0x26')](respondWithResult(_0x2606e7,null))[_0x0129('0x4a')](handleError(_0x2606e7,null));};exports[_0x0129('0x9c')]=function(_0x451247,_0x511e98,_0x1328e3){var _0x24f0f6={};var _0x3422a1={};var _0x1e2999;var _0x37bcde;return db[_0x0129('0x36')][_0x0129('0x65')]({'where':{'id':_0x451247[_0x0129('0x4c')]['id']}})['then'](handleEntityNotFound(_0x511e98,null))[_0x0129('0x26')](function(_0xa48f9d){if(_0xa48f9d){_0x1e2999=_0xa48f9d;_0x3422a1['model']=_[_0x0129('0x3b')](db['UserVoiceQueueRt'][_0x0129('0x4d')]);_0x3422a1['query']=_[_0x0129('0x3b')](_0x451247[_0x0129('0x3a')]);_0x3422a1[_0x0129('0x43')]=_[_0x0129('0x3d')](_0x3422a1[_0x0129('0x39')],_0x3422a1['query']);_0x24f0f6[_0x0129('0x3c')]=_['intersection'](_0x3422a1[_0x0129('0x39')],qs[_0x0129('0x3e')](_0x451247['query'][_0x0129('0x3e')]));_0x24f0f6['attributes']=_0x24f0f6[_0x0129('0x3c')][_0x0129('0x4e')]?_0x24f0f6[_0x0129('0x3c')]:_0x3422a1[_0x0129('0x39')];_0x24f0f6[_0x0129('0x41')]=qs[_0x0129('0x61')](_0x451247[_0x0129('0x3a')]['sort']);_0x24f0f6[_0x0129('0x42')]=qs[_0x0129('0x43')](_['pick'](_0x451247[_0x0129('0x3a')],_0x3422a1[_0x0129('0x43')]));if(_0x451247[_0x0129('0x3a')][_0x0129('0x2a')]){_0x24f0f6['where']=_[_0x0129('0x45')](_0x24f0f6[_0x0129('0x42')],{'$or':_['map'](_0x24f0f6['attributes'],function(_0x76f93){var _0x1f6821={};_0x1f6821[_0x76f93]={'$like':'%'+_0x451247['query'][_0x0129('0x2a')]+'%'};return _0x1f6821;})});}_0x24f0f6=_[_0x0129('0x45')]({},_0x24f0f6,_0x451247['options']);return _0x1e2999[_0x0129('0x9c')](_0x24f0f6);}})[_0x0129('0x26')](function(_0x2b21dc){if(_0x2b21dc){_0x37bcde=_0x2b21dc[_0x0129('0x4e')];if(!_0x451247[_0x0129('0x3a')][_0x0129('0x3f')](_0x0129('0x40'))){_0x24f0f6[_0x0129('0x1f')]=qs['limit'](_0x451247[_0x0129('0x3a')][_0x0129('0x1f')]);_0x24f0f6['offset']=qs[_0x0129('0x1e')](_0x451247[_0x0129('0x3a')][_0x0129('0x1e')]);}return _0x1e2999['getMembers'](_0x24f0f6);}})[_0x0129('0x26')](function(_0x3a67e4){return _0x3a67e4?{'count':_0x37bcde,'rows':_0x3a67e4}:null;})['then'](respondWithResult(_0x511e98,null))[_0x0129('0x4a')](handleError(_0x511e98,null));};exports[_0x0129('0x9d')]=function(_0x179516,_0x5a1532,_0x2c4b28){var _0x2328cc={};var _0x24d60e={};var _0x5e632e;var _0x50c340;return db[_0x0129('0x36')][_0x0129('0x65')]({'where':{'id':_0x179516[_0x0129('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5a1532,null))[_0x0129('0x26')](function(_0x50f006){if(_0x50f006){_0x5e632e=_0x50f006;_0x24d60e[_0x0129('0x39')]=_[_0x0129('0x3b')](db[_0x0129('0x9e')][_0x0129('0x4d')]);_0x24d60e[_0x0129('0x3a')]=_[_0x0129('0x3b')](_0x179516[_0x0129('0x3a')]);_0x24d60e[_0x0129('0x43')]=_[_0x0129('0x3d')](_0x24d60e['model'],_0x24d60e[_0x0129('0x3a')]);_0x2328cc[_0x0129('0x3c')]=_[_0x0129('0x3d')](_0x24d60e[_0x0129('0x39')],qs[_0x0129('0x3e')](_0x179516['query'][_0x0129('0x3e')]));_0x2328cc[_0x0129('0x3c')]=_0x2328cc[_0x0129('0x3c')][_0x0129('0x4e')]?_0x2328cc['attributes']:_0x24d60e[_0x0129('0x39')];_0x2328cc[_0x0129('0x41')]=qs['sort'](_0x179516['query']['sort']);_0x2328cc[_0x0129('0x42')]=qs[_0x0129('0x43')](_[_0x0129('0x44')](_0x179516[_0x0129('0x3a')],_0x24d60e[_0x0129('0x43')]));if(_0x179516[_0x0129('0x3a')]['filter']){_0x2328cc[_0x0129('0x42')]=_[_0x0129('0x45')](_0x2328cc[_0x0129('0x42')],{'$or':_[_0x0129('0x2c')](_0x2328cc[_0x0129('0x3c')],function(_0x57ff4d){var _0x2f9679={};_0x2f9679[_0x57ff4d]={'$like':'%'+_0x179516['query'][_0x0129('0x2a')]+'%'};return _0x2f9679;})});}_0x2328cc=_[_0x0129('0x45')]({},_0x2328cc,_0x179516[_0x0129('0x47')]);return _0x5e632e[_0x0129('0x9d')](_0x2328cc);}})[_0x0129('0x26')](function(_0x2d2480){if(_0x2d2480){_0x50c340=_0x2d2480[_0x0129('0x4e')];if(!_0x179516[_0x0129('0x3a')][_0x0129('0x3f')]('nolimit')){_0x2328cc[_0x0129('0x1f')]=qs[_0x0129('0x1f')](_0x179516[_0x0129('0x3a')]['limit']);_0x2328cc['offset']=qs['offset'](_0x179516[_0x0129('0x3a')][_0x0129('0x1e')]);}return _0x5e632e[_0x0129('0x9d')](_0x2328cc);}})[_0x0129('0x26')](function(_0x3c7c0c){if(_0x3c7c0c){return _0x3c7c0c?{'count':_0x50c340,'rows':_0x3c7c0c}:null;}})['then'](respondWithResult(_0x5a1532,null))[_0x0129('0x4a')](handleError(_0x5a1532,null));};exports[_0x0129('0x9f')]=function(_0x324624,_0x364de1,_0x44d662){var _0x2c057d,_0x566e75;return db[_0x0129('0x36')]['find']({'where':{'id':_0x324624[_0x0129('0x4c')]['id']}})[_0x0129('0x26')](handleEntityNotFound(_0x364de1,null))[_0x0129('0x26')](function(_0x5edde6){if(_0x5edde6){_0x566e75=_0x5edde6;return _0x5edde6[_0x0129('0x9f')](_0x324624[_0x0129('0x50')][_0x0129('0x82')],_[_0x0129('0xa0')](_0x324624[_0x0129('0x50')],[_0x0129('0x82'),'id'])||{});}return null;})[_0x0129('0x99')](function(_0x1583fe){var _0x24111d;_0x2c057d=_0x1583fe||[];var _0x23a61e=[];if(_0x1583fe){for(var _0x3ca7b0=0x0;_0x3ca7b0<_0x1583fe[_0x0129('0x4e')];_0x3ca7b0+=0x1){var _0x39f2ad=_0x1583fe[_0x3ca7b0][_0x0129('0x27')]({'plain':!![]});_0x566e75[_0x0129('0xa1')]=_0x324624[_0x0129('0x50')][_0x0129('0xa1')]?_0x324624[_0x0129('0x50')][_0x0129('0xa1')]:_0x566e75['dialCheckDuplicateType'];switch(_0x566e75['dialCheckDuplicateType']){case'always':_0x24111d=squel[_0x0129('0xa2')]()['into'](_0x0129('0xa3'))['fromQuery'](['phone',_0x0129('0xa4'),'ContactId',_0x0129('0xa5'),_0x0129('0x62'),_0x0129('0x5a'),'updatedAt'],squel[_0x0129('0x83')]()[_0x0129('0x84')]('phone',_0x0129('0xa6'))[_0x0129('0x84')](_0x0129('0xa7'),_0x0129('0xa4'))[_0x0129('0x84')]('id','ContactId')[_0x0129('0x84')](_0x39f2ad[_0x0129('0xa8')][_0x0129('0xa9')](),'ListId')[_0x0129('0x84')](_0x324624['params']['id'][_0x0129('0xa9')](),_0x0129('0x62'))['field'](_0x0129('0xa7'),_0x0129('0x5a'))['field'](_0x0129('0xa7'),_0x0129('0x5b'))['from'](_0x0129('0xaa'))['where']('deletedAt\x20IS\x20NULL')[_0x0129('0x42')](_0x0129('0xab'),_0x39f2ad[_0x0129('0xa8')][_0x0129('0xa9')]())[_0x0129('0x42')](_0x0129('0xac'))[_0x0129('0x42')](_0x0129('0xad'),squel[_0x0129('0x83')]()[_0x0129('0x84')](_0x0129('0xae'))[_0x0129('0xaf')](_0x0129('0xb0'))['where'](_0x0129('0x8a'),_0x324624[_0x0129('0x4c')]['id'][_0x0129('0xa9')]()))[_0x0129('0x42')](_0x0129('0xad'),squel['select']()['field'](_0x0129('0xb1'))[_0x0129('0xaf')](_0x0129('0xa3'))[_0x0129('0x42')](_0x0129('0x8a'),_0x324624[_0x0129('0x4c')]['id'][_0x0129('0xa9')]())))[_0x0129('0xa9')]();break;case _0x0129('0xb2'):_0x24111d=squel[_0x0129('0xa2')]()[_0x0129('0xb3')](_0x0129('0xa3'))[_0x0129('0xb4')](['phone',_0x0129('0xa4'),_0x0129('0xb5'),_0x0129('0xa5'),_0x0129('0x62'),_0x0129('0x5a'),_0x0129('0x5b')],squel['select']()[_0x0129('0x84')](_0x0129('0xa6'),_0x0129('0xa6'))['field'](_0x0129('0xa7'),_0x0129('0xa4'))[_0x0129('0x84')]('id',_0x0129('0xb5'))[_0x0129('0x84')](_0x39f2ad[_0x0129('0xa8')][_0x0129('0xa9')](),'ListId')['field'](_0x324624[_0x0129('0x4c')]['id'][_0x0129('0xa9')](),_0x0129('0x62'))['field'](_0x0129('0xa7'),'createdAt')['field'](_0x0129('0xa7'),_0x0129('0x5b'))[_0x0129('0xaf')]('cm_contacts')[_0x0129('0x42')](_0x0129('0xb6'))[_0x0129('0x42')]('ListId\x20=\x20?',_0x39f2ad[_0x0129('0xa8')][_0x0129('0xa9')]())[_0x0129('0x42')](_0x0129('0xac'))[_0x0129('0x42')](_0x0129('0xad'),squel[_0x0129('0x83')]()[_0x0129('0x84')](_0x0129('0xb1'))[_0x0129('0xaf')]('cm_hopper')[_0x0129('0x42')](_0x0129('0x8a'),_0x324624[_0x0129('0x4c')]['id'][_0x0129('0xa9')]())))[_0x0129('0xa9')]();break;default:_0x24111d=squel[_0x0129('0xa2')]()[_0x0129('0xb3')](_0x0129('0xa3'))[_0x0129('0xb4')]([_0x0129('0xa6'),_0x0129('0xa4'),_0x0129('0xb5'),_0x0129('0xa5'),_0x0129('0x62'),_0x0129('0x5a'),_0x0129('0x5b')],squel[_0x0129('0x83')]()[_0x0129('0x84')](_0x0129('0xa6'),_0x0129('0xa6'))[_0x0129('0x84')]('NOW()','scheduledAt')[_0x0129('0x84')]('id',_0x0129('0xb5'))[_0x0129('0x84')](_0x39f2ad['CmListId'][_0x0129('0xa9')](),'ListId')[_0x0129('0x84')](_0x324624[_0x0129('0x4c')]['id'][_0x0129('0xa9')](),_0x0129('0x62'))[_0x0129('0x84')]('NOW()',_0x0129('0x5a'))[_0x0129('0x84')]('NOW()','updatedAt')[_0x0129('0xaf')](_0x0129('0xaa'))[_0x0129('0x42')]('deletedAt\x20IS\x20NULL')[_0x0129('0x42')](_0x0129('0xab'),_0x39f2ad[_0x0129('0xa8')][_0x0129('0xa9')]())[_0x0129('0x42')](_0x0129('0xac')))[_0x0129('0xa9')]();}_0x23a61e[_0x0129('0x8c')](db[_0x0129('0x76')]['query'](_0x24111d));}return BPromise['all'](_0x23a61e);}})[_0x0129('0x26')](function(){return _0x2c057d;})[_0x0129('0x26')](respondWithResult(_0x364de1,null))[_0x0129('0x4a')](handleError(_0x364de1,null));};exports[_0x0129('0xb7')]=function(_0x4ba527,_0x24079c,_0x5a96fe){return db[_0x0129('0x36')][_0x0129('0x2f')]({'where':{'id':_0x4ba527['params']['id']}})[_0x0129('0x26')](handleEntityNotFound(_0x24079c,null))[_0x0129('0x26')](function(_0x2d7318){if(_0x2d7318){return _0x2d7318[_0x0129('0xb7')](_0x4ba527[_0x0129('0x3a')][_0x0129('0x82')]);}})['then'](function(_0x1d55dd){if(_0x1d55dd){return db[_0x0129('0x60')][_0x0129('0x5e')]({'where':{'ListId':_0x4ba527['query'][_0x0129('0x82')],'VoiceQueueId':_0x4ba527[_0x0129('0x4c')]['id']}})[_0x0129('0x26')](function(){return _0x1d55dd;});}})[_0x0129('0x26')](respondWithStatusCode(_0x24079c,null))[_0x0129('0x4a')](handleError(_0x24079c,null));};exports['getBlackLists']=function(_0x30c2dc,_0x3c6171,_0x44430b){var _0x3e3a19={};var _0x44ff74={};var _0x47842e;var _0x1ab434;return db[_0x0129('0x36')][_0x0129('0x65')]({'where':{'id':_0x30c2dc[_0x0129('0x4c')]['id']}})[_0x0129('0x26')](handleEntityNotFound(_0x3c6171,null))[_0x0129('0x26')](function(_0x28b793){if(_0x28b793){_0x47842e=_0x28b793;_0x44ff74[_0x0129('0x39')]=_[_0x0129('0x3b')](db[_0x0129('0x9e')][_0x0129('0x4d')]);_0x44ff74[_0x0129('0x3a')]=_[_0x0129('0x3b')](_0x30c2dc[_0x0129('0x3a')]);_0x44ff74[_0x0129('0x43')]=_[_0x0129('0x3d')](_0x44ff74['model'],_0x44ff74[_0x0129('0x3a')]);_0x3e3a19[_0x0129('0x3c')]=_[_0x0129('0x3d')](_0x44ff74[_0x0129('0x39')],qs['fields'](_0x30c2dc[_0x0129('0x3a')]['fields']));_0x3e3a19[_0x0129('0x3c')]=_0x3e3a19['attributes'][_0x0129('0x4e')]?_0x3e3a19[_0x0129('0x3c')]:_0x44ff74[_0x0129('0x39')];_0x3e3a19['order']=qs[_0x0129('0x61')](_0x30c2dc[_0x0129('0x3a')]['sort']);_0x3e3a19['where']=qs[_0x0129('0x43')](_['pick'](_0x30c2dc['query'],_0x44ff74['filters']));if(_0x30c2dc[_0x0129('0x3a')][_0x0129('0x2a')]){_0x3e3a19[_0x0129('0x42')]=_[_0x0129('0x45')](_0x3e3a19['where'],{'$or':_['map'](_0x3e3a19[_0x0129('0x3c')],function(_0x3d0a88){var _0x569f27={};_0x569f27[_0x3d0a88]={'$like':'%'+_0x30c2dc[_0x0129('0x3a')][_0x0129('0x2a')]+'%'};return _0x569f27;})});}_0x3e3a19=_[_0x0129('0x45')]({},_0x3e3a19,_0x30c2dc['options']);return _0x47842e['getBlackLists'](_0x3e3a19);}})['then'](function(_0x4a29cd){if(_0x4a29cd){_0x1ab434=_0x4a29cd[_0x0129('0x4e')];if(!_0x30c2dc['query'][_0x0129('0x3f')](_0x0129('0x40'))){_0x3e3a19[_0x0129('0x1f')]=qs['limit'](_0x30c2dc[_0x0129('0x3a')][_0x0129('0x1f')]);_0x3e3a19[_0x0129('0x1e')]=qs[_0x0129('0x1e')](_0x30c2dc[_0x0129('0x3a')][_0x0129('0x1e')]);}return _0x47842e[_0x0129('0xb8')](_0x3e3a19);}})['then'](function(_0x1ff2b1){if(_0x1ff2b1){return _0x1ff2b1?{'count':_0x1ab434,'rows':_0x1ff2b1}:null;}})['then'](respondWithResult(_0x3c6171,null))['catch'](handleError(_0x3c6171,null));};exports[_0x0129('0xb9')]=function(_0xa042dc,_0x41512c,_0x1f5d47){var _0x4be562,_0x323a82;return db[_0x0129('0x36')][_0x0129('0x2f')]({'where':{'id':_0xa042dc[_0x0129('0x4c')]['id']}})[_0x0129('0x26')](handleEntityNotFound(_0x41512c,null))[_0x0129('0x26')](function(_0x2f8285){if(_0x2f8285){_0x323a82=_0x2f8285;return _0x2f8285[_0x0129('0xb9')](_0xa042dc[_0x0129('0x50')]['ids'],_[_0x0129('0xa0')](_0xa042dc[_0x0129('0x50')],[_0x0129('0x82'),'id'])||{});}return null;})['spread'](function(_0x542a97){var _0x55dcad;_0x4be562=_0x542a97||[];var _0x23de42=[];if(_0x542a97){for(var _0xa07b5b=0x0;_0xa07b5b<_0x542a97[_0x0129('0x4e')];_0xa07b5b+=0x1){var _0x225757=_0x542a97[_0xa07b5b][_0x0129('0x27')]({'plain':!![]});_0x55dcad=squel['insert']()[_0x0129('0xb3')](_0x0129('0xba'))['fromQuery'](['phone',_0x0129('0xb5'),_0x0129('0xa5'),'VoiceQueueId',_0x0129('0x5a'),_0x0129('0x5b')],squel[_0x0129('0x83')]()[_0x0129('0x84')]('phone','phone')['field']('id','ContactId')[_0x0129('0x84')](_0x225757[_0x0129('0xa8')][_0x0129('0xa9')](),_0x0129('0xa5'))[_0x0129('0x84')](_0xa042dc['params']['id']['toString'](),_0x0129('0x62'))['field'](_0x0129('0xa7'),'createdAt')['field'](_0x0129('0xa7'),_0x0129('0x5b'))['from'](_0x0129('0xaa'))['where'](_0x0129('0xb6'))[_0x0129('0x42')](_0x0129('0xab'),_0x225757[_0x0129('0xa8')]['toString']())[_0x0129('0x42')](_0x0129('0xac')))[_0x0129('0xa9')]();_0x23de42[_0x0129('0x8c')](db['sequelize'][_0x0129('0x3a')](_0x55dcad));}return BPromise[_0x0129('0x91')](_0x23de42);}})[_0x0129('0x26')](function(){return _0x4be562;})['then'](respondWithResult(_0x41512c,null))['catch'](handleError(_0x41512c,null));};exports[_0x0129('0xbb')]=function(_0x227c4a,_0x3a944f,_0x311a60){return db[_0x0129('0x36')][_0x0129('0x2f')]({'where':{'id':_0x227c4a[_0x0129('0x4c')]['id']}})[_0x0129('0x26')](handleEntityNotFound(_0x3a944f,null))[_0x0129('0x26')](function(_0x40bae3){if(_0x40bae3){return _0x40bae3['removeBlackLists'](_0x227c4a['query'][_0x0129('0x82')]);}})['then'](function(_0x1f32d8){if(_0x1f32d8){return db[_0x0129('0x69')]['destroy']({'where':{'ListId':_0x227c4a[_0x0129('0x3a')][_0x0129('0x82')],'VoiceQueueId':_0x227c4a[_0x0129('0x4c')]['id']}})['then'](function(){return _0x1f32d8;});}})[_0x0129('0x26')](respondWithStatusCode(_0x3a944f,null))[_0x0129('0x4a')](handleError(_0x3a944f,null));}; \ No newline at end of file +var _0x4c60=['ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','insert','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','removeBlackLists','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/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','count','set','apply','reject','save','update','destroy','then','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map','value','includes','type','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','fieldName','key','model','keys','query','attributes','fields','nolimit','offset','sort','where','filters','merge','VIRTUAL','includeAll','include','findAll','catch','show','intersection','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','clone','params','options','omit','createdAt','updatedAt','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','hasOwnProperty','limit','order','VoiceQueueId','rows','getHopperHistories','CmHopperHistory','pick','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','teams','User','online','voicePause','Agents','forEach','penalty','sequelize','transaction','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','isNil','interface','format','emit','userVoiceQueue:save','Team','ids','select','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','SIP/%s','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','ContactId','NOW()','scheduledAt','field','CmListId','ListId','cm_contacts','deletedAt\x20IS\x20NULL'];(function(_0xd39330,_0x1d3d72){var _0x1d2c5d=function(_0x316fe2){while(--_0x316fe2){_0xd39330['push'](_0xd39330['shift']());}};_0x1d2c5d(++_0x1d3d72);}(_0x4c60,0xc1));var _0x04c6=function(_0x545bcd,_0x1d91c7){_0x545bcd=_0x545bcd-0x0;var _0x39569e=_0x4c60[_0x545bcd];return _0x39569e;};'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 hardwareService=require('../../config/license/hardware');var logger=require(_0x04c6('0x10'))(_0x04c6('0x11'));var utils=require('../../config/utils');var config=require(_0x04c6('0x12'));var licenseUtil=require(_0x04c6('0x13'));var db=require(_0x04c6('0x14'))['db'];config[_0x04c6('0x15')]=_['defaults'](config[_0x04c6('0x15')],{'host':_0x04c6('0x16'),'port':0x18eb});var socket=require(_0x04c6('0x17'))(new Redis(config['redis']));require(_0x04c6('0x18'))[_0x04c6('0x19')](socket);function respondWithStatusCode(_0x28632e,_0x3e80a6){_0x3e80a6=_0x3e80a6||0xcc;return function(_0x4760f8){if(_0x4760f8){return _0x28632e[_0x04c6('0x1a')](_0x3e80a6);}return _0x28632e[_0x04c6('0x1b')](_0x3e80a6)[_0x04c6('0x1c')]();};}function respondWithResult(_0x5a5a66,_0x31edf9){_0x31edf9=_0x31edf9||0xc8;return function(_0xa2bc92){if(_0xa2bc92){return _0x5a5a66[_0x04c6('0x1b')](_0x31edf9)[_0x04c6('0x1d')](_0xa2bc92);}};}function respondWithFilteredResult(_0x43596a,_0xfb4db5){return function(_0x21674a){if(_0x21674a){var _0x423ea9=_0x21674a[_0x04c6('0x1e')],_0x47f400=_0xfb4db5['offset'],_0x142065=_0xfb4db5['offset']+_0xfb4db5['limit'],_0x13e472;if(_0x142065>=_0x423ea9){_0x142065=_0x423ea9;_0x13e472=0xc8;}else{_0x13e472=0xce;}_0x43596a[_0x04c6('0x1b')](_0x13e472);return _0x43596a[_0x04c6('0x1f')]('Content-Range',_0x47f400+'-'+_0x142065+'/'+_0x423ea9)['json'](_0x21674a);}return null;};}function patchUpdates(_0x1e6854){return function(_0x2eed94){try{jsonpatch[_0x04c6('0x20')](_0x2eed94,_0x1e6854,!![]);}catch(_0x5daa22){return BPromise[_0x04c6('0x21')](_0x5daa22);}return _0x2eed94[_0x04c6('0x22')]();};}function saveUpdates(_0x9d41f8,_0x49c179){return function(_0x2d3277){if(_0x2d3277){return _0x2d3277[_0x04c6('0x23')](_0x9d41f8)['then'](function(_0x54a8b0){return _0x54a8b0;});}return null;};}function removeEntity(_0x4c8d72,_0x348ea3){return function(_0x3a2014){if(_0x3a2014){return _0x3a2014[_0x04c6('0x24')]()[_0x04c6('0x25')](function(){var _0x3e1328=_0x3a2014['get']({'plain':!![]});var _0x562952=[{'name':_0x04c6('0x26'),'value':_0x04c6('0x27'),'ignore':![]},{'name':_0x04c6('0x28'),'value':_0x04c6('0x29'),'ignore':![]}];var _0x4f256f=_(_0x562952)[_0x04c6('0x2a')]('ignore')[_0x04c6('0x2b')](_0x04c6('0x2c'))['value']();if(_[_0x04c6('0x2d')](_0x4f256f,_0x3e1328[_0x04c6('0x2e')])){return;}var _0x5f1331=_['find'](_0x562952,[_0x04c6('0x2c'),_0x3e1328[_0x04c6('0x2e')]])[_0x04c6('0x2f')];return db[_0x04c6('0x30')][_0x04c6('0x24')]({'where':{'type':_0x5f1331,'resourceId':_0x3e1328['id']}})[_0x04c6('0x25')](function(){return _0x3a2014;});})['then'](function(){_0x4c8d72['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x375a03,_0x5241b5){return function(_0x1e76e2){if(!_0x1e76e2){_0x375a03[_0x04c6('0x1a')](0x194);}return _0x1e76e2;};}function handleError(_0x5ea4ea,_0x437bfc){_0x437bfc=_0x437bfc||0x1f4;return function(_0x36f2af){logger[_0x04c6('0x31')](_0x36f2af[_0x04c6('0x32')]);if(_0x36f2af['name']){delete _0x36f2af[_0x04c6('0x2f')];}_0x5ea4ea[_0x04c6('0x1b')](_0x437bfc)[_0x04c6('0x33')](_0x36f2af);};}exports[_0x04c6('0x34')]=function(_0x3762af,_0x902e66){var _0x3e59b2={},_0x46380e={},_0x19a05b={'count':0x0,'rows':[]};var _0xca0b8f=_[_0x04c6('0x2b')](db[_0x04c6('0x35')][_0x04c6('0x36')],function(_0x3d56ea){return{'name':_0x3d56ea[_0x04c6('0x37')],'type':_0x3d56ea['type'][_0x04c6('0x38')]};});_0x46380e[_0x04c6('0x39')]=_[_0x04c6('0x2b')](_0xca0b8f,_0x04c6('0x2f'));_0x46380e['query']=_[_0x04c6('0x3a')](_0x3762af[_0x04c6('0x3b')]);_0x46380e['filters']=_['intersection'](_0x46380e['model'],_0x46380e[_0x04c6('0x3b')]);_0x3e59b2[_0x04c6('0x3c')]=_['intersection'](_0x46380e[_0x04c6('0x39')],qs['fields'](_0x3762af[_0x04c6('0x3b')][_0x04c6('0x3d')]));_0x3e59b2[_0x04c6('0x3c')]=_0x3e59b2[_0x04c6('0x3c')]['length']?_0x3e59b2['attributes']:_0x46380e[_0x04c6('0x39')];if(!_0x3762af[_0x04c6('0x3b')]['hasOwnProperty'](_0x04c6('0x3e'))){_0x3e59b2['limit']=qs['limit'](_0x3762af[_0x04c6('0x3b')]['limit']);_0x3e59b2[_0x04c6('0x3f')]=qs[_0x04c6('0x3f')](_0x3762af['query'][_0x04c6('0x3f')]);}_0x3e59b2['order']=qs[_0x04c6('0x40')](_0x3762af[_0x04c6('0x3b')][_0x04c6('0x40')]);_0x3e59b2[_0x04c6('0x41')]=qs[_0x04c6('0x42')](_['pick'](_0x3762af[_0x04c6('0x3b')],_0x46380e['filters']),_0xca0b8f);if(_0x3762af[_0x04c6('0x3b')]['filter']){_0x3e59b2[_0x04c6('0x41')]=_[_0x04c6('0x43')](_0x3e59b2[_0x04c6('0x41')],{'$or':_[_0x04c6('0x2b')](_0xca0b8f,function(_0xe6012e){if(_0xe6012e[_0x04c6('0x2e')]!==_0x04c6('0x44')){var _0x4a3c45={};_0x4a3c45[_0xe6012e[_0x04c6('0x2f')]]={'$like':'%'+_0x3762af['query'][_0x04c6('0x2a')]+'%'};return _0x4a3c45;}})});}_0x3e59b2=_['merge']({},_0x3e59b2,_0x3762af['options']);var _0x463222={'where':_0x3e59b2['where']};return db[_0x04c6('0x35')][_0x04c6('0x1e')](_0x463222)[_0x04c6('0x25')](function(_0x599682){_0x19a05b[_0x04c6('0x1e')]=_0x599682;if(_0x3762af[_0x04c6('0x3b')][_0x04c6('0x45')]){_0x3e59b2[_0x04c6('0x46')]=[{'all':!![]}];}return db[_0x04c6('0x35')][_0x04c6('0x47')](_0x3e59b2);})[_0x04c6('0x25')](function(_0x5a2d24){_0x19a05b['rows']=_0x5a2d24;return _0x19a05b;})[_0x04c6('0x25')](respondWithFilteredResult(_0x902e66,_0x3e59b2))[_0x04c6('0x48')](handleError(_0x902e66,null));};exports[_0x04c6('0x49')]=function(_0x5d6726,_0x46164a){var _0xe473b9={'raw':![],'where':{'id':_0x5d6726['params']['id']}},_0x259508={};_0x259508['model']=_['keys'](db[_0x04c6('0x35')][_0x04c6('0x36')]);_0x259508['query']=_[_0x04c6('0x3a')](_0x5d6726[_0x04c6('0x3b')]);_0x259508[_0x04c6('0x42')]=_['intersection'](_0x259508[_0x04c6('0x39')],_0x259508[_0x04c6('0x3b')]);_0xe473b9['attributes']=_[_0x04c6('0x4a')](_0x259508[_0x04c6('0x39')],qs[_0x04c6('0x3d')](_0x5d6726[_0x04c6('0x3b')]['fields']));_0xe473b9[_0x04c6('0x3c')]=_0xe473b9[_0x04c6('0x3c')][_0x04c6('0x4b')]?_0xe473b9[_0x04c6('0x3c')]:_0x259508['model'];if(_0x5d6726[_0x04c6('0x3b')][_0x04c6('0x45')]){_0xe473b9[_0x04c6('0x46')]=[{'all':!![]}];}_0xe473b9=_[_0x04c6('0x43')]({},_0xe473b9,_0x5d6726['options']);return db[_0x04c6('0x35')][_0x04c6('0x4c')](_0xe473b9)[_0x04c6('0x25')](handleEntityNotFound(_0x46164a,null))['then'](respondWithResult(_0x46164a,null))[_0x04c6('0x48')](handleError(_0x46164a,null));};exports[_0x04c6('0x4d')]=function(_0x2a342c,_0xd31976){return db[_0x04c6('0x35')][_0x04c6('0x4d')](_0x2a342c[_0x04c6('0x4e')],{})[_0x04c6('0x25')](function(_0x623acf){var _0x12f2c6=_0x2a342c[_0x04c6('0x4f')][_0x04c6('0x50')]({'plain':!![]});if(!_0x12f2c6)throw new Error(_0x04c6('0x51'));if(_0x12f2c6['role']===_0x04c6('0x4f')){var _0x394237=_0x623acf[_0x04c6('0x50')]({'plain':!![]});var _0xa0284e=[{'name':_0x04c6('0x26'),'value':'inbound'},{'name':_0x04c6('0x28'),'value':_0x04c6('0x29')}];var _0xc29082=_[_0x04c6('0x4c')](_0xa0284e,[_0x04c6('0x2c'),_0x394237[_0x04c6('0x2e')]])[_0x04c6('0x2f')];return db[_0x04c6('0x52')][_0x04c6('0x4c')]({'where':{'name':_0xc29082,'userProfileId':_0x12f2c6[_0x04c6('0x53')]},'raw':!![]})['then'](function(_0x594c06){if(_0x594c06&&_0x594c06['autoAssociation']===0x0){return db['UserProfileResource'][_0x04c6('0x4d')]({'name':_0x394237['name'],'resourceId':_0x394237['id'],'type':_0x594c06[_0x04c6('0x2f')],'sectionId':_0x594c06['id']},{})['then'](function(){return _0x623acf;});}else{return _0x623acf;}})[_0x04c6('0x48')](function(_0x141c13){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x141c13);throw _0x141c13;});}return _0x623acf;})[_0x04c6('0x25')](respondWithResult(_0xd31976,0xc9))[_0x04c6('0x48')](handleError(_0xd31976,null));};exports[_0x04c6('0x54')]=function(_0x2e54e5,_0x583b3c){var _0x2fb324={'where':{'id':_0x2e54e5[_0x04c6('0x55')]['id']}},_0xf4e9d6={};_0xf4e9d6[_0x04c6('0x39')]=_[_0x04c6('0x3a')](db[_0x04c6('0x35')][_0x04c6('0x36')]);_0x2fb324['attributes']=_[_0x04c6('0x4a')](_0xf4e9d6['model'],qs[_0x04c6('0x3d')](_0x2e54e5[_0x04c6('0x3b')]['fields']));_0x2fb324[_0x04c6('0x3c')]=_0x2fb324[_0x04c6('0x3c')][_0x04c6('0x4b')]?_0x2fb324[_0x04c6('0x3c')]:_0xf4e9d6[_0x04c6('0x39')];if(_0x2e54e5[_0x04c6('0x3b')][_0x04c6('0x45')]){_0x2fb324[_0x04c6('0x46')]=[{'all':!![]}];}_0x2fb324=_['merge']({},_0x2fb324,_0x2e54e5[_0x04c6('0x56')]);return db['VoiceQueue'][_0x04c6('0x4c')](_0x2fb324)[_0x04c6('0x25')](handleEntityNotFound(_0x583b3c,null))['then'](function(_0x503426){if(_0x503426){var _0x2e649d=_0x503426['get']({'plain':!![]});_0x2e649d=qs[_0x04c6('0x57')](_0x2e649d,['id',_0x04c6('0x58'),'updatedAt']);_0x2e54e5[_0x04c6('0x4e')]=_[_0x04c6('0x57')](_0x2e54e5[_0x04c6('0x4e')],['id',_0x04c6('0x58'),_0x04c6('0x59')]);return db[_0x04c6('0x35')][_0x04c6('0x4d')](_[_0x04c6('0x43')](_0x2e649d,_0x2e54e5[_0x04c6('0x4e')]),{'include':_0x2e54e5[_0x04c6('0x3b')][_0x04c6('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x3aaa1e){var _0x1492d0=_0x2e54e5[_0x04c6('0x4f')][_0x04c6('0x50')]({'plain':!![]});if(!_0x1492d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1492d0[_0x04c6('0x5a')]===_0x04c6('0x4f')){var _0x1b38d1=_0x3aaa1e['get']({'plain':!![]});var _0x563862=[{'name':_0x04c6('0x26'),'value':_0x04c6('0x27')},{'name':_0x04c6('0x28'),'value':_0x04c6('0x29')}];var _0x38d3c6=_[_0x04c6('0x4c')](_0x563862,['value',_0x1b38d1[_0x04c6('0x2e')]])[_0x04c6('0x2f')];return db[_0x04c6('0x52')]['find']({'where':{'name':_0x38d3c6,'userProfileId':_0x1492d0['userProfileId']},'raw':!![]})[_0x04c6('0x25')](function(_0x2ebe17){if(_0x2ebe17&&_0x2ebe17[_0x04c6('0x5b')]===0x0){return db[_0x04c6('0x30')]['create']({'name':_0x1b38d1[_0x04c6('0x2f')],'resourceId':_0x1b38d1['id'],'type':_0x2ebe17['name'],'sectionId':_0x2ebe17['id']},{})['then'](function(){return _0x3aaa1e;});}else{return _0x3aaa1e;}})[_0x04c6('0x48')](function(_0xe178dd){logger[_0x04c6('0x31')](_0x04c6('0x5c'),_0xe178dd);throw _0xe178dd;});}return _0x3aaa1e;});}})[_0x04c6('0x25')](respondWithResult(_0x583b3c,0xc9))[_0x04c6('0x48')](handleError(_0x583b3c,null));};exports[_0x04c6('0x23')]=function(_0x49eac3,_0x31cc93){if(_0x49eac3[_0x04c6('0x4e')]['id']){delete _0x49eac3[_0x04c6('0x4e')]['id'];}return db[_0x04c6('0x35')][_0x04c6('0x4c')]({'where':{'id':_0x49eac3['params']['id']}})['then'](handleEntityNotFound(_0x31cc93,null))[_0x04c6('0x25')](saveUpdates(_0x49eac3[_0x04c6('0x4e')],null))[_0x04c6('0x25')](respondWithResult(_0x31cc93,null))['catch'](handleError(_0x31cc93,null));};exports[_0x04c6('0x24')]=function(_0x467f3b,_0x4c9507){return db[_0x04c6('0x35')][_0x04c6('0x4c')]({'where':{'id':_0x467f3b[_0x04c6('0x55')]['id']}})[_0x04c6('0x25')](handleEntityNotFound(_0x4c9507,null))[_0x04c6('0x25')](removeEntity(_0x4c9507,null))[_0x04c6('0x48')](handleError(_0x4c9507,null));};exports[_0x04c6('0x5d')]=function(_0x1a2365,_0x22ae65,_0x3552cd){var _0x2d7ecc={'raw':![],'where':{}};var _0x384018={};var _0x38900b={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x04c6('0x5e')]({'where':{'id':_0x1a2365[_0x04c6('0x55')]['id']}})['then'](handleEntityNotFound(_0x22ae65,null))[_0x04c6('0x25')](function(_0x285dd1){if(_0x285dd1){_0x384018[_0x04c6('0x39')]=_[_0x04c6('0x3a')](db[_0x04c6('0x5f')]['rawAttributes']);_0x384018[_0x04c6('0x3b')]=_['keys'](_0x1a2365[_0x04c6('0x3b')]);_0x384018['filters']=_[_0x04c6('0x4a')](_0x384018[_0x04c6('0x39')],_0x384018[_0x04c6('0x3b')]);_0x2d7ecc[_0x04c6('0x3c')]=_[_0x04c6('0x4a')](_0x384018[_0x04c6('0x39')],qs[_0x04c6('0x3d')](_0x1a2365[_0x04c6('0x3b')][_0x04c6('0x3d')]));_0x2d7ecc['attributes']=_0x2d7ecc[_0x04c6('0x3c')][_0x04c6('0x4b')]?_0x2d7ecc['attributes']:_0x384018[_0x04c6('0x39')];if(!_0x1a2365['query'][_0x04c6('0x60')](_0x04c6('0x3e'))){_0x2d7ecc['limit']=qs[_0x04c6('0x61')](_0x1a2365[_0x04c6('0x3b')]['limit']);_0x2d7ecc[_0x04c6('0x3f')]=qs[_0x04c6('0x3f')](_0x1a2365['query'][_0x04c6('0x3f')]);}_0x2d7ecc[_0x04c6('0x62')]=qs['sort'](_0x1a2365[_0x04c6('0x3b')][_0x04c6('0x40')]);_0x2d7ecc['where']=qs['filters'](_['pick'](_0x1a2365[_0x04c6('0x3b')],_0x384018[_0x04c6('0x42')]));_0x2d7ecc[_0x04c6('0x41')][_0x04c6('0x63')]=_0x285dd1['id'];if(_0x1a2365[_0x04c6('0x3b')]['filter']){_0x2d7ecc[_0x04c6('0x41')]=_[_0x04c6('0x43')](_0x2d7ecc[_0x04c6('0x41')],{'$or':_[_0x04c6('0x2b')](_0x2d7ecc[_0x04c6('0x3c')],function(_0x57e90a){var _0x1c600b={};_0x1c600b[_0x57e90a]={'$like':'%'+_0x1a2365['query'][_0x04c6('0x2a')]+'%'};return _0x1c600b;})});}_0x2d7ecc=_['merge']({},_0x2d7ecc,_0x1a2365[_0x04c6('0x56')]);return db['CmHopper']['count']({'where':_0x2d7ecc[_0x04c6('0x41')]})['then'](function(_0x34f705){_0x38900b[_0x04c6('0x1e')]=_0x34f705;if(_0x1a2365[_0x04c6('0x3b')][_0x04c6('0x45')]){_0x2d7ecc[_0x04c6('0x46')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x2d7ecc);})[_0x04c6('0x25')](function(_0x14be40){_0x38900b[_0x04c6('0x64')]=_0x14be40;return _0x38900b;});}})[_0x04c6('0x25')](respondWithFilteredResult(_0x22ae65,_0x2d7ecc))[_0x04c6('0x48')](handleError(_0x22ae65,null));};exports[_0x04c6('0x65')]=function(_0x541f14,_0x1a9a95,_0x4c3f9e){var _0x5e403d={'raw':!![],'where':{}};var _0x866f47={};var _0x466cd9={'count':0x0,'rows':[]};return db[_0x04c6('0x35')][_0x04c6('0x5e')]({'where':{'id':_0x541f14[_0x04c6('0x55')]['id']}})[_0x04c6('0x25')](handleEntityNotFound(_0x1a9a95,null))[_0x04c6('0x25')](function(_0x243553){if(_0x243553){_0x866f47[_0x04c6('0x39')]=_[_0x04c6('0x3a')](db[_0x04c6('0x66')]['rawAttributes']);_0x866f47[_0x04c6('0x3b')]=_['keys'](_0x541f14['query']);_0x866f47[_0x04c6('0x42')]=_[_0x04c6('0x4a')](_0x866f47[_0x04c6('0x39')],_0x866f47[_0x04c6('0x3b')]);_0x5e403d[_0x04c6('0x3c')]=_[_0x04c6('0x4a')](_0x866f47[_0x04c6('0x39')],qs[_0x04c6('0x3d')](_0x541f14[_0x04c6('0x3b')][_0x04c6('0x3d')]));_0x5e403d[_0x04c6('0x3c')]=_0x5e403d['attributes']['length']?_0x5e403d[_0x04c6('0x3c')]:_0x866f47[_0x04c6('0x39')];if(!_0x541f14['query'][_0x04c6('0x60')](_0x04c6('0x3e'))){_0x5e403d['limit']=qs[_0x04c6('0x61')](_0x541f14[_0x04c6('0x3b')][_0x04c6('0x61')]);_0x5e403d[_0x04c6('0x3f')]=qs[_0x04c6('0x3f')](_0x541f14[_0x04c6('0x3b')][_0x04c6('0x3f')]);}_0x5e403d[_0x04c6('0x62')]=qs['sort'](_0x541f14[_0x04c6('0x3b')]['sort']);_0x5e403d[_0x04c6('0x41')]=qs[_0x04c6('0x42')](_[_0x04c6('0x67')](_0x541f14[_0x04c6('0x3b')],_0x866f47[_0x04c6('0x42')]));_0x5e403d[_0x04c6('0x41')]['VoiceQueueId']=_0x243553['id'];if(_0x541f14[_0x04c6('0x3b')][_0x04c6('0x2a')]){_0x5e403d[_0x04c6('0x41')]=_['merge'](_0x5e403d['where'],{'$or':_['map'](_0x5e403d[_0x04c6('0x3c')],function(_0x181268){var _0x47f933={};_0x47f933[_0x181268]={'$like':'%'+_0x541f14[_0x04c6('0x3b')][_0x04c6('0x2a')]+'%'};return _0x47f933;})});}_0x5e403d=_[_0x04c6('0x43')]({},_0x5e403d,_0x541f14['options']);return db[_0x04c6('0x66')]['count']({'where':_0x5e403d[_0x04c6('0x41')]})[_0x04c6('0x25')](function(_0x13ddf2){_0x466cd9['count']=_0x13ddf2;if(_0x541f14['query'][_0x04c6('0x45')]){_0x5e403d[_0x04c6('0x46')]=[{'all':!![]}];}return db[_0x04c6('0x66')][_0x04c6('0x47')](_0x5e403d);})['then'](function(_0x58c790){_0x466cd9[_0x04c6('0x64')]=_0x58c790;return _0x466cd9;});}})[_0x04c6('0x25')](respondWithFilteredResult(_0x1a9a95,_0x5e403d))[_0x04c6('0x48')](handleError(_0x1a9a95,null));};exports['getHopperFinals']=function(_0x2c1536,_0xe08ff4,_0x2dd699){var _0x3bfef2={'raw':!![],'where':{}};var _0x49f1e0={};var _0x1af683={'count':0x0,'rows':[]};return db[_0x04c6('0x35')][_0x04c6('0x5e')]({'where':{'id':_0x2c1536[_0x04c6('0x55')]['id']}})[_0x04c6('0x25')](handleEntityNotFound(_0xe08ff4,null))['then'](function(_0x14ce9e){if(_0x14ce9e){_0x49f1e0[_0x04c6('0x39')]=_[_0x04c6('0x3a')](db[_0x04c6('0x68')][_0x04c6('0x36')]);_0x49f1e0[_0x04c6('0x3b')]=_[_0x04c6('0x3a')](_0x2c1536['query']);_0x49f1e0[_0x04c6('0x42')]=_[_0x04c6('0x4a')](_0x49f1e0[_0x04c6('0x39')],_0x49f1e0[_0x04c6('0x3b')]);_0x3bfef2[_0x04c6('0x3c')]=_[_0x04c6('0x4a')](_0x49f1e0[_0x04c6('0x39')],qs[_0x04c6('0x3d')](_0x2c1536['query'][_0x04c6('0x3d')]));_0x3bfef2[_0x04c6('0x3c')]=_0x3bfef2['attributes'][_0x04c6('0x4b')]?_0x3bfef2[_0x04c6('0x3c')]:_0x49f1e0[_0x04c6('0x39')];if(!_0x2c1536[_0x04c6('0x3b')][_0x04c6('0x60')]('nolimit')){_0x3bfef2['limit']=qs[_0x04c6('0x61')](_0x2c1536[_0x04c6('0x3b')][_0x04c6('0x61')]);_0x3bfef2['offset']=qs[_0x04c6('0x3f')](_0x2c1536[_0x04c6('0x3b')]['offset']);}_0x3bfef2['order']=qs[_0x04c6('0x40')](_0x2c1536[_0x04c6('0x3b')]['sort']);_0x3bfef2[_0x04c6('0x41')]=qs[_0x04c6('0x42')](_[_0x04c6('0x67')](_0x2c1536[_0x04c6('0x3b')],_0x49f1e0['filters']));_0x3bfef2[_0x04c6('0x41')][_0x04c6('0x63')]=_0x14ce9e['id'];if(_0x2c1536[_0x04c6('0x3b')][_0x04c6('0x2a')]){_0x3bfef2[_0x04c6('0x41')]=_[_0x04c6('0x43')](_0x3bfef2['where'],{'$or':_[_0x04c6('0x2b')](_0x3bfef2[_0x04c6('0x3c')],function(_0x42b3ed){var _0x3a9695={};_0x3a9695[_0x42b3ed]={'$like':'%'+_0x2c1536[_0x04c6('0x3b')][_0x04c6('0x2a')]+'%'};return _0x3a9695;})});}_0x3bfef2=_[_0x04c6('0x43')]({},_0x3bfef2,_0x2c1536[_0x04c6('0x56')]);return db['CmHopperFinal']['count']({'where':_0x3bfef2[_0x04c6('0x41')]})[_0x04c6('0x25')](function(_0x9522ff){_0x1af683['count']=_0x9522ff;if(_0x2c1536[_0x04c6('0x3b')][_0x04c6('0x45')]){_0x3bfef2[_0x04c6('0x46')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x3bfef2);})[_0x04c6('0x25')](function(_0x32c577){_0x1af683[_0x04c6('0x64')]=_0x32c577;return _0x1af683;});}})[_0x04c6('0x25')](respondWithFilteredResult(_0xe08ff4,_0x3bfef2))[_0x04c6('0x48')](handleError(_0xe08ff4,null));};exports[_0x04c6('0x69')]=function(_0x5d521b,_0x52417e,_0x596ac3){var _0x239dda={'raw':!![],'where':{}};var _0x531c75={};var _0x5ef91d={'count':0x0,'rows':[]};return db[_0x04c6('0x35')][_0x04c6('0x5e')]({'where':{'id':_0x5d521b[_0x04c6('0x55')]['id']}})['then'](handleEntityNotFound(_0x52417e,null))[_0x04c6('0x25')](function(_0x312efd){if(_0x312efd){_0x531c75[_0x04c6('0x39')]=_[_0x04c6('0x3a')](db['CmHopperBlack']['rawAttributes']);_0x531c75['query']=_[_0x04c6('0x3a')](_0x5d521b[_0x04c6('0x3b')]);_0x531c75['filters']=_['intersection'](_0x531c75['model'],_0x531c75[_0x04c6('0x3b')]);_0x239dda['attributes']=_[_0x04c6('0x4a')](_0x531c75[_0x04c6('0x39')],qs[_0x04c6('0x3d')](_0x5d521b[_0x04c6('0x3b')][_0x04c6('0x3d')]));_0x239dda[_0x04c6('0x3c')]=_0x239dda['attributes'][_0x04c6('0x4b')]?_0x239dda[_0x04c6('0x3c')]:_0x531c75[_0x04c6('0x39')];if(!_0x5d521b[_0x04c6('0x3b')][_0x04c6('0x60')]('nolimit')){_0x239dda[_0x04c6('0x61')]=qs[_0x04c6('0x61')](_0x5d521b[_0x04c6('0x3b')]['limit']);_0x239dda[_0x04c6('0x3f')]=qs[_0x04c6('0x3f')](_0x5d521b[_0x04c6('0x3b')]['offset']);}_0x239dda[_0x04c6('0x62')]=qs[_0x04c6('0x40')](_0x5d521b[_0x04c6('0x3b')][_0x04c6('0x40')]);_0x239dda[_0x04c6('0x41')]=qs[_0x04c6('0x42')](_[_0x04c6('0x67')](_0x5d521b[_0x04c6('0x3b')],_0x531c75['filters']));_0x239dda[_0x04c6('0x41')][_0x04c6('0x63')]=_0x312efd['id'];if(_0x5d521b[_0x04c6('0x3b')]['filter']){_0x239dda['where']=_['merge'](_0x239dda[_0x04c6('0x41')],{'$or':_[_0x04c6('0x2b')](_0x239dda[_0x04c6('0x3c')],function(_0x579168){var _0x1d83a3={};_0x1d83a3[_0x579168]={'$like':'%'+_0x5d521b[_0x04c6('0x3b')][_0x04c6('0x2a')]+'%'};return _0x1d83a3;})});}_0x239dda=_[_0x04c6('0x43')]({},_0x239dda,_0x5d521b['options']);return db[_0x04c6('0x6a')][_0x04c6('0x1e')]({'where':_0x239dda[_0x04c6('0x41')]})[_0x04c6('0x25')](function(_0x51a123){_0x5ef91d[_0x04c6('0x1e')]=_0x51a123;if(_0x5d521b['query'][_0x04c6('0x45')]){_0x239dda[_0x04c6('0x46')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x04c6('0x47')](_0x239dda);})[_0x04c6('0x25')](function(_0x46a009){_0x5ef91d['rows']=_0x46a009;return _0x5ef91d;});}})[_0x04c6('0x25')](respondWithFilteredResult(_0x52417e,_0x239dda))[_0x04c6('0x48')](handleError(_0x52417e,null));};exports[_0x04c6('0x6b')]=function(_0x4fb402,_0x1884ce,_0x2c51eb){var _0x5b0859={};var _0x493fe1={};var _0x487c2a;var _0x523f48;return db[_0x04c6('0x35')][_0x04c6('0x5e')]({'where':{'id':_0x4fb402['params']['id']}})[_0x04c6('0x25')](handleEntityNotFound(_0x1884ce,null))[_0x04c6('0x25')](function(_0x527bf1){if(_0x527bf1){_0x487c2a=_0x527bf1;_0x493fe1[_0x04c6('0x39')]=_[_0x04c6('0x3a')](db['Team'][_0x04c6('0x36')]);_0x493fe1[_0x04c6('0x3b')]=_[_0x04c6('0x3a')](_0x4fb402['query']);_0x493fe1['filters']=_['intersection'](_0x493fe1[_0x04c6('0x39')],_0x493fe1[_0x04c6('0x3b')]);_0x5b0859[_0x04c6('0x3c')]=_['intersection'](_0x493fe1['model'],qs['fields'](_0x4fb402[_0x04c6('0x3b')]['fields']));_0x5b0859['attributes']=_0x5b0859[_0x04c6('0x3c')]['length']?_0x5b0859[_0x04c6('0x3c')]:_0x493fe1[_0x04c6('0x39')];_0x5b0859[_0x04c6('0x62')]=qs[_0x04c6('0x40')](_0x4fb402[_0x04c6('0x3b')]['sort']);_0x5b0859['where']=qs[_0x04c6('0x42')](_[_0x04c6('0x67')](_0x4fb402[_0x04c6('0x3b')],_0x493fe1[_0x04c6('0x42')]));if(_0x4fb402[_0x04c6('0x3b')][_0x04c6('0x2a')]){_0x5b0859['where']=_['merge'](_0x5b0859[_0x04c6('0x41')],{'$or':_[_0x04c6('0x2b')](_0x5b0859['attributes'],function(_0x2c0c74){var _0x4d16fe={};_0x4d16fe[_0x2c0c74]={'$like':'%'+_0x4fb402['query'][_0x04c6('0x2a')]+'%'};return _0x4d16fe;})});}_0x5b0859=_[_0x04c6('0x43')]({},_0x5b0859,_0x4fb402['options']);return _0x487c2a[_0x04c6('0x6b')](_0x5b0859);}})[_0x04c6('0x25')](function(_0x389dd3){if(_0x389dd3){_0x523f48=_0x389dd3['length'];if(!_0x4fb402[_0x04c6('0x3b')][_0x04c6('0x60')](_0x04c6('0x3e'))){_0x5b0859[_0x04c6('0x61')]=qs[_0x04c6('0x61')](_0x4fb402[_0x04c6('0x3b')][_0x04c6('0x61')]);_0x5b0859[_0x04c6('0x3f')]=qs['offset'](_0x4fb402[_0x04c6('0x3b')]['offset']);}return _0x487c2a[_0x04c6('0x6b')](_0x5b0859);}})[_0x04c6('0x25')](function(_0x3cfea6){if(_0x3cfea6){return _0x3cfea6?{'count':_0x523f48,'rows':_0x3cfea6}:null;}})[_0x04c6('0x25')](respondWithResult(_0x1884ce,null))[_0x04c6('0x48')](handleError(_0x1884ce,null));};exports['addTeams']=function(_0x7b32e6,_0x2ae300,_0x51c254){var _0x18362f=_0x7b32e6[_0x04c6('0x4e')][_0x04c6('0x6c')];var _0x5b67ea=_[_0x04c6('0x2b')](_0x18362f,'id');return db['Team']['findAll']({'where':{'id':_0x5b67ea},'attributes':['id'],'include':[{'model':db[_0x04c6('0x6d')],'as':'Agents','attributes':['id',_0x04c6('0x2f'),_0x04c6('0x6e'),_0x04c6('0x6f'),'interface'],'raw':!![]}]})[_0x04c6('0x25')](function(_0x47b54e){if(_0x47b54e){var _0x1dd178=_['flatMap'](_0x47b54e,function(_0x5d2d55){var _0x230d7f=_0x5d2d55['get']({'plain':!![]});_0x230d7f[_0x04c6('0x70')][_0x04c6('0x71')](function(_0x407d6a){_0x407d6a[_0x04c6('0x72')]=_[_0x04c6('0x4c')](_0x18362f,{'id':_0x230d7f['id']})[_0x04c6('0x72')];});return _0x230d7f[_0x04c6('0x70')];});return db[_0x04c6('0x35')][_0x04c6('0x4c')]({'where':{'id':_0x7b32e6[_0x04c6('0x55')]['id']}})['then'](function(_0x5101fc){return db[_0x04c6('0x73')][_0x04c6('0x74')](function(_0x1f3c0a){return _0x5101fc['addTeams'](_0x5b67ea,{'transaction':_0x1f3c0a})[_0x04c6('0x25')](function(){return BPromise['each'](_0x18362f,function(_0x5a17fe){return db[_0x04c6('0x75')][_0x04c6('0x76')]({'TeamId':_0x5a17fe['id'],'VoiceQueueId':_0x7b32e6[_0x04c6('0x55')]['id'],'penalty':_0x5a17fe[_0x04c6('0x72')]},{'transaction':_0x1f3c0a});});})['then'](function(){return BPromise['each'](_0x1dd178,function(_0x1ba6e9){return db[_0x04c6('0x77')]['findOrCreate']({'where':{'UserId':_0x1ba6e9['id'],'VoiceQueueId':_0x7b32e6[_0x04c6('0x55')]['id']},'defaults':{'penalty':_0x1ba6e9[_0x04c6('0x72')]},'transaction':_0x1f3c0a});});})[_0x04c6('0x25')](function(){return BPromise['each'](_['filter'](_0x1dd178,{'online':!![]}),function(_0x37fbde){return db[_0x04c6('0x78')][_0x04c6('0x76')]({'membername':_0x37fbde[_0x04c6('0x2f')],'UserId':_0x37fbde['id'],'queue_name':_0x5101fc[_0x04c6('0x2f')],'VoiceQueueId':_0x5101fc['id'],'interface':_[_0x04c6('0x79')](_0x37fbde[_0x04c6('0x7a')])?util[_0x04c6('0x7b')]('SIP/%s',_0x37fbde['name']):_0x37fbde['interface'],'paused':_0x37fbde[_0x04c6('0x6f')]||![],'penalty':_0x37fbde[_0x04c6('0x72')]},{'transaction':_0x1f3c0a});});})[_0x04c6('0x25')](function(){_0x1dd178[_0x04c6('0x71')](function(_0x3d88c6){socket[_0x04c6('0x7c')](_0x04c6('0x7d'),{'UserId':_0x3d88c6['id'],'VoiceQueueId':_0x5101fc['id']});});});});});}})['then'](respondWithStatusCode(_0x2ae300,null))[_0x04c6('0x48')](handleError(_0x2ae300,null));};exports['removeTeams']=function(_0x5866da,_0x45b350,_0xa417e2){return db[_0x04c6('0x7e')][_0x04c6('0x47')]({'where':{'id':_0x5866da[_0x04c6('0x3b')][_0x04c6('0x7f')]},'attributes':['id'],'include':[{'model':db[_0x04c6('0x6d')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x45b350,null))[_0x04c6('0x25')](function(_0x2b4df1){var _0x105691=_['map'](_0x2b4df1,'id');var _0x14a041=[];var _0x65e8ca=[];var _0x2b423d=squel[_0x04c6('0x80')]();_0x2b423d['field'](_0x04c6('0x81'))[_0x04c6('0x82')](_0x04c6('0x83'),'tq')['join'](_0x04c6('0x84'),'ut',_0x04c6('0x85'))[_0x04c6('0x41')](_0x04c6('0x86'),_0x5866da[_0x04c6('0x55')]['id']);for(var _0x350378=0x0;_0x350378<_0x2b4df1[_0x04c6('0x4b')];_0x350378+=0x1){let _0x3d4459=_0x2b4df1[_0x350378];for(var _0x3355c2=0x0;_0x3355c2<_0x3d4459[_0x04c6('0x70')]['length'];_0x3355c2+=0x1){let _0x89e1d1=_0x3d4459['Agents'][_0x3355c2];var _0x3f1b8c=_0x2b423d[_0x04c6('0x54')]();_0x3f1b8c[_0x04c6('0x41')](_0x04c6('0x87'),_0x89e1d1['id']);_0x65e8ca[_0x04c6('0x88')](db[_0x04c6('0x73')]['query'](_0x3f1b8c[_0x04c6('0x89')](),{'type':db[_0x04c6('0x73')][_0x04c6('0x8a')][_0x04c6('0x8b')]})[_0x04c6('0x25')](function(_0x111c54){if(_0x111c54[_0x04c6('0x4b')]===0x1){return _0x89e1d1['id'];}else{var _0x197e6d=_[_0x04c6('0x8c')](_[_0x04c6('0x2b')](_0x111c54,_0x04c6('0x8d')),function(_0x6952e2){return _[_0x04c6('0x2d')](_0x105691,_0x6952e2);});if(_0x197e6d){return _0x89e1d1['id'];}}}));}}return BPromise[_0x04c6('0x8e')](_0x65e8ca)[_0x04c6('0x25')](function(_0x382ed3){_0x14a041=_(_0x14a041)[_0x04c6('0x8f')](_0x382ed3)['compact']()[_0x04c6('0x2c')]();return db[_0x04c6('0x35')][_0x04c6('0x4c')]({'where':{'id':_0x5866da[_0x04c6('0x55')]['id']}})[_0x04c6('0x25')](function(_0x429729){return db[_0x04c6('0x73')][_0x04c6('0x74')](function(_0x3e26d8){return _0x429729[_0x04c6('0x90')](_0x5866da[_0x04c6('0x3b')]['ids'],{'transaction':_0x3e26d8})[_0x04c6('0x25')](function(){if(!_[_0x04c6('0x91')](_0x14a041)){return _0x429729[_0x04c6('0x92')](_0x14a041,{'transaction':_0x3e26d8})['then'](function(){return db[_0x04c6('0x78')][_0x04c6('0x24')]({'where':{'VoiceQueueId':_0x5866da[_0x04c6('0x55')]['id'],'UserId':_0x14a041},'transaction':_0x3e26d8});});}})[_0x04c6('0x25')](function(){_0x14a041[_0x04c6('0x71')](function(_0x2668f6){socket[_0x04c6('0x7c')](_0x04c6('0x93'),{'UserId':_0x2668f6,'VoiceQueueId':_0x429729['id']});});});});});});})[_0x04c6('0x25')](respondWithStatusCode(_0x45b350,null))['catch'](handleError(_0x45b350,null));};exports['addAgents']=function(_0x5e7510,_0x4bcfff,_0x1f9de8){var _0x5ddced,_0x7fe8c5;return db['VoiceQueue'][_0x04c6('0x4c')]({'where':{'id':_0x5e7510[_0x04c6('0x55')]['id']}})[_0x04c6('0x25')](handleEntityNotFound(_0x4bcfff,null))[_0x04c6('0x25')](function(_0x563305){if(_0x563305){_0x7fe8c5=_0x563305;return _0x563305['addAgents'](_0x5e7510[_0x04c6('0x4e')]['ids'],_['omit'](_0x5e7510[_0x04c6('0x4e')],[_0x04c6('0x7f'),'id'])||{})['spread'](function(_0x5c4304){for(var _0x8143c0=0x0;_0x8143c0<_0x5e7510[_0x04c6('0x4e')][_0x04c6('0x7f')][_0x04c6('0x4b')];_0x8143c0+=0x1){socket[_0x04c6('0x7c')](_0x04c6('0x7d'),{'UserId':_0x5e7510[_0x04c6('0x4e')][_0x04c6('0x7f')][_0x8143c0],'VoiceQueueId':_0x5e7510['params']['id']});}return _0x5c4304;});}})['then'](function(_0x49e686){_0x5ddced=_0x49e686||[];if(_0x7fe8c5){return db[_0x04c6('0x6d')][_0x04c6('0x47')]({'where':{'id':_0x5e7510[_0x04c6('0x4e')]['ids']},'attributes':['id',_0x04c6('0x2f'),_0x04c6('0x6e'),_0x04c6('0x6f'),_0x04c6('0x7a')],'raw':!![]});}})[_0x04c6('0x25')](function(_0x326503){if(!_['isEmpty'](_0x326503)){var _0x47bf12=[];for(var _0x2684ed=0x0;_0x2684ed<_0x326503[_0x04c6('0x4b')];_0x2684ed++){if(_0x326503[_0x2684ed]['online']){_0x47bf12[_0x04c6('0x88')](db[_0x04c6('0x78')][_0x04c6('0x76')]({'membername':_0x326503[_0x2684ed][_0x04c6('0x2f')],'UserId':_0x326503[_0x2684ed]['id'],'queue_name':_0x7fe8c5[_0x04c6('0x2f')],'VoiceQueueId':_0x7fe8c5['id'],'interface':_['isNil'](_0x326503[_0x2684ed][_0x04c6('0x7a')])?util[_0x04c6('0x7b')](_0x04c6('0x94'),_0x326503[_0x2684ed][_0x04c6('0x2f')]):_0x326503[_0x2684ed][_0x04c6('0x7a')],'paused':_0x326503[_0x2684ed][_0x04c6('0x6f')]||![],'penalty':_0x5e7510[_0x04c6('0x4e')][_0x04c6('0x72')]||0x0}));}}return BPromise[_0x04c6('0x8e')](_0x47bf12);}})[_0x04c6('0x25')](function(){return _0x5ddced;})['then'](respondWithResult(_0x4bcfff,null))['catch'](handleError(_0x4bcfff,null));};exports[_0x04c6('0x92')]=function(_0x5e26cc,_0x2eb0b8,_0x4ea146){return db['VoiceQueue']['find']({'where':{'id':_0x5e26cc[_0x04c6('0x55')]['id']}})[_0x04c6('0x25')](handleEntityNotFound(_0x2eb0b8,null))[_0x04c6('0x25')](function(_0x5aa1d3){if(_0x5aa1d3){return _0x5aa1d3[_0x04c6('0x92')](_0x5e26cc[_0x04c6('0x3b')]['ids'])[_0x04c6('0x25')](function(){if(_['isArray'](_0x5e26cc[_0x04c6('0x3b')]['ids'])){for(var _0x3dc72b=0x0;_0x3dc72b<_0x5e26cc[_0x04c6('0x3b')][_0x04c6('0x7f')][_0x04c6('0x4b')];_0x3dc72b+=0x1){socket['emit'](_0x04c6('0x93'),{'UserId':Number(_0x5e26cc['query']['ids'][_0x3dc72b]),'VoiceQueueId':Number(_0x5e26cc[_0x04c6('0x55')]['id'])});}}else{socket[_0x04c6('0x7c')](_0x04c6('0x93'),{'UserId':Number(_0x5e26cc[_0x04c6('0x3b')][_0x04c6('0x7f')]),'VoiceQueueId':Number(_0x5e26cc[_0x04c6('0x55')]['id'])});}});}})[_0x04c6('0x25')](function(_0x401e84){return db['UserVoiceQueueRt'][_0x04c6('0x24')]({'where':{'VoiceQueueId':_0x5e26cc[_0x04c6('0x55')]['id'],'UserId':_0x5e26cc[_0x04c6('0x3b')][_0x04c6('0x7f')]}})[_0x04c6('0x25')](function(){return _0x401e84;});})[_0x04c6('0x25')](respondWithStatusCode(_0x2eb0b8,null))[_0x04c6('0x48')](handleError(_0x2eb0b8,null));};exports[_0x04c6('0x95')]=function(_0x3c1b60,_0x3de7f9,_0x2068d7){var _0x4c5c2e={};var _0x6893bd={};var _0x580e57;var _0x46438b;return db[_0x04c6('0x35')]['findOne']({'where':{'id':_0x3c1b60[_0x04c6('0x55')]['id']}})[_0x04c6('0x25')](handleEntityNotFound(_0x3de7f9,null))[_0x04c6('0x25')](function(_0x242f61){if(_0x242f61){_0x580e57=_0x242f61;_0x6893bd['model']=_['keys'](db[_0x04c6('0x6d')][_0x04c6('0x36')]);_0x6893bd[_0x04c6('0x3b')]=_[_0x04c6('0x3a')](_0x3c1b60['query']);_0x6893bd[_0x04c6('0x42')]=_['intersection'](_0x6893bd['model'],_0x6893bd[_0x04c6('0x3b')]);_0x4c5c2e[_0x04c6('0x3c')]=_[_0x04c6('0x4a')](_0x6893bd[_0x04c6('0x39')],qs[_0x04c6('0x3d')](_0x3c1b60[_0x04c6('0x3b')][_0x04c6('0x3d')]));_0x4c5c2e['attributes']=_0x4c5c2e[_0x04c6('0x3c')][_0x04c6('0x4b')]?_0x4c5c2e[_0x04c6('0x3c')]:_0x6893bd[_0x04c6('0x39')];_0x4c5c2e[_0x04c6('0x62')]=qs['sort'](_0x3c1b60[_0x04c6('0x3b')][_0x04c6('0x40')]);_0x4c5c2e[_0x04c6('0x41')]=qs[_0x04c6('0x42')](_['pick'](_0x3c1b60[_0x04c6('0x3b')],_0x6893bd[_0x04c6('0x42')]));if(_0x3c1b60[_0x04c6('0x3b')]['filter']){_0x4c5c2e[_0x04c6('0x41')]=_[_0x04c6('0x43')](_0x4c5c2e[_0x04c6('0x41')],{'$or':_[_0x04c6('0x2b')](_0x4c5c2e['attributes'],function(_0x3e5080){var _0x5b6470={};_0x5b6470[_0x3e5080]={'$like':'%'+_0x3c1b60['query'][_0x04c6('0x2a')]+'%'};return _0x5b6470;})});}_0x4c5c2e=_[_0x04c6('0x43')]({},_0x4c5c2e,_0x3c1b60['options']);return _0x580e57[_0x04c6('0x95')](_0x4c5c2e);}})[_0x04c6('0x25')](function(_0x1054fe){if(_0x1054fe){_0x46438b=_0x1054fe[_0x04c6('0x4b')];if(!_0x3c1b60['query'][_0x04c6('0x60')](_0x04c6('0x3e'))){_0x4c5c2e[_0x04c6('0x61')]=qs['limit'](_0x3c1b60[_0x04c6('0x3b')][_0x04c6('0x61')]);_0x4c5c2e[_0x04c6('0x3f')]=qs[_0x04c6('0x3f')](_0x3c1b60[_0x04c6('0x3b')][_0x04c6('0x3f')]);}return _0x580e57[_0x04c6('0x95')](_0x4c5c2e);}})[_0x04c6('0x25')](function(_0x47bf3d){if(_0x47bf3d){return _0x47bf3d?{'count':_0x46438b,'rows':_0x47bf3d}:null;}})[_0x04c6('0x25')](respondWithResult(_0x3de7f9,null))[_0x04c6('0x48')](handleError(_0x3de7f9,null));};exports[_0x04c6('0x96')]=function(_0x47377b,_0x5e9441,_0x41b764){var _0x2b68e1={};var _0x27c0c7={};var _0x3e4f61;var _0x4d4f15;return db[_0x04c6('0x35')][_0x04c6('0x5e')]({'where':{'id':_0x47377b[_0x04c6('0x55')]['id']}})[_0x04c6('0x25')](handleEntityNotFound(_0x5e9441,null))[_0x04c6('0x25')](function(_0x2580a7){if(_0x2580a7){_0x3e4f61=_0x2580a7;_0x27c0c7['model']=_[_0x04c6('0x3a')](db[_0x04c6('0x78')]['rawAttributes']);_0x27c0c7[_0x04c6('0x3b')]=_[_0x04c6('0x3a')](_0x47377b['query']);_0x27c0c7['filters']=_[_0x04c6('0x4a')](_0x27c0c7['model'],_0x27c0c7[_0x04c6('0x3b')]);_0x2b68e1[_0x04c6('0x3c')]=_[_0x04c6('0x4a')](_0x27c0c7[_0x04c6('0x39')],qs[_0x04c6('0x3d')](_0x47377b['query'][_0x04c6('0x3d')]));_0x2b68e1[_0x04c6('0x3c')]=_0x2b68e1[_0x04c6('0x3c')][_0x04c6('0x4b')]?_0x2b68e1[_0x04c6('0x3c')]:_0x27c0c7['model'];_0x2b68e1[_0x04c6('0x62')]=qs[_0x04c6('0x40')](_0x47377b[_0x04c6('0x3b')][_0x04c6('0x40')]);_0x2b68e1[_0x04c6('0x41')]=qs[_0x04c6('0x42')](_['pick'](_0x47377b[_0x04c6('0x3b')],_0x27c0c7[_0x04c6('0x42')]));if(_0x47377b['query'][_0x04c6('0x2a')]){_0x2b68e1[_0x04c6('0x41')]=_[_0x04c6('0x43')](_0x2b68e1[_0x04c6('0x41')],{'$or':_[_0x04c6('0x2b')](_0x2b68e1['attributes'],function(_0x2c3343){var _0x422de4={};_0x422de4[_0x2c3343]={'$like':'%'+_0x47377b[_0x04c6('0x3b')]['filter']+'%'};return _0x422de4;})});}_0x2b68e1=_['merge']({},_0x2b68e1,_0x47377b[_0x04c6('0x56')]);return _0x3e4f61[_0x04c6('0x96')](_0x2b68e1);}})[_0x04c6('0x25')](function(_0xc74d0f){if(_0xc74d0f){_0x4d4f15=_0xc74d0f[_0x04c6('0x4b')];if(!_0x47377b[_0x04c6('0x3b')][_0x04c6('0x60')](_0x04c6('0x3e'))){_0x2b68e1[_0x04c6('0x61')]=qs[_0x04c6('0x61')](_0x47377b['query'][_0x04c6('0x61')]);_0x2b68e1[_0x04c6('0x3f')]=qs['offset'](_0x47377b['query'][_0x04c6('0x3f')]);}return _0x3e4f61['getMembers'](_0x2b68e1);}})[_0x04c6('0x25')](function(_0x4b0eb7){return _0x4b0eb7?{'count':_0x4d4f15,'rows':_0x4b0eb7}:null;})['then'](respondWithResult(_0x5e9441,null))[_0x04c6('0x48')](handleError(_0x5e9441,null));};exports[_0x04c6('0x97')]=function(_0x4b120f,_0x593f75,_0x481556){var _0x2852ca={};var _0x22492b={};var _0x2bc426;var _0x590ba6;return db[_0x04c6('0x35')][_0x04c6('0x5e')]({'where':{'id':_0x4b120f[_0x04c6('0x55')]['id']}})[_0x04c6('0x25')](handleEntityNotFound(_0x593f75,null))[_0x04c6('0x25')](function(_0x5d5282){if(_0x5d5282){_0x2bc426=_0x5d5282;_0x22492b[_0x04c6('0x39')]=_[_0x04c6('0x3a')](db[_0x04c6('0x98')][_0x04c6('0x36')]);_0x22492b[_0x04c6('0x3b')]=_[_0x04c6('0x3a')](_0x4b120f[_0x04c6('0x3b')]);_0x22492b[_0x04c6('0x42')]=_[_0x04c6('0x4a')](_0x22492b[_0x04c6('0x39')],_0x22492b[_0x04c6('0x3b')]);_0x2852ca[_0x04c6('0x3c')]=_[_0x04c6('0x4a')](_0x22492b[_0x04c6('0x39')],qs[_0x04c6('0x3d')](_0x4b120f[_0x04c6('0x3b')][_0x04c6('0x3d')]));_0x2852ca['attributes']=_0x2852ca[_0x04c6('0x3c')][_0x04c6('0x4b')]?_0x2852ca[_0x04c6('0x3c')]:_0x22492b[_0x04c6('0x39')];_0x2852ca[_0x04c6('0x62')]=qs[_0x04c6('0x40')](_0x4b120f[_0x04c6('0x3b')]['sort']);_0x2852ca[_0x04c6('0x41')]=qs[_0x04c6('0x42')](_['pick'](_0x4b120f['query'],_0x22492b['filters']));if(_0x4b120f['query'][_0x04c6('0x2a')]){_0x2852ca['where']=_['merge'](_0x2852ca[_0x04c6('0x41')],{'$or':_[_0x04c6('0x2b')](_0x2852ca[_0x04c6('0x3c')],function(_0x274a61){var _0x3fa2bb={};_0x3fa2bb[_0x274a61]={'$like':'%'+_0x4b120f[_0x04c6('0x3b')]['filter']+'%'};return _0x3fa2bb;})});}_0x2852ca=_[_0x04c6('0x43')]({},_0x2852ca,_0x4b120f[_0x04c6('0x56')]);return _0x2bc426[_0x04c6('0x97')](_0x2852ca);}})[_0x04c6('0x25')](function(_0x4ae2ed){if(_0x4ae2ed){_0x590ba6=_0x4ae2ed['length'];if(!_0x4b120f['query'][_0x04c6('0x60')](_0x04c6('0x3e'))){_0x2852ca[_0x04c6('0x61')]=qs[_0x04c6('0x61')](_0x4b120f[_0x04c6('0x3b')]['limit']);_0x2852ca[_0x04c6('0x3f')]=qs['offset'](_0x4b120f[_0x04c6('0x3b')]['offset']);}return _0x2bc426['getLists'](_0x2852ca);}})[_0x04c6('0x25')](function(_0x1f5f30){if(_0x1f5f30){return _0x1f5f30?{'count':_0x590ba6,'rows':_0x1f5f30}:null;}})['then'](respondWithResult(_0x593f75,null))[_0x04c6('0x48')](handleError(_0x593f75,null));};exports[_0x04c6('0x99')]=function(_0x364a8e,_0x39876a,_0xa03753){var _0x5ca56f,_0x4119c3;return db[_0x04c6('0x35')]['find']({'where':{'id':_0x364a8e[_0x04c6('0x55')]['id']}})['then'](handleEntityNotFound(_0x39876a,null))[_0x04c6('0x25')](function(_0x3796b8){if(_0x3796b8){_0x4119c3=_0x3796b8;return _0x3796b8[_0x04c6('0x99')](_0x364a8e[_0x04c6('0x4e')][_0x04c6('0x7f')],_[_0x04c6('0x57')](_0x364a8e[_0x04c6('0x4e')],[_0x04c6('0x7f'),'id'])||{});}return null;})[_0x04c6('0x9a')](function(_0x5da738){var _0x89b522;_0x5ca56f=_0x5da738||[];var _0x6d21be=[];if(_0x5da738){for(var _0x1f191f=0x0;_0x1f191f<_0x5da738[_0x04c6('0x4b')];_0x1f191f+=0x1){var _0x4309da=_0x5da738[_0x1f191f][_0x04c6('0x50')]({'plain':!![]});_0x4119c3['dialCheckDuplicateType']=_0x364a8e['body'][_0x04c6('0x9b')]?_0x364a8e[_0x04c6('0x4e')][_0x04c6('0x9b')]:_0x4119c3[_0x04c6('0x9b')];switch(_0x4119c3[_0x04c6('0x9b')]){case _0x04c6('0x9c'):_0x89b522=squel['insert']()[_0x04c6('0x9d')](_0x04c6('0x9e'))[_0x04c6('0x9f')]([_0x04c6('0xa0'),'scheduledAt',_0x04c6('0xa1'),'ListId',_0x04c6('0x63'),_0x04c6('0x58'),'updatedAt'],squel[_0x04c6('0x80')]()['field'](_0x04c6('0xa0'),_0x04c6('0xa0'))['field'](_0x04c6('0xa2'),_0x04c6('0xa3'))['field']('id','ContactId')[_0x04c6('0xa4')](_0x4309da[_0x04c6('0xa5')][_0x04c6('0x89')](),_0x04c6('0xa6'))[_0x04c6('0xa4')](_0x364a8e[_0x04c6('0x55')]['id'][_0x04c6('0x89')](),_0x04c6('0x63'))[_0x04c6('0xa4')]('NOW()',_0x04c6('0x58'))[_0x04c6('0xa4')](_0x04c6('0xa2'),_0x04c6('0x59'))[_0x04c6('0x82')](_0x04c6('0xa7'))[_0x04c6('0x41')](_0x04c6('0xa8'))['where'](_0x04c6('0xa9'),_0x4309da[_0x04c6('0xa5')]['toString']())['where'](_0x04c6('0xaa'))['where'](_0x04c6('0xab'),squel[_0x04c6('0x80')]()[_0x04c6('0xa4')](_0x04c6('0xac'))[_0x04c6('0x82')](_0x04c6('0xad'))[_0x04c6('0x41')](_0x04c6('0x86'),_0x364a8e[_0x04c6('0x55')]['id'][_0x04c6('0x89')]()))['where'](_0x04c6('0xab'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0x04c6('0x82')](_0x04c6('0x9e'))[_0x04c6('0x41')](_0x04c6('0x86'),_0x364a8e[_0x04c6('0x55')]['id'][_0x04c6('0x89')]())))[_0x04c6('0x89')]();break;case _0x04c6('0xae'):_0x89b522=squel[_0x04c6('0xaf')]()[_0x04c6('0x9d')](_0x04c6('0x9e'))[_0x04c6('0x9f')]([_0x04c6('0xa0'),_0x04c6('0xa3'),_0x04c6('0xa1'),_0x04c6('0xa6'),_0x04c6('0x63'),_0x04c6('0x58'),_0x04c6('0x59')],squel[_0x04c6('0x80')]()['field'](_0x04c6('0xa0'),_0x04c6('0xa0'))[_0x04c6('0xa4')](_0x04c6('0xa2'),'scheduledAt')[_0x04c6('0xa4')]('id','ContactId')['field'](_0x4309da['CmListId'][_0x04c6('0x89')](),_0x04c6('0xa6'))[_0x04c6('0xa4')](_0x364a8e[_0x04c6('0x55')]['id'][_0x04c6('0x89')](),_0x04c6('0x63'))[_0x04c6('0xa4')]('NOW()',_0x04c6('0x58'))[_0x04c6('0xa4')](_0x04c6('0xa2'),_0x04c6('0x59'))['from']('cm_contacts')[_0x04c6('0x41')]('deletedAt\x20IS\x20NULL')[_0x04c6('0x41')](_0x04c6('0xa9'),_0x4309da['CmListId']['toString']())[_0x04c6('0x41')](_0x04c6('0xaa'))['where'](_0x04c6('0xab'),squel[_0x04c6('0x80')]()[_0x04c6('0xa4')](_0x04c6('0xb0'))[_0x04c6('0x82')](_0x04c6('0x9e'))[_0x04c6('0x41')](_0x04c6('0x86'),_0x364a8e['params']['id']['toString']())))['toString']();break;default:_0x89b522=squel[_0x04c6('0xaf')]()['into']('cm_hopper')[_0x04c6('0x9f')]([_0x04c6('0xa0'),_0x04c6('0xa3'),_0x04c6('0xa1'),_0x04c6('0xa6'),_0x04c6('0x63'),_0x04c6('0x58'),_0x04c6('0x59')],squel[_0x04c6('0x80')]()[_0x04c6('0xa4')](_0x04c6('0xa0'),'phone')[_0x04c6('0xa4')]('NOW()',_0x04c6('0xa3'))[_0x04c6('0xa4')]('id',_0x04c6('0xa1'))['field'](_0x4309da[_0x04c6('0xa5')][_0x04c6('0x89')](),_0x04c6('0xa6'))['field'](_0x364a8e[_0x04c6('0x55')]['id'][_0x04c6('0x89')](),'VoiceQueueId')[_0x04c6('0xa4')](_0x04c6('0xa2'),_0x04c6('0x58'))[_0x04c6('0xa4')](_0x04c6('0xa2'),'updatedAt')[_0x04c6('0x82')](_0x04c6('0xa7'))[_0x04c6('0x41')](_0x04c6('0xa8'))[_0x04c6('0x41')]('ListId\x20=\x20?',_0x4309da[_0x04c6('0xa5')]['toString']())[_0x04c6('0x41')]('phone\x20IS\x20NOT\x20NULL'))[_0x04c6('0x89')]();}_0x6d21be['push'](db[_0x04c6('0x73')][_0x04c6('0x3b')](_0x89b522));}return BPromise['all'](_0x6d21be);}})[_0x04c6('0x25')](function(){return _0x5ca56f;})[_0x04c6('0x25')](respondWithResult(_0x39876a,null))[_0x04c6('0x48')](handleError(_0x39876a,null));};exports['removeLists']=function(_0x1bb326,_0x424193,_0x122f14){return db[_0x04c6('0x35')]['find']({'where':{'id':_0x1bb326['params']['id']}})['then'](handleEntityNotFound(_0x424193,null))[_0x04c6('0x25')](function(_0x14a0b2){if(_0x14a0b2){return _0x14a0b2[_0x04c6('0xb1')](_0x1bb326[_0x04c6('0x3b')][_0x04c6('0x7f')]);}})[_0x04c6('0x25')](function(_0xa2a2d6){if(_0xa2a2d6){return db['CmHopper'][_0x04c6('0x24')]({'where':{'ListId':_0x1bb326['query'][_0x04c6('0x7f')],'VoiceQueueId':_0x1bb326['params']['id']}})[_0x04c6('0x25')](function(){return _0xa2a2d6;});}})[_0x04c6('0x25')](respondWithStatusCode(_0x424193,null))[_0x04c6('0x48')](handleError(_0x424193,null));};exports[_0x04c6('0xb2')]=function(_0x149134,_0x1db878,_0x1b8591){var _0xd31c04={};var _0x583a83={};var _0x1949dc;var _0x11754d;return db[_0x04c6('0x35')][_0x04c6('0x5e')]({'where':{'id':_0x149134[_0x04c6('0x55')]['id']}})[_0x04c6('0x25')](handleEntityNotFound(_0x1db878,null))['then'](function(_0x1e7586){if(_0x1e7586){_0x1949dc=_0x1e7586;_0x583a83[_0x04c6('0x39')]=_[_0x04c6('0x3a')](db[_0x04c6('0x98')][_0x04c6('0x36')]);_0x583a83[_0x04c6('0x3b')]=_[_0x04c6('0x3a')](_0x149134[_0x04c6('0x3b')]);_0x583a83[_0x04c6('0x42')]=_[_0x04c6('0x4a')](_0x583a83[_0x04c6('0x39')],_0x583a83[_0x04c6('0x3b')]);_0xd31c04[_0x04c6('0x3c')]=_['intersection'](_0x583a83[_0x04c6('0x39')],qs['fields'](_0x149134[_0x04c6('0x3b')][_0x04c6('0x3d')]));_0xd31c04[_0x04c6('0x3c')]=_0xd31c04[_0x04c6('0x3c')][_0x04c6('0x4b')]?_0xd31c04[_0x04c6('0x3c')]:_0x583a83[_0x04c6('0x39')];_0xd31c04[_0x04c6('0x62')]=qs[_0x04c6('0x40')](_0x149134[_0x04c6('0x3b')]['sort']);_0xd31c04['where']=qs[_0x04c6('0x42')](_['pick'](_0x149134[_0x04c6('0x3b')],_0x583a83[_0x04c6('0x42')]));if(_0x149134[_0x04c6('0x3b')][_0x04c6('0x2a')]){_0xd31c04['where']=_[_0x04c6('0x43')](_0xd31c04['where'],{'$or':_[_0x04c6('0x2b')](_0xd31c04[_0x04c6('0x3c')],function(_0x36f8bb){var _0xc08a8d={};_0xc08a8d[_0x36f8bb]={'$like':'%'+_0x149134[_0x04c6('0x3b')]['filter']+'%'};return _0xc08a8d;})});}_0xd31c04=_[_0x04c6('0x43')]({},_0xd31c04,_0x149134[_0x04c6('0x56')]);return _0x1949dc[_0x04c6('0xb2')](_0xd31c04);}})[_0x04c6('0x25')](function(_0x97df43){if(_0x97df43){_0x11754d=_0x97df43[_0x04c6('0x4b')];if(!_0x149134[_0x04c6('0x3b')][_0x04c6('0x60')](_0x04c6('0x3e'))){_0xd31c04['limit']=qs[_0x04c6('0x61')](_0x149134[_0x04c6('0x3b')][_0x04c6('0x61')]);_0xd31c04[_0x04c6('0x3f')]=qs[_0x04c6('0x3f')](_0x149134[_0x04c6('0x3b')][_0x04c6('0x3f')]);}return _0x1949dc[_0x04c6('0xb2')](_0xd31c04);}})[_0x04c6('0x25')](function(_0x52bd34){if(_0x52bd34){return _0x52bd34?{'count':_0x11754d,'rows':_0x52bd34}:null;}})[_0x04c6('0x25')](respondWithResult(_0x1db878,null))['catch'](handleError(_0x1db878,null));};exports[_0x04c6('0xb3')]=function(_0x2db60b,_0x4cd15e,_0x1581b4){var _0x2bae4c,_0x1e7884;return db[_0x04c6('0x35')]['find']({'where':{'id':_0x2db60b['params']['id']}})[_0x04c6('0x25')](handleEntityNotFound(_0x4cd15e,null))[_0x04c6('0x25')](function(_0x14bdcd){if(_0x14bdcd){_0x1e7884=_0x14bdcd;return _0x14bdcd['addBlackLists'](_0x2db60b[_0x04c6('0x4e')][_0x04c6('0x7f')],_['omit'](_0x2db60b[_0x04c6('0x4e')],[_0x04c6('0x7f'),'id'])||{});}return null;})[_0x04c6('0x9a')](function(_0x4d1667){var _0x111461;_0x2bae4c=_0x4d1667||[];var _0x207ee1=[];if(_0x4d1667){for(var _0x5e702f=0x0;_0x5e702f<_0x4d1667['length'];_0x5e702f+=0x1){var _0x22a14f=_0x4d1667[_0x5e702f][_0x04c6('0x50')]({'plain':!![]});_0x111461=squel[_0x04c6('0xaf')]()[_0x04c6('0x9d')]('cm_hopper_black')['fromQuery'](['phone',_0x04c6('0xa1'),_0x04c6('0xa6'),'VoiceQueueId',_0x04c6('0x58'),'updatedAt'],squel['select']()[_0x04c6('0xa4')](_0x04c6('0xa0'),'phone')[_0x04c6('0xa4')]('id',_0x04c6('0xa1'))['field'](_0x22a14f[_0x04c6('0xa5')][_0x04c6('0x89')](),_0x04c6('0xa6'))[_0x04c6('0xa4')](_0x2db60b[_0x04c6('0x55')]['id'][_0x04c6('0x89')](),_0x04c6('0x63'))['field'](_0x04c6('0xa2'),_0x04c6('0x58'))[_0x04c6('0xa4')](_0x04c6('0xa2'),_0x04c6('0x59'))[_0x04c6('0x82')]('cm_contacts')['where'](_0x04c6('0xa8'))[_0x04c6('0x41')](_0x04c6('0xa9'),_0x22a14f[_0x04c6('0xa5')][_0x04c6('0x89')]())[_0x04c6('0x41')]('phone\x20IS\x20NOT\x20NULL'))[_0x04c6('0x89')]();_0x207ee1[_0x04c6('0x88')](db[_0x04c6('0x73')]['query'](_0x111461));}return BPromise[_0x04c6('0x8e')](_0x207ee1);}})[_0x04c6('0x25')](function(){return _0x2bae4c;})[_0x04c6('0x25')](respondWithResult(_0x4cd15e,null))[_0x04c6('0x48')](handleError(_0x4cd15e,null));};exports[_0x04c6('0xb4')]=function(_0x36756f,_0x44a6e0,_0x5293e9){return db[_0x04c6('0x35')][_0x04c6('0x4c')]({'where':{'id':_0x36756f['params']['id']}})[_0x04c6('0x25')](handleEntityNotFound(_0x44a6e0,null))[_0x04c6('0x25')](function(_0x3c5983){if(_0x3c5983){return _0x3c5983[_0x04c6('0xb4')](_0x36756f[_0x04c6('0x3b')][_0x04c6('0x7f')]);}})['then'](function(_0xd232be){if(_0xd232be){return db[_0x04c6('0x6a')][_0x04c6('0x24')]({'where':{'ListId':_0x36756f[_0x04c6('0x3b')]['ids'],'VoiceQueueId':_0x36756f[_0x04c6('0x55')]['id']}})[_0x04c6('0x25')](function(){return _0xd232be;});}})[_0x04c6('0x25')](respondWithStatusCode(_0x44a6e0,null))['catch'](handleError(_0x44a6e0,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 1090601..6e1a7c2 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 _0x26c6=['../../mysqldb','save','emit','hasOwnProperty','hook','exports','events'];(function(_0x41c5c5,_0x13bdf8){var _0x1178f1=function(_0x240981){while(--_0x240981){_0x41c5c5['push'](_0x41c5c5['shift']());}};_0x1178f1(++_0x13bdf8);}(_0x26c6,0x84));var _0x626c=function(_0x127d93,_0x536587){_0x127d93=_0x127d93-0x0;var _0x4567bf=_0x26c6[_0x127d93];return _0x4567bf;};'use strict';var EventEmitter=require(_0x626c('0x0'));var VoiceQueue=require(_0x626c('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x626c('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1f643b){return function(_0x591eb2,_0x4e51ce,_0x3f291e){VoiceQueueEvents[_0x626c('0x3')](_0x1f643b+':'+_0x591eb2['id'],_0x591eb2);VoiceQueueEvents[_0x626c('0x3')](_0x1f643b,_0x591eb2);_0x3f291e(null);};}for(var e in events){if(events[_0x626c('0x4')](e)){var event=events[e];VoiceQueue[_0x626c('0x5')](e,emitEvent(event));}}module[_0x626c('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0x290c=['exports','events','VoiceQueue','update','remove','emit','hasOwnProperty','hook'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x290c,0xe9));var _0xc290=function(_0x27a0fa,_0x5788ec){_0x27a0fa=_0x27a0fa-0x0;var _0x35cf59=_0x290c[_0x27a0fa];return _0x35cf59;};'use strict';var EventEmitter=require(_0xc290('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xc290('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc290('0x2'),'afterDestroy':_0xc290('0x3')};function emitEvent(_0x585f96){return function(_0x34068d,_0x4c0405,_0x40636a){VoiceQueueEvents[_0xc290('0x4')](_0x585f96+':'+_0x34068d['id'],_0x34068d);VoiceQueueEvents['emit'](_0x585f96,_0x34068d);_0x40636a(null);};}for(var e in events){if(events[_0xc290('0x5')](e)){var event=events[e];VoiceQueue[_0xc290('0x6')](e,emitEvent(event));}}module[_0xc290('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index a10275f..97882f1 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 _0xc1a7=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','voice_queues','lodash'];(function(_0x154f1d,_0x4c19cd){var _0x250c93=function(_0x37712c){while(--_0x37712c){_0x154f1d['push'](_0x154f1d['shift']());}};_0x250c93(++_0x4c19cd);}(_0xc1a7,0x117));var _0x7c1a=function(_0x57ba55,_0x2ff029){_0x57ba55=_0x57ba55-0x0;var _0x536e93=_0xc1a7[_0x57ba55];return _0x536e93;};'use strict';var _=require(_0x7c1a('0x0'));var util=require('util');var logger=require(_0x7c1a('0x1'))(_0x7c1a('0x2'));var moment=require(_0x7c1a('0x3'));var BPromise=require(_0x7c1a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7c1a('0x5'));var config=require(_0x7c1a('0x6'));var attributes=require('./voiceQueue.attributes');module[_0x7c1a('0x7')]=function(_0x3911b6,_0x3d71b1){return _0x3911b6[_0x7c1a('0x8')]('VoiceQueue',attributes,{'tableName':_0x7c1a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31f4=['./voiceQueue.attributes','define','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x18fc6d,_0x30b10c){var _0x301037=function(_0x3757c8){while(--_0x3757c8){_0x18fc6d['push'](_0x18fc6d['shift']());}};_0x301037(++_0x30b10c);}(_0x31f4,0x19c));var _0x431f=function(_0x576d8a,_0x2d7bde){_0x576d8a=_0x576d8a-0x0;var _0x3dc3ef=_0x31f4[_0x576d8a];return _0x3dc3ef;};'use strict';var _=require(_0x431f('0x0'));var util=require('util');var logger=require(_0x431f('0x1'))(_0x431f('0x2'));var moment=require(_0x431f('0x3'));var BPromise=require(_0x431f('0x4'));var rp=require(_0x431f('0x5'));var fs=require('fs');var path=require(_0x431f('0x6'));var rimraf=require('rimraf');var config=require(_0x431f('0x7'));var attributes=require(_0x431f('0x8'));module['exports']=function(_0x5e3c4e,_0x306564){return _0x5e3c4e[_0x431f('0x9')](_0x431f('0xa'),attributes,{'tableName':_0x431f('0xb'),'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 acb2b13..10ae0d1 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 _0x3492=['message','VoiceQueue,\x20%s,\x20%s','catch','GetVoiceQueue','options','raw','where','attributes','limit','include','model','then','ShowVoiceQueue','VoiceQueue','map','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','request','info','debug','request\x20sent','stringify','error','code'];(function(_0x49a811,_0x190495){var _0xd8ff9d=function(_0x3def3e){while(--_0x3def3e){_0x49a811['push'](_0x49a811['shift']());}};_0xd8ff9d(++_0x190495);}(_0x3492,0x1a6));var _0x2349=function(_0x3ac6a2,_0x44e54e){_0x3ac6a2=_0x3ac6a2-0x0;var _0x19c020=_0x3492[_0x3ac6a2];return _0x19c020;};'use strict';var _=require('lodash');var util=require(_0x2349('0x0'));var moment=require(_0x2349('0x1'));var BPromise=require(_0x2349('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2349('0x3'));var db=require(_0x2349('0x4'))['db'];var utils=require(_0x2349('0x5'));var logger=require(_0x2349('0x6'))('rpc');var config=require(_0x2349('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2349('0x8')][_0x2349('0x9')]({'port':0x232a});config['redis']=_[_0x2349('0xa')](config[_0x2349('0xb')],{'host':_0x2349('0xc'),'port':0x18eb});var socket=require(_0x2349('0xd'))(new Redis(config['redis']));require(_0x2349('0xe'))['register'](socket);function respondWithRpcPromise(_0x7bf6b0,_0x279eb9,_0x556a87){return new BPromise(function(_0x33ed72,_0x50e417){return client[_0x2349('0xf')](_0x7bf6b0,_0x556a87)['then'](function(_0x54a3a5){logger[_0x2349('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x279eb9,'request\x20sent');logger[_0x2349('0x11')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x279eb9,_0x2349('0x12'),JSON[_0x2349('0x13')](_0x54a3a5));if(_0x54a3a5['error']){if(_0x54a3a5[_0x2349('0x14')][_0x2349('0x15')]===0x1f4){logger[_0x2349('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x279eb9,_0x54a3a5['error'][_0x2349('0x16')]);return _0x50e417(_0x54a3a5[_0x2349('0x14')][_0x2349('0x16')]);}logger[_0x2349('0x14')](_0x2349('0x17'),_0x279eb9,_0x54a3a5['error'][_0x2349('0x16')]);return _0x33ed72(_0x54a3a5[_0x2349('0x14')][_0x2349('0x16')]);}else{logger['info'](_0x2349('0x17'),_0x279eb9,_0x2349('0x12'));_0x33ed72(_0x54a3a5['result']['message']);}})[_0x2349('0x18')](function(_0x5f4b01){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x279eb9,_0x5f4b01);_0x50e417(_0x5f4b01);});});}exports[_0x2349('0x19')]=function(_0x166f30){var _0xc99d26=this;return new Promise(function(_0x188423,_0x35f90c){return db['VoiceQueue']['findAll']({'raw':_0x166f30['options']?_0x166f30[_0x2349('0x1a')][_0x2349('0x1b')]===undefined?!![]:![]:!![],'where':_0x166f30['options']?_0x166f30['options'][_0x2349('0x1c')]||null:null,'attributes':_0x166f30['options']?_0x166f30[_0x2349('0x1a')][_0x2349('0x1d')]||null:null,'limit':_0x166f30['options']?_0x166f30[_0x2349('0x1a')][_0x2349('0x1e')]||null:null,'include':_0x166f30[_0x2349('0x1a')]?_0x166f30[_0x2349('0x1a')][_0x2349('0x1f')]?_['map'](_0x166f30[_0x2349('0x1a')][_0x2349('0x1f')],function(_0x13038c){return{'model':db[_0x13038c[_0x2349('0x20')]],'as':_0x13038c['as'],'attributes':_0x13038c['attributes'],'include':_0x13038c[_0x2349('0x1f')]?_['map'](_0x13038c[_0x2349('0x1f')],function(_0x42ea70){return{'model':db[_0x42ea70[_0x2349('0x20')]],'as':_0x42ea70['as'],'attributes':_0x42ea70[_0x2349('0x1d')],'include':_0x42ea70[_0x2349('0x1f')]?_['map'](_0x42ea70[_0x2349('0x1f')],function(_0x2817c0){return{'model':db[_0x2817c0['model']],'as':_0x2817c0['as'],'attributes':_0x2817c0[_0x2349('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2349('0x21')](function(_0x16dae){logger['info'](_0x2349('0x19'),_0x166f30);logger[_0x2349('0x11')]('GetVoiceQueue',_0x166f30,JSON[_0x2349('0x13')](_0x16dae));_0x188423(_0x16dae);})['catch'](function(_0x2fd28a){logger[_0x2349('0x14')]('GetVoiceQueue',_0x2fd28a[_0x2349('0x16')],_0x166f30);_0x35f90c(_0xc99d26['error'](0x1f4,_0x2fd28a[_0x2349('0x16')]));});});};exports[_0x2349('0x22')]=function(_0x382a70){var _0x33a443=this;return new Promise(function(_0x48732d,_0x219bb1){return db[_0x2349('0x23')]['find']({'raw':_0x382a70[_0x2349('0x1a')]?_0x382a70[_0x2349('0x1a')][_0x2349('0x1b')]===undefined?!![]:![]:!![],'where':_0x382a70[_0x2349('0x1a')]?_0x382a70[_0x2349('0x1a')][_0x2349('0x1c')]||null:null,'attributes':_0x382a70[_0x2349('0x1a')]?_0x382a70[_0x2349('0x1a')]['attributes']||null:null,'include':_0x382a70[_0x2349('0x1a')]?_0x382a70[_0x2349('0x1a')][_0x2349('0x1f')]?_[_0x2349('0x24')](_0x382a70['options'][_0x2349('0x1f')],function(_0x4c5946){return{'model':db[_0x4c5946[_0x2349('0x20')]],'as':_0x4c5946['as'],'attributes':_0x4c5946[_0x2349('0x1d')],'include':_0x4c5946['include']?_['map'](_0x4c5946[_0x2349('0x1f')],function(_0x5a675e){return{'model':db[_0x5a675e[_0x2349('0x20')]],'as':_0x5a675e['as'],'attributes':_0x5a675e[_0x2349('0x1d')],'include':_0x5a675e['include']?_[_0x2349('0x24')](_0x5a675e['include'],function(_0x5125f5){return{'model':db[_0x5125f5[_0x2349('0x20')]],'as':_0x5125f5['as'],'attributes':_0x5125f5[_0x2349('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2349('0x21')](function(_0x3d19a5){logger[_0x2349('0x10')](_0x2349('0x22'),_0x382a70);logger[_0x2349('0x11')](_0x2349('0x22'),_0x382a70,JSON['stringify'](_0x3d19a5));_0x48732d(_0x3d19a5);})[_0x2349('0x18')](function(_0x527fe1){logger['error']('ShowVoiceQueue',_0x527fe1[_0x2349('0x16')],_0x382a70);_0x219bb1(_0x33a443[_0x2349('0x14')](0x1f4,_0x527fe1[_0x2349('0x16')]));});});}; \ No newline at end of file +var _0x2b55=['stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','raw','options','where','limit','include','map','model','attributes','then','ShowVoiceQueue','find','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x2c7b38,_0x4c871a){var _0x1c2a50=function(_0x4321d1){while(--_0x4321d1){_0x2c7b38['push'](_0x2c7b38['shift']());}};_0x1c2a50(++_0x4c871a);}(_0x2b55,0x8c));var _0x52b5=function(_0x1554bb,_0x3990de){_0x1554bb=_0x1554bb-0x0;var _0xfbb670=_0x2b55[_0x1554bb];return _0xfbb670;};'use strict';var _=require('lodash');var util=require(_0x52b5('0x0'));var moment=require(_0x52b5('0x1'));var BPromise=require(_0x52b5('0x2'));var rs=require(_0x52b5('0x3'));var fs=require('fs');var Redis=require(_0x52b5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x52b5('0x5'))(_0x52b5('0x6'));var config=require(_0x52b5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x52b5('0x8')][_0x52b5('0x9')]({'port':0x232a});config[_0x52b5('0xa')]=_[_0x52b5('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x52b5('0xc'))(new Redis(config[_0x52b5('0xa')]));require('./voiceQueue.socket')[_0x52b5('0xd')](socket);function respondWithRpcPromise(_0x25264f,_0x1683c7,_0x55f3a2){return new BPromise(function(_0x4e6f61,_0x5c2193){return client[_0x52b5('0xe')](_0x25264f,_0x55f3a2)['then'](function(_0x497bf1){logger[_0x52b5('0xf')](_0x52b5('0x10'),_0x1683c7,_0x52b5('0x11'));logger[_0x52b5('0x12')](_0x52b5('0x13'),_0x1683c7,_0x52b5('0x11'),JSON[_0x52b5('0x14')](_0x497bf1));if(_0x497bf1[_0x52b5('0x15')]){if(_0x497bf1[_0x52b5('0x15')][_0x52b5('0x16')]===0x1f4){logger['error'](_0x52b5('0x10'),_0x1683c7,_0x497bf1[_0x52b5('0x15')][_0x52b5('0x17')]);return _0x5c2193(_0x497bf1['error'][_0x52b5('0x17')]);}logger['error'](_0x52b5('0x10'),_0x1683c7,_0x497bf1[_0x52b5('0x15')][_0x52b5('0x17')]);return _0x4e6f61(_0x497bf1[_0x52b5('0x15')][_0x52b5('0x17')]);}else{logger[_0x52b5('0xf')]('VoiceQueue,\x20%s,\x20%s',_0x1683c7,_0x52b5('0x11'));_0x4e6f61(_0x497bf1[_0x52b5('0x18')][_0x52b5('0x17')]);}})[_0x52b5('0x19')](function(_0x4ee796){logger[_0x52b5('0x15')](_0x52b5('0x10'),_0x1683c7,_0x4ee796);_0x5c2193(_0x4ee796);});});}exports[_0x52b5('0x1a')]=function(_0x188348){var _0xfe768f=this;return new Promise(function(_0x4b9984,_0x24cd43){return db[_0x52b5('0x1b')][_0x52b5('0x1c')]({'raw':_0x188348['options']?_0x188348['options'][_0x52b5('0x1d')]===undefined?!![]:![]:!![],'where':_0x188348[_0x52b5('0x1e')]?_0x188348[_0x52b5('0x1e')][_0x52b5('0x1f')]||null:null,'attributes':_0x188348[_0x52b5('0x1e')]?_0x188348['options']['attributes']||null:null,'limit':_0x188348[_0x52b5('0x1e')]?_0x188348[_0x52b5('0x1e')][_0x52b5('0x20')]||null:null,'include':_0x188348[_0x52b5('0x1e')]?_0x188348['options'][_0x52b5('0x21')]?_[_0x52b5('0x22')](_0x188348[_0x52b5('0x1e')][_0x52b5('0x21')],function(_0x710eda){return{'model':db[_0x710eda['model']],'as':_0x710eda['as'],'attributes':_0x710eda['attributes'],'include':_0x710eda[_0x52b5('0x21')]?_['map'](_0x710eda['include'],function(_0x2b7d31){return{'model':db[_0x2b7d31['model']],'as':_0x2b7d31['as'],'attributes':_0x2b7d31['attributes'],'include':_0x2b7d31[_0x52b5('0x21')]?_[_0x52b5('0x22')](_0x2b7d31[_0x52b5('0x21')],function(_0x4368e7){return{'model':db[_0x4368e7[_0x52b5('0x23')]],'as':_0x4368e7['as'],'attributes':_0x4368e7[_0x52b5('0x24')]};}):[]};}):[]};}):[]:[]})[_0x52b5('0x25')](function(_0x449d23){logger[_0x52b5('0xf')]('GetVoiceQueue',_0x188348);logger['debug'](_0x52b5('0x1a'),_0x188348,JSON['stringify'](_0x449d23));_0x4b9984(_0x449d23);})[_0x52b5('0x19')](function(_0x182de0){logger['error'](_0x52b5('0x1a'),_0x182de0['message'],_0x188348);_0x24cd43(_0xfe768f[_0x52b5('0x15')](0x1f4,_0x182de0[_0x52b5('0x17')]));});});};exports[_0x52b5('0x26')]=function(_0x3ad9b6){var _0x48d882=this;return new Promise(function(_0x2353f6,_0x4ab4cd){return db[_0x52b5('0x1b')][_0x52b5('0x27')]({'raw':_0x3ad9b6['options']?_0x3ad9b6[_0x52b5('0x1e')][_0x52b5('0x1d')]===undefined?!![]:![]:!![],'where':_0x3ad9b6['options']?_0x3ad9b6[_0x52b5('0x1e')][_0x52b5('0x1f')]||null:null,'attributes':_0x3ad9b6[_0x52b5('0x1e')]?_0x3ad9b6['options']['attributes']||null:null,'include':_0x3ad9b6[_0x52b5('0x1e')]?_0x3ad9b6[_0x52b5('0x1e')][_0x52b5('0x21')]?_[_0x52b5('0x22')](_0x3ad9b6[_0x52b5('0x1e')][_0x52b5('0x21')],function(_0x571fff){return{'model':db[_0x571fff['model']],'as':_0x571fff['as'],'attributes':_0x571fff[_0x52b5('0x24')],'include':_0x571fff[_0x52b5('0x21')]?_[_0x52b5('0x22')](_0x571fff[_0x52b5('0x21')],function(_0x40ab7c){return{'model':db[_0x40ab7c['model']],'as':_0x40ab7c['as'],'attributes':_0x40ab7c[_0x52b5('0x24')],'include':_0x40ab7c[_0x52b5('0x21')]?_[_0x52b5('0x22')](_0x40ab7c[_0x52b5('0x21')],function(_0x1db4a8){return{'model':db[_0x1db4a8[_0x52b5('0x23')]],'as':_0x1db4a8['as'],'attributes':_0x1db4a8[_0x52b5('0x24')]};}):[]};}):[]};}):[]:[]})[_0x52b5('0x25')](function(_0x256c39){logger[_0x52b5('0xf')](_0x52b5('0x26'),_0x3ad9b6);logger[_0x52b5('0x12')]('ShowVoiceQueue',_0x3ad9b6,JSON['stringify'](_0x256c39));_0x2353f6(_0x256c39);})[_0x52b5('0x19')](function(_0x30a63e){logger[_0x52b5('0x15')](_0x52b5('0x26'),_0x30a63e[_0x52b5('0x17')],_0x3ad9b6);_0x4ab4cd(_0x48d882[_0x52b5('0x15')](0x1f4,_0x30a63e['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 56c18e8..dd35c35 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 _0xfa6c=['removeListener','length','./voiceQueue.events','save','remove','emit'];(function(_0x372afc,_0x1d52ea){var _0x4ccee7=function(_0x28ad7d){while(--_0x28ad7d){_0x372afc['push'](_0x372afc['shift']());}};_0x4ccee7(++_0x1d52ea);}(_0xfa6c,0x152));var _0xcfa6=function(_0x46c5f0,_0x5969a9){_0x46c5f0=_0x46c5f0-0x0;var _0x54c19e=_0xfa6c[_0x46c5f0];return _0x54c19e;};'use strict';var VoiceQueueEvents=require(_0xcfa6('0x0'));var events=[_0xcfa6('0x1'),_0xcfa6('0x2'),'update'];function createListener(_0xed977d,_0x4b51d2){return function(_0x1de7da){_0x4b51d2[_0xcfa6('0x3')](_0xed977d,_0x1de7da);};}function removeListener(_0x591725,_0x5cee55){return function(){VoiceQueueEvents[_0xcfa6('0x4')](_0x591725,_0x5cee55);};}exports['register']=function(_0x2c1549){for(var _0x2512f7=0x0,_0x386bce=events[_0xcfa6('0x5')];_0x2512f7<_0x386bce;_0x2512f7++){var _0x3ac64a=events[_0x2512f7];var _0x47eea0=createListener('voiceQueue:'+_0x3ac64a,_0x2c1549);VoiceQueueEvents['on'](_0x3ac64a,_0x47eea0);}}; \ No newline at end of file +var _0x13ee=['removeListener','register','length','voiceQueue:','./voiceQueue.events','save','remove','update','emit'];(function(_0x3bd30f,_0x55cb6f){var _0x27eadf=function(_0x49534c){while(--_0x49534c){_0x3bd30f['push'](_0x3bd30f['shift']());}};_0x27eadf(++_0x55cb6f);}(_0x13ee,0x1f3));var _0xe13e=function(_0x311f44,_0x1d7f5b){_0x311f44=_0x311f44-0x0;var _0x46f1e6=_0x13ee[_0x311f44];return _0x46f1e6;};'use strict';var VoiceQueueEvents=require(_0xe13e('0x0'));var events=[_0xe13e('0x1'),_0xe13e('0x2'),_0xe13e('0x3')];function createListener(_0x20487b,_0x1528cc){return function(_0x362f32){_0x1528cc[_0xe13e('0x4')](_0x20487b,_0x362f32);};}function removeListener(_0x2a8bc7,_0x2e0fea){return function(){VoiceQueueEvents[_0xe13e('0x5')](_0x2a8bc7,_0x2e0fea);};}exports[_0xe13e('0x6')]=function(_0x4a62c9){for(var _0x17ee76=0x0,_0x382b8c=events[_0xe13e('0x7')];_0x17ee76<_0x382b8c;_0x17ee76++){var _0x506ce3=events[_0x17ee76];var _0x51bd8e=createListener(_0xe13e('0x8')+_0x506ce3,_0x4a62c9);VoiceQueueEvents['on'](_0x506ce3,_0x51bd8e);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index f9cb586..39804a1 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 _0x4730=['./voiceQueueReport.controller','isAuthenticated','index','get','describe','/index','getVoiceQueuesReport','/:id','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x4730,0x81));var _0x0473=function(_0x11c090,_0x7d8e4e){_0x11c090=_0x11c090-0x0;var _0x444c13=_0x4730[_0x11c090];return _0x444c13;};'use strict';var multer=require(_0x0473('0x0'));var util=require(_0x0473('0x1'));var path=require(_0x0473('0x2'));var timeout=require(_0x0473('0x3'));var express=require(_0x0473('0x4'));var router=express['Router']();var fs_extra=require(_0x0473('0x5'));var auth=require(_0x0473('0x6'));var interaction=require(_0x0473('0x7'));var config=require(_0x0473('0x8'));var controller=require(_0x0473('0x9'));router['get']('/',auth[_0x0473('0xa')](),controller[_0x0473('0xb')]);router[_0x0473('0xc')]('/describe',auth[_0x0473('0xa')](),controller[_0x0473('0xd')]);router[_0x0473('0xc')](_0x0473('0xe'),auth['isAuthenticated'](),controller[_0x0473('0xf')]);router[_0x0473('0xc')](_0x0473('0x10'),auth[_0x0473('0xa')](),controller['show']);router['post']('/',auth[_0x0473('0xa')](),controller[_0x0473('0x11')]);router[_0x0473('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0473('0x13')]);router[_0x0473('0x14')](_0x0473('0x10'),auth[_0x0473('0xa')](),controller[_0x0473('0x15')]);module[_0x0473('0x16')]=router; \ No newline at end of file +var _0x700d=['/:id','show','post','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport'];(function(_0x43a3,_0x4e0b15){var _0x5b03a0=function(_0x290e57){while(--_0x290e57){_0x43a3['push'](_0x43a3['shift']());}};_0x5b03a0(++_0x4e0b15);}(_0x700d,0x1ea));var _0xd700=function(_0x286c79,_0xd2f120){_0x286c79=_0x286c79-0x0;var _0x59573e=_0x700d[_0x286c79];return _0x59573e;};'use strict';var multer=require(_0xd700('0x0'));var util=require('util');var path=require(_0xd700('0x1'));var timeout=require(_0xd700('0x2'));var express=require(_0xd700('0x3'));var router=express[_0xd700('0x4')]();var fs_extra=require(_0xd700('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd700('0x6'));var config=require(_0xd700('0x7'));var controller=require(_0xd700('0x8'));router[_0xd700('0x9')]('/',auth[_0xd700('0xa')](),controller[_0xd700('0xb')]);router['get'](_0xd700('0xc'),auth[_0xd700('0xa')](),controller[_0xd700('0xd')]);router[_0xd700('0x9')](_0xd700('0xe'),auth[_0xd700('0xa')](),controller[_0xd700('0xf')]);router[_0xd700('0x9')](_0xd700('0x10'),auth[_0xd700('0xa')](),controller[_0xd700('0x11')]);router[_0xd700('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xd700('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xd700('0x13')](_0xd700('0x10'),auth['isAuthenticated'](),controller[_0xd700('0x14')]);module[_0xd700('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 8151581..e06f556 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 _0x9c44=['getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','DATE','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x49c4('0x0')]={'type':{'type':Sequelize[_0x49c4('0x1')]},'uniqueid':{'type':Sequelize[_0x49c4('0x1')]},'calleridnum':{'type':Sequelize[_0x49c4('0x1')]},'calleridname':{'type':Sequelize[_0x49c4('0x1')]},'queue':{'type':Sequelize[_0x49c4('0x1')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x41a183){var _0x57effd=moment(_0x41a183);var _0xc1278f=moment(this[_0x49c4('0x2')](_0x49c4('0x3')))[_0x49c4('0x4')](_0x49c4('0x5'));var _0x511d53=_0x57effd[_0x49c4('0x6')](_0xc1278f,_0x49c4('0x7'));this[_0x49c4('0x8')](_0x49c4('0x9'),_0x41a183);this['setDataValue']('holdtime',_0x511d53||null);}},'position':{'type':Sequelize[_0x49c4('0xa')]},'count':{'type':Sequelize[_0x49c4('0xa')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x49c4('0xb')]},'queuecallercomplete':{'type':Sequelize[_0x49c4('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x49c4('0xb')]},'queuecallerexitreason':{'type':Sequelize[_0x49c4('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x49c4('0xa')]},'channel':{'type':Sequelize[_0x49c4('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x49c4('0x1')]},'accountcode':{'type':Sequelize[_0x49c4('0x1')]},'context':{'type':Sequelize[_0x49c4('0x1')]},'exten':{'type':Sequelize[_0x49c4('0x1')]},'priority':{'type':Sequelize[_0x49c4('0x1')]},'holdtime':{'type':Sequelize[_0x49c4('0xa')]},'mohtime':{'type':Sequelize[_0x49c4('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x49c4('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x49c4('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x49c4('0x1')],'comment':_0x49c4('0xd')},'transferexten':{'type':Sequelize[_0x49c4('0x1')]},'transferuniqueid':{'type':Sequelize[_0x49c4('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x49c4('0x1')]},'thirdDisposition':{'type':Sequelize[_0x49c4('0x1')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x359d3e,_0x9d9e5b){var _0x533931=function(_0x553875){while(--_0x553875){_0x359d3e['push'](_0x359d3e['shift']());}};_0x533931(++_0x9d9e5b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0d8b('0x2')]},'calleridname':{'type':Sequelize[_0x0d8b('0x2')]},'queue':{'type':Sequelize[_0x0d8b('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x0d8b('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x0d8b('0x3')],'set':function(_0x577834){var _0x5e15e6=moment(_0x577834);var _0x3f8b6f=moment(this[_0x0d8b('0x4')](_0x0d8b('0x5')))['format'](_0x0d8b('0x6'));var _0x284169=_0x5e15e6['diff'](_0x3f8b6f,_0x0d8b('0x7'));this[_0x0d8b('0x8')](_0x0d8b('0x9'),_0x577834);this[_0x0d8b('0x8')](_0x0d8b('0xa'),_0x284169||null);}},'position':{'type':Sequelize[_0x0d8b('0xb')]},'count':{'type':Sequelize[_0x0d8b('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0d8b('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x0d8b('0x2')],'comment':_0x0d8b('0xd')},'originalposition':{'type':Sequelize[_0x0d8b('0xb')]},'channel':{'type':Sequelize[_0x0d8b('0x2')]},'connectedlinenum':{'type':Sequelize[_0x0d8b('0x2')]},'connectedlinename':{'type':Sequelize[_0x0d8b('0x2')]},'accountcode':{'type':Sequelize[_0x0d8b('0x2')]},'context':{'type':Sequelize[_0x0d8b('0x2')]},'exten':{'type':Sequelize[_0x0d8b('0x2')]},'priority':{'type':Sequelize[_0x0d8b('0x2')]},'holdtime':{'type':Sequelize[_0x0d8b('0xb')]},'mohtime':{'type':Sequelize[_0x0d8b('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0d8b('0x2')]},'transfer':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0d8b('0x2')],'comment':_0x0d8b('0xe')},'transferexten':{'type':Sequelize[_0x0d8b('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x0d8b('0x2')]},'secondDisposition':{'type':Sequelize[_0x0d8b('0x2')]},'thirdDisposition':{'type':Sequelize[_0x0d8b('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x0d8b('0xb')],'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 1176e6c..0bd2c1e 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 _0xb0d3=['lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','then','stack','name','send','index','map','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','VoiceQueueReport','findAll','rows','catch','show','params','rawAttributes','create','body','find','destroy','describe','getVoiceQueuesReport','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra'];(function(_0xfb3b3,_0x10db7a){var _0x36cae7=function(_0x183814){while(--_0x183814){_0xfb3b3['push'](_0xfb3b3['shift']());}};_0x36cae7(++_0x10db7a);}(_0xb0d3,0x1e1));var _0x3b0d=function(_0x294975,_0xba7309){_0x294975=_0x294975-0x0;var _0x523628=_0xb0d3[_0x294975];return _0x523628;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b0d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3b0d('0x1'));var rp=require(_0x3b0d('0x2'));var moment=require(_0x3b0d('0x3'));var BPromise=require(_0x3b0d('0x4'));var Mustache=require('mustache');var util=require(_0x3b0d('0x5'));var path=require(_0x3b0d('0x6'));var sox=require(_0x3b0d('0x7'));var csv=require(_0x3b0d('0x8'));var ejs=require(_0x3b0d('0x9'));var fs=require('fs');var fs_extra=require(_0x3b0d('0xa'));var _=require(_0x3b0d('0xb'));var squel=require(_0x3b0d('0xc'));var crypto=require('crypto');var jsforce=require(_0x3b0d('0xd'));var deskjs=require(_0x3b0d('0xe'));var toCsv=require(_0x3b0d('0x8'));var querystring=require(_0x3b0d('0xf'));var Papa=require('papaparse');var Redis=require(_0x3b0d('0x10'));var authService=require(_0x3b0d('0x11'));var qs=require(_0x3b0d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b0d('0x13'));var logger=require(_0x3b0d('0x14'))(_0x3b0d('0x15'));var utils=require(_0x3b0d('0x16'));var config=require(_0x3b0d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x3b0d('0x18')](config[_0x3b0d('0x19')],{'host':_0x3b0d('0x1a'),'port':0x18eb});var socket=require(_0x3b0d('0x1b'))(new Redis(config[_0x3b0d('0x19')]));require(_0x3b0d('0x1c'))[_0x3b0d('0x1d')](socket);function respondWithStatusCode(_0x51012f,_0x3c5e6d){_0x3c5e6d=_0x3c5e6d||0xcc;return function(_0x115e31){if(_0x115e31){return _0x51012f[_0x3b0d('0x1e')](_0x3c5e6d);}return _0x51012f[_0x3b0d('0x1f')](_0x3c5e6d)[_0x3b0d('0x20')]();};}function respondWithResult(_0x1ecf82,_0x296abc){_0x296abc=_0x296abc||0xc8;return function(_0x5c46cf){if(_0x5c46cf){return _0x1ecf82[_0x3b0d('0x1f')](_0x296abc)['json'](_0x5c46cf);}};}function respondWithFilteredResult(_0x5b4133,_0x6d6682){return function(_0x10aa84){if(_0x10aa84){var _0x477095=_0x10aa84['count'],_0x3a60c2=_0x6d6682[_0x3b0d('0x21')],_0x57aa7f=_0x6d6682[_0x3b0d('0x21')]+_0x6d6682[_0x3b0d('0x22')],_0x13a35e;if(_0x57aa7f>=_0x477095){_0x57aa7f=_0x477095;_0x13a35e=0xc8;}else{_0x13a35e=0xce;}_0x5b4133[_0x3b0d('0x1f')](_0x13a35e);return _0x5b4133[_0x3b0d('0x23')](_0x3b0d('0x24'),_0x3a60c2+'-'+_0x57aa7f+'/'+_0x477095)[_0x3b0d('0x25')](_0x10aa84);}return null;};}function patchUpdates(_0x361353){return function(_0x23ac33){try{jsonpatch[_0x3b0d('0x26')](_0x23ac33,_0x361353,!![]);}catch(_0x5b3598){return BPromise[_0x3b0d('0x27')](_0x5b3598);}return _0x23ac33[_0x3b0d('0x28')]();};}function saveUpdates(_0x12d784,_0x581e23){return function(_0x378edc){if(_0x378edc){return _0x378edc['update'](_0x12d784)[_0x3b0d('0x29')](function(_0x2b9377){return _0x2b9377;});}return null;};}function removeEntity(_0x1eb462,_0x156bfd){return function(_0x527490){if(_0x527490){return _0x527490['destroy']()[_0x3b0d('0x29')](function(){_0x1eb462[_0x3b0d('0x1f')](0xcc)[_0x3b0d('0x20')]();});}};}function handleEntityNotFound(_0x2afb00,_0x21452a){return function(_0x3c3b9e){if(!_0x3c3b9e){_0x2afb00[_0x3b0d('0x1e')](0x194);}return _0x3c3b9e;};}function handleError(_0x568301,_0x3e083f){_0x3e083f=_0x3e083f||0x1f4;return function(_0x2c9cdf){logger['error'](_0x2c9cdf[_0x3b0d('0x2a')]);if(_0x2c9cdf['name']){delete _0x2c9cdf[_0x3b0d('0x2b')];}_0x568301[_0x3b0d('0x1f')](_0x3e083f)[_0x3b0d('0x2c')](_0x2c9cdf);};}exports[_0x3b0d('0x2d')]=function(_0x33b4b2,_0x47064c){var _0x1b6388={},_0xe2fa3={},_0xf5d1fb={'count':0x0,'rows':[]};var _0x40e9b5=_[_0x3b0d('0x2e')](db['VoiceQueueReport']['rawAttributes'],function(_0x2e1426){return{'name':_0x2e1426['fieldName'],'type':_0x2e1426[_0x3b0d('0x2f')][_0x3b0d('0x30')]};});_0xe2fa3['model']=_[_0x3b0d('0x2e')](_0x40e9b5,_0x3b0d('0x2b'));_0xe2fa3['query']=_[_0x3b0d('0x31')](_0x33b4b2['query']);_0xe2fa3[_0x3b0d('0x32')]=_[_0x3b0d('0x33')](_0xe2fa3[_0x3b0d('0x34')],_0xe2fa3[_0x3b0d('0x35')]);_0x1b6388[_0x3b0d('0x36')]=_['intersection'](_0xe2fa3[_0x3b0d('0x34')],qs[_0x3b0d('0x37')](_0x33b4b2[_0x3b0d('0x35')]['fields']));_0x1b6388['attributes']=_0x1b6388[_0x3b0d('0x36')][_0x3b0d('0x38')]?_0x1b6388[_0x3b0d('0x36')]:_0xe2fa3[_0x3b0d('0x34')];if(!_0x33b4b2[_0x3b0d('0x35')][_0x3b0d('0x39')](_0x3b0d('0x3a'))){_0x1b6388[_0x3b0d('0x22')]=qs[_0x3b0d('0x22')](_0x33b4b2['query'][_0x3b0d('0x22')]);_0x1b6388[_0x3b0d('0x21')]=qs[_0x3b0d('0x21')](_0x33b4b2[_0x3b0d('0x35')][_0x3b0d('0x21')]);}_0x1b6388[_0x3b0d('0x3b')]=qs[_0x3b0d('0x3c')](_0x33b4b2['query']['sort']);_0x1b6388[_0x3b0d('0x3d')]=qs[_0x3b0d('0x32')](_['pick'](_0x33b4b2['query'],_0xe2fa3[_0x3b0d('0x32')]),_0x40e9b5);if(_0x33b4b2['query'][_0x3b0d('0x3e')]){_0x1b6388[_0x3b0d('0x3d')]=_[_0x3b0d('0x3f')](_0x1b6388[_0x3b0d('0x3d')],{'$or':_[_0x3b0d('0x2e')](_0x40e9b5,function(_0x553ae8){if(_0x553ae8[_0x3b0d('0x2f')]!==_0x3b0d('0x40')){var _0x573d86={};_0x573d86[_0x553ae8[_0x3b0d('0x2b')]]={'$like':'%'+_0x33b4b2[_0x3b0d('0x35')][_0x3b0d('0x3e')]+'%'};return _0x573d86;}})});}_0x1b6388=_['merge']({},_0x1b6388,_0x33b4b2[_0x3b0d('0x41')]);var _0x11d653={'where':_0x1b6388[_0x3b0d('0x3d')]};return db['VoiceQueueReport'][_0x3b0d('0x42')](_0x11d653)['then'](function(_0x5f57b8){_0xf5d1fb[_0x3b0d('0x42')]=_0x5f57b8;if(_0x33b4b2[_0x3b0d('0x35')][_0x3b0d('0x43')]){_0x1b6388[_0x3b0d('0x44')]=[{'all':!![]}];}return db[_0x3b0d('0x45')][_0x3b0d('0x46')](_0x1b6388);})[_0x3b0d('0x29')](function(_0x52173e){_0xf5d1fb[_0x3b0d('0x47')]=_0x52173e;return _0xf5d1fb;})['then'](respondWithFilteredResult(_0x47064c,_0x1b6388))[_0x3b0d('0x48')](handleError(_0x47064c,null));};exports[_0x3b0d('0x49')]=function(_0x3c4805,_0x45ffc2){var _0x56b298={'raw':![],'where':{'id':_0x3c4805[_0x3b0d('0x4a')]['id']}},_0x3d5f3b={};_0x3d5f3b[_0x3b0d('0x34')]=_['keys'](db[_0x3b0d('0x45')][_0x3b0d('0x4b')]);_0x3d5f3b[_0x3b0d('0x35')]=_[_0x3b0d('0x31')](_0x3c4805[_0x3b0d('0x35')]);_0x3d5f3b[_0x3b0d('0x32')]=_[_0x3b0d('0x33')](_0x3d5f3b[_0x3b0d('0x34')],_0x3d5f3b[_0x3b0d('0x35')]);_0x56b298[_0x3b0d('0x36')]=_['intersection'](_0x3d5f3b[_0x3b0d('0x34')],qs[_0x3b0d('0x37')](_0x3c4805[_0x3b0d('0x35')][_0x3b0d('0x37')]));_0x56b298[_0x3b0d('0x36')]=_0x56b298[_0x3b0d('0x36')]['length']?_0x56b298[_0x3b0d('0x36')]:_0x3d5f3b['model'];if(_0x3c4805['query'][_0x3b0d('0x43')]){_0x56b298[_0x3b0d('0x44')]=[{'all':!![]}];}_0x56b298=_['merge']({},_0x56b298,_0x3c4805['options']);return db[_0x3b0d('0x45')]['find'](_0x56b298)['then'](handleEntityNotFound(_0x45ffc2,null))[_0x3b0d('0x29')](respondWithResult(_0x45ffc2,null))[_0x3b0d('0x48')](handleError(_0x45ffc2,null));};exports[_0x3b0d('0x4c')]=function(_0x361f61,_0x4a5914){return db['VoiceQueueReport'][_0x3b0d('0x4c')](_0x361f61[_0x3b0d('0x4d')],{})[_0x3b0d('0x29')](respondWithResult(_0x4a5914,0xc9))[_0x3b0d('0x48')](handleError(_0x4a5914,null));};exports['update']=function(_0x5334fc,_0x500b3e){if(_0x5334fc[_0x3b0d('0x4d')]['id']){delete _0x5334fc[_0x3b0d('0x4d')]['id'];}return db[_0x3b0d('0x45')][_0x3b0d('0x4e')]({'where':{'id':_0x5334fc[_0x3b0d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x500b3e,null))[_0x3b0d('0x29')](saveUpdates(_0x5334fc['body'],null))[_0x3b0d('0x29')](respondWithResult(_0x500b3e,null))['catch'](handleError(_0x500b3e,null));};exports[_0x3b0d('0x4f')]=function(_0x25eef9,_0x214e05){return db[_0x3b0d('0x45')][_0x3b0d('0x4e')]({'where':{'id':_0x25eef9[_0x3b0d('0x4a')]['id']}})[_0x3b0d('0x29')](handleEntityNotFound(_0x214e05,null))['then'](removeEntity(_0x214e05,null))['catch'](handleError(_0x214e05,null));};exports[_0x3b0d('0x50')]=function(_0x3aca21,_0x3454e2){return db[_0x3b0d('0x45')][_0x3b0d('0x50')]()[_0x3b0d('0x29')](respondWithResult(_0x3454e2,null))['catch'](handleError(_0x3454e2,null));};exports[_0x3b0d('0x51')]=function(_0x2d9139,_0x5723ad){var _0x5a4d63={},_0x1cfbb3={},_0x3b1b96={'count':0x0,'rows':[]};_0x1cfbb3['model']=_['keys'](db[_0x3b0d('0x45')][_0x3b0d('0x4b')]);_0x1cfbb3['query']=_[_0x3b0d('0x31')](_0x2d9139[_0x3b0d('0x35')]);_0x1cfbb3[_0x3b0d('0x32')]=_[_0x3b0d('0x33')](_0x1cfbb3[_0x3b0d('0x34')],_0x1cfbb3[_0x3b0d('0x35')]);_0x5a4d63[_0x3b0d('0x36')]=_['intersection'](_0x1cfbb3['model'],qs[_0x3b0d('0x37')](_0x2d9139[_0x3b0d('0x35')]['fields']));_0x5a4d63['attributes']=_0x5a4d63['attributes'][_0x3b0d('0x38')]?_0x5a4d63['attributes']:_0x1cfbb3['model'];if(!_0x2d9139[_0x3b0d('0x35')][_0x3b0d('0x39')](_0x3b0d('0x3a'))){_0x5a4d63[_0x3b0d('0x22')]=qs[_0x3b0d('0x22')](_0x2d9139['query'][_0x3b0d('0x22')]);_0x5a4d63[_0x3b0d('0x21')]=qs[_0x3b0d('0x21')](_0x2d9139[_0x3b0d('0x35')][_0x3b0d('0x21')]);}_0x5a4d63[_0x3b0d('0x3b')]=qs[_0x3b0d('0x3c')](_0x2d9139[_0x3b0d('0x35')][_0x3b0d('0x3c')]);_0x5a4d63[_0x3b0d('0x3d')]=qs[_0x3b0d('0x32')](_['pick'](_0x2d9139[_0x3b0d('0x35')],_0x1cfbb3[_0x3b0d('0x32')]));if(_0x2d9139[_0x3b0d('0x35')]['filter']){_0x5a4d63[_0x3b0d('0x3d')]=_[_0x3b0d('0x3f')](_0x5a4d63[_0x3b0d('0x3d')],{'$or':_[_0x3b0d('0x2e')](_0x5a4d63[_0x3b0d('0x36')],function(_0x59c3e5){var _0xc08dc6={};_0xc08dc6[_0x59c3e5]={'$like':'%'+_0x2d9139[_0x3b0d('0x35')][_0x3b0d('0x3e')]+'%'};return _0xc08dc6;})});}_0x5a4d63=_[_0x3b0d('0x3f')]({},_0x5a4d63,_0x2d9139['options']);var _0x20315a={'where':_0x5a4d63[_0x3b0d('0x3d')]};return db[_0x3b0d('0x45')][_0x3b0d('0x42')](_0x20315a)['then'](function(_0x5d992d){_0x3b1b96[_0x3b0d('0x42')]=_0x5d992d;if(_0x2d9139[_0x3b0d('0x35')][_0x3b0d('0x43')]){_0x5a4d63[_0x3b0d('0x44')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x3b0d('0x46')](_0x5a4d63);})[_0x3b0d('0x29')](function(_0x3e2ba4){_0x3b1b96[_0x3b0d('0x47')]=_0x3e2ba4;return _0x3b1b96;})[_0x3b0d('0x29')](respondWithFilteredResult(_0x5723ad,_0x5a4d63,'getVoiceQueuesReport'))['catch'](handleError(_0x5723ad,null,_0x3b0d('0x51')));}; \ No newline at end of file +var _0xed06=['filters','pick','filter','merge','count','catch','show','includeAll','include','options','find','create','body','params','describe','getVoiceQueuesReport','hasOwnProperty','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','VoiceQueueReport','rawAttributes','fieldName','type','model','map','keys','intersection','query','attributes','fields','length','nolimit','order','sort','where'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xed06,0x111));var _0x6ed0=function(_0x346bfc,_0x2157d6){_0x346bfc=_0x346bfc-0x0;var _0x4550ab=_0xed06[_0x346bfc];return _0x4550ab;};'use strict';var emlformat=require(_0x6ed0('0x0'));var rimraf=require(_0x6ed0('0x1'));var zipdir=require(_0x6ed0('0x2'));var jsonpatch=require(_0x6ed0('0x3'));var rp=require(_0x6ed0('0x4'));var moment=require(_0x6ed0('0x5'));var BPromise=require(_0x6ed0('0x6'));var Mustache=require(_0x6ed0('0x7'));var util=require(_0x6ed0('0x8'));var path=require(_0x6ed0('0x9'));var sox=require(_0x6ed0('0xa'));var csv=require(_0x6ed0('0xb'));var ejs=require(_0x6ed0('0xc'));var fs=require('fs');var fs_extra=require(_0x6ed0('0xd'));var _=require(_0x6ed0('0xe'));var squel=require(_0x6ed0('0xf'));var crypto=require(_0x6ed0('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x6ed0('0x11'));var toCsv=require(_0x6ed0('0xb'));var querystring=require(_0x6ed0('0x12'));var Papa=require('papaparse');var Redis=require(_0x6ed0('0x13'));var authService=require(_0x6ed0('0x14'));var qs=require(_0x6ed0('0x15'));var as=require(_0x6ed0('0x16'));var hardwareService=require(_0x6ed0('0x17'));var logger=require(_0x6ed0('0x18'))(_0x6ed0('0x19'));var utils=require(_0x6ed0('0x1a'));var config=require(_0x6ed0('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x6ed0('0x1c'))['db'];config['redis']=_[_0x6ed0('0x1d')](config[_0x6ed0('0x1e')],{'host':_0x6ed0('0x1f'),'port':0x18eb});var socket=require(_0x6ed0('0x20'))(new Redis(config[_0x6ed0('0x1e')]));require(_0x6ed0('0x21'))[_0x6ed0('0x22')](socket);function respondWithStatusCode(_0x4c2b51,_0x2876b7){_0x2876b7=_0x2876b7||0xcc;return function(_0x49aadb){if(_0x49aadb){return _0x4c2b51[_0x6ed0('0x23')](_0x2876b7);}return _0x4c2b51['status'](_0x2876b7)[_0x6ed0('0x24')]();};}function respondWithResult(_0x538e15,_0x48a378){_0x48a378=_0x48a378||0xc8;return function(_0x37f9cf){if(_0x37f9cf){return _0x538e15[_0x6ed0('0x25')](_0x48a378)[_0x6ed0('0x26')](_0x37f9cf);}};}function respondWithFilteredResult(_0x1d3ad8,_0x466a15){return function(_0x446286){if(_0x446286){var _0x3fe632=_0x446286['count'],_0x37d62f=_0x466a15[_0x6ed0('0x27')],_0x59c5f2=_0x466a15['offset']+_0x466a15[_0x6ed0('0x28')],_0x2da6f4;if(_0x59c5f2>=_0x3fe632){_0x59c5f2=_0x3fe632;_0x2da6f4=0xc8;}else{_0x2da6f4=0xce;}_0x1d3ad8[_0x6ed0('0x25')](_0x2da6f4);return _0x1d3ad8['set'](_0x6ed0('0x29'),_0x37d62f+'-'+_0x59c5f2+'/'+_0x3fe632)[_0x6ed0('0x26')](_0x446286);}return null;};}function patchUpdates(_0x484842){return function(_0x20a5ee){try{jsonpatch[_0x6ed0('0x2a')](_0x20a5ee,_0x484842,!![]);}catch(_0x613ad5){return BPromise[_0x6ed0('0x2b')](_0x613ad5);}return _0x20a5ee[_0x6ed0('0x2c')]();};}function saveUpdates(_0x4813e7,_0x303397){return function(_0x4bdf1c){if(_0x4bdf1c){return _0x4bdf1c[_0x6ed0('0x2d')](_0x4813e7)[_0x6ed0('0x2e')](function(_0x5370b3){return _0x5370b3;});}return null;};}function removeEntity(_0x390167,_0x21a0db){return function(_0x68e4b7){if(_0x68e4b7){return _0x68e4b7[_0x6ed0('0x2f')]()[_0x6ed0('0x2e')](function(){_0x390167[_0x6ed0('0x25')](0xcc)[_0x6ed0('0x24')]();});}};}function handleEntityNotFound(_0x5cb55f,_0x20fdb8){return function(_0x4cfc13){if(!_0x4cfc13){_0x5cb55f['sendStatus'](0x194);}return _0x4cfc13;};}function handleError(_0x230b10,_0x1eca9f){_0x1eca9f=_0x1eca9f||0x1f4;return function(_0x3b027d){logger[_0x6ed0('0x30')](_0x3b027d['stack']);if(_0x3b027d[_0x6ed0('0x31')]){delete _0x3b027d[_0x6ed0('0x31')];}_0x230b10[_0x6ed0('0x25')](_0x1eca9f)[_0x6ed0('0x32')](_0x3b027d);};}exports['index']=function(_0x4fa4c5,_0x1fd59e){var _0x26be75={},_0x1668a8={},_0x12c601={'count':0x0,'rows':[]};var _0x1fa5b4=_['map'](db[_0x6ed0('0x33')][_0x6ed0('0x34')],function(_0x359a64){return{'name':_0x359a64[_0x6ed0('0x35')],'type':_0x359a64[_0x6ed0('0x36')]['key']};});_0x1668a8[_0x6ed0('0x37')]=_[_0x6ed0('0x38')](_0x1fa5b4,'name');_0x1668a8['query']=_[_0x6ed0('0x39')](_0x4fa4c5['query']);_0x1668a8['filters']=_[_0x6ed0('0x3a')](_0x1668a8[_0x6ed0('0x37')],_0x1668a8[_0x6ed0('0x3b')]);_0x26be75[_0x6ed0('0x3c')]=_[_0x6ed0('0x3a')](_0x1668a8[_0x6ed0('0x37')],qs[_0x6ed0('0x3d')](_0x4fa4c5[_0x6ed0('0x3b')][_0x6ed0('0x3d')]));_0x26be75[_0x6ed0('0x3c')]=_0x26be75[_0x6ed0('0x3c')][_0x6ed0('0x3e')]?_0x26be75[_0x6ed0('0x3c')]:_0x1668a8[_0x6ed0('0x37')];if(!_0x4fa4c5[_0x6ed0('0x3b')]['hasOwnProperty'](_0x6ed0('0x3f'))){_0x26be75[_0x6ed0('0x28')]=qs[_0x6ed0('0x28')](_0x4fa4c5[_0x6ed0('0x3b')]['limit']);_0x26be75[_0x6ed0('0x27')]=qs[_0x6ed0('0x27')](_0x4fa4c5[_0x6ed0('0x3b')]['offset']);}_0x26be75[_0x6ed0('0x40')]=qs[_0x6ed0('0x41')](_0x4fa4c5[_0x6ed0('0x3b')][_0x6ed0('0x41')]);_0x26be75[_0x6ed0('0x42')]=qs[_0x6ed0('0x43')](_[_0x6ed0('0x44')](_0x4fa4c5[_0x6ed0('0x3b')],_0x1668a8[_0x6ed0('0x43')]),_0x1fa5b4);if(_0x4fa4c5[_0x6ed0('0x3b')][_0x6ed0('0x45')]){_0x26be75[_0x6ed0('0x42')]=_['merge'](_0x26be75[_0x6ed0('0x42')],{'$or':_[_0x6ed0('0x38')](_0x1fa5b4,function(_0x2be028){if(_0x2be028[_0x6ed0('0x36')]!=='VIRTUAL'){var _0x320d71={};_0x320d71[_0x2be028['name']]={'$like':'%'+_0x4fa4c5[_0x6ed0('0x3b')]['filter']+'%'};return _0x320d71;}})});}_0x26be75=_[_0x6ed0('0x46')]({},_0x26be75,_0x4fa4c5['options']);var _0x44ba5c={'where':_0x26be75[_0x6ed0('0x42')]};return db['VoiceQueueReport']['count'](_0x44ba5c)[_0x6ed0('0x2e')](function(_0x560081){_0x12c601[_0x6ed0('0x47')]=_0x560081;if(_0x4fa4c5[_0x6ed0('0x3b')]['includeAll']){_0x26be75['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x26be75);})[_0x6ed0('0x2e')](function(_0x576fcd){_0x12c601['rows']=_0x576fcd;return _0x12c601;})['then'](respondWithFilteredResult(_0x1fd59e,_0x26be75))[_0x6ed0('0x48')](handleError(_0x1fd59e,null));};exports[_0x6ed0('0x49')]=function(_0x182294,_0x5cb010){var _0x2bacd8={'raw':![],'where':{'id':_0x182294['params']['id']}},_0x20af09={};_0x20af09[_0x6ed0('0x37')]=_[_0x6ed0('0x39')](db['VoiceQueueReport'][_0x6ed0('0x34')]);_0x20af09[_0x6ed0('0x3b')]=_[_0x6ed0('0x39')](_0x182294[_0x6ed0('0x3b')]);_0x20af09[_0x6ed0('0x43')]=_['intersection'](_0x20af09[_0x6ed0('0x37')],_0x20af09[_0x6ed0('0x3b')]);_0x2bacd8[_0x6ed0('0x3c')]=_[_0x6ed0('0x3a')](_0x20af09['model'],qs['fields'](_0x182294[_0x6ed0('0x3b')][_0x6ed0('0x3d')]));_0x2bacd8['attributes']=_0x2bacd8[_0x6ed0('0x3c')]['length']?_0x2bacd8[_0x6ed0('0x3c')]:_0x20af09[_0x6ed0('0x37')];if(_0x182294[_0x6ed0('0x3b')][_0x6ed0('0x4a')]){_0x2bacd8[_0x6ed0('0x4b')]=[{'all':!![]}];}_0x2bacd8=_['merge']({},_0x2bacd8,_0x182294[_0x6ed0('0x4c')]);return db['VoiceQueueReport'][_0x6ed0('0x4d')](_0x2bacd8)['then'](handleEntityNotFound(_0x5cb010,null))[_0x6ed0('0x2e')](respondWithResult(_0x5cb010,null))[_0x6ed0('0x48')](handleError(_0x5cb010,null));};exports[_0x6ed0('0x4e')]=function(_0x170b7f,_0xe53d){return db['VoiceQueueReport'][_0x6ed0('0x4e')](_0x170b7f[_0x6ed0('0x4f')],{})[_0x6ed0('0x2e')](respondWithResult(_0xe53d,0xc9))['catch'](handleError(_0xe53d,null));};exports[_0x6ed0('0x2d')]=function(_0xa30cd6,_0x312b2a){if(_0xa30cd6['body']['id']){delete _0xa30cd6[_0x6ed0('0x4f')]['id'];}return db[_0x6ed0('0x33')][_0x6ed0('0x4d')]({'where':{'id':_0xa30cd6[_0x6ed0('0x50')]['id']}})[_0x6ed0('0x2e')](handleEntityNotFound(_0x312b2a,null))['then'](saveUpdates(_0xa30cd6['body'],null))[_0x6ed0('0x2e')](respondWithResult(_0x312b2a,null))['catch'](handleError(_0x312b2a,null));};exports[_0x6ed0('0x2f')]=function(_0x21f57e,_0x359c1c){return db[_0x6ed0('0x33')][_0x6ed0('0x4d')]({'where':{'id':_0x21f57e[_0x6ed0('0x50')]['id']}})[_0x6ed0('0x2e')](handleEntityNotFound(_0x359c1c,null))['then'](removeEntity(_0x359c1c,null))[_0x6ed0('0x48')](handleError(_0x359c1c,null));};exports[_0x6ed0('0x51')]=function(_0x693b28,_0x2d6d67){return db[_0x6ed0('0x33')][_0x6ed0('0x51')]()[_0x6ed0('0x2e')](respondWithResult(_0x2d6d67,null))['catch'](handleError(_0x2d6d67,null));};exports[_0x6ed0('0x52')]=function(_0x5630cd,_0x569ec3){var _0x4868cd={},_0xf0a07a={},_0x1149ee={'count':0x0,'rows':[]};_0xf0a07a[_0x6ed0('0x37')]=_[_0x6ed0('0x39')](db['VoiceQueueReport'][_0x6ed0('0x34')]);_0xf0a07a['query']=_[_0x6ed0('0x39')](_0x5630cd['query']);_0xf0a07a[_0x6ed0('0x43')]=_[_0x6ed0('0x3a')](_0xf0a07a['model'],_0xf0a07a['query']);_0x4868cd[_0x6ed0('0x3c')]=_['intersection'](_0xf0a07a[_0x6ed0('0x37')],qs[_0x6ed0('0x3d')](_0x5630cd[_0x6ed0('0x3b')][_0x6ed0('0x3d')]));_0x4868cd[_0x6ed0('0x3c')]=_0x4868cd['attributes']['length']?_0x4868cd[_0x6ed0('0x3c')]:_0xf0a07a[_0x6ed0('0x37')];if(!_0x5630cd[_0x6ed0('0x3b')][_0x6ed0('0x53')]('nolimit')){_0x4868cd['limit']=qs[_0x6ed0('0x28')](_0x5630cd[_0x6ed0('0x3b')][_0x6ed0('0x28')]);_0x4868cd[_0x6ed0('0x27')]=qs[_0x6ed0('0x27')](_0x5630cd[_0x6ed0('0x3b')][_0x6ed0('0x27')]);}_0x4868cd[_0x6ed0('0x40')]=qs[_0x6ed0('0x41')](_0x5630cd[_0x6ed0('0x3b')][_0x6ed0('0x41')]);_0x4868cd[_0x6ed0('0x42')]=qs['filters'](_['pick'](_0x5630cd[_0x6ed0('0x3b')],_0xf0a07a[_0x6ed0('0x43')]));if(_0x5630cd['query'][_0x6ed0('0x45')]){_0x4868cd[_0x6ed0('0x42')]=_[_0x6ed0('0x46')](_0x4868cd[_0x6ed0('0x42')],{'$or':_['map'](_0x4868cd[_0x6ed0('0x3c')],function(_0x52419b){var _0x288f5e={};_0x288f5e[_0x52419b]={'$like':'%'+_0x5630cd['query']['filter']+'%'};return _0x288f5e;})});}_0x4868cd=_[_0x6ed0('0x46')]({},_0x4868cd,_0x5630cd['options']);var _0x488f99={'where':_0x4868cd[_0x6ed0('0x42')]};return db[_0x6ed0('0x33')][_0x6ed0('0x47')](_0x488f99)['then'](function(_0x5b99fe){_0x1149ee[_0x6ed0('0x47')]=_0x5b99fe;if(_0x5630cd[_0x6ed0('0x3b')][_0x6ed0('0x4a')]){_0x4868cd['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x4868cd);})[_0x6ed0('0x2e')](function(_0x709a2f){_0x1149ee[_0x6ed0('0x54')]=_0x709a2f;return _0x1149ee;})['then'](respondWithFilteredResult(_0x569ec3,_0x4868cd,_0x6ed0('0x52')))[_0x6ed0('0x48')](handleError(_0x569ec3,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index f39d404..387bb08 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 _0xa7eb=['exports','events','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x24a97b,_0x2feac0){var _0x186301=function(_0x4c1a25){while(--_0x4c1a25){_0x24a97b['push'](_0x24a97b['shift']());}};_0x186301(++_0x2feac0);}(_0xa7eb,0x1d5));var _0xba7e=function(_0xc1725a,_0x588f33){_0xc1725a=_0xc1725a-0x0;var _0xbecb34=_0xa7eb[_0xc1725a];return _0xbecb34;};'use strict';var EventEmitter=require(_0xba7e('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xba7e('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xba7e('0x2')](0x0);var events={'afterCreate':_0xba7e('0x3'),'afterUpdate':_0xba7e('0x4'),'afterDestroy':_0xba7e('0x5')};function emitEvent(_0x2bda8b){return function(_0x61cc12,_0x2f9d1e,_0x3392f7){VoiceQueueReportEvents['emit'](_0x2bda8b+':'+_0x61cc12['id'],_0x61cc12);VoiceQueueReportEvents[_0xba7e('0x6')](_0x2bda8b,_0x61cc12);_0x3392f7(null);};}for(var e in events){if(events[_0xba7e('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xba7e('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xcd75=['exports','events','../../mysqldb','VoiceQueueReport','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xcd75,0x17d));var _0x5cd7=function(_0x5c929c,_0x12ed29){_0x5c929c=_0x5c929c-0x0;var _0x1cd2ba=_0xcd75[_0x5c929c];return _0x1cd2ba;};'use strict';var EventEmitter=require(_0x5cd7('0x0'));var VoiceQueueReport=require(_0x5cd7('0x1'))['db'][_0x5cd7('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5cd7('0x3'),'afterUpdate':_0x5cd7('0x4'),'afterDestroy':_0x5cd7('0x5')};function emitEvent(_0x45f863){return function(_0x448468,_0x20dbc2,_0x5c8dfb){VoiceQueueReportEvents[_0x5cd7('0x6')](_0x45f863+':'+_0x448468['id'],_0x448468);VoiceQueueReportEvents[_0x5cd7('0x6')](_0x45f863,_0x448468);_0x5c8dfb(null);};}for(var e in events){if(events[_0x5cd7('0x7')](e)){var event=events[e];VoiceQueueReport[_0x5cd7('0x8')](e,emitEvent(event));}}module[_0x5cd7('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index f290f72..ce5db4f 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 _0x5f2f=['VoiceQueueReport','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceQueueReport.attributes','exports','define'];(function(_0x1d654f,_0x9cf763){var _0x5416d5=function(_0x3d6085){while(--_0x3d6085){_0x1d654f['push'](_0x1d654f['shift']());}};_0x5416d5(++_0x9cf763);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1c1913,_0x1d1b59){_0x1c1913=_0x1c1913-0x0;var _0x3b352a=_0x5f2f[_0x1c1913];return _0x3b352a;};'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 +var _0x2032=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x2032,0xd9));var _0x2203=function(_0x3ee025,_0x4ea604){_0x3ee025=_0x3ee025-0x0;var _0x1eb6a7=_0x2032[_0x3ee025];return _0x1eb6a7;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[{'fields':[_0x2203('0xc')]},{'fields':[_0x2203('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 82e3763..95c0744 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 _0xa780=['include','map','model','info','debug','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','where','limit','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','VoiceQueueReport,\x20%s,\x20%s','error','message','request\x20sent','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes'];(function(_0x1d9151,_0x5301e9){var _0x23d3f6=function(_0x48096f){while(--_0x48096f){_0x1d9151['push'](_0x1d9151['shift']());}};_0x23d3f6(++_0x5301e9);}(_0xa780,0xd4));var _0x0a78=function(_0x5735bc,_0x3e75bc){_0x5735bc=_0x5735bc-0x0;var _0x14d532=_0xa780[_0x5735bc];return _0x14d532;};'use strict';var _=require('lodash');var util=require(_0x0a78('0x0'));var moment=require(_0x0a78('0x1'));var BPromise=require('bluebird');var rs=require(_0x0a78('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a78('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a78('0x4'))(_0x0a78('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0a78('0x6')][_0x0a78('0x7')]({'port':0x232a});config[_0x0a78('0x8')]=_[_0x0a78('0x9')](config['redis'],{'host':_0x0a78('0xa'),'port':0x18eb});var socket=require(_0x0a78('0xb'))(new Redis(config['redis']));require(_0x0a78('0xc'))[_0x0a78('0xd')](socket);function respondWithRpcPromise(_0x200626,_0x1f592d,_0x24f96f){return new BPromise(function(_0x494786,_0x4ba9c7){return client['request'](_0x200626,_0x24f96f)[_0x0a78('0xe')](function(_0x3f2d0c){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x1f592d,'request\x20sent');logger['debug'](_0x0a78('0xf'),_0x1f592d,'request\x20sent',JSON[_0x0a78('0x10')](_0x3f2d0c));if(_0x3f2d0c['error']){if(_0x3f2d0c['error']['code']===0x1f4){logger['error'](_0x0a78('0x11'),_0x1f592d,_0x3f2d0c[_0x0a78('0x12')][_0x0a78('0x13')]);return _0x4ba9c7(_0x3f2d0c['error'][_0x0a78('0x13')]);}logger[_0x0a78('0x12')](_0x0a78('0x11'),_0x1f592d,_0x3f2d0c[_0x0a78('0x12')][_0x0a78('0x13')]);return _0x494786(_0x3f2d0c['error'][_0x0a78('0x13')]);}else{logger['info'](_0x0a78('0x11'),_0x1f592d,_0x0a78('0x14'));_0x494786(_0x3f2d0c['result'][_0x0a78('0x13')]);}})[_0x0a78('0x15')](function(_0xa0d937){logger['error'](_0x0a78('0x11'),_0x1f592d,_0xa0d937);_0x4ba9c7(_0xa0d937);});});}exports[_0x0a78('0x16')]=function(_0x115e3c){var _0x69ca00=this;return new Promise(function(_0x3803ee,_0x5e8f5a){return db[_0x0a78('0x17')][_0x0a78('0x18')]({'raw':_0x115e3c['options']?_0x115e3c[_0x0a78('0x19')][_0x0a78('0x1a')]===undefined?!![]:![]:!![],'where':_0x115e3c[_0x0a78('0x19')]?_0x115e3c[_0x0a78('0x19')]['where']||null:null,'attributes':_0x115e3c[_0x0a78('0x19')]?_0x115e3c['options'][_0x0a78('0x1b')]||null:null,'limit':_0x115e3c[_0x0a78('0x19')]?_0x115e3c['options']['limit']||null:null,'include':_0x115e3c['options']?_0x115e3c['options'][_0x0a78('0x1c')]?_[_0x0a78('0x1d')](_0x115e3c[_0x0a78('0x19')]['include'],function(_0x4bb34c){return{'model':db[_0x4bb34c[_0x0a78('0x1e')]],'as':_0x4bb34c['as'],'attributes':_0x4bb34c['attributes'],'include':_0x4bb34c[_0x0a78('0x1c')]?_['map'](_0x4bb34c[_0x0a78('0x1c')],function(_0x5a1e51){return{'model':db[_0x5a1e51[_0x0a78('0x1e')]],'as':_0x5a1e51['as'],'attributes':_0x5a1e51[_0x0a78('0x1b')],'include':_0x5a1e51[_0x0a78('0x1c')]?_[_0x0a78('0x1d')](_0x5a1e51[_0x0a78('0x1c')],function(_0x1cbdb4){return{'model':db[_0x1cbdb4['model']],'as':_0x1cbdb4['as'],'attributes':_0x1cbdb4[_0x0a78('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0a78('0xe')](function(_0x408ff6){logger[_0x0a78('0x1f')](_0x0a78('0x16'),_0x115e3c);logger[_0x0a78('0x20')]('GetVoiceQueueReport',_0x115e3c,JSON[_0x0a78('0x10')](_0x408ff6));_0x3803ee(_0x408ff6);})['catch'](function(_0x42b1fc){logger[_0x0a78('0x12')]('GetVoiceQueueReport',_0x42b1fc['message'],_0x115e3c);_0x5e8f5a(_0x69ca00['error'](0x1f4,_0x42b1fc['message']));});});};exports[_0x0a78('0x21')]=function(_0x5d5040){var _0x539ae4=this;return new Promise(function(_0x34666a,_0x44a320){return db[_0x0a78('0x17')][_0x0a78('0x22')](_0x5d5040[_0x0a78('0x23')],{'raw':_0x5d5040['options']?_0x5d5040[_0x0a78('0x19')][_0x0a78('0x1a')]===undefined?!![]:![]:!![]})[_0x0a78('0xe')](function(_0x4d3396){logger[_0x0a78('0x1f')](_0x0a78('0x21'),_0x5d5040);logger[_0x0a78('0x20')](_0x0a78('0x21'),_0x5d5040,JSON['stringify'](_0x4d3396));_0x34666a(_0x4d3396);})[_0x0a78('0x15')](function(_0x17415a){logger[_0x0a78('0x12')](_0x0a78('0x21'),_0x17415a[_0x0a78('0x13')],_0x5d5040);_0x44a320(_0x539ae4[_0x0a78('0x12')](0x1f4,_0x17415a[_0x0a78('0x13')]));});});};exports[_0x0a78('0x24')]=function(_0x2ee947){var _0x27d07b=this;return new Promise(function(_0x429dfc,_0x2b8563){return db[_0x0a78('0x17')][_0x0a78('0x25')](_0x2ee947[_0x0a78('0x23')],{'raw':_0x2ee947[_0x0a78('0x19')]?_0x2ee947[_0x0a78('0x19')][_0x0a78('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ee947['options']?_0x2ee947[_0x0a78('0x19')][_0x0a78('0x26')]||null:null,'attributes':_0x2ee947[_0x0a78('0x19')]?_0x2ee947[_0x0a78('0x19')][_0x0a78('0x1b')]||null:null,'limit':_0x2ee947[_0x0a78('0x19')]?_0x2ee947[_0x0a78('0x19')][_0x0a78('0x27')]||null:null})['then'](function(_0x50b2bf){logger[_0x0a78('0x1f')](_0x0a78('0x24'),_0x2ee947);logger['debug'](_0x0a78('0x24'),_0x2ee947,JSON['stringify'](_0x50b2bf));_0x429dfc(_0x50b2bf);})['catch'](function(_0x107f72){logger[_0x0a78('0x12')]('UpdateVoiceQueueReport',_0x107f72['message'],_0x2ee947);_0x2b8563(_0x27d07b[_0x0a78('0x12')](0x1f4,_0x107f72[_0x0a78('0x13')]));});});}; \ No newline at end of file +var _0xffc3=['debug','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','include','map','model','CreateVoiceQueueReport','create','body','raw','then','UpdateVoiceQueueReport','update','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xffc3,0x70));var _0x3ffc=function(_0x5a4d4c,_0x2bef70){_0x5a4d4c=_0x5a4d4c-0x0;var _0x561128=_0xffc3[_0x5a4d4c];return _0x561128;};'use strict';var _=require(_0x3ffc('0x0'));var util=require('util');var moment=require(_0x3ffc('0x1'));var BPromise=require(_0x3ffc('0x2'));var rs=require(_0x3ffc('0x3'));var fs=require('fs');var Redis=require(_0x3ffc('0x4'));var db=require(_0x3ffc('0x5'))['db'];var utils=require(_0x3ffc('0x6'));var logger=require(_0x3ffc('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3ffc('0x8'));var client=jayson[_0x3ffc('0x9')][_0x3ffc('0xa')]({'port':0x232a});config[_0x3ffc('0xb')]=_['defaults'](config['redis'],{'host':_0x3ffc('0xc'),'port':0x18eb});var socket=require(_0x3ffc('0xd'))(new Redis(config['redis']));require(_0x3ffc('0xe'))[_0x3ffc('0xf')](socket);function respondWithRpcPromise(_0x320d00,_0x451cd3,_0x5eda19){return new BPromise(function(_0x1508c0,_0xcc87eb){return client[_0x3ffc('0x10')](_0x320d00,_0x5eda19)['then'](function(_0x2126e1){logger[_0x3ffc('0x11')](_0x3ffc('0x12'),_0x451cd3,_0x3ffc('0x13'));logger[_0x3ffc('0x14')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x451cd3,_0x3ffc('0x13'),JSON[_0x3ffc('0x15')](_0x2126e1));if(_0x2126e1[_0x3ffc('0x16')]){if(_0x2126e1[_0x3ffc('0x16')][_0x3ffc('0x17')]===0x1f4){logger[_0x3ffc('0x16')](_0x3ffc('0x12'),_0x451cd3,_0x2126e1[_0x3ffc('0x16')][_0x3ffc('0x18')]);return _0xcc87eb(_0x2126e1[_0x3ffc('0x16')][_0x3ffc('0x18')]);}logger[_0x3ffc('0x16')](_0x3ffc('0x12'),_0x451cd3,_0x2126e1['error']['message']);return _0x1508c0(_0x2126e1[_0x3ffc('0x16')]['message']);}else{logger[_0x3ffc('0x11')](_0x3ffc('0x12'),_0x451cd3,_0x3ffc('0x13'));_0x1508c0(_0x2126e1[_0x3ffc('0x19')][_0x3ffc('0x18')]);}})[_0x3ffc('0x1a')](function(_0x2ad6fa){logger[_0x3ffc('0x16')](_0x3ffc('0x12'),_0x451cd3,_0x2ad6fa);_0xcc87eb(_0x2ad6fa);});});}exports[_0x3ffc('0x1b')]=function(_0x3d48d8){var _0x50fb40=this;return new Promise(function(_0x33e850,_0x4f7b81){return db[_0x3ffc('0x1c')][_0x3ffc('0x1d')]({'raw':_0x3d48d8[_0x3ffc('0x1e')]?_0x3d48d8[_0x3ffc('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3d48d8['options']?_0x3d48d8[_0x3ffc('0x1e')][_0x3ffc('0x1f')]||null:null,'attributes':_0x3d48d8[_0x3ffc('0x1e')]?_0x3d48d8[_0x3ffc('0x1e')][_0x3ffc('0x20')]||null:null,'limit':_0x3d48d8['options']?_0x3d48d8[_0x3ffc('0x1e')][_0x3ffc('0x21')]||null:null,'include':_0x3d48d8[_0x3ffc('0x1e')]?_0x3d48d8['options'][_0x3ffc('0x22')]?_[_0x3ffc('0x23')](_0x3d48d8[_0x3ffc('0x1e')][_0x3ffc('0x22')],function(_0x50f312){return{'model':db[_0x50f312['model']],'as':_0x50f312['as'],'attributes':_0x50f312[_0x3ffc('0x20')],'include':_0x50f312[_0x3ffc('0x22')]?_[_0x3ffc('0x23')](_0x50f312[_0x3ffc('0x22')],function(_0x2c7281){return{'model':db[_0x2c7281[_0x3ffc('0x24')]],'as':_0x2c7281['as'],'attributes':_0x2c7281[_0x3ffc('0x20')],'include':_0x2c7281[_0x3ffc('0x22')]?_[_0x3ffc('0x23')](_0x2c7281[_0x3ffc('0x22')],function(_0x506716){return{'model':db[_0x506716[_0x3ffc('0x24')]],'as':_0x506716['as'],'attributes':_0x506716[_0x3ffc('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29ed04){logger[_0x3ffc('0x11')]('GetVoiceQueueReport',_0x3d48d8);logger['debug'](_0x3ffc('0x1b'),_0x3d48d8,JSON[_0x3ffc('0x15')](_0x29ed04));_0x33e850(_0x29ed04);})['catch'](function(_0x5425b1){logger['error'](_0x3ffc('0x1b'),_0x5425b1[_0x3ffc('0x18')],_0x3d48d8);_0x4f7b81(_0x50fb40[_0x3ffc('0x16')](0x1f4,_0x5425b1[_0x3ffc('0x18')]));});});};exports[_0x3ffc('0x25')]=function(_0x4d7a78){var _0x5e411e=this;return new Promise(function(_0x35c459,_0x57a4ba){return db[_0x3ffc('0x1c')][_0x3ffc('0x26')](_0x4d7a78[_0x3ffc('0x27')],{'raw':_0x4d7a78['options']?_0x4d7a78[_0x3ffc('0x1e')][_0x3ffc('0x28')]===undefined?!![]:![]:!![]})[_0x3ffc('0x29')](function(_0x254c8d){logger[_0x3ffc('0x11')]('CreateVoiceQueueReport',_0x4d7a78);logger[_0x3ffc('0x14')](_0x3ffc('0x25'),_0x4d7a78,JSON['stringify'](_0x254c8d));_0x35c459(_0x254c8d);})[_0x3ffc('0x1a')](function(_0x17269c){logger[_0x3ffc('0x16')](_0x3ffc('0x25'),_0x17269c[_0x3ffc('0x18')],_0x4d7a78);_0x57a4ba(_0x5e411e[_0x3ffc('0x16')](0x1f4,_0x17269c[_0x3ffc('0x18')]));});});};exports[_0x3ffc('0x2a')]=function(_0x19be60){var _0x46e854=this;return new Promise(function(_0x1885a7,_0x8176f0){return db[_0x3ffc('0x1c')][_0x3ffc('0x2b')](_0x19be60['body'],{'raw':_0x19be60['options']?_0x19be60[_0x3ffc('0x1e')][_0x3ffc('0x28')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19be60[_0x3ffc('0x1e')]?_0x19be60[_0x3ffc('0x1e')][_0x3ffc('0x1f')]||null:null,'attributes':_0x19be60['options']?_0x19be60['options'][_0x3ffc('0x20')]||null:null,'limit':_0x19be60[_0x3ffc('0x1e')]?_0x19be60[_0x3ffc('0x1e')][_0x3ffc('0x21')]||null:null})['then'](function(_0x3597a6){logger[_0x3ffc('0x11')](_0x3ffc('0x2a'),_0x19be60);logger[_0x3ffc('0x14')](_0x3ffc('0x2a'),_0x19be60,JSON['stringify'](_0x3597a6));_0x1885a7(_0x3597a6);})[_0x3ffc('0x1a')](function(_0x10ff14){logger[_0x3ffc('0x16')](_0x3ffc('0x2a'),_0x10ff14['message'],_0x19be60);_0x8176f0(_0x46e854['error'](0x1f4,_0x10ff14[_0x3ffc('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index d5449d6..52ae85f 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 _0x098c=['removeListener','register','length','voiceQueueReport:','save','emit'];(function(_0x3cd1c0,_0x45b266){var _0x51864f=function(_0x393a02){while(--_0x393a02){_0x3cd1c0['push'](_0x3cd1c0['shift']());}};_0x51864f(++_0x45b266);}(_0x098c,0x178));var _0xc098=function(_0x495b4f,_0xdb22f2){_0x495b4f=_0x495b4f-0x0;var _0x4a10cb=_0x098c[_0x495b4f];return _0x4a10cb;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xc098('0x0'),'remove','update'];function createListener(_0x272b94,_0x4ce400){return function(_0x958d20){_0x4ce400[_0xc098('0x1')](_0x272b94,_0x958d20);};}function removeListener(_0x465904,_0x723f57){return function(){VoiceQueueReportEvents[_0xc098('0x2')](_0x465904,_0x723f57);};}exports[_0xc098('0x3')]=function(_0x220f02){for(var _0x3b4461=0x0,_0x4f7fc2=events[_0xc098('0x4')];_0x3b4461<_0x4f7fc2;_0x3b4461++){var _0x3cbc54=events[_0x3b4461];var _0x48d101=createListener(_0xc098('0x5')+_0x3cbc54,_0x220f02);VoiceQueueReportEvents['on'](_0x3cbc54,_0x48d101);}}; \ No newline at end of file +var _0xea2c=['./voiceQueueReport.events','save','remove','update','emit','removeListener','length','voiceQueueReport:'];(function(_0xbf71bc,_0x39b17b){var _0x1e02ad=function(_0x12ae9e){while(--_0x12ae9e){_0xbf71bc['push'](_0xbf71bc['shift']());}};_0x1e02ad(++_0x39b17b);}(_0xea2c,0x90));var _0xcea2=function(_0x4a0f89,_0x463117){_0x4a0f89=_0x4a0f89-0x0;var _0x2856ed=_0xea2c[_0x4a0f89];return _0x2856ed;};'use strict';var VoiceQueueReportEvents=require(_0xcea2('0x0'));var events=[_0xcea2('0x1'),_0xcea2('0x2'),_0xcea2('0x3')];function createListener(_0x41dcef,_0x505e31){return function(_0x4c388a){_0x505e31[_0xcea2('0x4')](_0x41dcef,_0x4c388a);};}function removeListener(_0x5abd80,_0x5b6d87){return function(){VoiceQueueReportEvents[_0xcea2('0x5')](_0x5abd80,_0x5b6d87);};}exports['register']=function(_0x15b5ee){for(var _0x5ccf29=0x0,_0x3e7b36=events[_0xcea2('0x6')];_0x5ccf29<_0x3e7b36;_0x5ccf29++){var _0x510565=events[_0x5ccf29];var _0x519dac=createListener(_0xcea2('0x7')+_0x510565,_0x15b5ee);VoiceQueueReportEvents['on'](_0x510565,_0x519dac);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 2757819..a08c00c 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 _0x8ce1=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','isAuthenticated','show','put','/:id','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x50d081,_0x44ae8a){var _0x2c2a02=function(_0x313381){while(--_0x313381){_0x50d081['push'](_0x50d081['shift']());}};_0x2c2a02(++_0x44ae8a);}(_0x8ce1,0x152));var _0x18ce=function(_0x4b10bc,_0x34048f){_0x4b10bc=_0x4b10bc-0x0;var _0x46e497=_0x8ce1[_0x4b10bc];return _0x46e497;};'use strict';var multer=require(_0x18ce('0x0'));var util=require(_0x18ce('0x1'));var path=require(_0x18ce('0x2'));var timeout=require(_0x18ce('0x3'));var express=require(_0x18ce('0x4'));var router=express[_0x18ce('0x5')]();var fs_extra=require(_0x18ce('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x18ce('0x7'));var config=require(_0x18ce('0x8'));var controller=require(_0x18ce('0x9'));router[_0x18ce('0xa')]('/',auth['isAuthenticated'](),controller[_0x18ce('0xb')]);router[_0x18ce('0xa')]('/:id',auth[_0x18ce('0xc')](),controller[_0x18ce('0xd')]);router['post']('/',auth[_0x18ce('0xc')](),controller['create']);router[_0x18ce('0xe')](_0x18ce('0xf'),auth[_0x18ce('0xc')](),controller[_0x18ce('0x10')]);router[_0x18ce('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x18ce('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5502=['create','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','show','post'];(function(_0x56ca41,_0x4af65c){var _0x5248ae=function(_0x253ba6){while(--_0x253ba6){_0x56ca41['push'](_0x56ca41['shift']());}};_0x5248ae(++_0x4af65c);}(_0x5502,0x69));var _0x2550=function(_0x3d0016,_0x4a37e0){_0x3d0016=_0x3d0016-0x0;var _0x1dcb28=_0x5502[_0x3d0016];return _0x1dcb28;};'use strict';var multer=require(_0x2550('0x0'));var util=require(_0x2550('0x1'));var path=require(_0x2550('0x2'));var timeout=require(_0x2550('0x3'));var express=require(_0x2550('0x4'));var router=express[_0x2550('0x5')]();var fs_extra=require(_0x2550('0x6'));var auth=require(_0x2550('0x7'));var interaction=require(_0x2550('0x8'));var config=require(_0x2550('0x9'));var controller=require(_0x2550('0xa'));router[_0x2550('0xb')]('/',auth[_0x2550('0xc')](),controller['index']);router[_0x2550('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x2550('0xd')]);router[_0x2550('0xe')]('/',auth['isAuthenticated'](),controller[_0x2550('0xf')]);router['put'](_0x2550('0x10'),auth[_0x2550('0xc')](),controller[_0x2550('0x11')]);router[_0x2550('0x12')](_0x2550('0x10'),auth[_0x2550('0xc')](),controller['destroy']);module[_0x2550('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 7ce7768..ff7caa3 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 _0xc5d8=['sequelize','moment','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3e9e31,_0x45f64f){var _0x756eda=function(_0x1d47d9){while(--_0x1d47d9){_0x3e9e31['push'](_0x3e9e31['shift']());}};_0x756eda(++_0x45f64f);}(_0xc5d8,0x70));var _0x8c5d=function(_0x20fa14,_0x2f0234){_0x20fa14=_0x20fa14-0x0;var _0x161aa0=_0xc5d8[_0x20fa14];return _0x161aa0;};'use strict';var Sequelize=require(_0x8c5d('0x0'));var moment=require(_0x8c5d('0x1'));module[_0x8c5d('0x2')]={'time':{'type':Sequelize[_0x8c5d('0x3')]},'callid':{'type':Sequelize[_0x8c5d('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x8c5d('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x8c5d('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x8c5d('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x8c5d('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x8c5d('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x8c5d('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x8c5d('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x8c5d('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x8c5d('0x4')],'allowNull':![],'defaultValue':moment()[_0x8c5d('0x5')](_0x8c5d('0x6'))}}; \ No newline at end of file +var _0x6d77=['sequelize','moment','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xf3a7cd,_0x23d55f){var _0x276c8a=function(_0x59a083){while(--_0x59a083){_0xf3a7cd['push'](_0xf3a7cd['shift']());}};_0x276c8a(++_0x23d55f);}(_0x6d77,0x186));var _0x76d7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6d77[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x76d7('0x0'));var moment=require(_0x76d7('0x1'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x76d7('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x76d7('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x76d7('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x76d7('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x76d7('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x76d7('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x76d7('0x3')],'allowNull':![],'defaultValue':moment()[_0x76d7('0x4')](_0x76d7('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 81c83c6..a2d46c1 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 _0x24e2=['count','offset','limit','reject','save','update','then','stack','name','index','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','map','query','attributes','fields','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','intersection','length','find','create','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x437006,_0x383392){var _0x215283=function(_0x362168){while(--_0x362168){_0x437006['push'](_0x437006['shift']());}};_0x215283(++_0x383392);}(_0x24e2,0x109));var _0x224e=function(_0x17bd6b,_0x32ebba){_0x17bd6b=_0x17bd6b-0x0;var _0x466cfa=_0x24e2[_0x17bd6b];return _0x466cfa;};'use strict';var emlformat=require(_0x224e('0x0'));var rimraf=require(_0x224e('0x1'));var zipdir=require(_0x224e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x224e('0x3'));var moment=require(_0x224e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x224e('0x5'));var util=require(_0x224e('0x6'));var path=require(_0x224e('0x7'));var sox=require(_0x224e('0x8'));var csv=require('to-csv');var ejs=require(_0x224e('0x9'));var fs=require('fs');var fs_extra=require(_0x224e('0xa'));var _=require(_0x224e('0xb'));var squel=require(_0x224e('0xc'));var crypto=require(_0x224e('0xd'));var jsforce=require(_0x224e('0xe'));var deskjs=require(_0x224e('0xf'));var toCsv=require(_0x224e('0x10'));var querystring=require(_0x224e('0x11'));var Papa=require('papaparse');var Redis=require(_0x224e('0x12'));var authService=require(_0x224e('0x13'));var qs=require(_0x224e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x224e('0x15'));var logger=require(_0x224e('0x16'))(_0x224e('0x17'));var utils=require(_0x224e('0x18'));var config=require(_0x224e('0x19'));var licenseUtil=require(_0x224e('0x1a'));var db=require(_0x224e('0x1b'))['db'];function respondWithStatusCode(_0x4fce73,_0x356c3d){_0x356c3d=_0x356c3d||0xcc;return function(_0x4dc7a6){if(_0x4dc7a6){return _0x4fce73[_0x224e('0x1c')](_0x356c3d);}return _0x4fce73['status'](_0x356c3d)[_0x224e('0x1d')]();};}function respondWithResult(_0x357bcd,_0x201cf2){_0x201cf2=_0x201cf2||0xc8;return function(_0x1b5d57){if(_0x1b5d57){return _0x357bcd[_0x224e('0x1e')](_0x201cf2)['json'](_0x1b5d57);}};}function respondWithFilteredResult(_0x3a6e97,_0x63eae){return function(_0x5c7a58){if(_0x5c7a58){var _0x2c3adc=_0x5c7a58[_0x224e('0x1f')],_0x210cbb=_0x63eae[_0x224e('0x20')],_0x36ae0a=_0x63eae['offset']+_0x63eae[_0x224e('0x21')],_0x469128;if(_0x36ae0a>=_0x2c3adc){_0x36ae0a=_0x2c3adc;_0x469128=0xc8;}else{_0x469128=0xce;}_0x3a6e97[_0x224e('0x1e')](_0x469128);return _0x3a6e97['set']('Content-Range',_0x210cbb+'-'+_0x36ae0a+'/'+_0x2c3adc)['json'](_0x5c7a58);}return null;};}function patchUpdates(_0x5a98c8){return function(_0x5f3ca7){try{jsonpatch['apply'](_0x5f3ca7,_0x5a98c8,!![]);}catch(_0xfd6446){return BPromise[_0x224e('0x22')](_0xfd6446);}return _0x5f3ca7[_0x224e('0x23')]();};}function saveUpdates(_0x176b19,_0xadc3ac){return function(_0x458621){if(_0x458621){return _0x458621[_0x224e('0x24')](_0x176b19)['then'](function(_0x1be6c4){return _0x1be6c4;});}return null;};}function removeEntity(_0x916b86,_0x22dd87){return function(_0x1987fd){if(_0x1987fd){return _0x1987fd['destroy']()[_0x224e('0x25')](function(){_0x916b86[_0x224e('0x1e')](0xcc)[_0x224e('0x1d')]();});}};}function handleEntityNotFound(_0x175b3b,_0x9d817){return function(_0x3c1131){if(!_0x3c1131){_0x175b3b['sendStatus'](0x194);}return _0x3c1131;};}function handleError(_0x366135,_0x5119d5){_0x5119d5=_0x5119d5||0x1f4;return function(_0x2dab63){logger['error'](_0x2dab63[_0x224e('0x26')]);if(_0x2dab63[_0x224e('0x27')]){delete _0x2dab63[_0x224e('0x27')];}_0x366135[_0x224e('0x1e')](_0x5119d5)['send'](_0x2dab63);};}exports[_0x224e('0x28')]=function(_0x3c9586,_0x409168){var _0x1c7007={},_0x55bc77={},_0x493d31={'count':0x0,'rows':[]};var _0x2161a5=_['map'](db[_0x224e('0x29')][_0x224e('0x2a')],function(_0xb415fe){return{'name':_0xb415fe[_0x224e('0x2b')],'type':_0xb415fe[_0x224e('0x2c')][_0x224e('0x2d')]};});_0x55bc77[_0x224e('0x2e')]=_[_0x224e('0x2f')](_0x2161a5,'name');_0x55bc77['query']=_['keys'](_0x3c9586[_0x224e('0x30')]);_0x55bc77['filters']=_['intersection'](_0x55bc77[_0x224e('0x2e')],_0x55bc77[_0x224e('0x30')]);_0x1c7007[_0x224e('0x31')]=_['intersection'](_0x55bc77['model'],qs[_0x224e('0x32')](_0x3c9586[_0x224e('0x30')][_0x224e('0x32')]));_0x1c7007[_0x224e('0x31')]=_0x1c7007[_0x224e('0x31')]['length']?_0x1c7007['attributes']:_0x55bc77[_0x224e('0x2e')];if(!_0x3c9586[_0x224e('0x30')]['hasOwnProperty'](_0x224e('0x33'))){_0x1c7007[_0x224e('0x21')]=qs[_0x224e('0x21')](_0x3c9586['query'][_0x224e('0x21')]);_0x1c7007[_0x224e('0x20')]=qs[_0x224e('0x20')](_0x3c9586[_0x224e('0x30')][_0x224e('0x20')]);}_0x1c7007[_0x224e('0x34')]=qs[_0x224e('0x35')](_0x3c9586[_0x224e('0x30')]['sort']);_0x1c7007[_0x224e('0x36')]=qs[_0x224e('0x37')](_[_0x224e('0x38')](_0x3c9586['query'],_0x55bc77[_0x224e('0x37')]),_0x2161a5);if(_0x3c9586[_0x224e('0x30')]['filter']){_0x1c7007[_0x224e('0x36')]=_[_0x224e('0x39')](_0x1c7007[_0x224e('0x36')],{'$or':_[_0x224e('0x2f')](_0x2161a5,function(_0x7c2eb4){if(_0x7c2eb4[_0x224e('0x2c')]!==_0x224e('0x3a')){var _0x8955fb={};_0x8955fb[_0x7c2eb4[_0x224e('0x27')]]={'$like':'%'+_0x3c9586[_0x224e('0x30')][_0x224e('0x3b')]+'%'};return _0x8955fb;}})});}_0x1c7007=_['merge']({},_0x1c7007,_0x3c9586[_0x224e('0x3c')]);var _0x49a865={'where':_0x1c7007['where']};return db['VoiceQueuesLog']['count'](_0x49a865)[_0x224e('0x25')](function(_0x11d9f){_0x493d31['count']=_0x11d9f;if(_0x3c9586[_0x224e('0x30')][_0x224e('0x3d')]){_0x1c7007[_0x224e('0x3e')]=[{'all':!![]}];}return db[_0x224e('0x29')][_0x224e('0x3f')](_0x1c7007);})[_0x224e('0x25')](function(_0x3e09c3){_0x493d31[_0x224e('0x40')]=_0x3e09c3;return _0x493d31;})[_0x224e('0x25')](respondWithFilteredResult(_0x409168,_0x1c7007))['catch'](handleError(_0x409168,null));};exports[_0x224e('0x41')]=function(_0x37685b,_0x49cf8d){var _0xf67949={'raw':!![],'where':{'id':_0x37685b[_0x224e('0x42')]['id']}},_0x59198a={};_0x59198a[_0x224e('0x2e')]=_[_0x224e('0x43')](db['VoiceQueuesLog'][_0x224e('0x2a')]);_0x59198a[_0x224e('0x30')]=_[_0x224e('0x43')](_0x37685b[_0x224e('0x30')]);_0x59198a['filters']=_[_0x224e('0x44')](_0x59198a['model'],_0x59198a[_0x224e('0x30')]);_0xf67949[_0x224e('0x31')]=_[_0x224e('0x44')](_0x59198a['model'],qs[_0x224e('0x32')](_0x37685b[_0x224e('0x30')]['fields']));_0xf67949['attributes']=_0xf67949[_0x224e('0x31')][_0x224e('0x45')]?_0xf67949[_0x224e('0x31')]:_0x59198a[_0x224e('0x2e')];if(_0x37685b['query'][_0x224e('0x3d')]){_0xf67949[_0x224e('0x3e')]=[{'all':!![]}];}_0xf67949=_[_0x224e('0x39')]({},_0xf67949,_0x37685b['options']);return db[_0x224e('0x29')][_0x224e('0x46')](_0xf67949)[_0x224e('0x25')](handleEntityNotFound(_0x49cf8d,null))[_0x224e('0x25')](respondWithResult(_0x49cf8d,null))['catch'](handleError(_0x49cf8d,null));};exports[_0x224e('0x47')]=function(_0x5ba885,_0x1ad025){return db[_0x224e('0x29')][_0x224e('0x47')](_0x5ba885[_0x224e('0x48')],{})['then'](respondWithResult(_0x1ad025,0xc9))[_0x224e('0x49')](handleError(_0x1ad025,null));};exports[_0x224e('0x24')]=function(_0x109041,_0x350d9d){if(_0x109041[_0x224e('0x48')]['id']){delete _0x109041[_0x224e('0x48')]['id'];}return db[_0x224e('0x29')]['find']({'where':{'id':_0x109041[_0x224e('0x42')]['id']}})[_0x224e('0x25')](handleEntityNotFound(_0x350d9d,null))[_0x224e('0x25')](saveUpdates(_0x109041[_0x224e('0x48')],null))['then'](respondWithResult(_0x350d9d,null))[_0x224e('0x49')](handleError(_0x350d9d,null));};exports['destroy']=function(_0x3226bc,_0x23c77e){return db[_0x224e('0x29')][_0x224e('0x46')]({'where':{'id':_0x3226bc[_0x224e('0x42')]['id']}})[_0x224e('0x25')](handleEntityNotFound(_0x23c77e,null))['then'](removeEntity(_0x23c77e,null))['catch'](handleError(_0x23c77e,null));}; \ No newline at end of file +var _0xd472=['params','length','merge','find','create','body','eml-format','zip-dir','request-promise','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','order','sort','where','pick','filter','options','count','includeAll','include','findAll','rows','catch','show'];(function(_0x3d95e9,_0x45bb17){var _0x472c9a=function(_0x4eeb02){while(--_0x4eeb02){_0x3d95e9['push'](_0x3d95e9['shift']());}};_0x472c9a(++_0x45bb17);}(_0xd472,0x11e));var _0x2d47=function(_0x2e3d16,_0x5e976f){_0x2e3d16=_0x2e3d16-0x0;var _0x38c598=_0xd472[_0x2e3d16];return _0x38c598;};'use strict';var emlformat=require(_0x2d47('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2d47('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2d47('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2d47('0x3'));var path=require(_0x2d47('0x4'));var sox=require(_0x2d47('0x5'));var csv=require(_0x2d47('0x6'));var ejs=require(_0x2d47('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d47('0x8'));var squel=require('squel');var crypto=require(_0x2d47('0x9'));var jsforce=require(_0x2d47('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2d47('0x6'));var querystring=require(_0x2d47('0xb'));var Papa=require(_0x2d47('0xc'));var Redis=require(_0x2d47('0xd'));var authService=require(_0x2d47('0xe'));var qs=require(_0x2d47('0xf'));var as=require(_0x2d47('0x10'));var hardwareService=require(_0x2d47('0x11'));var logger=require(_0x2d47('0x12'))(_0x2d47('0x13'));var utils=require(_0x2d47('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2d47('0x15'));var db=require(_0x2d47('0x16'))['db'];function respondWithStatusCode(_0x56d560,_0x22aea5){_0x22aea5=_0x22aea5||0xcc;return function(_0x276555){if(_0x276555){return _0x56d560['sendStatus'](_0x22aea5);}return _0x56d560[_0x2d47('0x17')](_0x22aea5)['end']();};}function respondWithResult(_0x570844,_0x34438a){_0x34438a=_0x34438a||0xc8;return function(_0x2dbf1a){if(_0x2dbf1a){return _0x570844[_0x2d47('0x17')](_0x34438a)[_0x2d47('0x18')](_0x2dbf1a);}};}function respondWithFilteredResult(_0x3838cb,_0x12c757){return function(_0x1c82d8){if(_0x1c82d8){var _0x319890=_0x1c82d8['count'],_0x518608=_0x12c757[_0x2d47('0x19')],_0x524542=_0x12c757[_0x2d47('0x19')]+_0x12c757[_0x2d47('0x1a')],_0x318fb3;if(_0x524542>=_0x319890){_0x524542=_0x319890;_0x318fb3=0xc8;}else{_0x318fb3=0xce;}_0x3838cb['status'](_0x318fb3);return _0x3838cb[_0x2d47('0x1b')](_0x2d47('0x1c'),_0x518608+'-'+_0x524542+'/'+_0x319890)[_0x2d47('0x18')](_0x1c82d8);}return null;};}function patchUpdates(_0x11baa1){return function(_0xb044ef){try{jsonpatch[_0x2d47('0x1d')](_0xb044ef,_0x11baa1,!![]);}catch(_0x5adc5b){return BPromise[_0x2d47('0x1e')](_0x5adc5b);}return _0xb044ef['save']();};}function saveUpdates(_0x421537,_0x3f345d){return function(_0x18a609){if(_0x18a609){return _0x18a609[_0x2d47('0x1f')](_0x421537)[_0x2d47('0x20')](function(_0x2a33ac){return _0x2a33ac;});}return null;};}function removeEntity(_0x35a521,_0x5712b2){return function(_0x3885d9){if(_0x3885d9){return _0x3885d9[_0x2d47('0x21')]()['then'](function(){_0x35a521[_0x2d47('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bb6b,_0x5cc1a8){return function(_0x1fe5d4){if(!_0x1fe5d4){_0x4bb6b['sendStatus'](0x194);}return _0x1fe5d4;};}function handleError(_0x23cf1c,_0x1a9194){_0x1a9194=_0x1a9194||0x1f4;return function(_0x297479){logger['error'](_0x297479[_0x2d47('0x22')]);if(_0x297479[_0x2d47('0x23')]){delete _0x297479[_0x2d47('0x23')];}_0x23cf1c[_0x2d47('0x17')](_0x1a9194)[_0x2d47('0x24')](_0x297479);};}exports[_0x2d47('0x25')]=function(_0x2172fe,_0x35d9cc){var _0x51f4a7={},_0x3c78d7={},_0x81a945={'count':0x0,'rows':[]};var _0x43c5ff=_[_0x2d47('0x26')](db[_0x2d47('0x27')][_0x2d47('0x28')],function(_0x2f0a3c){return{'name':_0x2f0a3c[_0x2d47('0x29')],'type':_0x2f0a3c[_0x2d47('0x2a')][_0x2d47('0x2b')]};});_0x3c78d7[_0x2d47('0x2c')]=_[_0x2d47('0x26')](_0x43c5ff,_0x2d47('0x23'));_0x3c78d7['query']=_[_0x2d47('0x2d')](_0x2172fe[_0x2d47('0x2e')]);_0x3c78d7[_0x2d47('0x2f')]=_[_0x2d47('0x30')](_0x3c78d7[_0x2d47('0x2c')],_0x3c78d7[_0x2d47('0x2e')]);_0x51f4a7[_0x2d47('0x31')]=_['intersection'](_0x3c78d7[_0x2d47('0x2c')],qs[_0x2d47('0x32')](_0x2172fe[_0x2d47('0x2e')][_0x2d47('0x32')]));_0x51f4a7['attributes']=_0x51f4a7[_0x2d47('0x31')]['length']?_0x51f4a7[_0x2d47('0x31')]:_0x3c78d7[_0x2d47('0x2c')];if(!_0x2172fe['query']['hasOwnProperty']('nolimit')){_0x51f4a7[_0x2d47('0x1a')]=qs[_0x2d47('0x1a')](_0x2172fe[_0x2d47('0x2e')][_0x2d47('0x1a')]);_0x51f4a7['offset']=qs[_0x2d47('0x19')](_0x2172fe[_0x2d47('0x2e')]['offset']);}_0x51f4a7[_0x2d47('0x33')]=qs[_0x2d47('0x34')](_0x2172fe[_0x2d47('0x2e')][_0x2d47('0x34')]);_0x51f4a7[_0x2d47('0x35')]=qs[_0x2d47('0x2f')](_[_0x2d47('0x36')](_0x2172fe['query'],_0x3c78d7['filters']),_0x43c5ff);if(_0x2172fe[_0x2d47('0x2e')][_0x2d47('0x37')]){_0x51f4a7[_0x2d47('0x35')]=_['merge'](_0x51f4a7[_0x2d47('0x35')],{'$or':_['map'](_0x43c5ff,function(_0x160a5d){if(_0x160a5d[_0x2d47('0x2a')]!=='VIRTUAL'){var _0x50e7f5={};_0x50e7f5[_0x160a5d[_0x2d47('0x23')]]={'$like':'%'+_0x2172fe['query'][_0x2d47('0x37')]+'%'};return _0x50e7f5;}})});}_0x51f4a7=_['merge']({},_0x51f4a7,_0x2172fe[_0x2d47('0x38')]);var _0x2063ef={'where':_0x51f4a7[_0x2d47('0x35')]};return db[_0x2d47('0x27')][_0x2d47('0x39')](_0x2063ef)[_0x2d47('0x20')](function(_0x5f3ada){_0x81a945[_0x2d47('0x39')]=_0x5f3ada;if(_0x2172fe[_0x2d47('0x2e')][_0x2d47('0x3a')]){_0x51f4a7[_0x2d47('0x3b')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x2d47('0x3c')](_0x51f4a7);})['then'](function(_0x5c8fdf){_0x81a945[_0x2d47('0x3d')]=_0x5c8fdf;return _0x81a945;})[_0x2d47('0x20')](respondWithFilteredResult(_0x35d9cc,_0x51f4a7))[_0x2d47('0x3e')](handleError(_0x35d9cc,null));};exports[_0x2d47('0x3f')]=function(_0x43a07d,_0x390c43){var _0x6f7149={'raw':!![],'where':{'id':_0x43a07d[_0x2d47('0x40')]['id']}},_0x164fee={};_0x164fee['model']=_[_0x2d47('0x2d')](db['VoiceQueuesLog'][_0x2d47('0x28')]);_0x164fee[_0x2d47('0x2e')]=_['keys'](_0x43a07d[_0x2d47('0x2e')]);_0x164fee[_0x2d47('0x2f')]=_[_0x2d47('0x30')](_0x164fee[_0x2d47('0x2c')],_0x164fee[_0x2d47('0x2e')]);_0x6f7149[_0x2d47('0x31')]=_['intersection'](_0x164fee[_0x2d47('0x2c')],qs[_0x2d47('0x32')](_0x43a07d[_0x2d47('0x2e')][_0x2d47('0x32')]));_0x6f7149['attributes']=_0x6f7149[_0x2d47('0x31')][_0x2d47('0x41')]?_0x6f7149[_0x2d47('0x31')]:_0x164fee[_0x2d47('0x2c')];if(_0x43a07d[_0x2d47('0x2e')][_0x2d47('0x3a')]){_0x6f7149['include']=[{'all':!![]}];}_0x6f7149=_[_0x2d47('0x42')]({},_0x6f7149,_0x43a07d[_0x2d47('0x38')]);return db[_0x2d47('0x27')][_0x2d47('0x43')](_0x6f7149)[_0x2d47('0x20')](handleEntityNotFound(_0x390c43,null))['then'](respondWithResult(_0x390c43,null))[_0x2d47('0x3e')](handleError(_0x390c43,null));};exports[_0x2d47('0x44')]=function(_0x17799e,_0x556642){return db['VoiceQueuesLog'][_0x2d47('0x44')](_0x17799e[_0x2d47('0x45')],{})['then'](respondWithResult(_0x556642,0xc9))[_0x2d47('0x3e')](handleError(_0x556642,null));};exports[_0x2d47('0x1f')]=function(_0x58529e,_0x910c){if(_0x58529e['body']['id']){delete _0x58529e[_0x2d47('0x45')]['id'];}return db[_0x2d47('0x27')][_0x2d47('0x43')]({'where':{'id':_0x58529e['params']['id']}})[_0x2d47('0x20')](handleEntityNotFound(_0x910c,null))[_0x2d47('0x20')](saveUpdates(_0x58529e[_0x2d47('0x45')],null))['then'](respondWithResult(_0x910c,null))[_0x2d47('0x3e')](handleError(_0x910c,null));};exports[_0x2d47('0x21')]=function(_0x2b0e91,_0x574db3){return db['VoiceQueuesLog'][_0x2d47('0x43')]({'where':{'id':_0x2b0e91[_0x2d47('0x40')]['id']}})[_0x2d47('0x20')](handleEntityNotFound(_0x574db3,null))[_0x2d47('0x20')](removeEntity(_0x574db3,null))[_0x2d47('0x3e')](handleError(_0x574db3,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 862f66b..5024008 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 _0xbf73=['request-promise','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','dtm','util','api','moment','bluebird'];(function(_0x4d7379,_0x4b4e63){var _0x46d7cf=function(_0x53f5f0){while(--_0x53f5f0){_0x4d7379['push'](_0x4d7379['shift']());}};_0x46d7cf(++_0x4b4e63);}(_0xbf73,0xac));var _0x3bf7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf73[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3bf7('0x0'));var logger=require('../../config/logger')(_0x3bf7('0x1'));var moment=require(_0x3bf7('0x2'));var BPromise=require(_0x3bf7('0x3'));var rp=require(_0x3bf7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3bf7('0x5'));var attributes=require(_0x3bf7('0x6'));module['exports']=function(_0x5d7d5f,_0x42d1b1){return _0x5d7d5f[_0x3bf7('0x7')](_0x3bf7('0x8'),attributes,{'tableName':_0x3bf7('0x9'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':['event',_0x3bf7('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x475f=['api','moment','bluebird','request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event','dtm','util'];(function(_0x25a6d8,_0x26442e){var _0x593edf=function(_0x1e4ecd){while(--_0x1e4ecd){_0x25a6d8['push'](_0x25a6d8['shift']());}};_0x593edf(++_0x26442e);}(_0x475f,0x99));var _0xf475=function(_0x3b6013,_0x346c0e){_0x3b6013=_0x3b6013-0x0;var _0x837aeb=_0x475f[_0x3b6013];return _0x837aeb;};'use strict';var _=require('lodash');var util=require(_0xf475('0x0'));var logger=require('../../config/logger')(_0xf475('0x1'));var moment=require(_0xf475('0x2'));var BPromise=require(_0xf475('0x3'));var rp=require(_0xf475('0x4'));var fs=require('fs');var path=require(_0xf475('0x5'));var rimraf=require(_0xf475('0x6'));var config=require('../../config/environment');var attributes=require(_0xf475('0x7'));module[_0xf475('0x8')]=function(_0x1c005e,_0x555911){return _0x1c005e[_0xf475('0x9')](_0xf475('0xa'),attributes,{'tableName':_0xf475('0xb'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xf475('0xc'),_0xf475('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index abfce5b..bcc95dc 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 _0x337f=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x59854b,_0xdaa8dd){var _0x363c6f=function(_0x421475){while(--_0x421475){_0x59854b['push'](_0x59854b['shift']());}};_0x363c6f(++_0xdaa8dd);}(_0x337f,0x11c));var _0xf337=function(_0x23b411,_0x8a755e){_0x23b411=_0x23b411-0x0;var _0x4d8915=_0x337f[_0x23b411];return _0x4d8915;};'use strict';var _=require(_0xf337('0x0'));var util=require(_0xf337('0x1'));var moment=require(_0xf337('0x2'));var BPromise=require('bluebird');var rs=require(_0xf337('0x3'));var fs=require('fs');var Redis=require(_0xf337('0x4'));var db=require(_0xf337('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf337('0x6'))(_0xf337('0x7'));var config=require('../../config/environment');var jayson=require(_0xf337('0x8'));var client=jayson['client'][_0xf337('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ae4d6,_0x2be604,_0x56bd39){return new BPromise(function(_0x4b80a2,_0x1f0a95){return client[_0xf337('0xa')](_0x5ae4d6,_0x56bd39)[_0xf337('0xb')](function(_0x2a4619){logger[_0xf337('0xc')](_0xf337('0xd'),_0x2be604,_0xf337('0xe'));logger[_0xf337('0xf')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x2be604,_0xf337('0xe'),JSON[_0xf337('0x10')](_0x2a4619));if(_0x2a4619[_0xf337('0x11')]){if(_0x2a4619[_0xf337('0x11')][_0xf337('0x12')]===0x1f4){logger[_0xf337('0x11')](_0xf337('0xd'),_0x2be604,_0x2a4619[_0xf337('0x11')][_0xf337('0x13')]);return _0x1f0a95(_0x2a4619[_0xf337('0x11')][_0xf337('0x13')]);}logger[_0xf337('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2be604,_0x2a4619[_0xf337('0x11')][_0xf337('0x13')]);return _0x4b80a2(_0x2a4619[_0xf337('0x11')]['message']);}else{logger[_0xf337('0xc')](_0xf337('0xd'),_0x2be604,'request\x20sent');_0x4b80a2(_0x2a4619[_0xf337('0x14')][_0xf337('0x13')]);}})[_0xf337('0x15')](function(_0x4a7e4c){logger[_0xf337('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2be604,_0x4a7e4c);_0x1f0a95(_0x4a7e4c);});});} \ No newline at end of file +var _0xc788=['request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','message','VoiceQueuesLog,\x20%s,\x20%s','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0xc788,0xc4));var _0x8c78=function(_0x1fb6ff,_0x474709){_0x1fb6ff=_0x1fb6ff-0x0;var _0x339f61=_0xc788[_0x1fb6ff];return _0x339f61;};'use strict';var _=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var moment=require(_0x8c78('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c78('0x3'));var db=require(_0x8c78('0x4'))['db'];var utils=require(_0x8c78('0x5'));var logger=require(_0x8c78('0x6'))(_0x8c78('0x7'));var config=require('../../config/environment');var jayson=require(_0x8c78('0x8'));var client=jayson[_0x8c78('0x9')][_0x8c78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ac27f,_0x205cc1,_0x4d54a5){return new BPromise(function(_0x247188,_0x299d9d){return client[_0x8c78('0xb')](_0x1ac27f,_0x4d54a5)[_0x8c78('0xc')](function(_0xdb0c17){logger[_0x8c78('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));logger['debug'](_0x8c78('0xf'),_0x205cc1,_0x8c78('0xe'),JSON['stringify'](_0xdb0c17));if(_0xdb0c17[_0x8c78('0x10')]){if(_0xdb0c17[_0x8c78('0x10')]['code']===0x1f4){logger[_0x8c78('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x205cc1,_0xdb0c17['error'][_0x8c78('0x11')]);return _0x299d9d(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);return _0x247188(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}else{logger[_0x8c78('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));_0x247188(_0xdb0c17[_0x8c78('0x13')]['message']);}})[_0x8c78('0x14')](function(_0x554464){logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0x554464);_0x299d9d(_0x554464);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 68c76d5..0dd5def 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 _0xbae4=['index','/describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','create','post','runTranscribe','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xbae4,0x160));var _0x4bae=function(_0x2fed2e,_0x25e703){_0x2fed2e=_0x2fed2e-0x0;var _0x2a0bff=_0xbae4[_0x2fed2e];return _0x2a0bff;};'use strict';var multer=require(_0x4bae('0x0'));var util=require(_0x4bae('0x1'));var path=require(_0x4bae('0x2'));var timeout=require(_0x4bae('0x3'));var express=require(_0x4bae('0x4'));var router=express['Router']();var fs_extra=require(_0x4bae('0x5'));var auth=require(_0x4bae('0x6'));var interaction=require(_0x4bae('0x7'));var config=require(_0x4bae('0x8'));var controller=require(_0x4bae('0x9'));router[_0x4bae('0xa')]('/',auth[_0x4bae('0xb')](),controller[_0x4bae('0xc')]);router['get'](_0x4bae('0xd'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x4bae('0xe'),auth[_0x4bae('0xb')](),controller[_0x4bae('0xf')]);router[_0x4bae('0xa')](_0x4bae('0x10'),auth[_0x4bae('0xb')](),controller[_0x4bae('0x11')]);router['get'](_0x4bae('0x12'),controller[_0x4bae('0x13')]);router['get'](_0x4bae('0x14'),auth[_0x4bae('0xb')](),controller[_0x4bae('0x15')]);router['post']('/',auth[_0x4bae('0xb')](),controller[_0x4bae('0x16')]);router[_0x4bae('0x17')](_0x4bae('0x14'),auth[_0x4bae('0xb')](),controller[_0x4bae('0x18')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4bae('0x19')]('/:id',auth[_0x4bae('0xb')](),controller[_0x4bae('0x1a')]);module[_0x4bae('0x1b')]=router; \ No newline at end of file +var _0x58dd=['get','post','create','/:id/transcribe','runTranscribe','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','/describe','/:id','show','/:id/download','download'];(function(_0x3e1f6a,_0x3a035d){var _0x21766a=function(_0xe9f36){while(--_0xe9f36){_0x3e1f6a['push'](_0x3e1f6a['shift']());}};_0x21766a(++_0x3a035d);}(_0x58dd,0x15b));var _0xd58d=function(_0x69d40a,_0x3b0212){_0x69d40a=_0x69d40a-0x0;var _0x5606f4=_0x58dd[_0x69d40a];return _0x5606f4;};'use strict';var multer=require(_0xd58d('0x0'));var util=require(_0xd58d('0x1'));var path=require(_0xd58d('0x2'));var timeout=require(_0xd58d('0x3'));var express=require(_0xd58d('0x4'));var router=express[_0xd58d('0x5')]();var fs_extra=require(_0xd58d('0x6'));var auth=require(_0xd58d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd58d('0x8'));var controller=require(_0xd58d('0x9'));router['get']('/',auth[_0xd58d('0xa')](),controller[_0xd58d('0xb')]);router['get'](_0xd58d('0xc'),auth[_0xd58d('0xa')](),controller['describe']);router['get'](_0xd58d('0xd'),auth[_0xd58d('0xa')](),controller[_0xd58d('0xe')]);router['get'](_0xd58d('0xf'),auth[_0xd58d('0xa')](),controller[_0xd58d('0x10')]);router[_0xd58d('0x11')]('/:id/downloads',controller['downloads']);router['get']('/:id/transcribe',auth[_0xd58d('0xa')](),controller['downloadTranscribe']);router[_0xd58d('0x12')]('/',auth[_0xd58d('0xa')](),controller[_0xd58d('0x13')]);router[_0xd58d('0x12')](_0xd58d('0x14'),auth['isAuthenticated'](),controller[_0xd58d('0x15')]);router[_0xd58d('0x16')](_0xd58d('0xd'),auth['isAuthenticated'](),controller[_0xd58d('0x17')]);router['delete'](_0xd58d('0xd'),auth['isAuthenticated'](),controller[_0xd58d('0x18')]);module[_0xd58d('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index a2e97bb..73ff598 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 _0xeff7=['STRING','setDataValue','membername','split','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','exports','getDataValue','extname'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xeff7,0x1e9));var _0x7eff=function(_0x5c83a4,_0x2f68f2){_0x5c83a4=_0x5c83a4-0x0;var _0x424356=_0xeff7[_0x5c83a4];return _0x424356;};'use strict';var Sequelize=require(_0x7eff('0x0'));var moment=require(_0x7eff('0x1'));var path=require('path');module[_0x7eff('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x7eff('0x3')]('value')?path[_0x7eff('0x4')](this[_0x7eff('0x3')]('value')):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7eff('0x5')],'set':function(_0x1e05e9){if(_0x1e05e9){this['setDataValue']('channel',_0x1e05e9);this[_0x7eff('0x6')](_0x7eff('0x7'),_0x1e05e9[_0x7eff('0x8')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x7eff('0x5')]},'calleridnum':{'type':Sequelize[_0x7eff('0x5')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x7eff('0x5')]},'connectedlinename':{'type':Sequelize[_0x7eff('0x5')]},'accountcode':{'type':Sequelize[_0x7eff('0x5')]},'context':{'type':Sequelize[_0x7eff('0x5')]},'exten':{'type':Sequelize[_0x7eff('0x5')]},'value':{'type':Sequelize[_0x7eff('0x5')]},'type':{'type':Sequelize[_0x7eff('0x5')]},'rating':{'type':Sequelize[_0x7eff('0x9')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x7eff('0x5')]},'userDisposition':{'type':Sequelize[_0x7eff('0x5')]},'userSecondDisposition':{'type':Sequelize[_0x7eff('0x5')]},'userThirdDisposition':{'type':Sequelize[_0x7eff('0x5')]},'location':{'type':Sequelize[_0x7eff('0xa')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize[_0x7eff('0x5')],'defaultValue':_0x7eff('0xb')},'fileUri':{'type':Sequelize[_0x7eff('0xa')]},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0x7eff('0x5')]},'sPositive':{'type':Sequelize[_0x7eff('0xc')]},'sNegative':{'type':Sequelize['FLOAT']},'sNeutral':{'type':Sequelize[_0x7eff('0xc')]},'sMixed':{'type':Sequelize[_0x7eff('0xc')]},'tempSentiment':{'type':Sequelize[_0x7eff('0xd')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x7eff('0x3')](_0x7eff('0xe')))[_0x7eff('0xf')](_0x7eff('0x10'))[_0x7eff('0x11')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x7eff('0x3')](_0x7eff('0x12')))[_0x7eff('0xf')](_0x7eff('0x10'))[_0x7eff('0x11')]();}}}; \ No newline at end of file +var _0x6528=['toString','sequelize','moment','path','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','channel','membername','TEXT','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm','DATE','updatedAt'];(function(_0x12fe86,_0x57ec8d){var _0x3c528b=function(_0x497daf){while(--_0x497daf){_0x12fe86['push'](_0x12fe86['shift']());}};_0x3c528b(++_0x57ec8d);}(_0x6528,0x73));var _0x8652=function(_0x58f904,_0x4d2646){_0x58f904=_0x58f904-0x0;var _0x3e35ef=_0x6528[_0x58f904];return _0x3e35ef;};'use strict';var Sequelize=require(_0x8652('0x0'));var moment=require(_0x8652('0x1'));var path=require(_0x8652('0x2'));module['exports']={'format':{'type':Sequelize[_0x8652('0x3')],'get':function(){return this[_0x8652('0x4')](_0x8652('0x5'))?path[_0x8652('0x6')](this[_0x8652('0x4')](_0x8652('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x8652('0x7')]},'channel':{'type':Sequelize[_0x8652('0x7')],'set':function(_0x252a61){if(_0x252a61){this[_0x8652('0x8')](_0x8652('0x9'),_0x252a61);this[_0x8652('0x8')](_0x8652('0xa'),_0x252a61['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x8652('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x8652('0x7')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8652('0x7')]},'exten':{'type':Sequelize[_0x8652('0x7')]},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8652('0x7')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x8652('0x7')]},'userDisposition':{'type':Sequelize[_0x8652('0x7')]},'userSecondDisposition':{'type':Sequelize[_0x8652('0x7')]},'userThirdDisposition':{'type':Sequelize[_0x8652('0x7')]},'location':{'type':Sequelize['TEXT']},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':'NEW'},'fileUri':{'type':Sequelize[_0x8652('0xb')]},'fileText':{'type':Sequelize[_0x8652('0xb')]},'failureReason':{'type':Sequelize[_0x8652('0xb')]},'sentiment':{'type':Sequelize[_0x8652('0x7')]},'sPositive':{'type':Sequelize[_0x8652('0xc')]},'sNegative':{'type':Sequelize[_0x8652('0xc')]},'sNeutral':{'type':Sequelize[_0x8652('0xc')]},'sMixed':{'type':Sequelize[_0x8652('0xc')]},'tempSentiment':{'type':Sequelize[_0x8652('0xd')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('createdAt'))[_0x8652('0xe')](_0x8652('0xf'))['toString']();}},'updatedAt':{'type':Sequelize[_0x8652('0x10')],'get':function(){return moment(this[_0x8652('0x4')](_0x8652('0x11')))[_0x8652('0xe')](_0x8652('0xf'))[_0x8652('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 7546e5c..c6487be 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 _0x9503=['merge','map','VIRTUAL','options','count','includeAll','findAll','show','params','intersection','include','find','catch','create','body','update','describe','download','uniqueid','value','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','send','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','col','$and','push','recording','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','unlinkSync','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','then','destroy','stack','name','index','VoiceRecording','rawAttributes','fieldName','type','differenceBy','keys','query','filters','model','fields','attributes','length','nolimit','order','sort','where','pick','filter'];(function(_0x51d907,_0x40c9f6){var _0x4595d8=function(_0x745767){while(--_0x745767){_0x51d907['push'](_0x51d907['shift']());}};_0x4595d8(++_0x40c9f6);}(_0x9503,0xf7));var _0x3950=function(_0x2d740c,_0x2b7b60){_0x2d740c=_0x2d740c-0x0;var _0x5ad865=_0x9503[_0x2d740c];return _0x5ad865;};'use strict';var emlformat=require(_0x3950('0x0'));var rimraf=require(_0x3950('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3950('0x2'));var rp=require(_0x3950('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3950('0x4'));var util=require(_0x3950('0x5'));var path=require(_0x3950('0x6'));var sox=require(_0x3950('0x7'));var csv=require(_0x3950('0x8'));var ejs=require(_0x3950('0x9'));var fs=require('fs');var fs_extra=require(_0x3950('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3950('0xb'));var jsforce=require(_0x3950('0xc'));var deskjs=require(_0x3950('0xd'));var toCsv=require(_0x3950('0x8'));var querystring=require(_0x3950('0xe'));var Papa=require(_0x3950('0xf'));var AWS=require(_0x3950('0x10'));var uuidv4=require(_0x3950('0x11'));var Redis=require(_0x3950('0x12'));var authService=require(_0x3950('0x13'));var qs=require(_0x3950('0x14'));var as=require(_0x3950('0x15'));var hardwareService=require(_0x3950('0x16'));var logger=require('../../config/logger')(_0x3950('0x17'));var utils=require(_0x3950('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3950('0x19'))['db'];function respondWithStatusCode(_0x1545c0,_0x4a2c34){_0x4a2c34=_0x4a2c34||0xcc;return function(_0x577861){if(_0x577861){return _0x1545c0[_0x3950('0x1a')](_0x4a2c34);}return _0x1545c0[_0x3950('0x1b')](_0x4a2c34)[_0x3950('0x1c')]();};}function respondWithResult(_0x10d928,_0x399a8a){_0x399a8a=_0x399a8a||0xc8;return function(_0x1228f8){if(_0x1228f8){return _0x10d928[_0x3950('0x1b')](_0x399a8a)[_0x3950('0x1d')](_0x1228f8);}};}function respondWithFilteredResult(_0x4d2d7f,_0x341556){return function(_0x557fe3){if(_0x557fe3){var _0x27e43a=_0x557fe3['count'],_0x54411d=_0x341556[_0x3950('0x1e')],_0x15aaa3=_0x341556[_0x3950('0x1e')]+_0x341556[_0x3950('0x1f')],_0x2270d9;if(_0x15aaa3>=_0x27e43a){_0x15aaa3=_0x27e43a;_0x2270d9=0xc8;}else{_0x2270d9=0xce;}_0x4d2d7f[_0x3950('0x1b')](_0x2270d9);return _0x4d2d7f[_0x3950('0x20')](_0x3950('0x21'),_0x54411d+'-'+_0x15aaa3+'/'+_0x27e43a)['json'](_0x557fe3);}return null;};}function patchUpdates(_0x3c11d1){return function(_0x506442){try{jsonpatch[_0x3950('0x22')](_0x506442,_0x3c11d1,!![]);}catch(_0x49c758){return BPromise[_0x3950('0x23')](_0x49c758);}return _0x506442['save']();};}function saveUpdates(_0x4b1c3a,_0x1ed7d6){return function(_0xe3e97e){if(_0xe3e97e){return _0xe3e97e['update'](_0x4b1c3a)[_0x3950('0x24')](function(_0x34bc52){return _0x34bc52;});}return null;};}function removeEntity(_0x48dd38,_0x3323ed){return function(_0x44dff4){if(_0x44dff4){return _0x44dff4[_0x3950('0x25')]()[_0x3950('0x24')](function(){_0x48dd38[_0x3950('0x1b')](0xcc)[_0x3950('0x1c')]();});}};}function handleEntityNotFound(_0x5d0ec2,_0x359467){return function(_0x177350){if(!_0x177350){_0x5d0ec2[_0x3950('0x1a')](0x194);}return _0x177350;};}function handleError(_0x2a8665,_0x5d5e14){_0x5d5e14=_0x5d5e14||0x1f4;return function(_0x5364b1){logger['error'](_0x5364b1[_0x3950('0x26')]);if(_0x5364b1[_0x3950('0x27')]){delete _0x5364b1[_0x3950('0x27')];}_0x2a8665[_0x3950('0x1b')](_0x5d5e14)['send'](_0x5364b1);};}exports[_0x3950('0x28')]=function(_0x304404,_0x303f9f){var _0x22ec60={},_0x423985={},_0x53ab6c={'count':0x0,'rows':[]};var _0x300819=_['map'](db[_0x3950('0x29')][_0x3950('0x2a')],function(_0x3a35d5){return{'name':_0x3a35d5[_0x3950('0x2b')],'type':_0x3a35d5[_0x3950('0x2c')]['key']};});_0x423985['model']=_[_0x3950('0x2d')](_['map'](_0x300819,_0x3950('0x27')),['format']);_0x423985['query']=_[_0x3950('0x2e')](_0x304404[_0x3950('0x2f')]);_0x423985[_0x3950('0x30')]=_['intersection'](_0x423985[_0x3950('0x31')],_0x423985[_0x3950('0x2f')]);_0x22ec60['attributes']=_['intersection'](_0x423985[_0x3950('0x31')],qs['fields'](_0x304404['query'][_0x3950('0x32')]));_0x22ec60[_0x3950('0x33')]=_0x22ec60['attributes'][_0x3950('0x34')]?_0x22ec60[_0x3950('0x33')]:_0x423985['model'];if(!_0x304404[_0x3950('0x2f')]['hasOwnProperty'](_0x3950('0x35'))){_0x22ec60[_0x3950('0x1f')]=qs[_0x3950('0x1f')](_0x304404[_0x3950('0x2f')][_0x3950('0x1f')]);_0x22ec60[_0x3950('0x1e')]=qs[_0x3950('0x1e')](_0x304404[_0x3950('0x2f')][_0x3950('0x1e')]);}_0x22ec60[_0x3950('0x36')]=qs[_0x3950('0x37')](_0x304404[_0x3950('0x2f')][_0x3950('0x37')]);_0x22ec60[_0x3950('0x38')]=qs[_0x3950('0x30')](_[_0x3950('0x39')](_0x304404['query'],_0x423985[_0x3950('0x30')]),_0x300819);if(_0x304404['query'][_0x3950('0x3a')]){_0x22ec60[_0x3950('0x38')]=_[_0x3950('0x3b')](_0x22ec60[_0x3950('0x38')],{'$or':_[_0x3950('0x3c')](_0x300819,function(_0xc09327){if(_0xc09327[_0x3950('0x2c')]!==_0x3950('0x3d')){var _0x2f729e={};_0x2f729e[_0xc09327[_0x3950('0x27')]]={'$like':'%'+_0x304404[_0x3950('0x2f')][_0x3950('0x3a')]+'%'};return _0x2f729e;}})});}_0x22ec60=_['merge']({},_0x22ec60,_0x304404[_0x3950('0x3e')]);var _0x10361e={'where':_0x22ec60['where']};return db[_0x3950('0x29')][_0x3950('0x3f')](_0x10361e)[_0x3950('0x24')](function(_0x3974ec){_0x53ab6c[_0x3950('0x3f')]=_0x3974ec;if(_0x304404['query'][_0x3950('0x40')]){_0x22ec60['include']=[{'all':!![]}];}return db[_0x3950('0x29')][_0x3950('0x41')](_0x22ec60);})[_0x3950('0x24')](function(_0x2e00a5){_0x53ab6c['rows']=_0x2e00a5;return _0x53ab6c;})[_0x3950('0x24')](respondWithFilteredResult(_0x303f9f,_0x22ec60))['catch'](handleError(_0x303f9f,null));};exports[_0x3950('0x42')]=function(_0x4a1ef6,_0x355a87){var _0x7b0553={'raw':![],'where':{'id':_0x4a1ef6[_0x3950('0x43')]['id']}},_0x150787={};_0x150787[_0x3950('0x31')]=_[_0x3950('0x2e')](db[_0x3950('0x29')][_0x3950('0x2a')]);_0x150787[_0x3950('0x2f')]=_[_0x3950('0x2e')](_0x4a1ef6[_0x3950('0x2f')]);_0x150787[_0x3950('0x30')]=_[_0x3950('0x44')](_0x150787[_0x3950('0x31')],_0x150787[_0x3950('0x2f')]);_0x7b0553['attributes']=_[_0x3950('0x44')](_0x150787[_0x3950('0x31')],qs[_0x3950('0x32')](_0x4a1ef6[_0x3950('0x2f')][_0x3950('0x32')]));_0x7b0553[_0x3950('0x33')]=_0x7b0553[_0x3950('0x33')][_0x3950('0x34')]?_0x7b0553[_0x3950('0x33')]:_0x150787[_0x3950('0x31')];if(_0x4a1ef6[_0x3950('0x2f')][_0x3950('0x40')]){_0x7b0553[_0x3950('0x45')]=[{'all':!![]}];}_0x7b0553=_['merge']({},_0x7b0553,_0x4a1ef6['options']);return db['VoiceRecording'][_0x3950('0x46')](_0x7b0553)[_0x3950('0x24')](handleEntityNotFound(_0x355a87,null))['then'](respondWithResult(_0x355a87,null))[_0x3950('0x47')](handleError(_0x355a87,null));};exports[_0x3950('0x48')]=function(_0x2ddb49,_0xb1eb0f){return db['VoiceRecording'][_0x3950('0x48')](_0x2ddb49[_0x3950('0x49')],{})[_0x3950('0x24')](respondWithResult(_0xb1eb0f,0xc9))[_0x3950('0x47')](handleError(_0xb1eb0f,null));};exports[_0x3950('0x4a')]=function(_0x50b294,_0x3d25cc){if(_0x50b294['body']['id']){delete _0x50b294[_0x3950('0x49')]['id'];}return db[_0x3950('0x29')][_0x3950('0x46')]({'where':{'id':_0x50b294[_0x3950('0x43')]['id']}})['then'](handleEntityNotFound(_0x3d25cc,null))[_0x3950('0x24')](saveUpdates(_0x50b294[_0x3950('0x49')],null))[_0x3950('0x24')](respondWithResult(_0x3d25cc,null))[_0x3950('0x47')](handleError(_0x3d25cc,null));};exports[_0x3950('0x4b')]=function(_0x4a09fa,_0x3d9fee){return db[_0x3950('0x29')]['describe']()[_0x3950('0x24')](respondWithResult(_0x3d9fee,null))[_0x3950('0x47')](handleError(_0x3d9fee,null));};exports[_0x3950('0x4c')]=function(_0x3c1ca7,_0x1117e1,_0x10e965){var _0x323ee0=require('../../components/encryptor');var _0xa82042=![];var _0x214d8e={};if(_0x3c1ca7[_0x3950('0x2f')][_0x3950('0x2c')]&&_0x3c1ca7[_0x3950('0x2f')][_0x3950('0x2c')]===_0x3950('0x4d')){_0x214d8e[_0x3950('0x4d')]=_0x3c1ca7['params']['id'];}else{_0x214d8e['id']=_0x3c1ca7['params']['id'];}return db['VoiceRecording'][_0x3950('0x46')]({'where':_0x214d8e,'attributes':['id',_0x3950('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x1117e1,null))[_0x3950('0x24')](function(_0x232605){if(_0x232605){var _0xdd601c=_0x232605[_0x3950('0x4e')];var _0x4d35db=util[_0x3950('0x4f')](_0x3950('0x50'),_0xdd601c);if(fs[_0x3950('0x51')](_0x4d35db)){_0xa82042=!![];return _0x323ee0[_0x3950('0x52')](_0x4d35db,_0xdd601c,config[_0x3950('0x53')]['recording'])[_0x3950('0x24')](function(){return _0x232605;});}return _0x232605;}})[_0x3950('0x24')](function(_0x5e6ad4){if(_0x5e6ad4){var _0x3f9c7f=_0x5e6ad4['value'];if(!fs['existsSync'](_0x3f9c7f)){throw new db[(_0x3950('0x54'))][(_0x3950('0x55'))](_0x3950('0x56'));}if(_0x5e6ad4[_0x3950('0x57')]){return _0x1117e1['download'](_0x3f9c7f,_0x5e6ad4[_0x3950('0x57')]+path[_0x3950('0x58')](_0x3f9c7f),function(){if(_0xa82042){fs[_0x3950('0x59')](_0x3f9c7f);}});}else{return _0x1117e1[_0x3950('0x4c')](_0x3f9c7f,function(_0x5a1cfe){if(_0xa82042){fs[_0x3950('0x59')](_0x3f9c7f);}});}}})[_0x3950('0x47')](function(_0x23b502){if(_0x23b502['message']==='VoiceRecording\x20not\x20found'){_0x1117e1[_0x3950('0x1b')](0x194)[_0x3950('0x5a')](_0x3950('0x5b'));}else{return handleError(_0x1117e1,null);}});};exports[_0x3950('0x5c')]=function(_0x5e4002,_0x3053b7,_0x46b953){var _0x1748a5=require(_0x3950('0x5d'));var _0x4a2487=![];var _0x72a5c8={'$and':[db[_0x3950('0x5e')][_0x3950('0x38')](db[_0x3950('0x5e')]['fn'](_0x3950('0x5f'),db[_0x3950('0x5e')][_0x3950('0x60')](_0x3950('0x4d'))),_0x5e4002[_0x3950('0x2f')]['token'])]};if(_0x5e4002[_0x3950('0x2f')][_0x3950('0x2c')]&&_0x5e4002['query'][_0x3950('0x2c')]===_0x3950('0x4d')){_0x72a5c8[_0x3950('0x61')][_0x3950('0x62')]({'uniqueid':_0x5e4002[_0x3950('0x43')]['id']});}else{_0x72a5c8['$and'][_0x3950('0x62')]({'id':_0x5e4002[_0x3950('0x43')]['id']});}return db[_0x3950('0x29')]['find']({'where':_0x72a5c8,'attributes':['id',_0x3950('0x4e')],'raw':!![]})[_0x3950('0x24')](handleEntityNotFound(_0x3053b7,null))[_0x3950('0x24')](function(_0xe6235f){if(_0xe6235f){var _0x59b84a=util[_0x3950('0x4f')](_0x3950('0x50'),_0xe6235f[_0x3950('0x4e')]);if(fs[_0x3950('0x51')](_0x59b84a)){_0x4a2487=!![];return _0x1748a5[_0x3950('0x52')](_0x59b84a,_0xe6235f[_0x3950('0x4e')],config[_0x3950('0x53')][_0x3950('0x63')])['then'](function(){return _0xe6235f;});}return _0xe6235f;}})[_0x3950('0x24')](function(_0x529483){if(_0x529483){if(!fs[_0x3950('0x51')](_0x529483[_0x3950('0x4e')])){throw new db[(_0x3950('0x54'))][(_0x3950('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x529483[_0x3950('0x57')]){return _0x3053b7[_0x3950('0x4c')](_0x529483['value'],_0x529483[_0x3950('0x57')]+path[_0x3950('0x58')](_0x529483[_0x3950('0x4e')]),function(){if(_0x4a2487){fs[_0x3950('0x59')](_0x529483[_0x3950('0x4e')]);}});}else{return _0x3053b7['download'](_0x529483[_0x3950('0x4e')],function(_0x53e1cc){if(_0x4a2487){fs['unlink'](_0x529483[_0x3950('0x4e')]);}});}}})[_0x3950('0x47')](handleError(_0x3053b7,null));};exports[_0x3950('0x25')]=function(_0x33369b,_0x4ab636){return db[_0x3950('0x29')][_0x3950('0x46')]({'where':{'id':_0x33369b[_0x3950('0x43')]['id']}})['then'](function(_0x550be0){if(!_0x550be0)throw new ReferenceError(_0x3950('0x64'));return _0x550be0;})[_0x3950('0x24')](function(_0x1f02b1){var _0x1e85df=_0x1f02b1[_0x3950('0x4e')];logger['info'](_0x3950('0x65'),_0x1e85df);if(!_[_0x3950('0x66')](_0x1f02b1['value'])&&fs[_0x3950('0x51')](_0x1e85df)){logger[_0x3950('0x67')](_0x3950('0x68')+_0x1e85df+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x3950('0x69')](_0x1e85df);}_0x1e85df=_0x1e85df+'.cypher';if(!_[_0x3950('0x66')](_0x1f02b1[_0x3950('0x4e')])&&fs[_0x3950('0x51')](_0x1e85df)){logger['info'](_0x3950('0x68')+_0x1e85df+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x3950('0x69')](_0x1e85df);}return _0x1f02b1;})[_0x3950('0x24')](function(_0x2d8f33){if(!_0x2d8f33)throw new InternalError();return _0x2d8f33[_0x3950('0x25')]();})[_0x3950('0x24')](function(){_0x4ab636[_0x3950('0x1b')](0xcc)[_0x3950('0x1c')]();})[_0x3950('0x47')](handleError(_0x4ab636,null));};function getBucketslist(_0x271884,_0x4faecb,_0x1a0a97){return new Promise(function(_0x58fffb,_0x184780){var _0x305584=new AWS['S3']({'accessKeyId':_0x4faecb,'secretAccessKey':_0x271884,'region':_0x1a0a97});_0x305584['listBuckets']({},function(_0x5b61a3,_0x536e55){if(_0x5b61a3){return _0x184780(_0x5b61a3);}else{return _0x58fffb(_0x536e55);}});});}function createBucket(_0x3d8608,_0x6ca949,_0x65d32c,_0x1759c4){return new Promise(function(_0x3704e7,_0x41cbb9){var _0x544969=new AWS['S3']({'accessKeyId':_0x6ca949,'secretAccessKey':_0x3d8608,'region':_0x65d32c});_0x544969[_0x3950('0x6a')]({'Bucket':_0x1759c4},function(_0x49acc5,_0x117bb4){if(_0x49acc5){return _0x41cbb9(_0x49acc5);}else{return _0x3704e7(_0x117bb4);}});});}function uploadFile(_0x50ca01,_0x3d0dc1,_0x1c2162,_0x58f6b4,_0x352b45,_0x587215){return new Promise(function(_0x2443d8,_0x40430d){var _0xe7d42b=new AWS['S3']({'accessKeyId':_0x3d0dc1,'secretAccessKey':_0x50ca01,'region':_0x1c2162});_0xe7d42b[_0x3950('0x6b')]({'Bucket':_0x58f6b4,'Key':_0x352b45,'Body':_0x587215},function(_0x44dac4,_0x177f49){if(_0x44dac4){return _0x40430d(_0x44dac4);}else{return _0x2443d8(_0x177f49);}});});}function startTranscribe(_0x425cc9,_0x5e3805,_0x5c30fe,_0x29e350,_0x1d96d9,_0x527743){return new Promise(function(_0x1cd230,_0x39fca7){var _0x53e42b=new AWS['TranscribeService']({'accessKeyId':_0x5e3805,'secretAccessKey':_0x425cc9,'region':_0x5c30fe});_0x53e42b[_0x3950('0x6c')]({'TranscriptionJobName':_0x29e350,'LanguageCode':_0x1d96d9,'Media':{'MediaFileUri':_0x527743}},function(_0x32ffb7,_0x2f640f){if(_0x32ffb7){return _0x39fca7(_0x32ffb7);}else{return _0x1cd230(_0x2f640f);}});});}function transcribe(_0xef0e34,_0x3dedc3,_0x488898,_0x4c3168,_0x1993a0,_0x49ab1b,_0x1af47b){return new Promise(function(_0x3f433a,_0x3d0db2){var _0x3e575f={};logger[_0x3950('0x67')](util['format'](_0x3950('0x6d'),_0xef0e34,_0x1993a0));return uploadFile(_0x3dedc3,_0x488898,_0x4c3168,_0x1993a0,path['basename'](_0x49ab1b),fs[_0x3950('0x6e')](_0x49ab1b))[_0x3950('0x24')](function(_0x1d81f8){logger[_0x3950('0x67')](util[_0x3950('0x4f')](_0x3950('0x6f'),_0xef0e34,_0x1993a0,_0x1d81f8[_0x3950('0x70')]));_0x3e575f[_0x3950('0x71')]=_0x1d81f8[_0x3950('0x72')];_0x3e575f[_0x3950('0x73')]=_0x1d81f8[_0x3950('0x70')];logger[_0x3950('0x67')](util[_0x3950('0x4f')](_0x3950('0x74'),_0xef0e34));return startTranscribe(_0x3dedc3,_0x488898,_0x4c3168,uuidv4(),_0x1af47b,_0x1d81f8[_0x3950('0x70')]);})[_0x3950('0x24')](function(_0x559871){logger[_0x3950('0x67')](util[_0x3950('0x4f')](_0x3950('0x75'),_0xef0e34,_0x559871[_0x3950('0x76')][_0x3950('0x77')]));_0x3e575f[_0x3950('0x78')]=_0x559871[_0x3950('0x76')]['TranscriptionJobName'];_0x3e575f[_0x3950('0x79')]=_0x559871['TranscriptionJob'][_0x3950('0x7a')];return _0x3f433a(_0x3e575f);})[_0x3950('0x47')](function(_0x5bb7d8){return _0x3d0db2(_0x5bb7d8);});});}exports[_0x3950('0x7b')]=function(_0x347138,_0x22885f,_0x2ef984){var _0x564027;var _0x43825a;var _0x4bd4b4;var _0x3f555e=require(_0x3950('0x5d'));return db['VoiceRecording'][_0x3950('0x7c')]({'where':{'id':_0x347138[_0x3950('0x43')]['id']}})[_0x3950('0x24')](function(_0x4bf564){if(_0x4bf564){var _0x284d3c=util[_0x3950('0x4f')](_0x3950('0x50'),_0x4bf564[_0x3950('0x4e')]);if(fs[_0x3950('0x51')](_0x284d3c)){cypher=!![];return _0x3f555e[_0x3950('0x52')](_0x284d3c,_0x4bf564['value'],config['secrets']['recording'])[_0x3950('0x24')](function(){return _0x4bf564;});}return _0x4bf564;}})[_0x3950('0x24')](function(_0xa62f13){if(!_0xa62f13){throw new db['Sequelize'][(_0x3950('0x55'))](_0x3950('0x7d'));}_0x43825a=_0xa62f13;return db[_0x3950('0x7e')]['findOne']({'where':{'id':0x1}});})[_0x3950('0x24')](handleEntityNotFound(_0x22885f,null))[_0x3950('0x24')](function(_0x3931ee){if(_0x3931ee){_0x564027=_0x3931ee;if(!_0x564027['transcribe']||!_0x564027[_0x3950('0x7f')]||!_0x564027[_0x3950('0x80')]||!_0x564027[_0x3950('0x81')]||!_0x564027[_0x3950('0x71')]){throw new db['Sequelize'][(_0x3950('0x55'))](_0x3950('0x82'));}if(_0x347138[_0x3950('0x49')][_0x3950('0x83')]&&(!_0x564027[_0x3950('0x84')]||!_0x564027[_0x3950('0x85')]||!_0x564027[_0x3950('0x86')]||!_0x564027['language']||!_0x564027[_0x3950('0x71')])){throw new db['Sequelize'][(_0x3950('0x55'))](_0x3950('0x87'));}return db[_0x3950('0x88')][_0x3950('0x7c')]({'where':{'id':_0x564027[_0x3950('0x7f')]}});}})[_0x3950('0x24')](function(_0x20d1bb){if(!_0x20d1bb){throw new db[(_0x3950('0x54'))][(_0x3950('0x55'))](_0x3950('0x89'));}if(!_0x20d1bb[_0x3950('0x8a')]||!_0x20d1bb[_0x3950('0x8b')]){throw new db[(_0x3950('0x54'))][(_0x3950('0x55'))]('Cloud\x20Provider\x20not\x20configured');}_0x4bd4b4=_0x20d1bb;return getBucketslist(_0x4bd4b4[_0x3950('0x8a')],_0x4bd4b4[_0x3950('0x8b')],_0x564027['transcribeRegion']);})[_0x3950('0x24')](function(_0x4eeca5){if(_0x4eeca5&&_0x4eeca5['Buckets']){var _0x3ae0b8=_['find'](_0x4eeca5[_0x3950('0x8c')],function(_0x10aeec){return _0x10aeec[_0x3950('0x8d')]===_0x564027[_0x3950('0x71')];});if(!_0x3ae0b8){logger[_0x3950('0x67')](util[_0x3950('0x4f')](_0x3950('0x8e'),_0x347138[_0x3950('0x43')]['id'],_0x564027[_0x3950('0x71')]));return createBucket(_0x4bd4b4[_0x3950('0x8a')],_0x4bd4b4['data2'],_0x564027[_0x3950('0x80')],_0x564027['bucket']);}logger[_0x3950('0x67')](util['format'](_0x3950('0x8f'),_0x347138[_0x3950('0x43')]['id'],_0x564027[_0x3950('0x71')]));return;}})[_0x3950('0x24')](function(_0x51c849){if(_0x43825a['transcribeStatus']===_0x3950('0x90')){return transcribe(_0x347138[_0x3950('0x43')]['id'],_0x4bd4b4[_0x3950('0x8a')],_0x4bd4b4[_0x3950('0x8b')],_0x564027[_0x3950('0x80')],_0x564027[_0x3950('0x71')],_0x43825a['value'],_0x564027[_0x3950('0x81')]);}else{logger['info'](util[_0x3950('0x4f')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x347138[_0x3950('0x43')]['id']));return{'transcribeStatus':_0x3950('0x91')};}})['then'](function(_0x46f30a){if(_0x46f30a){_0x46f30a[_0x3950('0x92')]=_0x347138[_0x3950('0x49')][_0x3950('0x83')];return _0x43825a['updateAttributes'](_0x46f30a);}})[_0x3950('0x24')](respondWithResult(_0x22885f,null))['catch'](handleError(_0x22885f,null));};function writeFile(_0x2b117f,_0x449b21){return new Promise(function(_0x4c7c6f,_0x37c4f4){fs[_0x3950('0x93')](_0x449b21,_0x2b117f,function(_0x5acc81,_0x3a205e){if(_0x5acc81){return _0x37c4f4(_0x5acc81);}else{return _0x4c7c6f(_0x3a205e);}});});}exports[_0x3950('0x94')]=function(_0x4111b0,_0x46698e,_0x23779d){return db['VoiceRecording'][_0x3950('0x7c')]({'where':{'id':_0x4111b0[_0x3950('0x43')]['id']}})[_0x3950('0x24')](handleEntityNotFound(_0x46698e))[_0x3950('0x24')](function(_0x7b4488){if(_0x7b4488&&_0x7b4488[_0x3950('0x95')]){var _0x2289e9=_0x7b4488[_0x3950('0x95')];var _0x464e7a=config[_0x3950('0x96')]+_0x3950('0x97')+_0x7b4488['id']+'.txt';if(fs[_0x3950('0x51')](_0x464e7a)){return _0x464e7a;}return writeFile(_0x2289e9,_0x464e7a)['then'](function(){return _0x464e7a;});}else{throw new db['Sequelize'][(_0x3950('0x55'))](_0x3950('0x98'));}})[_0x3950('0x24')](function(_0x5ddb52){return _0x46698e[_0x3950('0x4c')](_0x5ddb52);})[_0x3950('0x47')](handleError(_0x46698e));}; \ No newline at end of file +var _0xf680=['Not\x20found','sequelize','MD5','col','token','$and','push','extname','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','createBucket','TranscribeService','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','runTranscribe','findOne','decryptFile','recording','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','json','save','update','then','destroy','sendStatus','error','stack','name','send','index','VoiceRecording','rawAttributes','type','model','differenceBy','map','format','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','secrets','existsSync','Sequelize','ValidationError','filename','unlink','VoiceRecording\x20not\x20found'];(function(_0x20b6db,_0xed91b3){var _0x227d1d=function(_0x1e5153){while(--_0x1e5153){_0x20b6db['push'](_0x20b6db['shift']());}};_0x227d1d(++_0xed91b3);}(_0xf680,0x160));var _0x0f68=function(_0x21c814,_0x5ce2d2){_0x21c814=_0x21c814-0x0;var _0x4df500=_0xf680[_0x21c814];return _0x4df500;};'use strict';var emlformat=require(_0x0f68('0x0'));var rimraf=require(_0x0f68('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0f68('0x2'));var rp=require(_0x0f68('0x3'));var moment=require(_0x0f68('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0f68('0x5'));var util=require('util');var path=require(_0x0f68('0x6'));var sox=require(_0x0f68('0x7'));var csv=require(_0x0f68('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f68('0x9'));var _=require(_0x0f68('0xa'));var squel=require(_0x0f68('0xb'));var crypto=require(_0x0f68('0xc'));var jsforce=require(_0x0f68('0xd'));var deskjs=require(_0x0f68('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0f68('0xf'));var Papa=require('papaparse');var AWS=require(_0x0f68('0x10'));var uuidv4=require('uuid/v4');var Redis=require(_0x0f68('0x11'));var authService=require(_0x0f68('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0f68('0x13'));var hardwareService=require(_0x0f68('0x14'));var logger=require(_0x0f68('0x15'))(_0x0f68('0x16'));var utils=require(_0x0f68('0x17'));var config=require(_0x0f68('0x18'));var licenseUtil=require(_0x0f68('0x19'));var db=require(_0x0f68('0x1a'))['db'];function respondWithStatusCode(_0x5a0016,_0x11c6f2){_0x11c6f2=_0x11c6f2||0xcc;return function(_0x2b1877){if(_0x2b1877){return _0x5a0016['sendStatus'](_0x11c6f2);}return _0x5a0016[_0x0f68('0x1b')](_0x11c6f2)[_0x0f68('0x1c')]();};}function respondWithResult(_0x5d8bab,_0x3ac611){_0x3ac611=_0x3ac611||0xc8;return function(_0x18807b){if(_0x18807b){return _0x5d8bab[_0x0f68('0x1b')](_0x3ac611)['json'](_0x18807b);}};}function respondWithFilteredResult(_0x4f70c0,_0x1c0417){return function(_0x186671){if(_0x186671){var _0x33f899=_0x186671[_0x0f68('0x1d')],_0x3a3773=_0x1c0417[_0x0f68('0x1e')],_0x215dac=_0x1c0417[_0x0f68('0x1e')]+_0x1c0417[_0x0f68('0x1f')],_0x145ece;if(_0x215dac>=_0x33f899){_0x215dac=_0x33f899;_0x145ece=0xc8;}else{_0x145ece=0xce;}_0x4f70c0[_0x0f68('0x1b')](_0x145ece);return _0x4f70c0[_0x0f68('0x20')]('Content-Range',_0x3a3773+'-'+_0x215dac+'/'+_0x33f899)[_0x0f68('0x21')](_0x186671);}return null;};}function patchUpdates(_0x5b0cfc){return function(_0x4961c8){try{jsonpatch['apply'](_0x4961c8,_0x5b0cfc,!![]);}catch(_0x32bd81){return BPromise['reject'](_0x32bd81);}return _0x4961c8[_0x0f68('0x22')]();};}function saveUpdates(_0x3143dc,_0x347f97){return function(_0x595592){if(_0x595592){return _0x595592[_0x0f68('0x23')](_0x3143dc)[_0x0f68('0x24')](function(_0x1e90c4){return _0x1e90c4;});}return null;};}function removeEntity(_0x419702,_0x33f919){return function(_0x21203e){if(_0x21203e){return _0x21203e[_0x0f68('0x25')]()['then'](function(){_0x419702[_0x0f68('0x1b')](0xcc)[_0x0f68('0x1c')]();});}};}function handleEntityNotFound(_0x375fb3,_0x4a7a96){return function(_0x4d044f){if(!_0x4d044f){_0x375fb3[_0x0f68('0x26')](0x194);}return _0x4d044f;};}function handleError(_0x158af0,_0x27b3e3){_0x27b3e3=_0x27b3e3||0x1f4;return function(_0x3d27c5){logger[_0x0f68('0x27')](_0x3d27c5[_0x0f68('0x28')]);if(_0x3d27c5[_0x0f68('0x29')]){delete _0x3d27c5[_0x0f68('0x29')];}_0x158af0[_0x0f68('0x1b')](_0x27b3e3)[_0x0f68('0x2a')](_0x3d27c5);};}exports[_0x0f68('0x2b')]=function(_0xfb8629,_0x340fec){var _0x598104={},_0x322260={},_0x5e1208={'count':0x0,'rows':[]};var _0xc680b8=_['map'](db[_0x0f68('0x2c')][_0x0f68('0x2d')],function(_0x1fd4d2){return{'name':_0x1fd4d2['fieldName'],'type':_0x1fd4d2[_0x0f68('0x2e')]['key']};});_0x322260[_0x0f68('0x2f')]=_[_0x0f68('0x30')](_[_0x0f68('0x31')](_0xc680b8,_0x0f68('0x29')),[_0x0f68('0x32')]);_0x322260[_0x0f68('0x33')]=_[_0x0f68('0x34')](_0xfb8629['query']);_0x322260[_0x0f68('0x35')]=_[_0x0f68('0x36')](_0x322260[_0x0f68('0x2f')],_0x322260[_0x0f68('0x33')]);_0x598104[_0x0f68('0x37')]=_['intersection'](_0x322260[_0x0f68('0x2f')],qs[_0x0f68('0x38')](_0xfb8629[_0x0f68('0x33')]['fields']));_0x598104['attributes']=_0x598104[_0x0f68('0x37')]['length']?_0x598104[_0x0f68('0x37')]:_0x322260[_0x0f68('0x2f')];if(!_0xfb8629[_0x0f68('0x33')][_0x0f68('0x39')](_0x0f68('0x3a'))){_0x598104[_0x0f68('0x1f')]=qs['limit'](_0xfb8629['query'][_0x0f68('0x1f')]);_0x598104[_0x0f68('0x1e')]=qs[_0x0f68('0x1e')](_0xfb8629[_0x0f68('0x33')][_0x0f68('0x1e')]);}_0x598104['order']=qs[_0x0f68('0x3b')](_0xfb8629[_0x0f68('0x33')][_0x0f68('0x3b')]);_0x598104[_0x0f68('0x3c')]=qs[_0x0f68('0x35')](_[_0x0f68('0x3d')](_0xfb8629[_0x0f68('0x33')],_0x322260[_0x0f68('0x35')]),_0xc680b8);if(_0xfb8629['query'][_0x0f68('0x3e')]){_0x598104['where']=_[_0x0f68('0x3f')](_0x598104[_0x0f68('0x3c')],{'$or':_[_0x0f68('0x31')](_0xc680b8,function(_0x5c427e){if(_0x5c427e['type']!==_0x0f68('0x40')){var _0x23282c={};_0x23282c[_0x5c427e[_0x0f68('0x29')]]={'$like':'%'+_0xfb8629[_0x0f68('0x33')]['filter']+'%'};return _0x23282c;}})});}_0x598104=_[_0x0f68('0x3f')]({},_0x598104,_0xfb8629['options']);var _0x104c02={'where':_0x598104['where']};return db[_0x0f68('0x2c')][_0x0f68('0x1d')](_0x104c02)[_0x0f68('0x24')](function(_0x360cce){_0x5e1208[_0x0f68('0x1d')]=_0x360cce;if(_0xfb8629[_0x0f68('0x33')][_0x0f68('0x41')]){_0x598104[_0x0f68('0x42')]=[{'all':!![]}];}return db[_0x0f68('0x2c')][_0x0f68('0x43')](_0x598104);})[_0x0f68('0x24')](function(_0x2f878e){_0x5e1208[_0x0f68('0x44')]=_0x2f878e;return _0x5e1208;})[_0x0f68('0x24')](respondWithFilteredResult(_0x340fec,_0x598104))[_0x0f68('0x45')](handleError(_0x340fec,null));};exports[_0x0f68('0x46')]=function(_0xa22611,_0x40ebfe){var _0xfb7cf4={'raw':![],'where':{'id':_0xa22611[_0x0f68('0x47')]['id']}},_0x51b28b={};_0x51b28b[_0x0f68('0x2f')]=_[_0x0f68('0x34')](db['VoiceRecording'][_0x0f68('0x2d')]);_0x51b28b[_0x0f68('0x33')]=_[_0x0f68('0x34')](_0xa22611[_0x0f68('0x33')]);_0x51b28b[_0x0f68('0x35')]=_[_0x0f68('0x36')](_0x51b28b['model'],_0x51b28b['query']);_0xfb7cf4[_0x0f68('0x37')]=_[_0x0f68('0x36')](_0x51b28b[_0x0f68('0x2f')],qs[_0x0f68('0x38')](_0xa22611[_0x0f68('0x33')][_0x0f68('0x38')]));_0xfb7cf4[_0x0f68('0x37')]=_0xfb7cf4['attributes'][_0x0f68('0x48')]?_0xfb7cf4[_0x0f68('0x37')]:_0x51b28b[_0x0f68('0x2f')];if(_0xa22611['query'][_0x0f68('0x41')]){_0xfb7cf4[_0x0f68('0x42')]=[{'all':!![]}];}_0xfb7cf4=_['merge']({},_0xfb7cf4,_0xa22611['options']);return db[_0x0f68('0x2c')][_0x0f68('0x49')](_0xfb7cf4)['then'](handleEntityNotFound(_0x40ebfe,null))[_0x0f68('0x24')](respondWithResult(_0x40ebfe,null))[_0x0f68('0x45')](handleError(_0x40ebfe,null));};exports[_0x0f68('0x4a')]=function(_0x194817,_0xbbd09c){return db[_0x0f68('0x2c')][_0x0f68('0x4a')](_0x194817[_0x0f68('0x4b')],{})[_0x0f68('0x24')](respondWithResult(_0xbbd09c,0xc9))[_0x0f68('0x45')](handleError(_0xbbd09c,null));};exports[_0x0f68('0x23')]=function(_0x1cd410,_0x3bd42b){if(_0x1cd410[_0x0f68('0x4b')]['id']){delete _0x1cd410[_0x0f68('0x4b')]['id'];}return db[_0x0f68('0x2c')][_0x0f68('0x49')]({'where':{'id':_0x1cd410['params']['id']}})[_0x0f68('0x24')](handleEntityNotFound(_0x3bd42b,null))[_0x0f68('0x24')](saveUpdates(_0x1cd410[_0x0f68('0x4b')],null))[_0x0f68('0x24')](respondWithResult(_0x3bd42b,null))['catch'](handleError(_0x3bd42b,null));};exports[_0x0f68('0x4c')]=function(_0xb73307,_0x273586){return db[_0x0f68('0x2c')][_0x0f68('0x4c')]()[_0x0f68('0x24')](respondWithResult(_0x273586,null))[_0x0f68('0x45')](handleError(_0x273586,null));};exports[_0x0f68('0x4d')]=function(_0x1ccf0e,_0x4eac4c,_0x3bb90e){var _0x3ba2c1=require(_0x0f68('0x4e'));var _0x2f338c=![];var _0x35e75b={};if(_0x1ccf0e['query'][_0x0f68('0x2e')]&&_0x1ccf0e[_0x0f68('0x33')][_0x0f68('0x2e')]===_0x0f68('0x4f')){_0x35e75b['uniqueid']=_0x1ccf0e['params']['id'];}else{_0x35e75b['id']=_0x1ccf0e[_0x0f68('0x47')]['id'];}return db[_0x0f68('0x2c')][_0x0f68('0x49')]({'where':_0x35e75b,'attributes':['id',_0x0f68('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x4eac4c,null))[_0x0f68('0x24')](function(_0x4e1121){if(_0x4e1121){var _0x2aeeec=_0x4e1121[_0x0f68('0x50')];var _0x49bb4d=util[_0x0f68('0x32')](_0x0f68('0x51'),_0x2aeeec);if(fs['existsSync'](_0x49bb4d)){_0x2f338c=!![];return _0x3ba2c1['decryptFile'](_0x49bb4d,_0x2aeeec,config[_0x0f68('0x52')]['recording'])[_0x0f68('0x24')](function(){return _0x4e1121;});}return _0x4e1121;}})['then'](function(_0x5233e2){if(_0x5233e2){var _0x395892=_0x5233e2['value'];if(!fs[_0x0f68('0x53')](_0x395892)){throw new db[(_0x0f68('0x54'))][(_0x0f68('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x5233e2['filename']){return _0x4eac4c['download'](_0x395892,_0x5233e2[_0x0f68('0x56')]+path['extname'](_0x395892),function(){if(_0x2f338c){fs[_0x0f68('0x57')](_0x395892);}});}else{return _0x4eac4c[_0x0f68('0x4d')](_0x395892,function(_0x49c2ab){if(_0x2f338c){fs['unlink'](_0x395892);}});}}})[_0x0f68('0x45')](function(_0x11f0fa){if(_0x11f0fa['message']===_0x0f68('0x58')){_0x4eac4c[_0x0f68('0x1b')](0x194)[_0x0f68('0x2a')](_0x0f68('0x59'));}else{return handleError(_0x4eac4c,null);}});};exports['downloads']=function(_0x935887,_0xdf4411,_0x1f9cf4){var _0x36affb=require(_0x0f68('0x4e'));var _0x43c96e=![];var _0x1f4a2f={'$and':[db[_0x0f68('0x5a')][_0x0f68('0x3c')](db[_0x0f68('0x5a')]['fn'](_0x0f68('0x5b'),db[_0x0f68('0x5a')][_0x0f68('0x5c')](_0x0f68('0x4f'))),_0x935887[_0x0f68('0x33')][_0x0f68('0x5d')])]};if(_0x935887[_0x0f68('0x33')]['type']&&_0x935887[_0x0f68('0x33')][_0x0f68('0x2e')]===_0x0f68('0x4f')){_0x1f4a2f[_0x0f68('0x5e')]['push']({'uniqueid':_0x935887[_0x0f68('0x47')]['id']});}else{_0x1f4a2f[_0x0f68('0x5e')][_0x0f68('0x5f')]({'id':_0x935887[_0x0f68('0x47')]['id']});}return db[_0x0f68('0x2c')][_0x0f68('0x49')]({'where':_0x1f4a2f,'attributes':['id',_0x0f68('0x50')],'raw':!![]})[_0x0f68('0x24')](handleEntityNotFound(_0xdf4411,null))[_0x0f68('0x24')](function(_0x322064){if(_0x322064){var _0x1f6f92=util[_0x0f68('0x32')](_0x0f68('0x51'),_0x322064['value']);if(fs[_0x0f68('0x53')](_0x1f6f92)){_0x43c96e=!![];return _0x36affb['decryptFile'](_0x1f6f92,_0x322064[_0x0f68('0x50')],config['secrets']['recording'])['then'](function(){return _0x322064;});}return _0x322064;}})['then'](function(_0x2b4def){if(_0x2b4def){if(!fs['existsSync'](_0x2b4def[_0x0f68('0x50')])){throw new db[(_0x0f68('0x54'))][(_0x0f68('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x2b4def[_0x0f68('0x56')]){return _0xdf4411[_0x0f68('0x4d')](_0x2b4def['value'],_0x2b4def[_0x0f68('0x56')]+path[_0x0f68('0x60')](_0x2b4def[_0x0f68('0x50')]),function(){if(_0x43c96e){fs[_0x0f68('0x57')](_0x2b4def['value']);}});}else{return _0xdf4411[_0x0f68('0x4d')](_0x2b4def['value'],function(_0xdf3344){if(_0x43c96e){fs[_0x0f68('0x57')](_0x2b4def['value']);}});}}})[_0x0f68('0x45')](handleError(_0xdf4411,null));};exports[_0x0f68('0x25')]=function(_0x25964e,_0x41a8e2){return db['VoiceRecording'][_0x0f68('0x49')]({'where':{'id':_0x25964e[_0x0f68('0x47')]['id']}})['then'](function(_0x3d0123){if(!_0x3d0123)throw new ReferenceError('Entity\x20not\x20found');return _0x3d0123;})[_0x0f68('0x24')](function(_0x1c6ce3){var _0x110e71=_0x1c6ce3[_0x0f68('0x50')];logger[_0x0f68('0x61')](_0x0f68('0x62'),_0x110e71);if(!_['isNil'](_0x1c6ce3['value'])&&fs[_0x0f68('0x53')](_0x110e71)){logger[_0x0f68('0x61')](_0x0f68('0x63')+_0x110e71+_0x0f68('0x64'));fs[_0x0f68('0x65')](_0x110e71);}_0x110e71=_0x110e71+_0x0f68('0x66');if(!_['isNil'](_0x1c6ce3[_0x0f68('0x50')])&&fs[_0x0f68('0x53')](_0x110e71)){logger['info'](_0x0f68('0x63')+_0x110e71+_0x0f68('0x64'));fs[_0x0f68('0x65')](_0x110e71);}return _0x1c6ce3;})[_0x0f68('0x24')](function(_0x2ff53d){if(!_0x2ff53d)throw new InternalError();return _0x2ff53d['destroy']();})[_0x0f68('0x24')](function(){_0x41a8e2[_0x0f68('0x1b')](0xcc)[_0x0f68('0x1c')]();})[_0x0f68('0x45')](handleError(_0x41a8e2,null));};function getBucketslist(_0x2b154f,_0x8d2257,_0x1bbd37){return new Promise(function(_0x22c7a8,_0x1a993c){var _0x4df59d=new AWS['S3']({'accessKeyId':_0x8d2257,'secretAccessKey':_0x2b154f,'region':_0x1bbd37});_0x4df59d['listBuckets']({},function(_0x3ce804,_0x59fb0f){if(_0x3ce804){return _0x1a993c(_0x3ce804);}else{return _0x22c7a8(_0x59fb0f);}});});}function createBucket(_0x29b223,_0x45d22e,_0x5b9d32,_0xa07f97){return new Promise(function(_0x44db7d,_0x118337){var _0x11853e=new AWS['S3']({'accessKeyId':_0x45d22e,'secretAccessKey':_0x29b223,'region':_0x5b9d32});_0x11853e[_0x0f68('0x67')]({'Bucket':_0xa07f97},function(_0x3fcc9d,_0x426f1c){if(_0x3fcc9d){return _0x118337(_0x3fcc9d);}else{return _0x44db7d(_0x426f1c);}});});}function uploadFile(_0x41b4dc,_0x52575f,_0x46e9e3,_0x4c9aba,_0x56ff6d,_0x450480){return new Promise(function(_0x5dc6ef,_0x4926fe){var _0x2c189c=new AWS['S3']({'accessKeyId':_0x52575f,'secretAccessKey':_0x41b4dc,'region':_0x46e9e3});_0x2c189c['upload']({'Bucket':_0x4c9aba,'Key':_0x56ff6d,'Body':_0x450480},function(_0x391743,_0x4c0375){if(_0x391743){return _0x4926fe(_0x391743);}else{return _0x5dc6ef(_0x4c0375);}});});}function startTranscribe(_0x149137,_0x381430,_0x1e232b,_0x1332f0,_0x529e0e,_0x3ef055){return new Promise(function(_0x35f5a6,_0x7645e0){var _0x240c70=new AWS[(_0x0f68('0x68'))]({'accessKeyId':_0x381430,'secretAccessKey':_0x149137,'region':_0x1e232b});_0x240c70[_0x0f68('0x69')]({'TranscriptionJobName':_0x1332f0,'LanguageCode':_0x529e0e,'Media':{'MediaFileUri':_0x3ef055}},function(_0x36c1b1,_0x235cdd){if(_0x36c1b1){return _0x7645e0(_0x36c1b1);}else{return _0x35f5a6(_0x235cdd);}});});}function transcribe(_0x1f7376,_0x58a4fa,_0x1eec79,_0x40e92e,_0x482107,_0x2daf50,_0x51e013){return new Promise(function(_0x3b651f,_0x181e0f){var _0x3c77e1={};logger[_0x0f68('0x61')](util[_0x0f68('0x32')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x1f7376,_0x482107));return uploadFile(_0x58a4fa,_0x1eec79,_0x40e92e,_0x482107,path[_0x0f68('0x6a')](_0x2daf50),fs[_0x0f68('0x6b')](_0x2daf50))[_0x0f68('0x24')](function(_0x3fc2c1){logger['info'](util[_0x0f68('0x32')](_0x0f68('0x6c'),_0x1f7376,_0x482107,_0x3fc2c1['Location']));_0x3c77e1[_0x0f68('0x6d')]=_0x3fc2c1[_0x0f68('0x6e')];_0x3c77e1['location']=_0x3fc2c1[_0x0f68('0x6f')];logger[_0x0f68('0x61')](util[_0x0f68('0x32')](_0x0f68('0x70'),_0x1f7376));return startTranscribe(_0x58a4fa,_0x1eec79,_0x40e92e,uuidv4(),_0x51e013,_0x3fc2c1[_0x0f68('0x6f')]);})[_0x0f68('0x24')](function(_0x3b027b){logger[_0x0f68('0x61')](util[_0x0f68('0x32')](_0x0f68('0x71'),_0x1f7376,_0x3b027b[_0x0f68('0x72')][_0x0f68('0x73')]));_0x3c77e1['transcribeName']=_0x3b027b[_0x0f68('0x72')][_0x0f68('0x73')];_0x3c77e1[_0x0f68('0x74')]=_0x3b027b[_0x0f68('0x72')]['TranscriptionJobStatus'];return _0x3b651f(_0x3c77e1);})[_0x0f68('0x45')](function(_0x27aab5){return _0x181e0f(_0x27aab5);});});}exports[_0x0f68('0x75')]=function(_0x5ab890,_0x246570,_0xf9250b){var _0xe77aa3;var _0x1ef0e8;var _0xed657a;var _0x38b998=require(_0x0f68('0x4e'));return db['VoiceRecording'][_0x0f68('0x76')]({'where':{'id':_0x5ab890[_0x0f68('0x47')]['id']}})[_0x0f68('0x24')](function(_0x213458){if(_0x213458){var _0x19f438=util[_0x0f68('0x32')](_0x0f68('0x51'),_0x213458['value']);if(fs[_0x0f68('0x53')](_0x19f438)){cypher=!![];return _0x38b998[_0x0f68('0x77')](_0x19f438,_0x213458[_0x0f68('0x50')],config[_0x0f68('0x52')][_0x0f68('0x78')])[_0x0f68('0x24')](function(){return _0x213458;});}return _0x213458;}})[_0x0f68('0x24')](function(_0x52dc15){if(!_0x52dc15){throw new db[(_0x0f68('0x54'))][(_0x0f68('0x55'))](_0x0f68('0x79'));}_0x1ef0e8=_0x52dc15;return db[_0x0f68('0x7a')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x246570,null))[_0x0f68('0x24')](function(_0x2bb24f){if(_0x2bb24f){_0xe77aa3=_0x2bb24f;if(!_0xe77aa3[_0x0f68('0x7b')]||!_0xe77aa3[_0x0f68('0x7c')]||!_0xe77aa3[_0x0f68('0x7d')]||!_0xe77aa3[_0x0f68('0x7e')]||!_0xe77aa3['bucket']){throw new db[(_0x0f68('0x54'))]['ValidationError'](_0x0f68('0x7f'));}if(_0x5ab890['body'][_0x0f68('0x80')]&&(!_0xe77aa3['sentiment']||!_0xe77aa3['sentimentAccountId']||!_0xe77aa3['sentimentRegion']||!_0xe77aa3[_0x0f68('0x7e')]||!_0xe77aa3[_0x0f68('0x6d')])){throw new db[(_0x0f68('0x54'))][(_0x0f68('0x55'))](_0x0f68('0x81'));}return db[_0x0f68('0x82')][_0x0f68('0x76')]({'where':{'id':_0xe77aa3[_0x0f68('0x7c')]}});}})[_0x0f68('0x24')](function(_0x4aadf6){if(!_0x4aadf6){throw new db[(_0x0f68('0x54'))][(_0x0f68('0x55'))](_0x0f68('0x83'));}if(!_0x4aadf6[_0x0f68('0x84')]||!_0x4aadf6['data2']){throw new db[(_0x0f68('0x54'))][(_0x0f68('0x55'))]('Cloud\x20Provider\x20not\x20configured');}_0xed657a=_0x4aadf6;return getBucketslist(_0xed657a[_0x0f68('0x84')],_0xed657a[_0x0f68('0x85')],_0xe77aa3[_0x0f68('0x7d')]);})['then'](function(_0x3f9842){if(_0x3f9842&&_0x3f9842['Buckets']){var _0x4c6a74=_[_0x0f68('0x49')](_0x3f9842[_0x0f68('0x86')],function(_0x519dc5){return _0x519dc5[_0x0f68('0x87')]===_0xe77aa3['bucket'];});if(!_0x4c6a74){logger[_0x0f68('0x61')](util[_0x0f68('0x32')](_0x0f68('0x88'),_0x5ab890[_0x0f68('0x47')]['id'],_0xe77aa3[_0x0f68('0x6d')]));return createBucket(_0xed657a[_0x0f68('0x84')],_0xed657a['data2'],_0xe77aa3[_0x0f68('0x7d')],_0xe77aa3['bucket']);}logger['info'](util[_0x0f68('0x32')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x5ab890['params']['id'],_0xe77aa3[_0x0f68('0x6d')]));return;}})['then'](function(_0x307ba6){if(_0x1ef0e8[_0x0f68('0x74')]===_0x0f68('0x89')){return transcribe(_0x5ab890['params']['id'],_0xed657a[_0x0f68('0x84')],_0xed657a[_0x0f68('0x85')],_0xe77aa3[_0x0f68('0x7d')],_0xe77aa3[_0x0f68('0x6d')],_0x1ef0e8['value'],_0xe77aa3[_0x0f68('0x7e')]);}else{logger[_0x0f68('0x61')](util[_0x0f68('0x32')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x5ab890['params']['id']));return{'transcribeStatus':_0x0f68('0x8a')};}})[_0x0f68('0x24')](function(_0x2feed0){if(_0x2feed0){_0x2feed0['tempSentiment']=_0x5ab890[_0x0f68('0x4b')]['runSentiment'];return _0x1ef0e8[_0x0f68('0x8b')](_0x2feed0);}})[_0x0f68('0x24')](respondWithResult(_0x246570,null))[_0x0f68('0x45')](handleError(_0x246570,null));};function writeFile(_0x45b7c3,_0x436d21){return new Promise(function(_0x1cb8ed,_0x2a5b66){fs[_0x0f68('0x8c')](_0x436d21,_0x45b7c3,function(_0x54d977,_0x24dbe3){if(_0x54d977){return _0x2a5b66(_0x54d977);}else{return _0x1cb8ed(_0x24dbe3);}});});}exports[_0x0f68('0x8d')]=function(_0x25753d,_0x34a5cd,_0x278758){return db['VoiceRecording'][_0x0f68('0x76')]({'where':{'id':_0x25753d[_0x0f68('0x47')]['id']}})[_0x0f68('0x24')](handleEntityNotFound(_0x34a5cd))['then'](function(_0x30f51f){if(_0x30f51f&&_0x30f51f[_0x0f68('0x8e')]){var _0x3d02ed=_0x30f51f[_0x0f68('0x8e')];var _0x450d24=config[_0x0f68('0x8f')]+_0x0f68('0x90')+_0x30f51f['id']+_0x0f68('0x91');if(fs[_0x0f68('0x53')](_0x450d24)){return _0x450d24;}return writeFile(_0x3d02ed,_0x450d24)[_0x0f68('0x24')](function(){return _0x450d24;});}else{throw new db[(_0x0f68('0x54'))]['ValidationError'](_0x0f68('0x92'));}})[_0x0f68('0x24')](function(_0xa90f49){return _0x34a5cd[_0x0f68('0x4d')](_0xa90f49);})[_0x0f68('0x45')](handleError(_0x34a5cd));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index e263c2a..f0e12b4 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 _0x4172=['rimraf','../../config/environment','exports','define','VoiceRecording','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4172,0x1aa));var _0x2417=function(_0x5c605c,_0x23d6e7){_0x5c605c=_0x5c605c-0x0;var _0x428354=_0x4172[_0x5c605c];return _0x428354;};'use strict';var _=require(_0x2417('0x0'));var util=require(_0x2417('0x1'));var logger=require(_0x2417('0x2'))(_0x2417('0x3'));var moment=require(_0x2417('0x4'));var BPromise=require(_0x2417('0x5'));var rp=require(_0x2417('0x6'));var fs=require('fs');var path=require(_0x2417('0x7'));var rimraf=require(_0x2417('0x8'));var config=require(_0x2417('0x9'));var attributes=require('./voiceRecording.attributes');module[_0x2417('0xa')]=function(_0xd2fae3,_0x2002cd){return _0xd2fae3[_0x2417('0xb')](_0x2417('0xc'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x2417('0xd'),'fields':[_0x2417('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfbbf=['uniqueid','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfbbf,0x194));var _0xffbb=function(_0x23a191,_0x47ec9a){_0x23a191=_0x23a191-0x0;var _0x589b3d=_0xfbbf[_0x23a191];return _0x589b3d;};'use strict';var _=require('lodash');var util=require(_0xffbb('0x0'));var logger=require(_0xffbb('0x1'))('api');var moment=require('moment');var BPromise=require(_0xffbb('0x2'));var rp=require(_0xffbb('0x3'));var fs=require('fs');var path=require(_0xffbb('0x4'));var rimraf=require(_0xffbb('0x5'));var config=require(_0xffbb('0x6'));var attributes=require(_0xffbb('0x7'));module[_0xffbb('0x8')]=function(_0x32b8ef,_0x2a24f5){return _0x32b8ef[_0xffbb('0x9')](_0xffbb('0xa'),attributes,{'tableName':_0xffbb('0xb'),'paranoid':![],'indexes':[{'name':_0xffbb('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 574270d..9ed0f9d 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(_0xed5f9c,_0x5a25cd){var _0x3a1c43=function(_0x251202){while(--_0x251202){_0xed5f9c['push'](_0xed5f9c['shift']());}};_0x3a1c43(++_0x5a25cd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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(_0x43b22b,_0xea722c){var _0xd4e124=function(_0x271814){while(--_0x271814){_0x43b22b['push'](_0x43b22b['shift']());}};_0xd4e124(++_0xea722c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 5717a7c..bb26829 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 _0xe8e4=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','post','create','put','update','delete','exports'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xe8e4,0x11d));var _0x4e8e=function(_0x1ca997,_0x3c0c89){_0x1ca997=_0x1ca997-0x0;var _0x755592=_0xe8e4[_0x1ca997];return _0x755592;};'use strict';var multer=require(_0x4e8e('0x0'));var util=require(_0x4e8e('0x1'));var path=require(_0x4e8e('0x2'));var timeout=require(_0x4e8e('0x3'));var express=require(_0x4e8e('0x4'));var router=express[_0x4e8e('0x5')]();var fs_extra=require(_0x4e8e('0x6'));var auth=require(_0x4e8e('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0x4e8e('0x8')]('/',auth[_0x4e8e('0x9')](),controller[_0x4e8e('0xa')]);router[_0x4e8e('0x8')](_0x4e8e('0xb'),auth[_0x4e8e('0x9')](),controller[_0x4e8e('0xc')]);router['get']('/:id',auth[_0x4e8e('0x9')](),controller['show']);router[_0x4e8e('0xd')]('/',auth[_0x4e8e('0x9')](),controller[_0x4e8e('0xe')]);router[_0x4e8e('0xf')]('/:id',auth[_0x4e8e('0x9')](),controller[_0x4e8e('0x10')]);router[_0x4e8e('0x11')]('/:id',auth[_0x4e8e('0x9')](),controller['destroy']);module[_0x4e8e('0x12')]=router; \ No newline at end of file +var _0x270a=['create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./voiceTransferReport.controller','isAuthenticated','get','/describe','/:id','show','post'];(function(_0x39d838,_0x208cfa){var _0x360bac=function(_0x814782){while(--_0x814782){_0x39d838['push'](_0x39d838['shift']());}};_0x360bac(++_0x208cfa);}(_0x270a,0x195));var _0xa270=function(_0x1e13dd,_0x376c66){_0x1e13dd=_0x1e13dd-0x0;var _0x4c88e7=_0x270a[_0x1e13dd];return _0x4c88e7;};'use strict';var multer=require('multer');var util=require(_0xa270('0x0'));var path=require(_0xa270('0x1'));var timeout=require(_0xa270('0x2'));var express=require('express');var router=express[_0xa270('0x3')]();var fs_extra=require(_0xa270('0x4'));var auth=require(_0xa270('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa270('0x6'));router['get']('/',auth[_0xa270('0x7')](),controller['index']);router[_0xa270('0x8')](_0xa270('0x9'),auth[_0xa270('0x7')](),controller['describe']);router[_0xa270('0x8')](_0xa270('0xa'),auth['isAuthenticated'](),controller[_0xa270('0xb')]);router[_0xa270('0xc')]('/',auth['isAuthenticated'](),controller[_0xa270('0xd')]);router[_0xa270('0xe')](_0xa270('0xa'),auth[_0xa270('0x7')](),controller[_0xa270('0xf')]);router[_0xa270('0x10')]('/:id',auth[_0xa270('0x7')](),controller[_0xa270('0x11')]);module[_0xa270('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index cb1a1bb..cffe721 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 _0xd667=['blind','attended','STRING','Yes','sequelize','moment','exports','ENUM'];(function(_0x57ded7,_0xae7061){var _0x2bdc7e=function(_0x1d05f4){while(--_0x1d05f4){_0x57ded7['push'](_0x57ded7['shift']());}};_0x2bdc7e(++_0xae7061);}(_0xd667,0x1c4));var _0x7d66=function(_0xbdedba,_0x3f6a2b){_0xbdedba=_0xbdedba-0x0;var _0x14a6d=_0xd667[_0xbdedba];return _0x14a6d;};'use strict';var Sequelize=require(_0x7d66('0x0'));var moment=require(_0x7d66('0x1'));module[_0x7d66('0x2')]={'type':{'type':Sequelize[_0x7d66('0x3')](_0x7d66('0x4'),_0x7d66('0x5'))},'result':{'type':Sequelize[_0x7d66('0x6')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x7d66('0x6')]},'transferercalleridname':{'type':Sequelize[_0x7d66('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x7d66('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x7d66('0x6')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x7d66('0x6')]},'transfererexten':{'type':Sequelize[_0x7d66('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x7d66('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x7d66('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x7d66('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x7d66('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x7d66('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x7d66('0x6')]},'transfereecontext':{'type':Sequelize[_0x7d66('0x6')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x7d66('0x6')]},'isexternal':{'type':Sequelize[_0x7d66('0x3')](_0x7d66('0x7'),'No')},'context':{'type':Sequelize[_0x7d66('0x6')]},'extension':{'type':Sequelize[_0x7d66('0x6')]}}; \ No newline at end of file +var _0x8318=['attended','STRING','Yes','sequelize','exports','ENUM'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x8318,0x123));var _0x8831=function(_0x1e2393,_0x5e51f1){_0x1e2393=_0x1e2393-0x0;var _0x451f52=_0x8318[_0x1e2393];return _0x451f52;};'use strict';var Sequelize=require(_0x8831('0x0'));var moment=require('moment');module[_0x8831('0x1')]={'type':{'type':Sequelize[_0x8831('0x2')]('blind',_0x8831('0x3'))},'result':{'type':Sequelize[_0x8831('0x4')]},'transfererchannel':{'type':Sequelize[_0x8831('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x8831('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x8831('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x8831('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x8831('0x4')]},'transfererexten':{'type':Sequelize[_0x8831('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x8831('0x4')]},'transfereechannel':{'type':Sequelize[_0x8831('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x8831('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x8831('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x8831('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x8831('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x8831('0x4')]},'transfereecontext':{'type':Sequelize[_0x8831('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x8831('0x4')]},'isexternal':{'type':Sequelize['ENUM'](_0x8831('0x5'),'No')},'context':{'type':Sequelize[_0x8831('0x4')]},'extension':{'type':Sequelize[_0x8831('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 5865b86..9db798a 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 _0xf72c=['map','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','show','params','VoiceTransferReport','rawAttributes','find','catch','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','end','status','json','count','offset','set','Content-Range','apply','reject','update','then','stack','name','index'];(function(_0x29d254,_0x2b974f){var _0x54b91f=function(_0x1cf94f){while(--_0x1cf94f){_0x29d254['push'](_0x29d254['shift']());}};_0x54b91f(++_0x2b974f);}(_0xf72c,0x184));var _0xcf72=function(_0x133bd0,_0x23d366){_0x133bd0=_0x133bd0-0x0;var _0x3c3bee=_0xf72c[_0x133bd0];return _0x3c3bee;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcf72('0x0'));var jsonpatch=require(_0xcf72('0x1'));var rp=require(_0xcf72('0x2'));var moment=require(_0xcf72('0x3'));var BPromise=require(_0xcf72('0x4'));var Mustache=require(_0xcf72('0x5'));var util=require(_0xcf72('0x6'));var path=require('path');var sox=require(_0xcf72('0x7'));var csv=require(_0xcf72('0x8'));var ejs=require(_0xcf72('0x9'));var fs=require('fs');var fs_extra=require(_0xcf72('0xa'));var _=require(_0xcf72('0xb'));var squel=require(_0xcf72('0xc'));var crypto=require(_0xcf72('0xd'));var jsforce=require(_0xcf72('0xe'));var deskjs=require(_0xcf72('0xf'));var toCsv=require(_0xcf72('0x8'));var querystring=require(_0xcf72('0x10'));var Papa=require(_0xcf72('0x11'));var Redis=require(_0xcf72('0x12'));var authService=require(_0xcf72('0x13'));var qs=require(_0xcf72('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xcf72('0x15'));var config=require(_0xcf72('0x16'));var licenseUtil=require(_0xcf72('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fc67c,_0x396471){_0x396471=_0x396471||0xcc;return function(_0x35e3b5){if(_0x35e3b5){return _0x3fc67c['sendStatus'](_0x396471);}return _0x3fc67c['status'](_0x396471)[_0xcf72('0x18')]();};}function respondWithResult(_0x11e1b4,_0x40aa5d){_0x40aa5d=_0x40aa5d||0xc8;return function(_0x51bbb9){if(_0x51bbb9){return _0x11e1b4[_0xcf72('0x19')](_0x40aa5d)[_0xcf72('0x1a')](_0x51bbb9);}};}function respondWithFilteredResult(_0x6f7728,_0x1cd9ee){return function(_0x1a2299){if(_0x1a2299){var _0x1b9e47=_0x1a2299[_0xcf72('0x1b')],_0x50e844=_0x1cd9ee[_0xcf72('0x1c')],_0x4ade94=_0x1cd9ee[_0xcf72('0x1c')]+_0x1cd9ee['limit'],_0x210c48;if(_0x4ade94>=_0x1b9e47){_0x4ade94=_0x1b9e47;_0x210c48=0xc8;}else{_0x210c48=0xce;}_0x6f7728['status'](_0x210c48);return _0x6f7728[_0xcf72('0x1d')](_0xcf72('0x1e'),_0x50e844+'-'+_0x4ade94+'/'+_0x1b9e47)['json'](_0x1a2299);}return null;};}function patchUpdates(_0x2e0e0c){return function(_0x167a7e){try{jsonpatch[_0xcf72('0x1f')](_0x167a7e,_0x2e0e0c,!![]);}catch(_0x1f063e){return BPromise[_0xcf72('0x20')](_0x1f063e);}return _0x167a7e['save']();};}function saveUpdates(_0x441767,_0x2495d8){return function(_0x4214ec){if(_0x4214ec){return _0x4214ec[_0xcf72('0x21')](_0x441767)[_0xcf72('0x22')](function(_0x817042){return _0x817042;});}return null;};}function removeEntity(_0x1e2bed,_0x40f1cd){return function(_0x562da0){if(_0x562da0){return _0x562da0['destroy']()[_0xcf72('0x22')](function(){_0x1e2bed[_0xcf72('0x19')](0xcc)[_0xcf72('0x18')]();});}};}function handleEntityNotFound(_0x1f967a,_0x26a09){return function(_0x177dc4){if(!_0x177dc4){_0x1f967a['sendStatus'](0x194);}return _0x177dc4;};}function handleError(_0x305569,_0x5c7e06){_0x5c7e06=_0x5c7e06||0x1f4;return function(_0x2a292e){logger['error'](_0x2a292e[_0xcf72('0x23')]);if(_0x2a292e[_0xcf72('0x24')]){delete _0x2a292e[_0xcf72('0x24')];}_0x305569[_0xcf72('0x19')](_0x5c7e06)['send'](_0x2a292e);};}exports[_0xcf72('0x25')]=function(_0xec23a4,_0x5f4487){var _0x92245b={},_0x29d8b3={},_0x4acb5f={'count':0x0,'rows':[]};var _0x177863=_[_0xcf72('0x26')](db['VoiceTransferReport']['rawAttributes'],function(_0x49f933){return{'name':_0x49f933['fieldName'],'type':_0x49f933[_0xcf72('0x27')]['key']};});_0x29d8b3[_0xcf72('0x28')]=_[_0xcf72('0x26')](_0x177863,_0xcf72('0x24'));_0x29d8b3['query']=_[_0xcf72('0x29')](_0xec23a4[_0xcf72('0x2a')]);_0x29d8b3[_0xcf72('0x2b')]=_[_0xcf72('0x2c')](_0x29d8b3[_0xcf72('0x28')],_0x29d8b3[_0xcf72('0x2a')]);_0x92245b[_0xcf72('0x2d')]=_[_0xcf72('0x2c')](_0x29d8b3[_0xcf72('0x28')],qs[_0xcf72('0x2e')](_0xec23a4['query'][_0xcf72('0x2e')]));_0x92245b[_0xcf72('0x2d')]=_0x92245b[_0xcf72('0x2d')][_0xcf72('0x2f')]?_0x92245b[_0xcf72('0x2d')]:_0x29d8b3['model'];if(!_0xec23a4[_0xcf72('0x2a')][_0xcf72('0x30')](_0xcf72('0x31'))){_0x92245b['limit']=qs[_0xcf72('0x32')](_0xec23a4[_0xcf72('0x2a')][_0xcf72('0x32')]);_0x92245b['offset']=qs[_0xcf72('0x1c')](_0xec23a4[_0xcf72('0x2a')][_0xcf72('0x1c')]);}_0x92245b[_0xcf72('0x33')]=qs['sort'](_0xec23a4[_0xcf72('0x2a')][_0xcf72('0x34')]);_0x92245b[_0xcf72('0x35')]=qs[_0xcf72('0x2b')](_['pick'](_0xec23a4[_0xcf72('0x2a')],_0x29d8b3['filters']),_0x177863);if(_0xec23a4['query']['filter']){_0x92245b[_0xcf72('0x35')]=_[_0xcf72('0x36')](_0x92245b[_0xcf72('0x35')],{'$or':_[_0xcf72('0x26')](_0x177863,function(_0x47c46e){if(_0x47c46e[_0xcf72('0x27')]!=='VIRTUAL'){var _0x4dfebc={};_0x4dfebc[_0x47c46e[_0xcf72('0x24')]]={'$like':'%'+_0xec23a4[_0xcf72('0x2a')][_0xcf72('0x37')]+'%'};return _0x4dfebc;}})});}_0x92245b=_[_0xcf72('0x36')]({},_0x92245b,_0xec23a4[_0xcf72('0x38')]);var _0x41d704={'where':_0x92245b[_0xcf72('0x35')]};return db['VoiceTransferReport'][_0xcf72('0x1b')](_0x41d704)['then'](function(_0x1397ca){_0x4acb5f['count']=_0x1397ca;if(_0xec23a4['query'][_0xcf72('0x39')]){_0x92245b[_0xcf72('0x3a')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xcf72('0x3b')](_0x92245b);})[_0xcf72('0x22')](function(_0x3e583a){_0x4acb5f[_0xcf72('0x3c')]=_0x3e583a;return _0x4acb5f;})[_0xcf72('0x22')](respondWithFilteredResult(_0x5f4487,_0x92245b))['catch'](handleError(_0x5f4487,null));};exports[_0xcf72('0x3d')]=function(_0x54d434,_0x4e3d2f){var _0x29bedf={'raw':!![],'where':{'id':_0x54d434[_0xcf72('0x3e')]['id']}},_0x10bf2a={};_0x10bf2a[_0xcf72('0x28')]=_[_0xcf72('0x29')](db[_0xcf72('0x3f')][_0xcf72('0x40')]);_0x10bf2a[_0xcf72('0x2a')]=_['keys'](_0x54d434['query']);_0x10bf2a[_0xcf72('0x2b')]=_[_0xcf72('0x2c')](_0x10bf2a[_0xcf72('0x28')],_0x10bf2a[_0xcf72('0x2a')]);_0x29bedf[_0xcf72('0x2d')]=_['intersection'](_0x10bf2a[_0xcf72('0x28')],qs[_0xcf72('0x2e')](_0x54d434[_0xcf72('0x2a')][_0xcf72('0x2e')]));_0x29bedf['attributes']=_0x29bedf['attributes'][_0xcf72('0x2f')]?_0x29bedf[_0xcf72('0x2d')]:_0x10bf2a[_0xcf72('0x28')];if(_0x54d434['query'][_0xcf72('0x39')]){_0x29bedf[_0xcf72('0x3a')]=[{'all':!![]}];}_0x29bedf=_[_0xcf72('0x36')]({},_0x29bedf,_0x54d434[_0xcf72('0x38')]);return db[_0xcf72('0x3f')][_0xcf72('0x41')](_0x29bedf)['then'](handleEntityNotFound(_0x4e3d2f,null))[_0xcf72('0x22')](respondWithResult(_0x4e3d2f,null))[_0xcf72('0x42')](handleError(_0x4e3d2f,null));};exports[_0xcf72('0x43')]=function(_0x110388,_0x5873f1){return db['VoiceTransferReport']['create'](_0x110388[_0xcf72('0x44')],{})['then'](respondWithResult(_0x5873f1,0xc9))['catch'](handleError(_0x5873f1,null));};exports[_0xcf72('0x21')]=function(_0x1cdeb4,_0x15986f){if(_0x1cdeb4[_0xcf72('0x44')]['id']){delete _0x1cdeb4[_0xcf72('0x44')]['id'];}return db[_0xcf72('0x3f')][_0xcf72('0x41')]({'where':{'id':_0x1cdeb4[_0xcf72('0x3e')]['id']}})[_0xcf72('0x22')](handleEntityNotFound(_0x15986f,null))[_0xcf72('0x22')](saveUpdates(_0x1cdeb4['body'],null))[_0xcf72('0x22')](respondWithResult(_0x15986f,null))[_0xcf72('0x42')](handleError(_0x15986f,null));};exports[_0xcf72('0x45')]=function(_0x850dcb,_0x17cb31){return db[_0xcf72('0x3f')][_0xcf72('0x41')]({'where':{'id':_0x850dcb[_0xcf72('0x3e')]['id']}})['then'](handleEntityNotFound(_0x17cb31,null))['then'](removeEntity(_0x17cb31,null))[_0xcf72('0x42')](handleError(_0x17cb31,null));};exports[_0xcf72('0x46')]=function(_0x5c3895,_0x33a37d){return db['VoiceTransferReport']['describe']()[_0xcf72('0x22')](respondWithResult(_0x33a37d,null))[_0xcf72('0x42')](handleError(_0x33a37d,null));}; \ No newline at end of file +var _0x114a=['pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','find','describe','moment','bluebird','mustache','util','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','index','map','VoiceTransferReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0xc83298,_0x5725ad){var _0x2cb344=function(_0xc11401){while(--_0xc11401){_0xc83298['push'](_0xc83298['shift']());}};_0x2cb344(++_0x5725ad);}(_0x114a,0x125));var _0xa114=function(_0x17176e,_0x327d4b){_0x17176e=_0x17176e-0x0;var _0x2ef83d=_0x114a[_0x17176e];return _0x2ef83d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa114('0x0'));var BPromise=require(_0xa114('0x1'));var Mustache=require(_0xa114('0x2'));var util=require(_0xa114('0x3'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa114('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa114('0x5'));var squel=require(_0xa114('0x6'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa114('0x7'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa114('0x8'));var Redis=require(_0xa114('0x9'));var authService=require(_0xa114('0xa'));var qs=require(_0xa114('0xb'));var as=require(_0xa114('0xc'));var hardwareService=require(_0xa114('0xd'));var logger=require(_0xa114('0xe'))(_0xa114('0xf'));var utils=require(_0xa114('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xa114('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45a0eb,_0x8b98cc){_0x8b98cc=_0x8b98cc||0xcc;return function(_0x55f0ea){if(_0x55f0ea){return _0x45a0eb[_0xa114('0x12')](_0x8b98cc);}return _0x45a0eb[_0xa114('0x13')](_0x8b98cc)[_0xa114('0x14')]();};}function respondWithResult(_0x361e5d,_0x27ad34){_0x27ad34=_0x27ad34||0xc8;return function(_0x5d34f7){if(_0x5d34f7){return _0x361e5d['status'](_0x27ad34)[_0xa114('0x15')](_0x5d34f7);}};}function respondWithFilteredResult(_0x57be81,_0x505c1b){return function(_0x4398c4){if(_0x4398c4){var _0x44aa5d=_0x4398c4[_0xa114('0x16')],_0x241a1d=_0x505c1b[_0xa114('0x17')],_0x3eb713=_0x505c1b[_0xa114('0x17')]+_0x505c1b[_0xa114('0x18')],_0x805999;if(_0x3eb713>=_0x44aa5d){_0x3eb713=_0x44aa5d;_0x805999=0xc8;}else{_0x805999=0xce;}_0x57be81[_0xa114('0x13')](_0x805999);return _0x57be81[_0xa114('0x19')](_0xa114('0x1a'),_0x241a1d+'-'+_0x3eb713+'/'+_0x44aa5d)[_0xa114('0x15')](_0x4398c4);}return null;};}function patchUpdates(_0x183f2c){return function(_0x182882){try{jsonpatch[_0xa114('0x1b')](_0x182882,_0x183f2c,!![]);}catch(_0x4909a1){return BPromise['reject'](_0x4909a1);}return _0x182882[_0xa114('0x1c')]();};}function saveUpdates(_0x20f974,_0xc3d1c5){return function(_0x21b435){if(_0x21b435){return _0x21b435[_0xa114('0x1d')](_0x20f974)[_0xa114('0x1e')](function(_0x4c1096){return _0x4c1096;});}return null;};}function removeEntity(_0x3b3521,_0x281e76){return function(_0x557dfb){if(_0x557dfb){return _0x557dfb[_0xa114('0x1f')]()['then'](function(){_0x3b3521[_0xa114('0x13')](0xcc)[_0xa114('0x14')]();});}};}function handleEntityNotFound(_0x33c294,_0x1c69f5){return function(_0x1b5a3c){if(!_0x1b5a3c){_0x33c294[_0xa114('0x12')](0x194);}return _0x1b5a3c;};}function handleError(_0x45d506,_0x42e9dd){_0x42e9dd=_0x42e9dd||0x1f4;return function(_0x326b03){logger['error'](_0x326b03[_0xa114('0x20')]);if(_0x326b03['name']){delete _0x326b03[_0xa114('0x21')];}_0x45d506[_0xa114('0x13')](_0x42e9dd)['send'](_0x326b03);};}exports[_0xa114('0x22')]=function(_0x4b3852,_0x234eac){var _0x22b785={},_0x5a9b48={},_0x4f0d9b={'count':0x0,'rows':[]};var _0x228fb7=_[_0xa114('0x23')](db[_0xa114('0x24')]['rawAttributes'],function(_0x594459){return{'name':_0x594459[_0xa114('0x25')],'type':_0x594459[_0xa114('0x26')][_0xa114('0x27')]};});_0x5a9b48[_0xa114('0x28')]=_[_0xa114('0x23')](_0x228fb7,'name');_0x5a9b48['query']=_['keys'](_0x4b3852[_0xa114('0x29')]);_0x5a9b48[_0xa114('0x2a')]=_[_0xa114('0x2b')](_0x5a9b48['model'],_0x5a9b48[_0xa114('0x29')]);_0x22b785[_0xa114('0x2c')]=_['intersection'](_0x5a9b48[_0xa114('0x28')],qs[_0xa114('0x2d')](_0x4b3852['query'][_0xa114('0x2d')]));_0x22b785['attributes']=_0x22b785['attributes'][_0xa114('0x2e')]?_0x22b785[_0xa114('0x2c')]:_0x5a9b48[_0xa114('0x28')];if(!_0x4b3852[_0xa114('0x29')][_0xa114('0x2f')](_0xa114('0x30'))){_0x22b785[_0xa114('0x18')]=qs[_0xa114('0x18')](_0x4b3852[_0xa114('0x29')][_0xa114('0x18')]);_0x22b785[_0xa114('0x17')]=qs[_0xa114('0x17')](_0x4b3852[_0xa114('0x29')][_0xa114('0x17')]);}_0x22b785[_0xa114('0x31')]=qs[_0xa114('0x32')](_0x4b3852['query']['sort']);_0x22b785[_0xa114('0x33')]=qs['filters'](_[_0xa114('0x34')](_0x4b3852[_0xa114('0x29')],_0x5a9b48[_0xa114('0x2a')]),_0x228fb7);if(_0x4b3852['query'][_0xa114('0x35')]){_0x22b785[_0xa114('0x33')]=_[_0xa114('0x36')](_0x22b785[_0xa114('0x33')],{'$or':_['map'](_0x228fb7,function(_0x237b77){if(_0x237b77[_0xa114('0x26')]!==_0xa114('0x37')){var _0x148b22={};_0x148b22[_0x237b77[_0xa114('0x21')]]={'$like':'%'+_0x4b3852[_0xa114('0x29')][_0xa114('0x35')]+'%'};return _0x148b22;}})});}_0x22b785=_['merge']({},_0x22b785,_0x4b3852[_0xa114('0x38')]);var _0x3fedc1={'where':_0x22b785[_0xa114('0x33')]};return db[_0xa114('0x24')][_0xa114('0x16')](_0x3fedc1)[_0xa114('0x1e')](function(_0x497422){_0x4f0d9b[_0xa114('0x16')]=_0x497422;if(_0x4b3852[_0xa114('0x29')]['includeAll']){_0x22b785[_0xa114('0x39')]=[{'all':!![]}];}return db[_0xa114('0x24')][_0xa114('0x3a')](_0x22b785);})[_0xa114('0x1e')](function(_0x3dde82){_0x4f0d9b[_0xa114('0x3b')]=_0x3dde82;return _0x4f0d9b;})[_0xa114('0x1e')](respondWithFilteredResult(_0x234eac,_0x22b785))[_0xa114('0x3c')](handleError(_0x234eac,null));};exports[_0xa114('0x3d')]=function(_0xd0de5,_0x5aeb8e){var _0x4a77ba={'raw':!![],'where':{'id':_0xd0de5[_0xa114('0x3e')]['id']}},_0x2fbdae={};_0x2fbdae['model']=_['keys'](db[_0xa114('0x24')][_0xa114('0x3f')]);_0x2fbdae[_0xa114('0x29')]=_['keys'](_0xd0de5['query']);_0x2fbdae[_0xa114('0x2a')]=_[_0xa114('0x2b')](_0x2fbdae[_0xa114('0x28')],_0x2fbdae[_0xa114('0x29')]);_0x4a77ba['attributes']=_[_0xa114('0x2b')](_0x2fbdae[_0xa114('0x28')],qs[_0xa114('0x2d')](_0xd0de5[_0xa114('0x29')][_0xa114('0x2d')]));_0x4a77ba['attributes']=_0x4a77ba[_0xa114('0x2c')][_0xa114('0x2e')]?_0x4a77ba[_0xa114('0x2c')]:_0x2fbdae[_0xa114('0x28')];if(_0xd0de5['query'][_0xa114('0x40')]){_0x4a77ba[_0xa114('0x39')]=[{'all':!![]}];}_0x4a77ba=_[_0xa114('0x36')]({},_0x4a77ba,_0xd0de5[_0xa114('0x38')]);return db[_0xa114('0x24')]['find'](_0x4a77ba)['then'](handleEntityNotFound(_0x5aeb8e,null))[_0xa114('0x1e')](respondWithResult(_0x5aeb8e,null))[_0xa114('0x3c')](handleError(_0x5aeb8e,null));};exports[_0xa114('0x41')]=function(_0x5cb4f7,_0x132d2b){return db['VoiceTransferReport'][_0xa114('0x41')](_0x5cb4f7[_0xa114('0x42')],{})['then'](respondWithResult(_0x132d2b,0xc9))[_0xa114('0x3c')](handleError(_0x132d2b,null));};exports[_0xa114('0x1d')]=function(_0x8ee8cc,_0x4722c9){if(_0x8ee8cc['body']['id']){delete _0x8ee8cc[_0xa114('0x42')]['id'];}return db[_0xa114('0x24')][_0xa114('0x43')]({'where':{'id':_0x8ee8cc['params']['id']}})[_0xa114('0x1e')](handleEntityNotFound(_0x4722c9,null))[_0xa114('0x1e')](saveUpdates(_0x8ee8cc[_0xa114('0x42')],null))[_0xa114('0x1e')](respondWithResult(_0x4722c9,null))[_0xa114('0x3c')](handleError(_0x4722c9,null));};exports[_0xa114('0x1f')]=function(_0x4ac33,_0x3e73ec){return db['VoiceTransferReport'][_0xa114('0x43')]({'where':{'id':_0x4ac33[_0xa114('0x3e')]['id']}})[_0xa114('0x1e')](handleEntityNotFound(_0x3e73ec,null))['then'](removeEntity(_0x3e73ec,null))[_0xa114('0x3c')](handleError(_0x3e73ec,null));};exports[_0xa114('0x44')]=function(_0x352c3e,_0x2b9b82){return db[_0xa114('0x24')]['describe']()[_0xa114('0x1e')](respondWithResult(_0x2b9b82,null))[_0xa114('0x3c')](handleError(_0x2b9b82,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 0d3bfce..4181588 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 _0xd94d=['path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','report_call_transfer','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1a1460,_0x539531){var _0x33ab03=function(_0x26a04b){while(--_0x26a04b){_0x1a1460['push'](_0x1a1460['shift']());}};_0x33ab03(++_0x539531);}(_0xd94d,0x16f));var _0xdd94=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd94d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xdd94('0x0'));var logger=require(_0xdd94('0x1'))(_0xdd94('0x2'));var moment=require('moment');var BPromise=require(_0xdd94('0x3'));var rp=require(_0xdd94('0x4'));var fs=require('fs');var path=require(_0xdd94('0x5'));var rimraf=require(_0xdd94('0x6'));var config=require(_0xdd94('0x7'));var attributes=require(_0xdd94('0x8'));module[_0xdd94('0x9')]=function(_0x580c88,_0x1fd8a8){return _0x580c88[_0xdd94('0xa')]('VoiceTransferReport',attributes,{'tableName':_0xdd94('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x712f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer','util','../../config/logger'];(function(_0xe2c24d,_0x2f0305){var _0x5f04e8=function(_0x90c293){while(--_0x90c293){_0xe2c24d['push'](_0xe2c24d['shift']());}};_0x5f04e8(++_0x2f0305);}(_0x712f,0x1de));var _0xf712=function(_0xe53653,_0x2a6489){_0xe53653=_0xe53653-0x0;var _0x544d58=_0x712f[_0xe53653];return _0x544d58;};'use strict';var _=require('lodash');var util=require(_0xf712('0x0'));var logger=require(_0xf712('0x1'))('api');var moment=require(_0xf712('0x2'));var BPromise=require(_0xf712('0x3'));var rp=require(_0xf712('0x4'));var fs=require('fs');var path=require(_0xf712('0x5'));var rimraf=require(_0xf712('0x6'));var config=require(_0xf712('0x7'));var attributes=require(_0xf712('0x8'));module[_0xf712('0x9')]=function(_0x36dd80,_0x571129){return _0x36dd80['define'](_0xf712('0xa'),attributes,{'tableName':_0xf712('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 f93e52b..c352d16 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 _0x2f96=['info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceTransferReport','VoiceTransferReport','options','raw','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f96,0x1b3));var _0x62f9=function(_0x223c26,_0x53099c){_0x223c26=_0x223c26-0x0;var _0x17a8b8=_0x2f96[_0x223c26];return _0x17a8b8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x62f9('0x0'));var BPromise=require(_0x62f9('0x1'));var rs=require(_0x62f9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62f9('0x3'))['db'];var utils=require(_0x62f9('0x4'));var logger=require(_0x62f9('0x5'))(_0x62f9('0x6'));var config=require(_0x62f9('0x7'));var jayson=require(_0x62f9('0x8'));var client=jayson[_0x62f9('0x9')][_0x62f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1168a4,_0x5a7975,_0x11101d){return new BPromise(function(_0x22afae,_0x348a14){return client[_0x62f9('0xb')](_0x1168a4,_0x11101d)[_0x62f9('0xc')](function(_0x419aa5){logger[_0x62f9('0xd')](_0x62f9('0xe'),_0x5a7975,_0x62f9('0xf'));logger[_0x62f9('0x10')](_0x62f9('0x11'),_0x5a7975,_0x62f9('0xf'),JSON[_0x62f9('0x12')](_0x419aa5));if(_0x419aa5['error']){if(_0x419aa5[_0x62f9('0x13')][_0x62f9('0x14')]===0x1f4){logger[_0x62f9('0x13')](_0x62f9('0xe'),_0x5a7975,_0x419aa5[_0x62f9('0x13')][_0x62f9('0x15')]);return _0x348a14(_0x419aa5['error'][_0x62f9('0x15')]);}logger[_0x62f9('0x13')](_0x62f9('0xe'),_0x5a7975,_0x419aa5['error'][_0x62f9('0x15')]);return _0x22afae(_0x419aa5[_0x62f9('0x13')][_0x62f9('0x15')]);}else{logger[_0x62f9('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x5a7975,_0x62f9('0xf'));_0x22afae(_0x419aa5[_0x62f9('0x16')][_0x62f9('0x15')]);}})['catch'](function(_0x166ee6){logger[_0x62f9('0x13')](_0x62f9('0xe'),_0x5a7975,_0x166ee6);_0x348a14(_0x166ee6);});});}exports[_0x62f9('0x17')]=function(_0x47e9f7){var _0x119755=this;return new Promise(function(_0x561ea7,_0x509606){return db[_0x62f9('0x18')]['create'](_0x47e9f7['body'],{'raw':_0x47e9f7[_0x62f9('0x19')]?_0x47e9f7[_0x62f9('0x19')][_0x62f9('0x1a')]===undefined?!![]:![]:!![]})[_0x62f9('0xc')](function(_0x2bd8db){logger['info'](_0x62f9('0x17'),_0x47e9f7);logger[_0x62f9('0x10')](_0x62f9('0x17'),_0x47e9f7,JSON['stringify'](_0x2bd8db));_0x561ea7(_0x2bd8db);})[_0x62f9('0x1b')](function(_0x7b0f43){logger[_0x62f9('0x13')]('CreateVoiceTransferReport',_0x7b0f43[_0x62f9('0x15')],_0x47e9f7);_0x509606(_0x119755[_0x62f9('0x13')](0x1f4,_0x7b0f43[_0x62f9('0x15')]));});});}; \ No newline at end of file +var _0x5080=['VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then'];(function(_0x467651,_0x479bf8){var _0x1e0a30=function(_0x336d70){while(--_0x336d70){_0x467651['push'](_0x467651['shift']());}};_0x1e0a30(++_0x479bf8);}(_0x5080,0x12d));var _0x0508=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5080[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0508('0x0'));var BPromise=require(_0x0508('0x1'));var rs=require(_0x0508('0x2'));var fs=require('fs');var Redis=require(_0x0508('0x3'));var db=require(_0x0508('0x4'))['db'];var utils=require(_0x0508('0x5'));var logger=require('../../config/logger')(_0x0508('0x6'));var config=require(_0x0508('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0508('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a5f63,_0x4d0bfb,_0x17e7a7){return new BPromise(function(_0x4c29fb,_0x1c0f33){return client[_0x0508('0x9')](_0x3a5f63,_0x17e7a7)[_0x0508('0xa')](function(_0x3c4fc9){logger['info'](_0x0508('0xb'),_0x4d0bfb,'request\x20sent');logger[_0x0508('0xc')](_0x0508('0xd'),_0x4d0bfb,_0x0508('0xe'),JSON[_0x0508('0xf')](_0x3c4fc9));if(_0x3c4fc9['error']){if(_0x3c4fc9['error']['code']===0x1f4){logger[_0x0508('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x4d0bfb,_0x3c4fc9[_0x0508('0x10')][_0x0508('0x11')]);return _0x1c0f33(_0x3c4fc9[_0x0508('0x10')]['message']);}logger[_0x0508('0x10')](_0x0508('0xb'),_0x4d0bfb,_0x3c4fc9[_0x0508('0x10')][_0x0508('0x11')]);return _0x4c29fb(_0x3c4fc9['error']['message']);}else{logger[_0x0508('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x4d0bfb,_0x0508('0xe'));_0x4c29fb(_0x3c4fc9[_0x0508('0x13')][_0x0508('0x11')]);}})['catch'](function(_0x13b5d7){logger[_0x0508('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x4d0bfb,_0x13b5d7);_0x1c0f33(_0x13b5d7);});});}exports[_0x0508('0x14')]=function(_0x51587a){var _0x62b47a=this;return new Promise(function(_0x40c904,_0x4fef36){return db[_0x0508('0x15')][_0x0508('0x16')](_0x51587a['body'],{'raw':_0x51587a[_0x0508('0x17')]?_0x51587a[_0x0508('0x17')][_0x0508('0x18')]===undefined?!![]:![]:!![]})[_0x0508('0xa')](function(_0x51c7c3){logger['info'](_0x0508('0x14'),_0x51587a);logger[_0x0508('0xc')]('CreateVoiceTransferReport',_0x51587a,JSON[_0x0508('0xf')](_0x51c7c3));_0x40c904(_0x51c7c3);})[_0x0508('0x19')](function(_0x3bcf31){logger[_0x0508('0x10')](_0x0508('0x14'),_0x3bcf31['message'],_0x51587a);_0x4fef36(_0x62b47a[_0x0508('0x10')](0x1f4,_0x3bcf31[_0x0508('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index ff30119..08cd11d 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 _0xd66c=['isAuthenticated','hangup','answer','/hold','calls','/transfer','transfer','express','../../components/auth/service','./webbar.controller','post','/originate','canUpdate','originate','/hangup'];(function(_0x21276e,_0xe1a22c){var _0x428363=function(_0x55f099){while(--_0x55f099){_0x21276e['push'](_0x21276e['shift']());}};_0x428363(++_0xe1a22c);}(_0xd66c,0x106));var _0xcd66=function(_0xcf5362,_0x358b78){_0xcf5362=_0xcf5362-0x0;var _0x4072a9=_0xd66c[_0xcf5362];return _0x4072a9;};'use strict';var express=require(_0xcd66('0x0'));var router=express['Router']();var auth=require(_0xcd66('0x1'));var controller=require(_0xcd66('0x2'));router[_0xcd66('0x3')](_0xcd66('0x4'),auth['isAuthenticated'](),auth[_0xcd66('0x5')](),controller[_0xcd66('0x6')]);router[_0xcd66('0x3')](_0xcd66('0x7'),auth[_0xcd66('0x8')](),auth[_0xcd66('0x5')](),controller[_0xcd66('0x9')]);router[_0xcd66('0x3')]('/answer',auth[_0xcd66('0x8')](),auth[_0xcd66('0x5')](),controller[_0xcd66('0xa')]);router[_0xcd66('0x3')](_0xcd66('0xb'),auth[_0xcd66('0x8')](),auth['canUpdate'](),controller['hold']);router[_0xcd66('0x3')]('/unhold',auth[_0xcd66('0x8')](),auth[_0xcd66('0x5')](),controller['unhold']);router[_0xcd66('0x3')]('/calls',auth[_0xcd66('0x8')](),auth[_0xcd66('0x5')](),controller[_0xcd66('0xc')]);router[_0xcd66('0x3')](_0xcd66('0xd'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xcd66('0xe')]);module['exports']=router; \ No newline at end of file +var _0x8a1b=['canUpdate','originate','/hangup','isAuthenticated','hangup','/answer','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','./webbar.controller','post'];(function(_0x4cdf7d,_0x4fa52b){var _0x2f9487=function(_0x27cdbb){while(--_0x27cdbb){_0x4cdf7d['push'](_0x4cdf7d['shift']());}};_0x2f9487(++_0x4fa52b);}(_0x8a1b,0xf8));var _0xb8a1=function(_0x452c1c,_0x289664){_0x452c1c=_0x452c1c-0x0;var _0x190193=_0x8a1b[_0x452c1c];return _0x190193;};'use strict';var express=require(_0xb8a1('0x0'));var router=express[_0xb8a1('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xb8a1('0x2'));router[_0xb8a1('0x3')]('/originate',auth['isAuthenticated'](),auth[_0xb8a1('0x4')](),controller[_0xb8a1('0x5')]);router[_0xb8a1('0x3')](_0xb8a1('0x6'),auth[_0xb8a1('0x7')](),auth['canUpdate'](),controller[_0xb8a1('0x8')]);router[_0xb8a1('0x3')](_0xb8a1('0x9'),auth[_0xb8a1('0x7')](),auth[_0xb8a1('0x4')](),controller['answer']);router[_0xb8a1('0x3')]('/hold',auth['isAuthenticated'](),auth[_0xb8a1('0x4')](),controller[_0xb8a1('0xa')]);router['post'](_0xb8a1('0xb'),auth['isAuthenticated'](),auth[_0xb8a1('0x4')](),controller[_0xb8a1('0xc')]);router[_0xb8a1('0x3')](_0xb8a1('0xd'),auth['isAuthenticated'](),auth[_0xb8a1('0x4')](),controller[_0xb8a1('0xe')]);router[_0xb8a1('0x3')](_0xb8a1('0xf'),auth['isAuthenticated'](),auth[_0xb8a1('0x4')](),controller[_0xb8a1('0x10')]);module[_0xb8a1('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 381fbf0..39b7dfc 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 _0xcd1a=['agent','all','UserId','sessionId','length','\x20not\x20found!','originate\x20fired:','body','json','userId','callerId','callbackUrl','info','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','validate','entityFound:','user:%s','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','format','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls\x20fired:','VoiceChannels','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','util','bluebird','client','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','string','number','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','log','handleError:','error','status','send','name','NotFound','then','code','message','result','User','findOne'];(function(_0x2eec39,_0x24b14d){var _0x429715=function(_0x5def86){while(--_0x5def86){_0x2eec39['push'](_0x2eec39['shift']());}};_0x429715(++_0x24b14d);}(_0xcd1a,0x115));var _0xacd1=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xcd1a[_0x2064e5];return _0x21a233;};'use strict';var path=require(_0xacd1('0x0'));var fs=require('fs');var _=require(_0xacd1('0x1'));var db=require(_0xacd1('0x2'))['db'];var config=require('../../config/environment');var util=require(_0xacd1('0x3'));var BPromise=require(_0xacd1('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0xacd1('0x5')]['http']({'port':0x232a});var logger=require(_0xacd1('0x6'))(_0xacd1('0x7'));var Redis=require(_0xacd1('0x8'));config[_0xacd1('0x9')]=_[_0xacd1('0xa')](config['redis'],{'host':_0xacd1('0xb'),'port':0x18eb});var io=require(_0xacd1('0xc'))(new Redis(config[_0xacd1('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xacd1('0xd')},'callbackUrl':{'type':_0xacd1('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0xacd1('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xacd1('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xacd1('0xe'),'required':[!![],_0xacd1('0xf')]},'sessionId':{'type':_0xacd1('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xacd1('0xe'),'required':[!![],_0xacd1('0xf')]},'sessionId':{'type':_0xacd1('0xd'),'required':[!![],_0xacd1('0x10')]},'transferNumber':{'type':_0xacd1('0xd'),'required':[!![],_0xacd1('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xacd1('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xacd1('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xacd1('0xe'),'required':[!![],_0xacd1('0xf')]},'sessionId':{'type':_0xacd1('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xacd1('0xe'),'required':[!![],_0xacd1('0xf')]}});function emit(_0x338166,_0x548ac3,_0x5dd4ee){logger['info'](_0x338166,_0x548ac3,JSON['stringify'](_0x5dd4ee));io['to'](_0x338166)['emit'](_0x548ac3,_0x5dd4ee);}function handleError(_0x20cb36){return function(_0x1efa2c){console[_0xacd1('0x12')](_0xacd1('0x13'),_0x1efa2c,_0x1efa2c instanceof RangeError);logger[_0xacd1('0x14')](_0x1efa2c['stack']);if(_0x1efa2c instanceof RangeError){if(_0x1efa2c['name']){delete _0x1efa2c['name'];}_0x20cb36[_0xacd1('0x15')](0x194)[_0xacd1('0x16')](_0x1efa2c);}else{if(_0x1efa2c[_0xacd1('0x17')]){delete _0x1efa2c[_0xacd1('0x17')];}_0x20cb36[_0xacd1('0x15')](0x1f4)[_0xacd1('0x16')](_0x1efa2c);}};}function checkError(){return function(_0x18fc4f){if(!_0x18fc4f){throw new RangeError(_0xacd1('0x18'));}return _0x18fc4f;};}function respondWithRpcPromise(_0x1ad877,_0x58518){return new BPromise(function(_0x27fc19,_0xc2371f){var _0xbfd9bb=amiClient;return _0xbfd9bb['request'](_0x1ad877,_0x58518)[_0xacd1('0x19')](function(_0x340371){if(_0x340371[_0xacd1('0x14')]){if(_0x340371['error'][_0xacd1('0x1a')]===0x1f4){return _0xc2371f(_0x340371[_0xacd1('0x14')][_0xacd1('0x1b')]);}return _0x27fc19(_0x340371['error']['message']);}else{_0x27fc19(_0x340371[_0xacd1('0x1c')]);}})['catch'](function(_0x3d6a1f){_0xc2371f(_0x3d6a1f);});});}function getAgent(_0x5c19b8){return db[_0xacd1('0x1d')][_0xacd1('0x1e')]({'where':{'id':_0x5c19b8,'role':_0xacd1('0x1f')}})[_0xacd1('0x19')](checkError());}function getAgentCheckSession(_0x3a1a01,_0xf8e439){return new BPromise(function(_0x119960,_0x559f29){var _0x2f9320=respondWithRpcPromise('VoiceChannels');var _0x5379ee=getAgent(_0x3a1a01);Promise[_0xacd1('0x20')]([_0x2f9320,_0x5379ee])['then'](function(_0xb31f68){var _0x389082=_0xb31f68[0x0];var _0x1bd9c8=_0xb31f68[0x1];var _0x313a7d=_['filter'](_0x389082['rows'],function(_0x3b13fa){return _0x3b13fa[_0xacd1('0x21')]==_0x1bd9c8['id']&&_0x3b13fa[_0xacd1('0x22')]==_0xf8e439;});if(_0x313a7d[_0xacd1('0x23')]==0x1){_0x119960(_0x1bd9c8);}else{_0x559f29(new RangeError('sessionId\x20'+_0xf8e439+_0xacd1('0x24')));}});});}exports['originate']=function(_0x369ead,_0xb96b4f){logger['info'](_0xacd1('0x25'),_0x369ead[_0xacd1('0x26')]);var _0x3d6a8c=originateValidation['validate'](_0x369ead[_0xacd1('0x26')]);if(_0x3d6a8c[_0xacd1('0x23')]>0x0){return _0xb96b4f[_0xacd1('0x15')](0x190)[_0xacd1('0x27')](_0x3d6a8c);}var _0x10275b=_0x369ead['body'][_0xacd1('0x28')];var _0x42edf6=_0x369ead['body']['callNumber'];var _0x47dfb4=_0x369ead[_0xacd1('0x26')][_0xacd1('0x29')];var _0x2a2f8a=_0x369ead[_0xacd1('0x26')][_0xacd1('0x2a')];return getAgent(_0x10275b)[_0xacd1('0x19')](function(_0xd0b118){logger[_0xacd1('0x2b')]('entityFound:',_0xd0b118[_0xacd1('0x17')]);emit(util['format']('user:%s',_0xd0b118[_0xacd1('0x17')]),_0xacd1('0x2c'),{'callNumber':_0x42edf6,'callerId':_0x47dfb4,'callbackUrl':_0x2a2f8a});return _0xb96b4f[_0xacd1('0x15')](0xc8)[_0xacd1('0x27')]({'error':![],'message':_0xacd1('0x2d')});})[_0xacd1('0x2e')](handleError(_0xb96b4f));};exports[_0xacd1('0x2f')]=function(_0x5013f5,_0xc6f274){logger[_0xacd1('0x2b')](_0xacd1('0x30'),_0x5013f5[_0xacd1('0x26')]);var _0x280fc8=hangupValidation[_0xacd1('0x31')](_0x5013f5['body']);if(_0x280fc8[_0xacd1('0x23')]>0x0){return _0xc6f274[_0xacd1('0x15')](0x190)[_0xacd1('0x27')](_0x280fc8);}var _0x59e052=_0x5013f5[_0xacd1('0x26')][_0xacd1('0x28')];var _0x4f761f=_0x5013f5[_0xacd1('0x26')][_0xacd1('0x22')];return getAgent(_0x59e052)[_0xacd1('0x19')](function(_0x44350f){logger['info'](_0xacd1('0x32'),_0x44350f[_0xacd1('0x17')]);emit(util['format'](_0xacd1('0x33'),_0x44350f[_0xacd1('0x17')]),_0xacd1('0x34'),{'sessionId':_0x4f761f});return _0xc6f274[_0xacd1('0x15')](0xc8)[_0xacd1('0x27')]({'error':![],'message':_0xacd1('0x35')});})[_0xacd1('0x2e')](handleError(_0xc6f274));};exports[_0xacd1('0x36')]=function(_0x56a1b2,_0x71be59){logger[_0xacd1('0x2b')](_0xacd1('0x37'),_0x56a1b2[_0xacd1('0x26')]);var _0xa415b7=answerValidation[_0xacd1('0x31')](_0x56a1b2[_0xacd1('0x26')]);if(_0xa415b7[_0xacd1('0x23')]>0x0){return _0x71be59['status'](0x190)[_0xacd1('0x27')](_0xa415b7);}var _0x197d50=_0x56a1b2[_0xacd1('0x26')][_0xacd1('0x28')];var _0x7d85c2=_0x56a1b2[_0xacd1('0x26')][_0xacd1('0x22')];return getAgent(_0x197d50)[_0xacd1('0x19')](function(_0x44ff02){logger[_0xacd1('0x2b')](_0xacd1('0x32'),_0x44ff02[_0xacd1('0x17')]);emit(util['format'](_0xacd1('0x33'),_0x44ff02[_0xacd1('0x17')]),_0xacd1('0x38'),{'sessionId':_0x7d85c2});return _0x71be59[_0xacd1('0x15')](0xc8)[_0xacd1('0x27')]({'error':![],'message':_0xacd1('0x39')});})['catch'](handleError(_0x71be59));};exports['hold']=function(_0x173dea,_0x346667){logger[_0xacd1('0x2b')](_0xacd1('0x3a'),_0x173dea['body']);var _0x2712b4=holdValidation[_0xacd1('0x31')](_0x173dea[_0xacd1('0x26')]);if(_0x2712b4[_0xacd1('0x23')]>0x0){return _0x346667[_0xacd1('0x15')](0x190)[_0xacd1('0x27')](_0x2712b4);}var _0x3c4f45=_0x173dea['body'][_0xacd1('0x28')];var _0x228231=_0x173dea[_0xacd1('0x26')][_0xacd1('0x22')];return getAgent(_0x3c4f45)['then'](function(_0x4826b2){logger[_0xacd1('0x2b')](_0xacd1('0x32'),_0x4826b2[_0xacd1('0x17')]);emit(util[_0xacd1('0x3b')](_0xacd1('0x33'),_0x4826b2['name']),_0xacd1('0x3c'),{'sessionId':_0x228231});return _0x346667[_0xacd1('0x15')](0xc8)[_0xacd1('0x27')]({'error':![],'message':_0xacd1('0x3d')});})[_0xacd1('0x2e')](handleError(_0x346667));};exports[_0xacd1('0x3e')]=function(_0x5e9e3f,_0x554f99){logger[_0xacd1('0x2b')]('unhold\x20fired:',_0x5e9e3f[_0xacd1('0x26')]);var _0x22ae6d=unholdValidation['validate'](_0x5e9e3f[_0xacd1('0x26')]);if(_0x22ae6d[_0xacd1('0x23')]>0x0){return _0x554f99['status'](0x190)[_0xacd1('0x27')](_0x22ae6d);}var _0x851c24=_0x5e9e3f[_0xacd1('0x26')][_0xacd1('0x28')];var _0x3a31cf=_0x5e9e3f[_0xacd1('0x26')]['sessionId'];return getAgent(_0x851c24)['then'](function(_0x50a629){logger[_0xacd1('0x2b')](_0xacd1('0x32'),_0x50a629[_0xacd1('0x17')]);emit(util[_0xacd1('0x3b')](_0xacd1('0x33'),_0x50a629[_0xacd1('0x17')]),_0xacd1('0x3f'),{'sessionId':_0x3a31cf});return _0x554f99[_0xacd1('0x15')](0xc8)[_0xacd1('0x27')]({'error':![],'message':_0xacd1('0x40')});})[_0xacd1('0x2e')](handleError(_0x554f99));};exports['calls']=function(_0x396954,_0x34a5e4){logger[_0xacd1('0x2b')](_0xacd1('0x41'),_0x34a5e4['body']);var _0x33d571=callsValidation[_0xacd1('0x31')](_0x396954[_0xacd1('0x26')]);if(_0x33d571[_0xacd1('0x23')]>0x0){return _0x34a5e4['status'](0x190)[_0xacd1('0x27')](_0x33d571);}var _0x978ee9=_0x396954[_0xacd1('0x26')]['userId'];var _0x4178ef=respondWithRpcPromise(_0xacd1('0x42'));var _0x40b2f1=getAgent(_0x978ee9);return Promise['all']([_0x4178ef,_0x40b2f1])[_0xacd1('0x19')](function(_0x573860){var _0x3ffe4d=_0x573860[0x0];var _0x281a1d=_0x573860[0x1];var _0x2d2fcf=_['filter'](_0x3ffe4d[_0xacd1('0x43')],function(_0x3c9761){return _0x3c9761[_0xacd1('0x21')]==_0x281a1d['id'];});return _0x34a5e4['status'](0xc8)[_0xacd1('0x27')]({'count':_0x2d2fcf['length'],'rows':_0x2d2fcf});})[_0xacd1('0x2e')](handleError(_0x34a5e4));};exports[_0xacd1('0x44')]=function(_0x479eb1,_0x34f1b2){logger[_0xacd1('0x2b')](_0xacd1('0x45'),_0x479eb1[_0xacd1('0x26')]);var _0x3cd20e=conferenceValidation[_0xacd1('0x31')](_0x479eb1[_0xacd1('0x26')]);if(_0x3cd20e[_0xacd1('0x23')]>0x0){return _0x34f1b2[_0xacd1('0x15')](0x190)[_0xacd1('0x27')](_0x3cd20e);}var _0xf76c13=_0x479eb1[_0xacd1('0x26')]['userId'];return getAgent(_0xf76c13)[_0xacd1('0x19')](function(_0x39a18f){logger[_0xacd1('0x2b')](_0xacd1('0x32'),_0x39a18f[_0xacd1('0x17')]);emit(util[_0xacd1('0x3b')]('user:%s',_0x39a18f[_0xacd1('0x17')]),_0xacd1('0x46'));return _0x34f1b2['status'](0xc8)['json']({'error':![],'message':_0xacd1('0x47')});})['catch'](handleError(_0x34f1b2));};exports[_0xacd1('0x48')]=function(_0x520782,_0x12240e){logger[_0xacd1('0x2b')](_0xacd1('0x49'),_0x520782[_0xacd1('0x26')]);var _0x3c24d3=transferValidation[_0xacd1('0x31')](_0x520782[_0xacd1('0x26')]);if(_0x3c24d3[_0xacd1('0x23')]>0x0){return _0x12240e[_0xacd1('0x15')](0x190)[_0xacd1('0x27')](_0x3c24d3);}var _0x28f77c=_0x520782[_0xacd1('0x26')][_0xacd1('0x28')];var _0x52e9da=_0x520782[_0xacd1('0x26')][_0xacd1('0x22')];var _0xccc824=_0x520782['body'][_0xacd1('0x4a')];return getAgent(_0x28f77c)[_0xacd1('0x19')](function(_0x317ed8){logger[_0xacd1('0x2b')]('entityFound:',_0x317ed8[_0xacd1('0x17')]);emit(util[_0xacd1('0x3b')](_0xacd1('0x33'),_0x317ed8[_0xacd1('0x17')]),_0xacd1('0x4b'),{'sessionId':_0x52e9da,'transferNumber':_0xccc824});return _0x12240e[_0xacd1('0x15')](0xc8)['json']({'error':![],'message':_0xacd1('0x4c')});})[_0xacd1('0x2e')](handleError(_0x12240e));}; \ No newline at end of file +var _0xbe45=['userId','webbar:answer','answer\x20executed!','hold','hold\x20executed!','unhold','unhold\x20fired:','format','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','transfer','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../config/environment','util','bluebird','jayson/promise','client','http','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','stack','name','status','send','then','error','message','result','catch','User','findOne','VoiceChannels','all','rows','UserId','sessionId','sessionId\x20','originate\x20fired:','body','length','json','callNumber','callerId','webbar:originate','originate\x20executed!','hangup\x20fired:','entityFound:','user:%s','hangup\x20executed!','answer','answer\x20fired:'];(function(_0x58b44c,_0x1eb95c){var _0x16be81=function(_0x3d602a){while(--_0x3d602a){_0x58b44c['push'](_0x58b44c['shift']());}};_0x16be81(++_0x1eb95c);}(_0xbe45,0xf0));var _0x5be4=function(_0x16bc57,_0x323a47){_0x16bc57=_0x16bc57-0x0;var _0x14d6ff=_0xbe45[_0x16bc57];return _0x14d6ff;};'use strict';var path=require(_0x5be4('0x0'));var fs=require('fs');var _=require(_0x5be4('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x5be4('0x2'));var util=require(_0x5be4('0x3'));var BPromise=require(_0x5be4('0x4'));var jayson=require(_0x5be4('0x5'));var amiClient=jayson[_0x5be4('0x6')][_0x5be4('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0x5be4('0x8'));var Redis=require(_0x5be4('0x9'));config[_0x5be4('0xa')]=_[_0x5be4('0xb')](config[_0x5be4('0xa')],{'host':_0x5be4('0xc'),'port':0x18eb});var io=require(_0x5be4('0xd'))(new Redis(config[_0x5be4('0xa')]));var Schema=require(_0x5be4('0xe'));var originateValidation=new Schema({'userId':{'type':_0x5be4('0xf'),'required':[!![],_0x5be4('0x10')]},'callNumber':{'type':_0x5be4('0x11'),'required':[!![],_0x5be4('0x12')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x5be4('0x11')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x5be4('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5be4('0x10')]},'sessionId':{'type':_0x5be4('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5be4('0x10')]},'sessionId':{'type':_0x5be4('0x11'),'required':[!![],_0x5be4('0x13')]},'transferNumber':{'type':'string','required':[!![],_0x5be4('0x14')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5be4('0x10')]},'sessionId':{'type':_0x5be4('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x5be4('0xf'),'required':[!![],_0x5be4('0x10')]},'sessionId':{'type':_0x5be4('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x5be4('0xf'),'required':[!![],_0x5be4('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5be4('0x10')]}});function emit(_0x8466a7,_0x1d7db7,_0x11e581){logger[_0x5be4('0x15')](_0x8466a7,_0x1d7db7,JSON[_0x5be4('0x16')](_0x11e581));io['to'](_0x8466a7)[_0x5be4('0x17')](_0x1d7db7,_0x11e581);}function handleError(_0x2b704d){return function(_0x51662a){console[_0x5be4('0x18')]('handleError:',_0x51662a,_0x51662a instanceof RangeError);logger['error'](_0x51662a[_0x5be4('0x19')]);if(_0x51662a instanceof RangeError){if(_0x51662a[_0x5be4('0x1a')]){delete _0x51662a['name'];}_0x2b704d[_0x5be4('0x1b')](0x194)[_0x5be4('0x1c')](_0x51662a);}else{if(_0x51662a['name']){delete _0x51662a['name'];}_0x2b704d[_0x5be4('0x1b')](0x1f4)[_0x5be4('0x1c')](_0x51662a);}};}function checkError(){return function(_0x4b73f9){if(!_0x4b73f9){throw new RangeError('NotFound');}return _0x4b73f9;};}function respondWithRpcPromise(_0x9bdadd,_0x132489){return new BPromise(function(_0x2843e3,_0x3ccd67){var _0xa20552=amiClient;return _0xa20552['request'](_0x9bdadd,_0x132489)[_0x5be4('0x1d')](function(_0x51d7a7){if(_0x51d7a7[_0x5be4('0x1e')]){if(_0x51d7a7[_0x5be4('0x1e')]['code']===0x1f4){return _0x3ccd67(_0x51d7a7[_0x5be4('0x1e')][_0x5be4('0x1f')]);}return _0x2843e3(_0x51d7a7['error'][_0x5be4('0x1f')]);}else{_0x2843e3(_0x51d7a7[_0x5be4('0x20')]);}})[_0x5be4('0x21')](function(_0x39cf54){_0x3ccd67(_0x39cf54);});});}function getAgent(_0xa7a16){return db[_0x5be4('0x22')][_0x5be4('0x23')]({'where':{'id':_0xa7a16,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x51584f,_0x29b1f4){return new BPromise(function(_0x39430a,_0x5c489e){var _0xd88995=respondWithRpcPromise(_0x5be4('0x24'));var _0x3bd842=getAgent(_0x51584f);Promise[_0x5be4('0x25')]([_0xd88995,_0x3bd842])[_0x5be4('0x1d')](function(_0x1e0485){var _0x4b9029=_0x1e0485[0x0];var _0x1661c2=_0x1e0485[0x1];var _0x17a291=_['filter'](_0x4b9029[_0x5be4('0x26')],function(_0x49780a){return _0x49780a[_0x5be4('0x27')]==_0x1661c2['id']&&_0x49780a[_0x5be4('0x28')]==_0x29b1f4;});if(_0x17a291['length']==0x1){_0x39430a(_0x1661c2);}else{_0x5c489e(new RangeError(_0x5be4('0x29')+_0x29b1f4+'\x20not\x20found!'));}});});}exports['originate']=function(_0x11929e,_0x337ca1){logger[_0x5be4('0x15')](_0x5be4('0x2a'),_0x11929e[_0x5be4('0x2b')]);var _0x23775c=originateValidation[_0x5be4('0xe')](_0x11929e[_0x5be4('0x2b')]);if(_0x23775c[_0x5be4('0x2c')]>0x0){return _0x337ca1[_0x5be4('0x1b')](0x190)[_0x5be4('0x2d')](_0x23775c);}var _0x3c9b5c=_0x11929e['body']['userId'];var _0x31e023=_0x11929e[_0x5be4('0x2b')][_0x5be4('0x2e')];var _0x2af6c3=_0x11929e['body'][_0x5be4('0x2f')];var _0x4ae580=_0x11929e[_0x5be4('0x2b')]['callbackUrl'];return getAgent(_0x3c9b5c)[_0x5be4('0x1d')](function(_0x146a7b){logger['info']('entityFound:',_0x146a7b[_0x5be4('0x1a')]);emit(util['format']('user:%s',_0x146a7b[_0x5be4('0x1a')]),_0x5be4('0x30'),{'callNumber':_0x31e023,'callerId':_0x2af6c3,'callbackUrl':_0x4ae580});return _0x337ca1[_0x5be4('0x1b')](0xc8)['json']({'error':![],'message':_0x5be4('0x31')});})[_0x5be4('0x21')](handleError(_0x337ca1));};exports['hangup']=function(_0xeb99b5,_0x46953c){logger[_0x5be4('0x15')](_0x5be4('0x32'),_0xeb99b5['body']);var _0x68cd9=hangupValidation[_0x5be4('0xe')](_0xeb99b5[_0x5be4('0x2b')]);if(_0x68cd9[_0x5be4('0x2c')]>0x0){return _0x46953c[_0x5be4('0x1b')](0x190)[_0x5be4('0x2d')](_0x68cd9);}var _0x11d139=_0xeb99b5[_0x5be4('0x2b')]['userId'];var _0x41f02e=_0xeb99b5[_0x5be4('0x2b')][_0x5be4('0x28')];return getAgent(_0x11d139)[_0x5be4('0x1d')](function(_0x304fab){logger['info'](_0x5be4('0x33'),_0x304fab[_0x5be4('0x1a')]);emit(util['format'](_0x5be4('0x34'),_0x304fab[_0x5be4('0x1a')]),'webbar:hangup',{'sessionId':_0x41f02e});return _0x46953c[_0x5be4('0x1b')](0xc8)[_0x5be4('0x2d')]({'error':![],'message':_0x5be4('0x35')});})[_0x5be4('0x21')](handleError(_0x46953c));};exports[_0x5be4('0x36')]=function(_0x14ae03,_0x1ab4de){logger[_0x5be4('0x15')](_0x5be4('0x37'),_0x14ae03['body']);var _0x1add45=answerValidation['validate'](_0x14ae03[_0x5be4('0x2b')]);if(_0x1add45[_0x5be4('0x2c')]>0x0){return _0x1ab4de['status'](0x190)[_0x5be4('0x2d')](_0x1add45);}var _0x48c1db=_0x14ae03['body'][_0x5be4('0x38')];var _0x126812=_0x14ae03[_0x5be4('0x2b')][_0x5be4('0x28')];return getAgent(_0x48c1db)[_0x5be4('0x1d')](function(_0x224321){logger[_0x5be4('0x15')]('entityFound:',_0x224321[_0x5be4('0x1a')]);emit(util['format'](_0x5be4('0x34'),_0x224321['name']),_0x5be4('0x39'),{'sessionId':_0x126812});return _0x1ab4de[_0x5be4('0x1b')](0xc8)['json']({'error':![],'message':_0x5be4('0x3a')});})[_0x5be4('0x21')](handleError(_0x1ab4de));};exports[_0x5be4('0x3b')]=function(_0x4f548c,_0x17fabd){logger[_0x5be4('0x15')]('hold\x20fired:',_0x4f548c[_0x5be4('0x2b')]);var _0x4d9bbb=holdValidation['validate'](_0x4f548c[_0x5be4('0x2b')]);if(_0x4d9bbb[_0x5be4('0x2c')]>0x0){return _0x17fabd['status'](0x190)[_0x5be4('0x2d')](_0x4d9bbb);}var _0x57f25d=_0x4f548c['body'][_0x5be4('0x38')];var _0xa8b6a9=_0x4f548c[_0x5be4('0x2b')]['sessionId'];return getAgent(_0x57f25d)['then'](function(_0x378ae7){logger[_0x5be4('0x15')](_0x5be4('0x33'),_0x378ae7[_0x5be4('0x1a')]);emit(util['format'](_0x5be4('0x34'),_0x378ae7[_0x5be4('0x1a')]),'webbar:hold',{'sessionId':_0xa8b6a9});return _0x17fabd[_0x5be4('0x1b')](0xc8)[_0x5be4('0x2d')]({'error':![],'message':_0x5be4('0x3c')});})['catch'](handleError(_0x17fabd));};exports[_0x5be4('0x3d')]=function(_0x3481c9,_0xc9ca2f){logger[_0x5be4('0x15')](_0x5be4('0x3e'),_0x3481c9[_0x5be4('0x2b')]);var _0x1396ce=unholdValidation[_0x5be4('0xe')](_0x3481c9[_0x5be4('0x2b')]);if(_0x1396ce[_0x5be4('0x2c')]>0x0){return _0xc9ca2f['status'](0x190)[_0x5be4('0x2d')](_0x1396ce);}var _0x5f5851=_0x3481c9[_0x5be4('0x2b')][_0x5be4('0x38')];var _0xafdf6e=_0x3481c9[_0x5be4('0x2b')][_0x5be4('0x28')];return getAgent(_0x5f5851)[_0x5be4('0x1d')](function(_0x40e5e3){logger[_0x5be4('0x15')](_0x5be4('0x33'),_0x40e5e3[_0x5be4('0x1a')]);emit(util[_0x5be4('0x3f')]('user:%s',_0x40e5e3[_0x5be4('0x1a')]),_0x5be4('0x40'),{'sessionId':_0xafdf6e});return _0xc9ca2f[_0x5be4('0x1b')](0xc8)[_0x5be4('0x2d')]({'error':![],'message':_0x5be4('0x41')});})['catch'](handleError(_0xc9ca2f));};exports[_0x5be4('0x42')]=function(_0xaae2c,_0xf454e6){logger[_0x5be4('0x15')](_0x5be4('0x43'),_0xf454e6[_0x5be4('0x2b')]);var _0x7d2b3c=callsValidation['validate'](_0xaae2c[_0x5be4('0x2b')]);if(_0x7d2b3c['length']>0x0){return _0xf454e6[_0x5be4('0x1b')](0x190)[_0x5be4('0x2d')](_0x7d2b3c);}var _0x5b8b7a=_0xaae2c[_0x5be4('0x2b')][_0x5be4('0x38')];var _0x3c3ebb=respondWithRpcPromise(_0x5be4('0x24'));var _0x29ca73=getAgent(_0x5b8b7a);return Promise[_0x5be4('0x25')]([_0x3c3ebb,_0x29ca73])[_0x5be4('0x1d')](function(_0xc2719f){var _0x570c5d=_0xc2719f[0x0];var _0x5bb7ce=_0xc2719f[0x1];var _0x3052d8=_['filter'](_0x570c5d[_0x5be4('0x26')],function(_0x562e1d){return _0x562e1d[_0x5be4('0x27')]==_0x5bb7ce['id'];});return _0xf454e6[_0x5be4('0x1b')](0xc8)[_0x5be4('0x2d')]({'count':_0x3052d8[_0x5be4('0x2c')],'rows':_0x3052d8});})[_0x5be4('0x21')](handleError(_0xf454e6));};exports[_0x5be4('0x44')]=function(_0x3991cb,_0x5d8f53){logger[_0x5be4('0x15')](_0x5be4('0x45'),_0x3991cb['body']);var _0x3c862b=conferenceValidation[_0x5be4('0xe')](_0x3991cb[_0x5be4('0x2b')]);if(_0x3c862b[_0x5be4('0x2c')]>0x0){return _0x5d8f53[_0x5be4('0x1b')](0x190)['json'](_0x3c862b);}var _0x3d1ad3=_0x3991cb[_0x5be4('0x2b')][_0x5be4('0x38')];return getAgent(_0x3d1ad3)[_0x5be4('0x1d')](function(_0x915605){logger['info'](_0x5be4('0x33'),_0x915605['name']);emit(util[_0x5be4('0x3f')](_0x5be4('0x34'),_0x915605[_0x5be4('0x1a')]),'webbar:conference');return _0x5d8f53[_0x5be4('0x1b')](0xc8)[_0x5be4('0x2d')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x5d8f53));};exports[_0x5be4('0x46')]=function(_0xbaf63b,_0x48816f){logger[_0x5be4('0x15')](_0x5be4('0x47'),_0xbaf63b[_0x5be4('0x2b')]);var _0x51b6af=transferValidation[_0x5be4('0xe')](_0xbaf63b[_0x5be4('0x2b')]);if(_0x51b6af[_0x5be4('0x2c')]>0x0){return _0x48816f[_0x5be4('0x1b')](0x190)[_0x5be4('0x2d')](_0x51b6af);}var _0x2aa387=_0xbaf63b[_0x5be4('0x2b')][_0x5be4('0x38')];var _0x5a7d62=_0xbaf63b[_0x5be4('0x2b')][_0x5be4('0x28')];var _0x4743b8=_0xbaf63b[_0x5be4('0x2b')][_0x5be4('0x48')];return getAgent(_0x2aa387)[_0x5be4('0x1d')](function(_0x2995e6){logger[_0x5be4('0x15')](_0x5be4('0x33'),_0x2995e6[_0x5be4('0x1a')]);emit(util[_0x5be4('0x3f')]('user:%s',_0x2995e6['name']),_0x5be4('0x49'),{'sessionId':_0x5a7d62,'transferNumber':_0x4743b8});return _0x48816f[_0x5be4('0x1b')](0xc8)[_0x5be4('0x2d')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x48816f));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 826b48b..290d972 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 _0xac7c=['/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','create','addDisposition','post','addAnswer','addAgents','addApplications','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','get'];(function(_0x40df5f,_0x8fd59f){var _0x1573f1=function(_0x57b8b8){while(--_0x57b8b8){_0x40df5f['push'](_0x40df5f['shift']());}};_0x1573f1(++_0x8fd59f);}(_0xac7c,0xfe));var _0xcac7=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xac7c[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0xcac7('0x0'));var util=require('util');var path=require(_0xcac7('0x1'));var timeout=require(_0xcac7('0x2'));var express=require(_0xcac7('0x3'));var router=express[_0xcac7('0x4')]();var fs_extra=require(_0xcac7('0x5'));var auth=require(_0xcac7('0x6'));var interaction=require(_0xcac7('0x7'));var config=require(_0xcac7('0x8'));var controller=require(_0xcac7('0x9'));router['get']('/',auth[_0xcac7('0xa')](),controller['index']);router[_0xcac7('0xb')](_0xcac7('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xcac7('0xb')](_0xcac7('0xd'),auth[_0xcac7('0xa')](),controller[_0xcac7('0xe')]);router[_0xcac7('0xb')](_0xcac7('0xf'),auth[_0xcac7('0xa')](),controller[_0xcac7('0x10')]);router['get'](_0xcac7('0x11'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xcac7('0xb')](_0xcac7('0x12'),auth[_0xcac7('0xa')](),controller[_0xcac7('0x13')]);router[_0xcac7('0xb')](_0xcac7('0x14'),auth[_0xcac7('0xa')](),controller[_0xcac7('0x15')]);router['post']('/',auth[_0xcac7('0xa')](),controller[_0xcac7('0x16')]);router['post'](_0xcac7('0xf'),auth[_0xcac7('0xa')](),controller[_0xcac7('0x17')]);router[_0xcac7('0x18')](_0xcac7('0x11'),auth[_0xcac7('0xa')](),controller[_0xcac7('0x19')]);router[_0xcac7('0x18')](_0xcac7('0x12'),auth[_0xcac7('0xa')](),controller[_0xcac7('0x1a')]);router[_0xcac7('0x18')](_0xcac7('0x14'),auth[_0xcac7('0xa')](),controller[_0xcac7('0x1b')]);router[_0xcac7('0x18')]('/:id/notify',controller[_0xcac7('0x1c')]);router['post'](_0xcac7('0x1d'),auth[_0xcac7('0xa')](),controller[_0xcac7('0x1e')]);router[_0xcac7('0x1f')]('/:id',auth[_0xcac7('0xa')](),controller[_0xcac7('0x20')]);router[_0xcac7('0x21')](_0xcac7('0xd'),auth[_0xcac7('0xa')](),controller[_0xcac7('0x22')]);router[_0xcac7('0x21')](_0xcac7('0xf'),auth['isAuthenticated'](),controller[_0xcac7('0x23')]);router['delete'](_0xcac7('0x11'),auth[_0xcac7('0xa')](),controller['removeAnswers']);router[_0xcac7('0x21')](_0xcac7('0x12'),auth[_0xcac7('0xa')](),controller[_0xcac7('0x24')]);module[_0xcac7('0x25')]=router; \ No newline at end of file +var _0x7179=['removeDispositions','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','index','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','create','post','/:id/dispositions','addDisposition','addAgents','/:id/notify','notify','/:id/send','put','update','delete','destroy'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7179,0x66));var _0x9717=function(_0x5c9fb9,_0x43a233){_0x5c9fb9=_0x5c9fb9-0x0;var _0x3e52f7=_0x7179[_0x5c9fb9];return _0x3e52f7;};'use strict';var multer=require('multer');var util=require(_0x9717('0x0'));var path=require(_0x9717('0x1'));var timeout=require(_0x9717('0x2'));var express=require(_0x9717('0x3'));var router=express[_0x9717('0x4')]();var fs_extra=require(_0x9717('0x5'));var auth=require(_0x9717('0x6'));var interaction=require(_0x9717('0x7'));var config=require('../../config/environment');var controller=require(_0x9717('0x8'));router[_0x9717('0x9')]('/',auth[_0x9717('0xa')](),controller[_0x9717('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x9717('0xc'),auth[_0x9717('0xa')](),controller['show']);router[_0x9717('0x9')]('/:id/dispositions',auth[_0x9717('0xa')](),controller[_0x9717('0xd')]);router[_0x9717('0x9')](_0x9717('0xe'),auth[_0x9717('0xa')](),controller[_0x9717('0xf')]);router['get'](_0x9717('0x10'),auth[_0x9717('0xa')](),controller[_0x9717('0x11')]);router[_0x9717('0x9')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router['post']('/',auth['isAuthenticated'](),controller[_0x9717('0x12')]);router[_0x9717('0x13')](_0x9717('0x14'),auth[_0x9717('0xa')](),controller[_0x9717('0x15')]);router[_0x9717('0x13')](_0x9717('0xe'),auth[_0x9717('0xa')](),controller['addAnswer']);router[_0x9717('0x13')](_0x9717('0x10'),auth[_0x9717('0xa')](),controller[_0x9717('0x16')]);router[_0x9717('0x13')]('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0x9717('0x13')](_0x9717('0x17'),controller[_0x9717('0x18')]);router[_0x9717('0x13')](_0x9717('0x19'),auth[_0x9717('0xa')](),controller['send']);router[_0x9717('0x1a')]('/:id',auth[_0x9717('0xa')](),controller[_0x9717('0x1b')]);router[_0x9717('0x1c')](_0x9717('0xc'),auth[_0x9717('0xa')](),controller[_0x9717('0x1d')]);router[_0x9717('0x1c')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9717('0x1e')]);router[_0x9717('0x1c')](_0x9717('0xe'),auth[_0x9717('0xa')](),controller['removeAnswers']);router[_0x9717('0x1c')]('/:id/users',auth[_0x9717('0xa')](),controller[_0x9717('0x1f')]);module[_0x9717('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index cf41ef9..b2980c1 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 _0x11cf=['ENUM','twilio','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','name','generate'];(function(_0x9808,_0x1ab3ef){var _0x1c2f0f=function(_0x5efada){while(--_0x5efada){_0x9808['push'](_0x9808['shift']());}};_0x1c2f0f(++_0x1ab3ef);}(_0x11cf,0x1c3));var _0xf11c=function(_0x47bddb,_0x4fa570){_0x47bddb=_0x47bddb-0x0;var _0x32e2f5=_0x11cf[_0x47bddb];return _0x32e2f5;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xf11c('0x0'));module['exports']={'name':{'type':Sequelize[_0xf11c('0x1')],'unique':_0xf11c('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xf11c('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xf11c('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xf11c('0x1')],'defaultValue':function(){return rs[_0xf11c('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf11c('0x4')](_0xf11c('0x5'))},'accountSid':{'type':Sequelize[_0xf11c('0x1')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xf11c('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xf11c('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf11c('0x8')],'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['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf11c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf11c('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf11c('0x9'),'set':function(_0x544a0c){if(!_0x544a0c){this[_0xf11c('0xa')](_0xf11c('0xb'),null);}this['setDataValue'](_0xf11c('0xc'),_0x544a0c);}},'description':{'type':Sequelize[_0xf11c('0x1')]}}; \ No newline at end of file +var _0x4592=['setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x1ccb1e,_0x27f0e6){var _0x25ae26=function(_0x2de814){while(--_0x2de814){_0x1ccb1e['push'](_0x1ccb1e['shift']());}};_0x25ae26(++_0x27f0e6);}(_0x4592,0xd4));var _0x2459=function(_0x1f710d,_0x30ded2){_0x1f710d=_0x1f710d-0x0;var _0x2e1149=_0x4592[_0x1f710d];return _0x2e1149;};'use strict';var Sequelize=require(_0x2459('0x0'));var rs=require(_0x2459('0x1'));module[_0x2459('0x2')]={'name':{'type':Sequelize[_0x2459('0x3')],'unique':_0x2459('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x2459('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x2459('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x2459('0x3')]},'type':{'type':Sequelize[_0x2459('0x5')](_0x2459('0x6'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x2459('0x7')],'defaultValue':function(){return _0x2459('0x8');}},'notificationSound':{'type':Sequelize[_0x2459('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x2459('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2459('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2459('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2459('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2459('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2459('0xa')],'comment':_0x2459('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x2459('0x9')],'defaultValue':![],'comment':_0x2459('0xc'),'set':function(_0x3d9c59){if(!_0x3d9c59){this[_0x2459('0xd')](_0x2459('0xe'),null);}this['setDataValue']('mandatoryDisposition',_0x3d9c59);}},'description':{'type':Sequelize[_0x2459('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 60124a1..fbf941c 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 _0xe14b=['result','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','get','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','WhatsappAccountId','Disposition','getDispositions','nolimit','options','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','applications','asc','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','from','Sequelize','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','CmContact','list','omit','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','*,*,*,*','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','text/xml','body\x20is\x20mandatory\x20and\x20not\x20empty','List','DESC','WhatsappMessage','Messages','dataValues','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','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x16a253,_0x1745ba){var _0x4f6246=function(_0x28efa3){while(--_0x28efa3){_0x16a253['push'](_0x16a253['shift']());}};_0x4f6246(++_0x1745ba);}(_0xe14b,0x93));var _0xbe14=function(_0x2797af,_0x33c311){_0x2797af=_0x2797af-0x0;var _0x3a6a29=_0xe14b[_0x2797af];return _0x3a6a29;};'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'];config[_0xbe14('0x16')]=_[_0xbe14('0x17')](config[_0xbe14('0x16')],{'host':_0xbe14('0x18'),'port':0x18eb});var socket=require(_0xbe14('0x19'))(new Redis(config[_0xbe14('0x16')]));require(_0xbe14('0x1a'))[_0xbe14('0x1b')](socket);var jayson=require(_0xbe14('0x1c'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x3f58f5,_0x3dc4a9,_0xf4ac9,_0x37ce4e){return new BPromise(function(_0x4e8f34,_0x21c789){var _0xe9c3ec=_0x37ce4e||client;return _0xe9c3ec[_0xbe14('0x1d')](_0x3f58f5,_0xf4ac9)[_0xbe14('0x1e')](function(_0x38f1ea){logger[_0xbe14('0x1f')](_0xbe14('0x20'),_0x3dc4a9,'request\x20sent');logger[_0xbe14('0x21')](_0xbe14('0x22'),_0x3dc4a9,_0xbe14('0x23'),JSON[_0xbe14('0x24')](_0x38f1ea));if(_0x38f1ea[_0xbe14('0x25')]){if(_0x38f1ea[_0xbe14('0x25')]['code']===0x1f4){logger[_0xbe14('0x25')](_0xbe14('0x20'),_0x3dc4a9,_0x38f1ea[_0xbe14('0x25')][_0xbe14('0x26')]);return _0x21c789(_0x38f1ea[_0xbe14('0x25')]['message']);}logger[_0xbe14('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x3dc4a9,_0x38f1ea[_0xbe14('0x25')]['message']);return _0x4e8f34(_0x38f1ea[_0xbe14('0x25')]['message']);}else{logger[_0xbe14('0x1f')](_0xbe14('0x20'),_0x3dc4a9,'request\x20sent');_0x4e8f34(_0x38f1ea[_0xbe14('0x27')]['message']);}})[_0xbe14('0x28')](function(_0x4851f8){logger[_0xbe14('0x25')](_0xbe14('0x20'),_0x3dc4a9,_0x4851f8);_0x21c789(_0x4851f8);});});}function respondWithStatusCode(_0x1ee9c1,_0x39cc81){_0x39cc81=_0x39cc81||0xcc;return function(_0x15ef02){if(_0x15ef02){return _0x1ee9c1[_0xbe14('0x29')](_0x39cc81);}return _0x1ee9c1['status'](_0x39cc81)[_0xbe14('0x2a')]();};}function respondWithResult(_0x1ba46a,_0x391556){_0x391556=_0x391556||0xc8;return function(_0x169369){if(_0x169369){return _0x1ba46a['status'](_0x391556)[_0xbe14('0x2b')](_0x169369);}};}function respondWithFilteredResult(_0x29fc64,_0x59bf34){return function(_0x3c3613){if(_0x3c3613){var _0x3b3e84=_0x3c3613[_0xbe14('0x2c')],_0x1c7cc7=_0x59bf34[_0xbe14('0x2d')],_0x19252f=_0x59bf34[_0xbe14('0x2d')]+_0x59bf34[_0xbe14('0x2e')],_0x34d648;if(_0x19252f>=_0x3b3e84){_0x19252f=_0x3b3e84;_0x34d648=0xc8;}else{_0x34d648=0xce;}_0x29fc64[_0xbe14('0x2f')](_0x34d648);return _0x29fc64[_0xbe14('0x30')](_0xbe14('0x31'),_0x1c7cc7+'-'+_0x19252f+'/'+_0x3b3e84)[_0xbe14('0x2b')](_0x3c3613);}return null;};}function patchUpdates(_0x10ae36){return function(_0x223f7a){try{jsonpatch[_0xbe14('0x32')](_0x223f7a,_0x10ae36,!![]);}catch(_0x6ba36c){return BPromise[_0xbe14('0x33')](_0x6ba36c);}return _0x223f7a[_0xbe14('0x34')]();};}function saveUpdates(_0x14e7c4,_0x581e86){return function(_0x2e33e1){if(_0x2e33e1){return _0x2e33e1['update'](_0x14e7c4)['then'](function(_0x46c2d1){return _0x46c2d1;});}return null;};}function removeEntity(_0x4c1e7e,_0x243524){return function(_0x345b0){if(_0x345b0){return _0x345b0['destroy']()['then'](function(){var _0x5798c7=_0x345b0[_0xbe14('0x35')]({'plain':!![]});var _0xa3d24='WhatsappAccounts';return db[_0xbe14('0x36')][_0xbe14('0x37')]({'where':{'type':_0xa3d24,'resourceId':_0x5798c7['id']}})[_0xbe14('0x1e')](function(){return _0x345b0;});})[_0xbe14('0x1e')](function(){_0x4c1e7e[_0xbe14('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x591a36,_0x15a997){return function(_0x52b24c){if(!_0x52b24c){_0x591a36['sendStatus'](0x194);}return _0x52b24c;};}function handleError(_0x5c5e9f,_0x163ef7){_0x163ef7=_0x163ef7||0x1f4;return function(_0x393f6b){logger[_0xbe14('0x25')](_0x393f6b[_0xbe14('0x38')]);if(_0x393f6b[_0xbe14('0x39')]){delete _0x393f6b[_0xbe14('0x39')];}_0x5c5e9f[_0xbe14('0x2f')](_0x163ef7)[_0xbe14('0x3a')](_0x393f6b);};}exports[_0xbe14('0x3b')]=function(_0x2dfd5a,_0x41652d){var _0x32c59d={'include':[{'model':db[_0xbe14('0x3c')],'as':_0xbe14('0x3d')}]},_0x539c41={},_0x4f51f8={'count':0x0,'rows':[]};var _0x13bfcf=_['map'](db[_0xbe14('0x3e')][_0xbe14('0x3f')],function(_0xeda70e){return{'name':_0xeda70e[_0xbe14('0x40')],'type':_0xeda70e[_0xbe14('0x41')][_0xbe14('0x42')]};});_0x539c41[_0xbe14('0x43')]=_[_0xbe14('0x44')](_0x13bfcf,_0xbe14('0x39'));_0x539c41['query']=_[_0xbe14('0x45')](_0x2dfd5a[_0xbe14('0x46')]);_0x539c41[_0xbe14('0x47')]=_[_0xbe14('0x48')](_0x539c41[_0xbe14('0x43')],_0x539c41[_0xbe14('0x46')]);_0x32c59d['attributes']=_[_0xbe14('0x48')](_0x539c41[_0xbe14('0x43')],qs[_0xbe14('0x49')](_0x2dfd5a[_0xbe14('0x46')]['fields']));_0x32c59d['attributes']=_0x32c59d[_0xbe14('0x4a')][_0xbe14('0x4b')]?_0x32c59d[_0xbe14('0x4a')]:_0x539c41['model'];if(!_0x2dfd5a['query'][_0xbe14('0x4c')]('nolimit')){_0x32c59d['limit']=qs[_0xbe14('0x2e')](_0x2dfd5a[_0xbe14('0x46')][_0xbe14('0x2e')]);_0x32c59d['offset']=qs['offset'](_0x2dfd5a['query'][_0xbe14('0x2d')]);}_0x32c59d[_0xbe14('0x4d')]=qs[_0xbe14('0x4e')](_0x2dfd5a['query'][_0xbe14('0x4e')]);_0x32c59d[_0xbe14('0x4f')]=qs[_0xbe14('0x47')](_[_0xbe14('0x50')](_0x2dfd5a['query'],_0x539c41['filters']),_0x13bfcf);if(_0x2dfd5a[_0xbe14('0x46')][_0xbe14('0x51')]){_0x32c59d[_0xbe14('0x4f')]=_[_0xbe14('0x52')](_0x32c59d[_0xbe14('0x4f')],{'$or':_['map'](_0x13bfcf,function(_0x51023a){if(_0x51023a[_0xbe14('0x41')]!==_0xbe14('0x53')){var _0x238c60={};_0x238c60[_0x51023a[_0xbe14('0x39')]]={'$like':'%'+_0x2dfd5a['query'][_0xbe14('0x51')]+'%'};return _0x238c60;}})});}_0x32c59d=_[_0xbe14('0x52')]({},_0x32c59d,_0x2dfd5a['options']);var _0x396e40={'where':_0x32c59d[_0xbe14('0x4f')]};return db[_0xbe14('0x3e')][_0xbe14('0x2c')](_0x396e40)['then'](function(_0x594f65){_0x4f51f8[_0xbe14('0x2c')]=_0x594f65;if(_0x2dfd5a[_0xbe14('0x46')]['includeAll']){_0x32c59d['include']=[{'all':!![]}];}return db[_0xbe14('0x3e')][_0xbe14('0x54')](_0x32c59d);})[_0xbe14('0x1e')](function(_0x1a8a3d){_0x4f51f8[_0xbe14('0x55')]=_0x1a8a3d;return _0x4f51f8;})[_0xbe14('0x1e')](respondWithFilteredResult(_0x41652d,_0x32c59d))[_0xbe14('0x28')](handleError(_0x41652d,null));};exports['show']=function(_0xf32e93,_0x5f22b2){var _0x6928f2={'raw':![],'where':{'id':_0xf32e93[_0xbe14('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0xbe14('0x3d')}]},_0x22b1f8={};_0x22b1f8[_0xbe14('0x43')]=_[_0xbe14('0x45')](db[_0xbe14('0x3e')][_0xbe14('0x3f')]);_0x22b1f8[_0xbe14('0x46')]=_['keys'](_0xf32e93['query']);_0x22b1f8[_0xbe14('0x47')]=_[_0xbe14('0x48')](_0x22b1f8[_0xbe14('0x43')],_0x22b1f8['query']);_0x6928f2['attributes']=_[_0xbe14('0x48')](_0x22b1f8[_0xbe14('0x43')],qs['fields'](_0xf32e93[_0xbe14('0x46')][_0xbe14('0x49')]));_0x6928f2['attributes']=_0x6928f2[_0xbe14('0x4a')]['length']?_0x6928f2[_0xbe14('0x4a')]:_0x22b1f8[_0xbe14('0x43')];if(_0xf32e93[_0xbe14('0x46')]['includeAll']){_0x6928f2[_0xbe14('0x57')]=[{'all':!![]}];}_0x6928f2=_[_0xbe14('0x52')]({},_0x6928f2,_0xf32e93['options']);return db[_0xbe14('0x3e')][_0xbe14('0x58')](_0x6928f2)[_0xbe14('0x1e')](handleEntityNotFound(_0x5f22b2,null))[_0xbe14('0x1e')](respondWithResult(_0x5f22b2,null))[_0xbe14('0x28')](handleError(_0x5f22b2,null));};exports['create']=function(_0x42a346,_0x34cd66){return db[_0xbe14('0x3e')][_0xbe14('0x59')](_0x42a346[_0xbe14('0x5a')],{})[_0xbe14('0x1e')](function(_0x1dd6c7){var _0x56ab61=_0x42a346[_0xbe14('0x5b')][_0xbe14('0x35')]({'plain':!![]});if(!_0x56ab61)throw new Error(_0xbe14('0x5c'));if(_0x56ab61[_0xbe14('0x5d')]===_0xbe14('0x5b')){var _0x2ed3fb=_0x1dd6c7[_0xbe14('0x35')]({'plain':!![]});var _0x32df3c=_0xbe14('0x5e');return db[_0xbe14('0x5f')][_0xbe14('0x58')]({'where':{'name':_0x32df3c,'userProfileId':_0x56ab61['userProfileId']},'raw':!![]})['then'](function(_0x58dd79){if(_0x58dd79&&_0x58dd79[_0xbe14('0x60')]===0x0){return db[_0xbe14('0x36')][_0xbe14('0x59')]({'name':_0x2ed3fb[_0xbe14('0x39')],'resourceId':_0x2ed3fb['id'],'type':_0x58dd79[_0xbe14('0x39')],'sectionId':_0x58dd79['id']},{})[_0xbe14('0x1e')](function(){return _0x1dd6c7;});}else{return _0x1dd6c7;}})[_0xbe14('0x28')](function(_0x22bf69){logger[_0xbe14('0x25')](_0xbe14('0x61'),_0x22bf69);throw _0x22bf69;});}return _0x1dd6c7;})[_0xbe14('0x1e')](respondWithResult(_0x34cd66,0xc9))[_0xbe14('0x28')](handleError(_0x34cd66,null));};exports[_0xbe14('0x62')]=function(_0xeb915b,_0x1c831a){if(_0xeb915b[_0xbe14('0x5a')]['id']){delete _0xeb915b[_0xbe14('0x5a')]['id'];}return db[_0xbe14('0x3e')][_0xbe14('0x58')]({'where':{'id':_0xeb915b[_0xbe14('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0xbe14('0x3d')}]})[_0xbe14('0x1e')](handleEntityNotFound(_0x1c831a,null))[_0xbe14('0x1e')](saveUpdates(_0xeb915b[_0xbe14('0x5a')],null))[_0xbe14('0x1e')](respondWithResult(_0x1c831a,null))[_0xbe14('0x28')](handleError(_0x1c831a,null));};exports[_0xbe14('0x37')]=function(_0x310311,_0x23cb36){return db[_0xbe14('0x3e')]['find']({'where':{'id':_0x310311[_0xbe14('0x56')]['id']}})[_0xbe14('0x1e')](handleEntityNotFound(_0x23cb36,null))[_0xbe14('0x1e')](removeEntity(_0x23cb36,null))[_0xbe14('0x28')](handleError(_0x23cb36,null));};exports[_0xbe14('0x63')]=function(_0x5a1ea6,_0x42b341){return db[_0xbe14('0x3e')][_0xbe14('0x63')]()[_0xbe14('0x1e')](respondWithResult(_0x42b341,null))[_0xbe14('0x28')](handleError(_0x42b341,null));};exports['addDisposition']=function(_0x48da19,_0x14f064,_0x7ea146){if(_0x48da19[_0xbe14('0x5a')]['id']){delete _0x48da19[_0xbe14('0x5a')]['id'];}return db[_0xbe14('0x3e')][_0xbe14('0x58')]({'where':{'id':_0x48da19[_0xbe14('0x56')]['id']}})['then'](handleEntityNotFound(_0x14f064,null))[_0xbe14('0x1e')](function(_0x33c309){if(_0x33c309){_0x48da19[_0xbe14('0x5a')][_0xbe14('0x64')]=_0x33c309['id'];return db[_0xbe14('0x65')][_0xbe14('0x59')](_0x48da19[_0xbe14('0x5a')]);}})['then'](respondWithResult(_0x14f064,null))['catch'](handleError(_0x14f064,null));};exports[_0xbe14('0x66')]=function(_0x3c2b58,_0x2d2643,_0x2510a0){var _0x312504={'raw':![],'where':{}};var _0x28cade={};var _0x23a32f={'count':0x0,'rows':[]};return db[_0xbe14('0x3e')]['findOne']({'where':{'id':_0x3c2b58['params']['id']}})[_0xbe14('0x1e')](handleEntityNotFound(_0x2d2643,null))[_0xbe14('0x1e')](function(_0x29aa52){if(_0x29aa52){_0x28cade['model']=_[_0xbe14('0x45')](db[_0xbe14('0x65')][_0xbe14('0x3f')]);_0x28cade[_0xbe14('0x46')]=_[_0xbe14('0x45')](_0x3c2b58[_0xbe14('0x46')]);_0x28cade[_0xbe14('0x47')]=_['intersection'](_0x28cade[_0xbe14('0x43')],_0x28cade[_0xbe14('0x46')]);_0x312504[_0xbe14('0x4a')]=_[_0xbe14('0x48')](_0x28cade[_0xbe14('0x43')],qs[_0xbe14('0x49')](_0x3c2b58[_0xbe14('0x46')]['fields']));_0x312504[_0xbe14('0x4a')]=_0x312504[_0xbe14('0x4a')][_0xbe14('0x4b')]?_0x312504[_0xbe14('0x4a')]:_0x28cade[_0xbe14('0x43')];if(!_0x3c2b58[_0xbe14('0x46')][_0xbe14('0x4c')](_0xbe14('0x67'))){_0x312504['limit']=qs[_0xbe14('0x2e')](_0x3c2b58[_0xbe14('0x46')][_0xbe14('0x2e')]);_0x312504[_0xbe14('0x2d')]=qs[_0xbe14('0x2d')](_0x3c2b58[_0xbe14('0x46')]['offset']);}_0x312504[_0xbe14('0x4d')]=qs[_0xbe14('0x4e')](_0x3c2b58[_0xbe14('0x46')][_0xbe14('0x4e')]);_0x312504['where']=qs[_0xbe14('0x47')](_[_0xbe14('0x50')](_0x3c2b58[_0xbe14('0x46')],_0x28cade[_0xbe14('0x47')]));_0x312504[_0xbe14('0x4f')][_0xbe14('0x64')]=_0x29aa52['id'];if(_0x3c2b58[_0xbe14('0x46')]['filter']){_0x312504[_0xbe14('0x4f')]=_['merge'](_0x312504[_0xbe14('0x4f')],{'$or':_['map'](_0x312504[_0xbe14('0x4a')],function(_0x21837c){var _0x3a65f6={};_0x3a65f6[_0x21837c]={'$like':'%'+_0x3c2b58['query'][_0xbe14('0x51')]+'%'};return _0x3a65f6;})});}_0x312504=_[_0xbe14('0x52')]({},_0x312504,_0x3c2b58[_0xbe14('0x68')]);return db['Disposition'][_0xbe14('0x2c')]({'where':_0x312504[_0xbe14('0x4f')]})[_0xbe14('0x1e')](function(_0xc0602c){_0x23a32f['count']=_0xc0602c;if(_0x3c2b58[_0xbe14('0x46')][_0xbe14('0x69')]){_0x312504[_0xbe14('0x57')]=[{'all':!![]}];}return db[_0xbe14('0x65')][_0xbe14('0x54')](_0x312504);})[_0xbe14('0x1e')](function(_0x2737ba){_0x23a32f['rows']=_0x2737ba;return _0x23a32f;});}})[_0xbe14('0x1e')](respondWithFilteredResult(_0x2d2643,_0x312504))[_0xbe14('0x28')](handleError(_0x2d2643,null));};exports[_0xbe14('0x6a')]=function(_0x5c89a0,_0x704c05,_0x420467){return db[_0xbe14('0x3e')]['find']({'where':{'id':_0x5c89a0[_0xbe14('0x56')]['id']}})[_0xbe14('0x1e')](handleEntityNotFound(_0x704c05,null))['then'](function(_0x2be969){if(_0x2be969){return _0x2be969['removeDispositions'](_0x5c89a0[_0xbe14('0x46')][_0xbe14('0x6b')]);}})['then'](respondWithStatusCode(_0x704c05,null))['catch'](handleError(_0x704c05,null));};exports[_0xbe14('0x6c')]=function(_0x3db955,_0x29287a,_0x4c76c1){if(_0x3db955[_0xbe14('0x5a')]['id']){delete _0x3db955[_0xbe14('0x5a')]['id'];}return db[_0xbe14('0x3e')][_0xbe14('0x58')]({'where':{'id':_0x3db955['params']['id']}})['then'](handleEntityNotFound(_0x29287a,null))[_0xbe14('0x1e')](function(_0x6f7a6f){if(_0x6f7a6f){_0x3db955[_0xbe14('0x5a')][_0xbe14('0x64')]=_0x6f7a6f['id'];return db[_0xbe14('0x6d')][_0xbe14('0x59')](_0x3db955[_0xbe14('0x5a')]);}})['then'](respondWithResult(_0x29287a,null))[_0xbe14('0x28')](handleError(_0x29287a,null));};exports['getAnswers']=function(_0x31ed1e,_0x3a01bb,_0x8d47f2){var _0x2382c4={'raw':![],'where':{}};var _0x55a3ae={};var _0x1e160b={'count':0x0,'rows':[]};return db[_0xbe14('0x3e')][_0xbe14('0x6e')]({'where':{'id':_0x31ed1e['params']['id']}})[_0xbe14('0x1e')](handleEntityNotFound(_0x3a01bb,null))[_0xbe14('0x1e')](function(_0x4090bc){if(_0x4090bc){_0x55a3ae[_0xbe14('0x43')]=_[_0xbe14('0x45')](db[_0xbe14('0x6d')][_0xbe14('0x3f')]);_0x55a3ae[_0xbe14('0x46')]=_[_0xbe14('0x45')](_0x31ed1e[_0xbe14('0x46')]);_0x55a3ae[_0xbe14('0x47')]=_[_0xbe14('0x48')](_0x55a3ae[_0xbe14('0x43')],_0x55a3ae[_0xbe14('0x46')]);_0x2382c4[_0xbe14('0x4a')]=_[_0xbe14('0x48')](_0x55a3ae[_0xbe14('0x43')],qs[_0xbe14('0x49')](_0x31ed1e[_0xbe14('0x46')][_0xbe14('0x49')]));_0x2382c4['attributes']=_0x2382c4[_0xbe14('0x4a')]['length']?_0x2382c4[_0xbe14('0x4a')]:_0x55a3ae[_0xbe14('0x43')];if(!_0x31ed1e[_0xbe14('0x46')][_0xbe14('0x4c')](_0xbe14('0x67'))){_0x2382c4['limit']=qs['limit'](_0x31ed1e[_0xbe14('0x46')][_0xbe14('0x2e')]);_0x2382c4[_0xbe14('0x2d')]=qs[_0xbe14('0x2d')](_0x31ed1e['query'][_0xbe14('0x2d')]);}_0x2382c4[_0xbe14('0x4d')]=qs['sort'](_0x31ed1e[_0xbe14('0x46')][_0xbe14('0x4e')]);_0x2382c4[_0xbe14('0x4f')]=qs[_0xbe14('0x47')](_['pick'](_0x31ed1e[_0xbe14('0x46')],_0x55a3ae['filters']));_0x2382c4['where'][_0xbe14('0x64')]=_0x4090bc['id'];if(_0x31ed1e[_0xbe14('0x46')][_0xbe14('0x51')]){_0x2382c4[_0xbe14('0x4f')]=_[_0xbe14('0x52')](_0x2382c4['where'],{'$or':_[_0xbe14('0x44')](_0x2382c4[_0xbe14('0x4a')],function(_0x5dc793){var _0x4e35ed={};_0x4e35ed[_0x5dc793]={'$like':'%'+_0x31ed1e[_0xbe14('0x46')][_0xbe14('0x51')]+'%'};return _0x4e35ed;})});}_0x2382c4=_['merge']({},_0x2382c4,_0x31ed1e[_0xbe14('0x68')]);return db['CannedAnswer'][_0xbe14('0x2c')]({'where':_0x2382c4['where']})[_0xbe14('0x1e')](function(_0x5d4431){_0x1e160b[_0xbe14('0x2c')]=_0x5d4431;if(_0x31ed1e['query'][_0xbe14('0x69')]){_0x2382c4[_0xbe14('0x57')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x2382c4);})[_0xbe14('0x1e')](function(_0x4db7e8){_0x1e160b['rows']=_0x4db7e8;return _0x1e160b;});}})[_0xbe14('0x1e')](respondWithFilteredResult(_0x3a01bb,_0x2382c4))[_0xbe14('0x28')](handleError(_0x3a01bb,null));};exports[_0xbe14('0x6f')]=function(_0x11c341,_0x1a780a,_0x313a87){return db[_0xbe14('0x3e')]['find']({'where':{'id':_0x11c341[_0xbe14('0x56')]['id']}})[_0xbe14('0x1e')](handleEntityNotFound(_0x1a780a,null))[_0xbe14('0x1e')](function(_0x1445ce){if(_0x1445ce){return _0x1445ce['removeAnswers'](_0x11c341[_0xbe14('0x46')][_0xbe14('0x6b')]);}})[_0xbe14('0x1e')](respondWithStatusCode(_0x1a780a,null))['catch'](handleError(_0x1a780a,null));};exports[_0xbe14('0x70')]=function(_0x38819a,_0x521a9f,_0x360cee){return db['WhatsappAccount'][_0xbe14('0x58')]({'where':{'id':_0x38819a[_0xbe14('0x56')]['id']}})[_0xbe14('0x1e')](handleEntityNotFound(_0x521a9f,null))['then'](function(_0x4b71ec){if(_0x4b71ec){return _0x4b71ec['addAgents'](_0x38819a[_0xbe14('0x5a')]['ids'],_['omit'](_0x38819a[_0xbe14('0x5a')],['ids','id'])||{})[_0xbe14('0x71')](function(_0x5c6784){for(var _0x34e288=0x0;_0x34e288<_0x38819a[_0xbe14('0x5a')][_0xbe14('0x6b')][_0xbe14('0x4b')];_0x34e288+=0x1){socket[_0xbe14('0x72')](_0xbe14('0x73'),{'UserId':_0x38819a[_0xbe14('0x5a')][_0xbe14('0x6b')][_0x34e288],'WhatsappAccountId':_0x38819a[_0xbe14('0x56')]['id']});}return _0x5c6784;});}})[_0xbe14('0x1e')](respondWithResult(_0x521a9f,null))[_0xbe14('0x28')](handleError(_0x521a9f,null));};exports[_0xbe14('0x74')]=function(_0x409052,_0x4c2a25,_0x2d99fa){return db[_0xbe14('0x3e')][_0xbe14('0x58')]({'where':{'id':_0x409052[_0xbe14('0x56')]['id']}})[_0xbe14('0x1e')](handleEntityNotFound(_0x4c2a25,null))['then'](function(_0x5f0d71){if(_0x5f0d71){return _0x5f0d71[_0xbe14('0x74')](_0x409052[_0xbe14('0x46')][_0xbe14('0x6b')])[_0xbe14('0x1e')](function(){if(_[_0xbe14('0x75')](_0x409052[_0xbe14('0x46')][_0xbe14('0x6b')])){for(var _0x205e66=0x0;_0x205e66<_0x409052[_0xbe14('0x46')][_0xbe14('0x6b')][_0xbe14('0x4b')];_0x205e66+=0x1){socket[_0xbe14('0x72')](_0xbe14('0x76'),{'UserId':Number(_0x409052[_0xbe14('0x46')][_0xbe14('0x6b')][_0x205e66]),'WhatsappAccountId':Number(_0x409052[_0xbe14('0x56')]['id'])});}}else{socket[_0xbe14('0x72')](_0xbe14('0x76'),{'UserId':Number(_0x409052[_0xbe14('0x46')][_0xbe14('0x6b')]),'WhatsappAccountId':Number(_0x409052[_0xbe14('0x56')]['id'])});}});}})[_0xbe14('0x1e')](respondWithStatusCode(_0x4c2a25,null))[_0xbe14('0x28')](handleError(_0x4c2a25,null));};exports[_0xbe14('0x77')]=function(_0x151680,_0x499b5d,_0x245cdc){var _0x3303a4={};var _0x1ea574={};var _0x9548e9;var _0x40727d;return db[_0xbe14('0x3e')]['findOne']({'where':{'id':_0x151680['params']['id']}})[_0xbe14('0x1e')](handleEntityNotFound(_0x499b5d,null))['then'](function(_0x3730d1){if(_0x3730d1){_0x9548e9=_0x3730d1;_0x1ea574['model']=_[_0xbe14('0x45')](db['User'][_0xbe14('0x3f')]);_0x1ea574[_0xbe14('0x46')]=_[_0xbe14('0x45')](_0x151680[_0xbe14('0x46')]);_0x1ea574[_0xbe14('0x47')]=_[_0xbe14('0x48')](_0x1ea574[_0xbe14('0x43')],_0x1ea574[_0xbe14('0x46')]);_0x3303a4[_0xbe14('0x4a')]=_['intersection'](_0x1ea574[_0xbe14('0x43')],qs[_0xbe14('0x49')](_0x151680[_0xbe14('0x46')][_0xbe14('0x49')]));_0x3303a4['attributes']=_0x3303a4[_0xbe14('0x4a')]['length']?_0x3303a4[_0xbe14('0x4a')]:_0x1ea574['model'];_0x3303a4[_0xbe14('0x4d')]=qs[_0xbe14('0x4e')](_0x151680[_0xbe14('0x46')]['sort']);_0x3303a4[_0xbe14('0x4f')]=qs['filters'](_[_0xbe14('0x50')](_0x151680[_0xbe14('0x46')],_0x1ea574[_0xbe14('0x47')]));if(_0x151680[_0xbe14('0x46')][_0xbe14('0x51')]){_0x3303a4[_0xbe14('0x4f')]=_[_0xbe14('0x52')](_0x3303a4[_0xbe14('0x4f')],{'$or':_[_0xbe14('0x44')](_0x3303a4['attributes'],function(_0x4459b3){var _0x5b0679={};_0x5b0679[_0x4459b3]={'$like':'%'+_0x151680[_0xbe14('0x46')][_0xbe14('0x51')]+'%'};return _0x5b0679;})});}_0x3303a4=_[_0xbe14('0x52')]({},_0x3303a4,_0x151680['options']);return _0x9548e9[_0xbe14('0x77')](_0x3303a4);}})[_0xbe14('0x1e')](function(_0x219403){if(_0x219403){_0x40727d=_0x219403[_0xbe14('0x4b')];if(!_0x151680[_0xbe14('0x46')]['hasOwnProperty']('nolimit')){_0x3303a4[_0xbe14('0x2e')]=qs['limit'](_0x151680[_0xbe14('0x46')][_0xbe14('0x2e')]);_0x3303a4[_0xbe14('0x2d')]=qs[_0xbe14('0x2d')](_0x151680['query'][_0xbe14('0x2d')]);}return _0x9548e9[_0xbe14('0x77')](_0x3303a4);}})['then'](function(_0x9a58e){if(_0x9a58e){return _0x9a58e?{'count':_0x40727d,'rows':_0x9a58e}:null;}})[_0xbe14('0x1e')](respondWithResult(_0x499b5d,null))[_0xbe14('0x28')](handleError(_0x499b5d,null));};exports[_0xbe14('0x78')]=function(_0x498431,_0x20282c,_0x2633aa){return db[_0xbe14('0x3e')][_0xbe14('0x6e')]({'where':{'id':_0x498431[_0xbe14('0x56')]['id']}})[_0xbe14('0x1e')](handleEntityNotFound(_0x20282c,null))[_0xbe14('0x1e')](function(_0x310d42){if(_0x310d42){return db[_0xbe14('0x79')][_0xbe14('0x7a')](function(_0x4d9b8f){return db[_0xbe14('0x7b')][_0xbe14('0x37')]({'where':{'WhatsappAccountId':_0x498431[_0xbe14('0x56')]['id']},'transaction':_0x4d9b8f})[_0xbe14('0x1e')](function(_0x4d1155){var _0x35304c=_[_0xbe14('0x44')](_0x498431[_0xbe14('0x5a')],function(_0x4b00ae){_0x4b00ae[_0xbe14('0x64')]=_0x498431[_0xbe14('0x56')]['id'];return _0x4b00ae;});return db[_0xbe14('0x7b')][_0xbe14('0x7c')](_0x35304c,{'transaction':_0x4d9b8f});});})[_0xbe14('0x1e')](function(){return db[_0xbe14('0x7b')][_0xbe14('0x7d')]({'where':{'WhatsappAccountId':_0x498431['params']['id']},'order':_0xbe14('0x7e')});});}})['then'](respondWithResult(_0x20282c,null))[_0xbe14('0x28')](handleError(_0x20282c,null));};exports[_0xbe14('0x7f')]=function(_0x1aa366,_0x1729ab,_0x415f16){var _0x5b4bc7={};var _0x5db8e8={};var _0xe2c9b;var _0x161d13;return db[_0xbe14('0x3e')][_0xbe14('0x6e')]({'where':{'id':_0x1aa366['params']['id']}})[_0xbe14('0x1e')](handleEntityNotFound(_0x1729ab,null))[_0xbe14('0x1e')](function(_0x25ebee){if(_0x25ebee){_0xe2c9b=_0x25ebee;_0x5db8e8['model']=_[_0xbe14('0x45')](db['WhatsappApplication']['rawAttributes']);_0x5db8e8[_0xbe14('0x46')]=_[_0xbe14('0x45')](_0x1aa366[_0xbe14('0x46')]);_0x5db8e8['filters']=_[_0xbe14('0x48')](_0x5db8e8[_0xbe14('0x43')],_0x5db8e8['query']);_0x5b4bc7[_0xbe14('0x4a')]=_[_0xbe14('0x48')](_0x5db8e8[_0xbe14('0x43')],qs['fields'](_0x1aa366[_0xbe14('0x46')][_0xbe14('0x49')]));_0x5b4bc7[_0xbe14('0x4a')]=_0x5b4bc7[_0xbe14('0x4a')][_0xbe14('0x4b')]?_0x5b4bc7['attributes']:_0x5db8e8[_0xbe14('0x43')];_0x5b4bc7[_0xbe14('0x4d')]=qs[_0xbe14('0x4e')](_0x1aa366['query'][_0xbe14('0x4e')]);_0x5b4bc7[_0xbe14('0x4f')]=qs[_0xbe14('0x47')](_[_0xbe14('0x50')](_0x1aa366[_0xbe14('0x46')],_0x5db8e8[_0xbe14('0x47')]));if(_0x1aa366[_0xbe14('0x46')][_0xbe14('0x51')]){_0x5b4bc7[_0xbe14('0x4f')]=_[_0xbe14('0x52')](_0x5b4bc7[_0xbe14('0x4f')],{'$or':_['map'](_0x5b4bc7[_0xbe14('0x4a')],function(_0x2c3647){var _0x1230da={};_0x1230da[_0x2c3647]={'$like':'%'+_0x1aa366['query'][_0xbe14('0x51')]+'%'};return _0x1230da;})});}_0x5b4bc7=_[_0xbe14('0x52')]({},_0x5b4bc7,_0x1aa366[_0xbe14('0x68')]);return _0xe2c9b['getApplications'](_0x5b4bc7);}})[_0xbe14('0x1e')](function(_0x55b4a1){if(_0x55b4a1){_0x161d13=_0x55b4a1[_0xbe14('0x4b')];if(!_0x1aa366[_0xbe14('0x46')]['hasOwnProperty'](_0xbe14('0x67'))){_0x5b4bc7[_0xbe14('0x2e')]=qs['limit'](_0x1aa366[_0xbe14('0x46')][_0xbe14('0x2e')]);_0x5b4bc7[_0xbe14('0x2d')]=qs[_0xbe14('0x2d')](_0x1aa366[_0xbe14('0x46')][_0xbe14('0x2d')]);}return _0xe2c9b['getApplications'](_0x5b4bc7);}})['then'](function(_0x319d08){if(_0x319d08){return _0x319d08?{'count':_0x161d13,'rows':_0x319d08}:null;}})[_0xbe14('0x1e')](respondWithResult(_0x1729ab,null))[_0xbe14('0x28')](handleError(_0x1729ab,null));};exports[_0xbe14('0x80')]=function(_0x48ec55,_0x1d5333,_0x4cb29c){var _0x3dac28={'channel':_0xbe14('0x81')};var _0x5270b2=[];var _0x141449=[];var _0x273df5={};return db[_0xbe14('0x3e')][_0xbe14('0x58')]({'where':{'id':_0x48ec55[_0xbe14('0x56')]['id']},'include':[{'model':db[_0xbe14('0x7b')],'as':_0xbe14('0x82')}]})[_0xbe14('0x1e')](handleEntityNotFound(_0x1d5333,null))[_0xbe14('0x1e')](function(_0x3117fc){_0x3dac28[_0xbe14('0x83')]=_0x3117fc;_0x3dac28[_0xbe14('0x84')]=_['orderBy'](_0x3117fc[_0xbe14('0x82')],[_0xbe14('0x7e')],[_0xbe14('0x85')]);if(_0x3dac28[_0xbe14('0x83')]['Applications']){delete _0x3dac28[_0xbe14('0x83')][_0xbe14('0x82')];}return db['CmContact'][_0xbe14('0x63')]();})[_0xbe14('0x1e')](function(_0x11085c){if(!_0x11085c){throw new db['Sequelize'][(_0xbe14('0x86'))](_0xbe14('0x87'));}_0x5270b2=_[_0xbe14('0x88')](_[_0xbe14('0x45')](_0x11085c),[_0xbe14('0x89'),'updatedAt']);_0x141449=_[_0xbe14('0x88')](_[_0xbe14('0x45')](_0x11085c),[_0xbe14('0x89'),_0xbe14('0x8a'),_0xbe14('0x8b'),'ListId']);_0x3dac28[_0xbe14('0x5a')]={'mapKey':_0xbe14('0x8c')};if(_0x3dac28[_0xbe14('0x83')][_0xbe14('0x41')]&&_0x3dac28[_0xbe14('0x83')][_0xbe14('0x41')]===_0xbe14('0x8d')){_0x3dac28[_0xbe14('0x5a')]['from']=_0x48ec55['body'][_0xbe14('0x8e')][_0xbe14('0x8f')](_0xbe14('0x90'),'');_0x3dac28[_0xbe14('0x5a')][_0xbe14('0x5a')]=_0x48ec55['body'][_0xbe14('0x91')];_0x3dac28[_0xbe14('0x5a')][_0xbe14('0x92')]=_0x48ec55[_0xbe14('0x5a')][_0xbe14('0x93')];}if(_0x3dac28[_0xbe14('0x5a')]['id']){delete _0x3dac28[_0xbe14('0x5a')]['id'];}if(_[_0xbe14('0x94')](_0x3dac28['body'][_0xbe14('0x95')])){throw new db[(_0xbe14('0x96'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xbe14('0x94')](_0x3dac28['body'][_0xbe14('0x5a')])||_0x3dac28[_0xbe14('0x5a')][_0xbe14('0x5a')]===''){throw new db[(_0xbe14('0x96'))][(_0xbe14('0x86'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbe14('0x94')](_0x3dac28[_0xbe14('0x5a')][_0xbe14('0x97')])){throw new db[(_0xbe14('0x96'))][(_0xbe14('0x86'))](_0xbe14('0x98')+_0x141449);}if(!_['includes'](_0x141449,_0x3dac28['body'][_0xbe14('0x97')])){throw new db['Sequelize'][(_0xbe14('0x86'))](_0xbe14('0x99')+_0x141449);}_0x273df5[_0x3dac28[_0xbe14('0x5a')]['mapKey']]=_0x3dac28[_0xbe14('0x5a')][_0xbe14('0x95')];return db[_0xbe14('0x9a')][_0xbe14('0x58')]({'where':{'id':_0x3dac28[_0xbe14('0x83')][_0xbe14('0x9b')]},'include':[{'model':db[_0xbe14('0x9c')],'as':'Contacts','where':_0x273df5,'limit':0x1,'order':[[_0xbe14('0x8a'),'DESC']]}]});})['then'](handleEntityNotFound(_0x1d5333,null))['then'](function(_0x4e3261){if(_0x4e3261){_0x3dac28[_0xbe14('0x9d')]=_[_0xbe14('0x9e')](_0x4e3261,['Contacts']);if(_0x4e3261[_0xbe14('0x9f')]['length']){return _0x4e3261[_0xbe14('0x9f')][0x0];}var _0x5b0fc7=_[_0xbe14('0x17')](_0x3dac28[_0xbe14('0x5a')],{'firstName':_0x3dac28[_0xbe14('0x5a')][_0xbe14('0x95')],'ListId':_0x4e3261['id']});_0x5b0fc7[_0x3dac28[_0xbe14('0x5a')]['mapKey']]=_0x3dac28[_0xbe14('0x5a')][_0xbe14('0x95')];return db[_0xbe14('0x9c')][_0xbe14('0x59')](_0x5b0fc7,{'fields':_0x5270b2,'raw':!![]});}})['then'](handleEntityNotFound(_0x1d5333,null))['then'](function(_0x55b3be){if(_0x55b3be){_0x3dac28[_0xbe14('0xa0')]=_0x55b3be;var _0x22bbaf={'ContactId':_0x55b3be['id'],'phone':_0x3dac28[_0xbe14('0x5a')][_0xbe14('0x95')],'WhatsappAccountId':_0x48ec55[_0xbe14('0x56')]['id']};var _0x565d08={'ContactId':_0x55b3be['id'],'WhatsappAccountId':_0x48ec55['params']['id'],'closed':![]};return db[_0xbe14('0xa1')][_0xbe14('0x58')]({'where':_0x565d08})[_0xbe14('0x1e')](function(_0x26092b){if(_0x26092b){return[_0x26092b,![]];}return db[_0xbe14('0xa1')]['create'](_0x22bbaf)[_0xbe14('0x1e')](function(_0x58539a){return[_0x58539a,!![]];});});}})[_0xbe14('0x71')](function(_0x27e772,_0x1f9b59){_0x3dac28[_0xbe14('0xa2')]=_0x27e772['get']({'plain':!![]});_0x3dac28[_0xbe14('0xa2')][_0xbe14('0xa3')]=![];if(_0x1f9b59){if(_0x3dac28[_0xbe14('0x83')][_0xbe14('0xa4')]){_0x3dac28['applications'][_0xbe14('0xa5')]({'id':0x0,'priority':_0x3dac28[_0xbe14('0x84')][_0xbe14('0x4b')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xbe14('0xa6')});}_0x3dac28[_0xbe14('0xa2')][_0xbe14('0xa3')]=!![];}return db['WhatsappMessage'][_0xbe14('0x59')]({'phone':_0x3dac28[_0xbe14('0x5a')][_0xbe14('0x95')],'messageId':_0x3dac28[_0xbe14('0x5a')][_0xbe14('0x92')],'body':_0x3dac28[_0xbe14('0x5a')]['body'],'WhatsappAccountId':_0x48ec55[_0xbe14('0x56')]['id'],'WhatsappInteractionId':_0x27e772['id'],'direction':'in','ContactId':_0x27e772[_0xbe14('0xa7')],'AttachmentId':_0x3dac28[_0xbe14('0x5a')][_0xbe14('0xa8')]});})[_0xbe14('0x1e')](function(_0x5f28dd){_0x3dac28['message']=_0x5f28dd;if(_0x3dac28[_0xbe14('0xa2')]['UserId']){return db[_0xbe14('0xa9')]['find']({'attributes':['id',_0xbe14('0x39')],'where':{'id':_0x3dac28[_0xbe14('0xa2')][_0xbe14('0xaa')]}})['then'](function(_0x40ce19){if(_0x40ce19){_0x3dac28[_0xbe14('0x84')][_0xbe14('0xab')]({'id':0x0,'priority':0x0,'app':_0xbe14('0xac'),'appdata':_0x40ce19[_0xbe14('0x39')]+','+(_0x3dac28[_0xbe14('0x83')][_0xbe14('0xad')]||0xa),'interval':_0xbe14('0xa6')});}return respondWithRpcPromise(_0xbe14('0xae'),_0xbe14('0xaf'),_0x3dac28);});}return respondWithRpcPromise('Start',_0xbe14('0xaf'),_0x3dac28);})[_0xbe14('0x1e')](function(_0x44e08b){if(_0x44e08b){var _0x46c9b6=0xc8;var _0x106d94=_0xbe14('0xb0');logger[_0xbe14('0x1f')](_0xbe14('0x22'),_0x106d94,_0x46c9b6,'entity\x20found');logger[_0xbe14('0x21')](_0xbe14('0xb1'),_0x106d94,_0x46c9b6,_0xbe14('0xb2'),JSON[_0xbe14('0x24')](_0x44e08b));if(_0x3dac28[_0xbe14('0x83')][_0xbe14('0x41')]==='twilio'){return _0x1d5333['status'](_0x46c9b6)['set']('Content-Type',_0xbe14('0xb3'))[_0xbe14('0x3a')]('\x0a');}else{return _0x1d5333[_0xbe14('0x2f')](_0x46c9b6)['json'](_0x44e08b);}}})[_0xbe14('0x28')](handleError(_0x1d5333,null));};exports[_0xbe14('0x3a')]=function(_0x111ff0,_0x1c4d23,_0x1ee7c8){var _0x5b5f9,_0x4f727c,_0x3d87ba;if(_[_0xbe14('0x94')](_0x111ff0[_0xbe14('0x5a')][_0xbe14('0x5a')])||_0x111ff0[_0xbe14('0x5a')][_0xbe14('0x5a')]===''){throw new db[(_0xbe14('0x96'))][(_0xbe14('0x86'))](_0xbe14('0xb4'));}if(_['isNil'](_0x111ff0[_0xbe14('0x5a')]['to'])){throw new db['Sequelize'][(_0xbe14('0x86'))]('to\x20is\x20mandatory');}_0x5b5f9=_0x111ff0['body']['to'];return db[_0xbe14('0x3e')][_0xbe14('0x58')]({'where':{'id':_0x111ff0[_0xbe14('0x56')]['id']},'include':[{'model':db['CmList'],'as':_0xbe14('0xb5'),'include':[{'model':db['CmContact'],'as':_0xbe14('0x9f'),'where':{'mobile':_0x5b5f9},'limit':0x1,'order':[['updatedAt',_0xbe14('0xb6')]]}]}]})[_0xbe14('0x1e')](handleEntityNotFound(_0x1c4d23,null))[_0xbe14('0x1e')](function(_0x466455){if(_0x466455&&_0x466455[_0xbe14('0xb5')]){_0x4f727c=_0x466455[_0xbe14('0x35')]({'plain':!![]});if(_0x4f727c['List']&&_0x4f727c[_0xbe14('0xb5')][_0xbe14('0x9f')]['length']){return _0x4f727c['List']['Contacts'][0x0];}return db[_0xbe14('0x9c')][_0xbe14('0x59')](_[_0xbe14('0x17')](_0x111ff0[_0xbe14('0x5a')],{'firstName':_0x5b5f9,'mobile':_0x5b5f9,'phone':_0x5b5f9,'ListId':_0x4f727c[_0xbe14('0x9b')]}));}})[_0xbe14('0x1e')](handleEntityNotFound(_0x1c4d23,null))[_0xbe14('0x1e')](function(_0x513e85){if(_0x513e85){_0x3d87ba=_0x513e85;return db[_0xbe14('0xa1')][_0xbe14('0x58')]({'where':{'ContactId':_0x3d87ba['id'],'closed':![],'WhatsappAccountId':_0x4f727c['id']}})[_0xbe14('0x1e')](function(_0x47fa12){if(_0x47fa12){return[_0x47fa12,![]];}return db[_0xbe14('0xa1')][_0xbe14('0x59')]({'UserId':_0x111ff0[_0xbe14('0x5b')]['id'],'ContactId':_0x3d87ba['id'],'WhatsappAccountId':_0x4f727c['id'],'phone':_0x5b5f9,'firstMsgDirection':'out','Messages':[_['merge'](_0x111ff0[_0xbe14('0x5a')],{'read':![],'body':_0x111ff0['body'][_0xbe14('0x5a')],'phone':_0x5b5f9,'WhatsappAccountId':_0x4f727c['id'],'UserId':_0x111ff0[_0xbe14('0x5b')]['id'],'ContactId':_0x3d87ba['id']})]},{'include':[{'model':db[_0xbe14('0xb7')],'as':_0xbe14('0xb8')}]})[_0xbe14('0x1e')](function(_0x454f92){return[_0x454f92,!![]];});});}})['spread'](function(_0x2f01a4,_0x4aab5b){if(_0x4aab5b){return _0x2f01a4;}return db[_0xbe14('0xb7')][_0xbe14('0x59')](_[_0xbe14('0x52')](_0x111ff0['body'],{'read':![],'body':_0x111ff0[_0xbe14('0x5a')][_0xbe14('0x5a')],'phone':_0x5b5f9,'WhatsappAccountId':_0x4f727c['id'],'WhatsappInteractionId':_0x2f01a4['id'],'UserId':_0x111ff0['user']['id'],'ContactId':_0x3d87ba['id']}))['then'](function(_0x322282){_0x2f01a4[_0xbe14('0xb9')][_0xbe14('0xb8')]=[];_0x2f01a4['dataValues'][_0xbe14('0xb8')][_0xbe14('0xa5')](_0x322282['dataValues']);return _0x2f01a4;});})['then'](respondWithResult(_0x1c4d23,null))['catch'](handleError(_0x1c4d23,null));}; \ No newline at end of file +var _0x5fc3=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./whatsappAccount.socket','register','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','sendStatus','stack','name','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','limit','order','sort','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','show','params','filters','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','WhatsappAccountId','getDispositions','hasOwnProperty','nolimit','pick','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','findOne','WhatsappApplication','bulkCreate','getApplications','notify','Applications','account','applications','orderBy','priority','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','replace','whatsapp:','Body','messageId','MessageSid','isNil','from','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','Content-Type','text/xml','send','\x0a','to\x20is\x20mandatory','List','user','dataValues','Messages','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto'];(function(_0x50b57f,_0x2f01e9){var _0x4386fd=function(_0x9aa517){while(--_0x9aa517){_0x50b57f['push'](_0x50b57f['shift']());}};_0x4386fd(++_0x2f01e9);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x5fc3[_0x2e4aa2];return _0x5e6092;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x35fc('0x17')](config['redis'],{'host':_0x35fc('0x18'),'port':0x18eb});var socket=require(_0x35fc('0x19'))(new Redis(config[_0x35fc('0x1a')]));require(_0x35fc('0x1b'))[_0x35fc('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x558364,_0x398b67,_0x229d56,_0x53b898){return new BPromise(function(_0x154958,_0x227a49){var _0x1121fa=_0x53b898||client;return _0x1121fa['request'](_0x558364,_0x229d56)[_0x35fc('0x1d')](function(_0x45c8b7){logger['info'](_0x35fc('0x1e'),_0x398b67,_0x35fc('0x1f'));logger[_0x35fc('0x20')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x398b67,_0x35fc('0x1f'),JSON[_0x35fc('0x21')](_0x45c8b7));if(_0x45c8b7[_0x35fc('0x22')]){if(_0x45c8b7['error'][_0x35fc('0x23')]===0x1f4){logger[_0x35fc('0x22')](_0x35fc('0x1e'),_0x398b67,_0x45c8b7[_0x35fc('0x22')][_0x35fc('0x24')]);return _0x227a49(_0x45c8b7[_0x35fc('0x22')][_0x35fc('0x24')]);}logger[_0x35fc('0x22')](_0x35fc('0x1e'),_0x398b67,_0x45c8b7[_0x35fc('0x22')]['message']);return _0x154958(_0x45c8b7[_0x35fc('0x22')][_0x35fc('0x24')]);}else{logger[_0x35fc('0x25')](_0x35fc('0x1e'),_0x398b67,_0x35fc('0x1f'));_0x154958(_0x45c8b7['result'][_0x35fc('0x24')]);}})[_0x35fc('0x26')](function(_0x561bf8){logger[_0x35fc('0x22')](_0x35fc('0x1e'),_0x398b67,_0x561bf8);_0x227a49(_0x561bf8);});});}function respondWithStatusCode(_0x3d4a98,_0x51cfec){_0x51cfec=_0x51cfec||0xcc;return function(_0x4086e9){if(_0x4086e9){return _0x3d4a98['sendStatus'](_0x51cfec);}return _0x3d4a98[_0x35fc('0x27')](_0x51cfec)[_0x35fc('0x28')]();};}function respondWithResult(_0x5cb986,_0x519264){_0x519264=_0x519264||0xc8;return function(_0x47774c){if(_0x47774c){return _0x5cb986['status'](_0x519264)[_0x35fc('0x29')](_0x47774c);}};}function respondWithFilteredResult(_0x1a5d92,_0x57001c){return function(_0x26b7cb){if(_0x26b7cb){var _0x645eac=_0x26b7cb[_0x35fc('0x2a')],_0x383837=_0x57001c[_0x35fc('0x2b')],_0x9f3c8a=_0x57001c[_0x35fc('0x2b')]+_0x57001c['limit'],_0x3735da;if(_0x9f3c8a>=_0x645eac){_0x9f3c8a=_0x645eac;_0x3735da=0xc8;}else{_0x3735da=0xce;}_0x1a5d92[_0x35fc('0x27')](_0x3735da);return _0x1a5d92[_0x35fc('0x2c')](_0x35fc('0x2d'),_0x383837+'-'+_0x9f3c8a+'/'+_0x645eac)['json'](_0x26b7cb);}return null;};}function patchUpdates(_0xe79f52){return function(_0x16f067){try{jsonpatch[_0x35fc('0x2e')](_0x16f067,_0xe79f52,!![]);}catch(_0xe6e4ba){return BPromise[_0x35fc('0x2f')](_0xe6e4ba);}return _0x16f067[_0x35fc('0x30')]();};}function saveUpdates(_0x222ddb,_0x37b435){return function(_0xf4dfab){if(_0xf4dfab){return _0xf4dfab[_0x35fc('0x31')](_0x222ddb)['then'](function(_0x5e0313){return _0x5e0313;});}return null;};}function removeEntity(_0x114bc1,_0x4af5fe){return function(_0x37b394){if(_0x37b394){return _0x37b394[_0x35fc('0x32')]()[_0x35fc('0x1d')](function(){var _0x227471=_0x37b394[_0x35fc('0x33')]({'plain':!![]});var _0x12e78f='WhatsappAccounts';return db[_0x35fc('0x34')][_0x35fc('0x32')]({'where':{'type':_0x12e78f,'resourceId':_0x227471['id']}})[_0x35fc('0x1d')](function(){return _0x37b394;});})[_0x35fc('0x1d')](function(){_0x114bc1[_0x35fc('0x27')](0xcc)[_0x35fc('0x28')]();});}};}function handleEntityNotFound(_0x553597,_0x2483be){return function(_0x38193d){if(!_0x38193d){_0x553597[_0x35fc('0x35')](0x194);}return _0x38193d;};}function handleError(_0x52f53d,_0x2c657d){_0x2c657d=_0x2c657d||0x1f4;return function(_0x48d223){logger[_0x35fc('0x22')](_0x48d223[_0x35fc('0x36')]);if(_0x48d223[_0x35fc('0x37')]){delete _0x48d223[_0x35fc('0x37')];}_0x52f53d['status'](_0x2c657d)['send'](_0x48d223);};}exports['index']=function(_0x20f5fe,_0x56c06c){var _0x20f8bb={'include':[{'model':db[_0x35fc('0x38')],'as':_0x35fc('0x39')}]},_0x4b4d4a={},_0x9c6b65={'count':0x0,'rows':[]};var _0x22b724=_[_0x35fc('0x3a')](db[_0x35fc('0x3b')][_0x35fc('0x3c')],function(_0x4ec0dc){return{'name':_0x4ec0dc[_0x35fc('0x3d')],'type':_0x4ec0dc[_0x35fc('0x3e')]['key']};});_0x4b4d4a[_0x35fc('0x3f')]=_[_0x35fc('0x3a')](_0x22b724,_0x35fc('0x37'));_0x4b4d4a[_0x35fc('0x40')]=_[_0x35fc('0x41')](_0x20f5fe[_0x35fc('0x40')]);_0x4b4d4a['filters']=_[_0x35fc('0x42')](_0x4b4d4a[_0x35fc('0x3f')],_0x4b4d4a[_0x35fc('0x40')]);_0x20f8bb['attributes']=_[_0x35fc('0x42')](_0x4b4d4a[_0x35fc('0x3f')],qs['fields'](_0x20f5fe[_0x35fc('0x40')][_0x35fc('0x43')]));_0x20f8bb[_0x35fc('0x44')]=_0x20f8bb[_0x35fc('0x44')][_0x35fc('0x45')]?_0x20f8bb[_0x35fc('0x44')]:_0x4b4d4a[_0x35fc('0x3f')];if(!_0x20f5fe[_0x35fc('0x40')]['hasOwnProperty']('nolimit')){_0x20f8bb[_0x35fc('0x46')]=qs[_0x35fc('0x46')](_0x20f5fe['query']['limit']);_0x20f8bb['offset']=qs[_0x35fc('0x2b')](_0x20f5fe[_0x35fc('0x40')]['offset']);}_0x20f8bb[_0x35fc('0x47')]=qs[_0x35fc('0x48')](_0x20f5fe[_0x35fc('0x40')][_0x35fc('0x48')]);_0x20f8bb['where']=qs['filters'](_['pick'](_0x20f5fe['query'],_0x4b4d4a['filters']),_0x22b724);if(_0x20f5fe[_0x35fc('0x40')][_0x35fc('0x49')]){_0x20f8bb['where']=_[_0x35fc('0x4a')](_0x20f8bb['where'],{'$or':_[_0x35fc('0x3a')](_0x22b724,function(_0x40797d){if(_0x40797d[_0x35fc('0x3e')]!==_0x35fc('0x4b')){var _0x16f7c8={};_0x16f7c8[_0x40797d['name']]={'$like':'%'+_0x20f5fe[_0x35fc('0x40')][_0x35fc('0x49')]+'%'};return _0x16f7c8;}})});}_0x20f8bb=_['merge']({},_0x20f8bb,_0x20f5fe[_0x35fc('0x4c')]);var _0x298b7b={'where':_0x20f8bb[_0x35fc('0x4d')]};return db[_0x35fc('0x3b')]['count'](_0x298b7b)[_0x35fc('0x1d')](function(_0x4c82d8){_0x9c6b65['count']=_0x4c82d8;if(_0x20f5fe[_0x35fc('0x40')][_0x35fc('0x4e')]){_0x20f8bb[_0x35fc('0x4f')]=[{'all':!![]}];}return db[_0x35fc('0x3b')][_0x35fc('0x50')](_0x20f8bb);})[_0x35fc('0x1d')](function(_0x405320){_0x9c6b65[_0x35fc('0x51')]=_0x405320;return _0x9c6b65;})['then'](respondWithFilteredResult(_0x56c06c,_0x20f8bb))[_0x35fc('0x26')](handleError(_0x56c06c,null));};exports[_0x35fc('0x52')]=function(_0xeca02e,_0x40b5c7){var _0x2ad481={'raw':![],'where':{'id':_0xeca02e[_0x35fc('0x53')]['id']},'include':[{'model':db[_0x35fc('0x38')],'as':_0x35fc('0x39')}]},_0x1e3221={};_0x1e3221[_0x35fc('0x3f')]=_[_0x35fc('0x41')](db[_0x35fc('0x3b')][_0x35fc('0x3c')]);_0x1e3221[_0x35fc('0x40')]=_['keys'](_0xeca02e['query']);_0x1e3221[_0x35fc('0x54')]=_[_0x35fc('0x42')](_0x1e3221[_0x35fc('0x3f')],_0x1e3221[_0x35fc('0x40')]);_0x2ad481[_0x35fc('0x44')]=_[_0x35fc('0x42')](_0x1e3221['model'],qs['fields'](_0xeca02e[_0x35fc('0x40')][_0x35fc('0x43')]));_0x2ad481[_0x35fc('0x44')]=_0x2ad481[_0x35fc('0x44')]['length']?_0x2ad481[_0x35fc('0x44')]:_0x1e3221[_0x35fc('0x3f')];if(_0xeca02e['query'][_0x35fc('0x4e')]){_0x2ad481[_0x35fc('0x4f')]=[{'all':!![]}];}_0x2ad481=_['merge']({},_0x2ad481,_0xeca02e[_0x35fc('0x4c')]);return db[_0x35fc('0x3b')][_0x35fc('0x55')](_0x2ad481)[_0x35fc('0x1d')](handleEntityNotFound(_0x40b5c7,null))['then'](respondWithResult(_0x40b5c7,null))['catch'](handleError(_0x40b5c7,null));};exports['create']=function(_0x240338,_0x2ea8d6){return db['WhatsappAccount'][_0x35fc('0x56')](_0x240338[_0x35fc('0x57')],{})[_0x35fc('0x1d')](function(_0x145854){var _0x46c59b=_0x240338['user'][_0x35fc('0x33')]({'plain':!![]});if(!_0x46c59b)throw new Error(_0x35fc('0x58'));if(_0x46c59b[_0x35fc('0x59')]==='user'){var _0x304dba=_0x145854[_0x35fc('0x33')]({'plain':!![]});var _0x47fb1a=_0x35fc('0x5a');return db[_0x35fc('0x5b')][_0x35fc('0x55')]({'where':{'name':_0x47fb1a,'userProfileId':_0x46c59b[_0x35fc('0x5c')]},'raw':!![]})[_0x35fc('0x1d')](function(_0x41453b){if(_0x41453b&&_0x41453b[_0x35fc('0x5d')]===0x0){return db[_0x35fc('0x34')]['create']({'name':_0x304dba[_0x35fc('0x37')],'resourceId':_0x304dba['id'],'type':_0x41453b[_0x35fc('0x37')],'sectionId':_0x41453b['id']},{})[_0x35fc('0x1d')](function(){return _0x145854;});}else{return _0x145854;}})['catch'](function(_0x243871){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x243871);throw _0x243871;});}return _0x145854;})['then'](respondWithResult(_0x2ea8d6,0xc9))[_0x35fc('0x26')](handleError(_0x2ea8d6,null));};exports[_0x35fc('0x31')]=function(_0x39a1ee,_0x13901c){if(_0x39a1ee[_0x35fc('0x57')]['id']){delete _0x39a1ee['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x39a1ee['params']['id']},'include':[{'model':db['Pause'],'as':_0x35fc('0x39')}]})[_0x35fc('0x1d')](handleEntityNotFound(_0x13901c,null))[_0x35fc('0x1d')](saveUpdates(_0x39a1ee[_0x35fc('0x57')],null))['then'](respondWithResult(_0x13901c,null))[_0x35fc('0x26')](handleError(_0x13901c,null));};exports[_0x35fc('0x32')]=function(_0x390e16,_0x1b0063){return db[_0x35fc('0x3b')][_0x35fc('0x55')]({'where':{'id':_0x390e16[_0x35fc('0x53')]['id']}})[_0x35fc('0x1d')](handleEntityNotFound(_0x1b0063,null))[_0x35fc('0x1d')](removeEntity(_0x1b0063,null))['catch'](handleError(_0x1b0063,null));};exports[_0x35fc('0x5e')]=function(_0x47c75f,_0xfbd737){return db[_0x35fc('0x3b')][_0x35fc('0x5e')]()[_0x35fc('0x1d')](respondWithResult(_0xfbd737,null))['catch'](handleError(_0xfbd737,null));};exports[_0x35fc('0x5f')]=function(_0x4af592,_0x4e2835,_0x5f1d4a){if(_0x4af592[_0x35fc('0x57')]['id']){delete _0x4af592['body']['id'];}return db[_0x35fc('0x3b')]['find']({'where':{'id':_0x4af592[_0x35fc('0x53')]['id']}})['then'](handleEntityNotFound(_0x4e2835,null))[_0x35fc('0x1d')](function(_0x455b84){if(_0x455b84){_0x4af592[_0x35fc('0x57')][_0x35fc('0x60')]=_0x455b84['id'];return db['Disposition'][_0x35fc('0x56')](_0x4af592[_0x35fc('0x57')]);}})[_0x35fc('0x1d')](respondWithResult(_0x4e2835,null))['catch'](handleError(_0x4e2835,null));};exports[_0x35fc('0x61')]=function(_0x8a4a13,_0x37764b,_0x3c1b56){var _0x1e4e15={'raw':![],'where':{}};var _0x2c4309={};var _0x2ee98b={'count':0x0,'rows':[]};return db[_0x35fc('0x3b')]['findOne']({'where':{'id':_0x8a4a13[_0x35fc('0x53')]['id']}})[_0x35fc('0x1d')](handleEntityNotFound(_0x37764b,null))[_0x35fc('0x1d')](function(_0x4a926d){if(_0x4a926d){_0x2c4309[_0x35fc('0x3f')]=_[_0x35fc('0x41')](db['Disposition']['rawAttributes']);_0x2c4309[_0x35fc('0x40')]=_['keys'](_0x8a4a13[_0x35fc('0x40')]);_0x2c4309[_0x35fc('0x54')]=_[_0x35fc('0x42')](_0x2c4309[_0x35fc('0x3f')],_0x2c4309[_0x35fc('0x40')]);_0x1e4e15[_0x35fc('0x44')]=_[_0x35fc('0x42')](_0x2c4309[_0x35fc('0x3f')],qs[_0x35fc('0x43')](_0x8a4a13[_0x35fc('0x40')][_0x35fc('0x43')]));_0x1e4e15[_0x35fc('0x44')]=_0x1e4e15[_0x35fc('0x44')][_0x35fc('0x45')]?_0x1e4e15[_0x35fc('0x44')]:_0x2c4309[_0x35fc('0x3f')];if(!_0x8a4a13[_0x35fc('0x40')][_0x35fc('0x62')](_0x35fc('0x63'))){_0x1e4e15[_0x35fc('0x46')]=qs['limit'](_0x8a4a13[_0x35fc('0x40')]['limit']);_0x1e4e15[_0x35fc('0x2b')]=qs[_0x35fc('0x2b')](_0x8a4a13[_0x35fc('0x40')][_0x35fc('0x2b')]);}_0x1e4e15[_0x35fc('0x47')]=qs[_0x35fc('0x48')](_0x8a4a13[_0x35fc('0x40')][_0x35fc('0x48')]);_0x1e4e15[_0x35fc('0x4d')]=qs[_0x35fc('0x54')](_[_0x35fc('0x64')](_0x8a4a13['query'],_0x2c4309[_0x35fc('0x54')]));_0x1e4e15[_0x35fc('0x4d')][_0x35fc('0x60')]=_0x4a926d['id'];if(_0x8a4a13[_0x35fc('0x40')][_0x35fc('0x49')]){_0x1e4e15[_0x35fc('0x4d')]=_['merge'](_0x1e4e15[_0x35fc('0x4d')],{'$or':_[_0x35fc('0x3a')](_0x1e4e15[_0x35fc('0x44')],function(_0x23206d){var _0x6a46b4={};_0x6a46b4[_0x23206d]={'$like':'%'+_0x8a4a13[_0x35fc('0x40')][_0x35fc('0x49')]+'%'};return _0x6a46b4;})});}_0x1e4e15=_[_0x35fc('0x4a')]({},_0x1e4e15,_0x8a4a13[_0x35fc('0x4c')]);return db['Disposition'][_0x35fc('0x2a')]({'where':_0x1e4e15['where']})[_0x35fc('0x1d')](function(_0x23be75){_0x2ee98b['count']=_0x23be75;if(_0x8a4a13[_0x35fc('0x40')][_0x35fc('0x4e')]){_0x1e4e15[_0x35fc('0x4f')]=[{'all':!![]}];}return db[_0x35fc('0x65')][_0x35fc('0x50')](_0x1e4e15);})[_0x35fc('0x1d')](function(_0x42f87e){_0x2ee98b[_0x35fc('0x51')]=_0x42f87e;return _0x2ee98b;});}})[_0x35fc('0x1d')](respondWithFilteredResult(_0x37764b,_0x1e4e15))['catch'](handleError(_0x37764b,null));};exports['removeDispositions']=function(_0x4e7c7b,_0x531117,_0x160a6f){return db[_0x35fc('0x3b')][_0x35fc('0x55')]({'where':{'id':_0x4e7c7b[_0x35fc('0x53')]['id']}})[_0x35fc('0x1d')](handleEntityNotFound(_0x531117,null))['then'](function(_0x226fdf){if(_0x226fdf){return _0x226fdf[_0x35fc('0x66')](_0x4e7c7b[_0x35fc('0x40')][_0x35fc('0x67')]);}})['then'](respondWithStatusCode(_0x531117,null))[_0x35fc('0x26')](handleError(_0x531117,null));};exports[_0x35fc('0x68')]=function(_0x32b2df,_0x595a89,_0x314886){if(_0x32b2df[_0x35fc('0x57')]['id']){delete _0x32b2df[_0x35fc('0x57')]['id'];}return db[_0x35fc('0x3b')][_0x35fc('0x55')]({'where':{'id':_0x32b2df[_0x35fc('0x53')]['id']}})[_0x35fc('0x1d')](handleEntityNotFound(_0x595a89,null))[_0x35fc('0x1d')](function(_0x4b6c03){if(_0x4b6c03){_0x32b2df[_0x35fc('0x57')][_0x35fc('0x60')]=_0x4b6c03['id'];return db[_0x35fc('0x69')][_0x35fc('0x56')](_0x32b2df[_0x35fc('0x57')]);}})[_0x35fc('0x1d')](respondWithResult(_0x595a89,null))['catch'](handleError(_0x595a89,null));};exports[_0x35fc('0x6a')]=function(_0x5df473,_0x4855ee,_0x1a2da0){var _0x597670={'raw':![],'where':{}};var _0x1246c7={};var _0x233b7d={'count':0x0,'rows':[]};return db[_0x35fc('0x3b')]['findOne']({'where':{'id':_0x5df473[_0x35fc('0x53')]['id']}})[_0x35fc('0x1d')](handleEntityNotFound(_0x4855ee,null))[_0x35fc('0x1d')](function(_0x1beb46){if(_0x1beb46){_0x1246c7[_0x35fc('0x3f')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x1246c7[_0x35fc('0x40')]=_['keys'](_0x5df473[_0x35fc('0x40')]);_0x1246c7[_0x35fc('0x54')]=_[_0x35fc('0x42')](_0x1246c7[_0x35fc('0x3f')],_0x1246c7['query']);_0x597670[_0x35fc('0x44')]=_[_0x35fc('0x42')](_0x1246c7[_0x35fc('0x3f')],qs['fields'](_0x5df473[_0x35fc('0x40')][_0x35fc('0x43')]));_0x597670[_0x35fc('0x44')]=_0x597670['attributes']['length']?_0x597670['attributes']:_0x1246c7[_0x35fc('0x3f')];if(!_0x5df473[_0x35fc('0x40')][_0x35fc('0x62')](_0x35fc('0x63'))){_0x597670['limit']=qs[_0x35fc('0x46')](_0x5df473[_0x35fc('0x40')]['limit']);_0x597670['offset']=qs[_0x35fc('0x2b')](_0x5df473[_0x35fc('0x40')][_0x35fc('0x2b')]);}_0x597670['order']=qs['sort'](_0x5df473[_0x35fc('0x40')][_0x35fc('0x48')]);_0x597670['where']=qs[_0x35fc('0x54')](_[_0x35fc('0x64')](_0x5df473[_0x35fc('0x40')],_0x1246c7['filters']));_0x597670[_0x35fc('0x4d')][_0x35fc('0x60')]=_0x1beb46['id'];if(_0x5df473[_0x35fc('0x40')][_0x35fc('0x49')]){_0x597670['where']=_[_0x35fc('0x4a')](_0x597670[_0x35fc('0x4d')],{'$or':_[_0x35fc('0x3a')](_0x597670['attributes'],function(_0x96dfc){var _0x26d242={};_0x26d242[_0x96dfc]={'$like':'%'+_0x5df473[_0x35fc('0x40')]['filter']+'%'};return _0x26d242;})});}_0x597670=_[_0x35fc('0x4a')]({},_0x597670,_0x5df473[_0x35fc('0x4c')]);return db['CannedAnswer'][_0x35fc('0x2a')]({'where':_0x597670[_0x35fc('0x4d')]})[_0x35fc('0x1d')](function(_0x45eaae){_0x233b7d[_0x35fc('0x2a')]=_0x45eaae;if(_0x5df473[_0x35fc('0x40')][_0x35fc('0x4e')]){_0x597670[_0x35fc('0x4f')]=[{'all':!![]}];}return db[_0x35fc('0x69')]['findAll'](_0x597670);})[_0x35fc('0x1d')](function(_0x3fc6cc){_0x233b7d[_0x35fc('0x51')]=_0x3fc6cc;return _0x233b7d;});}})[_0x35fc('0x1d')](respondWithFilteredResult(_0x4855ee,_0x597670))['catch'](handleError(_0x4855ee,null));};exports[_0x35fc('0x6b')]=function(_0x1808a3,_0x209d7a,_0x7b633a){return db[_0x35fc('0x3b')][_0x35fc('0x55')]({'where':{'id':_0x1808a3[_0x35fc('0x53')]['id']}})[_0x35fc('0x1d')](handleEntityNotFound(_0x209d7a,null))['then'](function(_0x4e3b32){if(_0x4e3b32){return _0x4e3b32[_0x35fc('0x6b')](_0x1808a3[_0x35fc('0x40')][_0x35fc('0x67')]);}})['then'](respondWithStatusCode(_0x209d7a,null))[_0x35fc('0x26')](handleError(_0x209d7a,null));};exports[_0x35fc('0x6c')]=function(_0x699ecf,_0xf1f222,_0x4d01e1){return db['WhatsappAccount'][_0x35fc('0x55')]({'where':{'id':_0x699ecf['params']['id']}})[_0x35fc('0x1d')](handleEntityNotFound(_0xf1f222,null))[_0x35fc('0x1d')](function(_0x5d005a){if(_0x5d005a){return _0x5d005a['addAgents'](_0x699ecf[_0x35fc('0x57')][_0x35fc('0x67')],_[_0x35fc('0x6d')](_0x699ecf['body'],[_0x35fc('0x67'),'id'])||{})[_0x35fc('0x6e')](function(_0x2f3571){for(var _0x4cb4be=0x0;_0x4cb4be<_0x699ecf[_0x35fc('0x57')][_0x35fc('0x67')][_0x35fc('0x45')];_0x4cb4be+=0x1){socket[_0x35fc('0x6f')]('userWhatsappAccount:save',{'UserId':_0x699ecf[_0x35fc('0x57')][_0x35fc('0x67')][_0x4cb4be],'WhatsappAccountId':_0x699ecf[_0x35fc('0x53')]['id']});}return _0x2f3571;});}})[_0x35fc('0x1d')](respondWithResult(_0xf1f222,null))[_0x35fc('0x26')](handleError(_0xf1f222,null));};exports[_0x35fc('0x70')]=function(_0x5de35a,_0x22ba47,_0x109ea0){return db['WhatsappAccount'][_0x35fc('0x55')]({'where':{'id':_0x5de35a[_0x35fc('0x53')]['id']}})['then'](handleEntityNotFound(_0x22ba47,null))[_0x35fc('0x1d')](function(_0x31541e){if(_0x31541e){return _0x31541e[_0x35fc('0x70')](_0x5de35a[_0x35fc('0x40')][_0x35fc('0x67')])['then'](function(){if(_[_0x35fc('0x71')](_0x5de35a[_0x35fc('0x40')][_0x35fc('0x67')])){for(var _0x5bc29e=0x0;_0x5bc29e<_0x5de35a[_0x35fc('0x40')]['ids']['length'];_0x5bc29e+=0x1){socket[_0x35fc('0x6f')](_0x35fc('0x72'),{'UserId':Number(_0x5de35a[_0x35fc('0x40')][_0x35fc('0x67')][_0x5bc29e]),'WhatsappAccountId':Number(_0x5de35a[_0x35fc('0x53')]['id'])});}}else{socket['emit'](_0x35fc('0x72'),{'UserId':Number(_0x5de35a[_0x35fc('0x40')][_0x35fc('0x67')]),'WhatsappAccountId':Number(_0x5de35a['params']['id'])});}});}})[_0x35fc('0x1d')](respondWithStatusCode(_0x22ba47,null))[_0x35fc('0x26')](handleError(_0x22ba47,null));};exports[_0x35fc('0x73')]=function(_0x448cd5,_0x169112,_0x4ec3ba){var _0x1a2d73={};var _0x1bd27f={};var _0x47b52e;var _0x4d4e5f;return db[_0x35fc('0x3b')][_0x35fc('0x74')]({'where':{'id':_0x448cd5[_0x35fc('0x53')]['id']}})[_0x35fc('0x1d')](handleEntityNotFound(_0x169112,null))[_0x35fc('0x1d')](function(_0x2b2a87){if(_0x2b2a87){_0x47b52e=_0x2b2a87;_0x1bd27f[_0x35fc('0x3f')]=_['keys'](db['User'][_0x35fc('0x3c')]);_0x1bd27f[_0x35fc('0x40')]=_[_0x35fc('0x41')](_0x448cd5[_0x35fc('0x40')]);_0x1bd27f[_0x35fc('0x54')]=_['intersection'](_0x1bd27f['model'],_0x1bd27f[_0x35fc('0x40')]);_0x1a2d73[_0x35fc('0x44')]=_[_0x35fc('0x42')](_0x1bd27f[_0x35fc('0x3f')],qs['fields'](_0x448cd5['query'][_0x35fc('0x43')]));_0x1a2d73[_0x35fc('0x44')]=_0x1a2d73[_0x35fc('0x44')][_0x35fc('0x45')]?_0x1a2d73['attributes']:_0x1bd27f['model'];_0x1a2d73[_0x35fc('0x47')]=qs[_0x35fc('0x48')](_0x448cd5['query'][_0x35fc('0x48')]);_0x1a2d73[_0x35fc('0x4d')]=qs[_0x35fc('0x54')](_[_0x35fc('0x64')](_0x448cd5[_0x35fc('0x40')],_0x1bd27f[_0x35fc('0x54')]));if(_0x448cd5[_0x35fc('0x40')][_0x35fc('0x49')]){_0x1a2d73[_0x35fc('0x4d')]=_[_0x35fc('0x4a')](_0x1a2d73[_0x35fc('0x4d')],{'$or':_[_0x35fc('0x3a')](_0x1a2d73[_0x35fc('0x44')],function(_0x42a914){var _0x3e1b55={};_0x3e1b55[_0x42a914]={'$like':'%'+_0x448cd5[_0x35fc('0x40')]['filter']+'%'};return _0x3e1b55;})});}_0x1a2d73=_[_0x35fc('0x4a')]({},_0x1a2d73,_0x448cd5['options']);return _0x47b52e[_0x35fc('0x73')](_0x1a2d73);}})['then'](function(_0x5aa072){if(_0x5aa072){_0x4d4e5f=_0x5aa072[_0x35fc('0x45')];if(!_0x448cd5[_0x35fc('0x40')][_0x35fc('0x62')]('nolimit')){_0x1a2d73[_0x35fc('0x46')]=qs[_0x35fc('0x46')](_0x448cd5[_0x35fc('0x40')][_0x35fc('0x46')]);_0x1a2d73[_0x35fc('0x2b')]=qs[_0x35fc('0x2b')](_0x448cd5['query']['offset']);}return _0x47b52e[_0x35fc('0x73')](_0x1a2d73);}})['then'](function(_0x5b03dd){if(_0x5b03dd){return _0x5b03dd?{'count':_0x4d4e5f,'rows':_0x5b03dd}:null;}})[_0x35fc('0x1d')](respondWithResult(_0x169112,null))['catch'](handleError(_0x169112,null));};exports['addApplications']=function(_0x5ae83f,_0x450769,_0x5d461c){return db[_0x35fc('0x3b')][_0x35fc('0x74')]({'where':{'id':_0x5ae83f[_0x35fc('0x53')]['id']}})[_0x35fc('0x1d')](handleEntityNotFound(_0x450769,null))[_0x35fc('0x1d')](function(_0x201dfa){if(_0x201dfa){return db['sequelize']['transaction'](function(_0x13542a){return db['WhatsappApplication'][_0x35fc('0x32')]({'where':{'WhatsappAccountId':_0x5ae83f[_0x35fc('0x53')]['id']},'transaction':_0x13542a})['then'](function(_0x4b0d98){var _0x58d7cb=_[_0x35fc('0x3a')](_0x5ae83f[_0x35fc('0x57')],function(_0x406548){_0x406548[_0x35fc('0x60')]=_0x5ae83f[_0x35fc('0x53')]['id'];return _0x406548;});return db[_0x35fc('0x75')][_0x35fc('0x76')](_0x58d7cb,{'transaction':_0x13542a});});})[_0x35fc('0x1d')](function(){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x5ae83f['params']['id']},'order':'priority'});});}})[_0x35fc('0x1d')](respondWithResult(_0x450769,null))['catch'](handleError(_0x450769,null));};exports[_0x35fc('0x77')]=function(_0x5a801b,_0x47387f,_0x31b61d){var _0x4d18d7={};var _0x515bca={};var _0x3cab00;var _0x10cdce;return db[_0x35fc('0x3b')][_0x35fc('0x74')]({'where':{'id':_0x5a801b[_0x35fc('0x53')]['id']}})['then'](handleEntityNotFound(_0x47387f,null))['then'](function(_0x4655be){if(_0x4655be){_0x3cab00=_0x4655be;_0x515bca['model']=_[_0x35fc('0x41')](db['WhatsappApplication'][_0x35fc('0x3c')]);_0x515bca[_0x35fc('0x40')]=_[_0x35fc('0x41')](_0x5a801b[_0x35fc('0x40')]);_0x515bca['filters']=_[_0x35fc('0x42')](_0x515bca['model'],_0x515bca[_0x35fc('0x40')]);_0x4d18d7['attributes']=_['intersection'](_0x515bca[_0x35fc('0x3f')],qs['fields'](_0x5a801b[_0x35fc('0x40')][_0x35fc('0x43')]));_0x4d18d7[_0x35fc('0x44')]=_0x4d18d7[_0x35fc('0x44')][_0x35fc('0x45')]?_0x4d18d7[_0x35fc('0x44')]:_0x515bca[_0x35fc('0x3f')];_0x4d18d7[_0x35fc('0x47')]=qs[_0x35fc('0x48')](_0x5a801b['query'][_0x35fc('0x48')]);_0x4d18d7[_0x35fc('0x4d')]=qs[_0x35fc('0x54')](_[_0x35fc('0x64')](_0x5a801b[_0x35fc('0x40')],_0x515bca[_0x35fc('0x54')]));if(_0x5a801b[_0x35fc('0x40')][_0x35fc('0x49')]){_0x4d18d7['where']=_['merge'](_0x4d18d7['where'],{'$or':_['map'](_0x4d18d7['attributes'],function(_0x271087){var _0x2946f2={};_0x2946f2[_0x271087]={'$like':'%'+_0x5a801b[_0x35fc('0x40')][_0x35fc('0x49')]+'%'};return _0x2946f2;})});}_0x4d18d7=_[_0x35fc('0x4a')]({},_0x4d18d7,_0x5a801b['options']);return _0x3cab00[_0x35fc('0x77')](_0x4d18d7);}})[_0x35fc('0x1d')](function(_0x85721d){if(_0x85721d){_0x10cdce=_0x85721d[_0x35fc('0x45')];if(!_0x5a801b[_0x35fc('0x40')]['hasOwnProperty'](_0x35fc('0x63'))){_0x4d18d7[_0x35fc('0x46')]=qs[_0x35fc('0x46')](_0x5a801b['query'][_0x35fc('0x46')]);_0x4d18d7[_0x35fc('0x2b')]=qs[_0x35fc('0x2b')](_0x5a801b[_0x35fc('0x40')][_0x35fc('0x2b')]);}return _0x3cab00[_0x35fc('0x77')](_0x4d18d7);}})[_0x35fc('0x1d')](function(_0x45df88){if(_0x45df88){return _0x45df88?{'count':_0x10cdce,'rows':_0x45df88}:null;}})[_0x35fc('0x1d')](respondWithResult(_0x47387f,null))[_0x35fc('0x26')](handleError(_0x47387f,null));};exports[_0x35fc('0x78')]=function(_0x7b98b0,_0x225eb1,_0x206f0b){var _0x3e7663={'channel':'whatsapp'};var _0x4ae3d8=[];var _0x2d76c3=[];var _0x6a0c44={};return db[_0x35fc('0x3b')][_0x35fc('0x55')]({'where':{'id':_0x7b98b0[_0x35fc('0x53')]['id']},'include':[{'model':db[_0x35fc('0x75')],'as':_0x35fc('0x79')}]})[_0x35fc('0x1d')](handleEntityNotFound(_0x225eb1,null))[_0x35fc('0x1d')](function(_0x17b462){_0x3e7663[_0x35fc('0x7a')]=_0x17b462;_0x3e7663[_0x35fc('0x7b')]=_[_0x35fc('0x7c')](_0x17b462[_0x35fc('0x79')],[_0x35fc('0x7d')],['asc']);if(_0x3e7663[_0x35fc('0x7a')][_0x35fc('0x79')]){delete _0x3e7663[_0x35fc('0x7a')][_0x35fc('0x79')];}return db[_0x35fc('0x7e')][_0x35fc('0x5e')]();})[_0x35fc('0x1d')](function(_0xa4c51a){if(!_0xa4c51a){throw new db['Sequelize']['ValidationError'](_0x35fc('0x7f'));}_0x4ae3d8=_[_0x35fc('0x80')](_['keys'](_0xa4c51a),[_0x35fc('0x81'),_0x35fc('0x82')]);_0x2d76c3=_[_0x35fc('0x80')](_[_0x35fc('0x41')](_0xa4c51a),['createdAt',_0x35fc('0x82'),_0x35fc('0x83'),_0x35fc('0x84')]);_0x3e7663[_0x35fc('0x57')]={'mapKey':'mobile'};if(_0x3e7663[_0x35fc('0x7a')][_0x35fc('0x3e')]&&_0x3e7663['account'][_0x35fc('0x3e')]===_0x35fc('0x85')){_0x3e7663[_0x35fc('0x57')]['from']=_0x7b98b0[_0x35fc('0x57')]['From'][_0x35fc('0x86')](_0x35fc('0x87'),'');_0x3e7663['body'][_0x35fc('0x57')]=_0x7b98b0[_0x35fc('0x57')][_0x35fc('0x88')];_0x3e7663[_0x35fc('0x57')][_0x35fc('0x89')]=_0x7b98b0[_0x35fc('0x57')][_0x35fc('0x8a')];}if(_0x3e7663['body']['id']){delete _0x3e7663['body']['id'];}if(_[_0x35fc('0x8b')](_0x3e7663[_0x35fc('0x57')][_0x35fc('0x8c')])){throw new db[(_0x35fc('0x8d'))][(_0x35fc('0x8e'))](_0x35fc('0x8f'));}if(_[_0x35fc('0x8b')](_0x3e7663['body'][_0x35fc('0x57')])||_0x3e7663[_0x35fc('0x57')][_0x35fc('0x57')]===''){throw new db['Sequelize'][(_0x35fc('0x8e'))](_0x35fc('0x90'));}if(_[_0x35fc('0x8b')](_0x3e7663[_0x35fc('0x57')][_0x35fc('0x91')])){throw new db[(_0x35fc('0x8d'))][(_0x35fc('0x8e'))](_0x35fc('0x92')+_0x2d76c3);}if(!_[_0x35fc('0x93')](_0x2d76c3,_0x3e7663[_0x35fc('0x57')][_0x35fc('0x91')])){throw new db[(_0x35fc('0x8d'))][(_0x35fc('0x8e'))](_0x35fc('0x94')+_0x2d76c3);}_0x6a0c44[_0x3e7663[_0x35fc('0x57')][_0x35fc('0x91')]]=_0x3e7663[_0x35fc('0x57')][_0x35fc('0x8c')];return db[_0x35fc('0x95')]['find']({'where':{'id':_0x3e7663[_0x35fc('0x7a')]['ListId']},'include':[{'model':db[_0x35fc('0x7e')],'as':_0x35fc('0x96'),'where':_0x6a0c44,'limit':0x1,'order':[['updatedAt',_0x35fc('0x97')]]}]});})[_0x35fc('0x1d')](handleEntityNotFound(_0x225eb1,null))[_0x35fc('0x1d')](function(_0x1171ab){if(_0x1171ab){_0x3e7663[_0x35fc('0x98')]=_[_0x35fc('0x6d')](_0x1171ab,[_0x35fc('0x96')]);if(_0x1171ab[_0x35fc('0x96')]['length']){return _0x1171ab[_0x35fc('0x96')][0x0];}var _0x372583=_[_0x35fc('0x17')](_0x3e7663[_0x35fc('0x57')],{'firstName':_0x3e7663['body']['from'],'ListId':_0x1171ab['id']});_0x372583[_0x3e7663['body']['mapKey']]=_0x3e7663[_0x35fc('0x57')]['from'];return db[_0x35fc('0x7e')][_0x35fc('0x56')](_0x372583,{'fields':_0x4ae3d8,'raw':!![]});}})[_0x35fc('0x1d')](handleEntityNotFound(_0x225eb1,null))[_0x35fc('0x1d')](function(_0x1b9e94){if(_0x1b9e94){_0x3e7663[_0x35fc('0x99')]=_0x1b9e94;var _0x28cb0b={'ContactId':_0x1b9e94['id'],'phone':_0x3e7663[_0x35fc('0x57')][_0x35fc('0x8c')],'WhatsappAccountId':_0x7b98b0[_0x35fc('0x53')]['id']};var _0x5bfd4d={'ContactId':_0x1b9e94['id'],'WhatsappAccountId':_0x7b98b0[_0x35fc('0x53')]['id'],'closed':![]};return db[_0x35fc('0x9a')]['find']({'where':_0x5bfd4d})[_0x35fc('0x1d')](function(_0x3e8580){if(_0x3e8580){return[_0x3e8580,![]];}return db[_0x35fc('0x9a')][_0x35fc('0x56')](_0x28cb0b)['then'](function(_0x2d53f3){return[_0x2d53f3,!![]];});});}})[_0x35fc('0x6e')](function(_0x26bc22,_0xe7663b){_0x3e7663[_0x35fc('0x9b')]=_0x26bc22[_0x35fc('0x33')]({'plain':!![]});_0x3e7663[_0x35fc('0x9b')][_0x35fc('0x9c')]=![];if(_0xe7663b){if(_0x3e7663[_0x35fc('0x7a')][_0x35fc('0x9d')]){_0x3e7663[_0x35fc('0x7b')][_0x35fc('0x9e')]({'id':0x0,'priority':_0x3e7663[_0x35fc('0x7b')][_0x35fc('0x45')]+0x1,'app':_0x35fc('0x9f'),'appdata':_0x35fc('0xa0'),'interval':_0x35fc('0xa1')});}_0x3e7663[_0x35fc('0x9b')][_0x35fc('0x9c')]=!![];}return db[_0x35fc('0xa2')][_0x35fc('0x56')]({'phone':_0x3e7663[_0x35fc('0x57')]['from'],'messageId':_0x3e7663[_0x35fc('0x57')][_0x35fc('0x89')],'body':_0x3e7663[_0x35fc('0x57')][_0x35fc('0x57')],'WhatsappAccountId':_0x7b98b0[_0x35fc('0x53')]['id'],'WhatsappInteractionId':_0x26bc22['id'],'direction':'in','ContactId':_0x26bc22['ContactId'],'AttachmentId':_0x3e7663[_0x35fc('0x57')]['AttachmentId']});})[_0x35fc('0x1d')](function(_0x156c24){_0x3e7663[_0x35fc('0x24')]=_0x156c24;if(_0x3e7663[_0x35fc('0x9b')][_0x35fc('0xa3')]){return db[_0x35fc('0xa4')][_0x35fc('0x55')]({'attributes':['id',_0x35fc('0x37')],'where':{'id':_0x3e7663[_0x35fc('0x9b')][_0x35fc('0xa3')]}})[_0x35fc('0x1d')](function(_0x1ef246){if(_0x1ef246){_0x3e7663[_0x35fc('0x7b')][_0x35fc('0xa5')]({'id':0x0,'priority':0x0,'app':_0x35fc('0xa6'),'appdata':_0x1ef246[_0x35fc('0x37')]+','+(_0x3e7663[_0x35fc('0x7a')][_0x35fc('0xa7')]||0xa),'interval':_0x35fc('0xa1')});}return respondWithRpcPromise(_0x35fc('0xa8'),'startRouting',_0x3e7663);});}return respondWithRpcPromise(_0x35fc('0xa8'),_0x35fc('0xa9'),_0x3e7663);})[_0x35fc('0x1d')](function(_0x47e0c7){if(_0x47e0c7){var _0x19c803=0xc8;var _0x162858='receiveMessage';logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x162858,_0x19c803,_0x35fc('0xaa'));logger[_0x35fc('0x20')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x162858,_0x19c803,_0x35fc('0xaa'),JSON[_0x35fc('0x21')](_0x47e0c7));if(_0x3e7663[_0x35fc('0x7a')][_0x35fc('0x3e')]===_0x35fc('0x85')){return _0x225eb1[_0x35fc('0x27')](_0x19c803)['set'](_0x35fc('0xab'),_0x35fc('0xac'))[_0x35fc('0xad')](_0x35fc('0xae'));}else{return _0x225eb1[_0x35fc('0x27')](_0x19c803)['json'](_0x47e0c7);}}})[_0x35fc('0x26')](handleError(_0x225eb1,null));};exports[_0x35fc('0xad')]=function(_0x52f355,_0x12fc05,_0xa338a4){var _0x22640f,_0x2e3674,_0x158e72;if(_[_0x35fc('0x8b')](_0x52f355[_0x35fc('0x57')][_0x35fc('0x57')])||_0x52f355[_0x35fc('0x57')]['body']===''){throw new db[(_0x35fc('0x8d'))][(_0x35fc('0x8e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x35fc('0x8b')](_0x52f355['body']['to'])){throw new db[(_0x35fc('0x8d'))][(_0x35fc('0x8e'))](_0x35fc('0xaf'));}_0x22640f=_0x52f355[_0x35fc('0x57')]['to'];return db[_0x35fc('0x3b')][_0x35fc('0x55')]({'where':{'id':_0x52f355[_0x35fc('0x53')]['id']},'include':[{'model':db[_0x35fc('0x95')],'as':'List','include':[{'model':db[_0x35fc('0x7e')],'as':'Contacts','where':{'mobile':_0x22640f},'limit':0x1,'order':[[_0x35fc('0x82'),_0x35fc('0x97')]]}]}]})[_0x35fc('0x1d')](handleEntityNotFound(_0x12fc05,null))[_0x35fc('0x1d')](function(_0x1e887d){if(_0x1e887d&&_0x1e887d[_0x35fc('0xb0')]){_0x2e3674=_0x1e887d[_0x35fc('0x33')]({'plain':!![]});if(_0x2e3674[_0x35fc('0xb0')]&&_0x2e3674[_0x35fc('0xb0')][_0x35fc('0x96')][_0x35fc('0x45')]){return _0x2e3674[_0x35fc('0xb0')][_0x35fc('0x96')][0x0];}return db[_0x35fc('0x7e')][_0x35fc('0x56')](_['defaults'](_0x52f355[_0x35fc('0x57')],{'firstName':_0x22640f,'mobile':_0x22640f,'phone':_0x22640f,'ListId':_0x2e3674[_0x35fc('0x84')]}));}})[_0x35fc('0x1d')](handleEntityNotFound(_0x12fc05,null))[_0x35fc('0x1d')](function(_0x40e237){if(_0x40e237){_0x158e72=_0x40e237;return db[_0x35fc('0x9a')][_0x35fc('0x55')]({'where':{'ContactId':_0x158e72['id'],'closed':![],'WhatsappAccountId':_0x2e3674['id']}})['then'](function(_0x4a3036){if(_0x4a3036){return[_0x4a3036,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x52f355[_0x35fc('0xb1')]['id'],'ContactId':_0x158e72['id'],'WhatsappAccountId':_0x2e3674['id'],'phone':_0x22640f,'firstMsgDirection':'out','Messages':[_[_0x35fc('0x4a')](_0x52f355[_0x35fc('0x57')],{'read':![],'body':_0x52f355[_0x35fc('0x57')][_0x35fc('0x57')],'phone':_0x22640f,'WhatsappAccountId':_0x2e3674['id'],'UserId':_0x52f355[_0x35fc('0xb1')]['id'],'ContactId':_0x158e72['id']})]},{'include':[{'model':db[_0x35fc('0xa2')],'as':'Messages'}]})[_0x35fc('0x1d')](function(_0x4f617b){return[_0x4f617b,!![]];});});}})[_0x35fc('0x6e')](function(_0x4cd30d,_0x5e680a){if(_0x5e680a){return _0x4cd30d;}return db[_0x35fc('0xa2')][_0x35fc('0x56')](_[_0x35fc('0x4a')](_0x52f355['body'],{'read':![],'body':_0x52f355['body']['body'],'phone':_0x22640f,'WhatsappAccountId':_0x2e3674['id'],'WhatsappInteractionId':_0x4cd30d['id'],'UserId':_0x52f355['user']['id'],'ContactId':_0x158e72['id']}))[_0x35fc('0x1d')](function(_0x266934){_0x4cd30d[_0x35fc('0xb2')][_0x35fc('0xb3')]=[];_0x4cd30d[_0x35fc('0xb2')][_0x35fc('0xb3')][_0x35fc('0x9e')](_0x266934[_0x35fc('0xb2')]);return _0x4cd30d;});})[_0x35fc('0x1d')](respondWithResult(_0x12fc05,null))['catch'](handleError(_0x12fc05,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 2424956..68e962d 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 _0x236d=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0x236d,0x7e));var _0xd236=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x236d[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xd236('0x0'));var WhatsappAccount=require(_0xd236('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xd236('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd236('0x3'),'afterDestroy':_0xd236('0x4')};function emitEvent(_0x22533a){return function(_0x17ebae,_0x52cdc5,_0x56bc88){WhatsappAccountEvents[_0xd236('0x5')](_0x22533a+':'+_0x17ebae['id'],_0x17ebae);WhatsappAccountEvents[_0xd236('0x5')](_0x22533a,_0x17ebae);_0x56bc88(null);};}for(var e in events){if(events[_0xd236('0x6')](e)){var event=events[e];WhatsappAccount[_0xd236('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xd117=['exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0xd117,0x182));var _0x7d11=function(_0x2bda14,_0x4fab1b){_0x2bda14=_0x2bda14-0x0;var _0xb5dd49=_0xd117[_0x2bda14];return _0xb5dd49;};'use strict';var EventEmitter=require(_0x7d11('0x0'));var WhatsappAccount=require(_0x7d11('0x1'))['db'][_0x7d11('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7d11('0x3')](0x0);var events={'afterCreate':_0x7d11('0x4'),'afterUpdate':_0x7d11('0x5'),'afterDestroy':_0x7d11('0x6')};function emitEvent(_0x254bb4){return function(_0x3c07be,_0x31fcb0,_0x589c51){WhatsappAccountEvents[_0x7d11('0x7')](_0x254bb4+':'+_0x3c07be['id'],_0x3c07be);WhatsappAccountEvents[_0x7d11('0x7')](_0x254bb4,_0x3c07be);_0x589c51(null);};}for(var e in events){if(events[_0x7d11('0x8')](e)){var event=events[e];WhatsappAccount[_0x7d11('0x9')](e,emitEvent(event));}}module[_0x7d11('0xa')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 1928c11..0708b77 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 _0x81a8=['./whatsappAccount.attributes','exports','define','WhatsappAccount','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1d61de,_0x2a303d){var _0x446d8f=function(_0xee1c0d){while(--_0xee1c0d){_0x1d61de['push'](_0x1d61de['shift']());}};_0x446d8f(++_0x2a303d);}(_0x81a8,0x1e8));var _0x881a=function(_0xe3a46,_0x4f9273){_0xe3a46=_0xe3a46-0x0;var _0x5bb333=_0x81a8[_0xe3a46];return _0x5bb333;};'use strict';var _=require('lodash');var util=require(_0x881a('0x0'));var logger=require('../../config/logger')(_0x881a('0x1'));var moment=require(_0x881a('0x2'));var BPromise=require(_0x881a('0x3'));var rp=require(_0x881a('0x4'));var fs=require('fs');var path=require(_0x881a('0x5'));var rimraf=require(_0x881a('0x6'));var config=require('../../config/environment');var attributes=require(_0x881a('0x7'));module[_0x881a('0x8')]=function(_0xa2b23c,_0x45601d){return _0xa2b23c[_0x881a('0x9')](_0x881a('0xa'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe97=['bluebird','request-promise','path','../../config/environment','exports','define','WhatsappAccount','lodash','../../config/logger','api','moment'];(function(_0x1ecfbc,_0x597a77){var _0x5e1f90=function(_0x5e7c33){while(--_0x5e7c33){_0x1ecfbc['push'](_0x1ecfbc['shift']());}};_0x5e1f90(++_0x597a77);}(_0xfe97,0x193));var _0x7fe9=function(_0x55da94,_0x46c123){_0x55da94=_0x55da94-0x0;var _0x3abfd6=_0xfe97[_0x55da94];return _0x3abfd6;};'use strict';var _=require(_0x7fe9('0x0'));var util=require('util');var logger=require(_0x7fe9('0x1'))(_0x7fe9('0x2'));var moment=require(_0x7fe9('0x3'));var BPromise=require(_0x7fe9('0x4'));var rp=require(_0x7fe9('0x5'));var fs=require('fs');var path=require(_0x7fe9('0x6'));var rimraf=require('rimraf');var config=require(_0x7fe9('0x7'));var attributes=require('./whatsappAccount.attributes');module[_0x7fe9('0x8')]=function(_0x587735,_0x315b4d){return _0x587735[_0x7fe9('0x9')](_0x7fe9('0xa'),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 e9d97c4..2df034d 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 _0xf998=['attributes','map','then','util','randomstring','ioredis','../../mysqldb','rpc','client','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','find','options','where','include','model'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf998,0x7b));var _0x8f99=function(_0x223a7c,_0x11ebdc){_0x223a7c=_0x223a7c-0x0;var _0x22e78a=_0xf998[_0x223a7c];return _0x22e78a;};'use strict';var _=require('lodash');var util=require(_0x8f99('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8f99('0x1'));var fs=require('fs');var Redis=require(_0x8f99('0x2'));var db=require(_0x8f99('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8f99('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8f99('0x5')]['http']({'port':0x232a});config[_0x8f99('0x6')]=_[_0x8f99('0x7')](config[_0x8f99('0x6')],{'host':_0x8f99('0x8'),'port':0x18eb});var socket=require(_0x8f99('0x9'))(new Redis(config['redis']));require(_0x8f99('0xa'))['register'](socket);function respondWithRpcPromise(_0x3e93e6,_0x58dd00,_0x589d48){return new BPromise(function(_0x36b684,_0x3ed328){return client['request'](_0x3e93e6,_0x589d48)['then'](function(_0x299ab0){logger[_0x8f99('0xb')](_0x8f99('0xc'),_0x58dd00,_0x8f99('0xd'));logger['debug'](_0x8f99('0xe'),_0x58dd00,_0x8f99('0xd'),JSON[_0x8f99('0xf')](_0x299ab0));if(_0x299ab0['error']){if(_0x299ab0[_0x8f99('0x10')][_0x8f99('0x11')]===0x1f4){logger[_0x8f99('0x10')](_0x8f99('0xc'),_0x58dd00,_0x299ab0[_0x8f99('0x10')]['message']);return _0x3ed328(_0x299ab0[_0x8f99('0x10')]['message']);}logger[_0x8f99('0x10')](_0x8f99('0xc'),_0x58dd00,_0x299ab0[_0x8f99('0x10')][_0x8f99('0x12')]);return _0x36b684(_0x299ab0[_0x8f99('0x10')][_0x8f99('0x12')]);}else{logger[_0x8f99('0xb')](_0x8f99('0xc'),_0x58dd00,_0x8f99('0xd'));_0x36b684(_0x299ab0[_0x8f99('0x13')][_0x8f99('0x12')]);}})[_0x8f99('0x14')](function(_0x3f7167){logger[_0x8f99('0x10')](_0x8f99('0xc'),_0x58dd00,_0x3f7167);_0x3ed328(_0x3f7167);});});}exports[_0x8f99('0x15')]=function(_0x54f268){var _0x14443f=this;return new Promise(function(_0x19dff6,_0x5695b7){return db['WhatsappAccount'][_0x8f99('0x16')]({'raw':_0x54f268[_0x8f99('0x17')]?_0x54f268[_0x8f99('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x54f268['options']?_0x54f268[_0x8f99('0x17')][_0x8f99('0x18')]||null:null,'attributes':_0x54f268[_0x8f99('0x17')]?_0x54f268[_0x8f99('0x17')]['attributes']||null:null,'include':_0x54f268['options']?_0x54f268[_0x8f99('0x17')][_0x8f99('0x19')]?_['map'](_0x54f268[_0x8f99('0x17')][_0x8f99('0x19')],function(_0x417735){return{'model':db[_0x417735[_0x8f99('0x1a')]],'as':_0x417735['as'],'attributes':_0x417735[_0x8f99('0x1b')],'include':_0x417735[_0x8f99('0x19')]?_[_0x8f99('0x1c')](_0x417735[_0x8f99('0x19')],function(_0x1b6aa6){return{'model':db[_0x1b6aa6[_0x8f99('0x1a')]],'as':_0x1b6aa6['as'],'attributes':_0x1b6aa6[_0x8f99('0x1b')],'include':_0x1b6aa6[_0x8f99('0x19')]?_[_0x8f99('0x1c')](_0x1b6aa6[_0x8f99('0x19')],function(_0x2903f7){return{'model':db[_0x2903f7[_0x8f99('0x1a')]],'as':_0x2903f7['as'],'attributes':_0x2903f7[_0x8f99('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8f99('0x1d')](function(_0x443229){logger['info'](_0x8f99('0x15'),_0x54f268);logger['debug'](_0x8f99('0x15'),_0x54f268,JSON['stringify'](_0x443229));_0x19dff6(_0x443229);})[_0x8f99('0x14')](function(_0x16f9c9){logger['error'](_0x8f99('0x15'),_0x16f9c9[_0x8f99('0x12')],_0x54f268);_0x5695b7(_0x14443f[_0x8f99('0x10')](0x1f4,_0x16f9c9[_0x8f99('0x12')]));});});}; \ No newline at end of file +var _0x3e40=['WhatsappAccount','find','options','raw','where','attributes','map','include','model','then','ShowWhatsappAccount','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x40fbee,_0x268f74){var _0x1d93e8=function(_0x55b3c1){while(--_0x55b3c1){_0x40fbee['push'](_0x40fbee['shift']());}};_0x1d93e8(++_0x268f74);}(_0x3e40,0xef));var _0x03e4=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x3e40[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x03e4('0x0'));var util=require('util');var moment=require(_0x03e4('0x1'));var BPromise=require(_0x03e4('0x2'));var rs=require(_0x03e4('0x3'));var fs=require('fs');var Redis=require(_0x03e4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x03e4('0x5'));var logger=require(_0x03e4('0x6'))('rpc');var config=require(_0x03e4('0x7'));var jayson=require(_0x03e4('0x8'));var client=jayson[_0x03e4('0x9')]['http']({'port':0x232a});config[_0x03e4('0xa')]=_[_0x03e4('0xb')](config[_0x03e4('0xa')],{'host':_0x03e4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x03e4('0xa')]));require(_0x03e4('0xd'))[_0x03e4('0xe')](socket);function respondWithRpcPromise(_0x1360e5,_0x59a690,_0x54e611){return new BPromise(function(_0x3184bd,_0x11eb15){return client[_0x03e4('0xf')](_0x1360e5,_0x54e611)['then'](function(_0x385a13){logger[_0x03e4('0x10')](_0x03e4('0x11'),_0x59a690,_0x03e4('0x12'));logger[_0x03e4('0x13')](_0x03e4('0x14'),_0x59a690,_0x03e4('0x12'),JSON[_0x03e4('0x15')](_0x385a13));if(_0x385a13[_0x03e4('0x16')]){if(_0x385a13[_0x03e4('0x16')][_0x03e4('0x17')]===0x1f4){logger[_0x03e4('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x59a690,_0x385a13[_0x03e4('0x16')][_0x03e4('0x18')]);return _0x11eb15(_0x385a13['error'][_0x03e4('0x18')]);}logger['error'](_0x03e4('0x11'),_0x59a690,_0x385a13[_0x03e4('0x16')][_0x03e4('0x18')]);return _0x3184bd(_0x385a13[_0x03e4('0x16')][_0x03e4('0x18')]);}else{logger[_0x03e4('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x59a690,'request\x20sent');_0x3184bd(_0x385a13[_0x03e4('0x19')][_0x03e4('0x18')]);}})[_0x03e4('0x1a')](function(_0x3c88ec){logger['error'](_0x03e4('0x11'),_0x59a690,_0x3c88ec);_0x11eb15(_0x3c88ec);});});}exports['ShowWhatsappAccount']=function(_0x2a69a4){var _0x14d160=this;return new Promise(function(_0x52a2a4,_0x5a85f2){return db[_0x03e4('0x1b')][_0x03e4('0x1c')]({'raw':_0x2a69a4[_0x03e4('0x1d')]?_0x2a69a4[_0x03e4('0x1d')][_0x03e4('0x1e')]===undefined?!![]:![]:!![],'where':_0x2a69a4[_0x03e4('0x1d')]?_0x2a69a4['options'][_0x03e4('0x1f')]||null:null,'attributes':_0x2a69a4[_0x03e4('0x1d')]?_0x2a69a4['options'][_0x03e4('0x20')]||null:null,'include':_0x2a69a4[_0x03e4('0x1d')]?_0x2a69a4[_0x03e4('0x1d')]['include']?_[_0x03e4('0x21')](_0x2a69a4[_0x03e4('0x1d')][_0x03e4('0x22')],function(_0x1dfab6){return{'model':db[_0x1dfab6[_0x03e4('0x23')]],'as':_0x1dfab6['as'],'attributes':_0x1dfab6['attributes'],'include':_0x1dfab6[_0x03e4('0x22')]?_[_0x03e4('0x21')](_0x1dfab6[_0x03e4('0x22')],function(_0x2c1d47){return{'model':db[_0x2c1d47[_0x03e4('0x23')]],'as':_0x2c1d47['as'],'attributes':_0x2c1d47['attributes'],'include':_0x2c1d47['include']?_[_0x03e4('0x21')](_0x2c1d47[_0x03e4('0x22')],function(_0x505493){return{'model':db[_0x505493[_0x03e4('0x23')]],'as':_0x505493['as'],'attributes':_0x505493[_0x03e4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x03e4('0x24')](function(_0x5f2d63){logger[_0x03e4('0x10')](_0x03e4('0x25'),_0x2a69a4);logger[_0x03e4('0x13')](_0x03e4('0x25'),_0x2a69a4,JSON['stringify'](_0x5f2d63));_0x52a2a4(_0x5f2d63);})[_0x03e4('0x1a')](function(_0x84fe53){logger[_0x03e4('0x16')](_0x03e4('0x25'),_0x84fe53['message'],_0x2a69a4);_0x5a85f2(_0x14d160['error'](0x1f4,_0x84fe53[_0x03e4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index e9b7519..3b10b97 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 _0xbf76=['remove','update','register'];(function(_0x4854e7,_0x1417ac){var _0x566370=function(_0x2ccba2){while(--_0x2ccba2){_0x4854e7['push'](_0x4854e7['shift']());}};_0x566370(++_0x1417ac);}(_0xbf76,0x147));var _0x6bf7=function(_0x32c37e,_0x36bbe2){_0x32c37e=_0x32c37e-0x0;var _0x5dffd5=_0xbf76[_0x32c37e];return _0x5dffd5;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0x6bf7('0x0'),_0x6bf7('0x1')];function createListener(_0x1e5df4,_0xbec10a){return function(_0x3214cc){_0xbec10a['emit'](_0x1e5df4,_0x3214cc);};}function removeListener(_0x88f69f,_0x2d8f5e){return function(){WhatsappAccountEvents['removeListener'](_0x88f69f,_0x2d8f5e);};}exports[_0x6bf7('0x2')]=function(_0x1a6f1d){for(var _0x292250=0x0,_0x3727a9=events['length'];_0x292250<_0x3727a9;_0x292250++){var _0x32cff4=events[_0x292250];var _0x4a135b=createListener('whatsappAccount:'+_0x32cff4,_0x1a6f1d);WhatsappAccountEvents['on'](_0x32cff4,_0x4a135b);}}; \ No newline at end of file +var _0xe24d=['remove','removeListener','register','./whatsappAccount.events','save'];(function(_0x32d312,_0xf9cd19){var _0x11b740=function(_0x701726){while(--_0x701726){_0x32d312['push'](_0x32d312['shift']());}};_0x11b740(++_0xf9cd19);}(_0xe24d,0xa8));var _0xde24=function(_0xf11cf2,_0x11fa1d){_0xf11cf2=_0xf11cf2-0x0;var _0x548494=_0xe24d[_0xf11cf2];return _0x548494;};'use strict';var WhatsappAccountEvents=require(_0xde24('0x0'));var events=[_0xde24('0x1'),_0xde24('0x2'),'update'];function createListener(_0x24cefe,_0x323fc1){return function(_0x4b79fd){_0x323fc1['emit'](_0x24cefe,_0x4b79fd);};}function removeListener(_0x892e3d,_0x582f2a){return function(){WhatsappAccountEvents[_0xde24('0x3')](_0x892e3d,_0x582f2a);};}exports[_0xde24('0x4')]=function(_0x33d07c){for(var _0x48dd98=0x0,_0x48d02f=events['length'];_0x48dd98<_0x48d02f;_0x48dd98++){var _0x54538a=events[_0x48dd98];var _0x51de4d=createListener('whatsappAccount:'+_0x54538a,_0x33d07c);WhatsappAccountEvents['on'](_0x54538a,_0x51de4d);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 30f60ff..26294a8 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 _0x43dd=['../../config/environment','get','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','path','express','Router','../../components/interaction/service'];(function(_0x306761,_0x64a5f3){var _0x4c1335=function(_0x42db54){while(--_0x42db54){_0x306761['push'](_0x306761['shift']());}};_0x4c1335(++_0x64a5f3);}(_0x43dd,0x1cd));var _0xd43d=function(_0x11d87c,_0x19a20){_0x11d87c=_0x11d87c-0x0;var _0x528a60=_0x43dd[_0x11d87c];return _0x528a60;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd43d('0x0'));var timeout=require('connect-timeout');var express=require(_0xd43d('0x1'));var router=express[_0xd43d('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd43d('0x3'));var config=require(_0xd43d('0x4'));var controller=require('./whatsappApplication.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd43d('0x5')](_0xd43d('0x6'),auth['isAuthenticated'](),controller[_0xd43d('0x7')]);router[_0xd43d('0x8')]('/',auth[_0xd43d('0x9')](),controller[_0xd43d('0xa')]);router[_0xd43d('0xb')](_0xd43d('0x6'),auth[_0xd43d('0x9')](),controller[_0xd43d('0xc')]);router[_0xd43d('0xd')](_0xd43d('0x6'),auth[_0xd43d('0x9')](),controller[_0xd43d('0xe')]);module['exports']=router; \ No newline at end of file +var _0xa2d3=['show','post','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x323ead,_0x522f8a){var _0x492f54=function(_0x112b5a){while(--_0x112b5a){_0x323ead['push'](_0x323ead['shift']());}};_0x492f54(++_0x522f8a);}(_0xa2d3,0x138));var _0x3a2d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa2d3[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3a2d('0x0'));var timeout=require(_0x3a2d('0x1'));var express=require(_0x3a2d('0x2'));var router=express[_0x3a2d('0x3')]();var fs_extra=require(_0x3a2d('0x4'));var auth=require(_0x3a2d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3a2d('0x6'));var controller=require(_0x3a2d('0x7'));router[_0x3a2d('0x8')]('/',auth[_0x3a2d('0x9')](),controller[_0x3a2d('0xa')]);router[_0x3a2d('0x8')](_0x3a2d('0xb'),auth[_0x3a2d('0x9')](),controller[_0x3a2d('0xc')]);router[_0x3a2d('0xd')]('/',auth[_0x3a2d('0x9')](),controller['create']);router[_0x3a2d('0xe')](_0x3a2d('0xb'),auth['isAuthenticated'](),controller[_0x3a2d('0xf')]);router[_0x3a2d('0x10')](_0x3a2d('0xb'),auth[_0x3a2d('0x9')](),controller['destroy']);module[_0x3a2d('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 051a53f..07b90ed 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 _0x644f=['TEXT','STRING','*,*,*,*','exports','INTEGER','noop'];(function(_0x5a1c5f,_0x776c27){var _0x1e5374=function(_0x5d8a1a){while(--_0x5d8a1a){_0x5a1c5f['push'](_0x5a1c5f['shift']());}};_0x1e5374(++_0x776c27);}(_0x644f,0x129));var _0xf644=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0x644f[_0x318840];return _0x223da4;};'use strict';var Sequelize=require('sequelize');module[_0xf644('0x0')]={'priority':{'type':Sequelize[_0xf644('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf644('0x2')},'appdata':{'type':Sequelize[_0xf644('0x3')]()},'description':{'type':Sequelize[_0xf644('0x4')]},'interval':{'type':Sequelize[_0xf644('0x4')],'defaultValue':_0xf644('0x5')}}; \ No newline at end of file +var _0xb00a=['exports','STRING','noop','*,*,*,*','sequelize'];(function(_0x3a3fcc,_0x38afb3){var _0xe16438=function(_0x2280b4){while(--_0x2280b4){_0x3a3fcc['push'](_0x3a3fcc['shift']());}};_0xe16438(++_0x38afb3);}(_0xb00a,0x9f));var _0xab00=function(_0x4f8ba7,_0x8cf44c){_0x4f8ba7=_0x4f8ba7-0x0;var _0x5a28f6=_0xb00a[_0x4f8ba7];return _0x5a28f6;};'use strict';var Sequelize=require(_0xab00('0x0'));module[_0xab00('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xab00('0x2')],'allowNull':![],'defaultValue':_0xab00('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xab00('0x2')]},'interval':{'type':Sequelize[_0xab00('0x2')],'defaultValue':_0xab00('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index c5122ec..7a880ff 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 _0x40be=['util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','Content-Range','json','reject','save','update','destroy','sendStatus','error','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','then','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x576ee4,_0x3e14d7){var _0x5acc68=function(_0x26f1f1){while(--_0x26f1f1){_0x576ee4['push'](_0x576ee4['shift']());}};_0x5acc68(++_0x3e14d7);}(_0x40be,0xde));var _0xe40b=function(_0x2ea451,_0x48f0a5){_0x2ea451=_0x2ea451-0x0;var _0x2d4c97=_0x40be[_0x2ea451];return _0x2d4c97;};'use strict';var emlformat=require(_0xe40b('0x0'));var rimraf=require(_0xe40b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe40b('0x2'));var rp=require(_0xe40b('0x3'));var moment=require('moment');var BPromise=require(_0xe40b('0x4'));var Mustache=require(_0xe40b('0x5'));var util=require(_0xe40b('0x6'));var path=require(_0xe40b('0x7'));var sox=require(_0xe40b('0x8'));var csv=require(_0xe40b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe40b('0xa'));var _=require(_0xe40b('0xb'));var squel=require(_0xe40b('0xc'));var crypto=require(_0xe40b('0xd'));var jsforce=require(_0xe40b('0xe'));var deskjs=require(_0xe40b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe40b('0x10'));var Papa=require(_0xe40b('0x11'));var Redis=require(_0xe40b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe40b('0x13'));var as=require(_0xe40b('0x14'));var hardwareService=require(_0xe40b('0x15'));var logger=require(_0xe40b('0x16'))(_0xe40b('0x17'));var utils=require(_0xe40b('0x18'));var config=require(_0xe40b('0x19'));var licenseUtil=require(_0xe40b('0x1a'));var db=require(_0xe40b('0x1b'))['db'];function respondWithStatusCode(_0x4a1405,_0x2389cc){_0x2389cc=_0x2389cc||0xcc;return function(_0x10a323){if(_0x10a323){return _0x4a1405['sendStatus'](_0x2389cc);}return _0x4a1405[_0xe40b('0x1c')](_0x2389cc)[_0xe40b('0x1d')]();};}function respondWithResult(_0x397422,_0x332303){_0x332303=_0x332303||0xc8;return function(_0x11b291){if(_0x11b291){return _0x397422[_0xe40b('0x1c')](_0x332303)['json'](_0x11b291);}};}function respondWithFilteredResult(_0x24d696,_0xdc3aef){return function(_0x5e7ce3){if(_0x5e7ce3){var _0x376f3b=_0x5e7ce3[_0xe40b('0x1e')],_0x2c5c79=_0xdc3aef[_0xe40b('0x1f')],_0x487b41=_0xdc3aef['offset']+_0xdc3aef[_0xe40b('0x20')],_0x22c0bd;if(_0x487b41>=_0x376f3b){_0x487b41=_0x376f3b;_0x22c0bd=0xc8;}else{_0x22c0bd=0xce;}_0x24d696[_0xe40b('0x1c')](_0x22c0bd);return _0x24d696['set'](_0xe40b('0x21'),_0x2c5c79+'-'+_0x487b41+'/'+_0x376f3b)[_0xe40b('0x22')](_0x5e7ce3);}return null;};}function patchUpdates(_0x3e24a6){return function(_0x18c780){try{jsonpatch['apply'](_0x18c780,_0x3e24a6,!![]);}catch(_0x28075d){return BPromise[_0xe40b('0x23')](_0x28075d);}return _0x18c780[_0xe40b('0x24')]();};}function saveUpdates(_0x477269,_0x472376){return function(_0x33f39e){if(_0x33f39e){return _0x33f39e[_0xe40b('0x25')](_0x477269)['then'](function(_0x135e6c){return _0x135e6c;});}return null;};}function removeEntity(_0x38ec8b,_0x222cb1){return function(_0x10410c){if(_0x10410c){return _0x10410c[_0xe40b('0x26')]()['then'](function(){_0x38ec8b[_0xe40b('0x1c')](0xcc)[_0xe40b('0x1d')]();});}};}function handleEntityNotFound(_0x172e61,_0x5c292e){return function(_0x3ca9b1){if(!_0x3ca9b1){_0x172e61[_0xe40b('0x27')](0x194);}return _0x3ca9b1;};}function handleError(_0x14d2f5,_0x15b6cb){_0x15b6cb=_0x15b6cb||0x1f4;return function(_0x1d4a24){logger[_0xe40b('0x28')](_0x1d4a24['stack']);if(_0x1d4a24[_0xe40b('0x29')]){delete _0x1d4a24['name'];}_0x14d2f5[_0xe40b('0x1c')](_0x15b6cb)[_0xe40b('0x2a')](_0x1d4a24);};}exports[_0xe40b('0x2b')]=function(_0x4d7f72,_0x22d171){var _0x413742={},_0x212e39={},_0x4714c7={'count':0x0,'rows':[]};var _0x4fa31f=_[_0xe40b('0x2c')](db[_0xe40b('0x2d')][_0xe40b('0x2e')],function(_0x4e01fe){return{'name':_0x4e01fe[_0xe40b('0x2f')],'type':_0x4e01fe[_0xe40b('0x30')]['key']};});_0x212e39[_0xe40b('0x31')]=_[_0xe40b('0x2c')](_0x4fa31f,_0xe40b('0x29'));_0x212e39[_0xe40b('0x32')]=_[_0xe40b('0x33')](_0x4d7f72[_0xe40b('0x32')]);_0x212e39[_0xe40b('0x34')]=_[_0xe40b('0x35')](_0x212e39[_0xe40b('0x31')],_0x212e39[_0xe40b('0x32')]);_0x413742[_0xe40b('0x36')]=_[_0xe40b('0x35')](_0x212e39[_0xe40b('0x31')],qs[_0xe40b('0x37')](_0x4d7f72[_0xe40b('0x32')]['fields']));_0x413742[_0xe40b('0x36')]=_0x413742['attributes'][_0xe40b('0x38')]?_0x413742['attributes']:_0x212e39[_0xe40b('0x31')];if(!_0x4d7f72[_0xe40b('0x32')]['hasOwnProperty'](_0xe40b('0x39'))){_0x413742[_0xe40b('0x20')]=qs[_0xe40b('0x20')](_0x4d7f72[_0xe40b('0x32')][_0xe40b('0x20')]);_0x413742[_0xe40b('0x1f')]=qs[_0xe40b('0x1f')](_0x4d7f72[_0xe40b('0x32')][_0xe40b('0x1f')]);}_0x413742[_0xe40b('0x3a')]=qs[_0xe40b('0x3b')](_0x4d7f72[_0xe40b('0x32')]['sort']);_0x413742[_0xe40b('0x3c')]=qs['filters'](_[_0xe40b('0x3d')](_0x4d7f72[_0xe40b('0x32')],_0x212e39[_0xe40b('0x34')]),_0x4fa31f);if(_0x4d7f72[_0xe40b('0x32')]['filter']){_0x413742[_0xe40b('0x3c')]=_['merge'](_0x413742[_0xe40b('0x3c')],{'$or':_[_0xe40b('0x2c')](_0x4fa31f,function(_0x1c78d8){if(_0x1c78d8[_0xe40b('0x30')]!=='VIRTUAL'){var _0x5a7a95={};_0x5a7a95[_0x1c78d8[_0xe40b('0x29')]]={'$like':'%'+_0x4d7f72[_0xe40b('0x32')][_0xe40b('0x3e')]+'%'};return _0x5a7a95;}})});}_0x413742=_[_0xe40b('0x3f')]({},_0x413742,_0x4d7f72[_0xe40b('0x40')]);var _0x12f885={'where':_0x413742[_0xe40b('0x3c')]};return db[_0xe40b('0x2d')][_0xe40b('0x1e')](_0x12f885)[_0xe40b('0x41')](function(_0x416bdf){_0x4714c7[_0xe40b('0x1e')]=_0x416bdf;if(_0x4d7f72[_0xe40b('0x32')][_0xe40b('0x42')]){_0x413742[_0xe40b('0x43')]=[{'all':!![]}];}return db[_0xe40b('0x2d')][_0xe40b('0x44')](_0x413742);})['then'](function(_0x5b3c45){_0x4714c7[_0xe40b('0x45')]=_0x5b3c45;return _0x4714c7;})['then'](respondWithFilteredResult(_0x22d171,_0x413742))['catch'](handleError(_0x22d171,null));};exports[_0xe40b('0x46')]=function(_0x57c5b7,_0x109d30){var _0xc79aca={'raw':!![],'where':{'id':_0x57c5b7[_0xe40b('0x47')]['id']}},_0x14a384={};_0x14a384['model']=_[_0xe40b('0x33')](db[_0xe40b('0x2d')][_0xe40b('0x2e')]);_0x14a384['query']=_[_0xe40b('0x33')](_0x57c5b7[_0xe40b('0x32')]);_0x14a384[_0xe40b('0x34')]=_[_0xe40b('0x35')](_0x14a384[_0xe40b('0x31')],_0x14a384[_0xe40b('0x32')]);_0xc79aca[_0xe40b('0x36')]=_[_0xe40b('0x35')](_0x14a384[_0xe40b('0x31')],qs[_0xe40b('0x37')](_0x57c5b7[_0xe40b('0x32')][_0xe40b('0x37')]));_0xc79aca[_0xe40b('0x36')]=_0xc79aca[_0xe40b('0x36')][_0xe40b('0x38')]?_0xc79aca[_0xe40b('0x36')]:_0x14a384[_0xe40b('0x31')];if(_0x57c5b7[_0xe40b('0x32')][_0xe40b('0x42')]){_0xc79aca[_0xe40b('0x43')]=[{'all':!![]}];}_0xc79aca=_[_0xe40b('0x3f')]({},_0xc79aca,_0x57c5b7[_0xe40b('0x40')]);return db[_0xe40b('0x2d')][_0xe40b('0x48')](_0xc79aca)[_0xe40b('0x41')](handleEntityNotFound(_0x109d30,null))[_0xe40b('0x41')](respondWithResult(_0x109d30,null))[_0xe40b('0x49')](handleError(_0x109d30,null));};exports[_0xe40b('0x4a')]=function(_0x3d66e9,_0x59a4ef){return db[_0xe40b('0x2d')]['create'](_0x3d66e9[_0xe40b('0x4b')],{})[_0xe40b('0x41')](respondWithResult(_0x59a4ef,0xc9))['catch'](handleError(_0x59a4ef,null));};exports['update']=function(_0x1ccd77,_0x438e57){if(_0x1ccd77[_0xe40b('0x4b')]['id']){delete _0x1ccd77['body']['id'];}return db[_0xe40b('0x2d')]['find']({'where':{'id':_0x1ccd77[_0xe40b('0x47')]['id']}})['then'](handleEntityNotFound(_0x438e57,null))['then'](saveUpdates(_0x1ccd77[_0xe40b('0x4b')],null))[_0xe40b('0x41')](respondWithResult(_0x438e57,null))[_0xe40b('0x49')](handleError(_0x438e57,null));};exports[_0xe40b('0x26')]=function(_0x8d9a4f,_0x4d4eb2){return db[_0xe40b('0x2d')][_0xe40b('0x48')]({'where':{'id':_0x8d9a4f['params']['id']}})['then'](handleEntityNotFound(_0x4d4eb2,null))[_0xe40b('0x41')](removeEntity(_0x4d4eb2,null))[_0xe40b('0x49')](handleError(_0x4d4eb2,null));}; \ No newline at end of file +var _0xe69e=['find','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','destroy','then','error','stack','name','send','index','map','WhatsappApplication','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes'];(function(_0x3f5eaf,_0x14521a){var _0x282162=function(_0x274ff8){while(--_0x274ff8){_0x3f5eaf['push'](_0x3f5eaf['shift']());}};_0x282162(++_0x14521a);}(_0xe69e,0x17f));var _0xee69=function(_0x55cc58,_0x5ce0af){_0x55cc58=_0x55cc58-0x0;var _0x26062e=_0xe69e[_0x55cc58];return _0x26062e;};'use strict';var emlformat=require(_0xee69('0x0'));var rimraf=require(_0xee69('0x1'));var zipdir=require(_0xee69('0x2'));var jsonpatch=require(_0xee69('0x3'));var rp=require('request-promise');var moment=require(_0xee69('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xee69('0x5'));var util=require(_0xee69('0x6'));var path=require(_0xee69('0x7'));var sox=require(_0xee69('0x8'));var csv=require(_0xee69('0x9'));var ejs=require(_0xee69('0xa'));var fs=require('fs');var fs_extra=require(_0xee69('0xb'));var _=require(_0xee69('0xc'));var squel=require(_0xee69('0xd'));var crypto=require(_0xee69('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xee69('0xf'));var toCsv=require(_0xee69('0x9'));var querystring=require(_0xee69('0x10'));var Papa=require('papaparse');var Redis=require(_0xee69('0x11'));var authService=require(_0xee69('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xee69('0x13'));var hardwareService=require(_0xee69('0x14'));var logger=require(_0xee69('0x15'))(_0xee69('0x16'));var utils=require(_0xee69('0x17'));var config=require(_0xee69('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xee69('0x19'))['db'];function respondWithStatusCode(_0x35d4c7,_0x660a60){_0x660a60=_0x660a60||0xcc;return function(_0x407a0c){if(_0x407a0c){return _0x35d4c7[_0xee69('0x1a')](_0x660a60);}return _0x35d4c7[_0xee69('0x1b')](_0x660a60)[_0xee69('0x1c')]();};}function respondWithResult(_0x5ac12d,_0x3cfb33){_0x3cfb33=_0x3cfb33||0xc8;return function(_0x40e82e){if(_0x40e82e){return _0x5ac12d[_0xee69('0x1b')](_0x3cfb33)[_0xee69('0x1d')](_0x40e82e);}};}function respondWithFilteredResult(_0x2ee171,_0x2bae50){return function(_0x2d815d){if(_0x2d815d){var _0x14959d=_0x2d815d[_0xee69('0x1e')],_0x45990d=_0x2bae50[_0xee69('0x1f')],_0x22a4ac=_0x2bae50['offset']+_0x2bae50[_0xee69('0x20')],_0x1eb3c7;if(_0x22a4ac>=_0x14959d){_0x22a4ac=_0x14959d;_0x1eb3c7=0xc8;}else{_0x1eb3c7=0xce;}_0x2ee171[_0xee69('0x1b')](_0x1eb3c7);return _0x2ee171[_0xee69('0x21')]('Content-Range',_0x45990d+'-'+_0x22a4ac+'/'+_0x14959d)[_0xee69('0x1d')](_0x2d815d);}return null;};}function patchUpdates(_0x29796c){return function(_0xd5f821){try{jsonpatch[_0xee69('0x22')](_0xd5f821,_0x29796c,!![]);}catch(_0x15bbfe){return BPromise[_0xee69('0x23')](_0x15bbfe);}return _0xd5f821[_0xee69('0x24')]();};}function saveUpdates(_0x3a7628,_0x49e7ea){return function(_0x30d04b){if(_0x30d04b){return _0x30d04b['update'](_0x3a7628)['then'](function(_0x722eb6){return _0x722eb6;});}return null;};}function removeEntity(_0x537fde,_0x6b03c9){return function(_0x4ebfa3){if(_0x4ebfa3){return _0x4ebfa3[_0xee69('0x25')]()[_0xee69('0x26')](function(){_0x537fde['status'](0xcc)[_0xee69('0x1c')]();});}};}function handleEntityNotFound(_0x46e07a,_0xd0b177){return function(_0x100af9){if(!_0x100af9){_0x46e07a[_0xee69('0x1a')](0x194);}return _0x100af9;};}function handleError(_0x38c609,_0x93c74c){_0x93c74c=_0x93c74c||0x1f4;return function(_0x33d7c5){logger[_0xee69('0x27')](_0x33d7c5[_0xee69('0x28')]);if(_0x33d7c5[_0xee69('0x29')]){delete _0x33d7c5[_0xee69('0x29')];}_0x38c609[_0xee69('0x1b')](_0x93c74c)[_0xee69('0x2a')](_0x33d7c5);};}exports[_0xee69('0x2b')]=function(_0x5bc2a0,_0x3d5269){var _0xb1852f={},_0x29b893={},_0x274518={'count':0x0,'rows':[]};var _0x3ad24a=_[_0xee69('0x2c')](db[_0xee69('0x2d')]['rawAttributes'],function(_0x492724){return{'name':_0x492724[_0xee69('0x2e')],'type':_0x492724[_0xee69('0x2f')][_0xee69('0x30')]};});_0x29b893[_0xee69('0x31')]=_[_0xee69('0x2c')](_0x3ad24a,_0xee69('0x29'));_0x29b893[_0xee69('0x32')]=_[_0xee69('0x33')](_0x5bc2a0[_0xee69('0x32')]);_0x29b893['filters']=_[_0xee69('0x34')](_0x29b893[_0xee69('0x31')],_0x29b893[_0xee69('0x32')]);_0xb1852f['attributes']=_[_0xee69('0x34')](_0x29b893[_0xee69('0x31')],qs[_0xee69('0x35')](_0x5bc2a0[_0xee69('0x32')]['fields']));_0xb1852f[_0xee69('0x36')]=_0xb1852f['attributes'][_0xee69('0x37')]?_0xb1852f[_0xee69('0x36')]:_0x29b893['model'];if(!_0x5bc2a0[_0xee69('0x32')]['hasOwnProperty'](_0xee69('0x38'))){_0xb1852f[_0xee69('0x20')]=qs[_0xee69('0x20')](_0x5bc2a0[_0xee69('0x32')]['limit']);_0xb1852f[_0xee69('0x1f')]=qs[_0xee69('0x1f')](_0x5bc2a0[_0xee69('0x32')]['offset']);}_0xb1852f[_0xee69('0x39')]=qs[_0xee69('0x3a')](_0x5bc2a0['query'][_0xee69('0x3a')]);_0xb1852f[_0xee69('0x3b')]=qs[_0xee69('0x3c')](_['pick'](_0x5bc2a0[_0xee69('0x32')],_0x29b893[_0xee69('0x3c')]),_0x3ad24a);if(_0x5bc2a0[_0xee69('0x32')]['filter']){_0xb1852f[_0xee69('0x3b')]=_[_0xee69('0x3d')](_0xb1852f[_0xee69('0x3b')],{'$or':_[_0xee69('0x2c')](_0x3ad24a,function(_0x306db1){if(_0x306db1['type']!==_0xee69('0x3e')){var _0x485a62={};_0x485a62[_0x306db1[_0xee69('0x29')]]={'$like':'%'+_0x5bc2a0[_0xee69('0x32')][_0xee69('0x3f')]+'%'};return _0x485a62;}})});}_0xb1852f=_['merge']({},_0xb1852f,_0x5bc2a0[_0xee69('0x40')]);var _0xa2ddf0={'where':_0xb1852f[_0xee69('0x3b')]};return db[_0xee69('0x2d')]['count'](_0xa2ddf0)[_0xee69('0x26')](function(_0x4d7e28){_0x274518[_0xee69('0x1e')]=_0x4d7e28;if(_0x5bc2a0[_0xee69('0x32')][_0xee69('0x41')]){_0xb1852f[_0xee69('0x42')]=[{'all':!![]}];}return db[_0xee69('0x2d')][_0xee69('0x43')](_0xb1852f);})['then'](function(_0x22b1a1){_0x274518[_0xee69('0x44')]=_0x22b1a1;return _0x274518;})[_0xee69('0x26')](respondWithFilteredResult(_0x3d5269,_0xb1852f))[_0xee69('0x45')](handleError(_0x3d5269,null));};exports[_0xee69('0x46')]=function(_0x662b61,_0x1b8d54){var _0x2b7d47={'raw':!![],'where':{'id':_0x662b61[_0xee69('0x47')]['id']}},_0x1f7623={};_0x1f7623[_0xee69('0x31')]=_[_0xee69('0x33')](db[_0xee69('0x2d')][_0xee69('0x48')]);_0x1f7623['query']=_[_0xee69('0x33')](_0x662b61[_0xee69('0x32')]);_0x1f7623[_0xee69('0x3c')]=_[_0xee69('0x34')](_0x1f7623[_0xee69('0x31')],_0x1f7623[_0xee69('0x32')]);_0x2b7d47[_0xee69('0x36')]=_[_0xee69('0x34')](_0x1f7623[_0xee69('0x31')],qs['fields'](_0x662b61[_0xee69('0x32')][_0xee69('0x35')]));_0x2b7d47[_0xee69('0x36')]=_0x2b7d47[_0xee69('0x36')][_0xee69('0x37')]?_0x2b7d47[_0xee69('0x36')]:_0x1f7623[_0xee69('0x31')];if(_0x662b61['query'][_0xee69('0x41')]){_0x2b7d47['include']=[{'all':!![]}];}_0x2b7d47=_[_0xee69('0x3d')]({},_0x2b7d47,_0x662b61[_0xee69('0x40')]);return db[_0xee69('0x2d')][_0xee69('0x49')](_0x2b7d47)[_0xee69('0x26')](handleEntityNotFound(_0x1b8d54,null))[_0xee69('0x26')](respondWithResult(_0x1b8d54,null))['catch'](handleError(_0x1b8d54,null));};exports['create']=function(_0x1488e7,_0x503615){return db[_0xee69('0x2d')]['create'](_0x1488e7[_0xee69('0x4a')],{})['then'](respondWithResult(_0x503615,0xc9))[_0xee69('0x45')](handleError(_0x503615,null));};exports[_0xee69('0x4b')]=function(_0x382fce,_0x39390b){if(_0x382fce['body']['id']){delete _0x382fce[_0xee69('0x4a')]['id'];}return db['WhatsappApplication'][_0xee69('0x49')]({'where':{'id':_0x382fce['params']['id']}})['then'](handleEntityNotFound(_0x39390b,null))[_0xee69('0x26')](saveUpdates(_0x382fce[_0xee69('0x4a')],null))['then'](respondWithResult(_0x39390b,null))[_0xee69('0x45')](handleError(_0x39390b,null));};exports[_0xee69('0x25')]=function(_0x4becbd,_0x63ccab){return db['WhatsappApplication'][_0xee69('0x49')]({'where':{'id':_0x4becbd[_0xee69('0x47')]['id']}})[_0xee69('0x26')](handleEntityNotFound(_0x63ccab,null))['then'](removeEntity(_0x63ccab,null))[_0xee69('0x45')](handleError(_0x63ccab,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index c7df552..d1cb800 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 _0x9d67=['./whatsappApplication.attributes','define','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xddd222,_0x3e65b0){var _0x24e09d=function(_0x342611){while(--_0x342611){_0xddd222['push'](_0xddd222['shift']());}};_0x24e09d(++_0x3e65b0);}(_0x9d67,0xbb));var _0x79d6=function(_0x22b446,_0xba5413){_0x22b446=_0x22b446-0x0;var _0x40ad0a=_0x9d67[_0x22b446];return _0x40ad0a;};'use strict';var _=require(_0x79d6('0x0'));var util=require(_0x79d6('0x1'));var logger=require(_0x79d6('0x2'))('api');var moment=require(_0x79d6('0x3'));var BPromise=require(_0x79d6('0x4'));var rp=require(_0x79d6('0x5'));var fs=require('fs');var path=require(_0x79d6('0x6'));var rimraf=require(_0x79d6('0x7'));var config=require(_0x79d6('0x8'));var attributes=require(_0x79d6('0x9'));module['exports']=function(_0x558c32,_0x4a9a18){return _0x558c32[_0x79d6('0xa')](_0x79d6('0xb'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x79d6('0xc'),'collate':_0x79d6('0xd')});}; \ No newline at end of file +var _0x62d7=['rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird'];(function(_0x165190,_0x1519f2){var _0x52b9ab=function(_0x29d227){while(--_0x29d227){_0x165190['push'](_0x165190['shift']());}};_0x52b9ab(++_0x1519f2);}(_0x62d7,0xb0));var _0x762d=function(_0x326f4e,_0x3cc979){_0x326f4e=_0x326f4e-0x0;var _0x5c231f=_0x62d7[_0x326f4e];return _0x5c231f;};'use strict';var _=require(_0x762d('0x0'));var util=require('util');var logger=require(_0x762d('0x1'))(_0x762d('0x2'));var moment=require('moment');var BPromise=require(_0x762d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x762d('0x4'));var config=require(_0x762d('0x5'));var attributes=require(_0x762d('0x6'));module[_0x762d('0x7')]=function(_0x231348,_0x48823b){return _0x231348[_0x762d('0x8')](_0x762d('0x9'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x762d('0xa'),'collate':_0x762d('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index ebfc0c9..a3633ec 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 _0x6bdc=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','WhatsappApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6bdc,0x14e));var _0xc6bd=function(_0x58669b,_0x5367d7){_0x58669b=_0x58669b-0x0;var _0x46f846=_0x6bdc[_0x58669b];return _0x46f846;};'use strict';var _=require(_0xc6bd('0x0'));var util=require(_0xc6bd('0x1'));var moment=require(_0xc6bd('0x2'));var BPromise=require(_0xc6bd('0x3'));var rs=require(_0xc6bd('0x4'));var fs=require('fs');var Redis=require(_0xc6bd('0x5'));var db=require(_0xc6bd('0x6'))['db'];var utils=require(_0xc6bd('0x7'));var logger=require(_0xc6bd('0x8'))(_0xc6bd('0x9'));var config=require('../../config/environment');var jayson=require(_0xc6bd('0xa'));var client=jayson[_0xc6bd('0xb')][_0xc6bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f5327,_0x2c1c68,_0x8bd379){return new BPromise(function(_0x5ca385,_0x374067){return client[_0xc6bd('0xd')](_0x3f5327,_0x8bd379)[_0xc6bd('0xe')](function(_0x5e92e8){logger['info'](_0xc6bd('0xf'),_0x2c1c68,'request\x20sent');logger[_0xc6bd('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x2c1c68,_0xc6bd('0x11'),JSON[_0xc6bd('0x12')](_0x5e92e8));if(_0x5e92e8[_0xc6bd('0x13')]){if(_0x5e92e8[_0xc6bd('0x13')][_0xc6bd('0x14')]===0x1f4){logger[_0xc6bd('0x13')](_0xc6bd('0xf'),_0x2c1c68,_0x5e92e8[_0xc6bd('0x13')][_0xc6bd('0x15')]);return _0x374067(_0x5e92e8[_0xc6bd('0x13')][_0xc6bd('0x15')]);}logger[_0xc6bd('0x13')](_0xc6bd('0xf'),_0x2c1c68,_0x5e92e8[_0xc6bd('0x13')]['message']);return _0x5ca385(_0x5e92e8[_0xc6bd('0x13')]['message']);}else{logger['info'](_0xc6bd('0xf'),_0x2c1c68,_0xc6bd('0x11'));_0x5ca385(_0x5e92e8[_0xc6bd('0x16')][_0xc6bd('0x15')]);}})[_0xc6bd('0x17')](function(_0x5795bc){logger['error'](_0xc6bd('0xf'),_0x2c1c68,_0x5795bc);_0x374067(_0x5795bc);});});} \ No newline at end of file +var _0xa786=['moment','randomstring','../../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','request\x20sent','error','code','message','result','catch','lodash','util'];(function(_0x4162ab,_0x5e9fe5){var _0x34dffd=function(_0xb21df9){while(--_0xb21df9){_0x4162ab['push'](_0x4162ab['shift']());}};_0x34dffd(++_0x5e9fe5);}(_0xa786,0x71));var _0x6a78=function(_0x425d02,_0x196b00){_0x425d02=_0x425d02-0x0;var _0x5b8f6d=_0xa786[_0x425d02];return _0x5b8f6d;};'use strict';var _=require(_0x6a78('0x0'));var util=require(_0x6a78('0x1'));var moment=require(_0x6a78('0x2'));var BPromise=require('bluebird');var rs=require(_0x6a78('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6a78('0x4'));var logger=require(_0x6a78('0x5'))(_0x6a78('0x6'));var config=require(_0x6a78('0x7'));var jayson=require(_0x6a78('0x8'));var client=jayson[_0x6a78('0x9')][_0x6a78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dd11b,_0xcd6019,_0x103f4a){return new BPromise(function(_0x23ebbd,_0x30debf){return client[_0x6a78('0xb')](_0x4dd11b,_0x103f4a)[_0x6a78('0xc')](function(_0x1264c6){logger[_0x6a78('0xd')](_0x6a78('0xe'),_0xcd6019,'request\x20sent');logger[_0x6a78('0xf')](_0x6a78('0x10'),_0xcd6019,_0x6a78('0x11'),JSON['stringify'](_0x1264c6));if(_0x1264c6[_0x6a78('0x12')]){if(_0x1264c6[_0x6a78('0x12')][_0x6a78('0x13')]===0x1f4){logger[_0x6a78('0x12')](_0x6a78('0xe'),_0xcd6019,_0x1264c6['error'][_0x6a78('0x14')]);return _0x30debf(_0x1264c6[_0x6a78('0x12')][_0x6a78('0x14')]);}logger['error'](_0x6a78('0xe'),_0xcd6019,_0x1264c6[_0x6a78('0x12')]['message']);return _0x23ebbd(_0x1264c6[_0x6a78('0x12')][_0x6a78('0x14')]);}else{logger[_0x6a78('0xd')](_0x6a78('0xe'),_0xcd6019,_0x6a78('0x11'));_0x23ebbd(_0x1264c6[_0x6a78('0x15')]['message']);}})[_0x6a78('0x16')](function(_0x122362){logger[_0x6a78('0x12')](_0x6a78('0xe'),_0xcd6019,_0x122362);_0x30debf(_0x122362);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 9e272fc..38e88d3 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 _0xb704=['multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','describe','show','getMessages','/:id/download','download','create','/:id/messages','post','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','/:id','update','delete','whatsappinteraction:destroy','destroy','exports'];(function(_0x53e3fa,_0x50c5f2){var _0xe8584a=function(_0x1771a5){while(--_0x1771a5){_0x53e3fa['push'](_0x53e3fa['shift']());}};_0xe8584a(++_0x50c5f2);}(_0xb704,0xae));var _0x4b70=function(_0x2261c5,_0x5f1af4){_0x2261c5=_0x2261c5-0x0;var _0x3552fd=_0xb704[_0x2261c5];return _0x3552fd;};'use strict';var multer=require(_0x4b70('0x0'));var util=require(_0x4b70('0x1'));var path=require('path');var timeout=require(_0x4b70('0x2'));var express=require(_0x4b70('0x3'));var router=express[_0x4b70('0x4')]();var fs_extra=require(_0x4b70('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4b70('0x6'));var controller=require('./whatsappInteraction.controller');router[_0x4b70('0x7')]('/',auth[_0x4b70('0x8')](),controller[_0x4b70('0x9')]);router[_0x4b70('0x7')](_0x4b70('0xa'),auth['isAuthenticated'](),controller[_0x4b70('0xb')]);router[_0x4b70('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4b70('0xc')]);router['get']('/:id/messages',auth[_0x4b70('0x8')](),controller[_0x4b70('0xd')]);router[_0x4b70('0x7')](_0x4b70('0xe'),auth[_0x4b70('0x8')](),controller[_0x4b70('0xf')]);router['post']('/',auth[_0x4b70('0x8')](),controller[_0x4b70('0x10')]);router['post'](_0x4b70('0x11'),auth[_0x4b70('0x8')](),controller['addMessage']);router[_0x4b70('0x12')](_0x4b70('0x13'),auth[_0x4b70('0x8')](),interaction[_0x4b70('0x14')](_0x4b70('0x15'),_0x4b70('0x16')),controller['addTags']);router['put'](_0x4b70('0x17'),auth[_0x4b70('0x8')](),interaction[_0x4b70('0x14')]('whatsapp','whatsappinteraction:update'),controller[_0x4b70('0x18')]);router[_0x4b70('0x19')](_0x4b70('0x17'),auth[_0x4b70('0x8')](),interaction[_0x4b70('0x14')](_0x4b70('0x15'),_0x4b70('0x1a')),controller[_0x4b70('0x1b')]);router[_0x4b70('0x19')](_0x4b70('0x13'),auth['isAuthenticated'](),controller['removeTags']);module[_0x4b70('0x1c')]=router; \ No newline at end of file +var _0xcac9=['put','whatsapp','whatsappinteraction:update','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','download','create','post','addMessage','/:id/tags','tracked','addTags'];(function(_0x3f35f3,_0x406e05){var _0x1718ec=function(_0x52c27b){while(--_0x52c27b){_0x3f35f3['push'](_0x3f35f3['shift']());}};_0x1718ec(++_0x406e05);}(_0xcac9,0x162));var _0x9cac=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0xcac9[_0x383356];return _0x32ee5a;};'use strict';var multer=require(_0x9cac('0x0'));var util=require(_0x9cac('0x1'));var path=require(_0x9cac('0x2'));var timeout=require(_0x9cac('0x3'));var express=require(_0x9cac('0x4'));var router=express[_0x9cac('0x5')]();var fs_extra=require(_0x9cac('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9cac('0x7'));var config=require(_0x9cac('0x8'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth[_0x9cac('0x9')](),controller[_0x9cac('0xa')]);router[_0x9cac('0xb')](_0x9cac('0xc'),auth[_0x9cac('0x9')](),controller[_0x9cac('0xd')]);router['get'](_0x9cac('0xe'),auth[_0x9cac('0x9')](),controller['show']);router[_0x9cac('0xb')](_0x9cac('0xf'),auth[_0x9cac('0x9')](),controller['getMessages']);router[_0x9cac('0xb')]('/:id/download',auth['isAuthenticated'](),controller[_0x9cac('0x10')]);router['post']('/',auth[_0x9cac('0x9')](),controller[_0x9cac('0x11')]);router[_0x9cac('0x12')](_0x9cac('0xf'),auth['isAuthenticated'](),controller[_0x9cac('0x13')]);router[_0x9cac('0x12')](_0x9cac('0x14'),auth[_0x9cac('0x9')](),interaction[_0x9cac('0x15')]('whatsapp','whatsappinteraction:addtags'),controller[_0x9cac('0x16')]);router[_0x9cac('0x17')]('/:id',auth[_0x9cac('0x9')](),interaction[_0x9cac('0x15')](_0x9cac('0x18'),_0x9cac('0x19')),controller['update']);router[_0x9cac('0x1a')](_0x9cac('0xe'),auth[_0x9cac('0x9')](),interaction[_0x9cac('0x15')]('whatsapp','whatsappinteraction:destroy'),controller['destroy']);router[_0x9cac('0x1a')]('/:id/tags',auth['isAuthenticated'](),controller[_0x9cac('0x1b')]);module[_0x9cac('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 1dddee3..11d3ee3 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 _0x4503=['moment','exports','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x51bb4d,_0x43d5d8){var _0x394bd2=function(_0x422c48){while(--_0x422c48){_0x51bb4d['push'](_0x51bb4d['shift']());}};_0x394bd2(++_0x43d5d8);}(_0x4503,0x111));var _0x3450=function(_0x40f66c,_0x413dab){_0x40f66c=_0x40f66c-0x0;var _0x545454=_0x4503[_0x40f66c];return _0x545454;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3450('0x0'));module[_0x3450('0x1')]={'closed':{'type':Sequelize[_0x3450('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x3450('0x3')]},'secondDisposition':{'type':Sequelize[_0x3450('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3450('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x3450('0x3')]},'read1stAt':{'type':Sequelize[_0x3450('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x3450('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3450('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x3450('0x5')]('in',_0x3450('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xa866=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x771ec4,_0x3a9d73){var _0xbc511a=function(_0xff5e94){while(--_0xff5e94){_0x771ec4['push'](_0x771ec4['shift']());}};_0xbc511a(++_0x3a9d73);}(_0xa866,0x6a));var _0x6a86=function(_0x56bae1,_0x31960d){_0x56bae1=_0x56bae1-0x0;var _0x4dec83=_0xa866[_0x56bae1];return _0x4dec83;};'use strict';var Sequelize=require(_0x6a86('0x0'));var moment=require(_0x6a86('0x1'));module[_0x6a86('0x2')]={'closed':{'type':Sequelize[_0x6a86('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6a86('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6a86('0x5')]},'thirdDisposition':{'type':Sequelize[_0x6a86('0x5')]},'note':{'type':Sequelize[_0x6a86('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x6a86('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x6a86('0x6')]('in',_0x6a86('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6a86('0x6')]('in',_0x6a86('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 6a68a02..b838023 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 _0xb1a6=['WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','isEmpty','i.WhatsappAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','fields','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.*','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','params','includeAll','include','create','update','describe','WhatsappMessage','addMessage','omit','ids','getMessages','findOne','merge','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','addTags','spread','color','emit','whatsappInteractionTags:save','removeTags','unix','root','server','files','join','attachments','transcript-%d-%s.zip','fullname','Contact','firstName','lastName','direction','WhatsappAccount','Account','get','mkdirSync','Owner','N.A.','format','closed','closedAt','Messages','Attachment','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','secret','renderFile','views','downloadInteraction.html','transcript-','.pdf','download','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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','../../config/license/util','../../mysqldb','redis','localhost','./whatsappInteraction.socket','register','sendStatus','status','count','offset','Content-Range','json','apply','save','then','destroy','end','stack','name','send','Users','map','TagIds','split','forEach','push','catch','index','WhatsappInteraction','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','limit','order','sort','where','pick','field','from','select','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','whatsapp_interactions','cm_contacts','o.id\x20=\x20i.UserId','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','length','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','some','compact'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xb1a6,0x16b));var _0x6b1a=function(_0x43e611,_0x44c033){_0x43e611=_0x43e611-0x0;var _0x48e61a=_0xb1a6[_0x43e611];return _0x48e61a;};'use strict';var emlformat=require(_0x6b1a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6b1a('0x1'));var jsonpatch=require(_0x6b1a('0x2'));var rp=require(_0x6b1a('0x3'));var moment=require(_0x6b1a('0x4'));var BPromise=require(_0x6b1a('0x5'));var Mustache=require(_0x6b1a('0x6'));var util=require(_0x6b1a('0x7'));var path=require(_0x6b1a('0x8'));var sox=require('sox');var csv=require(_0x6b1a('0x9'));var ejs=require(_0x6b1a('0xa'));var fs=require('fs');var fs_extra=require(_0x6b1a('0xb'));var _=require(_0x6b1a('0xc'));var squel=require(_0x6b1a('0xd'));var crypto=require(_0x6b1a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x6b1a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6b1a('0x10'));var Papa=require(_0x6b1a('0x11'));var Redis=require('ioredis');var authService=require(_0x6b1a('0x12'));var qs=require(_0x6b1a('0x13'));var as=require(_0x6b1a('0x14'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x6b1a('0x15'));var logger=require(_0x6b1a('0x16'))(_0x6b1a('0x17'));var utils=require(_0x6b1a('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x6b1a('0x19'));var db=require(_0x6b1a('0x1a'))['db'];config['redis']=_['defaults'](config[_0x6b1a('0x1b')],{'host':_0x6b1a('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b1a('0x1b')]));require(_0x6b1a('0x1d'))[_0x6b1a('0x1e')](socket);function respondWithStatusCode(_0x286958,_0x5dbf29){_0x5dbf29=_0x5dbf29||0xcc;return function(_0x2de2b2){if(_0x2de2b2){return _0x286958[_0x6b1a('0x1f')](_0x5dbf29);}return _0x286958[_0x6b1a('0x20')](_0x5dbf29)['end']();};}function respondWithResult(_0x4e99fa,_0x158a65){_0x158a65=_0x158a65||0xc8;return function(_0x4392b9){if(_0x4392b9){return _0x4e99fa[_0x6b1a('0x20')](_0x158a65)['json'](_0x4392b9);}};}function respondWithFilteredResult(_0x59da65,_0x5eff46){return function(_0x9d097){if(_0x9d097){var _0x272b6a=_0x9d097[_0x6b1a('0x21')],_0x16a9d3=_0x5eff46[_0x6b1a('0x22')],_0x5ab8cf=_0x5eff46['offset']+_0x5eff46['limit'],_0x3f0c71;if(_0x5ab8cf>=_0x272b6a){_0x5ab8cf=_0x272b6a;_0x3f0c71=0xc8;}else{_0x3f0c71=0xce;}_0x59da65[_0x6b1a('0x20')](_0x3f0c71);return _0x59da65['set'](_0x6b1a('0x23'),_0x16a9d3+'-'+_0x5ab8cf+'/'+_0x272b6a)[_0x6b1a('0x24')](_0x9d097);}return null;};}function patchUpdates(_0x256947){return function(_0xe8ddbc){try{jsonpatch[_0x6b1a('0x25')](_0xe8ddbc,_0x256947,!![]);}catch(_0x4973a5){return BPromise['reject'](_0x4973a5);}return _0xe8ddbc[_0x6b1a('0x26')]();};}function saveUpdates(_0x57be15,_0x4d46af){return function(_0x4cc438){if(_0x4cc438){return _0x4cc438['update'](_0x57be15)[_0x6b1a('0x27')](function(_0xd0d04a){return _0xd0d04a;});}return null;};}function removeEntity(_0x2b1269,_0x3d160d){return function(_0x16951e){if(_0x16951e){return _0x16951e[_0x6b1a('0x28')]()[_0x6b1a('0x27')](function(){_0x2b1269['status'](0xcc)[_0x6b1a('0x29')]();});}};}function handleEntityNotFound(_0x41b2b4,_0x3acef8){return function(_0x25ee04){if(!_0x25ee04){_0x41b2b4[_0x6b1a('0x1f')](0x194);}return _0x25ee04;};}function handleError(_0x5710e4,_0x42d762){_0x42d762=_0x42d762||0x1f4;return function(_0x2b5e11){logger['error'](_0x2b5e11[_0x6b1a('0x2a')]);if(_0x2b5e11[_0x6b1a('0x2b')]){delete _0x2b5e11[_0x6b1a('0x2b')];}_0x5710e4['status'](_0x42d762)[_0x6b1a('0x2c')](_0x2b5e11);};}function getInteractionUsers(_0x1d657c,_0x582ead){return new BPromise(function(_0x1ebb5f,_0x340269){try{if(_0x582ead[_0x1d657c['id']]){_0x1d657c[_0x6b1a('0x2d')]=_[_0x6b1a('0x2e')](_0x582ead[_0x1d657c['id']],function(_0x21e455){return{'id':_0x21e455['id'],'fullname':_0x21e455['fullname']};});}}catch(_0x3f53a8){_0x340269(_0x3f53a8);}_0x1ebb5f(_0x1d657c);});}function getInteractionTags(_0x22e805,_0x4fb827){return new BPromise(function(_0x129834,_0x256822){try{if(_0x22e805[_0x6b1a('0x2f')]){_0x22e805['Tags']=[];_0x22e805[_0x6b1a('0x2f')][_0x6b1a('0x30')](',')[_0x6b1a('0x31')](function(_0x59fd1d){_0x22e805['Tags'][_0x6b1a('0x32')](_0x4fb827[_0x59fd1d]);});}delete _0x22e805[_0x6b1a('0x2f')];}catch(_0x2b08cd){_0x256822(_0x2b08cd);}_0x129834(_0x22e805);});}function updateWhatsappInteraction(_0x93eae3,_0xaf4b67,_0x1fe145){return new BPromise(function(_0x3ffbaf,_0x53555f){return getInteractionUsers(_0x93eae3,_0x1fe145)[_0x6b1a('0x27')](function(_0x406f8){return getInteractionTags(_0x406f8,_0xaf4b67);})[_0x6b1a('0x27')](function(_0x494935){_0x3ffbaf(_0x494935);})[_0x6b1a('0x33')](function(_0x570b7d){_0x53555f(_0x570b7d);});});}exports[_0x6b1a('0x34')]=function(_0x18aef2,_0x3e42a2){var _0x4e6245={},_0x593294={},_0x2a9637={'count':0x0,'rows':[]};var _0x5773cd=_['map'](db[_0x6b1a('0x35')][_0x6b1a('0x36')],function(_0x5db718){return{'name':_0x5db718[_0x6b1a('0x37')],'type':_0x5db718[_0x6b1a('0x38')][_0x6b1a('0x39')]};});_0x593294['model']=_['map'](_0x5773cd,_0x6b1a('0x2b'));_0x593294[_0x6b1a('0x3a')]=_[_0x6b1a('0x3b')](_0x18aef2[_0x6b1a('0x3a')]);_0x593294[_0x6b1a('0x3c')]=_[_0x6b1a('0x3d')](_0x593294['model'],_0x593294['query']);_0x4e6245['attributes']=_[_0x6b1a('0x3d')](_0x593294[_0x6b1a('0x3e')],qs['fields'](_0x18aef2[_0x6b1a('0x3a')]['fields']));_0x4e6245[_0x6b1a('0x3f')]=_0x4e6245[_0x6b1a('0x3f')]['length']?_0x4e6245['attributes']:_0x593294['model'];if(!_0x18aef2[_0x6b1a('0x3a')][_0x6b1a('0x40')]('nolimit')){_0x4e6245[_0x6b1a('0x41')]=qs[_0x6b1a('0x41')](_0x18aef2[_0x6b1a('0x3a')][_0x6b1a('0x41')]);_0x4e6245[_0x6b1a('0x22')]=qs['offset'](_0x18aef2[_0x6b1a('0x3a')][_0x6b1a('0x22')]);}_0x4e6245[_0x6b1a('0x42')]=qs['sort'](_0x18aef2[_0x6b1a('0x3a')][_0x6b1a('0x43')]);_0x4e6245[_0x6b1a('0x44')]=qs[_0x6b1a('0x3c')](_[_0x6b1a('0x45')](_0x18aef2[_0x6b1a('0x3a')],_0x593294[_0x6b1a('0x3c')]),_0x5773cd);var _0x35e8f7=[];var _0x4e8f37=squel['select']()[_0x6b1a('0x46')]('id')['field'](_0x6b1a('0x2b'))[_0x6b1a('0x46')]('color')[_0x6b1a('0x47')]('tools_tags');var _0x3cffa8=squel[_0x6b1a('0x48')]()[_0x6b1a('0x46')](_0x6b1a('0x49'))['field'](_0x6b1a('0x4a'))[_0x6b1a('0x46')](_0x6b1a('0x4b'))['from'](_0x6b1a('0x4c'),'ui')[_0x6b1a('0x4d')]('users','u','u.id\x20=\x20ui.UserId');var _0x313d70=squel['select']()['from'](_0x6b1a('0x4e'),'i')[_0x6b1a('0x4d')](_0x6b1a('0x4f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x6b1a('0x4d')]('users','o',_0x6b1a('0x50'))[_0x6b1a('0x4d')]('whatsapp_accounts','a','a.id\x20=\x20i.WhatsappAccountId')[_0x6b1a('0x4d')](_0x6b1a('0x51'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x6b1a('0x52'),'it',_0x6b1a('0x53'))[_0x6b1a('0x4d')]('tools_tags','t',_0x6b1a('0x54'));var _0x1debfd=squel[_0x6b1a('0x55')]();var _0x23149e=[];var _0x547548=squel[_0x6b1a('0x55')]();var _0x3ca01e;if(_0x18aef2[_0x6b1a('0x3a')]['search']){_0x3ca01e=as[_0x6b1a('0x56')](_0x18aef2[_0x6b1a('0x3a')][_0x6b1a('0x57')]);var _0x339110=_0x3ca01e[_0x6b1a('0x58')];for(var _0x5b0aa4=0x0;_0x5b0aa4<_0x3ca01e[_0x6b1a('0x59')][_0x6b1a('0x5a')];_0x5b0aa4++){var _0x3078b1=_0x3ca01e[_0x6b1a('0x59')][_0x5b0aa4];var _0x1a2e7f='i';var _0x108c9b=_[_0x6b1a('0x5b')](_0x5773cd,[_0x6b1a('0x2b'),_0x3078b1[_0x6b1a('0x46')]]);if(!_0x108c9b){switch(_0x3078b1[_0x6b1a('0x46')]){case _0x6b1a('0x5c'):if(_0x3078b1['value']==0x1){_0x313d70[_0x6b1a('0x5d')]('`'+_0x3078b1[_0x6b1a('0x46')]+_0x6b1a('0x5e'));}else{_0x313d70[_0x6b1a('0x5d')]('`'+_0x3078b1[_0x6b1a('0x46')]+_0x6b1a('0x5f'));}break;case'Contact':if(_0x3078b1[_0x6b1a('0x60')]===_0x6b1a('0x61')){if(_0x3078b1[_0x6b1a('0x62')][_0x6b1a('0x30')]('\x20')['length']>0x1){_0x1debfd[_0x339110](_0x6b1a('0x63'),qs[_0x6b1a('0x64')](_0x3078b1[_0x6b1a('0x62')]),null);}else{var _0x29c262='%'+_0x3078b1[_0x6b1a('0x62')]+'%';_0x1debfd[_0x339110](_0x6b1a('0x65'),_0x29c262,_0x29c262,_0x29c262);}}else{_0x108c9b=_[_0x6b1a('0x5b')](_0x5773cd,[_0x6b1a('0x2b'),'ContactId']);_0x3078b1[_0x6b1a('0x46')]=_0x6b1a('0x66');_0x29ddf4=as[_0x6b1a('0x67')](_0x1a2e7f,_0x108c9b[_0x6b1a('0x38')],_0x3078b1);_0x1debfd[_0x339110](_0x29ddf4[_0x6b1a('0x68')],_0x29ddf4['value']['start'],_0x29ddf4[_0x6b1a('0x62')][_0x6b1a('0x29')]);}break;case'Tag':var _0x53de8e=_0x3078b1[_0x6b1a('0x62')][_0x6b1a('0x30')](',')[_0x6b1a('0x2e')](function(_0x322013){return Number(_0x322013);});_0x53de8e[_0x6b1a('0x31')](function(_0xf02452){_0x547548['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xf02452+',%');});_0x23149e=_[_0x6b1a('0x69')](_0x23149e,_0x53de8e);break;case _0x6b1a('0x6a'):if(_0x3078b1[_0x6b1a('0x60')]===_0x6b1a('0x61')){_0x1debfd[_0x339110](_0x6b1a('0x6b'),'%'+_0x3078b1[_0x6b1a('0x62')]+'%',null);}else{_0x108c9b=_[_0x6b1a('0x5b')](_0x5773cd,[_0x6b1a('0x2b'),_0x6b1a('0x6c')]);_0x3078b1[_0x6b1a('0x46')]=_0x6b1a('0x6c');_0x29ddf4=as['buildExpression'](_0x1a2e7f,_0x108c9b[_0x6b1a('0x38')],_0x3078b1);_0x1debfd[_0x339110](_0x29ddf4[_0x6b1a('0x68')],_0x29ddf4[_0x6b1a('0x62')][_0x6b1a('0x6d')],_0x29ddf4['value'][_0x6b1a('0x29')]);}break;case _0x6b1a('0x6e'):_0x29ddf4=as[_0x6b1a('0x67')]('me',null,_0x3078b1);_0x1debfd[_0x339110](_0x29ddf4[_0x6b1a('0x68')],_0x29ddf4['value']['start'],_0x29ddf4[_0x6b1a('0x62')]['end']);break;}}else{var _0x29ddf4=as[_0x6b1a('0x67')](_0x1a2e7f,_0x108c9b['type'],_0x3078b1);_0x1debfd[_0x339110](_0x29ddf4[_0x6b1a('0x68')],_0x29ddf4[_0x6b1a('0x62')][_0x6b1a('0x6d')],_0x29ddf4['value'][_0x6b1a('0x29')]);}}}else{var _0x3a44f6=_(_0x18aef2[_0x6b1a('0x3a')])[_0x6b1a('0x3b')]()[_0x6b1a('0x2e')](function(_0x5ce96b){return _[_0x6b1a('0x6f')](_0x5773cd,[_0x6b1a('0x2b'),_0x5ce96b])?_0x5ce96b:undefined;})[_0x6b1a('0x70')]()[_0x6b1a('0x62')]();if(!_['isEmpty'](_0x3a44f6)){_0x3a44f6[_0x6b1a('0x31')](function(_0x5461ee){if(_0x5461ee===_0x6b1a('0x71')){_0x313d70[_0x6b1a('0x44')](_0x6b1a('0x72'),[][_0x6b1a('0x73')](_0x18aef2[_0x6b1a('0x3a')][_0x5461ee]));}else if(_0x5461ee===_0x6b1a('0x74')){var _0x68289b=JSON[_0x6b1a('0x75')](_0x18aef2[_0x6b1a('0x3a')][_0x5461ee])[_0x6b1a('0x76')];var _0x57adfb=JSON[_0x6b1a('0x75')](_0x18aef2['query'][_0x5461ee])[_0x6b1a('0x77')];_0x313d70[_0x6b1a('0x44')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x68289b,_0x57adfb);}else{if(_0x18aef2['query'][_0x5461ee]===_0x6b1a('0x78')){_0x313d70[_0x6b1a('0x44')]('i.'+_0x5461ee+_0x6b1a('0x79'));}else{_0x313d70['where']('i.'+_0x5461ee+_0x6b1a('0x7a'),_0x18aef2[_0x6b1a('0x3a')][_0x5461ee]);}}});}if(_0x18aef2[_0x6b1a('0x3a')][_0x6b1a('0x7b')]){if(_0x18aef2['query']['read']==0x1){_0x313d70[_0x6b1a('0x5d')](_0x6b1a('0x7c'));}else{_0x313d70['having']('`unreadMessages`\x20>\x200');}}if(_0x18aef2[_0x6b1a('0x3a')][_0x6b1a('0x7d')]){_0x23149e=_[_0x6b1a('0x7e')](_0x18aef2[_0x6b1a('0x3a')][_0x6b1a('0x7d')])?_0x18aef2['query'][_0x6b1a('0x7d')]:new Array(_0x18aef2['query']['tag']);_0x23149e[_0x6b1a('0x31')](function(_0x2a03af){_0x547548['or'](_0x6b1a('0x7f'),'%,'+_0x2a03af+',%');});}if(_0x18aef2[_0x6b1a('0x3a')][_0x6b1a('0x80')]){var _0x3c82a9=_0x18aef2['query'][_0x6b1a('0x80')][_0x6b1a('0x81')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x6b1a('0x82')](_0x3c82a9)){_0x1debfd['or'](_0x6b1a('0x83'),_0x3c82a9+'%')['or'](_0x6b1a('0x84'),_0x3c82a9+'%');}else{_0x1debfd['or'](_0x6b1a('0x85'),qs[_0x6b1a('0x64')](_0x3c82a9))['or'](_0x6b1a('0x86'),_0x3c82a9+'%');}}}_0x313d70[_0x6b1a('0x44')](_0x1debfd);_0x313d70[_0x6b1a('0x87')]('i.id');var _0x11cbd7={'type':db[_0x6b1a('0x88')][_0x6b1a('0x89')][_0x6b1a('0x8a')],'raw':!![]};var _0x51088f=_0x313d70[_0x6b1a('0x8b')]();_0x51088f[_0x6b1a('0x46')]('i.id');_0x51088f[_0x6b1a('0x46')](_0x6b1a('0x8c'),_0x6b1a('0x5c'));if(_0x4e6245[_0x6b1a('0x42')]){_0x4e6245[_0x6b1a('0x42')]['forEach'](function(_0x35c350){var _0x499777=_0x35c350[0x0]===_0x6b1a('0x8d')?_0x35c350[0x0]:'i.'+_0x35c350[0x0];_0x313d70[_0x6b1a('0x42')](_0x499777,_0x35c350[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x23149e)){_0x313d70[_0x6b1a('0x5d')](_0x547548);_0x51088f['where'](_0x6b1a('0x8e'),_0x23149e);}BPromise[_0x6b1a('0x8f')]()[_0x6b1a('0x27')](function(){if(!_0x3ca01e){if(_0x18aef2['query'][_0x6b1a('0x71')])return;_0x51088f[_0x6b1a('0x44')](_0x6b1a('0x90'));_0x313d70[_0x6b1a('0x44')](_0x6b1a('0x90'));return;}if(_0x18aef2[_0x6b1a('0x91')]['role']!==_0x6b1a('0x92'))return;return _0x18aef2[_0x6b1a('0x91')][_0x6b1a('0x93')]({'attributes':['id'],'raw':!![]})[_0x6b1a('0x27')](function(_0x172638){if(_[_0x6b1a('0x94')](_0x172638)){_0x51088f[_0x6b1a('0x44')](_0x6b1a('0x95'));_0x313d70[_0x6b1a('0x44')](_0x6b1a('0x95'));}else{_0x51088f['where'](_0x6b1a('0x72'),_[_0x6b1a('0x2e')](_0x172638,'id'));_0x313d70[_0x6b1a('0x44')]('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x172638,'id'));}});})[_0x6b1a('0x27')](function(){if(_0x18aef2[_0x6b1a('0x91')][_0x6b1a('0x96')]===_0x6b1a('0x92')&&!_0x3ca01e&&!_0x18aef2[_0x6b1a('0x3a')]['WhatsappAccountId'])return[];return db[_0x6b1a('0x97')][_0x6b1a('0x3a')](_0x51088f['toString'](),_0x11cbd7);})[_0x6b1a('0x27')](function(_0x351e4b){_0x2a9637[_0x6b1a('0x21')]=_0x351e4b['length'];if(_0x2a9637['count']===0x0)return[];return db[_0x6b1a('0x97')][_0x6b1a('0x3a')](_0x4e8f37[_0x6b1a('0x98')](),_0x11cbd7)['then'](function(_0x378a8a){_0x35e8f7=_[_0x6b1a('0x99')](_0x378a8a,'id');_0x11cbd7=_['merge'](_0x11cbd7,{'model':db[_0x6b1a('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x18aef2[_0x6b1a('0x3a')][_0x6b1a('0x9a')]){_0x4e6245[_0x6b1a('0x3f')]['forEach'](function(_0x3212c7){_0x313d70['field']('i.'+_0x3212c7);});}else{_0x313d70[_0x6b1a('0x46')](_0x6b1a('0x8c'),_0x6b1a('0x5c'));_0x313d70[_0x6b1a('0x46')](_0x6b1a('0x9b'),_0x6b1a('0x9c'));_0x313d70[_0x6b1a('0x46')](_0x6b1a('0x9d'),_0x6b1a('0x9e'));_0x313d70[_0x6b1a('0x46')](_0x6b1a('0x9f'),_0x6b1a('0x8d'));_0x313d70[_0x6b1a('0x46')](_0x6b1a('0xa0'));_0x313d70['field']('c.firstName',_0x6b1a('0xa1'));_0x313d70[_0x6b1a('0x46')](_0x6b1a('0xa2'),'Contact.lastName');_0x313d70[_0x6b1a('0x46')](_0x6b1a('0xa3'),_0x6b1a('0xa4'));_0x313d70[_0x6b1a('0x46')](_0x6b1a('0xa5'),_0x6b1a('0xa6'));_0x313d70[_0x6b1a('0x46')](_0x6b1a('0xa7'),_0x6b1a('0xa8'));_0x313d70['field'](_0x6b1a('0xa9'),_0x6b1a('0xaa'));_0x313d70[_0x6b1a('0x46')]('o.fullname',_0x6b1a('0xab'));_0x313d70[_0x6b1a('0x46')]('o.internal','Owner.internal');_0x313d70[_0x6b1a('0x46')](_0x6b1a('0xac'),_0x6b1a('0x2f'));}if(_0x4e6245[_0x6b1a('0x41')])_0x313d70['limit'](_0x4e6245[_0x6b1a('0x41')]);if(_0x4e6245[_0x6b1a('0x22')])_0x313d70[_0x6b1a('0x22')](_0x4e6245[_0x6b1a('0x22')]);return db[_0x6b1a('0x97')][_0x6b1a('0x3a')](_0x313d70['toString'](),_0x11cbd7);})[_0x6b1a('0x27')](function(_0xcdf434){_0x3cffa8['where'](_0x6b1a('0xad'),_[_0x6b1a('0x2e')](_0xcdf434,'id'));return db[_0x6b1a('0x97')][_0x6b1a('0x3a')](_0x3cffa8[_0x6b1a('0x98')](),_0x11cbd7)[_0x6b1a('0x27')](function(_0x382a49){var _0x1cb51e=_[_0x6b1a('0xae')](_0x382a49,'WhatsappInteractionId');var _0x5e212a=[];_0xcdf434[_0x6b1a('0x31')](function(_0x2025be){_0x5e212a['push'](updateWhatsappInteraction(_0x2025be,_0x35e8f7,_0x1cb51e));});return BPromise[_0x6b1a('0xaf')](_0x5e212a);});});})[_0x6b1a('0x27')](function(_0x3beb2b){_0x2a9637['rows']=_0x3beb2b;return _0x2a9637;})[_0x6b1a('0x27')](respondWithFilteredResult(_0x3e42a2,_0x4e6245))['catch'](handleError(_0x3e42a2,null));};exports['show']=function(_0x1a2558,_0xd64b86){var _0x4fe766={'raw':![],'where':{'id':_0x1a2558[_0x6b1a('0xb0')]['id']}},_0x1fbd89={};_0x1fbd89[_0x6b1a('0x3e')]=_[_0x6b1a('0x3b')](db['WhatsappInteraction'][_0x6b1a('0x36')]);_0x1fbd89[_0x6b1a('0x3a')]=_['keys'](_0x1a2558[_0x6b1a('0x3a')]);_0x1fbd89[_0x6b1a('0x3c')]=_[_0x6b1a('0x3d')](_0x1fbd89[_0x6b1a('0x3e')],_0x1fbd89[_0x6b1a('0x3a')]);_0x4fe766[_0x6b1a('0x3f')]=_[_0x6b1a('0x3d')](_0x1fbd89['model'],qs[_0x6b1a('0x9a')](_0x1a2558['query']['fields']));_0x4fe766[_0x6b1a('0x3f')]=_0x4fe766[_0x6b1a('0x3f')][_0x6b1a('0x5a')]?_0x4fe766[_0x6b1a('0x3f')]:_0x1fbd89['model'];if(_0x1a2558[_0x6b1a('0x3a')][_0x6b1a('0xb1')]){_0x4fe766[_0x6b1a('0xb2')]=[{'all':!![]}];}_0x4fe766=_['merge']({},_0x4fe766,_0x1a2558['options']);return db[_0x6b1a('0x35')]['find'](_0x4fe766)['then'](handleEntityNotFound(_0xd64b86,null))[_0x6b1a('0x27')](respondWithResult(_0xd64b86,null))[_0x6b1a('0x33')](handleError(_0xd64b86,null));};exports['create']=function(_0x547c54,_0xc2813b){return db[_0x6b1a('0x35')][_0x6b1a('0xb3')](_0x547c54[_0x6b1a('0x6e')],{})[_0x6b1a('0x27')](respondWithResult(_0xc2813b,0xc9))[_0x6b1a('0x33')](handleError(_0xc2813b,null));};exports[_0x6b1a('0xb4')]=function(_0x396bf9,_0x277ae9){if(_0x396bf9['body']['id']){delete _0x396bf9[_0x6b1a('0x6e')]['id'];}return db['WhatsappInteraction']['find']({'where':{'id':_0x396bf9['params']['id']}})[_0x6b1a('0x27')](handleEntityNotFound(_0x277ae9,null))[_0x6b1a('0x27')](saveUpdates(_0x396bf9[_0x6b1a('0x6e')],null))[_0x6b1a('0x27')](respondWithResult(_0x277ae9,null))[_0x6b1a('0x33')](handleError(_0x277ae9,null));};exports['destroy']=function(_0x1a6c2a,_0xbfbd3e){return db[_0x6b1a('0x35')]['find']({'where':{'id':_0x1a6c2a[_0x6b1a('0xb0')]['id']}})[_0x6b1a('0x27')](handleEntityNotFound(_0xbfbd3e,null))['then'](removeEntity(_0xbfbd3e,null))[_0x6b1a('0x33')](handleError(_0xbfbd3e,null));};exports[_0x6b1a('0xb5')]=function(_0x4c8132,_0x9e14aa){return db['WhatsappInteraction']['describe']()[_0x6b1a('0x27')](respondWithResult(_0x9e14aa,null))[_0x6b1a('0x33')](handleError(_0x9e14aa,null));};exports['addMessage']=function(_0x1ac01e,_0x516ab3,_0x1c3802){return db[_0x6b1a('0xb6')][_0x6b1a('0x5b')]({'where':{'id':_0x1ac01e[_0x6b1a('0xb0')]['id']}})['then'](handleEntityNotFound(_0x516ab3,null))['then'](function(_0x592160){if(_0x592160){return _0x592160[_0x6b1a('0xb7')](_0x1ac01e[_0x6b1a('0x6e')]['ids'],_[_0x6b1a('0xb8')](_0x1ac01e[_0x6b1a('0x6e')],[_0x6b1a('0xb9'),'id'])||{});}})[_0x6b1a('0x27')](respondWithResult(_0x516ab3,null))['catch'](handleError(_0x516ab3,null));};exports[_0x6b1a('0xba')]=function(_0x3b186a,_0x9c6224,_0x31d0d2){var _0x33e7e6={'raw':![],'where':{}};var _0x5876df={};var _0x3c60df={'count':0x0,'rows':[]};return db[_0x6b1a('0x35')][_0x6b1a('0xbb')]({'where':{'id':_0x3b186a[_0x6b1a('0xb0')]['id']}})[_0x6b1a('0x27')](handleEntityNotFound(_0x9c6224,null))[_0x6b1a('0x27')](function(_0x56939c){if(_0x56939c){_0x5876df[_0x6b1a('0x3e')]=_[_0x6b1a('0x3b')](db[_0x6b1a('0xb6')]['rawAttributes']);_0x5876df[_0x6b1a('0x3a')]=_[_0x6b1a('0x3b')](_0x3b186a[_0x6b1a('0x3a')]);_0x5876df[_0x6b1a('0x3c')]=_[_0x6b1a('0x3d')](_0x5876df[_0x6b1a('0x3e')],_0x5876df[_0x6b1a('0x3a')]);_0x33e7e6[_0x6b1a('0x3f')]=_[_0x6b1a('0x3d')](_0x5876df[_0x6b1a('0x3e')],qs[_0x6b1a('0x9a')](_0x3b186a[_0x6b1a('0x3a')][_0x6b1a('0x9a')]));_0x33e7e6[_0x6b1a('0x3f')]=_0x33e7e6['attributes'][_0x6b1a('0x5a')]?_0x33e7e6[_0x6b1a('0x3f')]:_0x5876df[_0x6b1a('0x3e')];if(!_0x3b186a[_0x6b1a('0x3a')]['hasOwnProperty']('nolimit')){_0x33e7e6[_0x6b1a('0x41')]=qs[_0x6b1a('0x41')](_0x3b186a['query']['limit']);_0x33e7e6['offset']=qs[_0x6b1a('0x22')](_0x3b186a[_0x6b1a('0x3a')][_0x6b1a('0x22')]);}_0x33e7e6['order']=qs['sort'](_0x3b186a[_0x6b1a('0x3a')][_0x6b1a('0x43')]);_0x33e7e6['where']=qs['filters'](_[_0x6b1a('0x45')](_0x3b186a['query'],_0x5876df['filters']));_0x33e7e6[_0x6b1a('0x44')]['WhatsappInteractionId']=_0x56939c['id'];if(_0x3b186a[_0x6b1a('0x3a')][_0x6b1a('0x80')]){_0x33e7e6[_0x6b1a('0x44')]=_[_0x6b1a('0xbc')](_0x33e7e6['where'],{'$or':_['map'](_0x33e7e6['attributes'],function(_0x314c23){var _0x18319e={};_0x18319e[_0x314c23]={'$like':'%'+_0x3b186a[_0x6b1a('0x3a')][_0x6b1a('0x80')]+'%'};return _0x18319e;})});}if(_0x3b186a[_0x6b1a('0x3a')][_0x6b1a('0x76')]){var _0xa4991a=_0x3b186a['query'][_0x6b1a('0x76')][_0x6b1a('0x30')](',');var _0x180100={};_0x180100[_0xa4991a[0x0]]={'$gte':moment(_0xa4991a[0x1])['format'](_0x6b1a('0xbd'))};_0x33e7e6[_0x6b1a('0x44')]=_['merge'](_0x33e7e6[_0x6b1a('0x44')],_0x180100);}_0x33e7e6=_[_0x6b1a('0xbc')]({},_0x33e7e6,_0x3b186a[_0x6b1a('0xbe')]);return db[_0x6b1a('0xb6')][_0x6b1a('0x21')]({'where':_0x33e7e6[_0x6b1a('0x44')]})['then'](function(_0x325461){_0x3c60df[_0x6b1a('0x21')]=_0x325461;if(_0x3b186a[_0x6b1a('0x3a')]['includeAll']){_0x33e7e6['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x6b1a('0xbf')](_0x33e7e6);})[_0x6b1a('0x27')](function(_0x3776d6){_0x3c60df[_0x6b1a('0xc0')]=_0x3776d6;return _0x3c60df;});}})['then'](respondWithFilteredResult(_0x9c6224,_0x33e7e6))[_0x6b1a('0x33')](handleError(_0x9c6224,null));};exports[_0x6b1a('0xc1')]=function(_0x26cca0,_0x47b1d0,_0x4a6c25){return db[_0x6b1a('0x35')][_0x6b1a('0x5b')]({'where':{'id':_0x26cca0['params']['id']}})[_0x6b1a('0x27')](handleEntityNotFound(_0x47b1d0,null))[_0x6b1a('0x27')](function(_0x51a23e){if(_0x51a23e){return _0x51a23e['setTags'](_0x26cca0[_0x6b1a('0x6e')]['ids'],_[_0x6b1a('0xb8')](_0x26cca0[_0x6b1a('0x6e')],[_0x6b1a('0xb9'),'id'])||{})[_0x6b1a('0xc2')](function(){return db['Tag'][_0x6b1a('0xbf')]({'attributes':['id',_0x6b1a('0x2b'),_0x6b1a('0xc3')],'where':{'id':_0x26cca0['body']['ids']}});})[_0x6b1a('0x27')](function(_0x2d48d0){socket[_0x6b1a('0xc4')](_0x6b1a('0xc5'),{'id':Number(_0x26cca0[_0x6b1a('0xb0')]['id']),'tags':_0x2d48d0||[]});return{'id':Number(_0x26cca0['params']['id']),'tags':_0x2d48d0||[]};});}})['then'](respondWithResult(_0x47b1d0,null))[_0x6b1a('0x33')](handleError(_0x47b1d0,null));};exports[_0x6b1a('0xc6')]=function(_0x40f09b,_0x1758d7,_0x4a6f0c){return db['WhatsappInteraction']['find']({'where':{'id':_0x40f09b[_0x6b1a('0xb0')]['id']}})[_0x6b1a('0x27')](handleEntityNotFound(_0x1758d7,null))[_0x6b1a('0x27')](function(_0x162ed2){if(_0x162ed2){return _0x162ed2[_0x6b1a('0xc6')](_0x40f09b[_0x6b1a('0x3a')]['ids']);}})[_0x6b1a('0x27')](respondWithStatusCode(_0x1758d7,null))['catch'](handleError(_0x1758d7,null));};exports['download']=function(_0x4f19b2,_0x281a42){var _0x1d59c8=moment()[_0x6b1a('0xc7')]()[_0x6b1a('0x98')]();var _0x251e22=path['join'](config[_0x6b1a('0xc8')],_0x6b1a('0xc9'),_0x6b1a('0xca'),'tmp');var _0x2dc641=path[_0x6b1a('0xcb')](config[_0x6b1a('0xc8')],'server',_0x6b1a('0xca'),_0x6b1a('0xcc'));var _0x58d414=path[_0x6b1a('0xcb')](_0x251e22,_0x1d59c8);var _0x396ebc=util['format'](_0x6b1a('0xcd'),_0x4f19b2[_0x6b1a('0xb0')]['id'],_0x1d59c8);var _0x5db901=path['join'](_0x251e22,_0x396ebc);var _0x4adccc=[];_0x4adccc[_0x6b1a('0x32')]({'model':db['User'],'as':_0x6b1a('0x6a'),'attributes':['id',_0x6b1a('0xce')],'raw':!![]});_0x4adccc['push']({'model':db['CmContact'],'as':_0x6b1a('0xcf'),'attributes':['id',_0x6b1a('0xd0'),_0x6b1a('0xd1')],'raw':!![]});if(_0x4f19b2[_0x6b1a('0x3a')][_0x6b1a('0xcc')]){_0x4adccc['push']({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x28f61e=[{'model':db[_0x6b1a('0xb6')],'as':'Messages','attributes':['id',_0x6b1a('0x6e'),'createdAt',_0x6b1a('0xd2'),'secret',_0x6b1a('0x7b')],'include':_0x4adccc}];_0x28f61e['push']({'model':db[_0x6b1a('0xd3')],'as':_0x6b1a('0xd4'),'attributes':['id',_0x6b1a('0x2b')]});_0x28f61e[_0x6b1a('0x32')]({'model':db[_0x6b1a('0x6a')],'as':'Owner','attributes':['id',_0x6b1a('0xce')]});return db[_0x6b1a('0x35')][_0x6b1a('0x5b')]({'where':{'id':_0x4f19b2['params']['id']},'include':_0x28f61e})[_0x6b1a('0x27')](handleEntityNotFound(_0x281a42,null))[_0x6b1a('0x27')](function(_0x4aec0e){if(_0x4aec0e){var _0x24c071=_0x4aec0e[_0x6b1a('0xd5')]({'plain':!![]});fs[_0x6b1a('0xd6')](_0x58d414);var _0xe2f895={'channel':'Whatsapp','account':_0x24c071['Account'][_0x6b1a('0x2b')],'agent':_0x24c071['Owner']?_0x24c071[_0x6b1a('0xd7')][_0x6b1a('0xce')]:_0x6b1a('0xd8'),'createdAt':moment(_0x24c071[_0x6b1a('0x74')])[_0x6b1a('0xd9')](_0x6b1a('0xbd'))[_0x6b1a('0x98')](),'closedAt':_0x24c071[_0x6b1a('0xda')]?moment(_0x24c071[_0x6b1a('0xdb')])[_0x6b1a('0xd9')](_0x6b1a('0xbd'))['toString']():'','disposition':_0x24c071['disposition'],'messages':_(_0x24c071[_0x6b1a('0xdc')])[_0x6b1a('0x80')]({'secret':![]})[_0x6b1a('0x2e')](function(_0x78bce8){if(_0x78bce8['Attachment']){var _0x25e657=path['join'](_0x2dc641,_0x78bce8[_0x6b1a('0xdd')][_0x6b1a('0xde')]);if(fs[_0x6b1a('0xdf')](_0x25e657)){fs[_0x6b1a('0xe0')](_0x25e657)[_0x6b1a('0xe1')](fs[_0x6b1a('0xe2')](path[_0x6b1a('0xcb')](_0x58d414,_0x78bce8[_0x6b1a('0xdd')][_0x6b1a('0xde')])));}}return{'date':moment(_0x78bce8['createdAt'])[_0x6b1a('0xd9')](_0x6b1a('0xbd'))[_0x6b1a('0x98')](),'sender':_0x78bce8[_0x6b1a('0xd2')]===_0x6b1a('0xe3')?_0x78bce8[_0x6b1a('0x6a')]?_0x78bce8[_0x6b1a('0x6a')][_0x6b1a('0xce')]:_0x6b1a('0xe4'):_0x78bce8['Contact'][_0x6b1a('0xd0')]+(_0x78bce8['Contact'][_0x6b1a('0xd1')]?'\x20'+_0x78bce8[_0x6b1a('0xcf')][_0x6b1a('0xd1')]:''),'body':_0x78bce8[_0x6b1a('0xdd')]?_0x78bce8[_0x6b1a('0xdd')]['basename']:_0x78bce8[_0x6b1a('0x6e')],'direction':_0x78bce8[_0x6b1a('0xd2')]===_0x6b1a('0xe3')?'A':'C','secret':_0x78bce8[_0x6b1a('0xe5')],'read':_0x78bce8[_0x6b1a('0x7b')],'attachment':_0x78bce8[_0x6b1a('0xdd')]};})[_0x6b1a('0x62')]()};return ejs[_0x6b1a('0xe6')](path[_0x6b1a('0xcb')](config[_0x6b1a('0xc8')],_0x6b1a('0xc9'),_0x6b1a('0xe7'),_0x6b1a('0xe8')),{'interaction':_0xe2f895})[_0x6b1a('0x27')](function(_0xa10319){var _0x233969=path['join'](_0x58d414,_0x6b1a('0xe9')+_0x24c071['id']+'-'+_0x1d59c8+_0x6b1a('0xea'));var _0x122e34={'path':_0x233969,'channel':'Whatsapp','interactionId':_0x24c071['id']};return pdf['createPdfFromHTML'](_0xa10319,_0x122e34);})[_0x6b1a('0x27')](function(){return new BPromise(function(_0x401895,_0x1cce03){zipdir(_0x58d414,{'saveTo':_0x5db901},function(_0x471685,_0x656179){if(_0x471685)return _0x1cce03(_0x471685);return _0x401895(_0x656179);});})['then'](function(){return new BPromise(function(_0x528ed2,_0x446777){rimraf(_0x58d414,function(_0x31563f){if(_0x31563f)_0x446777(_0x31563f);return _0x528ed2();});});})[_0x6b1a('0x27')](function(){return _0x281a42[_0x6b1a('0xeb')](_0x5db901,_0x396ebc,function(_0x1f4919){if(_0x1f4919){console['log'](_0x6b1a('0xec'),_0x1f4919);}else{fs[_0x6b1a('0xed')](_0x5db901);}});});});}else{return _0x281a42[_0x6b1a('0x1f')](0xc8);}})['catch'](handleError(_0x281a42,null));}; \ No newline at end of file +var _0xccf4=['Content-Range','apply','reject','update','then','stack','send','map','fullname','TagIds','split','forEach','Tags','push','catch','index','WhatsappInteraction','rawAttributes','fieldName','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','user_has_whatsapp_interactions','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','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?','find','ContactId','buildExpression','type','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','some','compact','isEmpty','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','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','i.id','SELECT','clone','contactName','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','agent','WhatsappAccountId','sequelize','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','c.email','Contact.email','Contact.phone','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','WhatsappInteractionId','all','rows','show','params','include','options','create','body','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','filter','merge','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','color','emit','removeTags','download','join','root','server','files','attachments','transcript-%d-%s.zip','User','CmContact','firstName','lastName','Attachment','Messages','direction','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','closed','closedAt','basename','createReadStream','createWriteStream','out','System','secret','renderFile','views','downloadInteraction.html','transcript-','.pdf','createPdfFromHTML','log','err','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset'];(function(_0x460d2e,_0x57433d){var _0x411a05=function(_0x5d262e){while(--_0x5d262e){_0x460d2e['push'](_0x460d2e['shift']());}};_0x411a05(++_0x57433d);}(_0xccf4,0x19d));var _0x4ccf=function(_0xaf8c1f,_0x1c0c8d){_0xaf8c1f=_0xaf8c1f-0x0;var _0x58c6d8=_0xccf4[_0xaf8c1f];return _0x58c6d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ccf('0x0'));var zipdir=require(_0x4ccf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4ccf('0x2'));var BPromise=require(_0x4ccf('0x3'));var Mustache=require('mustache');var util=require(_0x4ccf('0x4'));var path=require(_0x4ccf('0x5'));var sox=require(_0x4ccf('0x6'));var csv=require(_0x4ccf('0x7'));var ejs=require(_0x4ccf('0x8'));var fs=require('fs');var fs_extra=require(_0x4ccf('0x9'));var _=require(_0x4ccf('0xa'));var squel=require(_0x4ccf('0xb'));var crypto=require('crypto');var jsforce=require(_0x4ccf('0xc'));var deskjs=require(_0x4ccf('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4ccf('0xe'));var Papa=require(_0x4ccf('0xf'));var Redis=require(_0x4ccf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4ccf('0x11'));var as=require(_0x4ccf('0x12'));var pdf=require(_0x4ccf('0x13'));var hardwareService=require(_0x4ccf('0x14'));var logger=require(_0x4ccf('0x15'))(_0x4ccf('0x16'));var utils=require(_0x4ccf('0x17'));var config=require(_0x4ccf('0x18'));var licenseUtil=require(_0x4ccf('0x19'));var db=require(_0x4ccf('0x1a'))['db'];config[_0x4ccf('0x1b')]=_['defaults'](config[_0x4ccf('0x1b')],{'host':_0x4ccf('0x1c'),'port':0x18eb});var socket=require(_0x4ccf('0x1d'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x4ccf('0x1e')](socket);function respondWithStatusCode(_0x193e37,_0x31bbe9){_0x31bbe9=_0x31bbe9||0xcc;return function(_0x4a5348){if(_0x4a5348){return _0x193e37[_0x4ccf('0x1f')](_0x31bbe9);}return _0x193e37[_0x4ccf('0x20')](_0x31bbe9)[_0x4ccf('0x21')]();};}function respondWithResult(_0x56ddb7,_0xafab5a){_0xafab5a=_0xafab5a||0xc8;return function(_0x28bf1b){if(_0x28bf1b){return _0x56ddb7[_0x4ccf('0x20')](_0xafab5a)[_0x4ccf('0x22')](_0x28bf1b);}};}function respondWithFilteredResult(_0x3c6e8e,_0x5c60be){return function(_0x386f28){if(_0x386f28){var _0x5b119c=_0x386f28[_0x4ccf('0x23')],_0x281494=_0x5c60be['offset'],_0x84c85d=_0x5c60be[_0x4ccf('0x24')]+_0x5c60be['limit'],_0x15b88e;if(_0x84c85d>=_0x5b119c){_0x84c85d=_0x5b119c;_0x15b88e=0xc8;}else{_0x15b88e=0xce;}_0x3c6e8e[_0x4ccf('0x20')](_0x15b88e);return _0x3c6e8e['set'](_0x4ccf('0x25'),_0x281494+'-'+_0x84c85d+'/'+_0x5b119c)[_0x4ccf('0x22')](_0x386f28);}return null;};}function patchUpdates(_0x442895){return function(_0x2fa2c4){try{jsonpatch[_0x4ccf('0x26')](_0x2fa2c4,_0x442895,!![]);}catch(_0x3714c9){return BPromise[_0x4ccf('0x27')](_0x3714c9);}return _0x2fa2c4['save']();};}function saveUpdates(_0x546abf,_0x39e9f2){return function(_0x1011c8){if(_0x1011c8){return _0x1011c8[_0x4ccf('0x28')](_0x546abf)[_0x4ccf('0x29')](function(_0x20dd2e){return _0x20dd2e;});}return null;};}function removeEntity(_0x42afc7,_0x27cb6a){return function(_0x325b31){if(_0x325b31){return _0x325b31['destroy']()[_0x4ccf('0x29')](function(){_0x42afc7['status'](0xcc)[_0x4ccf('0x21')]();});}};}function handleEntityNotFound(_0x2884e3,_0x4aaf87){return function(_0xfe03b8){if(!_0xfe03b8){_0x2884e3[_0x4ccf('0x1f')](0x194);}return _0xfe03b8;};}function handleError(_0x33d3e5,_0x40d56a){_0x40d56a=_0x40d56a||0x1f4;return function(_0x414b71){logger['error'](_0x414b71[_0x4ccf('0x2a')]);if(_0x414b71['name']){delete _0x414b71['name'];}_0x33d3e5[_0x4ccf('0x20')](_0x40d56a)[_0x4ccf('0x2b')](_0x414b71);};}function getInteractionUsers(_0x24117a,_0x34591b){return new BPromise(function(_0x25342f,_0x18cde3){try{if(_0x34591b[_0x24117a['id']]){_0x24117a['Users']=_[_0x4ccf('0x2c')](_0x34591b[_0x24117a['id']],function(_0x4f5be6){return{'id':_0x4f5be6['id'],'fullname':_0x4f5be6[_0x4ccf('0x2d')]};});}}catch(_0x5ebbc6){_0x18cde3(_0x5ebbc6);}_0x25342f(_0x24117a);});}function getInteractionTags(_0x290e67,_0x4b8f75){return new BPromise(function(_0x1a4c7f,_0x31aca7){try{if(_0x290e67['TagIds']){_0x290e67['Tags']=[];_0x290e67[_0x4ccf('0x2e')][_0x4ccf('0x2f')](',')[_0x4ccf('0x30')](function(_0x589832){_0x290e67[_0x4ccf('0x31')][_0x4ccf('0x32')](_0x4b8f75[_0x589832]);});}delete _0x290e67[_0x4ccf('0x2e')];}catch(_0x367e39){_0x31aca7(_0x367e39);}_0x1a4c7f(_0x290e67);});}function updateWhatsappInteraction(_0x19ee04,_0x5911ac,_0x1cb5cf){return new BPromise(function(_0x1d6d4b,_0x32bf58){return getInteractionUsers(_0x19ee04,_0x1cb5cf)[_0x4ccf('0x29')](function(_0x4983c8){return getInteractionTags(_0x4983c8,_0x5911ac);})[_0x4ccf('0x29')](function(_0x353b96){_0x1d6d4b(_0x353b96);})[_0x4ccf('0x33')](function(_0x42381f){_0x32bf58(_0x42381f);});});}exports[_0x4ccf('0x34')]=function(_0x1a49ff,_0x53fdab){var _0xbb4bcb={},_0x23a3f5={},_0x2e5e80={'count':0x0,'rows':[]};var _0x419137=_[_0x4ccf('0x2c')](db[_0x4ccf('0x35')][_0x4ccf('0x36')],function(_0xebc705){return{'name':_0xebc705[_0x4ccf('0x37')],'type':_0xebc705['type']['key']};});_0x23a3f5[_0x4ccf('0x38')]=_[_0x4ccf('0x2c')](_0x419137,_0x4ccf('0x39'));_0x23a3f5[_0x4ccf('0x3a')]=_['keys'](_0x1a49ff[_0x4ccf('0x3a')]);_0x23a3f5[_0x4ccf('0x3b')]=_[_0x4ccf('0x3c')](_0x23a3f5['model'],_0x23a3f5[_0x4ccf('0x3a')]);_0xbb4bcb['attributes']=_['intersection'](_0x23a3f5['model'],qs[_0x4ccf('0x3d')](_0x1a49ff[_0x4ccf('0x3a')][_0x4ccf('0x3d')]));_0xbb4bcb[_0x4ccf('0x3e')]=_0xbb4bcb['attributes'][_0x4ccf('0x3f')]?_0xbb4bcb['attributes']:_0x23a3f5[_0x4ccf('0x38')];if(!_0x1a49ff[_0x4ccf('0x3a')][_0x4ccf('0x40')](_0x4ccf('0x41'))){_0xbb4bcb[_0x4ccf('0x42')]=qs[_0x4ccf('0x42')](_0x1a49ff[_0x4ccf('0x3a')][_0x4ccf('0x42')]);_0xbb4bcb[_0x4ccf('0x24')]=qs[_0x4ccf('0x24')](_0x1a49ff[_0x4ccf('0x3a')]['offset']);}_0xbb4bcb[_0x4ccf('0x43')]=qs[_0x4ccf('0x44')](_0x1a49ff[_0x4ccf('0x3a')][_0x4ccf('0x44')]);_0xbb4bcb[_0x4ccf('0x45')]=qs[_0x4ccf('0x3b')](_[_0x4ccf('0x46')](_0x1a49ff[_0x4ccf('0x3a')],_0x23a3f5[_0x4ccf('0x3b')]),_0x419137);var _0x3b574d=[];var _0x303543=squel[_0x4ccf('0x47')]()['field']('id')[_0x4ccf('0x48')]('name')[_0x4ccf('0x48')]('color')[_0x4ccf('0x49')](_0x4ccf('0x4a'));var _0x2507ec=squel[_0x4ccf('0x47')]()['field'](_0x4ccf('0x4b'))[_0x4ccf('0x48')](_0x4ccf('0x4c'))['field']('ui.WhatsappInteractionId')['from'](_0x4ccf('0x4d'),'ui')['left_join'](_0x4ccf('0x4e'),'u',_0x4ccf('0x4f'));var _0x462572=squel['select']()[_0x4ccf('0x49')]('whatsapp_interactions','i')['left_join']('cm_contacts','c',_0x4ccf('0x50'))[_0x4ccf('0x51')](_0x4ccf('0x4e'),'o',_0x4ccf('0x52'))[_0x4ccf('0x51')]('whatsapp_accounts','a','a.id\x20=\x20i.WhatsappAccountId')[_0x4ccf('0x51')]('whatsapp_messages','me',_0x4ccf('0x53'))['left_join'](_0x4ccf('0x54'),'it',_0x4ccf('0x55'))[_0x4ccf('0x51')](_0x4ccf('0x4a'),'t',_0x4ccf('0x56'));var _0x45aad2=squel[_0x4ccf('0x57')]();var _0x2891f5=[];var _0x1ad60a=squel[_0x4ccf('0x57')]();var _0x1dc7c8;if(_0x1a49ff[_0x4ccf('0x3a')][_0x4ccf('0x58')]){_0x1dc7c8=as[_0x4ccf('0x59')](_0x1a49ff[_0x4ccf('0x3a')][_0x4ccf('0x58')]);var _0x3afa7d=_0x1dc7c8['sqlOperator'];for(var _0x77dde5=0x0;_0x77dde5<_0x1dc7c8['conditions'][_0x4ccf('0x3f')];_0x77dde5++){var _0x469e74=_0x1dc7c8[_0x4ccf('0x5a')][_0x77dde5];var _0x314668='i';var _0x18e33f=_['find'](_0x419137,[_0x4ccf('0x39'),_0x469e74['field']]);if(!_0x18e33f){switch(_0x469e74[_0x4ccf('0x48')]){case _0x4ccf('0x5b'):if(_0x469e74[_0x4ccf('0x5c')]==0x1){_0x462572[_0x4ccf('0x5d')]('`'+_0x469e74[_0x4ccf('0x48')]+'`\x20=\x200');}else{_0x462572[_0x4ccf('0x5d')]('`'+_0x469e74['field']+_0x4ccf('0x5e'));}break;case _0x4ccf('0x5f'):if(_0x469e74[_0x4ccf('0x60')]===_0x4ccf('0x61')){if(_0x469e74['value'][_0x4ccf('0x2f')]('\x20')['length']>0x1){_0x45aad2[_0x3afa7d](_0x4ccf('0x62'),qs[_0x4ccf('0x63')](_0x469e74['value']),null);}else{var _0x2b4329='%'+_0x469e74[_0x4ccf('0x5c')]+'%';_0x45aad2[_0x3afa7d](_0x4ccf('0x64'),_0x2b4329,_0x2b4329,_0x2b4329);}}else{_0x18e33f=_[_0x4ccf('0x65')](_0x419137,[_0x4ccf('0x39'),_0x4ccf('0x66')]);_0x469e74[_0x4ccf('0x48')]=_0x4ccf('0x66');_0x18cae1=as[_0x4ccf('0x67')](_0x314668,_0x18e33f[_0x4ccf('0x68')],_0x469e74);_0x45aad2[_0x3afa7d](_0x18cae1['text'],_0x18cae1[_0x4ccf('0x5c')][_0x4ccf('0x69')],_0x18cae1['value'][_0x4ccf('0x21')]);}break;case _0x4ccf('0x6a'):var _0x1bc818=_0x469e74[_0x4ccf('0x5c')][_0x4ccf('0x2f')](',')[_0x4ccf('0x2c')](function(_0x11e69f){return Number(_0x11e69f);});_0x1bc818[_0x4ccf('0x30')](function(_0x52cb80){_0x1ad60a['or'](_0x4ccf('0x6b'),'%,'+_0x52cb80+',%');});_0x2891f5=_['union'](_0x2891f5,_0x1bc818);break;case'User':if(_0x469e74[_0x4ccf('0x60')]==='$substring'){_0x45aad2[_0x3afa7d](_0x4ccf('0x6c'),'%'+_0x469e74[_0x4ccf('0x5c')]+'%',null);}else{_0x18e33f=_[_0x4ccf('0x65')](_0x419137,['name',_0x4ccf('0x6d')]);_0x469e74[_0x4ccf('0x48')]=_0x4ccf('0x6d');_0x18cae1=as[_0x4ccf('0x67')](_0x314668,_0x18e33f[_0x4ccf('0x68')],_0x469e74);_0x45aad2[_0x3afa7d](_0x18cae1['text'],_0x18cae1[_0x4ccf('0x5c')][_0x4ccf('0x69')],_0x18cae1['value'][_0x4ccf('0x21')]);}break;case'body':_0x18cae1=as[_0x4ccf('0x67')]('me',null,_0x469e74);_0x45aad2[_0x3afa7d](_0x18cae1['text'],_0x18cae1[_0x4ccf('0x5c')][_0x4ccf('0x69')],_0x18cae1[_0x4ccf('0x5c')]['end']);break;}}else{var _0x18cae1=as[_0x4ccf('0x67')](_0x314668,_0x18e33f['type'],_0x469e74);_0x45aad2[_0x3afa7d](_0x18cae1['text'],_0x18cae1[_0x4ccf('0x5c')][_0x4ccf('0x69')],_0x18cae1['value'][_0x4ccf('0x21')]);}}}else{var _0x305c05=_(_0x1a49ff['query'])[_0x4ccf('0x6e')]()[_0x4ccf('0x2c')](function(_0x4280fd){return _[_0x4ccf('0x6f')](_0x419137,[_0x4ccf('0x39'),_0x4280fd])?_0x4280fd:undefined;})[_0x4ccf('0x70')]()[_0x4ccf('0x5c')]();if(!_[_0x4ccf('0x71')](_0x305c05)){_0x305c05[_0x4ccf('0x30')](function(_0x18c92c){if(_0x18c92c==='WhatsappAccountId'){_0x462572[_0x4ccf('0x45')]('i.WhatsappAccountId\x20IN\x20?',[][_0x4ccf('0x72')](_0x1a49ff[_0x4ccf('0x3a')][_0x18c92c]));}else if(_0x18c92c===_0x4ccf('0x73')){var _0x1f7595=JSON[_0x4ccf('0x74')](_0x1a49ff[_0x4ccf('0x3a')][_0x18c92c])['$gte'];var _0x2d2b1b=JSON['parse'](_0x1a49ff[_0x4ccf('0x3a')][_0x18c92c])[_0x4ccf('0x75')];_0x462572[_0x4ccf('0x45')](_0x4ccf('0x76'),_0x1f7595,_0x2d2b1b);}else{if(_0x1a49ff['query'][_0x18c92c]===_0x4ccf('0x77')){_0x462572[_0x4ccf('0x45')]('i.'+_0x18c92c+_0x4ccf('0x78'));}else{_0x462572['where']('i.'+_0x18c92c+'\x20=\x20?',_0x1a49ff[_0x4ccf('0x3a')][_0x18c92c]);}}});}if(_0x1a49ff['query'][_0x4ccf('0x79')]){if(_0x1a49ff[_0x4ccf('0x3a')][_0x4ccf('0x79')]==0x1){_0x462572['having'](_0x4ccf('0x7a'));}else{_0x462572[_0x4ccf('0x5d')](_0x4ccf('0x7b'));}}if(_0x1a49ff[_0x4ccf('0x3a')][_0x4ccf('0x7c')]){_0x2891f5=_[_0x4ccf('0x7d')](_0x1a49ff['query']['tag'])?_0x1a49ff[_0x4ccf('0x3a')][_0x4ccf('0x7c')]:new Array(_0x1a49ff[_0x4ccf('0x3a')]['tag']);_0x2891f5[_0x4ccf('0x30')](function(_0x5190ab){_0x1ad60a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5190ab+',%');});}if(_0x1a49ff['query']['filter']){var _0x1aef31=_0x1a49ff[_0x4ccf('0x3a')]['filter'][_0x4ccf('0x7e')]('\x5c','\x5c\x5c')[_0x4ccf('0x7e')](/'/g,'\x27\x27');if(qs[_0x4ccf('0x7f')](_0x1aef31)){_0x45aad2['or']('i.id\x20LIKE\x20?',_0x1aef31+'%')['or'](_0x4ccf('0x80'),_0x1aef31+'%');}else{_0x45aad2['or'](_0x4ccf('0x81'),qs[_0x4ccf('0x63')](_0x1aef31))['or'](_0x4ccf('0x82'),_0x1aef31+'%');}}}_0x462572[_0x4ccf('0x45')](_0x45aad2);_0x462572[_0x4ccf('0x83')](_0x4ccf('0x84'));var _0x3f1dd6={'type':db['Sequelize']['QueryTypes'][_0x4ccf('0x85')],'raw':!![]};var _0x5d4a93=_0x462572[_0x4ccf('0x86')]();_0x5d4a93[_0x4ccf('0x48')](_0x4ccf('0x84'));_0x5d4a93['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4ccf('0x5b'));if(_0xbb4bcb[_0x4ccf('0x43')]){_0xbb4bcb[_0x4ccf('0x43')][_0x4ccf('0x30')](function(_0x4f67da){var _0x515ed5=_0x4f67da[0x0]===_0x4ccf('0x87')?_0x4f67da[0x0]:'i.'+_0x4f67da[0x0];_0x462572[_0x4ccf('0x43')](_0x515ed5,_0x4f67da[0x1]==='DESC'?![]:!![]);});}if(!_[_0x4ccf('0x71')](_0x2891f5)){_0x462572[_0x4ccf('0x5d')](_0x1ad60a);_0x5d4a93[_0x4ccf('0x45')]('t.id\x20IN\x20?',_0x2891f5);}BPromise[_0x4ccf('0x88')]()[_0x4ccf('0x29')](function(){if(!_0x1dc7c8){if(_0x1a49ff[_0x4ccf('0x3a')]['WhatsappAccountId'])return;_0x5d4a93[_0x4ccf('0x45')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x462572['where'](_0x4ccf('0x89'));return;}if(_0x1a49ff[_0x4ccf('0x8a')][_0x4ccf('0x8b')]!=='agent')return;return _0x1a49ff[_0x4ccf('0x8a')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x4ccf('0x29')](function(_0x465177){if(_[_0x4ccf('0x71')](_0x465177)){_0x5d4a93[_0x4ccf('0x45')](_0x4ccf('0x8c'));_0x462572[_0x4ccf('0x45')](_0x4ccf('0x8c'));}else{_0x5d4a93[_0x4ccf('0x45')]('i.WhatsappAccountId\x20IN\x20?',_[_0x4ccf('0x2c')](_0x465177,'id'));_0x462572[_0x4ccf('0x45')](_0x4ccf('0x8d'),_[_0x4ccf('0x2c')](_0x465177,'id'));}});})[_0x4ccf('0x29')](function(){if(_0x1a49ff[_0x4ccf('0x8a')][_0x4ccf('0x8b')]===_0x4ccf('0x8e')&&!_0x1dc7c8&&!_0x1a49ff[_0x4ccf('0x3a')][_0x4ccf('0x8f')])return[];return db[_0x4ccf('0x90')][_0x4ccf('0x3a')](_0x5d4a93[_0x4ccf('0x91')](),_0x3f1dd6);})['then'](function(_0x2f6270){_0x2e5e80['count']=_0x2f6270[_0x4ccf('0x3f')];if(_0x2e5e80[_0x4ccf('0x23')]===0x0)return[];return db[_0x4ccf('0x90')][_0x4ccf('0x3a')](_0x303543['toString'](),_0x3f1dd6)[_0x4ccf('0x29')](function(_0x5b7ae8){_0x3b574d=_['keyBy'](_0x5b7ae8,'id');_0x3f1dd6=_['merge'](_0x3f1dd6,{'model':db[_0x4ccf('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1a49ff['query'][_0x4ccf('0x3d')]){_0xbb4bcb[_0x4ccf('0x3e')][_0x4ccf('0x30')](function(_0x2b1aea){_0x462572[_0x4ccf('0x48')]('i.'+_0x2b1aea);});}else{_0x462572[_0x4ccf('0x48')](_0x4ccf('0x92'),_0x4ccf('0x5b'));_0x462572[_0x4ccf('0x48')](_0x4ccf('0x93'),_0x4ccf('0x94'));_0x462572['field'](_0x4ccf('0x95'),_0x4ccf('0x96'));_0x462572[_0x4ccf('0x48')](_0x4ccf('0x97'),_0x4ccf('0x87'));_0x462572[_0x4ccf('0x48')](_0x4ccf('0x98'));_0x462572[_0x4ccf('0x48')](_0x4ccf('0x99'),'Contact.firstName');_0x462572['field'](_0x4ccf('0x9a'),'Contact.lastName');_0x462572[_0x4ccf('0x48')](_0x4ccf('0x9b'),_0x4ccf('0x9c'));_0x462572[_0x4ccf('0x48')]('c.phone',_0x4ccf('0x9d'));_0x462572[_0x4ccf('0x48')]('c.mobile','Contact.mobile');_0x462572[_0x4ccf('0x48')]('c.fax',_0x4ccf('0x9e'));_0x462572['field'](_0x4ccf('0x9f'),_0x4ccf('0xa0'));_0x462572[_0x4ccf('0x48')]('o.internal',_0x4ccf('0xa1'));_0x462572[_0x4ccf('0x48')](_0x4ccf('0xa2'),_0x4ccf('0x2e'));}if(_0xbb4bcb['limit'])_0x462572['limit'](_0xbb4bcb[_0x4ccf('0x42')]);if(_0xbb4bcb[_0x4ccf('0x24')])_0x462572[_0x4ccf('0x24')](_0xbb4bcb[_0x4ccf('0x24')]);return db[_0x4ccf('0x90')][_0x4ccf('0x3a')](_0x462572[_0x4ccf('0x91')](),_0x3f1dd6);})['then'](function(_0x4f3a4d){_0x2507ec['where']('ui.WhatsappInteractionId\x20IN\x20?',_['map'](_0x4f3a4d,'id'));return db[_0x4ccf('0x90')]['query'](_0x2507ec['toString'](),_0x3f1dd6)[_0x4ccf('0x29')](function(_0x52caa9){var _0x552630=_[_0x4ccf('0xa3')](_0x52caa9,_0x4ccf('0xa4'));var _0x15fad9=[];_0x4f3a4d[_0x4ccf('0x30')](function(_0xcd389d){_0x15fad9[_0x4ccf('0x32')](updateWhatsappInteraction(_0xcd389d,_0x3b574d,_0x552630));});return BPromise[_0x4ccf('0xa5')](_0x15fad9);});});})[_0x4ccf('0x29')](function(_0x3a60a2){_0x2e5e80[_0x4ccf('0xa6')]=_0x3a60a2;return _0x2e5e80;})[_0x4ccf('0x29')](respondWithFilteredResult(_0x53fdab,_0xbb4bcb))[_0x4ccf('0x33')](handleError(_0x53fdab,null));};exports[_0x4ccf('0xa7')]=function(_0x15d83f,_0xaaf9d7){var _0x5b9df1={'raw':![],'where':{'id':_0x15d83f[_0x4ccf('0xa8')]['id']}},_0x3e4c05={};_0x3e4c05[_0x4ccf('0x38')]=_[_0x4ccf('0x6e')](db[_0x4ccf('0x35')][_0x4ccf('0x36')]);_0x3e4c05['query']=_[_0x4ccf('0x6e')](_0x15d83f['query']);_0x3e4c05[_0x4ccf('0x3b')]=_[_0x4ccf('0x3c')](_0x3e4c05[_0x4ccf('0x38')],_0x3e4c05['query']);_0x5b9df1[_0x4ccf('0x3e')]=_[_0x4ccf('0x3c')](_0x3e4c05[_0x4ccf('0x38')],qs[_0x4ccf('0x3d')](_0x15d83f[_0x4ccf('0x3a')][_0x4ccf('0x3d')]));_0x5b9df1[_0x4ccf('0x3e')]=_0x5b9df1[_0x4ccf('0x3e')][_0x4ccf('0x3f')]?_0x5b9df1[_0x4ccf('0x3e')]:_0x3e4c05[_0x4ccf('0x38')];if(_0x15d83f['query']['includeAll']){_0x5b9df1[_0x4ccf('0xa9')]=[{'all':!![]}];}_0x5b9df1=_['merge']({},_0x5b9df1,_0x15d83f[_0x4ccf('0xaa')]);return db[_0x4ccf('0x35')][_0x4ccf('0x65')](_0x5b9df1)[_0x4ccf('0x29')](handleEntityNotFound(_0xaaf9d7,null))[_0x4ccf('0x29')](respondWithResult(_0xaaf9d7,null))[_0x4ccf('0x33')](handleError(_0xaaf9d7,null));};exports['create']=function(_0x3a61d6,_0x2ad648){return db[_0x4ccf('0x35')][_0x4ccf('0xab')](_0x3a61d6[_0x4ccf('0xac')],{})[_0x4ccf('0x29')](respondWithResult(_0x2ad648,0xc9))[_0x4ccf('0x33')](handleError(_0x2ad648,null));};exports[_0x4ccf('0x28')]=function(_0x31a1b9,_0x57721a){if(_0x31a1b9['body']['id']){delete _0x31a1b9[_0x4ccf('0xac')]['id'];}return db[_0x4ccf('0x35')][_0x4ccf('0x65')]({'where':{'id':_0x31a1b9[_0x4ccf('0xa8')]['id']}})['then'](handleEntityNotFound(_0x57721a,null))[_0x4ccf('0x29')](saveUpdates(_0x31a1b9[_0x4ccf('0xac')],null))[_0x4ccf('0x29')](respondWithResult(_0x57721a,null))[_0x4ccf('0x33')](handleError(_0x57721a,null));};exports['destroy']=function(_0x4e94d0,_0x2a9fe7){return db[_0x4ccf('0x35')]['find']({'where':{'id':_0x4e94d0['params']['id']}})['then'](handleEntityNotFound(_0x2a9fe7,null))[_0x4ccf('0x29')](removeEntity(_0x2a9fe7,null))[_0x4ccf('0x33')](handleError(_0x2a9fe7,null));};exports[_0x4ccf('0xad')]=function(_0x1230e1,_0x2f170b){return db['WhatsappInteraction'][_0x4ccf('0xad')]()['then'](respondWithResult(_0x2f170b,null))[_0x4ccf('0x33')](handleError(_0x2f170b,null));};exports[_0x4ccf('0xae')]=function(_0x1d26d4,_0xd68606,_0x16256e){return db[_0x4ccf('0xaf')][_0x4ccf('0x65')]({'where':{'id':_0x1d26d4[_0x4ccf('0xa8')]['id']}})[_0x4ccf('0x29')](handleEntityNotFound(_0xd68606,null))[_0x4ccf('0x29')](function(_0x401f10){if(_0x401f10){return _0x401f10['addMessage'](_0x1d26d4[_0x4ccf('0xac')][_0x4ccf('0xb0')],_[_0x4ccf('0xb1')](_0x1d26d4[_0x4ccf('0xac')],[_0x4ccf('0xb0'),'id'])||{});}})[_0x4ccf('0x29')](respondWithResult(_0xd68606,null))['catch'](handleError(_0xd68606,null));};exports[_0x4ccf('0xb2')]=function(_0x4a7bac,_0x26758b,_0x20c0fa){var _0x108d94={'raw':![],'where':{}};var _0x4204ed={};var _0x2b4a77={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x4ccf('0xb3')]({'where':{'id':_0x4a7bac[_0x4ccf('0xa8')]['id']}})[_0x4ccf('0x29')](handleEntityNotFound(_0x26758b,null))['then'](function(_0x27d940){if(_0x27d940){_0x4204ed[_0x4ccf('0x38')]=_[_0x4ccf('0x6e')](db[_0x4ccf('0xaf')][_0x4ccf('0x36')]);_0x4204ed[_0x4ccf('0x3a')]=_[_0x4ccf('0x6e')](_0x4a7bac[_0x4ccf('0x3a')]);_0x4204ed[_0x4ccf('0x3b')]=_[_0x4ccf('0x3c')](_0x4204ed['model'],_0x4204ed['query']);_0x108d94[_0x4ccf('0x3e')]=_[_0x4ccf('0x3c')](_0x4204ed[_0x4ccf('0x38')],qs[_0x4ccf('0x3d')](_0x4a7bac[_0x4ccf('0x3a')][_0x4ccf('0x3d')]));_0x108d94[_0x4ccf('0x3e')]=_0x108d94[_0x4ccf('0x3e')][_0x4ccf('0x3f')]?_0x108d94[_0x4ccf('0x3e')]:_0x4204ed['model'];if(!_0x4a7bac[_0x4ccf('0x3a')][_0x4ccf('0x40')](_0x4ccf('0x41'))){_0x108d94[_0x4ccf('0x42')]=qs['limit'](_0x4a7bac['query'][_0x4ccf('0x42')]);_0x108d94[_0x4ccf('0x24')]=qs[_0x4ccf('0x24')](_0x4a7bac['query'][_0x4ccf('0x24')]);}_0x108d94[_0x4ccf('0x43')]=qs[_0x4ccf('0x44')](_0x4a7bac[_0x4ccf('0x3a')]['sort']);_0x108d94['where']=qs[_0x4ccf('0x3b')](_[_0x4ccf('0x46')](_0x4a7bac[_0x4ccf('0x3a')],_0x4204ed[_0x4ccf('0x3b')]));_0x108d94[_0x4ccf('0x45')]['WhatsappInteractionId']=_0x27d940['id'];if(_0x4a7bac[_0x4ccf('0x3a')][_0x4ccf('0xb4')]){_0x108d94['where']=_[_0x4ccf('0xb5')](_0x108d94[_0x4ccf('0x45')],{'$or':_[_0x4ccf('0x2c')](_0x108d94['attributes'],function(_0x5e1497){var _0x1ad439={};_0x1ad439[_0x5e1497]={'$like':'%'+_0x4a7bac['query']['filter']+'%'};return _0x1ad439;})});}if(_0x4a7bac[_0x4ccf('0x3a')][_0x4ccf('0xb6')]){var _0x42b41d=_0x4a7bac['query'][_0x4ccf('0xb6')]['split'](',');var _0x2933ac={};_0x2933ac[_0x42b41d[0x0]]={'$gte':moment(_0x42b41d[0x1])[_0x4ccf('0xb7')](_0x4ccf('0xb8'))};_0x108d94['where']=_['merge'](_0x108d94[_0x4ccf('0x45')],_0x2933ac);}_0x108d94=_['merge']({},_0x108d94,_0x4a7bac['options']);return db[_0x4ccf('0xaf')]['count']({'where':_0x108d94[_0x4ccf('0x45')]})[_0x4ccf('0x29')](function(_0x29645b){_0x2b4a77[_0x4ccf('0x23')]=_0x29645b;if(_0x4a7bac[_0x4ccf('0x3a')]['includeAll']){_0x108d94['include']=[{'all':!![]}];}return db[_0x4ccf('0xaf')][_0x4ccf('0xb9')](_0x108d94);})[_0x4ccf('0x29')](function(_0x4f237c){_0x2b4a77['rows']=_0x4f237c;return _0x2b4a77;});}})['then'](respondWithFilteredResult(_0x26758b,_0x108d94))[_0x4ccf('0x33')](handleError(_0x26758b,null));};exports['addTags']=function(_0xf64a16,_0x4e85d0,_0x12b824){return db[_0x4ccf('0x35')][_0x4ccf('0x65')]({'where':{'id':_0xf64a16[_0x4ccf('0xa8')]['id']}})['then'](handleEntityNotFound(_0x4e85d0,null))[_0x4ccf('0x29')](function(_0x428157){if(_0x428157){return _0x428157['setTags'](_0xf64a16[_0x4ccf('0xac')][_0x4ccf('0xb0')],_[_0x4ccf('0xb1')](_0xf64a16[_0x4ccf('0xac')],[_0x4ccf('0xb0'),'id'])||{})['spread'](function(){return db[_0x4ccf('0x6a')][_0x4ccf('0xb9')]({'attributes':['id',_0x4ccf('0x39'),_0x4ccf('0xba')],'where':{'id':_0xf64a16['body'][_0x4ccf('0xb0')]}});})[_0x4ccf('0x29')](function(_0x657226){socket[_0x4ccf('0xbb')]('whatsappInteractionTags:save',{'id':Number(_0xf64a16[_0x4ccf('0xa8')]['id']),'tags':_0x657226||[]});return{'id':Number(_0xf64a16[_0x4ccf('0xa8')]['id']),'tags':_0x657226||[]};});}})[_0x4ccf('0x29')](respondWithResult(_0x4e85d0,null))['catch'](handleError(_0x4e85d0,null));};exports[_0x4ccf('0xbc')]=function(_0x212583,_0x685f51,_0x10353a){return db['WhatsappInteraction'][_0x4ccf('0x65')]({'where':{'id':_0x212583[_0x4ccf('0xa8')]['id']}})[_0x4ccf('0x29')](handleEntityNotFound(_0x685f51,null))[_0x4ccf('0x29')](function(_0x2e8f0c){if(_0x2e8f0c){return _0x2e8f0c[_0x4ccf('0xbc')](_0x212583[_0x4ccf('0x3a')][_0x4ccf('0xb0')]);}})['then'](respondWithStatusCode(_0x685f51,null))[_0x4ccf('0x33')](handleError(_0x685f51,null));};exports[_0x4ccf('0xbd')]=function(_0x423bd7,_0x50c3e4){var _0x39bd02=moment()['unix']()[_0x4ccf('0x91')]();var _0x2c39ec=path[_0x4ccf('0xbe')](config[_0x4ccf('0xbf')],_0x4ccf('0xc0'),_0x4ccf('0xc1'),'tmp');var _0x4411ef=path[_0x4ccf('0xbe')](config['root'],_0x4ccf('0xc0'),_0x4ccf('0xc1'),_0x4ccf('0xc2'));var _0x488165=path['join'](_0x2c39ec,_0x39bd02);var _0x4c6869=util[_0x4ccf('0xb7')](_0x4ccf('0xc3'),_0x423bd7[_0x4ccf('0xa8')]['id'],_0x39bd02);var _0xf2e350=path[_0x4ccf('0xbe')](_0x2c39ec,_0x4c6869);var _0x5ba97b=[];_0x5ba97b[_0x4ccf('0x32')]({'model':db[_0x4ccf('0xc4')],'as':_0x4ccf('0xc4'),'attributes':['id','fullname'],'raw':!![]});_0x5ba97b[_0x4ccf('0x32')]({'model':db[_0x4ccf('0xc5')],'as':'Contact','attributes':['id',_0x4ccf('0xc6'),_0x4ccf('0xc7')],'raw':!![]});if(_0x423bd7['query'][_0x4ccf('0xc2')]){_0x5ba97b['push']({'model':db[_0x4ccf('0xc8')],'as':_0x4ccf('0xc8'),'raw':!![]});}var _0x30ddbc=[{'model':db[_0x4ccf('0xaf')],'as':_0x4ccf('0xc9'),'attributes':['id',_0x4ccf('0xac'),_0x4ccf('0x73'),_0x4ccf('0xca'),'secret','read'],'include':_0x5ba97b}];_0x30ddbc[_0x4ccf('0x32')]({'model':db[_0x4ccf('0xcb')],'as':_0x4ccf('0xcc'),'attributes':['id','name']});_0x30ddbc[_0x4ccf('0x32')]({'model':db[_0x4ccf('0xc4')],'as':_0x4ccf('0xcd'),'attributes':['id',_0x4ccf('0x2d')]});return db['WhatsappInteraction'][_0x4ccf('0x65')]({'where':{'id':_0x423bd7[_0x4ccf('0xa8')]['id']},'include':_0x30ddbc})['then'](handleEntityNotFound(_0x50c3e4,null))[_0x4ccf('0x29')](function(_0x6681cc){if(_0x6681cc){var _0x1cc546=_0x6681cc[_0x4ccf('0xce')]({'plain':!![]});fs[_0x4ccf('0xcf')](_0x488165);var _0x368ad6={'channel':_0x4ccf('0xd0'),'account':_0x1cc546[_0x4ccf('0xcc')][_0x4ccf('0x39')],'agent':_0x1cc546[_0x4ccf('0xcd')]?_0x1cc546[_0x4ccf('0xcd')][_0x4ccf('0x2d')]:'N.A.','createdAt':moment(_0x1cc546[_0x4ccf('0x73')])[_0x4ccf('0xb7')](_0x4ccf('0xb8'))[_0x4ccf('0x91')](),'closedAt':_0x1cc546[_0x4ccf('0xd1')]?moment(_0x1cc546[_0x4ccf('0xd2')])[_0x4ccf('0xb7')](_0x4ccf('0xb8'))['toString']():'','disposition':_0x1cc546['disposition'],'messages':_(_0x1cc546['Messages'])['filter']({'secret':![]})[_0x4ccf('0x2c')](function(_0x4f50f6){if(_0x4f50f6[_0x4ccf('0xc8')]){var _0x59e5e2=path[_0x4ccf('0xbe')](_0x4411ef,_0x4f50f6['Attachment'][_0x4ccf('0xd3')]);if(fs['existsSync'](_0x59e5e2)){fs[_0x4ccf('0xd4')](_0x59e5e2)['pipe'](fs[_0x4ccf('0xd5')](path[_0x4ccf('0xbe')](_0x488165,_0x4f50f6[_0x4ccf('0xc8')][_0x4ccf('0xd3')])));}}return{'date':moment(_0x4f50f6[_0x4ccf('0x73')])[_0x4ccf('0xb7')](_0x4ccf('0xb8'))['toString'](),'sender':_0x4f50f6[_0x4ccf('0xca')]===_0x4ccf('0xd6')?_0x4f50f6[_0x4ccf('0xc4')]?_0x4f50f6[_0x4ccf('0xc4')][_0x4ccf('0x2d')]:_0x4ccf('0xd7'):_0x4f50f6[_0x4ccf('0x5f')][_0x4ccf('0xc6')]+(_0x4f50f6[_0x4ccf('0x5f')]['lastName']?'\x20'+_0x4f50f6[_0x4ccf('0x5f')][_0x4ccf('0xc7')]:''),'body':_0x4f50f6['Attachment']?_0x4f50f6['Attachment'][_0x4ccf('0xd3')]:_0x4f50f6[_0x4ccf('0xac')],'direction':_0x4f50f6['direction']===_0x4ccf('0xd6')?'A':'C','secret':_0x4f50f6[_0x4ccf('0xd8')],'read':_0x4f50f6[_0x4ccf('0x79')],'attachment':_0x4f50f6[_0x4ccf('0xc8')]};})[_0x4ccf('0x5c')]()};return ejs[_0x4ccf('0xd9')](path[_0x4ccf('0xbe')](config['root'],_0x4ccf('0xc0'),_0x4ccf('0xda'),_0x4ccf('0xdb')),{'interaction':_0x368ad6})[_0x4ccf('0x29')](function(_0x3c70cd){var _0x595df9=path[_0x4ccf('0xbe')](_0x488165,_0x4ccf('0xdc')+_0x1cc546['id']+'-'+_0x39bd02+_0x4ccf('0xdd'));var _0x4a055d={'path':_0x595df9,'channel':_0x4ccf('0xd0'),'interactionId':_0x1cc546['id']};return pdf[_0x4ccf('0xde')](_0x3c70cd,_0x4a055d);})['then'](function(){return new BPromise(function(_0x59fc3e,_0xe999f1){zipdir(_0x488165,{'saveTo':_0xf2e350},function(_0x26490b,_0x477072){if(_0x26490b)return _0xe999f1(_0x26490b);return _0x59fc3e(_0x477072);});})[_0x4ccf('0x29')](function(){return new BPromise(function(_0x2c93d9,_0x3c5817){rimraf(_0x488165,function(_0x290e5c){if(_0x290e5c)_0x3c5817(_0x290e5c);return _0x2c93d9();});});})['then'](function(){return _0x50c3e4['download'](_0xf2e350,_0x4c6869,function(_0x27a665){if(_0x27a665){console[_0x4ccf('0xdf')](_0x4ccf('0xe0'),_0x27a665);}else{fs['unlinkSync'](_0xf2e350);}});});});}else{return _0x50c3e4['sendStatus'](0xc8);}})[_0x4ccf('0x33')](handleError(_0x50c3e4,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 052cfbe..c4af6bf 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 _0xbd9b=['setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage'];(function(_0x333b60,_0x1404dd){var _0x225cfd=function(_0x25e082){while(--_0x25e082){_0x333b60['push'](_0x333b60['shift']());}};_0x225cfd(++_0x1404dd);}(_0xbd9b,0x1af));var _0xbbd9=function(_0x438aa0,_0x134c3d){_0x438aa0=_0x438aa0-0x0;var _0x12975c=_0xbd9b[_0x438aa0];return _0x12975c;};'use strict';var EventEmitter=require(_0xbbd9('0x0'));var WhatsappInteraction=require(_0xbbd9('0x1'))['db'][_0xbbd9('0x2')];var WhatsappMessage=require(_0xbbd9('0x1'))['db'][_0xbbd9('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xbbd9('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbbd9('0x5'),'afterDestroy':_0xbbd9('0x6')};function emitEvent(_0x5421c4){return function(_0x50e161,_0x5b73b5,_0x405391){_0x50e161[_0xbbd9('0x7')]({'attributes':['id'],'raw':!![]})[_0xbbd9('0x8')](function(_0x4b969d){_0x50e161[_0xbbd9('0x9')](_0xbbd9('0xa'),_0x4b969d[_0xbbd9('0xb')](function(_0x2a1a40){return{'id':_0x2a1a40['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x50e161['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbbd9('0x8')](function(_0x144906){_0x50e161[_0xbbd9('0x9')]('unreadMessages',_0x144906['length']);WhatsappInteractionEvents[_0xbbd9('0xc')](_0x5421c4+':'+_0x50e161['id'],_0x50e161);WhatsappInteractionEvents['emit'](_0x5421c4,_0x50e161);_0x405391(null);})['catch'](_0x405391(null));};}for(var e in events){if(events[_0xbbd9('0xd')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xbbd9('0xe')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x1d13=['../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','update','remove','getUsers','then','Users','map','findAll','unreadMessages','length','emit','hook','exports','events'];(function(_0x513fae,_0x3f2c52){var _0x52706b=function(_0x453fa1){while(--_0x453fa1){_0x513fae['push'](_0x513fae['shift']());}};_0x52706b(++_0x3f2c52);}(_0x1d13,0xa9));var _0x31d1=function(_0x46ed35,_0x2f088e){_0x46ed35=_0x46ed35-0x0;var _0x3eb6ef=_0x1d13[_0x46ed35];return _0x3eb6ef;};'use strict';var EventEmitter=require(_0x31d1('0x0'));var WhatsappInteraction=require(_0x31d1('0x1'))['db'][_0x31d1('0x2')];var WhatsappMessage=require(_0x31d1('0x1'))['db'][_0x31d1('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x31d1('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x31d1('0x5'),'afterDestroy':_0x31d1('0x6')};function emitEvent(_0x2ca955){return function(_0xe94a14,_0x492ad9,_0x1a7400){_0xe94a14[_0x31d1('0x7')]({'attributes':['id'],'raw':!![]})[_0x31d1('0x8')](function(_0x230c28){_0xe94a14['setDataValue'](_0x31d1('0x9'),_0x230c28[_0x31d1('0xa')](function(_0x140f8e){return{'id':_0x140f8e['id']};}));return WhatsappMessage[_0x31d1('0xb')]({'where':{'WhatsappInteractionId':_0xe94a14['id'],'direction':'in','read':![]},'raw':!![]});})[_0x31d1('0x8')](function(_0x1198c9){_0xe94a14['setDataValue'](_0x31d1('0xc'),_0x1198c9[_0x31d1('0xd')]);WhatsappInteractionEvents[_0x31d1('0xe')](_0x2ca955+':'+_0xe94a14['id'],_0xe94a14);WhatsappInteractionEvents['emit'](_0x2ca955,_0xe94a14);_0x1a7400(null);})['catch'](_0x1a7400(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x31d1('0xf')](e,emitEvent(event));}}module[_0x31d1('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 02fef9e..419ad2e 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 _0x5d04=['format','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','define','WhatsappInteraction','changed','closed','closedAt'];(function(_0x3e9f91,_0x6b967f){var _0x12887a=function(_0x4cd5c4){while(--_0x4cd5c4){_0x3e9f91['push'](_0x3e9f91['shift']());}};_0x12887a(++_0x6b967f);}(_0x5d04,0x17a));var _0x45d0=function(_0x1aae91,_0x14b4aa){_0x1aae91=_0x1aae91-0x0;var _0x5066d1=_0x5d04[_0x1aae91];return _0x5066d1;};'use strict';var _=require(_0x45d0('0x0'));var util=require(_0x45d0('0x1'));var logger=require(_0x45d0('0x2'))('api');var moment=require(_0x45d0('0x3'));var BPromise=require(_0x45d0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x45d0('0x5'));var config=require(_0x45d0('0x6'));var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x4bf2a7,_0x22440c){return _0x4bf2a7[_0x45d0('0x7')](_0x45d0('0x8'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xab7068,_0x951bd1,_0x1969a0){if(_0xab7068[_0x45d0('0x9')](_0x45d0('0xa'))){_0xab7068[_0x45d0('0xb')]=moment()[_0x45d0('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1969a0(null,_0xab7068);}}});}; \ No newline at end of file +var _0x970a=['WhatsappInteraction','whatsapp_interactions','closedAt','format','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define'];(function(_0x192545,_0x1c44dc){var _0x171917=function(_0x5781ae){while(--_0x5781ae){_0x192545['push'](_0x192545['shift']());}};_0x171917(++_0x1c44dc);}(_0x970a,0x162));var _0xa970=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x970a[_0x40220a];return _0x3903cc;};'use strict';var _=require('lodash');var util=require(_0xa970('0x0'));var logger=require(_0xa970('0x1'))('api');var moment=require(_0xa970('0x2'));var BPromise=require(_0xa970('0x3'));var rp=require(_0xa970('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa970('0x5'));var config=require(_0xa970('0x6'));var attributes=require(_0xa970('0x7'));module[_0xa970('0x8')]=function(_0x558494,_0x31560b){return _0x558494[_0xa970('0x9')](_0xa970('0xa'),attributes,{'tableName':_0xa970('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x105145,_0xa56db1,_0x2415fb){if(_0x105145['changed']('closed')){_0x105145[_0xa970('0xc')]=moment()[_0xa970('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2415fb(null,_0x105145);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index e4b0d6f..03234e8 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 _0x6331=['catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','where','attributes','limit','AddTagsToWhatsappInteraction','addTags','body','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','./whatsappInteraction.socket','request','then','info','debug','request\x20sent','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result'];(function(_0x57b064,_0x4f1821){var _0x400113=function(_0x2c9f15){while(--_0x2c9f15){_0x57b064['push'](_0x57b064['shift']());}};_0x400113(++_0x4f1821);}(_0x6331,0x1ef));var _0x1633=function(_0x300e2c,_0x49832f){_0x300e2c=_0x300e2c-0x0;var _0xcad935=_0x6331[_0x300e2c];return _0xcad935;};'use strict';var _=require(_0x1633('0x0'));var util=require(_0x1633('0x1'));var moment=require('moment');var BPromise=require(_0x1633('0x2'));var rs=require(_0x1633('0x3'));var fs=require('fs');var Redis=require(_0x1633('0x4'));var db=require(_0x1633('0x5'))['db'];var utils=require(_0x1633('0x6'));var logger=require(_0x1633('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1633('0x8'));var client=jayson[_0x1633('0x9')][_0x1633('0xa')]({'port':0x232a});config['redis']=_[_0x1633('0xb')](config[_0x1633('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1633('0xc')]));require(_0x1633('0xd'))['register'](socket);function respondWithRpcPromise(_0x506bf7,_0x18fd9e,_0x55cc89){return new BPromise(function(_0xe91bb2,_0x60645b){return client[_0x1633('0xe')](_0x506bf7,_0x55cc89)[_0x1633('0xf')](function(_0x534f7d){logger[_0x1633('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x18fd9e,'request\x20sent');logger[_0x1633('0x11')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x18fd9e,_0x1633('0x12'),JSON[_0x1633('0x13')](_0x534f7d));if(_0x534f7d[_0x1633('0x14')]){if(_0x534f7d[_0x1633('0x14')][_0x1633('0x15')]===0x1f4){logger['error'](_0x1633('0x16'),_0x18fd9e,_0x534f7d[_0x1633('0x14')][_0x1633('0x17')]);return _0x60645b(_0x534f7d[_0x1633('0x14')][_0x1633('0x17')]);}logger[_0x1633('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x18fd9e,_0x534f7d['error'][_0x1633('0x17')]);return _0xe91bb2(_0x534f7d[_0x1633('0x14')][_0x1633('0x17')]);}else{logger[_0x1633('0x10')](_0x1633('0x16'),_0x18fd9e,'request\x20sent');_0xe91bb2(_0x534f7d[_0x1633('0x18')][_0x1633('0x17')]);}})[_0x1633('0x19')](function(_0x286607){logger[_0x1633('0x14')](_0x1633('0x16'),_0x18fd9e,_0x286607);_0x60645b(_0x286607);});});}exports[_0x1633('0x1a')]=function(_0x1271a8){var _0xd3278f=this;return new Promise(function(_0x2dc438,_0x439a50){return db[_0x1633('0x1b')][_0x1633('0x1c')](_0x1271a8['body'],{'raw':_0x1271a8['options']?_0x1271a8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1271a8[_0x1633('0x1d')]?_0x1271a8[_0x1633('0x1d')][_0x1633('0x1e')]||null:null,'attributes':_0x1271a8['options']?_0x1271a8[_0x1633('0x1d')][_0x1633('0x1f')]||null:null,'limit':_0x1271a8[_0x1633('0x1d')]?_0x1271a8[_0x1633('0x1d')][_0x1633('0x20')]||null:null})[_0x1633('0xf')](function(_0x5479a0){logger['info'](_0x1633('0x1a'),_0x1271a8);logger[_0x1633('0x11')](_0x1633('0x1a'),_0x1271a8,JSON[_0x1633('0x13')](_0x5479a0));_0x2dc438(_0x5479a0);})[_0x1633('0x19')](function(_0x3d14b1){logger[_0x1633('0x14')](_0x1633('0x1a'),_0x3d14b1[_0x1633('0x17')],_0x1271a8);_0x439a50(_0xd3278f[_0x1633('0x14')](0x1f4,_0x3d14b1[_0x1633('0x17')]));});});};exports[_0x1633('0x21')]=function(_0x1154d8){return new Promise(function(_0x23ed3b,_0x1bbd8b){return db[_0x1633('0x1b')]['find']({'where':_0x1154d8['options']?_0x1154d8[_0x1633('0x1d')][_0x1633('0x1e')]||null:null})[_0x1633('0xf')](function(_0x15f2ef){if(_0x15f2ef){return _0x15f2ef[_0x1633('0x22')](_0x1154d8[_0x1633('0x23')][_0x1633('0x24')],_[_0x1633('0x25')](_0x1154d8[_0x1633('0x23')],[_0x1633('0x24'),'id'])||{});}})[_0x1633('0x26')](function(_0x4bf1f9){logger['info'](_0x1633('0x27'),_0x1154d8);logger['debug'](_0x1633('0x27'),_0x1154d8,JSON[_0x1633('0x13')](_0x4bf1f9));_0x23ed3b(_0x4bf1f9);})[_0x1633('0x19')](function(_0x4ef053){logger[_0x1633('0x14')](_0x1633('0x27'),_0x4ef053[_0x1633('0x17')],_0x1154d8);_0x1bbd8b(_this[_0x1633('0x14')](0x1f4,_0x4ef053[_0x1633('0x17')]));});});}; \ No newline at end of file +var _0x12e9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','limit','stringify','catch','AddTagsToWhatsappInteraction','find','addTags','omit','ids','spread','debug','AddTags','lodash','moment','bluebird','ioredis'];(function(_0x141993,_0x5cd8c2){var _0x55203a=function(_0x1797cd){while(--_0x1797cd){_0x141993['push'](_0x141993['shift']());}};_0x55203a(++_0x5cd8c2);}(_0x12e9,0x129));var _0x912e=function(_0x2adea8,_0x52dd0a){_0x2adea8=_0x2adea8-0x0;var _0x5ad185=_0x12e9[_0x2adea8];return _0x5ad185;};'use strict';var _=require(_0x912e('0x0'));var util=require('util');var moment=require(_0x912e('0x1'));var BPromise=require(_0x912e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x912e('0x3'));var db=require(_0x912e('0x4'))['db'];var utils=require(_0x912e('0x5'));var logger=require(_0x912e('0x6'))('rpc');var config=require(_0x912e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x912e('0x8')][_0x912e('0x9')]({'port':0x232a});config['redis']=_[_0x912e('0xa')](config[_0x912e('0xb')],{'host':_0x912e('0xc'),'port':0x18eb});var socket=require(_0x912e('0xd'))(new Redis(config[_0x912e('0xb')]));require(_0x912e('0xe'))[_0x912e('0xf')](socket);function respondWithRpcPromise(_0x42bea4,_0x6d86f7,_0x466da0){return new BPromise(function(_0x2d52a6,_0x2cc305){return client[_0x912e('0x10')](_0x42bea4,_0x466da0)[_0x912e('0x11')](function(_0x2a6309){logger['info'](_0x912e('0x12'),_0x6d86f7,_0x912e('0x13'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x6d86f7,_0x912e('0x13'),JSON['stringify'](_0x2a6309));if(_0x2a6309['error']){if(_0x2a6309[_0x912e('0x14')][_0x912e('0x15')]===0x1f4){logger['error'](_0x912e('0x12'),_0x6d86f7,_0x2a6309[_0x912e('0x14')]['message']);return _0x2cc305(_0x2a6309[_0x912e('0x14')][_0x912e('0x16')]);}logger[_0x912e('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x6d86f7,_0x2a6309[_0x912e('0x14')]['message']);return _0x2d52a6(_0x2a6309[_0x912e('0x14')][_0x912e('0x16')]);}else{logger[_0x912e('0x17')](_0x912e('0x12'),_0x6d86f7,_0x912e('0x13'));_0x2d52a6(_0x2a6309[_0x912e('0x18')][_0x912e('0x16')]);}})['catch'](function(_0x501f72){logger[_0x912e('0x14')](_0x912e('0x12'),_0x6d86f7,_0x501f72);_0x2cc305(_0x501f72);});});}exports[_0x912e('0x19')]=function(_0x450806){var _0x153eb9=this;return new Promise(function(_0x426ba8,_0x4ecea6){return db[_0x912e('0x1a')][_0x912e('0x1b')](_0x450806[_0x912e('0x1c')],{'raw':_0x450806[_0x912e('0x1d')]?_0x450806[_0x912e('0x1d')][_0x912e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x450806[_0x912e('0x1d')]?_0x450806[_0x912e('0x1d')][_0x912e('0x1f')]||null:null,'attributes':_0x450806[_0x912e('0x1d')]?_0x450806['options']['attributes']||null:null,'limit':_0x450806[_0x912e('0x1d')]?_0x450806[_0x912e('0x1d')][_0x912e('0x20')]||null:null})[_0x912e('0x11')](function(_0x28024e){logger[_0x912e('0x17')](_0x912e('0x19'),_0x450806);logger['debug']('UpdateWhatsappInteraction',_0x450806,JSON[_0x912e('0x21')](_0x28024e));_0x426ba8(_0x28024e);})[_0x912e('0x22')](function(_0x34dbae){logger[_0x912e('0x14')](_0x912e('0x19'),_0x34dbae[_0x912e('0x16')],_0x450806);_0x4ecea6(_0x153eb9['error'](0x1f4,_0x34dbae['message']));});});};exports[_0x912e('0x23')]=function(_0x1632c6){return new Promise(function(_0x34cd14,_0x2aa3f0){return db[_0x912e('0x1a')][_0x912e('0x24')]({'where':_0x1632c6[_0x912e('0x1d')]?_0x1632c6[_0x912e('0x1d')][_0x912e('0x1f')]||null:null})[_0x912e('0x11')](function(_0x245f49){if(_0x245f49){return _0x245f49[_0x912e('0x25')](_0x1632c6[_0x912e('0x1c')]['ids'],_[_0x912e('0x26')](_0x1632c6[_0x912e('0x1c')],[_0x912e('0x27'),'id'])||{});}})[_0x912e('0x28')](function(_0x5752ad){logger[_0x912e('0x17')]('AddTags',_0x1632c6);logger[_0x912e('0x29')](_0x912e('0x2a'),_0x1632c6,JSON[_0x912e('0x21')](_0x5752ad));_0x34cd14(_0x5752ad);})[_0x912e('0x22')](function(_0x3fd65f){logger[_0x912e('0x14')](_0x912e('0x2a'),_0x3fd65f[_0x912e('0x16')],_0x1632c6);_0x2aa3f0(_this[_0x912e('0x14')](0x1f4,_0x3fd65f[_0x912e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 33341f4..e0d8ce9 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 _0x68c7=['length','whatsappInteraction:','./whatsappInteraction.events','save','remove','removeListener'];(function(_0x59d468,_0x3990b9){var _0x5520cc=function(_0x2091cf){while(--_0x2091cf){_0x59d468['push'](_0x59d468['shift']());}};_0x5520cc(++_0x3990b9);}(_0x68c7,0xc8));var _0x768c=function(_0x3a076a,_0x2f7d66){_0x3a076a=_0x3a076a-0x0;var _0x369ac6=_0x68c7[_0x3a076a];return _0x369ac6;};'use strict';var WhatsappInteractionEvents=require(_0x768c('0x0'));var events=[_0x768c('0x1'),_0x768c('0x2'),'update'];function createListener(_0x8d4137,_0x44aefe){return function(_0x703270){_0x44aefe['emit'](_0x8d4137,_0x703270);};}function removeListener(_0x3c3ac8,_0x49fe68){return function(){WhatsappInteractionEvents[_0x768c('0x3')](_0x3c3ac8,_0x49fe68);};}exports['register']=function(_0x1eb630){for(var _0x45965d=0x0,_0x2192e3=events[_0x768c('0x4')];_0x45965d<_0x2192e3;_0x45965d++){var _0x299002=events[_0x45965d];var _0x783d65=createListener(_0x768c('0x5')+_0x299002,_0x1eb630);WhatsappInteractionEvents['on'](_0x299002,_0x783d65);}}; \ No newline at end of file +var _0xb2dc=['whatsappInteraction:','save','remove','update','register'];(function(_0x3d3f61,_0x426cae){var _0x2d1fc9=function(_0x295aab){while(--_0x295aab){_0x3d3f61['push'](_0x3d3f61['shift']());}};_0x2d1fc9(++_0x426cae);}(_0xb2dc,0xd8));var _0xcb2d=function(_0x12725d,_0x2ae356){_0x12725d=_0x12725d-0x0;var _0x3dc113=_0xb2dc[_0x12725d];return _0x3dc113;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xcb2d('0x0'),_0xcb2d('0x1'),_0xcb2d('0x2')];function createListener(_0x3b0619,_0x3bfe63){return function(_0x376434){_0x3bfe63['emit'](_0x3b0619,_0x376434);};}function removeListener(_0x266909,_0x8bcdd5){return function(){WhatsappInteractionEvents['removeListener'](_0x266909,_0x8bcdd5);};}exports[_0xcb2d('0x3')]=function(_0x5369a1){for(var _0x394097=0x0,_0x55ff34=events['length'];_0x394097<_0x55ff34;_0x394097++){var _0x511363=events[_0x394097];var _0x1097b7=createListener(_0xcb2d('0x4')+_0x511363,_0x5369a1);WhatsappInteractionEvents['on'](_0x511363,_0x1097b7);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index fc6b1de..024b08b 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 _0x4b84=['accept','/:id/reject','delete','destroy','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/describe','describe','isAuthenticated','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','/:id','put'];(function(_0x5d882f,_0x221c85){var _0x130d5d=function(_0x47a140){while(--_0x47a140){_0x5d882f['push'](_0x5d882f['shift']());}};_0x130d5d(++_0x221c85);}(_0x4b84,0x1cc));var _0x44b8=function(_0x216428,_0x5d20ea){_0x216428=_0x216428-0x0;var _0x313dd4=_0x4b84[_0x216428];return _0x313dd4;};'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('./whatsappMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x44b8('0x6')]);router['get'](_0x44b8('0x7'),auth['isAuthenticated'](),controller[_0x44b8('0x8')]);router['get']('/:id',auth[_0x44b8('0x9')](),controller[_0x44b8('0xa')]);router[_0x44b8('0xb')]('/',auth['isAuthenticated'](),interaction[_0x44b8('0xc')](_0x44b8('0xd'),_0x44b8('0xe')),controller[_0x44b8('0xf')]);router[_0x44b8('0xb')](_0x44b8('0x10'),controller[_0x44b8('0x11')]);router['put'](_0x44b8('0x12'),auth[_0x44b8('0x9')](),controller['update']);router[_0x44b8('0x13')]('/:id/accept',auth[_0x44b8('0x9')](),controller[_0x44b8('0x14')]);router['put'](_0x44b8('0x15'),auth['isAuthenticated'](),controller['reject']);router[_0x44b8('0x16')](_0x44b8('0x12'),auth[_0x44b8('0x9')](),controller[_0x44b8('0x17')]);module['exports']=router; \ No newline at end of file +var _0xdc97=['reject','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','describe','/:id','show','tracked','whatsapp','whatsappmessage:create','create','post','/:id/status','update','put','accept','/:id/reject'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xdc97,0x13b));var _0x7dc9=function(_0x128811,_0x1200ae){_0x128811=_0x128811-0x0;var _0x1ac326=_0xdc97[_0x128811];return _0x1ac326;};'use strict';var multer=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var path=require(_0x7dc9('0x2'));var timeout=require('connect-timeout');var express=require(_0x7dc9('0x3'));var router=express['Router']();var fs_extra=require(_0x7dc9('0x4'));var auth=require(_0x7dc9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7dc9('0x6'));var controller=require(_0x7dc9('0x7'));router[_0x7dc9('0x8')]('/',auth[_0x7dc9('0x9')](),controller['index']);router[_0x7dc9('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x7dc9('0xa')]);router[_0x7dc9('0x8')](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xc')]);router['post']('/',auth[_0x7dc9('0x9')](),interaction[_0x7dc9('0xd')](_0x7dc9('0xe'),_0x7dc9('0xf')),controller[_0x7dc9('0x10')]);router[_0x7dc9('0x11')](_0x7dc9('0x12'),controller['status']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7dc9('0x13')]);router[_0x7dc9('0x14')]('/:id/accept',auth[_0x7dc9('0x9')](),controller[_0x7dc9('0x15')]);router[_0x7dc9('0x14')](_0x7dc9('0x16'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0x17')]);router['delete'](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0x18')]);module[_0x7dc9('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index f885c70..cd24c1e 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 _0x2fec=['STRING','DATE','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x46e401,_0x486b72){var _0x29f7cf=function(_0x3eef52){while(--_0x3eef52){_0x46e401['push'](_0x46e401['shift']());}};_0x29f7cf(++_0x486b72);}(_0x2fec,0x82));var _0xc2fe=function(_0x1b3a5e,_0x592d0b){_0x1b3a5e=_0x1b3a5e-0x0;var _0x3a45e7=_0x2fec[_0x1b3a5e];return _0x3a45e7;};'use strict';var Sequelize=require('sequelize');module[_0xc2fe('0x0')]={'body':{'type':Sequelize[_0xc2fe('0x1')](_0xc2fe('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc2fe('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc2fe('0x4')]('in',_0xc2fe('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xc2fe('0x6')]},'readAt':{'type':Sequelize[_0xc2fe('0x7')]},'secret':{'type':Sequelize[_0xc2fe('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc2fe('0x1')]}}; \ No newline at end of file +var _0x76ec=['DATE','exports','TEXT','medium','BOOLEAN','out','STRING'];(function(_0x48ee0e,_0x1274a6){var _0x260ac8=function(_0x2e13a1){while(--_0x2e13a1){_0x48ee0e['push'](_0x48ee0e['shift']());}};_0x260ac8(++_0x1274a6);}(_0x76ec,0x1dd));var _0xc76e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x76ec[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xc76e('0x0')]={'body':{'type':Sequelize[_0xc76e('0x1')](_0xc76e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc76e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc76e('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xc76e('0x5')](0xbe)},'phone':{'type':Sequelize[_0xc76e('0x5')]},'readAt':{'type':Sequelize[_0xc76e('0x6')]},'secret':{'type':Sequelize[_0xc76e('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc76e('0x5')]},'providerResponse':{'type':Sequelize[_0xc76e('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 63be2cc..31de105 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 _0x93e9=['catch','status','offset','limit','set','json','save','update','destroy','end','sendStatus','stack','name','send','map','WhatsappMessage','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','sort','where','pick','filter','merge','options','count','includeAll','findAll','rows','params','intersection','find','body','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','whatsapp-interactions','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','received\x20delivery\x20report\x20from','type','inspect','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','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/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x42fd40,_0x461f03){var _0x1f96bc=function(_0x7ddab1){while(--_0x7ddab1){_0x42fd40['push'](_0x42fd40['shift']());}};_0x1f96bc(++_0x461f03);}(_0x93e9,0xcc));var _0x993e=function(_0x48ebf4,_0x180741){_0x48ebf4=_0x48ebf4-0x0;var _0x48128a=_0x93e9[_0x48ebf4];return _0x48128a;};'use strict';var emlformat=require(_0x993e('0x0'));var rimraf=require(_0x993e('0x1'));var zipdir=require(_0x993e('0x2'));var jsonpatch=require(_0x993e('0x3'));var rp=require(_0x993e('0x4'));var moment=require(_0x993e('0x5'));var BPromise=require(_0x993e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x993e('0x7'));var sox=require(_0x993e('0x8'));var csv=require(_0x993e('0x9'));var ejs=require(_0x993e('0xa'));var fs=require('fs');var fs_extra=require(_0x993e('0xb'));var _=require(_0x993e('0xc'));var squel=require(_0x993e('0xd'));var crypto=require(_0x993e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x993e('0xf'));var toCsv=require(_0x993e('0x9'));var querystring=require(_0x993e('0x10'));var Papa=require(_0x993e('0x11'));var Redis=require(_0x993e('0x12'));var authService=require(_0x993e('0x13'));var qs=require(_0x993e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x993e('0x15'));var logger=require(_0x993e('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x993e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x993e('0x18'))['db'];config['redis']=_['defaults'](config[_0x993e('0x19')],{'host':_0x993e('0x1a'),'port':0x18eb});var socket=require(_0x993e('0x1b'))(new Redis(config[_0x993e('0x19')]));require(_0x993e('0x1c'))[_0x993e('0x1d')](socket);var jayson=require(_0x993e('0x1e'));var client=jayson[_0x993e('0x1f')][_0x993e('0x20')]({'port':0x232c});var client9002=jayson[_0x993e('0x1f')][_0x993e('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x135771,_0x3df0e7,_0x125322,_0x1f267f){return new BPromise(function(_0x454475,_0x111707){var _0x526e06=_0x1f267f||client;return _0x526e06[_0x993e('0x21')](_0x135771,_0x125322)[_0x993e('0x22')](function(_0x3cc2b9){logger[_0x993e('0x23')](_0x993e('0x24'),_0x3df0e7,_0x993e('0x25'));logger['debug'](_0x993e('0x26'),_0x3df0e7,_0x993e('0x25'),JSON[_0x993e('0x27')](_0x3cc2b9));if(_0x3cc2b9[_0x993e('0x28')]){if(_0x3cc2b9[_0x993e('0x28')][_0x993e('0x29')]===0x1f4){logger[_0x993e('0x28')](_0x993e('0x24'),_0x3df0e7,_0x3cc2b9['error'][_0x993e('0x2a')]);return _0x111707(_0x3cc2b9['error'][_0x993e('0x2a')]);}logger[_0x993e('0x28')](_0x993e('0x24'),_0x3df0e7,_0x3cc2b9['error'][_0x993e('0x2a')]);return _0x454475(_0x3cc2b9[_0x993e('0x28')][_0x993e('0x2a')]);}else{logger[_0x993e('0x23')](_0x993e('0x24'),_0x3df0e7,_0x993e('0x25'));_0x454475(_0x3cc2b9[_0x993e('0x2b')][_0x993e('0x2a')]);}})[_0x993e('0x2c')](function(_0x18f6ac){logger[_0x993e('0x28')](_0x993e('0x24'),_0x3df0e7,_0x18f6ac);_0x111707(_0x18f6ac);});});}function respondWithStatusCode(_0x4fe471,_0x2756a7){_0x2756a7=_0x2756a7||0xcc;return function(_0x279bb8){if(_0x279bb8){return _0x4fe471['sendStatus'](_0x2756a7);}return _0x4fe471[_0x993e('0x2d')](_0x2756a7)['end']();};}function respondWithResult(_0x14a0c7,_0xa03fbd){_0xa03fbd=_0xa03fbd||0xc8;return function(_0x261822){if(_0x261822){return _0x14a0c7[_0x993e('0x2d')](_0xa03fbd)['json'](_0x261822);}};}function respondWithFilteredResult(_0x48d457,_0x32e332){return function(_0x466d63){if(_0x466d63){var _0x4a4f00=_0x466d63['count'],_0x223af0=_0x32e332[_0x993e('0x2e')],_0x46670a=_0x32e332[_0x993e('0x2e')]+_0x32e332[_0x993e('0x2f')],_0x248354;if(_0x46670a>=_0x4a4f00){_0x46670a=_0x4a4f00;_0x248354=0xc8;}else{_0x248354=0xce;}_0x48d457[_0x993e('0x2d')](_0x248354);return _0x48d457[_0x993e('0x30')]('Content-Range',_0x223af0+'-'+_0x46670a+'/'+_0x4a4f00)[_0x993e('0x31')](_0x466d63);}return null;};}function patchUpdates(_0x4d1379){return function(_0x782298){try{jsonpatch['apply'](_0x782298,_0x4d1379,!![]);}catch(_0x1da357){return BPromise['reject'](_0x1da357);}return _0x782298[_0x993e('0x32')]();};}function saveUpdates(_0x2ce5d5,_0x94a2fc){return function(_0x157ea4){if(_0x157ea4){return _0x157ea4[_0x993e('0x33')](_0x2ce5d5)[_0x993e('0x22')](function(_0x5562f1){return _0x5562f1;});}return null;};}function removeEntity(_0x1920c6,_0x4f9c94){return function(_0x4dbecb){if(_0x4dbecb){return _0x4dbecb[_0x993e('0x34')]()['then'](function(){_0x1920c6[_0x993e('0x2d')](0xcc)[_0x993e('0x35')]();});}};}function handleEntityNotFound(_0x2fa50e,_0xf06b15){return function(_0x3fd06e){if(!_0x3fd06e){_0x2fa50e[_0x993e('0x36')](0x194);}return _0x3fd06e;};}function handleError(_0x22a6bd,_0x14424a){_0x14424a=_0x14424a||0x1f4;return function(_0x16c944){logger[_0x993e('0x28')](_0x16c944[_0x993e('0x37')]);if(_0x16c944[_0x993e('0x38')]){delete _0x16c944[_0x993e('0x38')];}_0x22a6bd[_0x993e('0x2d')](_0x14424a)[_0x993e('0x39')](_0x16c944);};}exports['index']=function(_0x4325bc,_0x288b9c){var _0x2948cf={},_0x9a9f42={},_0x2b4d1={'count':0x0,'rows':[]};var _0x6f8808=_[_0x993e('0x3a')](db[_0x993e('0x3b')][_0x993e('0x3c')],function(_0x533e5a){return{'name':_0x533e5a[_0x993e('0x3d')],'type':_0x533e5a['type'][_0x993e('0x3e')]};});_0x9a9f42[_0x993e('0x3f')]=_[_0x993e('0x3a')](_0x6f8808,_0x993e('0x38'));_0x9a9f42[_0x993e('0x40')]=_[_0x993e('0x41')](_0x4325bc[_0x993e('0x40')]);_0x9a9f42[_0x993e('0x42')]=_['intersection'](_0x9a9f42[_0x993e('0x3f')],_0x9a9f42['query']);_0x2948cf[_0x993e('0x43')]=_['intersection'](_0x9a9f42[_0x993e('0x3f')],qs[_0x993e('0x44')](_0x4325bc[_0x993e('0x40')][_0x993e('0x44')]));_0x2948cf[_0x993e('0x43')]=_0x2948cf[_0x993e('0x43')][_0x993e('0x45')]?_0x2948cf[_0x993e('0x43')]:_0x9a9f42['model'];if(!_0x4325bc[_0x993e('0x40')]['hasOwnProperty']('nolimit')){_0x2948cf[_0x993e('0x2f')]=qs[_0x993e('0x2f')](_0x4325bc[_0x993e('0x40')]['limit']);_0x2948cf[_0x993e('0x2e')]=qs[_0x993e('0x2e')](_0x4325bc[_0x993e('0x40')]['offset']);}_0x2948cf['order']=qs['sort'](_0x4325bc[_0x993e('0x40')][_0x993e('0x46')]);_0x2948cf[_0x993e('0x47')]=qs['filters'](_[_0x993e('0x48')](_0x4325bc[_0x993e('0x40')],_0x9a9f42['filters']),_0x6f8808);if(_0x4325bc[_0x993e('0x40')][_0x993e('0x49')]){_0x2948cf['where']=_[_0x993e('0x4a')](_0x2948cf[_0x993e('0x47')],{'$or':_[_0x993e('0x3a')](_0x6f8808,function(_0x5e18e9){if(_0x5e18e9['type']!=='VIRTUAL'){var _0x5bc642={};_0x5bc642[_0x5e18e9[_0x993e('0x38')]]={'$like':'%'+_0x4325bc[_0x993e('0x40')][_0x993e('0x49')]+'%'};return _0x5bc642;}})});}_0x2948cf=_['merge']({},_0x2948cf,_0x4325bc[_0x993e('0x4b')]);var _0x42017a={'where':_0x2948cf[_0x993e('0x47')]};return db[_0x993e('0x3b')][_0x993e('0x4c')](_0x42017a)[_0x993e('0x22')](function(_0x52f148){_0x2b4d1['count']=_0x52f148;if(_0x4325bc[_0x993e('0x40')][_0x993e('0x4d')]){_0x2948cf['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x993e('0x4e')](_0x2948cf);})[_0x993e('0x22')](function(_0x8abac0){_0x2b4d1[_0x993e('0x4f')]=_0x8abac0;return _0x2b4d1;})[_0x993e('0x22')](respondWithFilteredResult(_0x288b9c,_0x2948cf))[_0x993e('0x2c')](handleError(_0x288b9c,null));};exports['show']=function(_0x206a74,_0x51ca44){var _0xb8629f={'raw':!![],'where':{'id':_0x206a74[_0x993e('0x50')]['id']}},_0x1f7425={};_0x1f7425[_0x993e('0x3f')]=_[_0x993e('0x41')](db[_0x993e('0x3b')][_0x993e('0x3c')]);_0x1f7425[_0x993e('0x40')]=_['keys'](_0x206a74[_0x993e('0x40')]);_0x1f7425[_0x993e('0x42')]=_[_0x993e('0x51')](_0x1f7425['model'],_0x1f7425[_0x993e('0x40')]);_0xb8629f['attributes']=_[_0x993e('0x51')](_0x1f7425[_0x993e('0x3f')],qs['fields'](_0x206a74[_0x993e('0x40')][_0x993e('0x44')]));_0xb8629f['attributes']=_0xb8629f[_0x993e('0x43')][_0x993e('0x45')]?_0xb8629f[_0x993e('0x43')]:_0x1f7425[_0x993e('0x3f')];if(_0x206a74[_0x993e('0x40')]['includeAll']){_0xb8629f['include']=[{'all':!![]}];}_0xb8629f=_['merge']({},_0xb8629f,_0x206a74[_0x993e('0x4b')]);return db[_0x993e('0x3b')][_0x993e('0x52')](_0xb8629f)[_0x993e('0x22')](handleEntityNotFound(_0x51ca44,null))[_0x993e('0x22')](respondWithResult(_0x51ca44,null))[_0x993e('0x2c')](handleError(_0x51ca44,null));};exports['create']=function(_0x3a897d,_0x258482){return db[_0x993e('0x3b')]['create'](_0x3a897d[_0x993e('0x53')],{})['then'](respondWithResult(_0x258482,0xc9))['catch'](handleError(_0x258482,null));};exports[_0x993e('0x33')]=function(_0x37d7b1,_0x511641){if(_0x37d7b1[_0x993e('0x53')]['id']){delete _0x37d7b1['body']['id'];}return db[_0x993e('0x3b')][_0x993e('0x52')]({'where':{'id':_0x37d7b1['params']['id']}})['then'](handleEntityNotFound(_0x511641,null))[_0x993e('0x22')](saveUpdates(_0x37d7b1[_0x993e('0x53')],null))[_0x993e('0x22')](respondWithResult(_0x511641,null))[_0x993e('0x2c')](handleError(_0x511641,null));};exports[_0x993e('0x34')]=function(_0x3bbd9a,_0x4f9225){return db[_0x993e('0x3b')][_0x993e('0x52')]({'where':{'id':_0x3bbd9a['params']['id']}})[_0x993e('0x22')](handleEntityNotFound(_0x4f9225,null))[_0x993e('0x22')](removeEntity(_0x4f9225,null))[_0x993e('0x2c')](handleError(_0x4f9225,null));};exports['describe']=function(_0x426341,_0x1a0d08){return db[_0x993e('0x3b')]['describe']()[_0x993e('0x22')](respondWithResult(_0x1a0d08,null))[_0x993e('0x2c')](handleError(_0x1a0d08,null));};var interaction_log=require(_0x993e('0x16'))('whatsapp-interactions');exports['accept']=function(_0x53c68a,_0x2534ca,_0x98d16c){var _0x3a3d29={'agent':{},'channel':_0x993e('0x54')};if(_0x53c68a[_0x993e('0x53')]['id']){delete _0x53c68a['body']['id'];}_0x53c68a[_0x993e('0x53')][_0x993e('0x55')]=!![];_0x53c68a[_0x993e('0x53')]['readAt']=moment()[_0x993e('0x56')](_0x993e('0x57'));_0x53c68a[_0x993e('0x53')][_0x993e('0x58')]=_0x53c68a['body'][_0x993e('0x58')]||_0x53c68a[_0x993e('0x59')]['id'];_0x3a3d29['agent']['id']=_0x53c68a['body'][_0x993e('0x58')];return db[_0x993e('0x3b')][_0x993e('0x52')]({'where':{'id':_0x53c68a[_0x993e('0x50')]['id'],'UserId':null},'include':[{'model':db[_0x993e('0x5a')],'as':_0x993e('0x5b')}]})[_0x993e('0x22')](handleEntityNotFound(_0x2534ca,null))[_0x993e('0x22')](saveUpdates(_0x53c68a[_0x993e('0x53')],null))[_0x993e('0x22')](function(_0x300a93){if(_0x300a93){_0x3a3d29[_0x993e('0x2a')]=_0x300a93[_0x993e('0x5c')]({'plain':!![]});return db[_0x993e('0x5d')][_0x993e('0x52')]({'where':{'id':_0x300a93[_0x993e('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x2534ca,null))[_0x993e('0x22')](function(_0x1cbd37){if(_0x1cbd37){return _0x1cbd37['update']({'UserId':_0x53c68a[_0x993e('0x53')]['UserId'],'read1stAt':_[_0x993e('0x5f')](_0x1cbd37[_0x993e('0x60')])?moment()[_0x993e('0x56')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x993e('0x22')](function(_0x5e9222){if(_0x5e9222){_0x3a3d29['interaction']=_0x5e9222[_0x993e('0x5c')]({'plain':!![]});interaction_log[_0x993e('0x23')](_0x993e('0x61'),_0x53c68a[_0x993e('0x59')]['id'],_0x53c68a[_0x993e('0x59')]['name'],_0x53c68a[_0x993e('0x59')][_0x993e('0x62')],_0x3a3d29[_0x993e('0x63')]['id'],_0x53c68a['body']?JSON[_0x993e('0x27')](_0x53c68a['body']):_0x993e('0x64'));return respondWithRpcPromise(_0x993e('0x65'),_0x993e('0x66'),_0x3a3d29);}return null;})['then'](function(_0x20c1e4){if(_0x20c1e4){if(_0x53c68a[_0x993e('0x53')][_0x993e('0x67')]){_0x3a3d29[_0x993e('0x2a')][_0x993e('0x68')]=util[_0x993e('0x56')](_0x993e('0x69'),_0x53c68a[_0x993e('0x59')][_0x993e('0x38')]);_0x3a3d29[_0x993e('0x2a')]['channel']=_0x3a3d29[_0x993e('0x6a')];_0x3a3d29[_0x993e('0x2a')][_0x993e('0x6b')]=_0x993e('0x6c');return respondWithRpcPromise(_0x993e('0x6d'),_0x993e('0x6d'),{'event':_0x993e('0x6e'),'message':_0x3a3d29[_0x993e('0x2a')]},client9002)['then'](function(){return _0x3a3d29;});}return _0x3a3d29;}return null;})['then'](respondWithResult(_0x2534ca,null))[_0x993e('0x2c')](handleError(_0x2534ca,null));};var interaction_log=require('../../config/logger')(_0x993e('0x6f'));exports[_0x993e('0x70')]=function(_0x2ce913,_0x49788e,_0x2bf739){var _0x580c2c={'agent':{},'channel':_0x993e('0x54')};if(_0x2ce913[_0x993e('0x53')]['id']){delete _0x2ce913[_0x993e('0x53')]['id'];}_0x2ce913[_0x993e('0x53')][_0x993e('0x58')]=_0x2ce913[_0x993e('0x53')][_0x993e('0x58')]||_0x2ce913[_0x993e('0x59')]['id'];_0x580c2c['agent']['id']=_0x2ce913['body'][_0x993e('0x58')];return db['WhatsappMessage'][_0x993e('0x52')]({'where':{'id':_0x2ce913[_0x993e('0x50')]['id'],'UserId':null}})[_0x993e('0x22')](handleEntityNotFound(_0x49788e,null))[_0x993e('0x22')](function(_0xb4e02c){if(_0xb4e02c){_0x580c2c[_0x993e('0x2a')]=_0xb4e02c[_0x993e('0x5c')]({'plain':!![]});return db[_0x993e('0x5d')][_0x993e('0x52')]({'where':{'id':_0xb4e02c[_0x993e('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x49788e,null))[_0x993e('0x22')](function(_0x14347f){if(_0x14347f){_0x580c2c['interaction']=_0x14347f[_0x993e('0x5c')]({'plain':!![]});interaction_log[_0x993e('0x23')](_0x993e('0x71'),_0x2ce913[_0x993e('0x59')]['id'],_0x2ce913[_0x993e('0x59')][_0x993e('0x38')],_0x2ce913[_0x993e('0x59')][_0x993e('0x62')],_0x580c2c[_0x993e('0x63')]['id'],_0x2ce913['body']?JSON[_0x993e('0x27')](_0x2ce913[_0x993e('0x53')]):_0x993e('0x64'));return respondWithRpcPromise(_0x993e('0x72'),'rejectMessage',_0x580c2c);}return null;})['then'](function(_0x35ad1b){if(_0x35ad1b){_0x35ad1b['message'][_0x993e('0x68')]=util[_0x993e('0x56')](_0x993e('0x69'),_0x2ce913[_0x993e('0x59')][_0x993e('0x38')]);_0x35ad1b[_0x993e('0x2a')][_0x993e('0x6a')]=_0x580c2c[_0x993e('0x6a')];_0x35ad1b[_0x993e('0x2a')][_0x993e('0x6b')]='reject';respondWithRpcPromise(_0x993e('0x6d'),_0x993e('0x6d'),{'event':_0x993e('0x73'),'message':_0x35ad1b[_0x993e('0x2a')]},client9002);return _0x580c2c;}return null;})[_0x993e('0x22')](respondWithResult(_0x49788e,null))[_0x993e('0x2c')](handleError(_0x49788e,null));};exports[_0x993e('0x2d')]=function(_0x5c634a,_0x47c3b6,_0x25dc99){if(_0x5c634a[_0x993e('0x53')]['id']){delete _0x5c634a[_0x993e('0x53')]['id'];}var _0x383c54;return db[_0x993e('0x3b')]['find']({'where':{'id':_0x5c634a['params']['id']}})['then'](handleEntityNotFound(_0x47c3b6,null))[_0x993e('0x22')](function(_0x2edae0){if(_0x2edae0){_0x383c54=_0x2edae0;return db[_0x993e('0x74')][_0x993e('0x52')]({'where':{'id':_0x2edae0[_0x993e('0x75')]}});}})['then'](handleEntityNotFound(_0x47c3b6,null))[_0x993e('0x22')](function(_0xaaf5af){if(_0xaaf5af){logger[_0x993e('0x76')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x993e('0x2d'),_0x993e('0x77'),_0xaaf5af[_0x993e('0x78')],util[_0x993e('0x79')](_0x5c634a[_0x993e('0x53')],{'showHidden':![],'depth':null}));switch(_0xaaf5af[_0x993e('0x78')]){case'twilio':if(_0x5c634a[_0x993e('0x53')]['MessageSid']&&_0x5c634a['body']['MessageSid']===_0x383c54['messageId']&&_0x5c634a[_0x993e('0x53')][_0x993e('0x7a')]&&_0x5c634a[_0x993e('0x53')][_0x993e('0x7a')]===_0x993e('0x55')){return _0x383c54[_0x993e('0x33')]({'read':!![]});}else{logger[_0x993e('0x28')](_0x993e('0x7b'),_0x993e('0x2d'),'twilio',util[_0x993e('0x79')](_0x5c634a['body'],{'showHidden':![],'depth':null}));}break;}return _0x383c54;}})[_0x993e('0x22')](respondWithResult(_0x47c3b6,null))[_0x993e('0x2c')](handleError(_0x47c3b6,null));}; \ No newline at end of file +var _0xcf2f=['params','model','find','body','describe','whatsapp-interactions','whatsapp','read','readAt','format','UserId','user','agent','WhatsappInteractionId','update','isNil','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','manual','interface','SIP/%s','channel','EventManager','acceptmessage','get','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','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','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','http','client','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','WhatsappMessage','findAll','catch','show'];(function(_0x479c1a,_0x3c3b1f){var _0x1ea8e5=function(_0x4f6115){while(--_0x4f6115){_0x479c1a['push'](_0x479c1a['shift']());}};_0x1ea8e5(++_0x3c3b1f);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x57b14f,_0x5c262e){_0x57b14f=_0x57b14f-0x0;var _0x45ccb4=_0xcf2f[_0x57b14f];return _0x45ccb4;};'use strict';var emlformat=require(_0xfcf2('0x0'));var rimraf=require(_0xfcf2('0x1'));var zipdir=require(_0xfcf2('0x2'));var jsonpatch=require(_0xfcf2('0x3'));var rp=require(_0xfcf2('0x4'));var moment=require('moment');var BPromise=require(_0xfcf2('0x5'));var Mustache=require(_0xfcf2('0x6'));var util=require(_0xfcf2('0x7'));var path=require(_0xfcf2('0x8'));var sox=require(_0xfcf2('0x9'));var csv=require(_0xfcf2('0xa'));var ejs=require(_0xfcf2('0xb'));var fs=require('fs');var fs_extra=require(_0xfcf2('0xc'));var _=require(_0xfcf2('0xd'));var squel=require(_0xfcf2('0xe'));var crypto=require(_0xfcf2('0xf'));var jsforce=require(_0xfcf2('0x10'));var deskjs=require(_0xfcf2('0x11'));var toCsv=require(_0xfcf2('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfcf2('0x12'));var qs=require(_0xfcf2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcf2('0x14'));var logger=require(_0xfcf2('0x15'))(_0xfcf2('0x16'));var utils=require(_0xfcf2('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfcf2('0x18'))['db'];config[_0xfcf2('0x19')]=_[_0xfcf2('0x1a')](config[_0xfcf2('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xfcf2('0x1b'))(new Redis(config['redis']));require('./whatsappMessage.socket')['register'](socket);var jayson=require(_0xfcf2('0x1c'));var client=jayson['client'][_0xfcf2('0x1d')]({'port':0x232c});var client9002=jayson[_0xfcf2('0x1e')][_0xfcf2('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x21f7d1,_0x315b2f,_0x44320d,_0x1de1e5){return new BPromise(function(_0x4d64ce,_0x3bc880){var _0x213125=_0x1de1e5||client;return _0x213125[_0xfcf2('0x1f')](_0x21f7d1,_0x44320d)['then'](function(_0xd87472){logger[_0xfcf2('0x20')](_0xfcf2('0x21'),_0x315b2f,_0xfcf2('0x22'));logger[_0xfcf2('0x23')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x315b2f,_0xfcf2('0x22'),JSON[_0xfcf2('0x24')](_0xd87472));if(_0xd87472['error']){if(_0xd87472[_0xfcf2('0x25')][_0xfcf2('0x26')]===0x1f4){logger[_0xfcf2('0x25')](_0xfcf2('0x21'),_0x315b2f,_0xd87472[_0xfcf2('0x25')][_0xfcf2('0x27')]);return _0x3bc880(_0xd87472[_0xfcf2('0x25')][_0xfcf2('0x27')]);}logger[_0xfcf2('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x315b2f,_0xd87472[_0xfcf2('0x25')][_0xfcf2('0x27')]);return _0x4d64ce(_0xd87472[_0xfcf2('0x25')]['message']);}else{logger[_0xfcf2('0x20')](_0xfcf2('0x21'),_0x315b2f,'request\x20sent');_0x4d64ce(_0xd87472[_0xfcf2('0x28')][_0xfcf2('0x27')]);}})['catch'](function(_0x1e6f14){logger[_0xfcf2('0x25')](_0xfcf2('0x21'),_0x315b2f,_0x1e6f14);_0x3bc880(_0x1e6f14);});});}function respondWithStatusCode(_0x21ca98,_0x5bb384){_0x5bb384=_0x5bb384||0xcc;return function(_0x1deca3){if(_0x1deca3){return _0x21ca98[_0xfcf2('0x29')](_0x5bb384);}return _0x21ca98[_0xfcf2('0x2a')](_0x5bb384)[_0xfcf2('0x2b')]();};}function respondWithResult(_0x17c994,_0x2b1d60){_0x2b1d60=_0x2b1d60||0xc8;return function(_0x315f1a){if(_0x315f1a){return _0x17c994[_0xfcf2('0x2a')](_0x2b1d60)[_0xfcf2('0x2c')](_0x315f1a);}};}function respondWithFilteredResult(_0x56f839,_0x4c2935){return function(_0x695f31){if(_0x695f31){var _0x878504=_0x695f31['count'],_0x3308c3=_0x4c2935[_0xfcf2('0x2d')],_0x532db6=_0x4c2935[_0xfcf2('0x2d')]+_0x4c2935[_0xfcf2('0x2e')],_0x560898;if(_0x532db6>=_0x878504){_0x532db6=_0x878504;_0x560898=0xc8;}else{_0x560898=0xce;}_0x56f839[_0xfcf2('0x2a')](_0x560898);return _0x56f839[_0xfcf2('0x2f')](_0xfcf2('0x30'),_0x3308c3+'-'+_0x532db6+'/'+_0x878504)[_0xfcf2('0x2c')](_0x695f31);}return null;};}function patchUpdates(_0x4fec96){return function(_0x4796c4){try{jsonpatch[_0xfcf2('0x31')](_0x4796c4,_0x4fec96,!![]);}catch(_0x1acbea){return BPromise[_0xfcf2('0x32')](_0x1acbea);}return _0x4796c4[_0xfcf2('0x33')]();};}function saveUpdates(_0x4913fc,_0x4ceb7d){return function(_0xdebb72){if(_0xdebb72){return _0xdebb72['update'](_0x4913fc)[_0xfcf2('0x34')](function(_0x347341){return _0x347341;});}return null;};}function removeEntity(_0x5ac9d0,_0x4729ff){return function(_0x43d72f){if(_0x43d72f){return _0x43d72f[_0xfcf2('0x35')]()[_0xfcf2('0x34')](function(){_0x5ac9d0[_0xfcf2('0x2a')](0xcc)[_0xfcf2('0x2b')]();});}};}function handleEntityNotFound(_0x143022,_0x533abe){return function(_0x38cfc6){if(!_0x38cfc6){_0x143022[_0xfcf2('0x29')](0x194);}return _0x38cfc6;};}function handleError(_0x5506ed,_0x101561){_0x101561=_0x101561||0x1f4;return function(_0x3d808a){logger['error'](_0x3d808a[_0xfcf2('0x36')]);if(_0x3d808a[_0xfcf2('0x37')]){delete _0x3d808a['name'];}_0x5506ed[_0xfcf2('0x2a')](_0x101561)[_0xfcf2('0x38')](_0x3d808a);};}exports[_0xfcf2('0x39')]=function(_0x3dcb50,_0x4cde2d){var _0x1f723d={},_0x2dbabb={},_0x1dc264={'count':0x0,'rows':[]};var _0x10448a=_[_0xfcf2('0x3a')](db['WhatsappMessage'][_0xfcf2('0x3b')],function(_0xad02c4){return{'name':_0xad02c4[_0xfcf2('0x3c')],'type':_0xad02c4[_0xfcf2('0x3d')][_0xfcf2('0x3e')]};});_0x2dbabb['model']=_[_0xfcf2('0x3a')](_0x10448a,'name');_0x2dbabb[_0xfcf2('0x3f')]=_[_0xfcf2('0x40')](_0x3dcb50[_0xfcf2('0x3f')]);_0x2dbabb[_0xfcf2('0x41')]=_[_0xfcf2('0x42')](_0x2dbabb['model'],_0x2dbabb[_0xfcf2('0x3f')]);_0x1f723d[_0xfcf2('0x43')]=_[_0xfcf2('0x42')](_0x2dbabb['model'],qs[_0xfcf2('0x44')](_0x3dcb50[_0xfcf2('0x3f')][_0xfcf2('0x44')]));_0x1f723d[_0xfcf2('0x43')]=_0x1f723d[_0xfcf2('0x43')][_0xfcf2('0x45')]?_0x1f723d['attributes']:_0x2dbabb['model'];if(!_0x3dcb50['query'][_0xfcf2('0x46')](_0xfcf2('0x47'))){_0x1f723d[_0xfcf2('0x2e')]=qs['limit'](_0x3dcb50['query']['limit']);_0x1f723d[_0xfcf2('0x2d')]=qs[_0xfcf2('0x2d')](_0x3dcb50[_0xfcf2('0x3f')][_0xfcf2('0x2d')]);}_0x1f723d[_0xfcf2('0x48')]=qs[_0xfcf2('0x49')](_0x3dcb50[_0xfcf2('0x3f')][_0xfcf2('0x49')]);_0x1f723d[_0xfcf2('0x4a')]=qs[_0xfcf2('0x41')](_[_0xfcf2('0x4b')](_0x3dcb50['query'],_0x2dbabb['filters']),_0x10448a);if(_0x3dcb50[_0xfcf2('0x3f')][_0xfcf2('0x4c')]){_0x1f723d[_0xfcf2('0x4a')]=_[_0xfcf2('0x4d')](_0x1f723d[_0xfcf2('0x4a')],{'$or':_[_0xfcf2('0x3a')](_0x10448a,function(_0x33b48e){if(_0x33b48e[_0xfcf2('0x3d')]!==_0xfcf2('0x4e')){var _0x43b389={};_0x43b389[_0x33b48e[_0xfcf2('0x37')]]={'$like':'%'+_0x3dcb50[_0xfcf2('0x3f')][_0xfcf2('0x4c')]+'%'};return _0x43b389;}})});}_0x1f723d=_[_0xfcf2('0x4d')]({},_0x1f723d,_0x3dcb50[_0xfcf2('0x4f')]);var _0x27d07d={'where':_0x1f723d[_0xfcf2('0x4a')]};return db['WhatsappMessage'][_0xfcf2('0x50')](_0x27d07d)[_0xfcf2('0x34')](function(_0x4c46a5){_0x1dc264[_0xfcf2('0x50')]=_0x4c46a5;if(_0x3dcb50['query'][_0xfcf2('0x51')]){_0x1f723d[_0xfcf2('0x52')]=[{'all':!![]}];}return db[_0xfcf2('0x53')][_0xfcf2('0x54')](_0x1f723d);})['then'](function(_0x48697a){_0x1dc264['rows']=_0x48697a;return _0x1dc264;})[_0xfcf2('0x34')](respondWithFilteredResult(_0x4cde2d,_0x1f723d))[_0xfcf2('0x55')](handleError(_0x4cde2d,null));};exports[_0xfcf2('0x56')]=function(_0x22241b,_0x56cf5f){var _0x314902={'raw':!![],'where':{'id':_0x22241b[_0xfcf2('0x57')]['id']}},_0x456dac={};_0x456dac['model']=_[_0xfcf2('0x40')](db[_0xfcf2('0x53')][_0xfcf2('0x3b')]);_0x456dac[_0xfcf2('0x3f')]=_[_0xfcf2('0x40')](_0x22241b['query']);_0x456dac[_0xfcf2('0x41')]=_[_0xfcf2('0x42')](_0x456dac[_0xfcf2('0x58')],_0x456dac[_0xfcf2('0x3f')]);_0x314902[_0xfcf2('0x43')]=_[_0xfcf2('0x42')](_0x456dac['model'],qs['fields'](_0x22241b['query'][_0xfcf2('0x44')]));_0x314902[_0xfcf2('0x43')]=_0x314902['attributes']['length']?_0x314902[_0xfcf2('0x43')]:_0x456dac[_0xfcf2('0x58')];if(_0x22241b[_0xfcf2('0x3f')]['includeAll']){_0x314902[_0xfcf2('0x52')]=[{'all':!![]}];}_0x314902=_[_0xfcf2('0x4d')]({},_0x314902,_0x22241b['options']);return db['WhatsappMessage'][_0xfcf2('0x59')](_0x314902)['then'](handleEntityNotFound(_0x56cf5f,null))[_0xfcf2('0x34')](respondWithResult(_0x56cf5f,null))[_0xfcf2('0x55')](handleError(_0x56cf5f,null));};exports['create']=function(_0x236b97,_0x55c1bd){return db[_0xfcf2('0x53')]['create'](_0x236b97[_0xfcf2('0x5a')],{})[_0xfcf2('0x34')](respondWithResult(_0x55c1bd,0xc9))[_0xfcf2('0x55')](handleError(_0x55c1bd,null));};exports['update']=function(_0x235b06,_0x27bae5){if(_0x235b06[_0xfcf2('0x5a')]['id']){delete _0x235b06[_0xfcf2('0x5a')]['id'];}return db[_0xfcf2('0x53')][_0xfcf2('0x59')]({'where':{'id':_0x235b06[_0xfcf2('0x57')]['id']}})['then'](handleEntityNotFound(_0x27bae5,null))[_0xfcf2('0x34')](saveUpdates(_0x235b06[_0xfcf2('0x5a')],null))['then'](respondWithResult(_0x27bae5,null))[_0xfcf2('0x55')](handleError(_0x27bae5,null));};exports[_0xfcf2('0x35')]=function(_0x3669b1,_0xe3d645){return db['WhatsappMessage'][_0xfcf2('0x59')]({'where':{'id':_0x3669b1['params']['id']}})[_0xfcf2('0x34')](handleEntityNotFound(_0xe3d645,null))[_0xfcf2('0x34')](removeEntity(_0xe3d645,null))[_0xfcf2('0x55')](handleError(_0xe3d645,null));};exports[_0xfcf2('0x5b')]=function(_0x101e85,_0x3f660b){return db[_0xfcf2('0x53')]['describe']()[_0xfcf2('0x34')](respondWithResult(_0x3f660b,null))[_0xfcf2('0x55')](handleError(_0x3f660b,null));};var interaction_log=require('../../config/logger')(_0xfcf2('0x5c'));exports['accept']=function(_0x5cf64f,_0xe4535,_0x375d6f){var _0x98be70={'agent':{},'channel':_0xfcf2('0x5d')};if(_0x5cf64f[_0xfcf2('0x5a')]['id']){delete _0x5cf64f['body']['id'];}_0x5cf64f[_0xfcf2('0x5a')][_0xfcf2('0x5e')]=!![];_0x5cf64f['body'][_0xfcf2('0x5f')]=moment()[_0xfcf2('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x5cf64f[_0xfcf2('0x5a')][_0xfcf2('0x61')]=_0x5cf64f[_0xfcf2('0x5a')][_0xfcf2('0x61')]||_0x5cf64f[_0xfcf2('0x62')]['id'];_0x98be70[_0xfcf2('0x63')]['id']=_0x5cf64f[_0xfcf2('0x5a')]['UserId'];return db[_0xfcf2('0x53')][_0xfcf2('0x59')]({'where':{'id':_0x5cf64f['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xfcf2('0x34')](handleEntityNotFound(_0xe4535,null))['then'](saveUpdates(_0x5cf64f[_0xfcf2('0x5a')],null))['then'](function(_0x388721){if(_0x388721){_0x98be70[_0xfcf2('0x27')]=_0x388721['get']({'plain':!![]});return db['WhatsappInteraction'][_0xfcf2('0x59')]({'where':{'id':_0x388721[_0xfcf2('0x64')]}});}return null;})[_0xfcf2('0x34')](handleEntityNotFound(_0xe4535,null))[_0xfcf2('0x34')](function(_0x4cfbdd){if(_0x4cfbdd){return _0x4cfbdd[_0xfcf2('0x65')]({'UserId':_0x5cf64f[_0xfcf2('0x5a')][_0xfcf2('0x61')],'read1stAt':_[_0xfcf2('0x66')](_0x4cfbdd['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0xa668b8){if(_0xa668b8){_0x98be70[_0xfcf2('0x67')]=_0xa668b8['get']({'plain':!![]});interaction_log[_0xfcf2('0x20')](_0xfcf2('0x68'),_0x5cf64f['user']['id'],_0x5cf64f[_0xfcf2('0x62')]['name'],_0x5cf64f[_0xfcf2('0x62')][_0xfcf2('0x69')],_0x98be70[_0xfcf2('0x67')]['id'],_0x5cf64f[_0xfcf2('0x5a')]?JSON['stringify'](_0x5cf64f[_0xfcf2('0x5a')]):_0xfcf2('0x6a'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x98be70);}return null;})['then'](function(_0xfb83e7){if(_0xfb83e7){if(_0x5cf64f[_0xfcf2('0x5a')][_0xfcf2('0x6b')]){_0x98be70['message'][_0xfcf2('0x6c')]=util[_0xfcf2('0x60')](_0xfcf2('0x6d'),_0x5cf64f[_0xfcf2('0x62')][_0xfcf2('0x37')]);_0x98be70[_0xfcf2('0x27')][_0xfcf2('0x6e')]=_0x98be70['channel'];_0x98be70['message']['event']='accept';return respondWithRpcPromise(_0xfcf2('0x6f'),_0xfcf2('0x6f'),{'event':_0xfcf2('0x70'),'message':_0x98be70['message']},client9002)[_0xfcf2('0x34')](function(){return _0x98be70;});}return _0x98be70;}return null;})[_0xfcf2('0x34')](respondWithResult(_0xe4535,null))['catch'](handleError(_0xe4535,null));};var interaction_log=require(_0xfcf2('0x15'))(_0xfcf2('0x5c'));exports[_0xfcf2('0x32')]=function(_0x174142,_0x171c90,_0x663a4e){var _0x484053={'agent':{},'channel':'whatsapp'};if(_0x174142[_0xfcf2('0x5a')]['id']){delete _0x174142[_0xfcf2('0x5a')]['id'];}_0x174142[_0xfcf2('0x5a')]['UserId']=_0x174142['body']['UserId']||_0x174142[_0xfcf2('0x62')]['id'];_0x484053[_0xfcf2('0x63')]['id']=_0x174142['body']['UserId'];return db[_0xfcf2('0x53')][_0xfcf2('0x59')]({'where':{'id':_0x174142['params']['id'],'UserId':null}})[_0xfcf2('0x34')](handleEntityNotFound(_0x171c90,null))[_0xfcf2('0x34')](function(_0x54b50a){if(_0x54b50a){_0x484053[_0xfcf2('0x27')]=_0x54b50a[_0xfcf2('0x71')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x54b50a[_0xfcf2('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x171c90,null))[_0xfcf2('0x34')](function(_0x1d0a3b){if(_0x1d0a3b){_0x484053[_0xfcf2('0x67')]=_0x1d0a3b[_0xfcf2('0x71')]({'plain':!![]});interaction_log[_0xfcf2('0x20')](_0xfcf2('0x72'),_0x174142['user']['id'],_0x174142[_0xfcf2('0x62')][_0xfcf2('0x37')],_0x174142[_0xfcf2('0x62')][_0xfcf2('0x69')],_0x484053[_0xfcf2('0x67')]['id'],_0x174142[_0xfcf2('0x5a')]?JSON['stringify'](_0x174142[_0xfcf2('0x5a')]):_0xfcf2('0x6a'));return respondWithRpcPromise(_0xfcf2('0x73'),_0xfcf2('0x74'),_0x484053);}return null;})['then'](function(_0x4d763a){if(_0x4d763a){_0x4d763a[_0xfcf2('0x27')][_0xfcf2('0x6c')]=util[_0xfcf2('0x60')](_0xfcf2('0x6d'),_0x174142['user'][_0xfcf2('0x37')]);_0x4d763a['message'][_0xfcf2('0x6e')]=_0x484053[_0xfcf2('0x6e')];_0x4d763a[_0xfcf2('0x27')]['event']='reject';respondWithRpcPromise(_0xfcf2('0x6f'),_0xfcf2('0x6f'),{'event':_0xfcf2('0x75'),'message':_0x4d763a[_0xfcf2('0x27')]},client9002);return _0x484053;}return null;})['then'](respondWithResult(_0x171c90,null))[_0xfcf2('0x55')](handleError(_0x171c90,null));};exports['status']=function(_0xa295d3,_0x14da0f,_0x853289){if(_0xa295d3['body']['id']){delete _0xa295d3['body']['id'];}var _0x5c588b;return db['WhatsappMessage'][_0xfcf2('0x59')]({'where':{'id':_0xa295d3[_0xfcf2('0x57')]['id']}})['then'](handleEntityNotFound(_0x14da0f,null))['then'](function(_0x320b8f){if(_0x320b8f){_0x5c588b=_0x320b8f;return db[_0xfcf2('0x76')]['find']({'where':{'id':_0x320b8f[_0xfcf2('0x77')]}});}})[_0xfcf2('0x34')](handleEntityNotFound(_0x14da0f,null))['then'](function(_0x28a372){if(_0x28a372){logger[_0xfcf2('0x23')](_0xfcf2('0x78'),_0xfcf2('0x2a'),_0xfcf2('0x79'),_0x28a372[_0xfcf2('0x3d')],util[_0xfcf2('0x7a')](_0xa295d3[_0xfcf2('0x5a')],{'showHidden':![],'depth':null}));switch(_0x28a372[_0xfcf2('0x3d')]){case _0xfcf2('0x7b'):if(_0xa295d3[_0xfcf2('0x5a')][_0xfcf2('0x7c')]&&_0xa295d3[_0xfcf2('0x5a')][_0xfcf2('0x7c')]===_0x5c588b['messageId']&&_0xa295d3[_0xfcf2('0x5a')][_0xfcf2('0x7d')]&&_0xa295d3[_0xfcf2('0x5a')][_0xfcf2('0x7d')]===_0xfcf2('0x5e')){return _0x5c588b[_0xfcf2('0x65')]({'read':!![]});}else{logger[_0xfcf2('0x25')](_0xfcf2('0x7e'),_0xfcf2('0x2a'),_0xfcf2('0x7b'),util[_0xfcf2('0x7a')](_0xa295d3[_0xfcf2('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x5c588b;}})[_0xfcf2('0x34')](respondWithResult(_0x14da0f,null))['catch'](handleError(_0x14da0f,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index f587c67..72da252 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(_0x249c51,_0x59ef58){var _0x5819a2=function(_0x4174e2){while(--_0x4174e2){_0x249c51['push'](_0x249c51['shift']());}};_0x5819a2(++_0x59ef58);}(_0x5f2f,0x73));var _0xf5f2=function(_0x9a9370,_0x25cd69){_0x9a9370=_0x9a9370-0x0;var _0x1418af=_0x5f2f[_0x9a9370];return _0x1418af;};'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(_0xdc1577,_0x383a92){var _0x31a819=function(_0x30eb91){while(--_0x30eb91){_0xdc1577['push'](_0xdc1577['shift']());}};_0x31a819(++_0x383a92);}(_0x7a54,0x106));var _0x47a5=function(_0x47de3e,_0x494e72){_0x47de3e=_0x47de3e-0x0;var _0x37a0d0=_0x7a54[_0x47de3e];return _0x37a0d0;};'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 ccdd975..6913481 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 _0x06fb=['WhatsappInteractionId','then','update','createdAt','error','find','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','finally','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne'];(function(_0x16b7d9,_0x4157ba){var _0x5810d1=function(_0x37b060){while(--_0x37b060){_0x16b7d9['push'](_0x16b7d9['shift']());}};_0x5810d1(++_0x4157ba);}(_0x06fb,0x190));var _0xb06f=function(_0x31c6b6,_0xdd33b7){_0x31c6b6=_0x31c6b6-0x0;var _0x32b27b=_0x06fb[_0x31c6b6];return _0x32b27b;};'use strict';var _=require('lodash');var util=require(_0xb06f('0x0'));var logger=require('../../config/logger')(_0xb06f('0x1'));var moment=require(_0xb06f('0x2'));var BPromise=require(_0xb06f('0x3'));var rp=require(_0xb06f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb06f('0x5'));module[_0xb06f('0x6')]=function(_0x20c8f0,_0x486a44){return _0x20c8f0[_0xb06f('0x7')](_0xb06f('0x8'),attributes,{'tableName':_0xb06f('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xb06f('0xa')]},{'name':_0xb06f('0xb'),'fields':[_0xb06f('0xc')],'type':_0xb06f('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4c72f9,_0x5a55a4,_0x4cc896){var _0x34b5c8=_0x20c8f0['models'];var _0x2e32f3=_0x4c72f9[_0xb06f('0xe')]({'plain':!![]});if(_0x2e32f3[_0xb06f('0xf')]['toLowerCase']()==='in'||_0x2e32f3[_0xb06f('0xf')][_0xb06f('0x10')]()===_0xb06f('0x11')&&!_0x2e32f3[_0xb06f('0x12')]&&!_[_0xb06f('0x13')](_0x2e32f3[_0xb06f('0x14')])){_0x34b5c8[_0xb06f('0x15')][_0xb06f('0x16')]({'where':{'id':_0x2e32f3[_0xb06f('0x17')]}})[_0xb06f('0x18')](function(_0x2a8c5d){if(_0x2a8c5d){_0x2a8c5d[_0xb06f('0x19')]({'lastMsgAt':_0x2e32f3[_0xb06f('0x1a')],'lastMsgDirection':_0x2e32f3[_0xb06f('0xf')]['toLowerCase']()});}})['catch'](function(_0x591a9f){console[_0xb06f('0x1b')](_0x591a9f);});}if(_0x2e32f3[_0xb06f('0xf')]==='out'&&!_0x2e32f3[_0xb06f('0x12')]){var _0x3efc2d;_0x34b5c8['WhatsappAccount'][_0xb06f('0x1c')]({'where':{'id':_0x2e32f3['WhatsappAccountId']},'raw':!![]})[_0xb06f('0x18')](function(_0x41933f){_0x3efc2d=_0x41933f;if(_0x3efc2d&&_0x3efc2d[_0xb06f('0x1d')]){switch(_0x3efc2d[_0xb06f('0x1d')]){case'twilio':var _0x71aeee=require(_0xb06f('0x1e'));if(_0x3efc2d[_0xb06f('0x1f')]&&_0x3efc2d[_0xb06f('0x20')]&&_0x3efc2d[_0xb06f('0x21')]){var _0x3b81b9=new _0x71aeee(_0x3efc2d[_0xb06f('0x1f')],_0x3efc2d[_0xb06f('0x20')]);_0x3b81b9[_0xb06f('0x22')][_0xb06f('0x23')]({'body':_0x2e32f3[_0xb06f('0xc')],'to':_0xb06f('0x24')+_0x2e32f3['phone'],'from':_0xb06f('0x24')+_0x3efc2d['phone'],'statusCallback':_0x3efc2d[_0xb06f('0x25')]+_0xb06f('0x26')+_0x2e32f3['id']+_0xb06f('0x27')+_0x3efc2d[_0xb06f('0x28')]})[_0xb06f('0x18')](function(_0x138c62){if(_0x138c62[_0xb06f('0x29')]){return _0x4c72f9[_0xb06f('0x19')]({'messageId':_0x138c62[_0xb06f('0x29')]});}})['catch'](function(_0x1d4c7a){logger[_0xb06f('0x1b')](_0xb06f('0x2a'),_0xb06f('0x2b'),_0xb06f('0x1e'),util[_0xb06f('0x2c')](_0x1d4c7a,{'showHidden':![],'depth':null}));});}else{logger[_0xb06f('0x1b')](_0xb06f('0x2a'),'afterCreate',_0xb06f('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0xb06f('0x2d')](function(){_0x4cc896();});}else{_0x4cc896();}}},'charset':'utf8mb4','collate':_0xb06f('0x2e')});}; \ No newline at end of file +var _0xfde6=['../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','messageId','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccountId','type','authToken','messages','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','request-promise','path'];(function(_0x2a71d2,_0x35bcda){var _0x200112=function(_0x40735f){while(--_0x40735f){_0x2a71d2['push'](_0x2a71d2['shift']());}};_0x200112(++_0x35bcda);}(_0xfde6,0xaf));var _0x6fde=function(_0x5711af,_0x230e23){_0x5711af=_0x5711af-0x0;var _0x4522c0=_0xfde6[_0x5711af];return _0x4522c0;};'use strict';var _=require('lodash');var util=require(_0x6fde('0x0'));var logger=require(_0x6fde('0x1'))('api');var moment=require(_0x6fde('0x2'));var BPromise=require('bluebird');var rp=require(_0x6fde('0x3'));var fs=require('fs');var path=require(_0x6fde('0x4'));var rimraf=require('rimraf');var config=require(_0x6fde('0x5'));var attributes=require(_0x6fde('0x6'));module[_0x6fde('0x7')]=function(_0x21d9d3,_0x4823f0){return _0x21d9d3['define'](_0x6fde('0x8'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x6fde('0x9'),'fields':[_0x6fde('0x9')]},{'name':'fti_whatsapp_messages','fields':[_0x6fde('0xa')],'type':_0x6fde('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x15e13f,_0x365704,_0x45d577){var _0x1ad321=_0x21d9d3[_0x6fde('0xc')];var _0x432a5d=_0x15e13f[_0x6fde('0xd')]({'plain':!![]});if(_0x432a5d['direction'][_0x6fde('0xe')]()==='in'||_0x432a5d[_0x6fde('0xf')]['toLowerCase']()===_0x6fde('0x10')&&!_0x432a5d[_0x6fde('0x11')]&&!_['isNil'](_0x432a5d[_0x6fde('0x12')])){_0x1ad321[_0x6fde('0x13')][_0x6fde('0x14')]({'where':{'id':_0x432a5d[_0x6fde('0x15')]}})[_0x6fde('0x16')](function(_0x5aaee0){if(_0x5aaee0){_0x5aaee0[_0x6fde('0x17')]({'lastMsgAt':_0x432a5d[_0x6fde('0x18')],'lastMsgDirection':_0x432a5d[_0x6fde('0xf')]['toLowerCase']()});}})[_0x6fde('0x19')](function(_0x2a5536){console[_0x6fde('0x1a')](_0x2a5536);});}if(_0x432a5d['direction']===_0x6fde('0x10')&&!_0x432a5d[_0x6fde('0x11')]){var _0x3faf1e;_0x1ad321['WhatsappAccount']['find']({'where':{'id':_0x432a5d[_0x6fde('0x1b')]},'raw':!![]})[_0x6fde('0x16')](function(_0x40ff96){_0x3faf1e=_0x40ff96;if(_0x3faf1e&&_0x3faf1e[_0x6fde('0x1c')]){switch(_0x3faf1e[_0x6fde('0x1c')]){case'twilio':var _0x4e7545=require('twilio');if(_0x3faf1e['accountSid']&&_0x3faf1e[_0x6fde('0x1d')]&&_0x3faf1e['phone']){var _0x51edd2=new _0x4e7545(_0x3faf1e['accountSid'],_0x3faf1e['authToken']);_0x51edd2[_0x6fde('0x1e')]['create']({'body':_0x432a5d[_0x6fde('0xa')],'to':_0x6fde('0x1f')+_0x432a5d[_0x6fde('0x20')],'from':'whatsapp:'+_0x3faf1e['phone'],'statusCallback':_0x3faf1e[_0x6fde('0x21')]+_0x6fde('0x22')+_0x432a5d['id']+_0x6fde('0x23')+_0x3faf1e[_0x6fde('0x24')]})[_0x6fde('0x16')](function(_0x149cdd){if(_0x149cdd['sid']){return _0x15e13f[_0x6fde('0x17')]({'messageId':_0x149cdd[_0x6fde('0x25')]});}})[_0x6fde('0x19')](function(_0x12fc9d){logger[_0x6fde('0x1a')](_0x6fde('0x26'),_0x6fde('0x27'),_0x6fde('0x28'),util['inspect'](_0x12fc9d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6fde('0x26'),_0x6fde('0x27'),_0x6fde('0x28'),_0x6fde('0x29'));}break;}}})[_0x6fde('0x2a')](function(){_0x45d577();});}else{_0x45d577();}}},'charset':_0x6fde('0x2b'),'collate':_0x6fde('0x2c')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 1c8ea43..d68778d 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 _0xb991=['../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','then','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x363294,_0x3e86d2){var _0x496446=function(_0x31435d){while(--_0x31435d){_0x363294['push'](_0x363294['shift']());}};_0x496446(++_0x3e86d2);}(_0xb991,0x1be));var _0x1b99=function(_0x568496,_0x565afd){_0x568496=_0x568496-0x0;var _0x26c5c1=_0xb991[_0x568496];return _0x26c5c1;};'use strict';var _=require(_0x1b99('0x0'));var util=require(_0x1b99('0x1'));var moment=require('moment');var BPromise=require(_0x1b99('0x2'));var rs=require(_0x1b99('0x3'));var fs=require('fs');var Redis=require(_0x1b99('0x4'));var db=require(_0x1b99('0x5'))['db'];var utils=require(_0x1b99('0x6'));var logger=require(_0x1b99('0x7'))(_0x1b99('0x8'));var config=require(_0x1b99('0x9'));var jayson=require(_0x1b99('0xa'));var client=jayson['client'][_0x1b99('0xb')]({'port':0x232a});config[_0x1b99('0xc')]=_[_0x1b99('0xd')](config[_0x1b99('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x1b99('0xe'))(new Redis(config['redis']));require(_0x1b99('0xf'))[_0x1b99('0x10')](socket);function respondWithRpcPromise(_0x541949,_0xf12e67,_0x5dc2f6){return new BPromise(function(_0x3e2ecc,_0x1279af){return client['request'](_0x541949,_0x5dc2f6)[_0x1b99('0x11')](function(_0x2d1941){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0xf12e67,_0x1b99('0x12'));logger[_0x1b99('0x13')](_0x1b99('0x14'),_0xf12e67,_0x1b99('0x12'),JSON[_0x1b99('0x15')](_0x2d1941));if(_0x2d1941[_0x1b99('0x16')]){if(_0x2d1941[_0x1b99('0x16')][_0x1b99('0x17')]===0x1f4){logger['error'](_0x1b99('0x18'),_0xf12e67,_0x2d1941['error'][_0x1b99('0x19')]);return _0x1279af(_0x2d1941['error']['message']);}logger[_0x1b99('0x16')](_0x1b99('0x18'),_0xf12e67,_0x2d1941[_0x1b99('0x16')]['message']);return _0x3e2ecc(_0x2d1941[_0x1b99('0x16')][_0x1b99('0x19')]);}else{logger[_0x1b99('0x1a')](_0x1b99('0x18'),_0xf12e67,_0x1b99('0x12'));_0x3e2ecc(_0x2d1941[_0x1b99('0x1b')]['message']);}})[_0x1b99('0x1c')](function(_0x4d0de9){logger[_0x1b99('0x16')](_0x1b99('0x18'),_0xf12e67,_0x4d0de9);_0x1279af(_0x4d0de9);});});}exports[_0x1b99('0x1d')]=function(_0x542473){var _0x7e1e77=this;return new Promise(function(_0x1e5731,_0x3f9bbd){return db[_0x1b99('0x1e')][_0x1b99('0x1f')](_0x542473[_0x1b99('0x20')],{'raw':_0x542473[_0x1b99('0x21')]?_0x542473['options'][_0x1b99('0x22')]===undefined?!![]:![]:!![]})[_0x1b99('0x11')](function(_0x51a303){logger[_0x1b99('0x1a')](_0x1b99('0x1d'),_0x542473);logger['debug'](_0x1b99('0x1d'),_0x542473,JSON[_0x1b99('0x15')](_0x51a303));_0x1e5731(_0x51a303);})['catch'](function(_0x23645a){logger['error'](_0x1b99('0x1d'),_0x23645a[_0x1b99('0x19')],_0x542473);_0x3f9bbd(_0x7e1e77['error'](0x1f4,_0x23645a[_0x1b99('0x19')]));});});}; \ No newline at end of file +var _0xd130=['then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateWhatsappMessage','WhatsappMessage','create','body','raw','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd130,0xd6));var _0x0d13=function(_0x34e522,_0x3e22b3){_0x34e522=_0x34e522-0x0;var _0x44b9ad=_0xd130[_0x34e522];return _0x44b9ad;};'use strict';var _=require(_0x0d13('0x0'));var util=require(_0x0d13('0x1'));var moment=require(_0x0d13('0x2'));var BPromise=require(_0x0d13('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d13('0x4'));var db=require(_0x0d13('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d13('0x6'))(_0x0d13('0x7'));var config=require('../../config/environment');var jayson=require(_0x0d13('0x8'));var client=jayson[_0x0d13('0x9')][_0x0d13('0xa')]({'port':0x232a});config['redis']=_[_0x0d13('0xb')](config[_0x0d13('0xc')],{'host':_0x0d13('0xd'),'port':0x18eb});var socket=require(_0x0d13('0xe'))(new Redis(config[_0x0d13('0xc')]));require(_0x0d13('0xf'))['register'](socket);function respondWithRpcPromise(_0x2899cc,_0x336135,_0x2f3422){return new BPromise(function(_0x4afdd8,_0x25ad01){return client[_0x0d13('0x10')](_0x2899cc,_0x2f3422)[_0x0d13('0x11')](function(_0x278b87){logger['info'](_0x0d13('0x12'),_0x336135,_0x0d13('0x13'));logger['debug'](_0x0d13('0x14'),_0x336135,_0x0d13('0x13'),JSON[_0x0d13('0x15')](_0x278b87));if(_0x278b87[_0x0d13('0x16')]){if(_0x278b87[_0x0d13('0x16')][_0x0d13('0x17')]===0x1f4){logger[_0x0d13('0x16')](_0x0d13('0x12'),_0x336135,_0x278b87[_0x0d13('0x16')][_0x0d13('0x18')]);return _0x25ad01(_0x278b87['error'][_0x0d13('0x18')]);}logger[_0x0d13('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x336135,_0x278b87[_0x0d13('0x16')][_0x0d13('0x18')]);return _0x4afdd8(_0x278b87['error'][_0x0d13('0x18')]);}else{logger[_0x0d13('0x19')](_0x0d13('0x12'),_0x336135,_0x0d13('0x13'));_0x4afdd8(_0x278b87['result'][_0x0d13('0x18')]);}})[_0x0d13('0x1a')](function(_0x110031){logger[_0x0d13('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x336135,_0x110031);_0x25ad01(_0x110031);});});}exports[_0x0d13('0x1b')]=function(_0xaf61a2){var _0x18c0da=this;return new Promise(function(_0x5ae36a,_0x4566e1){return db[_0x0d13('0x1c')][_0x0d13('0x1d')](_0xaf61a2[_0x0d13('0x1e')],{'raw':_0xaf61a2['options']?_0xaf61a2['options'][_0x0d13('0x1f')]===undefined?!![]:![]:!![]})[_0x0d13('0x11')](function(_0x1f7739){logger[_0x0d13('0x19')]('CreateWhatsappMessage',_0xaf61a2);logger[_0x0d13('0x20')](_0x0d13('0x1b'),_0xaf61a2,JSON[_0x0d13('0x15')](_0x1f7739));_0x5ae36a(_0x1f7739);})['catch'](function(_0x3eadee){logger['error'](_0x0d13('0x1b'),_0x3eadee[_0x0d13('0x18')],_0xaf61a2);_0x4566e1(_0x18c0da[_0x0d13('0x16')](0x1f4,_0x3eadee[_0x0d13('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 251ebad..8297dae 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 _0xb4a0=['register','whatsappMessage:','./whatsappMessage.events','remove','update','emit'];(function(_0x217a51,_0x9ce413){var _0x5b39e2=function(_0x3fe92){while(--_0x3fe92){_0x217a51['push'](_0x217a51['shift']());}};_0x5b39e2(++_0x9ce413);}(_0xb4a0,0x1e8));var _0x0b4a=function(_0xa2480f,_0x5e1224){_0xa2480f=_0xa2480f-0x0;var _0x4dd207=_0xb4a0[_0xa2480f];return _0x4dd207;};'use strict';var WhatsappMessageEvents=require(_0x0b4a('0x0'));var events=['save',_0x0b4a('0x1'),_0x0b4a('0x2')];function createListener(_0x2bd560,_0x352be4){return function(_0x4166ad){_0x352be4[_0x0b4a('0x3')](_0x2bd560,_0x4166ad);};}function removeListener(_0x268116,_0x4f6894){return function(){WhatsappMessageEvents['removeListener'](_0x268116,_0x4f6894);};}exports[_0x0b4a('0x4')]=function(_0x3b9ddb){for(var _0x41c4cf=0x0,_0x1bd469=events['length'];_0x41c4cf<_0x1bd469;_0x41c4cf++){var _0x351dec=events[_0x41c4cf];var _0x513c6c=createListener(_0x0b4a('0x5')+_0x351dec,_0x3b9ddb);WhatsappMessageEvents['on'](_0x351dec,_0x513c6c);}}; \ No newline at end of file +var _0xc26d=['remove','removeListener','register'];(function(_0x502e17,_0x36f1e5){var _0x1b9277=function(_0x38706a){while(--_0x38706a){_0x502e17['push'](_0x502e17['shift']());}};_0x1b9277(++_0x36f1e5);}(_0xc26d,0xd8));var _0xdc26=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc26d[_0x14add3];return _0x4a174f;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0xdc26('0x0'),'update'];function createListener(_0x2d9d35,_0x5d3908){return function(_0x17d902){_0x5d3908['emit'](_0x2d9d35,_0x17d902);};}function removeListener(_0x289d38,_0x2a5ed0){return function(){WhatsappMessageEvents[_0xdc26('0x1')](_0x289d38,_0x2a5ed0);};}exports[_0xdc26('0x2')]=function(_0x40e212){for(var _0x2ca84d=0x0,_0x1bbc41=events['length'];_0x2ca84d<_0x1bbc41;_0x2ca84d++){var _0x3a4c02=events[_0x2ca84d];var _0x1edc12=createListener('whatsappMessage:'+_0x3a4c02,_0x40e212);WhatsappMessageEvents['on'](_0x3a4c02,_0x1edc12);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index b8aaeca..00c080c 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 _0xa9fc=['/:id/teams','removeTeams','removeAgents','exports','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/members','getAgents','post','create','addTeams','/:id/users','addAgents','put','/:id','delete'];(function(_0xec9322,_0x2d5b87){var _0x39d576=function(_0x542056){while(--_0x542056){_0xec9322['push'](_0xec9322['shift']());}};_0x39d576(++_0x2d5b87);}(_0xa9fc,0x1be));var _0xca9f=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0xa9fc[_0x5b7788];return _0x573871;};'use strict';var multer=require('multer');var util=require(_0xca9f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xca9f('0x1')]();var fs_extra=require(_0xca9f('0x2'));var auth=require(_0xca9f('0x3'));var interaction=require(_0xca9f('0x4'));var config=require(_0xca9f('0x5'));var controller=require('./whatsappQueue.controller');router[_0xca9f('0x6')]('/',auth[_0xca9f('0x7')](),controller[_0xca9f('0x8')]);router[_0xca9f('0x6')](_0xca9f('0x9'),auth[_0xca9f('0x7')](),controller[_0xca9f('0xa')]);router['get']('/:id',auth[_0xca9f('0x7')](),controller[_0xca9f('0xb')]);router[_0xca9f('0x6')](_0xca9f('0xc'),auth['isAuthenticated'](),controller['getMembers']);router['get']('/:id/teams',auth[_0xca9f('0x7')](),controller['getTeams']);router['get']('/:id/users',auth[_0xca9f('0x7')](),controller[_0xca9f('0xd')]);router[_0xca9f('0xe')]('/',auth['isAuthenticated'](),controller[_0xca9f('0xf')]);router[_0xca9f('0xe')]('/:id/teams',auth['isAuthenticated'](),controller[_0xca9f('0x10')]);router[_0xca9f('0xe')](_0xca9f('0x11'),auth['isAuthenticated'](),controller[_0xca9f('0x12')]);router[_0xca9f('0x13')](_0xca9f('0x14'),auth[_0xca9f('0x7')](),controller['update']);router[_0xca9f('0x15')](_0xca9f('0x14'),auth[_0xca9f('0x7')](),controller['destroy']);router[_0xca9f('0x15')](_0xca9f('0x16'),auth['isAuthenticated'](),controller[_0xca9f('0x17')]);router['delete'](_0xca9f('0x11'),auth[_0xca9f('0x7')](),controller[_0xca9f('0x18')]);module[_0xca9f('0x19')]=router; \ No newline at end of file +var _0x9c70=['fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','show','/:id/members','/:id/teams','getAgents','post','create','addTeams','/:id/users','addAgents','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x19fc46,_0x5993f8){var _0x25aa8c=function(_0x28c6d2){while(--_0x28c6d2){_0x19fc46['push'](_0x19fc46['shift']());}};_0x25aa8c(++_0x5993f8);}(_0x9c70,0x98));var _0x09c7=function(_0x5f124a,_0x34e5d2){_0x5f124a=_0x5f124a-0x0;var _0x3717c1=_0x9c70[_0x5f124a];return _0x3717c1;};'use strict';var multer=require('multer');var util=require(_0x09c7('0x0'));var path=require('path');var timeout=require(_0x09c7('0x1'));var express=require(_0x09c7('0x2'));var router=express[_0x09c7('0x3')]();var fs_extra=require(_0x09c7('0x4'));var auth=require(_0x09c7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x09c7('0x6'));var controller=require(_0x09c7('0x7'));router[_0x09c7('0x8')]('/',auth[_0x09c7('0x9')](),controller[_0x09c7('0xa')]);router[_0x09c7('0x8')](_0x09c7('0xb'),auth[_0x09c7('0x9')](),controller['describe']);router[_0x09c7('0x8')]('/:id',auth[_0x09c7('0x9')](),controller[_0x09c7('0xc')]);router[_0x09c7('0x8')](_0x09c7('0xd'),auth[_0x09c7('0x9')](),controller['getMembers']);router[_0x09c7('0x8')](_0x09c7('0xe'),auth['isAuthenticated'](),controller['getTeams']);router[_0x09c7('0x8')]('/:id/users',auth[_0x09c7('0x9')](),controller[_0x09c7('0xf')]);router[_0x09c7('0x10')]('/',auth[_0x09c7('0x9')](),controller[_0x09c7('0x11')]);router[_0x09c7('0x10')](_0x09c7('0xe'),auth['isAuthenticated'](),controller[_0x09c7('0x12')]);router[_0x09c7('0x10')](_0x09c7('0x13'),auth[_0x09c7('0x9')](),controller[_0x09c7('0x14')]);router['put'](_0x09c7('0x15'),auth[_0x09c7('0x9')](),controller[_0x09c7('0x16')]);router[_0x09c7('0x17')](_0x09c7('0x15'),auth[_0x09c7('0x9')](),controller[_0x09c7('0x18')]);router['delete'](_0x09c7('0xe'),auth[_0x09c7('0x9')](),controller['removeTeams']);router[_0x09c7('0x17')](_0x09c7('0x13'),auth[_0x09c7('0x9')](),controller['removeAgents']);module[_0x09c7('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 23af136..c007fb7 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 _0x4766=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x59145a,_0x1f60f1){var _0xf04d7=function(_0x247581){while(--_0x247581){_0x59145a['push'](_0x59145a['shift']());}};_0xf04d7(++_0x1f60f1);}(_0x4766,0x114));var _0x6476=function(_0x159619,_0x58c92e){_0x159619=_0x159619-0x0;var _0x2c4c1d=_0x4766[_0x159619];return _0x2c4c1d;};'use strict';var Sequelize=require(_0x6476('0x0'));module['exports']={'name':{'type':Sequelize[_0x6476('0x1')],'unique':_0x6476('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x6476('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6476('0x4')](_0x6476('0x5'),_0x6476('0x6'),_0x6476('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0b7a=['rrmemory','beepall','roundrobin','sequelize','exports','name','INTEGER','ENUM'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0x0b7a,0xeb));var _0xa0b7=function(_0x25972c,_0x3512d9){_0x25972c=_0x25972c-0x0;var _0x2dda4e=_0x0b7a[_0x25972c];return _0x2dda4e;};'use strict';var Sequelize=require(_0xa0b7('0x0'));module[_0xa0b7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa0b7('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xa0b7('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa0b7('0x4')](_0xa0b7('0x5'),_0xa0b7('0x6'),_0xa0b7('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 a162f81..a3ff2ae 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 _0x7309=['pick','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','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','params','describe','getMembers','UserWhatsappQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','findOne','Team','getTeams','addTeams','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','TeamId','includes','all','union','compact','value','ids','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','omit','spread','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','Content-Range','apply','reject','save','then','get','destroy','end','error','name','send','index','map','WhatsappQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort'];(function(_0x137ae3,_0x4e93bf){var _0x3de34c=function(_0x3ecf5f){while(--_0x3ecf5f){_0x137ae3['push'](_0x137ae3['shift']());}};_0x3de34c(++_0x4e93bf);}(_0x7309,0xcf));var _0x9730=function(_0x4935b1,_0x18745c){_0x4935b1=_0x4935b1-0x0;var _0x242268=_0x7309[_0x4935b1];return _0x242268;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9730('0x0'));var jsonpatch=require(_0x9730('0x1'));var rp=require(_0x9730('0x2'));var moment=require(_0x9730('0x3'));var BPromise=require(_0x9730('0x4'));var Mustache=require('mustache');var util=require(_0x9730('0x5'));var path=require(_0x9730('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9730('0x7'));var _=require('lodash');var squel=require(_0x9730('0x8'));var crypto=require('crypto');var jsforce=require(_0x9730('0x9'));var deskjs=require(_0x9730('0xa'));var toCsv=require(_0x9730('0xb'));var querystring=require(_0x9730('0xc'));var Papa=require(_0x9730('0xd'));var Redis=require('ioredis');var authService=require(_0x9730('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9730('0xf'));var logger=require(_0x9730('0x10'))(_0x9730('0x11'));var utils=require(_0x9730('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x9730('0x13')]=_[_0x9730('0x14')](config[_0x9730('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x9730('0x15'))(new Redis(config[_0x9730('0x13')]));require('./whatsappQueue.socket')[_0x9730('0x16')](socket);function respondWithStatusCode(_0x41bbef,_0x3064b6){_0x3064b6=_0x3064b6||0xcc;return function(_0x42bb7a){if(_0x42bb7a){return _0x41bbef[_0x9730('0x17')](_0x3064b6);}return _0x41bbef[_0x9730('0x18')](_0x3064b6)['end']();};}function respondWithResult(_0x38f160,_0x30edba){_0x30edba=_0x30edba||0xc8;return function(_0x7a7d95){if(_0x7a7d95){return _0x38f160[_0x9730('0x18')](_0x30edba)[_0x9730('0x19')](_0x7a7d95);}};}function respondWithFilteredResult(_0x23e077,_0x1f9437){return function(_0x1142b1){if(_0x1142b1){var _0x27d543=_0x1142b1['count'],_0x17bf59=_0x1f9437['offset'],_0x362ba2=_0x1f9437[_0x9730('0x1a')]+_0x1f9437['limit'],_0x4b5a4c;if(_0x362ba2>=_0x27d543){_0x362ba2=_0x27d543;_0x4b5a4c=0xc8;}else{_0x4b5a4c=0xce;}_0x23e077[_0x9730('0x18')](_0x4b5a4c);return _0x23e077['set'](_0x9730('0x1b'),_0x17bf59+'-'+_0x362ba2+'/'+_0x27d543)['json'](_0x1142b1);}return null;};}function patchUpdates(_0x589a1a){return function(_0x1fd45d){try{jsonpatch[_0x9730('0x1c')](_0x1fd45d,_0x589a1a,!![]);}catch(_0x7cda29){return BPromise[_0x9730('0x1d')](_0x7cda29);}return _0x1fd45d[_0x9730('0x1e')]();};}function saveUpdates(_0x4431ff,_0x2347b7){return function(_0x46c1b7){if(_0x46c1b7){return _0x46c1b7['update'](_0x4431ff)['then'](function(_0x108922){return _0x108922;});}return null;};}function removeEntity(_0x5441ab,_0x4b058d){return function(_0x70a4f1){if(_0x70a4f1){return _0x70a4f1['destroy']()[_0x9730('0x1f')](function(){var _0x4ef12b=_0x70a4f1[_0x9730('0x20')]({'plain':!![]});var _0x3efe7e='WhatsappQueues';return db['UserProfileResource'][_0x9730('0x21')]({'where':{'type':_0x3efe7e,'resourceId':_0x4ef12b['id']}})[_0x9730('0x1f')](function(){return _0x70a4f1;});})['then'](function(){_0x5441ab[_0x9730('0x18')](0xcc)[_0x9730('0x22')]();});}};}function handleEntityNotFound(_0x2ae650,_0x42ea46){return function(_0xd63f72){if(!_0xd63f72){_0x2ae650[_0x9730('0x17')](0x194);}return _0xd63f72;};}function handleError(_0x25c8ed,_0xdafe02){_0xdafe02=_0xdafe02||0x1f4;return function(_0xbf6554){logger[_0x9730('0x23')](_0xbf6554['stack']);if(_0xbf6554[_0x9730('0x24')]){delete _0xbf6554['name'];}_0x25c8ed[_0x9730('0x18')](_0xdafe02)[_0x9730('0x25')](_0xbf6554);};}exports[_0x9730('0x26')]=function(_0x5902df,_0xc867b0){var _0x3fb047={},_0x59cfc8={},_0x4f16e2={'count':0x0,'rows':[]};var _0x359253=_[_0x9730('0x27')](db[_0x9730('0x28')][_0x9730('0x29')],function(_0x15b5f0){return{'name':_0x15b5f0['fieldName'],'type':_0x15b5f0[_0x9730('0x2a')][_0x9730('0x2b')]};});_0x59cfc8[_0x9730('0x2c')]=_['map'](_0x359253,'name');_0x59cfc8[_0x9730('0x2d')]=_[_0x9730('0x2e')](_0x5902df['query']);_0x59cfc8[_0x9730('0x2f')]=_[_0x9730('0x30')](_0x59cfc8['model'],_0x59cfc8[_0x9730('0x2d')]);_0x3fb047[_0x9730('0x31')]=_[_0x9730('0x30')](_0x59cfc8[_0x9730('0x2c')],qs[_0x9730('0x32')](_0x5902df['query'][_0x9730('0x32')]));_0x3fb047[_0x9730('0x31')]=_0x3fb047['attributes'][_0x9730('0x33')]?_0x3fb047[_0x9730('0x31')]:_0x59cfc8[_0x9730('0x2c')];if(!_0x5902df['query'][_0x9730('0x34')](_0x9730('0x35'))){_0x3fb047[_0x9730('0x36')]=qs[_0x9730('0x36')](_0x5902df[_0x9730('0x2d')][_0x9730('0x36')]);_0x3fb047[_0x9730('0x1a')]=qs[_0x9730('0x1a')](_0x5902df['query'][_0x9730('0x1a')]);}_0x3fb047[_0x9730('0x37')]=qs['sort'](_0x5902df[_0x9730('0x2d')][_0x9730('0x38')]);_0x3fb047['where']=qs[_0x9730('0x2f')](_[_0x9730('0x39')](_0x5902df['query'],_0x59cfc8[_0x9730('0x2f')]),_0x359253);if(_0x5902df['query'][_0x9730('0x3a')]){_0x3fb047[_0x9730('0x3b')]=_[_0x9730('0x3c')](_0x3fb047[_0x9730('0x3b')],{'$or':_[_0x9730('0x27')](_0x359253,function(_0xdbf2d){if(_0xdbf2d['type']!==_0x9730('0x3d')){var _0x5e34ad={};_0x5e34ad[_0xdbf2d[_0x9730('0x24')]]={'$like':'%'+_0x5902df[_0x9730('0x2d')][_0x9730('0x3a')]+'%'};return _0x5e34ad;}})});}_0x3fb047=_[_0x9730('0x3c')]({},_0x3fb047,_0x5902df['options']);var _0x445835={'where':_0x3fb047[_0x9730('0x3b')]};return db[_0x9730('0x28')][_0x9730('0x3e')](_0x445835)[_0x9730('0x1f')](function(_0x82157){_0x4f16e2['count']=_0x82157;if(_0x5902df[_0x9730('0x2d')][_0x9730('0x3f')]){_0x3fb047[_0x9730('0x40')]=[{'all':!![]}];}return db[_0x9730('0x28')][_0x9730('0x41')](_0x3fb047);})[_0x9730('0x1f')](function(_0x300ebc){_0x4f16e2[_0x9730('0x42')]=_0x300ebc;return _0x4f16e2;})[_0x9730('0x1f')](respondWithFilteredResult(_0xc867b0,_0x3fb047))[_0x9730('0x43')](handleError(_0xc867b0,null));};exports[_0x9730('0x44')]=function(_0x13c4c6,_0x4a8e93){var _0x3a0b05={'raw':!![],'where':{'id':_0x13c4c6['params']['id']}},_0x440e27={};_0x440e27[_0x9730('0x2c')]=_['keys'](db[_0x9730('0x28')][_0x9730('0x29')]);_0x440e27[_0x9730('0x2d')]=_[_0x9730('0x2e')](_0x13c4c6[_0x9730('0x2d')]);_0x440e27[_0x9730('0x2f')]=_[_0x9730('0x30')](_0x440e27['model'],_0x440e27[_0x9730('0x2d')]);_0x3a0b05[_0x9730('0x31')]=_['intersection'](_0x440e27[_0x9730('0x2c')],qs[_0x9730('0x32')](_0x13c4c6[_0x9730('0x2d')][_0x9730('0x32')]));_0x3a0b05[_0x9730('0x31')]=_0x3a0b05[_0x9730('0x31')][_0x9730('0x33')]?_0x3a0b05[_0x9730('0x31')]:_0x440e27[_0x9730('0x2c')];if(_0x13c4c6[_0x9730('0x2d')]['includeAll']){_0x3a0b05[_0x9730('0x40')]=[{'all':!![]}];}_0x3a0b05=_['merge']({},_0x3a0b05,_0x13c4c6[_0x9730('0x45')]);return db[_0x9730('0x28')][_0x9730('0x46')](_0x3a0b05)[_0x9730('0x1f')](handleEntityNotFound(_0x4a8e93,null))[_0x9730('0x1f')](respondWithResult(_0x4a8e93,null))[_0x9730('0x43')](handleError(_0x4a8e93,null));};exports['create']=function(_0x322cbc,_0x4a408f){return db['WhatsappQueue'][_0x9730('0x47')](_0x322cbc[_0x9730('0x48')],{})[_0x9730('0x1f')](function(_0xbc0ac2){var _0x58f31a=_0x322cbc['user']['get']({'plain':!![]});if(!_0x58f31a)throw new Error(_0x9730('0x49'));if(_0x58f31a[_0x9730('0x4a')]===_0x9730('0x4b')){var _0x48ce43=_0xbc0ac2[_0x9730('0x20')]({'plain':!![]});var _0x4808de='WhatsappQueues';return db[_0x9730('0x4c')]['find']({'where':{'name':_0x4808de,'userProfileId':_0x58f31a[_0x9730('0x4d')]},'raw':!![]})[_0x9730('0x1f')](function(_0x4dd8fe){if(_0x4dd8fe&&_0x4dd8fe[_0x9730('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x48ce43[_0x9730('0x24')],'resourceId':_0x48ce43['id'],'type':_0x4dd8fe['name'],'sectionId':_0x4dd8fe['id']},{})['then'](function(){return _0xbc0ac2;});}else{return _0xbc0ac2;}})[_0x9730('0x43')](function(_0x461d03){logger[_0x9730('0x23')](_0x9730('0x4f'),_0x461d03);throw _0x461d03;});}return _0xbc0ac2;})['then'](respondWithResult(_0x4a408f,0xc9))[_0x9730('0x43')](handleError(_0x4a408f,null));};exports['update']=function(_0x36d662,_0x573864){if(_0x36d662[_0x9730('0x48')]['id']){delete _0x36d662['body']['id'];}return db[_0x9730('0x28')][_0x9730('0x46')]({'where':{'id':_0x36d662[_0x9730('0x50')]['id']}})[_0x9730('0x1f')](handleEntityNotFound(_0x573864,null))['then'](saveUpdates(_0x36d662[_0x9730('0x48')],null))['then'](respondWithResult(_0x573864,null))[_0x9730('0x43')](handleError(_0x573864,null));};exports['destroy']=function(_0x47e8b3,_0x1857de){return db[_0x9730('0x28')][_0x9730('0x46')]({'where':{'id':_0x47e8b3[_0x9730('0x50')]['id']}})[_0x9730('0x1f')](handleEntityNotFound(_0x1857de,null))[_0x9730('0x1f')](removeEntity(_0x1857de,null))[_0x9730('0x43')](handleError(_0x1857de,null));};exports[_0x9730('0x51')]=function(_0x8fe933,_0x5574b9){return db[_0x9730('0x28')]['describe']()[_0x9730('0x1f')](respondWithResult(_0x5574b9,null))[_0x9730('0x43')](handleError(_0x5574b9,null));};exports[_0x9730('0x52')]=function(_0x5a1d4b,_0x2b1c6b,_0xd98cbb){var _0x152557={'raw':!![],'where':{}},_0x57cc91={},_0x4747e8;return db[_0x9730('0x28')]['findOne']({'where':{'id':_0x5a1d4b['params']['id']}})[_0x9730('0x1f')](handleEntityNotFound(_0x2b1c6b,null))[_0x9730('0x1f')](function(_0x24367a){if(_0x24367a){_0x4747e8=_0x24367a[_0x9730('0x20')]({'plain':!![]});_0x57cc91[_0x9730('0x2c')]=_[_0x9730('0x2e')](db[_0x9730('0x53')][_0x9730('0x29')]);_0x57cc91[_0x9730('0x2d')]=_['keys'](_0x5a1d4b['query']);_0x57cc91[_0x9730('0x2f')]=_[_0x9730('0x30')](_0x57cc91[_0x9730('0x2c')],_0x57cc91[_0x9730('0x2d')]);_0x152557[_0x9730('0x31')]=_[_0x9730('0x30')](_0x57cc91[_0x9730('0x2c')],qs[_0x9730('0x32')](_0x5a1d4b[_0x9730('0x2d')][_0x9730('0x32')]));_0x152557[_0x9730('0x31')]=_0x152557[_0x9730('0x31')][_0x9730('0x33')]?_0x152557[_0x9730('0x31')]:_0x57cc91[_0x9730('0x2c')];if(!_0x5a1d4b[_0x9730('0x2d')][_0x9730('0x34')](_0x9730('0x35'))){_0x152557['limit']=qs[_0x9730('0x36')](_0x5a1d4b[_0x9730('0x2d')][_0x9730('0x36')]);_0x152557[_0x9730('0x1a')]=qs[_0x9730('0x1a')](_0x5a1d4b['query']['offset']);}_0x152557['order']=qs[_0x9730('0x38')](_0x5a1d4b['query'][_0x9730('0x38')]);_0x152557[_0x9730('0x3b')]=qs[_0x9730('0x2f')](_['pick'](_0x5a1d4b[_0x9730('0x2d')],_0x57cc91[_0x9730('0x2f')]));_0x152557[_0x9730('0x3b')]['WhatsappQueueId']=_0x24367a['id'];if(_0x5a1d4b[_0x9730('0x2d')][_0x9730('0x3a')]){_0x152557[_0x9730('0x3b')]=_['merge'](_0x152557['where'],{'$or':_[_0x9730('0x27')](_0x152557[_0x9730('0x31')],function(_0x356827){var _0x59fcd1={};_0x59fcd1[_0x356827]={'$like':'%'+_0x5a1d4b[_0x9730('0x2d')][_0x9730('0x3a')]+'%'};return _0x59fcd1;})});}_0x152557=_[_0x9730('0x3c')]({},_0x152557,_0x5a1d4b[_0x9730('0x45')]);return db[_0x9730('0x53')][_0x9730('0x41')](_0x152557);}})['then'](function(_0x105611){if(_0x105611){return db[_0x9730('0x54')][_0x9730('0x55')]({'where':{'id':_[_0x9730('0x27')](_0x105611,_0x9730('0x56')),'role':_0x9730('0x57')},'attributes':['id',_0x9730('0x24'),'whatsappPause',_0x9730('0x58'),_0x9730('0x59')]});}})['then'](function(_0x14bc18){if(_0x14bc18){return{'count':_0x14bc18[_0x9730('0x3e')],'rows':_[_0x9730('0x27')](_0x14bc18[_0x9730('0x42')],function(_0x222a32){return{'membername':_0x222a32[_0x9730('0x24')],'UserId':_0x222a32['id'],'queue_name':_0x4747e8[_0x9730('0x24')],'WhatsappQueueId':_0x4747e8['id'],'interface':util[_0x9730('0x5a')](_0x9730('0x5b'),'SIP',_0x222a32[_0x9730('0x24')]),'penalty':0x0,'paused':_0x222a32['whatsappPause'],'createdAt':_0x222a32[_0x9730('0x59')],'updatedAt':_0x222a32[_0x9730('0x58')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9730('0x1f')](respondWithFilteredResult(_0x2b1c6b,_0x152557))[_0x9730('0x43')](handleError(_0x2b1c6b,null));};exports['getTeams']=function(_0x3c4b02,_0x3c0de1,_0x1bae99){var _0x54c298={};var _0xfd5892={};var _0x276bff;var _0x2d36b3;return db['WhatsappQueue'][_0x9730('0x5c')]({'where':{'id':_0x3c4b02[_0x9730('0x50')]['id']}})[_0x9730('0x1f')](handleEntityNotFound(_0x3c0de1,null))[_0x9730('0x1f')](function(_0x3030a5){if(_0x3030a5){_0x276bff=_0x3030a5;_0xfd5892[_0x9730('0x2c')]=_['keys'](db[_0x9730('0x5d')][_0x9730('0x29')]);_0xfd5892[_0x9730('0x2d')]=_[_0x9730('0x2e')](_0x3c4b02[_0x9730('0x2d')]);_0xfd5892['filters']=_[_0x9730('0x30')](_0xfd5892['model'],_0xfd5892['query']);_0x54c298[_0x9730('0x31')]=_[_0x9730('0x30')](_0xfd5892[_0x9730('0x2c')],qs[_0x9730('0x32')](_0x3c4b02[_0x9730('0x2d')]['fields']));_0x54c298['attributes']=_0x54c298[_0x9730('0x31')][_0x9730('0x33')]?_0x54c298['attributes']:_0xfd5892['model'];_0x54c298[_0x9730('0x37')]=qs[_0x9730('0x38')](_0x3c4b02[_0x9730('0x2d')][_0x9730('0x38')]);_0x54c298['where']=qs[_0x9730('0x2f')](_[_0x9730('0x39')](_0x3c4b02[_0x9730('0x2d')],_0xfd5892['filters']));if(_0x3c4b02[_0x9730('0x2d')][_0x9730('0x3a')]){_0x54c298[_0x9730('0x3b')]=_['merge'](_0x54c298[_0x9730('0x3b')],{'$or':_[_0x9730('0x27')](_0x54c298[_0x9730('0x31')],function(_0x1ee443){var _0x2457db={};_0x2457db[_0x1ee443]={'$like':'%'+_0x3c4b02[_0x9730('0x2d')][_0x9730('0x3a')]+'%'};return _0x2457db;})});}_0x54c298=_['merge']({},_0x54c298,_0x3c4b02['options']);return _0x276bff[_0x9730('0x5e')](_0x54c298);}})[_0x9730('0x1f')](function(_0x3d074f){if(_0x3d074f){_0x2d36b3=_0x3d074f[_0x9730('0x33')];if(!_0x3c4b02[_0x9730('0x2d')][_0x9730('0x34')](_0x9730('0x35'))){_0x54c298[_0x9730('0x36')]=qs[_0x9730('0x36')](_0x3c4b02[_0x9730('0x2d')][_0x9730('0x36')]);_0x54c298[_0x9730('0x1a')]=qs[_0x9730('0x1a')](_0x3c4b02[_0x9730('0x2d')][_0x9730('0x1a')]);}return _0x276bff['getTeams'](_0x54c298);}})[_0x9730('0x1f')](function(_0x53ceb1){if(_0x53ceb1){return _0x53ceb1?{'count':_0x2d36b3,'rows':_0x53ceb1}:null;}})[_0x9730('0x1f')](respondWithResult(_0x3c0de1,null))[_0x9730('0x43')](handleError(_0x3c0de1,null));};exports[_0x9730('0x5f')]=function(_0x51f7b7,_0x3177db,_0x57633f){var _0xc45ddf=_0x51f7b7[_0x9730('0x48')]['ids'];return db[_0x9730('0x5d')][_0x9730('0x41')]({'where':{'id':_0xc45ddf},'attributes':['id'],'include':[{'model':db[_0x9730('0x54')],'as':_0x9730('0x60'),'attributes':['id',_0x9730('0x24'),_0x9730('0x61'),'voicePause',_0x9730('0x62')],'raw':!![]}]})[_0x9730('0x1f')](function(_0x217b82){if(_0x217b82){var _0x5a81f0=_[_0x9730('0x63')](_0x217b82,function(_0x2c98d2){var _0x450956=_0x2c98d2[_0x9730('0x20')]({'plain':!![]});return _0x450956[_0x9730('0x60')];});return db[_0x9730('0x28')][_0x9730('0x46')]({'where':{'id':_0x51f7b7[_0x9730('0x50')]['id']}})[_0x9730('0x1f')](function(_0x1bdb5b){return db[_0x9730('0x64')][_0x9730('0x65')](function(_0x283d00){return _0x1bdb5b[_0x9730('0x5f')](_0xc45ddf,{'transaction':_0x283d00})[_0x9730('0x1f')](function(){return BPromise[_0x9730('0x66')](_0x5a81f0,function(_0x37657f){return db[_0x9730('0x53')][_0x9730('0x67')]({'where':{'UserId':_0x37657f['id'],'WhatsappQueueId':_0x51f7b7[_0x9730('0x50')]['id']},'transaction':_0x283d00});});})[_0x9730('0x1f')](function(){_0x5a81f0[_0x9730('0x68')](function(_0x2f62d2){socket['emit'](_0x9730('0x69'),{'UserId':_0x2f62d2['id'],'WhatsappQueueId':_0x1bdb5b['id']});});});});});}})[_0x9730('0x1f')](respondWithStatusCode(_0x3177db,null))[_0x9730('0x43')](handleError(_0x3177db,null));};exports[_0x9730('0x6a')]=function(_0x2b052b,_0xc78003,_0xab3598){return db[_0x9730('0x5d')][_0x9730('0x41')]({'where':{'id':_0x2b052b['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9730('0x60'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xc78003,null))['then'](function(_0x536988){var _0x32e5c9=_[_0x9730('0x27')](_0x536988,'id');var _0x44402d=[];var _0x3e7dc4=[];var _0x1e62bf=squel[_0x9730('0x6b')]();_0x1e62bf['field'](_0x9730('0x6c'))[_0x9730('0x6d')]('team_has_whatsapp_queues','tq')[_0x9730('0x6e')](_0x9730('0x6f'),'ut',_0x9730('0x70'))[_0x9730('0x3b')]('WhatsappQueueId\x20=\x20?',_0x2b052b[_0x9730('0x50')]['id']);for(var _0x49c1b6=0x0;_0x49c1b6<_0x536988[_0x9730('0x33')];_0x49c1b6+=0x1){let _0x2dc4da=_0x536988[_0x49c1b6];for(var _0x50cb4b=0x0;_0x50cb4b<_0x2dc4da[_0x9730('0x60')][_0x9730('0x33')];_0x50cb4b+=0x1){let _0x2c904e=_0x2dc4da[_0x9730('0x60')][_0x50cb4b];var _0x18cfe1=_0x1e62bf[_0x9730('0x71')]();_0x18cfe1[_0x9730('0x3b')](_0x9730('0x72'),_0x2c904e['id']);_0x3e7dc4['push'](db['sequelize'][_0x9730('0x2d')](_0x18cfe1[_0x9730('0x73')](),{'type':db[_0x9730('0x64')][_0x9730('0x74')]['SELECT']})[_0x9730('0x1f')](function(_0x36f982){if(_0x36f982['length']===0x1){return _0x2c904e['id'];}else{var _0x6621d=_['every'](_['map'](_0x36f982,_0x9730('0x75')),function(_0x368971){return _[_0x9730('0x76')](_0x32e5c9,_0x368971);});if(_0x6621d){return _0x2c904e['id'];}}}));}}return BPromise[_0x9730('0x77')](_0x3e7dc4)[_0x9730('0x1f')](function(_0x275b59){_0x44402d=_(_0x44402d)[_0x9730('0x78')](_0x275b59)[_0x9730('0x79')]()[_0x9730('0x7a')]();return db[_0x9730('0x28')][_0x9730('0x46')]({'where':{'id':_0x2b052b[_0x9730('0x50')]['id']}})[_0x9730('0x1f')](function(_0xfa24f8){return db['sequelize'][_0x9730('0x65')](function(_0x59b415){return _0xfa24f8[_0x9730('0x6a')](_0x2b052b[_0x9730('0x2d')][_0x9730('0x7b')],{'transaction':_0x59b415})[_0x9730('0x1f')](function(){if(!_[_0x9730('0x7c')](_0x44402d)){return _0xfa24f8[_0x9730('0x7d')](_0x44402d,{'transaction':_0x59b415});}})[_0x9730('0x1f')](function(){_0x44402d[_0x9730('0x68')](function(_0x55aae7){socket[_0x9730('0x7e')](_0x9730('0x7f'),{'UserId':_0x55aae7,'WhatsappQueueId':_0xfa24f8['id']});});});});});});})[_0x9730('0x1f')](respondWithStatusCode(_0xc78003,null))[_0x9730('0x43')](handleError(_0xc78003,null));};exports[_0x9730('0x80')]=function(_0xdc8b92,_0x3cddc5,_0x9dab8f){return db[_0x9730('0x28')][_0x9730('0x46')]({'where':{'id':_0xdc8b92[_0x9730('0x50')]['id']}})[_0x9730('0x1f')](handleEntityNotFound(_0x3cddc5,null))[_0x9730('0x1f')](function(_0x454b3b){if(_0x454b3b){return _0x454b3b[_0x9730('0x80')](_0xdc8b92[_0x9730('0x48')][_0x9730('0x7b')],_[_0x9730('0x81')](_0xdc8b92[_0x9730('0x48')],[_0x9730('0x7b'),'id'])||{})[_0x9730('0x82')](function(_0x6f1220){for(var _0x3fe8d3=0x0;_0x3fe8d3<_0xdc8b92[_0x9730('0x48')]['ids']['length'];_0x3fe8d3+=0x1){socket[_0x9730('0x7e')]('userWhatsappQueue:save',{'UserId':_0xdc8b92[_0x9730('0x48')]['ids'][_0x3fe8d3],'WhatsappQueueId':_0xdc8b92[_0x9730('0x50')]['id']});}return _0x6f1220;});}})['then'](respondWithResult(_0x3cddc5,null))['catch'](handleError(_0x3cddc5,null));};exports['removeAgents']=function(_0x7e0d93,_0x50a39e,_0x5156f8){return db[_0x9730('0x28')][_0x9730('0x46')]({'where':{'id':_0x7e0d93[_0x9730('0x50')]['id']}})[_0x9730('0x1f')](handleEntityNotFound(_0x50a39e,null))[_0x9730('0x1f')](function(_0x444cbf){if(_0x444cbf){return _0x444cbf[_0x9730('0x7d')](_0x7e0d93[_0x9730('0x2d')][_0x9730('0x7b')])[_0x9730('0x1f')](function(){if(_['isArray'](_0x7e0d93['query']['ids'])){for(var _0xe5b7e8=0x0;_0xe5b7e8<_0x7e0d93[_0x9730('0x2d')][_0x9730('0x7b')][_0x9730('0x33')];_0xe5b7e8+=0x1){socket[_0x9730('0x7e')](_0x9730('0x7f'),{'UserId':Number(_0x7e0d93[_0x9730('0x2d')]['ids'][_0xe5b7e8]),'WhatsappQueueId':Number(_0x7e0d93['params']['id'])});}}else{socket[_0x9730('0x7e')](_0x9730('0x7f'),{'UserId':Number(_0x7e0d93[_0x9730('0x2d')][_0x9730('0x7b')]),'WhatsappQueueId':Number(_0x7e0d93[_0x9730('0x50')]['id'])});}});}})[_0x9730('0x1f')](respondWithStatusCode(_0x50a39e,null))[_0x9730('0x43')](handleError(_0x50a39e,null));};exports[_0x9730('0x83')]=function(_0x3a7c2e,_0x1729a2,_0x10d163){var _0x498673={};var _0x5c06bd={};var _0x878b;var _0x28b65f;return db['WhatsappQueue']['findOne']({'where':{'id':_0x3a7c2e[_0x9730('0x50')]['id']}})[_0x9730('0x1f')](handleEntityNotFound(_0x1729a2,null))[_0x9730('0x1f')](function(_0x137f2b){if(_0x137f2b){_0x878b=_0x137f2b;_0x5c06bd[_0x9730('0x2c')]=_[_0x9730('0x2e')](db[_0x9730('0x54')]['rawAttributes']);_0x5c06bd[_0x9730('0x2d')]=_[_0x9730('0x2e')](_0x3a7c2e[_0x9730('0x2d')]);_0x5c06bd[_0x9730('0x2f')]=_[_0x9730('0x30')](_0x5c06bd[_0x9730('0x2c')],_0x5c06bd['query']);_0x498673[_0x9730('0x31')]=_[_0x9730('0x30')](_0x5c06bd[_0x9730('0x2c')],qs[_0x9730('0x32')](_0x3a7c2e['query'][_0x9730('0x32')]));_0x498673[_0x9730('0x31')]=_0x498673[_0x9730('0x31')][_0x9730('0x33')]?_0x498673[_0x9730('0x31')]:_0x5c06bd[_0x9730('0x2c')];_0x498673[_0x9730('0x37')]=qs[_0x9730('0x38')](_0x3a7c2e[_0x9730('0x2d')]['sort']);_0x498673[_0x9730('0x3b')]=qs[_0x9730('0x2f')](_[_0x9730('0x39')](_0x3a7c2e[_0x9730('0x2d')],_0x5c06bd['filters']));if(_0x3a7c2e[_0x9730('0x2d')]['filter']){_0x498673['where']=_[_0x9730('0x3c')](_0x498673['where'],{'$or':_[_0x9730('0x27')](_0x498673[_0x9730('0x31')],function(_0x32517b){var _0x115b6c={};_0x115b6c[_0x32517b]={'$like':'%'+_0x3a7c2e[_0x9730('0x2d')]['filter']+'%'};return _0x115b6c;})});}_0x498673=_[_0x9730('0x3c')]({},_0x498673,_0x3a7c2e[_0x9730('0x45')]);return _0x878b[_0x9730('0x83')](_0x498673);}})[_0x9730('0x1f')](function(_0x4a74cf){if(_0x4a74cf){_0x28b65f=_0x4a74cf[_0x9730('0x33')];if(!_0x3a7c2e[_0x9730('0x2d')][_0x9730('0x34')](_0x9730('0x35'))){_0x498673['limit']=qs[_0x9730('0x36')](_0x3a7c2e['query'][_0x9730('0x36')]);_0x498673[_0x9730('0x1a')]=qs['offset'](_0x3a7c2e[_0x9730('0x2d')]['offset']);}return _0x878b[_0x9730('0x83')](_0x498673);}})[_0x9730('0x1f')](function(_0x338678){if(_0x338678){return _0x338678?{'count':_0x28b65f,'rows':_0x338678}:null;}})[_0x9730('0x1f')](respondWithResult(_0x1729a2,null))[_0x9730('0x43')](handleError(_0x1729a2,null));}; \ No newline at end of file +var _0x00fa=['addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','./whatsappQueue.socket','register','sendStatus','json','count','offset','limit','status','Content-Range','apply','reject','save','update','then','UserProfileResource','destroy','error','stack','name','index','map','WhatsappQueue','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','show','keys','includeAll','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserWhatsappQueue','rawAttributes','hasOwnProperty','WhatsappQueueId','UserId','agent','createdAt','rows','format','%s/%s','whatsappPause','updatedAt','getTeams','Team','addTeams','Agents','online','interface','flatMap','sequelize','transaction','forEach','emit','userWhatsappQueue:save','removeTeams','User','select','field','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','union','compact','value','ids','isEmpty','removeAgents','userWhatsappQueue:remove'];(function(_0x340762,_0x3113e3){var _0x37e642=function(_0x9ea744){while(--_0x9ea744){_0x340762['push'](_0x340762['shift']());}};_0x37e642(++_0x3113e3);}(_0x00fa,0x1a6));var _0xa00f=function(_0x57d330,_0x5cb0ae){_0x57d330=_0x57d330-0x0;var _0x81578f=_0x00fa[_0x57d330];return _0x81578f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa00f('0x0'));var zipdir=require(_0xa00f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa00f('0x2'));var moment=require(_0xa00f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa00f('0x4'));var sox=require(_0xa00f('0x5'));var csv=require(_0xa00f('0x6'));var ejs=require(_0xa00f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa00f('0x8'));var squel=require(_0xa00f('0x9'));var crypto=require(_0xa00f('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa00f('0x6'));var querystring=require(_0xa00f('0xb'));var Papa=require(_0xa00f('0xc'));var Redis=require(_0xa00f('0xd'));var authService=require(_0xa00f('0xe'));var qs=require(_0xa00f('0xf'));var as=require(_0xa00f('0x10'));var hardwareService=require(_0xa00f('0x11'));var logger=require(_0xa00f('0x12'))(_0xa00f('0x13'));var utils=require(_0xa00f('0x14'));var config=require(_0xa00f('0x15'));var licenseUtil=require(_0xa00f('0x16'));var db=require(_0xa00f('0x17'))['db'];config['redis']=_[_0xa00f('0x18')](config['redis'],{'host':_0xa00f('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa00f('0x1a'))[_0xa00f('0x1b')](socket);function respondWithStatusCode(_0x1f88f4,_0x4156fe){_0x4156fe=_0x4156fe||0xcc;return function(_0x28ff2b){if(_0x28ff2b){return _0x1f88f4[_0xa00f('0x1c')](_0x4156fe);}return _0x1f88f4['status'](_0x4156fe)['end']();};}function respondWithResult(_0xebde38,_0x50757d){_0x50757d=_0x50757d||0xc8;return function(_0x4ce7e3){if(_0x4ce7e3){return _0xebde38['status'](_0x50757d)[_0xa00f('0x1d')](_0x4ce7e3);}};}function respondWithFilteredResult(_0x4fd083,_0x53afe4){return function(_0x2a827f){if(_0x2a827f){var _0x1698c9=_0x2a827f[_0xa00f('0x1e')],_0x18145f=_0x53afe4[_0xa00f('0x1f')],_0x37e1c1=_0x53afe4['offset']+_0x53afe4[_0xa00f('0x20')],_0x1bcceb;if(_0x37e1c1>=_0x1698c9){_0x37e1c1=_0x1698c9;_0x1bcceb=0xc8;}else{_0x1bcceb=0xce;}_0x4fd083[_0xa00f('0x21')](_0x1bcceb);return _0x4fd083['set'](_0xa00f('0x22'),_0x18145f+'-'+_0x37e1c1+'/'+_0x1698c9)[_0xa00f('0x1d')](_0x2a827f);}return null;};}function patchUpdates(_0x5d135a){return function(_0x2e9996){try{jsonpatch[_0xa00f('0x23')](_0x2e9996,_0x5d135a,!![]);}catch(_0x320007){return BPromise[_0xa00f('0x24')](_0x320007);}return _0x2e9996[_0xa00f('0x25')]();};}function saveUpdates(_0x7b55b6,_0x45c0aa){return function(_0x220f1c){if(_0x220f1c){return _0x220f1c[_0xa00f('0x26')](_0x7b55b6)[_0xa00f('0x27')](function(_0x19e45f){return _0x19e45f;});}return null;};}function removeEntity(_0x161b75,_0x43d767){return function(_0x2fe1bf){if(_0x2fe1bf){return _0x2fe1bf['destroy']()[_0xa00f('0x27')](function(){var _0x3054a5=_0x2fe1bf['get']({'plain':!![]});var _0x374345='WhatsappQueues';return db[_0xa00f('0x28')][_0xa00f('0x29')]({'where':{'type':_0x374345,'resourceId':_0x3054a5['id']}})['then'](function(){return _0x2fe1bf;});})[_0xa00f('0x27')](function(){_0x161b75[_0xa00f('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x117e4f,_0x2f963b){return function(_0x333df8){if(!_0x333df8){_0x117e4f[_0xa00f('0x1c')](0x194);}return _0x333df8;};}function handleError(_0x2b23c4,_0x444e59){_0x444e59=_0x444e59||0x1f4;return function(_0x5da4e4){logger[_0xa00f('0x2a')](_0x5da4e4[_0xa00f('0x2b')]);if(_0x5da4e4[_0xa00f('0x2c')]){delete _0x5da4e4[_0xa00f('0x2c')];}_0x2b23c4[_0xa00f('0x21')](_0x444e59)['send'](_0x5da4e4);};}exports[_0xa00f('0x2d')]=function(_0x39fde5,_0x4e85c0){var _0x161a48={},_0x2e845e={},_0x419970={'count':0x0,'rows':[]};var _0x53310f=_[_0xa00f('0x2e')](db[_0xa00f('0x2f')]['rawAttributes'],function(_0x42e100){return{'name':_0x42e100[_0xa00f('0x30')],'type':_0x42e100['type'][_0xa00f('0x31')]};});_0x2e845e[_0xa00f('0x32')]=_[_0xa00f('0x2e')](_0x53310f,_0xa00f('0x2c'));_0x2e845e[_0xa00f('0x33')]=_['keys'](_0x39fde5['query']);_0x2e845e[_0xa00f('0x34')]=_[_0xa00f('0x35')](_0x2e845e[_0xa00f('0x32')],_0x2e845e[_0xa00f('0x33')]);_0x161a48[_0xa00f('0x36')]=_['intersection'](_0x2e845e['model'],qs[_0xa00f('0x37')](_0x39fde5['query'][_0xa00f('0x37')]));_0x161a48['attributes']=_0x161a48[_0xa00f('0x36')][_0xa00f('0x38')]?_0x161a48[_0xa00f('0x36')]:_0x2e845e[_0xa00f('0x32')];if(!_0x39fde5[_0xa00f('0x33')]['hasOwnProperty'](_0xa00f('0x39'))){_0x161a48[_0xa00f('0x20')]=qs[_0xa00f('0x20')](_0x39fde5[_0xa00f('0x33')]['limit']);_0x161a48['offset']=qs[_0xa00f('0x1f')](_0x39fde5['query'][_0xa00f('0x1f')]);}_0x161a48[_0xa00f('0x3a')]=qs[_0xa00f('0x3b')](_0x39fde5['query'][_0xa00f('0x3b')]);_0x161a48[_0xa00f('0x3c')]=qs['filters'](_[_0xa00f('0x3d')](_0x39fde5[_0xa00f('0x33')],_0x2e845e[_0xa00f('0x34')]),_0x53310f);if(_0x39fde5[_0xa00f('0x33')][_0xa00f('0x3e')]){_0x161a48['where']=_[_0xa00f('0x3f')](_0x161a48[_0xa00f('0x3c')],{'$or':_['map'](_0x53310f,function(_0x5dcd76){if(_0x5dcd76[_0xa00f('0x40')]!==_0xa00f('0x41')){var _0x4f932e={};_0x4f932e[_0x5dcd76[_0xa00f('0x2c')]]={'$like':'%'+_0x39fde5['query'][_0xa00f('0x3e')]+'%'};return _0x4f932e;}})});}_0x161a48=_[_0xa00f('0x3f')]({},_0x161a48,_0x39fde5[_0xa00f('0x42')]);var _0x1815e4={'where':_0x161a48[_0xa00f('0x3c')]};return db['WhatsappQueue']['count'](_0x1815e4)[_0xa00f('0x27')](function(_0x5b95cc){_0x419970['count']=_0x5b95cc;if(_0x39fde5['query']['includeAll']){_0x161a48[_0xa00f('0x43')]=[{'all':!![]}];}return db[_0xa00f('0x2f')][_0xa00f('0x44')](_0x161a48);})[_0xa00f('0x27')](function(_0xd20859){_0x419970['rows']=_0xd20859;return _0x419970;})[_0xa00f('0x27')](respondWithFilteredResult(_0x4e85c0,_0x161a48))['catch'](handleError(_0x4e85c0,null));};exports[_0xa00f('0x45')]=function(_0x15c382,_0x4c753d){var _0x142e5d={'raw':!![],'where':{'id':_0x15c382['params']['id']}},_0x11fa49={};_0x11fa49['model']=_[_0xa00f('0x46')](db[_0xa00f('0x2f')]['rawAttributes']);_0x11fa49[_0xa00f('0x33')]=_[_0xa00f('0x46')](_0x15c382['query']);_0x11fa49[_0xa00f('0x34')]=_[_0xa00f('0x35')](_0x11fa49[_0xa00f('0x32')],_0x11fa49[_0xa00f('0x33')]);_0x142e5d[_0xa00f('0x36')]=_[_0xa00f('0x35')](_0x11fa49[_0xa00f('0x32')],qs['fields'](_0x15c382[_0xa00f('0x33')][_0xa00f('0x37')]));_0x142e5d[_0xa00f('0x36')]=_0x142e5d['attributes'][_0xa00f('0x38')]?_0x142e5d[_0xa00f('0x36')]:_0x11fa49['model'];if(_0x15c382[_0xa00f('0x33')][_0xa00f('0x47')]){_0x142e5d[_0xa00f('0x43')]=[{'all':!![]}];}_0x142e5d=_[_0xa00f('0x3f')]({},_0x142e5d,_0x15c382[_0xa00f('0x42')]);return db['WhatsappQueue'][_0xa00f('0x48')](_0x142e5d)[_0xa00f('0x27')](handleEntityNotFound(_0x4c753d,null))['then'](respondWithResult(_0x4c753d,null))[_0xa00f('0x49')](handleError(_0x4c753d,null));};exports[_0xa00f('0x4a')]=function(_0x2e3628,_0x3e8b03){return db['WhatsappQueue'][_0xa00f('0x4a')](_0x2e3628[_0xa00f('0x4b')],{})[_0xa00f('0x27')](function(_0x377f26){var _0x31d974=_0x2e3628[_0xa00f('0x4c')][_0xa00f('0x4d')]({'plain':!![]});if(!_0x31d974)throw new Error(_0xa00f('0x4e'));if(_0x31d974[_0xa00f('0x4f')]===_0xa00f('0x4c')){var _0x475199=_0x377f26[_0xa00f('0x4d')]({'plain':!![]});var _0x8bd4b8=_0xa00f('0x50');return db[_0xa00f('0x51')][_0xa00f('0x48')]({'where':{'name':_0x8bd4b8,'userProfileId':_0x31d974[_0xa00f('0x52')]},'raw':!![]})[_0xa00f('0x27')](function(_0x4760eb){if(_0x4760eb&&_0x4760eb[_0xa00f('0x53')]===0x0){return db[_0xa00f('0x28')]['create']({'name':_0x475199[_0xa00f('0x2c')],'resourceId':_0x475199['id'],'type':_0x4760eb[_0xa00f('0x2c')],'sectionId':_0x4760eb['id']},{})[_0xa00f('0x27')](function(){return _0x377f26;});}else{return _0x377f26;}})['catch'](function(_0x413ab3){logger[_0xa00f('0x2a')](_0xa00f('0x54'),_0x413ab3);throw _0x413ab3;});}return _0x377f26;})[_0xa00f('0x27')](respondWithResult(_0x3e8b03,0xc9))[_0xa00f('0x49')](handleError(_0x3e8b03,null));};exports[_0xa00f('0x26')]=function(_0x1ea758,_0xe94829){if(_0x1ea758[_0xa00f('0x4b')]['id']){delete _0x1ea758[_0xa00f('0x4b')]['id'];}return db[_0xa00f('0x2f')][_0xa00f('0x48')]({'where':{'id':_0x1ea758[_0xa00f('0x55')]['id']}})[_0xa00f('0x27')](handleEntityNotFound(_0xe94829,null))[_0xa00f('0x27')](saveUpdates(_0x1ea758[_0xa00f('0x4b')],null))['then'](respondWithResult(_0xe94829,null))[_0xa00f('0x49')](handleError(_0xe94829,null));};exports[_0xa00f('0x29')]=function(_0x4ef908,_0x3500c7){return db['WhatsappQueue']['find']({'where':{'id':_0x4ef908[_0xa00f('0x55')]['id']}})[_0xa00f('0x27')](handleEntityNotFound(_0x3500c7,null))[_0xa00f('0x27')](removeEntity(_0x3500c7,null))[_0xa00f('0x49')](handleError(_0x3500c7,null));};exports[_0xa00f('0x56')]=function(_0xd70368,_0x63034d){return db['WhatsappQueue'][_0xa00f('0x56')]()[_0xa00f('0x27')](respondWithResult(_0x63034d,null))[_0xa00f('0x49')](handleError(_0x63034d,null));};exports['getMembers']=function(_0x1d0b7e,_0x4f2da0,_0x2b0908){var _0x1aee56={'raw':!![],'where':{}},_0x484785={},_0x5f2d42;return db[_0xa00f('0x2f')][_0xa00f('0x57')]({'where':{'id':_0x1d0b7e[_0xa00f('0x55')]['id']}})[_0xa00f('0x27')](handleEntityNotFound(_0x4f2da0,null))[_0xa00f('0x27')](function(_0x86e062){if(_0x86e062){_0x5f2d42=_0x86e062[_0xa00f('0x4d')]({'plain':!![]});_0x484785[_0xa00f('0x32')]=_[_0xa00f('0x46')](db[_0xa00f('0x58')][_0xa00f('0x59')]);_0x484785['query']=_[_0xa00f('0x46')](_0x1d0b7e[_0xa00f('0x33')]);_0x484785[_0xa00f('0x34')]=_[_0xa00f('0x35')](_0x484785[_0xa00f('0x32')],_0x484785[_0xa00f('0x33')]);_0x1aee56[_0xa00f('0x36')]=_['intersection'](_0x484785['model'],qs['fields'](_0x1d0b7e[_0xa00f('0x33')][_0xa00f('0x37')]));_0x1aee56[_0xa00f('0x36')]=_0x1aee56['attributes'][_0xa00f('0x38')]?_0x1aee56[_0xa00f('0x36')]:_0x484785[_0xa00f('0x32')];if(!_0x1d0b7e[_0xa00f('0x33')][_0xa00f('0x5a')]('nolimit')){_0x1aee56[_0xa00f('0x20')]=qs[_0xa00f('0x20')](_0x1d0b7e['query']['limit']);_0x1aee56['offset']=qs[_0xa00f('0x1f')](_0x1d0b7e['query'][_0xa00f('0x1f')]);}_0x1aee56['order']=qs[_0xa00f('0x3b')](_0x1d0b7e[_0xa00f('0x33')][_0xa00f('0x3b')]);_0x1aee56['where']=qs[_0xa00f('0x34')](_[_0xa00f('0x3d')](_0x1d0b7e[_0xa00f('0x33')],_0x484785[_0xa00f('0x34')]));_0x1aee56[_0xa00f('0x3c')][_0xa00f('0x5b')]=_0x86e062['id'];if(_0x1d0b7e[_0xa00f('0x33')]['filter']){_0x1aee56['where']=_['merge'](_0x1aee56[_0xa00f('0x3c')],{'$or':_[_0xa00f('0x2e')](_0x1aee56[_0xa00f('0x36')],function(_0x2a6afd){var _0x565cff={};_0x565cff[_0x2a6afd]={'$like':'%'+_0x1d0b7e[_0xa00f('0x33')]['filter']+'%'};return _0x565cff;})});}_0x1aee56=_[_0xa00f('0x3f')]({},_0x1aee56,_0x1d0b7e[_0xa00f('0x42')]);return db[_0xa00f('0x58')]['findAll'](_0x1aee56);}})[_0xa00f('0x27')](function(_0x21d289){if(_0x21d289){return db['User']['findAndCountAll']({'where':{'id':_[_0xa00f('0x2e')](_0x21d289,_0xa00f('0x5c')),'role':_0xa00f('0x5d')},'attributes':['id',_0xa00f('0x2c'),'whatsappPause','updatedAt',_0xa00f('0x5e')]});}})[_0xa00f('0x27')](function(_0xed80){if(_0xed80){return{'count':_0xed80['count'],'rows':_[_0xa00f('0x2e')](_0xed80[_0xa00f('0x5f')],function(_0x3f3199){return{'membername':_0x3f3199[_0xa00f('0x2c')],'UserId':_0x3f3199['id'],'queue_name':_0x5f2d42[_0xa00f('0x2c')],'WhatsappQueueId':_0x5f2d42['id'],'interface':util[_0xa00f('0x60')](_0xa00f('0x61'),'SIP',_0x3f3199[_0xa00f('0x2c')]),'penalty':0x0,'paused':_0x3f3199[_0xa00f('0x62')],'createdAt':_0x3f3199['createdAt'],'updatedAt':_0x3f3199[_0xa00f('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa00f('0x27')](respondWithFilteredResult(_0x4f2da0,_0x1aee56))['catch'](handleError(_0x4f2da0,null));};exports[_0xa00f('0x64')]=function(_0x3a4901,_0x182038,_0x7b084d){var _0x6364c5={};var _0x518cda={};var _0x287ee9;var _0x3cbb15;return db['WhatsappQueue']['findOne']({'where':{'id':_0x3a4901[_0xa00f('0x55')]['id']}})[_0xa00f('0x27')](handleEntityNotFound(_0x182038,null))['then'](function(_0x41a8e6){if(_0x41a8e6){_0x287ee9=_0x41a8e6;_0x518cda[_0xa00f('0x32')]=_['keys'](db[_0xa00f('0x65')][_0xa00f('0x59')]);_0x518cda[_0xa00f('0x33')]=_['keys'](_0x3a4901[_0xa00f('0x33')]);_0x518cda[_0xa00f('0x34')]=_[_0xa00f('0x35')](_0x518cda['model'],_0x518cda[_0xa00f('0x33')]);_0x6364c5[_0xa00f('0x36')]=_['intersection'](_0x518cda[_0xa00f('0x32')],qs[_0xa00f('0x37')](_0x3a4901[_0xa00f('0x33')][_0xa00f('0x37')]));_0x6364c5[_0xa00f('0x36')]=_0x6364c5['attributes'][_0xa00f('0x38')]?_0x6364c5[_0xa00f('0x36')]:_0x518cda[_0xa00f('0x32')];_0x6364c5[_0xa00f('0x3a')]=qs[_0xa00f('0x3b')](_0x3a4901[_0xa00f('0x33')][_0xa00f('0x3b')]);_0x6364c5['where']=qs['filters'](_[_0xa00f('0x3d')](_0x3a4901[_0xa00f('0x33')],_0x518cda['filters']));if(_0x3a4901[_0xa00f('0x33')][_0xa00f('0x3e')]){_0x6364c5[_0xa00f('0x3c')]=_[_0xa00f('0x3f')](_0x6364c5['where'],{'$or':_[_0xa00f('0x2e')](_0x6364c5['attributes'],function(_0x2ff7a0){var _0x43bd9b={};_0x43bd9b[_0x2ff7a0]={'$like':'%'+_0x3a4901[_0xa00f('0x33')][_0xa00f('0x3e')]+'%'};return _0x43bd9b;})});}_0x6364c5=_[_0xa00f('0x3f')]({},_0x6364c5,_0x3a4901[_0xa00f('0x42')]);return _0x287ee9[_0xa00f('0x64')](_0x6364c5);}})['then'](function(_0x5965e1){if(_0x5965e1){_0x3cbb15=_0x5965e1['length'];if(!_0x3a4901[_0xa00f('0x33')][_0xa00f('0x5a')](_0xa00f('0x39'))){_0x6364c5['limit']=qs[_0xa00f('0x20')](_0x3a4901[_0xa00f('0x33')][_0xa00f('0x20')]);_0x6364c5[_0xa00f('0x1f')]=qs['offset'](_0x3a4901[_0xa00f('0x33')][_0xa00f('0x1f')]);}return _0x287ee9[_0xa00f('0x64')](_0x6364c5);}})[_0xa00f('0x27')](function(_0x47a75d){if(_0x47a75d){return _0x47a75d?{'count':_0x3cbb15,'rows':_0x47a75d}:null;}})[_0xa00f('0x27')](respondWithResult(_0x182038,null))[_0xa00f('0x49')](handleError(_0x182038,null));};exports[_0xa00f('0x66')]=function(_0x174c9f,_0x59d21c,_0x57ee5a){var _0x5d8a01=_0x174c9f[_0xa00f('0x4b')]['ids'];return db[_0xa00f('0x65')][_0xa00f('0x44')]({'where':{'id':_0x5d8a01},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa00f('0x67'),'attributes':['id',_0xa00f('0x2c'),_0xa00f('0x68'),'voicePause',_0xa00f('0x69')],'raw':!![]}]})[_0xa00f('0x27')](function(_0x11c2c8){if(_0x11c2c8){var _0x23d02c=_[_0xa00f('0x6a')](_0x11c2c8,function(_0x117665){var _0xe69888=_0x117665[_0xa00f('0x4d')]({'plain':!![]});return _0xe69888[_0xa00f('0x67')];});return db[_0xa00f('0x2f')][_0xa00f('0x48')]({'where':{'id':_0x174c9f[_0xa00f('0x55')]['id']}})[_0xa00f('0x27')](function(_0x599b69){return db[_0xa00f('0x6b')][_0xa00f('0x6c')](function(_0x536a33){return _0x599b69[_0xa00f('0x66')](_0x5d8a01,{'transaction':_0x536a33})[_0xa00f('0x27')](function(){return BPromise['each'](_0x23d02c,function(_0x4d4e9b){return db[_0xa00f('0x58')]['findOrCreate']({'where':{'UserId':_0x4d4e9b['id'],'WhatsappQueueId':_0x174c9f[_0xa00f('0x55')]['id']},'transaction':_0x536a33});});})[_0xa00f('0x27')](function(){_0x23d02c[_0xa00f('0x6d')](function(_0xf23fcd){socket[_0xa00f('0x6e')](_0xa00f('0x6f'),{'UserId':_0xf23fcd['id'],'WhatsappQueueId':_0x599b69['id']});});});});});}})[_0xa00f('0x27')](respondWithStatusCode(_0x59d21c,null))['catch'](handleError(_0x59d21c,null));};exports[_0xa00f('0x70')]=function(_0xd1b4e7,_0x9fcceb,_0x38b3ba){return db['Team'][_0xa00f('0x44')]({'where':{'id':_0xd1b4e7[_0xa00f('0x33')]['ids']},'attributes':['id'],'include':[{'model':db[_0xa00f('0x71')],'as':_0xa00f('0x67'),'attributes':['id'],'raw':!![]}]})[_0xa00f('0x27')](handleEntityNotFound(_0x9fcceb,null))[_0xa00f('0x27')](function(_0x1cecdd){var _0x2e415d=_['map'](_0x1cecdd,'id');var _0x1981c4=[];var _0x11a1f2=[];var _0x4f76d6=squel[_0xa00f('0x72')]();_0x4f76d6[_0xa00f('0x73')]('tq.TeamId')[_0xa00f('0x74')](_0xa00f('0x75'),'tq')['join'](_0xa00f('0x76'),'ut',_0xa00f('0x77'))['where']('WhatsappQueueId\x20=\x20?',_0xd1b4e7[_0xa00f('0x55')]['id']);for(var _0x20bfbe=0x0;_0x20bfbe<_0x1cecdd[_0xa00f('0x38')];_0x20bfbe+=0x1){let _0x16c25b=_0x1cecdd[_0x20bfbe];for(var _0x1a3a9c=0x0;_0x1a3a9c<_0x16c25b['Agents'][_0xa00f('0x38')];_0x1a3a9c+=0x1){let _0x81f64e=_0x16c25b[_0xa00f('0x67')][_0x1a3a9c];var _0x1f8689=_0x4f76d6[_0xa00f('0x78')]();_0x1f8689[_0xa00f('0x3c')](_0xa00f('0x79'),_0x81f64e['id']);_0x11a1f2[_0xa00f('0x7a')](db['sequelize'][_0xa00f('0x33')](_0x1f8689[_0xa00f('0x7b')](),{'type':db[_0xa00f('0x6b')]['QueryTypes'][_0xa00f('0x7c')]})[_0xa00f('0x27')](function(_0x2b8212){if(_0x2b8212[_0xa00f('0x38')]===0x1){return _0x81f64e['id'];}else{var _0xb5b1bd=_[_0xa00f('0x7d')](_[_0xa00f('0x2e')](_0x2b8212,'TeamId'),function(_0x5274cd){return _[_0xa00f('0x7e')](_0x2e415d,_0x5274cd);});if(_0xb5b1bd){return _0x81f64e['id'];}}}));}}return BPromise['all'](_0x11a1f2)['then'](function(_0x305549){_0x1981c4=_(_0x1981c4)[_0xa00f('0x7f')](_0x305549)[_0xa00f('0x80')]()[_0xa00f('0x81')]();return db[_0xa00f('0x2f')]['find']({'where':{'id':_0xd1b4e7['params']['id']}})[_0xa00f('0x27')](function(_0x2ade81){return db['sequelize'][_0xa00f('0x6c')](function(_0x76aa){return _0x2ade81[_0xa00f('0x70')](_0xd1b4e7[_0xa00f('0x33')][_0xa00f('0x82')],{'transaction':_0x76aa})['then'](function(){if(!_[_0xa00f('0x83')](_0x1981c4)){return _0x2ade81[_0xa00f('0x84')](_0x1981c4,{'transaction':_0x76aa});}})[_0xa00f('0x27')](function(){_0x1981c4[_0xa00f('0x6d')](function(_0x668f94){socket[_0xa00f('0x6e')](_0xa00f('0x85'),{'UserId':_0x668f94,'WhatsappQueueId':_0x2ade81['id']});});});});});});})[_0xa00f('0x27')](respondWithStatusCode(_0x9fcceb,null))[_0xa00f('0x49')](handleError(_0x9fcceb,null));};exports[_0xa00f('0x86')]=function(_0x59e6a3,_0x3edc69,_0x4fea77){return db[_0xa00f('0x2f')][_0xa00f('0x48')]({'where':{'id':_0x59e6a3[_0xa00f('0x55')]['id']}})[_0xa00f('0x27')](handleEntityNotFound(_0x3edc69,null))[_0xa00f('0x27')](function(_0x22350b){if(_0x22350b){return _0x22350b['addAgents'](_0x59e6a3['body']['ids'],_[_0xa00f('0x87')](_0x59e6a3['body'],[_0xa00f('0x82'),'id'])||{})[_0xa00f('0x88')](function(_0x1a89d5){for(var _0x263714=0x0;_0x263714<_0x59e6a3[_0xa00f('0x4b')][_0xa00f('0x82')][_0xa00f('0x38')];_0x263714+=0x1){socket[_0xa00f('0x6e')](_0xa00f('0x6f'),{'UserId':_0x59e6a3['body'][_0xa00f('0x82')][_0x263714],'WhatsappQueueId':_0x59e6a3[_0xa00f('0x55')]['id']});}return _0x1a89d5;});}})[_0xa00f('0x27')](respondWithResult(_0x3edc69,null))[_0xa00f('0x49')](handleError(_0x3edc69,null));};exports[_0xa00f('0x84')]=function(_0x2411af,_0x174bf5,_0x1f13fb){return db[_0xa00f('0x2f')]['find']({'where':{'id':_0x2411af['params']['id']}})[_0xa00f('0x27')](handleEntityNotFound(_0x174bf5,null))[_0xa00f('0x27')](function(_0x5a61a6){if(_0x5a61a6){return _0x5a61a6[_0xa00f('0x84')](_0x2411af[_0xa00f('0x33')]['ids'])[_0xa00f('0x27')](function(){if(_[_0xa00f('0x89')](_0x2411af[_0xa00f('0x33')][_0xa00f('0x82')])){for(var _0x426c51=0x0;_0x426c51<_0x2411af[_0xa00f('0x33')][_0xa00f('0x82')][_0xa00f('0x38')];_0x426c51+=0x1){socket['emit'](_0xa00f('0x85'),{'UserId':Number(_0x2411af['query'][_0xa00f('0x82')][_0x426c51]),'WhatsappQueueId':Number(_0x2411af[_0xa00f('0x55')]['id'])});}}else{socket['emit'](_0xa00f('0x85'),{'UserId':Number(_0x2411af['query'][_0xa00f('0x82')]),'WhatsappQueueId':Number(_0x2411af[_0xa00f('0x55')]['id'])});}});}})[_0xa00f('0x27')](respondWithStatusCode(_0x174bf5,null))['catch'](handleError(_0x174bf5,null));};exports[_0xa00f('0x8a')]=function(_0x2deae8,_0x237c06,_0x436321){var _0xef6c7f={};var _0x493e78={};var _0x3060ab;var _0x1a0c7e;return db[_0xa00f('0x2f')][_0xa00f('0x57')]({'where':{'id':_0x2deae8['params']['id']}})['then'](handleEntityNotFound(_0x237c06,null))[_0xa00f('0x27')](function(_0x1fa715){if(_0x1fa715){_0x3060ab=_0x1fa715;_0x493e78[_0xa00f('0x32')]=_[_0xa00f('0x46')](db[_0xa00f('0x71')][_0xa00f('0x59')]);_0x493e78[_0xa00f('0x33')]=_['keys'](_0x2deae8['query']);_0x493e78[_0xa00f('0x34')]=_[_0xa00f('0x35')](_0x493e78['model'],_0x493e78[_0xa00f('0x33')]);_0xef6c7f[_0xa00f('0x36')]=_[_0xa00f('0x35')](_0x493e78[_0xa00f('0x32')],qs[_0xa00f('0x37')](_0x2deae8[_0xa00f('0x33')][_0xa00f('0x37')]));_0xef6c7f[_0xa00f('0x36')]=_0xef6c7f[_0xa00f('0x36')]['length']?_0xef6c7f['attributes']:_0x493e78['model'];_0xef6c7f['order']=qs['sort'](_0x2deae8[_0xa00f('0x33')][_0xa00f('0x3b')]);_0xef6c7f['where']=qs[_0xa00f('0x34')](_[_0xa00f('0x3d')](_0x2deae8['query'],_0x493e78[_0xa00f('0x34')]));if(_0x2deae8['query'][_0xa00f('0x3e')]){_0xef6c7f[_0xa00f('0x3c')]=_[_0xa00f('0x3f')](_0xef6c7f[_0xa00f('0x3c')],{'$or':_[_0xa00f('0x2e')](_0xef6c7f['attributes'],function(_0x171e5d){var _0x250a9b={};_0x250a9b[_0x171e5d]={'$like':'%'+_0x2deae8[_0xa00f('0x33')][_0xa00f('0x3e')]+'%'};return _0x250a9b;})});}_0xef6c7f=_['merge']({},_0xef6c7f,_0x2deae8[_0xa00f('0x42')]);return _0x3060ab['getAgents'](_0xef6c7f);}})[_0xa00f('0x27')](function(_0xfe6096){if(_0xfe6096){_0x1a0c7e=_0xfe6096[_0xa00f('0x38')];if(!_0x2deae8[_0xa00f('0x33')]['hasOwnProperty'](_0xa00f('0x39'))){_0xef6c7f[_0xa00f('0x20')]=qs['limit'](_0x2deae8[_0xa00f('0x33')]['limit']);_0xef6c7f[_0xa00f('0x1f')]=qs[_0xa00f('0x1f')](_0x2deae8[_0xa00f('0x33')][_0xa00f('0x1f')]);}return _0x3060ab[_0xa00f('0x8a')](_0xef6c7f);}})[_0xa00f('0x27')](function(_0xa9b432){if(_0xa9b432){return _0xa9b432?{'count':_0x1a0c7e,'rows':_0xa9b432}:null;}})[_0xa00f('0x27')](respondWithResult(_0x237c06,null))[_0xa00f('0x49')](handleError(_0x237c06,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 1a0df99..3711d58 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 _0x7d40=['remove','emit','hasOwnProperty','exports','events','save','update'];(function(_0x29e301,_0x1db0d9){var _0x47cbee=function(_0x34e632){while(--_0x34e632){_0x29e301['push'](_0x29e301['shift']());}};_0x47cbee(++_0x1db0d9);}(_0x7d40,0xac));var _0x07d4=function(_0x535ad6,_0x22b56c){_0x535ad6=_0x535ad6-0x0;var _0x12d4f6=_0x7d40[_0x535ad6];return _0x12d4f6;};'use strict';var EventEmitter=require(_0x07d4('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x07d4('0x1'),'afterUpdate':_0x07d4('0x2'),'afterDestroy':_0x07d4('0x3')};function emitEvent(_0x48b794){return function(_0x205ee,_0x4cca46,_0x5d83e0){WhatsappQueueEvents[_0x07d4('0x4')](_0x48b794+':'+_0x205ee['id'],_0x205ee);WhatsappQueueEvents[_0x07d4('0x4')](_0x48b794,_0x205ee);_0x5d83e0(null);};}for(var e in events){if(events[_0x07d4('0x5')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x07d4('0x6')]=WhatsappQueueEvents; \ No newline at end of file +var _0x010c=['hasOwnProperty','hook','exports','../../mysqldb','WhatsappQueue','setMaxListeners','update','emit'];(function(_0x101f8,_0x5a304c){var _0x2da09e=function(_0xa0a52b){while(--_0xa0a52b){_0x101f8['push'](_0x101f8['shift']());}};_0x2da09e(++_0x5a304c);}(_0x010c,0xcb));var _0xc010=function(_0x113b3a,_0x4f1697){_0x113b3a=_0x113b3a-0x0;var _0x3a1a5a=_0x010c[_0x113b3a];return _0x3a1a5a;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xc010('0x0'))['db'][_0xc010('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xc010('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc010('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2aa775){return function(_0x42349d,_0xa4b8a2,_0x5df040){WhatsappQueueEvents[_0xc010('0x4')](_0x2aa775+':'+_0x42349d['id'],_0x42349d);WhatsappQueueEvents[_0xc010('0x4')](_0x2aa775,_0x42349d);_0x5df040(null);};}for(var e in events){if(events[_0xc010('0x5')](e)){var event=events[e];WhatsappQueue[_0xc010('0x6')](e,emitEvent(event));}}module[_0xc010('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 c8b8ec5..2acc640 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 _0x27ca=['moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','util','../../config/logger'];(function(_0x278084,_0x3e4b1c){var _0x28c051=function(_0x2d7479){while(--_0x2d7479){_0x278084['push'](_0x278084['shift']());}};_0x28c051(++_0x3e4b1c);}(_0x27ca,0x1b6));var _0xa27c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x27ca[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0xa27c('0x0'));var logger=require(_0xa27c('0x1'))('api');var moment=require(_0xa27c('0x2'));var BPromise=require(_0xa27c('0x3'));var rp=require(_0xa27c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa27c('0x5'));var config=require(_0xa27c('0x6'));var attributes=require(_0xa27c('0x7'));module['exports']=function(_0x54c180,_0x3ff8f5){return _0x54c180[_0xa27c('0x8')](_0xa27c('0x9'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5128=['path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','whatsapp_queues','util','../../config/logger','api','moment','request-promise'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x5128,0x1c9));var _0x8512=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x5128[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var util=require(_0x8512('0x0'));var logger=require(_0x8512('0x1'))(_0x8512('0x2'));var moment=require(_0x8512('0x3'));var BPromise=require('bluebird');var rp=require(_0x8512('0x4'));var fs=require('fs');var path=require(_0x8512('0x5'));var rimraf=require(_0x8512('0x6'));var config=require(_0x8512('0x7'));var attributes=require(_0x8512('0x8'));module[_0x8512('0x9')]=function(_0x30607e,_0x5e1f31){return _0x30607e['define']('WhatsappQueue',attributes,{'tableName':_0x8512('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index cfbbb79..2d3b231 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 _0x4784=['raw','where','attributes','limit','include','map','model','GetWhatsappQueue','catch','ShowWhatsappQueue','find','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','WhatsappQueue','options'];(function(_0x33c5db,_0x29fc18){var _0x3ddfb5=function(_0x4c4fee){while(--_0x4c4fee){_0x33c5db['push'](_0x33c5db['shift']());}};_0x3ddfb5(++_0x29fc18);}(_0x4784,0x14f));var _0x4478=function(_0x3132ff,_0xa92e80){_0x3132ff=_0x3132ff-0x0;var _0x300a49=_0x4784[_0x3132ff];return _0x300a49;};'use strict';var _=require(_0x4478('0x0'));var util=require(_0x4478('0x1'));var moment=require(_0x4478('0x2'));var BPromise=require('bluebird');var rs=require(_0x4478('0x3'));var fs=require('fs');var Redis=require(_0x4478('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4478('0x5'))(_0x4478('0x6'));var config=require(_0x4478('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4478('0x8')]({'port':0x232a});config[_0x4478('0x9')]=_['defaults'](config[_0x4478('0x9')],{'host':_0x4478('0xa'),'port':0x18eb});var socket=require(_0x4478('0xb'))(new Redis(config[_0x4478('0x9')]));require(_0x4478('0xc'))['register'](socket);function respondWithRpcPromise(_0x163613,_0x35a50f,_0x8a9d3c){return new BPromise(function(_0x5416a1,_0x3b9041){return client[_0x4478('0xd')](_0x163613,_0x8a9d3c)[_0x4478('0xe')](function(_0x47ae92){logger[_0x4478('0xf')](_0x4478('0x10'),_0x35a50f,'request\x20sent');logger[_0x4478('0x11')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x35a50f,_0x4478('0x12'),JSON[_0x4478('0x13')](_0x47ae92));if(_0x47ae92[_0x4478('0x14')]){if(_0x47ae92[_0x4478('0x14')][_0x4478('0x15')]===0x1f4){logger[_0x4478('0x14')](_0x4478('0x10'),_0x35a50f,_0x47ae92['error'][_0x4478('0x16')]);return _0x3b9041(_0x47ae92[_0x4478('0x14')][_0x4478('0x16')]);}logger['error'](_0x4478('0x10'),_0x35a50f,_0x47ae92['error'][_0x4478('0x16')]);return _0x5416a1(_0x47ae92['error'][_0x4478('0x16')]);}else{logger[_0x4478('0xf')](_0x4478('0x10'),_0x35a50f,_0x4478('0x12'));_0x5416a1(_0x47ae92['result']['message']);}})['catch'](function(_0x3e105d){logger[_0x4478('0x14')](_0x4478('0x10'),_0x35a50f,_0x3e105d);_0x3b9041(_0x3e105d);});});}exports['GetWhatsappQueue']=function(_0x1b2bd3){var _0x187c2c=this;return new Promise(function(_0x27e014,_0x589ddd){return db[_0x4478('0x17')]['findAll']({'raw':_0x1b2bd3['options']?_0x1b2bd3[_0x4478('0x18')][_0x4478('0x19')]===undefined?!![]:![]:!![],'where':_0x1b2bd3['options']?_0x1b2bd3['options'][_0x4478('0x1a')]||null:null,'attributes':_0x1b2bd3[_0x4478('0x18')]?_0x1b2bd3[_0x4478('0x18')][_0x4478('0x1b')]||null:null,'limit':_0x1b2bd3[_0x4478('0x18')]?_0x1b2bd3['options'][_0x4478('0x1c')]||null:null,'include':_0x1b2bd3[_0x4478('0x18')]?_0x1b2bd3[_0x4478('0x18')][_0x4478('0x1d')]?_[_0x4478('0x1e')](_0x1b2bd3[_0x4478('0x18')][_0x4478('0x1d')],function(_0x4840f0){return{'model':db[_0x4840f0[_0x4478('0x1f')]],'as':_0x4840f0['as'],'attributes':_0x4840f0[_0x4478('0x1b')],'include':_0x4840f0[_0x4478('0x1d')]?_[_0x4478('0x1e')](_0x4840f0['include'],function(_0xce0ccd){return{'model':db[_0xce0ccd[_0x4478('0x1f')]],'as':_0xce0ccd['as'],'attributes':_0xce0ccd['attributes'],'include':_0xce0ccd[_0x4478('0x1d')]?_[_0x4478('0x1e')](_0xce0ccd['include'],function(_0x4b3291){return{'model':db[_0x4b3291['model']],'as':_0x4b3291['as'],'attributes':_0x4b3291[_0x4478('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27f227){logger[_0x4478('0xf')](_0x4478('0x20'),_0x1b2bd3);logger['debug'](_0x4478('0x20'),_0x1b2bd3,JSON[_0x4478('0x13')](_0x27f227));_0x27e014(_0x27f227);})[_0x4478('0x21')](function(_0x162523){logger[_0x4478('0x14')](_0x4478('0x20'),_0x162523[_0x4478('0x16')],_0x1b2bd3);_0x589ddd(_0x187c2c[_0x4478('0x14')](0x1f4,_0x162523[_0x4478('0x16')]));});});};exports[_0x4478('0x22')]=function(_0x362cf7){var _0x355e0e=this;return new Promise(function(_0x2ce7bd,_0x34b8ab){return db[_0x4478('0x17')][_0x4478('0x23')]({'raw':_0x362cf7[_0x4478('0x18')]?_0x362cf7[_0x4478('0x18')][_0x4478('0x19')]===undefined?!![]:![]:!![],'where':_0x362cf7['options']?_0x362cf7[_0x4478('0x18')]['where']||null:null,'attributes':_0x362cf7[_0x4478('0x18')]?_0x362cf7[_0x4478('0x18')][_0x4478('0x1b')]||null:null,'include':_0x362cf7[_0x4478('0x18')]?_0x362cf7[_0x4478('0x18')][_0x4478('0x1d')]?_[_0x4478('0x1e')](_0x362cf7['options']['include'],function(_0x13aac1){return{'model':db[_0x13aac1[_0x4478('0x1f')]],'as':_0x13aac1['as'],'attributes':_0x13aac1[_0x4478('0x1b')],'include':_0x13aac1[_0x4478('0x1d')]?_['map'](_0x13aac1['include'],function(_0x1b6bf7){return{'model':db[_0x1b6bf7[_0x4478('0x1f')]],'as':_0x1b6bf7['as'],'attributes':_0x1b6bf7[_0x4478('0x1b')],'include':_0x1b6bf7['include']?_[_0x4478('0x1e')](_0x1b6bf7[_0x4478('0x1d')],function(_0x543a15){return{'model':db[_0x543a15[_0x4478('0x1f')]],'as':_0x543a15['as'],'attributes':_0x543a15[_0x4478('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4478('0xe')](function(_0x265b2f){logger[_0x4478('0xf')](_0x4478('0x22'),_0x362cf7);logger[_0x4478('0x11')](_0x4478('0x22'),_0x362cf7,JSON[_0x4478('0x13')](_0x265b2f));_0x2ce7bd(_0x265b2f);})[_0x4478('0x21')](function(_0x47da77){logger[_0x4478('0x14')](_0x4478('0x22'),_0x47da77[_0x4478('0x16')],_0x362cf7);_0x34b8ab(_0x355e0e[_0x4478('0x14')](0x1f4,_0x47da77[_0x4478('0x16')]));});});}; \ No newline at end of file +var _0x0ef3=['http','redis','defaults','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetWhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','catch','ShowWhatsappQueue','WhatsappQueue','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x3ef874,_0x37b465){var _0x395cbc=function(_0x23a9ae){while(--_0x23a9ae){_0x3ef874['push'](_0x3ef874['shift']());}};_0x395cbc(++_0x37b465);}(_0x0ef3,0x1b9));var _0x30ef=function(_0x146484,_0x27a7f0){_0x146484=_0x146484-0x0;var _0x4c7aa3=_0x0ef3[_0x146484];return _0x4c7aa3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x30ef('0x0'));var BPromise=require(_0x30ef('0x1'));var rs=require(_0x30ef('0x2'));var fs=require('fs');var Redis=require(_0x30ef('0x3'));var db=require(_0x30ef('0x4'))['db'];var utils=require(_0x30ef('0x5'));var logger=require(_0x30ef('0x6'))(_0x30ef('0x7'));var config=require('../../config/environment');var jayson=require(_0x30ef('0x8'));var client=jayson[_0x30ef('0x9')][_0x30ef('0xa')]({'port':0x232a});config[_0x30ef('0xb')]=_[_0x30ef('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x30ef('0xb')]));require(_0x30ef('0xd'))[_0x30ef('0xe')](socket);function respondWithRpcPromise(_0x5506f3,_0x53e84a,_0x39e4b3){return new BPromise(function(_0x455a24,_0x7a7298){return client[_0x30ef('0xf')](_0x5506f3,_0x39e4b3)['then'](function(_0x18d763){logger[_0x30ef('0x10')](_0x30ef('0x11'),_0x53e84a,_0x30ef('0x12'));logger['debug'](_0x30ef('0x13'),_0x53e84a,_0x30ef('0x12'),JSON[_0x30ef('0x14')](_0x18d763));if(_0x18d763[_0x30ef('0x15')]){if(_0x18d763['error'][_0x30ef('0x16')]===0x1f4){logger[_0x30ef('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x53e84a,_0x18d763['error'][_0x30ef('0x17')]);return _0x7a7298(_0x18d763[_0x30ef('0x15')][_0x30ef('0x17')]);}logger['error'](_0x30ef('0x11'),_0x53e84a,_0x18d763[_0x30ef('0x15')][_0x30ef('0x17')]);return _0x455a24(_0x18d763['error']['message']);}else{logger[_0x30ef('0x10')](_0x30ef('0x11'),_0x53e84a,_0x30ef('0x12'));_0x455a24(_0x18d763[_0x30ef('0x18')][_0x30ef('0x17')]);}})['catch'](function(_0x3cc9cb){logger[_0x30ef('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x53e84a,_0x3cc9cb);_0x7a7298(_0x3cc9cb);});});}exports[_0x30ef('0x19')]=function(_0xe3e658){var _0xf069fb=this;return new Promise(function(_0x2b5c63,_0x24c6a1){return db['WhatsappQueue'][_0x30ef('0x1a')]({'raw':_0xe3e658[_0x30ef('0x1b')]?_0xe3e658[_0x30ef('0x1b')][_0x30ef('0x1c')]===undefined?!![]:![]:!![],'where':_0xe3e658[_0x30ef('0x1b')]?_0xe3e658['options'][_0x30ef('0x1d')]||null:null,'attributes':_0xe3e658[_0x30ef('0x1b')]?_0xe3e658[_0x30ef('0x1b')][_0x30ef('0x1e')]||null:null,'limit':_0xe3e658['options']?_0xe3e658['options'][_0x30ef('0x1f')]||null:null,'include':_0xe3e658['options']?_0xe3e658[_0x30ef('0x1b')][_0x30ef('0x20')]?_['map'](_0xe3e658[_0x30ef('0x1b')]['include'],function(_0x3fef82){return{'model':db[_0x3fef82['model']],'as':_0x3fef82['as'],'attributes':_0x3fef82[_0x30ef('0x1e')],'include':_0x3fef82[_0x30ef('0x20')]?_[_0x30ef('0x21')](_0x3fef82['include'],function(_0x5d8c91){return{'model':db[_0x5d8c91['model']],'as':_0x5d8c91['as'],'attributes':_0x5d8c91[_0x30ef('0x1e')],'include':_0x5d8c91[_0x30ef('0x20')]?_[_0x30ef('0x21')](_0x5d8c91[_0x30ef('0x20')],function(_0x541f2a){return{'model':db[_0x541f2a[_0x30ef('0x22')]],'as':_0x541f2a['as'],'attributes':_0x541f2a[_0x30ef('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x30ef('0x23')](function(_0x501176){logger[_0x30ef('0x10')](_0x30ef('0x19'),_0xe3e658);logger[_0x30ef('0x24')](_0x30ef('0x19'),_0xe3e658,JSON[_0x30ef('0x14')](_0x501176));_0x2b5c63(_0x501176);})[_0x30ef('0x25')](function(_0x767f4){logger[_0x30ef('0x15')]('GetWhatsappQueue',_0x767f4[_0x30ef('0x17')],_0xe3e658);_0x24c6a1(_0xf069fb['error'](0x1f4,_0x767f4['message']));});});};exports[_0x30ef('0x26')]=function(_0x578828){var _0x52a321=this;return new Promise(function(_0x1c790e,_0x47dfbc){return db[_0x30ef('0x27')][_0x30ef('0x28')]({'raw':_0x578828[_0x30ef('0x1b')]?_0x578828['options'][_0x30ef('0x1c')]===undefined?!![]:![]:!![],'where':_0x578828['options']?_0x578828['options'][_0x30ef('0x1d')]||null:null,'attributes':_0x578828[_0x30ef('0x1b')]?_0x578828['options'][_0x30ef('0x1e')]||null:null,'include':_0x578828[_0x30ef('0x1b')]?_0x578828['options'][_0x30ef('0x20')]?_[_0x30ef('0x21')](_0x578828[_0x30ef('0x1b')][_0x30ef('0x20')],function(_0x240452){return{'model':db[_0x240452['model']],'as':_0x240452['as'],'attributes':_0x240452[_0x30ef('0x1e')],'include':_0x240452[_0x30ef('0x20')]?_['map'](_0x240452[_0x30ef('0x20')],function(_0x1ceb91){return{'model':db[_0x1ceb91['model']],'as':_0x1ceb91['as'],'attributes':_0x1ceb91[_0x30ef('0x1e')],'include':_0x1ceb91[_0x30ef('0x20')]?_[_0x30ef('0x21')](_0x1ceb91['include'],function(_0x431150){return{'model':db[_0x431150[_0x30ef('0x22')]],'as':_0x431150['as'],'attributes':_0x431150[_0x30ef('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x30ef('0x23')](function(_0x517c68){logger[_0x30ef('0x10')](_0x30ef('0x26'),_0x578828);logger[_0x30ef('0x24')](_0x30ef('0x26'),_0x578828,JSON[_0x30ef('0x14')](_0x517c68));_0x1c790e(_0x517c68);})[_0x30ef('0x25')](function(_0x1bb94b){logger[_0x30ef('0x15')]('ShowWhatsappQueue',_0x1bb94b[_0x30ef('0x17')],_0x578828);_0x47dfbc(_0x52a321[_0x30ef('0x15')](0x1f4,_0x1bb94b[_0x30ef('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 75576be..68a8060 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 _0x54e4=['length','whatsappQueue:','./whatsappQueue.events','removeListener','register'];(function(_0x835c94,_0x1da36e){var _0x53f56d=function(_0x196372){while(--_0x196372){_0x835c94['push'](_0x835c94['shift']());}};_0x53f56d(++_0x1da36e);}(_0x54e4,0x156));var _0x454e=function(_0x583fa5,_0x3d5260){_0x583fa5=_0x583fa5-0x0;var _0x234f43=_0x54e4[_0x583fa5];return _0x234f43;};'use strict';var WhatsappQueueEvents=require(_0x454e('0x0'));var events=['save','remove','update'];function createListener(_0x126b16,_0x1e16d2){return function(_0x39ccd5){_0x1e16d2['emit'](_0x126b16,_0x39ccd5);};}function removeListener(_0x222093,_0x4fed91){return function(){WhatsappQueueEvents[_0x454e('0x1')](_0x222093,_0x4fed91);};}exports[_0x454e('0x2')]=function(_0x32d411){for(var _0x2eaa63=0x0,_0x35345d=events[_0x454e('0x3')];_0x2eaa63<_0x35345d;_0x2eaa63++){var _0x459c9c=events[_0x2eaa63];var _0x130306=createListener(_0x454e('0x4')+_0x459c9c,_0x32d411);WhatsappQueueEvents['on'](_0x459c9c,_0x130306);}}; \ No newline at end of file +var _0x27dc=['emit','removeListener','register','whatsappQueue:','./whatsappQueue.events','save','remove','update'];(function(_0x344bed,_0x4293e4){var _0x4f8a15=function(_0x58d85e){while(--_0x58d85e){_0x344bed['push'](_0x344bed['shift']());}};_0x4f8a15(++_0x4293e4);}(_0x27dc,0x134));var _0xc27d=function(_0x2622c1,_0x22c2b6){_0x2622c1=_0x2622c1-0x0;var _0x475897=_0x27dc[_0x2622c1];return _0x475897;};'use strict';var WhatsappQueueEvents=require(_0xc27d('0x0'));var events=[_0xc27d('0x1'),_0xc27d('0x2'),_0xc27d('0x3')];function createListener(_0x189e42,_0x4da4b1){return function(_0x26291a){_0x4da4b1[_0xc27d('0x4')](_0x189e42,_0x26291a);};}function removeListener(_0x4a3a4d,_0x4ff155){return function(){WhatsappQueueEvents[_0xc27d('0x5')](_0x4a3a4d,_0x4ff155);};}exports[_0xc27d('0x6')]=function(_0x1b16e0){for(var _0x135dbb=0x0,_0x2ab68c=events['length'];_0x135dbb<_0x2ab68c;_0x135dbb++){var _0x46e09a=events[_0x135dbb];var _0x15aba4=createListener(_0xc27d('0x7')+_0x46e09a,_0x1b16e0);WhatsappQueueEvents['on'](_0x46e09a,_0x15aba4);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index a1951a2..ef62a24 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 _0x25a3=['../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra'];(function(_0x5998f4,_0x692111){var _0x67aa52=function(_0x153ad3){while(--_0x153ad3){_0x5998f4['push'](_0x5998f4['shift']());}};_0x67aa52(++_0x692111);}(_0x25a3,0x121));var _0x325a=function(_0x2c6047,_0x485481){_0x2c6047=_0x2c6047-0x0;var _0x5a9f17=_0x25a3[_0x2c6047];return _0x5a9f17;};'use strict';var multer=require(_0x325a('0x0'));var util=require(_0x325a('0x1'));var path=require(_0x325a('0x2'));var timeout=require('connect-timeout');var express=require(_0x325a('0x3'));var router=express['Router']();var fs_extra=require(_0x325a('0x4'));var auth=require(_0x325a('0x5'));var interaction=require(_0x325a('0x6'));var config=require('../../config/environment');var controller=require(_0x325a('0x7'));router[_0x325a('0x8')]('/',auth[_0x325a('0x9')](),controller['index']);router['get'](_0x325a('0xa'),auth[_0x325a('0x9')](),controller[_0x325a('0xb')]);router[_0x325a('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x325a('0xc')]);router[_0x325a('0xd')]('/',auth[_0x325a('0x9')](),controller[_0x325a('0xe')]);router[_0x325a('0xf')](_0x325a('0x10'),auth['isAuthenticated'](),controller[_0x325a('0x11')]);router[_0x325a('0x12')]('/:id',auth[_0x325a('0x9')](),controller[_0x325a('0x13')]);module[_0x325a('0x14')]=router; \ No newline at end of file +var _0x261b=['index','get','/describe','describe','/:id','post','create','put','destroy','exports','multer','util','fs-extra','../../components/interaction/service','./whatsappQueueReport.controller','isAuthenticated'];(function(_0x359113,_0x51b021){var _0x35af29=function(_0xbcdd6e){while(--_0xbcdd6e){_0x359113['push'](_0x359113['shift']());}};_0x35af29(++_0x51b021);}(_0x261b,0x15a));var _0xb261=function(_0xa0a721,_0x5f1192){_0xa0a721=_0xa0a721-0x0;var _0x530623=_0x261b[_0xa0a721];return _0x530623;};'use strict';var multer=require(_0xb261('0x0'));var util=require(_0xb261('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xb261('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xb261('0x3'));var config=require('../../config/environment');var controller=require(_0xb261('0x4'));router['get']('/',auth[_0xb261('0x5')](),controller[_0xb261('0x6')]);router[_0xb261('0x7')](_0xb261('0x8'),auth['isAuthenticated'](),controller[_0xb261('0x9')]);router[_0xb261('0x7')](_0xb261('0xa'),auth[_0xb261('0x5')](),controller['show']);router[_0xb261('0xb')]('/',auth[_0xb261('0x5')](),controller[_0xb261('0xc')]);router[_0xb261('0xd')](_0xb261('0xa'),auth[_0xb261('0x5')](),controller['update']);router['delete']('/:id',auth[_0xb261('0x5')](),controller[_0xb261('0xe')]);module[_0xb261('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index dfc4f60..9b7f4f8 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 _0xe14b=['sequelize','exports','DATE'];(function(_0x3cd1d2,_0x312a5f){var _0x1851e8=function(_0x567f59){while(--_0x567f59){_0x3cd1d2['push'](_0x3cd1d2['shift']());}};_0x1851e8(++_0x312a5f);}(_0xe14b,0x93));var _0xbe14=function(_0x1981d6,_0x3db5b0){_0x1981d6=_0x1981d6-0x0;var _0xa72861=_0xe14b[_0x1981d6];return _0xa72861;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xbe14('0x2')]},'leaveAt':{'type':Sequelize[_0xbe14('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xbe14('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x00bb=['sequelize','exports','STRING','DATE'];(function(_0x492d9a,_0x92ffce){var _0x1a4733=function(_0x131d64){while(--_0x131d64){_0x492d9a['push'](_0x492d9a['shift']());}};_0x1a4733(++_0x92ffce);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x00bb[_0x4e9628];return _0x27bc8c;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'uniqueid':{'type':Sequelize[_0xb00b('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb00b('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb00b('0x3')]},'exitAt':{'type':Sequelize[_0xb00b('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index ac19d5d..b8dedac 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 _0x5afd=['order','sort','filter','where','merge','options','WhatsappQueueReport','includeAll','show','include','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x39ae6d,_0x2e4ee6){var _0x4771f2=function(_0x484636){while(--_0x484636){_0x39ae6d['push'](_0x39ae6d['shift']());}};_0x4771f2(++_0x2e4ee6);}(_0x5afd,0xeb));var _0xd5af=function(_0x34da1f,_0x37a259){_0x34da1f=_0x34da1f-0x0;var _0x4897cc=_0x5afd[_0x34da1f];return _0x4897cc;};'use strict';var emlformat=require(_0xd5af('0x0'));var rimraf=require(_0xd5af('0x1'));var zipdir=require(_0xd5af('0x2'));var jsonpatch=require(_0xd5af('0x3'));var rp=require(_0xd5af('0x4'));var moment=require(_0xd5af('0x5'));var BPromise=require(_0xd5af('0x6'));var Mustache=require(_0xd5af('0x7'));var util=require(_0xd5af('0x8'));var path=require(_0xd5af('0x9'));var sox=require(_0xd5af('0xa'));var csv=require('to-csv');var ejs=require(_0xd5af('0xb'));var fs=require('fs');var fs_extra=require(_0xd5af('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd5af('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd5af('0xe'));var toCsv=require(_0xd5af('0xf'));var querystring=require('querystring');var Papa=require(_0xd5af('0x10'));var Redis=require('ioredis');var authService=require(_0xd5af('0x11'));var qs=require(_0xd5af('0x12'));var as=require(_0xd5af('0x13'));var hardwareService=require(_0xd5af('0x14'));var logger=require(_0xd5af('0x15'))(_0xd5af('0x16'));var utils=require(_0xd5af('0x17'));var config=require(_0xd5af('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b14cf,_0x543c22){_0x543c22=_0x543c22||0xcc;return function(_0x47c301){if(_0x47c301){return _0x4b14cf[_0xd5af('0x19')](_0x543c22);}return _0x4b14cf[_0xd5af('0x1a')](_0x543c22)[_0xd5af('0x1b')]();};}function respondWithResult(_0x20bcc3,_0x2355c2){_0x2355c2=_0x2355c2||0xc8;return function(_0x576fd4){if(_0x576fd4){return _0x20bcc3['status'](_0x2355c2)[_0xd5af('0x1c')](_0x576fd4);}};}function respondWithFilteredResult(_0x49bc53,_0x3bcc12){return function(_0x537904){if(_0x537904){var _0x45113b=_0x537904[_0xd5af('0x1d')],_0x4bce98=_0x3bcc12[_0xd5af('0x1e')],_0x8121dc=_0x3bcc12[_0xd5af('0x1e')]+_0x3bcc12[_0xd5af('0x1f')],_0x4fec69;if(_0x8121dc>=_0x45113b){_0x8121dc=_0x45113b;_0x4fec69=0xc8;}else{_0x4fec69=0xce;}_0x49bc53[_0xd5af('0x1a')](_0x4fec69);return _0x49bc53['set'](_0xd5af('0x20'),_0x4bce98+'-'+_0x8121dc+'/'+_0x45113b)[_0xd5af('0x1c')](_0x537904);}return null;};}function patchUpdates(_0x40f7a4){return function(_0x26a92e){try{jsonpatch[_0xd5af('0x21')](_0x26a92e,_0x40f7a4,!![]);}catch(_0x4c0f0e){return BPromise[_0xd5af('0x22')](_0x4c0f0e);}return _0x26a92e[_0xd5af('0x23')]();};}function saveUpdates(_0x2fc106,_0x2fc83f){return function(_0x31cf1f){if(_0x31cf1f){return _0x31cf1f[_0xd5af('0x24')](_0x2fc106)[_0xd5af('0x25')](function(_0x5c9170){return _0x5c9170;});}return null;};}function removeEntity(_0x2d8a40,_0x1133a3){return function(_0x5950bb){if(_0x5950bb){return _0x5950bb['destroy']()['then'](function(){_0x2d8a40[_0xd5af('0x1a')](0xcc)[_0xd5af('0x1b')]();});}};}function handleEntityNotFound(_0x592809,_0x35b517){return function(_0x375850){if(!_0x375850){_0x592809[_0xd5af('0x19')](0x194);}return _0x375850;};}function handleError(_0x5880be,_0x4659bc){_0x4659bc=_0x4659bc||0x1f4;return function(_0xeff265){logger[_0xd5af('0x26')](_0xeff265[_0xd5af('0x27')]);if(_0xeff265['name']){delete _0xeff265['name'];}_0x5880be[_0xd5af('0x1a')](_0x4659bc)['send'](_0xeff265);};}exports[_0xd5af('0x28')]=function(_0x39bd70,_0x416f79){var _0x39067a={},_0x4a1362={},_0x43210b={'count':0x0,'rows':[]};var _0xad34f8=_[_0xd5af('0x29')](db['WhatsappQueueReport'][_0xd5af('0x2a')],function(_0x2e0aff){return{'name':_0x2e0aff[_0xd5af('0x2b')],'type':_0x2e0aff[_0xd5af('0x2c')][_0xd5af('0x2d')]};});_0x4a1362[_0xd5af('0x2e')]=_[_0xd5af('0x29')](_0xad34f8,_0xd5af('0x2f'));_0x4a1362[_0xd5af('0x30')]=_[_0xd5af('0x31')](_0x39bd70['query']);_0x4a1362[_0xd5af('0x32')]=_['intersection'](_0x4a1362['model'],_0x4a1362[_0xd5af('0x30')]);_0x39067a[_0xd5af('0x33')]=_[_0xd5af('0x34')](_0x4a1362['model'],qs[_0xd5af('0x35')](_0x39bd70[_0xd5af('0x30')]['fields']));_0x39067a[_0xd5af('0x33')]=_0x39067a[_0xd5af('0x33')][_0xd5af('0x36')]?_0x39067a[_0xd5af('0x33')]:_0x4a1362[_0xd5af('0x2e')];if(!_0x39bd70[_0xd5af('0x30')][_0xd5af('0x37')](_0xd5af('0x38'))){_0x39067a['limit']=qs['limit'](_0x39bd70[_0xd5af('0x30')][_0xd5af('0x1f')]);_0x39067a['offset']=qs[_0xd5af('0x1e')](_0x39bd70[_0xd5af('0x30')][_0xd5af('0x1e')]);}_0x39067a[_0xd5af('0x39')]=qs[_0xd5af('0x3a')](_0x39bd70[_0xd5af('0x30')][_0xd5af('0x3a')]);_0x39067a['where']=qs[_0xd5af('0x32')](_['pick'](_0x39bd70[_0xd5af('0x30')],_0x4a1362[_0xd5af('0x32')]),_0xad34f8);if(_0x39bd70['query'][_0xd5af('0x3b')]){_0x39067a[_0xd5af('0x3c')]=_[_0xd5af('0x3d')](_0x39067a[_0xd5af('0x3c')],{'$or':_['map'](_0xad34f8,function(_0x48e662){if(_0x48e662[_0xd5af('0x2c')]!=='VIRTUAL'){var _0x3f22b8={};_0x3f22b8[_0x48e662['name']]={'$like':'%'+_0x39bd70[_0xd5af('0x30')]['filter']+'%'};return _0x3f22b8;}})});}_0x39067a=_[_0xd5af('0x3d')]({},_0x39067a,_0x39bd70[_0xd5af('0x3e')]);var _0x22ad84={'where':_0x39067a['where']};return db[_0xd5af('0x3f')][_0xd5af('0x1d')](_0x22ad84)[_0xd5af('0x25')](function(_0x21241c){_0x43210b[_0xd5af('0x1d')]=_0x21241c;if(_0x39bd70[_0xd5af('0x30')][_0xd5af('0x40')]){_0x39067a['include']=[{'all':!![]}];}return db[_0xd5af('0x3f')]['findAll'](_0x39067a);})['then'](function(_0x23ce83){_0x43210b['rows']=_0x23ce83;return _0x43210b;})[_0xd5af('0x25')](respondWithFilteredResult(_0x416f79,_0x39067a))['catch'](handleError(_0x416f79,null));};exports[_0xd5af('0x41')]=function(_0x2379dd,_0x4cacfa){var _0x545c87={'raw':!![],'where':{'id':_0x2379dd['params']['id']}},_0x105628={};_0x105628[_0xd5af('0x2e')]=_[_0xd5af('0x31')](db[_0xd5af('0x3f')][_0xd5af('0x2a')]);_0x105628[_0xd5af('0x30')]=_[_0xd5af('0x31')](_0x2379dd['query']);_0x105628[_0xd5af('0x32')]=_['intersection'](_0x105628[_0xd5af('0x2e')],_0x105628['query']);_0x545c87[_0xd5af('0x33')]=_['intersection'](_0x105628['model'],qs[_0xd5af('0x35')](_0x2379dd[_0xd5af('0x30')][_0xd5af('0x35')]));_0x545c87[_0xd5af('0x33')]=_0x545c87['attributes'][_0xd5af('0x36')]?_0x545c87[_0xd5af('0x33')]:_0x105628[_0xd5af('0x2e')];if(_0x2379dd[_0xd5af('0x30')][_0xd5af('0x40')]){_0x545c87[_0xd5af('0x42')]=[{'all':!![]}];}_0x545c87=_['merge']({},_0x545c87,_0x2379dd['options']);return db[_0xd5af('0x3f')][_0xd5af('0x43')](_0x545c87)[_0xd5af('0x25')](handleEntityNotFound(_0x4cacfa,null))[_0xd5af('0x25')](respondWithResult(_0x4cacfa,null))[_0xd5af('0x44')](handleError(_0x4cacfa,null));};exports['create']=function(_0x541811,_0x6dca69){return db[_0xd5af('0x3f')][_0xd5af('0x45')](_0x541811[_0xd5af('0x46')],{})['then'](respondWithResult(_0x6dca69,0xc9))[_0xd5af('0x44')](handleError(_0x6dca69,null));};exports[_0xd5af('0x24')]=function(_0x1cc57e,_0x393940){if(_0x1cc57e[_0xd5af('0x46')]['id']){delete _0x1cc57e['body']['id'];}return db[_0xd5af('0x3f')][_0xd5af('0x43')]({'where':{'id':_0x1cc57e[_0xd5af('0x47')]['id']}})[_0xd5af('0x25')](handleEntityNotFound(_0x393940,null))[_0xd5af('0x25')](saveUpdates(_0x1cc57e[_0xd5af('0x46')],null))['then'](respondWithResult(_0x393940,null))[_0xd5af('0x44')](handleError(_0x393940,null));};exports['destroy']=function(_0x44c81d,_0x3c64ea){return db[_0xd5af('0x3f')][_0xd5af('0x43')]({'where':{'id':_0x44c81d['params']['id']}})['then'](handleEntityNotFound(_0x3c64ea,null))[_0xd5af('0x25')](removeEntity(_0x3c64ea,null))[_0xd5af('0x44')](handleError(_0x3c64ea,null));};exports[_0xd5af('0x48')]=function(_0x4014bd,_0x45f6d5){return db['WhatsappQueueReport'][_0xd5af('0x48')]()[_0xd5af('0x25')](respondWithResult(_0x45f6d5,null))['catch'](handleError(_0x45f6d5,null));}; \ No newline at end of file +var _0x7037=['../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','key','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filter','merge','include','findAll','params','fields','includeAll','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x13bf6e,_0x3d42ee){var _0x55852e=function(_0x38a545){while(--_0x38a545){_0x13bf6e['push'](_0x13bf6e['shift']());}};_0x55852e(++_0x3d42ee);}(_0x7037,0x15f));var _0x7703=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x7037[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0x7703('0x0'));var rimraf=require(_0x7703('0x1'));var zipdir=require(_0x7703('0x2'));var jsonpatch=require(_0x7703('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7703('0x4'));var Mustache=require(_0x7703('0x5'));var util=require(_0x7703('0x6'));var path=require(_0x7703('0x7'));var sox=require(_0x7703('0x8'));var csv=require(_0x7703('0x9'));var ejs=require(_0x7703('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7703('0xb'));var squel=require(_0x7703('0xc'));var crypto=require(_0x7703('0xd'));var jsforce=require(_0x7703('0xe'));var deskjs=require(_0x7703('0xf'));var toCsv=require(_0x7703('0x9'));var querystring=require(_0x7703('0x10'));var Papa=require(_0x7703('0x11'));var Redis=require('ioredis');var authService=require(_0x7703('0x12'));var qs=require(_0x7703('0x13'));var as=require(_0x7703('0x14'));var hardwareService=require(_0x7703('0x15'));var logger=require(_0x7703('0x16'))(_0x7703('0x17'));var utils=require(_0x7703('0x18'));var config=require(_0x7703('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x7703('0x1a'))['db'];function respondWithStatusCode(_0x5e5ae,_0xc4309b){_0xc4309b=_0xc4309b||0xcc;return function(_0x310fcc){if(_0x310fcc){return _0x5e5ae['sendStatus'](_0xc4309b);}return _0x5e5ae[_0x7703('0x1b')](_0xc4309b)[_0x7703('0x1c')]();};}function respondWithResult(_0x231f59,_0x163758){_0x163758=_0x163758||0xc8;return function(_0x9df802){if(_0x9df802){return _0x231f59['status'](_0x163758)[_0x7703('0x1d')](_0x9df802);}};}function respondWithFilteredResult(_0x2de5dd,_0x3c8fe7){return function(_0x5f1fb1){if(_0x5f1fb1){var _0x3855dd=_0x5f1fb1[_0x7703('0x1e')],_0x90b068=_0x3c8fe7[_0x7703('0x1f')],_0x4242a5=_0x3c8fe7[_0x7703('0x1f')]+_0x3c8fe7[_0x7703('0x20')],_0x4f45af;if(_0x4242a5>=_0x3855dd){_0x4242a5=_0x3855dd;_0x4f45af=0xc8;}else{_0x4f45af=0xce;}_0x2de5dd['status'](_0x4f45af);return _0x2de5dd[_0x7703('0x21')]('Content-Range',_0x90b068+'-'+_0x4242a5+'/'+_0x3855dd)['json'](_0x5f1fb1);}return null;};}function patchUpdates(_0x1e36af){return function(_0x1e4a47){try{jsonpatch[_0x7703('0x22')](_0x1e4a47,_0x1e36af,!![]);}catch(_0x1ba558){return BPromise[_0x7703('0x23')](_0x1ba558);}return _0x1e4a47[_0x7703('0x24')]();};}function saveUpdates(_0x29a0dc,_0x6646f){return function(_0x37157a){if(_0x37157a){return _0x37157a[_0x7703('0x25')](_0x29a0dc)[_0x7703('0x26')](function(_0x37807b){return _0x37807b;});}return null;};}function removeEntity(_0x12896d,_0x48c5c2){return function(_0x1a4c1f){if(_0x1a4c1f){return _0x1a4c1f[_0x7703('0x27')]()[_0x7703('0x26')](function(){_0x12896d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x518fda,_0x256f72){return function(_0x19d067){if(!_0x19d067){_0x518fda[_0x7703('0x28')](0x194);}return _0x19d067;};}function handleError(_0xb756fe,_0x2e71cb){_0x2e71cb=_0x2e71cb||0x1f4;return function(_0x3e1606){logger[_0x7703('0x29')](_0x3e1606[_0x7703('0x2a')]);if(_0x3e1606['name']){delete _0x3e1606[_0x7703('0x2b')];}_0xb756fe[_0x7703('0x1b')](_0x2e71cb)[_0x7703('0x2c')](_0x3e1606);};}exports[_0x7703('0x2d')]=function(_0x4739a5,_0x47f95b){var _0x4956aa={},_0x2f9072={},_0x525d23={'count':0x0,'rows':[]};var _0xa004bc=_[_0x7703('0x2e')](db[_0x7703('0x2f')]['rawAttributes'],function(_0x29e00f){return{'name':_0x29e00f[_0x7703('0x30')],'type':_0x29e00f[_0x7703('0x31')][_0x7703('0x32')]};});_0x2f9072['model']=_[_0x7703('0x2e')](_0xa004bc,_0x7703('0x2b'));_0x2f9072[_0x7703('0x33')]=_[_0x7703('0x34')](_0x4739a5['query']);_0x2f9072[_0x7703('0x35')]=_['intersection'](_0x2f9072[_0x7703('0x36')],_0x2f9072[_0x7703('0x33')]);_0x4956aa[_0x7703('0x37')]=_[_0x7703('0x38')](_0x2f9072[_0x7703('0x36')],qs['fields'](_0x4739a5['query']['fields']));_0x4956aa['attributes']=_0x4956aa[_0x7703('0x37')][_0x7703('0x39')]?_0x4956aa['attributes']:_0x2f9072['model'];if(!_0x4739a5[_0x7703('0x33')][_0x7703('0x3a')](_0x7703('0x3b'))){_0x4956aa[_0x7703('0x20')]=qs[_0x7703('0x20')](_0x4739a5[_0x7703('0x33')]['limit']);_0x4956aa[_0x7703('0x1f')]=qs['offset'](_0x4739a5[_0x7703('0x33')][_0x7703('0x1f')]);}_0x4956aa['order']=qs[_0x7703('0x3c')](_0x4739a5['query'][_0x7703('0x3c')]);_0x4956aa[_0x7703('0x3d')]=qs[_0x7703('0x35')](_['pick'](_0x4739a5[_0x7703('0x33')],_0x2f9072[_0x7703('0x35')]),_0xa004bc);if(_0x4739a5[_0x7703('0x33')][_0x7703('0x3e')]){_0x4956aa['where']=_[_0x7703('0x3f')](_0x4956aa[_0x7703('0x3d')],{'$or':_['map'](_0xa004bc,function(_0x46abd9){if(_0x46abd9[_0x7703('0x31')]!=='VIRTUAL'){var _0x3756f3={};_0x3756f3[_0x46abd9['name']]={'$like':'%'+_0x4739a5[_0x7703('0x33')][_0x7703('0x3e')]+'%'};return _0x3756f3;}})});}_0x4956aa=_[_0x7703('0x3f')]({},_0x4956aa,_0x4739a5['options']);var _0x3ab758={'where':_0x4956aa['where']};return db[_0x7703('0x2f')][_0x7703('0x1e')](_0x3ab758)[_0x7703('0x26')](function(_0x46e3a8){_0x525d23['count']=_0x46e3a8;if(_0x4739a5[_0x7703('0x33')]['includeAll']){_0x4956aa[_0x7703('0x40')]=[{'all':!![]}];}return db[_0x7703('0x2f')][_0x7703('0x41')](_0x4956aa);})[_0x7703('0x26')](function(_0x4ba31e){_0x525d23['rows']=_0x4ba31e;return _0x525d23;})[_0x7703('0x26')](respondWithFilteredResult(_0x47f95b,_0x4956aa))['catch'](handleError(_0x47f95b,null));};exports['show']=function(_0x5d9dc9,_0x18e756){var _0x2f3e45={'raw':!![],'where':{'id':_0x5d9dc9[_0x7703('0x42')]['id']}},_0x1918c2={};_0x1918c2[_0x7703('0x36')]=_[_0x7703('0x34')](db['WhatsappQueueReport']['rawAttributes']);_0x1918c2[_0x7703('0x33')]=_[_0x7703('0x34')](_0x5d9dc9[_0x7703('0x33')]);_0x1918c2['filters']=_[_0x7703('0x38')](_0x1918c2[_0x7703('0x36')],_0x1918c2[_0x7703('0x33')]);_0x2f3e45[_0x7703('0x37')]=_[_0x7703('0x38')](_0x1918c2[_0x7703('0x36')],qs[_0x7703('0x43')](_0x5d9dc9['query'][_0x7703('0x43')]));_0x2f3e45[_0x7703('0x37')]=_0x2f3e45[_0x7703('0x37')][_0x7703('0x39')]?_0x2f3e45[_0x7703('0x37')]:_0x1918c2[_0x7703('0x36')];if(_0x5d9dc9[_0x7703('0x33')][_0x7703('0x44')]){_0x2f3e45['include']=[{'all':!![]}];}_0x2f3e45=_['merge']({},_0x2f3e45,_0x5d9dc9[_0x7703('0x45')]);return db[_0x7703('0x2f')][_0x7703('0x46')](_0x2f3e45)[_0x7703('0x26')](handleEntityNotFound(_0x18e756,null))[_0x7703('0x26')](respondWithResult(_0x18e756,null))[_0x7703('0x47')](handleError(_0x18e756,null));};exports[_0x7703('0x48')]=function(_0x262b8e,_0x2a2a96){return db[_0x7703('0x2f')][_0x7703('0x48')](_0x262b8e[_0x7703('0x49')],{})[_0x7703('0x26')](respondWithResult(_0x2a2a96,0xc9))['catch'](handleError(_0x2a2a96,null));};exports['update']=function(_0x5ce916,_0xeecda7){if(_0x5ce916[_0x7703('0x49')]['id']){delete _0x5ce916[_0x7703('0x49')]['id'];}return db['WhatsappQueueReport'][_0x7703('0x46')]({'where':{'id':_0x5ce916[_0x7703('0x42')]['id']}})[_0x7703('0x26')](handleEntityNotFound(_0xeecda7,null))[_0x7703('0x26')](saveUpdates(_0x5ce916[_0x7703('0x49')],null))[_0x7703('0x26')](respondWithResult(_0xeecda7,null))[_0x7703('0x47')](handleError(_0xeecda7,null));};exports[_0x7703('0x27')]=function(_0x5aa8ff,_0x501baf){return db[_0x7703('0x2f')][_0x7703('0x46')]({'where':{'id':_0x5aa8ff[_0x7703('0x42')]['id']}})['then'](handleEntityNotFound(_0x501baf,null))[_0x7703('0x26')](removeEntity(_0x501baf,null))[_0x7703('0x47')](handleError(_0x501baf,null));};exports[_0x7703('0x4a')]=function(_0x3de1ef,_0x30033e){return db['WhatsappQueueReport'][_0x7703('0x4a')]()[_0x7703('0x26')](respondWithResult(_0x30033e,null))['catch'](handleError(_0x30033e,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index c7b1ecc..a737170 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 _0xd91d=['path','../../config/environment','./whatsappQueueReport.attributes','exports','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x1261c2,_0x3ef819){var _0x3aabd2=function(_0x425d76){while(--_0x425d76){_0x1261c2['push'](_0x1261c2['shift']());}};_0x3aabd2(++_0x3ef819);}(_0xd91d,0x11a));var _0xdd91=function(_0x414787,_0x4e63ce){_0x414787=_0x414787-0x0;var _0x3eef30=_0xd91d[_0x414787];return _0x3eef30;};'use strict';var _=require(_0xdd91('0x0'));var util=require(_0xdd91('0x1'));var logger=require(_0xdd91('0x2'))('api');var moment=require(_0xdd91('0x3'));var BPromise=require(_0xdd91('0x4'));var rp=require(_0xdd91('0x5'));var fs=require('fs');var path=require(_0xdd91('0x6'));var rimraf=require('rimraf');var config=require(_0xdd91('0x7'));var attributes=require(_0xdd91('0x8'));module[_0xdd91('0x9')]=function(_0x521a72,_0x3f304f){return _0x521a72['define']('WhatsappQueueReport',attributes,{'tableName':_0xdd91('0xa'),'paranoid':![],'indexes':[{'name':_0xdd91('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7816=['../../config/environment','./whatsappQueueReport.attributes','exports','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3056a5,_0x255d64){var _0x5eaeff=function(_0x3edb77){while(--_0x3edb77){_0x3056a5['push'](_0x3056a5['shift']());}};_0x5eaeff(++_0x255d64);}(_0x7816,0xf6));var _0x6781=function(_0x19454e,_0x436336){_0x19454e=_0x19454e-0x0;var _0x11e26e=_0x7816[_0x19454e];return _0x11e26e;};'use strict';var _=require(_0x6781('0x0'));var util=require('util');var logger=require(_0x6781('0x1'))(_0x6781('0x2'));var moment=require(_0x6781('0x3'));var BPromise=require(_0x6781('0x4'));var rp=require(_0x6781('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6781('0x6'));var config=require(_0x6781('0x7'));var attributes=require(_0x6781('0x8'));module[_0x6781('0x9')]=function(_0x4b7eb5,_0x194cb5){return _0x4b7eb5['define']('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x6781('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index bd6b5b9..0d59d3b 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 _0x681f=['WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport','where','UpdateWhatsappQueueReport','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x681f,0x186));var _0xf681=function(_0x10d5ec,_0x46cc8b){_0x10d5ec=_0x10d5ec-0x0;var _0x3b7c69=_0x681f[_0x10d5ec];return _0x3b7c69;};'use strict';var _=require(_0xf681('0x0'));var util=require('util');var moment=require(_0xf681('0x1'));var BPromise=require('bluebird');var rs=require(_0xf681('0x2'));var fs=require('fs');var Redis=require(_0xf681('0x3'));var db=require(_0xf681('0x4'))['db'];var utils=require(_0xf681('0x5'));var logger=require(_0xf681('0x6'))('rpc');var config=require(_0xf681('0x7'));var jayson=require(_0xf681('0x8'));var client=jayson[_0xf681('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cd7b5,_0x37cd8a,_0x198078){return new BPromise(function(_0x355d6c,_0x53653e){return client[_0xf681('0xa')](_0x2cd7b5,_0x198078)[_0xf681('0xb')](function(_0x29b855){logger[_0xf681('0xc')](_0xf681('0xd'),_0x37cd8a,'request\x20sent');logger[_0xf681('0xe')](_0xf681('0xf'),_0x37cd8a,'request\x20sent',JSON[_0xf681('0x10')](_0x29b855));if(_0x29b855[_0xf681('0x11')]){if(_0x29b855[_0xf681('0x11')][_0xf681('0x12')]===0x1f4){logger[_0xf681('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x37cd8a,_0x29b855[_0xf681('0x11')]['message']);return _0x53653e(_0x29b855['error'][_0xf681('0x13')]);}logger[_0xf681('0x11')](_0xf681('0xd'),_0x37cd8a,_0x29b855[_0xf681('0x11')][_0xf681('0x13')]);return _0x355d6c(_0x29b855[_0xf681('0x11')][_0xf681('0x13')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x37cd8a,_0xf681('0x14'));_0x355d6c(_0x29b855[_0xf681('0x15')][_0xf681('0x13')]);}})[_0xf681('0x16')](function(_0xd55dd6){logger[_0xf681('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x37cd8a,_0xd55dd6);_0x53653e(_0xd55dd6);});});}exports['CreateWhatsappQueueReport']=function(_0x252f7f){var _0x315355=this;return new Promise(function(_0x57e070,_0xc53648){return db[_0xf681('0x17')][_0xf681('0x18')](_0x252f7f[_0xf681('0x19')],{'raw':_0x252f7f['options']?_0x252f7f[_0xf681('0x1a')][_0xf681('0x1b')]===undefined?!![]:![]:!![]})[_0xf681('0xb')](function(_0x1dc36a){logger[_0xf681('0xc')](_0xf681('0x1c'),_0x252f7f);logger[_0xf681('0xe')](_0xf681('0x1c'),_0x252f7f,JSON[_0xf681('0x10')](_0x1dc36a));_0x57e070(_0x1dc36a);})[_0xf681('0x16')](function(_0x3ea272){logger[_0xf681('0x11')]('CreateWhatsappQueueReport',_0x3ea272[_0xf681('0x13')],_0x252f7f);_0xc53648(_0x315355['error'](0x1f4,_0x3ea272['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x1fc618){var _0x16ab25=this;return new Promise(function(_0x596fb7,_0x3d94bf){return db[_0xf681('0x17')]['update'](_0x1fc618['body'],{'raw':_0x1fc618['options']?_0x1fc618[_0xf681('0x1a')][_0xf681('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fc618['options']?_0x1fc618['options'][_0xf681('0x1d')]||null:null,'attributes':_0x1fc618[_0xf681('0x1a')]?_0x1fc618[_0xf681('0x1a')]['attributes']||null:null,'limit':_0x1fc618['options']?_0x1fc618[_0xf681('0x1a')]['limit']||null:null})[_0xf681('0xb')](function(_0x2d702b){logger['info'](_0xf681('0x1e'),_0x1fc618);logger[_0xf681('0xe')]('UpdateWhatsappQueueReport',_0x1fc618,JSON[_0xf681('0x10')](_0x2d702b));_0x596fb7(_0x2d702b);})[_0xf681('0x16')](function(_0x4700cd){logger['error'](_0xf681('0x1e'),_0x4700cd[_0xf681('0x13')],_0x1fc618);_0x3d94bf(_0x16ab25[_0xf681('0x11')](0x1f4,_0x4700cd[_0xf681('0x13')]));});});}; \ No newline at end of file +var _0x5142=['where','limit','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport'];(function(_0x12835c,_0x3b6750){var _0x2b3686=function(_0x3e0472){while(--_0x3e0472){_0x12835c['push'](_0x12835c['shift']());}};_0x2b3686(++_0x3b6750);}(_0x5142,0x7e));var _0x2514=function(_0x5a4cfd,_0x309bec){_0x5a4cfd=_0x5a4cfd-0x0;var _0x5dedc2=_0x5142[_0x5a4cfd];return _0x5dedc2;};'use strict';var _=require(_0x2514('0x0'));var util=require('util');var moment=require(_0x2514('0x1'));var BPromise=require(_0x2514('0x2'));var rs=require(_0x2514('0x3'));var fs=require('fs');var Redis=require(_0x2514('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2514('0x5'))(_0x2514('0x6'));var config=require(_0x2514('0x7'));var jayson=require(_0x2514('0x8'));var client=jayson[_0x2514('0x9')][_0x2514('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x499c46,_0x9cc510,_0x13e930){return new BPromise(function(_0x31b21b,_0x792ba7){return client['request'](_0x499c46,_0x13e930)[_0x2514('0xb')](function(_0x3c5e6a){logger['info'](_0x2514('0xc'),_0x9cc510,_0x2514('0xd'));logger[_0x2514('0xe')](_0x2514('0xf'),_0x9cc510,'request\x20sent',JSON[_0x2514('0x10')](_0x3c5e6a));if(_0x3c5e6a[_0x2514('0x11')]){if(_0x3c5e6a[_0x2514('0x11')][_0x2514('0x12')]===0x1f4){logger[_0x2514('0x11')](_0x2514('0xc'),_0x9cc510,_0x3c5e6a[_0x2514('0x11')]['message']);return _0x792ba7(_0x3c5e6a[_0x2514('0x11')][_0x2514('0x13')]);}logger[_0x2514('0x11')](_0x2514('0xc'),_0x9cc510,_0x3c5e6a[_0x2514('0x11')][_0x2514('0x13')]);return _0x31b21b(_0x3c5e6a[_0x2514('0x11')][_0x2514('0x13')]);}else{logger[_0x2514('0x14')]('WhatsappQueueReport,\x20%s,\x20%s',_0x9cc510,_0x2514('0xd'));_0x31b21b(_0x3c5e6a['result'][_0x2514('0x13')]);}})[_0x2514('0x15')](function(_0x185544){logger[_0x2514('0x11')](_0x2514('0xc'),_0x9cc510,_0x185544);_0x792ba7(_0x185544);});});}exports[_0x2514('0x16')]=function(_0x514c60){var _0x10cb37=this;return new Promise(function(_0x8e4919,_0x480683){return db[_0x2514('0x17')][_0x2514('0x18')](_0x514c60[_0x2514('0x19')],{'raw':_0x514c60[_0x2514('0x1a')]?_0x514c60['options'][_0x2514('0x1b')]===undefined?!![]:![]:!![]})[_0x2514('0xb')](function(_0x3283ee){logger[_0x2514('0x14')]('CreateWhatsappQueueReport',_0x514c60);logger[_0x2514('0xe')](_0x2514('0x16'),_0x514c60,JSON[_0x2514('0x10')](_0x3283ee));_0x8e4919(_0x3283ee);})[_0x2514('0x15')](function(_0x5eb1a2){logger[_0x2514('0x11')](_0x2514('0x16'),_0x5eb1a2['message'],_0x514c60);_0x480683(_0x10cb37['error'](0x1f4,_0x5eb1a2[_0x2514('0x13')]));});});};exports[_0x2514('0x1c')]=function(_0xc5516a){var _0x595934=this;return new Promise(function(_0x286a25,_0x15b531){return db['WhatsappQueueReport']['update'](_0xc5516a[_0x2514('0x19')],{'raw':_0xc5516a[_0x2514('0x1a')]?_0xc5516a['options'][_0x2514('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc5516a['options']?_0xc5516a[_0x2514('0x1a')][_0x2514('0x1d')]||null:null,'attributes':_0xc5516a[_0x2514('0x1a')]?_0xc5516a[_0x2514('0x1a')]['attributes']||null:null,'limit':_0xc5516a[_0x2514('0x1a')]?_0xc5516a[_0x2514('0x1a')][_0x2514('0x1e')]||null:null})['then'](function(_0x29dd2d){logger[_0x2514('0x14')]('UpdateWhatsappQueueReport',_0xc5516a);logger[_0x2514('0xe')]('UpdateWhatsappQueueReport',_0xc5516a,JSON[_0x2514('0x10')](_0x29dd2d));_0x286a25(_0x29dd2d);})[_0x2514('0x15')](function(_0x313669){logger[_0x2514('0x11')](_0x2514('0x1c'),_0x313669['message'],_0xc5516a);_0x15b531(_0x595934['error'](0x1f4,_0x313669[_0x2514('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index fe32c48..8a60e30 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 _0x48ea=['../../config/environment','./whatsappTransferReport.controller','index','get','/describe','isAuthenticated','describe','show','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xddcd54,_0x4a6d58){var _0x559bec=function(_0x50faa3){while(--_0x50faa3){_0xddcd54['push'](_0xddcd54['shift']());}};_0x559bec(++_0x4a6d58);}(_0x48ea,0x173));var _0xa48e=function(_0x3b1113,_0x3b0fb1){_0x3b1113=_0x3b1113-0x0;var _0x32ed09=_0x48ea[_0x3b1113];return _0x32ed09;};'use strict';var multer=require(_0xa48e('0x0'));var util=require('util');var path=require(_0xa48e('0x1'));var timeout=require(_0xa48e('0x2'));var express=require(_0xa48e('0x3'));var router=express[_0xa48e('0x4')]();var fs_extra=require(_0xa48e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa48e('0x6'));var config=require(_0xa48e('0x7'));var controller=require(_0xa48e('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa48e('0x9')]);router[_0xa48e('0xa')](_0xa48e('0xb'),auth[_0xa48e('0xc')](),controller[_0xa48e('0xd')]);router[_0xa48e('0xa')]('/:id',auth[_0xa48e('0xc')](),controller[_0xa48e('0xe')]);router['post']('/',auth[_0xa48e('0xc')](),controller['create']);router[_0xa48e('0xf')](_0xa48e('0x10'),auth[_0xa48e('0xc')](),controller[_0xa48e('0x11')]);router[_0xa48e('0x12')](_0xa48e('0x10'),auth[_0xa48e('0xc')](),controller[_0xa48e('0x13')]);module[_0xa48e('0x14')]=router; \ No newline at end of file +var _0x20c0=['destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','./whatsappTransferReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','put','delete'];(function(_0x8c78,_0x3b91c2){var _0x384510=function(_0x92d7a2){while(--_0x92d7a2){_0x8c78['push'](_0x8c78['shift']());}};_0x384510(++_0x3b91c2);}(_0x20c0,0x7f));var _0x020c=function(_0x1f56b1,_0x3df671){_0x1f56b1=_0x1f56b1-0x0;var _0x2f9cfa=_0x20c0[_0x1f56b1];return _0x2f9cfa;};'use strict';var multer=require(_0x020c('0x0'));var util=require(_0x020c('0x1'));var path=require(_0x020c('0x2'));var timeout=require(_0x020c('0x3'));var express=require('express');var router=express[_0x020c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x020c('0x5'));var config=require('../../config/environment');var controller=require(_0x020c('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x020c('0x7')]);router[_0x020c('0x8')](_0x020c('0x9'),auth[_0x020c('0xa')](),controller[_0x020c('0xb')]);router[_0x020c('0x8')](_0x020c('0xc'),auth['isAuthenticated'](),controller[_0x020c('0xd')]);router[_0x020c('0xe')]('/',auth[_0x020c('0xa')](),controller['create']);router[_0x020c('0xf')](_0x020c('0xc'),auth[_0x020c('0xa')](),controller['update']);router[_0x020c('0x10')](_0x020c('0xc'),auth['isAuthenticated'](),controller[_0x020c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 2c0d28d..71b7893 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 _0x2032=['agent','queue','exports','STRING','ENUM'];(function(_0x403016,_0x2d54b0){var _0x2f9d06=function(_0x269387){while(--_0x269387){_0x403016['push'](_0x403016['shift']());}};_0x2f9d06(++_0x2d54b0);}(_0x2032,0xd9));var _0x2203=function(_0x34ef3f,_0x30a7bb){_0x34ef3f=_0x34ef3f-0x0;var _0x14b17b=_0x2032[_0x34ef3f];return _0x14b17b;};'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 +var _0xbaf0=['ENUM','account','agent','queue','exports','STRING'];(function(_0x15734d,_0x39f330){var _0x5b48db=function(_0x3d32a2){while(--_0x3d32a2){_0x15734d['push'](_0x15734d['shift']());}};_0x5b48db(++_0x39f330);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'uniqueid':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0baf('0x2')](_0x0baf('0x3'),_0x0baf('0x4'),_0x0baf('0x5')),'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 0c3628b..a3f1566 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 _0xdf4c=['offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','WhatsappTransferReport','fieldName','key','query','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','rawAttributes','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count'];(function(_0x2ac42f,_0xb2a82b){var _0x18e18a=function(_0x11ccde){while(--_0x11ccde){_0x2ac42f['push'](_0x2ac42f['shift']());}};_0x18e18a(++_0xb2a82b);}(_0xdf4c,0x112));var _0xcdf4=function(_0x405f28,_0x3ea99f){_0x405f28=_0x405f28-0x0;var _0x1a6075=_0xdf4c[_0x405f28];return _0x1a6075;};'use strict';var emlformat=require(_0xcdf4('0x0'));var rimraf=require(_0xcdf4('0x1'));var zipdir=require(_0xcdf4('0x2'));var jsonpatch=require(_0xcdf4('0x3'));var rp=require(_0xcdf4('0x4'));var moment=require(_0xcdf4('0x5'));var BPromise=require(_0xcdf4('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcdf4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcdf4('0x8'));var _=require('lodash');var squel=require(_0xcdf4('0x9'));var crypto=require(_0xcdf4('0xa'));var jsforce=require(_0xcdf4('0xb'));var deskjs=require(_0xcdf4('0xc'));var toCsv=require(_0xcdf4('0x7'));var querystring=require('querystring');var Papa=require(_0xcdf4('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcdf4('0xe'));var as=require(_0xcdf4('0xf'));var hardwareService=require(_0xcdf4('0x10'));var logger=require(_0xcdf4('0x11'))(_0xcdf4('0x12'));var utils=require(_0xcdf4('0x13'));var config=require(_0xcdf4('0x14'));var licenseUtil=require(_0xcdf4('0x15'));var db=require(_0xcdf4('0x16'))['db'];function respondWithStatusCode(_0x275b51,_0xa5a690){_0xa5a690=_0xa5a690||0xcc;return function(_0x57ec18){if(_0x57ec18){return _0x275b51['sendStatus'](_0xa5a690);}return _0x275b51[_0xcdf4('0x17')](_0xa5a690)[_0xcdf4('0x18')]();};}function respondWithResult(_0x321399,_0xb0277c){_0xb0277c=_0xb0277c||0xc8;return function(_0x4f352){if(_0x4f352){return _0x321399[_0xcdf4('0x17')](_0xb0277c)['json'](_0x4f352);}};}function respondWithFilteredResult(_0x1f0d91,_0x2f46b4){return function(_0x14963c){if(_0x14963c){var _0x11cead=_0x14963c[_0xcdf4('0x19')],_0x423d52=_0x2f46b4[_0xcdf4('0x1a')],_0x5ec638=_0x2f46b4[_0xcdf4('0x1a')]+_0x2f46b4[_0xcdf4('0x1b')],_0x252c75;if(_0x5ec638>=_0x11cead){_0x5ec638=_0x11cead;_0x252c75=0xc8;}else{_0x252c75=0xce;}_0x1f0d91[_0xcdf4('0x17')](_0x252c75);return _0x1f0d91[_0xcdf4('0x1c')](_0xcdf4('0x1d'),_0x423d52+'-'+_0x5ec638+'/'+_0x11cead)[_0xcdf4('0x1e')](_0x14963c);}return null;};}function patchUpdates(_0xdefb41){return function(_0x436b35){try{jsonpatch[_0xcdf4('0x1f')](_0x436b35,_0xdefb41,!![]);}catch(_0x52171a){return BPromise[_0xcdf4('0x20')](_0x52171a);}return _0x436b35['save']();};}function saveUpdates(_0xc1caa6,_0x506f9b){return function(_0x5f310c){if(_0x5f310c){return _0x5f310c[_0xcdf4('0x21')](_0xc1caa6)[_0xcdf4('0x22')](function(_0x3b53e3){return _0x3b53e3;});}return null;};}function removeEntity(_0x5332fd,_0x259580){return function(_0x234138){if(_0x234138){return _0x234138[_0xcdf4('0x23')]()[_0xcdf4('0x22')](function(){_0x5332fd[_0xcdf4('0x17')](0xcc)[_0xcdf4('0x18')]();});}};}function handleEntityNotFound(_0x2f924d,_0x4395be){return function(_0x2b1650){if(!_0x2b1650){_0x2f924d[_0xcdf4('0x24')](0x194);}return _0x2b1650;};}function handleError(_0x67b71f,_0x1de7ed){_0x1de7ed=_0x1de7ed||0x1f4;return function(_0x57be39){logger[_0xcdf4('0x25')](_0x57be39[_0xcdf4('0x26')]);if(_0x57be39['name']){delete _0x57be39[_0xcdf4('0x27')];}_0x67b71f[_0xcdf4('0x17')](_0x1de7ed)[_0xcdf4('0x28')](_0x57be39);};}exports[_0xcdf4('0x29')]=function(_0x5a3c4b,_0x4a61a3){var _0x736ce4={},_0x44f80d={},_0x4525da={'count':0x0,'rows':[]};var _0x19c2ba=_[_0xcdf4('0x2a')](db[_0xcdf4('0x2b')]['rawAttributes'],function(_0x3ed3e1){return{'name':_0x3ed3e1[_0xcdf4('0x2c')],'type':_0x3ed3e1['type'][_0xcdf4('0x2d')]};});_0x44f80d['model']=_[_0xcdf4('0x2a')](_0x19c2ba,_0xcdf4('0x27'));_0x44f80d[_0xcdf4('0x2e')]=_['keys'](_0x5a3c4b[_0xcdf4('0x2e')]);_0x44f80d[_0xcdf4('0x2f')]=_[_0xcdf4('0x30')](_0x44f80d[_0xcdf4('0x31')],_0x44f80d['query']);_0x736ce4['attributes']=_[_0xcdf4('0x30')](_0x44f80d[_0xcdf4('0x31')],qs[_0xcdf4('0x32')](_0x5a3c4b[_0xcdf4('0x2e')][_0xcdf4('0x32')]));_0x736ce4[_0xcdf4('0x33')]=_0x736ce4[_0xcdf4('0x33')][_0xcdf4('0x34')]?_0x736ce4[_0xcdf4('0x33')]:_0x44f80d[_0xcdf4('0x31')];if(!_0x5a3c4b[_0xcdf4('0x2e')]['hasOwnProperty'](_0xcdf4('0x35'))){_0x736ce4[_0xcdf4('0x1b')]=qs[_0xcdf4('0x1b')](_0x5a3c4b[_0xcdf4('0x2e')]['limit']);_0x736ce4[_0xcdf4('0x1a')]=qs[_0xcdf4('0x1a')](_0x5a3c4b[_0xcdf4('0x2e')]['offset']);}_0x736ce4['order']=qs[_0xcdf4('0x36')](_0x5a3c4b[_0xcdf4('0x2e')]['sort']);_0x736ce4[_0xcdf4('0x37')]=qs[_0xcdf4('0x2f')](_[_0xcdf4('0x38')](_0x5a3c4b[_0xcdf4('0x2e')],_0x44f80d[_0xcdf4('0x2f')]),_0x19c2ba);if(_0x5a3c4b[_0xcdf4('0x2e')][_0xcdf4('0x39')]){_0x736ce4[_0xcdf4('0x37')]=_[_0xcdf4('0x3a')](_0x736ce4['where'],{'$or':_[_0xcdf4('0x2a')](_0x19c2ba,function(_0x18328d){if(_0x18328d[_0xcdf4('0x3b')]!==_0xcdf4('0x3c')){var _0x49c06c={};_0x49c06c[_0x18328d[_0xcdf4('0x27')]]={'$like':'%'+_0x5a3c4b['query'][_0xcdf4('0x39')]+'%'};return _0x49c06c;}})});}_0x736ce4=_[_0xcdf4('0x3a')]({},_0x736ce4,_0x5a3c4b[_0xcdf4('0x3d')]);var _0x4dad84={'where':_0x736ce4['where']};return db[_0xcdf4('0x2b')]['count'](_0x4dad84)[_0xcdf4('0x22')](function(_0x33d199){_0x4525da['count']=_0x33d199;if(_0x5a3c4b['query'][_0xcdf4('0x3e')]){_0x736ce4[_0xcdf4('0x3f')]=[{'all':!![]}];}return db[_0xcdf4('0x2b')][_0xcdf4('0x40')](_0x736ce4);})['then'](function(_0x44dcf7){_0x4525da[_0xcdf4('0x41')]=_0x44dcf7;return _0x4525da;})[_0xcdf4('0x22')](respondWithFilteredResult(_0x4a61a3,_0x736ce4))['catch'](handleError(_0x4a61a3,null));};exports[_0xcdf4('0x42')]=function(_0x277cc4,_0x23fbf8){var _0x27c190={'raw':!![],'where':{'id':_0x277cc4['params']['id']}},_0x15e8b9={};_0x15e8b9[_0xcdf4('0x31')]=_[_0xcdf4('0x43')](db['WhatsappTransferReport'][_0xcdf4('0x44')]);_0x15e8b9[_0xcdf4('0x2e')]=_[_0xcdf4('0x43')](_0x277cc4['query']);_0x15e8b9[_0xcdf4('0x2f')]=_['intersection'](_0x15e8b9[_0xcdf4('0x31')],_0x15e8b9[_0xcdf4('0x2e')]);_0x27c190[_0xcdf4('0x33')]=_[_0xcdf4('0x30')](_0x15e8b9['model'],qs[_0xcdf4('0x32')](_0x277cc4['query'][_0xcdf4('0x32')]));_0x27c190[_0xcdf4('0x33')]=_0x27c190[_0xcdf4('0x33')][_0xcdf4('0x34')]?_0x27c190[_0xcdf4('0x33')]:_0x15e8b9[_0xcdf4('0x31')];if(_0x277cc4[_0xcdf4('0x2e')][_0xcdf4('0x3e')]){_0x27c190[_0xcdf4('0x3f')]=[{'all':!![]}];}_0x27c190=_[_0xcdf4('0x3a')]({},_0x27c190,_0x277cc4['options']);return db[_0xcdf4('0x2b')][_0xcdf4('0x45')](_0x27c190)[_0xcdf4('0x22')](handleEntityNotFound(_0x23fbf8,null))[_0xcdf4('0x22')](respondWithResult(_0x23fbf8,null))[_0xcdf4('0x46')](handleError(_0x23fbf8,null));};exports[_0xcdf4('0x47')]=function(_0x56eaa9,_0x4648c0){return db[_0xcdf4('0x2b')][_0xcdf4('0x47')](_0x56eaa9['body'],{})[_0xcdf4('0x22')](respondWithResult(_0x4648c0,0xc9))[_0xcdf4('0x46')](handleError(_0x4648c0,null));};exports[_0xcdf4('0x21')]=function(_0x3c6fd3,_0x4ddf9e){if(_0x3c6fd3['body']['id']){delete _0x3c6fd3[_0xcdf4('0x48')]['id'];}return db['WhatsappTransferReport'][_0xcdf4('0x45')]({'where':{'id':_0x3c6fd3[_0xcdf4('0x49')]['id']}})[_0xcdf4('0x22')](handleEntityNotFound(_0x4ddf9e,null))['then'](saveUpdates(_0x3c6fd3[_0xcdf4('0x48')],null))[_0xcdf4('0x22')](respondWithResult(_0x4ddf9e,null))[_0xcdf4('0x46')](handleError(_0x4ddf9e,null));};exports[_0xcdf4('0x23')]=function(_0x2155e3,_0x2b73ec){return db[_0xcdf4('0x2b')]['find']({'where':{'id':_0x2155e3[_0xcdf4('0x49')]['id']}})['then'](handleEntityNotFound(_0x2b73ec,null))[_0xcdf4('0x22')](removeEntity(_0x2b73ec,null))[_0xcdf4('0x46')](handleError(_0x2b73ec,null));};exports[_0xcdf4('0x4a')]=function(_0x3eb215,_0x15a103){return db['WhatsappTransferReport']['describe']()['then'](respondWithResult(_0x15a103,null))['catch'](handleError(_0x15a103,null));}; \ No newline at end of file +var _0xf3d7=['params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','include','options','find','create','body'];(function(_0x5c52c4,_0x3c23fb){var _0x58b622=function(_0xe93e54){while(--_0xe93e54){_0x5c52c4['push'](_0x5c52c4['shift']());}};_0x58b622(++_0x3c23fb);}(_0xf3d7,0x192));var _0x7f3d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xf3d7[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x7f3d('0x0'));var rimraf=require(_0x7f3d('0x1'));var zipdir=require(_0x7f3d('0x2'));var jsonpatch=require(_0x7f3d('0x3'));var rp=require(_0x7f3d('0x4'));var moment=require(_0x7f3d('0x5'));var BPromise=require(_0x7f3d('0x6'));var Mustache=require(_0x7f3d('0x7'));var util=require(_0x7f3d('0x8'));var path=require(_0x7f3d('0x9'));var sox=require(_0x7f3d('0xa'));var csv=require(_0x7f3d('0xb'));var ejs=require(_0x7f3d('0xc'));var fs=require('fs');var fs_extra=require(_0x7f3d('0xd'));var _=require(_0x7f3d('0xe'));var squel=require('squel');var crypto=require(_0x7f3d('0xf'));var jsforce=require(_0x7f3d('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7f3d('0x11'));var Papa=require(_0x7f3d('0x12'));var Redis=require(_0x7f3d('0x13'));var authService=require(_0x7f3d('0x14'));var qs=require(_0x7f3d('0x15'));var as=require(_0x7f3d('0x16'));var hardwareService=require(_0x7f3d('0x17'));var logger=require(_0x7f3d('0x18'))('api');var utils=require(_0x7f3d('0x19'));var config=require(_0x7f3d('0x1a'));var licenseUtil=require(_0x7f3d('0x1b'));var db=require(_0x7f3d('0x1c'))['db'];function respondWithStatusCode(_0x4afaed,_0x1be602){_0x1be602=_0x1be602||0xcc;return function(_0x920ade){if(_0x920ade){return _0x4afaed[_0x7f3d('0x1d')](_0x1be602);}return _0x4afaed[_0x7f3d('0x1e')](_0x1be602)[_0x7f3d('0x1f')]();};}function respondWithResult(_0x2a2214,_0x4b74f5){_0x4b74f5=_0x4b74f5||0xc8;return function(_0x27f9af){if(_0x27f9af){return _0x2a2214[_0x7f3d('0x1e')](_0x4b74f5)[_0x7f3d('0x20')](_0x27f9af);}};}function respondWithFilteredResult(_0x170d08,_0x396e40){return function(_0x165b88){if(_0x165b88){var _0x237855=_0x165b88[_0x7f3d('0x21')],_0x83fc64=_0x396e40['offset'],_0x3ac29d=_0x396e40[_0x7f3d('0x22')]+_0x396e40['limit'],_0x3a9a06;if(_0x3ac29d>=_0x237855){_0x3ac29d=_0x237855;_0x3a9a06=0xc8;}else{_0x3a9a06=0xce;}_0x170d08[_0x7f3d('0x1e')](_0x3a9a06);return _0x170d08[_0x7f3d('0x23')](_0x7f3d('0x24'),_0x83fc64+'-'+_0x3ac29d+'/'+_0x237855)[_0x7f3d('0x20')](_0x165b88);}return null;};}function patchUpdates(_0x4acc87){return function(_0x2f0d77){try{jsonpatch[_0x7f3d('0x25')](_0x2f0d77,_0x4acc87,!![]);}catch(_0x4bf3a0){return BPromise[_0x7f3d('0x26')](_0x4bf3a0);}return _0x2f0d77[_0x7f3d('0x27')]();};}function saveUpdates(_0x3db262,_0x26859a){return function(_0x1ef670){if(_0x1ef670){return _0x1ef670[_0x7f3d('0x28')](_0x3db262)[_0x7f3d('0x29')](function(_0x2db3f6){return _0x2db3f6;});}return null;};}function removeEntity(_0xe05460,_0x44f137){return function(_0x1a30b4){if(_0x1a30b4){return _0x1a30b4[_0x7f3d('0x2a')]()[_0x7f3d('0x29')](function(){_0xe05460[_0x7f3d('0x1e')](0xcc)[_0x7f3d('0x1f')]();});}};}function handleEntityNotFound(_0x6c7d2d,_0x798754){return function(_0x1fd5f8){if(!_0x1fd5f8){_0x6c7d2d[_0x7f3d('0x1d')](0x194);}return _0x1fd5f8;};}function handleError(_0x4217a5,_0xe05174){_0xe05174=_0xe05174||0x1f4;return function(_0x141fa8){logger[_0x7f3d('0x2b')](_0x141fa8[_0x7f3d('0x2c')]);if(_0x141fa8[_0x7f3d('0x2d')]){delete _0x141fa8[_0x7f3d('0x2d')];}_0x4217a5['status'](_0xe05174)['send'](_0x141fa8);};}exports['index']=function(_0xb3fa21,_0x22e211){var _0x47c0ea={},_0x46f856={},_0x3b977c={'count':0x0,'rows':[]};var _0x2183d6=_[_0x7f3d('0x2e')](db[_0x7f3d('0x2f')][_0x7f3d('0x30')],function(_0x224e18){return{'name':_0x224e18[_0x7f3d('0x31')],'type':_0x224e18[_0x7f3d('0x32')][_0x7f3d('0x33')]};});_0x46f856[_0x7f3d('0x34')]=_[_0x7f3d('0x2e')](_0x2183d6,_0x7f3d('0x2d'));_0x46f856[_0x7f3d('0x35')]=_[_0x7f3d('0x36')](_0xb3fa21['query']);_0x46f856[_0x7f3d('0x37')]=_[_0x7f3d('0x38')](_0x46f856[_0x7f3d('0x34')],_0x46f856[_0x7f3d('0x35')]);_0x47c0ea[_0x7f3d('0x39')]=_['intersection'](_0x46f856[_0x7f3d('0x34')],qs[_0x7f3d('0x3a')](_0xb3fa21[_0x7f3d('0x35')][_0x7f3d('0x3a')]));_0x47c0ea[_0x7f3d('0x39')]=_0x47c0ea[_0x7f3d('0x39')][_0x7f3d('0x3b')]?_0x47c0ea[_0x7f3d('0x39')]:_0x46f856[_0x7f3d('0x34')];if(!_0xb3fa21[_0x7f3d('0x35')]['hasOwnProperty'](_0x7f3d('0x3c'))){_0x47c0ea[_0x7f3d('0x3d')]=qs[_0x7f3d('0x3d')](_0xb3fa21[_0x7f3d('0x35')]['limit']);_0x47c0ea['offset']=qs[_0x7f3d('0x22')](_0xb3fa21[_0x7f3d('0x35')][_0x7f3d('0x22')]);}_0x47c0ea['order']=qs[_0x7f3d('0x3e')](_0xb3fa21[_0x7f3d('0x35')][_0x7f3d('0x3e')]);_0x47c0ea[_0x7f3d('0x3f')]=qs[_0x7f3d('0x37')](_[_0x7f3d('0x40')](_0xb3fa21[_0x7f3d('0x35')],_0x46f856[_0x7f3d('0x37')]),_0x2183d6);if(_0xb3fa21[_0x7f3d('0x35')][_0x7f3d('0x41')]){_0x47c0ea[_0x7f3d('0x3f')]=_[_0x7f3d('0x42')](_0x47c0ea['where'],{'$or':_[_0x7f3d('0x2e')](_0x2183d6,function(_0x39ffa2){if(_0x39ffa2[_0x7f3d('0x32')]!==_0x7f3d('0x43')){var _0x570a80={};_0x570a80[_0x39ffa2[_0x7f3d('0x2d')]]={'$like':'%'+_0xb3fa21[_0x7f3d('0x35')][_0x7f3d('0x41')]+'%'};return _0x570a80;}})});}_0x47c0ea=_[_0x7f3d('0x42')]({},_0x47c0ea,_0xb3fa21['options']);var _0x5ef95c={'where':_0x47c0ea[_0x7f3d('0x3f')]};return db[_0x7f3d('0x2f')]['count'](_0x5ef95c)['then'](function(_0x4d69b2){_0x3b977c[_0x7f3d('0x21')]=_0x4d69b2;if(_0xb3fa21[_0x7f3d('0x35')][_0x7f3d('0x44')]){_0x47c0ea['include']=[{'all':!![]}];}return db[_0x7f3d('0x2f')][_0x7f3d('0x45')](_0x47c0ea);})['then'](function(_0x440c9e){_0x3b977c[_0x7f3d('0x46')]=_0x440c9e;return _0x3b977c;})[_0x7f3d('0x29')](respondWithFilteredResult(_0x22e211,_0x47c0ea))[_0x7f3d('0x47')](handleError(_0x22e211,null));};exports[_0x7f3d('0x48')]=function(_0x4bbf08,_0xd0e108){var _0x49cfda={'raw':!![],'where':{'id':_0x4bbf08['params']['id']}},_0x1b3e6c={};_0x1b3e6c[_0x7f3d('0x34')]=_['keys'](db['WhatsappTransferReport'][_0x7f3d('0x30')]);_0x1b3e6c[_0x7f3d('0x35')]=_['keys'](_0x4bbf08['query']);_0x1b3e6c[_0x7f3d('0x37')]=_[_0x7f3d('0x38')](_0x1b3e6c['model'],_0x1b3e6c[_0x7f3d('0x35')]);_0x49cfda['attributes']=_[_0x7f3d('0x38')](_0x1b3e6c['model'],qs[_0x7f3d('0x3a')](_0x4bbf08[_0x7f3d('0x35')][_0x7f3d('0x3a')]));_0x49cfda[_0x7f3d('0x39')]=_0x49cfda[_0x7f3d('0x39')][_0x7f3d('0x3b')]?_0x49cfda[_0x7f3d('0x39')]:_0x1b3e6c[_0x7f3d('0x34')];if(_0x4bbf08[_0x7f3d('0x35')][_0x7f3d('0x44')]){_0x49cfda[_0x7f3d('0x49')]=[{'all':!![]}];}_0x49cfda=_[_0x7f3d('0x42')]({},_0x49cfda,_0x4bbf08[_0x7f3d('0x4a')]);return db['WhatsappTransferReport'][_0x7f3d('0x4b')](_0x49cfda)[_0x7f3d('0x29')](handleEntityNotFound(_0xd0e108,null))[_0x7f3d('0x29')](respondWithResult(_0xd0e108,null))['catch'](handleError(_0xd0e108,null));};exports[_0x7f3d('0x4c')]=function(_0x5d0426,_0x340d19){return db[_0x7f3d('0x2f')]['create'](_0x5d0426[_0x7f3d('0x4d')],{})['then'](respondWithResult(_0x340d19,0xc9))[_0x7f3d('0x47')](handleError(_0x340d19,null));};exports['update']=function(_0x255941,_0x4f9773){if(_0x255941[_0x7f3d('0x4d')]['id']){delete _0x255941[_0x7f3d('0x4d')]['id'];}return db['WhatsappTransferReport'][_0x7f3d('0x4b')]({'where':{'id':_0x255941[_0x7f3d('0x4e')]['id']}})[_0x7f3d('0x29')](handleEntityNotFound(_0x4f9773,null))[_0x7f3d('0x29')](saveUpdates(_0x255941[_0x7f3d('0x4d')],null))[_0x7f3d('0x29')](respondWithResult(_0x4f9773,null))['catch'](handleError(_0x4f9773,null));};exports[_0x7f3d('0x2a')]=function(_0x3eaad2,_0x42c6ed){return db[_0x7f3d('0x2f')][_0x7f3d('0x4b')]({'where':{'id':_0x3eaad2[_0x7f3d('0x4e')]['id']}})[_0x7f3d('0x29')](handleEntityNotFound(_0x42c6ed,null))[_0x7f3d('0x29')](removeEntity(_0x42c6ed,null))[_0x7f3d('0x47')](handleError(_0x42c6ed,null));};exports[_0x7f3d('0x4f')]=function(_0x2338f6,_0x109940){return db[_0x7f3d('0x2f')]['describe']()[_0x7f3d('0x29')](respondWithResult(_0x109940,null))['catch'](handleError(_0x109940,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 572a660..9334b81 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 _0x8ef6=['../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','api','request-promise','path','rimraf'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8ef6,0x19e));var _0x68ef=function(_0x3e2520,_0x346b7f){_0x3e2520=_0x3e2520-0x0;var _0x4bd18a=_0x8ef6[_0x3e2520];return _0x4bd18a;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require('../../config/logger')(_0x68ef('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x68ef('0x3'));var fs=require('fs');var path=require(_0x68ef('0x4'));var rimraf=require(_0x68ef('0x5'));var config=require(_0x68ef('0x6'));var attributes=require(_0x68ef('0x7'));module['exports']=function(_0x5c8060,_0x1c2234){return _0x5c8060[_0x68ef('0x8')](_0x68ef('0x9'),attributes,{'tableName':_0x68ef('0xa'),'paranoid':![],'indexes':[{'name':_0x68ef('0xb'),'fields':[_0x68ef('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x049b=['bluebird','request-promise','rimraf','../../config/environment','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x2cd2c4,_0x154bf4){var _0x5a5821=function(_0x35d2f0){while(--_0x35d2f0){_0x2cd2c4['push'](_0x2cd2c4['shift']());}};_0x5a5821(++_0x154bf4);}(_0x049b,0x167));var _0xb049=function(_0x51e931,_0x31ab2f){_0x51e931=_0x51e931-0x0;var _0xe87f7d=_0x049b[_0x51e931];return _0xe87f7d;};'use strict';var _=require(_0xb049('0x0'));var util=require(_0xb049('0x1'));var logger=require(_0xb049('0x2'))(_0xb049('0x3'));var moment=require(_0xb049('0x4'));var BPromise=require(_0xb049('0x5'));var rp=require(_0xb049('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb049('0x7'));var config=require(_0xb049('0x8'));var attributes=require('./whatsappTransferReport.attributes');module[_0xb049('0x9')]=function(_0x22f9a0,_0x21913a){return _0x22f9a0[_0xb049('0xa')](_0xb049('0xb'),attributes,{'tableName':_0xb049('0xc'),'paranoid':![],'indexes':[{'name':_0xb049('0xd'),'fields':[_0xb049('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index cf6b678..d7afcf7 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(_0x2be955,_0x2b2fef){var _0x354000=function(_0x28e688){while(--_0x28e688){_0x2be955['push'](_0x2be955['shift']());}};_0x354000(++_0x2b2fef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x285d79,_0x5520c6){var _0x1a5109=function(_0x268c20){while(--_0x268c20){_0x285d79['push'](_0x285d79['shift']());}};_0x1a5109(++_0x5520c6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 6e09dac..d61440c 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb982=['./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sync','then','listen','info','start','Online\x20apps:','map','filter','online','name','join','Offline\x20apps:','status','None','seedDB','default','catch','./rpc'];(function(_0x4efbfa,_0x414762){var _0x15f96a=function(_0x48ed29){while(--_0x48ed29){_0x4efbfa['push'](_0x4efbfa['shift']());}};_0x15f96a(++_0x414762);}(_0xb982,0x15e));var _0x2b98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb982[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var mysqldb=require('./mysqldb');var rpc=require(_0x2b98('0x0'));var config=require(_0x2b98('0x1'));var logger=require(_0x2b98('0x2'))(_0x2b98('0x3'));var pm2=require(_0x2b98('0x4'));var pm2Config=require(_0x2b98('0x5'));var schedule=require(_0x2b98('0x6'));var chat=require(_0x2b98('0x7'));var whatsapp=require(_0x2b98('0x8'));var transcribe=require(_0x2b98('0x9'));function main(){return mysqldb['db']['sequelize'][_0x2b98('0xa')]()[_0x2b98('0xb')](function(){return rpc[_0x2b98('0xc')]();})[_0x2b98('0xb')](function(_0x3a6bad){logger[_0x2b98('0xd')](_0x3a6bad);return chat['start']();})[_0x2b98('0xb')](function(){return whatsapp[_0x2b98('0xe')]();})['then'](function(){return schedule[_0x2b98('0xe')]();})['then'](function(){return transcribe[_0x2b98('0xe')]();})[_0x2b98('0xb')](function(_0x457b35){logger[_0x2b98('0xd')](_0x457b35);return pm2[_0x2b98('0xe')](pm2Config);})['then'](function(_0x3a2759){logger['info'](_0x2b98('0xf'),_[_0x2b98('0x10')](_[_0x2b98('0x11')](_0x3a2759,{'status':_0x2b98('0x12')}),_0x2b98('0x13'))[_0x2b98('0x14')]());logger['info'](_0x2b98('0x15'),_[_0x2b98('0x10')](_[_0x2b98('0x11')](_0x3a2759,function(_0x24b8e5){return _0x24b8e5[_0x2b98('0x16')]!==_0x2b98('0x12');}),_0x2b98('0x13'))['join']()||_0x2b98('0x17'));config[_0x2b98('0x18')]&&require('./config/seedDB')[_0x2b98('0x19')]();require('./config/license')[_0x2b98('0x19')]();})[_0x2b98('0x1a')](function(_0x2641fa){logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x2641fa);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x4325=['seedDB','default','./config/license','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/environment','./config/logger','app','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sequelize','sync','listen','info','start','then','map','filter','online','name','join','status'];(function(_0x343090,_0x433a80){var _0x3ff3e8=function(_0x16c811){while(--_0x16c811){_0x343090['push'](_0x343090['shift']());}};_0x3ff3e8(++_0x433a80);}(_0x4325,0x1da));var _0x5432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4325[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5432('0x0'));var mysqldb=require(_0x5432('0x1'));var rpc=require('./rpc');var config=require(_0x5432('0x2'));var logger=require(_0x5432('0x3'))(_0x5432('0x4'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0x5432('0x5'));var chat=require(_0x5432('0x6'));var whatsapp=require(_0x5432('0x7'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x5432('0x8')][_0x5432('0x9')]()['then'](function(){return rpc[_0x5432('0xa')]();})['then'](function(_0xc8252e){logger[_0x5432('0xb')](_0xc8252e);return chat[_0x5432('0xc')]();})[_0x5432('0xd')](function(){return whatsapp[_0x5432('0xc')]();})['then'](function(){return schedule[_0x5432('0xc')]();})['then'](function(){return transcribe[_0x5432('0xc')]();})[_0x5432('0xd')](function(_0x3dfa4){logger[_0x5432('0xb')](_0x3dfa4);return pm2['start'](pm2Config);})['then'](function(_0x11b25c){logger[_0x5432('0xb')]('Online\x20apps:',_[_0x5432('0xe')](_[_0x5432('0xf')](_0x11b25c,{'status':_0x5432('0x10')}),_0x5432('0x11'))[_0x5432('0x12')]());logger[_0x5432('0xb')]('Offline\x20apps:',_['map'](_[_0x5432('0xf')](_0x11b25c,function(_0x44e70c){return _0x44e70c[_0x5432('0x13')]!==_0x5432('0x10');}),_0x5432('0x11'))[_0x5432('0x12')]()||'None');config[_0x5432('0x14')]&&require('./config/seedDB')[_0x5432('0x15')]();require(_0x5432('0x16'))[_0x5432('0x15')]();})[_0x5432('0x17')](function(_0x4221a8){logger['error'](_0x5432('0x18'),_0x4221a8);process[_0x5432('0x19')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 92c5eb6..10e0b82 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 _0x26bd=['nonce','disabled','Invalid\x20API\x20access\x20key','blocked','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','redirect','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','length','splice','encryptString','join','promisify','sign','secret','options','verify','randomBytes','hex','floor','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','crypto','util','moment','secrets','session','fullname','name','internal','email','userpic','permissions','voicePause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','hotdesk','interface','userProfileId','privacyEnabled','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','closed','disposition','then','json','unmanaged','Unmanaged.','Forbidden.','headers','authorization','startsWith','Basic','User','find','authenticate','status','Wrong\x20credentials.','user','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','blockDuration','isEqual','apiKeyNonce'];(function(_0x2ab350,_0x32859f){var _0x4acac=function(_0x58ddc6){while(--_0x58ddc6){_0x2ab350['push'](_0x2ab350['shift']());}};_0x4acac(++_0x32859f);}(_0x26bd,0xaa));var _0xd26b=function(_0x2c51aa,_0x19485f){_0x2c51aa=_0x2c51aa-0x0;var _0x3bda66=_0x26bd[_0x2c51aa];return _0x3bda66;};'use strict';var db=require(_0xd26b('0x0'))['db'];var config=require(_0xd26b('0x1'));var hardwareConf=require(_0xd26b('0x2'));var licenseUtil=require(_0xd26b('0x3'));var encryptor=require(_0xd26b('0x4'));var _=require(_0xd26b('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xd26b('0x6'));var compose=require(_0xd26b('0x7'));var basicAuth=require(_0xd26b('0x8'));var crypto=require(_0xd26b('0x9'));var BPromise=require('bluebird');var util=require(_0xd26b('0xa'));var moment=require(_0xd26b('0xb'));var validateJwt=expressJwt({'secret':config[_0xd26b('0xc')][_0xd26b('0xd')]});var userAttributes=['id','role',_0xd26b('0xe'),_0xd26b('0xf'),_0xd26b('0x10'),_0xd26b('0x11'),_0xd26b('0x12'),_0xd26b('0x13'),'md5secret',_0xd26b('0x14'),'chatPause',_0xd26b('0x15'),_0xd26b('0x16'),_0xd26b('0x17'),_0xd26b('0x18'),_0xd26b('0x19'),_0xd26b('0x1a'),_0xd26b('0x1b'),_0xd26b('0x1c'),_0xd26b('0x1d'),'allowmessenger',_0xd26b('0x1e'),_0xd26b('0x1f'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0xd26b('0x20'),_0xd26b('0x21'),_0xd26b('0x22'),_0xd26b('0x23'),_0xd26b('0x24'),'phoneBarPrefixRequired',_0xd26b('0x25'),'phoneBarRemoteControlPort',_0xd26b('0x26'),_0xd26b('0x27'),_0xd26b('0x28'),_0xd26b('0x29'),'settingsEnabled'];exports[_0xd26b('0x2a')]=function(){return this[_0xd26b('0x2b')](!![])[_0xd26b('0x2c')](function(_0x1bc091,_0x27b973,_0x24da5d){if(_0x1bc091['user']){_0x24da5d();}else{return db[_0xd26b('0x2d')][_0xd26b('0x2e')]({'where':{'id':_0x1bc091[_0xd26b('0x2f')]['id']},'attributes':['id',_0xd26b('0x30'),_0xd26b('0x31')],'raw':!![]})[_0xd26b('0x32')](function(_0x28496e){if(_0x28496e&&_0x28496e[_0xd26b('0x30')]){return _0x27b973['status'](_0x28496e[_0xd26b('0x31')]==='unmanaged'?0x195:0x193)[_0xd26b('0x33')]({'message':_0x28496e[_0xd26b('0x31')]===_0xd26b('0x34')?_0xd26b('0x35'):_0xd26b('0x36')});}else{_0x24da5d();}})['catch'](function(_0x5db4e3){_0x24da5d(_0x5db4e3);});}});};exports[_0xd26b('0x2b')]=function isAuthenticated(_0x46282f){return compose()[_0xd26b('0x2c')](function(_0x369654,_0x16e731,_0x23c933){var _0xd91bca;if(_0x369654[_0xd26b('0x37')][_0xd26b('0x38')]){if(_[_0xd26b('0x39')](_0x369654[_0xd26b('0x37')][_0xd26b('0x38')],_0xd26b('0x3a'))){var _0x5ba508=basicAuth(_0x369654);db[_0xd26b('0x3b')][_0xd26b('0x3c')]({'where':{'name':_0x5ba508[_0xd26b('0xf')]}})['then'](function(_0x2cdfb6){if(!_0x2cdfb6||!_0x2cdfb6[_0xd26b('0x3d')](_0x5ba508['pass'])){return _0x16e731[_0xd26b('0x3e')](0x191)['json']({'message':_0xd26b('0x3f')});}_0x369654[_0xd26b('0x40')]={'id':_0x2cdfb6['id']};_0x23c933();})[_0xd26b('0x41')](function(_0x55e491){_0x23c933(_0x55e491);});}else if(_[_0xd26b('0x39')](_0x369654[_0xd26b('0x37')][_0xd26b('0x38')],_0xd26b('0x42'))){validateJwt(_0x369654,_0x16e731,_0x23c933);}else{if(_0x46282f){_0x23c933();}else{return _0x16e731[_0xd26b('0x3e')](0x193)[_0xd26b('0x33')]({'message':_0xd26b('0x43')});}}}else if(_0x369654[_0xd26b('0x44')][_0xd26b('0x45')]){try{var _0x3a86f7={'audience':hardwareConf[_0xd26b('0x46')](),'issuer':hardwareConf[_0xd26b('0x46')]()};verifyJwt(_0x369654[_0xd26b('0x44')][_0xd26b('0x45')],_0x3a86f7)['then'](function(_0x3851f3){return db[_0xd26b('0x3b')]['find']({'where':{'id':_0x3851f3[_0xd26b('0x47')]}})[_0xd26b('0x32')](function(_0x4460b1){_0xd91bca=_0x4460b1;return db[_0xd26b('0x48')][_0xd26b('0x2e')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xd26b('0x49')],'raw':!![]});})['then'](function(_0xe2af03){if(!_0xd91bca||!_[_0xd26b('0x4a')](_0xd91bca[_0xd26b('0x4b')],_0x3851f3[_0xd26b('0x4c')])){return _0x16e731[_0xd26b('0x3e')](0x191)[_0xd26b('0x33')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0xd91bca[_0xd26b('0x4d')]){return _0x16e731[_0xd26b('0x3e')](0x191)[_0xd26b('0x33')]({'message':_0xd26b('0x4e')});}if(_0xd91bca[_0xd26b('0x4f')]){if(_0xe2af03[_0xd26b('0x49')]>0x0){if(moment(_0xd91bca['blockedAt'])[_0xd26b('0x50')](_0xe2af03[_0xd26b('0x49')],_0xd26b('0x51'))>moment()){return _0x16e731[_0xd26b('0x3e')](0x191)[_0xd26b('0x33')]({'message':_0xd26b('0x4e')});}}else{return _0x16e731['status'](0x191)[_0xd26b('0x33')]({'message':_0xd26b('0x4e')});}}_0x369654[_0xd26b('0x40')]={'id':_0xd91bca['id']};_0x23c933();});})[_0xd26b('0x41')](function(){return _0x16e731['status'](0x191)[_0xd26b('0x33')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x4499aa){_0x23c933(_0x4499aa);}}else if(_0x46282f){_0x23c933();}else{return _0x16e731[_0xd26b('0x3e')](0x193)[_0xd26b('0x33')]({'message':_0xd26b('0x43')});}})[_0xd26b('0x2c')](function(_0x2213c3,_0x5f7947,_0x51af16){if(_0x2213c3[_0xd26b('0x40')]){db[_0xd26b('0x3b')][_0xd26b('0x3c')]({'where':{'id':_0x2213c3[_0xd26b('0x40')]['id']},'attributes':userAttributes})[_0xd26b('0x32')](function(_0x502a42){if(!_0x502a42){return _0x5f7947['status'](0x194)[_0xd26b('0x33')]({'message':_0xd26b('0x52')});}_0x2213c3['user']=_0x502a42;_0x51af16();})[_0xd26b('0x41')](function(_0x11197f){_0x51af16(_0x11197f);});}else if(_0x46282f){_0x51af16();}else{return _0x5f7947[_0xd26b('0x3e')](0x194)[_0xd26b('0x33')]({'message':_0xd26b('0x53')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x3c359e,_0x39b2f3,_0x4795c1){return licenseUtil[_0xd26b('0x54')]()[_0xd26b('0x32')](function(_0x3cfb71){if(_0x3cfb71['update']){_0x4795c1();}else{return _0x39b2f3['status'](0x193)[_0xd26b('0x33')]({'message':_0xd26b('0x55')});}})[_0xd26b('0x41')](function(_0x12b05c){_0x4795c1(_0x12b05c);});});};exports['isMiddleware']=function(_0x2df279,_0x4ce1a3,_0x3f759f){_0x2df279[_0xd26b('0x56')]=!![];return _0x3f759f();};exports[_0xd26b('0x57')]=function signToken(_0xb8f9b0){return signJwt(_0xb8f9b0);};exports[_0xd26b('0x58')]=function(_0x4ab186,_0x392cfb){if(!_0x4ab186[_0xd26b('0x40')]){return _0x392cfb[_0xd26b('0x3e')](0x194)[_0xd26b('0x33')]({'message':_0xd26b('0x59')});}var _0x2f1e9e={'payload':{'id':_0x4ab186['user']['id'],'role':_0x4ab186[_0xd26b('0x40')][_0xd26b('0x5a')]},'options':{'expiresIn':0x15180}};return signJwt(_0x2f1e9e)[_0xd26b('0x32')](function(_0x108fbc){_0x392cfb['cookie']('motion.token',_0x108fbc);_0x392cfb[_0xd26b('0x5b')](_0xd26b('0x5c'));})[_0xd26b('0x41')](function(_0x20fb85){return _0x392cfb[_0xd26b('0x3e')](0x1f4)[_0xd26b('0x5d')](_0x20fb85);});};exports['retrieveApiKey']=function(_0x686a66){if(_[_0xd26b('0x5e')](_0x686a66[_0xd26b('0x4b')])||_[_0xd26b('0x5e')](_0x686a66[_0xd26b('0x5f')])){return null;}else{return createJwt(_0x686a66);}};exports[_0xd26b('0x60')]=function(_0x567c48){_0x567c48[_0xd26b('0x4b')]=generateNonce();_0x567c48[_0xd26b('0x5f')]=generateIssuedAt();return createJwt(_0x567c48);};exports[_0xd26b('0x61')]=function(_0x1b3005,_0x18d9a5){var _0x891061=_0x1b3005[_0xd26b('0x44')][_0xd26b('0x45')];if(_0x891061){var _0x4e4e69={'nonce':_0x18d9a5['apiKeyNonce'],'iat':_0x18d9a5['apiKeyIat'],'audience':hardwareConf[_0xd26b('0x46')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x891061,_0x4e4e69)[_0xd26b('0x32')](function(){return generateApiKey(_0x18d9a5);});}else{throw{'message':_0xd26b('0x62')};}};exports['validatePasswordPattern']=function(_0x1604c7){var _0x11f716=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x11f716[_0xd26b('0x63')](_0x1604c7))throw new db[(_0xd26b('0x64'))][(_0xd26b('0x65'))](_0xd26b('0x66'));return;};exports['validatePasswordHistory']=function(_0x4e7009,_0x256ca8,_0x1cb259){var _0x21717c=encryptor[_0xd26b('0x67')](_0x256ca8)['split'](',');for(var _0x8dab2e=0x0;_0x8dab2e<_0x1cb259;_0x8dab2e++){if(!_0x21717c[_0x8dab2e])break;if(_0x4e7009['toLowerCase']()===_0x21717c[_0x8dab2e]['toLowerCase']()){var _0x4c5a93=util[_0xd26b('0x68')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x1cb259);if(_0x1cb259===0x1){_0x4c5a93=_0xd26b('0x69');}throw new db[(_0xd26b('0x64'))][(_0xd26b('0x65'))](_0x4c5a93);}}return;};exports[_0xd26b('0x6a')]=function(_0x5a5709,_0x3436f5){var _0x93384a=_0x3436f5?encryptor['decryptString'](_0x3436f5)[_0xd26b('0x6b')](','):[];if(_0x93384a[_0xd26b('0x6c')]===0x5){_0x93384a[_0xd26b('0x6d')](-0x1,0x1);}_0x93384a['unshift'](_0x5a5709);return encryptor[_0xd26b('0x6e')](_0x93384a[_0xd26b('0x6f')](','));};function signJwt(_0x44ad94){var _0x2cf835=BPromise[_0xd26b('0x70')](jwt[_0xd26b('0x71')],{'context':jwt});var _0xdfe8f9=_0x44ad94[_0xd26b('0x72')]||config[_0xd26b('0xc')][_0xd26b('0xd')];return new BPromise(function(_0x3a3d37,_0x3197e2){_0x2cf835(_0x44ad94['payload'],_0xdfe8f9,_0x44ad94[_0xd26b('0x73')])[_0xd26b('0x32')](function(_0x14ff6c){_0x3a3d37(_0x14ff6c);})[_0xd26b('0x41')](function(_0x46e194){_0x3197e2(_0x46e194);});});}function verifyJwt(_0x59e936,_0x285e16,_0x4ec0bc){var _0x146720=BPromise['promisify'](jwt[_0xd26b('0x74')],{'context':jwt});var _0x446da4=_0x4ec0bc||config[_0xd26b('0xc')][_0xd26b('0xd')];return new BPromise(function(_0x106f63,_0x17ecbb){_0x146720(_0x59e936,_0x446da4,_0x285e16)[_0xd26b('0x32')](function(_0x1ff40a){_0x106f63(_0x1ff40a);})['catch'](function(_0x24a256){_0x17ecbb(_0x24a256);});});}function generateNonce(){return crypto[_0xd26b('0x75')](0x10)['toString'](_0xd26b('0x76'));}function generateIssuedAt(){return Math[_0xd26b('0x77')](Date[_0xd26b('0x78')]()/0x3e8)[_0xd26b('0x79')]();}function createJwt(_0x41ec1c){var _0x498061={'payload':{'iat':_0x41ec1c['apiKeyIat'],'nonce':_0x41ec1c[_0xd26b('0x4b')]},'options':{'algorithm':_0xd26b('0x7a'),'subject':_0x41ec1c['id'][_0xd26b('0x79')](),'issuer':hardwareConf[_0xd26b('0x46')](),'audience':hardwareConf[_0xd26b('0x46')]()}};return signJwt(_0x498061)[_0xd26b('0x32')](function(_0x26c3d7){return{'iat':_0x41ec1c[_0xd26b('0x5f')],'nonce':_0x41ec1c[_0xd26b('0x4b')],'token':_0x26c3d7};});} \ No newline at end of file +var _0xf3a8=['now','HS512','../../config/environment','../../config/license/hardware','../encryptor','express-jwt','basic-auth','bluebird','util','moment','secrets','session','role','fullname','name','internal','userpic','md5secret','voicePause','chatPause','mailPause','faxPause','openchannelPause','pauseType','lastLoginAt','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','isAuthenticated','use','user','findOne','params','closed','then','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','User','find','authenticate','pass','startsWith','authorization','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','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','splice','encryptString','join','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor'];(function(_0x499729,_0x195f21){var _0x5342d4=function(_0x51654f){while(--_0x51654f){_0x499729['push'](_0x499729['shift']());}};_0x5342d4(++_0x195f21);}(_0xf3a8,0xf2));var _0x8f3a=function(_0x317a6a,_0x492a7e){_0x317a6a=_0x317a6a-0x0;var _0x34dc46=_0xf3a8[_0x317a6a];return _0x34dc46;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x8f3a('0x0'));var hardwareConf=require(_0x8f3a('0x1'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x8f3a('0x2'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x8f3a('0x3'));var compose=require('composable-middleware');var basicAuth=require(_0x8f3a('0x4'));var crypto=require('crypto');var BPromise=require(_0x8f3a('0x5'));var util=require(_0x8f3a('0x6'));var moment=require(_0x8f3a('0x7'));var validateJwt=expressJwt({'secret':config[_0x8f3a('0x8')][_0x8f3a('0x9')]});var userAttributes=['id',_0x8f3a('0xa'),_0x8f3a('0xb'),_0x8f3a('0xc'),_0x8f3a('0xd'),'email',_0x8f3a('0xe'),'permissions',_0x8f3a('0xf'),_0x8f3a('0x10'),_0x8f3a('0x11'),_0x8f3a('0x12'),_0x8f3a('0x13'),'smsPause',_0x8f3a('0x14'),_0x8f3a('0x15'),'showWebBar',_0x8f3a('0x16'),'lastPauseAt','crudPermissions',_0x8f3a('0x17'),_0x8f3a('0x18'),'alias',_0x8f3a('0x19'),_0x8f3a('0x1a'),_0x8f3a('0x1b'),'phoneBarEnableRecording',_0x8f3a('0x1c'),_0x8f3a('0x1d'),'phoneBarExpires',_0x8f3a('0x1e'),_0x8f3a('0x1f'),'phoneBarRemoteControlPort',_0x8f3a('0x20'),_0x8f3a('0x21'),_0x8f3a('0x22'),_0x8f3a('0x23'),_0x8f3a('0x24')];exports['isChatInteractionAuthorized']=function(){return this[_0x8f3a('0x25')](!![])[_0x8f3a('0x26')](function(_0x17c14c,_0x3a0b94,_0x31e4cc){if(_0x17c14c[_0x8f3a('0x27')]){_0x31e4cc();}else{return db['ChatInteraction'][_0x8f3a('0x28')]({'where':{'id':_0x17c14c[_0x8f3a('0x29')]['id']},'attributes':['id',_0x8f3a('0x2a'),'disposition'],'raw':!![]})[_0x8f3a('0x2b')](function(_0x4a9d05){if(_0x4a9d05&&_0x4a9d05[_0x8f3a('0x2a')]){return _0x3a0b94[_0x8f3a('0x2c')](_0x4a9d05[_0x8f3a('0x2d')]===_0x8f3a('0x2e')?0x195:0x193)[_0x8f3a('0x2f')]({'message':_0x4a9d05['disposition']===_0x8f3a('0x2e')?_0x8f3a('0x30'):_0x8f3a('0x31')});}else{_0x31e4cc();}})[_0x8f3a('0x32')](function(_0x36b477){_0x31e4cc(_0x36b477);});}});};exports['isAuthenticated']=function isAuthenticated(_0x556a88){return compose()[_0x8f3a('0x26')](function(_0x5b0211,_0xa8b81c,_0xf04b12){var _0x5e47ab;if(_0x5b0211['headers']['authorization']){if(_['startsWith'](_0x5b0211[_0x8f3a('0x33')]['authorization'],'Basic')){var _0xf19515=basicAuth(_0x5b0211);db[_0x8f3a('0x34')][_0x8f3a('0x35')]({'where':{'name':_0xf19515[_0x8f3a('0xc')]}})[_0x8f3a('0x2b')](function(_0x281d9b){if(!_0x281d9b||!_0x281d9b[_0x8f3a('0x36')](_0xf19515[_0x8f3a('0x37')])){return _0xa8b81c[_0x8f3a('0x2c')](0x191)[_0x8f3a('0x2f')]({'message':'Wrong\x20credentials.'});}_0x5b0211[_0x8f3a('0x27')]={'id':_0x281d9b['id']};_0xf04b12();})['catch'](function(_0x3d750e){_0xf04b12(_0x3d750e);});}else if(_[_0x8f3a('0x38')](_0x5b0211[_0x8f3a('0x33')][_0x8f3a('0x39')],_0x8f3a('0x3a'))){validateJwt(_0x5b0211,_0xa8b81c,_0xf04b12);}else{if(_0x556a88){_0xf04b12();}else{return _0xa8b81c['status'](0x193)[_0x8f3a('0x2f')]({'message':_0x8f3a('0x3b')});}}}else if(_0x5b0211[_0x8f3a('0x3c')][_0x8f3a('0x3d')]){try{var _0x19d4f7={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x8f3a('0x3e')]()};verifyJwt(_0x5b0211[_0x8f3a('0x3c')][_0x8f3a('0x3d')],_0x19d4f7)[_0x8f3a('0x2b')](function(_0x138a92){return db[_0x8f3a('0x34')][_0x8f3a('0x35')]({'where':{'id':_0x138a92[_0x8f3a('0x3f')]}})['then'](function(_0x553755){_0x5e47ab=_0x553755;return db['Setting'][_0x8f3a('0x28')]({'where':{'id':0x1},'attributes':[_0x8f3a('0x40'),_0x8f3a('0x41')],'raw':!![]});})[_0x8f3a('0x2b')](function(_0x5f116d){if(!_0x5e47ab||!_[_0x8f3a('0x42')](_0x5e47ab[_0x8f3a('0x43')],_0x138a92[_0x8f3a('0x44')])){return _0xa8b81c[_0x8f3a('0x2c')](0x191)[_0x8f3a('0x2f')]({'message':_0x8f3a('0x45')});}if(_0x5e47ab[_0x8f3a('0x46')]){return _0xa8b81c['status'](0x191)[_0x8f3a('0x2f')]({'message':_0x8f3a('0x47')});}if(_0x5e47ab[_0x8f3a('0x48')]){if(_0x5f116d['blockDuration']>0x0){if(moment(_0x5e47ab[_0x8f3a('0x49')])[_0x8f3a('0x4a')](_0x5f116d[_0x8f3a('0x41')],_0x8f3a('0x4b'))>moment()){return _0xa8b81c[_0x8f3a('0x2c')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0xa8b81c[_0x8f3a('0x2c')](0x191)[_0x8f3a('0x2f')]({'message':_0x8f3a('0x47')});}}_0x5b0211[_0x8f3a('0x27')]={'id':_0x5e47ab['id']};_0xf04b12();});})[_0x8f3a('0x32')](function(){return _0xa8b81c[_0x8f3a('0x2c')](0x191)[_0x8f3a('0x2f')]({'message':_0x8f3a('0x47')});});}catch(_0x520499){_0xf04b12(_0x520499);}}else if(_0x556a88){_0xf04b12();}else{return _0xa8b81c[_0x8f3a('0x2c')](0x193)['json']({'message':_0x8f3a('0x3b')});}})[_0x8f3a('0x26')](function(_0x9cf94a,_0x547c5f,_0x146d2d){if(_0x9cf94a[_0x8f3a('0x27')]){db[_0x8f3a('0x34')][_0x8f3a('0x35')]({'where':{'id':_0x9cf94a[_0x8f3a('0x27')]['id']},'attributes':userAttributes})[_0x8f3a('0x2b')](function(_0x35c6a4){if(!_0x35c6a4){return _0x547c5f[_0x8f3a('0x2c')](0x194)[_0x8f3a('0x2f')]({'message':_0x8f3a('0x4c')});}_0x9cf94a[_0x8f3a('0x27')]=_0x35c6a4;_0x146d2d();})[_0x8f3a('0x32')](function(_0x1bc927){_0x146d2d(_0x1bc927);});}else if(_0x556a88){_0x146d2d();}else{return _0x547c5f['status'](0x194)[_0x8f3a('0x2f')]({'message':_0x8f3a('0x4d')});}});};exports[_0x8f3a('0x4e')]=function canUpdate(){return compose()[_0x8f3a('0x26')](function(_0x2bed96,_0xef3a8,_0x5b315c){return licenseUtil['getLicense']()[_0x8f3a('0x2b')](function(_0x43c9c1){if(_0x43c9c1['update']){_0x5b315c();}else{return _0xef3a8[_0x8f3a('0x2c')](0x193)[_0x8f3a('0x2f')]({'message':_0x8f3a('0x4f')});}})[_0x8f3a('0x32')](function(_0xe8d3f0){_0x5b315c(_0xe8d3f0);});});};exports[_0x8f3a('0x50')]=function(_0x293d00,_0x2654ae,_0x59e5fd){_0x293d00[_0x8f3a('0x50')]=!![];return _0x59e5fd();};exports[_0x8f3a('0x51')]=function signToken(_0x4e42c2){return signJwt(_0x4e42c2);};exports[_0x8f3a('0x52')]=function(_0x2c79a9,_0x118b15){if(!_0x2c79a9[_0x8f3a('0x27')]){return _0x118b15['status'](0x194)[_0x8f3a('0x2f')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x19b235={'payload':{'id':_0x2c79a9[_0x8f3a('0x27')]['id'],'role':_0x2c79a9[_0x8f3a('0x27')][_0x8f3a('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x19b235)[_0x8f3a('0x2b')](function(_0x3dc549){_0x118b15[_0x8f3a('0x53')](_0x8f3a('0x54'),_0x3dc549);_0x118b15[_0x8f3a('0x55')](_0x8f3a('0x56'));})[_0x8f3a('0x32')](function(_0x38803d){return _0x118b15['status'](0x1f4)['send'](_0x38803d);});};exports[_0x8f3a('0x57')]=function(_0x4c3fcf){if(_['isNil'](_0x4c3fcf[_0x8f3a('0x43')])||_[_0x8f3a('0x58')](_0x4c3fcf['apiKeyIat'])){return null;}else{return createJwt(_0x4c3fcf);}};exports[_0x8f3a('0x59')]=function(_0x203415){_0x203415[_0x8f3a('0x43')]=generateNonce();_0x203415[_0x8f3a('0x5a')]=generateIssuedAt();return createJwt(_0x203415);};exports[_0x8f3a('0x5b')]=function(_0x3e80d5,_0x401941){var _0x59049b=_0x3e80d5[_0x8f3a('0x3c')][_0x8f3a('0x3d')];if(_0x59049b){var _0x48c98b={'nonce':_0x401941[_0x8f3a('0x43')],'iat':_0x401941[_0x8f3a('0x5a')],'audience':hardwareConf[_0x8f3a('0x3e')](),'issuer':hardwareConf[_0x8f3a('0x3e')]()};return verifyJwt(_0x59049b,_0x48c98b)['then'](function(){return generateApiKey(_0x401941);});}else{throw{'message':_0x8f3a('0x5c')};}};exports[_0x8f3a('0x5d')]=function(_0x25e562){var _0x497d0c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x497d0c[_0x8f3a('0x5e')](_0x25e562))throw new db[(_0x8f3a('0x5f'))]['ValidationError'](_0x8f3a('0x60'));return;};exports[_0x8f3a('0x61')]=function(_0x4bec0b,_0x11c505,_0x2218ae){var _0x5cff93=encryptor[_0x8f3a('0x62')](_0x11c505)[_0x8f3a('0x63')](',');for(var _0x154611=0x0;_0x154611<_0x2218ae;_0x154611++){if(!_0x5cff93[_0x154611])break;if(_0x4bec0b[_0x8f3a('0x64')]()===_0x5cff93[_0x154611][_0x8f3a('0x64')]()){var _0x17123f=util[_0x8f3a('0x65')](_0x8f3a('0x66'),_0x2218ae);if(_0x2218ae===0x1){_0x17123f=_0x8f3a('0x67');}throw new db[(_0x8f3a('0x5f'))]['ValidationError'](_0x17123f);}}return;};exports[_0x8f3a('0x68')]=function(_0x184dc8,_0x24498f){var _0x2653b2=_0x24498f?encryptor[_0x8f3a('0x62')](_0x24498f)[_0x8f3a('0x63')](','):[];if(_0x2653b2['length']===0x5){_0x2653b2[_0x8f3a('0x69')](-0x1,0x1);}_0x2653b2['unshift'](_0x184dc8);return encryptor[_0x8f3a('0x6a')](_0x2653b2[_0x8f3a('0x6b')](','));};function signJwt(_0x391a52){var _0x1284db=BPromise[_0x8f3a('0x6c')](jwt[_0x8f3a('0x6d')],{'context':jwt});var _0x91aaf4=_0x391a52[_0x8f3a('0x6e')]||config[_0x8f3a('0x8')]['session'];return new BPromise(function(_0x832c6b,_0x284dcd){_0x1284db(_0x391a52[_0x8f3a('0x6f')],_0x91aaf4,_0x391a52[_0x8f3a('0x70')])[_0x8f3a('0x2b')](function(_0x1c1cf5){_0x832c6b(_0x1c1cf5);})[_0x8f3a('0x32')](function(_0x552d94){_0x284dcd(_0x552d94);});});}function verifyJwt(_0x1d4155,_0x500b1a,_0x4eee8b){var _0x1aa51d=BPromise[_0x8f3a('0x6c')](jwt[_0x8f3a('0x71')],{'context':jwt});var _0x1b9ae7=_0x4eee8b||config[_0x8f3a('0x8')][_0x8f3a('0x9')];return new BPromise(function(_0x32778c,_0x477697){_0x1aa51d(_0x1d4155,_0x1b9ae7,_0x500b1a)[_0x8f3a('0x2b')](function(_0x5119e3){_0x32778c(_0x5119e3);})[_0x8f3a('0x32')](function(_0x3db113){_0x477697(_0x3db113);});});}function generateNonce(){return crypto[_0x8f3a('0x72')](0x10)[_0x8f3a('0x73')](_0x8f3a('0x74'));}function generateIssuedAt(){return Math[_0x8f3a('0x75')](Date[_0x8f3a('0x76')]()/0x3e8)[_0x8f3a('0x73')]();}function createJwt(_0x4eb0e3){var _0xed8dcf={'payload':{'iat':_0x4eb0e3[_0x8f3a('0x5a')],'nonce':_0x4eb0e3[_0x8f3a('0x43')]},'options':{'algorithm':_0x8f3a('0x77'),'subject':_0x4eb0e3['id'][_0x8f3a('0x73')](),'issuer':hardwareConf[_0x8f3a('0x3e')](),'audience':hardwareConf[_0x8f3a('0x3e')]()}};return signJwt(_0xed8dcf)['then'](function(_0x16fc21){return{'iat':_0x4eb0e3['apiKeyIat'],'nonce':_0x4eb0e3[_0x8f3a('0x43')],'token':_0x16fc21};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index ab8c180..bfef436 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 _0x63cd=['error','getCiphers','filter','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','update','write','final','binary','end','close','decryptFile','createReadStream','createDecipher','encryptString','secret','utf8','base64','decryptString','bluebird','../../config/environment','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join'];(function(_0x4854d6,_0x2f1264){var _0x3885c0=function(_0x4d564d){while(--_0x4d564d){_0x4854d6['push'](_0x4854d6['shift']());}};_0x3885c0(++_0x2f1264);}(_0x63cd,0x96));var _0xd63c=function(_0x13c4a0,_0x3a832a){_0x13c4a0=_0x13c4a0-0x0;var _0x107214=_0x63cd[_0x13c4a0];return _0x107214;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xd63c('0x0'));var _=require('lodash');var config=require(_0xd63c('0x1'));var logger=require('../../config/logger')(_0xd63c('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xd63c('0x3')][_0xd63c('0x4')],'algorithm':_0xd63c('0x5')};const fileOptions={'algorithm':_0xd63c('0x6')};if(config[_0xd63c('0x7')]&&config[_0xd63c('0x7')][_0xd63c('0x8')]){var isSupported=isAlgorithmSupported(config[_0xd63c('0x7')][_0xd63c('0x8')]);if(isSupported){fileOptions[_0xd63c('0x8')]=config[_0xd63c('0x7')][_0xd63c('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xd63c('0x9')](',\x20');logger[_0xd63c('0xa')](config['encrypt'][_0xd63c('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x37614d){return AES_SUPPORTED_RX['test'](_0x37614d);}function getSupportedCiphers(){return crypto[_0xd63c('0xb')]()[_0xd63c('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x5e8ddd){return getSupportedCiphers()['indexOf'](_0x5e8ddd)>-0x1;}function combineOptions(_0x15515b){var _0x30d91b={};for(var _0x2723f4 in fileOptions){if(fileOptions[_0xd63c('0xd')](_0x2723f4)){_0x30d91b[_0x2723f4]=fileOptions[_0x2723f4];}}if(_0x15515b){for(var _0x2b3190 in _0x15515b){if(_0x15515b[_0xd63c('0xd')](_0x2b3190)){_0x30d91b[_0x2b3190]=_0x15515b[_0x2b3190];}}}return _0x30d91b;}exports[_0xd63c('0xe')]=function(_0x5c9edf,_0x31d879,_0x1d5a05,_0x5ae028){return new BPromise(function(_0x54b4c7,_0x56ea37){_0x5ae028=combineOptions(_0x5ae028);var _0x43dfd5=new Buffer(_0x1d5a05);var _0x243462=fs['createReadStream'](_0x5c9edf);var _0x5afb7c=fs[_0xd63c('0xf')](_0x31d879);var _0xcb37fa=crypto[_0xd63c('0x10')](_0x5ae028[_0xd63c('0x8')],_0x43dfd5);_0x243462['on'](_0xd63c('0x11'),function(_0xa43c06){var _0x4dd6da=new Buffer(_0xcb37fa[_0xd63c('0x12')](_0xa43c06),'binary');_0x5afb7c[_0xd63c('0x13')](_0x4dd6da);});_0x243462['on']('end',function(){try{var _0x87764a=new Buffer(_0xcb37fa[_0xd63c('0x14')]('binary'),_0xd63c('0x15'));_0x5afb7c[_0xd63c('0x13')](_0x87764a);_0x5afb7c[_0xd63c('0x16')]();_0x5afb7c['on'](_0xd63c('0x17'),function(){return _0x54b4c7(_0x31d879);});}catch(_0xf30c08){fs['unlink'](_0x31d879);return _0x56ea37(_0xf30c08);}});});};exports[_0xd63c('0x18')]=function(_0x44ec1b,_0x316f65,_0x999eac,_0x203413){return new BPromise(function(_0x4e9244,_0x21932b){_0x203413=combineOptions(_0x203413);var _0x2c5805=new Buffer(_0x999eac);var _0x1a022f=fs[_0xd63c('0x19')](_0x44ec1b);var _0x23c28e=fs['createWriteStream'](_0x316f65);var _0x3708bb=crypto[_0xd63c('0x1a')](_0x203413[_0xd63c('0x8')],_0x2c5805);_0x1a022f['on'](_0xd63c('0x11'),function(_0x427602){var _0x25d15b=new Buffer(_0x3708bb[_0xd63c('0x12')](_0x427602),'binary');_0x23c28e['write'](_0x25d15b);});_0x1a022f['on']('end',function(){try{var _0x2866b6=new Buffer(_0x3708bb[_0xd63c('0x14')]('binary'),_0xd63c('0x15'));_0x23c28e['write'](_0x2866b6);_0x23c28e['end']();_0x23c28e['on'](_0xd63c('0x17'),function(){return _0x4e9244(_0x316f65);});}catch(_0x1dba5e){fs['unlink'](_0x316f65);return _0x21932b(_0x1dba5e);}});});};exports[_0xd63c('0x1b')]=function(_0x486035,_0x180a32,_0x1f4f4a){var _0x3a7f31=_0x1f4f4a||stringOptions['algorithm'];var _0x511ceb=_0x180a32||stringOptions[_0xd63c('0x1c')];var _0x33b1aa=crypto[_0xd63c('0x10')](_0x3a7f31,_0x511ceb);var _0xeac735=_0x33b1aa[_0xd63c('0x12')](_0x486035,_0xd63c('0x1d'),_0xd63c('0x1e'));_0xeac735+=_0x33b1aa[_0xd63c('0x14')](_0xd63c('0x1e'));return _0xeac735;};exports[_0xd63c('0x1f')]=function(_0x2b3eed,_0x590e90,_0x4f0f3e){var _0x321740=_0x4f0f3e||stringOptions[_0xd63c('0x8')];var _0x10b703=_0x590e90||stringOptions[_0xd63c('0x1c')];var _0x1ad6f1=crypto[_0xd63c('0x1a')](_0x321740,_0x10b703);var _0x8c71fa=_0x1ad6f1[_0xd63c('0x12')](_0x2b3eed,'base64','utf8');_0x8c71fa+=_0x1ad6f1[_0xd63c('0x14')](_0xd63c('0x1d'));return _0x8c71fa;}; \ No newline at end of file +var _0x09ed=['decryptString','bluebird','lodash','../../config/environment','../../config/logger','app','aes-256-ctr','aes192','algorithm','encrypt','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','binary','write','end','final','close','unlink','createDecipher','update','encryptString','secret','createCipher','utf8','base64'];(function(_0x4c34be,_0x39c723){var _0x8b8fcf=function(_0x5614ca){while(--_0x5614ca){_0x4c34be['push'](_0x4c34be['shift']());}};_0x8b8fcf(++_0x39c723);}(_0x09ed,0x1e1));var _0xd09e=function(_0x29e44e,_0x3524ab){_0x29e44e=_0x29e44e-0x0;var _0x5e5d81=_0x09ed[_0x29e44e];return _0x5e5d81;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xd09e('0x0'));var _=require(_0xd09e('0x1'));var config=require(_0xd09e('0x2'));var logger=require(_0xd09e('0x3'))(_0xd09e('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':_0xd09e('0x5')};const fileOptions={'algorithm':_0xd09e('0x6')};if(config['encrypt']&&config['encrypt'][_0xd09e('0x7')]){var isSupported=isAlgorithmSupported(config[_0xd09e('0x8')][_0xd09e('0x7')]);if(isSupported){fileOptions['algorithm']=config[_0xd09e('0x8')][_0xd09e('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0xd09e('0x8')]['algorithm'],_0xd09e('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x25bc23){return AES_SUPPORTED_RX['test'](_0x25bc23);}function getSupportedCiphers(){return crypto[_0xd09e('0xa')]()[_0xd09e('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x5619d2){return getSupportedCiphers()[_0xd09e('0xc')](_0x5619d2)>-0x1;}function combineOptions(_0xa805c9){var _0x5d1cf5={};for(var _0xbae113 in fileOptions){if(fileOptions[_0xd09e('0xd')](_0xbae113)){_0x5d1cf5[_0xbae113]=fileOptions[_0xbae113];}}if(_0xa805c9){for(var _0x3fab10 in _0xa805c9){if(_0xa805c9[_0xd09e('0xd')](_0x3fab10)){_0x5d1cf5[_0x3fab10]=_0xa805c9[_0x3fab10];}}}return _0x5d1cf5;}exports[_0xd09e('0xe')]=function(_0x1eb948,_0x4d6048,_0x1046a3,_0x3819e3){return new BPromise(function(_0x327ce4,_0x9ac491){_0x3819e3=combineOptions(_0x3819e3);var _0x3cac00=new Buffer(_0x1046a3);var _0x12ace3=fs[_0xd09e('0xf')](_0x1eb948);var _0x1df67a=fs[_0xd09e('0x10')](_0x4d6048);var _0x4ab876=crypto['createCipher'](_0x3819e3[_0xd09e('0x7')],_0x3cac00);_0x12ace3['on'](_0xd09e('0x11'),function(_0x2da333){var _0x465a68=new Buffer(_0x4ab876['update'](_0x2da333),_0xd09e('0x12'));_0x1df67a[_0xd09e('0x13')](_0x465a68);});_0x12ace3['on'](_0xd09e('0x14'),function(){try{var _0x139583=new Buffer(_0x4ab876[_0xd09e('0x15')](_0xd09e('0x12')),_0xd09e('0x12'));_0x1df67a['write'](_0x139583);_0x1df67a[_0xd09e('0x14')]();_0x1df67a['on'](_0xd09e('0x16'),function(){return _0x327ce4(_0x4d6048);});}catch(_0x49f12e){fs[_0xd09e('0x17')](_0x4d6048);return _0x9ac491(_0x49f12e);}});});};exports['decryptFile']=function(_0x9b9844,_0x514bda,_0x24e4d1,_0x14e5cc){return new BPromise(function(_0x3710e5,_0x153e5d){_0x14e5cc=combineOptions(_0x14e5cc);var _0x4c1a44=new Buffer(_0x24e4d1);var _0x378d18=fs[_0xd09e('0xf')](_0x9b9844);var _0x4b84ef=fs[_0xd09e('0x10')](_0x514bda);var _0x5de9f8=crypto[_0xd09e('0x18')](_0x14e5cc['algorithm'],_0x4c1a44);_0x378d18['on'](_0xd09e('0x11'),function(_0x1ca03f){var _0xd2d737=new Buffer(_0x5de9f8[_0xd09e('0x19')](_0x1ca03f),_0xd09e('0x12'));_0x4b84ef['write'](_0xd2d737);});_0x378d18['on'](_0xd09e('0x14'),function(){try{var _0xb6b4a=new Buffer(_0x5de9f8['final'](_0xd09e('0x12')),_0xd09e('0x12'));_0x4b84ef[_0xd09e('0x13')](_0xb6b4a);_0x4b84ef['end']();_0x4b84ef['on']('close',function(){return _0x3710e5(_0x514bda);});}catch(_0x23fb69){fs['unlink'](_0x514bda);return _0x153e5d(_0x23fb69);}});});};exports[_0xd09e('0x1a')]=function(_0x439d8f,_0x596fa4,_0x38d8ba){var _0x36a2d8=_0x38d8ba||stringOptions[_0xd09e('0x7')];var _0x5e57b3=_0x596fa4||stringOptions[_0xd09e('0x1b')];var _0x4077ba=crypto[_0xd09e('0x1c')](_0x36a2d8,_0x5e57b3);var _0x5e2fc7=_0x4077ba[_0xd09e('0x19')](_0x439d8f,_0xd09e('0x1d'),'base64');_0x5e2fc7+=_0x4077ba['final'](_0xd09e('0x1e'));return _0x5e2fc7;};exports[_0xd09e('0x1f')]=function(_0x486d9e,_0x8f604c,_0x682fa1){var _0x4fabdc=_0x682fa1||stringOptions['algorithm'];var _0xa96c40=_0x8f604c||stringOptions['secret'];var _0x42f4a5=crypto[_0xd09e('0x18')](_0x4fabdc,_0xa96c40);var _0x4d2645=_0x42f4a5['update'](_0x486d9e,_0xd09e('0x1e'),_0xd09e('0x1d'));_0x4d2645+=_0x42f4a5['final'](_0xd09e('0x1d'));return _0x4d2645;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 6014fd1..6923f2a 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 _0x4b84=['push','QueryTypes','SELECT','dirname','.csv','join','each','%s%d.%s','csv','%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','bluebird','../../mysqldb','dbH','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','then','query','sequelize','num','Empty','length'];(function(_0x164e5d,_0x1da231){var _0x476cfe=function(_0x1d77d2){while(--_0x1d77d2){_0x164e5d['push'](_0x164e5d['shift']());}};_0x476cfe(++_0x1da231);}(_0x4b84,0x1cc));var _0x44b8=function(_0x82140,_0x3a9d87){_0x82140=_0x82140-0x0;var _0x2b15a6=_0x4b84[_0x82140];return _0x2b15a6;};'use strict';var util=require(_0x44b8('0x0'));var path=require(_0x44b8('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x44b8('0x2'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0x44b8('0x3'))['db'];var dbH=require(_0x44b8('0x3'))[_0x44b8('0x4')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x44b8('0x5')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x327f59,_0x5947f7){var _0x3e87c5={'status':_0x327f59};var _0x5a2353={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5947f7){_0x3e87c5['savename']=_0x5947f7;}return db[_0x44b8('0x6')][_0x44b8('0x7')](_0x3e87c5,_0x5a2353);}function main(){var _0x30ebc3=0x1388;var _0x48a371;logger[_0x44b8('0x8')](util[_0x44b8('0x9')](_0x44b8('0xa'),EXTRACTED_REPORT_ID,_0x44b8('0xb')));return db[_0x44b8('0xc')][_0x44b8('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x44b8('0xe'),'splitSizeCsv']})[_0x44b8('0xf')](function(_0x4301a6){if(_0x4301a6){_0x48a371=_0x4301a6;_0x30ebc3=_0x48a371['splitSizeCsv']||0x1388;}})[_0x44b8('0xf')](function(){return dbH['sequelize'][_0x44b8('0x10')](util[_0x44b8('0x9')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x44b8('0x11')]['QueryTypes']['SELECT']});})[_0x44b8('0xf')](function(_0x2af0ad){if(!_0x2af0ad[0x0][_0x44b8('0x12')]){return analyticExtractedReport(_0x44b8('0x13'));}var _0x5e52f2=[];var _0x495c74=0x0;var _0x5d6349=!![];if(_0x2af0ad&&_0x2af0ad[_0x44b8('0x14')]){var _0x5b7803=_0x2af0ad[0x0][_0x44b8('0x12')]%(_0x495c74+_0x30ebc3);if(_0x48a371[_0x44b8('0xe')]){for(;_0x5d6349;_0x495c74+=_0x30ebc3,_0x5b7803=_0x2af0ad[0x0]['num']%(_0x495c74+_0x30ebc3)){if(_0x5b7803==0x0||_0x5b7803==_0x2af0ad[0x0][_0x44b8('0x12')]){_0x5d6349=![];}_0x5e52f2[_0x44b8('0x15')](dbH['sequelize'][_0x44b8('0x10')](util[_0x44b8('0x9')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x30ebc3,_0x495c74),{'type':dbH[_0x44b8('0x11')][_0x44b8('0x16')][_0x44b8('0x17')]}));}}else{_0x5e52f2[_0x44b8('0x15')](dbH[_0x44b8('0x11')][_0x44b8('0x10')](QUERY,{'type':dbH[_0x44b8('0x11')][_0x44b8('0x16')][_0x44b8('0x17')]}));}}var _0x1e0f2d=path[_0x44b8('0x18')](PATH);var _0x14996c=path['basename'](PATH,_0x44b8('0x19'));var _0x3a8aa4=_0x48a371[_0x44b8('0xe')]&&_0x5e52f2[_0x44b8('0x14')]>0x1;var _0x305a5c=[];if(!fs['existsSync'](path[_0x44b8('0x1a')](_0x1e0f2d,_0x14996c))&&_0x3a8aa4){fs['mkdirSync'](path[_0x44b8('0x1a')](_0x1e0f2d,_0x14996c));}return BPromise[_0x44b8('0x1b')](_0x5e52f2,function(_0x25a0c1){_0x305a5c[_0x44b8('0x15')](_0x25a0c1);})[_0x44b8('0xf')](function(){for(var _0x59acbc=0x0;_0x59acbc<_0x305a5c[_0x44b8('0x14')];_0x59acbc+=0x1){var _0x502acf;var _0x41d673=_0x305a5c[_0x59acbc];if(_0x3a8aa4){_0x502acf=path[_0x44b8('0x1a')](_0x1e0f2d,_0x14996c,util['format'](_0x44b8('0x1c'),_0x14996c,_0x59acbc,_0x44b8('0x1d')));}else{_0x502acf=path[_0x44b8('0x1a')](_0x1e0f2d,util['format'](_0x44b8('0x1e'),_0x14996c,_0x44b8('0x1d')));}fs['writeFileSync'](_0x502acf,csv(_0x41d673));}})[_0x44b8('0xf')](function(){if(_0x3a8aa4){zipdir(path['join'](_0x1e0f2d,_0x14996c),{'saveTo':path[_0x44b8('0x1a')](_0x1e0f2d,util['format']('%s.%s',_0x14996c,'zip'))},function(_0x387293,_0x29b18d){});rimraf(path[_0x44b8('0x1a')](_0x1e0f2d,_0x14996c),function(){});}})[_0x44b8('0xf')](function(){logger[_0x44b8('0x8')](util[_0x44b8('0x9')](_0x44b8('0x1f'),EXTRACTED_REPORT_ID,_0x44b8('0xb')));return analyticExtractedReport(_0x44b8('0x20'),_0x3a8aa4?util[_0x44b8('0x9')](_0x44b8('0x1e'),_0x14996c,_0x3a8aa4?_0x44b8('0x21'):_0x44b8('0x1d')):null);});})['catch'](function(_0x261ff2){logger['info'](util[_0x44b8('0x9')](_0x44b8('0x22'),EXTRACTED_REPORT_ID,_0x44b8('0xb')),util[_0x44b8('0x23')](_0x261ff2,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x44b8('0x24'));});}main(); \ No newline at end of file +var _0x9f62=['find','split','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push','dirname','basename','.csv','existsSync','join','mkdirSync','each','csv','%s.%s','writeFileSync','zip','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path','to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV'];(function(_0x456b57,_0x58691a){var _0x18f49f=function(_0x1dc195){while(--_0x1dc195){_0x456b57['push'](_0x456b57['shift']());}};_0x18f49f(++_0x58691a);}(_0x9f62,0x154));var _0x29f6=function(_0x2c0387,_0x372d73){_0x2c0387=_0x2c0387-0x0;var _0x17eb75=_0x9f62[_0x2c0387];return _0x17eb75;};'use strict';var util=require('util');var path=require(_0x29f6('0x0'));var _=require('lodash');var csv=require(_0x29f6('0x1'));var fs=require('fs');var BPromise=require(_0x29f6('0x2'));var zipdir=require(_0x29f6('0x3'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x29f6('0x4'))[_0x29f6('0x5')];var logger=require(_0x29f6('0x6'))(_0x29f6('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x29f6('0x8')][0x3];var PATH=process[_0x29f6('0x8')][0x4];function analyticExtractedReport(_0x9a43fe,_0x2ba602){var _0x416c6c={'status':_0x9a43fe};var _0x5e9945={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ba602){_0x416c6c['savename']=_0x2ba602;}return db['AnalyticExtractedReport']['update'](_0x416c6c,_0x5e9945);}function main(){var _0xe25841=0x1388;var _0x44db16;logger['info'](util['format'](_0x29f6('0x9'),EXTRACTED_REPORT_ID,_0x29f6('0xa')));return db['Setting'][_0x29f6('0xb')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x29f6('0xc'),'splitSizeCsv']})['then'](function(_0x559585){if(_0x559585){_0x44db16=_0x559585;_0xe25841=_0x44db16['splitSizeCsv']||0x1388;}})[_0x29f6('0xd')](function(){return dbH[_0x29f6('0xe')][_0x29f6('0xf')](util[_0x29f6('0x10')](_0x29f6('0x11'),QUERY),{'type':dbH[_0x29f6('0xe')][_0x29f6('0x12')][_0x29f6('0x13')]});})[_0x29f6('0xd')](function(_0x19331f){if(!_0x19331f[0x0][_0x29f6('0x14')]){return analyticExtractedReport(_0x29f6('0x15'));}var _0x1dde97=[];var _0x3a75d0=0x0;var _0x25e5a2=!![];if(_0x19331f&&_0x19331f[_0x29f6('0x16')]){var _0x3584a1=_0x19331f[0x0]['num']%(_0x3a75d0+_0xe25841);if(_0x44db16['split']){for(;_0x25e5a2;_0x3a75d0+=_0xe25841,_0x3584a1=_0x19331f[0x0][_0x29f6('0x14')]%(_0x3a75d0+_0xe25841)){if(_0x3584a1==0x0||_0x3584a1==_0x19331f[0x0][_0x29f6('0x14')]){_0x25e5a2=![];}_0x1dde97[_0x29f6('0x17')](dbH['sequelize'][_0x29f6('0xf')](util[_0x29f6('0x10')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xe25841,_0x3a75d0),{'type':dbH[_0x29f6('0xe')][_0x29f6('0x12')][_0x29f6('0x13')]}));}}else{_0x1dde97[_0x29f6('0x17')](dbH[_0x29f6('0xe')][_0x29f6('0xf')](QUERY,{'type':dbH['sequelize'][_0x29f6('0x12')]['SELECT']}));}}var _0x4acb15=path[_0x29f6('0x18')](PATH);var _0x1fa159=path[_0x29f6('0x19')](PATH,_0x29f6('0x1a'));var _0x54ddeb=_0x44db16[_0x29f6('0xc')]&&_0x1dde97['length']>0x1;var _0xd4179c=[];if(!fs[_0x29f6('0x1b')](path[_0x29f6('0x1c')](_0x4acb15,_0x1fa159))&&_0x54ddeb){fs[_0x29f6('0x1d')](path['join'](_0x4acb15,_0x1fa159));}return BPromise[_0x29f6('0x1e')](_0x1dde97,function(_0x4d494f){_0xd4179c['push'](_0x4d494f);})[_0x29f6('0xd')](function(){for(var _0x45f792=0x0;_0x45f792<_0xd4179c[_0x29f6('0x16')];_0x45f792+=0x1){var _0x342038;var _0x84ccb7=_0xd4179c[_0x45f792];if(_0x54ddeb){_0x342038=path[_0x29f6('0x1c')](_0x4acb15,_0x1fa159,util[_0x29f6('0x10')]('%s%d.%s',_0x1fa159,_0x45f792,_0x29f6('0x1f')));}else{_0x342038=path[_0x29f6('0x1c')](_0x4acb15,util[_0x29f6('0x10')](_0x29f6('0x20'),_0x1fa159,_0x29f6('0x1f')));}fs[_0x29f6('0x21')](_0x342038,csv(_0x84ccb7));}})[_0x29f6('0xd')](function(){if(_0x54ddeb){zipdir(path[_0x29f6('0x1c')](_0x4acb15,_0x1fa159),{'saveTo':path[_0x29f6('0x1c')](_0x4acb15,util[_0x29f6('0x10')](_0x29f6('0x20'),_0x1fa159,_0x29f6('0x22')))},function(_0x40c830,_0x304c28){});rimraf(path[_0x29f6('0x1c')](_0x4acb15,_0x1fa159),function(){});}})[_0x29f6('0xd')](function(){logger[_0x29f6('0x23')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x29f6('0xa')));return analyticExtractedReport('Completed',_0x54ddeb?util[_0x29f6('0x10')](_0x29f6('0x20'),_0x1fa159,_0x54ddeb?_0x29f6('0x22'):_0x29f6('0x1f')):null);});})['catch'](function(_0x53e11f){logger[_0x29f6('0x23')](util[_0x29f6('0x10')](_0x29f6('0x24'),EXTRACTED_REPORT_ID,_0x29f6('0xa')),util[_0x29f6('0x25')](_0x53e11f,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x29f6('0x26'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 8d55fb0..41dc0b7 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 _0x5687=['mkdirSync','all','flatten','createPdfKitDocument','%s%d.%s','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','window','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','body','keys','length','chunk','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','header','before','margin','landscape','\x20/\x20','footer','Arial','black','right','dirname','join','pdf','find','split','splitSizePdf','then','num','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT'];(function(_0x12da6c,_0x23ee55){var _0x3ef7b3=function(_0xeec4fb){while(--_0xeec4fb){_0x12da6c['push'](_0x12da6c['shift']());}};_0x3ef7b3(++_0x23ee55);}(_0x5687,0x1ce));var _0x7568=function(_0x20473a,_0x38b93f){_0x20473a=_0x20473a-0x0;var _0x5b11ff=_0x5687[_0x20473a];return _0x5b11ff;};'use strict';var _=require(_0x7568('0x0'));var fs=require('fs');var util=require(_0x7568('0x1'));var path=require(_0x7568('0x2'));var moment=require(_0x7568('0x3'));var htmlToPdfmake=require(_0x7568('0x4'));var PdfPrinter=require(_0x7568('0x5'));var zipdir=require(_0x7568('0x6'));var rimraf=require(_0x7568('0x7'));var JSDOM=require(_0x7568('0x8'))['JSDOM'];var window=new JSDOM('')[_0x7568('0x9')];var db=require(_0x7568('0xa'))['db'];var dbH=require(_0x7568('0xa'))[_0x7568('0xb')];var logger=require('../../config/logger')(_0x7568('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0x7568('0xd')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x7568('0xd')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x7568('0xe');var EXTRACTED_REPORT;function analyticExtractedReport(_0x53d9a5,_0xaf88a5){var _0x3d0d7c={'status':_0x53d9a5};var _0x394d4e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xaf88a5){_0x3d0d7c[_0x7568('0xf')]=_0xaf88a5;}return db[_0x7568('0x10')][_0x7568('0x11')](_0x3d0d7c,_0x394d4e);}function getHeaders(_0x1ade2c){return _[_0x7568('0x12')](_0x1ade2c,function(_0xdcb5){return{'text':_0xdcb5,'style':_0x7568('0x13')};});}function getRows(_0xd4857a,_0x4f9c9f){return _[_0x7568('0x12')](_0x4f9c9f,function(_0x59fdde){return _(_0x59fdde)[_0x7568('0x14')](_0xd4857a)[_0x7568('0x12')](function(_0x37bd69){return _0x37bd69?_[_0x7568('0x15')](_0x37bd69):'';})['value']();});}function createTable(_0x38dcb1,_0x423abb){var _0x6fc45a={'widths':_['fill'](Array(_0x38dcb1['length']),0x91),'heights':function(_0x11b041){return _0x11b041===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x369dbe=getHeaders(_0x38dcb1);_0x6fc45a[_0x7568('0x16')]['push'](_0x369dbe);var _0x5bd111=getRows(_0x38dcb1,_0x423abb);_0x6fc45a[_0x7568('0x16')]=_0x6fc45a[_0x7568('0x16')]['concat'](_0x5bd111);return _0x6fc45a;}function createTables(_0x47cafb){var _0x96045e=[];var _0x273a9f=Object[_0x7568('0x17')](_0x47cafb[0x0]);if(_0x47cafb[_0x7568('0x18')]>0x5)_0x273a9f=_[_0x7568('0x19')](Object[_0x7568('0x17')](_0x47cafb[0x0]),0x5);_0x273a9f[_0x7568('0x1a')](function(_0x2224f8){_0x96045e[_0x7568('0x1b')](createTable(_0x2224f8,_0x47cafb));});return _0x96045e;}function getPDFDocDefinition(_0x2be9c5){var _0x5a4793=util[_0x7568('0x1c')](_0x7568('0x1d'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x7568('0x1e')])[_0x7568('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x7568('0x1f')])[_0x7568('0x1c')](FORMAT));var _0x2ad216=[];for(var _0x1f27f5=0x0;_0x1f27f5<_0x2be9c5[_0x7568('0x18')];_0x1f27f5++){var _0x319785=[];if(_0x1f27f5===0x0){_0x319785[_0x7568('0x1b')]({'text':_0x5a4793,'style':_0x7568('0x20')});}var _0x1be38b={'table':_0x2be9c5[_0x1f27f5]};if(_0x1f27f5>0x0){_0x1be38b['pageBreak']=_0x7568('0x21');_0x1be38b[_0x7568('0x22')]=[0x0,0x46,0x0,0x0];}_0x319785['push'](_0x1be38b);_0x2ad216[_0x7568('0x1b')](_0x319785);}return{'pageSize':'A4','pageOrientation':_0x7568('0x23'),'content':_0x2ad216,'footer':function(_0xbfeab9,_0x33434d){return{'text':_0xbfeab9[_0x7568('0x15')]()+_0x7568('0x24')+_0x33434d,'style':_0x7568('0x25')};},'defaultStyle':{'font':_0x7568('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x7568('0x27')},'footer':{'alignment':_0x7568('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x21c326){var _0x4278fb=0x1388;var _0x3dd244;if(!_0x21c326[0x0]['num']){return analyticExtractedReport('Empty');}var _0x4e3138=[];var _0x3edccc=0x0;var _0x3043d5=!![];var _0x1b9ddc=path[_0x7568('0x29')](PATH);var _0x51c1ff=path['basename'](PATH,'.pdf');var _0x355ce0=path[_0x7568('0x2a')](_0x1b9ddc,util[_0x7568('0x1c')]('%s.%s',_0x51c1ff,_0x7568('0x2b')));var _0x53b4aa=![];return db['Setting'][_0x7568('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7568('0x2d'),_0x7568('0x2e')]})[_0x7568('0x2f')](function(_0x4933d7){if(_0x4933d7){_0x3dd244=_0x4933d7;_0x4278fb=_0x3dd244['splitSizePdf']||0x3e8;}})['then'](function(){if(_0x21c326&&_0x21c326[_0x7568('0x18')]){var _0x2cf65b=_0x21c326[0x0]['num']%(_0x3edccc+_0x4278fb);if(_0x3dd244['split']){for(;_0x3043d5;_0x3edccc+=_0x4278fb,_0x2cf65b=_0x21c326[0x0][_0x7568('0x30')]%(_0x3edccc+_0x4278fb)){if(_0x2cf65b==0x0||_0x2cf65b==_0x21c326[0x0]['num']){_0x3043d5=![];}_0x4e3138[_0x7568('0x1b')](dbH[_0x7568('0x31')][_0x7568('0x32')](util['format'](_0x7568('0x33'),QUERY,_0x4278fb,_0x3edccc),{'type':dbH[_0x7568('0x31')][_0x7568('0x34')]['SELECT']}));}}else{_0x4e3138['push'](dbH['sequelize'][_0x7568('0x32')](QUERY,{'type':dbH[_0x7568('0x31')][_0x7568('0x34')][_0x7568('0x35')]}));}}_0x53b4aa=_0x3dd244[_0x7568('0x2d')]&&_0x4e3138[_0x7568('0x18')]>0x1;if(!fs['existsSync'](path[_0x7568('0x2a')](_0x1b9ddc,_0x51c1ff))&&_0x53b4aa){fs[_0x7568('0x36')](path[_0x7568('0x2a')](_0x1b9ddc,_0x51c1ff));}return Promise[_0x7568('0x37')](_0x4e3138);})[_0x7568('0x2f')](function(_0x512acb){return createTables(_[_0x7568('0x38')](_0x512acb));})[_0x7568('0x2f')](function(_0x157589){var _0xe59fd6=getPDFDocDefinition(_0x157589);var _0x499852=getPDFPrinter();var _0x75deac=_0x499852[_0x7568('0x39')](_0xe59fd6);if(_0x53b4aa)_0x355ce0=path['join'](_0x1b9ddc,_0x51c1ff,util['format'](_0x7568('0x3a'),_0x51c1ff,index,'pdf'));return writePDFDocument(_0x75deac,_0x355ce0);})[_0x7568('0x2f')](function(){if(!_0x53b4aa)return;zipdir(path[_0x7568('0x2a')](_0x1b9ddc,_0x51c1ff),{'saveTo':path[_0x7568('0x2a')](_0x1b9ddc,util['format'](_0x7568('0x3b'),_0x51c1ff,_0x7568('0x3c')))},function(_0xd41ea2){if(_0xd41ea2)throw _0xd41ea2;return;});})[_0x7568('0x2f')](function(){if(!_0x53b4aa)return;rimraf(path[_0x7568('0x2a')](_0x1b9ddc,_0x51c1ff),function(){});})['then'](function(){logger[_0x7568('0x3d')](util[_0x7568('0x1c')](_0x7568('0x3e'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x7568('0x3f'),_0x53b4aa?util['format'](_0x7568('0x3b'),_0x51c1ff,_0x53b4aa?_0x7568('0x3c'):_0x7568('0x2b')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x7568('0x3d')](util[_0x7568('0x1c')](_0x7568('0x40'),EXTRACTED_REPORT_ID,_0x7568('0x41')));return db[_0x7568('0x10')][_0x7568('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x7568('0x2f')](function(_0x204b1c){EXTRACTED_REPORT=_0x204b1c;return dbH[_0x7568('0x31')][_0x7568('0x32')](util['format'](_0x7568('0x43'),QUERY),{'type':dbH[_0x7568('0x31')][_0x7568('0x34')][_0x7568('0x35')]});})[_0x7568('0x2f')](extractReport)[_0x7568('0x44')](function(_0x16ad6e){logger[_0x7568('0x3d')](util['format'](_0x7568('0x45'),EXTRACTED_REPORT_ID,_0x7568('0x41')),util[_0x7568('0x46')](_0x16ad6e,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x7568('0x47'));});}main();function getPDFPrinter(){var _0x588041=new PdfPrinter({'Arial':{'normal':__dirname+_0x7568('0x48'),'bold':__dirname+_0x7568('0x49'),'italics':__dirname+_0x7568('0x4a'),'bolditalics':__dirname+_0x7568('0x4b')}});return _0x588041;}function getPDFDocDefinitionFromHTML(_0x14d0bb,_0x106085){var _0x478f8e=util[_0x7568('0x1c')](_0x7568('0x4c'),_0x106085['channel'],_0x106085[_0x7568('0x4d')]);var _0x3e3691=moment()[_0x7568('0x1c')](_0x7568('0x4e'))[_0x7568('0x15')]();var _0x4e33ad=htmlToPdfmake(_0x14d0bb,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4e33ad],'defaultStyle':{'font':_0x7568('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x7568('0x4f'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x7568('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x7568('0x4f')}},'header':function(){return[{'text':_0x7568('0x50'),'style':'header'}];},'footer':function(_0x5f194a,_0x131c60){return[{'text':util[_0x7568('0x1c')](_0x7568('0x51'),_0x478f8e,_0x5f194a,_0x131c60,_0x3e3691),'style':_0x7568('0x25')}];}};}function writePDFDocument(_0x5448d2,_0x2e8a7e){return new Promise(function(_0xb6487d,_0x2ebf2f){var _0x11b5b9=_0x5448d2[_0x7568('0x52')](fs[_0x7568('0x53')](_0x2e8a7e));_0x11b5b9['on'](_0x7568('0x54'),function(){_0xb6487d(_0x7568('0x54'));});_0x11b5b9['on'](_0x7568('0x55'),function(_0x2c4ae7){_0x2ebf2f(_0x2c4ae7);});_0x5448d2['end']();});}exports['createPdfFromHTML']=function(_0x2dc040,_0x18b66f){var _0x44af58=getPDFPrinter();var _0x3d16cf=getPDFDocDefinitionFromHTML(_0x2dc040,_0x18b66f);var _0x36a982=_0x44af58['createPdfKitDocument'](_0x3d16cf);return writePDFDocument(_0x36a982,_0x18b66f[_0x7568('0x2')])[_0x7568('0x44')](function(_0xda1583){throw _0xda1583;});}; \ No newline at end of file +var _0x302c=['error','end','createPdfFromHTML','catch','lodash','util','path','moment','html-to-pdfmake','rimraf','jsdom','JSDOM','../../mysqldb','../../config/logger','analytics','argv','savename','map','tableHeader','pick','value','fill','length','auto','body','concat','keys','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','before','margin','landscape','footer','Arial','black','right','num','Empty','dirname','basename','.pdf','join','%s.%s','pdf','find','splitSizePdf','then','split','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','existsSync','mkdirSync','flatten','createPdfKitDocument','%s%d.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','inspect','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','toString','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish'];(function(_0x2a9633,_0x3fbfa8){var _0x56a4ee=function(_0x14d7c3){while(--_0x14d7c3){_0x2a9633['push'](_0x2a9633['shift']());}};_0x56a4ee(++_0x3fbfa8);}(_0x302c,0x15c));var _0xc302=function(_0x18e629,_0x52c8b0){_0x18e629=_0x18e629-0x0;var _0x26dd9c=_0x302c[_0x18e629];return _0x26dd9c;};'use strict';var _=require(_0xc302('0x0'));var fs=require('fs');var util=require(_0xc302('0x1'));var path=require(_0xc302('0x2'));var moment=require(_0xc302('0x3'));var htmlToPdfmake=require(_0xc302('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require(_0xc302('0x5'));var JSDOM=require(_0xc302('0x6'))[_0xc302('0x7')];var window=new JSDOM('')['window'];var db=require('../../mysqldb')['db'];var dbH=require(_0xc302('0x8'))['dbH'];var logger=require(_0xc302('0x9'))(_0xc302('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xc302('0xb')][0x2]);var QUERY=process[_0xc302('0xb')][0x3];var PATH=process[_0xc302('0xb')][0x4];var NAME=process[_0xc302('0xb')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;function analyticExtractedReport(_0x398f1a,_0x28dc3b){var _0x5c63da={'status':_0x398f1a};var _0x5f197b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x28dc3b){_0x5c63da[_0xc302('0xc')]=_0x28dc3b;}return db['AnalyticExtractedReport']['update'](_0x5c63da,_0x5f197b);}function getHeaders(_0x4f88de){return _[_0xc302('0xd')](_0x4f88de,function(_0x246ae7){return{'text':_0x246ae7,'style':_0xc302('0xe')};});}function getRows(_0x15f6ff,_0x3cf0f5){return _[_0xc302('0xd')](_0x3cf0f5,function(_0xd3236b){return _(_0xd3236b)[_0xc302('0xf')](_0x15f6ff)[_0xc302('0xd')](function(_0x39daf7){return _0x39daf7?_['toString'](_0x39daf7):'';})[_0xc302('0x10')]();});}function createTable(_0x2f9a3a,_0x54a865){var _0x2466a6={'widths':_[_0xc302('0x11')](Array(_0x2f9a3a[_0xc302('0x12')]),0x91),'heights':function(_0x29ce77){return _0x29ce77===0x0?_0xc302('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x54cf3a=getHeaders(_0x2f9a3a);_0x2466a6[_0xc302('0x14')]['push'](_0x54cf3a);var _0x1bec69=getRows(_0x2f9a3a,_0x54a865);_0x2466a6[_0xc302('0x14')]=_0x2466a6['body'][_0xc302('0x15')](_0x1bec69);return _0x2466a6;}function createTables(_0x1ddc86){var _0x34260a=[];var _0x2aca7b=Object[_0xc302('0x16')](_0x1ddc86[0x0]);if(_0x1ddc86[_0xc302('0x12')]>0x5)_0x2aca7b=_['chunk'](Object[_0xc302('0x16')](_0x1ddc86[0x0]),0x5);_0x2aca7b[_0xc302('0x17')](function(_0x494e0d){_0x34260a[_0xc302('0x18')](createTable(_0x494e0d,_0x1ddc86));});return _0x34260a;}function getPDFDocDefinition(_0x291528){var _0x51537c=util[_0xc302('0x19')](_0xc302('0x1a'),NAME,EXTRACTED_REPORT[_0xc302('0x1b')],moment(EXTRACTED_REPORT['startDate'])[_0xc302('0x19')](FORMAT),moment(EXTRACTED_REPORT[_0xc302('0x1c')])[_0xc302('0x19')](FORMAT));var _0x5af7a8=[];for(var _0x38ad27=0x0;_0x38ad27<_0x291528['length'];_0x38ad27++){var _0x1cbe6c=[];if(_0x38ad27===0x0){_0x1cbe6c['push']({'text':_0x51537c,'style':'header'});}var _0x57616c={'table':_0x291528[_0x38ad27]};if(_0x38ad27>0x0){_0x57616c['pageBreak']=_0xc302('0x1d');_0x57616c[_0xc302('0x1e')]=[0x0,0x46,0x0,0x0];}_0x1cbe6c[_0xc302('0x18')](_0x57616c);_0x5af7a8['push'](_0x1cbe6c);}return{'pageSize':'A4','pageOrientation':_0xc302('0x1f'),'content':_0x5af7a8,'footer':function(_0x54cffd,_0x58f09f){return{'text':_0x54cffd['toString']()+'\x20/\x20'+_0x58f09f,'style':_0xc302('0x20')};},'defaultStyle':{'font':_0xc302('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xc302('0x22')},'footer':{'alignment':_0xc302('0x23'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1bcf3c){var _0xa32da3=0x1388;var _0x2e76d3;if(!_0x1bcf3c[0x0][_0xc302('0x24')]){return analyticExtractedReport(_0xc302('0x25'));}var _0xc05f4f=[];var _0x3a0dc0=0x0;var _0x29ba0e=!![];var _0xee5a48=path[_0xc302('0x26')](PATH);var _0x3106a9=path[_0xc302('0x27')](PATH,_0xc302('0x28'));var _0xa1faac=path[_0xc302('0x29')](_0xee5a48,util['format'](_0xc302('0x2a'),_0x3106a9,_0xc302('0x2b')));var _0x5b41b4=![];return db['Setting'][_0xc302('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xc302('0x2d')]})[_0xc302('0x2e')](function(_0x572ba5){if(_0x572ba5){_0x2e76d3=_0x572ba5;_0xa32da3=_0x2e76d3[_0xc302('0x2d')]||0x3e8;}})['then'](function(){if(_0x1bcf3c&&_0x1bcf3c[_0xc302('0x12')]){var _0x4bd9a5=_0x1bcf3c[0x0]['num']%(_0x3a0dc0+_0xa32da3);if(_0x2e76d3[_0xc302('0x2f')]){for(;_0x29ba0e;_0x3a0dc0+=_0xa32da3,_0x4bd9a5=_0x1bcf3c[0x0][_0xc302('0x24')]%(_0x3a0dc0+_0xa32da3)){if(_0x4bd9a5==0x0||_0x4bd9a5==_0x1bcf3c[0x0][_0xc302('0x24')]){_0x29ba0e=![];}_0xc05f4f[_0xc302('0x18')](dbH['sequelize'][_0xc302('0x30')](util[_0xc302('0x19')](_0xc302('0x31'),QUERY,_0xa32da3,_0x3a0dc0),{'type':dbH[_0xc302('0x32')][_0xc302('0x33')][_0xc302('0x34')]}));}}else{_0xc05f4f[_0xc302('0x18')](dbH[_0xc302('0x32')][_0xc302('0x30')](QUERY,{'type':dbH[_0xc302('0x32')][_0xc302('0x33')][_0xc302('0x34')]}));}}_0x5b41b4=_0x2e76d3[_0xc302('0x2f')]&&_0xc05f4f['length']>0x1;if(!fs[_0xc302('0x35')](path['join'](_0xee5a48,_0x3106a9))&&_0x5b41b4){fs[_0xc302('0x36')](path[_0xc302('0x29')](_0xee5a48,_0x3106a9));}return Promise['all'](_0xc05f4f);})[_0xc302('0x2e')](function(_0x280616){return createTables(_[_0xc302('0x37')](_0x280616));})[_0xc302('0x2e')](function(_0x2fa905){var _0xbcffb7=getPDFDocDefinition(_0x2fa905);var _0x44ee11=getPDFPrinter();var _0x54adde=_0x44ee11[_0xc302('0x38')](_0xbcffb7);if(_0x5b41b4)_0xa1faac=path[_0xc302('0x29')](_0xee5a48,_0x3106a9,util['format'](_0xc302('0x39'),_0x3106a9,index,'pdf'));return writePDFDocument(_0x54adde,_0xa1faac);})['then'](function(){if(!_0x5b41b4)return;zipdir(path[_0xc302('0x29')](_0xee5a48,_0x3106a9),{'saveTo':path['join'](_0xee5a48,util[_0xc302('0x19')](_0xc302('0x2a'),_0x3106a9,_0xc302('0x3a')))},function(_0x306ff8){if(_0x306ff8)throw _0x306ff8;return;});})[_0xc302('0x2e')](function(){if(!_0x5b41b4)return;rimraf(path[_0xc302('0x29')](_0xee5a48,_0x3106a9),function(){});})[_0xc302('0x2e')](function(){logger[_0xc302('0x3b')](util[_0xc302('0x19')](_0xc302('0x3c'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xc302('0x3d'),_0x5b41b4?util[_0xc302('0x19')]('%s.%s',_0x3106a9,_0x5b41b4?'zip':_0xc302('0x2b')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xc302('0x3b')](util[_0xc302('0x19')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db['AnalyticExtractedReport'][_0xc302('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xc302('0x2e')](function(_0x1e2fa1){EXTRACTED_REPORT=_0x1e2fa1;return dbH[_0xc302('0x32')][_0xc302('0x30')](util['format'](_0xc302('0x3f'),QUERY),{'type':dbH['sequelize'][_0xc302('0x33')][_0xc302('0x34')]});})['then'](extractReport)['catch'](function(_0x59a28f){logger[_0xc302('0x3b')](util['format'](_0xc302('0x40'),EXTRACTED_REPORT_ID,_0xc302('0x41')),util[_0xc302('0x42')](_0x59a28f,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main();function getPDFPrinter(){var _0x39f7e2=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xc302('0x43'),'italics':__dirname+_0xc302('0x44'),'bolditalics':__dirname+_0xc302('0x45')}});return _0x39f7e2;}function getPDFDocDefinitionFromHTML(_0x492fb6,_0x59ca23){var _0x187551=util[_0xc302('0x19')](_0xc302('0x46'),_0x59ca23[_0xc302('0x47')],_0x59ca23[_0xc302('0x48')]);var _0x3f7b0f=moment()[_0xc302('0x19')](_0xc302('0x49'))[_0xc302('0x4a')]();var _0x4728eb=htmlToPdfmake(_0x492fb6,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4728eb],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xc302('0x4b'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xc302('0x4b'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xc302('0x4b')}},'header':function(){return[{'text':_0xc302('0x4c'),'style':_0xc302('0x4d')}];},'footer':function(_0x2bf648,_0x10be8a){return[{'text':util[_0xc302('0x19')](_0xc302('0x4e'),_0x187551,_0x2bf648,_0x10be8a,_0x3f7b0f),'style':_0xc302('0x20')}];}};}function writePDFDocument(_0x4e3aac,_0xb60332){return new Promise(function(_0x3ed6fb,_0x5ba0a1){var _0x32a18e=_0x4e3aac[_0xc302('0x4f')](fs[_0xc302('0x50')](_0xb60332));_0x32a18e['on']('finish',function(){_0x3ed6fb(_0xc302('0x51'));});_0x32a18e['on'](_0xc302('0x52'),function(_0xcabb58){_0x5ba0a1(_0xcabb58);});_0x4e3aac[_0xc302('0x53')]();});}exports[_0xc302('0x54')]=function(_0x2ebe7a,_0x5e8c5b){var _0x18d40b=getPDFPrinter();var _0x5f16a1=getPDFDocDefinitionFromHTML(_0x2ebe7a,_0x5e8c5b);var _0x5baf6d=_0x18d40b[_0xc302('0x38')](_0x5f16a1);return writePDFDocument(_0x5baf6d,_0x5e8c5b[_0xc302('0x2')])[_0xc302('0x55')](function(_0x3b38d8){throw _0x3b38d8;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index c997d98..1ac87b9 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 _0xe944=['Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','inspect','util','json2xls','rimraf','dbH','../../config/logger','analytics','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push','basename','.xlsx','existsSync','mkdirSync','join','each','%s%d.%s','%s.%s','xlsx','binary','zip'];(function(_0x2c1088,_0x51dde1){var _0x4a14fb=function(_0x68977e){while(--_0x68977e){_0x2c1088['push'](_0x2c1088['shift']());}};_0x4a14fb(++_0x51dde1);}(_0xe944,0x174));var _0x4e94=function(_0xf79cf2,_0x49a442){_0xf79cf2=_0xf79cf2-0x0;var _0x451a97=_0xe944[_0xf79cf2];return _0x451a97;};'use strict';var util=require(_0x4e94('0x0'));var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require(_0x4e94('0x1'));var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x4e94('0x2'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x4e94('0x3')];var logger=require(_0x4e94('0x4'))(_0x4e94('0x5'));var EXTRACTED_REPORT_ID=Number(process[_0x4e94('0x6')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x4e94('0x6')][0x4];function analyticExtractedReport(_0x28a1fd,_0x175b42){var _0x32bb46={'status':_0x28a1fd};var _0x5a5823={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x175b42){_0x32bb46[_0x4e94('0x7')]=_0x175b42;}return db['AnalyticExtractedReport'][_0x4e94('0x8')](_0x32bb46,_0x5a5823);}function main(){var _0xedf796=0x1388;var _0x307c47;logger[_0x4e94('0x9')](util['format'](_0x4e94('0xa'),EXTRACTED_REPORT_ID,_0x4e94('0xb')));return db[_0x4e94('0xc')][_0x4e94('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4e94('0xe'),_0x4e94('0xf')]})[_0x4e94('0x10')](function(_0x5b7b98){if(_0x5b7b98){_0x307c47=_0x5b7b98;_0xedf796=_0x307c47['splitSizeXlsx']||0x1388;}})[_0x4e94('0x10')](function(){return dbH[_0x4e94('0x11')][_0x4e94('0x12')](util[_0x4e94('0x13')](_0x4e94('0x14'),QUERY),{'type':dbH['sequelize'][_0x4e94('0x15')][_0x4e94('0x16')]});})[_0x4e94('0x10')](function(_0x17d5a9){if(!_0x17d5a9[0x0][_0x4e94('0x17')]){return analyticExtractedReport(_0x4e94('0x18'));}var _0x22b4ca=[];var _0x31dfd1=0x0;var _0xab0a8a=!![];if(_0x307c47[_0x4e94('0xe')]){if(_0x17d5a9&&_0x17d5a9[_0x4e94('0x19')]){var _0x41d8dc=_0x17d5a9[0x0]['num']%(_0x31dfd1+_0xedf796);for(;_0xab0a8a;_0x31dfd1+=_0xedf796,_0x41d8dc=_0x17d5a9[0x0]['num']%(_0x31dfd1+_0xedf796)){if(_0x41d8dc==0x0||_0x41d8dc==_0x17d5a9[0x0][_0x4e94('0x17')]){_0xab0a8a=![];}_0x22b4ca[_0x4e94('0x1a')](dbH[_0x4e94('0x11')][_0x4e94('0x12')](util[_0x4e94('0x13')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xedf796,_0x31dfd1),{'type':dbH[_0x4e94('0x11')][_0x4e94('0x15')][_0x4e94('0x16')]}));}}}else{_0x22b4ca[_0x4e94('0x1a')](dbH['sequelize'][_0x4e94('0x12')](QUERY,{'type':dbH['sequelize'][_0x4e94('0x15')][_0x4e94('0x16')]}));}var _0x563572=path['dirname'](PATH);var _0xf03522=path[_0x4e94('0x1b')](PATH,_0x4e94('0x1c'));var _0x3bb05b=_0x307c47[_0x4e94('0xe')]&&_0x22b4ca[_0x4e94('0x19')]>0x1;var _0x2edbd5=[];if(!fs[_0x4e94('0x1d')](path['join'](_0x563572,_0xf03522))&&_0x3bb05b){fs[_0x4e94('0x1e')](path[_0x4e94('0x1f')](_0x563572,_0xf03522));}return BPromise[_0x4e94('0x20')](_0x22b4ca,function(_0x57178a){_0x2edbd5[_0x4e94('0x1a')](_0x57178a);})['then'](function(){for(var _0x52c7f8=0x0;_0x52c7f8<_0x2edbd5[_0x4e94('0x19')];_0x52c7f8+=0x1){var _0x3e8f86;var _0x4a0f22=_0x2edbd5[_0x52c7f8];if(_0x3bb05b){_0x3e8f86=path[_0x4e94('0x1f')](_0x563572,_0xf03522,util[_0x4e94('0x13')](_0x4e94('0x21'),_0xf03522,_0x52c7f8,'xlsx'));}else{_0x3e8f86=path[_0x4e94('0x1f')](_0x563572,util[_0x4e94('0x13')](_0x4e94('0x22'),_0xf03522,_0x4e94('0x23')));}fs['writeFileSync'](_0x3e8f86,json2xls(_0x4a0f22),_0x4e94('0x24'));}})[_0x4e94('0x10')](function(){if(_0x3bb05b){zipdir(path[_0x4e94('0x1f')](_0x563572,_0xf03522),{'saveTo':path[_0x4e94('0x1f')](_0x563572,util[_0x4e94('0x13')](_0x4e94('0x22'),_0xf03522,_0x4e94('0x25')))},function(_0x42ea2a,_0x42e326){});rimraf(path['join'](_0x563572,_0xf03522),function(){});}})[_0x4e94('0x10')](function(){logger[_0x4e94('0x9')](util[_0x4e94('0x13')](_0x4e94('0x26'),EXTRACTED_REPORT_ID,_0x4e94('0xb')));return analyticExtractedReport(_0x4e94('0x27'),_0x3bb05b?util[_0x4e94('0x13')]('%s.%s',_0xf03522,_0x3bb05b?_0x4e94('0x25'):_0x4e94('0x23')):null);});})['catch'](function(_0x3143db){logger[_0x4e94('0x9')](util[_0x4e94('0x13')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0x4e94('0x28')](_0x3143db,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0xda58=['sequelize','SELECT','num','Empty','length','push','query','format','QueryTypes','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Completed','Failed','util','path','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xda58,0x1c5));var _0x8da5=function(_0x5ce5a1,_0x3c3f85){_0x5ce5a1=_0x5ce5a1-0x0;var _0x114bc6=_0xda58[_0x5ce5a1];return _0x114bc6;};'use strict';var util=require(_0x8da5('0x0'));var path=require(_0x8da5('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x8da5('0x2'));var BPromise=require(_0x8da5('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x8da5('0x4'));var db=require(_0x8da5('0x5'))['db'];var dbH=require(_0x8da5('0x5'))[_0x8da5('0x6')];var logger=require(_0x8da5('0x7'))(_0x8da5('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x8da5('0x9')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x3aaf0a,_0x28287b){var _0xbe84be={'status':_0x3aaf0a};var _0x4be51a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x28287b){_0xbe84be[_0x8da5('0xa')]=_0x28287b;}return db['AnalyticExtractedReport']['update'](_0xbe84be,_0x4be51a);}function main(){var _0x2973cd=0x1388;var _0x57829f;logger[_0x8da5('0xb')](util['format'](_0x8da5('0xc'),EXTRACTED_REPORT_ID,_0x8da5('0xd')));return db[_0x8da5('0xe')][_0x8da5('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8da5('0x10'),_0x8da5('0x11')]})[_0x8da5('0x12')](function(_0x960bab){if(_0x960bab){_0x57829f=_0x960bab;_0x2973cd=_0x57829f[_0x8da5('0x11')]||0x1388;}})[_0x8da5('0x12')](function(){return dbH['sequelize']['query'](util['format'](_0x8da5('0x13'),QUERY),{'type':dbH[_0x8da5('0x14')]['QueryTypes'][_0x8da5('0x15')]});})['then'](function(_0x3c5065){if(!_0x3c5065[0x0][_0x8da5('0x16')]){return analyticExtractedReport(_0x8da5('0x17'));}var _0xf298c0=[];var _0x2192f5=0x0;var _0x179584=!![];if(_0x57829f[_0x8da5('0x10')]){if(_0x3c5065&&_0x3c5065[_0x8da5('0x18')]){var _0x4419e1=_0x3c5065[0x0][_0x8da5('0x16')]%(_0x2192f5+_0x2973cd);for(;_0x179584;_0x2192f5+=_0x2973cd,_0x4419e1=_0x3c5065[0x0]['num']%(_0x2192f5+_0x2973cd)){if(_0x4419e1==0x0||_0x4419e1==_0x3c5065[0x0][_0x8da5('0x16')]){_0x179584=![];}_0xf298c0[_0x8da5('0x19')](dbH[_0x8da5('0x14')][_0x8da5('0x1a')](util[_0x8da5('0x1b')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2973cd,_0x2192f5),{'type':dbH[_0x8da5('0x14')]['QueryTypes'][_0x8da5('0x15')]}));}}}else{_0xf298c0[_0x8da5('0x19')](dbH[_0x8da5('0x14')]['query'](QUERY,{'type':dbH[_0x8da5('0x14')][_0x8da5('0x1c')][_0x8da5('0x15')]}));}var _0x197c00=path['dirname'](PATH);var _0x1c5a86=path[_0x8da5('0x1d')](PATH,_0x8da5('0x1e'));var _0x4e066f=_0x57829f[_0x8da5('0x10')]&&_0xf298c0[_0x8da5('0x18')]>0x1;var _0x4b5ffb=[];if(!fs[_0x8da5('0x1f')](path[_0x8da5('0x20')](_0x197c00,_0x1c5a86))&&_0x4e066f){fs[_0x8da5('0x21')](path[_0x8da5('0x20')](_0x197c00,_0x1c5a86));}return BPromise[_0x8da5('0x22')](_0xf298c0,function(_0x325d2d){_0x4b5ffb[_0x8da5('0x19')](_0x325d2d);})[_0x8da5('0x12')](function(){for(var _0x5c447e=0x0;_0x5c447e<_0x4b5ffb[_0x8da5('0x18')];_0x5c447e+=0x1){var _0x276a95;var _0x13f403=_0x4b5ffb[_0x5c447e];if(_0x4e066f){_0x276a95=path[_0x8da5('0x20')](_0x197c00,_0x1c5a86,util[_0x8da5('0x1b')](_0x8da5('0x23'),_0x1c5a86,_0x5c447e,_0x8da5('0x24')));}else{_0x276a95=path['join'](_0x197c00,util[_0x8da5('0x1b')](_0x8da5('0x25'),_0x1c5a86,_0x8da5('0x24')));}fs[_0x8da5('0x26')](_0x276a95,json2xls(_0x13f403),_0x8da5('0x27'));}})[_0x8da5('0x12')](function(){if(_0x4e066f){zipdir(path[_0x8da5('0x20')](_0x197c00,_0x1c5a86),{'saveTo':path[_0x8da5('0x20')](_0x197c00,util['format'](_0x8da5('0x25'),_0x1c5a86,_0x8da5('0x28')))},function(_0xd846f9,_0x357286){});rimraf(path[_0x8da5('0x20')](_0x197c00,_0x1c5a86),function(){});}})['then'](function(){logger[_0x8da5('0xb')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x8da5('0x29'),_0x4e066f?util[_0x8da5('0x1b')](_0x8da5('0x25'),_0x1c5a86,_0x4e066f?'zip':'xlsx'):null);});})['catch'](function(_0x5977ca){logger['info'](util[_0x8da5('0x1b')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8da5('0xd')),util['inspect'](_0x5977ca,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x8da5('0x2a'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 3c22700..fbfd6d4 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 _0xb84e=['models','VoiceExtension','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','hasOwnProperty','priority','extensions','extension','push','type','format','CDR(type)=%s','context','VoiceExtensionId','outbound','Set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','createdAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','toLowerCase','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','catch','error','rewrite','util','findAll','then','intervals'];(function(_0x491ec2,_0x540c00){var _0x1748db=function(_0x5a6258){while(--_0x5a6258){_0x491ec2['push'](_0x491ec2['shift']());}};_0x1748db(++_0x540c00);}(_0xb84e,0xbf));var _0xeb84=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xb84e[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require(_0xeb84('0x0'));function rewrite(_0x6bfa05,_0x3b2c5c){var _0x3f8a53=this;return _0x6bfa05['models']['Interval'][_0xeb84('0x1')]({'raw':!![]})[_0xeb84('0x2')](function(_0x1b956e){_0x3f8a53[_0xeb84('0x3')]=_0x1b956e;return _0x6bfa05[_0xeb84('0x4')][_0xeb84('0x5')]['findAll']({'where':{'IntervalId':_0x3b2c5c['IntervalId']},'raw':!![]});})[_0xeb84('0x2')](function(_0x4cd86e){return _0x6bfa05[_0xeb84('0x4')][_0xeb84('0x5')][_0xeb84('0x1')]({'where':{'exten':{'$in':_[_0xeb84('0x6')](_['map'](_0x4cd86e,_0xeb84('0x7')))}},'order':[{'raw':_0xeb84('0x8')}],'raw':!![]});})[_0xeb84('0x2')](function(_0x2d81e5){var _0x2839ec=_[_0xeb84('0x9')](_0x2d81e5,{'priority':'1'});var _0x3f38d4=_[_0xeb84('0x9')](_0x2d81e5,{'isApp':0x1});var _0x179a1a=_[_0xeb84('0xa')](_0x3f38d4,_0xeb84('0x7'));var _0x2b884e=[_0xeb84('0xb'),'playback'];var _0x5bab5f=[];var _0x252937=[];for(var _0x357214 in _0x179a1a){if(_0x179a1a[_0xeb84('0xc')](_0x357214)){_0x3f8a53[_0xeb84('0xd')]=0x2;_0x3f8a53[_0xeb84('0xe')]=[];_0x3f8a53[_0xeb84('0xf')]=_['find'](_0x2839ec,{'exten':_0x179a1a[_0x357214][0x0][_0xeb84('0x7')]});_0x3f8a53[_0xeb84('0xe')][_0xeb84('0x10')]({'type':_0x179a1a[_0x357214][0x0][_0xeb84('0x11')],'app':'Set','appdata':util[_0xeb84('0x12')](_0xeb84('0x13'),_0x179a1a[_0x357214][0x0][_0xeb84('0x11')]),'context':_0x179a1a[_0x357214][0x0][_0xeb84('0x14')],'exten':_0x179a1a[_0x357214][0x0][_0xeb84('0x7')],'priority':_0x3f8a53['priority']++,'VoiceExtensionId':_0x179a1a[_0x357214][0x0][_0xeb84('0x15')]});if(_0x179a1a[_0x357214][0x0]['type']===_0xeb84('0x16')){if(_0x3f8a53[_0xeb84('0xf')]){_0x3f8a53[_0xeb84('0xe')]['push']({'type':_0x179a1a[_0x357214][0x0]['type'],'app':_0xeb84('0x17'),'appdata':_0xeb84('0x18')+(_0x3f8a53[_0xeb84('0xf')][_0xeb84('0x19')]?_0xeb84('0x1a')+_0x3f8a53[_0xeb84('0xf')][_0xeb84('0x19')]+'}':_0xeb84('0x1b')),'context':_0x179a1a[_0x357214][0x0][_0xeb84('0x14')],'exten':_0x179a1a[_0x357214][0x0][_0xeb84('0x7')],'priority':_0x3f8a53[_0xeb84('0xd')]++,'VoiceExtensionId':_0x179a1a[_0x357214][0x0][_0xeb84('0x15')]});}_0x3f8a53[_0xeb84('0xe')][_0xeb84('0x10')]({'type':_0x179a1a[_0x357214][0x0][_0xeb84('0x11')],'app':_0xeb84('0x17'),'appdata':'CDR(routeid)='+_0x179a1a[_0x357214][0x0][_0xeb84('0x15')],'context':_0x179a1a[_0x357214][0x0][_0xeb84('0x14')],'exten':_0x179a1a[_0x357214][0x0]['exten'],'priority':_0x3f8a53[_0xeb84('0xd')]++,'VoiceExtensionId':_0x179a1a[_0x357214][0x0][_0xeb84('0x15')]});var _0x95231=_0x3f8a53[_0xeb84('0xd')]++;_0x3f8a53[_0xeb84('0xe')][_0xeb84('0x10')]({'type':_0x179a1a[_0x357214][0x0][_0xeb84('0x11')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x95231+0x2)+_0xeb84('0x1c')+(_0x95231+0x1)+')','context':_0x179a1a[_0x357214][0x0][_0xeb84('0x14')],'exten':_0x179a1a[_0x357214][0x0][_0xeb84('0x7')],'priority':_0x95231,'VoiceExtensionId':_0x179a1a[_0x357214][0x0][_0xeb84('0x15')]});if(_0x3f8a53[_0xeb84('0xf')]){_0x3f8a53[_0xeb84('0xe')][_0xeb84('0x10')]({'type':_0x179a1a[_0x357214][0x0][_0xeb84('0x11')],'app':_0xeb84('0x17'),'appdata':_0x3f8a53[_0xeb84('0xf')][_0xeb84('0x19')]?_0xeb84('0x1d')+_0x3f8a53[_0xeb84('0xf')][_0xeb84('0x19')]+'}':'CDR(prefix)=noprefix','context':_0x179a1a[_0x357214][0x0][_0xeb84('0x14')],'exten':_0x179a1a[_0x357214][0x0][_0xeb84('0x7')],'priority':_0x3f8a53[_0xeb84('0xd')]++,'VoiceExtensionId':_0x179a1a[_0x357214][0x0][_0xeb84('0x15')]});}_0x3f8a53[_0xeb84('0xe')][_0xeb84('0x10')]({'type':_0x179a1a[_0x357214][0x0][_0xeb84('0x11')],'app':_0xeb84('0x17'),'appdata':_0xeb84('0x1e')+_0x179a1a[_0x357214][0x0][_0xeb84('0x15')],'context':_0x179a1a[_0x357214][0x0][_0xeb84('0x14')],'exten':_0x179a1a[_0x357214][0x0]['exten'],'priority':_0x3f8a53['priority']++,'VoiceExtensionId':_0x179a1a[_0x357214][0x0][_0xeb84('0x15')]});if(_0x3f8a53['extension']&&_0x3f8a53[_0xeb84('0xf')][_0xeb84('0xc')](_0xeb84('0x1f'))&&_0x3f8a53[_0xeb84('0xf')]['recordingFormat']!=='none'){_0x3f8a53[_0xeb84('0xe')][_0xeb84('0x10')]({'type':_0x179a1a[_0x357214][0x0]['type'],'app':_0xeb84('0x17'),'appdata':_0xeb84('0x20'),'context':_0x179a1a[_0x357214][0x0]['context'],'exten':_0x179a1a[_0x357214][0x0][_0xeb84('0x7')],'priority':_0x3f8a53[_0xeb84('0xd')]++,'VoiceExtensionId':_0x179a1a[_0x357214][0x0]['VoiceExtensionId']});_0x3f8a53[_0xeb84('0xe')]['push']({'type':_0x179a1a[_0x357214][0x0]['type'],'app':_0xeb84('0x17'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x3f8a53[_0xeb84('0xf')][_0xeb84('0x1f')]||_0xeb84('0x21'),'context':_0x179a1a[_0x357214][0x0][_0xeb84('0x14')],'exten':_0x179a1a[_0x357214][0x0]['exten'],'priority':_0x3f8a53[_0xeb84('0xd')]++,'VoiceExtensionId':_0x179a1a[_0x357214][0x0]['VoiceExtensionId']});}}_0x3f8a53[_0xeb84('0xe')][_0xeb84('0x10')]({'type':_0x179a1a[_0x357214][0x0][_0xeb84('0x11')],'app':_0xeb84('0x17'),'appdata':_0xeb84('0x22'),'context':_0x179a1a[_0x357214][0x0][_0xeb84('0x14')],'exten':_0x179a1a[_0x357214][0x0][_0xeb84('0x7')],'priority':_0x3f8a53[_0xeb84('0xd')]++,'VoiceExtensionId':_0x179a1a[_0x357214][0x0]['VoiceExtensionId']});_0x3f8a53[_0xeb84('0xe')][_0xeb84('0x10')]({'type':_0x179a1a[_0x357214][0x0][_0xeb84('0x11')],'app':_0xeb84('0x17'),'appdata':_0xeb84('0x23'),'context':_0x179a1a[_0x357214][0x0][_0xeb84('0x14')],'exten':_0x179a1a[_0x357214][0x0]['exten'],'priority':_0x3f8a53['priority']++,'VoiceExtensionId':_0x179a1a[_0x357214][0x0][_0xeb84('0x15')]});_0x3f8a53['extensions'][_0xeb84('0x10')]({'type':_0x179a1a[_0x357214][0x0][_0xeb84('0x11')],'app':_0xeb84('0x17'),'appdata':'MONITOR_OPTIONS=ab','context':_0x179a1a[_0x357214][0x0][_0xeb84('0x14')],'exten':_0x179a1a[_0x357214][0x0][_0xeb84('0x7')],'priority':_0x3f8a53[_0xeb84('0xd')]++,'VoiceExtensionId':_0x179a1a[_0x357214][0x0]['VoiceExtensionId']});for(var _0x3dd3bc=0x0,_0x5e0b95=0x0;_0x3dd3bc<_0x179a1a[_0x357214][_0xeb84('0x24')];_0x3dd3bc+=0x1,_0x5e0b95=0x0){var _0x4867b7=_0x179a1a[_0x357214][_0x3dd3bc];if(_0x4867b7[_0xeb84('0x11')]){_0x4867b7[_0xeb84('0x11')]=_0x4867b7['type']['toLowerCase']();}var _0x6f1442=[];var _0x10b6a4=[];delete _0x4867b7['id'];delete _0x4867b7[_0xeb84('0x25')];delete _0x4867b7['updatedAt'];var _0x4eb810=_0x4867b7[_0xeb84('0x26')]!==_0xeb84('0x27')?[_0x4867b7['interval']]:_0x4867b7[_0xeb84('0x28')]?_['map'](_[_0xeb84('0x9')](_0x3f8a53[_0xeb84('0x3')],{'IntervalId':_0x4867b7['IntervalId']}),_0xeb84('0x26')):[];if(_0x4867b7[_0xeb84('0xc')](_0xeb84('0x29'))){if(_0x4867b7[_0xeb84('0x29')]&&_0x4867b7[_0xeb84('0x29')]!=='--'){_0x6f1442[_0xeb84('0x10')]({'type':_0x4867b7['type'],'app':_0xeb84('0x17'),'appdata':_0xeb84('0x2a')+_0x4867b7['tag'],'context':_0x4867b7[_0xeb84('0x14')],'exten':_0x4867b7['exten'],'priority':_0x4eb810['length']+_0x3f8a53[_0xeb84('0xd')]+_0x5e0b95++,'VoiceExtensionId':_0x4867b7[_0xeb84('0x15')]});}}if(_0x4867b7[_0xeb84('0x11')]===_0xeb84('0x16')&&_0x4867b7['hasOwnProperty'](_0xeb84('0x2b'))){if(_0x4867b7[_0xeb84('0x2b')]){_0x6f1442[_0xeb84('0x10')]({'type':_0x4867b7[_0xeb84('0x11')],'app':_0xeb84('0x2c'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x4867b7[_0xeb84('0x2b')]+')','context':_0x4867b7['context'],'exten':_0x4867b7['exten'],'priority':_0x4eb810['length']+_0x3f8a53[_0xeb84('0xd')]+_0x5e0b95++,'VoiceExtensionId':_0x4867b7[_0xeb84('0x15')]});}else{_0x6f1442[_0xeb84('0x10')]({'type':_0x4867b7['type'],'app':_0xeb84('0x2c'),'appdata':_0xeb84('0x2d'),'context':_0x4867b7[_0xeb84('0x14')],'exten':_0x4867b7[_0xeb84('0x7')],'priority':_0x4eb810[_0xeb84('0x24')]+_0x3f8a53['priority']+_0x5e0b95++,'VoiceExtensionId':_0x4867b7['VoiceExtensionId']});}}if(_0x4867b7['hasOwnProperty']('answer')){if(_0x2b884e[_0xeb84('0x2e')](_0x4867b7[_0xeb84('0x2f')][_0xeb84('0x30')]())>=0x0&&_0x4867b7['appType']!==_0xeb84('0x31')){if(_0x4867b7[_0xeb84('0x32')]){_0x6f1442['push']({'type':_0x4867b7['type'],'app':_0xeb84('0x2c'),'appdata':_0xeb84('0x33'),'context':_0x4867b7['context'],'exten':_0x4867b7['exten'],'priority':_0x4eb810[_0xeb84('0x24')]+_0x3f8a53['priority']+_0x5e0b95++,'VoiceExtensionId':_0x4867b7[_0xeb84('0x15')]});_0x6f1442['push']({'type':_0x4867b7['type'],'app':_0xeb84('0x17'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x4867b7[_0xeb84('0x14')],'exten':_0x4867b7[_0xeb84('0x7')],'priority':_0x4eb810[_0xeb84('0x24')]+_0x3f8a53['priority']+_0x5e0b95++,'VoiceExtensionId':_0x4867b7[_0xeb84('0x15')]});}else{_0x6f1442['push']({'type':_0x4867b7['type'],'app':_0xeb84('0x2c'),'appdata':_0xeb84('0x34'),'context':_0x4867b7['context'],'exten':_0x4867b7['exten'],'priority':_0x4eb810['length']+_0x3f8a53['priority']+_0x5e0b95++,'VoiceExtensionId':_0x4867b7[_0xeb84('0x15')]});_0x6f1442[_0xeb84('0x10')]({'type':_0x4867b7[_0xeb84('0x11')],'app':_0xeb84('0x17'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x4867b7[_0xeb84('0x14')],'exten':_0x4867b7[_0xeb84('0x7')],'priority':_0x4eb810['length']+_0x3f8a53[_0xeb84('0xd')]+_0x5e0b95++,'VoiceExtensionId':_0x4867b7[_0xeb84('0x15')]});}}}for(var _0x3eaed5=0x0;_0x3eaed5<_0x4eb810[_0xeb84('0x24')];_0x3eaed5+=0x1){var _0x5a7391=_0x3f8a53[_0xeb84('0xd')]+_0x4eb810['length'];var _0x3d394a=_0x3eaed5===_0x4eb810[_0xeb84('0x24')]-0x1?_0x3f8a53[_0xeb84('0xd')]+_0x6f1442['length']+_0x10b6a4[_0xeb84('0x24')]+0x2:_0x3f8a53[_0xeb84('0xd')]+_0x3eaed5+0x1;_0x6f1442[_0xeb84('0x35')](_0x3eaed5,0x0,{'type':_0x4867b7[_0xeb84('0x11')],'app':_0xeb84('0x36'),'appdata':_0x4eb810[_0x3eaed5]+'?'+_0x4867b7[_0xeb84('0x14')]+_0xeb84('0x37')+_0x5a7391+':'+_0x4867b7[_0xeb84('0x14')]+_0xeb84('0x37')+_0x3d394a,'exten':_0x4867b7[_0xeb84('0x7')],'context':_0x4867b7['context'],'priority':_0x3f8a53['priority']+_0x3eaed5,'VoiceExtensionId':_0x179a1a[_0x357214][0x0][_0xeb84('0x15')]});}_0x4867b7[_0xeb84('0xd')]=_0x6f1442[_0xeb84('0x24')]?_[_0xeb84('0x38')](_0x6f1442)[_0xeb84('0xd')]+0x1:_0x3f8a53[_0xeb84('0xd')];_0x3f8a53[_0xeb84('0xd')]=(_0x10b6a4[_0xeb84('0x24')]?_['last'](_0x10b6a4)['priority']:_0x4867b7[_0xeb84('0xd')])+0x1;_0x3f8a53[_0xeb84('0xe')]=_[_0xeb84('0x39')](_0x3f8a53[_0xeb84('0xe')],_0x6f1442,[_0x4867b7],_0x10b6a4);}_0x3f8a53[_0xeb84('0xe')]['push']({'type':_0x179a1a[_0x357214][0x0][_0xeb84('0x11')],'app':_0xeb84('0x3a'),'exten':_0x179a1a[_0x357214][0x0][_0xeb84('0x7')],'context':_0x179a1a[_0x357214][0x0]['context'],'priority':_0x3f8a53[_0xeb84('0xd')],'VoiceExtensionId':_0x179a1a[_0x357214][0x0]['VoiceExtensionId']});_0x5bab5f['push'](_0x179a1a[_0x357214][0x0][_0xeb84('0x15')]);_0x252937=_['concat'](_0x252937,_0x3f8a53[_0xeb84('0xe')]);}}return _0x6bfa05['transaction'](function(_0x4cad66){return _0x6bfa05['models']['VoiceExtension'][_0xeb84('0x3b')]({'where':{'VoiceExtensionId':{'$in':_0x5bab5f}},'transaction':_0x4cad66})[_0xeb84('0x2')](function(_0x10214d){return _0x6bfa05['models'][_0xeb84('0x5')][_0xeb84('0x3c')](_[_0xeb84('0x3d')](_0x252937,_0xeb84('0xd')),{'transaction':_0x4cad66});});});})[_0xeb84('0x3e')](function(_0x5f41f0){console[_0xeb84('0x3f')](_0x5f41f0);});}exports[_0xeb84('0x40')]=rewrite; \ No newline at end of file +var _0xceda=['interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','Hangup','concat','transaction','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','context','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','VoiceExtensionId','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt'];(function(_0x381fa6,_0x5532d9){var _0x488bb5=function(_0x271fc9){while(--_0x271fc9){_0x381fa6['push'](_0x381fa6['shift']());}};_0x488bb5(++_0x5532d9);}(_0xceda,0x1c4));var _0xaced=function(_0x168eb9,_0x525115){_0x168eb9=_0x168eb9-0x0;var _0x275d90=_0xceda[_0x168eb9];return _0x275d90;};'use strict';var _=require(_0xaced('0x0'));var util=require(_0xaced('0x1'));function rewrite(_0x4ab563,_0x261f5e){var _0x34073c=this;return _0x4ab563[_0xaced('0x2')][_0xaced('0x3')][_0xaced('0x4')]({'raw':!![]})[_0xaced('0x5')](function(_0xcf5a01){_0x34073c[_0xaced('0x6')]=_0xcf5a01;return _0x4ab563[_0xaced('0x2')][_0xaced('0x7')]['findAll']({'where':{'IntervalId':_0x261f5e[_0xaced('0x8')]},'raw':!![]});})['then'](function(_0x5ef911){return _0x4ab563['models'][_0xaced('0x7')]['findAll']({'where':{'exten':{'$in':_[_0xaced('0x9')](_[_0xaced('0xa')](_0x5ef911,_0xaced('0xb')))}},'order':[{'raw':_0xaced('0xc')}],'raw':!![]});})['then'](function(_0x3c1f12){var _0x3c58d2=_[_0xaced('0xd')](_0x3c1f12,{'priority':'1'});var _0x43d165=_[_0xaced('0xd')](_0x3c1f12,{'isApp':0x1});var _0x40ce48=_[_0xaced('0xe')](_0x43d165,_0xaced('0xb'));var _0x2e3c82=[_0xaced('0xf'),'playback'];var _0x165f04=[];var _0xe9002f=[];for(var _0x8488b9 in _0x40ce48){if(_0x40ce48[_0xaced('0x10')](_0x8488b9)){_0x34073c[_0xaced('0x11')]=0x2;_0x34073c[_0xaced('0x12')]=[];_0x34073c[_0xaced('0x13')]=_[_0xaced('0x14')](_0x3c58d2,{'exten':_0x40ce48[_0x8488b9][0x0]['exten']});_0x34073c['extensions'][_0xaced('0x15')]({'type':_0x40ce48[_0x8488b9][0x0][_0xaced('0x16')],'app':_0xaced('0x17'),'appdata':util[_0xaced('0x18')]('CDR(type)=%s',_0x40ce48[_0x8488b9][0x0]['type']),'context':_0x40ce48[_0x8488b9][0x0][_0xaced('0x19')],'exten':_0x40ce48[_0x8488b9][0x0]['exten'],'priority':_0x34073c[_0xaced('0x11')]++,'VoiceExtensionId':_0x40ce48[_0x8488b9][0x0]['VoiceExtensionId']});if(_0x40ce48[_0x8488b9][0x0][_0xaced('0x16')]===_0xaced('0x1a')){if(_0x34073c[_0xaced('0x13')]){_0x34073c['extensions'][_0xaced('0x15')]({'type':_0x40ce48[_0x8488b9][0x0][_0xaced('0x16')],'app':_0xaced('0x17'),'appdata':_0xaced('0x1b')+(_0x34073c[_0xaced('0x13')]['cutdigits']?_0xaced('0x1c')+_0x34073c[_0xaced('0x13')][_0xaced('0x1d')]+'}':_0xaced('0x1e')),'context':_0x40ce48[_0x8488b9][0x0][_0xaced('0x19')],'exten':_0x40ce48[_0x8488b9][0x0][_0xaced('0xb')],'priority':_0x34073c[_0xaced('0x11')]++,'VoiceExtensionId':_0x40ce48[_0x8488b9][0x0][_0xaced('0x1f')]});}_0x34073c['extensions'][_0xaced('0x15')]({'type':_0x40ce48[_0x8488b9][0x0][_0xaced('0x16')],'app':_0xaced('0x17'),'appdata':_0xaced('0x20')+_0x40ce48[_0x8488b9][0x0][_0xaced('0x1f')],'context':_0x40ce48[_0x8488b9][0x0][_0xaced('0x19')],'exten':_0x40ce48[_0x8488b9][0x0][_0xaced('0xb')],'priority':_0x34073c[_0xaced('0x11')]++,'VoiceExtensionId':_0x40ce48[_0x8488b9][0x0]['VoiceExtensionId']});var _0x37c039=_0x34073c[_0xaced('0x11')]++;_0x34073c[_0xaced('0x12')][_0xaced('0x15')]({'type':_0x40ce48[_0x8488b9][0x0][_0xaced('0x16')],'app':'ExecIf','appdata':_0xaced('0x21')+(_0x37c039+0x2)+_0xaced('0x22')+(_0x37c039+0x1)+')','context':_0x40ce48[_0x8488b9][0x0][_0xaced('0x19')],'exten':_0x40ce48[_0x8488b9][0x0][_0xaced('0xb')],'priority':_0x37c039,'VoiceExtensionId':_0x40ce48[_0x8488b9][0x0][_0xaced('0x1f')]});if(_0x34073c[_0xaced('0x13')]){_0x34073c['extensions'][_0xaced('0x15')]({'type':_0x40ce48[_0x8488b9][0x0][_0xaced('0x16')],'app':_0xaced('0x17'),'appdata':_0x34073c[_0xaced('0x13')][_0xaced('0x1d')]?_0xaced('0x23')+_0x34073c[_0xaced('0x13')][_0xaced('0x1d')]+'}':_0xaced('0x24'),'context':_0x40ce48[_0x8488b9][0x0][_0xaced('0x19')],'exten':_0x40ce48[_0x8488b9][0x0][_0xaced('0xb')],'priority':_0x34073c[_0xaced('0x11')]++,'VoiceExtensionId':_0x40ce48[_0x8488b9][0x0][_0xaced('0x1f')]});}_0x34073c[_0xaced('0x12')]['push']({'type':_0x40ce48[_0x8488b9][0x0][_0xaced('0x16')],'app':'Set','appdata':'outboundrouteid='+_0x40ce48[_0x8488b9][0x0][_0xaced('0x1f')],'context':_0x40ce48[_0x8488b9][0x0]['context'],'exten':_0x40ce48[_0x8488b9][0x0][_0xaced('0xb')],'priority':_0x34073c[_0xaced('0x11')]++,'VoiceExtensionId':_0x40ce48[_0x8488b9][0x0][_0xaced('0x1f')]});if(_0x34073c[_0xaced('0x13')]&&_0x34073c[_0xaced('0x13')]['hasOwnProperty'](_0xaced('0x25'))&&_0x34073c['extension'][_0xaced('0x25')]!=='none'){_0x34073c[_0xaced('0x12')][_0xaced('0x15')]({'type':_0x40ce48[_0x8488b9][0x0][_0xaced('0x16')],'app':_0xaced('0x17'),'appdata':_0xaced('0x26'),'context':_0x40ce48[_0x8488b9][0x0][_0xaced('0x19')],'exten':_0x40ce48[_0x8488b9][0x0][_0xaced('0xb')],'priority':_0x34073c[_0xaced('0x11')]++,'VoiceExtensionId':_0x40ce48[_0x8488b9][0x0][_0xaced('0x1f')]});_0x34073c[_0xaced('0x12')]['push']({'type':_0x40ce48[_0x8488b9][0x0]['type'],'app':_0xaced('0x17'),'appdata':_0xaced('0x27')+_0x34073c['extension'][_0xaced('0x25')]||'wav','context':_0x40ce48[_0x8488b9][0x0][_0xaced('0x19')],'exten':_0x40ce48[_0x8488b9][0x0]['exten'],'priority':_0x34073c[_0xaced('0x11')]++,'VoiceExtensionId':_0x40ce48[_0x8488b9][0x0][_0xaced('0x1f')]});}}_0x34073c['extensions'][_0xaced('0x15')]({'type':_0x40ce48[_0x8488b9][0x0][_0xaced('0x16')],'app':_0xaced('0x17'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x40ce48[_0x8488b9][0x0][_0xaced('0x19')],'exten':_0x40ce48[_0x8488b9][0x0]['exten'],'priority':_0x34073c[_0xaced('0x11')]++,'VoiceExtensionId':_0x40ce48[_0x8488b9][0x0][_0xaced('0x1f')]});_0x34073c[_0xaced('0x12')][_0xaced('0x15')]({'type':_0x40ce48[_0x8488b9][0x0][_0xaced('0x16')],'app':'Set','appdata':_0xaced('0x28'),'context':_0x40ce48[_0x8488b9][0x0][_0xaced('0x19')],'exten':_0x40ce48[_0x8488b9][0x0][_0xaced('0xb')],'priority':_0x34073c['priority']++,'VoiceExtensionId':_0x40ce48[_0x8488b9][0x0][_0xaced('0x1f')]});_0x34073c[_0xaced('0x12')][_0xaced('0x15')]({'type':_0x40ce48[_0x8488b9][0x0]['type'],'app':'Set','appdata':_0xaced('0x29'),'context':_0x40ce48[_0x8488b9][0x0][_0xaced('0x19')],'exten':_0x40ce48[_0x8488b9][0x0][_0xaced('0xb')],'priority':_0x34073c[_0xaced('0x11')]++,'VoiceExtensionId':_0x40ce48[_0x8488b9][0x0]['VoiceExtensionId']});for(var _0x242051=0x0,_0x37428e=0x0;_0x242051<_0x40ce48[_0x8488b9][_0xaced('0x2a')];_0x242051+=0x1,_0x37428e=0x0){var _0x3e3f26=_0x40ce48[_0x8488b9][_0x242051];if(_0x3e3f26[_0xaced('0x16')]){_0x3e3f26[_0xaced('0x16')]=_0x3e3f26[_0xaced('0x16')][_0xaced('0x2b')]();}var _0x10e16f=[];var _0x4a009f=[];delete _0x3e3f26['id'];delete _0x3e3f26[_0xaced('0x2c')];delete _0x3e3f26['updatedAt'];var _0x5c4f38=_0x3e3f26[_0xaced('0x2d')]!==_0xaced('0x2e')?[_0x3e3f26[_0xaced('0x2d')]]:_0x3e3f26[_0xaced('0x8')]?_[_0xaced('0xa')](_[_0xaced('0xd')](_0x34073c[_0xaced('0x6')],{'IntervalId':_0x3e3f26[_0xaced('0x8')]}),_0xaced('0x2d')):[];if(_0x3e3f26[_0xaced('0x10')]('tag')){if(_0x3e3f26[_0xaced('0x2f')]&&_0x3e3f26['tag']!=='--'){_0x10e16f['push']({'type':_0x3e3f26[_0xaced('0x16')],'app':_0xaced('0x17'),'appdata':_0xaced('0x30')+_0x3e3f26[_0xaced('0x2f')],'context':_0x3e3f26['context'],'exten':_0x3e3f26[_0xaced('0xb')],'priority':_0x5c4f38[_0xaced('0x2a')]+_0x34073c['priority']+_0x37428e++,'VoiceExtensionId':_0x3e3f26[_0xaced('0x1f')]});}}if(_0x3e3f26[_0xaced('0x16')]==='outbound'&&_0x3e3f26['hasOwnProperty']('callerID')){if(_0x3e3f26[_0xaced('0x31')]){_0x10e16f['push']({'type':_0x3e3f26['type'],'app':'ExecIf','appdata':_0xaced('0x32')+_0x3e3f26[_0xaced('0x31')]+')','context':_0x3e3f26[_0xaced('0x19')],'exten':_0x3e3f26[_0xaced('0xb')],'priority':_0x5c4f38['length']+_0x34073c[_0xaced('0x11')]+_0x37428e++,'VoiceExtensionId':_0x3e3f26[_0xaced('0x1f')]});}else{_0x10e16f[_0xaced('0x15')]({'type':_0x3e3f26['type'],'app':_0xaced('0x33'),'appdata':_0xaced('0x34'),'context':_0x3e3f26[_0xaced('0x19')],'exten':_0x3e3f26[_0xaced('0xb')],'priority':_0x5c4f38[_0xaced('0x2a')]+_0x34073c[_0xaced('0x11')]+_0x37428e++,'VoiceExtensionId':_0x3e3f26[_0xaced('0x1f')]});}}if(_0x3e3f26[_0xaced('0x10')](_0xaced('0x35'))){if(_0x2e3c82[_0xaced('0x36')](_0x3e3f26[_0xaced('0x37')][_0xaced('0x2b')]())>=0x0&&_0x3e3f26[_0xaced('0x38')]!=='custom'){if(_0x3e3f26[_0xaced('0x35')]){_0x10e16f[_0xaced('0x15')]({'type':_0x3e3f26[_0xaced('0x16')],'app':_0xaced('0x33'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x3e3f26[_0xaced('0x19')],'exten':_0x3e3f26['exten'],'priority':_0x5c4f38[_0xaced('0x2a')]+_0x34073c[_0xaced('0x11')]+_0x37428e++,'VoiceExtensionId':_0x3e3f26[_0xaced('0x1f')]});_0x10e16f[_0xaced('0x15')]({'type':_0x3e3f26[_0xaced('0x16')],'app':_0xaced('0x17'),'appdata':_0xaced('0x39'),'context':_0x3e3f26[_0xaced('0x19')],'exten':_0x3e3f26[_0xaced('0xb')],'priority':_0x5c4f38[_0xaced('0x2a')]+_0x34073c['priority']+_0x37428e++,'VoiceExtensionId':_0x3e3f26[_0xaced('0x1f')]});}else{_0x10e16f[_0xaced('0x15')]({'type':_0x3e3f26[_0xaced('0x16')],'app':_0xaced('0x33'),'appdata':_0xaced('0x3a'),'context':_0x3e3f26['context'],'exten':_0x3e3f26['exten'],'priority':_0x5c4f38[_0xaced('0x2a')]+_0x34073c['priority']+_0x37428e++,'VoiceExtensionId':_0x3e3f26[_0xaced('0x1f')]});_0x10e16f[_0xaced('0x15')]({'type':_0x3e3f26[_0xaced('0x16')],'app':_0xaced('0x17'),'appdata':_0xaced('0x3b'),'context':_0x3e3f26['context'],'exten':_0x3e3f26[_0xaced('0xb')],'priority':_0x5c4f38[_0xaced('0x2a')]+_0x34073c[_0xaced('0x11')]+_0x37428e++,'VoiceExtensionId':_0x3e3f26['VoiceExtensionId']});}}}for(var _0x3bcf6c=0x0;_0x3bcf6c<_0x5c4f38['length'];_0x3bcf6c+=0x1){var _0x5f0137=_0x34073c['priority']+_0x5c4f38[_0xaced('0x2a')];var _0x43f07d=_0x3bcf6c===_0x5c4f38['length']-0x1?_0x34073c[_0xaced('0x11')]+_0x10e16f[_0xaced('0x2a')]+_0x4a009f[_0xaced('0x2a')]+0x2:_0x34073c[_0xaced('0x11')]+_0x3bcf6c+0x1;_0x10e16f[_0xaced('0x3c')](_0x3bcf6c,0x0,{'type':_0x3e3f26[_0xaced('0x16')],'app':'GotoIfTime','appdata':_0x5c4f38[_0x3bcf6c]+'?'+_0x3e3f26[_0xaced('0x19')]+',${EXTEN},'+_0x5f0137+':'+_0x3e3f26['context']+_0xaced('0x3d')+_0x43f07d,'exten':_0x3e3f26[_0xaced('0xb')],'context':_0x3e3f26[_0xaced('0x19')],'priority':_0x34073c[_0xaced('0x11')]+_0x3bcf6c,'VoiceExtensionId':_0x40ce48[_0x8488b9][0x0]['VoiceExtensionId']});}_0x3e3f26['priority']=_0x10e16f['length']?_['last'](_0x10e16f)['priority']+0x1:_0x34073c['priority'];_0x34073c[_0xaced('0x11')]=(_0x4a009f['length']?_[_0xaced('0x3e')](_0x4a009f)['priority']:_0x3e3f26[_0xaced('0x11')])+0x1;_0x34073c[_0xaced('0x12')]=_['concat'](_0x34073c[_0xaced('0x12')],_0x10e16f,[_0x3e3f26],_0x4a009f);}_0x34073c[_0xaced('0x12')][_0xaced('0x15')]({'type':_0x40ce48[_0x8488b9][0x0][_0xaced('0x16')],'app':_0xaced('0x3f'),'exten':_0x40ce48[_0x8488b9][0x0][_0xaced('0xb')],'context':_0x40ce48[_0x8488b9][0x0][_0xaced('0x19')],'priority':_0x34073c[_0xaced('0x11')],'VoiceExtensionId':_0x40ce48[_0x8488b9][0x0]['VoiceExtensionId']});_0x165f04[_0xaced('0x15')](_0x40ce48[_0x8488b9][0x0]['VoiceExtensionId']);_0xe9002f=_[_0xaced('0x40')](_0xe9002f,_0x34073c[_0xaced('0x12')]);}}return _0x4ab563[_0xaced('0x41')](function(_0x41ea7b){return _0x4ab563[_0xaced('0x2')][_0xaced('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x165f04}},'transaction':_0x41ea7b})['then'](function(_0x430db9){return _0x4ab563['models'][_0xaced('0x7')][_0xaced('0x42')](_[_0xaced('0x43')](_0xe9002f,_0xaced('0x11')),{'transaction':_0x41ea7b});});});})[_0xaced('0x44')](function(_0x3e2f7e){console[_0xaced('0x45')](_0x3e2f7e);});}exports[_0xaced('0x46')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 6227822..28173b3 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','fromQuery','phone','scheduledAt','updatedAt','field','NOW()','ContactId','toString','createdAt','from','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','\x20=\x20?','into','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','cm_contacts','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','push','all','CmList','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x3071('0x0'));var fs=require('fs');var squel=require(_0x3071('0x1'));var Papa=require(_0x3071('0x2'));var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));config[_0x3071('0x7')]=_[_0x3071('0x8')](config[_0x3071('0x7')],{'host':_0x3071('0x9'),'port':0x18eb});var socket=require(_0x3071('0xa'))(new Redis(config[_0x3071('0x7')]));require(_0x3071('0xb'))[_0x3071('0xc')](socket);try{if(!process[_0x3071('0xd')][0x2]||process[_0x3071('0xd')][0x2]===_0x3071('0xe')||process['argv'][0x2]===_0x3071('0xf')){throw new Error(_0x3071('0x10'));}var FILEPATH=process[_0x3071('0xd')][0x2];if(!process[_0x3071('0xd')][0x3]||process[_0x3071('0xd')][0x3]==='undefined'||process[_0x3071('0xd')][0x3]===_0x3071('0xf')||!process[_0x3071('0xd')][0x4]||process[_0x3071('0xd')][0x4]===_0x3071('0xe')||process['argv'][0x4]==='null'){throw new Error(_0x3071('0x11'));}var FIELDS=_['zipObject'](process[_0x3071('0xd')][0x3][_0x3071('0x12')](','),process['argv'][0x4][_0x3071('0x12')](','));if(!process['argv'][0x5]||process[_0x3071('0xd')][0x5]===_0x3071('0xe')||process[_0x3071('0xd')][0x5]===_0x3071('0xf')){throw new Error(_0x3071('0x13'));}var LISTID=process[_0x3071('0xd')][0x5];var COMPANYID=process[_0x3071('0xd')][0x6]&&process[_0x3071('0xd')][0x6]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x6]!=='null'?process[_0x3071('0xd')][0x6]:null;var DUPLICATES=process[_0x3071('0xd')][0x7]&&process[_0x3071('0xd')][0x7]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x7]!==_0x3071('0xf')?process[_0x3071('0xd')][0x7]:null;if(!process[_0x3071('0xd')][0x8]||process['argv'][0x8]===_0x3071('0xe')||process[_0x3071('0xd')][0x8]===_0x3071('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x3071('0xd')][0x8];}catch(_0x5cd80d){logger[_0x3071('0x14')](_0x5cd80d);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x43128c,_0x3762d8,_0x457b57,_0x33090c){var _0x34c50e={'message':_0x3762d8};_0x34c50e[_0x43128c]=!![];if(_0x457b57){_0x34c50e[_0x3071('0x15')]=_0x457b57;}if(_0x33090c){_0x34c50e[_0x3071('0x16')]=_0x33090c;}return _0x34c50e;}function isEmail(_0x542646){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x542646);}function checkRow(_0x2ce48a,_0xb05b1d,_0x412652){return new BPromise(function(_0x13df9f,_0x2793ef){if(_[_0x3071('0x17')](_0x2ce48a)){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x18'),null,_0x412652));}if(_0x2ce48a[_0x3071('0x19')]&&_0x2ce48a['errors'][_0x3071('0x1a')]){var _0x3f1e6e=_[_0x3071('0x1b')](_0x2ce48a['errors'],_0x3071('0x1c'))[_0x3071('0x1d')](';');return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3f1e6e,null,_0x412652));}var _0x950fde={};for(var _0x3fa3b8 in FIELDS){if(FIELDS[_0x3071('0x1e')](_0x3fa3b8)&&FIELDS[_0x3fa3b8]){_0x950fde[_0x3fa3b8]=_0x2ce48a[_0x3071('0x1f')][0x0][FIELDS[_0x3fa3b8]]||_0x2ce48a[_0x3071('0x1f')][0x0]['\ufeff'+FIELDS[_0x3fa3b8]];}}if(!_0x950fde[_0x3071('0x20')]){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x21'),null,_0x412652));}if(!_0x950fde['phone']){return _0x2793ef(handleCheckRowError('error',_0x3071('0x22'),null,_0x412652));}if(_0x950fde[_0x3071('0x23')]){var _0x6ddf96=moment(_0x950fde[_0x3071('0x23')],_0x3071('0x24'));if(!_0x6ddf96[_0x3071('0x25')]()){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x26'),null,_0x412652));}}if(_0x950fde['email']){if(!isEmail(_0x950fde['email'])){return _0x2793ef(handleCheckRowError('error',_0x3071('0x27'),null,_0x412652));}}_0x950fde[_0x3071('0x28')]=LISTID;_0x950fde['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){var _0x28747d={};for(var _0x25250e=0x0,_0x13ae2c=DUPLICATES['length'];_0x25250e<_0x13ae2c;_0x25250e+=0x1){_0x28747d[DUPLICATES[_0x25250e]]=_0x950fde[DUPLICATES[_0x25250e]];}var _0x218a82=_[_0x3071('0x29')](_0xb05b1d,_0x28747d);if(_0x218a82){return _0x2793ef(handleCheckRowError(_0x3071('0x2a'),_0x3071('0x2b'),_0x218a82,_0x412652));}}return db[_0x3071('0x2c')][_0x3071('0x2d')](_0x950fde,{'raw':!![],'hooks':![],'fields':_[_0x3071('0x2e')](_0x950fde)})[_0x3071('0x2f')](function(_0x596cc3){if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){_0xb05b1d['push'](_['pick'](_0x950fde,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x596cc3['id'];return _0x13df9f();})[_0x3071('0x30')](function(_0xa3a7ae){return _0x2793ef(handleCheckRowError('error',_0x3071('0x31')+(_0xa3a7ae[_0x3071('0x1c')]||JSON[_0x3071('0x32')](_0xa3a7ae)),null,_0x412652));});});}function checkHopper(){function _0x14ac42(){return function(_0xc60572){logger[_0x3071('0x14')]('cmContact',_0x3071('0x33'),util[_0x3071('0x34')](_0xc60572,{'showHidden':![],'depth':null}));};}var _0x4ce6d4=function(_0x44ad05,_0x5b1392){var _0x28f855=squel[_0x3071('0x35')]()['into']('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),'ContactId',_0x3071('0x28'),_0x5b1392,'createdAt',_0x3071('0x39')],squel['select']()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x44ad05['id'][_0x3071('0x3d')](),_0x5b1392)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),'updatedAt')[_0x3071('0x3f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x3071('0x40'),LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x5b1392+_0x3071('0x46'),_0x44ad05['id'][_0x3071('0x3d')]())))['toString']();return _0x28f855;};var _0x5c93c7=function(_0x1721d0,_0x3c2f5e){var _0x1fe5e0=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')](['phone',_0x3071('0x38'),'ContactId','ListId',_0x3c2f5e,_0x3071('0x3e'),'updatedAt'],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')[_0x3071('0x3a')]('id','ContactId')[_0x3071('0x3a')](LISTID['toString'](),_0x3071('0x28'))[_0x3071('0x3a')](_0x1721d0['id']['toString'](),_0x3c2f5e)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')](_0x3071('0x40'),LISTID['toString']())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x4b'))[_0x3071('0x3f')](_0x3071('0x4c'))[_0x3071('0x41')](_0x3c2f5e+_0x3071('0x46'),_0x1721d0['id'][_0x3071('0x3d')]()))[_0x3071('0x41')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x3c2f5e+'\x20=\x20?',_0x1721d0['id'][_0x3071('0x3d')]())))[_0x3071('0x3d')]();return _0x1fe5e0;};function _0x5bc69e(_0x4b8ec0,_0x1b89ea){var _0x15abc4=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),_0x3071('0x3c'),_0x3071('0x28'),_0x1b89ea,'createdAt',_0x3071('0x39')],squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))['field'](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x4b8ec0['id'][_0x3071('0x3d')](),_0x1b89ea)[_0x3071('0x3a')]('NOW()',_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')]('ListId\x20=\x20?',LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))[_0x3071('0x3d')]();return _0x15abc4;}function _0x2e39ff(_0x3b47e8,_0x5cb3b3){var _0x5d1316=squel[_0x3071('0x35')]()[_0x3071('0x47')](_0x3071('0x4d'))[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x3c'),_0x3071('0x28'),_0x5cb3b3,_0x3071('0x3e'),_0x3071('0x39')],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')]('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))[_0x3071('0x3a')](_0x3b47e8['id']['toString'](),_0x5cb3b3)[_0x3071('0x3a')](_0x3071('0x3b'),'createdAt')['field'](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')](_0x3071('0x4e'))['where']('deletedAt\x20IS\x20NULL')[_0x3071('0x41')]('ListId\x20=\x20?',LISTID['toString']())['where']('id\x20IN\x20?',squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))['toString']();return _0x5d1316;}return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id',_0x3071('0x52')],'include':[{'model':db['CmList'],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x588406){var _0x1b35d3=[];if(_0x588406){var _0x29ee70;for(var _0x388cd1=0x0,_0x40c258;_0x388cd1<_0x588406[_0x3071('0x1a')];_0x388cd1+=0x1){_0x40c258=_0x588406[_0x388cd1][_0x3071('0x54')]({'plain':!![]});switch(_0x40c258[_0x3071('0x52')]){case'always':_0x1b35d3['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x40c258,_0x3071('0x57')))['then'](function(){})['catch'](_0x14ac42()));break;case _0x3071('0x58'):_0x1b35d3[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x40c258,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x1b35d3[_0x3071('0x59')](db['sequelize'][_0x3071('0x56')](_0x5bc69e(_0x40c258,'VoiceQueueId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x1b35d3;})[_0x3071('0x5a')]()[_0x3071('0x2f')](function(){return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x138a94){var _0x1da477=[];if(_0x138a94){var _0x4f06c0;for(var _0x2a2e7a=0x0,_0x22ec7b;_0x2a2e7a<_0x138a94[_0x3071('0x1a')];_0x2a2e7a+=0x1){_0x22ec7b=_0x138a94[_0x2a2e7a]['get']({'plain':!![]});_0x1da477['push'](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x22ec7b,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}return _0x1da477;})[_0x3071('0x5a')]();})[_0x3071('0x2f')](function(){return db[_0x3071('0x5c')][_0x3071('0x50')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x3cc937){var _0x98d0fb=[];if(_0x3cc937){for(var _0x1fea60=0x0,_0x435dcb;_0x1fea60<_0x3cc937[_0x3071('0x1a')];_0x1fea60+=0x1){_0x435dcb=_0x3cc937[_0x1fea60]['get']({'plain':!![]});switch(_0x435dcb[_0x3071('0x52')]){case'always':_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;case _0x3071('0x58'):_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x435dcb,'CampaignId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x98d0fb['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5bc69e(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x98d0fb;})['all']();})['then'](function(){return db[_0x3071('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x5e'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x136278){var _0x22783b=[];if(_0x136278){for(var _0x2f31b7=0x0,_0x568386;_0x2f31b7<_0x136278[_0x3071('0x1a')];_0x2f31b7+=0x1){_0x568386=_0x136278[_0x2f31b7][_0x3071('0x54')]({'plain':!![]});_0x22783b[_0x3071('0x59')](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x568386,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})['catch'](_0x14ac42()));}}return _0x22783b;})[_0x3071('0x5a')]();})[_0x3071('0x30')](function(_0x391887){logger[_0x3071('0x14')](_0x3071('0x5f'),'generalCheckHopper',_0x391887[_0x3071('0x1c')]);});}var processPromises=function(_0x479fe7){return BPromise[_0x3071('0x5a')](promises)[_0x3071('0x2f')](function(_0x39060f){})[_0x3071('0x30')](function(_0x1120ec){logger[_0x3071('0x14')](_0x3071('0x60'),JSON[_0x3071('0x32')](_0x1120ec));})['finally'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x479fe7){return _0x479fe7[_0x3071('0x63')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x3071('0x2f')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3071('0x64')](FILEPATH);}catch(_0x5e0cbd){logger[_0x3071('0x14')](_0x3071('0x65'),JSON[_0x3071('0x32')](_0x5e0cbd));}finally{process[_0x3071('0x66')](0x0);}});};process['on'](_0x3071('0x67'),function(){logger[_0x3071('0x68')](_0x3071('0x69'));endCsv();});function main(){return BPromise[_0x3071('0x6a')]()[_0x3071('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x3071('0x2c')][_0x3071('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3071('0x2f')](function(_0x5b2830){var _0x561030=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x561030,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4eb9e2,_0x8c77b7){total+=0x1;var _0x44b4c9=total;promises['push'](checkRow(_0x4eb9e2,_0x5b2830,_0x44b4c9)[_0x3071('0x2f')](function(){success+=0x1;})[_0x3071('0x30')](function(_0x1f61df){if(_0x1f61df['error']){errors+=0x1;delete _0x1f61df['error'];}else if(_0x1f61df[_0x3071('0x2a')]){duplicates+=0x1;delete _0x1f61df[_0x3071('0x2a')];}rows[_0x3071('0x59')](_0x1f61df);}));if(total%0xc8===0x0){_0x8c77b7[_0x3071('0x6b')]();return processPromises(_0x8c77b7);}},'complete':function(){return processPromises()[_0x3071('0x2f')](function(){logger[_0x3071('0x68')](_0x3071('0x6c'));endCsv();});},'error':function(_0x5eb60d,_0x58b62c){logger[_0x3071('0x68')](_0x3071('0x6d'),JSON[_0x3071('0x32')](_0x5eb60d));endCsv();}});})[_0x3071('0x30')](function(_0x5a3b64){logger[_0x3071('0x14')](_0x3071('0x6e'),JSON[_0x3071('0x32')](_0x5a3b64));});}main(); \ No newline at end of file +var _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(_0x4b6470,_0x5d7257){var _0x5679f0=function(_0x4d3024){while(--_0x4d3024){_0x4b6470['push'](_0x4b6470['shift']());}};_0x5679f0(++_0x5d7257);}(_0x70e0,0x17b));var _0x070e=function(_0x51aea2,_0x5e43f0){_0x51aea2=_0x51aea2-0x0;var _0x1c785f=_0x70e0[_0x51aea2];return _0x1c785f;};'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 diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 486ae45..e55de35 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 _0x74e5=['bluebird','squel','ioredis','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','test','select','field','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','cm_hopper','fromQuery','phone','ContactId','ListId','createdAt','updatedAt','priority','fields','cm_contacts.ListId\x20=\x20','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','toString','cm_hopper_black','cm_contacts','.CmListId','ListId\x20=\x20?','CompanyId','into','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','send','start','binding','socket_timestamp','root','server/files/tmp','keys','parse','createReadStream','data','length','rows','hasOwnProperty','trim','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','step','duplicates','\x20LIKE\x20cm_contacts;','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','campaigns_has_cm_lists','campaigns','CampaignId','then','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','lodash','papaparse','util'];(function(_0x5c9d37,_0x1b38d6){var _0x43b94f=function(_0x209d19){while(--_0x209d19){_0x5c9d37['push'](_0x5c9d37['shift']());}};_0x43b94f(++_0x1b38d6);}(_0x74e5,0xf5));var _0x574e=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x74e5[_0x164eca];return _0x2ce562;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x574e('0x0'));var Papa=require(_0x574e('0x1'));var util=require(_0x574e('0x2'));var BPromise=require(_0x574e('0x3'));var moment=require('moment');var squel=require(_0x574e('0x4'));var Redis=require(_0x574e('0x5'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0x574e('0x6'))(_0x574e('0x7'));config[_0x574e('0x8')]=_[_0x574e('0x9')](config[_0x574e('0x8')],{'host':_0x574e('0xa'),'port':0x18eb});var socket=require(_0x574e('0xb'))(new Redis(config[_0x574e('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x574e('0xc')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x58e3fd){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))*$/[_0x574e('0xd')](_0x58e3fd);}function selectNotIn(_0x14f280,_0x53275d,_0xd136eb,_0x214e44,_0x5cdfc7){return squel[_0x574e('0xe')]()[_0x574e('0xf')]('phone')[_0x574e('0x10')](_0x214e44)[_0x574e('0x11')](_0x53275d,null,_0x53275d+'.id\x20=\x20'+_0x214e44+'.'+_0xd136eb)[_0x574e('0x12')](_0x214e44+'.'+_0xd136eb+_0x574e('0x13')+_0x14f280+'.'+_0xd136eb)[_0x574e('0x12')](_0x53275d+_0x574e('0x14')+_0x5cdfc7[_0x574e('0x11')]()+')');}function insertCmHopper(_0x20bb2e,_0xcfeb81,_0x4d4435,_0x189599,_0x27e54f){var _0xd05da0=[_0x574e('0x15'),_0x574e('0x16'),_0x574e('0x17'),_0x574e('0x18'),_0xcfeb81+'.'+_0x189599,_0x574e('0x19'),_0x574e('0x1a'),'cm_contacts.priority',_0x574e('0x1b'),'\x22'+_0x27e54f+'\x22'];return squel[_0x574e('0x1c')]()['into'](_0x574e('0x1d'))[_0x574e('0x1e')]([_0x574e('0x1f'),'scheduledat',_0x574e('0x20'),_0x574e('0x21'),_0x189599,_0x574e('0x22'),_0x574e('0x23'),_0x574e('0x24'),'UserId','recallme'],squel[_0x574e('0xe')]()[_0x574e('0x25')](_0xd05da0)[_0x574e('0x10')](_0xcfeb81)[_0x574e('0x11')]('cm_contacts',null,_0x574e('0x26')+_0xcfeb81+'.CmListId')[_0x574e('0x11')](_0x4d4435,null,_0x4d4435+_0x574e('0x27')+_0xcfeb81+'.'+_0x189599)['where'](_0xcfeb81+_0x574e('0x28'),_0x20bb2e)[_0x574e('0x12')](_0x574e('0x29'),NOW)[_0x574e('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xcfeb81,_0x4d4435,_0x189599,'cm_hopper',[_0x574e('0x2a'),'\x22onlyIfOpen\x22']))[_0x574e('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xcfeb81,_0x4d4435,_0x189599,_0x574e('0x1d'),[_0x574e('0x2a')])))[_0x574e('0x2b')]();}function insertCmHopperBlack(_0x2e45b5,_0x26835f,_0x2f7434,_0x284a9f){var _0x342ebd=[_0x574e('0x15'),_0x574e('0x17'),_0x574e('0x18'),_0x26835f+'.'+_0x284a9f,_0x574e('0x19'),_0x574e('0x1a')];return squel[_0x574e('0x1c')]()['into'](_0x574e('0x2c'))[_0x574e('0x1e')]([_0x574e('0x1f'),_0x574e('0x20'),_0x574e('0x21'),_0x284a9f,_0x574e('0x22'),_0x574e('0x23')],squel['select']()[_0x574e('0x25')](_0x342ebd)[_0x574e('0x10')](_0x26835f)['join'](_0x574e('0x2d'),null,_0x574e('0x26')+_0x26835f+_0x574e('0x2e'))['join'](_0x2f7434,null,_0x2f7434+_0x574e('0x27')+_0x26835f+'.'+_0x284a9f)[_0x574e('0x12')](_0x26835f+_0x574e('0x28'),_0x2e45b5)[_0x574e('0x12')](_0x574e('0x29'),NOW)[_0x574e('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x574e('0xe')]()[_0x574e('0xf')]('phone')[_0x574e('0x10')](_0x574e('0x2c'))[_0x574e('0x12')](_0x574e('0x2f'),_0x2e45b5)['where'](_0x284a9f+'\x20=\x20?',_0x26835f+'.'+_0x284a9f)))[_0x574e('0x2b')]();}function insertCmContact(_0x235227,_0x5ad1fc,_0x474d50,_0x3c9ff9){var _0x471ac5=_['concat'](_['keys'](_0x3c9ff9),['ListId',_0x574e('0x30'),_0x574e('0x22'),_0x574e('0x23')]);return squel['insert']()[_0x574e('0x31')](_0x574e('0x2d'))[_0x574e('0x1e')](_0x471ac5,squel[_0x574e('0xe')]()[_0x574e('0x25')](_0x471ac5)[_0x574e('0x10')](_0x5ad1fc)[_0x574e('0x12')]('('+_0x474d50[_0x574e('0x11')](',')+')\x20NOT\x20IN\x20?',squel[_0x574e('0xe')]()[_0x574e('0x25')](_0x474d50)[_0x574e('0x10')](_0x574e('0x2d'))[_0x574e('0x12')](_0x574e('0x2f'),_0x235227)[_0x574e('0x12')](_0x574e('0x32')))[_0x574e('0x12')](_0x574e('0x33'),squel[_0x574e('0xe')]()[_0x574e('0xf')](_0x574e('0x34'),'min_id')['from'](_0x5ad1fc)[_0x574e('0x35')](_0x474d50['join'](','))))['toString']();}function handleStop(){logger[_0x574e('0x36')](_0x574e('0x37'));stopped=!![];}function handleUncaughtException(_0x24f029){logger[_0x574e('0x38')](_0x24f029[_0x574e('0x39')]);process[_0x574e('0x3a')](0x1);}function handleError(_0x125834,_0x33f692){stats[_0x574e('0x3b')][_0x574e('0x3c')]({'name':_0x33f692[_0x574e('0x3d')],'message':_0x33f692[_0x574e('0x39')],'row':_0x125834});}function handleQuery(_0x244cb1){logger[_0x574e('0x36')](_0x244cb1);return db[_0x574e('0x3e')][_0x574e('0x3f')](_0x244cb1)[_0x574e('0x40')](function(_0x252690){results[_0x574e('0x3c')](_0x252690);})['catch'](function(_0x5c35dd){logger['error'](_0x5c35dd[_0x574e('0x39')]);});}function main(_0x16cff9,_0x4c9eda,_0x57d83f,_0x4861fc){logger['info']('main',_0x16cff9,JSON['stringify'](_0x4c9eda));process[_0x574e('0x41')](_0x574e('0x42'));var _0x3c2763=_0x4c9eda[_0x574e('0x43')];var _0x1d5d95=_0x4c9eda[_0x574e('0x44')];var _0x2bf6d8=path['join'](config[_0x574e('0x45')],_0x574e('0x46'),_0x1d5d95+'.csv');var _0xac6dcd=_[_0x574e('0x47')](_0x3c2763)[_0x574e('0x11')]();logger['info']('header',_0xac6dcd);fs['writeFileSync'](_0x2bf6d8,_0xac6dcd+'\x0a');Papa[_0x574e('0x48')](fs[_0x574e('0x49')](_0x16cff9),{'header':!![],'skipEmptyLines':!![],'step':function(_0x277513,_0x522895){try{for(var _0x15ab8b=0x0,_0x5003b6=[];_0x15ab8b<_0x277513[_0x574e('0x4a')][_0x574e('0x4b')];_0x15ab8b++){stats[_0x574e('0x4c')]+=0x1;if(_0x277513[_0x574e('0x3b')][_0x15ab8b]){handleError(_0x277513['data'][_0x15ab8b],_0x277513['errors'][_0x15ab8b]);}else{var _0xdf3df2=[];for(var _0x25a6de in _0x3c2763){if(_0x3c2763[_0x574e('0x4d')](_0x25a6de)){if(_0x277513['data'][_0x15ab8b][_0x3c2763[_0x25a6de]]){var _0x13bf02=_[_0x574e('0x4e')](_0x277513[_0x574e('0x4a')][_0x15ab8b][_0x3c2763[_0x25a6de]]['replace'](/"/g,'\x27'));switch(_0x25a6de){case'scheduledat':var _0x3d32ad=moment(_0x13bf02,_0x574e('0x4f'),!![]);if(_0x3d32ad[_0x574e('0x50')]()){_0x5003b6[_0x574e('0x3c')]('\x22'+_0x13bf02+'\x22');}else{_0xdf3df2[_0x574e('0x3c')](_0x574e('0x51'));}break;case _0x574e('0x24'):var _0x59fbbf=parseInt(_0x13bf02);_0x13bf02=_[_0x574e('0x52')](_0x59fbbf)||_0x59fbbf<0x0||_0x59fbbf>0x4?_0x4861fc?0x3:0x2:_0x59fbbf;_0x5003b6['push']('\x22'+_0x13bf02+'\x22');break;case _0x574e('0x53'):var _0x2846d7=parseInt(_0x13bf02);if(_[_0x574e('0x54')](_0x2846d7)&&_[_0x574e('0x55')](_0x57d83f,_0x2846d7)){_0x5003b6[_0x574e('0x3c')]('\x22'+_0x2846d7+'\x22');}else{_0xdf3df2[_0x574e('0x3c')](_0x574e('0x56'));}break;case _0x574e('0x57'):if(isEmail(_0x13bf02)){_0x5003b6['push']('\x22'+_0x13bf02+'\x22');}else{_0xdf3df2[_0x574e('0x3c')](_0x574e('0x58'));}break;case'dateOfBirth':var _0x4193bc=moment(_0x13bf02,_0x574e('0x59'),!![]);if(_0x4193bc['isValid']()){_0x5003b6[_0x574e('0x3c')]('\x22'+_0x13bf02+'\x22');}else{_0xdf3df2['push'](_0x574e('0x5a'));}break;default:_0x5003b6[_0x574e('0x3c')]('\x22'+_0x13bf02+'\x22');}}else{switch(_0x25a6de){case'firstName':case _0x574e('0x1f'):_0xdf3df2[_0x574e('0x3c')](_0x25a6de+_0x574e('0x5b'));break;default:_0x5003b6[_0x574e('0x3c')]('\x22\x22');}}}}if(_0xdf3df2[_0x574e('0x4b')]){handleError(_0x277513[_0x574e('0x4a')][_0x15ab8b],{'code':_0x574e('0x5c'),'message':_0xdf3df2[_0x574e('0x11')]()});}else{fs[_0x574e('0x5d')](_0x2bf6d8,_0x5003b6['join']()+'\x0a');}_0x5003b6=[];}if(!(stats[_0x574e('0x4c')]%0xc8)){socket[_0x574e('0x5e')](_0x574e('0x5f')+_0x1d5d95,stats);stats[_0x574e('0x3b')]=[];}}if(stopped){logger[_0x574e('0x36')](_0x574e('0x60'));_0x522895['abort']();}}catch(_0x464be1){handleError(_0x277513[_0x574e('0x4a')][_0x15ab8b],{'code':'SystemError','message':_0x464be1['message']});logger[_0x574e('0x38')](_0x574e('0x61'),_0x464be1[_0x574e('0x39')]);}},'complete':function(){try{var _0x12f629=[];var _0xfb166f=_0x574e('0x2d');if(_0x4c9eda[_0x574e('0x62')]&&_0x4c9eda['duplicates'][_0x574e('0x4b')]){_0xfb166f='cm_contacts_'+_0x1d5d95;_0x12f629[_0x574e('0x3c')]('CREATE\x20TABLE\x20'+_0xfb166f+_0x574e('0x63'));}var _0x1d3831=util[_0x574e('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',_0x2bf6d8,_0xfb166f,_0xac6dcd,_0x4c9eda['ListId'],_0x4c9eda[_0x574e('0x30')]||null,NOW,NOW);if(_[_0x574e('0x64')](_0x3c2763['scheduledat'])){_0x1d3831+=_0x574e('0x65');}_0x12f629['push'](_0x1d3831);if(_0x4c9eda[_0x574e('0x62')]&&_0x4c9eda[_0x574e('0x62')][_0x574e('0x4b')]){_0x12f629[_0x574e('0x3c')](insertCmContact(_0x4c9eda['ListId'],_0xfb166f,_0x4c9eda['duplicates'],_0x3c2763));_0x12f629['push'](_0x574e('0x66')+_0xfb166f+';');}_0x12f629['push'](insertCmHopper(_0x4c9eda['ListId'],_0x574e('0x67'),'voice_queues',_0x574e('0x68'),_0x4861fc));_0x12f629[_0x574e('0x3c')](insertCmHopperBlack(_0x4c9eda[_0x574e('0x21')],_0x574e('0x69'),_0x574e('0x6a'),_0x574e('0x68')));_0x12f629[_0x574e('0x3c')](insertCmHopper(_0x4c9eda[_0x574e('0x21')],_0x574e('0x6b'),_0x574e('0x6c'),_0x574e('0x6d'),_0x4861fc));_0x12f629[_0x574e('0x3c')](insertCmHopperBlack(_0x4c9eda[_0x574e('0x21')],'campaigns_has_cm_blacklists',_0x574e('0x6c'),_0x574e('0x6d')));BPromise['each'](_0x12f629,handleQuery)[_0x574e('0x6e')](function(_0x3c507a){stats[_0x574e('0x6f')]=!![];stats[_0x574e('0x70')]=_0x4c9eda[_0x574e('0x62')]&&_0x4c9eda['duplicates'][_0x574e('0x4b')]?results[0x2][_0x574e('0x70')]:results[0x0][_0x574e('0x70')];socket[_0x574e('0x5e')]('contact:import:'+_0x1d5d95,stats);fs[_0x574e('0x71')](_0x16cff9);fs['unlink'](_0x2bf6d8);process[_0x574e('0x3a')](0x0);})['catch'](function(_0xa93326){logger[_0x574e('0x38')](_0xa93326[_0x574e('0x39')]);process[_0x574e('0x3a')](0x1);});}catch(_0x35c497){logger[_0x574e('0x38')](_0x574e('0x72'),_0x35c497['message']);process[_0x574e('0x3a')](0x1);}},'error':function(_0x5bbe2d,_0xd3cb81,_0x7da0e2,_0x1099e9){throw new Error(_0x1099e9);}});}function validate(){if(process[_0x574e('0x73')]&&process[_0x574e('0x73')]['length']<0x4){throw new Error(_0x574e('0x74'));}var _0x408ccc=path['join'](config[_0x574e('0x45')],_0x574e('0x46'),process[_0x574e('0x73')][0x2]);if(!fs['existsSync'](_0x408ccc)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x11cb96={};try{_0x11cb96=JSON['parse'](process[_0x574e('0x73')][0x3]);if(!_0x11cb96[_0x574e('0x43')]){throw new Error(_0x574e('0x75'));}if(!_0x11cb96[_0x574e('0x43')]['phone']){throw new Error(_0x574e('0x76'));}if(!_0x11cb96['binding'][_0x574e('0x77')]){throw new Error(_0x574e('0x78'));}var _0x224768=0x0;if(_0x11cb96[_0x574e('0x43')][_0x574e('0x53')]){_0x224768=0x1;}if(!_0x11cb96[_0x574e('0x21')]){throw new Error(_0x574e('0x79'));}}catch(_0x3f461f){throw new Error(_0x574e('0x7a'));}var _0x53efe5=[];try{_0x53efe5=_['map'](JSON[_0x574e('0x48')](process[_0x574e('0x73')][0x4]),'id');}catch(_0xff787b){logger[_0x574e('0x36')](_0x574e('0x7b'));}main(_0x408ccc,_0x11cb96,_0x53efe5,_0x224768);}validate();process['on']('SIGINT',handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x10d9=['main','stringify','send','start','socket_timestamp','root','.csv','parse','createReadStream','data','length','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','SystemRow','appendFileSync','rows','emit','contact:import:','abort','SystemError','step','duplicates','cm_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','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns','CampaignId','each','then','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','server/files/tmp','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','join','where','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','cm_hopper','scheduledat','ContactId','ListId','createdAt','updatedAt','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.id','cm_contacts.createdAt','insert','into','cm_hopper_black','fromQuery','phone','.CmListId','cm_contacts.phone\x20NOT\x20IN\x20(?)','field','ListId\x20=\x20?','\x20=\x20?','toString','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','message','exit','errors','push','code','sequelize','query','spread','catch','error'];(function(_0x458952,_0x455156){var _0x4f320b=function(_0x72413b){while(--_0x72413b){_0x458952['push'](_0x458952['shift']());}};_0x4f320b(++_0x455156);}(_0x10d9,0x14e));var _0x910d=function(_0x154eaa,_0x1b3d67){_0x154eaa=_0x154eaa-0x0;var _0x1670a8=_0x10d9[_0x154eaa];return _0x1670a8;};'use strict';var fs=require('fs');var path=require(_0x910d('0x0'));var _=require(_0x910d('0x1'));var Papa=require(_0x910d('0x2'));var util=require('util');var BPromise=require(_0x910d('0x3'));var moment=require(_0x910d('0x4'));var squel=require(_0x910d('0x5'));var Redis=require(_0x910d('0x6'));var db=require(_0x910d('0x7'))['db'];var config=require('../../../config/environment');var logger=require(_0x910d('0x8'))(_0x910d('0x9'));config[_0x910d('0xa')]=_[_0x910d('0xb')](config[_0x910d('0xa')],{'host':_0x910d('0xc'),'port':0x18eb});var socket=require(_0x910d('0xd'))(new Redis(config[_0x910d('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x910d('0xe')](_0x910d('0xf'));function isEmail(_0x24af48){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))*$/[_0x910d('0x10')](_0x24af48);}function selectNotIn(_0x17d79f,_0x24c5b2,_0x4883c2,_0x1c9086,_0x1113b7){return squel[_0x910d('0x11')]()['field']('phone')['from'](_0x1c9086)[_0x910d('0x12')](_0x24c5b2,null,_0x24c5b2+'.id\x20=\x20'+_0x1c9086+'.'+_0x4883c2)[_0x910d('0x13')](_0x1c9086+'.'+_0x4883c2+'\x20=\x20'+_0x17d79f+'.'+_0x4883c2)[_0x910d('0x13')](_0x24c5b2+'.dialCheckDuplicateType\x20IN\x20('+_0x1113b7[_0x910d('0x12')]()+')');}function insertCmHopper(_0x105e18,_0x53b308,_0x4ec733,_0x31f304,_0x27f25d){var _0x1c99e0=[_0x910d('0x14'),_0x910d('0x15'),'cm_contacts.id',_0x910d('0x16'),_0x53b308+'.'+_0x31f304,'cm_contacts.createdAt',_0x910d('0x17'),'cm_contacts.priority',_0x910d('0x18'),'\x22'+_0x27f25d+'\x22'];return squel['insert']()['into'](_0x910d('0x19'))['fromQuery'](['phone',_0x910d('0x1a'),_0x910d('0x1b'),_0x910d('0x1c'),_0x31f304,_0x910d('0x1d'),_0x910d('0x1e'),'priority',_0x910d('0x1f'),_0x910d('0x20')],squel['select']()[_0x910d('0x21')](_0x1c99e0)[_0x910d('0x22')](_0x53b308)[_0x910d('0x12')](_0x910d('0x23'),null,_0x910d('0x24')+_0x53b308+'.CmListId')[_0x910d('0x12')](_0x4ec733,null,_0x4ec733+_0x910d('0x25')+_0x53b308+'.'+_0x31f304)[_0x910d('0x13')](_0x53b308+_0x910d('0x26'),_0x105e18)['where'](_0x910d('0x27'),NOW)[_0x910d('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x53b308,_0x4ec733,_0x31f304,_0x910d('0x19'),[_0x910d('0x28'),_0x910d('0x29')]))[_0x910d('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x53b308,_0x4ec733,_0x31f304,'cm_hopper',['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x49aa12,_0xd924f0,_0x39fe69,_0xa71415){var _0x505f17=[_0x910d('0x14'),_0x910d('0x2a'),_0x910d('0x16'),_0xd924f0+'.'+_0xa71415,_0x910d('0x2b'),'cm_contacts.updatedAt'];return squel[_0x910d('0x2c')]()[_0x910d('0x2d')](_0x910d('0x2e'))[_0x910d('0x2f')]([_0x910d('0x30'),_0x910d('0x1b'),_0x910d('0x1c'),_0xa71415,_0x910d('0x1d'),'updatedAt'],squel['select']()[_0x910d('0x21')](_0x505f17)[_0x910d('0x22')](_0xd924f0)[_0x910d('0x12')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0xd924f0+_0x910d('0x31'))[_0x910d('0x12')](_0x39fe69,null,_0x39fe69+_0x910d('0x25')+_0xd924f0+'.'+_0xa71415)[_0x910d('0x13')](_0xd924f0+_0x910d('0x26'),_0x49aa12)['where'](_0x910d('0x27'),NOW)[_0x910d('0x13')](_0x910d('0x32'),squel['select']()[_0x910d('0x33')]('phone')[_0x910d('0x22')]('cm_hopper_black')[_0x910d('0x13')](_0x910d('0x34'),_0x49aa12)[_0x910d('0x13')](_0xa71415+_0x910d('0x35'),_0xd924f0+'.'+_0xa71415)))[_0x910d('0x36')]();}function insertCmContact(_0x14435f,_0x5da881,_0x124d8b,_0x5b059b){var _0x45005c=_[_0x910d('0x37')](_[_0x910d('0x38')](_0x5b059b),[_0x910d('0x1c'),_0x910d('0x39'),'createdAt',_0x910d('0x1e')]);return squel['insert']()[_0x910d('0x2d')](_0x910d('0x23'))['fromQuery'](_0x45005c,squel[_0x910d('0x11')]()[_0x910d('0x21')](_0x45005c)[_0x910d('0x22')](_0x5da881)[_0x910d('0x13')]('('+_0x124d8b[_0x910d('0x12')](',')+_0x910d('0x3a'),squel[_0x910d('0x11')]()[_0x910d('0x21')](_0x124d8b)[_0x910d('0x22')](_0x910d('0x23'))[_0x910d('0x13')](_0x910d('0x34'),_0x14435f)[_0x910d('0x13')](_0x910d('0x3b')))[_0x910d('0x13')](_0x910d('0x3c'),squel[_0x910d('0x11')]()[_0x910d('0x33')]('MIN(id)',_0x910d('0x3d'))['from'](_0x5da881)[_0x910d('0x3e')](_0x124d8b[_0x910d('0x12')](','))))['toString']();}function handleStop(){logger[_0x910d('0x3f')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x8c8a55){logger['error'](_0x8c8a55[_0x910d('0x40')]);process[_0x910d('0x41')](0x1);}function handleError(_0x299d14,_0x3b8efd){stats[_0x910d('0x42')][_0x910d('0x43')]({'name':_0x3b8efd[_0x910d('0x44')],'message':_0x3b8efd[_0x910d('0x40')],'row':_0x299d14});}function handleQuery(_0x1579a0){logger[_0x910d('0x3f')](_0x1579a0);return db[_0x910d('0x45')][_0x910d('0x46')](_0x1579a0)[_0x910d('0x47')](function(_0x2a976c){results[_0x910d('0x43')](_0x2a976c);})[_0x910d('0x48')](function(_0x1eb842){logger[_0x910d('0x49')](_0x1eb842[_0x910d('0x40')]);});}function main(_0x91b4b5,_0x22a409,_0x4558a0,_0x3cc289){logger[_0x910d('0x3f')](_0x910d('0x4a'),_0x91b4b5,JSON[_0x910d('0x4b')](_0x22a409));process[_0x910d('0x4c')](_0x910d('0x4d'));var _0x4b3ae8=_0x22a409['binding'];var _0x564bca=_0x22a409[_0x910d('0x4e')];var _0x8256ac=path[_0x910d('0x12')](config[_0x910d('0x4f')],'server/files/tmp',_0x564bca+_0x910d('0x50'));var _0x223ee2=_[_0x910d('0x38')](_0x4b3ae8)[_0x910d('0x12')]();logger[_0x910d('0x3f')]('header',_0x223ee2);fs['writeFileSync'](_0x8256ac,_0x223ee2+'\x0a');Papa[_0x910d('0x51')](fs[_0x910d('0x52')](_0x91b4b5),{'header':!![],'skipEmptyLines':!![],'step':function(_0x56e9af,_0x18e58a){try{for(var _0x52f7ec=0x0,_0x3f88c0=[];_0x52f7ec<_0x56e9af[_0x910d('0x53')][_0x910d('0x54')];_0x52f7ec++){stats['rows']+=0x1;if(_0x56e9af[_0x910d('0x42')][_0x52f7ec]){handleError(_0x56e9af['data'][_0x52f7ec],_0x56e9af[_0x910d('0x42')][_0x52f7ec]);}else{var _0x5d24b9=[];for(var _0x5a0b1a in _0x4b3ae8){if(_0x4b3ae8[_0x910d('0x55')](_0x5a0b1a)){if(_0x56e9af[_0x910d('0x53')][_0x52f7ec][_0x4b3ae8[_0x5a0b1a]]){var _0x754865=_[_0x910d('0x56')](_0x56e9af[_0x910d('0x53')][_0x52f7ec][_0x4b3ae8[_0x5a0b1a]][_0x910d('0x57')](/"/g,'\x27'));switch(_0x5a0b1a){case _0x910d('0x1a'):var _0x1e8075=moment(_0x754865,_0x910d('0xf'),!![]);if(_0x1e8075[_0x910d('0x58')]()){_0x3f88c0[_0x910d('0x43')]('\x22'+_0x754865+'\x22');}else{_0x5d24b9['push'](_0x910d('0x59'));}break;case _0x910d('0x5a'):var _0x375ba4=parseInt(_0x754865);_0x754865=_[_0x910d('0x5b')](_0x375ba4)||_0x375ba4<0x0||_0x375ba4>0x4?_0x3cc289?0x3:0x2:_0x375ba4;_0x3f88c0['push']('\x22'+_0x754865+'\x22');break;case _0x910d('0x1f'):var _0x1fd3bf=parseInt(_0x754865);if(_[_0x910d('0x5c')](_0x1fd3bf)&&_[_0x910d('0x5d')](_0x4558a0,_0x1fd3bf)){_0x3f88c0[_0x910d('0x43')]('\x22'+_0x1fd3bf+'\x22');}else{_0x5d24b9['push'](_0x910d('0x5e'));}break;case _0x910d('0x5f'):if(isEmail(_0x754865)){_0x3f88c0[_0x910d('0x43')]('\x22'+_0x754865+'\x22');}else{_0x5d24b9['push']('email\x20wrong\x20format');}break;case _0x910d('0x60'):var _0x554e54=moment(_0x754865,'YYYY-MM-DD',!![]);if(_0x554e54[_0x910d('0x58')]()){_0x3f88c0['push']('\x22'+_0x754865+'\x22');}else{_0x5d24b9[_0x910d('0x43')](_0x910d('0x61'));}break;default:_0x3f88c0[_0x910d('0x43')]('\x22'+_0x754865+'\x22');}}else{switch(_0x5a0b1a){case'firstName':case _0x910d('0x30'):_0x5d24b9[_0x910d('0x43')](_0x5a0b1a+'\x20not\x20specified');break;default:_0x3f88c0['push']('\x22\x22');}}}}if(_0x5d24b9[_0x910d('0x54')]){handleError(_0x56e9af[_0x910d('0x53')][_0x52f7ec],{'code':_0x910d('0x62'),'message':_0x5d24b9[_0x910d('0x12')]()});}else{fs[_0x910d('0x63')](_0x8256ac,_0x3f88c0[_0x910d('0x12')]()+'\x0a');}_0x3f88c0=[];}if(!(stats[_0x910d('0x64')]%0xc8)){socket[_0x910d('0x65')](_0x910d('0x66')+_0x564bca,stats);stats[_0x910d('0x42')]=[];}}if(stopped){logger[_0x910d('0x3f')]('Abort\x20parser');_0x18e58a[_0x910d('0x67')]();}}catch(_0x2a7dae){handleError(_0x56e9af[_0x910d('0x53')][_0x52f7ec],{'code':_0x910d('0x68'),'message':_0x2a7dae[_0x910d('0x40')]});logger[_0x910d('0x49')](_0x910d('0x69'),_0x2a7dae[_0x910d('0x40')]);}},'complete':function(){try{var _0x906a66=[];var _0x2f4e6f=_0x910d('0x23');if(_0x22a409[_0x910d('0x6a')]&&_0x22a409[_0x910d('0x6a')][_0x910d('0x54')]){_0x2f4e6f=_0x910d('0x6b')+_0x564bca;_0x906a66['push']('CREATE\x20TABLE\x20'+_0x2f4e6f+'\x20LIKE\x20cm_contacts;');}var _0x2965a1=util['format'](_0x910d('0x6c'),_0x8256ac,_0x2f4e6f,_0x223ee2,_0x22a409[_0x910d('0x1c')],_0x22a409[_0x910d('0x39')]||null,NOW,NOW);if(_['isNil'](_0x4b3ae8['scheduledat'])){_0x2965a1+=',\x20scheduledAt\x20=\x20NOW()';}_0x906a66[_0x910d('0x43')](_0x2965a1);if(_0x22a409['duplicates']&&_0x22a409[_0x910d('0x6a')][_0x910d('0x54')]){_0x906a66[_0x910d('0x43')](insertCmContact(_0x22a409['ListId'],_0x2f4e6f,_0x22a409['duplicates'],_0x4b3ae8));_0x906a66[_0x910d('0x43')]('DROP\x20TABLE\x20'+_0x2f4e6f+';');}_0x906a66[_0x910d('0x43')](insertCmHopper(_0x22a409['ListId'],_0x910d('0x6d'),_0x910d('0x6e'),_0x910d('0x6f'),_0x3cc289));_0x906a66[_0x910d('0x43')](insertCmHopperBlack(_0x22a409['ListId'],_0x910d('0x70'),_0x910d('0x6e'),_0x910d('0x6f')));_0x906a66[_0x910d('0x43')](insertCmHopper(_0x22a409[_0x910d('0x1c')],'campaigns_has_cm_lists',_0x910d('0x71'),_0x910d('0x72'),_0x3cc289));_0x906a66['push'](insertCmHopperBlack(_0x22a409[_0x910d('0x1c')],'campaigns_has_cm_blacklists',_0x910d('0x71'),_0x910d('0x72')));BPromise[_0x910d('0x73')](_0x906a66,handleQuery)[_0x910d('0x74')](function(_0x1cbddb){stats[_0x910d('0x75')]=!![];stats[_0x910d('0x76')]=_0x22a409['duplicates']&&_0x22a409[_0x910d('0x6a')][_0x910d('0x54')]?results[0x2][_0x910d('0x76')]:results[0x0][_0x910d('0x76')];socket[_0x910d('0x65')](_0x910d('0x66')+_0x564bca,stats);fs['unlink'](_0x91b4b5);fs[_0x910d('0x77')](_0x8256ac);process[_0x910d('0x41')](0x0);})[_0x910d('0x48')](function(_0x271b7f){logger[_0x910d('0x49')](_0x271b7f['message']);process[_0x910d('0x41')](0x1);});}catch(_0x1a0fc1){logger['error'](_0x910d('0x78'),_0x1a0fc1[_0x910d('0x40')]);process[_0x910d('0x41')](0x1);}},'error':function(_0x4bb388,_0x2b1817,_0x1ae127,_0x37949d){throw new Error(_0x37949d);}});}function validate(){if(process[_0x910d('0x79')]&&process[_0x910d('0x79')]['length']<0x4){throw new Error(_0x910d('0x7a'));}var _0x20fdd2=path[_0x910d('0x12')](config['root'],_0x910d('0x7b'),process['argv'][0x2]);if(!fs['existsSync'](_0x20fdd2)){throw new Error(_0x910d('0x7c'));}var _0x367cc7={};try{_0x367cc7=JSON[_0x910d('0x51')](process[_0x910d('0x79')][0x3]);if(!_0x367cc7[_0x910d('0x7d')]){throw new Error(_0x910d('0x7e'));}if(!_0x367cc7[_0x910d('0x7d')][_0x910d('0x30')]){throw new Error(_0x910d('0x7f'));}if(!_0x367cc7[_0x910d('0x7d')][_0x910d('0x80')]){throw new Error(_0x910d('0x81'));}var _0x2b4a8b=0x0;if(_0x367cc7[_0x910d('0x7d')][_0x910d('0x1f')]){_0x2b4a8b=0x1;}if(!_0x367cc7[_0x910d('0x1c')]){throw new Error(_0x910d('0x82'));}}catch(_0x53e0de){throw new Error(_0x910d('0x83'));}var _0x74e7a6=[];try{_0x74e7a6=_[_0x910d('0x84')](JSON[_0x910d('0x51')](process[_0x910d('0x79')][0x4]),'id');}catch(_0x487518){logger[_0x910d('0x3f')](_0x910d('0x85'));}main(_0x20fdd2,_0x367cc7,_0x74e7a6,_0x2b4a8b);}validate();process['on'](_0x910d('0x86'),handleStop);process['on'](_0x910d('0x87'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 074cdf6..37d42dc 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf2f=['UniqueId','starttime','Answer\x20Time','Complete\x20Time','endtime','duration','Billable\x20Time','getSubjects','string','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','destexten','Queue','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','Talk\x20Time','Called\x20Number','Member\x20Name'];(function(_0x51baa4,_0x58fcaa){var _0xe03848=function(_0x3e8db2){while(--_0x3e8db2){_0x51baa4['push'](_0x51baa4['shift']());}};_0xe03848(++_0x58fcaa);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x405584,_0x1d7362){_0x405584=_0x405584-0x0;var _0x21c4db=_0xcf2f[_0x405584];return _0x21c4db;};'use strict';exports[_0xfcf2('0x0')]=function(_0x29a20b,_0xe6b3a5){var _0x3165cf=[{'type':_0xfcf2('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x29a20b[_0xfcf2('0x2')]()){case _0xfcf2('0x3'):switch(_0xe6b3a5[_0xfcf2('0x2')]()){case _0xfcf2('0x4'):_0x3165cf[_0xfcf2('0x5')]({'type':_0xfcf2('0x6'),'content':'','variableName':_0xfcf2('0x7')});_0x3165cf[_0xfcf2('0x5')]({'type':_0xfcf2('0x6'),'content':'','variableName':_0xfcf2('0x8')});break;case _0xfcf2('0x9'):_0x3165cf[_0xfcf2('0x5')]({'type':_0xfcf2('0x1'),'content':_0xfcf2('0xa'),'variableName':null});_0x3165cf['push']({'type':'variable','content':'','variableName':'destcalleridnum'});break;}}return _0x3165cf;};exports[_0xfcf2('0xb')]=function(_0x2a9ecb,_0x481e38){var _0xf38eab=[];switch(_0x2a9ecb[_0xfcf2('0x2')]()){case _0xfcf2('0x3'):switch(_0x481e38[_0xfcf2('0x2')]()){case'inbound':_0xf38eab=[{'type':'string','content':_0xfcf2('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0xfcf2('0xd'),'content':'','key':_0xfcf2('0xe'),'keyType':_0xfcf2('0x6'),'variableName':'calleridnum'},{'type':_0xfcf2('0xd'),'content':'','key':'Caller\x20Name','keyType':'variable','variableName':'calleridname'},{'type':_0xfcf2('0xd'),'content':'','key':'Call\x20To','keyType':_0xfcf2('0x6'),'variableName':_0xfcf2('0xf')},{'type':_0xfcf2('0xd'),'content':'','key':_0xfcf2('0x10'),'keyType':_0xfcf2('0x6'),'variableName':_0xfcf2('0x7')},{'type':_0xfcf2('0xd'),'content':'','key':'UniqueId','keyType':_0xfcf2('0x6'),'variableName':_0xfcf2('0x11')},{'type':_0xfcf2('0xd'),'content':'','key':'Date','keyType':_0xfcf2('0x6'),'variableName':_0xfcf2('0x12')},{'type':_0xfcf2('0x1'),'content':_0xfcf2('0x13'),'key':null,'keyType':null,'variableName':null},{'type':_0xfcf2('0xd'),'content':'','key':'Agent\x20Name','keyType':_0xfcf2('0x6'),'variableName':_0xfcf2('0x14')},{'type':'keyValue','content':'','key':_0xfcf2('0x15'),'keyType':_0xfcf2('0x6'),'variableName':_0xfcf2('0x16')},{'type':_0xfcf2('0x1'),'content':_0xfcf2('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0xfcf2('0xd'),'content':'','key':_0xfcf2('0x18'),'keyType':_0xfcf2('0x6'),'variableName':_0xfcf2('0x12')},{'type':'keyValue','content':'','key':_0xfcf2('0x19'),'keyType':_0xfcf2('0x6'),'variableName':_0xfcf2('0x1a')},{'type':'keyValue','content':'','key':_0xfcf2('0x1b'),'keyType':_0xfcf2('0x6'),'variableName':'agentcompleteAt'},{'type':_0xfcf2('0xd'),'content':'','key':_0xfcf2('0x1c'),'keyType':'variable','variableName':_0xfcf2('0x1d')},{'type':_0xfcf2('0xd'),'content':'','key':_0xfcf2('0x1e'),'keyType':_0xfcf2('0x6'),'variableName':'talktime'}];break;case _0xfcf2('0x9'):_0xf38eab=[{'type':_0xfcf2('0x1'),'content':_0xfcf2('0xc'),'variableName':null},{'type':_0xfcf2('0xd'),'content':'','key':_0xfcf2('0x1f'),'keyType':_0xfcf2('0x6'),'keyContent':'','variableName':_0xfcf2('0x16')},{'type':_0xfcf2('0xd'),'content':'','key':_0xfcf2('0x20'),'keyType':'variable','keyContent':'','variableName':'membername'},{'type':_0xfcf2('0xd'),'content':'','key':_0xfcf2('0x21'),'keyType':_0xfcf2('0x6'),'keyContent':'','variableName':'uniqueid'},{'type':_0xfcf2('0xd'),'content':'','key':'Date','keyType':_0xfcf2('0x6'),'keyContent':'','variableName':_0xfcf2('0x22')},{'type':_0xfcf2('0x1'),'content':_0xfcf2('0x17')},{'type':_0xfcf2('0xd'),'content':'','key':_0xfcf2('0x23'),'keyType':_0xfcf2('0x6'),'keyContent':'','variableName':'answertime'},{'type':'keyValue','content':'','key':_0xfcf2('0x24'),'keyType':_0xfcf2('0x6'),'keyContent':'','variableName':_0xfcf2('0x25')},{'type':_0xfcf2('0xd'),'content':'','key':'Duration','keyType':'variable','keyContent':'','variableName':_0xfcf2('0x26')},{'type':'keyValue','content':'','key':_0xfcf2('0x27'),'keyType':_0xfcf2('0x6'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0xf38eab;}; \ No newline at end of file +var _0x777d=['answertime','endtime','Duration','duration','billableseconds','[xCALLY\x20Ticket]','toLowerCase','push','queue','variable','string','Outbound\x20Call','destcalleridnum','getDescriptions','voice','inbound','keyValue','calleridnum','Caller\x20Name','destexten','Queue','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','Talk\x20Time','talktime','outbound','***\x20Call\x20Info\x20***','Member\x20Name','membername','UniqueId','uniqueid','Answer\x20Time'];(function(_0x37c28f,_0x3e84ff){var _0x5bedf4=function(_0x578a39){while(--_0x578a39){_0x37c28f['push'](_0x37c28f['shift']());}};_0x5bedf4(++_0x3e84ff);}(_0x777d,0xe9));var _0xd777=function(_0x2c7780,_0x100f4a){_0x2c7780=_0x2c7780-0x0;var _0x580bc8=_0x777d[_0x2c7780];return _0x580bc8;};'use strict';exports['getSubjects']=function(_0x1dba51,_0xe6b7d9){var _0x2b6eab=[{'type':'string','content':_0xd777('0x0'),'variableName':null}];switch(_0x1dba51[_0xd777('0x1')]()){case'voice':switch(_0xe6b7d9['toLowerCase']()){case'inbound':_0x2b6eab[_0xd777('0x2')]({'type':'variable','content':'','variableName':_0xd777('0x3')});_0x2b6eab['push']({'type':_0xd777('0x4'),'content':'','variableName':'calleridnum'});break;case'outbound':_0x2b6eab['push']({'type':_0xd777('0x5'),'content':_0xd777('0x6'),'variableName':null});_0x2b6eab[_0xd777('0x2')]({'type':_0xd777('0x4'),'content':'','variableName':_0xd777('0x7')});break;}}return _0x2b6eab;};exports[_0xd777('0x8')]=function(_0x28fedc,_0x234862){var _0x45afb5=[];switch(_0x28fedc[_0xd777('0x1')]()){case _0xd777('0x9'):switch(_0x234862[_0xd777('0x1')]()){case _0xd777('0xa'):_0x45afb5=[{'type':'string','content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xd777('0xb'),'content':'','key':'Caller\x20Number','keyType':_0xd777('0x4'),'variableName':_0xd777('0xc')},{'type':_0xd777('0xb'),'content':'','key':_0xd777('0xd'),'keyType':_0xd777('0x4'),'variableName':'calleridname'},{'type':_0xd777('0xb'),'content':'','key':'Call\x20To','keyType':_0xd777('0x4'),'variableName':_0xd777('0xe')},{'type':_0xd777('0xb'),'content':'','key':_0xd777('0xf'),'keyType':_0xd777('0x4'),'variableName':'queue'},{'type':_0xd777('0xb'),'content':'','key':'UniqueId','keyType':_0xd777('0x4'),'variableName':'uniqueid'},{'type':_0xd777('0xb'),'content':'','key':_0xd777('0x10'),'keyType':_0xd777('0x4'),'variableName':_0xd777('0x11')},{'type':_0xd777('0x5'),'content':_0xd777('0x12'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Name','keyType':_0xd777('0x4'),'variableName':'destcalleridname'},{'type':_0xd777('0xb'),'content':'','key':'Agent\x20Number','keyType':'variable','variableName':'destcalleridnum'},{'type':_0xd777('0x5'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Ring','keyType':'variable','variableName':'agentcalledAt'},{'type':_0xd777('0xb'),'content':'','key':_0xd777('0x13'),'keyType':_0xd777('0x4'),'variableName':_0xd777('0x14')},{'type':_0xd777('0xb'),'content':'','key':_0xd777('0x15'),'keyType':_0xd777('0x4'),'variableName':_0xd777('0x16')},{'type':_0xd777('0xb'),'content':'','key':_0xd777('0x17'),'keyType':_0xd777('0x4'),'variableName':'holdtime'},{'type':_0xd777('0xb'),'content':'','key':_0xd777('0x18'),'keyType':_0xd777('0x4'),'variableName':_0xd777('0x19')}];break;case _0xd777('0x1a'):_0x45afb5=[{'type':'string','content':_0xd777('0x1b'),'variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':_0xd777('0x4'),'keyContent':'','variableName':_0xd777('0x7')},{'type':_0xd777('0xb'),'content':'','key':_0xd777('0x1c'),'keyType':'variable','keyContent':'','variableName':_0xd777('0x1d')},{'type':_0xd777('0xb'),'content':'','key':_0xd777('0x1e'),'keyType':_0xd777('0x4'),'keyContent':'','variableName':_0xd777('0x1f')},{'type':_0xd777('0xb'),'content':'','key':_0xd777('0x10'),'keyType':_0xd777('0x4'),'keyContent':'','variableName':'starttime'},{'type':_0xd777('0x5'),'content':'***\x20Time\x20Info\x20***'},{'type':'keyValue','content':'','key':_0xd777('0x20'),'keyType':_0xd777('0x4'),'keyContent':'','variableName':_0xd777('0x21')},{'type':_0xd777('0xb'),'content':'','key':'Complete\x20Time','keyType':'variable','keyContent':'','variableName':_0xd777('0x22')},{'type':_0xd777('0xb'),'content':'','key':_0xd777('0x23'),'keyType':_0xd777('0x4'),'keyContent':'','variableName':_0xd777('0x24')},{'type':_0xd777('0xb'),'content':'','key':'Billable\x20Time','keyType':'variable','keyContent':'','variableName':_0xd777('0x25')}];break;}}return _0x45afb5;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 8ee1cf5..6338d5c 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2dde=['clone','omit','body','html','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','update','then','info','error','tracked','user','query'];(function(_0x3bec61,_0x3a04b8){var _0x4bf6d2=function(_0x51e312){while(--_0x51e312){_0x3bec61['push'](_0x3bec61['shift']());}};_0x4bf6d2(++_0x3a04b8);}(_0x2dde,0x19a));var _0xe2dd=function(_0x3c72a3,_0x444fe2){_0x3c72a3=_0x3c72a3-0x0;var _0x250ec4=_0x2dde[_0x3c72a3];return _0x250ec4;};'use strict';var _=require(_0xe2dd('0x0'));var db=require(_0xe2dd('0x1'))['db'];var loggers={'openchannel':require(_0xe2dd('0x2'))(_0xe2dd('0x3')),'mail':require(_0xe2dd('0x2'))('mail-interactions'),'fax':require(_0xe2dd('0x2'))(_0xe2dd('0x4')),'sms':require('../../config/logger')(_0xe2dd('0x5')),'chat':require('../../config/logger')(_0xe2dd('0x6')),'whatsapp':require(_0xe2dd('0x2'))(_0xe2dd('0x7'))};function getInteractionId(_0x2cc760,_0x2a76cb,_0xd5472f){if(_0x2cc760&&_0x2cc760[_[_0xe2dd('0x8')](_0xd5472f)+_0xe2dd('0x9')]){return _0x2cc760[_[_0xe2dd('0x8')](_0xd5472f)+_0xe2dd('0x9')];}else if(_0x2cc760&&_0x2cc760['id']){return _0x2cc760['id'];}else if(_0x2a76cb&&_0x2a76cb['id']){return _0x2a76cb['id'];}else{return _0xe2dd('0xa');}}function log(_0x5d44f2,_0x371fd8,_0x5598ec,_0x2b38f5,_0x521204,_0xdc1ace){loggers[_0x521204['toLowerCase']()][_0x5d44f2](_0xe2dd('0xb'),_0xdc1ace[_0xe2dd('0xc')](),_0x371fd8?_0x371fd8['id']:null,_0x371fd8?_0x371fd8[_0xe2dd('0xd')]:null,_0x371fd8?_0x371fd8[_0xe2dd('0xe')]:null,getInteractionId(_0x5598ec,_0x2b38f5,_0x521204),_0x5598ec?JSON[_0xe2dd('0xf')](_0x5598ec):_0xe2dd('0x10'));}function updateUser(_0x566bc4,_0x2fa4ac,_0x5254f3,_0x37ecd6,_0x2bab0f){db[_[_0xe2dd('0x8')](_0x37ecd6)+_0xe2dd('0x11')]['findOne']({'where':{'id':getInteractionId(_0x2fa4ac,_0x5254f3,_0x37ecd6)}})['then'](function(_0x1cfe54){if(_0x1cfe54){return _0x1cfe54[_0xe2dd('0x12')]({'UserId':_0x566bc4?_0x566bc4['id']:null});}})[_0xe2dd('0x13')](function(_0x26207f){if(_0x26207f){log(_0xe2dd('0x14'),_0x566bc4,_0x2fa4ac,_0x5254f3,_0x37ecd6,_0x2bab0f);}})['catch'](function(){log(_0xe2dd('0x15'),_0x566bc4,_0x2fa4ac,_0x5254f3,_0x37ecd6,_0x2bab0f);});}exports[_0xe2dd('0x16')]=function(_0x301fb1,_0x1766ba){return function(_0x46930d,_0x55bfd1,_0xa1059a){var _0xcbf55f=_0x46930d[_0xe2dd('0x17')];var _0x1897f0={};var _0x470c6d=_0x46930d[_0xe2dd('0x18')];if(_0x1897f0){_0x1897f0=_[_0xe2dd('0x19')](_0x46930d['body']);_0x1897f0=_[_0xe2dd('0x1a')](_0x1897f0,[_0xe2dd('0x1b'),_0xe2dd('0x1c'),'phone','fax','mobile']);}updateUser(_0xcbf55f,_0x1897f0,_0x470c6d,_0x301fb1,_0x1766ba);_0xa1059a(null);};}; \ No newline at end of file +var _0x1928=['update','then','catch','error','tracked','user','clone','body','omit','html','fax','mobile','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','null','Interaction','findOne'];(function(_0x310340,_0x5b1cd6){var _0x1f5721=function(_0x47d4fb){while(--_0x47d4fb){_0x310340['push'](_0x310340['shift']());}};_0x1f5721(++_0x5b1cd6);}(_0x1928,0x138));var _0x8192=function(_0x30ba12,_0x10e416){_0x30ba12=_0x30ba12-0x0;var _0x57f8ac=_0x1928[_0x30ba12];return _0x57f8ac;};'use strict';var _=require(_0x8192('0x0'));var db=require(_0x8192('0x1'))['db'];var loggers={'openchannel':require(_0x8192('0x2'))('openchannel-interactions'),'mail':require(_0x8192('0x2'))(_0x8192('0x3')),'fax':require(_0x8192('0x2'))(_0x8192('0x4')),'sms':require(_0x8192('0x2'))(_0x8192('0x5')),'chat':require(_0x8192('0x2'))(_0x8192('0x6')),'whatsapp':require(_0x8192('0x2'))(_0x8192('0x7'))};function getInteractionId(_0x1d6b3d,_0x23ddef,_0x2cf769){if(_0x1d6b3d&&_0x1d6b3d[_[_0x8192('0x8')](_0x2cf769)+'InteractionId']){return _0x1d6b3d[_[_0x8192('0x8')](_0x2cf769)+'InteractionId'];}else if(_0x1d6b3d&&_0x1d6b3d['id']){return _0x1d6b3d['id'];}else if(_0x23ddef&&_0x23ddef['id']){return _0x23ddef['id'];}else{return _0x8192('0x9');}}function log(_0x187471,_0xc26196,_0x23a5c7,_0x4b69eb,_0xa18a62,_0xab012a){loggers[_0xa18a62[_0x8192('0xa')]()][_0x187471](_0x8192('0xb'),_0xab012a[_0x8192('0xc')](),_0xc26196?_0xc26196['id']:null,_0xc26196?_0xc26196['name']:null,_0xc26196?_0xc26196[_0x8192('0xd')]:null,getInteractionId(_0x23a5c7,_0x4b69eb,_0xa18a62),_0x23a5c7?JSON[_0x8192('0xe')](_0x23a5c7):_0x8192('0xf'));}function updateUser(_0x19fbec,_0x24e204,_0x45ad9d,_0x19fe79,_0xef6993){db[_[_0x8192('0x8')](_0x19fe79)+_0x8192('0x10')][_0x8192('0x11')]({'where':{'id':getInteractionId(_0x24e204,_0x45ad9d,_0x19fe79)}})['then'](function(_0x406b4b){if(_0x406b4b){return _0x406b4b[_0x8192('0x12')]({'UserId':_0x19fbec?_0x19fbec['id']:null});}})[_0x8192('0x13')](function(_0x965da7){if(_0x965da7){log('info',_0x19fbec,_0x24e204,_0x45ad9d,_0x19fe79,_0xef6993);}})[_0x8192('0x14')](function(){log(_0x8192('0x15'),_0x19fbec,_0x24e204,_0x45ad9d,_0x19fe79,_0xef6993);});}exports[_0x8192('0x16')]=function(_0x5c3593,_0x27d2cb){return function(_0x5d34a1,_0x405ee6,_0x39f63e){var _0xc98a01=_0x5d34a1[_0x8192('0x17')];var _0x52d740={};var _0x115da4=_0x5d34a1['query'];if(_0x52d740){_0x52d740=_[_0x8192('0x18')](_0x5d34a1[_0x8192('0x19')]);_0x52d740=_[_0x8192('0x1a')](_0x52d740,[_0x8192('0x19'),_0x8192('0x1b'),'phone',_0x8192('0x1c'),_0x8192('0x1d')]);}updateUser(_0xc98a01,_0x52d740,_0x115da4,_0x5c3593,_0x27d2cb);_0x39f63e(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index c24110b..e32401f 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb17e=['split','aes-256-ctr','format','%s:%s:%s','update','utf8','final','parse','use','License','findOne','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','license','data1'];(function(_0xcf581b,_0x4359dd){var _0x4f454d=function(_0x182d58){while(--_0x182d58){_0xcf581b['push'](_0xcf581b['shift']());}};_0x4f454d(++_0x4359dd);}(_0xb17e,0x158));var _0xeb17=function(_0x4d6da3,_0x510025){_0x4d6da3=_0x4d6da3-0x0;var _0x19c274=_0xb17e[_0x4d6da3];return _0x19c274;};'use strict';var crypto=require(_0xeb17('0x0'));var util=require(_0xeb17('0x1'));var compose=require(_0xeb17('0x2'));var db=require(_0xeb17('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x5d6b8e,_0x1bc6f6){if(_0x5d6b8e&&_0x1bc6f6){if(_0x1bc6f6['data1']&&_0x1bc6f6[_0xeb17('0x4')]){var _0x9e60bf=_0x1bc6f6[_0xeb17('0x5')];var _0x4ae202=_0x1bc6f6['license'];var _0x1ece0e=_0x9e60bf[_0xeb17('0x6')]('-')[0x4];var _0xb95c8=_0x9e60bf[_0xeb17('0x6')]('-')[0x0];var _0xafe842=crypto['createDecipher'](_0xeb17('0x7'),util[_0xeb17('0x8')](_0xeb17('0x9'),_0x1ece0e,_0x9e60bf,_0xb95c8));var _0x54cef8=_0xafe842[_0xeb17('0xa')](_0x4ae202,'base64',_0xeb17('0xb'));_0x54cef8+=_0xafe842[_0xeb17('0xc')]('utf8');var _0x44b9da=JSON[_0xeb17('0xd')](_0x54cef8);return _0x44b9da['hasOwnProperty'](_0x5d6b8e)?_0x44b9da[_0x5d6b8e]:null;}}return null;}function isLimit(_0x28fc33,_0x204229,_0x1490ef,_0x54e443){var _0x53c5e3=_0x204229;return compose()[_0xeb17('0xe')](function(_0xc4f445,_0x1e9d12,_0x29a39c){return db[_0xeb17('0xf')][_0xeb17('0x10')]({'where':{'id':0x1},'raw':!![]})[_0xeb17('0x11')](function(_0x3d4e40){var _0x4e3abc=getValueFromLicense(_0x28fc33,_0x3d4e40);return _0x4e3abc?_0x4e3abc:_0x53c5e3;})[_0xeb17('0x11')](function(_0x3d8bc1){_0x53c5e3=_0x3d8bc1;return _0x1490ef[_0xeb17('0x12')](_0x54e443);})['then'](function(_0x536766){if(_0x536766>=_0x53c5e3){return _0x1e9d12['status'](0x193)[_0xeb17('0x13')]({'message':util[_0xeb17('0x8')](_0xeb17('0x14'),_0x28fc33)});}_0x29a39c();})[_0xeb17('0x15')](function(_0x32ebdf){_0x29a39c(_0x32ebdf);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':_0xeb17('0x16')},{'role':_0xeb17('0x17')}]}});}exports[_0xeb17('0x18')]=isUserLimit; \ No newline at end of file +var _0x0861=['admin','user','crypto','util','data1','license','split','aes-256-ctr','format','update','utf8','final','parse','hasOwnProperty','License','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0x0861,0x1a6));var _0x1086=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x0861[_0x3e5086];return _0xfeb102;};'use strict';var crypto=require(_0x1086('0x0'));var util=require(_0x1086('0x1'));var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x15450c,_0x2c4e66){if(_0x15450c&&_0x2c4e66){if(_0x2c4e66[_0x1086('0x2')]&&_0x2c4e66['license']){var _0x5d1451=_0x2c4e66['data1'];var _0x36c687=_0x2c4e66[_0x1086('0x3')];var _0x48eec6=_0x5d1451[_0x1086('0x4')]('-')[0x4];var _0x1b5410=_0x5d1451['split']('-')[0x0];var _0x16d166=crypto['createDecipher'](_0x1086('0x5'),util[_0x1086('0x6')]('%s:%s:%s',_0x48eec6,_0x5d1451,_0x1b5410));var _0x1911dd=_0x16d166[_0x1086('0x7')](_0x36c687,'base64',_0x1086('0x8'));_0x1911dd+=_0x16d166[_0x1086('0x9')](_0x1086('0x8'));var _0x58c739=JSON[_0x1086('0xa')](_0x1911dd);return _0x58c739[_0x1086('0xb')](_0x15450c)?_0x58c739[_0x15450c]:null;}}return null;}function isLimit(_0x15fdb9,_0x4852c8,_0x417d73,_0x3e3f09){var _0x11138a=_0x4852c8;return compose()['use'](function(_0x59d204,_0x3b9cf4,_0x541d24){return db[_0x1086('0xc')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x1086('0xd')](function(_0x3b8f0f){var _0x806fd7=getValueFromLicense(_0x15fdb9,_0x3b8f0f);return _0x806fd7?_0x806fd7:_0x11138a;})[_0x1086('0xd')](function(_0x5069bb){_0x11138a=_0x5069bb;return _0x417d73['count'](_0x3e3f09);})[_0x1086('0xd')](function(_0x112f8d){if(_0x112f8d>=_0x11138a){return _0x3b9cf4[_0x1086('0xe')](0x193)[_0x1086('0xf')]({'message':util[_0x1086('0x6')](_0x1086('0x10'),_0x15fdb9)});}_0x541d24();})['catch'](function(_0x4182e0){_0x541d24(_0x4182e0);});});}function isUserLimit(){return isLimit(_0x1086('0x11'),0x1,db[_0x1086('0x12')],{'where':{'$or':[{'role':_0x1086('0x13')},{'role':_0x1086('0x14')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index c1059d0..043b4d1 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 _0x66c8=['replace','[$and]','[$or]','length','split','forEach','shift','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','value','includes','$gt','$lte','add','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','$in','start','utcOffset','hours','minutes','seconds','lodash','parseSearch','startsWith','and'];(function(_0x514835,_0x95fcdf){var _0x44c151=function(_0x1a23ca){while(--_0x1a23ca){_0x514835['push'](_0x514835['shift']());}};_0x44c151(++_0x95fcdf);}(_0x66c8,0x114));var _0x866c=function(_0x3673d1,_0x4814c6){_0x3673d1=_0x3673d1-0x0;var _0x3730f3=_0x66c8[_0x3673d1];return _0x3730f3;};'use strict';var _=require(_0x866c('0x0'));var moment=require('moment');exports[_0x866c('0x1')]=function(_0x2f8600){var _0x29a949={'conditions':[]};_0x29a949['sqlOperator']=_[_0x866c('0x2')](_0x2f8600,'[$or]')?'or':_0x866c('0x3');var _0x2af9f3=_0x2f8600[_0x866c('0x4')](_0x866c('0x5'),'')[_0x866c('0x4')](_0x866c('0x6'),'')['split']('||');for(var _0x680704=0x0;_0x680704<_0x2af9f3[_0x866c('0x7')];_0x680704++){var _0xc4a654=_0x2af9f3[_0x680704][_0x866c('0x8')](':=');var _0x4bf0cc=_0xc4a654[0x0];var _0x22235c=_0xc4a654['slice'](0x1);_0x22235c[_0x866c('0x9')](function(_0x5532a0){var _0x5e86f6=_0x5532a0[_0x866c('0x8')]('[')[_0x866c('0xa')]();var _0x936e58=_0x5532a0[_0x866c('0xb')](/\[(.*?)\]/g);_0x936e58[_0x866c('0x9')](function(_0x4696f1){var _0x13739f=_0x4696f1[_0x866c('0x8')]('[')[_0x866c('0xc')](function(_0x38f57c){return _0x38f57c[_0x866c('0xd')](']')>-0x1;})[_0x866c('0xe')](function(_0x2d56e9){return _0x2d56e9['split'](']')[0x0];})[0x0];_0x29a949[_0x866c('0xf')][_0x866c('0x10')]({'field':_0x4bf0cc,'operator':_0x5e86f6,'value':_0x13739f});});});}return _0x29a949;};exports[_0x866c('0x11')]=function(_0x2a145a,_0x6e7f83,_0x37c136){var _0x5f4079={};if(_0x6e7f83===_0x866c('0x12')){if(_0x37c136[_0x866c('0x13')]===_0x866c('0x14')){_0x37c136[_0x866c('0x13')]='$between';_0x37c136[_0x866c('0x15')]+=','+_0x37c136['value'];}else if(_[_0x866c('0x16')]([_0x866c('0x17'),_0x866c('0x18')],_0x37c136[_0x866c('0x13')])){_0x37c136[_0x866c('0x15')]=moment(_0x37c136[_0x866c('0x15')])[_0x866c('0x19')](0x1,'days')[_0x866c('0x1a')](_0x866c('0x1b'));}}if(_0x37c136[_0x866c('0x1c')]){_0x6e7f83=_0x37c136[_0x866c('0x1c')];_0x5f4079[_0x866c('0x1d')]=_0x866c('0x1e')+_0x2a145a+'.'+_0x37c136[_0x866c('0x1f')]+_0x866c('0x20')+_0x37c136['castTo']+')\x20'+parseOperator(_0x37c136[_0x866c('0x13')]);}else{_0x5f4079['text']=_0x2a145a+'.'+_0x37c136['field']+'\x20'+parseOperator(_0x37c136['operator']);}if(_[_0x866c('0x16')]([_0x866c('0x21'),'$notIn'],_0x37c136[_0x866c('0x13')]))_0x5f4079[_0x866c('0x1d')]='('+_0x5f4079[_0x866c('0x1d')]+_0x866c('0x22')+_0x2a145a+'.'+_0x37c136[_0x866c('0x1f')]+_0x866c('0x23');_0x5f4079['value']=parseValue(_0x6e7f83,_0x37c136[_0x866c('0x13')],_0x37c136[_0x866c('0x15')]);return _0x5f4079;};function parseOperator(_0x1e2b3d){var _0x57e8bb;switch(_0x1e2b3d){case'$in':_0x57e8bb=_0x866c('0x24');break;case _0x866c('0x25'):_0x57e8bb=_0x866c('0x26');break;case _0x866c('0x14'):_0x57e8bb=_0x866c('0x27');break;case _0x866c('0x21'):_0x57e8bb='<>\x20?';break;case _0x866c('0x28'):case _0x866c('0x29'):case _0x866c('0x2a'):_0x57e8bb='LIKE\x20?';break;case _0x866c('0x2b'):_0x57e8bb=_0x866c('0x2c');break;case _0x866c('0x17'):_0x57e8bb=_0x866c('0x2d');break;case _0x866c('0x18'):_0x57e8bb=_0x866c('0x2e');break;case'$gte':_0x57e8bb=_0x866c('0x2f');break;case _0x866c('0x30'):_0x57e8bb=_0x866c('0x31');break;}return _0x57e8bb;}function parseValue(_0x228b8c,_0x40cb0c,_0x146901){var _0x33af08={'start':undefined,'end':undefined};switch(_0x40cb0c){case _0x866c('0x32'):case _0x866c('0x25'):_0x33af08[_0x866c('0x33')]=_0x146901[_0x866c('0x8')](',');break;case'$substring':_0x33af08[_0x866c('0x33')]='%'+_0x146901+'%';break;case _0x866c('0x29'):_0x33af08[_0x866c('0x33')]=_0x146901+'%';break;case'$endsWith':_0x33af08[_0x866c('0x33')]='%'+_0x146901;break;case'$between':var _0x29a82c=_0x146901[_0x866c('0x8')](',');var _0x146901=_0x29a82c[_0x866c('0xa')]();var _0x156333=_0x29a82c['pop']();if(_0x228b8c==='DATE'){_0x146901=moment(_0x146901)[_0x866c('0x34')](0x0,!![])[_0x866c('0x1a')]();_0x156333=moment(_0x156333)['utcOffset'](0x0,!![])[_0x866c('0x19')](0x17,_0x866c('0x35'))[_0x866c('0x19')](0x3b,_0x866c('0x36'))[_0x866c('0x19')](0x3b,_0x866c('0x37'))['format']();}_0x33af08={'start':_0x146901,'end':_0x156333};break;default:_0x33af08[_0x866c('0x33')]=_0x146901;break;}return _0x33af08;} \ No newline at end of file +var _0x0085=['pop','utcOffset','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','and','replace','[$and]','[$or]','split','length','forEach','shift','match','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','text','CAST(','castTo','includes','$notIn','\x20OR\x20','field','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$substring','$endsWith','LIKE\x20?','$lt','<\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start'];(function(_0x476e0a,_0x2cbf35){var _0x18d470=function(_0x57305a){while(--_0x57305a){_0x476e0a['push'](_0x476e0a['shift']());}};_0x18d470(++_0x2cbf35);}(_0x0085,0x10d));var _0x5008=function(_0x1bf5e7,_0x5a829b){_0x1bf5e7=_0x1bf5e7-0x0;var _0x1ac2cd=_0x0085[_0x1bf5e7];return _0x1ac2cd;};'use strict';var _=require(_0x5008('0x0'));var moment=require(_0x5008('0x1'));exports[_0x5008('0x2')]=function(_0x16e863){var _0x5706d9={'conditions':[]};_0x5706d9[_0x5008('0x3')]=_[_0x5008('0x4')](_0x16e863,'[$or]')?'or':_0x5008('0x5');var _0x42c914=_0x16e863[_0x5008('0x6')](_0x5008('0x7'),'')[_0x5008('0x6')](_0x5008('0x8'),'')[_0x5008('0x9')]('||');for(var _0x3128d3=0x0;_0x3128d3<_0x42c914[_0x5008('0xa')];_0x3128d3++){var _0x283f5b=_0x42c914[_0x3128d3][_0x5008('0x9')](':=');var _0x23179e=_0x283f5b[0x0];var _0x4621e3=_0x283f5b['slice'](0x1);_0x4621e3[_0x5008('0xb')](function(_0x54449e){var _0x2b43ae=_0x54449e[_0x5008('0x9')]('[')[_0x5008('0xc')]();var _0x36ff64=_0x54449e[_0x5008('0xd')](/\[(.*?)\]/g);_0x36ff64[_0x5008('0xb')](function(_0x806920){var _0x22f3f1=_0x806920['split']('[')['filter'](function(_0x4c81f3){return _0x4c81f3['indexOf'](']')>-0x1;})[_0x5008('0xe')](function(_0xa4b9ec){return _0xa4b9ec['split'](']')[0x0];})[0x0];_0x5706d9[_0x5008('0xf')][_0x5008('0x10')]({'field':_0x23179e,'operator':_0x2b43ae,'value':_0x22f3f1});});});}return _0x5706d9;};exports[_0x5008('0x11')]=function(_0x5962f3,_0x437d19,_0x54a849){var _0x1cea67={};if(_0x437d19===_0x5008('0x12')){if(_0x54a849[_0x5008('0x13')]===_0x5008('0x14')){_0x54a849[_0x5008('0x13')]=_0x5008('0x15');_0x54a849[_0x5008('0x16')]+=','+_0x54a849[_0x5008('0x16')];}else if(_['includes']([_0x5008('0x17'),_0x5008('0x18')],_0x54a849[_0x5008('0x13')])){_0x54a849[_0x5008('0x16')]=moment(_0x54a849[_0x5008('0x16')])[_0x5008('0x19')](0x1,_0x5008('0x1a'))[_0x5008('0x1b')](_0x5008('0x1c'));}}if(_0x54a849['castTo']){_0x437d19=_0x54a849['castTo'];_0x1cea67[_0x5008('0x1d')]=_0x5008('0x1e')+_0x5962f3+'.'+_0x54a849['field']+'\x20AS\x20'+_0x54a849[_0x5008('0x1f')]+')\x20'+parseOperator(_0x54a849[_0x5008('0x13')]);}else{_0x1cea67[_0x5008('0x1d')]=_0x5962f3+'.'+_0x54a849['field']+'\x20'+parseOperator(_0x54a849[_0x5008('0x13')]);}if(_[_0x5008('0x20')](['$ne',_0x5008('0x21')],_0x54a849['operator']))_0x1cea67[_0x5008('0x1d')]='('+_0x1cea67['text']+_0x5008('0x22')+_0x5962f3+'.'+_0x54a849[_0x5008('0x23')]+'\x20IS\x20NULL)';_0x1cea67[_0x5008('0x16')]=parseValue(_0x437d19,_0x54a849[_0x5008('0x13')],_0x54a849['value']);return _0x1cea67;};function parseOperator(_0x38f227){var _0x23d7f1;switch(_0x38f227){case _0x5008('0x24'):_0x23d7f1=_0x5008('0x25');break;case _0x5008('0x21'):_0x23d7f1=_0x5008('0x26');break;case'$eq':_0x23d7f1=_0x5008('0x27');break;case'$ne':_0x23d7f1='<>\x20?';break;case _0x5008('0x28'):case'$startsWith':case _0x5008('0x29'):_0x23d7f1=_0x5008('0x2a');break;case _0x5008('0x2b'):_0x23d7f1=_0x5008('0x2c');break;case _0x5008('0x17'):_0x23d7f1='>\x20?';break;case'$lte':_0x23d7f1='<=\x20?';break;case _0x5008('0x2d'):_0x23d7f1=_0x5008('0x2e');break;case'$between':_0x23d7f1=_0x5008('0x2f');break;}return _0x23d7f1;}function parseValue(_0x5db1f4,_0x22526d,_0x177f51){var _0x8aae19={'start':undefined,'end':undefined};switch(_0x22526d){case _0x5008('0x24'):case _0x5008('0x21'):_0x8aae19[_0x5008('0x30')]=_0x177f51['split'](',');break;case _0x5008('0x28'):_0x8aae19['start']='%'+_0x177f51+'%';break;case'$startsWith':_0x8aae19[_0x5008('0x30')]=_0x177f51+'%';break;case _0x5008('0x29'):_0x8aae19[_0x5008('0x30')]='%'+_0x177f51;break;case'$between':var _0x1f28de=_0x177f51[_0x5008('0x9')](',');var _0x177f51=_0x1f28de[_0x5008('0xc')]();var _0x50ef11=_0x1f28de[_0x5008('0x31')]();if(_0x5db1f4===_0x5008('0x12')){_0x177f51=moment(_0x177f51)[_0x5008('0x32')](0x0,!![])[_0x5008('0x1b')]();_0x50ef11=moment(_0x50ef11)[_0x5008('0x32')](0x0,!![])['add'](0x17,'hours')[_0x5008('0x19')](0x3b,_0x5008('0x33'))[_0x5008('0x19')](0x3b,_0x5008('0x34'))[_0x5008('0x1b')]();}_0x8aae19={'start':_0x177f51,'end':_0x50ef11};break;default:_0x8aae19[_0x5008('0x30')]=_0x177f51;break;}return _0x8aae19;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 72079b3..e1fb2b9 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 _0xa4ee=['join','lodash','sequelize','moment','fields','split','filters','isEmpty','forOwn','type','parse','$gte','format','YYYY-MM-DD','utc','$lte','name','isArray','limit','offset','map','indexOf','priority','cast','substr','DESC','col','unsigned','ASC','omit','length','isObject','unset','hasOwnProperty','^[+]?[0-9]*$','isEmail','match','getFullTextValue','forEach','replace','includes','push'];(function(_0x214266,_0x1f6f52){var _0x568f75=function(_0x541904){while(--_0x541904){_0x214266['push'](_0x214266['shift']());}};_0x568f75(++_0x1f6f52);}(_0xa4ee,0x7f));var _0xea4e=function(_0xb42da0,_0x5e98b4){_0xb42da0=_0xb42da0-0x0;var _0x4036c7=_0xa4ee[_0xb42da0];return _0x4036c7;};'use strict';var _=require(_0xea4e('0x0'));var sequelize=require(_0xea4e('0x1'));var moment=require(_0xea4e('0x2'));var LIMIT_VALUE=0xfa;exports[_0xea4e('0x3')]=function(_0x5c799a){var _0x46bcbf=null;if(_0x5c799a){_0x46bcbf=_0x5c799a[_0xea4e('0x4')](',');}return _0x46bcbf;};exports[_0xea4e('0x5')]=function(_0x30f7e8,_0x3583b5){var _0x1b859f={};if(!_[_0xea4e('0x6')](_0x30f7e8)){_[_0xea4e('0x7')](_0x30f7e8,function(_0x5ce447,_0x2dc116){try{if(_0x3583b5){var _0x47608f=_['find'](_0x3583b5,{'name':_0x2dc116})||{};if(_0x47608f[_0xea4e('0x8')]==='DATE'&&_['isPlainObject'](_0x5ce447)){var _0x59d073=JSON[_0xea4e('0x9')](_0x5ce447);var _0x319c40={'$gte':moment(moment(_0x59d073[_0xea4e('0xa')])[_0xea4e('0xb')](_0xea4e('0xc')))[_0xea4e('0xd')]()[_0xea4e('0xb')](),'$lte':moment(moment(_0x59d073[_0xea4e('0xe')])[_0xea4e('0xb')](_0xea4e('0xc')))[_0xea4e('0xd')]()['subtract'](0x1,'s')[_0xea4e('0xb')]()};_0x1b859f[_0x2dc116]=_0x319c40;}else if(_0x47608f[_0xea4e('0xf')]==='uniqueid'){_0x1b859f[_0x2dc116]=_0x5ce447;}else{_0x1b859f[_0x2dc116]=_[_0xea4e('0x10')](_0x5ce447)?_0x5ce447:JSON[_0xea4e('0x9')](_0x5ce447);}}else{_0x1b859f[_0x2dc116]=_[_0xea4e('0x10')](_0x5ce447)?_0x5ce447:JSON['parse'](_0x5ce447);}}catch(_0x19abea){_0x1b859f[_0x2dc116]=_0x5ce447[_0xea4e('0x4')](',');}});}return _0x1b859f;};exports[_0xea4e('0x11')]=function(_0x446c99){_0x446c99=parseInt(_0x446c99,0xa);if(!_0x446c99||_0x446c99<0x0){_0x446c99=LIMIT_VALUE;}return _0x446c99;};exports[_0xea4e('0x12')]=function(_0x4cb575){_0x4cb575=parseInt(_0x4cb575,0xa);if(!_0x4cb575||_0x4cb575<0x0){_0x4cb575=0x0;}return _0x4cb575;};exports['sort']=function(_0x317aab){var _0x261307,_0x4ae421=null;if(_0x317aab){_0x261307=_0x317aab[_0xea4e('0x4')](',');_0x4ae421=_[_0xea4e('0x13')](_0x261307,function(_0x54fb8d){if(_0x54fb8d[_0xea4e('0x14')]('-')===0x0){return[_0x54fb8d===_0xea4e('0x15')?sequelize[_0xea4e('0x16')](sequelize['col']('priority'),'unsigned'):_0x54fb8d[_0xea4e('0x17')](0x1),_0xea4e('0x18')];}else{return[_0x54fb8d===_0xea4e('0x15')?sequelize['cast'](sequelize[_0xea4e('0x19')](_0xea4e('0x15')),_0xea4e('0x1a')):_0x54fb8d,_0xea4e('0x1b')];}});}return _0x4ae421;};exports[_0xea4e('0x1c')]=function(_0x4c1312,_0x26839d){if(_[_0xea4e('0x6')](_0x4c1312)){return _0x4c1312;}if(_[_0xea4e('0x10')](_0x4c1312)){for(var _0x3b2a73=0x0;_0x3b2a73<_0x4c1312[_0xea4e('0x1d')];_0x3b2a73+=0x1){_0x4c1312[_0x3b2a73]=this[_0xea4e('0x1c')](_0x4c1312[_0x3b2a73],_0x26839d);}return _0x4c1312;}if(!_[_0xea4e('0x1e')](_0x4c1312)){return _0x4c1312;}if(_['isString'](_0x26839d)){_0x26839d=[_0x26839d];}if(!_[_0xea4e('0x10')](_0x26839d)){return _0x4c1312;}for(var _0x3e558b=0x0;_0x3e558b<_0x26839d[_0xea4e('0x1d')];_0x3e558b+=0x1){_[_0xea4e('0x1f')](_0x4c1312,_0x26839d[_0x3e558b]);}for(var _0x3ffacd in _0x4c1312){if(_0x4c1312[_0xea4e('0x20')](_0x3ffacd)){_0x4c1312[_0x3ffacd]=this[_0xea4e('0x1c')](_0x4c1312[_0x3ffacd],_0x26839d);}}return _0x4c1312;};exports['isNumeric']=function(_0xb10abd){return _0xb10abd['match'](RegExp(_0xea4e('0x21')))?!![]:![];};exports[_0xea4e('0x22')]=function(_0x2a56f4){return _0x2a56f4[_0xea4e('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0xea4e('0x24')]=function(_0x553293){var _0x111a9d=[];_0x553293[_0xea4e('0x4')](/[ ,]+/)[_0xea4e('0x25')](function(_0x230dfe){_0x230dfe=_0x230dfe[_0xea4e('0x26')](/([^:]")"+/g,'$1');_0x230dfe='+'+_0x230dfe+'*';if(_0x230dfe[_0xea4e('0x27')]('@'))_0x230dfe='\x22'+_0x230dfe+'\x22';_0x111a9d[_0xea4e('0x28')](_0x230dfe);});return _0x111a9d[_0xea4e('0x29')]('\x20');}; \ No newline at end of file +var _0xc1f0=['forOwn','find','type','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','subtract','name','isArray','limit','offset','sort','priority','col','unsigned','substr','DESC','ASC','omit','isObject','length','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','replace','includes','push','join','lodash','sequelize','fields','split','filters'];(function(_0x38f464,_0x536ee6){var _0xec8ea4=function(_0x2fb321){while(--_0x2fb321){_0x38f464['push'](_0x38f464['shift']());}};_0xec8ea4(++_0x536ee6);}(_0xc1f0,0x10c));var _0x0c1f=function(_0x19c3e0,_0x381910){_0x19c3e0=_0x19c3e0-0x0;var _0x3eabe8=_0xc1f0[_0x19c3e0];return _0x3eabe8;};'use strict';var _=require(_0x0c1f('0x0'));var sequelize=require(_0x0c1f('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;exports[_0x0c1f('0x2')]=function(_0x24663c){var _0x40c215=null;if(_0x24663c){_0x40c215=_0x24663c[_0x0c1f('0x3')](',');}return _0x40c215;};exports[_0x0c1f('0x4')]=function(_0x210fca,_0x42c464){var _0x5e6676={};if(!_['isEmpty'](_0x210fca)){_[_0x0c1f('0x5')](_0x210fca,function(_0x38404c,_0x51fcd1){try{if(_0x42c464){var _0xfb1d78=_[_0x0c1f('0x6')](_0x42c464,{'name':_0x51fcd1})||{};if(_0xfb1d78[_0x0c1f('0x7')]==='DATE'&&_[_0x0c1f('0x8')](_0x38404c)){var _0x4e6a2d=JSON[_0x0c1f('0x9')](_0x38404c);var _0x5ac16e={'$gte':moment(moment(_0x4e6a2d[_0x0c1f('0xa')])[_0x0c1f('0xb')]('YYYY-MM-DD'))['utc']()[_0x0c1f('0xb')](),'$lte':moment(moment(_0x4e6a2d['$lte'])[_0x0c1f('0xb')](_0x0c1f('0xc')))[_0x0c1f('0xd')]()[_0x0c1f('0xe')](0x1,'s')[_0x0c1f('0xb')]()};_0x5e6676[_0x51fcd1]=_0x5ac16e;}else if(_0xfb1d78[_0x0c1f('0xf')]==='uniqueid'){_0x5e6676[_0x51fcd1]=_0x38404c;}else{_0x5e6676[_0x51fcd1]=_[_0x0c1f('0x10')](_0x38404c)?_0x38404c:JSON[_0x0c1f('0x9')](_0x38404c);}}else{_0x5e6676[_0x51fcd1]=_[_0x0c1f('0x10')](_0x38404c)?_0x38404c:JSON[_0x0c1f('0x9')](_0x38404c);}}catch(_0x369c20){_0x5e6676[_0x51fcd1]=_0x38404c[_0x0c1f('0x3')](',');}});}return _0x5e6676;};exports[_0x0c1f('0x11')]=function(_0x39f26e){_0x39f26e=parseInt(_0x39f26e,0xa);if(!_0x39f26e||_0x39f26e<0x0){_0x39f26e=LIMIT_VALUE;}return _0x39f26e;};exports[_0x0c1f('0x12')]=function(_0x1e6dac){_0x1e6dac=parseInt(_0x1e6dac,0xa);if(!_0x1e6dac||_0x1e6dac<0x0){_0x1e6dac=0x0;}return _0x1e6dac;};exports[_0x0c1f('0x13')]=function(_0x41540d){var _0x2db29c,_0x5a1d7f=null;if(_0x41540d){_0x2db29c=_0x41540d[_0x0c1f('0x3')](',');_0x5a1d7f=_['map'](_0x2db29c,function(_0x422c3b){if(_0x422c3b['indexOf']('-')===0x0){return[_0x422c3b===_0x0c1f('0x14')?sequelize['cast'](sequelize[_0x0c1f('0x15')]('priority'),_0x0c1f('0x16')):_0x422c3b[_0x0c1f('0x17')](0x1),_0x0c1f('0x18')];}else{return[_0x422c3b==='priority'?sequelize['cast'](sequelize[_0x0c1f('0x15')]('priority'),_0x0c1f('0x16')):_0x422c3b,_0x0c1f('0x19')];}});}return _0x5a1d7f;};exports[_0x0c1f('0x1a')]=function(_0x288043,_0x13e01c){if(_['isEmpty'](_0x288043)){return _0x288043;}if(_['isArray'](_0x288043)){for(var _0x3b8a68=0x0;_0x3b8a68<_0x288043['length'];_0x3b8a68+=0x1){_0x288043[_0x3b8a68]=this[_0x0c1f('0x1a')](_0x288043[_0x3b8a68],_0x13e01c);}return _0x288043;}if(!_[_0x0c1f('0x1b')](_0x288043)){return _0x288043;}if(_['isString'](_0x13e01c)){_0x13e01c=[_0x13e01c];}if(!_[_0x0c1f('0x10')](_0x13e01c)){return _0x288043;}for(var _0x47ba88=0x0;_0x47ba88<_0x13e01c[_0x0c1f('0x1c')];_0x47ba88+=0x1){_[_0x0c1f('0x1d')](_0x288043,_0x13e01c[_0x47ba88]);}for(var _0x22774f in _0x288043){if(_0x288043[_0x0c1f('0x1e')](_0x22774f)){_0x288043[_0x22774f]=this[_0x0c1f('0x1a')](_0x288043[_0x22774f],_0x13e01c);}}return _0x288043;};exports[_0x0c1f('0x1f')]=function(_0x4ef20c){return _0x4ef20c[_0x0c1f('0x20')](RegExp(_0x0c1f('0x21')))?!![]:![];};exports[_0x0c1f('0x22')]=function(_0x582915){return _0x582915['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x53323a){var _0x3bfb0d=[];_0x53323a[_0x0c1f('0x3')](/[ ,]+/)['forEach'](function(_0x2382da){_0x2382da=_0x2382da[_0x0c1f('0x23')](/([^:]")"+/g,'$1');_0x2382da='+'+_0x2382da+'*';if(_0x2382da[_0x0c1f('0x24')]('@'))_0x2382da='\x22'+_0x2382da+'\x22';_0x3bfb0d[_0x0c1f('0x25')](_0x2382da);});return _0x3bfb0d[_0x0c1f('0x26')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 042e935..2b1e7b2 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaaca=['default','get','env','production','set','appPath','root','test','join','client','use','toISOString','split','views','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','initialize','express','serve-favicon','body-parser','method-override','errorhandler','passport','cors','./environment','../mysqldb'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xaaca,0x1a4));var _0xaaac=function(_0x3c4a7c,_0x2f4e3c){_0x3c4a7c=_0x3c4a7c-0x0;var _0xf13d1e=_0xaaca[_0x3c4a7c];return _0xf13d1e;};'use strict';var express=require(_0xaaac('0x0'));var favicon=require(_0xaaac('0x1'));var bodyParser=require(_0xaaac('0x2'));var methodOverride=require(_0xaaac('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require(_0xaaac('0x4'));var path=require('path');var passport=require(_0xaaac('0x5'));var cors=require(_0xaaac('0x6'));var moment=require('moment');var config=require(_0xaaac('0x7'));var db=require(_0xaaac('0x8'))['db'];exports[_0xaaac('0x9')]=function(_0x1c22b3){var _0x35efaf=_0x1c22b3[_0xaaac('0xa')](_0xaaac('0xb'));if(_0x35efaf===_0xaaac('0xc')){_0x1c22b3[_0xaaac('0xd')](_0xaaac('0xe'),path['join'](config[_0xaaac('0xf')],'public'));}if(_0x35efaf==='development'||_0x35efaf===_0xaaac('0x10')){_0x1c22b3[_0xaaac('0xd')](_0xaaac('0xe'),path[_0xaaac('0x11')](config['root'],_0xaaac('0x12')));_0x1c22b3[_0xaaac('0x13')](errorHandler());}_0x1c22b3[_0xaaac('0xd')]('json\x20replacer',function(_0x14bcf2,_0x455dc2){if(this[_0x14bcf2]instanceof Date){_0x455dc2=this[_0x14bcf2][_0xaaac('0x14')]()[_0xaaac('0x15')]('.')[0x0]+'Z';}return _0x455dc2;});_0x1c22b3[_0xaaac('0x13')](express['static'](_0x1c22b3[_0xaaac('0xa')]('appPath')));_0x1c22b3[_0xaaac('0xd')](_0xaaac('0x16'),config[_0xaaac('0xf')]+_0xaaac('0x17'));_0x1c22b3[_0xaaac('0x18')](_0xaaac('0x19'),require(_0xaaac('0x1a'))[_0xaaac('0x1b')]);_0x1c22b3[_0xaaac('0xd')](_0xaaac('0x1c'),'html');_0x1c22b3[_0xaaac('0x13')](bodyParser[_0xaaac('0x1d')]({'limit':_0xaaac('0x1e'),'extended':!![]}));_0x1c22b3[_0xaaac('0x13')](bodyParser[_0xaaac('0x1f')]({'limit':_0xaaac('0x1e')}));_0x1c22b3[_0xaaac('0x13')](cors());_0x1c22b3[_0xaaac('0x13')](methodOverride());_0x1c22b3[_0xaaac('0x13')](cookieParser());_0x1c22b3['use'](passport[_0xaaac('0x20')]());}; \ No newline at end of file +var _0x4f2f=['body-parser','method-override','cookie-parser','path','passport','cors','moment','./environment','default','get','env','set','join','root','public','development','test','client','static','views','/server/views','engine','html','view\x20engine','use','urlencoded','initialize'];(function(_0x354581,_0x42a8f2){var _0x142573=function(_0x2c4407){while(--_0x2c4407){_0x354581['push'](_0x354581['shift']());}};_0x142573(++_0x42a8f2);}(_0x4f2f,0x1b0));var _0xf4f2=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x4f2f[_0x13ea00];return _0x1f7347;};'use strict';var express=require('express');var favicon=require('serve-favicon');var bodyParser=require(_0xf4f2('0x0'));var methodOverride=require(_0xf4f2('0x1'));var cookieParser=require(_0xf4f2('0x2'));var errorHandler=require('errorhandler');var path=require(_0xf4f2('0x3'));var passport=require(_0xf4f2('0x4'));var cors=require(_0xf4f2('0x5'));var moment=require(_0xf4f2('0x6'));var config=require(_0xf4f2('0x7'));var db=require('../mysqldb')['db'];exports[_0xf4f2('0x8')]=function(_0x9318db){var _0x2e52f2=_0x9318db[_0xf4f2('0x9')](_0xf4f2('0xa'));if(_0x2e52f2==='production'){_0x9318db[_0xf4f2('0xb')]('appPath',path[_0xf4f2('0xc')](config[_0xf4f2('0xd')],_0xf4f2('0xe')));}if(_0x2e52f2===_0xf4f2('0xf')||_0x2e52f2===_0xf4f2('0x10')){_0x9318db[_0xf4f2('0xb')]('appPath',path[_0xf4f2('0xc')](config[_0xf4f2('0xd')],_0xf4f2('0x11')));_0x9318db['use'](errorHandler());}_0x9318db[_0xf4f2('0xb')]('json\x20replacer',function(_0x2b612e,_0x5cf4ab){if(this[_0x2b612e]instanceof Date){_0x5cf4ab=this[_0x2b612e]['toISOString']()['split']('.')[0x0]+'Z';}return _0x5cf4ab;});_0x9318db['use'](express[_0xf4f2('0x12')](_0x9318db['get']('appPath')));_0x9318db[_0xf4f2('0xb')](_0xf4f2('0x13'),config[_0xf4f2('0xd')]+_0xf4f2('0x14'));_0x9318db[_0xf4f2('0x15')](_0xf4f2('0x16'),require('ejs')['renderFile']);_0x9318db['set'](_0xf4f2('0x17'),_0xf4f2('0x16'));_0x9318db[_0xf4f2('0x18')](bodyParser[_0xf4f2('0x19')]({'limit':'50mb','extended':!![]}));_0x9318db[_0xf4f2('0x18')](bodyParser['json']({'limit':'50mb'}));_0x9318db[_0xf4f2('0x18')](cors());_0x9318db[_0xf4f2('0x18')](methodOverride());_0x9318db['use'](cookieParser());_0x9318db[_0xf4f2('0x18')](passport[_0xf4f2('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 2be6ccf..05a8304 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 _0xc912=['mac','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','update','digest','hex','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','orderBy','family','IPv4','internal','concat','head'];(function(_0x11afe7,_0x2dcbae){var _0x2967b5=function(_0x534484){while(--_0x534484){_0x11afe7['push'](_0x11afe7['shift']());}};_0x2967b5(++_0x2dcbae);}(_0xc912,0x9a));var _0x2c91=function(_0x2d07a8,_0x3bd0e1){_0x2d07a8=_0x2d07a8-0x0;var _0x1c2d33=_0xc912[_0x2d07a8];return _0x1c2d33;};'use strict';var _=require(_0x2c91('0x0'));var os=require('os');var crypto=require(_0x2c91('0x1'));var machine=require(_0x2c91('0x2'));var exec=require('child_process')[_0x2c91('0x3')];var config=require(_0x2c91('0x4'));function getInterfaces(){var _0x12507a=[];var _0x26802a=os['networkInterfaces']();var _0x30ee6d=_[_0x2c91('0x5')](_['keys'](_0x26802a));for(var _0x3c8c26=0x0;_0x3c8c26<_0x30ee6d['length'];_0x3c8c26++){var _0x181ac5=_0x26802a[_0x30ee6d[_0x3c8c26]]['filter'](function(_0x49601b){return _0x49601b[_0x2c91('0x6')]===_0x2c91('0x7')&&_0x49601b[_0x2c91('0x8')]===![];});_0x12507a=_0x12507a[_0x2c91('0x9')](_0x181ac5);}return _0x12507a;}function getFirstInterface(){var _0x3ec2a6=_[_0x2c91('0xa')](getInterfaces());return{'macAddress':_0x3ec2a6&&_0x3ec2a6[_0x2c91('0xb')]?_0x3ec2a6[_0x2c91('0xb')]:'00:00:00:00:00:00','ipAddress':_0x3ec2a6&&_0x3ec2a6[_0x2c91('0xc')]?_0x3ec2a6[_0x2c91('0xc')]:_0x2c91('0xd')};}exports[_0x2c91('0xe')]=getFirstInterface;function getCPUhash(){var _0x4d82d5=_[_0x2c91('0x5')](os[_0x2c91('0xf')]()[_0x2c91('0x10')](function(_0x4214bf){return _0x4214bf[_0x2c91('0x11')];}))[_0x2c91('0x12')](':');return crypto[_0x2c91('0x13')]('md5')[_0x2c91('0x14')](_0x4d82d5)[_0x2c91('0x15')](_0x2c91('0x16'));}exports['getUuid']=function(){var _0x10871a=os[_0x2c91('0x17')]();var _0x5bc76f=/[0-9a-f-]{36}/;if(config[_0x2c91('0x18')]&&_0x5bc76f[_0x2c91('0x19')](config[_0x2c91('0x18')])){return config['licenseToken'];}else if(_0x10871a===_0x2c91('0x1a')){return exec(_0x2c91('0x1b'),{'encoding':'utf8'})[_0x2c91('0x1c')]('\x0d\x0a','');}else{var _0x10d27e=getFirstInterface();var _0x599a2f=getCPUhash();var _0x267f61=_0x599a2f+'|'+os[_0x2c91('0x1d')]()+'|'+_0x10d27e[_0x2c91('0x1e')]+'|'+_0x10d27e[_0x2c91('0x1f')];var _0x5f42cb=crypto[_0x2c91('0x13')]('md5')[_0x2c91('0x14')](_0x267f61)[_0x2c91('0x15')]('hex');return _0x5f42cb[_0x2c91('0x20')](0x0,0x8)+'-'+_0x5f42cb[_0x2c91('0x20')](0x8,0xc)+'-'+_0x5f42cb[_0x2c91('0x20')](0xc,0x10)+'-'+_0x5f42cb['substring'](0x10,0x14)+'-'+_0x5f42cb[_0x2c91('0x20')](0x14);}}; \ No newline at end of file +var _0x33ed=['length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','model','join','createHash','md5','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','ipAddress','update','substring','crypto','execSync','networkInterfaces'];(function(_0x5627fd,_0x4bf61c){var _0x15eb6d=function(_0x391733){while(--_0x391733){_0x5627fd['push'](_0x5627fd['shift']());}};_0x15eb6d(++_0x4bf61c);}(_0x33ed,0x66));var _0xd33e=function(_0x54a761,_0x431fd4){_0x54a761=_0x54a761-0x0;var _0x37d1da=_0x33ed[_0x54a761];return _0x37d1da;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xd33e('0x0'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0xd33e('0x1')];var config=require('../environment');function getInterfaces(){var _0x5821f8=[];var _0x142133=os[_0xd33e('0x2')]();var _0x18acfe=_['orderBy'](_['keys'](_0x142133));for(var _0x19e69f=0x0;_0x19e69f<_0x18acfe[_0xd33e('0x3')];_0x19e69f++){var _0x48349b=_0x142133[_0x18acfe[_0x19e69f]][_0xd33e('0x4')](function(_0x32c230){return _0x32c230[_0xd33e('0x5')]===_0xd33e('0x6')&&_0x32c230[_0xd33e('0x7')]===![];});_0x5821f8=_0x5821f8[_0xd33e('0x8')](_0x48349b);}return _0x5821f8;}function getFirstInterface(){var _0x315821=_[_0xd33e('0x9')](getInterfaces());return{'macAddress':_0x315821&&_0x315821['mac']?_0x315821[_0xd33e('0xa')]:_0xd33e('0xb'),'ipAddress':_0x315821&&_0x315821[_0xd33e('0xc')]?_0x315821[_0xd33e('0xc')]:_0xd33e('0xd')};}exports[_0xd33e('0xe')]=getFirstInterface;function getCPUhash(){var _0x454e77=_[_0xd33e('0xf')](os[_0xd33e('0x10')]()[_0xd33e('0x11')](function(_0x3e027f){return _0x3e027f[_0xd33e('0x12')];}))[_0xd33e('0x13')](':');return crypto[_0xd33e('0x14')](_0xd33e('0x15'))['update'](_0x454e77)[_0xd33e('0x16')](_0xd33e('0x17'));}exports[_0xd33e('0x18')]=function(){var _0x2b53b3=os[_0xd33e('0x19')]();var _0xa8524a=/[0-9a-f-]{36}/;if(config[_0xd33e('0x1a')]&&_0xa8524a[_0xd33e('0x1b')](config[_0xd33e('0x1a')])){return config[_0xd33e('0x1a')];}else if(_0x2b53b3===_0xd33e('0x1c')){return exec(_0xd33e('0x1d'),{'encoding':_0xd33e('0x1e')})[_0xd33e('0x1f')]('\x0d\x0a','');}else{var _0x35e520=getFirstInterface();var _0x1f698a=getCPUhash();var _0x53a5b8=_0x1f698a+'|'+os['hostname']()+'|'+_0x35e520['macAddress']+'|'+_0x35e520[_0xd33e('0x20')];var _0x4590c2=crypto[_0xd33e('0x14')](_0xd33e('0x15'))[_0xd33e('0x21')](_0x53a5b8)[_0xd33e('0x16')](_0xd33e('0x17'));return _0x4590c2['substring'](0x0,0x8)+'-'+_0x4590c2['substring'](0x8,0xc)+'-'+_0x4590c2[_0xd33e('0x22')](0xc,0x10)+'-'+_0x4590c2[_0xd33e('0x22')](0x10,0x14)+'-'+_0x4590c2[_0xd33e('0x22')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index ac96299..3a2266c 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 _0xb830=['THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','error','finally','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','GET','then','catch','get','data1','active','license','data2','info'];(function(_0x398784,_0x4f43d4){var _0x76f0e1=function(_0x2d2c8e){while(--_0x2d2c8e){_0x398784['push'](_0x398784['shift']());}};_0x76f0e1(++_0x4f43d4);}(_0xb830,0xe5));var _0x0b83=function(_0x496c99,_0x5d965f){_0x496c99=_0x496c99-0x0;var _0x31a066=_0xb830[_0x496c99];return _0x31a066;};'use strict';var util=require(_0x0b83('0x0'));var moment=require(_0x0b83('0x1'));var rp=require(_0x0b83('0x2'));var BPromise=require(_0x0b83('0x3'));var pkginfo=require(_0x0b83('0x4'))(module,_0x0b83('0x5'));var db=require(_0x0b83('0x6'))['db'];var encryptor=require(_0x0b83('0x7'));var hardware=require(_0x0b83('0x8'));var logger=require(_0x0b83('0x9'))('license');var HOST=_0x0b83('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2d0587){return new BPromise(function(_0x102585,_0x2ad57f){var _0x961155=util[_0x0b83('0xb')](_0x0b83('0xc'),HOST,_0x2d0587,module['exports'][_0x0b83('0x5')]);if(oldToken){_0x961155=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x2d0587,module[_0x0b83('0xd')][_0x0b83('0x5')],oldToken);}var _0x14d4e6={'uri':_0x961155,'method':_0x0b83('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x14d4e6)[_0x0b83('0xf')](function(_0x37016e){_0x102585(_0x37016e);})[_0x0b83('0x10')](function(_0x48f011){_0x2ad57f(_0x48f011);});});}function manageLicense(_0x1b43fe,_0x5403b6){var _0x29f2ce=_0x5403b6[_0x0b83('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x29f2ce[_0x0b83('0x12')]!==_0x1b43fe&&!_0x29f2ce['data2']){oldToken=_0x29f2ce[_0x0b83('0x12')];}httpRequest(_0x1b43fe)[_0x0b83('0xf')](function(_0xc00dfb){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0xc00dfb[_0x0b83('0x13')]){isOldTokenSent=![];if(!_0x29f2ce[_0x0b83('0x14')]&&_0x29f2ce[_0x0b83('0x14')]!=_0xc00dfb[_0x0b83('0x14')]||_0x29f2ce[_0x0b83('0x14')]&&_0x29f2ce[_0x0b83('0x15')]){logger[_0x0b83('0x16')](_0x0b83('0x17'));}if(_0x29f2ce[_0x0b83('0x14')]&&!_0x29f2ce[_0x0b83('0x15')]&&_0x29f2ce[_0x0b83('0x14')]!=_0xc00dfb[_0x0b83('0x14')]){logger['info'](_0x0b83('0x18'));}if(_0x29f2ce[_0x0b83('0x14')]&&!_0x29f2ce['data2']&&_0x29f2ce['license']==_0xc00dfb['license']){return _0x5403b6;}return _0x5403b6[_0x0b83('0x19')]({'data1':_0x1b43fe,'data2':null,'license':_0xc00dfb[_0x0b83('0x14')]});}else{if(_0xc00dfb[_0x0b83('0x14')]||_0x29f2ce[_0x0b83('0x14')]){if(!_0x29f2ce['data2']){if(_0x29f2ce[_0x0b83('0x12')]==_0x1b43fe){GRAY_PERIOD_REASON=_0x0b83('0x1a');logger[_0x0b83('0x16')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x0b83('0x1b');logger[_0x0b83('0x16')](_0x0b83('0x1c'),_0x29f2ce[_0x0b83('0x12')],_0x1b43fe);}logger['info'](_0x0b83('0x1d'),GRAY_PERIOD_REASON[_0x0b83('0x1e')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x5403b6[_0x0b83('0x19')]({'data2':encryptor[_0x0b83('0x1f')](moment()[_0x0b83('0xb')](_0x0b83('0x20')))});}else{if(moment()[_0x0b83('0x21')](encryptor[_0x0b83('0x22')](_0x29f2ce[_0x0b83('0x15')]),_0x0b83('0x23'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()['format'](_0x0b83('0x20')));isOldTokenSent=![];return _0x5403b6[_0x0b83('0x19')]({'data1':_0x1b43fe,'data2':null,'license':null});}}}else{if(_0x29f2ce[_0x0b83('0x12')]!=_0x1b43fe){logger[_0x0b83('0x16')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x29f2ce[_0x0b83('0x12')],_0x1b43fe);return _0x5403b6[_0x0b83('0x19')]({'data1':_0x1b43fe,'data2':null,'license':null});}}}return _0x5403b6;})['then'](function(_0x7e7128){_0x5403b6=_0x7e7128;})['catch'](function(_0x55902e){logger[_0x0b83('0x24')](_0x55902e['message']);})[_0x0b83('0x25')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x5403b6);},TIME);});}function defaultLicense(){var _0x5f3dfc=hardware['getUuid']();if(_0x5f3dfc){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x5f3dfc}})[_0x0b83('0x26')](function(_0x23ebb7,_0x39d772){logger[_0x0b83('0x16')](_0x0b83('0x27'),_0x5f3dfc);manageLicense(_0x5f3dfc,_0x23ebb7);})[_0x0b83('0x10')](function(_0x2fc540){logger['error'](_0x2fc540[_0x0b83('0x28')]);});}}exports[_0x0b83('0x29')]=defaultLicense; \ No newline at end of file +var _0x6c26=['moment','request-promise','bluebird','pkginfo','version','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','catch','get','data1','data2','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error'];(function(_0x4bb94b,_0x50628a){var _0x36dcc6=function(_0x3ea436){while(--_0x3ea436){_0x4bb94b['push'](_0x4bb94b['shift']());}};_0x36dcc6(++_0x50628a);}(_0x6c26,0x1c8));var _0x66c2=function(_0x39efb2,_0x84f00d){_0x39efb2=_0x39efb2-0x0;var _0x310af1=_0x6c26[_0x39efb2];return _0x310af1;};'use strict';var util=require('util');var moment=require(_0x66c2('0x0'));var rp=require(_0x66c2('0x1'));var BPromise=require(_0x66c2('0x2'));var pkginfo=require(_0x66c2('0x3'))(module,_0x66c2('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x66c2('0x5'));var hardware=require(_0x66c2('0x6'));var logger=require(_0x66c2('0x7'))('license');var HOST=_0x66c2('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1e051b){return new BPromise(function(_0x5532f8,_0x396d84){var _0x2def4a=util[_0x66c2('0x9')](_0x66c2('0xa'),HOST,_0x1e051b,module['exports'][_0x66c2('0x4')]);if(oldToken){_0x2def4a=util['format'](_0x66c2('0xb'),HOST,_0x1e051b,module[_0x66c2('0xc')]['version'],oldToken);}var _0x50a5cb={'uri':_0x2def4a,'method':_0x66c2('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x50a5cb)[_0x66c2('0xe')](function(_0xb28a5){_0x5532f8(_0xb28a5);})[_0x66c2('0xf')](function(_0x539937){_0x396d84(_0x539937);});});}function manageLicense(_0x2370f8,_0x647388){var _0x2c0ecb=_0x647388[_0x66c2('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x2c0ecb[_0x66c2('0x11')]!==_0x2370f8&&!_0x2c0ecb[_0x66c2('0x12')]){oldToken=_0x2c0ecb[_0x66c2('0x11')];}httpRequest(_0x2370f8)[_0x66c2('0xe')](function(_0x182d3b){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x182d3b['active']){isOldTokenSent=![];if(!_0x2c0ecb[_0x66c2('0x13')]&&_0x2c0ecb['license']!=_0x182d3b[_0x66c2('0x13')]||_0x2c0ecb[_0x66c2('0x13')]&&_0x2c0ecb[_0x66c2('0x12')]){logger[_0x66c2('0x14')](_0x66c2('0x15'));}if(_0x2c0ecb[_0x66c2('0x13')]&&!_0x2c0ecb['data2']&&_0x2c0ecb[_0x66c2('0x13')]!=_0x182d3b[_0x66c2('0x13')]){logger[_0x66c2('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x2c0ecb['license']&&!_0x2c0ecb[_0x66c2('0x12')]&&_0x2c0ecb['license']==_0x182d3b[_0x66c2('0x13')]){return _0x647388;}return _0x647388[_0x66c2('0x16')]({'data1':_0x2370f8,'data2':null,'license':_0x182d3b[_0x66c2('0x13')]});}else{if(_0x182d3b[_0x66c2('0x13')]||_0x2c0ecb[_0x66c2('0x13')]){if(!_0x2c0ecb['data2']){if(_0x2c0ecb[_0x66c2('0x11')]==_0x2370f8){GRAY_PERIOD_REASON='Disabled';logger[_0x66c2('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x2c0ecb[_0x66c2('0x11')],_0x2370f8);}logger[_0x66c2('0x14')](_0x66c2('0x17'),GRAY_PERIOD_REASON[_0x66c2('0x18')](),moment()[_0x66c2('0x9')](_0x66c2('0x19')));return _0x647388['update']({'data2':encryptor[_0x66c2('0x1a')](moment()[_0x66c2('0x9')](_0x66c2('0x19')))});}else{if(moment()[_0x66c2('0x1b')](encryptor['decryptString'](_0x2c0ecb[_0x66c2('0x12')]),'days')>DAYS){logger[_0x66c2('0x14')](_0x66c2('0x1c'),moment()[_0x66c2('0x9')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x647388['update']({'data1':_0x2370f8,'data2':null,'license':null});}}}else{if(_0x2c0ecb['data1']!=_0x2370f8){logger[_0x66c2('0x14')](_0x66c2('0x1d'),_0x2c0ecb['data1'],_0x2370f8);return _0x647388[_0x66c2('0x16')]({'data1':_0x2370f8,'data2':null,'license':null});}}}return _0x647388;})[_0x66c2('0xe')](function(_0x23b260){_0x647388=_0x23b260;})[_0x66c2('0xf')](function(_0x335526){logger['error'](_0x335526[_0x66c2('0x1e')]);})[_0x66c2('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0x66c2('0x20')](),_0x647388);},TIME);});}function defaultLicense(){var _0xcc7f78=hardware[_0x66c2('0x20')]();if(_0xcc7f78){return db[_0x66c2('0x21')][_0x66c2('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0xcc7f78}})[_0x66c2('0x23')](function(_0xd059f4,_0x40e1a9){logger[_0x66c2('0x14')](_0x66c2('0x24'),_0xcc7f78);manageLicense(_0xcc7f78,_0xd059f4);})[_0x66c2('0xf')](function(_0x20dc99){logger[_0x66c2('0x25')](_0x20dc99[_0x66c2('0x1e')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 1f96626..a08e7c0 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 _0x8dec=['data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','days','changed','User','findAll','sequelize','col','role','admin','user','telephone','users','telephones','forEach','count','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','./hardware','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data1'];(function(_0xdc6106,_0xa645fe){var _0x345181=function(_0x371366){while(--_0x371366){_0xdc6106['push'](_0xdc6106['shift']());}};_0x345181(++_0xa645fe);}(_0x8dec,0xaa));var _0xc8de=function(_0x2bca49,_0x249a6a){_0x2bca49=_0x2bca49-0x0;var _0x3b26b9=_0x8dec[_0x2bca49];return _0x3b26b9;};'use strict';var util=require(_0xc8de('0x0'));var _=require(_0xc8de('0x1'));var moment=require(_0xc8de('0x2'));var BPromise=require('bluebird');var hardware=require(_0xc8de('0x3'));var encryptor=require('../../components/encryptor');var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc8de('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xc8de('0x5'),'machineUuid':hardware[_0xc8de('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xc8de('0x7'),'machineUuid':hardware[_0xc8de('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x377cd3){return new BPromise(function(_0x58a346,_0x4cff72){return db[_0xc8de('0x8')][_0xc8de('0x9')](_[_0xc8de('0xa')](_0x377cd3,{'raw':!![],'where':{'id':0x1}}))[_0xc8de('0xb')](function(_0x3faadb){return checkLicense(_0x3faadb,null);})[_0xc8de('0xb')](function(_0x1b15b6){_0x58a346(_0x1b15b6);return;})[_0xc8de('0xc')](function(_0x1277dd){_0x4cff72(_0x1277dd);});});}function checkLicense(_0x3b1630,_0x40bd54){if(!_0x3b1630){demoLicense[_0xc8de('0xd')]=_0x3b1630['data1'];return demoLicense;}try{var _0x14cafa=_0x40bd54||_0x3b1630[_0xc8de('0xe')];if(_[_0xc8de('0xf')](_0x14cafa)){throw new Error(_0xc8de('0x10'));}var _0x1c607d=_0x3b1630[_0xc8de('0x11')];var _0x2fe490=_0x3b1630[_0xc8de('0x12')];var _0x3e07bb=_0x1c607d[_0xc8de('0x13')]('-')[0x4];var _0x439491=_0x1c607d[_0xc8de('0x13')]('-')[0x0];var _0x422b42=encryptor[_0xc8de('0x14')](_0x14cafa,util[_0xc8de('0x15')](_0xc8de('0x16'),_0x3e07bb,_0x1c607d,_0x439491));var _0x372c7a=JSON[_0xc8de('0x17')](_0x422b42);_0x372c7a[_0xc8de('0x18')]=![];_0x372c7a[_0xc8de('0xd')]=_0x1c607d;_0x372c7a[_0xc8de('0x19')]=hardware[_0xc8de('0x6')]();if(_0x2fe490){var _0xa467bc=encryptor[_0xc8de('0x14')](_0x2fe490);_0x372c7a[_0xc8de('0x1a')]=_0xa467bc;_0x372c7a[_0xc8de('0x1b')]=moment(_0xa467bc)[_0xc8de('0x1c')](0x7,_0xc8de('0x1d'))[_0xc8de('0x15')]();_0x372c7a['grayReason']=_0x372c7a[_0xc8de('0xd')]!=_0x372c7a[_0xc8de('0x19')]?_0xc8de('0x1e'):'disabled';}return _0x372c7a;}catch(_0xa3007c){breakingLicense[_0xc8de('0xd')]=_0x3b1630[_0xc8de('0x11')];breakingLicense['message']=_0xa3007c['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xdbafdc,_0xf506cf){getLicense()[_0xc8de('0xb')](function(_0x1f95f2){return db[_0xc8de('0x1f')][_0xc8de('0x20')]({'attributes':['role',[db[_0xc8de('0x21')]['fn']('COUNT',db['sequelize'][_0xc8de('0x22')](_0xc8de('0x23'))),'count']],'group':'role','where':{'role':{'$or':[_0xc8de('0x24'),_0xc8de('0x25'),_0xc8de('0x26')]}},'raw':!![]})['then'](function(_0x5c7b96){var _0x321716={'user':_0x1f95f2[_0xc8de('0x27')]||0x0,'telephone':_0x1f95f2[_0xc8de('0x28')]||0x0};_0x5c7b96[_0xc8de('0x29')](function(_0x250032){var _0x17045e=_0x250032[_0xc8de('0x23')]==='admin'?_0xc8de('0x25'):_0x250032['role'];_0x321716[_0x17045e]-=_0x250032[_0xc8de('0x2a')];if(_0x321716[_0x17045e]<0x0)_0x321716[_0x17045e]=0x0;});_0xdbafdc(_0x321716);return;});})[_0xc8de('0xc')](function(_0x65ffbb){_0xf506cf(_0x65ffbb);});});}function checkUserLimits(_0x4a9a37){return new BPromise(function(_0x54fae0,_0x317cb2){getLimits()[_0xc8de('0xb')](function(_0x5c96a7){var _0x30b593=_['pick'](_[_0xc8de('0x2b')](_0x4a9a37,_0xc8de('0x23')),[_0xc8de('0x24'),_0xc8de('0x25'),_0xc8de('0x26')]);var _0x30da9e=(_0x30b593[_0xc8de('0x24')]||0x0)+(_0x30b593['user']||0x0);var _0x1c2a8f=_0x30b593[_0xc8de('0x26')]||0x0;if(_0x30da9e>_0x5c96a7['user'])return _0x317cb2(_0xc8de('0x2c'));if(_0x1c2a8f>_0x5c96a7[_0xc8de('0x26')])return _0x317cb2(_0xc8de('0x2d'));return _0x54fae0();})[_0xc8de('0xc')](function(_0x39fbfc){_0x317cb2(_0x39fbfc);});});}module[_0xc8de('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x7408=['License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','demo','gray','deadline','add','days','grayReason','machineUuid','disabled','message','then','User','findAll','role','sequelize','COUNT','col','count','user','telephone','users','forEach','admin','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','License','find','catch','uuid','data1','license'];(function(_0x113bb4,_0x48e892){var _0x1f0efe=function(_0x14bd5f){while(--_0x14bd5f){_0x113bb4['push'](_0x113bb4['shift']());}};_0x1f0efe(++_0x48e892);}(_0x7408,0x7d));var _0x8740=function(_0x7791d5,_0xdab65f){_0x7791d5=_0x7791d5-0x0;var _0x5ce288=_0x7408[_0x7791d5];return _0x5ce288;};'use strict';var util=require(_0x8740('0x0'));var _=require(_0x8740('0x1'));var moment=require(_0x8740('0x2'));var BPromise=require(_0x8740('0x3'));var hardware=require(_0x8740('0x4'));var encryptor=require(_0x8740('0x5'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x8740('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x8740('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x8740('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x8740('0x8'),'machineUuid':hardware[_0x8740('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x37b426){return new BPromise(function(_0x28b9ad,_0x5abcf6){return db[_0x8740('0xa')][_0x8740('0xb')](_['defaults'](_0x37b426,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x1c7813){return checkLicense(_0x1c7813,null);})['then'](function(_0x5d80dc){_0x28b9ad(_0x5d80dc);return;})[_0x8740('0xc')](function(_0x471646){_0x5abcf6(_0x471646);});});}function checkLicense(_0x41b761,_0x17df31){if(!_0x41b761){demoLicense[_0x8740('0xd')]=_0x41b761[_0x8740('0xe')];return demoLicense;}try{var _0x278dfa=_0x17df31||_0x41b761[_0x8740('0xf')];if(_['isEmpty'](_0x278dfa)){throw new Error(_0x8740('0x10'));}var _0x4892d3=_0x41b761[_0x8740('0xe')];var _0x4a778d=_0x41b761[_0x8740('0x11')];var _0x5be98d=_0x4892d3[_0x8740('0x12')]('-')[0x4];var _0x2629f5=_0x4892d3[_0x8740('0x12')]('-')[0x0];var _0x40ee90=encryptor[_0x8740('0x13')](_0x278dfa,util[_0x8740('0x14')](_0x8740('0x15'),_0x5be98d,_0x4892d3,_0x2629f5));var _0x2590d8=JSON['parse'](_0x40ee90);_0x2590d8[_0x8740('0x16')]=![];_0x2590d8[_0x8740('0xd')]=_0x4892d3;_0x2590d8['machineUuid']=hardware[_0x8740('0x9')]();if(_0x4a778d){var _0x2d30d8=encryptor[_0x8740('0x13')](_0x4a778d);_0x2590d8[_0x8740('0x17')]=_0x2d30d8;_0x2590d8[_0x8740('0x18')]=moment(_0x2d30d8)[_0x8740('0x19')](0x7,_0x8740('0x1a'))[_0x8740('0x14')]();_0x2590d8[_0x8740('0x1b')]=_0x2590d8[_0x8740('0xd')]!=_0x2590d8[_0x8740('0x1c')]?'changed':_0x8740('0x1d');}return _0x2590d8;}catch(_0x46323e){breakingLicense[_0x8740('0xd')]=_0x41b761[_0x8740('0xe')];breakingLicense[_0x8740('0x1e')]=_0x46323e['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2f828c,_0x4ac2a5){getLicense()[_0x8740('0x1f')](function(_0x17d0cd){return db[_0x8740('0x20')][_0x8740('0x21')]({'attributes':[_0x8740('0x22'),[db[_0x8740('0x23')]['fn'](_0x8740('0x24'),db[_0x8740('0x23')][_0x8740('0x25')](_0x8740('0x22'))),_0x8740('0x26')]],'group':_0x8740('0x22'),'where':{'role':{'$or':['admin',_0x8740('0x27'),_0x8740('0x28')]}},'raw':!![]})['then'](function(_0x30d6be){var _0x56b73e={'user':_0x17d0cd[_0x8740('0x29')]||0x0,'telephone':_0x17d0cd['telephones']||0x0};_0x30d6be[_0x8740('0x2a')](function(_0x40d13a){var _0x575e72=_0x40d13a['role']===_0x8740('0x2b')?_0x8740('0x27'):_0x40d13a[_0x8740('0x22')];_0x56b73e[_0x575e72]-=_0x40d13a[_0x8740('0x26')];if(_0x56b73e[_0x575e72]<0x0)_0x56b73e[_0x575e72]=0x0;});_0x2f828c(_0x56b73e);return;});})['catch'](function(_0x198909){_0x4ac2a5(_0x198909);});});}function checkUserLimits(_0x38273b){return new BPromise(function(_0x24cc12,_0x17c087){getLimits()[_0x8740('0x1f')](function(_0x31a710){var _0x17ee1f=_['pick'](_[_0x8740('0x2c')](_0x38273b,_0x8740('0x22')),['admin','user',_0x8740('0x28')]);var _0x158417=(_0x17ee1f[_0x8740('0x2b')]||0x0)+(_0x17ee1f[_0x8740('0x27')]||0x0);var _0x4b17c5=_0x17ee1f[_0x8740('0x28')]||0x0;if(_0x158417>_0x31a710['user'])return _0x17c087('License\x20limit\x20reached\x20for\x20users');if(_0x4b17c5>_0x31a710[_0x8740('0x28')])return _0x17c087(_0x8740('0x2d'));return _0x24cc12();})[_0x8740('0xc')](function(_0x50b3f0){_0x17c087(_0x50b3f0);});});}module[_0x8740('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index b735e88..e7ca2db 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 _0x1458=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x34b262,_0x3ae933){var _0x509c9a=function(_0x2a2b4d){while(--_0x2a2b4d){_0x34b262['push'](_0x34b262['shift']());}};_0x509c9a(++_0x3ae933);}(_0x1458,0x16c));var _0x8145=function(_0x2c32a5,_0x50e815){_0x2c32a5=_0x2c32a5-0x0;var _0x261eff=_0x1458[_0x2c32a5];return _0x261eff;};'use strict';module[_0x8145('0x0')]={'DOMAIN':_0x8145('0x1'),'SESSION_SECRET':_0x8145('0x2'),'GOOGLE_ID':_0x8145('0x3'),'GOOGLE_SECRET':_0x8145('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x3e33=['myappanuglar-secret','exports'];(function(_0x15f43a,_0x57c8b5){var _0x2369bc=function(_0x46c265){while(--_0x46c265){_0x15f43a['push'](_0x15f43a['shift']());}};_0x2369bc(++_0x57c8b5);}(_0x3e33,0x137));var _0x33e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e33[_0x3dd15e];return _0x231fd0;};'use strict';module[_0x33e3('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x33e3('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 12073d9..04ad507 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf372=['winston','path','INFO','join','/var','log','xcally','format','message','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','Logger','transports','File','%s-%s','error','info','Console','env','debugLevel','moment'];(function(_0x56258b,_0x47922f){var _0x3c6c6c=function(_0x5c4d32){while(--_0x5c4d32){_0x56258b['push'](_0x56258b['shift']());}};_0x3c6c6c(++_0x47922f);}(_0xf372,0xc7));var _0x2f37=function(_0xe428e,_0x10ad85){_0xe428e=_0xe428e-0x0;var _0x30a2b4=_0xf372[_0xe428e];return _0x30a2b4;};'use strict';var moment=require(_0x2f37('0x0'));var winston=require(_0x2f37('0x1'));var util=require('util');var path=require(_0x2f37('0x2'));var debugLevel=_0x2f37('0x3');function filename(_0xbe89e0,_0x4baa8d){return path[_0x2f37('0x4')](_0x2f37('0x5'),_0x2f37('0x6'),_0x2f37('0x7'),util[_0x2f37('0x8')]('%s-%s.log',_0xbe89e0,_0x4baa8d));}function formatter(_0x4b8882,_0x4d6d3e){_0x4d6d3e[_0x2f37('0x9')]=_0x4d6d3e[_0x2f37('0x9')][_0x2f37('0xa')](/@@{/g,_0x2f37('0xb'))[_0x2f37('0xa')](/}@@/g,'}}}')[_0x2f37('0xa')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x2f37('0x8')](_0x2f37('0xc'),moment()[_0x2f37('0x8')](_0x2f37('0xd')),_0x4d6d3e[_0x2f37('0xe')][_0x2f37('0xf')](),_0x4b8882,_0x4d6d3e[_0x2f37('0x9')]);}module['exports']=function(_0x484227){return new winston[(_0x2f37('0x10'))]({'transports':[new winston[(_0x2f37('0x11'))][(_0x2f37('0x12'))]({'name':util[_0x2f37('0x8')](_0x2f37('0x13'),_0x484227,'error'),'filename':filename(_0x484227,_0x2f37('0x14')),'level':_0x2f37('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x19dbc9){return formatter(_0x484227,_0x19dbc9);}}),new winston[(_0x2f37('0x11'))][(_0x2f37('0x12'))]({'name':util['format'](_0x2f37('0x13'),_0x484227,_0x2f37('0x15')),'filename':filename(_0x484227,'info'),'level':_0x2f37('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x117b08){return formatter(_0x484227,_0x117b08);}}),new winston[(_0x2f37('0x11'))][(_0x2f37('0x16'))]({'level':process[_0x2f37('0x17')][_0x2f37('0x18')]||debugLevel,'json':![],'formatter':function(_0x5ae3f2){return formatter(_0x484227,_0x5ae3f2);}})]});}; \ No newline at end of file +var _0x4d5d=['info','transports','Console','env','xcally','format','%s-%s.log','message','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','File','%s-%s','error'];(function(_0x324d77,_0x307ef7){var _0x2a77a7=function(_0x54120e){while(--_0x54120e){_0x324d77['push'](_0x324d77['shift']());}};_0x2a77a7(++_0x307ef7);}(_0x4d5d,0x1f2));var _0xd4d5=function(_0x1abbaa,_0x1b7a38){_0x1abbaa=_0x1abbaa-0x0;var _0x40ed52=_0x4d5d[_0x1abbaa];return _0x40ed52;};'use strict';var moment=require('moment');var winston=require('winston');var util=require('util');var path=require('path');var debugLevel='INFO';function filename(_0x36ac0c,_0x37e9d6){return path['join']('/var','log',_0xd4d5('0x0'),util[_0xd4d5('0x1')](_0xd4d5('0x2'),_0x36ac0c,_0x37e9d6));}function formatter(_0xfe6ab3,_0x44abd8){_0x44abd8['message']=_0x44abd8[_0xd4d5('0x3')][_0xd4d5('0x4')](/@@{/g,_0xd4d5('0x5'))[_0xd4d5('0x4')](/}@@/g,_0xd4d5('0x6'))[_0xd4d5('0x4')](/@{/g,'{{')[_0xd4d5('0x4')](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xd4d5('0x1')](_0xd4d5('0x7')),_0x44abd8[_0xd4d5('0x8')][_0xd4d5('0x9')](),_0xfe6ab3,_0x44abd8[_0xd4d5('0x3')]);}module[_0xd4d5('0xa')]=function(_0x47d756){return new winston[(_0xd4d5('0xb'))]({'transports':[new winston['transports'][(_0xd4d5('0xc'))]({'name':util[_0xd4d5('0x1')](_0xd4d5('0xd'),_0x47d756,'error'),'filename':filename(_0x47d756,_0xd4d5('0xe')),'level':_0xd4d5('0xe'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1bd378){return formatter(_0x47d756,_0x1bd378);}}),new winston['transports'][(_0xd4d5('0xc'))]({'name':util[_0xd4d5('0x1')](_0xd4d5('0xd'),_0x47d756,_0xd4d5('0xf')),'filename':filename(_0x47d756,_0xd4d5('0xf')),'level':_0xd4d5('0xf'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2e2fc9){return formatter(_0x47d756,_0x2e2fc9);}}),new winston[(_0xd4d5('0x10'))][(_0xd4d5('0x11'))]({'level':process[_0xd4d5('0x12')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x339246){return formatter(_0x47d756,_0x339246);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index b897f53..123acdb 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 _0xa30d=['email','routing','../../services/routing/index.js','../../services/xdr/index.js','exports','path','join','ami','../../services/ami/index.js','agi','../../services/agi/index.js'];(function(_0x30a701,_0x56a624){var _0x26612e=function(_0x4a4524){while(--_0x4a4524){_0x30a701['push'](_0x30a701['shift']());}};_0x26612e(++_0x56a624);}(_0xa30d,0x1e9));var _0xda30=function(_0x2fe4d4,_0x183e0c){_0x2fe4d4=_0x2fe4d4-0x0;var _0x1259b6=_0xa30d[_0x2fe4d4];return _0x1259b6;};'use strict';var path=require(_0xda30('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0xda30('0x1')](__dirname,'../../services/express/index.js')},{'name':_0xda30('0x2'),'script':path[_0xda30('0x1')](__dirname,_0xda30('0x3'))},{'name':_0xda30('0x4'),'script':path[_0xda30('0x1')](__dirname,_0xda30('0x5'))},{'name':_0xda30('0x6'),'script':path[_0xda30('0x1')](__dirname,'../../services/email/index.js')},{'name':_0xda30('0x7'),'script':path[_0xda30('0x1')](__dirname,_0xda30('0x8'))},{'name':'xdr','script':path['join'](__dirname,_0xda30('0x9'))}]};module[_0xda30('0xa')]=config; \ No newline at end of file +var _0x8d79=['routing','xdr','exports','path','express','join','ami','../../services/ami/index.js','agi','../../services/agi/index.js'];(function(_0x20712b,_0x1c952c){var _0x3dd71d=function(_0x33ab9c){while(--_0x33ab9c){_0x20712b['push'](_0x20712b['shift']());}};_0x3dd71d(++_0x1c952c);}(_0x8d79,0x125));var _0x98d7=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x8d79[_0x16b9ed];return _0x66b1f8;};'use strict';var path=require(_0x98d7('0x0'));var os=require('os');var config={'apps':[{'name':_0x98d7('0x1'),'script':path[_0x98d7('0x2')](__dirname,'../../services/express/index.js')},{'name':_0x98d7('0x3'),'script':path[_0x98d7('0x2')](__dirname,_0x98d7('0x4'))},{'name':_0x98d7('0x5'),'script':path[_0x98d7('0x2')](__dirname,_0x98d7('0x6'))},{'name':'email','script':path['join'](__dirname,'../../services/email/index.js')},{'name':_0x98d7('0x7'),'script':path[_0x98d7('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0x98d7('0x8'),'script':path['join'](__dirname,'../../services/xdr/index.js')}]};module[_0x98d7('0x9')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 29ffb75..cd08f26 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 _0xca9e=['./config','connect','connected','start','then','disconnect','restart','list','describe','delete','dump','pm2','bluebird'];(function(_0x37386e,_0x16977e){var _0x25680a=function(_0x398924){while(--_0x398924){_0x37386e['push'](_0x37386e['shift']());}};_0x25680a(++_0x16977e);}(_0xca9e,0x136));var _0xeca9=function(_0x1853af,_0x40f80){_0x1853af=_0x1853af-0x0;var _0xecb368=_0xca9e[_0x1853af];return _0xecb368;};'use strict';var pm2=require(_0xeca9('0x0'));var BPromise=require(_0xeca9('0x1'));var config=require(_0xeca9('0x2'));function connect(){return new BPromise(function(_0x1c579d,_0x2df937){return pm2[_0xeca9('0x3')](function(_0x8dbabb){if(_0x8dbabb){return _0x2df937(_0x8dbabb);}return _0x1c579d(_0xeca9('0x4'));});});};exports[_0xeca9('0x5')]=function(_0x1e0a18){return connect()[_0xeca9('0x6')](function(){return new BPromise(function(_0x1c4ce6,_0x186a47){return pm2[_0xeca9('0x5')](_0x1e0a18,function(_0x483e41,_0x369f5e){if(_0x483e41){return _0x186a47(_0x483e41);}pm2[_0xeca9('0x7')]();return _0x1c4ce6(_0x369f5e);});});});};exports['stop']=function(_0x4eaf49){return connect()[_0xeca9('0x6')](function(){return new BPromise(function(_0x239e92,_0x1673b6){return pm2['stop'](_0x4eaf49,function(_0x2dba50,_0x364eb2){if(_0x2dba50){return _0x1673b6(_0x2dba50);}pm2[_0xeca9('0x7')]();return _0x239e92(_0x364eb2);});});});};exports[_0xeca9('0x8')]=function(_0x19584d){return connect()[_0xeca9('0x6')](function(){return new BPromise(function(_0x5b5fbf,_0x3145c4){return pm2[_0xeca9('0x8')](_0x19584d,function(_0x4f8839,_0x27ca6f){if(_0x4f8839){return _0x3145c4(_0x4f8839);}pm2['disconnect']();return _0x5b5fbf(_0x27ca6f);});});});};exports[_0xeca9('0x9')]=function(){return connect()[_0xeca9('0x6')](function(){return new BPromise(function(_0x543958,_0x3e9377){return pm2[_0xeca9('0x9')](function(_0x1ba9e9,_0x4d65ee){if(_0x1ba9e9){return _0x3e9377(_0x1ba9e9);}pm2[_0xeca9('0x7')]();return _0x543958(_0x4d65ee);});});});};exports[_0xeca9('0xa')]=function(_0x910814){return connect()[_0xeca9('0x6')](function(){return new BPromise(function(_0x551393,_0x520411){return pm2[_0xeca9('0xa')](_0x910814,function(_0x77cb,_0x553965){if(_0x77cb){return _0x520411(_0x77cb);}pm2[_0xeca9('0x7')]();return _0x551393(_0x553965);});});});};exports[_0xeca9('0xb')]=function(_0x4fbe8a){return connect()['then'](function(){return new BPromise(function(_0x579421,_0x132008){return pm2[_0xeca9('0xb')](_0x4fbe8a,function(_0x3525ee,_0x5dde5f){if(_0x3525ee){return _0x132008(_0x3525ee);}pm2[_0xeca9('0x7')]();return _0x579421(_0x5dde5f);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x317159,_0x5df8e9){return pm2[_0xeca9('0xc')](function(_0x1c4dd6){if(_0x1c4dd6){return _0x5df8e9(_0x1c4dd6);}return _0x317159('saved');});});});}; \ No newline at end of file +var _0xe36e=['list','describe','delete','dump','saved','pm2','./config','connect','connected','start','then','disconnect','stop','restart'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xe36e,0xbb));var _0xee36=function(_0x334d1e,_0x2ceee0){_0x334d1e=_0x334d1e-0x0;var _0x1176b0=_0xe36e[_0x334d1e];return _0x1176b0;};'use strict';var pm2=require(_0xee36('0x0'));var BPromise=require('bluebird');var config=require(_0xee36('0x1'));function connect(){return new BPromise(function(_0x3f12e0,_0x37c140){return pm2[_0xee36('0x2')](function(_0x33a2b4){if(_0x33a2b4){return _0x37c140(_0x33a2b4);}return _0x3f12e0(_0xee36('0x3'));});});};exports[_0xee36('0x4')]=function(_0x2320b0){return connect()[_0xee36('0x5')](function(){return new BPromise(function(_0x506fc3,_0x12b133){return pm2[_0xee36('0x4')](_0x2320b0,function(_0x253536,_0x1cc081){if(_0x253536){return _0x12b133(_0x253536);}pm2[_0xee36('0x6')]();return _0x506fc3(_0x1cc081);});});});};exports[_0xee36('0x7')]=function(_0x4b754b){return connect()[_0xee36('0x5')](function(){return new BPromise(function(_0x479a76,_0x18c0b0){return pm2[_0xee36('0x7')](_0x4b754b,function(_0x4cc3c1,_0x42c56){if(_0x4cc3c1){return _0x18c0b0(_0x4cc3c1);}pm2['disconnect']();return _0x479a76(_0x42c56);});});});};exports[_0xee36('0x8')]=function(_0x12902f){return connect()[_0xee36('0x5')](function(){return new BPromise(function(_0x3cb4da,_0x52176e){return pm2[_0xee36('0x8')](_0x12902f,function(_0x2ed159,_0x589404){if(_0x2ed159){return _0x52176e(_0x2ed159);}pm2['disconnect']();return _0x3cb4da(_0x589404);});});});};exports[_0xee36('0x9')]=function(){return connect()[_0xee36('0x5')](function(){return new BPromise(function(_0xbef914,_0x13014e){return pm2['list'](function(_0x53eae1,_0x5619e8){if(_0x53eae1){return _0x13014e(_0x53eae1);}pm2[_0xee36('0x6')]();return _0xbef914(_0x5619e8);});});});};exports[_0xee36('0xa')]=function(_0x47c48e){return connect()[_0xee36('0x5')](function(){return new BPromise(function(_0x526ad7,_0x267320){return pm2['describe'](_0x47c48e,function(_0x34cc3,_0x3a9960){if(_0x34cc3){return _0x267320(_0x34cc3);}pm2['disconnect']();return _0x526ad7(_0x3a9960);});});});};exports['delete']=function(_0x32a8ac){return connect()[_0xee36('0x5')](function(){return new BPromise(function(_0x290abf,_0x5c3d7f){return pm2[_0xee36('0xb')](_0x32a8ac,function(_0x5a13ab,_0xf2efd6){if(_0x5a13ab){return _0x5c3d7f(_0x5a13ab);}pm2['disconnect']();return _0x290abf(_0xf2efd6);});});});};exports[_0xee36('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x132cac,_0x394d85){return pm2['dump'](function(_0x55e4e5){if(_0x55e4e5){return _0x394d85(_0x55e4e5);}return _0x132cac(_0xee36('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index db0f05d..af70550 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 _0x3ff9=['format','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','then','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout'];(function(_0x4c2468,_0x59bc81){var _0x27626a=function(_0x29e3cb){while(--_0x29e3cb){_0x4c2468['push'](_0x4c2468['shift']());}};_0x27626a(++_0x59bc81);}(_0x3ff9,0x1d1));var _0x93ff=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x3ff9[_0x35885a];return _0xe86249;};'use strict';var _=require(_0x93ff('0x0'));var moment=require(_0x93ff('0x1'));var Redis=require(_0x93ff('0x2'));var util=require('util');var config=require(_0x93ff('0x3'));var db=require(_0x93ff('0x4'))['db'];var logger=require(_0x93ff('0x5'))(_0x93ff('0x6'));config[_0x93ff('0x7')]=_['defaults'](config[_0x93ff('0x7')],{'host':_0x93ff('0x8'),'port':0x18eb});var io=require(_0x93ff('0x9'))(new Redis(config[_0x93ff('0x7')]));function closeInteractions(){var _0x1ef349=0x0;var _0x4901a1=[];return db[_0x93ff('0xa')][_0x93ff('0xb')]({'raw':!![],'attributes':['id',_0x93ff('0xc')],'where':{'id':0x1}})['then'](function(_0x1f548a){_0x1ef349=_0x1f548a['chatTimeout'];if(_0x1ef349){return db[_0x93ff('0xd')][_0x93ff('0xe')]({'raw':!![],'attributes':['id',_0x93ff('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x93ff('0x10')](_0x1f548a['chatTimeout'],'minutes')}}});}else{return[];}})[_0x93ff('0x11')](function(_0x375f0b){if(_0x375f0b&&_0x375f0b[_0x93ff('0x12')]){_0x4901a1=_[_0x93ff('0x13')](_0x375f0b||[],'id');logger['info'](_0x93ff('0x14'),_0x4901a1[_0x93ff('0x15')]());return db[_0x93ff('0xd')][_0x93ff('0x16')]({'closeReason':_0x93ff('0x17'),'disposition':_0x93ff('0x18'),'closed':!![],'closedAt':moment()[_0x93ff('0x19')](_0x93ff('0x1a'))},{'where':{'id':_0x4901a1}});}})[_0x93ff('0x11')](function(){if(_0x4901a1&&_0x4901a1[_0x93ff('0x12')]){logger[_0x93ff('0x1b')](_0x93ff('0x1c'),_0x4901a1['join']());for(var _0x42657a=0x0;_0x42657a<_0x4901a1[_0x93ff('0x12')];_0x42657a++){io['emit'](_0x93ff('0x1d'),{'id':_0x4901a1[_0x42657a],'closed':!![]});}}})[_0x93ff('0x1e')](function(_0x2c1c40){logger[_0x93ff('0x1f')](_0x93ff('0x20'),_0x2c1c40?util[_0x93ff('0x21')](_0x2c1c40,{'showHidden':![],'depth':null}):'');});}exports[_0x93ff('0x22')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x9fd7=['../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','subtract','minutes','length','map','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','catch','error','inspect','start','lodash','moment','ioredis','../../config/environment'];(function(_0x4346ad,_0x34ad75){var _0x44f4f8=function(_0xc56cb9){while(--_0xc56cb9){_0x4346ad['push'](_0x4346ad['shift']());}};_0x44f4f8(++_0x34ad75);}(_0x9fd7,0x1d8));var _0x79fd=function(_0x40924d,_0x31436f){_0x40924d=_0x40924d-0x0;var _0x1443bd=_0x9fd7[_0x40924d];return _0x1443bd;};'use strict';var _=require(_0x79fd('0x0'));var moment=require(_0x79fd('0x1'));var Redis=require(_0x79fd('0x2'));var util=require('util');var config=require(_0x79fd('0x3'));var db=require(_0x79fd('0x4'))['db'];var logger=require(_0x79fd('0x5'))(_0x79fd('0x6'));config[_0x79fd('0x7')]=_[_0x79fd('0x8')](config['redis'],{'host':_0x79fd('0x9'),'port':0x18eb});var io=require(_0x79fd('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x355072=0x0;var _0x13a0fd=[];return db[_0x79fd('0xb')][_0x79fd('0xc')]({'raw':!![],'attributes':['id',_0x79fd('0xd')],'where':{'id':0x1}})[_0x79fd('0xe')](function(_0x41e7f6){_0x355072=_0x41e7f6[_0x79fd('0xd')];if(_0x355072){return db[_0x79fd('0xf')][_0x79fd('0x10')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x79fd('0x11')](_0x41e7f6['chatTimeout'],_0x79fd('0x12'))}}});}else{return[];}})[_0x79fd('0xe')](function(_0x17cfe0){if(_0x17cfe0&&_0x17cfe0[_0x79fd('0x13')]){_0x13a0fd=_[_0x79fd('0x14')](_0x17cfe0||[],'id');logger[_0x79fd('0x15')]('[CHAT]\x20Interactions\x20to\x20close:',_0x13a0fd[_0x79fd('0x16')]());return db[_0x79fd('0xf')][_0x79fd('0x17')]({'closeReason':_0x79fd('0x18'),'disposition':_0x79fd('0x19'),'closed':!![],'closedAt':moment()[_0x79fd('0x1a')](_0x79fd('0x1b'))},{'where':{'id':_0x13a0fd}});}})[_0x79fd('0xe')](function(){if(_0x13a0fd&&_0x13a0fd[_0x79fd('0x13')]){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x13a0fd[_0x79fd('0x16')]());for(var _0x10ef51=0x0;_0x10ef51<_0x13a0fd['length'];_0x10ef51++){io[_0x79fd('0x1c')](_0x79fd('0x1d'),{'id':_0x13a0fd[_0x10ef51],'closed':!![]});}}})[_0x79fd('0x1e')](function(_0x10c789){logger[_0x79fd('0x1f')]('[CHAT]\x20Error\x20closing\x20interactions',_0x10c789?util[_0x79fd('0x20')](_0x10c789,{'showHidden':![],'depth':null}):'');});}exports[_0x79fd('0x21')]=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 e7fdc83..79f4261 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 _0x1662=['Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','sendIfEmpty','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','name','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','no\x20report\x20id','findAll','MailServerOut','jobs','map','toString','keyBy','difference','intersection','stop','deleteJob','delete\x20cron','length','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','exists','stop\x20cron','update','update\x20cron','run','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','email','MailAccount','service','host','Smtp','port','secure','auth','user','pass','format','bcc','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','basename','savename','extname','zip','status','Sent','message','attachments','text'];(function(_0x3ac312,_0x5d3903){var _0x36b673=function(_0x254b25){while(--_0x254b25){_0x3ac312['push'](_0x3ac312['shift']());}};_0x36b673(++_0x5d3903);}(_0x1662,0xe6));var _0x2166=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x1662[_0x5608a3];return _0x1ed50a;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x2166('0x0'));var _=require(_0x2166('0x1'));var moment=require(_0x2166('0x2'));var CronJobManager=require(_0x2166('0x3'));var jayson=require(_0x2166('0x4'));var BPromise=require(_0x2166('0x5'));var logger=require(_0x2166('0x6'))(_0x2166('0x7'));var db=require(_0x2166('0x8'))['db'];var analyticCustomReportController=require(_0x2166('0x9'));var analyticDefaultReportController=require(_0x2166('0xa'));var client=jayson[_0x2166('0xb')][_0x2166('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x11a837,_0x5e07a4){return function(){logger[_0x2166('0xd')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x11a837[_0x2166('0xe')]);var _0xe3d68c=!![];var _0x296103={'tls':{'rejectUnauthorized':![]}};if(_0x11a837[_0x2166('0xf')]['Smtp'][_0x2166('0x10')]){_0x296103['service']=_0x11a837[_0x2166('0xf')]['Smtp'][_0x2166('0x10')];}else{_0x296103[_0x2166('0x11')]=_0x11a837['MailAccount'][_0x2166('0x12')][_0x2166('0x11')];_0x296103[_0x2166('0x13')]=_0x11a837[_0x2166('0xf')][_0x2166('0x12')][_0x2166('0x13')];_0x296103[_0x2166('0x14')]=_0x11a837[_0x2166('0xf')][_0x2166('0x12')][_0x2166('0x14')];}if(_0x11a837[_0x2166('0xf')][_0x2166('0x12')]['authentication']){_0x296103[_0x2166('0x15')]={'user':_0x11a837['MailAccount'][_0x2166('0x12')][_0x2166('0x16')],'pass':_0x11a837[_0x2166('0xf')][_0x2166('0x12')][_0x2166('0x17')]};}var _0x4d2832={'account':_0x296103,'message':{'from':util[_0x2166('0x18')]('\x22%s\x22\x20<%s>',_0x11a837[_0x2166('0xf')]['name'],_0x11a837[_0x2166('0xf')][_0x2166('0xe')]||_0x11a837[_0x2166('0xf')][_0x2166('0x12')][_0x2166('0x16')]),'to':_0x11a837['email'],'cc':_0x11a837['cc'],'bcc':_0x11a837[_0x2166('0x19')],'subject':util[_0x2166('0x18')]('Report\x20%s\x20last\x20%s\x20%s',_0x5e07a4['name'],_0x11a837[_0x2166('0x1a')],_0x11a837[_0x2166('0x1b')])}};var _0x4d76f3=path[_0x2166('0x1c')](__dirname,_0x2166('0x1d'));var _0x4b7b1d=_0x5e07a4['savename'];var _0x3e53f2=util[_0x2166('0x18')](_0x2166('0x1e'),path[_0x2166('0x1f')](_0x5e07a4[_0x2166('0x20')],path[_0x2166('0x21')](_0x5e07a4[_0x2166('0x20')])),_0x2166('0x22'));var _0x24f440=path[_0x2166('0x1c')](_0x4d76f3,_0x4b7b1d);var _0x227c62=path[_0x2166('0x1c')](_0x4d76f3,_0x3e53f2);if(fs['existsSync'](_0x24f440)){_0x5e07a4[_0x2166('0x23')]=_0x2166('0x24');_0x4d2832[_0x2166('0x25')][_0x2166('0x26')]=[{'filename':_0x4b7b1d,'path':_0x24f440}];_0x4d2832[_0x2166('0x25')][_0x2166('0x27')]=util[_0x2166('0x18')](_0x2166('0x28'),JSON[_0x2166('0x29')](_0x5e07a4,null,0x2));}else if(fs[_0x2166('0x2a')](_0x227c62)){_0x5e07a4[_0x2166('0x23')]='Sent';_0x4d2832[_0x2166('0x25')]['attachments']=[{'filename':_0x3e53f2,'path':_0x227c62}];}else{_0x4d2832[_0x2166('0x25')][_0x2166('0x27')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x11a837[_0x2166('0x2b')]){_0xe3d68c=![];logger[_0x2166('0xd')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0xe3d68c){return client[_0x2166('0x2c')](_0x2166('0x2d'),_0x4d2832)[_0x2166('0x2e')](function(_0x1ecec6){if(_0x1ecec6[_0x2166('0x2f')]){return logger['error'](_0x2166('0x30'),JSON[_0x2166('0x29')](_0x1ecec6));}return logger[_0x2166('0xd')](_0x2166('0x31'));})[_0x2166('0x32')](function(_0x5da4b6){return logger[_0x2166('0x2f')]('error\x20mail',JSON['stringify'](_0x5da4b6));});}};}function handleError(){return function(_0x1ffe53){return logger[_0x2166('0x2f')](JSON['stringify'](_0x1ffe53));};}function handleResult(_0x51cd18){return function(_0x33d7aa){logger[_0x2166('0xd')](_0x2166('0x33'),JSON[_0x2166('0x29')](_0x33d7aa));if(_0x51cd18[_0x2166('0xf')]&&_0x51cd18['MailAccount']['Smtp']&&!_[_0x2166('0x34')](_0x51cd18['email'])){setTimeout(handleSendEmail(_0x51cd18,_0x33d7aa),0x3c*0x3e8);}};}function handleJob(_0x36ca3c){return function(){try{if(_[_0x2166('0x34')](_0x36ca3c[_0x2166('0x1a')])){return logger['info'](_0x2166('0x35'));}if(_[_0x2166('0x34')](_0x36ca3c[_0x2166('0x1b')])){return logger['info'](_0x2166('0x36'));}var _0x244dd4={'startDate':moment()[_0x2166('0x37')](_0x36ca3c[_0x2166('0x1a')],_0x36ca3c[_0x2166('0x1b')])[_0x2166('0x18')](_0x2166('0x38')),'endDate':moment()['format'](_0x2166('0x38')),'type':_0x2166('0x39'),'output':_0x36ca3c['output'],'name':_0x36ca3c[_0x2166('0x3a')]};if(!_[_0x2166('0x34')](_0x36ca3c['DefaultReportId'])){logger[_0x2166('0xd')](_0x2166('0x3b'),_0x36ca3c['DefaultReportId']);return analyticDefaultReportController[_0x2166('0x3c')]({'id':_0x36ca3c['DefaultReportId']},_0x244dd4)['then'](handleResult(_0x36ca3c))[_0x2166('0x32')](handleError());}if(!_[_0x2166('0x34')](_0x36ca3c[_0x2166('0x3d')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x36ca3c[_0x2166('0x3d')]);return analyticCustomReportController[_0x2166('0x3c')]({'id':_0x36ca3c['CustomReportId']},_0x244dd4)[_0x2166('0x2e')](handleResult(_0x36ca3c))[_0x2166('0x32')](handleError());}}catch(_0x58892b){logger[_0x2166('0x2f')](JSON[_0x2166('0x29')](_0x58892b));}return logger[_0x2166('0xd')](_0x2166('0x3e'));};}function getJobs(_0x3bd6dc){var _0x923f39={};if(_0x3bd6dc){_0x923f39['id']=_0x3bd6dc;}return db['Schedule'][_0x2166('0x3f')]({'where':_0x923f39,'include':[{'model':db['MailAccount'],'attributes':['id',_0x2166('0x3a'),'email'],'include':[{'model':db[_0x2166('0x40')],'as':_0x2166('0x12')}]}]})['then'](function(_0x30e41c){var _0x2f1217=_['keys'](manager[_0x2166('0x41')]);var _0x4765aa=_[_0x2166('0x42')](_0x30e41c,function(_0x1e68fb){return _0x1e68fb['id'][_0x2166('0x43')]();});var _0x2cf6e0=_[_0x2166('0x44')](_0x30e41c,function(_0x1610c6){return _0x1610c6['id'][_0x2166('0x43')]();});var _0x27d92e=_0x3bd6dc?_0x4765aa:_[_0x2166('0x45')](_0x4765aa,_0x2f1217);var _0x582a9d=_[_0x2166('0x46')](_0x4765aa,_0x2f1217);var _0x583972=_['difference'](_0x2f1217,_0x4765aa);var _0x13ac5d;var _0x3a23e7;for(_0x13ac5d=0x0;_0x13ac5d<_0x583972['length']&&!_0x3bd6dc;_0x13ac5d+=0x1){_0x3a23e7=_0x583972[_0x13ac5d][_0x2166('0x43')]();if(manager['exists'](_0x3a23e7)){manager[_0x2166('0x47')](_0x3a23e7);manager[_0x2166('0x48')](_0x3a23e7);logger[_0x2166('0xd')](_0x2166('0x49'),_0x3a23e7);}}logger[_0x2166('0xd')]('toRun',JSON['stringify'](_0x27d92e));for(_0x13ac5d=0x0;_0x13ac5d<_0x27d92e[_0x2166('0x4a')];_0x13ac5d+=0x1){_0x3a23e7=_0x27d92e[_0x13ac5d][_0x2166('0x43')]();logger[_0x2166('0xd')]('index',_0x3a23e7);if(_0x3bd6dc){logger[_0x2166('0xd')](_0x2166('0x4b'),_0x3bd6dc);logger[_0x2166('0xd')](JSON[_0x2166('0x29')](_0x2cf6e0[_0x3a23e7]));BPromise[_0x2166('0x4c')]()[_0x2166('0x2e')](handleJob(_0x2cf6e0[_0x3a23e7]));logger[_0x2166('0xd')](_0x2166('0x4d'),_0x2cf6e0[_0x3a23e7][_0x2166('0x3a')],_0x2cf6e0[_0x3a23e7][_0x2166('0x4e')]);}else if(_0x2cf6e0[_0x3a23e7][_0x2166('0x4e')]&&_0x2cf6e0[_0x3a23e7][_0x2166('0x4f')]&&moment()[_0x2166('0x50')](_0x2cf6e0[_0x3a23e7][_0x2166('0x51')],_0x2cf6e0[_0x3a23e7][_0x2166('0x52')])){manager[_0x2166('0x53')](_0x3a23e7,_0x2cf6e0[_0x3a23e7][_0x2166('0x4e')],handleJob(_0x2cf6e0[_0x3a23e7]));manager[_0x2166('0x54')](_0x3a23e7);logger[_0x2166('0xd')]('add\x20cron',_0x2cf6e0[_0x3a23e7][_0x2166('0x3a')],_0x2cf6e0[_0x3a23e7][_0x2166('0x4e')]);}else if(manager[_0x2166('0x55')](_0x3a23e7)){manager[_0x2166('0x47')](_0x3a23e7);manager['deleteJob'](_0x3a23e7);logger[_0x2166('0xd')](_0x2166('0x56'),_0x2cf6e0[_0x3a23e7][_0x2166('0x3a')],_0x2cf6e0[_0x3a23e7]['cron']);}}for(_0x13ac5d=0x0,_0x3a23e7;_0x13ac5d<_0x582a9d[_0x2166('0x4a')]&&!_0x3bd6dc;_0x13ac5d+=0x1){_0x3a23e7=_0x582a9d[_0x13ac5d][_0x2166('0x43')]();if(manager[_0x2166('0x55')](_0x3a23e7)){if(_0x2cf6e0[_0x3a23e7][_0x2166('0x4e')]&&_0x2cf6e0[_0x3a23e7][_0x2166('0x4f')]&&moment()[_0x2166('0x50')](_0x2cf6e0[_0x3a23e7]['startAt'],_0x2cf6e0[_0x3a23e7][_0x2166('0x52')])){manager[_0x2166('0x57')](_0x3a23e7,_0x2cf6e0[_0x3a23e7]['cron'],handleJob(_0x2cf6e0[_0x3a23e7]));logger[_0x2166('0xd')](_0x2166('0x58'),_0x2cf6e0[_0x3a23e7][_0x2166('0x3a')],_0x2cf6e0[_0x3a23e7][_0x2166('0x4e')]);}else{manager[_0x2166('0x47')](_0x3a23e7);manager[_0x2166('0x48')](_0x3a23e7);logger[_0x2166('0xd')](_0x2166('0x56'),_0x2cf6e0[_0x3a23e7][_0x2166('0x3a')],_0x2cf6e0[_0x3a23e7][_0x2166('0x4e')]);}}}})[_0x2166('0x32')](function(_0x4b2b9a){logger['error'](JSON[_0x2166('0x29')](_0x4b2b9a));});}exports[_0x2166('0x59')]=function(_0x566724){return getJobs(_0x566724);};exports[_0x2166('0x54')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x2646=['../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','service','Smtp','port','secure','authentication','user','pass','format','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','savename','%s.%s','basename','extname','zip','existsSync','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','email\x20sent','catch','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','MailServerOut','keys','jobs','map','toString','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','my\x20id','run\x20job','cron','active','add','start','add\x20cron','stop\x20cron','isBetween','startAt','endAt','update','run','util','path','cron-job-manager','jayson/promise','bluebird','../logger','schedule'];(function(_0x2b9c91,_0x2edf9b){var _0xa6b3b2=function(_0x54c440){while(--_0x54c440){_0x2b9c91['push'](_0x2b9c91['shift']());}};_0xa6b3b2(++_0x2edf9b);}(_0x2646,0x159));var _0x6264=function(_0x320dd0,_0x266a5b){_0x320dd0=_0x320dd0-0x0;var _0x1ffb02=_0x2646[_0x320dd0];return _0x1ffb02;};'use strict';var fs=require('fs');var util=require(_0x6264('0x0'));var path=require(_0x6264('0x1'));var _=require('lodash');var moment=require('moment');var CronJobManager=require(_0x6264('0x2'));var jayson=require(_0x6264('0x3'));var BPromise=require(_0x6264('0x4'));var logger=require(_0x6264('0x5'))(_0x6264('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x6264('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x6264('0x8')][_0x6264('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2d23c4,_0x100bfd){return function(){logger[_0x6264('0xa')](_0x6264('0xb'),_0x2d23c4[_0x6264('0xc')]);var _0x505931=!![];var _0x4e7245={'tls':{'rejectUnauthorized':![]}};if(_0x2d23c4[_0x6264('0xd')]['Smtp']['service']){_0x4e7245[_0x6264('0xe')]=_0x2d23c4[_0x6264('0xd')]['Smtp'][_0x6264('0xe')];}else{_0x4e7245['host']=_0x2d23c4[_0x6264('0xd')][_0x6264('0xf')]['host'];_0x4e7245[_0x6264('0x10')]=_0x2d23c4[_0x6264('0xd')][_0x6264('0xf')][_0x6264('0x10')];_0x4e7245[_0x6264('0x11')]=_0x2d23c4[_0x6264('0xd')][_0x6264('0xf')][_0x6264('0x11')];}if(_0x2d23c4[_0x6264('0xd')][_0x6264('0xf')][_0x6264('0x12')]){_0x4e7245['auth']={'user':_0x2d23c4[_0x6264('0xd')]['Smtp'][_0x6264('0x13')],'pass':_0x2d23c4[_0x6264('0xd')][_0x6264('0xf')][_0x6264('0x14')]};}var _0x7e6a3e={'account':_0x4e7245,'message':{'from':util[_0x6264('0x15')]('\x22%s\x22\x20<%s>',_0x2d23c4[_0x6264('0xd')][_0x6264('0x16')],_0x2d23c4[_0x6264('0xd')][_0x6264('0xc')]||_0x2d23c4['MailAccount']['Smtp'][_0x6264('0x13')]),'to':_0x2d23c4[_0x6264('0xc')],'cc':_0x2d23c4['cc'],'bcc':_0x2d23c4[_0x6264('0x17')],'subject':util[_0x6264('0x15')](_0x6264('0x18'),_0x100bfd[_0x6264('0x16')],_0x2d23c4[_0x6264('0x19')],_0x2d23c4[_0x6264('0x1a')])}};var _0x5da513=path[_0x6264('0x1b')](__dirname,'../../files/reports');var _0x2c953e=_0x100bfd[_0x6264('0x1c')];var _0x44989a=util[_0x6264('0x15')](_0x6264('0x1d'),path[_0x6264('0x1e')](_0x100bfd[_0x6264('0x1c')],path[_0x6264('0x1f')](_0x100bfd[_0x6264('0x1c')])),_0x6264('0x20'));var _0x132455=path[_0x6264('0x1b')](_0x5da513,_0x2c953e);var _0x5637d0=path[_0x6264('0x1b')](_0x5da513,_0x44989a);if(fs[_0x6264('0x21')](_0x132455)){_0x100bfd['status']=_0x6264('0x22');_0x7e6a3e[_0x6264('0x23')]['attachments']=[{'filename':_0x2c953e,'path':_0x132455}];_0x7e6a3e[_0x6264('0x23')][_0x6264('0x24')]=util[_0x6264('0x15')](_0x6264('0x25'),JSON[_0x6264('0x26')](_0x100bfd,null,0x2));}else if(fs['existsSync'](_0x5637d0)){_0x100bfd[_0x6264('0x27')]=_0x6264('0x22');_0x7e6a3e['message'][_0x6264('0x28')]=[{'filename':_0x44989a,'path':_0x5637d0}];}else{_0x7e6a3e[_0x6264('0x23')][_0x6264('0x24')]=_0x6264('0x29');if(!_0x2d23c4[_0x6264('0x2a')]){_0x505931=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x505931){return client[_0x6264('0x2b')](_0x6264('0x2c'),_0x7e6a3e)[_0x6264('0x2d')](function(_0x1b514c){if(_0x1b514c['error']){return logger[_0x6264('0x2e')]('error\x20mail',JSON[_0x6264('0x26')](_0x1b514c));}return logger[_0x6264('0xa')](_0x6264('0x2f'));})[_0x6264('0x30')](function(_0x10b3d5){return logger[_0x6264('0x2e')](_0x6264('0x31'),JSON[_0x6264('0x26')](_0x10b3d5));});}};}function handleError(){return function(_0x494410){return logger[_0x6264('0x2e')](JSON[_0x6264('0x26')](_0x494410));};}function handleResult(_0x2fb07c){return function(_0x26d9c6){logger[_0x6264('0xa')](_0x6264('0x32'),JSON[_0x6264('0x26')](_0x26d9c6));if(_0x2fb07c['MailAccount']&&_0x2fb07c[_0x6264('0xd')][_0x6264('0xf')]&&!_[_0x6264('0x33')](_0x2fb07c[_0x6264('0xc')])){setTimeout(handleSendEmail(_0x2fb07c,_0x26d9c6),0x3c*0x3e8);}};}function handleJob(_0x258912){return function(){try{if(_['isNil'](_0x258912['subtractNumber'])){return logger[_0x6264('0xa')](_0x6264('0x34'));}if(_[_0x6264('0x33')](_0x258912['subtractUnit'])){return logger[_0x6264('0xa')](_0x6264('0x35'));}var _0x452bc9={'startDate':moment()[_0x6264('0x36')](_0x258912[_0x6264('0x19')],_0x258912['subtractUnit'])[_0x6264('0x15')](_0x6264('0x37')),'endDate':moment()[_0x6264('0x15')](_0x6264('0x37')),'type':_0x6264('0x38'),'output':_0x258912['output'],'name':_0x258912[_0x6264('0x16')]};if(!_[_0x6264('0x33')](_0x258912[_0x6264('0x39')])){logger[_0x6264('0xa')](_0x6264('0x3a'),_0x258912[_0x6264('0x39')]);return analyticDefaultReportController['runReport']({'id':_0x258912[_0x6264('0x39')]},_0x452bc9)['then'](handleResult(_0x258912))[_0x6264('0x30')](handleError());}if(!_[_0x6264('0x33')](_0x258912[_0x6264('0x3b')])){logger[_0x6264('0xa')](_0x6264('0x3c'),_0x258912[_0x6264('0x3b')]);return analyticCustomReportController['runReport']({'id':_0x258912[_0x6264('0x3b')]},_0x452bc9)[_0x6264('0x2d')](handleResult(_0x258912))[_0x6264('0x30')](handleError());}}catch(_0x373ab3){logger[_0x6264('0x2e')](JSON['stringify'](_0x373ab3));}return logger[_0x6264('0xa')](_0x6264('0x3d'));};}function getJobs(_0x2adcec){var _0x4fd1cb={};if(_0x2adcec){_0x4fd1cb['id']=_0x2adcec;}return db['Schedule']['findAll']({'where':_0x4fd1cb,'include':[{'model':db[_0x6264('0xd')],'attributes':['id',_0x6264('0x16'),_0x6264('0xc')],'include':[{'model':db[_0x6264('0x3e')],'as':_0x6264('0xf')}]}]})[_0x6264('0x2d')](function(_0xb80570){var _0x2cfc14=_[_0x6264('0x3f')](manager[_0x6264('0x40')]);var _0x197240=_[_0x6264('0x41')](_0xb80570,function(_0x3a1c64){return _0x3a1c64['id'][_0x6264('0x42')]();});var _0x2b47c7=_['keyBy'](_0xb80570,function(_0xa4993b){return _0xa4993b['id']['toString']();});var _0x3c3985=_0x2adcec?_0x197240:_[_0x6264('0x43')](_0x197240,_0x2cfc14);var _0x11ddfc=_[_0x6264('0x44')](_0x197240,_0x2cfc14);var _0x5ea8a3=_['difference'](_0x2cfc14,_0x197240);var _0x5ec2e4;var _0x43a7b4;for(_0x5ec2e4=0x0;_0x5ec2e4<_0x5ea8a3[_0x6264('0x45')]&&!_0x2adcec;_0x5ec2e4+=0x1){_0x43a7b4=_0x5ea8a3[_0x5ec2e4][_0x6264('0x42')]();if(manager[_0x6264('0x46')](_0x43a7b4)){manager[_0x6264('0x47')](_0x43a7b4);manager[_0x6264('0x48')](_0x43a7b4);logger['info'](_0x6264('0x49'),_0x43a7b4);}}logger['info'](_0x6264('0x4a'),JSON['stringify'](_0x3c3985));for(_0x5ec2e4=0x0;_0x5ec2e4<_0x3c3985[_0x6264('0x45')];_0x5ec2e4+=0x1){_0x43a7b4=_0x3c3985[_0x5ec2e4]['toString']();logger[_0x6264('0xa')]('index',_0x43a7b4);if(_0x2adcec){logger[_0x6264('0xa')](_0x6264('0x4b'),_0x2adcec);logger[_0x6264('0xa')](JSON[_0x6264('0x26')](_0x2b47c7[_0x43a7b4]));BPromise['resolve']()['then'](handleJob(_0x2b47c7[_0x43a7b4]));logger['info'](_0x6264('0x4c'),_0x2b47c7[_0x43a7b4][_0x6264('0x16')],_0x2b47c7[_0x43a7b4][_0x6264('0x4d')]);}else if(_0x2b47c7[_0x43a7b4][_0x6264('0x4d')]&&_0x2b47c7[_0x43a7b4][_0x6264('0x4e')]&&moment()['isBetween'](_0x2b47c7[_0x43a7b4]['startAt'],_0x2b47c7[_0x43a7b4]['endAt'])){manager[_0x6264('0x4f')](_0x43a7b4,_0x2b47c7[_0x43a7b4][_0x6264('0x4d')],handleJob(_0x2b47c7[_0x43a7b4]));manager[_0x6264('0x50')](_0x43a7b4);logger[_0x6264('0xa')](_0x6264('0x51'),_0x2b47c7[_0x43a7b4][_0x6264('0x16')],_0x2b47c7[_0x43a7b4]['cron']);}else if(manager[_0x6264('0x46')](_0x43a7b4)){manager[_0x6264('0x47')](_0x43a7b4);manager[_0x6264('0x48')](_0x43a7b4);logger[_0x6264('0xa')](_0x6264('0x52'),_0x2b47c7[_0x43a7b4][_0x6264('0x16')],_0x2b47c7[_0x43a7b4][_0x6264('0x4d')]);}}for(_0x5ec2e4=0x0,_0x43a7b4;_0x5ec2e4<_0x11ddfc[_0x6264('0x45')]&&!_0x2adcec;_0x5ec2e4+=0x1){_0x43a7b4=_0x11ddfc[_0x5ec2e4][_0x6264('0x42')]();if(manager[_0x6264('0x46')](_0x43a7b4)){if(_0x2b47c7[_0x43a7b4][_0x6264('0x4d')]&&_0x2b47c7[_0x43a7b4][_0x6264('0x4e')]&&moment()[_0x6264('0x53')](_0x2b47c7[_0x43a7b4][_0x6264('0x54')],_0x2b47c7[_0x43a7b4][_0x6264('0x55')])){manager[_0x6264('0x56')](_0x43a7b4,_0x2b47c7[_0x43a7b4][_0x6264('0x4d')],handleJob(_0x2b47c7[_0x43a7b4]));logger[_0x6264('0xa')]('update\x20cron',_0x2b47c7[_0x43a7b4]['name'],_0x2b47c7[_0x43a7b4]['cron']);}else{manager[_0x6264('0x47')](_0x43a7b4);manager[_0x6264('0x48')](_0x43a7b4);logger[_0x6264('0xa')](_0x6264('0x52'),_0x2b47c7[_0x43a7b4][_0x6264('0x16')],_0x2b47c7[_0x43a7b4][_0x6264('0x4d')]);}}}})['catch'](function(_0x119825){logger[_0x6264('0x2e')](JSON[_0x6264('0x26')](_0x119825));});}exports[_0x6264('0x57')]=function(_0x51b221){return getJobs(_0x51b221);};exports['start']=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 48ff6ba..9d7f3d1 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 _0x02f7=['transcript','update','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','language','bucket','Sequelize','Transcript\x20not\x20available','sentimentAccountId','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Sentiment\x20Analysis\x20not\x20configured','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','Setting','Settings\x20not\x20available','transcribeAccountId','CloudProvider','forEach','push','all','start','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length'];(function(_0x398a54,_0x28603f){var _0x29e6b5=function(_0x15908d){while(--_0x15908d){_0x398a54['push'](_0x398a54['shift']());}};_0x29e6b5(++_0x28603f);}(_0x02f7,0x73));var _0x702f=function(_0x54211e,_0x39c424){_0x54211e=_0x54211e-0x0;var _0x43010c=_0x02f7[_0x54211e];return _0x43010c;};var _=require('lodash');var AWS=require(_0x702f('0x0'));var rp=require(_0x702f('0x1'));var util=require(_0x702f('0x2'));var BPromise=require(_0x702f('0x3'));var db=require(_0x702f('0x4'))['db'];var logger=require(_0x702f('0x5'))(_0x702f('0x6'));function getTranscriptionJob(_0x318c8b,_0x489d22,_0x184a98,_0x38adc1){return new Promise(function(_0x555d9c,_0x2e029b){var _0x132e11=new AWS['TranscribeService']({'accessKeyId':_0x489d22,'secretAccessKey':_0x318c8b,'region':_0x184a98});_0x132e11[_0x702f('0x7')]({'TranscriptionJobName':_0x38adc1},function(_0x2fe755,_0x2d8dfa){if(_0x2fe755){return _0x2e029b(_0x2fe755);}else{return _0x555d9c(_0x2d8dfa);}});});}function sentiment(_0x1f93c8,_0x566ab6,_0x546aee,_0x361bf6,_0x25b214){return new Promise(function(_0xc7adcf,_0x534103){var _0x2089fd=new AWS['Comprehend']({'accessKeyId':_0x566ab6,'secretAccessKey':_0x1f93c8,'region':_0x546aee});_0x2089fd[_0x702f('0x8')]({'Text':_0x361bf6,'LanguageCode':_0x25b214[_0x702f('0x9')](0x0,0x2)},function(_0x1306e9,_0x257928){if(_0x1306e9){return _0x534103(_0x1306e9);}else{return _0xc7adcf(_0x257928);}});});}function checkTranscribeJob(_0x4dcff1,_0x565006,_0x2a144f){var _0x40d403;return new BPromise(function(_0x5bb2cb,_0x436955){logger[_0x702f('0xa')](util[_0x702f('0xb')](_0x702f('0xc'),_0x4dcff1['id'],_0x4dcff1[_0x702f('0xd')]));return getTranscriptionJob(_0x2a144f[_0x702f('0xe')],_0x2a144f[_0x702f('0xf')],_0x565006[_0x702f('0x10')],_0x4dcff1[_0x702f('0xd')])[_0x702f('0x11')](function(_0x9a99e2){logger['info'](util[_0x702f('0xb')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x4dcff1['id'],_0x4dcff1[_0x702f('0xd')],_0x9a99e2[_0x702f('0x12')][_0x702f('0x13')]));if(!_0x4dcff1[_0x702f('0x14')]){switch(_0x9a99e2[_0x702f('0x12')][_0x702f('0x13')]){case _0x702f('0x15'):var _0x246cc3={'transcribeStatus':_0x9a99e2[_0x702f('0x12')][_0x702f('0x13')],'fileUri':_0x9a99e2[_0x702f('0x12')]['Transcript'][_0x702f('0x16')]};logger[_0x702f('0xa')](util[_0x702f('0xb')](_0x702f('0x17'),_0x4dcff1['id']));return rp({'uri':_0x9a99e2['TranscriptionJob'][_0x702f('0x18')][_0x702f('0x16')],'json':!![]})[_0x702f('0x11')](function(_0x5e3b28){logger[_0x702f('0xa')](util[_0x702f('0xb')](_0x702f('0x19'),_0x4dcff1['id']));if(_0x5e3b28&&_0x5e3b28[_0x702f('0x1a')]&&_0x5e3b28[_0x702f('0x1a')][_0x702f('0x1b')]&&_0x5e3b28[_0x702f('0x1a')][_0x702f('0x1b')][_0x702f('0x1c')]){_0x246cc3[_0x702f('0x14')]='';for(var _0x255a73=0x0;_0x255a73<_0x5e3b28[_0x702f('0x1a')][_0x702f('0x1b')]['length'];_0x255a73++){_0x246cc3[_0x702f('0x14')]+=_0x5e3b28[_0x702f('0x1a')][_0x702f('0x1b')][_0x255a73][_0x702f('0x1d')]+'';}}return _0x4dcff1[_0x702f('0x1e')](_0x246cc3);})[_0x702f('0x11')](function(){logger[_0x702f('0xa')](util[_0x702f('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4dcff1['id']));if(!_0x4dcff1['tempSentiment']){throw new db['Sequelize'][(_0x702f('0x1f'))](_0x702f('0x20'));}if(!_0x565006[_0x702f('0x21')]||!_0x565006['sentimentAccountId']||!_0x565006['sentimentRegion']||!_0x565006[_0x702f('0x22')]||!_0x565006[_0x702f('0x23')]){throw new db[(_0x702f('0x24'))][(_0x702f('0x1f'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x246cc3[_0x702f('0x14')]){throw new Error(_0x702f('0x25'));}if(_0x565006[_0x702f('0x26')]===_0x2a144f['id']){return _0x2a144f;}else{return db['CloudProvider'][_0x702f('0x27')]({'where':{'id':_settings[_0x702f('0x26')]}});}})[_0x702f('0x11')](function(_0x36694b){if(!_0x36694b){throw new db[(_0x702f('0x24'))]['ValidationError'](_0x702f('0x28'));}if(!_0x36694b['data1']||!_0x36694b[_0x702f('0xf')]){throw new db['Sequelize'][(_0x702f('0x1f'))](_0x702f('0x29'));}_0x40d403=_0x36694b;logger[_0x702f('0xa')](util['format'](_0x702f('0x2a'),_0x4dcff1['id']));return sentiment(_0x40d403[_0x702f('0xe')],_0x40d403['data2'],_0x565006[_0x702f('0x2b')],_0x246cc3[_0x702f('0x14')],_0x565006[_0x702f('0x22')]);})[_0x702f('0x11')](function(_0x197ee9){logger['info'](util[_0x702f('0xb')](_0x702f('0x2c'),_0x4dcff1['id']));return _0x4dcff1[_0x702f('0x1e')]({'sentiment':_0x197ee9[_0x702f('0x2d')],'sPositive':_0x197ee9['SentimentScore'][_0x702f('0x2e')],'sNegative':_0x197ee9[_0x702f('0x2f')][_0x702f('0x30')],'sMixed':_0x197ee9['SentimentScore'][_0x702f('0x31')],'sNeutral':_0x197ee9[_0x702f('0x2f')][_0x702f('0x32')]});})['then'](function(){logger[_0x702f('0xa')](util[_0x702f('0xb')](_0x702f('0x33'),_0x4dcff1['id']));_0x5bb2cb();});case _0x702f('0x34'):return _0x4dcff1[_0x702f('0x1e')]({'transcribeStatus':_0x702f('0x34'),'failureReason':_0x9a99e2[_0x702f('0x12')][_0x702f('0x35')]})['then'](function(){logger['info'](util[_0x702f('0xb')](_0x702f('0x33'),_0x4dcff1['id']));_0x5bb2cb();});default:logger[_0x702f('0xa')](util['format'](_0x702f('0x36'),_0x4dcff1['id']));break;}}else{return BPromise[_0x702f('0x37')]()['then'](function(){if(!_0x4dcff1[_0x702f('0x38')]){throw new db['Sequelize'][(_0x702f('0x1f'))](_0x702f('0x20'));}if(!_0x565006[_0x702f('0x21')]||!_0x565006['sentimentAccountId']||!_0x565006['sentimentRegion']||!_0x565006[_0x702f('0x22')]||!_0x565006[_0x702f('0x23')]){throw new db['Sequelize'][(_0x702f('0x1f'))](_0x702f('0x39'));}if(!_0x4dcff1[_0x702f('0x14')]){throw new Error(_0x702f('0x25'));}if(_0x565006['sentimentAccountId']===_0x2a144f['id']){return _0x2a144f;}else{return db['CloudProvider'][_0x702f('0x27')]({'where':{'id':_settings[_0x702f('0x26')]}});}})[_0x702f('0x11')](function(_0x36322a){if(!_0x36322a){throw new db[(_0x702f('0x24'))][(_0x702f('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x36322a[_0x702f('0xe')]||!_0x36322a[_0x702f('0xf')]){throw new db[(_0x702f('0x24'))][(_0x702f('0x1f'))](_0x702f('0x29'));}_0x40d403=_0x36322a;logger[_0x702f('0xa')](util[_0x702f('0xb')](_0x702f('0x2a'),_0x4dcff1['id']));return sentiment(_0x40d403[_0x702f('0xe')],_0x40d403[_0x702f('0xf')],_0x565006[_0x702f('0x2b')],_0x4dcff1[_0x702f('0x14')],_0x565006['language']);})[_0x702f('0x11')](function(_0x2af38c){logger[_0x702f('0xa')](util[_0x702f('0xb')](_0x702f('0x2c'),_0x4dcff1['id']));return _0x4dcff1['update']({'sentiment':_0x2af38c[_0x702f('0x2d')],'sPositive':_0x2af38c[_0x702f('0x2f')][_0x702f('0x2e')],'sNegative':_0x2af38c[_0x702f('0x2f')]['Negative'],'sMixed':_0x2af38c[_0x702f('0x2f')][_0x702f('0x31')],'sNeutral':_0x2af38c[_0x702f('0x2f')][_0x702f('0x32')],'transcribeStatus':'COMPLETED'});})['then'](function(){logger['info'](util['format'](_0x702f('0x33'),_0x4dcff1['id']));_0x5bb2cb();});}})[_0x702f('0x3a')](function(_0x2ccafd){if(_0x2ccafd){if(!_0x2ccafd['name']||_0x2ccafd[_0x702f('0x3b')]!==_0x702f('0x3c')){logger[_0x702f('0x3d')](util[_0x702f('0xb')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x4dcff1['id']),util[_0x702f('0x3e')](_0x2ccafd,{'showHidden':![],'depth':null}));}}_0x5bb2cb();});});}function checkTranscribe(){var _0x54a498;var _0x3cec66;var _0x2ad70f;return db[_0x702f('0x3f')]['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x3a071f){if(!_0x3a071f||!_0x3a071f[_0x702f('0x1c')]){throw new db[(_0x702f('0x24'))][(_0x702f('0x1f'))]('No\x20transcribe\x20job\x20to\x20check');}_0x54a498=_0x3a071f;return db[_0x702f('0x40')][_0x702f('0x27')]({'where':{'id':0x1}});})[_0x702f('0x11')](function(_0x1ede74){if(!_0x1ede74){throw new db[(_0x702f('0x24'))][(_0x702f('0x1f'))](_0x702f('0x41'));}_0x3cec66=_0x1ede74;if(!_0x3cec66[_0x702f('0x6')]||!_0x3cec66[_0x702f('0x42')]||!_0x3cec66[_0x702f('0x10')]||!_0x3cec66[_0x702f('0x22')]||!_0x3cec66[_0x702f('0x23')]){throw new db[(_0x702f('0x24'))][(_0x702f('0x1f'))]('Transcribe\x20not\x20configured');}return db[_0x702f('0x43')][_0x702f('0x27')]({'where':{'id':_0x3cec66[_0x702f('0x42')]}});})[_0x702f('0x11')](function(_0x389fe7){if(!_0x389fe7){throw new db['Sequelize']['ValidationError'](_0x702f('0x28'));}if(!_0x389fe7[_0x702f('0xe')]||!_0x389fe7[_0x702f('0xf')]){throw new db[(_0x702f('0x24'))][(_0x702f('0x1f'))](_0x702f('0x29'));}_0x2ad70f=_0x389fe7;var _0x3a024b=[];_0x54a498[_0x702f('0x44')](function(_0x4d307d){_0x3a024b[_0x702f('0x45')](checkTranscribeJob(_0x4d307d,_0x3cec66,_0x2ad70f));});return BPromise[_0x702f('0x46')](_0x3a024b);})[_0x702f('0x3a')](function(_0x1a2fb9){if(_0x1a2fb9){if(!_0x1a2fb9[_0x702f('0x3b')]||_0x1a2fb9[_0x702f('0x3b')]!=='SequelizeValidationError'){logger[_0x702f('0x3d')](util[_0x702f('0x3e')](_0x1a2fb9,{'showHidden':![],'depth':null}));}}});}exports[_0x702f('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xacd4=['length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','ValidationError','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','update','Sentiment','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','catch','error','start','lodash','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeRegion','transcribeName','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts'];(function(_0xd00e8a,_0x259941){var _0x5ade3e=function(_0x39fb7c){while(--_0x39fb7c){_0xd00e8a['push'](_0xd00e8a['shift']());}};_0x5ade3e(++_0x259941);}(_0xacd4,0x162));var _0x4acd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xacd4[_0x321bb2];return _0x9c12ed;};var _=require(_0x4acd('0x0'));var AWS=require('aws-sdk');var rp=require(_0x4acd('0x1'));var util=require(_0x4acd('0x2'));var BPromise=require(_0x4acd('0x3'));var db=require(_0x4acd('0x4'))['db'];var logger=require(_0x4acd('0x5'))(_0x4acd('0x6'));function getTranscriptionJob(_0x391aae,_0x16ff6c,_0x4483f8,_0x2116f3){return new Promise(function(_0x32d8e3,_0xccd6d){var _0xfd38bc=new AWS['TranscribeService']({'accessKeyId':_0x16ff6c,'secretAccessKey':_0x391aae,'region':_0x4483f8});_0xfd38bc['getTranscriptionJob']({'TranscriptionJobName':_0x2116f3},function(_0xa45fb8,_0x5db49f){if(_0xa45fb8){return _0xccd6d(_0xa45fb8);}else{return _0x32d8e3(_0x5db49f);}});});}function sentiment(_0x1d3ea7,_0x400350,_0x2b67ab,_0x15bc8e,_0x198dc6){return new Promise(function(_0x15b0d0,_0x40a15e){var _0x10c842=new AWS[(_0x4acd('0x7'))]({'accessKeyId':_0x400350,'secretAccessKey':_0x1d3ea7,'region':_0x2b67ab});_0x10c842[_0x4acd('0x8')]({'Text':_0x15bc8e,'LanguageCode':_0x198dc6[_0x4acd('0x9')](0x0,0x2)},function(_0x55deac,_0x3793d5){if(_0x55deac){return _0x40a15e(_0x55deac);}else{return _0x15b0d0(_0x3793d5);}});});}function checkTranscribeJob(_0x3d962b,_0x14c578,_0x34b44b){var _0x4bfd92;return new BPromise(function(_0x5462e9,_0x45c63c){logger[_0x4acd('0xa')](util['format'](_0x4acd('0xb'),_0x3d962b['id'],_0x3d962b['transcribeName']));return getTranscriptionJob(_0x34b44b['data1'],_0x34b44b['data2'],_0x14c578[_0x4acd('0xc')],_0x3d962b[_0x4acd('0xd')])[_0x4acd('0xe')](function(_0x2efd6b){logger[_0x4acd('0xa')](util[_0x4acd('0xf')](_0x4acd('0x10'),_0x3d962b['id'],_0x3d962b['transcribeName'],_0x2efd6b['TranscriptionJob'][_0x4acd('0x11')]));if(!_0x3d962b[_0x4acd('0x12')]){switch(_0x2efd6b[_0x4acd('0x13')]['TranscriptionJobStatus']){case _0x4acd('0x14'):var _0x54a2d3={'transcribeStatus':_0x2efd6b[_0x4acd('0x13')][_0x4acd('0x11')],'fileUri':_0x2efd6b[_0x4acd('0x13')]['Transcript']['TranscriptFileUri']};logger[_0x4acd('0xa')](util[_0x4acd('0xf')]('[RECORDING:%d]\x20Get\x20transcript',_0x3d962b['id']));return rp({'uri':_0x2efd6b[_0x4acd('0x13')][_0x4acd('0x15')][_0x4acd('0x16')],'json':!![]})[_0x4acd('0xe')](function(_0x53d75d){logger[_0x4acd('0xa')](util['format'](_0x4acd('0x17'),_0x3d962b['id']));if(_0x53d75d&&_0x53d75d[_0x4acd('0x18')]&&_0x53d75d[_0x4acd('0x18')][_0x4acd('0x19')]&&_0x53d75d[_0x4acd('0x18')]['transcripts']['length']){_0x54a2d3['fileText']='';for(var _0x43765d=0x0;_0x43765d<_0x53d75d[_0x4acd('0x18')][_0x4acd('0x19')][_0x4acd('0x1a')];_0x43765d++){_0x54a2d3[_0x4acd('0x12')]+=_0x53d75d['results'][_0x4acd('0x19')][_0x43765d][_0x4acd('0x1b')]+'';}}return _0x3d962b['update'](_0x54a2d3);})[_0x4acd('0xe')](function(){logger['info'](util[_0x4acd('0xf')](_0x4acd('0x1c'),_0x3d962b['id']));if(!_0x3d962b[_0x4acd('0x1d')]){throw new db[(_0x4acd('0x1e'))]['ValidationError'](_0x4acd('0x1f'));}if(!_0x14c578[_0x4acd('0x20')]||!_0x14c578[_0x4acd('0x21')]||!_0x14c578[_0x4acd('0x22')]||!_0x14c578['language']||!_0x14c578[_0x4acd('0x23')]){throw new db[(_0x4acd('0x1e'))]['ValidationError'](_0x4acd('0x24'));}if(!_0x54a2d3[_0x4acd('0x12')]){throw new Error(_0x4acd('0x25'));}if(_0x14c578[_0x4acd('0x21')]===_0x34b44b['id']){return _0x34b44b;}else{return db[_0x4acd('0x26')][_0x4acd('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x4acd('0xe')](function(_0x1bb701){if(!_0x1bb701){throw new db[(_0x4acd('0x1e'))][(_0x4acd('0x28'))](_0x4acd('0x29'));}if(!_0x1bb701[_0x4acd('0x2a')]||!_0x1bb701[_0x4acd('0x2b')]){throw new db[(_0x4acd('0x1e'))][(_0x4acd('0x28'))](_0x4acd('0x2c'));}_0x4bfd92=_0x1bb701;logger[_0x4acd('0xa')](util['format'](_0x4acd('0x2d'),_0x3d962b['id']));return sentiment(_0x4bfd92['data1'],_0x4bfd92[_0x4acd('0x2b')],_0x14c578[_0x4acd('0x22')],_0x54a2d3[_0x4acd('0x12')],_0x14c578[_0x4acd('0x2e')]);})[_0x4acd('0xe')](function(_0x14ec8e){logger['info'](util['format'](_0x4acd('0x2f'),_0x3d962b['id']));return _0x3d962b['update']({'sentiment':_0x14ec8e['Sentiment'],'sPositive':_0x14ec8e[_0x4acd('0x30')][_0x4acd('0x31')],'sNegative':_0x14ec8e[_0x4acd('0x30')][_0x4acd('0x32')],'sMixed':_0x14ec8e[_0x4acd('0x30')][_0x4acd('0x33')],'sNeutral':_0x14ec8e[_0x4acd('0x30')][_0x4acd('0x34')]});})[_0x4acd('0xe')](function(){logger[_0x4acd('0xa')](util[_0x4acd('0xf')](_0x4acd('0x1c'),_0x3d962b['id']));_0x5462e9();});case _0x4acd('0x35'):return _0x3d962b['update']({'transcribeStatus':_0x4acd('0x35'),'failureReason':_0x2efd6b[_0x4acd('0x13')][_0x4acd('0x36')]})[_0x4acd('0xe')](function(){logger[_0x4acd('0xa')](util[_0x4acd('0xf')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3d962b['id']));_0x5462e9();});default:logger['info'](util[_0x4acd('0xf')](_0x4acd('0x37'),_0x3d962b['id']));break;}}else{return BPromise[_0x4acd('0x38')]()[_0x4acd('0xe')](function(){if(!_0x3d962b['tempSentiment']){throw new db[(_0x4acd('0x1e'))][(_0x4acd('0x28'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x14c578[_0x4acd('0x20')]||!_0x14c578[_0x4acd('0x21')]||!_0x14c578[_0x4acd('0x22')]||!_0x14c578[_0x4acd('0x2e')]||!_0x14c578[_0x4acd('0x23')]){throw new db[(_0x4acd('0x1e'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x3d962b[_0x4acd('0x12')]){throw new Error('Transcript\x20not\x20available');}if(_0x14c578[_0x4acd('0x21')]===_0x34b44b['id']){return _0x34b44b;}else{return db[_0x4acd('0x26')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0x4acd('0xe')](function(_0x4dbbf5){if(!_0x4dbbf5){throw new db[(_0x4acd('0x1e'))]['ValidationError'](_0x4acd('0x29'));}if(!_0x4dbbf5[_0x4acd('0x2a')]||!_0x4dbbf5['data2']){throw new db[(_0x4acd('0x1e'))]['ValidationError'](_0x4acd('0x2c'));}_0x4bfd92=_0x4dbbf5;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x3d962b['id']));return sentiment(_0x4bfd92[_0x4acd('0x2a')],_0x4bfd92[_0x4acd('0x2b')],_0x14c578['sentimentRegion'],_0x3d962b[_0x4acd('0x12')],_0x14c578[_0x4acd('0x2e')]);})[_0x4acd('0xe')](function(_0x4679f7){logger['info'](util[_0x4acd('0xf')](_0x4acd('0x2f'),_0x3d962b['id']));return _0x3d962b[_0x4acd('0x39')]({'sentiment':_0x4679f7[_0x4acd('0x3a')],'sPositive':_0x4679f7[_0x4acd('0x30')]['Positive'],'sNegative':_0x4679f7[_0x4acd('0x30')][_0x4acd('0x32')],'sMixed':_0x4679f7[_0x4acd('0x30')][_0x4acd('0x33')],'sNeutral':_0x4679f7[_0x4acd('0x30')][_0x4acd('0x34')],'transcribeStatus':_0x4acd('0x14')});})['then'](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3d962b['id']));_0x5462e9();});}})['catch'](function(_0x102ac7){if(_0x102ac7){if(!_0x102ac7[_0x4acd('0x3b')]||_0x102ac7[_0x4acd('0x3b')]!==_0x4acd('0x3c')){logger['error'](util[_0x4acd('0xf')](_0x4acd('0x3d'),_0x3d962b['id']),util[_0x4acd('0x3e')](_0x102ac7,{'showHidden':![],'depth':null}));}}_0x5462e9();});});}function checkTranscribe(){var _0xffd6d6;var _0x5a3481;var _0x35751c;return db[_0x4acd('0x3f')][_0x4acd('0x40')]({'where':{'transcribeStatus':_0x4acd('0x41')}})[_0x4acd('0xe')](function(_0x445299){if(!_0x445299||!_0x445299['length']){throw new db['Sequelize']['ValidationError'](_0x4acd('0x42'));}_0xffd6d6=_0x445299;return db[_0x4acd('0x43')][_0x4acd('0x27')]({'where':{'id':0x1}});})[_0x4acd('0xe')](function(_0x5c6054){if(!_0x5c6054){throw new db[(_0x4acd('0x1e'))][(_0x4acd('0x28'))](_0x4acd('0x44'));}_0x5a3481=_0x5c6054;if(!_0x5a3481[_0x4acd('0x6')]||!_0x5a3481[_0x4acd('0x45')]||!_0x5a3481[_0x4acd('0xc')]||!_0x5a3481[_0x4acd('0x2e')]||!_0x5a3481[_0x4acd('0x23')]){throw new db['Sequelize']['ValidationError'](_0x4acd('0x46'));}return db[_0x4acd('0x26')]['findOne']({'where':{'id':_0x5a3481[_0x4acd('0x45')]}});})[_0x4acd('0xe')](function(_0x2b693a){if(!_0x2b693a){throw new db[(_0x4acd('0x1e'))][(_0x4acd('0x28'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2b693a[_0x4acd('0x2a')]||!_0x2b693a['data2']){throw new db[(_0x4acd('0x1e'))][(_0x4acd('0x28'))]('Cloud\x20Provider\x20not\x20configured');}_0x35751c=_0x2b693a;var _0x16a4a5=[];_0xffd6d6[_0x4acd('0x47')](function(_0x44de51){_0x16a4a5[_0x4acd('0x48')](checkTranscribeJob(_0x44de51,_0x5a3481,_0x35751c));});return BPromise['all'](_0x16a4a5);})[_0x4acd('0x49')](function(_0x31652a){if(_0x31652a){if(!_0x31652a[_0x4acd('0x3b')]||_0x31652a['name']!==_0x4acd('0x3c')){logger[_0x4acd('0x4a')](util[_0x4acd('0x3e')](_0x31652a,{'showHidden':![],'depth':null}));}}});}exports[_0x4acd('0x4b')]=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 f657d53..15fb452 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 _0xd76e=['schedule','redis','defaults','localhost','WhatsappInteraction','findAll','lastMsgAt','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger'];(function(_0x27250c,_0x3e6637){var _0x7e3095=function(_0x1bbce7){while(--_0x1bbce7){_0x27250c['push'](_0x27250c['shift']());}};_0x7e3095(++_0x3e6637);}(_0xd76e,0x101));var _0xed76=function(_0x4376e8,_0x4dfdf6){_0x4376e8=_0x4376e8-0x0;var _0x12e63b=_0xd76e[_0x4376e8];return _0x12e63b;};'use strict';var _=require(_0xed76('0x0'));var moment=require(_0xed76('0x1'));var Redis=require(_0xed76('0x2'));var util=require(_0xed76('0x3'));var config=require(_0xed76('0x4'));var db=require(_0xed76('0x5'))['db'];var logger=require(_0xed76('0x6'))(_0xed76('0x7'));config[_0xed76('0x8')]=_[_0xed76('0x9')](config[_0xed76('0x8')],{'host':_0xed76('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xed76('0x8')]));function closeInteractions(){var _0xde53c1=[];return db[_0xed76('0xb')][_0xed76('0xc')]({'raw':!![],'attributes':['id',_0xed76('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xed76('0xe'))}}})[_0xed76('0xf')](function(_0x58335b){if(_0x58335b&&_0x58335b[_0xed76('0x10')]){_0xde53c1=_[_0xed76('0x11')](_0x58335b||[],'id');logger[_0xed76('0x12')](_0xed76('0x13'),_0xde53c1[_0xed76('0x14')]());return db[_0xed76('0xb')]['update']({'closeReason':_0xed76('0x15'),'disposition':_0xed76('0x16'),'closed':!![],'closedAt':moment()[_0xed76('0x17')](_0xed76('0x18'))},{'where':{'id':_0xde53c1}});}})[_0xed76('0xf')](function(){if(_0xde53c1&&_0xde53c1[_0xed76('0x10')]){logger[_0xed76('0x12')](_0xed76('0x19'),_0xde53c1['join']());for(var _0x37905b=0x0;_0x37905b<_0xde53c1['length'];_0x37905b++){io[_0xed76('0x1a')](_0xed76('0x1b'),{'id':_0xde53c1[_0x37905b],'closed':!![]});}}})[_0xed76('0x1c')](function(_0xd3791a){logger[_0xed76('0x1d')](_0xed76('0x1e'),_0xd3791a?util[_0xed76('0x1f')](_0xd3791a,{'showHidden':![],'depth':null}):'');});}exports[_0xed76('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xfc04=['../../mysqldb','redis','defaults','localhost','WhatsappInteraction','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','format','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','ioredis','../../config/environment'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0xfc04,0x19d));var _0x4fc0=function(_0x2cf7de,_0xc91dbc){_0x2cf7de=_0x2cf7de-0x0;var _0x340728=_0xfc04[_0x2cf7de];return _0x340728;};'use strict';var _=require(_0x4fc0('0x0'));var moment=require('moment');var Redis=require(_0x4fc0('0x1'));var util=require('util');var config=require(_0x4fc0('0x2'));var db=require(_0x4fc0('0x3'))['db'];var logger=require('../logger')('schedule');config[_0x4fc0('0x4')]=_[_0x4fc0('0x5')](config[_0x4fc0('0x4')],{'host':_0x4fc0('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x118d8f=[];return db[_0x4fc0('0x7')]['findAll']({'raw':!![],'attributes':['id',_0x4fc0('0x8')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4fc0('0x9')](0x18,_0x4fc0('0xa'))}}})[_0x4fc0('0xb')](function(_0xbb967){if(_0xbb967&&_0xbb967[_0x4fc0('0xc')]){_0x118d8f=_[_0x4fc0('0xd')](_0xbb967||[],'id');logger[_0x4fc0('0xe')](_0x4fc0('0xf'),_0x118d8f[_0x4fc0('0x10')]());return db[_0x4fc0('0x7')][_0x4fc0('0x11')]({'closeReason':_0x4fc0('0x12'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x4fc0('0x13')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x118d8f}});}})[_0x4fc0('0xb')](function(){if(_0x118d8f&&_0x118d8f[_0x4fc0('0xc')]){logger[_0x4fc0('0xe')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x118d8f[_0x4fc0('0x10')]());for(var _0x4770e7=0x0;_0x4770e7<_0x118d8f[_0x4fc0('0xc')];_0x4770e7++){io[_0x4fc0('0x14')](_0x4fc0('0x15'),{'id':_0x118d8f[_0x4770e7],'closed':!![]});}}})[_0x4fc0('0x16')](function(_0x1ee2e){logger[_0x4fc0('0x17')](_0x4fc0('0x18'),_0x1ee2e?util[_0x4fc0('0x19')](_0x1ee2e,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 6e4aed5..b012030 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x73bc=['Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','then','bulkCreate','finished\x20populating','contacts1','CmHopper','destroy','log','hopper1','hopper2','catch','util','../mysqldb','push'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0x73bc,0x1c5));var _0xc73b=function(_0x31163d,_0x215b95){_0x31163d=_0x31163d-0x0;var _0x4acb12=_0x73bc[_0x31163d];return _0x4acb12;};'use strict';var util=require(_0xc73b('0x0'));var db=require(_0xc73b('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xc73b('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xc73b('0x3')+i,'phone':0xf879fb460+i,'email':_0xc73b('0x4')+i+_0xc73b('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xc73b('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xc73b('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xc73b('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xc73b('0x2')]({'id':i,'firstName':_0xc73b('0x7')+i,'lastName':_0xc73b('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xc73b('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xc73b('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xc73b('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc73b('0x6')](),'updatedAt':Date[_0xc73b('0x6')]()});}db[_0xc73b('0x8')]['destroy']({'where':{}})[_0xc73b('0x9')](function(){return db[_0xc73b('0x8')][_0xc73b('0xa')](contacts);})[_0xc73b('0x9')](function(){console['log'](_0xc73b('0xb'),_0xc73b('0xc'));return db[_0xc73b('0xd')][_0xc73b('0xe')]({'where':{}});})[_0xc73b('0x9')](function(){return db[_0xc73b('0xd')][_0xc73b('0xa')](hopper);})[_0xc73b('0x9')](function(){console[_0xc73b('0xf')]('finished\x20populating',_0xc73b('0x10'));return db[_0xc73b('0x8')][_0xc73b('0xa')](contacts2);})[_0xc73b('0x9')](function(){console['log'](_0xc73b('0xb'),'contacts2');return db[_0xc73b('0xd')][_0xc73b('0xa')](hopper2);})[_0xc73b('0x9')](function(){console[_0xc73b('0xf')](_0xc73b('0xb'),_0xc73b('0x11'));})[_0xc73b('0x12')](function(_0x245f59){console['log'](_0x245f59);}); \ No newline at end of file +var _0xd5d5=['@xcally.com','push','now','Innocenzo','CmContact','destroy','bulkCreate','log','finished\x20populating','contacts1','CmHopper','then','hopper1','contacts2','hopper2','util','../mysqldb','Biondo','innocenzo.biondo'];(function(_0x2afcf7,_0x189ad8){var _0x5e9ffc=function(_0x503ea8){while(--_0x503ea8){_0x2afcf7['push'](_0x2afcf7['shift']());}};_0x5e9ffc(++_0x189ad8);}(_0xd5d5,0xe0));var _0x5d5d=function(_0x595a21,_0x24790f){_0x595a21=_0x595a21-0x0;var _0x50df84=_0xd5d5[_0x595a21];return _0x50df84;};'use strict';var util=require(_0x5d5d('0x0'));var db=require(_0x5d5d('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':_0x5d5d('0x2')+i,'phone':0xf879fb460+i,'email':_0x5d5d('0x3')+i+_0x5d5d('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x5d5d('0x5')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5d5d('0x6')](),'updatedAt':Date[_0x5d5d('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x5d5d('0x7')+i,'lastName':_0x5d5d('0x2')+i,'phone':0xf879fb460+i,'email':_0x5d5d('0x3')+i+_0x5d5d('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x5d5d('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x5d5d('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5d5d('0x6')](),'updatedAt':Date['now']()});}db[_0x5d5d('0x8')][_0x5d5d('0x9')]({'where':{}})['then'](function(){return db[_0x5d5d('0x8')][_0x5d5d('0xa')](contacts);})['then'](function(){console[_0x5d5d('0xb')](_0x5d5d('0xc'),_0x5d5d('0xd'));return db[_0x5d5d('0xe')]['destroy']({'where':{}});})[_0x5d5d('0xf')](function(){return db[_0x5d5d('0xe')][_0x5d5d('0xa')](hopper);})[_0x5d5d('0xf')](function(){console['log']('finished\x20populating',_0x5d5d('0x10'));return db[_0x5d5d('0x8')][_0x5d5d('0xa')](contacts2);})[_0x5d5d('0xf')](function(){console['log'](_0x5d5d('0xc'),_0x5d5d('0x11'));return db[_0x5d5d('0xe')][_0x5d5d('0xa')](hopper2);})[_0x5d5d('0xf')](function(){console[_0x5d5d('0xb')](_0x5d5d('0xc'),_0x5d5d('0x12'));})['catch'](function(_0x530ab7){console[_0x5d5d('0xb')](_0x530ab7);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 3d07839..764c426 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x13e7=['format','agent','%s%s','%s%s@xcally.com','password','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','log','catch','util','../mysqldb'];(function(_0x3ada9e,_0x561f5e){var _0x276a9c=function(_0x4a9a6d){while(--_0x4a9a6d){_0x3ada9e['push'](_0x3ada9e['shift']());}};_0x276a9c(++_0x561f5e);}(_0x13e7,0xde));var _0x713e=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0x13e7[_0x15ea09];return _0x3e9c78;};'use strict';var util=require(_0x713e('0x0'));var db=require(_0x713e('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x713e('0x2')]('%s%s',_0x713e('0x3'),i),'fullname':util[_0x713e('0x2')](_0x713e('0x4'),_0x713e('0x3'),i),'email':util[_0x713e('0x2')](_0x713e('0x5'),_0x713e('0x3'),i),'role':_0x713e('0x3'),'password':_0x713e('0x6'),'internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0x713e('0x7')],'disallow':[_0x713e('0x8')],'allow':[_0x713e('0x9')],'defaultuser':util[_0x713e('0x2')](_0x713e('0x4'),'agent',i),'encryption':_0x713e('0xa'),'avpf':_0x713e('0xa'),'force_avp':_0x713e('0xa'),'icesupport':_0x713e('0xa'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x713e('0xb'),'dtlssetup':'actpass','callerid':util['format'](_0x713e('0xc'),util['format'](_0x713e('0x4'),_0x713e('0x3'),i),0xfa0+i)});}db[_0x713e('0xd')]['bulkCreate'](users)['then'](function(){console[_0x713e('0xe')]('add\x20user');})[_0x713e('0xf')](function(_0x572bc6){console['log'](_0x572bc6);}); \ No newline at end of file +var _0xf4c8=['wss','all','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','add\x20user','catch','log','util','../mysqldb','format','%s%s','agent','password','friend','udp'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xf4c8,0x98));var _0x8f4c=function(_0x5dee5e,_0x2fd6fb){_0x5dee5e=_0x5dee5e-0x0;var _0x14caf0=_0xf4c8[_0x5dee5e];return _0x14caf0;};'use strict';var util=require(_0x8f4c('0x0'));var db=require(_0x8f4c('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x8f4c('0x2')](_0x8f4c('0x3'),_0x8f4c('0x4'),i),'fullname':util[_0x8f4c('0x2')](_0x8f4c('0x3'),'agent',i),'email':util['format']('%s%s@xcally.com',_0x8f4c('0x4'),i),'role':_0x8f4c('0x4'),'password':_0x8f4c('0x5'),'internal':0xfa0+i,'type':_0x8f4c('0x6'),'transport':[_0x8f4c('0x7'),'ws',_0x8f4c('0x8')],'disallow':[_0x8f4c('0x9')],'allow':['ulaw'],'defaultuser':util[_0x8f4c('0x2')](_0x8f4c('0x3'),_0x8f4c('0x4'),i),'encryption':_0x8f4c('0xa'),'avpf':_0x8f4c('0xa'),'force_avp':_0x8f4c('0xa'),'icesupport':_0x8f4c('0xa'),'dtlsenable':_0x8f4c('0xa'),'dtlsverify':'no','dtlscertfile':_0x8f4c('0xb'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x8f4c('0xc'),'callerid':util[_0x8f4c('0x2')](_0x8f4c('0xd'),util[_0x8f4c('0x2')](_0x8f4c('0x3'),_0x8f4c('0x4'),i),0xfa0+i)});}db[_0x8f4c('0xe')][_0x8f4c('0xf')](users)[_0x8f4c('0x10')](function(){console['log'](_0x8f4c('0x11'));})[_0x8f4c('0x12')](function(_0x1a4879){console[_0x8f4c('0x13')](_0x1a4879);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 154ba01..9cff20e 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe130=['SmsQueues','MailQueues','WhatsappQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','map','resourceId','where','role','Campaign','then','format','Agents','length','handshake','query','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:inbound','VoiceQueue','ChatQueues','OpenchannelQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','all','voice','chat','fax','sms','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','join','default','connection','setMaxListeners','request','remotePort','connectedAt','log','SocketIO\x20','address','DISCONNECTED','CONNECTED','util','../mysqldb','User','name','agent','telephone','type','ivr','VoiceQueues','FaxQueues'];(function(_0xea0aca,_0x4ff0fb){var _0xd257e1=function(_0x2a5070){while(--_0x2a5070){_0xea0aca['push'](_0xea0aca['shift']());}};_0xd257e1(++_0x4ff0fb);}(_0xe130,0x18a));var _0x0e13=function(_0x521bd9,_0x2cbda9){_0x521bd9=_0x521bd9-0x0;var _0x18bb2f=_0xe130[_0x521bd9];return _0x18bb2f;};'use strict';var _=require('lodash');var util=require(_0x0e13('0x0'));var BPromise=require('bluebird');var db=require(_0x0e13('0x1'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0x0e13('0x2')],'attributes':['id',_0x0e13('0x3'),'role'],'raw':!![],'where':{'role':_0x0e13('0x4')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x0e13('0x3')],'where':{'role':_0x0e13('0x5')}};var queryTrunks={'raw':!![],'attributes':['id',_0x0e13('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x0e13('0x3')],'where':{'role':_0x0e13('0x4')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x0e13('0x3'),_0x0e13('0x6')],'where':{'type':_0x0e13('0x7')}};function getAssociatedResources(_0x4d5d8e,_0x708e1c,_0x1ebe95){return db['UserProfileSection']['findOne']({'where':{'name':_0x4d5d8e,'userProfileId':_0x708e1c},'raw':!![]})['then'](function(_0x18b8a9){if(_0x18b8a9){if(_0x18b8a9['autoAssociation']){switch(_0x4d5d8e){case _0x0e13('0x8'):case'ChatQueues':case _0x0e13('0x9'):case _0x0e13('0xa'):case _0x0e13('0xb'):case'OpenchannelQueues':case _0x0e13('0xc'):return db[_0x1ebe95]['findAll'](queryQueues);case _0x0e13('0xd'):return db[_0x1ebe95][_0x0e13('0xe')](queryTelephones);case _0x0e13('0xf'):return db[_0x1ebe95][_0x0e13('0xe')](queryTrunks);case _0x0e13('0x10'):return db[_0x1ebe95][_0x0e13('0xe')](queryCampaigns);}}else{return db[_0x0e13('0x11')][_0x0e13('0xe')]({'attributes':['resourceId'],'where':{'sectionId':_0x18b8a9['id']},'raw':!![]})['then'](function(_0x2152bb){if(_0x2152bb){var _0xe4f835={'where':{'id':_[_0x0e13('0x12')](_0x2152bb,_0x0e13('0x13'))},'raw':!![]};switch(_0x1ebe95){case _0x0e13('0x2'):_0xe4f835[_0x0e13('0x14')][_0x0e13('0x15')]=_0x0e13('0x5');break;case _0x0e13('0x16'):_0xe4f835['where'][_0x0e13('0x6')]=_0x0e13('0x7');break;}return db[_0x1ebe95][_0x0e13('0xe')](_0xe4f835);}else{return[];}});}}else{return[];}})[_0x0e13('0x17')](function(_0x1d505){return _0x1d505;});}function joinOrLeaveQueues(_0x215efd,_0x1de7f1,_0x42fcfb,_0x542c38){_0x215efd[_0x1de7f1](util[_0x0e13('0x18')]('%s:queue:%s',_0x42fcfb,_0x542c38[_0x0e13('0x3')]));if(_0x542c38[_0x0e13('0x19')]){for(var _0x2fbea3=0x0;_0x2fbea3<_0x542c38[_0x0e13('0x19')][_0x0e13('0x1a')];_0x2fbea3+=0x1){_0x215efd[_0x1de7f1](util[_0x0e13('0x18')]('user:%s',_0x542c38['Agents'][_0x2fbea3]['name']));}}}function joinOrLeave(_0x337f56,_0x1e0712,_0x1b1113){var _0x5e9a65;if(_0x337f56[_0x0e13('0x1b')][_0x0e13('0x1c')]['id']){db[_0x0e13('0x2')][_0x0e13('0x1d')]({'attributes':['id','name',_0x0e13('0x15'),_0x0e13('0x1e')],'where':{'id':_0x337f56[_0x0e13('0x1b')]['query']['id']},'include':[{'model':db[_0x0e13('0x1f')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x0e13('0x20')],'as':_0x0e13('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x0e13('0x22')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x0e13('0x23')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x0e13('0x24')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x0e13('0x25')],'as':_0x0e13('0x26'),'attributes':['id'],'raw':!![]}]})[_0x0e13('0x17')](function(_0x262c3a){if(_0x262c3a){_0x5e9a65=_0x262c3a;_0x337f56[_0x1e0712](util[_0x0e13('0x18')](_0x0e13('0x27'),_0x262c3a[_0x0e13('0x3')]));var _0x5906a5=[];switch(_0x262c3a[_0x0e13('0x15')]){case _0x0e13('0x28'):_0x337f56[_0x1e0712]('voice:inbound');_0x337f56[_0x1e0712](_0x0e13('0x29'));if(queryQueues[_0x0e13('0x2a')](_0x0e13('0x2b'))){delete queryQueues[_0x0e13('0x2b')];}_0x5906a5[_0x0e13('0x2c')](db['VoiceQueue'][_0x0e13('0xe')](queryQueues));_0x5906a5[_0x0e13('0x2c')](db[_0x0e13('0x2d')]['findAll'](queryQueues));_0x5906a5['push'](db[_0x0e13('0x2e')][_0x0e13('0xe')](queryQueues));_0x5906a5[_0x0e13('0x2c')](db[_0x0e13('0x2f')]['findAll'](queryQueues));_0x5906a5[_0x0e13('0x2c')](db[_0x0e13('0x30')]['findAll'](queryQueues));_0x5906a5[_0x0e13('0x2c')](db[_0x0e13('0x31')][_0x0e13('0xe')](queryQueues));_0x5906a5[_0x0e13('0x2c')](db[_0x0e13('0x32')][_0x0e13('0xe')](queryQueues));_0x5906a5[_0x0e13('0x2c')](db[_0x0e13('0x2')]['findAll'](queryTelephones));_0x5906a5['push'](db[_0x0e13('0x33')]['findAll'](queryTrunks));_0x5906a5[_0x0e13('0x2c')](db[_0x0e13('0x16')][_0x0e13('0xe')](queryCampaigns));_0x5906a5[_0x0e13('0x2c')](db[_0x0e13('0x2')]['findAll'](queryAgents));break;case _0x0e13('0x34'):_0x337f56[_0x1e0712](_0x0e13('0x35'));_0x337f56[_0x1e0712](_0x0e13('0x29'));_0x5906a5[_0x0e13('0x2c')](getAssociatedResources(_0x0e13('0x8'),_0x262c3a[_0x0e13('0x1e')],_0x0e13('0x36')));_0x5906a5[_0x0e13('0x2c')](getAssociatedResources(_0x0e13('0x37'),_0x262c3a[_0x0e13('0x1e')],_0x0e13('0x2d')));_0x5906a5[_0x0e13('0x2c')](getAssociatedResources(_0x0e13('0x9'),_0x262c3a[_0x0e13('0x1e')],_0x0e13('0x2e')));_0x5906a5[_0x0e13('0x2c')](getAssociatedResources(_0x0e13('0xa'),_0x262c3a[_0x0e13('0x1e')],'SmsQueue'));_0x5906a5[_0x0e13('0x2c')](getAssociatedResources(_0x0e13('0xb'),_0x262c3a[_0x0e13('0x1e')],_0x0e13('0x30')));_0x5906a5[_0x0e13('0x2c')](getAssociatedResources(_0x0e13('0x38'),_0x262c3a[_0x0e13('0x1e')],_0x0e13('0x31')));_0x5906a5['push'](getAssociatedResources('WhatsappQueues',_0x262c3a[_0x0e13('0x1e')],'WhatsappQueue'));_0x5906a5['push'](getAssociatedResources(_0x0e13('0xd'),_0x262c3a[_0x0e13('0x1e')],_0x0e13('0x2')));_0x5906a5[_0x0e13('0x2c')](getAssociatedResources(_0x0e13('0xf'),_0x262c3a[_0x0e13('0x1e')],_0x0e13('0x33')));_0x5906a5[_0x0e13('0x2c')](getAssociatedResources(_0x0e13('0x10'),_0x262c3a[_0x0e13('0x1e')],_0x0e13('0x16')));_0x5906a5[_0x0e13('0x2c')](db[_0x0e13('0x2')]['findAll'](queryAgents));break;case _0x0e13('0x4'):_0x337f56[_0x1e0712](_0x0e13('0x35'));_0x337f56[_0x1e0712](_0x0e13('0x29'));_0x5906a5['push'](_0x262c3a[_0x0e13('0x39')]({'attributes':['id','name']}));_0x5906a5[_0x0e13('0x2c')](_0x262c3a[_0x0e13('0x3a')]({'attributes':['id',_0x0e13('0x3')]}));_0x5906a5[_0x0e13('0x2c')](_0x262c3a[_0x0e13('0x3b')]({'attributes':['id',_0x0e13('0x3')]}));_0x5906a5['push'](_0x262c3a[_0x0e13('0x3c')]({'attributes':['id','name']}));_0x5906a5[_0x0e13('0x2c')](_0x262c3a[_0x0e13('0x3d')]({'attributes':['id',_0x0e13('0x3')]}));_0x5906a5[_0x0e13('0x2c')](_0x262c3a['getOpenchannelQueues']({'attributes':['id',_0x0e13('0x3')]}));_0x5906a5[_0x0e13('0x2c')](_0x262c3a['getWhatsappQueues']({'attributes':['id',_0x0e13('0x3')]}));break;}return BPromise[_0x0e13('0x3e')](_0x5906a5);}})['then'](function(_0x19fd38){if(_0x19fd38&&_0x19fd38[_0x0e13('0x1a')]){for(var _0x23a759=0x0;_0x23a759<_0x19fd38[_0x0e13('0x1a')];_0x23a759+=0x1){for(var _0x1c54f5=0x0;_0x1c54f5<_0x19fd38[_0x23a759][_0x0e13('0x1a')];_0x1c54f5+=0x1){switch(_0x23a759){case 0x0:joinOrLeaveQueues(_0x337f56,_0x1e0712,_0x0e13('0x3f'),_0x19fd38[_0x23a759][_0x1c54f5]);break;case 0x1:joinOrLeaveQueues(_0x337f56,_0x1e0712,_0x0e13('0x40'),_0x19fd38[_0x23a759][_0x1c54f5]);break;case 0x2:joinOrLeaveQueues(_0x337f56,_0x1e0712,_0x0e13('0x41'),_0x19fd38[_0x23a759][_0x1c54f5]);break;case 0x3:joinOrLeaveQueues(_0x337f56,_0x1e0712,_0x0e13('0x42'),_0x19fd38[_0x23a759][_0x1c54f5]);break;case 0x4:joinOrLeaveQueues(_0x337f56,_0x1e0712,'mail',_0x19fd38[_0x23a759][_0x1c54f5]);break;case 0x5:joinOrLeaveQueues(_0x337f56,_0x1e0712,_0x0e13('0x43'),_0x19fd38[_0x23a759][_0x1c54f5]);break;case 0x6:joinOrLeaveQueues(_0x337f56,_0x1e0712,_0x0e13('0x44'),_0x19fd38[_0x23a759][_0x1c54f5]);break;case 0x7:if(_0x5e9a65[_0x0e13('0x15')]!==_0x0e13('0x4'))_0x337f56[_0x1e0712](util['format'](_0x0e13('0x45'),_0x19fd38[_0x23a759][_0x1c54f5][_0x0e13('0x3')]));break;case 0x8:if(_0x5e9a65[_0x0e13('0x15')]!=='agent')_0x337f56[_0x1e0712](util[_0x0e13('0x18')]('trunk:%s',_0x19fd38[_0x23a759][_0x1c54f5][_0x0e13('0x3')]));break;case 0x9:if(_0x5e9a65[_0x0e13('0x15')]!==_0x0e13('0x4'))_0x337f56[_0x1e0712](util['format'](_0x0e13('0x46'),_0x19fd38[_0x23a759][_0x1c54f5]['type'],_0x19fd38[_0x23a759][_0x1c54f5][_0x0e13('0x3')]));break;case 0xa:_0x337f56[_0x1e0712](util[_0x0e13('0x18')](_0x0e13('0x27'),_0x19fd38[_0x23a759][_0x1c54f5][_0x0e13('0x3')]));break;}}}}})[_0x0e13('0x17')](function(){if(_0x1e0712===_0x0e13('0x47')){var _0x4f1180=_[_0x0e13('0x12')](_0x5e9a65[_0x0e13('0x48')],'id');return _0x5e9a65[_0x0e13('0x49')](_0x4f1180)[_0x0e13('0x17')](function(){for(var _0x5e9b3a=0x0;_0x5e9b3a<_0x4f1180['length'];_0x5e9b3a+=0x1){_0x1b1113['emit'](_0x0e13('0x4a'),{'ChatInteractionId':Number(_0x4f1180[_0x5e9b3a]),'UserId':Number(_0x5e9a65['id'])});}});}})[_0x0e13('0x17')](function(){if(_0x1e0712===_0x0e13('0x47')){var _0x52c5e7=_[_0x0e13('0x12')](_0x5e9a65[_0x0e13('0x21')],'id');return _0x5e9a65[_0x0e13('0x4b')](_0x52c5e7)['then'](function(){for(var _0x50868d=0x0;_0x50868d<_0x52c5e7[_0x0e13('0x1a')];_0x50868d+=0x1){_0x1b1113[_0x0e13('0x4c')](_0x0e13('0x4d'),{'MailInteractionId':Number(_0x52c5e7[_0x50868d]),'UserId':Number(_0x5e9a65['id'])});}});}})['then'](function(){if(_0x1e0712==='leave'){var _0x1510ab=_['map'](_0x5e9a65[_0x0e13('0x4e')],'id');return _0x5e9a65[_0x0e13('0x4f')](_0x1510ab)[_0x0e13('0x17')](function(){for(var _0x370107=0x0;_0x370107<_0x1510ab[_0x0e13('0x1a')];_0x370107+=0x1){_0x1b1113['emit'](_0x0e13('0x50'),{'FaxInteractionId':Number(_0x1510ab[_0x370107]),'UserId':Number(_0x5e9a65['id'])});}});}})[_0x0e13('0x17')](function(){if(_0x1e0712===_0x0e13('0x47')){var _0x2dc85a=_['map'](_0x5e9a65[_0x0e13('0x51')],'id');return _0x5e9a65[_0x0e13('0x52')](_0x2dc85a)['then'](function(){for(var _0x37200d=0x0;_0x37200d<_0x2dc85a[_0x0e13('0x1a')];_0x37200d+=0x1){_0x1b1113[_0x0e13('0x4c')](_0x0e13('0x53'),{'SmsInteractionId':Number(_0x2dc85a[_0x37200d]),'UserId':Number(_0x5e9a65['id'])});}});}})['then'](function(){if(_0x1e0712===_0x0e13('0x47')){var _0x4be920=_['map'](_0x5e9a65[_0x0e13('0x54')],'id');return _0x5e9a65[_0x0e13('0x55')](_0x4be920)['then'](function(){for(var _0x35fb55=0x0;_0x35fb55<_0x4be920['length'];_0x35fb55+=0x1){_0x1b1113[_0x0e13('0x4c')](_0x0e13('0x56'),{'OpenchannelInteractionId':Number(_0x4be920[_0x35fb55]),'UserId':Number(_0x5e9a65['id'])});}});}})[_0x0e13('0x17')](function(){if(_0x1e0712===_0x0e13('0x47')){var _0xb4043=_[_0x0e13('0x12')](_0x5e9a65['WhatsappInteractions'],'id');return _0x5e9a65[_0x0e13('0x57')](_0xb4043)[_0x0e13('0x17')](function(){for(var _0x567bc3=0x0;_0x567bc3<_0xb4043[_0x0e13('0x1a')];_0x567bc3+=0x1){_0x1b1113[_0x0e13('0x4c')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0xb4043[_0x567bc3]),'UserId':Number(_0x5e9a65['id'])});}});}})[_0x0e13('0x58')](function(_0x5217c3){_0x337f56['log'](_0x5217c3);});}}function onDisconnect(_0x191a97,_0xb0cd43){joinOrLeave(_0x191a97,_0x0e13('0x47'),_0xb0cd43);}function onConnect(_0x52c577){joinOrLeave(_0x52c577,_0x0e13('0x59'));}exports[_0x0e13('0x5a')]=function(_0x3250c4){_0x3250c4['on'](_0x0e13('0x5b'),function(_0xf1e851){_0xf1e851[_0x0e13('0x5c')](0x0);_0xf1e851['address']=_0xf1e851[_0x0e13('0x5d')][_0x0e13('0x5b')]['remoteAddress']+':'+_0xf1e851[_0x0e13('0x5d')]['connection'][_0x0e13('0x5e')];_0xf1e851[_0x0e13('0x5f')]=new Date();_0xf1e851[_0x0e13('0x60')]=function(_0xc32698){console[_0x0e13('0x60')](_0x0e13('0x61')+_0xf1e851['nsp'][_0x0e13('0x3')]+'['+_0xf1e851[_0x0e13('0x62')]+']',_0xc32698);};_0xf1e851['on']('disconnect',function(){onDisconnect(_0xf1e851,_0x3250c4);_0xf1e851[_0x0e13('0x60')](_0x0e13('0x63'));});onConnect(_0xf1e851);_0xf1e851[_0x0e13('0x60')](_0x0e13('0x64'));});}; \ No newline at end of file +var _0x6ee1=['join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','./environment','name','User','role','agent','telephone','type','ivr','UserProfileSection','findOne','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','resourceId','then','map','where','format','%s:queue:%s','Agents','user:%s','handshake','query','find','ChatInteractions','MailInteractions','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','Campaign','user','voice:outbound','userProfileId','WhatsappQueue','IvrCampaigns','getVoiceQueues','getFaxQueues','getSmsQueues','all','length','chat','fax','whatsapp','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','log'];(function(_0xc1f905,_0x3153f1){var _0x1378cd=function(_0x1af57b){while(--_0x1af57b){_0xc1f905['push'](_0xc1f905['shift']());}};_0x1378cd(++_0x3153f1);}(_0x6ee1,0x6a));var _0x16ee=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x6ee1[_0x576170];return _0x397c70;};'use strict';var _=require(_0x16ee('0x0'));var util=require('util');var BPromise=require(_0x16ee('0x1'));var db=require('../mysqldb')['db'];var config=require(_0x16ee('0x2'));var queryQueues={'attributes':['id',_0x16ee('0x3')],'include':[{'as':'Agents','model':db[_0x16ee('0x4')],'attributes':['id',_0x16ee('0x3'),_0x16ee('0x5')],'raw':!![],'where':{'role':_0x16ee('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x16ee('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x16ee('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x16ee('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x16ee('0x3'),_0x16ee('0x8')],'where':{'type':_0x16ee('0x9')}};function getAssociatedResources(_0x348646,_0x401b58,_0x3b9539){return db[_0x16ee('0xa')][_0x16ee('0xb')]({'where':{'name':_0x348646,'userProfileId':_0x401b58},'raw':!![]})['then'](function(_0x5a0cfb){if(_0x5a0cfb){if(_0x5a0cfb['autoAssociation']){switch(_0x348646){case _0x16ee('0xc'):case _0x16ee('0xd'):case _0x16ee('0xe'):case _0x16ee('0xf'):case _0x16ee('0x10'):case _0x16ee('0x11'):case _0x16ee('0x12'):return db[_0x3b9539][_0x16ee('0x13')](queryQueues);case _0x16ee('0x14'):return db[_0x3b9539]['findAll'](queryTelephones);case _0x16ee('0x15'):return db[_0x3b9539]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x3b9539][_0x16ee('0x13')](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':[_0x16ee('0x16')],'where':{'sectionId':_0x5a0cfb['id']},'raw':!![]})[_0x16ee('0x17')](function(_0x2248f0){if(_0x2248f0){var _0x45a7ff={'where':{'id':_[_0x16ee('0x18')](_0x2248f0,_0x16ee('0x16'))},'raw':!![]};switch(_0x3b9539){case'User':_0x45a7ff[_0x16ee('0x19')]['role']='telephone';break;case'Campaign':_0x45a7ff[_0x16ee('0x19')][_0x16ee('0x8')]='ivr';break;}return db[_0x3b9539][_0x16ee('0x13')](_0x45a7ff);}else{return[];}});}}else{return[];}})['then'](function(_0x399f1e){return _0x399f1e;});}function joinOrLeaveQueues(_0x36b683,_0xaf4f7,_0x46ee35,_0x572124){_0x36b683[_0xaf4f7](util[_0x16ee('0x1a')](_0x16ee('0x1b'),_0x46ee35,_0x572124[_0x16ee('0x3')]));if(_0x572124['Agents']){for(var _0x26e5b5=0x0;_0x26e5b5<_0x572124[_0x16ee('0x1c')]['length'];_0x26e5b5+=0x1){_0x36b683[_0xaf4f7](util[_0x16ee('0x1a')](_0x16ee('0x1d'),_0x572124[_0x16ee('0x1c')][_0x26e5b5][_0x16ee('0x3')]));}}}function joinOrLeave(_0x1292a8,_0x481e0b,_0x21a709){var _0x2fd8e6;if(_0x1292a8[_0x16ee('0x1e')][_0x16ee('0x1f')]['id']){db[_0x16ee('0x4')][_0x16ee('0x20')]({'attributes':['id',_0x16ee('0x3'),_0x16ee('0x5'),'userProfileId'],'where':{'id':_0x1292a8[_0x16ee('0x1e')][_0x16ee('0x1f')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x16ee('0x21'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x16ee('0x22'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x16ee('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x16ee('0x24')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x16ee('0x25')],'as':_0x16ee('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x16ee('0x27')],'as':_0x16ee('0x28'),'attributes':['id'],'raw':!![]}]})[_0x16ee('0x17')](function(_0x4cb5d0){if(_0x4cb5d0){_0x2fd8e6=_0x4cb5d0;_0x1292a8[_0x481e0b](util[_0x16ee('0x1a')]('user:%s',_0x4cb5d0[_0x16ee('0x3')]));var _0x2f15a9=[];switch(_0x4cb5d0[_0x16ee('0x5')]){case'admin':_0x1292a8[_0x481e0b](_0x16ee('0x29'));_0x1292a8[_0x481e0b]('voice:outbound');if(queryQueues[_0x16ee('0x2a')](_0x16ee('0x2b'))){delete queryQueues[_0x16ee('0x2b')];}_0x2f15a9[_0x16ee('0x2c')](db[_0x16ee('0x2d')]['findAll'](queryQueues));_0x2f15a9[_0x16ee('0x2c')](db[_0x16ee('0x2e')]['findAll'](queryQueues));_0x2f15a9[_0x16ee('0x2c')](db[_0x16ee('0x2f')][_0x16ee('0x13')](queryQueues));_0x2f15a9[_0x16ee('0x2c')](db[_0x16ee('0x30')][_0x16ee('0x13')](queryQueues));_0x2f15a9[_0x16ee('0x2c')](db[_0x16ee('0x31')][_0x16ee('0x13')](queryQueues));_0x2f15a9[_0x16ee('0x2c')](db[_0x16ee('0x32')][_0x16ee('0x13')](queryQueues));_0x2f15a9[_0x16ee('0x2c')](db['WhatsappQueue'][_0x16ee('0x13')](queryQueues));_0x2f15a9[_0x16ee('0x2c')](db[_0x16ee('0x4')]['findAll'](queryTelephones));_0x2f15a9[_0x16ee('0x2c')](db[_0x16ee('0x33')][_0x16ee('0x13')](queryTrunks));_0x2f15a9[_0x16ee('0x2c')](db[_0x16ee('0x34')][_0x16ee('0x13')](queryCampaigns));_0x2f15a9[_0x16ee('0x2c')](db['User']['findAll'](queryAgents));break;case _0x16ee('0x35'):_0x1292a8[_0x481e0b](_0x16ee('0x29'));_0x1292a8[_0x481e0b](_0x16ee('0x36'));_0x2f15a9[_0x16ee('0x2c')](getAssociatedResources(_0x16ee('0xc'),_0x4cb5d0[_0x16ee('0x37')],'VoiceQueue'));_0x2f15a9[_0x16ee('0x2c')](getAssociatedResources(_0x16ee('0xd'),_0x4cb5d0[_0x16ee('0x37')],_0x16ee('0x2e')));_0x2f15a9[_0x16ee('0x2c')](getAssociatedResources(_0x16ee('0xe'),_0x4cb5d0['userProfileId'],'FaxQueue'));_0x2f15a9[_0x16ee('0x2c')](getAssociatedResources(_0x16ee('0xf'),_0x4cb5d0[_0x16ee('0x37')],_0x16ee('0x30')));_0x2f15a9[_0x16ee('0x2c')](getAssociatedResources(_0x16ee('0x10'),_0x4cb5d0[_0x16ee('0x37')],_0x16ee('0x31')));_0x2f15a9[_0x16ee('0x2c')](getAssociatedResources('OpenchannelQueues',_0x4cb5d0[_0x16ee('0x37')],_0x16ee('0x32')));_0x2f15a9[_0x16ee('0x2c')](getAssociatedResources(_0x16ee('0x12'),_0x4cb5d0[_0x16ee('0x37')],_0x16ee('0x38')));_0x2f15a9[_0x16ee('0x2c')](getAssociatedResources(_0x16ee('0x14'),_0x4cb5d0[_0x16ee('0x37')],_0x16ee('0x4')));_0x2f15a9[_0x16ee('0x2c')](getAssociatedResources(_0x16ee('0x15'),_0x4cb5d0[_0x16ee('0x37')],_0x16ee('0x33')));_0x2f15a9[_0x16ee('0x2c')](getAssociatedResources(_0x16ee('0x39'),_0x4cb5d0[_0x16ee('0x37')],'Campaign'));_0x2f15a9[_0x16ee('0x2c')](db['User']['findAll'](queryAgents));break;case _0x16ee('0x6'):_0x1292a8[_0x481e0b](_0x16ee('0x29'));_0x1292a8[_0x481e0b](_0x16ee('0x36'));_0x2f15a9[_0x16ee('0x2c')](_0x4cb5d0[_0x16ee('0x3a')]({'attributes':['id','name']}));_0x2f15a9['push'](_0x4cb5d0['getChatQueues']({'attributes':['id',_0x16ee('0x3')]}));_0x2f15a9[_0x16ee('0x2c')](_0x4cb5d0[_0x16ee('0x3b')]({'attributes':['id','name']}));_0x2f15a9['push'](_0x4cb5d0[_0x16ee('0x3c')]({'attributes':['id',_0x16ee('0x3')]}));_0x2f15a9[_0x16ee('0x2c')](_0x4cb5d0['getMailQueues']({'attributes':['id',_0x16ee('0x3')]}));_0x2f15a9[_0x16ee('0x2c')](_0x4cb5d0['getOpenchannelQueues']({'attributes':['id','name']}));_0x2f15a9['push'](_0x4cb5d0['getWhatsappQueues']({'attributes':['id',_0x16ee('0x3')]}));break;}return BPromise[_0x16ee('0x3d')](_0x2f15a9);}})[_0x16ee('0x17')](function(_0x182514){if(_0x182514&&_0x182514[_0x16ee('0x3e')]){for(var _0x53429e=0x0;_0x53429e<_0x182514[_0x16ee('0x3e')];_0x53429e+=0x1){for(var _0x958dd4=0x0;_0x958dd4<_0x182514[_0x53429e][_0x16ee('0x3e')];_0x958dd4+=0x1){switch(_0x53429e){case 0x0:joinOrLeaveQueues(_0x1292a8,_0x481e0b,'voice',_0x182514[_0x53429e][_0x958dd4]);break;case 0x1:joinOrLeaveQueues(_0x1292a8,_0x481e0b,_0x16ee('0x3f'),_0x182514[_0x53429e][_0x958dd4]);break;case 0x2:joinOrLeaveQueues(_0x1292a8,_0x481e0b,_0x16ee('0x40'),_0x182514[_0x53429e][_0x958dd4]);break;case 0x3:joinOrLeaveQueues(_0x1292a8,_0x481e0b,'sms',_0x182514[_0x53429e][_0x958dd4]);break;case 0x4:joinOrLeaveQueues(_0x1292a8,_0x481e0b,'mail',_0x182514[_0x53429e][_0x958dd4]);break;case 0x5:joinOrLeaveQueues(_0x1292a8,_0x481e0b,'openchannel',_0x182514[_0x53429e][_0x958dd4]);break;case 0x6:joinOrLeaveQueues(_0x1292a8,_0x481e0b,_0x16ee('0x41'),_0x182514[_0x53429e][_0x958dd4]);break;case 0x7:if(_0x2fd8e6[_0x16ee('0x5')]!=='agent')_0x1292a8[_0x481e0b](util[_0x16ee('0x1a')]('telephone:%s',_0x182514[_0x53429e][_0x958dd4][_0x16ee('0x3')]));break;case 0x8:if(_0x2fd8e6[_0x16ee('0x5')]!==_0x16ee('0x6'))_0x1292a8[_0x481e0b](util[_0x16ee('0x1a')](_0x16ee('0x42'),_0x182514[_0x53429e][_0x958dd4][_0x16ee('0x3')]));break;case 0x9:if(_0x2fd8e6[_0x16ee('0x5')]!==_0x16ee('0x6'))_0x1292a8[_0x481e0b](util[_0x16ee('0x1a')](_0x16ee('0x43'),_0x182514[_0x53429e][_0x958dd4][_0x16ee('0x8')],_0x182514[_0x53429e][_0x958dd4]['name']));break;case 0xa:_0x1292a8[_0x481e0b](util[_0x16ee('0x1a')](_0x16ee('0x1d'),_0x182514[_0x53429e][_0x958dd4]['name']));break;}}}}})[_0x16ee('0x17')](function(){if(_0x481e0b===_0x16ee('0x44')){var _0x4ce109=_['map'](_0x2fd8e6[_0x16ee('0x21')],'id');return _0x2fd8e6[_0x16ee('0x45')](_0x4ce109)[_0x16ee('0x17')](function(){for(var _0x282776=0x0;_0x282776<_0x4ce109[_0x16ee('0x3e')];_0x282776+=0x1){_0x21a709[_0x16ee('0x46')](_0x16ee('0x47'),{'ChatInteractionId':Number(_0x4ce109[_0x282776]),'UserId':Number(_0x2fd8e6['id'])});}});}})[_0x16ee('0x17')](function(){if(_0x481e0b==='leave'){var _0x2877f2=_[_0x16ee('0x18')](_0x2fd8e6[_0x16ee('0x22')],'id');return _0x2fd8e6[_0x16ee('0x48')](_0x2877f2)[_0x16ee('0x17')](function(){for(var _0x516373=0x0;_0x516373<_0x2877f2[_0x16ee('0x3e')];_0x516373+=0x1){_0x21a709['emit'](_0x16ee('0x49'),{'MailInteractionId':Number(_0x2877f2[_0x516373]),'UserId':Number(_0x2fd8e6['id'])});}});}})[_0x16ee('0x17')](function(){if(_0x481e0b===_0x16ee('0x44')){var _0x30e69c=_[_0x16ee('0x18')](_0x2fd8e6['FaxInteractions'],'id');return _0x2fd8e6[_0x16ee('0x4a')](_0x30e69c)[_0x16ee('0x17')](function(){for(var _0x508b75=0x0;_0x508b75<_0x30e69c['length'];_0x508b75+=0x1){_0x21a709['emit'](_0x16ee('0x4b'),{'FaxInteractionId':Number(_0x30e69c[_0x508b75]),'UserId':Number(_0x2fd8e6['id'])});}});}})[_0x16ee('0x17')](function(){if(_0x481e0b==='leave'){var _0x3b038c=_[_0x16ee('0x18')](_0x2fd8e6['SmsInteractions'],'id');return _0x2fd8e6['removeSmsInteractions'](_0x3b038c)[_0x16ee('0x17')](function(){for(var _0x5e4738=0x0;_0x5e4738<_0x3b038c[_0x16ee('0x3e')];_0x5e4738+=0x1){_0x21a709[_0x16ee('0x46')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x3b038c[_0x5e4738]),'UserId':Number(_0x2fd8e6['id'])});}});}})[_0x16ee('0x17')](function(){if(_0x481e0b===_0x16ee('0x44')){var _0x257f00=_['map'](_0x2fd8e6[_0x16ee('0x26')],'id');return _0x2fd8e6['removeOpenchannelInteractions'](_0x257f00)[_0x16ee('0x17')](function(){for(var _0x21adff=0x0;_0x21adff<_0x257f00[_0x16ee('0x3e')];_0x21adff+=0x1){_0x21a709[_0x16ee('0x46')](_0x16ee('0x4c'),{'OpenchannelInteractionId':Number(_0x257f00[_0x21adff]),'UserId':Number(_0x2fd8e6['id'])});}});}})['then'](function(){if(_0x481e0b===_0x16ee('0x44')){var _0x4bfacc=_[_0x16ee('0x18')](_0x2fd8e6[_0x16ee('0x28')],'id');return _0x2fd8e6['removeWhatsappInteractions'](_0x4bfacc)['then'](function(){for(var _0x1bd1d4=0x0;_0x1bd1d4<_0x4bfacc[_0x16ee('0x3e')];_0x1bd1d4+=0x1){_0x21a709[_0x16ee('0x46')](_0x16ee('0x4d'),{'WhatsappInteractionId':Number(_0x4bfacc[_0x1bd1d4]),'UserId':Number(_0x2fd8e6['id'])});}});}})[_0x16ee('0x4e')](function(_0x2ead8e){_0x1292a8[_0x16ee('0x4f')](_0x2ead8e);});}}function onDisconnect(_0x1a47d5,_0x380018){joinOrLeave(_0x1a47d5,'leave',_0x380018);}function onConnect(_0x1933f7){joinOrLeave(_0x1933f7,_0x16ee('0x50'));}exports[_0x16ee('0x51')]=function(_0x500160){_0x500160['on'](_0x16ee('0x52'),function(_0x35e841){_0x35e841[_0x16ee('0x53')](0x0);_0x35e841[_0x16ee('0x54')]=_0x35e841[_0x16ee('0x55')]['connection'][_0x16ee('0x56')]+':'+_0x35e841[_0x16ee('0x55')]['connection'][_0x16ee('0x57')];_0x35e841[_0x16ee('0x58')]=new Date();_0x35e841[_0x16ee('0x4f')]=function(_0x14bf8b){console['log']('SocketIO\x20'+_0x35e841[_0x16ee('0x59')][_0x16ee('0x3')]+'['+_0x35e841['address']+']',_0x14bf8b);};_0x35e841['on'](_0x16ee('0x5a'),function(){onDisconnect(_0x35e841,_0x500160);_0x35e841['log'](_0x16ee('0x5b'));});onConnect(_0x35e841);_0x35e841[_0x16ee('0x4f')](_0x16ee('0x5c'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index e05247d..468b3ff 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 _0x34f3=['http','ChatInteraction','afterCreate','newinteraction','Chat','newmessage','Sms','SmsInteraction','afterUpdate','Whatsapp','closedinteraction','WhatsappMessage','FaxInteraction','Fax','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','info','Trigger,\x20%s','error','code','catch','get','channel','event','direction','UserId','User','find','name','interface','format','incomingmessage','outgoingmessage','opened','closed','then','SIP/%s','default','length','hasOwnProperty','model','hook','callback','toLowerCase','util','../../mysqldb','jayson/promise','../logger','client'];(function(_0x45ae6b,_0x14a150){var _0x4903f3=function(_0xbfcc2b){while(--_0xbfcc2b){_0x45ae6b['push'](_0x45ae6b['shift']());}};_0x4903f3(++_0x14a150);}(_0x34f3,0x10e));var _0x334f=function(_0xfbc086,_0x47d086){_0xfbc086=_0xfbc086-0x0;var _0x1dce03=_0x34f3[_0xfbc086];return _0x1dce03;};'use strict';var util=require(_0x334f('0x0'));var db=require(_0x334f('0x1'))['db'];var jayson=require(_0x334f('0x2'));var logger=require(_0x334f('0x3'))('triggers');var client=jayson[_0x334f('0x4')][_0x334f('0x5')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x334f('0x6'),'event':_0x334f('0x7'),'condition':_0x334f('0x8'),'callback':afterCreate},{'channel':_0x334f('0x9'),'model':_0x334f('0x6'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x334f('0x9'),'model':'ChatMessage','event':_0x334f('0x7'),'condition':_0x334f('0xa'),'callback':afterCreateMessage},{'channel':_0x334f('0xb'),'model':_0x334f('0xc'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x334f('0xb'),'model':_0x334f('0xc'),'event':_0x334f('0xd'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x334f('0xb'),'model':'SmsMessage','event':_0x334f('0x7'),'condition':_0x334f('0xa'),'callback':afterCreateMessage},{'channel':_0x334f('0xe'),'model':'WhatsappInteraction','event':_0x334f('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x334f('0xe'),'model':'WhatsappInteraction','event':_0x334f('0xd'),'condition':_0x334f('0xf'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x334f('0x10'),'event':_0x334f('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Fax','model':_0x334f('0x11'),'event':_0x334f('0x7'),'condition':_0x334f('0x8'),'callback':afterCreate},{'channel':_0x334f('0x12'),'model':'FaxInteraction','event':_0x334f('0xd'),'condition':_0x334f('0xf'),'callback':afterUpdate},{'channel':_0x334f('0x12'),'model':'FaxMessage','event':_0x334f('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x334f('0x13'),'model':_0x334f('0x14'),'event':_0x334f('0x7'),'condition':_0x334f('0x8'),'callback':afterCreate},{'channel':'Mail','model':'MailInteraction','event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':'Mail','model':_0x334f('0x15'),'event':_0x334f('0x7'),'condition':_0x334f('0xa'),'callback':afterCreateMessage},{'channel':_0x334f('0x16'),'model':'OpenchannelInteraction','event':'afterCreate','condition':_0x334f('0x8'),'callback':afterCreate},{'channel':_0x334f('0x16'),'model':_0x334f('0x17'),'event':_0x334f('0xd'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x334f('0x16'),'model':_0x334f('0x18'),'event':_0x334f('0x7'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x356103){return client[_0x334f('0x19')](_0x334f('0x1a'),_0x356103)['then'](function(_0x58c258){logger[_0x334f('0x1b')](_0x334f('0x1c'),_0x334f('0x1a'),_0x58c258);if(_0x58c258['error']){if(_0x58c258[_0x334f('0x1d')][_0x334f('0x1e')]===0x1f4){logger['error'](_0x334f('0x1c'),_0x334f('0x1a'),_0x58c258[_0x334f('0x1d')]);}}})[_0x334f('0x1f')](function(_0x346c13){logger[_0x334f('0x1d')]('Trigger,\x20%s',_0x334f('0x1a'),_0x346c13);});}function afterCreateMessage(_0x49e7ee,_0x4afee0){return function(_0x286c08,_0x4bc53a){_0x286c08=_0x286c08[_0x334f('0x20')]({'plain':!![]});_0x286c08[_0x334f('0x21')]=_0x49e7ee;_0x286c08[_0x334f('0x22')]=_0x286c08[_0x334f('0x23')];if(_0x286c08[_0x334f('0x24')]){return db[_0x334f('0x25')][_0x334f('0x26')]({'where':{'id':_0x286c08[_0x334f('0x24')]},'attributes':['id',_0x334f('0x27')],'raw':!![]})['then'](function(_0x2a9221){_0x286c08[_0x334f('0x28')]=util[_0x334f('0x29')]('SIP/%s',_0x2a9221['name']);_0x286c08['channel']=_0x49e7ee;return request({'event':_0x334f('0x2a'),'message':_0x286c08});})[_0x334f('0x1f')](function(_0x5e8add){console[_0x334f('0x1d')](_0x5e8add);});}else{return request({'event':_0x334f('0x2b'),'message':_0x286c08});}};}function afterCreate(_0x10e77b,_0x235396){return function(_0x3187a2,_0x3231f7){_0x3187a2=_0x3187a2[_0x334f('0x20')]({'plain':!![]});_0x3187a2[_0x334f('0x21')]=_0x10e77b;_0x3187a2[_0x334f('0x22')]=_0x334f('0x2c');return request({'event':_0x235396,'message':_0x3187a2});};}function afterUpdate(_0x139279,_0x419b9e){return function(_0x1a5229,_0x4c7efb){if(_0x1a5229['changed'](_0x334f('0x2d'))&&_0x1a5229['closed']){_0x1a5229=_0x1a5229[_0x334f('0x20')]({'plain':!![]});_0x1a5229[_0x334f('0x21')]=_0x139279;_0x1a5229[_0x334f('0x22')]=_0x334f('0x2d');if(_0x1a5229['UserId']){return db[_0x334f('0x25')][_0x334f('0x26')]({'where':{'id':_0x1a5229['UserId']},'attributes':['id',_0x334f('0x27')],'raw':!![]})[_0x334f('0x2e')](function(_0x534fd7){_0x1a5229[_0x334f('0x28')]=util['format'](_0x334f('0x2f'),_0x534fd7['name']);return request({'event':_0x419b9e,'message':_0x1a5229});})[_0x334f('0x1f')](function(_0x38e0d2){console[_0x334f('0x1d')](_0x38e0d2);});}else{return request({'event':_0x419b9e,'message':_0x1a5229});}}};}exports[_0x334f('0x30')]=function(){for(var _0x523a96=0x0;_0x523a96=_0x170d1f[_0x7bef('0x16')]){throw Error(_0x7bef('0x17'));}_0x91d676(_0x4aaa7d);})['catch'](function(_0x937f50){_0x5ccd3c(_0x937f50);});});}; \ No newline at end of file +var _0x87f7=['Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','./license/util','mail','chat','sms','whatsapp','getChannels','toLowerCase','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','then','agents'];(function(_0x2887f7,_0x4a5a61){var _0x22fb2a=function(_0x1f093f){while(--_0x1f093f){_0x2887f7['push'](_0x2887f7['shift']());}};_0x22fb2a(++_0x4a5a61);}(_0x87f7,0x1e5));var _0x787f=function(_0x3204f9,_0x280488){_0x3204f9=_0x3204f9-0x0;var _0x280ce2=_0x87f7[_0x3204f9];return _0x280ce2;};'use strict';var _=require(_0x787f('0x0'));var BPromise=require(_0x787f('0x1'));var db=require('../mysqldb')['db'];var util=require(_0x787f('0x2'));var channels=['voice',_0x787f('0x3'),_0x787f('0x4'),'fax',_0x787f('0x5'),_0x787f('0x6'),'openchannel'];exports[_0x787f('0x7')]=function(){return channels;};exports['isValidChannel']=function(_0x210b6e){_0x210b6e=_0x210b6e[_0x787f('0x8')]();return _['includes'](channels,_0x210b6e);};exports[_0x787f('0x9')]=function(_0x53c07a,_0x1ee049,_0x154fe6,_0x511377){var _0x5d0da3={'loginAttempts':_0x1ee049,'blocked':_0x154fe6};if(!_[_0x787f('0xa')](_0x511377)){_0x5d0da3[_0x787f('0xb')]=_0x511377;}return _0x53c07a[_0x787f('0xc')](_0x5d0da3);};exports[_0x787f('0xd')]=function(_0x49c7d1){return new BPromise(function(_0x4ca006,_0x1aaa59){var _0x3033b0=0x0;if(_0x49c7d1[_0x787f('0xe')]!==_0x787f('0xf')){_0x4ca006(_0x49c7d1);}db[_0x787f('0x10')]['count']({'where':{'role':_0x787f('0xf'),'online':!![],'id':{'$ne':_0x49c7d1['id']}}})[_0x787f('0x11')](function(_0x1349d9){_0x3033b0=_0x1349d9;return util['getLicense']();})[_0x787f('0x11')](function(_0x4b3616){if(_0x4b3616&&_0x4b3616[_0x787f('0x12')]&&_0x3033b0>=_0x4b3616[_0x787f('0x12')]){throw Error(_0x787f('0x13'));}_0x4ca006(_0x49c7d1);})[_0x787f('0x14')](function(_0x439683){_0x1aaa59(_0x439683);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 90ff7dc..dabcd20 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x840a=['status','json','send','exports','404'];(function(_0xfec81c,_0x3f7f63){var _0x5d21f6=function(_0x2a0813){while(--_0x2a0813){_0xfec81c['push'](_0xfec81c['shift']());}};_0x5d21f6(++_0x3f7f63);}(_0x840a,0xbc));var _0xa840=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x840a[_0x2641f9];return _0x585741;};'use strict';module[_0xa840('0x0')][0x194]=function pageNotFound(_0x333de6,_0x55678c){var _0x5c9dca=_0xa840('0x1');var _0x13d37c=0x194;var _0x350249={'status':_0x13d37c};_0x55678c[_0xa840('0x2')](_0x350249[_0xa840('0x2')]);_0x55678c['render'](_0x5c9dca,{},function(_0x1d9cde,_0xc0c91f){if(_0x1d9cde){return _0x55678c['status'](_0x350249[_0xa840('0x2')])[_0xa840('0x3')](_0x350249);}_0x55678c[_0xa840('0x4')](_0xc0c91f);});}; \ No newline at end of file +var _0x7734=['status','render','send','exports'];(function(_0x2f99f7,_0x280c8c){var _0x3d6512=function(_0x49a842){while(--_0x49a842){_0x2f99f7['push'](_0x2f99f7['shift']());}};_0x3d6512(++_0x280c8c);}(_0x7734,0x17f));var _0x4773=function(_0x4346b3,_0x3ee38b){_0x4346b3=_0x4346b3-0x0;var _0x5d7b1f=_0x7734[_0x4346b3];return _0x5d7b1f;};'use strict';module[_0x4773('0x0')][0x194]=function pageNotFound(_0x23c76c,_0x422e4b){var _0x550759='404';var _0x34aaae=0x194;var _0x2e1e89={'status':_0x34aaae};_0x422e4b[_0x4773('0x1')](_0x2e1e89[_0x4773('0x1')]);_0x422e4b[_0x4773('0x2')](_0x550759,{},function(_0x4c3ceb,_0x5d6026){if(_0x4c3ceb){return _0x422e4b['status'](_0x2e1e89['status'])['json'](_0x2e1e89);}_0x422e4b[_0x4773('0x3')](_0x5d6026);});}; \ No newline at end of file diff --git a/server/migrations/2.5.27.js b/server/migrations/2.5.27.js new file mode 100644 index 0000000..92c836d --- /dev/null +++ b/server/migrations/2.5.27.js @@ -0,0 +1,165 @@ +'use strict'; + +var BPromise = require('bluebird'); +var util = require('util'); + +var logger = require('../config/logger')('migration'); + +var Sequence = function () { }; + +Sequence.prototype.enqueue = function (fn) { + this.tail = this.tail ? this.tail.finally(fn) : fn(); +}; + +var Migration = function (queryInterface) { + this.queryInterface = queryInterface; + this.sequence = new Sequence(); +}; + +Migration.prototype.changeColumn = function (table, column, type) { + var _this = this; + this.sequence.enqueue(function () { + return _this.queryInterface + .changeColumn(table, column, type) + .then(function () { + logger.info('Changed column %s in table %s', column, table); + }) + .catch(function (err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addColumn = function (table, column, type) { + var _this = this; + this.sequence.enqueue(function () { + return _this.queryInterface + .addColumn(table, column, type) + .then(function () { + logger.info('Added column %s to %s', column, table); + }) + .catch(function (err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.dropTable = function (table) { + var _this = this; + this.sequence.enqueue(function () { + return _this.queryInterface + .dropTable(table, { + force: true + }) + .then(function () { + logger.info('table dropped %s', table); + }) + .catch(function (err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addIndex = function (table, column, indexName) { + var _this = this; + this.sequence.enqueue(function () { + return _this.queryInterface + .addIndex(table, column, { + indexName: indexName + }) + .then(function () { + logger.info('addIndex %s %s %s', table, column.join(','), indexName); + }) + .catch(function (err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeIndex = function (table, indexName) { + var _this = this; + this.sequence.enqueue(function () { + return _this.queryInterface + .removeIndex(table, indexName) + .then(function () { + logger.info('removeIndex %s %s', table, indexName); + }) + .catch(function (err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.query = function (sql) { + var _this = this; + this.sequence.enqueue(function () { + return _this.queryInterface.sequelize + .query(sql) + .then(function () { + logger.info('query %s', sql); + }) + .catch(function (err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeColumn = function (table, column) { + var _this = this; + this.sequence.enqueue(function () { + return _this.queryInterface + .removeColumn(table, column) + .then(function () { + logger.info('Removed column %s from %s', column, table); + }) + .catch(function (err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null + }) + ); + }); + }); +}; + +Migration.prototype.renameColumn = function (table, oldColumn, newColumn) { + var _this = this; + this.sequence.enqueue(function () { + return _this.queryInterface + .renameColumn(table, oldColumn, newColumn) + .then(function () { + logger.info('Renamed column from %s to %s on %s', oldColumn, newColumn, table); + }) + .catch(function (err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null + }) + ); + }); + }); +}; + +Migration.prototype.final = function (resolve) { + this.sequence.enqueue(function () { + return resolve(); + }); +}; + +module.exports = { + up: function (queryInterface, Sequelize) { + return new BPromise(function (resolve) { + var migration = new Migration(queryInterface); + + // START FINAL + migration.final(resolve); + // END FINAL + }); + }, + + down: function (queryInterface, Sequelize) { + // var migration = new Migration(queryInterface); + } +}; diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 57e3a13..f10948d 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6975=['CompanyId','Company','cm_user_has_contacts','cm_contact_has_tags','OwnerId','CampaignId','Condition','All','OneAll','Any','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','ChatApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','fax_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','AllCondition','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','Variable','VariableId','SugarcrmAccount','Configurations','AccountId','DeskField','ZohoAccount','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskConfiguration','FreshdeskField','int_freshdesk_configuration_has_tags','ServicenowConfiguration','ServicenowField','FromId','ToId','SessionId','JscriptyProject','ProjectId','user_has_square_projects','VoiceQueues','SmsQueues','team_has_whatsapp_queues','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsAccountId','CustomFields','HopperHistory','Queues','voice_queues_has_cm_lists','UserProfileSection','Resources','WhatsappAccountId','WhatsappMessage','WhatsappApplication','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','path','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xcall','database','username','options','password','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','../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','../api/disposition/disposition.model','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','../api/cdr/cdr.model','Schedule','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Trigger','../api/trigger/trigger.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../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','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/chatTransferReport/chatTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','CmHopperFinal','HopperFinals','CmHopperHistory','OpenchannelInteractions','ChatInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','belongsTo','userProfileId','belongsToMany','ChatGroup','chat_group_has_users','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','OpenchannelInteraction','user_has_openchannel_interactions','MailQueues','FaxQueues','WhatsappQueue','WhatsappQueues','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopper','Hoppers','HopperHistories','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceMail','Messages','mailboxuser','mailbox','VoiceQueueReport','QueueCalls','AgentReports','uniqueid','Contact','MailServerIn','MailAccountId','Smtp','Dispositions','Interactions','List','Template','Agents','user_has_mail_accounts','team_has_mail_queues','MailMessage','Account','ContactId','Owner','Tags','mail_interaction_has_tags','MailInteractionId','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','restrict','IntervalId','TagId','ListId','Dashboard','Items','Answers','user_has_fax_accounts','FaxAccountId','ThroughTags','Users','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelApplication','OpenchannelQueue','OpenchannelInteractionId','openchannel_interaction_has_tags','ProactiveActions','Agent','ChatQueue','Queue','ChatQueueId','Website','ChatMessage','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','Contacts'];(function(_0x469ae2,_0x24cd30){var _0x5e33e4=function(_0x1aaeb1){while(--_0x1aaeb1){_0x469ae2['push'](_0x469ae2['shift']());}};_0x5e33e4(++_0x24cd30);}(_0x6975,0x69));var _0x5697=function(_0x25de09,_0x96ed5a){_0x25de09=_0x25de09-0x0;var _0x3eda1e=_0x6975[_0x25de09];return _0x3eda1e;};'use strict';var path=require(_0x5697('0x0'));var config=require(_0x5697('0x1'));var Sequelize=require(_0x5697('0x2'));var _=require(_0x5697('0x3'));var jstz=require(_0x5697('0x4'));var timezone=jstz[_0x5697('0x5')]();config[_0x5697('0x2')]=_[_0x5697('0x6')](config['sequelize'],{'database':_0x5697('0x7'),'username':'xcall','password':_0x5697('0x8'),'options':{'host':_0x5697('0x9'),'port':0xcea,'dialect':_0x5697('0xa'),'dialectOptions':{'charset':_0x5697('0xb')},'logging':![],'timezone':timezone[_0x5697('0xc')](),'define':{'charset':_0x5697('0xd'),'collate':_0x5697('0xe')}}});config[_0x5697('0xf')]=_[_0x5697('0x6')](config[_0x5697('0xf')],{'database':'motion2','username':_0x5697('0x10'),'password':_0x5697('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x5697('0xa'),'dialectOptions':{'charset':_0x5697('0xb')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x5697('0xd'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x5697('0x2')][_0x5697('0x11')],config[_0x5697('0x2')][_0x5697('0x12')],config[_0x5697('0x2')]['password'],config['sequelize'][_0x5697('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config[_0x5697('0xf')][_0x5697('0x12')],config[_0x5697('0xf')][_0x5697('0x14')],config['sequelizeHistory'][_0x5697('0x13')])};db[_0x5697('0x15')]=db['sequelize'][_0x5697('0x16')](_0x5697('0x17'));db[_0x5697('0x18')]=db['sequelize'][_0x5697('0x16')](_0x5697('0x19'));db[_0x5697('0x1a')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x1b'));db['VoiceExtension']=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x1c'));db[_0x5697('0x1d')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x1e'));db[_0x5697('0x1f')]=db[_0x5697('0x2')]['import']('../api/voiceQueue/voiceQueue.model');db[_0x5697('0x20')]=db['sequelize'][_0x5697('0x16')](_0x5697('0x21'));db[_0x5697('0x22')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x23'));db['VoiceMail']=db[_0x5697('0x2')]['import'](_0x5697('0x24'));db[_0x5697('0x25')]=db['sequelize'][_0x5697('0x16')](_0x5697('0x26'));db[_0x5697('0x27')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x28'));db[_0x5697('0x29')]=db[_0x5697('0x2')][_0x5697('0x16')]('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db[_0x5697('0x2')]['import'](_0x5697('0x2a'));db['VoiceQueueReport']=db[_0x5697('0x2')]['import'](_0x5697('0x2b'));db[_0x5697('0x2c')]=db[_0x5697('0x2')][_0x5697('0x16')]('../api/memberReport/memberReport.model');db[_0x5697('0x2d')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x2e'));db[_0x5697('0x2f')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x30'));db[_0x5697('0x31')]=db[_0x5697('0x2')]['import']('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x5697('0x32')]=db[_0x5697('0x2')][_0x5697('0x16')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x5697('0x33')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x34'));db[_0x5697('0x35')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x36'));db[_0x5697('0x37')]=db['sequelize'][_0x5697('0x16')](_0x5697('0x38'));db[_0x5697('0x39')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x3a'));db[_0x5697('0x3b')]=db['sequelize']['import'](_0x5697('0x3c'));db[_0x5697('0x3d')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x3e'));db['MailServerIn']=db['sequelize'][_0x5697('0x16')](_0x5697('0x3f'));db[_0x5697('0x40')]=db['sequelize'][_0x5697('0x16')](_0x5697('0x41'));db[_0x5697('0x42')]=db[_0x5697('0x2')][_0x5697('0x16')]('../api/mailAccount/mailAccount.model');db[_0x5697('0x43')]=db['sequelize'][_0x5697('0x16')](_0x5697('0x44'));db['MailSubstatus']=db[_0x5697('0x2')]['import'](_0x5697('0x45'));db[_0x5697('0x46')]=db[_0x5697('0x2')]['import'](_0x5697('0x47'));db['MailMessage']=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x48'));db[_0x5697('0x49')]=db[_0x5697('0x2')]['import'](_0x5697('0x4a'));db[_0x5697('0x4b')]=db[_0x5697('0x2')][_0x5697('0x16')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x4c'));db[_0x5697('0x4d')]=db[_0x5697('0x2')]['import'](_0x5697('0x4e'));db[_0x5697('0x4f')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x50'));db[_0x5697('0x51')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x52'));db[_0x5697('0x53')]=db[_0x5697('0x2')][_0x5697('0x16')]('../api/faxInteraction/faxInteraction.model');db[_0x5697('0x54')]=db[_0x5697('0x2')][_0x5697('0x16')]('../api/faxMessage/faxMessage.model');db[_0x5697('0x55')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x56'));db[_0x5697('0x57')]=db['sequelize']['import']('../api/faxQueueReport/faxQueueReport.model');db['SmsAccount']=db[_0x5697('0x2')]['import'](_0x5697('0x58'));db[_0x5697('0x59')]=db[_0x5697('0x2')][_0x5697('0x16')]('../api/smsApplication/smsApplication.model');db[_0x5697('0x5a')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x5b'));db[_0x5697('0x5c')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x5d'));db[_0x5697('0x5e')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x5f'));db[_0x5697('0x60')]=db['sequelize']['import'](_0x5697('0x61'));db['OpenchannelApplication']=db['sequelize']['import'](_0x5697('0x62'));db['OpenchannelInteraction']=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x63'));db['OpenchannelMessage']=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x64'));db['OpenchannelQueue']=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x65'));db[_0x5697('0x66')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x67'));db[_0x5697('0x68')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x69'));db[_0x5697('0x6a')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x6b'));db[_0x5697('0x6c')]=db['sequelize'][_0x5697('0x16')](_0x5697('0x6d'));db['ChatMessage']=db['sequelize'][_0x5697('0x16')](_0x5697('0x6e'));db['ChatOfflineMessage']=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x6f'));db['ChatQueue']=db[_0x5697('0x2')]['import'](_0x5697('0x70'));db['ChatGroup']=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x71'));db[_0x5697('0x72')]=db[_0x5697('0x2')][_0x5697('0x16')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x5697('0x73')]=db[_0x5697('0x2')]['import'](_0x5697('0x74'));db[_0x5697('0x75')]=db['sequelize']['import'](_0x5697('0x76'));db['CmHopper']=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x77'));db[_0x5697('0x78')]=db['sequelize']['import'](_0x5697('0x79'));db['CmHopperFinal']=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x7a'));db['CmHopperHistory']=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x7b'));db[_0x5697('0x7c')]=db['sequelize'][_0x5697('0x16')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x5697('0x7d')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x7e'));db[_0x5697('0x7f')]=db[_0x5697('0x2')]['import'](_0x5697('0x80'));db[_0x5697('0x81')]=db[_0x5697('0x2')]['import'](_0x5697('0x82'));db[_0x5697('0x83')]=db[_0x5697('0x2')]['import'](_0x5697('0x84'));db[_0x5697('0x85')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x86'));db['Condition']=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x87'));db[_0x5697('0x88')]=db[_0x5697('0x2')]['import']('../api/interval/interval.model');db[_0x5697('0x89')]=db['sequelize'][_0x5697('0x16')](_0x5697('0x8a'));db['Cdr']=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x8b'));db['VoiceQueuesLog']=db['sequelize'][_0x5697('0x16')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x5697('0x8c')]=db[_0x5697('0x2')][_0x5697('0x16')]('../api/schedule/schedule.model');db[_0x5697('0x8d')]=db['sequelize'][_0x5697('0x16')](_0x5697('0x8e'));db[_0x5697('0x8f')]=db['sequelize']['import'](_0x5697('0x90'));db['Template']=db[_0x5697('0x2')][_0x5697('0x16')]('../api/template/template.model');db[_0x5697('0x91')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x92'));db['Variable']=db['sequelize'][_0x5697('0x16')]('../api/variable/variable.model');db[_0x5697('0x93')]=db[_0x5697('0x2')]['import'](_0x5697('0x94'));db[_0x5697('0x95')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x96'));db[_0x5697('0x97')]=db[_0x5697('0x2')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db[_0x5697('0x98')]=db[_0x5697('0x2')][_0x5697('0x16')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x5697('0x99')]=db[_0x5697('0x2')]['import'](_0x5697('0x9a'));db[_0x5697('0x9b')]=db['sequelize'][_0x5697('0x16')]('../api/analyticMetric/analyticMetric.model');db[_0x5697('0x9c')]=db['sequelize']['import'](_0x5697('0x9d'));db[_0x5697('0x9e')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x9f'));db[_0x5697('0xa0')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xa1'));db[_0x5697('0xa2')]=db['sequelize'][_0x5697('0x16')](_0x5697('0xa3'));db[_0x5697('0xa4')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xa5'));db['SugarcrmAccount']=db[_0x5697('0x2')]['import'](_0x5697('0xa6'));db[_0x5697('0xa7')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xa8'));db[_0x5697('0xa9')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xaa'));db[_0x5697('0xab')]=db[_0x5697('0x2')]['import']('../api/intDeskAccount/intDeskAccount.model');db[_0x5697('0xac')]=db['sequelize'][_0x5697('0x16')]('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xad'));db['ZohoAccount']=db[_0x5697('0x2')]['import'](_0x5697('0xae'));db[_0x5697('0xaf')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xb0'));db[_0x5697('0xb1')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xb2'));db[_0x5697('0xb3')]=db[_0x5697('0x2')]['import'](_0x5697('0xb4'));db[_0x5697('0xb5')]=db[_0x5697('0x2')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xb6'));db[_0x5697('0xb7')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xb8'));db['FreshdeskConfiguration']=db[_0x5697('0x2')]['import'](_0x5697('0xb9'));db['FreshdeskField']=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xba'));db[_0x5697('0xbb')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xbc'));db[_0x5697('0xbd')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xbe'));db[_0x5697('0xbf')]=db[_0x5697('0x2')]['import']('../api/intVtigerField/intVtigerField.model');db[_0x5697('0xc0')]=db[_0x5697('0x2')][_0x5697('0x16')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xc1'));db['ServicenowField']=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xc2'));db[_0x5697('0xc3')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xc4'));db[_0x5697('0xc5')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xc6'));db[_0x5697('0xc7')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xc8'));db[_0x5697('0xc9')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xca'));db[_0x5697('0xcb')]=db['sequelize'][_0x5697('0x16')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x5697('0xcc')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xcd'));db[_0x5697('0x93')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0x94'));db[_0x5697('0xce')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xcf'));db[_0x5697('0xd0')]=db[_0x5697('0x2')][_0x5697('0x16')]('../api/chatQueueReport/chatQueueReport.model');db[_0x5697('0xd1')]=db['sequelize']['import'](_0x5697('0xd2'));db[_0x5697('0xd3')]=db[_0x5697('0x2')]['import']('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x5697('0xd4')]=db[_0x5697('0x2')]['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db['sequelize'][_0x5697('0x16')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x5697('0xd5')]=db[_0x5697('0x2')]['import'](_0x5697('0xd6'));db[_0x5697('0xd7')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xd8'));db[_0x5697('0xd9')]=db['sequelize']['import'](_0x5697('0xda'));db['JscriptyProject']=db['sequelize']['import'](_0x5697('0xdb'));db[_0x5697('0xdc')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xdd'));db[_0x5697('0xde')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xdf'));db['SquareProject']=db[_0x5697('0x2')]['import']('../api/squareProject/squareProject.model');db[_0x5697('0xe0')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xe1'));db[_0x5697('0xe2')]=db[_0x5697('0x2')]['import'](_0x5697('0xe3'));db[_0x5697('0xe4')]=db[_0x5697('0x2')]['import']('../api/team/team.model');db[_0x5697('0xe5')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xe6'));db[_0x5697('0xe7')]=db['sequelize'][_0x5697('0x16')](_0x5697('0xe8'));db[_0x5697('0xe9')]=db[_0x5697('0x2')]['import']('../api/migration/migration.model');db[_0x5697('0xea')]=db['sequelize'][_0x5697('0x16')](_0x5697('0xeb'));db[_0x5697('0xec')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xed'));db['MailTransferReport']=db['sequelize'][_0x5697('0x16')]('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db['sequelize']['import'](_0x5697('0xee'));db['FaxTransferReport']=db[_0x5697('0x2')][_0x5697('0x16')]('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db['sequelize'][_0x5697('0x16')](_0x5697('0xef'));db['SmsTransferReport']=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xf0'));db[_0x5697('0xf1')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xf2'));db[_0x5697('0xf3')]=db['sequelize']['import'](_0x5697('0xf4'));db[_0x5697('0xf5')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xf6'));db['UserProfileSection']=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xf7'));db[_0x5697('0xf8')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xf9'));db[_0x5697('0xfa')]=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xfb'));db[_0x5697('0xfc')]=db[_0x5697('0x2')][_0x5697('0x16')]('../api/whatsappAccount/whatsappAccount.model');db['WhatsappApplication']=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xfd'));db[_0x5697('0xfe')]=db[_0x5697('0x2')][_0x5697('0x16')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0x5697('0x2')][_0x5697('0x16')](_0x5697('0xff'));db[_0x5697('0x100')]=db[_0x5697('0x2')][_0x5697('0x16')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x5697('0x101')]=db[_0x5697('0x2')]['import'](_0x5697('0x102'));db['WhatsappQueue']=db[_0x5697('0x2')]['import'](_0x5697('0x103'));db[_0x5697('0x104')]=db[_0x5697('0x2')][_0x5697('0x16')]('../api/cloudProvider/cloudProvider.model');db[_0x5697('0x105')]=db['sequelize']['import'](_0x5697('0x106'));db['User'][_0x5697('0x107')](db['VoiceMail'],{'as':'VoiceMail','onDelete':_0x5697('0x108'),'foreignKey':_0x5697('0x109')});db['User'][_0x5697('0x10a')](db[_0x5697('0x20')],{'as':_0x5697('0x10b'),'foreignKey':_0x5697('0x109')});db[_0x5697('0x15')][_0x5697('0x10a')](db['UserVoiceQueueRt'],{'as':_0x5697('0x10c'),'foreignKey':_0x5697('0x109')});db[_0x5697('0x15')][_0x5697('0x10a')](db[_0x5697('0x10d')],{'as':_0x5697('0x10e'),'onDelete':_0x5697('0x108'),'hooks':!![]});db[_0x5697('0x15')][_0x5697('0x10a')](db[_0x5697('0x10f')],{'as':_0x5697('0x110'),'foreignKey':'UserId'});db['User'][_0x5697('0x10a')](db[_0x5697('0x111')],{'as':'HopperHistory','foreignKey':_0x5697('0x109')});db[_0x5697('0x15')][_0x5697('0x10a')](db[_0x5697('0x7c')],{'as':_0x5697('0x7c'),'foreignKey':'UserId'});db[_0x5697('0x15')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x5697('0x112'),'foreignKey':_0x5697('0x109')});db['User']['hasMany'](db['ChatInteraction'],{'as':_0x5697('0x113'),'foreignKey':_0x5697('0x109')});db[_0x5697('0x15')]['hasMany'](db[_0x5697('0x5a')],{'as':'SmsInteractions','foreignKey':'UserId'});db[_0x5697('0x15')][_0x5697('0x10a')](db[_0x5697('0x53')],{'as':_0x5697('0x114'),'foreignKey':_0x5697('0x109')});db[_0x5697('0x15')][_0x5697('0x10a')](db[_0x5697('0x46')],{'as':_0x5697('0x115'),'foreignKey':_0x5697('0x109')});db[_0x5697('0x15')][_0x5697('0x10a')](db['WhatsappInteraction'],{'as':_0x5697('0x116'),'foreignKey':_0x5697('0x109')});db['User'][_0x5697('0x10a')](db[_0x5697('0xfa')],{'as':_0x5697('0x117'),'foreignKey':'SenderId'});db[_0x5697('0x15')][_0x5697('0x118')](db['UserProfile'],{'as':_0x5697('0xf5'),'foreignKey':_0x5697('0x119')});db[_0x5697('0x15')][_0x5697('0x11a')](db[_0x5697('0x11b')],{'as':'Groups','through':_0x5697('0x11c')});db[_0x5697('0x15')]['belongsToMany'](db['CmContact'],{'as':'Contacts','through':'cm_user_has_contacts'});db['User'][_0x5697('0x11a')](db[_0x5697('0xf1')],{'as':_0x5697('0x11d'),'through':_0x5697('0x11e')});db[_0x5697('0x15')][_0x5697('0x11a')](db['Team'],{'through':_0x5697('0x11f')});db['User'][_0x5697('0x11a')](db[_0x5697('0x46')],{'as':_0x5697('0x115'),'through':_0x5697('0x120')});db[_0x5697('0x15')]['belongsToMany'](db[_0x5697('0x6c')],{'as':_0x5697('0x113'),'through':_0x5697('0x121')});db[_0x5697('0x15')]['belongsToMany'](db['FaxInteraction'],{'as':'FaxInteractions','through':_0x5697('0x122')});db[_0x5697('0x15')][_0x5697('0x11a')](db[_0x5697('0x5a')],{'as':_0x5697('0x123'),'through':_0x5697('0x124')});db[_0x5697('0x15')][_0x5697('0x11a')](db[_0x5697('0x125')],{'as':_0x5697('0x112'),'through':_0x5697('0x126')});db[_0x5697('0x15')][_0x5697('0x11a')](db[_0x5697('0xfe')],{'as':_0x5697('0x116'),'through':'user_has_whatsapp_interactions'});db[_0x5697('0x15')][_0x5697('0x11a')](db[_0x5697('0x1f')],{'as':'VoiceQueues','through':_0x5697('0x32'),'required':![]});db[_0x5697('0x15')][_0x5697('0x11a')](db[_0x5697('0x43')],{'as':_0x5697('0x127'),'through':_0x5697('0x35'),'required':![]});db['User']['belongsToMany'](db['ChatQueue'],{'as':'ChatQueues','through':_0x5697('0x33'),'required':![],'hooks':!![]});db[_0x5697('0x15')]['belongsToMany'](db['FaxQueue'],{'as':_0x5697('0x128'),'through':'UserFaxQueue','required':![]});db['User'][_0x5697('0x11a')](db[_0x5697('0x5e')],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db[_0x5697('0x15')][_0x5697('0x11a')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':_0x5697('0x3b'),'required':![]});db[_0x5697('0x15')][_0x5697('0x11a')](db[_0x5697('0x129')],{'as':_0x5697('0x12a'),'through':'UserWhatsappQueue','required':![]});db[_0x5697('0x15')][_0x5697('0x11a')](db[_0x5697('0xf1')],{'through':'cm_user_has_lists'});db['User'][_0x5697('0x11a')](db[_0x5697('0xf3')],{'as':'VoicePrefixes','through':_0x5697('0x12b'),'required':![]});db[_0x5697('0x15')][_0x5697('0x11a')](db['ChatWebsite'],{'as':_0x5697('0x12c'),'through':_0x5697('0x12d')});db[_0x5697('0x15')]['belongsToMany'](db['FaxAccount'],{'as':_0x5697('0x12e'),'through':'user_has_fax_accounts'});db['User'][_0x5697('0x11a')](db['MailAccount'],{'as':_0x5697('0x12f'),'through':'user_has_mail_accounts'});db[_0x5697('0x15')]['belongsToMany'](db[_0x5697('0x60')],{'as':_0x5697('0x130'),'through':_0x5697('0x131')});db[_0x5697('0x15')][_0x5697('0x11a')](db[_0x5697('0x132')],{'as':_0x5697('0x133'),'through':'user_has_sms_accounts'});db[_0x5697('0x15')][_0x5697('0x11a')](db[_0x5697('0xfc')],{'as':_0x5697('0x134'),'through':_0x5697('0x135')});db[_0x5697('0x15')]['belongsToMany'](db[_0x5697('0x136')],{'as':_0x5697('0x137'),'through':'user_has_square_projects'});db[_0x5697('0x18')][_0x5697('0x10a')](db[_0x5697('0x10d')],{'as':_0x5697('0x138'),'onDelete':_0x5697('0x108'),'foreignKey':_0x5697('0x139')});db[_0x5697('0x1a')]['hasMany'](db[_0x5697('0x10d')],{'onDelete':_0x5697('0x108')});db[_0x5697('0x10d')][_0x5697('0x10a')](db[_0x5697('0x10d')],{'as':_0x5697('0x13a'),'onDelete':_0x5697('0x108')});db['VoiceMusicOnHold']['belongsToMany'](db['Sound'],{'as':_0x5697('0x13b'),'through':_0x5697('0x13c')});db['VoiceQueue'][_0x5697('0x10a')](db['UserVoiceQueueRt'],{'as':_0x5697('0x13d'),'foreignKey':_0x5697('0x13e')});db[_0x5697('0x1f')]['hasMany'](db[_0x5697('0x13f')],{'as':_0x5697('0x140'),'foreignKey':_0x5697('0x13e')});db[_0x5697('0x1f')][_0x5697('0x10a')](db[_0x5697('0x10f')],{'as':_0x5697('0x110'),'foreignKey':_0x5697('0x13e')});db[_0x5697('0x1f')][_0x5697('0x10a')](db[_0x5697('0x111')],{'as':_0x5697('0x141'),'foreignKey':'VoiceQueueId'});db[_0x5697('0x1f')][_0x5697('0x10a')](db[_0x5697('0x7c')],{'as':'ReportAgentPreview','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x5697('0x10a')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x5697('0x13e')});db[_0x5697('0x1f')][_0x5697('0x10a')](db[_0x5697('0x142')],{'as':_0x5697('0x143'),'foreignKey':_0x5697('0x13e')});db[_0x5697('0x1f')][_0x5697('0x118')](db[_0x5697('0x2d')],{'as':_0x5697('0x2d'),'foreignKey':_0x5697('0x144')});db['VoiceQueue'][_0x5697('0x118')](db[_0x5697('0x2d')],{'as':_0x5697('0x145'),'foreignKey':_0x5697('0x146')});db[_0x5697('0x1f')][_0x5697('0x118')](db[_0x5697('0x88')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x5697('0x1f')][_0x5697('0x118')](db['Pause'],{'as':_0x5697('0x147'),'foreignKey':_0x5697('0x148')});db[_0x5697('0x1f')][_0x5697('0x11a')](db['CmList'],{'as':'Lists','through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0x5697('0x11a')](db[_0x5697('0x15')],{'as':'Agents','through':_0x5697('0x32')});db[_0x5697('0x1f')][_0x5697('0x11a')](db[_0x5697('0xe4')],{'as':_0x5697('0x149'),'through':_0x5697('0x105')});db[_0x5697('0x1f')]['belongsToMany'](db[_0x5697('0xf1')],{'as':_0x5697('0x14a'),'through':_0x5697('0x14b')});db[_0x5697('0x20')][_0x5697('0x118')](db[_0x5697('0x15')],{'as':_0x5697('0x15'),'foreignKey':_0x5697('0x109')});db[_0x5697('0x22')][_0x5697('0x118')](db[_0x5697('0x15')],{'as':_0x5697('0x15'),'foreignKey':_0x5697('0x109')});db[_0x5697('0x14c')][_0x5697('0x10a')](db[_0x5697('0x25')],{'as':_0x5697('0x14d'),'onDelete':_0x5697('0x108'),'foreignKey':_0x5697('0x14e'),'sourceKey':'mailbox'});db[_0x5697('0x25')][_0x5697('0x118')](db[_0x5697('0x14c')],{'foreignKey':_0x5697('0x14e'),'targetKey':_0x5697('0x14f')});db[_0x5697('0x27')][_0x5697('0x10a')](db[_0x5697('0x150')],{'as':_0x5697('0x151'),'foreignKey':'uniqueid','constraints':![]});db[_0x5697('0x27')][_0x5697('0x10a')](db['VoiceAgentReport'],{'as':_0x5697('0x152'),'foreignKey':_0x5697('0x153'),'constraints':![]});db[_0x5697('0x27')][_0x5697('0x118')](db['User'],{'as':'User','foreignKey':'UserId'});db['VoiceCallReport']['belongsTo'](db['CmContact'],{'as':_0x5697('0x154'),'foreignKey':'ContactId'});db[_0x5697('0x155')][_0x5697('0x118')](db[_0x5697('0x42')],{'as':_0x5697('0x42'),'foreignKey':_0x5697('0x156')});db[_0x5697('0x40')][_0x5697('0x118')](db['MailAccount'],{'as':_0x5697('0x42'),'foreignKey':'MailAccountId'});db[_0x5697('0x42')][_0x5697('0x107')](db[_0x5697('0x155')],{'as':'Imap','onDelete':_0x5697('0x108')});db[_0x5697('0x42')][_0x5697('0x107')](db['MailServerOut'],{'as':_0x5697('0x157'),'onDelete':_0x5697('0x108')});db[_0x5697('0x42')]['hasMany'](db[_0x5697('0x85')],{'as':_0x5697('0x158'),'foreignKey':_0x5697('0x156')});db[_0x5697('0x42')][_0x5697('0x10a')](db[_0x5697('0x83')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0x5697('0x42')][_0x5697('0x10a')](db['MailMessage'],{'as':_0x5697('0x14d'),'foreignKey':_0x5697('0x156')});db[_0x5697('0x42')]['hasMany'](db[_0x5697('0x46')],{'as':_0x5697('0x159')});db[_0x5697('0x42')][_0x5697('0x10a')](db[_0x5697('0x49')],{'as':_0x5697('0x13a')});db[_0x5697('0x42')][_0x5697('0x118')](db[_0x5697('0xf1')],{'as':_0x5697('0x15a'),'foreignKey':'ListId'});db[_0x5697('0x42')][_0x5697('0x118')](db[_0x5697('0x15b')],{'as':'Template','foreignKey':'TemplateId'});db[_0x5697('0x42')][_0x5697('0x118')](db[_0x5697('0x89')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x5697('0x42')][_0x5697('0x11a')](db[_0x5697('0x15')],{'as':_0x5697('0x15c'),'through':_0x5697('0x15d')});db[_0x5697('0x43')][_0x5697('0x11a')](db[_0x5697('0x15')],{'as':'Agents','through':_0x5697('0x35')});db[_0x5697('0x43')][_0x5697('0x11a')](db[_0x5697('0xe4')],{'through':_0x5697('0x15e'),'as':'Teams'});db[_0x5697('0x46')][_0x5697('0x10a')](db[_0x5697('0x15f')],{'as':'Messages','onDelete':'cascade','foreignKey':'MailInteractionId'});db['MailInteraction'][_0x5697('0x118')](db[_0x5697('0x42')],{'as':_0x5697('0x160'),'foreignKey':_0x5697('0x156')});db[_0x5697('0x46')][_0x5697('0x118')](db[_0x5697('0x75')],{'as':'Contact','foreignKey':_0x5697('0x161')});db[_0x5697('0x46')]['belongsTo'](db[_0x5697('0x15')],{'as':_0x5697('0x162'),'foreignKey':_0x5697('0x109')});db[_0x5697('0x46')]['belongsToMany'](db[_0x5697('0x8f')],{'through':'mail_interaction_has_tags','as':_0x5697('0x163')});db['MailInteraction'][_0x5697('0x11a')](db['Tag'],{'through':_0x5697('0x164'),'as':'ThroughTags'});db[_0x5697('0x46')]['belongsToMany'](db[_0x5697('0x15')],{'as':'Users','through':_0x5697('0x120'),'foreignKey':_0x5697('0x165')});db[_0x5697('0x15f')]['hasMany'](db[_0x5697('0xea')],{'as':_0x5697('0x166'),'onDelete':_0x5697('0x108')});db[_0x5697('0x15f')][_0x5697('0x118')](db[_0x5697('0x15')],{'as':_0x5697('0x15')});db[_0x5697('0x15f')]['belongsTo'](db[_0x5697('0x75')],{'onDelete':'cascade','as':_0x5697('0x154')});db[_0x5697('0x15f')][_0x5697('0x118')](db[_0x5697('0x46')],{'as':_0x5697('0x167'),'foreignKey':_0x5697('0x165')});db[_0x5697('0x15f')][_0x5697('0x118')](db[_0x5697('0x42')],{'as':_0x5697('0x160'),'foreignKey':_0x5697('0x156')});db[_0x5697('0x15f')][_0x5697('0x118')](db[_0x5697('0x66')],{'as':'ChatWebsite','foreignKey':_0x5697('0x168')});db['MailMessage'][_0x5697('0x118')](db[_0x5697('0x169')],{'as':_0x5697('0x169'),'foreignKey':_0x5697('0x16a')});db[_0x5697('0x49')][_0x5697('0x118')](db[_0x5697('0x15')],{'onDelete':_0x5697('0x16b')});db['MailApplication'][_0x5697('0x118')](db['MailQueue'],{'onDelete':_0x5697('0x16b')});db['MailApplication'][_0x5697('0x118')](db['MailAccount'],{'onDelete':'restrict'});db['MailApplication']['belongsTo'](db[_0x5697('0x88')],{'onDelete':_0x5697('0x16b'),'foreignKey':_0x5697('0x16c')});db['MailApplication']['belongsTo'](db[_0x5697('0x8f')],{'onDelete':'restrict','foreignKey':_0x5697('0x16d')});db[_0x5697('0x4b')][_0x5697('0x118')](db[_0x5697('0x42')],{});db[_0x5697('0x4b')]['belongsTo'](db[_0x5697('0xf1')],{'as':'List','foreignKey':_0x5697('0x16e')});db['MailQueueReport'][_0x5697('0x118')](db[_0x5697('0x75')],{'as':_0x5697('0x154'),'foreignKey':_0x5697('0x161')});db[_0x5697('0x4b')][_0x5697('0x118')](db['MailInteraction'],{});db[_0x5697('0x4b')]['belongsTo'](db['MailMessage'],{});db[_0x5697('0x4b')][_0x5697('0x118')](db[_0x5697('0x15')],{});db[_0x5697('0x4b')][_0x5697('0x118')](db[_0x5697('0x43')],{});db[_0x5697('0x16f')]['hasMany'](db[_0x5697('0x4d')],{'as':_0x5697('0x170'),'onDelete':_0x5697('0x108')});db[_0x5697('0x4f')][_0x5697('0x10a')](db[_0x5697('0x85')],{'as':'Dispositions','foreignKey':'FaxAccountId'});db[_0x5697('0x4f')]['hasMany'](db[_0x5697('0x83')],{'as':_0x5697('0x171'),'foreignKey':'FaxAccountId'});db[_0x5697('0x4f')][_0x5697('0x10a')](db['FaxInteraction'],{'as':'Interactions'});db[_0x5697('0x4f')][_0x5697('0x10a')](db[_0x5697('0x51')],{'as':_0x5697('0x13a')});db[_0x5697('0x4f')][_0x5697('0x10a')](db['VoiceExtension'],{'as':'Exntensions','onDelete':_0x5697('0x108')});db[_0x5697('0x4f')][_0x5697('0x10a')](db[_0x5697('0x54')],{'as':_0x5697('0x14d')});db[_0x5697('0x4f')][_0x5697('0x118')](db['Trunk'],{'as':'Trunk'});db[_0x5697('0x4f')][_0x5697('0x118')](db[_0x5697('0xf1')],{'as':_0x5697('0x15a'),'foreignKey':_0x5697('0x16e')});db[_0x5697('0x4f')]['belongsTo'](db[_0x5697('0x89')],{'as':_0x5697('0x147'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x5697('0x4f')][_0x5697('0x11a')](db[_0x5697('0x15')],{'as':_0x5697('0x15c'),'through':_0x5697('0x172')});db[_0x5697('0x51')][_0x5697('0x118')](db[_0x5697('0x15')],{'onDelete':_0x5697('0x16b')});db[_0x5697('0x51')][_0x5697('0x118')](db[_0x5697('0x55')],{'onDelete':_0x5697('0x16b')});db[_0x5697('0x51')][_0x5697('0x118')](db[_0x5697('0x4f')],{'onDelete':_0x5697('0x16b')});db[_0x5697('0x51')][_0x5697('0x118')](db[_0x5697('0x8f')],{'onDelete':_0x5697('0x16b'),'foreignKey':_0x5697('0x16d')});db[_0x5697('0x53')][_0x5697('0x10a')](db['FaxMessage'],{'as':_0x5697('0x14d'),'onDelete':'cascade','foreignKey':'FaxInteractionId'});db[_0x5697('0x53')]['belongsTo'](db[_0x5697('0x4f')],{'as':_0x5697('0x160'),'foreignKey':_0x5697('0x173')});db['FaxInteraction']['belongsTo'](db[_0x5697('0x75')],{'as':'Contact','foreignKey':_0x5697('0x161')});db[_0x5697('0x53')][_0x5697('0x118')](db[_0x5697('0x15')],{'as':'Owner','foreignKey':'UserId'});db[_0x5697('0x53')][_0x5697('0x11a')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0x5697('0x163')});db[_0x5697('0x53')][_0x5697('0x11a')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0x5697('0x174')});db['FaxInteraction'][_0x5697('0x11a')](db['User'],{'as':_0x5697('0x175'),'through':_0x5697('0x122'),'foreignKey':_0x5697('0x176')});db[_0x5697('0x54')][_0x5697('0x118')](db[_0x5697('0x15')],{'onDelete':_0x5697('0x108'),'as':_0x5697('0x15')});db[_0x5697('0x54')][_0x5697('0x118')](db[_0x5697('0x53')],{'as':_0x5697('0x167'),'foreignKey':_0x5697('0x176')});db['FaxMessage']['belongsTo'](db[_0x5697('0x75')],{'onDelete':_0x5697('0x108'),'as':_0x5697('0x154')});db[_0x5697('0x54')][_0x5697('0x118')](db[_0x5697('0xea')],{'as':'Attachment','foreignKey':_0x5697('0x177')});db[_0x5697('0x54')][_0x5697('0x118')](db[_0x5697('0x4f')],{'as':_0x5697('0x160'),'foreignKey':_0x5697('0x173')});db[_0x5697('0x55')]['belongsToMany'](db['User'],{'as':_0x5697('0x15c'),'through':'UserFaxQueue'});db[_0x5697('0x55')][_0x5697('0x11a')](db['Team'],{'through':_0x5697('0x178'),'as':_0x5697('0x149')});db['FaxQueueReport']['belongsTo'](db[_0x5697('0x4f')],{});db['FaxQueueReport'][_0x5697('0x118')](db[_0x5697('0xf1')],{'as':_0x5697('0x15a'),'foreignKey':_0x5697('0x16e')});db['FaxQueueReport'][_0x5697('0x118')](db[_0x5697('0x75')],{'as':_0x5697('0x154'),'foreignKey':_0x5697('0x161')});db[_0x5697('0x57')]['belongsTo'](db[_0x5697('0x53')],{});db[_0x5697('0x57')][_0x5697('0x118')](db[_0x5697('0x54')],{});db[_0x5697('0x57')][_0x5697('0x118')](db[_0x5697('0x15')],{});db['FaxQueueReport'][_0x5697('0x118')](db['FaxQueue'],{});db['SmsAccount'][_0x5697('0x10a')](db['Disposition'],{'as':_0x5697('0x158'),'foreignKey':'SmsAccountId'});db[_0x5697('0x132')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x5697('0x179')});db[_0x5697('0x132')][_0x5697('0x10a')](db[_0x5697('0x5c')],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0x5697('0x132')]['hasMany'](db['SmsInteraction'],{'as':_0x5697('0x159')});db['SmsAccount'][_0x5697('0x10a')](db[_0x5697('0x59')],{'as':_0x5697('0x13a')});db['SmsAccount'][_0x5697('0x118')](db[_0x5697('0xf1')],{'as':_0x5697('0x15a'),'foreignKey':_0x5697('0x16e')});db[_0x5697('0x132')][_0x5697('0x118')](db[_0x5697('0x89')],{'as':_0x5697('0x147'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x5697('0x132')][_0x5697('0x11a')](db[_0x5697('0x15')],{'as':_0x5697('0x15c'),'through':'user_has_sms_accounts'});db[_0x5697('0x59')]['belongsTo'](db[_0x5697('0x15')],{'onDelete':_0x5697('0x16b')});db[_0x5697('0x59')][_0x5697('0x118')](db[_0x5697('0x5e')],{'onDelete':'restrict'});db[_0x5697('0x59')][_0x5697('0x118')](db[_0x5697('0x132')],{'onDelete':'restrict'});db['SmsApplication']['belongsTo'](db['Interval'],{'onDelete':_0x5697('0x16b'),'foreignKey':_0x5697('0x16c')});db[_0x5697('0x59')][_0x5697('0x118')](db[_0x5697('0x8f')],{'onDelete':_0x5697('0x16b'),'foreignKey':'TagId'});db[_0x5697('0x5a')][_0x5697('0x10a')](db['SmsMessage'],{'as':_0x5697('0x14d'),'onDelete':'cascade','foreignKey':_0x5697('0x17a')});db[_0x5697('0x5a')][_0x5697('0x118')](db[_0x5697('0x132')],{'as':_0x5697('0x160'),'foreignKey':_0x5697('0x179')});db[_0x5697('0x5a')][_0x5697('0x118')](db['CmContact'],{'as':_0x5697('0x154'),'foreignKey':_0x5697('0x161')});db[_0x5697('0x5a')][_0x5697('0x118')](db['User'],{'as':'Owner','foreignKey':_0x5697('0x109')});db[_0x5697('0x5a')][_0x5697('0x11a')](db[_0x5697('0x8f')],{'through':_0x5697('0x17b'),'as':_0x5697('0x163')});db[_0x5697('0x5a')][_0x5697('0x11a')](db[_0x5697('0x8f')],{'through':_0x5697('0x17b'),'as':_0x5697('0x174')});db['SmsInteraction'][_0x5697('0x11a')](db[_0x5697('0x15')],{'as':_0x5697('0x175'),'through':_0x5697('0x124'),'foreignKey':_0x5697('0x17a')});db['SmsMessage']['belongsTo'](db[_0x5697('0x15')],{'as':_0x5697('0x15')});db['SmsMessage'][_0x5697('0x118')](db[_0x5697('0x75')],{'onDelete':_0x5697('0x108'),'as':_0x5697('0x154')});db[_0x5697('0x5c')][_0x5697('0x118')](db[_0x5697('0x5a')],{'onDelete':_0x5697('0x108'),'as':_0x5697('0x167'),'foreignKey':_0x5697('0x17a')});db[_0x5697('0x5c')][_0x5697('0x118')](db[_0x5697('0x132')],{'as':'Account','foreignKey':_0x5697('0x179')});db[_0x5697('0x5e')][_0x5697('0x11a')](db[_0x5697('0x15')],{'as':_0x5697('0x15c'),'through':_0x5697('0x39'),'foreignKey':_0x5697('0x17c')});db[_0x5697('0x5e')][_0x5697('0x11a')](db['Team'],{'through':_0x5697('0x17d'),'as':_0x5697('0x149')});db['OpenchannelAccount']['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x5697('0x10a')](db[_0x5697('0x83')],{'as':_0x5697('0x171'),'foreignKey':'OpenchannelAccountId'});db[_0x5697('0x60')][_0x5697('0x10a')](db[_0x5697('0x125')],{'as':_0x5697('0x159'),'foreignKey':_0x5697('0x17e')});db[_0x5697('0x60')][_0x5697('0x10a')](db[_0x5697('0x17f')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db[_0x5697('0x60')][_0x5697('0x10a')](db[_0x5697('0x180')],{'as':_0x5697('0x13a'),'foreignKey':_0x5697('0x17e')});db[_0x5697('0x60')]['belongsTo'](db[_0x5697('0xf1')],{'as':_0x5697('0x15a'),'foreignKey':'ListId'});db['OpenchannelAccount'][_0x5697('0x118')](db[_0x5697('0x89')],{'as':_0x5697('0x147'),'foreignKey':_0x5697('0x148')});db[_0x5697('0x60')]['belongsToMany'](db['User'],{'as':_0x5697('0x15c'),'through':_0x5697('0x131')});db['OpenchannelApplication'][_0x5697('0x118')](db[_0x5697('0x15')],{'onDelete':_0x5697('0x16b')});db['OpenchannelApplication']['belongsTo'](db[_0x5697('0x181')],{'onDelete':_0x5697('0x16b'),'foreignKey':'OpenchannelQueueId'});db[_0x5697('0x180')]['belongsTo'](db[_0x5697('0x60')],{'onDelete':_0x5697('0x16b'),'foreignKey':_0x5697('0x17e')});db['OpenchannelApplication']['belongsTo'](db[_0x5697('0x88')],{'onDelete':_0x5697('0x16b'),'foreignKey':_0x5697('0x16c')});db[_0x5697('0x180')]['belongsTo'](db['Tag'],{'onDelete':_0x5697('0x16b'),'foreignKey':_0x5697('0x16d')});db[_0x5697('0x125')]['hasMany'](db[_0x5697('0x17f')],{'as':_0x5697('0x14d'),'onDelete':_0x5697('0x108'),'foreignKey':_0x5697('0x182')});db[_0x5697('0x125')][_0x5697('0x118')](db['OpenchannelAccount'],{'as':_0x5697('0x160'),'foreignKey':_0x5697('0x17e')});db[_0x5697('0x125')]['belongsTo'](db[_0x5697('0x75')],{'as':'Contact','foreignKey':'ContactId'});db[_0x5697('0x125')]['belongsTo'](db[_0x5697('0x15')],{'as':_0x5697('0x162'),'foreignKey':_0x5697('0x109')});db[_0x5697('0x125')][_0x5697('0x11a')](db[_0x5697('0x8f')],{'through':_0x5697('0x183'),'as':'Tags'});db['OpenchannelInteraction'][_0x5697('0x11a')](db['Tag'],{'through':_0x5697('0x183'),'as':_0x5697('0x174')});db[_0x5697('0x125')]['belongsToMany'](db[_0x5697('0x15')],{'as':'Users','through':'user_has_openchannel_interactions','foreignKey':_0x5697('0x182')});db[_0x5697('0x17f')][_0x5697('0x118')](db[_0x5697('0x15')],{'onDelete':_0x5697('0x108'),'as':_0x5697('0x15')});db[_0x5697('0x17f')]['belongsTo'](db['CmContact'],{'onDelete':_0x5697('0x108'),'as':_0x5697('0x154')});db['OpenchannelMessage']['belongsTo'](db[_0x5697('0x125')],{'onDelete':_0x5697('0x108'),'as':_0x5697('0x167'),'foreignKey':'OpenchannelInteractionId'});db[_0x5697('0x17f')][_0x5697('0x118')](db[_0x5697('0xea')],{'as':_0x5697('0xea'),'foreignKey':_0x5697('0x177')});db[_0x5697('0x17f')][_0x5697('0x118')](db['OpenchannelAccount'],{'as':_0x5697('0x160'),'foreignKey':_0x5697('0x17e')});db[_0x5697('0x181')][_0x5697('0x11a')](db['User'],{'as':_0x5697('0x15c'),'through':_0x5697('0x3b'),'foreignKey':'OpenchannelQueueId'});db[_0x5697('0x181')][_0x5697('0x11a')](db[_0x5697('0xe4')],{'through':'team_has_openchannel_queues','as':_0x5697('0x149')});db[_0x5697('0x66')]['hasMany'](db[_0x5697('0x85')],{'as':_0x5697('0x158'),'foreignKey':_0x5697('0x168')});db['ChatWebsite']['hasMany'](db[_0x5697('0x83')],{'as':_0x5697('0x171'),'foreignKey':_0x5697('0x168')});db[_0x5697('0x66')][_0x5697('0x10a')](db['ChatProactiveAction'],{'as':_0x5697('0x184')});db[_0x5697('0x66')]['hasMany'](db[_0x5697('0x6c')],{'as':'Interactions'});db['ChatWebsite'][_0x5697('0x10a')](db[_0x5697('0x6a')],{'as':_0x5697('0x13a')});db[_0x5697('0x66')][_0x5697('0x10a')](db['ChatMessage'],{'as':_0x5697('0x14d')});db['ChatWebsite'][_0x5697('0x118')](db[_0x5697('0xf1')],{'as':_0x5697('0x15a'),'foreignKey':'ListId'});db[_0x5697('0x66')][_0x5697('0x118')](db[_0x5697('0x88')],{'as':_0x5697('0x88'),'foreignKey':_0x5697('0x16c')});db[_0x5697('0x66')][_0x5697('0x118')](db['MailAccount'],{'as':_0x5697('0x42'),'foreignKey':_0x5697('0x156')});db[_0x5697('0x66')]['belongsTo'](db[_0x5697('0x89')],{'as':'mandatoryDispositionPause','foreignKey':_0x5697('0x148')});db[_0x5697('0x66')][_0x5697('0x11a')](db['User'],{'as':_0x5697('0x15c'),'through':_0x5697('0x12d')});db[_0x5697('0x68')][_0x5697('0x118')](db[_0x5697('0x60')],{});db[_0x5697('0x68')][_0x5697('0x118')](db[_0x5697('0xf1')],{'as':_0x5697('0x15a'),'foreignKey':_0x5697('0x16e')});db[_0x5697('0x68')][_0x5697('0x118')](db[_0x5697('0x75')],{'as':_0x5697('0x154'),'foreignKey':_0x5697('0x161')});db[_0x5697('0x68')][_0x5697('0x118')](db['OpenchannelInteraction'],{});db[_0x5697('0x68')]['belongsTo'](db[_0x5697('0x17f')],{});db[_0x5697('0x68')]['belongsTo'](db[_0x5697('0x15')],{});db['OpenchannelQueueReport'][_0x5697('0x118')](db['OpenchannelQueue'],{});db[_0x5697('0x6a')][_0x5697('0x118')](db['User'],{'as':_0x5697('0x185'),'foreignKey':_0x5697('0x109'),'onDelete':_0x5697('0x16b')});db[_0x5697('0x6a')][_0x5697('0x118')](db[_0x5697('0x186')],{'as':_0x5697('0x187'),'foreignKey':_0x5697('0x188'),'onDelete':_0x5697('0x16b')});db[_0x5697('0x6a')][_0x5697('0x118')](db[_0x5697('0x66')],{'as':_0x5697('0x189'),'foreignKey':_0x5697('0x168'),'onDelete':'restrict'});db['ChatApplication'][_0x5697('0x118')](db[_0x5697('0x8f')],{'onDelete':_0x5697('0x16b'),'foreignKey':_0x5697('0x16d')});db[_0x5697('0x6c')][_0x5697('0x10a')](db[_0x5697('0x18a')],{'as':'Messages','onDelete':_0x5697('0x108'),'foreignKey':'ChatInteractionId'});db['ChatInteraction']['belongsTo'](db[_0x5697('0x66')],{'as':_0x5697('0x160'),'foreignKey':_0x5697('0x168')});db['ChatInteraction'][_0x5697('0x118')](db[_0x5697('0x75')],{'as':_0x5697('0x154'),'foreignKey':'ContactId'});db[_0x5697('0x6c')]['belongsTo'](db[_0x5697('0x15')],{'as':_0x5697('0x162'),'foreignKey':'UserId'});db[_0x5697('0x6c')][_0x5697('0x11a')](db[_0x5697('0x8f')],{'through':_0x5697('0x18b'),'as':_0x5697('0x163')});db[_0x5697('0x6c')][_0x5697('0x11a')](db[_0x5697('0x8f')],{'through':_0x5697('0x18b'),'as':'ThroughTags'});db[_0x5697('0x6c')][_0x5697('0x11a')](db['User'],{'as':_0x5697('0x175'),'through':_0x5697('0x121'),'foreignKey':_0x5697('0x18c')});db['ChatMessage'][_0x5697('0x118')](db[_0x5697('0x15')],{'onDelete':_0x5697('0x108'),'as':'User'});db[_0x5697('0x18a')]['belongsTo'](db[_0x5697('0x75')],{'onDelete':_0x5697('0x108'),'as':_0x5697('0x154'),'foreignKey':_0x5697('0x161')});db[_0x5697('0x18a')][_0x5697('0x118')](db['ChatInteraction'],{'onDelete':'cascade','as':_0x5697('0x167'),'foreignKey':_0x5697('0x18c')});db['ChatMessage'][_0x5697('0x118')](db[_0x5697('0xea')],{'as':_0x5697('0xea'),'foreignKey':'AttachmentId'});db[_0x5697('0x18a')][_0x5697('0x118')](db[_0x5697('0x66')],{'as':_0x5697('0x160'),'foreignKey':'ChatWebsiteId'});db[_0x5697('0x169')][_0x5697('0x10a')](db[_0x5697('0xea')],{'as':_0x5697('0x166'),'foreignKey':_0x5697('0x16a'),'onDelete':_0x5697('0x108'),'hooks':!![]});db[_0x5697('0x169')]['belongsTo'](db[_0x5697('0x75')],{'onDelete':'cascade','as':_0x5697('0x154'),'foreignKey':'ContactId'});db[_0x5697('0x169')][_0x5697('0x118')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x5697('0x168')});db[_0x5697('0x186')][_0x5697('0x11a')](db['User'],{'as':'Agents','through':_0x5697('0x33'),'hooks':!![]});db['ChatQueue'][_0x5697('0x11a')](db[_0x5697('0xe4')],{'through':_0x5697('0x18d'),'as':'Teams'});db[_0x5697('0x11b')][_0x5697('0x10a')](db['ChatInternalMessage'],{'as':'Messages','foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0x5697('0x11b')][_0x5697('0x11a')](db['User'],{'as':_0x5697('0x13d'),'through':_0x5697('0x11c')});db[_0x5697('0x72')][_0x5697('0x118')](db[_0x5697('0x66')],{'as':_0x5697('0x189'),'foreignKey':_0x5697('0x168')});db[_0x5697('0x73')][_0x5697('0x10a')](db[_0x5697('0x75')],{'as':_0x5697('0x18e'),'foreignKey':_0x5697('0x18f')});db[_0x5697('0x75')][_0x5697('0x10a')](db[_0x5697('0x13f')],{'as':_0x5697('0x140'),'foreignKey':'ContactId'});db['CmContact'][_0x5697('0x10a')](db[_0x5697('0x10f')],{'as':_0x5697('0x110'),'foreignKey':'ContactId'});db[_0x5697('0x75')]['hasMany'](db[_0x5697('0x111')],{'as':_0x5697('0x141'),'foreignKey':_0x5697('0x161')});db[_0x5697('0x75')][_0x5697('0x10a')](db[_0x5697('0x7c')],{'as':_0x5697('0x7c'),'foreignKey':_0x5697('0x161')});db[_0x5697('0x75')][_0x5697('0x10a')](db[_0x5697('0x142')],{'as':_0x5697('0x143'),'foreignKey':_0x5697('0x161')});db[_0x5697('0x75')][_0x5697('0x10a')](db[_0x5697('0x125')],{'as':_0x5697('0x112'),'foreignKey':_0x5697('0x161'),'onDelete':'restrict'});db['CmContact'][_0x5697('0x10a')](db['ChatInteraction'],{'as':_0x5697('0x113'),'foreignKey':_0x5697('0x161'),'onDelete':_0x5697('0x16b')});db[_0x5697('0x75')][_0x5697('0x10a')](db[_0x5697('0x5a')],{'as':_0x5697('0x123'),'foreignKey':_0x5697('0x161'),'onDelete':_0x5697('0x16b')});db[_0x5697('0x75')][_0x5697('0x10a')](db[_0x5697('0x53')],{'as':_0x5697('0x114'),'foreignKey':_0x5697('0x161'),'onDelete':_0x5697('0x16b')});db[_0x5697('0x75')][_0x5697('0x10a')](db[_0x5697('0x46')],{'as':'MailInteractions','foreignKey':_0x5697('0x161'),'onDelete':_0x5697('0x16b')});db[_0x5697('0x75')][_0x5697('0x118')](db[_0x5697('0x73')],{'as':_0x5697('0x190'),'foreignKey':_0x5697('0x18f')});db[_0x5697('0x75')][_0x5697('0x118')](db[_0x5697('0xf1')],{'as':'List','foreignKey':'ListId','onDelete':_0x5697('0x108')});db[_0x5697('0x75')]['belongsToMany'](db['User'],{'as':_0x5697('0x175'),'through':_0x5697('0x191')});db[_0x5697('0x75')][_0x5697('0x11a')](db[_0x5697('0x8f')],{'as':_0x5697('0x163'),'through':_0x5697('0x192')});db['CmContact'][_0x5697('0x11a')](db[_0x5697('0x8f')],{'through':_0x5697('0x192'),'as':'ThroughTags'});db[_0x5697('0x13f')][_0x5697('0x118')](db[_0x5697('0x75')],{'as':_0x5697('0x154'),'foreignKey':'ContactId','onDelete':_0x5697('0x108')});db['CmHopper']['belongsTo'](db[_0x5697('0xf1')],{'as':'List','foreignKey':_0x5697('0x16e'),'onDelete':'cascade'});db[_0x5697('0x13f')][_0x5697('0x118')](db[_0x5697('0x15')],{'as':'Agent','foreignKey':_0x5697('0x109')});db[_0x5697('0x13f')][_0x5697('0x118')](db[_0x5697('0x1f')],{'as':_0x5697('0x187'),'foreignKey':_0x5697('0x13e'),'onDelete':_0x5697('0x108')});db['CmHopper'][_0x5697('0x118')](db['Campaign'],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x5697('0x108')});db[_0x5697('0x13f')]['belongsTo'](db[_0x5697('0x15')],{'as':_0x5697('0x162'),'foreignKey':_0x5697('0x193')});db[_0x5697('0x78')][_0x5697('0x118')](db['CmContact'],{'as':'Contact','foreignKey':_0x5697('0x161'),'onDelete':_0x5697('0x108')});db[_0x5697('0x78')]['belongsTo'](db[_0x5697('0xf1')],{'as':_0x5697('0x15a'),'foreignKey':_0x5697('0x16e'),'onDelete':_0x5697('0x108')});db[_0x5697('0x78')][_0x5697('0x118')](db[_0x5697('0x1f')],{'as':_0x5697('0x187'),'foreignKey':_0x5697('0x13e'),'onDelete':_0x5697('0x108')});db[_0x5697('0x78')][_0x5697('0x118')](db[_0x5697('0xe7')],{'as':_0x5697('0xe7'),'foreignKey':_0x5697('0x194'),'onDelete':_0x5697('0x108')});db['Automation'][_0x5697('0x10a')](db[_0x5697('0x195')],{'as':{'plural':_0x5697('0x196'),'singular':_0x5697('0x197')},'foreignKey':'AutomationAllId','onDelete':_0x5697('0x108'),'hooks':!![]});db[_0x5697('0x81')]['hasMany'](db[_0x5697('0x195')],{'as':{'plural':_0x5697('0x198'),'singular':'OneAny'},'foreignKey':_0x5697('0x199'),'onDelete':_0x5697('0x108'),'hooks':!![]});db['Automation'][_0x5697('0x10a')](db['Action'],{'as':_0x5697('0x19a'),'foreignKey':_0x5697('0x19b'),'onDelete':_0x5697('0x108'),'hooks':!![]});db[_0x5697('0x85')]['hasMany'](db[_0x5697('0x85')],{'as':'Dispositions','foreignKey':'ParentId','onDelete':'cascade'});db['Interval'][_0x5697('0x10a')](db[_0x5697('0x88')],{'as':_0x5697('0x19c'),'foreignKey':_0x5697('0x16c'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x5697('0x88')]['hasMany'](db[_0x5697('0x10d')],{'as':_0x5697('0x10e'),'foreignKey':_0x5697('0x16c'),'onDelete':_0x5697('0x16b')});db[_0x5697('0x88')]['hasMany'](db[_0x5697('0x49')],{'as':_0x5697('0x19d'),'foreignKey':_0x5697('0x16c')});db['Interval'][_0x5697('0x10a')](db[_0x5697('0x6a')],{'as':_0x5697('0x19e'),'foreignKey':'IntervalId'});db[_0x5697('0x88')][_0x5697('0x10a')](db[_0x5697('0x51')],{'as':'FaxApplications','foreignKey':_0x5697('0x16c')});db[_0x5697('0x88')][_0x5697('0x10a')](db[_0x5697('0x59')],{'as':_0x5697('0x19f'),'foreignKey':_0x5697('0x16c')});db[_0x5697('0x8c')]['belongsTo'](db[_0x5697('0x42')],{});db['Schedule']['belongsTo'](db[_0x5697('0x98')],{'foreignKey':_0x5697('0x1a0')});db['Schedule'][_0x5697('0x118')](db[_0x5697('0x97')],{'foreignKey':_0x5697('0x1a1')});db[_0x5697('0x8d')][_0x5697('0x11a')](db['VoiceMusicOnHold'],{'as':_0x5697('0x1a2'),'through':_0x5697('0x13c'),'onDelete':_0x5697('0x16b')});db[_0x5697('0x8f')]['belongsToMany'](db['CmContact'],{'through':_0x5697('0x192')});db['Tag'][_0x5697('0x11a')](db[_0x5697('0x6c')],{'through':_0x5697('0x18b')});db[_0x5697('0x8f')][_0x5697('0x11a')](db[_0x5697('0x46')],{'through':_0x5697('0x164')});db['Tag'][_0x5697('0x11a')](db[_0x5697('0x5a')],{'through':'sms_interaction_has_tags'});db[_0x5697('0x8f')][_0x5697('0x11a')](db[_0x5697('0x53')],{'through':_0x5697('0x1a3')});db[_0x5697('0x8f')]['belongsToMany'](db[_0x5697('0x125')],{'through':_0x5697('0x183')});db[_0x5697('0x8f')][_0x5697('0x11a')](db['WhatsappInteraction'],{'through':_0x5697('0x1a4')});db['Trigger'][_0x5697('0x10a')](db[_0x5697('0x195')],{'as':{'plural':_0x5697('0x1a5'),'singular':_0x5697('0x1a6')},'foreignKey':'TriggerAllId','onDelete':_0x5697('0x108'),'hooks':!![]});db['Trigger'][_0x5697('0x10a')](db[_0x5697('0x195')],{'as':{'plural':'AnyConditions','singular':_0x5697('0x1a7')},'foreignKey':_0x5697('0x1a8'),'onDelete':'cascade','hooks':!![]});db[_0x5697('0x91')][_0x5697('0x10a')](db[_0x5697('0x7f')],{'as':_0x5697('0x19a'),'foreignKey':_0x5697('0x1a9'),'onDelete':'cascade','hooks':!![]});db[_0x5697('0x97')]['hasMany'](db[_0x5697('0x9c')],{'as':_0x5697('0x1aa'),'onDelete':'cascade','foreignKey':_0x5697('0x1a1'),'hooks':!![]});db['AnalyticDefaultReport'][_0x5697('0x10a')](db[_0x5697('0x9c')],{'as':'Fields','onDelete':_0x5697('0x108'),'foreignKey':_0x5697('0x1a0')});db[_0x5697('0x9b')]['hasMany'](db[_0x5697('0x9c')],{'as':_0x5697('0x1aa'),'onDelete':_0x5697('0x108'),'foreignKey':_0x5697('0x1ab')});db[_0x5697('0x9c')]['belongsTo'](db[_0x5697('0x9b')],{'foreignKey':_0x5697('0x1ab')});db['SalesforceAccount'][_0x5697('0x10a')](db[_0x5697('0xa2')],{'as':'Configurations','onDelete':_0x5697('0x108'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x5697('0x10a')](db['SalesforceField'],{'as':_0x5697('0x1ac'),'onDelete':_0x5697('0x108'),'foreignKey':_0x5697('0x1ad')});db[_0x5697('0xa2')][_0x5697('0x10a')](db[_0x5697('0xa4')],{'as':_0x5697('0x1ae'),'onDelete':_0x5697('0x108'),'foreignKey':_0x5697('0x1af')});db['SalesforceConfiguration'][_0x5697('0x10a')](db['SalesforceField'],{'as':_0x5697('0x1aa'),'onDelete':_0x5697('0x108'),'foreignKey':_0x5697('0x1b0')});db[_0x5697('0xa2')]['belongsTo'](db['SalesforceAccount'],{'as':_0x5697('0x160'),'foreignKey':'AccountId'});db[_0x5697('0xa4')][_0x5697('0x10a')](db[_0x5697('0xa4')],{'as':_0x5697('0x1b1'),'foreignKey':'SubjectId'});db['SalesforceField'][_0x5697('0x10a')](db['SalesforceField'],{'as':_0x5697('0x1b2'),'foreignKey':_0x5697('0x1af')});db[_0x5697('0xa4')][_0x5697('0x10a')](db[_0x5697('0xa4')],{'as':_0x5697('0x1b3'),'foreignKey':_0x5697('0x1b0')});db['SalesforceField'][_0x5697('0x118')](db[_0x5697('0x1b4')],{'as':_0x5697('0x1b4'),'foreignKey':_0x5697('0x1b5')});db[_0x5697('0x1b6')][_0x5697('0x10a')](db[_0x5697('0xa7')],{'as':_0x5697('0x1b7'),'onDelete':_0x5697('0x108'),'foreignKey':_0x5697('0x1b8')});db['SugarcrmConfiguration'][_0x5697('0x10a')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0x5697('0x108'),'foreignKey':_0x5697('0x1ad')});db['SugarcrmConfiguration'][_0x5697('0x10a')](db[_0x5697('0xa9')],{'as':_0x5697('0x1ae'),'onDelete':_0x5697('0x108'),'foreignKey':'DescriptionId'});db[_0x5697('0xa7')][_0x5697('0x10a')](db[_0x5697('0xa9')],{'as':_0x5697('0x1aa'),'onDelete':'cascade','foreignKey':_0x5697('0x1b0')});db[_0x5697('0xa7')][_0x5697('0x118')](db[_0x5697('0x1b6')],{'as':_0x5697('0x160'),'foreignKey':_0x5697('0x1b8')});db[_0x5697('0xa9')][_0x5697('0x10a')](db[_0x5697('0xa9')],{'as':_0x5697('0x1b1'),'foreignKey':'SubjectId'});db[_0x5697('0xa9')][_0x5697('0x10a')](db[_0x5697('0xa9')],{'as':_0x5697('0x1b2'),'foreignKey':_0x5697('0x1af')});db[_0x5697('0xa9')][_0x5697('0x10a')](db[_0x5697('0xa9')],{'as':_0x5697('0x1b3'),'foreignKey':_0x5697('0x1b0')});db[_0x5697('0xa9')][_0x5697('0x118')](db[_0x5697('0x1b4')],{'as':_0x5697('0x1b4'),'foreignKey':_0x5697('0x1b5')});db[_0x5697('0xab')][_0x5697('0x10a')](db[_0x5697('0xac')],{'as':_0x5697('0x1b7'),'onDelete':'cascade','foreignKey':_0x5697('0x1b8')});db[_0x5697('0xac')][_0x5697('0x10a')](db['DeskField'],{'as':'Subjects','onDelete':_0x5697('0x108'),'foreignKey':'SubjectId'});db['DeskConfiguration'][_0x5697('0x10a')](db['DeskField'],{'as':_0x5697('0x1ae'),'onDelete':_0x5697('0x108'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db[_0x5697('0x1b9')],{'as':'Fields','onDelete':_0x5697('0x108'),'foreignKey':'FieldId'});db[_0x5697('0xac')][_0x5697('0x118')](db[_0x5697('0xab')],{'as':_0x5697('0x160'),'foreignKey':'AccountId'});db[_0x5697('0xac')][_0x5697('0x11a')](db[_0x5697('0x8f')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x5697('0x10a')](db[_0x5697('0x1b9')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x5697('0x1b9')]['hasMany'](db['DeskField'],{'as':_0x5697('0x1b2'),'foreignKey':_0x5697('0x1af')});db[_0x5697('0x1b9')][_0x5697('0x10a')](db[_0x5697('0x1b9')],{'as':'Field','foreignKey':_0x5697('0x1b0')});db[_0x5697('0x1b9')][_0x5697('0x118')](db[_0x5697('0x1b4')],{'as':_0x5697('0x1b4'),'foreignKey':_0x5697('0x1b5')});db[_0x5697('0x1ba')]['hasMany'](db['ZohoConfiguration'],{'as':_0x5697('0x1b7'),'onDelete':'cascade','foreignKey':_0x5697('0x1b8')});db[_0x5697('0xaf')][_0x5697('0x10a')](db[_0x5697('0xb1')],{'as':_0x5697('0x1ac'),'onDelete':_0x5697('0x108'),'foreignKey':_0x5697('0x1ad')});db[_0x5697('0xaf')][_0x5697('0x10a')](db[_0x5697('0xb1')],{'as':_0x5697('0x1ae'),'onDelete':_0x5697('0x108'),'foreignKey':_0x5697('0x1af')});db[_0x5697('0xaf')]['hasMany'](db[_0x5697('0xb1')],{'as':'Fields','onDelete':_0x5697('0x108'),'foreignKey':'FieldId'});db[_0x5697('0xaf')][_0x5697('0x118')](db['ZohoAccount'],{'as':_0x5697('0x160'),'foreignKey':'AccountId'});db[_0x5697('0xb1')][_0x5697('0x10a')](db['ZohoField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x5697('0xb1')][_0x5697('0x10a')](db[_0x5697('0xb1')],{'as':_0x5697('0x1b2'),'foreignKey':_0x5697('0x1af')});db[_0x5697('0xb1')][_0x5697('0x10a')](db[_0x5697('0xb1')],{'as':_0x5697('0x1b3'),'foreignKey':_0x5697('0x1b0')});db['ZohoField'][_0x5697('0x118')](db[_0x5697('0x1b4')],{'as':_0x5697('0x1b4'),'foreignKey':_0x5697('0x1b5')});db[_0x5697('0xb3')][_0x5697('0x10a')](db['ZendeskConfiguration'],{'as':_0x5697('0x1b7'),'onDelete':_0x5697('0x108'),'foreignKey':'AccountId'});db['ZendeskConfiguration']['hasMany'](db[_0x5697('0x1bb')],{'as':_0x5697('0x1ac'),'foreignKey':_0x5697('0x1ad')});db[_0x5697('0xb5')]['hasMany'](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0x5697('0x1af')});db['ZendeskConfiguration']['hasMany'](db[_0x5697('0x1bb')],{'as':'Fields','foreignKey':_0x5697('0x1b0')});db[_0x5697('0xb5')]['belongsTo'](db[_0x5697('0xb3')],{'as':_0x5697('0x160'),'foreignKey':_0x5697('0x1b8')});db[_0x5697('0xb5')][_0x5697('0x11a')](db[_0x5697('0x8f')],{'through':_0x5697('0x1bc')});db[_0x5697('0x1bb')][_0x5697('0x10a')](db[_0x5697('0x1bb')],{'as':'Subject','foreignKey':_0x5697('0x1ad')});db[_0x5697('0x1bb')][_0x5697('0x10a')](db[_0x5697('0x1bb')],{'as':'Description','foreignKey':_0x5697('0x1af')});db[_0x5697('0x1bb')][_0x5697('0x10a')](db[_0x5697('0x1bb')],{'as':_0x5697('0x1b3'),'foreignKey':'FieldId'});db[_0x5697('0x1bb')]['belongsTo'](db[_0x5697('0x1b4')],{'as':_0x5697('0x1b4'),'foreignKey':_0x5697('0x1b5')});db[_0x5697('0xb7')]['hasMany'](db['FreshdeskConfiguration'],{'as':_0x5697('0x1b7'),'onDelete':_0x5697('0x108'),'foreignKey':_0x5697('0x1b8')});db[_0x5697('0x1bd')][_0x5697('0x10a')](db[_0x5697('0x1be')],{'as':'Subjects','onDelete':_0x5697('0x108'),'foreignKey':'SubjectId'});db[_0x5697('0x1bd')][_0x5697('0x10a')](db[_0x5697('0x1be')],{'as':'Descriptions','onDelete':_0x5697('0x108'),'foreignKey':_0x5697('0x1af')});db['FreshdeskConfiguration']['hasMany'](db[_0x5697('0x1be')],{'as':_0x5697('0x1aa'),'onDelete':_0x5697('0x108'),'foreignKey':_0x5697('0x1b0')});db[_0x5697('0x1bd')][_0x5697('0x118')](db[_0x5697('0xb7')],{'as':_0x5697('0x160'),'foreignKey':_0x5697('0x1b8')});db['FreshdeskConfiguration'][_0x5697('0x11a')](db[_0x5697('0x8f')],{'through':_0x5697('0x1bf')});db[_0x5697('0x1be')]['hasMany'](db[_0x5697('0x1be')],{'as':'Subject','foreignKey':_0x5697('0x1ad')});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':_0x5697('0x1b2'),'foreignKey':_0x5697('0x1af')});db[_0x5697('0x1be')][_0x5697('0x10a')](db[_0x5697('0x1be')],{'as':'Field','foreignKey':_0x5697('0x1b0')});db[_0x5697('0x1be')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x5697('0xbb')][_0x5697('0x10a')](db[_0x5697('0xbd')],{'as':'Configurations','onDelete':_0x5697('0x108'),'foreignKey':'AccountId'});db[_0x5697('0xbd')][_0x5697('0x10a')](db['VtigerField'],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x5697('0xbd')][_0x5697('0x10a')](db[_0x5697('0xbf')],{'as':_0x5697('0x1ae'),'foreignKey':'DescriptionId'});db[_0x5697('0xbd')][_0x5697('0x10a')](db[_0x5697('0xbf')],{'as':'Fields','foreignKey':'FieldId'});db[_0x5697('0xbd')]['belongsTo'](db[_0x5697('0xbb')],{'as':_0x5697('0x160'),'foreignKey':_0x5697('0x1b8')});db[_0x5697('0xbf')][_0x5697('0x10a')](db[_0x5697('0xbf')],{'as':_0x5697('0x1b1'),'foreignKey':_0x5697('0x1ad')});db[_0x5697('0xbf')][_0x5697('0x10a')](db['VtigerField'],{'as':_0x5697('0x1b2'),'foreignKey':_0x5697('0x1af')});db[_0x5697('0xbf')]['hasMany'](db['VtigerField'],{'as':_0x5697('0x1b3'),'foreignKey':_0x5697('0x1b0')});db[_0x5697('0xbf')][_0x5697('0x118')](db[_0x5697('0x1b4')],{'as':_0x5697('0x1b4'),'foreignKey':_0x5697('0x1b5')});db[_0x5697('0xc0')][_0x5697('0x10a')](db[_0x5697('0x1c0')],{'as':'Configurations','onDelete':_0x5697('0x108'),'foreignKey':'AccountId'});db[_0x5697('0x1c0')][_0x5697('0x10a')](db[_0x5697('0x1c1')],{'as':_0x5697('0x1ac'),'foreignKey':_0x5697('0x1ad')});db[_0x5697('0x1c0')][_0x5697('0x10a')](db[_0x5697('0x1c1')],{'as':_0x5697('0x1ae'),'foreignKey':_0x5697('0x1af')});db[_0x5697('0x1c0')][_0x5697('0x10a')](db[_0x5697('0x1c1')],{'as':_0x5697('0x1aa'),'foreignKey':'FieldId'});db[_0x5697('0x1c0')][_0x5697('0x118')](db[_0x5697('0xc0')],{'as':'Account','foreignKey':_0x5697('0x1b8')});db[_0x5697('0x1c1')][_0x5697('0x10a')](db['ServicenowField'],{'as':'Subject','foreignKey':_0x5697('0x1ad')});db[_0x5697('0x1c1')][_0x5697('0x10a')](db[_0x5697('0x1c1')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x5697('0x1c1')][_0x5697('0x10a')](db['ServicenowField'],{'as':_0x5697('0x1b3'),'foreignKey':_0x5697('0x1b0')});db[_0x5697('0x1c1')][_0x5697('0x118')](db[_0x5697('0x1b4')],{'as':_0x5697('0x1b4'),'foreignKey':_0x5697('0x1b5')});db['Dynamics365Account'][_0x5697('0x10a')](db['Dynamics365Configuration'],{'as':_0x5697('0x1b7'),'onDelete':_0x5697('0x108'),'foreignKey':'AccountId'});db[_0x5697('0xc5')][_0x5697('0x10a')](db[_0x5697('0xc7')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0x5697('0x10a')](db['Dynamics365Field'],{'as':_0x5697('0x1ae'),'onDelete':_0x5697('0x108'),'foreignKey':_0x5697('0x1af')});db[_0x5697('0xc5')]['hasMany'](db[_0x5697('0xc7')],{'as':_0x5697('0x1aa'),'onDelete':'cascade','foreignKey':'FieldId'});db['Dynamics365Configuration'][_0x5697('0x118')](db[_0x5697('0xc3')],{'as':'Account','foreignKey':'AccountId'});db[_0x5697('0xc7')][_0x5697('0x10a')](db[_0x5697('0xc7')],{'as':_0x5697('0x1b1'),'foreignKey':_0x5697('0x1ad')});db[_0x5697('0xc7')][_0x5697('0x10a')](db[_0x5697('0xc7')],{'as':_0x5697('0x1b2'),'foreignKey':'DescriptionId'});db[_0x5697('0xc7')][_0x5697('0x10a')](db['Dynamics365Field'],{'as':_0x5697('0x1b3'),'foreignKey':_0x5697('0x1b0')});db[_0x5697('0xc7')][_0x5697('0x118')](db['Variable'],{'as':_0x5697('0x1b4'),'foreignKey':_0x5697('0x1b5')});db[_0x5697('0xc9')][_0x5697('0x10a')](db[_0x5697('0xcb')],{'as':_0x5697('0x1b7'),'onDelete':_0x5697('0x108'),'foreignKey':'AccountId'});db[_0x5697('0xcb')][_0x5697('0x10a')](db['FreshsalesField'],{'as':_0x5697('0x1ac'),'foreignKey':_0x5697('0x1ad')});db[_0x5697('0xcb')][_0x5697('0x10a')](db[_0x5697('0xcc')],{'as':_0x5697('0x1ae'),'foreignKey':_0x5697('0x1af')});db[_0x5697('0xcb')][_0x5697('0x10a')](db[_0x5697('0xcc')],{'as':'Fields','foreignKey':_0x5697('0x1b0')});db[_0x5697('0xcb')][_0x5697('0x118')](db['FreshsalesAccount'],{'as':_0x5697('0x160'),'foreignKey':_0x5697('0x1b8')});db[_0x5697('0xcc')][_0x5697('0x10a')](db[_0x5697('0xcc')],{'as':_0x5697('0x1b1'),'foreignKey':_0x5697('0x1ad')});db['FreshsalesField'][_0x5697('0x10a')](db['FreshsalesField'],{'as':_0x5697('0x1b2'),'foreignKey':_0x5697('0x1af')});db[_0x5697('0xcc')][_0x5697('0x10a')](db[_0x5697('0xcc')],{'as':_0x5697('0x1b3'),'foreignKey':_0x5697('0x1b0')});db[_0x5697('0xcc')][_0x5697('0x118')](db[_0x5697('0x1b4')],{'as':_0x5697('0x1b4'),'foreignKey':_0x5697('0x1b5')});db[_0x5697('0xd0')][_0x5697('0x118')](db[_0x5697('0x66')],{});db[_0x5697('0xd0')][_0x5697('0x118')](db['CmList'],{'as':_0x5697('0x15a'),'foreignKey':'ListId'});db[_0x5697('0xd0')][_0x5697('0x118')](db[_0x5697('0x75')],{'as':'Contact','foreignKey':'ContactId'});db['ChatQueueReport'][_0x5697('0x118')](db[_0x5697('0x6c')],{});db[_0x5697('0xd0')][_0x5697('0x118')](db['ChatMessage'],{});db['ChatQueueReport'][_0x5697('0x118')](db['User'],{});db['ChatQueueReport']['belongsTo'](db[_0x5697('0x186')],{});db[_0x5697('0xd1')]['belongsTo'](db[_0x5697('0x15')],{'onDelete':_0x5697('0x108'),'foreignKey':_0x5697('0x1c2')});db['ChatInternalMessage'][_0x5697('0x118')](db['User'],{'onDelete':_0x5697('0x108'),'foreignKey':_0x5697('0x1c3')});db[_0x5697('0x142')][_0x5697('0x10a')](db[_0x5697('0xd4')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x5697('0x142')][_0x5697('0x10a')](db[_0x5697('0xd3')],{'foreignKey':_0x5697('0x1c4'),'onDelete':_0x5697('0x108')});db[_0x5697('0xd5')][_0x5697('0x118')](db['SmsAccount'],{});db[_0x5697('0xd5')]['belongsTo'](db[_0x5697('0xf1')],{'as':_0x5697('0x15a'),'foreignKey':_0x5697('0x16e')});db[_0x5697('0xd5')][_0x5697('0x118')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db['SmsQueueReport'][_0x5697('0x118')](db[_0x5697('0x5a')],{});db[_0x5697('0xd5')][_0x5697('0x118')](db[_0x5697('0x5c')],{});db['SmsQueueReport'][_0x5697('0x118')](db[_0x5697('0x15')],{});db[_0x5697('0xd5')][_0x5697('0x118')](db[_0x5697('0x5e')],{});db[_0x5697('0x1c5')]['hasMany'](db[_0x5697('0x142')],{'foreignKey':_0x5697('0x1c6')});db['JscriptyProject'][_0x5697('0x10a')](db[_0x5697('0xd4')],{'foreignKey':_0x5697('0x1c6')});db[_0x5697('0x1c5')][_0x5697('0x10a')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x5697('0x136')][_0x5697('0x11a')](db[_0x5697('0x15')],{'as':'Users','through':_0x5697('0x1c7')});db[_0x5697('0xe4')][_0x5697('0x11a')](db[_0x5697('0x15')],{'as':_0x5697('0x15c'),'through':_0x5697('0x11f')});db[_0x5697('0xe4')]['belongsToMany'](db['VoiceQueue'],{'through':_0x5697('0x105'),'as':_0x5697('0x1c8')});db['Team']['belongsToMany'](db['MailQueue'],{'through':_0x5697('0x15e'),'as':_0x5697('0x127')});db[_0x5697('0xe4')][_0x5697('0x11a')](db[_0x5697('0x186')],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0x5697('0xe4')][_0x5697('0x11a')](db[_0x5697('0x55')],{'through':_0x5697('0x178'),'as':'FaxQueues'});db[_0x5697('0xe4')][_0x5697('0x11a')](db['SmsQueue'],{'through':_0x5697('0x17d'),'as':_0x5697('0x1c9')});db[_0x5697('0xe4')][_0x5697('0x11a')](db[_0x5697('0x181')],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0x5697('0xe4')][_0x5697('0x11a')](db[_0x5697('0x129')],{'through':_0x5697('0x1ca'),'as':_0x5697('0x12a')});db[_0x5697('0xe7')][_0x5697('0x10a')](db[_0x5697('0x13f')],{'as':_0x5697('0x140'),'foreignKey':'CampaignId'});db[_0x5697('0xe7')][_0x5697('0x10a')](db[_0x5697('0x10f')],{'as':_0x5697('0x110'),'foreignKey':'CampaignId'});db['Campaign']['hasMany'](db['CmHopperHistory'],{'as':_0x5697('0x141'),'foreignKey':_0x5697('0x194')});db['Campaign'][_0x5697('0x10a')](db[_0x5697('0x78')],{'as':_0x5697('0x1cb'),'foreignKey':_0x5697('0x194')});db[_0x5697('0xe7')][_0x5697('0x118')](db[_0x5697('0x2d')],{'as':_0x5697('0x2d'),'foreignKey':_0x5697('0x144')});db['Campaign'][_0x5697('0x118')](db['Trunk'],{'as':_0x5697('0x145'),'foreignKey':_0x5697('0x146')});db['Campaign']['belongsTo'](db[_0x5697('0x88')],{'as':_0x5697('0x88'),'foreignKey':_0x5697('0x16c')});db['Campaign'][_0x5697('0x118')](db['SquareProject'],{'as':_0x5697('0x136'),'foreignKey':_0x5697('0x1cc')});db['Campaign']['belongsToMany'](db[_0x5697('0xf1')],{'as':_0x5697('0x11d'),'through':_0x5697('0x1cd')});db[_0x5697('0xe7')]['belongsToMany'](db[_0x5697('0xf1')],{'as':_0x5697('0x14a'),'through':_0x5697('0x1ce')});db[_0x5697('0xea')][_0x5697('0x118')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0x5697('0x16a')});db[_0x5697('0x1cf')][_0x5697('0x118')](db[_0x5697('0x15f')],{});db[_0x5697('0x1cf')][_0x5697('0x118')](db[_0x5697('0x46')],{});db['MailTransferReport']['belongsTo'](db[_0x5697('0x42')],{'foreignKey':_0x5697('0x1d0'),'as':_0x5697('0x1d1')});db['MailTransferReport'][_0x5697('0x118')](db[_0x5697('0x15')],{'foreignKey':_0x5697('0x1d2'),'as':_0x5697('0x1d3')});db[_0x5697('0x1cf')][_0x5697('0x118')](db[_0x5697('0x15')],{'foreignKey':_0x5697('0x1d4'),'as':_0x5697('0x1d5')});db[_0x5697('0x1cf')][_0x5697('0x118')](db[_0x5697('0x43')],{'foreignKey':_0x5697('0x1d6'),'as':_0x5697('0x1d7')});db[_0x5697('0x1cf')]['belongsTo'](db[_0x5697('0x42')],{'foreignKey':_0x5697('0x1d8'),'as':_0x5697('0x1d9')});db[_0x5697('0x1da')][_0x5697('0x118')](db['ChatMessage'],{});db['ChatTransferReport'][_0x5697('0x118')](db[_0x5697('0x6c')],{});db[_0x5697('0x1da')]['belongsTo'](db[_0x5697('0x66')],{'foreignKey':_0x5697('0x1db'),'as':_0x5697('0x1d1')});db[_0x5697('0x1da')]['belongsTo'](db[_0x5697('0x15')],{'foreignKey':_0x5697('0x1d2'),'as':'FromAgent'});db['ChatTransferReport'][_0x5697('0x118')](db[_0x5697('0x15')],{'foreignKey':_0x5697('0x1d4'),'as':_0x5697('0x1d5')});db[_0x5697('0x1da')][_0x5697('0x118')](db[_0x5697('0x186')],{'foreignKey':_0x5697('0x1dc'),'as':_0x5697('0x1d7')});db[_0x5697('0x1da')][_0x5697('0x118')](db[_0x5697('0x66')],{'foreignKey':_0x5697('0x1dd'),'as':'ToAccount'});db[_0x5697('0x1de')][_0x5697('0x118')](db[_0x5697('0x54')],{});db[_0x5697('0x1de')][_0x5697('0x118')](db[_0x5697('0x53')],{});db[_0x5697('0x1de')]['belongsTo'](db[_0x5697('0x4f')],{'foreignKey':_0x5697('0x1df'),'as':_0x5697('0x1d1')});db[_0x5697('0x1de')][_0x5697('0x118')](db[_0x5697('0x15')],{'foreignKey':_0x5697('0x1d2'),'as':_0x5697('0x1d3')});db[_0x5697('0x1de')][_0x5697('0x118')](db[_0x5697('0x15')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x5697('0x1de')][_0x5697('0x118')](db[_0x5697('0x55')],{'foreignKey':_0x5697('0x1e0'),'as':_0x5697('0x1d7')});db['FaxTransferReport']['belongsTo'](db[_0x5697('0x4f')],{'foreignKey':_0x5697('0x1e1'),'as':_0x5697('0x1d9')});db[_0x5697('0x1e2')][_0x5697('0x118')](db['OpenchannelMessage'],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x5697('0x1e2')]['belongsTo'](db[_0x5697('0x60')],{'foreignKey':_0x5697('0x1e3'),'as':_0x5697('0x1d1')});db[_0x5697('0x1e2')][_0x5697('0x118')](db[_0x5697('0x15')],{'foreignKey':'FromUserId','as':_0x5697('0x1d3')});db['OpenchannelTransferReport']['belongsTo'](db[_0x5697('0x15')],{'foreignKey':_0x5697('0x1d4'),'as':_0x5697('0x1d5')});db[_0x5697('0x1e2')]['belongsTo'](db[_0x5697('0x181')],{'foreignKey':_0x5697('0x1e4'),'as':'ToQueue'});db[_0x5697('0x1e2')][_0x5697('0x118')](db['OpenchannelAccount'],{'foreignKey':_0x5697('0x1e5'),'as':_0x5697('0x1d9')});db['SmsTransferReport'][_0x5697('0x118')](db[_0x5697('0x5c')],{});db[_0x5697('0x1e6')][_0x5697('0x118')](db[_0x5697('0x5a')],{});db['SmsTransferReport']['belongsTo'](db[_0x5697('0x132')],{'foreignKey':_0x5697('0x1e7'),'as':_0x5697('0x1d1')});db[_0x5697('0x1e6')]['belongsTo'](db['User'],{'foreignKey':_0x5697('0x1d2'),'as':_0x5697('0x1d3')});db[_0x5697('0x1e6')][_0x5697('0x118')](db[_0x5697('0x15')],{'foreignKey':'ToUserId','as':_0x5697('0x1d5')});db[_0x5697('0x1e6')][_0x5697('0x118')](db[_0x5697('0x5e')],{'foreignKey':'ToSmsQueueId','as':_0x5697('0x1d7')});db[_0x5697('0x1e6')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0x5697('0x1e8'),'as':'ToAccount'});db[_0x5697('0xf1')][_0x5697('0x10a')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x5697('0x16e')});db[_0x5697('0xf1')]['hasMany'](db[_0x5697('0x7d')],{'as':_0x5697('0x1e9'),'foreignKey':_0x5697('0x16e')});db['CmList'][_0x5697('0x10a')](db[_0x5697('0x75')],{'as':_0x5697('0x18e'),'onDelete':'cascade','foreignKey':'ListId'});db['CmList']['hasMany'](db[_0x5697('0x10f')],{'as':'HopperFinals','foreignKey':_0x5697('0x16e')});db[_0x5697('0xf1')][_0x5697('0x10a')](db['CmHopperHistory'],{'as':_0x5697('0x1ea'),'foreignKey':_0x5697('0x16e')});db[_0x5697('0xf1')][_0x5697('0x10a')](db[_0x5697('0x7c')],{'as':_0x5697('0x7c'),'foreignKey':_0x5697('0x16e')});db[_0x5697('0xf1')][_0x5697('0x11a')](db[_0x5697('0x1f')],{'as':_0x5697('0x1eb'),'through':_0x5697('0x1ec')});db[_0x5697('0xf1')][_0x5697('0x11a')](db['User'],{'as':'Agents','through':_0x5697('0x11e')});db[_0x5697('0xf3')][_0x5697('0x10a')](db[_0x5697('0x10d')],{'as':_0x5697('0x10e'),'onDelete':_0x5697('0x108')});db[_0x5697('0xf3')][_0x5697('0x11a')](db['User'],{'as':_0x5697('0x15c'),'through':'user_has_voice_prefixes'});db[_0x5697('0xf5')][_0x5697('0x10a')](db[_0x5697('0x15')],{'as':_0x5697('0x175'),'foreignKey':_0x5697('0x119')});db[_0x5697('0xf5')][_0x5697('0x10a')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0x5697('0x119'),'onDelete':_0x5697('0x108')});db[_0x5697('0x1ed')][_0x5697('0x10a')](db['UserProfileResource'],{'as':_0x5697('0x1ee'),'foreignKey':'sectionId','onDelete':_0x5697('0x108')});db[_0x5697('0xfc')][_0x5697('0x10a')](db[_0x5697('0x85')],{'as':_0x5697('0x158'),'foreignKey':_0x5697('0x1ef')});db['WhatsappAccount'][_0x5697('0x10a')](db[_0x5697('0x83')],{'as':_0x5697('0x171'),'foreignKey':'WhatsappAccountId'});db[_0x5697('0xfc')][_0x5697('0x10a')](db[_0x5697('0x1f0')],{'as':'Messages','foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x5697('0x10a')](db['WhatsappInteraction'],{'as':_0x5697('0x159')});db[_0x5697('0xfc')][_0x5697('0x10a')](db[_0x5697('0x1f1')],{'as':_0x5697('0x13a')});db[_0x5697('0xfc')][_0x5697('0x118')](db['CmList'],{'as':_0x5697('0x15a'),'foreignKey':_0x5697('0x16e')});db[_0x5697('0xfc')][_0x5697('0x118')](db[_0x5697('0x89')],{'as':_0x5697('0x147'),'foreignKey':_0x5697('0x148')});db[_0x5697('0xfc')][_0x5697('0x11a')](db[_0x5697('0x15')],{'as':'Agents','through':_0x5697('0x135')});db[_0x5697('0x1f1')]['belongsTo'](db['User'],{'onDelete':_0x5697('0x16b')});db['WhatsappApplication']['belongsTo'](db['WhatsappQueue'],{'onDelete':_0x5697('0x16b')});db[_0x5697('0x1f1')][_0x5697('0x118')](db[_0x5697('0xfc')],{'onDelete':_0x5697('0x16b')});db[_0x5697('0x1f1')][_0x5697('0x118')](db[_0x5697('0x88')],{'onDelete':_0x5697('0x16b'),'foreignKey':_0x5697('0x16c')});db[_0x5697('0x1f1')][_0x5697('0x118')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x5697('0x16d')});db[_0x5697('0xfe')][_0x5697('0x10a')](db[_0x5697('0x1f0')],{'as':_0x5697('0x14d'),'onDelete':_0x5697('0x108'),'foreignKey':_0x5697('0x1f2')});db[_0x5697('0xfe')]['belongsTo'](db[_0x5697('0xfc')],{'as':_0x5697('0x160'),'foreignKey':_0x5697('0x1ef')});db[_0x5697('0xfe')]['belongsTo'](db['CmContact'],{'as':_0x5697('0x154'),'foreignKey':_0x5697('0x161')});db['WhatsappInteraction'][_0x5697('0x118')](db[_0x5697('0x15')],{'as':_0x5697('0x162'),'foreignKey':'UserId'});db[_0x5697('0xfe')][_0x5697('0x11a')](db[_0x5697('0x8f')],{'through':_0x5697('0x1a4'),'as':_0x5697('0x163')});db[_0x5697('0xfe')][_0x5697('0x11a')](db[_0x5697('0x8f')],{'through':_0x5697('0x1a4'),'as':_0x5697('0x174')});db['WhatsappInteraction']['belongsToMany'](db['User'],{'as':_0x5697('0x175'),'through':_0x5697('0x1f3'),'foreignKey':_0x5697('0x1f2')});db[_0x5697('0x1f0')]['belongsTo'](db[_0x5697('0x15')],{'as':_0x5697('0x15')});db[_0x5697('0x1f0')][_0x5697('0x118')](db['CmContact'],{'onDelete':_0x5697('0x108'),'as':'Contact'});db[_0x5697('0x1f0')][_0x5697('0x118')](db['WhatsappInteraction'],{'onDelete':_0x5697('0x108'),'as':_0x5697('0x167'),'foreignKey':_0x5697('0x1f2')});db[_0x5697('0x1f0')][_0x5697('0x118')](db[_0x5697('0xfc')],{'as':_0x5697('0x160'),'foreignKey':_0x5697('0x1ef')});db[_0x5697('0x100')][_0x5697('0x118')](db[_0x5697('0xfc')],{});db[_0x5697('0x100')][_0x5697('0x118')](db[_0x5697('0xf1')],{'as':_0x5697('0x15a'),'foreignKey':_0x5697('0x16e')});db[_0x5697('0x100')][_0x5697('0x118')](db[_0x5697('0x75')],{'as':_0x5697('0x154'),'foreignKey':_0x5697('0x161')});db[_0x5697('0x100')][_0x5697('0x118')](db['WhatsappInteraction'],{});db[_0x5697('0x100')][_0x5697('0x118')](db[_0x5697('0x129')],{});db[_0x5697('0x100')][_0x5697('0x118')](db[_0x5697('0x1f0')],{});db[_0x5697('0x100')][_0x5697('0x118')](db['User'],{});db[_0x5697('0x101')]['belongsTo'](db[_0x5697('0x1f0')],{});db[_0x5697('0x101')][_0x5697('0x118')](db[_0x5697('0xfe')],{});db[_0x5697('0x101')][_0x5697('0x118')](db[_0x5697('0xfc')],{'foreignKey':_0x5697('0x1f4'),'as':_0x5697('0x1d1')});db[_0x5697('0x101')][_0x5697('0x118')](db[_0x5697('0xfc')],{'foreignKey':_0x5697('0x1f5'),'as':_0x5697('0x1d9')});db[_0x5697('0x101')][_0x5697('0x118')](db[_0x5697('0x129')],{'foreignKey':_0x5697('0x1f6'),'as':_0x5697('0x1d7')});db[_0x5697('0x101')]['belongsTo'](db[_0x5697('0x15')],{'foreignKey':_0x5697('0x1d2'),'as':_0x5697('0x1d3')});db[_0x5697('0x101')][_0x5697('0x118')](db['User'],{'foreignKey':_0x5697('0x1d4'),'as':_0x5697('0x1d5')});db[_0x5697('0x129')]['belongsToMany'](db['User'],{'as':_0x5697('0x15c'),'through':_0x5697('0x3d'),'foreignKey':_0x5697('0x1f7')});db[_0x5697('0x129')][_0x5697('0x11a')](db[_0x5697('0xe4')],{'through':_0x5697('0x1ca'),'as':_0x5697('0x149')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x6158=['ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','hasMany','UserId','UserVoiceQueueRt','VoiceExtension','Extensions','HopperFinals','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteractions','UserNotifications','SenderId','belongsTo','UserProfile','belongsToMany','Groups','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','user_has_sms_interactions','WhatsappInteractions','MailQueues','SmsQueue','UserSmsQueue','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','FaxAccount','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SquareProjects','SpiedAgents','cascade','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','QueueCalls','VoiceAgentReport','uniqueid','Contact','MailServerIn','MailAccountId','Imap','Smtp','Dispositions','Interactions','List','ListId','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Attachment','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','MailQueueReport','ContactId','Items','Answers','Exntensions','FaxInteractionId','FaxAccountId','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','SmsMessage','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ProactiveActions','user_has_chat_websites','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','Attachments','team_has_chat_queues','chat_group_has_users','CompanyId','Company','cm_contact_has_tags','Queue','Campaign','CampaignId','OwnerId','OneAll','AutomationAllId','Any','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','Schedule','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','Fields','MetricId','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Description','Field','VariableId','SugarcrmAccount','Subject','DeskAccount','Configurations','int_desk_configuration_has_tags','ZohoAccount','ZohoConfiguration','ZendeskAccount','ZendeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowAccount','ServicenowConfiguration','FreshsalesConfiguration','ChatQueueReport','FromId','ToId','SessionId','JscriptyProject','ProjectId','VoiceQueues','FaxQueues','team_has_sms_queues','SmsQueues','team_has_whatsapp_queues','SquareProject','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','ToAccount','FromFaxAccountId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToSmsQueueId','CustomFields','HopperHistory','Queues','voice_queues_has_cm_lists','userProfileId','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','name','utf8','utf8_general_ci','sequelizeHistory','xcall','utf8mb4','username','password','options','database','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','VoiceMail','VoiceMailMessage','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerOut','../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','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','Sound','../api/sound/sound.model','Tag','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model'];(function(_0x5544f0,_0x33dd1f){var _0x367f89=function(_0x33264a){while(--_0x33264a){_0x5544f0['push'](_0x5544f0['shift']());}};_0x367f89(++_0x33dd1f);}(_0x6158,0x133));var _0x8615=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6158[_0x3dd15e];return _0x231fd0;};'use strict';var path=require('path');var config=require(_0x8615('0x0'));var Sequelize=require(_0x8615('0x1'));var _=require(_0x8615('0x2'));var jstz=require(_0x8615('0x3'));var timezone=jstz[_0x8615('0x4')]();config[_0x8615('0x1')]=_[_0x8615('0x5')](config[_0x8615('0x1')],{'database':_0x8615('0x6'),'username':'xcall','password':_0x8615('0x7'),'options':{'host':_0x8615('0x8'),'port':0xcea,'dialect':_0x8615('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x8615('0xa')](),'define':{'charset':_0x8615('0xb'),'collate':_0x8615('0xc')}}});config[_0x8615('0xd')]=_[_0x8615('0x5')](config[_0x8615('0xd')],{'database':_0x8615('0x6'),'username':_0x8615('0xe'),'password':_0x8615('0x7'),'options':{'host':_0x8615('0x8'),'port':0xcea,'dialect':_0x8615('0x9'),'dialectOptions':{'charset':_0x8615('0xf')},'logging':![],'timezone':timezone[_0x8615('0xa')](),'define':{'charset':_0x8615('0xb'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x8615('0x1')][_0x8615('0x10')],config['sequelize'][_0x8615('0x11')],config[_0x8615('0x1')][_0x8615('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8615('0xd')][_0x8615('0x13')],config[_0x8615('0xd')][_0x8615('0x10')],config[_0x8615('0xd')][_0x8615('0x11')],config[_0x8615('0xd')][_0x8615('0x12')])};db[_0x8615('0x14')]=db['sequelize'][_0x8615('0x15')](_0x8615('0x16'));db[_0x8615('0x17')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x18'));db[_0x8615('0x19')]=db['sequelize'][_0x8615('0x15')](_0x8615('0x1a'));db['VoiceExtension']=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x1b'));db['VoiceMusicOnHold']=db['sequelize']['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x8615('0x1c')]=db[_0x8615('0x1')]['import'](_0x8615('0x1d'));db[_0x8615('0x1e')]=db['sequelize'][_0x8615('0x15')]('../api/voiceRecording/voiceRecording.model');db[_0x8615('0x1f')]=db[_0x8615('0x1')][_0x8615('0x15')]('../api/screenRecording/screenRecording.model');db[_0x8615('0x20')]=db['sequelize'][_0x8615('0x15')]('../api/voiceMail/voiceMail.model');db[_0x8615('0x21')]=db['sequelize'][_0x8615('0x15')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x8615('0x22')]=db['sequelize'][_0x8615('0x15')]('../api/voiceCallReport/voiceCallReport.model');db[_0x8615('0x23')]=db['sequelize'][_0x8615('0x15')](_0x8615('0x24'));db['VoiceAgentReport']=db['sequelize'][_0x8615('0x15')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x8615('0x25')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x26'));db[_0x8615('0x27')]=db[_0x8615('0x1')][_0x8615('0x15')]('../api/memberReport/memberReport.model');db[_0x8615('0x28')]=db['sequelize'][_0x8615('0x15')](_0x8615('0x29'));db[_0x8615('0x2a')]=db['sequelize'][_0x8615('0x15')](_0x8615('0x2b'));db['UserVoiceQueueRt']=db[_0x8615('0x1')][_0x8615('0x15')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x8615('0x2c')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x2d'));db[_0x8615('0x2e')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x2f'));db[_0x8615('0x30')]=db['sequelize'][_0x8615('0x15')](_0x8615('0x31'));db[_0x8615('0x32')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x33'));db['UserSmsQueue']=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x34'));db[_0x8615('0x35')]=db['sequelize'][_0x8615('0x15')](_0x8615('0x36'));db[_0x8615('0x37')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x38'));db['MailServerIn']=db['sequelize']['import']('../api/mailServerIn/mailServerIn.model');db[_0x8615('0x39')]=db['sequelize'][_0x8615('0x15')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db['sequelize'][_0x8615('0x15')](_0x8615('0x3a'));db[_0x8615('0x3b')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x3c'));db[_0x8615('0x3d')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x3e'));db[_0x8615('0x3f')]=db['sequelize'][_0x8615('0x15')](_0x8615('0x40'));db[_0x8615('0x41')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x42'));db[_0x8615('0x43')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x44'));db['MailQueueReport']=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x45'));db[_0x8615('0x46')]=db['sequelize'][_0x8615('0x15')](_0x8615('0x47'));db[_0x8615('0x48')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x49'));db['FaxAccount']=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x4a'));db[_0x8615('0x4b')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x4c'));db[_0x8615('0x4d')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x4e'));db[_0x8615('0x4f')]=db['sequelize'][_0x8615('0x15')]('../api/faxMessage/faxMessage.model');db[_0x8615('0x50')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x51'));db[_0x8615('0x52')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x53'));db[_0x8615('0x54')]=db[_0x8615('0x1')]['import']('../api/smsAccount/smsAccount.model');db['SmsApplication']=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x55'));db['SmsInteraction']=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x56'));db['SmsMessage']=db[_0x8615('0x1')]['import']('../api/smsMessage/smsMessage.model');db['SmsQueue']=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x57'));db['OpenchannelAccount']=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x58'));db[_0x8615('0x59')]=db['sequelize'][_0x8615('0x15')](_0x8615('0x5a'));db[_0x8615('0x5b')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x5c'));db[_0x8615('0x5d')]=db[_0x8615('0x1')][_0x8615('0x15')]('../api/openchannelMessage/openchannelMessage.model');db[_0x8615('0x5e')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x5f'));db[_0x8615('0x60')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x61'));db[_0x8615('0x62')]=db['sequelize'][_0x8615('0x15')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x8615('0x63')]=db['sequelize'][_0x8615('0x15')](_0x8615('0x64'));db[_0x8615('0x65')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x66'));db[_0x8615('0x67')]=db[_0x8615('0x1')][_0x8615('0x15')]('../api/chatMessage/chatMessage.model');db[_0x8615('0x68')]=db[_0x8615('0x1')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x8615('0x69')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x6a'));db[_0x8615('0x6b')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x6c'));db['ChatProactiveAction']=db[_0x8615('0x1')]['import'](_0x8615('0x6d'));db[_0x8615('0x6e')]=db[_0x8615('0x1')]['import'](_0x8615('0x6f'));db[_0x8615('0x70')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x71'));db[_0x8615('0x72')]=db[_0x8615('0x1')][_0x8615('0x15')]('../api/cmHopper/cmHopper.model');db[_0x8615('0x73')]=db[_0x8615('0x1')][_0x8615('0x15')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x8615('0x74')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x75'));db[_0x8615('0x76')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x77'));db['ReportAgentPreview']=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x78'));db[_0x8615('0x79')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x7a'));db[_0x8615('0x7b')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x7c'));db[_0x8615('0x7d')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x7e'));db[_0x8615('0x7f')]=db[_0x8615('0x1')]['import'](_0x8615('0x80'));db[_0x8615('0x81')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x82'));db[_0x8615('0x83')]=db[_0x8615('0x1')]['import']('../api/condition/condition.model');db[_0x8615('0x84')]=db['sequelize'][_0x8615('0x15')](_0x8615('0x85'));db[_0x8615('0x86')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x87'));db[_0x8615('0x88')]=db[_0x8615('0x1')]['import']('../api/cdr/cdr.model');db[_0x8615('0x89')]=db[_0x8615('0x1')]['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db['Schedule']=db[_0x8615('0x1')][_0x8615('0x15')]('../api/schedule/schedule.model');db[_0x8615('0x8a')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x8b'));db[_0x8615('0x8c')]=db[_0x8615('0x1')][_0x8615('0x15')]('../api/tag/tag.model');db[_0x8615('0x8d')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x8e'));db[_0x8615('0x8f')]=db[_0x8615('0x1')]['import'](_0x8615('0x90'));db[_0x8615('0x91')]=db['sequelize'][_0x8615('0x15')]('../api/variable/variable.model');db[_0x8615('0x92')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x93'));db[_0x8615('0x94')]=db['sequelize'][_0x8615('0x15')](_0x8615('0x95'));db[_0x8615('0x96')]=db['sequelize'][_0x8615('0x15')](_0x8615('0x97'));db[_0x8615('0x98')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x99'));db[_0x8615('0x9a')]=db['sequelize']['import'](_0x8615('0x9b'));db[_0x8615('0x9c')]=db[_0x8615('0x1')][_0x8615('0x15')]('../api/analyticMetric/analyticMetric.model');db[_0x8615('0x9d')]=db['sequelize'][_0x8615('0x15')](_0x8615('0x9e'));db[_0x8615('0x9f')]=db[_0x8615('0x1')][_0x8615('0x15')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x8615('0xa0')]=db[_0x8615('0x1')]['import']('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x8615('0xa1')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xa2'));db[_0x8615('0xa3')]=db[_0x8615('0x1')][_0x8615('0x15')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0x8615('0x1')][_0x8615('0x15')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x8615('0xa4')]=db['sequelize'][_0x8615('0x15')](_0x8615('0xa5'));db[_0x8615('0xa6')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xa7'));db['DeskAccount']=db[_0x8615('0x1')]['import'](_0x8615('0xa8'));db[_0x8615('0xa9')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xaa'));db[_0x8615('0xab')]=db['sequelize'][_0x8615('0x15')](_0x8615('0xac'));db['ZohoAccount']=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xad'));db['ZohoConfiguration']=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xae'));db[_0x8615('0xaf')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xb0'));db['ZendeskAccount']=db[_0x8615('0x1')][_0x8615('0x15')]('../api/intZendeskAccount/intZendeskAccount.model');db['ZendeskConfiguration']=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xb1'));db['ZendeskField']=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xb2'));db[_0x8615('0xb3')]=db[_0x8615('0x1')]['import']('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x8615('0xb4')]=db['sequelize'][_0x8615('0x15')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x8615('0xb5')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xb6'));db[_0x8615('0xb7')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xb8'));db[_0x8615('0xb9')]=db['sequelize'][_0x8615('0x15')](_0x8615('0xba'));db[_0x8615('0xbb')]=db[_0x8615('0x1')]['import'](_0x8615('0xbc'));db['ServicenowAccount']=db['sequelize'][_0x8615('0x15')](_0x8615('0xbd'));db['ServicenowConfiguration']=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xbe'));db[_0x8615('0xbf')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xc0'));db[_0x8615('0xc1')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xc2'));db[_0x8615('0xc3')]=db[_0x8615('0x1')]['import'](_0x8615('0xc4'));db[_0x8615('0xc5')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xc6'));db[_0x8615('0xc7')]=db['sequelize'][_0x8615('0x15')](_0x8615('0xc8'));db['FreshsalesConfiguration']=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xc9'));db[_0x8615('0xca')]=db[_0x8615('0x1')][_0x8615('0x15')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x8615('0x92')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x93'));db[_0x8615('0xcb')]=db['sequelize']['import'](_0x8615('0xcc'));db['ChatQueueReport']=db[_0x8615('0x1')][_0x8615('0x15')]('../api/chatQueueReport/chatQueueReport.model');db[_0x8615('0xcd')]=db['sequelize'][_0x8615('0x15')](_0x8615('0xce'));db[_0x8615('0xcf')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xd0'));db[_0x8615('0xd1')]=db['sequelize']['import'](_0x8615('0xd2'));db[_0x8615('0xd3')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xd4'));db[_0x8615('0xd5')]=db[_0x8615('0x1')][_0x8615('0x15')]('../api/smsQueueReport/smsQueueReport.model');db[_0x8615('0xd6')]=db[_0x8615('0x1')]['import'](_0x8615('0xd7'));db[_0x8615('0xd8')]=db[_0x8615('0x1')]['import'](_0x8615('0xd9'));db['JscriptyProject']=db[_0x8615('0x1')]['import'](_0x8615('0xda'));db['Setting']=db[_0x8615('0x1')]['import']('../api/setting/setting.model');db[_0x8615('0xdb')]=db['sequelize'][_0x8615('0x15')](_0x8615('0xdc'));db['SquareProject']=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xdd'));db['SquareRecording']=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xde'));db[_0x8615('0xdf')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xe0'));db[_0x8615('0xe1')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xe2'));db[_0x8615('0xe3')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xe4'));db['Campaign']=db[_0x8615('0x1')]['import'](_0x8615('0xe5'));db[_0x8615('0xe6')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xe7'));db['Attachment']=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xe8'));db[_0x8615('0xe9')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xea'));db['MailTransferReport']=db[_0x8615('0x1')][_0x8615('0x15')]('../api/mailTransferReport/mailTransferReport.model');db[_0x8615('0xeb')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xec'));db[_0x8615('0xed')]=db[_0x8615('0x1')][_0x8615('0x15')]('../api/faxTransferReport/faxTransferReport.model');db[_0x8615('0xee')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xef'));db[_0x8615('0xf0')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xf1'));db[_0x8615('0xf2')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0xf3'));db[_0x8615('0xf4')]=db[_0x8615('0x1')][_0x8615('0x15')]('../api/voicePrefix/voicePrefix.model');db['UserProfile']=db['sequelize'][_0x8615('0x15')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db['sequelize']['import'](_0x8615('0xf5'));db[_0x8615('0xf6')]=db[_0x8615('0x1')][_0x8615('0x15')]('../api/userProfileResource/userProfileResource.model');db[_0x8615('0xf7')]=db[_0x8615('0x1')][_0x8615('0x15')]('../api/userNotification/userNotification.model');db[_0x8615('0xf8')]=db['sequelize']['import'](_0x8615('0xf9'));db[_0x8615('0xfa')]=db['sequelize'][_0x8615('0x15')](_0x8615('0xfb'));db[_0x8615('0xfc')]=db[_0x8615('0x1')]['import'](_0x8615('0xfd'));db[_0x8615('0xfe')]=db[_0x8615('0x1')][_0x8615('0x15')]('../api/whatsappMessage/whatsappMessage.model');db[_0x8615('0xff')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x100'));db[_0x8615('0x101')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x102'));db[_0x8615('0x103')]=db[_0x8615('0x1')][_0x8615('0x15')]('../api/whatsappQueue/whatsappQueue.model');db[_0x8615('0x104')]=db[_0x8615('0x1')]['import'](_0x8615('0x105'));db[_0x8615('0x106')]=db[_0x8615('0x1')][_0x8615('0x15')](_0x8615('0x107'));db['User'][_0x8615('0x108')](db['VoiceMail'],{'as':_0x8615('0x20'),'onDelete':'cascade','foreignKey':'UserId'});db[_0x8615('0x14')][_0x8615('0x109')](db[_0x8615('0x1e')],{'as':'Recordings','foreignKey':_0x8615('0x10a')});db[_0x8615('0x14')]['hasMany'](db[_0x8615('0x10b')],{'as':'VoiceQueuesRt','foreignKey':_0x8615('0x10a')});db[_0x8615('0x14')][_0x8615('0x109')](db[_0x8615('0x10c')],{'as':_0x8615('0x10d'),'onDelete':'cascade','hooks':!![]});db[_0x8615('0x14')][_0x8615('0x109')](db[_0x8615('0x74')],{'as':_0x8615('0x10e'),'foreignKey':_0x8615('0x10a')});db[_0x8615('0x14')][_0x8615('0x109')](db[_0x8615('0x76')],{'as':'HopperHistory','foreignKey':_0x8615('0x10a')});db[_0x8615('0x14')][_0x8615('0x109')](db[_0x8615('0x10f')],{'as':_0x8615('0x10f'),'foreignKey':_0x8615('0x10a')});db[_0x8615('0x14')][_0x8615('0x109')](db['OpenchannelInteraction'],{'as':_0x8615('0x110'),'foreignKey':_0x8615('0x10a')});db[_0x8615('0x14')][_0x8615('0x109')](db[_0x8615('0x65')],{'as':_0x8615('0x111'),'foreignKey':'UserId'});db[_0x8615('0x14')]['hasMany'](db[_0x8615('0x112')],{'as':_0x8615('0x113'),'foreignKey':'UserId'});db[_0x8615('0x14')]['hasMany'](db[_0x8615('0x4d')],{'as':_0x8615('0x114'),'foreignKey':_0x8615('0x10a')});db[_0x8615('0x14')][_0x8615('0x109')](db[_0x8615('0x3f')],{'as':_0x8615('0x115'),'foreignKey':_0x8615('0x10a')});db[_0x8615('0x14')]['hasMany'](db[_0x8615('0xfc')],{'as':'WhatsappInteractions','foreignKey':_0x8615('0x10a')});db[_0x8615('0x14')][_0x8615('0x109')](db[_0x8615('0xf7')],{'as':_0x8615('0x116'),'foreignKey':_0x8615('0x117')});db[_0x8615('0x14')][_0x8615('0x118')](db[_0x8615('0x119')],{'as':_0x8615('0x119'),'foreignKey':'userProfileId'});db[_0x8615('0x14')][_0x8615('0x11a')](db['ChatGroup'],{'as':_0x8615('0x11b'),'through':'chat_group_has_users'});db[_0x8615('0x14')][_0x8615('0x11a')](db[_0x8615('0x70')],{'as':_0x8615('0x11c'),'through':_0x8615('0x11d')});db[_0x8615('0x14')][_0x8615('0x11a')](db[_0x8615('0xf2')],{'as':_0x8615('0x11e'),'through':_0x8615('0x11f')});db[_0x8615('0x14')][_0x8615('0x11a')](db[_0x8615('0xe1')],{'through':_0x8615('0x120')});db[_0x8615('0x14')][_0x8615('0x11a')](db['MailInteraction'],{'as':_0x8615('0x115'),'through':_0x8615('0x121')});db[_0x8615('0x14')][_0x8615('0x11a')](db[_0x8615('0x65')],{'as':_0x8615('0x111'),'through':'user_has_chat_interactions'});db[_0x8615('0x14')]['belongsToMany'](db[_0x8615('0x4d')],{'as':_0x8615('0x114'),'through':_0x8615('0x122')});db[_0x8615('0x14')][_0x8615('0x11a')](db['SmsInteraction'],{'as':'SmsInteractions','through':_0x8615('0x123')});db[_0x8615('0x14')][_0x8615('0x11a')](db[_0x8615('0x5b')],{'as':_0x8615('0x110'),'through':'user_has_openchannel_interactions'});db[_0x8615('0x14')][_0x8615('0x11a')](db[_0x8615('0xfc')],{'as':_0x8615('0x124'),'through':'user_has_whatsapp_interactions'});db[_0x8615('0x14')][_0x8615('0x11a')](db[_0x8615('0x1c')],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db[_0x8615('0x14')]['belongsToMany'](db['MailQueue'],{'as':_0x8615('0x125'),'through':_0x8615('0x30'),'required':![]});db[_0x8615('0x14')][_0x8615('0x11a')](db[_0x8615('0x69')],{'as':'ChatQueues','through':'UserChatQueue','required':![],'hooks':!![]});db[_0x8615('0x14')][_0x8615('0x11a')](db['FaxQueue'],{'as':'FaxQueues','through':_0x8615('0x32'),'required':![]});db[_0x8615('0x14')][_0x8615('0x11a')](db[_0x8615('0x126')],{'as':'SmsQueues','through':_0x8615('0x127'),'required':![]});db[_0x8615('0x14')][_0x8615('0x11a')](db[_0x8615('0x5e')],{'as':'OpenchannelQueues','through':_0x8615('0x35'),'required':![]});db[_0x8615('0x14')][_0x8615('0x11a')](db[_0x8615('0x103')],{'as':_0x8615('0x128'),'through':_0x8615('0x37'),'required':![]});db['User'][_0x8615('0x11a')](db[_0x8615('0xf2')],{'through':'cm_user_has_lists'});db[_0x8615('0x14')][_0x8615('0x11a')](db['VoicePrefix'],{'as':_0x8615('0x129'),'through':_0x8615('0x12a'),'required':![]});db[_0x8615('0x14')]['belongsToMany'](db['ChatWebsite'],{'as':_0x8615('0x12b'),'through':'user_has_chat_websites'});db[_0x8615('0x14')]['belongsToMany'](db[_0x8615('0x12c')],{'as':'FaxAccounts','through':_0x8615('0x12d')});db[_0x8615('0x14')][_0x8615('0x11a')](db[_0x8615('0x12e')],{'as':_0x8615('0x12f'),'through':_0x8615('0x130')});db[_0x8615('0x14')][_0x8615('0x11a')](db[_0x8615('0x131')],{'as':_0x8615('0x132'),'through':_0x8615('0x133')});db[_0x8615('0x14')][_0x8615('0x11a')](db['SmsAccount'],{'as':_0x8615('0x134'),'through':_0x8615('0x135')});db['User'][_0x8615('0x11a')](db['WhatsappAccount'],{'as':_0x8615('0x136'),'through':'user_has_whatsapp_accounts'});db[_0x8615('0x14')]['belongsToMany'](db['SquareProject'],{'as':_0x8615('0x137'),'through':'user_has_square_projects'});db[_0x8615('0x17')][_0x8615('0x109')](db['VoiceExtension'],{'as':_0x8615('0x138'),'onDelete':_0x8615('0x139'),'foreignKey':_0x8615('0x13a')});db[_0x8615('0x19')][_0x8615('0x109')](db['VoiceExtension'],{'onDelete':_0x8615('0x139')});db[_0x8615('0x10c')][_0x8615('0x109')](db[_0x8615('0x10c')],{'as':_0x8615('0x13b'),'onDelete':'cascade'});db[_0x8615('0x13c')]['belongsToMany'](db[_0x8615('0x8a')],{'as':_0x8615('0x13d'),'through':_0x8615('0x13e')});db[_0x8615('0x1c')][_0x8615('0x109')](db[_0x8615('0x10b')],{'as':_0x8615('0x13f'),'foreignKey':_0x8615('0x140')});db[_0x8615('0x1c')][_0x8615('0x109')](db['CmHopper'],{'as':_0x8615('0x141'),'foreignKey':_0x8615('0x140')});db[_0x8615('0x1c')]['hasMany'](db[_0x8615('0x74')],{'as':_0x8615('0x10e'),'foreignKey':_0x8615('0x140')});db['VoiceQueue'][_0x8615('0x109')](db['CmHopperHistory'],{'as':_0x8615('0x142'),'foreignKey':_0x8615('0x140')});db[_0x8615('0x1c')][_0x8615('0x109')](db[_0x8615('0x10f')],{'as':_0x8615('0x10f'),'foreignKey':_0x8615('0x140')});db['VoiceQueue']['hasMany'](db['CmHopperBlack'],{'as':_0x8615('0x143'),'foreignKey':_0x8615('0x140')});db['VoiceQueue'][_0x8615('0x109')](db[_0x8615('0xd3')],{'as':_0x8615('0x144'),'foreignKey':_0x8615('0x140')});db[_0x8615('0x1c')][_0x8615('0x118')](db['Trunk'],{'as':_0x8615('0x28'),'foreignKey':_0x8615('0x145')});db[_0x8615('0x1c')]['belongsTo'](db[_0x8615('0x28')],{'as':'TrunkBackup','foreignKey':_0x8615('0x146')});db[_0x8615('0x1c')]['belongsTo'](db['Interval'],{'as':_0x8615('0x84'),'foreignKey':_0x8615('0x147')});db['VoiceQueue'][_0x8615('0x118')](db['Pause'],{'as':_0x8615('0x148'),'foreignKey':_0x8615('0x149')});db['VoiceQueue'][_0x8615('0x11a')](db[_0x8615('0xf2')],{'as':_0x8615('0x11e'),'through':'voice_queues_has_cm_lists'});db[_0x8615('0x1c')][_0x8615('0x11a')](db[_0x8615('0x14')],{'as':_0x8615('0x14a'),'through':_0x8615('0x2c')});db[_0x8615('0x1c')][_0x8615('0x11a')](db['Team'],{'as':_0x8615('0x14b'),'through':_0x8615('0x106')});db[_0x8615('0x1c')][_0x8615('0x11a')](db[_0x8615('0xf2')],{'as':_0x8615('0x14c'),'through':_0x8615('0x14d')});db[_0x8615('0x1e')][_0x8615('0x118')](db[_0x8615('0x14')],{'as':_0x8615('0x14'),'foreignKey':'UserId'});db[_0x8615('0x1f')][_0x8615('0x118')](db[_0x8615('0x14')],{'as':'User','foreignKey':_0x8615('0x10a')});db[_0x8615('0x20')][_0x8615('0x109')](db['VoiceMailMessage'],{'as':_0x8615('0x14e'),'onDelete':_0x8615('0x139'),'foreignKey':'mailboxuser','sourceKey':_0x8615('0x14f')});db[_0x8615('0x21')][_0x8615('0x118')](db['VoiceMail'],{'foreignKey':_0x8615('0x150'),'targetKey':_0x8615('0x14f')});db['VoiceCallReport']['hasMany'](db[_0x8615('0x25')],{'as':_0x8615('0x151'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x8615('0x109')](db[_0x8615('0x152')],{'as':'AgentReports','foreignKey':_0x8615('0x153'),'constraints':![]});db['VoiceCallReport'][_0x8615('0x118')](db[_0x8615('0x14')],{'as':_0x8615('0x14'),'foreignKey':_0x8615('0x10a')});db['VoiceCallReport']['belongsTo'](db['CmContact'],{'as':_0x8615('0x154'),'foreignKey':'ContactId'});db[_0x8615('0x155')][_0x8615('0x118')](db[_0x8615('0x12e')],{'as':'MailAccount','foreignKey':_0x8615('0x156')});db[_0x8615('0x39')][_0x8615('0x118')](db['MailAccount'],{'as':_0x8615('0x12e'),'foreignKey':_0x8615('0x156')});db[_0x8615('0x12e')][_0x8615('0x108')](db['MailServerIn'],{'as':_0x8615('0x157'),'onDelete':_0x8615('0x139')});db[_0x8615('0x12e')][_0x8615('0x108')](db['MailServerOut'],{'as':_0x8615('0x158'),'onDelete':_0x8615('0x139')});db[_0x8615('0x12e')][_0x8615('0x109')](db[_0x8615('0x81')],{'as':_0x8615('0x159'),'foreignKey':_0x8615('0x156')});db['MailAccount'][_0x8615('0x109')](db[_0x8615('0x7f')],{'as':'Answers','foreignKey':_0x8615('0x156')});db[_0x8615('0x12e')][_0x8615('0x109')](db['MailMessage'],{'as':_0x8615('0x14e'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x8615('0x109')](db[_0x8615('0x3f')],{'as':_0x8615('0x15a')});db[_0x8615('0x12e')][_0x8615('0x109')](db[_0x8615('0x43')],{'as':_0x8615('0x13b')});db['MailAccount'][_0x8615('0x118')](db[_0x8615('0xf2')],{'as':_0x8615('0x15b'),'foreignKey':_0x8615('0x15c')});db[_0x8615('0x12e')]['belongsTo'](db[_0x8615('0x8d')],{'as':_0x8615('0x8d'),'foreignKey':'TemplateId'});db[_0x8615('0x12e')][_0x8615('0x118')](db[_0x8615('0x86')],{'as':_0x8615('0x148'),'foreignKey':_0x8615('0x149')});db['MailAccount']['belongsToMany'](db[_0x8615('0x14')],{'as':'Agents','through':'user_has_mail_accounts'});db[_0x8615('0x3b')][_0x8615('0x11a')](db[_0x8615('0x14')],{'as':_0x8615('0x14a'),'through':_0x8615('0x30')});db[_0x8615('0x3b')]['belongsToMany'](db[_0x8615('0xe1')],{'through':'team_has_mail_queues','as':'Teams'});db['MailInteraction'][_0x8615('0x109')](db['MailMessage'],{'as':_0x8615('0x14e'),'onDelete':_0x8615('0x139'),'foreignKey':_0x8615('0x15d')});db[_0x8615('0x3f')][_0x8615('0x118')](db[_0x8615('0x12e')],{'as':_0x8615('0x15e'),'foreignKey':_0x8615('0x156')});db[_0x8615('0x3f')]['belongsTo'](db[_0x8615('0x70')],{'as':_0x8615('0x154'),'foreignKey':'ContactId'});db[_0x8615('0x3f')][_0x8615('0x118')](db['User'],{'as':_0x8615('0x15f'),'foreignKey':_0x8615('0x10a')});db[_0x8615('0x3f')]['belongsToMany'](db[_0x8615('0x8c')],{'through':_0x8615('0x160'),'as':_0x8615('0x161')});db[_0x8615('0x3f')][_0x8615('0x11a')](db[_0x8615('0x8c')],{'through':_0x8615('0x160'),'as':_0x8615('0x162')});db[_0x8615('0x3f')][_0x8615('0x11a')](db[_0x8615('0x14')],{'as':'Users','through':'user_has_mail_interactions','foreignKey':_0x8615('0x15d')});db[_0x8615('0x41')][_0x8615('0x109')](db[_0x8615('0x163')],{'as':'Attachments','onDelete':_0x8615('0x139')});db[_0x8615('0x41')]['belongsTo'](db[_0x8615('0x14')],{'as':_0x8615('0x14')});db[_0x8615('0x41')][_0x8615('0x118')](db['CmContact'],{'onDelete':_0x8615('0x139'),'as':_0x8615('0x154')});db[_0x8615('0x41')][_0x8615('0x118')](db['MailInteraction'],{'as':_0x8615('0x164'),'foreignKey':_0x8615('0x15d')});db['MailMessage']['belongsTo'](db[_0x8615('0x12e')],{'as':_0x8615('0x15e'),'foreignKey':_0x8615('0x156')});db['MailMessage'][_0x8615('0x118')](db['ChatWebsite'],{'as':_0x8615('0x60'),'foreignKey':_0x8615('0x165')});db['MailMessage'][_0x8615('0x118')](db[_0x8615('0x68')],{'as':_0x8615('0x68'),'foreignKey':_0x8615('0x166')});db[_0x8615('0x43')][_0x8615('0x118')](db[_0x8615('0x14')],{'onDelete':_0x8615('0x167')});db['MailApplication'][_0x8615('0x118')](db[_0x8615('0x3b')],{'onDelete':'restrict'});db[_0x8615('0x43')]['belongsTo'](db[_0x8615('0x12e')],{'onDelete':_0x8615('0x167')});db[_0x8615('0x43')][_0x8615('0x118')](db[_0x8615('0x84')],{'onDelete':_0x8615('0x167'),'foreignKey':_0x8615('0x147')});db[_0x8615('0x43')][_0x8615('0x118')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x8615('0x168')});db['MailQueueReport'][_0x8615('0x118')](db[_0x8615('0x12e')],{});db[_0x8615('0x169')][_0x8615('0x118')](db[_0x8615('0xf2')],{'as':_0x8615('0x15b'),'foreignKey':_0x8615('0x15c')});db[_0x8615('0x169')][_0x8615('0x118')](db[_0x8615('0x70')],{'as':_0x8615('0x154'),'foreignKey':_0x8615('0x16a')});db[_0x8615('0x169')][_0x8615('0x118')](db[_0x8615('0x3f')],{});db['MailQueueReport']['belongsTo'](db['MailMessage'],{});db[_0x8615('0x169')][_0x8615('0x118')](db[_0x8615('0x14')],{});db[_0x8615('0x169')][_0x8615('0x118')](db['MailQueue'],{});db[_0x8615('0x46')][_0x8615('0x109')](db['DashboardItem'],{'as':_0x8615('0x16b'),'onDelete':_0x8615('0x139')});db[_0x8615('0x12c')][_0x8615('0x109')](db[_0x8615('0x81')],{'as':_0x8615('0x159'),'foreignKey':'FaxAccountId'});db[_0x8615('0x12c')][_0x8615('0x109')](db[_0x8615('0x7f')],{'as':_0x8615('0x16c'),'foreignKey':'FaxAccountId'});db[_0x8615('0x12c')]['hasMany'](db['FaxInteraction'],{'as':'Interactions'});db[_0x8615('0x12c')][_0x8615('0x109')](db[_0x8615('0x4b')],{'as':_0x8615('0x13b')});db[_0x8615('0x12c')]['hasMany'](db[_0x8615('0x10c')],{'as':_0x8615('0x16d'),'onDelete':'cascade'});db[_0x8615('0x12c')]['hasMany'](db['FaxMessage'],{'as':_0x8615('0x14e')});db[_0x8615('0x12c')][_0x8615('0x118')](db['Trunk'],{'as':'Trunk'});db[_0x8615('0x12c')]['belongsTo'](db[_0x8615('0xf2')],{'as':_0x8615('0x15b'),'foreignKey':_0x8615('0x15c')});db[_0x8615('0x12c')][_0x8615('0x118')](db[_0x8615('0x86')],{'as':_0x8615('0x148'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x8615('0x12c')][_0x8615('0x11a')](db['User'],{'as':_0x8615('0x14a'),'through':_0x8615('0x12d')});db[_0x8615('0x4b')][_0x8615('0x118')](db[_0x8615('0x14')],{'onDelete':_0x8615('0x167')});db['FaxApplication'][_0x8615('0x118')](db[_0x8615('0x50')],{'onDelete':'restrict'});db[_0x8615('0x4b')][_0x8615('0x118')](db[_0x8615('0x12c')],{'onDelete':_0x8615('0x167')});db[_0x8615('0x4b')][_0x8615('0x118')](db['Tag'],{'onDelete':_0x8615('0x167'),'foreignKey':'TagId'});db['FaxInteraction'][_0x8615('0x109')](db[_0x8615('0x4f')],{'as':_0x8615('0x14e'),'onDelete':_0x8615('0x139'),'foreignKey':_0x8615('0x16e')});db[_0x8615('0x4d')][_0x8615('0x118')](db['FaxAccount'],{'as':'Account','foreignKey':_0x8615('0x16f')});db[_0x8615('0x4d')][_0x8615('0x118')](db[_0x8615('0x70')],{'as':_0x8615('0x154'),'foreignKey':_0x8615('0x16a')});db[_0x8615('0x4d')][_0x8615('0x118')](db[_0x8615('0x14')],{'as':_0x8615('0x15f'),'foreignKey':_0x8615('0x10a')});db['FaxInteraction'][_0x8615('0x11a')](db[_0x8615('0x8c')],{'through':_0x8615('0x170'),'as':'Tags'});db[_0x8615('0x4d')]['belongsToMany'](db[_0x8615('0x8c')],{'through':_0x8615('0x170'),'as':'ThroughTags'});db[_0x8615('0x4d')][_0x8615('0x11a')](db['User'],{'as':_0x8615('0x171'),'through':_0x8615('0x122'),'foreignKey':'FaxInteractionId'});db[_0x8615('0x4f')][_0x8615('0x118')](db['User'],{'onDelete':_0x8615('0x139'),'as':_0x8615('0x14')});db[_0x8615('0x4f')]['belongsTo'](db[_0x8615('0x4d')],{'as':_0x8615('0x164'),'foreignKey':_0x8615('0x16e')});db['FaxMessage'][_0x8615('0x118')](db[_0x8615('0x70')],{'onDelete':_0x8615('0x139'),'as':_0x8615('0x154')});db['FaxMessage'][_0x8615('0x118')](db['Attachment'],{'as':'Attachment','foreignKey':_0x8615('0x172')});db[_0x8615('0x4f')]['belongsTo'](db['FaxAccount'],{'as':'Account','foreignKey':_0x8615('0x16f')});db['FaxQueue'][_0x8615('0x11a')](db['User'],{'as':_0x8615('0x14a'),'through':_0x8615('0x32')});db[_0x8615('0x50')][_0x8615('0x11a')](db[_0x8615('0xe1')],{'through':_0x8615('0x173'),'as':_0x8615('0x14b')});db[_0x8615('0x52')]['belongsTo'](db[_0x8615('0x12c')],{});db['FaxQueueReport']['belongsTo'](db[_0x8615('0xf2')],{'as':'List','foreignKey':_0x8615('0x15c')});db[_0x8615('0x52')][_0x8615('0x118')](db[_0x8615('0x70')],{'as':_0x8615('0x154'),'foreignKey':'ContactId'});db[_0x8615('0x52')][_0x8615('0x118')](db[_0x8615('0x4d')],{});db['FaxQueueReport'][_0x8615('0x118')](db[_0x8615('0x4f')],{});db['FaxQueueReport'][_0x8615('0x118')](db[_0x8615('0x14')],{});db['FaxQueueReport'][_0x8615('0x118')](db[_0x8615('0x50')],{});db[_0x8615('0x54')]['hasMany'](db[_0x8615('0x81')],{'as':'Dispositions','foreignKey':'SmsAccountId'});db[_0x8615('0x54')][_0x8615('0x109')](db[_0x8615('0x7f')],{'as':'Answers','foreignKey':'SmsAccountId'});db[_0x8615('0x54')][_0x8615('0x109')](db['SmsMessage'],{'as':_0x8615('0x14e'),'foreignKey':_0x8615('0x174')});db['SmsAccount'][_0x8615('0x109')](db[_0x8615('0x112')],{'as':_0x8615('0x15a')});db[_0x8615('0x54')][_0x8615('0x109')](db[_0x8615('0x175')],{'as':_0x8615('0x13b')});db['SmsAccount'][_0x8615('0x118')](db['CmList'],{'as':'List','foreignKey':'ListId'});db['SmsAccount']['belongsTo'](db[_0x8615('0x86')],{'as':_0x8615('0x148'),'foreignKey':'mandatoryDispositionPauseId'});db['SmsAccount'][_0x8615('0x11a')](db[_0x8615('0x14')],{'as':_0x8615('0x14a'),'through':_0x8615('0x135')});db['SmsApplication'][_0x8615('0x118')](db[_0x8615('0x14')],{'onDelete':_0x8615('0x167')});db[_0x8615('0x175')]['belongsTo'](db[_0x8615('0x126')],{'onDelete':_0x8615('0x167')});db[_0x8615('0x175')][_0x8615('0x118')](db[_0x8615('0x54')],{'onDelete':_0x8615('0x167')});db['SmsApplication'][_0x8615('0x118')](db[_0x8615('0x84')],{'onDelete':_0x8615('0x167'),'foreignKey':_0x8615('0x147')});db[_0x8615('0x175')][_0x8615('0x118')](db['Tag'],{'onDelete':_0x8615('0x167'),'foreignKey':_0x8615('0x168')});db['SmsInteraction'][_0x8615('0x109')](db[_0x8615('0x176')],{'as':'Messages','onDelete':_0x8615('0x139'),'foreignKey':_0x8615('0x177')});db['SmsInteraction'][_0x8615('0x118')](db[_0x8615('0x54')],{'as':_0x8615('0x15e'),'foreignKey':_0x8615('0x174')});db['SmsInteraction'][_0x8615('0x118')](db[_0x8615('0x70')],{'as':'Contact','foreignKey':_0x8615('0x16a')});db[_0x8615('0x112')][_0x8615('0x118')](db[_0x8615('0x14')],{'as':_0x8615('0x15f'),'foreignKey':'UserId'});db['SmsInteraction'][_0x8615('0x11a')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x8615('0x161')});db[_0x8615('0x112')][_0x8615('0x11a')](db[_0x8615('0x8c')],{'through':_0x8615('0x178'),'as':'ThroughTags'});db[_0x8615('0x112')]['belongsToMany'](db[_0x8615('0x14')],{'as':_0x8615('0x171'),'through':_0x8615('0x123'),'foreignKey':_0x8615('0x177')});db[_0x8615('0x176')][_0x8615('0x118')](db[_0x8615('0x14')],{'as':_0x8615('0x14')});db[_0x8615('0x176')][_0x8615('0x118')](db[_0x8615('0x70')],{'onDelete':_0x8615('0x139'),'as':_0x8615('0x154')});db[_0x8615('0x176')][_0x8615('0x118')](db[_0x8615('0x112')],{'onDelete':_0x8615('0x139'),'as':_0x8615('0x164'),'foreignKey':_0x8615('0x177')});db[_0x8615('0x176')][_0x8615('0x118')](db[_0x8615('0x54')],{'as':_0x8615('0x15e'),'foreignKey':'SmsAccountId'});db['SmsQueue'][_0x8615('0x11a')](db[_0x8615('0x14')],{'as':_0x8615('0x14a'),'through':_0x8615('0x127'),'foreignKey':_0x8615('0x179')});db[_0x8615('0x126')]['belongsToMany'](db['Team'],{'through':'team_has_sms_queues','as':_0x8615('0x14b')});db[_0x8615('0x131')][_0x8615('0x109')](db['Disposition'],{'as':_0x8615('0x159'),'foreignKey':'OpenchannelAccountId'});db[_0x8615('0x131')]['hasMany'](db[_0x8615('0x7f')],{'as':_0x8615('0x16c'),'foreignKey':_0x8615('0x17a')});db[_0x8615('0x131')][_0x8615('0x109')](db['OpenchannelInteraction'],{'as':_0x8615('0x15a'),'foreignKey':'OpenchannelAccountId'});db[_0x8615('0x131')]['hasMany'](db[_0x8615('0x5d')],{'as':_0x8615('0x14e'),'foreignKey':_0x8615('0x17a')});db[_0x8615('0x131')][_0x8615('0x109')](db[_0x8615('0x59')],{'as':'Applications','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['belongsTo'](db[_0x8615('0xf2')],{'as':'List','foreignKey':'ListId'});db[_0x8615('0x131')][_0x8615('0x118')](db[_0x8615('0x86')],{'as':_0x8615('0x148'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x8615('0x131')][_0x8615('0x11a')](db[_0x8615('0x14')],{'as':_0x8615('0x14a'),'through':'user_has_openchannel_accounts'});db[_0x8615('0x59')][_0x8615('0x118')](db[_0x8615('0x14')],{'onDelete':'restrict'});db[_0x8615('0x59')][_0x8615('0x118')](db[_0x8615('0x5e')],{'onDelete':_0x8615('0x167'),'foreignKey':_0x8615('0x17b')});db[_0x8615('0x59')]['belongsTo'](db['OpenchannelAccount'],{'onDelete':_0x8615('0x167'),'foreignKey':_0x8615('0x17a')});db[_0x8615('0x59')]['belongsTo'](db[_0x8615('0x84')],{'onDelete':_0x8615('0x167'),'foreignKey':_0x8615('0x147')});db['OpenchannelApplication'][_0x8615('0x118')](db['Tag'],{'onDelete':_0x8615('0x167'),'foreignKey':_0x8615('0x168')});db[_0x8615('0x5b')][_0x8615('0x109')](db[_0x8615('0x5d')],{'as':_0x8615('0x14e'),'onDelete':_0x8615('0x139'),'foreignKey':_0x8615('0x17c')});db[_0x8615('0x5b')][_0x8615('0x118')](db['OpenchannelAccount'],{'as':_0x8615('0x15e'),'foreignKey':_0x8615('0x17a')});db[_0x8615('0x5b')][_0x8615('0x118')](db[_0x8615('0x70')],{'as':'Contact','foreignKey':_0x8615('0x16a')});db[_0x8615('0x5b')][_0x8615('0x118')](db['User'],{'as':_0x8615('0x15f'),'foreignKey':_0x8615('0x10a')});db[_0x8615('0x5b')][_0x8615('0x11a')](db[_0x8615('0x8c')],{'through':'openchannel_interaction_has_tags','as':_0x8615('0x161')});db['OpenchannelInteraction'][_0x8615('0x11a')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db['OpenchannelInteraction'][_0x8615('0x11a')](db['User'],{'as':_0x8615('0x171'),'through':'user_has_openchannel_interactions','foreignKey':_0x8615('0x17c')});db[_0x8615('0x5d')][_0x8615('0x118')](db[_0x8615('0x14')],{'onDelete':_0x8615('0x139'),'as':'User'});db[_0x8615('0x5d')][_0x8615('0x118')](db['CmContact'],{'onDelete':_0x8615('0x139'),'as':_0x8615('0x154')});db['OpenchannelMessage']['belongsTo'](db[_0x8615('0x5b')],{'onDelete':_0x8615('0x139'),'as':'Interaction','foreignKey':_0x8615('0x17c')});db['OpenchannelMessage'][_0x8615('0x118')](db[_0x8615('0x163')],{'as':_0x8615('0x163'),'foreignKey':_0x8615('0x172')});db[_0x8615('0x5d')][_0x8615('0x118')](db[_0x8615('0x131')],{'as':_0x8615('0x15e'),'foreignKey':_0x8615('0x17a')});db[_0x8615('0x5e')][_0x8615('0x11a')](db[_0x8615('0x14')],{'as':'Agents','through':_0x8615('0x35'),'foreignKey':_0x8615('0x17b')});db['OpenchannelQueue'][_0x8615('0x11a')](db['Team'],{'through':_0x8615('0x17d'),'as':_0x8615('0x14b')});db[_0x8615('0x60')][_0x8615('0x109')](db[_0x8615('0x81')],{'as':_0x8615('0x159'),'foreignKey':_0x8615('0x165')});db[_0x8615('0x60')]['hasMany'](db[_0x8615('0x7f')],{'as':'Answers','foreignKey':_0x8615('0x165')});db['ChatWebsite'][_0x8615('0x109')](db['ChatProactiveAction'],{'as':_0x8615('0x17e')});db['ChatWebsite'][_0x8615('0x109')](db['ChatInteraction'],{'as':_0x8615('0x15a')});db[_0x8615('0x60')][_0x8615('0x109')](db[_0x8615('0x63')],{'as':_0x8615('0x13b')});db[_0x8615('0x60')][_0x8615('0x109')](db['ChatMessage'],{'as':_0x8615('0x14e')});db['ChatWebsite'][_0x8615('0x118')](db['CmList'],{'as':_0x8615('0x15b'),'foreignKey':'ListId'});db['ChatWebsite']['belongsTo'](db['Interval'],{'as':_0x8615('0x84'),'foreignKey':_0x8615('0x147')});db[_0x8615('0x60')][_0x8615('0x118')](db[_0x8615('0x12e')],{'as':_0x8615('0x12e'),'foreignKey':_0x8615('0x156')});db['ChatWebsite']['belongsTo'](db['Pause'],{'as':_0x8615('0x148'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x8615('0x60')]['belongsToMany'](db['User'],{'as':_0x8615('0x14a'),'through':_0x8615('0x17f')});db['OpenchannelQueueReport'][_0x8615('0x118')](db['OpenchannelAccount'],{});db[_0x8615('0x62')][_0x8615('0x118')](db[_0x8615('0xf2')],{'as':'List','foreignKey':_0x8615('0x15c')});db[_0x8615('0x62')][_0x8615('0x118')](db['CmContact'],{'as':_0x8615('0x154'),'foreignKey':_0x8615('0x16a')});db['OpenchannelQueueReport'][_0x8615('0x118')](db['OpenchannelInteraction'],{});db[_0x8615('0x62')][_0x8615('0x118')](db['OpenchannelMessage'],{});db[_0x8615('0x62')][_0x8615('0x118')](db[_0x8615('0x14')],{});db[_0x8615('0x62')]['belongsTo'](db[_0x8615('0x5e')],{});db['ChatApplication']['belongsTo'](db['User'],{'as':_0x8615('0x180'),'foreignKey':'UserId','onDelete':'restrict'});db[_0x8615('0x63')][_0x8615('0x118')](db['ChatQueue'],{'as':'Queue','foreignKey':_0x8615('0x181'),'onDelete':_0x8615('0x167')});db[_0x8615('0x63')][_0x8615('0x118')](db[_0x8615('0x60')],{'as':_0x8615('0x182'),'foreignKey':_0x8615('0x165'),'onDelete':_0x8615('0x167')});db['ChatApplication']['belongsTo'](db[_0x8615('0x8c')],{'onDelete':'restrict','foreignKey':_0x8615('0x168')});db[_0x8615('0x65')][_0x8615('0x109')](db['ChatMessage'],{'as':_0x8615('0x14e'),'onDelete':_0x8615('0x139'),'foreignKey':_0x8615('0x183')});db['ChatInteraction'][_0x8615('0x118')](db[_0x8615('0x60')],{'as':'Account','foreignKey':_0x8615('0x165')});db[_0x8615('0x65')][_0x8615('0x118')](db[_0x8615('0x70')],{'as':_0x8615('0x154'),'foreignKey':_0x8615('0x16a')});db[_0x8615('0x65')][_0x8615('0x118')](db['User'],{'as':_0x8615('0x15f'),'foreignKey':_0x8615('0x10a')});db['ChatInteraction'][_0x8615('0x11a')](db[_0x8615('0x8c')],{'through':_0x8615('0x184'),'as':'Tags'});db[_0x8615('0x65')][_0x8615('0x11a')](db[_0x8615('0x8c')],{'through':'chat_interaction_has_tags','as':_0x8615('0x162')});db[_0x8615('0x65')][_0x8615('0x11a')](db['User'],{'as':'Users','through':_0x8615('0x185'),'foreignKey':_0x8615('0x183')});db[_0x8615('0x67')][_0x8615('0x118')](db[_0x8615('0x14')],{'onDelete':_0x8615('0x139'),'as':_0x8615('0x14')});db[_0x8615('0x67')]['belongsTo'](db[_0x8615('0x70')],{'onDelete':_0x8615('0x139'),'as':_0x8615('0x154'),'foreignKey':_0x8615('0x16a')});db[_0x8615('0x67')]['belongsTo'](db[_0x8615('0x65')],{'onDelete':_0x8615('0x139'),'as':_0x8615('0x164'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x8615('0x118')](db['Attachment'],{'as':'Attachment','foreignKey':_0x8615('0x172')});db[_0x8615('0x67')][_0x8615('0x118')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x8615('0x165')});db[_0x8615('0x68')][_0x8615('0x109')](db['Attachment'],{'as':_0x8615('0x186'),'foreignKey':_0x8615('0x166'),'onDelete':_0x8615('0x139'),'hooks':!![]});db[_0x8615('0x68')][_0x8615('0x118')](db[_0x8615('0x70')],{'onDelete':_0x8615('0x139'),'as':_0x8615('0x154'),'foreignKey':_0x8615('0x16a')});db[_0x8615('0x68')][_0x8615('0x118')](db[_0x8615('0x60')],{'as':'Account','foreignKey':_0x8615('0x165')});db['ChatQueue'][_0x8615('0x11a')](db[_0x8615('0x14')],{'as':_0x8615('0x14a'),'through':_0x8615('0x2e'),'hooks':!![]});db['ChatQueue'][_0x8615('0x11a')](db[_0x8615('0xe1')],{'through':_0x8615('0x187'),'as':'Teams'});db[_0x8615('0x6b')][_0x8615('0x109')](db[_0x8615('0xcd')],{'as':_0x8615('0x14e'),'foreignKey':'ChatGroupId','onDelete':_0x8615('0x139')});db['ChatGroup']['belongsToMany'](db[_0x8615('0x14')],{'as':_0x8615('0x13f'),'through':_0x8615('0x188')});db['ChatProactiveAction'][_0x8615('0x118')](db[_0x8615('0x60')],{'as':_0x8615('0x182'),'foreignKey':_0x8615('0x165')});db[_0x8615('0x6e')]['hasMany'](db[_0x8615('0x70')],{'as':_0x8615('0x11c'),'foreignKey':_0x8615('0x189')});db[_0x8615('0x70')][_0x8615('0x109')](db[_0x8615('0x72')],{'as':_0x8615('0x141'),'foreignKey':_0x8615('0x16a')});db[_0x8615('0x70')][_0x8615('0x109')](db[_0x8615('0x74')],{'as':_0x8615('0x10e'),'foreignKey':_0x8615('0x16a')});db['CmContact'][_0x8615('0x109')](db[_0x8615('0x76')],{'as':_0x8615('0x142'),'foreignKey':'ContactId'});db[_0x8615('0x70')]['hasMany'](db[_0x8615('0x10f')],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db[_0x8615('0x70')][_0x8615('0x109')](db[_0x8615('0xd3')],{'as':_0x8615('0x144'),'foreignKey':_0x8615('0x16a')});db['CmContact'][_0x8615('0x109')](db[_0x8615('0x5b')],{'as':_0x8615('0x110'),'foreignKey':_0x8615('0x16a'),'onDelete':_0x8615('0x167')});db[_0x8615('0x70')][_0x8615('0x109')](db[_0x8615('0x65')],{'as':_0x8615('0x111'),'foreignKey':_0x8615('0x16a'),'onDelete':_0x8615('0x167')});db[_0x8615('0x70')][_0x8615('0x109')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x8615('0x16a'),'onDelete':_0x8615('0x167')});db['CmContact'][_0x8615('0x109')](db[_0x8615('0x4d')],{'as':'FaxInteractions','foreignKey':_0x8615('0x16a'),'onDelete':_0x8615('0x167')});db[_0x8615('0x70')]['hasMany'](db[_0x8615('0x3f')],{'as':_0x8615('0x115'),'foreignKey':_0x8615('0x16a'),'onDelete':_0x8615('0x167')});db[_0x8615('0x70')][_0x8615('0x118')](db[_0x8615('0x6e')],{'as':_0x8615('0x18a'),'foreignKey':_0x8615('0x189')});db[_0x8615('0x70')]['belongsTo'](db[_0x8615('0xf2')],{'as':_0x8615('0x15b'),'foreignKey':_0x8615('0x15c'),'onDelete':_0x8615('0x139')});db['CmContact']['belongsToMany'](db[_0x8615('0x14')],{'as':'Users','through':'cm_user_has_contacts'});db['CmContact'][_0x8615('0x11a')](db[_0x8615('0x8c')],{'as':_0x8615('0x161'),'through':_0x8615('0x18b')});db['CmContact'][_0x8615('0x11a')](db[_0x8615('0x8c')],{'through':_0x8615('0x18b'),'as':_0x8615('0x162')});db[_0x8615('0x72')]['belongsTo'](db[_0x8615('0x70')],{'as':'Contact','foreignKey':_0x8615('0x16a'),'onDelete':_0x8615('0x139')});db[_0x8615('0x72')][_0x8615('0x118')](db[_0x8615('0xf2')],{'as':_0x8615('0x15b'),'foreignKey':_0x8615('0x15c'),'onDelete':_0x8615('0x139')});db['CmHopper'][_0x8615('0x118')](db['User'],{'as':_0x8615('0x180'),'foreignKey':'UserId'});db[_0x8615('0x72')][_0x8615('0x118')](db['VoiceQueue'],{'as':_0x8615('0x18c'),'foreignKey':_0x8615('0x140'),'onDelete':_0x8615('0x139')});db[_0x8615('0x72')][_0x8615('0x118')](db[_0x8615('0x18d')],{'as':_0x8615('0x18d'),'foreignKey':_0x8615('0x18e'),'onDelete':_0x8615('0x139')});db[_0x8615('0x72')][_0x8615('0x118')](db[_0x8615('0x14')],{'as':'Owner','foreignKey':_0x8615('0x18f')});db['CmHopperBlack']['belongsTo'](db[_0x8615('0x70')],{'as':'Contact','foreignKey':_0x8615('0x16a'),'onDelete':_0x8615('0x139')});db[_0x8615('0x73')][_0x8615('0x118')](db[_0x8615('0xf2')],{'as':_0x8615('0x15b'),'foreignKey':_0x8615('0x15c'),'onDelete':_0x8615('0x139')});db[_0x8615('0x73')][_0x8615('0x118')](db[_0x8615('0x1c')],{'as':_0x8615('0x18c'),'foreignKey':_0x8615('0x140'),'onDelete':_0x8615('0x139')});db[_0x8615('0x73')][_0x8615('0x118')](db['Campaign'],{'as':'Campaign','foreignKey':_0x8615('0x18e'),'onDelete':_0x8615('0x139')});db[_0x8615('0x7d')][_0x8615('0x109')](db[_0x8615('0x83')],{'as':{'plural':'All','singular':_0x8615('0x190')},'foreignKey':_0x8615('0x191'),'onDelete':_0x8615('0x139'),'hooks':!![]});db[_0x8615('0x7d')][_0x8615('0x109')](db[_0x8615('0x83')],{'as':{'plural':_0x8615('0x192'),'singular':'OneAny'},'foreignKey':_0x8615('0x193'),'onDelete':_0x8615('0x139'),'hooks':!![]});db[_0x8615('0x7d')]['hasMany'](db[_0x8615('0x7b')],{'as':_0x8615('0x194'),'foreignKey':_0x8615('0x195'),'onDelete':_0x8615('0x139'),'hooks':!![]});db[_0x8615('0x81')][_0x8615('0x109')](db['Disposition'],{'as':_0x8615('0x159'),'foreignKey':_0x8615('0x196'),'onDelete':'cascade'});db[_0x8615('0x84')][_0x8615('0x109')](db[_0x8615('0x84')],{'as':_0x8615('0x197'),'foreignKey':_0x8615('0x147'),'onDelete':_0x8615('0x139'),'hooks':!![],'required':![]});db[_0x8615('0x84')]['hasMany'](db[_0x8615('0x10c')],{'as':_0x8615('0x10d'),'foreignKey':'IntervalId','onDelete':_0x8615('0x167')});db['Interval'][_0x8615('0x109')](db[_0x8615('0x43')],{'as':_0x8615('0x198'),'foreignKey':'IntervalId'});db[_0x8615('0x84')]['hasMany'](db[_0x8615('0x63')],{'as':_0x8615('0x199'),'foreignKey':_0x8615('0x147')});db[_0x8615('0x84')][_0x8615('0x109')](db[_0x8615('0x4b')],{'as':_0x8615('0x19a'),'foreignKey':'IntervalId'});db[_0x8615('0x84')]['hasMany'](db[_0x8615('0x175')],{'as':_0x8615('0x19b'),'foreignKey':_0x8615('0x147')});db[_0x8615('0x19c')][_0x8615('0x118')](db[_0x8615('0x12e')],{});db['Schedule'][_0x8615('0x118')](db[_0x8615('0x98')],{'foreignKey':'DefaultReportId'});db[_0x8615('0x19c')][_0x8615('0x118')](db[_0x8615('0x96')],{'foreignKey':_0x8615('0x19d')});db[_0x8615('0x8a')][_0x8615('0x11a')](db[_0x8615('0x13c')],{'as':_0x8615('0x19e'),'through':_0x8615('0x13e'),'onDelete':_0x8615('0x167')});db[_0x8615('0x8c')][_0x8615('0x11a')](db[_0x8615('0x70')],{'through':_0x8615('0x18b')});db['Tag'][_0x8615('0x11a')](db[_0x8615('0x65')],{'through':_0x8615('0x184')});db['Tag'][_0x8615('0x11a')](db[_0x8615('0x3f')],{'through':_0x8615('0x160')});db['Tag']['belongsToMany'](db[_0x8615('0x112')],{'through':_0x8615('0x178')});db[_0x8615('0x8c')][_0x8615('0x11a')](db[_0x8615('0x4d')],{'through':'fax_interaction_has_tags'});db['Tag'][_0x8615('0x11a')](db[_0x8615('0x5b')],{'through':'openchannel_interaction_has_tags'});db[_0x8615('0x8c')]['belongsToMany'](db[_0x8615('0xfc')],{'through':_0x8615('0x19f')});db[_0x8615('0x8f')]['hasMany'](db[_0x8615('0x83')],{'as':{'plural':'AllConditions','singular':_0x8615('0x1a0')},'foreignKey':_0x8615('0x1a1'),'onDelete':_0x8615('0x139'),'hooks':!![]});db[_0x8615('0x8f')][_0x8615('0x109')](db[_0x8615('0x83')],{'as':{'plural':_0x8615('0x1a2'),'singular':'AnyCondition'},'foreignKey':_0x8615('0x1a3'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x8615('0x109')](db['Action'],{'as':_0x8615('0x194'),'foreignKey':_0x8615('0x1a4'),'onDelete':_0x8615('0x139'),'hooks':!![]});db[_0x8615('0x96')]['hasMany'](db[_0x8615('0x9d')],{'as':_0x8615('0x1a5'),'onDelete':_0x8615('0x139'),'foreignKey':_0x8615('0x19d'),'hooks':!![]});db[_0x8615('0x98')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x8615('0x1a5'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x8615('0x9c')][_0x8615('0x109')](db[_0x8615('0x9d')],{'as':_0x8615('0x1a5'),'onDelete':_0x8615('0x139'),'foreignKey':_0x8615('0x1a6')});db['AnalyticFieldReport'][_0x8615('0x118')](db[_0x8615('0x9c')],{'foreignKey':'MetricId'});db[_0x8615('0xa0')][_0x8615('0x109')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0x8615('0x139'),'foreignKey':_0x8615('0x1a7')});db[_0x8615('0xa1')][_0x8615('0x109')](db['SalesforceField'],{'as':_0x8615('0x1a8'),'onDelete':_0x8615('0x139'),'foreignKey':_0x8615('0x1a9')});db[_0x8615('0xa1')]['hasMany'](db[_0x8615('0xa3')],{'as':_0x8615('0x1aa'),'onDelete':_0x8615('0x139'),'foreignKey':_0x8615('0x1ab')});db[_0x8615('0xa1')][_0x8615('0x109')](db[_0x8615('0xa3')],{'as':_0x8615('0x1a5'),'onDelete':'cascade','foreignKey':_0x8615('0x1ac')});db['SalesforceConfiguration'][_0x8615('0x118')](db['SalesforceAccount'],{'as':_0x8615('0x15e'),'foreignKey':'AccountId'});db[_0x8615('0xa3')][_0x8615('0x109')](db[_0x8615('0xa3')],{'as':'Subject','foreignKey':_0x8615('0x1a9')});db[_0x8615('0xa3')][_0x8615('0x109')](db[_0x8615('0xa3')],{'as':_0x8615('0x1ad'),'foreignKey':'DescriptionId'});db[_0x8615('0xa3')]['hasMany'](db[_0x8615('0xa3')],{'as':_0x8615('0x1ae'),'foreignKey':'FieldId'});db[_0x8615('0xa3')][_0x8615('0x118')](db[_0x8615('0x91')],{'as':_0x8615('0x91'),'foreignKey':_0x8615('0x1af')});db[_0x8615('0x1b0')][_0x8615('0x109')](db[_0x8615('0xa4')],{'as':'Configurations','onDelete':_0x8615('0x139'),'foreignKey':'AccountId'});db[_0x8615('0xa4')][_0x8615('0x109')](db[_0x8615('0xa6')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x8615('0x1a9')});db[_0x8615('0xa4')][_0x8615('0x109')](db['SugarcrmField'],{'as':_0x8615('0x1aa'),'onDelete':'cascade','foreignKey':_0x8615('0x1ab')});db[_0x8615('0xa4')][_0x8615('0x109')](db[_0x8615('0xa6')],{'as':_0x8615('0x1a5'),'onDelete':_0x8615('0x139'),'foreignKey':_0x8615('0x1ac')});db['SugarcrmConfiguration'][_0x8615('0x118')](db[_0x8615('0x1b0')],{'as':'Account','foreignKey':_0x8615('0x1a7')});db[_0x8615('0xa6')][_0x8615('0x109')](db['SugarcrmField'],{'as':_0x8615('0x1b1'),'foreignKey':_0x8615('0x1a9')});db['SugarcrmField']['hasMany'](db[_0x8615('0xa6')],{'as':_0x8615('0x1ad'),'foreignKey':_0x8615('0x1ab')});db['SugarcrmField'][_0x8615('0x109')](db[_0x8615('0xa6')],{'as':_0x8615('0x1ae'),'foreignKey':_0x8615('0x1ac')});db['SugarcrmField']['belongsTo'](db[_0x8615('0x91')],{'as':'Variable','foreignKey':_0x8615('0x1af')});db[_0x8615('0x1b2')][_0x8615('0x109')](db['DeskConfiguration'],{'as':_0x8615('0x1b3'),'onDelete':_0x8615('0x139'),'foreignKey':_0x8615('0x1a7')});db[_0x8615('0xa9')][_0x8615('0x109')](db['DeskField'],{'as':_0x8615('0x1a8'),'onDelete':_0x8615('0x139'),'foreignKey':_0x8615('0x1a9')});db[_0x8615('0xa9')]['hasMany'](db[_0x8615('0xab')],{'as':_0x8615('0x1aa'),'onDelete':_0x8615('0x139'),'foreignKey':_0x8615('0x1ab')});db[_0x8615('0xa9')][_0x8615('0x109')](db[_0x8615('0xab')],{'as':_0x8615('0x1a5'),'onDelete':_0x8615('0x139'),'foreignKey':_0x8615('0x1ac')});db[_0x8615('0xa9')][_0x8615('0x118')](db['DeskAccount'],{'as':_0x8615('0x15e'),'foreignKey':'AccountId'});db[_0x8615('0xa9')][_0x8615('0x11a')](db['Tag'],{'through':_0x8615('0x1b4')});db['DeskField'][_0x8615('0x109')](db[_0x8615('0xab')],{'as':_0x8615('0x1b1'),'foreignKey':'SubjectId'});db[_0x8615('0xab')][_0x8615('0x109')](db['DeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['DeskField']['hasMany'](db[_0x8615('0xab')],{'as':_0x8615('0x1ae'),'foreignKey':_0x8615('0x1ac')});db[_0x8615('0xab')][_0x8615('0x118')](db[_0x8615('0x91')],{'as':_0x8615('0x91'),'foreignKey':_0x8615('0x1af')});db[_0x8615('0x1b5')]['hasMany'](db[_0x8615('0x1b6')],{'as':'Configurations','onDelete':_0x8615('0x139'),'foreignKey':_0x8615('0x1a7')});db[_0x8615('0x1b6')][_0x8615('0x109')](db[_0x8615('0xaf')],{'as':_0x8615('0x1a8'),'onDelete':'cascade','foreignKey':_0x8615('0x1a9')});db[_0x8615('0x1b6')][_0x8615('0x109')](db[_0x8615('0xaf')],{'as':_0x8615('0x1aa'),'onDelete':_0x8615('0x139'),'foreignKey':'DescriptionId'});db[_0x8615('0x1b6')][_0x8615('0x109')](db[_0x8615('0xaf')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x8615('0x1ac')});db[_0x8615('0x1b6')]['belongsTo'](db['ZohoAccount'],{'as':_0x8615('0x15e'),'foreignKey':_0x8615('0x1a7')});db[_0x8615('0xaf')][_0x8615('0x109')](db[_0x8615('0xaf')],{'as':_0x8615('0x1b1'),'foreignKey':_0x8615('0x1a9')});db['ZohoField'][_0x8615('0x109')](db[_0x8615('0xaf')],{'as':_0x8615('0x1ad'),'foreignKey':_0x8615('0x1ab')});db[_0x8615('0xaf')][_0x8615('0x109')](db[_0x8615('0xaf')],{'as':_0x8615('0x1ae'),'foreignKey':_0x8615('0x1ac')});db[_0x8615('0xaf')][_0x8615('0x118')](db[_0x8615('0x91')],{'as':_0x8615('0x91'),'foreignKey':_0x8615('0x1af')});db[_0x8615('0x1b7')]['hasMany'](db[_0x8615('0x1b8')],{'as':_0x8615('0x1b3'),'onDelete':'cascade','foreignKey':_0x8615('0x1a7')});db[_0x8615('0x1b8')]['hasMany'](db['ZendeskField'],{'as':'Subjects','foreignKey':_0x8615('0x1a9')});db[_0x8615('0x1b8')]['hasMany'](db['ZendeskField'],{'as':_0x8615('0x1aa'),'foreignKey':_0x8615('0x1ab')});db[_0x8615('0x1b8')]['hasMany'](db[_0x8615('0x1b9')],{'as':_0x8615('0x1a5'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0x8615('0x118')](db[_0x8615('0x1b7')],{'as':_0x8615('0x15e'),'foreignKey':'AccountId'});db[_0x8615('0x1b8')][_0x8615('0x11a')](db[_0x8615('0x8c')],{'through':_0x8615('0x1ba')});db[_0x8615('0x1b9')][_0x8615('0x109')](db[_0x8615('0x1b9')],{'as':_0x8615('0x1b1'),'foreignKey':_0x8615('0x1a9')});db[_0x8615('0x1b9')][_0x8615('0x109')](db['ZendeskField'],{'as':_0x8615('0x1ad'),'foreignKey':_0x8615('0x1ab')});db['ZendeskField'][_0x8615('0x109')](db[_0x8615('0x1b9')],{'as':_0x8615('0x1ae'),'foreignKey':_0x8615('0x1ac')});db['ZendeskField']['belongsTo'](db[_0x8615('0x91')],{'as':_0x8615('0x91'),'foreignKey':_0x8615('0x1af')});db['FreshdeskAccount']['hasMany'](db[_0x8615('0xb4')],{'as':'Configurations','onDelete':_0x8615('0x139'),'foreignKey':'AccountId'});db[_0x8615('0xb4')][_0x8615('0x109')](db[_0x8615('0xb5')],{'as':'Subjects','onDelete':_0x8615('0x139'),'foreignKey':'SubjectId'});db[_0x8615('0xb4')][_0x8615('0x109')](db[_0x8615('0xb5')],{'as':_0x8615('0x1aa'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x8615('0xb4')]['hasMany'](db[_0x8615('0xb5')],{'as':_0x8615('0x1a5'),'onDelete':_0x8615('0x139'),'foreignKey':_0x8615('0x1ac')});db[_0x8615('0xb4')]['belongsTo'](db[_0x8615('0xb3')],{'as':_0x8615('0x15e'),'foreignKey':'AccountId'});db[_0x8615('0xb4')][_0x8615('0x11a')](db[_0x8615('0x8c')],{'through':_0x8615('0x1bb')});db[_0x8615('0xb5')][_0x8615('0x109')](db[_0x8615('0xb5')],{'as':_0x8615('0x1b1'),'foreignKey':_0x8615('0x1a9')});db[_0x8615('0xb5')][_0x8615('0x109')](db[_0x8615('0xb5')],{'as':'Description','foreignKey':_0x8615('0x1ab')});db[_0x8615('0xb5')][_0x8615('0x109')](db[_0x8615('0xb5')],{'as':'Field','foreignKey':'FieldId'});db[_0x8615('0xb5')][_0x8615('0x118')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x8615('0xb7')][_0x8615('0x109')](db[_0x8615('0xb9')],{'as':_0x8615('0x1b3'),'onDelete':'cascade','foreignKey':_0x8615('0x1a7')});db[_0x8615('0xb9')][_0x8615('0x109')](db[_0x8615('0xbb')],{'as':'Subjects','foreignKey':_0x8615('0x1a9')});db['VtigerConfiguration'][_0x8615('0x109')](db['VtigerField'],{'as':_0x8615('0x1aa'),'foreignKey':_0x8615('0x1ab')});db[_0x8615('0xb9')]['hasMany'](db['VtigerField'],{'as':'Fields','foreignKey':_0x8615('0x1ac')});db[_0x8615('0xb9')]['belongsTo'](db[_0x8615('0xb7')],{'as':_0x8615('0x15e'),'foreignKey':_0x8615('0x1a7')});db['VtigerField'][_0x8615('0x109')](db[_0x8615('0xbb')],{'as':_0x8615('0x1b1'),'foreignKey':'SubjectId'});db[_0x8615('0xbb')][_0x8615('0x109')](db['VtigerField'],{'as':_0x8615('0x1ad'),'foreignKey':_0x8615('0x1ab')});db[_0x8615('0xbb')][_0x8615('0x109')](db[_0x8615('0xbb')],{'as':_0x8615('0x1ae'),'foreignKey':_0x8615('0x1ac')});db[_0x8615('0xbb')][_0x8615('0x118')](db[_0x8615('0x91')],{'as':_0x8615('0x91'),'foreignKey':_0x8615('0x1af')});db[_0x8615('0x1bc')]['hasMany'](db[_0x8615('0x1bd')],{'as':_0x8615('0x1b3'),'onDelete':_0x8615('0x139'),'foreignKey':_0x8615('0x1a7')});db[_0x8615('0x1bd')][_0x8615('0x109')](db[_0x8615('0xbf')],{'as':_0x8615('0x1a8'),'foreignKey':'SubjectId'});db[_0x8615('0x1bd')][_0x8615('0x109')](db[_0x8615('0xbf')],{'as':_0x8615('0x1aa'),'foreignKey':_0x8615('0x1ab')});db[_0x8615('0x1bd')]['hasMany'](db[_0x8615('0xbf')],{'as':_0x8615('0x1a5'),'foreignKey':_0x8615('0x1ac')});db[_0x8615('0x1bd')][_0x8615('0x118')](db[_0x8615('0x1bc')],{'as':_0x8615('0x15e'),'foreignKey':'AccountId'});db[_0x8615('0xbf')]['hasMany'](db[_0x8615('0xbf')],{'as':'Subject','foreignKey':'SubjectId'});db['ServicenowField'][_0x8615('0x109')](db['ServicenowField'],{'as':_0x8615('0x1ad'),'foreignKey':_0x8615('0x1ab')});db[_0x8615('0xbf')][_0x8615('0x109')](db[_0x8615('0xbf')],{'as':_0x8615('0x1ae'),'foreignKey':_0x8615('0x1ac')});db['ServicenowField'][_0x8615('0x118')](db[_0x8615('0x91')],{'as':_0x8615('0x91'),'foreignKey':_0x8615('0x1af')});db['Dynamics365Account'][_0x8615('0x109')](db['Dynamics365Configuration'],{'as':'Configurations','onDelete':_0x8615('0x139'),'foreignKey':_0x8615('0x1a7')});db[_0x8615('0xc3')][_0x8615('0x109')](db[_0x8615('0xc5')],{'as':_0x8615('0x1a8'),'onDelete':'cascade','foreignKey':_0x8615('0x1a9')});db[_0x8615('0xc3')]['hasMany'](db[_0x8615('0xc5')],{'as':_0x8615('0x1aa'),'onDelete':_0x8615('0x139'),'foreignKey':_0x8615('0x1ab')});db[_0x8615('0xc3')][_0x8615('0x109')](db[_0x8615('0xc5')],{'as':_0x8615('0x1a5'),'onDelete':'cascade','foreignKey':_0x8615('0x1ac')});db['Dynamics365Configuration'][_0x8615('0x118')](db['Dynamics365Account'],{'as':_0x8615('0x15e'),'foreignKey':_0x8615('0x1a7')});db[_0x8615('0xc5')][_0x8615('0x109')](db[_0x8615('0xc5')],{'as':_0x8615('0x1b1'),'foreignKey':_0x8615('0x1a9')});db[_0x8615('0xc5')]['hasMany'](db[_0x8615('0xc5')],{'as':'Description','foreignKey':_0x8615('0x1ab')});db[_0x8615('0xc5')][_0x8615('0x109')](db[_0x8615('0xc5')],{'as':_0x8615('0x1ae'),'foreignKey':_0x8615('0x1ac')});db[_0x8615('0xc5')][_0x8615('0x118')](db['Variable'],{'as':_0x8615('0x91'),'foreignKey':_0x8615('0x1af')});db[_0x8615('0xc7')][_0x8615('0x109')](db[_0x8615('0x1be')],{'as':_0x8615('0x1b3'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x8615('0x1be')][_0x8615('0x109')](db['FreshsalesField'],{'as':_0x8615('0x1a8'),'foreignKey':_0x8615('0x1a9')});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':_0x8615('0x1aa'),'foreignKey':_0x8615('0x1ab')});db[_0x8615('0x1be')][_0x8615('0x109')](db['FreshsalesField'],{'as':_0x8615('0x1a5'),'foreignKey':'FieldId'});db[_0x8615('0x1be')][_0x8615('0x118')](db[_0x8615('0xc7')],{'as':_0x8615('0x15e'),'foreignKey':'AccountId'});db[_0x8615('0xca')]['hasMany'](db[_0x8615('0xca')],{'as':_0x8615('0x1b1'),'foreignKey':_0x8615('0x1a9')});db[_0x8615('0xca')]['hasMany'](db['FreshsalesField'],{'as':_0x8615('0x1ad'),'foreignKey':'DescriptionId'});db[_0x8615('0xca')][_0x8615('0x109')](db['FreshsalesField'],{'as':_0x8615('0x1ae'),'foreignKey':_0x8615('0x1ac')});db[_0x8615('0xca')][_0x8615('0x118')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db['ChatQueueReport'][_0x8615('0x118')](db[_0x8615('0x60')],{});db[_0x8615('0x1bf')][_0x8615('0x118')](db[_0x8615('0xf2')],{'as':_0x8615('0x15b'),'foreignKey':'ListId'});db[_0x8615('0x1bf')][_0x8615('0x118')](db['CmContact'],{'as':_0x8615('0x154'),'foreignKey':_0x8615('0x16a')});db[_0x8615('0x1bf')][_0x8615('0x118')](db[_0x8615('0x65')],{});db[_0x8615('0x1bf')][_0x8615('0x118')](db[_0x8615('0x67')],{});db[_0x8615('0x1bf')]['belongsTo'](db['User'],{});db[_0x8615('0x1bf')][_0x8615('0x118')](db[_0x8615('0x69')],{});db[_0x8615('0xcd')][_0x8615('0x118')](db['User'],{'onDelete':_0x8615('0x139'),'foreignKey':_0x8615('0x1c0')});db[_0x8615('0xcd')]['belongsTo'](db['User'],{'onDelete':_0x8615('0x139'),'foreignKey':_0x8615('0x1c1')});db[_0x8615('0xd3')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0x8615('0x139')});db[_0x8615('0xd3')][_0x8615('0x109')](db[_0x8615('0xcf')],{'foreignKey':_0x8615('0x1c2'),'onDelete':_0x8615('0x139')});db[_0x8615('0xd5')][_0x8615('0x118')](db[_0x8615('0x54')],{});db['SmsQueueReport']['belongsTo'](db[_0x8615('0xf2')],{'as':_0x8615('0x15b'),'foreignKey':_0x8615('0x15c')});db['SmsQueueReport'][_0x8615('0x118')](db['CmContact'],{'as':_0x8615('0x154'),'foreignKey':'ContactId'});db[_0x8615('0xd5')][_0x8615('0x118')](db[_0x8615('0x112')],{});db[_0x8615('0xd5')][_0x8615('0x118')](db[_0x8615('0x176')],{});db[_0x8615('0xd5')][_0x8615('0x118')](db[_0x8615('0x14')],{});db[_0x8615('0xd5')][_0x8615('0x118')](db[_0x8615('0x126')],{});db[_0x8615('0x1c3')][_0x8615('0x109')](db[_0x8615('0xd3')],{'foreignKey':_0x8615('0x1c4')});db['JscriptyProject'][_0x8615('0x109')](db[_0x8615('0xd1')],{'foreignKey':_0x8615('0x1c4')});db[_0x8615('0x1c3')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x8615('0x1c4')});db['SquareProject'][_0x8615('0x11a')](db[_0x8615('0x14')],{'as':'Users','through':'user_has_square_projects'});db[_0x8615('0xe1')]['belongsToMany'](db[_0x8615('0x14')],{'as':'Agents','through':_0x8615('0x120')});db['Team'][_0x8615('0x11a')](db[_0x8615('0x1c')],{'through':_0x8615('0x106'),'as':_0x8615('0x1c5')});db['Team']['belongsToMany'](db[_0x8615('0x3b')],{'through':'team_has_mail_queues','as':'MailQueues'});db['Team'][_0x8615('0x11a')](db[_0x8615('0x69')],{'through':_0x8615('0x187'),'as':'ChatQueues'});db['Team'][_0x8615('0x11a')](db[_0x8615('0x50')],{'through':'team_has_fax_queues','as':_0x8615('0x1c6')});db[_0x8615('0xe1')][_0x8615('0x11a')](db['SmsQueue'],{'through':_0x8615('0x1c7'),'as':_0x8615('0x1c8')});db[_0x8615('0xe1')][_0x8615('0x11a')](db[_0x8615('0x5e')],{'through':_0x8615('0x17d'),'as':'OpenchannelQueues'});db[_0x8615('0xe1')][_0x8615('0x11a')](db[_0x8615('0x103')],{'through':_0x8615('0x1c9'),'as':_0x8615('0x128')});db[_0x8615('0x18d')]['hasMany'](db['CmHopper'],{'as':_0x8615('0x141'),'foreignKey':_0x8615('0x18e')});db[_0x8615('0x18d')]['hasMany'](db['CmHopperFinal'],{'as':_0x8615('0x10e'),'foreignKey':_0x8615('0x18e')});db[_0x8615('0x18d')][_0x8615('0x109')](db['CmHopperHistory'],{'as':_0x8615('0x142'),'foreignKey':'CampaignId'});db[_0x8615('0x18d')]['hasMany'](db[_0x8615('0x73')],{'as':_0x8615('0x143'),'foreignKey':_0x8615('0x18e')});db[_0x8615('0x18d')][_0x8615('0x118')](db[_0x8615('0x28')],{'as':'Trunk','foreignKey':_0x8615('0x145')});db[_0x8615('0x18d')][_0x8615('0x118')](db[_0x8615('0x28')],{'as':'TrunkBackup','foreignKey':_0x8615('0x146')});db[_0x8615('0x18d')][_0x8615('0x118')](db['Interval'],{'as':_0x8615('0x84'),'foreignKey':_0x8615('0x147')});db[_0x8615('0x18d')][_0x8615('0x118')](db[_0x8615('0x1ca')],{'as':_0x8615('0x1ca'),'foreignKey':_0x8615('0x1cb')});db[_0x8615('0x18d')][_0x8615('0x11a')](db[_0x8615('0xf2')],{'as':_0x8615('0x11e'),'through':_0x8615('0x1cc')});db[_0x8615('0x18d')][_0x8615('0x11a')](db[_0x8615('0xf2')],{'as':'BlackLists','through':_0x8615('0x1cd')});db[_0x8615('0x163')][_0x8615('0x118')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0x8615('0x166')});db['MailTransferReport']['belongsTo'](db[_0x8615('0x41')],{});db[_0x8615('0x1ce')][_0x8615('0x118')](db[_0x8615('0x3f')],{});db[_0x8615('0x1ce')][_0x8615('0x118')](db[_0x8615('0x12e')],{'foreignKey':_0x8615('0x1cf'),'as':_0x8615('0x1d0')});db['MailTransferReport'][_0x8615('0x118')](db[_0x8615('0x14')],{'foreignKey':_0x8615('0x1d1'),'as':_0x8615('0x1d2')});db['MailTransferReport'][_0x8615('0x118')](db[_0x8615('0x14')],{'foreignKey':_0x8615('0x1d3'),'as':_0x8615('0x1d4')});db[_0x8615('0x1ce')][_0x8615('0x118')](db[_0x8615('0x3b')],{'foreignKey':'ToMailQueueId','as':_0x8615('0x1d5')});db[_0x8615('0x1ce')][_0x8615('0x118')](db[_0x8615('0x12e')],{'foreignKey':_0x8615('0x1d6'),'as':'ToAccount'});db[_0x8615('0xeb')][_0x8615('0x118')](db[_0x8615('0x67')],{});db[_0x8615('0xeb')][_0x8615('0x118')](db['ChatInteraction'],{});db[_0x8615('0xeb')][_0x8615('0x118')](db[_0x8615('0x60')],{'foreignKey':_0x8615('0x1d7'),'as':_0x8615('0x1d0')});db[_0x8615('0xeb')][_0x8615('0x118')](db['User'],{'foreignKey':_0x8615('0x1d1'),'as':_0x8615('0x1d2')});db[_0x8615('0xeb')]['belongsTo'](db[_0x8615('0x14')],{'foreignKey':_0x8615('0x1d3'),'as':_0x8615('0x1d4')});db[_0x8615('0xeb')][_0x8615('0x118')](db[_0x8615('0x69')],{'foreignKey':_0x8615('0x1d8'),'as':'ToQueue'});db[_0x8615('0xeb')][_0x8615('0x118')](db[_0x8615('0x60')],{'foreignKey':_0x8615('0x1d9'),'as':_0x8615('0x1da')});db[_0x8615('0xed')][_0x8615('0x118')](db[_0x8615('0x4f')],{});db['FaxTransferReport']['belongsTo'](db[_0x8615('0x4d')],{});db[_0x8615('0xed')]['belongsTo'](db[_0x8615('0x12c')],{'foreignKey':_0x8615('0x1db'),'as':'FromAccount'});db[_0x8615('0xed')][_0x8615('0x118')](db['User'],{'foreignKey':_0x8615('0x1d1'),'as':_0x8615('0x1d2')});db[_0x8615('0xed')][_0x8615('0x118')](db[_0x8615('0x14')],{'foreignKey':'ToUserId','as':'ToAgent'});db['FaxTransferReport'][_0x8615('0x118')](db[_0x8615('0x50')],{'foreignKey':'ToFaxQueueId','as':_0x8615('0x1d5')});db[_0x8615('0xed')][_0x8615('0x118')](db[_0x8615('0x12c')],{'foreignKey':_0x8615('0x1dc'),'as':'ToAccount'});db[_0x8615('0xee')]['belongsTo'](db[_0x8615('0x5d')],{});db['OpenchannelTransferReport'][_0x8615('0x118')](db['OpenchannelInteraction'],{});db[_0x8615('0xee')]['belongsTo'](db[_0x8615('0x131')],{'foreignKey':_0x8615('0x1dd'),'as':'FromAccount'});db[_0x8615('0xee')][_0x8615('0x118')](db[_0x8615('0x14')],{'foreignKey':_0x8615('0x1d1'),'as':_0x8615('0x1d2')});db[_0x8615('0xee')][_0x8615('0x118')](db[_0x8615('0x14')],{'foreignKey':'ToUserId','as':_0x8615('0x1d4')});db[_0x8615('0xee')][_0x8615('0x118')](db[_0x8615('0x5e')],{'foreignKey':_0x8615('0x1de'),'as':'ToQueue'});db[_0x8615('0xee')]['belongsTo'](db[_0x8615('0x131')],{'foreignKey':'ToOpenchannelAccountId','as':_0x8615('0x1da')});db[_0x8615('0xf0')][_0x8615('0x118')](db[_0x8615('0x176')],{});db[_0x8615('0xf0')][_0x8615('0x118')](db[_0x8615('0x112')],{});db[_0x8615('0xf0')]['belongsTo'](db['SmsAccount'],{'foreignKey':'FromSmsAccountId','as':_0x8615('0x1d0')});db[_0x8615('0xf0')][_0x8615('0x118')](db[_0x8615('0x14')],{'foreignKey':_0x8615('0x1d1'),'as':'FromAgent'});db['SmsTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x8615('0x1d3'),'as':_0x8615('0x1d4')});db['SmsTransferReport'][_0x8615('0x118')](db['SmsQueue'],{'foreignKey':_0x8615('0x1df'),'as':_0x8615('0x1d5')});db[_0x8615('0xf0')][_0x8615('0x118')](db[_0x8615('0x54')],{'foreignKey':'ToSmsAccountId','as':_0x8615('0x1da')});db[_0x8615('0xf2')][_0x8615('0x109')](db[_0x8615('0x81')],{'as':_0x8615('0x159'),'foreignKey':'ListId'});db['CmList']['hasMany'](db[_0x8615('0x79')],{'as':_0x8615('0x1e0'),'foreignKey':_0x8615('0x15c')});db[_0x8615('0xf2')][_0x8615('0x109')](db[_0x8615('0x70')],{'as':_0x8615('0x11c'),'onDelete':_0x8615('0x139'),'foreignKey':_0x8615('0x15c')});db[_0x8615('0xf2')][_0x8615('0x109')](db[_0x8615('0x74')],{'as':_0x8615('0x10e'),'foreignKey':_0x8615('0x15c')});db[_0x8615('0xf2')][_0x8615('0x109')](db['CmHopperHistory'],{'as':_0x8615('0x1e1'),'foreignKey':_0x8615('0x15c')});db[_0x8615('0xf2')][_0x8615('0x109')](db[_0x8615('0x10f')],{'as':_0x8615('0x10f'),'foreignKey':'ListId'});db[_0x8615('0xf2')][_0x8615('0x11a')](db[_0x8615('0x1c')],{'as':_0x8615('0x1e2'),'through':_0x8615('0x1e3')});db[_0x8615('0xf2')][_0x8615('0x11a')](db['User'],{'as':_0x8615('0x14a'),'through':_0x8615('0x11f')});db[_0x8615('0xf4')][_0x8615('0x109')](db[_0x8615('0x10c')],{'as':_0x8615('0x10d'),'onDelete':'cascade'});db[_0x8615('0xf4')][_0x8615('0x11a')](db[_0x8615('0x14')],{'as':'Agents','through':'user_has_voice_prefixes'});db['UserProfile'][_0x8615('0x109')](db[_0x8615('0x14')],{'as':_0x8615('0x171'),'foreignKey':_0x8615('0x1e4')});db[_0x8615('0x119')][_0x8615('0x109')](db[_0x8615('0x1e5')],{'as':_0x8615('0x1e6'),'foreignKey':_0x8615('0x1e4'),'onDelete':_0x8615('0x139')});db[_0x8615('0x1e5')]['hasMany'](db[_0x8615('0xf6')],{'as':_0x8615('0x1e7'),'foreignKey':_0x8615('0x1e8'),'onDelete':'cascade'});db['WhatsappAccount'][_0x8615('0x109')](db[_0x8615('0x81')],{'as':_0x8615('0x159'),'foreignKey':_0x8615('0x1e9')});db[_0x8615('0xf8')][_0x8615('0x109')](db[_0x8615('0x7f')],{'as':'Answers','foreignKey':_0x8615('0x1e9')});db['WhatsappAccount'][_0x8615('0x109')](db[_0x8615('0xfe')],{'as':_0x8615('0x14e'),'foreignKey':'WhatsappAccountId'});db[_0x8615('0xf8')][_0x8615('0x109')](db[_0x8615('0xfc')],{'as':_0x8615('0x15a')});db[_0x8615('0xf8')][_0x8615('0x109')](db[_0x8615('0xfa')],{'as':'Applications'});db[_0x8615('0xf8')][_0x8615('0x118')](db[_0x8615('0xf2')],{'as':_0x8615('0x15b'),'foreignKey':'ListId'});db[_0x8615('0xf8')][_0x8615('0x118')](db[_0x8615('0x86')],{'as':_0x8615('0x148'),'foreignKey':_0x8615('0x149')});db[_0x8615('0xf8')][_0x8615('0x11a')](db[_0x8615('0x14')],{'as':_0x8615('0x14a'),'through':_0x8615('0x1ea')});db['WhatsappApplication']['belongsTo'](db[_0x8615('0x14')],{'onDelete':'restrict'});db[_0x8615('0xfa')][_0x8615('0x118')](db['WhatsappQueue'],{'onDelete':_0x8615('0x167')});db[_0x8615('0xfa')][_0x8615('0x118')](db[_0x8615('0xf8')],{'onDelete':_0x8615('0x167')});db[_0x8615('0xfa')][_0x8615('0x118')](db[_0x8615('0x84')],{'onDelete':_0x8615('0x167'),'foreignKey':'IntervalId'});db[_0x8615('0xfa')][_0x8615('0x118')](db[_0x8615('0x8c')],{'onDelete':_0x8615('0x167'),'foreignKey':_0x8615('0x168')});db[_0x8615('0xfc')]['hasMany'](db[_0x8615('0xfe')],{'as':_0x8615('0x14e'),'onDelete':'cascade','foreignKey':_0x8615('0x1eb')});db[_0x8615('0xfc')]['belongsTo'](db[_0x8615('0xf8')],{'as':_0x8615('0x15e'),'foreignKey':_0x8615('0x1e9')});db['WhatsappInteraction']['belongsTo'](db[_0x8615('0x70')],{'as':_0x8615('0x154'),'foreignKey':_0x8615('0x16a')});db[_0x8615('0xfc')]['belongsTo'](db[_0x8615('0x14')],{'as':_0x8615('0x15f'),'foreignKey':_0x8615('0x10a')});db['WhatsappInteraction']['belongsToMany'](db[_0x8615('0x8c')],{'through':_0x8615('0x19f'),'as':_0x8615('0x161')});db[_0x8615('0xfc')][_0x8615('0x11a')](db['Tag'],{'through':_0x8615('0x19f'),'as':_0x8615('0x162')});db[_0x8615('0xfc')][_0x8615('0x11a')](db['User'],{'as':_0x8615('0x171'),'through':_0x8615('0x1ec'),'foreignKey':_0x8615('0x1eb')});db[_0x8615('0xfe')][_0x8615('0x118')](db[_0x8615('0x14')],{'as':_0x8615('0x14')});db[_0x8615('0xfe')][_0x8615('0x118')](db['CmContact'],{'onDelete':'cascade','as':_0x8615('0x154')});db[_0x8615('0xfe')][_0x8615('0x118')](db['WhatsappInteraction'],{'onDelete':_0x8615('0x139'),'as':_0x8615('0x164'),'foreignKey':'WhatsappInteractionId'});db[_0x8615('0xfe')][_0x8615('0x118')](db[_0x8615('0xf8')],{'as':_0x8615('0x15e'),'foreignKey':_0x8615('0x1e9')});db[_0x8615('0xff')][_0x8615('0x118')](db[_0x8615('0xf8')],{});db['WhatsappQueueReport'][_0x8615('0x118')](db[_0x8615('0xf2')],{'as':'List','foreignKey':_0x8615('0x15c')});db[_0x8615('0xff')]['belongsTo'](db[_0x8615('0x70')],{'as':'Contact','foreignKey':_0x8615('0x16a')});db[_0x8615('0xff')][_0x8615('0x118')](db[_0x8615('0xfc')],{});db[_0x8615('0xff')]['belongsTo'](db[_0x8615('0x103')],{});db['WhatsappQueueReport'][_0x8615('0x118')](db[_0x8615('0xfe')],{});db[_0x8615('0xff')][_0x8615('0x118')](db[_0x8615('0x14')],{});db[_0x8615('0x101')]['belongsTo'](db[_0x8615('0xfe')],{});db[_0x8615('0x101')][_0x8615('0x118')](db[_0x8615('0xfc')],{});db[_0x8615('0x101')]['belongsTo'](db[_0x8615('0xf8')],{'foreignKey':_0x8615('0x1ed'),'as':_0x8615('0x1d0')});db[_0x8615('0x101')][_0x8615('0x118')](db[_0x8615('0xf8')],{'foreignKey':_0x8615('0x1ee'),'as':_0x8615('0x1da')});db['WhatsappTransferReport'][_0x8615('0x118')](db[_0x8615('0x103')],{'foreignKey':_0x8615('0x1ef'),'as':_0x8615('0x1d5')});db[_0x8615('0x101')][_0x8615('0x118')](db['User'],{'foreignKey':_0x8615('0x1d1'),'as':_0x8615('0x1d2')});db['WhatsappTransferReport'][_0x8615('0x118')](db[_0x8615('0x14')],{'foreignKey':'ToUserId','as':_0x8615('0x1d4')});db[_0x8615('0x103')][_0x8615('0x11a')](db[_0x8615('0x14')],{'as':_0x8615('0x14a'),'through':_0x8615('0x37'),'foreignKey':_0x8615('0x1f0')});db[_0x8615('0x103')]['belongsToMany'](db[_0x8615('0xe1')],{'through':_0x8615('0x1c9'),'as':'Teams'});module[_0x8615('0x1f1')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index e8f81ba..7953c42 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5025=['./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/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/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/tags','./api/tag','./api/template','/api/triggers','./api/variable','/api/integrations','./api/integration','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','/api/chat/reports/queue','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/squareOdbc','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','./api/authLocal','/api/auth/google','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','join','/demo','root','/snippet','static','3.0.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','username','password','newPassword','firstName','lastName','mobile','fax','email','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerSecret','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','dsn','secret','oldPassword','isPlainObject','length','isString','}@@','replace','lodash','express','express-winston','./errors','./config/environment','./config/logger','api','default','use','isEmpty','\x20body=%s','body','format','headers','x-forwarded-for','connection','url','user','role','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','statusCode','name','agent_name','test','/api/users','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings'];(function(_0x56a0e3,_0x3507aa){var _0x9b6241=function(_0x3b5fc9){while(--_0x3b5fc9){_0x56a0e3['push'](_0x56a0e3['shift']());}};_0x9b6241(++_0x3507aa);}(_0x5025,0x125));var _0x5502=function(_0x2e334b,_0x426b6e){_0x2e334b=_0x2e334b-0x0;var _0x390570=_0x5025[_0x2e334b];return _0x390570;};'use strict';var _=require(_0x5502('0x0'));var path=require('path');var express=require(_0x5502('0x1'));var ewinston=require(_0x5502('0x2'));var util=require('util');var errors=require(_0x5502('0x3'));var config=require(_0x5502('0x4'));var logger=require(_0x5502('0x5'))(_0x5502('0x6'));var authLogger=require(_0x5502('0x5'))('auth');exports[_0x5502('0x7')]=function(_0x1c8e9e){_0x1c8e9e[_0x5502('0x8')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x427a12,_0x6052c1){var _0x45b2e6='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x5502('0x9')](_0x427a12['body'])){_0x45b2e6+=_0x5502('0xa');var _0x2cde20=_0x427a12[_0x5502('0xb')];maskSensitiveData(_0x2cde20);}return util[_0x5502('0xc')](_0x45b2e6,_0x427a12['method'],_0x427a12[_0x5502('0xd')][_0x5502('0xe')]?_0x427a12[_0x5502('0xd')][_0x5502('0xe')]:_0x427a12[_0x5502('0xf')]['remoteAddress']||_0x427a12['ip'],_0x427a12[_0x5502('0x10')],_0x6052c1['statusCode'],_0x6052c1['responseTime'],_0x427a12['user']?_0x427a12['user']['id']:null,_0x427a12['user']?_0x427a12[_0x5502('0x11')]['name']:null,_0x427a12['user']?_0x427a12['user'][_0x5502('0x12')]:null,_0x2cde20?util[_0x5502('0x13')](_0x2cde20,![],null):'');}}));_0x1c8e9e['use'](ewinston[_0x5502('0x14')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2f3f03,_0xcf12d4){var _0xd0c33f=_0x5502('0x15');if(_0x2f3f03[_0x5502('0xb')]&&_0x2f3f03[_0x5502('0xb')][_0x5502('0x16')]&&_0x2f3f03[_0x5502('0xb')][_0x5502('0x17')]){_0xd0c33f=_0x5502('0x18');}return util[_0x5502('0xc')](_0xd0c33f,_0x2f3f03[_0x5502('0x19')],_0x2f3f03[_0x5502('0xd')][_0x5502('0xe')]?_0x2f3f03[_0x5502('0xd')]['x-forwarded-for']:_0x2f3f03[_0x5502('0xf')]['remoteAddress']||_0x2f3f03['ip'],_0x2f3f03['url'],_0xcf12d4[_0x5502('0x1a')],_0xcf12d4['responseTime'],_0x2f3f03[_0x5502('0x11')]?_0x2f3f03['user']['id']:null,_0x2f3f03[_0x5502('0x11')]?_0x2f3f03[_0x5502('0x11')][_0x5502('0x1b')]:null,_0x2f3f03[_0x5502('0x11')]?_0x2f3f03['user'][_0x5502('0x12')]:null,_0x2f3f03[_0x5502('0xb')]&&_0x2f3f03['body'][_0x5502('0x16')]?_0x2f3f03['body'][_0x5502('0x16')]:'other',_0x2f3f03[_0x5502('0xb')]&&_0x2f3f03['body']['agent_id']?_0x2f3f03[_0x5502('0xb')]['agent_id']:'',_0x2f3f03[_0x5502('0xb')]&&_0x2f3f03[_0x5502('0xb')]['agent_name']?_0x2f3f03['body'][_0x5502('0x1c')]:'');},'ignoreRoute':function(_0x3b6856){var _0x379c63=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x379c63[_0x5502('0x1d')](_0x3b6856[_0x5502('0x10')]);}}));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x1e'),require('./api/user'));_0x1c8e9e['use']('/api/voice/chanspy',require(_0x5502('0x1f')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x20'),require(_0x5502('0x21')));_0x1c8e9e['use'](_0x5502('0x22'),require(_0x5502('0x23')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x24'),require(_0x5502('0x25')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x26'),require(_0x5502('0x27')));_0x1c8e9e['use'](_0x5502('0x28'),require(_0x5502('0x29')));_0x1c8e9e['use'](_0x5502('0x2a'),require(_0x5502('0x2b')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x2c'),require('./api/voiceMail'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x2d'),require(_0x5502('0x2e')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x2f'),require('./api/voiceCallReport'));_0x1c8e9e[_0x5502('0x8')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x1c8e9e['use'](_0x5502('0x30'),require(_0x5502('0x31')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x32'),require(_0x5502('0x33')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x34'),require('./api/memberReport'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x35'),require(_0x5502('0x36')));_0x1c8e9e['use']('/api/voice/transfers/reports',require(_0x5502('0x37')));_0x1c8e9e[_0x5502('0x8')]('/api/mail/out_servers',require(_0x5502('0x38')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x39'),require(_0x5502('0x3a')));_0x1c8e9e['use'](_0x5502('0x3b'),require(_0x5502('0x3c')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x3d'),require(_0x5502('0x3e')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x3f'),require(_0x5502('0x40')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x41'),require(_0x5502('0x42')));_0x1c8e9e['use']('/api/mail/applications',require(_0x5502('0x43')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x44'),require(_0x5502('0x45')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x46'),require('./api/dashboard'));_0x1c8e9e['use'](_0x5502('0x47'),require(_0x5502('0x48')));_0x1c8e9e['use'](_0x5502('0x49'),require(_0x5502('0x4a')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x4b'),require('./api/faxApplication'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x4c'),require(_0x5502('0x4d')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x4e'),require(_0x5502('0x4f')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x50'),require(_0x5502('0x51')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x52'),require(_0x5502('0x53')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x54'),require(_0x5502('0x55')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x56'),require(_0x5502('0x57')));_0x1c8e9e[_0x5502('0x8')]('/api/sms/interactions',require('./api/smsInteraction'));_0x1c8e9e['use'](_0x5502('0x58'),require(_0x5502('0x59')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x5a'),require(_0x5502('0x5b')));_0x1c8e9e[_0x5502('0x8')]('/api/openchannel/accounts',require(_0x5502('0x5c')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x5d'),require(_0x5502('0x5e')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x5f'),require(_0x5502('0x60')));_0x1c8e9e[_0x5502('0x8')]('/api/openchannel/messages',require(_0x5502('0x61')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x62'),require(_0x5502('0x63')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x64'),require(_0x5502('0x65')));_0x1c8e9e['use'](_0x5502('0x66'),require(_0x5502('0x67')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x68'),require('./api/chatApplication'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x69'),require('./api/chatInteraction'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x6a'),require(_0x5502('0x6b')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x6c'),require(_0x5502('0x6d')));_0x1c8e9e['use'](_0x5502('0x6e'),require(_0x5502('0x6f')));_0x1c8e9e['use'](_0x5502('0x70'),require('./api/chatGroup'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x71'),require(_0x5502('0x72')));_0x1c8e9e[_0x5502('0x8')]('/api/cm/companies',require('./api/cmCompany'));_0x1c8e9e['use'](_0x5502('0x73'),require(_0x5502('0x74')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x75'),require('./api/cmHopper'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x76'),require('./api/cmHopperBlack'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x77'),require(_0x5502('0x78')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x79'),require(_0x5502('0x7a')));_0x1c8e9e['use'](_0x5502('0x7b'),require(_0x5502('0x7c')));_0x1c8e9e['use'](_0x5502('0x7d'),require('./api/action'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x7e'),require(_0x5502('0x7f')));_0x1c8e9e['use'](_0x5502('0x80'),require(_0x5502('0x81')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x82'),require(_0x5502('0x83')));_0x1c8e9e[_0x5502('0x8')]('/api/conditions',require(_0x5502('0x84')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x85'),require(_0x5502('0x86')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x87'),require(_0x5502('0x88')));_0x1c8e9e[_0x5502('0x8')]('/api/cdr',require(_0x5502('0x89')));_0x1c8e9e[_0x5502('0x8')]('/api/voiceQueuesLog',require(_0x5502('0x8a')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x8b'),require(_0x5502('0x8c')));_0x1c8e9e[_0x5502('0x8')]('/api/sounds',require('./api/sound'));_0x1c8e9e['use'](_0x5502('0x8d'),require(_0x5502('0x8e')));_0x1c8e9e[_0x5502('0x8')]('/api/templates',require(_0x5502('0x8f')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x90'),require('./api/trigger'));_0x1c8e9e[_0x5502('0x8')]('/api/variables',require(_0x5502('0x91')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x92'),require(_0x5502('0x93')));_0x1c8e9e[_0x5502('0x8')]('/api/integrations/reports',require(_0x5502('0x94')));_0x1c8e9e[_0x5502('0x8')]('/api/analytics/custom_reports',require(_0x5502('0x95')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x96'),require(_0x5502('0x97')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x98'),require(_0x5502('0x99')));_0x1c8e9e['use'](_0x5502('0x9a'),require(_0x5502('0x9b')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x9c'),require(_0x5502('0x9d')));_0x1c8e9e['use'](_0x5502('0x9e'),require(_0x5502('0x9f')));_0x1c8e9e['use'](_0x5502('0xa0'),require('./api/intSalesforceAccount'));_0x1c8e9e[_0x5502('0x8')]('/api/integrations/salesforce/configurations',require(_0x5502('0xa1')));_0x1c8e9e['use'](_0x5502('0xa2'),require(_0x5502('0xa3')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xa4'),require(_0x5502('0xa5')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xa6'),require('./api/intSugarcrmConfiguration'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xa7'),require(_0x5502('0xa8')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xa9'),require(_0x5502('0xaa')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xab'),require(_0x5502('0xac')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xad'),require(_0x5502('0xae')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xaf'),require(_0x5502('0xb0')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xb1'),require('./api/intZohoConfiguration'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xb2'),require('./api/intZohoField'));_0x1c8e9e['use'](_0x5502('0xb3'),require(_0x5502('0xb4')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xb5'),require('./api/intZendeskConfiguration'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xb6'),require(_0x5502('0xb7')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xb8'),require('./api/intFreshdeskAccount'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xb9'),require(_0x5502('0xba')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xbb'),require(_0x5502('0xbc')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xbd'),require(_0x5502('0xbe')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xbf'),require(_0x5502('0xc0')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xc1'),require(_0x5502('0xc2')));_0x1c8e9e[_0x5502('0x8')]('/api/integrations/servicenow/accounts',require('./api/intServicenowAccount'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xc3'),require(_0x5502('0xc4')));_0x1c8e9e[_0x5502('0x8')]('/api/integrations/servicenow/fields',require(_0x5502('0xc5')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xc6'),require(_0x5502('0xc7')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xc8'),require(_0x5502('0xc9')));_0x1c8e9e['use'](_0x5502('0xca'),require(_0x5502('0xcb')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xcc'),require('./api/intFreshsalesAccount'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xcd'),require(_0x5502('0xce')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xcf'),require('./api/intFreshsalesField'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xd0'),require('./api/network'));_0x1c8e9e['use'](_0x5502('0xd1'),require('./api/chatQueueReport'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xd2'),require('./api/chatInternalMessage'));_0x1c8e9e['use'](_0x5502('0xd3'),require(_0x5502('0xd4')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xd5'),require(_0x5502('0xd6')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xd7'),require('./api/jscriptySessionReport'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xd8'),require(_0x5502('0xd9')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xda'),require(_0x5502('0xdb')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xdc'),require(_0x5502('0xdd')));_0x1c8e9e[_0x5502('0x8')]('/api/jscripty/projects',require(_0x5502('0xde')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xdf'),require('./api/setting'));_0x1c8e9e[_0x5502('0x8')]('/api/square/odbc',require(_0x5502('0xe0')));_0x1c8e9e['use']('/api/square/projects',require(_0x5502('0xe1')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xe2'),require('./api/squareRecording'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xe3'),require(_0x5502('0xe4')));_0x1c8e9e[_0x5502('0x8')]('/api/teams',require(_0x5502('0xe5')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xe6'),require(_0x5502('0xe7')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xe8'),require('./api/campaign'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xe9'),require(_0x5502('0xea')));_0x1c8e9e['use']('/api/attachments',require('./api/attachment'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xeb'),require(_0x5502('0xec')));_0x1c8e9e['use'](_0x5502('0xed'),require(_0x5502('0xee')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xef'),require(_0x5502('0xf0')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xf1'),require(_0x5502('0xf2')));_0x1c8e9e['use'](_0x5502('0xf3'),require(_0x5502('0xf4')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xf5'),require(_0x5502('0xf6')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xf7'),require(_0x5502('0xf8')));_0x1c8e9e['use'](_0x5502('0xf9'),require('./api/voicePrefix'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xfa'),require(_0x5502('0xfb')));_0x1c8e9e[_0x5502('0x8')]('/api/userProfile/sections',require(_0x5502('0xfc')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0xfd'),require(_0x5502('0xfe')));_0x1c8e9e['use'](_0x5502('0xff'),require('./api/userNotification'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x100'),require(_0x5502('0x101')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x102'),require(_0x5502('0x103')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x104'),require(_0x5502('0x105')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x106'),require(_0x5502('0x107')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x108'),require('./api/whatsappQueueReport'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x109'),require(_0x5502('0x10a')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x10b'),require('./api/whatsappQueue'));_0x1c8e9e['use'](_0x5502('0x10c'),require(_0x5502('0x10d')));_0x1c8e9e[_0x5502('0x8')]('/api/auth/local',require(_0x5502('0x10e')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x10f'),require('./api/authGoogle'));_0x1c8e9e['use'](_0x5502('0x110'),require(_0x5502('0x111')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x112'),require(_0x5502('0x113')));_0x1c8e9e['use'](_0x5502('0x114'),require('./api/version'));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x115'),require(_0x5502('0x116')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x117'),require(_0x5502('0x118')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x119'),require(_0x5502('0x11a')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x11b'),express['static'](path[_0x5502('0x11c')](config['root'],'/apidoc')));_0x1c8e9e['use']('/www',express['static'](path[_0x5502('0x11c')](config['root'],'/www')));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x11d'),express['static'](path[_0x5502('0x11c')](config[_0x5502('0x11e')],_0x5502('0x11d'))));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x11f'),express[_0x5502('0x120')](path[_0x5502('0x11c')](config[_0x5502('0x11e')],'snippet',_0x5502('0x121'))));_0x1c8e9e[_0x5502('0x8')](_0x5502('0x122'),express[_0x5502('0x120')](path[_0x5502('0x11c')](config[_0x5502('0x11e')],_0x5502('0x123'))));_0x1c8e9e[_0x5502('0x124')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x5502('0x125')](errors[0x194]);_0x1c8e9e[_0x5502('0x124')]('/*')[_0x5502('0x125')](function(_0x2edf0b,_0x26cfe2){_0x26cfe2[_0x5502('0x126')](path[_0x5502('0x127')](_0x1c8e9e[_0x5502('0x125')](_0x5502('0x128'))+_0x5502('0x129')));});};var sensitiveFields=[_0x5502('0x12a'),_0x5502('0x12b'),_0x5502('0x12c'),'apiKey',_0x5502('0x12d'),_0x5502('0x12e'),'street','phone',_0x5502('0x12f'),_0x5502('0x130'),_0x5502('0x131'),'clientId',_0x5502('0x132'),_0x5502('0x133'),_0x5502('0x134'),_0x5502('0x135'),_0x5502('0x136'),_0x5502('0x137'),_0x5502('0x138'),_0x5502('0x139'),_0x5502('0x13a'),_0x5502('0x13b'),'consumerKey',_0x5502('0x13c'),'membername',_0x5502('0x13d'),_0x5502('0x13e'),_0x5502('0x13f'),_0x5502('0x140'),_0x5502('0x141'),_0x5502('0x142'),_0x5502('0x143'),_0x5502('0x144'),_0x5502('0x145'),_0x5502('0x11'),'pass',_0x5502('0x146'),_0x5502('0x147'),_0x5502('0x148'),_0x5502('0x149'),'registry',_0x5502('0x14a')];function maskSensitiveData(_0x3a8d26){var _0x5c1c79=/(?!^)[\s\S](?!$)/g;if(!_[_0x5502('0x14b')](_0x3a8d26))return;for(var _0x548e46 in _0x3a8d26){if(_['isArray'](_0x3a8d26[_0x548e46])){for(var _0x5a3cff=0x0;_0x5a3cff<_0x3a8d26[_0x548e46][_0x5502('0x14c')];_0x5a3cff++){maskSensitiveData(_0x3a8d26[_0x548e46][_0x5a3cff]);}}else if(_['isPlainObject'](_0x3a8d26[_0x548e46])){maskSensitiveData(_0x3a8d26[_0x548e46]);}else if(_[_0x5502('0x14d')](_0x3a8d26[_0x548e46])){_0x3a8d26[_0x548e46]=_0x3a8d26[_0x548e46]['replace'](/{{{/g,'@@{')['replace'](/}}}/g,_0x5502('0x14e'))[_0x5502('0x14f')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x548e46)){_0x3a8d26[_0x548e46]=_0x3a8d26[_0x548e46][_0x5502('0x14f')](_0x5c1c79,'*');}}}} \ No newline at end of file +var _0x5df5=['x-forwarded-for','connection','remoteAddress','url','statusCode','user','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','method','responseTime','role','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/sounds','./api/sound','/api/tags','./api/tag','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','/api/migrations','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','/api/voice/prefixes','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','newPassword','apiKey','firstName','street','mobile','fax','email','clientId','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridname','calleridnum','exten','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isPlainObject','replace','@@{','}@@','includes','path','express','express-winston','util','./errors','./config/environment','./config/logger','api','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','headers'];(function(_0x8f6a2c,_0x435996){var _0x42a718=function(_0x572dd2){while(--_0x572dd2){_0x8f6a2c['push'](_0x8f6a2c['shift']());}};_0x42a718(++_0x435996);}(_0x5df5,0x138));var _0x55df=function(_0x6104e2,_0x55e85d){_0x6104e2=_0x6104e2-0x0;var _0x332bf4=_0x5df5[_0x6104e2];return _0x332bf4;};'use strict';var _=require('lodash');var path=require(_0x55df('0x0'));var express=require(_0x55df('0x1'));var ewinston=require(_0x55df('0x2'));var util=require(_0x55df('0x3'));var errors=require(_0x55df('0x4'));var config=require(_0x55df('0x5'));var logger=require(_0x55df('0x6'))(_0x55df('0x7'));var authLogger=require(_0x55df('0x6'))('auth');exports[_0x55df('0x8')]=function(_0x423c92){_0x423c92[_0x55df('0x9')](ewinston[_0x55df('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x589a54,_0x2029e0){var _0x50f065=_0x55df('0xb');if(!_[_0x55df('0xc')](_0x589a54[_0x55df('0xd')])){_0x50f065+='\x20body=%s';var _0x3cbfd6=_0x589a54[_0x55df('0xd')];maskSensitiveData(_0x3cbfd6);}return util[_0x55df('0xe')](_0x50f065,_0x589a54['method'],_0x589a54[_0x55df('0xf')][_0x55df('0x10')]?_0x589a54[_0x55df('0xf')][_0x55df('0x10')]:_0x589a54[_0x55df('0x11')][_0x55df('0x12')]||_0x589a54['ip'],_0x589a54[_0x55df('0x13')],_0x2029e0[_0x55df('0x14')],_0x2029e0['responseTime'],_0x589a54[_0x55df('0x15')]?_0x589a54[_0x55df('0x15')]['id']:null,_0x589a54['user']?_0x589a54[_0x55df('0x15')]['name']:null,_0x589a54['user']?_0x589a54[_0x55df('0x15')]['role']:null,_0x3cbfd6?util[_0x55df('0x16')](_0x3cbfd6,![],null):'');}}));_0x423c92[_0x55df('0x9')](ewinston[_0x55df('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x59ba56,_0x32c394){var _0x5cd8d9=_0x55df('0x17');if(_0x59ba56[_0x55df('0xd')]&&_0x59ba56[_0x55df('0xd')][_0x55df('0x18')]&&_0x59ba56[_0x55df('0xd')][_0x55df('0x19')]){_0x5cd8d9='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x5cd8d9,_0x59ba56[_0x55df('0x1a')],_0x59ba56[_0x55df('0xf')][_0x55df('0x10')]?_0x59ba56[_0x55df('0xf')][_0x55df('0x10')]:_0x59ba56[_0x55df('0x11')][_0x55df('0x12')]||_0x59ba56['ip'],_0x59ba56[_0x55df('0x13')],_0x32c394['statusCode'],_0x32c394[_0x55df('0x1b')],_0x59ba56[_0x55df('0x15')]?_0x59ba56[_0x55df('0x15')]['id']:null,_0x59ba56['user']?_0x59ba56[_0x55df('0x15')]['name']:null,_0x59ba56['user']?_0x59ba56[_0x55df('0x15')][_0x55df('0x1c')]:null,_0x59ba56['body']&&_0x59ba56[_0x55df('0xd')][_0x55df('0x18')]?_0x59ba56['body']['device']:_0x55df('0x1d'),_0x59ba56[_0x55df('0xd')]&&_0x59ba56[_0x55df('0xd')][_0x55df('0x19')]?_0x59ba56[_0x55df('0xd')]['agent_id']:'',_0x59ba56[_0x55df('0xd')]&&_0x59ba56[_0x55df('0xd')][_0x55df('0x1e')]?_0x59ba56['body']['agent_name']:'');},'ignoreRoute':function(_0xf5371c){var _0x1a6305=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1a6305[_0x55df('0x1f')](_0xf5371c[_0x55df('0x13')]);}}));_0x423c92[_0x55df('0x9')](_0x55df('0x20'),require(_0x55df('0x21')));_0x423c92[_0x55df('0x9')](_0x55df('0x22'),require(_0x55df('0x23')));_0x423c92[_0x55df('0x9')]('/api/voice/contexts',require(_0x55df('0x24')));_0x423c92[_0x55df('0x9')](_0x55df('0x25'),require('./api/voiceExtension'));_0x423c92[_0x55df('0x9')]('/api/voice/mohs',require(_0x55df('0x26')));_0x423c92[_0x55df('0x9')](_0x55df('0x27'),require(_0x55df('0x28')));_0x423c92['use']('/api/voice/recordings',require(_0x55df('0x29')));_0x423c92['use'](_0x55df('0x2a'),require(_0x55df('0x2b')));_0x423c92[_0x55df('0x9')](_0x55df('0x2c'),require('./api/voiceMail'));_0x423c92[_0x55df('0x9')](_0x55df('0x2d'),require(_0x55df('0x2e')));_0x423c92[_0x55df('0x9')](_0x55df('0x2f'),require(_0x55df('0x30')));_0x423c92[_0x55df('0x9')]('/api/voice/dials/reports',require(_0x55df('0x31')));_0x423c92[_0x55df('0x9')](_0x55df('0x32'),require(_0x55df('0x33')));_0x423c92[_0x55df('0x9')]('/api/voice/queues/reports',require(_0x55df('0x34')));_0x423c92[_0x55df('0x9')](_0x55df('0x35'),require('./api/memberReport'));_0x423c92[_0x55df('0x9')]('/api/trunks',require('./api/trunk'));_0x423c92[_0x55df('0x9')](_0x55df('0x36'),require(_0x55df('0x37')));_0x423c92[_0x55df('0x9')]('/api/mail/out_servers',require(_0x55df('0x38')));_0x423c92['use']('/api/mail/accounts',require(_0x55df('0x39')));_0x423c92[_0x55df('0x9')](_0x55df('0x3a'),require(_0x55df('0x3b')));_0x423c92[_0x55df('0x9')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0x423c92['use'](_0x55df('0x3c'),require(_0x55df('0x3d')));_0x423c92[_0x55df('0x9')](_0x55df('0x3e'),require(_0x55df('0x3f')));_0x423c92[_0x55df('0x9')](_0x55df('0x40'),require(_0x55df('0x41')));_0x423c92[_0x55df('0x9')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x423c92[_0x55df('0x9')](_0x55df('0x42'),require(_0x55df('0x43')));_0x423c92['use'](_0x55df('0x44'),require('./api/dashboardItem'));_0x423c92[_0x55df('0x9')](_0x55df('0x45'),require(_0x55df('0x46')));_0x423c92['use'](_0x55df('0x47'),require('./api/faxApplication'));_0x423c92[_0x55df('0x9')](_0x55df('0x48'),require(_0x55df('0x49')));_0x423c92[_0x55df('0x9')](_0x55df('0x4a'),require(_0x55df('0x4b')));_0x423c92['use'](_0x55df('0x4c'),require(_0x55df('0x4d')));_0x423c92[_0x55df('0x9')]('/api/fax/reports/queue',require(_0x55df('0x4e')));_0x423c92[_0x55df('0x9')](_0x55df('0x4f'),require(_0x55df('0x50')));_0x423c92['use'](_0x55df('0x51'),require(_0x55df('0x52')));_0x423c92[_0x55df('0x9')](_0x55df('0x53'),require(_0x55df('0x54')));_0x423c92['use'](_0x55df('0x55'),require('./api/smsMessage'));_0x423c92[_0x55df('0x9')](_0x55df('0x56'),require(_0x55df('0x57')));_0x423c92['use'](_0x55df('0x58'),require(_0x55df('0x59')));_0x423c92[_0x55df('0x9')]('/api/openchannel/applications',require(_0x55df('0x5a')));_0x423c92[_0x55df('0x9')](_0x55df('0x5b'),require(_0x55df('0x5c')));_0x423c92[_0x55df('0x9')]('/api/openchannel/messages',require('./api/openchannelMessage'));_0x423c92[_0x55df('0x9')](_0x55df('0x5d'),require(_0x55df('0x5e')));_0x423c92[_0x55df('0x9')](_0x55df('0x5f'),require('./api/chatWebsite'));_0x423c92['use'](_0x55df('0x60'),require(_0x55df('0x61')));_0x423c92[_0x55df('0x9')](_0x55df('0x62'),require(_0x55df('0x63')));_0x423c92[_0x55df('0x9')](_0x55df('0x64'),require(_0x55df('0x65')));_0x423c92[_0x55df('0x9')]('/api/chat/messages',require('./api/chatMessage'));_0x423c92['use'](_0x55df('0x66'),require(_0x55df('0x67')));_0x423c92['use'](_0x55df('0x68'),require(_0x55df('0x69')));_0x423c92[_0x55df('0x9')](_0x55df('0x6a'),require(_0x55df('0x6b')));_0x423c92[_0x55df('0x9')](_0x55df('0x6c'),require(_0x55df('0x6d')));_0x423c92[_0x55df('0x9')](_0x55df('0x6e'),require(_0x55df('0x6f')));_0x423c92[_0x55df('0x9')](_0x55df('0x70'),require('./api/cmContact'));_0x423c92[_0x55df('0x9')]('/api/cm/hopper',require('./api/cmHopper'));_0x423c92[_0x55df('0x9')](_0x55df('0x71'),require(_0x55df('0x72')));_0x423c92[_0x55df('0x9')](_0x55df('0x73'),require(_0x55df('0x74')));_0x423c92[_0x55df('0x9')](_0x55df('0x75'),require(_0x55df('0x76')));_0x423c92[_0x55df('0x9')](_0x55df('0x77'),require(_0x55df('0x78')));_0x423c92['use'](_0x55df('0x79'),require(_0x55df('0x7a')));_0x423c92[_0x55df('0x9')]('/api/automations',require(_0x55df('0x7b')));_0x423c92[_0x55df('0x9')](_0x55df('0x7c'),require(_0x55df('0x7d')));_0x423c92['use']('/api/dispositions',require(_0x55df('0x7e')));_0x423c92[_0x55df('0x9')](_0x55df('0x7f'),require(_0x55df('0x80')));_0x423c92[_0x55df('0x9')](_0x55df('0x81'),require('./api/interval'));_0x423c92[_0x55df('0x9')]('/api/pauses',require(_0x55df('0x82')));_0x423c92['use'](_0x55df('0x83'),require(_0x55df('0x84')));_0x423c92[_0x55df('0x9')](_0x55df('0x85'),require('./api/voiceQueuesLog'));_0x423c92[_0x55df('0x9')]('/api/schedules',require('./api/schedule'));_0x423c92[_0x55df('0x9')](_0x55df('0x86'),require(_0x55df('0x87')));_0x423c92[_0x55df('0x9')](_0x55df('0x88'),require(_0x55df('0x89')));_0x423c92[_0x55df('0x9')]('/api/templates',require(_0x55df('0x8a')));_0x423c92[_0x55df('0x9')](_0x55df('0x8b'),require(_0x55df('0x8c')));_0x423c92['use'](_0x55df('0x8d'),require('./api/variable'));_0x423c92['use'](_0x55df('0x8e'),require('./api/integration'));_0x423c92[_0x55df('0x9')](_0x55df('0x8f'),require(_0x55df('0x90')));_0x423c92[_0x55df('0x9')](_0x55df('0x91'),require(_0x55df('0x92')));_0x423c92['use']('/api/analytics/default_reports',require(_0x55df('0x93')));_0x423c92['use'](_0x55df('0x94'),require(_0x55df('0x95')));_0x423c92[_0x55df('0x9')](_0x55df('0x96'),require(_0x55df('0x97')));_0x423c92[_0x55df('0x9')](_0x55df('0x98'),require(_0x55df('0x99')));_0x423c92['use']('/api/analytics/tree_reports',require(_0x55df('0x9a')));_0x423c92[_0x55df('0x9')]('/api/integrations/salesforce/accounts',require(_0x55df('0x9b')));_0x423c92[_0x55df('0x9')](_0x55df('0x9c'),require('./api/intSalesforceConfiguration'));_0x423c92[_0x55df('0x9')](_0x55df('0x9d'),require(_0x55df('0x9e')));_0x423c92['use'](_0x55df('0x9f'),require(_0x55df('0xa0')));_0x423c92[_0x55df('0x9')](_0x55df('0xa1'),require(_0x55df('0xa2')));_0x423c92[_0x55df('0x9')](_0x55df('0xa3'),require(_0x55df('0xa4')));_0x423c92[_0x55df('0x9')](_0x55df('0xa5'),require(_0x55df('0xa6')));_0x423c92[_0x55df('0x9')]('/api/integrations/desk/configurations',require(_0x55df('0xa7')));_0x423c92[_0x55df('0x9')](_0x55df('0xa8'),require(_0x55df('0xa9')));_0x423c92[_0x55df('0x9')](_0x55df('0xaa'),require(_0x55df('0xab')));_0x423c92[_0x55df('0x9')]('/api/integrations/zoho/configurations',require(_0x55df('0xac')));_0x423c92['use'](_0x55df('0xad'),require(_0x55df('0xae')));_0x423c92['use']('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x423c92[_0x55df('0x9')](_0x55df('0xaf'),require(_0x55df('0xb0')));_0x423c92[_0x55df('0x9')](_0x55df('0xb1'),require(_0x55df('0xb2')));_0x423c92[_0x55df('0x9')]('/api/integrations/freshdesk/accounts',require(_0x55df('0xb3')));_0x423c92[_0x55df('0x9')](_0x55df('0xb4'),require('./api/intFreshdeskConfiguration'));_0x423c92[_0x55df('0x9')](_0x55df('0xb5'),require('./api/intFreshdeskField'));_0x423c92[_0x55df('0x9')](_0x55df('0xb6'),require(_0x55df('0xb7')));_0x423c92[_0x55df('0x9')](_0x55df('0xb8'),require(_0x55df('0xb9')));_0x423c92[_0x55df('0x9')](_0x55df('0xba'),require(_0x55df('0xbb')));_0x423c92[_0x55df('0x9')]('/api/integrations/servicenow/accounts',require(_0x55df('0xbc')));_0x423c92[_0x55df('0x9')](_0x55df('0xbd'),require(_0x55df('0xbe')));_0x423c92[_0x55df('0x9')](_0x55df('0xbf'),require(_0x55df('0xc0')));_0x423c92[_0x55df('0x9')]('/api/integrations/dynamics365/accounts',require(_0x55df('0xc1')));_0x423c92[_0x55df('0x9')](_0x55df('0xc2'),require(_0x55df('0xc3')));_0x423c92[_0x55df('0x9')](_0x55df('0xc4'),require('./api/intDynamics365Field'));_0x423c92['use'](_0x55df('0xc5'),require('./api/intFreshsalesAccount'));_0x423c92[_0x55df('0x9')]('/api/integrations/freshsales/configurations',require(_0x55df('0xc6')));_0x423c92['use'](_0x55df('0xc7'),require('./api/intFreshsalesField'));_0x423c92[_0x55df('0x9')](_0x55df('0xc8'),require(_0x55df('0xc9')));_0x423c92[_0x55df('0x9')](_0x55df('0xca'),require(_0x55df('0xcb')));_0x423c92[_0x55df('0x9')](_0x55df('0xcc'),require(_0x55df('0xcd')));_0x423c92[_0x55df('0x9')]('/api/jscripty/answers/reports',require(_0x55df('0xce')));_0x423c92[_0x55df('0x9')]('/api/jscripty/questions/reports',require(_0x55df('0xcf')));_0x423c92[_0x55df('0x9')]('/api/jscripty/sessions/reports',require(_0x55df('0xd0')));_0x423c92['use'](_0x55df('0xd1'),require(_0x55df('0xd2')));_0x423c92[_0x55df('0x9')](_0x55df('0xd3'),require(_0x55df('0xd4')));_0x423c92[_0x55df('0x9')](_0x55df('0xd5'),require('./api/squareReportDetail'));_0x423c92[_0x55df('0x9')](_0x55df('0xd6'),require(_0x55df('0xd7')));_0x423c92['use'](_0x55df('0xd8'),require(_0x55df('0xd9')));_0x423c92[_0x55df('0x9')](_0x55df('0xda'),require(_0x55df('0xdb')));_0x423c92[_0x55df('0x9')]('/api/square/projects',require(_0x55df('0xdc')));_0x423c92[_0x55df('0x9')](_0x55df('0xdd'),require(_0x55df('0xde')));_0x423c92['use'](_0x55df('0xdf'),require(_0x55df('0xe0')));_0x423c92['use'](_0x55df('0xe1'),require(_0x55df('0xe2')));_0x423c92['use'](_0x55df('0xe3'),require(_0x55df('0xe4')));_0x423c92['use'](_0x55df('0xe5'),require('./api/campaign'));_0x423c92['use'](_0x55df('0xe6'),require('./api/migration'));_0x423c92[_0x55df('0x9')](_0x55df('0xe7'),require(_0x55df('0xe8')));_0x423c92[_0x55df('0x9')]('/api/plugins',require(_0x55df('0xe9')));_0x423c92[_0x55df('0x9')](_0x55df('0xea'),require(_0x55df('0xeb')));_0x423c92['use']('/api/chat/reports/transfer',require(_0x55df('0xec')));_0x423c92[_0x55df('0x9')]('/api/fax/reports/transfer',require(_0x55df('0xed')));_0x423c92[_0x55df('0x9')](_0x55df('0xee'),require(_0x55df('0xef')));_0x423c92[_0x55df('0x9')](_0x55df('0xf0'),require('./api/smsTransferReport'));_0x423c92[_0x55df('0x9')](_0x55df('0xf1'),require('./api/cmList'));_0x423c92[_0x55df('0x9')](_0x55df('0xf2'),require('./api/voicePrefix'));_0x423c92['use'](_0x55df('0xf3'),require('./api/userProfile'));_0x423c92[_0x55df('0x9')](_0x55df('0xf4'),require(_0x55df('0xf5')));_0x423c92[_0x55df('0x9')](_0x55df('0xf6'),require('./api/userProfileResource'));_0x423c92[_0x55df('0x9')](_0x55df('0xf7'),require(_0x55df('0xf8')));_0x423c92['use'](_0x55df('0xf9'),require(_0x55df('0xfa')));_0x423c92[_0x55df('0x9')](_0x55df('0xfb'),require(_0x55df('0xfc')));_0x423c92['use']('/api/whatsapp/interactions',require(_0x55df('0xfd')));_0x423c92[_0x55df('0x9')](_0x55df('0xfe'),require(_0x55df('0xff')));_0x423c92[_0x55df('0x9')](_0x55df('0x100'),require('./api/whatsappQueueReport'));_0x423c92[_0x55df('0x9')]('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0x423c92[_0x55df('0x9')]('/api/whatsapp/queues',require(_0x55df('0x101')));_0x423c92['use'](_0x55df('0x102'),require(_0x55df('0x103')));_0x423c92['use'](_0x55df('0x104'),require(_0x55df('0x105')));_0x423c92[_0x55df('0x9')](_0x55df('0x106'),require('./api/authGoogle'));_0x423c92[_0x55df('0x9')](_0x55df('0x107'),require(_0x55df('0x108')));_0x423c92[_0x55df('0x9')](_0x55df('0x109'),require('./api/rpc'));_0x423c92[_0x55df('0x9')](_0x55df('0x10a'),require(_0x55df('0x10b')));_0x423c92[_0x55df('0x9')](_0x55df('0x10c'),require(_0x55df('0x10d')));_0x423c92['use']('/api/pm2',require(_0x55df('0x10e')));_0x423c92[_0x55df('0x9')]('/api/webbar',require(_0x55df('0x10f')));_0x423c92['use'](_0x55df('0x110'),express[_0x55df('0x111')](path[_0x55df('0x112')](config[_0x55df('0x113')],'/apidoc')));_0x423c92[_0x55df('0x9')](_0x55df('0x114'),express[_0x55df('0x111')](path[_0x55df('0x112')](config[_0x55df('0x113')],_0x55df('0x114'))));_0x423c92[_0x55df('0x9')]('/demo',express['static'](path[_0x55df('0x112')](config[_0x55df('0x113')],_0x55df('0x115'))));_0x423c92[_0x55df('0x9')](_0x55df('0x116'),express[_0x55df('0x111')](path['join'](config[_0x55df('0x113')],'snippet',_0x55df('0x117'))));_0x423c92[_0x55df('0x9')](_0x55df('0x118'),express[_0x55df('0x111')](path[_0x55df('0x112')](config[_0x55df('0x113')],_0x55df('0x119'))));_0x423c92[_0x55df('0x11a')](_0x55df('0x11b'))[_0x55df('0x11c')](errors[0x194]);_0x423c92[_0x55df('0x11a')]('/*')[_0x55df('0x11c')](function(_0x1ed6dd,_0x4828e8){_0x4828e8[_0x55df('0x11d')](path[_0x55df('0x11e')](_0x423c92['get']('appPath')+_0x55df('0x11f')));});};var sensitiveFields=['username','password',_0x55df('0x120'),_0x55df('0x121'),_0x55df('0x122'),'lastName',_0x55df('0x123'),'phone',_0x55df('0x124'),_0x55df('0x125'),_0x55df('0x126'),_0x55df('0x127'),'clientSecret',_0x55df('0x128'),_0x55df('0x129'),_0x55df('0x12a'),_0x55df('0x12b'),_0x55df('0x12c'),_0x55df('0x12d'),_0x55df('0x12e'),_0x55df('0x12f'),_0x55df('0x130'),_0x55df('0x131'),_0x55df('0x132'),'membername',_0x55df('0x133'),_0x55df('0x134'),_0x55df('0x135'),_0x55df('0x136'),'clientEmail',_0x55df('0x137'),_0x55df('0x138'),_0x55df('0x139'),_0x55df('0x13a'),_0x55df('0x15'),_0x55df('0x13b'),'accountSid',_0x55df('0x13c'),_0x55df('0x13d'),_0x55df('0x13e'),_0x55df('0x13f'),_0x55df('0x140')];function maskSensitiveData(_0xbca275){var _0x42a434=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0xbca275))return;for(var _0x4cb25d in _0xbca275){if(_[_0x55df('0x141')](_0xbca275[_0x4cb25d])){for(var _0x1bff20=0x0;_0x1bff20<_0xbca275[_0x4cb25d][_0x55df('0x142')];_0x1bff20++){maskSensitiveData(_0xbca275[_0x4cb25d][_0x1bff20]);}}else if(_[_0x55df('0x143')](_0xbca275[_0x4cb25d])){maskSensitiveData(_0xbca275[_0x4cb25d]);}else if(_['isString'](_0xbca275[_0x4cb25d])){_0xbca275[_0x4cb25d]=_0xbca275[_0x4cb25d][_0x55df('0x144')](/{{{/g,_0x55df('0x145'))['replace'](/}}}/g,_0x55df('0x146'))[_0x55df('0x144')](/{{/g,'@{')[_0x55df('0x144')](/}}/g,'}@');if(_[_0x55df('0x147')](sensitiveFields,_0x4cb25d)){_0xbca275[_0x4cb25d]=_0xbca275[_0x4cb25d][_0x55df('0x144')](_0x42a434,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index af8eb07..e612b24 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb95b=['../api/smsQueueReport/smsQueueReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','bluebird','lodash','../config/environment','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc'];(function(_0x22f0ac,_0x117cdc){var _0x510fc7=function(_0x5220aa){while(--_0x5220aa){_0x22f0ac['push'](_0x22f0ac['shift']());}};_0x510fc7(++_0x117cdc);}(_0xb95b,0x1ef));var _0xbb95=function(_0x831154,_0x1495b8){_0x831154=_0x831154-0x0;var _0x1035a1=_0xb95b[_0x831154];return _0x1035a1;};'use strict';var jayson=require(_0xbb95('0x0'));var BPromise=require(_0xbb95('0x1'));var _=require(_0xbb95('0x2'));var config=require(_0xbb95('0x3'));exports['listen']=function(){return new BPromise(function(_0x56bf5d,_0x2a09b2){var _0x4f6e77={};_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require('../api/user/user.rpc'));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x5')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x6')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x7')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x4f6e77=_['merge'](_0x4f6e77,require(_0xbb95('0x8')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x9')));_0x4f6e77=_['merge'](_0x4f6e77,require(_0xbb95('0xa')));_0x4f6e77=_['merge'](_0x4f6e77,require(_0xbb95('0xb')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0xc')));_0x4f6e77=_['merge'](_0x4f6e77,require(_0xbb95('0xd')));_0x4f6e77=_['merge'](_0x4f6e77,require(_0xbb95('0xe')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require('../api/mailQueue/mailQueue.rpc'));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0xf')));_0x4f6e77=_['merge'](_0x4f6e77,require(_0xbb95('0x10')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x11')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x4f6e77=_['merge'](_0x4f6e77,require(_0xbb95('0x12')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require('../api/faxApplication/faxApplication.rpc'));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require('../api/faxInteraction/faxInteraction.rpc'));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x13')));_0x4f6e77=_['merge'](_0x4f6e77,require(_0xbb95('0x14')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require('../api/smsAccount/smsAccount.rpc'));_0x4f6e77=_['merge'](_0x4f6e77,require(_0xbb95('0x15')));_0x4f6e77=_['merge'](_0x4f6e77,require(_0xbb95('0x16')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x17')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x18')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x19')));_0x4f6e77=_['merge'](_0x4f6e77,require(_0xbb95('0x1a')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x1b')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x1c')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x1d')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x1e')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x1f')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x20')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x21')));_0x4f6e77=_['merge'](_0x4f6e77,require(_0xbb95('0x22')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x23')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x24')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x25')));_0x4f6e77=_['merge'](_0x4f6e77,require('../api/sound/sound.rpc'));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x26')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x27')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x28')));_0x4f6e77=_['merge'](_0x4f6e77,require(_0xbb95('0x29')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x2a')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x2b')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x2c')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x2d')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x2e')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x2f')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x30')));_0x4f6e77=_['merge'](_0x4f6e77,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x31')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require('../api/squareReport/squareReport.rpc'));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x4f6e77=_['merge'](_0x4f6e77,require(_0xbb95('0x32')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x33')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x34')));_0x4f6e77=_['merge'](_0x4f6e77,require('../api/squareRecording/squareRecording.rpc'));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x35')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require('../api/campaign/campaign.rpc'));_0x4f6e77=_['merge'](_0x4f6e77,require(_0xbb95('0x36')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x37')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x38')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x39')));_0x4f6e77=_['merge'](_0x4f6e77,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require(_0xbb95('0x3a')));_0x4f6e77=_[_0xbb95('0x4')](_0x4f6e77,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x352b06=jayson[_0xbb95('0x3b')](_0x4f6e77)[_0xbb95('0x3c')]();var _0x4421dd=config[_0xbb95('0x3d')][_0xbb95('0x3e')]||config['port']+0x1;var _0x347ec3=config[_0xbb95('0x3d')]['ip']||'localhost';_0x352b06['on']('error',function(_0x586c83){return _0x2a09b2(_0x586c83);});_0x352b06[_0xbb95('0x3f')](_0x4421dd,_0x347ec3,function(){console[_0xbb95('0x40')](_0xbb95('0x41'),_0x347ec3,_0x4421dd);require(_0xbb95('0x42'))[_0xbb95('0x43')]();return _0x56bf5d('RPC\x20listening\x20on\x20'+_0x347ec3+':'+_0x4421dd);});});}; \ No newline at end of file +var _0x0e40=['../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.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/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.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/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc'];(function(_0x34489e,_0x2e414e){var _0x2c0df6=function(_0x7171cb){while(--_0x7171cb){_0x34489e['push'](_0x34489e['shift']());}};_0x2c0df6(++_0x2e414e);}(_0x0e40,0x190));var _0x00e4=function(_0x3b6cbe,_0x3ec07e){_0x3b6cbe=_0x3b6cbe-0x0;var _0x288799=_0x0e40[_0x3b6cbe];return _0x288799;};'use strict';var jayson=require(_0x00e4('0x0'));var BPromise=require(_0x00e4('0x1'));var _=require(_0x00e4('0x2'));var config=require(_0x00e4('0x3'));exports['listen']=function(){return new BPromise(function(_0x6b7795,_0x209da9){var _0x2701e2={};_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x5')));_0x2701e2=_['merge'](_0x2701e2,require(_0x00e4('0x6')));_0x2701e2=_['merge'](_0x2701e2,require(_0x00e4('0x7')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x8')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x2701e2=_['merge'](_0x2701e2,require(_0x00e4('0x9')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0xa')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x2701e2=_['merge'](_0x2701e2,require(_0x00e4('0xb')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0xc')));_0x2701e2=_['merge'](_0x2701e2,require(_0x00e4('0xd')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0xe')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0xf')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x10')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x11')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x12')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require('../api/mailApplication/mailApplication.rpc'));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x13')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require('../api/faxAccount/faxAccount.rpc'));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x14')));_0x2701e2=_['merge'](_0x2701e2,require('../api/faxInteraction/faxInteraction.rpc'));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x15')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x16')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x17')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require('../api/smsAccount/smsAccount.rpc'));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x18')));_0x2701e2=_['merge'](_0x2701e2,require(_0x00e4('0x19')));_0x2701e2=_['merge'](_0x2701e2,require(_0x00e4('0x1a')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x1b')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x1c')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x1d')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x1e')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x1f')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x20')));_0x2701e2=_['merge'](_0x2701e2,require(_0x00e4('0x21')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require('../api/cmContact/cmContact.rpc'));_0x2701e2=_['merge'](_0x2701e2,require('../api/cmHopper/cmHopper.rpc'));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x22')));_0x2701e2=_['merge'](_0x2701e2,require(_0x00e4('0x23')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x24')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x25')));_0x2701e2=_['merge'](_0x2701e2,require('../api/sound/sound.rpc'));_0x2701e2=_['merge'](_0x2701e2,require(_0x00e4('0x26')));_0x2701e2=_['merge'](_0x2701e2,require(_0x00e4('0x27')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x28')));_0x2701e2=_['merge'](_0x2701e2,require(_0x00e4('0x29')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x2a')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x2b')));_0x2701e2=_['merge'](_0x2701e2,require(_0x00e4('0x2c')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x2d')));_0x2701e2=_['merge'](_0x2701e2,require(_0x00e4('0x2e')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x2f')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x30')));_0x2701e2=_['merge'](_0x2701e2,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x2701e2=_['merge'](_0x2701e2,require(_0x00e4('0x31')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x32')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x33')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x34')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x35')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require('../api/squareOdbc/squareOdbc.rpc'));_0x2701e2=_['merge'](_0x2701e2,require(_0x00e4('0x36')));_0x2701e2=_['merge'](_0x2701e2,require(_0x00e4('0x37')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x38')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x39')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x3a')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x3b')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x3c')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x3d')));_0x2701e2=_[_0x00e4('0x4')](_0x2701e2,require(_0x00e4('0x3e')));_0x2701e2=_['merge'](_0x2701e2,require(_0x00e4('0x3f')));var _0x9b9bf0=jayson[_0x00e4('0x40')](_0x2701e2)[_0x00e4('0x41')]();var _0x4da44d=config[_0x00e4('0x42')][_0x00e4('0x43')]||config[_0x00e4('0x43')]+0x1;var _0x4abfcd=config[_0x00e4('0x42')]['ip']||_0x00e4('0x44');_0x9b9bf0['on']('error',function(_0x27f5d1){return _0x209da9(_0x27f5d1);});_0x9b9bf0[_0x00e4('0x45')](_0x4da44d,_0x4abfcd,function(){console[_0x00e4('0x46')](_0x00e4('0x47'),_0x4abfcd,_0x4da44d);require(_0x00e4('0x48'))[_0x00e4('0x49')]();return _0x6b7795(_0x00e4('0x4a')+_0x4abfcd+':'+_0x4da44d);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 2aec9a8..0b0e0fd 100644 --- a/server/services/agi/channel.js +++ b/server/services/agi/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','noop','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','emit','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','destroy','pipe','write','inherits','prototype','command','sync','answer','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','sendRequest','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','GOTO\x20%s\x20%s\x20%s'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xedd9,0xfc));var _0x9edd=function(_0xeffc3d,_0x41cc2b){_0xeffc3d=_0xeffc3d-0x0;var _0x1b5ec6=_0xedd9[_0xeffc3d];return _0x1b5ec6;};'use strict';var util=require('util');var _=require(_0x9edd('0x0'));var EventEmitter=require(_0x9edd('0x1'))[_0x9edd('0x2')];var AGIReply=require(_0x9edd('0x3'));var AGIError=require(_0x9edd('0x4'));function AGIChannel(_0x127cbe){var _0x3e6d3a=this,_0x36b53f=new AGIReply(),_0x5943b3=![],_0x33679f={};EventEmitter[_0x9edd('0x5')](_0x3e6d3a);_0x127cbe[_0x9edd('0x6')](_0x9edd('0x7'));_0x127cbe['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x36b53f[_0x9edd('0x6')]('utf8');_0x36b53f['on'](_0x9edd('0x8'),function(_0x190185){for(var _0x1355be in _0x190185){_0x3e6d3a[_0x1355be]=_0x190185[_0x1355be];}_0x3e6d3a[_0x9edd('0x9')]('ready');});_0x36b53f['on'](_0x9edd('0xa'),function(_0x5d2f90){if(_0x5d2f90[_0x9edd('0xb')]()==_0x9edd('0xc')){_0x3e6d3a['emit'](_0x9edd('0xc'));return;}if(_0x5d2f90[_0x9edd('0xd')](0x0,0xb)=='520-Invalid'){_0x5943b3=!![];}if(_0x5943b3){_0x33679f['rx']+=_0x5d2f90+'\x0a';if(_0x5d2f90[_0x9edd('0xe')](_0x9edd('0xf'))!=-0x1){_0x5943b3=![];}}else{_0x33679f['rx']=_0x5d2f90;}if(_0x5943b3){return;}if(typeof _0x33679f['cb']==_0x9edd('0x10')){var _0xfd544a=_0x33679f['rx'][_0x9edd('0xd')](0x0,0x3),_0x287ddd=null,_0x3a7b84=null;_0xfd544a=parseInt(_0xfd544a);if(isNaN(_0xfd544a)){_0x33679f['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x9edd('0x11')});return;}if(_0xfd544a!=0xc8){_0x33679f['cb'](null,{'code':_0xfd544a,'result':-0x1,'extra':'KO'});return;}_0x287ddd=_0x33679f['rx']['substring'](0x4)[_0x9edd('0x12')](_0x9edd('0x13'),'');if(_0x287ddd[_0x9edd('0x14')]('\x20')!=-0x1){_0x287ddd=_0x287ddd[_0x9edd('0x15')](0x0,_0x287ddd[_0x9edd('0x14')]('\x20'));}if(_[_0x9edd('0x16')](_0x287ddd,'-1')){_0x287ddd=parseInt(_0x287ddd);}_0x3a7b84=_0x33679f['rx'][_0x9edd('0x17')]('\x20');if(_0x3a7b84[_0x9edd('0x18')]==0x3){_0x3a7b84=_0x3a7b84[0x2]['substring'](0x1,_0x3a7b84[0x2][_0x9edd('0x18')]-0x1);}else if(_0x3a7b84[_0x9edd('0x18')]>0x3){var _0x449cee=/\((.+)\)/;var _0x5acf65=_0x33679f['rx'][_0x9edd('0x19')](_0x449cee);if(_0x5acf65){_0x3a7b84=_0x5acf65[0x1];}else{_0x3a7b84=null;}}else{_0x3a7b84=null;}_0x33679f['cb'](null,{'code':_0xfd544a,'result':_0x287ddd,'extra':_0x3a7b84});}});_0x127cbe['on'](_0x9edd('0x1a'),function(_0x40ba32){_0x3e6d3a['emit'](_0x9edd('0x1a'),new AGIError('E_AGI_SOCKET_ERROR',_0x40ba32[_0x9edd('0x1b')]));});_0x127cbe['on'](_0x9edd('0x1c'),function(){_0x3e6d3a['emit']('close',new AGIError(_0x9edd('0x1d')));});_0x127cbe['on']('timeout',function(){_0x3e6d3a[_0x9edd('0x9')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x127cbe[_0x9edd('0x1e')]();});_0x127cbe[_0x9edd('0x1f')](_0x36b53f);this['command']=function(_0x5823bc,_0x341d67){var _0x5823bc=_0x5823bc||'',_0x341d67=typeof _0x341d67=='function'?_0x341d67:new Function();_0x33679f={'tx':_0x5823bc,'rx':'','cb':_0x341d67};_0x127cbe[_0x9edd('0x20')](_0x5823bc+'\x0a');},this[_0x9edd('0x1c')]=function(){_0x127cbe[_0x9edd('0x1e')]();};}util[_0x9edd('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x9edd('0x22')]['sendRequest']=function(_0x46c383){return this[_0x9edd('0x23')][_0x9edd('0x24')](this,_0x46c383);};AGIChannel[_0x9edd('0x22')][_0x9edd('0x25')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x9edd('0x22')][_0x9edd('0x26')]=function(_0x8d67aa,_0x25e135,_0x3c2227){_0x8d67aa=_0x8d67aa===undefined?'beep':_0x8d67aa;_0x25e135=_0x25e135===undefined?'5':_0x25e135;_0x3c2227=_0x3c2227===undefined?'1':_0x3c2227;return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x28'),_0x8d67aa,_0x25e135*0x3e8,_0x3c2227));};AGIChannel[_0x9edd('0x22')]['noop']=function(_0x238b22){_0x238b22=_0x238b22||_0x9edd('0x29');return this[_0x9edd('0x2a')](util[_0x9edd('0x27')]('VERBOSE\x20\x22%s\x22',_0x238b22));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x2b')]=function(_0xbe87e1,_0x12c1bc){if(_[_0x9edd('0x2c')](_0x12c1bc)){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x2d'),_0xbe87e1,_0x12c1bc[_0x9edd('0x2e')](',')));}return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x2d'),_0xbe87e1,_0x12c1bc));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x2f')]=function(_0x1a6c23){return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x30'),_0x1a6c23));};AGIChannel[_0x9edd('0x22')]['setExtension']=function(_0x2d2f88){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x31'),_0x2d2f88));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x32')]=function(_0x473068){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x33'),_0x473068));};AGIChannel[_0x9edd('0x22')][_0x9edd('0xc')]=function(){return this[_0x9edd('0x2a')](_0x9edd('0x34'));};AGIChannel['prototype'][_0x9edd('0x35')]=function(_0x5ed62d,_0x968303){var _0x148630=_[_0x9edd('0x36')](_0x968303)||_[_0x9edd('0x37')](_0x968303)?_0x968303[_0x9edd('0x38')]():_0x968303;return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x39'),_0x5ed62d,_0x148630?_0x148630[_0x9edd('0x38')]()[_0x9edd('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x3a')]=function(_0x5c0627,_0x1cbbac){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')]('SAY\x20NUMBER\x20%s\x20%s',_0x5c0627,_0x1cbbac));};AGIChannel[_0x9edd('0x22')]['sayDigits']=function(_0x3ef1d5,_0x5658d6){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x3b'),_0x3ef1d5,_0x5658d6));};AGIChannel['prototype'][_0x9edd('0x3c')]=function(_0xcbd0ef,_0x2f8f61){return this['sendRequest'](util[_0x9edd('0x27')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0xcbd0ef,_0x2f8f61));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x3d')]=function(_0x50be2c,_0x315f52,_0x40fdfb){_0x315f52=_0x315f52||this[_0x9edd('0x3e')];_0x40fdfb=_0x40fdfb||0x1;this[_0x9edd('0x2f')](_0x50be2c);this['setExtension'](_0x315f52);this[_0x9edd('0x32')](_0x40fdfb);return this['noop'](util[_0x9edd('0x27')](_0x9edd('0x3f'),_0x50be2c,_0x315f52,_0x40fdfb));};AGIChannel['prototype'][_0x9edd('0x40')]=function(_0x49a128){return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x41'),_0x49a128));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x42')]=function(_0x25e6ec,_0x4737ae,_0x3ff512,_0x75efbe,_0x18c149,_0x2b081a){_0x4737ae=_0x4737ae||_0x9edd('0x43');_0x3ff512=_0x3ff512||'';_0x75efbe=_0x75efbe===undefined?-0x1:_0x75efbe==='-1'?-0x1:_0x75efbe*0x3e8;_0x18c149=_0x18c149===undefined?'':'s='+_0x18c149;_0x2b081a=_0x2b081a?_0x9edd('0x44'):'';return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x45'),_0x25e6ec,_0x4737ae,_0x3ff512,_0x75efbe,_0x2b081a,_0x18c149));};AGIChannel['prototype'][_0x9edd('0x46')]=function(_0x2570e3,_0x2231c1){_0x2231c1=_0x2231c1||'';return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x47'),_0x2570e3,_0x2231c1));};AGIChannel[_0x9edd('0x22')]['agi']=function(_0x4a4656){return this['exec'](_0x9edd('0x48'),_0x4a4656);};AGIChannel['prototype'][_0x9edd('0x49')]=function(_0x19b56b){return this[_0x9edd('0x2b')](_0x9edd('0x4a'),_0x19b56b);};AGIChannel[_0x9edd('0x22')]['error']=function(_0x387fb8,_0x35e63c){this[_0x9edd('0x4b')](util['format'](_0x9edd('0x4c'),_0x387fb8['id'],_0x387fb8[_0x9edd('0x4d')],_0x35e63c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x9edd('0x4e')]=AGIChannel; \ No newline at end of file +var _0x9c44=['no\x20code','replace','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','emit','ready','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','function'];(function(_0x3db122,_0x5e6bee){var _0x325b67=function(_0x5095af){while(--_0x5095af){_0x3db122['push'](_0x3db122['shift']());}};_0x325b67(++_0x5e6bee);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIReply=require(_0x49c4('0x2'));var AGIError=require(_0x49c4('0x3'));function AGIChannel(_0x455700){var _0x2ad237=this,_0x4e0313=new AGIReply(),_0x4941f1=![],_0x41a183={};EventEmitter['call'](_0x2ad237);_0x455700[_0x49c4('0x4')](_0x49c4('0x5'));_0x455700[_0x49c4('0x6')](0x8*0x3c*0x3c*0x3e8);_0x4e0313[_0x49c4('0x4')](_0x49c4('0x5'));_0x4e0313['on']('headers',function(_0x11c586){for(var _0x42e4f8 in _0x11c586){_0x2ad237[_0x42e4f8]=_0x11c586[_0x42e4f8];}_0x2ad237[_0x49c4('0x7')](_0x49c4('0x8'));});_0x4e0313['on']('line',function(_0x5ab4a3){if(_0x5ab4a3[_0x49c4('0x9')]()==_0x49c4('0xa')){_0x2ad237['emit'](_0x49c4('0xa'));return;}if(_0x5ab4a3[_0x49c4('0xb')](0x0,0xb)=='520-Invalid'){_0x4941f1=!![];}if(_0x4941f1){_0x41a183['rx']+=_0x5ab4a3+'\x0a';if(_0x5ab4a3['search'](_0x49c4('0xc'))!=-0x1){_0x4941f1=![];}}else{_0x41a183['rx']=_0x5ab4a3;}if(_0x4941f1){return;}if(typeof _0x41a183['cb']==_0x49c4('0xd')){var _0x5487cd=_0x41a183['rx']['substring'](0x0,0x3),_0x7df3a9=null,_0x403bfb=null;_0x5487cd=parseInt(_0x5487cd);if(isNaN(_0x5487cd)){_0x41a183['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x49c4('0xe')});return;}if(_0x5487cd!=0xc8){_0x41a183['cb'](null,{'code':_0x5487cd,'result':-0x1,'extra':'KO'});return;}_0x7df3a9=_0x41a183['rx'][_0x49c4('0xb')](0x4)[_0x49c4('0xf')](_0x49c4('0x10'),'');if(_0x7df3a9[_0x49c4('0x11')]('\x20')!=-0x1){_0x7df3a9=_0x7df3a9[_0x49c4('0x12')](0x0,_0x7df3a9[_0x49c4('0x11')]('\x20'));}if(_[_0x49c4('0x13')](_0x7df3a9,'-1')){_0x7df3a9=parseInt(_0x7df3a9);}_0x403bfb=_0x41a183['rx']['split']('\x20');if(_0x403bfb[_0x49c4('0x14')]==0x3){_0x403bfb=_0x403bfb[0x2][_0x49c4('0xb')](0x1,_0x403bfb[0x2][_0x49c4('0x14')]-0x1);}else if(_0x403bfb[_0x49c4('0x14')]>0x3){var _0x2abc78=/\((.+)\)/;var _0x53e3a2=_0x41a183['rx'][_0x49c4('0x15')](_0x2abc78);if(_0x53e3a2){_0x403bfb=_0x53e3a2[0x1];}else{_0x403bfb=null;}}else{_0x403bfb=null;}_0x41a183['cb'](null,{'code':_0x5487cd,'result':_0x7df3a9,'extra':_0x403bfb});}});_0x455700['on'](_0x49c4('0x16'),function(_0x4c3253){_0x2ad237['emit'](_0x49c4('0x16'),new AGIError(_0x49c4('0x17'),_0x4c3253[_0x49c4('0x18')]));});_0x455700['on']('close',function(){_0x2ad237[_0x49c4('0x7')]('close',new AGIError(_0x49c4('0x19')));});_0x455700['on'](_0x49c4('0x1a'),function(){_0x2ad237[_0x49c4('0x7')](_0x49c4('0x1a'),new AGIError(_0x49c4('0x1b')));_0x455700[_0x49c4('0x1c')]();});_0x455700[_0x49c4('0x1d')](_0x4e0313);this[_0x49c4('0x1e')]=function(_0x2197d2,_0x578447){var _0x2197d2=_0x2197d2||'',_0x578447=typeof _0x578447==_0x49c4('0xd')?_0x578447:new Function();_0x41a183={'tx':_0x2197d2,'rx':'','cb':_0x578447};_0x455700['write'](_0x2197d2+'\x0a');},this['close']=function(){_0x455700[_0x49c4('0x1c')]();};}util[_0x49c4('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x49c4('0x20')][_0x49c4('0x21')]=function(_0x4811c4){return this['command'][_0x49c4('0x22')](this,_0x4811c4);};AGIChannel[_0x49c4('0x20')]['answer']=function(){return this[_0x49c4('0x21')](_0x49c4('0x23'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x24')]=function(_0x531d92,_0x543ea2,_0x449960){_0x531d92=_0x531d92===undefined?'beep':_0x531d92;_0x543ea2=_0x543ea2===undefined?'5':_0x543ea2;_0x449960=_0x449960===undefined?'1':_0x449960;return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x26'),_0x531d92,_0x543ea2*0x3e8,_0x449960));};AGIChannel[_0x49c4('0x20')]['noop']=function(_0x889909){_0x889909=_0x889909||_0x49c4('0x27');return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x28'),_0x889909));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x29')]=function(_0x427b26,_0x17b50f){if(_[_0x49c4('0x2a')](_0x17b50f)){return this[_0x49c4('0x21')](util['format']('EXEC\x20%s\x20%s',_0x427b26,_0x17b50f['join'](',')));}return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2b'),_0x427b26,_0x17b50f));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2c')]=function(_0x574fd3){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2d'),_0x574fd3));};AGIChannel[_0x49c4('0x20')]['setExtension']=function(_0x57a29c){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2e'),_0x57a29c));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2f')]=function(_0x4a0c7a){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x30'),_0x4a0c7a));};AGIChannel['prototype']['hangup']=function(){return this[_0x49c4('0x21')](_0x49c4('0x31'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x32')]=function(_0x2b45a1,_0x2cf897){var _0x1d1557=_[_0x49c4('0x33')](_0x2cf897)||_[_0x49c4('0x34')](_0x2cf897)?_0x2cf897['toString']():_0x2cf897;return this[_0x49c4('0x21')](util['format'](_0x49c4('0x35'),_0x2b45a1,_0x1d1557?_0x1d1557[_0x49c4('0x36')]()[_0x49c4('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x49c4('0x20')]['sayNumber']=function(_0x335f0c,_0x31f3ff){return this[_0x49c4('0x21')](util['format'](_0x49c4('0x37'),_0x335f0c,_0x31f3ff));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x38')]=function(_0x5e5366,_0x1ba7a0){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x39'),_0x5e5366,_0x1ba7a0));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3a')]=function(_0x1e506a,_0x4e0663){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x3b'),_0x1e506a,_0x4e0663));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3c')]=function(_0x29dd5d,_0x1be62d,_0xc9722b){_0x1be62d=_0x1be62d||this[_0x49c4('0x3d')];_0xc9722b=_0xc9722b||0x1;this[_0x49c4('0x2c')](_0x29dd5d);this[_0x49c4('0x3e')](_0x1be62d);this[_0x49c4('0x2f')](_0xc9722b);return this[_0x49c4('0x3f')](util['format'](_0x49c4('0x40'),_0x29dd5d,_0x1be62d,_0xc9722b));};AGIChannel['prototype'][_0x49c4('0x41')]=function(_0x4915bc){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x42'),_0x4915bc));};AGIChannel[_0x49c4('0x20')]['recordFile']=function(_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x117151,_0x490823){_0x20490b=_0x20490b||_0x49c4('0x43');_0x1e7bdc=_0x1e7bdc||'';_0x38349b=_0x38349b===undefined?-0x1:_0x38349b==='-1'?-0x1:_0x38349b*0x3e8;_0x117151=_0x117151===undefined?'':'s='+_0x117151;_0x490823=_0x490823?_0x49c4('0x44'):'';return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x45'),_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x490823,_0x117151));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x46')]=function(_0x3351c1,_0x3c4a1d){_0x3c4a1d=_0x3c4a1d||'';return this['sendRequest'](util[_0x49c4('0x25')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3351c1,_0x3c4a1d));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x47')]=function(_0x301def){return this[_0x49c4('0x29')](_0x49c4('0x48'),_0x301def);};AGIChannel['prototype'][_0x49c4('0x49')]=function(_0x15b674){return this[_0x49c4('0x29')](_0x49c4('0x4a'),_0x15b674);};AGIChannel[_0x49c4('0x20')][_0x49c4('0x16')]=function(_0x9779ef,_0x4d89e0){this[_0x49c4('0x3f')](util['format'](_0x49c4('0x4b'),_0x9779ef['id'],_0x9779ef[_0x49c4('0x4c')],_0x4d89e0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x49c4('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 9f36889..52be5c0 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 _0xf776=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x55f687,_0x4acb12){var _0x671c1b=function(_0x32a6aa){while(--_0x32a6aa){_0x55f687['push'](_0x55f687['shift']());}};_0x671c1b(++_0x4acb12);}(_0xf776,0x169));var _0x6f77=function(_0x5b7962,_0x357ab5){_0x5b7962=_0x5b7962-0x0;var _0x3e749b=_0xf776[_0x5b7962];return _0x3e749b;};'use strict';var util=require(_0x6f77('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x6f77('0x1'),'E_AGI_SERVER_ERROR':_0x6f77('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x6f77('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x6f77('0x4'),'E_AGI_SOCKET_ERROR':_0x6f77('0x5'),'E_AGI_SOCKET_CLOSE':_0x6f77('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x6f77('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x6f77('0x8')};function AGIError(_0x21909a){var _0x21909a=_0x21909a||null,_0x18a937=_0x18a937||[],_0x545ba9=0x1,_0x1dd52f='';if(!error[_0x21909a]){_0x21909a='E_AGI_UNDEFINED';}_0x18a937[_0x6f77('0x9')](error[_0x21909a]);while(arguments[_0x545ba9]){_0x18a937[_0x6f77('0x9')](arguments[_0x545ba9]);_0x545ba9++;}_0x1dd52f=util[_0x6f77('0xa')][_0x6f77('0xb')](util,_0x18a937);this['message']=_0x1dd52f;this[_0x6f77('0xc')]=_0x21909a;}module[_0x6f77('0xd')]=AGIError; \ No newline at end of file +var _0xc474=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x802235,_0x20b6ce){var _0x4742bc=function(_0x8734b9){while(--_0x8734b9){_0x802235['push'](_0x802235['shift']());}};_0x4742bc(++_0x20b6ce);}(_0xc474,0xfc));var _0x4c47=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc474[_0x59ee6f];return _0x4c0979;};'use strict';var util=require(_0x4c47('0x0'));var error={'E_AGI_UNDEFINED':_0x4c47('0x1'),'E_AGI_ARGUMENT_PORT':_0x4c47('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x4c47('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x4c47('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x4c47('0x5'),'E_AGI_SOCKET_ERROR':_0x4c47('0x6'),'E_AGI_SOCKET_CLOSE':_0x4c47('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x4c47('0x8'),'E_AGI_COMMAND_EMPTY':_0x4c47('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x4c47('0xa'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x5aaf0e){var _0x5aaf0e=_0x5aaf0e||null,_0x255b6e=_0x255b6e||[],_0x275a64=0x1,_0x35a093='';if(!error[_0x5aaf0e]){_0x5aaf0e=_0x4c47('0xb');}_0x255b6e['push'](error[_0x5aaf0e]);while(arguments[_0x275a64]){_0x255b6e[_0x4c47('0xc')](arguments[_0x275a64]);_0x275a64++;}_0x35a093=util[_0x4c47('0xd')]['apply'](util,_0x255b6e);this[_0x4c47('0xe')]=_0x35a093;this[_0x4c47('0xf')]=_0x5aaf0e;}module[_0x4c47('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 80117ad..9adf1b6 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 _0xe9e8=['addVertex','edges','addEdge','size','relations','getVertex','info','no\x20vertex\x20found','length','no\x20edge/s\x20available','condition','split','vswitch','target','agicommand','traverseBFS','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','numberOfEdges','prototype'];(function(_0x55e75c,_0x51cb2d){var _0x24f4bd=function(_0x18f46d){while(--_0x18f46d){_0x55e75c['push'](_0x55e75c['shift']());}};_0x24f4bd(++_0x51cb2d);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x3a1902,_0x318503){_0x3a1902=_0x3a1902-0x0;var _0x22713a=_0xe9e8[_0x3a1902];return _0x22713a;};'use strict';var _=require(_0x8e9e('0x0'));var logger=require(_0x8e9e('0x1'))(_0x8e9e('0x2'));var verticesWithRetry=[_0x8e9e('0x3'),_0x8e9e('0x4'),_0x8e9e('0x5')];var Graph=function(){this[_0x8e9e('0x6')]={};this['edges']={};this[_0x8e9e('0x7')]=0x0;};Graph[_0x8e9e('0x8')][_0x8e9e('0x9')]=function(_0x4d1b1c){this[_0x8e9e('0x6')][_0x4d1b1c['id']]=_0x4d1b1c;this[_0x8e9e('0xa')][_0x4d1b1c['id']]=[];};Graph[_0x8e9e('0x8')][_0x8e9e('0xb')]=function(_0x58f822,_0x3b5d21,_0x2ae896){this[_0x8e9e('0xa')][_0x58f822]['push']({'target':_0x3b5d21,'condition':_0x2ae896});this[_0x8e9e('0x7')]+=0x1;};Graph[_0x8e9e('0x8')][_0x8e9e('0xc')]=function(){return _['size'](this[_0x8e9e('0x6')]);};Graph[_0x8e9e('0x8')][_0x8e9e('0xd')]=function(){return this[_0x8e9e('0x7')];};Graph[_0x8e9e('0x8')][_0x8e9e('0xe')]=function(_0x2adef2){return this['vertices'][_0x2adef2];};Graph[_0x8e9e('0x8')]['traverseBFS']=function(_0x29d7ec,_0xd1909e){if(!this[_0x8e9e('0x6')][_0x29d7ec]){return logger[_0x8e9e('0xf')](_0x8e9e('0x10'));}var _0x1c927d=_0xd1909e(this[_0x8e9e('0x6')][_0x29d7ec]);if(!_0x1c927d){return logger['info']('stop\x20traverse');}if(this[_0x8e9e('0xa')][_0x29d7ec][_0x8e9e('0x11')]===0x0){return logger['info'](_0x8e9e('0x12'));}for(var _0xb67ecc=0x0,_0xa45d92=[],_0x22b2c7=![];_0xb67ecc\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','root','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','target','addEdge','source','value','getSquareProject','then','catch','createSquareReport','agi_','substring','inspect','debug','variables','stringify','close','hangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','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','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s'];(function(_0x403349,_0x335683){var _0x4c0435=function(_0x561609){while(--_0x561609){_0x403349['push'](_0x403349['shift']());}};_0x4c0435(++_0x335683);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x719236,_0x3615f8){_0x719236=_0x719236-0x0;var _0x3ae92d=_0x0f9f[_0x719236];return _0x3ae92d;};'use strict';var parser=require('xml2json');var _=require(_0xf0f9('0x0'));var syncho=require(_0xf0f9('0x1'));var util=require(_0xf0f9('0x2'));var moment=require('moment');var config=require(_0xf0f9('0x3'));var logger=require(_0xf0f9('0x4'))(_0xf0f9('0x5'));var utilLicense=require(_0xf0f9('0x6'));var rpc=require(_0xf0f9('0x7'));var mailRpc=require(_0xf0f9('0x8'));var Graph=require(_0xf0f9('0x9'));var Vertices=require(_0xf0f9('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xf0f9('0x5')]=_[_0xf0f9('0xb')](config['agi'],{'ip':_0xf0f9('0xc'),'port':0x11dd});function connectionHandler(_0x294b42){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x294b42);agiHandler(_0x294b42);}catch(_0x2a9c6b){logger[_0xf0f9('0xd')](_0x2a9c6b[_0xf0f9('0xe')]);}});});}function listeningHandler(){console['log'](_0xf0f9('0xf'),config[_0xf0f9('0x5')][_0xf0f9('0x10')]);logger['info'](util['format'](_0xf0f9('0x11'),config[_0xf0f9('0x5')]['ip'],config[_0xf0f9('0x5')][_0xf0f9('0x10')]));}function errorHandler(_0x2708e1){if(_0x2708e1&&_0x2708e1[_0xf0f9('0x12')]&&_0x2708e1[_0xf0f9('0x13')]){logger['error'](util[_0xf0f9('0x14')](_0xf0f9('0x15'),_0x2708e1[_0xf0f9('0x12')],_0x2708e1[_0xf0f9('0x13')]));}else{logger[_0xf0f9('0xd')](util['format'](_0xf0f9('0x16'),_0x2708e1[_0xf0f9('0xe')]));}}function closeHandler(){logger[_0xf0f9('0x17')](util[_0xf0f9('0x14')](_0xf0f9('0x18'),this[_0xf0f9('0x19')],this[_0xf0f9('0x1a')],this[_0xf0f9('0x1b')],this[_0xf0f9('0x1c')],this[_0xf0f9('0x1d')]));try{createSquareReport(this);}catch(_0x4d3534){logger['error'](_0x4d3534[_0xf0f9('0xe')]);}}function timeoutHandler(){logger[_0xf0f9('0x17')](util['format'](_0xf0f9('0x1e'),this['arg_1'],this['calleridname'],this[_0xf0f9('0x1b')],this[_0xf0f9('0x1c')],this[_0xf0f9('0x1d')]));}function hangupHandler(){logger[_0xf0f9('0x17')](util[_0xf0f9('0x14')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this['calleridname'],this[_0xf0f9('0x1b')],this[_0xf0f9('0x1c')],this[_0xf0f9('0x1d')]));this['evtHangup']=!![];}function getRoot(_0x4a8726){return parser[_0xf0f9('0x1f')](_0x4a8726,{'object':!![]})['mxGraphModel'][_0xf0f9('0x20')];}function addVertex(_0x414f87,_0x173c79,_0x570c68){_0x173c79[_0xf0f9('0x21')]=_0x570c68;if(_0x173c79[_0xf0f9('0x22')](_0xf0f9('0x23'))){_0x173c79['maxRetry']=parseInt(_0x173c79[_0xf0f9('0x23')],0xa);}_0x414f87[_0xf0f9('0x24')](_[_0xf0f9('0x25')](_0x173c79,_0xf0f9('0x26')));}function initGraph(_0x16f639,_0x19d750){var _0x5df7f5=new Graph();for(var _0x28e1f6 in _0x16f639){if(_0x16f639['hasOwnProperty'](_0x28e1f6)){if(_[_0xf0f9('0x27')](_0x16f639[_0x28e1f6])){for(var _0x30e85c=0x0;_0x30e85c<_0x16f639[_0x28e1f6]['length'];_0x30e85c+=0x1){addVertex(_0x5df7f5,_0x16f639[_0x28e1f6][_0x30e85c],_0x28e1f6);}}else{addVertex(_0x5df7f5,_0x16f639[_0x28e1f6],_0x28e1f6);}}}for(var _0x4b75b2=0x0;_0x4b75b2<_0x19d750[_0xf0f9('0x28')];_0x4b75b2+=0x1){if(_0x19d750[_0x4b75b2]['source']&&_0x19d750[_0x4b75b2][_0xf0f9('0x29')]){_0x5df7f5[_0xf0f9('0x2a')](_0x19d750[_0x4b75b2][_0xf0f9('0x2b')],_0x19d750[_0x4b75b2][_0xf0f9('0x29')],_0x19d750[_0x4b75b2][_0xf0f9('0x2c')]);}}return _0x5df7f5;}function getSquareProject(_0x39cd34,_0x1377ed){rpc[_0xf0f9('0x2d')](_0x39cd34)[_0xf0f9('0x2e')](function(_0x4e4e08){_0x1377ed(null,_0x4e4e08);})[_0xf0f9('0x2f')](function(_0x28da31){_0x1377ed(null,_0x28da31);});}function createSquareReport(_0x534083,_0x48ef2a){rpc[_0xf0f9('0x30')](_0x534083)['then'](function(_0x483a8c){if(_0x48ef2a){_0x48ef2a(null,_0x483a8c);}})[_0xf0f9('0x2f')](function(_0x490e91){if(_0x48ef2a){_0x48ef2a(null,_0x490e91);}});}function setChannelVariables(_0x31b6c4){for(var _0xf9b6a8 in _0x31b6c4){if(_0x31b6c4['hasOwnProperty'](_0xf9b6a8)){if(_0xf9b6a8['indexOf'](_0xf0f9('0x31'))===0x0){_0x31b6c4[_0xf9b6a8[_0xf0f9('0x32')](0x4)]=_0x31b6c4[_0xf9b6a8];delete _0x31b6c4[_0xf9b6a8];}}}}function getLogFromObject(_0x3393bd){return util[_0xf0f9('0x33')](_0x3393bd,{'showHidden':![],'depth':null});}function agiHandler(_0x278192){var _0x1c03ad,_0x1b784a,_0x30bc8e,_0x3c92f7,_0xaf9500;logger[_0xf0f9('0x34')](_0xf0f9('0x35'),JSON[_0xf0f9('0x36')](_0x278192,null,0x2));logger['info'](util[_0xf0f9('0x14')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x278192[_0xf0f9('0x19')],_0x278192[_0xf0f9('0x1a')],_0x278192[_0xf0f9('0x1b')],_0x278192[_0xf0f9('0x1c')],_0x278192[_0xf0f9('0x1d')]));_0x278192['on'](_0xf0f9('0xd'),errorHandler);_0x278192['on'](_0xf0f9('0x37'),closeHandler);_0x278192['on']('timeout',timeoutHandler);_0x278192['evtHangup']=![];_0x278192['on'](_0xf0f9('0x38'),hangupHandler);var _0x3b37c2=getSquareProject[_0xf0f9('0x39')](null,_0x278192[_0xf0f9('0x19')]);if(_0x3b37c2){if(_0x3b37c2[_0xf0f9('0x3a')]){_0x1c03ad=getRoot(_0x3b37c2['production']);if(_0x1c03ad&&_0x1c03ad[_0xf0f9('0x3b')]){logger[_0xf0f9('0x34')](_0xf0f9('0x20'),JSON[_0xf0f9('0x36')](_0x1c03ad,null,0x2));_0x278192[_0xf0f9('0x3c')]=moment()['format'](_0xf0f9('0x3d'));_0x1b784a=initGraph(_[_0xf0f9('0x25')](_0x1c03ad,_0xf0f9('0x26')),_0x1c03ad[_0xf0f9('0x26')]);_0x30bc8e=new Vertices(_0x278192,rpc,mailRpc);logger[_0xf0f9('0x17')](util[_0xf0f9('0x14')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x278192[_0xf0f9('0x19')],_0x278192[_0xf0f9('0x1a')],_0x278192[_0xf0f9('0x1b')],_0x278192['dnid'],_0x278192[_0xf0f9('0x1d')]));_0x1b784a[_0xf0f9('0x3e')](_0x1c03ad[_0xf0f9('0x3b')]['id'],function(_0xa2b82b){try{_0xa2b82b=_0x30bc8e[_0xf0f9('0x3f')](_0xa2b82b);logger[_0xf0f9('0x34')](_0xf0f9('0x40'),JSON[_0xf0f9('0x36')](_0xa2b82b,null,0x2));if(_0xa2b82b[_0xf0f9('0x21')]===_0xf0f9('0x41')){logger[_0xf0f9('0x17')](_0xf0f9('0x42'));_0x278192[_0xf0f9('0x43')]=_0xa2b82b['context']||_0x278192['context'];_0x278192[_0xf0f9('0x44')]=_0xa2b82b['extension'];_0x278192['priority']=_0xa2b82b['priority']?_0xa2b82b[_0xf0f9('0x45')]-0x1:0x1;return null;}else if(_0xa2b82b&&_0x30bc8e[_0xa2b82b[_0xf0f9('0x21')]]){_0xaf9500=_0x30bc8e[_0xa2b82b[_0xf0f9('0x21')]](_0xa2b82b);logger[_0xf0f9('0x17')](_0xf0f9('0x46'),JSON[_0xf0f9('0x36')](_0xaf9500,null,0x2));if(_0xaf9500&&_0xaf9500[_0xf0f9('0x47')]===AGI_CODE_SUCCESS&&_0xaf9500[_0xf0f9('0x48')]!==AGI_RESULT_ERROR&&!_0x278192[_0xf0f9('0x49')]){logger['debug'](_0xf0f9('0x46'),getLogFromObject(_0xaf9500));return _[_0xf0f9('0x4a')](_0xaf9500[_0xf0f9('0x48')])?null:_0xaf9500['result'][_0xf0f9('0x4b')]();}else{logger[_0xf0f9('0xd')](_0xf0f9('0x46'),getLogFromObject(_0xaf9500));return null;}}else{logger['error'](_0xf0f9('0x4c'));return null;}}catch(_0x44d56e){logger['error'](_0x44d56e[_0xf0f9('0xe')]);return null;}});if(_0x1c03ad[_0xf0f9('0x4d')]){logger[_0xf0f9('0x17')](util[_0xf0f9('0x14')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x278192[_0xf0f9('0x19')],_0x278192[_0xf0f9('0x1a')],_0x278192[_0xf0f9('0x1b')],_0x278192[_0xf0f9('0x1c')],_0x278192[_0xf0f9('0x1d')]));_0x1b784a[_0xf0f9('0x3e')](_0x1c03ad['finally']['id'],function(_0x27cbb1){try{_0x27cbb1=_0x30bc8e['clear'](_0x27cbb1);logger[_0xf0f9('0x34')](_0xf0f9('0x40'),JSON[_0xf0f9('0x36')](_0x27cbb1,null,0x2));if(_0x27cbb1&&_0x30bc8e[_0x27cbb1[_0xf0f9('0x21')]]){_0xaf9500=_0x30bc8e[_0x27cbb1[_0xf0f9('0x21')]](_0x27cbb1);if(_0xaf9500){logger[_0xf0f9('0x34')](_0xf0f9('0x46'),getLogFromObject(_0xaf9500));return _[_0xf0f9('0x4a')](_0xaf9500[_0xf0f9('0x48')])?null:_0xaf9500[_0xf0f9('0x48')][_0xf0f9('0x4b')]();}else{logger[_0xf0f9('0xd')](_0xf0f9('0x46'),getLogFromObject(_0xaf9500));return null;}}else{logger[_0xf0f9('0xd')](_0xf0f9('0x4c'));return null;}}catch(_0x3cb91a){logger[_0xf0f9('0xd')](_0x3cb91a[_0xf0f9('0xe')]);return null;}});}logger[_0xf0f9('0x17')](util[_0xf0f9('0x14')](_0xf0f9('0x4e'),_0x278192[_0xf0f9('0x19')],_0x278192[_0xf0f9('0x1a')],_0x278192[_0xf0f9('0x1b')],_0x278192['dnid'],_0x278192['uniqueid']));logger[_0xf0f9('0x17')](util['format'](_0xf0f9('0x4f'),_0x278192[_0xf0f9('0x43')],_0x278192[_0xf0f9('0x44')],parseInt(_0x278192['priority'],0xa)+0x1));_0x278192[_0xf0f9('0x50')](_0x278192['context'],_0x278192[_0xf0f9('0x44')],parseInt(_0x278192[_0xf0f9('0x45')],0xa)+0x1);_0x278192[_0xf0f9('0x37')]();}}else{logger[_0xf0f9('0xd')](util[_0xf0f9('0x14')]('Project\x20%s\x20not\x20published',_0x278192[_0xf0f9('0x19')]));_0x278192['continueAt'](_0x278192[_0xf0f9('0x43')],_0x278192[_0xf0f9('0x44')],parseInt(_0x278192[_0xf0f9('0x45')],0xa)+0x1);_0x278192[_0xf0f9('0x37')]();}}else{logger[_0xf0f9('0xd')](util['format'](_0xf0f9('0x51'),_0x278192[_0xf0f9('0x19')]));_0x278192[_0xf0f9('0x50')](_0x278192[_0xf0f9('0x43')],_0x278192[_0xf0f9('0x44')],parseInt(_0x278192[_0xf0f9('0x45')],0xa)+0x1);_0x278192[_0xf0f9('0x37')]();}}function main(){var _0x26c1d6;return utilLicense[_0xf0f9('0x52')]()[_0xf0f9('0x2e')](function(_0x2884f1){if(_0x2884f1){if(_0x2884f1[_0xf0f9('0x53')]){if(_0x2884f1[_0xf0f9('0x54')]&&_0x2884f1[_0xf0f9('0x54')]>0x0){logger['info'](util[_0xf0f9('0x14')](_0xf0f9('0x55'),_0x2884f1[_0xf0f9('0x54')]));_0x26c1d6=_0x2884f1['callysquare'];}else{logger[_0xf0f9('0x17')](_0xf0f9('0x56'));}}else{logger[_0xf0f9('0x17')](_0xf0f9('0x57'));_0x26c1d6=-0x1;}}})[_0xf0f9('0x2f')](function(_0x586022){logger[_0xf0f9('0xd')](_0xf0f9('0x58'),_0x586022[_0xf0f9('0xe')]);})[_0xf0f9('0x4d')](function(){var _0x2807f9=require(_0xf0f9('0x59'))(config[_0xf0f9('0x5')][_0xf0f9('0x10')],config[_0xf0f9('0x5')]['ip'],_0x26c1d6);_0x2807f9['on'](_0xf0f9('0xd'),errorHandler);_0x2807f9['on']('listening',listeningHandler);_0x2807f9['on'](_0xf0f9('0x5a'),connectionHandler);_0x2807f9['on'](_0xf0f9('0x37'),closeHandler);});}main(); \ No newline at end of file +var _0x032e=['[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','syncho','util','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','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','[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','evtHangup','toJson','mxGraphModel','root','maxRetry','retry','addVertex','omit','mxCell','hasOwnProperty','length','addEdge','source','target','value','then','catch','createSquareReport','indexOf','substring','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','agicommand','gotoc','context','extension','priority','response','code','result','isUndefined','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare'];(function(_0x2b14ee,_0x49d254){var _0x5a6d21=function(_0x34330b){while(--_0x34330b){_0x2b14ee['push'](_0x2b14ee['shift']());}};_0x5a6d21(++_0x49d254);}(_0x032e,0x124));var _0xe032=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x032e[_0x5447fd];return _0x15b28a;};'use strict';var parser=require(_0xe032('0x0'));var _=require('lodash');var syncho=require(_0xe032('0x1'));var util=require(_0xe032('0x2'));var moment=require('moment');var config=require('../../config/environment');var logger=require(_0xe032('0x3'))(_0xe032('0x4'));var utilLicense=require(_0xe032('0x5'));var rpc=require(_0xe032('0x6'));var mailRpc=require(_0xe032('0x7'));var Graph=require(_0xe032('0x8'));var Vertices=require(_0xe032('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xe032('0x4')]=_[_0xe032('0xa')](config[_0xe032('0x4')],{'ip':_0xe032('0xb'),'port':0x11dd});function connectionHandler(_0xd84027){process[_0xe032('0xc')](function(){syncho(function(){try{setChannelVariables(_0xd84027);agiHandler(_0xd84027);}catch(_0x3b0ef8){logger[_0xe032('0xd')](_0x3b0ef8[_0xe032('0xe')]);}});});}function listeningHandler(){console[_0xe032('0xf')](_0xe032('0x10'),config['agi'][_0xe032('0x11')]);logger[_0xe032('0x12')](util[_0xe032('0x13')](_0xe032('0x14'),config[_0xe032('0x4')]['ip'],config[_0xe032('0x4')][_0xe032('0x11')]));}function errorHandler(_0x5bcb5b){if(_0x5bcb5b&&_0x5bcb5b[_0xe032('0x15')]&&_0x5bcb5b[_0xe032('0x16')]){logger[_0xe032('0xd')](util[_0xe032('0x13')]('[%s]\x20%s',_0x5bcb5b[_0xe032('0x15')],_0x5bcb5b[_0xe032('0x16')]));}else{logger[_0xe032('0xd')](util[_0xe032('0x13')](_0xe032('0x17'),_0x5bcb5b[_0xe032('0xe')]));}}function closeHandler(){logger[_0xe032('0x12')](util['format'](_0xe032('0x18'),this[_0xe032('0x19')],this[_0xe032('0x1a')],this[_0xe032('0x1b')],this[_0xe032('0x1c')],this[_0xe032('0x1d')]));try{createSquareReport(this);}catch(_0x4cdab3){logger[_0xe032('0xd')](_0x4cdab3[_0xe032('0xe')]);}}function timeoutHandler(){logger[_0xe032('0x12')](util[_0xe032('0x13')](_0xe032('0x1e'),this['arg_1'],this['calleridname'],this['callerid'],this[_0xe032('0x1c')],this['uniqueid']));}function hangupHandler(){logger[_0xe032('0x12')](util[_0xe032('0x13')](_0xe032('0x1f'),this[_0xe032('0x19')],this[_0xe032('0x1a')],this[_0xe032('0x1b')],this[_0xe032('0x1c')],this['uniqueid']));this[_0xe032('0x20')]=!![];}function getRoot(_0x866c81){return parser[_0xe032('0x21')](_0x866c81,{'object':!![]})[_0xe032('0x22')][_0xe032('0x23')];}function addVertex(_0x33d89a,_0x22831a,_0xe89aa7){_0x22831a['agicommand']=_0xe89aa7;if(_0x22831a['hasOwnProperty']('retry')){_0x22831a[_0xe032('0x24')]=parseInt(_0x22831a[_0xe032('0x25')],0xa);}_0x33d89a[_0xe032('0x26')](_[_0xe032('0x27')](_0x22831a,_0xe032('0x28')));}function initGraph(_0x200671,_0x36ece7){var _0x2b6ffa=new Graph();for(var _0x4dcbf1 in _0x200671){if(_0x200671[_0xe032('0x29')](_0x4dcbf1)){if(_['isArray'](_0x200671[_0x4dcbf1])){for(var _0x189ed4=0x0;_0x189ed4<_0x200671[_0x4dcbf1][_0xe032('0x2a')];_0x189ed4+=0x1){addVertex(_0x2b6ffa,_0x200671[_0x4dcbf1][_0x189ed4],_0x4dcbf1);}}else{addVertex(_0x2b6ffa,_0x200671[_0x4dcbf1],_0x4dcbf1);}}}for(var _0x3106aa=0x0;_0x3106aa<_0x36ece7[_0xe032('0x2a')];_0x3106aa+=0x1){if(_0x36ece7[_0x3106aa]['source']&&_0x36ece7[_0x3106aa]['target']){_0x2b6ffa[_0xe032('0x2b')](_0x36ece7[_0x3106aa][_0xe032('0x2c')],_0x36ece7[_0x3106aa][_0xe032('0x2d')],_0x36ece7[_0x3106aa][_0xe032('0x2e')]);}}return _0x2b6ffa;}function getSquareProject(_0x4e8b72,_0x541aa8){rpc['getSquareProject'](_0x4e8b72)[_0xe032('0x2f')](function(_0x1dd34f){_0x541aa8(null,_0x1dd34f);})[_0xe032('0x30')](function(_0x707b){_0x541aa8(null,_0x707b);});}function createSquareReport(_0x50db2d,_0x3b93e3){rpc[_0xe032('0x31')](_0x50db2d)[_0xe032('0x2f')](function(_0x4348f8){if(_0x3b93e3){_0x3b93e3(null,_0x4348f8);}})[_0xe032('0x30')](function(_0x4a0198){if(_0x3b93e3){_0x3b93e3(null,_0x4a0198);}});}function setChannelVariables(_0xd90bd5){for(var _0x33634c in _0xd90bd5){if(_0xd90bd5[_0xe032('0x29')](_0x33634c)){if(_0x33634c[_0xe032('0x32')]('agi_')===0x0){_0xd90bd5[_0x33634c[_0xe032('0x33')](0x4)]=_0xd90bd5[_0x33634c];delete _0xd90bd5[_0x33634c];}}}}function getLogFromObject(_0x4c86e9){return util[_0xe032('0x34')](_0x4c86e9,{'showHidden':![],'depth':null});}function agiHandler(_0x53df28){var _0x9d3199,_0x4b0b21,_0x2c1ec0,_0x517df6,_0x3970e1;logger[_0xe032('0x35')]('variables',JSON[_0xe032('0x36')](_0x53df28,null,0x2));logger[_0xe032('0x12')](util[_0xe032('0x13')](_0xe032('0x37'),_0x53df28['arg_1'],_0x53df28[_0xe032('0x1a')],_0x53df28['callerid'],_0x53df28[_0xe032('0x1c')],_0x53df28[_0xe032('0x1d')]));_0x53df28['on']('error',errorHandler);_0x53df28['on'](_0xe032('0x38'),closeHandler);_0x53df28['on'](_0xe032('0x39'),timeoutHandler);_0x53df28['evtHangup']=![];_0x53df28['on'](_0xe032('0x3a'),hangupHandler);var _0x2cfc49=getSquareProject[_0xe032('0x3b')](null,_0x53df28[_0xe032('0x19')]);if(_0x2cfc49){if(_0x2cfc49[_0xe032('0x3c')]){_0x9d3199=getRoot(_0x2cfc49[_0xe032('0x3c')]);if(_0x9d3199&&_0x9d3199[_0xe032('0x3d')]){logger[_0xe032('0x35')](_0xe032('0x23'),JSON[_0xe032('0x36')](_0x9d3199,null,0x2));_0x53df28[_0xe032('0x3e')]=moment()[_0xe032('0x13')](_0xe032('0x3f'));_0x4b0b21=initGraph(_[_0xe032('0x27')](_0x9d3199,_0xe032('0x28')),_0x9d3199[_0xe032('0x28')]);_0x2c1ec0=new Vertices(_0x53df28,rpc,mailRpc);logger[_0xe032('0x12')](util['format'](_0xe032('0x40'),_0x53df28['arg_1'],_0x53df28[_0xe032('0x1a')],_0x53df28[_0xe032('0x1b')],_0x53df28[_0xe032('0x1c')],_0x53df28[_0xe032('0x1d')]));_0x4b0b21[_0xe032('0x41')](_0x9d3199['start']['id'],function(_0x132d25){try{_0x132d25=_0x2c1ec0['clear'](_0x132d25);logger[_0xe032('0x35')]('vertex',JSON[_0xe032('0x36')](_0x132d25,null,0x2));if(_0x132d25[_0xe032('0x42')]===_0xe032('0x43')){logger[_0xe032('0x12')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x53df28[_0xe032('0x44')]=_0x132d25['context']||_0x53df28[_0xe032('0x44')];_0x53df28[_0xe032('0x45')]=_0x132d25[_0xe032('0x45')];_0x53df28[_0xe032('0x46')]=_0x132d25['priority']?_0x132d25['priority']-0x1:0x1;return null;}else if(_0x132d25&&_0x2c1ec0[_0x132d25[_0xe032('0x42')]]){_0x3970e1=_0x2c1ec0[_0x132d25[_0xe032('0x42')]](_0x132d25);logger['info'](_0xe032('0x47'),JSON[_0xe032('0x36')](_0x3970e1,null,0x2));if(_0x3970e1&&_0x3970e1[_0xe032('0x48')]===AGI_CODE_SUCCESS&&_0x3970e1[_0xe032('0x49')]!==AGI_RESULT_ERROR&&!_0x53df28[_0xe032('0x20')]){logger['debug'](_0xe032('0x47'),getLogFromObject(_0x3970e1));return _[_0xe032('0x4a')](_0x3970e1[_0xe032('0x49')])?null:_0x3970e1[_0xe032('0x49')][_0xe032('0x4b')]();}else{logger[_0xe032('0xd')](_0xe032('0x47'),getLogFromObject(_0x3970e1));return null;}}else{logger[_0xe032('0xd')]('agicommand\x20not\x20found');return null;}}catch(_0x535f34){logger[_0xe032('0xd')](_0x535f34['stack']);return null;}});if(_0x9d3199[_0xe032('0x4c')]){logger[_0xe032('0x12')](util[_0xe032('0x13')](_0xe032('0x4d'),_0x53df28[_0xe032('0x19')],_0x53df28[_0xe032('0x1a')],_0x53df28[_0xe032('0x1b')],_0x53df28[_0xe032('0x1c')],_0x53df28[_0xe032('0x1d')]));_0x4b0b21['traverseBFS'](_0x9d3199[_0xe032('0x4c')]['id'],function(_0x565e8e){try{_0x565e8e=_0x2c1ec0['clear'](_0x565e8e);logger[_0xe032('0x35')](_0xe032('0x4e'),JSON[_0xe032('0x36')](_0x565e8e,null,0x2));if(_0x565e8e&&_0x2c1ec0[_0x565e8e[_0xe032('0x42')]]){_0x3970e1=_0x2c1ec0[_0x565e8e['agicommand']](_0x565e8e);if(_0x3970e1){logger[_0xe032('0x35')](_0xe032('0x47'),getLogFromObject(_0x3970e1));return _[_0xe032('0x4a')](_0x3970e1[_0xe032('0x49')])?null:_0x3970e1[_0xe032('0x49')][_0xe032('0x4b')]();}else{logger[_0xe032('0xd')]('response',getLogFromObject(_0x3970e1));return null;}}else{logger[_0xe032('0xd')](_0xe032('0x4f'));return null;}}catch(_0x538150){logger[_0xe032('0xd')](_0x538150[_0xe032('0xe')]);return null;}});}logger[_0xe032('0x12')](util[_0xe032('0x13')](_0xe032('0x50'),_0x53df28[_0xe032('0x19')],_0x53df28[_0xe032('0x1a')],_0x53df28[_0xe032('0x1b')],_0x53df28[_0xe032('0x1c')],_0x53df28[_0xe032('0x1d')]));logger[_0xe032('0x12')](util[_0xe032('0x13')](_0xe032('0x51'),_0x53df28[_0xe032('0x44')],_0x53df28['extension'],parseInt(_0x53df28[_0xe032('0x46')],0xa)+0x1));_0x53df28['continueAt'](_0x53df28[_0xe032('0x44')],_0x53df28[_0xe032('0x45')],parseInt(_0x53df28[_0xe032('0x46')],0xa)+0x1);_0x53df28[_0xe032('0x38')]();}}else{logger[_0xe032('0xd')](util[_0xe032('0x13')](_0xe032('0x52'),_0x53df28[_0xe032('0x19')]));_0x53df28[_0xe032('0x53')](_0x53df28[_0xe032('0x44')],_0x53df28[_0xe032('0x45')],parseInt(_0x53df28['priority'],0xa)+0x1);_0x53df28[_0xe032('0x38')]();}}else{logger[_0xe032('0xd')](util['format'](_0xe032('0x54'),_0x53df28['arg_1']));_0x53df28[_0xe032('0x53')](_0x53df28[_0xe032('0x44')],_0x53df28[_0xe032('0x45')],parseInt(_0x53df28[_0xe032('0x46')],0xa)+0x1);_0x53df28[_0xe032('0x38')]();}}function main(){var _0x5f11f9;return utilLicense[_0xe032('0x55')]()[_0xe032('0x2f')](function(_0x1e1277){if(_0x1e1277){if(_0x1e1277[_0xe032('0x56')]){if(_0x1e1277[_0xe032('0x57')]&&_0x1e1277[_0xe032('0x57')]>0x0){logger[_0xe032('0x12')](util['format'](_0xe032('0x58'),_0x1e1277[_0xe032('0x57')]));_0x5f11f9=_0x1e1277[_0xe032('0x57')];}else{logger[_0xe032('0x12')](_0xe032('0x59'));}}else{logger[_0xe032('0x12')](_0xe032('0x5a'));_0x5f11f9=-0x1;}}})[_0xe032('0x30')](function(_0x80d181){logger['error'](_0xe032('0x5b'),_0x80d181[_0xe032('0xe')]);})[_0xe032('0x4c')](function(){var _0x560e26=require(_0xe032('0x5c'))(config[_0xe032('0x4')]['port'],config[_0xe032('0x4')]['ip'],_0x5f11f9);_0x560e26['on'](_0xe032('0xd'),errorHandler);_0x560e26['on'](_0xe032('0x5d'),listeningHandler);_0x560e26['on'](_0xe032('0x5e'),connectionHandler);_0x560e26['on'](_0xe032('0x38'),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 730ff77..9e9cc05 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x37ea5e,_0x59c834){var _0x3c7214=function(_0x58c6cf){while(--_0x58c6cf){_0x37ea5e['push'](_0x37ea5e['shift']());}};_0x3c7214(++_0x59c834);}(_0x814b,0x1a2));var _0xb814=function(_0x2e5636,_0x2b9540){_0x2e5636=_0x2e5636-0x0;var _0x4d7371=_0x814b[_0x2e5636];return _0x4d7371;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file +var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x2d7c95,_0x282bcd){var _0x4fa5fd=function(_0x2a64e9){while(--_0x2a64e9){_0x2d7c95['push'](_0x2d7c95['shift']());}};_0x4fa5fd(++_0x282bcd);}(_0x814b,0x1a2));var _0xb814=function(_0x2ade6c,_0x2d42f2){_0x2ade6c=_0x2ade6c-0x0;var _0x2cb372=_0x814b[_0x2ade6c];return _0x2cb372;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index eaea2b5..05d489e 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0x87667f,_0x2fa934){var _0x1c162b=function(_0x4da2ca){while(--_0x4da2ca){_0x87667f['push'](_0x87667f['shift']());}};_0x1c162b(++_0x2fa934);}(_0x7a54,0x106));var _0x47a5=function(_0x2e7244,_0x2bbdf8){_0x2e7244=_0x2e7244-0x0;var _0x26c34e=_0x7a54[_0x2e7244];return _0x26c34e;};'use strict';var util=require(_0x47a5('0x0'));var Transform=require(_0x47a5('0x1'))[_0x47a5('0x2')];function AGIReply(_0x58157c){Transform[_0x47a5('0x3')](this,_0x58157c);this[_0x47a5('0x4')]='';this['_inBody']=![];}util[_0x47a5('0x5')](AGIReply,Transform);AGIReply[_0x47a5('0x6')][_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){var _0x3d5629='\x0a',_0x59199c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x343372=-0x1,_0x30e405=-0x1,_0x506eda='',_0x194fb0=0x0,_0x5077f3='',_0x5d90b3='';this[_0x47a5('0x4')]+=_0x3717e1[_0x47a5('0x8')]();_0x5077f3=this['_localBuffer'];if(!this[_0x47a5('0x9')]){_0x194fb0=0x0;while(_0x59199c[_0x194fb0]){while((_0x30e405=_0x5077f3['indexOf'](_0x59199c[_0x194fb0]))!=-0x1){_0x506eda=_0x59199c[_0x194fb0];_0x5d90b3=_0x5077f3['substring'](0x0,_0x30e405);_0x5077f3=_0x5077f3[_0x47a5('0xa')](_0x30e405+_0x506eda[_0x47a5('0xb')]);var _0x2f399b=_0x5d90b3[_0x47a5('0xc')](_0x3d5629),_0x250fad=0x0,_0xd612dd={},_0xd308b8='',_0x1eae59='',_0x5beb89=-0x1;while(_0x2f399b[_0x250fad]){_0x5beb89=_0x2f399b[_0x250fad][_0x47a5('0xd')](':');if(_0x5beb89!=-0x1){_0xd308b8=_0x2f399b[_0x250fad][_0x47a5('0xe')](0x0,_0x5beb89)[_0x47a5('0xf')]();_0x1eae59=_0x2f399b[_0x250fad][_0x47a5('0xe')](_0x5beb89+0x1)[_0x47a5('0xf')]();if(_0xd308b8[_0x47a5('0xb')]>0x0){_0xd612dd[_0xd308b8]=_0x1eae59;}}else{}_0x250fad++;}this[_0x47a5('0x10')]('headers',_0xd612dd);this[_0x47a5('0x9')]=!![];}_0x194fb0++;}this[_0x47a5('0x4')]=_0x5077f3;}else{while((_0x343372=_0x5077f3[_0x47a5('0xd')](_0x3d5629))!=-0x1){_0x5d90b3=_0x5077f3[_0x47a5('0xa')](0x0,_0x343372);this[_0x47a5('0x10')]('line',_0x5d90b3);_0x5077f3=_0x5077f3['substring'](_0x343372+_0x3d5629[_0x47a5('0xb')]);}this['_localBuffer']=_0x5077f3;}_0x545a97();};module['exports']=AGIReply; \ No newline at end of file +var _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x405541,_0x2945cc){var _0x194a1e=function(_0x46fffe){while(--_0x46fffe){_0x405541['push'](_0x405541['shift']());}};_0x194a1e(++_0x2945cc);}(_0xb10b,0x12a));var _0xbb10=function(_0x34ad4f,_0x3b9428){_0x34ad4f=_0x34ad4f-0x0;var _0x1a868f=_0xb10b[_0x34ad4f];return _0x1a868f;};'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 4baba24..ceec55a 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 _0x1e24=['createCmContact','phone','CreateCmContact','getPauseById','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','client','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','email','name','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage'];(function(_0x1e3671,_0x9ae4fc){var _0x48d5f5=function(_0xfab713){while(--_0xfab713){_0x1e3671['push'](_0x1e3671['shift']());}};_0x48d5f5(++_0x9ae4fc);}(_0x1e24,0x82));var _0x41e2=function(_0x20732f,_0x147fbc){_0x20732f=_0x20732f-0x0;var _0x5c3d7b=_0x1e24[_0x20732f];return _0x5c3d7b;};'use strict';var BPromise=require(_0x41e2('0x0'));var moment=require(_0x41e2('0x1'));var _=require(_0x41e2('0x2'));var util=require(_0x41e2('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x41e2('0x4')][_0x41e2('0x5')]({'port':0x2329});function request(_0x810a00,_0x3d02e7){return new BPromise(function(_0x50b618,_0x433cff){return client[_0x41e2('0x6')](_0x810a00,_0x3d02e7)[_0x41e2('0x7')](function(_0x2bc3fe){if(_0x2bc3fe[_0x41e2('0x8')]){return _0x433cff(_0x2bc3fe[_0x41e2('0x8')][_0x41e2('0x9')]);}else{return _0x50b618(_0x2bc3fe[_0x41e2('0xa')]);}})[_0x41e2('0xb')](function(_0x5ed6c7){return _0x433cff(_0x5ed6c7);});});}exports[_0x41e2('0xc')]=function(_0x25dd75){return request(_0x41e2('0xd'),{'options':{'raw':![],'where':{'name':_0x25dd75},'attributes':[_0x41e2('0xe')]}});};exports[_0x41e2('0xf')]=function(_0x2fe0a6){return request(_0x41e2('0x10'),{'options':{'raw':![],'where':{'id':_0x2fe0a6},'include':[{'model':_0x41e2('0x11'),'as':_0x41e2('0x12')}],'attributes':['id','name',_0x41e2('0x13')]}});};exports['getSquareProjectById']=function(_0x1d9f89){return request(_0x41e2('0xd'),{'options':{'where':{'id':_0x1d9f89},'attributes':[_0x41e2('0x14')]}});};exports['getVoiceQueueById']=function(_0x16dd93){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x16dd93},'attributes':[_0x41e2('0x14')]}});};exports['getVariableById']=function(_0x3128d8){return request(_0x41e2('0x15'),{'options':{'where':{'id':_0x3128d8},'attributes':[_0x41e2('0x14')]}});};exports['getSquareOdbcById']=function(_0x9aab16){return request(_0x41e2('0x16'),{'options':{'where':{'id':_0x9aab16},'attributes':[_0x41e2('0x17')]}});};exports[_0x41e2('0x18')]=function(_0x491f50){return request(_0x41e2('0x19'),{'options':{'where':{'id':_0x491f50},'attributes':[_0x41e2('0x14')]}});};exports[_0x41e2('0x1a')]=function(_0x3d3c83){return request('ShowTrunk',{'options':{'where':{'id':_0x3d3c83},'attributes':[_0x41e2('0x14')]}});};exports[_0x41e2('0x1b')]=function(_0x4505a6){return request(_0x41e2('0x1c'),{'options':{'where':{'id':_0x4505a6},'attributes':['save_name']}});};exports[_0x41e2('0x1d')]=function(_0x3fc700){return request(_0x41e2('0x1e'),{'options':{'raw':![],'where':{'id':_0x3fc700},'include':[{'model':_0x41e2('0x1f'),'as':_0x41e2('0x20')}]}});};exports[_0x41e2('0x21')]=function(_0x3dc6be){return request(_0x41e2('0x22'),{'options':{'where':{'id':_0x3dc6be},'attributes':['id',_0x41e2('0x14')]}});};exports[_0x41e2('0x23')]=function(_0x2cb747){return request(_0x41e2('0x24'),{'body':_0x2cb747});};exports[_0x41e2('0x25')]=function(_0x267a25){return request(_0x41e2('0x26'),{'body':_0x267a25});};exports[_0x41e2('0x27')]=function(_0x2416fe){return request('CreateSquareReport',{'body':_[_0x41e2('0x28')](_0x2416fe,{'project_name':_0x2416fe['arg_1'],'prev_project_name':_0x2416fe[_0x41e2('0x29')]||'','is_subproject':_0x2416fe[_0x41e2('0x29')]?!![]:![],'leaveAt':moment()[_0x41e2('0x2a')](_0x41e2('0x2b'))})});};exports[_0x41e2('0x2c')]=function(_0x2cae5d){return request(_0x41e2('0x2d'),{'body':_0x2cae5d});};exports[_0x41e2('0x2e')]=function(_0x5ec732){return request('CreateSquareMessage',{'body':_0x5ec732});};exports[_0x41e2('0x2f')]=function(_0x49ec8e){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x49ec8e[_0x41e2('0x30')],'ListId':_0x49ec8e['ListId']}}})['then'](function(_0x18a14f){if(_0x18a14f){return _0x18a14f;}return request(_0x41e2('0x31'),{'body':_0x49ec8e});});};exports[_0x41e2('0x32')]=function(_0x20df8a){return request(_0x41e2('0x33'),{'options':{'where':{'id':_0x20df8a},'attributes':[_0x41e2('0x14')]}});};exports['agentLogin']=function(_0x273710,_0x55f2cf){return request(_0x41e2('0x34'),{'body':{'interface':_0x55f2cf},'options':{'where':_0x273710}});};exports[_0x41e2('0x35')]=function(_0x114ba1,_0x442062,_0x3c4fe5){return request(_0x41e2('0x36'),{'body':{'type':_0x442062,'uniqueid':_0x3c4fe5},'options':{'where':_0x114ba1}});};exports[_0x41e2('0x37')]=function(_0x24a89d){return request(_0x41e2('0x38'),{'body':{},'options':{'where':_0x24a89d}});};exports[_0x41e2('0x39')]=function(_0x271a24){return request(_0x41e2('0x3a'),{'body':{},'options':{'where':_0x271a24}});}; \ No newline at end of file +var _0xe4e7=['getPauseById','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','request','then','error','message','result','catch','getSquareProject','production','MailServerOut','Smtp','email','getSquareProjectById','ShowSquareProject','name','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getTrunkById','ShowSound','save_name','getIntervalById','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe4e7,0x78));var _0x7e4e=function(_0x4a2854,_0x3a0b75){_0x4a2854=_0x4a2854-0x0;var _0xaf21e=_0xe4e7[_0x4a2854];return _0xaf21e;};'use strict';var BPromise=require(_0x7e4e('0x0'));var moment=require(_0x7e4e('0x1'));var _=require(_0x7e4e('0x2'));var util=require(_0x7e4e('0x3'));var jayson=require(_0x7e4e('0x4'));var client=jayson[_0x7e4e('0x5')]['http']({'port':0x2329});function request(_0x545fb1,_0x5eec43){return new BPromise(function(_0x358713,_0x304e09){return client[_0x7e4e('0x6')](_0x545fb1,_0x5eec43)[_0x7e4e('0x7')](function(_0x4290ea){if(_0x4290ea[_0x7e4e('0x8')]){return _0x304e09(_0x4290ea[_0x7e4e('0x8')][_0x7e4e('0x9')]);}else{return _0x358713(_0x4290ea[_0x7e4e('0xa')]);}})[_0x7e4e('0xb')](function(_0x304536){return _0x304e09(_0x304536);});});}exports[_0x7e4e('0xc')]=function(_0x10d9ab){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x10d9ab},'attributes':[_0x7e4e('0xd')]}});};exports['getMailAccountById']=function(_0x204854){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x204854},'include':[{'model':_0x7e4e('0xe'),'as':_0x7e4e('0xf')}],'attributes':['id','name',_0x7e4e('0x10')]}});};exports[_0x7e4e('0x11')]=function(_0x555b56){return request(_0x7e4e('0x12'),{'options':{'where':{'id':_0x555b56},'attributes':[_0x7e4e('0x13')]}});};exports[_0x7e4e('0x14')]=function(_0x3328df){return request(_0x7e4e('0x15'),{'options':{'where':{'id':_0x3328df},'attributes':[_0x7e4e('0x13')]}});};exports['getVariableById']=function(_0x26f478){return request(_0x7e4e('0x16'),{'options':{'where':{'id':_0x26f478},'attributes':[_0x7e4e('0x13')]}});};exports[_0x7e4e('0x17')]=function(_0x50b0fb){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x50b0fb},'attributes':[_0x7e4e('0x18')]}});};exports[_0x7e4e('0x19')]=function(_0x37f4bd){return request(_0x7e4e('0x1a'),{'options':{'where':{'id':_0x37f4bd},'attributes':['name']}});};exports[_0x7e4e('0x1b')]=function(_0x262d6b){return request('ShowTrunk',{'options':{'where':{'id':_0x262d6b},'attributes':['name']}});};exports['getSoundById']=function(_0x2b208b){return request(_0x7e4e('0x1c'),{'options':{'where':{'id':_0x2b208b},'attributes':[_0x7e4e('0x1d')]}});};exports[_0x7e4e('0x1e')]=function(_0x2f51a9){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x2f51a9},'include':[{'model':_0x7e4e('0x1f'),'as':_0x7e4e('0x20')}]}});};exports['getSmsAccountById']=function(_0x1fea59){return request(_0x7e4e('0x21'),{'options':{'where':{'id':_0x1fea59},'attributes':['id',_0x7e4e('0x13')]}});};exports[_0x7e4e('0x22')]=function(_0x93e23c){return request(_0x7e4e('0x23'),{'body':_0x93e23c});};exports['createSquareDetailsReport']=function(_0x29938c){return request(_0x7e4e('0x24'),{'body':_0x29938c});};exports['createSquareReport']=function(_0x43c53b){return request(_0x7e4e('0x25'),{'body':_[_0x7e4e('0x26')](_0x43c53b,{'project_name':_0x43c53b[_0x7e4e('0x27')],'prev_project_name':_0x43c53b[_0x7e4e('0x28')]||'','is_subproject':_0x43c53b[_0x7e4e('0x28')]?!![]:![],'leaveAt':moment()[_0x7e4e('0x29')](_0x7e4e('0x2a'))})});};exports[_0x7e4e('0x2b')]=function(_0x2b5469){return request(_0x7e4e('0x2c'),{'body':_0x2b5469});};exports[_0x7e4e('0x2d')]=function(_0x4fd751){return request(_0x7e4e('0x2e'),{'body':_0x4fd751});};exports[_0x7e4e('0x2f')]=function(_0x466aad){return request(_0x7e4e('0x30'),{'options':{'raw':![],'where':{'phone':_0x466aad[_0x7e4e('0x31')],'ListId':_0x466aad[_0x7e4e('0x32')]}}})[_0x7e4e('0x7')](function(_0x126b3d){if(_0x126b3d){return _0x126b3d;}return request('CreateCmContact',{'body':_0x466aad});});};exports[_0x7e4e('0x33')]=function(_0x1099e3){return request('ShowPause',{'options':{'where':{'id':_0x1099e3},'attributes':[_0x7e4e('0x13')]}});};exports['agentLogin']=function(_0x36ef1d,_0x2d179e){return request('LoginUser',{'body':{'interface':_0x2d179e},'options':{'where':_0x36ef1d}});};exports[_0x7e4e('0x34')]=function(_0x4cf320,_0x122a18,_0x1cdb91){return request(_0x7e4e('0x35'),{'body':{'type':_0x122a18,'uniqueid':_0x1cdb91},'options':{'where':_0x4cf320}});};exports[_0x7e4e('0x36')]=function(_0x290abd){return request('UnpauseUser',{'body':{},'options':{'where':_0x290abd}});};exports[_0x7e4e('0x37')]=function(_0xd824b4){return request(_0x7e4e('0x38'),{'body':{},'options':{'where':_0xd824b4}});}; \ 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 e09b670..a537fe3 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 _0xa8a8=['./lex','exports','./polly'];(function(_0x2d6375,_0x149216){var _0x29186f=function(_0x31fc6f){while(--_0x31fc6f){_0x2d6375['push'](_0x2d6375['shift']());}};_0x29186f(++_0x149216);}(_0xa8a8,0xec));var _0x8a8a=function(_0x46e8c9,_0x31da80){_0x46e8c9=_0x46e8c9-0x0;var _0x356e5c=_0xa8a8[_0x46e8c9];return _0x356e5c;};var polly=require(_0x8a8a('0x0'));var lex=require(_0x8a8a('0x1'));module[_0x8a8a('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x032e=['./polly','exports'];(function(_0x579870,_0x3af560){var _0x5a3731=function(_0x349356){while(--_0x349356){_0x579870['push'](_0x579870['shift']());}};_0x5a3731(++_0x3af560);}(_0x032e,0x124));var _0xe032=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x032e[_0x2dafbe];return _0x58a45a;};var polly=require(_0xe032('0x0'));var lex=require('./lex');module[_0xe032('0x1')]={'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 0e26c37..f946416 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 _0xf290=['exports'];(function(_0x153c6e,_0x2fa57e){var _0x36b210=function(_0x3464c6){while(--_0x3464c6){_0x153c6e['push'](_0x153c6e['shift']());}};_0x36b210(++_0x2fa57e);}(_0xf290,0xde));var _0x0f29=function(_0x40dd56,_0x726ca5){_0x40dd56=_0x40dd56-0x0;var _0x4f850f=_0xf290[_0x40dd56];return _0x4f850f;};'use strict';var lex=require('./lib/api');module[_0x0f29('0x0')]=function(_0x550692,_0x1d35f0,_0x4b16e4,_0xb8a620,_0x1b4f85,_0x38f5b5){return lex(_0x550692,_0x1d35f0,_0x4b16e4,_0xb8a620,_0x1b4f85,_0x38f5b5);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x5cfde5,_0xc8f60a,_0x190dc3,_0x9601f9,_0xfe8bb0,_0x4918dc){return lex(_0x5cfde5,_0xc8f60a,_0x190dc3,_0x9601f9,_0xfe8bb0,_0x4918dc);}; \ 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 a01f1db..05b8895 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 _0xbb4b=['postText','slots','hasOwnProperty','slot_','exports','$LATEST','aws-sdk'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0xbb4b,0x187));var _0xbbb4=function(_0x5eac63,_0x4e2921){_0x5eac63=_0x5eac63-0x0;var _0x3ea7ba=_0xbb4b[_0x5eac63];return _0x3ea7ba;};'use strict';var BPromise=require('bluebird');var AWS=require(_0xbbb4('0x0'));function lexResult(_0x44b941,_0x3dccbb){return new BPromise(function(_0x251aa4,_0x4abd59){_0x44b941[_0xbbb4('0x1')](_0x3dccbb,function(_0x52311c,_0x5d498b){if(_0x52311c){_0x4abd59(_0x52311c);}if(_0x5d498b['slots']){for(const _0x4b8fa2 in _0x5d498b[_0xbbb4('0x2')]){if(_0x5d498b[_0xbbb4('0x2')][_0xbbb4('0x3')](_0x4b8fa2)){var _0x5d89f9=_0x5d498b[_0xbbb4('0x2')][_0x4b8fa2];_0x5d498b[_0xbbb4('0x4')+_0x4b8fa2]=_0x5d89f9;}}}_0x251aa4(_0x5d498b);});});}module[_0xbbb4('0x5')]=function(_0x2ecb46,_0x1c2b21,_0x47cc97,_0x31bc8c,_0x1d4051,_0x52bb4c){var _0xd8fc0d=new AWS['LexRuntime']({'accessKeyId':_0x1c2b21,'secretAccessKey':_0x47cc97,'region':_0x31bc8c});var _0x20bbfd={'botAlias':_0xbbb4('0x6'),'botName':_0x52bb4c,'inputText':_0x1d4051,'userId':_0x2ecb46};return lexResult(_0xd8fc0d,_0x20bbfd);}; \ No newline at end of file +var _0x3ebd=['hasOwnProperty','slot_','LexRuntime','$LATEST','bluebird','aws-sdk','postText','slots'];(function(_0x2e71f2,_0x4ff4fc){var _0x33df0b=function(_0x26c5b9){while(--_0x26c5b9){_0x2e71f2['push'](_0x2e71f2['shift']());}};_0x33df0b(++_0x4ff4fc);}(_0x3ebd,0x1f4));var _0xd3eb=function(_0x3b3fb4,_0xf4e66c){_0x3b3fb4=_0x3b3fb4-0x0;var _0x485c7a=_0x3ebd[_0x3b3fb4];return _0x485c7a;};'use strict';var BPromise=require(_0xd3eb('0x0'));var AWS=require(_0xd3eb('0x1'));function lexResult(_0x3ce3ec,_0x5a4cf8){return new BPromise(function(_0x3246f8,_0x1177b7){_0x3ce3ec[_0xd3eb('0x2')](_0x5a4cf8,function(_0x23743e,_0x1c7037){if(_0x23743e){_0x1177b7(_0x23743e);}if(_0x1c7037[_0xd3eb('0x3')]){for(const _0x3c1702 in _0x1c7037[_0xd3eb('0x3')]){if(_0x1c7037[_0xd3eb('0x3')][_0xd3eb('0x4')](_0x3c1702)){var _0x4b3121=_0x1c7037[_0xd3eb('0x3')][_0x3c1702];_0x1c7037[_0xd3eb('0x5')+_0x3c1702]=_0x4b3121;}}}_0x3246f8(_0x1c7037);});});}module['exports']=function(_0x4497f9,_0x3a9c13,_0x3abcfe,_0x114b5b,_0x311d68,_0x530e71){var _0xe81c15=new AWS[(_0xd3eb('0x6'))]({'accessKeyId':_0x3a9c13,'secretAccessKey':_0x3abcfe,'region':_0x114b5b});var _0x285c97={'botAlias':_0xd3eb('0x7'),'botName':_0x530e71,'inputText':_0x311d68,'userId':_0x4497f9};return lexResult(_0xe81c15,_0x285c97);}; \ 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 8ffefa4..46a0676 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 _0xbae9=['./lib/api'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xbae9,0x1bf));var _0x9bae=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xbae9[_0xfa634c];return _0x73e478;};'use strict';var polly=require(_0x9bae('0x0'));module['exports']=function(_0x1a3cee,_0x47f6c0,_0x52ce01,_0x24601d,_0x1b5b90,_0x1d49c3,_0x39181a){return polly(_0x1a3cee,_0x47f6c0,_0x52ce01,_0x24601d,_0x1b5b90,_0x1d49c3,_0x39181a);}; \ No newline at end of file +var _0xe00d=['exports','./lib/api'];(function(_0x1ae74e,_0x1a195c){var _0x3708b0=function(_0x33b4cd){while(--_0x33b4cd){_0x1ae74e['push'](_0x1ae74e['shift']());}};_0x3708b0(++_0x1a195c);}(_0xe00d,0x6b));var _0xde00=function(_0x15ec89,_0x21f093){_0x15ec89=_0x15ec89-0x0;var _0x52add1=_0xe00d[_0x15ec89];return _0x52add1;};'use strict';var polly=require(_0xde00('0x0'));module[_0xde00('0x1')]=function(_0xe8ad,_0x339ddd,_0x396237,_0x14d1be,_0x1452a0,_0x2be82a,_0x46caf4){return polly(_0xe8ad,_0x339ddd,_0x396237,_0x14d1be,_0x1452a0,_0x2be82a,_0x46caf4);}; \ 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 a79a94d..147662d 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 _0x7d12=['AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','text','mp3','path','bluebird','aws-sdk'];(function(_0x5d3b2b,_0x361fed){var _0x3e6f54=function(_0x4e61ae){while(--_0x4e61ae){_0x5d3b2b['push'](_0x5d3b2b['shift']());}};_0x3e6f54(++_0x361fed);}(_0x7d12,0x7d));var _0x27d1=function(_0x58b44a,_0x1a7aa6){_0x58b44a=_0x58b44a-0x0;var _0xd6779d=_0x7d12[_0x58b44a];return _0xd6779d;};'use strict';var fs=require('fs');var path=require(_0x27d1('0x0'));var BPromise=require(_0x27d1('0x1'));var rs=require('randomstring');var AWS=require(_0x27d1('0x2'));function pollyResult(_0x31e0ed,_0x7107b3,_0x1988e6){return new BPromise(function(_0x478036,_0x1bdb2e){_0x31e0ed['synthesizeSpeech'](_0x7107b3,function(_0x3729b8,_0x482eba){if(_0x3729b8){_0x1bdb2e(_0x3729b8);}else if(_0x482eba){if(_0x482eba[_0x27d1('0x3')]instanceof Buffer){fs[_0x27d1('0x4')](_0x1988e6,_0x482eba[_0x27d1('0x3')],function(_0x4bfeaa){if(_0x4bfeaa){_0x1bdb2e(_0x4bfeaa);}else{_0x478036();}});}else{_0x1bdb2e(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x1bdb2e(new Error(_0x27d1('0x5')));}});});}module['exports']=function(_0x2a9e61,_0xb84eba,_0x5d01db,_0x56f720,_0x5ec670,_0x4cc66b,_0x13a546){var _0x8d0795=new AWS['Polly']({'accessKeyId':_0x2a9e61,'secretAccessKey':_0xb84eba,'region':_0x5d01db});var _0x1baa8b={'Text':_0x5ec670,'TextType':_0x4cc66b||_0x27d1('0x6'),'OutputFormat':_0x27d1('0x7'),'VoiceId':_0x56f720};return pollyResult(_0x8d0795,_0x1baa8b,_0x13a546);}; \ No newline at end of file +var _0x72f7=['aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','bluebird'];(function(_0x5eb81a,_0x5aa6ae){var _0x4be675=function(_0x4db013){while(--_0x4db013){_0x5eb81a['push'](_0x5eb81a['shift']());}};_0x4be675(++_0x5aa6ae);}(_0x72f7,0x1a7));var _0x772f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x72f7[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x772f('0x0'));var rs=require('randomstring');var AWS=require(_0x772f('0x1'));function pollyResult(_0x5a0048,_0x1c2fb3,_0x1d5c2b){return new BPromise(function(_0x62dd62,_0x5a3794){_0x5a0048['synthesizeSpeech'](_0x1c2fb3,function(_0x4c4f3e,_0x2134a0){if(_0x4c4f3e){_0x5a3794(_0x4c4f3e);}else if(_0x2134a0){if(_0x2134a0[_0x772f('0x2')]instanceof Buffer){fs[_0x772f('0x3')](_0x1d5c2b,_0x2134a0[_0x772f('0x2')],function(_0x3b319c){if(_0x3b319c){_0x5a3794(_0x3b319c);}else{_0x62dd62();}});}else{_0x5a3794(new Error(_0x772f('0x4')));}}else{_0x5a3794(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x772f('0x5')]=function(_0x255179,_0x21abc7,_0x2d3e59,_0x11a644,_0x5698e0,_0x129824,_0x146260){var _0x225108=new AWS['Polly']({'accessKeyId':_0x255179,'secretAccessKey':_0x21abc7,'region':_0x2d3e59});var _0x3249e0={'Text':_0x5698e0,'TextType':_0x129824||_0x772f('0x6'),'OutputFormat':_0x772f('0x7'),'VoiceId':_0x11a644};return pollyResult(_0x225108,_0x3249e0,_0x146260);}; \ 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 730cd4c..208faa7 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 _0x2707=['./lib/api'];(function(_0xe67c8d,_0x4535a7){var _0x1bd65f=function(_0x14b96b){while(--_0x14b96b){_0xe67c8d['push'](_0xe67c8d['shift']());}};_0x1bd65f(++_0x4535a7);}(_0x2707,0x118));var _0x7270=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x2707[_0x4fbfd9];return _0x31dc94;};'use strict';var asr=require(_0x7270('0x0'));module['exports']=function(_0x3b71d5,_0x272813,_0x49cf80,_0x1e47f9){return asr(_0x3b71d5,_0x272813,_0x49cf80);}; \ No newline at end of file +var _0xcc3f=['./lib/api'];(function(_0x26e52e,_0x1cbd4b){var _0x376315=function(_0x4a049f){while(--_0x4a049f){_0x26e52e['push'](_0x26e52e['shift']());}};_0x376315(++_0x1cbd4b);}(_0xcc3f,0x16f));var _0xfcc3=function(_0x46d36f,_0xa0e2a4){_0x46d36f=_0x46d36f-0x0;var _0x2d7ece=_0xcc3f[_0x46d36f];return _0x2d7ece;};'use strict';var asr=require(_0xfcc3('0x0'));module['exports']=function(_0x364293,_0x48b383,_0x3892c5,_0x49a818){return asr(_0x364293,_0x48b383,_0x3892c5);}; \ 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 6d1590a..71b6403 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 _0x3262=['lang\x20should\x20be\x20a\x20string','readFileSync','toString','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3262,0x164));var _0x2326=function(_0x4f3c9b,_0x28e078){_0x4f3c9b=_0x4f3c9b-0x0;var _0x84e58a=_0x3262[_0x4f3c9b];return _0x84e58a;};'use strict';var url=require(_0x2326('0x0'));var BPromise=require(_0x2326('0x1'));var fs=require('fs');var host=_0x2326('0x2');module[_0x2326('0x3')]=function(_0x93c9d4,_0x280ad6,_0x4ecd22){return new BPromise(function(_0x316110,_0x3ba913){var _0x1e727d;if(typeof _0x93c9d4!==_0x2326('0x4')||_0x93c9d4[_0x2326('0x5')]===0x0){return _0x3ba913(_0x2326('0x6'));}if(typeof _0x280ad6!=='string'||_0x280ad6[_0x2326('0x5')]===0x0){return _0x3ba913('key\x20should\x20be\x20a\x20string');}if(typeof _0x4ecd22!==_0x2326('0x7')&&(typeof _0x4ecd22!=='string'||_0x4ecd22[_0x2326('0x5')]===0x0)){return _0x3ba913(_0x2326('0x8'));}try{_0x1e727d=fs[_0x2326('0x9')](_0x93c9d4)[_0x2326('0xa')]('base64');}catch(_0x4649a7){return _0x3ba913(_0x4649a7);}return _0x316110({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x280ad6,'body':{'config':{'encoding':_0x2326('0xb'),'sampleRateHertz':_0x2326('0xc'),'languageCode':_0x4ecd22},'audio':{'content':_0x1e727d}},'json':!![]});});}; \ No newline at end of file +var _0x5ee3=['bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x5ee3,0x74));var _0x35ee=function(_0x1a3255,_0xd1c5bd){_0x1a3255=_0x1a3255-0x0;var _0x44dcf9=_0x5ee3[_0x1a3255];return _0x44dcf9;};'use strict';var url=require(_0x35ee('0x0'));var BPromise=require(_0x35ee('0x1'));var fs=require('fs');var host=_0x35ee('0x2');module[_0x35ee('0x3')]=function(_0x3c5e67,_0x2eceed,_0x433141){return new BPromise(function(_0x3c6fb1,_0x15a986){var _0x27975a;if(typeof _0x3c5e67!==_0x35ee('0x4')||_0x3c5e67[_0x35ee('0x5')]===0x0){return _0x15a986(_0x35ee('0x6'));}if(typeof _0x2eceed!=='string'||_0x2eceed[_0x35ee('0x5')]===0x0){return _0x15a986('key\x20should\x20be\x20a\x20string');}if(typeof _0x433141!=='undefined'&&(typeof _0x433141!==_0x35ee('0x4')||_0x433141[_0x35ee('0x5')]===0x0)){return _0x15a986('lang\x20should\x20be\x20a\x20string');}try{_0x27975a=fs['readFileSync'](_0x3c5e67)[_0x35ee('0x7')](_0x35ee('0x8'));}catch(_0x27c65b){return _0x15a986(_0x27c65b);}return _0x3c6fb1({'method':_0x35ee('0x9'),'uri':host+_0x35ee('0xa')+_0x2eceed,'body':{'config':{'encoding':_0x35ee('0xb'),'sampleRateHertz':_0x35ee('0xc'),'languageCode':_0x433141},'audio':{'content':_0x27975a}},'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 a3389cd..ed9481e 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 _0x5eee=['exports','./asr'];(function(_0x534519,_0x4878f7){var _0x2155be=function(_0x24572f){while(--_0x24572f){_0x534519['push'](_0x534519['shift']());}};_0x2155be(++_0x4878f7);}(_0x5eee,0xb9));var _0xe5ee=function(_0x227217,_0x3b2bb2){_0x227217=_0x227217-0x0;var _0x28224d=_0x5eee[_0x227217];return _0x28224d;};var asr=require(_0xe5ee('0x0'));module[_0xe5ee('0x1')]={'asr':asr}; \ No newline at end of file +var _0x6a42=['./asr','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x6a42,0x6e));var _0x26a4=function(_0xe204cf,_0x2578b1){_0xe204cf=_0xe204cf-0x0;var _0x4804a5=_0x6a42[_0xe204cf];return _0x4804a5;};var asr=require(_0x26a4('0x0'));module[_0x26a4('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 d8f216c..ad5c294 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 _0xf737=['finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','text:synthesize','tmp','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','utf8','POST','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','googleDialogflow','result','action','actionIncomplete','fulfillment','speech','status','metadata','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','parse','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','apiai-promise','bluebird','http','https','md5','path','randomstring','sox','url','./aws','./google','./tilde','../../../config/logger','agi','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','pipe','end','data','transcode','error\x20convert'];(function(_0x3733ed,_0x4a4bfb){var _0x192af9=function(_0x4a35ea){while(--_0x4a35ea){_0x3733ed['push'](_0x3733ed['shift']());}};_0x192af9(++_0x4a4bfb);}(_0xf737,0xea));var _0x7f73=function(_0x1ad823,_0x2ebd75){_0x1ad823=_0x1ad823-0x0;var _0x5093a7=_0xf737[_0x1ad823];return _0x5093a7;};'use strict';var apiai=require(_0x7f73('0x0'));var BPromise=require(_0x7f73('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x7f73('0x2'));var https=require(_0x7f73('0x3'));var md5=require(_0x7f73('0x4'));var path=require(_0x7f73('0x5'));var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0x7f73('0x6'));var sox=require(_0x7f73('0x7'));var tts=require('google-tts-api');var urlParse=require(_0x7f73('0x8'))['parse'];var util=require('util');var aws=require(_0x7f73('0x9'));var google=require(_0x7f73('0xa'));var sestek=require('./sestek');var tilde=require(_0x7f73('0xb'));var logger=require(_0x7f73('0xc'))(_0x7f73('0xd'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x41c678,_0x1e6f6f){return new BPromise(function(_0x176140,_0x562001){var _0x13852c=urlParse(_0x41c678);var _0x2e4b99=_0x13852c[_0x7f73('0xe')]===_0x7f73('0xf')?https:http;var _0x2fa060={'host':_0x13852c[_0x7f73('0x10')],'path':_0x13852c[_0x7f73('0x5')],'headers':{'user-agent':_0x7f73('0x11')}};_0x2e4b99[_0x7f73('0x12')](_0x2fa060,function(_0x31294c){if(_0x31294c[_0x7f73('0x13')]!==0xc8){logger[_0x7f73('0x14')](_0x7f73('0x15')+_0x41c678+'\x20failed,\x20status\x20code\x20=\x20'+_0x31294c[_0x7f73('0x13')]+'\x20('+_0x31294c['statusMessage']+')');_0x562001(new Error(_0x7f73('0x15')+_0x41c678+_0x7f73('0x16')+_0x31294c[_0x7f73('0x13')]+'\x20('+_0x31294c[_0x7f73('0x17')]+')'));return;}var _0x56217f=fs[_0x7f73('0x18')](_0x1e6f6f);_0x56217f['on'](_0x7f73('0x19'),function(){logger[_0x7f73('0x1a')](_0x7f73('0x1b'));_0x56217f[_0x7f73('0x1c')](_0x176140);});_0x56217f['on'](_0x7f73('0x14'),function(_0x3b98d7){fs['unlink'](_0x1e6f6f);logger[_0x7f73('0x14')]('download\x20error',_0x3b98d7);_0x562001(_0x3b98d7);});_0x31294c[_0x7f73('0x1d')](_0x56217f);})['on'](_0x7f73('0x14'),function(_0x50e376){logger[_0x7f73('0x14')](_0x50e376);_0x562001(_0x50e376);})[_0x7f73('0x1e')]();});}function uploadFile(_0x293768){return new BPromise(function(_0x47a65b,_0x5a68c4){var _0x10d734=urlParse(_0x293768);var _0x5792bd=_0x10d734['protocol']===_0x7f73('0xf')?https:http;var _0x30c84d={'host':_0x10d734[_0x7f73('0x10')],'path':_0x10d734[_0x7f73('0x5')],'headers':{'user-agent':_0x7f73('0x11')}};_0x5792bd[_0x7f73('0x12')](_0x30c84d,function(_0x1c2119){if(_0x1c2119[_0x7f73('0x13')]!==0xc8){_0x5a68c4(new Error('request\x20to\x20'+_0x293768+'\x20failed,\x20status\x20code\x20=\x20'+_0x1c2119['statusCode']+'\x20('+_0x1c2119['statusMessage']+')'));return;}var _0x342325='';_0x1c2119['on'](_0x7f73('0x1f'),function(_0x46c880){_0x342325+=_0x46c880;});_0x1c2119['on'](_0x7f73('0x1e'),function(){_0x47a65b(_0x342325);});})['on'](_0x7f73('0x14'),function(_0x566913){_0x5a68c4(_0x566913);})[_0x7f73('0x1e')]();});}function convertFile(_0x4eb0c1,_0xf896d6){return new BPromise(function(_0x2ac418,_0x37d0c2){var _0x131677=sox[_0x7f73('0x20')](_0x4eb0c1,_0xf896d6,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x131677['on']('error',function(_0x1d19e3){logger['error'](_0x7f73('0x21'),_0x1d19e3);_0x37d0c2(_0x1d19e3);});_0x131677['on'](_0x7f73('0x1e'),function(){logger[_0x7f73('0x1a')](_0x7f73('0x22'));_0x2ac418();});_0x131677[_0x7f73('0x23')]();});}function base64Decode(_0x4acd50,_0x1ce1f6){var _0x182c6d=path[_0x7f73('0x24')](__dirname,'tmp',rs[_0x7f73('0x25')](0x4)+_0x7f73('0x26'));fs[_0x7f73('0x27')](_0x182c6d,_0x4acd50,_0x7f73('0x28'));return convertFile(_0x182c6d,_0x1ce1f6)[_0x7f73('0x29')](function(){try{fs[_0x7f73('0x2a')](_0x182c6d);fs[_0x7f73('0x2b')](_0x1ce1f6,_0x7f73('0x2c'));}catch(_0x5ab696){logger['error'](_0x5ab696);}return _0x1ce1f6[_0x7f73('0x2d')]('.')[0x0];});}function base64Encode(_0x398c16){var _0x4fcf68=fs[_0x7f73('0x2e')](_0x398c16);return new Buffer(_0x4fcf68)['toString']('base64');}exports[_0x7f73('0x2f')]=function(_0x3e064b,_0x313ab4,_0xb69db0,_0x5ee0c7,_0x5d01e3,_0xe20940){var _0x5d9990,_0x568623;var _0x13936b=_0x7f73('0x30');var _0x1b8b36=_0x7f73('0x31')+_0x3e064b;var _0x3c9c5a={};if(_0x313ab4===_0x7f73('0x32')){_0x3c9c5a[_0x7f73('0x33')]={'ssml':_0xb69db0};}else{_0x3c9c5a['input']={'text':_0xb69db0};};_0x3c9c5a[_0x7f73('0x34')]={'languageCode':_0x5ee0c7,'ssmlGender':_0x5d01e3};_0x3c9c5a[_0x7f73('0x35')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x36dca7={'url':_0x13936b+_0x7f73('0x36')+_0x1b8b36,'method':'POST','json':!![],'body':_0x3c9c5a};return rp(_0x36dca7)[_0x7f73('0x29')](function(_0x18315d){return new BPromise(function(_0x5de2b9,_0x4d40da){_0x5d9990=path[_0x7f73('0x24')](__dirname,_0x7f73('0x37'),rs['generate'](0x4)+_0x7f73('0x38'));var _0x53d764=Buffer[_0x7f73('0x39')](_0x18315d[_0x7f73('0x3a')],_0x7f73('0x28'));return fs[_0x7f73('0x3b')](_0x5d9990,_0x53d764,function(_0x2442dd){_0x4d40da(_0x2442dd);},function(_0x27e889){fs['chmodSync'](_0x5d9990,_0x7f73('0x2c'));_0x5de2b9(_0x27e889);});});})[_0x7f73('0x29')](function(_0x512cc5){_0x568623=path['resolve'](__dirname,_0x7f73('0x37'),rs['generate'](0x4)+_0x7f73('0x26'));return convertFile(_0x5d9990,_0x568623);})[_0x7f73('0x29')](function(){try{fs[_0x7f73('0x2a')](_0x5d9990);fs['chmodSync'](_0x568623,_0x7f73('0x2c'));}catch(_0x5294fa){logger['error'](_0x5294fa);}logger[_0x7f73('0x1a')](_0x7f73('0x3c'),_0x568623[_0x7f73('0x2d')]('.')[0x0]);return _0x568623[_0x7f73('0x2d')]('.')[0x0];});};exports[_0x7f73('0x3d')]=function(_0x49db9c,_0x4e1049){var _0xb3445='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x15944f,_0x51c455;var _0x14e972;var _0x4b7ed5={'encoding':_0x7f73('0x3e'),'method':_0x7f73('0x3f'),'timeout':0x2710,'url':_0xb3445,'headers':{'Content-Type':_0x7f73('0x40')},'body':_0x7f73('0x41')+encodeURIComponent(JSON[_0x7f73('0x42')]([[[_0x7f73('0x43'),JSON[_0x7f73('0x42')]([_0x49db9c,_0x4e1049||'en',![],'null']),null,_0x7f73('0x44')]]]))};return rp(_0x4b7ed5)[_0x7f73('0x29')](function(_0x4ba3eb){try{_0x14e972=eval(_0x4ba3eb[_0x7f73('0x45')](0x5))[0x0][0x2];}catch(_0xdc2016){throw new Error(_0x7f73('0x46')+_0x4ba3eb[_0x7f73('0x1f')]);}if(!_0x14e972){if(_0x49db9c[_0x7f73('0x47')]>0xc8){throw new Error(_0x7f73('0x48'));}else{throw new Error(_0x7f73('0x49')+_0x4e1049+_0x7f73('0x4a'));}}try{_0x14e972=eval(_0x14e972)[0x0];}catch(_0x33a93d){throw new Error(_0x7f73('0x46')+res[_0x7f73('0x1f')]);}const _0x5819ae=_0x14e972;_0x15944f=path[_0x7f73('0x24')](__dirname,_0x7f73('0x37'),rs[_0x7f73('0x25')](0x4)+_0x7f73('0x38'));fs[_0x7f73('0x27')](_0x15944f,_0x14e972,{'encoding':_0x7f73('0x28')});_0x51c455=path[_0x7f73('0x24')](__dirname,_0x7f73('0x37'),rs[_0x7f73('0x25')](0x4)+_0x7f73('0x26'));return convertFile(_0x15944f,_0x51c455);})[_0x7f73('0x29')](function(){try{fs[_0x7f73('0x2a')](_0x15944f);fs[_0x7f73('0x2b')](_0x51c455,_0x7f73('0x2c'));}catch(_0x1201a6){logger[_0x7f73('0x14')](_0x1201a6);}logger[_0x7f73('0x1a')](_0x7f73('0x4b'),_0x51c455[_0x7f73('0x2d')]('.')[0x0]);return _0x51c455[_0x7f73('0x2d')]('.')[0x0];});};exports['googleASR']=function(_0x5dff49,_0x42deb3,_0x4f05eb){return google[_0x7f73('0x4c')](_0x5dff49,_0x42deb3,_0x4f05eb)[_0x7f73('0x29')](function(_0x47eb0d){logger[_0x7f73('0x1a')](_0x47eb0d[_0x7f73('0x4d')]);return rp(_0x47eb0d);})[_0x7f73('0x29')](function(_0x3c431d){var _0x59d4b1='';var _0x497f8b=0x0;try{fs[_0x7f73('0x2a')](_0x5dff49);}catch(_0x1ed7e9){logger[_0x7f73('0x14')](_0x1ed7e9);}if(_0x3c431d&&_0x3c431d['results']){_0x59d4b1=_0x3c431d[_0x7f73('0x4e')]['map'](function(_0x428fab){return _0x428fab&&_0x428fab['alternatives'][0x0]&&_0x428fab[_0x7f73('0x4f')][0x0][_0x7f73('0x50')]?_0x428fab[_0x7f73('0x4f')][0x0][_0x7f73('0x50')]:'';})[_0x7f73('0x51')]('\x0a');_0x497f8b=_0x3c431d[_0x7f73('0x4e')][_0x7f73('0x52')](function(_0x176133){return _0x176133&&_0x176133[_0x7f73('0x4f')][0x0]&&_0x176133['alternatives'][0x0][_0x7f73('0x53')]?_0x176133[_0x7f73('0x4f')][0x0][_0x7f73('0x53')]:0x0;})[_0x7f73('0x51')]('\x0a');}logger[_0x7f73('0x1a')](_0x7f73('0x54'),_0x59d4b1);logger[_0x7f73('0x1a')]('googleASR\x20confidence',_0x497f8b);return{'transcript':_0x59d4b1,'confidence':_0x497f8b};})[_0x7f73('0x55')](function(_0x4fca76){logger[_0x7f73('0x14')](_0x7f73('0x56'),_0x4fca76[_0x7f73('0x13')],_0x4fca76[_0x7f73('0x57')],_0x4fca76['message']);});};exports[_0x7f73('0x58')]=function(_0x2145d1,_0x105720,_0x529aba,_0x2205a9){var _0x1abe3d=apiai(_0x105720,{'language':_0x2205a9||'en'});return _0x1abe3d['textRequest'](_0x529aba,{'sessionId':md5(_0x2145d1)})[_0x7f73('0x29')](function(_0x16eb29){logger[_0x7f73('0x1a')](JSON[_0x7f73('0x42')](_0x16eb29));return{'source':_0x16eb29['result']['source'],'resolvedQuery':_0x16eb29['result']['resolvedQuery'],'action':_0x16eb29[_0x7f73('0x59')][_0x7f73('0x5a')],'actionIncomplete':_0x16eb29[_0x7f73('0x59')][_0x7f73('0x5b')],'speech':_0x16eb29['result'][_0x7f73('0x5c')][_0x7f73('0x5d')],'score':_0x16eb29[_0x7f73('0x59')]['score'],'statusCode':_0x16eb29[_0x7f73('0x5e')]['code'],'endConversation':_0x16eb29[_0x7f73('0x59')][_0x7f73('0x5f')]['endConversation']||![],'isFallbackIntent':_0x16eb29[_0x7f73('0x59')][_0x7f73('0x5f')][_0x7f73('0x60')]};});};exports[_0x7f73('0x61')]=function(_0x2a81a2,_0x1b1d3c,_0x4a4ebb,_0x3cba21,_0x4186b5,_0x5da8af){var _0x45398d=_0x3cba21['replace'](/\\n/g,'\x0a');var _0x3d899e={'credentials':{'private_key':_0x45398d,'client_email':_0x4a4ebb}};var _0x480260=new dialogflow[(_0x7f73('0x62'))](_0x3d899e);var _0x4366c1=_0x480260[_0x7f73('0x63')](_0x1b1d3c,md5(_0x2a81a2));var _0xd16bd7={'session':_0x4366c1,'queryInput':{'text':{'text':_0x4186b5,'languageCode':_0x5da8af}}};return _0x480260[_0x7f73('0x64')](_0xd16bd7)[_0x7f73('0x29')](function(_0x57b3fe){if(_0x57b3fe&&_0x57b3fe[_0x7f73('0x47')]){logger[_0x7f73('0x1a')]('Dialogflow\x20V2\x20response:',JSON['stringify'](_0x57b3fe));var _0x76f651=_0x57b3fe[0x0];if(_0x76f651){var _0xe15c66={'action':_0x76f651[_0x7f73('0x65')][_0x7f73('0x5a')],'allRequiredParamsPresent':_0x76f651[_0x7f73('0x65')][_0x7f73('0x66')],'endConversation':_0x76f651[_0x7f73('0x65')][_0x7f73('0x67')]&&_0x76f651['queryResult'][_0x7f73('0x67')][_0x7f73('0x68')]?_0x76f651[_0x7f73('0x65')]['diagnosticInfo'][_0x7f73('0x68')][_0x7f73('0x69')][_0x7f73('0x6a')]:![],'fulfillmentText':_0x76f651[_0x7f73('0x65')][_0x7f73('0x6b')],'intentName':_0x76f651['queryResult']['intent'][_0x7f73('0x57')],'intentDisplayName':_0x76f651[_0x7f73('0x65')][_0x7f73('0x6c')][_0x7f73('0x6d')],'isFallbackIntent':_0x76f651[_0x7f73('0x65')][_0x7f73('0x6c')]['isFallback'],'languageCode':_0x76f651['queryResult'][_0x7f73('0x6e')],'queryText':_0x76f651[_0x7f73('0x65')][_0x7f73('0x6f')],'responseId':_0x76f651[_0x7f73('0x70')],'score':_0x76f651[_0x7f73('0x65')][_0x7f73('0x71')],'speech':_0x76f651['queryResult'][_0x7f73('0x6b')],'providerResponse':JSON[_0x7f73('0x42')](_0x57b3fe)};return _0xe15c66;}}});};exports[_0x7f73('0x72')]=function(_0xc3a62d,_0x5712ed,_0xa68a5d,_0x803adb){return tilde[_0x7f73('0x4c')](_0xc3a62d,_0x5712ed,_0xa68a5d,_0x803adb)['then'](function(_0x2a9146){try{fs[_0x7f73('0x2a')](_0xc3a62d);}catch(_0x3c155c){logger[_0x7f73('0x14')](_0x3c155c);}logger[_0x7f73('0x1a')](_0x7f73('0x73'),_0x2a9146['transcript']);logger['info']('Tilde\x20ASR\x20confidence',_0x2a9146[_0x7f73('0x53')]);return _0x2a9146;});};exports[_0x7f73('0x74')]=function(_0x29d78a,_0x55d65b,_0x3d8df1,_0x52d275,_0x4b12f1,_0x3d7e1b){var _0x4edf2f=path['resolve'](__dirname,'tmp',rs[_0x7f73('0x25')](0x4)+_0x7f73('0x38'));var _0x12e70e;return aws[_0x7f73('0x75')](_0x29d78a,_0x55d65b,_0x3d8df1,_0x52d275,_0x4b12f1,_0x3d7e1b,_0x4edf2f)['then'](function(){_0x12e70e=path[_0x7f73('0x24')](__dirname,_0x7f73('0x37'),rs[_0x7f73('0x25')](0x4)+'.wav');return convertFile(_0x4edf2f,_0x12e70e);})[_0x7f73('0x29')](function(){try{fs[_0x7f73('0x2a')](_0x4edf2f);fs['chmodSync'](_0x12e70e,_0x7f73('0x2c'));}catch(_0x1decc7){logger[_0x7f73('0x14')](_0x1decc7);}return _0x12e70e[_0x7f73('0x2d')]('.')[0x0];});};exports[_0x7f73('0x76')]=function(_0x2ebfa4,_0x19f3a6,_0x3eb85d,_0x55c3fc,_0x64ca51,_0x53a6b1){return aws[_0x7f73('0x77')](_0x2ebfa4,_0x19f3a6,_0x3eb85d,_0x55c3fc,_0x64ca51,_0x53a6b1)[_0x7f73('0x29')](function(_0x3bacb1){logger[_0x7f73('0x1a')](JSON['stringify'](_0x3bacb1));return _0x3bacb1;});};exports[_0x7f73('0x78')]=function(_0x5a5c6e,_0x3bff3a,_0x13968f,_0x105709){var _0x10175c=util[_0x7f73('0x79')](_0x7f73('0x7a'),ISPEECH_API,_0x5a5c6e,encodeURIComponent(_0x3bff3a),_0x13968f,_0x105709);var _0x548f39=path[_0x7f73('0x24')](__dirname,_0x7f73('0x37'),rs['generate'](0x4)+'.mp3');var _0x43f126;return downloadFile(_0x10175c,_0x548f39)[_0x7f73('0x29')](function(){_0x43f126=path[_0x7f73('0x24')](__dirname,_0x7f73('0x37'),rs[_0x7f73('0x25')](0x4)+_0x7f73('0x26'));return convertFile(_0x548f39,_0x43f126);})[_0x7f73('0x29')](function(){try{fs[_0x7f73('0x2a')](_0x548f39);fs[_0x7f73('0x2b')](_0x43f126,_0x7f73('0x2c'));}catch(_0x3db9e4){logger[_0x7f73('0x14')](_0x3db9e4);}return _0x43f126[_0x7f73('0x2d')]('.')[0x0];});};exports[_0x7f73('0x7b')]=function(_0x2bf219,_0x4f582f,_0x41533f,_0x168180){var _0x1b1a09=util[_0x7f73('0x79')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x4f582f,_0x41533f,base64Encode(_0x2bf219),_0x168180?util[_0x7f73('0x79')](_0x7f73('0x7c'),encodeURIComponent(_0x168180)):_0x7f73('0x7d'));return uploadFile(_0x1b1a09)[_0x7f73('0x29')](function(_0x516828){return querystring[_0x7f73('0x7e')](_0x516828);});};exports['sestekNDA']=function(_0x42697d,_0x2b4c7f){return sestek[_0x7f73('0x7f')](_0x42697d,_0x2b4c7f)[_0x7f73('0x29')](function(_0x500170){logger[_0x7f73('0x1a')](JSON[_0x7f73('0x42')](_0x500170));var _0x5c7779={'speech':_0x500170[_0x7f73('0x80')],'action':_0x500170[_0x7f73('0x81')]?_0x500170[_0x7f73('0x81')][_0x7f73('0x82')]:undefined,'actiondata':_0x500170['channelData']?_0x500170[_0x7f73('0x81')]['CustomActionData']:undefined};if(_0x500170[_0x7f73('0x81')]&&_0x500170['channelData'][_0x7f73('0x83')]){return base64Decode(_0x500170['channelData'][_0x7f73('0x83')][_0x7f73('0x84')],path[_0x7f73('0x24')](__dirname,_0x7f73('0x37'),rs['generate'](0x4)+'.wav'))[_0x7f73('0x29')](function(_0x3a9c88){_0x5c7779[_0x7f73('0x85')]=_0x3a9c88;return _0x5c7779;});}return _0x5c7779;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x4e92=['error','download\x20error','pipe','end','https:','get','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','base64','then','chmodSync','777','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','voice','text:synthesize','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic','slice','length','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','writeFileSync','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','result','source','resolvedQuery','speech','score','status','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','%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','sestekNDA','nda','text','CustomAction','channelData','CustomActionData','AudioFromTts','Data','bluebird','dialogflow','http','https','md5','path','randomstring','sox','google-tts-api','url','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','close','unlink'];(function(_0x1f696e,_0x30f4a4){var _0x2127b4=function(_0x5f4822){while(--_0x5f4822){_0x1f696e['push'](_0x1f696e['shift']());}};_0x2127b4(++_0x30f4a4);}(_0x4e92,0x181));var _0x24e9=function(_0x27c1ab,_0x3734be){_0x27c1ab=_0x27c1ab-0x0;var _0x5087a3=_0x4e92[_0x27c1ab];return _0x5087a3;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x24e9('0x0'));var dialogflow=require(_0x24e9('0x1'));var fs=require('fs');var http=require(_0x24e9('0x2'));var https=require(_0x24e9('0x3'));var md5=require(_0x24e9('0x4'));var path=require(_0x24e9('0x5'));var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0x24e9('0x6'));var sox=require(_0x24e9('0x7'));var tts=require(_0x24e9('0x8'));var urlParse=require(_0x24e9('0x9'))['parse'];var util=require('util');var aws=require('./aws');var google=require(_0x24e9('0xa'));var sestek=require(_0x24e9('0xb'));var tilde=require('./tilde');var logger=require(_0x24e9('0xc'))(_0x24e9('0xd'));var ISPEECH_API=_0x24e9('0xe');function downloadFile(_0x22e980,_0x487d27){return new BPromise(function(_0x3e0008,_0x592e78){var _0x51e845=urlParse(_0x22e980);var _0x50a1e4=_0x51e845[_0x24e9('0xf')]==='https:'?https:http;var _0xb55d76={'host':_0x51e845[_0x24e9('0x10')],'path':_0x51e845[_0x24e9('0x5')],'headers':{'user-agent':_0x24e9('0x11')}};_0x50a1e4['get'](_0xb55d76,function(_0x56c383){if(_0x56c383[_0x24e9('0x12')]!==0xc8){logger['error'](_0x24e9('0x13')+_0x22e980+_0x24e9('0x14')+_0x56c383['statusCode']+'\x20('+_0x56c383['statusMessage']+')');_0x592e78(new Error(_0x24e9('0x13')+_0x22e980+_0x24e9('0x14')+_0x56c383[_0x24e9('0x12')]+'\x20('+_0x56c383[_0x24e9('0x15')]+')'));return;}var _0xc6da6=fs[_0x24e9('0x16')](_0x487d27);_0xc6da6['on']('finish',function(){logger[_0x24e9('0x17')]('finish\x20download\x20file');_0xc6da6[_0x24e9('0x18')](_0x3e0008);});_0xc6da6['on']('error',function(_0x58e4a0){fs[_0x24e9('0x19')](_0x487d27);logger[_0x24e9('0x1a')](_0x24e9('0x1b'),_0x58e4a0);_0x592e78(_0x58e4a0);});_0x56c383[_0x24e9('0x1c')](_0xc6da6);})['on'](_0x24e9('0x1a'),function(_0x27c949){logger[_0x24e9('0x1a')](_0x27c949);_0x592e78(_0x27c949);})[_0x24e9('0x1d')]();});}function uploadFile(_0x18b566){return new BPromise(function(_0x21345e,_0x97dbcd){var _0x122ab0=urlParse(_0x18b566);var _0x27b771=_0x122ab0['protocol']===_0x24e9('0x1e')?https:http;var _0x3bfd02={'host':_0x122ab0[_0x24e9('0x10')],'path':_0x122ab0['path'],'headers':{'user-agent':_0x24e9('0x11')}};_0x27b771[_0x24e9('0x1f')](_0x3bfd02,function(_0x30a49e){if(_0x30a49e[_0x24e9('0x12')]!==0xc8){_0x97dbcd(new Error(_0x24e9('0x13')+_0x18b566+_0x24e9('0x14')+_0x30a49e['statusCode']+'\x20('+_0x30a49e[_0x24e9('0x15')]+')'));return;}var _0x1c30ff='';_0x30a49e['on'](_0x24e9('0x20'),function(_0x16cc7d){_0x1c30ff+=_0x16cc7d;});_0x30a49e['on'](_0x24e9('0x1d'),function(){_0x21345e(_0x1c30ff);});})['on'](_0x24e9('0x1a'),function(_0x5d9f5b){_0x97dbcd(_0x5d9f5b);})[_0x24e9('0x1d')]();});}function convertFile(_0x19bcc0,_0x8b9170){return new BPromise(function(_0x3536a5,_0x1e4040){var _0x4ec2e9=sox[_0x24e9('0x21')](_0x19bcc0,_0x8b9170,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4ec2e9['on'](_0x24e9('0x1a'),function(_0x3680bf){logger[_0x24e9('0x1a')](_0x24e9('0x22'),_0x3680bf);_0x1e4040(_0x3680bf);});_0x4ec2e9['on'](_0x24e9('0x1d'),function(){logger[_0x24e9('0x17')](_0x24e9('0x23'));_0x3536a5();});_0x4ec2e9[_0x24e9('0x24')]();});}function base64Decode(_0x1b312d,_0x189532){var _0x3091e6=path[_0x24e9('0x25')](__dirname,_0x24e9('0x26'),rs[_0x24e9('0x27')](0x4)+_0x24e9('0x28'));fs['writeFileSync'](_0x3091e6,_0x1b312d,_0x24e9('0x29'));return convertFile(_0x3091e6,_0x189532)[_0x24e9('0x2a')](function(){try{fs[_0x24e9('0x19')](_0x3091e6);fs[_0x24e9('0x2b')](_0x189532,_0x24e9('0x2c'));}catch(_0x269c8){logger[_0x24e9('0x1a')](_0x269c8);}return _0x189532['split']('.')[0x0];});}function base64Encode(_0x1c9781){var _0x5e9f66=fs[_0x24e9('0x2d')](_0x1c9781);return new Buffer(_0x5e9f66)['toString'](_0x24e9('0x29'));}exports[_0x24e9('0x2e')]=function(_0x303643,_0xc1b703,_0x41dda2,_0x58b415,_0x3fd44b,_0x4a69b5){var _0x4ede7b,_0x401f8c;var _0x36a4bc=_0x24e9('0x2f');var _0x3f5a2a=_0x24e9('0x30')+_0x303643;var _0x219f19={};if(_0xc1b703===_0x24e9('0x31')){_0x219f19['input']={'ssml':_0x41dda2};}else{_0x219f19['input']={'text':_0x41dda2};};_0x219f19[_0x24e9('0x32')]={'languageCode':_0x58b415,'ssmlGender':_0x3fd44b};_0x219f19['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x29c9a6={'url':_0x36a4bc+_0x24e9('0x33')+_0x3f5a2a,'method':'POST','json':!![],'body':_0x219f19};return rp(_0x29c9a6)[_0x24e9('0x2a')](function(_0x3672f3){return new BPromise(function(_0x2dfa29,_0x2f0df3){_0x4ede7b=path[_0x24e9('0x25')](__dirname,_0x24e9('0x26'),rs[_0x24e9('0x27')](0x4)+_0x24e9('0x34'));var _0x5c41ef=Buffer[_0x24e9('0x35')](_0x3672f3[_0x24e9('0x36')],_0x24e9('0x29'));return fs[_0x24e9('0x37')](_0x4ede7b,_0x5c41ef,function(_0x1b6192){_0x2f0df3(_0x1b6192);},function(_0x248c6c){fs[_0x24e9('0x2b')](_0x4ede7b,'777');_0x2dfa29(_0x248c6c);});});})[_0x24e9('0x2a')](function(_0x3d7ae2){_0x401f8c=path[_0x24e9('0x25')](__dirname,_0x24e9('0x26'),rs['generate'](0x4)+_0x24e9('0x28'));return convertFile(_0x4ede7b,_0x401f8c);})[_0x24e9('0x2a')](function(){try{fs['unlink'](_0x4ede7b);fs[_0x24e9('0x2b')](_0x401f8c,_0x24e9('0x2c'));}catch(_0x38760d){logger['error'](_0x38760d);}logger[_0x24e9('0x17')](_0x24e9('0x38'),_0x401f8c[_0x24e9('0x39')]('.')[0x0]);return _0x401f8c[_0x24e9('0x39')]('.')[0x0];});};exports[_0x24e9('0x3a')]=function(_0x4c9aae,_0x378e48){var _0xf445b4=_0x24e9('0x3b');var _0x2366e2,_0xbe5256;var _0x1c248e;var _0xa4fde4={'encoding':_0x24e9('0x3c'),'method':_0x24e9('0x3d'),'timeout':0x2710,'url':_0xf445b4,'headers':{'Content-Type':_0x24e9('0x3e')},'body':'f.req='+encodeURIComponent(JSON[_0x24e9('0x3f')]([[[_0x24e9('0x40'),JSON[_0x24e9('0x3f')]([_0x4c9aae,_0x378e48||'en',![],_0x24e9('0x41')]),null,_0x24e9('0x42')]]]))};return rp(_0xa4fde4)[_0x24e9('0x2a')](function(_0x5db5c9){try{_0x1c248e=eval(_0x5db5c9[_0x24e9('0x43')](0x5))[0x0][0x2];}catch(_0x1bb22d){throw new Error('parse\x20response\x20failed:\x0a'+_0x5db5c9[_0x24e9('0x20')]);}if(!_0x1c248e){if(_0x4c9aae[_0x24e9('0x44')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x24e9('0x45')+_0x378e48+_0x24e9('0x46'));}}try{_0x1c248e=eval(_0x1c248e)[0x0];}catch(_0xc02bef){throw new Error(_0x24e9('0x47')+res['data']);}const _0x2485ed=_0x1c248e;_0x2366e2=path[_0x24e9('0x25')](__dirname,_0x24e9('0x26'),rs['generate'](0x4)+_0x24e9('0x34'));fs[_0x24e9('0x48')](_0x2366e2,_0x1c248e,{'encoding':_0x24e9('0x29')});_0xbe5256=path[_0x24e9('0x25')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x2366e2,_0xbe5256);})['then'](function(){try{fs[_0x24e9('0x19')](_0x2366e2);fs['chmodSync'](_0xbe5256,_0x24e9('0x2c'));}catch(_0x3f08d4){logger[_0x24e9('0x1a')](_0x3f08d4);}logger[_0x24e9('0x17')](_0x24e9('0x49'),_0xbe5256['split']('.')[0x0]);return _0xbe5256[_0x24e9('0x39')]('.')[0x0];});};exports[_0x24e9('0x4a')]=function(_0x5cc1a3,_0x5b589e,_0x3df5ab){return google[_0x24e9('0x4b')](_0x5cc1a3,_0x5b589e,_0x3df5ab)[_0x24e9('0x2a')](function(_0x5e8811){logger[_0x24e9('0x17')](_0x5e8811[_0x24e9('0x4c')]);return rp(_0x5e8811);})['then'](function(_0x3eb6e2){var _0x52a436='';var _0x5d9862=0x0;try{fs[_0x24e9('0x19')](_0x5cc1a3);}catch(_0x1809a0){logger[_0x24e9('0x1a')](_0x1809a0);}if(_0x3eb6e2&&_0x3eb6e2['results']){_0x52a436=_0x3eb6e2[_0x24e9('0x4d')]['map'](function(_0x37b599){return _0x37b599&&_0x37b599[_0x24e9('0x4e')][0x0]&&_0x37b599[_0x24e9('0x4e')][0x0]['transcript']?_0x37b599['alternatives'][0x0][_0x24e9('0x4f')]:'';})[_0x24e9('0x50')]('\x0a');_0x5d9862=_0x3eb6e2[_0x24e9('0x4d')][_0x24e9('0x51')](function(_0x19810a){return _0x19810a&&_0x19810a['alternatives'][0x0]&&_0x19810a[_0x24e9('0x4e')][0x0][_0x24e9('0x52')]?_0x19810a['alternatives'][0x0][_0x24e9('0x52')]:0x0;})[_0x24e9('0x50')]('\x0a');}logger[_0x24e9('0x17')](_0x24e9('0x53'),_0x52a436);logger[_0x24e9('0x17')](_0x24e9('0x54'),_0x5d9862);return{'transcript':_0x52a436,'confidence':_0x5d9862};})[_0x24e9('0x55')](function(_0x5ca82d){logger[_0x24e9('0x1a')](_0x24e9('0x56'),_0x5ca82d[_0x24e9('0x12')],_0x5ca82d[_0x24e9('0x57')],_0x5ca82d[_0x24e9('0x58')]);});};exports['googleDialogflow']=function(_0x16c642,_0x2afb6c,_0x1ec0db,_0x3990da){var _0x5ebcb8=apiai(_0x2afb6c,{'language':_0x3990da||'en'});return _0x5ebcb8[_0x24e9('0x59')](_0x1ec0db,{'sessionId':md5(_0x16c642)})[_0x24e9('0x2a')](function(_0x2489dd){logger['info'](JSON['stringify'](_0x2489dd));return{'source':_0x2489dd[_0x24e9('0x5a')][_0x24e9('0x5b')],'resolvedQuery':_0x2489dd[_0x24e9('0x5a')][_0x24e9('0x5c')],'action':_0x2489dd[_0x24e9('0x5a')]['action'],'actionIncomplete':_0x2489dd['result']['actionIncomplete'],'speech':_0x2489dd[_0x24e9('0x5a')]['fulfillment'][_0x24e9('0x5d')],'score':_0x2489dd[_0x24e9('0x5a')][_0x24e9('0x5e')],'statusCode':_0x2489dd[_0x24e9('0x5f')][_0x24e9('0x60')],'endConversation':_0x2489dd[_0x24e9('0x5a')]['metadata'][_0x24e9('0x61')]||![],'isFallbackIntent':_0x2489dd['result'][_0x24e9('0x62')][_0x24e9('0x63')]};});};exports[_0x24e9('0x64')]=function(_0x3b4aeb,_0x62077,_0xed9c49,_0x24cb76,_0x3efb52,_0x2d7ffe){var _0x5b6e05=_0x24cb76['replace'](/\\n/g,'\x0a');var _0x222a14={'credentials':{'private_key':_0x5b6e05,'client_email':_0xed9c49}};var _0x5c2931=new dialogflow[(_0x24e9('0x65'))](_0x222a14);var _0x3cf836=_0x5c2931[_0x24e9('0x66')](_0x62077,md5(_0x3b4aeb));var _0x5e2273={'session':_0x3cf836,'queryInput':{'text':{'text':_0x3efb52,'languageCode':_0x2d7ffe}}};return _0x5c2931['detectIntent'](_0x5e2273)[_0x24e9('0x2a')](function(_0x18ab4d){if(_0x18ab4d&&_0x18ab4d[_0x24e9('0x44')]){logger['info'](_0x24e9('0x67'),JSON[_0x24e9('0x3f')](_0x18ab4d));var _0x4627ef=_0x18ab4d[0x0];if(_0x4627ef){var _0x15a48a={'action':_0x4627ef[_0x24e9('0x68')]['action'],'allRequiredParamsPresent':_0x4627ef[_0x24e9('0x68')][_0x24e9('0x69')],'endConversation':_0x4627ef[_0x24e9('0x68')][_0x24e9('0x6a')]&&_0x4627ef['queryResult']['diagnosticInfo'][_0x24e9('0x6b')]?_0x4627ef['queryResult'][_0x24e9('0x6a')][_0x24e9('0x6b')][_0x24e9('0x6c')][_0x24e9('0x6d')]:![],'fulfillmentText':_0x4627ef[_0x24e9('0x68')]['fulfillmentText'],'intentName':_0x4627ef[_0x24e9('0x68')][_0x24e9('0x6e')][_0x24e9('0x57')],'intentDisplayName':_0x4627ef['queryResult'][_0x24e9('0x6e')][_0x24e9('0x6f')],'isFallbackIntent':_0x4627ef[_0x24e9('0x68')][_0x24e9('0x6e')][_0x24e9('0x70')],'languageCode':_0x4627ef[_0x24e9('0x68')][_0x24e9('0x71')],'queryText':_0x4627ef[_0x24e9('0x68')][_0x24e9('0x72')],'responseId':_0x4627ef[_0x24e9('0x73')],'score':_0x4627ef['queryResult'][_0x24e9('0x74')],'speech':_0x4627ef[_0x24e9('0x68')][_0x24e9('0x75')],'providerResponse':JSON[_0x24e9('0x3f')](_0x18ab4d)};return _0x15a48a;}}});};exports[_0x24e9('0x76')]=function(_0x400857,_0x280050,_0xcbaaa2,_0x3077aa){return tilde['asr'](_0x400857,_0x280050,_0xcbaaa2,_0x3077aa)[_0x24e9('0x2a')](function(_0x5bdffc){try{fs['unlink'](_0x400857);}catch(_0x48fd2f){logger[_0x24e9('0x1a')](_0x48fd2f);}logger['info']('Tilde\x20ASR\x20transcription',_0x5bdffc[_0x24e9('0x4f')]);logger[_0x24e9('0x17')](_0x24e9('0x77'),_0x5bdffc[_0x24e9('0x52')]);return _0x5bdffc;});};exports[_0x24e9('0x78')]=function(_0x48c763,_0x5781dc,_0x2a7383,_0x976167,_0x417aef,_0x51ef09){var _0x5c87f4=path[_0x24e9('0x25')](__dirname,_0x24e9('0x26'),rs[_0x24e9('0x27')](0x4)+_0x24e9('0x34'));var _0x8776fa;return aws[_0x24e9('0x79')](_0x48c763,_0x5781dc,_0x2a7383,_0x976167,_0x417aef,_0x51ef09,_0x5c87f4)['then'](function(){_0x8776fa=path[_0x24e9('0x25')](__dirname,_0x24e9('0x26'),rs['generate'](0x4)+_0x24e9('0x28'));return convertFile(_0x5c87f4,_0x8776fa);})[_0x24e9('0x2a')](function(){try{fs[_0x24e9('0x19')](_0x5c87f4);fs[_0x24e9('0x2b')](_0x8776fa,_0x24e9('0x2c'));}catch(_0x559057){logger[_0x24e9('0x1a')](_0x559057);}return _0x8776fa['split']('.')[0x0];});};exports[_0x24e9('0x7a')]=function(_0x3dcbc5,_0x1960a3,_0x39c44e,_0x5467c4,_0x2e3da6,_0x692cc3){return aws[_0x24e9('0x7b')](_0x3dcbc5,_0x1960a3,_0x39c44e,_0x5467c4,_0x2e3da6,_0x692cc3)['then'](function(_0x102231){logger[_0x24e9('0x17')](JSON['stringify'](_0x102231));return _0x102231;});};exports[_0x24e9('0x7c')]=function(_0x4960d2,_0x33f30e,_0x20fbe3,_0xee8820){var _0x143869=util['format'](_0x24e9('0x7d'),ISPEECH_API,_0x4960d2,encodeURIComponent(_0x33f30e),_0x20fbe3,_0xee8820);var _0x4bd250=path['resolve'](__dirname,_0x24e9('0x26'),rs[_0x24e9('0x27')](0x4)+_0x24e9('0x34'));var _0x37dba9;return downloadFile(_0x143869,_0x4bd250)[_0x24e9('0x2a')](function(){_0x37dba9=path[_0x24e9('0x25')](__dirname,_0x24e9('0x26'),rs[_0x24e9('0x27')](0x4)+'.wav');return convertFile(_0x4bd250,_0x37dba9);})['then'](function(){try{fs[_0x24e9('0x19')](_0x4bd250);fs[_0x24e9('0x2b')](_0x37dba9,_0x24e9('0x2c'));}catch(_0x5ceb8d){logger[_0x24e9('0x1a')](_0x5ceb8d);}return _0x37dba9[_0x24e9('0x39')]('.')[0x0];});};exports[_0x24e9('0x7e')]=function(_0x29661b,_0x5d6bf3,_0x3f04f4,_0x26b85f){var _0x30226b=util[_0x24e9('0x7f')](_0x24e9('0x80'),ISPEECH_API,_0x5d6bf3,_0x3f04f4,base64Encode(_0x29661b),_0x26b85f?util['format']('model=%s',encodeURIComponent(_0x26b85f)):'freeform=3');return uploadFile(_0x30226b)[_0x24e9('0x2a')](function(_0x1842ec){return querystring['parse'](_0x1842ec);});};exports[_0x24e9('0x81')]=function(_0x5ebd5c,_0x2453ca){return sestek[_0x24e9('0x82')](_0x5ebd5c,_0x2453ca)[_0x24e9('0x2a')](function(_0xece939){logger[_0x24e9('0x17')](JSON[_0x24e9('0x3f')](_0xece939));var _0x500374={'speech':_0xece939[_0x24e9('0x83')],'action':_0xece939['channelData']?_0xece939['channelData'][_0x24e9('0x84')]:undefined,'actiondata':_0xece939['channelData']?_0xece939[_0x24e9('0x85')][_0x24e9('0x86')]:undefined};if(_0xece939[_0x24e9('0x85')]&&_0xece939[_0x24e9('0x85')][_0x24e9('0x87')]){return base64Decode(_0xece939['channelData'][_0x24e9('0x87')][_0x24e9('0x88')],path['resolve'](__dirname,_0x24e9('0x26'),rs[_0x24e9('0x27')](0x4)+_0x24e9('0x28')))['then'](function(_0x369814){_0x500374['audiofile']=_0x369814;return _0x500374;});}return _0x500374;});};exports['dirName']=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 469c52c..ee62b8f 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 _0x8265=['exports'];(function(_0x45bdae,_0x41eb62){var _0xcb8501=function(_0xb8ed1f){while(--_0xb8ed1f){_0x45bdae['push'](_0x45bdae['shift']());}};_0xcb8501(++_0x41eb62);}(_0x8265,0x92));var _0x5826=function(_0x5c8a02,_0x26ddd5){_0x5c8a02=_0x5c8a02-0x0;var _0x103bfb=_0x8265[_0x5c8a02];return _0x103bfb;};var nda=require('./nda');module[_0x5826('0x0')]={'nda':nda}; \ No newline at end of file +var _0x052a=['exports'];(function(_0x513d2d,_0x74efbe){var _0x1165a4=function(_0x2b86ba){while(--_0x2b86ba){_0x513d2d['push'](_0x513d2d['shift']());}};_0x1165a4(++_0x74efbe);}(_0x052a,0xd6));var _0xa052=function(_0x3ccdf8,_0x584ceb){_0x3ccdf8=_0x3ccdf8-0x0;var _0x243dab=_0x052a[_0x3ccdf8];return _0x243dab;};var nda=require('./nda');module[_0xa052('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 0adf275..8be4305 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 _0x72d0=['Nda','uniqueid','calleridname','dnid','extension','text','Bearer\x20','project','body','ProjectName','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','info','stringify','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type'];(function(_0x2708a3,_0x2b808f){var _0x4c44c5=function(_0x1a8b1f){while(--_0x1a8b1f){_0x2708a3['push'](_0x2708a3['shift']());}};_0x4c44c5(++_0x2b808f);}(_0x72d0,0xcd));var _0x072d=function(_0x325eaf,_0x4dc8a0){_0x325eaf=_0x325eaf-0x0;var _0x570131=_0x72d0[_0x325eaf];return _0x570131;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require('../../../../../config/logger')(_0x072d('0x0'));module[_0x072d('0x1')]=function(_0x48a7da,_0x498e01){var _0x11972d={'method':_0x072d('0x2'),'uri':url[_0x072d('0x3')](_0x498e01[_0x072d('0x4')],_0x072d('0x5')),'form':{'grant_type':_0x072d('0x6'),'username':_0x498e01[_0x072d('0x7')],'password':_0x498e01[_0x072d('0x6')]},'json':!![]};return rp(_0x11972d)[_0x072d('0x8')](function(_0x101e2e){var _0x301406={'method':_0x072d('0x2'),'uri':url[_0x072d('0x3')](_0x498e01[_0x072d('0x9')],_0x072d('0xa')),'body':{'type':_0x498e01[_0x072d('0xb')]||'message','channelId':_0x072d('0xc'),'conversation':{'id':_0x48a7da[_0x072d('0xd')]},'from':{'id':_0x48a7da['callerid'],'name':_0x48a7da[_0x072d('0xe')]},'recipient':{'id':_0x48a7da[_0x072d('0xf')],'name':_0x48a7da[_0x072d('0x10')]},'text':_0x498e01[_0x072d('0x11')],'channelData':{}},'headers':{'Authorization':_0x072d('0x12')+_0x101e2e['access_token']},'json':!![]};if(_0x498e01[_0x072d('0x13')]){_0x301406[_0x072d('0x14')]['channelData'][_0x072d('0x15')]=_0x498e01[_0x072d('0x13')];}if(_0x498e01[_0x072d('0x16')]=='1'){_0x301406[_0x072d('0x14')][_0x072d('0x17')][_0x072d('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x072d('0x19')};}if(_0x498e01[_0x072d('0x1a')]){_0x301406[_0x072d('0x14')][_0x072d('0x17')][_0x072d('0x1b')]=_0x498e01[_0x072d('0x1a')];if(_0x498e01[_0x072d('0x1c')]){_0x301406['body'][_0x072d('0x17')]['CustomActionData']=_0x498e01[_0x072d('0x1c')];}}logger[_0x072d('0x1d')](JSON[_0x072d('0x1e')](_0x301406));return rp(_0x301406);});}; \ No newline at end of file +var _0x74d8=['password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','project','body','channelData','ProjectName','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','request-promise','../../../../../config/logger','exports','POST','resolve'];(function(_0x3bb1da,_0x14c198){var _0x31b312=function(_0x513fea){while(--_0x513fea){_0x3bb1da['push'](_0x3bb1da['shift']());}};_0x31b312(++_0x14c198);}(_0x74d8,0x150));var _0x874d=function(_0x380d57,_0x26069b){_0x380d57=_0x380d57-0x0;var _0x197f04=_0x74d8[_0x380d57];return _0x197f04;};'use strict';var rp=require(_0x874d('0x0'));var url=require('url');var logger=require(_0x874d('0x1'))('agi');module[_0x874d('0x2')]=function(_0x23f289,_0x27e5b3){var _0xe2a2f3={'method':_0x874d('0x3'),'uri':url[_0x874d('0x4')](_0x27e5b3['ndauth_url'],'/token'),'form':{'grant_type':_0x874d('0x5'),'username':_0x27e5b3[_0x874d('0x6')],'password':_0x27e5b3[_0x874d('0x5')]},'json':!![]};return rp(_0xe2a2f3)[_0x874d('0x7')](function(_0x187691){var _0x14506b={'method':'POST','uri':url[_0x874d('0x4')](_0x27e5b3[_0x874d('0x8')],_0x874d('0x9')),'body':{'type':_0x27e5b3[_0x874d('0xa')]||_0x874d('0xb'),'channelId':_0x874d('0xc'),'conversation':{'id':_0x23f289[_0x874d('0xd')]},'from':{'id':_0x23f289[_0x874d('0xe')],'name':_0x23f289[_0x874d('0xf')]},'recipient':{'id':_0x23f289[_0x874d('0x10')],'name':_0x23f289[_0x874d('0x11')]},'text':_0x27e5b3[_0x874d('0x12')],'channelData':{}},'headers':{'Authorization':_0x874d('0x13')+_0x187691['access_token']},'json':!![]};if(_0x27e5b3[_0x874d('0x14')]){_0x14506b[_0x874d('0x15')][_0x874d('0x16')][_0x874d('0x17')]=_0x27e5b3['project'];}if(_0x27e5b3['ndagenerate_audio']=='1'){_0x14506b[_0x874d('0x15')][_0x874d('0x16')][_0x874d('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x874d('0x19')};}if(_0x27e5b3['custom_action']){_0x14506b[_0x874d('0x15')][_0x874d('0x16')][_0x874d('0x1a')]=_0x27e5b3[_0x874d('0x1b')];if(_0x27e5b3[_0x874d('0x1c')]){_0x14506b[_0x874d('0x15')]['channelData'][_0x874d('0x1d')]=_0x27e5b3[_0x874d('0x1c')];}}logger[_0x874d('0x1e')](JSON['stringify'](_0x14506b));return rp(_0x14506b);});}; \ 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 56014c2..22ac5d1 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 _0xacc2=['exports','./lib/api'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0xacc2,0x89));var _0x2acc=function(_0x358765,_0x2611bd){_0x358765=_0x358765-0x0;var _0x2dd269=_0xacc2[_0x358765];return _0x2dd269;};'use strict';var asr=require(_0x2acc('0x0'));module[_0x2acc('0x1')]=function(_0x1cbc6e,_0x54086f,_0xd57091,_0x23f46a){return asr(_0x1cbc6e,_0x54086f,_0xd57091,_0x23f46a);}; \ No newline at end of file +var _0x6371=['exports','./lib/api'];(function(_0x2ee514,_0x2f6dee){var _0x4e7a30=function(_0x12d532){while(--_0x12d532){_0x2ee514['push'](_0x2ee514['shift']());}};_0x4e7a30(++_0x2f6dee);}(_0x6371,0x129));var _0x1637=function(_0x319cb9,_0x4b8d35){_0x319cb9=_0x319cb9-0x0;var _0x1735fc=_0x6371[_0x319cb9];return _0x1735fc;};'use strict';var asr=require(_0x1637('0x0'));module[_0x1637('0x1')]=function(_0x6e1b5d,_0x26aaee,_0x5ff107,_0x550aad){return asr(_0x6e1b5d,_0x26aaee,_0x5ff107,_0x550aad);}; \ 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 2534c52..9093803 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 _0xb728=['status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','message','bluebird','lodash','moment','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','createHash','sha1','update','digest','hex','unix','stringify','createReadStream','data','close','send','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse'];(function(_0x4cb757,_0x5776c9){var _0x364a3a=function(_0x9355cb){while(--_0x9355cb){_0x4cb757['push'](_0x4cb757['shift']());}};_0x364a3a(++_0x5776c9);}(_0xb728,0xe2));var _0x8b72=function(_0x438086,_0x379f07){_0x438086=_0x438086-0x0;var _0x700123=_0xb728[_0x438086];return _0x700123;};'use strict';var BPromise=require(_0x8b72('0x0'));var _=require(_0x8b72('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x8b72('0x2'));var crypto=require(_0x8b72('0x3'));var logger=require('../../../../../../config/logger')(_0x8b72('0x4'));module[_0x8b72('0x5')]=function(_0x514b58,_0x3161ae,_0x694067,_0x233835){return new BPromise(function(_0x21630a,_0x462703){logger[_0x8b72('0x6')](_0x8b72('0x7'),_0x233835||_0x8b72('0x8'));var _0x110b51=new WebSocket(_0x233835||_0x8b72('0x8'),{'perMessageDeflate':![]});var _0x5e1366='';var _0x1dfd26='0';var _0x7cd5e2='1';var _0x201af8=_0x8b72('0x9');function _0x1320ec(_0x75053c){var _0x1f74de=crypto[_0x8b72('0xa')](_0x8b72('0xb'));_0x1f74de[_0x8b72('0xc')](_0x75053c);return _0x1f74de[_0x8b72('0xd')](_0x8b72('0xe'));}function _0x53211f(){try{logger[_0x8b72('0x6')]('Open\x20Tilde\x20ASR\x20socket');var _0x4fa93d=moment()[_0x8b72('0xf')]();var _0x229fca=_0x1320ec(_0x4fa93d+_0x3161ae+_0x694067);_0x110b51['send'](JSON[_0x8b72('0x10')]({'appID':_0x3161ae,'timestamp':_0x4fa93d,'appKey':_0x229fca}));var _0x4d16c4=fs[_0x8b72('0x11')](_0x514b58);_0x4d16c4['on'](_0x8b72('0x12'),function(_0x894597){_0x110b51['send'](_0x894597);});_0x4d16c4['on'](_0x8b72('0x13'),function(){_0x110b51[_0x8b72('0x14')](_0x8b72('0x15'));});}catch(_0x4c5c90){logger[_0x8b72('0x16')](_0x8b72('0x17'),JSON['stringify'](_0x4c5c90));_0x110b51[_0x8b72('0x18')]();}}function _0x105af9(_0x5ebe92){try{if(_0x5ebe92){var _0x2f574a=JSON[_0x8b72('0x19')](_0x5ebe92);switch(_0x2f574a[_0x8b72('0x1a')]){case 0x0:if(_0x2f574a[_0x8b72('0x1b')]){if(_0x2f574a[_0x8b72('0x1b')][_0x8b72('0x1c')]){logger['info'](_0x8b72('0x1d'),JSON[_0x8b72('0x10')](_0x2f574a['result'][_0x8b72('0x1e')]));_0x5e1366=_0x2f574a[_0x8b72('0x1b')][_0x8b72('0x1e')][0x0][_0x8b72('0x1f')];_0x1dfd26=_0x2f574a[_0x8b72('0x1b')][_0x8b72('0x1e')][0x0][_0x8b72('0x20')];_0x7cd5e2='0';_0x201af8=_0x8b72('0x21');_0x110b51[_0x8b72('0x18')]();}}break;case 0x1:logger[_0x8b72('0x6')](_0x8b72('0x9'));_0x7cd5e2='1';_0x201af8=_0x8b72('0x9');break;case 0x2:logger[_0x8b72('0x6')](_0x8b72('0x22'));_0x7cd5e2='2';_0x201af8=_0x8b72('0x22');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x7cd5e2='9';_0x201af8=_0x8b72('0x23');break;case 0xa:logger[_0x8b72('0x6')]('Authentication\x20failed.');_0x7cd5e2='10';_0x201af8=_0x8b72('0x24');break;case 0xb:logger[_0x8b72('0x6')](_0x8b72('0x25'));_0x7cd5e2='11';_0x201af8=_0x8b72('0x25');}}}catch(_0x40a53f){logger[_0x8b72('0x16')](_0x8b72('0x26'),JSON[_0x8b72('0x10')](_0x40a53f));_0x110b51[_0x8b72('0x18')]();}}function _0x11668c(){logger[_0x8b72('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0x21630a({'transcript':_0x5e1366,'confidence':_0x1dfd26,'status':_0x7cd5e2,'status_message':_0x201af8});}function _0x376210(_0x29731b){logger[_0x8b72('0x16')](_0x8b72('0x27'));if(!_[_0x8b72('0x28')](_0x29731b)){logger[_0x8b72('0x16')](_['isObject'](_0x29731b)?JSON[_0x8b72('0x10')](_0x29731b):_0x29731b);}}_0x110b51['on']('open',_0x53211f);_0x110b51['on'](_0x8b72('0x29'),_0x105af9);_0x110b51['on']('close',_0x11668c);_0x110b51['on'](_0x8b72('0x16'),_0x376210);});}; \ No newline at end of file +var _0x2cae=['isObject','open','message','bluebird','lodash','moment','crypto','agi','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil'];(function(_0x36d2d4,_0x4c6b20){var _0x452907=function(_0x46f81c){while(--_0x46f81c){_0x36d2d4['push'](_0x36d2d4['shift']());}};_0x452907(++_0x4c6b20);}(_0x2cae,0x162));var _0xe2ca=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x2cae[_0x1e7b16];return _0x37fadc;};'use strict';var BPromise=require(_0xe2ca('0x0'));var _=require(_0xe2ca('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xe2ca('0x2'));var crypto=require(_0xe2ca('0x3'));var logger=require('../../../../../../config/logger')(_0xe2ca('0x4'));module['exports']=function(_0x1c10d8,_0x35d22f,_0x412845,_0x28956f){return new BPromise(function(_0x58014e,_0x564fd1){logger[_0xe2ca('0x5')]('Tilde\x20URI',_0x28956f||_0xe2ca('0x6'));var _0x244e4c=new WebSocket(_0x28956f||_0xe2ca('0x6'),{'perMessageDeflate':![]});var _0x50d79b='';var _0x184baa='0';var _0x286898='1';var _0x3a6292=_0xe2ca('0x7');function _0x1211fb(_0x556425){var _0x272709=crypto['createHash'](_0xe2ca('0x8'));_0x272709[_0xe2ca('0x9')](_0x556425);return _0x272709[_0xe2ca('0xa')]('hex');}function _0x5a4c56(){try{logger['info'](_0xe2ca('0xb'));var _0x3c546b=moment()[_0xe2ca('0xc')]();var _0xcbd62c=_0x1211fb(_0x3c546b+_0x35d22f+_0x412845);_0x244e4c[_0xe2ca('0xd')](JSON[_0xe2ca('0xe')]({'appID':_0x35d22f,'timestamp':_0x3c546b,'appKey':_0xcbd62c}));var _0x31962d=fs[_0xe2ca('0xf')](_0x1c10d8);_0x31962d['on'](_0xe2ca('0x10'),function(_0x1f451a){_0x244e4c[_0xe2ca('0xd')](_0x1f451a);});_0x31962d['on'](_0xe2ca('0x11'),function(){_0x244e4c[_0xe2ca('0xd')]('EOS');});}catch(_0x587f8c){logger[_0xe2ca('0x12')](_0xe2ca('0x13'),JSON[_0xe2ca('0xe')](_0x587f8c));_0x244e4c[_0xe2ca('0x14')]();}}function _0x868637(_0x339a02){try{if(_0x339a02){var _0x51393d=JSON[_0xe2ca('0x15')](_0x339a02);switch(_0x51393d[_0xe2ca('0x16')]){case 0x0:if(_0x51393d['result']){if(_0x51393d[_0xe2ca('0x17')][_0xe2ca('0x18')]){logger[_0xe2ca('0x5')](_0xe2ca('0x19'),JSON['stringify'](_0x51393d['result'][_0xe2ca('0x1a')]));_0x50d79b=_0x51393d[_0xe2ca('0x17')][_0xe2ca('0x1a')][0x0][_0xe2ca('0x1b')];_0x184baa=_0x51393d[_0xe2ca('0x17')]['hypotheses'][0x0][_0xe2ca('0x1c')];_0x286898='0';_0x3a6292='Success.';_0x244e4c[_0xe2ca('0x14')]();}}break;case 0x1:logger[_0xe2ca('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x286898='1';_0x3a6292=_0xe2ca('0x7');break;case 0x2:logger['info'](_0xe2ca('0x1d'));_0x286898='2';_0x3a6292=_0xe2ca('0x1d');break;case 0x9:logger[_0xe2ca('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x286898='9';_0x3a6292='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xe2ca('0x5')](_0xe2ca('0x1e'));_0x286898='10';_0x3a6292=_0xe2ca('0x1e');break;case 0xb:logger[_0xe2ca('0x5')](_0xe2ca('0x1f'));_0x286898='11';_0x3a6292='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x1d8965){logger['error'](_0xe2ca('0x20'),JSON[_0xe2ca('0xe')](_0x1d8965));_0x244e4c[_0xe2ca('0x14')]();}}function _0xf1a015(){logger[_0xe2ca('0x5')](_0xe2ca('0x21'));_0x58014e({'transcript':_0x50d79b,'confidence':_0x184baa,'status':_0x286898,'status_message':_0x3a6292});}function _0x95a79c(_0x5305a1){logger[_0xe2ca('0x12')](_0xe2ca('0x22'));if(!_[_0xe2ca('0x23')](_0x5305a1)){logger[_0xe2ca('0x12')](_[_0xe2ca('0x24')](_0x5305a1)?JSON[_0xe2ca('0xe')](_0x5305a1):_0x5305a1);}}_0x244e4c['on'](_0xe2ca('0x25'),_0x5a4c56);_0x244e4c['on'](_0xe2ca('0x26'),_0x868637);_0x244e4c['on'](_0xe2ca('0x11'),_0xf1a015);_0x244e4c['on'](_0xe2ca('0x12'),_0x95a79c);});}; \ 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 e8c978a..76ee66a 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 _0xe3b7=['./asr','exports'];(function(_0x4a6156,_0x2b8ce6){var _0x12c1f6=function(_0x533b09){while(--_0x533b09){_0x4a6156['push'](_0x4a6156['shift']());}};_0x12c1f6(++_0x2b8ce6);}(_0xe3b7,0x17e));var _0x7e3b=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xe3b7[_0x3b0731];return _0x4204d7;};var asr=require(_0x7e3b('0x0'));module[_0x7e3b('0x1')]={'asr':asr}; \ No newline at end of file +var _0x1e4c=['./asr','exports'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x1e4c,0x1bc));var _0xc1e4=function(_0x36d7da,_0x3131b3){_0x36d7da=_0x36d7da-0x0;var _0x1fa00b=_0x1e4c[_0x36d7da];return _0x1fa00b;};var asr=require(_0xc1e4('0x0'));module[_0xc1e4('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index d9d327b..4165d41 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 _0x04de=['listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','EventEmitter','./error','./channel','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen'];(function(_0x330d40,_0x2ada0a){var _0x23308a=function(_0x13291b){while(--_0x13291b){_0x330d40['push'](_0x330d40['shift']());}};_0x23308a(++_0x2ada0a);}(_0x04de,0x107));var _0xe04d=function(_0x2aeec2,_0x1b88a0){_0x2aeec2=_0x2aeec2-0x0;var _0x366ac5=_0x04de[_0x2aeec2];return _0x366ac5;};'use strict';var util=require(_0xe04d('0x0'));var net=require(_0xe04d('0x1'));var EventEmitter=require(_0xe04d('0x2'))[_0xe04d('0x3')];var AGIError=require(_0xe04d('0x4'));var AGIChannel=require(_0xe04d('0x5'));var AGIServer=function(_0x1113af,_0x43c4b1,_0x2593a4){var _0x70ead0=this,_0x1113af=_0x1113af||0x11dd,_0x43c4b1=_0x43c4b1||'127.0.0.1',_0x4bb925=null,_0x4f7637=0x0;EventEmitter[_0xe04d('0x6')](_0x70ead0);function _0x210e93(){if(!_0x1113af){_0x70ead0[_0xe04d('0x7')](_0xe04d('0x8'),new AGIError(_0xe04d('0x9')));return![];}_0x4bb925=net[_0xe04d('0xa')]();_0x4bb925[_0xe04d('0xb')](_0x1113af,_0x43c4b1);_0x4bb925['on'](_0xe04d('0xc'),function(){_0x70ead0['emit'](_0xe04d('0xc'));});_0x4bb925['on'](_0xe04d('0xd'),function(_0x2576b2){_0x4bb925[_0xe04d('0xe')](function(_0xad5c34,_0x3e1837){if(_0xad5c34){_0x70ead0[_0xe04d('0x7')](_0xe04d('0x8'),new AGIError(_0xe04d('0xf'),_0xad5c34));}else if(_0x2593a4&&_0x2593a4<0x0){_0x70ead0['emit'](_0xe04d('0x8'),new AGIError(_0xe04d('0x10')));_0x2576b2[_0xe04d('0x11')]();}else if(_0x2593a4&&_0x2593a4>0x0&&_0x2593a4<_0x3e1837){_0x4f7637+=0x1;_0x70ead0[_0xe04d('0x7')](_0xe04d('0x8'),new AGIError(_0xe04d('0x12'),_0x4f7637));_0x2576b2[_0xe04d('0x11')]();}else{var _0x143019=new AGIChannel(_0x2576b2);_0x143019['on'](_0xe04d('0x13'),function(){_0x70ead0[_0xe04d('0x7')](_0xe04d('0xd'),_0x143019);});}});});_0x4bb925['on'](_0xe04d('0x8'),function(_0x5cfd5b){_0x70ead0[_0xe04d('0x7')]('error',new AGIError(_0xe04d('0xf'),_0x5cfd5b['code']));});_0x4bb925['on'](_0xe04d('0x14'),function(){_0x70ead0[_0xe04d('0x7')](_0xe04d('0x14'),new AGIError(_0xe04d('0x15')));});}process[_0xe04d('0x16')](function(){_0x210e93();});};util[_0xe04d('0x17')](AGIServer,EventEmitter);module[_0xe04d('0x18')]=function(_0x399aa0,_0x403a71,_0x5d8a1e){return new AGIServer(_0x399aa0,_0x403a71,_0x5d8a1e);}; \ No newline at end of file +var _0x765e=['close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','EventEmitter','./error','./channel','127.0.0.1','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x765e,0x131));var _0xe765=function(_0x616887,_0x1ffa9f){_0x616887=_0x616887-0x0;var _0x2328ab=_0x765e[_0x616887];return _0x2328ab;};'use strict';var util=require(_0xe765('0x0'));var net=require(_0xe765('0x1'));var EventEmitter=require(_0xe765('0x2'))[_0xe765('0x3')];var AGIError=require(_0xe765('0x4'));var AGIChannel=require(_0xe765('0x5'));var AGIServer=function(_0x25f437,_0x38d6d2,_0x30703f){var _0xd2e232=this,_0x25f437=_0x25f437||0x11dd,_0x38d6d2=_0x38d6d2||_0xe765('0x6'),_0x40ac5e=null,_0xdcac86=0x0;EventEmitter['call'](_0xd2e232);function _0x35d891(){if(!_0x25f437){_0xd2e232[_0xe765('0x7')](_0xe765('0x8'),new AGIError(_0xe765('0x9')));return![];}_0x40ac5e=net[_0xe765('0xa')]();_0x40ac5e[_0xe765('0xb')](_0x25f437,_0x38d6d2);_0x40ac5e['on'](_0xe765('0xc'),function(){_0xd2e232['emit'](_0xe765('0xc'));});_0x40ac5e['on'](_0xe765('0xd'),function(_0x31114a){_0x40ac5e['getConnections'](function(_0x6e86dc,_0x57edaf){if(_0x6e86dc){_0xd2e232['emit']('error',new AGIError(_0xe765('0xe'),_0x6e86dc));}else if(_0x30703f&&_0x30703f<0x0){_0xd2e232[_0xe765('0x7')](_0xe765('0x8'),new AGIError(_0xe765('0xf')));_0x31114a[_0xe765('0x10')]();}else if(_0x30703f&&_0x30703f>0x0&&_0x30703f<_0x57edaf){_0xdcac86+=0x1;_0xd2e232['emit'](_0xe765('0x8'),new AGIError(_0xe765('0x11'),_0xdcac86));_0x31114a[_0xe765('0x10')]();}else{var _0x58dc37=new AGIChannel(_0x31114a);_0x58dc37['on'](_0xe765('0x12'),function(){_0xd2e232['emit']('connection',_0x58dc37);});}});});_0x40ac5e['on'](_0xe765('0x8'),function(_0x1b1cfe){_0xd2e232[_0xe765('0x7')]('error',new AGIError(_0xe765('0xe'),_0x1b1cfe[_0xe765('0x13')]));});_0x40ac5e['on'](_0xe765('0x14'),function(){_0xd2e232[_0xe765('0x7')](_0xe765('0x14'),new AGIError(_0xe765('0x15')));});}process[_0xe765('0x16')](function(){_0x35d891();});};util[_0xe765('0x17')](AGIServer,EventEmitter);module[_0xe765('0x18')]=function(_0x57fb61,_0x17b670,_0x56905c){return new AGIServer(_0x57fb61,_0x17b670,_0x56905c);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index b8c59a8..7aca65d 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 _0xca84=['%s_ROWS_COUNT','dial','debug','no\x20user\x20selected','getUser','sip_id','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','dialogflowV2_language','no\x20anguage\x20configured','dialogflowV2','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','no\x20trunk\x20selected','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','aws_access_key_id','Trying\x20aws\x20Polly\x20%s','streamFile','unlink','aws\x20Polly\x20is\x20unreachable','awslex','no\x20valid\x20credentials\x20configured','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','getIntervals','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','beep','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','success','playback','PLAYBACK','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','position','record','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','auth','pass','template_id','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','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','project_id','no\x20subproject\x20selected','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','Enter\x20in\x20SYSTEM\x20(%s)\x20block','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','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','path','util','lodash','odbc','randomstring','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','channel','mailRpc','prototype','getVariable','rpc','getVariableById','getVoiceQueue','getVoiceQueueById','then','name','catch','getSquareProject','getSquareProjectById','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','map','Intervals','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','callerid','createSquareRecording','uniqueid','calleridname','context','extension','priority','accountcode','dnid','arg_1','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','list_id','scheduledAt','toString','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','number','timeout','includes','POST','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','clone','isString','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','replaceAllVariables','%s.%s','saveRestApiResult','replaceObjectAllVariables','split','length','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','sync','retry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','callback','no\x20list\x20selected','delay','add','minutes','callback_priority','phone','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','getSquareOdbc','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]'];(function(_0x424f75,_0x56c223){var _0xdb9ca1=function(_0x591597){while(--_0x591597){_0x424f75['push'](_0x424f75['shift']());}};_0xdb9ca1(++_0x56c223);}(_0xca84,0xf5));var _0x4ca8=function(_0x31bfab,_0x5226ad){_0x31bfab=_0x31bfab-0x0;var _0x422e1d=_0xca84[_0x31bfab];return _0x422e1d;};'use strict';var fs=require('fs');var path=require(_0x4ca8('0x0'));var util=require(_0x4ca8('0x1'));var _=require(_0x4ca8('0x2'));var sh=require('shelljs');var odbc=require(_0x4ca8('0x3'))();var rs=require(_0x4ca8('0x4'));var moment=require('moment');var Mustache=require(_0x4ca8('0x5'));var rp=require(_0x4ca8('0x6'));var logger=require(_0x4ca8('0x7'))(_0x4ca8('0x8'));var config=require(_0x4ca8('0x9'));var scripts=require(_0x4ca8('0xa'));var FILES_PATH=_0x4ca8('0xb');var recursiveMapAttributes=[_0x4ca8('0xc'),_0x4ca8('0xd')];var verticesWithRetry=[_0x4ca8('0xe'),'getdigits',_0x4ca8('0xf')];var AGIVertices=function(_0x5727b5,_0x2661cd,_0x55748d){this[_0x4ca8('0x10')]=_0x5727b5;this['rpc']=_0x2661cd;this[_0x4ca8('0x11')]=_0x55748d;};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x13')]=function(_0x359590,_0x21be85){this[_0x4ca8('0x14')][_0x4ca8('0x15')](_0x359590)['then'](function(_0x5e1297){_0x21be85(null,_0x5e1297?_0x5e1297['name']:![]);})['catch'](function(_0x309286){_0x21be85(_0x309286);});};AGIVertices['prototype'][_0x4ca8('0x16')]=function(_0x32283c,_0x522db3){this['rpc'][_0x4ca8('0x17')](_0x32283c)[_0x4ca8('0x18')](function(_0x3a34d7){_0x522db3(null,_0x3a34d7?_0x3a34d7[_0x4ca8('0x19')]:![]);})[_0x4ca8('0x1a')](function(_0x64c350){_0x522db3(_0x64c350);});};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x1b')]=function(_0x2603d5,_0xd04c8a){this[_0x4ca8('0x14')][_0x4ca8('0x1c')](_0x2603d5)['then'](function(_0xedd3){_0xd04c8a(null,_0xedd3?_0xedd3[_0x4ca8('0x19')]:![]);})[_0x4ca8('0x1a')](function(_0x261e08){_0xd04c8a(_0x261e08);});};AGIVertices[_0x4ca8('0x12')]['getSquareOdbc']=function(_0x23b57a,_0x28a889){this['rpc'][_0x4ca8('0x1d')](_0x23b57a)['then'](function(_0x2764e4){_0x28a889(null,_0x2764e4?_0x2764e4[_0x4ca8('0x1e')]:![]);})[_0x4ca8('0x1a')](function(_0x838ff0){_0x28a889(_0x838ff0);});};AGIVertices[_0x4ca8('0x12')]['getUser']=function(_0x273a4d,_0xf50050){this[_0x4ca8('0x14')][_0x4ca8('0x1f')](_0x273a4d)[_0x4ca8('0x18')](function(_0x4d090a){_0xf50050(null,_0x4d090a?_0x4d090a[_0x4ca8('0x19')]:![]);})[_0x4ca8('0x1a')](function(_0x398ed4){_0xf50050(_0x398ed4);});};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x20')]=function(_0x5c169b,_0x2050f9){this[_0x4ca8('0x14')][_0x4ca8('0x21')](_0x5c169b)['then'](function(_0x21cd51){_0x2050f9(null,_0x21cd51?_0x21cd51[_0x4ca8('0x19')]:![]);})[_0x4ca8('0x1a')](function(_0x1f2231){_0x2050f9(_0x1f2231);});};AGIVertices['prototype'][_0x4ca8('0x22')]=function(_0x3d8862,_0x5966d2){var _0x364ba4=this;this[_0x4ca8('0x14')][_0x4ca8('0x23')](_0x3d8862)[_0x4ca8('0x18')](function(_0x1eb599){_0x5966d2(null,_0x1eb599?_0x364ba4['getSoundPath'](_0x1eb599[_0x4ca8('0x24')]):![]);})[_0x4ca8('0x1a')](function(_0x4d28a9){_0x5966d2(_0x4d28a9);});};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x25')]=function(_0x2554ec,_0xe96d6c){this[_0x4ca8('0x14')][_0x4ca8('0x26')](_0x2554ec)[_0x4ca8('0x18')](function(_0x5b31a3){_0xe96d6c(null,_0x5b31a3?_0x5b31a3:![]);})[_0x4ca8('0x1a')](function(_0x124155){_0xe96d6c(_0x124155);});};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x27')]=function(_0x2c9d20,_0x2ba427,_0x4a65f2){this[_0x4ca8('0x11')]['sendMailMessage'](_0x2c9d20,_0x2ba427)[_0x4ca8('0x18')](function(){_0x4a65f2(null);})[_0x4ca8('0x1a')](function(_0x147cc6){_0x4a65f2(_0x147cc6);});};AGIVertices[_0x4ca8('0x12')]['getIntervals']=function(_0x5e9d32,_0x35d32f){this['rpc'][_0x4ca8('0x28')](_0x5e9d32)[_0x4ca8('0x18')](function(_0x46a1e3){if(_0x46a1e3){if(_0x46a1e3[_0x4ca8('0x29')]){_0x35d32f(null,[_0x46a1e3[_0x4ca8('0x2a')]]);}else{_0x35d32f(null,_[_0x4ca8('0x2b')](_0x46a1e3[_0x4ca8('0x2c')],_0x4ca8('0x2a')));}}else{_0x35d32f(null,![]);}})['catch'](function(_0x5e07de){_0x35d32f(_0x5e07de);});};AGIVertices['prototype']['getSoundPath']=function(_0x104496){return util['format'](_0x4ca8('0x2d'),FILES_PATH,_0x104496);};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x2e')]=function(_0x1198fb,_0x7b9108,_0x179ebd){odbc['open'](_0x1198fb,function(_0xf1f78c){if(_0xf1f78c){logger[_0x4ca8('0x2f')](_0x4ca8('0x30'),_0xf1f78c);_0x179ebd(_0xf1f78c);}else{logger['info'](_0x4ca8('0x31'));odbc[_0x4ca8('0x32')](_0x7b9108,function(_0x448e8e,_0x130e2c){if(_0x448e8e){logger[_0x4ca8('0x33')](_0x4ca8('0x34'),_0x7b9108);_0x179ebd(_0x448e8e);}else{logger[_0x4ca8('0x33')](_0x4ca8('0x35'),_0x7b9108);odbc[_0x4ca8('0x36')](function(_0x3c5af6){if(_0x3c5af6){logger['error'](_0x4ca8('0x37'),_0x3c5af6);}_0x179ebd(null,_0x130e2c);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x3f2e7a,_0x2f0dbf){this[_0x4ca8('0x14')][_0x4ca8('0x38')](_0x3f2e7a)[_0x4ca8('0x18')](function(_0x5d56ed){_0x2f0dbf(null,_0x5d56ed?_0x5d56ed:![]);})[_0x4ca8('0x1a')](function(_0x1fb436){_0x2f0dbf(_0x1fb436);});};AGIVertices['prototype'][_0x4ca8('0x39')]=function(_0x28cf1f,_0x25fc20){this[_0x4ca8('0x14')][_0x4ca8('0x39')](_0x28cf1f)[_0x4ca8('0x18')](function(_0x333b6b){_0x25fc20(null,_0x333b6b);})['catch'](function(_0x447df4){_0x25fc20(_0x447df4);});};AGIVertices[_0x4ca8('0x12')]['createSquareDetailsReport']=function(_0x346fa1,_0x258499,_0x2eae16){this[_0x4ca8('0x14')][_0x4ca8('0x3a')]({'uniqueid':this[_0x4ca8('0x10')]['uniqueid'],'node':_0x346fa1[_0x4ca8('0x3b')],'application':_0x346fa1['agicommand'],'data':_0x258499||null,'project_name':this[_0x4ca8('0x10')]['arg_1'],'callerid':this[_0x4ca8('0x10')][_0x4ca8('0x3c')]})[_0x4ca8('0x18')](function(_0x48a55a){if(_0x2eae16){_0x2eae16(null,_0x48a55a);}})[_0x4ca8('0x1a')](function(_0x2b2222){if(_0x2eae16){_0x2eae16(_0x2b2222);}});};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x3d')]=function(_0xd6d442,_0x2bd0c1,_0x3434b4,_0x181102){this[_0x4ca8('0x14')][_0x4ca8('0x3d')]({'uniqueid':this[_0x4ca8('0x10')][_0x4ca8('0x3e')],'callerid':this[_0x4ca8('0x10')]['callerid'],'calleridname':this['channel'][_0x4ca8('0x3f')],'context':this['channel'][_0x4ca8('0x40')],'extension':this['channel'][_0x4ca8('0x41')],'priority':this[_0x4ca8('0x10')][_0x4ca8('0x42')],'accountcode':this[_0x4ca8('0x10')][_0x4ca8('0x43')],'dnid':this[_0x4ca8('0x10')][_0x4ca8('0x44')],'projectName':this[_0x4ca8('0x10')][_0x4ca8('0x45')],'saveName':_0x2bd0c1,'filename':_0xd6d442['file']||_0x2bd0c1,'savePath':_0x3434b4})[_0x4ca8('0x18')](function(_0x3cab83){_0x181102(null,_0x3cab83);})['catch'](function(_0x29c8d8){_0x181102(_0x29c8d8);});};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x46')]=function(_0x8eee18,_0xca3ee0,_0x311f74,_0x1d20fa,_0x3a1ec8){this[_0x4ca8('0x14')][_0x4ca8('0x46')]({'uniqueid':this[_0x4ca8('0x10')][_0x4ca8('0x3e')],'body':_0x8eee18,'direction':_0xca3ee0,'providerName':_0x311f74,'providerResponse':_0x1d20fa})[_0x4ca8('0x18')](function(_0x5e67c2){if(_0x3a1ec8){_0x3a1ec8(null,_0x5e67c2);}})[_0x4ca8('0x1a')](function(_0x131c1f){if(_0x3a1ec8){_0x3a1ec8(_0x131c1f);}});};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x47')]=function(_0xac9871,_0x24ea2f){this[_0x4ca8('0x14')][_0x4ca8('0x47')]({'firstName':_[_0x4ca8('0x48')](_0xac9871[_0x4ca8('0x19')])||_[_0x4ca8('0x49')](_0xac9871[_0x4ca8('0x19')])?'callback_'+Math[_0x4ca8('0x4a')]():_0xac9871[_0x4ca8('0x19')],'lastName':_['isEmpty'](_0xac9871[_0x4ca8('0x4b')])||_[_0x4ca8('0x49')](_0xac9871[_0x4ca8('0x4b')])?null:_0xac9871['lastName'],'phone':_0xac9871['phone'],'ListId':_0xac9871[_0x4ca8('0x4c')],'scheduledat':_0xac9871[_0x4ca8('0x4d')],'callbackUniqueid':this[_0x4ca8('0x10')][_0x4ca8('0x3e')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0xac9871[_0x4ca8('0x4d')][_0x4ca8('0x4e')](),'priority':_0xac9871['callback_priority']})[_0x4ca8('0x18')](function(_0x272b3d){_0x24ea2f(null,_0x272b3d);})[_0x4ca8('0x1a')](function(_0xfdde6a){_0x24ea2f(_0xfdde6a);});};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x4f')]=function(_0x224cdb,_0x2bdef7){this[_0x4ca8('0x14')]['getPauseById'](_0x224cdb)[_0x4ca8('0x18')](function(_0x5585f3){_0x2bdef7(null,_0x5585f3?_0x5585f3[_0x4ca8('0x19')]:![]);})[_0x4ca8('0x1a')](function(_0x4456ca){_0x2bdef7(_0x4456ca);});};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x50')]=function(_0x302178,_0x42676c,_0x43b970){var _0x1b7b6a={'role':_0x4ca8('0x51')};_0x1b7b6a[_0x302178]=this[_0x4ca8('0x10')][_0x4ca8('0x3c')];this['rpc'][_0x4ca8('0x50')](_0x1b7b6a,_0x42676c,this['channel'][_0x4ca8('0x3e')])[_0x4ca8('0x18')](function(_0x6bff0c){_0x43b970(null,_[_0x4ca8('0x49')](_0x6bff0c)?![]:!![]);})[_0x4ca8('0x1a')](function(_0x37198f){logger[_0x4ca8('0x2f')](_0x37198f);_0x43b970(null,![]);});};AGIVertices['prototype'][_0x4ca8('0x52')]=function(_0x233c22,_0x26c91c){var _0x214129={'role':_0x4ca8('0x51')};_0x214129[_0x233c22]=this['channel'][_0x4ca8('0x3c')];this[_0x4ca8('0x14')][_0x4ca8('0x52')](_0x214129)[_0x4ca8('0x18')](function(_0x5361dc){_0x26c91c(null,_['isNil'](_0x5361dc)?![]:!![]);})[_0x4ca8('0x1a')](function(_0x28b0ea){logger[_0x4ca8('0x2f')](_0x28b0ea);_0x26c91c(null,![]);});};AGIVertices['prototype'][_0x4ca8('0x53')]=function(_0x4c1323,_0x3d5ad9){var _0x1e81f3={'role':'agent'};_0x1e81f3[_0x4c1323]=this[_0x4ca8('0x10')][_0x4ca8('0x3c')];this[_0x4ca8('0x14')]['agentLogout'](_0x1e81f3)[_0x4ca8('0x18')](function(_0x3c67c1){_0x3d5ad9(null,_['isNil'](_0x3c67c1)?![]:!![]);})['catch'](function(_0x37b320){logger['error'](_0x37b320);_0x3d5ad9(null,![]);});};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x54')]=function(_0x5a60f1,_0x1c78cf){var _0xf6066d={'role':_0x4ca8('0x51')};_0xf6066d[_0x5a60f1]=this[_0x4ca8('0x10')][_0x4ca8('0x3c')];var _0x477934=_0x5a60f1!=_0x4ca8('0x55')?util[_0x4ca8('0x56')](_0x4ca8('0x57'),_0x4ca8('0x58'),this['channel'][_0x4ca8('0x3c')]):undefined;this[_0x4ca8('0x14')]['agentLogin'](_0xf6066d,_0x477934)[_0x4ca8('0x18')](function(_0x33890d){_0x1c78cf(null,_['isNil'](_0x33890d)?![]:!![]);})[_0x4ca8('0x1a')](function(_0x5ca317){logger[_0x4ca8('0x2f')](_0x5ca317);_0x1c78cf(null,![]);});};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x59')]=function(_0xa37320,_0x10cc1f){sh[_0x4ca8('0x5a')](_[_0x4ca8('0x5b')](_0xa37320),function(_0x36b3e0,_0x4eced9){var _0x35ff44=_0x4eced9['replace'](/(\r\n|\n|\r)/gm,'');_0x10cc1f(null,_0x35ff44);});};AGIVertices[_0x4ca8('0x12')]['googleCloudTTS']=function(_0x1b4dde,_0x360167){scripts[_0x4ca8('0x5c')](_0x1b4dde[_0x4ca8('0x5d')],_0x1b4dde[_0x4ca8('0x5e')]||'text',_0x1b4dde[_0x4ca8('0x5f')],_0x1b4dde[_0x4ca8('0x60')]||'en-US',_0x1b4dde[_0x4ca8('0x61')]||_0x4ca8('0x62'),_0x1b4dde[_0x4ca8('0x63')]||_0x4ca8('0x64'))[_0x4ca8('0x18')](function(_0x21506f){_0x360167(null,_0x21506f);})[_0x4ca8('0x1a')](function(_0x5063a0){_0x360167(_0x5063a0);});};AGIVertices[_0x4ca8('0x12')]['googleTTS']=function(_0x24b2f1,_0x5222a5){scripts[_0x4ca8('0x65')](_0x24b2f1[_0x4ca8('0x5f')],_0x24b2f1[_0x4ca8('0x66')]||'en',0x1)[_0x4ca8('0x18')](function(_0x20ace5){_0x5222a5(null,_0x20ace5);})['catch'](function(_0x3172bf){_0x5222a5(_0x3172bf);});};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x67')]=function(_0xeb4bae,_0x46121d){var _0x21c005={'uri':_0xeb4bae[_0x4ca8('0x68')],'method':_0xeb4bae['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xeb4bae['timeout'])===_0x4ca8('0x69')&&parseInt(_0xeb4bae[_0x4ca8('0x6a')])>=0x1?parseInt(_0xeb4bae[_0x4ca8('0x6a')])*0x3e8:0x5*0x3e8};if(_[_0x4ca8('0x6b')]([_0x4ca8('0x6c'),'PUT'],_0x21c005['method'][_0x4ca8('0x6d')]())){try{_0x21c005[_0x4ca8('0x6e')]=_0xeb4bae[_0x4ca8('0xd')]?JSON['parse'](_0xeb4bae[_0x4ca8('0xd')]):{};}catch(_0x35676a){logger[_0x4ca8('0x2f')](_0x4ca8('0x6f'),_0x35676a);}}try{_0x21c005[_0x4ca8('0x70')]=_0xeb4bae['rawHeaders']?JSON[_0x4ca8('0x71')](_0xeb4bae['rawHeaders']):{};}catch(_0x425ab1){logger[_0x4ca8('0x2f')](_0x4ca8('0x72'),_0x425ab1);}if(_0xeb4bae['computedVariables']){try{var _0x3bf6a4=require(_0xeb4bae[_0x4ca8('0x73')])['sync'](this,_0x21c005);_0x21c005[_0x4ca8('0x74')]=Mustache[_0x4ca8('0x75')](_0xeb4bae[_0x4ca8('0x68')],_0x3bf6a4,{},['$$','$$']);if(_0x21c005[_0x4ca8('0x70')]){_0x21c005['headers']=JSON[_0x4ca8('0x71')](Mustache['render'](JSON[_0x4ca8('0x76')](_0x21c005[_0x4ca8('0x70')]),_0x3bf6a4,{},['$$','$$']));}if(_0x21c005[_0x4ca8('0x6e')]){_0x21c005[_0x4ca8('0x6e')]=JSON[_0x4ca8('0x71')](Mustache['render'](JSON[_0x4ca8('0x76')](_0x21c005['body']),_0x3bf6a4,{},['$$','$$']));}}catch(_0x26ecff){logger[_0x4ca8('0x2f')](_0x4ca8('0x77'),_0x26ecff);}}rp(_0x21c005)[_0x4ca8('0x18')](function(_0x49296a){var _0x29a094={'statusCode':_0x49296a[_0x4ca8('0x78')]||0xc8,'statusMessage':_0x49296a[_0x4ca8('0x79')]||'OK','headers':_0x49296a[_0x4ca8('0x70')]||{},'body':_0x49296a[_0x4ca8('0x6e')]||{}};_0x46121d(null,_0x29a094);})[_0x4ca8('0x1a')](function(_0x1ca8d4){var _0x23d384={'statusCode':_0x1ca8d4[_0x4ca8('0x78')]||0x1f4,'statusMessage':_0x1ca8d4['message']||_0x4ca8('0x7a'),'headers':_0x1ca8d4['options']['headers']||{},'body':_0x1ca8d4[_0x4ca8('0x7b')][_0x4ca8('0x6e')]||{}};_0x46121d(null,_0x23d384);});};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x7c')]=function(_0x2e2584,_0x1106a6){scripts[_0x4ca8('0x7c')](this[_0x4ca8('0x10')][_0x4ca8('0x3e')],_0x2e2584[_0x4ca8('0x7d')],_0x2e2584['text'],_0x2e2584['dialogflow_language']||'en')['then'](function(_0x2b301f){_0x1106a6(null,_0x2b301f);})[_0x4ca8('0x1a')](function(_0x48911f){_0x1106a6(_0x48911f);});};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x7e')]=function(_0x346e73,_0x217ab0){scripts['googleDialogflowV2'](this['channel'][_0x4ca8('0x3e')],_0x346e73[_0x4ca8('0x7f')],_0x346e73[_0x4ca8('0x80')],_0x346e73['private_key'],_0x346e73['text'],_0x346e73['dialogflowV2_language']||'en')[_0x4ca8('0x18')](function(_0xb26bfd){_0x217ab0(null,_0xb26bfd);})[_0x4ca8('0x1a')](function(_0x4882f6){_0x217ab0(_0x4882f6);});};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x81')]=function(_0x5370da,_0x4797e7){scripts[_0x4ca8('0x81')](this[_0x4ca8('0x10')],_0x5370da)[_0x4ca8('0x18')](function(_0x4af920){_0x4797e7(null,_0x4af920);})[_0x4ca8('0x1a')](function(_0x1854f6){_0x4797e7(_0x1854f6);});};AGIVertices[_0x4ca8('0x12')]['ispeechTTS']=function(_0x20191b,_0x3318d7){scripts[_0x4ca8('0x82')](_0x20191b['key'],_0x20191b[_0x4ca8('0x5f')],_0x20191b[_0x4ca8('0x83')]||_0x4ca8('0x84'),_0x20191b[_0x4ca8('0x85')])['then'](function(_0x36e718){_0x3318d7(null,_0x36e718);})[_0x4ca8('0x1a')](function(_0x66bb1f){_0x3318d7(_0x66bb1f);});};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x86')]=function(_0x2599b0,_0x254e11,_0x1216bf){scripts[_0x4ca8('0x86')](_0x254e11,_0x2599b0[_0x4ca8('0x7d')],_0x2599b0[_0x4ca8('0x87')]||'en-US',this[_0x4ca8('0x88')](_0x2599b0[_0x4ca8('0x89')])?_0x2599b0[_0x4ca8('0x89')]:undefined)[_0x4ca8('0x18')](function(_0x34b762){_0x1216bf(null,_0x34b762);})['catch'](function(_0x375a31){_0x1216bf(_0x375a31);});};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x8a')]=function(_0x251ea8,_0x579d4f){scripts[_0x4ca8('0x8a')](_0x251ea8['aws_access_key_id'],_0x251ea8[_0x4ca8('0x8b')],_0x251ea8[_0x4ca8('0x8c')],_0x251ea8[_0x4ca8('0x8d')]||_0x4ca8('0x8e'),_0x251ea8[_0x4ca8('0x5f')],_0x251ea8[_0x4ca8('0x8f')]||_0x4ca8('0x5f'))[_0x4ca8('0x18')](function(_0x2b537b){_0x579d4f(null,_0x2b537b);})[_0x4ca8('0x1a')](function(_0xbf6795){_0x579d4f(_0xbf6795);});};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x90')]=function(_0x2f9c88,_0x39aee6){scripts[_0x4ca8('0x90')](this['channel']['uniqueid'],_0x2f9c88['aws_access_key_id'],_0x2f9c88[_0x4ca8('0x8b')],_0x2f9c88['aws_lex_region'],_0x2f9c88[_0x4ca8('0x5f')],_0x2f9c88['aws_bot_name'])[_0x4ca8('0x18')](function(_0x1b33ea){_0x39aee6(null,_0x1b33ea);})[_0x4ca8('0x1a')](function(_0x373fe8){_0x39aee6(_0x373fe8);});};AGIVertices[_0x4ca8('0x12')]['googleASR']=function(_0x5f16e9,_0x104b68,_0x502857){scripts[_0x4ca8('0x91')](_0x104b68,_0x5f16e9[_0x4ca8('0x7d')],_0x5f16e9[_0x4ca8('0x92')]||_0x4ca8('0x84'))[_0x4ca8('0x18')](function(_0x128192){_0x502857(null,_0x128192);})['catch'](function(_0x286f56){_0x502857(_0x286f56);});};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x93')]=function(_0x4993ce,_0x349bb4,_0x35de8a){scripts[_0x4ca8('0x93')](_0x349bb4,_0x4993ce[_0x4ca8('0x94')],_0x4993ce[_0x4ca8('0x95')],_0x4993ce[_0x4ca8('0x74')])[_0x4ca8('0x18')](function(_0x1fb4ea){_0x35de8a(null,_0x1fb4ea);})[_0x4ca8('0x1a')](function(_0x3453e9){_0x35de8a(_0x3453e9);});};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x96')]=function(_0x3eec55){var _0x2736b8=_['includes'](verticesWithRetry,_0x3eec55[_0x4ca8('0x97')])?_0x3eec55:_[_0x4ca8('0x98')](_0x3eec55);for(var _0x22cc18 in _0x2736b8){if(_0x2736b8['hasOwnProperty'](_0x22cc18)){if(_0x2736b8[_0x22cc18]&&_[_0x4ca8('0x99')](_0x2736b8[_0x22cc18])){if(_[_0x4ca8('0x6b')](recursiveMapAttributes,_0x22cc18)){_0x2736b8[_0x22cc18]=this['replaceObjectAllVariables'](_0x2736b8[_0x22cc18]);}else{_0x2736b8[_0x22cc18]=this['replaceAllVariables'](_0x2736b8[_0x22cc18]);}}}}return _0x2736b8;};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x9a')]=function(_0x17221f){for(var _0x237fa9 in _0x17221f){if(_0x17221f[_0x4ca8('0x9b')](_0x237fa9)){if(_[_0x4ca8('0x9c')](_0x17221f[_0x237fa9])){this['recursiveNodeIndex'](_0x17221f[_0x237fa9]);}else if(_[_0x4ca8('0x9d')](_0x17221f[_0x237fa9])){for(var _0x592758=0x0;_0x592758<_0x17221f[_0x237fa9]['length'];_0x592758++){this[_0x4ca8('0x9a')](_0x17221f[_0x237fa9][_0x592758]);}}else if(_[_0x4ca8('0x99')](_0x17221f[_0x237fa9])){_0x17221f[_0x237fa9]=this[_0x4ca8('0x9e')](_0x17221f[_0x237fa9]);}}}};AGIVertices[_0x4ca8('0x12')]['saveRestApiResult']=function(_0x4a60f1,_0x1bb7d7){for(var _0x4fd1aa in _0x4a60f1){if(_0x4a60f1['hasOwnProperty'](_0x4fd1aa)){if(_[_0x4ca8('0x9c')](_0x4a60f1[_0x4fd1aa])){if(!_['isEmpty'](_0x4a60f1[_0x4fd1aa])){this['saveRestApiResult'](_0x4a60f1[_0x4fd1aa],util[_0x4ca8('0x56')](_0x4ca8('0x9f'),_0x1bb7d7,_0x4fd1aa));}}else if(_[_0x4ca8('0x9d')](_0x4a60f1[_0x4fd1aa])){for(var _0x22df20=0x0;_0x22df20<_0x4a60f1[_0x4fd1aa]['length'];_0x22df20++){this[_0x4ca8('0xa0')](_0x4a60f1[_0x4fd1aa][_0x22df20],util['format']('%s.%s',_0x1bb7d7,_0x4fd1aa+'['+_0x22df20+']'));}}else{if(!_[_0x4ca8('0x49')](_0x4a60f1[_0x4fd1aa])){this['channel']['setVariable'](util[_0x4ca8('0x56')](_0x4ca8('0x9f'),_0x1bb7d7,_0x4fd1aa),_0x4a60f1[_0x4fd1aa]);}}}}};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0xa1')]=function(_0x538c3a){try{var _0x4f7ab8=JSON[_0x4ca8('0x71')](_0x538c3a);this[_0x4ca8('0x9a')](_0x4f7ab8);return JSON[_0x4ca8('0x76')](_0x4f7ab8);}catch(_0x2f84d9){return this['replaceAllVariables'](_0x538c3a);}};AGIVertices[_0x4ca8('0x12')]['replaceAllVariables']=function(_0x3aa24e){var _0x5d7942=_0x3aa24e[_0x4ca8('0xa2')]('{');for(var _0x2bde75=0x1;_0x2bde75<_0x5d7942[_0x4ca8('0xa3')];_0x2bde75+=0x1){var _0x5748eb=_0x5d7942[_0x2bde75][_0x4ca8('0xa2')]('}');if(_0x5748eb[_0x4ca8('0xa3')]>0x1){_0x3aa24e=_0x3aa24e[_0x4ca8('0xa4')]('{'+_0x5748eb[0x0]+'}',this['channel']['getVariable'](_0x5748eb[0x0])[_0x4ca8('0xa5')]||_0x5748eb[0x0]);}}if(_0x5d7942[_0x4ca8('0xa3')]===0x1){return _0x3aa24e[_0x4ca8('0x4e')]();}return this[_0x4ca8('0x9e')](_0x3aa24e);};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0xa6')]=function(_0x24aa26,_0x2a63d6){var _0x1ccdb9=this['channel'][_0x4ca8('0x13')](_0x24aa26);if(_0x1ccdb9[_0x4ca8('0xa7')]===-0x1){return _0x1ccdb9;}logger['info'](util[_0x4ca8('0x56')](_0x4ca8('0xa8'),_0x2a63d6,_0x1ccdb9[_0x4ca8('0xa5')]));return this['channel'][_0x4ca8('0xa9')](_0x2a63d6,_0x1ccdb9[_0x4ca8('0xa5')]);};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x88')]=function(_0x3e1a27){return _0x3e1a27&&_0x3e1a27!=='0'&&_0x3e1a27!=='-1'&&_0x3e1a27!=='';};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0xaa')]=function(_0x16db3c){this['createSquareDetailsReport'][_0x4ca8('0xab')](this,_0x16db3c,'-');_0x16db3c[_0x4ca8('0xac')]=_0x16db3c['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0xad')]=function(_0x17d3e0){logger['info'](util[_0x4ca8('0x56')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x17d3e0['label']));if(!this[_0x4ca8('0x88')](_0x17d3e0['text'])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')](_0x4ca8('0xaf'));}var _0x81caf8='\x22'+_0x17d3e0[_0x4ca8('0x5f')]+'\x22';if(this[_0x4ca8('0x88')](_0x17d3e0['options'])){_0x81caf8+=','+_0x17d3e0[_0x4ca8('0x7b')];}var _0x420e54=this[_0x4ca8('0x10')][_0x4ca8('0x5a')](_0x4ca8('0xb0'),_0x81caf8);if(_0x420e54[_0x4ca8('0xa7')]===-0x1){return _0x420e54;}return this[_0x4ca8('0x10')][_0x4ca8('0xae')](util[_0x4ca8('0x56')](_0x4ca8('0xb1'),_0x81caf8));};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0xb2')]=function(_0x222b2b){logger[_0x4ca8('0x33')](util['format'](_0x4ca8('0xb3'),_0x222b2b['label']));if(!this[_0x4ca8('0x88')](_0x222b2b['grammar'])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')](_0x4ca8('0xb4'));}var _0x1b17eb=_0x222b2b[_0x4ca8('0xb5')];if(this[_0x4ca8('0x88')](_0x222b2b[_0x4ca8('0x7b')])){_0x1b17eb+=','+_0x222b2b['options'];}var _0x538861=this[_0x4ca8('0x10')]['exec'](_0x4ca8('0xb6'),_0x1b17eb);if(_0x538861['result']===-0x1){return _0x538861;}var _0x25b7d6=this['getAndSetVariable'](_0x4ca8('0xb7'),_0x4ca8('0xb8'));if(_0x25b7d6['result']===-0x1){return _0x25b7d6;}var _0x456935=this['getAndSetVariable'](_0x4ca8('0xb9'),_0x4ca8('0xba'));if(_0x456935[_0x4ca8('0xa7')]===-0x1){return _0x456935;}var _0x93ba2a=this[_0x4ca8('0xa6')](_0x4ca8('0xbb'),_0x4ca8('0xbc'));if(_0x93ba2a[_0x4ca8('0xa7')]===-0x1){return _0x93ba2a;}return this[_0x4ca8('0x10')][_0x4ca8('0xae')](util[_0x4ca8('0x56')](_0x4ca8('0xbd'),_0x1b17eb));};AGIVertices['prototype'][_0x4ca8('0x8')]=function(_0x32c97e){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0xbe'),_0x32c97e[_0x4ca8('0x3b')]));return this[_0x4ca8('0x10')][_0x4ca8('0x8')]([_0x32c97e[_0x4ca8('0xbf')],_0x32c97e[_0x4ca8('0xc0')]]);};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0xc1')]=function(_0x520a60){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x520a60[_0x4ca8('0x3b')]));if(this['isConfigured'](_0x520a60[_0x4ca8('0x6a')])){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0xc2'),_0x520a60[_0x4ca8('0x6a')]));var _0x1ea53f=this[_0x4ca8('0x10')]['wait'](_0x520a60[_0x4ca8('0x6a')]);if(_0x1ea53f[_0x4ca8('0xa7')]===-0x1){return _0x1ea53f;}}return this['channel'][_0x4ca8('0xc1')]();};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0xc3')]=function(_0x49c983){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x49c983[_0x4ca8('0x3b')]));if(!this['isConfigured'](_0x49c983[_0x4ca8('0x4c')])){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x49c983,_0x4ca8('0xc4'));}_0x49c983[_0x4ca8('0x4d')]=moment();if(this[_0x4ca8('0x88')](_0x49c983[_0x4ca8('0xc5')])){_0x49c983['scheduledAt']=moment()[_0x4ca8('0xc6')](_0x49c983[_0x4ca8('0xc5')],_0x4ca8('0xc7'));}if(!this[_0x4ca8('0x88')](_0x49c983[_0x4ca8('0xc8')])){_0x49c983[_0x4ca8('0xc8')]=0x2;}this['createCmContact']['sync'](this,_0x49c983);return this[_0x4ca8('0x10')][_0x4ca8('0xae')](util[_0x4ca8('0x56')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x49c983[_0x4ca8('0xc9')],_0x49c983[_0x4ca8('0x4c')],_0x49c983[_0x4ca8('0x4d')]));};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0xca')]=function(_0x309724){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x309724[_0x4ca8('0x3b')]));var _0x419f5a=this['channel']['exec'](_0x309724[_0x4ca8('0xcb')],_0x309724[_0x4ca8('0x7b')]);if(_0x419f5a[_0x4ca8('0xa7')]===-0x1){return _0x419f5a;}return this[_0x4ca8('0x10')][_0x4ca8('0xae')](util[_0x4ca8('0x56')](_0x4ca8('0xcc'),_0x309724[_0x4ca8('0xcb')],_0x309724[_0x4ca8('0x7b')]));};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0xcd')]=function(_0x539bb0){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0xce'),_0x539bb0['label']));if(!this[_0x4ca8('0x88')](_0x539bb0[_0x4ca8('0x5f')])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')]('no\x20text\x20configured');}var _0x1451a6='\x22'+_0x539bb0['text']+'\x22';if(this[_0x4ca8('0x88')](_0x539bb0[_0x4ca8('0x7b')])){_0x1451a6+=','+_0x539bb0[_0x4ca8('0x7b')];}var _0x466305=this[_0x4ca8('0x10')][_0x4ca8('0x5a')]('MRCPSynth',_0x1451a6);if(_0x466305['result']===-0x1){return _0x466305;}return this[_0x4ca8('0x10')]['noop'](util[_0x4ca8('0x56')](_0x4ca8('0xb1'),_0x1451a6));};AGIVertices[_0x4ca8('0x12')]['sestektts']=function(_0x43fade){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0xcf'),_0x43fade['label']));if(!this[_0x4ca8('0x88')](_0x43fade[_0x4ca8('0x5f')])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')]('no\x20text\x20configured');}var _0x10128e='\x22'+_0x43fade[_0x4ca8('0x5f')]+'\x22';if(this[_0x4ca8('0x88')](_0x43fade[_0x4ca8('0x7b')])){_0x10128e+=','+_0x43fade[_0x4ca8('0x7b')];}var _0x4d2478=this['channel'][_0x4ca8('0x5a')]('MRCPSynth',_0x10128e);if(_0x4d2478['result']===-0x1){return _0x4d2478;}return this[_0x4ca8('0x10')][_0x4ca8('0xae')](util['format'](_0x4ca8('0xb1'),_0x10128e));};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0xd0')]=function(_0x1a7da7){logger[_0x4ca8('0x33')](util['format'](_0x4ca8('0xd1'),_0x1a7da7[_0x4ca8('0x3b')]));if(!this[_0x4ca8('0x88')](_0x1a7da7[_0x4ca8('0xb5')])){return this['channel'][_0x4ca8('0xae')](_0x4ca8('0xb4'));}var _0x5ba209=_0x1a7da7['grammar'];if(this['isConfigured'](_0x1a7da7[_0x4ca8('0x7b')])){_0x5ba209+=','+_0x1a7da7[_0x4ca8('0x7b')];}var _0x26d0f7=this['channel'][_0x4ca8('0x5a')](_0x4ca8('0xb6'),_0x5ba209);if(_0x26d0f7[_0x4ca8('0xa7')]===-0x1){return _0x26d0f7;}var _0x427e74=this[_0x4ca8('0xa6')](_0x4ca8('0xb7'),_0x4ca8('0xd2'));if(_0x427e74[_0x4ca8('0xa7')]===-0x1){return _0x427e74;}var _0x5c344d=this['getAndSetVariable'](_0x4ca8('0xb9'),_0x4ca8('0xd3'));if(_0x5c344d['result']===-0x1){return _0x5c344d;}var _0x12ec7b=this['getAndSetVariable'](_0x4ca8('0xbb'),_0x4ca8('0xd4'));if(_0x12ec7b[_0x4ca8('0xa7')]===-0x1){return _0x12ec7b;}return this[_0x4ca8('0x10')][_0x4ca8('0xae')](util[_0x4ca8('0x56')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5ba209));};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0xd5')]=function(_0x345e1c){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0xd6'),_0x345e1c[_0x4ca8('0x3b')]));if(!this['isConfigured'](_0x345e1c[_0x4ca8('0xb5')])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')]('no\x20grammar\x20configured');}var _0x35ad38=_0x345e1c['grammar'];if(this[_0x4ca8('0x88')](_0x345e1c['options'])){_0x35ad38+=','+_0x345e1c[_0x4ca8('0x7b')];}var _0x38c3cc=this[_0x4ca8('0x10')]['exec'](_0x4ca8('0xb6'),_0x35ad38);if(_0x38c3cc['result']===-0x1){return _0x38c3cc;}var _0x50fe9d=this[_0x4ca8('0xa6')](_0x4ca8('0xb7'),'SESTEK_ASR_CONFIDENCE');if(_0x50fe9d[_0x4ca8('0xa7')]===-0x1){return _0x50fe9d;}var _0xe3eb35=this[_0x4ca8('0xa6')](_0x4ca8('0xb9'),'SESTEK_ASR_TRANSCRIPT');if(_0xe3eb35[_0x4ca8('0xa7')]===-0x1){return _0xe3eb35;}var _0x59b1a2=this[_0x4ca8('0xa6')]('RECOG_INSTANCE()',_0x4ca8('0xd7'));if(_0x59b1a2[_0x4ca8('0xa7')]===-0x1){return _0x59b1a2;}return this[_0x4ca8('0x10')][_0x4ca8('0xae')](util[_0x4ca8('0x56')](_0x4ca8('0xbd'),_0x35ad38));};AGIVertices['prototype'][_0x4ca8('0xd8')]=function(_0x4be0dd){logger[_0x4ca8('0x33')](util['format'](_0x4ca8('0xd9'),_0x4be0dd[_0x4ca8('0x3b')]));if(!this[_0x4ca8('0x88')](_0x4be0dd[_0x4ca8('0xda')])){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x4be0dd,'no\x20database\x20selected');}var _0x19d5b2=this[_0x4ca8('0xdb')][_0x4ca8('0xab')](this,_0x4be0dd['odbc_id']);if(!_0x19d5b2){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x4be0dd,'no\x20odbc\x20database\x20found');}if(!this[_0x4ca8('0x88')](_0x4be0dd['query'])){return this[_0x4ca8('0x10')]['error'](_0x4be0dd,_0x4ca8('0xdc'));}var _0xb82c79=_0x4be0dd[_0x4ca8('0x32')][_0x4ca8('0xdd')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x4ca8('0xae')](util[_0x4ca8('0x56')](_0x4ca8('0xde'),_0xb82c79));var _0x35c4d3=this['getQueryOdbc']['sync'](this,_0x19d5b2,_0xb82c79);this[_0x4ca8('0x3a')][_0x4ca8('0xab')](this,_0x4be0dd,_0xb82c79);if(!this[_0x4ca8('0x88')](_0x4be0dd[_0x4ca8('0xdf')])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')](_0x4ca8('0xe0'));}var _0x5ece6f=this['getVariable'][_0x4ca8('0xab')](this,_0x4be0dd[_0x4ca8('0xdf')]);if(!_0x5ece6f){return this[_0x4ca8('0x10')]['error'](_0x4be0dd,_0x4ca8('0xe1'));}var _0x4a7e27=this;_0x35c4d3[_0x4ca8('0xe2')](function(_0x1bd47a,_0x2c5d0e){Object[_0x4ca8('0xe3')](_0x1bd47a)[_0x4ca8('0xe2')](function(_0x5dd7ca){_0x4a7e27[_0x4ca8('0x10')][_0x4ca8('0xa9')](util[_0x4ca8('0x56')](_0x4ca8('0xe4'),_0x5ece6f,_0x2c5d0e,_0x5dd7ca),_0x1bd47a[_0x5dd7ca]);});});this[_0x4ca8('0x10')][_0x4ca8('0xa9')](util[_0x4ca8('0x56')](_0x4ca8('0xe5'),_0x5ece6f),_0x35c4d3[_0x4ca8('0xa3')]);return this[_0x4ca8('0x10')][_0x4ca8('0xae')](util[_0x4ca8('0x56')]('variable\x20%s\x20set',_0x5ece6f));};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0xe6')]=function(_0x168747){logger[_0x4ca8('0xe7')](util[_0x4ca8('0x56')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x168747[_0x4ca8('0x3b')]));if(!this[_0x4ca8('0x88')](_0x168747['sip_id'])){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x168747,_0x4ca8('0xe8'));}var _0x36736b=this[_0x4ca8('0xe9')][_0x4ca8('0xab')](this,_0x168747[_0x4ca8('0xea')]);if(!_0x36736b){return this['channel']['error'](_0x168747,_0x4ca8('0xeb'));}var _0x32e666=this[_0x4ca8('0x10')][_0x4ca8('0x5a')](_0x4ca8('0xec'),[util['format']('SIP/%s',_0x36736b),_0x168747['timeout'],_0x168747[_0x4ca8('0xed')],_0x168747[_0x4ca8('0x68')]]);if(_0x32e666['result']===-0x1){return _0x32e666;}return this[_0x4ca8('0x10')][_0x4ca8('0xae')](util['format'](_0x4ca8('0xee'),'DIAL'));};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0xef')]=function(_0x368525){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x368525[_0x4ca8('0x3b')]));if(!this[_0x4ca8('0x88')](_0x368525[_0x4ca8('0x7d')])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')](_0x4ca8('0xf0'));}if(!this['isConfigured'](_0x368525[_0x4ca8('0x5f')])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')]('no\x20text\x20configured');}this[_0x4ca8('0x10')][_0x4ca8('0xf1')]=!![];this[_0x4ca8('0x3a')](_0x368525);this[_0x4ca8('0x46')](_0x368525[_0x4ca8('0x5f')],'in','','');this[_0x4ca8('0x10')][_0x4ca8('0xae')](util[_0x4ca8('0x56')](_0x4ca8('0xf2'),_0x368525[_0x4ca8('0x5f')]));var _0x492401=this[_0x4ca8('0x7c')][_0x4ca8('0xab')](this,_0x368525);if(_0x492401){for(var _0x2d25ca in _0x492401){if(_0x492401[_0x4ca8('0x9b')](_0x2d25ca)){this['channel']['setVariable'](util[_0x4ca8('0x56')](_0x4ca8('0xf3'),_0x2d25ca[_0x4ca8('0x6d')]()),_0x492401[_0x2d25ca]);}}this[_0x4ca8('0x46')](_0x492401['speech'],_0x4ca8('0xf4'),'dialogflow','');return this[_0x4ca8('0x10')][_0x4ca8('0xae')](util[_0x4ca8('0x56')](_0x4ca8('0xf5'),_0x492401[_0x4ca8('0xf6')]));}return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x368525,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x4ca8('0x12')]['dialogflowV2']=function(_0x1cc015){logger['info'](util[_0x4ca8('0x56')](_0x4ca8('0xf7'),_0x1cc015[_0x4ca8('0x3b')]));if(!this[_0x4ca8('0x88')](_0x1cc015[_0x4ca8('0x7f')])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')](_0x4ca8('0xf8'));}if(!this[_0x4ca8('0x88')](_0x1cc015[_0x4ca8('0x80')])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')](_0x4ca8('0xf9'));}if(!this[_0x4ca8('0x88')](_0x1cc015['private_key'])){return this['channel'][_0x4ca8('0xae')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x1cc015[_0x4ca8('0xfa')])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')](_0x4ca8('0xfb'));}if(!this[_0x4ca8('0x88')](_0x1cc015[_0x4ca8('0x5f')])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')](_0x4ca8('0xaf'));}this[_0x4ca8('0x10')][_0x4ca8('0xf1')]=!![];this[_0x4ca8('0x3a')](_0x1cc015);this['createSquareMessage'](_0x1cc015[_0x4ca8('0x5f')],'in','','');this[_0x4ca8('0x10')][_0x4ca8('0xae')](util[_0x4ca8('0x56')]('Trying\x20DialogflowV2:\x20%s',_0x1cc015['text']));var _0x53d788=this[_0x4ca8('0x7e')][_0x4ca8('0xab')](this,_0x1cc015);if(_0x53d788){for(var _0x1265d2 in _0x53d788){if(_0x53d788['hasOwnProperty'](_0x1265d2)){if(_0x1265d2!=='providerResponse'){this['channel'][_0x4ca8('0xa9')](util['format'](_0x4ca8('0xf3'),_0x1265d2[_0x4ca8('0x6d')]()),_0x53d788[_0x1265d2]);}}}this[_0x4ca8('0x46')](_0x53d788['speech'],_0x4ca8('0xf4'),_0x4ca8('0xfc'),_0x53d788['providerResponse']);return this[_0x4ca8('0x10')]['noop'](util['format']('DialogflowV2\x20Result\x20%s',_0x53d788[_0x4ca8('0xf6')]));}return this['channel'][_0x4ca8('0x2f')](_0x1cc015,_0x4ca8('0xfd'));};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0xfe')]=function(_0x547d1a){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0xff'),_0x547d1a[_0x4ca8('0x3b')]));if(!this[_0x4ca8('0x88')](_0x547d1a[_0x4ca8('0x100')])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')](_0x4ca8('0x101'));}if(!this['isConfigured'](_0x547d1a[_0x4ca8('0x102')])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')](_0x4ca8('0x103'));}if(!this[_0x4ca8('0x88')](_0x547d1a[_0x4ca8('0x104')])){return this[_0x4ca8('0x10')]['noop'](_0x4ca8('0x105'));}if(!this[_0x4ca8('0x88')](_0x547d1a[_0x4ca8('0x106')])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')](_0x4ca8('0xaf'));}this[_0x4ca8('0x10')][_0x4ca8('0xf1')]=!![];this[_0x4ca8('0x3a')](_0x547d1a);this[_0x4ca8('0x46')](_0x547d1a[_0x4ca8('0x5f')],'in','','');this[_0x4ca8('0x10')]['noop'](util[_0x4ca8('0x56')](_0x4ca8('0x107'),_0x547d1a[_0x4ca8('0x5f')]));var _0x14f103=this['sestekNDA'][_0x4ca8('0xab')](this,_0x547d1a);if(_0x14f103){for(var _0x2ae23a in _0x14f103){if(_0x14f103['hasOwnProperty'](_0x2ae23a)){this['channel'][_0x4ca8('0xa9')](util[_0x4ca8('0x56')](_0x4ca8('0x108'),_0x2ae23a[_0x4ca8('0x6d')]()),_0x14f103[_0x2ae23a]);}}this[_0x4ca8('0x46')](_0x14f103[_0x4ca8('0xf6')],_0x4ca8('0xf4'),_0x4ca8('0xfe'),'');if(_0x14f103[_0x4ca8('0x109')]){this['channel'][_0x4ca8('0xae')](util['format'](_0x4ca8('0x10a'),_0x14f103['audiofile']));var _0x5acc57=this[_0x4ca8('0x10')]['streamFile'](_0x14f103['audiofile']);try{fs['unlink'](_0x14f103[_0x4ca8('0x109')]+_0x4ca8('0x10b'));}catch(_0x2d47a2){logger[_0x4ca8('0x2f')](_0x2d47a2);}return _0x5acc57;}else{return this[_0x4ca8('0x10')][_0x4ca8('0xae')](util[_0x4ca8('0x56')](_0x4ca8('0x10c'),_0x14f103[_0x4ca8('0xf6')]));}}return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x547d1a,_0x4ca8('0x10d'));};AGIVertices['prototype'][_0x4ca8('0x10e')]=function(_0xd528fc){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')]('Enter\x20in\x20END\x20(%s)\x20block',_0xd528fc[_0x4ca8('0x3b')]));return this[_0x4ca8('0x10')][_0x4ca8('0xae')](_0x4ca8('0x10e'));};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x10f')]=function(_0x461054){logger['info'](util[_0x4ca8('0x56')](_0x4ca8('0x110'),_0x461054['label']));var _0x168ba7='';if(_0x461054['trunk_id']){if(!this['isConfigured'](_0x461054['trunk_id'])){return this['channel'][_0x4ca8('0x2f')](_0x461054,_0x4ca8('0x111'));}else{var _0x2cec63=parseInt(_0x461054[_0x4ca8('0x112')],0xa);if(isNaN(_0x2cec63)){_0x168ba7=_0x461054[_0x4ca8('0x112')];}else{_0x168ba7=this[_0x4ca8('0x20')][_0x4ca8('0xab')](this,_0x461054[_0x4ca8('0x112')]);if(!_0x168ba7){return this[_0x4ca8('0x10')]['error'](_0x461054,_0x4ca8('0x113'));}}}}else if(_0x461054[_0x4ca8('0x114')]){_0x168ba7=_0x461054[_0x4ca8('0x114')];}else{return this[_0x4ca8('0x10')]['error'](_0x461054,_0x4ca8('0x111'));}var _0x18fcd1=this[_0x4ca8('0x10')][_0x4ca8('0x5a')](_0x4ca8('0xec'),[util['format'](_0x4ca8('0x115'),_0x168ba7,_0x461054[_0x4ca8('0xc9')]),_0x461054[_0x4ca8('0x6a')],_0x461054[_0x4ca8('0xed')],_0x461054['url']]);if(_0x18fcd1[_0x4ca8('0xa7')]===-0x1){return _0x18fcd1;}return this[_0x4ca8('0x10')][_0x4ca8('0xae')](util[_0x4ca8('0x56')](_0x4ca8('0xee'),_0x4ca8('0xec')));};AGIVertices[_0x4ca8('0x12')]['finally']=function(_0x45123a){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0x116'),_0x45123a[_0x4ca8('0x3b')]));return this[_0x4ca8('0x10')]['noop'](_0x4ca8('0x117'));};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x118')]=function(_0x903ccf){logger['info'](util[_0x4ca8('0x56')](_0x4ca8('0x119'),_0x903ccf[_0x4ca8('0x3b')]));if(_0x903ccf['retry']===0x0){return this[_0x4ca8('0xaa')](_0x903ccf);}_0x903ccf['retry']-=0x1;if(!this[_0x4ca8('0x88')](_0x903ccf[_0x4ca8('0x11a')])){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x903ccf,_0x4ca8('0x11b'));}var _0x58959d=this[_0x4ca8('0x22')][_0x4ca8('0xab')](this,_0x903ccf[_0x4ca8('0x11a')]);if(!_0x58959d){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x903ccf,'no\x20file\x20audio\x20found');}if(!this[_0x4ca8('0x88')](_0x903ccf[_0x4ca8('0xdf')])){return this['channel'][_0x4ca8('0x2f')](_0x4ca8('0xe0'));}var _0x199840=this[_0x4ca8('0x10')][_0x4ca8('0x11c')](_0x58959d,_0x903ccf[_0x4ca8('0x11d')],_0x903ccf[_0x4ca8('0x11e')]);var _0x5fc151=_0x199840[_0x4ca8('0xa7')]?_0x199840[_0x4ca8('0xa7')]['toString']():'';logger[_0x4ca8('0x33')](_0x4ca8('0x11f'),JSON[_0x4ca8('0x76')](_0x199840));if(_0x199840[_0x4ca8('0xa7')]===-0x1){this[_0x4ca8('0x3a')][_0x4ca8('0xab')](this,_0x903ccf,_0x5fc151);return _0x199840;}else if(_0x199840[_0x4ca8('0xa5')]===_0x4ca8('0x6a')){_0x199840[_0x4ca8('0xa7')]=_0x5fc151[_0x4ca8('0xa3')]>=parseInt(_0x903ccf[_0x4ca8('0x120')])?'x':'i';}else{_0x199840['result']=_0x5fc151[_0x4ca8('0xa3')]>=parseInt(_0x903ccf[_0x4ca8('0x120')])&&_0x5fc151[_0x4ca8('0xa3')]<=parseInt(_0x903ccf[_0x4ca8('0x11e')])?'x':'i';}var _0x4b97d3=this[_0x4ca8('0x13')][_0x4ca8('0xab')](this,_0x903ccf[_0x4ca8('0xdf')]);if(!_0x4b97d3){return this['channel'][_0x4ca8('0x2f')](_0x903ccf,'no\x20variable\x20found');}this[_0x4ca8('0x10')][_0x4ca8('0xa9')](_0x4b97d3,_0x5fc151);if(this['isConfigured'](_0x903ccf[_0x4ca8('0x121')])){var _0x72d6b9=parseInt(_0x903ccf['hiddendigitsnum'],0xa);var _0x19bf6d=rs[_0x4ca8('0x122')]({'charset':'*','length':_0x72d6b9});var _0x383e75=_0x5fc151[_0x4ca8('0xa3')];if(_0x383e75>0x0){if(_0x383e75>_0x72d6b9){this['createSquareDetailsReport'][_0x4ca8('0xab')](this,_0x903ccf,_0x903ccf[_0x4ca8('0x123')]===_0x4ca8('0x124')?_0x19bf6d+_0x5fc151[_0x4ca8('0x125')](_0x72d6b9):_0x5fc151[_0x4ca8('0x125')](0x0,_0x383e75-_0x72d6b9)+_0x19bf6d);}else{this[_0x4ca8('0x3a')]['sync'](this,_0x903ccf,rs[_0x4ca8('0x122')]({'charset':'*','length':_0x383e75}));}}else{this['createSquareDetailsReport'][_0x4ca8('0xab')](this,_0x903ccf,'');}}else{this[_0x4ca8('0x3a')][_0x4ca8('0xab')](this,_0x903ccf,_0x5fc151);}return _0x199840;};AGIVertices[_0x4ca8('0x12')]['getsecretdigits']=function(_0x1395fc){logger[_0x4ca8('0x33')](util['format'](_0x4ca8('0x126'),_0x1395fc['label']));return this['getdigits'](_0x1395fc);};AGIVertices['prototype'][_0x4ca8('0x127')]=function(_0x8f0f97){logger['info'](util[_0x4ca8('0x56')](_0x4ca8('0x128'),_0x8f0f97[_0x4ca8('0x3b')]));this[_0x4ca8('0x3a')][_0x4ca8('0xab')](this,_0x8f0f97,_0x8f0f97[_0x4ca8('0x129')]);return this['channel'][_0x4ca8('0xae')](util[_0x4ca8('0x56')](_0x4ca8('0x12a'),_0x8f0f97[_0x4ca8('0x129')]));};AGIVertices['prototype']['awspolly']=function(_0x3a832c){logger['info'](util[_0x4ca8('0x56')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x3a832c[_0x4ca8('0x3b')]));if(!this[_0x4ca8('0x88')](_0x3a832c[_0x4ca8('0x12b')])||!this[_0x4ca8('0x88')](_0x3a832c[_0x4ca8('0x8b')])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x3a832c['text'])){return this[_0x4ca8('0x10')]['noop']('no\x20text\x20configured');}this[_0x4ca8('0x10')]['noop'](util['format'](_0x4ca8('0x12c'),_0x3a832c['text']));var _0x408d6e=this['awsPolly'][_0x4ca8('0xab')](this,_0x3a832c);if(_0x408d6e){this['channel'][_0x4ca8('0xae')](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0x408d6e));var _0x27f094=this[_0x4ca8('0x10')][_0x4ca8('0x12d')](_0x408d6e);try{fs[_0x4ca8('0x12e')](_0x408d6e+_0x4ca8('0x10b'));}catch(_0x2edbd8){logger[_0x4ca8('0x2f')](_0x2edbd8);}return _0x27f094;}return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x3a832c,_0x4ca8('0x12f'));};AGIVertices['prototype'][_0x4ca8('0x130')]=function(_0x12e5cc){logger[_0x4ca8('0x33')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x12e5cc['label']));if(!this[_0x4ca8('0x88')](_0x12e5cc[_0x4ca8('0x12b')])||!this[_0x4ca8('0x88')](_0x12e5cc[_0x4ca8('0x8b')])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')](_0x4ca8('0x131'));}if(!this[_0x4ca8('0x88')](_0x12e5cc[_0x4ca8('0x132')])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')](_0x4ca8('0x133'));}if(!this[_0x4ca8('0x88')](_0x12e5cc[_0x4ca8('0x5f')])){return this[_0x4ca8('0x10')]['noop']('no\x20text\x20configured');}this[_0x4ca8('0x10')][_0x4ca8('0xf1')]=!![];this['createSquareDetailsReport'](_0x12e5cc);this['createSquareMessage'](_0x12e5cc[_0x4ca8('0x5f')],'in','','');this[_0x4ca8('0x10')][_0x4ca8('0xae')](util['format'](_0x4ca8('0x134'),_0x12e5cc['text']));var _0x3cb049=this[_0x4ca8('0x90')][_0x4ca8('0xab')](this,_0x12e5cc);if(_0x3cb049){for(var _0x5adaa0 in _0x3cb049){if(_0x3cb049[_0x4ca8('0x9b')](_0x5adaa0)&&_[_0x4ca8('0x99')](_0x3cb049[_0x5adaa0])){this[_0x4ca8('0x10')][_0x4ca8('0xa9')](util['format'](_0x4ca8('0x135'),_0x5adaa0[_0x4ca8('0x6d')]()),_0x3cb049[_0x5adaa0]);}}if(_['isNil'](_0x3cb049[_0x4ca8('0x136')])){return this[_0x4ca8('0x10')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x4ca8('0x46')](_0x3cb049[_0x4ca8('0x136')],_0x4ca8('0xf4'),_0x4ca8('0x137'),'');return this[_0x4ca8('0x10')][_0x4ca8('0xae')](util['format'](_0x4ca8('0x138'),_0x3cb049['message']));}}return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x12e5cc,_0x4ca8('0x139'));};AGIVertices[_0x4ca8('0x12')]['googleasr']=function(_0xff08c0){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0x13a'),_0xff08c0['label'],_0xff08c0[_0x4ca8('0x6a')]));if(!this[_0x4ca8('0x88')](_0xff08c0[_0x4ca8('0x7d')])){return this['channel']['noop'](_0x4ca8('0xf0'));}var _0x440201=_0x4ca8('0x13b');var _0x3060d7=util['format'](_0x4ca8('0x13c'),FILES_PATH,rs[_0x4ca8('0x122')](0x4));var _0xb95d01=util[_0x4ca8('0x56')]('%s.%s',_0x3060d7,_0x440201);var _0x597b94=!![];if(_0xff08c0['beep']===_0x4ca8('0x13d')){_0x597b94=![];}var _0x30745b=this[_0x4ca8('0x10')][_0x4ca8('0x13e')](_0x3060d7,_0x440201,_0xff08c0[_0x4ca8('0x13f')],_0xff08c0[_0x4ca8('0x6a')],undefined,_0x597b94);if(_0x30745b['result']!==-0x1){this['channel'][_0x4ca8('0xae')](util[_0x4ca8('0x56')](_0x4ca8('0x140'),_0xb95d01));var _0x6e29c=this['googleASR'][_0x4ca8('0xab')](this,_0xff08c0,_0xb95d01);if(_0x6e29c){for(var _0x5f1167 in _0x6e29c){if(_0x6e29c[_0x4ca8('0x9b')](_0x5f1167)){this[_0x4ca8('0x10')][_0x4ca8('0xa9')](util[_0x4ca8('0x56')](_0x4ca8('0x141'),_0x5f1167[_0x4ca8('0x6d')]()),_0x6e29c[_0x5f1167]);}}return this[_0x4ca8('0x10')][_0x4ca8('0xae')](util[_0x4ca8('0x56')](_0x4ca8('0x142'),JSON['stringify'](_0x6e29c)));}}return _0x30745b;};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x143')]=function(_0x3a10b3){logger[_0x4ca8('0x33')](util['format'](_0x4ca8('0x144'),_0x3a10b3[_0x4ca8('0x3b')]));if(!this[_0x4ca8('0x88')](_0x3a10b3['appid'])){return this['channel'][_0x4ca8('0xae')](_0x4ca8('0x145'));}if(!this['isConfigured'](_0x3a10b3[_0x4ca8('0x95')])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')](_0x4ca8('0x146'));}var _0x58efce=_0x4ca8('0x13b');var _0x5f0c2a=util[_0x4ca8('0x56')](_0x4ca8('0x13c'),FILES_PATH,rs[_0x4ca8('0x122')](0x4));var _0x3b364f=util[_0x4ca8('0x56')]('%s.%s',_0x5f0c2a,_0x58efce);var _0x30fd6e=!![];if(_0x3a10b3['beep']==='NOBEEP'){_0x30fd6e=![];}var _0x43c295=this['channel'][_0x4ca8('0x13e')](_0x5f0c2a,_0x58efce,_0x3a10b3[_0x4ca8('0x13f')],_0x3a10b3[_0x4ca8('0x6a')],undefined,_0x30fd6e);if(_0x43c295[_0x4ca8('0xa7')]!==-0x1){this[_0x4ca8('0x10')]['noop'](util[_0x4ca8('0x56')]('tilde\x20%s\x20file\x20created',_0x3b364f));var _0x13371a=this['tildeASR'][_0x4ca8('0xab')](this,_0x3a10b3,_0x3b364f);if(_0x13371a){for(var _0x303aa1 in _0x13371a){if(_0x13371a[_0x4ca8('0x9b')](_0x303aa1)){this[_0x4ca8('0x10')][_0x4ca8('0xa9')](util[_0x4ca8('0x56')](_0x4ca8('0x147'),_0x303aa1[_0x4ca8('0x6d')]()),_0x13371a[_0x303aa1]);}}return this[_0x4ca8('0x10')][_0x4ca8('0xae')](util['format'](_0x4ca8('0x148'),JSON['stringify'](_0x13371a)));}}return _0x43c295;};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x149')]=function(_0x1c1b56){logger['info'](util[_0x4ca8('0x56')](_0x4ca8('0x14a'),_0x1c1b56[_0x4ca8('0x3b')]));return this[_0x4ca8('0x10')][_0x4ca8('0x14b')](_0x1c1b56[_0x4ca8('0x40')],_0x1c1b56['extension'],_0x1c1b56[_0x4ca8('0x42')]);};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x14c')]=function(_0x121f83){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0x14d'),_0x121f83[_0x4ca8('0x3b')]));if(!this['isConfigured'](_0x121f83[_0x4ca8('0x14e')])){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x121f83,_0x4ca8('0x14f'));}try{var _0x15ca62=eval(_0x121f83[_0x4ca8('0x14e')])?'true':_0x4ca8('0x150');this[_0x4ca8('0x10')][_0x4ca8('0xae')](util[_0x4ca8('0x56')]('EVAL\x20CONDITION\x20%s\x20%s',_0x121f83[_0x4ca8('0x14e')],_0x15ca62));return{'code':0xc8,'result':_0x15ca62};}catch(_0x20eef0){return{'code':0xc8,'result':_0x4ca8('0x150')};}};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x151')]=function(_0x3a9eea){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0x152'),_0x3a9eea['label']));if(!this[_0x4ca8('0x88')](_0x3a9eea['interval_id'])){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x3a9eea,_0x4ca8('0x153'));}var _0x23d678=this[_0x4ca8('0x154')][_0x4ca8('0xab')](this,_0x3a9eea[_0x4ca8('0x155')]);if(!_0x23d678){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x3a9eea,_0x4ca8('0x156'));}for(var _0x1f1ce7=0x0;_0x1f1ce7<_0x23d678['length'];_0x1f1ce7+=0x1){var _0x66d230=this[_0x4ca8('0x10')][_0x4ca8('0x13')](util['format'](_0x4ca8('0x157'),_0x23d678[_0x1f1ce7]));if(_0x66d230['result']===-0x1){return _0x66d230;}logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0x158'),_0x23d678[_0x1f1ce7],_0x66d230[_0x4ca8('0xa5')]));if(_0x66d230[_0x4ca8('0xa5')]===_0x4ca8('0x159')){logger['info'](util[_0x4ca8('0x56')](_0x4ca8('0x158'),_0x23d678[_0x1f1ce7],_0x4ca8('0x159')));this[_0x4ca8('0x10')]['noop'](util[_0x4ca8('0x56')](_0x4ca8('0x158'),_0x23d678[_0x1f1ce7],_0x4ca8('0x159')));return{'code':0xc8,'result':_0x4ca8('0x159')};}else{logger['info'](util[_0x4ca8('0x56')](_0x4ca8('0x158'),_0x23d678[_0x1f1ce7],_0x4ca8('0x150')));this['channel'][_0x4ca8('0xae')](util['format']('IFTIME\x20%s\x20%s',_0x23d678[_0x1f1ce7],'false'));}}return{'code':0xc8,'result':_0x4ca8('0x150')};};AGIVertices[_0x4ca8('0x12')]['hangup']=function(_0x21d9b6){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x21d9b6[_0x4ca8('0x3b')]));return this[_0x4ca8('0x10')][_0x4ca8('0x15a')]();};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x15b')]=function(_0xbca42d){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0x15c'),_0xbca42d[_0x4ca8('0x3b')]));if(!this[_0x4ca8('0x88')](_0xbca42d['key'])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')](_0x4ca8('0xf0'));}var _0x2a7b4a=_0x4ca8('0x13b');var _0x5a52a6=util[_0x4ca8('0x56')](_0x4ca8('0x13c'),FILES_PATH,rs['generate'](0x4));var _0x1579bb=util[_0x4ca8('0x56')](_0x4ca8('0x9f'),_0x5a52a6,_0x2a7b4a);var _0x306c9c=!![];if(_0xbca42d[_0x4ca8('0x15d')]===_0x4ca8('0x13d')){_0x306c9c=![];}var _0x51d746=this[_0x4ca8('0x10')][_0x4ca8('0x13e')](_0x5a52a6,_0x2a7b4a,_0xbca42d['intKey'],_0xbca42d[_0x4ca8('0x6a')],undefined,_0x306c9c);if(_0x51d746[_0x4ca8('0xa7')]!==-0x1){this[_0x4ca8('0x10')]['noop'](util['format'](_0x4ca8('0x15e'),_0x1579bb));var _0x355f90=this[_0x4ca8('0x86')][_0x4ca8('0xab')](this,_0xbca42d,_0x1579bb);if(_0x355f90){for(var _0x712b1c in _0x355f90){if(_0x355f90[_0x4ca8('0x9b')](_0x712b1c)){this[_0x4ca8('0x10')][_0x4ca8('0xa9')](util[_0x4ca8('0x56')](_0x4ca8('0x15f'),_0x712b1c[_0x4ca8('0x6d')]()),_0x355f90[_0x712b1c]);}}return this[_0x4ca8('0x10')][_0x4ca8('0xae')](util[_0x4ca8('0x56')](_0x4ca8('0x160'),JSON[_0x4ca8('0x76')](_0x355f90)));}}return _0x51d746;};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x161')]=function(_0x3f4847){logger[_0x4ca8('0x33')](util['format'](_0x4ca8('0x162'),_0x3f4847[_0x4ca8('0x3b')]));if(!this[_0x4ca8('0x88')](_0x3f4847[_0x4ca8('0x7d')])){return this['channel'][_0x4ca8('0xae')](_0x4ca8('0xf0'));}if(!this['isConfigured'](_0x3f4847[_0x4ca8('0x5f')])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')]('no\x20text\x20configured');}this[_0x4ca8('0x10')]['noop'](util[_0x4ca8('0x56')]('Trying\x20ispeech\x20TTS\x20%s',_0x3f4847[_0x4ca8('0x5f')]));var _0x3152ad=this['ispeechTTS'][_0x4ca8('0xab')](this,_0x3f4847);if(_0x3152ad){this[_0x4ca8('0x10')][_0x4ca8('0xae')](util[_0x4ca8('0x56')](_0x4ca8('0x15e'),_0x3152ad));var _0x169833=this[_0x4ca8('0x10')]['streamFile'](_0x3152ad,_0x3f4847['intKey']);try{fs['unlink'](_0x3152ad+_0x4ca8('0x10b'));}catch(_0x58f789){logger['error'](_0x58f789);}return _0x169833;}return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x3f4847,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x163')]=function(_0x334183){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0x164'),_0x334183[_0x4ca8('0x3b')]));if(!this['isConfigured'](_0x334183[_0x4ca8('0x165')])){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x334183,'no\x20find\x20by\x20configured');}logger[_0x4ca8('0x33')](util['format'](_0x4ca8('0x166'),this[_0x4ca8('0x10')][_0x4ca8('0x3c')],_0x334183[_0x4ca8('0x165')]));var _0x223e0f=this[_0x4ca8('0x54')][_0x4ca8('0xab')](this,_0x334183[_0x4ca8('0x165')]);if(_0x223e0f){logger['info'](util['format'](_0x4ca8('0x167'),this[_0x4ca8('0x10')][_0x4ca8('0x3c')],_0x334183[_0x4ca8('0x165')]));this[_0x4ca8('0x10')][_0x4ca8('0xae')](util['format'](_0x4ca8('0x167'),this[_0x4ca8('0x10')][_0x4ca8('0x3c')],_0x334183[_0x4ca8('0x165')]));return{'code':0xc8,'result':'success'};}else{logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0x168'),this[_0x4ca8('0x10')][_0x4ca8('0x3c')],_0x334183['findBy']));this[_0x4ca8('0x10')]['noop'](util[_0x4ca8('0x56')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4ca8('0x10')][_0x4ca8('0x3c')],_0x334183[_0x4ca8('0x165')]));return{'code':0xc8,'result':_0x4ca8('0x169')};}};AGIVertices['prototype']['logout']=function(_0x567612){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0x16a'),_0x567612[_0x4ca8('0x3b')]));if(!this[_0x4ca8('0x88')](_0x567612[_0x4ca8('0x165')])){return this[_0x4ca8('0x10')]['error'](_0x567612,_0x4ca8('0x16b'));}logger['info'](util[_0x4ca8('0x56')](_0x4ca8('0x166'),this[_0x4ca8('0x10')][_0x4ca8('0x3c')],_0x567612[_0x4ca8('0x165')]));var _0x415858=this[_0x4ca8('0x53')][_0x4ca8('0xab')](this,_0x567612['findBy']);if(_0x415858){logger['info'](util[_0x4ca8('0x56')](_0x4ca8('0x167'),this[_0x4ca8('0x10')][_0x4ca8('0x3c')],_0x567612[_0x4ca8('0x165')]));this['channel'][_0x4ca8('0xae')](util[_0x4ca8('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4ca8('0x10')][_0x4ca8('0x3c')],_0x567612[_0x4ca8('0x165')]));return{'code':0xc8,'result':'success'};}else{logger[_0x4ca8('0x33')](util['format'](_0x4ca8('0x168'),this['channel']['callerid'],_0x567612[_0x4ca8('0x165')]));this[_0x4ca8('0x10')][_0x4ca8('0xae')](util[_0x4ca8('0x56')](_0x4ca8('0x168'),this[_0x4ca8('0x10')][_0x4ca8('0x3c')],_0x567612['findBy']));return{'code':0xc8,'result':_0x4ca8('0x169')};}};AGIVertices['prototype'][_0x4ca8('0x16c')]=function(_0x489e01){logger['info'](util[_0x4ca8('0x56')](_0x4ca8('0x16d'),_0x489e01['label']));if(!this['isConfigured'](_0x489e01[_0x4ca8('0x16e')])){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x489e01,_0x4ca8('0x16f'));}this['channel'][_0x4ca8('0xae')](util[_0x4ca8('0x56')](_0x4ca8('0x170'),_0x489e01[_0x4ca8('0x16e')]));var _0x3a4dc1=eval(_0x489e01[_0x4ca8('0x16e')]);if(!this[_0x4ca8('0x88')](_0x489e01[_0x4ca8('0xdf')])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')](_0x4ca8('0xe0'));}var _0x2f57da=this[_0x4ca8('0x13')][_0x4ca8('0xab')](this,_0x489e01[_0x4ca8('0xdf')]);if(!_0x2f57da){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x489e01,_0x4ca8('0xe1'));}if(_[_0x4ca8('0x9d')](_0x3a4dc1)){var _0x521543=this;_0x3a4dc1[_0x4ca8('0xe2')](function(_0x23923b,_0x674522){_0x521543[_0x4ca8('0x10')][_0x4ca8('0xa9')](util[_0x4ca8('0x56')](_0x4ca8('0x171'),_0x2f57da,_0x674522),_0x23923b);});return this['channel'][_0x4ca8('0xae')](util[_0x4ca8('0x56')]('variable\x20%s[key]\x20set',_0x2f57da));}else{return this[_0x4ca8('0x10')]['setVariable'](_0x2f57da,_0x3a4dc1);}};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0xe')]=function(_0x2fcc47){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0x172'),_0x2fcc47[_0x4ca8('0x3b')]));if(_0x2fcc47[_0x4ca8('0xac')]===0x0){return this['maxRetry'](_0x2fcc47);}_0x2fcc47[_0x4ca8('0xac')]-=0x1;if(!this[_0x4ca8('0x88')](_0x2fcc47[_0x4ca8('0x11a')])){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x2fcc47,_0x4ca8('0x11b'));}var _0x51dff0=this[_0x4ca8('0x22')][_0x4ca8('0xab')](this,_0x2fcc47[_0x4ca8('0x11a')]);if(!_0x51dff0){return this['channel'][_0x4ca8('0x2f')](_0x2fcc47,_0x4ca8('0x173'));}var _0xe62d34=this[_0x4ca8('0x10')][_0x4ca8('0x11c')](_0x51dff0,_0x2fcc47[_0x4ca8('0x11d')],_0x2fcc47['digit']);var _0x51d973=_0xe62d34[_0x4ca8('0xa7')];if(_0xe62d34[_0x4ca8('0xa7')]===-0x1){this[_0x4ca8('0x3a')][_0x4ca8('0xab')](this,_0x2fcc47,'-1');return _0xe62d34;}else if(_0xe62d34[_0x4ca8('0xa5')]==='timeout'){_0xe62d34['result']=_0xe62d34['result'][_0x4ca8('0xa3')]>0x0?_0xe62d34['result']:'t';}else if(_[_0x4ca8('0x48')](_0xe62d34['result'])){_0xe62d34[_0x4ca8('0xa7')]='#';_0x51d973='#';}if(!this[_0x4ca8('0x88')](_0x2fcc47['variable_id'])){this[_0x4ca8('0x10')][_0x4ca8('0xae')](_0x4ca8('0xe0'));}else{var _0x4a1beb=this[_0x4ca8('0x13')][_0x4ca8('0xab')](this,_0x2fcc47[_0x4ca8('0xdf')]);if(!_0x4a1beb){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x2fcc47,_0x4ca8('0xe1'));}this[_0x4ca8('0x10')][_0x4ca8('0xa9')](_0x4a1beb,_0x51d973);}this['createSquareDetailsReport']['sync'](this,_0x2fcc47,_0x51d973);return _0xe62d34;};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0xae')]=function(_0x5e0a97){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0x174'),_0x5e0a97[_0x4ca8('0x3b')]));return this[_0x4ca8('0x10')]['noop'](_0x5e0a97[_0x4ca8('0x175')]||_0x5e0a97['label']);};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x176')]=function(_0x531b03){logger['info'](util[_0x4ca8('0x56')](_0x4ca8('0x177'),_0x531b03[_0x4ca8('0x3b')]));if(!this['isConfigured'](_0x531b03['findBy'])){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x531b03,'no\x20find\x20by\x20configured');}logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x4ca8('0x10')][_0x4ca8('0x3c')],_0x531b03[_0x4ca8('0x165')]));var _0x312561=this[_0x4ca8('0x4f')][_0x4ca8('0xab')](this,_0x531b03['pause_id']);var _0x29d337=this[_0x4ca8('0x50')]['sync'](this,_0x531b03['findBy'],_0x312561);if(_0x29d337){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x531b03[_0x4ca8('0x165')]));this[_0x4ca8('0x10')][_0x4ca8('0xae')](util[_0x4ca8('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4ca8('0x10')][_0x4ca8('0x3c')],_0x531b03[_0x4ca8('0x165')]));return{'code':0xc8,'result':_0x4ca8('0x178')};}else{logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4ca8('0x10')]['callerid'],_0x531b03[_0x4ca8('0x165')]));this[_0x4ca8('0x10')]['noop'](util[_0x4ca8('0x56')](_0x4ca8('0x167'),this[_0x4ca8('0x10')][_0x4ca8('0x3c')],_0x531b03['findBy']));return{'code':0xc8,'result':_0x4ca8('0x169')};}};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x179')]=function(_0x211ada){logger[_0x4ca8('0x33')](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x211ada[_0x4ca8('0x3b')]));if(!this[_0x4ca8('0x88')](_0x211ada['file_id'])){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x211ada,'no\x20file\x20audio\x20selected');}var _0x17aeaa=this['getSound'][_0x4ca8('0xab')](this,_0x211ada[_0x4ca8('0x11a')]);if(!_0x17aeaa){return this[_0x4ca8('0x10')]['error'](_0x211ada,_0x4ca8('0x173'));}var _0x41088b=this[_0x4ca8('0x10')][_0x4ca8('0x5a')](_0x4ca8('0x17a'),[_0x17aeaa,_0x211ada[_0x4ca8('0xed')]]);if(_0x41088b[_0x4ca8('0xa7')]===-0x1){return _0x41088b;}return this[_0x4ca8('0x10')]['noop'](util[_0x4ca8('0x56')](_0x4ca8('0xcc'),_0x4ca8('0x17a'),_0x17aeaa));};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x17b')]=function(_0x25ba23){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x25ba23['label']));if(!this[_0x4ca8('0x88')](_0x25ba23[_0x4ca8('0x17c')])){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x25ba23,_0x4ca8('0x17d'));}var _0x34f94e='';var _0x3a7be7=parseInt(_0x25ba23['queue_id'],0xa);if(isNaN(_0x3a7be7)){_0x34f94e=_0x25ba23[_0x4ca8('0x17c')];}else{_0x34f94e=this['getVoiceQueue'][_0x4ca8('0xab')](this,_0x25ba23[_0x4ca8('0x17c')]);if(!_0x34f94e){return this['channel']['error'](_0x25ba23,_0x4ca8('0x17e'));}}var _0x5d99c8='';if(this[_0x4ca8('0x88')](_0x25ba23[_0x4ca8('0x11a')])){var _0x31c4fc=this[_0x4ca8('0x22')]['sync'](this,_0x25ba23[_0x4ca8('0x11a')]);if(_0x31c4fc){_0x5d99c8=_0x31c4fc;}}this[_0x4ca8('0x3a')][_0x4ca8('0xab')](this,_0x25ba23,_0x34f94e);if(_0x25ba23['opts'][_0x4ca8('0x17f')]('x')<0x0){_0x25ba23[_0x4ca8('0xed')]+='x';}if(_0x25ba23[_0x4ca8('0xed')][_0x4ca8('0x17f')]('X')<0x0){_0x25ba23['opts']+='X';}this[_0x4ca8('0x10')][_0x4ca8('0xa9')]('XMCS-QUEUE',_0x34f94e?_0x34f94e[_0x4ca8('0x180')]():'');var _0x51505f=this[_0x4ca8('0x10')]['exec'](_0x4ca8('0x181'),[_0x34f94e,_0x25ba23[_0x4ca8('0xed')],_0x25ba23[_0x4ca8('0x68')],_0x5d99c8,_0x25ba23[_0x4ca8('0x6a')],_0x25ba23['agi'],_0x25ba23[_0x4ca8('0x182')],_0x25ba23[_0x4ca8('0x183')],'',_0x25ba23[_0x4ca8('0x184')]]);if(_0x51505f['result']===-0x1){return _0x51505f;}return this[_0x4ca8('0x10')]['noop'](util['format'](_0x4ca8('0xcc'),'QUEUE',_0x34f94e));};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x185')]=function(_0x25c65f){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x25c65f[_0x4ca8('0x3b')]));var _0x46f8d5=_0x25c65f[_0x4ca8('0x186')]||_0x4ca8('0x13b');var _0x338c72=util[_0x4ca8('0x56')](_0x4ca8('0x187'),this[_0x4ca8('0x10')][_0x4ca8('0x3e')],rs[_0x4ca8('0x122')](0x5));var _0x29ce82=util['format'](_0x4ca8('0x188'),FILES_PATH,_0x338c72,_0x46f8d5);var _0x174f57=util[_0x4ca8('0x56')]('%s/recordings/%s',FILES_PATH,_0x338c72);this[_0x4ca8('0x3d')][_0x4ca8('0xab')](this,_0x25c65f,_0x338c72,_0x29ce82);this[_0x4ca8('0x10')][_0x4ca8('0xa9')](_0x4ca8('0x189'),_0x338c72);logger[_0x4ca8('0x33')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x174f57,_0x46f8d5,_0x25c65f[_0x4ca8('0x18a')],_0x25c65f[_0x4ca8('0x6a')]);return this[_0x4ca8('0x10')][_0x4ca8('0x13e')](_0x174f57,_0x46f8d5,_0x25c65f['escape_digits'],_0x25c65f['timeout'],undefined,!![]);};AGIVertices['prototype'][_0x4ca8('0x18b')]=function(_0x41cede){logger[_0x4ca8('0x33')](util['format'](_0x4ca8('0x18c'),_0x41cede[_0x4ca8('0x3b')]));if(!this[_0x4ca8('0x88')](_0x41cede['url'])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')](_0x4ca8('0x18d'));}var _0x10ba5d=this[_0x4ca8('0x67')][_0x4ca8('0xab')](this,_0x41cede);logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0x18e'),util[_0x4ca8('0x18f')](_0x10ba5d,{'showHidden':![],'depth':null})));if(!this[_0x4ca8('0x88')](_0x41cede[_0x4ca8('0xdf')])){return this['channel'][_0x4ca8('0xae')](_0x4ca8('0x190'));}var _0x544c3c=this[_0x4ca8('0x13')][_0x4ca8('0xab')](this,_0x41cede[_0x4ca8('0xdf')]);if(!_0x544c3c){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x41cede,_0x4ca8('0xe1'));}this['channel'][_0x4ca8('0xa9')](util[_0x4ca8('0x56')](_0x4ca8('0x191'),_0x544c3c),_0x10ba5d[_0x4ca8('0x78')]?_0x10ba5d[_0x4ca8('0x78')]:_0x4ca8('0x192'));this['channel'][_0x4ca8('0xa9')](util[_0x4ca8('0x56')]('%s_STATUS_MESSAGE',_0x544c3c),_0x10ba5d[_0x4ca8('0x79')]?_0x10ba5d[_0x4ca8('0x79')]:'OK');if(_0x10ba5d[_0x4ca8('0x6e')]){try{this[_0x4ca8('0xa0')](_0x10ba5d[_0x4ca8('0x6e')],_0x544c3c);}catch(_0x3a9f7f){logger[_0x4ca8('0x2f')](util['format'](_0x4ca8('0x193'),_0x544c3c));}}return this['channel'][_0x4ca8('0xae')](util['format'](_0x4ca8('0x194'),_0x544c3c));};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x195')]=function(_0x361058){logger[_0x4ca8('0x33')](util['format'](_0x4ca8('0x196'),_0x361058[_0x4ca8('0x3b')]));return this[_0x4ca8('0x10')][_0x4ca8('0x197')](_0x361058['digits'][_0x4ca8('0xdd')](/\s+/g,''),_0x361058[_0x4ca8('0x18a')]);};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x198')]=function(_0x3f2d49){logger[_0x4ca8('0x33')](util['format'](_0x4ca8('0x199'),_0x3f2d49[_0x4ca8('0x3b')]));return this[_0x4ca8('0x10')]['sayNumber'](_0x3f2d49[_0x4ca8('0x69')][_0x4ca8('0xdd')](/\s+/g,''),_0x3f2d49['escape_digits']);};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x19a')]=function(_0x1fd1b8){logger[_0x4ca8('0x33')](util['format'](_0x4ca8('0x19b'),_0x1fd1b8['label']));return this[_0x4ca8('0x10')][_0x4ca8('0x19c')](_0x1fd1b8[_0x4ca8('0x5f')],_0x1fd1b8[_0x4ca8('0x18a')]);};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x19d')]=function(_0x12a509){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0x19e'),_0x12a509['label']));if(!this[_0x4ca8('0x88')](_0x12a509[_0x4ca8('0x19f')])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')]('no\x20mail\x20account\x20configured');}var _0x591761=this[_0x4ca8('0x25')][_0x4ca8('0xab')](this,_0x12a509[_0x4ca8('0x19f')]);if(!_0x591761||!_0x591761[_0x4ca8('0x1a0')]){return this[_0x4ca8('0x10')]['error'](_0x12a509,_0x4ca8('0x1a1'));}var _0x1e25e4={'from':util[_0x4ca8('0x56')](_0x4ca8('0x1a2'),_0x591761[_0x4ca8('0x19')],_0x591761[_0x4ca8('0x1a3')]||_0x591761[_0x4ca8('0x1a0')][_0x4ca8('0x1a4')]),'to':_0x12a509['to']||'','cc':_0x12a509['cc']||'','bcc':_0x12a509[_0x4ca8('0x1a5')]||'','subject':_0x12a509[_0x4ca8('0x1a6')],'html':_0x12a509[_0x4ca8('0x5f')],'text':_0x12a509[_0x4ca8('0x5f')]};var _0x3709fa={'tls':{'rejectUnauthorized':![]}};if(_0x591761[_0x4ca8('0x1a0')][_0x4ca8('0x1a7')]){_0x3709fa[_0x4ca8('0x1a7')]=_0x591761[_0x4ca8('0x1a0')][_0x4ca8('0x1a7')];}else{_0x3709fa[_0x4ca8('0x1a8')]=_0x591761[_0x4ca8('0x1a0')][_0x4ca8('0x1a8')];_0x3709fa[_0x4ca8('0x1a9')]=_0x591761['Smtp'][_0x4ca8('0x1a9')];_0x3709fa[_0x4ca8('0x1aa')]=_0x591761[_0x4ca8('0x1a0')][_0x4ca8('0x1aa')];}if(_0x591761[_0x4ca8('0x1a0')]['authentication']){_0x3709fa[_0x4ca8('0x1ab')]={'user':_0x591761[_0x4ca8('0x1a0')][_0x4ca8('0x1a4')],'pass':_0x591761['Smtp'][_0x4ca8('0x1ac')]};}if(this['isConfigured'](_0x12a509[_0x4ca8('0x1ad')])){}logger[_0x4ca8('0xe7')](_0x4ca8('0x1ae'),JSON[_0x4ca8('0x76')](_0x1e25e4));this[_0x4ca8('0x3a')]['sync'](this,_0x12a509,_0x12a509[_0x4ca8('0x19f')]);this['channel'][_0x4ca8('0xae')](util[_0x4ca8('0x56')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x591761[_0x4ca8('0x19')]));this[_0x4ca8('0x27')]['sync'](this,_0x3709fa,_0x1e25e4);return this[_0x4ca8('0x10')][_0x4ca8('0xae')](_0x4ca8('0x1af'));};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x1b0')]=function(_0x4380d8){logger['info'](util[_0x4ca8('0x56')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x4380d8[_0x4ca8('0x3b')]));return this[_0x4ca8('0x10')][_0x4ca8('0xae')](_0x4ca8('0x1b1'));};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x1b2')]=function(_0x4f7f8e){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0x1b3'),_0x4f7f8e[_0x4ca8('0x3b')]));if(!this[_0x4ca8('0x88')](_0x4f7f8e[_0x4ca8('0x1b4')])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')](_0x4ca8('0x1b5'));}var _0x5b9b63=this['getSmsAccount'][_0x4ca8('0xab')](this,_0x4f7f8e[_0x4ca8('0x1b4')]);if(!_0x5b9b63){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x4f7f8e,_0x4ca8('0x1b6'));}var _0x3e78b6={'body':_0x4f7f8e[_0x4ca8('0x1b7')],'phone':_0x4f7f8e['to']||'','SmsAccountId':_0x5b9b63['id']};logger['debug']('sendSMS\x20message',JSON[_0x4ca8('0x76')](_0x3e78b6));this[_0x4ca8('0x3a')][_0x4ca8('0xab')](this,_0x4f7f8e,_0x4f7f8e[_0x4ca8('0x1b4')]);this[_0x4ca8('0x10')]['noop'](util[_0x4ca8('0x56')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x5b9b63[_0x4ca8('0x19')]));this[_0x4ca8('0x39')][_0x4ca8('0xab')](this,_0x3e78b6);return this[_0x4ca8('0x10')][_0x4ca8('0xae')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x4ca8('0x1b8')]=function(_0x322e1a){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0x1b9'),_0x322e1a['label']));if(!this[_0x4ca8('0x88')](_0x322e1a[_0x4ca8('0xdf')])){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x322e1a,_0x4ca8('0x1ba'));}var _0x4f8714=this[_0x4ca8('0x13')][_0x4ca8('0xab')](this,_0x322e1a['variable_id']);if(!_0x4f8714){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x322e1a,_0x4ca8('0xe1'));}return this['channel'][_0x4ca8('0xa9')](_0x4f8714,_0x322e1a[_0x4ca8('0x1bb')]);};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x1bc')]=function(_0x104655){logger['info'](util[_0x4ca8('0x56')](_0x4ca8('0x1bd'),_0x104655[_0x4ca8('0x3b')]));this[_0x4ca8('0x10')]['noop'](_0x4ca8('0x1be'));if(_0x104655[_0x4ca8('0xc1')]===_0x4ca8('0x1bf')){this['channel']['noop'](_0x4ca8('0x1c0'));return this[_0x4ca8('0x10')]['answer']();}return this[_0x4ca8('0x10')][_0x4ca8('0xae')](_0x4ca8('0x1c1'));};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x1c2')]=function(_0x3f89f5){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x3f89f5[_0x4ca8('0x3b')]));if(!this['isConfigured'](_0x3f89f5[_0x4ca8('0x1c3')])){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x3f89f5,_0x4ca8('0x1c4'));}var _0x241082=this['getSquareProject'][_0x4ca8('0xab')](this,_0x3f89f5['project_id']);if(!this[_0x4ca8('0x88')](_0x241082)){return this['channel'][_0x4ca8('0x2f')](_0x3f89f5,util[_0x4ca8('0x56')](_0x4ca8('0x1c5'),_0x3f89f5[_0x4ca8('0x1c3')]));}if(_0x241082===this[_0x4ca8('0x10')]['arg_1']){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x3f89f5,_0x4ca8('0x1c6'));}this[_0x4ca8('0x3a')][_0x4ca8('0xab')](this,_0x3f89f5,_0x241082);var _0x464f41=this['channel'][_0x4ca8('0x5a')](_0x4ca8('0x1c7'),util[_0x4ca8('0x56')](_0x4ca8('0x1c8'),config['agi']['host']||'127.0.0.1',_0x241082,this[_0x4ca8('0x10')][_0x4ca8('0x45')]));if(_0x464f41[_0x4ca8('0xa7')]===-0x1){return _0x464f41;}return this[_0x4ca8('0x10')][_0x4ca8('0xae')](util[_0x4ca8('0x56')](_0x4ca8('0xcc'),_0x4ca8('0x1c7'),_0x241082));};AGIVertices['prototype']['system']=function(_0x2bacc3){logger['info'](util[_0x4ca8('0x56')](_0x4ca8('0x1c9'),_0x2bacc3[_0x4ca8('0x3b')]));var _0x4f400f=this[_0x4ca8('0x59')]['sync'](this,_0x2bacc3[_0x4ca8('0xbf')]);this[_0x4ca8('0x3a')]['sync'](this,_0x2bacc3,_0x2bacc3[_0x4ca8('0xbf')]);if(this[_0x4ca8('0x88')](_0x2bacc3[_0x4ca8('0xdf')])){var _0x1129c5=this['getVariable'][_0x4ca8('0xab')](this,_0x2bacc3['variable_id']);if(_0x1129c5){this[_0x4ca8('0x10')][_0x4ca8('0xa9')](_0x1129c5,_0x4f400f);return this[_0x4ca8('0x10')]['noop'](util[_0x4ca8('0x56')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x2bacc3[_0x4ca8('0xbf')],_0x1129c5));}}return this['channel'][_0x4ca8('0xae')](util[_0x4ca8('0x56')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x2bacc3[_0x4ca8('0xbf')]));};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x1ca')]=function(_0x403307){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0x1cb'),_0x403307['label']));_0x403307[_0x4ca8('0x5f')]=_0x403307[_0x4ca8('0x5f')][_0x4ca8('0xdd')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x403307[_0x4ca8('0x5d')])){return this[_0x4ca8('0x10')]['noop'](_0x4ca8('0x1cc'));}if(!this[_0x4ca8('0x88')](_0x403307[_0x4ca8('0x5f')])){return this[_0x4ca8('0x10')][_0x4ca8('0xae')](_0x4ca8('0xaf'));}this['channel']['noop'](util[_0x4ca8('0x56')](_0x4ca8('0x1cd'),_0x403307['text']));var _0x30feb6=this[_0x4ca8('0x5c')]['sync'](this,_0x403307);if(_0x30feb6){this[_0x4ca8('0x10')][_0x4ca8('0xae')](util[_0x4ca8('0x56')](_0x4ca8('0x1ce'),_0x30feb6));var _0x2b5809=this['channel'][_0x4ca8('0x12d')](_0x30feb6);try{fs[_0x4ca8('0x12e')](_0x30feb6+_0x4ca8('0x10b'));}catch(_0x11deff){logger[_0x4ca8('0x2f')](_0x11deff);}return _0x2b5809;}return this['channel'][_0x4ca8('0x2f')](_0x403307,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x1cf')]=function(_0x18544e){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0x1d0'),_0x18544e['label']));_0x18544e[_0x4ca8('0x5f')]=_0x18544e[_0x4ca8('0x5f')][_0x4ca8('0xdd')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4ca8('0x88')](_0x18544e[_0x4ca8('0x5f')])){return this['channel'][_0x4ca8('0xae')]('no\x20text\x20configured');}this[_0x4ca8('0x10')]['noop'](util['format'](_0x4ca8('0x1d1'),_0x18544e[_0x4ca8('0x5f')]));var _0x1feade=this['googleTTS'][_0x4ca8('0xab')](this,_0x18544e);if(_0x1feade){this[_0x4ca8('0x10')][_0x4ca8('0xae')](util[_0x4ca8('0x56')]('Google\x20TTS\x20%s\x20file\x20created',_0x1feade));var _0x48d22f=this[_0x4ca8('0x10')][_0x4ca8('0x12d')](_0x1feade);try{fs[_0x4ca8('0x12e')](_0x1feade+_0x4ca8('0x10b'));}catch(_0x1b3057){logger[_0x4ca8('0x2f')](_0x1b3057);}return _0x48d22f;}return this['channel'][_0x4ca8('0x2f')](_0x18544e,_0x4ca8('0x1d2'));};AGIVertices[_0x4ca8('0x12')][_0x4ca8('0x1d3')]=function(_0x1980f1){logger[_0x4ca8('0x33')](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x1980f1[_0x4ca8('0x3b')]));if(!this[_0x4ca8('0x88')](_0x1980f1[_0x4ca8('0x165')])){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x1980f1,_0x4ca8('0x16b'));}logger['info'](util[_0x4ca8('0x56')](_0x4ca8('0x166'),this[_0x4ca8('0x10')][_0x4ca8('0x3c')],_0x1980f1[_0x4ca8('0x165')]));var _0x41c654=this[_0x4ca8('0x52')][_0x4ca8('0xab')](this,_0x1980f1[_0x4ca8('0x165')]);if(_0x41c654){logger['info'](util[_0x4ca8('0x56')](_0x4ca8('0x167'),this['channel'][_0x4ca8('0x3c')],_0x1980f1[_0x4ca8('0x165')]));this[_0x4ca8('0x10')][_0x4ca8('0xae')](util[_0x4ca8('0x56')](_0x4ca8('0x167'),this[_0x4ca8('0x10')][_0x4ca8('0x3c')],_0x1980f1[_0x4ca8('0x165')]));return{'code':0xc8,'result':'success'};}else{logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0x168'),this[_0x4ca8('0x10')][_0x4ca8('0x3c')],_0x1980f1['findBy']));this['channel'][_0x4ca8('0xae')](util[_0x4ca8('0x56')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4ca8('0x10')][_0x4ca8('0x3c')],_0x1980f1[_0x4ca8('0x165')]));return{'code':0xc8,'result':_0x4ca8('0x169')};}};AGIVertices['prototype'][_0x4ca8('0x1d4')]=function(_0x514a2e){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0x1d5'),_0x514a2e[_0x4ca8('0x3b')]));var _0x4284ba=this['channel']['exec'](_0x4ca8('0x1d6'),[_0x514a2e[_0x4ca8('0x1d7')],_0x514a2e[_0x4ca8('0x7b')]]);if(_0x4284ba['result']===-0x1){return _0x4284ba;}return this[_0x4ca8('0x10')][_0x4ca8('0xae')](util['format']('Executed\x20command\x20%s\x20%s',_0x4ca8('0x1d6'),_0x514a2e[_0x4ca8('0x1d7')]));};AGIVertices[_0x4ca8('0x12')]['vswitch']=function(_0x17278b){logger[_0x4ca8('0x33')](util[_0x4ca8('0x56')](_0x4ca8('0x1d8'),_0x17278b[_0x4ca8('0x3b')]));if(!this[_0x4ca8('0x88')](_0x17278b[_0x4ca8('0xdf')])){return this[_0x4ca8('0x10')]['error'](_0x17278b,_0x4ca8('0x1ba'));}var _0x1dd52f=this[_0x4ca8('0x13')][_0x4ca8('0xab')](this,_0x17278b[_0x4ca8('0xdf')]);if(!_0x1dd52f){return this[_0x4ca8('0x10')][_0x4ca8('0x2f')](_0x17278b,'no\x20variable\x20found');}var _0x58dca8=this[_0x4ca8('0x10')][_0x4ca8('0x13')](_0x1dd52f);return{'code':0xc8,'result':_0x58dca8[_0x4ca8('0xa5')]?_0x58dca8[_0x4ca8('0xa5')]:'-'};};String['prototype'][_0x4ca8('0xa4')]=function(_0x29b400,_0xc9f2c1){return this[_0x4ca8('0xa2')](_0x29b400)['join'](_0xc9f2c1);};module[_0x4ca8('0x1d9')]=AGIVertices; \ No newline at end of file +var _0x0e4b=['dialogflowV2_project_id','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','.wav','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','wav','%s/recordings/%s','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','beep','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','no\x20variable\x20found','isArray','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','file_id','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','toLowerCase','QUEUE','macro','position','record','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','saydigits','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','Smtp','service','host','port','secure','authentication','auth','template_id','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','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','yes','Answer','Skipped\x20Answer','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','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','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','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','lodash','odbc','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','file','createCmContact','isEmpty','callback_','random','lastName','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','agentUnpause','isNil','agentLogout','agent','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','audioEncoding','MP3','googleTTS','restAPI','url','method','timeout','includes','POST','body','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','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','key','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','length','recursiveNodeIndex','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','toString','getAndSetVariable','result','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','createSquareMessage','Trying\x20Dialogflow:\x20%s','googleDialogflow','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block'];(function(_0x5baf61,_0x4903bd){var _0x1b2132=function(_0x1e8320){while(--_0x1e8320){_0x5baf61['push'](_0x5baf61['shift']());}};_0x1b2132(++_0x4903bd);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x57bd16,_0x32bfe2){_0x57bd16=_0x57bd16-0x0;var _0x3cca09=_0x0e4b[_0x57bd16];return _0x3cca09;};'use strict';var fs=require('fs');var path=require(_0xb0e4('0x0'));var util=require(_0xb0e4('0x1'));var _=require(_0xb0e4('0x2'));var sh=require('shelljs');var odbc=require(_0xb0e4('0x3'))();var rs=require('randomstring');var moment=require('moment');var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0xb0e4('0x4'))(_0xb0e4('0x5'));var config=require('../../config/environment');var scripts=require(_0xb0e4('0x6'));var FILES_PATH=_0xb0e4('0x7');var recursiveMapAttributes=[_0xb0e4('0x8'),_0xb0e4('0x9')];var verticesWithRetry=[_0xb0e4('0xa'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x101860,_0x9d4a99,_0x1d6452){this[_0xb0e4('0xb')]=_0x101860;this[_0xb0e4('0xc')]=_0x9d4a99;this[_0xb0e4('0xd')]=_0x1d6452;};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0xf')]=function(_0x38019d,_0x397bf3){this[_0xb0e4('0xc')][_0xb0e4('0x10')](_0x38019d)[_0xb0e4('0x11')](function(_0x3fdf0f){_0x397bf3(null,_0x3fdf0f?_0x3fdf0f[_0xb0e4('0x12')]:![]);})['catch'](function(_0x190a90){_0x397bf3(_0x190a90);});};AGIVertices[_0xb0e4('0xe')]['getVoiceQueue']=function(_0x39fbf7,_0x26f664){this[_0xb0e4('0xc')][_0xb0e4('0x13')](_0x39fbf7)[_0xb0e4('0x11')](function(_0x57ba9d){_0x26f664(null,_0x57ba9d?_0x57ba9d['name']:![]);})[_0xb0e4('0x14')](function(_0x3a140c){_0x26f664(_0x3a140c);});};AGIVertices['prototype'][_0xb0e4('0x15')]=function(_0x376d1f,_0xc12df2){this[_0xb0e4('0xc')][_0xb0e4('0x16')](_0x376d1f)[_0xb0e4('0x11')](function(_0x570886){_0xc12df2(null,_0x570886?_0x570886['name']:![]);})['catch'](function(_0x42e43d){_0xc12df2(_0x42e43d);});};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x17')]=function(_0x690682,_0x2ce0c6){this[_0xb0e4('0xc')]['getSquareOdbcById'](_0x690682)[_0xb0e4('0x11')](function(_0x459684){_0x2ce0c6(null,_0x459684?_0x459684[_0xb0e4('0x18')]:![]);})[_0xb0e4('0x14')](function(_0x4bbb10){_0x2ce0c6(_0x4bbb10);});};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x19')]=function(_0x52b55e,_0x2663f3){this[_0xb0e4('0xc')][_0xb0e4('0x1a')](_0x52b55e)['then'](function(_0x1a6810){_0x2663f3(null,_0x1a6810?_0x1a6810['name']:![]);})['catch'](function(_0x21276c){_0x2663f3(_0x21276c);});};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x1b')]=function(_0x26420c,_0x13781c){this[_0xb0e4('0xc')][_0xb0e4('0x1c')](_0x26420c)['then'](function(_0x28ed88){_0x13781c(null,_0x28ed88?_0x28ed88['name']:![]);})[_0xb0e4('0x14')](function(_0x22033f){_0x13781c(_0x22033f);});};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x1d')]=function(_0x4fc624,_0x1ed356){var _0x2ccef1=this;this[_0xb0e4('0xc')][_0xb0e4('0x1e')](_0x4fc624)[_0xb0e4('0x11')](function(_0x5c0ad0){_0x1ed356(null,_0x5c0ad0?_0x2ccef1[_0xb0e4('0x1f')](_0x5c0ad0[_0xb0e4('0x20')]):![]);})['catch'](function(_0x1d5ba8){_0x1ed356(_0x1d5ba8);});};AGIVertices['prototype'][_0xb0e4('0x21')]=function(_0x3a08f6,_0x50cef9){this[_0xb0e4('0xc')][_0xb0e4('0x22')](_0x3a08f6)[_0xb0e4('0x11')](function(_0x2694ea){_0x50cef9(null,_0x2694ea?_0x2694ea:![]);})[_0xb0e4('0x14')](function(_0x3313c6){_0x50cef9(_0x3313c6);});};AGIVertices['prototype'][_0xb0e4('0x23')]=function(_0x57339c,_0x5b3d93,_0x311ce3){this['mailRpc'][_0xb0e4('0x23')](_0x57339c,_0x5b3d93)['then'](function(){_0x311ce3(null);})[_0xb0e4('0x14')](function(_0x52373a){_0x311ce3(_0x52373a);});};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x24')]=function(_0x404793,_0x5dd765){this[_0xb0e4('0xc')]['getIntervalById'](_0x404793)[_0xb0e4('0x11')](function(_0x2d3e83){if(_0x2d3e83){if(_0x2d3e83[_0xb0e4('0x25')]){_0x5dd765(null,[_0x2d3e83[_0xb0e4('0x26')]]);}else{_0x5dd765(null,_[_0xb0e4('0x27')](_0x2d3e83['Intervals'],_0xb0e4('0x26')));}}else{_0x5dd765(null,![]);}})['catch'](function(_0x276328){_0x5dd765(_0x276328);});};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x1f')]=function(_0x5451f2){return util[_0xb0e4('0x28')](_0xb0e4('0x29'),FILES_PATH,_0x5451f2);};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x2a')]=function(_0x4fec45,_0x4b6f58,_0x4af7f6){odbc['open'](_0x4fec45,function(_0x16812e){if(_0x16812e){logger['error'](_0xb0e4('0x2b'),_0x16812e);_0x4af7f6(_0x16812e);}else{logger['info'](_0xb0e4('0x2c'));odbc['query'](_0x4b6f58,function(_0x5d4af8,_0x222c3b){if(_0x5d4af8){logger[_0xb0e4('0x2d')](_0xb0e4('0x2e'),_0x4b6f58);_0x4af7f6(_0x5d4af8);}else{logger['info'](_0xb0e4('0x2f'),_0x4b6f58);odbc[_0xb0e4('0x30')](function(_0x5dc154){if(_0x5dc154){logger[_0xb0e4('0x31')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x5dc154);}_0x4af7f6(null,_0x222c3b);});}});}});};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x32')]=function(_0x4ab8fa,_0x43f7e0){this['rpc']['getSmsAccountById'](_0x4ab8fa)['then'](function(_0x114098){_0x43f7e0(null,_0x114098?_0x114098:![]);})[_0xb0e4('0x14')](function(_0x5d2d60){_0x43f7e0(_0x5d2d60);});};AGIVertices[_0xb0e4('0xe')]['createSmsMessage']=function(_0x3a26ec,_0x10dbdc){this[_0xb0e4('0xc')][_0xb0e4('0x33')](_0x3a26ec)['then'](function(_0x610856){_0x10dbdc(null,_0x610856);})[_0xb0e4('0x14')](function(_0x1a524b){_0x10dbdc(_0x1a524b);});};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x34')]=function(_0x3c9e8a,_0x3f3983,_0xd1fec){this[_0xb0e4('0xc')][_0xb0e4('0x34')]({'uniqueid':this[_0xb0e4('0xb')][_0xb0e4('0x35')],'node':_0x3c9e8a[_0xb0e4('0x36')],'application':_0x3c9e8a[_0xb0e4('0x37')],'data':_0x3f3983||null,'project_name':this[_0xb0e4('0xb')][_0xb0e4('0x38')],'callerid':this['channel'][_0xb0e4('0x39')]})[_0xb0e4('0x11')](function(_0x44403f){if(_0xd1fec){_0xd1fec(null,_0x44403f);}})[_0xb0e4('0x14')](function(_0x4b3ec2){if(_0xd1fec){_0xd1fec(_0x4b3ec2);}});};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x3a')]=function(_0x56ff92,_0x28a484,_0x2c1c5c,_0x47107e){this[_0xb0e4('0xc')]['createSquareRecording']({'uniqueid':this[_0xb0e4('0xb')][_0xb0e4('0x35')],'callerid':this[_0xb0e4('0xb')][_0xb0e4('0x39')],'calleridname':this[_0xb0e4('0xb')][_0xb0e4('0x3b')],'context':this[_0xb0e4('0xb')][_0xb0e4('0x3c')],'extension':this[_0xb0e4('0xb')][_0xb0e4('0x3d')],'priority':this[_0xb0e4('0xb')]['priority'],'accountcode':this[_0xb0e4('0xb')][_0xb0e4('0x3e')],'dnid':this['channel']['dnid'],'projectName':this['channel'][_0xb0e4('0x38')],'saveName':_0x28a484,'filename':_0x56ff92[_0xb0e4('0x3f')]||_0x28a484,'savePath':_0x2c1c5c})['then'](function(_0x484d19){_0x47107e(null,_0x484d19);})['catch'](function(_0x54963f){_0x47107e(_0x54963f);});};AGIVertices['prototype']['createSquareMessage']=function(_0x3809c6,_0x52f7c5,_0x17c18c,_0x3c0ce3,_0x463709){this[_0xb0e4('0xc')]['createSquareMessage']({'uniqueid':this[_0xb0e4('0xb')][_0xb0e4('0x35')],'body':_0x3809c6,'direction':_0x52f7c5,'providerName':_0x17c18c,'providerResponse':_0x3c0ce3})['then'](function(_0xc1246c){if(_0x463709){_0x463709(null,_0xc1246c);}})['catch'](function(_0x4467df){if(_0x463709){_0x463709(_0x4467df);}});};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x40')]=function(_0x2e2b07,_0x4b1d48){this[_0xb0e4('0xc')][_0xb0e4('0x40')]({'firstName':_[_0xb0e4('0x41')](_0x2e2b07[_0xb0e4('0x12')])||_['isNil'](_0x2e2b07[_0xb0e4('0x12')])?_0xb0e4('0x42')+Math[_0xb0e4('0x43')]():_0x2e2b07['name'],'lastName':_['isEmpty'](_0x2e2b07['lastName'])||_['isNil'](_0x2e2b07['lastName'])?null:_0x2e2b07[_0xb0e4('0x44')],'phone':_0x2e2b07['phone'],'ListId':_0x2e2b07[_0xb0e4('0x45')],'scheduledat':_0x2e2b07[_0xb0e4('0x46')],'callbackUniqueid':this[_0xb0e4('0xb')][_0xb0e4('0x35')],'tags':'callback','description':_0xb0e4('0x47')+_0x2e2b07[_0xb0e4('0x46')]['toString'](),'priority':_0x2e2b07[_0xb0e4('0x48')]})['then'](function(_0x2a2b9d){_0x4b1d48(null,_0x2a2b9d);})[_0xb0e4('0x14')](function(_0xe3250d){_0x4b1d48(_0xe3250d);});};AGIVertices['prototype'][_0xb0e4('0x49')]=function(_0x363b2f,_0x5bf6e1){this[_0xb0e4('0xc')][_0xb0e4('0x4a')](_0x363b2f)['then'](function(_0x4d0a0d){_0x5bf6e1(null,_0x4d0a0d?_0x4d0a0d[_0xb0e4('0x12')]:![]);})[_0xb0e4('0x14')](function(_0x2aefeb){_0x5bf6e1(_0x2aefeb);});};AGIVertices['prototype'][_0xb0e4('0x4b')]=function(_0xf318df,_0x55db3f,_0x313801){var _0x32d5b7={'role':'agent'};_0x32d5b7[_0xf318df]=this[_0xb0e4('0xb')][_0xb0e4('0x39')];this[_0xb0e4('0xc')]['agentPause'](_0x32d5b7,_0x55db3f,this[_0xb0e4('0xb')][_0xb0e4('0x35')])[_0xb0e4('0x11')](function(_0x40c288){_0x313801(null,_['isNil'](_0x40c288)?![]:!![]);})[_0xb0e4('0x14')](function(_0x4ab061){logger[_0xb0e4('0x31')](_0x4ab061);_0x313801(null,![]);});};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x4c')]=function(_0x1a6254,_0x30150c){var _0x5473d7={'role':'agent'};_0x5473d7[_0x1a6254]=this[_0xb0e4('0xb')][_0xb0e4('0x39')];this[_0xb0e4('0xc')][_0xb0e4('0x4c')](_0x5473d7)[_0xb0e4('0x11')](function(_0x2e63b9){_0x30150c(null,_[_0xb0e4('0x4d')](_0x2e63b9)?![]:!![]);})[_0xb0e4('0x14')](function(_0xf035a2){logger[_0xb0e4('0x31')](_0xf035a2);_0x30150c(null,![]);});};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x4e')]=function(_0x341276,_0x1fd1cc){var _0xd3115a={'role':_0xb0e4('0x4f')};_0xd3115a[_0x341276]=this['channel']['callerid'];this[_0xb0e4('0xc')][_0xb0e4('0x4e')](_0xd3115a)[_0xb0e4('0x11')](function(_0x3a7d66){_0x1fd1cc(null,_[_0xb0e4('0x4d')](_0x3a7d66)?![]:!![]);})['catch'](function(_0x572e39){logger[_0xb0e4('0x31')](_0x572e39);_0x1fd1cc(null,![]);});};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x50')]=function(_0x54f614,_0x939ff0){var _0x2764ce={'role':'agent'};_0x2764ce[_0x54f614]=this['channel'][_0xb0e4('0x39')];var _0x553f4d=_0x54f614!=_0xb0e4('0x51')?util[_0xb0e4('0x28')](_0xb0e4('0x52'),_0xb0e4('0x53'),this[_0xb0e4('0xb')][_0xb0e4('0x39')]):undefined;this[_0xb0e4('0xc')][_0xb0e4('0x50')](_0x2764ce,_0x553f4d)[_0xb0e4('0x11')](function(_0x414367){_0x939ff0(null,_[_0xb0e4('0x4d')](_0x414367)?![]:!![]);})['catch'](function(_0x2b3fb8){logger[_0xb0e4('0x31')](_0x2b3fb8);_0x939ff0(null,![]);});};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x54')]=function(_0x19d326,_0x2700af){sh[_0xb0e4('0x55')](_[_0xb0e4('0x56')](_0x19d326),function(_0x4aae28,_0x1e418f){var _0xffe7f=_0x1e418f[_0xb0e4('0x57')](/(\r\n|\n|\r)/gm,'');_0x2700af(null,_0xffe7f);});};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x58')]=function(_0x1172e3,_0x18325e){scripts[_0xb0e4('0x58')](_0x1172e3[_0xb0e4('0x59')],_0x1172e3['google_cloud_tts_text_type']||_0xb0e4('0x5a'),_0x1172e3['text'],_0x1172e3[_0xb0e4('0x5b')]||'en-US',_0x1172e3['ssmlGender']||'MALE',_0x1172e3[_0xb0e4('0x5c')]||_0xb0e4('0x5d'))[_0xb0e4('0x11')](function(_0x282398){_0x18325e(null,_0x282398);})[_0xb0e4('0x14')](function(_0x157d14){_0x18325e(_0x157d14);});};AGIVertices[_0xb0e4('0xe')]['googleTTS']=function(_0x3603b4,_0x5a0ada){scripts[_0xb0e4('0x5e')](_0x3603b4['text'],_0x3603b4['google_tts_language']||'en',0x1)[_0xb0e4('0x11')](function(_0x536fc5){_0x5a0ada(null,_0x536fc5);})['catch'](function(_0x1ac0b5){_0x5a0ada(_0x1ac0b5);});};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x5f')]=function(_0x1ca5d5,_0x567866){var _0x193a35={'uri':_0x1ca5d5[_0xb0e4('0x60')],'method':_0x1ca5d5[_0xb0e4('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x1ca5d5['timeout'])==='number'&&parseInt(_0x1ca5d5[_0xb0e4('0x62')])>=0x1?parseInt(_0x1ca5d5[_0xb0e4('0x62')])*0x3e8:0x5*0x3e8};if(_[_0xb0e4('0x63')]([_0xb0e4('0x64'),'PUT'],_0x193a35[_0xb0e4('0x61')]['toUpperCase']())){try{_0x193a35[_0xb0e4('0x65')]=_0x1ca5d5[_0xb0e4('0x9')]?JSON[_0xb0e4('0x66')](_0x1ca5d5[_0xb0e4('0x9')]):{};}catch(_0x1ed180){logger[_0xb0e4('0x31')](_0xb0e4('0x67'),_0x1ed180);}}try{_0x193a35['headers']=_0x1ca5d5[_0xb0e4('0x8')]?JSON[_0xb0e4('0x66')](_0x1ca5d5[_0xb0e4('0x8')]):{};}catch(_0x2a370a){logger[_0xb0e4('0x31')](_0xb0e4('0x68'),_0x2a370a);}if(_0x1ca5d5[_0xb0e4('0x69')]){try{var _0x367469=require(_0x1ca5d5[_0xb0e4('0x69')])[_0xb0e4('0x6a')](this,_0x193a35);_0x193a35[_0xb0e4('0x6b')]=Mustache[_0xb0e4('0x6c')](_0x1ca5d5['url'],_0x367469,{},['$$','$$']);if(_0x193a35[_0xb0e4('0x6d')]){_0x193a35[_0xb0e4('0x6d')]=JSON[_0xb0e4('0x66')](Mustache['render'](JSON[_0xb0e4('0x6e')](_0x193a35[_0xb0e4('0x6d')]),_0x367469,{},['$$','$$']));}if(_0x193a35[_0xb0e4('0x65')]){_0x193a35[_0xb0e4('0x65')]=JSON[_0xb0e4('0x66')](Mustache[_0xb0e4('0x6c')](JSON[_0xb0e4('0x6e')](_0x193a35['body']),_0x367469,{},['$$','$$']));}}catch(_0x5b5960){logger['error'](_0xb0e4('0x6f'),_0x5b5960);}}rp(_0x193a35)[_0xb0e4('0x11')](function(_0x3fd79a){var _0x1ad4c6={'statusCode':_0x3fd79a[_0xb0e4('0x70')]||0xc8,'statusMessage':_0x3fd79a[_0xb0e4('0x71')]||'OK','headers':_0x3fd79a[_0xb0e4('0x6d')]||{},'body':_0x3fd79a[_0xb0e4('0x65')]||{}};_0x567866(null,_0x1ad4c6);})[_0xb0e4('0x14')](function(_0xdd477d){var _0x433ea4={'statusCode':_0xdd477d[_0xb0e4('0x70')]||0x1f4,'statusMessage':_0xdd477d[_0xb0e4('0x72')]||_0xb0e4('0x73'),'headers':_0xdd477d[_0xb0e4('0x74')][_0xb0e4('0x6d')]||{},'body':_0xdd477d['options'][_0xb0e4('0x65')]||{}};_0x567866(null,_0x433ea4);});};AGIVertices[_0xb0e4('0xe')]['googleDialogflow']=function(_0x172369,_0x2d5b62){scripts['googleDialogflow'](this[_0xb0e4('0xb')][_0xb0e4('0x35')],_0x172369[_0xb0e4('0x75')],_0x172369['text'],_0x172369[_0xb0e4('0x76')]||'en')[_0xb0e4('0x11')](function(_0x451b3f){_0x2d5b62(null,_0x451b3f);})[_0xb0e4('0x14')](function(_0x5409af){_0x2d5b62(_0x5409af);});};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x77')]=function(_0x47e242,_0x22d455){scripts[_0xb0e4('0x77')](this[_0xb0e4('0xb')][_0xb0e4('0x35')],_0x47e242['dialogflowV2_project_id'],_0x47e242[_0xb0e4('0x78')],_0x47e242[_0xb0e4('0x79')],_0x47e242[_0xb0e4('0x5a')],_0x47e242[_0xb0e4('0x7a')]||'en')[_0xb0e4('0x11')](function(_0x171cbe){_0x22d455(null,_0x171cbe);})[_0xb0e4('0x14')](function(_0x57db87){_0x22d455(_0x57db87);});};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x7b')]=function(_0x4a51e4,_0x289951){scripts['sestekNDA'](this[_0xb0e4('0xb')],_0x4a51e4)[_0xb0e4('0x11')](function(_0x57175e){_0x289951(null,_0x57175e);})[_0xb0e4('0x14')](function(_0x24b0b0){_0x289951(_0x24b0b0);});};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x7c')]=function(_0x1de291,_0x1be0f3){scripts[_0xb0e4('0x7c')](_0x1de291[_0xb0e4('0x75')],_0x1de291[_0xb0e4('0x5a')],_0x1de291[_0xb0e4('0x7d')]||_0xb0e4('0x7e'),_0x1de291['speed'])[_0xb0e4('0x11')](function(_0x2d92a2){_0x1be0f3(null,_0x2d92a2);})[_0xb0e4('0x14')](function(_0x473aa7){_0x1be0f3(_0x473aa7);});};AGIVertices['prototype']['ispeechASR']=function(_0x1e3edf,_0x35f8af,_0xf404fa){scripts[_0xb0e4('0x7f')](_0x35f8af,_0x1e3edf[_0xb0e4('0x75')],_0x1e3edf[_0xb0e4('0x80')]||_0xb0e4('0x7e'),this[_0xb0e4('0x81')](_0x1e3edf['model'])?_0x1e3edf[_0xb0e4('0x82')]:undefined)[_0xb0e4('0x11')](function(_0x55cee9){_0xf404fa(null,_0x55cee9);})['catch'](function(_0x57da72){_0xf404fa(_0x57da72);});};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x83')]=function(_0x3035b7,_0x5b65bc){scripts[_0xb0e4('0x83')](_0x3035b7[_0xb0e4('0x84')],_0x3035b7[_0xb0e4('0x85')],_0x3035b7[_0xb0e4('0x86')],_0x3035b7[_0xb0e4('0x87')]||'Amy',_0x3035b7['text'],_0x3035b7['aws_text_type']||_0xb0e4('0x5a'))['then'](function(_0x301445){_0x5b65bc(null,_0x301445);})[_0xb0e4('0x14')](function(_0xe0b486){_0x5b65bc(_0xe0b486);});};AGIVertices[_0xb0e4('0xe')]['awsLex']=function(_0x560e9b,_0x207a78){scripts[_0xb0e4('0x88')](this[_0xb0e4('0xb')][_0xb0e4('0x35')],_0x560e9b[_0xb0e4('0x84')],_0x560e9b[_0xb0e4('0x85')],_0x560e9b[_0xb0e4('0x89')],_0x560e9b[_0xb0e4('0x5a')],_0x560e9b[_0xb0e4('0x8a')])[_0xb0e4('0x11')](function(_0x1bf6eb){_0x207a78(null,_0x1bf6eb);})['catch'](function(_0x5518a9){_0x207a78(_0x5518a9);});};AGIVertices['prototype'][_0xb0e4('0x8b')]=function(_0x3676cc,_0x2ff592,_0x5a2bf3){scripts['googleASR'](_0x2ff592,_0x3676cc[_0xb0e4('0x75')],_0x3676cc[_0xb0e4('0x8c')]||_0xb0e4('0x7e'))['then'](function(_0x226961){_0x5a2bf3(null,_0x226961);})[_0xb0e4('0x14')](function(_0x3aaf9f){_0x5a2bf3(_0x3aaf9f);});};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x8d')]=function(_0x3957bb,_0x137f23,_0x281468){scripts[_0xb0e4('0x8d')](_0x137f23,_0x3957bb['appid'],_0x3957bb[_0xb0e4('0x8e')],_0x3957bb[_0xb0e4('0x6b')])[_0xb0e4('0x11')](function(_0x50a438){_0x281468(null,_0x50a438);})['catch'](function(_0x35840a){_0x281468(_0x35840a);});};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x8f')]=function(_0x465ab1){var _0x1d859b=_[_0xb0e4('0x63')](verticesWithRetry,_0x465ab1['agicommand'])?_0x465ab1:_[_0xb0e4('0x90')](_0x465ab1);for(var _0x42b334 in _0x1d859b){if(_0x1d859b[_0xb0e4('0x91')](_0x42b334)){if(_0x1d859b[_0x42b334]&&_[_0xb0e4('0x92')](_0x1d859b[_0x42b334])){if(_[_0xb0e4('0x63')](recursiveMapAttributes,_0x42b334)){_0x1d859b[_0x42b334]=this[_0xb0e4('0x93')](_0x1d859b[_0x42b334]);}else{_0x1d859b[_0x42b334]=this[_0xb0e4('0x94')](_0x1d859b[_0x42b334]);}}}}return _0x1d859b;};AGIVertices[_0xb0e4('0xe')]['recursiveNodeIndex']=function(_0x6216f5){for(var _0x19b97b in _0x6216f5){if(_0x6216f5[_0xb0e4('0x91')](_0x19b97b)){if(_[_0xb0e4('0x95')](_0x6216f5[_0x19b97b])){this['recursiveNodeIndex'](_0x6216f5[_0x19b97b]);}else if(_['isArray'](_0x6216f5[_0x19b97b])){for(var _0x6e38b9=0x0;_0x6e38b9<_0x6216f5[_0x19b97b][_0xb0e4('0x96')];_0x6e38b9++){this[_0xb0e4('0x97')](_0x6216f5[_0x19b97b][_0x6e38b9]);}}else if(_[_0xb0e4('0x92')](_0x6216f5[_0x19b97b])){_0x6216f5[_0x19b97b]=this[_0xb0e4('0x94')](_0x6216f5[_0x19b97b]);}}}};AGIVertices[_0xb0e4('0xe')]['saveRestApiResult']=function(_0x48305f,_0x5d12af){for(var _0x299c50 in _0x48305f){if(_0x48305f['hasOwnProperty'](_0x299c50)){if(_[_0xb0e4('0x95')](_0x48305f[_0x299c50])){if(!_['isEmpty'](_0x48305f[_0x299c50])){this[_0xb0e4('0x98')](_0x48305f[_0x299c50],util[_0xb0e4('0x28')](_0xb0e4('0x99'),_0x5d12af,_0x299c50));}}else if(_['isArray'](_0x48305f[_0x299c50])){for(var _0x5776c5=0x0;_0x5776c5<_0x48305f[_0x299c50][_0xb0e4('0x96')];_0x5776c5++){this['saveRestApiResult'](_0x48305f[_0x299c50][_0x5776c5],util[_0xb0e4('0x28')](_0xb0e4('0x99'),_0x5d12af,_0x299c50+'['+_0x5776c5+']'));}}else{if(!_['isNil'](_0x48305f[_0x299c50])){this[_0xb0e4('0xb')][_0xb0e4('0x9a')](util[_0xb0e4('0x28')]('%s.%s',_0x5d12af,_0x299c50),_0x48305f[_0x299c50]);}}}}};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x93')]=function(_0x39e20a){try{var _0x3f197c=JSON[_0xb0e4('0x66')](_0x39e20a);this[_0xb0e4('0x97')](_0x3f197c);return JSON[_0xb0e4('0x6e')](_0x3f197c);}catch(_0x1e81a3){return this[_0xb0e4('0x94')](_0x39e20a);}};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x94')]=function(_0x1a7d8a){var _0x1210b9=_0x1a7d8a['split']('{');for(var _0x2c135c=0x1;_0x2c135c<_0x1210b9[_0xb0e4('0x96')];_0x2c135c+=0x1){var _0x5dac5=_0x1210b9[_0x2c135c][_0xb0e4('0x9b')]('}');if(_0x5dac5['length']>0x1){_0x1a7d8a=_0x1a7d8a[_0xb0e4('0x9c')]('{'+_0x5dac5[0x0]+'}',this[_0xb0e4('0xb')][_0xb0e4('0xf')](_0x5dac5[0x0])[_0xb0e4('0x9d')]||_0x5dac5[0x0]);}}if(_0x1210b9[_0xb0e4('0x96')]===0x1){return _0x1a7d8a[_0xb0e4('0x9e')]();}return this[_0xb0e4('0x94')](_0x1a7d8a);};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x9f')]=function(_0x5d5924,_0x35b29c){var _0xb1b5be=this[_0xb0e4('0xb')][_0xb0e4('0xf')](_0x5d5924);if(_0xb1b5be[_0xb0e4('0xa0')]===-0x1){return _0xb1b5be;}logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x35b29c,_0xb1b5be[_0xb0e4('0x9d')]));return this['channel'][_0xb0e4('0x9a')](_0x35b29c,_0xb1b5be[_0xb0e4('0x9d')]);};AGIVertices[_0xb0e4('0xe')]['isConfigured']=function(_0x2d5dc0){return _0x2d5dc0&&_0x2d5dc0!=='0'&&_0x2d5dc0!=='-1'&&_0x2d5dc0!=='';};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0xa1')]=function(_0x13456e){this[_0xb0e4('0x34')]['sync'](this,_0x13456e,'-');_0x13456e[_0xb0e4('0xa2')]=_0x13456e[_0xb0e4('0xa1')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0xa3')]=function(_0x28578f){logger['info'](util['format'](_0xb0e4('0xa4'),_0x28578f['label']));if(!this[_0xb0e4('0x81')](_0x28578f[_0xb0e4('0x5a')])){return this[_0xb0e4('0xb')][_0xb0e4('0xa5')]('no\x20text\x20configured');}var _0x3b1df3='\x22'+_0x28578f['text']+'\x22';if(this[_0xb0e4('0x81')](_0x28578f[_0xb0e4('0x74')])){_0x3b1df3+=','+_0x28578f[_0xb0e4('0x74')];}var _0x1a35af=this[_0xb0e4('0xb')][_0xb0e4('0x55')]('MRCPSynth',_0x3b1df3);if(_0x1a35af[_0xb0e4('0xa0')]===-0x1){return _0x1a35af;}return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util[_0xb0e4('0x28')](_0xb0e4('0xa6'),_0x3b1df3));};AGIVertices['prototype']['mrcprecog']=function(_0x4a7928){logger[_0xb0e4('0x2d')](util['format'](_0xb0e4('0xa7'),_0x4a7928[_0xb0e4('0x36')]));if(!this[_0xb0e4('0x81')](_0x4a7928['grammar'])){return this[_0xb0e4('0xb')]['noop'](_0xb0e4('0xa8'));}var _0x26fb02=_0x4a7928[_0xb0e4('0xa9')];if(this[_0xb0e4('0x81')](_0x4a7928['options'])){_0x26fb02+=','+_0x4a7928['options'];}var _0x1caa18=this[_0xb0e4('0xb')][_0xb0e4('0x55')](_0xb0e4('0xaa'),_0x26fb02);if(_0x1caa18['result']===-0x1){return _0x1caa18;}var _0x42b6d7=this[_0xb0e4('0x9f')](_0xb0e4('0xab'),_0xb0e4('0xac'));if(_0x42b6d7['result']===-0x1){return _0x42b6d7;}var _0x530198=this[_0xb0e4('0x9f')](_0xb0e4('0xad'),'MRCP_RECOG_TRANSCRIPT');if(_0x530198[_0xb0e4('0xa0')]===-0x1){return _0x530198;}var _0x8931e=this[_0xb0e4('0x9f')](_0xb0e4('0xae'),_0xb0e4('0xaf'));if(_0x8931e[_0xb0e4('0xa0')]===-0x1){return _0x8931e;}return this[_0xb0e4('0xb')]['noop'](util[_0xb0e4('0x28')](_0xb0e4('0xb0'),_0x26fb02));};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x5')]=function(_0xa043d){logger[_0xb0e4('0x2d')](util['format'](_0xb0e4('0xb1'),_0xa043d['label']));return this['channel'][_0xb0e4('0x5')]([_0xa043d[_0xb0e4('0xb2')],_0xa043d['args']]);};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0xb3')]=function(_0x4987e3){logger[_0xb0e4('0x2d')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x4987e3[_0xb0e4('0x36')]));if(this[_0xb0e4('0x81')](_0x4987e3[_0xb0e4('0x62')])){logger['info'](util[_0xb0e4('0x28')](_0xb0e4('0xb4'),_0x4987e3[_0xb0e4('0x62')]));var _0x2128f5=this[_0xb0e4('0xb')][_0xb0e4('0xb5')](_0x4987e3[_0xb0e4('0x62')]);if(_0x2128f5['result']===-0x1){return _0x2128f5;}}return this[_0xb0e4('0xb')]['answer']();};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0xb6')]=function(_0x21ac09){logger[_0xb0e4('0x2d')](util['format'](_0xb0e4('0xb7'),_0x21ac09[_0xb0e4('0x36')]));if(!this['isConfigured'](_0x21ac09[_0xb0e4('0x45')])){return this['channel'][_0xb0e4('0x31')](_0x21ac09,_0xb0e4('0xb8'));}_0x21ac09[_0xb0e4('0x46')]=moment();if(this[_0xb0e4('0x81')](_0x21ac09[_0xb0e4('0xb9')])){_0x21ac09[_0xb0e4('0x46')]=moment()['add'](_0x21ac09[_0xb0e4('0xb9')],'minutes');}if(!this[_0xb0e4('0x81')](_0x21ac09[_0xb0e4('0x48')])){_0x21ac09['callback_priority']=0x2;}this[_0xb0e4('0x40')][_0xb0e4('0x6a')](this,_0x21ac09);return this[_0xb0e4('0xb')]['noop'](util[_0xb0e4('0x28')](_0xb0e4('0xba'),_0x21ac09[_0xb0e4('0xbb')],_0x21ac09['list_id'],_0x21ac09['scheduledAt']));};AGIVertices[_0xb0e4('0xe')]['custom_app']=function(_0x1dcea2){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x1dcea2[_0xb0e4('0x36')]));var _0x3c0197=this['channel'][_0xb0e4('0x55')](_0x1dcea2[_0xb0e4('0xbc')],_0x1dcea2[_0xb0e4('0x74')]);if(_0x3c0197[_0xb0e4('0xa0')]===-0x1){return _0x3c0197;}return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util['format'](_0xb0e4('0xbd'),_0x1dcea2[_0xb0e4('0xbc')],_0x1dcea2[_0xb0e4('0x74')]));};AGIVertices['prototype'][_0xb0e4('0xbe')]=function(_0x198f39){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0xbf'),_0x198f39['label']));if(!this[_0xb0e4('0x81')](_0x198f39[_0xb0e4('0x5a')])){return this[_0xb0e4('0xb')]['noop'](_0xb0e4('0xc0'));}var _0x1329a5='\x22'+_0x198f39[_0xb0e4('0x5a')]+'\x22';if(this[_0xb0e4('0x81')](_0x198f39['options'])){_0x1329a5+=','+_0x198f39[_0xb0e4('0x74')];}var _0x40dc98=this[_0xb0e4('0xb')][_0xb0e4('0x55')](_0xb0e4('0xc1'),_0x1329a5);if(_0x40dc98[_0xb0e4('0xa0')]===-0x1){return _0x40dc98;}return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util['format'](_0xb0e4('0xa6'),_0x1329a5));};AGIVertices[_0xb0e4('0xe')]['sestektts']=function(_0x58a779){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0xc2'),_0x58a779[_0xb0e4('0x36')]));if(!this[_0xb0e4('0x81')](_0x58a779[_0xb0e4('0x5a')])){return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](_0xb0e4('0xc0'));}var _0x1b6a61='\x22'+_0x58a779[_0xb0e4('0x5a')]+'\x22';if(this['isConfigured'](_0x58a779[_0xb0e4('0x74')])){_0x1b6a61+=','+_0x58a779[_0xb0e4('0x74')];}var _0x3409b0=this[_0xb0e4('0xb')]['exec'](_0xb0e4('0xc1'),_0x1b6a61);if(_0x3409b0[_0xb0e4('0xa0')]===-0x1){return _0x3409b0;}return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util['format'](_0xb0e4('0xa6'),_0x1b6a61));};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0xc3')]=function(_0x215e6a){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x215e6a[_0xb0e4('0x36')]));if(!this[_0xb0e4('0x81')](_0x215e6a[_0xb0e4('0xa9')])){return this['channel']['noop'](_0xb0e4('0xa8'));}var _0x45d06a=_0x215e6a[_0xb0e4('0xa9')];if(this[_0xb0e4('0x81')](_0x215e6a[_0xb0e4('0x74')])){_0x45d06a+=','+_0x215e6a[_0xb0e4('0x74')];}var _0xf861d2=this['channel'][_0xb0e4('0x55')](_0xb0e4('0xaa'),_0x45d06a);if(_0xf861d2[_0xb0e4('0xa0')]===-0x1){return _0xf861d2;}var _0x3a10e0=this[_0xb0e4('0x9f')]('RECOG_CONFIDENCE()',_0xb0e4('0xc4'));if(_0x3a10e0[_0xb0e4('0xa0')]===-0x1){return _0x3a10e0;}var _0x3e3d67=this['getAndSetVariable'](_0xb0e4('0xad'),_0xb0e4('0xc5'));if(_0x3e3d67['result']===-0x1){return _0x3e3d67;}var _0x21ba5d=this['getAndSetVariable'](_0xb0e4('0xae'),'LUMENVOX_ASR_INSTANCE');if(_0x21ba5d[_0xb0e4('0xa0')]===-0x1){return _0x21ba5d;}return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util[_0xb0e4('0x28')](_0xb0e4('0xb0'),_0x45d06a));};AGIVertices['prototype']['sestekasr']=function(_0x21ba1c){logger[_0xb0e4('0x2d')](util['format'](_0xb0e4('0xc6'),_0x21ba1c[_0xb0e4('0x36')]));if(!this[_0xb0e4('0x81')](_0x21ba1c[_0xb0e4('0xa9')])){return this['channel'][_0xb0e4('0xa5')]('no\x20grammar\x20configured');}var _0x46a4aa=_0x21ba1c[_0xb0e4('0xa9')];if(this[_0xb0e4('0x81')](_0x21ba1c[_0xb0e4('0x74')])){_0x46a4aa+=','+_0x21ba1c[_0xb0e4('0x74')];}var _0x58a2e1=this['channel']['exec'](_0xb0e4('0xaa'),_0x46a4aa);if(_0x58a2e1['result']===-0x1){return _0x58a2e1;}var _0xfe92a3=this[_0xb0e4('0x9f')](_0xb0e4('0xab'),'SESTEK_ASR_CONFIDENCE');if(_0xfe92a3['result']===-0x1){return _0xfe92a3;}var _0x31fd36=this[_0xb0e4('0x9f')]('RECOG_INPUT()',_0xb0e4('0xc7'));if(_0x31fd36[_0xb0e4('0xa0')]===-0x1){return _0x31fd36;}var _0x341924=this['getAndSetVariable'](_0xb0e4('0xae'),_0xb0e4('0xc8'));if(_0x341924[_0xb0e4('0xa0')]===-0x1){return _0x341924;}return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util[_0xb0e4('0x28')](_0xb0e4('0xb0'),_0x46a4aa));};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0xc9')]=function(_0x45514c){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0xca'),_0x45514c[_0xb0e4('0x36')]));if(!this[_0xb0e4('0x81')](_0x45514c[_0xb0e4('0xcb')])){return this['channel'][_0xb0e4('0x31')](_0x45514c,_0xb0e4('0xcc'));}var _0xed931a=this[_0xb0e4('0x17')][_0xb0e4('0x6a')](this,_0x45514c[_0xb0e4('0xcb')]);if(!_0xed931a){return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x45514c,_0xb0e4('0xcd'));}if(!this[_0xb0e4('0x81')](_0x45514c[_0xb0e4('0xce')])){return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x45514c,_0xb0e4('0xcf'));}var _0x55dd2c=_0x45514c[_0xb0e4('0xce')][_0xb0e4('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util[_0xb0e4('0x28')](_0xb0e4('0xd0'),_0x55dd2c));var _0x215401=this['getQueryOdbc'][_0xb0e4('0x6a')](this,_0xed931a,_0x55dd2c);this[_0xb0e4('0x34')][_0xb0e4('0x6a')](this,_0x45514c,_0x55dd2c);if(!this['isConfigured'](_0x45514c[_0xb0e4('0xd1')])){return this[_0xb0e4('0xb')]['noop'](_0xb0e4('0xd2'));}var _0x22eadf=this['getVariable']['sync'](this,_0x45514c[_0xb0e4('0xd1')]);if(!_0x22eadf){return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x45514c,'no\x20variable\x20found');}var _0x16a5a2=this;_0x215401[_0xb0e4('0xd3')](function(_0x461bb8,_0x2f457a){Object['keys'](_0x461bb8)[_0xb0e4('0xd3')](function(_0x736283){_0x16a5a2[_0xb0e4('0xb')][_0xb0e4('0x9a')](util[_0xb0e4('0x28')]('%s[%s][%s]',_0x22eadf,_0x2f457a,_0x736283),_0x461bb8[_0x736283]);});});this['channel'][_0xb0e4('0x9a')](util[_0xb0e4('0x28')]('%s_ROWS_COUNT',_0x22eadf),_0x215401[_0xb0e4('0x96')]);return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util[_0xb0e4('0x28')](_0xb0e4('0xd4'),_0x22eadf));};AGIVertices[_0xb0e4('0xe')]['dial']=function(_0x378de3){logger[_0xb0e4('0xd5')](util[_0xb0e4('0x28')](_0xb0e4('0xd6'),_0x378de3[_0xb0e4('0x36')]));if(!this['isConfigured'](_0x378de3[_0xb0e4('0xd7')])){return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x378de3,'no\x20user\x20selected');}var _0x15459a=this['getUser'][_0xb0e4('0x6a')](this,_0x378de3[_0xb0e4('0xd7')]);if(!_0x15459a){return this[_0xb0e4('0xb')]['error'](_0x378de3,_0xb0e4('0xd8'));}var _0x37b16d=this[_0xb0e4('0xb')][_0xb0e4('0x55')]('DIAL',[util[_0xb0e4('0x28')]('SIP/%s',_0x15459a),_0x378de3[_0xb0e4('0x62')],_0x378de3[_0xb0e4('0xd9')],_0x378de3[_0xb0e4('0x60')]]);if(_0x37b16d[_0xb0e4('0xa0')]===-0x1){return _0x37b16d;}return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util[_0xb0e4('0x28')](_0xb0e4('0xda'),_0xb0e4('0xdb')));};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0xdc')]=function(_0x41f248){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0xdd'),_0x41f248[_0xb0e4('0x36')]));if(!this['isConfigured'](_0x41f248[_0xb0e4('0x75')])){return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](_0xb0e4('0xde'));}if(!this['isConfigured'](_0x41f248[_0xb0e4('0x5a')])){return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](_0xb0e4('0xc0'));}this[_0xb0e4('0xb')]['bot']=!![];this['createSquareDetailsReport'](_0x41f248);this[_0xb0e4('0xdf')](_0x41f248[_0xb0e4('0x5a')],'in','','');this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util[_0xb0e4('0x28')](_0xb0e4('0xe0'),_0x41f248['text']));var _0x3d7119=this[_0xb0e4('0xe1')][_0xb0e4('0x6a')](this,_0x41f248);if(_0x3d7119){for(var _0xc273fd in _0x3d7119){if(_0x3d7119[_0xb0e4('0x91')](_0xc273fd)){this['channel'][_0xb0e4('0x9a')](util['format'](_0xb0e4('0xe2'),_0xc273fd[_0xb0e4('0xe3')]()),_0x3d7119[_0xc273fd]);}}this[_0xb0e4('0xdf')](_0x3d7119[_0xb0e4('0xe4')],_0xb0e4('0xe5'),_0xb0e4('0xdc'),'');return this['channel']['noop'](util[_0xb0e4('0x28')](_0xb0e4('0xe6'),_0x3d7119['speech']));}return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x41f248,_0xb0e4('0xe7'));};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0xe8')]=function(_0x156ae9){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0xe9'),_0x156ae9[_0xb0e4('0x36')]));if(!this[_0xb0e4('0x81')](_0x156ae9[_0xb0e4('0xea')])){return this[_0xb0e4('0xb')][_0xb0e4('0xa5')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x156ae9[_0xb0e4('0x78')])){return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](_0xb0e4('0xeb'));}if(!this[_0xb0e4('0x81')](_0x156ae9[_0xb0e4('0x79')])){return this['channel'][_0xb0e4('0xa5')](_0xb0e4('0xec'));}if(!this['isConfigured'](_0x156ae9[_0xb0e4('0x7a')])){return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](_0xb0e4('0xed'));}if(!this[_0xb0e4('0x81')](_0x156ae9[_0xb0e4('0x5a')])){return this['channel'][_0xb0e4('0xa5')](_0xb0e4('0xc0'));}this['channel'][_0xb0e4('0xee')]=!![];this[_0xb0e4('0x34')](_0x156ae9);this['createSquareMessage'](_0x156ae9[_0xb0e4('0x5a')],'in','','');this['channel'][_0xb0e4('0xa5')](util[_0xb0e4('0x28')](_0xb0e4('0xef'),_0x156ae9[_0xb0e4('0x5a')]));var _0x2cd857=this[_0xb0e4('0x77')][_0xb0e4('0x6a')](this,_0x156ae9);if(_0x2cd857){for(var _0x1adaed in _0x2cd857){if(_0x2cd857[_0xb0e4('0x91')](_0x1adaed)){if(_0x1adaed!==_0xb0e4('0xf0')){this[_0xb0e4('0xb')][_0xb0e4('0x9a')](util[_0xb0e4('0x28')]('DIALOGFLOW_%s',_0x1adaed[_0xb0e4('0xe3')]()),_0x2cd857[_0x1adaed]);}}}this[_0xb0e4('0xdf')](_0x2cd857[_0xb0e4('0xe4')],'out',_0xb0e4('0xe8'),_0x2cd857['providerResponse']);return this['channel']['noop'](util[_0xb0e4('0x28')](_0xb0e4('0xf1'),_0x2cd857[_0xb0e4('0xe4')]));}return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x156ae9,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0xf2')]=function(_0x3aef9a){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0xf3'),_0x3aef9a[_0xb0e4('0x36')]));if(!this[_0xb0e4('0x81')](_0x3aef9a[_0xb0e4('0xf4')])){return this['channel'][_0xb0e4('0xa5')](_0xb0e4('0xf5'));}if(!this['isConfigured'](_0x3aef9a[_0xb0e4('0xf6')])){return this['channel'][_0xb0e4('0xa5')](_0xb0e4('0xf7'));}if(!this['isConfigured'](_0x3aef9a[_0xb0e4('0xf8')])){return this[_0xb0e4('0xb')][_0xb0e4('0xa5')]('no\x20password\x20configured');}if(!this[_0xb0e4('0x81')](_0x3aef9a[_0xb0e4('0xf9')])){return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](_0xb0e4('0xc0'));}this['channel'][_0xb0e4('0xee')]=!![];this[_0xb0e4('0x34')](_0x3aef9a);this[_0xb0e4('0xdf')](_0x3aef9a[_0xb0e4('0x5a')],'in','','');this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util[_0xb0e4('0x28')](_0xb0e4('0xfa'),_0x3aef9a[_0xb0e4('0x5a')]));var _0x1cdb27=this[_0xb0e4('0x7b')][_0xb0e4('0x6a')](this,_0x3aef9a);if(_0x1cdb27){for(var _0x1c752d in _0x1cdb27){if(_0x1cdb27[_0xb0e4('0x91')](_0x1c752d)){this['channel'][_0xb0e4('0x9a')](util[_0xb0e4('0x28')](_0xb0e4('0xfb'),_0x1c752d[_0xb0e4('0xe3')]()),_0x1cdb27[_0x1c752d]);}}this[_0xb0e4('0xdf')](_0x1cdb27[_0xb0e4('0xe4')],_0xb0e4('0xe5'),_0xb0e4('0xf2'),'');if(_0x1cdb27['audiofile']){this['channel'][_0xb0e4('0xa5')](util['format'](_0xb0e4('0xfc'),_0x1cdb27[_0xb0e4('0xfd')]));var _0x2f9b00=this[_0xb0e4('0xb')][_0xb0e4('0xfe')](_0x1cdb27[_0xb0e4('0xfd')]);try{fs[_0xb0e4('0xff')](_0x1cdb27[_0xb0e4('0xfd')]+'.wav');}catch(_0x265a03){logger['error'](_0x265a03);}return _0x2f9b00;}else{return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util[_0xb0e4('0x28')](_0xb0e4('0x100'),_0x1cdb27[_0xb0e4('0xe4')]));}}return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x3aef9a,_0xb0e4('0x101'));};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x102')]=function(_0x4ab648){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x103'),_0x4ab648[_0xb0e4('0x36')]));return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](_0xb0e4('0x102'));};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x104')]=function(_0x28c65c){logger[_0xb0e4('0x2d')](util['format'](_0xb0e4('0x105'),_0x28c65c['label']));var _0x6d6798='';if(_0x28c65c[_0xb0e4('0x106')]){if(!this['isConfigured'](_0x28c65c[_0xb0e4('0x106')])){return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x28c65c,_0xb0e4('0x107'));}else{var _0x1b3e5d=parseInt(_0x28c65c[_0xb0e4('0x106')],0xa);if(isNaN(_0x1b3e5d)){_0x6d6798=_0x28c65c[_0xb0e4('0x106')];}else{_0x6d6798=this['getTrunk'][_0xb0e4('0x6a')](this,_0x28c65c[_0xb0e4('0x106')]);if(!_0x6d6798){return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x28c65c,_0xb0e4('0x108'));}}}}else if(_0x28c65c['trunk_name']){_0x6d6798=_0x28c65c[_0xb0e4('0x109')];}else{return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x28c65c,_0xb0e4('0x107'));}var _0x337dfd=this['channel'][_0xb0e4('0x55')](_0xb0e4('0xdb'),[util[_0xb0e4('0x28')](_0xb0e4('0x10a'),_0x6d6798,_0x28c65c[_0xb0e4('0xbb')]),_0x28c65c[_0xb0e4('0x62')],_0x28c65c[_0xb0e4('0xd9')],_0x28c65c[_0xb0e4('0x60')]]);if(_0x337dfd[_0xb0e4('0xa0')]===-0x1){return _0x337dfd;}return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util[_0xb0e4('0x28')](_0xb0e4('0xda'),'DIAL'));};AGIVertices[_0xb0e4('0xe')]['finally']=function(_0x20a979){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x10b'),_0x20a979['label']));return this[_0xb0e4('0xb')]['noop'](_0xb0e4('0x10c'));};AGIVertices['prototype'][_0xb0e4('0x10d')]=function(_0x5e38b3){logger['info'](util['format'](_0xb0e4('0x10e'),_0x5e38b3[_0xb0e4('0x36')]));if(_0x5e38b3['retry']===0x0){return this[_0xb0e4('0xa1')](_0x5e38b3);}_0x5e38b3[_0xb0e4('0xa2')]-=0x1;if(!this[_0xb0e4('0x81')](_0x5e38b3['file_id'])){return this['channel']['error'](_0x5e38b3,_0xb0e4('0x10f'));}var _0x2f2bb4=this[_0xb0e4('0x1d')][_0xb0e4('0x6a')](this,_0x5e38b3['file_id']);if(!_0x2f2bb4){return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x5e38b3,_0xb0e4('0x110'));}if(!this[_0xb0e4('0x81')](_0x5e38b3[_0xb0e4('0xd1')])){return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0xb0e4('0xd2'));}var _0x400b6b=this[_0xb0e4('0xb')][_0xb0e4('0x111')](_0x2f2bb4,_0x5e38b3[_0xb0e4('0x112')],_0x5e38b3[_0xb0e4('0x113')]);var _0x644411=_0x400b6b[_0xb0e4('0xa0')]?_0x400b6b[_0xb0e4('0xa0')][_0xb0e4('0x9e')]():'';logger[_0xb0e4('0x2d')](_0xb0e4('0x114'),JSON[_0xb0e4('0x6e')](_0x400b6b));if(_0x400b6b['result']===-0x1){this[_0xb0e4('0x34')][_0xb0e4('0x6a')](this,_0x5e38b3,_0x644411);return _0x400b6b;}else if(_0x400b6b[_0xb0e4('0x9d')]==='timeout'){_0x400b6b[_0xb0e4('0xa0')]=_0x644411[_0xb0e4('0x96')]>=parseInt(_0x5e38b3['mindigit'])?'x':'i';}else{_0x400b6b[_0xb0e4('0xa0')]=_0x644411[_0xb0e4('0x96')]>=parseInt(_0x5e38b3[_0xb0e4('0x115')])&&_0x644411['length']<=parseInt(_0x5e38b3[_0xb0e4('0x113')])?'x':'i';}var _0x31ea43=this[_0xb0e4('0xf')][_0xb0e4('0x6a')](this,_0x5e38b3[_0xb0e4('0xd1')]);if(!_0x31ea43){return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x5e38b3,'no\x20variable\x20found');}this['channel']['setVariable'](_0x31ea43,_0x644411);if(this[_0xb0e4('0x81')](_0x5e38b3[_0xb0e4('0x116')])){var _0x28854e=parseInt(_0x5e38b3[_0xb0e4('0x116')],0xa);var _0x37150e=rs[_0xb0e4('0x117')]({'charset':'*','length':_0x28854e});var _0x5b87c5=_0x644411['length'];if(_0x5b87c5>0x0){if(_0x5b87c5>_0x28854e){this[_0xb0e4('0x34')][_0xb0e4('0x6a')](this,_0x5e38b3,_0x5e38b3[_0xb0e4('0x118')]==='first'?_0x37150e+_0x644411[_0xb0e4('0x119')](_0x28854e):_0x644411['substr'](0x0,_0x5b87c5-_0x28854e)+_0x37150e);}else{this['createSquareDetailsReport'][_0xb0e4('0x6a')](this,_0x5e38b3,rs['generate']({'charset':'*','length':_0x5b87c5}));}}else{this[_0xb0e4('0x34')][_0xb0e4('0x6a')](this,_0x5e38b3,'');}}else{this[_0xb0e4('0x34')][_0xb0e4('0x6a')](this,_0x5e38b3,_0x644411);}return _0x400b6b;};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x11a')]=function(_0x6b716c){logger[_0xb0e4('0x2d')](util['format'](_0xb0e4('0x11b'),_0x6b716c[_0xb0e4('0x36')]));return this[_0xb0e4('0x10d')](_0x6b716c);};AGIVertices['prototype'][_0xb0e4('0x11c')]=function(_0x50daa9){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x11d'),_0x50daa9[_0xb0e4('0x36')]));this['createSquareDetailsReport'][_0xb0e4('0x6a')](this,_0x50daa9,_0x50daa9[_0xb0e4('0x11e')]);return this['channel'][_0xb0e4('0xa5')](util[_0xb0e4('0x28')]('GOAL\x20%s',_0x50daa9[_0xb0e4('0x11e')]));};AGIVertices['prototype'][_0xb0e4('0x11f')]=function(_0x577d05){logger['info'](util[_0xb0e4('0x28')](_0xb0e4('0x120'),_0x577d05[_0xb0e4('0x36')]));if(!this[_0xb0e4('0x81')](_0x577d05['aws_access_key_id'])||!this[_0xb0e4('0x81')](_0x577d05['aws_secret_access_key'])){return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](_0xb0e4('0x121'));}if(!this[_0xb0e4('0x81')](_0x577d05[_0xb0e4('0x5a')])){return this[_0xb0e4('0xb')][_0xb0e4('0xa5')]('no\x20text\x20configured');}this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util['format'](_0xb0e4('0x122'),_0x577d05[_0xb0e4('0x5a')]));var _0x1df07e=this['awsPolly'][_0xb0e4('0x6a')](this,_0x577d05);if(_0x1df07e){this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0x1df07e));var _0x2e2a51=this['channel'][_0xb0e4('0xfe')](_0x1df07e);try{fs[_0xb0e4('0xff')](_0x1df07e+_0xb0e4('0x123'));}catch(_0x26d34f){logger[_0xb0e4('0x31')](_0x26d34f);}return _0x2e2a51;}return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x577d05,_0xb0e4('0x124'));};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x125')]=function(_0x5a2e54){logger['info'](util[_0xb0e4('0x28')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x5a2e54[_0xb0e4('0x36')]));if(!this[_0xb0e4('0x81')](_0x5a2e54[_0xb0e4('0x84')])||!this['isConfigured'](_0x5a2e54['aws_secret_access_key'])){return this[_0xb0e4('0xb')][_0xb0e4('0xa5')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xb0e4('0x81')](_0x5a2e54['aws_bot_name'])){return this['channel'][_0xb0e4('0xa5')](_0xb0e4('0x126'));}if(!this[_0xb0e4('0x81')](_0x5a2e54['text'])){return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](_0xb0e4('0xc0'));}this['channel'][_0xb0e4('0xee')]=!![];this['createSquareDetailsReport'](_0x5a2e54);this[_0xb0e4('0xdf')](_0x5a2e54[_0xb0e4('0x5a')],'in','','');this['channel'][_0xb0e4('0xa5')](util[_0xb0e4('0x28')](_0xb0e4('0x127'),_0x5a2e54[_0xb0e4('0x5a')]));var _0x4f5ab9=this['awsLex'][_0xb0e4('0x6a')](this,_0x5a2e54);if(_0x4f5ab9){for(var _0x3d39b8 in _0x4f5ab9){if(_0x4f5ab9[_0xb0e4('0x91')](_0x3d39b8)&&_['isString'](_0x4f5ab9[_0x3d39b8])){this[_0xb0e4('0xb')][_0xb0e4('0x9a')](util[_0xb0e4('0x28')]('AWS_LEX_%s',_0x3d39b8['toUpperCase']()),_0x4f5ab9[_0x3d39b8]);}}if(_['isNil'](_0x4f5ab9[_0xb0e4('0x72')])){return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](_0xb0e4('0x128'));}else{this[_0xb0e4('0xdf')](_0x4f5ab9[_0xb0e4('0x72')],_0xb0e4('0xe5'),_0xb0e4('0x129'),'');return this[_0xb0e4('0xb')]['noop'](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x4f5ab9[_0xb0e4('0x72')]));}}return this['channel']['error'](_0x5a2e54,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xb0e4('0xe')]['googleasr']=function(_0x2962cf){logger['info'](util[_0xb0e4('0x28')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x2962cf[_0xb0e4('0x36')],_0x2962cf[_0xb0e4('0x62')]));if(!this[_0xb0e4('0x81')](_0x2962cf[_0xb0e4('0x75')])){return this[_0xb0e4('0xb')][_0xb0e4('0xa5')]('no\x20key\x20configured');}var _0x408590=_0xb0e4('0x12a');var _0x346614=util[_0xb0e4('0x28')](_0xb0e4('0x12b'),FILES_PATH,rs['generate'](0x4));var _0x30994b=util[_0xb0e4('0x28')]('%s.%s',_0x346614,_0x408590);var _0x58b8c9=!![];if(_0x2962cf['beep']==='NOBEEP'){_0x58b8c9=![];}var _0x5dd2fa=this['channel'][_0xb0e4('0x12c')](_0x346614,_0x408590,_0x2962cf[_0xb0e4('0x12d')],_0x2962cf['timeout'],undefined,_0x58b8c9);if(_0x5dd2fa['result']!==-0x1){this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util['format']('google\x20%s\x20file\x20created',_0x30994b));var _0x4169c9=this[_0xb0e4('0x8b')]['sync'](this,_0x2962cf,_0x30994b);if(_0x4169c9){for(var _0x5699fb in _0x4169c9){if(_0x4169c9['hasOwnProperty'](_0x5699fb)){this[_0xb0e4('0xb')][_0xb0e4('0x9a')](util['format'](_0xb0e4('0x12e'),_0x5699fb[_0xb0e4('0xe3')]()),_0x4169c9[_0x5699fb]);}}return this[_0xb0e4('0xb')]['noop'](util[_0xb0e4('0x28')](_0xb0e4('0x12f'),JSON[_0xb0e4('0x6e')](_0x4169c9)));}}return _0x5dd2fa;};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x130')]=function(_0x31d2e3){logger['info'](util[_0xb0e4('0x28')](_0xb0e4('0x131'),_0x31d2e3[_0xb0e4('0x36')]));if(!this['isConfigured'](_0x31d2e3['appid'])){return this[_0xb0e4('0xb')]['noop'](_0xb0e4('0x132'));}if(!this['isConfigured'](_0x31d2e3[_0xb0e4('0x8e')])){return this[_0xb0e4('0xb')][_0xb0e4('0xa5')]('no\x20appsecret\x20configured');}var _0x45d450=_0xb0e4('0x12a');var _0x3ff184=util[_0xb0e4('0x28')](_0xb0e4('0x12b'),FILES_PATH,rs[_0xb0e4('0x117')](0x4));var _0x58c076=util[_0xb0e4('0x28')](_0xb0e4('0x99'),_0x3ff184,_0x45d450);var _0x528cc8=!![];if(_0x31d2e3[_0xb0e4('0x133')]===_0xb0e4('0x134')){_0x528cc8=![];}var _0x12174e=this[_0xb0e4('0xb')][_0xb0e4('0x12c')](_0x3ff184,_0x45d450,_0x31d2e3[_0xb0e4('0x12d')],_0x31d2e3[_0xb0e4('0x62')],undefined,_0x528cc8);if(_0x12174e[_0xb0e4('0xa0')]!==-0x1){this['channel'][_0xb0e4('0xa5')](util[_0xb0e4('0x28')](_0xb0e4('0x135'),_0x58c076));var _0x100556=this[_0xb0e4('0x8d')][_0xb0e4('0x6a')](this,_0x31d2e3,_0x58c076);if(_0x100556){for(var _0x19a239 in _0x100556){if(_0x100556['hasOwnProperty'](_0x19a239)){this[_0xb0e4('0xb')]['setVariable'](util[_0xb0e4('0x28')](_0xb0e4('0x136'),_0x19a239[_0xb0e4('0xe3')]()),_0x100556[_0x19a239]);}}return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util['format'](_0xb0e4('0x137'),JSON[_0xb0e4('0x6e')](_0x100556)));}}return _0x12174e;};AGIVertices['prototype']['gotoc']=function(_0x2ac1dd){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x138'),_0x2ac1dd[_0xb0e4('0x36')]));return this[_0xb0e4('0xb')][_0xb0e4('0x139')](_0x2ac1dd[_0xb0e4('0x3c')],_0x2ac1dd['extension'],_0x2ac1dd['priority']);};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x13a')]=function(_0x47f977){logger['info'](util['format'](_0xb0e4('0x13b'),_0x47f977['label']));if(!this[_0xb0e4('0x81')](_0x47f977['condition'])){return this[_0xb0e4('0xb')]['error'](_0x47f977,_0xb0e4('0x13c'));}try{var _0x11ea0f=eval(_0x47f977[_0xb0e4('0x13d')])?_0xb0e4('0x13e'):_0xb0e4('0x13f');this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util[_0xb0e4('0x28')](_0xb0e4('0x140'),_0x47f977['condition'],_0x11ea0f));return{'code':0xc8,'result':_0x11ea0f};}catch(_0x442173){return{'code':0xc8,'result':_0xb0e4('0x13f')};}};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x141')]=function(_0x5b2b04){logger['info'](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5b2b04['label']));if(!this[_0xb0e4('0x81')](_0x5b2b04[_0xb0e4('0x142')])){return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x5b2b04,_0xb0e4('0x143'));}var _0x28cfb4=this[_0xb0e4('0x24')][_0xb0e4('0x6a')](this,_0x5b2b04['interval_id']);if(!_0x28cfb4){return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x5b2b04,_0xb0e4('0x144'));}for(var _0x7fd625=0x0;_0x7fd625<_0x28cfb4[_0xb0e4('0x96')];_0x7fd625+=0x1){var _0x33024c=this[_0xb0e4('0xb')][_0xb0e4('0xf')](util[_0xb0e4('0x28')]('IFTIME(%s?true:false)',_0x28cfb4[_0x7fd625]));if(_0x33024c[_0xb0e4('0xa0')]===-0x1){return _0x33024c;}logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x145'),_0x28cfb4[_0x7fd625],_0x33024c[_0xb0e4('0x9d')]));if(_0x33024c[_0xb0e4('0x9d')]==='true'){logger['info'](util[_0xb0e4('0x28')](_0xb0e4('0x145'),_0x28cfb4[_0x7fd625],_0xb0e4('0x13e')));this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util[_0xb0e4('0x28')](_0xb0e4('0x145'),_0x28cfb4[_0x7fd625],_0xb0e4('0x13e')));return{'code':0xc8,'result':_0xb0e4('0x13e')};}else{logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x145'),_0x28cfb4[_0x7fd625],'false'));this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util['format'](_0xb0e4('0x145'),_0x28cfb4[_0x7fd625],_0xb0e4('0x13f')));}}return{'code':0xc8,'result':_0xb0e4('0x13f')};};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x146')]=function(_0x1ae05f){logger['info'](util[_0xb0e4('0x28')](_0xb0e4('0x147'),_0x1ae05f[_0xb0e4('0x36')]));return this[_0xb0e4('0xb')][_0xb0e4('0x146')]();};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x148')]=function(_0x3e9af4){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x149'),_0x3e9af4['label']));if(!this[_0xb0e4('0x81')](_0x3e9af4[_0xb0e4('0x75')])){return this['channel']['noop']('no\x20key\x20configured');}var _0x26c20b='wav';var _0x4f081d=util[_0xb0e4('0x28')](_0xb0e4('0x12b'),FILES_PATH,rs['generate'](0x4));var _0x317646=util[_0xb0e4('0x28')](_0xb0e4('0x99'),_0x4f081d,_0x26c20b);var _0x8ca58=!![];if(_0x3e9af4['beep']===_0xb0e4('0x134')){_0x8ca58=![];}var _0x1c4104=this[_0xb0e4('0xb')]['recordFile'](_0x4f081d,_0x26c20b,_0x3e9af4[_0xb0e4('0x12d')],_0x3e9af4[_0xb0e4('0x62')],undefined,_0x8ca58);if(_0x1c4104['result']!==-0x1){this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util['format'](_0xb0e4('0x14a'),_0x317646));var _0x1baf74=this[_0xb0e4('0x7f')][_0xb0e4('0x6a')](this,_0x3e9af4,_0x317646);if(_0x1baf74){for(var _0x2d08a9 in _0x1baf74){if(_0x1baf74[_0xb0e4('0x91')](_0x2d08a9)){this[_0xb0e4('0xb')][_0xb0e4('0x9a')](util[_0xb0e4('0x28')](_0xb0e4('0x14b'),_0x2d08a9[_0xb0e4('0xe3')]()),_0x1baf74[_0x2d08a9]);}}return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util[_0xb0e4('0x28')](_0xb0e4('0x14c'),JSON[_0xb0e4('0x6e')](_0x1baf74)));}}return _0x1c4104;};AGIVertices['prototype'][_0xb0e4('0x14d')]=function(_0x2bb009){logger['info'](util['format'](_0xb0e4('0x14e'),_0x2bb009['label']));if(!this[_0xb0e4('0x81')](_0x2bb009[_0xb0e4('0x75')])){return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](_0xb0e4('0xde'));}if(!this[_0xb0e4('0x81')](_0x2bb009[_0xb0e4('0x5a')])){return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](_0xb0e4('0xc0'));}this[_0xb0e4('0xb')]['noop'](util[_0xb0e4('0x28')](_0xb0e4('0x14f'),_0x2bb009[_0xb0e4('0x5a')]));var _0x58688e=this['ispeechTTS'][_0xb0e4('0x6a')](this,_0x2bb009);if(_0x58688e){this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util[_0xb0e4('0x28')](_0xb0e4('0x14a'),_0x58688e));var _0x431c28=this[_0xb0e4('0xb')][_0xb0e4('0xfe')](_0x58688e,_0x2bb009[_0xb0e4('0x12d')]);try{fs[_0xb0e4('0xff')](_0x58688e+_0xb0e4('0x123'));}catch(_0x3c6b39){logger['error'](_0x3c6b39);}return _0x431c28;}return this[_0xb0e4('0xb')]['error'](_0x2bb009,_0xb0e4('0x150'));};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x151')]=function(_0x5ad370){logger[_0xb0e4('0x2d')](util['format'](_0xb0e4('0x152'),_0x5ad370[_0xb0e4('0x36')]));if(!this[_0xb0e4('0x81')](_0x5ad370[_0xb0e4('0x153')])){return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x5ad370,_0xb0e4('0x154'));}logger['info'](util[_0xb0e4('0x28')](_0xb0e4('0x155'),this[_0xb0e4('0xb')][_0xb0e4('0x39')],_0x5ad370[_0xb0e4('0x153')]));var _0xb423f6=this[_0xb0e4('0x50')][_0xb0e4('0x6a')](this,_0x5ad370[_0xb0e4('0x153')]);if(_0xb423f6){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x156'),this[_0xb0e4('0xb')][_0xb0e4('0x39')],_0x5ad370[_0xb0e4('0x153')]));this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util[_0xb0e4('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x5ad370[_0xb0e4('0x153')]));return{'code':0xc8,'result':_0xb0e4('0x157')};}else{logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x158'),this[_0xb0e4('0xb')]['callerid'],_0x5ad370[_0xb0e4('0x153')]));this[_0xb0e4('0xb')]['noop'](util[_0xb0e4('0x28')](_0xb0e4('0x158'),this[_0xb0e4('0xb')][_0xb0e4('0x39')],_0x5ad370[_0xb0e4('0x153')]));return{'code':0xc8,'result':_0xb0e4('0x159')};}};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x15a')]=function(_0x2add85){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x15b'),_0x2add85['label']));if(!this[_0xb0e4('0x81')](_0x2add85[_0xb0e4('0x153')])){return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x2add85,_0xb0e4('0x154'));}logger['info'](util[_0xb0e4('0x28')](_0xb0e4('0x155'),this['channel'][_0xb0e4('0x39')],_0x2add85['findBy']));var _0x318417=this['agentLogout'][_0xb0e4('0x6a')](this,_0x2add85[_0xb0e4('0x153')]);if(_0x318417){logger['info'](util[_0xb0e4('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xb0e4('0xb')]['callerid'],_0x2add85[_0xb0e4('0x153')]));this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xb0e4('0xb')]['callerid'],_0x2add85[_0xb0e4('0x153')]));return{'code':0xc8,'result':_0xb0e4('0x157')};}else{logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x158'),this[_0xb0e4('0xb')][_0xb0e4('0x39')],_0x2add85[_0xb0e4('0x153')]));this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util[_0xb0e4('0x28')](_0xb0e4('0x158'),this[_0xb0e4('0xb')][_0xb0e4('0x39')],_0x2add85['findBy']));return{'code':0xc8,'result':_0xb0e4('0x159')};}};AGIVertices['prototype']['math']=function(_0x5b1522){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x15c'),_0x5b1522[_0xb0e4('0x36')]));if(!this[_0xb0e4('0x81')](_0x5b1522[_0xb0e4('0x15d')])){return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x5b1522,_0xb0e4('0x15e'));}this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util[_0xb0e4('0x28')]('math\x20%s',_0x5b1522[_0xb0e4('0x15d')]));var _0x5c4984=eval(_0x5b1522['operation']);if(!this['isConfigured'](_0x5b1522[_0xb0e4('0xd1')])){return this['channel'][_0xb0e4('0xa5')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0xd26b85=this[_0xb0e4('0xf')]['sync'](this,_0x5b1522[_0xb0e4('0xd1')]);if(!_0xd26b85){return this[_0xb0e4('0xb')]['error'](_0x5b1522,_0xb0e4('0x15f'));}if(_[_0xb0e4('0x160')](_0x5c4984)){var _0x27fb7d=this;_0x5c4984['forEach'](function(_0x4ee3df,_0x2e5dde){_0x27fb7d[_0xb0e4('0xb')]['setVariable'](util['format'](_0xb0e4('0x161'),_0xd26b85,_0x2e5dde),_0x4ee3df);});return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util[_0xb0e4('0x28')]('variable\x20%s[key]\x20set',_0xd26b85));}else{return this[_0xb0e4('0xb')][_0xb0e4('0x9a')](_0xd26b85,_0x5c4984);}};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0xa')]=function(_0x3c8442){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x162'),_0x3c8442[_0xb0e4('0x36')]));if(_0x3c8442[_0xb0e4('0xa2')]===0x0){return this['maxRetry'](_0x3c8442);}_0x3c8442[_0xb0e4('0xa2')]-=0x1;if(!this[_0xb0e4('0x81')](_0x3c8442[_0xb0e4('0x163')])){return this[_0xb0e4('0xb')]['error'](_0x3c8442,'no\x20file\x20audio\x20selected');}var _0x36dcf9=this[_0xb0e4('0x1d')][_0xb0e4('0x6a')](this,_0x3c8442[_0xb0e4('0x163')]);if(!_0x36dcf9){return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x3c8442,_0xb0e4('0x110'));}var _0x3325c1=this[_0xb0e4('0xb')][_0xb0e4('0x111')](_0x36dcf9,_0x3c8442['response'],_0x3c8442[_0xb0e4('0x164')]);var _0x15e83d=_0x3325c1[_0xb0e4('0xa0')];if(_0x3325c1[_0xb0e4('0xa0')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x3c8442,'-1');return _0x3325c1;}else if(_0x3325c1[_0xb0e4('0x9d')]===_0xb0e4('0x62')){_0x3325c1[_0xb0e4('0xa0')]=_0x3325c1[_0xb0e4('0xa0')][_0xb0e4('0x96')]>0x0?_0x3325c1[_0xb0e4('0xa0')]:'t';}else if(_[_0xb0e4('0x41')](_0x3325c1[_0xb0e4('0xa0')])){_0x3325c1[_0xb0e4('0xa0')]='#';_0x15e83d='#';}if(!this[_0xb0e4('0x81')](_0x3c8442[_0xb0e4('0xd1')])){this[_0xb0e4('0xb')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x202f2e=this[_0xb0e4('0xf')][_0xb0e4('0x6a')](this,_0x3c8442['variable_id']);if(!_0x202f2e){return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x3c8442,_0xb0e4('0x15f'));}this['channel'][_0xb0e4('0x9a')](_0x202f2e,_0x15e83d);}this['createSquareDetailsReport'][_0xb0e4('0x6a')](this,_0x3c8442,_0x15e83d);return _0x3325c1;};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0xa5')]=function(_0x2e4954){logger['info'](util[_0xb0e4('0x28')](_0xb0e4('0x165'),_0x2e4954[_0xb0e4('0x36')]));return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](_0x2e4954[_0xb0e4('0x166')]||_0x2e4954[_0xb0e4('0x36')]);};AGIVertices[_0xb0e4('0xe')]['pause']=function(_0x13e780){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x13e780[_0xb0e4('0x36')]));if(!this[_0xb0e4('0x81')](_0x13e780[_0xb0e4('0x153')])){return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x13e780,'no\x20find\x20by\x20configured');}logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x155'),this[_0xb0e4('0xb')]['callerid'],_0x13e780[_0xb0e4('0x153')]));var _0x55f8ce=this[_0xb0e4('0x49')][_0xb0e4('0x6a')](this,_0x13e780[_0xb0e4('0x167')]);var _0x441644=this[_0xb0e4('0x4b')][_0xb0e4('0x6a')](this,_0x13e780[_0xb0e4('0x153')],_0x55f8ce);if(_0x441644){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x156'),this['channel']['callerid'],_0x13e780[_0xb0e4('0x153')]));this[_0xb0e4('0xb')]['noop'](util[_0xb0e4('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xb0e4('0xb')][_0xb0e4('0x39')],_0x13e780[_0xb0e4('0x153')]));return{'code':0xc8,'result':_0xb0e4('0x157')};}else{logger[_0xb0e4('0x2d')](util['format'](_0xb0e4('0x158'),this[_0xb0e4('0xb')][_0xb0e4('0x39')],_0x13e780[_0xb0e4('0x153')]));this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xb0e4('0xb')][_0xb0e4('0x39')],_0x13e780[_0xb0e4('0x153')]));return{'code':0xc8,'result':_0xb0e4('0x159')};}};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x168')]=function(_0x2dbce3){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x169'),_0x2dbce3[_0xb0e4('0x36')]));if(!this[_0xb0e4('0x81')](_0x2dbce3['file_id'])){return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x2dbce3,_0xb0e4('0x10f'));}var _0x15a622=this[_0xb0e4('0x1d')]['sync'](this,_0x2dbce3[_0xb0e4('0x163')]);if(!_0x15a622){return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x2dbce3,_0xb0e4('0x110'));}var _0x33b371=this[_0xb0e4('0xb')][_0xb0e4('0x55')]('PLAYBACK',[_0x15a622,_0x2dbce3[_0xb0e4('0xd9')]]);if(_0x33b371['result']===-0x1){return _0x33b371;}return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util['format'](_0xb0e4('0xbd'),'PLAYBACK',_0x15a622));};AGIVertices['prototype']['queue']=function(_0x3b2889){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x16a'),_0x3b2889[_0xb0e4('0x36')]));if(!this[_0xb0e4('0x81')](_0x3b2889[_0xb0e4('0x16b')])){return this['channel'][_0xb0e4('0x31')](_0x3b2889,_0xb0e4('0x16c'));}var _0x57e267='';var _0x3980d5=parseInt(_0x3b2889['queue_id'],0xa);if(isNaN(_0x3980d5)){_0x57e267=_0x3b2889['queue_id'];}else{_0x57e267=this['getVoiceQueue'][_0xb0e4('0x6a')](this,_0x3b2889[_0xb0e4('0x16b')]);if(!_0x57e267){return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x3b2889,'no\x20queue\x20found');}}var _0x369e50='';if(this['isConfigured'](_0x3b2889[_0xb0e4('0x163')])){var _0x42f5e8=this[_0xb0e4('0x1d')][_0xb0e4('0x6a')](this,_0x3b2889[_0xb0e4('0x163')]);if(_0x42f5e8){_0x369e50=_0x42f5e8;}}this[_0xb0e4('0x34')][_0xb0e4('0x6a')](this,_0x3b2889,_0x57e267);if(_0x3b2889[_0xb0e4('0xd9')]['indexOf']('x')<0x0){_0x3b2889[_0xb0e4('0xd9')]+='x';}if(_0x3b2889['opts'][_0xb0e4('0x16d')]('X')<0x0){_0x3b2889[_0xb0e4('0xd9')]+='X';}this[_0xb0e4('0xb')]['setVariable']('XMCS-QUEUE',_0x57e267?_0x57e267[_0xb0e4('0x16e')]():'');var _0x5e2b2d=this['channel'][_0xb0e4('0x55')](_0xb0e4('0x16f'),[_0x57e267,_0x3b2889['opts'],_0x3b2889[_0xb0e4('0x60')],_0x369e50,_0x3b2889[_0xb0e4('0x62')],_0x3b2889['agi'],_0x3b2889[_0xb0e4('0x170')],_0x3b2889['gosub'],'',_0x3b2889[_0xb0e4('0x171')]]);if(_0x5e2b2d[_0xb0e4('0xa0')]===-0x1){return _0x5e2b2d;}return this['channel'][_0xb0e4('0xa5')](util['format'](_0xb0e4('0xbd'),_0xb0e4('0x16f'),_0x57e267));};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x172')]=function(_0x19bb02){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x19bb02[_0xb0e4('0x36')]));var _0x3fa829=_0x19bb02[_0xb0e4('0x173')]||'wav';var _0x483780=util['format'](_0xb0e4('0x174'),this[_0xb0e4('0xb')][_0xb0e4('0x35')],rs['generate'](0x5));var _0x124406=util[_0xb0e4('0x28')](_0xb0e4('0x175'),FILES_PATH,_0x483780,_0x3fa829);var _0x42e385=util[_0xb0e4('0x28')](_0xb0e4('0x12b'),FILES_PATH,_0x483780);this[_0xb0e4('0x3a')]['sync'](this,_0x19bb02,_0x483780,_0x124406);this[_0xb0e4('0xb')][_0xb0e4('0x9a')](_0xb0e4('0x176'),_0x483780);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x42e385,_0x3fa829,_0x19bb02['escape_digits'],_0x19bb02['timeout']);return this['channel'][_0xb0e4('0x12c')](_0x42e385,_0x3fa829,_0x19bb02[_0xb0e4('0x177')],_0x19bb02[_0xb0e4('0x62')],undefined,!![]);};AGIVertices['prototype'][_0xb0e4('0x178')]=function(_0x9a914b){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x179'),_0x9a914b[_0xb0e4('0x36')]));if(!this[_0xb0e4('0x81')](_0x9a914b['url'])){return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](_0xb0e4('0x17a'));}var _0x232eb0=this['restAPI'][_0xb0e4('0x6a')](this,_0x9a914b);logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x17b'),util[_0xb0e4('0x17c')](_0x232eb0,{'showHidden':![],'depth':null})));if(!this[_0xb0e4('0x81')](_0x9a914b[_0xb0e4('0xd1')])){return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](_0xb0e4('0x17d'));}var _0x2794f7=this['getVariable']['sync'](this,_0x9a914b['variable_id']);if(!_0x2794f7){return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x9a914b,'no\x20variable\x20found');}this[_0xb0e4('0xb')][_0xb0e4('0x9a')](util[_0xb0e4('0x28')]('%s_STATUS_CODE',_0x2794f7),_0x232eb0[_0xb0e4('0x70')]?_0x232eb0[_0xb0e4('0x70')]:_0xb0e4('0x17e'));this[_0xb0e4('0xb')][_0xb0e4('0x9a')](util[_0xb0e4('0x28')]('%s_STATUS_MESSAGE',_0x2794f7),_0x232eb0[_0xb0e4('0x71')]?_0x232eb0[_0xb0e4('0x71')]:'OK');if(_0x232eb0[_0xb0e4('0x65')]){try{this[_0xb0e4('0x98')](_0x232eb0[_0xb0e4('0x65')],_0x2794f7);}catch(_0x4db72b){logger['error'](util[_0xb0e4('0x28')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x2794f7));}}return this[_0xb0e4('0xb')]['noop'](util[_0xb0e4('0x28')]('variable\x20%s\x20set',_0x2794f7));};AGIVertices['prototype'][_0xb0e4('0x17f')]=function(_0x2c048e){logger['info'](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x2c048e['label']));return this[_0xb0e4('0xb')][_0xb0e4('0x180')](_0x2c048e[_0xb0e4('0x181')][_0xb0e4('0x57')](/\s+/g,''),_0x2c048e[_0xb0e4('0x177')]);};AGIVertices['prototype']['saynumber']=function(_0x29cc58){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x182'),_0x29cc58[_0xb0e4('0x36')]));return this[_0xb0e4('0xb')][_0xb0e4('0x183')](_0x29cc58['number']['replace'](/\s+/g,''),_0x29cc58[_0xb0e4('0x177')]);};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x184')]=function(_0x1038fd){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x185'),_0x1038fd[_0xb0e4('0x36')]));return this[_0xb0e4('0xb')][_0xb0e4('0x186')](_0x1038fd[_0xb0e4('0x5a')],_0x1038fd[_0xb0e4('0x177')]);};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x187')]=function(_0x584826){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x188'),_0x584826[_0xb0e4('0x36')]));if(!this[_0xb0e4('0x81')](_0x584826['account_id'])){return this['channel'][_0xb0e4('0xa5')](_0xb0e4('0x189'));}var _0x611285=this['getMailAccount'][_0xb0e4('0x6a')](this,_0x584826[_0xb0e4('0x18a')]);if(!_0x611285||!_0x611285['Smtp']){return this['channel'][_0xb0e4('0x31')](_0x584826,_0xb0e4('0x18b'));}var _0x335e75={'from':util[_0xb0e4('0x28')](_0xb0e4('0x18c'),_0x611285[_0xb0e4('0x12')],_0x611285[_0xb0e4('0x18d')]||_0x611285['Smtp'][_0xb0e4('0x18e')]),'to':_0x584826['to']||'','cc':_0x584826['cc']||'','bcc':_0x584826[_0xb0e4('0x18f')]||'','subject':_0x584826[_0xb0e4('0x190')],'html':_0x584826[_0xb0e4('0x5a')],'text':_0x584826['text']};var _0x187ace={'tls':{'rejectUnauthorized':![]}};if(_0x611285[_0xb0e4('0x191')]['service']){_0x187ace[_0xb0e4('0x192')]=_0x611285[_0xb0e4('0x191')]['service'];}else{_0x187ace['host']=_0x611285[_0xb0e4('0x191')][_0xb0e4('0x193')];_0x187ace[_0xb0e4('0x194')]=_0x611285[_0xb0e4('0x191')][_0xb0e4('0x194')];_0x187ace[_0xb0e4('0x195')]=_0x611285[_0xb0e4('0x191')][_0xb0e4('0x195')];}if(_0x611285[_0xb0e4('0x191')][_0xb0e4('0x196')]){_0x187ace[_0xb0e4('0x197')]={'user':_0x611285[_0xb0e4('0x191')][_0xb0e4('0x18e')],'pass':_0x611285[_0xb0e4('0x191')]['pass']};}if(this[_0xb0e4('0x81')](_0x584826[_0xb0e4('0x198')])){}logger['debug']('sendMail\x20message',JSON[_0xb0e4('0x6e')](_0x335e75));this[_0xb0e4('0x34')][_0xb0e4('0x6a')](this,_0x584826,_0x584826[_0xb0e4('0x18a')]);this['channel'][_0xb0e4('0xa5')](util[_0xb0e4('0x28')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x611285[_0xb0e4('0x12')]));this[_0xb0e4('0x23')]['sync'](this,_0x187ace,_0x335e75);return this[_0xb0e4('0xb')][_0xb0e4('0xa5')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x199')]=function(_0x3595bf){logger[_0xb0e4('0x2d')](util['format'](_0xb0e4('0x19a'),_0x3595bf[_0xb0e4('0x36')]));return this[_0xb0e4('0xb')][_0xb0e4('0xa5')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x19b')]=function(_0x416aac){logger[_0xb0e4('0x2d')](util['format'](_0xb0e4('0x19c'),_0x416aac[_0xb0e4('0x36')]));if(!this[_0xb0e4('0x81')](_0x416aac[_0xb0e4('0x19d')])){return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](_0xb0e4('0x19e'));}var _0x5b4802=this['getSmsAccount']['sync'](this,_0x416aac[_0xb0e4('0x19d')]);if(!_0x5b4802){return this[_0xb0e4('0xb')]['error'](_0x416aac,_0xb0e4('0x19f'));}var _0x3ba096={'body':_0x416aac[_0xb0e4('0x1a0')],'phone':_0x416aac['to']||'','SmsAccountId':_0x5b4802['id']};logger[_0xb0e4('0xd5')](_0xb0e4('0x1a1'),JSON['stringify'](_0x3ba096));this['createSquareDetailsReport'][_0xb0e4('0x6a')](this,_0x416aac,_0x416aac[_0xb0e4('0x19d')]);this[_0xb0e4('0xb')]['noop'](util[_0xb0e4('0x28')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x5b4802[_0xb0e4('0x12')]));this['createSmsMessage']['sync'](this,_0x3ba096);return this[_0xb0e4('0xb')]['noop'](_0xb0e4('0x1a2'));};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x1a3')]=function(_0x4572f4){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x1a4'),_0x4572f4[_0xb0e4('0x36')]));if(!this[_0xb0e4('0x81')](_0x4572f4[_0xb0e4('0xd1')])){return this['channel']['error'](_0x4572f4,_0xb0e4('0x1a5'));}var _0x190feb=this[_0xb0e4('0xf')][_0xb0e4('0x6a')](this,_0x4572f4[_0xb0e4('0xd1')]);if(!_0x190feb){return this['channel'][_0xb0e4('0x31')](_0x4572f4,_0xb0e4('0x15f'));}return this[_0xb0e4('0xb')][_0xb0e4('0x9a')](_0x190feb,_0x4572f4[_0xb0e4('0x1a6')]);};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x1a7')]=function(_0x3a64d5){logger[_0xb0e4('0x2d')](util['format'](_0xb0e4('0x1a8'),_0x3a64d5[_0xb0e4('0x36')]));this['channel'][_0xb0e4('0xa5')]('START\x20CALLY\x20SQUARE');if(_0x3a64d5[_0xb0e4('0xb3')]===_0xb0e4('0x1a9')){this['channel'][_0xb0e4('0xa5')](_0xb0e4('0x1aa'));return this['channel'][_0xb0e4('0xb3')]();}return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](_0xb0e4('0x1ab'));};AGIVertices[_0xb0e4('0xe')]['subproject']=function(_0x2089ce){logger['info'](util[_0xb0e4('0x28')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x2089ce[_0xb0e4('0x36')]));if(!this[_0xb0e4('0x81')](_0x2089ce['project_id'])){return this[_0xb0e4('0xb')]['error'](_0x2089ce,_0xb0e4('0x1ac'));}var _0x4d519b=this[_0xb0e4('0x15')]['sync'](this,_0x2089ce[_0xb0e4('0x1ad')]);if(!this['isConfigured'](_0x4d519b)){return this[_0xb0e4('0xb')]['error'](_0x2089ce,util[_0xb0e4('0x28')](_0xb0e4('0x1ae'),_0x2089ce['project_id']));}if(_0x4d519b===this[_0xb0e4('0xb')][_0xb0e4('0x38')]){return this['channel'][_0xb0e4('0x31')](_0x2089ce,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xb0e4('0x34')][_0xb0e4('0x6a')](this,_0x2089ce,_0x4d519b);var _0x3b10cf=this[_0xb0e4('0xb')]['exec']('AGI',util[_0xb0e4('0x28')](_0xb0e4('0x1af'),config[_0xb0e4('0x5')][_0xb0e4('0x193')]||_0xb0e4('0x1b0'),_0x4d519b,this[_0xb0e4('0xb')][_0xb0e4('0x38')]));if(_0x3b10cf[_0xb0e4('0xa0')]===-0x1){return _0x3b10cf;}return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util[_0xb0e4('0x28')](_0xb0e4('0xbd'),_0xb0e4('0x1b1'),_0x4d519b));};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x1b2')]=function(_0x1778e8){logger[_0xb0e4('0x2d')](util['format'](_0xb0e4('0x1b3'),_0x1778e8[_0xb0e4('0x36')]));var _0x51bb6a=this[_0xb0e4('0x54')][_0xb0e4('0x6a')](this,_0x1778e8['command']);this['createSquareDetailsReport'][_0xb0e4('0x6a')](this,_0x1778e8,_0x1778e8[_0xb0e4('0xb2')]);if(this[_0xb0e4('0x81')](_0x1778e8[_0xb0e4('0xd1')])){var _0xb771f7=this[_0xb0e4('0xf')]['sync'](this,_0x1778e8[_0xb0e4('0xd1')]);if(_0xb771f7){this[_0xb0e4('0xb')][_0xb0e4('0x9a')](_0xb771f7,_0x51bb6a);return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util[_0xb0e4('0x28')](_0xb0e4('0x1b4'),_0x1778e8[_0xb0e4('0xb2')],_0xb771f7));}}return this['channel'][_0xb0e4('0xa5')](util[_0xb0e4('0x28')](_0xb0e4('0x1b5'),_0x1778e8[_0xb0e4('0xb2')]));};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x1b6')]=function(_0x84bdb5){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x1b7'),_0x84bdb5[_0xb0e4('0x36')]));_0x84bdb5[_0xb0e4('0x5a')]=_0x84bdb5[_0xb0e4('0x5a')][_0xb0e4('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x84bdb5['apiKey'])){return this[_0xb0e4('0xb')]['noop'](_0xb0e4('0x1b8'));}if(!this[_0xb0e4('0x81')](_0x84bdb5[_0xb0e4('0x5a')])){return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](_0xb0e4('0xc0'));}this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x84bdb5['text']));var _0x36615a=this[_0xb0e4('0x58')]['sync'](this,_0x84bdb5);if(_0x36615a){this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util[_0xb0e4('0x28')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x36615a));var _0x3bd3bd=this[_0xb0e4('0xb')][_0xb0e4('0xfe')](_0x36615a);try{fs[_0xb0e4('0xff')](_0x36615a+'.wav');}catch(_0x5aad01){logger[_0xb0e4('0x31')](_0x5aad01);}return _0x3bd3bd;}return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x84bdb5,_0xb0e4('0x1b9'));};AGIVertices['prototype']['tts']=function(_0x53837b){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x1ba'),_0x53837b[_0xb0e4('0x36')]));_0x53837b['text']=_0x53837b['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xb0e4('0x81')](_0x53837b[_0xb0e4('0x5a')])){return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](_0xb0e4('0xc0'));}this['channel'][_0xb0e4('0xa5')](util['format'](_0xb0e4('0x1bb'),_0x53837b[_0xb0e4('0x5a')]));var _0x39603d=this[_0xb0e4('0x5e')][_0xb0e4('0x6a')](this,_0x53837b);if(_0x39603d){this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util[_0xb0e4('0x28')]('Google\x20TTS\x20%s\x20file\x20created',_0x39603d));var _0x10be16=this['channel'][_0xb0e4('0xfe')](_0x39603d);try{fs['unlink'](_0x39603d+_0xb0e4('0x123'));}catch(_0x491b27){logger[_0xb0e4('0x31')](_0x491b27);}return _0x10be16;}return this['channel'][_0xb0e4('0x31')](_0x53837b,_0xb0e4('0x1bc'));};AGIVertices[_0xb0e4('0xe')][_0xb0e4('0x1bd')]=function(_0x5dd3e5){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x1be'),_0x5dd3e5[_0xb0e4('0x36')]));if(!this[_0xb0e4('0x81')](_0x5dd3e5['findBy'])){return this['channel'][_0xb0e4('0x31')](_0x5dd3e5,_0xb0e4('0x154'));}logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x155'),this[_0xb0e4('0xb')][_0xb0e4('0x39')],_0x5dd3e5[_0xb0e4('0x153')]));var _0x364552=this[_0xb0e4('0x4c')][_0xb0e4('0x6a')](this,_0x5dd3e5[_0xb0e4('0x153')]);if(_0x364552){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x156'),this['channel'][_0xb0e4('0x39')],_0x5dd3e5['findBy']));this['channel'][_0xb0e4('0xa5')](util['format'](_0xb0e4('0x156'),this[_0xb0e4('0xb')][_0xb0e4('0x39')],_0x5dd3e5[_0xb0e4('0x153')]));return{'code':0xc8,'result':'success'};}else{logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x158'),this['channel'][_0xb0e4('0x39')],_0x5dd3e5[_0xb0e4('0x153')]));this['channel'][_0xb0e4('0xa5')](util[_0xb0e4('0x28')](_0xb0e4('0x158'),this[_0xb0e4('0xb')][_0xb0e4('0x39')],_0x5dd3e5[_0xb0e4('0x153')]));return{'code':0xc8,'result':_0xb0e4('0x159')};}};AGIVertices['prototype'][_0xb0e4('0x1bf')]=function(_0x301d26){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x1c0'),_0x301d26['label']));var _0x35f022=this[_0xb0e4('0xb')]['exec'](_0xb0e4('0x1c1'),[_0x301d26['mailbox'],_0x301d26['options']]);if(_0x35f022[_0xb0e4('0xa0')]===-0x1){return _0x35f022;}return this[_0xb0e4('0xb')][_0xb0e4('0xa5')](util[_0xb0e4('0x28')](_0xb0e4('0xbd'),_0xb0e4('0x1c1'),_0x301d26[_0xb0e4('0x1c2')]));};AGIVertices[_0xb0e4('0xe')]['vswitch']=function(_0x117a80){logger[_0xb0e4('0x2d')](util[_0xb0e4('0x28')](_0xb0e4('0x1c3'),_0x117a80['label']));if(!this['isConfigured'](_0x117a80[_0xb0e4('0xd1')])){return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x117a80,'no\x20variable\x20selected');}var _0x4d8b09=this['getVariable'][_0xb0e4('0x6a')](this,_0x117a80[_0xb0e4('0xd1')]);if(!_0x4d8b09){return this[_0xb0e4('0xb')][_0xb0e4('0x31')](_0x117a80,'no\x20variable\x20found');}var _0x4ec417=this[_0xb0e4('0xb')][_0xb0e4('0xf')](_0x4d8b09);return{'code':0xc8,'result':_0x4ec417[_0xb0e4('0x9d')]?_0x4ec417[_0xb0e4('0x9d')]:'-'};};String[_0xb0e4('0xe')][_0xb0e4('0x9c')]=function(_0x3b7139,_0x677493){return this['split'](_0x3b7139)[_0xb0e4('0x1c4')](_0x677493);};module[_0xb0e4('0x1c5')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 2224096..e4fa3aa 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 _0x9957=['then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','message','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','queue','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','getAgent'];(function(_0x2c88dc,_0x57fbc3){var _0x44070e=function(_0x270231){while(--_0x270231){_0x2c88dc['push'](_0x2c88dc['shift']());}};_0x44070e(++_0x57fbc3);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var util=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var ami=require(_0x7995('0x3'));var logger=require('../../../config/logger')(_0x7995('0x4'));var RpcUser=require(_0x7995('0x5'));var RpcVoiceAgentReport=require(_0x7995('0x6'));function Acw(_0x462a03){this['voiceQueues']=_0x462a03[_0x7995('0x7')];this[_0x7995('0x8')]=_0x462a03[_0x7995('0x8')];this[_0x7995('0x9')]=_0x462a03[_0x7995('0x9')];this[_0x7995('0xa')]={};ami['on']('agentconnect',this[_0x7995('0xb')][_0x7995('0xc')](this));ami['on']('hanguprequest',this[_0x7995('0xd')][_0x7995('0xc')](this));ami['on'](_0x7995('0xe'),this[_0x7995('0xf')][_0x7995('0xc')](this));ami['on'](_0x7995('0x10'),this[_0x7995('0x11')]['bind'](this));ami['on'](_0x7995('0x12'),this[_0x7995('0x13')]['bind'](this));ami['on'](_0x7995('0x14'),this[_0x7995('0x15')][_0x7995('0xc')](this));ami['on'](_0x7995('0x16'),this[_0x7995('0x17')][_0x7995('0xc')](this));}function getDiff(_0x2bbe7a){var _0x4cc004=moment()['milliseconds'](0x0);var _0x2b4e94=moment(_0x2bbe7a)[_0x7995('0x18')](0x0);return _0x4cc004[_0x7995('0x19')](_0x2b4e94,_0x7995('0x1a'));}Acw[_0x7995('0x1b')][_0x7995('0x1c')]=function(_0x2202ce){try{var _0x41cbf0=this;var _0x5377e5=this[_0x7995('0xa')][_0x2202ce]['interface'];var _0x2f832e=this[_0x7995('0xa')][_0x2202ce][_0x7995('0x1d')];var _0x291317=this[_0x7995('0x7')][_0x2f832e];var _0x37a7d4=![];var _0x4faa60='ACW';if(_0x291317[_0x7995('0x1e')]){if(_0x291317['mandatoryDispositionPause']['name']){_0x37a7d4=!![];_0x4faa60=_0x291317[_0x7995('0x1f')][_0x7995('0x20')];}}ami['Action']({'action':_0x7995('0x21'),'interface':_0x5377e5,'paused':!![],'reason':_0x4faa60})['then'](function(_0x4b1a8e){if(_0x41cbf0[_0x7995('0x8')][_0x5377e5]){return RpcUser[_0x7995('0x22')](_0x41cbf0[_0x7995('0x8')][_0x5377e5]['id'])[_0x7995('0x23')](function(_0x460924){if(_0x460924&&!_0x460924[_0x7995('0x24')]){logger['info'](_0x7995('0x25'),_0x2202ce,_0x5377e5,_0x2f832e);var _0x46ee4b=_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x26')]&&_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x27')]?_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x27')]:_0x2202ce;return RpcUser['savePause'](_0x41cbf0[_0x7995('0x8')][_0x5377e5],_0x4faa60,_0x46ee4b)[_0x7995('0x23')](function(_0x401dc3){if(!_0x37a7d4){_0x41cbf0[_0x7995('0x9')][_0x5377e5]={};logger[_0x7995('0x28')](_0x7995('0x29'),_0x2202ce,_0x41cbf0['voiceQueues'][_0x2f832e][_0x7995('0x2a')],_0x5377e5,_0x2f832e);_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2b')]=setTimeout(_0x41cbf0[_0x7995('0x2c')][_0x7995('0xc')](_0x41cbf0,_0x5377e5),_0x41cbf0[_0x7995('0x7')][_0x2f832e][_0x7995('0x2a')]*0x3e8);_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2d')]=moment()['format'](_0x7995('0x2e'));_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2f')]=_0x2202ce;_0x41cbf0['timers'][_0x5377e5]['queue']=_0x2f832e;_0x41cbf0['timers'][_0x5377e5][_0x7995('0x30')]=function(){var _0xe6b0b3=getDiff(_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2d')]);clearTimeout(_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2b')]);_0x41cbf0['timers'][_0x5377e5]['timer']=![];RpcVoiceAgentReport[_0x7995('0x31')]({'acwtime':_0xe6b0b3},_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2f')],_0x5377e5)[_0x7995('0x23')](function(_0x29fac5){logger[_0x7995('0x28')](_0x7995('0x32'),_0x2202ce,_0xe6b0b3,_0x29fac5);})['catch'](function(_0x44309d){logger[_0x7995('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x2202ce,_0x44309d);});delete _0x41cbf0['timers'][_0x5377e5];};}});}else{logger['info'](_0x7995('0x34'),_0x2202ce,_0x5377e5,_0x2f832e);}});}})[_0x7995('0x35')](function(_0x4a176f){logger[_0x7995('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2202ce,_0x41cbf0[_0x7995('0x7')][_0x2f832e][_0x7995('0x2a')],_0x5377e5,_0x2f832e);})[_0x7995('0x36')](function(){delete _0x41cbf0['channels'][_0x2202ce];});}catch(_0x52d76d){logger[_0x7995('0x33')]('[ACW][START]\x20%s',_0x52d76d['message']);}};Acw[_0x7995('0x1b')][_0x7995('0x2c')]=function(_0x5212ff){try{var _0x1baa15=this;if(_0x1baa15[_0x7995('0x9')][_0x5212ff]){_0x1baa15[_0x7995('0x9')][_0x5212ff][_0x7995('0x2b')]=![];var _0x1e3dbf=_0x1baa15['timers'][_0x5212ff][_0x7995('0x2f')];var _0x242713=_0x1baa15[_0x7995('0x9')][_0x5212ff][_0x7995('0x1d')];var _0x4b1541=_0x1baa15[_0x7995('0x7')][_0x242713][_0x7995('0x2a')];logger[_0x7995('0x28')](_0x7995('0x37'),_0x1e3dbf,_0x5212ff);RpcUser[_0x7995('0x38')](this[_0x7995('0x8')][_0x5212ff]);RpcVoiceAgentReport['update']({'acwtime':_0x4b1541,'agentacw':!![]},_0x1e3dbf,_0x5212ff)[_0x7995('0x23')](function(_0x3be298){logger[_0x7995('0x28')](_0x7995('0x32'),_0x1e3dbf,_0x4b1541,_0x3be298);})[_0x7995('0x35')](function(_0x298fc2){logger[_0x7995('0x33')](_0x7995('0x39'),_0x1e3dbf,_0x298fc2);});}else{logger[_0x7995('0x33')](_0x7995('0x3a'),_0x5212ff);if(_0x1baa15[_0x7995('0x9')]){logger[_0x7995('0x28')](_0x7995('0x3b'),JSON['stringify'](_0x1baa15['timers']));}}}catch(_0x334dff){logger[_0x7995('0x33')]('[ACW][STOP]\x20%s',_0x334dff['message']);}};Acw[_0x7995('0x1b')]['syncAgentConnect']=function(_0x504a33){try{if(this[_0x7995('0x7')][_0x504a33[_0x7995('0x1d')]]&&(this[_0x7995('0x7')][_0x504a33['queue']][_0x7995('0x4')]||this['voiceQueues'][_0x504a33[_0x7995('0x1d')]]['mandatoryDisposition'])){if(this['agents'][_0x504a33[_0x7995('0x3c')]]){this[_0x7995('0xa')][_0x504a33[_0x7995('0x2f')]]={'queue':_0x504a33[_0x7995('0x1d')],'interface':_0x504a33['interface'],'destlinkedid':_0x504a33[_0x7995('0x27')]};}}}catch(_0x40fc68){logger[_0x7995('0x33')](_0x7995('0x3d'),_0x40fc68['message']);}};Acw['prototype'][_0x7995('0x17')]=function(_0x55791b){try{if(this[_0x7995('0x7')][_0x55791b['queue']]&&(this[_0x7995('0x7')][_0x55791b['queue']][_0x7995('0x4')]||this[_0x7995('0x7')][_0x55791b['queue']][_0x7995('0x1e')])){if(this[_0x7995('0x8')][_0x55791b[_0x7995('0x3c')]]){this[_0x7995('0xa')][_0x55791b['uniqueid']]={'queue':_0x55791b[_0x7995('0x1d')],'interface':_0x55791b[_0x7995('0x3c')]};}}}catch(_0x237270){logger['error'](_0x7995('0x3e'),_0x237270[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0xd')]=function(_0x255313){try{if(this['channels'][_0x255313[_0x7995('0x2f')]]&&_[_0x7995('0x40')](this['channels'][_0x255313[_0x7995('0x2f')]]['attended'])){logger[_0x7995('0x28')](_0x7995('0x41'),_0x255313[_0x7995('0x2f')]);this[_0x7995('0x1c')](_0x255313[_0x7995('0x2f')]);}else if(this[_0x7995('0xa')][_0x255313[_0x7995('0x42')]]&&_['isUndefined'](this[_0x7995('0xa')][_0x255313[_0x7995('0x42')]][_0x7995('0x26')])){logger['info'](_0x7995('0x43'),_0x255313[_0x7995('0x42')]);this[_0x7995('0x1c')](_0x255313['linkedid']);}}catch(_0x4ec548){logger['error'](_0x7995('0x44'),_0x4ec548[_0x7995('0x3f')]);}};Acw['prototype'][_0x7995('0xf')]=function(_0x29f300){try{if(this[_0x7995('0xa')][_0x29f300[_0x7995('0x2f')]]&&this[_0x7995('0xa')][_0x29f300['uniqueid']][_0x7995('0x26')]){logger['info'](_0x7995('0x45'),_0x29f300[_0x7995('0x2f')]);this[_0x7995('0x1c')](_0x29f300['uniqueid']);}else if(this['channels'][_0x29f300['linkedid']]&&this['channels'][_0x29f300[_0x7995('0x42')]][_0x7995('0x26')]){logger[_0x7995('0x28')](_0x7995('0x46'),_0x29f300[_0x7995('0x42')]);this[_0x7995('0x1c')](_0x29f300[_0x7995('0x42')]);}}catch(_0xda6ce8){logger[_0x7995('0x33')](_0x7995('0x47'),_0xda6ce8[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0x13')]=function(_0x35bea3){try{if(!_[_0x7995('0x48')](this[_0x7995('0xa')][_0x35bea3[_0x7995('0x49')]])){this[_0x7995('0x1c')](_0x35bea3[_0x7995('0x49')]);if(this['channels'][_0x35bea3[_0x7995('0x4a')]]){this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]][_0x7995('0x26')]=!![];this['channels'][_0x35bea3['transfertargetuniqueid']]=this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]];delete this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]];}}else if(!_['isNil'](this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4b')]])){this[_0x7995('0x1c')](_0x35bea3[_0x7995('0x4b')]);if(this['channels'][_0x35bea3['origtransfereruniqueid']]){this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]][_0x7995('0x26')]=!![];this[_0x7995('0xa')][_0x35bea3[_0x7995('0x49')]]=this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]];delete this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]];}}}catch(_0x50caf5){logger[_0x7995('0x33')](_0x7995('0x4d'),_0x50caf5[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')]['syncBlindTransfer']=function(_0x51bf6a){try{if(this[_0x7995('0xa')][_0x51bf6a[_0x7995('0x4e')]]){logger['info'](_0x7995('0x4f'),JSON[_0x7995('0x50')](_0x51bf6a[_0x7995('0x4e')]));this[_0x7995('0x1c')](_0x51bf6a[_0x7995('0x4e')]);}else if(this['channels'][_0x51bf6a[_0x7995('0x51')]]){logger['info'](_0x7995('0x52'),JSON[_0x7995('0x50')](_0x51bf6a[_0x7995('0x51')]));this[_0x7995('0x1c')](_0x51bf6a[_0x7995('0x51')]);}}catch(_0xeb8920){logger[_0x7995('0x33')](_0x7995('0x53'),_0xeb8920[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0x11')]=function(_0x234d8d){try{if(this['voiceQueues'][_0x234d8d[_0x7995('0x1d')]]&&this[_0x7995('0x7')][_0x234d8d[_0x7995('0x1d')]][_0x7995('0x54')]===_0x7995('0x55')){if(this['agents'][_0x234d8d['interface']]){logger[_0x7995('0x28')](_0x7995('0x56'),_0x234d8d[_0x7995('0x2f')],_0x234d8d[_0x7995('0x3c')],_0x234d8d['queue']);return RpcUser[_0x7995('0x57')](this['agents'][_0x234d8d['interface']],_0x7995('0x58'),_0x234d8d[_0x7995('0x2f')]);}}}catch(_0x3f0a71){logger[_0x7995('0x33')](_0x7995('0x59'),_0x3f0a71[_0x7995('0x3f')]);}};module[_0x7995('0x5a')]=Acw; \ No newline at end of file +var _0x9957=['then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','message','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','queue','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','getAgent'];(function(_0x546a83,_0x32a1fd){var _0x604e27=function(_0x315e69){while(--_0x315e69){_0x546a83['push'](_0x546a83['shift']());}};_0x604e27(++_0x32a1fd);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var ami=require(_0x7995('0x3'));var logger=require('../../../config/logger')(_0x7995('0x4'));var RpcUser=require(_0x7995('0x5'));var RpcVoiceAgentReport=require(_0x7995('0x6'));function Acw(_0x462a03){this['voiceQueues']=_0x462a03[_0x7995('0x7')];this[_0x7995('0x8')]=_0x462a03[_0x7995('0x8')];this[_0x7995('0x9')]=_0x462a03[_0x7995('0x9')];this[_0x7995('0xa')]={};ami['on']('agentconnect',this[_0x7995('0xb')][_0x7995('0xc')](this));ami['on']('hanguprequest',this[_0x7995('0xd')][_0x7995('0xc')](this));ami['on'](_0x7995('0xe'),this[_0x7995('0xf')][_0x7995('0xc')](this));ami['on'](_0x7995('0x10'),this[_0x7995('0x11')]['bind'](this));ami['on'](_0x7995('0x12'),this[_0x7995('0x13')]['bind'](this));ami['on'](_0x7995('0x14'),this[_0x7995('0x15')][_0x7995('0xc')](this));ami['on'](_0x7995('0x16'),this[_0x7995('0x17')][_0x7995('0xc')](this));}function getDiff(_0x2bbe7a){var _0x4cc004=moment()['milliseconds'](0x0);var _0x2b4e94=moment(_0x2bbe7a)[_0x7995('0x18')](0x0);return _0x4cc004[_0x7995('0x19')](_0x2b4e94,_0x7995('0x1a'));}Acw[_0x7995('0x1b')][_0x7995('0x1c')]=function(_0x2202ce){try{var _0x41cbf0=this;var _0x5377e5=this[_0x7995('0xa')][_0x2202ce]['interface'];var _0x2f832e=this[_0x7995('0xa')][_0x2202ce][_0x7995('0x1d')];var _0x291317=this[_0x7995('0x7')][_0x2f832e];var _0x37a7d4=![];var _0x4faa60='ACW';if(_0x291317[_0x7995('0x1e')]){if(_0x291317['mandatoryDispositionPause']['name']){_0x37a7d4=!![];_0x4faa60=_0x291317[_0x7995('0x1f')][_0x7995('0x20')];}}ami['Action']({'action':_0x7995('0x21'),'interface':_0x5377e5,'paused':!![],'reason':_0x4faa60})['then'](function(_0x4b1a8e){if(_0x41cbf0[_0x7995('0x8')][_0x5377e5]){return RpcUser[_0x7995('0x22')](_0x41cbf0[_0x7995('0x8')][_0x5377e5]['id'])[_0x7995('0x23')](function(_0x460924){if(_0x460924&&!_0x460924[_0x7995('0x24')]){logger['info'](_0x7995('0x25'),_0x2202ce,_0x5377e5,_0x2f832e);var _0x46ee4b=_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x26')]&&_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x27')]?_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x27')]:_0x2202ce;return RpcUser['savePause'](_0x41cbf0[_0x7995('0x8')][_0x5377e5],_0x4faa60,_0x46ee4b)[_0x7995('0x23')](function(_0x401dc3){if(!_0x37a7d4){_0x41cbf0[_0x7995('0x9')][_0x5377e5]={};logger[_0x7995('0x28')](_0x7995('0x29'),_0x2202ce,_0x41cbf0['voiceQueues'][_0x2f832e][_0x7995('0x2a')],_0x5377e5,_0x2f832e);_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2b')]=setTimeout(_0x41cbf0[_0x7995('0x2c')][_0x7995('0xc')](_0x41cbf0,_0x5377e5),_0x41cbf0[_0x7995('0x7')][_0x2f832e][_0x7995('0x2a')]*0x3e8);_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2d')]=moment()['format'](_0x7995('0x2e'));_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2f')]=_0x2202ce;_0x41cbf0['timers'][_0x5377e5]['queue']=_0x2f832e;_0x41cbf0['timers'][_0x5377e5][_0x7995('0x30')]=function(){var _0xe6b0b3=getDiff(_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2d')]);clearTimeout(_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2b')]);_0x41cbf0['timers'][_0x5377e5]['timer']=![];RpcVoiceAgentReport[_0x7995('0x31')]({'acwtime':_0xe6b0b3},_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2f')],_0x5377e5)[_0x7995('0x23')](function(_0x29fac5){logger[_0x7995('0x28')](_0x7995('0x32'),_0x2202ce,_0xe6b0b3,_0x29fac5);})['catch'](function(_0x44309d){logger[_0x7995('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x2202ce,_0x44309d);});delete _0x41cbf0['timers'][_0x5377e5];};}});}else{logger['info'](_0x7995('0x34'),_0x2202ce,_0x5377e5,_0x2f832e);}});}})[_0x7995('0x35')](function(_0x4a176f){logger[_0x7995('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2202ce,_0x41cbf0[_0x7995('0x7')][_0x2f832e][_0x7995('0x2a')],_0x5377e5,_0x2f832e);})[_0x7995('0x36')](function(){delete _0x41cbf0['channels'][_0x2202ce];});}catch(_0x52d76d){logger[_0x7995('0x33')]('[ACW][START]\x20%s',_0x52d76d['message']);}};Acw[_0x7995('0x1b')][_0x7995('0x2c')]=function(_0x5212ff){try{var _0x1baa15=this;if(_0x1baa15[_0x7995('0x9')][_0x5212ff]){_0x1baa15[_0x7995('0x9')][_0x5212ff][_0x7995('0x2b')]=![];var _0x1e3dbf=_0x1baa15['timers'][_0x5212ff][_0x7995('0x2f')];var _0x242713=_0x1baa15[_0x7995('0x9')][_0x5212ff][_0x7995('0x1d')];var _0x4b1541=_0x1baa15[_0x7995('0x7')][_0x242713][_0x7995('0x2a')];logger[_0x7995('0x28')](_0x7995('0x37'),_0x1e3dbf,_0x5212ff);RpcUser[_0x7995('0x38')](this[_0x7995('0x8')][_0x5212ff]);RpcVoiceAgentReport['update']({'acwtime':_0x4b1541,'agentacw':!![]},_0x1e3dbf,_0x5212ff)[_0x7995('0x23')](function(_0x3be298){logger[_0x7995('0x28')](_0x7995('0x32'),_0x1e3dbf,_0x4b1541,_0x3be298);})[_0x7995('0x35')](function(_0x298fc2){logger[_0x7995('0x33')](_0x7995('0x39'),_0x1e3dbf,_0x298fc2);});}else{logger[_0x7995('0x33')](_0x7995('0x3a'),_0x5212ff);if(_0x1baa15[_0x7995('0x9')]){logger[_0x7995('0x28')](_0x7995('0x3b'),JSON['stringify'](_0x1baa15['timers']));}}}catch(_0x334dff){logger[_0x7995('0x33')]('[ACW][STOP]\x20%s',_0x334dff['message']);}};Acw[_0x7995('0x1b')]['syncAgentConnect']=function(_0x504a33){try{if(this[_0x7995('0x7')][_0x504a33[_0x7995('0x1d')]]&&(this[_0x7995('0x7')][_0x504a33['queue']][_0x7995('0x4')]||this['voiceQueues'][_0x504a33[_0x7995('0x1d')]]['mandatoryDisposition'])){if(this['agents'][_0x504a33[_0x7995('0x3c')]]){this[_0x7995('0xa')][_0x504a33[_0x7995('0x2f')]]={'queue':_0x504a33[_0x7995('0x1d')],'interface':_0x504a33['interface'],'destlinkedid':_0x504a33[_0x7995('0x27')]};}}}catch(_0x40fc68){logger[_0x7995('0x33')](_0x7995('0x3d'),_0x40fc68['message']);}};Acw['prototype'][_0x7995('0x17')]=function(_0x55791b){try{if(this[_0x7995('0x7')][_0x55791b['queue']]&&(this[_0x7995('0x7')][_0x55791b['queue']][_0x7995('0x4')]||this[_0x7995('0x7')][_0x55791b['queue']][_0x7995('0x1e')])){if(this[_0x7995('0x8')][_0x55791b[_0x7995('0x3c')]]){this[_0x7995('0xa')][_0x55791b['uniqueid']]={'queue':_0x55791b[_0x7995('0x1d')],'interface':_0x55791b[_0x7995('0x3c')]};}}}catch(_0x237270){logger['error'](_0x7995('0x3e'),_0x237270[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0xd')]=function(_0x255313){try{if(this['channels'][_0x255313[_0x7995('0x2f')]]&&_[_0x7995('0x40')](this['channels'][_0x255313[_0x7995('0x2f')]]['attended'])){logger[_0x7995('0x28')](_0x7995('0x41'),_0x255313[_0x7995('0x2f')]);this[_0x7995('0x1c')](_0x255313[_0x7995('0x2f')]);}else if(this[_0x7995('0xa')][_0x255313[_0x7995('0x42')]]&&_['isUndefined'](this[_0x7995('0xa')][_0x255313[_0x7995('0x42')]][_0x7995('0x26')])){logger['info'](_0x7995('0x43'),_0x255313[_0x7995('0x42')]);this[_0x7995('0x1c')](_0x255313['linkedid']);}}catch(_0x4ec548){logger['error'](_0x7995('0x44'),_0x4ec548[_0x7995('0x3f')]);}};Acw['prototype'][_0x7995('0xf')]=function(_0x29f300){try{if(this[_0x7995('0xa')][_0x29f300[_0x7995('0x2f')]]&&this[_0x7995('0xa')][_0x29f300['uniqueid']][_0x7995('0x26')]){logger['info'](_0x7995('0x45'),_0x29f300[_0x7995('0x2f')]);this[_0x7995('0x1c')](_0x29f300['uniqueid']);}else if(this['channels'][_0x29f300['linkedid']]&&this['channels'][_0x29f300[_0x7995('0x42')]][_0x7995('0x26')]){logger[_0x7995('0x28')](_0x7995('0x46'),_0x29f300[_0x7995('0x42')]);this[_0x7995('0x1c')](_0x29f300[_0x7995('0x42')]);}}catch(_0xda6ce8){logger[_0x7995('0x33')](_0x7995('0x47'),_0xda6ce8[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0x13')]=function(_0x35bea3){try{if(!_[_0x7995('0x48')](this[_0x7995('0xa')][_0x35bea3[_0x7995('0x49')]])){this[_0x7995('0x1c')](_0x35bea3[_0x7995('0x49')]);if(this['channels'][_0x35bea3[_0x7995('0x4a')]]){this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]][_0x7995('0x26')]=!![];this['channels'][_0x35bea3['transfertargetuniqueid']]=this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]];delete this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]];}}else if(!_['isNil'](this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4b')]])){this[_0x7995('0x1c')](_0x35bea3[_0x7995('0x4b')]);if(this['channels'][_0x35bea3['origtransfereruniqueid']]){this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]][_0x7995('0x26')]=!![];this[_0x7995('0xa')][_0x35bea3[_0x7995('0x49')]]=this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]];delete this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]];}}}catch(_0x50caf5){logger[_0x7995('0x33')](_0x7995('0x4d'),_0x50caf5[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')]['syncBlindTransfer']=function(_0x51bf6a){try{if(this[_0x7995('0xa')][_0x51bf6a[_0x7995('0x4e')]]){logger['info'](_0x7995('0x4f'),JSON[_0x7995('0x50')](_0x51bf6a[_0x7995('0x4e')]));this[_0x7995('0x1c')](_0x51bf6a[_0x7995('0x4e')]);}else if(this['channels'][_0x51bf6a[_0x7995('0x51')]]){logger['info'](_0x7995('0x52'),JSON[_0x7995('0x50')](_0x51bf6a[_0x7995('0x51')]));this[_0x7995('0x1c')](_0x51bf6a[_0x7995('0x51')]);}}catch(_0xeb8920){logger[_0x7995('0x33')](_0x7995('0x53'),_0xeb8920[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0x11')]=function(_0x234d8d){try{if(this['voiceQueues'][_0x234d8d[_0x7995('0x1d')]]&&this[_0x7995('0x7')][_0x234d8d[_0x7995('0x1d')]][_0x7995('0x54')]===_0x7995('0x55')){if(this['agents'][_0x234d8d['interface']]){logger[_0x7995('0x28')](_0x7995('0x56'),_0x234d8d[_0x7995('0x2f')],_0x234d8d[_0x7995('0x3c')],_0x234d8d['queue']);return RpcUser[_0x7995('0x57')](this['agents'][_0x234d8d['interface']],_0x7995('0x58'),_0x234d8d[_0x7995('0x2f')]);}}}catch(_0x3f0a71){logger[_0x7995('0x33')](_0x7995('0x59'),_0x3f0a71[_0x7995('0x3f')]);}};module[_0x7995('0x5a')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 68a7171..d752b85 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 _0x000f=['connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','catch','log','error','exports','asterisk-manager','bluebird','moment','lodash','../../config/logger','ami','../../config/environment','port','asterisk','keepConnected','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close'];(function(_0x487ab4,_0x1e24e8){var _0x3bef77=function(_0x5ce664){while(--_0x5ce664){_0x487ab4['push'](_0x487ab4['shift']());}};_0x3bef77(++_0x1e24e8);}(_0x000f,0x1c3));var _0xf000=function(_0x5abf5e,_0x218efc){_0x5abf5e=_0x5abf5e-0x0;var _0x5dc13a=_0x000f[_0x5abf5e];return _0x5dc13a;};'use strict';var Manager=require(_0xf000('0x0'));var BPromise=require(_0xf000('0x1'));var moment=require(_0xf000('0x2'));var util=require('util');var _=require(_0xf000('0x3'));var logger=require(_0xf000('0x4'))(_0xf000('0x5'));var config=require(_0xf000('0x6'));var ami=new Manager(config['asterisk'][_0xf000('0x7')],config[_0xf000('0x8')]['ip'],config[_0xf000('0x8')]['username'],config[_0xf000('0x8')]['password'],!![]);ami[_0xf000('0x9')]();ami[_0xf000('0xa')]=BPromise[_0xf000('0xb')](ami[_0xf000('0xc')]);function error(_0x4fd976){logger['error'](util[_0xf000('0xd')](_0xf000('0xe'),config[_0xf000('0x8')][_0xf000('0xf')],config[_0xf000('0x8')]['ip'],config[_0xf000('0x8')]['port'],util[_0xf000('0x10')](_0x4fd976,![],null)));}function close(){logger['error'](util[_0xf000('0xd')](_0xf000('0x11'),config[_0xf000('0x8')][_0xf000('0xf')],config['asterisk']['ip'],config[_0xf000('0x8')][_0xf000('0x7')]));}ami[_0xf000('0x12')]=function(){return function(){return ami[_0xf000('0xa')]({'action':_0xf000('0x13')});};};ami[_0xf000('0x14')]=function(){return function(){return ami['Action']({'action':_0xf000('0x15')});};};ami[_0xf000('0x16')]=function(){return function(){return ami[_0xf000('0xa')]({'action':'sippeerstatus'});};};ami[_0xf000('0x17')]=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xf000('0xa')]({'action':_0xf000('0x18')});};};function connect(_0x1132cf){logger[_0xf000('0x19')](util[_0xf000('0xd')](_0xf000('0x1a'),config['asterisk'][_0xf000('0xf')],config['asterisk']['ip'],config[_0xf000('0x8')][_0xf000('0x7')]));ami[_0xf000('0x1b')]('error',error);ami[_0xf000('0x1b')](_0xf000('0x1c'),close);}ami['on'](_0xf000('0x1d'),connect);ami['on'](_0xf000('0x1e'),function(_0x5a0930){logger['info'](util['format'](_0xf000('0x1f'),config[_0xf000('0x8')][_0xf000('0xf')],config[_0xf000('0x8')]['ip'],config[_0xf000('0x8')][_0xf000('0x7')],util[_0xf000('0x10')](_0x5a0930,![],null)));});ami['on']('fullybooted',function(_0x25eb17){logger[_0xf000('0x19')](util[_0xf000('0xd')](_0xf000('0x20'),config[_0xf000('0x8')][_0xf000('0xf')],config[_0xf000('0x8')]['ip'],config[_0xf000('0x8')]['port']));return BPromise[_0xf000('0x21')]()[_0xf000('0x22')](ami['actionSipShowRegistry']())[_0xf000('0x22')](ami[_0xf000('0x14')]())[_0xf000('0x22')](ami['actionSipPeerStatus']())[_0xf000('0x22')](ami[_0xf000('0x17')]())[_0xf000('0x22')](ami[_0xf000('0x23')]())[_0xf000('0x24')](function(_0x158410){console[_0xf000('0x25')](_0x158410);});});ami[_0xf000('0x1b')](_0xf000('0x26'),error);ami[_0xf000('0x1b')](_0xf000('0x1c'),close);module[_0xf000('0x27')]=ami; \ No newline at end of file +var _0x895d=['log','once','exports','asterisk-manager','moment','util','lodash','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','connect','shutdown','fullybooted','resolve','then','actionQueueSummary'];(function(_0x158ffd,_0x4ddd42){var _0xa3f69c=function(_0x3d11f7){while(--_0x3d11f7){_0x158ffd['push'](_0x158ffd['shift']());}};_0xa3f69c(++_0x4ddd42);}(_0x895d,0x8f));var _0xd895=function(_0x510fe7,_0x1f48ec){_0x510fe7=_0x510fe7-0x0;var _0x18240b=_0x895d[_0x510fe7];return _0x18240b;};'use strict';var Manager=require(_0xd895('0x0'));var BPromise=require('bluebird');var moment=require(_0xd895('0x1'));var util=require(_0xd895('0x2'));var _=require(_0xd895('0x3'));var logger=require(_0xd895('0x4'))(_0xd895('0x5'));var config=require('../../config/environment');var ami=new Manager(config[_0xd895('0x6')][_0xd895('0x7')],config[_0xd895('0x6')]['ip'],config[_0xd895('0x6')][_0xd895('0x8')],config['asterisk'][_0xd895('0x9')],!![]);ami[_0xd895('0xa')]();ami[_0xd895('0xb')]=BPromise[_0xd895('0xc')](ami['action']);function error(_0x3eeede){logger[_0xd895('0xd')](util[_0xd895('0xe')](_0xd895('0xf'),config['asterisk'][_0xd895('0x8')],config[_0xd895('0x6')]['ip'],config['asterisk'][_0xd895('0x7')],util[_0xd895('0x10')](_0x3eeede,![],null)));}function close(){logger[_0xd895('0xd')](util['format'](_0xd895('0x11'),config[_0xd895('0x6')][_0xd895('0x8')],config['asterisk']['ip'],config[_0xd895('0x6')][_0xd895('0x7')]));}ami[_0xd895('0x12')]=function(){return function(){return ami[_0xd895('0xb')]({'action':'sipshowregistry'});};};ami[_0xd895('0x13')]=function(){return function(){return ami[_0xd895('0xb')]({'action':_0xd895('0x14')});};};ami[_0xd895('0x15')]=function(){return function(){return ami[_0xd895('0xb')]({'action':'sippeerstatus'});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xd895('0xb')]({'action':_0xd895('0x16')});};};ami[_0xd895('0x17')]=function(){return function(){return ami['Action']({'action':_0xd895('0x18')});};};function connect(_0x1f07b8){logger[_0xd895('0x19')](util[_0xd895('0xe')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xd895('0x6')][_0xd895('0x8')],config['asterisk']['ip'],config[_0xd895('0x6')][_0xd895('0x7')]));ami['once'](_0xd895('0xd'),error);ami['once']('close',close);}ami['on'](_0xd895('0x1a'),connect);ami['on'](_0xd895('0x1b'),function(_0x50b33f){logger[_0xd895('0x19')](util[_0xd895('0xe')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xd895('0x8')],config[_0xd895('0x6')]['ip'],config[_0xd895('0x6')][_0xd895('0x7')],util['inspect'](_0x50b33f,![],null)));});ami['on'](_0xd895('0x1c'),function(_0x294bca){logger['info'](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xd895('0x6')]['username'],config[_0xd895('0x6')]['ip'],config['asterisk'][_0xd895('0x7')]));return BPromise[_0xd895('0x1d')]()[_0xd895('0x1e')](ami[_0xd895('0x12')]())[_0xd895('0x1e')](ami[_0xd895('0x13')]())[_0xd895('0x1e')](ami[_0xd895('0x15')]())['then'](ami[_0xd895('0x1f')]())['then'](ami[_0xd895('0x17')]())['catch'](function(_0x4c8c04){console[_0xd895('0x20')](_0x4c8c04);});});ami[_0xd895('0x21')]('error',error);ami[_0xd895('0x21')]('close',close);module[_0xd895('0x22')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 8498d1b..c66c944 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 _0x68e4=['bluebird','ami','client','request','then','debug','rpc','memberReport','error','message','result','catch','jayson/promise'];(function(_0x4a2814,_0x13e0ed){var _0x327cdb=function(_0x4c62ec){while(--_0x4c62ec){_0x4a2814['push'](_0x4a2814['shift']());}};_0x327cdb(++_0x13e0ed);}(_0x68e4,0xf6));var _0x468e=function(_0x4d0f90,_0x23ffee){_0x4d0f90=_0x4d0f90-0x0;var _0x112227=_0x68e4[_0x4d0f90];return _0x112227;};'use strict';var jayson=require(_0x468e('0x0'));var BPromise=require(_0x468e('0x1'));var logger=require('../../config/logger')(_0x468e('0x2'));var client=jayson[_0x468e('0x3')]['http']({'port':0x2329});client['Request']=function(_0x5668bf,_0x157234){return new BPromise(function(_0x12d29a,_0x52786b){return client[_0x468e('0x4')](_0x5668bf,_0x157234)[_0x468e('0x5')](function(_0x3fdff8){logger[_0x468e('0x6')](_0x468e('0x7'),_0x468e('0x8'),_0x5668bf,_0x157234,_0x3fdff8);if(_0x3fdff8[_0x468e('0x9')]){logger[_0x468e('0x9')](_0x468e('0x7'),_0x468e('0x8'),_0x5668bf,_0x3fdff8['error'][_0x468e('0xa')],_0x157234);return _0x52786b(_0x3fdff8[_0x468e('0x9')][_0x468e('0xa')]);}else{return _0x12d29a(_0x3fdff8[_0x468e('0xb')]);}})[_0x468e('0xc')](function(_0x1cc837){logger[_0x468e('0x9')](_0x468e('0x7'),_0x468e('0x8'),_0x5668bf,_0x1cc837,_0x157234);return _0x52786b(_0x1cc837);});});};module['exports']=client; \ No newline at end of file +var _0x1315=['debug','rpc','memberReport','error','message','catch','exports','bluebird','../../config/logger','ami','client','http','Request','request','then'];(function(_0x3a3e9d,_0x342509){var _0x4046d5=function(_0x1f2adb){while(--_0x1f2adb){_0x3a3e9d['push'](_0x3a3e9d['shift']());}};_0x4046d5(++_0x342509);}(_0x1315,0x70));var _0x5131=function(_0x11b831,_0xef73c8){_0x11b831=_0x11b831-0x0;var _0x22c1b0=_0x1315[_0x11b831];return _0x22c1b0;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x5131('0x0'));var logger=require(_0x5131('0x1'))(_0x5131('0x2'));var client=jayson[_0x5131('0x3')][_0x5131('0x4')]({'port':0x2329});client[_0x5131('0x5')]=function(_0x1e6e39,_0x4a1f49){return new BPromise(function(_0x33301f,_0x227a06){return client[_0x5131('0x6')](_0x1e6e39,_0x4a1f49)[_0x5131('0x7')](function(_0x26538f){logger[_0x5131('0x8')](_0x5131('0x9'),_0x5131('0xa'),_0x1e6e39,_0x4a1f49,_0x26538f);if(_0x26538f['error']){logger[_0x5131('0xb')](_0x5131('0x9'),_0x5131('0xa'),_0x1e6e39,_0x26538f[_0x5131('0xb')]['message'],_0x4a1f49);return _0x227a06(_0x26538f[_0x5131('0xb')][_0x5131('0xc')]);}else{return _0x33301f(_0x26538f['result']);}})[_0x5131('0xd')](function(_0x5c1a12){logger[_0x5131('0xb')](_0x5131('0x9'),'memberReport',_0x1e6e39,_0x5c1a12,_0x4a1f49);return _0x227a06(_0x5c1a12);});});};module[_0x5131('0xe')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index c12184c..7e847c0 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 _0x8829=['callbackat','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','util','moment','string','isNil','voiceQueue','uniqueid','name','Contact','firstName','lastName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid'];(function(_0x5e8e1a,_0x1e29dc){var _0x38ae18=function(_0x349675){while(--_0x349675){_0x5e8e1a['push'](_0x5e8e1a['shift']());}};_0x38ae18(++_0x1e29dc);}(_0x8829,0x195));var _0x9882=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8829[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x9882('0x0'));var _=require('lodash');var moment=require(_0x9882('0x1'));function checkNameSurname(_0x15baac,_0x520082,_0x192b3d){var _0x29a899='';if(!_['isNil'](_0x520082)&&_0x9882('0x2')===typeof _0x520082){_0x29a899+=_0x520082;}if(!_[_0x9882('0x3')](_0x192b3d)&&_0x9882('0x2')===typeof _0x192b3d){_0x29a899+='\x20'+_0x192b3d;}if(_0x29a899!==''){return _0x29a899;}return _0x15baac;}function Action(_0x5b84b2,_0x2fb7ba,_0x376266){this[_0x9882('0x4')]=_0x5b84b2;this[_0x9882('0x5')]=_0x376266||undefined;this[_0x9882('0x6')]=checkNameSurname(_0x2fb7ba[_0x9882('0x7')]['phone'],_0x2fb7ba[_0x9882('0x7')][_0x9882('0x8')],_0x2fb7ba['Contact'][_0x9882('0x9')]);this[_0x9882('0xa')]=_0x2fb7ba['Contact'][_0x9882('0xb')];this[_0x9882('0xc')]=_0x5b84b2['name'];this[_0x9882('0xd')]=_0x2fb7ba['active']||![];this[_0x9882('0xe')]=_0x5b84b2[_0x9882('0xe')];this[_0x9882('0xf')]=_0x5b84b2['dialQueueTimeout']||0x3;this[_0x9882('0x10')]=_0x2fb7ba[_0x9882('0x10')];this[_0x9882('0x11')]=_0x2fb7ba['countbusyretry'];this['countcongestionretry']=_0x2fb7ba[_0x9882('0x12')];this['countnoanswerretry']=_0x2fb7ba[_0x9882('0x13')];this[_0x9882('0x14')]=_0x2fb7ba['countnosuchnumberretry'];this[_0x9882('0x15')]=_0x2fb7ba[_0x9882('0x15')];this[_0x9882('0x16')]=_0x2fb7ba[_0x9882('0x16')];this['countmachineretry']=_0x2fb7ba['countmachineretry'];this[_0x9882('0x17')]=_0x2fb7ba[_0x9882('0x17')];this[_0x9882('0x18')]=_0x2fb7ba['ContactId'];this['ListId']=_0x2fb7ba[_0x9882('0x19')];this[_0x9882('0x1a')]=_0x2fb7ba[_0x9882('0x1a')];this[_0x9882('0x1b')]=_0x2fb7ba[_0x9882('0x1b')];this[_0x9882('0x1c')]=_0x2fb7ba[_0x9882('0x1c')];this[_0x9882('0x1d')]=_0x2fb7ba['id'];this[_0x9882('0x1e')]=_0x2fb7ba[_0x9882('0x7')]['firstName']||'';this['starttime']=moment()[_0x9882('0x1f')](_0x9882('0x20'));this[_0x9882('0x21')]=_0x2fb7ba[_0x9882('0x21')];this[_0x9882('0x22')]=_0x2fb7ba['callbackuniqueid'];this[_0x9882('0x23')]=_0x2fb7ba[_0x9882('0x23')];this['recallme']=_0x2fb7ba['recallme'];this[_0x9882('0x24')]='';this[_0x9882('0x25')]='';}Action[_0x9882('0x26')][_0x9882('0x27')]=function(){return util['format'](_0x9882('0x28'),this['name'],this['voiceQueue'][_0x9882('0x29')]>0x0?this[_0x9882('0xa')][_0x9882('0x2a')](this[_0x9882('0x4')][_0x9882('0x29')]):this[_0x9882('0xa')]);};Action[_0x9882('0x26')][_0x9882('0x2b')]=function(){return this[_0x9882('0xc')];};module['exports']=Action; \ No newline at end of file +var _0x6170=['dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','format','dialCutDigit','prototype','getQueue','exports','util','lodash','moment','isNil','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type'];(function(_0x4bfd0b,_0x4cd193){var _0x1020d7=function(_0x2ed88e){while(--_0x2ed88e){_0x4bfd0b['push'](_0x4bfd0b['shift']());}};_0x1020d7(++_0x4cd193);}(_0x6170,0x17d));var _0x0617=function(_0x2faedf,_0x1f7817){_0x2faedf=_0x2faedf-0x0;var _0x13859b=_0x6170[_0x2faedf];return _0x13859b;};'use strict';var util=require(_0x0617('0x0'));var _=require(_0x0617('0x1'));var moment=require(_0x0617('0x2'));function checkNameSurname(_0xc7e162,_0x532d4e,_0x1b262d){var _0x321093='';if(!_[_0x0617('0x3')](_0x532d4e)&&'string'===typeof _0x532d4e){_0x321093+=_0x532d4e;}if(!_['isNil'](_0x1b262d)&&'string'===typeof _0x1b262d){_0x321093+='\x20'+_0x1b262d;}if(_0x321093!==''){return _0x321093;}return _0xc7e162;}function Action(_0xf7b877,_0x4cb118,_0x3bffba){this[_0x0617('0x4')]=_0xf7b877;this[_0x0617('0x5')]=_0x3bffba||undefined;this[_0x0617('0x6')]=checkNameSurname(_0x4cb118[_0x0617('0x7')][_0x0617('0x8')],_0x4cb118[_0x0617('0x7')][_0x0617('0x9')],_0x4cb118[_0x0617('0x7')][_0x0617('0xa')]);this[_0x0617('0xb')]=_0x4cb118['Contact'][_0x0617('0x8')];this[_0x0617('0xc')]=_0xf7b877[_0x0617('0x6')];this['active']=_0x4cb118[_0x0617('0xd')]||![];this[_0x0617('0xe')]=_0xf7b877[_0x0617('0xe')];this['dialQueueTimeout']=_0xf7b877[_0x0617('0xf')]||0x3;this[_0x0617('0x10')]=_0x4cb118[_0x0617('0x10')];this[_0x0617('0x11')]=_0x4cb118[_0x0617('0x11')];this[_0x0617('0x12')]=_0x4cb118[_0x0617('0x12')];this['countnoanswerretry']=_0x4cb118[_0x0617('0x13')];this['countnosuchnumberretry']=_0x4cb118['countnosuchnumberretry'];this[_0x0617('0x14')]=_0x4cb118[_0x0617('0x14')];this[_0x0617('0x15')]=_0x4cb118[_0x0617('0x15')];this[_0x0617('0x16')]=_0x4cb118['countmachineretry'];this['countagentrejectretry']=_0x4cb118[_0x0617('0x17')];this[_0x0617('0x18')]=_0x4cb118[_0x0617('0x18')];this[_0x0617('0x19')]=_0x4cb118[_0x0617('0x19')];this[_0x0617('0x1a')]=_0x4cb118[_0x0617('0x1a')];this[_0x0617('0x1b')]=_0x4cb118[_0x0617('0x1b')];this['CampaignId']=_0x4cb118[_0x0617('0x1c')];this[_0x0617('0x1d')]=_0x4cb118['id'];this[_0x0617('0x1e')]=_0x4cb118['Contact'][_0x0617('0x9')]||'';this[_0x0617('0x1f')]=moment()['format'](_0x0617('0x20'));this[_0x0617('0x21')]=_0x4cb118['callback'];this[_0x0617('0x22')]=_0x4cb118[_0x0617('0x22')];this['callbackat']=_0x4cb118[_0x0617('0x23')];this[_0x0617('0x24')]=_0x4cb118[_0x0617('0x24')];this[_0x0617('0x25')]='';this['originatecalleridname']='';}Action['prototype'][_0x0617('0x26')]=function(){return util[_0x0617('0x27')]('\x22%s\x22\x20<%s>',this[_0x0617('0x6')],this[_0x0617('0x4')]['dialCutDigit']>0x0?this[_0x0617('0xb')]['substring'](this[_0x0617('0x4')][_0x0617('0x28')]):this[_0x0617('0xb')]);};Action[_0x0617('0x29')][_0x0617('0x2a')]=function(){return this[_0x0617('0xc')];};module[_0x0617('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 61cc173..beb5490 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 _0x4c4a=['callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','milliseconds','diff','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','holdtime','membername','reason','callback','callbackuniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c4a,0x1e8));var _0xa4c4=function(_0x295830,_0x3a1467){_0x295830=_0x295830-0x0;var _0xecd1c3=_0x4c4a[_0x295830];return _0xecd1c3;};'use strict';var util=require(_0xa4c4('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x5c3d8b,_0x287246){var _0x3a4357=moment(_0x5c3d8b)[_0xa4c4('0x1')](0x0);var _0x2e00bb=moment(_0x287246)[_0xa4c4('0x1')](0x0);return _0x3a4357[_0xa4c4('0x2')](_0x2e00bb,'seconds');}function AgentComplete(_0x31f98c,_0x1a5108){this['state']=0x4;this[_0xa4c4('0x3')]=_0xa4c4('0x4');this[_0xa4c4('0x5')]=_0x31f98c['scheduledat'];this[_0xa4c4('0x6')]=_0x31f98c[_0xa4c4('0x6')];this[_0xa4c4('0x7')]=_0x31f98c[_0xa4c4('0x6')]===_0xa4c4('0x8')?_0xa4c4('0x9'):_0x31f98c[_0xa4c4('0x6')];this[_0xa4c4('0xa')]=_0x31f98c[_0xa4c4('0xa')];this[_0xa4c4('0xb')]=_0x31f98c[_0xa4c4('0xb')];this['countnoanswerretry']=_0x31f98c[_0xa4c4('0xc')];this[_0xa4c4('0xd')]=_0x31f98c[_0xa4c4('0xa')]+_0x31f98c[_0xa4c4('0xb')]+_0x31f98c[_0xa4c4('0xc')]+_0x31f98c[_0xa4c4('0xe')]+_0x31f98c[_0xa4c4('0xf')]+_0x31f98c[_0xa4c4('0x10')]+_0x31f98c[_0xa4c4('0x11')]+_0x31f98c[_0xa4c4('0x12')];this[_0xa4c4('0xe')]=_0x31f98c[_0xa4c4('0xe')];this[_0xa4c4('0xf')]=_0x31f98c[_0xa4c4('0xf')];this[_0xa4c4('0x10')]=_0x31f98c['countabandonedretry'];this[_0xa4c4('0x11')]=_0x31f98c[_0xa4c4('0x11')];this[_0xa4c4('0x12')]=_0x31f98c[_0xa4c4('0x12')];this[_0xa4c4('0x13')]=_0x1a5108['uniqueid'];this[_0xa4c4('0x14')]=_0x31f98c[_0xa4c4('0x15')];this['calleridnum']=_0x31f98c['number'];this[_0xa4c4('0x16')]=_0x31f98c[_0xa4c4('0x16')];this[_0xa4c4('0x17')]=_0x31f98c[_0xa4c4('0x17')];this[_0xa4c4('0x18')]=_0x31f98c[_0xa4c4('0x18')];this[_0xa4c4('0x19')]=moment()['format'](_0xa4c4('0x1a'));this['ringtime']=getSeconds(_0x31f98c['responsetime'],_0x31f98c[_0xa4c4('0x16')]);this[_0xa4c4('0x1b')]=getSeconds(_0x31f98c[_0xa4c4('0x18')],_0x31f98c['responsetime']);this['talktime']=getSeconds(this['endtime'],_0x31f98c['answertime']);this['queue']=_0x1a5108[_0xa4c4('0x9')];this[_0xa4c4('0x1c')]=_0x1a5108[_0xa4c4('0x1c')];this[_0xa4c4('0x1d')]=_0x1a5108[_0xa4c4('0x1d')];this[_0xa4c4('0x1e')]=_0x31f98c['callback'];this[_0xa4c4('0x1f')]=_0x31f98c['callbackuniqueid'];this[_0xa4c4('0x20')]=_0x31f98c[_0xa4c4('0x20')];this['recallme']=_0x31f98c[_0xa4c4('0x21')];this[_0xa4c4('0x22')]=_0x31f98c['ContactId'];this[_0xa4c4('0x23')]=_0x31f98c['ListId'];this['UserId']=_0x31f98c['UserId'];this[_0xa4c4('0x24')]=_0x31f98c[_0xa4c4('0x24')];this[_0xa4c4('0x25')]=_0x31f98c['CampaignId'];this[_0xa4c4('0x26')]=_0x31f98c[_0xa4c4('0x26')]||'';this[_0xa4c4('0x27')]=_0x31f98c[_0xa4c4('0x27')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0xd24c=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x595d11,_0x3b7391){var _0x484a84=function(_0x588cd5){while(--_0x588cd5){_0x595d11['push'](_0x595d11['shift']());}};_0x484a84(++_0x3b7391);}(_0xd24c,0xcf));var _0xcd24=function(_0x2f40a4,_0x47180d){_0x2f40a4=_0x2f40a4-0x0;var _0x264c34=_0xd24c[_0x2f40a4];return _0x264c34;};'use strict';var util=require('util');var _=require(_0xcd24('0x0'));var moment=require('moment');function getSeconds(_0x177b3d,_0x3b99e5){var _0x554ca4=moment(_0x177b3d)[_0xcd24('0x1')](0x0);var _0x1c602a=moment(_0x3b99e5)[_0xcd24('0x1')](0x0);return _0x554ca4['diff'](_0x1c602a,_0xcd24('0x2'));}function AgentComplete(_0xfbb7c7,_0x3cbfb5){this[_0xcd24('0x3')]=0x4;this[_0xcd24('0x4')]=_0xcd24('0x5');this[_0xcd24('0x6')]=_0xfbb7c7[_0xcd24('0x6')];this[_0xcd24('0x7')]=_0xfbb7c7['type'];this[_0xcd24('0x8')]=_0xfbb7c7[_0xcd24('0x7')]===_0xcd24('0x9')?_0xcd24('0xa'):_0xfbb7c7[_0xcd24('0x7')];this[_0xcd24('0xb')]=_0xfbb7c7[_0xcd24('0xb')];this[_0xcd24('0xc')]=_0xfbb7c7[_0xcd24('0xc')];this[_0xcd24('0xd')]=_0xfbb7c7[_0xcd24('0xd')];this[_0xcd24('0xe')]=_0xfbb7c7[_0xcd24('0xb')]+_0xfbb7c7[_0xcd24('0xc')]+_0xfbb7c7[_0xcd24('0xd')]+_0xfbb7c7[_0xcd24('0xf')]+_0xfbb7c7[_0xcd24('0x10')]+_0xfbb7c7[_0xcd24('0x11')]+_0xfbb7c7[_0xcd24('0x12')]+_0xfbb7c7[_0xcd24('0x13')];this[_0xcd24('0xf')]=_0xfbb7c7[_0xcd24('0xf')];this[_0xcd24('0x10')]=_0xfbb7c7['countdropretry'];this[_0xcd24('0x11')]=_0xfbb7c7[_0xcd24('0x11')];this[_0xcd24('0x12')]=_0xfbb7c7[_0xcd24('0x12')];this[_0xcd24('0x13')]=_0xfbb7c7[_0xcd24('0x13')];this[_0xcd24('0x14')]=_0x3cbfb5[_0xcd24('0x14')];this[_0xcd24('0x15')]=_0xfbb7c7['name'];this['calleridnum']=_0xfbb7c7[_0xcd24('0x16')];this[_0xcd24('0x17')]=_0xfbb7c7[_0xcd24('0x17')];this[_0xcd24('0x18')]=_0xfbb7c7[_0xcd24('0x18')];this[_0xcd24('0x19')]=_0xfbb7c7[_0xcd24('0x19')];this[_0xcd24('0x1a')]=moment()[_0xcd24('0x1b')](_0xcd24('0x1c'));this[_0xcd24('0x1d')]=getSeconds(_0xfbb7c7[_0xcd24('0x18')],_0xfbb7c7[_0xcd24('0x17')]);this[_0xcd24('0x1e')]=getSeconds(_0xfbb7c7[_0xcd24('0x19')],_0xfbb7c7[_0xcd24('0x18')]);this[_0xcd24('0x1f')]=getSeconds(this['endtime'],_0xfbb7c7['answertime']);this['queue']=_0x3cbfb5[_0xcd24('0xa')];this['membername']=_0x3cbfb5['membername'];this['reason']=_0x3cbfb5['reason'];this[_0xcd24('0x20')]=_0xfbb7c7[_0xcd24('0x20')];this[_0xcd24('0x21')]=_0xfbb7c7['callbackuniqueid'];this[_0xcd24('0x22')]=_0xfbb7c7['callbackat'];this['recallme']=_0xfbb7c7[_0xcd24('0x23')];this[_0xcd24('0x24')]=_0xfbb7c7[_0xcd24('0x24')];this[_0xcd24('0x25')]=_0xfbb7c7['ListId'];this[_0xcd24('0x26')]=_0xfbb7c7[_0xcd24('0x26')];this[_0xcd24('0x27')]=_0xfbb7c7['VoiceQueueId'];this[_0xcd24('0x28')]=_0xfbb7c7['CampaignId'];this[_0xcd24('0x29')]=_0xfbb7c7['originatecalleridnum']||'';this['originatecalleridname']=_0xfbb7c7[_0xcd24('0x2a')]||'';}module[_0xcd24('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 97d7999..a6d27ba 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 _0x89a3=['milliseconds','seconds','uniqueid','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','countdropretry','countabandonedretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment'];(function(_0x40e609,_0x4e4b74){var _0xf46928=function(_0xed016c){while(--_0xed016c){_0x40e609['push'](_0x40e609['shift']());}};_0xf46928(++_0x4e4b74);}(_0x89a3,0x138));var _0x389a=function(_0x4c06a3,_0x1e6b6f){_0x4c06a3=_0x4c06a3-0x0;var _0x7ff53c=_0x89a3[_0x4c06a3];return _0x7ff53c;};'use strict';var util=require(_0x389a('0x0'));var _=require(_0x389a('0x1'));var moment=require(_0x389a('0x2'));function getSeconds(_0x5e3373,_0x47d69a){var _0x265a1e=moment(_0x5e3373)[_0x389a('0x3')](0x0);var _0x521612=moment(_0x47d69a)['milliseconds'](0x0);return _0x265a1e['diff'](_0x521612,_0x389a('0x4'));}function Final(_0x248fe9){this['uniqueid']=_0x248fe9[_0x389a('0x5')];this['scheduledat']=_0x248fe9['scheduledat'];this[_0x389a('0x6')]=_0x248fe9[_0x389a('0x6')];this[_0x389a('0x7')]=_0x248fe9['type']===_0x389a('0x8')?_0x389a('0x9'):_0x248fe9['type'];this[_0x389a('0xa')]=_0x248fe9[_0x389a('0xa')];this[_0x389a('0xb')]=_0x248fe9[_0x389a('0xb')];this[_0x389a('0xc')]=_0x248fe9[_0x389a('0xc')];this['countglobal']=_0x248fe9[_0x389a('0xa')]+_0x248fe9[_0x389a('0xb')]+_0x248fe9[_0x389a('0xc')]+_0x248fe9[_0x389a('0xd')]+_0x248fe9['countdropretry']+_0x248fe9['countabandonedretry']+_0x248fe9['countmachineretry']+_0x248fe9[_0x389a('0xe')];this[_0x389a('0xd')]=_0x248fe9[_0x389a('0xd')];this[_0x389a('0xf')]=_0x248fe9[_0x389a('0xf')];this[_0x389a('0x10')]=_0x248fe9['countabandonedretry'];this['countmachineretry']=_0x248fe9[_0x389a('0x11')];this[_0x389a('0xe')]=_0x248fe9['countagentrejectretry'];this[_0x389a('0x9')]=_0x248fe9[_0x389a('0x9')];this[_0x389a('0x12')]=_0x248fe9[_0x389a('0x12')];this['calleridnum']=_0x248fe9[_0x389a('0x13')];this[_0x389a('0x14')]=_0x248fe9[_0x389a('0x14')];this['responsetime']=_0x248fe9[_0x389a('0x15')];this['endtime']=_0x248fe9['responsetime'];this[_0x389a('0x16')]=_0x248fe9[_0x389a('0x16')]||0x0;this['holdtime']=_0x248fe9[_0x389a('0x17')]||0x0;this[_0x389a('0x18')]=_0x248fe9[_0x389a('0x18')]||0x0;this['callback']=_0x248fe9['callback'];this[_0x389a('0x19')]=_0x248fe9['callbackuniqueid'];this['callbackat']=_0x248fe9[_0x389a('0x1a')];this['recallme']=_0x248fe9['recallme'];this[_0x389a('0x1b')]=_0x248fe9[_0x389a('0x1b')];this[_0x389a('0x1c')]=_0x248fe9[_0x389a('0x1c')];this[_0x389a('0x1d')]=_0x248fe9[_0x389a('0x1d')];this['VoiceQueueId']=_0x248fe9[_0x389a('0x1e')];this[_0x389a('0x1f')]=_0x248fe9[_0x389a('0x1f')];this['originatecalleridnum']=_0x248fe9[_0x389a('0x20')]||'';this['originatecalleridname']=_0x248fe9[_0x389a('0x21')]||'';}module[_0x389a('0x22')]=Final; \ No newline at end of file +var _0x8a56=['starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridname'];(function(_0x2df362,_0x4358a7){var _0x9093ef=function(_0x1bff25){while(--_0x1bff25){_0x2df362['push'](_0x2df362['shift']());}};_0x9093ef(++_0x4358a7);}(_0x8a56,0x183));var _0x68a5=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0x8a56[_0x622035];return _0x326cf2;};'use strict';var util=require(_0x68a5('0x0'));var _=require(_0x68a5('0x1'));var moment=require('moment');function getSeconds(_0x315f1b,_0x498223){var _0x413e59=moment(_0x315f1b)[_0x68a5('0x2')](0x0);var _0x4c676e=moment(_0x498223)[_0x68a5('0x2')](0x0);return _0x413e59[_0x68a5('0x3')](_0x4c676e,_0x68a5('0x4'));}function Final(_0x223566){this[_0x68a5('0x5')]=_0x223566[_0x68a5('0x5')];this[_0x68a5('0x6')]=_0x223566[_0x68a5('0x6')];this['type']=_0x223566[_0x68a5('0x7')];this[_0x68a5('0x8')]=_0x223566[_0x68a5('0x7')]===_0x68a5('0x9')?_0x68a5('0xa'):_0x223566['type'];this[_0x68a5('0xb')]=_0x223566[_0x68a5('0xb')];this[_0x68a5('0xc')]=_0x223566[_0x68a5('0xc')];this[_0x68a5('0xd')]=_0x223566['countnoanswerretry'];this[_0x68a5('0xe')]=_0x223566[_0x68a5('0xb')]+_0x223566[_0x68a5('0xc')]+_0x223566[_0x68a5('0xd')]+_0x223566['countnosuchnumberretry']+_0x223566['countdropretry']+_0x223566[_0x68a5('0xf')]+_0x223566[_0x68a5('0x10')]+_0x223566['countagentrejectretry'];this['countnosuchnumberretry']=_0x223566['countnosuchnumberretry'];this[_0x68a5('0x11')]=_0x223566[_0x68a5('0x11')];this[_0x68a5('0xf')]=_0x223566[_0x68a5('0xf')];this[_0x68a5('0x10')]=_0x223566['countmachineretry'];this[_0x68a5('0x12')]=_0x223566[_0x68a5('0x12')];this[_0x68a5('0xa')]=_0x223566['queue'];this[_0x68a5('0x13')]=_0x223566[_0x68a5('0x13')];this['calleridnum']=_0x223566['calleridnum'];this[_0x68a5('0x14')]=_0x223566[_0x68a5('0x14')];this['responsetime']=_0x223566[_0x68a5('0x15')];this[_0x68a5('0x16')]=_0x223566[_0x68a5('0x15')];this[_0x68a5('0x17')]=_0x223566[_0x68a5('0x17')]||0x0;this['holdtime']=_0x223566['holdtime']||0x0;this[_0x68a5('0x18')]=_0x223566['talktime']||0x0;this[_0x68a5('0x19')]=_0x223566[_0x68a5('0x19')];this['callbackuniqueid']=_0x223566[_0x68a5('0x1a')];this['callbackat']=_0x223566[_0x68a5('0x1b')];this[_0x68a5('0x1c')]=_0x223566[_0x68a5('0x1c')];this['ContactId']=_0x223566[_0x68a5('0x1d')];this[_0x68a5('0x1e')]=_0x223566[_0x68a5('0x1e')];this['UserId']=_0x223566[_0x68a5('0x1f')];this[_0x68a5('0x20')]=_0x223566[_0x68a5('0x20')];this['CampaignId']=_0x223566[_0x68a5('0x21')];this[_0x68a5('0x22')]=_0x223566[_0x68a5('0x22')]||'';this[_0x68a5('0x23')]=_0x223566[_0x68a5('0x23')]||'';}module[_0x68a5('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index b907ad2..2716a95 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 _0x02c0=['YYYY-MM-DD\x20HH:mm:ss','ringtime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format'];(function(_0x118139,_0x7ce965){var _0x2fece9=function(_0xd145a4){while(--_0xd145a4){_0x118139['push'](_0x118139['shift']());}};_0x2fece9(++_0x7ce965);}(_0x02c0,0x18e));var _0x002c=function(_0x19f6b5,_0x4317bc){_0x19f6b5=_0x19f6b5-0x0;var _0x421795=_0x02c0[_0x19f6b5];return _0x421795;};'use strict';var util=require(_0x002c('0x0'));var _=require(_0x002c('0x1'));var moment=require(_0x002c('0x2'));function getSeconds(_0x21878c,_0x190529){var _0x13d291=moment(_0x21878c)[_0x002c('0x3')](0x0);var _0x19b28e=moment(_0x190529)[_0x002c('0x3')](0x0);return _0x13d291[_0x002c('0x4')](_0x19b28e,_0x002c('0x5'));}function Hangup(_0x4c2c9a,_0x256ea7){this[_0x002c('0x6')]=0x4;this[_0x002c('0x7')]=_0x002c('0x8');this['scheduledat']=_0x4c2c9a[_0x002c('0x9')];this[_0x002c('0xa')]=_0x4c2c9a['type'];this[_0x002c('0xb')]=_0x4c2c9a[_0x002c('0xa')]===_0x002c('0xc')?_0x002c('0xd'):_0x4c2c9a[_0x002c('0xa')];this[_0x002c('0xe')]=_0x4c2c9a[_0x002c('0xe')];this[_0x002c('0xf')]=_0x4c2c9a[_0x002c('0xf')];this[_0x002c('0x10')]=_0x4c2c9a[_0x002c('0x10')];this[_0x002c('0x11')]=_0x4c2c9a[_0x002c('0xe')]+_0x4c2c9a[_0x002c('0xf')]+_0x4c2c9a[_0x002c('0x10')]+_0x4c2c9a['countnosuchnumberretry']+_0x4c2c9a['countdropretry']+_0x4c2c9a[_0x002c('0x12')]+_0x4c2c9a[_0x002c('0x13')]+_0x4c2c9a[_0x002c('0x14')];this[_0x002c('0x15')]=_0x4c2c9a[_0x002c('0x15')];this[_0x002c('0x16')]=_0x4c2c9a[_0x002c('0x16')];this[_0x002c('0x12')]=_0x4c2c9a[_0x002c('0x12')];this[_0x002c('0x13')]=_0x4c2c9a['countmachineretry'];this[_0x002c('0x14')]=_0x4c2c9a[_0x002c('0x14')];this[_0x002c('0x17')]=_0x256ea7[_0x002c('0x17')];this[_0x002c('0x18')]=_0x4c2c9a[_0x002c('0x19')];this[_0x002c('0x1a')]=_0x4c2c9a[_0x002c('0x1b')];this[_0x002c('0x1c')]=_0x4c2c9a[_0x002c('0x1c')];this[_0x002c('0x1d')]=_0x4c2c9a[_0x002c('0x1d')];this[_0x002c('0x1e')]=moment()[_0x002c('0x1f')](_0x002c('0x20'));this[_0x002c('0x21')]=getSeconds(_0x4c2c9a[_0x002c('0x1d')],_0x4c2c9a[_0x002c('0x1c')]);this['holdtime']=0x0;this['talktime']=getSeconds(this[_0x002c('0x1e')],_0x4c2c9a[_0x002c('0x1d')]);this[_0x002c('0xd')]=_0x4c2c9a[_0x002c('0xd')];this['membername']='IVR';this[_0x002c('0x22')]=_0x256ea7['cause-txt'];this[_0x002c('0x23')]=_0x4c2c9a[_0x002c('0x23')];this[_0x002c('0x24')]=_0x4c2c9a[_0x002c('0x24')];this[_0x002c('0x25')]=_0x4c2c9a[_0x002c('0x25')];this[_0x002c('0x26')]=_0x4c2c9a['recallme'];this[_0x002c('0x27')]=_0x4c2c9a[_0x002c('0x27')];this[_0x002c('0x28')]=_0x4c2c9a[_0x002c('0x28')];this['UserId']=_0x4c2c9a[_0x002c('0x29')];this['VoiceQueueId']=_0x4c2c9a['VoiceQueueId'];this['CampaignId']=_0x4c2c9a['CampaignId'];}module[_0x002c('0x2a')]=Hangup; \ No newline at end of file +var _0x9067=['starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','queue','IVR','reason','cause-txt','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','Answer','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','calleridname','calleridnum','number'];(function(_0x3922b0,_0x124626){var _0x99a2a1=function(_0x108fd9){while(--_0x108fd9){_0x3922b0['push'](_0x3922b0['shift']());}};_0x99a2a1(++_0x124626);}(_0x9067,0x1e6));var _0x7906=function(_0x51e7fc,_0x48c9ff){_0x51e7fc=_0x51e7fc-0x0;var _0x221bac=_0x9067[_0x51e7fc];return _0x221bac;};'use strict';var util=require(_0x7906('0x0'));var _=require(_0x7906('0x1'));var moment=require(_0x7906('0x2'));function getSeconds(_0x49c6e6,_0x5cc415){var _0x589a10=moment(_0x49c6e6)['milliseconds'](0x0);var _0x5123e2=moment(_0x5cc415)[_0x7906('0x3')](0x0);return _0x589a10[_0x7906('0x4')](_0x5123e2,_0x7906('0x5'));}function Hangup(_0x3d93ab,_0x5d39f3){this[_0x7906('0x6')]=0x4;this['statedesc']=_0x7906('0x7');this['scheduledat']=_0x3d93ab['scheduledat'];this[_0x7906('0x8')]=_0x3d93ab[_0x7906('0x8')];this['campaigntype']=_0x3d93ab[_0x7906('0x8')]===_0x7906('0x9')?'queue':_0x3d93ab[_0x7906('0x8')];this[_0x7906('0xa')]=_0x3d93ab['countbusyretry'];this[_0x7906('0xb')]=_0x3d93ab[_0x7906('0xb')];this[_0x7906('0xc')]=_0x3d93ab['countnoanswerretry'];this['countglobal']=_0x3d93ab['countbusyretry']+_0x3d93ab[_0x7906('0xb')]+_0x3d93ab['countnoanswerretry']+_0x3d93ab['countnosuchnumberretry']+_0x3d93ab[_0x7906('0xd')]+_0x3d93ab[_0x7906('0xe')]+_0x3d93ab['countmachineretry']+_0x3d93ab[_0x7906('0xf')];this[_0x7906('0x10')]=_0x3d93ab['countnosuchnumberretry'];this[_0x7906('0xd')]=_0x3d93ab['countdropretry'];this[_0x7906('0xe')]=_0x3d93ab['countabandonedretry'];this[_0x7906('0x11')]=_0x3d93ab[_0x7906('0x11')];this['countagentrejectretry']=_0x3d93ab['countagentrejectretry'];this['uniqueid']=_0x5d39f3['uniqueid'];this[_0x7906('0x12')]=_0x3d93ab['name'];this[_0x7906('0x13')]=_0x3d93ab[_0x7906('0x14')];this[_0x7906('0x15')]=_0x3d93ab['starttime'];this[_0x7906('0x16')]=_0x3d93ab['responsetime'];this[_0x7906('0x17')]=moment()['format'](_0x7906('0x18'));this[_0x7906('0x19')]=getSeconds(_0x3d93ab[_0x7906('0x16')],_0x3d93ab[_0x7906('0x15')]);this[_0x7906('0x1a')]=0x0;this['talktime']=getSeconds(this[_0x7906('0x17')],_0x3d93ab[_0x7906('0x16')]);this[_0x7906('0x1b')]=_0x3d93ab[_0x7906('0x1b')];this['membername']=_0x7906('0x1c');this[_0x7906('0x1d')]=_0x5d39f3[_0x7906('0x1e')];this['callback']=_0x3d93ab['callback'];this[_0x7906('0x1f')]=_0x3d93ab[_0x7906('0x1f')];this[_0x7906('0x20')]=_0x3d93ab[_0x7906('0x20')];this[_0x7906('0x21')]=_0x3d93ab['recallme'];this[_0x7906('0x22')]=_0x3d93ab[_0x7906('0x22')];this[_0x7906('0x23')]=_0x3d93ab['ListId'];this['UserId']=_0x3d93ab['UserId'];this[_0x7906('0x24')]=_0x3d93ab[_0x7906('0x24')];this[_0x7906('0x25')]=_0x3d93ab['CampaignId'];}module[_0x7906('0x26')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index d3dcf3b..ea56d1c 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 _0xa8c4=['countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime','endtime','responsetime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue'];(function(_0x34a71f,_0xbf2b4a){var _0x945986=function(_0x44cc36){while(--_0x44cc36){_0x34a71f['push'](_0x34a71f['shift']());}};_0x945986(++_0xbf2b4a);}(_0xa8c4,0x12d));var _0x4a8c=function(_0x127565,_0x4cf4c7){_0x127565=_0x127565-0x0;var _0x35090e=_0xa8c4[_0x127565];return _0x35090e;};'use strict';var util=require('util');var _=require(_0x4a8c('0x0'));var moment=require(_0x4a8c('0x1'));function getSeconds(_0x5cb13b,_0xcd762c){var _0x467ef5=moment(_0x5cb13b)['milliseconds'](0x0);var _0x2bbcab=moment(_0xcd762c)[_0x4a8c('0x2')](0x0);return _0x467ef5[_0x4a8c('0x3')](_0x2bbcab,_0x4a8c('0x4'));}function History(_0x1481e0){this[_0x4a8c('0x5')]=_0x1481e0[_0x4a8c('0x5')];this[_0x4a8c('0x6')]=_0x1481e0[_0x4a8c('0x6')]||undefined;this[_0x4a8c('0x7')]=_0x1481e0['type'];this[_0x4a8c('0x8')]=_0x1481e0[_0x4a8c('0x7')]===_0x4a8c('0x9')?_0x4a8c('0xa'):_0x1481e0[_0x4a8c('0x7')];this[_0x4a8c('0xb')]=_0x1481e0[_0x4a8c('0xb')];this[_0x4a8c('0xc')]=_0x1481e0['countcongestionretry'];this[_0x4a8c('0xd')]=_0x1481e0['countnoanswerretry'];this['countglobal']=_0x1481e0[_0x4a8c('0xb')]+_0x1481e0[_0x4a8c('0xc')]+_0x1481e0[_0x4a8c('0xd')]+_0x1481e0[_0x4a8c('0xe')]+_0x1481e0[_0x4a8c('0xf')]+_0x1481e0[_0x4a8c('0x10')]+_0x1481e0[_0x4a8c('0x11')]+_0x1481e0[_0x4a8c('0x12')];this[_0x4a8c('0xe')]=_0x1481e0['countnosuchnumberretry'];this[_0x4a8c('0xf')]=_0x1481e0[_0x4a8c('0xf')];this[_0x4a8c('0x10')]=_0x1481e0[_0x4a8c('0x10')];this[_0x4a8c('0x11')]=_0x1481e0[_0x4a8c('0x11')];this[_0x4a8c('0x12')]=_0x1481e0[_0x4a8c('0x12')];this['queue']=_0x1481e0[_0x4a8c('0xa')];this[_0x4a8c('0x13')]=_0x1481e0['name'];this[_0x4a8c('0x14')]=_0x1481e0[_0x4a8c('0x15')];this[_0x4a8c('0x16')]=_0x1481e0[_0x4a8c('0x16')];this['responsetime']=_0x1481e0['responsetime'];this[_0x4a8c('0x17')]=_0x1481e0[_0x4a8c('0x18')];this[_0x4a8c('0x19')]=getSeconds(_0x1481e0[_0x4a8c('0x18')],_0x1481e0[_0x4a8c('0x16')]);this['holdtime']=0x0;this[_0x4a8c('0x1a')]=0x0;this[_0x4a8c('0x1b')]=_0x1481e0[_0x4a8c('0x1b')];this[_0x4a8c('0x1c')]=_0x1481e0['callbackuniqueid'];this[_0x4a8c('0x1d')]=_0x1481e0[_0x4a8c('0x1d')];this[_0x4a8c('0x1e')]=_0x1481e0[_0x4a8c('0x1e')];this[_0x4a8c('0x1f')]=_0x1481e0[_0x4a8c('0x1f')];this['ListId']=_0x1481e0[_0x4a8c('0x20')];this[_0x4a8c('0x21')]=_0x1481e0['UserId'];this[_0x4a8c('0x22')]=_0x1481e0[_0x4a8c('0x22')];this[_0x4a8c('0x23')]=_0x1481e0[_0x4a8c('0x23')];this['originatecalleridnum']=_0x1481e0[_0x4a8c('0x24')]||'';this[_0x4a8c('0x25')]=_0x1481e0[_0x4a8c('0x25')]||'';}module[_0x4a8c('0x26')]=History; \ No newline at end of file +var _0xcbcc=['originatecalleridname','util','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','queue','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x5bc69d,_0x25137d){var _0x154d9c=function(_0x10a8b0){while(--_0x10a8b0){_0x5bc69d['push'](_0x5bc69d['shift']());}};_0x154d9c(++_0x25137d);}(_0xcbcc,0x198));var _0xccbc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcbcc[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xccbc('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x362ea2,_0x3ba09e){var _0x56ed7b=moment(_0x362ea2)[_0xccbc('0x1')](0x0);var _0x21b5c1=moment(_0x3ba09e)[_0xccbc('0x1')](0x0);return _0x56ed7b[_0xccbc('0x2')](_0x21b5c1,'seconds');}function History(_0x4b878d){this['uniqueid']=_0x4b878d[_0xccbc('0x3')];this[_0xccbc('0x4')]=_0x4b878d[_0xccbc('0x4')]||undefined;this[_0xccbc('0x5')]=_0x4b878d['type'];this[_0xccbc('0x6')]=_0x4b878d[_0xccbc('0x5')]===_0xccbc('0x7')?'queue':_0x4b878d[_0xccbc('0x5')];this[_0xccbc('0x8')]=_0x4b878d[_0xccbc('0x8')];this['countcongestionretry']=_0x4b878d[_0xccbc('0x9')];this[_0xccbc('0xa')]=_0x4b878d[_0xccbc('0xa')];this[_0xccbc('0xb')]=_0x4b878d[_0xccbc('0x8')]+_0x4b878d[_0xccbc('0x9')]+_0x4b878d[_0xccbc('0xa')]+_0x4b878d['countnosuchnumberretry']+_0x4b878d['countdropretry']+_0x4b878d[_0xccbc('0xc')]+_0x4b878d['countmachineretry']+_0x4b878d[_0xccbc('0xd')];this[_0xccbc('0xe')]=_0x4b878d[_0xccbc('0xe')];this['countdropretry']=_0x4b878d[_0xccbc('0xf')];this['countabandonedretry']=_0x4b878d[_0xccbc('0xc')];this[_0xccbc('0x10')]=_0x4b878d[_0xccbc('0x10')];this[_0xccbc('0xd')]=_0x4b878d[_0xccbc('0xd')];this[_0xccbc('0x11')]=_0x4b878d['queue'];this['calleridname']=_0x4b878d[_0xccbc('0x12')];this[_0xccbc('0x13')]=_0x4b878d[_0xccbc('0x14')];this[_0xccbc('0x15')]=_0x4b878d['starttime'];this['responsetime']=_0x4b878d[_0xccbc('0x16')];this[_0xccbc('0x17')]=_0x4b878d[_0xccbc('0x16')];this[_0xccbc('0x18')]=getSeconds(_0x4b878d[_0xccbc('0x16')],_0x4b878d[_0xccbc('0x15')]);this[_0xccbc('0x19')]=0x0;this[_0xccbc('0x1a')]=0x0;this[_0xccbc('0x1b')]=_0x4b878d[_0xccbc('0x1b')];this[_0xccbc('0x1c')]=_0x4b878d[_0xccbc('0x1c')];this[_0xccbc('0x1d')]=_0x4b878d[_0xccbc('0x1d')];this[_0xccbc('0x1e')]=_0x4b878d['recallme'];this[_0xccbc('0x1f')]=_0x4b878d[_0xccbc('0x1f')];this[_0xccbc('0x20')]=_0x4b878d['ListId'];this[_0xccbc('0x21')]=_0x4b878d[_0xccbc('0x21')];this['VoiceQueueId']=_0x4b878d[_0xccbc('0x22')];this['CampaignId']=_0x4b878d[_0xccbc('0x23')];this['originatecalleridnum']=_0x4b878d['originatecalleridnum']||'';this[_0xccbc('0x24')]=_0x4b878d[_0xccbc('0x24')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 995e22b..c2bc037 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 _0x3c2f=['actionid','locked','paused','stateinterface','push','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','syncQueueStatusComplete','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTimeIntervals','ifTime','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','indexOf','true','content','all','some','INTERVAL_IS_OVERTIME','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','method\x20not\x20recognized','launchHandleIvr','dialActive','dialTimezone','[syncQueueSummary]','checkIfTime','pow','replace','random','match','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','dialOriginateCallerIdName','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','Error','response','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','dialAgentRejectMaxRetry','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','erlangCalls','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','started\x20in\x20predictive\x20at','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','predictiveIntervalHitRate','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','Agent','voicePause','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','Contact.phone','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','ACTIVE','[getContactDialer2]','tryOriginatePredictive','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','[busyFactor]','p\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncHangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','stringify','milliseconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','talking','total','unmanaged','waiting','loggedInDb','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','Trunk','active','callerid','format','voice:queue:%s','ivr','info','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','---------------------------','merge','diff','seconds','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','endtime','starttime','clearZombieChannels','uniqueId','[uniqueid]','[actions]','Action','status','channel','catch','updateOriginated','queue','[Dialer][checkChannel]','resolve','then','countReScheduled','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','[unlockContact]\x20','getContactDialer','getContactDialerIvr','[getContactDialer]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','saveInDb','pick','ContactId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','reachable','SIP/%s','unmonitored','uniqueid','isNil','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','outboundAnswerCallsDay','state','HangupInAMD','AMD','[syncHangupInAMD]','membername','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','VoiceQueueId','dialAMDActive','[syncHangupInAMDIvr]','MACHINE','Machine','amd','countnoanswerretry','countdropretry','dialMachineMaxRetry','reason\x2019\x20machine....','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','cause-txt','Unknow','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','agiafterat','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','actions'];(function(_0x466af7,_0x2f7551){var _0x348c96=function(_0x2d7477){while(--_0x2d7477){_0x466af7['push'](_0x466af7['shift']());}};_0x348c96(++_0x2f7551);}(_0x3c2f,0xf3));var _0xf3c2=function(_0x1bc41f,_0x2e6cd7){_0x1bc41f=_0x1bc41f-0x0;var _0x1f7025=_0x3c2f[_0x1bc41f];return _0x1f7025;};'use strict';var util=require(_0xf3c2('0x0'));var _=require(_0xf3c2('0x1'));var BPromise=require(_0xf3c2('0x2'));var uuid=require(_0xf3c2('0x3'));var moment=require(_0xf3c2('0x4'));var rr=require('rr');var md5=require(_0xf3c2('0x5'));var Redis=require(_0xf3c2('0x6'));var ut=require(_0xf3c2('0x7'));var config=require(_0xf3c2('0x8'));var logger=require(_0xf3c2('0x9'))(_0xf3c2('0xa'));var loggerBooked=require(_0xf3c2('0x9'))(_0xf3c2('0xb'));var loggerPredictive=require(_0xf3c2('0x9'))(_0xf3c2('0xc'));var loggerPredictiveCalls=require(_0xf3c2('0x9'))(_0xf3c2('0xd'));var loggerSyncQueueSummary=require('../../../config/logger')(_0xf3c2('0xe'));var ami=require('../ami');config[_0xf3c2('0xf')]=_[_0xf3c2('0x10')](config[_0xf3c2('0xf')],{'host':_0xf3c2('0x11'),'port':0x18eb});var io=require(_0xf3c2('0x12'))(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xf3c2('0x13'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xf3c2('0x14'));var Action=require(_0xf3c2('0x15'));var History=require(_0xf3c2('0x16'));var Final=require(_0xf3c2('0x17'));var AgentComplete=require(_0xf3c2('0x18'));var QueueCallerAbandon=require(_0xf3c2('0x19'));var Hangup=require('./hangup');var ipAgi=process['env'][_0xf3c2('0x1a')]||_0xf3c2('0x1b');var strategy={'rrmemory':_0xf3c2('0x1c'),'roundrobin':_0xf3c2('0x1d')};var Sequence=function(){};Sequence[_0xf3c2('0x1e')][_0xf3c2('0x1f')]=function(_0x1064f6){this[_0xf3c2('0x20')]=this['tail']?this['tail'][_0xf3c2('0x21')](_0x1064f6):_0x1064f6();};function Dialer(_0x22753e,_0x57f93c){this[_0xf3c2('0x22')]=new Sequence();this[_0xf3c2('0x23')]=_0x57f93c;this[_0xf3c2('0x24')]=_0x22753e[_0xf3c2('0x24')];this[_0xf3c2('0x25')]=_0x22753e[_0xf3c2('0x25')];this[_0xf3c2('0x26')]=_0x22753e[_0xf3c2('0x26')];this['trunks']=_0x22753e[_0xf3c2('0x27')];this[_0xf3c2('0x28')]=config[_0xf3c2('0x28')]||0x2;this['channels']={};this['actions']={};this['contactsId']={};this['uniqueId']={};this[_0xf3c2('0x29')]={};this[_0xf3c2('0x2a')]={};this[_0xf3c2('0x2b')]={};this[_0xf3c2('0x2c')]={};this[_0xf3c2('0x2d')]={};this[_0xf3c2('0x2e')]={};ami['on'](_0xf3c2('0x2f'),this[_0xf3c2('0x30')][_0xf3c2('0x31')](this));ami['on'](_0xf3c2('0x32'),this[_0xf3c2('0x33')]['bind'](this));ami['on'](_0xf3c2('0x34'),this['syncOriginateResponse']['bind'](this));ami['on'](_0xf3c2('0x35'),this[_0xf3c2('0x36')][_0xf3c2('0x31')](this));ami['on'](_0xf3c2('0x37'),this[_0xf3c2('0xe')][_0xf3c2('0x31')](this));ami['on']('hangup',this[_0xf3c2('0x38')][_0xf3c2('0x31')](this));ami['on'](_0xf3c2('0x39'),this['syncNewExten'][_0xf3c2('0x31')](this));ami['on'](_0xf3c2('0x3a'),this[_0xf3c2('0x3b')][_0xf3c2('0x31')](this));ami['on'](_0xf3c2('0x3c'),this[_0xf3c2('0x3d')]['bind'](this));ami['on'](_0xf3c2('0x3e'),this['syncQueueStatusComplete'][_0xf3c2('0x31')](this));this[_0xf3c2('0x3f')]();this[_0xf3c2('0x40')]();}function isNotNull(_0x3d3e91){return _0x3d3e91!==null&&!_['isUndefined'](_0x3d3e91);}function checkIsLoggedIn(_0x85e12f,_0x22568d){return function(){if(_0x22568d<=0x0){_0x85e12f[_0xf3c2('0x41')]='AGENTS_NOT_LOGGED';throw _0x85e12f[_0xf3c2('0x42')]+_0xf3c2('0x43');}};}function isActive(_0x21e9db){return _0x21e9db;}function checkIsActive(_0x433c22,_0x1c7d37){return function(){if(!isActive(_0x1c7d37)){_0x433c22[_0xf3c2('0x41')]=_0xf3c2('0x44');throw _0x433c22[_0xf3c2('0x42')]+_0xf3c2('0x45');}};}function checkInterval(_0x34de17){return function(){if(!isNotNull(_0x34de17[_0xf3c2('0x46')])){_0x34de17[_0xf3c2('0x41')]=_0xf3c2('0x47');throw _0x34de17[_0xf3c2('0x42')]+_0xf3c2('0x48');}if(!isNotNull(_0x34de17[_0xf3c2('0x46')]['Intervals'])){_0x34de17[_0xf3c2('0x41')]=_0xf3c2('0x47');throw _0x34de17[_0xf3c2('0x42')]+_0xf3c2('0x48');}if(!isNotNull(_[_0xf3c2('0x49')](_0x34de17[_0xf3c2('0x46')][_0xf3c2('0x4a')]))){_0x34de17[_0xf3c2('0x41')]=_0xf3c2('0x47');throw _0x34de17[_0xf3c2('0x42')]+_0xf3c2('0x48');}};}function msgResponse(_0x4386d2,_0x47a2f6,_0x6f6f54){return{'action':_0x4386d2,'response':_0x47a2f6,'message':_0x6f6f54,'stack':_0x6f6f54};}function myreject(_0x1d2549){return function(_0x5019ba){return _0x1d2549(msgResponse(_0xf3c2('0x4b'),'Error',JSON[_0xf3c2('0x4c')](_0x5019ba)));};}function getSeconds(_0x3e00f4,_0x106a9c){var _0x3a964d=moment(_0x3e00f4)[_0xf3c2('0x4d')](0x0);var _0x877494=moment(_0x106a9c)['milliseconds'](0x0);return _0x3a964d['diff'](_0x877494,'seconds');}function emit(_0x1885cd,_0x111dce,_0x4139eb){io['to'](_0x1885cd)[_0xf3c2('0x4e')](_0x111dce,_0x4139eb);}function emitVoiceQueueSummary(_0xabb098){if(_0xabb098[_0xf3c2('0x4f')]===_0xf3c2('0x50')){var _0x4cae2b={'id':_0xabb098['id'],'name':_0xabb098['name'],'strategy':_0xabb098[_0xf3c2('0x51')],'answered':_0xabb098[_0xf3c2('0x52')],'available':_0xabb098[_0xf3c2('0x53')],'loggedIn':_0xabb098[_0xf3c2('0x54')],'pTalking':_0xabb098[_0xf3c2('0x55')],'sumBillable':_0xabb098[_0xf3c2('0x56')],'sumDuration':_0xabb098['sumDuration'],'sumHoldTime':_0xabb098['sumHoldTime']||0x0,'talking':_0xabb098[_0xf3c2('0x57')],'total':_0xabb098[_0xf3c2('0x58')],'type':_0xabb098[_0xf3c2('0x4f')],'unmanaged':_0xabb098[_0xf3c2('0x59')],'abandoned':_0xabb098['abandoned'],'waiting':_0xabb098[_0xf3c2('0x5a')],'loggedInDb':_0xabb098[_0xf3c2('0x5b')],'dialActive':_0xabb098['dialActive'],'dialMethod':_0xabb098['dialMethod'],'dialOriginateCallerIdName':_0xabb098['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0xabb098['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0xabb098[_0xf3c2('0x5c')],'dialPrefix':_0xabb098[_0xf3c2('0x5d')],'outboundAnswerAgiCallsDay':_0xabb098[_0xf3c2('0x5e')],'outboundAnswerCallsDay':_0xabb098['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0xabb098[_0xf3c2('0x5f')],'outboundBusyCallsDay':_0xabb098[_0xf3c2('0x60')],'outboundCongestionCallsDay':_0xabb098[_0xf3c2('0x61')],'outboundDropCallsDayACS':_0xabb098[_0xf3c2('0x62')],'outboundDropCallsDayCallersExit':_0xabb098['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0xabb098[_0xf3c2('0x63')],'outboundNoAnswerCallsDay':_0xabb098[_0xf3c2('0x64')],'outboundNoSuchCallsDay':_0xabb098[_0xf3c2('0x65')],'outboundOriginateFailureCallsDay':_0xabb098[_0xf3c2('0x66')],'outboundReCallsDay':_0xabb098[_0xf3c2('0x67')],'outboundRejectCallsDay':_0xabb098[_0xf3c2('0x68')],'outboundUnknownCallsDay':_0xabb098[_0xf3c2('0x69')],'predictiveIntervalAnsweredCalls':_0xabb098[_0xf3c2('0x6a')],'predictiveIntervalAvgHoldtime':_0xabb098[_0xf3c2('0x6b')],'predictiveIntervalAvgTalktime':_0xabb098[_0xf3c2('0x6c')],'predictiveIntervalDroppedCallsCallersExit':_0xabb098[_0xf3c2('0x6d')],'predictiveIntervalDroppedCallsTimeout':_0xabb098[_0xf3c2('0x6e')],'predictiveIntervalErlangCalls':_0xabb098['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0xabb098['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0xabb098['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0xabb098[_0xf3c2('0x6f')],'predictiveIntervalPauses':_0xabb098[_0xf3c2('0x70')],'predictiveIntervalAvailable':_0xabb098[_0xf3c2('0x71')],'predictiveIntervalTotalCalls':_0xabb098[_0xf3c2('0x72')],'message':_0xabb098[_0xf3c2('0x41')],'originated':_0xabb098[_0xf3c2('0x73')],'erlangCalls':_0xabb098['erlangCalls'],'erlangCallToSecond':_0xabb098[_0xf3c2('0x74')],'erlangAbandonmentRate':_0xabb098['erlangAbandonmentRate'],'erlangBusyFactor':_0xabb098['erlangBusyFactor'],'startPredictive':_0xabb098[_0xf3c2('0x2a')],'startProgressive':_0xabb098['startProgressive']};if(_0xabb098[_0xf3c2('0x75')]){_0x4cae2b[_0xf3c2('0x75')]={'id':_0xabb098['Trunk']['id'],'name':_0xabb098[_0xf3c2('0x75')][_0xf3c2('0x42')],'active':_0xabb098[_0xf3c2('0x75')][_0xf3c2('0x76')],'callerid':_0xabb098[_0xf3c2('0x75')][_0xf3c2('0x77')]};}if(_0xabb098[_0xf3c2('0x46')]){_0x4cae2b[_0xf3c2('0x46')]={'id':_0xabb098[_0xf3c2('0x46')]['id'],'name':_0xabb098[_0xf3c2('0x46')][_0xf3c2('0x42')]};}var _0x1f6833=md5(JSON['stringify'](_0x4cae2b));if(_0xabb098['md5']!==_0x1f6833){_0xabb098['md5']=_0x1f6833;emit(util[_0xf3c2('0x78')](_0xf3c2('0x79'),_0x4cae2b[_0xf3c2('0x42')]),'voice_queue:save',_0x4cae2b);}}}function emitCampaignSummary(_0x255a77){if(_0x255a77[_0xf3c2('0x4f')]===_0xf3c2('0x7a')){emit(util[_0xf3c2('0x78')]('campaign:ivr:%s',_0x255a77[_0xf3c2('0x42')]),'campaign:save',_0x255a77);}}function checkGetDataPredictive(_0x1f30d6){if(isNotNull(_0x1f30d6)&&!_['isEmpty'](_0x1f30d6)){loggerPredictive[_0xf3c2('0x7b')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xf3c2('0x7b')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1f30d6[_0xf3c2('0x72')]);loggerPredictive[_0xf3c2('0x7b')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1f30d6[_0xf3c2('0x6a')]);loggerPredictive[_0xf3c2('0x7b')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1f30d6['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xf3c2('0x7b')](_0xf3c2('0x7c'),_0x1f30d6[_0xf3c2('0x6d')]);loggerPredictive[_0xf3c2('0x7b')](_0xf3c2('0x7d'),_0x1f30d6[_0xf3c2('0x6b')]);loggerPredictive[_0xf3c2('0x7b')](_0xf3c2('0x7e'),_0x1f30d6[_0xf3c2('0x6c')]);loggerPredictive['info']('---------------------------');if(_0x1f30d6[_0xf3c2('0x72')]>0x0){if(!_[_0xf3c2('0x7f')](_0x1f30d6['predictiveIntervalAvgTalktime'])&&_0x1f30d6[_0xf3c2('0x6c')]>0x0){return!![];}loggerPredictive[_0xf3c2('0x7b')](_0xf3c2('0x80'));if(!_[_0xf3c2('0x7f')](_0x1f30d6[_0xf3c2('0x6b')])&&_0x1f30d6[_0xf3c2('0x6b')]>0x0){return!![];}loggerPredictive['info'](_0xf3c2('0x81'));}else{loggerPredictive[_0xf3c2('0x7b')](_0xf3c2('0x82'));}}else{loggerPredictive[_0xf3c2('0x7b')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x82964b){return function(_0x2b5754){loggerPredictive[_0xf3c2('0x7b')](_0xf3c2('0x83'));loggerPredictive[_0xf3c2('0x7b')](_0xf3c2('0x84'),_0x2b5754['erlangCalls']);loggerPredictive[_0xf3c2('0x7b')](_0xf3c2('0x85'),_0x2b5754[_0xf3c2('0x74')]);loggerPredictive[_0xf3c2('0x7b')](_0xf3c2('0x86'),_0x2b5754[_0xf3c2('0x87')]);loggerPredictive[_0xf3c2('0x7b')](_0xf3c2('0x88'),_0x2b5754[_0xf3c2('0x89')]);loggerPredictive['info'](_0xf3c2('0x86'),_0x2b5754[_0xf3c2('0x87')]);loggerPredictive[_0xf3c2('0x7b')](_0xf3c2('0x8a'));_[_0xf3c2('0x8b')](_0x82964b,_0x2b5754);};}function getDiff(_0x259980){var _0x192e64=moment()[_0xf3c2('0x4d')](0x0);var _0x55748c=moment(_0x259980)['milliseconds'](0x0);return _0x192e64[_0xf3c2('0x8c')](_0x55748c,_0xf3c2('0x8d'));}function ifInterval(_0x26bb69,_0x3da639){if(_[_0xf3c2('0x7f')](_0x3da639)){return![];}return getDiff(_0x3da639)<_0x26bb69*0x3c;}function freeVariablesPredictive(_0x160729){if(isNotNull(_0x160729)){if(!_[_0xf3c2('0x7f')](_0x160729[_0xf3c2('0x2b')])){_0x160729[_0xf3c2('0x2b')]=undefined;loggerPredictive['info'](_0x160729[_0xf3c2('0x42')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xf3c2('0x7f')](_0x160729[_0xf3c2('0x2a')])){_0x160729[_0xf3c2('0x2a')]=undefined;loggerPredictive[_0xf3c2('0x7b')](_0x160729[_0xf3c2('0x42')],'clearing\x20variable\x20start\x20predictive');}if(!_['isUndefined'](_0x160729['handlePredictive'])){clearInterval(_0x160729['handlePredictive']);_0x160729[_0xf3c2('0x8e')]=undefined;loggerPredictive[_0xf3c2('0x7b')](_0x160729['name'],_0xf3c2('0x8f'));}}}function erlangb(_0x53eec6,_0x33ce64){if(_0x33ce64===0x0){return 0x0;}var _0x424306=0x1;for(var _0x339cca=0x1;_0x339cca<=_0x33ce64;_0x339cca+=0x1){_0x424306=0x1+_0x424306*_0x339cca/_0x53eec6;}return 0x1/_0x424306;}function isVoiceQueueOutbound(_0x401bc9){return _0x401bc9==='outbound';}function isNotPreview(_0x4965f5){return _0x4965f5!==_0xf3c2('0x23');}function isCampaignIvr(_0xf8611a){return _0xf8611a===_0xf3c2('0x7a');}function getCallerId(_0x51f146,_0x59eee5,_0x26d8cf){if(!_[_0xf3c2('0x7f')](_0x26d8cf)&&typeof _0x26d8cf===_0xf3c2('0x90')&&!_['isEmpty'](_0x26d8cf)){if(!_[_0xf3c2('0x7f')](_0x59eee5)&&typeof _0x59eee5==='string'&&!_['isEmpty'](_0x59eee5)){return util[_0xf3c2('0x78')](_0xf3c2('0x91'),_0x59eee5,_0x26d8cf);}return util[_0xf3c2('0x78')](_0xf3c2('0x91'),_0x26d8cf,_0x26d8cf);}if(!_[_0xf3c2('0x7f')](_0x51f146)&&typeof _0x51f146===_0xf3c2('0x90')&&!_[_0xf3c2('0x49')](_0x51f146)){return _0x51f146;}return _0xf3c2('0x92');}function loggerCatchQueueSummary(_0x370ba3,_0x5c55cd){return function(_0x372974){freeVariablesPredictive(_0x5c55cd);emitVoiceQueueSummary(_0x5c55cd);emitCampaignSummary(_0x5c55cd);loggerSyncQueueSummary[_0xf3c2('0x93')](_0x370ba3,util[_0xf3c2('0x94')](_0x372974,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5b48c4,_0x520cb6){return function(_0x31dbed){loggerPredictive[_0xf3c2('0x93')](_0x520cb6[_0xf3c2('0x42')],_0x5b48c4);loggerPredictive['error'](_0x31dbed[_0xf3c2('0x95')]);freeVariablesPredictive(_0x520cb6);};}function loggerCatch(_0x27ef19){return function(_0x2c0e8e){logger[_0xf3c2('0x93')](_0x27ef19,util['inspect'](_0x2c0e8e,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1a9133){return _0x1a9133&&!_[_0xf3c2('0x7f')](_0x1a9133)&&_0x1a9133['length']>0x0;}function decremetOriginate(_0xc35d34){if(!_[_0xf3c2('0x7f')](_0xc35d34)&&_0xc35d34!==null){if(typeof _0xc35d34['originated']!==_0xf3c2('0x96')){if(_0xc35d34[_0xf3c2('0x73')]>0x0){_0xc35d34['originated']-=0x1;}else{logger['error'](_0xf3c2('0x97'));}}}else{logger[_0xf3c2('0x93')](_0xf3c2('0x98'));}}function checkContactLowerLimitOriginate(_0x362932,_0x516871,_0x47fc41){if(_0x516871>_0x47fc41){for(var _0x5cd3e2=0x0;_0x5cd3e2<_0x516871-_0x47fc41;_0x5cd3e2+=0x1){decremetOriginate(_0x362932);}}}function loggerGetContactDialer(_0x102b91,_0x385bed,_0x5cb4cb){return function(_0x33906f){checkContactLowerLimitOriginate(_0x385bed,_0x5cb4cb,0x0);logger[_0xf3c2('0x93')](_0x102b91,util['inspect'](_0x33906f,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x492e24){return function(_0x510395){if(isNotNull(_0x510395)&&isNotNull(_0x510395[0x0])){if(_0x510395[0x0]['contactsRescheduled']>0x0){_0x492e24[_0xf3c2('0x41')]=_0xf3c2('0x99');logger[_0xf3c2('0x7b')](_0xf3c2('0x9a')+_0x492e24[_0xf3c2('0x42')],_0x510395[0x0][_0xf3c2('0x9b')],_0xf3c2('0x9c'));}else{_0x492e24[_0xf3c2('0x41')]=_0xf3c2('0x9d');logger['info'](_0xf3c2('0x9e')+_0x492e24['name']);}}};}function notSendMessagesQueue(_0x4e37f3){if(_0x4e37f3[_0xf3c2('0x9f')]){freeVariablesPredictive(_0x4e37f3);if(_0x4e37f3[_0xf3c2('0x73')]===0x0&&_0x4e37f3['talking']===0x0&&_0x4e37f3[_0xf3c2('0x5a')]===0x0&&(_0x4e37f3[_0xf3c2('0x55')]||0x0)===0x0){_0x4e37f3[_0xf3c2('0x9f')]=![];_0x4e37f3['available']=0x0;_0x4e37f3[_0xf3c2('0x41')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xf3c2('0x93')](_0xf3c2('0xa0'),_0x4e37f3['name'],'is\x20not\x20active');}else{_0x4e37f3[_0xf3c2('0x41')]=_0xf3c2('0xa1');loggerSyncQueueSummary[_0xf3c2('0x93')](_0xf3c2('0xa0'),_0x4e37f3['name'],_0xf3c2('0xa2'));}emitVoiceQueueSummary(_0x4e37f3);}}function notSendMessagesCampaign(_0x4b77f8){if(_0x4b77f8[_0xf3c2('0x9f')]){if(_0x4b77f8[_0xf3c2('0x73')]===0x0){_0x4b77f8[_0xf3c2('0x9f')]=![];_0x4b77f8[_0xf3c2('0x41')]=_0xf3c2('0x44');loggerSyncQueueSummary[_0xf3c2('0x93')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x4b77f8[_0xf3c2('0x42')],'is\x20not\x20active');}else{_0x4b77f8[_0xf3c2('0x41')]=_0xf3c2('0xa1');loggerSyncQueueSummary['error'](_0xf3c2('0xa3'),_0x4b77f8['name'],_0xf3c2('0xa2'));}emitCampaignSummary(_0x4b77f8);}}function createObjHistory(_0x3e1d05,_0x5528b8,_0x22b52c,_0x4939a5,_0x27cd5c){_0x3e1d05[_0xf3c2('0x41')]=_0x22b52c;var _0x5de7f8=new Action(_0x3e1d05,_0x5528b8);var _0x3b909f=new History(_0x5de7f8);_0x3b909f['state']=_0x4939a5;_0x3b909f[_0xf3c2('0xa4')]=_0x27cd5c;_0x3b909f[_0xf3c2('0xa5')]=_0x5de7f8[_0xf3c2('0xa6')];return _0x3b909f;}Dialer[_0xf3c2('0x1e')][_0xf3c2('0x40')]=function(){var _0x358a69=this;setInterval(function(){_0x358a69[_0xf3c2('0xa7')](_0x358a69[_0xf3c2('0xa8')],_0xf3c2('0xa9'));_0x358a69[_0xf3c2('0xa7')](_0x358a69['actions'],_0xf3c2('0xaa'));},0x32c8);};Dialer[_0xf3c2('0x1e')][_0xf3c2('0xa7')]=function(_0x583c49,_0x4b16cb){var _0x590d23=this;for(var _0x254f08 in _0x583c49){if(typeof _0x583c49[_0x254f08]!==_0xf3c2('0x96')){this[_0xf3c2('0x22')][_0xf3c2('0x1f')](function(){if(!_['isNil'](_0x583c49[_0x254f08])){return ami[_0xf3c2('0xab')]({'action':_0xf3c2('0xac'),'channel':_0x583c49[_0x254f08][_0xf3c2('0xad')]})[_0xf3c2('0xae')](function(_0x5c5b3b){if(_0x5c5b3b['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x583c49[_0x254f08]&&_0x583c49[_0x254f08][_0xf3c2('0x4f')]!=='ivr'){_0x590d23[_0xf3c2('0xaf')](_0x590d23[_0xf3c2('0x24')][_0x583c49[_0x254f08][_0xf3c2('0xb0')]]);logger[_0xf3c2('0x93')](_0xf3c2('0xb1'),_0x4b16cb,_0x254f08,_0x583c49[_0x254f08][_0xf3c2('0xb0')]);delete _0x583c49[_0x254f08];}if(_0x583c49[_0x254f08]&&_0x583c49[_0x254f08][_0xf3c2('0x4f')]===_0xf3c2('0x7a')){_0x590d23[_0xf3c2('0xaf')](_0x590d23[_0xf3c2('0x25')][_0x583c49[_0x254f08]['queue']]);logger[_0xf3c2('0x93')]('[Dialer][checkChannel][ivr]',_0x4b16cb,_0x254f08,_0x583c49[_0x254f08]['queue']);delete _0x583c49[_0x254f08];}},0x2328);}});}});}}};Dialer['prototype']['countReScheduled']=function(_0x495bff){return BPromise[_0xf3c2('0xb2')]()[_0xf3c2('0xb3')](cmHopper[_0xf3c2('0xb4')](_0x495bff))[_0xf3c2('0xae')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xf3c2('0x1e')][_0xf3c2('0xb5')]=function(_0x578407){return BPromise['resolve']()[_0xf3c2('0xb3')](cmHopperBlack[_0xf3c2('0xb5')](_0x578407))['catch'](loggerCatch(_0xf3c2('0xb6')));};Dialer[_0xf3c2('0x1e')][_0xf3c2('0xb7')]=function(_0x1e8760){return BPromise['resolve']()[_0xf3c2('0xb3')](cmHopperBlack[_0xf3c2('0xb7')](_0x1e8760))[_0xf3c2('0xae')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xf3c2('0x1e')][_0xf3c2('0xb8')]=function(_0x499480){return BPromise[_0xf3c2('0xb2')]()['then'](cmHopperHistory[_0xf3c2('0xb9')](_0x499480))[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0xba')));};Dialer[_0xf3c2('0x1e')]['rescheduleContact']=function(_0x12f1ee){return BPromise['resolve']()[_0xf3c2('0xb3')](cmHopper[_0xf3c2('0xbb')](_0x12f1ee))[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0xbc')));};Dialer['prototype']['unlockContact']=function(_0x1f3c6a,_0x4810c0,_0x34c1d4){return BPromise[_0xf3c2('0xb2')]()[_0xf3c2('0xb3')](cmHopper['unlockContact'](_0x1f3c6a,_0x4810c0,_0x34c1d4))['catch'](loggerCatch(_0xf3c2('0xbd')));};Dialer['prototype'][_0xf3c2('0xbe')]=function(_0x2ab4e3,_0x4875c0,_0x244bda,_0x2bbed3){return BPromise[_0xf3c2('0xb2')]()[_0xf3c2('0xb3')](cmHopper['getContactDialer'](_0x2ab4e3,_0x4875c0,_0x244bda,_0x2bbed3))[_0xf3c2('0xae')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xf3c2('0x1e')][_0xf3c2('0xbf')]=function(_0x155621,_0x179097,_0x5d289c){return BPromise[_0xf3c2('0xb2')]()[_0xf3c2('0xb3')](cmHopper[_0xf3c2('0xbf')](_0x155621,_0x179097,_0x5d289c))[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0xc0')));};Dialer[_0xf3c2('0x1e')][_0xf3c2('0xc1')]=function(_0x379011){return BPromise[_0xf3c2('0xb2')]()[_0xf3c2('0xb3')](voiceQueueRt[_0xf3c2('0xc1')](_0x379011))[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0xc2')));};Dialer[_0xf3c2('0x1e')][_0xf3c2('0xc3')]=function(_0x371ae5){return BPromise['resolve']()[_0xf3c2('0xb3')](cmHopper['moveContactManagedDialer'](_0x371ae5))[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0xc4')));};Dialer['prototype'][_0xf3c2('0xc5')]=function(_0x5aba4e){return BPromise['resolve']()[_0xf3c2('0xb3')](cmHopperHistory[_0xf3c2('0xc5')](_0x5aba4e))[_0xf3c2('0xae')](loggerCatch('[createHistory]\x20'));};Dialer[_0xf3c2('0x1e')]['updateOriginated']=function(_0x20dd4c){if(!_['isUndefined'](_0x20dd4c)&&_0x20dd4c!==null){if(typeof _0x20dd4c[_0xf3c2('0x73')]!=='undefined'){if(_0x20dd4c[_0xf3c2('0x73')]>0x0){_0x20dd4c[_0xf3c2('0x73')]-=0x1;}else{logger[_0xf3c2('0x93')](_0xf3c2('0xc6'));}}}else{logger[_0xf3c2('0x93')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xf3c2('0x1e')][_0xf3c2('0xc7')]=function(_0x1466fd,_0x194f83){var _0x3f1579=this;return function(_0x3ac12a){_0x3f1579['updateOriginated'](_0x194f83);logger[_0xf3c2('0x93')](_0x1466fd,util[_0xf3c2('0x94')](_0x3ac12a,{'showHidden':![],'depth':null}));};};Dialer[_0xf3c2('0x1e')]['emptyContact']=function(_0x2a2a30,_0xe1ecf0,_0x28bad8){var _0x6906e={'state':0x19,'statedesc':'notFound'};this[_0xf3c2('0xaf')](_0xe1ecf0);this[_0xf3c2('0xc8')](_['merge'](_0x6906e,_[_0xf3c2('0xc9')](_0x28bad8,[_0xf3c2('0xca'),'ListId',_0xf3c2('0xcb'),'VoiceQueueId',_0xf3c2('0xcc')])),_0xf3c2('0xcd'),_0xf3c2('0xce'));logger[_0xf3c2('0x93')](_0x2a2a30);};Dialer[_0xf3c2('0x1e')][_0xf3c2('0xcf')]=function(_0x3cb134){return _0x3cb134===_0xf3c2('0xd0');};Dialer[_0xf3c2('0x1e')][_0xf3c2('0xd1')]=function(_0x406468){return!_[_0xf3c2('0x7f')](_0x406468)&&_0x406468&&!_[_0xf3c2('0x7f')](_0x406468[_0xf3c2('0x42')])&&!_[_0xf3c2('0x7f')](_0x406468[_0xf3c2('0x76')])&&_0x406468[_0xf3c2('0x76')]&&(this[_0xf3c2('0x27')][util[_0xf3c2('0x78')]('SIP/%s',_0x406468[_0xf3c2('0x42')])][_0xf3c2('0xac')]===_0xf3c2('0xd2')||this[_0xf3c2('0x27')][util['format'](_0xf3c2('0xd3'),_0x406468[_0xf3c2('0x42')])][_0xf3c2('0xac')]===_0xf3c2('0xd4'));};Dialer[_0xf3c2('0x1e')][_0xf3c2('0xc8')]=function(_0x5e4edf,_0x5d07f6,_0x13ec76){this[_0xf3c2('0xc5')](_0x5e4edf)[_0xf3c2('0xae')](loggerCatch(_0x5d07f6));this[_0xf3c2('0xc3')](_0x5e4edf)[_0xf3c2('0xae')](loggerCatch(_0x13ec76));};Dialer[_0xf3c2('0x1e')][_0xf3c2('0x3b')]=function(_0x5b57ce){var _0x24103d=this[_0xf3c2('0xa8')][_0x5b57ce[_0xf3c2('0xd5')]];var _0x450ae8;if(!_[_0xf3c2('0xd6')](_0x5b57ce)&&!_[_0xf3c2('0xd6')](_0x5b57ce[_0xf3c2('0xd7')])&&!_[_0xf3c2('0xd6')](_0x5b57ce[_0xf3c2('0xd7')][_0xf3c2('0xd8')])&&_0x5b57ce[_0xf3c2('0xd9')]===_0xf3c2('0xda')&&_0x24103d){if(_0x24103d['type']!=='ivr'&&this['voiceQueues'][_0x24103d[_0xf3c2('0xb0')]]['dialAMDActive']&&_0x5b57ce[_0xf3c2('0xdb')]===_0xf3c2('0xdc')){delete this[_0xf3c2('0xa8')][_0x5b57ce[_0xf3c2('0xd5')]];this[_0xf3c2('0xaf')](this[_0xf3c2('0x24')][_0x24103d[_0xf3c2('0xb0')]]);this[_0xf3c2('0x24')][_0x24103d[_0xf3c2('0xb0')]][_0xf3c2('0xdd')]+=0x1;this[_0xf3c2('0x24')][_0x24103d[_0xf3c2('0xb0')]]['outboundAnswerAgiCallsDay']+=0x1;_0x450ae8=new Hangup(_0x24103d,_0x5b57ce);_0x450ae8[_0xf3c2('0xde')]=0x12;_0x450ae8[_0xf3c2('0xa4')]=_0xf3c2('0xdf');_0x450ae8['membername']=_0xf3c2('0xe0');this[_0xf3c2('0xc8')](_0x450ae8,'[syncHangupInAMD][createHistory]',_0xf3c2('0xe1'));}if(_0x24103d[_0xf3c2('0x4f')]!==_0xf3c2('0x7a')&&this['voiceQueues'][_0x24103d[_0xf3c2('0xb0')]]['dialAMDActive']&&_0x5b57ce['value']==='MACHINE'){var _0x1f177d=this;return new BPromise(function(_0x2c7022,_0x453f56){delete _0x1f177d[_0xf3c2('0xa8')][_0x5b57ce['uniqueid']];_0x1f177d[_0xf3c2('0xaf')](_0x1f177d[_0xf3c2('0x24')][_0x24103d[_0xf3c2('0xb0')]]);_0x1f177d[_0xf3c2('0x24')][_0x24103d[_0xf3c2('0xb0')]][_0xf3c2('0xdd')]+=0x1;_0x1f177d['voiceQueues'][_0x24103d[_0xf3c2('0xb0')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x517390=_0x1f177d[_0xf3c2('0x24')][_0x24103d[_0xf3c2('0xb0')]];var _0x263ebd=new Hangup(_0x24103d,_0x5b57ce);_0x263ebd[_0xf3c2('0xde')]=0x13;_0x263ebd[_0xf3c2('0xa4')]='Machine';_0x263ebd[_0xf3c2('0xe2')]=_0xf3c2('0xe0');_0x263ebd[_0xf3c2('0xe3')]+=0x1;_0x263ebd[_0xf3c2('0xe4')]+=0x1;_0x263ebd['amd']=!![];_0x1f177d['createHistory'](_0x263ebd)['catch'](loggerCatch(_0xf3c2('0xe5')));if(_0x263ebd[_0xf3c2('0xe6')]+_0x263ebd[_0xf3c2('0xe7')]+_0x263ebd['countnoanswerretry']+_0x263ebd[_0xf3c2('0xe8')]+_0x263ebd['countdropretry']+_0x263ebd[_0xf3c2('0xe9')]+_0x263ebd[_0xf3c2('0xe3')]+_0x263ebd[_0xf3c2('0xea')]>=_0x517390[_0xf3c2('0xeb')]){_0x1f177d[_0xf3c2('0xec')](_0x263ebd,_0x2c7022,_0x453f56,_0xf3c2('0xed'));}else{if(_0x263ebd[_0xf3c2('0xe3')]>=_0x517390['dialMachineMaxRetry']){_0x1f177d[_0xf3c2('0xee')](_0x263ebd,_0x2c7022,_0x453f56,'reason\x2019\x20machine....');}else{_0x1f177d[_0xf3c2('0xbb')]({'active':![],'countmachineretry':_0x263ebd[_0xf3c2('0xe3')],'scheduledat':moment()[_0xf3c2('0xef')](_0x517390[_0xf3c2('0xf0')],_0xf3c2('0xf1'))[_0xf3c2('0x78')](_0xf3c2('0xf2')),'ContactId':_0x263ebd['ContactId'],'ListId':_0x263ebd[_0xf3c2('0xf3')],'VoiceQueueId':_0x263ebd[_0xf3c2('0xf4')]||undefined,'CampaignId':_0x263ebd[_0xf3c2('0xcc')]||undefined})[_0xf3c2('0xae')](loggerCatch('[rescheduleContact][Machine]'));_0x2c7022({'reschedule':0x1});}}});}if(_0x24103d['type']===_0xf3c2('0x7a')&&this[_0xf3c2('0x25')][_0x24103d[_0xf3c2('0xb0')]][_0xf3c2('0xf5')]&&_0x5b57ce[_0xf3c2('0xdb')]===_0xf3c2('0xdc')){delete this[_0xf3c2('0xa8')][_0x5b57ce[_0xf3c2('0xd5')]];this['updateOriginated'](this[_0xf3c2('0x25')][_0x24103d['queue']]);_0x450ae8=new Hangup(_0x24103d,_0x5b57ce);_0x450ae8[_0xf3c2('0xde')]=0x12;_0x450ae8['statedesc']=_0xf3c2('0xdf');_0x450ae8[_0xf3c2('0xe2')]='AMD';this['saveInDb'](_0x450ae8,'[syncHangupInAMDIvr][createHistory]',_0xf3c2('0xf6'));}if(_0x24103d[_0xf3c2('0x4f')]===_0xf3c2('0x7a')&&this[_0xf3c2('0x25')][_0x24103d[_0xf3c2('0xb0')]]['dialAMDActive']&&_0x5b57ce[_0xf3c2('0xdb')]===_0xf3c2('0xf7')){var _0x1f177d=this;return new BPromise(function(_0x2c7300,_0x108dc9){delete _0x1f177d['uniqueId'][_0x5b57ce['uniqueid']];_0x1f177d[_0xf3c2('0xaf')](_0x1f177d[_0xf3c2('0x25')][_0x24103d[_0xf3c2('0xb0')]]);_0x1f177d['campaigns'][_0x24103d['queue']][_0xf3c2('0xdd')]+=0x1;_0x1f177d['campaigns'][_0x24103d[_0xf3c2('0xb0')]][_0xf3c2('0x5e')]+=0x1;var _0xdd8460=_0x1f177d['campaigns'][_0x24103d[_0xf3c2('0xb0')]];var _0x1392c1=new Hangup(_0x24103d,_0x5b57ce);_0x1392c1[_0xf3c2('0xde')]=0x13;_0x1392c1['statedesc']=_0xf3c2('0xf8');_0x1392c1[_0xf3c2('0xe2')]=_0xf3c2('0xe0');_0x1392c1[_0xf3c2('0xe3')]+=0x1;_0x1392c1[_0xf3c2('0xe4')]+=0x1;_0x1392c1[_0xf3c2('0xf9')]=!![];_0x1f177d[_0xf3c2('0xc5')](_0x1392c1)[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0xe5')));if(_0x1392c1[_0xf3c2('0xe6')]+_0x1392c1['countcongestionretry']+_0x1392c1[_0xf3c2('0xfa')]+_0x1392c1[_0xf3c2('0xe8')]+_0x1392c1[_0xf3c2('0xfb')]+_0x1392c1['countabandonedretry']+_0x1392c1['countmachineretry']+_0x1392c1[_0xf3c2('0xea')]>=_0xdd8460[_0xf3c2('0xeb')]){_0x1f177d[_0xf3c2('0xec')](_0x1392c1,_0x2c7300,_0x108dc9,_0xf3c2('0xed'));}else{if(_0x1392c1[_0xf3c2('0xe3')]>=_0xdd8460[_0xf3c2('0xfc')]){_0x1f177d[_0xf3c2('0xee')](_0x1392c1,_0x2c7300,_0x108dc9,_0xf3c2('0xfd'));}else{_0x1f177d[_0xf3c2('0xbb')]({'active':![],'countmachineretry':_0x1392c1[_0xf3c2('0xe3')],'scheduledat':moment()['add'](_0xdd8460[_0xf3c2('0xf0')],'minutes')[_0xf3c2('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1392c1[_0xf3c2('0xca')],'ListId':_0x1392c1[_0xf3c2('0xf3')],'VoiceQueueId':_0x1392c1[_0xf3c2('0xf4')]||undefined,'CampaignId':_0x1392c1[_0xf3c2('0xcc')]||undefined})['catch'](loggerCatch(_0xf3c2('0xfe')));_0x2c7300({'reschedule':0x1});}}});}}};Dialer[_0xf3c2('0x1e')][_0xf3c2('0x38')]=function(_0x4af70a){var _0x410754=this[_0xf3c2('0xa8')][_0x4af70a[_0xf3c2('0xd5')]];var _0x3aac1b=this;var _0x2e67f6;if(_0x410754&&_0x410754['type']===_0xf3c2('0x7a')){delete this[_0xf3c2('0xa8')][_0x4af70a[_0xf3c2('0xd5')]];this['updateOriginated'](this[_0xf3c2('0x25')][_0x410754[_0xf3c2('0xb0')]]);this[_0xf3c2('0x25')][_0x410754[_0xf3c2('0xb0')]][_0xf3c2('0xff')]+=0x1;_0x2e67f6=new Hangup(_0x410754,_0x4af70a);this[_0xf3c2('0xc5')](_0x2e67f6)[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0x100')));this['moveContactManagedDialer'](_0x2e67f6)['catch'](loggerCatch(_0xf3c2('0x101')));}if(_0x410754&&_0x410754[_0xf3c2('0x4f')]!==_0xf3c2('0x7a')&&isNotNull(this[_0xf3c2('0x24')][_0x410754[_0xf3c2('0xb0')]]['dialQueueProject'])){delete this['uniqueId'][_0x4af70a[_0xf3c2('0xd5')]];this['updateOriginated'](this[_0xf3c2('0x24')][_0x410754[_0xf3c2('0xb0')]]);this['voiceQueues'][_0x410754[_0xf3c2('0xb0')]][_0xf3c2('0xdd')]+=0x1;this[_0xf3c2('0x24')][_0x410754[_0xf3c2('0xb0')]][_0xf3c2('0x5e')]+=0x1;_0x2e67f6=new Hangup(_0x410754,_0x4af70a);_0x2e67f6[_0xf3c2('0xde')]=0x10;_0x2e67f6[_0xf3c2('0xa4')]=_0xf3c2('0x102');_0x2e67f6['membername']=_0xf3c2('0x103');this['createHistory'](_0x2e67f6)['catch'](loggerCatch(_0xf3c2('0x100')));this[_0xf3c2('0xc3')](_0x2e67f6)[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0x101')));}if(_0x410754&&_0x410754[_0xf3c2('0x4f')]!==_0xf3c2('0x7a')&&!isNotNull(this[_0xf3c2('0x24')][_0x410754[_0xf3c2('0xb0')]][_0xf3c2('0x104')])){delete this[_0xf3c2('0xa8')][_0x4af70a[_0xf3c2('0xd5')]];this[_0xf3c2('0xaf')](this['voiceQueues'][_0x410754[_0xf3c2('0xb0')]]);this[_0xf3c2('0x24')][_0x410754['queue']][_0xf3c2('0x69')]+=0x1;_0x2e67f6=new Hangup(_0x410754,_0x4af70a);_0x2e67f6[_0xf3c2('0xde')]=0xc;_0x2e67f6[_0xf3c2('0xa4')]=_0x4af70a[_0xf3c2('0x105')];_0x2e67f6[_0xf3c2('0xe2')]=_0xf3c2('0x106');this[_0xf3c2('0xc5')](_0x2e67f6)[_0xf3c2('0xae')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xf3c2('0xc3')](_0x2e67f6)[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0x101')));}};Dialer['prototype'][_0xf3c2('0x36')]=function(_0x1bc484){var _0x56264f=this[_0xf3c2('0xa8')][_0x1bc484['uniqueid']];var _0x4cd83e=this;if(this[_0xf3c2('0x24')][_0x1bc484[_0xf3c2('0xb0')]]){if(_0x56264f&&_0x56264f[_0xf3c2('0x4f')]!==_0xf3c2('0x7a')){delete this['uniqueId'][_0x1bc484[_0xf3c2('0xd5')]];this[_0xf3c2('0x24')][_0x1bc484['queue']][_0xf3c2('0xdd')]+=0x1;var _0x320b50=new AgentComplete(_0x56264f,_0x1bc484);if(_0x1bc484[_0xf3c2('0x107')]===_0xf3c2('0x108')){_0x320b50['agiafterat']=this['voiceQueues'][_0x1bc484['queue']][_0xf3c2('0x109')]&&this[_0xf3c2('0x24')][_0x1bc484[_0xf3c2('0xb0')]][_0xf3c2('0x10a')]?moment()['format'](_0xf3c2('0xf2')):undefined;}this['createHistory'](_0x320b50)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xf3c2('0xc3')](_0x320b50)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0xf3c2('0x30')]=function(_0x48f3b4){if(this[_0xf3c2('0x24')][_0x48f3b4[_0xf3c2('0xb0')]]){if(this['uniqueId'][_0x48f3b4[_0xf3c2('0xd5')]]&&this['uniqueId'][_0x48f3b4[_0xf3c2('0xd5')]][_0xf3c2('0x4f')]!==_0xf3c2('0x7a')){this['updateOriginated'](this[_0xf3c2('0x24')][_0x48f3b4[_0xf3c2('0xb0')]]);this[_0xf3c2('0xa8')][_0x48f3b4[_0xf3c2('0xd5')]]['answertime']=moment()[_0xf3c2('0x78')](_0xf3c2('0xf2'));}}};Dialer['prototype'][_0xf3c2('0x10b')]=function(_0x1fa647){this[_0xf3c2('0xc5')](_0x1fa647)[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0x10c')));this[_0xf3c2('0xc3')](_0x1fa647)[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0x10d')));};Dialer['prototype'][_0xf3c2('0x33')]=function(_0x35b41d){var _0x5ad361=this['uniqueId'][_0x35b41d[_0xf3c2('0xd5')]];var _0x58bfea=this;if(this[_0xf3c2('0x24')][_0x35b41d['queue']]){if(_0x5ad361&&_0x5ad361['type']!==_0xf3c2('0x7a')){delete this[_0xf3c2('0xa8')][_0x35b41d[_0xf3c2('0xd5')]];this[_0xf3c2('0xaf')](this['voiceQueues'][_0x35b41d['queue']]);_0x5ad361[_0xf3c2('0x10e')]=moment()['format'](_0xf3c2('0xf2'));var _0x4962e3=new QueueCallerAbandon(_0x5ad361,_0x35b41d);if(getSeconds(_0x5ad361['droptime'],_0x5ad361[_0xf3c2('0x10f')])>=_0x5ad361[_0xf3c2('0x110')]){this['voiceQueues'][_0x35b41d['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xf3c2('0x24')][_0x35b41d[_0xf3c2('0xb0')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xf3c2('0x24')][_0x35b41d[_0xf3c2('0xb0')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x4962e3[_0xf3c2('0xde')]=0xa;_0x4962e3[_0xf3c2('0xa4')]=_0xf3c2('0x111');_0x4962e3[_0xf3c2('0x112')]='TIMEOUT';_0x4962e3[_0xf3c2('0x113')]=this['voiceQueues'][_0x35b41d[_0xf3c2('0xb0')]]['dialQueueProject2']?moment()[_0xf3c2('0x78')](_0xf3c2('0xf2')):undefined;_0x4962e3[_0xf3c2('0xfb')]+=0x1;_0x4962e3[_0xf3c2('0xe4')]+=0x1;if(_0x4962e3[_0xf3c2('0xfb')]>=this['voiceQueues'][_0x35b41d['queue']][_0xf3c2('0x114')]){this['queueCallerAbandonCreateState'](_0x4962e3);}else{this[_0xf3c2('0xbb')]({'active':![],'countdropretry':_0x4962e3[_0xf3c2('0xfb')],'scheduledat':moment()[_0xf3c2('0xef')](this['voiceQueues'][_0x35b41d[_0xf3c2('0xb0')]]['dialDropRetryFrequency'],'minutes')[_0xf3c2('0x78')](_0xf3c2('0xf2')),'ContactId':_0x5ad361['ContactId'],'ListId':_0x5ad361['ListId'],'VoiceQueueId':_0x5ad361[_0xf3c2('0xf4')]||undefined,'CampaignId':_0x5ad361[_0xf3c2('0xcc')]||undefined})[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0x115')));var _0x4a91f8=new History(_0x4962e3);_0x4a91f8[_0xf3c2('0xde')]=0xa;_0x4a91f8[_0xf3c2('0xa4')]=_0xf3c2('0x111');_0x4a91f8[_0xf3c2('0xa6')]=moment()[_0xf3c2('0x78')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a91f8[_0xf3c2('0xa5')]=_0x4a91f8[_0xf3c2('0xa6')];_0x4a91f8[_0xf3c2('0x116')]=_0x4962e3[_0xf3c2('0x116')];_0x4a91f8[_0xf3c2('0x117')]=_0x4962e3['calleridnum'];this['createHistory'](_0x4a91f8)['catch'](loggerCatch(_0xf3c2('0x118')));}}else{this['voiceQueues'][_0x35b41d[_0xf3c2('0xb0')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xf3c2('0x24')][_0x35b41d[_0xf3c2('0xb0')]][_0xf3c2('0x119')]+=0x1;_0x4962e3['state']=0xb;_0x4962e3['statedesc']=_0xf3c2('0x11a');_0x4962e3[_0xf3c2('0x112')]=_0xf3c2('0x11b');_0x4962e3[_0xf3c2('0xe9')]+=0x1;_0x4962e3[_0xf3c2('0xe4')]+=0x1;if(_0x4962e3['countabandonedretry']>=this[_0xf3c2('0x24')][_0x35b41d['queue']][_0xf3c2('0x11c')]){this[_0xf3c2('0x10b')](_0x4962e3);}else{this[_0xf3c2('0xbb')]({'active':![],'countabandonedretry':_0x4962e3['countabandonedretry'],'scheduledat':moment()[_0xf3c2('0xef')](this[_0xf3c2('0x24')][_0x35b41d['queue']][_0xf3c2('0x11d')],_0xf3c2('0xf1'))[_0xf3c2('0x78')](_0xf3c2('0xf2')),'ContactId':_0x5ad361[_0xf3c2('0xca')],'ListId':_0x5ad361[_0xf3c2('0xf3')],'VoiceQueueId':_0x5ad361[_0xf3c2('0xf4')]||undefined,'CampaignId':_0x5ad361[_0xf3c2('0xcc')]||undefined})[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0x11e')));var _0x4a91f8=new History(_0x4962e3);_0x4a91f8[_0xf3c2('0xde')]=0xb;_0x4a91f8[_0xf3c2('0xa4')]='Abandoned';_0x4a91f8[_0xf3c2('0xa6')]=moment()[_0xf3c2('0x78')](_0xf3c2('0xf2'));_0x4a91f8['endtime']=_0x4a91f8[_0xf3c2('0xa6')];_0x4a91f8[_0xf3c2('0x116')]=_0x4962e3[_0xf3c2('0x116')];_0x4a91f8[_0xf3c2('0x117')]=_0x4962e3['calleridnum'];this[_0xf3c2('0xc5')](_0x4a91f8)[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0x11f')));}}}}};Dialer[_0xf3c2('0x1e')][_0xf3c2('0x120')]=function(_0x15534f){if(this[_0xf3c2('0x121')][_0x15534f[_0xf3c2('0xd5')]]){this[_0xf3c2('0x121')][_0x15534f[_0xf3c2('0xd5')]][_0xf3c2('0xad')]=_0x15534f['channel'];}if(this['uniqueId'][_0x15534f[_0xf3c2('0xd5')]]){this[_0xf3c2('0xa8')][_0x15534f['uniqueid']][_0xf3c2('0xad')]=_0x15534f['channel'];}};Dialer[_0xf3c2('0x1e')][_0xf3c2('0x3d')]=function(_0xd6bc86){if(strategy[this[_0xf3c2('0x24')][this[_0xf3c2('0x121')][_0xd6bc86[_0xf3c2('0x122')]][_0xf3c2('0xb0')]][_0xf3c2('0x51')]]===_0xf3c2('0x1d')){if(this[_0xf3c2('0x121')][_0xd6bc86[_0xf3c2('0x122')]]&&_['isNil'](this['actions'][_0xd6bc86[_0xf3c2('0x122')]][_0xf3c2('0x123')])&&_0xd6bc86[_0xf3c2('0xac')]==='1'&&_0xd6bc86[_0xf3c2('0x124')]==='0'){if(this['agents'][_0xd6bc86[_0xf3c2('0x125')]]){if(!this[_0xf3c2('0x26')][_0xd6bc86[_0xf3c2('0x125')]][_0xf3c2('0x123')]){this['agents'][_0xd6bc86[_0xf3c2('0x125')]][_0xf3c2('0x123')]=!![];this[_0xf3c2('0x121')][_0xd6bc86[_0xf3c2('0x122')]][_0xf3c2('0x123')]=!![];this[_0xf3c2('0x121')][_0xd6bc86[_0xf3c2('0x122')]][_0xf3c2('0x125')]=_0xd6bc86[_0xf3c2('0x125')];}}}}else if((strategy[this['voiceQueues'][this[_0xf3c2('0x121')][_0xd6bc86[_0xf3c2('0x122')]][_0xf3c2('0xb0')]]['strategy']]||_0xf3c2('0x1c'))==='rrmemory'){if(this['actions'][_0xd6bc86[_0xf3c2('0x122')]]){if(this[_0xf3c2('0x26')][_0xd6bc86[_0xf3c2('0x125')]]){this['actions'][_0xd6bc86[_0xf3c2('0x122')]][_0xf3c2('0x125')]=_0xd6bc86[_0xf3c2('0x125')];if(_[_0xf3c2('0xd6')](this[_0xf3c2('0x2d')][this['actions'][_0xd6bc86[_0xf3c2('0x122')]][_0xf3c2('0xb0')]])){this['queueBooked'][this[_0xf3c2('0x121')][_0xd6bc86['actionid']]['queue']]=[];}this['queueBooked'][this[_0xf3c2('0x121')][_0xd6bc86[_0xf3c2('0x122')]][_0xf3c2('0xb0')]][_0xf3c2('0x126')](_[_0xf3c2('0x8b')](_[_0xf3c2('0xc9')](this[_0xf3c2('0x121')][_0xd6bc86['actionid']],[_0xf3c2('0x127'),_0xf3c2('0x125')]),{'status':_0xd6bc86[_0xf3c2('0xac')],'paused':_0xd6bc86[_0xf3c2('0x124')]}));}}}};function unlockQueueStatus(_0x4be140,_0x37b80b){setTimeout(function(){if(_['isUndefined'](_0x4be140['queueStatusComplete'])){loggerBooked[_0xf3c2('0x93')](_0xf3c2('0x128'),_0x37b80b);}_0x4be140[_0xf3c2('0x129')]=!![];loggerBooked[_0xf3c2('0x7b')](_0xf3c2('0x12a'),_0x37b80b,JSON[_0xf3c2('0x4c')](_[_0xf3c2('0xc9')](_0x4be140,[_0xf3c2('0x42'),_0xf3c2('0x129')])));},0x1f3);}Dialer[_0xf3c2('0x1e')][_0xf3c2('0x12b')]=function(_0x13b3c5){var _0x731ad3=this;var _0x215143=_0x731ad3['voiceQueues'][_0x731ad3['actions'][_0x13b3c5[_0xf3c2('0x122')]][_0xf3c2('0xb0')]];if(strategy[this[_0xf3c2('0x24')][this[_0xf3c2('0x121')][_0x13b3c5[_0xf3c2('0x122')]]['queue']][_0xf3c2('0x51')]]===_0xf3c2('0x1d')){if(this[_0xf3c2('0x121')][_0x13b3c5[_0xf3c2('0x122')]]&&this['actions'][_0x13b3c5[_0xf3c2('0x122')]][_0xf3c2('0x125')]){this[_0xf3c2('0x23')]['run'](this[_0xf3c2('0x121')][_0x13b3c5['actionid']][_0xf3c2('0x127')],this[_0xf3c2('0x121')][_0x13b3c5[_0xf3c2('0x122')]][_0xf3c2('0x125')])[_0xf3c2('0xae')](function(_0x2eea7a){logger[_0xf3c2('0x93')](_0xf3c2('0x12c'),util[_0xf3c2('0x94')](_0x2eea7a,{'showHidden':![],'depth':null}));})[_0xf3c2('0x21')](function(){_0x731ad3[_0xf3c2('0xaf')](_0x731ad3[_0xf3c2('0x24')][_0x731ad3[_0xf3c2('0x121')][_0x13b3c5['actionid']]['queue']]);_0x731ad3[_0xf3c2('0x26')][_0x731ad3[_0xf3c2('0x121')][_0x13b3c5[_0xf3c2('0x122')]][_0xf3c2('0x125')]][_0xf3c2('0x123')]=![];delete _0x731ad3[_0xf3c2('0x121')][_0x13b3c5[_0xf3c2('0x122')]];unlockQueueStatus(_0x215143);});}else{this[_0xf3c2('0xaf')](this[_0xf3c2('0x24')][this['actions'][_0x13b3c5[_0xf3c2('0x122')]][_0xf3c2('0xb0')]]);this[_0xf3c2('0xbb')]({'active':![],'ContactId':this['actions'][_0x13b3c5[_0xf3c2('0x122')]][_0xf3c2('0xca')],'ListId':this[_0xf3c2('0x121')][_0x13b3c5[_0xf3c2('0x122')]][_0xf3c2('0xf3')],'VoiceQueueId':this['actions'][_0x13b3c5[_0xf3c2('0x122')]][_0xf3c2('0xf4')]||undefined,'CampaignId':this['actions'][_0x13b3c5['actionid']]['CampaignId']||undefined})[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0x12d')));delete this[_0xf3c2('0x121')][_0x13b3c5[_0xf3c2('0x122')]];unlockQueueStatus(_0x215143);}}else if((strategy[this[_0xf3c2('0x24')][this['actions'][_0x13b3c5[_0xf3c2('0x122')]][_0xf3c2('0xb0')]][_0xf3c2('0x51')]]||_0xf3c2('0x1c'))==='rrmemory'){var _0x31492f;if(this[_0xf3c2('0x121')][_0x13b3c5[_0xf3c2('0x122')]]&&!_[_0xf3c2('0x49')](this[_0xf3c2('0x2d')][this['actions'][_0x13b3c5[_0xf3c2('0x122')]][_0xf3c2('0xb0')]])){if(this[_0xf3c2('0x2e')][_0x731ad3[_0xf3c2('0x121')][_0x13b3c5['actionid']][_0xf3c2('0xb0')]]){this[_0xf3c2('0x2e')][_0x731ad3['actions'][_0x13b3c5[_0xf3c2('0x122')]][_0xf3c2('0xb0')]]=this['queueBookedRR'][this[_0xf3c2('0x121')][_0x13b3c5[_0xf3c2('0x122')]][_0xf3c2('0xb0')]]?this[_0xf3c2('0x2e')][this[_0xf3c2('0x121')][_0x13b3c5[_0xf3c2('0x122')]][_0xf3c2('0xb0')]]:this[_0xf3c2('0x2d')][this['actions'][_0x13b3c5[_0xf3c2('0x122')]][_0xf3c2('0xb0')]]?this[_0xf3c2('0x2d')][this[_0xf3c2('0x121')][_0x13b3c5['actionid']]['queue']][_0xf3c2('0x12e')]||0x0:0x0;}this[_0xf3c2('0x2d')][this[_0xf3c2('0x121')][_0x13b3c5[_0xf3c2('0x122')]][_0xf3c2('0xb0')]][_0xf3c2('0x12e')]=this[_0xf3c2('0x2e')][this[_0xf3c2('0x121')][_0x13b3c5[_0xf3c2('0x122')]]['queue']];for(var _0x2509c7=0x0;_0x2509c7=0x0;})[_0xf3c2('0xae')](myreject(_0x231ddc)));}}else{_0x29e1dd['push'](ami[_0xf3c2('0xab')]({'action':_0xf3c2('0x144'),'command':util[_0xf3c2('0x78')](_0xf3c2('0x145'),_0x59d9f7,!_['isUndefined'](config[_0xf3c2('0x140')][_0x23fbb6])?_0x23fbb6:'')})[_0xf3c2('0xb3')](function(_0x5ebe88){return _0x5ebe88[_0xf3c2('0x149')][_0xf3c2('0x147')](_0xf3c2('0x148'))>=0x0;})[_0xf3c2('0xae')](myreject(_0x231ddc)));}BPromise[_0xf3c2('0x14a')](_0x29e1dd)['then'](function(_0x5ba291){var _0x148bb0=_[_0xf3c2('0x14b')](_0x5ba291);if(_0x148bb0){return _0x438dc3(_0x148bb0);}else{_0x54baea['message']=_0x189f89?'GLOBAL_INTERVAL_IS_OVERTIME':_0xf3c2('0x14c');return _0x231ddc(msgResponse('[ifTime][promiseAll]','Failure','Global:\x20'+_0x189f89+'\x20'+_0x5e9f95+_0xf3c2('0x14d')+util['inspect'](_0x59d9f7,{'showHidden':![],'depth':null})+_0xf3c2('0x14e')+_0x23fbb6));}})[_0xf3c2('0xae')](function(_0x2f30ea){return _0x231ddc(msgResponse(_0xf3c2('0x13c'),_0xf3c2('0x13e'),JSON[_0xf3c2('0x4c')](_0x2f30ea)));});});};Dialer[_0xf3c2('0x1e')][_0xf3c2('0x14f')]=function(_0x5ab47d){var _0x35a723=this;return function(){switch(_0x5ab47d[_0xf3c2('0x150')]){case _0xf3c2('0x151'):freeVariablesPredictive(_0x5ab47d);_0x35a723[_0xf3c2('0x152')](_0x5ab47d,0x1);break;case _0xf3c2('0x153'):freeVariablesPredictive(_0x5ab47d);_0x35a723[_0xf3c2('0x152')](_0x5ab47d,_0x5ab47d[_0xf3c2('0x154')]);break;case _0xf3c2('0xc'):_0x35a723[_0xf3c2('0xc')](_0x5ab47d);break;case'booked':freeVariablesPredictive(_0x5ab47d);_0x35a723['handlePower'](_0x5ab47d,0x1);break;default:freeVariablesPredictive(_0x5ab47d);logger['error']('Queue',_0x5ab47d[_0xf3c2('0x42')],_0xf3c2('0x155'));}};};Dialer[_0xf3c2('0x1e')][_0xf3c2('0x156')]=function(_0x147bba){var _0x465c18=this;return function(){_0x465c18['handleIvr'](_0x147bba);};};Dialer[_0xf3c2('0x1e')][_0xf3c2('0xe')]=function(_0x1bd9d2){var _0x50bb00=this;if(isNotPreview(_0x1bd9d2['dialMethod'])){if(isVoiceQueueOutbound(_0x1bd9d2['type'])&&isActive(_0x1bd9d2['dialActive'])){_0x1bd9d2[_0xf3c2('0x9f')]=!![];BPromise[_0xf3c2('0xb2')]()[_0xf3c2('0xb3')](checkIsLoggedIn(_0x1bd9d2,_0x1bd9d2[_0xf3c2('0x54')]))[_0xf3c2('0xb3')](checkIsActive(_0x1bd9d2,_0x1bd9d2[_0xf3c2('0x157')]))[_0xf3c2('0xb3')](checkInterval(_0x1bd9d2))[_0xf3c2('0xb3')](_0x50bb00[_0xf3c2('0x138')](_0x1bd9d2))[_0xf3c2('0xb3')](_0x50bb00['checkIfTime'](_0x1bd9d2['dialGlobalInterval'],_0x1bd9d2[_0xf3c2('0x158')],_0x1bd9d2['name'],_0x1bd9d2))['then'](_0x50bb00['checkIfTimeIntervals'](_0x1bd9d2[_0xf3c2('0x46')],_0x1bd9d2[_0xf3c2('0x158')],_0x1bd9d2[_0xf3c2('0x42')],_0x1bd9d2))[_0xf3c2('0xb3')](_0x50bb00[_0xf3c2('0x14f')](_0x1bd9d2))[_0xf3c2('0xae')](loggerCatchQueueSummary(_0xf3c2('0x159'),_0x1bd9d2));}else{notSendMessagesQueue(_0x1bd9d2);}}else{freeVariablesPredictive(_0x1bd9d2);}};Dialer[_0xf3c2('0x1e')][_0xf3c2('0x137')]=function(){var _0x591e=this;var _0xb7d4d7;for(var _0x5b4107 in this[_0xf3c2('0x25')]){if(typeof this['campaigns'][_0x5b4107]!==_0xf3c2('0x96')){_0xb7d4d7=this['campaigns'][_0x5b4107];if(isCampaignIvr(_0xb7d4d7['type'])&&isActive(_0xb7d4d7['active'])){_0xb7d4d7['sendMessageOneNotActive']=!![];BPromise[_0xf3c2('0xb2')]()[_0xf3c2('0xb3')](checkIsActive(_0xb7d4d7,_0xb7d4d7[_0xf3c2('0x76')]))[_0xf3c2('0xb3')](checkInterval(_0xb7d4d7))[_0xf3c2('0xb3')](_0x591e[_0xf3c2('0x138')](_0xb7d4d7))[_0xf3c2('0xb3')](_0x591e[_0xf3c2('0x15a')](_0xb7d4d7['dialGlobalInterval'],_0xb7d4d7['dialTimezone'],_0xb7d4d7[_0xf3c2('0x42')],_0xb7d4d7))[_0xf3c2('0xb3')](_0x591e['checkIfTimeIntervals'](_0xb7d4d7[_0xf3c2('0x46')],_0xb7d4d7['dialTimezone'],_0xb7d4d7[_0xf3c2('0x42')],_0xb7d4d7))['then'](_0x591e[_0xf3c2('0x156')](_0xb7d4d7))[_0xf3c2('0xae')](loggerCatchQueueSummary('[syncCampaigns]',_0xb7d4d7));}else{notSendMessagesCampaign(_0xb7d4d7);}}}};function getCallerIdRandom(_0xa3990,_0x38d42e){var _0xc36f8b;var _0x33bf0d;var _0x22b370;if(_0x38d42e<=0x0){_0x38d42e=0x1;}_0xc36f8b=new RegExp('\x5cw{0,'+_0x38d42e+'}$');_0x33bf0d=Math[_0xf3c2('0x15b')](0xa,_0x38d42e-0x1);_0x22b370=Math[_0xf3c2('0x15b')](0xa,_0x38d42e)-0x1;return util[_0xf3c2('0x78')]('%s',_[_0xf3c2('0x15c')](_0xa3990,_0xc36f8b,_[_0xf3c2('0x15d')](_0x33bf0d,_0x22b370)));}function extractCalleridName(_0x3d566d){var _0x506128=_0x3d566d[_0xf3c2('0x15e')](/"(.*?)"/);return _0x506128?_0x506128[0x1]:_0x3d566d;}function extractCalleridNumber(_0x5f1ad0){var _0x11f811=_0x5f1ad0[_0xf3c2('0x15e')](/<(.*?)>/);return _0x11f811?_0x11f811[0x1]:_0x5f1ad0;}Dialer[_0xf3c2('0x1e')]['actionOriginate']=function(_0x12c937,_0xa6b54d){var _0x215141=this;var _0x4a82fc=uuid['v4']();this[_0xf3c2('0x121')][_0x4a82fc]=new Action(_0x12c937,_0xa6b54d,_0x4a82fc);return new BPromise(function(_0x4a8f24,_0x229492){if(_['isUndefined'](_0x12c937)&&typeof _0x12c937!==_0xf3c2('0x15f')){return _0x229492(msgResponse(_0xf3c2('0x160'),_0xf3c2('0x13e'),_0xf3c2('0x161')));}if(_[_0xf3c2('0x7f')](_0xa6b54d[_0xf3c2('0x162')][_0xf3c2('0x163')])||_0xa6b54d['Contact'][_0xf3c2('0x163')]===null){return _0x229492(msgResponse(_0xf3c2('0x160'),'Failure',_0xf3c2('0x164')));}var _0x436a8a={'XMD-CALLERID':_0x215141['actions'][_0x4a82fc][_0xf3c2('0x165')](),'XMD-AGI':_0x12c937[_0xf3c2('0x104')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x12c937[_0xf3c2('0x104')]):_0xf3c2('0x166'),'XMD-AGIAFTER':_0x12c937[_0xf3c2('0x109')]?util[_0xf3c2('0x78')](_0xf3c2('0x167'),ipAgi,_0x12c937[_0xf3c2('0x109')]):_0xf3c2('0x166'),'XMD-QUEUE':_0x12c937['type']===_0xf3c2('0x50')?util[_0xf3c2('0x78')](_0xf3c2('0x168'),_0x12c937[_0xf3c2('0x42')],_0x12c937[_0xf3c2('0x169')]||'',_0x12c937['dialAgiAfterHangupAgent']?'c':'',_0x12c937[_0xf3c2('0x110')]||0x3):_0xf3c2('0x166'),'XMD-CONTACTID':_0xa6b54d[_0xf3c2('0xca')],'XMD-CDRTYPE':_0xf3c2('0xa'),'CALLERID(all)':_0x215141[_0xf3c2('0x121')][_0x4a82fc][_0xf3c2('0x165')](),'XMD-AMD':_0x12c937[_0xf3c2('0xf5')]?'ACTIVE':_0xf3c2('0x166'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x12c937[_0xf3c2('0xf5')]){_0x436a8a[_0xf3c2('0x16a')]=_0x12c937[_0xf3c2('0x16b')]||0x9c4;_0x436a8a[_0xf3c2('0x16c')]=_0x12c937[_0xf3c2('0x16d')]||0x5dc;_0x436a8a[_0xf3c2('0x16e')]=_0x12c937['dialAMDAfterGreetingSilence']||0x320;_0x436a8a[_0xf3c2('0x16f')]=_0x12c937[_0xf3c2('0x170')]||0x1388;_0x436a8a[_0xf3c2('0x171')]=_0x12c937['dialAMDMinWordLength']||0x64;_0x436a8a['XMD-AMDBETWEENWORDSSILENCE']=_0x12c937['dialAMDBetweenWordsSilence']||0x32;_0x436a8a[_0xf3c2('0x172')]=_0x12c937['dialAMDMaximumNumberOfWords']||0x3;_0x436a8a[_0xf3c2('0x173')]=_0x12c937[_0xf3c2('0x174')]||0x100;_0x436a8a[_0xf3c2('0x175')]=_0x12c937[_0xf3c2('0x176')]||0x1388;}if(_0x12c937[_0xf3c2('0x4f')]===_0xf3c2('0x50')){_0x436a8a[_0xf3c2('0x177')]=_0xa6b54d[_0xf3c2('0xf4')];}else{_0x436a8a[_0xf3c2('0x178')]=_0xa6b54d['CampaignId'];}for(var _0x17394c in _0xa6b54d[_0xf3c2('0x162')]){if(typeof _0xa6b54d['Contact'][_0x17394c]!==_0xf3c2('0x96')){if(isNotNull(_0xa6b54d[_0xf3c2('0x162')][_0x17394c])&&_0x17394c!=='id'&&_0x17394c!==_0xf3c2('0x179')&&_0x17394c!==_0xf3c2('0x17a')&&_0x17394c!==_0xf3c2('0x17b')){_0x436a8a[util[_0xf3c2('0x78')](_0xf3c2('0x17c'),_0xf3c2('0x17d'),_[_0xf3c2('0x17e')](_0x17394c))]=_0xa6b54d['Contact'][_0x17394c];}}}var _0x3608d9=_0x215141['isTrunkReachable'](_0x12c937[_0xf3c2('0x75')])?getCallerId(_0x12c937[_0xf3c2('0x75')][_0xf3c2('0x77')],_0x12c937['dialOriginateCallerIdName'],_0x12c937[_0xf3c2('0x17f')]>0x0?getCallerIdRandom(_0x12c937[_0xf3c2('0x180')],_0x12c937[_0xf3c2('0x17f')]):_0x12c937[_0xf3c2('0x180')]):getCallerId(_['isNil'](_0x12c937[_0xf3c2('0x139')])?_0x12c937[_0xf3c2('0x75')][_0xf3c2('0x77')]:_0x12c937[_0xf3c2('0x139')]['callerid'],_0x12c937[_0xf3c2('0x181')],_0x12c937[_0xf3c2('0x17f')]>0x0?getCallerIdRandom(_0x12c937[_0xf3c2('0x180')],_0x12c937[_0xf3c2('0x17f')]):_0x12c937['dialOriginateCallerIdNumber']);if(_0x3608d9){_0x436a8a[_0xf3c2('0x182')]=_0x215141[_0xf3c2('0x121')][_0x4a82fc][_0xf3c2('0x183')]=extractCalleridName(_0x3608d9);_0x436a8a[_0xf3c2('0x184')]=_0x215141[_0xf3c2('0x121')][_0x4a82fc][_0xf3c2('0x185')]=extractCalleridNumber(_0x3608d9);}return ami[_0xf3c2('0xab')]({'actionid':_0x4a82fc,'action':'originate','channel':_0x215141['isTrunkReachable'](_0x12c937[_0xf3c2('0x75')])?util[_0xf3c2('0x78')](_0xf3c2('0x186'),_0x12c937['Trunk']['name'],isNotNull(_0x12c937[_0xf3c2('0x5d')])?_0x12c937[_0xf3c2('0x5d')][_0xf3c2('0x187')]()||'':'',_0x12c937[_0xf3c2('0x188')]>0x0?_0xa6b54d[_0xf3c2('0x162')][_0xf3c2('0x163')][_0xf3c2('0x189')](_0x12c937[_0xf3c2('0x188')]):_0xa6b54d['Contact'][_0xf3c2('0x163')]):util['format'](_0xf3c2('0x186'),_[_0xf3c2('0xd6')](_0x12c937[_0xf3c2('0x139')])?_0x12c937[_0xf3c2('0x75')]['name']:_0x12c937[_0xf3c2('0x139')][_0xf3c2('0x42')],isNotNull(_0x12c937[_0xf3c2('0x5d')])?_0x12c937[_0xf3c2('0x5d')][_0xf3c2('0x187')]()||'':'',_0x12c937[_0xf3c2('0x188')]>0x0?_0xa6b54d[_0xf3c2('0x162')][_0xf3c2('0x163')][_0xf3c2('0x189')](_0x12c937[_0xf3c2('0x188')]):_0xa6b54d[_0xf3c2('0x162')][_0xf3c2('0x163')]),'callerid':_0x3608d9,'Exten':_0xf3c2('0xda'),'Context':_0xf3c2('0x18a'),'Priority':'1','variable':_0x436a8a,'timeout':(_0x12c937[_0xf3c2('0x5c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4a82fc})[_0xf3c2('0xb3')](function(_0x2bbd22){return _0x4a8f24(_0x2bbd22);})[_0xf3c2('0xae')](function(_0x3be46d){_0x12c937[_0xf3c2('0x66')]+=0x1;var _0x575681=new History(_0x215141['actions'][_0x4a82fc]);logger[_0xf3c2('0x93')](util[_0xf3c2('0x78')](_0xf3c2('0x18b'),JSON[_0xf3c2('0x4c')](_0x3be46d)));_0x575681['state']=0xe;_0x575681[_0xf3c2('0xa4')]=_0xf3c2('0x18c');_0x575681[_0xf3c2('0xa6')]=moment()[_0xf3c2('0x78')](_0xf3c2('0xf2'));_0x575681[_0xf3c2('0xa5')]=_0x575681[_0xf3c2('0xa6')];_0x215141['createHistory'](_0x575681)[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0x18d')));_0x215141['moveContactManagedDialer'](_0x575681)['catch'](loggerCatch(_0xf3c2('0x18d')))[_0xf3c2('0x21')](function(){delete _0x215141[_0xf3c2('0x121')][_0x4a82fc];return _0x229492(msgResponse(_0xf3c2('0x160'),_0xf3c2('0x18e'),'originate\x20action\x20Error'));});});});};Dialer[_0xf3c2('0x1e')]['syncOriginateResponse']=function(_0x5d04fa){var _0x3a88da=this[_0xf3c2('0x121')][_0x5d04fa['actionid']];if(_0x3a88da){delete this[_0xf3c2('0x121')][_0x5d04fa[_0xf3c2('0x122')]];_0x3a88da[_0xf3c2('0x10f')]=moment()[_0xf3c2('0x78')](_0xf3c2('0xf2'));var _0x329450=_0x3a88da[_0xf3c2('0x4f')]===_0xf3c2('0x7a')?this[_0xf3c2('0x25')][_0x3a88da['queue']]:this[_0xf3c2('0x24')][_0x3a88da['getQueue']()];if(!this['isSuccess'](_0x5d04fa[_0xf3c2('0x18f')])){this[_0xf3c2('0xaf')](_0x329450);return this['callProgressDetecting'](_0x3a88da,_0x329450,_0x5d04fa)[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0x190')));}this[_0xf3c2('0xa8')][_0x5d04fa[_0xf3c2('0xd5')]]=_0x3a88da;}};Dialer[_0xf3c2('0x1e')][_0xf3c2('0x191')]=function(_0x2bb9f1,_0x44e437,_0x1b8242){var _0x304f57=new History(_0x44e437);if(_0x304f57[_0xf3c2('0xe6')]+_0x304f57[_0xf3c2('0xe7')]+_0x304f57[_0xf3c2('0xfa')]+_0x304f57[_0xf3c2('0xe8')]+_0x304f57[_0xf3c2('0xfb')]+_0x304f57['countabandonedretry']+_0x304f57[_0xf3c2('0xe3')]+_0x304f57['countagentrejectretry']>=_0x1b8242[_0xf3c2('0xeb')]-0x1){return!![];}switch(_0x2bb9f1){case 0x3:if(_0x304f57[_0xf3c2('0xfa')]>=_0x1b8242[_0xf3c2('0x192')]-0x1){return!![];}this[_0xf3c2('0xbb')]({'active':![],'countnoanswerretry':_0x304f57[_0xf3c2('0xfa')]+=0x1,'scheduledat':moment()[_0xf3c2('0xef')](_0x1b8242[_0xf3c2('0x193')],_0xf3c2('0xf1'))[_0xf3c2('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x304f57[_0xf3c2('0xca')],'ListId':_0x304f57[_0xf3c2('0xf3')],'VoiceQueueId':_0x304f57[_0xf3c2('0xf4')]||undefined,'CampaignId':_0x304f57[_0xf3c2('0xcc')]||undefined})[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0x194')));break;case 0x5:if(_0x304f57[_0xf3c2('0xe6')]>=_0x1b8242['dialBusyMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x304f57[_0xf3c2('0xe6')]+=0x1,'scheduledat':moment()[_0xf3c2('0xef')](_0x1b8242[_0xf3c2('0x195')],_0xf3c2('0xf1'))[_0xf3c2('0x78')](_0xf3c2('0xf2')),'ContactId':_0x304f57[_0xf3c2('0xca')],'ListId':_0x304f57[_0xf3c2('0xf3')],'VoiceQueueId':_0x304f57[_0xf3c2('0xf4')]||undefined,'CampaignId':_0x304f57[_0xf3c2('0xcc')]||undefined})['catch'](loggerCatch(_0xf3c2('0x196')));break;case 0x8:if(_0x304f57[_0xf3c2('0xe7')]>=_0x1b8242[_0xf3c2('0x197')]-0x1){return!![];}this[_0xf3c2('0xbb')]({'active':![],'countcongestionretry':_0x304f57['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x1b8242['dialCongestionRetryFrequency'],_0xf3c2('0xf1'))[_0xf3c2('0x78')](_0xf3c2('0xf2')),'ContactId':_0x304f57[_0xf3c2('0xca')],'ListId':_0x304f57[_0xf3c2('0xf3')],'VoiceQueueId':_0x304f57[_0xf3c2('0xf4')]||undefined,'CampaignId':_0x304f57['CampaignId']||undefined})['catch'](loggerCatch(_0xf3c2('0x198')));break;case 0x0:if(_0x304f57[_0xf3c2('0xe8')]>=_0x1b8242[_0xf3c2('0x199')]-0x1){return!![];}else{this[_0xf3c2('0xbb')]({'active':![],'countnosuchnumberretry':_0x304f57[_0xf3c2('0xe8')]+=0x1,'scheduledat':moment()['add'](_0x1b8242['dialNoSuchNumberRetryFrequency'],_0xf3c2('0xf1'))[_0xf3c2('0x78')](_0xf3c2('0xf2')),'ContactId':_0x304f57[_0xf3c2('0xca')],'ListId':_0x304f57[_0xf3c2('0xf3')],'VoiceQueueId':_0x304f57[_0xf3c2('0xf4')]||undefined,'CampaignId':_0x304f57[_0xf3c2('0xcc')]||undefined})[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0x19a')));}break;case 0xa:if(_0x304f57[_0xf3c2('0xfb')]>=_0x1b8242['dialDropMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x304f57[_0xf3c2('0xfb')]+=0x1,'scheduledat':moment()[_0xf3c2('0xef')](_0x1b8242[_0xf3c2('0x19b')],_0xf3c2('0xf1'))[_0xf3c2('0x78')](_0xf3c2('0xf2')),'ContactId':_0x304f57[_0xf3c2('0xca')],'ListId':_0x304f57[_0xf3c2('0xf3')],'VoiceQueueId':_0x304f57[_0xf3c2('0xf4')]||undefined,'CampaignId':_0x304f57[_0xf3c2('0xcc')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x304f57['countabandonedretry']>=_0x1b8242[_0xf3c2('0x11c')]-0x1){return!![];}this[_0xf3c2('0xbb')]({'active':![],'countabandonedretry':_0x304f57['countabandonedretry']+=0x1,'scheduledat':moment()[_0xf3c2('0xef')](_0x1b8242[_0xf3c2('0x11d')],_0xf3c2('0xf1'))['format'](_0xf3c2('0xf2')),'ContactId':_0x304f57[_0xf3c2('0xca')],'ListId':_0x304f57[_0xf3c2('0xf3')],'VoiceQueueId':_0x304f57[_0xf3c2('0xf4')]||undefined,'CampaignId':_0x304f57['CampaignId']||undefined})['catch'](loggerCatch(_0xf3c2('0x11e')));break;case 0x13:if(_0x304f57[_0xf3c2('0xe3')]>=_0x1b8242['dialMachineMaxRetry']-0x1){return!![];}this[_0xf3c2('0xbb')]({'active':![],'countmachineretry':_0x304f57['countmachineretry']+=0x1,'scheduledat':moment()[_0xf3c2('0xef')](_0x1b8242[_0xf3c2('0xf0')],_0xf3c2('0xf1'))[_0xf3c2('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x304f57[_0xf3c2('0xca')],'ListId':_0x304f57[_0xf3c2('0xf3')],'VoiceQueueId':_0x304f57[_0xf3c2('0xf4')]||undefined,'CampaignId':_0x304f57['CampaignId']||undefined})['catch'](loggerCatch(_0xf3c2('0xfe')));break;case 0x14:if(_0x304f57['countagentrejectretry']>=_0x1b8242[_0xf3c2('0x19c')]-0x1){return!![];}this[_0xf3c2('0xbb')]({'active':![],'countagentrejectretry':_0x304f57['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xf3c2('0xef')](_0x1b8242['dialAgentRejectRetryFrequency'],_0xf3c2('0xf1'))[_0xf3c2('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x304f57[_0xf3c2('0xca')],'ListId':_0x304f57[_0xf3c2('0xf3')],'VoiceQueueId':_0x304f57[_0xf3c2('0xf4')]||undefined,'CampaignId':_0x304f57['CampaignId']||undefined})[_0xf3c2('0xae')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xf3c2('0x1e')][_0xf3c2('0x19d')]=function(_0x3cc329,_0xa87750,_0x580605){var _0xd831d1=this;var _0x4fd80b=new History(_0x3cc329);return new BPromise(function(_0x3d3db2,_0x474e80){if(_[_0xf3c2('0x7f')](_0xa87750)&&typeof _0xa87750!==_0xf3c2('0x15f')){return _0x474e80(msgResponse(_0xf3c2('0x19e'),_0xf3c2('0x13e'),_0xf3c2('0x19f')));}if(_[_0xf3c2('0x7f')](_0x580605)&&typeof _0x580605!==_0xf3c2('0x15f')){return _0x474e80(msgResponse(_0xf3c2('0x19e'),'Failure',_0xf3c2('0x1a0')));}switch(_0x580605[_0xf3c2('0x107')]){case'0':_0xa87750[_0xf3c2('0x65')]+=0x1;_0x4fd80b[_0xf3c2('0xde')]=0x0;_0x4fd80b[_0xf3c2('0xa4')]='NoSuchNumber';_0x4fd80b[_0xf3c2('0xe8')]+=0x1;_0x4fd80b['countglobal']+=0x1;ami[_0xf3c2('0x4e')](_0xf3c2('0x1a1'),ut[_0xf3c2('0x1a2')](_0x3cc329,_0xf3c2('0x1a3')));_0xd831d1['createHistory'](_0x4fd80b)[_0xf3c2('0xae')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0xd831d1[_0xf3c2('0x191')](0x0,_0x3cc329,_0xa87750)){if(_0x4fd80b[_0xf3c2('0xe8')]>=_0xa87750[_0xf3c2('0x199')]){_0xd831d1['createStateFinal'](_0x4fd80b,_0x3d3db2,_0x474e80,'reason\x200\x20no\x20such\x20number....');}else{_0xd831d1[_0xf3c2('0xec')](_0x4fd80b,_0x3d3db2,_0x474e80,_0xf3c2('0x1a4'));}}break;case'3':_0xa87750[_0xf3c2('0x64')]+=0x1;_0x4fd80b[_0xf3c2('0xde')]=0x3;_0x4fd80b[_0xf3c2('0xa4')]='NoAnswer';_0x4fd80b['countnoanswerretry']+=0x1;_0x4fd80b[_0xf3c2('0xe4')]+=0x1;ami[_0xf3c2('0x4e')]('custom:agentnoanswer',ut['buildObj'](_0x3cc329,_0xf3c2('0x1a5')));_0xd831d1[_0xf3c2('0xc5')](_0x4fd80b)['catch'](loggerCatch(_0xf3c2('0x1a6')));if(_0xd831d1[_0xf3c2('0x191')](0x3,_0x3cc329,_0xa87750)){if(_0x4fd80b[_0xf3c2('0xfa')]>=_0xa87750[_0xf3c2('0x192')]){_0xd831d1[_0xf3c2('0xee')](_0x4fd80b,_0x3d3db2,_0x474e80,_0xf3c2('0x1a7'));}else{_0xd831d1[_0xf3c2('0xec')](_0x4fd80b,_0x3d3db2,_0x474e80,_0xf3c2('0x1a7'));}}break;case'5':_0xa87750[_0xf3c2('0x60')]+=0x1;_0x4fd80b[_0xf3c2('0xde')]=0x5;_0x4fd80b['statedesc']=_0xf3c2('0x1a8');_0x4fd80b['countbusyretry']+=0x1;_0x4fd80b[_0xf3c2('0xe4')]+=0x1;ami[_0xf3c2('0x4e')](_0xf3c2('0x1a9'),ut[_0xf3c2('0x1a2')](_0x3cc329,'busy'));_0xd831d1[_0xf3c2('0xc5')](_0x4fd80b)[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0x1aa')));if(_0xd831d1[_0xf3c2('0x191')](0x5,_0x3cc329,_0xa87750)){if(_0x4fd80b['countbusyretry']>=_0xa87750['dialBusyMaxRetry']){_0xd831d1[_0xf3c2('0xee')](_0x4fd80b,_0x3d3db2,_0x474e80,_0xf3c2('0x1ab'));}else{_0xd831d1[_0xf3c2('0xec')](_0x4fd80b,_0x3d3db2,_0x474e80,_0xf3c2('0x1ab'));}}break;case'8':_0xa87750[_0xf3c2('0x61')]+=0x1;_0x4fd80b['state']=0x8;_0x4fd80b[_0xf3c2('0xa4')]=_0xf3c2('0x1ac');_0x4fd80b[_0xf3c2('0xe7')]+=0x1;_0x4fd80b['countglobal']+=0x1;ami[_0xf3c2('0x4e')](_0xf3c2('0x1ad'),ut[_0xf3c2('0x1a2')](_0x3cc329,_0xf3c2('0x1ae')));_0xd831d1[_0xf3c2('0xc5')](_0x4fd80b)[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0x1af')));if(_0xd831d1['checkRetriveMax'](0x8,_0x3cc329,_0xa87750)){if(_0x4fd80b[_0xf3c2('0xe7')]>=_0xa87750[_0xf3c2('0x197')]){_0xd831d1[_0xf3c2('0xee')](_0x4fd80b,_0x3d3db2,_0x474e80,_0xf3c2('0x1b0'));}else{_0xd831d1[_0xf3c2('0xec')](_0x4fd80b,_0x3d3db2,_0x474e80,_0xf3c2('0x1b0'));}}break;case'11':_0xa87750[_0xf3c2('0x1b1')]+=0x1;_0x4fd80b[_0xf3c2('0xde')]=0xb;_0x4fd80b[_0xf3c2('0xa4')]=_0xf3c2('0x11a');_0x4fd80b['countabandonedretry']+=0x1;_0x4fd80b[_0xf3c2('0xe4')]+=0x1;_0xd831d1[_0xf3c2('0xc5')](_0x4fd80b)[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0x11f')));if(_0xd831d1['checkRetriveMax'](0xb,_0x3cc329,_0xa87750)){if(_0x4fd80b[_0xf3c2('0xe9')]>=_0xa87750['dialAbandonedMaxRetry']){_0xd831d1[_0xf3c2('0xee')](_0x4fd80b,_0x3d3db2,_0x474e80,_0xf3c2('0x1b2'));}else{_0xd831d1[_0xf3c2('0xec')](_0x4fd80b,_0x3d3db2,_0x474e80,'reason\x2011\x20abandoned');}}break;case'20':_0xa87750[_0xf3c2('0x68')]+=0x1;_0x4fd80b[_0xf3c2('0xde')]=0x14;_0x4fd80b[_0xf3c2('0xa4')]=_0xf3c2('0x1b3');_0x4fd80b['countagentrejectretry']+=0x1;_0x4fd80b[_0xf3c2('0xe4')]+=0x1;ami[_0xf3c2('0x4e')](_0xf3c2('0x1b4'),ut['buildObj'](_0x3cc329,_0xf3c2('0x1b5')));_0xd831d1['createHistory'](_0x4fd80b)[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0x1b6')));if(_0xd831d1[_0xf3c2('0x191')](0x14,_0x3cc329,_0xa87750)){if(_0x4fd80b[_0xf3c2('0xea')]>=_0xa87750[_0xf3c2('0x19c')]){_0xd831d1['createStateFinal'](_0x4fd80b,_0x3d3db2,_0x474e80,'reason\x2020\x20agentreject');}else{_0xd831d1[_0xf3c2('0xec')](_0x4fd80b,_0x3d3db2,_0x474e80,_0xf3c2('0x1b7'));}}break;default:_0xa87750['outboundUnknownCallsDay']+=0x1;_0x4fd80b['state']=0xc;_0x4fd80b[_0xf3c2('0xa4')]=_0x580605[_0xf3c2('0x107')];_0xd831d1[_0xf3c2('0xc5')](_0x4fd80b)[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0x1b8')));if(_0xd831d1['checkRetriveMax'](_0x580605[_0xf3c2('0x107')],_0x3cc329,_0xa87750)){if(_0x4fd80b[_0xf3c2('0xe6')]+_0x4fd80b['countcongestionretry']+_0x4fd80b['countnoanswerretry']+_0x4fd80b[_0xf3c2('0xe8')]+_0x4fd80b[_0xf3c2('0xfb')]+_0x4fd80b[_0xf3c2('0xe9')]+_0x4fd80b['countmachineretry']+_0x4fd80b[_0xf3c2('0xea')]>=_0xa87750[_0xf3c2('0xeb')]){_0xd831d1['stateGlobal'](_0x4fd80b,_0x3d3db2,_0x474e80,_0x580605[_0xf3c2('0x107')]);}else{_0xd831d1[_0xf3c2('0xee')](_0x4fd80b,_0x3d3db2,_0x474e80,_0x580605[_0xf3c2('0x107')]);}}}});};Dialer['prototype'][_0xf3c2('0xec')]=function(_0x3ac1a2,_0x20116f,_0x1603bd,_0x25dd77){var _0x176074=new Final(_0x3ac1a2);_0x176074[_0xf3c2('0xde')]=0xf;_0x176074[_0xf3c2('0xa4')]=_0xf3c2('0x1b9');this[_0xf3c2('0xee')](_0x176074,_0x20116f,_0x1603bd,_0x25dd77);};Dialer['prototype'][_0xf3c2('0xee')]=function(_0x55bf8e,_0x5664f0,_0x52f391,_0x177680){this['moveContactManagedDialer'](_0x55bf8e)[_0xf3c2('0xb3')](function(){return _0x5664f0(msgResponse(_0xf3c2('0x19e'),_0xf3c2('0xd0'),_0x177680));})[_0xf3c2('0xae')](function(){return _0x52f391(msgResponse('[moveContactManagedDialer][0]','Failure','contact\x20not\x20moved'));});};Dialer[_0xf3c2('0x1e')][_0xf3c2('0xc')]=function(_0x4385f5){var _0x2b2caf=_0x4385f5[_0xf3c2('0x1ba')]/0x64;var _0x4646e7=_0x4385f5['outboundDropCallsDayTimeout']/(_0x4385f5[_0xf3c2('0x63')]+_0x4385f5[_0xf3c2('0xdd')]);var _0x59950f=Math[_0xf3c2('0x1bb')](_0x4385f5[_0xf3c2('0x71')]*(_0x4385f5[_0xf3c2('0x1bc')]/0x64));var _0x3a92c4=Math['round'](_0x4385f5['predictiveIntervalAvailable']*(_0x4385f5[_0xf3c2('0x1bd')]/0x64));var _0x4e5fd5=_0x4385f5['available']+_0x4385f5[_0xf3c2('0x57')];var _0x2c59f9=Math[_0xf3c2('0x1be')](_0x4385f5['erlangCalls']*_0x4385f5['erlangAbandonmentRate']*_0x4385f5['predictiveIntervalHitRate']*_0x4385f5[_0xf3c2('0x6f')]);if(_['isUndefined'](_0x4385f5[_0xf3c2('0x2b')])){if(!_[_0xf3c2('0x7f')](_0x4385f5[_0xf3c2('0x2a')])){_0x4385f5[_0xf3c2('0x2a')]=undefined;loggerPredictive['error'](_0xf3c2('0x1bf'),_0xf3c2('0x1c0'));}if(!_[_0xf3c2('0x7f')](_0x4385f5['handlePredictive'])){loggerPredictive[_0xf3c2('0x93')](_0xf3c2('0x1bf'),_0xf3c2('0x1c1'));clearInterval(_0x4385f5[_0xf3c2('0x8e')]);_0x4385f5[_0xf3c2('0x8e')]=undefined;}_0x4385f5[_0xf3c2('0x2b')]=moment()[_0xf3c2('0x78')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x4385f5[_0xf3c2('0x42')],_0xf3c2('0x1c2'),_0x4385f5[_0xf3c2('0x2b')]);this[_0xf3c2('0x152')](_0x4385f5,0x1);}else if(ifInterval(_0x4385f5[_0xf3c2('0x1c3')],_0x4385f5['startProgressive'])){this[_0xf3c2('0x152')](_0x4385f5,0x1);loggerPredictiveCalls[_0xf3c2('0x7b')](_0xf3c2('0x1c4'),_0x4385f5[_0xf3c2('0x2b')],_0x4385f5[_0xf3c2('0x42')]);_0x4385f5[_0xf3c2('0x1c5')]=0x0;_0x4385f5[_0xf3c2('0x1c6')]=0x0;}else if(_0x2b2caf<_0x4646e7&&_0x4385f5[_0xf3c2('0x1c7')]===_0xf3c2('0x1c8')){freeVariablesPredictive(_0x4385f5);loggerPredictive[_0xf3c2('0x7b')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x4646e7,_0xf3c2('0x2b'),_0x4385f5['name']);}else if(_0x2c59f9<_0x4385f5[_0xf3c2('0x1c6')]&&_0x4385f5[_0xf3c2('0x1c7')]==='dropRate'){freeVariablesPredictive(_0x4385f5);loggerPredictive[_0xf3c2('0x7b')](_0xf3c2('0x1c9'),'Max\x20Drop\x20',_0x2c59f9,'Drop\x20in\x20this\x20interval',_0x4385f5['predictiveIntervalErlangCallsDroppedCalls'],_0xf3c2('0x2b'),_0x4385f5['name']);}else if(!ifInterval(_0x4385f5[_0xf3c2('0x1c3')],_0x4385f5[_0xf3c2('0x2b')])&&_[_0xf3c2('0x7f')](_0x4385f5[_0xf3c2('0x2a')])&&!_['isUndefined'](_0x4385f5[_0xf3c2('0x2b')])){_0x4385f5[_0xf3c2('0x2a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xf3c2('0x7b')](_0x4385f5[_0xf3c2('0x42')],_0xf3c2('0x1ca'),_0x4385f5['startPredictive']);this['averageHandleTime'](_0x4385f5[_0xf3c2('0x1c3')])['then'](this['getDataPredictive'](_0x4385f5))['then'](mergeDataErlangB(_0x4385f5))[_0xf3c2('0xb3')](this[_0xf3c2('0x1cb')](_0x4385f5))[_0xf3c2('0xae')](loggerCatchPredictive(_0xf3c2('0x1cc'),_0x4385f5));}else if(!ifInterval(_0x4385f5['dialPredictiveInterval'],_0x4385f5['startPredictive'])){_0x4385f5[_0xf3c2('0x1c6')]=0x0;_0x4385f5[_0xf3c2('0x2a')]=moment()[_0xf3c2('0x78')](_0xf3c2('0xf2'));loggerPredictive[_0xf3c2('0x7b')](_0x4385f5[_0xf3c2('0x42')],_0xf3c2('0x1cd'),_0x4385f5[_0xf3c2('0x2a')]);clearInterval(_0x4385f5[_0xf3c2('0x8e')]);_0x4385f5['handlePredictive']=undefined;this['averageHandleTime'](_0x4385f5[_0xf3c2('0x1c3')])[_0xf3c2('0xb3')](this[_0xf3c2('0x1ce')](_0x4385f5))[_0xf3c2('0xb3')](mergeDataErlangB(_0x4385f5))[_0xf3c2('0xb3')](this[_0xf3c2('0x1cb')](_0x4385f5))[_0xf3c2('0xae')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x4385f5));}else if(_0x4385f5[_0xf3c2('0x71')]&&_0x4e5fd5<_0x4385f5[_0xf3c2('0x71')]-_0x3a92c4){freeVariablesPredictive(_0x4385f5);loggerPredictive[_0xf3c2('0x7b')](_0x4385f5[_0xf3c2('0x42')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x4e5fd5,_0xf3c2('0x1cf'),_0x4385f5[_0xf3c2('0x71')],'-',_0x3a92c4,'=',_0x4385f5[_0xf3c2('0x71')]-_0x3a92c4,')');}else if(_0x4385f5[_0xf3c2('0x71')]&&_0x4e5fd5>_0x4385f5[_0xf3c2('0x71')]+_0x59950f){freeVariablesPredictive(_0x4385f5);loggerPredictive['info'](_0x4385f5[_0xf3c2('0x42')],_0xf3c2('0x1d0'),_0x4e5fd5,')\x20are\x20more\x20than\x20threshold\x20(',_0x4385f5[_0xf3c2('0x71')],'+',_0x59950f,'=',_0x4385f5['predictiveIntervalAvailable']+_0x59950f,')');}};Dialer[_0xf3c2('0x1e')][_0xf3c2('0x1ce')]=function(_0x5a84d5){var _0x52f17d=this;return function(_0x20fddb){return new BPromise(function(_0x15831c,_0x29ab56){_['merge'](_0x5a84d5,_0x20fddb[0x0]);if(checkGetDataPredictive(_0x20fddb[0x0])){var _0x2a678b=_0x5a84d5[_0xf3c2('0x71')]=_0x5a84d5[_0xf3c2('0x57')]+_0x5a84d5['available'];var _0x229f41=_0x5a84d5['dialPredictiveInterval']*0x3c;var _0x344248=_0x20fddb[0x0][_0xf3c2('0x6c')]+_0x20fddb[0x0]['predictiveIntervalAvgHoldtime'];var _0x42d2f0=(_0x20fddb[0x0]['predictiveIntervalAnsweredCalls']+_0x20fddb[0x0][_0xf3c2('0x6e')]+_0x20fddb[0x0][_0xf3c2('0x6d')])/_0x20fddb[0x0][_0xf3c2('0x72')];_0x5a84d5[_0xf3c2('0x1d1')]=_0x42d2f0>0x0?_0x42d2f0:0x1;switch(_0x5a84d5['dialPredictiveOptimization']){case _0xf3c2('0x1c8'):var _0x243401=_0x5a84d5[_0xf3c2('0x1ba')]/0x64;return _0x52f17d[_0xf3c2('0x1d2')](_0x2a678b,_0x229f41,_0x344248,_0x42d2f0,_0x243401)[_0xf3c2('0xb3')](function(_0x3b1c0b){return _0x15831c(_0x3b1c0b);});case _0xf3c2('0x1d3'):var _0x460d72=_0x5a84d5[_0xf3c2('0x1ba')]/0x64;return _0x52f17d[_0xf3c2('0x1d4')](_0x2a678b,_0x229f41,_0x344248,_0x42d2f0,_0x460d72)['then'](function(_0x523353){return _0x15831c(_0x523353);});default:return _0x29ab56(msgResponse('[getDataPredictive]',_0xf3c2('0x13e'),_0xf3c2('0x1d5')));}}else{return _0x29ab56(msgResponse(_0xf3c2('0x1d6'),'Failure',_0xf3c2('0x1d7')));}});};};Dialer[_0xf3c2('0x1e')]['getDataPredictiveOld']=function(_0x4f7a1e){var _0x35e8e7=this;return function(_0x1b8027){return new BPromise(function(_0x4516ce,_0x37c591){_['merge'](_0x4f7a1e,_0x1b8027[0x0]);if(checkGetDataPredictive(_0x1b8027[0x0])){loggerPredictive[_0xf3c2('0x7b')](JSON[_0xf3c2('0x4c')](_0x1b8027[0x0]));if(_0x4f7a1e[_0xf3c2('0x1c7')]===_0xf3c2('0x1c8')){return _0x35e8e7[_0xf3c2('0xc1')](_0x4f7a1e['id'])['then'](function(_0x2cc869){var _0x3e3ced=_0x4f7a1e['loggedIn']-_0x2cc869[0x0]['outboundQueuePauses'];var _0x1b6605=_0x4f7a1e['dialPredictiveInterval']*0x3c;var _0x526a09=_0x1b8027[0x0][_0xf3c2('0x6c')]+_0x1b8027[0x0][_0xf3c2('0x6b')];var _0x2b1f65=(_0x1b8027[0x0]['predictiveIntervalAnsweredCalls']+_0x1b8027[0x0][_0xf3c2('0x6e')]+_0x1b8027[0x0][_0xf3c2('0x6d')])/_0x1b8027[0x0][_0xf3c2('0x72')];var _0xfc9b3a=_0x4f7a1e[_0xf3c2('0x1ba')]/0x64;_0x4f7a1e[_0xf3c2('0x70')]=_0x2cc869[0x0][_0xf3c2('0x1d8')]||0x0;_0x4f7a1e['predictiveIntervalHitRate']=_0x2b1f65>0x0?_0x2b1f65:0x1;return _0x35e8e7[_0xf3c2('0x1d2')](_0x3e3ced,_0x1b6605,_0x526a09,_0x2b1f65,_0xfc9b3a);})[_0xf3c2('0xb3')](function(_0x1affba){return _0x4516ce(_0x1affba);})[_0xf3c2('0xae')](function(_0x119687){return _0x37c591(msgResponse(_0xf3c2('0x1d9'),'Failure',JSON[_0xf3c2('0x4c')](_0x119687)));});}if(_0x4f7a1e[_0xf3c2('0x1c7')]===_0xf3c2('0x1d3')){return _0x35e8e7[_0xf3c2('0xc1')](_0x4f7a1e['id'])[_0xf3c2('0xb3')](function(_0x1094b1){var _0x2dfff2=_0x4f7a1e['loggedIn']-_0x1094b1[0x0]['outboundQueuePauses'];var _0x4040e9=_0x4f7a1e['dialPredictiveInterval']*0x3c;var _0x3dfe50=_0x1b8027[0x0][_0xf3c2('0x6c')]+_0x1b8027[0x0][_0xf3c2('0x6b')];var _0x15aa40=(_0x1b8027[0x0][_0xf3c2('0x6a')]+_0x1b8027[0x0][_0xf3c2('0x6e')]+_0x1b8027[0x0][_0xf3c2('0x6d')])/_0x1b8027[0x0][_0xf3c2('0x72')];var _0x1113e9=_0x4f7a1e['dialPredictiveOptimizationPercentage']/0x64;_0x4f7a1e[_0xf3c2('0x70')]=_0x1094b1[0x0]['outboundQueuePauses']||0x0;_0x4f7a1e[_0xf3c2('0x1d1')]=_0x15aa40>0x0?_0x15aa40:0x1;return _0x35e8e7['busyFactor'](_0x2dfff2,_0x4040e9,_0x3dfe50,_0x15aa40,_0x1113e9);})[_0xf3c2('0xb3')](function(_0x256071){return _0x4516ce(_0x256071);})[_0xf3c2('0xae')](function(_0x4091fa){return _0x37c591(msgResponse(_0xf3c2('0x1d9'),'Failure',JSON[_0xf3c2('0x4c')](_0x4091fa)));});}}else{return _0x37c591(msgResponse(_0xf3c2('0x1d6'),_0xf3c2('0x13e'),_0xf3c2('0x1d7')));}});};};Dialer['prototype'][_0xf3c2('0x1cb')]=function(_0x3d69b3){var _0x58bf4d=this;return function(){var _0x5a0433=0x0;var _0x1d8398=Math['floor'](_0x3d69b3['erlangCallToSecond']*0x3e8);if(_0x1d8398>0x0){_0x1d8398=_0x1d8398<0x64?0x64:_0x1d8398;loggerPredictive['info'](_0x3d69b3[_0xf3c2('0x42')],_0xf3c2('0x1da'),_0x1d8398,_0xf3c2('0x4d'));_0x3d69b3[_0xf3c2('0x8e')]=setInterval(function(){_0x58bf4d[_0xf3c2('0x8e')](_0x3d69b3);loggerPredictiveCalls[_0xf3c2('0x7b')](_0xf3c2('0x1db'),_0x5a0433+=0x1);},_0x1d8398);}else{loggerPredictive[_0xf3c2('0x7b')](_0x3d69b3[_0xf3c2('0x42')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xf3c2('0x1e')][_0xf3c2('0x1dc')]=function(_0x417eed,_0x5e6a28){var _0x52783c=this;return function(_0x12f4d9){if(_['isEmpty'](_0x12f4d9)){if(_[_0xf3c2('0xd6')](_0x5e6a28[_0xf3c2('0xcb')])||!_0x5e6a28[_0xf3c2('0x1dd')]){if(_0x417eed[_0xf3c2('0x150')]===_0xf3c2('0xb')){_0x417eed['queueStatusComplete']=_['isUndefined'](_0x417eed['queueStatusComplete'])?!![]:_0x417eed[_0xf3c2('0x129')];var _0x71d125=uuid['v4']();_0x52783c[_0xf3c2('0x121')][_0x71d125]=new Action(_0x417eed,_0x5e6a28,_0x71d125);loggerBooked['info'](_0xf3c2('0x1de'),_0x71d125,_0xf3c2('0x1df'),JSON['stringify'](_0x417eed[_0xf3c2('0x129')]),_0xf3c2('0x1e0'),_0x417eed[_0xf3c2('0x42')]);if(_0x417eed['queueStatusComplete']){_0x417eed[_0xf3c2('0x129')]=![];_0x52783c['queueBooked'][_0x52783c[_0xf3c2('0x121')][_0x71d125][_0xf3c2('0xb0')]]=[];ami[_0xf3c2('0xab')]({'actionid':_0x71d125,'action':'queuestatus','queue':_0x417eed['name']})[_0xf3c2('0xae')](function(){_0x52783c[_0xf3c2('0xaf')](_0x417eed);_0x52783c[_0xf3c2('0xbb')]({'active':![],'ContactId':_0x52783c[_0xf3c2('0x121')][_0x71d125]['ContactId'],'ListId':_0x52783c['actions'][_0x71d125][_0xf3c2('0xf3')],'VoiceQueueId':_0x52783c[_0xf3c2('0x121')][_0x71d125][_0xf3c2('0xf4')]||undefined,'CampaignId':_0x52783c[_0xf3c2('0x121')][_0x71d125][_0xf3c2('0xcc')]||undefined})[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0x1e1')));delete _0x52783c[_0xf3c2('0x121')][_0x71d125];});}else{loggerBooked[_0xf3c2('0x7b')](_0xf3c2('0x1e2'),JSON['stringify'](_0x417eed['queueStatusComplete']),'Queue:\x20',_0x417eed[_0xf3c2('0x42')]);_0x52783c[_0xf3c2('0xaf')](_0x417eed);_0x52783c[_0xf3c2('0xbb')]({'active':![],'ContactId':_0x52783c[_0xf3c2('0x121')][_0x71d125][_0xf3c2('0xca')],'ListId':_0x52783c[_0xf3c2('0x121')][_0x71d125]['ListId'],'VoiceQueueId':_0x52783c[_0xf3c2('0x121')][_0x71d125][_0xf3c2('0xf4')]||undefined,'CampaignId':_0x52783c[_0xf3c2('0x121')][_0x71d125]['CampaignId']||undefined})[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0x1e1')));delete _0x52783c[_0xf3c2('0x121')][_0x71d125];}}else{return _0x52783c[_0xf3c2('0x1e3')](_0x417eed,_0x5e6a28);}}else{if(getDiff(_0x5e6a28[_0xf3c2('0x1e4')])<_0x417eed[_0xf3c2('0x1e5')]*0x3c){if(_0x5e6a28['Agent']&&!_0x5e6a28[_0xf3c2('0x1e6')][_0xf3c2('0x1e7')]){_0x52783c[_0xf3c2('0x23')][_0xf3c2('0x134')](_0x5e6a28['id'])[_0xf3c2('0x21')](function(){_0x52783c['updateOriginated'](_0x417eed);});}else{_0x52783c[_0xf3c2('0x1e8')]({'active':![]},_0x5e6a28['id'],0x1)['finally'](function(){_0x52783c[_0xf3c2('0xaf')](_0x417eed);});}}else{_0x417eed['outboundReCallsDay']+=0x1;_0x52783c[_0xf3c2('0xaf')](_0x417eed);if(_0x417eed[_0xf3c2('0x1e9')]){_0x52783c[_0xf3c2('0xbb')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5e6a28[_0xf3c2('0xca')],'ListId':_0x5e6a28[_0xf3c2('0xf3')],'VoiceQueueId':_0x5e6a28[_0xf3c2('0xf4')]||undefined,'CampaignId':_0x5e6a28['CampaignId']||undefined})[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0x1ea')));_0x52783c[_0xf3c2('0xc5')](createObjHistory(_0x417eed,_0x5e6a28,'RECALLINQUEUE',0x17,_0xf3c2('0x1eb')))[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0x1ec')));}else{_0x52783c[_0xf3c2('0xc8')](createObjHistory(_0x417eed,_0x5e6a28,_0xf3c2('0x1ed'),0x16,'RecallFailedTimeout'),_0xf3c2('0x1ee'),'[Originate][HistoryRecallClose]');}}}}else{_0x417eed[_0xf3c2('0x5f')]+=0x1;_0x52783c[_0xf3c2('0xc8')](createObjHistory(_0x417eed,_0x5e6a28,_0xf3c2('0x1ef'),0xd,_0xf3c2('0x1f0')),_0xf3c2('0x1f1'),_0xf3c2('0x1f2'));throw _0xf3c2('0x1f3');}};};Dialer[_0xf3c2('0x1e')][_0xf3c2('0x1f4')]=function(_0x1c3005){var _0x27ece3=this;var _0x2ade23=_0x1c3005[_0xf3c2('0x1f5')]-_0x1c3005[_0xf3c2('0x73')]-_0x1c3005[_0xf3c2('0x1f6')];emitCampaignSummary(_0x1c3005);if(_0x2ade23>0x0){if(_0x2ade23>this[_0xf3c2('0x28')]){_0x2ade23=this[_0xf3c2('0x28')];}_0x1c3005[_0xf3c2('0x1f6')]+=_0x2ade23;this['getContactDialerIvr'](_0x1c3005['id'],_0x2ade23,_0x1c3005[_0xf3c2('0x1f7')])[_0xf3c2('0xb3')](function(_0x45345f){_0x1c3005['temp']-=_0x2ade23;_0x1c3005[_0xf3c2('0x1f6')]=_0x1c3005[_0xf3c2('0x1f6')]>0x0?_0x1c3005[_0xf3c2('0x1f6')]:0x0;if(!checkContactEmpty(_0x45345f)){_0x1c3005[_0xf3c2('0x41')]=_0xf3c2('0x9d');logger[_0xf3c2('0x7b')](_0xf3c2('0x1f8')+_0x1c3005[_0xf3c2('0x42')]);}else{_0x1c3005['originated']+=_0x45345f[_0xf3c2('0x12f')];_0x1c3005[_0xf3c2('0x41')]=_0xf3c2('0x1f9');for(var _0x47f756=0x0;_0x47f756<_0x45345f[_0xf3c2('0x12f')];_0x47f756+=0x1){_0x1c3005[_0xf3c2('0x1fa')]+=0x1;if(_[_0xf3c2('0xd6')](_0x45345f[_0x47f756])||_[_0xf3c2('0xd6')](_0x45345f[_0x47f756][_0xf3c2('0x162')])||_[_0xf3c2('0xd6')](_0x45345f[_0x47f756][_0xf3c2('0x162')][_0xf3c2('0x163')])){_0x27ece3[_0xf3c2('0x1fb')](_0xf3c2('0x1fc'),_0x1c3005,_0x45345f[_0x47f756]);}else{_0x27ece3['checkIsBlackListIvr'](_[_0xf3c2('0xc9')](_0x45345f[_0x47f756],['CampaignId',_0xf3c2('0x1fd')]))['then'](_0x27ece3['checkContactBlack'](_0x1c3005,_0x45345f[_0x47f756]))[_0xf3c2('0xae')](_0x27ece3['loggerHandler']('[actionOriginateIvr]\x20',_0x1c3005));}}}})[_0xf3c2('0xae')](loggerGetContactDialer(_0xf3c2('0x1fe'),_0x1c3005,_0x2ade23));}};Dialer['prototype'][_0xf3c2('0x152')]=function(_0x1c21c4,_0x1fa1f5){var _0x244e45=this;var _0x76f87a=[];var _0x1cd001=_0x1fa1f5>=0x1?_0x1fa1f5:0x1;if(_0x1c21c4[_0xf3c2('0x150')]===_0xf3c2('0xb')){_0x1cd001=0x1;}var _0x43827a=Math[_0xf3c2('0x1be')](_0x1c21c4[_0xf3c2('0x53')]*_0x1cd001)-_0x1c21c4['originated']-_0x1c21c4[_0xf3c2('0x1f6')];emitVoiceQueueSummary(_0x1c21c4);if(_0x1c21c4[_0xf3c2('0x1ff')]>0x0){var _0x56ba94=_0x1c21c4[_0xf3c2('0x1ff')]-_0x1c21c4[_0xf3c2('0x73')]-_0x1c21c4[_0xf3c2('0x57')]-_0x1c21c4[_0xf3c2('0x1f6')]-_0x1c21c4[_0xf3c2('0x55')];if(_0x43827a>_0x56ba94){_0x43827a=_0x56ba94;}}if(_0x43827a>0x0){if(_0x1c21c4[_0xf3c2('0x150')]==='booked'){_0x43827a=0x1;}if(_0x43827a>this[_0xf3c2('0x28')]){_0x43827a=this[_0xf3c2('0x28')];}_0x1c21c4['temp']+=_0x43827a;for(var _0x596b26 in this['agents']){if(typeof this[_0xf3c2('0x26')][_0x596b26]!=='undefined'){if(this[_0xf3c2('0x26')][_0x596b26][_0xf3c2('0xde')]===_0xf3c2('0x200')&&this[_0xf3c2('0x26')][_0x596b26]['status']==='reachable'){_0x76f87a['push'](this[_0xf3c2('0x26')][_0x596b26]['id']);}}}this[_0xf3c2('0xbe')](_0x1c21c4['id'],_0x76f87a,_0x43827a,_0x1c21c4[_0xf3c2('0x1f7')])[_0xf3c2('0xb3')](function(_0x139193){_0x1c21c4[_0xf3c2('0x1f6')]-=_0x43827a;_0x1c21c4['temp']=_0x1c21c4[_0xf3c2('0x1f6')]>0x0?_0x1c21c4[_0xf3c2('0x1f6')]:0x0;if(!checkContactEmpty(_0x139193)){_0x244e45[_0xf3c2('0xb4')](_0x1c21c4)['then'](sendMessageReschedule(_0x1c21c4))[_0xf3c2('0xae')](loggerCatch(_0xf3c2('0x201')));}else{_0x1c21c4[_0xf3c2('0x73')]+=_0x139193[_0xf3c2('0x12f')];_0x1c21c4['message']=_0x1c21c4[_0xf3c2('0x150')]===_0xf3c2('0xb')?_0xf3c2('0x202'):_0xf3c2('0x1f9');for(var _0x2b62a2=0x0;_0x2b62a2<_0x139193[_0xf3c2('0x12f')];_0x2b62a2+=0x1){if(_['isNil'](_0x139193[_0x2b62a2])||_[_0xf3c2('0xd6')](_0x139193[_0x2b62a2][_0xf3c2('0x162')])||_[_0xf3c2('0xd6')](_0x139193[_0x2b62a2]['Contact']['phone'])){_0x244e45[_0xf3c2('0x1fb')]('[actionOriginate]\x20',_0x1c21c4,_0x139193[_0x2b62a2]);}else{_0x244e45['checkIsBlackList'](_['pick'](_0x139193[_0x2b62a2],[_0xf3c2('0xf4'),_0xf3c2('0x1fd')]))[_0xf3c2('0xb3')](_0x244e45[_0xf3c2('0x1dc')](_0x1c21c4,_0x139193[_0x2b62a2]))['catch'](_0x244e45[_0xf3c2('0xc7')]('[actionOriginate]\x20',_0x1c21c4));}}}})[_0xf3c2('0xae')](loggerGetContactDialer(_0xf3c2('0x203'),_0x1c21c4,_0x43827a));}};Dialer[_0xf3c2('0x1e')][_0xf3c2('0x8e')]=function(_0x5ad602){if(_0x5ad602[_0xf3c2('0x1ff')]>0x0){var _0xc2582c=_0x5ad602['dialLimitQueue']-_0x5ad602[_0xf3c2('0x73')]-_0x5ad602[_0xf3c2('0x57')];if(_0xc2582c>0x0){this[_0xf3c2('0x204')](_0x5ad602);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0xf3c2('0x204')](_0x5ad602);}};Dialer['prototype'][_0xf3c2('0x204')]=function(_0x5a11ee){var _0x5ca75b=this;var _0x22f221=[];_0x5a11ee[_0xf3c2('0x73')]+=0x1;for(var _0x355b35 in this['agents']){if(typeof this['agents'][_0x355b35]!=='undefined'){if(this['agents'][_0x355b35][_0xf3c2('0xde')]===_0xf3c2('0x200')&&this[_0xf3c2('0x26')][_0x355b35]['status']==='reachable'){_0x22f221[_0xf3c2('0x126')](this[_0xf3c2('0x26')][_0x355b35]['id']);}}}this[_0xf3c2('0xbe')](_0x5a11ee['id'],_0x22f221,0x1,_0x5a11ee['dialOrderByScheduledAt'])[_0xf3c2('0xb3')](function(_0x1e30f3){if(!checkContactEmpty(_0x1e30f3)){checkContactLowerLimitOriginate(_0x5a11ee,0x1,0x0);_0x5ca75b[_0xf3c2('0xb4')](_0x5a11ee)[_0xf3c2('0xb3')](sendMessageReschedule(_0x5a11ee))[_0xf3c2('0xae')](loggerCatch('[countReScheduled]\x20'));}else{_0x5a11ee[_0xf3c2('0x41')]='RUNNING';if(_[_0xf3c2('0xd6')](_0x1e30f3[0x0])||_[_0xf3c2('0xd6')](_0x1e30f3[0x0][_0xf3c2('0x162')])||_[_0xf3c2('0xd6')](_0x1e30f3[0x0]['Contact'][_0xf3c2('0x163')])){_0x5ca75b[_0xf3c2('0x1fb')](_0xf3c2('0x1fc'),_0x5a11ee,_0x1e30f3[0x0]);}else{_0x5ca75b[_0xf3c2('0xb5')](_[_0xf3c2('0xc9')](_0x1e30f3[0x0],['VoiceQueueId',_0xf3c2('0x1fd')]))[_0xf3c2('0xb3')](_0x5ca75b[_0xf3c2('0x1dc')](_0x5a11ee,_0x1e30f3[0x0]))['catch'](_0x5ca75b['loggerHandler'](_0xf3c2('0x205'),_0x5a11ee));}}})[_0xf3c2('0xae')](loggerGetContactDialer('[getContactDialerPredictive]',_0x5a11ee,0x1));emitVoiceQueueSummary(_0x5a11ee);};Dialer['prototype']['abandonmentRate']=function(_0x27abdc,_0x496e26,_0x17c917,_0x458a9e,_0x560f05,_0x320efe){loggerPredictive[_0xf3c2('0x7b')](_0xf3c2('0x206'));loggerPredictive[_0xf3c2('0x7b')](_0xf3c2('0x207'),_0x27abdc);loggerPredictive[_0xf3c2('0x7b')](_0xf3c2('0x208'),_0x496e26);loggerPredictive[_0xf3c2('0x7b')](_0xf3c2('0x209'),_0x17c917);loggerPredictive[_0xf3c2('0x7b')](_0xf3c2('0x20a'),_0x458a9e);loggerPredictive['info'](_0xf3c2('0x20b'),_0x560f05);loggerPredictive[_0xf3c2('0x7b')](_0xf3c2('0x8a'));return new BPromise(function(_0x4ada22,_0x4a0b2a){if(_0x27abdc<=0x0||isNaN(_0x27abdc)){return _0x4a0b2a(msgResponse(_0xf3c2('0x20c'),_0xf3c2('0x18e'),_0xf3c2('0x20d')+_0x27abdc));}if(_0x17c917<=0x0||isNaN(_0x17c917)){return _0x4a0b2a(msgResponse(_0xf3c2('0x20c'),_0xf3c2('0x18e'),_0xf3c2('0x20e')+_0x17c917));}if(_0x458a9e<=0x0||isNaN(_0x458a9e)){return _0x4a0b2a(msgResponse(_0xf3c2('0x20c'),'Error','p\x20=\x20'+_0x458a9e));}if(_0x496e26<=0x0||isNaN(_0x496e26)){return _0x4a0b2a(msgResponse(_0xf3c2('0x20c'),_0xf3c2('0x18e'),_0xf3c2('0x20f')+_0x496e26));}if(_0x560f05<=0x0||isNaN(_0x560f05)){return _0x4a0b2a(msgResponse(_0xf3c2('0x20c'),_0xf3c2('0x18e'),_0xf3c2('0x210')+_0x560f05));}_0x320efe=_0x320efe||0x0;var _0x5abf47=0x1/_0x17c917;var _0x5004f7=0x0;var _0x3ecae8=0x0;var _0x2946c6=0x0;var _0xf75797=0x0;for(var _0x416cfb=0x0;_0x2946c6<_0x560f05;_0x416cfb+=0x1){_0x3ecae8=_0x416cfb/_0x496e26;_0x5004f7=(_0x458a9e*_0x3ecae8+_0x320efe)/_0x5abf47;_0x2946c6=erlangb(_0x5004f7,_0x27abdc);_0xf75797=_0x5004f7/_0x27abdc*(0x1-erlangb(_0x5004f7,_0x27abdc));}return _0x4ada22({'erlangCalls':_0x416cfb,'erlangCallToSecond':_0x496e26/_0x416cfb,'erlangAbandonmentRate':_0x2946c6,'erlangBusyFactor':_0xf75797});});};Dialer[_0xf3c2('0x1e')]['busyFactor']=function(_0x41037a,_0x58ed9a,_0x35ed8b,_0x1b2751,_0x504ffc,_0x224f87){loggerPredictive[_0xf3c2('0x7b')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xf3c2('0x7b')]('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',_0x41037a);loggerPredictive[_0xf3c2('0x7b')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x58ed9a);loggerPredictive['info'](_0xf3c2('0x209'),_0x35ed8b);loggerPredictive['info'](_0xf3c2('0x20a'),_0x1b2751);loggerPredictive[_0xf3c2('0x7b')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x504ffc);loggerPredictive[_0xf3c2('0x7b')]('---------------------------');return new BPromise(function(_0x36cf16,_0x5300cd){if(_0x41037a<=0x0||isNaN(_0x41037a)){return _0x5300cd(msgResponse(_0xf3c2('0x211'),_0xf3c2('0x18e'),_0xf3c2('0x20d')+_0x41037a));}if(_0x35ed8b<=0x0||isNaN(_0x35ed8b)){return _0x5300cd(msgResponse(_0xf3c2('0x211'),_0xf3c2('0x18e'),_0xf3c2('0x20e')+_0x35ed8b));}if(_0x1b2751<=0x0||isNaN(_0x1b2751)){return _0x5300cd(msgResponse(_0xf3c2('0x211'),_0xf3c2('0x18e'),_0xf3c2('0x212')+_0x1b2751));}if(_0x58ed9a<=0x0||isNaN(_0x58ed9a)){return _0x5300cd(msgResponse(_0xf3c2('0x211'),_0xf3c2('0x18e'),_0xf3c2('0x20f')+_0x58ed9a));}if(_0x504ffc<=0x0||isNaN(_0x504ffc)){return _0x5300cd(msgResponse('[busyFactor]',_0xf3c2('0x18e'),_0xf3c2('0x213')+_0x504ffc));}_0x224f87=_0x224f87||0x0;var _0x1a1f35=0x1/_0x35ed8b;var _0x56a403=0x0;var _0x5c4983=0x0;var _0x3301b7=0x0;var _0x230697=0x0;for(var _0x2affd0=0x0;_0x230697<_0x504ffc;_0x2affd0+=0x1){_0x5c4983=_0x2affd0/_0x58ed9a;_0x56a403=(_0x1b2751*_0x5c4983+_0x224f87)/_0x1a1f35;_0x3301b7=erlangb(_0x56a403,_0x41037a);_0x230697=_0x56a403/_0x41037a*(0x1-erlangb(_0x56a403,_0x41037a));}return _0x36cf16({'erlangCalls':_0x2affd0,'erlangCallToSecond':_0x58ed9a/_0x2affd0,'erlangAbandonmentRate':_0x3301b7,'erlangBusyFactor':_0x230697});});};module[_0xf3c2('0x214')]=Dialer; \ No newline at end of file +var _0xe9ff=['is\x20not\x20active','state','starttime','clearZombieChannels','[uniqueid]','[actions]','prototype','undefined','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','then','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','averageHandleTime','resolve','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','merge','ContactId','ListId','VoiceQueueId','CampaignId','isSuccess','Success','SIP/%s','reachable','unmonitored','syncVarSet','uniqueid','isNil','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','statedesc','Machine','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countglobal','countcongestionretry','countdropretry','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','TIMEOUT','[rescheduleContact][Drop]','Drop','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','dropreason','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','actionid','locked','paused','stateinterface','strategy','idHopper','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','queueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','indexOf','true','push','content','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','checkIfTimeIntervals','\x5cw{0,','replace','random','match','actionOriginate','object','Contact','phone','originate','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','getCaller','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','createdAt','updatedAt','%s%s','XMD-','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdName','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialPrefix','dialCutDigit','trim','substring','from-sip','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','reason','outboundNoSuchCallsDay','custom:agentnosuchnumber','buildObj','nosuchnumber','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','checkRetriveMax','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','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','available','dialPredictiveOptimizationPercentage','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','checkContactBlack','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','ACTIVE','RUNNING','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[actionOriginatePredictive]\x20','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','Ts\x20=\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\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','uuid','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','message','INTERVAL_IS_NULL','name','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','milliseconds','seconds','emit','outbound','answered','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangBusyFactor','Trunk','active','stringify','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\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','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','diff','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xe9ff,0x17c));var _0xfe9f=function(_0xfa092f,_0x3e337a){_0xfa092f=_0xfa092f-0x0;var _0x3c188d=_0xe9ff[_0xfa092f];return _0x3c188d;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0xfe9f('0x0'));var moment=require('moment');var rr=require('rr');var md5=require(_0xfe9f('0x1'));var Redis=require(_0xfe9f('0x2'));var ut=require(_0xfe9f('0x3'));var config=require(_0xfe9f('0x4'));var logger=require(_0xfe9f('0x5'))(_0xfe9f('0x6'));var loggerBooked=require(_0xfe9f('0x5'))(_0xfe9f('0x7'));var loggerPredictive=require(_0xfe9f('0x5'))(_0xfe9f('0x8'));var loggerPredictiveCalls=require(_0xfe9f('0x5'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0xfe9f('0x9'));var ami=require(_0xfe9f('0xa'));config[_0xfe9f('0xb')]=_[_0xfe9f('0xc')](config['redis'],{'host':_0xfe9f('0xd'),'port':0x18eb});var io=require(_0xfe9f('0xe'))(new Redis(config[_0xfe9f('0xb')]));var cmHopper=require(_0xfe9f('0xf'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xfe9f('0x10'));var Action=require(_0xfe9f('0x11'));var History=require(_0xfe9f('0x12'));var Final=require(_0xfe9f('0x13'));var AgentComplete=require(_0xfe9f('0x14'));var QueueCallerAbandon=require(_0xfe9f('0x15'));var Hangup=require('./hangup');var ipAgi=process[_0xfe9f('0x16')][_0xfe9f('0x17')]||_0xfe9f('0x18');var strategy={'rrmemory':_0xfe9f('0x19'),'roundrobin':_0xfe9f('0x1a')};var Sequence=function(){};Sequence['prototype'][_0xfe9f('0x1b')]=function(_0x1f1c82){this['tail']=this['tail']?this[_0xfe9f('0x1c')][_0xfe9f('0x1d')](_0x1f1c82):_0x1f1c82();};function Dialer(_0x38533b,_0x3377e2){this[_0xfe9f('0x1e')]=new Sequence();this['preview']=_0x3377e2;this[_0xfe9f('0x1f')]=_0x38533b[_0xfe9f('0x1f')];this[_0xfe9f('0x20')]=_0x38533b[_0xfe9f('0x20')];this['agents']=_0x38533b[_0xfe9f('0x21')];this[_0xfe9f('0x22')]=_0x38533b[_0xfe9f('0x22')];this[_0xfe9f('0x23')]=config[_0xfe9f('0x23')]||0x2;this[_0xfe9f('0x24')]={};this[_0xfe9f('0x25')]={};this[_0xfe9f('0x26')]={};this[_0xfe9f('0x27')]={};this[_0xfe9f('0x28')]={};this[_0xfe9f('0x29')]={};this[_0xfe9f('0x2a')]={};this[_0xfe9f('0x2b')]={};this[_0xfe9f('0x2c')]={};this[_0xfe9f('0x2d')]={};ami['on'](_0xfe9f('0x2e'),this[_0xfe9f('0x2f')][_0xfe9f('0x30')](this));ami['on'](_0xfe9f('0x31'),this[_0xfe9f('0x32')][_0xfe9f('0x30')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0xfe9f('0x30')](this));ami['on'](_0xfe9f('0x33'),this[_0xfe9f('0x34')]['bind'](this));ami['on'](_0xfe9f('0x35'),this[_0xfe9f('0x9')]['bind'](this));ami['on'](_0xfe9f('0x36'),this[_0xfe9f('0x37')][_0xfe9f('0x30')](this));ami['on'](_0xfe9f('0x38'),this[_0xfe9f('0x39')][_0xfe9f('0x30')](this));ami['on'](_0xfe9f('0x3a'),this['syncVarSet'][_0xfe9f('0x30')](this));ami['on'](_0xfe9f('0x3b'),this[_0xfe9f('0x3c')][_0xfe9f('0x30')](this));ami['on']('queuestatuscomplete',this[_0xfe9f('0x3d')]['bind'](this));this[_0xfe9f('0x3e')]();this[_0xfe9f('0x3f')]();}function isNotNull(_0x59fcbd){return _0x59fcbd!==null&&!_[_0xfe9f('0x40')](_0x59fcbd);}function checkIsLoggedIn(_0x31f33c,_0x19b224){return function(){if(_0x19b224<=0x0){_0x31f33c['message']=_0xfe9f('0x41');throw _0x31f33c['name']+_0xfe9f('0x42');}};}function isActive(_0x3257a4){return _0x3257a4;}function checkIsActive(_0x32924d,_0x3959a4){return function(){if(!isActive(_0x3959a4)){_0x32924d['message']=_0xfe9f('0x43');throw _0x32924d['name']+_0xfe9f('0x44');}};}function checkInterval(_0x3169d6){return function(){if(!isNotNull(_0x3169d6[_0xfe9f('0x45')])){_0x3169d6[_0xfe9f('0x46')]=_0xfe9f('0x47');throw _0x3169d6[_0xfe9f('0x48')]+_0xfe9f('0x49');}if(!isNotNull(_0x3169d6[_0xfe9f('0x45')][_0xfe9f('0x4a')])){_0x3169d6[_0xfe9f('0x46')]=_0xfe9f('0x47');throw _0x3169d6['name']+_0xfe9f('0x49');}if(!isNotNull(_[_0xfe9f('0x4b')](_0x3169d6[_0xfe9f('0x45')][_0xfe9f('0x4a')]))){_0x3169d6[_0xfe9f('0x46')]='INTERVAL_IS_NULL';throw _0x3169d6[_0xfe9f('0x48')]+_0xfe9f('0x49');}};}function msgResponse(_0x34faa1,_0x30f463,_0x540aa3){return{'action':_0x34faa1,'response':_0x30f463,'message':_0x540aa3,'stack':_0x540aa3};}function myreject(_0x29ddef){return function(_0x1efc84){return _0x29ddef(msgResponse(_0xfe9f('0x4c'),_0xfe9f('0x4d'),JSON['stringify'](_0x1efc84)));};}function getSeconds(_0x825cb7,_0x1ec816){var _0x4a2c6b=moment(_0x825cb7)['milliseconds'](0x0);var _0x3b8071=moment(_0x1ec816)[_0xfe9f('0x4e')](0x0);return _0x4a2c6b['diff'](_0x3b8071,_0xfe9f('0x4f'));}function emit(_0x50e2a4,_0x47ca54,_0x5eec63){io['to'](_0x50e2a4)[_0xfe9f('0x50')](_0x47ca54,_0x5eec63);}function emitVoiceQueueSummary(_0x59be94){if(_0x59be94['type']===_0xfe9f('0x51')){var _0x41c47f={'id':_0x59be94['id'],'name':_0x59be94[_0xfe9f('0x48')],'strategy':_0x59be94['strategy'],'answered':_0x59be94[_0xfe9f('0x52')],'available':_0x59be94['available'],'loggedIn':_0x59be94[_0xfe9f('0x53')],'pTalking':_0x59be94['pTalking'],'sumBillable':_0x59be94[_0xfe9f('0x54')],'sumDuration':_0x59be94[_0xfe9f('0x55')],'sumHoldTime':_0x59be94[_0xfe9f('0x56')]||0x0,'talking':_0x59be94[_0xfe9f('0x57')],'total':_0x59be94[_0xfe9f('0x58')],'type':_0x59be94[_0xfe9f('0x59')],'unmanaged':_0x59be94[_0xfe9f('0x5a')],'abandoned':_0x59be94[_0xfe9f('0x5b')],'waiting':_0x59be94[_0xfe9f('0x5c')],'loggedInDb':_0x59be94['loggedInDb'],'dialActive':_0x59be94[_0xfe9f('0x5d')],'dialMethod':_0x59be94[_0xfe9f('0x5e')],'dialOriginateCallerIdName':_0x59be94['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x59be94[_0xfe9f('0x5f')],'dialOriginateTimeout':_0x59be94[_0xfe9f('0x60')],'dialPrefix':_0x59be94['dialPrefix'],'outboundAnswerAgiCallsDay':_0x59be94[_0xfe9f('0x61')],'outboundAnswerCallsDay':_0x59be94[_0xfe9f('0x62')],'outboundBlacklistCallsDay':_0x59be94['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x59be94[_0xfe9f('0x63')],'outboundCongestionCallsDay':_0x59be94[_0xfe9f('0x64')],'outboundDropCallsDayACS':_0x59be94[_0xfe9f('0x65')],'outboundDropCallsDayCallersExit':_0x59be94['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x59be94[_0xfe9f('0x66')],'outboundNoAnswerCallsDay':_0x59be94[_0xfe9f('0x67')],'outboundNoSuchCallsDay':_0x59be94['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x59be94['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x59be94[_0xfe9f('0x68')],'outboundRejectCallsDay':_0x59be94[_0xfe9f('0x69')],'outboundUnknownCallsDay':_0x59be94[_0xfe9f('0x6a')],'predictiveIntervalAnsweredCalls':_0x59be94[_0xfe9f('0x6b')],'predictiveIntervalAvgHoldtime':_0x59be94[_0xfe9f('0x6c')],'predictiveIntervalAvgTalktime':_0x59be94[_0xfe9f('0x6d')],'predictiveIntervalDroppedCallsCallersExit':_0x59be94[_0xfe9f('0x6e')],'predictiveIntervalDroppedCallsTimeout':_0x59be94['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x59be94[_0xfe9f('0x6f')],'predictiveIntervalErlangCallsDroppedCalls':_0x59be94[_0xfe9f('0x70')],'predictiveIntervalHitRate':_0x59be94[_0xfe9f('0x71')],'predictiveIntervalMultiplicativeFactor':_0x59be94[_0xfe9f('0x72')],'predictiveIntervalPauses':_0x59be94[_0xfe9f('0x73')],'predictiveIntervalAvailable':_0x59be94[_0xfe9f('0x74')],'predictiveIntervalTotalCalls':_0x59be94[_0xfe9f('0x75')],'message':_0x59be94[_0xfe9f('0x46')],'originated':_0x59be94[_0xfe9f('0x76')],'erlangCalls':_0x59be94[_0xfe9f('0x77')],'erlangCallToSecond':_0x59be94['erlangCallToSecond'],'erlangAbandonmentRate':_0x59be94['erlangAbandonmentRate'],'erlangBusyFactor':_0x59be94[_0xfe9f('0x78')],'startPredictive':_0x59be94[_0xfe9f('0x29')],'startProgressive':_0x59be94[_0xfe9f('0x2a')]};if(_0x59be94['Trunk']){_0x41c47f['Trunk']={'id':_0x59be94[_0xfe9f('0x79')]['id'],'name':_0x59be94['Trunk'][_0xfe9f('0x48')],'active':_0x59be94[_0xfe9f('0x79')][_0xfe9f('0x7a')],'callerid':_0x59be94[_0xfe9f('0x79')]['callerid']};}if(_0x59be94[_0xfe9f('0x45')]){_0x41c47f[_0xfe9f('0x45')]={'id':_0x59be94[_0xfe9f('0x45')]['id'],'name':_0x59be94[_0xfe9f('0x45')]['name']};}var _0x527271=md5(JSON[_0xfe9f('0x7b')](_0x41c47f));if(_0x59be94[_0xfe9f('0x1')]!==_0x527271){_0x59be94[_0xfe9f('0x1')]=_0x527271;emit(util[_0xfe9f('0x7c')](_0xfe9f('0x7d'),_0x41c47f['name']),_0xfe9f('0x7e'),_0x41c47f);}}}function emitCampaignSummary(_0x405736){if(_0x405736[_0xfe9f('0x59')]===_0xfe9f('0x7f')){emit(util[_0xfe9f('0x7c')](_0xfe9f('0x80'),_0x405736[_0xfe9f('0x48')]),_0xfe9f('0x81'),_0x405736);}}function checkGetDataPredictive(_0x1f0117){if(isNotNull(_0x1f0117)&&!_[_0xfe9f('0x4b')](_0x1f0117)){loggerPredictive[_0xfe9f('0x82')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x83'),_0x1f0117['predictiveIntervalTotalCalls']);loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x84'),_0x1f0117[_0xfe9f('0x6b')]);loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x85'),_0x1f0117['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x86'),_0x1f0117[_0xfe9f('0x6e')]);loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x87'),_0x1f0117[_0xfe9f('0x6c')]);loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x88'),_0x1f0117[_0xfe9f('0x6d')]);loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x89'));if(_0x1f0117[_0xfe9f('0x75')]>0x0){if(!_[_0xfe9f('0x40')](_0x1f0117[_0xfe9f('0x6d')])&&_0x1f0117[_0xfe9f('0x6d')]>0x0){return!![];}loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x8a'));if(!_[_0xfe9f('0x40')](_0x1f0117[_0xfe9f('0x6c')])&&_0x1f0117['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xfe9f('0x82')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x8b'));}return![];}function mergeDataErlangB(_0x5254d6){return function(_0x202b88){loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x8c'));loggerPredictive['info'](_0xfe9f('0x8d'),_0x202b88[_0xfe9f('0x77')]);loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x8e'),_0x202b88[_0xfe9f('0x8f')]);loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x90'),_0x202b88[_0xfe9f('0x91')]);loggerPredictive[_0xfe9f('0x82')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x202b88['erlangBusyFactor']);loggerPredictive[_0xfe9f('0x82')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x202b88[_0xfe9f('0x91')]);loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x89'));_['merge'](_0x5254d6,_0x202b88);};}function getDiff(_0x286e9f){var _0x364fdd=moment()['milliseconds'](0x0);var _0x1a0325=moment(_0x286e9f)[_0xfe9f('0x4e')](0x0);return _0x364fdd[_0xfe9f('0x92')](_0x1a0325,_0xfe9f('0x4f'));}function ifInterval(_0x3d0b67,_0x59b3d2){if(_['isUndefined'](_0x59b3d2)){return![];}return getDiff(_0x59b3d2)<_0x3d0b67*0x3c;}function freeVariablesPredictive(_0x52cdf1){if(isNotNull(_0x52cdf1)){if(!_['isUndefined'](_0x52cdf1[_0xfe9f('0x2a')])){_0x52cdf1[_0xfe9f('0x2a')]=undefined;loggerPredictive[_0xfe9f('0x82')](_0x52cdf1['name'],_0xfe9f('0x93'));}if(!_[_0xfe9f('0x40')](_0x52cdf1['startPredictive'])){_0x52cdf1[_0xfe9f('0x29')]=undefined;loggerPredictive[_0xfe9f('0x82')](_0x52cdf1[_0xfe9f('0x48')],_0xfe9f('0x94'));}if(!_[_0xfe9f('0x40')](_0x52cdf1['handlePredictive'])){clearInterval(_0x52cdf1['handlePredictive']);_0x52cdf1[_0xfe9f('0x95')]=undefined;loggerPredictive['info'](_0x52cdf1[_0xfe9f('0x48')],_0xfe9f('0x96'));}}}function erlangb(_0x362fe5,_0x52e2a9){if(_0x52e2a9===0x0){return 0x0;}var _0x3620b9=0x1;for(var _0x2c6422=0x1;_0x2c6422<=_0x52e2a9;_0x2c6422+=0x1){_0x3620b9=0x1+_0x3620b9*_0x2c6422/_0x362fe5;}return 0x1/_0x3620b9;}function isVoiceQueueOutbound(_0x4a832c){return _0x4a832c===_0xfe9f('0x51');}function isNotPreview(_0x42ac0f){return _0x42ac0f!==_0xfe9f('0x97');}function isCampaignIvr(_0x5a8bb9){return _0x5a8bb9==='ivr';}function getCallerId(_0x1b95e5,_0x6099b9,_0x39e883){if(!_['isUndefined'](_0x39e883)&&typeof _0x39e883===_0xfe9f('0x98')&&!_[_0xfe9f('0x4b')](_0x39e883)){if(!_[_0xfe9f('0x40')](_0x6099b9)&&typeof _0x6099b9===_0xfe9f('0x98')&&!_[_0xfe9f('0x4b')](_0x6099b9)){return util[_0xfe9f('0x7c')](_0xfe9f('0x99'),_0x6099b9,_0x39e883);}return util['format'](_0xfe9f('0x99'),_0x39e883,_0x39e883);}if(!_['isUndefined'](_0x1b95e5)&&typeof _0x1b95e5===_0xfe9f('0x98')&&!_['isEmpty'](_0x1b95e5)){return _0x1b95e5;}return _0xfe9f('0x9a');}function loggerCatchQueueSummary(_0x627a40,_0x42e654){return function(_0x341087){freeVariablesPredictive(_0x42e654);emitVoiceQueueSummary(_0x42e654);emitCampaignSummary(_0x42e654);loggerSyncQueueSummary[_0xfe9f('0x9b')](_0x627a40,util[_0xfe9f('0x9c')](_0x341087,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2f3559,_0x23a393){return function(_0x330cff){loggerPredictive[_0xfe9f('0x9b')](_0x23a393[_0xfe9f('0x48')],_0x2f3559);loggerPredictive[_0xfe9f('0x9b')](_0x330cff['stack']);freeVariablesPredictive(_0x23a393);};}function loggerCatch(_0x41dee7){return function(_0x11bfeb){logger[_0xfe9f('0x9b')](_0x41dee7,util[_0xfe9f('0x9c')](_0x11bfeb,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x5d0b4a){return _0x5d0b4a&&!_['isUndefined'](_0x5d0b4a)&&_0x5d0b4a[_0xfe9f('0x9d')]>0x0;}function decremetOriginate(_0x399157){if(!_[_0xfe9f('0x40')](_0x399157)&&_0x399157!==null){if(typeof _0x399157[_0xfe9f('0x76')]!=='undefined'){if(_0x399157[_0xfe9f('0x76')]>0x0){_0x399157[_0xfe9f('0x76')]-=0x1;}else{logger[_0xfe9f('0x9b')](_0xfe9f('0x9e'));}}}else{logger[_0xfe9f('0x9b')](_0xfe9f('0x9f'));}}function checkContactLowerLimitOriginate(_0x2f7ca6,_0x1d6069,_0x3f57fc){if(_0x1d6069>_0x3f57fc){for(var _0x126cbb=0x0;_0x126cbb<_0x1d6069-_0x3f57fc;_0x126cbb+=0x1){decremetOriginate(_0x2f7ca6);}}}function loggerGetContactDialer(_0x494af1,_0x230c36,_0x1c5c32){return function(_0x44bc95){checkContactLowerLimitOriginate(_0x230c36,_0x1c5c32,0x0);logger[_0xfe9f('0x9b')](_0x494af1,util[_0xfe9f('0x9c')](_0x44bc95,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3aa6d9){return function(_0x4b696c){if(isNotNull(_0x4b696c)&&isNotNull(_0x4b696c[0x0])){if(_0x4b696c[0x0]['contactsRescheduled']>0x0){_0x3aa6d9[_0xfe9f('0x46')]='RESCHEDULED_CONTACTS';logger[_0xfe9f('0x82')](_0xfe9f('0xa0')+_0x3aa6d9['name'],_0x4b696c[0x0][_0xfe9f('0xa1')],_0xfe9f('0xa2'));}else{_0x3aa6d9[_0xfe9f('0x46')]=_0xfe9f('0xa3');logger['info'](_0xfe9f('0xa4')+_0x3aa6d9[_0xfe9f('0x48')]);}}};}function notSendMessagesQueue(_0x433f78){if(_0x433f78[_0xfe9f('0xa5')]){freeVariablesPredictive(_0x433f78);if(_0x433f78[_0xfe9f('0x76')]===0x0&&_0x433f78['talking']===0x0&&_0x433f78[_0xfe9f('0x5c')]===0x0&&(_0x433f78['pTalking']||0x0)===0x0){_0x433f78['sendMessageOneNotActive']=![];_0x433f78['available']=0x0;_0x433f78[_0xfe9f('0x46')]='NOT_ACTIVE';loggerSyncQueueSummary['error'](_0xfe9f('0xa6'),_0x433f78[_0xfe9f('0x48')],'is\x20not\x20active');}else{_0x433f78[_0xfe9f('0x46')]=_0xfe9f('0xa7');loggerSyncQueueSummary[_0xfe9f('0x9b')](_0xfe9f('0xa6'),_0x433f78[_0xfe9f('0x48')],_0xfe9f('0xa8'));}emitVoiceQueueSummary(_0x433f78);}}function notSendMessagesCampaign(_0x14e399){if(_0x14e399[_0xfe9f('0xa5')]){if(_0x14e399[_0xfe9f('0x76')]===0x0){_0x14e399[_0xfe9f('0xa5')]=![];_0x14e399['message']=_0xfe9f('0x43');loggerSyncQueueSummary[_0xfe9f('0x9b')](_0xfe9f('0xa9'),_0x14e399[_0xfe9f('0x48')],_0xfe9f('0xaa'));}else{_0x14e399[_0xfe9f('0x46')]=_0xfe9f('0xa7');loggerSyncQueueSummary['error'](_0xfe9f('0xa9'),_0x14e399[_0xfe9f('0x48')],'is\x20disactive');}emitCampaignSummary(_0x14e399);}}function createObjHistory(_0x2f8bff,_0x5dde1d,_0x5bc162,_0x6456ae,_0xc7d9aa){_0x2f8bff[_0xfe9f('0x46')]=_0x5bc162;var _0xbca0d7=new Action(_0x2f8bff,_0x5dde1d);var _0xf7ff4c=new History(_0xbca0d7);_0xf7ff4c[_0xfe9f('0xab')]=_0x6456ae;_0xf7ff4c['statedesc']=_0xc7d9aa;_0xf7ff4c['endtime']=_0xbca0d7[_0xfe9f('0xac')];return _0xf7ff4c;}Dialer['prototype'][_0xfe9f('0x3f')]=function(){var _0x37ee31=this;setInterval(function(){_0x37ee31[_0xfe9f('0xad')](_0x37ee31['uniqueId'],_0xfe9f('0xae'));_0x37ee31[_0xfe9f('0xad')](_0x37ee31['actions'],_0xfe9f('0xaf'));},0x32c8);};Dialer[_0xfe9f('0xb0')][_0xfe9f('0xad')]=function(_0x934af8,_0x27a192){var _0x4416ff=this;for(var _0x3d5b6a in _0x934af8){if(typeof _0x934af8[_0x3d5b6a]!==_0xfe9f('0xb1')){this[_0xfe9f('0x1e')][_0xfe9f('0x1b')](function(){if(!_['isNil'](_0x934af8[_0x3d5b6a])){return ami[_0xfe9f('0xb2')]({'action':_0xfe9f('0xb3'),'channel':_0x934af8[_0x3d5b6a][_0xfe9f('0xb4')]})['catch'](function(_0x432e70){if(_0x432e70[_0xfe9f('0x46')]===_0xfe9f('0xb5')){setTimeout(function(){if(_0x934af8[_0x3d5b6a]&&_0x934af8[_0x3d5b6a][_0xfe9f('0x59')]!==_0xfe9f('0x7f')){_0x4416ff[_0xfe9f('0xb6')](_0x4416ff[_0xfe9f('0x1f')][_0x934af8[_0x3d5b6a][_0xfe9f('0xb7')]]);logger[_0xfe9f('0x9b')](_0xfe9f('0xb8'),_0x27a192,_0x3d5b6a,_0x934af8[_0x3d5b6a][_0xfe9f('0xb7')]);delete _0x934af8[_0x3d5b6a];}if(_0x934af8[_0x3d5b6a]&&_0x934af8[_0x3d5b6a]['type']===_0xfe9f('0x7f')){_0x4416ff[_0xfe9f('0xb6')](_0x4416ff[_0xfe9f('0x20')][_0x934af8[_0x3d5b6a][_0xfe9f('0xb7')]]);logger[_0xfe9f('0x9b')](_0xfe9f('0xb9'),_0x27a192,_0x3d5b6a,_0x934af8[_0x3d5b6a][_0xfe9f('0xb7')]);delete _0x934af8[_0x3d5b6a];}},0x2328);}});}});}}};Dialer['prototype'][_0xfe9f('0xba')]=function(_0x301dfb){return BPromise['resolve']()[_0xfe9f('0xbb')](cmHopper[_0xfe9f('0xba')](_0x301dfb))[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0xbd')));};Dialer[_0xfe9f('0xb0')][_0xfe9f('0xbe')]=function(_0x599942){return BPromise['resolve']()[_0xfe9f('0xbb')](cmHopperBlack['checkIsBlackList'](_0x599942))[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0xbf')));};Dialer[_0xfe9f('0xb0')][_0xfe9f('0xc0')]=function(_0xeea045){return BPromise['resolve']()[_0xfe9f('0xbb')](cmHopperBlack[_0xfe9f('0xc0')](_0xeea045))[_0xfe9f('0xbc')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xfe9f('0xb0')][_0xfe9f('0xc1')]=function(_0x389952){return BPromise[_0xfe9f('0xc2')]()[_0xfe9f('0xbb')](cmHopperHistory[_0xfe9f('0xc3')](_0x389952))[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0xc4')));};Dialer[_0xfe9f('0xb0')][_0xfe9f('0xc5')]=function(_0x85ddf3){return BPromise[_0xfe9f('0xc2')]()[_0xfe9f('0xbb')](cmHopper[_0xfe9f('0xc5')](_0x85ddf3))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0xfe9f('0xb0')]['unlockContact']=function(_0x358717,_0x464632,_0x186285){return BPromise['resolve']()['then'](cmHopper['unlockContact'](_0x358717,_0x464632,_0x186285))[_0xfe9f('0xbc')](loggerCatch('[unlockContact]\x20'));};Dialer['prototype'][_0xfe9f('0xc6')]=function(_0x500b80,_0x141ec5,_0x34d014,_0xe47510){return BPromise[_0xfe9f('0xc2')]()[_0xfe9f('0xbb')](cmHopper[_0xfe9f('0xc6')](_0x500b80,_0x141ec5,_0x34d014,_0xe47510))[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0xc7')));};Dialer[_0xfe9f('0xb0')][_0xfe9f('0xc8')]=function(_0x3b0120,_0x20b8eb,_0x5b8b5e){return BPromise[_0xfe9f('0xc2')]()['then'](cmHopper[_0xfe9f('0xc8')](_0x3b0120,_0x20b8eb,_0x5b8b5e))[_0xfe9f('0xbc')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xfe9f('0xb0')][_0xfe9f('0xc9')]=function(_0x5b3780){return BPromise[_0xfe9f('0xc2')]()[_0xfe9f('0xbb')](voiceQueueRt[_0xfe9f('0xc9')](_0x5b3780))[_0xfe9f('0xbc')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xfe9f('0xb0')][_0xfe9f('0xca')]=function(_0x217a38){return BPromise['resolve']()[_0xfe9f('0xbb')](cmHopper[_0xfe9f('0xca')](_0x217a38))[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0xcb')));};Dialer['prototype'][_0xfe9f('0xcc')]=function(_0x4e2ed0){return BPromise[_0xfe9f('0xc2')]()[_0xfe9f('0xbb')](cmHopperHistory[_0xfe9f('0xcc')](_0x4e2ed0))['catch'](loggerCatch(_0xfe9f('0xcd')));};Dialer[_0xfe9f('0xb0')][_0xfe9f('0xb6')]=function(_0x5ae60e){if(!_[_0xfe9f('0x40')](_0x5ae60e)&&_0x5ae60e!==null){if(typeof _0x5ae60e[_0xfe9f('0x76')]!=='undefined'){if(_0x5ae60e[_0xfe9f('0x76')]>0x0){_0x5ae60e['originated']-=0x1;}else{logger['error'](_0xfe9f('0xce'));}}}else{logger[_0xfe9f('0x9b')](_0xfe9f('0xcf'));}};Dialer[_0xfe9f('0xb0')][_0xfe9f('0xd0')]=function(_0x542b5c,_0x4e5279){var _0x5ea22e=this;return function(_0x5a74ab){_0x5ea22e[_0xfe9f('0xb6')](_0x4e5279);logger[_0xfe9f('0x9b')](_0x542b5c,util[_0xfe9f('0x9c')](_0x5a74ab,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0xfe9f('0xd1')]=function(_0x501067,_0x3ff58e,_0x3fe279){var _0x1d6442={'state':0x19,'statedesc':_0xfe9f('0xd2')};this[_0xfe9f('0xb6')](_0x3ff58e);this[_0xfe9f('0xd3')](_[_0xfe9f('0xd4')](_0x1d6442,_['pick'](_0x3fe279,[_0xfe9f('0xd5'),_0xfe9f('0xd6'),'UserId',_0xfe9f('0xd7'),_0xfe9f('0xd8')])),'[emptyContact][createHistory]','[emptyContact]');logger['error'](_0x501067);};Dialer[_0xfe9f('0xb0')][_0xfe9f('0xd9')]=function(_0x2d18ce){return _0x2d18ce===_0xfe9f('0xda');};Dialer['prototype']['isTrunkReachable']=function(_0x225832){return!_[_0xfe9f('0x40')](_0x225832)&&_0x225832&&!_[_0xfe9f('0x40')](_0x225832[_0xfe9f('0x48')])&&!_[_0xfe9f('0x40')](_0x225832[_0xfe9f('0x7a')])&&_0x225832[_0xfe9f('0x7a')]&&(this[_0xfe9f('0x22')][util[_0xfe9f('0x7c')](_0xfe9f('0xdb'),_0x225832[_0xfe9f('0x48')])]['status']===_0xfe9f('0xdc')||this['trunks'][util['format'](_0xfe9f('0xdb'),_0x225832[_0xfe9f('0x48')])]['status']===_0xfe9f('0xdd'));};Dialer[_0xfe9f('0xb0')][_0xfe9f('0xd3')]=function(_0x319297,_0x30bdd1,_0x594e0e){this[_0xfe9f('0xcc')](_0x319297)['catch'](loggerCatch(_0x30bdd1));this[_0xfe9f('0xca')](_0x319297)[_0xfe9f('0xbc')](loggerCatch(_0x594e0e));};Dialer['prototype'][_0xfe9f('0xde')]=function(_0x1f43ed){var _0x50d1f0=this[_0xfe9f('0x27')][_0x1f43ed[_0xfe9f('0xdf')]];var _0x34305d;if(!_[_0xfe9f('0xe0')](_0x1f43ed)&&!_[_0xfe9f('0xe0')](_0x1f43ed['variable'])&&!_[_0xfe9f('0xe0')](_0x1f43ed['variable']['amdstatus'])&&_0x1f43ed[_0xfe9f('0xe1')]===_0xfe9f('0xe2')&&_0x50d1f0){if(_0x50d1f0[_0xfe9f('0x59')]!=='ivr'&&this[_0xfe9f('0x1f')][_0x50d1f0[_0xfe9f('0xb7')]][_0xfe9f('0xe3')]&&_0x1f43ed[_0xfe9f('0xe4')]===_0xfe9f('0xe5')){delete this[_0xfe9f('0x27')][_0x1f43ed[_0xfe9f('0xdf')]];this[_0xfe9f('0xb6')](this[_0xfe9f('0x1f')][_0x50d1f0[_0xfe9f('0xb7')]]);this[_0xfe9f('0x1f')][_0x50d1f0[_0xfe9f('0xb7')]][_0xfe9f('0x62')]+=0x1;this[_0xfe9f('0x1f')][_0x50d1f0[_0xfe9f('0xb7')]][_0xfe9f('0x61')]+=0x1;_0x34305d=new Hangup(_0x50d1f0,_0x1f43ed);_0x34305d[_0xfe9f('0xab')]=0x12;_0x34305d['statedesc']=_0xfe9f('0xe6');_0x34305d[_0xfe9f('0xe7')]=_0xfe9f('0xe8');this[_0xfe9f('0xd3')](_0x34305d,_0xfe9f('0xe9'),_0xfe9f('0xea'));}if(_0x50d1f0[_0xfe9f('0x59')]!==_0xfe9f('0x7f')&&this['voiceQueues'][_0x50d1f0['queue']][_0xfe9f('0xe3')]&&_0x1f43ed['value']===_0xfe9f('0xeb')){var _0x1ca644=this;return new BPromise(function(_0x4c313c,_0x3da36e){delete _0x1ca644['uniqueId'][_0x1f43ed[_0xfe9f('0xdf')]];_0x1ca644[_0xfe9f('0xb6')](_0x1ca644[_0xfe9f('0x1f')][_0x50d1f0[_0xfe9f('0xb7')]]);_0x1ca644[_0xfe9f('0x1f')][_0x50d1f0[_0xfe9f('0xb7')]]['outboundAnswerCallsDay']+=0x1;_0x1ca644[_0xfe9f('0x1f')][_0x50d1f0['queue']][_0xfe9f('0x61')]+=0x1;var _0x29945b=_0x1ca644[_0xfe9f('0x1f')][_0x50d1f0[_0xfe9f('0xb7')]];var _0x2a037c=new Hangup(_0x50d1f0,_0x1f43ed);_0x2a037c[_0xfe9f('0xab')]=0x13;_0x2a037c[_0xfe9f('0xec')]=_0xfe9f('0xed');_0x2a037c['membername']=_0xfe9f('0xe8');_0x2a037c[_0xfe9f('0xee')]+=0x1;_0x2a037c['countglobal']+=0x1;_0x2a037c[_0xfe9f('0xef')]=!![];_0x1ca644[_0xfe9f('0xcc')](_0x2a037c)['catch'](loggerCatch(_0xfe9f('0xf0')));if(_0x2a037c[_0xfe9f('0xf1')]+_0x2a037c['countcongestionretry']+_0x2a037c[_0xfe9f('0xf2')]+_0x2a037c[_0xfe9f('0xf3')]+_0x2a037c['countdropretry']+_0x2a037c[_0xfe9f('0xf4')]+_0x2a037c[_0xfe9f('0xee')]+_0x2a037c[_0xfe9f('0xf5')]>=_0x29945b[_0xfe9f('0xf6')]){_0x1ca644[_0xfe9f('0xf7')](_0x2a037c,_0x4c313c,_0x3da36e,_0xfe9f('0xf8'));}else{if(_0x2a037c[_0xfe9f('0xee')]>=_0x29945b[_0xfe9f('0xf9')]){_0x1ca644[_0xfe9f('0xfa')](_0x2a037c,_0x4c313c,_0x3da36e,'reason\x2019\x20machine....');}else{_0x1ca644[_0xfe9f('0xc5')]({'active':![],'countmachineretry':_0x2a037c[_0xfe9f('0xee')],'scheduledat':moment()[_0xfe9f('0xfb')](_0x29945b[_0xfe9f('0xfc')],_0xfe9f('0xfd'))[_0xfe9f('0x7c')](_0xfe9f('0xfe')),'ContactId':_0x2a037c[_0xfe9f('0xd5')],'ListId':_0x2a037c[_0xfe9f('0xd6')],'VoiceQueueId':_0x2a037c[_0xfe9f('0xd7')]||undefined,'CampaignId':_0x2a037c[_0xfe9f('0xd8')]||undefined})[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0xff')));_0x4c313c({'reschedule':0x1});}}});}if(_0x50d1f0[_0xfe9f('0x59')]==='ivr'&&this[_0xfe9f('0x20')][_0x50d1f0['queue']]['dialAMDActive']&&_0x1f43ed[_0xfe9f('0xe4')]===_0xfe9f('0xe5')){delete this[_0xfe9f('0x27')][_0x1f43ed[_0xfe9f('0xdf')]];this['updateOriginated'](this[_0xfe9f('0x20')][_0x50d1f0[_0xfe9f('0xb7')]]);_0x34305d=new Hangup(_0x50d1f0,_0x1f43ed);_0x34305d[_0xfe9f('0xab')]=0x12;_0x34305d[_0xfe9f('0xec')]=_0xfe9f('0xe6');_0x34305d['membername']=_0xfe9f('0xe8');this[_0xfe9f('0xd3')](_0x34305d,_0xfe9f('0x100'),_0xfe9f('0x101'));}if(_0x50d1f0[_0xfe9f('0x59')]===_0xfe9f('0x7f')&&this[_0xfe9f('0x20')][_0x50d1f0['queue']][_0xfe9f('0xe3')]&&_0x1f43ed['value']===_0xfe9f('0xeb')){var _0x1ca644=this;return new BPromise(function(_0xba9040,_0x11269e){delete _0x1ca644[_0xfe9f('0x27')][_0x1f43ed['uniqueid']];_0x1ca644[_0xfe9f('0xb6')](_0x1ca644['campaigns'][_0x50d1f0['queue']]);_0x1ca644[_0xfe9f('0x20')][_0x50d1f0['queue']]['outboundAnswerCallsDay']+=0x1;_0x1ca644[_0xfe9f('0x20')][_0x50d1f0[_0xfe9f('0xb7')]][_0xfe9f('0x61')]+=0x1;var _0x41e34a=_0x1ca644[_0xfe9f('0x20')][_0x50d1f0['queue']];var _0x298865=new Hangup(_0x50d1f0,_0x1f43ed);_0x298865[_0xfe9f('0xab')]=0x13;_0x298865[_0xfe9f('0xec')]='Machine';_0x298865['membername']='AMD';_0x298865[_0xfe9f('0xee')]+=0x1;_0x298865[_0xfe9f('0x102')]+=0x1;_0x298865['amd']=!![];_0x1ca644[_0xfe9f('0xcc')](_0x298865)['catch'](loggerCatch(_0xfe9f('0xf0')));if(_0x298865['countbusyretry']+_0x298865[_0xfe9f('0x103')]+_0x298865[_0xfe9f('0xf2')]+_0x298865[_0xfe9f('0xf3')]+_0x298865[_0xfe9f('0x104')]+_0x298865[_0xfe9f('0xf4')]+_0x298865[_0xfe9f('0xee')]+_0x298865[_0xfe9f('0xf5')]>=_0x41e34a[_0xfe9f('0xf6')]){_0x1ca644[_0xfe9f('0xf7')](_0x298865,_0xba9040,_0x11269e,'reason19\x20machine....');}else{if(_0x298865[_0xfe9f('0xee')]>=_0x41e34a[_0xfe9f('0xf9')]){_0x1ca644[_0xfe9f('0xfa')](_0x298865,_0xba9040,_0x11269e,_0xfe9f('0x105'));}else{_0x1ca644[_0xfe9f('0xc5')]({'active':![],'countmachineretry':_0x298865[_0xfe9f('0xee')],'scheduledat':moment()[_0xfe9f('0xfb')](_0x41e34a['dialMachineRetryFrequency'],_0xfe9f('0xfd'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x298865[_0xfe9f('0xd5')],'ListId':_0x298865[_0xfe9f('0xd6')],'VoiceQueueId':_0x298865[_0xfe9f('0xd7')]||undefined,'CampaignId':_0x298865[_0xfe9f('0xd8')]||undefined})[_0xfe9f('0xbc')](loggerCatch('[rescheduleContact][Machine]'));_0xba9040({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xfe9f('0x37')]=function(_0x2c7dfc){var _0x2f422e=this['uniqueId'][_0x2c7dfc[_0xfe9f('0xdf')]];var _0x465c33=this;var _0x4731d3;if(_0x2f422e&&_0x2f422e['type']===_0xfe9f('0x7f')){delete this[_0xfe9f('0x27')][_0x2c7dfc['uniqueid']];this[_0xfe9f('0xb6')](this['campaigns'][_0x2f422e[_0xfe9f('0xb7')]]);this[_0xfe9f('0x20')][_0x2f422e[_0xfe9f('0xb7')]][_0xfe9f('0x106')]+=0x1;_0x4731d3=new Hangup(_0x2f422e,_0x2c7dfc);this[_0xfe9f('0xcc')](_0x4731d3)['catch'](loggerCatch(_0xfe9f('0x107')));this[_0xfe9f('0xca')](_0x4731d3)[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0x108')));}if(_0x2f422e&&_0x2f422e[_0xfe9f('0x59')]!==_0xfe9f('0x7f')&&isNotNull(this[_0xfe9f('0x1f')][_0x2f422e['queue']][_0xfe9f('0x109')])){delete this['uniqueId'][_0x2c7dfc[_0xfe9f('0xdf')]];this[_0xfe9f('0xb6')](this[_0xfe9f('0x1f')][_0x2f422e['queue']]);this[_0xfe9f('0x1f')][_0x2f422e['queue']][_0xfe9f('0x62')]+=0x1;this['voiceQueues'][_0x2f422e[_0xfe9f('0xb7')]]['outboundAnswerAgiCallsDay']+=0x1;_0x4731d3=new Hangup(_0x2f422e,_0x2c7dfc);_0x4731d3['state']=0x10;_0x4731d3[_0xfe9f('0xec')]=_0xfe9f('0x10a');_0x4731d3[_0xfe9f('0xe7')]=_0xfe9f('0x10b');this[_0xfe9f('0xcc')](_0x4731d3)[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0x107')));this['moveContactManagedDialer'](_0x4731d3)[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0x108')));}if(_0x2f422e&&_0x2f422e['type']!==_0xfe9f('0x7f')&&!isNotNull(this[_0xfe9f('0x1f')][_0x2f422e[_0xfe9f('0xb7')]][_0xfe9f('0x109')])){delete this['uniqueId'][_0x2c7dfc[_0xfe9f('0xdf')]];this['updateOriginated'](this[_0xfe9f('0x1f')][_0x2f422e['queue']]);this['voiceQueues'][_0x2f422e['queue']][_0xfe9f('0x6a')]+=0x1;_0x4731d3=new Hangup(_0x2f422e,_0x2c7dfc);_0x4731d3[_0xfe9f('0xab')]=0xc;_0x4731d3['statedesc']=_0x2c7dfc[_0xfe9f('0x10c')];_0x4731d3[_0xfe9f('0xe7')]='Unknow';this[_0xfe9f('0xcc')](_0x4731d3)[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0x107')));this[_0xfe9f('0xca')](_0x4731d3)['catch'](loggerCatch(_0xfe9f('0x108')));}};Dialer[_0xfe9f('0xb0')][_0xfe9f('0x34')]=function(_0x2d0d9c){var _0x3db939=this[_0xfe9f('0x27')][_0x2d0d9c[_0xfe9f('0xdf')]];var _0x7a25fb=this;if(this[_0xfe9f('0x1f')][_0x2d0d9c[_0xfe9f('0xb7')]]){if(_0x3db939&&_0x3db939[_0xfe9f('0x59')]!=='ivr'){delete this[_0xfe9f('0x27')][_0x2d0d9c[_0xfe9f('0xdf')]];this[_0xfe9f('0x1f')][_0x2d0d9c[_0xfe9f('0xb7')]][_0xfe9f('0x62')]+=0x1;var _0x4ccc99=new AgentComplete(_0x3db939,_0x2d0d9c);if(_0x2d0d9c['reason']==='agent'){_0x4ccc99[_0xfe9f('0x10d')]=this[_0xfe9f('0x1f')][_0x2d0d9c[_0xfe9f('0xb7')]][_0xfe9f('0x10e')]&&this['voiceQueues'][_0x2d0d9c['queue']]['dialAgiAfterHangupAgent']?moment()[_0xfe9f('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0xfe9f('0xcc')](_0x4ccc99)[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0x10f')));this['moveContactManagedDialer'](_0x4ccc99)['catch'](loggerCatch(_0xfe9f('0x110')));}}};Dialer[_0xfe9f('0xb0')][_0xfe9f('0x2f')]=function(_0x502b59){if(this[_0xfe9f('0x1f')][_0x502b59[_0xfe9f('0xb7')]]){if(this['uniqueId'][_0x502b59[_0xfe9f('0xdf')]]&&this[_0xfe9f('0x27')][_0x502b59[_0xfe9f('0xdf')]][_0xfe9f('0x59')]!==_0xfe9f('0x7f')){this[_0xfe9f('0xb6')](this['voiceQueues'][_0x502b59[_0xfe9f('0xb7')]]);this[_0xfe9f('0x27')][_0x502b59[_0xfe9f('0xdf')]]['answertime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xfe9f('0xb0')][_0xfe9f('0x111')]=function(_0x3be53c){this['createHistory'](_0x3be53c)[_0xfe9f('0xbc')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x3be53c)[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0x112')));};Dialer[_0xfe9f('0xb0')][_0xfe9f('0x32')]=function(_0x6a4f47){var _0x36fa6d=this[_0xfe9f('0x27')][_0x6a4f47['uniqueid']];var _0x27d6b9=this;if(this[_0xfe9f('0x1f')][_0x6a4f47[_0xfe9f('0xb7')]]){if(_0x36fa6d&&_0x36fa6d[_0xfe9f('0x59')]!==_0xfe9f('0x7f')){delete this[_0xfe9f('0x27')][_0x6a4f47[_0xfe9f('0xdf')]];this['updateOriginated'](this[_0xfe9f('0x1f')][_0x6a4f47[_0xfe9f('0xb7')]]);_0x36fa6d[_0xfe9f('0x113')]=moment()['format'](_0xfe9f('0xfe'));var _0x8b9312=new QueueCallerAbandon(_0x36fa6d,_0x6a4f47);if(getSeconds(_0x36fa6d[_0xfe9f('0x113')],_0x36fa6d[_0xfe9f('0x114')])>=_0x36fa6d[_0xfe9f('0x115')]){this[_0xfe9f('0x1f')][_0x6a4f47[_0xfe9f('0xb7')]][_0xfe9f('0x116')]+=0x1;this[_0xfe9f('0x1f')][_0x6a4f47[_0xfe9f('0xb7')]][_0xfe9f('0x66')]+=0x1;this['voiceQueues'][_0x6a4f47[_0xfe9f('0xb7')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x8b9312['state']=0xa;_0x8b9312[_0xfe9f('0xec')]='Drop';_0x8b9312['dropreason']=_0xfe9f('0x117');_0x8b9312[_0xfe9f('0x10d')]=this[_0xfe9f('0x1f')][_0x6a4f47[_0xfe9f('0xb7')]]['dialQueueProject2']?moment()[_0xfe9f('0x7c')](_0xfe9f('0xfe')):undefined;_0x8b9312[_0xfe9f('0x104')]+=0x1;_0x8b9312[_0xfe9f('0x102')]+=0x1;if(_0x8b9312[_0xfe9f('0x104')]>=this['voiceQueues'][_0x6a4f47[_0xfe9f('0xb7')]]['dialDropMaxRetry']){this[_0xfe9f('0x111')](_0x8b9312);}else{this[_0xfe9f('0xc5')]({'active':![],'countdropretry':_0x8b9312[_0xfe9f('0x104')],'scheduledat':moment()[_0xfe9f('0xfb')](this[_0xfe9f('0x1f')][_0x6a4f47[_0xfe9f('0xb7')]]['dialDropRetryFrequency'],_0xfe9f('0xfd'))['format'](_0xfe9f('0xfe')),'ContactId':_0x36fa6d[_0xfe9f('0xd5')],'ListId':_0x36fa6d[_0xfe9f('0xd6')],'VoiceQueueId':_0x36fa6d['VoiceQueueId']||undefined,'CampaignId':_0x36fa6d[_0xfe9f('0xd8')]||undefined})[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0x118')));var _0x3bd079=new History(_0x8b9312);_0x3bd079[_0xfe9f('0xab')]=0xa;_0x3bd079[_0xfe9f('0xec')]=_0xfe9f('0x119');_0x3bd079['starttime']=moment()[_0xfe9f('0x7c')](_0xfe9f('0xfe'));_0x3bd079[_0xfe9f('0x11a')]=_0x3bd079['starttime'];_0x3bd079['calleridname']=_0x8b9312[_0xfe9f('0x11b')];_0x3bd079['calleridnum']=_0x8b9312[_0xfe9f('0x11c')];this['createHistory'](_0x3bd079)[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0x11d')));}}else{this[_0xfe9f('0x1f')][_0x6a4f47[_0xfe9f('0xb7')]][_0xfe9f('0x6e')]+=0x1;this['voiceQueues'][_0x6a4f47['queue']][_0xfe9f('0x11e')]+=0x1;_0x8b9312[_0xfe9f('0xab')]=0xb;_0x8b9312['statedesc']=_0xfe9f('0x11f');_0x8b9312[_0xfe9f('0x120')]='CALLEREXIT';_0x8b9312[_0xfe9f('0xf4')]+=0x1;_0x8b9312[_0xfe9f('0x102')]+=0x1;if(_0x8b9312[_0xfe9f('0xf4')]>=this[_0xfe9f('0x1f')][_0x6a4f47[_0xfe9f('0xb7')]][_0xfe9f('0x121')]){this['queueCallerAbandonCreateState'](_0x8b9312);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x8b9312[_0xfe9f('0xf4')],'scheduledat':moment()[_0xfe9f('0xfb')](this[_0xfe9f('0x1f')][_0x6a4f47['queue']]['dialAbandonedRetryFrequency'],'minutes')[_0xfe9f('0x7c')](_0xfe9f('0xfe')),'ContactId':_0x36fa6d[_0xfe9f('0xd5')],'ListId':_0x36fa6d[_0xfe9f('0xd6')],'VoiceQueueId':_0x36fa6d['VoiceQueueId']||undefined,'CampaignId':_0x36fa6d['CampaignId']||undefined})[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0x122')));var _0x3bd079=new History(_0x8b9312);_0x3bd079[_0xfe9f('0xab')]=0xb;_0x3bd079[_0xfe9f('0xec')]='Abandoned';_0x3bd079[_0xfe9f('0xac')]=moment()[_0xfe9f('0x7c')](_0xfe9f('0xfe'));_0x3bd079[_0xfe9f('0x11a')]=_0x3bd079[_0xfe9f('0xac')];_0x3bd079[_0xfe9f('0x11b')]=_0x8b9312[_0xfe9f('0x11b')];_0x3bd079['calleridnum']=_0x8b9312[_0xfe9f('0x11c')];this[_0xfe9f('0xcc')](_0x3bd079)[_0xfe9f('0xbc')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer['prototype']['syncNewExten']=function(_0x5b796a){if(this[_0xfe9f('0x25')][_0x5b796a['uniqueid']]){this[_0xfe9f('0x25')][_0x5b796a['uniqueid']][_0xfe9f('0xb4')]=_0x5b796a[_0xfe9f('0xb4')];}if(this[_0xfe9f('0x27')][_0x5b796a[_0xfe9f('0xdf')]]){this[_0xfe9f('0x27')][_0x5b796a[_0xfe9f('0xdf')]][_0xfe9f('0xb4')]=_0x5b796a[_0xfe9f('0xb4')];}};Dialer[_0xfe9f('0xb0')][_0xfe9f('0x3c')]=function(_0x147134){if(strategy[this[_0xfe9f('0x1f')][this['actions'][_0x147134[_0xfe9f('0x123')]]['queue']]['strategy']]===_0xfe9f('0x1a')){if(this[_0xfe9f('0x25')][_0x147134[_0xfe9f('0x123')]]&&_[_0xfe9f('0xe0')](this[_0xfe9f('0x25')][_0x147134[_0xfe9f('0x123')]][_0xfe9f('0x124')])&&_0x147134['status']==='1'&&_0x147134[_0xfe9f('0x125')]==='0'){if(this['agents'][_0x147134[_0xfe9f('0x126')]]){if(!this[_0xfe9f('0x21')][_0x147134[_0xfe9f('0x126')]]['locked']){this[_0xfe9f('0x21')][_0x147134['stateinterface']]['locked']=!![];this[_0xfe9f('0x25')][_0x147134['actionid']][_0xfe9f('0x124')]=!![];this[_0xfe9f('0x25')][_0x147134[_0xfe9f('0x123')]][_0xfe9f('0x126')]=_0x147134[_0xfe9f('0x126')];}}}}else if((strategy[this['voiceQueues'][this[_0xfe9f('0x25')][_0x147134[_0xfe9f('0x123')]][_0xfe9f('0xb7')]][_0xfe9f('0x127')]]||_0xfe9f('0x19'))===_0xfe9f('0x19')){if(this[_0xfe9f('0x25')][_0x147134['actionid']]){if(this[_0xfe9f('0x21')][_0x147134[_0xfe9f('0x126')]]){this['actions'][_0x147134[_0xfe9f('0x123')]]['stateinterface']=_0x147134[_0xfe9f('0x126')];if(_[_0xfe9f('0xe0')](this[_0xfe9f('0x2c')][this[_0xfe9f('0x25')][_0x147134[_0xfe9f('0x123')]]['queue']])){this[_0xfe9f('0x2c')][this['actions'][_0x147134['actionid']][_0xfe9f('0xb7')]]=[];}this['queueBooked'][this[_0xfe9f('0x25')][_0x147134['actionid']][_0xfe9f('0xb7')]]['push'](_[_0xfe9f('0xd4')](_['pick'](this[_0xfe9f('0x25')][_0x147134[_0xfe9f('0x123')]],[_0xfe9f('0x128'),_0xfe9f('0x126')]),{'status':_0x147134[_0xfe9f('0xb3')],'paused':_0x147134[_0xfe9f('0x125')]}));}}}};function unlockQueueStatus(_0x102c54,_0x475e2a){setTimeout(function(){if(_[_0xfe9f('0x40')](_0x102c54['queueStatusComplete'])){loggerBooked[_0xfe9f('0x9b')](_0xfe9f('0x129'),_0x475e2a);}_0x102c54['queueStatusComplete']=!![];loggerBooked[_0xfe9f('0x82')](_0xfe9f('0x12a'),_0x475e2a,JSON[_0xfe9f('0x7b')](_[_0xfe9f('0x12b')](_0x102c54,[_0xfe9f('0x48'),_0xfe9f('0x12c')])));},0x1f3);}Dialer[_0xfe9f('0xb0')][_0xfe9f('0x3d')]=function(_0x2cbcc3){var _0x3f8dc9=this;var _0x5379d0=_0x3f8dc9['voiceQueues'][_0x3f8dc9[_0xfe9f('0x25')][_0x2cbcc3[_0xfe9f('0x123')]][_0xfe9f('0xb7')]];if(strategy[this['voiceQueues'][this[_0xfe9f('0x25')][_0x2cbcc3[_0xfe9f('0x123')]]['queue']][_0xfe9f('0x127')]]===_0xfe9f('0x1a')){if(this['actions'][_0x2cbcc3[_0xfe9f('0x123')]]&&this[_0xfe9f('0x25')][_0x2cbcc3[_0xfe9f('0x123')]][_0xfe9f('0x126')]){this[_0xfe9f('0x97')][_0xfe9f('0x12d')](this[_0xfe9f('0x25')][_0x2cbcc3['actionid']][_0xfe9f('0x128')],this[_0xfe9f('0x25')][_0x2cbcc3['actionid']][_0xfe9f('0x126')])[_0xfe9f('0xbc')](function(_0x2f2032){logger[_0xfe9f('0x9b')](_0xfe9f('0x12e'),util[_0xfe9f('0x9c')](_0x2f2032,{'showHidden':![],'depth':null}));})['finally'](function(){_0x3f8dc9[_0xfe9f('0xb6')](_0x3f8dc9['voiceQueues'][_0x3f8dc9[_0xfe9f('0x25')][_0x2cbcc3[_0xfe9f('0x123')]][_0xfe9f('0xb7')]]);_0x3f8dc9[_0xfe9f('0x21')][_0x3f8dc9[_0xfe9f('0x25')][_0x2cbcc3[_0xfe9f('0x123')]][_0xfe9f('0x126')]][_0xfe9f('0x124')]=![];delete _0x3f8dc9[_0xfe9f('0x25')][_0x2cbcc3[_0xfe9f('0x123')]];unlockQueueStatus(_0x5379d0);});}else{this[_0xfe9f('0xb6')](this['voiceQueues'][this[_0xfe9f('0x25')][_0x2cbcc3[_0xfe9f('0x123')]]['queue']]);this[_0xfe9f('0xc5')]({'active':![],'ContactId':this['actions'][_0x2cbcc3['actionid']][_0xfe9f('0xd5')],'ListId':this[_0xfe9f('0x25')][_0x2cbcc3[_0xfe9f('0x123')]]['ListId'],'VoiceQueueId':this['actions'][_0x2cbcc3[_0xfe9f('0x123')]][_0xfe9f('0xd7')]||undefined,'CampaignId':this['actions'][_0x2cbcc3[_0xfe9f('0x123')]]['CampaignId']||undefined})[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0x12f')));delete this[_0xfe9f('0x25')][_0x2cbcc3[_0xfe9f('0x123')]];unlockQueueStatus(_0x5379d0);}}else if((strategy[this[_0xfe9f('0x1f')][this[_0xfe9f('0x25')][_0x2cbcc3[_0xfe9f('0x123')]][_0xfe9f('0xb7')]][_0xfe9f('0x127')]]||_0xfe9f('0x19'))===_0xfe9f('0x19')){var _0x34d375;if(this[_0xfe9f('0x25')][_0x2cbcc3[_0xfe9f('0x123')]]&&!_['isEmpty'](this['queueBooked'][this[_0xfe9f('0x25')][_0x2cbcc3[_0xfe9f('0x123')]][_0xfe9f('0xb7')]])){if(this['queueBookedRR'][_0x3f8dc9[_0xfe9f('0x25')][_0x2cbcc3['actionid']]['queue']]){this[_0xfe9f('0x2d')][_0x3f8dc9['actions'][_0x2cbcc3[_0xfe9f('0x123')]][_0xfe9f('0xb7')]]=this[_0xfe9f('0x2d')][this[_0xfe9f('0x25')][_0x2cbcc3[_0xfe9f('0x123')]][_0xfe9f('0xb7')]]?this['queueBookedRR'][this[_0xfe9f('0x25')][_0x2cbcc3['actionid']][_0xfe9f('0xb7')]]:this[_0xfe9f('0x2c')][this[_0xfe9f('0x25')][_0x2cbcc3[_0xfe9f('0x123')]][_0xfe9f('0xb7')]]?this[_0xfe9f('0x2c')][this[_0xfe9f('0x25')][_0x2cbcc3[_0xfe9f('0x123')]]['queue']]['_rr']||0x0:0x0;}this[_0xfe9f('0x2c')][this[_0xfe9f('0x25')][_0x2cbcc3[_0xfe9f('0x123')]][_0xfe9f('0xb7')]][_0xfe9f('0x130')]=this[_0xfe9f('0x2d')][this['actions'][_0x2cbcc3[_0xfe9f('0x123')]]['queue']];for(var _0x16627d=0x0;_0x16627d=0x0;})[_0xfe9f('0xbc')](myreject(_0x55d6c2)));}}else{_0x330af5[_0xfe9f('0x14d')](ami[_0xfe9f('0xb2')]({'action':_0xfe9f('0x149'),'command':util[_0xfe9f('0x7c')](_0xfe9f('0x14a'),_0x3a3456,!_[_0xfe9f('0x40')](config['timezones'][_0xd4ecfe])?_0xd4ecfe:'')})[_0xfe9f('0xbb')](function(_0x260c74){return _0x260c74[_0xfe9f('0x14e')][_0xfe9f('0x14b')](_0xfe9f('0x14c'))>=0x0;})[_0xfe9f('0xbc')](myreject(_0x55d6c2)));}BPromise[_0xfe9f('0x14f')](_0x330af5)['then'](function(_0x268c8a){var _0xa409aa=_[_0xfe9f('0x150')](_0x268c8a);if(_0xa409aa){return _0x1ffeb2(_0xa409aa);}else{_0x3fa403[_0xfe9f('0x46')]=_0x331d56?_0xfe9f('0x151'):_0xfe9f('0x152');return _0x55d6c2(msgResponse(_0xfe9f('0x153'),_0xfe9f('0x141'),_0xfe9f('0x154')+_0x331d56+'\x20'+_0x5ea540+'\x20Interval\x20is\x20overtime:\x20'+util[_0xfe9f('0x9c')](_0x3a3456,{'showHidden':![],'depth':null})+_0xfe9f('0x155')+_0xd4ecfe));}})[_0xfe9f('0xbc')](function(_0x36006f){return _0x55d6c2(msgResponse('ifTime',_0xfe9f('0x141'),JSON[_0xfe9f('0x7b')](_0x36006f)));});});};Dialer['prototype'][_0xfe9f('0x156')]=function(_0x11f44c){var _0x3835eb=this;return function(){switch(_0x11f44c[_0xfe9f('0x5e')]){case _0xfe9f('0x157'):freeVariablesPredictive(_0x11f44c);_0x3835eb[_0xfe9f('0x158')](_0x11f44c,0x1);break;case _0xfe9f('0x159'):freeVariablesPredictive(_0x11f44c);_0x3835eb[_0xfe9f('0x158')](_0x11f44c,_0x11f44c[_0xfe9f('0x15a')]);break;case _0xfe9f('0x8'):_0x3835eb[_0xfe9f('0x8')](_0x11f44c);break;case _0xfe9f('0x7'):freeVariablesPredictive(_0x11f44c);_0x3835eb[_0xfe9f('0x158')](_0x11f44c,0x1);break;default:freeVariablesPredictive(_0x11f44c);logger['error'](_0xfe9f('0x15b'),_0x11f44c[_0xfe9f('0x48')],_0xfe9f('0x15c'));}};};Dialer['prototype'][_0xfe9f('0x15d')]=function(_0x224d47){var _0x2984d9=this;return function(){_0x2984d9[_0xfe9f('0x15e')](_0x224d47);};};Dialer['prototype'][_0xfe9f('0x9')]=function(_0xc09a0d){var _0x386c86=this;if(isNotPreview(_0xc09a0d[_0xfe9f('0x5e')])){if(isVoiceQueueOutbound(_0xc09a0d[_0xfe9f('0x59')])&&isActive(_0xc09a0d[_0xfe9f('0x5d')])){_0xc09a0d[_0xfe9f('0xa5')]=!![];BPromise['resolve']()[_0xfe9f('0xbb')](checkIsLoggedIn(_0xc09a0d,_0xc09a0d['loggedIn']))[_0xfe9f('0xbb')](checkIsActive(_0xc09a0d,_0xc09a0d['dialActive']))[_0xfe9f('0xbb')](checkInterval(_0xc09a0d))[_0xfe9f('0xbb')](_0x386c86[_0xfe9f('0x13a')](_0xc09a0d))['then'](_0x386c86[_0xfe9f('0x13f')](_0xc09a0d[_0xfe9f('0x15f')],_0xc09a0d[_0xfe9f('0x160')],_0xc09a0d[_0xfe9f('0x48')],_0xc09a0d))[_0xfe9f('0xbb')](_0x386c86['checkIfTimeIntervals'](_0xc09a0d[_0xfe9f('0x45')],_0xc09a0d[_0xfe9f('0x160')],_0xc09a0d['name'],_0xc09a0d))[_0xfe9f('0xbb')](_0x386c86['checkDialMethod'](_0xc09a0d))[_0xfe9f('0xbc')](loggerCatchQueueSummary(_0xfe9f('0x161'),_0xc09a0d));}else{notSendMessagesQueue(_0xc09a0d);}}else{freeVariablesPredictive(_0xc09a0d);}};Dialer[_0xfe9f('0xb0')][_0xfe9f('0x139')]=function(){var _0x2cf4f4=this;var _0x4a36c5;for(var _0x2fbc9d in this[_0xfe9f('0x20')]){if(typeof this['campaigns'][_0x2fbc9d]!==_0xfe9f('0xb1')){_0x4a36c5=this['campaigns'][_0x2fbc9d];if(isCampaignIvr(_0x4a36c5[_0xfe9f('0x59')])&&isActive(_0x4a36c5[_0xfe9f('0x7a')])){_0x4a36c5[_0xfe9f('0xa5')]=!![];BPromise['resolve']()[_0xfe9f('0xbb')](checkIsActive(_0x4a36c5,_0x4a36c5[_0xfe9f('0x7a')]))[_0xfe9f('0xbb')](checkInterval(_0x4a36c5))[_0xfe9f('0xbb')](_0x2cf4f4['checkIsTrunkReachable'](_0x4a36c5))['then'](_0x2cf4f4[_0xfe9f('0x13f')](_0x4a36c5[_0xfe9f('0x15f')],_0x4a36c5[_0xfe9f('0x160')],_0x4a36c5[_0xfe9f('0x48')],_0x4a36c5))[_0xfe9f('0xbb')](_0x2cf4f4[_0xfe9f('0x162')](_0x4a36c5[_0xfe9f('0x45')],_0x4a36c5[_0xfe9f('0x160')],_0x4a36c5[_0xfe9f('0x48')],_0x4a36c5))[_0xfe9f('0xbb')](_0x2cf4f4['launchHandleIvr'](_0x4a36c5))[_0xfe9f('0xbc')](loggerCatchQueueSummary('[syncCampaigns]',_0x4a36c5));}else{notSendMessagesCampaign(_0x4a36c5);}}}};function getCallerIdRandom(_0x1f9d49,_0x58631e){var _0x17227a;var _0x54dcf3;var _0x2b0c71;if(_0x58631e<=0x0){_0x58631e=0x1;}_0x17227a=new RegExp(_0xfe9f('0x163')+_0x58631e+'}$');_0x54dcf3=Math['pow'](0xa,_0x58631e-0x1);_0x2b0c71=Math['pow'](0xa,_0x58631e)-0x1;return util[_0xfe9f('0x7c')]('%s',_[_0xfe9f('0x164')](_0x1f9d49,_0x17227a,_[_0xfe9f('0x165')](_0x54dcf3,_0x2b0c71)));}function extractCalleridName(_0x368aa9){var _0x4d335b=_0x368aa9[_0xfe9f('0x166')](/"(.*?)"/);return _0x4d335b?_0x4d335b[0x1]:_0x368aa9;}function extractCalleridNumber(_0x30bf9d){var _0x36ea87=_0x30bf9d[_0xfe9f('0x166')](/<(.*?)>/);return _0x36ea87?_0x36ea87[0x1]:_0x30bf9d;}Dialer[_0xfe9f('0xb0')][_0xfe9f('0x167')]=function(_0x2f1205,_0x4b5a42){var _0x57f932=this;var _0x2a28ab=uuid['v4']();this[_0xfe9f('0x25')][_0x2a28ab]=new Action(_0x2f1205,_0x4b5a42,_0x2a28ab);return new BPromise(function(_0x54c712,_0x2d6f18){if(_['isUndefined'](_0x2f1205)&&typeof _0x2f1205!==_0xfe9f('0x168')){return _0x2d6f18(msgResponse('originate','Failure','voiceQueue\x20is\x20undefine'));}if(_[_0xfe9f('0x40')](_0x4b5a42[_0xfe9f('0x169')][_0xfe9f('0x16a')])||_0x4b5a42[_0xfe9f('0x169')][_0xfe9f('0x16a')]===null){return _0x2d6f18(msgResponse(_0xfe9f('0x16b'),_0xfe9f('0x141'),_0xfe9f('0x16c')));}var _0x1bfb9a={'XMD-CALLERID':_0x57f932['actions'][_0x2a28ab]['getCaller'](),'XMD-AGI':_0x2f1205[_0xfe9f('0x109')]?util[_0xfe9f('0x7c')](_0xfe9f('0x16d'),ipAgi,_0x2f1205[_0xfe9f('0x109')]):'NONE','XMD-AGIAFTER':_0x2f1205['dialQueueProject2']?util[_0xfe9f('0x7c')](_0xfe9f('0x16d'),ipAgi,_0x2f1205[_0xfe9f('0x10e')]):_0xfe9f('0x16e'),'XMD-QUEUE':_0x2f1205['type']===_0xfe9f('0x51')?util['format'](_0xfe9f('0x16f'),_0x2f1205[_0xfe9f('0x48')],_0x2f1205[_0xfe9f('0x170')]||'',_0x2f1205[_0xfe9f('0x171')]?'c':'',_0x2f1205[_0xfe9f('0x115')]||0x3):_0xfe9f('0x16e'),'XMD-CONTACTID':_0x4b5a42[_0xfe9f('0xd5')],'XMD-CDRTYPE':_0xfe9f('0x6'),'CALLERID(all)':_0x57f932[_0xfe9f('0x25')][_0x2a28ab][_0xfe9f('0x172')](),'XMD-AMD':_0x2f1205[_0xfe9f('0xe3')]?'ACTIVE':'NONE','XMD-DESTINATION':_0xfe9f('0xe2')};if(_0x2f1205[_0xfe9f('0xe3')]){_0x1bfb9a[_0xfe9f('0x173')]=_0x2f1205[_0xfe9f('0x174')]||0x9c4;_0x1bfb9a[_0xfe9f('0x175')]=_0x2f1205[_0xfe9f('0x176')]||0x5dc;_0x1bfb9a[_0xfe9f('0x177')]=_0x2f1205[_0xfe9f('0x178')]||0x320;_0x1bfb9a['XMD-AMDTOTALANALYSISTIME']=_0x2f1205[_0xfe9f('0x179')]||0x1388;_0x1bfb9a['XMD-AMDMINWORDLENGTH']=_0x2f1205[_0xfe9f('0x17a')]||0x64;_0x1bfb9a[_0xfe9f('0x17b')]=_0x2f1205['dialAMDBetweenWordsSilence']||0x32;_0x1bfb9a[_0xfe9f('0x17c')]=_0x2f1205[_0xfe9f('0x17d')]||0x3;_0x1bfb9a['XMD-AMDSILENCETHRESHOLD']=_0x2f1205[_0xfe9f('0x17e')]||0x100;_0x1bfb9a[_0xfe9f('0x17f')]=_0x2f1205['dialAMDMaximumWordLength']||0x1388;}if(_0x2f1205[_0xfe9f('0x59')]===_0xfe9f('0x51')){_0x1bfb9a[_0xfe9f('0x180')]=_0x4b5a42['VoiceQueueId'];}else{_0x1bfb9a[_0xfe9f('0x181')]=_0x4b5a42[_0xfe9f('0xd8')];}for(var _0x122fe2 in _0x4b5a42[_0xfe9f('0x169')]){if(typeof _0x4b5a42[_0xfe9f('0x169')][_0x122fe2]!==_0xfe9f('0xb1')){if(isNotNull(_0x4b5a42[_0xfe9f('0x169')][_0x122fe2])&&_0x122fe2!=='id'&&_0x122fe2!=='tags'&&_0x122fe2!==_0xfe9f('0x182')&&_0x122fe2!==_0xfe9f('0x183')){_0x1bfb9a[util[_0xfe9f('0x7c')](_0xfe9f('0x184'),_0xfe9f('0x185'),_['toUpper'](_0x122fe2))]=_0x4b5a42[_0xfe9f('0x169')][_0x122fe2];}}}var _0x8237b0=_0x57f932[_0xfe9f('0x13b')](_0x2f1205[_0xfe9f('0x79')])?getCallerId(_0x2f1205[_0xfe9f('0x79')][_0xfe9f('0x186')],_0x2f1205['dialOriginateCallerIdName'],_0x2f1205[_0xfe9f('0x187')]>0x0?getCallerIdRandom(_0x2f1205[_0xfe9f('0x5f')],_0x2f1205[_0xfe9f('0x187')]):_0x2f1205[_0xfe9f('0x5f')]):getCallerId(_[_0xfe9f('0xe0')](_0x2f1205['TrunkBackup'])?_0x2f1205[_0xfe9f('0x79')][_0xfe9f('0x186')]:_0x2f1205[_0xfe9f('0x13c')][_0xfe9f('0x186')],_0x2f1205[_0xfe9f('0x188')],_0x2f1205['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x2f1205[_0xfe9f('0x5f')],_0x2f1205[_0xfe9f('0x187')]):_0x2f1205['dialOriginateCallerIdNumber']);if(_0x8237b0){_0x1bfb9a[_0xfe9f('0x189')]=_0x57f932[_0xfe9f('0x25')][_0x2a28ab][_0xfe9f('0x18a')]=extractCalleridName(_0x8237b0);_0x1bfb9a[_0xfe9f('0x18b')]=_0x57f932[_0xfe9f('0x25')][_0x2a28ab][_0xfe9f('0x18c')]=extractCalleridNumber(_0x8237b0);}return ami[_0xfe9f('0xb2')]({'actionid':_0x2a28ab,'action':'originate','channel':_0x57f932[_0xfe9f('0x13b')](_0x2f1205[_0xfe9f('0x79')])?util[_0xfe9f('0x7c')](_0xfe9f('0x18d'),_0x2f1205[_0xfe9f('0x79')]['name'],isNotNull(_0x2f1205[_0xfe9f('0x18e')])?_0x2f1205[_0xfe9f('0x18e')]['trim']()||'':'',_0x2f1205[_0xfe9f('0x18f')]>0x0?_0x4b5a42[_0xfe9f('0x169')][_0xfe9f('0x16a')]['substring'](_0x2f1205[_0xfe9f('0x18f')]):_0x4b5a42['Contact']['phone']):util[_0xfe9f('0x7c')](_0xfe9f('0x18d'),_[_0xfe9f('0xe0')](_0x2f1205[_0xfe9f('0x13c')])?_0x2f1205[_0xfe9f('0x79')][_0xfe9f('0x48')]:_0x2f1205['TrunkBackup'][_0xfe9f('0x48')],isNotNull(_0x2f1205[_0xfe9f('0x18e')])?_0x2f1205[_0xfe9f('0x18e')][_0xfe9f('0x190')]()||'':'',_0x2f1205[_0xfe9f('0x18f')]>0x0?_0x4b5a42['Contact'][_0xfe9f('0x16a')][_0xfe9f('0x191')](_0x2f1205[_0xfe9f('0x18f')]):_0x4b5a42[_0xfe9f('0x169')][_0xfe9f('0x16a')]),'callerid':_0x8237b0,'Exten':'xcally-motion-dialer','Context':_0xfe9f('0x192'),'Priority':'1','variable':_0x1bfb9a,'timeout':(_0x2f1205[_0xfe9f('0x60')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2a28ab})[_0xfe9f('0xbb')](function(_0x2a40c9){return _0x54c712(_0x2a40c9);})['catch'](function(_0x280283){_0x2f1205[_0xfe9f('0x193')]+=0x1;var _0x43eaf3=new History(_0x57f932['actions'][_0x2a28ab]);logger[_0xfe9f('0x9b')](util[_0xfe9f('0x7c')]('[originateError]:\x20%s',JSON[_0xfe9f('0x7b')](_0x280283)));_0x43eaf3['state']=0xe;_0x43eaf3[_0xfe9f('0xec')]=_0xfe9f('0x194');_0x43eaf3[_0xfe9f('0xac')]=moment()[_0xfe9f('0x7c')](_0xfe9f('0xfe'));_0x43eaf3['endtime']=_0x43eaf3['starttime'];_0x57f932[_0xfe9f('0xcc')](_0x43eaf3)[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0x195')));_0x57f932[_0xfe9f('0xca')](_0x43eaf3)['catch'](loggerCatch(_0xfe9f('0x195')))[_0xfe9f('0x1d')](function(){delete _0x57f932[_0xfe9f('0x25')][_0x2a28ab];return _0x2d6f18(msgResponse('originate','Error',_0xfe9f('0x196')));});});});};Dialer[_0xfe9f('0xb0')][_0xfe9f('0x197')]=function(_0x5404cf){var _0xe3eba1=this['actions'][_0x5404cf[_0xfe9f('0x123')]];if(_0xe3eba1){delete this[_0xfe9f('0x25')][_0x5404cf['actionid']];_0xe3eba1['responsetime']=moment()[_0xfe9f('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5ccc4c=_0xe3eba1[_0xfe9f('0x59')]===_0xfe9f('0x7f')?this[_0xfe9f('0x20')][_0xe3eba1[_0xfe9f('0xb7')]]:this[_0xfe9f('0x1f')][_0xe3eba1[_0xfe9f('0x198')]()];if(!this[_0xfe9f('0xd9')](_0x5404cf[_0xfe9f('0x199')])){this['updateOriginated'](_0x5ccc4c);return this[_0xfe9f('0x19a')](_0xe3eba1,_0x5ccc4c,_0x5404cf)['catch'](loggerCatch(_0xfe9f('0x19b')));}this[_0xfe9f('0x27')][_0x5404cf[_0xfe9f('0xdf')]]=_0xe3eba1;}};Dialer[_0xfe9f('0xb0')]['checkRetriveMax']=function(_0x4d11a8,_0x116727,_0x2f84e6){var _0x202ed8=new History(_0x116727);if(_0x202ed8[_0xfe9f('0xf1')]+_0x202ed8[_0xfe9f('0x103')]+_0x202ed8[_0xfe9f('0xf2')]+_0x202ed8[_0xfe9f('0xf3')]+_0x202ed8['countdropretry']+_0x202ed8[_0xfe9f('0xf4')]+_0x202ed8[_0xfe9f('0xee')]+_0x202ed8[_0xfe9f('0xf5')]>=_0x2f84e6[_0xfe9f('0xf6')]-0x1){return!![];}switch(_0x4d11a8){case 0x3:if(_0x202ed8['countnoanswerretry']>=_0x2f84e6[_0xfe9f('0x19c')]-0x1){return!![];}this[_0xfe9f('0xc5')]({'active':![],'countnoanswerretry':_0x202ed8[_0xfe9f('0xf2')]+=0x1,'scheduledat':moment()['add'](_0x2f84e6[_0xfe9f('0x19d')],_0xfe9f('0xfd'))[_0xfe9f('0x7c')](_0xfe9f('0xfe')),'ContactId':_0x202ed8[_0xfe9f('0xd5')],'ListId':_0x202ed8[_0xfe9f('0xd6')],'VoiceQueueId':_0x202ed8[_0xfe9f('0xd7')]||undefined,'CampaignId':_0x202ed8[_0xfe9f('0xd8')]||undefined})['catch'](loggerCatch(_0xfe9f('0x19e')));break;case 0x5:if(_0x202ed8[_0xfe9f('0xf1')]>=_0x2f84e6[_0xfe9f('0x19f')]-0x1){return!![];}this[_0xfe9f('0xc5')]({'active':![],'countbusyretry':_0x202ed8[_0xfe9f('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x2f84e6[_0xfe9f('0x1a0')],_0xfe9f('0xfd'))['format'](_0xfe9f('0xfe')),'ContactId':_0x202ed8[_0xfe9f('0xd5')],'ListId':_0x202ed8[_0xfe9f('0xd6')],'VoiceQueueId':_0x202ed8['VoiceQueueId']||undefined,'CampaignId':_0x202ed8['CampaignId']||undefined})[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0x1a1')));break;case 0x8:if(_0x202ed8[_0xfe9f('0x103')]>=_0x2f84e6[_0xfe9f('0x1a2')]-0x1){return!![];}this[_0xfe9f('0xc5')]({'active':![],'countcongestionretry':_0x202ed8['countcongestionretry']+=0x1,'scheduledat':moment()[_0xfe9f('0xfb')](_0x2f84e6['dialCongestionRetryFrequency'],_0xfe9f('0xfd'))[_0xfe9f('0x7c')](_0xfe9f('0xfe')),'ContactId':_0x202ed8[_0xfe9f('0xd5')],'ListId':_0x202ed8[_0xfe9f('0xd6')],'VoiceQueueId':_0x202ed8[_0xfe9f('0xd7')]||undefined,'CampaignId':_0x202ed8[_0xfe9f('0xd8')]||undefined})['catch'](loggerCatch(_0xfe9f('0x1a3')));break;case 0x0:if(_0x202ed8['countnosuchnumberretry']>=_0x2f84e6[_0xfe9f('0x1a4')]-0x1){return!![];}else{this[_0xfe9f('0xc5')]({'active':![],'countnosuchnumberretry':_0x202ed8[_0xfe9f('0xf3')]+=0x1,'scheduledat':moment()['add'](_0x2f84e6[_0xfe9f('0x1a5')],_0xfe9f('0xfd'))['format'](_0xfe9f('0xfe')),'ContactId':_0x202ed8[_0xfe9f('0xd5')],'ListId':_0x202ed8[_0xfe9f('0xd6')],'VoiceQueueId':_0x202ed8[_0xfe9f('0xd7')]||undefined,'CampaignId':_0x202ed8['CampaignId']||undefined})[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0x1a6')));}break;case 0xa:if(_0x202ed8[_0xfe9f('0x104')]>=_0x2f84e6[_0xfe9f('0x1a7')]-0x1){return!![];}this[_0xfe9f('0xc5')]({'active':![],'countdropretry':_0x202ed8['countdropretry']+=0x1,'scheduledat':moment()[_0xfe9f('0xfb')](_0x2f84e6[_0xfe9f('0x1a8')],_0xfe9f('0xfd'))['format'](_0xfe9f('0xfe')),'ContactId':_0x202ed8[_0xfe9f('0xd5')],'ListId':_0x202ed8[_0xfe9f('0xd6')],'VoiceQueueId':_0x202ed8[_0xfe9f('0xd7')]||undefined,'CampaignId':_0x202ed8[_0xfe9f('0xd8')]||undefined})[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0x118')));break;case 0xb:if(_0x202ed8[_0xfe9f('0xf4')]>=_0x2f84e6[_0xfe9f('0x121')]-0x1){return!![];}this[_0xfe9f('0xc5')]({'active':![],'countabandonedretry':_0x202ed8['countabandonedretry']+=0x1,'scheduledat':moment()[_0xfe9f('0xfb')](_0x2f84e6[_0xfe9f('0x1a9')],_0xfe9f('0xfd'))['format'](_0xfe9f('0xfe')),'ContactId':_0x202ed8['ContactId'],'ListId':_0x202ed8[_0xfe9f('0xd6')],'VoiceQueueId':_0x202ed8[_0xfe9f('0xd7')]||undefined,'CampaignId':_0x202ed8[_0xfe9f('0xd8')]||undefined})['catch'](loggerCatch(_0xfe9f('0x122')));break;case 0x13:if(_0x202ed8['countmachineretry']>=_0x2f84e6['dialMachineMaxRetry']-0x1){return!![];}this[_0xfe9f('0xc5')]({'active':![],'countmachineretry':_0x202ed8['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0x2f84e6[_0xfe9f('0xfc')],_0xfe9f('0xfd'))[_0xfe9f('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x202ed8[_0xfe9f('0xd5')],'ListId':_0x202ed8[_0xfe9f('0xd6')],'VoiceQueueId':_0x202ed8[_0xfe9f('0xd7')]||undefined,'CampaignId':_0x202ed8[_0xfe9f('0xd8')]||undefined})[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0xff')));break;case 0x14:if(_0x202ed8['countagentrejectretry']>=_0x2f84e6[_0xfe9f('0x1aa')]-0x1){return!![];}this[_0xfe9f('0xc5')]({'active':![],'countagentrejectretry':_0x202ed8[_0xfe9f('0xf5')]+=0x1,'scheduledat':moment()[_0xfe9f('0xfb')](_0x2f84e6[_0xfe9f('0x1ab')],'minutes')[_0xfe9f('0x7c')](_0xfe9f('0xfe')),'ContactId':_0x202ed8[_0xfe9f('0xd5')],'ListId':_0x202ed8[_0xfe9f('0xd6')],'VoiceQueueId':_0x202ed8[_0xfe9f('0xd7')]||undefined,'CampaignId':_0x202ed8[_0xfe9f('0xd8')]||undefined})[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0x1ac')));break;default:return!![];}};Dialer[_0xfe9f('0xb0')][_0xfe9f('0x19a')]=function(_0x5031dc,_0x41ce1b,_0x120423){var _0x4141d0=this;var _0x30ca60=new History(_0x5031dc);return new BPromise(function(_0x1fff43,_0x4235ea){if(_[_0xfe9f('0x40')](_0x41ce1b)&&typeof _0x41ce1b!==_0xfe9f('0x168')){return _0x4235ea(msgResponse(_0xfe9f('0x1ad'),_0xfe9f('0x141'),_0xfe9f('0x1ae')));}if(_['isUndefined'](_0x120423)&&typeof _0x120423!=='object'){return _0x4235ea(msgResponse(_0xfe9f('0x1ad'),_0xfe9f('0x141'),'evt\x20is\x20undefine'));}switch(_0x120423[_0xfe9f('0x1af')]){case'0':_0x41ce1b[_0xfe9f('0x1b0')]+=0x1;_0x30ca60['state']=0x0;_0x30ca60['statedesc']='NoSuchNumber';_0x30ca60[_0xfe9f('0xf3')]+=0x1;_0x30ca60[_0xfe9f('0x102')]+=0x1;ami[_0xfe9f('0x50')](_0xfe9f('0x1b1'),ut[_0xfe9f('0x1b2')](_0x5031dc,_0xfe9f('0x1b3')));_0x4141d0[_0xfe9f('0xcc')](_0x30ca60)[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0xf0')));if(_0x4141d0['checkRetriveMax'](0x0,_0x5031dc,_0x41ce1b)){if(_0x30ca60[_0xfe9f('0xf3')]>=_0x41ce1b[_0xfe9f('0x1a4')]){_0x4141d0['createStateFinal'](_0x30ca60,_0x1fff43,_0x4235ea,'reason\x200\x20no\x20such\x20number....');}else{_0x4141d0[_0xfe9f('0xf7')](_0x30ca60,_0x1fff43,_0x4235ea,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x41ce1b[_0xfe9f('0x67')]+=0x1;_0x30ca60['state']=0x3;_0x30ca60['statedesc']=_0xfe9f('0x1b4');_0x30ca60[_0xfe9f('0xf2')]+=0x1;_0x30ca60['countglobal']+=0x1;ami['emit'](_0xfe9f('0x1b5'),ut[_0xfe9f('0x1b2')](_0x5031dc,_0xfe9f('0x1b6')));_0x4141d0[_0xfe9f('0xcc')](_0x30ca60)[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0x1b7')));if(_0x4141d0[_0xfe9f('0x1b8')](0x3,_0x5031dc,_0x41ce1b)){if(_0x30ca60[_0xfe9f('0xf2')]>=_0x41ce1b[_0xfe9f('0x19c')]){_0x4141d0['createStateFinal'](_0x30ca60,_0x1fff43,_0x4235ea,_0xfe9f('0x1b9'));}else{_0x4141d0['stateGlobal'](_0x30ca60,_0x1fff43,_0x4235ea,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x41ce1b[_0xfe9f('0x63')]+=0x1;_0x30ca60[_0xfe9f('0xab')]=0x5;_0x30ca60[_0xfe9f('0xec')]=_0xfe9f('0x1ba');_0x30ca60[_0xfe9f('0xf1')]+=0x1;_0x30ca60['countglobal']+=0x1;ami[_0xfe9f('0x50')](_0xfe9f('0x1bb'),ut[_0xfe9f('0x1b2')](_0x5031dc,_0xfe9f('0x1bc')));_0x4141d0[_0xfe9f('0xcc')](_0x30ca60)['catch'](loggerCatch(_0xfe9f('0x1bd')));if(_0x4141d0[_0xfe9f('0x1b8')](0x5,_0x5031dc,_0x41ce1b)){if(_0x30ca60[_0xfe9f('0xf1')]>=_0x41ce1b[_0xfe9f('0x19f')]){_0x4141d0[_0xfe9f('0xfa')](_0x30ca60,_0x1fff43,_0x4235ea,_0xfe9f('0x1be'));}else{_0x4141d0[_0xfe9f('0xf7')](_0x30ca60,_0x1fff43,_0x4235ea,_0xfe9f('0x1be'));}}break;case'8':_0x41ce1b['outboundCongestionCallsDay']+=0x1;_0x30ca60[_0xfe9f('0xab')]=0x8;_0x30ca60['statedesc']=_0xfe9f('0x1bf');_0x30ca60[_0xfe9f('0x103')]+=0x1;_0x30ca60[_0xfe9f('0x102')]+=0x1;ami[_0xfe9f('0x50')](_0xfe9f('0x1c0'),ut[_0xfe9f('0x1b2')](_0x5031dc,_0xfe9f('0x1c1')));_0x4141d0[_0xfe9f('0xcc')](_0x30ca60)['catch'](loggerCatch(_0xfe9f('0x1c2')));if(_0x4141d0[_0xfe9f('0x1b8')](0x8,_0x5031dc,_0x41ce1b)){if(_0x30ca60[_0xfe9f('0x103')]>=_0x41ce1b['dialCongestionMaxRetry']){_0x4141d0[_0xfe9f('0xfa')](_0x30ca60,_0x1fff43,_0x4235ea,_0xfe9f('0x1c3'));}else{_0x4141d0[_0xfe9f('0xf7')](_0x30ca60,_0x1fff43,_0x4235ea,_0xfe9f('0x1c3'));}}break;case'11':_0x41ce1b[_0xfe9f('0x1c4')]+=0x1;_0x30ca60['state']=0xb;_0x30ca60['statedesc']=_0xfe9f('0x11f');_0x30ca60[_0xfe9f('0xf4')]+=0x1;_0x30ca60[_0xfe9f('0x102')]+=0x1;_0x4141d0['createHistory'](_0x30ca60)[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0x1c5')));if(_0x4141d0[_0xfe9f('0x1b8')](0xb,_0x5031dc,_0x41ce1b)){if(_0x30ca60[_0xfe9f('0xf4')]>=_0x41ce1b[_0xfe9f('0x121')]){_0x4141d0[_0xfe9f('0xfa')](_0x30ca60,_0x1fff43,_0x4235ea,_0xfe9f('0x1c6'));}else{_0x4141d0['stateGlobal'](_0x30ca60,_0x1fff43,_0x4235ea,_0xfe9f('0x1c6'));}}break;case'20':_0x41ce1b[_0xfe9f('0x69')]+=0x1;_0x30ca60[_0xfe9f('0xab')]=0x14;_0x30ca60[_0xfe9f('0xec')]=_0xfe9f('0x1c7');_0x30ca60[_0xfe9f('0xf5')]+=0x1;_0x30ca60['countglobal']+=0x1;ami[_0xfe9f('0x50')](_0xfe9f('0x1c8'),ut['buildObj'](_0x5031dc,_0xfe9f('0x1c9')));_0x4141d0[_0xfe9f('0xcc')](_0x30ca60)[_0xfe9f('0xbc')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x4141d0['checkRetriveMax'](0x14,_0x5031dc,_0x41ce1b)){if(_0x30ca60[_0xfe9f('0xf5')]>=_0x41ce1b['dialAgentRejectMaxRetry']){_0x4141d0['createStateFinal'](_0x30ca60,_0x1fff43,_0x4235ea,'reason\x2020\x20agentreject');}else{_0x4141d0[_0xfe9f('0xf7')](_0x30ca60,_0x1fff43,_0x4235ea,_0xfe9f('0x1ca'));}}break;default:_0x41ce1b[_0xfe9f('0x6a')]+=0x1;_0x30ca60[_0xfe9f('0xab')]=0xc;_0x30ca60[_0xfe9f('0xec')]=_0x120423[_0xfe9f('0x1af')];_0x4141d0[_0xfe9f('0xcc')](_0x30ca60)[_0xfe9f('0xbc')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x4141d0[_0xfe9f('0x1b8')](_0x120423[_0xfe9f('0x1af')],_0x5031dc,_0x41ce1b)){if(_0x30ca60[_0xfe9f('0xf1')]+_0x30ca60[_0xfe9f('0x103')]+_0x30ca60[_0xfe9f('0xf2')]+_0x30ca60[_0xfe9f('0xf3')]+_0x30ca60[_0xfe9f('0x104')]+_0x30ca60[_0xfe9f('0xf4')]+_0x30ca60['countmachineretry']+_0x30ca60['countagentrejectretry']>=_0x41ce1b[_0xfe9f('0xf6')]){_0x4141d0[_0xfe9f('0xf7')](_0x30ca60,_0x1fff43,_0x4235ea,_0x120423['reason']);}else{_0x4141d0[_0xfe9f('0xfa')](_0x30ca60,_0x1fff43,_0x4235ea,_0x120423[_0xfe9f('0x1af')]);}}}});};Dialer[_0xfe9f('0xb0')][_0xfe9f('0xf7')]=function(_0x59e266,_0x2ea6df,_0x1f2a5c,_0x96eb9a){var _0x4b5d2b=new Final(_0x59e266);_0x4b5d2b[_0xfe9f('0xab')]=0xf;_0x4b5d2b[_0xfe9f('0xec')]='Global';this[_0xfe9f('0xfa')](_0x4b5d2b,_0x2ea6df,_0x1f2a5c,_0x96eb9a);};Dialer[_0xfe9f('0xb0')][_0xfe9f('0xfa')]=function(_0x1eece3,_0x387692,_0x23fbd0,_0x309cd6){this['moveContactManagedDialer'](_0x1eece3)['then'](function(){return _0x387692(msgResponse(_0xfe9f('0x1ad'),_0xfe9f('0xda'),_0x309cd6));})[_0xfe9f('0xbc')](function(){return _0x23fbd0(msgResponse(_0xfe9f('0x1cb'),_0xfe9f('0x141'),_0xfe9f('0x1cc')));});};Dialer[_0xfe9f('0xb0')][_0xfe9f('0x8')]=function(_0x2e896a){var _0x25678f=_0x2e896a['dialPredictiveOptimizationPercentage']/0x64;var _0x41d382=_0x2e896a[_0xfe9f('0x66')]/(_0x2e896a[_0xfe9f('0x66')]+_0x2e896a[_0xfe9f('0x62')]);var _0x371d63=Math[_0xfe9f('0x1cd')](_0x2e896a['predictiveIntervalAvailable']*(_0x2e896a[_0xfe9f('0x1ce')]/0x64));var _0x125607=Math[_0xfe9f('0x1cd')](_0x2e896a[_0xfe9f('0x74')]*(_0x2e896a[_0xfe9f('0x1cf')]/0x64));var _0x136bf5=_0x2e896a['available']+_0x2e896a[_0xfe9f('0x57')];var _0x1e229d=Math[_0xfe9f('0x1d0')](_0x2e896a[_0xfe9f('0x77')]*_0x2e896a[_0xfe9f('0x91')]*_0x2e896a[_0xfe9f('0x71')]*_0x2e896a['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x2e896a[_0xfe9f('0x2a')])){if(!_['isUndefined'](_0x2e896a['startPredictive'])){_0x2e896a[_0xfe9f('0x29')]=undefined;loggerPredictive[_0xfe9f('0x9b')](_0xfe9f('0x1d1'),_0xfe9f('0x1d2'));}if(!_[_0xfe9f('0x40')](_0x2e896a[_0xfe9f('0x95')])){loggerPredictive[_0xfe9f('0x9b')](_0xfe9f('0x1d1'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x2e896a['handlePredictive']);_0x2e896a['handlePredictive']=undefined;}_0x2e896a[_0xfe9f('0x2a')]=moment()[_0xfe9f('0x7c')](_0xfe9f('0xfe'));loggerPredictive[_0xfe9f('0x82')](_0x2e896a[_0xfe9f('0x48')],_0xfe9f('0x1d3'),_0x2e896a['startProgressive']);this['handlePower'](_0x2e896a,0x1);}else if(ifInterval(_0x2e896a[_0xfe9f('0x1d4')],_0x2e896a[_0xfe9f('0x2a')])){this[_0xfe9f('0x158')](_0x2e896a,0x1);loggerPredictiveCalls['info'](_0xfe9f('0x1d5'),_0x2e896a[_0xfe9f('0x2a')],_0x2e896a[_0xfe9f('0x48')]);_0x2e896a[_0xfe9f('0x77')]=0x0;_0x2e896a[_0xfe9f('0x70')]=0x0;}else if(_0x25678f<_0x41d382&&_0x2e896a[_0xfe9f('0x1d6')]===_0xfe9f('0x1d7')){freeVariablesPredictive(_0x2e896a);loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x1d8'),_0xfe9f('0x1d9'),_0x41d382,_0xfe9f('0x2a'),_0x2e896a[_0xfe9f('0x48')]);}else if(_0x1e229d<_0x2e896a[_0xfe9f('0x70')]&&_0x2e896a[_0xfe9f('0x1d6')]==='dropRate'){freeVariablesPredictive(_0x2e896a);loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x1da'),_0xfe9f('0x1db'),_0x1e229d,_0xfe9f('0x1dc'),_0x2e896a[_0xfe9f('0x70')],_0xfe9f('0x2a'),_0x2e896a[_0xfe9f('0x48')]);}else if(!ifInterval(_0x2e896a[_0xfe9f('0x1d4')],_0x2e896a[_0xfe9f('0x2a')])&&_[_0xfe9f('0x40')](_0x2e896a[_0xfe9f('0x29')])&&!_['isUndefined'](_0x2e896a[_0xfe9f('0x2a')])){_0x2e896a[_0xfe9f('0x29')]=moment()[_0xfe9f('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xfe9f('0x82')](_0x2e896a['name'],_0xfe9f('0x1dd'),_0x2e896a[_0xfe9f('0x29')]);this[_0xfe9f('0xc1')](_0x2e896a[_0xfe9f('0x1d4')])[_0xfe9f('0xbb')](this['getDataPredictive'](_0x2e896a))[_0xfe9f('0xbb')](mergeDataErlangB(_0x2e896a))[_0xfe9f('0xbb')](this[_0xfe9f('0x1de')](_0x2e896a))[_0xfe9f('0xbc')](loggerCatchPredictive(_0xfe9f('0x1df'),_0x2e896a));}else if(!ifInterval(_0x2e896a['dialPredictiveInterval'],_0x2e896a[_0xfe9f('0x29')])){_0x2e896a[_0xfe9f('0x70')]=0x0;_0x2e896a[_0xfe9f('0x29')]=moment()[_0xfe9f('0x7c')](_0xfe9f('0xfe'));loggerPredictive[_0xfe9f('0x82')](_0x2e896a[_0xfe9f('0x48')],_0xfe9f('0x1e0'),_0x2e896a['startPredictive']);clearInterval(_0x2e896a[_0xfe9f('0x95')]);_0x2e896a[_0xfe9f('0x95')]=undefined;this[_0xfe9f('0xc1')](_0x2e896a['dialPredictiveInterval'])[_0xfe9f('0xbb')](this[_0xfe9f('0x1e1')](_0x2e896a))[_0xfe9f('0xbb')](mergeDataErlangB(_0x2e896a))[_0xfe9f('0xbb')](this[_0xfe9f('0x1de')](_0x2e896a))[_0xfe9f('0xbc')](loggerCatchPredictive(_0xfe9f('0x1e2'),_0x2e896a));}else if(_0x2e896a['predictiveIntervalAvailable']&&_0x136bf5<_0x2e896a[_0xfe9f('0x74')]-_0x125607){freeVariablesPredictive(_0x2e896a);loggerPredictive[_0xfe9f('0x82')](_0x2e896a['name'],_0xfe9f('0x1e3'),_0x136bf5,')\x20are\x20less\x20than\x20threshold\x20(',_0x2e896a['predictiveIntervalAvailable'],'-',_0x125607,'=',_0x2e896a[_0xfe9f('0x74')]-_0x125607,')');}else if(_0x2e896a[_0xfe9f('0x74')]&&_0x136bf5>_0x2e896a[_0xfe9f('0x74')]+_0x371d63){freeVariablesPredictive(_0x2e896a);loggerPredictive[_0xfe9f('0x82')](_0x2e896a['name'],_0xfe9f('0x1e3'),_0x136bf5,_0xfe9f('0x1e4'),_0x2e896a[_0xfe9f('0x74')],'+',_0x371d63,'=',_0x2e896a[_0xfe9f('0x74')]+_0x371d63,')');}};Dialer['prototype'][_0xfe9f('0x1e1')]=function(_0x2840a3){var _0xc971e1=this;return function(_0x14535c){return new BPromise(function(_0x53c093,_0x476c37){_[_0xfe9f('0xd4')](_0x2840a3,_0x14535c[0x0]);if(checkGetDataPredictive(_0x14535c[0x0])){var _0x178e30=_0x2840a3[_0xfe9f('0x74')]=_0x2840a3[_0xfe9f('0x57')]+_0x2840a3[_0xfe9f('0x1e5')];var _0x4f5d8b=_0x2840a3[_0xfe9f('0x1d4')]*0x3c;var _0x18b28d=_0x14535c[0x0][_0xfe9f('0x6d')]+_0x14535c[0x0][_0xfe9f('0x6c')];var _0x165108=(_0x14535c[0x0][_0xfe9f('0x6b')]+_0x14535c[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x14535c[0x0][_0xfe9f('0x6e')])/_0x14535c[0x0]['predictiveIntervalTotalCalls'];_0x2840a3[_0xfe9f('0x71')]=_0x165108>0x0?_0x165108:0x1;switch(_0x2840a3[_0xfe9f('0x1d6')]){case'dropRate':var _0x59bed6=_0x2840a3[_0xfe9f('0x1e6')]/0x64;return _0xc971e1['abandonmentRate'](_0x178e30,_0x4f5d8b,_0x18b28d,_0x165108,_0x59bed6)[_0xfe9f('0xbb')](function(_0x46914c){return _0x53c093(_0x46914c);});case _0xfe9f('0x1e7'):var _0x4ae56b=_0x2840a3['dialPredictiveOptimizationPercentage']/0x64;return _0xc971e1[_0xfe9f('0x1e8')](_0x178e30,_0x4f5d8b,_0x18b28d,_0x165108,_0x4ae56b)[_0xfe9f('0xbb')](function(_0x1435a5){return _0x53c093(_0x1435a5);});default:return _0x476c37(msgResponse(_0xfe9f('0x1e9'),'Failure',_0xfe9f('0x1ea')));}}else{return _0x476c37(msgResponse(_0xfe9f('0x1e9'),'Failure',_0xfe9f('0x1eb')));}});};};Dialer['prototype'][_0xfe9f('0x1ec')]=function(_0x567479){var _0x1bac07=this;return function(_0x2e5eab){return new BPromise(function(_0x2b3314,_0x1b57be){_['merge'](_0x567479,_0x2e5eab[0x0]);if(checkGetDataPredictive(_0x2e5eab[0x0])){loggerPredictive['info'](JSON['stringify'](_0x2e5eab[0x0]));if(_0x567479[_0xfe9f('0x1d6')]===_0xfe9f('0x1d7')){return _0x1bac07[_0xfe9f('0xc9')](_0x567479['id'])['then'](function(_0x140545){var _0x31b6f3=_0x567479[_0xfe9f('0x53')]-_0x140545[0x0][_0xfe9f('0x1ed')];var _0x2452a2=_0x567479['dialPredictiveInterval']*0x3c;var _0x529cb2=_0x2e5eab[0x0][_0xfe9f('0x6d')]+_0x2e5eab[0x0]['predictiveIntervalAvgHoldtime'];var _0xfa0a2d=(_0x2e5eab[0x0][_0xfe9f('0x6b')]+_0x2e5eab[0x0][_0xfe9f('0x116')]+_0x2e5eab[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2e5eab[0x0][_0xfe9f('0x75')];var _0x373916=_0x567479[_0xfe9f('0x1e6')]/0x64;_0x567479['predictiveIntervalPauses']=_0x140545[0x0]['outboundQueuePauses']||0x0;_0x567479['predictiveIntervalHitRate']=_0xfa0a2d>0x0?_0xfa0a2d:0x1;return _0x1bac07['abandonmentRate'](_0x31b6f3,_0x2452a2,_0x529cb2,_0xfa0a2d,_0x373916);})['then'](function(_0x2799c8){return _0x2b3314(_0x2799c8);})[_0xfe9f('0xbc')](function(_0x243ddf){return _0x1b57be(msgResponse('[CatchErlangB]',_0xfe9f('0x141'),JSON[_0xfe9f('0x7b')](_0x243ddf)));});}if(_0x567479['dialPredictiveOptimization']===_0xfe9f('0x1e7')){return _0x1bac07[_0xfe9f('0xc9')](_0x567479['id'])['then'](function(_0x2e4bbd){var _0x409bfd=_0x567479[_0xfe9f('0x53')]-_0x2e4bbd[0x0][_0xfe9f('0x1ed')];var _0x29ba6c=_0x567479[_0xfe9f('0x1d4')]*0x3c;var _0xebd6da=_0x2e5eab[0x0][_0xfe9f('0x6d')]+_0x2e5eab[0x0][_0xfe9f('0x6c')];var _0xd51f62=(_0x2e5eab[0x0][_0xfe9f('0x6b')]+_0x2e5eab[0x0][_0xfe9f('0x116')]+_0x2e5eab[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2e5eab[0x0][_0xfe9f('0x75')];var _0x158737=_0x567479[_0xfe9f('0x1e6')]/0x64;_0x567479[_0xfe9f('0x73')]=_0x2e4bbd[0x0][_0xfe9f('0x1ed')]||0x0;_0x567479['predictiveIntervalHitRate']=_0xd51f62>0x0?_0xd51f62:0x1;return _0x1bac07[_0xfe9f('0x1e8')](_0x409bfd,_0x29ba6c,_0xebd6da,_0xd51f62,_0x158737);})['then'](function(_0x407bed){return _0x2b3314(_0x407bed);})[_0xfe9f('0xbc')](function(_0x115352){return _0x1b57be(msgResponse(_0xfe9f('0x1ee'),_0xfe9f('0x141'),JSON['stringify'](_0x115352)));});}}else{return _0x1b57be(msgResponse(_0xfe9f('0x1e9'),_0xfe9f('0x141'),_0xfe9f('0x1eb')));}});};};Dialer[_0xfe9f('0xb0')]['startMethodPredictive']=function(_0x466a9c){var _0x38ae1f=this;return function(){var _0x189184=0x0;var _0x59957d=Math[_0xfe9f('0x1d0')](_0x466a9c['erlangCallToSecond']*0x3e8);if(_0x59957d>0x0){_0x59957d=_0x59957d<0x64?0x64:_0x59957d;loggerPredictive['info'](_0x466a9c['name'],_0xfe9f('0x1ef'),_0x59957d,_0xfe9f('0x4e'));_0x466a9c[_0xfe9f('0x95')]=setInterval(function(){_0x38ae1f[_0xfe9f('0x95')](_0x466a9c);loggerPredictiveCalls[_0xfe9f('0x82')](_0xfe9f('0x1f0'),_0x189184+=0x1);},_0x59957d);}else{loggerPredictive[_0xfe9f('0x82')](_0x466a9c[_0xfe9f('0x48')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0xfe9f('0x1f1')]=function(_0x5d10a8,_0x48dee5){var _0x510fed=this;return function(_0x191bf5){if(_['isEmpty'](_0x191bf5)){if(_[_0xfe9f('0xe0')](_0x48dee5['UserId'])||!_0x48dee5['recallme']){if(_0x5d10a8[_0xfe9f('0x5e')]==='booked'){_0x5d10a8[_0xfe9f('0x12c')]=_[_0xfe9f('0x40')](_0x5d10a8[_0xfe9f('0x12c')])?!![]:_0x5d10a8['queueStatusComplete'];var _0x4f170e=uuid['v4']();_0x510fed[_0xfe9f('0x25')][_0x4f170e]=new Action(_0x5d10a8,_0x48dee5,_0x4f170e);loggerBooked['info']('[booked][checkContactBlack]',_0x4f170e,'queueStatusComplete:\x20',JSON['stringify'](_0x5d10a8[_0xfe9f('0x12c')]),_0xfe9f('0x1f2'),_0x5d10a8['name']);if(_0x5d10a8[_0xfe9f('0x12c')]){_0x5d10a8[_0xfe9f('0x12c')]=![];_0x510fed[_0xfe9f('0x2c')][_0x510fed[_0xfe9f('0x25')][_0x4f170e][_0xfe9f('0xb7')]]=[];ami[_0xfe9f('0xb2')]({'actionid':_0x4f170e,'action':_0xfe9f('0x1f3'),'queue':_0x5d10a8['name']})[_0xfe9f('0xbc')](function(){_0x510fed['updateOriginated'](_0x5d10a8);_0x510fed[_0xfe9f('0xc5')]({'active':![],'ContactId':_0x510fed[_0xfe9f('0x25')][_0x4f170e][_0xfe9f('0xd5')],'ListId':_0x510fed['actions'][_0x4f170e][_0xfe9f('0xd6')],'VoiceQueueId':_0x510fed['actions'][_0x4f170e][_0xfe9f('0xd7')]||undefined,'CampaignId':_0x510fed['actions'][_0x4f170e][_0xfe9f('0xd8')]||undefined})[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0x1f4')));delete _0x510fed['actions'][_0x4f170e];});}else{loggerBooked[_0xfe9f('0x82')](_0xfe9f('0x1f5'),JSON[_0xfe9f('0x7b')](_0x5d10a8['queueStatusComplete']),'Queue:\x20',_0x5d10a8[_0xfe9f('0x48')]);_0x510fed[_0xfe9f('0xb6')](_0x5d10a8);_0x510fed[_0xfe9f('0xc5')]({'active':![],'ContactId':_0x510fed[_0xfe9f('0x25')][_0x4f170e][_0xfe9f('0xd5')],'ListId':_0x510fed['actions'][_0x4f170e][_0xfe9f('0xd6')],'VoiceQueueId':_0x510fed['actions'][_0x4f170e][_0xfe9f('0xd7')]||undefined,'CampaignId':_0x510fed[_0xfe9f('0x25')][_0x4f170e]['CampaignId']||undefined})[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0x1f4')));delete _0x510fed[_0xfe9f('0x25')][_0x4f170e];}}else{return _0x510fed[_0xfe9f('0x167')](_0x5d10a8,_0x48dee5);}}else{if(getDiff(_0x48dee5[_0xfe9f('0x1f6')])<_0x5d10a8[_0xfe9f('0x1f7')]*0x3c){if(_0x48dee5[_0xfe9f('0x1f8')]&&!_0x48dee5[_0xfe9f('0x1f8')][_0xfe9f('0x1f9')]){_0x510fed['preview'][_0xfe9f('0x12d')](_0x48dee5['id'])[_0xfe9f('0x1d')](function(){_0x510fed[_0xfe9f('0xb6')](_0x5d10a8);});}else{_0x510fed['unlockContact']({'active':![]},_0x48dee5['id'],0x1)[_0xfe9f('0x1d')](function(){_0x510fed[_0xfe9f('0xb6')](_0x5d10a8);});}}else{_0x5d10a8[_0xfe9f('0x68')]+=0x1;_0x510fed[_0xfe9f('0xb6')](_0x5d10a8);if(_0x5d10a8[_0xfe9f('0x1fa')]){_0x510fed[_0xfe9f('0xc5')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x48dee5[_0xfe9f('0xd5')],'ListId':_0x48dee5[_0xfe9f('0xd6')],'VoiceQueueId':_0x48dee5[_0xfe9f('0xd7')]||undefined,'CampaignId':_0x48dee5[_0xfe9f('0xd8')]||undefined})['catch'](loggerCatch(_0xfe9f('0x1fb')));_0x510fed[_0xfe9f('0xcc')](createObjHistory(_0x5d10a8,_0x48dee5,_0xfe9f('0x1fc'),0x17,_0xfe9f('0x1fd')))['catch'](loggerCatch(_0xfe9f('0x1fe')));}else{_0x510fed[_0xfe9f('0xd3')](createObjHistory(_0x5d10a8,_0x48dee5,_0xfe9f('0x1ff'),0x16,_0xfe9f('0x200')),_0xfe9f('0x201'),'[Originate][HistoryRecallClose]');}}}}else{_0x5d10a8[_0xfe9f('0x202')]+=0x1;_0x510fed[_0xfe9f('0xd3')](createObjHistory(_0x5d10a8,_0x48dee5,'BLACKLIST',0xd,_0xfe9f('0x203')),_0xfe9f('0x204'),_0xfe9f('0x205'));throw _0xfe9f('0x206');}};};Dialer['prototype']['handleIvr']=function(_0x5ee393){var _0x3aedba=this;var _0x5cef83=_0x5ee393[_0xfe9f('0x207')]-_0x5ee393[_0xfe9f('0x76')]-_0x5ee393[_0xfe9f('0x208')];emitCampaignSummary(_0x5ee393);if(_0x5cef83>0x0){if(_0x5cef83>this[_0xfe9f('0x23')]){_0x5cef83=this['maxNumberOriginate'];}_0x5ee393[_0xfe9f('0x208')]+=_0x5cef83;this[_0xfe9f('0xc8')](_0x5ee393['id'],_0x5cef83,_0x5ee393[_0xfe9f('0x209')])[_0xfe9f('0xbb')](function(_0x474acd){_0x5ee393[_0xfe9f('0x208')]-=_0x5cef83;_0x5ee393['temp']=_0x5ee393[_0xfe9f('0x208')]>0x0?_0x5ee393[_0xfe9f('0x208')]:0x0;if(!checkContactEmpty(_0x474acd)){_0x5ee393['message']=_0xfe9f('0xa3');logger[_0xfe9f('0x82')]('[getContactCampaign2][Empty]'+_0x5ee393[_0xfe9f('0x48')]);}else{_0x5ee393[_0xfe9f('0x76')]+=_0x474acd[_0xfe9f('0x9d')];_0x5ee393['message']='RUNNING';for(var _0x4efae8=0x0;_0x4efae8<_0x474acd[_0xfe9f('0x9d')];_0x4efae8+=0x1){_0x5ee393['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x474acd[_0x4efae8])||_[_0xfe9f('0xe0')](_0x474acd[_0x4efae8][_0xfe9f('0x169')])||_['isNil'](_0x474acd[_0x4efae8][_0xfe9f('0x169')][_0xfe9f('0x16a')])){_0x3aedba['emptyContact'](_0xfe9f('0x20a'),_0x5ee393,_0x474acd[_0x4efae8]);}else{_0x3aedba[_0xfe9f('0xc0')](_['pick'](_0x474acd[_0x4efae8],[_0xfe9f('0xd8'),'Contact.phone']))[_0xfe9f('0xbb')](_0x3aedba[_0xfe9f('0x1f1')](_0x5ee393,_0x474acd[_0x4efae8]))[_0xfe9f('0xbc')](_0x3aedba[_0xfe9f('0xd0')](_0xfe9f('0x20b'),_0x5ee393));}}}})[_0xfe9f('0xbc')](loggerGetContactDialer(_0xfe9f('0x20c'),_0x5ee393,_0x5cef83));}};Dialer[_0xfe9f('0xb0')][_0xfe9f('0x158')]=function(_0xdb9fa7,_0x20dc21){var _0x2183c0=this;var _0x294215=[];var _0x2ce8f6=_0x20dc21>=0x1?_0x20dc21:0x1;if(_0xdb9fa7[_0xfe9f('0x5e')]===_0xfe9f('0x7')){_0x2ce8f6=0x1;}var _0x1a44d1=Math[_0xfe9f('0x1d0')](_0xdb9fa7['available']*_0x2ce8f6)-_0xdb9fa7[_0xfe9f('0x76')]-_0xdb9fa7[_0xfe9f('0x208')];emitVoiceQueueSummary(_0xdb9fa7);if(_0xdb9fa7[_0xfe9f('0x20d')]>0x0){var _0x402c8c=_0xdb9fa7[_0xfe9f('0x20d')]-_0xdb9fa7[_0xfe9f('0x76')]-_0xdb9fa7[_0xfe9f('0x57')]-_0xdb9fa7[_0xfe9f('0x208')]-_0xdb9fa7[_0xfe9f('0x20e')];if(_0x1a44d1>_0x402c8c){_0x1a44d1=_0x402c8c;}}if(_0x1a44d1>0x0){if(_0xdb9fa7[_0xfe9f('0x5e')]==='booked'){_0x1a44d1=0x1;}if(_0x1a44d1>this['maxNumberOriginate']){_0x1a44d1=this[_0xfe9f('0x23')];}_0xdb9fa7[_0xfe9f('0x208')]+=_0x1a44d1;for(var _0x208c68 in this[_0xfe9f('0x21')]){if(typeof this[_0xfe9f('0x21')][_0x208c68]!==_0xfe9f('0xb1')){if(this[_0xfe9f('0x21')][_0x208c68]['state']==='not_inuse'&&this[_0xfe9f('0x21')][_0x208c68]['status']===_0xfe9f('0xdc')){_0x294215[_0xfe9f('0x14d')](this[_0xfe9f('0x21')][_0x208c68]['id']);}}}this['getContactDialer'](_0xdb9fa7['id'],_0x294215,_0x1a44d1,_0xdb9fa7['dialOrderByScheduledAt'])['then'](function(_0x3516ba){_0xdb9fa7[_0xfe9f('0x208')]-=_0x1a44d1;_0xdb9fa7['temp']=_0xdb9fa7[_0xfe9f('0x208')]>0x0?_0xdb9fa7[_0xfe9f('0x208')]:0x0;if(!checkContactEmpty(_0x3516ba)){_0x2183c0['countReScheduled'](_0xdb9fa7)['then'](sendMessageReschedule(_0xdb9fa7))[_0xfe9f('0xbc')](loggerCatch(_0xfe9f('0xbd')));}else{_0xdb9fa7['originated']+=_0x3516ba[_0xfe9f('0x9d')];_0xdb9fa7[_0xfe9f('0x46')]=_0xdb9fa7[_0xfe9f('0x5e')]===_0xfe9f('0x7')?_0xfe9f('0x20f'):_0xfe9f('0x210');for(var _0x14f40f=0x0;_0x14f40f<_0x3516ba[_0xfe9f('0x9d')];_0x14f40f+=0x1){if(_[_0xfe9f('0xe0')](_0x3516ba[_0x14f40f])||_[_0xfe9f('0xe0')](_0x3516ba[_0x14f40f][_0xfe9f('0x169')])||_[_0xfe9f('0xe0')](_0x3516ba[_0x14f40f][_0xfe9f('0x169')][_0xfe9f('0x16a')])){_0x2183c0[_0xfe9f('0xd1')]('[actionOriginate]\x20',_0xdb9fa7,_0x3516ba[_0x14f40f]);}else{_0x2183c0['checkIsBlackList'](_[_0xfe9f('0x12b')](_0x3516ba[_0x14f40f],[_0xfe9f('0xd7'),_0xfe9f('0x211')]))['then'](_0x2183c0[_0xfe9f('0x1f1')](_0xdb9fa7,_0x3516ba[_0x14f40f]))['catch'](_0x2183c0[_0xfe9f('0xd0')](_0xfe9f('0x20a'),_0xdb9fa7));}}}})[_0xfe9f('0xbc')](loggerGetContactDialer(_0xfe9f('0x212'),_0xdb9fa7,_0x1a44d1));}};Dialer[_0xfe9f('0xb0')][_0xfe9f('0x95')]=function(_0x41f628){if(_0x41f628[_0xfe9f('0x20d')]>0x0){var _0x4ef183=_0x41f628['dialLimitQueue']-_0x41f628[_0xfe9f('0x76')]-_0x41f628[_0xfe9f('0x57')];if(_0x4ef183>0x0){this[_0xfe9f('0x213')](_0x41f628);}else{loggerPredictiveCalls[_0xfe9f('0x82')](_0xfe9f('0x214'));}}else{this[_0xfe9f('0x213')](_0x41f628);}};Dialer[_0xfe9f('0xb0')]['tryOriginatePredictive']=function(_0x4cb4ca){var _0x246c9f=this;var _0x43f213=[];_0x4cb4ca[_0xfe9f('0x76')]+=0x1;for(var _0x2453e7 in this[_0xfe9f('0x21')]){if(typeof this['agents'][_0x2453e7]!==_0xfe9f('0xb1')){if(this[_0xfe9f('0x21')][_0x2453e7]['state']===_0xfe9f('0x215')&&this[_0xfe9f('0x21')][_0x2453e7]['status']==='reachable'){_0x43f213[_0xfe9f('0x14d')](this[_0xfe9f('0x21')][_0x2453e7]['id']);}}}this[_0xfe9f('0xc6')](_0x4cb4ca['id'],_0x43f213,0x1,_0x4cb4ca[_0xfe9f('0x209')])[_0xfe9f('0xbb')](function(_0x4cb250){if(!checkContactEmpty(_0x4cb250)){checkContactLowerLimitOriginate(_0x4cb4ca,0x1,0x0);_0x246c9f[_0xfe9f('0xba')](_0x4cb4ca)[_0xfe9f('0xbb')](sendMessageReschedule(_0x4cb4ca))[_0xfe9f('0xbc')](loggerCatch('[countReScheduled]\x20'));}else{_0x4cb4ca['message']=_0xfe9f('0x210');if(_[_0xfe9f('0xe0')](_0x4cb250[0x0])||_[_0xfe9f('0xe0')](_0x4cb250[0x0][_0xfe9f('0x169')])||_[_0xfe9f('0xe0')](_0x4cb250[0x0][_0xfe9f('0x169')][_0xfe9f('0x16a')])){_0x246c9f['emptyContact'](_0xfe9f('0x20a'),_0x4cb4ca,_0x4cb250[0x0]);}else{_0x246c9f[_0xfe9f('0xbe')](_[_0xfe9f('0x12b')](_0x4cb250[0x0],[_0xfe9f('0xd7'),_0xfe9f('0x211')]))[_0xfe9f('0xbb')](_0x246c9f[_0xfe9f('0x1f1')](_0x4cb4ca,_0x4cb250[0x0]))['catch'](_0x246c9f[_0xfe9f('0xd0')](_0xfe9f('0x216'),_0x4cb4ca));}}})[_0xfe9f('0xbc')](loggerGetContactDialer('[getContactDialerPredictive]',_0x4cb4ca,0x1));emitVoiceQueueSummary(_0x4cb4ca);};Dialer[_0xfe9f('0xb0')]['abandonmentRate']=function(_0x127da3,_0x5cf8d1,_0x4dfb94,_0x5e3752,_0x282077,_0x5c5b67){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x217'),_0x127da3);loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x218'),_0x5cf8d1);loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x219'),_0x4dfb94);loggerPredictive['info'](_0xfe9f('0x21a'),_0x5e3752);loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x21b'),_0x282077);loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x89'));return new BPromise(function(_0xa08a05,_0x12a9c4){if(_0x127da3<=0x0||isNaN(_0x127da3)){return _0x12a9c4(msgResponse('[abandonmentRate]',_0xfe9f('0x4d'),_0xfe9f('0x21c')+_0x127da3));}if(_0x4dfb94<=0x0||isNaN(_0x4dfb94)){return _0x12a9c4(msgResponse('[abandonmentRate]',_0xfe9f('0x4d'),_0xfe9f('0x21d')+_0x4dfb94));}if(_0x5e3752<=0x0||isNaN(_0x5e3752)){return _0x12a9c4(msgResponse(_0xfe9f('0x21e'),_0xfe9f('0x4d'),_0xfe9f('0x21f')+_0x5e3752));}if(_0x5cf8d1<=0x0||isNaN(_0x5cf8d1)){return _0x12a9c4(msgResponse(_0xfe9f('0x21e'),_0xfe9f('0x4d'),_0xfe9f('0x220')+_0x5cf8d1));}if(_0x282077<=0x0||isNaN(_0x282077)){return _0x12a9c4(msgResponse(_0xfe9f('0x21e'),_0xfe9f('0x4d'),_0xfe9f('0x221')+_0x282077));}_0x5c5b67=_0x5c5b67||0x0;var _0x126207=0x1/_0x4dfb94;var _0x282058=0x0;var _0x42e708=0x0;var _0x3318d1=0x0;var _0x374bae=0x0;for(var _0x261e4a=0x0;_0x3318d1<_0x282077;_0x261e4a+=0x1){_0x42e708=_0x261e4a/_0x5cf8d1;_0x282058=(_0x5e3752*_0x42e708+_0x5c5b67)/_0x126207;_0x3318d1=erlangb(_0x282058,_0x127da3);_0x374bae=_0x282058/_0x127da3*(0x1-erlangb(_0x282058,_0x127da3));}return _0xa08a05({'erlangCalls':_0x261e4a,'erlangCallToSecond':_0x5cf8d1/_0x261e4a,'erlangAbandonmentRate':_0x3318d1,'erlangBusyFactor':_0x374bae});});};Dialer[_0xfe9f('0xb0')][_0xfe9f('0x1e8')]=function(_0x45fc89,_0x4b2a91,_0x3e2149,_0x1037a3,_0x542613,_0x59f524){loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x222'));loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x217'),_0x45fc89);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4b2a91);loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x219'),_0x3e2149);loggerPredictive[_0xfe9f('0x82')]('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',_0x1037a3);loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x223'),_0x542613);loggerPredictive[_0xfe9f('0x82')](_0xfe9f('0x89'));return new BPromise(function(_0x28e137,_0x3ba275){if(_0x45fc89<=0x0||isNaN(_0x45fc89)){return _0x3ba275(msgResponse(_0xfe9f('0x224'),_0xfe9f('0x4d'),_0xfe9f('0x21c')+_0x45fc89));}if(_0x3e2149<=0x0||isNaN(_0x3e2149)){return _0x3ba275(msgResponse(_0xfe9f('0x224'),'Error',_0xfe9f('0x21d')+_0x3e2149));}if(_0x1037a3<=0x0||isNaN(_0x1037a3)){return _0x3ba275(msgResponse(_0xfe9f('0x224'),_0xfe9f('0x4d'),_0xfe9f('0x21f')+_0x1037a3));}if(_0x4b2a91<=0x0||isNaN(_0x4b2a91)){return _0x3ba275(msgResponse(_0xfe9f('0x224'),_0xfe9f('0x4d'),_0xfe9f('0x220')+_0x4b2a91));}if(_0x542613<=0x0||isNaN(_0x542613)){return _0x3ba275(msgResponse(_0xfe9f('0x224'),_0xfe9f('0x4d'),'Umin\x20=\x20'+_0x542613));}_0x59f524=_0x59f524||0x0;var _0x43ec3a=0x1/_0x3e2149;var _0x550f89=0x0;var _0x347556=0x0;var _0x27733d=0x0;var _0x1ee343=0x0;for(var _0x4bbcde=0x0;_0x1ee343<_0x542613;_0x4bbcde+=0x1){_0x347556=_0x4bbcde/_0x4b2a91;_0x550f89=(_0x1037a3*_0x347556+_0x59f524)/_0x43ec3a;_0x27733d=erlangb(_0x550f89,_0x45fc89);_0x1ee343=_0x550f89/_0x45fc89*(0x1-erlangb(_0x550f89,_0x45fc89));}return _0x28e137({'erlangCalls':_0x4bbcde,'erlangCallToSecond':_0x4b2a91/_0x4bbcde,'erlangAbandonmentRate':_0x27733d,'erlangBusyFactor':_0x1ee343});});};module[_0xfe9f('0x225')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index df87a65..cf9c0a2 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 _0x6b79=['responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime'];(function(_0x3dc538,_0x4f7702){var _0x72c2fd=function(_0x5a7260){while(--_0x5a7260){_0x3dc538['push'](_0x3dc538['shift']());}};_0x72c2fd(++_0x4f7702);}(_0x6b79,0xbc));var _0x96b7=function(_0x389f79,_0x20765c){_0x389f79=_0x389f79-0x0;var _0x2b72fb=_0x6b79[_0x389f79];return _0x2b72fb;};'use strict';var util=require(_0x96b7('0x0'));var _=require(_0x96b7('0x1'));var moment=require('moment');function getSeconds(_0x5906fb,_0x143bd5){var _0x3dfb11=moment(_0x5906fb)[_0x96b7('0x2')](0x0);var _0x448874=moment(_0x143bd5)[_0x96b7('0x2')](0x0);return _0x3dfb11[_0x96b7('0x3')](_0x448874,_0x96b7('0x4'));}function QueueCallerAbandon(_0x550dc9,_0x384bd3){this['scheduledat']=_0x550dc9['scheduledat'];this[_0x96b7('0x5')]=_0x550dc9[_0x96b7('0x5')];this[_0x96b7('0x6')]=_0x550dc9[_0x96b7('0x5')]===_0x96b7('0x7')?_0x96b7('0x8'):_0x550dc9[_0x96b7('0x5')];this[_0x96b7('0x9')]=_0x550dc9['countbusyretry'];this[_0x96b7('0xa')]=_0x550dc9[_0x96b7('0xa')];this[_0x96b7('0xb')]=_0x550dc9[_0x96b7('0xb')];this['countglobal']=_0x550dc9[_0x96b7('0x9')]+_0x550dc9[_0x96b7('0xa')]+_0x550dc9[_0x96b7('0xb')]+_0x550dc9[_0x96b7('0xc')]+_0x550dc9[_0x96b7('0xd')]+_0x550dc9[_0x96b7('0xe')]+_0x550dc9[_0x96b7('0xf')]+_0x550dc9[_0x96b7('0x10')];this[_0x96b7('0xc')]=_0x550dc9[_0x96b7('0xc')];this[_0x96b7('0xd')]=_0x550dc9['countdropretry'];this[_0x96b7('0xe')]=_0x550dc9['countabandonedretry'];this[_0x96b7('0xf')]=_0x550dc9[_0x96b7('0xf')];this[_0x96b7('0x10')]=_0x550dc9[_0x96b7('0x10')];this[_0x96b7('0x11')]=_0x384bd3[_0x96b7('0x11')];this[_0x96b7('0x12')]=_0x550dc9[_0x96b7('0x13')];this['calleridnum']=_0x550dc9[_0x96b7('0x14')];this['starttime']=_0x550dc9[_0x96b7('0x15')];this[_0x96b7('0x16')]=_0x550dc9[_0x96b7('0x16')];this[_0x96b7('0x17')]=_0x550dc9[_0x96b7('0x17')];this[_0x96b7('0x18')]=this['droptime'];this[_0x96b7('0x19')]=getSeconds(_0x550dc9[_0x96b7('0x16')],_0x550dc9[_0x96b7('0x15')]);this[_0x96b7('0x1a')]=getSeconds(this['droptime'],_0x550dc9['responsetime']);this[_0x96b7('0x1b')]=0x0;this[_0x96b7('0x8')]=_0x384bd3[_0x96b7('0x8')];this[_0x96b7('0x1c')]=_0x384bd3[_0x96b7('0x1d')];this[_0x96b7('0x1e')]=_0x384bd3[_0x96b7('0x1e')];this[_0x96b7('0x1f')]=_0x550dc9['callback'];this['callbackuniqueid']=_0x550dc9[_0x96b7('0x20')];this['callbackat']=_0x550dc9[_0x96b7('0x21')];this[_0x96b7('0x22')]=_0x550dc9[_0x96b7('0x22')];this['ContactId']=_0x550dc9['ContactId'];this[_0x96b7('0x23')]=_0x550dc9[_0x96b7('0x23')];this[_0x96b7('0x24')]=_0x550dc9[_0x96b7('0x24')];this[_0x96b7('0x25')]=_0x550dc9[_0x96b7('0x25')];this[_0x96b7('0x26')]=_0x550dc9['CampaignId'];this[_0x96b7('0x27')]=_0x550dc9[_0x96b7('0x27')]||'';this[_0x96b7('0x28')]=_0x550dc9['originatecalleridname']||'';}module[_0x96b7('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x0740=['type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','endtime','ringtime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','seconds','scheduledat'];(function(_0x5af26b,_0x24c1f9){var _0x43534c=function(_0x491bd5){while(--_0x491bd5){_0x5af26b['push'](_0x5af26b['shift']());}};_0x43534c(++_0x24c1f9);}(_0x0740,0x19f));var _0x0074=function(_0x2426aa,_0x4aa511){_0x2426aa=_0x2426aa-0x0;var _0x3dc56d=_0x0740[_0x2426aa];return _0x3dc56d;};'use strict';var util=require(_0x0074('0x0'));var _=require('lodash');var moment=require(_0x0074('0x1'));function getSeconds(_0x4604d9,_0x4fc269){var _0x39fd35=moment(_0x4604d9)[_0x0074('0x2')](0x0);var _0xfbc217=moment(_0x4fc269)['milliseconds'](0x0);return _0x39fd35['diff'](_0xfbc217,_0x0074('0x3'));}function QueueCallerAbandon(_0xdeeb69,_0x51d266){this[_0x0074('0x4')]=_0xdeeb69['scheduledat'];this[_0x0074('0x5')]=_0xdeeb69[_0x0074('0x5')];this[_0x0074('0x6')]=_0xdeeb69['type']===_0x0074('0x7')?_0x0074('0x8'):_0xdeeb69['type'];this['countbusyretry']=_0xdeeb69['countbusyretry'];this[_0x0074('0x9')]=_0xdeeb69[_0x0074('0x9')];this['countnoanswerretry']=_0xdeeb69[_0x0074('0xa')];this[_0x0074('0xb')]=_0xdeeb69[_0x0074('0xc')]+_0xdeeb69['countcongestionretry']+_0xdeeb69[_0x0074('0xa')]+_0xdeeb69[_0x0074('0xd')]+_0xdeeb69[_0x0074('0xe')]+_0xdeeb69['countabandonedretry']+_0xdeeb69[_0x0074('0xf')]+_0xdeeb69[_0x0074('0x10')];this[_0x0074('0xd')]=_0xdeeb69[_0x0074('0xd')];this[_0x0074('0xe')]=_0xdeeb69[_0x0074('0xe')];this[_0x0074('0x11')]=_0xdeeb69[_0x0074('0x11')];this[_0x0074('0xf')]=_0xdeeb69['countmachineretry'];this[_0x0074('0x10')]=_0xdeeb69['countagentrejectretry'];this[_0x0074('0x12')]=_0x51d266['uniqueid'];this[_0x0074('0x13')]=_0xdeeb69[_0x0074('0x14')];this[_0x0074('0x15')]=_0xdeeb69['number'];this[_0x0074('0x16')]=_0xdeeb69[_0x0074('0x16')];this[_0x0074('0x17')]=_0xdeeb69[_0x0074('0x17')];this[_0x0074('0x18')]=_0xdeeb69[_0x0074('0x18')];this[_0x0074('0x19')]=this['droptime'];this[_0x0074('0x1a')]=getSeconds(_0xdeeb69[_0x0074('0x17')],_0xdeeb69[_0x0074('0x16')]);this[_0x0074('0x1b')]=getSeconds(this[_0x0074('0x18')],_0xdeeb69[_0x0074('0x17')]);this['talktime']=0x0;this[_0x0074('0x8')]=_0x51d266['queue'];this[_0x0074('0x1c')]=_0x51d266[_0x0074('0x1d')];this[_0x0074('0x1e')]=_0x51d266['reason'];this[_0x0074('0x1f')]=_0xdeeb69[_0x0074('0x1f')];this[_0x0074('0x20')]=_0xdeeb69[_0x0074('0x20')];this['callbackat']=_0xdeeb69[_0x0074('0x21')];this['recallme']=_0xdeeb69[_0x0074('0x22')];this[_0x0074('0x23')]=_0xdeeb69[_0x0074('0x23')];this[_0x0074('0x24')]=_0xdeeb69['ListId'];this['UserId']=_0xdeeb69[_0x0074('0x25')];this[_0x0074('0x26')]=_0xdeeb69[_0x0074('0x26')];this[_0x0074('0x27')]=_0xdeeb69[_0x0074('0x27')];this[_0x0074('0x28')]=_0xdeeb69[_0x0074('0x28')]||'';this['originatecalleridname']=_0xdeeb69[_0x0074('0x29')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 63c7e84..bbf0f51 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 _0xa692=['format','%s/%s/%s','tech','fax','localstationid','headerinfo','path','AttachmentId','util','lodash','channel'];(function(_0x29e314,_0x19d592){var _0x4c9fcb=function(_0xcb1c9){while(--_0xcb1c9){_0x29e314['push'](_0x29e314['shift']());}};_0x4c9fcb(++_0x19d592);}(_0xa692,0x1d6));var _0x2a69=function(_0x38136b,_0x35c34e){_0x38136b=_0x38136b-0x0;var _0x3b10b9=_0xa692[_0x38136b];return _0x3b10b9;};'use strict';var util=require(_0x2a69('0x0'));var _=require(_0x2a69('0x1'));var moment=require('moment');function Action(_0x5cf33f,_0x57505e,_0x2fb06e){this['uniqueid']=_0x5cf33f||undefined;this[_0x2a69('0x2')]=util[_0x2a69('0x3')](_0x2a69('0x4'),_0x57505e[_0x2a69('0x5')],_0x57505e['Trunk']['name'],_0x2fb06e[_0x2a69('0x6')]);this[_0x2a69('0x7')]=_0x57505e[_0x2a69('0x7')];this[_0x2a69('0x8')]=_0x57505e[_0x2a69('0x8')];this[_0x2a69('0x9')]=_0x2fb06e[_0x2a69('0x9')];this[_0x2a69('0xa')]=_0x2fb06e[_0x2a69('0xa')];}module['exports']=Action; \ No newline at end of file +var _0xd51f=['fax','headerinfo','AttachmentId','util','lodash','uniqueid','channel','format','%s/%s/%s','tech','Trunk','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd51f,0x15f));var _0xfd51=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xd51f[_0x178e48];return _0x440d7e;};'use strict';var util=require(_0xfd51('0x0'));var _=require(_0xfd51('0x1'));var moment=require('moment');function Action(_0x457125,_0x4e2a0e,_0x36e450){this[_0xfd51('0x2')]=_0x457125||undefined;this[_0xfd51('0x3')]=util[_0xfd51('0x4')](_0xfd51('0x5'),_0x4e2a0e[_0xfd51('0x6')],_0x4e2a0e[_0xfd51('0x7')][_0xfd51('0x8')],_0x36e450[_0xfd51('0x9')]);this['localstationid']=_0x4e2a0e['localstationid'];this[_0xfd51('0xa')]=_0x4e2a0e['headerinfo'];this['path']=_0x36e450['path'];this['AttachmentId']=_0x36e450[_0xfd51('0xb')];}module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index ea163e7..4a9db32 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 _0xdd4d=['value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','.pdf','application/pdf','then','notify','parse','\x20notify\x20','error','\x20receiveFax\x20','stringify','actions','merge','pick','response','reason','AttachmentId','logger','[Fax][Message][Error][Updated]','catch','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','util','lodash','bluebird','uuid','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','newchannel','syncNewchannel','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdd4d,0x152));var _0xddd4=function(_0x142b4f,_0x346c1e){_0x142b4f=_0x142b4f-0x0;var _0x1aa9ff=_0xdd4d[_0x142b4f];return _0x1aa9ff;};'use strict';var util=require(_0xddd4('0x0'));var _=require(_0xddd4('0x1'));var BPromise=require(_0xddd4('0x2'));var uuid=require(_0xddd4('0x3'));var moment=require('moment');var path=require(_0xddd4('0x4'));var tiff2pdf=require(_0xddd4('0x5'));var gs=require('./util/gs');var logger=require(_0xddd4('0x6'))(_0xddd4('0x7'));var ami=require(_0xddd4('0x8'));var rpcDb=require(_0xddd4('0x9'));var Channel=require(_0xddd4('0xa'));var ut=require(_0xddd4('0xb'));var Action=require(_0xddd4('0xc'));var faxAccount=require(_0xddd4('0xd'));var attachment=require(_0xddd4('0xe'));var faxMessage=require(_0xddd4('0xf'));function Fax(_0x156a6f){this['channels']={};this[_0xddd4('0x10')]=_0x156a6f[_0xddd4('0x10')];this[_0xddd4('0x11')]=_0x156a6f[_0xddd4('0x11')];this['actions']={};ami['on'](_0xddd4('0x12'),this[_0xddd4('0x13')]['bind'](this));ami['on']('varset',this[_0xddd4('0x14')][_0xddd4('0x15')](this));ami['on'](_0xddd4('0x16'),this[_0xddd4('0x17')][_0xddd4('0x15')](this));ami['on'](_0xddd4('0x18'),this[_0xddd4('0x19')][_0xddd4('0x15')](this));ami['on'](_0xddd4('0x1a'),this[_0xddd4('0x1b')][_0xddd4('0x15')](this));ami['on'](_0xddd4('0x1c'),this['syncReceiveFax'][_0xddd4('0x15')](this));ami['on'](_0xddd4('0x1d'),this[_0xddd4('0x1e')]['bind'](this));ami['on'](_0xddd4('0x1f'),this[_0xddd4('0x20')]['bind'](this));}Fax[_0xddd4('0x21')][_0xddd4('0x13')]=function(_0xd6dd7e){if(_0xd6dd7e[_0xddd4('0x22')]===_0xddd4('0x23')){for(var _0x16e18e in this[_0xddd4('0x10')]){if(this['faxAccounts'][_0xddd4('0x24')](_0x16e18e)){if(_0xd6dd7e[_0xddd4('0x25')]===this[_0xddd4('0x10')][_0x16e18e][_0xddd4('0x26')]){this[_0xddd4('0x27')][_0xd6dd7e[_0xddd4('0x28')]]={};this[_0xddd4('0x27')][_0xd6dd7e[_0xddd4('0x28')]][_0xddd4('0x29')]=_0xd6dd7e['channel'];this[_0xddd4('0x27')][_0xd6dd7e['uniqueid']]['id']=this[_0xddd4('0x10')][_0x16e18e]['id'];this[_0xddd4('0x27')][_0xd6dd7e[_0xddd4('0x28')]][_0xddd4('0x2a')]=this[_0xddd4('0x10')][_0x16e18e][_0xddd4('0x2a')];logger[_0xddd4('0x2b')](_0xd6dd7e[_0xddd4('0x28')],_0xddd4('0x2c'));}}}}if(this['actions'][_0xd6dd7e['uniqueid']]){this[_0xddd4('0x27')][_0xd6dd7e[_0xddd4('0x28')]]={};this[_0xddd4('0x27')][_0xd6dd7e[_0xddd4('0x28')]][_0xddd4('0x29')]=_0xd6dd7e[_0xddd4('0x29')];logger[_0xddd4('0x2b')](_0xd6dd7e[_0xddd4('0x28')],_0xddd4('0x2c'));}};Fax[_0xddd4('0x21')]['syncVarSet']=function(_0x46c0e5){if(this[_0xddd4('0x27')][_0x46c0e5[_0xddd4('0x28')]]){for(var _0x5b6fba in _0x46c0e5[_0xddd4('0x2d')]){if(_0x46c0e5[_0xddd4('0x2d')]['hasOwnProperty'](_0x5b6fba)){this[_0xddd4('0x27')][_0x46c0e5[_0xddd4('0x28')]][_0x5b6fba]=_0x46c0e5[_0xddd4('0x2e')];}}}};Fax['prototype'][_0xddd4('0x17')]=function(_0x867397){if(this[_0xddd4('0x27')][_0x867397[_0xddd4('0x28')]]){this[_0xddd4('0x27')][_0x867397['uniqueid']][_0xddd4('0x2f')]=_0x867397['channelstate'];this[_0xddd4('0x27')][_0x867397[_0xddd4('0x28')]][_0xddd4('0x30')]=_0x867397[_0xddd4('0x30')];}};Fax[_0xddd4('0x21')]['syncNewExten']=function(_0x3299e0){if(this[_0xddd4('0x27')][_0x3299e0[_0xddd4('0x28')]]){for(var _0x8bb39f in _0x3299e0[_0xddd4('0x2d')]){if(_0x3299e0['variable'][_0xddd4('0x24')](_0x8bb39f)){this[_0xddd4('0x27')][_0x3299e0[_0xddd4('0x28')]][_0x8bb39f]=_0x3299e0[_0xddd4('0x2e')];}}}};Fax[_0xddd4('0x21')][_0xddd4('0x1b')]=function(_0x91806a){if(this[_0xddd4('0x27')][_0x91806a[_0xddd4('0x28')]]){this[_0xddd4('0x27')][_0x91806a[_0xddd4('0x28')]]['operation']=_0x91806a[_0xddd4('0x31')];this[_0xddd4('0x27')][_0x91806a[_0xddd4('0x28')]][_0xddd4('0x32')]=_0x91806a[_0xddd4('0x32')];this[_0xddd4('0x27')][_0x91806a['uniqueid']][_0xddd4('0x26')]=_0x91806a[_0xddd4('0x26')];this[_0xddd4('0x27')][_0x91806a[_0xddd4('0x28')]][_0xddd4('0x33')]=_0x91806a['filename'];logger[_0xddd4('0x2b')](_0x91806a[_0xddd4('0x28')],_0xddd4('0x34'));}};Fax[_0xddd4('0x21')][_0xddd4('0x35')]=function(_0x42b135){var _0x11e9dc=this;if(this['channels'][_0x42b135[_0xddd4('0x28')]]){var _0x34d627=this['channels'][_0x42b135[_0xddd4('0x28')]]['id'];this[_0xddd4('0x27')][_0x42b135['uniqueid']]['remotestationid']=_0x42b135[_0xddd4('0x36')];this[_0xddd4('0x27')][_0x42b135[_0xddd4('0x28')]][_0xddd4('0x37')]=_0x42b135[_0xddd4('0x37')];this[_0xddd4('0x27')][_0x42b135[_0xddd4('0x28')]]['localstationid']=_0x42b135[_0xddd4('0x26')];this[_0xddd4('0x27')][_0x42b135[_0xddd4('0x28')]]['resolution']=_0x42b135['resolution'];this[_0xddd4('0x27')][_0x42b135[_0xddd4('0x28')]][_0xddd4('0x38')]=_0x42b135[_0xddd4('0x38')];this[_0xddd4('0x27')][_0x42b135[_0xddd4('0x28')]][_0xddd4('0x33')]=_0x42b135[_0xddd4('0x33')];this['channels'][_0x42b135['uniqueid']][_0xddd4('0x39')]=_0x42b135[_0xddd4('0x39')];if(this[_0xddd4('0x27')][_0x42b135[_0xddd4('0x28')]][_0xddd4('0x37')]>0x0){tiff2pdf(_0x42b135[_0xddd4('0x33')],_0xddd4('0x3a'),function(_0x9c9aa9){logger[_0xddd4('0x2b')](_0x42b135[_0xddd4('0x28')],_0xddd4('0x3b'),_0x9c9aa9[_0xddd4('0x3c')]);attachment['create']({'name':path['parse'](_0x42b135['filename'])['name'],'basename':path['parse'](_0x42b135[_0xddd4('0x33')])[_0xddd4('0x2a')]+_0xddd4('0x3d'),'type':_0xddd4('0x3e')})[_0xddd4('0x3f')](function(_0x33285c){faxAccount[_0xddd4('0x40')](_0x34d627,{'from':_0x42b135['calleridnum'],'mapKey':'fax','body':path[_0xddd4('0x41')](_0x42b135[_0xddd4('0x33')])[_0xddd4('0x2a')]+_0xddd4('0x3d'),'AttachmentId':_0x33285c['id']})['catch'](function(_0x59f7bd){logger['error'](_0x42b135[_0xddd4('0x28')],_0xddd4('0x42'),JSON['stringify'](_0x59f7bd));});})['catch'](function(_0x1f6cae){logger[_0xddd4('0x43')](_0x42b135[_0xddd4('0x28')],_0xddd4('0x44'),JSON[_0xddd4('0x45')](_0x1f6cae));});});}logger['info'](_0x42b135[_0xddd4('0x28')],_0xddd4('0x44'));}};Fax[_0xddd4('0x21')][_0xddd4('0x20')]=function(_0x4a1bf4){if(this[_0xddd4('0x46')][_0x4a1bf4[_0xddd4('0x28')]]){_[_0xddd4('0x47')](this['channels'][_0x4a1bf4['uniqueid']],_[_0xddd4('0x48')](_0x4a1bf4,[_0xddd4('0x49'),_0xddd4('0x4a')]));}};function updateStatus(_0x49d823){if(_0x49d823[_0xddd4('0x4b')]){faxMessage['update'](_0x49d823['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x115aab){ut[_0xddd4('0x4c')](_0xddd4('0x4d'),_0x115aab);})[_0xddd4('0x4e')](function(_0x500a85){ut[_0xddd4('0x4c')](_0xddd4('0x4f'),_0x500a85);});}else{ut[_0xddd4('0x4c')](_0xddd4('0x50'));}}Fax['prototype'][_0xddd4('0x51')]=function(_0x33d7d7,_0x12007c,_0x313dc4){var _0x1b3e9d=this;var _0xbb5a88={};if(_0x12007c){_0xbb5a88={'read':_0x12007c};}else{_0xbb5a88={'failMessage':_0x313dc4};}if(this[_0xddd4('0x46')][_0x33d7d7][_0xddd4('0x4b')]){faxMessage[_0xddd4('0x52')](this[_0xddd4('0x46')][_0x33d7d7][_0xddd4('0x4b')],_0xbb5a88)[_0xddd4('0x3f')](function(_0x3a4647){ut[_0xddd4('0x4c')](_0xddd4('0x53'),_0x3a4647);})[_0xddd4('0x4e')](function(_0x3a6ac7){ut['logger'](_0xddd4('0x54'),_0x3a6ac7);})[_0xddd4('0x55')](function(){delete _0x1b3e9d[_0xddd4('0x27')][_0x33d7d7];delete _0x1b3e9d[_0xddd4('0x46')][_0x33d7d7];});}else{ut[_0xddd4('0x4c')](_0xddd4('0x56'));delete this['channels'][_0x33d7d7];delete this[_0xddd4('0x46')][_0x33d7d7];}};Fax['prototype'][_0xddd4('0x1e')]=function(_0x117ad8){var _0x409693=this;if(this[_0xddd4('0x27')][_0x117ad8[_0xddd4('0x28')]]){if(this[_0xddd4('0x46')][_0x117ad8[_0xddd4('0x28')]]){this[_0xddd4('0x27')][_0x117ad8[_0xddd4('0x28')]]['id']=this[_0xddd4('0x46')][_0x117ad8['uniqueid']]['id'];this[_0xddd4('0x27')][_0x117ad8[_0xddd4('0x28')]][_0xddd4('0x2a')]=this[_0xddd4('0x46')][_0x117ad8[_0xddd4('0x28')]][_0xddd4('0x2a')];}logger[_0xddd4('0x2b')](_0x117ad8[_0xddd4('0x28')],this[_0xddd4('0x46')][_0x117ad8[_0xddd4('0x28')]]?'\x20hangup\x20sendFile\x20':_0xddd4('0x57'),JSON[_0xddd4('0x45')](this[_0xddd4('0x27')][_0x117ad8[_0xddd4('0x28')]]));if(this[_0xddd4('0x46')][_0x117ad8[_0xddd4('0x28')]]){if(this[_0xddd4('0x27')][_0x117ad8[_0xddd4('0x28')]][_0xddd4('0x58')]>0x0&&this[_0xddd4('0x27')][_0x117ad8[_0xddd4('0x28')]][_0xddd4('0x1a')]===_0xddd4('0x59')){this[_0xddd4('0x51')](_0x117ad8[_0xddd4('0x28')],!![]);}else{this[_0xddd4('0x51')](_0x117ad8[_0xddd4('0x28')],![],this[_0xddd4('0x27')][_0x117ad8[_0xddd4('0x28')]][_0xddd4('0x5a')]?_0xddd4('0x5b')+this[_0xddd4('0x27')][_0x117ad8[_0xddd4('0x28')]][_0xddd4('0x5a')]:_0xddd4('0x5c'));}}}};Fax[_0xddd4('0x21')]['send']=function(_0x4f0a0f){var _0x268ab1=this;return new BPromise(function(_0x496fd0,_0x1cae27){_0x268ab1[_0xddd4('0x5d')](_0x4f0a0f,_0x268ab1[_0xddd4('0x10')][_0x4f0a0f[_0xddd4('0x5e')]])[_0xddd4('0x3f')](function(_0x42f30b){ut['logger'](_0xddd4('0x5f'),_0x42f30b);_0x496fd0(ut['message'](_0xddd4('0x60')));})['catch'](function(_0x260aa2){ut[_0xddd4('0x4c')](_0xddd4('0x61'),_0x260aa2);updateStatus(_0x4f0a0f);_0x1cae27(ut['message'](_0xddd4('0x62')));});});};Fax['prototype'][_0xddd4('0x63')]=function(_0x506269){var _0xef73e7=this;return new BPromise(function(_0x416a5a,_0x2a4e30){var _0x1d4f75=_0xef73e7[_0xddd4('0x64')](_0xef73e7[_0xddd4('0x10')][_0x506269[_0xddd4('0x5e')]][_0xddd4('0x65')],_0x506269);if(_0x1d4f75[_0xddd4('0x66')]){_0x416a5a(ut[_0xddd4('0x3c')](_0xddd4('0x67')));}else{_0x2a4e30(ut['message'](_0x1d4f75[_0xddd4('0x3c')]));}});};function originate(_0x200c2f,_0x584401,_0x14e7b8){return new BPromise(function(_0x232c5a,_0xbe86b){if(_0x14e7b8){var _0x35c903=util[_0xddd4('0x68')](_0xddd4('0x69'),path[_0xddd4('0x41')](_0x200c2f[_0xddd4('0x4')])[_0xddd4('0x2a')],_0x200c2f[_0xddd4('0x4')]);gs[_0xddd4('0x6a')](_0x35c903)[_0xddd4('0x3f')](function(){_0x200c2f[_0xddd4('0x4')]=util['format'](_0xddd4('0x6b'),path[_0xddd4('0x41')](_0x200c2f['path'])[_0xddd4('0x6c')],path['parse'](_0x200c2f[_0xddd4('0x4')])[_0xddd4('0x2a')]);_0x584401[_0xddd4('0x6d')]=_0x200c2f[_0xddd4('0x4')];ut[_0xddd4('0x4c')](_0xddd4('0x6e'),'');ami[_0xddd4('0x6f')](ut['variablesAction'](_0x200c2f,_0x584401))[_0xddd4('0x3f')](function(_0x1d4b01){_0x232c5a(_0x1d4b01);})[_0xddd4('0x4e')](function(_0x16bc2e){_0xbe86b(_0x16bc2e);});})[_0xddd4('0x4e')](function(_0x337757){_0xbe86b(_0x337757);});}else{ami[_0xddd4('0x6f')](ut[_0xddd4('0x70')](_0x200c2f,_0x584401))[_0xddd4('0x3f')](function(_0x133ec7){_0x232c5a(_0x133ec7);})[_0xddd4('0x4e')](function(_0x2cb2be){_0xbe86b(_0x2cb2be);});}});}Fax[_0xddd4('0x21')][_0xddd4('0x5d')]=function(_0x25ecaa,_0x44318d){var _0x338ad6=this;return new BPromise(function(_0x3eea00,_0x55ad0b){var _0x63faa4=uuid['v4']();var _0xec5bbb=ut[_0xddd4('0x71')](_0x25ecaa,_0x44318d);_0x338ad6[_0xddd4('0x46')][_0x63faa4]=new Action(_0x63faa4,_0x44318d,_0x25ecaa);var _0x13606c=_0x338ad6[_0xddd4('0x46')][_0x63faa4];if(path['parse'](_0x25ecaa[_0xddd4('0x4')])[_0xddd4('0x72')]==='.pdf'){originate(_0x13606c,_0xec5bbb,!![])['then'](function(_0x3f6cf7){_0x3eea00(_0x3f6cf7);})[_0xddd4('0x4e')](function(_0x5011c0){_0x55ad0b(_0x5011c0);});}else{originate(_0x13606c,_0xec5bbb,![])['then'](function(_0x25f598){_0x3eea00(_0x25f598);})[_0xddd4('0x4e')](function(_0x43dcdb){_0x55ad0b(_0x43dcdb);});}});};Fax[_0xddd4('0x21')]['isTrunkReachable']=function(_0x213360){return!_['isNil'](_0x213360)&&!_[_0xddd4('0x73')](_0x213360[_0xddd4('0x2a')])&&!_['isNil'](_0x213360[_0xddd4('0x74')])&&_0x213360[_0xddd4('0x74')]&&!_[_0xddd4('0x73')](this[_0xddd4('0x11')][util[_0xddd4('0x68')]('SIP/%s',_0x213360[_0xddd4('0x2a')])])&&!_[_0xddd4('0x73')](this[_0xddd4('0x11')][util[_0xddd4('0x68')](_0xddd4('0x75'),_0x213360[_0xddd4('0x2a')])][_0xddd4('0x32')])&&(this['trunks'][util[_0xddd4('0x68')]('SIP/%s',_0x213360[_0xddd4('0x2a')])][_0xddd4('0x32')]===_0xddd4('0x76')||this[_0xddd4('0x11')][util[_0xddd4('0x68')](_0xddd4('0x75'),_0x213360['name'])][_0xddd4('0x32')]===_0xddd4('0x77'));};Fax['prototype'][_0xddd4('0x64')]=function(_0x46163d,_0x21423a){if(!this[_0xddd4('0x78')](_0x46163d)){ut[_0xddd4('0x4c')](_0xddd4('0x79'),_[_0xddd4('0x73')](_0x46163d)?'':_0x46163d[_0xddd4('0x2a')]+_0xddd4('0x7a'));return{'isValid':![],'message':_0xddd4('0x7b')};}if(_[_0xddd4('0x73')](_0x21423a['fax'])){ut['logger'](_0xddd4('0x7c'),JSON['stringify'](_0x21423a));return{'isValid':![],'message':_0xddd4('0x7d')};}if(_['isNil'](_0x21423a[_0xddd4('0x4')])){ut[_0xddd4('0x4c')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0xddd4('0x45')](_0x21423a));return{'isValid':![],'message':_0xddd4('0x7e')};}return{'isValid':!![],'message':_0xddd4('0x7f')};};module['exports']=Fax; \ No newline at end of file +var _0xaaa6=['receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','from-voip-provider','hasOwnProperty','exten','localstationid','channel','uniqueid','name','\x20syncNewchannel\x20','info','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','application/pdf','then','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','reason','update','AttachmentId','logger','[Fax][Message][Error][Updated]','updateStatus','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','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','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','fax','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus'];(function(_0x26b990,_0x2cf5c0){var _0x1a7c09=function(_0x1ff90d){while(--_0x1ff90d){_0x26b990['push'](_0x26b990['shift']());}};_0x1a7c09(++_0x2cf5c0);}(_0xaaa6,0x1ae));var _0x6aaa=function(_0x479a35,_0x2526b2){_0x479a35=_0x479a35-0x0;var _0x24fea9=_0xaaa6[_0x479a35];return _0x24fea9;};'use strict';var util=require(_0x6aaa('0x0'));var _=require(_0x6aaa('0x1'));var BPromise=require(_0x6aaa('0x2'));var uuid=require(_0x6aaa('0x3'));var moment=require(_0x6aaa('0x4'));var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require('../../../config/logger')(_0x6aaa('0x5'));var ami=require(_0x6aaa('0x6'));var rpcDb=require(_0x6aaa('0x7'));var Channel=require('./channel');var ut=require(_0x6aaa('0x8'));var Action=require(_0x6aaa('0x9'));var faxAccount=require(_0x6aaa('0xa'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x6aaa('0xb'));function Fax(_0x406cd0){this[_0x6aaa('0xc')]={};this[_0x6aaa('0xd')]=_0x406cd0[_0x6aaa('0xd')];this['trunks']=_0x406cd0[_0x6aaa('0xe')];this[_0x6aaa('0xf')]={};ami['on'](_0x6aaa('0x10'),this[_0x6aaa('0x11')][_0x6aaa('0x12')](this));ami['on'](_0x6aaa('0x13'),this[_0x6aaa('0x14')][_0x6aaa('0x12')](this));ami['on']('newstate',this[_0x6aaa('0x15')][_0x6aaa('0x12')](this));ami['on'](_0x6aaa('0x16'),this[_0x6aaa('0x17')][_0x6aaa('0x12')](this));ami['on'](_0x6aaa('0x18'),this[_0x6aaa('0x19')]['bind'](this));ami['on'](_0x6aaa('0x1a'),this[_0x6aaa('0x1b')][_0x6aaa('0x12')](this));ami['on'](_0x6aaa('0x1c'),this[_0x6aaa('0x1d')][_0x6aaa('0x12')](this));ami['on'](_0x6aaa('0x1e'),this[_0x6aaa('0x1f')]['bind'](this));}Fax[_0x6aaa('0x20')][_0x6aaa('0x11')]=function(_0xc6c31a){if(_0xc6c31a['context']===_0x6aaa('0x21')){for(var _0x272e05 in this[_0x6aaa('0xd')]){if(this[_0x6aaa('0xd')][_0x6aaa('0x22')](_0x272e05)){if(_0xc6c31a[_0x6aaa('0x23')]===this[_0x6aaa('0xd')][_0x272e05][_0x6aaa('0x24')]){this[_0x6aaa('0xc')][_0xc6c31a['uniqueid']]={};this[_0x6aaa('0xc')][_0xc6c31a['uniqueid']][_0x6aaa('0x25')]=_0xc6c31a[_0x6aaa('0x25')];this[_0x6aaa('0xc')][_0xc6c31a[_0x6aaa('0x26')]]['id']=this[_0x6aaa('0xd')][_0x272e05]['id'];this['channels'][_0xc6c31a[_0x6aaa('0x26')]]['name']=this[_0x6aaa('0xd')][_0x272e05][_0x6aaa('0x27')];logger['info'](_0xc6c31a[_0x6aaa('0x26')],_0x6aaa('0x28'));}}}}if(this[_0x6aaa('0xf')][_0xc6c31a[_0x6aaa('0x26')]]){this[_0x6aaa('0xc')][_0xc6c31a[_0x6aaa('0x26')]]={};this[_0x6aaa('0xc')][_0xc6c31a[_0x6aaa('0x26')]][_0x6aaa('0x25')]=_0xc6c31a['channel'];logger[_0x6aaa('0x29')](_0xc6c31a[_0x6aaa('0x26')],_0x6aaa('0x28'));}};Fax[_0x6aaa('0x20')][_0x6aaa('0x14')]=function(_0x397289){if(this[_0x6aaa('0xc')][_0x397289[_0x6aaa('0x26')]]){for(var _0x40b97f in _0x397289['variable']){if(_0x397289[_0x6aaa('0x2a')][_0x6aaa('0x22')](_0x40b97f)){this['channels'][_0x397289[_0x6aaa('0x26')]][_0x40b97f]=_0x397289[_0x6aaa('0x2b')];}}}};Fax[_0x6aaa('0x20')]['syncNewState']=function(_0x2ec388){if(this['channels'][_0x2ec388[_0x6aaa('0x26')]]){this[_0x6aaa('0xc')][_0x2ec388[_0x6aaa('0x26')]][_0x6aaa('0x2c')]=_0x2ec388['channelstate'];this[_0x6aaa('0xc')][_0x2ec388[_0x6aaa('0x26')]][_0x6aaa('0x2d')]=_0x2ec388['channelstatedesc'];}};Fax['prototype'][_0x6aaa('0x17')]=function(_0xee1263){if(this['channels'][_0xee1263['uniqueid']]){for(var _0x10da79 in _0xee1263[_0x6aaa('0x2a')]){if(_0xee1263[_0x6aaa('0x2a')][_0x6aaa('0x22')](_0x10da79)){this['channels'][_0xee1263[_0x6aaa('0x26')]][_0x10da79]=_0xee1263[_0x6aaa('0x2b')];}}}};Fax[_0x6aaa('0x20')][_0x6aaa('0x19')]=function(_0x9b109e){if(this['channels'][_0x9b109e[_0x6aaa('0x26')]]){this[_0x6aaa('0xc')][_0x9b109e[_0x6aaa('0x26')]]['operation']=_0x9b109e[_0x6aaa('0x2e')];this[_0x6aaa('0xc')][_0x9b109e[_0x6aaa('0x26')]][_0x6aaa('0x2f')]=_0x9b109e[_0x6aaa('0x2f')];this[_0x6aaa('0xc')][_0x9b109e[_0x6aaa('0x26')]]['localstationid']=_0x9b109e[_0x6aaa('0x24')];this[_0x6aaa('0xc')][_0x9b109e[_0x6aaa('0x26')]]['filename']=_0x9b109e[_0x6aaa('0x30')];logger[_0x6aaa('0x29')](_0x9b109e[_0x6aaa('0x26')],_0x6aaa('0x31'));}};Fax[_0x6aaa('0x20')][_0x6aaa('0x1b')]=function(_0x5ab248){var _0x15b66b=this;if(this[_0x6aaa('0xc')][_0x5ab248[_0x6aaa('0x26')]]){var _0x155e58=this['channels'][_0x5ab248[_0x6aaa('0x26')]]['id'];this['channels'][_0x5ab248[_0x6aaa('0x26')]][_0x6aaa('0x32')]=_0x5ab248[_0x6aaa('0x32')];this[_0x6aaa('0xc')][_0x5ab248[_0x6aaa('0x26')]][_0x6aaa('0x33')]=_0x5ab248[_0x6aaa('0x33')];this['channels'][_0x5ab248[_0x6aaa('0x26')]][_0x6aaa('0x24')]=_0x5ab248[_0x6aaa('0x24')];this['channels'][_0x5ab248[_0x6aaa('0x26')]][_0x6aaa('0x34')]=_0x5ab248[_0x6aaa('0x34')];this[_0x6aaa('0xc')][_0x5ab248['uniqueid']]['transferrate']=_0x5ab248[_0x6aaa('0x35')];this[_0x6aaa('0xc')][_0x5ab248[_0x6aaa('0x26')]][_0x6aaa('0x30')]=_0x5ab248[_0x6aaa('0x30')];this[_0x6aaa('0xc')][_0x5ab248[_0x6aaa('0x26')]][_0x6aaa('0x36')]=_0x5ab248[_0x6aaa('0x36')];if(this[_0x6aaa('0xc')][_0x5ab248[_0x6aaa('0x26')]][_0x6aaa('0x33')]>0x0){tiff2pdf(_0x5ab248[_0x6aaa('0x30')],_0x6aaa('0x37'),function(_0x2ad05d){logger['info'](_0x5ab248[_0x6aaa('0x26')],'\x20result\x20conversion\x20file\x20',_0x2ad05d[_0x6aaa('0x38')]);attachment[_0x6aaa('0x39')]({'name':path['parse'](_0x5ab248['filename'])[_0x6aaa('0x27')],'basename':path[_0x6aaa('0x3a')](_0x5ab248[_0x6aaa('0x30')])[_0x6aaa('0x27')]+'.pdf','type':_0x6aaa('0x3b')})[_0x6aaa('0x3c')](function(_0x2c3b3e){faxAccount['notify'](_0x155e58,{'from':_0x5ab248[_0x6aaa('0x36')],'mapKey':_0x6aaa('0x5'),'body':path[_0x6aaa('0x3a')](_0x5ab248[_0x6aaa('0x30')])[_0x6aaa('0x27')]+_0x6aaa('0x3d'),'AttachmentId':_0x2c3b3e['id']})[_0x6aaa('0x3e')](function(_0x269530){logger[_0x6aaa('0x3f')](_0x5ab248['uniqueid'],_0x6aaa('0x40'),JSON[_0x6aaa('0x41')](_0x269530));});})[_0x6aaa('0x3e')](function(_0x27e703){logger[_0x6aaa('0x3f')](_0x5ab248[_0x6aaa('0x26')],_0x6aaa('0x42'),JSON[_0x6aaa('0x41')](_0x27e703));});});}logger[_0x6aaa('0x29')](_0x5ab248[_0x6aaa('0x26')],_0x6aaa('0x42'));}};Fax['prototype'][_0x6aaa('0x1f')]=function(_0x168ec4){if(this[_0x6aaa('0xf')][_0x168ec4[_0x6aaa('0x26')]]){_['merge'](this[_0x6aaa('0xc')][_0x168ec4['uniqueid']],_[_0x6aaa('0x43')](_0x168ec4,['response',_0x6aaa('0x44')]));}};function updateStatus(_0x5e6ce8){if(_0x5e6ce8['AttachmentId']){faxMessage[_0x6aaa('0x45')](_0x5e6ce8[_0x6aaa('0x46')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x6aaa('0x3c')](function(_0x11a778){ut[_0x6aaa('0x47')](_0x6aaa('0x48'),_0x11a778);})[_0x6aaa('0x3e')](function(_0x5c559e){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x5c559e);});}else{ut[_0x6aaa('0x47')]('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype'][_0x6aaa('0x49')]=function(_0x139c41,_0x5709d5,_0x371daa){var _0x1d0245=this;var _0x52c438={};if(_0x5709d5){_0x52c438={'read':_0x5709d5};}else{_0x52c438={'failMessage':_0x371daa};}if(this[_0x6aaa('0xf')][_0x139c41][_0x6aaa('0x46')]){faxMessage[_0x6aaa('0x45')](this[_0x6aaa('0xf')][_0x139c41][_0x6aaa('0x46')],_0x52c438)[_0x6aaa('0x3c')](function(_0x34c131){ut[_0x6aaa('0x47')](_0x6aaa('0x4a'),_0x34c131);})['catch'](function(_0xaf67f2){ut[_0x6aaa('0x47')]('[Fax][Message][NoUpdate1]',_0xaf67f2);})[_0x6aaa('0x4b')](function(){delete _0x1d0245[_0x6aaa('0xc')][_0x139c41];delete _0x1d0245[_0x6aaa('0xf')][_0x139c41];});}else{ut[_0x6aaa('0x47')](_0x6aaa('0x4c'));delete this[_0x6aaa('0xc')][_0x139c41];delete this['actions'][_0x139c41];}};Fax[_0x6aaa('0x20')][_0x6aaa('0x1d')]=function(_0x200e71){var _0x5e36e8=this;if(this[_0x6aaa('0xc')][_0x200e71[_0x6aaa('0x26')]]){if(this['actions'][_0x200e71[_0x6aaa('0x26')]]){this[_0x6aaa('0xc')][_0x200e71[_0x6aaa('0x26')]]['id']=this[_0x6aaa('0xf')][_0x200e71['uniqueid']]['id'];this[_0x6aaa('0xc')][_0x200e71[_0x6aaa('0x26')]]['name']=this[_0x6aaa('0xf')][_0x200e71[_0x6aaa('0x26')]][_0x6aaa('0x27')];}logger['info'](_0x200e71[_0x6aaa('0x26')],this['actions'][_0x200e71[_0x6aaa('0x26')]]?_0x6aaa('0x4d'):'\x20hangup\x20faxRiceive\x20',JSON[_0x6aaa('0x41')](this['channels'][_0x200e71[_0x6aaa('0x26')]]));if(this[_0x6aaa('0xf')][_0x200e71['uniqueid']]){if(this[_0x6aaa('0xc')][_0x200e71[_0x6aaa('0x26')]][_0x6aaa('0x4e')]>0x0&&this[_0x6aaa('0xc')][_0x200e71[_0x6aaa('0x26')]]['faxstatus']==='SUCCESS'){this['updateStatus'](_0x200e71[_0x6aaa('0x26')],!![]);}else{this[_0x6aaa('0x49')](_0x200e71[_0x6aaa('0x26')],![],this[_0x6aaa('0xc')][_0x200e71[_0x6aaa('0x26')]][_0x6aaa('0x4f')]?_0x6aaa('0x50')+this[_0x6aaa('0xc')][_0x200e71['uniqueid']][_0x6aaa('0x4f')]:_0x6aaa('0x51'));}}}};Fax[_0x6aaa('0x20')][_0x6aaa('0x52')]=function(_0x1d174f){var _0x2c961c=this;return new BPromise(function(_0x26106f,_0x11e35d){_0x2c961c[_0x6aaa('0x53')](_0x1d174f,_0x2c961c[_0x6aaa('0xd')][_0x1d174f[_0x6aaa('0x54')]])[_0x6aaa('0x3c')](function(_0x36b908){ut[_0x6aaa('0x47')](_0x6aaa('0x55'),_0x36b908);_0x26106f(ut[_0x6aaa('0x38')]('Fax\x20received'));})[_0x6aaa('0x3e')](function(_0x413d10){ut[_0x6aaa('0x47')](_0x6aaa('0x56'),_0x413d10);updateStatus(_0x1d174f);_0x11e35d(ut[_0x6aaa('0x38')](_0x6aaa('0x57')));});});};Fax[_0x6aaa('0x20')][_0x6aaa('0x58')]=function(_0x27de97){var _0x30e2d1=this;return new BPromise(function(_0x216da9,_0x35a8ba){var _0x241980=_0x30e2d1['checkTrunk'](_0x30e2d1[_0x6aaa('0xd')][_0x27de97['FaxAccountId']]['Trunk'],_0x27de97);if(_0x241980[_0x6aaa('0x59')]){_0x216da9(ut[_0x6aaa('0x38')](_0x6aaa('0x5a')));}else{_0x35a8ba(ut[_0x6aaa('0x38')](_0x241980[_0x6aaa('0x38')]));}});};function originate(_0x12922d,_0x4a391c,_0x1330bf){return new BPromise(function(_0xbed210,_0x51e8e1){if(_0x1330bf){var _0x2fb7a9=util[_0x6aaa('0x5b')](_0x6aaa('0x5c'),path[_0x6aaa('0x3a')](_0x12922d[_0x6aaa('0x5d')])[_0x6aaa('0x27')],_0x12922d['path']);gs[_0x6aaa('0x5e')](_0x2fb7a9)[_0x6aaa('0x3c')](function(){_0x12922d[_0x6aaa('0x5d')]=util[_0x6aaa('0x5b')](_0x6aaa('0x5f'),path['parse'](_0x12922d[_0x6aaa('0x5d')])[_0x6aaa('0x60')],path['parse'](_0x12922d['path'])[_0x6aaa('0x27')]);_0x4a391c[_0x6aaa('0x61')]=_0x12922d['path'];ut[_0x6aaa('0x47')](_0x6aaa('0x62'),'');ami[_0x6aaa('0x63')](ut['variablesAction'](_0x12922d,_0x4a391c))[_0x6aaa('0x3c')](function(_0x2f2a72){_0xbed210(_0x2f2a72);})[_0x6aaa('0x3e')](function(_0x53a5ba){_0x51e8e1(_0x53a5ba);});})[_0x6aaa('0x3e')](function(_0x476962){_0x51e8e1(_0x476962);});}else{ami[_0x6aaa('0x63')](ut[_0x6aaa('0x64')](_0x12922d,_0x4a391c))[_0x6aaa('0x3c')](function(_0x589e18){_0xbed210(_0x589e18);})[_0x6aaa('0x3e')](function(_0x50576f){_0x51e8e1(_0x50576f);});}});}Fax[_0x6aaa('0x20')]['execOriginate']=function(_0x4434d4,_0x3e5d11){var _0x25855f=this;return new BPromise(function(_0xca9b50,_0x2aeb3){var _0x32fe29=uuid['v4']();var _0x5aadfe=ut[_0x6aaa('0x65')](_0x4434d4,_0x3e5d11);_0x25855f[_0x6aaa('0xf')][_0x32fe29]=new Action(_0x32fe29,_0x3e5d11,_0x4434d4);var _0x3eaa82=_0x25855f[_0x6aaa('0xf')][_0x32fe29];if(path[_0x6aaa('0x3a')](_0x4434d4[_0x6aaa('0x5d')])[_0x6aaa('0x66')]==='.pdf'){originate(_0x3eaa82,_0x5aadfe,!![])[_0x6aaa('0x3c')](function(_0x3adb54){_0xca9b50(_0x3adb54);})[_0x6aaa('0x3e')](function(_0x91b6e5){_0x2aeb3(_0x91b6e5);});}else{originate(_0x3eaa82,_0x5aadfe,![])[_0x6aaa('0x3c')](function(_0x2f9ac4){_0xca9b50(_0x2f9ac4);})[_0x6aaa('0x3e')](function(_0x42ebbc){_0x2aeb3(_0x42ebbc);});}});};Fax[_0x6aaa('0x20')]['isTrunkReachable']=function(_0x1d6b06){return!_[_0x6aaa('0x67')](_0x1d6b06)&&!_[_0x6aaa('0x67')](_0x1d6b06[_0x6aaa('0x27')])&&!_[_0x6aaa('0x67')](_0x1d6b06[_0x6aaa('0x68')])&&_0x1d6b06[_0x6aaa('0x68')]&&!_['isNil'](this[_0x6aaa('0xe')][util['format']('SIP/%s',_0x1d6b06['name'])])&&!_[_0x6aaa('0x67')](this[_0x6aaa('0xe')][util[_0x6aaa('0x5b')](_0x6aaa('0x69'),_0x1d6b06[_0x6aaa('0x27')])][_0x6aaa('0x2f')])&&(this[_0x6aaa('0xe')][util[_0x6aaa('0x5b')](_0x6aaa('0x69'),_0x1d6b06[_0x6aaa('0x27')])][_0x6aaa('0x2f')]===_0x6aaa('0x6a')||this[_0x6aaa('0xe')][util[_0x6aaa('0x5b')]('SIP/%s',_0x1d6b06[_0x6aaa('0x27')])][_0x6aaa('0x2f')]===_0x6aaa('0x6b'));};Fax[_0x6aaa('0x20')]['checkTrunk']=function(_0x289a8a,_0x721208){if(!this[_0x6aaa('0x6c')](_0x289a8a)){ut[_0x6aaa('0x47')](_0x6aaa('0x6d'),_['isNil'](_0x289a8a)?'':_0x289a8a[_0x6aaa('0x27')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x6aaa('0x6e')};}if(_[_0x6aaa('0x67')](_0x721208['fax'])){ut[_0x6aaa('0x47')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x6aaa('0x41')](_0x721208));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x6aaa('0x67')](_0x721208['path'])){ut[_0x6aaa('0x47')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x721208));return{'isValid':![],'message':_0x6aaa('0x6f')};}return{'isValid':!![],'message':_0x6aaa('0x70')};};module[_0x6aaa('0x71')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index b12cd81..f8b051d 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 _0x3c11=['error','inspect','notify','resolve','util','../../../config/logger','lodash','../rpc/faxAccount'];(function(_0x169098,_0x55fa34){var _0x43d9b2=function(_0x54ffc7){while(--_0x54ffc7){_0x169098['push'](_0x169098['shift']());}};_0x43d9b2(++_0x55fa34);}(_0x3c11,0x12c));var _0x13c1=function(_0x252894,_0x5b5ff2){_0x252894=_0x252894-0x0;var _0x4c897a=_0x3c11[_0x252894];return _0x4c897a;};'use strict';var util=require(_0x13c1('0x0'));var BPromise=require('bluebird');var logger=require(_0x13c1('0x1'))('preview');var _=require(_0x13c1('0x2'));var faxAccount=require(_0x13c1('0x3'));function loggerCatch(_0x5bf211){return function(_0x58aa6b){logger[_0x13c1('0x4')](_0x5bf211,util[_0x13c1('0x5')](_0x58aa6b,{'showHidden':![],'depth':null}));};}exports[_0x13c1('0x6')]=function(_0x3c3af2,_0x5ef664){return BPromise[_0x13c1('0x7')]()['then'](faxAccount[_0x13c1('0x6')](_0x3c3af2,_0x5ef664))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x5d5c=['../rpc/faxAccount','error','inspect','then','notify','catch','[Notify]\x20','util','../../../config/logger','preview','lodash'];(function(_0x95ca4,_0x2397ac){var _0x21baaa=function(_0x405aa3){while(--_0x405aa3){_0x95ca4['push'](_0x95ca4['shift']());}};_0x21baaa(++_0x2397ac);}(_0x5d5c,0xac));var _0xc5d5=function(_0x1bb1e1,_0x2ecf21){_0x1bb1e1=_0x1bb1e1-0x0;var _0x322250=_0x5d5c[_0x1bb1e1];return _0x322250;};'use strict';var util=require(_0xc5d5('0x0'));var BPromise=require('bluebird');var logger=require(_0xc5d5('0x1'))(_0xc5d5('0x2'));var _=require(_0xc5d5('0x3'));var faxAccount=require(_0xc5d5('0x4'));function loggerCatch(_0x2cc63a){return function(_0x514800){logger[_0xc5d5('0x5')](_0x2cc63a,util[_0xc5d5('0x6')](_0x514800,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x2007e0,_0x3543ae){return BPromise['resolve']()[_0xc5d5('0x7')](faxAccount[_0xc5d5('0x8')](_0x2007e0,_0x3543ae))[_0xc5d5('0x9')](loggerCatch(_0xc5d5('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index cc1d264..79a65da 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 _0x79f5=['../../../../config/logger','fax','bluebird','child_process','execute','info','Exec\x20gs','inspect'];(function(_0x4ca92a,_0x461a78){var _0x3c9e0f=function(_0x29a0f8){while(--_0x29a0f8){_0x4ca92a['push'](_0x4ca92a['shift']());}};_0x3c9e0f(++_0x461a78);}(_0x79f5,0x1c8));var _0x579f=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x79f5[_0x1facfa];return _0x9ec701;};'use strict';var util=require('util');var logger=require(_0x579f('0x0'))(_0x579f('0x1'));var BPromise=require(_0x579f('0x2'));var exec=require(_0x579f('0x3'))['exec'];exports[_0x579f('0x4')]=function(_0x967f43){return new BPromise(function(_0x3adbaf,_0x23e273){exec(_0x967f43,function(_0x246f70,_0xd30cde,_0x37055a){logger[_0x579f('0x5')]('Exec\x20gs',_0xd30cde);if(_0x246f70){logger[_0x579f('0x5')](_0x579f('0x6'),'\x20Error\x20:',util[_0x579f('0x7')](_0x246f70,{'showHidden':![],'depth':null}),_0xd30cde,_0x37055a);_0x23e273(_0x246f70);}_0x3adbaf(_0xd30cde);});});}; \ No newline at end of file +var _0x2ace=['info','\x20Error\x20:','inspect','util','child_process','Exec\x20gs'];(function(_0x2f575c,_0x317faf){var _0x1c12e2=function(_0x3a1e3b){while(--_0x3a1e3b){_0x2f575c['push'](_0x2f575c['shift']());}};_0x1c12e2(++_0x317faf);}(_0x2ace,0x14d));var _0xe2ac=function(_0x16dbcd,_0x274516){_0x16dbcd=_0x16dbcd-0x0;var _0x34706e=_0x2ace[_0x16dbcd];return _0x34706e;};'use strict';var util=require(_0xe2ac('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require('bluebird');var exec=require(_0xe2ac('0x1'))['exec'];exports['execute']=function(_0x5716e0){return new BPromise(function(_0x558dc1,_0x17c8dc){exec(_0x5716e0,function(_0x2aa098,_0x191174,_0x439c80){logger['info'](_0xe2ac('0x2'),_0x191174);if(_0x2aa098){logger[_0xe2ac('0x3')](_0xe2ac('0x2'),_0xe2ac('0x4'),util[_0xe2ac('0x5')](_0x2aa098,{'showHidden':![],'depth':null}),_0x191174,_0x439c80);_0x17c8dc(_0x2aa098);}_0x558dc1(_0x191174);});});}; \ 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 dc060a8..54a1ff8 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 _0x6c76=['fax','message','inspect','addVariables','headerinfo','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','localstationid','path','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','util','lodash','moment'];(function(_0x316cf0,_0xcb4a0d){var _0x498265=function(_0x6bd2dd){while(--_0x6bd2dd){_0x316cf0['push'](_0x316cf0['shift']());}};_0x498265(++_0xcb4a0d);}(_0x6c76,0x184));var _0x66c7=function(_0x4d089c,_0x74bc49){_0x4d089c=_0x4d089c-0x0;var _0x4b7678=_0x6c76[_0x4d089c];return _0x4b7678;};'use strict';var util=require(_0x66c7('0x0'));var _=require(_0x66c7('0x1'));var moment=require(_0x66c7('0x2'));var logger=require('../../../../config/logger')(_0x66c7('0x3'));exports[_0x66c7('0x4')]=function(_0x519756){return{'message':_0x519756};};exports['logger']=function(_0x2f6db7,_0x2b7cf3){logger['info'](_0x2f6db7,util[_0x66c7('0x5')](_0x2b7cf3,{'showHidden':![],'depth':null}));};exports[_0x66c7('0x6')]=function(_0x52f71b,_0x23408c){var _0x4dffcd={'XMF-ECM':_0x23408c['ecm'],'XMF-HEADERINFO':_0x23408c[_0x66c7('0x7')],'XMF-MINRATE':_0x23408c[_0x66c7('0x8')],'XMF-MAXRATE':_0x23408c[_0x66c7('0x9')],'XMF-MODEM':util['format'](_0x66c7('0xa'),_0x23408c[_0x66c7('0xb')]),'XMF-GATEWAY':_0x23408c[_0x66c7('0xc')],'XMF-FAXDETECT':_0x23408c[_0x66c7('0xd')],'XMF-T38TIMEOUT':_0x23408c['t38timeout'],'XMF-LOCALSTATIONID':_0x23408c[_0x66c7('0xe')],'XMF-PATH':_0x52f71b[_0x66c7('0xf')]};return _0x4dffcd;};exports[_0x66c7('0x10')]=function(_0x187e00,_0x21fb64){return{'actionid':_0x187e00[_0x66c7('0x11')],'action':_0x66c7('0x12'),'channel':_0x187e00['channel'],'Exten':_0x66c7('0x13'),'Context':_0x66c7('0x14'),'Priority':'1','callerid':util[_0x66c7('0x15')](_0x66c7('0x16'),_0x187e00[_0x66c7('0x7')]?_0x187e00[_0x66c7('0x7')]:'',_0x187e00[_0x66c7('0xe')]),'variable':_0x21fb64,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x187e00[_0x66c7('0x11')]};}; \ No newline at end of file +var _0xd2ea=['variablesAction','uniqueid','originate','channel','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','logger','info','inspect','addVariables','ecm','minrate','maxrate','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid'];(function(_0x525833,_0xe65722){var _0x2dc53e=function(_0x447bc3){while(--_0x447bc3){_0x525833['push'](_0x525833['shift']());}};_0x2dc53e(++_0xe65722);}(_0xd2ea,0x15f));var _0xad2e=function(_0x5a8840,_0x2887ac){_0x5a8840=_0x5a8840-0x0;var _0x458083=_0xd2ea[_0x5a8840];return _0x458083;};'use strict';var util=require(_0xad2e('0x0'));var _=require(_0xad2e('0x1'));var moment=require(_0xad2e('0x2'));var logger=require(_0xad2e('0x3'))(_0xad2e('0x4'));exports['message']=function(_0x3a9d11){return{'message':_0x3a9d11};};exports[_0xad2e('0x5')]=function(_0xcba7cb,_0x3e0741){logger[_0xad2e('0x6')](_0xcba7cb,util[_0xad2e('0x7')](_0x3e0741,{'showHidden':![],'depth':null}));};exports[_0xad2e('0x8')]=function(_0x592e8b,_0x3b5170){var _0x3e3d1f={'XMF-ECM':_0x3b5170[_0xad2e('0x9')],'XMF-HEADERINFO':_0x3b5170['headerinfo'],'XMF-MINRATE':_0x3b5170[_0xad2e('0xa')],'XMF-MAXRATE':_0x3b5170[_0xad2e('0xb')],'XMF-MODEM':util['format'](_0xad2e('0xc'),_0x3b5170['modem']),'XMF-GATEWAY':_0x3b5170[_0xad2e('0xd')],'XMF-FAXDETECT':_0x3b5170[_0xad2e('0xe')],'XMF-T38TIMEOUT':_0x3b5170[_0xad2e('0xf')],'XMF-LOCALSTATIONID':_0x3b5170[_0xad2e('0x10')],'XMF-PATH':_0x592e8b['path']};return _0x3e3d1f;};exports[_0xad2e('0x11')]=function(_0x5707a5,_0x42d2ac){return{'actionid':_0x5707a5[_0xad2e('0x12')],'action':_0xad2e('0x13'),'channel':_0x5707a5[_0xad2e('0x14')],'Exten':'xcally-motion-fax','Context':_0xad2e('0x15'),'Priority':'1','callerid':util['format'](_0xad2e('0x16'),_0x5707a5['headerinfo']?_0x5707a5['headerinfo']:'',_0x5707a5['localstationid']),'variable':_0x42d2ac,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5707a5['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 6a89f3d..0a16fbc 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 _0x6e6c=['bluebird','util','./server','./realtime','./trigger','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','get','hour','resolve','then','initAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','sync'];(function(_0x58c7fa,_0x12ea94){var _0xe7efb=function(_0x28d5e9){while(--_0x28d5e9){_0x58c7fa['push'](_0x58c7fa['shift']());}};_0xe7efb(++_0x12ea94);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var moment=require('moment');var server=require(_0xc6e6('0x2'));var Realtime=require(_0xc6e6('0x3'));var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0xc6e6('0x4'));var Dialer=require('./dialer');var Preview=require(_0xc6e6('0x5'));var Fax=require('./fax');var user=require(_0xc6e6('0x6'));var voiceQueue=require(_0xc6e6('0x7'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xc6e6('0x8'));var trunk=require(_0xc6e6('0x9'));var trigger=require('./rpc/trigger');var template=require(_0xc6e6('0xa'));var cmHopperHistory=require(_0xc6e6('0xb'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xc6e6('0xc'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xc6e6('0xd'));var salesforce=require(_0xc6e6('0xe'));var sugarcrm=require(_0xc6e6('0xf'));var freshdesk=require(_0xc6e6('0x10'));var desk=require(_0xc6e6('0x11'));var zoho=require(_0xc6e6('0x12'));var vtiger=require(_0xc6e6('0x13'));var freshsales=require(_0xc6e6('0x14'));var servicenow=require(_0xc6e6('0x15'));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()[_0xc6e6('0x16')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xc6e6('0x16')](_0xc6e6('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xc6e6('0x18')]()[_0xc6e6('0x19')](user['getAgents']())[_0xc6e6('0x19')](realtime[_0xc6e6('0x1a')]())[_0xc6e6('0x19')](user[_0xc6e6('0x1b')]())[_0xc6e6('0x19')](realtime['initTelephones']())[_0xc6e6('0x19')](trunk[_0xc6e6('0x1c')]())['then'](realtime[_0xc6e6('0x1d')]())[_0xc6e6('0x19')](voiceQueue[_0xc6e6('0x1e')]())['then'](realtime['initVoiceQueues']())['then'](trigger[_0xc6e6('0x1f')]())['then'](realtime[_0xc6e6('0x20')]())[_0xc6e6('0x19')](template[_0xc6e6('0x21')]())[_0xc6e6('0x19')](realtime[_0xc6e6('0x22')]())[_0xc6e6('0x19')](zendesk[_0xc6e6('0x23')]())[_0xc6e6('0x19')](realtime[_0xc6e6('0x24')]())[_0xc6e6('0x19')](salesforce['getSalesforceAccounts']())[_0xc6e6('0x19')](realtime['initSalesforceAccounts']())[_0xc6e6('0x19')](sugarcrm[_0xc6e6('0x25')]())[_0xc6e6('0x19')](realtime[_0xc6e6('0x26')]())['then'](freshdesk[_0xc6e6('0x27')]())[_0xc6e6('0x19')](realtime[_0xc6e6('0x28')]())[_0xc6e6('0x19')](desk[_0xc6e6('0x29')]())['then'](realtime[_0xc6e6('0x2a')]())['then'](zoho[_0xc6e6('0x2b')]())[_0xc6e6('0x19')](realtime[_0xc6e6('0x2c')]())[_0xc6e6('0x19')](vtiger['getVtigerAccounts']())[_0xc6e6('0x19')](realtime['initVtigerAccounts']())[_0xc6e6('0x19')](freshsales['getFreshsalesAccounts']())[_0xc6e6('0x19')](realtime[_0xc6e6('0x2d')]())[_0xc6e6('0x19')](servicenow[_0xc6e6('0x2e')]())[_0xc6e6('0x19')](realtime['initServicenowAccounts']())[_0xc6e6('0x19')](dynamics365[_0xc6e6('0x2f')]())[_0xc6e6('0x19')](realtime[_0xc6e6('0x30')]())['then'](campaign[_0xc6e6('0x31')]())['then'](realtime[_0xc6e6('0x32')]())[_0xc6e6('0x19')](voiceExtension[_0xc6e6('0x33')]())[_0xc6e6('0x19')](realtime[_0xc6e6('0x34')]())[_0xc6e6('0x19')](faxAccount[_0xc6e6('0x35')]())[_0xc6e6('0x19')](realtime[_0xc6e6('0x36')]())[_0xc6e6('0x19')](function(){return realtime;});}function initParams(){return BPromise[_0xc6e6('0x18')]()[_0xc6e6('0x19')](voiceQueueReport[_0xc6e6('0x37')]())[_0xc6e6('0x19')](realtime[_0xc6e6('0x38')]())[_0xc6e6('0x19')](cmHopperHistory[_0xc6e6('0x39')]())['then'](realtime[_0xc6e6('0x3a')]())[_0xc6e6('0x19')](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime[_0xc6e6('0x3b')]())[_0xc6e6('0x19')](voiceCallReport[_0xc6e6('0x3c')]())[_0xc6e6('0x19')](realtime[_0xc6e6('0x3d')]())[_0xc6e6('0x19')](function(_0x59a8f0){})[_0xc6e6('0x3e')](function(_0x46098f){console[_0xc6e6('0x3f')](_0x46098f);});}function main(){return server['listen'](realtime,preview,fax)['then'](function(_0xa5138d){return initRealtime();})[_0xc6e6('0x19')](function(){return initParams();})[_0xc6e6('0x19')](function(){report[_0xc6e6('0x40')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x59ac83){console[_0xc6e6('0x3f')](_0x59ac83);});}main(); \ No newline at end of file +var _0xbaf0=['initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initVoiceCallReports','log','sync','catch','util','moment','./server','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','hour','get','resolve','getAgents','initAgents','then','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var BPromise=require('bluebird');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var server=require(_0x0baf('0x2'));var Realtime=require(_0x0baf('0x3'));var Report=require(_0x0baf('0x4'));var Acw=require(_0x0baf('0x5'));var Trigger=require('./trigger');var Dialer=require(_0x0baf('0x6'));var Preview=require(_0x0baf('0x7'));var Fax=require(_0x0baf('0x8'));var user=require(_0x0baf('0x9'));var voiceQueue=require(_0x0baf('0xa'));var voiceQueueReport=require(_0x0baf('0xb'));var voiceCallReport=require(_0x0baf('0xc'));var trunk=require(_0x0baf('0xd'));var trigger=require(_0x0baf('0xe'));var template=require('./rpc/template');var cmHopperHistory=require(_0x0baf('0xf'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x0baf('0x10'));var faxAccount=require(_0x0baf('0x11'));var zendesk=require(_0x0baf('0x12'));var salesforce=require(_0x0baf('0x13'));var sugarcrm=require(_0x0baf('0x14'));var freshdesk=require(_0x0baf('0x15'));var desk=require(_0x0baf('0x16'));var zoho=require(_0x0baf('0x17'));var vtiger=require(_0x0baf('0x18'));var freshsales=require(_0x0baf('0x19'));var servicenow=require(_0x0baf('0x1a'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x0baf('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0baf('0x1c')](_0x0baf('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x0baf('0x1d')]()['then'](user[_0x0baf('0x1e')]())['then'](realtime[_0x0baf('0x1f')]())[_0x0baf('0x20')](user[_0x0baf('0x21')]())[_0x0baf('0x20')](realtime[_0x0baf('0x22')]())[_0x0baf('0x20')](trunk['getTrunks']())['then'](realtime[_0x0baf('0x23')]())[_0x0baf('0x20')](voiceQueue[_0x0baf('0x24')]())[_0x0baf('0x20')](realtime[_0x0baf('0x25')]())[_0x0baf('0x20')](trigger['getTriggers']())[_0x0baf('0x20')](realtime[_0x0baf('0x26')]())[_0x0baf('0x20')](template[_0x0baf('0x27')]())[_0x0baf('0x20')](realtime[_0x0baf('0x28')]())['then'](zendesk['getZendeskAccounts']())[_0x0baf('0x20')](realtime[_0x0baf('0x29')]())[_0x0baf('0x20')](salesforce[_0x0baf('0x2a')]())[_0x0baf('0x20')](realtime[_0x0baf('0x2b')]())[_0x0baf('0x20')](sugarcrm[_0x0baf('0x2c')]())[_0x0baf('0x20')](realtime[_0x0baf('0x2d')]())['then'](freshdesk[_0x0baf('0x2e')]())['then'](realtime[_0x0baf('0x2f')]())['then'](desk['getDeskAccounts']())[_0x0baf('0x20')](realtime['initDeskAccounts']())['then'](zoho[_0x0baf('0x30')]())[_0x0baf('0x20')](realtime[_0x0baf('0x31')]())[_0x0baf('0x20')](vtiger[_0x0baf('0x32')]())['then'](realtime[_0x0baf('0x33')]())[_0x0baf('0x20')](freshsales[_0x0baf('0x34')]())[_0x0baf('0x20')](realtime[_0x0baf('0x35')]())[_0x0baf('0x20')](servicenow[_0x0baf('0x36')]())['then'](realtime[_0x0baf('0x37')]())[_0x0baf('0x20')](dynamics365[_0x0baf('0x38')]())[_0x0baf('0x20')](realtime['initDynamics365Accounts']())[_0x0baf('0x20')](campaign[_0x0baf('0x39')]())['then'](realtime[_0x0baf('0x3a')]())[_0x0baf('0x20')](voiceExtension[_0x0baf('0x3b')]())[_0x0baf('0x20')](realtime[_0x0baf('0x3c')]())[_0x0baf('0x20')](faxAccount[_0x0baf('0x3d')]())['then'](realtime[_0x0baf('0x3e')]())[_0x0baf('0x20')](function(){return realtime;});}function initParams(){return BPromise[_0x0baf('0x1d')]()[_0x0baf('0x20')](voiceQueueReport[_0x0baf('0x3f')]())[_0x0baf('0x20')](realtime[_0x0baf('0x40')]())[_0x0baf('0x20')](cmHopperHistory[_0x0baf('0x41')]())[_0x0baf('0x20')](realtime[_0x0baf('0x42')]())[_0x0baf('0x20')](cmHopperHistory[_0x0baf('0x43')]())[_0x0baf('0x20')](realtime['initCampaignHopperHistory']())[_0x0baf('0x20')](voiceCallReport['getVoiceCallReports']())[_0x0baf('0x20')](realtime[_0x0baf('0x44')]())[_0x0baf('0x20')](function(_0x3d65f2){})['catch'](function(_0x1a2b03){console[_0x0baf('0x45')](_0x1a2b03);});}function main(){return server['listen'](realtime,preview,fax)[_0x0baf('0x20')](function(_0x2447c2){return initRealtime();})[_0x0baf('0x20')](function(){return initParams();})[_0x0baf('0x20')](function(){report[_0x0baf('0x46')]();setInterval(initRealtime,0x1388);})[_0x0baf('0x47')](function(_0xe03d82){console[_0x0baf('0x45')](_0xe03d82);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 69965f6..3c1823d 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 _0x9f6e=['../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','local','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','format','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','stringify','md5','user:%s','user:save','user:presence','lodash','moment','ioredis'];(function(_0x8174f7,_0x149345){var _0x3c7333=function(_0xc12280){while(--_0xc12280){_0x8174f7['push'](_0x8174f7['shift']());}};_0x3c7333(++_0x149345);}(_0x9f6e,0x145));var _0xe9f6=function(_0x1b9285,_0x5ccf86){_0x1b9285=_0x1b9285-0x0;var _0x57891f=_0x9f6e[_0x1b9285];return _0x57891f;};'use strict';var _=require(_0xe9f6('0x0'));var util=require('util');var moment=require(_0xe9f6('0x1'));var md5=require('md5');var Redis=require(_0xe9f6('0x2'));var config=require(_0xe9f6('0x3'));config['redis']=_[_0xe9f6('0x4')](config[_0xe9f6('0x5')],{'host':_0xe9f6('0x6'),'port':0x18eb});var io=require(_0xe9f6('0x7'))(new Redis(config['redis']));function Agent(_0x3742df){this['id']=_0x3742df['id']||0x0;this[_0xe9f6('0x8')]=_0x3742df[_0xe9f6('0x8')]||'';this[_0xe9f6('0x9')]=_0x3742df[_0xe9f6('0x9')]||'';this[_0xe9f6('0xa')]=_0x3742df[_0xe9f6('0xa')]||'';this[_0xe9f6('0xb')]=_0x3742df['fullname']||'';this[_0xe9f6('0xc')]=_0xe9f6('0xd');this[_0xe9f6('0xe')]=0x0;this[_0xe9f6('0xf')]='unknown';this[_0xe9f6('0x10')]='';this[_0xe9f6('0x11')]='';this[_0xe9f6('0x12')]='';this[_0xe9f6('0x13')]='';this[_0xe9f6('0x14')]=_0x3742df['online']||![];this[_0xe9f6('0x15')]=_0xe9f6('0xd');this[_0xe9f6('0x16')]=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this['onhold']=![];this[_0xe9f6('0x17')]=![];this['md5']='';}Agent['prototype'][_0xe9f6('0x18')]=function(_0x16df38){var _0x59b206;if(_0x16df38&&_0x16df38['state']){_0x59b206=_0x16df38[_0xe9f6('0xc')][_0xe9f6('0x19')]();switch(_0x59b206){case _0xe9f6('0x1a'):_0x59b206=_0xe9f6('0x1b');break;case _0xe9f6('0x1c'):_0x59b206=_0xe9f6('0x1d');break;}}if(_0x59b206&&this[_0xe9f6('0x15')]!==_0x59b206||_0x16df38[_0xe9f6('0x1e')]){this[_0xe9f6('0x16')]=_[_0xe9f6('0x1f')](moment()[_0xe9f6('0x20')]('x'));}if(_0x59b206){this[_0xe9f6('0x15')]=_0x59b206;}var _0x3b192e={'id':this['id'],'name':this[_0xe9f6('0x8')],'email':this['email'],'accountcode':this['accountcode'],'fullname':this[_0xe9f6('0xb')],'state':this['state'],'stateTime':this[_0xe9f6('0xe')],'status':this['status'],'address':this[_0xe9f6('0x10')],'online':this['online'],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xe9f6('0x16')],'voiceStatusCallerIdNumber':this[_0xe9f6('0x21')],'voiceStatusQueue':this[_0xe9f6('0x22')],'interface':this[_0xe9f6('0x13')],'onhold':this[_0xe9f6('0x23')]};var _0x4e0ffd=md5(JSON[_0xe9f6('0x24')](_0x3b192e));if(this['md5']!==_0x4e0ffd){this[_0xe9f6('0x25')]=_0x4e0ffd;io['to'](util[_0xe9f6('0x20')](_0xe9f6('0x26'),_0x3b192e[_0xe9f6('0x8')]))['emit'](_0xe9f6('0x27'),_0x3b192e);io['emit'](_0xe9f6('0x28'),_0x3b192e);}};module['exports']=Agent; \ No newline at end of file +var _0xa07e=['emit','user:save','user:presence','exports','moment','ioredis','redis','localhost','socket.io-emitter','name','email','accountcode','unknown','stateTime','address','mobile','online','voiceStatus','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','idle','inuse','voiceStatusTime','format','fullname','status','voiceStatusCallerIdNumber','interface','stringify','md5','user:%s'];(function(_0x26a84c,_0x5724a7){var _0xa7793f=function(_0x34b8e2){while(--_0x34b8e2){_0x26a84c['push'](_0x26a84c['shift']());}};_0xa7793f(++_0x5724a7);}(_0xa07e,0x162));var _0xea07=function(_0x55f66b,_0x397a49){_0x55f66b=_0x55f66b-0x0;var _0x5edab4=_0xa07e[_0x55f66b];return _0x5edab4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xea07('0x0'));var md5=require('md5');var Redis=require(_0xea07('0x1'));var config=require('../../../config/environment');config[_0xea07('0x2')]=_['defaults'](config['redis'],{'host':_0xea07('0x3'),'port':0x18eb});var io=require(_0xea07('0x4'))(new Redis(config['redis']));function Agent(_0x1e7564){this['id']=_0x1e7564['id']||0x0;this[_0xea07('0x5')]=_0x1e7564[_0xea07('0x5')]||'';this['email']=_0x1e7564[_0xea07('0x6')]||'';this[_0xea07('0x7')]=_0x1e7564['accountcode']||'';this['fullname']=_0x1e7564['fullname']||'';this['state']=_0xea07('0x8');this[_0xea07('0x9')]=0x0;this['status']='unknown';this[_0xea07('0xa')]='';this['phone']='';this[_0xea07('0xb')]='';this['interface']='';this[_0xea07('0xc')]=_0x1e7564['online']||![];this[_0xea07('0xd')]=_0xea07('0x8');this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0xea07('0xe')]='';this[_0xea07('0xf')]=![];this['local']=![];this['md5']='';}Agent[_0xea07('0x10')][_0xea07('0x11')]=function(_0x3a0329){var _0x843d16;if(_0x3a0329&&_0x3a0329['state']){_0x843d16=_0x3a0329[_0xea07('0x12')][_0xea07('0x13')]();switch(_0x843d16){case'not_inuse':_0x843d16=_0xea07('0x14');break;case _0xea07('0x15'):_0x843d16='talking';break;}}if(_0x843d16&&this[_0xea07('0xd')]!==_0x843d16||_0x3a0329['statePause']){this[_0xea07('0x16')]=_['toNumber'](moment()[_0xea07('0x17')]('x'));}if(_0x843d16){this[_0xea07('0xd')]=_0x843d16;}var _0x558b2b={'id':this['id'],'name':this[_0xea07('0x5')],'email':this[_0xea07('0x6')],'accountcode':this[_0xea07('0x7')],'fullname':this[_0xea07('0x18')],'state':this[_0xea07('0x12')],'stateTime':this[_0xea07('0x9')],'status':this[_0xea07('0x19')],'address':this[_0xea07('0xa')],'online':this[_0xea07('0xc')],'voiceStatus':this[_0xea07('0xd')],'voiceStatusTime':this[_0xea07('0x16')],'voiceStatusCallerIdNumber':this[_0xea07('0x1a')],'voiceStatusQueue':this[_0xea07('0xe')],'interface':this[_0xea07('0x1b')],'onhold':this[_0xea07('0xf')]};var _0x75a6b5=md5(JSON[_0xea07('0x1c')](_0x558b2b));if(this[_0xea07('0x1d')]!==_0x75a6b5){this[_0xea07('0x1d')]=_0x75a6b5;io['to'](util['format'](_0xea07('0x1e'),_0x558b2b[_0xea07('0x5')]))[_0xea07('0x1f')](_0xea07('0x20'),_0x558b2b);io['emit'](_0xea07('0x21'),_0x558b2b);}};module[_0xea07('0x22')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index bd08873..05a26ce 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 _0x6b94=['dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting'];(function(_0x5bbbeb,_0x207649){var _0x24a7d8=function(_0x4f491){while(--_0x4f491){_0x5bbbeb['push'](_0x5bbbeb['shift']());}};_0x24a7d8(++_0x207649);}(_0x6b94,0xa1));var _0x46b9=function(_0x284c26,_0x4f0391){_0x284c26=_0x284c26-0x0;var _0x405c22=_0x6b94[_0x284c26];return _0x405c22;};'use strict';function Campaign(_0x11da75){this['id']=_0x11da75['id']||0x0;this[_0x46b9('0x0')]=_0x11da75[_0x46b9('0x0')]||'';this[_0x46b9('0x1')]=_0x11da75[_0x46b9('0x1')]||'campaign';this[_0x46b9('0x2')]=0x0;this[_0x46b9('0x3')]=0x0;this[_0x46b9('0x4')]=0x0;this[_0x46b9('0x5')]=0x0;this[_0x46b9('0x6')]='';this['sendMessageOneNotActive']=!![];this[_0x46b9('0x7')]=_0x11da75[_0x46b9('0x7')];this[_0x46b9('0x8')]=_0x11da75[_0x46b9('0x8')];this['dialTimezone']=_0x11da75[_0x46b9('0x9')]||null;this[_0x46b9('0xa')]=_0x11da75[_0x46b9('0xa')]?_0x11da75[_0x46b9('0xa')]:null;this[_0x46b9('0xb')]=_0x11da75[_0x46b9('0xb')];this['dialOriginateCallerIdNumber']=_0x11da75[_0x46b9('0xc')];this[_0x46b9('0xd')]=_0x11da75[_0x46b9('0xd')]||0x1e;this[_0x46b9('0xe')]=_0x11da75[_0x46b9('0xe')];this[_0x46b9('0xf')]=_0x11da75[_0x46b9('0xf')];this[_0x46b9('0x10')]=_0x11da75[_0x46b9('0x10')];this[_0x46b9('0x11')]=_0x11da75['dialBusyRetryFrequency'];this[_0x46b9('0x12')]=_0x11da75[_0x46b9('0x12')];this['dialNoAnswerRetryFrequency']=_0x11da75[_0x46b9('0x13')];this['dialGlobalMaxRetry']=_0x11da75[_0x46b9('0x14')];this[_0x46b9('0x15')]=_0x11da75[_0x46b9('0x15')]||0x3;this[_0x46b9('0x16')]=_0x11da75[_0x46b9('0x16')]||0x96;this[_0x46b9('0x17')]=_0x11da75['dialDropMaxRetry']||0x3;this[_0x46b9('0x18')]=_0x11da75[_0x46b9('0x18')]||0x96;this[_0x46b9('0x19')]=_0x11da75[_0x46b9('0x19')]||0x3;this[_0x46b9('0x1a')]=_0x11da75['dialAbandonedRetryFrequency']||0x96;this[_0x46b9('0x1b')]=_0x11da75[_0x46b9('0x1b')]||0x3;this['dialMachineRetryFrequency']=_0x11da75[_0x46b9('0x1c')]||0x96;this[_0x46b9('0x1d')]=_0x11da75[_0x46b9('0x1d')]||0x3;this[_0x46b9('0x1e')]=_0x11da75[_0x46b9('0x1e')]||0x96;this[_0x46b9('0x1f')]=_0x11da75[_0x46b9('0x1f')]||'DESC';this[_0x46b9('0x20')]=_0x11da75[_0x46b9('0x20')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x11da75[_0x46b9('0x21')]||undefined;this['dialCutDigit']=_0x11da75[_0x46b9('0x22')]||undefined;this[_0x46b9('0x23')]=_0x11da75['TrunkBackup']?_0x11da75['TrunkBackup']:undefined;this[_0x46b9('0x24')]=_0x11da75[_0x46b9('0x24')]?_0x11da75[_0x46b9('0x24')]:undefined;this['Interval']=_0x11da75[_0x46b9('0x25')]?_0x11da75[_0x46b9('0x25')]:undefined;this[_0x46b9('0x26')]=_0x11da75[_0x46b9('0x26')]?_0x11da75[_0x46b9('0x26')]:undefined;this[_0x46b9('0x27')]=_0x11da75[_0x46b9('0x26')]?_0x11da75[_0x46b9('0x26')]['name']:undefined;this[_0x46b9('0x28')]=_0x11da75[_0x46b9('0x28')]||![];this[_0x46b9('0x29')]=_0x11da75[_0x46b9('0x29')];this['dialAMDGreeting']=_0x11da75[_0x46b9('0x2a')];this[_0x46b9('0x2b')]=_0x11da75[_0x46b9('0x2b')];this[_0x46b9('0x2c')]=_0x11da75['dialAMDTotalAnalysisTime'];this[_0x46b9('0x2d')]=_0x11da75[_0x46b9('0x2d')];this[_0x46b9('0x2e')]=_0x11da75[_0x46b9('0x2e')];this[_0x46b9('0x2f')]=_0x11da75[_0x46b9('0x2f')];this[_0x46b9('0x30')]=_0x11da75[_0x46b9('0x30')];this['dialAMDMaximumWordLength']=_0x11da75[_0x46b9('0x31')];}module[_0x46b9('0x32')]=Campaign; \ No newline at end of file +var _0xece9=['dialNoSuchNumberRetryFrequency','dialDropMaxRetry','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','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry'];(function(_0x59242b,_0x226010){var _0x4d65dd=function(_0x5ebd0a){while(--_0x5ebd0a){_0x59242b['push'](_0x59242b['shift']());}};_0x4d65dd(++_0x226010);}(_0xece9,0x155));var _0x9ece=function(_0x43c5b2,_0x2b9dc3){_0x43c5b2=_0x43c5b2-0x0;var _0x513c2b=_0xece9[_0x43c5b2];return _0x513c2b;};'use strict';function Campaign(_0xd8625e){this['id']=_0xd8625e['id']||0x0;this[_0x9ece('0x0')]=_0xd8625e['name']||'';this[_0x9ece('0x1')]=_0xd8625e[_0x9ece('0x1')]||_0x9ece('0x2');this['originated']=0x0;this[_0x9ece('0x3')]=0x0;this[_0x9ece('0x4')]=0x0;this[_0x9ece('0x5')]=0x0;this[_0x9ece('0x6')]='';this[_0x9ece('0x7')]=!![];this[_0x9ece('0x8')]=_0xd8625e[_0x9ece('0x8')];this['limitCalls']=_0xd8625e[_0x9ece('0x9')];this[_0x9ece('0xa')]=_0xd8625e[_0x9ece('0xa')]||null;this['dialGlobalInterval']=_0xd8625e['dialGlobalInterval']?_0xd8625e[_0x9ece('0xb')]:null;this['dialOriginateCallerIdName']=_0xd8625e[_0x9ece('0xc')];this['dialOriginateCallerIdNumber']=_0xd8625e[_0x9ece('0xd')];this[_0x9ece('0xe')]=_0xd8625e['dialOriginateTimeout']||0x1e;this[_0x9ece('0xf')]=_0xd8625e[_0x9ece('0xf')];this[_0x9ece('0x10')]=_0xd8625e[_0x9ece('0x10')];this[_0x9ece('0x11')]=_0xd8625e['dialBusyMaxRetry'];this[_0x9ece('0x12')]=_0xd8625e[_0x9ece('0x12')];this[_0x9ece('0x13')]=_0xd8625e['dialNoAnswerMaxRetry'];this[_0x9ece('0x14')]=_0xd8625e['dialNoAnswerRetryFrequency'];this[_0x9ece('0x15')]=_0xd8625e['dialGlobalMaxRetry'];this[_0x9ece('0x16')]=_0xd8625e[_0x9ece('0x16')]||0x3;this[_0x9ece('0x17')]=_0xd8625e['dialNoSuchNumberRetryFrequency']||0x96;this[_0x9ece('0x18')]=_0xd8625e['dialDropMaxRetry']||0x3;this[_0x9ece('0x19')]=_0xd8625e[_0x9ece('0x19')]||0x96;this[_0x9ece('0x1a')]=_0xd8625e[_0x9ece('0x1a')]||0x3;this[_0x9ece('0x1b')]=_0xd8625e[_0x9ece('0x1b')]||0x96;this[_0x9ece('0x1c')]=_0xd8625e[_0x9ece('0x1c')]||0x3;this[_0x9ece('0x1d')]=_0xd8625e[_0x9ece('0x1d')]||0x96;this[_0x9ece('0x1e')]=_0xd8625e[_0x9ece('0x1e')]||0x3;this[_0x9ece('0x1f')]=_0xd8625e[_0x9ece('0x1f')]||0x96;this[_0x9ece('0x20')]=_0xd8625e['dialOrderByScheduledAt']||_0x9ece('0x21');this[_0x9ece('0x22')]=_0xd8625e[_0x9ece('0x22')]||undefined;this[_0x9ece('0x23')]=_0xd8625e[_0x9ece('0x23')]||undefined;this[_0x9ece('0x24')]=_0xd8625e[_0x9ece('0x24')]||undefined;this[_0x9ece('0x25')]=_0xd8625e[_0x9ece('0x25')]?_0xd8625e['TrunkBackup']:undefined;this['Trunk']=_0xd8625e[_0x9ece('0x26')]?_0xd8625e['Trunk']:undefined;this[_0x9ece('0x27')]=_0xd8625e[_0x9ece('0x27')]?_0xd8625e[_0x9ece('0x27')]:undefined;this[_0x9ece('0x28')]=_0xd8625e[_0x9ece('0x28')]?_0xd8625e[_0x9ece('0x28')]:undefined;this[_0x9ece('0x29')]=_0xd8625e[_0x9ece('0x28')]?_0xd8625e[_0x9ece('0x28')][_0x9ece('0x0')]:undefined;this[_0x9ece('0x2a')]=_0xd8625e[_0x9ece('0x2a')]||![];this[_0x9ece('0x2b')]=_0xd8625e[_0x9ece('0x2b')];this[_0x9ece('0x2c')]=_0xd8625e['dialAMDGreeting'];this[_0x9ece('0x2d')]=_0xd8625e[_0x9ece('0x2d')];this[_0x9ece('0x2e')]=_0xd8625e[_0x9ece('0x2e')];this['dialAMDMinWordLength']=_0xd8625e[_0x9ece('0x2f')];this[_0x9ece('0x30')]=_0xd8625e[_0x9ece('0x30')];this[_0x9ece('0x31')]=_0xd8625e[_0x9ece('0x31')];this['dialAMDSilenceThreshold']=_0xd8625e[_0x9ece('0x32')];this[_0x9ece('0x33')]=_0xd8625e['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 f282fc5..5a3c2a3 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 _0x2b29=['transferconnectedlinenum','transferType','mohtime','starttime','channel','destinationchannel','calleridnum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answertime','endtime','unmanaged','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','monitorFilename','queue','monitors','transfercalleridnum'];(function(_0x1003c7,_0x377bff){var _0x3002d9=function(_0x1cbb6f){while(--_0x1cbb6f){_0x1003c7['push'](_0x1003c7['shift']());}};_0x3002d9(++_0x377bff);}(_0x2b29,0x6f));var _0x92b2=function(_0x174d53,_0x4cac01){_0x174d53=_0x174d53-0x0;var _0x5dcfc7=_0x2b29[_0x174d53];return _0x5dcfc7;};'use strict';function Channel(){this[_0x92b2('0x0')]=null;this[_0x92b2('0x1')]='';this[_0x92b2('0x2')]='';this[_0x92b2('0x3')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this[_0x92b2('0x4')]=undefined;this[_0x92b2('0x5')]=0x0;this[_0x92b2('0x6')]='';this[_0x92b2('0x7')]=0x0;this[_0x92b2('0x8')]=0x0;this[_0x92b2('0x9')]=0x0;this['answered']=![];this[_0x92b2('0xa')]=null;this[_0x92b2('0xb')]=null;this[_0x92b2('0xc')]=![];this['abandoned']=![];this[_0x92b2('0xd')]='';this[_0x92b2('0xe')]='';this[_0x92b2('0xf')]=0x0;this[_0x92b2('0x10')]=0x0;this[_0x92b2('0x11')]=0x0;this[_0x92b2('0x12')]=null;this[_0x92b2('0x13')]=null;this['disposition']=null;this['monitor']=![];this[_0x92b2('0x14')]=null;this[_0x92b2('0x15')]=null;this[_0x92b2('0x16')]=[];this[_0x92b2('0x17')]=undefined;this[_0x92b2('0x18')]=undefined;this[_0x92b2('0x19')]=undefined;this[_0x92b2('0x1a')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xa900=['calleridnum','calleridname','connectedlinenum','accountcode','linkedid','exten','answered','answertime','unmanaged','abandoned','lastapplication','duration','billableseconds','holdtime','tag','monitor','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel'];(function(_0x1735da,_0x3996eb){var _0x185fb0=function(_0x2fd537){while(--_0x2fd537){_0x1735da['push'](_0x1735da['shift']());}};_0x185fb0(++_0x3996eb);}(_0xa900,0x101));var _0x0a90=function(_0x1652b7,_0xcd7dd5){_0x1652b7=_0x1652b7-0x0;var _0x54632e=_0xa900[_0x1652b7];return _0x54632e;};'use strict';function Channel(){this[_0x0a90('0x0')]=null;this[_0x0a90('0x1')]='';this[_0x0a90('0x2')]='';this[_0x0a90('0x3')]=0x0;this[_0x0a90('0x4')]='';this[_0x0a90('0x5')]=undefined;this['connectedlinename']=undefined;this[_0x0a90('0x6')]=0x0;this['context']='';this['uniqueid']=0x0;this[_0x0a90('0x7')]=0x0;this[_0x0a90('0x8')]=0x0;this[_0x0a90('0x9')]=![];this[_0x0a90('0xa')]=null;this['endtime']=null;this[_0x0a90('0xb')]=![];this[_0x0a90('0xc')]=![];this[_0x0a90('0xd')]='';this['lastdata']='';this[_0x0a90('0xe')]=0x0;this[_0x0a90('0xf')]=0x0;this[_0x0a90('0x10')]=0x0;this['type']=null;this[_0x0a90('0x11')]=null;this['disposition']=null;this[_0x0a90('0x12')]=![];this[_0x0a90('0x13')]=null;this['queue']=null;this[_0x0a90('0x14')]=[];this[_0x0a90('0x15')]=undefined;this[_0x0a90('0x16')]=undefined;this[_0x0a90('0x17')]=undefined;this[_0x0a90('0x18')]=0x0;}module[_0x0a90('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 8bfb857..4c2f4b9 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 _0x379e=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','username','remoteUri','authType','password'];(function(_0x4abce7,_0x5cf46e){var _0x1914dd=function(_0x2d7e86){while(--_0x2d7e86){_0x4abce7['push'](_0x4abce7['shift']());}};_0x1914dd(++_0x5cf46e);}(_0x379e,0x104));var _0xe379=function(_0x235330,_0x17f76b){_0x235330=_0x235330-0x0;var _0x324795=_0x379e[_0x235330];return _0x324795;};'use strict';function DeskAccount(_0x2ad2d4){this['id']=_0x2ad2d4['id']||0x0;this['name']=_0x2ad2d4['name']||'';this['username']=_0x2ad2d4[_0xe379('0x0')]||'';this[_0xe379('0x1')]=_0x2ad2d4[_0xe379('0x1')]||'';this[_0xe379('0x2')]=_0x2ad2d4[_0xe379('0x2')]||'';this[_0xe379('0x3')]=_0x2ad2d4[_0xe379('0x3')]||'';this['consumerKey']=_0x2ad2d4[_0xe379('0x4')]||'';this[_0xe379('0x5')]=_0x2ad2d4[_0xe379('0x5')]||'';this[_0xe379('0x6')]=_0x2ad2d4[_0xe379('0x6')]||'';this['tokenSecret']=_0x2ad2d4[_0xe379('0x7')]||'';this[_0xe379('0x8')]=_0x2ad2d4[_0xe379('0x8')]||'';this[_0xe379('0x9')]=_0x2ad2d4[_0xe379('0x9')]||'';this[_0xe379('0xa')]=_0x2ad2d4[_0xe379('0xa')]||{};}module[_0xe379('0xb')]=DeskAccount; \ No newline at end of file +var _0x79d3=['type','serverUrl','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x4a1f96,_0x1f84bd){var _0x19d80c=function(_0x1992b0){while(--_0x1992b0){_0x4a1f96['push'](_0x4a1f96['shift']());}};_0x19d80c(++_0x1f84bd);}(_0x79d3,0x15f));var _0x379d=function(_0x3d5e72,_0x3ab167){_0x3d5e72=_0x3d5e72-0x0;var _0x2230e4=_0x79d3[_0x3d5e72];return _0x2230e4;};'use strict';function DeskAccount(_0x439d8d){this['id']=_0x439d8d['id']||0x0;this['name']=_0x439d8d[_0x379d('0x0')]||'';this['username']=_0x439d8d[_0x379d('0x1')]||'';this[_0x379d('0x2')]=_0x439d8d['remoteUri']||'';this[_0x379d('0x3')]=_0x439d8d[_0x379d('0x3')]||'';this[_0x379d('0x4')]=_0x439d8d[_0x379d('0x4')]||'';this[_0x379d('0x5')]=_0x439d8d[_0x379d('0x5')]||'';this[_0x379d('0x6')]=_0x439d8d['consumerSecret']||'';this[_0x379d('0x7')]=_0x439d8d['token']||'';this[_0x379d('0x8')]=_0x439d8d[_0x379d('0x8')]||'';this[_0x379d('0x9')]=_0x439d8d['type']||'';this[_0x379d('0xa')]=_0x439d8d['serverUrl']||'';this['Configurations']=_0x439d8d['Configurations']||{};}module[_0x379d('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 9d19d97..e8ca350 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 _0x39db=['Configurations','name','password','remoteUri','tenantId','clientSecret','serverUrl'];(function(_0x5b8a99,_0x2e0c12){var _0x31fa01=function(_0x21396c){while(--_0x21396c){_0x5b8a99['push'](_0x5b8a99['shift']());}};_0x31fa01(++_0x2e0c12);}(_0x39db,0xfd));var _0xb39d=function(_0x34c825,_0x44cad4){_0x34c825=_0x34c825-0x0;var _0x2fde13=_0x39db[_0x34c825];return _0x2fde13;};'use strict';function Dynamics365Account(_0x8c523e){this['id']=_0x8c523e['id']||0x0;this[_0xb39d('0x0')]=_0x8c523e[_0xb39d('0x0')]||'';this['username']=_0x8c523e['username']||'';this[_0xb39d('0x1')]=_0x8c523e[_0xb39d('0x1')]||'';this[_0xb39d('0x2')]=_0x8c523e[_0xb39d('0x2')]||'';this['tenantId']=_0x8c523e[_0xb39d('0x3')]||'';this['clientId']=_0x8c523e['clientId']||'';this[_0xb39d('0x4')]=_0x8c523e[_0xb39d('0x4')]||{};this[_0xb39d('0x5')]=_0x8c523e['serverUrl']||'';this[_0xb39d('0x6')]=_0x8c523e[_0xb39d('0x6')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x1708=['Configurations','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x8cb2f9,_0x2b8706){var _0x164887=function(_0x1812cc){while(--_0x1812cc){_0x8cb2f9['push'](_0x8cb2f9['shift']());}};_0x164887(++_0x2b8706);}(_0x1708,0x14e));var _0x8170=function(_0x4d7faf,_0x2c3cc9){_0x4d7faf=_0x4d7faf-0x0;var _0x5ef01d=_0x1708[_0x4d7faf];return _0x5ef01d;};'use strict';function Dynamics365Account(_0xfd2ca4){this['id']=_0xfd2ca4['id']||0x0;this['name']=_0xfd2ca4[_0x8170('0x0')]||'';this['username']=_0xfd2ca4[_0x8170('0x1')]||'';this[_0x8170('0x2')]=_0xfd2ca4[_0x8170('0x2')]||'';this[_0x8170('0x3')]=_0xfd2ca4['remoteUri']||'';this[_0x8170('0x4')]=_0xfd2ca4[_0x8170('0x4')]||'';this['clientId']=_0xfd2ca4[_0x8170('0x5')]||'';this[_0x8170('0x6')]=_0xfd2ca4[_0x8170('0x6')]||{};this[_0x8170('0x7')]=_0xfd2ca4[_0x8170('0x7')]||'';this[_0x8170('0x8')]=_0xfd2ca4[_0x8170('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 5f22184..8e25fa0 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 _0xa443=['maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate'];(function(_0x2b32c4,_0x55cbdd){var _0x5adb7a=function(_0x51aeb9){while(--_0x51aeb9){_0x2b32c4['push'](_0x2b32c4['shift']());}};_0x5adb7a(++_0x55cbdd);}(_0xa443,0x1a3));var _0x3a44=function(_0x1fec11,_0x1ae288){_0x1fec11=_0x1fec11-0x0;var _0x284e5d=_0xa443[_0x1fec11];return _0x284e5d;};'use strict';function FaxAccount(_0x5e2d29){this['id']=_0x5e2d29['id']||0x0;this[_0x3a44('0x0')]=_0x5e2d29['name']||'';this[_0x3a44('0x1')]=_0x5e2d29[_0x3a44('0x1')];this[_0x3a44('0x2')]=_0x5e2d29[_0x3a44('0x2')];this[_0x3a44('0x3')]=_0x5e2d29[_0x3a44('0x3')];this[_0x3a44('0x4')]=_0x5e2d29[_0x3a44('0x4')];this[_0x3a44('0x5')]=_0x5e2d29[_0x3a44('0x5')]||0x960;this[_0x3a44('0x6')]=_0x5e2d29[_0x3a44('0x6')]||0x3840;this['modem']=_0x5e2d29[_0x3a44('0x7')]||_0x3a44('0x8');this[_0x3a44('0x9')]=_0x5e2d29[_0x3a44('0x9')]||'no';this[_0x3a44('0xa')]=_0x5e2d29[_0x3a44('0xa')]||'no';this[_0x3a44('0xb')]=_0x5e2d29[_0x3a44('0xb')]||0x1388;this[_0x3a44('0xc')]=_0x5e2d29[_0x3a44('0xc')]||_0x3a44('0xd');this[_0x3a44('0xe')]=_0x5e2d29[_0x3a44('0xe')]?_0x5e2d29[_0x3a44('0xe')]:undefined;this[_0x3a44('0xf')]=_0x5e2d29['ListId'];this[_0x3a44('0x10')]=_0x5e2d29[_0x3a44('0x10')];}module['exports']=FaxAccount; \ No newline at end of file +var _0xef9e=['name','description','ecm','localstationid','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xef9e,0x1ef));var _0xeef9=function(_0x81492e,_0x308ef1){_0x81492e=_0x81492e-0x0;var _0x3645ac=_0xef9e[_0x81492e];return _0x3645ac;};'use strict';function FaxAccount(_0x58afd7){this['id']=_0x58afd7['id']||0x0;this['name']=_0x58afd7[_0xeef9('0x0')]||'';this[_0xeef9('0x1')]=_0x58afd7[_0xeef9('0x1')];this[_0xeef9('0x2')]=_0x58afd7[_0xeef9('0x2')];this['headerinfo']=_0x58afd7['headerinfo'];this[_0xeef9('0x3')]=_0x58afd7[_0xeef9('0x3')];this['minrate']=_0x58afd7['minrate']||0x960;this[_0xeef9('0x4')]=_0x58afd7[_0xeef9('0x4')]||0x3840;this[_0xeef9('0x5')]=_0x58afd7['modem']||_0xeef9('0x6');this['gateway']=_0x58afd7[_0xeef9('0x7')]||'no';this[_0xeef9('0x8')]=_0x58afd7[_0xeef9('0x8')]||'no';this[_0xeef9('0x9')]=_0x58afd7[_0xeef9('0x9')]||0x1388;this['tech']=_0x58afd7[_0xeef9('0xa')]||_0xeef9('0xb');this[_0xeef9('0xc')]=_0x58afd7[_0xeef9('0xc')]?_0x58afd7[_0xeef9('0xc')]:undefined;this[_0xeef9('0xd')]=_0x58afd7[_0xeef9('0xd')];this[_0xeef9('0xe')]=_0x58afd7[_0xeef9('0xe')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 559281f..85a6363 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 _0x0022=['username','token','remoteUri','Configurations','name'];(function(_0x2a24ae,_0x59da03){var _0x16e687=function(_0x4097ec){while(--_0x4097ec){_0x2a24ae['push'](_0x2a24ae['shift']());}};_0x16e687(++_0x59da03);}(_0x0022,0x180));var _0x2002=function(_0x279ff1,_0x474b5){_0x279ff1=_0x279ff1-0x0;var _0x571459=_0x0022[_0x279ff1];return _0x571459;};'use strict';function FreshdeskAccount(_0x4a702d){this['id']=_0x4a702d['id']||0x0;this[_0x2002('0x0')]=_0x4a702d[_0x2002('0x0')]||'';this[_0x2002('0x1')]=_0x4a702d[_0x2002('0x1')]||'';this['apiKey']=_0x4a702d[_0x2002('0x2')]||'';this[_0x2002('0x3')]=_0x4a702d[_0x2002('0x3')]||'';this['serverUrl']=_0x4a702d['serverUrl']||'';this[_0x2002('0x4')]=_0x4a702d['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x43ff=['exports','name','username','apiKey','remoteUri','serverUrl','Configurations'];(function(_0x2ad537,_0x3864bb){var _0x201209=function(_0x3f987c){while(--_0x3f987c){_0x2ad537['push'](_0x2ad537['shift']());}};_0x201209(++_0x3864bb);}(_0x43ff,0x1dd));var _0xf43f=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x43ff[_0x3de8a4];return _0x4635cf;};'use strict';function FreshdeskAccount(_0x5ce87f){this['id']=_0x5ce87f['id']||0x0;this[_0xf43f('0x0')]=_0x5ce87f[_0xf43f('0x0')]||'';this['username']=_0x5ce87f[_0xf43f('0x1')]||'';this[_0xf43f('0x2')]=_0x5ce87f['token']||'';this[_0xf43f('0x3')]=_0x5ce87f[_0xf43f('0x3')]||'';this['serverUrl']=_0x5ce87f[_0xf43f('0x4')]||'';this[_0xf43f('0x5')]=_0x5ce87f[_0xf43f('0x5')]||{};}module[_0xf43f('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 10ff263..b775d0d 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 _0x4d61=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x445c65,_0x2dcdce){var _0x1eb741=function(_0x4c3855){while(--_0x4c3855){_0x445c65['push'](_0x445c65['shift']());}};_0x1eb741(++_0x2dcdce);}(_0x4d61,0x1ab));var _0x14d6=function(_0xb61d88,_0x388bba){_0xb61d88=_0xb61d88-0x0;var _0x196a0d=_0x4d61[_0xb61d88];return _0x196a0d;};'use strict';function FreshsalesAccount(_0x3f8aae){this['id']=_0x3f8aae['id']||0x0;this['name']=_0x3f8aae[_0x14d6('0x0')]||'';this[_0x14d6('0x1')]=_0x3f8aae[_0x14d6('0x1')]||'';this[_0x14d6('0x2')]=_0x3f8aae[_0x14d6('0x3')]||'';this[_0x14d6('0x4')]=_0x3f8aae[_0x14d6('0x4')]||'';this['serverUrl']=_0x3f8aae[_0x14d6('0x5')]||'';this[_0x14d6('0x6')]=_0x3f8aae[_0x14d6('0x6')]||{};}module[_0x14d6('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xe2ee=['serverUrl','Configurations','username','apiKey','token'];(function(_0x4441c1,_0x3841c0){var _0x579d72=function(_0x26d90d){while(--_0x26d90d){_0x4441c1['push'](_0x4441c1['shift']());}};_0x579d72(++_0x3841c0);}(_0xe2ee,0xbb));var _0xee2e=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0xe2ee[_0x2d61b2];return _0x12df89;};'use strict';function FreshsalesAccount(_0x2597bd){this['id']=_0x2597bd['id']||0x0;this['name']=_0x2597bd['name']||'';this[_0xee2e('0x0')]=_0x2597bd['username']||'';this[_0xee2e('0x1')]=_0x2597bd[_0xee2e('0x2')]||'';this['remoteUri']=_0x2597bd['remoteUri']||'';this[_0xee2e('0x3')]=_0x2597bd[_0xee2e('0x3')]||'';this['Configurations']=_0x2597bd[_0xee2e('0x4')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 9823134..8ba25e8 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 _0x10ff=['queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','connectedlinename','accountcode','exten','priority','assigned','lastAssignedTo','variables','exports','type','calleridnum','calleridname','queuecallerjoinAt'];(function(_0x47973b,_0xb524ea){var _0x4ccad6=function(_0x26bb11){while(--_0x26bb11){_0x47973b['push'](_0x47973b['shift']());}};_0x4ccad6(++_0xb524ea);}(_0x10ff,0x1b5));var _0xf10f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x10ff[_0x321bb2];return _0x9c12ed;};'use strict';function QueueReport(){this[_0xf10f('0x0')]='inbound';this['uniqueid']='';this[_0xf10f('0x1')]='';this[_0xf10f('0x2')]='';this['queue']='';this[_0xf10f('0x3')]=null;this[_0xf10f('0x4')]=null;this[_0xf10f('0x5')]=0x1;this[_0xf10f('0x6')]=0x1;this[_0xf10f('0x7')]=![];this[_0xf10f('0x8')]=null;this[_0xf10f('0x9')]=![];this[_0xf10f('0xa')]=null;this[_0xf10f('0xb')]=![];this[_0xf10f('0xc')]=null;this['originalposition']=0x1;this['channel']='';this['connectedlinenum']='';this[_0xf10f('0xd')]='';this[_0xf10f('0xe')]='';this['context']='';this[_0xf10f('0xf')]='';this[_0xf10f('0x10')]='';this['holdtime']=0x0;this[_0xf10f('0x11')]=![];this[_0xf10f('0x12')]='';this['mohtime']=0x0;this[_0xf10f('0x13')]={};}module[_0xf10f('0x14')]=QueueReport; \ No newline at end of file +var _0xa52d=['queuecallerjoinAt','queuecallerleaveAt','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','context','exten','priority','assigned','lastAssignedTo','exports','type','uniqueid','calleridnum','calleridname'];(function(_0x19d465,_0x3af538){var _0x1ad248=function(_0x1a8dfa){while(--_0x1a8dfa){_0x19d465['push'](_0x19d465['shift']());}};_0x1ad248(++_0x3af538);}(_0xa52d,0x6e));var _0xda52=function(_0x5ca5bc,_0x5b8a9d){_0x5ca5bc=_0x5ca5bc-0x0;var _0x26ca86=_0xa52d[_0x5ca5bc];return _0x26ca86;};'use strict';function QueueReport(){this[_0xda52('0x0')]='inbound';this[_0xda52('0x1')]='';this[_0xda52('0x2')]='';this[_0xda52('0x3')]='';this['queue']='';this[_0xda52('0x4')]=null;this[_0xda52('0x5')]=null;this['position']=0x1;this['count']=0x1;this['queuecallerabandon']=![];this[_0xda52('0x6')]=null;this[_0xda52('0x7')]=![];this[_0xda52('0x8')]=null;this[_0xda52('0x9')]=![];this[_0xda52('0xa')]=null;this[_0xda52('0xb')]=0x1;this[_0xda52('0xc')]='';this['connectedlinenum']='';this['connectedlinename']='';this['accountcode']='';this[_0xda52('0xd')]='';this[_0xda52('0xe')]='';this[_0xda52('0xf')]='';this['holdtime']=0x0;this[_0xda52('0x10')]=![];this[_0xda52('0x11')]='';this['mohtime']=0x0;this['variables']={};}module[_0xda52('0x12')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 62ccbae..4ce1d66 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 _0xb891=['integrationTab','serverUrl','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x4fc212,_0x1087aa){var _0x252317=function(_0x6facac){while(--_0x6facac){_0x4fc212['push'](_0x4fc212['shift']());}};_0x252317(++_0x1087aa);}(_0xb891,0x1dc));var _0x1b89=function(_0x9c99d8,_0x34342c){_0x9c99d8=_0x9c99d8-0x0;var _0x7f8f29=_0xb891[_0x9c99d8];return _0x7f8f29;};'use strict';function SalesforceAccount(_0x5bca58){this['id']=_0x5bca58['id']||0x0;this[_0x1b89('0x0')]=_0x5bca58[_0x1b89('0x0')]||'';this[_0x1b89('0x1')]=_0x5bca58['username']||'';this[_0x1b89('0x2')]=_0x5bca58['remoteUri']||'';this['password']=_0x5bca58[_0x1b89('0x3')]||'';this[_0x1b89('0x4')]=_0x5bca58[_0x1b89('0x4')]||'';this[_0x1b89('0x5')]=_0x5bca58[_0x1b89('0x5')]||'';this[_0x1b89('0x6')]=_0x5bca58[_0x1b89('0x6')]||'';this['type']=_0x5bca58[_0x1b89('0x7')]||_0x1b89('0x8');this[_0x1b89('0x9')]=_0x5bca58[_0x1b89('0x9')]||'';this['Configurations']=_0x5bca58['Configurations']||{};}module[_0x1b89('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x387d=['securityToken','type','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x279ce4,_0x13a3c8){var _0x3e8bcd=function(_0x122463){while(--_0x122463){_0x279ce4['push'](_0x279ce4['shift']());}};_0x3e8bcd(++_0x13a3c8);}(_0x387d,0x19e));var _0xd387=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x387d[_0x297fd3];return _0x2af381;};'use strict';function SalesforceAccount(_0x507933){this['id']=_0x507933['id']||0x0;this[_0xd387('0x0')]=_0x507933[_0xd387('0x0')]||'';this[_0xd387('0x1')]=_0x507933[_0xd387('0x1')]||'';this[_0xd387('0x2')]=_0x507933[_0xd387('0x2')]||'';this['password']=_0x507933[_0xd387('0x3')]||'';this[_0xd387('0x4')]=_0x507933[_0xd387('0x4')]||'';this[_0xd387('0x5')]=_0x507933[_0xd387('0x5')]||'';this[_0xd387('0x6')]=_0x507933[_0xd387('0x6')]||'';this[_0xd387('0x7')]=_0x507933[_0xd387('0x7')]||'integrationTab';this[_0xd387('0x8')]=_0x507933[_0xd387('0x8')]||'';this[_0xd387('0x9')]=_0x507933['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 8b1d6a1..45adf66 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 _0xaa03=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x4f140e,_0x574bee){var _0x357343=function(_0x489ebc){while(--_0x489ebc){_0x4f140e['push'](_0x4f140e['shift']());}};_0x357343(++_0x574bee);}(_0xaa03,0x112));var _0x3aa0=function(_0x4eee6d,_0x551211){_0x4eee6d=_0x4eee6d-0x0;var _0x18fed0=_0xaa03[_0x4eee6d];return _0x18fed0;};'use strict';function ServicenowAccount(_0x2d0f99){this['id']=_0x2d0f99['id']||0x0;this[_0x3aa0('0x0')]=_0x2d0f99[_0x3aa0('0x0')]||'';this['username']=_0x2d0f99[_0x3aa0('0x1')]||'';this[_0x3aa0('0x2')]=_0x2d0f99[_0x3aa0('0x2')]||'';this[_0x3aa0('0x3')]=_0x2d0f99[_0x3aa0('0x3')]||'';this[_0x3aa0('0x4')]=_0x2d0f99[_0x3aa0('0x4')]||'';this[_0x3aa0('0x5')]=_0x2d0f99[_0x3aa0('0x5')]||{};}module[_0x3aa0('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x3c07=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x1a8f03,_0x20d0fe){var _0x37956e=function(_0x26e597){while(--_0x26e597){_0x1a8f03['push'](_0x1a8f03['shift']());}};_0x37956e(++_0x20d0fe);}(_0x3c07,0x185));var _0x73c0=function(_0x10346c,_0x183ce6){_0x10346c=_0x10346c-0x0;var _0x262bd4=_0x3c07[_0x10346c];return _0x262bd4;};'use strict';function ServicenowAccount(_0x48a96a){this['id']=_0x48a96a['id']||0x0;this['name']=_0x48a96a[_0x73c0('0x0')]||'';this[_0x73c0('0x1')]=_0x48a96a[_0x73c0('0x1')]||'';this[_0x73c0('0x2')]=_0x48a96a[_0x73c0('0x2')]||'';this['remoteUri']=_0x48a96a[_0x73c0('0x3')]||'';this[_0x73c0('0x4')]=_0x48a96a['serverUrl']||'';this[_0x73c0('0x5')]=_0x48a96a[_0x73c0('0x5')]||{};}module[_0x73c0('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 650febd..f363da1 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 _0xca0b=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x2c8802,_0x4ad8e4){var _0x29fefc=function(_0x92772b){while(--_0x92772b){_0x2c8802['push'](_0x2c8802['shift']());}};_0x29fefc(++_0x4ad8e4);}(_0xca0b,0x104));var _0xbca0=function(_0x426f31,_0x3b37cc){_0x426f31=_0x426f31-0x0;var _0x5f0aab=_0xca0b[_0x426f31];return _0x5f0aab;};'use strict';function SugarcrmAccount(_0x296b17){this['id']=_0x296b17['id']||0x0;this[_0xbca0('0x0')]=_0x296b17[_0xbca0('0x0')]||'';this[_0xbca0('0x1')]=_0x296b17['username']||'';this[_0xbca0('0x2')]=_0x296b17[_0xbca0('0x2')]||'';this[_0xbca0('0x3')]=_0x296b17[_0xbca0('0x3')]||'';this[_0xbca0('0x4')]=_0x296b17[_0xbca0('0x4')]||'';this['Configurations']=_0x296b17[_0xbca0('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x5569=['remoteUri','serverUrl','Configurations','name','username','password'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5569,0x19b));var _0x9556=function(_0x39ddd4,_0x38ce35){_0x39ddd4=_0x39ddd4-0x0;var _0x3d642a=_0x5569[_0x39ddd4];return _0x3d642a;};'use strict';function SugarcrmAccount(_0x260e4f){this['id']=_0x260e4f['id']||0x0;this[_0x9556('0x0')]=_0x260e4f[_0x9556('0x0')]||'';this[_0x9556('0x1')]=_0x260e4f[_0x9556('0x1')]||'';this[_0x9556('0x2')]=_0x260e4f['password']||'';this[_0x9556('0x3')]=_0x260e4f['remoteUri']||'';this[_0x9556('0x4')]=_0x260e4f[_0x9556('0x4')]||'';this[_0x9556('0x5')]=_0x260e4f[_0x9556('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index cab8add..130ae28 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 _0xa5b5=['stateTime','status','unknown','name','accountcode','state'];(function(_0x4e8432,_0x588490){var _0x376b56=function(_0x414845){while(--_0x414845){_0x4e8432['push'](_0x4e8432['shift']());}};_0x376b56(++_0x588490);}(_0xa5b5,0x17d));var _0x5a5b=function(_0x261d6e,_0x227ddb){_0x261d6e=_0x261d6e-0x0;var _0x14e2da=_0xa5b5[_0x261d6e];return _0x14e2da;};'use strict';function Telephone(_0x264e66){this['id']=_0x264e66['id']||0x0;this['name']=_0x264e66[_0x5a5b('0x0')]||'';this[_0x5a5b('0x1')]=_0x264e66[_0x5a5b('0x1')]||'';this[_0x5a5b('0x2')]='unknown';this[_0x5a5b('0x3')]=0x0;this[_0x5a5b('0x4')]=_0x5a5b('0x5');this['address']='';}module['exports']=Telephone; \ No newline at end of file +var _0x66dc=['address','exports','name','accountcode','state','unknown','stateTime','status'];(function(_0x24c650,_0x2a2175){var _0x369d76=function(_0x136209){while(--_0x136209){_0x24c650['push'](_0x24c650['shift']());}};_0x369d76(++_0x2a2175);}(_0x66dc,0x14a));var _0xc66d=function(_0xf8d101,_0x11b892){_0xf8d101=_0xf8d101-0x0;var _0x2d4f91=_0x66dc[_0xf8d101];return _0x2d4f91;};'use strict';function Telephone(_0x5993c6){this['id']=_0x5993c6['id']||0x0;this['name']=_0x5993c6[_0xc66d('0x0')]||'';this[_0xc66d('0x1')]=_0x5993c6[_0xc66d('0x1')]||'';this[_0xc66d('0x2')]=_0xc66d('0x3');this[_0xc66d('0x4')]=0x0;this[_0xc66d('0x5')]=_0xc66d('0x3');this[_0xc66d('0x6')]='';}module[_0xc66d('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 7eaf94c..fe7028b 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 _0x5975=['name','html'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x5975,0xd0));var _0x5597=function(_0x477107,_0x88ce19){_0x477107=_0x477107-0x0;var _0x87d6a2=_0x5975[_0x477107];return _0x87d6a2;};'use strict';function template(_0x4adfdb){this['id']=_0x4adfdb['id']||0x0;this['name']=_0x4adfdb[_0x5597('0x0')]||'';this[_0x5597('0x1')]=_0x4adfdb[_0x5597('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0x4d29=['html','exports','name'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x4d29,0x10d));var _0x94d2=function(_0x3796de,_0x201a12){_0x3796de=_0x3796de-0x0;var _0x468869=_0x4d29[_0x3796de];return _0x468869;};'use strict';function template(_0x269f0b){this['id']=_0x269f0b['id']||0x0;this[_0x94d2('0x0')]=_0x269f0b[_0x94d2('0x0')]||'';this['html']=_0x269f0b[_0x94d2('0x1')]||'';}module[_0x94d2('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 8ba29d3..7860f70 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 _0x55ca=['name','voice','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x55ca,0x126));var _0xa55c=function(_0x4ede09,_0x18801d){_0x4ede09=_0x4ede09-0x0;var _0x253193=_0x55ca[_0x4ede09];return _0x253193;};'use strict';function Trigger(_0x53d0d7){this['id']=_0x53d0d7['id']||0x0;this[_0xa55c('0x0')]=_0x53d0d7['name']||'';this['channel']=_0x53d0d7['channel']||_0xa55c('0x1');this[_0xa55c('0x2')]=_0x53d0d7['status']||![];this[_0xa55c('0x3')]=_0x53d0d7[_0xa55c('0x3')]||[];this[_0xa55c('0x4')]=_0x53d0d7[_0xa55c('0x4')]||[];this[_0xa55c('0x5')]=_0x53d0d7[_0xa55c('0x5')]||[];}module[_0xa55c('0x6')]=Trigger; \ No newline at end of file +var _0x9c44=['voice','status','AnyConditions','Actions','exports','name','channel'];(function(_0x3419f2,_0x17c772){var _0x3107cf=function(_0x3d5444){while(--_0x3d5444){_0x3419f2['push'](_0x3419f2['shift']());}};_0x3107cf(++_0x17c772);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';function Trigger(_0x2fa01d){this['id']=_0x2fa01d['id']||0x0;this['name']=_0x2fa01d[_0x49c4('0x0')]||'';this[_0x49c4('0x1')]=_0x2fa01d[_0x49c4('0x1')]||_0x49c4('0x2');this[_0x49c4('0x3')]=_0x2fa01d[_0x49c4('0x3')]||![];this['AllConditions']=_0x2fa01d['AllConditions']||[];this[_0x49c4('0x4')]=_0x2fa01d['AnyConditions']||[];this[_0x49c4('0x5')]=_0x2fa01d[_0x49c4('0x5')]||[];}module[_0x49c4('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 996935b..cd42c24 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 _0x7097=['stateRegistry','registrationtime','address','active','name','unknown','status','registry','indexOf','split','host','port','domain'];(function(_0x45d816,_0x294d58){var _0x477c43=function(_0x62bf37){while(--_0x62bf37){_0x45d816['push'](_0x45d816['shift']());}};_0x477c43(++_0x294d58);}(_0x7097,0xe0));var _0x7709=function(_0x5447fe,_0x38c7be){_0x5447fe=_0x5447fe-0x0;var _0x66e84f=_0x7097[_0x5447fe];return _0x66e84f;};'use strict';function Trunk(_0x24c4c9){this['id']=_0x24c4c9['id']||0x0;this['active']=_0x24c4c9[_0x7709('0x0')]||![];this[_0x7709('0x1')]=_0x24c4c9[_0x7709('0x1')]||'';this['state']=_0x7709('0x2');this['stateTime']=0x0;this[_0x7709('0x3')]=_0x7709('0x2');this[_0x7709('0x4')]=_0x24c4c9['registry']&&_0x24c4c9['registry'][_0x7709('0x5')](':')?_0x24c4c9[_0x7709('0x4')][_0x7709('0x6')](':')[0x0]:'';this[_0x7709('0x7')]='';this[_0x7709('0x8')]='';this[_0x7709('0x9')]='';this['domainport']='';this['refresh']='';this[_0x7709('0xa')]=_0x7709('0x2');this[_0x7709('0xb')]='';this[_0x7709('0xc')]='';}module['exports']=Trunk; \ No newline at end of file +var _0xd5cc=['stateTime','status','registry','indexOf','split','port','domain','domainport','refresh','stateRegistry','unknown','registrationtime','address','exports','active','name'];(function(_0x4cb997,_0x31aa4a){var _0x38f8e5=function(_0x12b4e9){while(--_0x12b4e9){_0x4cb997['push'](_0x4cb997['shift']());}};_0x38f8e5(++_0x31aa4a);}(_0xd5cc,0x1ce));var _0xcd5c=function(_0xf08fb2,_0x17dab2){_0xf08fb2=_0xf08fb2-0x0;var _0x415226=_0xd5cc[_0xf08fb2];return _0x415226;};'use strict';function Trunk(_0x311565){this['id']=_0x311565['id']||0x0;this[_0xcd5c('0x0')]=_0x311565[_0xcd5c('0x0')]||![];this[_0xcd5c('0x1')]=_0x311565[_0xcd5c('0x1')]||'';this['state']='unknown';this[_0xcd5c('0x2')]=0x0;this[_0xcd5c('0x3')]='unknown';this[_0xcd5c('0x4')]=_0x311565[_0xcd5c('0x4')]&&_0x311565[_0xcd5c('0x4')][_0xcd5c('0x5')](':')?_0x311565['registry'][_0xcd5c('0x6')](':')[0x0]:'';this['host']='';this[_0xcd5c('0x7')]='';this[_0xcd5c('0x8')]='';this[_0xcd5c('0x9')]='';this[_0xcd5c('0xa')]='';this[_0xcd5c('0xb')]=_0xcd5c('0xc');this[_0xcd5c('0xd')]='';this[_0xcd5c('0xe')]='';}module[_0xcd5c('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 56ca43e..56ebe3d 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 _0xaec3=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x31cec3,_0x27c9d5){var _0x439621=function(_0x3d1ee5){while(--_0x3d1ee5){_0x31cec3['push'](_0x31cec3['shift']());}};_0x439621(++_0x27c9d5);}(_0xaec3,0x173));var _0x3aec=function(_0x3ba7f4,_0x1935e1){_0x3ba7f4=_0x3ba7f4-0x0;var _0x1e8eea=_0xaec3[_0x3ba7f4];return _0x1e8eea;};'use strict';function voiceExtension(_0x5527a9){this['id']=_0x5527a9['id']||0x0;this[_0x3aec('0x0')]=_0x5527a9[_0x3aec('0x0')]||'';this[_0x3aec('0x1')]=_0x5527a9[_0x3aec('0x1')]||_0x3aec('0x2');this['mandatoryDisposition']=_0x5527a9[_0x3aec('0x3')]||![];}module[_0x3aec('0x4')]=voiceExtension; \ No newline at end of file +var _0xdcf4=['recordingFormat','none','mandatoryDisposition','exten'];(function(_0x2106be,_0x1bea82){var _0x224fcb=function(_0x145166){while(--_0x145166){_0x2106be['push'](_0x2106be['shift']());}};_0x224fcb(++_0x1bea82);}(_0xdcf4,0x1b3));var _0x4dcf=function(_0x12679a,_0x43e9fb){_0x12679a=_0x12679a-0x0;var _0x91cde3=_0xdcf4[_0x12679a];return _0x91cde3;};'use strict';function voiceExtension(_0x5ae71b){this['id']=_0x5ae71b['id']||0x0;this[_0x4dcf('0x0')]=_0x5ae71b['exten']||'';this[_0x4dcf('0x1')]=_0x5ae71b[_0x4dcf('0x1')]||_0x4dcf('0x2');this['mandatoryDisposition']=_0x5ae71b[_0x4dcf('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index a4ac44f..7483d58 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 _0x0827=['strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','sumDuration','sumHoldTime','sumBillable','loggedIn','available','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialCutDigit'];(function(_0x483ac3,_0x56e26d){var _0x517e8e=function(_0x3c71b5){while(--_0x3c71b5){_0x483ac3['push'](_0x483ac3['shift']());}};_0x517e8e(++_0x56e26d);}(_0x0827,0xa4));var _0x7082=function(_0x2077c2,_0x275ab5){_0x2077c2=_0x2077c2-0x0;var _0x312f9f=_0x0827[_0x2077c2];return _0x312f9f;};'use strict';var statusDesc=['unknown','not_inuse',_0x7082('0x0'),_0x7082('0x1'),_0x7082('0x2'),_0x7082('0x3'),_0x7082('0x4'),_0x7082('0x5'),_0x7082('0x6')];var monitorFormat={'wav':_0x7082('0x7'),'wav49':_0x7082('0x8'),'gsm':_0x7082('0x9')};var strategy={'rrmemory':_0x7082('0xa'),'roundrobin':_0x7082('0xb')};function VoiceQueue(_0x3bbe3d){this['id']=_0x3bbe3d['id']||0x0;this[_0x7082('0xc')]=_0x3bbe3d[_0x7082('0xc')]||'';this[_0x7082('0xd')]=_0x3bbe3d[_0x7082('0xd')]||'';this['type']=_0x3bbe3d[_0x7082('0xe')]||_0x7082('0xf');this[_0x7082('0x10')]=0x0;this[_0x7082('0x11')]=0x0;this[_0x7082('0x12')]=0x0;this['answered']=0x0;this[_0x7082('0x13')]=0x0;this[_0x7082('0x14')]=0x0;this[_0x7082('0x15')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0x7082('0x16')]=0x0;this[_0x7082('0x17')]=0x0;this['acw']=_0x3bbe3d['acw']||![];this[_0x7082('0x18')]=_0x3bbe3d[_0x7082('0x18')]||0xa;this[_0x7082('0x19')]=_0x3bbe3d['autopause']||'no';this[_0x7082('0x1a')]=!![];this['message']='';this[_0x7082('0x1b')]=0x0;this[_0x7082('0x1c')]=0x0;this['dialTimezone']=_0x3bbe3d[_0x7082('0x1d')]||null;this[_0x7082('0x1e')]=_0x3bbe3d[_0x7082('0x1e')]?_0x3bbe3d[_0x7082('0x1e')]:null;this[_0x7082('0x1f')]=_0x3bbe3d[_0x7082('0x1f')];this[_0x7082('0x20')]=_0x3bbe3d[_0x7082('0x20')]||_0x7082('0x21');this['dialLimitChannel']=_0x3bbe3d[_0x7082('0x22')]||0x0;this[_0x7082('0x23')]=_0x3bbe3d['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x3bbe3d[_0x7082('0x24')]||0x1;this[_0x7082('0x25')]=_0x3bbe3d[_0x7082('0x25')]||_0x7082('0x26');this['dialPredictiveOptimizationPercentage']=_0x3bbe3d[_0x7082('0x27')]||0.03;this[_0x7082('0x28')]=_0x3bbe3d['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x3bbe3d[_0x7082('0x29')]||'anonymous';this[_0x7082('0x2a')]=_0x3bbe3d[_0x7082('0x2a')]||_0x7082('0x2b');this[_0x7082('0x2c')]=_0x3bbe3d[_0x7082('0x2c')]||0x1e;this[_0x7082('0x2d')]=_0x3bbe3d[_0x7082('0x2d')]||'tTxX';this[_0x7082('0x2e')]=_0x3bbe3d[_0x7082('0x2e')]||0x3;this[_0x7082('0x2f')]=_0x3bbe3d[_0x7082('0x2f')]||undefined;this[_0x7082('0x30')]=_0x3bbe3d['dialCongestionMaxRetry']||0x3;this[_0x7082('0x31')]=_0x3bbe3d['dialCongestionRetryFrequency']||0x96;this[_0x7082('0x32')]=_0x3bbe3d[_0x7082('0x32')]||0x3;this[_0x7082('0x33')]=_0x3bbe3d[_0x7082('0x33')]||0x96;this[_0x7082('0x34')]=_0x3bbe3d[_0x7082('0x34')]||0x3;this[_0x7082('0x35')]=_0x3bbe3d[_0x7082('0x35')]||0x96;this[_0x7082('0x36')]=_0x3bbe3d[_0x7082('0x36')]||0x3;this[_0x7082('0x37')]=_0x3bbe3d[_0x7082('0x37')]||0x96;this[_0x7082('0x38')]=_0x3bbe3d[_0x7082('0x38')]||0x3;this['dialDropRetryFrequency']=_0x3bbe3d[_0x7082('0x39')]||0x96;this[_0x7082('0x3a')]=_0x3bbe3d[_0x7082('0x3a')]||0x3;this[_0x7082('0x3b')]=_0x3bbe3d['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x3bbe3d['dialMachineMaxRetry']||0x3;this[_0x7082('0x3c')]=_0x3bbe3d['dialMachineRetryFrequency']||0x96;this[_0x7082('0x3d')]=_0x3bbe3d['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x3bbe3d[_0x7082('0x3e')]||0x96;this[_0x7082('0x3f')]=_0x3bbe3d[_0x7082('0x3f')]||0x4;this[_0x7082('0x40')]=_0x3bbe3d[_0x7082('0x40')]?_0x3bbe3d[_0x7082('0x40')]:undefined;this['TrunkBackup']=_0x3bbe3d[_0x7082('0x41')]?_0x3bbe3d[_0x7082('0x41')]:undefined;this[_0x7082('0x42')]=_0x3bbe3d[_0x7082('0x42')]||undefined;this[_0x7082('0x43')]=_0x3bbe3d[_0x7082('0x43')]?_0x3bbe3d[_0x7082('0x43')]:undefined;this[_0x7082('0x44')]=_0x3bbe3d['dialOrderByScheduledAt']||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x3bbe3d['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x7082('0x45')]=_0x3bbe3d[_0x7082('0x45')]||undefined;this[_0x7082('0x46')]=strategy[_0x3bbe3d[_0x7082('0x46')]]||_0x7082('0xa');this['queueStatusComplete']=!![];this[_0x7082('0x47')]=_0x3bbe3d[_0x7082('0x47')]||![];this[_0x7082('0x48')]=_0x3bbe3d[_0x7082('0x48')];this[_0x7082('0x49')]=_0x3bbe3d[_0x7082('0x49')];this[_0x7082('0x4a')]=_0x3bbe3d[_0x7082('0x4a')];this[_0x7082('0x4b')]=_0x3bbe3d[_0x7082('0x4b')];this[_0x7082('0x4c')]=_0x3bbe3d['dialAMDMinWordLength'];this[_0x7082('0x4d')]=_0x3bbe3d[_0x7082('0x4d')];this[_0x7082('0x4e')]=_0x3bbe3d[_0x7082('0x4e')];this[_0x7082('0x4f')]=_0x3bbe3d[_0x7082('0x4f')];this['dialAMDMaximumWordLength']=_0x3bbe3d['dialAMDMaximumWordLength'];this[_0x7082('0x50')]=0x0;this['pTalking']=0x0;this[_0x7082('0x51')]=_0x3bbe3d[_0x7082('0x51')];this[_0x7082('0x52')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x7082('0x53')]=0x0;this[_0x7082('0x54')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x7082('0x55')]=0x0;this[_0x7082('0x56')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x7082('0x57')]=0x0;this[_0x7082('0x58')]=0x0;this[_0x7082('0x59')]=0x0;this[_0x7082('0x5a')]=0x0;this['outboundReCallsDay']=0x0;this[_0x7082('0x5b')]=0x0;this[_0x7082('0x5c')]=undefined;this[_0x7082('0x5d')]=undefined;this[_0x7082('0x5e')]=undefined;this[_0x7082('0x5f')]=1.05;this[_0x7082('0x60')]=0x0;this[_0x7082('0x61')]=0x0;this[_0x7082('0x62')]=0x0;this[_0x7082('0x63')]=0x0;this[_0x7082('0x64')]=0x0;this[_0x7082('0x65')]=0x0;this[_0x7082('0x66')]=0x0;this[_0x7082('0x67')]=0x0;this['predictiveIntervalMaxThreshold']=_0x3bbe3d[_0x7082('0x68')]||0x14;this[_0x7082('0x69')]=_0x3bbe3d[_0x7082('0x68')]||0xa;this[_0x7082('0x6a')]=0x0;this[_0x7082('0x6b')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0x7082('0x6c')]=0x0;this[_0x7082('0x6d')]=0x0;this['erlangBusyFactor']=0x0;this[_0x7082('0x6e')]=_0x3bbe3d['dialRecallMeTimeout']||0x1e;this[_0x7082('0x6f')]=_0x3bbe3d[_0x7082('0x6f')]||![];this[_0x7082('0x70')]=_0x3bbe3d[_0x7082('0x70')]||undefined;this[_0x7082('0x71')]=_0x3bbe3d[_0x7082('0x71')]||![];this[_0x7082('0x72')]=_0x3bbe3d[_0x7082('0x72')]||![];this[_0x7082('0xd')]=monitorFormat[_0x3bbe3d[_0x7082('0xd')]]?monitorFormat[_0x3bbe3d['monitor_format']]:undefined;this['mandatoryDisposition']=_0x3bbe3d[_0x7082('0x73')]||![];this[_0x7082('0x74')]=_0x3bbe3d[_0x7082('0x74')]?_0x3bbe3d[_0x7082('0x74')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0xf1a9=['acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumBillable','unmanaged','loggedIn','available','acw'];(function(_0x2be7e7,_0x215c0a){var _0x449c7b=function(_0x35483b){while(--_0x35483b){_0x2be7e7['push'](_0x2be7e7['shift']());}};_0x449c7b(++_0x215c0a);}(_0xf1a9,0x14d));var _0x9f1a=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0xf1a9[_0x468b0f];return _0x3e74d9;};'use strict';var statusDesc=['unknown',_0x9f1a('0x0'),_0x9f1a('0x1'),'busy',_0x9f1a('0x2'),_0x9f1a('0x3'),_0x9f1a('0x4'),_0x9f1a('0x5'),_0x9f1a('0x6')];var monitorFormat={'wav':_0x9f1a('0x7'),'wav49':_0x9f1a('0x8'),'gsm':'gsm'};var strategy={'rrmemory':_0x9f1a('0x9'),'roundrobin':_0x9f1a('0xa')};function VoiceQueue(_0x4afb0a){this['id']=_0x4afb0a['id']||0x0;this[_0x9f1a('0xb')]=_0x4afb0a[_0x9f1a('0xb')]||'';this['monitor_format']=_0x4afb0a[_0x9f1a('0xc')]||'';this[_0x9f1a('0xd')]=_0x4afb0a[_0x9f1a('0xd')]||_0x9f1a('0xe');this[_0x9f1a('0xf')]=0x0;this[_0x9f1a('0x10')]=0x0;this[_0x9f1a('0x11')]=0x0;this[_0x9f1a('0x12')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0x9f1a('0x13')]=0x0;this[_0x9f1a('0x14')]=0x0;this['abandoned']=0x0;this[_0x9f1a('0x15')]=0x0;this[_0x9f1a('0x16')]=0x0;this[_0x9f1a('0x17')]=_0x4afb0a[_0x9f1a('0x17')]||![];this['acwTimeout']=_0x4afb0a[_0x9f1a('0x18')]||0xa;this['autopause']=_0x4afb0a[_0x9f1a('0x19')]||'no';this[_0x9f1a('0x1a')]=!![];this[_0x9f1a('0x1b')]='';this['originated']=0x0;this[_0x9f1a('0x1c')]=0x0;this[_0x9f1a('0x1d')]=_0x4afb0a[_0x9f1a('0x1d')]||null;this[_0x9f1a('0x1e')]=_0x4afb0a['dialGlobalInterval']?_0x4afb0a[_0x9f1a('0x1e')]:null;this[_0x9f1a('0x1f')]=_0x4afb0a[_0x9f1a('0x1f')];this[_0x9f1a('0x20')]=_0x4afb0a[_0x9f1a('0x20')]||_0x9f1a('0x21');this[_0x9f1a('0x22')]=_0x4afb0a[_0x9f1a('0x22')]||0x0;this[_0x9f1a('0x23')]=_0x4afb0a[_0x9f1a('0x23')]||0x0;this[_0x9f1a('0x24')]=_0x4afb0a[_0x9f1a('0x24')]||0x1;this['dialPredictiveOptimization']=_0x4afb0a['dialPredictiveOptimization']||_0x9f1a('0x25');this[_0x9f1a('0x26')]=_0x4afb0a[_0x9f1a('0x26')]||0.03;this[_0x9f1a('0x27')]=_0x4afb0a[_0x9f1a('0x27')]||0x258;this[_0x9f1a('0x28')]=_0x4afb0a['dialOriginateCallerIdName']||_0x9f1a('0x29');this[_0x9f1a('0x2a')]=_0x4afb0a['dialOriginateCallerIdNumber']||'anonymous';this[_0x9f1a('0x2b')]=_0x4afb0a['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x4afb0a[_0x9f1a('0x2c')]||_0x9f1a('0x2d');this[_0x9f1a('0x2e')]=_0x4afb0a['dialQueueTimeout']||0x3;this['dialQueueProject']=_0x4afb0a[_0x9f1a('0x2f')]||undefined;this[_0x9f1a('0x30')]=_0x4afb0a[_0x9f1a('0x30')]||0x3;this[_0x9f1a('0x31')]=_0x4afb0a[_0x9f1a('0x31')]||0x96;this[_0x9f1a('0x32')]=_0x4afb0a[_0x9f1a('0x32')]||0x3;this[_0x9f1a('0x33')]=_0x4afb0a[_0x9f1a('0x33')]||0x96;this[_0x9f1a('0x34')]=_0x4afb0a['dialNoAnswerMaxRetry']||0x3;this[_0x9f1a('0x35')]=_0x4afb0a[_0x9f1a('0x35')]||0x96;this[_0x9f1a('0x36')]=_0x4afb0a[_0x9f1a('0x36')]||0x3;this[_0x9f1a('0x37')]=_0x4afb0a[_0x9f1a('0x37')]||0x96;this['dialDropMaxRetry']=_0x4afb0a[_0x9f1a('0x38')]||0x3;this['dialDropRetryFrequency']=_0x4afb0a[_0x9f1a('0x39')]||0x96;this[_0x9f1a('0x3a')]=_0x4afb0a[_0x9f1a('0x3a')]||0x3;this['dialAbandonedRetryFrequency']=_0x4afb0a[_0x9f1a('0x3b')]||0x96;this['dialMachineMaxRetry']=_0x4afb0a['dialMachineMaxRetry']||0x3;this[_0x9f1a('0x3c')]=_0x4afb0a[_0x9f1a('0x3c')]||0x96;this['dialAgentRejectMaxRetry']=_0x4afb0a['dialAgentRejectMaxRetry']||0x3;this[_0x9f1a('0x3d')]=_0x4afb0a[_0x9f1a('0x3d')]||0x96;this[_0x9f1a('0x3e')]=_0x4afb0a['dialGlobalMaxRetry']||0x4;this[_0x9f1a('0x3f')]=_0x4afb0a[_0x9f1a('0x3f')]?_0x4afb0a[_0x9f1a('0x3f')]:undefined;this[_0x9f1a('0x40')]=_0x4afb0a[_0x9f1a('0x40')]?_0x4afb0a[_0x9f1a('0x40')]:undefined;this[_0x9f1a('0x41')]=_0x4afb0a[_0x9f1a('0x41')]||undefined;this['Interval']=_0x4afb0a[_0x9f1a('0x42')]?_0x4afb0a['Interval']:undefined;this['dialOrderByScheduledAt']=_0x4afb0a[_0x9f1a('0x43')]||'DESC';this[_0x9f1a('0x44')]=_0x4afb0a[_0x9f1a('0x44')]||undefined;this['dialCutDigit']=_0x4afb0a[_0x9f1a('0x45')]||undefined;this['strategy']=strategy[_0x4afb0a[_0x9f1a('0x46')]]||'rrmemory';this['queueStatusComplete']=!![];this[_0x9f1a('0x47')]=_0x4afb0a['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x4afb0a[_0x9f1a('0x48')];this[_0x9f1a('0x49')]=_0x4afb0a['dialAMDGreeting'];this[_0x9f1a('0x4a')]=_0x4afb0a[_0x9f1a('0x4a')];this[_0x9f1a('0x4b')]=_0x4afb0a['dialAMDTotalAnalysisTime'];this[_0x9f1a('0x4c')]=_0x4afb0a[_0x9f1a('0x4c')];this['dialAMDBetweenWordsSilence']=_0x4afb0a[_0x9f1a('0x4d')];this[_0x9f1a('0x4e')]=_0x4afb0a[_0x9f1a('0x4e')];this[_0x9f1a('0x4f')]=_0x4afb0a[_0x9f1a('0x4f')];this[_0x9f1a('0x50')]=_0x4afb0a['dialAMDMaximumWordLength'];this[_0x9f1a('0x51')]=0x0;this[_0x9f1a('0x52')]=0x0;this[_0x9f1a('0x53')]=_0x4afb0a[_0x9f1a('0x53')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x9f1a('0x54')]=0x0;this[_0x9f1a('0x55')]=0x0;this[_0x9f1a('0x56')]=0x0;this[_0x9f1a('0x57')]=0x0;this[_0x9f1a('0x58')]=0x0;this[_0x9f1a('0x59')]=0x0;this[_0x9f1a('0x5a')]=0x0;this[_0x9f1a('0x5b')]=0x0;this[_0x9f1a('0x5c')]=0x0;this[_0x9f1a('0x5d')]=0x0;this[_0x9f1a('0x5e')]=0x0;this[_0x9f1a('0x5f')]=undefined;this[_0x9f1a('0x60')]=undefined;this[_0x9f1a('0x61')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x9f1a('0x62')]=0x0;this[_0x9f1a('0x63')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x9f1a('0x64')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x9f1a('0x65')]=0x0;this[_0x9f1a('0x66')]=0x0;this[_0x9f1a('0x67')]=_0x4afb0a['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x9f1a('0x68')]=_0x4afb0a[_0x9f1a('0x69')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x9f1a('0x6a')]=0x1;this[_0x9f1a('0x6b')]=0x0;this[_0x9f1a('0x6c')]=0x0;this[_0x9f1a('0x6d')]=0x0;this[_0x9f1a('0x6e')]=0x0;this[_0x9f1a('0x6f')]=_0x4afb0a[_0x9f1a('0x6f')]||0x1e;this['dialRecallInQueue']=_0x4afb0a[_0x9f1a('0x70')]||![];this['dialQueueProject2']=_0x4afb0a[_0x9f1a('0x71')]||undefined;this[_0x9f1a('0x72')]=_0x4afb0a[_0x9f1a('0x72')]||![];this[_0x9f1a('0x73')]=_0x4afb0a['dialAgiAfterHangupAgent']||![];this[_0x9f1a('0xc')]=monitorFormat[_0x4afb0a['monitor_format']]?monitorFormat[_0x4afb0a[_0x9f1a('0xc')]]:undefined;this[_0x9f1a('0x74')]=_0x4afb0a['mandatoryDisposition']||![];this[_0x9f1a('0x75')]=_0x4afb0a[_0x9f1a('0x75')]?_0x4afb0a[_0x9f1a('0x75')]:undefined;}module[_0x9f1a('0x76')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 3f0df33..5b7f7f8 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 _0x43ff=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x1bf848,_0x5b1c29){var _0x57b4c2=function(_0x47ca11){while(--_0x47ca11){_0x1bf848['push'](_0x1bf848['shift']());}};_0x57b4c2(++_0x5b1c29);}(_0x43ff,0xbb));var _0xf43f=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0x43ff[_0x562f3b];return _0x1edd55;};'use strict';function VtigerAccount(_0x36ec1b){this['id']=_0x36ec1b['id']||0x0;this[_0xf43f('0x0')]=_0x36ec1b['name']||'';this[_0xf43f('0x1')]=_0x36ec1b['username']||'';this['accessKey']=_0x36ec1b[_0xf43f('0x2')]||'';this[_0xf43f('0x3')]=_0x36ec1b[_0xf43f('0x3')]||'';this[_0xf43f('0x4')]=_0x36ec1b[_0xf43f('0x4')]||'';this[_0xf43f('0x5')]=_0x36ec1b['Configurations']||{};}module[_0xf43f('0x6')]=VtigerAccount; \ No newline at end of file +var _0x872c=['remoteUri','serverUrl','Configurations','name','username','accessKey'];(function(_0x4b9543,_0x571758){var _0x13da94=function(_0x36ad9e){while(--_0x36ad9e){_0x4b9543['push'](_0x4b9543['shift']());}};_0x13da94(++_0x571758);}(_0x872c,0xe7));var _0xc872=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x872c[_0x4b369d];return _0x571a98;};'use strict';function VtigerAccount(_0x2e1d62){this['id']=_0x2e1d62['id']||0x0;this[_0xc872('0x0')]=_0x2e1d62['name']||'';this[_0xc872('0x1')]=_0x2e1d62[_0xc872('0x1')]||'';this[_0xc872('0x2')]=_0x2e1d62[_0xc872('0x2')]||'';this[_0xc872('0x3')]=_0x2e1d62[_0xc872('0x3')]||'';this[_0xc872('0x4')]=_0x2e1d62[_0xc872('0x4')]||'';this[_0xc872('0x5')]=_0x2e1d62[_0xc872('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 6ed6a7b..aaf534e 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 _0x5f2f=['authType','type','integrationTab','serverUrl','Configurations','name','username','password','token','remoteUri'];(function(_0x1cfea7,_0x3ad698){var _0x3c90da=function(_0x48e966){while(--_0x48e966){_0x1cfea7['push'](_0x1cfea7['shift']());}};_0x3c90da(++_0x3ad698);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3b5dbb,_0x42245d){_0x3b5dbb=_0x3b5dbb-0x0;var _0x24d9d2=_0x5f2f[_0x3b5dbb];return _0x24d9d2;};'use strict';function ZendeskAccount(_0x7c86d8){this['id']=_0x7c86d8['id']||0x0;this[_0xf5f2('0x0')]=_0x7c86d8[_0xf5f2('0x0')]||'';this[_0xf5f2('0x1')]=_0x7c86d8[_0xf5f2('0x1')]||'';this[_0xf5f2('0x2')]=_0x7c86d8[_0xf5f2('0x2')]||'';this[_0xf5f2('0x3')]=_0x7c86d8['token']||'';this['remoteUri']=_0x7c86d8[_0xf5f2('0x4')]||'';this[_0xf5f2('0x5')]=_0x7c86d8[_0xf5f2('0x5')]||'';this[_0xf5f2('0x6')]=_0x7c86d8[_0xf5f2('0x6')]||_0xf5f2('0x7');this['serverUrl']=_0x7c86d8[_0xf5f2('0x8')]||'';this[_0xf5f2('0x9')]=_0x7c86d8[_0xf5f2('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +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(_0x3d838a,_0x5bf3ab){_0x3d838a=_0x3d838a-0x0;var _0x237367=_0xadb5[_0x3d838a];return _0x237367;};'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 diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index ba8e706..9fa4b34 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 _0x9ffd=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x3eb630,_0x552586){var _0x1b840d=function(_0x2594a8){while(--_0x2594a8){_0x3eb630['push'](_0x3eb630['shift']());}};_0x1b840d(++_0x552586);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x206f5f,_0x462b85){_0x206f5f=_0x206f5f-0x0;var _0x10836b=_0x9ffd[_0x206f5f];return _0x10836b;};'use strict';function ZohoAccount(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['description']=_0x4c26a1[_0xd9ff('0x1')]||'';this[_0xd9ff('0x2')]=_0x4c26a1[_0xd9ff('0x2')]||'';this[_0xd9ff('0x3')]=_0x4c26a1['zone']||'';this[_0xd9ff('0x4')]=_0x4c26a1[_0xd9ff('0x4')]||'';this['clientSecret']=_0x4c26a1[_0xd9ff('0x5')]||'';this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||'';this[_0xd9ff('0x7')]=_0x4c26a1[_0xd9ff('0x7')]||'';this[_0xd9ff('0x8')]=_0x4c26a1[_0xd9ff('0x8')]||'';this[_0xd9ff('0x9')]=_0x4c26a1[_0xd9ff('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x160f=['clientSecret','serverUrl','code','Configurations','exports','name','description','host','zone','clientId'];(function(_0x3a5da5,_0x58eaa0){var _0x2de0e5=function(_0x2f1d09){while(--_0x2f1d09){_0x3a5da5['push'](_0x3a5da5['shift']());}};_0x2de0e5(++_0x58eaa0);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';function ZohoAccount(_0x31024b){this['id']=_0x31024b['id']||0x0;this[_0xf160('0x0')]=_0x31024b[_0xf160('0x0')]||'';this[_0xf160('0x1')]=_0x31024b['description']||'';this[_0xf160('0x2')]=_0x31024b[_0xf160('0x2')]||'';this[_0xf160('0x3')]=_0x31024b[_0xf160('0x3')]||'';this[_0xf160('0x4')]=_0x31024b[_0xf160('0x4')]||'';this['clientSecret']=_0x31024b[_0xf160('0x5')]||'';this[_0xf160('0x6')]=_0x31024b['serverUrl']||'';this['code']=_0x31024b[_0xf160('0x7')]||'';this['refreshToken']=_0x31024b['refreshToken']||'';this['Configurations']=_0x31024b[_0xf160('0x8')]||{};}module[_0xf160('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 2a53e26..f8c4473 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 _0xf621=['countabandonedretry','countdropretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','util','moment','isNil','string','uniqueid','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','active','calleridnum','scheduledat','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry'];(function(_0xcb4e02,_0x321d2c){var _0x1e2d62=function(_0x514273){while(--_0x514273){_0xcb4e02['push'](_0xcb4e02['shift']());}};_0x1e2d62(++_0x321d2c);}(_0xf621,0x137));var _0x1f62=function(_0xea343d,_0x311197){_0xea343d=_0xea343d-0x0;var _0x2c6e9c=_0xf621[_0xea343d];return _0x2c6e9c;};'use strict';var util=require(_0x1f62('0x0'));var _=require('lodash');var moment=require(_0x1f62('0x1'));function checkNameSurname(_0x4bf2e4,_0x3deab1,_0x5b49e1){var _0x710e4='';if(!_[_0x1f62('0x2')](_0x3deab1)&&_0x1f62('0x3')===typeof _0x3deab1){_0x710e4+=_0x3deab1;}if(!_[_0x1f62('0x2')](_0x5b49e1)&&'string'===typeof _0x5b49e1){_0x710e4+='\x20'+_0x5b49e1;}if(_0x710e4!==''){return _0x710e4;}return _0x4bf2e4;}function Action(_0x36bc63,_0x1f251a,_0x1b45fe,_0x1770d0,_0x3c249d){this[_0x1f62('0x4')]=_0x1b45fe||undefined;this['idContact']=_0x36bc63['id'];this['queue']=_0x1f251a[_0x1f62('0x5')];this[_0x1f62('0x6')]=_0x1f251a[_0x1f62('0x6')];this[_0x1f62('0x7')]='queue';this[_0x1f62('0x8')]=![];this[_0x1f62('0x9')]=_[_0x1f62('0x2')](_0x36bc63[_0x1f62('0xa')])?undefined:_0x36bc63['Agent'][_0x1f62('0x5')];this[_0x1f62('0xb')]=this[_0x1f62('0x9')]?util[_0x1f62('0xc')](_0x1f62('0xd'),this[_0x1f62('0x9')]):_0x1770d0||undefined;this[_0x1f62('0xe')]=checkNameSurname(_0x36bc63[_0x1f62('0xf')][_0x1f62('0x10')],_0x36bc63[_0x1f62('0xf')][_0x1f62('0x11')],_0x36bc63[_0x1f62('0xf')]['lastName']);this[_0x1f62('0x12')]=_0x36bc63[_0x1f62('0x12')]||![];this[_0x1f62('0x13')]=_0x36bc63[_0x1f62('0xf')]['phone'];this[_0x1f62('0x14')]=_0x36bc63[_0x1f62('0x14')];this['countbusyretry']=_0x36bc63['countbusyretry']||0x0;this['countcongestionretry']=_0x36bc63['countcongestionretry']||0x0;this['countnoanswerretry']=_0x36bc63[_0x1f62('0x15')]||0x0;this[_0x1f62('0x16')]=(_0x36bc63['countbusyretry']||0x0)+(_0x36bc63[_0x1f62('0x17')]||0x0)+(_0x36bc63['countnoanswerretry']||0x0)+(_0x36bc63[_0x1f62('0x18')]||0x0)+(_0x36bc63['countdropretry']||0x0)+(_0x36bc63[_0x1f62('0x19')]||0x0)+(_0x36bc63['countmachineretry']||0x0)+(_0x36bc63['countagentrejectretry']||0x0);this['countnosuchnumberretry']=_0x36bc63[_0x1f62('0x18')]||0x0;this['countdropretry']=_0x36bc63[_0x1f62('0x1a')]||0x0;this['countabandonedretry']=_0x36bc63['countabandonedretry']||0x0;this[_0x1f62('0x1b')]=_0x36bc63['countmachineretry']||0x0;this[_0x1f62('0x1c')]=_0x36bc63[_0x1f62('0x1c')]||0x0;this[_0x1f62('0x1d')]=_0x36bc63[_0x1f62('0x1d')];this[_0x1f62('0x1e')]=_0x36bc63[_0x1f62('0x1e')];this[_0x1f62('0x1f')]=_0x36bc63['callbackat'];this[_0x1f62('0x20')]=_0x36bc63[_0x1f62('0x20')];this[_0x1f62('0x21')]=_0x36bc63[_0x1f62('0x21')];this['ListId']=_0x36bc63[_0x1f62('0x22')];this[_0x1f62('0x23')]=_[_0x1f62('0x2')](_0x36bc63['Agent'])?_0x36bc63[_0x1f62('0x23')]:_0x36bc63[_0x1f62('0xa')]['id'];this[_0x1f62('0x24')]=_0x36bc63[_0x1f62('0x24')];this[_0x1f62('0x25')]='';this[_0x1f62('0x26')]='';}Action[_0x1f62('0x27')]['getCaller']=function(){return util[_0x1f62('0xc')](_0x1f62('0x28'),this[_0x1f62('0xe')],this[_0x1f62('0x29')]);};module['exports']=Action; \ No newline at end of file +var _0xc155=['calleridname','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','string','uniqueid','idContact','name','type','campaigntype','queue','membername','isNil','Agent','channelAgent','format','SIP/%s'];(function(_0x11b09e,_0x1d086e){var _0x24313f=function(_0x3df868){while(--_0x3df868){_0x11b09e['push'](_0x11b09e['shift']());}};_0x24313f(++_0x1d086e);}(_0xc155,0x124));var _0x5c15=function(_0x21e64a,_0x44c2e4){_0x21e64a=_0x21e64a-0x0;var _0x2e9291=_0xc155[_0x21e64a];return _0x2e9291;};'use strict';var util=require(_0x5c15('0x0'));var _=require(_0x5c15('0x1'));var moment=require(_0x5c15('0x2'));function checkNameSurname(_0x57628f,_0x2bd30c,_0x18089b){var _0x7fd703='';if(!_['isNil'](_0x2bd30c)&&'string'===typeof _0x2bd30c){_0x7fd703+=_0x2bd30c;}if(!_['isNil'](_0x18089b)&&_0x5c15('0x3')===typeof _0x18089b){_0x7fd703+='\x20'+_0x18089b;}if(_0x7fd703!==''){return _0x7fd703;}return _0x57628f;}function Action(_0x1fbd4e,_0x46549a,_0x286182,_0x147872,_0x5a6b92){this[_0x5c15('0x4')]=_0x286182||undefined;this[_0x5c15('0x5')]=_0x1fbd4e['id'];this['queue']=_0x46549a[_0x5c15('0x6')];this['type']=_0x46549a[_0x5c15('0x7')];this[_0x5c15('0x8')]=_0x5c15('0x9');this['dialAnswer']=![];this[_0x5c15('0xa')]=_[_0x5c15('0xb')](_0x1fbd4e[_0x5c15('0xc')])?undefined:_0x1fbd4e[_0x5c15('0xc')]['name'];this[_0x5c15('0xd')]=this['membername']?util[_0x5c15('0xe')](_0x5c15('0xf'),this[_0x5c15('0xa')]):_0x147872||undefined;this[_0x5c15('0x10')]=checkNameSurname(_0x1fbd4e[_0x5c15('0x11')][_0x5c15('0x12')],_0x1fbd4e[_0x5c15('0x11')]['firstName'],_0x1fbd4e[_0x5c15('0x11')][_0x5c15('0x13')]);this[_0x5c15('0x14')]=_0x1fbd4e[_0x5c15('0x14')]||![];this[_0x5c15('0x15')]=_0x1fbd4e['Contact']['phone'];this['scheduledat']=_0x1fbd4e[_0x5c15('0x16')];this[_0x5c15('0x17')]=_0x1fbd4e[_0x5c15('0x17')]||0x0;this['countcongestionretry']=_0x1fbd4e[_0x5c15('0x18')]||0x0;this[_0x5c15('0x19')]=_0x1fbd4e[_0x5c15('0x19')]||0x0;this['countglobal']=(_0x1fbd4e[_0x5c15('0x17')]||0x0)+(_0x1fbd4e[_0x5c15('0x18')]||0x0)+(_0x1fbd4e[_0x5c15('0x19')]||0x0)+(_0x1fbd4e[_0x5c15('0x1a')]||0x0)+(_0x1fbd4e[_0x5c15('0x1b')]||0x0)+(_0x1fbd4e[_0x5c15('0x1c')]||0x0)+(_0x1fbd4e[_0x5c15('0x1d')]||0x0)+(_0x1fbd4e[_0x5c15('0x1e')]||0x0);this['countnosuchnumberretry']=_0x1fbd4e[_0x5c15('0x1a')]||0x0;this[_0x5c15('0x1b')]=_0x1fbd4e['countdropretry']||0x0;this[_0x5c15('0x1c')]=_0x1fbd4e['countabandonedretry']||0x0;this['countmachineretry']=_0x1fbd4e[_0x5c15('0x1d')]||0x0;this[_0x5c15('0x1e')]=_0x1fbd4e[_0x5c15('0x1e')]||0x0;this['callback']=_0x1fbd4e[_0x5c15('0x1f')];this[_0x5c15('0x20')]=_0x1fbd4e[_0x5c15('0x20')];this[_0x5c15('0x21')]=_0x1fbd4e['callbackat'];this[_0x5c15('0x22')]=_0x1fbd4e[_0x5c15('0x22')];this[_0x5c15('0x23')]=_0x1fbd4e[_0x5c15('0x23')];this[_0x5c15('0x24')]=_0x1fbd4e[_0x5c15('0x24')];this[_0x5c15('0x25')]=_[_0x5c15('0xb')](_0x1fbd4e['Agent'])?_0x1fbd4e[_0x5c15('0x25')]:_0x1fbd4e[_0x5c15('0xc')]['id'];this[_0x5c15('0x26')]=_0x1fbd4e[_0x5c15('0x26')];this[_0x5c15('0x27')]='';this['originatecalleridname']='';}Action['prototype'][_0x5c15('0x28')]=function(){return util[_0x5c15('0xe')](_0x5c15('0x29'),this[_0x5c15('0x10')],this[_0x5c15('0x2a')]);};module[_0x5c15('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 82f9b6a..da29ef6 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 _0x86b0=['RecallFailedTimeout','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','countglobal','custom:agentnosuchnumber','buildObj','nosuchnumber','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','ANSWER','responsetime','answertime','pTalking','uniqueid','\x20Queue','custom:agentconnect','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','linkedid','countbusyretry','totalGlobal','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','getCallerId','originatecalleridname','extractCalleridName','addVariables','merge','toLowerVariables','Action','variablesAction','[originated][increment]','OriginateError','channel','actionid','clone','isFailure','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','destuniqueid','variables','filterKey','keys','variable','addVariable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfer','transfererlinkedid','exports','util','bluebird','moment','md5','ioredis','../../../config/environment','../../../config/logger','actionPreview','./action','./util/util','redis','defaults','localhost','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','emit','type','outbound','strategy','answered','sumDuration','sumHoldTime','talking','total','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','stringify','format','voice_queue:save','info','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','available','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','prototype','clockClearZombieChannels','hasOwnProperty','preview','booked','clearZombieChannels','setMessage','recallMe','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','ListId','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer'];(function(_0x21f31f,_0xb1d452){var _0x4ac4a7=function(_0x2bb2e2){while(--_0x2bb2e2){_0x21f31f['push'](_0x21f31f['shift']());}};_0x4ac4a7(++_0xb1d452);}(_0x86b0,0xc3));var _0x086b=function(_0x36affd,_0x1ced58){_0x36affd=_0x36affd-0x0;var _0x1f09a2=_0x86b0[_0x36affd];return _0x1f09a2;};'use strict';var util=require(_0x086b('0x0'));var _=require('lodash');var BPromise=require(_0x086b('0x1'));var uuid=require('uuid');var moment=require(_0x086b('0x2'));var md5=require(_0x086b('0x3'));var Redis=require(_0x086b('0x4'));var config=require(_0x086b('0x5'));var logger=require(_0x086b('0x6'))('preview');var loggerAction=require(_0x086b('0x6'))(_0x086b('0x7'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Action=require(_0x086b('0x8'));var ut=require(_0x086b('0x9'));config[_0x086b('0xa')]=_[_0x086b('0xb')](config['redis'],{'host':_0x086b('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x086b('0xa')]));var Sequence=function(){};Sequence['prototype'][_0x086b('0xd')]=function(_0xe6959b){this[_0x086b('0xe')]=this[_0x086b('0xe')]?this['tail'][_0x086b('0xf')](_0xe6959b):_0xe6959b();};function Preview(_0xd2422){this[_0x086b('0x10')]=new Sequence();this[_0x086b('0x11')]=_0xd2422[_0x086b('0x12')];this[_0x086b('0x13')]=_0xd2422[_0x086b('0x13')];this[_0x086b('0x14')]={};this['agents']=_0xd2422[_0x086b('0x15')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this[_0x086b('0x16')][_0x086b('0x17')](this));ami['on'](_0x086b('0x18'),this[_0x086b('0x19')][_0x086b('0x17')](this));ami['on'](_0x086b('0x1a'),this['syncHangupRequest']['bind'](this));ami['on'](_0x086b('0x1b'),this[_0x086b('0x1c')][_0x086b('0x17')](this));ami['on'](_0x086b('0x1d'),this[_0x086b('0x1e')][_0x086b('0x17')](this));ami['on'](_0x086b('0x1f'),this[_0x086b('0x20')][_0x086b('0x17')](this));ami['on'](_0x086b('0x21'),this[_0x086b('0x22')][_0x086b('0x17')](this));ami['on']('blindtransfer',this[_0x086b('0x23')][_0x086b('0x17')](this));this['loopCampaigns'](this[_0x086b('0x11')]);}function emit(_0x4eeeac,_0x589bf4,_0x14b579){io['to'](_0x4eeeac)[_0x086b('0x24')](_0x589bf4,_0x14b579);}function emitCampaignPreview(_0x5c16e7){if(_0x5c16e7[_0x086b('0x25')]===_0x086b('0x26')){var _0x241494={'id':_0x5c16e7['id'],'name':_0x5c16e7['name'],'strategy':_0x5c16e7[_0x086b('0x27')],'answered':_0x5c16e7[_0x086b('0x28')],'available':_0x5c16e7['available'],'loggedIn':_0x5c16e7['loggedIn'],'pTalking':_0x5c16e7['pTalking'],'sumBillable':_0x5c16e7['sumBillable'],'sumDuration':_0x5c16e7[_0x086b('0x29')],'sumHoldTime':_0x5c16e7[_0x086b('0x2a')]||0x0,'talking':_0x5c16e7[_0x086b('0x2b')],'total':_0x5c16e7[_0x086b('0x2c')],'type':_0x5c16e7[_0x086b('0x25')],'unmanaged':_0x5c16e7['unmanaged'],'abandoned':_0x5c16e7['abandoned'],'waiting':_0x5c16e7[_0x086b('0x2d')],'loggedInDb':_0x5c16e7['loggedInDb'],'dialActive':_0x5c16e7[_0x086b('0x2e')],'dialMethod':_0x5c16e7[_0x086b('0x2f')],'dialOriginateCallerIdName':_0x5c16e7[_0x086b('0x30')],'dialOriginateCallerIdNumber':_0x5c16e7[_0x086b('0x31')],'dialOriginateTimeout':_0x5c16e7[_0x086b('0x32')],'dialPrefix':_0x5c16e7[_0x086b('0x33')],'outboundAnswerAgiCallsDay':_0x5c16e7[_0x086b('0x34')],'outboundAnswerCallsDay':_0x5c16e7[_0x086b('0x35')],'outboundBlacklistCallsDay':_0x5c16e7['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x5c16e7[_0x086b('0x36')],'outboundCongestionCallsDay':_0x5c16e7[_0x086b('0x37')],'outboundDropCallsDayACS':_0x5c16e7['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x5c16e7['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x5c16e7[_0x086b('0x38')],'outboundNoAnswerCallsDay':_0x5c16e7[_0x086b('0x39')],'outboundNoSuchCallsDay':_0x5c16e7[_0x086b('0x3a')],'outboundOriginateFailureCallsDay':_0x5c16e7[_0x086b('0x3b')],'outboundReCallsDay':_0x5c16e7[_0x086b('0x3c')],'outboundRejectCallsDay':_0x5c16e7[_0x086b('0x3d')],'outboundUnknownCallsDay':_0x5c16e7[_0x086b('0x3e')],'outboundAbandonedCallsDay':_0x5c16e7['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x5c16e7['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x5c16e7[_0x086b('0x3f')],'predictiveIntervalAvgTalktime':_0x5c16e7[_0x086b('0x40')],'predictiveIntervalDroppedCallsCallersExit':_0x5c16e7[_0x086b('0x41')],'predictiveIntervalDroppedCallsTimeout':_0x5c16e7[_0x086b('0x42')],'predictiveIntervalErlangCalls':_0x5c16e7[_0x086b('0x43')],'predictiveIntervalErlangCallsDroppedCalls':_0x5c16e7['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x5c16e7[_0x086b('0x44')],'predictiveIntervalMultiplicativeFactor':_0x5c16e7['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x5c16e7[_0x086b('0x45')],'predictiveIntervalAvailable':_0x5c16e7['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x5c16e7[_0x086b('0x46')],'message':_0x5c16e7[_0x086b('0x47')],'originated':_0x5c16e7['originated'],'erlangCalls':_0x5c16e7[_0x086b('0x48')],'erlangCallToSecond':_0x5c16e7[_0x086b('0x49')],'erlangAbandonmentRate':_0x5c16e7[_0x086b('0x4a')],'erlangBusyFactor':_0x5c16e7[_0x086b('0x4b')],'startPredictive':_0x5c16e7[_0x086b('0x4c')],'startProgressive':_0x5c16e7[_0x086b('0x4d')]};if(_0x5c16e7[_0x086b('0x4e')]){_0x241494[_0x086b('0x4e')]={'id':_0x5c16e7[_0x086b('0x4e')]['id'],'name':_0x5c16e7[_0x086b('0x4e')][_0x086b('0x4f')],'active':_0x5c16e7[_0x086b('0x4e')][_0x086b('0x50')],'callerid':_0x5c16e7['Trunk'][_0x086b('0x51')]};}if(_0x5c16e7['Interval']){_0x241494[_0x086b('0x52')]={'id':_0x5c16e7[_0x086b('0x52')]['id'],'name':_0x5c16e7[_0x086b('0x52')][_0x086b('0x4f')]};}var _0x2baf51=md5(JSON[_0x086b('0x53')](_0x241494));if(_0x5c16e7[_0x086b('0x3')]!==_0x2baf51){_0x5c16e7[_0x086b('0x3')]=_0x2baf51;emit(util[_0x086b('0x54')]('voice:queue:%s',_0x241494[_0x086b('0x4f')]),_0x086b('0x55'),_0x241494);}}}function emitVoiceQueueChannelRemove(_0x2daaf9){logger[_0x086b('0x56')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x086b('0x53')](_0x2daaf9));emit(util[_0x086b('0x54')](_0x086b('0x57'),_0x2daaf9[_0x086b('0x4f')]),_0x086b('0x58'),_0x2daaf9);io['emit'](_0x086b('0x59'),_0x2daaf9);}function notSendMessagesQueue(_0x5c0c2a){if(_0x5c0c2a[_0x086b('0x5a')]){if(_0x5c0c2a['originated']===0x0&&_0x5c0c2a['pTalking']===0x0){_0x5c0c2a[_0x086b('0x5a')]=![];_0x5c0c2a[_0x086b('0x5b')]=0x0;_0x5c0c2a[_0x086b('0x5c')]=0x0;_0x5c0c2a[_0x086b('0x47')]=_0x086b('0x5d');ut[_0x086b('0x5e')](_0x086b('0x5f'),_0x5c0c2a[_0x086b('0x4f')]+_0x086b('0x60'));}else{_0x5c0c2a[_0x086b('0x47')]=_0x086b('0x61');ut[_0x086b('0x5e')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x5c0c2a['name']+_0x086b('0x62'));}emitCampaignPreview(_0x5c0c2a);}}Preview['prototype']['loopCampaigns']=function(){var _0x26f561=this;setInterval(function(){_0x26f561[_0x086b('0x63')]();},0x7cf);};Preview[_0x086b('0x64')][_0x086b('0x63')]=function(){var _0x5a9745=this['campaignsPreview'];this[_0x086b('0x65')]+=0x1;for(var _0xd78379 in _0x5a9745){if(_0x5a9745[_0x086b('0x66')](_0xd78379)&&(_0x5a9745[_0xd78379][_0x086b('0x2f')]===_0x086b('0x67')||_0x5a9745[_0xd78379][_0x086b('0x2f')]===_0x086b('0x68'))&&_0x5a9745[_0xd78379]['type']===_0x086b('0x26')){if(this[_0x086b('0x65')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x086b('0x69')]();}}if(_0x5a9745[_0x086b('0x66')](_0xd78379)&&_0x5a9745[_0xd78379]['dialMethod']===_0x086b('0x67')&&_0x5a9745[_0xd78379][_0x086b('0x25')]===_0x086b('0x26')){if(_0x5a9745[_0xd78379][_0x086b('0x2e')]){this[_0x086b('0x6a')](_0x5a9745[_0xd78379]);this[_0x086b('0x6b')](_0x5a9745[_0xd78379]);}else{notSendMessagesQueue(_0x5a9745[_0xd78379]);}}}};Preview['prototype']['clearZombieChannel']=function(_0x4408fb){var _0x96f4b=this;this['sequence'][_0x086b('0xd')](function(){if(!_[_0x086b('0x6c')](_0x96f4b[_0x086b('0x14')][_0x4408fb])){loggerAction[_0x086b('0x56')](_0x086b('0x6d'),_0x4408fb,_0x086b('0x6e'),_0x96f4b[_0x086b('0x14')][_0x4408fb][_0x086b('0x6f')],_0x086b('0x70'),JSON[_0x086b('0x53')](_0x96f4b['campaignsPreview'][_0x96f4b[_0x086b('0x14')][_0x4408fb][_0x086b('0x6f')]]['originated']),_0x086b('0x71'),JSON[_0x086b('0x53')](_0x96f4b[_0x086b('0x11')][_0x96f4b[_0x086b('0x14')][_0x4408fb][_0x086b('0x6f')]]['pTalking']),JSON[_0x086b('0x53')](_0x96f4b['actions'][_0x4408fb][_0x086b('0x72')]),JSON['stringify'](_[_0x086b('0x73')](_0x96f4b[_0x086b('0x14')][_0x4408fb],['contactId',_0x086b('0x74'),_0x086b('0x75'),_0x086b('0x76')])));return ami['Action']({'action':'status','channel':_0x96f4b[_0x086b('0x14')][_0x4408fb]['channel']})[_0x086b('0x77')](function(_0x5a6e44){if(_0x5a6e44[_0x086b('0x47')]===_0x086b('0x78')){setTimeout(function(){if(_0x96f4b['actions'][_0x4408fb]){ut['updateOriginated'](_0x96f4b['campaignsPreview'][_0x96f4b['actions'][_0x4408fb][_0x086b('0x6f')]],_0x086b('0x79'));if(_0x96f4b[_0x086b('0x14')][_0x4408fb][_0x086b('0x72')]===!![]){ut[_0x086b('0x7a')](_0x96f4b[_0x086b('0x11')][_0x96f4b[_0x086b('0x14')][_0x4408fb]['queue']],'[clearZombieChannel]');ut[_0x086b('0x7b')](_0x086b('0x7c')+_0x4408fb,_0x96f4b[_0x086b('0x14')][_0x4408fb][_0x086b('0x6f')]);}ut[_0x086b('0x7b')](_0x086b('0x7d')+_0x4408fb,_0x96f4b[_0x086b('0x14')][_0x4408fb][_0x086b('0x6f')]);delete _0x96f4b[_0x086b('0x14')][_0x4408fb];}},0x2328);}});}});};Preview[_0x086b('0x64')]['clearZombieChannels']=function(){var _0x799d76=this;loggerAction[_0x086b('0x56')](_0x086b('0x7e'),_[_0x086b('0x7f')](this[_0x086b('0x14')]));for(var _0x3279cd in this[_0x086b('0x14')]){if(_0x799d76[_0x086b('0x14')]['hasOwnProperty'](_0x3279cd)){_0x799d76['clearZombieChannel'](_0x3279cd);}}};Preview[_0x086b('0x64')][_0x086b('0x6b')]=function(_0x57a062){var _0x4260c3=this;rpcDb[_0x086b('0x80')](_0x57a062['id'],ut[_0x086b('0x81')](this[_0x086b('0x15')]))[_0x086b('0x82')](function(_0xcbf22f){if(!_[_0x086b('0x6c')](_0xcbf22f)){for(var _0x1c3b36=0x0;_0x1c3b36<_0xcbf22f[_0x086b('0x83')];_0x1c3b36+=0x1){if(ut[_0x086b('0x84')](_0xcbf22f[_0x1c3b36][_0x086b('0x85')])<_0x57a062[_0x086b('0x86')]*0x3c){if(_0xcbf22f[_0x1c3b36][_0x086b('0x87')]&&!_0xcbf22f[_0x1c3b36][_0x086b('0x87')][_0x086b('0x88')]){_0x4260c3[_0x086b('0x89')](_0xcbf22f[_0x1c3b36]['id'])[_0x086b('0x82')](ut[_0x086b('0x8a')](_0x086b('0x8b')))['catch'](ut['logger2'](_0x086b('0x8b')));}else{rpcDb[_0x086b('0x8c')](_0xcbf22f[_0x1c3b36]['id']);}}else{var _0x66e168=new Action(_0xcbf22f[_0x1c3b36],_0x57a062);_0x66e168[_0x086b('0x8d')]=moment()[_0x086b('0x54')](_0x086b('0x8e'));_0x57a062[_0x086b('0x3c')]+=0x1;ut['logCustomer'](_0x66e168,0x17,'RecallInQueue');if(_0x57a062[_0x086b('0x8f')]){rpcDb[_0x086b('0x90')](ut['createBody'](_0xcbf22f[_0x1c3b36]));rpcDb[_0x086b('0x91')](_0x66e168,_0x086b('0x92'));}else{ut[_0x086b('0x93')](_0x66e168,0x16,_0x086b('0x94'));rpcDb[_0x086b('0x91')](_0x66e168,'[HistoryRecallClose]');rpcDb[_0x086b('0x95')](_0x66e168,'[HistoryRecallClose]');}}}}})[_0x086b('0x77')](ut[_0x086b('0x8a')](_0x086b('0x96')));};Preview[_0x086b('0x64')][_0x086b('0x6a')]=function(_0x9da2ff){_0x9da2ff[_0x086b('0x5a')]=!![];if(ut[_0x086b('0x97')](_0x9da2ff[_0x086b('0x98')])){_0x9da2ff[_0x086b('0x47')]=_0x086b('0x99');}else if(!ut[_0x086b('0x9a')](_0x9da2ff[_0x086b('0x2e')])){_0x9da2ff[_0x086b('0x47')]=_0x086b('0x5d');}else if(!this[_0x086b('0x9b')](_0x9da2ff[_0x086b('0x4e')])){if(!this[_0x086b('0x9b')](_0x9da2ff[_0x086b('0x9c')])){_0x9da2ff['message']=_0x086b('0x9d');}else{_0x9da2ff[_0x086b('0x47')]=_0x086b('0x9e');}}else{_0x9da2ff['message']='ACTIVE';}emitCampaignPreview(_0x9da2ff);};Preview['prototype']['callProgressDetectingCustomer']=function(_0x1ef983,_0x314680,_0x1d3bc2){var _0x5a787a=this;var _0x159900=this[_0x086b('0x14')][_0x314680];var _0xb37e4d=this[_0x086b('0x11')][_0x159900['queue']];var _0x3486cc;if(_0xb37e4d){switch(_0x1d3bc2){case'1':_0xb37e4d['outboundNoSuchCallsDay']+=0x1;_0x159900[_0x086b('0x9f')]+=0x1;_0x159900[_0x086b('0xa0')]=ut['totalGlobal'](_0x159900);ut[_0x086b('0x93')](_0x159900,0x0,'NoSuchNumber');ami[_0x086b('0x24')](_0x086b('0xa1'),ut[_0x086b('0xa2')](_0x159900,_0x086b('0xa3')));rpcDb['createCustomerHistory'](_0x159900,'[callProgressDetectingCustomer][logNoSuch]');if(ut['totalGlobal'](_0x159900)>=_0xb37e4d[_0x086b('0xa4')]){_0x3486cc=ut[_0x086b('0xa5')](_0x159900,0xf,_0x086b('0xa6'));rpcDb[_0x086b('0x95')](_0x3486cc,_0x086b('0xa7'));}else{if(_0x159900[_0x086b('0x9f')]>=_0xb37e4d[_0x086b('0xa8')]){rpcDb['createCustomerFinal'](_0x159900,_0x086b('0xa7'));}else{rpcDb[_0x086b('0xa9')](ut[_0x086b('0xaa')](_0x159900,_0x086b('0x9f'),_0xb37e4d[_0x086b('0xab')]),_0x159900['unlockAgent'],_0x159900[_0x086b('0xac')]);}}delete this['actions'][_0x1ef983['linkedid']];break;case _0x086b('0xad'):var _0x4780a1=moment()[_0x086b('0x54')](_0x086b('0x8e'));_0x159900[_0x086b('0xae')]=_0x4780a1;_0x159900[_0x086b('0xaf')]=_0x4780a1;_0x159900['dialAnswer']=!![];_0xb37e4d[_0x086b('0xb0')]+=0x1;logger[_0x086b('0x56')]('[syncHangup][talking][increment]',_0x159900[_0x086b('0xb1')],_0x086b('0xb2'),_0xb37e4d[_0x086b('0x4f')],_0x086b('0x71'),_0xb37e4d[_0x086b('0xb0')]);ami['emit'](_0x086b('0xb3'),ut['buildObj'](_0x159900,_0x086b('0xb4'),this['campaignsPreview'][_0x159900[_0x086b('0x6f')]]));if(_0xb37e4d['acw']){ami[_0x086b('0x24')](_0x086b('0xb5'),ut[_0x086b('0xb6')](_0x159900));}break;case'16':ami[_0x086b('0x24')](_0x086b('0xb7'),ut['buildObj'](_0x159900,'complete',this[_0x086b('0x11')][_0x159900['queue']]));emitVoiceQueueChannelRemove(ut[_0x086b('0xa2')](_0x159900,_0x086b('0xb8')));_0xb37e4d['outboundAnswerCallsDay']+=0x1;_0xb37e4d[_0x086b('0x2c')]+=0x1;_0xb37e4d['answered']+=0x1;ut['decrementTalkink'](_0xb37e4d,_0x086b('0xb9'));_0x159900['countglobal']=ut['totalGlobal'](_0x159900);ut[_0x086b('0x93')](_0x159900,0x4,_0x086b('0xba'));rpcDb['createCustomerHistory'](_0x159900,_0x086b('0xbb'));rpcDb['createCustomerFinal'](_0x159900,_0x086b('0xbc'));rpcDb[_0x086b('0xbd')](_0x159900);_0xb37e4d['sumDuration']+=_0x159900[_0x086b('0xbe')];_0xb37e4d[_0x086b('0xbf')]+=_0x159900[_0x086b('0xbe')];logger[_0x086b('0x56')](_0x086b('0xc0'),_0x159900[_0x086b('0xb1')],_0x086b('0xb2'),_0xb37e4d[_0x086b('0x4f')],_0x086b('0x71'),_0xb37e4d[_0x086b('0xb0')]);delete this['actions'][_0x1ef983[_0x086b('0xc1')]];break;case'BUSY':_0xb37e4d[_0x086b('0x36')]+=0x1;_0x159900[_0x086b('0xc2')]+=0x1;_0x159900['countglobal']=ut[_0x086b('0xc3')](_0x159900);ut['logCustomer'](_0x159900,0x5,_0x086b('0xc4'));ami['emit'](_0x086b('0xc5'),ut['buildObj'](_0x159900,_0x086b('0xc6')));rpcDb['createCustomerHistory'](_0x159900,_0x086b('0xc7'));if(ut['totalGlobal'](_0x159900)>=_0xb37e4d['dialGlobalMaxRetry']){_0x3486cc=ut[_0x086b('0xa5')](_0x159900,0xf,_0x086b('0xa6'));rpcDb[_0x086b('0x95')](_0x3486cc,_0x086b('0xc8'));}else{if(_0x159900[_0x086b('0xc2')]>=_0xb37e4d[_0x086b('0xc9')]){rpcDb[_0x086b('0x95')](_0x159900,_0x086b('0xc7'));}else{rpcDb[_0x086b('0xa9')](ut[_0x086b('0xaa')](_0x159900,_0x086b('0xc2'),_0xb37e4d[_0x086b('0xca')]),_0x159900[_0x086b('0xcb')],_0x159900[_0x086b('0xac')]);}}break;case _0x086b('0xcc'):_0xb37e4d[_0x086b('0x39')]+=0x1;_0x159900[_0x086b('0xcd')]+=0x1;_0x159900[_0x086b('0xa0')]=ut[_0x086b('0xc3')](_0x159900);ut[_0x086b('0x93')](_0x159900,0x3,_0x086b('0xce'));ami[_0x086b('0x24')](_0x086b('0xcf'),ut['buildObj'](_0x159900,_0x086b('0xd0')));rpcDb['createCustomerHistory'](_0x159900,_0x086b('0xd1'));if(ut['totalGlobal'](_0x159900)>=_0xb37e4d[_0x086b('0xa4')]){_0x3486cc=ut[_0x086b('0xa5')](_0x159900,0xf,_0x086b('0xa6'));rpcDb[_0x086b('0x95')](_0x3486cc,_0x086b('0xd2'));}else{if(_0x159900[_0x086b('0xcd')]>=_0xb37e4d[_0x086b('0xd3')]){rpcDb[_0x086b('0x95')](_0x159900,_0x086b('0xd1'));}else{rpcDb['rescheduleContact'](ut[_0x086b('0xaa')](_0x159900,'countnoanswerretry',_0xb37e4d[_0x086b('0xd4')]),_0x159900['unlockAgent'],_0x159900[_0x086b('0xac')]);}}break;case'CONGESTION':_0xb37e4d['outboundCongestionCallsDay']+=0x1;_0x159900[_0x086b('0xd5')]+=0x1;_0x159900[_0x086b('0xa0')]=ut[_0x086b('0xc3')](_0x159900);ut[_0x086b('0x93')](_0x159900,0x8,_0x086b('0xd6'));ami[_0x086b('0x24')]('custom:agentcongestion',ut[_0x086b('0xa2')](_0x159900,'congestion'));rpcDb[_0x086b('0x91')](_0x159900,_0x086b('0xd7'));if(ut[_0x086b('0xc3')](_0x159900)>=_0xb37e4d[_0x086b('0xa4')]){_0x3486cc=ut['cloneAction'](_0x159900,0xf,_0x086b('0xa6'));rpcDb[_0x086b('0x95')](_0x3486cc,_0x086b('0xd8'));}else{if(_0x159900[_0x086b('0xd5')]>=_0xb37e4d[_0x086b('0xd9')]){rpcDb[_0x086b('0x95')](_0x159900,_0x086b('0xd7'));}else{rpcDb[_0x086b('0xa9')](ut[_0x086b('0xaa')](_0x159900,_0x086b('0xd5'),_0xb37e4d[_0x086b('0xca')]),_0x159900[_0x086b('0xcb')],_0x159900['activeContact']);}}break;case _0x086b('0xda'):_0xb37e4d['outboundRejectCallsDay']+=0x1;_0x159900[_0x086b('0xdb')]+=0x1;_0x159900['countglobal']=ut[_0x086b('0xc3')](_0x159900);ut[_0x086b('0x93')](_0x159900,0x14,_0x086b('0xdc'));ami['emit']('custom:agentreject',ut['buildObj'](_0x159900,_0x086b('0xdd')));rpcDb[_0x086b('0x91')](_0x159900,_0x086b('0xde'));if(ut[_0x086b('0xc3')](_0x159900)>=_0xb37e4d[_0x086b('0xa4')]){_0x3486cc=ut['cloneAction'](_0x159900,0x14,'AgentReject');rpcDb[_0x086b('0x95')](_0x3486cc,_0x086b('0xdf'));}else{if(_0x159900[_0x086b('0xdb')]>=_0xb37e4d[_0x086b('0xe0')]){rpcDb[_0x086b('0x95')](_0x159900,_0x086b('0xdf'));}else{rpcDb[_0x086b('0xa9')](ut['scheduledAt'](_0x159900,_0x086b('0xdb'),_0xb37e4d[_0x086b('0xe1')]),_0x159900['unlockAgent'],_0x159900[_0x086b('0xac')]);}}break;case _0x086b('0xe2'):_0xb37e4d[_0x086b('0xe3')]+=0x1;_0x159900[_0x086b('0xe4')]+=0x1;_0x159900[_0x086b('0xa0')]=ut['totalGlobal'](_0x159900);ut['logCustomer'](_0x159900,0xb,_0x086b('0xe5'));rpcDb['createCustomerHistory'](_0x159900,_0x086b('0xe6'));if(ut[_0x086b('0xc3')](_0x159900)>=_0xb37e4d['dialGlobalMaxRetry']){_0x3486cc=ut['cloneAction'](_0x159900,0xf,_0x086b('0xa6'));rpcDb[_0x086b('0x95')](_0x3486cc,_0x086b('0xe6'));}else{if(_0x159900[_0x086b('0xe7')]>=_0xb37e4d[_0x086b('0xe8')]){rpcDb[_0x086b('0x95')](_0x159900,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x086b('0xa9')](ut[_0x086b('0xaa')](_0x159900,'countabandonedretry',_0xb37e4d[_0x086b('0xe9')]),_0x159900[_0x086b('0xcb')],_0x159900[_0x086b('0xac')]);}}break;default:if(_0x159900[_0x086b('0x72')]){ut[_0x086b('0x7a')](_0xb37e4d,'[default]');ut[_0x086b('0x7b')](_0x086b('0xea')+_0xb37e4d['name'],_0x1ef983);}_0xb37e4d[_0x086b('0x3e')]+=0x1;_0x159900[_0x086b('0xa0')]=ut[_0x086b('0xc3')](_0x159900);ut[_0x086b('0x93')](_0x159900,0xc,_0x1ef983[_0x086b('0xeb')]||_0x1ef983[_0x086b('0xec')]);rpcDb[_0x086b('0x91')](_0x159900,_0x086b('0xed'));if(ut['totalGlobal'](_0x159900)>=_0xb37e4d['dialGlobalMaxRetry']){_0x3486cc=ut[_0x086b('0xa5')](_0x159900,0xf,'Global');rpcDb['createCustomerFinal'](_0x3486cc,_0x086b('0xee'));}else{rpcDb[_0x086b('0x95')](_0x159900,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x086b('0x14')][_0x1ef983[_0x086b('0xc1')]];}if(!(_0x159900[_0x086b('0x72')]&&_0x1d3bc2==='16')){ut[_0x086b('0xef')](_0xb37e4d,_0x086b('0xf0'));logger[_0x086b('0x56')](_0x086b('0xf1'),_0x159900[_0x086b('0xb1')],_0x086b('0xb2'),_0xb37e4d['name'],'originated:\x20',_0xb37e4d[_0x086b('0xf2')]);}if(_0x1d3bc2!==_0x086b('0xad')){delete this[_0x086b('0x14')][_0x1ef983[_0x086b('0xc1')]];delete this['actions'][_0x1ef983[_0x086b('0xf3')]];}}};Preview[_0x086b('0x64')][_0x086b('0xf4')]=function(_0x28755c,_0x2f5758,_0x2d7c59){if(_[_0x086b('0xf5')](_0x2f5758)&&_0x086b('0xf6')!==typeof _0x2f5758){return;}if(_[_0x086b('0xf5')](_0x2d7c59)&&'object'!==typeof _0x2d7c59){return;}switch(_0x2d7c59[_0x086b('0xf7')]){case'0':ut[_0x086b('0xf8')](_0x28755c,0x0,_0x086b('0xf9'));rpcDb[_0x086b('0xfa')](_0x28755c,_0x086b('0xfb'));break;case'3':ut['logAgent'](_0x28755c,0x3,_0x086b('0xce'));rpcDb['createAgentHistory'](_0x28755c,_0x086b('0xfc'));break;case'5':ut[_0x086b('0xf8')](_0x28755c,0x5,_0x086b('0xc4'));rpcDb[_0x086b('0xfa')](_0x28755c,_0x086b('0xfd'));break;case'8':ut['logAgent'](_0x28755c,0x8,_0x086b('0xd6'));rpcDb['createAgentHistory'](_0x28755c,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x086b('0xf8')](_0x28755c,0x16,_0x086b('0xfe'));rpcDb[_0x086b('0xfa')](_0x28755c,_0x086b('0xff'));break;default:ut[_0x086b('0xf8')](_0x28755c,0xc,_0x2d7c59['reason']);rpcDb['createAgentHistory'](_0x28755c,_0x086b('0x100'));}ut[_0x086b('0xef')](_0x2f5758,'[callProgressDetectingAgent]');logger[_0x086b('0x56')]('[originated][decrement][callProgressDetectingAgent]',_0x28755c[_0x086b('0xb1')],_0x086b('0xb2'),_0x2f5758[_0x086b('0x4f')],_0x086b('0x70'),_0x2f5758['originated']);delete this[_0x086b('0x14')][_0x28755c['uniqueid']];};Preview[_0x086b('0x64')][_0x086b('0x101')]=function(_0x2dfb45,_0x56b8d0,_0xe56e36,_0x341855,_0x2b614b){var _0x17af29=this;return new BPromise(function(_0x3628cb,_0x5e9ac7){if(_[_0x086b('0x6c')](_0x56b8d0)||_[_0x086b('0x6c')](_0x56b8d0[_0x086b('0x102')])||_['isNil'](_0x56b8d0['Contact'][_0x086b('0x103')])||_['isNil'](_0x56b8d0['VoiceQueueId'])){_0x5e9ac7(ut[_0x086b('0x47')](_0x086b('0x104'),_0x341855,_0x2b614b));return;}var _0x15eeed=uuid['v4']();var _0x657373=_0x17af29[_0x086b('0x11')][_0x56b8d0['Queue'][_0x086b('0x4f')]];var _0x10d8a9=_0xe56e36?_0x17af29['agents'][_0xe56e36]['id']:undefined;_0x17af29[_0x086b('0x14')][_0x15eeed]=new Action(_0x56b8d0,_0x657373,_0x15eeed,_0xe56e36,_0x10d8a9);var _0x285dad=_0x17af29[_0x086b('0x14')][_0x15eeed];_0x285dad[_0x086b('0xcb')]=_0x341855;_0x285dad[_0x086b('0xac')]=_0x2b614b;_0x285dad[_0x086b('0x105')]=_0xe56e36;if(_[_0x086b('0x106')](_0x2dfb45)){_0x17af29[_0x086b('0x107')](_0x285dad,_0x657373,_0x56b8d0,_0xe56e36)[_0x086b('0x82')](function(_0x1e8fc7){logger['info'](_0x086b('0x108'),_0x086b('0x109')+_0x285dad[_0x086b('0x6f')]+_0x086b('0x10a')+_0x285dad[_0x086b('0x10b')],JSON[_0x086b('0x53')](_0x1e8fc7));ami['emit']('custom:agentcalled',ut[_0x086b('0xa2')](_0x285dad,'called',_0x17af29['campaignsPreview'][_0x285dad[_0x086b('0x6f')]]));_0x3628cb(ut[_0x086b('0x47')](_0x086b('0x10c')));})[_0x086b('0x77')](function(_0x82ca0a){ut[_0x086b('0x5e')](_0x086b('0x10d'),_0x82ca0a);_0x5e9ac7(ut[_0x086b('0x47')](_0x086b('0x10e'),_0x341855,_0x2b614b));});}else{_0x657373[_0x086b('0x10f')]+=0x1;ut[_0x086b('0x110')](_0x285dad);rpcDb['createHistory'](_0x285dad,_0x086b('0x111'));delete _0x17af29[_0x086b('0x14')][_0x15eeed];_0x5e9ac7(ut[_0x086b('0x47')](_0x086b('0x112'),_0x341855,_0x2b614b));}});};Preview['prototype']['isTrunkReachable']=function(_0x1a4239){return!_['isNil'](_0x1a4239)&&!_[_0x086b('0x6c')](_0x1a4239[_0x086b('0x4f')])&&!_['isNil'](_0x1a4239[_0x086b('0x50')])&&_0x1a4239[_0x086b('0x50')]&&!_['isNil'](this[_0x086b('0x13')][util[_0x086b('0x54')](_0x086b('0x113'),_0x1a4239['name'])])&&!_[_0x086b('0x6c')](this[_0x086b('0x13')][util[_0x086b('0x54')](_0x086b('0x113'),_0x1a4239['name'])][_0x086b('0x114')])&&(this[_0x086b('0x13')][util[_0x086b('0x54')]('SIP/%s',_0x1a4239[_0x086b('0x4f')])][_0x086b('0x114')]===_0x086b('0x115')||this[_0x086b('0x13')][util[_0x086b('0x54')]('SIP/%s',_0x1a4239[_0x086b('0x4f')])][_0x086b('0x114')]===_0x086b('0x116'));};Preview['prototype']['run']=function(_0x2a8d10,_0x56ef2f){var _0x5193cf=this;return new BPromise(function(_0x5384e1,_0x1f250a){_0x5193cf[_0x086b('0x117')](_0x2a8d10,_0x56ef2f)['then'](function(_0xfbd76c){_0x5384e1(_[_0x086b('0x73')](_0xfbd76c,['message']));})[_0x086b('0x77')](function(_0x555e6b){if(_0x555e6b[_0x086b('0x118')]){rpcDb[_0x086b('0x119')](_0x2a8d10);}if(_0x555e6b[_0x086b('0x50')]){rpcDb[_0x086b('0x8c')](_0x2a8d10);}_0x1f250a(_[_0x086b('0x73')](_0x555e6b,[_0x086b('0x47')]));});});};Preview[_0x086b('0x64')][_0x086b('0x117')]=function(_0x2758e7,_0x33d5b6){var _0x1f3e7a=this;return new BPromise(function(_0x5e2f6d,_0x51d696){var _0x5a309c,_0x4b704a;rpcDb[_0x086b('0x11a')](_0x2758e7)[_0x086b('0x82')](function(_0x41a03b){if(!_[_0x086b('0x6c')](_0x41a03b[0x0])){_0x4b704a=_0x41a03b[0x0][_0x086b('0x11b')]?![]:!![];_0x5a309c=_0x41a03b[0x0]['recallme']?!![]:![];_0x5a309c=_0x33d5b6?!![]:_0x5a309c;}var _0x53c0d1=_0x1f3e7a[_0x086b('0x11c')](_0x41a03b);if(_0x53c0d1[_0x086b('0x11d')]){rpcDb[_0x086b('0x11e')](_[_0x086b('0x73')](_0x41a03b[0x0],[_0x086b('0x75'),'Contact.phone']))[_0x086b('0x82')](function(_0x1722ae){_0x1f3e7a[_0x086b('0x101')](_0x1722ae,_0x41a03b[0x0],_0x33d5b6,_0x4b704a,_0x5a309c)[_0x086b('0x82')](function(_0x53c4d5){_0x5e2f6d(_0x53c4d5);})['catch'](function(_0x5c3bdf){_0x51d696(_0x5c3bdf);});})[_0x086b('0x77')](function(_0x35c57c){ut[_0x086b('0x5e')](_0x086b('0x11f'),_0x35c57c);_0x51d696(ut['message'](_0x086b('0x120'),_0x4b704a,_0x5a309c));});}else{_0x51d696(ut['message'](_0x53c0d1[_0x086b('0x47')],_0x4b704a,_0x5a309c));}})['catch'](function(_0x2653d7){ut['logger']('[Preview][getContactPreview]',_0x2653d7);_0x51d696(ut[_0x086b('0x47')](_0x086b('0x120'),![],!![]));});});};Preview[_0x086b('0x64')]['validateContact']=function(_0x57a6cf){if(_[_0x086b('0x6c')](_0x57a6cf)||_[_0x086b('0x106')](_0x57a6cf)||!_[_0x086b('0x6c')](_0x57a6cf[0x0]['Agent'])&&_[_0x086b('0x6c')](_0x57a6cf[0x0][_0x086b('0x87')][_0x086b('0x4f')])){ut['logger'](_0x086b('0x121'),_0x57a6cf);return{'isValid':![],'message':_0x086b('0x122')};}var _0x1eb858=this[_0x086b('0x11')][_0x57a6cf[0x0]['Queue']['name']];_0x1eb858[_0x086b('0x47')]=_0x086b('0x9e');if(_[_0x086b('0x6c')](_0x1eb858)){ut['logger'](_0x086b('0x123'),_0x1eb858);return{'isValid':![],'message':_0x086b('0x124')};}if(!this[_0x086b('0x9b')](_0x1eb858[_0x086b('0x4e')])){ut[_0x086b('0x5e')](_0x086b('0x125'),_0x086b('0x126')+_0x1eb858[_0x086b('0x4f')]+_0x086b('0x127'));if(!this['isTrunkReachable'](_0x1eb858[_0x086b('0x9c')])){ut[_0x086b('0x5e')](_0x086b('0x125'),_0x1eb858[_0x086b('0x4f')]+_0x086b('0x128'));return{'isValid':![],'message':_0x086b('0x129')};}}if(!ut['isActive'](_0x1eb858[_0x086b('0x2e')])){ut[_0x086b('0x5e')](_0x086b('0x12a'),_0x1eb858[_0x086b('0x4f')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x086b('0x126')+_0x1eb858[_0x086b('0x4f')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x086b('0x12b')};};Preview[_0x086b('0x64')]['execCall']=function(_0x322d77,_0x3b4bec,_0x5a4666,_0x76bc68){var _0x12a7cb=this;return new BPromise(function(_0x463796,_0x41a970){var _0x45c21b=_0x322d77[_0x086b('0xb1')];var _0x323cab=_0x12a7cb[_0x086b('0x9b')](_0x3b4bec['Trunk'])?util[_0x086b('0x54')](_0x086b('0x12c'),_0x3b4bec['Trunk'][_0x086b('0x4f')],_[_0x086b('0x6c')](_0x3b4bec[_0x086b('0x33')])?'':_0x3b4bec[_0x086b('0x33')]['trim']()||'',_0x3b4bec['dialCutDigit']>0x0?_0x5a4666[_0x086b('0x102')][_0x086b('0x103')]['substring'](_0x3b4bec['dialCutDigit']):_0x5a4666[_0x086b('0x102')][_0x086b('0x103')]):util['format']('SIP/%s/%s%s',_[_0x086b('0x6c')](_0x3b4bec[_0x086b('0x9c')])?_0x3b4bec['Trunk'][_0x086b('0x4f')]:_0x3b4bec[_0x086b('0x9c')][_0x086b('0x4f')],_[_0x086b('0x6c')](_0x3b4bec[_0x086b('0x33')])?'':_0x3b4bec[_0x086b('0x33')][_0x086b('0x12d')]()||'',_0x3b4bec[_0x086b('0x12e')]>0x0?_0x5a4666['Contact'][_0x086b('0x103')][_0x086b('0x12f')](_0x3b4bec[_0x086b('0x12e')]):_0x5a4666[_0x086b('0x102')][_0x086b('0x103')]);var _0x3851d0=_0x12a7cb[_0x086b('0x9b')](_0x3b4bec[_0x086b('0x4e')])?ut['getCallerId'](_0x3b4bec[_0x086b('0x4e')][_0x086b('0x51')],_0x3b4bec[_0x086b('0x30')],_0x3b4bec['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x086b('0x130')](_0x3b4bec[_0x086b('0x31')],_0x3b4bec[_0x086b('0x131')]):_0x3b4bec[_0x086b('0x31')]):ut[_0x086b('0x132')](_[_0x086b('0x6c')](_0x3b4bec[_0x086b('0x9c')])?_0x3b4bec[_0x086b('0x4e')][_0x086b('0x51')]:_0x3b4bec[_0x086b('0x9c')][_0x086b('0x51')],_0x3b4bec[_0x086b('0x30')],_0x3b4bec['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x086b('0x130')](_0x3b4bec[_0x086b('0x31')],_0x3b4bec[_0x086b('0x131')]):_0x3b4bec[_0x086b('0x31')]);if(_0x3851d0){_0x322d77[_0x086b('0x133')]=ut[_0x086b('0x134')](_0x3851d0);_0x322d77['originatecalleridnum']=ut['extractCalleridNumber'](_0x3851d0);}var _0x97631c=ut[_0x086b('0x135')](_0x3b4bec,_0x5a4666,_0x323cab,_0x3851d0,_0x45c21b,_0x322d77);_[_0x086b('0x136')](_0x322d77,ut[_0x086b('0x137')](_0x97631c));_0x322d77[_0x086b('0x8d')]=moment()[_0x086b('0x54')](_0x086b('0x8e'));ami[_0x086b('0x138')](ut[_0x086b('0x139')](_0x322d77,_0x3b4bec,_0x97631c,_0x322d77[_0x086b('0xac')],_0x76bc68))[_0x086b('0x82')](function(_0xda19b){_0x3b4bec[_0x086b('0xf2')]+=0x1;logger[_0x086b('0x56')](_0x086b('0x13a'),_0x45c21b,_0x086b('0xb2'),_0x3b4bec[_0x086b('0x4f')],_0x086b('0x70'),_0x3b4bec[_0x086b('0xf2')]);_0x463796(_0xda19b);})[_0x086b('0x77')](function(_0x3f2257){ut[_0x086b('0xf8')](_0x322d77,0xe,_0x086b('0x13b'));rpcDb[_0x086b('0xfa')](_0x322d77,'[originateFailure][logOriginateFailure]');_0x41a970(_0x3f2257);});});};Preview[_0x086b('0x64')][_0x086b('0x1e')]=function(_0x2e9a65){if(this[_0x086b('0x14')][_0x2e9a65['linkedid']]){this[_0x086b('0x14')][_0x2e9a65[_0x086b('0xc1')]][_0x086b('0x13c')]=_0x2e9a65[_0x086b('0x13c')];}};Preview[_0x086b('0x64')]['syncOriginateResponse']=function(_0x5df4c2){var _0x2770cd=this;var _0x1b963e=this[_0x086b('0x14')][_0x5df4c2[_0x086b('0x13d')]];if(_0x1b963e){if(_0x1b963e[_0x086b('0x105')]&&this[_0x086b('0x15')][_0x1b963e['lookAgent']]){ut['logLookAgent'](_0x1b963e,this[_0x086b('0x15')][_0x1b963e['lookAgent']][_0x086b('0x4f')],this['agents'][_0x1b963e['lookAgent']]['id']);}var _0xe64bc7=_[_0x086b('0x13e')](_0x1b963e);_0xe64bc7[_0x086b('0xae')]=moment()[_0x086b('0x54')](_0x086b('0x8e'));var _0x78086d=_0x2770cd[_0x086b('0x11')][_0x1b963e[_0x086b('0x6f')]];if(ut[_0x086b('0x13f')](_0x5df4c2['response'])){if(_0x1b963e[_0x086b('0xcb')]){rpcDb[_0x086b('0x119')](_0x1b963e['idContact']);}if(_0x1b963e[_0x086b('0xac')]){rpcDb[_0x086b('0x8c')](_0x1b963e['idContact']);}ami[_0x086b('0x24')](_0x086b('0x140'),ut[_0x086b('0xa2')](_0x1b963e,_0x086b('0x141'),this[_0x086b('0x11')][_0x1b963e[_0x086b('0x6f')]]));this['callProgressDetectingAgent'](_0xe64bc7,_0x78086d,_0x5df4c2);}else{_0x1b963e[_0x086b('0x8d')]=moment()[_0x086b('0x54')](_0x086b('0x8e'));ut['logAgent'](_0xe64bc7,0x4,_0x086b('0xba'));rpcDb['createAgentHistory'](_0xe64bc7,_0x086b('0x142'));}}};Preview[_0x086b('0x64')][_0x086b('0x19')]=function(_0x22e70d){var _0x363a95=this;var _0x1e8bb9=this[_0x086b('0x14')][_0x22e70d[_0x086b('0xc1')]];var _0x21182d;if(_0x1e8bb9){_0x21182d=this[_0x086b('0x11')][_0x1e8bb9[_0x086b('0x6f')]];logger[_0x086b('0x56')](_0x086b('0x143'),_0x22e70d[_0x086b('0xc1')],_0x086b('0xb2'),_0x21182d[_0x086b('0x4f')],_0x086b('0x71'),_0x21182d['pTalking']);}if(this[_0x086b('0x14')][_0x22e70d[_0x086b('0xc1')]]&&_0x22e70d['linkedid']!==_0x22e70d[_0x086b('0xb1')]){if(_0x22e70d[_0x086b('0x144')]==='16'&&this[_0x086b('0x14')][_0x22e70d[_0x086b('0xc1')]][_0x086b('0x72')]){this[_0x086b('0x145')](_0x22e70d,_0x22e70d[_0x086b('0xc1')],_0x22e70d[_0x086b('0x144')]);}else if(this[_0x086b('0x14')][_0x22e70d[_0x086b('0xc1')]][_0x086b('0x72')]){logger[_0x086b('0x56')](_0x086b('0x146'),_0x22e70d['linkedid'],_0x22e70d['cause'],'\x20Queue',_0x21182d[_0x086b('0x4f')],_0x086b('0x71'),_0x21182d[_0x086b('0xb0')]);this[_0x086b('0x145')](_0x22e70d,_0x22e70d[_0x086b('0xc1')],_0x22e70d[_0x086b('0x144')]);}}else if(_0x1e8bb9&&_[_0x086b('0x6c')](_0x1e8bb9[_0x086b('0x147')])&&_0x21182d[_0x086b('0x148')]&&_0x22e70d[_0x086b('0xc1')]===_0x22e70d['uniqueid']&&_[_0x086b('0x6c')](_0x22e70d['reason'])&&_0x22e70d[_0x086b('0x144')]==='16'&&_0x22e70d[_0x086b('0x149')]==='6'&&_['isUndefined'](_0x1e8bb9['transfer'])){if(_0x1e8bb9[_0x086b('0xcb')]){rpcDb[_0x086b('0x119')](_0x1e8bb9[_0x086b('0x10b')]);}if(_0x1e8bb9[_0x086b('0xac')]){rpcDb['disableContact'](_0x1e8bb9['idContact']);}_0x22e70d['reason']='22';this[_0x086b('0xf4')](_0x1e8bb9,_0x21182d,_0x22e70d);}else if(_0x1e8bb9&&_0x1e8bb9['transfer']){if(_0x22e70d['cause']==='16'&&this[_0x086b('0x14')][_0x22e70d[_0x086b('0xc1')]][_0x086b('0x72')]){logger[_0x086b('0x56')]('[syncHangup][talking][transfer]',_0x22e70d['linkedid'],_0x22e70d[_0x086b('0x144')],_0x086b('0xb2'),_0x21182d['name'],_0x086b('0x71'),_0x21182d[_0x086b('0xb0')]);this[_0x086b('0x145')](_0x22e70d,_0x22e70d['linkedid'],_0x22e70d[_0x086b('0x144')]);}else if(this['actions'][_0x22e70d[_0x086b('0xc1')]]['dialAnswer']){logger['info']('[syncHangup][talking][cause]',_0x22e70d[_0x086b('0xc1')],_0x22e70d[_0x086b('0x144')],_0x086b('0xb2'),_0x21182d[_0x086b('0x4f')],_0x086b('0x71'),_0x21182d[_0x086b('0xb0')]);this[_0x086b('0x145')](_0x22e70d,_0x22e70d[_0x086b('0xc1')],_0x22e70d[_0x086b('0x144')]);}}};Preview[_0x086b('0x64')]['syncDialEnd']=function(_0x50067b){if(this['actions'][_0x50067b[_0x086b('0xf3')]]&&_0x50067b[_0x086b('0xf3')]!==_0x50067b[_0x086b('0x14a')]){this[_0x086b('0x145')](_0x50067b,_0x50067b[_0x086b('0xf3')],_0x50067b[_0x086b('0xec')]);}};Preview[_0x086b('0x64')]['syncHangupRequest']=function(_0x843d64){if(this[_0x086b('0x14')][_0x843d64[_0x086b('0xc1')]]&&_0x843d64[_0x086b('0xc1')]!==_0x843d64[_0x086b('0xb1')]&&!this[_0x086b('0x14')][_0x843d64[_0x086b('0xc1')]][_0x086b('0x72')]){if(_0x843d64[_0x086b('0x144')]==='1'){this[_0x086b('0x145')](_0x843d64,_0x843d64[_0x086b('0xc1')],_0x843d64[_0x086b('0x144')]);}}};Preview[_0x086b('0x64')]['addVariable']=function(_0x47927d,_0x1cfd4,_0x2a5998){if(this[_0x086b('0x14')][_0x47927d]){if(_[_0x086b('0x6c')](this[_0x086b('0x14')][_0x47927d][_0x086b('0x14b')])){this[_0x086b('0x14')][_0x47927d][_0x086b('0x14b')]={};}this[_0x086b('0x14')][_0x47927d][_0x086b('0x14b')][_0x1cfd4]=_0x2a5998;}};Preview[_0x086b('0x64')][_0x086b('0x20')]=function(_0x377643){try{if(!_[_0x086b('0x6c')](_0x377643)){if(ut[_0x086b('0x14c')](_[_0x086b('0x14d')](_0x377643[_0x086b('0x14e')])[0x0])){this[_0x086b('0x14f')](_0x377643['uniqueid'],_[_0x086b('0x14d')](_0x377643[_0x086b('0x14e')])[0x0],_0x377643[_0x086b('0x150')]);}}}catch(_0x1d78ea){logger[_0x086b('0x151')](_0x086b('0x152'),util['inspect'](_0x1d78ea,{'showHidden':![],'depth':null}));}};Preview[_0x086b('0x64')][_0x086b('0x22')]=function(_0x595ebe){if(_0x595ebe){if(this[_0x086b('0x14')][_0x595ebe['transfertargetlinkedid']]){this[_0x086b('0x14')][_0x595ebe[_0x086b('0x153')]][_0x086b('0x154')]=!![];}}};Preview['prototype'][_0x086b('0x23')]=function(_0x14dc0f){if(_0x14dc0f){if(this[_0x086b('0x14')][_0x14dc0f[_0x086b('0x155')]]){this[_0x086b('0x14')][_0x14dc0f[_0x086b('0x155')]]['transfer']=!![];}}};module[_0x086b('0x156')]=Preview; \ No newline at end of file +var _0x1e2c=['uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','NOANSWER','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerRetryFrequency','Congestion','custom:agentcongestion','congestion','countcongestionretry','dialCongestionMaxRetry','dialBusyRetryFrequency','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','isValid','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','OriginateError','[originateFailure][logOriginateFailure]','lookAgent','logLookAgent','clone','isFailure','response','unlockContact','idContact','custom:agentringnoanswer','rejected','Answer','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','addVariable','variables','keys','variable','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','util','lodash','bluebird','uuid','moment','md5','../../../config/logger','preview','actionPreview','../ami','./action','redis','defaults','localhost','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','outbound','strategy','available','loggedIn','pTalking','sumBillable','talking','total','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','name','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','syncCampaigns','clockClearZombieChannels','booked','clearZombieChannels','hasOwnProperty','clearZombieChannel','isNil','info','[clearZombieChannels][talking]','Queue','originated:\x20','queue','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','size','recallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','rescheduleContactInQueue','createCustomerHistory','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','emit','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','ANSWER','responsetime','answertime'];(function(_0x218300,_0x4dbebd){var _0x58d431=function(_0x42b95e){while(--_0x42b95e){_0x218300['push'](_0x218300['shift']());}};_0x58d431(++_0x4dbebd);}(_0x1e2c,0x98));var _0xc1e2=function(_0x13a296,_0x4ca51d){_0x13a296=_0x13a296-0x0;var _0x202651=_0x1e2c[_0x13a296];return _0x202651;};'use strict';var util=require(_0xc1e2('0x0'));var _=require(_0xc1e2('0x1'));var BPromise=require(_0xc1e2('0x2'));var uuid=require(_0xc1e2('0x3'));var moment=require(_0xc1e2('0x4'));var md5=require(_0xc1e2('0x5'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xc1e2('0x6'))(_0xc1e2('0x7'));var loggerAction=require('../../../config/logger')(_0xc1e2('0x8'));var ami=require(_0xc1e2('0x9'));var rpcDb=require('./rpcDb');var Action=require(_0xc1e2('0xa'));var ut=require('./util/util');config[_0xc1e2('0xb')]=_[_0xc1e2('0xc')](config[_0xc1e2('0xb')],{'host':_0xc1e2('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc1e2('0xb')]));var Sequence=function(){};Sequence[_0xc1e2('0xe')][_0xc1e2('0xf')]=function(_0x38d898){this[_0xc1e2('0x10')]=this['tail']?this[_0xc1e2('0x10')]['finally'](_0x38d898):_0x38d898();};function Preview(_0xc4eb78){this[_0xc1e2('0x11')]=new Sequence();this[_0xc1e2('0x12')]=_0xc4eb78[_0xc1e2('0x13')];this[_0xc1e2('0x14')]=_0xc4eb78['trunks'];this[_0xc1e2('0x15')]={};this[_0xc1e2('0x16')]=_0xc4eb78['agents'];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this[_0xc1e2('0x17')][_0xc1e2('0x18')](this));ami['on'](_0xc1e2('0x19'),this[_0xc1e2('0x1a')][_0xc1e2('0x18')](this));ami['on']('hanguprequest',this[_0xc1e2('0x1b')][_0xc1e2('0x18')](this));ami['on'](_0xc1e2('0x1c'),this['syncDialEnd'][_0xc1e2('0x18')](this));ami['on'](_0xc1e2('0x1d'),this[_0xc1e2('0x1e')][_0xc1e2('0x18')](this));ami['on'](_0xc1e2('0x1f'),this[_0xc1e2('0x20')][_0xc1e2('0x18')](this));ami['on'](_0xc1e2('0x21'),this['syncAttendedTransfer'][_0xc1e2('0x18')](this));ami['on'](_0xc1e2('0x22'),this[_0xc1e2('0x23')][_0xc1e2('0x18')](this));this[_0xc1e2('0x24')](this['campaignsPreview']);}function emit(_0x3e5445,_0x4bcbdd,_0x320bf2){io['to'](_0x3e5445)['emit'](_0x4bcbdd,_0x320bf2);}function emitCampaignPreview(_0x378250){if(_0x378250[_0xc1e2('0x25')]===_0xc1e2('0x26')){var _0x3d455c={'id':_0x378250['id'],'name':_0x378250['name'],'strategy':_0x378250[_0xc1e2('0x27')],'answered':_0x378250['answered'],'available':_0x378250[_0xc1e2('0x28')],'loggedIn':_0x378250[_0xc1e2('0x29')],'pTalking':_0x378250[_0xc1e2('0x2a')],'sumBillable':_0x378250[_0xc1e2('0x2b')],'sumDuration':_0x378250['sumDuration'],'sumHoldTime':_0x378250['sumHoldTime']||0x0,'talking':_0x378250[_0xc1e2('0x2c')],'total':_0x378250[_0xc1e2('0x2d')],'type':_0x378250['type'],'unmanaged':_0x378250[_0xc1e2('0x2e')],'abandoned':_0x378250[_0xc1e2('0x2f')],'waiting':_0x378250[_0xc1e2('0x30')],'loggedInDb':_0x378250['loggedInDb'],'dialActive':_0x378250[_0xc1e2('0x31')],'dialMethod':_0x378250[_0xc1e2('0x32')],'dialOriginateCallerIdName':_0x378250['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x378250[_0xc1e2('0x33')],'dialOriginateTimeout':_0x378250[_0xc1e2('0x34')],'dialPrefix':_0x378250[_0xc1e2('0x35')],'outboundAnswerAgiCallsDay':_0x378250['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x378250[_0xc1e2('0x36')],'outboundBlacklistCallsDay':_0x378250['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x378250['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x378250[_0xc1e2('0x37')],'outboundDropCallsDayACS':_0x378250[_0xc1e2('0x38')],'outboundDropCallsDayCallersExit':_0x378250[_0xc1e2('0x39')],'outboundDropCallsDayTimeout':_0x378250['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x378250[_0xc1e2('0x3a')],'outboundNoSuchCallsDay':_0x378250[_0xc1e2('0x3b')],'outboundOriginateFailureCallsDay':_0x378250[_0xc1e2('0x3c')],'outboundReCallsDay':_0x378250['outboundReCallsDay'],'outboundRejectCallsDay':_0x378250[_0xc1e2('0x3d')],'outboundUnknownCallsDay':_0x378250[_0xc1e2('0x3e')],'outboundAbandonedCallsDay':_0x378250['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x378250[_0xc1e2('0x3f')],'predictiveIntervalAvgHoldtime':_0x378250[_0xc1e2('0x40')],'predictiveIntervalAvgTalktime':_0x378250[_0xc1e2('0x41')],'predictiveIntervalDroppedCallsCallersExit':_0x378250[_0xc1e2('0x42')],'predictiveIntervalDroppedCallsTimeout':_0x378250[_0xc1e2('0x43')],'predictiveIntervalErlangCalls':_0x378250['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x378250[_0xc1e2('0x44')],'predictiveIntervalHitRate':_0x378250[_0xc1e2('0x45')],'predictiveIntervalMultiplicativeFactor':_0x378250[_0xc1e2('0x46')],'predictiveIntervalPauses':_0x378250['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x378250[_0xc1e2('0x47')],'predictiveIntervalTotalCalls':_0x378250[_0xc1e2('0x48')],'message':_0x378250[_0xc1e2('0x49')],'originated':_0x378250[_0xc1e2('0x4a')],'erlangCalls':_0x378250['erlangCalls'],'erlangCallToSecond':_0x378250['erlangCallToSecond'],'erlangAbandonmentRate':_0x378250[_0xc1e2('0x4b')],'erlangBusyFactor':_0x378250['erlangBusyFactor'],'startPredictive':_0x378250[_0xc1e2('0x4c')],'startProgressive':_0x378250[_0xc1e2('0x4d')]};if(_0x378250['Trunk']){_0x3d455c['Trunk']={'id':_0x378250[_0xc1e2('0x4e')]['id'],'name':_0x378250[_0xc1e2('0x4e')]['name'],'active':_0x378250[_0xc1e2('0x4e')][_0xc1e2('0x4f')],'callerid':_0x378250[_0xc1e2('0x4e')][_0xc1e2('0x50')]};}if(_0x378250['Interval']){_0x3d455c[_0xc1e2('0x51')]={'id':_0x378250['Interval']['id'],'name':_0x378250[_0xc1e2('0x51')]['name']};}var _0x23fc15=md5(JSON[_0xc1e2('0x52')](_0x3d455c));if(_0x378250['md5']!==_0x23fc15){_0x378250[_0xc1e2('0x5')]=_0x23fc15;emit(util[_0xc1e2('0x53')](_0xc1e2('0x54'),_0x3d455c[_0xc1e2('0x55')]),_0xc1e2('0x56'),_0x3d455c);}}}function emitVoiceQueueChannelRemove(_0x52b9eb){logger['info'](_0xc1e2('0x57'),JSON['stringify'](_0x52b9eb));emit(util[_0xc1e2('0x53')]('voice:queue:%s',_0x52b9eb['name']),_0xc1e2('0x58'),_0x52b9eb);io['emit'](_0xc1e2('0x59'),_0x52b9eb);}function notSendMessagesQueue(_0x3f3085){if(_0x3f3085['sendMessageOneNotActive']){if(_0x3f3085[_0xc1e2('0x4a')]===0x0&&_0x3f3085[_0xc1e2('0x2a')]===0x0){_0x3f3085['sendMessageOneNotActive']=![];_0x3f3085[_0xc1e2('0x28')]=0x0;_0x3f3085[_0xc1e2('0x5a')]=0x0;_0x3f3085[_0xc1e2('0x49')]=_0xc1e2('0x5b');ut[_0xc1e2('0x5c')](_0xc1e2('0x5d'),_0x3f3085[_0xc1e2('0x55')]+_0xc1e2('0x5e'));}else{_0x3f3085['message']='IS_DISACTIVED';ut[_0xc1e2('0x5c')](_0xc1e2('0x5d'),_0x3f3085[_0xc1e2('0x55')]+_0xc1e2('0x5f'));}emitCampaignPreview(_0x3f3085);}}Preview[_0xc1e2('0xe')][_0xc1e2('0x24')]=function(){var _0x190e78=this;setInterval(function(){_0x190e78[_0xc1e2('0x60')]();},0x7cf);};Preview[_0xc1e2('0xe')]['syncCampaigns']=function(){var _0x2a2401=this[_0xc1e2('0x12')];this[_0xc1e2('0x61')]+=0x1;for(var _0x15bee9 in _0x2a2401){if(_0x2a2401['hasOwnProperty'](_0x15bee9)&&(_0x2a2401[_0x15bee9][_0xc1e2('0x32')]===_0xc1e2('0x7')||_0x2a2401[_0x15bee9][_0xc1e2('0x32')]===_0xc1e2('0x62'))&&_0x2a2401[_0x15bee9]['type']===_0xc1e2('0x26')){if(this[_0xc1e2('0x61')]>0x7){this[_0xc1e2('0x61')]=0x0;this[_0xc1e2('0x63')]();}}if(_0x2a2401[_0xc1e2('0x64')](_0x15bee9)&&_0x2a2401[_0x15bee9][_0xc1e2('0x32')]===_0xc1e2('0x7')&&_0x2a2401[_0x15bee9][_0xc1e2('0x25')]==='outbound'){if(_0x2a2401[_0x15bee9]['dialActive']){this['setMessage'](_0x2a2401[_0x15bee9]);this['recallMe'](_0x2a2401[_0x15bee9]);}else{notSendMessagesQueue(_0x2a2401[_0x15bee9]);}}}};Preview[_0xc1e2('0xe')][_0xc1e2('0x65')]=function(_0x554999){var _0x2d9d17=this;this[_0xc1e2('0x11')]['enqueue'](function(){if(!_[_0xc1e2('0x66')](_0x2d9d17['actions'][_0x554999])){loggerAction[_0xc1e2('0x67')](_0xc1e2('0x68'),_0x554999,_0xc1e2('0x69'),_0x2d9d17[_0xc1e2('0x15')][_0x554999]['queue'],_0xc1e2('0x6a'),JSON[_0xc1e2('0x52')](_0x2d9d17[_0xc1e2('0x12')][_0x2d9d17[_0xc1e2('0x15')][_0x554999][_0xc1e2('0x6b')]]['originated']),_0xc1e2('0x6c'),JSON['stringify'](_0x2d9d17[_0xc1e2('0x12')][_0x2d9d17['actions'][_0x554999][_0xc1e2('0x6b')]][_0xc1e2('0x2a')]),JSON['stringify'](_0x2d9d17[_0xc1e2('0x15')][_0x554999][_0xc1e2('0x6d')]),JSON[_0xc1e2('0x52')](_[_0xc1e2('0x6e')](_0x2d9d17['actions'][_0x554999],['contactId',_0xc1e2('0x6f'),_0xc1e2('0x70'),_0xc1e2('0x71')])));return ami[_0xc1e2('0x72')]({'action':_0xc1e2('0x73'),'channel':_0x2d9d17[_0xc1e2('0x15')][_0x554999][_0xc1e2('0x74')]})[_0xc1e2('0x75')](function(_0x1161cb){if(_0x1161cb[_0xc1e2('0x49')]===_0xc1e2('0x76')){setTimeout(function(){if(_0x2d9d17[_0xc1e2('0x15')][_0x554999]){ut[_0xc1e2('0x77')](_0x2d9d17[_0xc1e2('0x12')][_0x2d9d17[_0xc1e2('0x15')][_0x554999]['queue']],_0xc1e2('0x78'));if(_0x2d9d17[_0xc1e2('0x15')][_0x554999][_0xc1e2('0x6d')]===!![]){ut[_0xc1e2('0x79')](_0x2d9d17[_0xc1e2('0x12')][_0x2d9d17['actions'][_0x554999][_0xc1e2('0x6b')]],_0xc1e2('0x78'));ut[_0xc1e2('0x7a')]('[Dialer][checkChannel][pTalking][Preview]'+_0x554999,_0x2d9d17[_0xc1e2('0x15')][_0x554999]['queue']);}ut[_0xc1e2('0x7a')](_0xc1e2('0x7b')+_0x554999,_0x2d9d17[_0xc1e2('0x15')][_0x554999]['queue']);delete _0x2d9d17['actions'][_0x554999];}},0x2328);}});}});};Preview['prototype'][_0xc1e2('0x63')]=function(){var _0x526343=this;loggerAction['info'](_0xc1e2('0x7c'),_[_0xc1e2('0x7d')](this[_0xc1e2('0x15')]));for(var _0xef31d1 in this[_0xc1e2('0x15')]){if(_0x526343['actions']['hasOwnProperty'](_0xef31d1)){_0x526343['clearZombieChannel'](_0xef31d1);}}};Preview['prototype'][_0xc1e2('0x7e')]=function(_0x2f9f17){var _0x4d74c6=this;rpcDb['getContactRecallMe'](_0x2f9f17['id'],ut[_0xc1e2('0x7f')](this[_0xc1e2('0x16')]))[_0xc1e2('0x80')](function(_0x4eacfa){if(!_[_0xc1e2('0x66')](_0x4eacfa)){for(var _0x3ed162=0x0;_0x3ed162<_0x4eacfa[_0xc1e2('0x81')];_0x3ed162+=0x1){if(ut[_0xc1e2('0x82')](_0x4eacfa[_0x3ed162][_0xc1e2('0x83')])<_0x2f9f17[_0xc1e2('0x84')]*0x3c){if(_0x4eacfa[_0x3ed162]['Agent']&&!_0x4eacfa[_0x3ed162][_0xc1e2('0x85')][_0xc1e2('0x86')]){_0x4d74c6[_0xc1e2('0x87')](_0x4eacfa[_0x3ed162]['id'])[_0xc1e2('0x80')](ut[_0xc1e2('0x88')](_0xc1e2('0x89')))[_0xc1e2('0x75')](ut[_0xc1e2('0x88')](_0xc1e2('0x89')));}else{rpcDb[_0xc1e2('0x8a')](_0x4eacfa[_0x3ed162]['id']);}}else{var _0x5ce61f=new Action(_0x4eacfa[_0x3ed162],_0x2f9f17);_0x5ce61f[_0xc1e2('0x8b')]=moment()[_0xc1e2('0x53')](_0xc1e2('0x8c'));_0x2f9f17['outboundReCallsDay']+=0x1;ut[_0xc1e2('0x8d')](_0x5ce61f,0x17,_0xc1e2('0x8e'));if(_0x2f9f17['dialRecallInQueue']){rpcDb[_0xc1e2('0x8f')](ut['createBody'](_0x4eacfa[_0x3ed162]));rpcDb[_0xc1e2('0x90')](_0x5ce61f,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xc1e2('0x8d')](_0x5ce61f,0x16,'RecallFailedTimeout');rpcDb[_0xc1e2('0x90')](_0x5ce61f,'[HistoryRecallClose]');rpcDb[_0xc1e2('0x91')](_0x5ce61f,'[HistoryRecallClose]');}}}}})[_0xc1e2('0x75')](ut[_0xc1e2('0x88')](_0xc1e2('0x92')));};Preview[_0xc1e2('0xe')][_0xc1e2('0x93')]=function(_0x491949){_0x491949['sendMessageOneNotActive']=!![];if(ut[_0xc1e2('0x94')](_0x491949['loggedIn'])){_0x491949[_0xc1e2('0x49')]=_0xc1e2('0x95');}else if(!ut[_0xc1e2('0x96')](_0x491949[_0xc1e2('0x31')])){_0x491949[_0xc1e2('0x49')]=_0xc1e2('0x5b');}else if(!this[_0xc1e2('0x97')](_0x491949[_0xc1e2('0x4e')])){if(!this[_0xc1e2('0x97')](_0x491949[_0xc1e2('0x98')])){_0x491949[_0xc1e2('0x49')]=_0xc1e2('0x99');}else{_0x491949[_0xc1e2('0x49')]=_0xc1e2('0x9a');}}else{_0x491949['message']='ACTIVE';}emitCampaignPreview(_0x491949);};Preview[_0xc1e2('0xe')][_0xc1e2('0x9b')]=function(_0x1a0edd,_0x7188c6,_0x562ecb){var _0x585008=this;var _0x3b8ba8=this[_0xc1e2('0x15')][_0x7188c6];var _0x27e902=this[_0xc1e2('0x12')][_0x3b8ba8[_0xc1e2('0x6b')]];var _0x231078;if(_0x27e902){switch(_0x562ecb){case'1':_0x27e902[_0xc1e2('0x3b')]+=0x1;_0x3b8ba8[_0xc1e2('0x9c')]+=0x1;_0x3b8ba8[_0xc1e2('0x9d')]=ut[_0xc1e2('0x9e')](_0x3b8ba8);ut['logCustomer'](_0x3b8ba8,0x0,'NoSuchNumber');ami[_0xc1e2('0x9f')](_0xc1e2('0xa0'),ut[_0xc1e2('0xa1')](_0x3b8ba8,_0xc1e2('0xa2')));rpcDb['createCustomerHistory'](_0x3b8ba8,_0xc1e2('0xa3'));if(ut[_0xc1e2('0x9e')](_0x3b8ba8)>=_0x27e902['dialGlobalMaxRetry']){_0x231078=ut[_0xc1e2('0xa4')](_0x3b8ba8,0xf,_0xc1e2('0xa5'));rpcDb[_0xc1e2('0x91')](_0x231078,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x3b8ba8['countnosuchnumberretry']>=_0x27e902['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x3b8ba8,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut[_0xc1e2('0xa6')](_0x3b8ba8,_0xc1e2('0x9c'),_0x27e902[_0xc1e2('0xa7')]),_0x3b8ba8[_0xc1e2('0xa8')],_0x3b8ba8[_0xc1e2('0xa9')]);}}delete this['actions'][_0x1a0edd['linkedid']];break;case _0xc1e2('0xaa'):var _0x1b2982=moment()['format'](_0xc1e2('0x8c'));_0x3b8ba8[_0xc1e2('0xab')]=_0x1b2982;_0x3b8ba8[_0xc1e2('0xac')]=_0x1b2982;_0x3b8ba8[_0xc1e2('0x6d')]=!![];_0x27e902[_0xc1e2('0x2a')]+=0x1;logger['info']('[syncHangup][talking][increment]',_0x3b8ba8[_0xc1e2('0xad')],_0xc1e2('0xae'),_0x27e902['name'],_0xc1e2('0x6c'),_0x27e902[_0xc1e2('0x2a')]);ami[_0xc1e2('0x9f')](_0xc1e2('0xaf'),ut[_0xc1e2('0xa1')](_0x3b8ba8,_0xc1e2('0xb0'),this[_0xc1e2('0x12')][_0x3b8ba8[_0xc1e2('0x6b')]]));if(_0x27e902[_0xc1e2('0xb1')]){ami[_0xc1e2('0x9f')](_0xc1e2('0xb2'),ut['buildAcw'](_0x3b8ba8));}break;case'16':ami[_0xc1e2('0x9f')](_0xc1e2('0xb3'),ut[_0xc1e2('0xa1')](_0x3b8ba8,_0xc1e2('0xb4'),this['campaignsPreview'][_0x3b8ba8[_0xc1e2('0x6b')]]));emitVoiceQueueChannelRemove(ut[_0xc1e2('0xa1')](_0x3b8ba8,_0xc1e2('0xb4')));_0x27e902[_0xc1e2('0x36')]+=0x1;_0x27e902[_0xc1e2('0x2d')]+=0x1;_0x27e902[_0xc1e2('0xb5')]+=0x1;ut[_0xc1e2('0x79')](_0x27e902,_0xc1e2('0xb6'));_0x3b8ba8[_0xc1e2('0x9d')]=ut[_0xc1e2('0x9e')](_0x3b8ba8);ut[_0xc1e2('0x8d')](_0x3b8ba8,0x4,'Answer');rpcDb[_0xc1e2('0x90')](_0x3b8ba8,_0xc1e2('0xb7'));rpcDb['createCustomerFinal'](_0x3b8ba8,_0xc1e2('0xb8'));rpcDb[_0xc1e2('0xb9')](_0x3b8ba8);_0x27e902[_0xc1e2('0xba')]+=_0x3b8ba8[_0xc1e2('0xbb')];_0x27e902[_0xc1e2('0x2b')]+=_0x3b8ba8['talktime'];logger[_0xc1e2('0x67')](_0xc1e2('0xbc'),_0x3b8ba8[_0xc1e2('0xad')],_0xc1e2('0xae'),_0x27e902[_0xc1e2('0x55')],_0xc1e2('0x6c'),_0x27e902[_0xc1e2('0x2a')]);delete this[_0xc1e2('0x15')][_0x1a0edd[_0xc1e2('0xbd')]];break;case _0xc1e2('0xbe'):_0x27e902[_0xc1e2('0xbf')]+=0x1;_0x3b8ba8[_0xc1e2('0xc0')]+=0x1;_0x3b8ba8[_0xc1e2('0x9d')]=ut[_0xc1e2('0x9e')](_0x3b8ba8);ut['logCustomer'](_0x3b8ba8,0x5,'Busy');ami[_0xc1e2('0x9f')](_0xc1e2('0xc1'),ut[_0xc1e2('0xa1')](_0x3b8ba8,_0xc1e2('0xc2')));rpcDb[_0xc1e2('0x90')](_0x3b8ba8,_0xc1e2('0xc3'));if(ut[_0xc1e2('0x9e')](_0x3b8ba8)>=_0x27e902['dialGlobalMaxRetry']){_0x231078=ut[_0xc1e2('0xa4')](_0x3b8ba8,0xf,'Global');rpcDb[_0xc1e2('0x91')](_0x231078,_0xc1e2('0xc4'));}else{if(_0x3b8ba8[_0xc1e2('0xc0')]>=_0x27e902[_0xc1e2('0xc5')]){rpcDb['createCustomerFinal'](_0x3b8ba8,_0xc1e2('0xc3'));}else{rpcDb[_0xc1e2('0xc6')](ut['scheduledAt'](_0x3b8ba8,'countbusyretry',_0x27e902['dialBusyRetryFrequency']),_0x3b8ba8[_0xc1e2('0xa8')],_0x3b8ba8[_0xc1e2('0xa9')]);}}break;case _0xc1e2('0xc7'):_0x27e902[_0xc1e2('0x3a')]+=0x1;_0x3b8ba8[_0xc1e2('0xc8')]+=0x1;_0x3b8ba8['countglobal']=ut['totalGlobal'](_0x3b8ba8);ut[_0xc1e2('0x8d')](_0x3b8ba8,0x3,_0xc1e2('0xc9'));ami[_0xc1e2('0x9f')]('custom:agentnoanswer',ut[_0xc1e2('0xa1')](_0x3b8ba8,'noanswer'));rpcDb[_0xc1e2('0x90')](_0x3b8ba8,_0xc1e2('0xca'));if(ut['totalGlobal'](_0x3b8ba8)>=_0x27e902[_0xc1e2('0xcb')]){_0x231078=ut[_0xc1e2('0xa4')](_0x3b8ba8,0xf,_0xc1e2('0xa5'));rpcDb[_0xc1e2('0x91')](_0x231078,_0xc1e2('0xcc'));}else{if(_0x3b8ba8[_0xc1e2('0xc8')]>=_0x27e902['dialNoAnswerMaxRetry']){rpcDb[_0xc1e2('0x91')](_0x3b8ba8,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xc1e2('0xc6')](ut[_0xc1e2('0xa6')](_0x3b8ba8,_0xc1e2('0xc8'),_0x27e902[_0xc1e2('0xcd')]),_0x3b8ba8[_0xc1e2('0xa8')],_0x3b8ba8[_0xc1e2('0xa9')]);}}break;case'CONGESTION':_0x27e902[_0xc1e2('0x37')]+=0x1;_0x3b8ba8['countcongestionretry']+=0x1;_0x3b8ba8[_0xc1e2('0x9d')]=ut[_0xc1e2('0x9e')](_0x3b8ba8);ut['logCustomer'](_0x3b8ba8,0x8,_0xc1e2('0xce'));ami[_0xc1e2('0x9f')](_0xc1e2('0xcf'),ut[_0xc1e2('0xa1')](_0x3b8ba8,_0xc1e2('0xd0')));rpcDb[_0xc1e2('0x90')](_0x3b8ba8,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0xc1e2('0x9e')](_0x3b8ba8)>=_0x27e902['dialGlobalMaxRetry']){_0x231078=ut[_0xc1e2('0xa4')](_0x3b8ba8,0xf,_0xc1e2('0xa5'));rpcDb['createCustomerFinal'](_0x231078,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x3b8ba8[_0xc1e2('0xd1')]>=_0x27e902[_0xc1e2('0xd2')]){rpcDb[_0xc1e2('0x91')](_0x3b8ba8,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xc1e2('0xc6')](ut['scheduledAt'](_0x3b8ba8,'countcongestionretry',_0x27e902[_0xc1e2('0xd3')]),_0x3b8ba8[_0xc1e2('0xa8')],_0x3b8ba8['activeContact']);}}break;case _0xc1e2('0xd4'):_0x27e902[_0xc1e2('0x3d')]+=0x1;_0x3b8ba8[_0xc1e2('0xd5')]+=0x1;_0x3b8ba8['countglobal']=ut[_0xc1e2('0x9e')](_0x3b8ba8);ut[_0xc1e2('0x8d')](_0x3b8ba8,0x14,_0xc1e2('0xd6'));ami[_0xc1e2('0x9f')](_0xc1e2('0xd7'),ut[_0xc1e2('0xa1')](_0x3b8ba8,_0xc1e2('0xd8')));rpcDb[_0xc1e2('0x90')](_0x3b8ba8,'[syncHangupRequest][logAgentReject]');if(ut[_0xc1e2('0x9e')](_0x3b8ba8)>=_0x27e902[_0xc1e2('0xcb')]){_0x231078=ut[_0xc1e2('0xa4')](_0x3b8ba8,0x14,'AgentReject');rpcDb[_0xc1e2('0x91')](_0x231078,_0xc1e2('0xd9'));}else{if(_0x3b8ba8[_0xc1e2('0xd5')]>=_0x27e902[_0xc1e2('0xda')]){rpcDb[_0xc1e2('0x91')](_0x3b8ba8,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xc1e2('0xc6')](ut['scheduledAt'](_0x3b8ba8,_0xc1e2('0xd5'),_0x27e902['dialAgentRejectRetryFrequency']),_0x3b8ba8[_0xc1e2('0xa8')],_0x3b8ba8[_0xc1e2('0xa9')]);}}break;case _0xc1e2('0xdb'):_0x27e902[_0xc1e2('0xdc')]+=0x1;_0x3b8ba8['countabandonedretry']+=0x1;_0x3b8ba8[_0xc1e2('0x9d')]=ut[_0xc1e2('0x9e')](_0x3b8ba8);ut[_0xc1e2('0x8d')](_0x3b8ba8,0xb,'Abandoned');rpcDb[_0xc1e2('0x90')](_0x3b8ba8,_0xc1e2('0xdd'));if(ut[_0xc1e2('0x9e')](_0x3b8ba8)>=_0x27e902[_0xc1e2('0xcb')]){_0x231078=ut['cloneAction'](_0x3b8ba8,0xf,_0xc1e2('0xa5'));rpcDb[_0xc1e2('0x91')](_0x231078,_0xc1e2('0xdd'));}else{if(_0x3b8ba8[_0xc1e2('0xde')]>=_0x27e902[_0xc1e2('0xdf')]){rpcDb[_0xc1e2('0x91')](_0x3b8ba8,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xc1e2('0xc6')](ut[_0xc1e2('0xa6')](_0x3b8ba8,_0xc1e2('0xe0'),_0x27e902[_0xc1e2('0xe1')]),_0x3b8ba8[_0xc1e2('0xa8')],_0x3b8ba8[_0xc1e2('0xa9')]);}}break;default:if(_0x3b8ba8[_0xc1e2('0x6d')]){ut[_0xc1e2('0x79')](_0x27e902,'[default]');ut[_0xc1e2('0x7a')](_0xc1e2('0xe2')+_0x27e902['name'],_0x1a0edd);}_0x27e902[_0xc1e2('0x3e')]+=0x1;_0x3b8ba8[_0xc1e2('0x9d')]=ut[_0xc1e2('0x9e')](_0x3b8ba8);ut[_0xc1e2('0x8d')](_0x3b8ba8,0xc,_0x1a0edd[_0xc1e2('0xe3')]||_0x1a0edd[_0xc1e2('0xe4')]);rpcDb[_0xc1e2('0x90')](_0x3b8ba8,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0xc1e2('0x9e')](_0x3b8ba8)>=_0x27e902[_0xc1e2('0xcb')]){_0x231078=ut[_0xc1e2('0xa4')](_0x3b8ba8,0xf,_0xc1e2('0xa5'));rpcDb[_0xc1e2('0x91')](_0x231078,_0xc1e2('0xe5'));}else{rpcDb['createCustomerFinal'](_0x3b8ba8,_0xc1e2('0xe5'));}delete this[_0xc1e2('0x15')][_0x1a0edd[_0xc1e2('0xbd')]];}if(!(_0x3b8ba8[_0xc1e2('0x6d')]&&_0x562ecb==='16')){ut[_0xc1e2('0x77')](_0x27e902,_0xc1e2('0xe6'));logger[_0xc1e2('0x67')](_0xc1e2('0xe7'),_0x3b8ba8['uniqueid'],_0xc1e2('0xae'),_0x27e902[_0xc1e2('0x55')],_0xc1e2('0x6a'),_0x27e902[_0xc1e2('0x4a')]);}if(_0x562ecb!==_0xc1e2('0xaa')){delete this['actions'][_0x1a0edd[_0xc1e2('0xbd')]];delete this[_0xc1e2('0x15')][_0x1a0edd[_0xc1e2('0xe8')]];}}};Preview[_0xc1e2('0xe')][_0xc1e2('0xe9')]=function(_0x411056,_0x4a4315,_0x206acb){if(_['isUndefined'](_0x4a4315)&&_0xc1e2('0xea')!==typeof _0x4a4315){return;}if(_[_0xc1e2('0xeb')](_0x206acb)&&_0xc1e2('0xea')!==typeof _0x206acb){return;}switch(_0x206acb[_0xc1e2('0xec')]){case'0':ut[_0xc1e2('0xed')](_0x411056,0x0,_0xc1e2('0xee'));rpcDb[_0xc1e2('0xef')](_0x411056,_0xc1e2('0xf0'));break;case'3':ut['logAgent'](_0x411056,0x3,_0xc1e2('0xc9'));rpcDb[_0xc1e2('0xef')](_0x411056,_0xc1e2('0xf1'));break;case'5':ut[_0xc1e2('0xed')](_0x411056,0x5,'Busy');rpcDb['createAgentHistory'](_0x411056,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xc1e2('0xed')](_0x411056,0x8,_0xc1e2('0xce'));rpcDb[_0xc1e2('0xef')](_0x411056,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut['logAgent'](_0x411056,0x16,_0xc1e2('0xf2'));rpcDb[_0xc1e2('0xef')](_0x411056,_0xc1e2('0xf3'));break;default:ut[_0xc1e2('0xed')](_0x411056,0xc,_0x206acb['reason']);rpcDb[_0xc1e2('0xef')](_0x411056,_0xc1e2('0xf4'));}ut[_0xc1e2('0x77')](_0x4a4315,'[callProgressDetectingAgent]');logger[_0xc1e2('0x67')](_0xc1e2('0xf5'),_0x411056[_0xc1e2('0xad')],_0xc1e2('0xae'),_0x4a4315[_0xc1e2('0x55')],_0xc1e2('0x6a'),_0x4a4315[_0xc1e2('0x4a')]);delete this[_0xc1e2('0x15')][_0x411056['uniqueid']];};Preview[_0xc1e2('0xe')][_0xc1e2('0xf6')]=function(_0x7ff3f1,_0x410fa1,_0x537570,_0x503d57,_0x238248){var _0x3135af=this;return new BPromise(function(_0x5bf1c1,_0xf6e4f3){if(_[_0xc1e2('0x66')](_0x410fa1)||_[_0xc1e2('0x66')](_0x410fa1[_0xc1e2('0xf7')])||_['isNil'](_0x410fa1[_0xc1e2('0xf7')][_0xc1e2('0xf8')])||_[_0xc1e2('0x66')](_0x410fa1[_0xc1e2('0x70')])){_0xf6e4f3(ut[_0xc1e2('0x49')]('Contact\x20is\x20undefined',_0x503d57,_0x238248));return;}var _0x73d5e7=uuid['v4']();var _0x5acd2b=_0x3135af[_0xc1e2('0x12')][_0x410fa1[_0xc1e2('0x69')][_0xc1e2('0x55')]];var _0x7bf07a=_0x537570?_0x3135af[_0xc1e2('0x16')][_0x537570]['id']:undefined;_0x3135af[_0xc1e2('0x15')][_0x73d5e7]=new Action(_0x410fa1,_0x5acd2b,_0x73d5e7,_0x537570,_0x7bf07a);var _0x224902=_0x3135af[_0xc1e2('0x15')][_0x73d5e7];_0x224902[_0xc1e2('0xa8')]=_0x503d57;_0x224902[_0xc1e2('0xa9')]=_0x238248;_0x224902['lookAgent']=_0x537570;if(_[_0xc1e2('0xf9')](_0x7ff3f1)){_0x3135af[_0xc1e2('0xfa')](_0x224902,_0x5acd2b,_0x410fa1,_0x537570)[_0xc1e2('0x80')](function(_0x2215d0){logger['info'](_0xc1e2('0xfb'),_0xc1e2('0xfc')+_0x224902['queue']+_0xc1e2('0xfd')+_0x224902['idContact'],JSON[_0xc1e2('0x52')](_0x2215d0));ami[_0xc1e2('0x9f')](_0xc1e2('0xfe'),ut['buildObj'](_0x224902,'called',_0x3135af[_0xc1e2('0x12')][_0x224902[_0xc1e2('0x6b')]]));_0x5bf1c1(ut[_0xc1e2('0x49')]('Calling'));})[_0xc1e2('0x75')](function(_0x567606){ut[_0xc1e2('0x5c')]('[Preview][execCall][failure]',_0x567606);_0xf6e4f3(ut['message'](_0xc1e2('0xff'),_0x503d57,_0x238248));});}else{_0x5acd2b[_0xc1e2('0x100')]+=0x1;ut['logBlacklist'](_0x224902);rpcDb[_0xc1e2('0x101')](_0x224902,_0xc1e2('0x102'));delete _0x3135af[_0xc1e2('0x15')][_0x73d5e7];_0xf6e4f3(ut[_0xc1e2('0x49')](_0xc1e2('0x103'),_0x503d57,_0x238248));}});};Preview[_0xc1e2('0xe')][_0xc1e2('0x97')]=function(_0x1531b5){return!_[_0xc1e2('0x66')](_0x1531b5)&&!_[_0xc1e2('0x66')](_0x1531b5[_0xc1e2('0x55')])&&!_['isNil'](_0x1531b5[_0xc1e2('0x4f')])&&_0x1531b5['active']&&!_[_0xc1e2('0x66')](this[_0xc1e2('0x14')][util[_0xc1e2('0x53')]('SIP/%s',_0x1531b5[_0xc1e2('0x55')])])&&!_[_0xc1e2('0x66')](this[_0xc1e2('0x14')][util[_0xc1e2('0x53')](_0xc1e2('0x104'),_0x1531b5['name'])][_0xc1e2('0x73')])&&(this['trunks'][util[_0xc1e2('0x53')](_0xc1e2('0x104'),_0x1531b5['name'])][_0xc1e2('0x73')]===_0xc1e2('0x105')||this[_0xc1e2('0x14')][util[_0xc1e2('0x53')](_0xc1e2('0x104'),_0x1531b5['name'])][_0xc1e2('0x73')]===_0xc1e2('0x106'));};Preview[_0xc1e2('0xe')][_0xc1e2('0x87')]=function(_0x2f4269,_0x529cda){var _0x357019=this;return new BPromise(function(_0x8d7b4a,_0x4d0e73){_0x357019[_0xc1e2('0x107')](_0x2f4269,_0x529cda)['then'](function(_0x3722cd){_0x8d7b4a(_['pick'](_0x3722cd,['message']));})[_0xc1e2('0x75')](function(_0x33043c){if(_0x33043c[_0xc1e2('0x108')]){rpcDb['unlockContact'](_0x2f4269);}if(_0x33043c[_0xc1e2('0x4f')]){rpcDb['disableContact'](_0x2f4269);}_0x4d0e73(_[_0xc1e2('0x6e')](_0x33043c,['message']));});});};Preview['prototype'][_0xc1e2('0x107')]=function(_0x1bf233,_0x2d2be6){var _0x13d7a9=this;return new BPromise(function(_0x15297f,_0x1fe0af){var _0x1b20ce,_0x3a40a1;rpcDb[_0xc1e2('0x109')](_0x1bf233)['then'](function(_0x37e2a1){if(!_['isNil'](_0x37e2a1[0x0])){_0x3a40a1=_0x37e2a1[0x0][_0xc1e2('0x10a')]?![]:!![];_0x1b20ce=_0x37e2a1[0x0][_0xc1e2('0x10a')]?!![]:![];_0x1b20ce=_0x2d2be6?!![]:_0x1b20ce;}var _0x320b76=_0x13d7a9['validateContact'](_0x37e2a1);if(_0x320b76[_0xc1e2('0x10b')]){rpcDb['checkIsBlackList'](_[_0xc1e2('0x6e')](_0x37e2a1[0x0],[_0xc1e2('0x70'),_0xc1e2('0x10c')]))[_0xc1e2('0x80')](function(_0xec18cf){_0x13d7a9[_0xc1e2('0xf6')](_0xec18cf,_0x37e2a1[0x0],_0x2d2be6,_0x3a40a1,_0x1b20ce)['then'](function(_0x349c4c){_0x15297f(_0x349c4c);})[_0xc1e2('0x75')](function(_0xac76c5){_0x1fe0af(_0xac76c5);});})[_0xc1e2('0x75')](function(_0x444e63){ut['logger'](_0xc1e2('0x10d'),_0x444e63);_0x1fe0af(ut[_0xc1e2('0x49')](_0xc1e2('0x10e'),_0x3a40a1,_0x1b20ce));});}else{_0x1fe0af(ut['message'](_0x320b76[_0xc1e2('0x49')],_0x3a40a1,_0x1b20ce));}})['catch'](function(_0x3a9c6d){ut['logger'](_0xc1e2('0x10f'),_0x3a9c6d);_0x1fe0af(ut[_0xc1e2('0x49')](_0xc1e2('0x10e'),![],!![]));});});};Preview[_0xc1e2('0xe')][_0xc1e2('0x110')]=function(_0x1ccce8){if(_[_0xc1e2('0x66')](_0x1ccce8)||_[_0xc1e2('0xf9')](_0x1ccce8)||!_[_0xc1e2('0x66')](_0x1ccce8[0x0][_0xc1e2('0x85')])&&_[_0xc1e2('0x66')](_0x1ccce8[0x0][_0xc1e2('0x85')]['name'])){ut['logger'](_0xc1e2('0x111'),_0x1ccce8);return{'isValid':![],'message':_0xc1e2('0x112')};}var _0x4befa6=this[_0xc1e2('0x12')][_0x1ccce8[0x0][_0xc1e2('0x69')][_0xc1e2('0x55')]];_0x4befa6[_0xc1e2('0x49')]='ACTIVE';if(_[_0xc1e2('0x66')](_0x4befa6)){ut[_0xc1e2('0x5c')](_0xc1e2('0x113'),_0x4befa6);return{'isValid':![],'message':_0xc1e2('0x114')};}if(!this['isTrunkReachable'](_0x4befa6[_0xc1e2('0x4e')])){ut[_0xc1e2('0x5c')](_0xc1e2('0x115'),_0xc1e2('0x116')+_0x4befa6[_0xc1e2('0x55')]+_0xc1e2('0x117'));if(!this['isTrunkReachable'](_0x4befa6[_0xc1e2('0x98')])){ut[_0xc1e2('0x5c')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x4befa6[_0xc1e2('0x55')]+_0xc1e2('0x118'));return{'isValid':![],'message':_0xc1e2('0x119')};}}if(!ut[_0xc1e2('0x96')](_0x4befa6[_0xc1e2('0x31')])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x4befa6[_0xc1e2('0x55')]+_0xc1e2('0x11a'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4befa6[_0xc1e2('0x55')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xc1e2('0x11b')};};Preview[_0xc1e2('0xe')][_0xc1e2('0xfa')]=function(_0x190393,_0x334e45,_0xba18a6,_0x2d35a1){var _0x543b49=this;return new BPromise(function(_0x3cce46,_0x16c6ab){var _0x463918=_0x190393[_0xc1e2('0xad')];var _0x363bcb=_0x543b49[_0xc1e2('0x97')](_0x334e45[_0xc1e2('0x4e')])?util['format'](_0xc1e2('0x11c'),_0x334e45[_0xc1e2('0x4e')][_0xc1e2('0x55')],_['isNil'](_0x334e45[_0xc1e2('0x35')])?'':_0x334e45['dialPrefix'][_0xc1e2('0x11d')]()||'',_0x334e45[_0xc1e2('0x11e')]>0x0?_0xba18a6[_0xc1e2('0xf7')][_0xc1e2('0xf8')]['substring'](_0x334e45[_0xc1e2('0x11e')]):_0xba18a6[_0xc1e2('0xf7')]['phone']):util[_0xc1e2('0x53')]('SIP/%s/%s%s',_['isNil'](_0x334e45[_0xc1e2('0x98')])?_0x334e45[_0xc1e2('0x4e')][_0xc1e2('0x55')]:_0x334e45[_0xc1e2('0x98')][_0xc1e2('0x55')],_['isNil'](_0x334e45[_0xc1e2('0x35')])?'':_0x334e45['dialPrefix'][_0xc1e2('0x11d')]()||'',_0x334e45[_0xc1e2('0x11e')]>0x0?_0xba18a6[_0xc1e2('0xf7')][_0xc1e2('0xf8')]['substring'](_0x334e45[_0xc1e2('0x11e')]):_0xba18a6[_0xc1e2('0xf7')]['phone']);var _0x3c485d=_0x543b49[_0xc1e2('0x97')](_0x334e45['Trunk'])?ut[_0xc1e2('0x11f')](_0x334e45[_0xc1e2('0x4e')][_0xc1e2('0x50')],_0x334e45[_0xc1e2('0x120')],_0x334e45[_0xc1e2('0x121')]>0x0?ut[_0xc1e2('0x122')](_0x334e45[_0xc1e2('0x33')],_0x334e45[_0xc1e2('0x121')]):_0x334e45[_0xc1e2('0x33')]):ut[_0xc1e2('0x11f')](_['isNil'](_0x334e45[_0xc1e2('0x98')])?_0x334e45['Trunk']['callerid']:_0x334e45[_0xc1e2('0x98')][_0xc1e2('0x50')],_0x334e45[_0xc1e2('0x120')],_0x334e45[_0xc1e2('0x121')]>0x0?ut[_0xc1e2('0x122')](_0x334e45[_0xc1e2('0x33')],_0x334e45[_0xc1e2('0x121')]):_0x334e45[_0xc1e2('0x33')]);if(_0x3c485d){_0x190393['originatecalleridname']=ut[_0xc1e2('0x123')](_0x3c485d);_0x190393[_0xc1e2('0x124')]=ut[_0xc1e2('0x125')](_0x3c485d);}var _0x593b74=ut[_0xc1e2('0x126')](_0x334e45,_0xba18a6,_0x363bcb,_0x3c485d,_0x463918,_0x190393);_[_0xc1e2('0x127')](_0x190393,ut[_0xc1e2('0x128')](_0x593b74));_0x190393['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ami[_0xc1e2('0x72')](ut['variablesAction'](_0x190393,_0x334e45,_0x593b74,_0x190393[_0xc1e2('0xa9')],_0x2d35a1))[_0xc1e2('0x80')](function(_0x46f957){_0x334e45['originated']+=0x1;logger[_0xc1e2('0x67')]('[originated][increment]',_0x463918,_0xc1e2('0xae'),_0x334e45[_0xc1e2('0x55')],_0xc1e2('0x6a'),_0x334e45[_0xc1e2('0x4a')]);_0x3cce46(_0x46f957);})[_0xc1e2('0x75')](function(_0x2ba0aa){ut[_0xc1e2('0xed')](_0x190393,0xe,_0xc1e2('0x129'));rpcDb['createAgentHistory'](_0x190393,_0xc1e2('0x12a'));_0x16c6ab(_0x2ba0aa);});});};Preview[_0xc1e2('0xe')][_0xc1e2('0x1e')]=function(_0x3aae32){if(this['actions'][_0x3aae32[_0xc1e2('0xbd')]]){this[_0xc1e2('0x15')][_0x3aae32[_0xc1e2('0xbd')]]['channel']=_0x3aae32['channel'];}};Preview[_0xc1e2('0xe')]['syncOriginateResponse']=function(_0xcfd5dd){var _0x2c4d6b=this;var _0x2a26b8=this['actions'][_0xcfd5dd['actionid']];if(_0x2a26b8){if(_0x2a26b8[_0xc1e2('0x12b')]&&this[_0xc1e2('0x16')][_0x2a26b8[_0xc1e2('0x12b')]]){ut[_0xc1e2('0x12c')](_0x2a26b8,this[_0xc1e2('0x16')][_0x2a26b8['lookAgent']][_0xc1e2('0x55')],this[_0xc1e2('0x16')][_0x2a26b8[_0xc1e2('0x12b')]]['id']);}var _0x18049a=_[_0xc1e2('0x12d')](_0x2a26b8);_0x18049a[_0xc1e2('0xab')]=moment()[_0xc1e2('0x53')](_0xc1e2('0x8c'));var _0x4aebd5=_0x2c4d6b['campaignsPreview'][_0x2a26b8[_0xc1e2('0x6b')]];if(ut[_0xc1e2('0x12e')](_0xcfd5dd[_0xc1e2('0x12f')])){if(_0x2a26b8['unlockAgent']){rpcDb[_0xc1e2('0x130')](_0x2a26b8[_0xc1e2('0x131')]);}if(_0x2a26b8[_0xc1e2('0xa9')]){rpcDb[_0xc1e2('0x8a')](_0x2a26b8[_0xc1e2('0x131')]);}ami[_0xc1e2('0x9f')](_0xc1e2('0x132'),ut['buildObj'](_0x2a26b8,_0xc1e2('0x133'),this[_0xc1e2('0x12')][_0x2a26b8[_0xc1e2('0x6b')]]));this[_0xc1e2('0xe9')](_0x18049a,_0x4aebd5,_0xcfd5dd);}else{_0x2a26b8[_0xc1e2('0x8b')]=moment()[_0xc1e2('0x53')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xc1e2('0xed')](_0x18049a,0x4,_0xc1e2('0x134'));rpcDb[_0xc1e2('0xef')](_0x18049a,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0xc1e2('0xe')][_0xc1e2('0x1a')]=function(_0x27d021){var _0x339320=this;var _0x9a39e0=this[_0xc1e2('0x15')][_0x27d021[_0xc1e2('0xbd')]];var _0x4aaea2;if(_0x9a39e0){_0x4aaea2=this['campaignsPreview'][_0x9a39e0[_0xc1e2('0x6b')]];logger[_0xc1e2('0x67')]('[syncHangup][talking]',_0x27d021['linkedid'],_0xc1e2('0xae'),_0x4aaea2[_0xc1e2('0x55')],_0xc1e2('0x6c'),_0x4aaea2[_0xc1e2('0x2a')]);}if(this[_0xc1e2('0x15')][_0x27d021[_0xc1e2('0xbd')]]&&_0x27d021[_0xc1e2('0xbd')]!==_0x27d021[_0xc1e2('0xad')]){if(_0x27d021[_0xc1e2('0x135')]==='16'&&this[_0xc1e2('0x15')][_0x27d021[_0xc1e2('0xbd')]][_0xc1e2('0x6d')]){this['callProgressDetectingCustomer'](_0x27d021,_0x27d021[_0xc1e2('0xbd')],_0x27d021['cause']);}else if(this[_0xc1e2('0x15')][_0x27d021['linkedid']][_0xc1e2('0x6d')]){logger['info'](_0xc1e2('0x136'),_0x27d021[_0xc1e2('0xbd')],_0x27d021['cause'],'\x20Queue',_0x4aaea2[_0xc1e2('0x55')],'pTalking:\x20',_0x4aaea2[_0xc1e2('0x2a')]);this['callProgressDetectingCustomer'](_0x27d021,_0x27d021[_0xc1e2('0xbd')],_0x27d021[_0xc1e2('0x135')]);}}else if(_0x9a39e0&&_[_0xc1e2('0x66')](_0x9a39e0[_0xc1e2('0x137')])&&_0x4aaea2[_0xc1e2('0x138')]&&_0x27d021[_0xc1e2('0xbd')]===_0x27d021['uniqueid']&&_['isNil'](_0x27d021[_0xc1e2('0xec')])&&_0x27d021[_0xc1e2('0x135')]==='16'&&_0x27d021[_0xc1e2('0x139')]==='6'&&_['isUndefined'](_0x9a39e0[_0xc1e2('0x13a')])){if(_0x9a39e0[_0xc1e2('0xa8')]){rpcDb[_0xc1e2('0x130')](_0x9a39e0[_0xc1e2('0x131')]);}if(_0x9a39e0['activeContact']){rpcDb['disableContact'](_0x9a39e0[_0xc1e2('0x131')]);}_0x27d021[_0xc1e2('0xec')]='22';this[_0xc1e2('0xe9')](_0x9a39e0,_0x4aaea2,_0x27d021);}else if(_0x9a39e0&&_0x9a39e0[_0xc1e2('0x13a')]){if(_0x27d021[_0xc1e2('0x135')]==='16'&&this[_0xc1e2('0x15')][_0x27d021['linkedid']][_0xc1e2('0x6d')]){logger[_0xc1e2('0x67')](_0xc1e2('0x13b'),_0x27d021[_0xc1e2('0xbd')],_0x27d021[_0xc1e2('0x135')],'\x20Queue',_0x4aaea2['name'],_0xc1e2('0x6c'),_0x4aaea2['pTalking']);this[_0xc1e2('0x9b')](_0x27d021,_0x27d021['linkedid'],_0x27d021[_0xc1e2('0x135')]);}else if(this[_0xc1e2('0x15')][_0x27d021[_0xc1e2('0xbd')]]['dialAnswer']){logger[_0xc1e2('0x67')](_0xc1e2('0x136'),_0x27d021[_0xc1e2('0xbd')],_0x27d021['cause'],_0xc1e2('0xae'),_0x4aaea2[_0xc1e2('0x55')],'pTalking:\x20',_0x4aaea2[_0xc1e2('0x2a')]);this[_0xc1e2('0x9b')](_0x27d021,_0x27d021['linkedid'],_0x27d021[_0xc1e2('0x135')]);}}};Preview[_0xc1e2('0xe')][_0xc1e2('0x13c')]=function(_0x5e1180){if(this['actions'][_0x5e1180[_0xc1e2('0xe8')]]&&_0x5e1180[_0xc1e2('0xe8')]!==_0x5e1180['destuniqueid']){this['callProgressDetectingCustomer'](_0x5e1180,_0x5e1180[_0xc1e2('0xe8')],_0x5e1180[_0xc1e2('0xe4')]);}};Preview[_0xc1e2('0xe')][_0xc1e2('0x1b')]=function(_0x123b82){if(this[_0xc1e2('0x15')][_0x123b82['linkedid']]&&_0x123b82['linkedid']!==_0x123b82[_0xc1e2('0xad')]&&!this['actions'][_0x123b82[_0xc1e2('0xbd')]]['dialAnswer']){if(_0x123b82[_0xc1e2('0x135')]==='1'){this[_0xc1e2('0x9b')](_0x123b82,_0x123b82[_0xc1e2('0xbd')],_0x123b82[_0xc1e2('0x135')]);}}};Preview['prototype'][_0xc1e2('0x13d')]=function(_0x20a9d3,_0x225b8e,_0x426ed6){if(this['actions'][_0x20a9d3]){if(_['isNil'](this[_0xc1e2('0x15')][_0x20a9d3][_0xc1e2('0x13e')])){this[_0xc1e2('0x15')][_0x20a9d3][_0xc1e2('0x13e')]={};}this[_0xc1e2('0x15')][_0x20a9d3]['variables'][_0x225b8e]=_0x426ed6;}};Preview[_0xc1e2('0xe')][_0xc1e2('0x20')]=function(_0x20847a){try{if(!_[_0xc1e2('0x66')](_0x20847a)){if(ut['filterKey'](_[_0xc1e2('0x13f')](_0x20847a[_0xc1e2('0x140')])[0x0])){this[_0xc1e2('0x13d')](_0x20847a['uniqueid'],_[_0xc1e2('0x13f')](_0x20847a[_0xc1e2('0x140')])[0x0],_0x20847a['value']);}}}catch(_0x39150f){logger['error']('[syncVarSet][Preview]',util[_0xc1e2('0x141')](_0x39150f,{'showHidden':![],'depth':null}));}};Preview[_0xc1e2('0xe')][_0xc1e2('0x142')]=function(_0x87d53f){if(_0x87d53f){if(this[_0xc1e2('0x15')][_0x87d53f['transfertargetlinkedid']]){this['actions'][_0x87d53f[_0xc1e2('0x143')]]['transfer']=!![];}}};Preview[_0xc1e2('0xe')][_0xc1e2('0x23')]=function(_0x2dcde2){if(_0x2dcde2){if(this['actions'][_0x2dcde2[_0xc1e2('0x144')]]){this[_0xc1e2('0x15')][_0x2dcde2[_0xc1e2('0x144')]][_0xc1e2('0x13a')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 6e520d1..b8c491f 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 _0x1b20=['inspect','then','catch','[createHistory]\x20','resolve','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','holdtime','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error'];(function(_0x29846e,_0x117548){var _0x4ebf29=function(_0xec9cf7){while(--_0xec9cf7){_0x29846e['push'](_0x29846e['shift']());}};_0x4ebf29(++_0x117548);}(_0x1b20,0x66));var _0x01b2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1b20[_0x4565bf];return _0x5610ba;};'use strict';var util=require('util');var BPromise=require(_0x01b2('0x0'));var logger=require(_0x01b2('0x1'))('preview');var _=require('lodash');var cmHopper=require(_0x01b2('0x2'));var cmHopperFinal=require(_0x01b2('0x3'));var cmHopperHistory=require(_0x01b2('0x4'));var cmHopperBlack=require(_0x01b2('0x5'));var voiceQueueRt=require(_0x01b2('0x6'));var agentReportPreview=require(_0x01b2('0x7'));var voiceQueueReport=require(_0x01b2('0x8'));function loggerCatch(_0x28de4a){return function(_0x46e745){logger[_0x01b2('0x9')](_0x28de4a,util[_0x01b2('0xa')](_0x46e745,{'showHidden':![],'depth':null}));};}function create(_0x323470){return BPromise['resolve']()[_0x01b2('0xb')](cmHopperHistory['createHistory'](_0x323470))[_0x01b2('0xc')](loggerCatch(_0x01b2('0xd')));}function createAgent(_0x3bad99){return BPromise[_0x01b2('0xe')]()[_0x01b2('0xb')](agentReportPreview[_0x01b2('0xf')](_0x3bad99))[_0x01b2('0xc')](loggerCatch(_0x01b2('0xd')));}function moveContact(_0x55804c){return BPromise[_0x01b2('0xe')]()['then'](cmHopper[_0x01b2('0x10')](_0x55804c,!![]))['catch'](loggerCatch(_0x01b2('0x11')));}exports[_0x01b2('0x12')]=function(_0x2c6d4d){return BPromise[_0x01b2('0xe')]()['then'](cmHopperBlack[_0x01b2('0x12')](_0x2c6d4d))[_0x01b2('0xc')](loggerCatch(_0x01b2('0x13')));};exports[_0x01b2('0x14')]=function(_0x3bb071){return BPromise['resolve']()[_0x01b2('0xb')](cmHopper[_0x01b2('0x14')](_0x3bb071))[_0x01b2('0xc')](loggerCatch(_0x01b2('0x15')));};exports['createHistory']=function(_0x523b80,_0x2a8458){create(_0x523b80)[_0x01b2('0xc')](loggerCatch(_0x2a8458));moveContact(_0x523b80)['catch'](loggerCatch(_0x2a8458));};exports[_0x01b2('0x16')]=function(_0x444236,_0x27a0bc){createAgent(_0x444236)['catch'](loggerCatch(_0x27a0bc));};exports[_0x01b2('0x17')]=function(_0x9f182b,_0x38c4c8){create(_0x9f182b)[_0x01b2('0xc')](loggerCatch(_0x38c4c8));};exports[_0x01b2('0x18')]=function(_0x56ea3c,_0xfbd5db){moveContact(_0x56ea3c)['catch'](loggerCatch(_0xfbd5db));};exports[_0x01b2('0x19')]=function(_0x4c0008,_0x400f80,_0x266264){if(_0x400f80){_0x4c0008[_0x01b2('0x1a')]=null;}if(_0x266264){_0x4c0008['active']=![];}return BPromise[_0x01b2('0xe')]()[_0x01b2('0xb')](cmHopper[_0x01b2('0x19')](_0x4c0008))[_0x01b2('0xc')](loggerCatch(_0x01b2('0x1b')));};exports['countReScheduled']=function(_0x1874b9){return BPromise['resolve']()['then'](cmHopper[_0x01b2('0x1c')](_0x1874b9))[_0x01b2('0xc')](loggerCatch(_0x01b2('0x1d')));};exports[_0x01b2('0x1e')]=function(_0x2e32c1){return BPromise[_0x01b2('0xe')]()['then'](cmHopper[_0x01b2('0x1e')]({'UserId':null},_0x2e32c1,0x1))[_0x01b2('0xc')](loggerCatch(_0x01b2('0x1f')));};exports[_0x01b2('0x20')]=function(_0x54543b){return BPromise[_0x01b2('0xe')]()['then'](cmHopper[_0x01b2('0x1e')]({'active':![]},_0x54543b,0x1))[_0x01b2('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0x01b2('0x21')]=function(_0x5efdda){var _0x487c49={};_0x487c49[_0x01b2('0x22')]=_0x5efdda[_0x01b2('0x22')];_0x487c49['uniqueid']=_0x5efdda[_0x01b2('0x23')];_0x487c49[_0x01b2('0x24')]=_0x5efdda[_0x01b2('0x24')];_0x487c49[_0x01b2('0x25')]=_0x5efdda[_0x01b2('0x25')];_0x487c49[_0x01b2('0x26')]=_0x5efdda[_0x01b2('0x26')];_0x487c49[_0x01b2('0x27')]=_0x5efdda[_0x01b2('0x28')];_0x487c49[_0x01b2('0x29')]=_0x5efdda[_0x01b2('0x28')];_0x487c49['queuecallercomplete']=0x1;_0x487c49[_0x01b2('0x2a')]=_0x5efdda[_0x01b2('0x2b')];_0x487c49[_0x01b2('0x2c')]=_0x5efdda[_0x01b2('0x2d')];_0x487c49[_0x01b2('0x2e')]=_0x01b2('0x2f');_0x487c49['exten']='xcally-motion-preview';_0x487c49[_0x01b2('0x30')]=0x0;_0x487c49['assigned']=0x1;_0x487c49['lastAssignedTo']=_0x5efdda[_0x01b2('0x2d')];_0x487c49[_0x01b2('0x31')]=_0x01b2('0x32');return BPromise[_0x01b2('0xe')]()['then'](voiceQueueReport[_0x01b2('0x33')](_0x487c49))['catch'](loggerCatch(_0x01b2('0x34')));};exports['getContactRecallMe']=function(_0x5af6ff,_0x5e23dd){return BPromise[_0x01b2('0xe')]()[_0x01b2('0xb')](cmHopper[_0x01b2('0x35')](_0x5af6ff,_0x5e23dd))[_0x01b2('0xc')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x01b2('0x36')]=function(_0x2bd252){return BPromise['resolve']()[_0x01b2('0xb')](cmHopper[_0x01b2('0x19')](_0x2bd252,!![],!![]))[_0x01b2('0xc')](loggerCatch(_0x01b2('0x37')));}; \ No newline at end of file +var _0x0b78=['type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContact','[rescheduleContactInQueue]\x20','util','bluebird','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','inspect','resolve','then','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createHistory','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20'];(function(_0x32f05c,_0x273aef){var _0x4307ed=function(_0x1be4da){while(--_0x1be4da){_0x32f05c['push'](_0x32f05c['shift']());}};_0x4307ed(++_0x273aef);}(_0x0b78,0x1ad));var _0x80b7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0b78[_0x2641f9];return _0x585741;};'use strict';var util=require(_0x80b7('0x0'));var BPromise=require(_0x80b7('0x1'));var logger=require('../../../config/logger')(_0x80b7('0x2'));var _=require(_0x80b7('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x80b7('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x80b7('0x5'));var voiceQueueRt=require(_0x80b7('0x6'));var agentReportPreview=require(_0x80b7('0x7'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x49bc7f){return function(_0x167ddd){logger['error'](_0x49bc7f,util[_0x80b7('0x8')](_0x167ddd,{'showHidden':![],'depth':null}));};}function create(_0x122ebe){return BPromise[_0x80b7('0x9')]()[_0x80b7('0xa')](cmHopperHistory['createHistory'](_0x122ebe))[_0x80b7('0xb')](loggerCatch(_0x80b7('0xc')));}function createAgent(_0x374c52){return BPromise['resolve']()[_0x80b7('0xa')](agentReportPreview['createHistory'](_0x374c52))[_0x80b7('0xb')](loggerCatch(_0x80b7('0xc')));}function moveContact(_0x3b19da){return BPromise[_0x80b7('0x9')]()[_0x80b7('0xa')](cmHopper[_0x80b7('0xd')](_0x3b19da,!![]))[_0x80b7('0xb')](loggerCatch(_0x80b7('0xe')));}exports[_0x80b7('0xf')]=function(_0x366e34){return BPromise[_0x80b7('0x9')]()['then'](cmHopperBlack[_0x80b7('0xf')](_0x366e34))[_0x80b7('0xb')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x80b7('0x10')]=function(_0x1a6317){return BPromise['resolve']()[_0x80b7('0xa')](cmHopper[_0x80b7('0x10')](_0x1a6317))[_0x80b7('0xb')](loggerCatch(_0x80b7('0x11')));};exports[_0x80b7('0x12')]=function(_0x352805,_0x1e3d1c){create(_0x352805)[_0x80b7('0xb')](loggerCatch(_0x1e3d1c));moveContact(_0x352805)[_0x80b7('0xb')](loggerCatch(_0x1e3d1c));};exports[_0x80b7('0x13')]=function(_0x4c12b1,_0x3bb691){createAgent(_0x4c12b1)[_0x80b7('0xb')](loggerCatch(_0x3bb691));};exports[_0x80b7('0x14')]=function(_0x125c47,_0x58dbda){create(_0x125c47)['catch'](loggerCatch(_0x58dbda));};exports[_0x80b7('0x15')]=function(_0x1e27aa,_0x1b584b){moveContact(_0x1e27aa)[_0x80b7('0xb')](loggerCatch(_0x1b584b));};exports['rescheduleContact']=function(_0x4f6eec,_0x2aebe3,_0x3aed77){if(_0x2aebe3){_0x4f6eec[_0x80b7('0x16')]=null;}if(_0x3aed77){_0x4f6eec[_0x80b7('0x17')]=![];}return BPromise['resolve']()[_0x80b7('0xa')](cmHopper['rescheduleContact'](_0x4f6eec))['catch'](loggerCatch(_0x80b7('0x18')));};exports[_0x80b7('0x19')]=function(_0x65d31d){return BPromise[_0x80b7('0x9')]()[_0x80b7('0xa')](cmHopper[_0x80b7('0x19')](_0x65d31d))[_0x80b7('0xb')](loggerCatch(_0x80b7('0x1a')));};exports[_0x80b7('0x1b')]=function(_0x1e751a){return BPromise[_0x80b7('0x9')]()[_0x80b7('0xa')](cmHopper[_0x80b7('0x1b')]({'UserId':null},_0x1e751a,0x1))[_0x80b7('0xb')](loggerCatch(_0x80b7('0x1c')));};exports['disableContact']=function(_0x40cfd3){return BPromise[_0x80b7('0x9')]()['then'](cmHopper[_0x80b7('0x1b')]({'active':![]},_0x40cfd3,0x1))[_0x80b7('0xb')](loggerCatch(_0x80b7('0x1d')));};exports['crateCustomerReportQueue']=function(_0x1b7715){var _0x48995a={};_0x48995a[_0x80b7('0x1e')]=_0x1b7715[_0x80b7('0x1e')];_0x48995a[_0x80b7('0x1f')]=_0x1b7715[_0x80b7('0x1f')];_0x48995a[_0x80b7('0x20')]=_0x1b7715[_0x80b7('0x20')];_0x48995a[_0x80b7('0x21')]=_0x1b7715[_0x80b7('0x21')];_0x48995a[_0x80b7('0x22')]=_0x1b7715[_0x80b7('0x22')];_0x48995a[_0x80b7('0x23')]=_0x1b7715['answertime'];_0x48995a['queuecallerleaveAt']=_0x1b7715[_0x80b7('0x24')];_0x48995a[_0x80b7('0x25')]=0x1;_0x48995a['queuecallercompleteAt']=_0x1b7715['endtime'];_0x48995a[_0x80b7('0x26')]=_0x1b7715[_0x80b7('0x27')];_0x48995a[_0x80b7('0x28')]=_0x80b7('0x29');_0x48995a[_0x80b7('0x2a')]=_0x80b7('0x2b');_0x48995a['holdtime']=0x0;_0x48995a[_0x80b7('0x2c')]=0x1;_0x48995a[_0x80b7('0x2d')]=_0x1b7715[_0x80b7('0x27')];_0x48995a[_0x80b7('0x2e')]='COMPLETED';return BPromise[_0x80b7('0x9')]()[_0x80b7('0xa')](voiceQueueReport['create'](_0x48995a))[_0x80b7('0xb')](loggerCatch(_0x80b7('0x2f')));};exports[_0x80b7('0x30')]=function(_0x2a80d7,_0x3c1f0e){return BPromise[_0x80b7('0x9')]()[_0x80b7('0xa')](cmHopper[_0x80b7('0x30')](_0x2a80d7,_0x3c1f0e))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x34f479){return BPromise[_0x80b7('0x9')]()[_0x80b7('0xa')](cmHopper[_0x80b7('0x31')](_0x34f479,!![],!![]))[_0x80b7('0xb')](loggerCatch(_0x80b7('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 fd009dd..4ee5a4a 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 _0x7826=['countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','name','queue','interface','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','getDiff','createBody','filterKey','type','campaigntype','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','extractCalleridName','extractCalleridNumber','match','lodash','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','info','inspect','loggerError','error','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','NONE','originatecalleridnum','originatecalleridname','monitor_format','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','calleridnum','xcally-motion-preview','from-sip','timeout','countbusyretry','countcongestionretry'];(function(_0x55a89b,_0x39ef6c){var _0x52941a=function(_0x417a66){while(--_0x417a66){_0x55a89b['push'](_0x55a89b['shift']());}};_0x52941a(++_0x39ef6c);}(_0x7826,0x146));var _0x6782=function(_0x5a8269,_0xfb2f54){_0x5a8269=_0x5a8269-0x0;var _0x539ed7=_0x7826[_0x5a8269];return _0x539ed7;};'use strict';var util=require('util');var _=require(_0x6782('0x0'));var moment=require('moment');var logger=require(_0x6782('0x1'))(_0x6782('0x2'));var ipAgi=process['env'][_0x6782('0x3')]||_0x6782('0x4');function getSeconds(_0x27c2bc,_0x3ec220){var _0x448201=moment(_0x27c2bc)[_0x6782('0x5')](0x0);var _0x89b82e=moment(_0x3ec220)[_0x6782('0x5')](0x0);return _0x448201[_0x6782('0x6')](_0x89b82e,_0x6782('0x7'));}exports[_0x6782('0x8')]=function(_0x5e64b0){return function(_0x2ac20c){logger['error'](_0x5e64b0,util['inspect'](_0x2ac20c,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x2dda70,_0x34c8fb){logger[_0x6782('0x9')](_0x2dda70,util[_0x6782('0xa')](_0x34c8fb,{'showHidden':![],'depth':null}));};exports[_0x6782('0xb')]=function(_0x580356,_0x4cd30a){logger[_0x6782('0xc')](_0x580356,util[_0x6782('0xa')](_0x4cd30a,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x3e794e){return function(_0x414b74){logger[_0x6782('0x9')](_0x3e794e,util[_0x6782('0xa')](_0x414b74,{'showHidden':![],'depth':null}));};};exports[_0x6782('0xd')]=function(_0x2da68e,_0x181783,_0x3a6722){return{'message':_0x2da68e,'unlock':_0x181783,'active':_0x3a6722};};exports[_0x6782('0xe')]=function(_0x326576,_0x5b481a,_0x398db5){if(!_[_0x6782('0xf')](_0x398db5)&&_0x6782('0x10')===typeof _0x398db5&&!_['isEmpty'](_0x398db5)){if(!_[_0x6782('0xf')](_0x5b481a)&&_0x6782('0x10')===typeof _0x5b481a&&!_[_0x6782('0x11')](_0x5b481a)){return util[_0x6782('0x12')]('\x22%s\x22\x20<%s>',_0x5b481a,_0x398db5);}return util[_0x6782('0x12')](_0x6782('0x13'),_0x398db5,_0x398db5);}if(!_['isUndefined'](_0x326576)&&_0x6782('0x10')===typeof _0x326576&&!_[_0x6782('0x11')](_0x326576)){return _0x326576;}return _0x6782('0x14');};exports[_0x6782('0x15')]=function(_0xdb2bea){if(_[_0x6782('0x16')](_0xdb2bea)){return![];}return _0xdb2bea;};exports[_0x6782('0x17')]=function(_0x4acf52,_0x959df6,_0x1bf062,_0xd5fb63,_0x1928b6,_0x57cd60){var _0xd88e3d={'XMD-QUEUE':_0x959df6[_0x6782('0x18')]?_0x959df6[_0x6782('0x18')]['name']:'','XMD-CALLERID':_0xd5fb63,'XMD-CALLERID-PREVIEW':_0x57cd60?util[_0x6782('0x12')](_0x6782('0x13'),_0x57cd60[_0x6782('0x19')],_0x57cd60['calleridnum']):_0xd5fb63,'XMD-DIALID':_0x1928b6,'XMD-CONTACTID':_0x959df6[_0x6782('0x1a')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0xd5fb63,'XMD-VOICEQUEUEID':_0x959df6[_0x6782('0x1b')],'XMD-DIALCHANNEL':_0x1bf062,'XMD-DIALTIMEOUT':_0x4acf52[_0x6782('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x6782('0x12')](_0x6782('0x1d'),_0x4acf52['dialQueueProject2']?'g':'',_[_0x6782('0x11')](_0x4acf52['monitor_format'])?'':_0x6782('0x1e')),'XMD-DIALURL':_0x4acf52[_0x6782('0x1f')]||'','XMD-AGI':_0x4acf52[_0x6782('0x20')]?util[_0x6782('0x12')](_0x6782('0x21'),ipAgi,_0x4acf52[_0x6782('0x20')]):'NONE','XMD-AGIAFTER':_0x4acf52[_0x6782('0x22')]?util[_0x6782('0x12')](_0x6782('0x21'),ipAgi,_0x4acf52['dialQueueProject2']):_0x6782('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x57cd60?_0x57cd60[_0x6782('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x57cd60?_0x57cd60[_0x6782('0x25')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0x6782('0x11')](_0x4acf52[_0x6782('0x26')])){_0xd88e3d[util[_0x6782('0x12')]('%s',_0x6782('0x27'))]=_0x4acf52[_0x6782('0x26')];_0xd88e3d[util[_0x6782('0x12')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x1928b6;}if(_0x959df6&&_0x959df6[_0x6782('0x28')]){for(var _0x20391f in _0x959df6[_0x6782('0x28')]){if(_0x959df6[_0x6782('0x28')][_0x6782('0x29')](_0x20391f)){if(!_['isNil'](_0x959df6[_0x6782('0x28')][_0x20391f])&&_0x20391f!=='id'&&_0x20391f!==_0x6782('0x2a')&&_0x20391f!==_0x6782('0x2b')&&_0x20391f!==_0x6782('0x2c')){_0xd88e3d[util[_0x6782('0x12')](_0x6782('0x2d'),_0x6782('0x2e'),_[_0x6782('0x2f')](_0x20391f))]=_0x959df6['Contact'][_0x20391f];}}}}return _0xd88e3d;};exports['toLowerVariables']=function(_0x16e4f2){var _0x160020={};for(var _0xf07dfc in _0x16e4f2){if(_0x16e4f2[_0x6782('0x29')](_0xf07dfc)){_0x160020[util[_0x6782('0x12')]('%s',_[_0x6782('0x30')](_0xf07dfc))]=_0x16e4f2[_0xf07dfc];}}return{'variables':_0x160020};};exports[_0x6782('0x31')]=function(_0xc31f27,_0x12c8d1){if(!_[_0x6782('0x16')](_0xc31f27)){if(_0xc31f27['hasOwnProperty']('originated')){if(_0xc31f27['originated']>0x0){_0xc31f27[_0x6782('0x32')]-=0x1;}else{logger[_0x6782('0xc')](_0x6782('0x33'),_0x12c8d1);}}}else{logger[_0x6782('0xc')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x12c8d1);}};exports[_0x6782('0x34')]=function(_0x39dc9e){var _0x3476cd=moment()[_0x6782('0x12')](_0x6782('0x35'));_0x39dc9e[_0x6782('0x36')]=0xd;_0x39dc9e[_0x6782('0x37')]=_0x6782('0x38');_0x39dc9e[_0x6782('0x39')]=_0x3476cd;_0x39dc9e[_0x6782('0x3a')]=_0x3476cd;_0x39dc9e[_0x6782('0x3b')]=_0x3476cd;};exports['logAgent']=function(_0x391a61,_0x49a882,_0x5e1f94){var _0x12a60f=moment()['format'](_0x6782('0x35'));_0x391a61[_0x6782('0x36')]=_0x49a882;_0x391a61[_0x6782('0x37')]=_0x5e1f94;_0x391a61['responsetime']=_0x12a60f;_0x391a61['ringtime']=getSeconds(_0x391a61['responsetime'],_0x391a61['starttime']);};exports[_0x6782('0x3c')]=function(_0x4c9001,_0x5ce85e,_0x1331e5){_0x4c9001[_0x6782('0x3d')]=_0x5ce85e;_0x4c9001[_0x6782('0x3e')]=_0x1331e5;};exports[_0x6782('0x3f')]=function(_0x32cd0f,_0x2cbd6e,_0x38d24f){var _0x144fde=moment()[_0x6782('0x12')](_0x6782('0x35'));_0x32cd0f['state']=_0x2cbd6e;_0x32cd0f[_0x6782('0x37')]=_0x38d24f;_0x32cd0f['responsetime']=_0x32cd0f[_0x6782('0x3a')]?_0x32cd0f[_0x6782('0x3a')]:_0x144fde;_0x32cd0f[_0x6782('0x3b')]=_0x32cd0f[_0x6782('0x3b')]?_0x32cd0f[_0x6782('0x3b')]:_0x144fde;_0x32cd0f['ringtime']=getSeconds(_0x32cd0f['responsetime']||0x0,_0x32cd0f[_0x6782('0x39')]||0x0);_0x32cd0f[_0x6782('0x40')]=_0x32cd0f[_0x6782('0x41')]?getSeconds(_0x32cd0f[_0x6782('0x3b')],_0x32cd0f[_0x6782('0x41')]):0x0;};exports[_0x6782('0x42')]=function(_0x2e0356){return _0x2e0356==='Failure';};exports[_0x6782('0x43')]=function(_0x552466,_0x1337ab,_0x4e3f9e,_0x611f48,_0xb3ec94){var _0x44f1d6=_0x611f48?_0x6782('0x44'):_0x552466[_0x6782('0x19')];_0x44f1d6=_0xb3ec94?_0x6782('0x45'):_0x44f1d6;return{'actionid':_0x552466[_0x6782('0x46')],'action':_0x6782('0x47'),'channel':_0x552466[_0x6782('0x48')],'callerid':util[_0x6782('0x12')](_0x6782('0x13'),_0x44f1d6,_0x552466[_0x6782('0x49')]),'Exten':_0x6782('0x4a'),'Context':_0x6782('0x4b'),'Priority':'1','variable':_0x4e3f9e,'timeout':(_0x1337ab[_0x6782('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x552466[_0x6782('0x46')]};};exports['totalGlobal']=function(_0x5154b2){return _0x5154b2[_0x6782('0x4d')]+_0x5154b2[_0x6782('0x4e')]+_0x5154b2[_0x6782('0x4f')]+_0x5154b2[_0x6782('0x50')]+_0x5154b2[_0x6782('0x51')];};exports[_0x6782('0x52')]=function(_0x5d4ba2){var _0x47f47c=_[_0x6782('0x53')](_0x5d4ba2);_0x47f47c[_0x6782('0x36')]=0xf;_0x47f47c[_0x6782('0x37')]=_0x6782('0x54');return _0x47f47c;};exports['scheduledAt']=function(_0x4575e8,_0x192b63,_0x57cbce){var _0x504461={};_0x504461[_0x192b63]=_0x4575e8[_0x192b63];_0x504461[_0x6782('0x55')]=![];_0x504461['scheduledat']=moment()[_0x6782('0x56')](_0x57cbce,_0x6782('0x57'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x504461[_0x6782('0x1a')]=_0x4575e8[_0x6782('0x1a')];_0x504461['ListId']=_0x4575e8[_0x6782('0x58')];_0x504461['VoiceQueueId']=_0x4575e8[_0x6782('0x1b')]||undefined;return _0x504461;};exports[_0x6782('0x59')]=function(_0x2f142d,_0x1248eb){if(!_[_0x6782('0x16')](_0x2f142d)){if(_0x2f142d[_0x6782('0x5a')]>0x0){_0x2f142d[_0x6782('0x5a')]-=0x1;}else{logger[_0x6782('0xc')](_0x1248eb,_0x6782('0x5b'));}}else{logger['error'](_0x1248eb,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x6782('0x5c')]=function(_0x1ea7ef){if(_0x1ea7ef<=0x0){return!![];}return![];};exports[_0x6782('0x5d')]=function(_0x1f8ef9,_0x56cc4b,_0x5c17f1){_0x1f8ef9['lastevent']=_0x56cc4b;_0x1f8ef9[_0x6782('0x5e')]=_0x1f8ef9[_0x6782('0x5f')];_0x1f8ef9[_0x6782('0x60')]=_0x1f8ef9['channelAgent'];if(_0x5c17f1){_0x1f8ef9[_0x6782('0x61')]=_0x5c17f1[_0x6782('0x61')];}return _0x1f8ef9;};exports[_0x6782('0x62')]=function(_0x22f7ee){var _0x153b97={};_0x153b97['queue']=_0x22f7ee[_0x6782('0x5f')];_0x153b97['interface']=_0x22f7ee[_0x6782('0x48')];_0x153b97[_0x6782('0x46')]=_0x22f7ee[_0x6782('0x46')];return _0x153b97;};exports[_0x6782('0x63')]=function(_0x5f0f37){var _0x2a1e7c=[];for(var _0x33fa7e in _0x5f0f37){if(_0x5f0f37[_0x6782('0x29')](_0x33fa7e)){if(!_[_0x6782('0x16')](_0x5f0f37[_0x33fa7e])&&_0x5f0f37[_0x33fa7e][_0x6782('0x36')]===_0x6782('0x64')&&_0x5f0f37[_0x33fa7e][_0x6782('0x65')]==='reachable'){_0x2a1e7c['push'](_0x5f0f37[_0x33fa7e]['id']);}}}return _0x2a1e7c;};exports[_0x6782('0x66')]=function(_0x25f95d){var _0x48e7ee=moment()['milliseconds'](0x0);var _0x1f1b2e=moment(_0x25f95d)['milliseconds'](0x0);return _0x48e7ee[_0x6782('0x6')](_0x1f1b2e,_0x6782('0x7'));};exports[_0x6782('0x67')]=function(_0x5076e1){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5076e1[_0x6782('0x1a')],'ListId':_0x5076e1[_0x6782('0x58')],'VoiceQueueId':_0x5076e1[_0x6782('0x1b')]||undefined,'CampaignId':_0x5076e1['CampaignId']||undefined};};exports[_0x6782('0x68')]=function(_0x16e5c3){if(_0x16e5c3===_0x6782('0x46')||_0x16e5c3==='idContact'||_0x16e5c3===_0x6782('0x5f')||_0x16e5c3===_0x6782('0x69')||_0x16e5c3===_0x6782('0x6a')||_0x16e5c3==='dialAnswer'||_0x16e5c3===_0x6782('0x3d')||_0x16e5c3==='channelAgent'||_0x16e5c3===_0x6782('0x19')||_0x16e5c3===_0x6782('0x55')||_0x16e5c3===_0x6782('0x49')||_0x16e5c3==='scheduledat'||_0x16e5c3===_0x6782('0x4d')||_0x16e5c3===_0x6782('0x4e')||_0x16e5c3==='countnoanswerretry'||_0x16e5c3==='countglobal'||_0x16e5c3==='callback'||_0x16e5c3===_0x6782('0x6b')||_0x16e5c3===_0x6782('0x6c')||_0x16e5c3==='recallme'||_0x16e5c3===_0x6782('0x1a')||_0x16e5c3==='ListId'||_0x16e5c3===_0x6782('0x3e')||_0x16e5c3===_0x6782('0x1b')||_0x16e5c3===_0x6782('0x6d')||_0x16e5c3===_0x6782('0x6e')||_0x16e5c3===_0x6782('0x6f')||_0x16e5c3==='xmd-phone'||_0x16e5c3===_0x6782('0x70')||_0x16e5c3===_0x6782('0x71')||_0x16e5c3==='xmd-dialtimeout'||_0x16e5c3===_0x6782('0x72')||_0x16e5c3===_0x6782('0x73')||_0x16e5c3==='xmd-dialchannel'||_0x16e5c3===_0x6782('0x74')||_0x16e5c3===_0x6782('0x75')||_0x16e5c3===_0x6782('0x76')||_0x16e5c3===_0x6782('0x77')||_0x16e5c3==='xmd-agi'||_0x16e5c3===_0x6782('0x78')||_0x16e5c3===_0x6782('0x79')||_0x16e5c3==='rtpaudioqosjitter'||_0x16e5c3===_0x6782('0x7a')||_0x16e5c3===_0x6782('0x7b')||_0x16e5c3===_0x6782('0x7c')||_0x16e5c3===_0x6782('0x7d')||_0x16e5c3===_0x6782('0x7e')||_0x16e5c3===_0x6782('0x78')||_0x16e5c3===_0x6782('0x79')||_0x16e5c3===_0x6782('0x7f')||_0x16e5c3===_0x6782('0x7a')||_0x16e5c3==='rtpaudioqosloss'||_0x16e5c3===_0x6782('0x7c')||_0x16e5c3===_0x6782('0x7d')||_0x16e5c3===_0x6782('0x7e')||_0x16e5c3===_0x6782('0x80')||_0x16e5c3===_0x6782('0x81')||_0x16e5c3===_0x6782('0x36')||_0x16e5c3===_0x6782('0x37')){return![];}return!![];};exports[_0x6782('0x82')]=function(_0x2f6327,_0x2eb0de){var _0x24b56e,_0x22bc21,_0x335423;if(_0x2eb0de<=0x0){_0x2eb0de=0x1;}_0x24b56e=new RegExp(_0x6782('0x83')+_0x2eb0de+'}$');_0x22bc21=Math['pow'](0xa,_0x2eb0de-0x1);_0x335423=Math['pow'](0xa,_0x2eb0de)-0x1;return util[_0x6782('0x12')]('%s',_['replace'](_0x2f6327,_0x24b56e,_['random'](_0x22bc21,_0x335423)));};exports[_0x6782('0x84')]=function(_0x50fb89){var _0x4f588f=_0x50fb89['match'](/"(.*?)"/);return _0x4f588f?_0x4f588f[0x1]:_0x50fb89;};exports[_0x6782('0x85')]=function(_0x58dd44){var _0x2de4b3=_0x58dd44[_0x6782('0x86')](/<(.*?)>/);return _0x2de4b3?_0x2de4b3[0x1]:_0x58dd44;}; \ No newline at end of file +var _0x5854=['not_inuse','status','reachable','push','getDiff','CampaignId','filterKey','idContact','dialAnswer','active','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','UserId','xmd-voicequeueid','xmd-queue','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','Contact','tags','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','membername','ringtime','talktime','answertime','isFailure','Failure','RECALL','BOOKED','originate','channelAgent','from-sip','uniqueid','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','mandatoryDisposition','buildAcw','agentReadyId'];(function(_0x4737a0,_0x36520e){var _0x4d558b=function(_0xaa9825){while(--_0xaa9825){_0x4737a0['push'](_0x4737a0['shift']());}};_0x4d558b(++_0x36520e);}(_0x5854,0x1d0));var _0x4585=function(_0x504bdf,_0x10bb30){_0x504bdf=_0x504bdf-0x0;var _0x499747=_0x5854[_0x504bdf];return _0x499747;};'use strict';var util=require(_0x4585('0x0'));var _=require('lodash');var moment=require(_0x4585('0x1'));var logger=require(_0x4585('0x2'))(_0x4585('0x3'));var ipAgi=process[_0x4585('0x4')][_0x4585('0x5')]||_0x4585('0x6');function getSeconds(_0x2d9984,_0x1cf6b8){var _0x29f017=moment(_0x2d9984)[_0x4585('0x7')](0x0);var _0x41e6cf=moment(_0x1cf6b8)[_0x4585('0x7')](0x0);return _0x29f017[_0x4585('0x8')](_0x41e6cf,_0x4585('0x9'));}exports[_0x4585('0xa')]=function(_0x1f7a11){return function(_0x4c5196){logger[_0x4585('0xb')](_0x1f7a11,util[_0x4585('0xc')](_0x4c5196,{'showHidden':![],'depth':null}));};};exports[_0x4585('0xd')]=function(_0x15f155,_0x2252e8){logger[_0x4585('0xe')](_0x15f155,util[_0x4585('0xc')](_0x2252e8,{'showHidden':![],'depth':null}));};exports[_0x4585('0xf')]=function(_0x3a7df7,_0xe30dfc){logger['error'](_0x3a7df7,util['inspect'](_0xe30dfc,{'showHidden':![],'depth':null}));};exports[_0x4585('0x10')]=function(_0x3282cc){return function(_0x1f7ca1){logger['info'](_0x3282cc,util[_0x4585('0xc')](_0x1f7ca1,{'showHidden':![],'depth':null}));};};exports[_0x4585('0x11')]=function(_0x1c58ce,_0x5f5cb7,_0x2b0ec1){return{'message':_0x1c58ce,'unlock':_0x5f5cb7,'active':_0x2b0ec1};};exports[_0x4585('0x12')]=function(_0x1784d1,_0x14fa88,_0x14b7c7){if(!_[_0x4585('0x13')](_0x14b7c7)&&_0x4585('0x14')===typeof _0x14b7c7&&!_[_0x4585('0x15')](_0x14b7c7)){if(!_[_0x4585('0x13')](_0x14fa88)&&_0x4585('0x14')===typeof _0x14fa88&&!_[_0x4585('0x15')](_0x14fa88)){return util[_0x4585('0x16')](_0x4585('0x17'),_0x14fa88,_0x14b7c7);}return util['format'](_0x4585('0x17'),_0x14b7c7,_0x14b7c7);}if(!_[_0x4585('0x13')](_0x1784d1)&&'string'===typeof _0x1784d1&&!_[_0x4585('0x15')](_0x1784d1)){return _0x1784d1;}return'\x22\x22\x20<>';};exports[_0x4585('0x18')]=function(_0x18713d){if(_[_0x4585('0x19')](_0x18713d)){return![];}return _0x18713d;};exports[_0x4585('0x1a')]=function(_0x15f76e,_0x389558,_0x93d90c,_0x1d4eec,_0x21375a,_0xcbf7d5){var _0x50b288={'XMD-QUEUE':_0x389558['Queue']?_0x389558[_0x4585('0x1b')][_0x4585('0x1c')]:'','XMD-CALLERID':_0x1d4eec,'XMD-CALLERID-PREVIEW':_0xcbf7d5?util[_0x4585('0x16')](_0x4585('0x17'),_0xcbf7d5[_0x4585('0x1d')],_0xcbf7d5[_0x4585('0x1e')]):_0x1d4eec,'XMD-DIALID':_0x21375a,'XMD-CONTACTID':_0x389558[_0x4585('0x1f')],'XMD-CDRTYPE':_0x4585('0x20'),'CALLERID(all)':_0x1d4eec,'XMD-VOICEQUEUEID':_0x389558[_0x4585('0x21')],'XMD-DIALCHANNEL':_0x93d90c,'XMD-DIALTIMEOUT':_0x15f76e['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x4585('0x16')](_0x4585('0x22'),_0x15f76e['dialQueueProject2']?'g':'',_['isEmpty'](_0x15f76e[_0x4585('0x23')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x15f76e[_0x4585('0x24')]||'','XMD-AGI':_0x15f76e[_0x4585('0x25')]?util[_0x4585('0x16')](_0x4585('0x26'),ipAgi,_0x15f76e[_0x4585('0x25')]):_0x4585('0x27'),'XMD-AGIAFTER':_0x15f76e[_0x4585('0x28')]?util[_0x4585('0x16')](_0x4585('0x26'),ipAgi,_0x15f76e['dialQueueProject2']):_0x4585('0x27'),'XMD-ORIGINATECALLERIDNUM':_0xcbf7d5?_0xcbf7d5[_0x4585('0x29')]:'','XMD-ORIGINATECALLERIDNAME':_0xcbf7d5?_0xcbf7d5[_0x4585('0x2a')]:'','XMD-DESTINATION':_0x4585('0x2b')};if(!_['isEmpty'](_0x15f76e[_0x4585('0x23')])){_0x50b288[util[_0x4585('0x16')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x15f76e['monitor_format'];_0x50b288[util[_0x4585('0x16')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x21375a;}if(_0x389558&&_0x389558[_0x4585('0x2c')]){for(var _0x1a5d7f in _0x389558[_0x4585('0x2c')]){if(_0x389558[_0x4585('0x2c')]['hasOwnProperty'](_0x1a5d7f)){if(!_['isNil'](_0x389558['Contact'][_0x1a5d7f])&&_0x1a5d7f!=='id'&&_0x1a5d7f!==_0x4585('0x2d')&&_0x1a5d7f!==_0x4585('0x2e')&&_0x1a5d7f!==_0x4585('0x2f')){_0x50b288[util[_0x4585('0x16')](_0x4585('0x30'),'XMD-',_[_0x4585('0x31')](_0x1a5d7f))]=_0x389558[_0x4585('0x2c')][_0x1a5d7f];}}}}return _0x50b288;};exports[_0x4585('0x32')]=function(_0x595b58){var _0x50f563={};for(var _0x504bc6 in _0x595b58){if(_0x595b58[_0x4585('0x33')](_0x504bc6)){_0x50f563[util[_0x4585('0x16')]('%s',_[_0x4585('0x34')](_0x504bc6))]=_0x595b58[_0x504bc6];}}return{'variables':_0x50f563};};exports[_0x4585('0x35')]=function(_0x3d2a0a,_0x509812){if(!_[_0x4585('0x19')](_0x3d2a0a)){if(_0x3d2a0a[_0x4585('0x33')](_0x4585('0x36'))){if(_0x3d2a0a[_0x4585('0x36')]>0x0){_0x3d2a0a['originated']-=0x1;}else{logger[_0x4585('0xb')](_0x4585('0x37'),_0x509812);}}}else{logger['error'](_0x4585('0x38'),_0x509812);}};exports[_0x4585('0x39')]=function(_0x5b5127){var _0x17be97=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5b5127[_0x4585('0x3a')]=0xd;_0x5b5127[_0x4585('0x3b')]=_0x4585('0x3c');_0x5b5127[_0x4585('0x3d')]=_0x17be97;_0x5b5127[_0x4585('0x3e')]=_0x17be97;_0x5b5127[_0x4585('0x3f')]=_0x17be97;};exports[_0x4585('0x40')]=function(_0x36fcc8,_0x4f13c4,_0x4abb84){var _0x2c5b5a=moment()[_0x4585('0x16')](_0x4585('0x41'));_0x36fcc8[_0x4585('0x3a')]=_0x4f13c4;_0x36fcc8['statedesc']=_0x4abb84;_0x36fcc8[_0x4585('0x3e')]=_0x2c5b5a;_0x36fcc8['ringtime']=getSeconds(_0x36fcc8[_0x4585('0x3e')],_0x36fcc8['starttime']);};exports['logLookAgent']=function(_0x2cd332,_0x7501a9,_0x4bdbe3){_0x2cd332[_0x4585('0x42')]=_0x7501a9;_0x2cd332['UserId']=_0x4bdbe3;};exports['logCustomer']=function(_0x22621d,_0x1901a2,_0x12769a){var _0x583601=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x22621d[_0x4585('0x3a')]=_0x1901a2;_0x22621d[_0x4585('0x3b')]=_0x12769a;_0x22621d['responsetime']=_0x22621d[_0x4585('0x3e')]?_0x22621d[_0x4585('0x3e')]:_0x583601;_0x22621d[_0x4585('0x3f')]=_0x22621d[_0x4585('0x3f')]?_0x22621d[_0x4585('0x3f')]:_0x583601;_0x22621d[_0x4585('0x43')]=getSeconds(_0x22621d[_0x4585('0x3e')]||0x0,_0x22621d['starttime']||0x0);_0x22621d[_0x4585('0x44')]=_0x22621d[_0x4585('0x45')]?getSeconds(_0x22621d[_0x4585('0x3f')],_0x22621d[_0x4585('0x45')]):0x0;};exports[_0x4585('0x46')]=function(_0x48d6da){return _0x48d6da===_0x4585('0x47');};exports['variablesAction']=function(_0x15bbca,_0xc614d4,_0x599c5e,_0x3c012a,_0x3bfea1){var _0x4b070f=_0x3c012a?_0x4585('0x48'):_0x15bbca['calleridname'];_0x4b070f=_0x3bfea1?_0x4585('0x49'):_0x4b070f;return{'actionid':_0x15bbca['uniqueid'],'action':_0x4585('0x4a'),'channel':_0x15bbca[_0x4585('0x4b')],'callerid':util[_0x4585('0x16')](_0x4585('0x17'),_0x4b070f,_0x15bbca['calleridnum']),'Exten':'xcally-motion-preview','Context':_0x4585('0x4c'),'Priority':'1','variable':_0x599c5e,'timeout':(_0xc614d4['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x15bbca[_0x4585('0x4d')]};};exports[_0x4585('0x4e')]=function(_0x469bb0){return _0x469bb0[_0x4585('0x4f')]+_0x469bb0['countcongestionretry']+_0x469bb0[_0x4585('0x50')]+_0x469bb0[_0x4585('0x51')]+_0x469bb0[_0x4585('0x52')];};exports['cloneAction']=function(_0x39a63b){var _0x5d5734=_[_0x4585('0x53')](_0x39a63b);_0x5d5734[_0x4585('0x3a')]=0xf;_0x5d5734['statedesc']=_0x4585('0x54');return _0x5d5734;};exports['scheduledAt']=function(_0xd4f699,_0x6e3227,_0x27b738){var _0x4e1692={};_0x4e1692[_0x6e3227]=_0xd4f699[_0x6e3227];_0x4e1692['active']=![];_0x4e1692[_0x4585('0x55')]=moment()[_0x4585('0x56')](_0x27b738,_0x4585('0x57'))[_0x4585('0x16')]('YYYY-MM-DD\x20HH:mm:ss');_0x4e1692[_0x4585('0x1f')]=_0xd4f699[_0x4585('0x1f')];_0x4e1692[_0x4585('0x58')]=_0xd4f699[_0x4585('0x58')];_0x4e1692[_0x4585('0x21')]=_0xd4f699[_0x4585('0x21')]||undefined;return _0x4e1692;};exports[_0x4585('0x59')]=function(_0x203e90,_0x5c40bd){if(!_[_0x4585('0x19')](_0x203e90)){if(_0x203e90[_0x4585('0x5a')]>0x0){_0x203e90[_0x4585('0x5a')]-=0x1;}else{logger['error'](_0x5c40bd,_0x4585('0x5b'));}}else{logger[_0x4585('0xb')](_0x5c40bd,_0x4585('0x5c'));}};exports[_0x4585('0x5d')]=function(_0x2d6dbd){if(_0x2d6dbd<=0x0){return!![];}return![];};exports['buildObj']=function(_0x198316,_0x5b0885,_0x14b002){_0x198316[_0x4585('0x5e')]=_0x5b0885;_0x198316[_0x4585('0x1c')]=_0x198316[_0x4585('0x5f')];_0x198316[_0x4585('0x60')]=_0x198316[_0x4585('0x4b')];if(_0x14b002){_0x198316['mandatoryDisposition']=_0x14b002[_0x4585('0x61')];}return _0x198316;};exports[_0x4585('0x62')]=function(_0x2c545c){var _0x526451={};_0x526451[_0x4585('0x5f')]=_0x2c545c[_0x4585('0x5f')];_0x526451[_0x4585('0x60')]=_0x2c545c[_0x4585('0x4b')];_0x526451[_0x4585('0x4d')]=_0x2c545c[_0x4585('0x4d')];return _0x526451;};exports[_0x4585('0x63')]=function(_0x3f6d23){var _0x34dcb5=[];for(var _0x3baf58 in _0x3f6d23){if(_0x3f6d23[_0x4585('0x33')](_0x3baf58)){if(!_[_0x4585('0x19')](_0x3f6d23[_0x3baf58])&&_0x3f6d23[_0x3baf58][_0x4585('0x3a')]===_0x4585('0x64')&&_0x3f6d23[_0x3baf58][_0x4585('0x65')]===_0x4585('0x66')){_0x34dcb5[_0x4585('0x67')](_0x3f6d23[_0x3baf58]['id']);}}}return _0x34dcb5;};exports[_0x4585('0x68')]=function(_0x107a9e){var _0x129bc0=moment()['milliseconds'](0x0);var _0x3d5de3=moment(_0x107a9e)[_0x4585('0x7')](0x0);return _0x129bc0[_0x4585('0x8')](_0x3d5de3,_0x4585('0x9'));};exports['createBody']=function(_0x412eeb){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x412eeb[_0x4585('0x1f')],'ListId':_0x412eeb[_0x4585('0x58')],'VoiceQueueId':_0x412eeb[_0x4585('0x21')]||undefined,'CampaignId':_0x412eeb[_0x4585('0x69')]||undefined};};exports[_0x4585('0x6a')]=function(_0x2554e7){if(_0x2554e7===_0x4585('0x4d')||_0x2554e7===_0x4585('0x6b')||_0x2554e7===_0x4585('0x5f')||_0x2554e7==='type'||_0x2554e7==='campaigntype'||_0x2554e7===_0x4585('0x6c')||_0x2554e7===_0x4585('0x42')||_0x2554e7===_0x4585('0x4b')||_0x2554e7==='calleridname'||_0x2554e7===_0x4585('0x6d')||_0x2554e7===_0x4585('0x1e')||_0x2554e7==='scheduledat'||_0x2554e7==='countbusyretry'||_0x2554e7===_0x4585('0x6e')||_0x2554e7===_0x4585('0x50')||_0x2554e7===_0x4585('0x6f')||_0x2554e7===_0x4585('0x70')||_0x2554e7===_0x4585('0x71')||_0x2554e7===_0x4585('0x72')||_0x2554e7==='recallme'||_0x2554e7===_0x4585('0x1f')||_0x2554e7===_0x4585('0x58')||_0x2554e7===_0x4585('0x73')||_0x2554e7==='VoiceQueueId'||_0x2554e7==='sipcallid'||_0x2554e7===_0x4585('0x74')||_0x2554e7===_0x4585('0x75')||_0x2554e7==='xmd-phone'||_0x2554e7==='xmd-listid'||_0x2554e7===_0x4585('0x76')||_0x2554e7==='xmd-dialtimeout'||_0x2554e7===_0x4585('0x77')||_0x2554e7===_0x4585('0x78')||_0x2554e7===_0x4585('0x79')||_0x2554e7===_0x4585('0x7a')||_0x2554e7==='xmd-cdrtype'||_0x2554e7==='xmd-callerid'||_0x2554e7==='xmd-agiafter'||_0x2554e7===_0x4585('0x7b')||_0x2554e7===_0x4585('0x7c')||_0x2554e7===_0x4585('0x7d')||_0x2554e7===_0x4585('0x7e')||_0x2554e7===_0x4585('0x7f')||_0x2554e7==='rtpaudioqosloss'||_0x2554e7==='rtpaudioqoslossbridged'||_0x2554e7===_0x4585('0x80')||_0x2554e7==='rtpaudioqosrttbridged'||_0x2554e7===_0x4585('0x7c')||_0x2554e7===_0x4585('0x7d')||_0x2554e7===_0x4585('0x7e')||_0x2554e7===_0x4585('0x7f')||_0x2554e7===_0x4585('0x81')||_0x2554e7===_0x4585('0x82')||_0x2554e7===_0x4585('0x80')||_0x2554e7===_0x4585('0x83')||_0x2554e7==='bridgepeer'||_0x2554e7===_0x4585('0x84')||_0x2554e7===_0x4585('0x3a')||_0x2554e7===_0x4585('0x3b')){return![];}return!![];};exports[_0x4585('0x85')]=function(_0x20f6da,_0x53e5d0){var _0x49d21d,_0x490a84,_0x484d3a;if(_0x53e5d0<=0x0){_0x53e5d0=0x1;}_0x49d21d=new RegExp(_0x4585('0x86')+_0x53e5d0+'}$');_0x490a84=Math[_0x4585('0x87')](0xa,_0x53e5d0-0x1);_0x484d3a=Math[_0x4585('0x87')](0xa,_0x53e5d0)-0x1;return util[_0x4585('0x16')]('%s',_[_0x4585('0x88')](_0x20f6da,_0x49d21d,_[_0x4585('0x89')](_0x490a84,_0x484d3a)));};exports[_0x4585('0x8a')]=function(_0x3d5a45){var _0x78af88=_0x3d5a45[_0x4585('0x8b')](/"(.*?)"/);return _0x78af88?_0x78af88[0x1]:_0x3d5a45;};exports[_0x4585('0x8c')]=function(_0xac2e2){var _0x511305=_0xac2e2[_0x4585('0x8b')](/<(.*?)>/);return _0x511305?_0x511305[0x1]:_0xac2e2;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index f8106f6..49a2ee4 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(_0x3d111f,_0x40e076){var _0x3fa5ef=function(_0x92f1ff){while(--_0x92f1ff){_0x3d111f['push'](_0x3d111f['shift']());}};_0x3fa5ef(++_0x40e076);}(_0x5f2f,0x73));var _0xf5f2=function(_0xc730c2,_0x362619){_0xc730c2=_0xc730c2-0x0;var _0x28ea39=_0x5f2f[_0xc730c2];return _0x28ea39;};'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(_0x5f3716,_0x10ccc3){var _0xcbb970=function(_0x26a60c){while(--_0x26a60c){_0x5f3716['push'](_0x5f3716['shift']());}};_0xcbb970(++_0x10ccc3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x34f8c9,_0x93c983){_0x34f8c9=_0x34f8c9-0x0;var _0xf7828c=_0x5f2f[_0x34f8c9];return _0xf7828c;};'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 b82b117..882c1e4 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 _0x55ca=['voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','timers','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','isNil','format','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','unmanaged','abandoned','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','interface','isUndefined','initTelephones','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','merge','groupBy','uniqueid','queuecallerexit','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercompleteAt','queuecallerleaveAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','exports','bluebird','util','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','agents','telephones','trunks'];(function(_0x13e300,_0x1bcb41){var _0x5a3eea=function(_0x2dfd2a){while(--_0x2dfd2a){_0x13e300['push'](_0x13e300['shift']());}};_0x5a3eea(++_0x1bcb41);}(_0x55ca,0x126));var _0xa55c=function(_0x5db99b,_0xdee23a){_0x5db99b=_0x5db99b-0x0;var _0x4b2d0e=_0x55ca[_0x5db99b];return _0x4b2d0e;};'use strict';var BPromise=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require('../model/agent');var Telephone=require(_0xa55c('0x2'));var Trunk=require(_0xa55c('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xa55c('0x4'));var Template=require(_0xa55c('0x5'));var Campaign=require(_0xa55c('0x6'));var VoiceExtension=require(_0xa55c('0x7'));var ZendeskAccount=require(_0xa55c('0x8'));var SalesforceAccount=require(_0xa55c('0x9'));var FreshdeskAccount=require(_0xa55c('0xa'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xa55c('0xb'));var DeskAccount=require(_0xa55c('0xc'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xa55c('0xd'));var Dynamics365Account=require(_0xa55c('0xe'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xa55c('0xf')]={};this[_0xa55c('0x10')]={};this[_0xa55c('0x11')]={};this[_0xa55c('0x12')]={};this[_0xa55c('0x13')]={};this[_0xa55c('0x14')]={};this[_0xa55c('0x15')]={};this[_0xa55c('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xa55c('0x17')]={};this[_0xa55c('0x18')]={};this['queueChannels']={};this['outboundChannels']={};this[_0xa55c('0x19')]={};this['settings']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0xa55c('0x1a')]={};this[_0xa55c('0x1b')]={};this[_0xa55c('0x1c')]={};this[_0xa55c('0x1d')]={};this[_0xa55c('0x1e')]={};this[_0xa55c('0x1f')]={};this['dynamics365Accounts']={};this[_0xa55c('0x20')]={};this[_0xa55c('0x21')]={};};function freeIsNotKey(_0x25934f,_0x31e10d,_0x1c4cfd){var _0x3ae86b=_[_0xa55c('0x22')](_0x25934f,function(_0x2d09d8,_0x24783b){return _0x2d09d8[_0x1c4cfd];});for(var _0x4cee3c in _0x31e10d){if(_0x31e10d[_0xa55c('0x23')](_0x4cee3c)){if(!_0x3ae86b[_0x4cee3c]){delete _0x31e10d[_0x4cee3c];}}}}function freeIsNotKeySip(_0x104a99,_0x461284){var _0x358b61=_[_0xa55c('0x22')](_0x104a99,function(_0x5426e5,_0x4c0daf){return util['format'](_0xa55c('0x24'),_0x5426e5[_0xa55c('0x25')]);});for(var _0xade4c4 in _0x461284){if(_0x461284['hasOwnProperty'](_0xade4c4)){if(!_0x358b61[_0xade4c4]){delete _0x461284[_0xade4c4];}}}}function freeIsNotKeyAgent(_0x383d92,_0x2fcb90){var _0x54945a=_[_0xa55c('0x22')](_0x383d92,function(_0x133096,_0x940f28){var _0x1965f1=_[_0xa55c('0x26')](_0x133096['interface'])?util[_0xa55c('0x27')]('SIP/%s',_0x133096['name']):_0x133096['interface'];return _0x1965f1;});for(var _0x19ae88 in _0x2fcb90){if(_0x2fcb90['hasOwnProperty'](_0x19ae88)){if(!_0x54945a[_0x19ae88]){delete _0x2fcb90[_0x19ae88];}}}}function clearVoiceCallReports(_0x3ecbe7){_0x3ecbe7[_0xa55c('0x28')]=0x0;_0x3ecbe7[_0xa55c('0x29')]=0x0;_0x3ecbe7[_0xa55c('0x2a')]=0x0;_0x3ecbe7[_0xa55c('0x2b')]=0x0;_0x3ecbe7[_0xa55c('0x2c')]=0x0;}function clearCampaigns(_0x1da633){if(!_[_0xa55c('0x2d')](_0x1da633)){for(var _0x192df2 in _0x1da633){if(_0x1da633[_0xa55c('0x23')](_0x192df2)){_0x1da633[_0x192df2][_0xa55c('0x2e')]=0x0;_0x1da633[_0x192df2]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x430d55){if(!_[_0xa55c('0x2d')](_0x430d55)){for(var _0x1c9f6b in _0x430d55){if(_0x430d55[_0xa55c('0x23')](_0x1c9f6b)){_0x430d55[_0x1c9f6b]['total']=0x0;_0x430d55[_0x1c9f6b][_0xa55c('0x29')]=0x0;_0x430d55[_0x1c9f6b][_0xa55c('0x2f')]=0x0;_0x430d55[_0x1c9f6b][_0xa55c('0x30')]=0x0;_0x430d55[_0x1c9f6b][_0xa55c('0x2a')]=0x0;_0x430d55[_0x1c9f6b][_0xa55c('0x2b')]=0x0;_0x430d55[_0x1c9f6b][_0xa55c('0x2c')]=0x0;_0x430d55[_0x1c9f6b]['outboundAnswerAgiCallsDay']=0x0;_0x430d55[_0x1c9f6b][_0xa55c('0x31')]=0x0;_0x430d55[_0x1c9f6b]['outboundBusyCallsDay']=0x0;_0x430d55[_0x1c9f6b][_0xa55c('0x32')]=0x0;_0x430d55[_0x1c9f6b][_0xa55c('0x33')]=0x0;_0x430d55[_0x1c9f6b][_0xa55c('0x34')]=0x0;_0x430d55[_0x1c9f6b][_0xa55c('0x35')]=0x0;_0x430d55[_0x1c9f6b]['outboundDropCallsDayCallersExit']=0x0;_0x430d55[_0x1c9f6b][_0xa55c('0x36')]=0x0;_0x430d55[_0x1c9f6b][_0xa55c('0x37')]=0x0;_0x430d55[_0x1c9f6b][_0xa55c('0x38')]=0x0;_0x430d55[_0x1c9f6b][_0xa55c('0x39')]=0x0;_0x430d55[_0x1c9f6b][_0xa55c('0x3a')]=0x0;_0x430d55[_0x1c9f6b][_0xa55c('0x3b')]=0x0;_0x430d55[_0x1c9f6b][_0xa55c('0x3c')]=!![];}}}}Realtime[_0xa55c('0x3d')][_0xa55c('0x3e')]=function(_0xcbaf2e,_0x197099){for(var _0x4eb7c4 in _0x197099){if(_0xcbaf2e['hasOwnProperty'](_0x4eb7c4)){_0xcbaf2e[_0x4eb7c4]=_0x197099[_0x4eb7c4];}}};Realtime[_0xa55c('0x3d')][_0xa55c('0x3f')]=function(){var _0x4932d0=this;return function(_0x30fadd){if(_0x30fadd){freeIsNotKeyAgent(_0x30fadd,_0x4932d0[_0xa55c('0xf')]);for(var _0x2e9623=0x0,_0x1839ac={},_0x30d4f8={};_0x2e9623<_0x30fadd[_0xa55c('0x40')];_0x2e9623+=0x1){_0x1839ac=_0x30fadd[_0x2e9623];var _0x3ce1b3=_[_0xa55c('0x26')](_0x1839ac[_0xa55c('0x41')])?util['format']('SIP/%s',_0x1839ac['name']):_0x1839ac[_0xa55c('0x41')];if(_[_0xa55c('0x42')](_0x4932d0[_0xa55c('0xf')][_0x3ce1b3])){_0x4932d0['agents'][_0x3ce1b3]=new Agent(_0x1839ac);}else{_0x4932d0[_0xa55c('0x3e')](_0x4932d0['agents'][_0x3ce1b3],_0x1839ac);}}}return _0x4932d0[_0xa55c('0xf')];};};Realtime['prototype'][_0xa55c('0x43')]=function(){var _0x39267c=this;return function(_0x3c0ec1){if(_0x3c0ec1){freeIsNotKeySip(_0x3c0ec1,_0x39267c['telephones']);for(var _0x7c4a47=0x0,_0x30f23b={},_0x47e93c={};_0x7c4a47<_0x3c0ec1[_0xa55c('0x40')];_0x7c4a47+=0x1){_0x30f23b=_0x3c0ec1[_0x7c4a47];if(_[_0xa55c('0x42')](_0x39267c['telephones'][util['format'](_0xa55c('0x24'),_0x30f23b['name'])])){_0x39267c[_0xa55c('0x10')][util[_0xa55c('0x27')]('SIP/%s',_0x30f23b['name'])]=new Telephone(_0x30f23b);}else{_0x39267c['mergeFromDatabase'](_0x39267c['telephones'][util[_0xa55c('0x27')](_0xa55c('0x24'),_0x30f23b[_0xa55c('0x25')])],_0x30f23b);}}}return _0x39267c[_0xa55c('0x10')];};};Realtime[_0xa55c('0x3d')]['initTrunks']=function(){var _0x3d52d8=this;return function(_0x7cc363){if(_0x7cc363){freeIsNotKeySip(_0x7cc363,_0x3d52d8[_0xa55c('0x11')]);for(var _0x317f6b=0x0,_0x43bac0={},_0x23cef5={};_0x317f6b<_0x7cc363['length'];_0x317f6b+=0x1){_0x43bac0=_0x7cc363[_0x317f6b];if(_[_0xa55c('0x42')](_0x3d52d8['trunks'][util['format'](_0xa55c('0x24'),_0x43bac0[_0xa55c('0x25')])])){_0x3d52d8['trunks'][util[_0xa55c('0x27')]('SIP/%s',_0x43bac0['name'])]=new Trunk(_0x43bac0);}else{_0x3d52d8[_0xa55c('0x3e')](_0x3d52d8[_0xa55c('0x11')][util[_0xa55c('0x27')]('SIP/%s',_0x43bac0[_0xa55c('0x25')])],_0x43bac0);}}}return _0x3d52d8[_0xa55c('0x11')];};};Realtime['prototype'][_0xa55c('0x44')]=function(){var _0x514661=this;return function(_0x39886a){if(_0x39886a){freeIsNotKey(_0x39886a,_0x514661[_0xa55c('0x12')],'name');for(var _0x66d1de=0x0,_0x1dae70={},_0x5d834d={};_0x66d1de<_0x39886a[_0xa55c('0x40')];_0x66d1de+=0x1){_0x1dae70=_0x39886a[_0x66d1de];if(_[_0xa55c('0x42')](_0x514661[_0xa55c('0x12')][_0x1dae70['name']])){_0x514661[_0xa55c('0x12')][_0x1dae70['name']]=new VoiceQueue(_0x1dae70);}else{_0x514661[_0xa55c('0x3e')](_0x514661[_0xa55c('0x12')][_0x1dae70[_0xa55c('0x25')]],_0x1dae70);}}}return _0x514661['voiceQueues'];};};Realtime[_0xa55c('0x3d')][_0xa55c('0x45')]=function(){var _0x592429=this;return function(_0x3d19f5){if(_0x3d19f5){freeIsNotKey(_0x3d19f5,_0x592429[_0xa55c('0x13')],'id');for(var _0x5d5cf6=0x0,_0x11ff1d={},_0xd3fe78={};_0x5d5cf6<_0x3d19f5['length'];_0x5d5cf6+=0x1){_0x11ff1d=_0x3d19f5[_0x5d5cf6];if(_[_0xa55c('0x42')](_0x592429[_0xa55c('0x13')][_0x11ff1d['id']])){_0x592429[_0xa55c('0x13')][_0x11ff1d['id']]=new Trigger(_0x11ff1d);}else{_0x592429[_0xa55c('0x3e')](_0x592429['triggers'][_0x11ff1d['id']],_0x11ff1d);}}}return _0x592429[_0xa55c('0x13')];};};Realtime['prototype'][_0xa55c('0x46')]=function(){var _0x213100=this;return function(_0x194a79){if(_0x194a79){freeIsNotKey(_0x194a79,_0x213100['templates'],'id');for(var _0x39bd3d=0x0,_0x250b00={},_0x574fe9={};_0x39bd3d<_0x194a79[_0xa55c('0x40')];_0x39bd3d+=0x1){_0x250b00=_0x194a79[_0x39bd3d];if(_[_0xa55c('0x42')](_0x213100[_0xa55c('0x15')][_0x250b00['id']])){_0x213100[_0xa55c('0x15')][_0x250b00['id']]=new Template(_0x250b00);}else{_0x213100[_0xa55c('0x3e')](_0x213100[_0xa55c('0x15')][_0x250b00['id']],_0x250b00);}}}return _0x213100[_0xa55c('0x15')];};};Realtime[_0xa55c('0x3d')][_0xa55c('0x47')]=function(){var _0x3376a1=this;return function(_0x4fc0a9){if(_0x4fc0a9){freeIsNotKey(_0x4fc0a9,_0x3376a1[_0xa55c('0x48')],'id');for(var _0x46e27d=0x0,_0x216de8={},_0x4f73b6={};_0x46e27d<_0x4fc0a9[_0xa55c('0x40')];_0x46e27d+=0x1){_0x216de8=_0x4fc0a9[_0x46e27d];if(_[_0xa55c('0x42')](_0x3376a1['zendeskAccounts'][_0x216de8['id']])){_0x3376a1[_0xa55c('0x48')][_0x216de8['id']]=new ZendeskAccount(_0x216de8);}else{_0x3376a1['mergeFromDatabase'](_0x3376a1[_0xa55c('0x48')][_0x216de8['id']],_0x216de8);}}}return _0x3376a1[_0xa55c('0x48')];};};Realtime[_0xa55c('0x3d')][_0xa55c('0x49')]=function(){var _0x2ecf79=this;return function(_0x5b1cf3){if(_0x5b1cf3){freeIsNotKey(_0x5b1cf3,_0x2ecf79[_0xa55c('0x4a')],'id');for(var _0x4607ca=0x0,_0x4b85cc={},_0x3929a6={};_0x4607ca<_0x5b1cf3[_0xa55c('0x40')];_0x4607ca+=0x1){_0x4b85cc=_0x5b1cf3[_0x4607ca];if(_[_0xa55c('0x42')](_0x2ecf79[_0xa55c('0x4a')][_0x4b85cc['id']])){_0x2ecf79['salesforceAccounts'][_0x4b85cc['id']]=new SalesforceAccount(_0x4b85cc);}else{_0x2ecf79['mergeFromDatabase'](_0x2ecf79[_0xa55c('0x4a')][_0x4b85cc['id']],_0x4b85cc);}}}return _0x2ecf79[_0xa55c('0x4a')];};};Realtime[_0xa55c('0x3d')][_0xa55c('0x4b')]=function(){var _0x54cbde=this;return function(_0x30c0c9){if(_0x30c0c9){freeIsNotKey(_0x30c0c9,_0x54cbde['freshdeskAccounts'],'id');for(var _0x2742e4=0x0,_0x437ced={},_0x20593d={};_0x2742e4<_0x30c0c9[_0xa55c('0x40')];_0x2742e4+=0x1){_0x437ced=_0x30c0c9[_0x2742e4];if(_[_0xa55c('0x42')](_0x54cbde['freshdeskAccounts'][_0x437ced['id']])){_0x54cbde[_0xa55c('0x1b')][_0x437ced['id']]=new FreshdeskAccount(_0x437ced);}else{_0x54cbde['mergeFromDatabase'](_0x54cbde[_0xa55c('0x1b')][_0x437ced['id']],_0x437ced);}}}return _0x54cbde[_0xa55c('0x1b')];};};Realtime[_0xa55c('0x3d')][_0xa55c('0x4c')]=function(){var _0x19aaf5=this;return function(_0x138c9e){if(_0x138c9e){freeIsNotKey(_0x138c9e,_0x19aaf5[_0xa55c('0x1c')],'id');for(var _0x53e2be=0x0,_0x450567={},_0x449e00={};_0x53e2be<_0x138c9e[_0xa55c('0x40')];_0x53e2be+=0x1){_0x450567=_0x138c9e[_0x53e2be];if(_[_0xa55c('0x42')](_0x19aaf5[_0xa55c('0x1c')][_0x450567['id']])){_0x19aaf5['zohoAccounts'][_0x450567['id']]=new ZohoAccount(_0x450567);}else{_0x19aaf5[_0xa55c('0x3e')](_0x19aaf5[_0xa55c('0x1c')][_0x450567['id']],_0x450567);}}}return _0x19aaf5[_0xa55c('0x1c')];};};Realtime[_0xa55c('0x3d')][_0xa55c('0x4d')]=function(){var _0x493f51=this;return function(_0xdd92c1){if(_0xdd92c1){freeIsNotKey(_0xdd92c1,_0x493f51[_0xa55c('0x1d')],'id');for(var _0x43136b=0x0,_0x16d9b2={},_0x3ba56d={};_0x43136b<_0xdd92c1['length'];_0x43136b+=0x1){_0x16d9b2=_0xdd92c1[_0x43136b];if(_[_0xa55c('0x42')](_0x493f51['deskAccounts'][_0x16d9b2['id']])){_0x493f51[_0xa55c('0x1d')][_0x16d9b2['id']]=new DeskAccount(_0x16d9b2);}else{_0x493f51['mergeFromDatabase'](_0x493f51[_0xa55c('0x1d')][_0x16d9b2['id']],_0x16d9b2);}}}return _0x493f51['deskAccounts'];};};Realtime[_0xa55c('0x3d')][_0xa55c('0x4e')]=function(){var _0x21d6b4=this;return function(_0x2f811e){if(_0x2f811e){freeIsNotKey(_0x2f811e,_0x21d6b4[_0xa55c('0x1a')],'id');for(var _0x3a5a52=0x0,_0xafaf8c={},_0x2f2226={};_0x3a5a52<_0x2f811e[_0xa55c('0x40')];_0x3a5a52+=0x1){_0xafaf8c=_0x2f811e[_0x3a5a52];if(_[_0xa55c('0x42')](_0x21d6b4['sugarcrmAccounts'][_0xafaf8c['id']])){_0x21d6b4[_0xa55c('0x1a')][_0xafaf8c['id']]=new SugarcrmAccount(_0xafaf8c);}else{_0x21d6b4[_0xa55c('0x3e')](_0x21d6b4['sugarcrmAccounts'][_0xafaf8c['id']],_0xafaf8c);}}}return _0x21d6b4[_0xa55c('0x1a')];};};Realtime[_0xa55c('0x3d')][_0xa55c('0x4f')]=function(){var _0x9fe234=this;return function(_0x1b8b06){if(_0x1b8b06){freeIsNotKey(_0x1b8b06,_0x9fe234[_0xa55c('0x1e')],'id');for(var _0x3cef1f=0x0,_0x202191={},_0x47de0a={};_0x3cef1f<_0x1b8b06[_0xa55c('0x40')];_0x3cef1f+=0x1){_0x202191=_0x1b8b06[_0x3cef1f];if(_[_0xa55c('0x42')](_0x9fe234[_0xa55c('0x1e')][_0x202191['id']])){_0x9fe234[_0xa55c('0x1e')][_0x202191['id']]=new VtigerAccount(_0x202191);}else{_0x9fe234[_0xa55c('0x3e')](_0x9fe234[_0xa55c('0x1e')][_0x202191['id']],_0x202191);}}}return _0x9fe234[_0xa55c('0x1e')];};};Realtime[_0xa55c('0x3d')][_0xa55c('0x50')]=function(){var _0x4a08ca=this;return function(_0x347562){if(_0x347562){freeIsNotKey(_0x347562,_0x4a08ca[_0xa55c('0x1f')],'id');for(var _0x40c56a=0x0,_0x26606c={},_0x3a269d={};_0x40c56a<_0x347562[_0xa55c('0x40')];_0x40c56a+=0x1){_0x26606c=_0x347562[_0x40c56a];if(_[_0xa55c('0x42')](_0x4a08ca[_0xa55c('0x1f')][_0x26606c['id']])){_0x4a08ca[_0xa55c('0x1f')][_0x26606c['id']]=new ServicenowAccount(_0x26606c);}else{_0x4a08ca[_0xa55c('0x3e')](_0x4a08ca[_0xa55c('0x1f')][_0x26606c['id']],_0x26606c);}}}return _0x4a08ca['servicenowAccounts'];};};Realtime[_0xa55c('0x3d')]['initDynamics365Accounts']=function(){var _0x1228a4=this;return function(_0x1ff077){if(_0x1ff077){freeIsNotKey(_0x1ff077,_0x1228a4[_0xa55c('0x51')],'id');for(var _0x4f2a7b=0x0,_0x4d9722={},_0x2640a1={};_0x4f2a7b<_0x1ff077[_0xa55c('0x40')];_0x4f2a7b+=0x1){_0x4d9722=_0x1ff077[_0x4f2a7b];if(_[_0xa55c('0x42')](_0x1228a4[_0xa55c('0x51')][_0x4d9722['id']])){_0x1228a4['dynamics365Accounts'][_0x4d9722['id']]=new Dynamics365Account(_0x4d9722);}else{_0x1228a4[_0xa55c('0x3e')](_0x1228a4[_0xa55c('0x51')][_0x4d9722['id']],_0x4d9722);}}}return _0x1228a4[_0xa55c('0x51')];};};Realtime[_0xa55c('0x3d')][_0xa55c('0x52')]=function(){var _0x500968=this;return function(_0x4b090c){if(_0x4b090c){freeIsNotKey(_0x4b090c,_0x500968[_0xa55c('0x20')],'id');for(var _0x38689e=0x0,_0x3f9d0a={},_0x36ee32={};_0x38689e<_0x4b090c[_0xa55c('0x40')];_0x38689e+=0x1){_0x3f9d0a=_0x4b090c[_0x38689e];if(_['isUndefined'](_0x500968[_0xa55c('0x20')][_0x3f9d0a['id']])){_0x500968[_0xa55c('0x20')][_0x3f9d0a['id']]=new FreshsalesAccount(_0x3f9d0a);}else{_0x500968['mergeFromDatabase'](_0x500968[_0xa55c('0x20')][_0x3f9d0a['id']],_0x3f9d0a);}}}return _0x500968[_0xa55c('0x20')];};};Realtime[_0xa55c('0x3d')]['initVoiceQueueHopperHistory']=function(){var _0x1521d5=this;return function(_0x3ff604){for(var _0xdf94b3=0x0;_0xdf94b3<_0x3ff604[_0xa55c('0x40')];_0xdf94b3+=0x1){_[_0xa55c('0x53')](_0x1521d5['voiceQueues'][_0x3ff604[_0xdf94b3][_0xa55c('0x25')]],_0x3ff604[_0xdf94b3]);}return _0x1521d5[_0xa55c('0x12')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x194ddc=this;return function(_0x4e1cbd){clearVoiceQueues(_0x194ddc[_0xa55c('0x12')]);if(_0x4e1cbd){_0x4e1cbd=_[_0xa55c('0x54')](_0x4e1cbd,_0xa55c('0x55'));for(var _0x1301fd in _0x4e1cbd){if(_0x4e1cbd[_0xa55c('0x23')](_0x1301fd)){var _0x3f1132={};for(var _0x22b06f=0x0;_0x22b06f<_0x4e1cbd[_0x1301fd][_0xa55c('0x40')];_0x22b06f+=0x1){var _0x16dfc6=_0x4e1cbd[_0x1301fd][_0x22b06f]['queue'];if(_0x194ddc[_0xa55c('0x12')][_0x16dfc6]){if(_0x4e1cbd[_0x1301fd][_0x22b06f][_0xa55c('0x56')]){_0x194ddc[_0xa55c('0x12')][_0x16dfc6][_0xa55c('0x2f')]+=0x1;}if(_0x4e1cbd[_0x1301fd][_0x22b06f]['queuecallerabandon']){_0x194ddc[_0xa55c('0x12')][_0x16dfc6][_0xa55c('0x30')]+=0x1;}_0x194ddc[_0xa55c('0x12')][_0x16dfc6][_0xa55c('0x2a')]+=moment(_0x4e1cbd[_0x1301fd][_0x22b06f]['queuecallerleaveAt'])['diff'](moment(_0x4e1cbd[_0x1301fd][_0x22b06f][_0xa55c('0x57')]),_0xa55c('0x58'))||0x0;if(_0x22b06f===_0x4e1cbd[_0x1301fd][_0xa55c('0x40')]-0x1){_0x194ddc[_0xa55c('0x12')][_0x16dfc6]['sumDuration']+=moment(_0x4e1cbd[_0x1301fd][_0x22b06f]['queuecallercompleteAt']||_0x4e1cbd[_0x1301fd][_0x22b06f][_0xa55c('0x59')]||_0x4e1cbd[_0x1301fd][_0x22b06f][_0xa55c('0x5a')])[_0xa55c('0x5b')](moment(_0x4e1cbd[_0x1301fd][_0x22b06f][_0xa55c('0x57')]),_0xa55c('0x58'))||0x0;_0x194ddc[_0xa55c('0x12')][_0x16dfc6][_0xa55c('0x28')]+=0x1;if(_0x4e1cbd[_0x1301fd][_0x22b06f]['queuecallercomplete']){_0x194ddc[_0xa55c('0x12')][_0x16dfc6]['answered']+=0x1;_0x194ddc[_0xa55c('0x12')][_0x16dfc6]['sumBillable']+=moment(_0x4e1cbd[_0x1301fd][_0x22b06f][_0xa55c('0x5c')])[_0xa55c('0x5b')](moment(_0x4e1cbd[_0x1301fd][_0x22b06f][_0xa55c('0x5d')]),_0xa55c('0x58'))||0x0;}}else{_0x194ddc[_0xa55c('0x12')][_0x16dfc6][_0xa55c('0x2b')]+=_0x194ddc[_0xa55c('0x12')][_0x16dfc6][_0xa55c('0x2a')]||0x0;}}}}}}return _0x194ddc['voiceQueues'];};};Realtime['prototype'][_0xa55c('0x5e')]=function(){var _0x2948b1=this;return function(_0xc2ad5c){clearVoiceCallReports(_0x2948b1[_0xa55c('0x16')]);if(_0xc2ad5c){for(var _0x1622cb=0x0;_0x1622cb<_0xc2ad5c[_0xa55c('0x40')];_0x1622cb+=0x1){_0x2948b1['outbound'][_0xa55c('0x28')]+=0x1;_0x2948b1[_0xa55c('0x16')][_0xa55c('0x2b')]+=_0xc2ad5c[_0x1622cb][_0xa55c('0x5f')];if(_0xc2ad5c[_0x1622cb][_0xa55c('0x60')]===_0xa55c('0x61')){_0x2948b1[_0xa55c('0x16')][_0xa55c('0x29')]+=0x1;_0x2948b1['outbound'][_0xa55c('0x2a')]+=_0xc2ad5c[_0x1622cb][_0xa55c('0x5f')]-_0xc2ad5c[_0x1622cb][_0xa55c('0x62')]||0x0;_0x2948b1[_0xa55c('0x16')][_0xa55c('0x2c')]+=_0xc2ad5c[_0x1622cb]['billableseconds'];}}}return _0x2948b1[_0xa55c('0x16')];};};Realtime[_0xa55c('0x3d')]['initCampaigns']=function(){var _0x4863d5=this;return function(_0x1f7b00){if(_0x1f7b00){freeIsNotKey(_0x1f7b00,_0x4863d5[_0xa55c('0x14')],'name');for(var _0x559e71=0x0,_0x579726={};_0x559e71<_0x1f7b00['length'];_0x559e71+=0x1){_0x579726=_0x1f7b00[_0x559e71];if(_[_0xa55c('0x42')](_0x4863d5[_0xa55c('0x14')][_0x579726[_0xa55c('0x25')]])){_0x4863d5[_0xa55c('0x14')][_0x579726[_0xa55c('0x25')]]=new Campaign(_0x579726);}else{_0x4863d5[_0xa55c('0x3e')](_0x4863d5['campaigns'][_0x579726[_0xa55c('0x25')]],_0x579726);_0x4863d5[_0xa55c('0x14')][_0x579726[_0xa55c('0x25')]][_0xa55c('0x63')]=_0x579726['SquareProject']?_0x579726[_0xa55c('0x64')][_0xa55c('0x25')]:undefined;}}}return _0x4863d5[_0xa55c('0x14')];};};Realtime['prototype'][_0xa55c('0x65')]=function(){var _0x4fb0d3=this;return function(_0x5e26f0){if(_0x5e26f0){freeIsNotKey(_0x5e26f0,_0x4fb0d3[_0xa55c('0x17')],'id');for(var _0x413b45=0x0,_0x1e298d={};_0x413b45<_0x5e26f0[_0xa55c('0x40')];_0x413b45+=0x1){_0x1e298d=_0x5e26f0[_0x413b45];if(_[_0xa55c('0x42')](_0x4fb0d3[_0xa55c('0x17')][_0x1e298d['id']])){_0x4fb0d3[_0xa55c('0x17')][_0x1e298d['id']]=new VoiceExtension(_0x1e298d);}else{_0x4fb0d3['mergeFromDatabase'](_0x4fb0d3['voiceExtensions'][_0x1e298d['id']],_0x1e298d);}}}return _0x4fb0d3[_0xa55c('0x17')];};};Realtime[_0xa55c('0x3d')][_0xa55c('0x66')]=function(){var _0x1f4bc8=this;return function(_0x195c86){clearCampaigns(_0x1f4bc8[_0xa55c('0x14')]);for(var _0x356a73=0x0;_0x356a73<_0x195c86[_0xa55c('0x40')];_0x356a73+=0x1){_[_0xa55c('0x53')](_0x1f4bc8[_0xa55c('0x14')][_0x195c86[_0x356a73]['name']],_0x195c86[_0x356a73]);}return _0x1f4bc8[_0xa55c('0x14')];};};Realtime[_0xa55c('0x3d')]['initFaxAccounts']=function(){var _0xb9708=this;return function(_0x584317){if(_0x584317){freeIsNotKey(_0x584317,_0xb9708[_0xa55c('0x21')],'id');for(var _0xe504ba=0x0,_0x3fe34d={},_0x314205={};_0xe504ba<_0x584317[_0xa55c('0x40')];_0xe504ba+=0x1){_0x3fe34d=_0x584317[_0xe504ba];if(_['isUndefined'](_0xb9708[_0xa55c('0x21')][_0x3fe34d['id']])){_0xb9708[_0xa55c('0x21')][_0x3fe34d['id']]=new FaxAccount(_0x3fe34d);}else{_0xb9708[_0xa55c('0x3e')](_0xb9708[_0xa55c('0x21')][_0x3fe34d['id']],_0x3fe34d);}}}return _0xb9708[_0xa55c('0x21')];};};module[_0xa55c('0x67')]=Realtime; \ No newline at end of file +var _0x00bb=['outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initVoiceQueues','initTriggers','triggers','templates','initZendeskAccounts','salesforceAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallerexitAt','queuecallercomplete','seconds','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','dialQueueProject','SquareProject','voiceExtensions','initFaxAccounts','faxAccounts','bluebird','util','lodash','../model/agent','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','campaigns','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','freshsalesAccounts','mapKeys','hasOwnProperty','SIP/%s','interface','format','name','total','answered','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','abandoned','sumHoldTime','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout'];(function(_0x375b8b,_0x1d7939){var _0x1ef2f7=function(_0x2871fc){while(--_0x2871fc){_0x375b8b['push'](_0x375b8b['shift']());}};_0x1ef2f7(++_0x1d7939);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x00bb[_0x5b644e];return _0x49c6bf;};'use strict';var BPromise=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var _=require(_0xb00b('0x2'));var moment=require('moment');var Agent=require(_0xb00b('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0xb00b('0x4'));var VoiceQueue=require(_0xb00b('0x5'));var Trigger=require('../model/trigger');var Template=require(_0xb00b('0x6'));var Campaign=require(_0xb00b('0x7'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xb00b('0x8'));var SugarcrmAccount=require(_0xb00b('0x9'));var ZohoAccount=require(_0xb00b('0xa'));var DeskAccount=require(_0xb00b('0xb'));var VtigerAccount=require(_0xb00b('0xc'));var ServicenowAccount=require(_0xb00b('0xd'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xb00b('0xe'));var Realtime=function(){this[_0xb00b('0xf')]={};this[_0xb00b('0x10')]={};this[_0xb00b('0x11')]={};this[_0xb00b('0x12')]={};this['triggers']={};this[_0xb00b('0x13')]={};this['templates']={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xb00b('0x14')]={};this[_0xb00b('0x15')]={};this[_0xb00b('0x16')]={};this[_0xb00b('0x17')]={};this[_0xb00b('0x18')]={};this[_0xb00b('0x19')]={};this['salesforceAccounts']={};this[_0xb00b('0x1a')]={};this[_0xb00b('0x1b')]={};this['zohoAccounts']={};this[_0xb00b('0x1c')]={};this[_0xb00b('0x1d')]={};this['servicenowAccounts']={};this['dynamics365Accounts']={};this[_0xb00b('0x1e')]={};this['faxAccounts']={};};function freeIsNotKey(_0x51d136,_0x1f9c78,_0x638443){var _0x387d97=_[_0xb00b('0x1f')](_0x51d136,function(_0x58d65f,_0x2a7231){return _0x58d65f[_0x638443];});for(var _0x599347 in _0x1f9c78){if(_0x1f9c78[_0xb00b('0x20')](_0x599347)){if(!_0x387d97[_0x599347]){delete _0x1f9c78[_0x599347];}}}}function freeIsNotKeySip(_0x5aa9a0,_0x25d7a0){var _0x5e8d7b=_[_0xb00b('0x1f')](_0x5aa9a0,function(_0x3355a3,_0x53ee68){return util['format'](_0xb00b('0x21'),_0x3355a3['name']);});for(var _0x1344c4 in _0x25d7a0){if(_0x25d7a0[_0xb00b('0x20')](_0x1344c4)){if(!_0x5e8d7b[_0x1344c4]){delete _0x25d7a0[_0x1344c4];}}}}function freeIsNotKeyAgent(_0x2fe48d,_0x3501af){var _0x56c189=_[_0xb00b('0x1f')](_0x2fe48d,function(_0x4df284,_0x25a973){var _0x121ec7=_['isNil'](_0x4df284[_0xb00b('0x22')])?util[_0xb00b('0x23')]('SIP/%s',_0x4df284[_0xb00b('0x24')]):_0x4df284[_0xb00b('0x22')];return _0x121ec7;});for(var _0x5568bb in _0x3501af){if(_0x3501af[_0xb00b('0x20')](_0x5568bb)){if(!_0x56c189[_0x5568bb]){delete _0x3501af[_0x5568bb];}}}}function clearVoiceCallReports(_0x243fdb){_0x243fdb[_0xb00b('0x25')]=0x0;_0x243fdb[_0xb00b('0x26')]=0x0;_0x243fdb['sumHoldTime']=0x0;_0x243fdb['sumDuration']=0x0;_0x243fdb[_0xb00b('0x27')]=0x0;}function clearCampaigns(_0x490380){if(!_['isEmpty'](_0x490380)){for(var _0x4a635e in _0x490380){if(_0x490380[_0xb00b('0x20')](_0x4a635e)){_0x490380[_0x4a635e][_0xb00b('0x28')]=0x0;_0x490380[_0x4a635e][_0xb00b('0x29')]=0x0;}}}}function clearVoiceQueues(_0x3825af){if(!_[_0xb00b('0x2a')](_0x3825af)){for(var _0x197379 in _0x3825af){if(_0x3825af[_0xb00b('0x20')](_0x197379)){_0x3825af[_0x197379]['total']=0x0;_0x3825af[_0x197379][_0xb00b('0x26')]=0x0;_0x3825af[_0x197379]['unmanaged']=0x0;_0x3825af[_0x197379][_0xb00b('0x2b')]=0x0;_0x3825af[_0x197379][_0xb00b('0x2c')]=0x0;_0x3825af[_0x197379][_0xb00b('0x2d')]=0x0;_0x3825af[_0x197379]['sumBillable']=0x0;_0x3825af[_0x197379][_0xb00b('0x2e')]=0x0;_0x3825af[_0x197379][_0xb00b('0x2f')]=0x0;_0x3825af[_0x197379][_0xb00b('0x30')]=0x0;_0x3825af[_0x197379][_0xb00b('0x31')]=0x0;_0x3825af[_0x197379][_0xb00b('0x32')]=0x0;_0x3825af[_0x197379][_0xb00b('0x33')]=0x0;_0x3825af[_0x197379][_0xb00b('0x34')]=0x0;_0x3825af[_0x197379][_0xb00b('0x35')]=0x0;_0x3825af[_0x197379][_0xb00b('0x36')]=0x0;_0x3825af[_0x197379]['outboundOriginateFailureCallsDay']=0x0;_0x3825af[_0x197379][_0xb00b('0x37')]=0x0;_0x3825af[_0x197379][_0xb00b('0x38')]=0x0;_0x3825af[_0x197379]['outboundAnswerAgiCallsDay']=0x0;_0x3825af[_0x197379][_0xb00b('0x39')]=0x0;_0x3825af[_0x197379][_0xb00b('0x3a')]=!![];}}}}Realtime['prototype'][_0xb00b('0x3b')]=function(_0x4d2ee5,_0x20e1c9){for(var _0x4117f2 in _0x20e1c9){if(_0x4d2ee5[_0xb00b('0x20')](_0x4117f2)){_0x4d2ee5[_0x4117f2]=_0x20e1c9[_0x4117f2];}}};Realtime[_0xb00b('0x3c')][_0xb00b('0x3d')]=function(){var _0x1436ad=this;return function(_0x17f613){if(_0x17f613){freeIsNotKeyAgent(_0x17f613,_0x1436ad['agents']);for(var _0x57e8f9=0x0,_0x5b04c2={},_0x347e73={};_0x57e8f9<_0x17f613[_0xb00b('0x3e')];_0x57e8f9+=0x1){_0x5b04c2=_0x17f613[_0x57e8f9];var _0x45dcda=_[_0xb00b('0x3f')](_0x5b04c2['interface'])?util[_0xb00b('0x23')](_0xb00b('0x21'),_0x5b04c2[_0xb00b('0x24')]):_0x5b04c2[_0xb00b('0x22')];if(_[_0xb00b('0x40')](_0x1436ad[_0xb00b('0xf')][_0x45dcda])){_0x1436ad[_0xb00b('0xf')][_0x45dcda]=new Agent(_0x5b04c2);}else{_0x1436ad[_0xb00b('0x3b')](_0x1436ad['agents'][_0x45dcda],_0x5b04c2);}}}return _0x1436ad['agents'];};};Realtime[_0xb00b('0x3c')]['initTelephones']=function(){var _0x1c8258=this;return function(_0x1c5400){if(_0x1c5400){freeIsNotKeySip(_0x1c5400,_0x1c8258[_0xb00b('0x10')]);for(var _0x45ca74=0x0,_0x37c017={},_0x142cdd={};_0x45ca74<_0x1c5400[_0xb00b('0x3e')];_0x45ca74+=0x1){_0x37c017=_0x1c5400[_0x45ca74];if(_['isUndefined'](_0x1c8258[_0xb00b('0x10')][util[_0xb00b('0x23')](_0xb00b('0x21'),_0x37c017[_0xb00b('0x24')])])){_0x1c8258[_0xb00b('0x10')][util[_0xb00b('0x23')]('SIP/%s',_0x37c017[_0xb00b('0x24')])]=new Telephone(_0x37c017);}else{_0x1c8258[_0xb00b('0x3b')](_0x1c8258['telephones'][util[_0xb00b('0x23')](_0xb00b('0x21'),_0x37c017[_0xb00b('0x24')])],_0x37c017);}}}return _0x1c8258[_0xb00b('0x10')];};};Realtime[_0xb00b('0x3c')]['initTrunks']=function(){var _0x14ff6a=this;return function(_0xe4b5b6){if(_0xe4b5b6){freeIsNotKeySip(_0xe4b5b6,_0x14ff6a[_0xb00b('0x11')]);for(var _0xa262a3=0x0,_0x5d2bbd={},_0x4867fe={};_0xa262a3<_0xe4b5b6[_0xb00b('0x3e')];_0xa262a3+=0x1){_0x5d2bbd=_0xe4b5b6[_0xa262a3];if(_[_0xb00b('0x40')](_0x14ff6a[_0xb00b('0x11')][util[_0xb00b('0x23')](_0xb00b('0x21'),_0x5d2bbd[_0xb00b('0x24')])])){_0x14ff6a[_0xb00b('0x11')][util['format'](_0xb00b('0x21'),_0x5d2bbd[_0xb00b('0x24')])]=new Trunk(_0x5d2bbd);}else{_0x14ff6a[_0xb00b('0x3b')](_0x14ff6a[_0xb00b('0x11')][util[_0xb00b('0x23')](_0xb00b('0x21'),_0x5d2bbd[_0xb00b('0x24')])],_0x5d2bbd);}}}return _0x14ff6a[_0xb00b('0x11')];};};Realtime[_0xb00b('0x3c')][_0xb00b('0x41')]=function(){var _0xc0dddd=this;return function(_0x419113){if(_0x419113){freeIsNotKey(_0x419113,_0xc0dddd['voiceQueues'],_0xb00b('0x24'));for(var _0x35a0ba=0x0,_0xd07fb8={},_0x44afa0={};_0x35a0ba<_0x419113[_0xb00b('0x3e')];_0x35a0ba+=0x1){_0xd07fb8=_0x419113[_0x35a0ba];if(_[_0xb00b('0x40')](_0xc0dddd[_0xb00b('0x12')][_0xd07fb8[_0xb00b('0x24')]])){_0xc0dddd[_0xb00b('0x12')][_0xd07fb8[_0xb00b('0x24')]]=new VoiceQueue(_0xd07fb8);}else{_0xc0dddd[_0xb00b('0x3b')](_0xc0dddd[_0xb00b('0x12')][_0xd07fb8['name']],_0xd07fb8);}}}return _0xc0dddd['voiceQueues'];};};Realtime['prototype'][_0xb00b('0x42')]=function(){var _0x23d858=this;return function(_0x481154){if(_0x481154){freeIsNotKey(_0x481154,_0x23d858[_0xb00b('0x43')],'id');for(var _0x3c0fa=0x0,_0x1d3c5d={},_0x32163b={};_0x3c0fa<_0x481154['length'];_0x3c0fa+=0x1){_0x1d3c5d=_0x481154[_0x3c0fa];if(_['isUndefined'](_0x23d858[_0xb00b('0x43')][_0x1d3c5d['id']])){_0x23d858[_0xb00b('0x43')][_0x1d3c5d['id']]=new Trigger(_0x1d3c5d);}else{_0x23d858['mergeFromDatabase'](_0x23d858['triggers'][_0x1d3c5d['id']],_0x1d3c5d);}}}return _0x23d858[_0xb00b('0x43')];};};Realtime[_0xb00b('0x3c')]['initTemplates']=function(){var _0x2228e9=this;return function(_0x47a814){if(_0x47a814){freeIsNotKey(_0x47a814,_0x2228e9['templates'],'id');for(var _0x4bcc9e=0x0,_0x465d90={},_0x481515={};_0x4bcc9e<_0x47a814[_0xb00b('0x3e')];_0x4bcc9e+=0x1){_0x465d90=_0x47a814[_0x4bcc9e];if(_[_0xb00b('0x40')](_0x2228e9[_0xb00b('0x44')][_0x465d90['id']])){_0x2228e9[_0xb00b('0x44')][_0x465d90['id']]=new Template(_0x465d90);}else{_0x2228e9[_0xb00b('0x3b')](_0x2228e9[_0xb00b('0x44')][_0x465d90['id']],_0x465d90);}}}return _0x2228e9['templates'];};};Realtime['prototype'][_0xb00b('0x45')]=function(){var _0x161da9=this;return function(_0x559357){if(_0x559357){freeIsNotKey(_0x559357,_0x161da9[_0xb00b('0x19')],'id');for(var _0xe4cf45=0x0,_0x57f6ab={},_0x15dcbf={};_0xe4cf45<_0x559357[_0xb00b('0x3e')];_0xe4cf45+=0x1){_0x57f6ab=_0x559357[_0xe4cf45];if(_[_0xb00b('0x40')](_0x161da9['zendeskAccounts'][_0x57f6ab['id']])){_0x161da9['zendeskAccounts'][_0x57f6ab['id']]=new ZendeskAccount(_0x57f6ab);}else{_0x161da9[_0xb00b('0x3b')](_0x161da9[_0xb00b('0x19')][_0x57f6ab['id']],_0x57f6ab);}}}return _0x161da9[_0xb00b('0x19')];};};Realtime[_0xb00b('0x3c')]['initSalesforceAccounts']=function(){var _0x380acb=this;return function(_0x3f31e5){if(_0x3f31e5){freeIsNotKey(_0x3f31e5,_0x380acb['salesforceAccounts'],'id');for(var _0x4cd9fd=0x0,_0x160965={},_0x524b05={};_0x4cd9fd<_0x3f31e5[_0xb00b('0x3e')];_0x4cd9fd+=0x1){_0x160965=_0x3f31e5[_0x4cd9fd];if(_[_0xb00b('0x40')](_0x380acb[_0xb00b('0x46')][_0x160965['id']])){_0x380acb[_0xb00b('0x46')][_0x160965['id']]=new SalesforceAccount(_0x160965);}else{_0x380acb[_0xb00b('0x3b')](_0x380acb[_0xb00b('0x46')][_0x160965['id']],_0x160965);}}}return _0x380acb['salesforceAccounts'];};};Realtime[_0xb00b('0x3c')]['initFreshdeskAccounts']=function(){var _0x37d4d2=this;return function(_0x98caa9){if(_0x98caa9){freeIsNotKey(_0x98caa9,_0x37d4d2[_0xb00b('0x1b')],'id');for(var _0x5ac79e=0x0,_0x248335={},_0x25f1f6={};_0x5ac79e<_0x98caa9[_0xb00b('0x3e')];_0x5ac79e+=0x1){_0x248335=_0x98caa9[_0x5ac79e];if(_['isUndefined'](_0x37d4d2[_0xb00b('0x1b')][_0x248335['id']])){_0x37d4d2[_0xb00b('0x1b')][_0x248335['id']]=new FreshdeskAccount(_0x248335);}else{_0x37d4d2[_0xb00b('0x3b')](_0x37d4d2[_0xb00b('0x1b')][_0x248335['id']],_0x248335);}}}return _0x37d4d2[_0xb00b('0x1b')];};};Realtime[_0xb00b('0x3c')][_0xb00b('0x47')]=function(){var _0x3a0b90=this;return function(_0x4c3067){if(_0x4c3067){freeIsNotKey(_0x4c3067,_0x3a0b90[_0xb00b('0x48')],'id');for(var _0x2cbe80=0x0,_0x1b4860={},_0x4a22dd={};_0x2cbe80<_0x4c3067[_0xb00b('0x3e')];_0x2cbe80+=0x1){_0x1b4860=_0x4c3067[_0x2cbe80];if(_[_0xb00b('0x40')](_0x3a0b90[_0xb00b('0x48')][_0x1b4860['id']])){_0x3a0b90[_0xb00b('0x48')][_0x1b4860['id']]=new ZohoAccount(_0x1b4860);}else{_0x3a0b90[_0xb00b('0x3b')](_0x3a0b90['zohoAccounts'][_0x1b4860['id']],_0x1b4860);}}}return _0x3a0b90[_0xb00b('0x48')];};};Realtime[_0xb00b('0x3c')][_0xb00b('0x49')]=function(){var _0x1cad79=this;return function(_0x4b1e5f){if(_0x4b1e5f){freeIsNotKey(_0x4b1e5f,_0x1cad79[_0xb00b('0x1c')],'id');for(var _0x2301b7=0x0,_0x2c93db={},_0x2d73bb={};_0x2301b7<_0x4b1e5f[_0xb00b('0x3e')];_0x2301b7+=0x1){_0x2c93db=_0x4b1e5f[_0x2301b7];if(_[_0xb00b('0x40')](_0x1cad79[_0xb00b('0x1c')][_0x2c93db['id']])){_0x1cad79['deskAccounts'][_0x2c93db['id']]=new DeskAccount(_0x2c93db);}else{_0x1cad79[_0xb00b('0x3b')](_0x1cad79['deskAccounts'][_0x2c93db['id']],_0x2c93db);}}}return _0x1cad79[_0xb00b('0x1c')];};};Realtime['prototype'][_0xb00b('0x4a')]=function(){var _0x530d4a=this;return function(_0xe2d5ca){if(_0xe2d5ca){freeIsNotKey(_0xe2d5ca,_0x530d4a['sugarcrmAccounts'],'id');for(var _0x3dffaf=0x0,_0x2534ed={},_0x3bae02={};_0x3dffaf<_0xe2d5ca['length'];_0x3dffaf+=0x1){_0x2534ed=_0xe2d5ca[_0x3dffaf];if(_['isUndefined'](_0x530d4a['sugarcrmAccounts'][_0x2534ed['id']])){_0x530d4a[_0xb00b('0x1a')][_0x2534ed['id']]=new SugarcrmAccount(_0x2534ed);}else{_0x530d4a[_0xb00b('0x3b')](_0x530d4a[_0xb00b('0x1a')][_0x2534ed['id']],_0x2534ed);}}}return _0x530d4a['sugarcrmAccounts'];};};Realtime[_0xb00b('0x3c')][_0xb00b('0x4b')]=function(){var _0xca87d4=this;return function(_0x2ddba4){if(_0x2ddba4){freeIsNotKey(_0x2ddba4,_0xca87d4[_0xb00b('0x1d')],'id');for(var _0x485033=0x0,_0x32f924={},_0x27b13b={};_0x485033<_0x2ddba4['length'];_0x485033+=0x1){_0x32f924=_0x2ddba4[_0x485033];if(_[_0xb00b('0x40')](_0xca87d4[_0xb00b('0x1d')][_0x32f924['id']])){_0xca87d4[_0xb00b('0x1d')][_0x32f924['id']]=new VtigerAccount(_0x32f924);}else{_0xca87d4['mergeFromDatabase'](_0xca87d4['vtigerAccounts'][_0x32f924['id']],_0x32f924);}}}return _0xca87d4[_0xb00b('0x1d')];};};Realtime[_0xb00b('0x3c')][_0xb00b('0x4c')]=function(){var _0x49f0a2=this;return function(_0x5aac5f){if(_0x5aac5f){freeIsNotKey(_0x5aac5f,_0x49f0a2['servicenowAccounts'],'id');for(var _0x5e9677=0x0,_0xc695f={},_0x4df7fa={};_0x5e9677<_0x5aac5f[_0xb00b('0x3e')];_0x5e9677+=0x1){_0xc695f=_0x5aac5f[_0x5e9677];if(_[_0xb00b('0x40')](_0x49f0a2['servicenowAccounts'][_0xc695f['id']])){_0x49f0a2[_0xb00b('0x4d')][_0xc695f['id']]=new ServicenowAccount(_0xc695f);}else{_0x49f0a2[_0xb00b('0x3b')](_0x49f0a2[_0xb00b('0x4d')][_0xc695f['id']],_0xc695f);}}}return _0x49f0a2[_0xb00b('0x4d')];};};Realtime[_0xb00b('0x3c')]['initDynamics365Accounts']=function(){var _0x222066=this;return function(_0x851800){if(_0x851800){freeIsNotKey(_0x851800,_0x222066[_0xb00b('0x4e')],'id');for(var _0x15dcc3=0x0,_0x8e7e4e={},_0x404fbd={};_0x15dcc3<_0x851800[_0xb00b('0x3e')];_0x15dcc3+=0x1){_0x8e7e4e=_0x851800[_0x15dcc3];if(_['isUndefined'](_0x222066[_0xb00b('0x4e')][_0x8e7e4e['id']])){_0x222066[_0xb00b('0x4e')][_0x8e7e4e['id']]=new Dynamics365Account(_0x8e7e4e);}else{_0x222066[_0xb00b('0x3b')](_0x222066[_0xb00b('0x4e')][_0x8e7e4e['id']],_0x8e7e4e);}}}return _0x222066[_0xb00b('0x4e')];};};Realtime[_0xb00b('0x3c')][_0xb00b('0x4f')]=function(){var _0x266294=this;return function(_0x4d6f3a){if(_0x4d6f3a){freeIsNotKey(_0x4d6f3a,_0x266294[_0xb00b('0x1e')],'id');for(var _0x446e42=0x0,_0x1bf5ad={},_0x3e6a79={};_0x446e42<_0x4d6f3a[_0xb00b('0x3e')];_0x446e42+=0x1){_0x1bf5ad=_0x4d6f3a[_0x446e42];if(_[_0xb00b('0x40')](_0x266294[_0xb00b('0x1e')][_0x1bf5ad['id']])){_0x266294[_0xb00b('0x1e')][_0x1bf5ad['id']]=new FreshsalesAccount(_0x1bf5ad);}else{_0x266294['mergeFromDatabase'](_0x266294[_0xb00b('0x1e')][_0x1bf5ad['id']],_0x1bf5ad);}}}return _0x266294[_0xb00b('0x1e')];};};Realtime[_0xb00b('0x3c')][_0xb00b('0x50')]=function(){var _0x227949=this;return function(_0x376adc){for(var _0x26461a=0x0;_0x26461a<_0x376adc['length'];_0x26461a+=0x1){_[_0xb00b('0x51')](_0x227949[_0xb00b('0x12')][_0x376adc[_0x26461a][_0xb00b('0x24')]],_0x376adc[_0x26461a]);}return _0x227949[_0xb00b('0x12')];};};Realtime[_0xb00b('0x3c')][_0xb00b('0x52')]=function(){var _0x4930f3=this;return function(_0x39bb6c){clearVoiceQueues(_0x4930f3['voiceQueues']);if(_0x39bb6c){_0x39bb6c=_[_0xb00b('0x53')](_0x39bb6c,'uniqueid');for(var _0x1b255d in _0x39bb6c){if(_0x39bb6c[_0xb00b('0x20')](_0x1b255d)){var _0x20e844={};for(var _0x4d1daa=0x0;_0x4d1daa<_0x39bb6c[_0x1b255d]['length'];_0x4d1daa+=0x1){var _0x9ad1c6=_0x39bb6c[_0x1b255d][_0x4d1daa][_0xb00b('0x54')];if(_0x4930f3[_0xb00b('0x12')][_0x9ad1c6]){if(_0x39bb6c[_0x1b255d][_0x4d1daa][_0xb00b('0x55')]){_0x4930f3[_0xb00b('0x12')][_0x9ad1c6][_0xb00b('0x56')]+=0x1;}if(_0x39bb6c[_0x1b255d][_0x4d1daa][_0xb00b('0x57')]){_0x4930f3[_0xb00b('0x12')][_0x9ad1c6][_0xb00b('0x2b')]+=0x1;}_0x4930f3[_0xb00b('0x12')][_0x9ad1c6][_0xb00b('0x2c')]+=moment(_0x39bb6c[_0x1b255d][_0x4d1daa][_0xb00b('0x58')])[_0xb00b('0x59')](moment(_0x39bb6c[_0x1b255d][_0x4d1daa][_0xb00b('0x5a')]),'seconds')||0x0;if(_0x4d1daa===_0x39bb6c[_0x1b255d]['length']-0x1){_0x4930f3[_0xb00b('0x12')][_0x9ad1c6][_0xb00b('0x2d')]+=moment(_0x39bb6c[_0x1b255d][_0x4d1daa]['queuecallercompleteAt']||_0x39bb6c[_0x1b255d][_0x4d1daa]['queuecallerabandonAt']||_0x39bb6c[_0x1b255d][_0x4d1daa][_0xb00b('0x5b')])[_0xb00b('0x59')](moment(_0x39bb6c[_0x1b255d][_0x4d1daa][_0xb00b('0x5a')]),'seconds')||0x0;_0x4930f3[_0xb00b('0x12')][_0x9ad1c6][_0xb00b('0x25')]+=0x1;if(_0x39bb6c[_0x1b255d][_0x4d1daa][_0xb00b('0x5c')]){_0x4930f3[_0xb00b('0x12')][_0x9ad1c6][_0xb00b('0x26')]+=0x1;_0x4930f3[_0xb00b('0x12')][_0x9ad1c6][_0xb00b('0x27')]+=moment(_0x39bb6c[_0x1b255d][_0x4d1daa]['queuecallercompleteAt'])[_0xb00b('0x59')](moment(_0x39bb6c[_0x1b255d][_0x4d1daa]['queuecallerleaveAt']),_0xb00b('0x5d'))||0x0;}}else{_0x4930f3[_0xb00b('0x12')][_0x9ad1c6]['sumDuration']+=_0x4930f3[_0xb00b('0x12')][_0x9ad1c6][_0xb00b('0x2c')]||0x0;}}}}}}return _0x4930f3[_0xb00b('0x12')];};};Realtime[_0xb00b('0x3c')][_0xb00b('0x5e')]=function(){var _0x4434fa=this;return function(_0xc41c1f){clearVoiceCallReports(_0x4434fa[_0xb00b('0x5f')]);if(_0xc41c1f){for(var _0x36ba5c=0x0;_0x36ba5c<_0xc41c1f[_0xb00b('0x3e')];_0x36ba5c+=0x1){_0x4434fa[_0xb00b('0x5f')][_0xb00b('0x25')]+=0x1;_0x4434fa['outbound'][_0xb00b('0x2d')]+=_0xc41c1f[_0x36ba5c][_0xb00b('0x60')];if(_0xc41c1f[_0x36ba5c][_0xb00b('0x61')]===_0xb00b('0x62')){_0x4434fa['outbound'][_0xb00b('0x26')]+=0x1;_0x4434fa[_0xb00b('0x5f')][_0xb00b('0x2c')]+=_0xc41c1f[_0x36ba5c][_0xb00b('0x60')]-_0xc41c1f[_0x36ba5c][_0xb00b('0x63')]||0x0;_0x4434fa['outbound'][_0xb00b('0x27')]+=_0xc41c1f[_0x36ba5c][_0xb00b('0x63')];}}}return _0x4434fa[_0xb00b('0x5f')];};};Realtime[_0xb00b('0x3c')]['initCampaigns']=function(){var _0x34dcb0=this;return function(_0x584f4b){if(_0x584f4b){freeIsNotKey(_0x584f4b,_0x34dcb0[_0xb00b('0x13')],_0xb00b('0x24'));for(var _0x69b4e0=0x0,_0x165442={};_0x69b4e0<_0x584f4b[_0xb00b('0x3e')];_0x69b4e0+=0x1){_0x165442=_0x584f4b[_0x69b4e0];if(_[_0xb00b('0x40')](_0x34dcb0[_0xb00b('0x13')][_0x165442[_0xb00b('0x24')]])){_0x34dcb0[_0xb00b('0x13')][_0x165442[_0xb00b('0x24')]]=new Campaign(_0x165442);}else{_0x34dcb0[_0xb00b('0x3b')](_0x34dcb0['campaigns'][_0x165442[_0xb00b('0x24')]],_0x165442);_0x34dcb0[_0xb00b('0x13')][_0x165442[_0xb00b('0x24')]][_0xb00b('0x64')]=_0x165442['SquareProject']?_0x165442[_0xb00b('0x65')][_0xb00b('0x24')]:undefined;}}}return _0x34dcb0['campaigns'];};};Realtime[_0xb00b('0x3c')]['initVoiceExtensions']=function(){var _0x3caf51=this;return function(_0x43377c){if(_0x43377c){freeIsNotKey(_0x43377c,_0x3caf51[_0xb00b('0x66')],'id');for(var _0x51fdf7=0x0,_0x2c4cdf={};_0x51fdf7<_0x43377c[_0xb00b('0x3e')];_0x51fdf7+=0x1){_0x2c4cdf=_0x43377c[_0x51fdf7];if(_[_0xb00b('0x40')](_0x3caf51[_0xb00b('0x66')][_0x2c4cdf['id']])){_0x3caf51[_0xb00b('0x66')][_0x2c4cdf['id']]=new VoiceExtension(_0x2c4cdf);}else{_0x3caf51[_0xb00b('0x3b')](_0x3caf51[_0xb00b('0x66')][_0x2c4cdf['id']],_0x2c4cdf);}}}return _0x3caf51[_0xb00b('0x66')];};};Realtime[_0xb00b('0x3c')]['initCampaignHopperHistory']=function(){var _0x5914c9=this;return function(_0x466ddb){clearCampaigns(_0x5914c9[_0xb00b('0x13')]);for(var _0x2c4488=0x0;_0x2c4488<_0x466ddb[_0xb00b('0x3e')];_0x2c4488+=0x1){_['merge'](_0x5914c9[_0xb00b('0x13')][_0x466ddb[_0x2c4488][_0xb00b('0x24')]],_0x466ddb[_0x2c4488]);}return _0x5914c9['campaigns'];};};Realtime[_0xb00b('0x3c')][_0xb00b('0x67')]=function(){var _0x2762fb=this;return function(_0x54244b){if(_0x54244b){freeIsNotKey(_0x54244b,_0x2762fb[_0xb00b('0x68')],'id');for(var _0x1dd043=0x0,_0x51d9de={},_0x2b7fa9={};_0x1dd043<_0x54244b[_0xb00b('0x3e')];_0x1dd043+=0x1){_0x51d9de=_0x54244b[_0x1dd043];if(_[_0xb00b('0x40')](_0x2762fb[_0xb00b('0x68')][_0x51d9de['id']])){_0x2762fb[_0xb00b('0x68')][_0x51d9de['id']]=new FaxAccount(_0x51d9de);}else{_0x2762fb[_0xb00b('0x3b')](_0x2762fb[_0xb00b('0x68')][_0x51d9de['id']],_0x51d9de);}}}return _0x2762fb[_0xb00b('0x68')];};};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 631c8cb..4659158 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 _0x4828=['custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','accountcode','isNil','name','format','connectedlinenum','assigned','interface','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','voiceCallReport','destination','exten','type','dialer','lastapplication','lastdata','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','channel','destinationchannel','ANSWERED','\x22%s\x22\x20<%s>','calleridnum','transfers','linkedid','transfereelinkedid','monitor','monitors','length','monitorFilename','filename','createdAt','calleridname','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','substring','indexOf','mobile','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceAgentReport'];(function(_0x20e134,_0x3bbb29){var _0x1e2dbd=function(_0x588c17){while(--_0x588c17){_0x20e134['push'](_0x20e134['shift']());}};_0x1e2dbd(++_0x3bbb29);}(_0x4828,0x96));var _0x8482=function(_0x13f0d4,_0x9b158){_0x13f0d4=_0x13f0d4-0x0;var _0x20e23a=_0x4828[_0x13f0d4];return _0x20e23a;};'use strict';var _=require(_0x8482('0x0'));var moment=require(_0x8482('0x1'));var util=require(_0x8482('0x2'));var config=require(_0x8482('0x3'));var ami=require(_0x8482('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x8482('0x5'));var RpcVoiceDialReport=require(_0x8482('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x8482('0x7'));var RpcVoiceRecording=require(_0x8482('0x8'));var RpcVoiceTransferReport=require(_0x8482('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x8482('0xa'));var VoiceAgentReport=require(_0x8482('0xb'));var VoiceDialReport=require(_0x8482('0xc'));var UserReport=require(_0x8482('0xd'));function Report(_0xd6755f){this['realtime']=_0xd6755f;this[_0x8482('0xe')]=_0xd6755f['agents'];this[_0x8482('0xf')]=_0xd6755f[_0x8482('0xf')];}Report[_0x8482('0x10')][_0x8482('0x11')]=function(_0x5a3f01){var _0x1b0f62=new VoiceQueueReport(this[_0x8482('0x12')]);var _0x32f969=new VoiceAgentReport(this[_0x8482('0x12')]);var _0x30e1c5=new VoiceDialReport(this['realtime']);var _0x272aa5=new VoiceCallReport(this[_0x8482('0x12')]);var _0x218535=new UserReport(this[_0x8482('0x12')]);if(config[_0x8482('0x13')]&&config[_0x8482('0x13')][_0x8482('0x14')]){ami['on'](_0x8482('0x15'),this[_0x8482('0x16')][_0x8482('0x17')](this));ami['on'](_0x8482('0x18'),this['voiceCallReport'][_0x8482('0x17')](this));ami['on']('custom:voiceAgentReport',this[_0x8482('0x19')]['bind'](this));ami['on'](_0x8482('0x1a'),this[_0x8482('0x1b')][_0x8482('0x17')](this));ami['on'](_0x8482('0x1c'),this[_0x8482('0x1d')][_0x8482('0x17')](this));ami['on']('attendedtransfer',this[_0x8482('0x1e')][_0x8482('0x17')](this));}};Report[_0x8482('0x10')][_0x8482('0x1f')]=function(_0x43db14){var _0x2666f9;_0x2666f9=_['find'](this['agents'],function(_0xed7dd3){return _0xed7dd3[_0x8482('0x20')]==_0x43db14||_0xed7dd3['name']==_0x43db14;});if(_[_0x8482('0x21')](_0x2666f9)){var _0x1197d1=_['find'](this[_0x8482('0xf')],function(_0x180ba2){return _0x180ba2[_0x8482('0x20')]==_0x43db14||_0x180ba2[_0x8482('0x22')]==_0x43db14;});if(_0x1197d1){_0x2666f9=_['find'](this[_0x8482('0xe')],function(_0x50269e){return _0x50269e['interface']==util[_0x8482('0x23')]('SIP/%s',_0x1197d1[_0x8482('0x22')]);});}}return _0x2666f9;};Report[_0x8482('0x10')]['voiceQueueReport']=function(_0x91c47e){for(var _0x116a71=0x0;_0x116a71<_0x91c47e['length'];_0x116a71+=0x1){var _0x50d584=this[_0x8482('0x1f')](_0x91c47e[_0x116a71][_0x8482('0x24')]);if(_0x50d584){_0x91c47e[_0x116a71][_0x8482('0x20')]=_0x50d584['accountcode'];_0x91c47e[_0x116a71][_0x8482('0x25')]=!![];_0x91c47e[_0x116a71]['lastAssignedTo']=_0x50d584[_0x8482('0x22')];_0x91c47e[_0x116a71][_0x8482('0x26')]=_[_0x8482('0x21')](_0x50d584[_0x8482('0x26')])?util[_0x8482('0x23')](_0x8482('0x27'),_0x50d584[_0x8482('0x22')]):_0x50d584[_0x8482('0x26')];if(_0x91c47e[_0x116a71][_0x8482('0x28')]){_0x91c47e[_0x116a71][_0x8482('0x29')]=moment()['format'](_0x8482('0x2a'));}if(_0x91c47e[_0x116a71][_0x8482('0x2b')]){_0x91c47e[_0x116a71]['queuecallerexitAt']=moment()['format'](_0x8482('0x2a'));}RpcMemberReport['voiceQueueReport'](_0x91c47e[_0x116a71]);}RpcVoiceQueueReport[_0x8482('0x2c')](_0x91c47e[_0x116a71]);}};function extractCalleridNumber(_0x1bf825){var _0x395759=_0x1bf825[_0x8482('0x2d')](/<(.*?)>/);return _0x395759?_0x395759[0x1]:_0x1bf825;}Report[_0x8482('0x10')][_0x8482('0x2e')]=function(_0x920ac2){_0x920ac2[_0x8482('0x2f')]=_0x920ac2['destination']||_0x920ac2[_0x8482('0x30')];if(_0x920ac2[_0x8482('0x31')]==_0x8482('0x32')){_0x920ac2[_0x8482('0x33')]='queue';_0x920ac2[_0x8482('0x34')]=_0x920ac2[_0x8482('0x35')];if(_0x920ac2[_0x8482('0x36')]==_0x8482('0x37')){_0x920ac2[_0x8482('0x20')]='';_0x920ac2['destination']=extractCalleridNumber(_0x920ac2[_0x8482('0x38')]);}else if(_0x920ac2['context']==_0x8482('0x39')){if(_0x920ac2['destination']==_0x8482('0x3a')){_0x920ac2[_0x8482('0x2f')]=extractCalleridNumber(_0x920ac2[_0x8482('0x3b')]);_0x920ac2['calleridnum']=_0x920ac2[_0x8482('0x3c')];_0x920ac2['destinationchannel']=[_0x920ac2[_0x8482('0x3d')],_0x920ac2[_0x8482('0x3d')]=_0x920ac2[_0x8482('0x3e')]][0x0];_0x920ac2[_0x8482('0x38')]=_0x920ac2['calleridpreview'];}else{_0x920ac2[_0x8482('0x2f')]=_0x920ac2['calleridnum'];_0x920ac2['calleridnum']=_0x920ac2[_0x8482('0x3c')];if(_0x920ac2['disposition']==_0x8482('0x3f')){_0x920ac2['accountcode']=_0x920ac2[_0x8482('0x24')];}else{_0x920ac2['accountcode']='';}}}}else{_0x920ac2[_0x8482('0x38')]=util[_0x8482('0x23')](_0x8482('0x40'),_0x920ac2['calleridname'],_0x920ac2[_0x8482('0x41')]);}if(RpcVoiceTransferReport[_0x8482('0x42')][_0x920ac2[_0x8482('0x43')]]){var _0x2cb81d=RpcVoiceTransferReport[_0x8482('0x42')][_0x920ac2[_0x8482('0x43')]];_0x2cb81d[_0x8482('0x44')]=_0x920ac2['uniqueid'];RpcVoiceTransferReport[_0x8482('0x1d')](_0x2cb81d);delete RpcVoiceTransferReport['transfers'][_0x920ac2[_0x8482('0x43')]];}RpcVoiceCallReport[_0x8482('0x2c')](_0x920ac2);if(_0x920ac2[_0x8482('0x45')]){for(var _0x2f60f1=0x0;_0x2f60f1<_0x920ac2[_0x8482('0x46')][_0x8482('0x47')];_0x2f60f1+=0x1){_0x920ac2[_0x8482('0x48')]=_0x920ac2[_0x8482('0x46')][_0x2f60f1][_0x8482('0x49')];_0x920ac2[_0x8482('0x4a')]=_0x920ac2['monitors'][_0x2f60f1]['createdAt'];if(_0x920ac2[_0x8482('0x30')]==_0x8482('0x3a')){_0x920ac2[_0x8482('0x41')]=_0x920ac2[_0x8482('0x24')];_0x920ac2[_0x8482('0x4b')]=_0x920ac2[_0x8482('0x4c')];_0x920ac2[_0x8482('0x24')]=_0x920ac2[_0x8482('0x20')];_0x920ac2[_0x8482('0x4c')]=_0x920ac2[_0x8482('0x4d')];_0x920ac2[_0x8482('0x30')]=_0x920ac2[_0x8482('0x3c')];}else if(_0x920ac2[_0x8482('0x30')]==_0x8482('0x4e')){_0x920ac2['calleridnum']=_0x920ac2[_0x8482('0x2f')];_0x920ac2['exten']=_0x920ac2[_0x8482('0x3c')];}RpcVoiceRecording[_0x8482('0x2c')](_0x920ac2);}}};Report['prototype']['voiceAgentReport']=function(_0x589ec8){if(_[_0x8482('0x4f')](_0x589ec8)){_0x589ec8[_0x8482('0x50')](function(_0x38c1ab){RpcVoiceAgentReport[_0x8482('0x2c')](_0x38c1ab);});}else{RpcVoiceAgentReport[_0x8482('0x2c')](_0x589ec8);}};Report[_0x8482('0x10')][_0x8482('0x1b')]=function(_0x534830){RpcVoiceDialReport[_0x8482('0x2c')](_0x534830);var _0x5e30ef;var _0x315bf5;var _0x5ed2e2=_0x534830[_0x8482('0x3d')];if(_[_0x8482('0x51')](_0x5ed2e2,'Local')){_0x315bf5=_0x5ed2e2[_0x8482('0x52')](_0x5ed2e2['indexOf']('/')+0x1,_0x5ed2e2[_0x8482('0x53')]('@'));_0x5e30ef=_['find'](this[_0x8482('0xe')],function(_0x4ba3af){return _0x4ba3af[_0x8482('0x54')]==_0x315bf5||_0x4ba3af['phone']==_0x315bf5||_0x4ba3af[_0x8482('0x20')]==_0x315bf5;});}else{_0x315bf5=_0x5ed2e2[_0x8482('0x52')](_0x5ed2e2[_0x8482('0x53')]('/')+0x1,_0x5ed2e2[_0x8482('0x55')]('-'));_0x5e30ef=this[_0x8482('0x1f')](_0x315bf5);}if(_0x5e30ef){_0x534830[_0x8482('0x26')]=_[_0x8482('0x21')](_0x5e30ef['interface'])?util[_0x8482('0x23')]('SIP/%s',_0x5e30ef[_0x8482('0x22')]):_0x5e30ef[_0x8482('0x26')];_0x534830[_0x8482('0x4d')]=_0x5e30ef['name'];_0x534830['accountcode']=_0x5e30ef[_0x8482('0x20')];RpcMemberReport[_0x8482('0x1b')](_0x534830);}};Report[_0x8482('0x10')][_0x8482('0x1d')]=function(_0x192d74){RpcVoiceTransferReport[_0x8482('0x42')][_0x192d74[_0x8482('0x56')]]=_0x192d74;};Report[_0x8482('0x10')]['attendedTransfer']=function(_0x7c0a3e){RpcVoiceTransferReport[_0x8482('0x1e')](_0x7c0a3e);};module[_0x8482('0x57')]=Report; \ No newline at end of file +var _0xba26=['exten','dialer','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridnum','channel','destinationchannel','calleridpreview','originatecalleridnum','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitors','monitorFilename','createdAt','connectedlinename','membername','voiceAgentReport','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','voiceQueueReport','bind','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','isNil','name','length','connectedlinenum','assigned','lastAssignedTo','interface','format','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','voiceCallReport','destination'];(function(_0x188028,_0xb434f8){var _0x8fa1a5=function(_0x1488d2){while(--_0x1488d2){_0x188028['push'](_0x188028['shift']());}};_0x8fa1a5(++_0xb434f8);}(_0xba26,0xcf));var _0x6ba2=function(_0x5c8c8b,_0x21631c){_0x5c8c8b=_0x5c8c8b-0x0;var _0x3cc99c=_0xba26[_0x5c8c8b];return _0x3cc99c;};'use strict';var _=require(_0x6ba2('0x0'));var moment=require('moment');var util=require(_0x6ba2('0x1'));var config=require(_0x6ba2('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x6ba2('0x3'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x6ba2('0x4'));var RpcMemberReport=require(_0x6ba2('0x5'));var RpcVoiceQueueReport=require(_0x6ba2('0x6'));var RpcVoiceRecording=require(_0x6ba2('0x7'));var RpcVoiceTransferReport=require(_0x6ba2('0x8'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x6ba2('0x9'));var VoiceAgentReport=require(_0x6ba2('0xa'));var VoiceDialReport=require(_0x6ba2('0xb'));var UserReport=require('./userReport');function Report(_0x2a957a){this[_0x6ba2('0xc')]=_0x2a957a;this['agents']=_0x2a957a[_0x6ba2('0xd')];this['telephones']=_0x2a957a[_0x6ba2('0xe')];}Report[_0x6ba2('0xf')][_0x6ba2('0x10')]=function(_0x4cf026){var _0x3633c9=new VoiceQueueReport(this['realtime']);var _0x2129a8=new VoiceAgentReport(this['realtime']);var _0x36b631=new VoiceDialReport(this[_0x6ba2('0xc')]);var _0x23efdb=new VoiceCallReport(this[_0x6ba2('0xc')]);var _0x304488=new UserReport(this['realtime']);if(config[_0x6ba2('0x11')]&&config[_0x6ba2('0x11')]['disabled']){ami['on']('custom:voiceQueueReport',this[_0x6ba2('0x12')][_0x6ba2('0x13')](this));ami['on']('custom:voiceCallReport',this['voiceCallReport'][_0x6ba2('0x13')](this));ami['on'](_0x6ba2('0x14'),this['voiceAgentReport'][_0x6ba2('0x13')](this));ami['on'](_0x6ba2('0x15'),this[_0x6ba2('0x16')][_0x6ba2('0x13')](this));ami['on'](_0x6ba2('0x17'),this[_0x6ba2('0x18')]['bind'](this));ami['on'](_0x6ba2('0x19'),this[_0x6ba2('0x1a')][_0x6ba2('0x13')](this));}};Report['prototype'][_0x6ba2('0x1b')]=function(_0x15ad55){var _0x10ebf2;_0x10ebf2=_[_0x6ba2('0x1c')](this[_0x6ba2('0xd')],function(_0x32e484){return _0x32e484[_0x6ba2('0x1d')]==_0x15ad55||_0x32e484['name']==_0x15ad55;});if(_[_0x6ba2('0x1e')](_0x10ebf2)){var _0xc2b8fd=_[_0x6ba2('0x1c')](this['telephones'],function(_0x1db0e9){return _0x1db0e9[_0x6ba2('0x1d')]==_0x15ad55||_0x1db0e9[_0x6ba2('0x1f')]==_0x15ad55;});if(_0xc2b8fd){_0x10ebf2=_[_0x6ba2('0x1c')](this[_0x6ba2('0xd')],function(_0x15837c){return _0x15837c['interface']==util['format']('SIP/%s',_0xc2b8fd[_0x6ba2('0x1f')]);});}}return _0x10ebf2;};Report[_0x6ba2('0xf')]['voiceQueueReport']=function(_0x25b66c){for(var _0x5927ef=0x0;_0x5927ef<_0x25b66c[_0x6ba2('0x20')];_0x5927ef+=0x1){var _0x429714=this[_0x6ba2('0x1b')](_0x25b66c[_0x5927ef][_0x6ba2('0x21')]);if(_0x429714){_0x25b66c[_0x5927ef]['accountcode']=_0x429714[_0x6ba2('0x1d')];_0x25b66c[_0x5927ef][_0x6ba2('0x22')]=!![];_0x25b66c[_0x5927ef][_0x6ba2('0x23')]=_0x429714[_0x6ba2('0x1f')];_0x25b66c[_0x5927ef]['interface']=_[_0x6ba2('0x1e')](_0x429714[_0x6ba2('0x24')])?util[_0x6ba2('0x25')](_0x6ba2('0x26'),_0x429714[_0x6ba2('0x1f')]):_0x429714[_0x6ba2('0x24')];if(_0x25b66c[_0x5927ef][_0x6ba2('0x27')]){_0x25b66c[_0x5927ef][_0x6ba2('0x28')]=moment()[_0x6ba2('0x25')](_0x6ba2('0x29'));}if(_0x25b66c[_0x5927ef][_0x6ba2('0x2a')]){_0x25b66c[_0x5927ef][_0x6ba2('0x2b')]=moment()[_0x6ba2('0x25')](_0x6ba2('0x29'));}RpcMemberReport[_0x6ba2('0x12')](_0x25b66c[_0x5927ef]);}RpcVoiceQueueReport[_0x6ba2('0x2c')](_0x25b66c[_0x5927ef]);}};function extractCalleridNumber(_0x22a325){var _0x5abca1=_0x22a325[_0x6ba2('0x2d')](/<(.*?)>/);return _0x5abca1?_0x5abca1[0x1]:_0x22a325;}Report[_0x6ba2('0xf')][_0x6ba2('0x2e')]=function(_0x1a98d1){_0x1a98d1[_0x6ba2('0x2f')]=_0x1a98d1[_0x6ba2('0x2f')]||_0x1a98d1[_0x6ba2('0x30')];if(_0x1a98d1['type']==_0x6ba2('0x31')){_0x1a98d1['lastapplication']='queue';_0x1a98d1[_0x6ba2('0x32')]=_0x1a98d1['queue'];if(_0x1a98d1[_0x6ba2('0x33')]==_0x6ba2('0x34')){_0x1a98d1[_0x6ba2('0x1d')]='';_0x1a98d1[_0x6ba2('0x2f')]=extractCalleridNumber(_0x1a98d1[_0x6ba2('0x35')]);}else if(_0x1a98d1[_0x6ba2('0x33')]==_0x6ba2('0x36')){if(_0x1a98d1['destination']==_0x6ba2('0x37')){_0x1a98d1['destination']=extractCalleridNumber(_0x1a98d1['calleridpreview']);_0x1a98d1[_0x6ba2('0x38')]=_0x1a98d1['originatecalleridnum'];_0x1a98d1['destinationchannel']=[_0x1a98d1['channel'],_0x1a98d1[_0x6ba2('0x39')]=_0x1a98d1[_0x6ba2('0x3a')]][0x0];_0x1a98d1[_0x6ba2('0x35')]=_0x1a98d1[_0x6ba2('0x3b')];}else{_0x1a98d1[_0x6ba2('0x2f')]=_0x1a98d1[_0x6ba2('0x38')];_0x1a98d1[_0x6ba2('0x38')]=_0x1a98d1[_0x6ba2('0x3c')];if(_0x1a98d1['disposition']==_0x6ba2('0x3d')){_0x1a98d1[_0x6ba2('0x1d')]=_0x1a98d1[_0x6ba2('0x21')];}else{_0x1a98d1[_0x6ba2('0x1d')]='';}}}}else{_0x1a98d1[_0x6ba2('0x35')]=util['format'](_0x6ba2('0x3e'),_0x1a98d1[_0x6ba2('0x3f')],_0x1a98d1[_0x6ba2('0x38')]);}if(RpcVoiceTransferReport[_0x6ba2('0x40')][_0x1a98d1[_0x6ba2('0x41')]]){var _0x6c7e41=RpcVoiceTransferReport[_0x6ba2('0x40')][_0x1a98d1[_0x6ba2('0x41')]];_0x6c7e41[_0x6ba2('0x42')]=_0x1a98d1[_0x6ba2('0x43')];RpcVoiceTransferReport[_0x6ba2('0x18')](_0x6c7e41);delete RpcVoiceTransferReport['transfers'][_0x1a98d1['linkedid']];}RpcVoiceCallReport[_0x6ba2('0x2c')](_0x1a98d1);if(_0x1a98d1[_0x6ba2('0x44')]){for(var _0x5b3478=0x0;_0x5b3478<_0x1a98d1[_0x6ba2('0x45')][_0x6ba2('0x20')];_0x5b3478+=0x1){_0x1a98d1[_0x6ba2('0x46')]=_0x1a98d1[_0x6ba2('0x45')][_0x5b3478]['filename'];_0x1a98d1[_0x6ba2('0x47')]=_0x1a98d1[_0x6ba2('0x45')][_0x5b3478][_0x6ba2('0x47')];if(_0x1a98d1['exten']=='xcally-motion-preview'){_0x1a98d1[_0x6ba2('0x38')]=_0x1a98d1[_0x6ba2('0x21')];_0x1a98d1[_0x6ba2('0x3f')]=_0x1a98d1[_0x6ba2('0x48')];_0x1a98d1[_0x6ba2('0x21')]=_0x1a98d1[_0x6ba2('0x1d')];_0x1a98d1[_0x6ba2('0x48')]=_0x1a98d1[_0x6ba2('0x49')];_0x1a98d1[_0x6ba2('0x30')]=_0x1a98d1[_0x6ba2('0x3c')];}else if(_0x1a98d1[_0x6ba2('0x30')]=='xcally-motion-dialer'){_0x1a98d1[_0x6ba2('0x38')]=_0x1a98d1[_0x6ba2('0x2f')];_0x1a98d1[_0x6ba2('0x30')]=_0x1a98d1[_0x6ba2('0x3c')];}RpcVoiceRecording[_0x6ba2('0x2c')](_0x1a98d1);}}};Report[_0x6ba2('0xf')][_0x6ba2('0x4a')]=function(_0x5856f6){if(_['isArray'](_0x5856f6)){_0x5856f6[_0x6ba2('0x4b')](function(_0x43cb93){RpcVoiceAgentReport[_0x6ba2('0x2c')](_0x43cb93);});}else{RpcVoiceAgentReport[_0x6ba2('0x2c')](_0x5856f6);}};Report[_0x6ba2('0xf')][_0x6ba2('0x16')]=function(_0x5f87b7){RpcVoiceDialReport['create'](_0x5f87b7);var _0x404504;var _0x5b2e84;var _0x1c7b07=_0x5f87b7[_0x6ba2('0x39')];if(_[_0x6ba2('0x4c')](_0x1c7b07,_0x6ba2('0x4d'))){_0x5b2e84=_0x1c7b07[_0x6ba2('0x4e')](_0x1c7b07[_0x6ba2('0x4f')]('/')+0x1,_0x1c7b07[_0x6ba2('0x4f')]('@'));_0x404504=_[_0x6ba2('0x1c')](this['agents'],function(_0x30b74d){return _0x30b74d[_0x6ba2('0x50')]==_0x5b2e84||_0x30b74d[_0x6ba2('0x51')]==_0x5b2e84||_0x30b74d[_0x6ba2('0x1d')]==_0x5b2e84;});}else{_0x5b2e84=_0x1c7b07[_0x6ba2('0x4e')](_0x1c7b07['indexOf']('/')+0x1,_0x1c7b07[_0x6ba2('0x52')]('-'));_0x404504=this[_0x6ba2('0x1b')](_0x5b2e84);}if(_0x404504){_0x5f87b7[_0x6ba2('0x24')]=_[_0x6ba2('0x1e')](_0x404504[_0x6ba2('0x24')])?util[_0x6ba2('0x25')](_0x6ba2('0x26'),_0x404504[_0x6ba2('0x1f')]):_0x404504[_0x6ba2('0x24')];_0x5f87b7['membername']=_0x404504['name'];_0x5f87b7[_0x6ba2('0x1d')]=_0x404504['accountcode'];RpcMemberReport[_0x6ba2('0x16')](_0x5f87b7);}};Report[_0x6ba2('0xf')][_0x6ba2('0x18')]=function(_0x231c41){RpcVoiceTransferReport[_0x6ba2('0x40')][_0x231c41[_0x6ba2('0x53')]]=_0x231c41;};Report[_0x6ba2('0xf')]['attendedTransfer']=function(_0x448e29){RpcVoiceTransferReport[_0x6ba2('0x1a')](_0x448e29);};module[_0x6ba2('0x54')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index c87699b..4811405 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 _0x1c45=['actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','prototype','isUndefined','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','trunk:save','device','local','inuse','toLowerCase','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','name','substring','indexOf','phone','accountcode','[userReport][devicestatechange]','[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','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','inspect'];(function(_0x270a54,_0x307ff6){var _0x4d07d0=function(_0x59ac5a){while(--_0x59ac5a){_0x270a54['push'](_0x270a54['shift']());}};_0x4d07d0(++_0x307ff6);}(_0x1c45,0x1b0));var _0x51c4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1c45[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x51c4('0x0'));var moment=require(_0x51c4('0x1'));var util=require(_0x51c4('0x2'));var Redis=require(_0x51c4('0x3'));var BPromise=require(_0x51c4('0x4'));var config=require(_0x51c4('0x5'));var logger=require(_0x51c4('0x6'))(_0x51c4('0x7'));var ami=require('../ami');config['redis']=_[_0x51c4('0x8')](config[_0x51c4('0x9')],{'host':_0x51c4('0xa'),'port':0x18eb});var io=require(_0x51c4('0xb'))(new Redis(config[_0x51c4('0x9')]));function UserReport(_0x14650b){this[_0x51c4('0xc')]=_0x14650b[_0x51c4('0xc')];this[_0x51c4('0xd')]=_0x14650b['agents'];this['telephones']=_0x14650b[_0x51c4('0xe')];ami['on'](_0x51c4('0xf'),this[_0x51c4('0x10')][_0x51c4('0x11')](this));ami['on'](_0x51c4('0x12'),this[_0x51c4('0x10')]['bind'](this));ami['on'](_0x51c4('0x13'),this[_0x51c4('0x14')][_0x51c4('0x11')](this));ami['on'](_0x51c4('0x15'),this[_0x51c4('0x16')][_0x51c4('0x11')](this));return this[_0x51c4('0x17')]();}function showSipRegistrations(){Promise[_0x51c4('0x18')]()[_0x51c4('0x19')](ami[_0x51c4('0x1a')]())[_0x51c4('0x1b')](function(_0x45d015){logger[_0x51c4('0x1c')]('[userReport][sipshowregistry]',util[_0x51c4('0x1d')](_0x45d015,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x51c4('0x18')]()['then'](ami[_0x51c4('0x1e')]())[_0x51c4('0x1b')](function(_0x317b8d){logger[_0x51c4('0x1c')](_0x51c4('0x1f'),util[_0x51c4('0x1d')](_0x317b8d,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x51c4('0x18')]()['then'](ami[_0x51c4('0x20')]())[_0x51c4('0x1b')](function(_0x5e0e8d){logger[_0x51c4('0x1c')]('[userReport][sippeerstatus]',util[_0x51c4('0x1d')](_0x5e0e8d,{'showHidden':![],'depth':null}));});}UserReport[_0x51c4('0x21')][_0x51c4('0x17')]=function(){setInterval(function(){BPromise[_0x51c4('0x18')]()['then'](showSipRegistrations())[_0x51c4('0x19')](listDeviceStates())[_0x51c4('0x19')](showPeersStatus());},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x2047c8){return _0x2047c8!==null&&!_[_0x51c4('0x22')](_0x2047c8);};UserReport[_0x51c4('0x21')][_0x51c4('0x23')]=function(_0x394822,_0x3a80db,_0x590c9a){io['to'](_0x394822)[_0x51c4('0x23')](_0x3a80db,_0x590c9a);};UserReport[_0x51c4('0x21')][_0x51c4('0x10')]=function(_0x3b56d1){try{if(this[_0x51c4('0x24')](_0x3b56d1)){logger[_0x51c4('0x25')](_0x51c4('0x26'),_0x3b56d1[_0x51c4('0x27')],_0x3b56d1[_0x51c4('0x28')]);logger[_0x51c4('0x29')](_0x51c4('0x2a'),util['inspect'](_0x3b56d1,{'showHidden':![],'depth':null}));var _0x367065=_[_0x51c4('0x2b')](this[_0x51c4('0xc')],{'registry':_0x3b56d1[_0x51c4('0x27')]});if(_0x367065){_0x3b56d1[_0x51c4('0x2c')]=_0x3b56d1[_0x51c4('0x28')];_[_0x51c4('0x2d')](_0x367065,_[_0x51c4('0x2e')](_0x3b56d1,[_0x51c4('0x2f'),_0x51c4('0x30'),_0x51c4('0x27'),_0x51c4('0x28')]));logger[_0x51c4('0x29')](_0x51c4('0x31'),util[_0x51c4('0x1d')](_0x367065,{'showHidden':![],'depth':null}));this['emit'](util[_0x51c4('0x32')](_0x51c4('0x33'),_0x367065['name']),_0x51c4('0x34'),_0x367065);}}}catch(_0x2974a3){logger[_0x51c4('0x1c')](_0x51c4('0x2a'),util[_0x51c4('0x1d')](_0x2974a3,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x51c4('0x14')]=function(_0xdebc00){try{if(this[_0x51c4('0x24')](_0xdebc00)){logger[_0x51c4('0x25')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0xdebc00['device'],_0xdebc00[_0x51c4('0x28')]);logger[_0x51c4('0x29')]('[userReport][devicestatechange]',util[_0x51c4('0x1d')](_0xdebc00,{'showHidden':![],'depth':null}));if(this[_0x51c4('0xd')][_0xdebc00['device']]){if(!this['agents'][_0xdebc00[_0x51c4('0x35')]][_0x51c4('0x36')]||_0xdebc00[_0x51c4('0x28')]['toLowerCase']()==_0x51c4('0x37')){this[_0x51c4('0xd')][_0xdebc00[_0x51c4('0x35')]][_0x51c4('0x36')]=![];if(this['agents'][_0xdebc00[_0x51c4('0x35')]][_0x51c4('0x28')]!==_0xdebc00['state'][_0x51c4('0x38')]()){this['agents'][_0xdebc00[_0x51c4('0x35')]][_0x51c4('0x39')]=_[_0x51c4('0x3a')](moment()[_0x51c4('0x32')]('x'));}this[_0x51c4('0xd')][_0xdebc00['device']][_0x51c4('0x28')]=_0xdebc00['state'][_0x51c4('0x38')]();this[_0x51c4('0xd')][_0xdebc00[_0x51c4('0x35')]][_0x51c4('0x3b')](_0xdebc00);}}else if(this[_0x51c4('0xe')][_0xdebc00[_0x51c4('0x35')]]){if(this[_0x51c4('0xe')][_0xdebc00[_0x51c4('0x35')]][_0x51c4('0x28')]!==_0xdebc00[_0x51c4('0x28')][_0x51c4('0x38')]()){this[_0x51c4('0xe')][_0xdebc00[_0x51c4('0x35')]][_0x51c4('0x39')]=_['toNumber'](moment()[_0x51c4('0x32')]('x'));}this[_0x51c4('0xe')][_0xdebc00[_0x51c4('0x35')]][_0x51c4('0x28')]=_0xdebc00[_0x51c4('0x28')][_0x51c4('0x38')]();logger[_0x51c4('0x29')](_0x51c4('0x3c'),util[_0x51c4('0x1d')](this[_0x51c4('0xe')][_0xdebc00['device']],{'showHidden':![],'depth':null}));this[_0x51c4('0x23')](util[_0x51c4('0x32')](_0x51c4('0x3d'),this[_0x51c4('0xe')][_0xdebc00[_0x51c4('0x35')]][_0x51c4('0x3e')]),'telephone:save',this[_0x51c4('0xe')][_0xdebc00[_0x51c4('0x35')]]);}else if(this[_0x51c4('0xc')][_0xdebc00[_0x51c4('0x35')]]){if(this[_0x51c4('0xc')][_0xdebc00[_0x51c4('0x35')]][_0x51c4('0x28')]!==_0xdebc00[_0x51c4('0x28')][_0x51c4('0x38')]()){this[_0x51c4('0xc')][_0xdebc00['device']][_0x51c4('0x39')]=_['toNumber'](moment()[_0x51c4('0x32')]('x'));}this[_0x51c4('0xc')][_0xdebc00[_0x51c4('0x35')]]['state']=_0xdebc00[_0x51c4('0x28')]['toLowerCase']();logger[_0x51c4('0x29')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x51c4('0x1d')](this[_0x51c4('0xc')][_0xdebc00[_0x51c4('0x35')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x51c4('0x32')]('trunk:%s',this[_0x51c4('0xc')][_0xdebc00[_0x51c4('0x35')]][_0x51c4('0x3e')]),'trunk:save',this[_0x51c4('0xc')][_0xdebc00['device']]);}else if(_['startsWith'](_0xdebc00['device'],'Local')){var _0x3bcf35=_0xdebc00[_0x51c4('0x35')];var _0x276bbe=_0x3bcf35[_0x51c4('0x3f')](_0x3bcf35[_0x51c4('0x40')]('/')+0x1,_0x3bcf35[_0x51c4('0x40')]('@'));var _0x45e216=_[_0x51c4('0x2b')](this[_0x51c4('0xd')],function(_0x2dba45){return _0x2dba45['mobile']==_0x276bbe||_0x2dba45[_0x51c4('0x41')]==_0x276bbe||_0x2dba45[_0x51c4('0x42')]==_0x276bbe;});if(_0x45e216){if(_0x45e216[_0x51c4('0x28')]!==_0xdebc00[_0x51c4('0x28')][_0x51c4('0x38')]()){_0x45e216[_0x51c4('0x39')]=_[_0x51c4('0x3a')](moment()[_0x51c4('0x32')]('x'));}_0x45e216['state']=_0xdebc00[_0x51c4('0x28')][_0x51c4('0x38')]();_0x45e216[_0x51c4('0x36')]=!![];_0x45e216[_0x51c4('0x3b')](_0xdebc00);}}}}catch(_0x1b4ebe){logger[_0x51c4('0x1c')](_0x51c4('0x43'),util['inspect'](_0x1b4ebe,{'showHidden':![],'depth':null}));}};UserReport[_0x51c4('0x21')][_0x51c4('0x16')]=function(_0x27ddd8){try{if(this[_0x51c4('0x24')](_0x27ddd8)&&this['isNotNull'](_0x27ddd8[_0x51c4('0x15')])){logger[_0x51c4('0x25')](_0x51c4('0x44'),_0x27ddd8[_0x51c4('0x45')],_0x27ddd8[_0x51c4('0x46')],_0x27ddd8[_0x51c4('0x15')]);logger['debug'](_0x51c4('0x47'),util[_0x51c4('0x1d')](_0x27ddd8,{'showHidden':![],'depth':null}));if(this['agents'][_0x27ddd8[_0x51c4('0x45')]]){if(!this[_0x51c4('0xd')][_0x27ddd8[_0x51c4('0x45')]][_0x51c4('0x36')]||_0x27ddd8[_0x51c4('0x15')][_0x51c4('0x38')]()==_0x51c4('0x48')){this['agents'][_0x27ddd8[_0x51c4('0x45')]][_0x51c4('0x36')]=![];this['agents'][_0x27ddd8[_0x51c4('0x45')]][_0x51c4('0x49')]=_0x27ddd8[_0x51c4('0x15')][_0x51c4('0x38')]();this[_0x51c4('0xd')][_0x27ddd8[_0x51c4('0x45')]]['address']=_0x27ddd8[_0x51c4('0x46')];this[_0x51c4('0xd')][_0x27ddd8[_0x51c4('0x45')]]['updateStatusRealtime'](_0x27ddd8);}}else if(this[_0x51c4('0xe')][_0x27ddd8['peer']]){this['telephones'][_0x27ddd8[_0x51c4('0x45')]]['status']=_0x27ddd8[_0x51c4('0x15')]['toLowerCase']();this[_0x51c4('0xe')][_0x27ddd8['peer']]['address']=_0x27ddd8[_0x51c4('0x46')];logger[_0x51c4('0x29')](_0x51c4('0x4a'),util[_0x51c4('0x1d')](this[_0x51c4('0xe')][_0x27ddd8[_0x51c4('0x45')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x51c4('0x3d'),this['telephones'][_0x27ddd8[_0x51c4('0x45')]][_0x51c4('0x3e')]),_0x51c4('0x4b'),this[_0x51c4('0xe')][_0x27ddd8[_0x51c4('0x45')]]);}else if(this[_0x51c4('0xc')][_0x27ddd8[_0x51c4('0x45')]]){this['trunks'][_0x27ddd8[_0x51c4('0x45')]][_0x51c4('0x49')]=_0x27ddd8[_0x51c4('0x15')][_0x51c4('0x38')]();this['trunks'][_0x27ddd8[_0x51c4('0x45')]][_0x51c4('0x46')]=_0x27ddd8[_0x51c4('0x46')];logger[_0x51c4('0x29')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util['inspect'](this['trunks'][_0x27ddd8[_0x51c4('0x45')]],{'showHidden':![],'depth':null}));this[_0x51c4('0x23')](util[_0x51c4('0x32')](_0x51c4('0x33'),this[_0x51c4('0xc')][_0x27ddd8[_0x51c4('0x45')]][_0x51c4('0x3e')]),'trunk:save',this['trunks'][_0x27ddd8[_0x51c4('0x45')]]);}}}catch(_0x1c9bf7){logger['error']('[userReport][peerstatus]',util[_0x51c4('0x1d')](_0x1c9bf7,{'showHidden':![],'depth':null}));}};module[_0x51c4('0x4c')]=UserReport; \ No newline at end of file +var _0x89d6=['error','[userReport][devicestatelist]','[userReport][sippeerstatus]','prototype','syncRealtimeShow','isNotNull','isUndefined','emit','[userReport][registry]\x20registry:%s\x20state:%s','username','state','[userReport][registry]','find','stateRegistry','merge','omit','event','actionid','debug','format','trunk:%s','name','trunk:save','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','Local','substring','indexOf','mobile','phone','accountcode','[userReport][devicestatechange]','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','peer','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','syncDeviceState','syncPeerStatus','resolve','then','actionSipShowRegistry','catch','[userReport][sipshowregistry]','inspect','actionDeviceStateList'];(function(_0x416a3c,_0x481c83){var _0x2a055d=function(_0x1095d4){while(--_0x1095d4){_0x416a3c['push'](_0x416a3c['shift']());}};_0x2a055d(++_0x481c83);}(_0x89d6,0x119));var _0x689d=function(_0x4ef856,_0x4eccd3){_0x4ef856=_0x4ef856-0x0;var _0xd4c542=_0x89d6[_0x4ef856];return _0xd4c542;};'use strict';var _=require(_0x689d('0x0'));var moment=require(_0x689d('0x1'));var util=require(_0x689d('0x2'));var Redis=require(_0x689d('0x3'));var BPromise=require('bluebird');var config=require(_0x689d('0x4'));var logger=require(_0x689d('0x5'))(_0x689d('0x6'));var ami=require('../ami');config[_0x689d('0x7')]=_[_0x689d('0x8')](config[_0x689d('0x7')],{'host':_0x689d('0x9'),'port':0x18eb});var io=require(_0x689d('0xa'))(new Redis(config[_0x689d('0x7')]));function UserReport(_0x5beecb){this[_0x689d('0xb')]=_0x5beecb[_0x689d('0xb')];this[_0x689d('0xc')]=_0x5beecb['agents'];this['telephones']=_0x5beecb[_0x689d('0xd')];ami['on'](_0x689d('0xe'),this[_0x689d('0xf')][_0x689d('0x10')](this));ami['on']('registry',this['syncRegistry'][_0x689d('0x10')](this));ami['on'](_0x689d('0x11'),this[_0x689d('0x12')][_0x689d('0x10')](this));ami['on']('peerstatus',this[_0x689d('0x13')][_0x689d('0x10')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x689d('0x14')]()[_0x689d('0x15')](ami[_0x689d('0x16')]())[_0x689d('0x17')](function(_0x43a52a){logger['error'](_0x689d('0x18'),util[_0x689d('0x19')](_0x43a52a,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()['then'](ami[_0x689d('0x1a')]())[_0x689d('0x17')](function(_0x3beb4a){logger[_0x689d('0x1b')](_0x689d('0x1c'),util['inspect'](_0x3beb4a,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x689d('0x14')]()[_0x689d('0x15')](ami['actionSipPeerStatus']())[_0x689d('0x17')](function(_0x508b74){logger[_0x689d('0x1b')](_0x689d('0x1d'),util[_0x689d('0x19')](_0x508b74,{'showHidden':![],'depth':null}));});}UserReport[_0x689d('0x1e')][_0x689d('0x1f')]=function(){setInterval(function(){BPromise[_0x689d('0x14')]()[_0x689d('0x15')](showSipRegistrations())['then'](listDeviceStates())[_0x689d('0x15')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x689d('0x20')]=function(_0x5bf394){return _0x5bf394!==null&&!_[_0x689d('0x21')](_0x5bf394);};UserReport[_0x689d('0x1e')][_0x689d('0x22')]=function(_0x55ebc6,_0x1740b3,_0x490980){io['to'](_0x55ebc6)[_0x689d('0x22')](_0x1740b3,_0x490980);};UserReport[_0x689d('0x1e')][_0x689d('0xf')]=function(_0xe27c61){try{if(this[_0x689d('0x20')](_0xe27c61)){logger['info'](_0x689d('0x23'),_0xe27c61[_0x689d('0x24')],_0xe27c61[_0x689d('0x25')]);logger['debug'](_0x689d('0x26'),util[_0x689d('0x19')](_0xe27c61,{'showHidden':![],'depth':null}));var _0x324185=_[_0x689d('0x27')](this[_0x689d('0xb')],{'registry':_0xe27c61['username']});if(_0x324185){_0xe27c61[_0x689d('0x28')]=_0xe27c61['state'];_[_0x689d('0x29')](_0x324185,_[_0x689d('0x2a')](_0xe27c61,[_0x689d('0x2b'),_0x689d('0x2c'),_0x689d('0x24'),'state']));logger[_0x689d('0x2d')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util['inspect'](_0x324185,{'showHidden':![],'depth':null}));this['emit'](util[_0x689d('0x2e')](_0x689d('0x2f'),_0x324185[_0x689d('0x30')]),_0x689d('0x31'),_0x324185);}}}catch(_0x5057df){logger['error']('[userReport][registry]',util[_0x689d('0x19')](_0x5057df,{'showHidden':![],'depth':null}));}};UserReport[_0x689d('0x1e')][_0x689d('0x12')]=function(_0x2f7fc1){try{if(this[_0x689d('0x20')](_0x2f7fc1)){logger[_0x689d('0x32')](_0x689d('0x33'),_0x2f7fc1['device'],_0x2f7fc1[_0x689d('0x25')]);logger[_0x689d('0x2d')]('[userReport][devicestatechange]',util[_0x689d('0x19')](_0x2f7fc1,{'showHidden':![],'depth':null}));if(this[_0x689d('0xc')][_0x2f7fc1['device']]){if(!this[_0x689d('0xc')][_0x2f7fc1[_0x689d('0x34')]][_0x689d('0x35')]||_0x2f7fc1[_0x689d('0x25')][_0x689d('0x36')]()==_0x689d('0x37')){this[_0x689d('0xc')][_0x2f7fc1[_0x689d('0x34')]][_0x689d('0x35')]=![];if(this[_0x689d('0xc')][_0x2f7fc1[_0x689d('0x34')]][_0x689d('0x25')]!==_0x2f7fc1[_0x689d('0x25')][_0x689d('0x36')]()){this[_0x689d('0xc')][_0x2f7fc1['device']][_0x689d('0x38')]=_[_0x689d('0x39')](moment()[_0x689d('0x2e')]('x'));}this[_0x689d('0xc')][_0x2f7fc1[_0x689d('0x34')]]['state']=_0x2f7fc1[_0x689d('0x25')][_0x689d('0x36')]();this[_0x689d('0xc')][_0x2f7fc1[_0x689d('0x34')]][_0x689d('0x3a')](_0x2f7fc1);}}else if(this['telephones'][_0x2f7fc1['device']]){if(this[_0x689d('0xd')][_0x2f7fc1[_0x689d('0x34')]][_0x689d('0x25')]!==_0x2f7fc1['state']['toLowerCase']()){this['telephones'][_0x2f7fc1[_0x689d('0x34')]]['stateTime']=_[_0x689d('0x39')](moment()[_0x689d('0x2e')]('x'));}this[_0x689d('0xd')][_0x2f7fc1[_0x689d('0x34')]]['state']=_0x2f7fc1[_0x689d('0x25')][_0x689d('0x36')]();logger['debug']('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this['telephones'][_0x2f7fc1['device']],{'showHidden':![],'depth':null}));this[_0x689d('0x22')](util[_0x689d('0x2e')]('telephone:%s',this['telephones'][_0x2f7fc1[_0x689d('0x34')]][_0x689d('0x30')]),_0x689d('0x3b'),this['telephones'][_0x2f7fc1['device']]);}else if(this['trunks'][_0x2f7fc1[_0x689d('0x34')]]){if(this[_0x689d('0xb')][_0x2f7fc1[_0x689d('0x34')]]['state']!==_0x2f7fc1[_0x689d('0x25')][_0x689d('0x36')]()){this[_0x689d('0xb')][_0x2f7fc1[_0x689d('0x34')]]['stateTime']=_[_0x689d('0x39')](moment()[_0x689d('0x2e')]('x'));}this[_0x689d('0xb')][_0x2f7fc1[_0x689d('0x34')]][_0x689d('0x25')]=_0x2f7fc1[_0x689d('0x25')][_0x689d('0x36')]();logger[_0x689d('0x2d')](_0x689d('0x3c'),util[_0x689d('0x19')](this[_0x689d('0xb')][_0x2f7fc1['device']],{'showHidden':![],'depth':null}));this[_0x689d('0x22')](util[_0x689d('0x2e')](_0x689d('0x2f'),this[_0x689d('0xb')][_0x2f7fc1['device']]['name']),_0x689d('0x31'),this[_0x689d('0xb')][_0x2f7fc1[_0x689d('0x34')]]);}else if(_['startsWith'](_0x2f7fc1['device'],_0x689d('0x3d'))){var _0x1b7fdd=_0x2f7fc1['device'];var _0x24822c=_0x1b7fdd[_0x689d('0x3e')](_0x1b7fdd[_0x689d('0x3f')]('/')+0x1,_0x1b7fdd[_0x689d('0x3f')]('@'));var _0x262dbe=_[_0x689d('0x27')](this[_0x689d('0xc')],function(_0x25f8f0){return _0x25f8f0[_0x689d('0x40')]==_0x24822c||_0x25f8f0[_0x689d('0x41')]==_0x24822c||_0x25f8f0[_0x689d('0x42')]==_0x24822c;});if(_0x262dbe){if(_0x262dbe[_0x689d('0x25')]!==_0x2f7fc1['state']['toLowerCase']()){_0x262dbe[_0x689d('0x38')]=_['toNumber'](moment()[_0x689d('0x2e')]('x'));}_0x262dbe[_0x689d('0x25')]=_0x2f7fc1[_0x689d('0x25')]['toLowerCase']();_0x262dbe['local']=!![];_0x262dbe[_0x689d('0x3a')](_0x2f7fc1);}}}}catch(_0x50cdd9){logger[_0x689d('0x1b')](_0x689d('0x43'),util[_0x689d('0x19')](_0x50cdd9,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x689d('0x13')]=function(_0x139097){try{if(this[_0x689d('0x20')](_0x139097)&&this[_0x689d('0x20')](_0x139097[_0x689d('0x44')])){logger['info'](_0x689d('0x45'),_0x139097['peer'],_0x139097[_0x689d('0x46')],_0x139097[_0x689d('0x44')]);logger['debug']('[userReport][peerstatus]',util[_0x689d('0x19')](_0x139097,{'showHidden':![],'depth':null}));if(this[_0x689d('0xc')][_0x139097[_0x689d('0x47')]]){if(!this[_0x689d('0xc')][_0x139097[_0x689d('0x47')]][_0x689d('0x35')]||_0x139097[_0x689d('0x44')][_0x689d('0x36')]()=='registered'){this['agents'][_0x139097[_0x689d('0x47')]][_0x689d('0x35')]=![];this[_0x689d('0xc')][_0x139097[_0x689d('0x47')]][_0x689d('0x48')]=_0x139097[_0x689d('0x44')][_0x689d('0x36')]();this[_0x689d('0xc')][_0x139097['peer']]['address']=_0x139097[_0x689d('0x46')];this[_0x689d('0xc')][_0x139097[_0x689d('0x47')]][_0x689d('0x3a')](_0x139097);}}else if(this['telephones'][_0x139097['peer']]){this['telephones'][_0x139097['peer']][_0x689d('0x48')]=_0x139097[_0x689d('0x44')]['toLowerCase']();this[_0x689d('0xd')][_0x139097[_0x689d('0x47')]]['address']=_0x139097[_0x689d('0x46')];logger[_0x689d('0x2d')](_0x689d('0x49'),util[_0x689d('0x19')](this[_0x689d('0xd')][_0x139097[_0x689d('0x47')]],{'showHidden':![],'depth':null}));this[_0x689d('0x22')](util['format']('telephone:%s',this[_0x689d('0xd')][_0x139097[_0x689d('0x47')]][_0x689d('0x30')]),_0x689d('0x3b'),this[_0x689d('0xd')][_0x139097['peer']]);}else if(this['trunks'][_0x139097[_0x689d('0x47')]]){this[_0x689d('0xb')][_0x139097[_0x689d('0x47')]][_0x689d('0x48')]=_0x139097[_0x689d('0x44')][_0x689d('0x36')]();this[_0x689d('0xb')][_0x139097['peer']][_0x689d('0x46')]=_0x139097['address'];logger[_0x689d('0x2d')](_0x689d('0x4a'),util[_0x689d('0x19')](this[_0x689d('0xb')][_0x139097[_0x689d('0x47')]],{'showHidden':![],'depth':null}));this[_0x689d('0x22')](util[_0x689d('0x2e')](_0x689d('0x2f'),this[_0x689d('0xb')][_0x139097[_0x689d('0x47')]][_0x689d('0x30')]),_0x689d('0x31'),this[_0x689d('0xb')][_0x139097['peer']]);}}}catch(_0x2e65e1){logger[_0x689d('0x1b')](_0x689d('0x4b'),util[_0x689d('0x19')](_0x2e65e1,{'showHidden':![],'depth':null}));}};module[_0x689d('0x4c')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 360342f..c309dc6 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 _0xf438=['destchannelstatedesc','holdtime','lastevent','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','user:%s','user:agentconnect','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','error','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswerAt','reason','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','syncVarSet','addVariable','keys','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','memberdynamic','memberinterface','memberpenalty','memberrealtime','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','agentcompleteAt','values','transfereeuniqueid','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','varset','hangup','syncHangup','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','format','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','inbound','merge','omit','event','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','membername','user:called','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate'];(function(_0x119acf,_0x847313){var _0x53803c=function(_0x176cbb){while(--_0x176cbb){_0x119acf['push'](_0x119acf['shift']());}};_0x53803c(++_0x847313);}(_0xf438,0xec));var _0x8f43=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xf438[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0x8f43('0x0'));var moment=require(_0x8f43('0x1'));var util=require(_0x8f43('0x2'));var Redis=require(_0x8f43('0x3'));var config=require(_0x8f43('0x4'));var logger=require(_0x8f43('0x5'))(_0x8f43('0x6'));var ami=require(_0x8f43('0x7'));config[_0x8f43('0x8')]=_[_0x8f43('0x9')](config[_0x8f43('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8f43('0x8')]));function VoiceAgentReport(_0x3a0926){this[_0x8f43('0xa')]={};this[_0x8f43('0xb')]=_0x3a0926['voiceQueues'];this[_0x8f43('0xc')]=_0x3a0926[_0x8f43('0xc')];this[_0x8f43('0xd')]={};ami['on'](_0x8f43('0xe'),this[_0x8f43('0xf')][_0x8f43('0x10')](this));ami['on'](_0x8f43('0x11'),this[_0x8f43('0x12')][_0x8f43('0x10')](this));ami['on']('agentringnoanswer',this[_0x8f43('0x13')][_0x8f43('0x10')](this));ami['on'](_0x8f43('0x14'),this[_0x8f43('0x15')][_0x8f43('0x10')](this));ami['on'](_0x8f43('0x16'),this['syncAgentComplete'][_0x8f43('0x10')](this));ami['on'](_0x8f43('0x17'),this['syncVarSet'][_0x8f43('0x10')](this));ami['on'](_0x8f43('0x18'),this[_0x8f43('0x19')][_0x8f43('0x10')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x8f43('0x10')](this));ami['on'](_0x8f43('0x1a'),this['syncMusicOnHoldStop'][_0x8f43('0x10')](this));ami['on'](_0x8f43('0x1b'),this[_0x8f43('0x1c')][_0x8f43('0x10')](this));ami['on'](_0x8f43('0x1d'),this[_0x8f43('0x1e')][_0x8f43('0x10')](this));}VoiceAgentReport[_0x8f43('0x1f')][_0x8f43('0x20')]=function(_0x1fad22,_0x314449,_0x23e8f2){io['to'](_0x1fad22)[_0x8f43('0x20')](_0x314449,_0x23e8f2);};VoiceAgentReport[_0x8f43('0x1f')][_0x8f43('0x21')]=function(_0x5f2578){return _0x5f2578!==null&&!_[_0x8f43('0x22')](_0x5f2578);};VoiceAgentReport[_0x8f43('0x1f')][_0x8f43('0xf')]=function(_0x2024a0){try{if(this[_0x8f43('0x21')](_0x2024a0)){logger[_0x8f43('0x23')](_0x8f43('0x24'),_0x2024a0[_0x8f43('0x25')],_0x2024a0['membername'],_0x2024a0[_0x8f43('0x26')]);logger[_0x8f43('0x27')](_0x8f43('0x28'),_0x2024a0[_0x8f43('0x25')],util[_0x8f43('0x29')](_0x2024a0,{'showHidden':![],'depth':null}));if(_[_0x8f43('0x22')](this['channels'][_0x2024a0['uniqueid']])){this[_0x8f43('0xa')][_0x2024a0[_0x8f43('0x25')]]={};}if(_[_0x8f43('0x22')](this[_0x8f43('0xa')][_0x2024a0[_0x8f43('0x25')]][_0x2024a0[_0x8f43('0x26')]])){this[_0x8f43('0xa')][_0x2024a0[_0x8f43('0x25')]][_0x2024a0[_0x8f43('0x26')]]={'agentcalledAt':moment()[_0x8f43('0x2a')](_0x8f43('0x2b')),'lastevent':'called','mandatoryDisposition':this[_0x8f43('0xb')][_0x2024a0[_0x8f43('0x2c')]]?this['voiceQueues'][_0x2024a0['queue']][_0x8f43('0x2d')]||![]:![],'type':this[_0x8f43('0xb')][_0x2024a0[_0x8f43('0x2c')]]?this['voiceQueues'][_0x2024a0['queue']]['type']||_0x8f43('0x2e'):_0x8f43('0x2e'),'variables':this[_0x8f43('0xd')][_0x2024a0[_0x8f43('0x25')]]};}_[_0x8f43('0x2f')](this[_0x8f43('0xa')][_0x2024a0['uniqueid']][_0x2024a0[_0x8f43('0x26')]],_[_0x8f43('0x30')](_0x2024a0,[_0x8f43('0x31'),'privilege']));logger[_0x8f43('0x27')](_0x8f43('0x32'),_0x2024a0['uniqueid'],util[_0x8f43('0x29')](this['channels'][_0x2024a0[_0x8f43('0x25')]][_0x2024a0[_0x8f43('0x26')]],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcalled',this[_0x8f43('0xa')][_0x2024a0[_0x8f43('0x25')]][_0x2024a0[_0x8f43('0x26')]]);logger[_0x8f43('0x27')](_0x8f43('0x33'),_0x2024a0[_0x8f43('0x25')],util[_0x8f43('0x29')](this[_0x8f43('0xa')][_0x2024a0[_0x8f43('0x25')]][_0x2024a0['destuniqueid']],{'showHidden':![],'depth':null}));this['emit'](util[_0x8f43('0x2a')]('user:%s',_0x2024a0[_0x8f43('0x34')]),_0x8f43('0x35'),this[_0x8f43('0xa')][_0x2024a0[_0x8f43('0x25')]][_0x2024a0[_0x8f43('0x26')]]);}}catch(_0x1a83b4){logger['error'](_0x8f43('0x36'),_0x2024a0[_0x8f43('0x25')],util[_0x8f43('0x29')](_0x1a83b4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8f43('0x1f')][_0x8f43('0x12')]=function(_0x9bd6aa){try{if(this['isNotNull'](_0x9bd6aa)){if(this[_0x8f43('0xa')][_0x9bd6aa['uniqueid']]){logger[_0x8f43('0x27')](_0x8f43('0x37'),_0x9bd6aa[_0x8f43('0x25')],util[_0x8f43('0x29')](_0x9bd6aa,{'showHidden':![],'depth':null}));for(var _0x51f1df in this[_0x8f43('0xa')][_0x9bd6aa[_0x8f43('0x25')]]){if(this[_0x8f43('0xa')][_0x9bd6aa[_0x8f43('0x25')]][_0x8f43('0x38')](_0x51f1df)){if(_0x9bd6aa[_0x8f43('0x26')]===_0x51f1df){logger[_0x8f43('0x23')](_0x8f43('0x39'),_0x9bd6aa[_0x8f43('0x25')],_0x9bd6aa['membername'],_0x9bd6aa[_0x8f43('0x26')]);this['channels'][_0x9bd6aa[_0x8f43('0x25')]][_0x51f1df][_0x8f43('0x3a')]=moment()[_0x8f43('0x2a')](_0x8f43('0x2b'));this[_0x8f43('0xa')][_0x9bd6aa[_0x8f43('0x25')]][_0x51f1df][_0x8f43('0x3b')]=_0x9bd6aa[_0x8f43('0x3b')];this[_0x8f43('0xa')][_0x9bd6aa[_0x8f43('0x25')]][_0x51f1df][_0x8f43('0x3c')]=_0x9bd6aa[_0x8f43('0x3c')];this['channels'][_0x9bd6aa['uniqueid']][_0x51f1df][_0x8f43('0x3d')]=_0x9bd6aa[_0x8f43('0x3d')];this[_0x8f43('0xa')][_0x9bd6aa['uniqueid']][_0x51f1df][_0x8f43('0x3e')]=_0x9bd6aa[_0x8f43('0x3e')];this[_0x8f43('0xa')][_0x9bd6aa[_0x8f43('0x25')]][_0x51f1df][_0x8f43('0x3f')]=_0x9bd6aa[_0x8f43('0x3f')];this['channels'][_0x9bd6aa[_0x8f43('0x25')]][_0x51f1df][_0x8f43('0x40')]='connect';_['merge'](this[_0x8f43('0xc')][_0x9bd6aa[_0x8f43('0x41')]],_[_0x8f43('0x42')](_0x9bd6aa,[_0x8f43('0x2c'),_0x8f43('0x43')]));logger['debug'](_0x8f43('0x44'),_0x9bd6aa[_0x8f43('0x25')],util[_0x8f43('0x29')](this[_0x8f43('0xa')][_0x9bd6aa[_0x8f43('0x25')]][_0x9bd6aa['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x8f43('0x20')]('custom:agentconnect',this[_0x8f43('0xa')][_0x9bd6aa[_0x8f43('0x25')]][_0x9bd6aa[_0x8f43('0x26')]]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x9bd6aa[_0x8f43('0x25')],util[_0x8f43('0x29')](this['channels'][_0x9bd6aa[_0x8f43('0x25')]][_0x9bd6aa[_0x8f43('0x26')]],{'showHidden':![],'depth':null}));this[_0x8f43('0x20')](util[_0x8f43('0x2a')](_0x8f43('0x45'),_0x9bd6aa['membername']),_0x8f43('0x46'),this[_0x8f43('0xa')][_0x9bd6aa[_0x8f43('0x25')]][_0x9bd6aa['destuniqueid']]);}else if(!this[_0x8f43('0xa')][_0x9bd6aa['uniqueid']][_0x51f1df][_0x8f43('0x47')]&&!this[_0x8f43('0xa')][_0x9bd6aa[_0x8f43('0x25')]][_0x51f1df][_0x8f43('0x16')]){logger[_0x8f43('0x23')](_0x8f43('0x48'),_0x9bd6aa[_0x8f43('0x25')],this['channels'][_0x9bd6aa[_0x8f43('0x25')]][_0x51f1df][_0x8f43('0x34')],_0x51f1df);this['channels'][_0x9bd6aa[_0x8f43('0x25')]][_0x51f1df][_0x8f43('0x47')]=!![];this[_0x8f43('0xa')][_0x9bd6aa[_0x8f43('0x25')]][_0x51f1df]['agentringnoanswerAt']=moment()[_0x8f43('0x2a')](_0x8f43('0x2b'));this[_0x8f43('0xa')][_0x9bd6aa['uniqueid']][_0x51f1df]['answeredelsewheredestinationuniqueid']=_0x9bd6aa[_0x8f43('0x26')];this[_0x8f43('0xa')][_0x9bd6aa[_0x8f43('0x25')]][_0x51f1df][_0x8f43('0x49')]=_0x9bd6aa[_0x8f43('0x34')];this[_0x8f43('0xa')][_0x9bd6aa[_0x8f43('0x25')]][_0x51f1df][_0x8f43('0x40')]=_0x8f43('0x4a');this[_0x8f43('0xa')][_0x9bd6aa[_0x8f43('0x25')]][_0x51f1df]['reason']=_0x8f43('0x4a');logger[_0x8f43('0x27')](_0x8f43('0x4b'),_0x9bd6aa[_0x8f43('0x25')],util['inspect'](this['channels'][_0x9bd6aa[_0x8f43('0x25')]][_0x51f1df],{'showHidden':![],'depth':null}));ami[_0x8f43('0x20')](_0x8f43('0x4c'),this[_0x8f43('0xa')][_0x9bd6aa['uniqueid']][_0x51f1df]);}}}}}}catch(_0x53d3ed){logger[_0x8f43('0x4d')](_0x8f43('0x4e'),_0x9bd6aa[_0x8f43('0x25')],util['inspect'](_0x53d3ed,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8f43('0x1f')][_0x8f43('0x13')]=function(_0x5a4ddd){try{if(this['isNotNull'](_0x5a4ddd)){logger[_0x8f43('0x27')](_0x8f43('0x4f'),_0x5a4ddd[_0x8f43('0x25')],util[_0x8f43('0x29')](_0x5a4ddd,{'showHidden':![],'depth':null}));if(this[_0x8f43('0xa')][_0x5a4ddd[_0x8f43('0x25')]]&&this[_0x8f43('0xa')][_0x5a4ddd[_0x8f43('0x25')]][_0x5a4ddd['destuniqueid']]){logger[_0x8f43('0x23')](_0x8f43('0x50'),_0x5a4ddd[_0x8f43('0x25')],_0x5a4ddd['membername'],_0x5a4ddd[_0x8f43('0x26')]);this['channels'][_0x5a4ddd['uniqueid']][_0x5a4ddd[_0x8f43('0x26')]][_0x8f43('0x47')]=!![];this[_0x8f43('0xa')][_0x5a4ddd['uniqueid']][_0x5a4ddd[_0x8f43('0x26')]][_0x8f43('0x51')]=moment()[_0x8f43('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8f43('0xa')][_0x5a4ddd[_0x8f43('0x25')]][_0x5a4ddd[_0x8f43('0x26')]][_0x8f43('0x40')]='rejected';this[_0x8f43('0xa')][_0x5a4ddd[_0x8f43('0x25')]][_0x5a4ddd[_0x8f43('0x26')]][_0x8f43('0x52')]=_0x8f43('0x53');logger[_0x8f43('0x27')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5a4ddd[_0x8f43('0x25')],util[_0x8f43('0x29')](this[_0x8f43('0xa')][_0x5a4ddd[_0x8f43('0x25')]][_0x5a4ddd[_0x8f43('0x26')]],{'showHidden':![],'depth':null}));ami[_0x8f43('0x20')](_0x8f43('0x54'),this[_0x8f43('0xa')][_0x5a4ddd[_0x8f43('0x25')]][_0x5a4ddd[_0x8f43('0x26')]]);}}}catch(_0x450dd0){logger[_0x8f43('0x4d')](_0x8f43('0x55'),_0x5a4ddd[_0x8f43('0x25')],util[_0x8f43('0x29')](_0x450dd0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8f43('0x1f')]['syncQueueCallerAbandon']=function(_0x3e40cf){try{if(this[_0x8f43('0x21')](_0x3e40cf)){logger[_0x8f43('0x27')](_0x8f43('0x56'),_0x3e40cf[_0x8f43('0x25')],util[_0x8f43('0x29')](_0x3e40cf,{'showHidden':![],'depth':null}));if(this[_0x8f43('0xa')][_0x3e40cf[_0x8f43('0x25')]]){for(var _0x3ec2bf in this[_0x8f43('0xa')][_0x3e40cf[_0x8f43('0x25')]]){if(this[_0x8f43('0xa')][_0x3e40cf[_0x8f43('0x25')]][_0x8f43('0x38')](_0x3ec2bf)&&!this[_0x8f43('0xa')][_0x3e40cf[_0x8f43('0x25')]][_0x3ec2bf][_0x8f43('0x47')]&&!this[_0x8f43('0xa')][_0x3e40cf[_0x8f43('0x25')]][_0x3ec2bf][_0x8f43('0x16')]){logger[_0x8f43('0x23')](_0x8f43('0x57'),_0x3e40cf[_0x8f43('0x25')],this[_0x8f43('0xa')][_0x3e40cf[_0x8f43('0x25')]][_0x3ec2bf][_0x8f43('0x34')],_0x3ec2bf);this[_0x8f43('0xa')][_0x3e40cf[_0x8f43('0x25')]][_0x3ec2bf][_0x8f43('0x47')]=!![];this[_0x8f43('0xa')][_0x3e40cf[_0x8f43('0x25')]][_0x3ec2bf][_0x8f43('0x51')]=moment()[_0x8f43('0x2a')](_0x8f43('0x2b'));this['channels'][_0x3e40cf[_0x8f43('0x25')]][_0x3ec2bf][_0x8f43('0x40')]=_0x8f43('0x58');this[_0x8f43('0xa')][_0x3e40cf[_0x8f43('0x25')]][_0x3ec2bf]['reason']=_0x8f43('0x58');logger[_0x8f43('0x27')](_0x8f43('0x59'),_0x3e40cf[_0x8f43('0x25')],util[_0x8f43('0x29')](this[_0x8f43('0xa')][_0x3e40cf[_0x8f43('0x25')]][_0x3ec2bf],{'showHidden':![],'depth':null}));ami[_0x8f43('0x20')]('custom:agentqueuecallerabandon',this['channels'][_0x3e40cf[_0x8f43('0x25')]][_0x3ec2bf]);}}}}}catch(_0x445241){logger[_0x8f43('0x4d')](_0x8f43('0x5a'),_0x3e40cf[_0x8f43('0x25')],util['inspect'](_0x445241,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x8f43('0x5b')]=function(_0x48c3ea){try{if(this[_0x8f43('0x21')](_0x48c3ea)){logger[_0x8f43('0x27')](_0x8f43('0x5c'),_0x48c3ea[_0x8f43('0x25')],util[_0x8f43('0x29')](_0x48c3ea,{'showHidden':![],'depth':null}));if(this[_0x8f43('0xa')][_0x48c3ea['uniqueid']]){for(var _0x56416a in this[_0x8f43('0xa')][_0x48c3ea[_0x8f43('0x25')]]){if(this[_0x8f43('0xa')][_0x48c3ea[_0x8f43('0x25')]]['hasOwnProperty'](_0x56416a)){if(this[_0x8f43('0xa')][_0x48c3ea[_0x8f43('0x25')]][_0x56416a][_0x8f43('0x3a')]&&!this['channels'][_0x48c3ea['uniqueid']][_0x56416a][_0x8f43('0x16')]){logger[_0x8f43('0x23')](_0x8f43('0x5d'),_0x48c3ea[_0x8f43('0x25')],this[_0x8f43('0xa')][_0x48c3ea[_0x8f43('0x25')]][_0x56416a]['membername'],_0x56416a);this['channels'][_0x48c3ea[_0x8f43('0x25')]][_0x56416a][_0x8f43('0x16')]=!![];this['channels'][_0x48c3ea['uniqueid']][_0x56416a]['agentcompleteAt']=moment()[_0x8f43('0x2a')](_0x8f43('0x2b'));this[_0x8f43('0xa')][_0x48c3ea['uniqueid']][_0x56416a][_0x8f43('0x40')]=_0x8f43('0x5e');this['channels'][_0x48c3ea[_0x8f43('0x25')]][_0x56416a][_0x8f43('0x52')]=_0x48c3ea[_0x8f43('0x52')]==_0x8f43('0x5f')?_0x8f43('0x60'):_0x48c3ea[_0x8f43('0x52')];this[_0x8f43('0xa')][_0x48c3ea[_0x8f43('0x25')]][_0x56416a][_0x8f43('0x61')]=_0x48c3ea['talktime'];if(this[_0x8f43('0xb')][_0x48c3ea[_0x8f43('0x2c')]]&&this[_0x8f43('0xb')][_0x48c3ea[_0x8f43('0x2c')]][_0x8f43('0x62')]){this[_0x8f43('0xa')][_0x48c3ea[_0x8f43('0x25')]][_0x56416a][_0x8f43('0x63')]=this[_0x8f43('0xb')][_0x48c3ea[_0x8f43('0x2c')]][_0x8f43('0x64')];this['channels'][_0x48c3ea[_0x8f43('0x25')]][_0x56416a][_0x8f43('0x65')]=!![];}this[_0x8f43('0xc')][_0x48c3ea[_0x8f43('0x41')]]=_[_0x8f43('0x30')](this[_0x8f43('0xc')][_0x48c3ea[_0x8f43('0x41')]],[_0x8f43('0x2c'),_0x8f43('0x43')]);logger[_0x8f43('0x27')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x48c3ea[_0x8f43('0x25')],util[_0x8f43('0x29')](this[_0x8f43('0xa')][_0x48c3ea['uniqueid']][_0x56416a],{'showHidden':![],'depth':null}));ami[_0x8f43('0x20')](_0x8f43('0x66'),this['channels'][_0x48c3ea[_0x8f43('0x25')]][_0x56416a]);logger[_0x8f43('0x27')](_0x8f43('0x67'),_0x48c3ea[_0x8f43('0x25')],util[_0x8f43('0x29')](this[_0x8f43('0xa')][_0x48c3ea['uniqueid']][_0x56416a],{'showHidden':![],'depth':null}));this[_0x8f43('0x20')](util[_0x8f43('0x2a')](_0x8f43('0x45'),_0x48c3ea['membername']),_0x8f43('0x68'),this['channels'][_0x48c3ea[_0x8f43('0x25')]][_0x56416a]);}}}}}}catch(_0x7494c8){logger['error']('[%s][voiceAgentReport][agentcomplete]',_0x48c3ea[_0x8f43('0x25')],util['inspect'](_0x7494c8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8f43('0x1f')][_0x8f43('0x69')]=function(_0x2cb670){try{if(this[_0x8f43('0x21')](_0x2cb670)){logger[_0x8f43('0x27')]('[%s][voiceAgentReport][varset]\x20event:',_0x2cb670[_0x8f43('0x25')],util[_0x8f43('0x29')](_0x2cb670,{'showHidden':![],'depth':null}));this[_0x8f43('0x6a')](_0x2cb670[_0x8f43('0x25')],_[_0x8f43('0x6b')](_0x2cb670['variable'])[0x0],_0x2cb670[_0x8f43('0x6c')]);if(this['channels'][_0x2cb670[_0x8f43('0x25')]]){for(var _0x56d85d in this[_0x8f43('0xa')][_0x2cb670['uniqueid']]){if(this[_0x8f43('0xa')][_0x2cb670[_0x8f43('0x25')]][_0x8f43('0x38')](_0x56d85d)){logger[_0x8f43('0x23')](_0x8f43('0x6d'),_0x2cb670[_0x8f43('0x25')],_0x56d85d,_[_0x8f43('0x6b')](_0x2cb670['variable'])[0x0],_0x2cb670['value']);if(_['isUndefined'](this[_0x8f43('0xa')][_0x2cb670[_0x8f43('0x25')]][_0x56d85d][_0x8f43('0xd')])){this['channels'][_0x2cb670[_0x8f43('0x25')]][_0x56d85d][_0x8f43('0xd')]={};}this[_0x8f43('0xa')][_0x2cb670[_0x8f43('0x25')]][_0x56d85d][_0x8f43('0xd')]=this[_0x8f43('0xd')][_0x2cb670[_0x8f43('0x25')]];}}}}}catch(_0x3137c8){logger[_0x8f43('0x4d')]('[%s][voiceAgentReport][varset]',_0x2cb670['uniqueid'],util[_0x8f43('0x29')](_0x3137c8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8f43('0x1f')]['addVariable']=function(_0x3fdd27,_0x35893c,_0x5bb111){var _0x49c124=[_0x8f43('0x6e'),'rtpaudioqosbridged',_0x8f43('0x6f'),_0x8f43('0x70'),_0x8f43('0x71'),_0x8f43('0x72'),_0x8f43('0x73'),_0x8f43('0x74'),_0x8f43('0x75'),_0x8f43('0x76'),_0x8f43('0x77'),'bridgepvtcallid','membercalls',_0x8f43('0x78'),_0x8f43('0x79'),'memberlastcall',_0x8f43('0x34'),_0x8f43('0x7a'),_0x8f43('0x7b')];if(!_['isNil'](_0x35893c)&&!_[_0x8f43('0x7c')](_0x49c124,_0x35893c)){if(_[_0x8f43('0x22')](this['variables'][_0x3fdd27])){this[_0x8f43('0xd')][_0x3fdd27]={};}this[_0x8f43('0xd')][_0x3fdd27][_0x35893c]=_0x5bb111;}};VoiceAgentReport[_0x8f43('0x1f')]['syncHangup']=function(_0x5d05bc){try{if(this[_0x8f43('0x21')](_0x5d05bc)){logger['debug'](_0x8f43('0x7d'),_0x5d05bc[_0x8f43('0x25')],util[_0x8f43('0x29')](_0x5d05bc,{'showHidden':![],'depth':null}));if(this[_0x8f43('0xa')][_0x5d05bc[_0x8f43('0x25')]]){for(var _0xa9317e in this[_0x8f43('0xa')][_0x5d05bc[_0x8f43('0x25')]]){if(this[_0x8f43('0xa')][_0x5d05bc['uniqueid']][_0x8f43('0x38')](_0xa9317e)){if(this[_0x8f43('0xa')][_0x5d05bc['uniqueid']][_0xa9317e]['reason']==_0x8f43('0x5f')&&this['channels'][_0x5d05bc['uniqueid']][_0xa9317e][_0x8f43('0x16')]){logger['info'](_0x8f43('0x7e'),_0x5d05bc[_0x8f43('0x25')],_0xa9317e);this['channels'][_0x5d05bc[_0x8f43('0x25')]][_0xa9317e][_0x8f43('0x7f')]=moment()['format'](_0x8f43('0x2b'));}}}logger['debug']('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x5d05bc[_0x8f43('0x25')],util['inspect'](_[_0x8f43('0x80')](this[_0x8f43('0xa')][_0x5d05bc[_0x8f43('0x25')]]),{'showHidden':![],'depth':null}));ami[_0x8f43('0x20')]('custom:voiceAgentReport',_[_0x8f43('0x80')](this[_0x8f43('0xa')][_0x5d05bc[_0x8f43('0x25')]]));delete this['channels'][_0x5d05bc[_0x8f43('0x25')]];}if(this['variables'][_0x5d05bc[_0x8f43('0x25')]]){delete this['variables'][_0x5d05bc['uniqueid']];}}}catch(_0x58c53b){logger[_0x8f43('0x4d')]('[%s][voiceAgentReport][hangup]',_0x5d05bc[_0x8f43('0x25')],util[_0x8f43('0x29')](_0x58c53b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8f43('0x1f')]['syncAttendedTransfer']=function(_0x252d30){try{if(this[_0x8f43('0x21')](_0x252d30)){logger['debug']('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x252d30['uniqueid'],util['inspect'](_0x252d30,{'showHidden':![],'depth':null}));if(this[_0x8f43('0xa')][_0x252d30[_0x8f43('0x81')]]){for(var _0x51f1e3 in this[_0x8f43('0xa')][_0x252d30['transfereeuniqueid']]){if(this[_0x8f43('0xa')][_0x252d30[_0x8f43('0x81')]][_0x8f43('0x38')](_0x51f1e3)){if(_0x252d30['origtransfereruniqueid']===_0x51f1e3){logger['info']('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x252d30[_0x8f43('0x25')],this[_0x8f43('0xa')][_0x252d30[_0x8f43('0x81')]][_0x51f1e3][_0x8f43('0x34')],_0x51f1e3);var _0x4f79b4=moment();this[_0x8f43('0xa')][_0x252d30[_0x8f43('0x81')]][_0x51f1e3][_0x8f43('0x16')]=!![];this[_0x8f43('0xa')][_0x252d30[_0x8f43('0x81')]][_0x51f1e3][_0x8f43('0x7f')]=moment()[_0x8f43('0x2a')](_0x8f43('0x2b'));this['channels'][_0x252d30[_0x8f43('0x81')]][_0x51f1e3][_0x8f43('0x40')]=_0x8f43('0x5e');this[_0x8f43('0xa')][_0x252d30['transfereeuniqueid']][_0x51f1e3][_0x8f43('0x52')]=_0x8f43('0x5f');this[_0x8f43('0xa')][_0x252d30['transfereeuniqueid']][_0x51f1e3]['talktime']=_0x4f79b4['diff'](this[_0x8f43('0xa')][_0x252d30[_0x8f43('0x81')]][_0x51f1e3][_0x8f43('0x3a')],_0x8f43('0x82'));}}}}if(this['channels'][_0x252d30['secondtransfereruniqueid']]){var _0x4b1f20=this[_0x8f43('0xa')][_0x252d30[_0x8f43('0x83')]];this[_0x8f43('0xa')][_0x252d30['secondtransfereruniqueid']]=this[_0x8f43('0xa')][_0x252d30[_0x8f43('0x81')]];this[_0x8f43('0xa')][_0x252d30[_0x8f43('0x81')]]=_0x4b1f20;}}}catch(_0x1eb814){logger[_0x8f43('0x4d')](_0x8f43('0x84'),_0x252d30['uniqueid'],util[_0x8f43('0x29')](_0x1eb814,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8f43('0x1f')][_0x8f43('0x1e')]=function(_0x23cc37){try{if(this[_0x8f43('0x21')](_0x23cc37)){logger[_0x8f43('0x27')](_0x8f43('0x85'),_0x23cc37['uniqueid'],util[_0x8f43('0x29')](_0x23cc37,{'showHidden':![],'depth':null}));if(this[_0x8f43('0xa')][_0x23cc37[_0x8f43('0x81')]]){for(var _0x5c6e8d in this[_0x8f43('0xa')][_0x23cc37[_0x8f43('0x81')]]){if(this['channels'][_0x23cc37[_0x8f43('0x81')]][_0x8f43('0x38')](_0x5c6e8d)){if(_0x23cc37['transfereruniqueid']===_0x5c6e8d){logger[_0x8f43('0x23')](_0x8f43('0x86'),_0x23cc37[_0x8f43('0x25')],this[_0x8f43('0xa')][_0x23cc37[_0x8f43('0x81')]][_0x5c6e8d]['membername'],_0x5c6e8d);var _0x14ff9e=moment();this[_0x8f43('0xa')][_0x23cc37[_0x8f43('0x81')]][_0x5c6e8d]['agentcomplete']=!![];this['channels'][_0x23cc37[_0x8f43('0x81')]][_0x5c6e8d][_0x8f43('0x7f')]=_0x14ff9e;this[_0x8f43('0xa')][_0x23cc37[_0x8f43('0x81')]][_0x5c6e8d][_0x8f43('0x40')]=_0x8f43('0x5e');this[_0x8f43('0xa')][_0x23cc37[_0x8f43('0x81')]][_0x5c6e8d][_0x8f43('0x52')]='transfer';this[_0x8f43('0xa')][_0x23cc37[_0x8f43('0x81')]][_0x5c6e8d]['talktime']=_0x14ff9e[_0x8f43('0x87')](this[_0x8f43('0xa')][_0x23cc37[_0x8f43('0x81')]][_0x5c6e8d][_0x8f43('0x3a')],_0x8f43('0x82'));}}}}}}catch(_0x439ca1){logger[_0x8f43('0x4d')](_0x8f43('0x88'),_0x23cc37[_0x8f43('0x25')],util['inspect'](_0x439ca1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8f43('0x1f')][_0x8f43('0x89')]=function(_0x32ecb5){var _0x13d3b1='';try{if(this[_0x8f43('0x21')](_0x32ecb5)){logger[_0x8f43('0x27')](_0x8f43('0x8a'),_0x32ecb5[_0x8f43('0x25')],util['inspect'](_0x32ecb5,{'showHidden':![],'depth':null}));if(_0x32ecb5[_0x8f43('0x8b')]){_0x13d3b1=_0x32ecb5[_0x8f43('0x8b')][_0x8f43('0x8c')](0x0,_0x32ecb5[_0x8f43('0x8b')][_0x8f43('0x8d')]('-'));if(this[_0x8f43('0xc')][_0x13d3b1]){logger[_0x8f43('0x23')](_0x8f43('0x8e'),_0x32ecb5[_0x8f43('0x25')],_0x13d3b1);this[_0x8f43('0xc')][_0x13d3b1]['onhold']=!![];}}}}catch(_0x504d02){logger[_0x8f43('0x4d')](_0x8f43('0x8f'),_0x32ecb5['uniqueid'],util[_0x8f43('0x29')](_0x504d02,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8f43('0x1f')][_0x8f43('0x90')]=function(_0x16344b){var _0x380bac='';try{if(this[_0x8f43('0x21')](_0x16344b)){logger[_0x8f43('0x27')](_0x8f43('0x91'),_0x16344b[_0x8f43('0x25')],util[_0x8f43('0x29')](_0x16344b,{'showHidden':![],'depth':null}));if(_0x16344b[_0x8f43('0x8b')]){_0x380bac=_0x16344b['channel'][_0x8f43('0x8c')](0x0,_0x16344b[_0x8f43('0x8b')][_0x8f43('0x8d')]('-'));if(this[_0x8f43('0xc')][_0x380bac]){logger[_0x8f43('0x23')](_0x8f43('0x92'),_0x16344b['uniqueid'],_0x380bac);this[_0x8f43('0xc')][_0x380bac][_0x8f43('0x93')]=![];}}}}catch(_0x944d54){logger[_0x8f43('0x4d')](_0x8f43('0x94'),_0x16344b['uniqueid'],util['inspect'](_0x944d54,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x17a6=['agentconnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','emit','prototype','isNotNull','isUndefined','uniqueid','membername','debug','[%s][voiceAgentReport][agentcalled]\x20event:','YYYY-MM-DD\x20HH:mm:ss','called','voiceQueues','queue','mandatoryDisposition','inbound','destuniqueid','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','inspect','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','merge','interface','pick','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','answeredelsewheredestinationuniqueid','answeredelsewheremembername','reason','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','keys','value','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','custom:voiceAgentReport','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','hasOwnProperty','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','localhost','socket.io-emitter','channels','agents','variables','agentcalled','bind'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x17a6,0x8a));var _0x617a=function(_0x515805,_0x10ba3d){_0x515805=_0x515805-0x0;var _0x2ff501=_0x17a6[_0x515805];return _0x2ff501;};'use strict';var _=require('lodash');var moment=require(_0x617a('0x0'));var util=require(_0x617a('0x1'));var Redis=require(_0x617a('0x2'));var config=require(_0x617a('0x3'));var logger=require(_0x617a('0x4'))(_0x617a('0x5'));var ami=require(_0x617a('0x6'));config['redis']=_[_0x617a('0x7')](config['redis'],{'host':_0x617a('0x8'),'port':0x18eb});var io=require(_0x617a('0x9'))(new Redis(config['redis']));function VoiceAgentReport(_0x20ad2a){this[_0x617a('0xa')]={};this['voiceQueues']=_0x20ad2a['voiceQueues'];this[_0x617a('0xb')]=_0x20ad2a[_0x617a('0xb')];this[_0x617a('0xc')]={};ami['on'](_0x617a('0xd'),this['syncAgentCalled'][_0x617a('0xe')](this));ami['on'](_0x617a('0xf'),this['syncAgentConnect'][_0x617a('0xe')](this));ami['on'](_0x617a('0x10'),this[_0x617a('0x11')][_0x617a('0xe')](this));ami['on']('queuecallerabandon',this[_0x617a('0x12')][_0x617a('0xe')](this));ami['on'](_0x617a('0x13'),this[_0x617a('0x14')]['bind'](this));ami['on'](_0x617a('0x15'),this[_0x617a('0x16')]['bind'](this));ami['on'](_0x617a('0x17'),this[_0x617a('0x18')][_0x617a('0xe')](this));ami['on'](_0x617a('0x19'),this[_0x617a('0x1a')][_0x617a('0xe')](this));ami['on'](_0x617a('0x1b'),this[_0x617a('0x1c')][_0x617a('0xe')](this));ami['on'](_0x617a('0x1d'),this[_0x617a('0x1e')][_0x617a('0xe')](this));ami['on'](_0x617a('0x1f'),this['syncBlindTransfer'][_0x617a('0xe')](this));}VoiceAgentReport['prototype'][_0x617a('0x20')]=function(_0x5bf7c9,_0x1989b5,_0x53b2f2){io['to'](_0x5bf7c9)['emit'](_0x1989b5,_0x53b2f2);};VoiceAgentReport[_0x617a('0x21')][_0x617a('0x22')]=function(_0x50d52d){return _0x50d52d!==null&&!_[_0x617a('0x23')](_0x50d52d);};VoiceAgentReport[_0x617a('0x21')]['syncAgentCalled']=function(_0x354f5d){try{if(this[_0x617a('0x22')](_0x354f5d)){logger['info']('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x354f5d[_0x617a('0x24')],_0x354f5d[_0x617a('0x25')],_0x354f5d['destuniqueid']);logger[_0x617a('0x26')](_0x617a('0x27'),_0x354f5d[_0x617a('0x24')],util['inspect'](_0x354f5d,{'showHidden':![],'depth':null}));if(_[_0x617a('0x23')](this[_0x617a('0xa')][_0x354f5d[_0x617a('0x24')]])){this[_0x617a('0xa')][_0x354f5d[_0x617a('0x24')]]={};}if(_[_0x617a('0x23')](this[_0x617a('0xa')][_0x354f5d['uniqueid']][_0x354f5d['destuniqueid']])){this[_0x617a('0xa')][_0x354f5d['uniqueid']][_0x354f5d['destuniqueid']]={'agentcalledAt':moment()['format'](_0x617a('0x28')),'lastevent':_0x617a('0x29'),'mandatoryDisposition':this[_0x617a('0x2a')][_0x354f5d[_0x617a('0x2b')]]?this[_0x617a('0x2a')][_0x354f5d[_0x617a('0x2b')]][_0x617a('0x2c')]||![]:![],'type':this[_0x617a('0x2a')][_0x354f5d['queue']]?this[_0x617a('0x2a')][_0x354f5d[_0x617a('0x2b')]]['type']||_0x617a('0x2d'):'inbound','variables':this[_0x617a('0xc')][_0x354f5d[_0x617a('0x24')]]};}_['merge'](this[_0x617a('0xa')][_0x354f5d[_0x617a('0x24')]][_0x354f5d[_0x617a('0x2e')]],_['omit'](_0x354f5d,[_0x617a('0x2f'),_0x617a('0x30')]));logger[_0x617a('0x26')](_0x617a('0x31'),_0x354f5d[_0x617a('0x24')],util['inspect'](this['channels'][_0x354f5d[_0x617a('0x24')]][_0x354f5d[_0x617a('0x2e')]],{'showHidden':![],'depth':null}));ami['emit'](_0x617a('0x32'),this[_0x617a('0xa')][_0x354f5d[_0x617a('0x24')]][_0x354f5d[_0x617a('0x2e')]]);logger[_0x617a('0x26')](_0x617a('0x33'),_0x354f5d[_0x617a('0x24')],util[_0x617a('0x34')](this[_0x617a('0xa')][_0x354f5d[_0x617a('0x24')]][_0x354f5d['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x617a('0x20')](util[_0x617a('0x35')](_0x617a('0x36'),_0x354f5d[_0x617a('0x25')]),'user:called',this[_0x617a('0xa')][_0x354f5d[_0x617a('0x24')]][_0x354f5d[_0x617a('0x2e')]]);}}catch(_0xa5ad73){logger[_0x617a('0x37')](_0x617a('0x38'),_0x354f5d[_0x617a('0x24')],util['inspect'](_0xa5ad73,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x617a('0x39')]=function(_0x2e7173){try{if(this[_0x617a('0x22')](_0x2e7173)){if(this[_0x617a('0xa')][_0x2e7173['uniqueid']]){logger[_0x617a('0x26')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x2e7173[_0x617a('0x24')],util[_0x617a('0x34')](_0x2e7173,{'showHidden':![],'depth':null}));for(var _0x20d52b in this['channels'][_0x2e7173[_0x617a('0x24')]]){if(this[_0x617a('0xa')][_0x2e7173[_0x617a('0x24')]]['hasOwnProperty'](_0x20d52b)){if(_0x2e7173[_0x617a('0x2e')]===_0x20d52b){logger[_0x617a('0x3a')](_0x617a('0x3b'),_0x2e7173[_0x617a('0x24')],_0x2e7173[_0x617a('0x25')],_0x2e7173['destuniqueid']);this['channels'][_0x2e7173[_0x617a('0x24')]][_0x20d52b][_0x617a('0x3c')]=moment()[_0x617a('0x35')](_0x617a('0x28'));this[_0x617a('0xa')][_0x2e7173['uniqueid']][_0x20d52b][_0x617a('0x3d')]=_0x2e7173[_0x617a('0x3d')];this['channels'][_0x2e7173[_0x617a('0x24')]][_0x20d52b][_0x617a('0x3e')]=_0x2e7173['connectedlinenum'];this['channels'][_0x2e7173['uniqueid']][_0x20d52b][_0x617a('0x3f')]=_0x2e7173['destchannelstate'];this[_0x617a('0xa')][_0x2e7173['uniqueid']][_0x20d52b][_0x617a('0x40')]=_0x2e7173[_0x617a('0x40')];this[_0x617a('0xa')][_0x2e7173[_0x617a('0x24')]][_0x20d52b][_0x617a('0x41')]=_0x2e7173['holdtime'];this[_0x617a('0xa')][_0x2e7173[_0x617a('0x24')]][_0x20d52b][_0x617a('0x42')]=_0x617a('0x43');_[_0x617a('0x44')](this[_0x617a('0xb')][_0x2e7173[_0x617a('0x45')]],_[_0x617a('0x46')](_0x2e7173,['queue','destconnectedlinenum']));logger[_0x617a('0x26')](_0x617a('0x47'),_0x2e7173[_0x617a('0x24')],util[_0x617a('0x34')](this[_0x617a('0xa')][_0x2e7173[_0x617a('0x24')]][_0x2e7173[_0x617a('0x2e')]],{'showHidden':![],'depth':null}));ami['emit'](_0x617a('0x48'),this['channels'][_0x2e7173[_0x617a('0x24')]][_0x2e7173[_0x617a('0x2e')]]);logger[_0x617a('0x26')](_0x617a('0x49'),_0x2e7173[_0x617a('0x24')],util['inspect'](this[_0x617a('0xa')][_0x2e7173[_0x617a('0x24')]][_0x2e7173[_0x617a('0x2e')]],{'showHidden':![],'depth':null}));this[_0x617a('0x20')](util[_0x617a('0x35')](_0x617a('0x36'),_0x2e7173[_0x617a('0x25')]),_0x617a('0x4a'),this[_0x617a('0xa')][_0x2e7173['uniqueid']][_0x2e7173['destuniqueid']]);}else if(!this[_0x617a('0xa')][_0x2e7173[_0x617a('0x24')]][_0x20d52b][_0x617a('0x10')]&&!this[_0x617a('0xa')][_0x2e7173[_0x617a('0x24')]][_0x20d52b][_0x617a('0x13')]){logger[_0x617a('0x3a')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x2e7173['uniqueid'],this[_0x617a('0xa')][_0x2e7173[_0x617a('0x24')]][_0x20d52b]['membername'],_0x20d52b);this['channels'][_0x2e7173[_0x617a('0x24')]][_0x20d52b][_0x617a('0x10')]=!![];this[_0x617a('0xa')][_0x2e7173[_0x617a('0x24')]][_0x20d52b]['agentringnoanswerAt']=moment()[_0x617a('0x35')](_0x617a('0x28'));this['channels'][_0x2e7173[_0x617a('0x24')]][_0x20d52b][_0x617a('0x4b')]=_0x2e7173[_0x617a('0x2e')];this[_0x617a('0xa')][_0x2e7173[_0x617a('0x24')]][_0x20d52b][_0x617a('0x4c')]=_0x2e7173[_0x617a('0x25')];this[_0x617a('0xa')][_0x2e7173['uniqueid']][_0x20d52b][_0x617a('0x42')]='answered_elsewhere';this[_0x617a('0xa')][_0x2e7173['uniqueid']][_0x20d52b][_0x617a('0x4d')]=_0x617a('0x4e');logger[_0x617a('0x26')](_0x617a('0x4f'),_0x2e7173['uniqueid'],util[_0x617a('0x34')](this[_0x617a('0xa')][_0x2e7173[_0x617a('0x24')]][_0x20d52b],{'showHidden':![],'depth':null}));ami['emit'](_0x617a('0x50'),this['channels'][_0x2e7173[_0x617a('0x24')]][_0x20d52b]);}}}}}}catch(_0x59c14d){logger[_0x617a('0x37')](_0x617a('0x51'),_0x2e7173[_0x617a('0x24')],util['inspect'](_0x59c14d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x617a('0x21')][_0x617a('0x11')]=function(_0x321208){try{if(this[_0x617a('0x22')](_0x321208)){logger[_0x617a('0x26')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x321208['uniqueid'],util[_0x617a('0x34')](_0x321208,{'showHidden':![],'depth':null}));if(this['channels'][_0x321208[_0x617a('0x24')]]&&this[_0x617a('0xa')][_0x321208[_0x617a('0x24')]][_0x321208[_0x617a('0x2e')]]){logger[_0x617a('0x3a')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x321208[_0x617a('0x24')],_0x321208[_0x617a('0x25')],_0x321208[_0x617a('0x2e')]);this[_0x617a('0xa')][_0x321208['uniqueid']][_0x321208[_0x617a('0x2e')]]['agentringnoanswer']=!![];this[_0x617a('0xa')][_0x321208[_0x617a('0x24')]][_0x321208[_0x617a('0x2e')]]['agentringnoanswerAt']=moment()[_0x617a('0x35')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x617a('0xa')][_0x321208[_0x617a('0x24')]][_0x321208[_0x617a('0x2e')]][_0x617a('0x42')]=_0x617a('0x52');this[_0x617a('0xa')][_0x321208[_0x617a('0x24')]][_0x321208['destuniqueid']]['reason']=_0x617a('0x52');logger[_0x617a('0x26')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x321208[_0x617a('0x24')],util[_0x617a('0x34')](this[_0x617a('0xa')][_0x321208[_0x617a('0x24')]][_0x321208['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x617a('0x53'),this['channels'][_0x321208['uniqueid']][_0x321208['destuniqueid']]);}}}catch(_0x72dc7f){logger[_0x617a('0x37')](_0x617a('0x54'),_0x321208[_0x617a('0x24')],util[_0x617a('0x34')](_0x72dc7f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x617a('0x21')][_0x617a('0x12')]=function(_0x26aed1){try{if(this[_0x617a('0x22')](_0x26aed1)){logger[_0x617a('0x26')](_0x617a('0x55'),_0x26aed1['uniqueid'],util['inspect'](_0x26aed1,{'showHidden':![],'depth':null}));if(this[_0x617a('0xa')][_0x26aed1[_0x617a('0x24')]]){for(var _0x5232de in this['channels'][_0x26aed1[_0x617a('0x24')]]){if(this[_0x617a('0xa')][_0x26aed1[_0x617a('0x24')]]['hasOwnProperty'](_0x5232de)&&!this[_0x617a('0xa')][_0x26aed1[_0x617a('0x24')]][_0x5232de]['agentringnoanswer']&&!this['channels'][_0x26aed1[_0x617a('0x24')]][_0x5232de][_0x617a('0x13')]){logger['info'](_0x617a('0x56'),_0x26aed1[_0x617a('0x24')],this[_0x617a('0xa')][_0x26aed1['uniqueid']][_0x5232de][_0x617a('0x25')],_0x5232de);this[_0x617a('0xa')][_0x26aed1[_0x617a('0x24')]][_0x5232de][_0x617a('0x10')]=!![];this['channels'][_0x26aed1[_0x617a('0x24')]][_0x5232de][_0x617a('0x57')]=moment()[_0x617a('0x35')](_0x617a('0x28'));this['channels'][_0x26aed1[_0x617a('0x24')]][_0x5232de][_0x617a('0x42')]=_0x617a('0x58');this[_0x617a('0xa')][_0x26aed1[_0x617a('0x24')]][_0x5232de]['reason']=_0x617a('0x58');logger[_0x617a('0x26')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x26aed1[_0x617a('0x24')],util[_0x617a('0x34')](this[_0x617a('0xa')][_0x26aed1[_0x617a('0x24')]][_0x5232de],{'showHidden':![],'depth':null}));ami[_0x617a('0x20')](_0x617a('0x59'),this[_0x617a('0xa')][_0x26aed1['uniqueid']][_0x5232de]);}}}}}catch(_0xc38098){logger[_0x617a('0x37')](_0x617a('0x5a'),_0x26aed1[_0x617a('0x24')],util['inspect'](_0xc38098,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x617a('0x21')][_0x617a('0x14')]=function(_0x4d63ca){try{if(this['isNotNull'](_0x4d63ca)){logger[_0x617a('0x26')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x4d63ca[_0x617a('0x24')],util[_0x617a('0x34')](_0x4d63ca,{'showHidden':![],'depth':null}));if(this[_0x617a('0xa')][_0x4d63ca[_0x617a('0x24')]]){for(var _0x6de755 in this[_0x617a('0xa')][_0x4d63ca[_0x617a('0x24')]]){if(this[_0x617a('0xa')][_0x4d63ca[_0x617a('0x24')]]['hasOwnProperty'](_0x6de755)){if(this['channels'][_0x4d63ca[_0x617a('0x24')]][_0x6de755][_0x617a('0x3c')]&&!this[_0x617a('0xa')][_0x4d63ca['uniqueid']][_0x6de755][_0x617a('0x13')]){logger[_0x617a('0x3a')](_0x617a('0x5b'),_0x4d63ca['uniqueid'],this['channels'][_0x4d63ca[_0x617a('0x24')]][_0x6de755][_0x617a('0x25')],_0x6de755);this[_0x617a('0xa')][_0x4d63ca[_0x617a('0x24')]][_0x6de755][_0x617a('0x13')]=!![];this['channels'][_0x4d63ca[_0x617a('0x24')]][_0x6de755][_0x617a('0x5c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x617a('0xa')][_0x4d63ca[_0x617a('0x24')]][_0x6de755]['lastevent']=_0x617a('0x5d');this[_0x617a('0xa')][_0x4d63ca['uniqueid']][_0x6de755][_0x617a('0x4d')]=_0x4d63ca[_0x617a('0x4d')]==_0x617a('0x5e')?_0x617a('0x5f'):_0x4d63ca[_0x617a('0x4d')];this['channels'][_0x4d63ca[_0x617a('0x24')]][_0x6de755][_0x617a('0x60')]=_0x4d63ca['talktime'];if(this[_0x617a('0x2a')][_0x4d63ca[_0x617a('0x2b')]]&&this[_0x617a('0x2a')][_0x4d63ca[_0x617a('0x2b')]][_0x617a('0x61')]){this[_0x617a('0xa')][_0x4d63ca[_0x617a('0x24')]][_0x6de755]['acwtime']=this[_0x617a('0x2a')][_0x4d63ca[_0x617a('0x2b')]][_0x617a('0x62')];this[_0x617a('0xa')][_0x4d63ca[_0x617a('0x24')]][_0x6de755][_0x617a('0x63')]=!![];}this['agents'][_0x4d63ca[_0x617a('0x45')]]=_['omit'](this[_0x617a('0xb')][_0x4d63ca[_0x617a('0x45')]],[_0x617a('0x2b'),'destconnectedlinenum']);logger[_0x617a('0x26')](_0x617a('0x64'),_0x4d63ca[_0x617a('0x24')],util['inspect'](this[_0x617a('0xa')][_0x4d63ca[_0x617a('0x24')]][_0x6de755],{'showHidden':![],'depth':null}));ami[_0x617a('0x20')](_0x617a('0x65'),this[_0x617a('0xa')][_0x4d63ca['uniqueid']][_0x6de755]);logger[_0x617a('0x26')](_0x617a('0x66'),_0x4d63ca['uniqueid'],util[_0x617a('0x34')](this['channels'][_0x4d63ca[_0x617a('0x24')]][_0x6de755],{'showHidden':![],'depth':null}));this[_0x617a('0x20')](util[_0x617a('0x35')]('user:%s',_0x4d63ca[_0x617a('0x25')]),'user:agentcomplete',this[_0x617a('0xa')][_0x4d63ca[_0x617a('0x24')]][_0x6de755]);}}}}}}catch(_0x2701e4){logger[_0x617a('0x37')](_0x617a('0x67'),_0x4d63ca[_0x617a('0x24')],util['inspect'](_0x2701e4,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x617a('0x16')]=function(_0x115e73){try{if(this[_0x617a('0x22')](_0x115e73)){logger[_0x617a('0x26')](_0x617a('0x68'),_0x115e73[_0x617a('0x24')],util[_0x617a('0x34')](_0x115e73,{'showHidden':![],'depth':null}));this['addVariable'](_0x115e73[_0x617a('0x24')],_[_0x617a('0x69')](_0x115e73['variable'])[0x0],_0x115e73['value']);if(this[_0x617a('0xa')][_0x115e73[_0x617a('0x24')]]){for(var _0x27878d in this[_0x617a('0xa')][_0x115e73[_0x617a('0x24')]]){if(this[_0x617a('0xa')][_0x115e73[_0x617a('0x24')]]['hasOwnProperty'](_0x27878d)){logger[_0x617a('0x3a')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x115e73[_0x617a('0x24')],_0x27878d,_['keys'](_0x115e73['variable'])[0x0],_0x115e73[_0x617a('0x6a')]);if(_[_0x617a('0x23')](this['channels'][_0x115e73[_0x617a('0x24')]][_0x27878d][_0x617a('0xc')])){this[_0x617a('0xa')][_0x115e73[_0x617a('0x24')]][_0x27878d][_0x617a('0xc')]={};}this['channels'][_0x115e73['uniqueid']][_0x27878d][_0x617a('0xc')]=this['variables'][_0x115e73[_0x617a('0x24')]];}}}}}catch(_0x497da5){logger[_0x617a('0x37')](_0x617a('0x6b'),_0x115e73[_0x617a('0x24')],util['inspect'](_0x497da5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x617a('0x21')][_0x617a('0x6c')]=function(_0x3daba5,_0x30d48c,_0x131095){var _0x455e9c=['rtpaudioqos',_0x617a('0x6d'),_0x617a('0x6e'),_0x617a('0x6f'),_0x617a('0x70'),_0x617a('0x71'),'rtpaudioqosrtt',_0x617a('0x72'),_0x617a('0x73'),_0x617a('0x74'),_0x617a('0x75'),_0x617a('0x76'),_0x617a('0x77'),'memberdynamic',_0x617a('0x78'),_0x617a('0x79'),_0x617a('0x25'),_0x617a('0x7a'),_0x617a('0x7b')];if(!_['isNil'](_0x30d48c)&&!_[_0x617a('0x7c')](_0x455e9c,_0x30d48c)){if(_[_0x617a('0x23')](this['variables'][_0x3daba5])){this['variables'][_0x3daba5]={};}this[_0x617a('0xc')][_0x3daba5][_0x30d48c]=_0x131095;}};VoiceAgentReport[_0x617a('0x21')]['syncHangup']=function(_0x4e2f33){try{if(this[_0x617a('0x22')](_0x4e2f33)){logger['debug'](_0x617a('0x7d'),_0x4e2f33[_0x617a('0x24')],util[_0x617a('0x34')](_0x4e2f33,{'showHidden':![],'depth':null}));if(this[_0x617a('0xa')][_0x4e2f33[_0x617a('0x24')]]){for(var _0x103844 in this[_0x617a('0xa')][_0x4e2f33['uniqueid']]){if(this[_0x617a('0xa')][_0x4e2f33[_0x617a('0x24')]]['hasOwnProperty'](_0x103844)){if(this['channels'][_0x4e2f33[_0x617a('0x24')]][_0x103844]['reason']==_0x617a('0x5e')&&this[_0x617a('0xa')][_0x4e2f33[_0x617a('0x24')]][_0x103844][_0x617a('0x13')]){logger['info'](_0x617a('0x7e'),_0x4e2f33[_0x617a('0x24')],_0x103844);this['channels'][_0x4e2f33[_0x617a('0x24')]][_0x103844][_0x617a('0x5c')]=moment()['format'](_0x617a('0x28'));}}}logger[_0x617a('0x26')](_0x617a('0x7f'),_0x4e2f33[_0x617a('0x24')],util[_0x617a('0x34')](_['values'](this[_0x617a('0xa')][_0x4e2f33[_0x617a('0x24')]]),{'showHidden':![],'depth':null}));ami[_0x617a('0x20')](_0x617a('0x80'),_[_0x617a('0x81')](this[_0x617a('0xa')][_0x4e2f33[_0x617a('0x24')]]));delete this[_0x617a('0xa')][_0x4e2f33[_0x617a('0x24')]];}if(this[_0x617a('0xc')][_0x4e2f33[_0x617a('0x24')]]){delete this[_0x617a('0xc')][_0x4e2f33[_0x617a('0x24')]];}}}catch(_0x29ae3f){logger[_0x617a('0x37')](_0x617a('0x82'),_0x4e2f33[_0x617a('0x24')],util['inspect'](_0x29ae3f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x617a('0x21')]['syncAttendedTransfer']=function(_0x244e94){try{if(this[_0x617a('0x22')](_0x244e94)){logger[_0x617a('0x26')](_0x617a('0x83'),_0x244e94[_0x617a('0x24')],util[_0x617a('0x34')](_0x244e94,{'showHidden':![],'depth':null}));if(this[_0x617a('0xa')][_0x244e94[_0x617a('0x84')]]){for(var _0x885a09 in this[_0x617a('0xa')][_0x244e94[_0x617a('0x84')]]){if(this[_0x617a('0xa')][_0x244e94[_0x617a('0x84')]][_0x617a('0x85')](_0x885a09)){if(_0x244e94[_0x617a('0x86')]===_0x885a09){logger['info'](_0x617a('0x87'),_0x244e94[_0x617a('0x24')],this['channels'][_0x244e94['transfereeuniqueid']][_0x885a09]['membername'],_0x885a09);var _0x12f10b=moment();this['channels'][_0x244e94['transfereeuniqueid']][_0x885a09]['agentcomplete']=!![];this['channels'][_0x244e94['transfereeuniqueid']][_0x885a09][_0x617a('0x5c')]=moment()[_0x617a('0x35')](_0x617a('0x28'));this[_0x617a('0xa')][_0x244e94[_0x617a('0x84')]][_0x885a09][_0x617a('0x42')]=_0x617a('0x5d');this['channels'][_0x244e94[_0x617a('0x84')]][_0x885a09]['reason']=_0x617a('0x5e');this[_0x617a('0xa')][_0x244e94[_0x617a('0x84')]][_0x885a09][_0x617a('0x60')]=_0x12f10b[_0x617a('0x88')](this[_0x617a('0xa')][_0x244e94[_0x617a('0x84')]][_0x885a09][_0x617a('0x3c')],_0x617a('0x89'));}}}}if(this[_0x617a('0xa')][_0x244e94[_0x617a('0x8a')]]){var _0x49faec=this[_0x617a('0xa')][_0x244e94[_0x617a('0x8a')]];this[_0x617a('0xa')][_0x244e94['secondtransfereruniqueid']]=this['channels'][_0x244e94[_0x617a('0x84')]];this['channels'][_0x244e94[_0x617a('0x84')]]=_0x49faec;}}}catch(_0x3b90b0){logger['error'](_0x617a('0x8b'),_0x244e94[_0x617a('0x24')],util[_0x617a('0x34')](_0x3b90b0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x617a('0x8c')]=function(_0x44c7dd){try{if(this[_0x617a('0x22')](_0x44c7dd)){logger[_0x617a('0x26')](_0x617a('0x8d'),_0x44c7dd[_0x617a('0x24')],util[_0x617a('0x34')](_0x44c7dd,{'showHidden':![],'depth':null}));if(this['channels'][_0x44c7dd[_0x617a('0x84')]]){for(var _0x5616a0 in this['channels'][_0x44c7dd['transfereeuniqueid']]){if(this['channels'][_0x44c7dd[_0x617a('0x84')]][_0x617a('0x85')](_0x5616a0)){if(_0x44c7dd['transfereruniqueid']===_0x5616a0){logger[_0x617a('0x3a')](_0x617a('0x8e'),_0x44c7dd[_0x617a('0x24')],this[_0x617a('0xa')][_0x44c7dd[_0x617a('0x84')]][_0x5616a0][_0x617a('0x25')],_0x5616a0);var _0x11ccf7=moment();this[_0x617a('0xa')][_0x44c7dd['transfereeuniqueid']][_0x5616a0]['agentcomplete']=!![];this[_0x617a('0xa')][_0x44c7dd[_0x617a('0x84')]][_0x5616a0][_0x617a('0x5c')]=_0x11ccf7;this['channels'][_0x44c7dd['transfereeuniqueid']][_0x5616a0][_0x617a('0x42')]=_0x617a('0x5d');this['channels'][_0x44c7dd[_0x617a('0x84')]][_0x5616a0][_0x617a('0x4d')]=_0x617a('0x5e');this[_0x617a('0xa')][_0x44c7dd['transfereeuniqueid']][_0x5616a0]['talktime']=_0x11ccf7[_0x617a('0x88')](this['channels'][_0x44c7dd['transfereeuniqueid']][_0x5616a0][_0x617a('0x3c')],_0x617a('0x89'));}}}}}}catch(_0x4ce087){logger[_0x617a('0x37')]('[%s][voiceAgentReport][blindtransfer]',_0x44c7dd[_0x617a('0x24')],util[_0x617a('0x34')](_0x4ce087,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x617a('0x21')][_0x617a('0x1a')]=function(_0x11ea0e){var _0x6da40e='';try{if(this['isNotNull'](_0x11ea0e)){logger[_0x617a('0x26')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x11ea0e[_0x617a('0x24')],util['inspect'](_0x11ea0e,{'showHidden':![],'depth':null}));if(_0x11ea0e[_0x617a('0x8f')]){_0x6da40e=_0x11ea0e[_0x617a('0x8f')]['substring'](0x0,_0x11ea0e['channel'][_0x617a('0x90')]('-'));if(this[_0x617a('0xb')][_0x6da40e]){logger[_0x617a('0x3a')](_0x617a('0x91'),_0x11ea0e['uniqueid'],_0x6da40e);this[_0x617a('0xb')][_0x6da40e][_0x617a('0x92')]=!![];}}}}catch(_0x1fef32){logger[_0x617a('0x37')](_0x617a('0x93'),_0x11ea0e[_0x617a('0x24')],util[_0x617a('0x34')](_0x1fef32,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x617a('0x21')][_0x617a('0x1c')]=function(_0x16b82a){var _0x5bd55c='';try{if(this[_0x617a('0x22')](_0x16b82a)){logger[_0x617a('0x26')](_0x617a('0x94'),_0x16b82a[_0x617a('0x24')],util[_0x617a('0x34')](_0x16b82a,{'showHidden':![],'depth':null}));if(_0x16b82a[_0x617a('0x8f')]){_0x5bd55c=_0x16b82a[_0x617a('0x8f')][_0x617a('0x95')](0x0,_0x16b82a[_0x617a('0x8f')][_0x617a('0x90')]('-'));if(this['agents'][_0x5bd55c]){logger[_0x617a('0x3a')](_0x617a('0x96'),_0x16b82a['uniqueid'],_0x5bd55c);this['agents'][_0x5bd55c][_0x617a('0x92')]=![];}}}}catch(_0x4927b1){logger[_0x617a('0x37')](_0x617a('0x97'),_0x16b82a[_0x617a('0x24')],util[_0x617a('0x34')](_0x4927b1,{'showHidden':![],'depth':null}));}};module[_0x617a('0x98')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index eaf1f43..ea2fdb3 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 _0x08db=['isUndefined','merge','pick','isNotNull','[%s][voiceCallReport][newchannel]\x20event:','linkedid','channel','OutgoingSpoolFailed','exten','starttime','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','keys','context','from-sip','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','name','accountcode','[%s][voiceCallReport][newexten]\x20event:','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','application','duration','subtract','seconds','includes','lastapplication','lastdata','cdr(','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','xcally-motion-preview','destinationchannel','disposition','UserId','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','find','monitors','isNil','push','[%s][voiceCallReport][mixMonitorFilename]','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','syncMixMonitorFilename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-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','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','diff','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:%s','user:agentcomplete','then','transferType','undefined','isEmpty','getSettings','stopRecordingOnTransfer','resolve','StopMixMonitor','catch','Action','BlindTransfer','blindTransfers','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','util','ioredis','../../../config/environment','ami','../ami','../model/channel','../rpc/setting','unknown','inuse','invalid','ringinuse','onhold','set','queue','dial','playback','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','defaults','localhost','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','error','[voiceCallReport][coreshowchannels]','inspect','prototype','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridnum','debug','uniqueid'];(function(_0x327f19,_0x18860a){var _0x1c86a0=function(_0x41f27f){while(--_0x41f27f){_0x327f19['push'](_0x327f19['shift']());}};_0x1c86a0(++_0x18860a);}(_0x08db,0x14e));var _0xb08d=function(_0x25aea6,_0x34632d){_0x25aea6=_0x25aea6-0x0;var _0x2e314c=_0x08db[_0x25aea6];return _0x2e314c;};'use strict';var BPromise=require(_0xb08d('0x0'));var _=require('lodash');var moment=require('moment');var util=require(_0xb08d('0x1'));var path=require('path');var Redis=require(_0xb08d('0x2'));var config=require(_0xb08d('0x3'));var logger=require('../../../config/logger')(_0xb08d('0x4'));var ami=require(_0xb08d('0x5'));var Channel=require(_0xb08d('0x6'));var RpcSetting=require(_0xb08d('0x7'));var statusDesc=[_0xb08d('0x8'),'not_inuse',_0xb08d('0x9'),'busy',_0xb08d('0xa'),'unavailable','ringing',_0xb08d('0xb'),_0xb08d('0xc')];var applications=[_0xb08d('0xd'),_0xb08d('0xe'),'agi',_0xb08d('0xf'),_0xb08d('0x10'),_0xb08d('0x11')];var dispositions=[_0xb08d('0x12'),_0xb08d('0x13'),_0xb08d('0x13'),_0xb08d('0x12'),_0xb08d('0x12'),_0xb08d('0x12'),'ANSWERED',_0xb08d('0x14'),'FAILED','FAILED','FAILED'];var actions={};config[_0xb08d('0x15')]=_[_0xb08d('0x16')](config[_0xb08d('0x15')],{'host':_0xb08d('0x17'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb08d('0x15')]));function VoiceCallReport(_0x176982){this[_0xb08d('0x18')]=_0x176982[_0xb08d('0x18')];this[_0xb08d('0x19')]=_0x176982[_0xb08d('0x19')];this['blindTransfers']={};ami['on'](_0xb08d('0x1a'),this[_0xb08d('0x1b')][_0xb08d('0x1c')](this));ami['on'](_0xb08d('0x1d'),this[_0xb08d('0x1b')][_0xb08d('0x1c')](this));ami['on'](_0xb08d('0x1e'),this['syncNewChannel'][_0xb08d('0x1c')](this));ami['on'](_0xb08d('0x1f'),this[_0xb08d('0x20')]['bind'](this));ami['on'](_0xb08d('0x21'),this[_0xb08d('0x22')]['bind'](this));ami['on'](_0xb08d('0x23'),this[_0xb08d('0x24')]['bind'](this));ami['on'](_0xb08d('0x25'),this[_0xb08d('0x26')][_0xb08d('0x1c')](this));ami['on'](_0xb08d('0x27'),this[_0xb08d('0x28')]['bind'](this));ami['on']('blindtransfer',this[_0xb08d('0x29')][_0xb08d('0x1c')](this));ami['on'](_0xb08d('0x2a'),this[_0xb08d('0x2b')][_0xb08d('0x1c')](this));ami['on'](_0xb08d('0x2c'),this[_0xb08d('0x2d')][_0xb08d('0x1c')](this));try{logger[_0xb08d('0x2e')]('[voiceCallReport][coreshowchannels]\x20started');ami['actionCoreShowChannels']();}catch(_0x55e338){logger[_0xb08d('0x2f')](_0xb08d('0x30'),util[_0xb08d('0x31')](_0x55e338,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x4e4edc){return _0x4e4edc!==null&&!_['isUndefined'](_0x4e4edc);};VoiceCallReport[_0xb08d('0x32')][_0xb08d('0x33')]=function(_0x30bb90,_0x170403,_0x3f8955){io['to'](_0x30bb90)[_0xb08d('0x33')](_0x170403,_0x3f8955);};VoiceCallReport[_0xb08d('0x32')]['syncNewCallerId']=function(_0x53a4d5){try{if(this['isNotNull'](_0x53a4d5)){logger[_0xb08d('0x2e')](_0xb08d('0x34'),_0x53a4d5['uniqueid'],_0x53a4d5['calleridname'],_0x53a4d5[_0xb08d('0x35')]);logger[_0xb08d('0x36')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x53a4d5[_0xb08d('0x37')],util[_0xb08d('0x31')](_0x53a4d5,{'showHidden':![],'depth':null}));if(_0x53a4d5['uniqueid']===_0x53a4d5['linkedid']){if(!_[_0xb08d('0x38')](this[_0xb08d('0x18')][_0x53a4d5[_0xb08d('0x37')]])){_[_0xb08d('0x39')](this[_0xb08d('0x18')][_0x53a4d5[_0xb08d('0x37')]],_[_0xb08d('0x3a')](_0x53a4d5,_['keys'](this[_0xb08d('0x18')][_0x53a4d5['uniqueid']])));}}}}catch(_0x34f2c0){logger[_0xb08d('0x2f')]('[%s][voiceCallReport][newcallerid]',_0x53a4d5[_0xb08d('0x37')],util[_0xb08d('0x31')](_0x34f2c0,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewChannel']=function(_0x57883e){try{if(this[_0xb08d('0x3b')](_0x57883e)){logger[_0xb08d('0x36')](_0xb08d('0x3c'),_0x57883e[_0xb08d('0x37')],util[_0xb08d('0x31')](_0x57883e,{'showHidden':![],'depth':null}));if(_0x57883e[_0xb08d('0x37')]===_0x57883e[_0xb08d('0x3d')]&&_0x57883e[_0xb08d('0x3e')]!=_0xb08d('0x3f')){if(_[_0xb08d('0x38')](this[_0xb08d('0x18')][_0x57883e['uniqueid']])){logger[_0xb08d('0x2e')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x57883e[_0xb08d('0x37')],_0x57883e['context'],_0x57883e[_0xb08d('0x40')]);this[_0xb08d('0x18')][_0x57883e[_0xb08d('0x37')]]=new Channel();this[_0xb08d('0x18')][_0x57883e[_0xb08d('0x37')]][_0xb08d('0x41')]=moment()[_0xb08d('0x42')](_0xb08d('0x43'));this[_0xb08d('0x18')][_0x57883e[_0xb08d('0x37')]]['disposition']=dispositions[_[_0xb08d('0x44')](_0x57883e[_0xb08d('0x45')])];_[_0xb08d('0x39')](this[_0xb08d('0x18')][_0x57883e[_0xb08d('0x37')]],_['pick'](_0x57883e,_[_0xb08d('0x46')](this[_0xb08d('0x18')][_0x57883e[_0xb08d('0x37')]])));if(_0x57883e[_0xb08d('0x47')]===_0xb08d('0x48')){if(this['agents'][_0x57883e[_0xb08d('0x3e')][_0xb08d('0x49')]('-')[0x0]]){this[_0xb08d('0x19')][_0x57883e[_0xb08d('0x3e')][_0xb08d('0x49')]('-')[0x0]][_0xb08d('0x4a')]=_0x57883e[_0xb08d('0x40')];logger[_0xb08d('0x36')](_0xb08d('0x4b'),_0x57883e[_0xb08d('0x37')],util[_0xb08d('0x31')]({'destaccountcode':this[_0xb08d('0x19')][_0x57883e[_0xb08d('0x3e')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x57883e[_0xb08d('0x40')]},{'showHidden':![],'depth':null}));this[_0xb08d('0x33')](util[_0xb08d('0x42')]('user:%s',this[_0xb08d('0x19')][_0x57883e[_0xb08d('0x3e')][_0xb08d('0x49')]('-')[0x0]][_0xb08d('0x4c')]),'user:agentconnect',{'destaccountcode':this[_0xb08d('0x19')][_0x57883e[_0xb08d('0x3e')][_0xb08d('0x49')]('-')[0x0]][_0xb08d('0x4d')],'destconnectedlinenum':_0x57883e[_0xb08d('0x40')]});}}}}}}catch(_0x4a6423){logger[_0xb08d('0x2f')]('[%s][voiceCallReport][newchannel]',_0x57883e[_0xb08d('0x37')],util[_0xb08d('0x31')](_0x4a6423,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb08d('0x32')][_0xb08d('0x1b')]=function(_0x105e96){try{if(this[_0xb08d('0x3b')](_0x105e96)){logger['debug'](_0xb08d('0x4e'),_0x105e96[_0xb08d('0x37')],util[_0xb08d('0x31')](_0x105e96,{'showHidden':![],'depth':null}));if(_0x105e96[_0xb08d('0x37')]===_0x105e96[_0xb08d('0x3d')]&&_0x105e96[_0xb08d('0x40')]!='h'&&_0x105e96[_0xb08d('0x3e')]!=_0xb08d('0x3f')){_0x105e96['application']=_0x105e96['application'][_0xb08d('0x4f')]();_0x105e96[_0xb08d('0x50')]=(_0x105e96[_0xb08d('0x51')]||_0x105e96['applicationdata'])['toLowerCase']();logger['info'](_0xb08d('0x52'),_0x105e96[_0xb08d('0x37')],_0x105e96[_0xb08d('0x53')],_0x105e96[_0xb08d('0x50')]);if(_[_0xb08d('0x38')](this[_0xb08d('0x18')][_0x105e96[_0xb08d('0x37')]])){this[_0xb08d('0x18')][_0x105e96[_0xb08d('0x37')]]=new Channel();this[_0xb08d('0x18')][_0x105e96[_0xb08d('0x37')]][_0xb08d('0x41')]=_0x105e96[_0xb08d('0x54')]?moment()[_0xb08d('0x55')](moment[_0xb08d('0x54')](_0x105e96[_0xb08d('0x54')])[_0xb08d('0x56')](),'seconds')[_0xb08d('0x42')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0xb08d('0x42')](_0xb08d('0x43'));this[_0xb08d('0x18')][_0x105e96[_0xb08d('0x37')]]['disposition']=_0xb08d('0x12');}_[_0xb08d('0x39')](this[_0xb08d('0x18')][_0x105e96[_0xb08d('0x37')]],_['pick'](_0x105e96,_['keys'](this[_0xb08d('0x18')][_0x105e96['uniqueid']])));if(_[_0xb08d('0x57')](applications,_0x105e96[_0xb08d('0x53')])){this[_0xb08d('0x18')][_0x105e96['uniqueid']][_0xb08d('0x58')]=_0x105e96[_0xb08d('0x53')];this['channels'][_0x105e96['uniqueid']][_0xb08d('0x59')]=_0x105e96['applicationdata'];if(_0x105e96[_0xb08d('0x53')]==='set'&&_['startsWith'](_0x105e96[_0xb08d('0x50')],_0xb08d('0x5a'))){var _0x164b2e=_0x105e96['applicationdata'][_0xb08d('0x49')]('=');var _0x47c4da=_0x164b2e[0x0]['match'](/cdr\((.*)\)/);if(_0x47c4da){this[_0xb08d('0x18')][_0x105e96[_0xb08d('0x37')]][_0x47c4da[0x1]]=_0x164b2e[0x1];}}else if(_0x105e96[_0xb08d('0x53')]===_0xb08d('0xe')){this[_0xb08d('0x18')][_0x105e96['uniqueid']][_0xb08d('0xe')]=_0x105e96['applicationdata']['split'](',')[0x0];}}}}}catch(_0x549a8b){logger[_0xb08d('0x2f')](_0xb08d('0x5b'),_0x105e96['uniqueid'],util[_0xb08d('0x31')](_0x549a8b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xb08d('0x20')]=function(_0x1d2446){try{if(this[_0xb08d('0x3b')](_0x1d2446)){logger[_0xb08d('0x2e')](_0xb08d('0x5c'),_0x1d2446['uniqueid'],_0x1d2446['linkedid'],_0x1d2446[_0xb08d('0x5d')],_0x1d2446[_0xb08d('0x35')]);logger[_0xb08d('0x36')](_0xb08d('0x5e'),_0x1d2446[_0xb08d('0x37')],util[_0xb08d('0x31')](_0x1d2446,{'showHidden':![],'depth':null}));if(_0x1d2446[_0xb08d('0x37')]!==_0x1d2446[_0xb08d('0x3d')]){if(this[_0xb08d('0x18')][_0x1d2446[_0xb08d('0x3d')]]){if(_0x1d2446[_0xb08d('0x45')]==='6'){if(!this['channels'][_0x1d2446[_0xb08d('0x3d')]][_0xb08d('0x5f')]){var _0x556883=moment();this[_0xb08d('0x18')][_0x1d2446['linkedid']][_0xb08d('0x5f')]=!![];this['channels'][_0x1d2446[_0xb08d('0x3d')]][_0xb08d('0x60')]=_0x556883[_0xb08d('0x42')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xb08d('0x18')][_0x1d2446[_0xb08d('0x3d')]][_0xb08d('0x41')]){this[_0xb08d('0x18')][_0x1d2446['linkedid']][_0xb08d('0x61')]=_0x556883['diff'](this['channels'][_0x1d2446[_0xb08d('0x3d')]][_0xb08d('0x41')],_0xb08d('0x56'));}}this[_0xb08d('0x18')][_0x1d2446[_0xb08d('0x3d')]][_0xb08d('0x3d')]=_0x1d2446['uniqueid'];if(_0x1d2446['calleridnum']!==_0xb08d('0x62')){this['channels'][_0x1d2446[_0xb08d('0x3d')]]['connectedlinenum']=_0x1d2446[_0xb08d('0x35')];}this[_0xb08d('0x18')][_0x1d2446['linkedid']]['connectedlinename']=_0x1d2446[_0xb08d('0x5d')];this['channels'][_0x1d2446[_0xb08d('0x3d')]][_0xb08d('0x63')]=_0x1d2446['channel'];this[_0xb08d('0x18')][_0x1d2446['linkedid']][_0xb08d('0x64')]=dispositions[_[_0xb08d('0x44')](_0x1d2446[_0xb08d('0x45')])];if(this[_0xb08d('0x19')][_0x1d2446[_0xb08d('0x3e')][_0xb08d('0x49')]('-')[0x0]]){this[_0xb08d('0x18')][_0x1d2446[_0xb08d('0x3d')]]['UserId']=this[_0xb08d('0x19')][_0x1d2446[_0xb08d('0x3e')][_0xb08d('0x49')]('-')[0x0]]['id'];this[_0xb08d('0x18')][_0x1d2446['linkedid']]['membername']=this['agents'][_0x1d2446['channel'][_0xb08d('0x49')]('-')[0x0]][_0xb08d('0x4c')];}}}}else{if(this[_0xb08d('0x18')][_0x1d2446[_0xb08d('0x37')]]){if(_0x1d2446[_0xb08d('0x45')]==='6'){if(this[_0xb08d('0x19')][_0x1d2446[_0xb08d('0x3e')]['split']('-')[0x0]]){this[_0xb08d('0x18')][_0x1d2446['uniqueid']][_0xb08d('0x65')]=this[_0xb08d('0x19')][_0x1d2446[_0xb08d('0x3e')][_0xb08d('0x49')]('-')[0x0]]['id'];this[_0xb08d('0x18')][_0x1d2446[_0xb08d('0x37')]]['membername']=this[_0xb08d('0x19')][_0x1d2446[_0xb08d('0x3e')][_0xb08d('0x49')]('-')[0x0]][_0xb08d('0x4c')];}}}}}}catch(_0x3643d0){logger[_0xb08d('0x2f')]('[%s][voiceCallReport][newstate]',_0x1d2446['uniqueid'],util['inspect'](_0x3643d0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb08d('0x32')]['syncMixMonitorFilename']=function(_0x217ba9,_0x47cf36){try{if(this['channels'][_0x217ba9]){logger[_0xb08d('0x2e')](_0xb08d('0x66'),_0x217ba9,_0x47cf36);this[_0xb08d('0x18')][_0x217ba9][_0xb08d('0x67')]=!![];if(_[_0xb08d('0x68')](_0x47cf36,_0xb08d('0x69'))){_0x47cf36=_0x47cf36[_0xb08d('0x6a')](_0xb08d('0x69'),_0xb08d('0x6b'));}this[_0xb08d('0x18')][_0x217ba9]['monitorFilename']=_0x47cf36;var _0x30db2b=_[_0xb08d('0x6c')](this[_0xb08d('0x18')][_0x217ba9][_0xb08d('0x6d')],{'filename':_0x47cf36});if(_[_0xb08d('0x6e')](_0x30db2b)){this['channels'][_0x217ba9][_0xb08d('0x6d')][_0xb08d('0x6f')]({'filename':_0x47cf36,'createdAt':moment()[_0xb08d('0x42')](_0xb08d('0x43')),'mixmonitorid':'','status':'rec'});}}}catch(_0x469be8){logger[_0xb08d('0x2f')](_0xb08d('0x70'),_0x217ba9,util[_0xb08d('0x31')](_0x469be8,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncVarSet']=function(_0x3a7a54){try{if(this[_0xb08d('0x3b')](_0x3a7a54)){logger['debug']('[%s][voiceCallReport][varset]\x20event:',_0x3a7a54[_0xb08d('0x37')],util['inspect'](_0x3a7a54,{'showHidden':![],'depth':null}));if(this['channels'][_0x3a7a54[_0xb08d('0x37')]]&&_0x3a7a54['channel']!=_0xb08d('0x3f')){if(this['isNotNull'](_0x3a7a54[_0xb08d('0x71')])){if(this['isNotNull'](_0x3a7a54[_0xb08d('0x71')]['mixmonitor_filename'])){logger[_0xb08d('0x2e')](_0xb08d('0x72'),_0x3a7a54['uniqueid'],_0x3a7a54['value']);this[_0xb08d('0x73')](_0x3a7a54[_0xb08d('0x37')],_0x3a7a54[_0xb08d('0x74')]);}else if(this[_0xb08d('0x3b')](_0x3a7a54[_0xb08d('0x71')][_0xb08d('0x75')])){logger['info'](_0xb08d('0x76'),_0x3a7a54[_0xb08d('0x37')],_0x3a7a54[_0xb08d('0x74')]);this['channels'][_0x3a7a54['uniqueid']][_0xb08d('0x35')]=_0x3a7a54[_0xb08d('0x74')];}else if(this[_0xb08d('0x3b')](_0x3a7a54['variable'][_0xb08d('0x77')])){logger[_0xb08d('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x3a7a54[_0xb08d('0x37')],_0x3a7a54[_0xb08d('0x74')]);this[_0xb08d('0x18')][_0x3a7a54['uniqueid']]['callerid']=_0x3a7a54[_0xb08d('0x74')];}else if(this[_0xb08d('0x3b')](_0x3a7a54[_0xb08d('0x71')][_0xb08d('0x78')])){logger[_0xb08d('0x2e')](_0xb08d('0x79'),_0x3a7a54[_0xb08d('0x37')],_0x3a7a54[_0xb08d('0x74')]);this[_0xb08d('0x18')][_0x3a7a54['uniqueid']][_0xb08d('0x7a')]=_0x3a7a54[_0xb08d('0x74')];}else if(this['isNotNull'](_0x3a7a54[_0xb08d('0x71')]['xmd-queue'])){logger['info'](_0xb08d('0x7b'),_0x3a7a54[_0xb08d('0x37')],_0x3a7a54[_0xb08d('0x74')][_0xb08d('0x49')](',')[0x0]);this[_0xb08d('0x18')][_0x3a7a54[_0xb08d('0x37')]][_0xb08d('0xe')]=_0x3a7a54[_0xb08d('0x74')][_0xb08d('0x49')](',')[0x0];}else if(this['isNotNull'](_0x3a7a54[_0xb08d('0x71')][_0xb08d('0x7c')])){logger[_0xb08d('0x2e')](_0xb08d('0x7d'),_0x3a7a54[_0xb08d('0x37')],_0x3a7a54[_0xb08d('0x74')]);this['channels'][_0x3a7a54[_0xb08d('0x37')]][_0xb08d('0x7e')]=_0x3a7a54[_0xb08d('0x74')];}else if(this[_0xb08d('0x3b')](_0x3a7a54['variable'][_0xb08d('0x7f')])){logger[_0xb08d('0x2e')](_0xb08d('0x80'),_0x3a7a54[_0xb08d('0x37')],_0x3a7a54['value']);this[_0xb08d('0x18')][_0x3a7a54[_0xb08d('0x37')]][_0xb08d('0x81')]=_0x3a7a54[_0xb08d('0x74')];}else if(this[_0xb08d('0x3b')](_0x3a7a54[_0xb08d('0x71')][_0xb08d('0x82')])){logger[_0xb08d('0x2e')](_0xb08d('0x83'),_0x3a7a54[_0xb08d('0x37')],_0x3a7a54['value']);this[_0xb08d('0x18')][_0x3a7a54[_0xb08d('0x37')]][_0xb08d('0x84')]=_0x3a7a54[_0xb08d('0x74')];}else if(this[_0xb08d('0x3b')](_0x3a7a54[_0xb08d('0x71')][_0xb08d('0x85')])){logger['info'](_0xb08d('0x86'),_0x3a7a54[_0xb08d('0x37')],_0x3a7a54['value']);this['channels'][_0x3a7a54[_0xb08d('0x37')]][_0xb08d('0xe')]=_0x3a7a54[_0xb08d('0x74')];}else if(this[_0xb08d('0x3b')](_0x3a7a54['variable'][_0xb08d('0x87')])){logger[_0xb08d('0x2e')](_0xb08d('0x88'),_0x3a7a54[_0xb08d('0x37')],_0x3a7a54[_0xb08d('0x74')]);this[_0xb08d('0x18')][_0x3a7a54[_0xb08d('0x37')]][_0xb08d('0x89')]=_0x3a7a54['value'];}}}else if(this[_0xb08d('0x3b')](_0x3a7a54[_0xb08d('0x71')][_0xb08d('0x8a')])){if(_0x3a7a54[_0xb08d('0x74')]){var _0x53be42=path['parse'](_0x3a7a54['value'])[_0xb08d('0x4c')];logger[_0xb08d('0x2e')](_0xb08d('0x72'),_0x53be42,_0x3a7a54['value']);this[_0xb08d('0x73')](_0x53be42,_0x3a7a54[_0xb08d('0x74')]);}}else if(this[_0xb08d('0x18')][_0x3a7a54[_0xb08d('0x3d')]]){if(this[_0xb08d('0x3b')](_0x3a7a54['variable'])){if(this[_0xb08d('0x3b')](_0x3a7a54[_0xb08d('0x71')][_0xb08d('0x87')])){logger[_0xb08d('0x2e')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x3a7a54[_0xb08d('0x3d')],_0x3a7a54['value']);this['channels'][_0x3a7a54[_0xb08d('0x3d')]][_0xb08d('0x8b')]=_0x3a7a54[_0xb08d('0x74')];}}}}}catch(_0x4bdbbb){logger[_0xb08d('0x2f')](_0xb08d('0x8c'),_0x3a7a54['uniqueid'],util['inspect'](_0x4bdbbb,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xb08d('0x24')]=function(_0x2c6f8d){try{if(this['isNotNull'](_0x2c6f8d)){logger[_0xb08d('0x36')](_0xb08d('0x8d'),_0x2c6f8d[_0xb08d('0x37')],util[_0xb08d('0x31')](_0x2c6f8d,{'showHidden':![],'depth':null}));if(this['channels'][_0x2c6f8d[_0xb08d('0x37')]]){logger[_0xb08d('0x2e')](_0xb08d('0x8e'),_0x2c6f8d['uniqueid'],_0x2c6f8d[_0xb08d('0x8f')]);var _0x56b25d=moment();this[_0xb08d('0x18')][_0x2c6f8d[_0xb08d('0x37')]]['endtime']=_0x56b25d['format'](_0xb08d('0x43'));this[_0xb08d('0x18')][_0x2c6f8d[_0xb08d('0x37')]]['duration']=_0x56b25d[_0xb08d('0x90')](this[_0xb08d('0x18')][_0x2c6f8d[_0xb08d('0x37')]][_0xb08d('0x41')],_0xb08d('0x56'));if(this[_0xb08d('0x18')][_0x2c6f8d[_0xb08d('0x37')]][_0xb08d('0x5f')]){this[_0xb08d('0x18')][_0x2c6f8d['uniqueid']]['billableseconds']=_0x56b25d[_0xb08d('0x90')](this['channels'][_0x2c6f8d[_0xb08d('0x37')]][_0xb08d('0x60')],'seconds');this[_0xb08d('0x18')][_0x2c6f8d[_0xb08d('0x37')]]['holdtime']=this[_0xb08d('0x18')][_0x2c6f8d[_0xb08d('0x37')]][_0xb08d('0x54')]-this['channels'][_0x2c6f8d[_0xb08d('0x37')]]['billableseconds'];}if(_0x2c6f8d[_0xb08d('0x47')]===_0xb08d('0x48')){if(this['agents'][_0x2c6f8d[_0xb08d('0x3e')][_0xb08d('0x49')]('-')[0x0]]){this[_0xb08d('0x19')][_0x2c6f8d['channel'][_0xb08d('0x49')]('-')[0x0]]=_['omit'](this[_0xb08d('0x19')][_0x2c6f8d['channel'][_0xb08d('0x49')]('-')[0x0]],[_0xb08d('0x4a')]);logger[_0xb08d('0x36')](_0xb08d('0x91'),_0x2c6f8d['uniqueid'],util[_0xb08d('0x31')]({'destaccountcode':this[_0xb08d('0x19')][_0x2c6f8d[_0xb08d('0x3e')]['split']('-')[0x0]][_0xb08d('0x4d')]},{'showHidden':![],'depth':null}));this[_0xb08d('0x33')](util['format'](_0xb08d('0x92'),this['agents'][_0x2c6f8d[_0xb08d('0x3e')][_0xb08d('0x49')]('-')[0x0]]['name']),_0xb08d('0x93'),{'destaccountcode':this['agents'][_0x2c6f8d[_0xb08d('0x3e')][_0xb08d('0x49')]('-')[0x0]]['accountcode']});}}var _0x3b8f5e=this;Promise['resolve']()[_0xb08d('0x94')](function(){var _0xf10829=_0x3b8f5e['channels'][_0x2c6f8d[_0xb08d('0x37')]];if(typeof _0xf10829[_0xb08d('0x95')]===_0xb08d('0x96'))return;if(_[_0xb08d('0x97')](_0xf10829[_0xb08d('0x6d')]))return;return RpcSetting[_0xb08d('0x98')]()[_0xb08d('0x94')](function(_0x376cf0){if(!_0x376cf0[_0xb08d('0x99')])return;return Promise[_0xb08d('0x9a')]()[_0xb08d('0x94')](function(){return ami['Action']({'action':_0xb08d('0x9b'),'channel':_0xf10829[_0xb08d('0x3e')]})[_0xb08d('0x9c')](function(){});})[_0xb08d('0x94')](function(){return ami[_0xb08d('0x9d')]({'action':_0xb08d('0x9b'),'channel':_0xf10829['destinationchannel']})['catch'](function(){})['finally'](function(){var _0x30a313=_0x3b8f5e[_0xb08d('0x19')][_0xf10829['destinationchannel'][_0xb08d('0x49')]('-')[0x0]];if(!_0x30a313)return;io['emit']('webbar:stopmonitors',{'agentId':_0x30a313['id'],'uniqueid':_0xf10829[_0xb08d('0x37')]});});});});})[_0xb08d('0x94')](function(){if(_0x2c6f8d['event']===_0xb08d('0x9e')){_0x3b8f5e[_0xb08d('0x9f')][_0x2c6f8d[_0xb08d('0x37')]]=_0x3b8f5e[_0xb08d('0x18')][_0x2c6f8d[_0xb08d('0x37')]];}else{if(_0x3b8f5e['channels'][_0x2c6f8d['uniqueid']][_0xb08d('0x7a')]===_0xb08d('0xa0')&&_0x3b8f5e['blindTransfers'][_0x2c6f8d[_0xb08d('0x37')]]){_0x3b8f5e[_0xb08d('0x18')][_0x2c6f8d[_0xb08d('0x37')]][_0xb08d('0x37')]=[_0x3b8f5e['channels'][_0x2c6f8d[_0xb08d('0x37')]][_0xb08d('0x3d')],_0x3b8f5e[_0xb08d('0x18')][_0x2c6f8d[_0xb08d('0x37')]][_0xb08d('0x3d')]=_0x3b8f5e[_0xb08d('0x18')][_0x2c6f8d[_0xb08d('0x37')]]['uniqueid']][0x0];delete _0x3b8f5e[_0xb08d('0x9f')][_0x2c6f8d[_0xb08d('0x37')]];}}logger[_0xb08d('0x36')](_0xb08d('0xa1'),_0x2c6f8d[_0xb08d('0x37')],util[_0xb08d('0x31')](_0x3b8f5e[_0xb08d('0x18')][_0x2c6f8d['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xb08d('0xa2'),_0x3b8f5e[_0xb08d('0x18')][_0x2c6f8d[_0xb08d('0x37')]]);delete _0x3b8f5e[_0xb08d('0x18')][_0x2c6f8d[_0xb08d('0x37')]];});}}}catch(_0x45bff1){logger[_0xb08d('0x2f')](_0xb08d('0xa3'),_0x2c6f8d[_0xb08d('0x37')],util[_0xb08d('0x31')](_0x45bff1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb08d('0x32')][_0xb08d('0x28')]=function(_0x107bc0){try{if(this[_0xb08d('0x3b')](_0x107bc0)){logger[_0xb08d('0x2e')](_0xb08d('0xa4'),_0x107bc0[_0xb08d('0x37')],_0x107bc0[_0xb08d('0xa5')],_0x107bc0['transfertargetcalleridnum']);logger[_0xb08d('0x36')](_0xb08d('0xa6'),_0x107bc0['uniqueid'],util[_0xb08d('0x31')](_0x107bc0,{'showHidden':![],'depth':null}));if(this[_0xb08d('0x18')][_0x107bc0[_0xb08d('0xa7')]]){this[_0xb08d('0x18')][_0x107bc0[_0xb08d('0xa7')]][_0xb08d('0xa8')]=_0x107bc0['origtransferercalleridnum'];this['channels'][_0x107bc0['transfereeuniqueid']][_0xb08d('0xa9')]=_0x107bc0[_0xb08d('0xaa')];if(this['channels'][_0x107bc0[_0xb08d('0xab')]]){var _0x397c5c=this[_0xb08d('0x18')][_0x107bc0['secondtransfereruniqueid']];this[_0xb08d('0x18')][_0x107bc0[_0xb08d('0xab')]]=this[_0xb08d('0x18')][_0x107bc0[_0xb08d('0xa7')]];this[_0xb08d('0x18')][_0x107bc0[_0xb08d('0xa7')]]=_0x397c5c;}}else if(this[_0xb08d('0x18')][_0x107bc0['transfertargetuniqueid']]){this['channels'][_0x107bc0[_0xb08d('0xac')]][_0xb08d('0xa8')]=_0x107bc0[_0xb08d('0xa5')];this[_0xb08d('0x18')][_0x107bc0[_0xb08d('0xac')]]['transferconnectedlinenum']=_0x107bc0[_0xb08d('0xaa')];if(this[_0xb08d('0x18')][_0x107bc0[_0xb08d('0xad')]]){var _0x397c5c=this[_0xb08d('0x18')][_0x107bc0[_0xb08d('0xad')]];this[_0xb08d('0x18')][_0x107bc0[_0xb08d('0xad')]]=this[_0xb08d('0x18')][_0x107bc0[_0xb08d('0xac')]];this['channels'][_0x107bc0[_0xb08d('0xac')]]=_0x397c5c;}}if((this[_0xb08d('0x18')][_0x107bc0[_0xb08d('0xad')]]||this['channels'][_0x107bc0[_0xb08d('0xae')]])&&this[_0xb08d('0x18')][_0x107bc0['secondtransfereruniqueid']]){var _0x30b15c=_[_0xb08d('0xaf')]([this[_0xb08d('0x18')][_0x107bc0[_0xb08d('0xad')]],this[_0xb08d('0x18')][_0x107bc0[_0xb08d('0xae')]],this[_0xb08d('0x18')][_0x107bc0['secondtransfereruniqueid']]],function(_0x338ccd){return _0x338ccd&&_0x338ccd[_0xb08d('0x7a')]==='outbound'&&_0x338ccd[_0xb08d('0xb0')];});if(_0x30b15c){if(this[_0xb08d('0x18')][_0x107bc0[_0xb08d('0xad')]])this[_0xb08d('0x18')][_0x107bc0['origtransfereruniqueid']]['transferType']='ATTENDED';if(this[_0xb08d('0x18')][_0x107bc0[_0xb08d('0xae')]])this[_0xb08d('0x18')][_0x107bc0[_0xb08d('0xae')]][_0xb08d('0x95')]=_0xb08d('0xb1');this[_0xb08d('0x18')][_0x107bc0[_0xb08d('0xab')]][_0xb08d('0x95')]='ATTENDED';}}}}catch(_0x413464){logger[_0xb08d('0x2f')](_0xb08d('0xb2'),_0x107bc0['uniqueid'],util[_0xb08d('0x31')](_0x413464,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb08d('0x32')][_0xb08d('0x29')]=function(_0x2e1b51){try{if(this['isNotNull'](_0x2e1b51)){logger[_0xb08d('0x2e')](_0xb08d('0xb3'),_0x2e1b51[_0xb08d('0x37')],_0x2e1b51[_0xb08d('0xb4')],_0x2e1b51[_0xb08d('0xb5')]);logger[_0xb08d('0x36')](_0xb08d('0xb6'),_0x2e1b51[_0xb08d('0x37')],util[_0xb08d('0x31')](_0x2e1b51,{'showHidden':![],'depth':null}));if(this[_0xb08d('0x18')][_0x2e1b51[_0xb08d('0xa7')]]){this['channels'][_0x2e1b51[_0xb08d('0xa7')]]['transfercalleridnum']=_0x2e1b51[_0xb08d('0xb4')];this['channels'][_0x2e1b51['transfereeuniqueid']][_0xb08d('0xa9')]=_0x2e1b51['extension'];this[_0xb08d('0x18')][_0x2e1b51[_0xb08d('0xa7')]][_0xb08d('0x95')]=_0xb08d('0xb7');this['syncHangup']({'event':'BlindTransfer','uniqueid':_0x2e1b51[_0xb08d('0xa7')],'context':_0x2e1b51[_0xb08d('0x47')],'channel':_0x2e1b51[_0xb08d('0xb8')]});}else{this['channels'][_0x2e1b51[_0xb08d('0xb9')]][_0xb08d('0x95')]=_0xb08d('0xb7');}}}catch(_0x16e797){logger['error']('[%s][voiceCallReport][blindtransfer]',_0x2e1b51[_0xb08d('0x37')],util[_0xb08d('0x31')](_0x16e797,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb08d('0x32')][_0xb08d('0x2b')]=function(_0x5d66c8){try{if(this['isNotNull'](_0x5d66c8)){logger['debug'](_0xb08d('0xba'),_0x5d66c8[_0xb08d('0x37')],util[_0xb08d('0x31')](_0x5d66c8,{'showHidden':![],'depth':null}));if(this[_0xb08d('0x18')][_0x5d66c8[_0xb08d('0x37')]]){if(!_[_0xb08d('0x6e')](this[_0xb08d('0x18')][_0x5d66c8[_0xb08d('0x37')]][_0xb08d('0x60')])){this[_0xb08d('0x18')][_0x5d66c8[_0xb08d('0x37')]][_0xb08d('0xbb')]=moment()[_0xb08d('0x42')](_0xb08d('0x43'));logger['info'](_0xb08d('0xbc'),_0x5d66c8[_0xb08d('0x37')],this[_0xb08d('0x18')][_0x5d66c8[_0xb08d('0x37')]][_0xb08d('0xbb')]);}}}}catch(_0x46f557){logger[_0xb08d('0x2f')](_0xb08d('0xbd'),_0x5d66c8[_0xb08d('0x37')],util[_0xb08d('0x31')](_0x46f557,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb08d('0x32')]['syncMusicOnHoldStop']=function(_0x1a3269){try{if(this['isNotNull'](_0x1a3269)){logger['debug'](_0xb08d('0xbe'),_0x1a3269['uniqueid'],util[_0xb08d('0x31')](_0x1a3269,{'showHidden':![],'depth':null}));if(this['channels'][_0x1a3269[_0xb08d('0x37')]]){if(!_[_0xb08d('0x6e')](this[_0xb08d('0x18')][_0x1a3269['uniqueid']][_0xb08d('0xbb')])){this['channels'][_0x1a3269['uniqueid']][_0xb08d('0xbf')]+=moment()[_0xb08d('0xc0')](0x0)[_0xb08d('0x90')](this[_0xb08d('0x18')][_0x1a3269[_0xb08d('0x37')]][_0xb08d('0xbb')],_0xb08d('0x56'));logger[_0xb08d('0x2e')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x1a3269[_0xb08d('0x37')],this['channels'][_0x1a3269[_0xb08d('0x37')]][_0xb08d('0xbf')]);delete this[_0xb08d('0x18')][_0x1a3269[_0xb08d('0x37')]][_0xb08d('0xbb')];}}}}catch(_0x2e78ab){logger[_0xb08d('0x2f')](_0xb08d('0xc1'),_0x1a3269[_0xb08d('0x37')],util[_0xb08d('0x31')](_0x2e78ab,{'showHidden':![],'depth':null}));}};module[_0xb08d('0xc2')]=VoiceCallReport; \ No newline at end of file +var _0x0a35=['origtransfereruniqueid','origtransfererlinkedid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','extension','BLIND','BlindTransfer','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','../rpc/setting','unknown','not_inuse','busy','invalid','ringing','ringinuse','onhold','set','queue','dial','playback','voicemail','NO\x20ANSWER','ANSWERED','BUSY','FAILED','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','varset','syncVarSet','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','isUndefined','prototype','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','uniqueid','linkedid','pick','keys','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','merge','split','[%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','duration','seconds','includes','lastdata','cdr(','match','[%s][voiceCallReport][newexten]','syncNewState','channelstate','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinename','destinationchannel','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','find','monitors','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','type','xmd-queue','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','from-sip','omit','destconnectedlinenum','user:agentcomplete','resolve','transferType','isEmpty','getSettings','then','Action','StopMixMonitor','catch','finally','event','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','syncAttendedTransfer','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid'];(function(_0x76e09b,_0x5d18a3){var _0xd18014=function(_0x47509e){while(--_0x47509e){_0x76e09b['push'](_0x76e09b['shift']());}};_0xd18014(++_0x5d18a3);}(_0x0a35,0xe1));var _0x50a3=function(_0x41f15f,_0x1a39ef){_0x41f15f=_0x41f15f-0x0;var _0x269a71=_0x0a35[_0x41f15f];return _0x269a71;};'use strict';var BPromise=require(_0x50a3('0x0'));var _=require(_0x50a3('0x1'));var moment=require(_0x50a3('0x2'));var util=require(_0x50a3('0x3'));var path=require(_0x50a3('0x4'));var Redis=require(_0x50a3('0x5'));var config=require(_0x50a3('0x6'));var logger=require(_0x50a3('0x7'))(_0x50a3('0x8'));var ami=require('../ami');var Channel=require(_0x50a3('0x9'));var RpcSetting=require(_0x50a3('0xa'));var statusDesc=[_0x50a3('0xb'),_0x50a3('0xc'),'inuse',_0x50a3('0xd'),_0x50a3('0xe'),'unavailable',_0x50a3('0xf'),_0x50a3('0x10'),_0x50a3('0x11')];var applications=[_0x50a3('0x12'),_0x50a3('0x13'),'agi',_0x50a3('0x14'),_0x50a3('0x15'),_0x50a3('0x16')];var dispositions=[_0x50a3('0x17'),'FAILED','FAILED',_0x50a3('0x17'),'NO\x20ANSWER',_0x50a3('0x17'),_0x50a3('0x18'),_0x50a3('0x19'),_0x50a3('0x1a'),'FAILED','FAILED'];var actions={};config[_0x50a3('0x1b')]=_[_0x50a3('0x1c')](config[_0x50a3('0x1b')],{'host':_0x50a3('0x1d'),'port':0x18eb});var io=require(_0x50a3('0x1e'))(new Redis(config['redis']));function VoiceCallReport(_0x16ebce){this[_0x50a3('0x1f')]=_0x16ebce['channels'];this[_0x50a3('0x20')]=_0x16ebce['agents'];this[_0x50a3('0x21')]={};ami['on'](_0x50a3('0x22'),this[_0x50a3('0x23')][_0x50a3('0x24')](this));ami['on'](_0x50a3('0x25'),this[_0x50a3('0x23')][_0x50a3('0x24')](this));ami['on'](_0x50a3('0x26'),this[_0x50a3('0x27')][_0x50a3('0x24')](this));ami['on'](_0x50a3('0x28'),this['syncNewState'][_0x50a3('0x24')](this));ami['on'](_0x50a3('0x29'),this[_0x50a3('0x2a')][_0x50a3('0x24')](this));ami['on']('hangup',this[_0x50a3('0x2b')][_0x50a3('0x24')](this));ami['on'](_0x50a3('0x2c'),this[_0x50a3('0x2d')]['bind'](this));ami['on'](_0x50a3('0x2e'),this['syncAttendedTransfer'][_0x50a3('0x24')](this));ami['on'](_0x50a3('0x2f'),this[_0x50a3('0x30')][_0x50a3('0x24')](this));ami['on'](_0x50a3('0x31'),this[_0x50a3('0x32')]['bind'](this));ami['on'](_0x50a3('0x33'),this[_0x50a3('0x34')][_0x50a3('0x24')](this));try{logger[_0x50a3('0x35')](_0x50a3('0x36'));ami[_0x50a3('0x37')]();}catch(_0x4ad97e){logger[_0x50a3('0x38')](_0x50a3('0x39'),util[_0x50a3('0x3a')](_0x4ad97e,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x2136d0){return _0x2136d0!==null&&!_[_0x50a3('0x3b')](_0x2136d0);};VoiceCallReport['prototype']['emit']=function(_0x8dfeb9,_0x377c1f,_0x5a08b6){io['to'](_0x8dfeb9)['emit'](_0x377c1f,_0x5a08b6);};VoiceCallReport[_0x50a3('0x3c')][_0x50a3('0x2d')]=function(_0x125c86){try{if(this[_0x50a3('0x3d')](_0x125c86)){logger[_0x50a3('0x35')](_0x50a3('0x3e'),_0x125c86['uniqueid'],_0x125c86[_0x50a3('0x3f')],_0x125c86[_0x50a3('0x40')]);logger[_0x50a3('0x41')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x125c86[_0x50a3('0x42')],util['inspect'](_0x125c86,{'showHidden':![],'depth':null}));if(_0x125c86[_0x50a3('0x42')]===_0x125c86[_0x50a3('0x43')]){if(!_[_0x50a3('0x3b')](this['channels'][_0x125c86[_0x50a3('0x42')]])){_['merge'](this['channels'][_0x125c86[_0x50a3('0x42')]],_[_0x50a3('0x44')](_0x125c86,_[_0x50a3('0x45')](this[_0x50a3('0x1f')][_0x125c86[_0x50a3('0x42')]])));}}}}catch(_0x445369){logger[_0x50a3('0x38')](_0x50a3('0x46'),_0x125c86[_0x50a3('0x42')],util[_0x50a3('0x3a')](_0x445369,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x50a3('0x3c')][_0x50a3('0x27')]=function(_0x3076e7){try{if(this[_0x50a3('0x3d')](_0x3076e7)){logger[_0x50a3('0x41')](_0x50a3('0x47'),_0x3076e7[_0x50a3('0x42')],util['inspect'](_0x3076e7,{'showHidden':![],'depth':null}));if(_0x3076e7[_0x50a3('0x42')]===_0x3076e7['linkedid']&&_0x3076e7[_0x50a3('0x48')]!=_0x50a3('0x49')){if(_[_0x50a3('0x3b')](this['channels'][_0x3076e7[_0x50a3('0x42')]])){logger[_0x50a3('0x35')](_0x50a3('0x4a'),_0x3076e7[_0x50a3('0x42')],_0x3076e7[_0x50a3('0x4b')],_0x3076e7[_0x50a3('0x4c')]);this['channels'][_0x3076e7['uniqueid']]=new Channel();this['channels'][_0x3076e7[_0x50a3('0x42')]][_0x50a3('0x4d')]=moment()[_0x50a3('0x4e')](_0x50a3('0x4f'));this['channels'][_0x3076e7[_0x50a3('0x42')]][_0x50a3('0x50')]=dispositions[_[_0x50a3('0x51')](_0x3076e7['channelstate'])];_[_0x50a3('0x52')](this[_0x50a3('0x1f')][_0x3076e7[_0x50a3('0x42')]],_[_0x50a3('0x44')](_0x3076e7,_[_0x50a3('0x45')](this[_0x50a3('0x1f')][_0x3076e7['uniqueid']])));if(_0x3076e7[_0x50a3('0x4b')]==='from-sip'){if(this[_0x50a3('0x20')][_0x3076e7[_0x50a3('0x48')][_0x50a3('0x53')]('-')[0x0]]){this[_0x50a3('0x20')][_0x3076e7[_0x50a3('0x48')][_0x50a3('0x53')]('-')[0x0]]['destconnectedlinenum']=_0x3076e7[_0x50a3('0x4c')];logger[_0x50a3('0x41')](_0x50a3('0x54'),_0x3076e7['uniqueid'],util[_0x50a3('0x3a')]({'destaccountcode':this[_0x50a3('0x20')][_0x3076e7[_0x50a3('0x48')][_0x50a3('0x53')]('-')[0x0]][_0x50a3('0x55')],'destconnectedlinenum':_0x3076e7[_0x50a3('0x4c')]},{'showHidden':![],'depth':null}));this[_0x50a3('0x56')](util['format'](_0x50a3('0x57'),this['agents'][_0x3076e7['channel'][_0x50a3('0x53')]('-')[0x0]][_0x50a3('0x58')]),_0x50a3('0x59'),{'destaccountcode':this[_0x50a3('0x20')][_0x3076e7['channel'][_0x50a3('0x53')]('-')[0x0]][_0x50a3('0x55')],'destconnectedlinenum':_0x3076e7[_0x50a3('0x4c')]});}}}}}}catch(_0x168229){logger[_0x50a3('0x38')](_0x50a3('0x5a'),_0x3076e7[_0x50a3('0x42')],util[_0x50a3('0x3a')](_0x168229,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x50a3('0x3c')][_0x50a3('0x23')]=function(_0x4cc960){try{if(this['isNotNull'](_0x4cc960)){logger['debug'](_0x50a3('0x5b'),_0x4cc960[_0x50a3('0x42')],util['inspect'](_0x4cc960,{'showHidden':![],'depth':null}));if(_0x4cc960[_0x50a3('0x42')]===_0x4cc960[_0x50a3('0x43')]&&_0x4cc960[_0x50a3('0x4c')]!='h'&&_0x4cc960[_0x50a3('0x48')]!=_0x50a3('0x49')){_0x4cc960[_0x50a3('0x5c')]=_0x4cc960[_0x50a3('0x5c')][_0x50a3('0x5d')]();_0x4cc960[_0x50a3('0x5e')]=(_0x4cc960[_0x50a3('0x5f')]||_0x4cc960[_0x50a3('0x5e')])[_0x50a3('0x5d')]();logger[_0x50a3('0x35')](_0x50a3('0x60'),_0x4cc960[_0x50a3('0x42')],_0x4cc960[_0x50a3('0x5c')],_0x4cc960[_0x50a3('0x5e')]);if(_['isUndefined'](this['channels'][_0x4cc960['uniqueid']])){this[_0x50a3('0x1f')][_0x4cc960[_0x50a3('0x42')]]=new Channel();this[_0x50a3('0x1f')][_0x4cc960[_0x50a3('0x42')]][_0x50a3('0x4d')]=_0x4cc960['duration']?moment()['subtract'](moment[_0x50a3('0x61')](_0x4cc960[_0x50a3('0x61')])[_0x50a3('0x62')](),_0x50a3('0x62'))['format'](_0x50a3('0x4f')):moment()[_0x50a3('0x4e')](_0x50a3('0x4f'));this['channels'][_0x4cc960['uniqueid']][_0x50a3('0x50')]=_0x50a3('0x17');}_[_0x50a3('0x52')](this[_0x50a3('0x1f')][_0x4cc960['uniqueid']],_['pick'](_0x4cc960,_[_0x50a3('0x45')](this[_0x50a3('0x1f')][_0x4cc960[_0x50a3('0x42')]])));if(_[_0x50a3('0x63')](applications,_0x4cc960['application'])){this[_0x50a3('0x1f')][_0x4cc960[_0x50a3('0x42')]]['lastapplication']=_0x4cc960['application'];this[_0x50a3('0x1f')][_0x4cc960[_0x50a3('0x42')]][_0x50a3('0x64')]=_0x4cc960[_0x50a3('0x5e')];if(_0x4cc960['application']===_0x50a3('0x12')&&_['startsWith'](_0x4cc960[_0x50a3('0x5e')],_0x50a3('0x65'))){var _0x4b740f=_0x4cc960[_0x50a3('0x5e')][_0x50a3('0x53')]('=');var _0x117ce5=_0x4b740f[0x0][_0x50a3('0x66')](/cdr\((.*)\)/);if(_0x117ce5){this[_0x50a3('0x1f')][_0x4cc960[_0x50a3('0x42')]][_0x117ce5[0x1]]=_0x4b740f[0x1];}}else if(_0x4cc960[_0x50a3('0x5c')]===_0x50a3('0x13')){this[_0x50a3('0x1f')][_0x4cc960[_0x50a3('0x42')]]['queue']=_0x4cc960['applicationdata'][_0x50a3('0x53')](',')[0x0];}}}}}catch(_0x5ab4c7){logger['error'](_0x50a3('0x67'),_0x4cc960['uniqueid'],util['inspect'](_0x5ab4c7,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x50a3('0x68')]=function(_0x3167f9){try{if(this['isNotNull'](_0x3167f9)){logger[_0x50a3('0x35')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x3167f9[_0x50a3('0x42')],_0x3167f9[_0x50a3('0x43')],_0x3167f9[_0x50a3('0x3f')],_0x3167f9['calleridnum']);logger['debug']('[%s][voiceCallReport][newstate]\x20event:',_0x3167f9['uniqueid'],util[_0x50a3('0x3a')](_0x3167f9,{'showHidden':![],'depth':null}));if(_0x3167f9[_0x50a3('0x42')]!==_0x3167f9[_0x50a3('0x43')]){if(this[_0x50a3('0x1f')][_0x3167f9[_0x50a3('0x43')]]){if(_0x3167f9[_0x50a3('0x69')]==='6'){if(!this[_0x50a3('0x1f')][_0x3167f9[_0x50a3('0x43')]][_0x50a3('0x6a')]){var _0x3cd4b2=moment();this[_0x50a3('0x1f')][_0x3167f9['linkedid']][_0x50a3('0x6a')]=!![];this[_0x50a3('0x1f')][_0x3167f9[_0x50a3('0x43')]][_0x50a3('0x6b')]=_0x3cd4b2[_0x50a3('0x4e')](_0x50a3('0x4f'));if(this['channels'][_0x3167f9['linkedid']][_0x50a3('0x4d')]){this[_0x50a3('0x1f')][_0x3167f9[_0x50a3('0x43')]][_0x50a3('0x6c')]=_0x3cd4b2[_0x50a3('0x6d')](this[_0x50a3('0x1f')][_0x3167f9[_0x50a3('0x43')]][_0x50a3('0x4d')],_0x50a3('0x62'));}}this['channels'][_0x3167f9[_0x50a3('0x43')]]['linkedid']=_0x3167f9[_0x50a3('0x42')];if(_0x3167f9[_0x50a3('0x40')]!==_0x50a3('0x6e')){this[_0x50a3('0x1f')][_0x3167f9[_0x50a3('0x43')]]['connectedlinenum']=_0x3167f9[_0x50a3('0x40')];}this[_0x50a3('0x1f')][_0x3167f9[_0x50a3('0x43')]][_0x50a3('0x6f')]=_0x3167f9['calleridname'];this[_0x50a3('0x1f')][_0x3167f9[_0x50a3('0x43')]][_0x50a3('0x70')]=_0x3167f9[_0x50a3('0x48')];this[_0x50a3('0x1f')][_0x3167f9[_0x50a3('0x43')]][_0x50a3('0x50')]=dispositions[_[_0x50a3('0x51')](_0x3167f9[_0x50a3('0x69')])];if(this[_0x50a3('0x20')][_0x3167f9[_0x50a3('0x48')][_0x50a3('0x53')]('-')[0x0]]){this['channels'][_0x3167f9[_0x50a3('0x43')]][_0x50a3('0x71')]=this['agents'][_0x3167f9[_0x50a3('0x48')][_0x50a3('0x53')]('-')[0x0]]['id'];this[_0x50a3('0x1f')][_0x3167f9[_0x50a3('0x43')]][_0x50a3('0x72')]=this['agents'][_0x3167f9[_0x50a3('0x48')][_0x50a3('0x53')]('-')[0x0]][_0x50a3('0x58')];}}}}else{if(this[_0x50a3('0x1f')][_0x3167f9[_0x50a3('0x42')]]){if(_0x3167f9[_0x50a3('0x69')]==='6'){if(this[_0x50a3('0x20')][_0x3167f9[_0x50a3('0x48')][_0x50a3('0x53')]('-')[0x0]]){this[_0x50a3('0x1f')][_0x3167f9[_0x50a3('0x42')]]['UserId']=this[_0x50a3('0x20')][_0x3167f9[_0x50a3('0x48')]['split']('-')[0x0]]['id'];this['channels'][_0x3167f9[_0x50a3('0x42')]][_0x50a3('0x72')]=this['agents'][_0x3167f9['channel'][_0x50a3('0x53')]('-')[0x0]][_0x50a3('0x58')];}}}}}}catch(_0x2b0a96){logger[_0x50a3('0x38')](_0x50a3('0x73'),_0x3167f9[_0x50a3('0x42')],util[_0x50a3('0x3a')](_0x2b0a96,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x50a3('0x3c')][_0x50a3('0x74')]=function(_0x5dc6d0,_0x998a30){try{if(this[_0x50a3('0x1f')][_0x5dc6d0]){logger[_0x50a3('0x35')](_0x50a3('0x75'),_0x5dc6d0,_0x998a30);this[_0x50a3('0x1f')][_0x5dc6d0][_0x50a3('0x76')]=!![];if(_[_0x50a3('0x77')](_0x998a30,_0x50a3('0x78'))){_0x998a30=_0x998a30[_0x50a3('0x79')](_0x50a3('0x78'),_0x50a3('0x7a'));}this[_0x50a3('0x1f')][_0x5dc6d0]['monitorFilename']=_0x998a30;var _0x4d4c0f=_[_0x50a3('0x7b')](this[_0x50a3('0x1f')][_0x5dc6d0][_0x50a3('0x7c')],{'filename':_0x998a30});if(_['isNil'](_0x4d4c0f)){this['channels'][_0x5dc6d0][_0x50a3('0x7c')][_0x50a3('0x7d')]({'filename':_0x998a30,'createdAt':moment()[_0x50a3('0x4e')](_0x50a3('0x4f')),'mixmonitorid':'','status':_0x50a3('0x7e')});}}}catch(_0x3ecabe){logger[_0x50a3('0x38')]('[%s][voiceCallReport][mixMonitorFilename]',_0x5dc6d0,util['inspect'](_0x3ecabe,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x50a3('0x2a')]=function(_0x5b24d4){try{if(this['isNotNull'](_0x5b24d4)){logger[_0x50a3('0x41')](_0x50a3('0x7f'),_0x5b24d4[_0x50a3('0x42')],util[_0x50a3('0x3a')](_0x5b24d4,{'showHidden':![],'depth':null}));if(this[_0x50a3('0x1f')][_0x5b24d4[_0x50a3('0x42')]]&&_0x5b24d4[_0x50a3('0x48')]!=_0x50a3('0x49')){if(this[_0x50a3('0x3d')](_0x5b24d4['variable'])){if(this[_0x50a3('0x3d')](_0x5b24d4[_0x50a3('0x80')][_0x50a3('0x81')])){logger[_0x50a3('0x35')](_0x50a3('0x82'),_0x5b24d4['uniqueid'],_0x5b24d4[_0x50a3('0x83')]);this['syncMixMonitorFilename'](_0x5b24d4['uniqueid'],_0x5b24d4[_0x50a3('0x83')]);}else if(this[_0x50a3('0x3d')](_0x5b24d4['variable'][_0x50a3('0x84')])){logger[_0x50a3('0x35')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x5b24d4[_0x50a3('0x42')],_0x5b24d4[_0x50a3('0x83')]);this[_0x50a3('0x1f')][_0x5b24d4[_0x50a3('0x42')]][_0x50a3('0x40')]=_0x5b24d4[_0x50a3('0x83')];}else if(this[_0x50a3('0x3d')](_0x5b24d4[_0x50a3('0x80')][_0x50a3('0x85')])){logger[_0x50a3('0x35')](_0x50a3('0x86'),_0x5b24d4[_0x50a3('0x42')],_0x5b24d4[_0x50a3('0x83')]);this[_0x50a3('0x1f')][_0x5b24d4[_0x50a3('0x42')]][_0x50a3('0x87')]=_0x5b24d4[_0x50a3('0x83')];}else if(this['isNotNull'](_0x5b24d4[_0x50a3('0x80')]['xmd-cdrtype'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x5b24d4[_0x50a3('0x42')],_0x5b24d4[_0x50a3('0x83')]);this[_0x50a3('0x1f')][_0x5b24d4[_0x50a3('0x42')]][_0x50a3('0x88')]=_0x5b24d4['value'];}else if(this[_0x50a3('0x3d')](_0x5b24d4['variable'][_0x50a3('0x89')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x5b24d4[_0x50a3('0x42')],_0x5b24d4[_0x50a3('0x83')][_0x50a3('0x53')](',')[0x0]);this['channels'][_0x5b24d4[_0x50a3('0x42')]][_0x50a3('0x13')]=_0x5b24d4[_0x50a3('0x83')]['split'](',')[0x0];}else if(this[_0x50a3('0x3d')](_0x5b24d4[_0x50a3('0x80')][_0x50a3('0x8a')])){logger[_0x50a3('0x35')](_0x50a3('0x8b'),_0x5b24d4[_0x50a3('0x42')],_0x5b24d4[_0x50a3('0x83')]);this[_0x50a3('0x1f')][_0x5b24d4[_0x50a3('0x42')]][_0x50a3('0x8c')]=_0x5b24d4[_0x50a3('0x83')];}else if(this['isNotNull'](_0x5b24d4[_0x50a3('0x80')][_0x50a3('0x8d')])){logger[_0x50a3('0x35')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x5b24d4[_0x50a3('0x42')],_0x5b24d4[_0x50a3('0x83')]);this[_0x50a3('0x1f')][_0x5b24d4[_0x50a3('0x42')]][_0x50a3('0x8e')]=_0x5b24d4[_0x50a3('0x83')];}else if(this[_0x50a3('0x3d')](_0x5b24d4[_0x50a3('0x80')][_0x50a3('0x8f')])){logger[_0x50a3('0x35')](_0x50a3('0x90'),_0x5b24d4['uniqueid'],_0x5b24d4[_0x50a3('0x83')]);this['channels'][_0x5b24d4['uniqueid']][_0x50a3('0x91')]=_0x5b24d4[_0x50a3('0x83')];}else if(this[_0x50a3('0x3d')](_0x5b24d4[_0x50a3('0x80')]['xmcs-queue'])){logger['info'](_0x50a3('0x92'),_0x5b24d4[_0x50a3('0x42')],_0x5b24d4[_0x50a3('0x83')]);this[_0x50a3('0x1f')][_0x5b24d4['uniqueid']][_0x50a3('0x13')]=_0x5b24d4[_0x50a3('0x83')];}else if(this[_0x50a3('0x3d')](_0x5b24d4[_0x50a3('0x80')][_0x50a3('0x93')])){logger[_0x50a3('0x35')](_0x50a3('0x94'),_0x5b24d4['uniqueid'],_0x5b24d4[_0x50a3('0x83')]);this[_0x50a3('0x1f')][_0x5b24d4[_0x50a3('0x42')]]['sipcalluniqueid']=_0x5b24d4[_0x50a3('0x83')];}}}else if(this[_0x50a3('0x3d')](_0x5b24d4[_0x50a3('0x80')][_0x50a3('0x81')])){if(_0x5b24d4[_0x50a3('0x83')]){var _0x318df6=path[_0x50a3('0x95')](_0x5b24d4[_0x50a3('0x83')])[_0x50a3('0x58')];logger[_0x50a3('0x35')](_0x50a3('0x82'),_0x318df6,_0x5b24d4[_0x50a3('0x83')]);this['syncMixMonitorFilename'](_0x318df6,_0x5b24d4[_0x50a3('0x83')]);}}else if(this[_0x50a3('0x1f')][_0x5b24d4[_0x50a3('0x43')]]){if(this[_0x50a3('0x3d')](_0x5b24d4[_0x50a3('0x80')])){if(this[_0x50a3('0x3d')](_0x5b24d4[_0x50a3('0x80')][_0x50a3('0x93')])){logger[_0x50a3('0x35')](_0x50a3('0x94'),_0x5b24d4['linkedid'],_0x5b24d4['value']);this[_0x50a3('0x1f')][_0x5b24d4['linkedid']][_0x50a3('0x96')]=_0x5b24d4['value'];}}}}}catch(_0x3ed780){logger[_0x50a3('0x38')](_0x50a3('0x97'),_0x5b24d4['uniqueid'],util[_0x50a3('0x3a')](_0x3ed780,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x50a3('0x3c')]['syncHangup']=function(_0x110ee1){try{if(this[_0x50a3('0x3d')](_0x110ee1)){logger[_0x50a3('0x41')]('[%s][voiceCallReport][hangup]\x20event:',_0x110ee1[_0x50a3('0x42')],util[_0x50a3('0x3a')](_0x110ee1,{'showHidden':![],'depth':null}));if(this[_0x50a3('0x1f')][_0x110ee1[_0x50a3('0x42')]]){logger[_0x50a3('0x35')](_0x50a3('0x98'),_0x110ee1['uniqueid'],_0x110ee1[_0x50a3('0x99')]);var _0x312cae=moment();this[_0x50a3('0x1f')][_0x110ee1[_0x50a3('0x42')]][_0x50a3('0x9a')]=_0x312cae[_0x50a3('0x4e')](_0x50a3('0x4f'));this['channels'][_0x110ee1['uniqueid']][_0x50a3('0x61')]=_0x312cae[_0x50a3('0x6d')](this['channels'][_0x110ee1['uniqueid']][_0x50a3('0x4d')],_0x50a3('0x62'));if(this[_0x50a3('0x1f')][_0x110ee1[_0x50a3('0x42')]][_0x50a3('0x6a')]){this[_0x50a3('0x1f')][_0x110ee1[_0x50a3('0x42')]][_0x50a3('0x9b')]=_0x312cae['diff'](this[_0x50a3('0x1f')][_0x110ee1['uniqueid']][_0x50a3('0x6b')],'seconds');this[_0x50a3('0x1f')][_0x110ee1[_0x50a3('0x42')]][_0x50a3('0x6c')]=this[_0x50a3('0x1f')][_0x110ee1[_0x50a3('0x42')]][_0x50a3('0x61')]-this[_0x50a3('0x1f')][_0x110ee1[_0x50a3('0x42')]][_0x50a3('0x9b')];}if(_0x110ee1[_0x50a3('0x4b')]===_0x50a3('0x9c')){if(this['agents'][_0x110ee1[_0x50a3('0x48')][_0x50a3('0x53')]('-')[0x0]]){this['agents'][_0x110ee1[_0x50a3('0x48')][_0x50a3('0x53')]('-')[0x0]]=_[_0x50a3('0x9d')](this[_0x50a3('0x20')][_0x110ee1[_0x50a3('0x48')]['split']('-')[0x0]],[_0x50a3('0x9e')]);logger[_0x50a3('0x41')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x110ee1[_0x50a3('0x42')],util[_0x50a3('0x3a')]({'destaccountcode':this[_0x50a3('0x20')][_0x110ee1[_0x50a3('0x48')]['split']('-')[0x0]][_0x50a3('0x55')]},{'showHidden':![],'depth':null}));this[_0x50a3('0x56')](util[_0x50a3('0x4e')](_0x50a3('0x57'),this[_0x50a3('0x20')][_0x110ee1[_0x50a3('0x48')][_0x50a3('0x53')]('-')[0x0]][_0x50a3('0x58')]),_0x50a3('0x9f'),{'destaccountcode':this[_0x50a3('0x20')][_0x110ee1['channel']['split']('-')[0x0]][_0x50a3('0x55')]});}}var _0x45661e=this;Promise[_0x50a3('0xa0')]()['then'](function(){var _0xa908f1=_0x45661e[_0x50a3('0x1f')][_0x110ee1['uniqueid']];if(typeof _0xa908f1[_0x50a3('0xa1')]==='undefined')return;if(_[_0x50a3('0xa2')](_0xa908f1['monitors']))return;return RpcSetting[_0x50a3('0xa3')]()[_0x50a3('0xa4')](function(_0x452cf1){if(!_0x452cf1['stopRecordingOnTransfer'])return;return Promise[_0x50a3('0xa0')]()['then'](function(){return ami[_0x50a3('0xa5')]({'action':_0x50a3('0xa6'),'channel':_0xa908f1[_0x50a3('0x48')]})[_0x50a3('0xa7')](function(){});})[_0x50a3('0xa4')](function(){return ami[_0x50a3('0xa5')]({'action':'StopMixMonitor','channel':_0xa908f1[_0x50a3('0x70')]})[_0x50a3('0xa7')](function(){})[_0x50a3('0xa8')](function(){var _0x30c2ae=_0x45661e['agents'][_0xa908f1[_0x50a3('0x70')]['split']('-')[0x0]];if(!_0x30c2ae)return;io['emit']('webbar:stopmonitors',{'agentId':_0x30c2ae['id'],'uniqueid':_0xa908f1[_0x50a3('0x42')]});});});});})[_0x50a3('0xa4')](function(){if(_0x110ee1[_0x50a3('0xa9')]==='BlindTransfer'){_0x45661e[_0x50a3('0x21')][_0x110ee1['uniqueid']]=_0x45661e[_0x50a3('0x1f')][_0x110ee1[_0x50a3('0x42')]];}else{if(_0x45661e['channels'][_0x110ee1['uniqueid']][_0x50a3('0x88')]===_0x50a3('0xaa')&&_0x45661e[_0x50a3('0x21')][_0x110ee1[_0x50a3('0x42')]]){_0x45661e[_0x50a3('0x1f')][_0x110ee1[_0x50a3('0x42')]][_0x50a3('0x42')]=[_0x45661e[_0x50a3('0x1f')][_0x110ee1[_0x50a3('0x42')]][_0x50a3('0x43')],_0x45661e[_0x50a3('0x1f')][_0x110ee1[_0x50a3('0x42')]][_0x50a3('0x43')]=_0x45661e[_0x50a3('0x1f')][_0x110ee1[_0x50a3('0x42')]][_0x50a3('0x42')]][0x0];delete _0x45661e['blindTransfers'][_0x110ee1[_0x50a3('0x42')]];}}logger['debug'](_0x50a3('0xab'),_0x110ee1['uniqueid'],util['inspect'](_0x45661e[_0x50a3('0x1f')][_0x110ee1[_0x50a3('0x42')]],{'showHidden':![],'depth':null}));ami[_0x50a3('0x56')](_0x50a3('0xac'),_0x45661e[_0x50a3('0x1f')][_0x110ee1[_0x50a3('0x42')]]);delete _0x45661e[_0x50a3('0x1f')][_0x110ee1['uniqueid']];});}}}catch(_0xd79581){logger['error'](_0x50a3('0xad'),_0x110ee1[_0x50a3('0x42')],util[_0x50a3('0x3a')](_0xd79581,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x50a3('0x3c')][_0x50a3('0xae')]=function(_0x10a2ab){try{if(this[_0x50a3('0x3d')](_0x10a2ab)){logger[_0x50a3('0x35')]('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x10a2ab[_0x50a3('0x42')],_0x10a2ab['origtransferercalleridnum'],_0x10a2ab[_0x50a3('0xaf')]);logger[_0x50a3('0x41')](_0x50a3('0xb0'),_0x10a2ab[_0x50a3('0x42')],util[_0x50a3('0x3a')](_0x10a2ab,{'showHidden':![],'depth':null}));if(this['channels'][_0x10a2ab[_0x50a3('0xb1')]]){this[_0x50a3('0x1f')][_0x10a2ab[_0x50a3('0xb1')]][_0x50a3('0xb2')]=_0x10a2ab[_0x50a3('0xb3')];this[_0x50a3('0x1f')][_0x10a2ab[_0x50a3('0xb1')]][_0x50a3('0xb4')]=_0x10a2ab['transfertargetcalleridnum'];if(this['channels'][_0x10a2ab[_0x50a3('0xb5')]]){var _0x58b9d8=this[_0x50a3('0x1f')][_0x10a2ab[_0x50a3('0xb5')]];this[_0x50a3('0x1f')][_0x10a2ab[_0x50a3('0xb5')]]=this[_0x50a3('0x1f')][_0x10a2ab[_0x50a3('0xb1')]];this[_0x50a3('0x1f')][_0x10a2ab[_0x50a3('0xb1')]]=_0x58b9d8;}}else if(this[_0x50a3('0x1f')][_0x10a2ab[_0x50a3('0xb6')]]){this[_0x50a3('0x1f')][_0x10a2ab[_0x50a3('0xb6')]]['transfercalleridnum']=_0x10a2ab[_0x50a3('0xb3')];this['channels'][_0x10a2ab[_0x50a3('0xb6')]][_0x50a3('0xb4')]=_0x10a2ab[_0x50a3('0xaf')];if(this[_0x50a3('0x1f')][_0x10a2ab[_0x50a3('0xb7')]]){var _0x58b9d8=this[_0x50a3('0x1f')][_0x10a2ab['origtransfereruniqueid']];this[_0x50a3('0x1f')][_0x10a2ab[_0x50a3('0xb7')]]=this[_0x50a3('0x1f')][_0x10a2ab[_0x50a3('0xb6')]];this[_0x50a3('0x1f')][_0x10a2ab[_0x50a3('0xb6')]]=_0x58b9d8;}}if((this[_0x50a3('0x1f')][_0x10a2ab[_0x50a3('0xb7')]]||this['channels'][_0x10a2ab[_0x50a3('0xb8')]])&&this[_0x50a3('0x1f')][_0x10a2ab[_0x50a3('0xb5')]]){var _0x40e617=_['some']([this[_0x50a3('0x1f')][_0x10a2ab['origtransfereruniqueid']],this[_0x50a3('0x1f')][_0x10a2ab[_0x50a3('0xb8')]],this[_0x50a3('0x1f')][_0x10a2ab['secondtransfereruniqueid']]],function(_0x2f147f){return _0x2f147f&&_0x2f147f[_0x50a3('0x88')]==='outbound'&&_0x2f147f['routeid'];});if(_0x40e617){if(this[_0x50a3('0x1f')][_0x10a2ab['origtransfereruniqueid']])this[_0x50a3('0x1f')][_0x10a2ab['origtransfereruniqueid']][_0x50a3('0xa1')]=_0x50a3('0xb9');if(this[_0x50a3('0x1f')][_0x10a2ab[_0x50a3('0xb8')]])this[_0x50a3('0x1f')][_0x10a2ab['origtransfererlinkedid']][_0x50a3('0xa1')]=_0x50a3('0xb9');this[_0x50a3('0x1f')][_0x10a2ab[_0x50a3('0xb5')]][_0x50a3('0xa1')]=_0x50a3('0xb9');}}}}catch(_0xc7f534){logger[_0x50a3('0x38')](_0x50a3('0xba'),_0x10a2ab[_0x50a3('0x42')],util[_0x50a3('0x3a')](_0xc7f534,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x50a3('0x3c')][_0x50a3('0x30')]=function(_0x9092aa){try{if(this[_0x50a3('0x3d')](_0x9092aa)){logger[_0x50a3('0x35')](_0x50a3('0xbb'),_0x9092aa[_0x50a3('0x42')],_0x9092aa[_0x50a3('0xbc')],_0x9092aa['extension']);logger[_0x50a3('0x41')](_0x50a3('0xbd'),_0x9092aa['uniqueid'],util[_0x50a3('0x3a')](_0x9092aa,{'showHidden':![],'depth':null}));if(this['channels'][_0x9092aa['transfereeuniqueid']]){this[_0x50a3('0x1f')][_0x9092aa[_0x50a3('0xb1')]][_0x50a3('0xb2')]=_0x9092aa[_0x50a3('0xbc')];this[_0x50a3('0x1f')][_0x9092aa['transfereeuniqueid']][_0x50a3('0xb4')]=_0x9092aa[_0x50a3('0xbe')];this[_0x50a3('0x1f')][_0x9092aa[_0x50a3('0xb1')]][_0x50a3('0xa1')]=_0x50a3('0xbf');this['syncHangup']({'event':_0x50a3('0xc0'),'uniqueid':_0x9092aa[_0x50a3('0xb1')],'context':_0x9092aa[_0x50a3('0x4b')],'channel':_0x9092aa['transfererchannel']});}else{this[_0x50a3('0x1f')][_0x9092aa[_0x50a3('0xc1')]][_0x50a3('0xa1')]='BLIND';}}}catch(_0x31a871){logger[_0x50a3('0x38')](_0x50a3('0xc2'),_0x9092aa[_0x50a3('0x42')],util[_0x50a3('0x3a')](_0x31a871,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x50a3('0x3c')][_0x50a3('0x32')]=function(_0x12cc5a){try{if(this[_0x50a3('0x3d')](_0x12cc5a)){logger[_0x50a3('0x41')](_0x50a3('0xc3'),_0x12cc5a[_0x50a3('0x42')],util[_0x50a3('0x3a')](_0x12cc5a,{'showHidden':![],'depth':null}));if(this[_0x50a3('0x1f')][_0x12cc5a[_0x50a3('0x42')]]){if(!_[_0x50a3('0xc4')](this[_0x50a3('0x1f')][_0x12cc5a['uniqueid']]['answertime'])){this[_0x50a3('0x1f')][_0x12cc5a[_0x50a3('0x42')]][_0x50a3('0xc5')]=moment()[_0x50a3('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');logger['info'](_0x50a3('0xc6'),_0x12cc5a[_0x50a3('0x42')],this[_0x50a3('0x1f')][_0x12cc5a['uniqueid']][_0x50a3('0xc5')]);}}}}catch(_0x508415){logger[_0x50a3('0x38')](_0x50a3('0xc7'),_0x12cc5a[_0x50a3('0x42')],util['inspect'](_0x508415,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x50a3('0x3c')][_0x50a3('0x34')]=function(_0x210413){try{if(this['isNotNull'](_0x210413)){logger[_0x50a3('0x41')](_0x50a3('0xc8'),_0x210413[_0x50a3('0x42')],util[_0x50a3('0x3a')](_0x210413,{'showHidden':![],'depth':null}));if(this[_0x50a3('0x1f')][_0x210413[_0x50a3('0x42')]]){if(!_[_0x50a3('0xc4')](this['channels'][_0x210413[_0x50a3('0x42')]][_0x50a3('0xc5')])){this[_0x50a3('0x1f')][_0x210413[_0x50a3('0x42')]]['mohtime']+=moment()[_0x50a3('0xc9')](0x0)['diff'](this['channels'][_0x210413[_0x50a3('0x42')]][_0x50a3('0xc5')],_0x50a3('0x62'));logger[_0x50a3('0x35')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x210413['uniqueid'],this[_0x50a3('0x1f')][_0x210413[_0x50a3('0x42')]]['mohtime']);delete this[_0x50a3('0x1f')][_0x210413['uniqueid']][_0x50a3('0xc5')];}}}}catch(_0x2c0c78){logger[_0x50a3('0x38')](_0x50a3('0xca'),_0x210413[_0x50a3('0x42')],util[_0x50a3('0x3a')](_0x2c0c78,{'showHidden':![],'depth':null}));}};module[_0x50a3('0xcb')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index e3b992d..4d06007 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 _0x99d2=['error','[%s][voiceDialReport][varset]\x20event:','addVariable','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','syncHangup','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','diff','starttime','seconds','lastevent','complete','answertime','answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','duration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','exports','lodash','moment','ioredis','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','bind','syncDialEnd','syncVarSet','hangup','isNotNull','isUndefined','prototype','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','privilege','info','[%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][dialend]\x20event:','dialstatus','connectedlinenum','connectedlinename','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:'];(function(_0x3bd1f7,_0x559b7c){var _0x5935e3=function(_0x3fcc1c){while(--_0x3fcc1c){_0x3bd1f7['push'](_0x3bd1f7['shift']());}};_0x5935e3(++_0x559b7c);}(_0x99d2,0x1e0));var _0x299d=function(_0x4ca869,_0x1477b7){_0x4ca869=_0x4ca869-0x0;var _0x139ad5=_0x99d2[_0x4ca869];return _0x139ad5;};'use strict';var _=require(_0x299d('0x0'));var moment=require(_0x299d('0x1'));var util=require('util');var Redis=require(_0x299d('0x2'));var config=require('../../../config/environment');var logger=require(_0x299d('0x3'))('ami');var ami=require(_0x299d('0x4'));config[_0x299d('0x5')]=_[_0x299d('0x6')](config['redis'],{'host':_0x299d('0x7'),'port':0x18eb});var io=require(_0x299d('0x8'))(new Redis(config['redis']));function VoiceDialReport(_0xbbe58){this[_0x299d('0x9')]=_0xbbe58[_0x299d('0xa')];this['outbound']=_0xbbe58[_0x299d('0xb')];this[_0x299d('0xc')]={};ami['on'](_0x299d('0xd'),this['syncDialBegin'][_0x299d('0xe')](this));ami['on']('dialend',this[_0x299d('0xf')]['bind'](this));ami['on']('varset',this[_0x299d('0x10')]['bind'](this));ami['on'](_0x299d('0x11'),this['syncHangup']['bind'](this));}VoiceDialReport['prototype'][_0x299d('0x12')]=function(_0x1ed731){return _0x1ed731!==null&&!_[_0x299d('0x13')](_0x1ed731);};VoiceDialReport[_0x299d('0x14')][_0x299d('0x15')]=function(_0x47eb94,_0x1b4032,_0x408d80){io['to'](_0x47eb94)[_0x299d('0x15')](_0x1b4032,_0x408d80);};VoiceDialReport[_0x299d('0x14')]['syncDialBegin']=function(_0x1daa3b){try{if(this['isNotNull'](_0x1daa3b)){logger[_0x299d('0x16')](_0x299d('0x17'),_0x1daa3b[_0x299d('0x18')],util[_0x299d('0x19')](_0x1daa3b,{'showHidden':![],'depth':null}));if(this['channels'][_0x1daa3b[_0x299d('0x18')]]){_[_0x299d('0x1a')](this['channels'][_0x1daa3b[_0x299d('0x18')]],{'starttime':moment()[_0x299d('0x1b')](_0x299d('0x1c')),'lastevent':_0x299d('0x1d'),'interface':_0x1daa3b[_0x299d('0x1e')]['substring'](0x0,_0x1daa3b[_0x299d('0x1e')]['lastIndexOf']('-')),'membername':_0x1daa3b[_0x299d('0x1e')][_0x299d('0x1f')](_0x1daa3b[_0x299d('0x1e')][_0x299d('0x20')]('/')+0x1,_0x1daa3b[_0x299d('0x1e')][_0x299d('0x20')]('-'))},_[_0x299d('0x21')](_0x1daa3b,['event',_0x299d('0x22')]));logger[_0x299d('0x23')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x1daa3b['uniqueid'],this[_0x299d('0x9')][_0x1daa3b['uniqueid']]['membername'],this[_0x299d('0x9')][_0x1daa3b[_0x299d('0x18')]]['interface']);logger[_0x299d('0x16')](_0x299d('0x24'),_0x1daa3b[_0x299d('0x18')],util['inspect'](this[_0x299d('0x9')][_0x1daa3b[_0x299d('0x18')]],{'showHidden':![],'depth':null}));this[_0x299d('0x15')](_0x299d('0x25'),_0x299d('0x26'),this[_0x299d('0x9')][_0x1daa3b['uniqueid']]);logger['debug'](_0x299d('0x27'),_0x1daa3b[_0x299d('0x18')],util[_0x299d('0x19')](this[_0x299d('0x9')][_0x1daa3b[_0x299d('0x18')]],{'showHidden':![],'depth':null}));ami[_0x299d('0x15')](_0x299d('0x28'),this[_0x299d('0x9')][_0x1daa3b[_0x299d('0x18')]]);}}}catch(_0x2516b2){logger['error']('[%s][voiceDialReport][dialbegin]',_0x1daa3b[_0x299d('0x18')],util[_0x299d('0x19')](_0x2516b2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x299d('0x14')]['syncDialEnd']=function(_0x1f7703){try{if(this[_0x299d('0x12')](_0x1f7703)){logger['debug'](_0x299d('0x29'),_0x1f7703[_0x299d('0x18')],util[_0x299d('0x19')](_0x1f7703,{'showHidden':![],'depth':null}));if(this[_0x299d('0x9')][_0x1f7703[_0x299d('0x18')]]){this[_0x299d('0x9')][_0x1f7703[_0x299d('0x18')]][_0x299d('0x2a')]=_0x1f7703['dialstatus'];if(_0x1f7703[_0x299d('0x2a')]==='ANSWER'){this[_0x299d('0x9')][_0x1f7703[_0x299d('0x18')]][_0x299d('0x2b')]=_0x1f7703['connectedlinenum'];this[_0x299d('0x9')][_0x1f7703[_0x299d('0x18')]]['connectedlinename']=_0x1f7703[_0x299d('0x2c')];this[_0x299d('0x9')][_0x1f7703[_0x299d('0x18')]]['answertime']=moment()[_0x299d('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x1f7703[_0x299d('0x18')]]['lastevent']=_0x299d('0x2d');logger['info'](_0x299d('0x2e'),_0x1f7703[_0x299d('0x18')],_0x1f7703['channel'][_0x299d('0x1f')](_0x1f7703['channel']['lastIndexOf']('/')+0x1,_0x1f7703[_0x299d('0x1e')][_0x299d('0x20')]('-')));logger[_0x299d('0x16')](_0x299d('0x2f'),_0x1f7703[_0x299d('0x18')],util['inspect'](this[_0x299d('0x9')][_0x1f7703[_0x299d('0x18')]],{'showHidden':![],'depth':null}));ami[_0x299d('0x15')](_0x299d('0x30'),this['channels'][_0x1f7703['uniqueid']]);}logger[_0x299d('0x16')](_0x299d('0x31'),_0x1f7703['uniqueid'],util[_0x299d('0x19')](this['channels'][_0x1f7703['uniqueid']],{'showHidden':![],'depth':null}));this[_0x299d('0x15')]('voice:outbound',_0x299d('0x26'),this[_0x299d('0x9')][_0x1f7703[_0x299d('0x18')]]);}}}catch(_0x2335b7){logger[_0x299d('0x32')]('[%s][voiceDialReport][dialend]',_0x1f7703['uniqueid'],util['inspect'](_0x2335b7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x299d('0x14')][_0x299d('0x10')]=function(_0x1eb736){try{if(this[_0x299d('0x12')](_0x1eb736)){logger[_0x299d('0x16')](_0x299d('0x33'),_0x1eb736[_0x299d('0x18')],util['inspect'](_0x1eb736,{'showHidden':![],'depth':null}));this[_0x299d('0x34')](_0x1eb736[_0x299d('0x18')],_['keys'](_0x1eb736[_0x299d('0x35')])[0x0],_0x1eb736[_0x299d('0x36')]);if(this[_0x299d('0x12')](_0x1eb736[_0x299d('0x35')])&&this['isNotNull'](_0x1eb736[_0x299d('0x35')][_0x299d('0x37')])){if(_[_0x299d('0x13')](this[_0x299d('0x9')][_0x1eb736[_0x299d('0x18')]])){this['channels'][_0x1eb736['uniqueid']]={'routeId':_0x1eb736['value'],'variables':this[_0x299d('0xc')][_0x1eb736[_0x299d('0x18')]]};logger[_0x299d('0x23')](_0x299d('0x38'),_0x1eb736[_0x299d('0x18')],_0x1eb736['variable'][_0x299d('0x37')],_[_0x299d('0x39')](_0x1eb736[_0x299d('0x35')])[0x0],_0x1eb736['value']);logger['debug'](_0x299d('0x3a'),_0x1eb736['uniqueid'],util[_0x299d('0x19')](this[_0x299d('0x9')][_0x1eb736['uniqueid']],{'showHidden':![],'depth':null}));this[_0x299d('0x15')](_0x299d('0x25'),'voice_outbound_channel:save',this[_0x299d('0x9')][_0x1eb736[_0x299d('0x18')]]);}}}}catch(_0x3a7563){logger[_0x299d('0x32')](_0x299d('0x3b'),_0x1eb736[_0x299d('0x18')],util[_0x299d('0x19')](_0x3a7563,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x299d('0x14')]['addVariable']=function(_0x2c44df,_0x2b100c,_0x46ca86){var _0xb6b460=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x299d('0x3c'),_0x299d('0x3d'),_0x299d('0x3e'),_0x299d('0x3f'),_0x299d('0x40'),_0x299d('0x41'),'bridgepeer',_0x299d('0x42'),_0x299d('0x43'),_0x299d('0x44'),_0x299d('0x45'),_0x299d('0x46'),_0x299d('0x47'),_0x299d('0x48'),_0x299d('0x49')];if(!_[_0x299d('0x4a')](_0x2b100c)&&!_[_0x299d('0x4b')](_0xb6b460,_0x2b100c)){if(_['isUndefined'](this[_0x299d('0xc')][_0x2c44df])){this[_0x299d('0xc')][_0x2c44df]={};}this[_0x299d('0xc')][_0x2c44df][_0x2b100c]=_0x46ca86;}};VoiceDialReport['prototype'][_0x299d('0x4c')]=function(_0xc5ff92){try{if(this[_0x299d('0x12')](_0xc5ff92)){logger[_0x299d('0x16')](_0x299d('0x4d'),_0xc5ff92['uniqueid'],util[_0x299d('0x19')](_0xc5ff92,{'showHidden':![],'depth':null}));if(this[_0x299d('0x9')][_0xc5ff92[_0x299d('0x18')]]){logger['info'](_0x299d('0x4e'),_0xc5ff92[_0x299d('0x18')],_0xc5ff92[_0x299d('0x4f')]);this['channels'][_0xc5ff92['uniqueid']][_0x299d('0x50')]=moment()[_0x299d('0x1b')](_0x299d('0x1c'));this[_0x299d('0x9')][_0xc5ff92[_0x299d('0x18')]]['duration']=moment(this[_0x299d('0x9')][_0xc5ff92[_0x299d('0x18')]][_0x299d('0x50')])[_0x299d('0x51')](this[_0x299d('0x9')][_0xc5ff92[_0x299d('0x18')]][_0x299d('0x52')],_0x299d('0x53'));this[_0x299d('0x9')][_0xc5ff92[_0x299d('0x18')]][_0x299d('0x54')]=_0x299d('0x55');this[_0x299d('0xb')]['total']+=0x1;if(this[_0x299d('0x9')][_0xc5ff92[_0x299d('0x18')]][_0x299d('0x56')]){this[_0x299d('0xb')][_0x299d('0x57')]+=0x1;this['channels'][_0xc5ff92[_0x299d('0x18')]][_0x299d('0x58')]=moment(this[_0x299d('0x9')][_0xc5ff92[_0x299d('0x18')]][_0x299d('0x56')])[_0x299d('0x51')](this[_0x299d('0x9')][_0xc5ff92['uniqueid']][_0x299d('0x52')],_0x299d('0x53'));this[_0x299d('0x9')][_0xc5ff92[_0x299d('0x18')]][_0x299d('0x59')]=moment(this[_0x299d('0x9')][_0xc5ff92[_0x299d('0x18')]][_0x299d('0x50')])[_0x299d('0x51')](this['channels'][_0xc5ff92[_0x299d('0x18')]][_0x299d('0x56')],_0x299d('0x53'));this[_0x299d('0xb')][_0x299d('0x5a')]+=this[_0x299d('0x9')][_0xc5ff92[_0x299d('0x18')]][_0x299d('0x58')]||0x0;this['outbound'][_0x299d('0x5b')]+=this[_0x299d('0x9')][_0xc5ff92[_0x299d('0x18')]][_0x299d('0x59')];}this[_0x299d('0xb')][_0x299d('0x5c')]+=this['channels'][_0xc5ff92[_0x299d('0x18')]][_0x299d('0x5d')];logger[_0x299d('0x16')](_0x299d('0x5e'),_0xc5ff92[_0x299d('0x18')],util['inspect'](this[_0x299d('0x9')][_0xc5ff92[_0x299d('0x18')]],{'showHidden':![],'depth':null}));ami['emit'](_0x299d('0x5f'),this[_0x299d('0x9')][_0xc5ff92['uniqueid']]);logger[_0x299d('0x16')](_0x299d('0x60'),_0xc5ff92[_0x299d('0x18')],util['inspect'](this[_0x299d('0x9')][_0xc5ff92[_0x299d('0x18')]],{'showHidden':![],'depth':null}));ami['emit'](_0x299d('0x61'),this['channels'][_0xc5ff92[_0x299d('0x18')]]);logger[_0x299d('0x16')](_0x299d('0x62'),_0xc5ff92[_0x299d('0x18')],util[_0x299d('0x19')](this[_0x299d('0x9')][_0xc5ff92['uniqueid']],{'showHidden':![],'depth':null}));this[_0x299d('0x15')](_0x299d('0x25'),_0x299d('0x63'),this[_0x299d('0xb')]);logger['info']('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x299d('0x64')](this['channels'][_0xc5ff92[_0x299d('0x18')]]));logger['debug'](_0x299d('0x65'),_0xc5ff92[_0x299d('0x18')],util[_0x299d('0x19')](this[_0x299d('0x9')][_0xc5ff92[_0x299d('0x18')]],{'showHidden':![],'depth':null}));this[_0x299d('0x15')](_0x299d('0x25'),_0x299d('0x66'),this[_0x299d('0x9')][_0xc5ff92['uniqueid']]);delete this['channels'][_0xc5ff92['uniqueid']];}else if(this[_0x299d('0x9')][_0xc5ff92['linkedid']]){this[_0x299d('0x9')][_0xc5ff92[_0x299d('0x67')]][_0x299d('0x18')]=this[_0x299d('0x9')][_0xc5ff92[_0x299d('0x67')]][_0x299d('0x68')];}if(this[_0x299d('0xc')][_0xc5ff92[_0x299d('0x18')]]){delete this[_0x299d('0xc')][_0xc5ff92[_0x299d('0x18')]];}}}catch(_0x41393b){logger[_0x299d('0x32')]('[%s][voiceDialReport][hangup]',_0xc5ff92[_0x299d('0x18')],util[_0x299d('0x19')](_0x41393b,{'showHidden':![],'depth':null}));}};module[_0x299d('0x69')]=VoiceDialReport; \ No newline at end of file +var _0xd417=['privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','outboundrouteid','value','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','endtime','duration','diff','starttime','seconds','complete','total','answered','holdtime','sumHoldTime','sumBillable','billableseconds','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:','voice_outbound:save','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','exports','lodash','moment','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','outbound','variables','syncDialBegin','bind','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','channels','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit'];(function(_0x45403e,_0x120ffc){var _0x5d8d32=function(_0x4a0da5){while(--_0x4a0da5){_0x45403e['push'](_0x45403e['shift']());}};_0x5d8d32(++_0x120ffc);}(_0xd417,0x10a));var _0x7d41=function(_0x538536,_0xbe20f5){_0x538536=_0x538536-0x0;var _0x3dff5d=_0xd417[_0x538536];return _0x3dff5d;};'use strict';var _=require(_0x7d41('0x0'));var moment=require(_0x7d41('0x1'));var util=require('util');var Redis=require(_0x7d41('0x2'));var config=require(_0x7d41('0x3'));var logger=require('../../../config/logger')('ami');var ami=require('../ami');config[_0x7d41('0x4')]=_['defaults'](config[_0x7d41('0x4')],{'host':_0x7d41('0x5'),'port':0x18eb});var io=require(_0x7d41('0x6'))(new Redis(config[_0x7d41('0x4')]));function VoiceDialReport(_0x2f7716){this['channels']=_0x2f7716['outboundChannels'];this[_0x7d41('0x7')]=_0x2f7716[_0x7d41('0x7')];this[_0x7d41('0x8')]={};ami['on']('dialbegin',this[_0x7d41('0x9')][_0x7d41('0xa')](this));ami['on']('dialend',this['syncDialEnd'][_0x7d41('0xa')](this));ami['on'](_0x7d41('0xb'),this[_0x7d41('0xc')][_0x7d41('0xa')](this));ami['on'](_0x7d41('0xd'),this[_0x7d41('0xe')][_0x7d41('0xa')](this));}VoiceDialReport[_0x7d41('0xf')][_0x7d41('0x10')]=function(_0x5a41cc){return _0x5a41cc!==null&&!_[_0x7d41('0x11')](_0x5a41cc);};VoiceDialReport[_0x7d41('0xf')][_0x7d41('0x12')]=function(_0x5d881b,_0x48cd63,_0xed0313){io['to'](_0x5d881b)[_0x7d41('0x12')](_0x48cd63,_0xed0313);};VoiceDialReport['prototype'][_0x7d41('0x9')]=function(_0x275281){try{if(this[_0x7d41('0x10')](_0x275281)){logger[_0x7d41('0x13')](_0x7d41('0x14'),_0x275281[_0x7d41('0x15')],util[_0x7d41('0x16')](_0x275281,{'showHidden':![],'depth':null}));if(this[_0x7d41('0x17')][_0x275281[_0x7d41('0x15')]]){_[_0x7d41('0x18')](this[_0x7d41('0x17')][_0x275281[_0x7d41('0x15')]],{'starttime':moment()[_0x7d41('0x19')](_0x7d41('0x1a')),'lastevent':'called','interface':_0x275281[_0x7d41('0x1b')][_0x7d41('0x1c')](0x0,_0x275281['channel']['lastIndexOf']('-')),'membername':_0x275281[_0x7d41('0x1b')][_0x7d41('0x1c')](_0x275281[_0x7d41('0x1b')]['lastIndexOf']('/')+0x1,_0x275281[_0x7d41('0x1b')][_0x7d41('0x1d')]('-'))},_[_0x7d41('0x1e')](_0x275281,['event',_0x7d41('0x1f')]));logger[_0x7d41('0x20')](_0x7d41('0x21'),_0x275281[_0x7d41('0x15')],this['channels'][_0x275281['uniqueid']][_0x7d41('0x22')],this[_0x7d41('0x17')][_0x275281[_0x7d41('0x15')]]['interface']);logger[_0x7d41('0x13')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x275281[_0x7d41('0x15')],util[_0x7d41('0x16')](this[_0x7d41('0x17')][_0x275281['uniqueid']],{'showHidden':![],'depth':null}));this[_0x7d41('0x12')]('voice:outbound','voice_outbound_channel:save',this[_0x7d41('0x17')][_0x275281[_0x7d41('0x15')]]);logger[_0x7d41('0x13')](_0x7d41('0x23'),_0x275281[_0x7d41('0x15')],util[_0x7d41('0x16')](this[_0x7d41('0x17')][_0x275281[_0x7d41('0x15')]],{'showHidden':![],'depth':null}));ami[_0x7d41('0x12')]('custom:dialbegin',this[_0x7d41('0x17')][_0x275281['uniqueid']]);}}}catch(_0x411348){logger[_0x7d41('0x24')](_0x7d41('0x25'),_0x275281['uniqueid'],util[_0x7d41('0x16')](_0x411348,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x7d41('0x26')]=function(_0x1a8089){try{if(this[_0x7d41('0x10')](_0x1a8089)){logger[_0x7d41('0x13')](_0x7d41('0x27'),_0x1a8089['uniqueid'],util['inspect'](_0x1a8089,{'showHidden':![],'depth':null}));if(this[_0x7d41('0x17')][_0x1a8089['uniqueid']]){this[_0x7d41('0x17')][_0x1a8089['uniqueid']][_0x7d41('0x28')]=_0x1a8089['dialstatus'];if(_0x1a8089[_0x7d41('0x28')]===_0x7d41('0x29')){this[_0x7d41('0x17')][_0x1a8089[_0x7d41('0x15')]][_0x7d41('0x2a')]=_0x1a8089[_0x7d41('0x2a')];this[_0x7d41('0x17')][_0x1a8089[_0x7d41('0x15')]][_0x7d41('0x2b')]=_0x1a8089[_0x7d41('0x2b')];this[_0x7d41('0x17')][_0x1a8089[_0x7d41('0x15')]][_0x7d41('0x2c')]=moment()[_0x7d41('0x19')](_0x7d41('0x1a'));this[_0x7d41('0x17')][_0x1a8089[_0x7d41('0x15')]][_0x7d41('0x2d')]=_0x7d41('0x2e');logger['info']('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x1a8089['uniqueid'],_0x1a8089['channel'][_0x7d41('0x1c')](_0x1a8089[_0x7d41('0x1b')][_0x7d41('0x1d')]('/')+0x1,_0x1a8089[_0x7d41('0x1b')][_0x7d41('0x1d')]('-')));logger['debug'](_0x7d41('0x2f'),_0x1a8089[_0x7d41('0x15')],util[_0x7d41('0x16')](this[_0x7d41('0x17')][_0x1a8089['uniqueid']],{'showHidden':![],'depth':null}));ami['emit']('custom:dialconnect',this[_0x7d41('0x17')][_0x1a8089[_0x7d41('0x15')]]);}logger[_0x7d41('0x13')](_0x7d41('0x30'),_0x1a8089[_0x7d41('0x15')],util['inspect'](this[_0x7d41('0x17')][_0x1a8089[_0x7d41('0x15')]],{'showHidden':![],'depth':null}));this[_0x7d41('0x12')](_0x7d41('0x31'),_0x7d41('0x32'),this['channels'][_0x1a8089[_0x7d41('0x15')]]);}}}catch(_0x1c6b4c){logger[_0x7d41('0x24')](_0x7d41('0x33'),_0x1a8089[_0x7d41('0x15')],util[_0x7d41('0x16')](_0x1c6b4c,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7d41('0xf')][_0x7d41('0xc')]=function(_0x49efd1){try{if(this['isNotNull'](_0x49efd1)){logger[_0x7d41('0x13')](_0x7d41('0x34'),_0x49efd1[_0x7d41('0x15')],util[_0x7d41('0x16')](_0x49efd1,{'showHidden':![],'depth':null}));this[_0x7d41('0x35')](_0x49efd1[_0x7d41('0x15')],_[_0x7d41('0x36')](_0x49efd1[_0x7d41('0x37')])[0x0],_0x49efd1['value']);if(this['isNotNull'](_0x49efd1[_0x7d41('0x37')])&&this['isNotNull'](_0x49efd1[_0x7d41('0x37')][_0x7d41('0x38')])){if(_[_0x7d41('0x11')](this[_0x7d41('0x17')][_0x49efd1[_0x7d41('0x15')]])){this[_0x7d41('0x17')][_0x49efd1[_0x7d41('0x15')]]={'routeId':_0x49efd1[_0x7d41('0x39')],'variables':this['variables'][_0x49efd1[_0x7d41('0x15')]]};logger[_0x7d41('0x20')](_0x7d41('0x3a'),_0x49efd1[_0x7d41('0x15')],_0x49efd1[_0x7d41('0x37')][_0x7d41('0x38')],_[_0x7d41('0x36')](_0x49efd1[_0x7d41('0x37')])[0x0],_0x49efd1[_0x7d41('0x39')]);logger[_0x7d41('0x13')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x49efd1[_0x7d41('0x15')],util[_0x7d41('0x16')](this[_0x7d41('0x17')][_0x49efd1[_0x7d41('0x15')]],{'showHidden':![],'depth':null}));this[_0x7d41('0x12')](_0x7d41('0x31'),_0x7d41('0x32'),this[_0x7d41('0x17')][_0x49efd1[_0x7d41('0x15')]]);}}}}catch(_0x3db9ec){logger[_0x7d41('0x24')]('[%s][voiceDialReport][varset]',_0x49efd1[_0x7d41('0x15')],util[_0x7d41('0x16')](_0x3db9ec,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7d41('0xf')]['addVariable']=function(_0x1be6ea,_0x34c99f,_0x5d9ac9){var _0x946e8b=[_0x7d41('0x3b'),_0x7d41('0x3c'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x7d41('0x3d'),_0x7d41('0x3e'),_0x7d41('0x3f'),_0x7d41('0x40'),'sipcallid',_0x7d41('0x41'),'bridgepeer','bridgepvtcallid','membercalls',_0x7d41('0x42'),_0x7d41('0x43'),_0x7d41('0x44'),_0x7d41('0x22'),_0x7d41('0x45'),_0x7d41('0x46')];if(!_[_0x7d41('0x47')](_0x34c99f)&&!_[_0x7d41('0x48')](_0x946e8b,_0x34c99f)){if(_['isUndefined'](this['variables'][_0x1be6ea])){this[_0x7d41('0x8')][_0x1be6ea]={};}this[_0x7d41('0x8')][_0x1be6ea][_0x34c99f]=_0x5d9ac9;}};VoiceDialReport[_0x7d41('0xf')][_0x7d41('0xe')]=function(_0x344eba){try{if(this['isNotNull'](_0x344eba)){logger[_0x7d41('0x13')]('[%s][voiceDialReport][hangup]\x20event:',_0x344eba[_0x7d41('0x15')],util[_0x7d41('0x16')](_0x344eba,{'showHidden':![],'depth':null}));if(this['channels'][_0x344eba[_0x7d41('0x15')]]){logger[_0x7d41('0x20')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x344eba[_0x7d41('0x15')],_0x344eba['cause-txt']);this[_0x7d41('0x17')][_0x344eba['uniqueid']][_0x7d41('0x49')]=moment()[_0x7d41('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7d41('0x17')][_0x344eba[_0x7d41('0x15')]][_0x7d41('0x4a')]=moment(this['channels'][_0x344eba['uniqueid']][_0x7d41('0x49')])[_0x7d41('0x4b')](this['channels'][_0x344eba[_0x7d41('0x15')]][_0x7d41('0x4c')],_0x7d41('0x4d'));this[_0x7d41('0x17')][_0x344eba[_0x7d41('0x15')]]['lastevent']=_0x7d41('0x4e');this['outbound'][_0x7d41('0x4f')]+=0x1;if(this[_0x7d41('0x17')][_0x344eba[_0x7d41('0x15')]]['answertime']){this[_0x7d41('0x7')][_0x7d41('0x50')]+=0x1;this[_0x7d41('0x17')][_0x344eba[_0x7d41('0x15')]][_0x7d41('0x51')]=moment(this[_0x7d41('0x17')][_0x344eba[_0x7d41('0x15')]]['answertime'])[_0x7d41('0x4b')](this[_0x7d41('0x17')][_0x344eba['uniqueid']]['starttime'],'seconds');this[_0x7d41('0x17')][_0x344eba['uniqueid']]['billableseconds']=moment(this[_0x7d41('0x17')][_0x344eba['uniqueid']][_0x7d41('0x49')])[_0x7d41('0x4b')](this['channels'][_0x344eba['uniqueid']][_0x7d41('0x2c')],_0x7d41('0x4d'));this[_0x7d41('0x7')][_0x7d41('0x52')]+=this[_0x7d41('0x17')][_0x344eba['uniqueid']][_0x7d41('0x51')]||0x0;this['outbound'][_0x7d41('0x53')]+=this[_0x7d41('0x17')][_0x344eba['uniqueid']][_0x7d41('0x54')];}this['outbound'][_0x7d41('0x55')]+=this[_0x7d41('0x17')][_0x344eba[_0x7d41('0x15')]][_0x7d41('0x4a')];logger[_0x7d41('0x13')](_0x7d41('0x56'),_0x344eba[_0x7d41('0x15')],util[_0x7d41('0x16')](this[_0x7d41('0x17')][_0x344eba[_0x7d41('0x15')]],{'showHidden':![],'depth':null}));ami[_0x7d41('0x12')](_0x7d41('0x57'),this[_0x7d41('0x17')][_0x344eba[_0x7d41('0x15')]]);logger['debug'](_0x7d41('0x58'),_0x344eba[_0x7d41('0x15')],util['inspect'](this[_0x7d41('0x17')][_0x344eba[_0x7d41('0x15')]],{'showHidden':![],'depth':null}));ami['emit'](_0x7d41('0x59'),this['channels'][_0x344eba['uniqueid']]);logger[_0x7d41('0x13')](_0x7d41('0x5a'),_0x344eba[_0x7d41('0x15')],util[_0x7d41('0x16')](this[_0x7d41('0x17')][_0x344eba[_0x7d41('0x15')]],{'showHidden':![],'depth':null}));this[_0x7d41('0x12')](_0x7d41('0x31'),_0x7d41('0x5b'),this['outbound']);logger['info']('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x7d41('0x5c')](this[_0x7d41('0x17')][_0x344eba[_0x7d41('0x15')]]));logger['debug'](_0x7d41('0x5d'),_0x344eba[_0x7d41('0x15')],util[_0x7d41('0x16')](this[_0x7d41('0x17')][_0x344eba['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x7d41('0x31'),_0x7d41('0x5e'),this[_0x7d41('0x17')][_0x344eba[_0x7d41('0x15')]]);delete this[_0x7d41('0x17')][_0x344eba[_0x7d41('0x15')]];}else if(this[_0x7d41('0x17')][_0x344eba[_0x7d41('0x5f')]]){this['channels'][_0x344eba[_0x7d41('0x5f')]][_0x7d41('0x15')]=this[_0x7d41('0x17')][_0x344eba[_0x7d41('0x5f')]][_0x7d41('0x60')];}if(this[_0x7d41('0x8')][_0x344eba[_0x7d41('0x15')]]){delete this[_0x7d41('0x8')][_0x344eba[_0x7d41('0x15')]];}}}catch(_0x23cc7c){logger['error'](_0x7d41('0x61'),_0x344eba[_0x7d41('0x15')],util[_0x7d41('0x16')](_0x23cc7c,{'showHidden':![],'depth':null}));}};module[_0x7d41('0x62')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 4651ab3..c094acf 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 _0x780f=['[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','keys','push','[%s][voiceQueueReport][queuecallerjoin]','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitreason','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','syncQueueCallerLeave','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexit','queuecallerexitAt','reason','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','add','seconds','FORWARDTRANSFER','FORWARD','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','addVariable','value','CONTINUE','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','variable','queueposition','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','[%s][voiceQueueReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipuri','bridgepvtcallid','memberinterface','memberlastcall','memberrealtime','includes','[%s][voiceQueueReport][hangup]','length','unmanaged','diff','milliseconds','answered','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','transfertype','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','transferexten','origtransfereruniqueid','switch','syncBlindTransfer','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','exports','lodash','moment','util','md5','ioredis','ami','../ami','../model/queueReport','redis','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','agents','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','loopQueueSummary','hasOwnProperty','originated','isEmpty','waiting','queueStatusComplete','unlockRR','channels','isNil','Action','status','channel','message','No\x20such\x20channel','[%s][voiceQueueReport][checkChannel]','error','inspect','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','voice:queue:%s','name','voice_queue_channel:save','voice_queue_presence:save','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:remove\x20event:','format','voice_queue_channel:remove','type','inbound','strategy','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','Trunk','Interval','stringify','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','loopQueueShow','clearZombieChannels','catch','[voiceQueueReport][queues]','then','[voiceQueueReport][queuesummary]','[voiceQueueReport][queuesummary]\x20event:','info','[voiceQueueReport][queuesummary]\x20name:%s','queue','callers','loggedIn','toNumber','loggedin','available','emitVoiceQueueSummary','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','[voiceQueueReport][queuesummarycomplete]\x20event:','isUndefined','queuecallerjoinAt','position','count'];(function(_0xf2d744,_0x20952a){var _0x3193e2=function(_0xfe3e2e){while(--_0xfe3e2e){_0xf2d744['push'](_0xf2d744['shift']());}};_0x3193e2(++_0x20952a);}(_0x780f,0x6c));var _0xf780=function(_0x2fd0f0,_0x4b634e){_0x2fd0f0=_0x2fd0f0-0x0;var _0x57f71a=_0x780f[_0x2fd0f0];return _0x57f71a;};'use strict';var _=require(_0xf780('0x0'));var moment=require(_0xf780('0x1'));var util=require(_0xf780('0x2'));var md5=require(_0xf780('0x3'));var Redis=require(_0xf780('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xf780('0x5'));var ami=require(_0xf780('0x6'));var QueueReport=require(_0xf780('0x7'));config[_0xf780('0x8')]=_['defaults'](config[_0xf780('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xf780('0x9'))(new Redis(config[_0xf780('0x8')]));var Sequence=function(){};Sequence[_0xf780('0xa')][_0xf780('0xb')]=function(_0x44f14c){this[_0xf780('0xc')]=this['tail']?this[_0xf780('0xc')][_0xf780('0xd')](_0x44f14c):_0x44f14c();};function VoiceQueueReport(_0x121d96){this[_0xf780('0xe')]=new Sequence();this[_0xf780('0xf')]={};this[_0xf780('0x10')]=_0x121d96[_0xf780('0x10')];this['channels']=_0x121d96['queueChannels'];this[_0xf780('0x11')]=_0x121d96[_0xf780('0x11')];this[_0xf780('0x12')]=!![];this[_0xf780('0x13')]=_0x121d96['campaigns'];this[_0xf780('0x14')]={};ami['on'](_0xf780('0x15'),this[_0xf780('0x16')][_0xf780('0x17')](this));ami['on']('queuesummarycomplete',this[_0xf780('0x18')]['bind'](this));ami['on'](_0xf780('0x19'),this[_0xf780('0x1a')][_0xf780('0x17')](this));ami['on'](_0xf780('0x1b'),this[_0xf780('0x1c')][_0xf780('0x17')](this));ami['on'](_0xf780('0x1d'),this['syncQueueCallerLeave'][_0xf780('0x17')](this));ami['on'](_0xf780('0x1e'),this[_0xf780('0x1f')][_0xf780('0x17')](this));ami['on'](_0xf780('0x20'),this[_0xf780('0x21')]['bind'](this));ami['on'](_0xf780('0x22'),this[_0xf780('0x23')]['bind'](this));ami['on'](_0xf780('0x24'),this[_0xf780('0x25')]['bind'](this));ami['on'](_0xf780('0x26'),this[_0xf780('0x27')][_0xf780('0x17')](this));ami['on'](_0xf780('0x28'),this[_0xf780('0x29')][_0xf780('0x17')](this));ami['on']('musiconholdstop',this[_0xf780('0x2a')]['bind'](this));ami['on']('attendedtransfer',this[_0xf780('0x2b')][_0xf780('0x17')](this));ami['on'](_0xf780('0x2c'),this['syncBlindTransfer'][_0xf780('0x17')](this));this[_0xf780('0x2d')]();this['loopQueueShow']();}function clearChannels(_0x3a8327){if(!_['isEmpty'](_0x3a8327)){for(var _0x25faba in _0x3a8327){if(_0x3a8327[_0xf780('0x2e')](_0x25faba)){delete _0x3a8327[_0x25faba];}}}}function clearCampaigns(_0x5d4053){if(!_['isEmpty'](_0x5d4053)){for(var _0x3710bb in _0x5d4053){if(_0x5d4053[_0xf780('0x2e')](_0x3710bb)){_0x5d4053[_0x3710bb][_0xf780('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x40d9c9){if(!_[_0xf780('0x30')](_0x40d9c9)){for(var _0x2bd6cf in _0x40d9c9){if(_0x40d9c9[_0xf780('0x2e')](_0x2bd6cf)){_0x40d9c9[_0x2bd6cf]['originated']=0x0;_0x40d9c9[_0x2bd6cf]['talking']=0x0;_0x40d9c9[_0x2bd6cf]['pTalking']=0x0;_0x40d9c9[_0x2bd6cf][_0xf780('0x31')]=0x0;_0x40d9c9[_0x2bd6cf][_0xf780('0x32')]=!![];}}}}function clearAgentBooked(_0x26452f){if(!_['isEmpty'](_0x26452f)){for(var _0x4ed256 in _0x26452f){if(_0x26452f[_0xf780('0x2e')](_0x4ed256)){_0x26452f[_0x4ed256][_0xf780('0x33')]=!![];}}}}VoiceQueueReport[_0xf780('0xa')]['clearZombieChannels']=function(){var _0x3cc1a5=this;for(var _0x60bb8b in this[_0xf780('0x34')]){if(this[_0xf780('0x34')]['hasOwnProperty'](_0x60bb8b)&&!this[_0xf780('0x34')][_0x60bb8b]['switch']){this[_0xf780('0xe')][_0xf780('0xb')](function(){if(!_[_0xf780('0x35')](_0x3cc1a5[_0xf780('0x34')][_0x60bb8b])){return ami[_0xf780('0x36')]({'action':_0xf780('0x37'),'channel':_0x3cc1a5[_0xf780('0x34')][_0x60bb8b][_0xf780('0x38')]})['catch'](function(_0x4f9428){if(_0x4f9428[_0xf780('0x39')]===_0xf780('0x3a')){setTimeout(function(){if(_0x3cc1a5[_0xf780('0x34')][_0x60bb8b]){delete _0x3cc1a5[_0xf780('0x34')][_0x60bb8b];logger['error'](_0xf780('0x3b'),_0x60bb8b,util['inspect'](_0x4f9428,{'showHidden':![],'depth':null}));}if(_0x3cc1a5[_0xf780('0xf')][_0x60bb8b]){delete _0x3cc1a5[_0xf780('0xf')][_0x60bb8b];logger[_0xf780('0x3c')]('[%s][voiceQueueReport][checkQueueReport]',_0x60bb8b,util[_0xf780('0x3d')](_0x4f9428,{'showHidden':![],'depth':null}));}if(_0x3cc1a5[_0xf780('0x14')][_0x60bb8b]){delete _0x3cc1a5[_0xf780('0x14')][_0x60bb8b];logger[_0xf780('0x3c')]('[%s][voiceQueueReport][checkVariables]',_0x60bb8b,util[_0xf780('0x3d')](_0x4f9428,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0xf780('0x27')]=function(){logger['error']('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0xf780('0x34')]);this['clearQueueReport'](this[_0xf780('0xf')]);clearAgentBooked(this[_0xf780('0x10')]);clearVoiceQueues(this[_0xf780('0x11')]);clearCampaigns(this[_0xf780('0x13')]);};VoiceQueueReport['prototype'][_0xf780('0x3e')]=function(_0x1765ac){var _0x3482f2=this;if(!_[_0xf780('0x30')](_0x1765ac)){for(var _0x4e46fa in _0x1765ac){if(_0x1765ac[_0xf780('0x2e')](_0x4e46fa)){_0x3482f2[_0xf780('0x3f')](_0x1765ac[_0x4e46fa],_0xf780('0x40'));delete _0x1765ac[_0x4e46fa];}}}};VoiceQueueReport[_0xf780('0xa')][_0xf780('0x41')]=function(_0x4b4ed8,_0x4b8a3c,_0x3297c9){io['to'](_0x4b4ed8)[_0xf780('0x41')](_0x4b8a3c,_0x3297c9);};VoiceQueueReport[_0xf780('0xa')][_0xf780('0x42')]=function(_0x1a6a6f,_0x4a0efe){logger[_0xf780('0x43')]('[%s][voiceQueueReport]['+_0x4a0efe+_0xf780('0x44'),_0x1a6a6f[_0xf780('0x45')],util[_0xf780('0x3d')](_0x1a6a6f,{'showHidden':![],'depth':null}));this[_0xf780('0x41')](util['format'](_0xf780('0x46'),_0x1a6a6f[_0xf780('0x47')]),_0xf780('0x48'),_0x1a6a6f);io[_0xf780('0x41')](_0xf780('0x49'),_0x1a6a6f);};VoiceQueueReport[_0xf780('0xa')][_0xf780('0x3f')]=function(_0x1af20f,_0x343635){logger[_0xf780('0x43')](_0xf780('0x4a')+_0x343635+_0xf780('0x4b'),_0x1af20f[_0xf780('0x45')],util[_0xf780('0x3d')](_0x1af20f,{'showHidden':![],'depth':null}));this['emit'](util[_0xf780('0x4c')]('voice:queue:%s',_0x1af20f[_0xf780('0x47')]),_0xf780('0x4d'),_0x1af20f);io['emit']('voice_queue_presence:remove',_0x1af20f);};VoiceQueueReport['prototype']['emitVoiceQueueSummary']=function(_0x4ddd08,_0x5e14b7){if(_0x4ddd08[_0xf780('0x4e')]===_0xf780('0x4f')){var _0x3528d9={'id':_0x4ddd08['id'],'name':_0x4ddd08[_0xf780('0x47')],'strategy':_0x4ddd08[_0xf780('0x50')],'answered':_0x4ddd08['answered'],'available':_0x4ddd08['available'],'loggedIn':_0x4ddd08['loggedIn'],'pTalking':_0x4ddd08['pTalking'],'sumBillable':_0x4ddd08[_0xf780('0x51')],'sumDuration':_0x4ddd08[_0xf780('0x52')],'sumHoldTime':_0x4ddd08[_0xf780('0x53')]||0x0,'talking':_0x4ddd08[_0xf780('0x54')],'total':_0x4ddd08[_0xf780('0x55')],'type':_0x4ddd08[_0xf780('0x4e')],'unmanaged':_0x4ddd08['unmanaged'],'abandoned':_0x4ddd08[_0xf780('0x56')],'waiting':_0x4ddd08[_0xf780('0x31')]};if(_0x4ddd08[_0xf780('0x57')]){_0x3528d9[_0xf780('0x57')]={'id':_0x4ddd08[_0xf780('0x57')]['id'],'name':_0x4ddd08[_0xf780('0x57')]['name'],'active':_0x4ddd08[_0xf780('0x57')]['active'],'callerid':_0x4ddd08[_0xf780('0x57')]['callerid']};}if(_0x4ddd08[_0xf780('0x58')]){_0x3528d9['Interval']={'id':_0x4ddd08['Interval']['id'],'name':_0x4ddd08[_0xf780('0x58')][_0xf780('0x47')]};}var _0x189717=md5(JSON[_0xf780('0x59')](_0x3528d9));if(_0x4ddd08['md5']!==_0x189717){_0x4ddd08[_0xf780('0x3')]=_0x189717;logger[_0xf780('0x43')](_0xf780('0x5a')+_0x5e14b7+_0xf780('0x5b'),util[_0xf780('0x3d')](_0x3528d9,{'showHidden':![],'depth':null}));this['emit'](util[_0xf780('0x4c')]('voice:queue:%s',_0x3528d9[_0xf780('0x47')]),_0xf780('0x5c'),_0x3528d9);}}};VoiceQueueReport[_0xf780('0xa')][_0xf780('0x5d')]=function(_0xecfcd0){return _0xecfcd0!==null&&!_['isUndefined'](_0xecfcd0);};VoiceQueueReport['prototype'][_0xf780('0x5e')]=function(){var _0x44a40f=this;setInterval(function(){_0x44a40f[_0xf780('0x5f')]();ami[_0xf780('0x36')]({'action':'queues'})[_0xf780('0x60')](function(_0x476354){logger[_0xf780('0x3c')](_0xf780('0x61'),util[_0xf780('0x3d')](_0x476354,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xf780('0xa')]['loopQueueSummary']=function(){var _0x2c9932=this;setInterval(function(){if(_0x2c9932[_0xf780('0x12')]){return ami['Action']({'action':_0xf780('0x15')})[_0xf780('0x62')](function(_0x276a30){_0x2c9932[_0xf780('0x12')]=![];})[_0xf780('0x60')](function(_0x420dee){logger[_0xf780('0x3c')](_0xf780('0x63'),util[_0xf780('0x3d')](_0x420dee,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xf780('0xa')][_0xf780('0x16')]=function(_0x324f74){try{if(this['isNotNull'](_0x324f74)&&this[_0xf780('0x5d')](_0x324f74['queue'])){logger[_0xf780('0x43')](_0xf780('0x64'),util['inspect'](_0x324f74,{'showHidden':![],'depth':null}));if(this['voiceQueues'][_0x324f74['queue']]){logger[_0xf780('0x65')](_0xf780('0x66'),_0x324f74[_0xf780('0x67')]);var _0x5579b4=_['countBy'](this['channels'],_0xf780('0x67'))[_0x324f74['queue']]||0x0;var _0x28b057=_0x5579b4-_0x324f74[_0xf780('0x68')];if(this[_0xf780('0x11')][_0x324f74['queue']][_0xf780('0x31')]!==_['toNumber'](_0x324f74[_0xf780('0x68')])||this[_0xf780('0x11')][_0x324f74['queue']][_0xf780('0x69')]!==_[_0xf780('0x6a')](_0x324f74[_0xf780('0x6b')])||this[_0xf780('0x11')][_0x324f74[_0xf780('0x67')]][_0xf780('0x6c')]!==_[_0xf780('0x6a')](_0x324f74['available'])||this['voiceQueues'][_0x324f74[_0xf780('0x67')]][_0xf780('0x54')]!==_0x28b057){this['voiceQueues'][_0x324f74[_0xf780('0x67')]][_0xf780('0x31')]=_[_0xf780('0x6a')](_0x324f74[_0xf780('0x68')]);this[_0xf780('0x11')][_0x324f74['queue']]['loggedIn']=_[_0xf780('0x6a')](_0x324f74['loggedin']);this[_0xf780('0x11')][_0x324f74['queue']][_0xf780('0x6c')]=_[_0xf780('0x6a')](_0x324f74[_0xf780('0x6c')]);this[_0xf780('0x11')][_0x324f74[_0xf780('0x67')]]['talking']=_0x28b057>0x0?_0x28b057:0x0;this[_0xf780('0x11')][_0x324f74[_0xf780('0x67')]][_0xf780('0x54')]=this['voiceQueues'][_0x324f74['queue']][_0xf780('0x54')]>_[_0xf780('0x6a')](_0x324f74[_0xf780('0x6b')])?_['toNumber'](_0x324f74['loggedin']):this[_0xf780('0x11')][_0x324f74[_0xf780('0x67')]][_0xf780('0x54')];this[_0xf780('0x6d')](this[_0xf780('0x11')][_0x324f74[_0xf780('0x67')]],'queuesummary');}logger[_0xf780('0x43')](_0xf780('0x6e'),util[_0xf780('0x3d')](this['voiceQueues'][_0x324f74['queue']],{'showHidden':![],'depth':null}));ami[_0xf780('0x41')]('custom:queuesummary',this[_0xf780('0x11')][_0x324f74[_0xf780('0x67')]]);}}}catch(_0x28a12a){logger[_0xf780('0x3c')](_0xf780('0x63'),util[_0xf780('0x3d')](_0x28a12a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf780('0xa')][_0xf780('0x18')]=function(_0x13ebe0){logger[_0xf780('0x43')](_0xf780('0x6f'),util[_0xf780('0x3d')](_0x13ebe0,{'showHidden':![],'depth':null}));this[_0xf780('0x12')]=!![];};VoiceQueueReport[_0xf780('0xa')][_0xf780('0x1a')]=function(_0x2ee4ae){try{if(this['isNotNull'](_0x2ee4ae)){logger[_0xf780('0x43')]('[%s][voiceQueueReport][queuecallerjoin]',_0x2ee4ae[_0xf780('0x45')],util[_0xf780('0x3d')](_0x2ee4ae,{'showHidden':![],'depth':null}));if(_[_0xf780('0x70')](this['queueReports'][_0x2ee4ae[_0xf780('0x45')]])){this[_0xf780('0xf')][_0x2ee4ae[_0xf780('0x45')]]=[];this[_0xf780('0x34')][_0x2ee4ae[_0xf780('0x45')]]={};}var _0x1656fc=new QueueReport();_0x1656fc[_0xf780('0x47')]=_0x2ee4ae[_0xf780('0x67')];_0x1656fc[_0xf780('0x4e')]=this[_0xf780('0x11')][_0x1656fc[_0xf780('0x47')]]&&this['voiceQueues'][_0x1656fc[_0xf780('0x47')]]['type']?this['voiceQueues'][_0x1656fc[_0xf780('0x47')]]['type']||_0xf780('0x4f'):_0xf780('0x4f');_0x1656fc['queue']=_0x2ee4ae[_0xf780('0x67')];_0x1656fc[_0xf780('0x71')]=moment()[_0xf780('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x1656fc[_0xf780('0x72')]=_0x2ee4ae[_0xf780('0x72')];_0x1656fc[_0xf780('0x73')]=_0x2ee4ae[_0xf780('0x73')];_0x1656fc[_0xf780('0x45')]=_0x2ee4ae['uniqueid'];logger[_0xf780('0x65')](_0xf780('0x74'),_0x1656fc[_0xf780('0x47')],_0x1656fc['type']);_[_0xf780('0x75')](_0x1656fc,_['pick'](_0x2ee4ae,_[_0xf780('0x76')](_0x1656fc)));this[_0xf780('0xf')][_0x2ee4ae[_0xf780('0x45')]][_0xf780('0x77')](_0x1656fc);this[_0xf780('0x34')][_0x2ee4ae[_0xf780('0x45')]]=_0x1656fc;this[_0xf780('0x42')](_0x1656fc,'queuecallerjoin');}}catch(_0x439082){logger[_0xf780('0x3c')](_0xf780('0x78'),_0x2ee4ae['uniqueid'],util[_0xf780('0x3d')](_0x439082,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf780('0xa')][_0xf780('0x1c')]=function(_0x5a8e82){try{if(this[_0xf780('0x5d')](_0x5a8e82)){logger[_0xf780('0x43')](_0xf780('0x79'),_0x5a8e82[_0xf780('0x45')],util['inspect'](_0x5a8e82,{'showHidden':![],'depth':null}));if(this[_0xf780('0xf')][_0x5a8e82[_0xf780('0x45')]]){var _0xa23d66=_[_0xf780('0x7a')](this['queueReports'][_0x5a8e82[_0xf780('0x45')]]);_0xa23d66[_0xf780('0x7b')]=![];_0xa23d66[_0xf780('0x7c')]=null;_0xa23d66[_0xf780('0x7d')]=_0x5a8e82['holdtime'];_0xa23d66[_0xf780('0x7e')]=_0x5a8e82['originalposition'];_0xa23d66[_0xf780('0x1b')]=!![];_0xa23d66[_0xf780('0x7f')]=moment()['format'](_0xf780('0x80'));_0xa23d66[_0xf780('0x81')]=_0xf780('0x82');_0xa23d66[_0xf780('0x83')]=null;logger[_0xf780('0x65')](_0xf780('0x84'),_0xa23d66['name'],_0xa23d66['type']);this[_0xf780('0x34')][_0x5a8e82['uniqueid']]=_0xa23d66;this[_0xf780('0x3f')](_0xa23d66,'queuecallerabandon');}}}catch(_0x37a975){logger[_0xf780('0x3c')](_0xf780('0x79'),_0x5a8e82[_0xf780('0x45')],util[_0xf780('0x3d')](_0x37a975,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf780('0xa')][_0xf780('0x85')]=function(_0x43c98c){try{if(this['isNotNull'](_0x43c98c)){logger['debug'](_0xf780('0x86'),_0x43c98c[_0xf780('0x45')],util[_0xf780('0x3d')](_0x43c98c,{'showHidden':![],'depth':null}));if(this[_0xf780('0xf')][_0x43c98c[_0xf780('0x45')]]){var _0x5d5108=_[_0xf780('0x7a')](this[_0xf780('0xf')][_0x43c98c['uniqueid']]);_0x5d5108[_0xf780('0x87')]=moment()[_0xf780('0x4c')](_0xf780('0x80'));_0x5d5108[_0xf780('0x88')]=_0x43c98c[_0xf780('0x88')];_0x5d5108[_0xf780('0x89')]=_0x43c98c['connectedlinename'];logger[_0xf780('0x65')](_0xf780('0x8a'),_0x5d5108['name'],_0x5d5108['type'],_0x43c98c[_0xf780('0x88')],_0x43c98c[_0xf780('0x89')]);this[_0xf780('0x34')][_0x43c98c[_0xf780('0x45')]]=_0x5d5108;this['emitVoiceQueueChannelSave'](_0x5d5108,_0xf780('0x1d'));}}}catch(_0x27f2ce){logger[_0xf780('0x3c')](_0xf780('0x86'),_0x43c98c[_0xf780('0x45')],util[_0xf780('0x3d')](_0x27f2ce,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf780('0xa')][_0xf780('0x21')]=function(_0x472cbc){try{if(this[_0xf780('0x5d')](_0x472cbc)){logger[_0xf780('0x43')](_0xf780('0x8b'),_0x472cbc[_0xf780('0x45')],util['inspect'](_0x472cbc,{'showHidden':![],'depth':null}));if(this[_0xf780('0xf')][_0x472cbc['uniqueid']]){var _0x173f74=_['last'](this['queueReports'][_0x472cbc[_0xf780('0x45')]]);_0x173f74[_0xf780('0x7b')]=!![];_0x173f74[_0xf780('0x81')]=_0xf780('0x8c');logger[_0xf780('0x65')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x173f74[_0xf780('0x47')],_0x173f74['type']);}}}catch(_0x813c82){logger[_0xf780('0x3c')](_0xf780('0x8b'),_0x472cbc[_0xf780('0x45')],util[_0xf780('0x3d')](_0x813c82,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf780('0xa')][_0xf780('0x1f')]=function(_0x2c1174){try{if(this['isNotNull'](_0x2c1174)){logger[_0xf780('0x43')](_0xf780('0x8d'),_0x2c1174[_0xf780('0x45')],util[_0xf780('0x3d')](_0x2c1174,{'showHidden':![],'depth':null}));if(this[_0xf780('0xf')][_0x2c1174[_0xf780('0x45')]]){var _0x37b549=_[_0xf780('0x7a')](this[_0xf780('0xf')][_0x2c1174[_0xf780('0x45')]]);_0x37b549[_0xf780('0x1b')]=![];_0x37b549[_0xf780('0x7f')]=null;_0x37b549[_0xf780('0x8e')]=!![];_0x37b549['lastAssignedTo']=_0x2c1174[_0xf780('0x8f')];_0x37b549[_0xf780('0x7d')]=_0x2c1174['holdtime'];_0x37b549[_0xf780('0x7b')]=!![];_0x37b549[_0xf780('0x90')]=![];_0x37b549[_0xf780('0x91')]=null;if(!_0x37b549['transfer']){if(_0x2c1174[_0xf780('0x92')]==_0xf780('0x93')){_0x37b549[_0xf780('0x81')]=_0xf780('0x94');logger[_0xf780('0x65')](_0xf780('0x95'),_0x37b549[_0xf780('0x47')],_0x37b549[_0xf780('0x4e')]);}else{if(_[_0xf780('0x96')](_0x2c1174['channel'][_0xf780('0x97')](),_0xf780('0x98'))){if(this[_0xf780('0xf')][_0x2c1174[_0xf780('0x99')]]){var _0x5382cb=_['last'](this['queueReports'][_0x2c1174[_0xf780('0x99')]]);_0x5382cb['queuecallercomplete']=![];_0x5382cb[_0xf780('0x90')]=!![];_0x5382cb['queuecallerexitAt']=moment(_0x37b549[_0xf780('0x71')])[_0xf780('0x9a')](_0x2c1174[_0xf780('0x7d')],_0xf780('0x9b'))[_0xf780('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x5382cb[_0xf780('0x81')]=_0xf780('0x9c');_0x5382cb['transfer']=!![];_0x5382cb['transfertype']=_0xf780('0x9d');_0x5382cb['transferexten']=_0x2c1174[_0xf780('0x9e')];_0x5382cb[_0xf780('0x9f')]=_0x2c1174['uniqueid'];logger[_0xf780('0x65')](_0xf780('0xa0'),_0x5382cb[_0xf780('0x47')],_0x5382cb[_0xf780('0x4e')]);var _0x55800d=this[_0xf780('0xf')][_0x2c1174[_0xf780('0x99')]];this[_0xf780('0xf')][_0x2c1174[_0xf780('0x99')]]=this[_0xf780('0xf')][_0x2c1174[_0xf780('0x45')]];this[_0xf780('0xf')][_0x2c1174[_0xf780('0x45')]]=_0x55800d;}}else{_0x37b549['queuecallerexitreason']=_0xf780('0xa1')+_0x2c1174[_0xf780('0x92')][_0xf780('0xa2')]();logger[_0xf780('0x65')](_0xf780('0xa3'),_0x37b549[_0xf780('0x47')],_0x37b549[_0xf780('0x4e')],_0x37b549[_0xf780('0x81')]);}}}this['channels'][_0x2c1174[_0xf780('0x45')]]=_0x37b549;this[_0xf780('0x3f')](_0x37b549,_0xf780('0x1e'));}}}catch(_0x2095a8){logger[_0xf780('0x3c')]('[%s][voiceQueueReport][agentcomplete]',_0x2c1174['uniqueid'],util[_0xf780('0x3d')](_0x2095a8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf780('0xa')]['syncVarSet']=function(_0x5032a3){try{if(this[_0xf780('0x5d')](_0x5032a3)){logger[_0xf780('0x43')]('[%s][voiceQueueReport][varset]',_0x5032a3['uniqueid'],util[_0xf780('0x3d')](_0x5032a3,{'showHidden':![],'depth':null}));this[_0xf780('0xa4')](_0x5032a3[_0xf780('0x45')],_[_0xf780('0x76')](_0x5032a3['variable'])[0x0],_0x5032a3[_0xf780('0xa5')]);if(this[_0xf780('0xf')][_0x5032a3[_0xf780('0x45')]]){var _0x43b06f=_['last'](this[_0xf780('0xf')][_0x5032a3[_0xf780('0x45')]]);if(_0x43b06f){if(this[_0xf780('0x5d')](_0x5032a3['variable'])&&this[_0xf780('0x5d')](_0x5032a3['variable']['queuestatus'])){switch(_0x5032a3[_0xf780('0xa5')]){case _0xf780('0xa6'):_0x43b06f[_0xf780('0x90')]=![];_0x43b06f[_0xf780('0x91')]=null;break;case _0xf780('0xa7'):_0x43b06f[_0xf780('0xa8')]=_0xf780('0xa9');_0x43b06f['queuecallerexit']=!![];_0x43b06f['queuecallerexitAt']=moment()[_0xf780('0x4c')](_0xf780('0x80'));_0x43b06f[_0xf780('0x87')]=moment()[_0xf780('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');logger['debug'](_0xf780('0xaa'),_0x5032a3['uniqueid'],util[_0xf780('0x3d')](_0x43b06f,{'showHidden':![],'depth':null}));ami[_0xf780('0x41')]('custom:timeout',_0x43b06f);break;default:_0x43b06f[_0xf780('0x90')]=!![];_0x43b06f[_0xf780('0x91')]=moment()[_0xf780('0x4c')](_0xf780('0x80'));_0x43b06f[_0xf780('0x87')]=moment()[_0xf780('0x4c')](_0xf780('0x80'));}_0x43b06f[_0xf780('0x1b')]=![];_0x43b06f['queuecallerabandonAt']=null;_0x43b06f[_0xf780('0x81')]=_0x5032a3[_0xf780('0xa5')];this[_0xf780('0x34')][_0x5032a3[_0xf780('0x45')]]=_0x43b06f;this[_0xf780('0x3f')](_0x43b06f,_0xf780('0x22'));}else if(this['isNotNull'](_0x5032a3[_0xf780('0xab')])&&this[_0xf780('0x5d')](_0x5032a3[_0xf780('0xab')][_0xf780('0xac')])){if(!_0x43b06f[_0xf780('0x1b')]){_0x43b06f[_0xf780('0x90')]=!![];_0x43b06f['queuecallerexitAt']=moment()[_0xf780('0x4c')](_0xf780('0x80'));_0x43b06f[_0xf780('0x81')]='EXITWITHKEY';_0x43b06f[_0xf780('0x87')]=moment()[_0xf780('0x4c')](_0xf780('0x80'));this['channels'][_0x5032a3[_0xf780('0x45')]]=_0x43b06f;}}logger[_0xf780('0x65')](_0xf780('0xad'),_0x5032a3['uniqueid'],_0x43b06f[_0xf780('0x47')],_0x43b06f[_0xf780('0x4e')],_[_0xf780('0x76')](_0x5032a3[_0xf780('0xab')])[0x0],_0x5032a3[_0xf780('0xa5')]);_0x43b06f[_0xf780('0x14')]=this['variables'][_0x5032a3[_0xf780('0x45')]];}}}}catch(_0x63a3b4){logger[_0xf780('0x3c')](_0xf780('0xae'),_0x5032a3[_0xf780('0x45')],util['inspect'](_0x63a3b4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xf780('0xa4')]=function(_0x5a2eae,_0x40c55f,_0x5190b0){var _0x39b961=[_0xf780('0xaf'),'rtpaudioqosbridged',_0xf780('0xb0'),_0xf780('0xb1'),_0xf780('0xb2'),_0xf780('0xb3'),_0xf780('0xb4'),'rtpaudioqosrttbridged','sipcallid',_0xf780('0xb5'),'bridgepeer',_0xf780('0xb6'),'membercalls','memberdynamic',_0xf780('0xb7'),_0xf780('0xb8'),_0xf780('0x8f'),'memberpenalty',_0xf780('0xb9')];if(!_['isNil'](_0x40c55f)&&!_[_0xf780('0xba')](_0x39b961,_0x40c55f)){if(_[_0xf780('0x70')](this['variables'][_0x5a2eae])){this[_0xf780('0x14')][_0x5a2eae]={};}this[_0xf780('0x14')][_0x5a2eae][_0x40c55f]=_0x5190b0;}};VoiceQueueReport[_0xf780('0xa')][_0xf780('0x25')]=function(_0xe944){try{if(this[_0xf780('0x5d')](_0xe944)){logger[_0xf780('0x43')](_0xf780('0xbb'),_0xe944[_0xf780('0x45')],util['inspect'](_0xe944,{'showHidden':![],'depth':null}));if(this[_0xf780('0xf')][_0xe944[_0xf780('0x45')]]){for(var _0x58c991=0x0,_0x37d5e2={};_0x58c9910x0?_0x4b6e36:0x0;this[_0x3efe('0x11')][_0x149ea7['queue']][_0x3efe('0x31')]=this['voiceQueues'][_0x149ea7['queue']]['talking']>_[_0x3efe('0x6c')](_0x149ea7[_0x3efe('0x6d')])?_[_0x3efe('0x6c')](_0x149ea7[_0x3efe('0x6d')]):this[_0x3efe('0x11')][_0x149ea7['queue']]['talking'];this['emitVoiceQueueSummary'](this['voiceQueues'][_0x149ea7[_0x3efe('0x66')]],_0x3efe('0x15'));}logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util['inspect'](this[_0x3efe('0x11')][_0x149ea7[_0x3efe('0x66')]],{'showHidden':![],'depth':null}));ami[_0x3efe('0x41')]('custom:queuesummary',this['voiceQueues'][_0x149ea7[_0x3efe('0x66')]]);}}}catch(_0x2a3d5e){logger[_0x3efe('0x3b')](_0x3efe('0x64'),util[_0x3efe('0x3a')](_0x2a3d5e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3efe('0xa')][_0x3efe('0x19')]=function(_0x2cb3a2){logger[_0x3efe('0x43')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x3efe('0x3a')](_0x2cb3a2,{'showHidden':![],'depth':null}));this[_0x3efe('0x12')]=!![];};VoiceQueueReport[_0x3efe('0xa')][_0x3efe('0x1b')]=function(_0x1de5de){try{if(this[_0x3efe('0x65')](_0x1de5de)){logger[_0x3efe('0x43')](_0x3efe('0x6f'),_0x1de5de[_0x3efe('0x70')],util['inspect'](_0x1de5de,{'showHidden':![],'depth':null}));if(_[_0x3efe('0x60')](this['queueReports'][_0x1de5de['uniqueid']])){this['queueReports'][_0x1de5de[_0x3efe('0x70')]]=[];this['channels'][_0x1de5de[_0x3efe('0x70')]]={};}var _0x97823f=new QueueReport();_0x97823f[_0x3efe('0x48')]=_0x1de5de[_0x3efe('0x66')];_0x97823f['type']=this['voiceQueues'][_0x97823f['name']]&&this[_0x3efe('0x11')][_0x97823f['name']]['type']?this[_0x3efe('0x11')][_0x97823f[_0x3efe('0x48')]][_0x3efe('0x4d')]||_0x3efe('0x4e'):'inbound';_0x97823f[_0x3efe('0x66')]=_0x1de5de[_0x3efe('0x66')];_0x97823f['queuecallerjoinAt']=moment()['format'](_0x3efe('0x71'));_0x97823f[_0x3efe('0x72')]=_0x1de5de[_0x3efe('0x72')];_0x97823f[_0x3efe('0x73')]=_0x1de5de[_0x3efe('0x73')];_0x97823f[_0x3efe('0x70')]=_0x1de5de['uniqueid'];logger[_0x3efe('0x68')](_0x3efe('0x74'),_0x97823f[_0x3efe('0x48')],_0x97823f[_0x3efe('0x4d')]);_[_0x3efe('0x75')](_0x97823f,_[_0x3efe('0x76')](_0x1de5de,_[_0x3efe('0x77')](_0x97823f)));this[_0x3efe('0xf')][_0x1de5de['uniqueid']][_0x3efe('0x78')](_0x97823f);this[_0x3efe('0x35')][_0x1de5de[_0x3efe('0x70')]]=_0x97823f;this[_0x3efe('0x42')](_0x97823f,'queuecallerjoin');}}catch(_0x41f8e4){logger[_0x3efe('0x3b')]('[%s][voiceQueueReport][queuecallerjoin]',_0x1de5de[_0x3efe('0x70')],util[_0x3efe('0x3a')](_0x41f8e4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3efe('0xa')][_0x3efe('0x79')]=function(_0x1ecd21){try{if(this['isNotNull'](_0x1ecd21)){logger[_0x3efe('0x43')](_0x3efe('0x7a'),_0x1ecd21[_0x3efe('0x70')],util[_0x3efe('0x3a')](_0x1ecd21,{'showHidden':![],'depth':null}));if(this[_0x3efe('0xf')][_0x1ecd21['uniqueid']]){var _0x371354=_[_0x3efe('0x7b')](this[_0x3efe('0xf')][_0x1ecd21[_0x3efe('0x70')]]);_0x371354['queuecallercomplete']=![];_0x371354[_0x3efe('0x7c')]=null;_0x371354[_0x3efe('0x7d')]=_0x1ecd21[_0x3efe('0x7d')];_0x371354['originalposition']=_0x1ecd21['originalposition'];_0x371354['queuecallerabandon']=!![];_0x371354[_0x3efe('0x7e')]=moment()[_0x3efe('0x46')](_0x3efe('0x71'));_0x371354[_0x3efe('0x7f')]='ABANDONED';_0x371354['lastAssignedTo']=null;logger[_0x3efe('0x68')](_0x3efe('0x80'),_0x371354[_0x3efe('0x48')],_0x371354[_0x3efe('0x4d')]);this['channels'][_0x1ecd21[_0x3efe('0x70')]]=_0x371354;this[_0x3efe('0x4b')](_0x371354,'queuecallerabandon');}}}catch(_0x21978f){logger[_0x3efe('0x3b')](_0x3efe('0x7a'),_0x1ecd21[_0x3efe('0x70')],util[_0x3efe('0x3a')](_0x21978f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3efe('0x1e')]=function(_0x579a77){try{if(this['isNotNull'](_0x579a77)){logger[_0x3efe('0x43')]('[%s][voiceQueueReport][queuecallerleave]',_0x579a77[_0x3efe('0x70')],util[_0x3efe('0x3a')](_0x579a77,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x579a77[_0x3efe('0x70')]]){var _0x4211fa=_[_0x3efe('0x7b')](this['queueReports'][_0x579a77[_0x3efe('0x70')]]);_0x4211fa[_0x3efe('0x81')]=moment()[_0x3efe('0x46')](_0x3efe('0x71'));_0x4211fa[_0x3efe('0x82')]=_0x579a77['connectedlinenum'];_0x4211fa[_0x3efe('0x83')]=_0x579a77[_0x3efe('0x83')];logger[_0x3efe('0x68')](_0x3efe('0x84'),_0x4211fa[_0x3efe('0x48')],_0x4211fa[_0x3efe('0x4d')],_0x579a77[_0x3efe('0x82')],_0x579a77[_0x3efe('0x83')]);this[_0x3efe('0x35')][_0x579a77[_0x3efe('0x70')]]=_0x4211fa;this[_0x3efe('0x42')](_0x4211fa,_0x3efe('0x1d'));}}}catch(_0x2b0ab6){logger['error'](_0x3efe('0x85'),_0x579a77[_0x3efe('0x70')],util[_0x3efe('0x3a')](_0x2b0ab6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3efe('0xa')]['syncAgentConnect']=function(_0x588981){try{if(this[_0x3efe('0x65')](_0x588981)){logger['debug'](_0x3efe('0x86'),_0x588981[_0x3efe('0x70')],util[_0x3efe('0x3a')](_0x588981,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x588981['uniqueid']]){var _0x330b95=_[_0x3efe('0x7b')](this[_0x3efe('0xf')][_0x588981[_0x3efe('0x70')]]);_0x330b95[_0x3efe('0x87')]=!![];_0x330b95[_0x3efe('0x7f')]=_0x3efe('0x88');logger[_0x3efe('0x68')](_0x3efe('0x89'),_0x330b95[_0x3efe('0x48')],_0x330b95[_0x3efe('0x4d')]);}}}catch(_0x755d71){logger[_0x3efe('0x3b')](_0x3efe('0x86'),_0x588981[_0x3efe('0x70')],util[_0x3efe('0x3a')](_0x755d71,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x55dad0){try{if(this[_0x3efe('0x65')](_0x55dad0)){logger[_0x3efe('0x43')](_0x3efe('0x8a'),_0x55dad0[_0x3efe('0x70')],util[_0x3efe('0x3a')](_0x55dad0,{'showHidden':![],'depth':null}));if(this[_0x3efe('0xf')][_0x55dad0['uniqueid']]){var _0x123f07=_[_0x3efe('0x7b')](this[_0x3efe('0xf')][_0x55dad0[_0x3efe('0x70')]]);_0x123f07['queuecallerabandon']=![];_0x123f07[_0x3efe('0x7e')]=null;_0x123f07[_0x3efe('0x8b')]=!![];_0x123f07[_0x3efe('0x8c')]=_0x55dad0[_0x3efe('0x8d')];_0x123f07[_0x3efe('0x7d')]=_0x55dad0[_0x3efe('0x7d')];_0x123f07[_0x3efe('0x87')]=!![];_0x123f07[_0x3efe('0x8e')]=![];_0x123f07[_0x3efe('0x8f')]=null;if(!_0x123f07['transfer']){if(_0x55dad0[_0x3efe('0x90')]=='transfer'){_0x123f07[_0x3efe('0x7f')]=_0x3efe('0x91');logger[_0x3efe('0x68')](_0x3efe('0x92'),_0x123f07[_0x3efe('0x48')],_0x123f07['type']);}else{if(_['startsWith'](_0x55dad0[_0x3efe('0x93')][_0x3efe('0x94')](),'local/')){if(this['queueReports'][_0x55dad0['linkedid']]){var _0x4bd33a=_[_0x3efe('0x7b')](this[_0x3efe('0xf')][_0x55dad0['linkedid']]);_0x4bd33a[_0x3efe('0x87')]=![];_0x4bd33a[_0x3efe('0x8e')]=!![];_0x4bd33a['queuecallerexitAt']=moment(_0x123f07[_0x3efe('0x95')])[_0x3efe('0x96')](_0x55dad0['holdtime'],_0x3efe('0x97'))['format'](_0x3efe('0x71'));_0x4bd33a[_0x3efe('0x7f')]=_0x3efe('0x98');_0x4bd33a[_0x3efe('0x99')]=!![];_0x4bd33a[_0x3efe('0x9a')]=_0x3efe('0x9b');_0x4bd33a[_0x3efe('0x9c')]=_0x55dad0[_0x3efe('0x9d')];_0x4bd33a[_0x3efe('0x9e')]=_0x55dad0[_0x3efe('0x70')];logger[_0x3efe('0x68')](_0x3efe('0x9f'),_0x4bd33a[_0x3efe('0x48')],_0x4bd33a['type']);var _0x4f18e9=this['queueReports'][_0x55dad0[_0x3efe('0xa0')]];this[_0x3efe('0xf')][_0x55dad0[_0x3efe('0xa0')]]=this[_0x3efe('0xf')][_0x55dad0[_0x3efe('0x70')]];this[_0x3efe('0xf')][_0x55dad0['uniqueid']]=_0x4f18e9;}}else{_0x123f07[_0x3efe('0x7f')]='COMPLETEDBY'+_0x55dad0['reason'][_0x3efe('0xa1')]();logger['info'](_0x3efe('0xa2'),_0x123f07[_0x3efe('0x48')],_0x123f07[_0x3efe('0x4d')],_0x123f07[_0x3efe('0x7f')]);}}}this[_0x3efe('0x35')][_0x55dad0[_0x3efe('0x70')]]=_0x123f07;this[_0x3efe('0x4b')](_0x123f07,_0x3efe('0xa3'));}}}catch(_0x5d3475){logger[_0x3efe('0x3b')](_0x3efe('0x8a'),_0x55dad0[_0x3efe('0x70')],util[_0x3efe('0x3a')](_0x5d3475,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3efe('0xa')][_0x3efe('0xa4')]=function(_0x13ea5e){try{if(this[_0x3efe('0x65')](_0x13ea5e)){logger['debug'](_0x3efe('0xa5'),_0x13ea5e[_0x3efe('0x70')],util[_0x3efe('0x3a')](_0x13ea5e,{'showHidden':![],'depth':null}));this[_0x3efe('0xa6')](_0x13ea5e['uniqueid'],_[_0x3efe('0x77')](_0x13ea5e[_0x3efe('0xa7')])[0x0],_0x13ea5e['value']);if(this[_0x3efe('0xf')][_0x13ea5e[_0x3efe('0x70')]]){var _0x16bcdc=_[_0x3efe('0x7b')](this[_0x3efe('0xf')][_0x13ea5e[_0x3efe('0x70')]]);if(_0x16bcdc){if(this['isNotNull'](_0x13ea5e['variable'])&&this[_0x3efe('0x65')](_0x13ea5e[_0x3efe('0xa7')]['queuestatus'])){switch(_0x13ea5e[_0x3efe('0xa8')]){case _0x3efe('0xa9'):_0x16bcdc[_0x3efe('0x8e')]=![];_0x16bcdc[_0x3efe('0x8f')]=null;break;case _0x3efe('0xaa'):_0x16bcdc[_0x3efe('0xab')]='timeout';_0x16bcdc[_0x3efe('0x8e')]=!![];_0x16bcdc['queuecallerexitAt']=moment()[_0x3efe('0x46')](_0x3efe('0x71'));_0x16bcdc[_0x3efe('0x81')]=moment()[_0x3efe('0x46')](_0x3efe('0x71'));logger[_0x3efe('0x43')](_0x3efe('0xac'),_0x13ea5e[_0x3efe('0x70')],util[_0x3efe('0x3a')](_0x16bcdc,{'showHidden':![],'depth':null}));ami[_0x3efe('0x41')](_0x3efe('0xad'),_0x16bcdc);break;default:_0x16bcdc[_0x3efe('0x8e')]=!![];_0x16bcdc['queuecallerexitAt']=moment()[_0x3efe('0x46')](_0x3efe('0x71'));_0x16bcdc[_0x3efe('0x81')]=moment()[_0x3efe('0x46')]('YYYY-MM-DD\x20HH:mm:ss');}_0x16bcdc[_0x3efe('0x1c')]=![];_0x16bcdc['queuecallerabandonAt']=null;_0x16bcdc['queuecallerexitreason']=_0x13ea5e[_0x3efe('0xa8')];this[_0x3efe('0x35')][_0x13ea5e[_0x3efe('0x70')]]=_0x16bcdc;this[_0x3efe('0x4b')](_0x16bcdc,_0x3efe('0x22'));}else if(this['isNotNull'](_0x13ea5e[_0x3efe('0xa7')])&&this[_0x3efe('0x65')](_0x13ea5e[_0x3efe('0xa7')][_0x3efe('0xae')])){if(!_0x16bcdc['queuecallerabandon']){_0x16bcdc['queuecallerexit']=!![];_0x16bcdc[_0x3efe('0x8f')]=moment()[_0x3efe('0x46')](_0x3efe('0x71'));_0x16bcdc[_0x3efe('0x7f')]=_0x3efe('0xaf');_0x16bcdc[_0x3efe('0x81')]=moment()['format'](_0x3efe('0x71'));this[_0x3efe('0x35')][_0x13ea5e[_0x3efe('0x70')]]=_0x16bcdc;}}logger['info'](_0x3efe('0xb0'),_0x13ea5e[_0x3efe('0x70')],_0x16bcdc[_0x3efe('0x48')],_0x16bcdc[_0x3efe('0x4d')],_[_0x3efe('0x77')](_0x13ea5e[_0x3efe('0xa7')])[0x0],_0x13ea5e[_0x3efe('0xa8')]);_0x16bcdc[_0x3efe('0x14')]=this[_0x3efe('0x14')][_0x13ea5e['uniqueid']];}}}}catch(_0x390e0c){logger[_0x3efe('0x3b')](_0x3efe('0xa5'),_0x13ea5e[_0x3efe('0x70')],util[_0x3efe('0x3a')](_0x390e0c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3efe('0xa')]['addVariable']=function(_0x267a7a,_0x193336,_0x1b598b){var _0x4f72ea=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter',_0x3efe('0xb1'),_0x3efe('0xb2'),_0x3efe('0xb3'),_0x3efe('0xb4'),_0x3efe('0xb5'),_0x3efe('0xb6'),_0x3efe('0xb7'),'bridgepeer','bridgepvtcallid',_0x3efe('0xb8'),_0x3efe('0xb9'),'memberinterface',_0x3efe('0xba'),_0x3efe('0x8d'),_0x3efe('0xbb'),_0x3efe('0xbc')];if(!_[_0x3efe('0x37')](_0x193336)&&!_[_0x3efe('0xbd')](_0x4f72ea,_0x193336)){if(_[_0x3efe('0x60')](this[_0x3efe('0x14')][_0x267a7a])){this[_0x3efe('0x14')][_0x267a7a]={};}this['variables'][_0x267a7a][_0x193336]=_0x1b598b;}};VoiceQueueReport[_0x3efe('0xa')][_0x3efe('0x24')]=function(_0x1a87a2){try{if(this['isNotNull'](_0x1a87a2)){logger[_0x3efe('0x43')](_0x3efe('0xbe'),_0x1a87a2['uniqueid'],util[_0x3efe('0x3a')](_0x1a87a2,{'showHidden':![],'depth':null}));if(this[_0x3efe('0xf')][_0x1a87a2['uniqueid']]){for(var _0x43b660=0x0,_0xa858d4={};_0x43b660=0x0?moment(_0x1b8ff8['endtime'])[_0xbc3d('0x9')](_0x1b8ff8[_0xbc3d('0x11')],_0xbc3d('0x13')):null,'data1':_0xbc3d('0x14'),'data2':_0x1b8ff8[_0xbc3d('0x15')],'data3':_0x1b8ff8[_0xbc3d('0x16')],'data4':_0x1b8ff8[_0xbc3d('0x17')]||null,'role':'agent','internal':_0x1b8ff8[_0xbc3d('0x15')]?_[_0xbc3d('0xd')](_0x1b8ff8[_0xbc3d('0x15')]):undefined,'uniqueid':_0x1b8ff8[_0xbc3d('0x18')]},'log':_0xbc3d('0xe')});}; \ No newline at end of file +var _0x54d1=['CreateMemberReport','voice','isNil','interface','format','SIP/%s','lastAssignedTo','TALKING','diff','seconds','inbound','calleridnum','exten','agent','accountcode','toNumber','uniqueid','voiceDialReport','starttime','endtime','outbound','dialstring','moment','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request'];(function(_0x53f37f,_0xfb0b18){var _0x2fe5f8=function(_0x76ef2d){while(--_0x76ef2d){_0x53f37f['push'](_0x53f37f['shift']());}};_0x2fe5f8(++_0xfb0b18);}(_0x54d1,0x1ac));var _0x154d=function(_0x4d21fb,_0x2de336){_0x4d21fb=_0x4d21fb-0x0;var _0x708145=_0x54d1[_0x4d21fb];return _0x708145;};'use strict';var moment=require(_0x154d('0x0'));var _=require('lodash');var util=require(_0x154d('0x1'));var client=require(_0x154d('0x2'));exports[_0x154d('0x3')]=function(_0x10aab2){var _0xdc0f97=_0x10aab2[_0x154d('0x4')]||_0x10aab2[_0x154d('0x5')];return client[_0x154d('0x6')](_0x154d('0x7'),{'body':{'channel':_0x154d('0x8'),'membername':_0x10aab2['lastAssignedTo'],'interface':_[_0x154d('0x9')](_0x10aab2[_0x154d('0xa')])?util[_0x154d('0xb')](_0x154d('0xc'),_0x10aab2[_0x154d('0xd')]):_0x10aab2['interface'],'type':_0x154d('0xe'),'enterAt':_0x10aab2['queuecallerleaveAt'],'exitAt':_0xdc0f97,'duration':moment(_0xdc0f97)[_0x154d('0xf')](_0x10aab2['queuecallerleaveAt'],_0x154d('0x10')),'data1':_0x154d('0x11'),'data2':_0x10aab2[_0x154d('0x12')],'data3':_0x10aab2[_0x154d('0x13')],'data4':null,'data5':_0x10aab2['queue'],'role':_0x154d('0x14'),'internal':_0x10aab2[_0x154d('0x15')]?_[_0x154d('0x16')](_0x10aab2[_0x154d('0x15')]):undefined,'uniqueid':_0x10aab2[_0x154d('0x17')]},'log':_0x154d('0x7')});};exports[_0x154d('0x18')]=function(_0x8955cc){return client['Request'](_0x154d('0x7'),{'body':{'channel':_0x154d('0x8'),'membername':_0x8955cc['membername'],'interface':_0x8955cc[_0x154d('0xa')],'type':_0x154d('0xe'),'enterAt':_0x8955cc[_0x154d('0x19')],'exitAt':_0x8955cc['endtime'],'duration':moment(_0x8955cc['endtime'])[_0x154d('0xf')](_0x8955cc['starttime'],_0x154d('0x10'))>=0x0?moment(_0x8955cc[_0x154d('0x1a')])[_0x154d('0xf')](_0x8955cc[_0x154d('0x19')],'seconds'):null,'data1':_0x154d('0x1b'),'data2':_0x8955cc[_0x154d('0x15')],'data3':_0x8955cc[_0x154d('0x13')],'data4':_0x8955cc[_0x154d('0x1c')]||null,'role':_0x154d('0x14'),'internal':_0x8955cc[_0x154d('0x15')]?_['toNumber'](_0x8955cc[_0x154d('0x15')]):undefined,'uniqueid':_0x8955cc[_0x154d('0x17')]},'log':_0x154d('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 64c3e97..141bb41 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 _0xda55=['GetSettings','../client','getSettings','stopRecordingOnTransfer'];(function(_0x2dfc21,_0x203c9c){var _0x464a0d=function(_0x11d875){while(--_0x11d875){_0x2dfc21['push'](_0x2dfc21['shift']());}};_0x464a0d(++_0x203c9c);}(_0xda55,0x6d));var _0x5da5=function(_0x11bf38,_0x213d7f){_0x11bf38=_0x11bf38-0x0;var _0x202699=_0xda55[_0x11bf38];return _0x202699;};'use strict';var client=require(_0x5da5('0x0'));exports[_0x5da5('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5da5('0x2')]},'log':_0x5da5('0x3')});}; \ No newline at end of file +var _0x7072=['stopRecordingOnTransfer','GetSettings','getSettings','Request','ShowSetting'];(function(_0x5a7123,_0xf3d016){var _0x166efc=function(_0x2c7334){while(--_0x2c7334){_0x5a7123['push'](_0x5a7123['shift']());}};_0x166efc(++_0xf3d016);}(_0x7072,0x138));var _0x2707=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x7072[_0x3de8a4];return _0x4635cf;};'use strict';var client=require('../client');exports[_0x2707('0x0')]=function(){return client[_0x2707('0x1')](_0x2707('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2707('0x3')]},'log':_0x2707('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index a3569cc..7f467b0 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 _0x6324=['GetTemplate','html','../client','getTemplates'];(function(_0x6882d,_0x1541f8){var _0x4034ed=function(_0x2e7a55){while(--_0x2e7a55){_0x6882d['push'](_0x6882d['shift']());}};_0x4034ed(++_0x1541f8);}(_0x6324,0x142));var _0x4632=function(_0x3a0aef,_0x4815f2){_0x3a0aef=_0x3a0aef-0x0;var _0x837448=_0x6324[_0x3a0aef];return _0x837448;};'use strict';var client=require(_0x4632('0x0'));exports[_0x4632('0x1')]=function(_0xb0927d){return function(_0x2fc528){return client['Request'](_0x4632('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x4632('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xb688=['Request','GetTemplate','name','getTemplates'];(function(_0x479c68,_0x4f2415){var _0x5215b1=function(_0x293c65){while(--_0x293c65){_0x479c68['push'](_0x479c68['shift']());}};_0x5215b1(++_0x4f2415);}(_0xb688,0xcf));var _0x8b68=function(_0x10fbe6,_0x19065c){_0x10fbe6=_0x10fbe6-0x0;var _0x3ffc90=_0xb688[_0x10fbe6];return _0x3ffc90;};'use strict';var client=require('../client');exports[_0x8b68('0x0')]=function(_0x196cec){return function(_0x266285){return client[_0x8b68('0x1')](_0x8b68('0x2'),{'options':{'raw':!![],'attributes':['id',_0x8b68('0x3'),'html']},'log':_0x8b68('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index b1cec72..6b585a8 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 _0x6856=['channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data1','data4','data5','data6','data7','../client','Request','GetTrigger'];(function(_0x35b23f,_0x554eee){var _0x13aaed=function(_0x37e382){while(--_0x37e382){_0x35b23f['push'](_0x35b23f['shift']());}};_0x13aaed(++_0x554eee);}(_0x6856,0x12d));var _0x6685=function(_0x154d1d,_0x33a101){_0x154d1d=_0x154d1d-0x0;var _0x28f6b8=_0x6856[_0x154d1d];return _0x28f6b8;};'use strict';var client=require(_0x6685('0x0'));exports['getTriggers']=function(_0x2127bd){return function(_0x2278b9){return client[_0x6685('0x1')](_0x6685('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x6685('0x3'),_0x6685('0x4')],'include':[{'model':_0x6685('0x5'),'as':_0x6685('0x6'),'attributes':['id',_0x6685('0x7'),_0x6685('0x8'),_0x6685('0x9')]},{'model':_0x6685('0x5'),'as':_0x6685('0xa'),'attributes':['id',_0x6685('0x7'),_0x6685('0x8'),_0x6685('0x9')]},{'model':_0x6685('0xb'),'as':_0x6685('0xc'),'attributes':['id',_0x6685('0xd'),_0x6685('0xe'),'data2','data3',_0x6685('0xf'),_0x6685('0x10'),_0x6685('0x11'),_0x6685('0x12')]}]},'log':_0x6685('0x2')});};}; \ No newline at end of file +var _0x5b6a=['AnyConditions','operator','Action','action','data2','data3','data5','data6','data7','../client','GetTrigger','channel','status','Condition','value'];(function(_0x5b0346,_0x28bd6d){var _0x357f3=function(_0x315d42){while(--_0x315d42){_0x5b0346['push'](_0x5b0346['shift']());}};_0x357f3(++_0x28bd6d);}(_0x5b6a,0x1e9));var _0xa5b6=function(_0x43aef7,_0x3ff371){_0x43aef7=_0x43aef7-0x0;var _0x55fe89=_0x5b6a[_0x43aef7];return _0x55fe89;};'use strict';var client=require(_0xa5b6('0x0'));exports['getTriggers']=function(_0x2331b6){return function(_0x2ebf9f){return client['Request'](_0xa5b6('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xa5b6('0x2'),_0xa5b6('0x3')],'include':[{'model':_0xa5b6('0x4'),'as':'AllConditions','attributes':['id','field','operator',_0xa5b6('0x5')]},{'model':_0xa5b6('0x4'),'as':_0xa5b6('0x6'),'attributes':['id','field',_0xa5b6('0x7'),'value']},{'model':_0xa5b6('0x8'),'as':'Actions','attributes':['id',_0xa5b6('0x9'),'data1',_0xa5b6('0xa'),_0xa5b6('0xb'),'data4',_0xa5b6('0xc'),_0xa5b6('0xd'),_0xa5b6('0xe')]}]},'log':_0xa5b6('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 381d9a0..4fe5bc7 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 _0x905d=['GetTrunk','name','registry','getTrunks','Request'];(function(_0x53977a,_0x2f45f3){var _0x568970=function(_0x366ab3){while(--_0x366ab3){_0x53977a['push'](_0x53977a['shift']());}};_0x568970(++_0x2f45f3);}(_0x905d,0x1bb));var _0xd905=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x905d[_0x2dafbe];return _0x58a45a;};'use strict';var client=require('../client');exports[_0xd905('0x0')]=function(_0x223df1){return function(_0x59e19e){return client[_0xd905('0x1')](_0xd905('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xd905('0x3'),_0xd905('0x4')]},'log':_0xd905('0x2')});};}; \ No newline at end of file +var _0x5f84=['name','registry','Request'];(function(_0x24aabf,_0x3372de){var _0xf9d23=function(_0x1019db){while(--_0x1019db){_0x24aabf['push'](_0x24aabf['shift']());}};_0xf9d23(++_0x3372de);}(_0x5f84,0xb0));var _0x45f8=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5f84[_0x19950b];return _0x3c6b41;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x311894){return function(_0xfed69d){return client[_0x45f8('0x0')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x45f8('0x1'),_0x45f8('0x2')]},'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 480d754..c212857 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 _0xeb70=['accountcode','internal','PauseUser','savePause','UnpauseUser','getAgent','fullname','online','lastLoginAt','getAgents','GetUser','name','email','pauseType','lastPauseAt','phone','mobile','interface','getTelephones','Request'];(function(_0x5abfeb,_0x570e41){var _0x157c00=function(_0x5c230d){while(--_0x5c230d){_0x5abfeb['push'](_0x5abfeb['shift']());}};_0x157c00(++_0x570e41);}(_0xeb70,0x185));var _0x0eb7=function(_0x18ae03,_0x5951fc){_0x18ae03=_0x18ae03-0x0;var _0x3e3fdd=_0xeb70[_0x18ae03];return _0x3e3fdd;};'use strict';var client=require('../client');exports[_0x0eb7('0x0')]=function(){return function(){return client['Request'](_0x0eb7('0x1'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0eb7('0x2'),_0x0eb7('0x3'),'accountcode','fullname','online','lastLoginAt',_0x0eb7('0x4'),_0x0eb7('0x5'),'voicePause',_0x0eb7('0x6'),_0x0eb7('0x7'),_0x0eb7('0x8')]},'log':_0x0eb7('0x0')});};};exports[_0x0eb7('0x9')]=function(){return function(){return client[_0x0eb7('0xa')](_0x0eb7('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x0eb7('0x2'),_0x0eb7('0xb'),_0x0eb7('0xc')]},'log':_0x0eb7('0x9')});};};exports['savePause']=function(_0x389170,_0x1254b4,_0x26978e){return client[_0x0eb7('0xa')](_0x0eb7('0xd'),{'body':{'type':_0x1254b4,'uniqueid':_0x26978e},'options':{'where':{'id':_0x389170['id']}},'log':_0x0eb7('0xe')});};exports['saveUnpause']=function(_0x202274){return client[_0x0eb7('0xa')](_0x0eb7('0xf'),{'body':{},'options':{'where':{'id':_0x202274['id']}},'log':'savePause'});};exports[_0x0eb7('0x10')]=function(_0xe74ba5){return client[_0x0eb7('0xa')]('ShowUser',{'options':{'raw':![],'where':{'role':'agent','id':_0xe74ba5},'attributes':['id',_0x0eb7('0x2'),_0x0eb7('0x3'),_0x0eb7('0xb'),_0x0eb7('0x11'),_0x0eb7('0x12'),_0x0eb7('0x13'),_0x0eb7('0x4'),_0x0eb7('0x5'),'voicePause',_0x0eb7('0x8')]},'log':_0x0eb7('0x10')});}; \ No newline at end of file +var _0x0ff5=['fullname','online','lastLoginAt','pauseType','phone','mobile','interface','getTelephones','telephone','internal','savePause','saveUnpause','UnpauseUser','getAgent','accountcode','voicePause','../client','getAgents','Request','GetUser','agent','name','email'];(function(_0x34f545,_0x2bd2ee){var _0x1ff6b8=function(_0x582e3b){while(--_0x582e3b){_0x34f545['push'](_0x34f545['shift']());}};_0x1ff6b8(++_0x2bd2ee);}(_0x0ff5,0x9a));var _0x50ff=function(_0x4cbdb7,_0x1b82f6){_0x4cbdb7=_0x4cbdb7-0x0;var _0x4ecb18=_0x0ff5[_0x4cbdb7];return _0x4ecb18;};'use strict';var client=require(_0x50ff('0x0'));exports[_0x50ff('0x1')]=function(){return function(){return client[_0x50ff('0x2')](_0x50ff('0x3'),{'options':{'raw':![],'where':{'role':_0x50ff('0x4')},'attributes':['id',_0x50ff('0x5'),_0x50ff('0x6'),'accountcode',_0x50ff('0x7'),_0x50ff('0x8'),_0x50ff('0x9'),_0x50ff('0xa'),'lastPauseAt','voicePause',_0x50ff('0xb'),_0x50ff('0xc'),_0x50ff('0xd')]},'log':'getAgents'});};};exports[_0x50ff('0xe')]=function(){return function(){return client[_0x50ff('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x50ff('0xf')},'attributes':['id',_0x50ff('0x5'),'accountcode',_0x50ff('0x10')]},'log':'getTelephones'});};};exports[_0x50ff('0x11')]=function(_0x3d016e,_0x5bd838,_0x2995f8){return client[_0x50ff('0x2')]('PauseUser',{'body':{'type':_0x5bd838,'uniqueid':_0x2995f8},'options':{'where':{'id':_0x3d016e['id']}},'log':_0x50ff('0x11')});};exports[_0x50ff('0x12')]=function(_0x211334){return client[_0x50ff('0x2')](_0x50ff('0x13'),{'body':{},'options':{'where':{'id':_0x211334['id']}},'log':_0x50ff('0x11')});};exports[_0x50ff('0x14')]=function(_0x170a37){return client[_0x50ff('0x2')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x50ff('0x4'),'id':_0x170a37},'attributes':['id','name',_0x50ff('0x6'),_0x50ff('0x15'),_0x50ff('0x7'),_0x50ff('0x8'),_0x50ff('0x9'),_0x50ff('0xa'),'lastPauseAt',_0x50ff('0x16'),_0x50ff('0xd')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index ac45a67..f77fc43 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 _0xa3ec=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x455150,_0x274121){var _0x12ca9c=function(_0x47eb22){while(--_0x47eb22){_0x455150['push'](_0x455150['shift']());}};_0x12ca9c(++_0x274121);}(_0xa3ec,0x195));var _0xca3e=function(_0x3816e6,_0x2ba308){_0x3816e6=_0x3816e6-0x0;var _0x2d11e3=_0xa3ec[_0x3816e6];return _0x2d11e3;};'use strict';var client=require(_0xca3e('0x0'));exports[_0xca3e('0x1')]=function(_0x20a66b){return client[_0xca3e('0x2')]('CreateVoiceAgentReport',{'body':_0x20a66b,'log':_0xca3e('0x3')});};exports[_0xca3e('0x4')]=function(_0x5bfa27,_0xdbe952,_0x1aa883){return client[_0xca3e('0x2')](_0xca3e('0x5'),{'body':_0x5bfa27,'options':{'where':{'uniqueid':_0xdbe952,'interface':_0x1aa883,'agentcomplete':!![]}},'log':_0xca3e('0x5')});}; \ No newline at end of file +var _0x132b=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x38182b,_0x5dbf8b){var _0x3d6a8c=function(_0x5ee16f){while(--_0x5ee16f){_0x38182b['push'](_0x38182b['shift']());}};_0x3d6a8c(++_0x5dbf8b);}(_0x132b,0x8d));var _0xb132=function(_0xfcb430,_0x1283db){_0xfcb430=_0xfcb430-0x0;var _0x49b575=_0x132b[_0xfcb430];return _0x49b575;};'use strict';var client=require(_0xb132('0x0'));exports[_0xb132('0x1')]=function(_0x5cc734){return client[_0xb132('0x2')](_0xb132('0x3'),{'body':_0x5cc734,'log':_0xb132('0x3')});};exports['update']=function(_0x1272dd,_0x18c143,_0x5acaa0){return client[_0xb132('0x2')](_0xb132('0x4'),{'body':_0x1272dd,'options':{'where':{'uniqueid':_0x18c143,'interface':_0x5acaa0,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 39d0698..027ced1 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 _0xbae5=['day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','getVoiceCallReports','outbound','startOf'];(function(_0x3d875b,_0x4ac475){var _0x52e4f5=function(_0x46d964){while(--_0x46d964){_0x3d875b['push'](_0x3d875b['shift']());}};_0x52e4f5(++_0x4ac475);}(_0xbae5,0x1d5));var _0x5bae=function(_0x586fbe,_0x2044d2){_0x586fbe=_0x586fbe-0x0;var _0x31bdca=_0xbae5[_0x586fbe];return _0x31bdca;};'use strict';var moment=require(_0x5bae('0x0'));var util=require(_0x5bae('0x1'));var _=require('lodash');var client=require(_0x5bae('0x2'));exports[_0x5bae('0x3')]=function(_0x1da8ac){return client[_0x5bae('0x4')](_0x5bae('0x5'),{'body':_[_0x5bae('0x6')](_0x1da8ac,{'source':_0x1da8ac[_0x5bae('0x7')],'destinationcontext':_0x1da8ac['context'],'callerid':_0x1da8ac['callerid'],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0x5bae('0x8')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0x5bae('0x9')],'createdAt':{'$between':[moment()[_0x5bae('0xa')](_0x5bae('0xb'))[_0x5bae('0xc')](_0x5bae('0xd')),moment()[_0x5bae('0xe')](_0x5bae('0xb'))[_0x5bae('0xc')](_0x5bae('0xd'))]}},'attributes':[_0x5bae('0xf'),_0x5bae('0x10'),_0x5bae('0x11'),_0x5bae('0x12')]},'log':_0x5bae('0x13')});};}; \ No newline at end of file +var _0xc07a=['callerid','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','format','YYYY-MM-DD\x20HH:mm:ss','day','type','disposition','billableseconds','GetVoiceCallReports','moment','util','lodash','create','CreateVoiceCallReport','merge','calleridnum','context'];(function(_0x306e94,_0x8f682b){var _0x4a3d2f=function(_0x242f57){while(--_0x242f57){_0x306e94['push'](_0x306e94['shift']());}};_0x4a3d2f(++_0x8f682b);}(_0xc07a,0x1c4));var _0xac07=function(_0x5ee5af,_0x52369f){_0x5ee5af=_0x5ee5af-0x0;var _0x1fdd47=_0xc07a[_0x5ee5af];return _0x1fdd47;};'use strict';var moment=require(_0xac07('0x0'));var util=require(_0xac07('0x1'));var _=require(_0xac07('0x2'));var client=require('../client');exports[_0xac07('0x3')]=function(_0x4640b3){return client['Request'](_0xac07('0x4'),{'body':_[_0xac07('0x5')](_0x4640b3,{'source':_0x4640b3[_0xac07('0x6')],'destinationcontext':_0x4640b3[_0xac07('0x7')],'callerid':_0x4640b3[_0xac07('0x8')],'amaflags':_0xac07('0x9')}),'log':_0xac07('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0xac07('0xa'),{'options':{'where':{'type':[_0xac07('0xb')],'createdAt':{'$between':[moment()[_0xac07('0xc')]('day')[_0xac07('0xd')](_0xac07('0xe')),moment()['endOf'](_0xac07('0xf'))[_0xac07('0xd')](_0xac07('0xe'))]}},'attributes':[_0xac07('0x10'),_0xac07('0x11'),'duration',_0xac07('0x12')]},'log':_0xac07('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 245bd85..3824e1d 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 _0x8365=['../client','create','Request','CreateVoiceDialReport'];(function(_0x490cf0,_0x302b19){var _0x3b954e=function(_0x527f6e){while(--_0x527f6e){_0x490cf0['push'](_0x490cf0['shift']());}};_0x3b954e(++_0x302b19);}(_0x8365,0x180));var _0x5836=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x8365[_0xfae23b];return _0x200640;};'use strict';var client=require(_0x5836('0x0'));exports[_0x5836('0x1')]=function(_0xee9544){return client[_0x5836('0x2')]('CreateVoiceDialReport',{'body':_0xee9544,'log':_0x5836('0x3')});}; \ No newline at end of file +var _0xc970=['Request','CreateVoiceDialReport','../client'];(function(_0x47af1b,_0x4cb20e){var _0x149364=function(_0x561b24){while(--_0x561b24){_0x47af1b['push'](_0x47af1b['shift']());}};_0x149364(++_0x4cb20e);}(_0xc970,0x9b));var _0x0c97=function(_0x7377e8,_0xa36817){_0x7377e8=_0x7377e8-0x0;var _0x417b70=_0xc970[_0x7377e8];return _0x417b70;};'use strict';var client=require(_0x0c97('0x0'));exports['create']=function(_0x5207d6){return client[_0x0c97('0x1')](_0x0c97('0x2'),{'body':_0x5207d6,'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 8d02c11..a6371b6 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 _0xb139=['exten','recordingFormat','../client','getVoiceExtensions','GetVoiceExtension'];(function(_0x12b83d,_0x4bcec7){var _0x1fd39d=function(_0x449185){while(--_0x449185){_0x12b83d['push'](_0x12b83d['shift']());}};_0x1fd39d(++_0x4bcec7);}(_0xb139,0x1ba));var _0x9b13=function(_0x1e5066,_0x2f4db6){_0x1e5066=_0x1e5066-0x0;var _0x1cbd7a=_0xb139[_0x1e5066];return _0x1cbd7a;};'use strict';var client=require(_0x9b13('0x0'));exports[_0x9b13('0x1')]=function(){return function(){return client['Request'](_0x9b13('0x2'),{'options':{'raw':!![],'attributes':['id',_0x9b13('0x3'),_0x9b13('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xc902=['../client','getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0x55f9f8,_0x171532){var _0x2061e0=function(_0x3e47f6){while(--_0x3e47f6){_0x55f9f8['push'](_0x55f9f8['shift']());}};_0x2061e0(++_0x171532);}(_0xc902,0x15c));var _0x2c90=function(_0x140369,_0x385cd1){_0x140369=_0x140369-0x0;var _0x15ce57=_0xc902[_0x140369];return _0x15ce57;};'use strict';var client=require(_0x2c90('0x0'));exports[_0x2c90('0x1')]=function(){return function(){return client[_0x2c90('0x2')](_0x2c90('0x3'),{'options':{'raw':!![],'attributes':['id',_0x2c90('0x4'),_0x2c90('0x5')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 81c3886..090b84d 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 _0x1bcc=['dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','Intervals','interval','getVoiceQueues','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject'];(function(_0x383a11,_0x7c00a6){var _0x5da89d=function(_0x12c4e8){while(--_0x12c4e8){_0x383a11['push'](_0x383a11['shift']());}};_0x5da89d(++_0x7c00a6);}(_0x1bcc,0x11c));var _0xc1bc=function(_0x188905,_0x398fac){_0x188905=_0x188905-0x0;var _0x2bf735=_0x1bcc[_0x188905];return _0x2bf735;};'use strict';var client=require('../client');exports[_0xc1bc('0x0')]=function(){return function(){return client['Request'](_0xc1bc('0x1'),{'options':{'raw':![],'attributes':['id',_0xc1bc('0x2'),_0xc1bc('0x3'),_0xc1bc('0x4'),_0xc1bc('0x5'),_0xc1bc('0x6'),_0xc1bc('0x7'),_0xc1bc('0x8'),'dialMethod',_0xc1bc('0x9'),_0xc1bc('0xa'),_0xc1bc('0xb'),_0xc1bc('0xc'),_0xc1bc('0xd'),_0xc1bc('0xe'),_0xc1bc('0xf'),_0xc1bc('0x10'),_0xc1bc('0x11'),_0xc1bc('0x12'),_0xc1bc('0x13'),_0xc1bc('0x14'),_0xc1bc('0x15'),'dialCongestionRetryFrequency',_0xc1bc('0x16'),_0xc1bc('0x17'),_0xc1bc('0x18'),_0xc1bc('0x19'),_0xc1bc('0x1a'),_0xc1bc('0x1b'),_0xc1bc('0x1c'),'dialPrefix','dialCheckDuplicateType','dialAMDActive',_0xc1bc('0x1d'),_0xc1bc('0x1e'),_0xc1bc('0x1f'),'dialAMDTotalAnalysisTime',_0xc1bc('0x20'),'dialAMDBetweenWordsSilence',_0xc1bc('0x21'),_0xc1bc('0x22'),_0xc1bc('0x23'),_0xc1bc('0x24'),'dialRecallMeTimeout',_0xc1bc('0x25'),'dialOrderByScheduledAt',_0xc1bc('0x26'),'dialAgiAfterHangupClient',_0xc1bc('0x27'),_0xc1bc('0x6'),_0xc1bc('0x28'),_0xc1bc('0x29'),_0xc1bc('0x2a'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0xc1bc('0x2b'),_0xc1bc('0x2c'),_0xc1bc('0x2d'),_0xc1bc('0x2e'),_0xc1bc('0x2f'),_0xc1bc('0x30'),_0xc1bc('0x31'),_0xc1bc('0x32'),'mandatoryDisposition',_0xc1bc('0x33'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0xc1bc('0x34'),'as':_0xc1bc('0x34'),'attributes':['id',_0xc1bc('0x2'),'callerid',_0xc1bc('0x35')]},{'model':_0xc1bc('0x36'),'as':_0xc1bc('0x37'),'attributes':['id',_0xc1bc('0x2')]},{'model':_0xc1bc('0x34'),'as':_0xc1bc('0x38'),'attributes':['id',_0xc1bc('0x2'),_0xc1bc('0x39'),_0xc1bc('0x35')]},{'model':_0xc1bc('0x3a'),'as':_0xc1bc('0x3a'),'attributes':['id',_0xc1bc('0x2')],'include':[{'model':'Interval','as':_0xc1bc('0x3b'),'attributes':['id',_0xc1bc('0x2'),_0xc1bc('0x3c')]}]}]},'log':_0xc1bc('0x0')});};}; \ No newline at end of file +var _0xecfd=['dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','GetVoiceQueue','name','acwTimeout','monitor_format','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue'];(function(_0xf04c6d,_0xe98786){var _0x4a804e=function(_0x431a0a){while(--_0x431a0a){_0xf04c6d['push'](_0xf04c6d['shift']());}};_0x4a804e(++_0xe98786);}(_0xecfd,0x190));var _0xdecf=function(_0x194512,_0x39f7bb){_0x194512=_0x194512-0x0;var _0x46f2c7=_0xecfd[_0x194512];return _0x46f2c7;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client['Request'](_0xdecf('0x0'),{'options':{'raw':![],'attributes':['id',_0xdecf('0x1'),'acw',_0xdecf('0x2'),'autopause',_0xdecf('0x3'),'type','dialActive','dialMethod',_0xdecf('0x4'),_0xdecf('0x5'),'dialPowerLevel',_0xdecf('0x6'),'dialPredictiveOptimizationPercentage',_0xdecf('0x7'),_0xdecf('0x8'),_0xdecf('0x9'),_0xdecf('0xa'),_0xdecf('0xb'),_0xdecf('0xc'),_0xdecf('0xd'),_0xdecf('0xe'),_0xdecf('0xf'),_0xdecf('0x10'),_0xdecf('0x11'),_0xdecf('0x12'),'dialNoAnswerRetryFrequency',_0xdecf('0x13'),_0xdecf('0x14'),'dialGlobalInterval','dialPrefix',_0xdecf('0x15'),_0xdecf('0x16'),_0xdecf('0x17'),_0xdecf('0x18'),_0xdecf('0x19'),_0xdecf('0x1a'),'dialAMDMinWordLength',_0xdecf('0x1b'),_0xdecf('0x1c'),'dialAMDSilenceThreshold',_0xdecf('0x1d'),'timeout',_0xdecf('0x1e'),_0xdecf('0x1f'),_0xdecf('0x20'),_0xdecf('0x21'),_0xdecf('0x22'),'dialQueueProject2',_0xdecf('0x3'),_0xdecf('0x23'),_0xdecf('0x24'),'dialCutDigit',_0xdecf('0x25'),'dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency',_0xdecf('0x26'),'dialAbandonedRetryFrequency',_0xdecf('0x27'),'dialMachineRetryFrequency',_0xdecf('0x28'),_0xdecf('0x29'),_0xdecf('0x2a'),_0xdecf('0x2b'),_0xdecf('0x2c')],'include':[{'model':_0xdecf('0x2d'),'as':_0xdecf('0x2d'),'attributes':['id',_0xdecf('0x1'),_0xdecf('0x2e'),_0xdecf('0x2f')]},{'model':_0xdecf('0x30'),'as':'mandatoryDispositionPause','attributes':['id',_0xdecf('0x1')]},{'model':'Trunk','as':_0xdecf('0x31'),'attributes':['id',_0xdecf('0x1'),'callerid','active']},{'model':_0xdecf('0x32'),'as':_0xdecf('0x32'),'attributes':['id',_0xdecf('0x1')],'include':[{'model':'Interval','as':_0xdecf('0x33'),'attributes':['id',_0xdecf('0x1'),_0xdecf('0x34')]}]}]},'log':_0xdecf('0x35')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 1393fc0..39ee3e1 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 _0x9055=['YYYY-MM-DD\x20HH:mm:ss','endOf','queue','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','day','format'];(function(_0x1aab74,_0x38a57b){var _0x396af2=function(_0x1c2e0d){while(--_0x1c2e0d){_0x1aab74['push'](_0x1aab74['shift']());}};_0x396af2(++_0x38a57b);}(_0x9055,0xa2));var _0x5905=function(_0xc205a4,_0x36b067){_0xc205a4=_0xc205a4-0x0;var _0xab679a=_0x9055[_0xc205a4];return _0xab679a;};'use strict';var moment=require(_0x5905('0x0'));var _=require(_0x5905('0x1'));var client=require('../client');exports['create']=function(_0x2e4385){return client[_0x5905('0x2')](_0x5905('0x3'),{'body':_0x2e4385,'log':_0x5905('0x3')});};exports[_0x5905('0x4')]=function(){return function(){return client[_0x5905('0x2')](_0x5905('0x5'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x5905('0x6')](_0x5905('0x7'))[_0x5905('0x8')](_0x5905('0x9')),moment()[_0x5905('0xa')](_0x5905('0x7'))[_0x5905('0x8')](_0x5905('0x9'))]}},'attributes':['uniqueid',_0x5905('0xb'),'queuecallerjoinAt',_0x5905('0xc'),_0x5905('0xd'),_0x5905('0xe'),_0x5905('0xf'),_0x5905('0x10'),'queuecallerabandon',_0x5905('0x11')]},'log':_0x5905('0x12')});};}; \ No newline at end of file +var _0xb7a1=['YYYY-MM-DD\x20HH:mm:ss','uniqueid','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','moment','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','day'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0xb7a1,0xe6));var _0x1b7a=function(_0x51ba53,_0x5ce838){_0x51ba53=_0x51ba53-0x0;var _0x464aeb=_0xb7a1[_0x51ba53];return _0x464aeb;};'use strict';var moment=require(_0x1b7a('0x0'));var _=require(_0x1b7a('0x1'));var client=require(_0x1b7a('0x2'));exports[_0x1b7a('0x3')]=function(_0x402474){return client[_0x1b7a('0x4')](_0x1b7a('0x5'),{'body':_0x402474,'log':_0x1b7a('0x5')});};exports[_0x1b7a('0x6')]=function(){return function(){return client[_0x1b7a('0x4')](_0x1b7a('0x7'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x1b7a('0x8')](_0x1b7a('0x9'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x1b7a('0x9'))['format'](_0x1b7a('0xa'))]}},'attributes':[_0x1b7a('0xb'),'queue',_0x1b7a('0xc'),_0x1b7a('0xd'),_0x1b7a('0xe'),_0x1b7a('0xf'),_0x1b7a('0x10'),_0x1b7a('0x11'),_0x1b7a('0x12'),_0x1b7a('0x13')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index e953bab..463a4c8 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 _0x8d03=['../client','Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x20f4c1,_0x353f7f){var _0x1ad915=function(_0xd3396a){while(--_0xd3396a){_0x20f4c1['push'](_0x20f4c1['shift']());}};_0x1ad915(++_0x353f7f);}(_0x8d03,0x138));var _0x38d0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x8d03[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0x38d0('0x0'));exports['getVoiceQueueRtPauses']=function(_0x2b6ff6){return function(){return client[_0x38d0('0x1')](_0x38d0('0x2'),{'options':{'where':{'VoiceQueueId':_0x2b6ff6,'paused':!![]},'raw':!![]},'log':_0x38d0('0x3')});};}; \ No newline at end of file +var _0x3676=['getVoiceQueueRtPauses','../client','Request','GetVoiceQueueRtPauses'];(function(_0x4db4c9,_0x2fde42){var _0x177126=function(_0x5065f6){while(--_0x5065f6){_0x4db4c9['push'](_0x4db4c9['shift']());}};_0x177126(++_0x2fde42);}(_0x3676,0x14d));var _0x6367=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x3676[_0x231e16];return _0x570a7c;};'use strict';var client=require(_0x6367('0x0'));exports['getVoiceQueueRtPauses']=function(_0x1c5545){return function(){return client[_0x6367('0x1')](_0x6367('0x2'),{'options':{'where':{'VoiceQueueId':_0x1c5545,'paused':!![]},'raw':!![]},'log':_0x6367('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 4da7028..8485009 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 _0xe62c=['create','Request','CreateVoiceRecording','merge','monitorFilename','lodash','../client'];(function(_0xd44e5f,_0x56249a){var _0x1bf73e=function(_0x6dc06b){while(--_0x6dc06b){_0xd44e5f['push'](_0xd44e5f['shift']());}};_0x1bf73e(++_0x56249a);}(_0xe62c,0x12b));var _0xce62=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xe62c[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0xce62('0x0'));var client=require(_0xce62('0x1'));exports[_0xce62('0x2')]=function(_0x31583b){return client[_0xce62('0x3')](_0xce62('0x4'),{'body':_[_0xce62('0x5')](_0x31583b,{'value':_0x31583b[_0xce62('0x6')]}),'log':_0xce62('0x4')});}; \ No newline at end of file +var _0x8160=['CreateVoiceRecording','monitorFilename','lodash','Request'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8160,0x17a));var _0x0816=function(_0xd8b13b,_0x108ffc){_0xd8b13b=_0xd8b13b-0x0;var _0x474663=_0x8160[_0xd8b13b];return _0x474663;};'use strict';var _=require(_0x0816('0x0'));var client=require('../client');exports['create']=function(_0x2ae117){return client[_0x0816('0x1')](_0x0816('0x2'),{'body':_['merge'](_0x2ae117,{'value':_0x2ae117[_0x0816('0x3')]}),'log':_0x0816('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index d39d6ff..6af715d 100644 --- a/server/services/ami/rpc/voiceTransferReport.js +++ b/server/services/ami/rpc/voiceTransferReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x46c6=['transfereecontext','transfereeexten','blind','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','transfertargetchannel','transfertargetconnectedlinename','transfertargetlinkedid','isexternal','origtransferercontext','attended','../client','transfers','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode'];(function(_0x53274e,_0x3ae9ed){var _0xeda1a5=function(_0x4b8092){while(--_0x4b8092){_0x53274e['push'](_0x53274e['shift']());}};_0xeda1a5(++_0x3ae9ed);}(_0x46c6,0xc8));var _0x646c=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x46c6[_0x46698a];return _0x356db0;};'use strict';var client=require(_0x646c('0x0'));exports[_0x646c('0x1')]={};exports['blindTransfer']=function(_0x5d2f93){return client['Request'](_0x646c('0x2'),{'body':{'result':_0x5d2f93[_0x646c('0x3')],'transfererchannel':_0x5d2f93[_0x646c('0x4')],'transferercalleridnum':_0x5d2f93[_0x646c('0x5')],'transferercalleridname':_0x5d2f93[_0x646c('0x6')],'transfererconnectedlinenum':_0x5d2f93[_0x646c('0x7')],'transfererconnectedlinename':_0x5d2f93[_0x646c('0x8')],'transfereraccountcode':_0x5d2f93['transfereraccountcode'],'transferercontext':_0x5d2f93[_0x646c('0x9')],'transfererexten':_0x5d2f93[_0x646c('0xa')],'transfererlinkedid':_0x5d2f93[_0x646c('0xb')],'transfereechannel':_0x5d2f93[_0x646c('0xc')],'transfereecalleridnum':_0x5d2f93['transfereecalleridnum'],'transfereecalleridname':_0x5d2f93[_0x646c('0xd')],'transfereeconnectedlinenum':_0x5d2f93[_0x646c('0xe')],'transfereeconnectedlinename':_0x5d2f93[_0x646c('0xf')],'transfereeaccountcode':_0x5d2f93[_0x646c('0x10')],'transfereecontext':_0x5d2f93[_0x646c('0x11')],'transfereeexten':_0x5d2f93[_0x646c('0x12')],'transfereelinkedid':_0x5d2f93['transfereelinkedid'],'isexternal':_0x5d2f93['isexternal'],'context':_0x5d2f93['context'],'extension':_0x5d2f93['extension'],'type':_0x646c('0x13')},'log':_0x646c('0x2')});};exports['attendedTransfer']=function(_0x2d490e){return client['Request'](_0x646c('0x2'),{'body':{'result':_0x2d490e[_0x646c('0x3')],'transfererchannel':_0x2d490e['origtransfererchannel'],'transferercalleridnum':_0x2d490e['origtransferercalleridnum'],'transferercalleridname':_0x2d490e[_0x646c('0x14')],'transfererconnectedlinenum':_0x2d490e[_0x646c('0x15')],'transfererconnectedlinename':_0x2d490e[_0x646c('0x16')],'transfereraccountcode':_0x2d490e[_0x646c('0x17')],'transferercontext':_0x2d490e['secondtransferercontext'],'transfererexten':_0x2d490e['secondtransfererexten'],'transfererlinkedid':_0x2d490e[_0x646c('0x18')],'transfereechannel':_0x2d490e[_0x646c('0x19')],'transfereecalleridnum':_0x2d490e['transfertargetcalleridnum'],'transfereecalleridname':_0x2d490e['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x2d490e['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2d490e[_0x646c('0x1a')],'transfereeaccountcode':_0x2d490e['transfertargetaccountcode'],'transfereecontext':_0x2d490e['transfertargetcontext'],'transfereeexten':_0x2d490e['transfertargetexten'],'transfereelinkedid':_0x2d490e[_0x646c('0x1b')],'isexternal':_0x2d490e[_0x646c('0x1c')],'context':_0x2d490e[_0x646c('0x1d')],'extension':_0x2d490e['origtransfererexten'],'type':_0x646c('0x1e')},'log':_0x646c('0x2')});}; \ No newline at end of file +var _0xb095=['extension','blind','origtransfererchannel','origtransferercalleridnum','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetexten','transfertargetlinkedid','origtransferercontext','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','context'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xb095,0x13f));var _0x5b09=function(_0x1b88b2,_0x1341c7){_0x1b88b2=_0x1b88b2-0x0;var _0x550e70=_0xb095[_0x1b88b2];return _0x550e70;};'use strict';var client=require(_0x5b09('0x0'));exports['transfers']={};exports[_0x5b09('0x1')]=function(_0xf65b4b){return client[_0x5b09('0x2')](_0x5b09('0x3'),{'body':{'result':_0xf65b4b[_0x5b09('0x4')],'transfererchannel':_0xf65b4b[_0x5b09('0x5')],'transferercalleridnum':_0xf65b4b[_0x5b09('0x6')],'transferercalleridname':_0xf65b4b['transferercalleridname'],'transfererconnectedlinenum':_0xf65b4b[_0x5b09('0x7')],'transfererconnectedlinename':_0xf65b4b[_0x5b09('0x8')],'transfereraccountcode':_0xf65b4b[_0x5b09('0x9')],'transferercontext':_0xf65b4b[_0x5b09('0xa')],'transfererexten':_0xf65b4b['transfererexten'],'transfererlinkedid':_0xf65b4b[_0x5b09('0xb')],'transfereechannel':_0xf65b4b[_0x5b09('0xc')],'transfereecalleridnum':_0xf65b4b[_0x5b09('0xd')],'transfereecalleridname':_0xf65b4b[_0x5b09('0xe')],'transfereeconnectedlinenum':_0xf65b4b[_0x5b09('0xf')],'transfereeconnectedlinename':_0xf65b4b[_0x5b09('0x10')],'transfereeaccountcode':_0xf65b4b[_0x5b09('0x11')],'transfereecontext':_0xf65b4b['transfereecontext'],'transfereeexten':_0xf65b4b[_0x5b09('0x12')],'transfereelinkedid':_0xf65b4b[_0x5b09('0x13')],'isexternal':_0xf65b4b['isexternal'],'context':_0xf65b4b[_0x5b09('0x14')],'extension':_0xf65b4b[_0x5b09('0x15')],'type':_0x5b09('0x16')},'log':_0x5b09('0x3')});};exports['attendedTransfer']=function(_0x342fff){return client[_0x5b09('0x2')](_0x5b09('0x3'),{'body':{'result':_0x342fff[_0x5b09('0x4')],'transfererchannel':_0x342fff[_0x5b09('0x17')],'transferercalleridnum':_0x342fff[_0x5b09('0x18')],'transferercalleridname':_0x342fff['origtransferercalleridname'],'transfererconnectedlinenum':_0x342fff['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x342fff['secondtransfererconnectedlinename'],'transfereraccountcode':_0x342fff['origtransfereraccountcode'],'transferercontext':_0x342fff[_0x5b09('0x19')],'transfererexten':_0x342fff[_0x5b09('0x1a')],'transfererlinkedid':_0x342fff['origtransfererlinkedid'],'transfereechannel':_0x342fff[_0x5b09('0x1b')],'transfereecalleridnum':_0x342fff[_0x5b09('0x1c')],'transfereecalleridname':_0x342fff[_0x5b09('0x1d')],'transfereeconnectedlinenum':_0x342fff[_0x5b09('0x1e')],'transfereeconnectedlinename':_0x342fff['transfertargetconnectedlinename'],'transfereeaccountcode':_0x342fff['transfertargetaccountcode'],'transfereecontext':_0x342fff['transfertargetcontext'],'transfereeexten':_0x342fff[_0x5b09('0x1f')],'transfereelinkedid':_0x342fff[_0x5b09('0x20')],'isexternal':_0x342fff['isexternal'],'context':_0x342fff[_0x5b09('0x21')],'extension':_0x342fff['origtransfererexten'],'type':'attended'},'log':_0x5b09('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index c4a96e8..22e59f1 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 _0xafaf=['/var/spool/asterisk/monitor/','isNil','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','status','StopMixMonitor\x20Success','voicequeuechannel','queueChannels','voicequeuechannelhangup','Hangup','Redirect','exten','telephones','trunks','outboundChannels','outbound','campaigns','run','event','emit','checkAfterSend','http','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','bluebird','../properties','../ami','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','asterisk','username','ami\x20disconnected','join','keys','module','action','Reload','Action','then','message','catch','error','pick','command','Command','content','voiceQueues','hasOwnProperty','strategy','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','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','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','find','omit','undefined','values','channels','voicechannel','map','uniqueid','channel','%s.%s','filename','wav','MixMonitor','monitors'];(function(_0x537621,_0x302d0e){var _0x17c0ac=function(_0x31a735){while(--_0x31a735){_0x537621['push'](_0x537621['shift']());}};_0x17c0ac(++_0x302d0e);}(_0xafaf,0x12e));var _0xfafa=function(_0x219090,_0x472dc0){_0x219090=_0x219090-0x0;var _0x10e2c7=_0xafaf[_0x219090];return _0x10e2c7;};'use strict';var _=require(_0xfafa('0x0'));var util=require('util');var jayson=require(_0xfafa('0x1'));var schema=require(_0xfafa('0x2'));var BPromise=require(_0xfafa('0x3'));var moment=require('moment');var config=require('../../../config/environment');var properties=require(_0xfafa('0x4'));var ami=require(_0xfafa('0x5'));exports['listen']=function(_0x549711,_0x27b299,_0x2d9ed5){return new BPromise(function(_0x5c50c0,_0x10cc24){var _0x1abfd8={'QueuePause':function(_0x51c1dc){return new Promise(function(_0xd46133,_0x50ff67){var _0x46b026=util[_0xfafa('0x6')](_0xfafa('0x7'),_0xfafa('0x8'),_0x51c1dc[_0xfafa('0x9')]);if(_0x549711['timers']&&_0x549711['timers'][_0x46b026]&&_0x549711[_0xfafa('0xa')][_0x46b026][_0xfafa('0xb')]){_0x549711[_0xfafa('0xa')][_0x46b026][_0xfafa('0xc')]();}if(_0x549711[_0xfafa('0xd')][_0x46b026]){_0x549711[_0xfafa('0xd')][_0x46b026][_0xfafa('0xe')]({'statePause':_0x51c1dc['pause']?!![]:![]});}_0xd46133({'code':0xc8,'message':_0xfafa('0xf')});});},'Reload':function(_0x3aeb91){var _0x8accbf=this;return new Promise(function(_0x9c04a2,_0x2c9d66){if(ami[_0xfafa('0x10')]()==![]){return _0x2c9d66(_0x8accbf['error'](0x1f4,[config[_0xfafa('0x11')]['ip'],config['asterisk'][_0xfafa('0x12')],_0xfafa('0x13')][_0xfafa('0x14')]('\x20')));}_0x3aeb91=_['pick'](_0x3aeb91,_[_0xfafa('0x15')](properties[_0xfafa('0x16')]));_0x3aeb91[_0xfafa('0x17')]=_0xfafa('0x18');return ami[_0xfafa('0x19')](_0x3aeb91)[_0xfafa('0x1a')](function(_0x469ed7){_0x9c04a2({'code':0xc8,'message':_0x469ed7[_0xfafa('0x1b')]});})[_0xfafa('0x1c')](function(_0x4fff84){_0x2c9d66(_0x8accbf[_0xfafa('0x1d')](0x1f5,_0x4fff84['message']));});});},'Command':function(_0x2d460a){var _0x12222b=this;return new Promise(function(_0x38b446,_0x47d11c){if(ami[_0xfafa('0x10')]()==![]){return _0x47d11c(_0x12222b['error'](0x1f4,[config[_0xfafa('0x11')]['ip'],config[_0xfafa('0x11')][_0xfafa('0x12')],'ami\x20disconnected']['join']('\x20')));}_0x2d460a=_[_0xfafa('0x1e')](_0x2d460a,_0xfafa('0x1f'));_0x2d460a[_0xfafa('0x17')]=_0xfafa('0x20');return ami[_0xfafa('0x19')](_0x2d460a)['then'](function(_0x52654e){_0x38b446({'code':0xc8,'message':_0x52654e[_0xfafa('0x21')]});})['catch'](function(_0x58c841){_0x47d11c(_0x12222b[_0xfafa('0x1d')](0x1f5,_0x58c841['message']));});});},'VoiceQueues':function(_0x1da2a4){return new Promise(function(_0x2e5a2c,_0x2b1b38){var _0x3ea1ce=[];for(var _0x4d24c4 in _0x549711[_0xfafa('0x22')]){if(_0x549711[_0xfafa('0x22')][_0xfafa('0x23')](_0x4d24c4)){var _0x1be9c8=_0x549711['voiceQueues'][_0x4d24c4];var _0x4cfed8={'id':_0x1be9c8['id'],'name':_0x1be9c8['name'],'strategy':_0x1be9c8[_0xfafa('0x24')],'answered':_0x1be9c8['answered'],'available':_0x1be9c8[_0xfafa('0x25')],'loggedIn':_0x1be9c8[_0xfafa('0x26')],'pTalking':_0x1be9c8[_0xfafa('0x27')],'sumBillable':_0x1be9c8['sumBillable'],'sumDuration':_0x1be9c8[_0xfafa('0x28')],'sumHoldTime':_0x1be9c8[_0xfafa('0x29')]||0x0,'talking':_0x1be9c8[_0xfafa('0x2a')],'total':_0x1be9c8[_0xfafa('0x2b')],'type':_0x1be9c8[_0xfafa('0x2c')],'unmanaged':_0x1be9c8[_0xfafa('0x2d')],'abandoned':_0x1be9c8[_0xfafa('0x2e')],'waiting':_0x1be9c8[_0xfafa('0x2f')],'loggedInDb':_0x1be9c8['loggedInDb']};if(_0x1be9c8[_0xfafa('0x2c')]==='outbound'){_0x4cfed8[_0xfafa('0x30')]=_0x1be9c8['dialActive'];_0x4cfed8[_0xfafa('0x31')]=_0x1be9c8[_0xfafa('0x31')];_0x4cfed8[_0xfafa('0x32')]=_0x1be9c8[_0xfafa('0x32')];_0x4cfed8[_0xfafa('0x33')]=_0x1be9c8[_0xfafa('0x33')];_0x4cfed8[_0xfafa('0x34')]=_0x1be9c8[_0xfafa('0x34')];_0x4cfed8[_0xfafa('0x35')]=_0x1be9c8['dialPrefix'];_0x4cfed8[_0xfafa('0x36')]=_0x1be9c8[_0xfafa('0x36')];_0x4cfed8[_0xfafa('0x37')]=_0x1be9c8[_0xfafa('0x37')];_0x4cfed8['outboundAnswerCallsDay']=_0x1be9c8[_0xfafa('0x38')];_0x4cfed8['outboundBlacklistCallsDay']=_0x1be9c8[_0xfafa('0x39')];_0x4cfed8['outboundBusyCallsDay']=_0x1be9c8[_0xfafa('0x3a')];_0x4cfed8['outboundCongestionCallsDay']=_0x1be9c8[_0xfafa('0x3b')];_0x4cfed8[_0xfafa('0x3c')]=_0x1be9c8[_0xfafa('0x3c')];_0x4cfed8[_0xfafa('0x3d')]=_0x1be9c8['outboundDropCallsDayCallersExit'];_0x4cfed8[_0xfafa('0x3e')]=_0x1be9c8['outboundDropCallsDayTimeout'];_0x4cfed8[_0xfafa('0x3f')]=_0x1be9c8[_0xfafa('0x3f')];_0x4cfed8[_0xfafa('0x40')]=_0x1be9c8['outboundNoSuchCallsDay'];_0x4cfed8[_0xfafa('0x41')]=_0x1be9c8['outboundOriginateFailureCallsDay'];_0x4cfed8[_0xfafa('0x42')]=_0x1be9c8['outboundReCallsDay'];_0x4cfed8[_0xfafa('0x43')]=_0x1be9c8[_0xfafa('0x43')];_0x4cfed8['outboundUnknownCallsDay']=_0x1be9c8[_0xfafa('0x44')];_0x4cfed8[_0xfafa('0x45')]=_0x1be9c8[_0xfafa('0x45')];_0x4cfed8[_0xfafa('0x46')]=_0x1be9c8['predictiveIntervalAvgHoldtime'];_0x4cfed8[_0xfafa('0x47')]=_0x1be9c8[_0xfafa('0x47')];_0x4cfed8[_0xfafa('0x48')]=_0x1be9c8[_0xfafa('0x48')];_0x4cfed8[_0xfafa('0x49')]=_0x1be9c8[_0xfafa('0x49')];_0x4cfed8[_0xfafa('0x4a')]=_0x1be9c8[_0xfafa('0x4a')];_0x4cfed8[_0xfafa('0x4b')]=_0x1be9c8[_0xfafa('0x4b')];_0x4cfed8[_0xfafa('0x4c')]=_0x1be9c8[_0xfafa('0x4c')];_0x4cfed8[_0xfafa('0x4d')]=_0x1be9c8[_0xfafa('0x4d')];_0x4cfed8['predictiveIntervalPauses']=_0x1be9c8[_0xfafa('0x4e')];_0x4cfed8[_0xfafa('0x4f')]=_0x1be9c8['predictiveIntervalAvailable'];_0x4cfed8[_0xfafa('0x50')]=_0x1be9c8[_0xfafa('0x50')];_0x4cfed8[_0xfafa('0x1b')]=_0x1be9c8[_0xfafa('0x1b')];_0x4cfed8['originated']=_0x1be9c8[_0xfafa('0x51')];_0x4cfed8[_0xfafa('0x52')]=_0x1be9c8[_0xfafa('0x52')];_0x4cfed8['erlangCallToSecond']=_0x1be9c8[_0xfafa('0x53')];_0x4cfed8['erlangAbandonmentRate']=_0x1be9c8['erlangAbandonmentRate'];_0x4cfed8[_0xfafa('0x54')]=_0x1be9c8['erlangBusyFactor'];_0x4cfed8[_0xfafa('0x55')]=_0x1be9c8[_0xfafa('0x55')];_0x4cfed8['startProgressive']=_0x1be9c8[_0xfafa('0x56')];}if(_0x1be9c8['Trunk']){_0x4cfed8['Trunk']={'id':_0x1be9c8[_0xfafa('0x57')]['id'],'name':_0x1be9c8[_0xfafa('0x57')][_0xfafa('0x9')],'active':_0x1be9c8[_0xfafa('0x57')]['active'],'callerid':_0x1be9c8[_0xfafa('0x57')][_0xfafa('0x58')]};}if(_0x1be9c8[_0xfafa('0x59')]){_0x4cfed8[_0xfafa('0x59')]={'id':_0x1be9c8[_0xfafa('0x59')]['id'],'name':_0x1be9c8[_0xfafa('0x59')][_0xfafa('0x9')]};}_0x3ea1ce[_0xfafa('0x5a')](_0x4cfed8);}}_0x2e5a2c({'count':_0x3ea1ce[_0xfafa('0x5b')],'rows':_0x3ea1ce});});},'UpdateVoiceQueue':function(_0x5ecd28){return new Promise(function(_0x3175dc,_0xe535b){var _0x12b918=_[_0xfafa('0x5c')](_0x549711[_0xfafa('0x22')],{'id':parseInt(_0x5ecd28['id'])});var _0x490ba4=_[_0xfafa('0x5d')](_0x5ecd28,['id']);if(_0x12b918){for(var _0x543c37 in _0x490ba4){if(typeof _0x490ba4[_0x543c37]!==_0xfafa('0x5e')&&typeof _0x12b918[_0x543c37]!==_0xfafa('0x5e')){_0x12b918[_0x543c37]=_0x490ba4[_0x543c37];}}_0x3175dc(_0x12b918);}else{_0xe535b();}});},'VoiceChannels':function(_0x1da51b){return new Promise(function(_0xe76c49,_0x3c0b78){var _0x24c62d=_[_0xfafa('0x5f')](_0x549711[_0xfafa('0x60')]);_0xe76c49({'count':_0x24c62d[_0xfafa('0x5b')],'rows':_0x24c62d});});},'VoiceChannelMixMonitor':function(_0x4c2d77){var _0x3126b6=this;return new Promise(function(_0x4e2c33,_0x49aa70){if(ami['isConnected']()==![]){return _0x49aa70(_0x3126b6[_0xfafa('0x1d')](0x1f4,[config[_0xfafa('0x11')]['ip'],config[_0xfafa('0x11')][_0xfafa('0x12')],_0xfafa('0x13')]['join']('\x20')));}var _0x56441e=schema(properties[_0xfafa('0x61')])['validate'](_0x4c2d77);if(_0x56441e['length']>0x0){return _0x49aa70(_0x3126b6[_0xfafa('0x1d')](0x1f4,_[_0xfafa('0x62')](_0x56441e,_0xfafa('0x1b'))['join'](',\x20')));}var _0x223128=_[_0xfafa('0x5c')](_0x549711[_0xfafa('0x60')],{'uniqueid':_0x4c2d77[_0xfafa('0x63')]});if(_0x223128&&_0x223128[_0xfafa('0x64')]){var _0x78400f=util[_0xfafa('0x6')](_0xfafa('0x65'),_0x4c2d77[_0xfafa('0x66')]||_0x4c2d77[_0xfafa('0x63')],_0x4c2d77['format']||_0xfafa('0x67'));return ami[_0xfafa('0x19')]({'action':_0xfafa('0x68'),'channel':_0x223128[_0xfafa('0x64')],'file':_0x78400f,'options':'ai(mixmonitorid)'})['then'](function(_0x5243d1){var _0x5322a6=_[_0xfafa('0x5c')](_0x223128[_0xfafa('0x69')],{'filename':_0xfafa('0x6a')+_0x78400f['toLowerCase']()});if(_[_0xfafa('0x6b')](_0x5322a6)){_0x223128[_0xfafa('0x69')][_0xfafa('0x5a')]({'filename':_0xfafa('0x6a')+_0x78400f[_0xfafa('0x6c')](),'createdAt':moment()[_0xfafa('0x6')](_0xfafa('0x6d')),'mixmonitorid':_0x5243d1[_0xfafa('0x6e')],'status':_0xfafa('0x6f')});}else{_0x5322a6[_0xfafa('0x6e')]=_0x5243d1[_0xfafa('0x6e')];_0x5322a6['status']=_0xfafa('0x6f');}_0x4e2c33({'code':0xc8,'message':[_0x4c2d77[_0xfafa('0x63')],'MixMonitor\x20Success',_0x5243d1['mixmonitorid']]['join']('\x20'),'mixmonitorid':_0x5243d1[_0xfafa('0x6e')]});})[_0xfafa('0x1c')](function(_0x113ca0){_0x49aa70(_0x3126b6[_0xfafa('0x1d')](0x1f5,[_0x4c2d77['uniqueid'],_0x113ca0[_0xfafa('0x1b')][_0xfafa('0x6c')]()]['join']('\x20')));});}else{return _0x49aa70(_0x3126b6[_0xfafa('0x1d')](0x1f5,_0xfafa('0x70')));}});},'VoiceChannelStopMixMonitor':function(_0x3aa854){var _0x5f3098=this;return new Promise(function(_0x349e03,_0x4e26ad){if(ami[_0xfafa('0x10')]()==![]){return _0x4e26ad(_0x5f3098[_0xfafa('0x1d')](0x1f4,[config[_0xfafa('0x11')]['ip'],config['asterisk'][_0xfafa('0x12')],'ami\x20disconnected']['join']('\x20')));}var _0x481087=schema(properties[_0xfafa('0x61')])['validate'](_0x3aa854);if(_0x481087[_0xfafa('0x5b')]>0x0){return _0x4e26ad(_0x5f3098[_0xfafa('0x1d')](0x1f4,_['map'](_0x481087,_0xfafa('0x1b'))[_0xfafa('0x14')](',\x20')));}var _0x2c9b90=_['find'](_0x549711[_0xfafa('0x60')],{'uniqueid':_0x3aa854[_0xfafa('0x63')]});if(_0x2c9b90){return BPromise[_0xfafa('0x71')]()[_0xfafa('0x1a')](function(){if(_0x2c9b90[_0xfafa('0x64')]){return ami[_0xfafa('0x19')]({'action':_0xfafa('0x72'),'channel':_0x2c9b90[_0xfafa('0x64')],'mixmonitorid':_0x3aa854[_0xfafa('0x6e')]})[_0xfafa('0x1c')](function(_0x12c899){});}})[_0xfafa('0x1a')](function(){if(_0x2c9b90[_0xfafa('0x73')]){return ami[_0xfafa('0x19')]({'action':_0xfafa('0x72'),'channel':_0x2c9b90[_0xfafa('0x73')],'mixmonitorid':_0x3aa854[_0xfafa('0x6e')]})['catch'](function(_0x5be4f6){});}})[_0xfafa('0x1a')](function(_0x280254){var _0x331871=_['find'](_0x2c9b90[_0xfafa('0x69')],{'mixmonitorid':_0x3aa854['mixmonitorid']});if(_0x331871){_0x331871['status']='stop';}})['then'](function(){var _0x27940d=util['format'](_0xfafa('0x65'),_0x3aa854[_0xfafa('0x66')]||_0x3aa854[_0xfafa('0x63')],_0x3aa854[_0xfafa('0x6')]||_0xfafa('0x67'));var _0x2b9eaa=_[_0xfafa('0x5c')](_0x2c9b90['monitors'],{'filename':_0xfafa('0x6a')+_0x27940d[_0xfafa('0x6c')]()});if(_0x2b9eaa){_0x2b9eaa[_0xfafa('0x74')]='stop';}})['then'](function(){_0x349e03({'code':0xc8,'message':[_0x3aa854[_0xfafa('0x63')],_0xfafa('0x75')]['join']('\x20')});})[_0xfafa('0x1c')](function(_0x414ab9){_0x4e26ad(_0x5f3098[_0xfafa('0x1d')](0x1f5,[_0x3aa854['uniqueid'],_0x414ab9[_0xfafa('0x1b')][_0xfafa('0x6c')]()]['join']('\x20')));});}else{return _0x4e26ad(_0x5f3098[_0xfafa('0x1d')](0x1f5,_0xfafa('0x70')));}});},'VoiceQueuesChannels':function(_0x390393){return new Promise(function(_0x4f0495,_0xdb5e50){var _0x825e0d=_[_0xfafa('0x5f')](_0x549711['queueChannels']);_0x4f0495({'count':_0x825e0d['length'],'rows':_0x825e0d});});},'VoiceQueuesChannel':function(_0x31b74c){var _0x437067=this;return new Promise(function(_0x23be48,_0x17c826){var _0x1c7cc6=schema(properties[_0xfafa('0x76')])['validate'](_0x31b74c);if(_0x1c7cc6[_0xfafa('0x5b')]>0x0){return _0x17c826(_0x437067[_0xfafa('0x1d')](0x1f4,_[_0xfafa('0x62')](_0x1c7cc6,_0xfafa('0x1b'))[_0xfafa('0x14')](',\x20')));}var _0x2b43b2=_['find'](_0x549711[_0xfafa('0x77')],{'uniqueid':_0x31b74c['uniqueid']});if(_0x2b43b2){_0x23be48(_0x2b43b2);}else{return _0x17c826(_0x437067['error'](0x1f5,_0xfafa('0x70')));}});},'VoiceQueuesChannelHangup':function(_0x150bda){var _0x484eac=this;return new Promise(function(_0x47d12b,_0x470d5a){if(ami['isConnected']()==![]){return _0x470d5a(_0x484eac[_0xfafa('0x1d')](0x1f4,[config['asterisk']['ip'],config[_0xfafa('0x11')][_0xfafa('0x12')],_0xfafa('0x13')][_0xfafa('0x14')]('\x20')));}var _0x3f1625=schema(properties[_0xfafa('0x78')])[_0xfafa('0x2')](_0x150bda);if(_0x3f1625[_0xfafa('0x5b')]>0x0){return _0x470d5a(_0x484eac['error'](0x1f4,_[_0xfafa('0x62')](_0x3f1625,_0xfafa('0x1b'))[_0xfafa('0x14')](',\x20')));}var _0x360a98=_[_0xfafa('0x5c')](_0x549711['queueChannels'],{'uniqueid':_0x150bda[_0xfafa('0x63')]});if(_0x360a98&&_0x360a98[_0xfafa('0x64')]){return ami['Action']({'action':_0xfafa('0x79'),'channel':_0x360a98['channel']})[_0xfafa('0x1a')](function(_0x83a93e){_0x47d12b({'code':0xc8,'message':[_0x150bda['uniqueid'],_0x83a93e[_0xfafa('0x1b')][_0xfafa('0x6c')]()][_0xfafa('0x14')]('\x20')});})[_0xfafa('0x1c')](function(_0x1597e3){_0x470d5a(_0x484eac[_0xfafa('0x1d')](0x1f5,[_0x150bda['uniqueid'],_0x1597e3[_0xfafa('0x1b')][_0xfafa('0x6c')]()][_0xfafa('0x14')]('\x20')));});}else{return _0x470d5a(_0x484eac[_0xfafa('0x1d')](0x1f5,_0xfafa('0x70')));}});},'VoiceQueuesChannelRedirect':function(_0x2a83b7){var _0xd02080=this;return new Promise(function(_0x497fb9,_0x566eae){if(ami[_0xfafa('0x10')]()==![]){return _0x566eae(_0xd02080[_0xfafa('0x1d')](0x1f4,[config['asterisk']['ip'],config[_0xfafa('0x11')][_0xfafa('0x12')],_0xfafa('0x13')][_0xfafa('0x14')]('\x20')));}var _0x1ce5aa=schema(properties['voicequeuechannelredirect'])[_0xfafa('0x2')](_0x2a83b7);if(_0x1ce5aa[_0xfafa('0x5b')]>0x0){return _0x566eae(_0xd02080[_0xfafa('0x1d')](0x1f4,_[_0xfafa('0x62')](_0x1ce5aa,_0xfafa('0x1b'))[_0xfafa('0x14')](',\x20')));}var _0x3e06f8=_['find'](_0x549711['queueChannels'],{'uniqueid':_0x2a83b7['uniqueid']});if(_0x3e06f8&&_0x3e06f8[_0xfafa('0x64')]){return ami[_0xfafa('0x19')]({'action':_0xfafa('0x7a'),'channel':_0x3e06f8['channel'],'exten':_0x2a83b7[_0xfafa('0x7b')],'context':_0x2a83b7['context']||_0x3e06f8['context'],'priority':0x1})[_0xfafa('0x1a')](function(_0x56207a){_0x497fb9({'code':0xc8,'message':[_0x2a83b7['uniqueid'],_0x56207a[_0xfafa('0x1b')][_0xfafa('0x6c')]()][_0xfafa('0x14')]('\x20')});})['catch'](function(_0x4f50c5){_0x566eae(_0xd02080[_0xfafa('0x1d')](0x1f5,[_0x2a83b7[_0xfafa('0x63')],_0x4f50c5[_0xfafa('0x1b')][_0xfafa('0x6c')]()][_0xfafa('0x14')]('\x20')));});}else{return _0x566eae(_0xd02080[_0xfafa('0x1d')](0x1f5,_0xfafa('0x70')));}});},'Agents':function(_0x406a81){return new Promise(function(_0xd20a9f,_0x4da648){var _0x485596=_[_0xfafa('0x5f')](_0x549711[_0xfafa('0xd')]);_0xd20a9f({'count':_0x485596[_0xfafa('0x5b')],'rows':_0x485596});});},'Telephones':function(_0x3a877b){return new Promise(function(_0x4db0b9,_0x55b698){var _0x5f46fc=_[_0xfafa('0x5f')](_0x549711[_0xfafa('0x7c')]);_0x4db0b9({'count':_0x5f46fc[_0xfafa('0x5b')],'rows':_0x5f46fc});});},'Trunks':function(_0x816990){return new Promise(function(_0x51ab33,_0x3fc1e8){var _0x4bd96e=_['values'](_0x549711[_0xfafa('0x7d')]);_0x51ab33({'count':_0x4bd96e[_0xfafa('0x5b')],'rows':_0x4bd96e});});},'OutboundChannels':function(_0xa96e21){return new Promise(function(_0x2e9ac1,_0x190073){var _0x356965=_[_0xfafa('0x5f')](_0x549711[_0xfafa('0x7e')]);_0x2e9ac1({'count':_0x356965[_0xfafa('0x5b')],'rows':_0x356965});});},'Outbound':function(_0x44adb5){return new Promise(function(_0x136c2f,_0x382735){_0x136c2f(_0x549711[_0xfafa('0x7f')]);});},'Campaigns':function(_0x52f274){return new Promise(function(_0x46aa80,_0x3412e8){var _0x21c1dd=_['values'](_0x549711[_0xfafa('0x80')]);_0x46aa80({'count':_0x21c1dd['length'],'rows':_0x21c1dd});});},'VoiceQueuesPreview':function(_0x2caccc){var _0x2e7750=this;return new Promise(function(_0x3ac887,_0x503338){_0x27b299[_0xfafa('0x81')](_0x2caccc['id'])[_0xfafa('0x1a')](function(_0x1bc869){_0x3ac887({'code':0xc8,'message':_0x1bc869[_0xfafa('0x1b')]});})[_0xfafa('0x1c')](function(_0x407cec){_0x503338(_0x2e7750[_0xfafa('0x1d')](0x1f4,_0x407cec[_0xfafa('0x1b')]));});});},'EventManager':function(_0x4f4b41){var _0x14b217=this;return new Promise(function(_0x578843,_0x579940){if(!_0x4f4b41[_0xfafa('0x82')]){return _0x579940(_0x14b217[_0xfafa('0x1d')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xfafa('0x83')]('custom:'+_0x4f4b41['event'],_0x4f4b41[_0xfafa('0x1b')]);_0x578843({'code':0xc8,'message':_0x4f4b41});});},'FaxAccounts':function(_0x366c82){return new Promise(function(_0x590279,_0x12bff3){var _0x47e3a6=_[_0xfafa('0x5f')](_0x549711['faxAccounts']);_0x590279({'count':_0x47e3a6[_0xfafa('0x5b')],'rows':_0x47e3a6});});},'SendFax':function(_0x5d8ee8){var _0x35b985=this;return new Promise(function(_0x46230c,_0x27e77f){_0x2d9ed5['send'](_0x5d8ee8)[_0xfafa('0x1a')](function(_0x153acf){_0x46230c({'code':0xc8,'message':_0x153acf[_0xfafa('0x1b')]});})[_0xfafa('0x1c')](function(_0x100f37){_0x27e77f(_0x35b985[_0xfafa('0x1d')](0x1f4,_0x100f37['message']));});});},'CheckAfterSend':function(_0x282e0f){var _0x358051=this;return new Promise(function(_0x5d88a5,_0x5bf122){_0x2d9ed5[_0xfafa('0x84')](_0x282e0f)[_0xfafa('0x1a')](function(_0x58fba9){_0x5d88a5({'code':0xc8,'message':_0x58fba9[_0xfafa('0x1b')]});})[_0xfafa('0x1c')](function(_0x133aaf){_0x5bf122(_0x358051['error'](0x1f4,_0x133aaf[_0xfafa('0x1b')]));});});}};var _0x3569ab=jayson['server'](_0x1abfd8)[_0xfafa('0x85')]();_0x3569ab['on'](_0xfafa('0x1d'),function(_0x205f2d){return _0x10cc24(_0x205f2d);});_0x3569ab['listen'](0x232a,'127.0.0.1',function(){console['log'](_0xfafa('0x86'),0x232a);return _0x5c50c0(_0xfafa('0x87')+0x232a);});});}; \ No newline at end of file +var _0xe94a=['moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','name','timers','timer','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','username','ami\x20disconnected','keys','action','Reload','Action','then','message','asterisk','join','pick','command','Command','content','catch','voiceQueues','hasOwnProperty','answered','pTalking','sumBillable','sumDuration','sumHoldTime','type','unmanaged','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','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','find','omit','undefined','values','channels','voicechannel','map','uniqueid','channel','filename','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','wav','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Redirect','exten','context','telephones','outboundChannels','campaigns','event','Event\x20name\x20mandatory','faxAccounts','send','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xe94a,0x10b));var _0xae94=function(_0x3ec1da,_0x1e36f5){_0x3ec1da=_0x3ec1da-0x0;var _0x472358=_0xe94a[_0x3ec1da];return _0x472358;};'use strict';var _=require('lodash');var util=require(_0xae94('0x0'));var jayson=require(_0xae94('0x1'));var schema=require(_0xae94('0x2'));var BPromise=require('bluebird');var moment=require(_0xae94('0x3'));var config=require(_0xae94('0x4'));var properties=require(_0xae94('0x5'));var ami=require(_0xae94('0x6'));exports[_0xae94('0x7')]=function(_0x466eb7,_0xac9d3e,_0x32561c){return new BPromise(function(_0x3a4742,_0x23254b){var _0x43d259={'QueuePause':function(_0x262012){return new Promise(function(_0x2f5da7,_0x13494f){var _0x2c2f92=util[_0xae94('0x8')](_0xae94('0x9'),'SIP',_0x262012[_0xae94('0xa')]);if(_0x466eb7['timers']&&_0x466eb7[_0xae94('0xb')][_0x2c2f92]&&_0x466eb7[_0xae94('0xb')][_0x2c2f92][_0xae94('0xc')]){_0x466eb7[_0xae94('0xb')][_0x2c2f92]['updateAcw']();}if(_0x466eb7[_0xae94('0xd')][_0x2c2f92]){_0x466eb7['agents'][_0x2c2f92][_0xae94('0xe')]({'statePause':_0x262012[_0xae94('0xf')]?!![]:![]});}_0x2f5da7({'code':0xc8,'message':_0xae94('0x10')});});},'Reload':function(_0x536200){var _0x482ff2=this;return new Promise(function(_0x1a29c7,_0x25a7e0){if(ami[_0xae94('0x11')]()==![]){return _0x25a7e0(_0x482ff2[_0xae94('0x12')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xae94('0x13')],_0xae94('0x14')]['join']('\x20')));}_0x536200=_['pick'](_0x536200,_[_0xae94('0x15')](properties['module']));_0x536200[_0xae94('0x16')]=_0xae94('0x17');return ami[_0xae94('0x18')](_0x536200)[_0xae94('0x19')](function(_0x2f0546){_0x1a29c7({'code':0xc8,'message':_0x2f0546[_0xae94('0x1a')]});})['catch'](function(_0x7d0d11){_0x25a7e0(_0x482ff2[_0xae94('0x12')](0x1f5,_0x7d0d11[_0xae94('0x1a')]));});});},'Command':function(_0x335c0b){var _0x1d1758=this;return new Promise(function(_0x5b042b,_0x872d01){if(ami[_0xae94('0x11')]()==![]){return _0x872d01(_0x1d1758[_0xae94('0x12')](0x1f4,[config[_0xae94('0x1b')]['ip'],config[_0xae94('0x1b')]['username'],_0xae94('0x14')][_0xae94('0x1c')]('\x20')));}_0x335c0b=_[_0xae94('0x1d')](_0x335c0b,_0xae94('0x1e'));_0x335c0b['action']=_0xae94('0x1f');return ami['Action'](_0x335c0b)[_0xae94('0x19')](function(_0x3a1cd0){_0x5b042b({'code':0xc8,'message':_0x3a1cd0[_0xae94('0x20')]});})[_0xae94('0x21')](function(_0x312d1d){_0x872d01(_0x1d1758[_0xae94('0x12')](0x1f5,_0x312d1d[_0xae94('0x1a')]));});});},'VoiceQueues':function(_0x5a0c04){return new Promise(function(_0x3572d3,_0x4c6a98){var _0xba8d20=[];for(var _0x11d5fb in _0x466eb7[_0xae94('0x22')]){if(_0x466eb7[_0xae94('0x22')][_0xae94('0x23')](_0x11d5fb)){var _0x54b71b=_0x466eb7['voiceQueues'][_0x11d5fb];var _0xc7008d={'id':_0x54b71b['id'],'name':_0x54b71b['name'],'strategy':_0x54b71b['strategy'],'answered':_0x54b71b[_0xae94('0x24')],'available':_0x54b71b['available'],'loggedIn':_0x54b71b['loggedIn'],'pTalking':_0x54b71b[_0xae94('0x25')],'sumBillable':_0x54b71b[_0xae94('0x26')],'sumDuration':_0x54b71b[_0xae94('0x27')],'sumHoldTime':_0x54b71b[_0xae94('0x28')]||0x0,'talking':_0x54b71b['talking'],'total':_0x54b71b['total'],'type':_0x54b71b[_0xae94('0x29')],'unmanaged':_0x54b71b[_0xae94('0x2a')],'abandoned':_0x54b71b['abandoned'],'waiting':_0x54b71b[_0xae94('0x2b')],'loggedInDb':_0x54b71b[_0xae94('0x2c')]};if(_0x54b71b['type']===_0xae94('0x2d')){_0xc7008d['dialActive']=_0x54b71b[_0xae94('0x2e')];_0xc7008d[_0xae94('0x2f')]=_0x54b71b[_0xae94('0x2f')];_0xc7008d['dialOriginateCallerIdName']=_0x54b71b[_0xae94('0x30')];_0xc7008d[_0xae94('0x31')]=_0x54b71b[_0xae94('0x31')];_0xc7008d[_0xae94('0x32')]=_0x54b71b[_0xae94('0x32')];_0xc7008d[_0xae94('0x33')]=_0x54b71b['dialPrefix'];_0xc7008d[_0xae94('0x34')]=_0x54b71b[_0xae94('0x34')];_0xc7008d[_0xae94('0x35')]=_0x54b71b['outboundAnswerAgiCallsDay'];_0xc7008d['outboundAnswerCallsDay']=_0x54b71b[_0xae94('0x36')];_0xc7008d['outboundBlacklistCallsDay']=_0x54b71b[_0xae94('0x37')];_0xc7008d[_0xae94('0x38')]=_0x54b71b[_0xae94('0x38')];_0xc7008d[_0xae94('0x39')]=_0x54b71b['outboundCongestionCallsDay'];_0xc7008d[_0xae94('0x3a')]=_0x54b71b['outboundDropCallsDayACS'];_0xc7008d[_0xae94('0x3b')]=_0x54b71b[_0xae94('0x3b')];_0xc7008d[_0xae94('0x3c')]=_0x54b71b[_0xae94('0x3c')];_0xc7008d['outboundNoAnswerCallsDay']=_0x54b71b[_0xae94('0x3d')];_0xc7008d[_0xae94('0x3e')]=_0x54b71b[_0xae94('0x3e')];_0xc7008d[_0xae94('0x3f')]=_0x54b71b[_0xae94('0x3f')];_0xc7008d[_0xae94('0x40')]=_0x54b71b[_0xae94('0x40')];_0xc7008d[_0xae94('0x41')]=_0x54b71b[_0xae94('0x41')];_0xc7008d['outboundUnknownCallsDay']=_0x54b71b[_0xae94('0x42')];_0xc7008d[_0xae94('0x43')]=_0x54b71b[_0xae94('0x43')];_0xc7008d['predictiveIntervalAvgHoldtime']=_0x54b71b[_0xae94('0x44')];_0xc7008d[_0xae94('0x45')]=_0x54b71b['predictiveIntervalAvgTalktime'];_0xc7008d[_0xae94('0x46')]=_0x54b71b[_0xae94('0x46')];_0xc7008d['predictiveIntervalDroppedCallsTimeout']=_0x54b71b['predictiveIntervalDroppedCallsTimeout'];_0xc7008d[_0xae94('0x47')]=_0x54b71b[_0xae94('0x47')];_0xc7008d[_0xae94('0x48')]=_0x54b71b['predictiveIntervalErlangCallsDroppedCalls'];_0xc7008d[_0xae94('0x49')]=_0x54b71b[_0xae94('0x49')];_0xc7008d['predictiveIntervalMultiplicativeFactor']=_0x54b71b[_0xae94('0x4a')];_0xc7008d[_0xae94('0x4b')]=_0x54b71b['predictiveIntervalPauses'];_0xc7008d[_0xae94('0x4c')]=_0x54b71b[_0xae94('0x4c')];_0xc7008d[_0xae94('0x4d')]=_0x54b71b[_0xae94('0x4d')];_0xc7008d[_0xae94('0x1a')]=_0x54b71b['message'];_0xc7008d[_0xae94('0x4e')]=_0x54b71b['originated'];_0xc7008d[_0xae94('0x4f')]=_0x54b71b[_0xae94('0x4f')];_0xc7008d[_0xae94('0x50')]=_0x54b71b['erlangCallToSecond'];_0xc7008d[_0xae94('0x51')]=_0x54b71b[_0xae94('0x51')];_0xc7008d['erlangBusyFactor']=_0x54b71b[_0xae94('0x52')];_0xc7008d[_0xae94('0x53')]=_0x54b71b[_0xae94('0x53')];_0xc7008d[_0xae94('0x54')]=_0x54b71b['startProgressive'];}if(_0x54b71b[_0xae94('0x55')]){_0xc7008d[_0xae94('0x55')]={'id':_0x54b71b[_0xae94('0x55')]['id'],'name':_0x54b71b['Trunk'][_0xae94('0xa')],'active':_0x54b71b[_0xae94('0x55')]['active'],'callerid':_0x54b71b[_0xae94('0x55')][_0xae94('0x56')]};}if(_0x54b71b['Interval']){_0xc7008d[_0xae94('0x57')]={'id':_0x54b71b[_0xae94('0x57')]['id'],'name':_0x54b71b[_0xae94('0x57')][_0xae94('0xa')]};}_0xba8d20[_0xae94('0x58')](_0xc7008d);}}_0x3572d3({'count':_0xba8d20[_0xae94('0x59')],'rows':_0xba8d20});});},'UpdateVoiceQueue':function(_0x4efb2c){return new Promise(function(_0x47312a,_0x491fd4){var _0x3fd856=_[_0xae94('0x5a')](_0x466eb7[_0xae94('0x22')],{'id':parseInt(_0x4efb2c['id'])});var _0x59a81f=_[_0xae94('0x5b')](_0x4efb2c,['id']);if(_0x3fd856){for(var _0x172e10 in _0x59a81f){if(typeof _0x59a81f[_0x172e10]!==_0xae94('0x5c')&&typeof _0x3fd856[_0x172e10]!==_0xae94('0x5c')){_0x3fd856[_0x172e10]=_0x59a81f[_0x172e10];}}_0x47312a(_0x3fd856);}else{_0x491fd4();}});},'VoiceChannels':function(_0x3c2eb0){return new Promise(function(_0x206447,_0x236e34){var _0x52aa54=_[_0xae94('0x5d')](_0x466eb7[_0xae94('0x5e')]);_0x206447({'count':_0x52aa54[_0xae94('0x59')],'rows':_0x52aa54});});},'VoiceChannelMixMonitor':function(_0x2692e2){var _0x52fd8a=this;return new Promise(function(_0x23fa60,_0x285b30){if(ami[_0xae94('0x11')]()==![]){return _0x285b30(_0x52fd8a['error'](0x1f4,[config[_0xae94('0x1b')]['ip'],config[_0xae94('0x1b')][_0xae94('0x13')],_0xae94('0x14')][_0xae94('0x1c')]('\x20')));}var _0x4cc4a9=schema(properties[_0xae94('0x5f')])[_0xae94('0x2')](_0x2692e2);if(_0x4cc4a9[_0xae94('0x59')]>0x0){return _0x285b30(_0x52fd8a[_0xae94('0x12')](0x1f4,_[_0xae94('0x60')](_0x4cc4a9,_0xae94('0x1a'))[_0xae94('0x1c')](',\x20')));}var _0x4fad33=_[_0xae94('0x5a')](_0x466eb7[_0xae94('0x5e')],{'uniqueid':_0x2692e2[_0xae94('0x61')]});if(_0x4fad33&&_0x4fad33[_0xae94('0x62')]){var _0x4e63c5=util[_0xae94('0x8')]('%s.%s',_0x2692e2[_0xae94('0x63')]||_0x2692e2[_0xae94('0x61')],_0x2692e2['format']||'wav');return ami[_0xae94('0x18')]({'action':_0xae94('0x64'),'channel':_0x4fad33[_0xae94('0x62')],'file':_0x4e63c5,'options':_0xae94('0x65')})['then'](function(_0x48e475){var _0x3e5aed=_[_0xae94('0x5a')](_0x4fad33[_0xae94('0x66')],{'filename':_0xae94('0x67')+_0x4e63c5[_0xae94('0x68')]()});if(_['isNil'](_0x3e5aed)){_0x4fad33['monitors']['push']({'filename':_0xae94('0x67')+_0x4e63c5[_0xae94('0x68')](),'createdAt':moment()['format'](_0xae94('0x69')),'mixmonitorid':_0x48e475[_0xae94('0x6a')],'status':_0xae94('0x6b')});}else{_0x3e5aed['mixmonitorid']=_0x48e475[_0xae94('0x6a')];_0x3e5aed[_0xae94('0x6c')]='rec';}_0x23fa60({'code':0xc8,'message':[_0x2692e2[_0xae94('0x61')],_0xae94('0x6d'),_0x48e475[_0xae94('0x6a')]][_0xae94('0x1c')]('\x20'),'mixmonitorid':_0x48e475[_0xae94('0x6a')]});})[_0xae94('0x21')](function(_0x350d96){_0x285b30(_0x52fd8a[_0xae94('0x12')](0x1f5,[_0x2692e2[_0xae94('0x61')],_0x350d96[_0xae94('0x1a')]['toLowerCase']()][_0xae94('0x1c')]('\x20')));});}else{return _0x285b30(_0x52fd8a['error'](0x1f5,_0xae94('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0x3248bc){var _0x5a659b=this;return new Promise(function(_0x51291b,_0x2327be){if(ami[_0xae94('0x11')]()==![]){return _0x2327be(_0x5a659b['error'](0x1f4,[config[_0xae94('0x1b')]['ip'],config[_0xae94('0x1b')][_0xae94('0x13')],_0xae94('0x14')][_0xae94('0x1c')]('\x20')));}var _0x48568b=schema(properties[_0xae94('0x5f')])['validate'](_0x3248bc);if(_0x48568b[_0xae94('0x59')]>0x0){return _0x2327be(_0x5a659b['error'](0x1f4,_[_0xae94('0x60')](_0x48568b,_0xae94('0x1a'))[_0xae94('0x1c')](',\x20')));}var _0x34abe6=_[_0xae94('0x5a')](_0x466eb7[_0xae94('0x5e')],{'uniqueid':_0x3248bc[_0xae94('0x61')]});if(_0x34abe6){return BPromise[_0xae94('0x6f')]()[_0xae94('0x19')](function(){if(_0x34abe6['channel']){return ami[_0xae94('0x18')]({'action':_0xae94('0x70'),'channel':_0x34abe6['channel'],'mixmonitorid':_0x3248bc[_0xae94('0x6a')]})[_0xae94('0x21')](function(_0x60988d){});}})[_0xae94('0x19')](function(){if(_0x34abe6[_0xae94('0x71')]){return ami[_0xae94('0x18')]({'action':_0xae94('0x70'),'channel':_0x34abe6[_0xae94('0x71')],'mixmonitorid':_0x3248bc[_0xae94('0x6a')]})[_0xae94('0x21')](function(_0x5e066f){});}})['then'](function(_0x21353f){var _0x4f5781=_['find'](_0x34abe6[_0xae94('0x66')],{'mixmonitorid':_0x3248bc[_0xae94('0x6a')]});if(_0x4f5781){_0x4f5781[_0xae94('0x6c')]=_0xae94('0x72');}})[_0xae94('0x19')](function(){var _0x3ec1c1=util[_0xae94('0x8')](_0xae94('0x73'),_0x3248bc['filename']||_0x3248bc[_0xae94('0x61')],_0x3248bc[_0xae94('0x8')]||_0xae94('0x74'));var _0x11bfd6=_[_0xae94('0x5a')](_0x34abe6['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x3ec1c1[_0xae94('0x68')]()});if(_0x11bfd6){_0x11bfd6[_0xae94('0x6c')]=_0xae94('0x72');}})['then'](function(){_0x51291b({'code':0xc8,'message':[_0x3248bc[_0xae94('0x61')],_0xae94('0x75')]['join']('\x20')});})[_0xae94('0x21')](function(_0x543774){_0x2327be(_0x5a659b['error'](0x1f5,[_0x3248bc[_0xae94('0x61')],_0x543774[_0xae94('0x1a')]['toLowerCase']()][_0xae94('0x1c')]('\x20')));});}else{return _0x2327be(_0x5a659b['error'](0x1f5,_0xae94('0x6e')));}});},'VoiceQueuesChannels':function(_0x3102d0){return new Promise(function(_0x36422e,_0x115bf0){var _0x237fb5=_[_0xae94('0x5d')](_0x466eb7[_0xae94('0x76')]);_0x36422e({'count':_0x237fb5['length'],'rows':_0x237fb5});});},'VoiceQueuesChannel':function(_0x4c07e8){var _0xc23db7=this;return new Promise(function(_0x414ca4,_0x4fc53f){var _0x1260fc=schema(properties[_0xae94('0x77')])[_0xae94('0x2')](_0x4c07e8);if(_0x1260fc['length']>0x0){return _0x4fc53f(_0xc23db7[_0xae94('0x12')](0x1f4,_['map'](_0x1260fc,_0xae94('0x1a'))[_0xae94('0x1c')](',\x20')));}var _0x46c6c7=_['find'](_0x466eb7[_0xae94('0x76')],{'uniqueid':_0x4c07e8['uniqueid']});if(_0x46c6c7){_0x414ca4(_0x46c6c7);}else{return _0x4fc53f(_0xc23db7[_0xae94('0x12')](0x1f5,_0xae94('0x6e')));}});},'VoiceQueuesChannelHangup':function(_0x42202d){var _0x14c22c=this;return new Promise(function(_0x1634bb,_0x1fbc2f){if(ami[_0xae94('0x11')]()==![]){return _0x1fbc2f(_0x14c22c['error'](0x1f4,[config['asterisk']['ip'],config[_0xae94('0x1b')][_0xae94('0x13')],_0xae94('0x14')][_0xae94('0x1c')]('\x20')));}var _0x9bba16=schema(properties[_0xae94('0x78')])[_0xae94('0x2')](_0x42202d);if(_0x9bba16[_0xae94('0x59')]>0x0){return _0x1fbc2f(_0x14c22c['error'](0x1f4,_[_0xae94('0x60')](_0x9bba16,'message')[_0xae94('0x1c')](',\x20')));}var _0x3867a4=_[_0xae94('0x5a')](_0x466eb7[_0xae94('0x76')],{'uniqueid':_0x42202d[_0xae94('0x61')]});if(_0x3867a4&&_0x3867a4[_0xae94('0x62')]){return ami[_0xae94('0x18')]({'action':'Hangup','channel':_0x3867a4[_0xae94('0x62')]})[_0xae94('0x19')](function(_0x3deb7b){_0x1634bb({'code':0xc8,'message':[_0x42202d[_0xae94('0x61')],_0x3deb7b[_0xae94('0x1a')][_0xae94('0x68')]()][_0xae94('0x1c')]('\x20')});})[_0xae94('0x21')](function(_0xce06e4){_0x1fbc2f(_0x14c22c[_0xae94('0x12')](0x1f5,[_0x42202d[_0xae94('0x61')],_0xce06e4[_0xae94('0x1a')][_0xae94('0x68')]()]['join']('\x20')));});}else{return _0x1fbc2f(_0x14c22c[_0xae94('0x12')](0x1f5,_0xae94('0x6e')));}});},'VoiceQueuesChannelRedirect':function(_0x104ef3){var _0x353e99=this;return new Promise(function(_0x89508,_0x595865){if(ami[_0xae94('0x11')]()==![]){return _0x595865(_0x353e99['error'](0x1f4,[config['asterisk']['ip'],config[_0xae94('0x1b')]['username'],_0xae94('0x14')][_0xae94('0x1c')]('\x20')));}var _0x304be5=schema(properties['voicequeuechannelredirect'])['validate'](_0x104ef3);if(_0x304be5[_0xae94('0x59')]>0x0){return _0x595865(_0x353e99[_0xae94('0x12')](0x1f4,_[_0xae94('0x60')](_0x304be5,_0xae94('0x1a'))['join'](',\x20')));}var _0x48a0a7=_['find'](_0x466eb7[_0xae94('0x76')],{'uniqueid':_0x104ef3[_0xae94('0x61')]});if(_0x48a0a7&&_0x48a0a7[_0xae94('0x62')]){return ami[_0xae94('0x18')]({'action':_0xae94('0x79'),'channel':_0x48a0a7[_0xae94('0x62')],'exten':_0x104ef3[_0xae94('0x7a')],'context':_0x104ef3[_0xae94('0x7b')]||_0x48a0a7[_0xae94('0x7b')],'priority':0x1})[_0xae94('0x19')](function(_0x523e1e){_0x89508({'code':0xc8,'message':[_0x104ef3['uniqueid'],_0x523e1e[_0xae94('0x1a')][_0xae94('0x68')]()][_0xae94('0x1c')]('\x20')});})['catch'](function(_0x45446e){_0x595865(_0x353e99[_0xae94('0x12')](0x1f5,[_0x104ef3[_0xae94('0x61')],_0x45446e['message'][_0xae94('0x68')]()]['join']('\x20')));});}else{return _0x595865(_0x353e99['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x4dcbec){return new Promise(function(_0x10f8a7,_0xdc0c13){var _0x4ea6e5=_[_0xae94('0x5d')](_0x466eb7[_0xae94('0xd')]);_0x10f8a7({'count':_0x4ea6e5['length'],'rows':_0x4ea6e5});});},'Telephones':function(_0x137e2d){return new Promise(function(_0x55a0c2,_0x5a3ca6){var _0x503cbc=_[_0xae94('0x5d')](_0x466eb7[_0xae94('0x7c')]);_0x55a0c2({'count':_0x503cbc[_0xae94('0x59')],'rows':_0x503cbc});});},'Trunks':function(_0x57d227){return new Promise(function(_0x3fcae4,_0x283861){var _0x30b57f=_[_0xae94('0x5d')](_0x466eb7['trunks']);_0x3fcae4({'count':_0x30b57f['length'],'rows':_0x30b57f});});},'OutboundChannels':function(_0x344dad){return new Promise(function(_0xc3c387,_0x472c94){var _0x43ceef=_[_0xae94('0x5d')](_0x466eb7[_0xae94('0x7d')]);_0xc3c387({'count':_0x43ceef[_0xae94('0x59')],'rows':_0x43ceef});});},'Outbound':function(_0x4b1a09){return new Promise(function(_0x32e555,_0x21ea6f){_0x32e555(_0x466eb7[_0xae94('0x2d')]);});},'Campaigns':function(_0x5376b0){return new Promise(function(_0x1e64ab,_0x559adc){var _0x4210c7=_[_0xae94('0x5d')](_0x466eb7[_0xae94('0x7e')]);_0x1e64ab({'count':_0x4210c7[_0xae94('0x59')],'rows':_0x4210c7});});},'VoiceQueuesPreview':function(_0x228739){var _0x1c985b=this;return new Promise(function(_0x291765,_0x3406fa){_0xac9d3e['run'](_0x228739['id'])[_0xae94('0x19')](function(_0x127220){_0x291765({'code':0xc8,'message':_0x127220['message']});})['catch'](function(_0x51d87a){_0x3406fa(_0x1c985b[_0xae94('0x12')](0x1f4,_0x51d87a[_0xae94('0x1a')]));});});},'EventManager':function(_0x1c35fb){var _0x5cae65=this;return new Promise(function(_0x371d44,_0x5a9e4d){if(!_0x1c35fb[_0xae94('0x7f')]){return _0x5a9e4d(_0x5cae65[_0xae94('0x12')](0x1f4,_0xae94('0x80')));}ami['emit']('custom:'+_0x1c35fb[_0xae94('0x7f')],_0x1c35fb['message']);_0x371d44({'code':0xc8,'message':_0x1c35fb});});},'FaxAccounts':function(_0x56de81){return new Promise(function(_0x37ebfc,_0x3f7dcf){var _0x4e287e=_[_0xae94('0x5d')](_0x466eb7[_0xae94('0x81')]);_0x37ebfc({'count':_0x4e287e[_0xae94('0x59')],'rows':_0x4e287e});});},'SendFax':function(_0xb07500){var _0x278da6=this;return new Promise(function(_0x4bdf3a,_0x297621){_0x32561c[_0xae94('0x82')](_0xb07500)['then'](function(_0x1cfa25){_0x4bdf3a({'code':0xc8,'message':_0x1cfa25[_0xae94('0x1a')]});})[_0xae94('0x21')](function(_0xa4f5e7){_0x297621(_0x278da6['error'](0x1f4,_0xa4f5e7['message']));});});},'CheckAfterSend':function(_0x18c673){var _0x510f48=this;return new Promise(function(_0x1ab94a,_0x19f5d1){_0x32561c['checkAfterSend'](_0x18c673)[_0xae94('0x19')](function(_0x2de2c0){_0x1ab94a({'code':0xc8,'message':_0x2de2c0['message']});})['catch'](function(_0x5b9171){_0x19f5d1(_0x510f48[_0xae94('0x12')](0x1f4,_0x5b9171[_0xae94('0x1a')]));});});}};var _0x2d1146=jayson['server'](_0x43d259)[_0xae94('0x83')]();_0x2d1146['on'](_0xae94('0x12'),function(_0x425777){return _0x23254b(_0x425777);});_0x2d1146[_0xae94('0x7')](0x232a,_0xae94('0x84'),function(){console[_0xae94('0x85')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3a4742(_0xae94('0x86')+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 3d85566..ef6a3cb 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 _0xf709=['destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','emit','exec','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','calleridname','','Unknown'];(function(_0x36a6a6,_0x2f1838){var _0x588121=function(_0xcb8620){while(--_0xcb8620){_0x36a6a6['push'](_0x36a6a6['shift']());}};_0x588121(++_0x2f1838);}(_0xf709,0x7b));var _0x9f70=function(_0x59adad,_0x42bfc6){_0x59adad=_0x59adad-0x0;var _0x4edfb7=_0xf709[_0x59adad];return _0x4edfb7;};'use strict';var _=require(_0x9f70('0x0'));var BPromise=require(_0x9f70('0x1'));var Redis=require(_0x9f70('0x2'));var util=require(_0x9f70('0x3'));var config=require(_0x9f70('0x4'));var logger=require(_0x9f70('0x5'))(_0x9f70('0x6'));var cmContactRpc=require(_0x9f70('0x7'));config[_0x9f70('0x8')]=_[_0x9f70('0x9')](config[_0x9f70('0x8')],{'host':_0x9f70('0xa'),'port':0x18eb});var io=require(_0x9f70('0xb'))(new Redis(config[_0x9f70('0x8')]));function emit(_0x34fa92,_0x3ffe38,_0x10538c,_0x837672,_0x37088b){logger['info']('[CM][%s][%s]',_0x34fa92,_0x3ffe38['id'],_0x10538c,_0x837672,JSON['stringify'](_0x37088b));io['to'](_0x10538c)[_0x9f70('0xc')](_0x837672,_0x37088b);}exports[_0x9f70('0xd')]=function(_0x58bee6,_0x22e4e8,_0x4172db,_0x42fa0d){var _0x7bc2b2,_0x3ec5ee;var _0x5eff51={};var _0x552b95=Number(_0x4172db[_0x9f70('0xe')]);var _0x2dfb25=_0x4172db[_0x9f70('0xf')]?Boolean(Number(_0x4172db[_0x9f70('0xf')])):![];var _0xa98c54;if(_0x42fa0d[_0x9f70('0x10')]){_0x5eff51['id']=_0x42fa0d[_0x9f70('0x10')];}if(!_0x5eff51['id']){_0x5eff51[_0x9f70('0x11')]=_0x552b95;_0xa98c54=_0x4172db[_0x9f70('0x12')]&&_0x4172db[_0x9f70('0x12')]!=='0'?_0x4172db['data3'][_0x9f70('0x13')](','):[_0x9f70('0x14')];_0x5eff51[_0x9f70('0x15')]=_[_0x9f70('0x16')](_0xa98c54,function(_0x18a63e){var _0x3055ca={};_0x3055ca[_0x18a63e]=_0x42fa0d[_0x9f70('0x17')]?_0x42fa0d[_0x9f70('0x18')]:_0x42fa0d[_0x9f70('0x19')];return _0x3055ca;});}var _0x263401=['id',_0x9f70('0x1a'),_0x9f70('0x1b'),_0x9f70('0x14'),_0x9f70('0x1c'),_0x9f70('0x1d'),_0x9f70('0x11'),_0x9f70('0x1e'),_0x9f70('0x1f'),_0x9f70('0x20')];var _0x519046=_[_0x9f70('0x21')](_0x263401,_0xa98c54);BPromise[_0x9f70('0x22')]()[_0x9f70('0x23')](cmContactRpc[_0x9f70('0x24')]({'attributes':_0x519046,'where':_0x5eff51}))[_0x9f70('0x23')](function(_0x152f95){_0x3ec5ee=_0x152f95;if(!_['isEmpty'](_0x3ec5ee)){if(_0x3ec5ee[_0x9f70('0x25')]===0x1){_0x7bc2b2=_0x3ec5ee[0x0];logger[_0x9f70('0x26')](_0x9f70('0x27'),_0x42fa0d[_0x9f70('0x28')],_0x22e4e8['id'],_0x7bc2b2['id']);}else{logger[_0x9f70('0x26')](_0x9f70('0x29'),_0x42fa0d['uniqueid'],_0x22e4e8['id'],_[_0x9f70('0x16')](_0x3ec5ee,'id')['join'](','));}return;}else{logger[_0x9f70('0x26')](_0x9f70('0x2a'),_0x42fa0d[_0x9f70('0x28')],_0x22e4e8['id']);var _0x3dcc75={'ListId':_0x552b95};var _0x30a3be=_0x4172db[_0x9f70('0x2b')]&&_0x4172db[_0x9f70('0x2b')]!=='0'?_0x4172db[_0x9f70('0x2b')]:'phone';if(_0x2dfb25){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x42fa0d[_0x9f70('0x28')],_0x22e4e8['id']);_0x3dcc75[_0x30a3be]=_[_0x9f70('0x2c')](_0x42fa0d['routeId'])?_0x42fa0d[_0x9f70('0x19')]:_0x42fa0d[_0x9f70('0x18')];if(_['isNil'](_0x42fa0d[_0x9f70('0x17')])){_0x3dcc75[_0x9f70('0x1a')]=_0x42fa0d[_0x9f70('0x2d')]&&_0x42fa0d[_0x9f70('0x2d')]!==_0x9f70('0x2e')?_0x42fa0d[_0x9f70('0x2d')]:_0x9f70('0x2f');}else{_0x3dcc75['firstName']=_0x42fa0d['destcalleridname']&&_0x42fa0d['destcalleridname']!==_0x9f70('0x2e')?_0x42fa0d[_0x9f70('0x30')]:'Unknown';}return BPromise[_0x9f70('0x22')]()['then'](cmContactRpc[_0x9f70('0x31')](_0x3dcc75))['then'](function(_0xd917f7){_0x7bc2b2=_0xd917f7;_0x3ec5ee['push'](_0xd917f7);if(_0x7bc2b2){logger[_0x9f70('0x26')](_0x9f70('0x32'),_0x42fa0d[_0x9f70('0x28')],_0x22e4e8['id'],_0x7bc2b2['id']);}return;});}else{logger['info'](_0x9f70('0x33'),_0x42fa0d[_0x9f70('0x28')],_0x22e4e8['id']);_0x3dcc75[_0x30a3be]=_[_0x9f70('0x2c')](_0x42fa0d[_0x9f70('0x17')])?_0x42fa0d[_0x9f70('0x19')]:_0x42fa0d[_0x9f70('0x18')];if(_['isNil'](_0x42fa0d[_0x9f70('0x17')])){_0x3dcc75[_0x9f70('0x1a')]=_0x42fa0d[_0x9f70('0x2d')]&&_0x42fa0d['calleridname']!==''?_0x42fa0d['calleridname']:_0x9f70('0x2f');}else{_0x3dcc75[_0x9f70('0x1a')]=_0x42fa0d[_0x9f70('0x30')]&&_0x42fa0d[_0x9f70('0x30')]!==_0x9f70('0x2e')?_0x42fa0d['destcalleridname']:_0x9f70('0x2f');}_0x7bc2b2=_0x3dcc75;_0x3ec5ee['push'](_0x3dcc75);return;}}})['then'](function(){if(_0x58bee6){emit(_0x42fa0d['uniqueid'],_0x22e4e8,util[_0x9f70('0x34')]('user:%s',_0x58bee6[_0x9f70('0x35')]),util[_0x9f70('0x34')]('trigger:%s',_0x4172db[_0x9f70('0x36')][_0x9f70('0x37')]()),{'evt':_[_0x9f70('0x38')](_0x42fa0d,{'autoCreate':_0x2dfb25}),'contact':_0x7bc2b2===undefined?{}:_0x7bc2b2,'contacts':_0x3ec5ee['length']===0x0?undefined:_0x3ec5ee});}});}; \ No newline at end of file +var _0x7b91=['join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','Unknown','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','merge','lodash','bluebird','ioredis','util','trigger','../../rpc/cmContact','redis','localhost','info','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','split','phone','map','routeId','calleridnum','firstName','fax','createdAt','updatedAt','union','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid'];(function(_0x39053a,_0x45bbea){var _0x1fdf5a=function(_0x3d2a5e){while(--_0x3d2a5e){_0x39053a['push'](_0x39053a['shift']());}};_0x1fdf5a(++_0x45bbea);}(_0x7b91,0x14b));var _0x17b9=function(_0x48a811,_0x3c519f){_0x48a811=_0x48a811-0x0;var _0x767ee5=_0x7b91[_0x48a811];return _0x767ee5;};'use strict';var _=require(_0x17b9('0x0'));var BPromise=require(_0x17b9('0x1'));var Redis=require(_0x17b9('0x2'));var util=require(_0x17b9('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x17b9('0x4'));var cmContactRpc=require(_0x17b9('0x5'));config[_0x17b9('0x6')]=_['defaults'](config[_0x17b9('0x6')],{'host':_0x17b9('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x17b9('0x6')]));function emit(_0x5788f0,_0x3ad0c8,_0x2d56d0,_0x3fe4b2,_0x404ca5){logger[_0x17b9('0x8')]('[CM][%s][%s]',_0x5788f0,_0x3ad0c8['id'],_0x2d56d0,_0x3fe4b2,JSON[_0x17b9('0x9')](_0x404ca5));io['to'](_0x2d56d0)[_0x17b9('0xa')](_0x3fe4b2,_0x404ca5);}exports[_0x17b9('0xb')]=function(_0x1cddca,_0x5ca0d8,_0xe1a2d5,_0x2197a0){var _0x3d5a8a,_0x34b385;var _0x25fc39={};var _0x5c32c5=Number(_0xe1a2d5[_0x17b9('0xc')]);var _0x594dfd=_0xe1a2d5[_0x17b9('0xd')]?Boolean(Number(_0xe1a2d5[_0x17b9('0xd')])):![];var _0x3a1f7f;if(_0x2197a0[_0x17b9('0xe')]){_0x25fc39['id']=_0x2197a0[_0x17b9('0xe')];}if(!_0x25fc39['id']){_0x25fc39[_0x17b9('0xf')]=_0x5c32c5;_0x3a1f7f=_0xe1a2d5[_0x17b9('0x10')]&&_0xe1a2d5[_0x17b9('0x10')]!=='0'?_0xe1a2d5[_0x17b9('0x10')][_0x17b9('0x11')](','):[_0x17b9('0x12')];_0x25fc39['$or']=_[_0x17b9('0x13')](_0x3a1f7f,function(_0x37bac2){var _0x4d78ef={};_0x4d78ef[_0x37bac2]=_0x2197a0[_0x17b9('0x14')]?_0x2197a0['destcalleridnum']:_0x2197a0[_0x17b9('0x15')];return _0x4d78ef;});}var _0x75de0a=['id',_0x17b9('0x16'),'lastName',_0x17b9('0x12'),'mobile',_0x17b9('0x17'),'ListId',_0x17b9('0x18'),'scheduledAt',_0x17b9('0x19')];var _0x44a049=_[_0x17b9('0x1a')](_0x75de0a,_0x3a1f7f);BPromise['resolve']()[_0x17b9('0x1b')](cmContactRpc[_0x17b9('0x1c')]({'attributes':_0x44a049,'where':_0x25fc39}))[_0x17b9('0x1b')](function(_0x1d7064){_0x34b385=_0x1d7064;if(!_[_0x17b9('0x1d')](_0x34b385)){if(_0x34b385[_0x17b9('0x1e')]===0x1){_0x3d5a8a=_0x34b385[0x0];logger[_0x17b9('0x8')](_0x17b9('0x1f'),_0x2197a0[_0x17b9('0x20')],_0x5ca0d8['id'],_0x3d5a8a['id']);}else{logger[_0x17b9('0x8')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x2197a0[_0x17b9('0x20')],_0x5ca0d8['id'],_[_0x17b9('0x13')](_0x34b385,'id')[_0x17b9('0x21')](','));}return;}else{logger[_0x17b9('0x8')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x2197a0[_0x17b9('0x20')],_0x5ca0d8['id']);var _0x53d1af={'ListId':_0x5c32c5};var _0x4805b6=_0xe1a2d5[_0x17b9('0x22')]&&_0xe1a2d5[_0x17b9('0x22')]!=='0'?_0xe1a2d5[_0x17b9('0x22')]:'phone';if(_0x594dfd){logger[_0x17b9('0x8')](_0x17b9('0x23'),_0x2197a0[_0x17b9('0x20')],_0x5ca0d8['id']);_0x53d1af[_0x4805b6]=_[_0x17b9('0x24')](_0x2197a0['routeId'])?_0x2197a0[_0x17b9('0x15')]:_0x2197a0['destcalleridnum'];if(_['isNil'](_0x2197a0[_0x17b9('0x14')])){_0x53d1af['firstName']=_0x2197a0[_0x17b9('0x25')]&&_0x2197a0[_0x17b9('0x25')]!==_0x17b9('0x26')?_0x2197a0[_0x17b9('0x25')]:_0x17b9('0x27');}else{_0x53d1af[_0x17b9('0x16')]=_0x2197a0[_0x17b9('0x28')]&&_0x2197a0[_0x17b9('0x28')]!==_0x17b9('0x26')?_0x2197a0['destcalleridname']:'Unknown';}return BPromise[_0x17b9('0x29')]()[_0x17b9('0x1b')](cmContactRpc[_0x17b9('0x2a')](_0x53d1af))['then'](function(_0x55b2c3){_0x3d5a8a=_0x55b2c3;_0x34b385[_0x17b9('0x2b')](_0x55b2c3);if(_0x3d5a8a){logger['info'](_0x17b9('0x2c'),_0x2197a0[_0x17b9('0x20')],_0x5ca0d8['id'],_0x3d5a8a['id']);}return;});}else{logger[_0x17b9('0x8')](_0x17b9('0x2d'),_0x2197a0[_0x17b9('0x20')],_0x5ca0d8['id']);_0x53d1af[_0x4805b6]=_[_0x17b9('0x24')](_0x2197a0[_0x17b9('0x14')])?_0x2197a0[_0x17b9('0x15')]:_0x2197a0['destcalleridnum'];if(_[_0x17b9('0x24')](_0x2197a0[_0x17b9('0x14')])){_0x53d1af[_0x17b9('0x16')]=_0x2197a0[_0x17b9('0x25')]&&_0x2197a0['calleridname']!==_0x17b9('0x26')?_0x2197a0[_0x17b9('0x25')]:_0x17b9('0x27');}else{_0x53d1af[_0x17b9('0x16')]=_0x2197a0[_0x17b9('0x28')]&&_0x2197a0['destcalleridname']!==_0x17b9('0x26')?_0x2197a0[_0x17b9('0x28')]:_0x17b9('0x27');}_0x3d5a8a=_0x53d1af;_0x34b385[_0x17b9('0x2b')](_0x53d1af);return;}}})[_0x17b9('0x1b')](function(){if(_0x1cddca){emit(_0x2197a0['uniqueid'],_0x5ca0d8,util[_0x17b9('0x2e')](_0x17b9('0x2f'),_0x1cddca[_0x17b9('0x30')]),util[_0x17b9('0x2e')](_0x17b9('0x31'),_0xe1a2d5[_0x17b9('0x32')]['toLowerCase']()),{'evt':_[_0x17b9('0x33')](_0x2197a0,{'autoCreate':_0x594dfd}),'contact':_0x3d5a8a===undefined?{}:_0x3d5a8a,'contacts':_0x34b385[_0x17b9('0x1e')]===0x0?undefined:_0x34b385});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 61e24cd..77fae60 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 _0x9ff4=['info','stringify','prototype','clone','checkTriggers','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','interface','action','toLowerCase','contactmanager','data1','TemplateId','data2','render','html','template\x20not\x20found','uri','isNil','data3','location','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winApplication','winArguments','name','format','trigger:%s:%s','user:%s','trigger:%s','exec','integration','voiceQueues','queue','routeId','urlforward','parse','query','AllConditions','every','some','AnyConditions','checkConditions','channel','operator','value','ChatWebsiteId','upperFirst','AccountId','interaction','message','event','agent','lastevent','mustache','ioredis','./urlforward','./integration','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','popup','url','winapp','triggers','agents','templates','voiceExtensions','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','zendeskAccounts','custom:agentcalled','custom:agentconnect','syncCustomEvent','custom:agentringnoanswer','bind','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','emit'];(function(_0x4d605f,_0x1955ac){var _0x177aef=function(_0xf5ca58){while(--_0xf5ca58){_0x4d605f['push'](_0x4d605f['shift']());}};_0x177aef(++_0x1955ac);}(_0x9ff4,0x196));var _0x49ff=function(_0x2b62b2,_0x2f9c15){_0x2b62b2=_0x2b62b2-0x0;var _0x57ceb3=_0x9ff4[_0x2b62b2];return _0x57ceb3;};'use strict';var util=require('util');var _=require('lodash');var url=require('url');var Mustache=require(_0x49ff('0x0'));var Redis=require(_0x49ff('0x1'));var urlforward=require(_0x49ff('0x2'));var integration=require(_0x49ff('0x3'));var cmContact=require('./cmContact');var script=require(_0x49ff('0x4'));var config=require(_0x49ff('0x5'));var logger=require(_0x49ff('0x6'))(_0x49ff('0x7'));var ami=require(_0x49ff('0x8'));config[_0x49ff('0x9')]=_[_0x49ff('0xa')](config[_0x49ff('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x49ff('0x9')]));var operators={'equals':function(_0x3a9da1,_0x562cd1){return _0x3a9da1==_0x562cd1;},'not_equals':function(_0x4e845a,_0x2a8e2f){return _0x4e845a!=_0x2a8e2f;}};var barAndWebActions=[_0x49ff('0xb'),_0x49ff('0xc'),_0x49ff('0xd')];function Trigger(_0x3d98aa){this[_0x49ff('0xe')]=_0x3d98aa[_0x49ff('0xe')];this[_0x49ff('0xf')]=_0x3d98aa['agents'];this['voiceQueues']=_0x3d98aa['voiceQueues'];this[_0x49ff('0x10')]=_0x3d98aa[_0x49ff('0x10')];this['voiceExtensions']=_0x3d98aa[_0x49ff('0x11')];this['zendeskAccounts']=_0x3d98aa['zendeskAccounts'];this[_0x49ff('0x12')]=_0x3d98aa['freshdeskAccounts'];this[_0x49ff('0x13')]=_0x3d98aa[_0x49ff('0x13')];this[_0x49ff('0x14')]=_0x3d98aa[_0x49ff('0x14')];this[_0x49ff('0x15')]=_0x3d98aa[_0x49ff('0x15')];this[_0x49ff('0x16')]=_0x3d98aa[_0x49ff('0x16')];this['vtigerAccounts']=_0x3d98aa[_0x49ff('0x17')];this['servicenowAccounts']=_0x3d98aa[_0x49ff('0x18')];this[_0x49ff('0x19')]=_0x3d98aa[_0x49ff('0x19')];this[_0x49ff('0x1a')]=_0x3d98aa[_0x49ff('0x1a')];this[_0x49ff('0x1b')]={'zendesk':this[_0x49ff('0x1c')],'salesforce':this[_0x49ff('0x13')],'freshdesk':this[_0x49ff('0x12')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x49ff('0x15')],'desk':this['deskAccounts'],'vtiger':this[_0x49ff('0x17')],'dynamics365':this[_0x49ff('0x19')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x49ff('0x18')]};ami['on'](_0x49ff('0x1d'),this['syncCustomEvent']['bind'](this));ami['on'](_0x49ff('0x1e'),this[_0x49ff('0x1f')]['bind'](this));ami['on'](_0x49ff('0x20'),this['syncCustomEvent'][_0x49ff('0x21')](this));ami['on'](_0x49ff('0x22'),this[_0x49ff('0x1f')][_0x49ff('0x21')](this));ami['on'](_0x49ff('0x23'),this[_0x49ff('0x1f')][_0x49ff('0x21')](this));ami['on'](_0x49ff('0x24'),this[_0x49ff('0x1f')][_0x49ff('0x21')](this));ami['on'](_0x49ff('0x25'),this[_0x49ff('0x1f')][_0x49ff('0x21')](this));ami['on']('custom:agentcongestion',this[_0x49ff('0x1f')][_0x49ff('0x21')](this));ami['on']('custom:agentreject',this[_0x49ff('0x1f')][_0x49ff('0x21')](this));ami['on'](_0x49ff('0x26'),this['syncCustomEvent'][_0x49ff('0x21')](this));ami['on'](_0x49ff('0x27'),this[_0x49ff('0x1f')][_0x49ff('0x21')](this));ami['on'](_0x49ff('0x28'),this[_0x49ff('0x29')][_0x49ff('0x21')](this));ami['on'](_0x49ff('0x2a'),this[_0x49ff('0x29')][_0x49ff('0x21')](this));ami['on'](_0x49ff('0x2b'),this[_0x49ff('0x29')][_0x49ff('0x21')](this));ami['on'](_0x49ff('0x2c'),this['syncCustomEvent'][_0x49ff('0x21')](this));ami['on']('custom:closedinteraction',this[_0x49ff('0x1f')][_0x49ff('0x21')](this));ami['on'](_0x49ff('0x2d'),this[_0x49ff('0x1f')][_0x49ff('0x21')](this));ami['on'](_0x49ff('0x2e'),this[_0x49ff('0x1f')]['bind'](this));ami['on'](_0x49ff('0x2f'),this[_0x49ff('0x1f')][_0x49ff('0x21')](this));ami['on'](_0x49ff('0x30'),this[_0x49ff('0x1f')][_0x49ff('0x21')](this));}Trigger['prototype'][_0x49ff('0x31')]=function(_0x53da25,_0x2d2c5d,_0xf7a195){logger[_0x49ff('0x32')](_0x53da25,_0x2d2c5d,JSON[_0x49ff('0x33')](_0xf7a195));io['to'](_0x53da25)[_0x49ff('0x31')](_0x2d2c5d,_0xf7a195);};Trigger[_0x49ff('0x34')][_0x49ff('0x1f')]=function(_0x53b0f3){var _0x1e63c7=_[_0x49ff('0x35')](_0x53b0f3);this[_0x49ff('0x36')](_0x1e63c7);};Trigger[_0x49ff('0x34')][_0x49ff('0x29')]=function(_0x5f13bd){if(this[_0x49ff('0xf')][_0x5f13bd['interface']]){this['syncCustomEvent'](_0x5f13bd);}};Trigger['prototype'][_0x49ff('0x36')]=function(_0x49857f){var _0x493aa5;for(var _0x2432f4 in this[_0x49ff('0xe')]){if(this['triggers'][_0x49ff('0x37')](_0x2432f4)){if(this[_0x49ff('0xe')][_0x2432f4][_0x49ff('0x38')]){_0x493aa5=this[_0x49ff('0x39')](this[_0x49ff('0xe')][_0x2432f4],_0x49857f);if(_0x493aa5){_[_0x49ff('0x3a')](_0x49857f,_0x49857f[_0x49ff('0x3b')]);for(var _0x501d2c=0x0,_0x4a6f82,_0x18030d,_0x2603e5;_0x501d2c0x0){_0x1b189c=_[_0x372a('0x29')](_0x1b0f73,_0xc835d4);}return _0x1b189c;}function getCustomFields(_0x3845b9,_0x2fe123){var _0x255188=[];var _0x163852={'custom_fields':{}};if(_0x3845b9['length']>0x0){_[_0x372a('0x2a')](_0x3845b9,function(_0x37177f){if(_[_0x372a('0x2b')]([_0x372a('0x2c'),_0x372a('0x2d')],_0x37177f[_0x372a('0x2e')])&&_0x37177f[_0x372a('0x2f')]&&!_0x37177f[_0x372a('0x30')]){_0x163852[_0x37177f[_0x372a('0x2f')]['toLowerCase']()]=_0x37177f['content'][_0x372a('0x20')]();}else if(_[_0x372a('0x2b')]([_0x372a('0x2c'),_0x372a('0x2d')],_0x37177f[_0x372a('0x2e')])&&_0x37177f['idField']&&_0x37177f[_0x372a('0x30')]){_0x163852[_0x372a('0x31')][_0x37177f[_0x372a('0x32')]]=_0x37177f[_0x372a('0x33')][_0x372a('0x20')]();}else if(_0x37177f[_0x372a('0x2e')]===_0x372a('0x34')&&_0x37177f[_0x372a('0x35')]&&_0x37177f['idField']&&_0x37177f[_0x372a('0x30')]){_0x2fe123[_0x37177f[_0x372a('0x35')]]&&(_0x163852['custom_fields'][_0x37177f[_0x372a('0x32')]]=_0x2fe123[_0x37177f[_0x372a('0x35')]][_0x372a('0x20')]());}else if(_0x37177f[_0x372a('0x2e')]===_0x372a('0x36')&&_0x37177f['Variable']&&_0x37177f[_0x372a('0x37')][_0x372a('0x38')]&&_0x37177f['idField']&&_0x37177f[_0x372a('0x30')]){_0x2fe123[_0x37177f['Variable'][_0x372a('0x38')][_0x372a('0x39')]()]&&(_0x163852[_0x372a('0x31')][_0x37177f[_0x372a('0x32')]]=_0x2fe123[_0x37177f[_0x372a('0x37')][_0x372a('0x38')][_0x372a('0x39')]()][_0x372a('0x20')]());}});}if(_0x163852[_0x372a('0x3a')]){_0x163852[_0x372a('0x3a')]=Number(_0x163852[_0x372a('0x3a')]);}return _0x163852;}function getTicket(_0x211825,_0x4dea52,_0x4dde3d,_0x1c7809,_0x549319){logger['info']('Creating\x20new\x20ticket...');var _0x3d198c=_[_0x372a('0x3b')]({'subject':intUtil[_0x372a('0x3c')](_0x1c7809[_0x372a('0x3d')],_0x549319,'\x20'),'type':_0x372a('0x3e'),'status':_0x372a('0x3f'),'labels':[_0x372a('0x40'),_0x372a('0x41'),_0x372a('0x42')][_0x372a('0x43')](getTags(_0x1c7809[_0x372a('0x44')],_0x372a('0x38'))),'description':intUtil[_0x372a('0x3c')](_0x1c7809[_0x372a('0x45')],_0x549319,'\x0a'),'_links':{'assigned_user':{'href':util[_0x372a('0xb')]('/api/v2/users/%d',_0x4dea52['id']),'class':_0x372a('0x46')}},'message':{'direction':'in','body':intUtil[_0x372a('0x3c')](_0x1c7809[_0x372a('0x45')],_0x549319,'\x0a')}},getCustomFields(_0x1c7809['Fields'],_0x549319));return request({'uri':util[_0x372a('0xb')](_0x372a('0x47'),_0x211825[_0x372a('0xd')],_0x4dde3d['id']),'method':_0x372a('0x26'),'body':_0x3d198c});}exports[_0x372a('0x48')]=function(_0x31c423,_0x38fdb8,_0x40376c,_0x38a4a9,_0x3cf797,_0x73d3aa){var _0x19d102,_0x539a1d;_0x73d3aa[_0x372a('0xd')]=intUtil[_0x372a('0x49')](_0x73d3aa[_0x372a('0xd')]);_0x73d3aa[_0x372a('0x4a')]=intUtil[_0x372a('0x49')](_0x73d3aa[_0x372a('0x4a')]);if(_0x3cf797&&_0x3cf797[_0x372a('0x4b')]){logger[_0x372a('0x14')](_0x372a('0x4c'),_0x372a('0x4d'));_0x38fdb8['recordingURL']=util['format'](_0x372a('0x4e'),_0x73d3aa[_0x372a('0x4a')],_0x38fdb8[_0x372a('0x4f')],md5(_0x38fdb8[_0x372a('0x4f')]));}else{_0x38fdb8[_0x372a('0x50')]='';}headers['Authorization']=getAuth(_0x73d3aa);return getUser(_0x73d3aa,_0x38a4a9['email'])['then'](function(_0x15b1eb){_0x19d102=_0x15b1eb;logger[_0x372a('0x14')]('The\x20User\x20ID\x20is:',_0x19d102['id']);return getEndUser(_0x73d3aa,_0x38fdb8['calleridname'],_0x38fdb8['calleridnum']);})[_0x372a('0xe')](function(_0x188183){_0x539a1d=_0x188183;logger[_0x372a('0x14')](_0x372a('0x51'),_0x539a1d['id']);return getTicket(_0x73d3aa,_0x19d102,_0x539a1d,_0x40376c,_0x38fdb8);})['then'](function(_0x37bca0){if(_0x37bca0){logger[_0x372a('0x14')](_0x372a('0x52'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x37bca0['id']);switch(_0x73d3aa[_0x372a('0x2e')]){case'integrationTab':logger[_0x372a('0x14')]('[QUEUE]',_0x372a('0x53'));emit(util[_0x372a('0xb')](_0x372a('0x54'),_0x38a4a9['name']),_0x372a('0x55'),{'recordId':_0x37bca0['id']});break;case _0x372a('0x56'):logger['info'](_0x372a('0x4c'),_0x372a('0x57'));emit(util[_0x372a('0xb')](_0x372a('0x54'),_0x38a4a9[_0x372a('0x38')]),_0x372a('0x58'),{'uri':util[_0x372a('0xb')](_0x372a('0x59'),_0x37bca0['id'])});break;default:logger[_0x372a('0x5a')]('[QUEUE]',_0x372a('0x5b'));}}})[_0x372a('0x5c')](function(_0x81a1b8){console[_0x372a('0x5a')](_0x81a1b8);logger[_0x372a('0x5a')](_0x372a('0x4c'),JSON['stringify'](_0x81a1b8));});};exports['outbound']=function(_0x1f6365,_0xbbab61,_0x6dd580,_0xcd2c55,_0x46811f,_0x2ccf48,_0x4aad46){var _0x2bcf35,_0x3a54c0;_0x2ccf48[_0x372a('0xd')]=intUtil[_0x372a('0x49')](_0x2ccf48[_0x372a('0xd')]);_0x2ccf48[_0x372a('0x4a')]=intUtil[_0x372a('0x49')](_0x2ccf48[_0x372a('0x4a')]);if(_0x4aad46&&_0x4aad46[_0x372a('0x5d')]&&_0x4aad46['recordingFormat']!=='none'){logger['info'](_0x372a('0x5e'),_0x372a('0x4d'));_0xbbab61[_0x372a('0x50')]=util[_0x372a('0xb')](_0x372a('0x4e'),_0x2ccf48[_0x372a('0x4a')],_0xbbab61[_0x372a('0x4f')],md5(_0xbbab61['uniqueid']));}headers[_0x372a('0x5f')]=getAuth(_0x2ccf48);return getUser(_0x2ccf48,_0xcd2c55['email'])['then'](function(_0x4abbde){_0x2bcf35=_0x4abbde;logger[_0x372a('0x14')](_0x372a('0x60'),_0x2bcf35['id']);return getEndUser(_0x2ccf48,_0xbbab61[_0x372a('0x61')],_0xbbab61[_0x372a('0x62')]);})['then'](function(_0x43ae8f){_0x3a54c0=_0x43ae8f;logger[_0x372a('0x14')](_0x372a('0x51'),_0x3a54c0['id']);return getTicket(_0x2ccf48,_0x2bcf35,_0x3a54c0,_0x6dd580,_0xbbab61);})[_0x372a('0xe')](function(_0x263eb2){if(_0x263eb2){logger['info'](_0x372a('0x52'));logger[_0x372a('0x14')](_0x372a('0x63'),_0x263eb2['id']);switch(_0x2ccf48[_0x372a('0x2e')]){case _0x372a('0x64'):logger[_0x372a('0x14')]('[QUEUE]',_0x372a('0x53'));emit(util[_0x372a('0xb')](_0x372a('0x54'),_0xcd2c55[_0x372a('0x38')]),_0x372a('0x55'),{'recordId':_0x263eb2['id']});break;case _0x372a('0x56'):logger['info'](_0x372a('0x4c'),_0x372a('0x57'));emit(util[_0x372a('0xb')](_0x372a('0x54'),_0xcd2c55[_0x372a('0x38')]),'trigger:browser:url',{'uri':util['format'](_0x372a('0x65'),_0x2ccf48[_0x372a('0xd')],_0x263eb2['id'])});break;default:logger[_0x372a('0x5a')]('[OUTBOUND]','Desk\x20account\x20type\x20not\x20recognized');}}})[_0x372a('0x5c')](function(_0xd9d998){logger[_0x372a('0x5a')]('[OUTBOUND]',JSON[_0x372a('0x19')](_0xd9d998));});};exports[_0x372a('0x66')]=function(_0xcef522,_0xe22117,_0x4279ba,_0x51a839,_0x2b8287,_0x5a948e){var _0x87fe74,_0x290952;_0x5a948e[_0x372a('0xd')]=intUtil['stripTrailingSlash'](_0x5a948e[_0x372a('0xd')]);_0x5a948e[_0x372a('0x4a')]=intUtil[_0x372a('0x49')](_0x5a948e[_0x372a('0x4a')]);if(_0x2b8287&&_0x2b8287['monitor_format']){logger[_0x372a('0x14')]('['+_0xe22117['lastevent']['toUpperCase']()+']',_0x372a('0x4d'));_0xe22117[_0x372a('0x50')]=util['format'](_0x372a('0x4e'),_0x5a948e[_0x372a('0x4a')],_0xe22117['uniqueid'],md5(_0xe22117[_0x372a('0x4f')]));}else{_0xe22117['recordingURL']='';}headers[_0x372a('0x5f')]=getAuth(_0x5a948e);return getUser(_0x5a948e)[_0x372a('0xe')](function(_0x3c2a56){_0x87fe74=_0x3c2a56;logger[_0x372a('0x14')]('The\x20User\x20ID\x20is:',_0x87fe74['id']);return getEndUser(_0x5a948e,_0xe22117[_0x372a('0x67')],_0xe22117['calleridnum']);})[_0x372a('0xe')](function(_0x5b87b6){_0x290952=_0x5b87b6;logger[_0x372a('0x14')](_0x372a('0x51'),_0x290952['id']);return getTicket(_0x5a948e,_0x87fe74,_0x290952,_0x4279ba,_0xe22117);})[_0x372a('0xe')](function(_0x500471){if(_0x500471){logger[_0x372a('0x14')]('Ticket\x20created!');logger[_0x372a('0x14')](_0x372a('0x63'),_0x500471['id']);}})['catch'](function(_0x3e1f4f){logger[_0x372a('0x5a')]('['+_0xe22117[_0x372a('0x68')][_0x372a('0x69')]()+']',JSON[_0x372a('0x19')](_0x3e1f4f));});}; \ No newline at end of file +var _0x5ca2=['includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','variable','variableName','name','Variable','priority','merge','getString','Subjects','new','xCALLY','Motion','CTI','concat','Tags','Descriptions','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','unmanaged','toUpperCase','Recording\x20is\x20enabled!','lastevent','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','format','%s/users','remoteUri','total_entries','find','then','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','work','length','map','forEach'];(function(_0x27ded2,_0x3e6679){var _0x5a5434=function(_0x1c4404){while(--_0x1c4404){_0x27ded2['push'](_0x27ded2['shift']());}};_0x5a5434(++_0x3e6679);}(_0x5ca2,0x1ee));var _0x25ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ca2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x25ca('0x0'));var rp=require(_0x25ca('0x1'));var md5=require(_0x25ca('0x2'));var util=require(_0x25ca('0x3'));var Redis=require(_0x25ca('0x4'));var intUtil=require(_0x25ca('0x5'));var config=require(_0x25ca('0x6'));var logger=require(_0x25ca('0x7'))(_0x25ca('0x8'));config[_0x25ca('0x9')]=_[_0x25ca('0xa')](config['redis'],{'host':_0x25ca('0xb'),'port':0x18eb});var io=require(_0x25ca('0xc'))(new Redis(config[_0x25ca('0x9')]));function emit(_0xcd1bf0,_0x3f0d18,_0x259ddc){io['to'](_0xcd1bf0)['emit'](_0x3f0d18,_0x259ddc);}var headers={'Content-Type':'application/json','Accept':_0x25ca('0xd')};function getUser(_0x3a7f1e,_0x16437b){if(intUtil[_0x25ca('0xe')](_0x16437b)===!![]){logger[_0x25ca('0xf')]('Getting\x20agent\x20with\x20email',_0x16437b);return request({'uri':util[_0x25ca('0x10')](_0x25ca('0x11'),_0x3a7f1e[_0x25ca('0x12')])})['then'](function(_0x5c5ded){if(_0x5c5ded[_0x25ca('0x13')]){return _[_0x25ca('0x14')](_0x5c5ded['_embedded']['entries'],{'email':_0x16437b});}})[_0x25ca('0x15')](function(_0x56c643){if(_0x56c643){logger[_0x25ca('0xf')](_0x25ca('0x16'));return _0x56c643;}else{logger[_0x25ca('0xf')](_0x25ca('0x17'));return request({'uri':util[_0x25ca('0x10')](_0x25ca('0x18'),_0x3a7f1e[_0x25ca('0x12')])});}});}else{logger[_0x25ca('0xf')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x25ca('0x10')](_0x25ca('0x18'),_0x3a7f1e['remoteUri'])});}}function request(_0x389a15){logger[_0x25ca('0x19')](_0x25ca('0x1a'),JSON[_0x25ca('0x1b')](_0x389a15));return rp(_['defaults'](_0x389a15,{'method':_0x25ca('0x1c'),'headers':headers,'json':!![]}));}function getAuth(_0x15e57f){var _0x3bef8c;if(_0x15e57f[_0x25ca('0x1d')]===_0x25ca('0x1e')){_0x3bef8c=util[_0x25ca('0x10')](_0x25ca('0x1f'),_0x15e57f[_0x25ca('0x20')],_0x15e57f[_0x25ca('0x21')]);}else if(_0x15e57f[_0x25ca('0x1d')]===_0x25ca('0x22')){_0x3bef8c=util[_0x25ca('0x10')](_0x25ca('0x23'),_0x15e57f['username'],_0x15e57f[_0x25ca('0x22')]);}return util[_0x25ca('0x10')](_0x25ca('0x24'),new Buffer(_0x3bef8c)[_0x25ca('0x25')](_0x25ca('0x26')));}function getEndUser(_0x2cacc6,_0x3c47a7,_0x12a024){logger[_0x25ca('0xf')]('Searching\x20enduser\x20with\x20phone',_0x12a024);return request({'uri':util['format']('%s/customers/search',_0x2cacc6[_0x25ca('0x12')]),'qs':{'phone':_0x12a024}})[_0x25ca('0x15')](function(_0x2c2f5b){if(_0x2c2f5b[_0x25ca('0x13')]){logger[_0x25ca('0xf')]('Enduser\x20found!');return _0x2c2f5b[_0x25ca('0x27')]['entries'][0x0];}else{logger[_0x25ca('0xf')](_0x25ca('0x28'));return request({'uri':util[_0x25ca('0x10')]('%s/customers',_0x2cacc6['remoteUri']),'method':_0x25ca('0x29'),'body':{'first_name':_0x3c47a7,'title':_0x3c47a7,'phone_numbers':[{'type':_0x25ca('0x2a'),'value':_0x12a024}]}});}});}function getTags(_0x50669d,_0x2dcbb2){var _0x13acce=[];if(_0x50669d&&_0x50669d[_0x25ca('0x2b')]>0x0){_0x13acce=_[_0x25ca('0x2c')](_0x50669d,_0x2dcbb2);}return _0x13acce;}function getCustomFields(_0x33cc7a,_0x2669bd){var _0x1056e9=[];var _0x15c50c={'custom_fields':{}};if(_0x33cc7a[_0x25ca('0x2b')]>0x0){_[_0x25ca('0x2d')](_0x33cc7a,function(_0x594340){if(_[_0x25ca('0x2e')]([_0x25ca('0x2f'),_0x25ca('0x30')],_0x594340[_0x25ca('0x31')])&&_0x594340[_0x25ca('0x32')]&&!_0x594340[_0x25ca('0x33')]){_0x15c50c[_0x594340[_0x25ca('0x32')][_0x25ca('0x34')]()]=_0x594340[_0x25ca('0x35')][_0x25ca('0x25')]();}else if(_[_0x25ca('0x2e')]([_0x25ca('0x2f'),'picklist'],_0x594340[_0x25ca('0x31')])&&_0x594340[_0x25ca('0x36')]&&_0x594340[_0x25ca('0x33')]){_0x15c50c[_0x25ca('0x37')][_0x594340[_0x25ca('0x36')]]=_0x594340[_0x25ca('0x35')][_0x25ca('0x25')]();}else if(_0x594340[_0x25ca('0x31')]===_0x25ca('0x38')&&_0x594340[_0x25ca('0x39')]&&_0x594340['idField']&&_0x594340[_0x25ca('0x33')]){_0x2669bd[_0x594340[_0x25ca('0x39')]]&&(_0x15c50c[_0x25ca('0x37')][_0x594340['idField']]=_0x2669bd[_0x594340[_0x25ca('0x39')]][_0x25ca('0x25')]());}else if(_0x594340[_0x25ca('0x31')]==='customVariable'&&_0x594340['Variable']&&_0x594340['Variable'][_0x25ca('0x3a')]&&_0x594340['idField']&&_0x594340[_0x25ca('0x33')]){_0x2669bd[_0x594340[_0x25ca('0x3b')][_0x25ca('0x3a')]['toLowerCase']()]&&(_0x15c50c[_0x25ca('0x37')][_0x594340[_0x25ca('0x36')]]=_0x2669bd[_0x594340['Variable'][_0x25ca('0x3a')]['toLowerCase']()][_0x25ca('0x25')]());}});}if(_0x15c50c[_0x25ca('0x3c')]){_0x15c50c[_0x25ca('0x3c')]=Number(_0x15c50c[_0x25ca('0x3c')]);}return _0x15c50c;}function getTicket(_0x5673d5,_0x793898,_0x5e5d31,_0x14f7b1,_0x1490ee){logger[_0x25ca('0xf')]('Creating\x20new\x20ticket...');var _0x4ac6a8=_[_0x25ca('0x3d')]({'subject':intUtil[_0x25ca('0x3e')](_0x14f7b1[_0x25ca('0x3f')],_0x1490ee,'\x20'),'type':'phone','status':_0x25ca('0x40'),'labels':[_0x25ca('0x41'),_0x25ca('0x42'),_0x25ca('0x43')][_0x25ca('0x44')](getTags(_0x14f7b1[_0x25ca('0x45')],_0x25ca('0x3a'))),'description':intUtil[_0x25ca('0x3e')](_0x14f7b1[_0x25ca('0x46')],_0x1490ee,'\x0a'),'_links':{'assigned_user':{'href':util[_0x25ca('0x10')]('/api/v2/users/%d',_0x793898['id']),'class':'user'}},'message':{'direction':'in','body':intUtil[_0x25ca('0x3e')](_0x14f7b1[_0x25ca('0x46')],_0x1490ee,'\x0a')}},getCustomFields(_0x14f7b1[_0x25ca('0x47')],_0x1490ee));return request({'uri':util[_0x25ca('0x10')](_0x25ca('0x48'),_0x5673d5[_0x25ca('0x12')],_0x5e5d31['id']),'method':_0x25ca('0x29'),'body':_0x4ac6a8});}exports[_0x25ca('0x49')]=function(_0x501a62,_0x229633,_0x4a81a1,_0x3a0353,_0x21778d,_0x2bef8d){var _0x150d22,_0x1fa968;_0x2bef8d['remoteUri']=intUtil[_0x25ca('0x4a')](_0x2bef8d[_0x25ca('0x12')]);_0x2bef8d[_0x25ca('0x4b')]=intUtil[_0x25ca('0x4a')](_0x2bef8d['serverUrl']);if(_0x21778d&&_0x21778d[_0x25ca('0x4c')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x229633[_0x25ca('0x4d')]=util[_0x25ca('0x10')](_0x25ca('0x4e'),_0x2bef8d[_0x25ca('0x4b')],_0x229633['uniqueid'],md5(_0x229633[_0x25ca('0x4f')]));}else{_0x229633[_0x25ca('0x4d')]='';}headers[_0x25ca('0x50')]=getAuth(_0x2bef8d);return getUser(_0x2bef8d,_0x3a0353['email'])['then'](function(_0x1ebd41){_0x150d22=_0x1ebd41;logger[_0x25ca('0xf')](_0x25ca('0x51'),_0x150d22['id']);return getEndUser(_0x2bef8d,_0x229633[_0x25ca('0x52')],_0x229633[_0x25ca('0x53')]);})[_0x25ca('0x15')](function(_0x1e90ea){_0x1fa968=_0x1e90ea;logger[_0x25ca('0xf')](_0x25ca('0x54'),_0x1fa968['id']);return getTicket(_0x2bef8d,_0x150d22,_0x1fa968,_0x4a81a1,_0x229633);})[_0x25ca('0x15')](function(_0x190ba6){if(_0x190ba6){logger[_0x25ca('0xf')](_0x25ca('0x55'));logger[_0x25ca('0xf')](_0x25ca('0x56'),_0x190ba6['id']);switch(_0x2bef8d[_0x25ca('0x31')]){case _0x25ca('0x57'):logger[_0x25ca('0xf')](_0x25ca('0x58'),_0x25ca('0x59'));emit(util[_0x25ca('0x10')](_0x25ca('0x5a'),_0x3a0353[_0x25ca('0x3a')]),_0x25ca('0x5b'),{'recordId':_0x190ba6['id']});break;case'newTab':logger[_0x25ca('0xf')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x25ca('0x5a'),_0x3a0353['name']),_0x25ca('0x5c'),{'uri':util[_0x25ca('0x10')](_0x25ca('0x5d'),_0x190ba6['id'])});break;default:logger['error'](_0x25ca('0x58'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x25ca('0x5e')](function(_0x100a57){console['error'](_0x100a57);logger[_0x25ca('0x5f')](_0x25ca('0x58'),JSON[_0x25ca('0x1b')](_0x100a57));});};exports[_0x25ca('0x60')]=function(_0x11c6aa,_0x4025c,_0x3375f1,_0x23dc37,_0x5a498a,_0x3a92d1,_0x39c218){var _0x20b963,_0x24f612;_0x3a92d1['remoteUri']=intUtil['stripTrailingSlash'](_0x3a92d1[_0x25ca('0x12')]);_0x3a92d1['serverUrl']=intUtil[_0x25ca('0x4a')](_0x3a92d1[_0x25ca('0x4b')]);if(_0x39c218&&_0x39c218[_0x25ca('0x61')]&&_0x39c218[_0x25ca('0x61')]!==_0x25ca('0x62')){logger[_0x25ca('0xf')](_0x25ca('0x63'),'Recording\x20is\x20enabled!');_0x4025c['recordingURL']=util['format'](_0x25ca('0x4e'),_0x3a92d1[_0x25ca('0x4b')],_0x4025c['uniqueid'],md5(_0x4025c['uniqueid']));}headers['Authorization']=getAuth(_0x3a92d1);return getUser(_0x3a92d1,_0x23dc37['email'])[_0x25ca('0x15')](function(_0x2f5601){_0x20b963=_0x2f5601;logger[_0x25ca('0xf')]('The\x20User\x20ID\x20is:',_0x20b963['id']);return getEndUser(_0x3a92d1,_0x4025c['destcalleridname'],_0x4025c[_0x25ca('0x64')]);})[_0x25ca('0x15')](function(_0x171013){_0x24f612=_0x171013;logger['info'](_0x25ca('0x54'),_0x24f612['id']);return getTicket(_0x3a92d1,_0x20b963,_0x24f612,_0x3375f1,_0x4025c);})[_0x25ca('0x15')](function(_0x1be4b3){if(_0x1be4b3){logger[_0x25ca('0xf')](_0x25ca('0x55'));logger[_0x25ca('0xf')]('The\x20Ticket\x20ID\x20is:',_0x1be4b3['id']);switch(_0x3a92d1[_0x25ca('0x31')]){case'integrationTab':logger[_0x25ca('0xf')]('[QUEUE]',_0x25ca('0x59'));emit(util['format']('user:%s',_0x23dc37['name']),'trigger:desk:display',{'recordId':_0x1be4b3['id']});break;case _0x25ca('0x65'):logger[_0x25ca('0xf')]('[QUEUE]',_0x25ca('0x66'));emit(util[_0x25ca('0x10')](_0x25ca('0x5a'),_0x23dc37['name']),_0x25ca('0x5c'),{'uri':util[_0x25ca('0x10')](_0x25ca('0x67'),_0x3a92d1[_0x25ca('0x12')],_0x1be4b3['id'])});break;default:logger[_0x25ca('0x5f')](_0x25ca('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x25ca('0x5e')](function(_0x3c91be){logger['error'](_0x25ca('0x63'),JSON[_0x25ca('0x1b')](_0x3c91be));});};exports[_0x25ca('0x68')]=function(_0x3d5824,_0x4ef910,_0x518a6f,_0x24b855,_0x2c54a7,_0x370753){var _0x4fc02f,_0x5c0da8;_0x370753['remoteUri']=intUtil[_0x25ca('0x4a')](_0x370753[_0x25ca('0x12')]);_0x370753[_0x25ca('0x4b')]=intUtil['stripTrailingSlash'](_0x370753[_0x25ca('0x4b')]);if(_0x2c54a7&&_0x2c54a7[_0x25ca('0x4c')]){logger[_0x25ca('0xf')]('['+_0x4ef910['lastevent'][_0x25ca('0x69')]()+']',_0x25ca('0x6a'));_0x4ef910[_0x25ca('0x4d')]=util[_0x25ca('0x10')](_0x25ca('0x4e'),_0x370753['serverUrl'],_0x4ef910['uniqueid'],md5(_0x4ef910['uniqueid']));}else{_0x4ef910['recordingURL']='';}headers[_0x25ca('0x50')]=getAuth(_0x370753);return getUser(_0x370753)[_0x25ca('0x15')](function(_0x57f0d7){_0x4fc02f=_0x57f0d7;logger[_0x25ca('0xf')](_0x25ca('0x51'),_0x4fc02f['id']);return getEndUser(_0x370753,_0x4ef910[_0x25ca('0x52')],_0x4ef910['calleridnum']);})[_0x25ca('0x15')](function(_0x19056a){_0x5c0da8=_0x19056a;logger[_0x25ca('0xf')]('The\x20Enduser\x20ID\x20is:',_0x5c0da8['id']);return getTicket(_0x370753,_0x4fc02f,_0x5c0da8,_0x518a6f,_0x4ef910);})[_0x25ca('0x15')](function(_0x9b079d){if(_0x9b079d){logger[_0x25ca('0xf')](_0x25ca('0x55'));logger[_0x25ca('0xf')](_0x25ca('0x56'),_0x9b079d['id']);}})[_0x25ca('0x5e')](function(_0x17383b){logger[_0x25ca('0x5f')]('['+_0x4ef910[_0x25ca('0x6b')][_0x25ca('0x69')]()+']',JSON[_0x25ca('0x1b')](_0x17383b));});}; \ 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 2ec2260..a27f559 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 _0xb934=['picklist','type','nameField','customField','idField','indexOf','content','incidents','getString','Subjects','/contacts(','/systemusers(','Fields','ticketType','phonecall','phonecalls','assign','calleridnum','callDirection','queue','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','trigger:browser:url','serverUrl','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','defaults','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','systemuserid','toLowerCase','outbound','destcalleridnum','contacts','headers','odata-entityid','substring','lastIndexOf','enduserId',']\x20Enduser\x20created!','forEach','string'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb934,0x92));var _0x4b93=function(_0x2f5d25,_0x539ccf){_0x2f5d25=_0x2f5d25-0x0;var _0x15a429=_0xb934[_0x2f5d25];return _0x15a429;};'use strict';var _=require(_0x4b93('0x0'));var BPromise=require(_0x4b93('0x1'));var rp=require(_0x4b93('0x2'));var util=require('util');var intUtil=require(_0x4b93('0x3'));var md5=require(_0x4b93('0x4'));var Redis=require(_0x4b93('0x5'));var logger=require(_0x4b93('0x6'))(_0x4b93('0x7'));var config=require('../../../../config/environment');config['redis']=_[_0x4b93('0x8')](config[_0x4b93('0x9')],{'host':_0x4b93('0xa'),'port':0x18eb});var io=require(_0x4b93('0xb'))(new Redis(config['redis']));function getAuthToken(_0x3ee934,_0x20d624,_0x36cdc8){var _0xa7f4c2={'method':_0x4b93('0xc'),'uri':_0x20d624,'form':{'client_id':_0x3ee934[_0x4b93('0xd')],'resource':_0x3ee934[_0x4b93('0xe')],'username':_0x3ee934[_0x4b93('0xf')],'password':_0x3ee934[_0x4b93('0x10')],'grant_type':'password','client_secret':_0x3ee934[_0x4b93('0x11')]},'json':!![]};return rp(_0xa7f4c2)[_0x4b93('0x12')](function(_0x16a0d4){return _0x16a0d4[_0x4b93('0x13')];})[_0x4b93('0x14')](function(_0x7fe591){logger[_0x4b93('0x15')]('['+[_0x36cdc8[_0x4b93('0x16')]()]+_0x4b93('0x17'));return _0x7fe591[_0x4b93('0x18')];});}function getUser(_0x79a4d0,_0x1d2234,_0x332359,_0x3f4db7,_0x11dd47,_0x4f7c7a){return new BPromise(function(_0x2e573d,_0x102e58){return getAuthToken(_0x1d2234,_0x3f4db7,_0x4f7c7a)[_0x4b93('0x12')](function(_0x53eb43){var _0x19a9d5={'method':_0x4b93('0x19'),'uri':_0x11dd47+_0x4b93('0x1a'),'headers':{'Authorization':_0x4b93('0x1b')+_0x53eb43,'OData-Version':_0x4b93('0x1c')},'json':!![]};return rp(_0x19a9d5);})['then'](function(_0x67669d){var _0xd304ec=_0x67669d['value'];var _0x50a27b=![];var _0x11a1f3=null;if(!_[_0x4b93('0x1d')](_0x332359)){if(intUtil[_0x4b93('0x1e')](_0x332359[_0x4b93('0x1f')])){_0x79a4d0[_0x4b93('0x20')]=_0x332359[_0x4b93('0x1f')];for(_0x11a1f3=0x0;_0x11a1f3<_0xd304ec[_0x4b93('0x21')];_0x11a1f3++){if(_0xd304ec[_0x11a1f3][_0x4b93('0x22')]===_0x332359[_0x4b93('0x1f')]&&!_0xd304ec[_0x11a1f3][_0x4b93('0x23')]){_0x50a27b=!![];logger[_0x4b93('0x24')]('['+[_0x4f7c7a['toUpperCase']()]+']\x20Agent\x20found\x20'+_0xd304ec[_0x11a1f3]['systemuserid']+'!');_0x79a4d0['userId']=_0xd304ec[_0x11a1f3]['systemuserid'];}}}}if(!_0x50a27b){logger[_0x4b93('0x24')]('['+[_0x4f7c7a['toUpperCase']()]+_0x4b93('0x25'));_0x79a4d0[_0x4b93('0x20')]=_0x1d2234[_0x4b93('0xf')];for(_0x11a1f3=0x0;_0x11a1f3<_0xd304ec[_0x4b93('0x21')];_0x11a1f3++){if(_0xd304ec[_0x11a1f3][_0x4b93('0x22')]===_0x1d2234[_0x4b93('0xf')]){_0x79a4d0[_0x4b93('0x26')]=_0xd304ec[_0x11a1f3][_0x4b93('0x27')];}}}_0x2e573d(_0x79a4d0);})['catch'](function(_0x5691ba){_0x102e58(_0x5691ba[_0x4b93('0x18')]);});});}function createEndUser(_0x4fff6a,_0x118afb,_0x56e4a8,_0x352f08,_0x5a0a76,_0x5ec0af){return new BPromise(function(_0x302b93,_0x66df79){return getAuthToken(_0x118afb,_0x56e4a8,_0x5ec0af)[_0x4b93('0x12')](function(_0x205e5b){var _0x3e3c0e=_0x5ec0af[_0x4b93('0x28')]()===_0x4b93('0x29')?_0x5a0a76[_0x4b93('0x2a')]:_0x5a0a76['calleridnum'];var _0x2bff36={'method':_0x4b93('0xc'),'uri':_0x352f08+_0x4b93('0x2b'),'body':{'telephone1':_0x3e3c0e,'fullname':_0x3e3c0e,'firstname':_0x3e3c0e,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x4fff6a[_0x4b93('0x26')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x205e5b,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x2bff36);})[_0x4b93('0x12')](function(_0x2fb254){var _0x1d4a80=_0x2fb254[_0x4b93('0x2c')][_0x4b93('0x2d')];var _0x421d5c=_0x1d4a80[_0x4b93('0x2e')](_0x1d4a80[_0x4b93('0x2f')]('(')+0x1,_0x1d4a80[_0x4b93('0x2f')](')'));_0x4fff6a[_0x4b93('0x30')]=_0x421d5c;_0x302b93(_0x4fff6a);})['catch'](function(_0x8c1e2b){_0x66df79(_0x8c1e2b['message']);});});}function getEndUser(_0x551d21,_0x31a96d,_0x278bdb,_0x3d39f2,_0x20f83a,_0x23d26b){return new BPromise(function(_0x224abc,_0x376e63){return getAuthToken(_0x31a96d,_0x278bdb,_0x23d26b)[_0x4b93('0x12')](function(_0x520ef3){var _0x34d8d8={'method':_0x4b93('0x19'),'uri':_0x3d39f2+'contacts?$select=telephone1','headers':{'Authorization':'Bearer\x20'+_0x520ef3,'If-None-Match':null,'OData-Version':_0x4b93('0x1c')},'json':!![]};return rp(_0x34d8d8);})[_0x4b93('0x12')](function(_0x3cc5fa){var _0x162a2e=null;if(_0x3cc5fa){var _0x340021=_0x3cc5fa['value'];var _0x256b9a=![];for(_0x162a2e=0x0;_0x162a2e<_0x340021[_0x4b93('0x21')];_0x162a2e++){var _0x12ead4=_0x23d26b[_0x4b93('0x28')]()===_0x4b93('0x29')?_0x20f83a[_0x4b93('0x2a')]:_0x20f83a['calleridnum'];if(_0x340021[_0x162a2e]['telephone1']===_0x12ead4){_0x256b9a=!![];_0x551d21['enduserId']=_0x340021[_0x162a2e]['contactid'];}}if(_0x256b9a){_0x224abc(_0x551d21);}else{return createEndUser(_0x551d21,_0x31a96d,_0x278bdb,_0x3d39f2,_0x20f83a,_0x23d26b)[_0x4b93('0x12')](function(_0x40cc7a){logger['info']('['+[_0x23d26b[_0x4b93('0x16')]()]+_0x4b93('0x31'),_0x40cc7a[_0x4b93('0x30')]);_0x224abc(_0x40cc7a);});}}else{return createEndUser(_0x551d21,_0x31a96d,_0x278bdb,_0x3d39f2,_0x20f83a,_0x23d26b)[_0x4b93('0x12')](function(_0x5925b7){logger[_0x4b93('0x24')]('['+[_0x23d26b[_0x4b93('0x16')]()]+']\x20Enduser\x20Created!',_0x5925b7[_0x4b93('0x30')]);_0x224abc(_0x5925b7);});}});});}function getCustomFields(_0x4a7b3e,_0x25b55c,_0x504111){var _0x5d6f72={};if(_0x4a7b3e[_0x4b93('0x21')]>0x0){_[_0x4b93('0x32')](_0x4a7b3e,function(_0x4ef3c6){if(_['includes']([_0x4b93('0x33'),_0x4b93('0x34')],_0x4ef3c6[_0x4b93('0x35')])&&_0x4ef3c6[_0x4b93('0x36')]&&!_0x4ef3c6[_0x4b93('0x37')]){var _0x2cdefe=_0x4ef3c6[_0x4b93('0x38')][_0x4b93('0x28')]();var _0x52d56f=_0x2cdefe[_0x4b93('0x2e')](0x0,_0x2cdefe['indexOf']('_'));var _0x10ffff=_0x2cdefe['substring'](_0x2cdefe[_0x4b93('0x39')]('_')+0x1);if(_0x52d56f===_0x504111){_0x5d6f72[_0x10ffff]=_0x4ef3c6[_0x4b93('0x3a')];}}});}return _0x5d6f72;}function getTicket(_0x1b9fad,_0x5a8c00,_0x343f5a,_0xe1e51b,_0x5f5604,_0x5f4f27,_0x5afc93){return new BPromise(function(_0x48491d,_0x3fb869){var _0x29f6eb;return getAuthToken(_0x5a8c00,_0x343f5a,_0x5afc93)[_0x4b93('0x12')](function(_0x3d93f3){if(_0x5f4f27['ticketType']==='incident'){_0x29f6eb={'method':_0x4b93('0xc'),'uri':_0xe1e51b+_0x4b93('0x3b'),'body':Object['assign']({},{'title':intUtil[_0x4b93('0x3c')](_0x5f4f27[_0x4b93('0x3d')],_0x5f5604,'\x20'),'description':intUtil['getString'](_0x5f4f27['Descriptions'],_0x5f5604,'\x0a'),'customerid_contact@odata.bind':_0x4b93('0x3e')+_0x1b9fad[_0x4b93('0x30')]+')','ownerid@odata.bind':_0x4b93('0x3f')+_0x1b9fad[_0x4b93('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x5f4f27[_0x4b93('0x40')],_0x5f5604,_0x5f4f27[_0x4b93('0x41')])),'headers':{'Authorization':_0x4b93('0x1b')+_0x3d93f3,'OData-Version':_0x4b93('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5f4f27['ticketType']===_0x4b93('0x42')){_0x29f6eb={'method':_0x4b93('0xc'),'uri':_0xe1e51b+_0x4b93('0x43'),'body':Object[_0x4b93('0x44')]({},{'subject':intUtil[_0x4b93('0x3c')](_0x5f4f27[_0x4b93('0x3d')],_0x5f5604,'\x20'),'phonenumber':String(_0x5f5604[_0x4b93('0x45')]),'description':intUtil['getString'](_0x5f4f27['Descriptions'],_0x5f5604,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4b93('0x3e')+_0x1b9fad[_0x4b93('0x30')]+')','ownerid@odata.bind':_0x4b93('0x3f')+_0x1b9fad['userId']+')','directioncode':_0x1b9fad[_0x4b93('0x46')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x1b9fad[_0x4b93('0x26')]+')','participationtypemask':_0x1b9fad['callDirection']===_0x4b93('0x47')?0x2:0x1},{'partyid_contact@odata.bind':_0x4b93('0x3e')+_0x1b9fad[_0x4b93('0x30')]+')','participationtypemask':_0x1b9fad[_0x4b93('0x46')]===_0x4b93('0x47')?0x1:0x2}]},getCustomFields(_0x5f4f27[_0x4b93('0x40')],_0x5f5604,_0x5f4f27[_0x4b93('0x41')])),'headers':{'Authorization':_0x4b93('0x1b')+_0x3d93f3,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x29f6eb);})[_0x4b93('0x12')](function(_0x149d39){var _0x11eacc=_0x149d39[_0x4b93('0x2c')]['odata-entityid'];var _0x243285=_0x11eacc[_0x4b93('0x2e')](_0x11eacc[_0x4b93('0x2f')]('(')+0x1,_0x11eacc[_0x4b93('0x2f')](')'));_0x1b9fad['ticketId']=_0x243285;_0x48491d(_0x1b9fad);})['catch'](function(_0x31069a){_0x3fb869(_0x31069a['message']);});});}function emit(_0x127896,_0x3af75a,_0x38cc38,_0x12c5f5){var _0x1826a1={'uri':util['format'](_0x4b93('0x48'),_0x127896,_0x38cc38,_0x12c5f5)};io['to'](util[_0x4b93('0x49')](_0x4b93('0x4a'),_0x3af75a))['emit'](_0x4b93('0x4b'),_0x1826a1);}exports['cs']=function(_0x46c721,_0xe5a732,_0x4b7195,_0x1c0d87,_0x122eb6,_0x545f54,_0xd18be2,_0x42fe93){var _0xba645e={};_0x545f54[_0x4b93('0xe')]=intUtil['stripTrailingSlash'](_0x545f54[_0x4b93('0xe')]);_0x545f54[_0x4b93('0x4c')]=intUtil[_0x4b93('0x4d')](_0x545f54[_0x4b93('0x4c')]);_0xba645e[_0x4b93('0x46')]=_0x42fe93===_0x4b93('0x47')||_0x42fe93===_0x4b93('0x4e')?_0x4b93('0x47'):'outbound';var _0x47907e=util[_0x4b93('0x49')](_0x4b93('0x4f'),_0x545f54[_0x4b93('0xe')]);var _0x30de07=util[_0x4b93('0x49')](_0x4b93('0x50'),_0x545f54[_0x4b93('0x51')]);var _0xaef99c=util[_0x4b93('0x49')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x545f54[_0x4b93('0x4c')],_0xe5a732[_0x4b93('0x52')],md5(_0xe5a732['uniqueid']));if(_0x122eb6&&_0x122eb6[_0x4b93('0x53')]){logger[_0x4b93('0x24')](_0x4b93('0x54'),_0x4b93('0x55'));_0xe5a732[_0x4b93('0x56')]=_0xaef99c;}else if(_0xd18be2&&_0xd18be2['recordingFormat']&&_0xd18be2[_0x4b93('0x57')]!=='none'){logger[_0x4b93('0x24')]('[OUTBOUND]',_0x4b93('0x55'));_0xe5a732[_0x4b93('0x56')]=_0xaef99c;}else{_0xe5a732[_0x4b93('0x56')]='';}return getUser(_0xba645e,_0x545f54,_0x1c0d87,_0x30de07,_0x47907e,_0x42fe93)[_0x4b93('0x12')](function(_0x115656){logger[_0x4b93('0x24')]('['+_0x42fe93[_0x4b93('0x16')]()+_0x4b93('0x58'),_0x115656['userId']);logger['info']('['+_0x42fe93[_0x4b93('0x16')]()+_0x4b93('0x59'),_0x115656[_0x4b93('0x20')]);return getEndUser(_0x115656,_0x545f54,_0x30de07,_0x47907e,_0xe5a732,_0x42fe93);})[_0x4b93('0x12')](function(_0x356ec5){logger[_0x4b93('0x24')]('['+_0x42fe93[_0x4b93('0x16')]()+_0x4b93('0x5a'),_0x356ec5[_0x4b93('0x30')]);logger[_0x4b93('0x24')]('['+_0x42fe93[_0x4b93('0x16')]()+_0x4b93('0x5b'),_0xe5a732[_0x4b93('0x45')]);return getTicket(_0x356ec5,_0x545f54,_0x30de07,_0x47907e,_0xe5a732,_0x4b7195,_0x42fe93);})['then'](function(_0x57344c){logger[_0x4b93('0x24')](util[_0x4b93('0x49')]('['+_0x42fe93[_0x4b93('0x16')]()+_0x4b93('0x5c'),_0x4b7195['ticketType'],_0x57344c[_0x4b93('0x5d')]));logger[_0x4b93('0x24')](util[_0x4b93('0x49')]('['+_0x42fe93[_0x4b93('0x16')]()+_0x4b93('0x5e'),_0x42fe93));if(_0x42fe93!==_0x4b93('0x4e')){logger['info']('['+_0x42fe93['toUpperCase']()+']',_0x4b93('0x5f'));emit(_0x545f54[_0x4b93('0xe')],_0x1c0d87[_0x4b93('0x60')],_0x4b7195[_0x4b93('0x41')],_0x57344c[_0x4b93('0x5d')]);}})[_0x4b93('0x14')](function(_0x4ee674){logger[_0x4b93('0x15')]('['+_0x42fe93['toUpperCase']()+_0x4b93('0x61'),util[_0x4b93('0x62')](_0x4ee674,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x39c7=['Subjects','getString','Descriptions','/contacts(','phonecall','phonecalls','callDirection','queue','Fields','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','unmanaged','outbound','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','bluebird','request-promise','util','./util','md5','ioredis','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','POST','clientId','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','Bearer\x20','4.0','value','isNil','email','userEmail','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','username','length','userId','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','GET','contacts?$select=telephone1','contactid','forEach','includes','type','nameField','customField','idField','indexOf','content','ticketType'];(function(_0x313014,_0x375ea6){var _0x39e670=function(_0x1bf910){while(--_0x1bf910){_0x313014['push'](_0x313014['shift']());}};_0x39e670(++_0x375ea6);}(_0x39c7,0x85));var _0x739c=function(_0x471600,_0x2db989){_0x471600=_0x471600-0x0;var _0x265466=_0x39c7[_0x471600];return _0x265466;};'use strict';var _=require('lodash');var BPromise=require(_0x739c('0x0'));var rp=require(_0x739c('0x1'));var util=require(_0x739c('0x2'));var intUtil=require(_0x739c('0x3'));var md5=require(_0x739c('0x4'));var Redis=require(_0x739c('0x5'));var logger=require('../../../../config/logger')(_0x739c('0x6'));var config=require(_0x739c('0x7'));config[_0x739c('0x8')]=_['defaults'](config['redis'],{'host':_0x739c('0x9'),'port':0x18eb});var io=require(_0x739c('0xa'))(new Redis(config['redis']));function getAuthToken(_0x480159,_0x27c5a4,_0x3475f2){var _0x5e8ed6={'method':_0x739c('0xb'),'uri':_0x27c5a4,'form':{'client_id':_0x480159[_0x739c('0xc')],'resource':_0x480159['remoteUri'],'username':_0x480159['username'],'password':_0x480159[_0x739c('0xd')],'grant_type':_0x739c('0xd'),'client_secret':_0x480159[_0x739c('0xe')]},'json':!![]};return rp(_0x5e8ed6)[_0x739c('0xf')](function(_0x2ef40e){return _0x2ef40e[_0x739c('0x10')];})[_0x739c('0x11')](function(_0x37c26f){logger[_0x739c('0x12')]('['+[_0x3475f2[_0x739c('0x13')]()]+_0x739c('0x14'));return _0x37c26f[_0x739c('0x15')];});}function getUser(_0x5b8dab,_0x432308,_0xd6cb9c,_0x211418,_0x2d4939,_0x298049){return new BPromise(function(_0x23be87,_0x254b5d){return getAuthToken(_0x432308,_0x211418,_0x298049)[_0x739c('0xf')](function(_0x2083f8){var _0x1a97c1={'method':'GET','uri':_0x2d4939+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x739c('0x16')+_0x2083f8,'OData-Version':_0x739c('0x17')},'json':!![]};return rp(_0x1a97c1);})[_0x739c('0xf')](function(_0x56034d){var _0x1bb4fd=_0x56034d[_0x739c('0x18')];var _0x27141a=![];var _0x25acc6=null;if(!_[_0x739c('0x19')](_0xd6cb9c)){if(intUtil['validateEmail'](_0xd6cb9c[_0x739c('0x1a')])){_0x5b8dab[_0x739c('0x1b')]=_0xd6cb9c[_0x739c('0x1a')];for(_0x25acc6=0x0;_0x25acc6<_0x1bb4fd['length'];_0x25acc6++){if(_0x1bb4fd[_0x25acc6][_0x739c('0x1c')]===_0xd6cb9c['email']&&!_0x1bb4fd[_0x25acc6]['isdisabled']){_0x27141a=!![];logger[_0x739c('0x1d')]('['+[_0x298049['toUpperCase']()]+_0x739c('0x1e')+_0x1bb4fd[_0x25acc6][_0x739c('0x1f')]+'!');_0x5b8dab['userId']=_0x1bb4fd[_0x25acc6][_0x739c('0x1f')];}}}}if(!_0x27141a){logger['info']('['+[_0x298049[_0x739c('0x13')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x5b8dab[_0x739c('0x1b')]=_0x432308[_0x739c('0x20')];for(_0x25acc6=0x0;_0x25acc6<_0x1bb4fd[_0x739c('0x21')];_0x25acc6++){if(_0x1bb4fd[_0x25acc6][_0x739c('0x1c')]===_0x432308[_0x739c('0x20')]){_0x5b8dab[_0x739c('0x22')]=_0x1bb4fd[_0x25acc6][_0x739c('0x1f')];}}}_0x23be87(_0x5b8dab);})[_0x739c('0x11')](function(_0x5d404c){_0x254b5d(_0x5d404c[_0x739c('0x15')]);});});}function createEndUser(_0x87b322,_0x5c963f,_0x3dad7f,_0x54c667,_0x4ca46a,_0x4200b3){return new BPromise(function(_0x722443,_0x322139){return getAuthToken(_0x5c963f,_0x3dad7f,_0x4200b3)[_0x739c('0xf')](function(_0x2053a5){var _0x4b81ce=_0x4200b3[_0x739c('0x23')]()==='outbound'?_0x4ca46a[_0x739c('0x24')]:_0x4ca46a[_0x739c('0x25')];var _0x178b58={'method':_0x739c('0xb'),'uri':_0x54c667+_0x739c('0x26'),'body':{'telephone1':_0x4b81ce,'fullname':_0x4b81ce,'firstname':_0x4b81ce,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x739c('0x27')+_0x87b322[_0x739c('0x22')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x2053a5,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x178b58);})['then'](function(_0x570c90){var _0xc0bda8=_0x570c90[_0x739c('0x28')][_0x739c('0x29')];var _0x351e6c=_0xc0bda8[_0x739c('0x2a')](_0xc0bda8[_0x739c('0x2b')]('(')+0x1,_0xc0bda8[_0x739c('0x2b')](')'));_0x87b322[_0x739c('0x2c')]=_0x351e6c;_0x722443(_0x87b322);})[_0x739c('0x11')](function(_0x107396){_0x322139(_0x107396[_0x739c('0x15')]);});});}function getEndUser(_0xac8767,_0x368201,_0x2d05cf,_0x204839,_0x30932a,_0x3130e2){return new BPromise(function(_0x358e9f,_0x1146b2){return getAuthToken(_0x368201,_0x2d05cf,_0x3130e2)[_0x739c('0xf')](function(_0x222262){var _0x267484={'method':_0x739c('0x2d'),'uri':_0x204839+_0x739c('0x2e'),'headers':{'Authorization':_0x739c('0x16')+_0x222262,'If-None-Match':null,'OData-Version':_0x739c('0x17')},'json':!![]};return rp(_0x267484);})[_0x739c('0xf')](function(_0x2d73af){var _0x1ee7ce=null;if(_0x2d73af){var _0x37df00=_0x2d73af[_0x739c('0x18')];var _0x75c108=![];for(_0x1ee7ce=0x0;_0x1ee7ce<_0x37df00[_0x739c('0x21')];_0x1ee7ce++){var _0xad3131=_0x3130e2[_0x739c('0x23')]()==='outbound'?_0x30932a[_0x739c('0x24')]:_0x30932a[_0x739c('0x25')];if(_0x37df00[_0x1ee7ce]['telephone1']===_0xad3131){_0x75c108=!![];_0xac8767[_0x739c('0x2c')]=_0x37df00[_0x1ee7ce][_0x739c('0x2f')];}}if(_0x75c108){_0x358e9f(_0xac8767);}else{return createEndUser(_0xac8767,_0x368201,_0x2d05cf,_0x204839,_0x30932a,_0x3130e2)['then'](function(_0x4e68ab){logger[_0x739c('0x1d')]('['+[_0x3130e2[_0x739c('0x13')]()]+']\x20Enduser\x20created!',_0x4e68ab[_0x739c('0x2c')]);_0x358e9f(_0x4e68ab);});}}else{return createEndUser(_0xac8767,_0x368201,_0x2d05cf,_0x204839,_0x30932a,_0x3130e2)[_0x739c('0xf')](function(_0x448dd6){logger[_0x739c('0x1d')]('['+[_0x3130e2[_0x739c('0x13')]()]+']\x20Enduser\x20Created!',_0x448dd6[_0x739c('0x2c')]);_0x358e9f(_0x448dd6);});}});});}function getCustomFields(_0x1cd361,_0x4ad8e4,_0x51a37d){var _0x4eb5ab={};if(_0x1cd361[_0x739c('0x21')]>0x0){_[_0x739c('0x30')](_0x1cd361,function(_0x5279af){if(_[_0x739c('0x31')](['string','picklist'],_0x5279af[_0x739c('0x32')])&&_0x5279af[_0x739c('0x33')]&&!_0x5279af[_0x739c('0x34')]){var _0x3b9ff6=_0x5279af[_0x739c('0x35')][_0x739c('0x23')]();var _0xf22f6c=_0x3b9ff6[_0x739c('0x2a')](0x0,_0x3b9ff6['indexOf']('_'));var _0x1deab6=_0x3b9ff6[_0x739c('0x2a')](_0x3b9ff6[_0x739c('0x36')]('_')+0x1);if(_0xf22f6c===_0x51a37d){_0x4eb5ab[_0x1deab6]=_0x5279af[_0x739c('0x37')];}}});}return _0x4eb5ab;}function getTicket(_0x567ae7,_0x967a2,_0x39e916,_0x561a39,_0x6a0ec2,_0xc22cd1,_0x456b58){return new BPromise(function(_0x3eeb47,_0x480d22){var _0x438cff;return getAuthToken(_0x967a2,_0x39e916,_0x456b58)[_0x739c('0xf')](function(_0x3b6584){if(_0xc22cd1[_0x739c('0x38')]==='incident'){_0x438cff={'method':_0x739c('0xb'),'uri':_0x561a39+'incidents','body':Object['assign']({},{'title':intUtil['getString'](_0xc22cd1[_0x739c('0x39')],_0x6a0ec2,'\x20'),'description':intUtil[_0x739c('0x3a')](_0xc22cd1[_0x739c('0x3b')],_0x6a0ec2,'\x0a'),'customerid_contact@odata.bind':_0x739c('0x3c')+_0x567ae7[_0x739c('0x2c')]+')','ownerid@odata.bind':_0x739c('0x27')+_0x567ae7['userId']+')','caseorigincode':'1'},getCustomFields(_0xc22cd1['Fields'],_0x6a0ec2,_0xc22cd1['ticketType'])),'headers':{'Authorization':_0x739c('0x16')+_0x3b6584,'OData-Version':_0x739c('0x17')},'json':!![],'resolveWithFullResponse':!![]};}if(_0xc22cd1['ticketType']===_0x739c('0x3d')){_0x438cff={'method':'POST','uri':_0x561a39+_0x739c('0x3e'),'body':Object['assign']({},{'subject':intUtil[_0x739c('0x3a')](_0xc22cd1[_0x739c('0x39')],_0x6a0ec2,'\x20'),'phonenumber':String(_0x6a0ec2[_0x739c('0x25')]),'description':intUtil['getString'](_0xc22cd1[_0x739c('0x3b')],_0x6a0ec2,'\x0a'),'regardingobjectid_contact@odata.bind':_0x739c('0x3c')+_0x567ae7['enduserId']+')','ownerid@odata.bind':_0x739c('0x27')+_0x567ae7[_0x739c('0x22')]+')','directioncode':_0x567ae7[_0x739c('0x3f')]===_0x739c('0x40')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x739c('0x27')+_0x567ae7['userId']+')','participationtypemask':_0x567ae7[_0x739c('0x3f')]===_0x739c('0x40')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x567ae7[_0x739c('0x2c')]+')','participationtypemask':_0x567ae7[_0x739c('0x3f')]==='queue'?0x1:0x2}]},getCustomFields(_0xc22cd1[_0x739c('0x41')],_0x6a0ec2,_0xc22cd1['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x3b6584,'OData-Version':_0x739c('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x438cff);})[_0x739c('0xf')](function(_0x4b3248){var _0x3cd16d=_0x4b3248['headers'][_0x739c('0x29')];var _0x13711d=_0x3cd16d[_0x739c('0x2a')](_0x3cd16d[_0x739c('0x2b')]('(')+0x1,_0x3cd16d[_0x739c('0x2b')](')'));_0x567ae7[_0x739c('0x42')]=_0x13711d;_0x3eeb47(_0x567ae7);})[_0x739c('0x11')](function(_0x36eb49){_0x480d22(_0x36eb49['message']);});});}function emit(_0x195680,_0x25b22a,_0x24ffe7,_0x396dfa){var _0x4174a4={'uri':util[_0x739c('0x43')](_0x739c('0x44'),_0x195680,_0x24ffe7,_0x396dfa)};io['to'](util[_0x739c('0x43')](_0x739c('0x45'),_0x25b22a))[_0x739c('0x46')](_0x739c('0x47'),_0x4174a4);}exports['cs']=function(_0x46c250,_0x4595e9,_0x42d6f3,_0x25c9fe,_0x4f1e61,_0x283908,_0x28ca96,_0x4da7f3){var _0xef8406={};_0x283908[_0x739c('0x48')]=intUtil[_0x739c('0x49')](_0x283908[_0x739c('0x48')]);_0x283908[_0x739c('0x4a')]=intUtil[_0x739c('0x49')](_0x283908[_0x739c('0x4a')]);_0xef8406[_0x739c('0x3f')]=_0x4da7f3===_0x739c('0x40')||_0x4da7f3===_0x739c('0x4b')?'queue':_0x739c('0x4c');var _0x3b6b79=util[_0x739c('0x43')](_0x739c('0x4d'),_0x283908[_0x739c('0x48')]);var _0x3317c3=util[_0x739c('0x43')](_0x739c('0x4e'),_0x283908[_0x739c('0x4f')]);var _0x11452e=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x283908[_0x739c('0x4a')],_0x4595e9[_0x739c('0x50')],md5(_0x4595e9[_0x739c('0x50')]));if(_0x4f1e61&&_0x4f1e61[_0x739c('0x51')]){logger[_0x739c('0x1d')](_0x739c('0x52'),_0x739c('0x53'));_0x4595e9[_0x739c('0x54')]=_0x11452e;}else if(_0x28ca96&&_0x28ca96[_0x739c('0x55')]&&_0x28ca96[_0x739c('0x55')]!==_0x739c('0x56')){logger[_0x739c('0x1d')](_0x739c('0x57'),_0x739c('0x53'));_0x4595e9['recordingURL']=_0x11452e;}else{_0x4595e9[_0x739c('0x54')]='';}return getUser(_0xef8406,_0x283908,_0x25c9fe,_0x3317c3,_0x3b6b79,_0x4da7f3)[_0x739c('0xf')](function(_0x32e85d){logger[_0x739c('0x1d')]('['+_0x4da7f3['toUpperCase']()+_0x739c('0x58'),_0x32e85d[_0x739c('0x22')]);logger[_0x739c('0x1d')]('['+_0x4da7f3['toUpperCase']()+_0x739c('0x59'),_0x32e85d[_0x739c('0x1b')]);return getEndUser(_0x32e85d,_0x283908,_0x3317c3,_0x3b6b79,_0x4595e9,_0x4da7f3);})[_0x739c('0xf')](function(_0x127d33){logger[_0x739c('0x1d')]('['+_0x4da7f3[_0x739c('0x13')]()+_0x739c('0x5a'),_0x127d33[_0x739c('0x2c')]);logger[_0x739c('0x1d')]('['+_0x4da7f3[_0x739c('0x13')]()+_0x739c('0x5b'),_0x4595e9[_0x739c('0x25')]);return getTicket(_0x127d33,_0x283908,_0x3317c3,_0x3b6b79,_0x4595e9,_0x42d6f3,_0x4da7f3);})[_0x739c('0xf')](function(_0xf89f0f){logger[_0x739c('0x1d')](util['format']('['+_0x4da7f3[_0x739c('0x13')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x42d6f3['ticketType'],_0xf89f0f[_0x739c('0x42')]));logger[_0x739c('0x1d')](util[_0x739c('0x43')]('['+_0x4da7f3[_0x739c('0x13')]()+_0x739c('0x5c'),_0x4da7f3));if(_0x4da7f3!==_0x739c('0x4b')){logger[_0x739c('0x1d')]('['+_0x4da7f3[_0x739c('0x13')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x283908[_0x739c('0x48')],_0x25c9fe[_0x739c('0x5d')],_0x42d6f3[_0x739c('0x38')],_0xf89f0f[_0x739c('0x42')]);}})[_0x739c('0x11')](function(_0x3737d8){logger[_0x739c('0x12')]('['+_0x4da7f3[_0x739c('0x13')]()+_0x739c('0x5e'),util['inspect'](_0x3737d8,{'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 9935921..65673b4 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 _0xe67d=['format','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]','stringify','defaults','map','includes','string','type','nameField','customField','toLowerCase','content','picklist','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','unmanaged','toUpperCase','lodash','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','remoteUri','POST','then','info'];(function(_0x5b12c3,_0x81ec42){var _0x3b00a5=function(_0x2ce97d){while(--_0x2ce97d){_0x5b12c3['push'](_0x5b12c3['shift']());}};_0x3b00a5(++_0x81ec42);}(_0xe67d,0x1af));var _0xde67=function(_0x5f13cd,_0x3daaf8){_0x5f13cd=_0x5f13cd-0x0;var _0x827cb7=_0xe67d[_0x5f13cd];return _0x827cb7;};'use strict';var _=require(_0xde67('0x0'));var rp=require(_0xde67('0x1'));var md5=require(_0xde67('0x2'));var util=require('util');var Redis=require(_0xde67('0x3'));var intUtil=require('./util');var config=require(_0xde67('0x4'));var logger=require(_0xde67('0x5'))(_0xde67('0x6'));config[_0xde67('0x7')]=_['defaults'](config[_0xde67('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xde67('0x8'))(new Redis(config['redis']));var headers={'Content-Type':_0xde67('0x9'),'Accept':_0xde67('0x9')};function emit(_0x337429,_0x49d0ee,_0x454d96){io['to'](_0x337429)[_0xde67('0xa')](_0x49d0ee,_0x454d96);}function getTicket(_0x3bdd87,_0x562d04,_0x45767c,_0x1f67b8,_0x2b8efb){logger['info'](_0xde67('0xb'));var _0x265098=_[_0xde67('0xc')]({'responder_id':_0x562d04['id'],'requester_id':_0x45767c['id'],'name':util['format'](_0xde67('0xd'),_0x2b8efb[_0xde67('0xe')]),'phone':_0x2b8efb[_0xde67('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xde67('0x10')](_0x1f67b8['Subjects'],_0x2b8efb,'\x20'),'description':intUtil['getString'](_0x1f67b8[_0xde67('0x11')],_0x2b8efb,_0xde67('0x12')),'tags':getTags(_0x1f67b8['Tags'],_0xde67('0x13'))},getCustomFields(_0x1f67b8[_0xde67('0x14')],_0x2b8efb));_0x265098[_0xde67('0x15')]=_[_0xde67('0x16')](_[_0xde67('0x17')](_0x265098[_0xde67('0x15')],'id'),'value');return request({'uri':util['format'](_0xde67('0x18'),_0x3bdd87[_0xde67('0x19')]),'method':_0xde67('0x1a'),'body':_0x265098})[_0xde67('0x1b')](function(_0x59ee95){logger[_0xde67('0x1c')]('Ticket\x20created!');return _0x59ee95;});}function getUser(_0x3503b7,_0x1f24fb){if(intUtil['validateEmail'](_0x1f24fb)){return request({'uri':util[_0xde67('0x1d')](_0xde67('0x1e'),_0x3503b7[_0xde67('0x19')]),'qs':{'email':_0x1f24fb}})[_0xde67('0x1b')](function(_0x1fc0bc){if(_0x1fc0bc[_0xde67('0x1f')]){logger['info'](_0xde67('0x20'));return _[_0xde67('0x21')](_0x1fc0bc,function(_0x5c50a3){return _0x5c50a3[_0xde67('0x22')][_0xde67('0x23')]===_0x1f24fb;});}else{logger[_0xde67('0x1c')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xde67('0x1d')](_0xde67('0x24'),_0x3503b7[_0xde67('0x19')])})[_0xde67('0x1b')](function(_0xfff2d8){logger[_0xde67('0x1c')](_0xde67('0x25'));return _0xfff2d8;});}});}else{logger[_0xde67('0x1c')](_0xde67('0x26'));return request({'uri':util[_0xde67('0x1d')](_0xde67('0x24'),_0x3503b7['remoteUri'])})['then'](function(_0x47f7d5){logger[_0xde67('0x1c')]('Admin\x20account\x20selected.');return _0x47f7d5;});}}function getEndUser(_0xdc3458,_0x843959,_0x1b3898){logger['info'](_0xde67('0x27'),_0x1b3898);return request({'uri':util[_0xde67('0x1d')](_0xde67('0x28'),_0xdc3458[_0xde67('0x19')]),'qs':{'phone':_0x1b3898}})[_0xde67('0x1b')](function(_0x39a535){if(_0x39a535[_0xde67('0x1f')]){logger[_0xde67('0x1c')](_0xde67('0x29'));return _['find'](_0x39a535,{'phone':_0x1b3898});}else{logger[_0xde67('0x1c')](_0xde67('0x2a'));return request({'uri':util['format'](_0xde67('0x28'),_0xdc3458[_0xde67('0x19')]),'method':_0xde67('0x1a'),'body':{'name':_0x843959,'phone':_0x1b3898}})[_0xde67('0x1b')](function(_0xf1429c){logger[_0xde67('0x1c')](_0xde67('0x2b'));return _0xf1429c;});}});}function getAuth(_0x558fda){return util[_0xde67('0x1d')]('Basic\x20%s',new Buffer(_0x558fda[_0xde67('0x2c')]+':X')[_0xde67('0x2d')](_0xde67('0x2e')));}function request(_0x26acff){logger[_0xde67('0x2f')](_0xde67('0x30'),JSON[_0xde67('0x31')](_0x26acff));return rp(_[_0xde67('0x32')](_0x26acff,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x42c88a,_0x383d14){var _0x96fea4=[];if(_0x42c88a&&_0x42c88a['length']>0x0){_0x96fea4=_[_0xde67('0x33')](_0x42c88a,_0x383d14);}return _0x96fea4;}function getCustomFields(_0x5e4162,_0x537ca){var _0x49ce4a=[];var _0x2f47b2={'custom_fields':[]};if(_0x5e4162[_0xde67('0x1f')]>0x0){_['forEach'](_0x5e4162,function(_0x1ce822){if(_[_0xde67('0x34')]([_0xde67('0x35'),'picklist'],_0x1ce822[_0xde67('0x36')])&&_0x1ce822[_0xde67('0x37')]&&!_0x1ce822[_0xde67('0x38')]){_0x2f47b2[_0x1ce822[_0xde67('0x37')][_0xde67('0x39')]()]=_0x1ce822[_0xde67('0x3a')][_0xde67('0x2d')]();}else if(_['includes']([_0xde67('0x35'),_0xde67('0x3b')],_0x1ce822[_0xde67('0x36')])&&_0x1ce822[_0xde67('0x3c')]&&_0x1ce822[_0xde67('0x38')]){_0x2f47b2[_0xde67('0x15')][_0xde67('0x3d')]({'id':_0x1ce822[_0xde67('0x3c')],'value':_0x1ce822[_0xde67('0x3a')]['toString']()});}else if(_0x1ce822[_0xde67('0x36')]===_0xde67('0x3e')&&_0x1ce822[_0xde67('0x3f')]&&_0x1ce822[_0xde67('0x3c')]&&_0x1ce822[_0xde67('0x38')]){_0x537ca[_0x1ce822['variableName']]&&_0x2f47b2[_0xde67('0x15')][_0xde67('0x3d')]({'id':_0x1ce822[_0xde67('0x3c')],'value':_0x537ca[_0x1ce822[_0xde67('0x3f')]][_0xde67('0x2d')]()});}else if(_0x1ce822[_0xde67('0x36')]===_0xde67('0x40')&&_0x1ce822[_0xde67('0x41')]&&_0x1ce822[_0xde67('0x41')][_0xde67('0x13')]&&_0x1ce822[_0xde67('0x3c')]&&_0x1ce822[_0xde67('0x38')]){_0x537ca[_0x1ce822[_0xde67('0x41')][_0xde67('0x13')][_0xde67('0x39')]()]&&_0x2f47b2['custom_fields']['push']({'id':_0x1ce822['idField'],'value':_0x537ca[_0x1ce822['Variable'][_0xde67('0x13')][_0xde67('0x39')]()]['toString']()});}});}return _0x2f47b2;}exports[_0xde67('0x42')]=function(_0x412754,_0x14ae70,_0x7da902,_0x54746d,_0x1d83cf,_0x2f56da){var _0x41c441,_0x142e5a;_0x2f56da[_0xde67('0x19')]=intUtil[_0xde67('0x43')](_0x2f56da[_0xde67('0x19')]);_0x2f56da[_0xde67('0x44')]=intUtil[_0xde67('0x43')](_0x2f56da[_0xde67('0x44')]);if(_0x1d83cf&&_0x1d83cf[_0xde67('0x45')]){logger[_0xde67('0x1c')](_0xde67('0x46'),'Recording\x20is\x20enabled!');_0x14ae70[_0xde67('0x47')]=util[_0xde67('0x1d')](_0xde67('0x48'),_0x2f56da[_0xde67('0x44')],_0x14ae70['uniqueid'],md5(_0x14ae70[_0xde67('0x49')]));}else{_0x14ae70['recordingURL']='';}headers[_0xde67('0x4a')]=getAuth(_0x2f56da);return getUser(_0x2f56da,_0x54746d[_0xde67('0x23')])[_0xde67('0x1b')](function(_0x289825){_0x41c441=_0x289825;logger[_0xde67('0x1c')](_0xde67('0x4b'),_0x41c441['id']);return getEndUser(_0x2f56da,_0x14ae70[_0xde67('0xe')],_0x14ae70['calleridnum']);})[_0xde67('0x1b')](function(_0x4adede){_0x142e5a=_0x4adede;logger[_0xde67('0x1c')](_0xde67('0x4c'),_0x142e5a['id']);return getTicket(_0x2f56da,_0x41c441,_0x142e5a,_0x7da902,_0x14ae70);})[_0xde67('0x1b')](function(_0x2f7333){if(_0x2f7333&&_0x2f7333['id']){logger['info'](_0xde67('0x4d'));logger['info'](_0xde67('0x4e'),_0x2f7333['id']);logger[_0xde67('0x1c')](_0xde67('0x46'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xde67('0x1d')](_0xde67('0x4f'),_0x54746d['name']),_0xde67('0x50'),{'uri':util[_0xde67('0x1d')](_0xde67('0x51'),_0x2f56da[_0xde67('0x19')],_0x2f7333['id'])});}})[_0xde67('0x52')](function(_0x3fcc83){logger[_0xde67('0x53')](_0xde67('0x46'),JSON[_0xde67('0x31')](_0x3fcc83));});};exports[_0xde67('0x54')]=function(_0xba2cb5,_0x320b84,_0x31d91c,_0x17dae7,_0xe5fcb2,_0x53eaad,_0x32237c){var _0x431e31,_0x172ba6;_0x53eaad[_0xde67('0x19')]=intUtil[_0xde67('0x43')](_0x53eaad[_0xde67('0x19')]);_0x53eaad[_0xde67('0x44')]=intUtil[_0xde67('0x43')](_0x53eaad[_0xde67('0x44')]);if(_0x32237c&&_0x32237c['recordingFormat']&&_0x32237c['recordingFormat']!==_0xde67('0x55')){logger[_0xde67('0x1c')](_0xde67('0x56'),_0xde67('0x57'));_0x320b84[_0xde67('0x47')]=util[_0xde67('0x1d')](_0xde67('0x48'),_0x53eaad['serverUrl'],_0x320b84['uniqueid'],md5(_0x320b84[_0xde67('0x49')]));}headers['Authorization']=getAuth(_0x53eaad);return getUser(_0x53eaad,_0x17dae7[_0xde67('0x23')])[_0xde67('0x1b')](function(_0x35697a){_0x431e31=_0x35697a;logger[_0xde67('0x1c')](_0xde67('0x4b'),_0x431e31['id']);return getEndUser(_0x53eaad,_0x320b84[_0xde67('0x58')],_0x320b84[_0xde67('0x59')]);})['then'](function(_0x348778){_0x172ba6=_0x348778;logger['info']('The\x20Enduser\x20ID\x20is:',_0x172ba6['id']);return getTicket(_0x53eaad,_0x431e31,_0x172ba6,_0x31d91c,_0x320b84);})[_0xde67('0x1b')](function(_0x36201e){if(_0x36201e&&_0x36201e['id']){logger[_0xde67('0x1c')](_0xde67('0x4d'));logger[_0xde67('0x1c')](_0xde67('0x4e'),_0x36201e['id']);logger[_0xde67('0x1c')](_0xde67('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xde67('0x1d')](_0xde67('0x4f'),_0x17dae7[_0xde67('0x13')]),_0xde67('0x50'),{'uri':util[_0xde67('0x1d')]('%s/helpdesk/tickets/%d',_0x53eaad[_0xde67('0x19')],_0x36201e['id'])});}})[_0xde67('0x52')](function(_0x5a4525){logger[_0xde67('0x53')]('[OUTBOUND]',JSON[_0xde67('0x31')](_0x5a4525));});};exports[_0xde67('0x5a')]=function(_0x32a3d9,_0x4962bf,_0x1239da,_0x2dd170,_0x55987c,_0x4b5f91){var _0x246cc1,_0x425554;_0x4b5f91['remoteUri']=intUtil[_0xde67('0x43')](_0x4b5f91['remoteUri']);_0x4b5f91['serverUrl']=intUtil[_0xde67('0x43')](_0x4b5f91[_0xde67('0x44')]);if(_0x55987c&&_0x55987c[_0xde67('0x45')]){logger[_0xde67('0x1c')]('['+_0x4962bf['lastevent'][_0xde67('0x5b')]()+']',_0xde67('0x57'));_0x4962bf[_0xde67('0x47')]=util[_0xde67('0x1d')](_0xde67('0x48'),_0x4b5f91['serverUrl'],_0x4962bf[_0xde67('0x49')],md5(_0x4962bf[_0xde67('0x49')]));}else{_0x4962bf[_0xde67('0x47')]='';}headers['Authorization']=getAuth(_0x4b5f91);return getUser(_0x4b5f91,'')[_0xde67('0x1b')](function(_0x24f7b2){_0x246cc1=_0x24f7b2;logger[_0xde67('0x1c')](_0xde67('0x4b'),_0x246cc1['id']);return getEndUser(_0x4b5f91,_0x4962bf[_0xde67('0xe')],_0x4962bf[_0xde67('0xf')]);})['then'](function(_0x1838c3){_0x425554=_0x1838c3;logger[_0xde67('0x1c')]('The\x20Enduser\x20ID\x20is:',_0x425554['id']);return getTicket(_0x4b5f91,_0x246cc1,_0x425554,_0x1239da,_0x4962bf);})['then'](function(_0x2c54a6){if(_0x2c54a6){logger[_0xde67('0x1c')](_0xde67('0x4d'));logger[_0xde67('0x1c')]('The\x20Ticket\x20ID\x20is:',_0x2c54a6['id']);}})[_0xde67('0x52')](function(_0x57aaf0){logger[_0xde67('0x53')]('['+_0x4962bf['lastevent']['toUpperCase']()+']',JSON[_0xde67('0x31')](_0x57aaf0));});}; \ No newline at end of file +var _0x6124=['content','variable','variableName','customVariable','Variable','name','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Descriptions','
','Tags','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','stringify','GET','map','forEach','includes','string','picklist','customField','toLowerCase','toString','type','idField','push'];(function(_0x2047de,_0x2d899f){var _0x3da48c=function(_0x28a91e){while(--_0x28a91e){_0x2047de['push'](_0x2047de['shift']());}};_0x3da48c(++_0x2d899f);}(_0x6124,0x140));var _0x4612=function(_0x257afc,_0x4b42ac){_0x257afc=_0x257afc-0x0;var _0xb2f2a4=_0x6124[_0x257afc];return _0xb2f2a4;};'use strict';var _=require(_0x4612('0x0'));var rp=require(_0x4612('0x1'));var md5=require(_0x4612('0x2'));var util=require('util');var Redis=require(_0x4612('0x3'));var intUtil=require(_0x4612('0x4'));var config=require(_0x4612('0x5'));var logger=require(_0x4612('0x6'))(_0x4612('0x7'));config[_0x4612('0x8')]=_[_0x4612('0x9')](config['redis'],{'host':_0x4612('0xa'),'port':0x18eb});var io=require(_0x4612('0xb'))(new Redis(config[_0x4612('0x8')]));var headers={'Content-Type':_0x4612('0xc'),'Accept':'application/json'};function emit(_0x151178,_0x3de0c8,_0x3e8eb8){io['to'](_0x151178)[_0x4612('0xd')](_0x3de0c8,_0x3e8eb8);}function getTicket(_0x332280,_0x1b37a5,_0x1ce67b,_0x13fddb,_0xfbd14a){logger[_0x4612('0xe')](_0x4612('0xf'));var _0x78ad4b=_[_0x4612('0x10')]({'responder_id':_0x1b37a5['id'],'requester_id':_0x1ce67b['id'],'name':util[_0x4612('0x11')](_0x4612('0x12'),_0xfbd14a[_0x4612('0x13')]),'phone':_0xfbd14a[_0x4612('0x14')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x13fddb[_0x4612('0x15')],_0xfbd14a,'\x20'),'description':intUtil[_0x4612('0x16')](_0x13fddb[_0x4612('0x17')],_0xfbd14a,_0x4612('0x18')),'tags':getTags(_0x13fddb[_0x4612('0x19')],'name')},getCustomFields(_0x13fddb['Fields'],_0xfbd14a));_0x78ad4b[_0x4612('0x1a')]=_['mapValues'](_['keyBy'](_0x78ad4b[_0x4612('0x1a')],'id'),_0x4612('0x1b'));return request({'uri':util[_0x4612('0x11')](_0x4612('0x1c'),_0x332280[_0x4612('0x1d')]),'method':_0x4612('0x1e'),'body':_0x78ad4b})[_0x4612('0x1f')](function(_0xe4b478){logger[_0x4612('0xe')](_0x4612('0x20'));return _0xe4b478;});}function getUser(_0x2f8990,_0x1b4358){if(intUtil[_0x4612('0x21')](_0x1b4358)){return request({'uri':util[_0x4612('0x11')](_0x4612('0x22'),_0x2f8990['remoteUri']),'qs':{'email':_0x1b4358}})[_0x4612('0x1f')](function(_0x1c3b97){if(_0x1c3b97[_0x4612('0x23')]){logger[_0x4612('0xe')](_0x4612('0x24'));return _[_0x4612('0x25')](_0x1c3b97,function(_0x3ca7cd){return _0x3ca7cd[_0x4612('0x26')][_0x4612('0x27')]===_0x1b4358;});}else{logger[_0x4612('0xe')](_0x4612('0x28'));return request({'uri':util[_0x4612('0x11')]('%s/api/v2/agents/me',_0x2f8990[_0x4612('0x1d')])})[_0x4612('0x1f')](function(_0x49003f){logger['info'](_0x4612('0x29'));return _0x49003f;});}});}else{logger[_0x4612('0xe')](_0x4612('0x2a'));return request({'uri':util[_0x4612('0x11')](_0x4612('0x2b'),_0x2f8990[_0x4612('0x1d')])})[_0x4612('0x1f')](function(_0x2bf8e8){logger[_0x4612('0xe')](_0x4612('0x29'));return _0x2bf8e8;});}}function getEndUser(_0x451c05,_0x5baa9b,_0x230110){logger[_0x4612('0xe')](_0x4612('0x2c'),_0x230110);return request({'uri':util[_0x4612('0x11')]('%s/api/v2/contacts',_0x451c05['remoteUri']),'qs':{'phone':_0x230110}})[_0x4612('0x1f')](function(_0x15e370){if(_0x15e370['length']){logger[_0x4612('0xe')](_0x4612('0x2d'));return _[_0x4612('0x25')](_0x15e370,{'phone':_0x230110});}else{logger[_0x4612('0xe')](_0x4612('0x2e'));return request({'uri':util[_0x4612('0x11')](_0x4612('0x2f'),_0x451c05[_0x4612('0x1d')]),'method':_0x4612('0x1e'),'body':{'name':_0x5baa9b,'phone':_0x230110}})[_0x4612('0x1f')](function(_0x5af8d2){logger[_0x4612('0xe')](_0x4612('0x30'));return _0x5af8d2;});}});}function getAuth(_0x12843c){return util['format'](_0x4612('0x31'),new Buffer(_0x12843c[_0x4612('0x32')]+':X')['toString']('base64'));}function request(_0x2ae261){logger['debug']('[HTTP]',JSON[_0x4612('0x33')](_0x2ae261));return rp(_[_0x4612('0x9')](_0x2ae261,{'method':_0x4612('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x4645e7,_0x5e3f86){var _0x4864d5=[];if(_0x4645e7&&_0x4645e7[_0x4612('0x23')]>0x0){_0x4864d5=_[_0x4612('0x35')](_0x4645e7,_0x5e3f86);}return _0x4864d5;}function getCustomFields(_0x494ecf,_0x1f751a){var _0x10e32c=[];var _0x41058={'custom_fields':[]};if(_0x494ecf[_0x4612('0x23')]>0x0){_[_0x4612('0x36')](_0x494ecf,function(_0x49f43e){if(_[_0x4612('0x37')]([_0x4612('0x38'),_0x4612('0x39')],_0x49f43e['type'])&&_0x49f43e['nameField']&&!_0x49f43e[_0x4612('0x3a')]){_0x41058[_0x49f43e['nameField'][_0x4612('0x3b')]()]=_0x49f43e['content'][_0x4612('0x3c')]();}else if(_[_0x4612('0x37')]([_0x4612('0x38'),_0x4612('0x39')],_0x49f43e[_0x4612('0x3d')])&&_0x49f43e[_0x4612('0x3e')]&&_0x49f43e[_0x4612('0x3a')]){_0x41058[_0x4612('0x1a')][_0x4612('0x3f')]({'id':_0x49f43e[_0x4612('0x3e')],'value':_0x49f43e[_0x4612('0x40')][_0x4612('0x3c')]()});}else if(_0x49f43e['type']===_0x4612('0x41')&&_0x49f43e[_0x4612('0x42')]&&_0x49f43e[_0x4612('0x3e')]&&_0x49f43e['customField']){_0x1f751a[_0x49f43e[_0x4612('0x42')]]&&_0x41058[_0x4612('0x1a')][_0x4612('0x3f')]({'id':_0x49f43e['idField'],'value':_0x1f751a[_0x49f43e[_0x4612('0x42')]][_0x4612('0x3c')]()});}else if(_0x49f43e['type']===_0x4612('0x43')&&_0x49f43e[_0x4612('0x44')]&&_0x49f43e[_0x4612('0x44')][_0x4612('0x45')]&&_0x49f43e['idField']&&_0x49f43e[_0x4612('0x3a')]){_0x1f751a[_0x49f43e[_0x4612('0x44')][_0x4612('0x45')]['toLowerCase']()]&&_0x41058['custom_fields'][_0x4612('0x3f')]({'id':_0x49f43e['idField'],'value':_0x1f751a[_0x49f43e[_0x4612('0x44')][_0x4612('0x45')][_0x4612('0x3b')]()][_0x4612('0x3c')]()});}});}return _0x41058;}exports['queue']=function(_0xa19986,_0x378592,_0x5c81e2,_0x2eb81d,_0x4c5e7e,_0x2c452f){var _0x5c7004,_0x40c5c0;_0x2c452f[_0x4612('0x1d')]=intUtil[_0x4612('0x46')](_0x2c452f[_0x4612('0x1d')]);_0x2c452f[_0x4612('0x47')]=intUtil[_0x4612('0x46')](_0x2c452f[_0x4612('0x47')]);if(_0x4c5e7e&&_0x4c5e7e[_0x4612('0x48')]){logger['info'](_0x4612('0x49'),_0x4612('0x4a'));_0x378592[_0x4612('0x4b')]=util[_0x4612('0x11')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2c452f[_0x4612('0x47')],_0x378592[_0x4612('0x4c')],md5(_0x378592[_0x4612('0x4c')]));}else{_0x378592['recordingURL']='';}headers[_0x4612('0x4d')]=getAuth(_0x2c452f);return getUser(_0x2c452f,_0x2eb81d[_0x4612('0x27')])[_0x4612('0x1f')](function(_0x31b94d){_0x5c7004=_0x31b94d;logger[_0x4612('0xe')](_0x4612('0x4e'),_0x5c7004['id']);return getEndUser(_0x2c452f,_0x378592[_0x4612('0x13')],_0x378592[_0x4612('0x14')]);})[_0x4612('0x1f')](function(_0x2f3190){_0x40c5c0=_0x2f3190;logger['info'](_0x4612('0x4f'),_0x40c5c0['id']);return getTicket(_0x2c452f,_0x5c7004,_0x40c5c0,_0x5c81e2,_0x378592);})[_0x4612('0x1f')](function(_0x2d3a03){if(_0x2d3a03&&_0x2d3a03['id']){logger[_0x4612('0xe')](_0x4612('0x20'));logger['info'](_0x4612('0x50'),_0x2d3a03['id']);logger[_0x4612('0xe')](_0x4612('0x49'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x4612('0x51'),_0x2eb81d['name']),_0x4612('0x52'),{'uri':util['format'](_0x4612('0x53'),_0x2c452f['remoteUri'],_0x2d3a03['id'])});}})[_0x4612('0x54')](function(_0xba8cdd){logger[_0x4612('0x55')](_0x4612('0x49'),JSON[_0x4612('0x33')](_0xba8cdd));});};exports[_0x4612('0x56')]=function(_0xdcf806,_0x9fe27a,_0x4088f7,_0x1870ae,_0x40da0f,_0x4f4440,_0x2a116a){var _0x2c822f,_0x25e833;_0x4f4440[_0x4612('0x1d')]=intUtil[_0x4612('0x46')](_0x4f4440['remoteUri']);_0x4f4440[_0x4612('0x47')]=intUtil[_0x4612('0x46')](_0x4f4440[_0x4612('0x47')]);if(_0x2a116a&&_0x2a116a[_0x4612('0x57')]&&_0x2a116a[_0x4612('0x57')]!==_0x4612('0x58')){logger[_0x4612('0xe')]('[OUTBOUND]',_0x4612('0x4a'));_0x9fe27a['recordingURL']=util[_0x4612('0x11')](_0x4612('0x59'),_0x4f4440['serverUrl'],_0x9fe27a[_0x4612('0x4c')],md5(_0x9fe27a['uniqueid']));}headers[_0x4612('0x4d')]=getAuth(_0x4f4440);return getUser(_0x4f4440,_0x1870ae['email'])[_0x4612('0x1f')](function(_0x440be6){_0x2c822f=_0x440be6;logger[_0x4612('0xe')](_0x4612('0x4e'),_0x2c822f['id']);return getEndUser(_0x4f4440,_0x9fe27a['destcalleridname'],_0x9fe27a[_0x4612('0x5a')]);})[_0x4612('0x1f')](function(_0xd52669){_0x25e833=_0xd52669;logger[_0x4612('0xe')](_0x4612('0x4f'),_0x25e833['id']);return getTicket(_0x4f4440,_0x2c822f,_0x25e833,_0x4088f7,_0x9fe27a);})[_0x4612('0x1f')](function(_0x41746e){if(_0x41746e&&_0x41746e['id']){logger[_0x4612('0xe')](_0x4612('0x20'));logger[_0x4612('0xe')](_0x4612('0x50'),_0x41746e['id']);logger[_0x4612('0xe')]('[OUTBOUND]',_0x4612('0x5b'));emit(util[_0x4612('0x11')](_0x4612('0x51'),_0x1870ae[_0x4612('0x45')]),_0x4612('0x52'),{'uri':util['format'](_0x4612('0x53'),_0x4f4440[_0x4612('0x1d')],_0x41746e['id'])});}})[_0x4612('0x54')](function(_0x52e40a){logger[_0x4612('0x55')](_0x4612('0x5c'),JSON[_0x4612('0x33')](_0x52e40a));});};exports[_0x4612('0x5d')]=function(_0x211d5c,_0x2cd9fe,_0x4c1679,_0x241d19,_0x35a8b6,_0x4de189){var _0x4ff84e,_0x57c46e;_0x4de189['remoteUri']=intUtil['stripTrailingSlash'](_0x4de189[_0x4612('0x1d')]);_0x4de189[_0x4612('0x47')]=intUtil[_0x4612('0x46')](_0x4de189[_0x4612('0x47')]);if(_0x35a8b6&&_0x35a8b6[_0x4612('0x48')]){logger[_0x4612('0xe')]('['+_0x2cd9fe[_0x4612('0x5e')][_0x4612('0x5f')]()+']',_0x4612('0x4a'));_0x2cd9fe['recordingURL']=util[_0x4612('0x11')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4de189['serverUrl'],_0x2cd9fe[_0x4612('0x4c')],md5(_0x2cd9fe[_0x4612('0x4c')]));}else{_0x2cd9fe[_0x4612('0x4b')]='';}headers[_0x4612('0x4d')]=getAuth(_0x4de189);return getUser(_0x4de189,'')[_0x4612('0x1f')](function(_0x472ebf){_0x4ff84e=_0x472ebf;logger[_0x4612('0xe')](_0x4612('0x4e'),_0x4ff84e['id']);return getEndUser(_0x4de189,_0x2cd9fe['calleridname'],_0x2cd9fe['calleridnum']);})['then'](function(_0x3bef9f){_0x57c46e=_0x3bef9f;logger['info'](_0x4612('0x4f'),_0x57c46e['id']);return getTicket(_0x4de189,_0x4ff84e,_0x57c46e,_0x4c1679,_0x2cd9fe);})[_0x4612('0x1f')](function(_0xb43f8a){if(_0xb43f8a){logger['info'](_0x4612('0x20'));logger[_0x4612('0xe')](_0x4612('0x50'),_0xb43f8a['id']);}})[_0x4612('0x54')](function(_0x899282){logger[_0x4612('0x55')]('['+_0x2cd9fe['lastevent'][_0x4612('0x5f')]()+']',JSON[_0x4612('0x33')](_0x899282));});}; \ 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 cbea7ae..eb4b9cf 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 _0x0e17=['endUserId','Contact\x20found\x20mobile_number:','work_number','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Subjects','Descriptions','format','add','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','ticketId','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','/api/selector/owners','headers','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','userId','Admin\x20selected','catch','&f=','find','Searching\x20contact\x20with\x20phone\x20%s','contactNumber'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0e17,0xd6));var _0x70e1=function(_0xb03201,_0x54db21){_0xb03201=_0xb03201-0x0;var _0x399746=_0x0e17[_0xb03201];return _0x399746;};'use strict';var _=require(_0x70e1('0x0'));var rp=require(_0x70e1('0x1'));var md5=require(_0x70e1('0x2'));var util=require(_0x70e1('0x3'));var moment=require(_0x70e1('0x4'));var Promise=require(_0x70e1('0x5'));var Redis=require(_0x70e1('0x6'));var intUtil=require(_0x70e1('0x7'));var config=require(_0x70e1('0x8'));var logger=require(_0x70e1('0x9'))(_0x70e1('0xa'));config[_0x70e1('0xb')]=_['defaults'](config[_0x70e1('0xb')],{'host':_0x70e1('0xc'),'port':0x18eb});var io=require(_0x70e1('0xd'))(new Redis(config[_0x70e1('0xb')]));function getAdminId(_0x26218a,_0x2c45c3,_0x5ac686,_0x58d96a){return new Promise(function(_0xfe25b1,_0x4fc01f){var _0x17f39c=![];var _0x3ef3e1={'method':'GET','uri':_0x58d96a+_0x70e1('0xe'),'json':!![]};_0x3ef3e1[_0x70e1('0xf')]=_0x5ac686;logger['info'](_0x70e1('0x10'));return rp(_0x3ef3e1)['then'](function(_0x1ce904){if(_0x1ce904){var _0x5be96e=_0x1ce904[_0x70e1('0x11')];var _0xcf2748=null;for(_0xcf2748=0x0;_0xcf2748<_0x5be96e[_0x70e1('0x12')];_0xcf2748++){if(_0x5be96e[_0xcf2748][_0x70e1('0x13')]===_0x26218a[_0x70e1('0x14')]){_0x26218a[_0x70e1('0x15')]=_0x5be96e[_0xcf2748]['id'];_0x17f39c=!![];}}if(_0x17f39c){logger[_0x70e1('0x16')](_0x70e1('0x17'),_0x26218a[_0x70e1('0x15')]);_0xfe25b1(_0x26218a);}else{_0x4fc01f({'statusCode':0x194,'message':_0x70e1('0x18')});}}else{_0x4fc01f({'statusCode':0x194,'message':_0x70e1('0x18')});}})['catch'](function(_0x1f50aa){logger[_0x70e1('0x19')]('['+[_0x2c45c3[_0x70e1('0x1a')]()]+']',_0x1f50aa[_0x70e1('0x1b')]);_0x4fc01f(_0x1f50aa);});});}function getUser(_0x33e090,_0xc18a09,_0x3ed8a0){return function(_0x178441){return new Promise(function(_0x6b5d29,_0xa98e90){var _0x28ed4b={'method':'GET','uri':_0x3ed8a0+'/api/selector/owners','json':!![]};_0x28ed4b[_0x70e1('0xf')]=_0xc18a09;logger[_0x70e1('0x16')](_0x70e1('0x1c'));return rp(_0x28ed4b)[_0x70e1('0x1d')](function(_0xe86bd1){if(_0xe86bd1){var _0x2d9130=_0xe86bd1[_0x70e1('0x11')];var _0x17442e=![];var _0xdb1503=null;if(_0x178441[_0x70e1('0x1e')]!==null){logger[_0x70e1('0x16')](_0x70e1('0x1f'),_0x178441[_0x70e1('0x1e')]);_0x178441[_0x70e1('0x20')]=_0x178441[_0x70e1('0x1e')];for(_0xdb1503=0x0;_0xdb1503<_0x2d9130[_0x70e1('0x12')];_0xdb1503++){if(_0x2d9130[_0xdb1503]['email']===_0x178441[_0x70e1('0x1e')]){_0x17442e=!![];_0x178441['userId']=_0x2d9130[_0xdb1503]['id'];logger['info'](_0x70e1('0x21'),_0x178441[_0x70e1('0x22')]);}}}if(!_0x17442e){logger[_0x70e1('0x16')](_0x70e1('0x23'));_0x178441[_0x70e1('0x20')]=_0x178441[_0x70e1('0x14')];_0x178441['userId']=_0x178441[_0x70e1('0x15')];_0x17442e=!![];}if(_0x17442e){_0x6b5d29(_0x178441);}else{_0xa98e90({'statusCode':0x194,'message':_0x70e1('0x18')});}}else{_0xa98e90({'statusCode':0x194,'message':_0x70e1('0x18')});}})[_0x70e1('0x24')](function(_0x5b4ed0){logger[_0x70e1('0x19')]('['+[_0x33e090[_0x70e1('0x1a')]()]+']',_0x5b4ed0[_0x70e1('0x1b')]);_0xa98e90(_0x5b4ed0);});});};}function searchContact(_0x57ca4e,_0x1908fb,_0x2d8eb7,_0x3240af){return new Promise(function(_0x22a814,_0x40c316){var _0x33aab0={'method':'GET','headers':_0x1908fb,'uri':_0x57ca4e+'/api/lookup?q='+_0x3240af+_0x70e1('0x25')+_0x2d8eb7+'&entities=contact','json':!![]};rp(_0x33aab0)['then'](function(_0x1e84b0){var _0x3bf743=_[_0x70e1('0x26')](_0x1e84b0['contacts']['contacts'],[_0x2d8eb7,_0x3240af]);_0x22a814(_0x3bf743);})['catch'](function(_0x2fecb3){_0x40c316(_0x2fecb3);});});}function getEndUser(_0x401a06,_0x411bed,_0x3069fb){return function(_0x3679a7){return new Promise(function(_0x1dee15,_0x29e9b3){logger[_0x70e1('0x16')](util['format'](_0x70e1('0x27'),_0x3679a7[_0x70e1('0x28')]));searchContact(_0x3069fb,_0x411bed,'mobile_number',_0x3679a7[_0x70e1('0x28')])[_0x70e1('0x1d')](function(_0x3352ae){if(_0x3352ae){_0x3679a7[_0x70e1('0x29')]=_0x3352ae['id'];logger['info'](_0x70e1('0x2a'),_0x3679a7[_0x70e1('0x29')]);return _0x1dee15(_0x3679a7);}searchContact(_0x3069fb,_0x411bed,_0x70e1('0x2b'),_0x3679a7[_0x70e1('0x28')])[_0x70e1('0x1d')](function(_0x3ee7fb){if(_0x3ee7fb){_0x3679a7['endUserId']=_0x3ee7fb['id'];logger['info']('Contact\x20found\x20work_number:',_0x3679a7[_0x70e1('0x29')]);return _0x1dee15(_0x3679a7);}createEndUser(_0x3679a7,_0x401a06,_0x411bed,_0x3069fb)[_0x70e1('0x1d')](function(_0x22dc73){logger['info']('Contact\x20created:',_0x22dc73[_0x70e1('0x29')]);return _0x1dee15(_0x22dc73);});});})[_0x70e1('0x24')](function(_0x5223f1){_0x29e9b3(_0x5223f1);});});};}function createEndUser(_0x328a49,_0x1e0b3d,_0x45a665,_0x6aa261){return new Promise(function(_0x3de2de,_0x3cd5ac){var _0xf0db5b=moment();var _0x389c68={'method':'POST','uri':_0x6aa261+_0x70e1('0x2c'),'body':{'contact':{'last_name':_0x328a49[_0x70e1('0x28')],'work_number':_0x328a49['contactNumber'],'mobile_number':_0x328a49['contactNumber'],'owner_id':_0x328a49['userId'],'created_at':_0xf0db5b['format'](_0x70e1('0x2d'))}},'json':!![]};_0x389c68[_0x70e1('0xf')]=_0x45a665;logger[_0x70e1('0x16')](_0x70e1('0x2e'));return rp(_0x389c68)[_0x70e1('0x1d')](function(_0x427e0a){_0x328a49[_0x70e1('0x29')]=_0x427e0a[_0x70e1('0x2f')]['id'];_0x3de2de(_0x328a49);})[_0x70e1('0x24')](function(_0x94b47f){logger['error']('['+[_0x1e0b3d[_0x70e1('0x1a')]()]+']',_0x94b47f[_0x70e1('0x1b')]);_0x3cd5ac(_0x94b47f['message']);});});}function getTicket(_0x30d8a0,_0xdeffd1,_0x4bd6cc,_0x57c9ff,_0x1e71e3){return function(_0x4aa3c4){logger['info'](_0x70e1('0x30'));return new Promise(function(_0x5c903d,_0xbbb884){var _0x5429a5=moment();var _0x12f6a4={'method':'POST','uri':_0x4bd6cc+'/api/tasks','body':{'title':intUtil[_0x70e1('0x31')](_0x57c9ff[_0x70e1('0x32')],_0x1e71e3,'\x20'),'description':intUtil[_0x70e1('0x31')](_0x57c9ff[_0x70e1('0x33')],_0x1e71e3,'\x0a'),'owner_id':_0x4aa3c4[_0x70e1('0x22')],'creater_id':_0x4aa3c4[_0x70e1('0x15')],'targetable_id':_0x4aa3c4[_0x70e1('0x29')],'targetable_type':'Contact','created_at':_0x5429a5[_0x70e1('0x34')](_0x70e1('0x2d')),'due_date':_0x5429a5[_0x70e1('0x35')](0x1e,'m')[_0x70e1('0x34')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x12f6a4['headers']=_0xdeffd1;return rp(_0x12f6a4)[_0x70e1('0x1d')](function(_0x244090){_0x4aa3c4['ticketId']=_0x244090[_0x70e1('0x36')]['id'];logger['info'](_0x70e1('0x37'),_0x4aa3c4['ticketId']);_0x5c903d(_0x4aa3c4);})[_0x70e1('0x24')](function(_0x409e02){logger['error']('['+[_0x30d8a0[_0x70e1('0x1a')]()]+']',_0x409e02[_0x70e1('0x1b')]);_0xbbb884(_0x409e02['message']);});});};}function emit(_0x177f9d,_0x10adf7,_0x20c335){var _0x13325f={'uri':_0x177f9d+_0x70e1('0x38')+_0x20c335};io['to'](util['format'](_0x70e1('0x39'),_0x10adf7))[_0x70e1('0x3a')](_0x70e1('0x3b'),_0x13325f);}exports['cs']=function(_0x248b96,_0xdd7d43,_0x2794d7,_0x21897e,_0x2229ca,_0x253d71,_0x234ad9,_0x1e0410){var _0xf30d81={};var _0x3fa968={'Authorization':_0x70e1('0x3c')+_0x253d71[_0x70e1('0x3d')]};_0x253d71[_0x70e1('0x3e')]=intUtil[_0x70e1('0x3f')](_0x253d71[_0x70e1('0x3e')]);_0x253d71[_0x70e1('0x40')]=intUtil[_0x70e1('0x3f')](_0x253d71['serverUrl']);var _0x37095b=_0x253d71['remoteUri'];_0xf30d81[_0x70e1('0x14')]=_0x253d71[_0x70e1('0x41')];_0xf30d81[_0x70e1('0x28')]=_0x1e0410[_0x70e1('0x42')]()===_0x70e1('0x43')?_0xdd7d43[_0x70e1('0x44')]:_0xdd7d43[_0x70e1('0x45')];_0xf30d81['callDirection']=_0x1e0410===_0x70e1('0x46')||_0x1e0410==='unmanaged'?'queue':_0x70e1('0x43');if(_0x21897e){_0xf30d81[_0x70e1('0x1e')]=_0x21897e[_0x70e1('0x13')];}var _0x296349=util[_0x70e1('0x34')](_0x70e1('0x47'),_0x253d71['serverUrl'],_0xdd7d43[_0x70e1('0x48')],md5(_0xdd7d43[_0x70e1('0x48')]));if(_0x2229ca&&_0x2229ca[_0x70e1('0x49')]){logger[_0x70e1('0x16')](_0x70e1('0x4a'),_0x70e1('0x4b'));_0xdd7d43[_0x70e1('0x4c')]=_0x296349;}else if(_0x234ad9&&_0x234ad9[_0x70e1('0x4d')]&&_0x234ad9[_0x70e1('0x4d')]!==_0x70e1('0x4e')){logger[_0x70e1('0x16')](_0x70e1('0x4f'),_0x70e1('0x4b'));_0xdd7d43[_0x70e1('0x4c')]=_0x296349;}else{_0xdd7d43[_0x70e1('0x4c')]='';}return getAdminId(_0xf30d81,_0x1e0410,_0x3fa968,_0x37095b)['then'](getUser(_0x1e0410,_0x3fa968,_0x37095b))[_0x70e1('0x1d')](getEndUser(_0x1e0410,_0x3fa968,_0x37095b))[_0x70e1('0x1d')](getTicket(_0x1e0410,_0x3fa968,_0x37095b,_0x2794d7,_0xdd7d43))[_0x70e1('0x1d')](function(_0x4ab620){logger[_0x70e1('0x16')](util['format'](_0x70e1('0x50'),_0x4ab620[_0x70e1('0x51')]));if(_0x1e0410!=='unmanaged'){logger['info']('['+[_0x1e0410['toUpperCase']()]+']',_0x70e1('0x52'));emit(_0x37095b,_0x21897e['name'],_0x4ab620[_0x70e1('0x29')]);}})[_0x70e1('0x24')](function(_0x43dcc9){logger[_0x70e1('0x19')]('['+[_0x1e0410['toUpperCase']()]+_0x70e1('0x53'),util[_0x70e1('0x54')](_0x43dcc9,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6c84=['contact','/api/tasks','getString','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','md5','util','moment','ioredis','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','GET','users','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','adminEmail','error','/api/lookup?q=','&entities=contact','contacts','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact'];(function(_0x1940d2,_0x3d9737){var _0x3bb42e=function(_0x5bd0d1){while(--_0x5bd0d1){_0x1940d2['push'](_0x1940d2['shift']());}};_0x3bb42e(++_0x3d9737);}(_0x6c84,0x112));var _0x46c8=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x6c84[_0x173441];return _0x2423a8;};'use strict';var _=require(_0x46c8('0x0'));var rp=require(_0x46c8('0x1'));var md5=require(_0x46c8('0x2'));var util=require(_0x46c8('0x3'));var moment=require(_0x46c8('0x4'));var Promise=require('bluebird');var Redis=require(_0x46c8('0x5'));var intUtil=require('./util');var config=require(_0x46c8('0x6'));var logger=require('../../../../config/logger')('freshsales');config[_0x46c8('0x7')]=_[_0x46c8('0x8')](config[_0x46c8('0x7')],{'host':_0x46c8('0x9'),'port':0x18eb});var io=require(_0x46c8('0xa'))(new Redis(config[_0x46c8('0x7')]));function getAdminId(_0xfe26c8,_0x1727f4,_0x5c0684,_0x27c1a5){return new Promise(function(_0x561c61,_0x5a3cbf){var _0x527efe=![];var _0x1a56f0={'method':'GET','uri':_0x27c1a5+_0x46c8('0xb'),'json':!![]};_0x1a56f0[_0x46c8('0xc')]=_0x5c0684;logger[_0x46c8('0xd')](_0x46c8('0xe'));return rp(_0x1a56f0)[_0x46c8('0xf')](function(_0x2c336b){if(_0x2c336b){var _0x28cbca=_0x2c336b['users'];var _0x58c2c2=null;for(_0x58c2c2=0x0;_0x58c2c2<_0x28cbca['length'];_0x58c2c2++){if(_0x28cbca[_0x58c2c2][_0x46c8('0x10')]===_0xfe26c8['adminEmail']){_0xfe26c8[_0x46c8('0x11')]=_0x28cbca[_0x58c2c2]['id'];_0x527efe=!![];}}if(_0x527efe){logger[_0x46c8('0xd')](_0x46c8('0x12'),_0xfe26c8[_0x46c8('0x11')]);_0x561c61(_0xfe26c8);}else{_0x5a3cbf({'statusCode':0x194,'message':_0x46c8('0x13')});}}else{_0x5a3cbf({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x46c8('0x14')](function(_0x26ab24){logger['error']('['+[_0x1727f4[_0x46c8('0x15')]()]+']',_0x26ab24[_0x46c8('0x16')]);_0x5a3cbf(_0x26ab24);});});}function getUser(_0x5b7b2e,_0x488eb5,_0x2d24b2){return function(_0x255a0e){return new Promise(function(_0x29b28f,_0x2036be){var _0x21918f={'method':_0x46c8('0x17'),'uri':_0x2d24b2+_0x46c8('0xb'),'json':!![]};_0x21918f[_0x46c8('0xc')]=_0x488eb5;logger[_0x46c8('0xd')]('Getting\x20user\x20list');return rp(_0x21918f)[_0x46c8('0xf')](function(_0x7425f6){if(_0x7425f6){var _0x44b600=_0x7425f6[_0x46c8('0x18')];var _0x3d3c31=![];var _0x5af964=null;if(_0x255a0e[_0x46c8('0x19')]!==null){logger[_0x46c8('0xd')]('Getting\x20user\x20with\x20email',_0x255a0e['agentEmail']);_0x255a0e[_0x46c8('0x1a')]=_0x255a0e[_0x46c8('0x19')];for(_0x5af964=0x0;_0x5af964<_0x44b600['length'];_0x5af964++){if(_0x44b600[_0x5af964][_0x46c8('0x10')]===_0x255a0e['agentEmail']){_0x3d3c31=!![];_0x255a0e[_0x46c8('0x1b')]=_0x44b600[_0x5af964]['id'];logger[_0x46c8('0xd')](_0x46c8('0x1c'),_0x255a0e[_0x46c8('0x1b')]);}}}if(!_0x3d3c31){logger[_0x46c8('0xd')](_0x46c8('0x1d'));_0x255a0e[_0x46c8('0x1a')]=_0x255a0e[_0x46c8('0x1e')];_0x255a0e[_0x46c8('0x1b')]=_0x255a0e[_0x46c8('0x11')];_0x3d3c31=!![];}if(_0x3d3c31){_0x29b28f(_0x255a0e);}else{_0x2036be({'statusCode':0x194,'message':_0x46c8('0x13')});}}else{_0x2036be({'statusCode':0x194,'message':_0x46c8('0x13')});}})[_0x46c8('0x14')](function(_0x4da906){logger[_0x46c8('0x1f')]('['+[_0x5b7b2e[_0x46c8('0x15')]()]+']',_0x4da906[_0x46c8('0x16')]);_0x2036be(_0x4da906);});});};}function searchContact(_0x35effc,_0x21f6d9,_0x55a5f7,_0x2c78f9){return new Promise(function(_0x2603f9,_0x840dac){var _0x1744bd={'method':_0x46c8('0x17'),'headers':_0x21f6d9,'uri':_0x35effc+_0x46c8('0x20')+_0x2c78f9+'&f='+_0x55a5f7+_0x46c8('0x21'),'json':!![]};rp(_0x1744bd)[_0x46c8('0xf')](function(_0x1ef79a){var _0x5c0ce0=_['find'](_0x1ef79a[_0x46c8('0x22')][_0x46c8('0x22')],[_0x55a5f7,_0x2c78f9]);_0x2603f9(_0x5c0ce0);})[_0x46c8('0x14')](function(_0x404335){_0x840dac(_0x404335);});});}function getEndUser(_0x3d3988,_0x10484f,_0x762292){return function(_0x2ddfa5){return new Promise(function(_0x24e0ab,_0x226535){logger['info'](util['format'](_0x46c8('0x23'),_0x2ddfa5['contactNumber']));searchContact(_0x762292,_0x10484f,_0x46c8('0x24'),_0x2ddfa5[_0x46c8('0x25')])[_0x46c8('0xf')](function(_0x12d579){if(_0x12d579){_0x2ddfa5[_0x46c8('0x26')]=_0x12d579['id'];logger[_0x46c8('0xd')]('Contact\x20found\x20mobile_number:',_0x2ddfa5[_0x46c8('0x26')]);return _0x24e0ab(_0x2ddfa5);}searchContact(_0x762292,_0x10484f,_0x46c8('0x27'),_0x2ddfa5[_0x46c8('0x25')])[_0x46c8('0xf')](function(_0x2e1c2f){if(_0x2e1c2f){_0x2ddfa5[_0x46c8('0x26')]=_0x2e1c2f['id'];logger['info'](_0x46c8('0x28'),_0x2ddfa5['endUserId']);return _0x24e0ab(_0x2ddfa5);}createEndUser(_0x2ddfa5,_0x3d3988,_0x10484f,_0x762292)[_0x46c8('0xf')](function(_0x20cfdf){logger[_0x46c8('0xd')](_0x46c8('0x29'),_0x20cfdf[_0x46c8('0x26')]);return _0x24e0ab(_0x20cfdf);});});})[_0x46c8('0x14')](function(_0x60b630){_0x226535(_0x60b630);});});};}function createEndUser(_0x2019db,_0x5e86c4,_0x3a9fdc,_0x400437){return new Promise(function(_0x13b17c,_0x2b6ea9){var _0x5818aa=moment();var _0x3afd19={'method':_0x46c8('0x2a'),'uri':_0x400437+'/api/contacts','body':{'contact':{'last_name':_0x2019db[_0x46c8('0x25')],'work_number':_0x2019db[_0x46c8('0x25')],'mobile_number':_0x2019db[_0x46c8('0x25')],'owner_id':_0x2019db['userId'],'created_at':_0x5818aa[_0x46c8('0x2b')](_0x46c8('0x2c'))}},'json':!![]};_0x3afd19[_0x46c8('0xc')]=_0x3a9fdc;logger[_0x46c8('0xd')](_0x46c8('0x2d'));return rp(_0x3afd19)[_0x46c8('0xf')](function(_0x2f5fe0){_0x2019db[_0x46c8('0x26')]=_0x2f5fe0[_0x46c8('0x2e')]['id'];_0x13b17c(_0x2019db);})['catch'](function(_0x52cc7b){logger[_0x46c8('0x1f')]('['+[_0x5e86c4[_0x46c8('0x15')]()]+']',_0x52cc7b[_0x46c8('0x16')]);_0x2b6ea9(_0x52cc7b[_0x46c8('0x16')]);});});}function getTicket(_0xd3b2ba,_0x22f58a,_0x249784,_0xd206a3,_0x505ee8){return function(_0x104064){logger[_0x46c8('0xd')]('Creating\x20new\x20task');return new Promise(function(_0x3eb39d,_0x521f5b){var _0x15560d=moment();var _0x3adf95={'method':_0x46c8('0x2a'),'uri':_0x249784+_0x46c8('0x2f'),'body':{'title':intUtil[_0x46c8('0x30')](_0xd206a3['Subjects'],_0x505ee8,'\x20'),'description':intUtil[_0x46c8('0x30')](_0xd206a3['Descriptions'],_0x505ee8,'\x0a'),'owner_id':_0x104064[_0x46c8('0x1b')],'creater_id':_0x104064[_0x46c8('0x11')],'targetable_id':_0x104064[_0x46c8('0x26')],'targetable_type':_0x46c8('0x31'),'created_at':_0x15560d['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x15560d[_0x46c8('0x32')](0x1e,'m')['format'](_0x46c8('0x2c'))},'json':!![]};_0x3adf95[_0x46c8('0xc')]=_0x22f58a;return rp(_0x3adf95)['then'](function(_0x30f215){_0x104064[_0x46c8('0x33')]=_0x30f215[_0x46c8('0x34')]['id'];logger[_0x46c8('0xd')](_0x46c8('0x35'),_0x104064[_0x46c8('0x33')]);_0x3eb39d(_0x104064);})['catch'](function(_0x2d04cb){logger[_0x46c8('0x1f')]('['+[_0xd3b2ba[_0x46c8('0x15')]()]+']',_0x2d04cb[_0x46c8('0x16')]);_0x521f5b(_0x2d04cb[_0x46c8('0x16')]);});});};}function emit(_0x365858,_0x4a1b89,_0x56aa02){var _0x591be5={'uri':_0x365858+_0x46c8('0x36')+_0x56aa02};io['to'](util['format'](_0x46c8('0x37'),_0x4a1b89))[_0x46c8('0x38')](_0x46c8('0x39'),_0x591be5);}exports['cs']=function(_0x5d19ed,_0xd6d0cd,_0x271661,_0x4b00de,_0x41e382,_0x2f71e2,_0x3a15f4,_0x344231){var _0x1f66c8={};var _0x324ec5={'Authorization':_0x46c8('0x3a')+_0x2f71e2[_0x46c8('0x3b')]};_0x2f71e2[_0x46c8('0x3c')]=intUtil[_0x46c8('0x3d')](_0x2f71e2[_0x46c8('0x3c')]);_0x2f71e2[_0x46c8('0x3e')]=intUtil[_0x46c8('0x3d')](_0x2f71e2['serverUrl']);var _0x51b5be=_0x2f71e2[_0x46c8('0x3c')];_0x1f66c8['adminEmail']=_0x2f71e2[_0x46c8('0x3f')];_0x1f66c8[_0x46c8('0x25')]=_0x344231['toLowerCase']()===_0x46c8('0x40')?_0xd6d0cd[_0x46c8('0x41')]:_0xd6d0cd['calleridnum'];_0x1f66c8[_0x46c8('0x42')]=_0x344231===_0x46c8('0x43')||_0x344231==='unmanaged'?_0x46c8('0x43'):_0x46c8('0x40');if(_0x4b00de){_0x1f66c8['agentEmail']=_0x4b00de['email'];}var _0x457dce=util['format'](_0x46c8('0x44'),_0x2f71e2[_0x46c8('0x3e')],_0xd6d0cd['uniqueid'],md5(_0xd6d0cd['uniqueid']));if(_0x41e382&&_0x41e382['monitor_format']){logger[_0x46c8('0xd')](_0x46c8('0x45'),'Recording\x20is\x20enabled!');_0xd6d0cd['recordingURL']=_0x457dce;}else if(_0x3a15f4&&_0x3a15f4[_0x46c8('0x46')]&&_0x3a15f4[_0x46c8('0x46')]!==_0x46c8('0x47')){logger[_0x46c8('0xd')](_0x46c8('0x48'),_0x46c8('0x49'));_0xd6d0cd[_0x46c8('0x4a')]=_0x457dce;}else{_0xd6d0cd[_0x46c8('0x4a')]='';}return getAdminId(_0x1f66c8,_0x344231,_0x324ec5,_0x51b5be)[_0x46c8('0xf')](getUser(_0x344231,_0x324ec5,_0x51b5be))[_0x46c8('0xf')](getEndUser(_0x344231,_0x324ec5,_0x51b5be))['then'](getTicket(_0x344231,_0x324ec5,_0x51b5be,_0x271661,_0xd6d0cd))[_0x46c8('0xf')](function(_0x52405a){logger['info'](util['format'](_0x46c8('0x4b'),_0x52405a[_0x46c8('0x33')]));if(_0x344231!==_0x46c8('0x4c')){logger['info']('['+[_0x344231['toUpperCase']()]+']',_0x46c8('0x4d'));emit(_0x51b5be,_0x4b00de[_0x46c8('0x4e')],_0x52405a[_0x46c8('0x26')]);}})[_0x46c8('0x14')](function(_0x436da2){logger[_0x46c8('0x1f')]('['+[_0x344231[_0x46c8('0x15')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x46c8('0x4f')](_0x436da2,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/index.js b/server/services/ami/trigger/integration/index.js index 1d38613..8b25afd 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 _0xefda=['./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','zoho','vtiger','dynamics365','freshsales','includes','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','desk','servicenow','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','./salesforce'];(function(_0x22ee1e,_0x3eff80){var _0x49a5c9=function(_0x373480){while(--_0x373480){_0x22ee1e['push'](_0x22ee1e['shift']());}};_0x49a5c9(++_0x3eff80);}(_0xefda,0x96));var _0xaefd=function(_0x30f57a,_0x2a84d2){_0x30f57a=_0x30f57a-0x0;var _0x6de3e8=_0xefda[_0x30f57a];return _0x6de3e8;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0xaefd('0x1'));var sugarcrm=require(_0xaefd('0x2'));var freshdesk=require('./freshdesk');var zoho=require(_0xaefd('0x3'));var desk=require(_0xaefd('0x4'));var vtiger=require(_0xaefd('0x5'));var servicenow=require(_0xaefd('0x6'));var dynamics365=require(_0xaefd('0x7'));var freshsales=require(_0xaefd('0x8'));var integrations=['zendesk',_0xaefd('0x9'),_0xaefd('0xa'),_0xaefd('0xb'),_0xaefd('0xc'),'desk',_0xaefd('0xd'),_0xaefd('0xe'),_0xaefd('0xf'),'servicenow'];exports['exec']=function(_0x54a3b1,_0xa6239d,_0x16b36e,_0x20135c,_0x35eea5,_0x10272a){if(_0x16b36e){if(_[_0xaefd('0x10')](integrations,_0x54a3b1[_0xaefd('0x11')][_0xaefd('0x12')]())){try{var _0x27be0f=null;var _0x382983='';var _0x2a310c=_0x16b36e[_0x54a3b1['data1'][_0xaefd('0x12')]()];if(_0x2a310c){var _0x4ac467=_0x2a310c[_0x54a3b1[_0xaefd('0x13')]];if(_0x4ac467){var _0x1725af=_[_0xaefd('0x14')](_0x4ac467[_0xaefd('0x15')],{'id':parseInt(_0x54a3b1['data3'],0xa)});if(_0x1725af){if(_0x20135c){if(_0x35eea5&&_0xa6239d[_0xaefd('0x16')]){_0x382983=_0xaefd('0x16');}else if(_0xa6239d[_0xaefd('0x17')]){_0x382983=_0xaefd('0x18');}else{console[_0xaefd('0x19')](_0xaefd('0x1a'),_0xa6239d);}}else{_0x382983=_0xaefd('0x1b');}switch(_0x54a3b1[_0xaefd('0x11')]['toLowerCase']()){case _0xaefd('0x1c'):zendesk[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case _0xaefd('0x9'):salesforce[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case _0xaefd('0xa'):sugarcrm[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case _0xaefd('0xb'):freshdesk[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case _0xaefd('0xc'):zoho[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case _0xaefd('0x1d'):desk[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case'vtiger':vtiger[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case _0xaefd('0xf'):freshsales['cs'](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a,_0x382983);break;case _0xaefd('0x1e'):servicenow['cs'](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a,_0x382983);break;case _0xaefd('0xe'):dynamics365['cs'](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a,_0x382983);break;default:console[_0xaefd('0x19')](_0xaefd('0x1f'));}}else{_0x27be0f=require(_0xaefd('0x20'))(_0x54a3b1['data1'][_0xaefd('0x12')]());_0x27be0f[_0xaefd('0x21')](_0xaefd('0x22'),util[_0xaefd('0x23')](_0xaefd('0x24'),_0x54a3b1['data1']['toLowerCase'](),_0x54a3b1['data3']));}}else{_0x27be0f=require(_0xaefd('0x20'))(_0x54a3b1[_0xaefd('0x11')][_0xaefd('0x12')]());_0x27be0f['error'](_0xaefd('0x22'),util['format'](_0xaefd('0x25'),_0x54a3b1[_0xaefd('0x11')][_0xaefd('0x12')](),_0x54a3b1['data2']));}}else{}}catch(_0x435413){console[_0xaefd('0x21')](_0x435413);}}}}; \ No newline at end of file +var _0x0b0e=['./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','desk','vtiger','dynamics365','freshsales','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','outbound','log','unmanaged','freshdesk','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./sugarcrm','./freshdesk','./zoho'];(function(_0x337839,_0x34bb95){var _0x3fb3a9=function(_0x302c40){while(--_0x302c40){_0x337839['push'](_0x337839['shift']());}};_0x3fb3a9(++_0x34bb95);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2a0fc4,_0x2eaf74){_0x2a0fc4=_0x2a0fc4-0x0;var _0x531d00=_0x0b0e[_0x2a0fc4];return _0x531d00;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var zendesk=require(_0xe0b0('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0xe0b0('0x2'));var freshdesk=require(_0xe0b0('0x3'));var zoho=require(_0xe0b0('0x4'));var desk=require(_0xe0b0('0x5'));var vtiger=require(_0xe0b0('0x6'));var servicenow=require(_0xe0b0('0x7'));var dynamics365=require(_0xe0b0('0x8'));var freshsales=require(_0xe0b0('0x9'));var integrations=[_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'freshdesk','zoho',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'servicenow'];exports[_0xe0b0('0x11')]=function(_0x1dd3b8,_0x553d4f,_0x1fef28,_0x2f32b6,_0x574d96,_0x399320){if(_0x1fef28){if(_[_0xe0b0('0x12')](integrations,_0x1dd3b8[_0xe0b0('0x13')]['toLowerCase']())){try{var _0x3068c0=null;var _0x1c358a='';var _0x3cc19a=_0x1fef28[_0x1dd3b8[_0xe0b0('0x13')][_0xe0b0('0x14')]()];if(_0x3cc19a){var _0x4d2bf7=_0x3cc19a[_0x1dd3b8[_0xe0b0('0x15')]];if(_0x4d2bf7){var _0x154de6=_[_0xe0b0('0x16')](_0x4d2bf7[_0xe0b0('0x17')],{'id':parseInt(_0x1dd3b8[_0xe0b0('0x18')],0xa)});if(_0x154de6){if(_0x2f32b6){if(_0x574d96&&_0x553d4f['queue']){_0x1c358a=_0xe0b0('0x19');}else if(_0x553d4f['routeId']){_0x1c358a=_0xe0b0('0x1a');}else{console[_0xe0b0('0x1b')]('EVENT\x20UNKNOWN',_0x553d4f);}}else{_0x1c358a=_0xe0b0('0x1c');}switch(_0x1dd3b8['data1'][_0xe0b0('0x14')]()){case _0xe0b0('0xa'):zendesk[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case'salesforce':salesforce[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case'sugarcrm':sugarcrm[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case _0xe0b0('0x1d'):freshdesk[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case'zoho':zoho[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case'desk':desk[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case'vtiger':vtiger[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case _0xe0b0('0x10'):freshsales['cs'](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320,_0x1c358a);break;case'servicenow':servicenow['cs'](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320,_0x1c358a);break;case'dynamics365':dynamics365['cs'](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320,_0x1c358a);break;default:console[_0xe0b0('0x1b')]('unknown\x20integration');}}else{_0x3068c0=require(_0xe0b0('0x1e'))(_0x1dd3b8['data1'][_0xe0b0('0x14')]());_0x3068c0[_0xe0b0('0x1f')](_0xe0b0('0x20'),util[_0xe0b0('0x21')](_0xe0b0('0x22'),_0x1dd3b8['data1']['toLowerCase'](),_0x1dd3b8[_0xe0b0('0x18')]));}}else{_0x3068c0=require('../../../../config/logger')(_0x1dd3b8[_0xe0b0('0x13')][_0xe0b0('0x14')]());_0x3068c0['error'](_0xe0b0('0x20'),util['format'](_0xe0b0('0x23'),_0x1dd3b8['data1'][_0xe0b0('0x14')](),_0x1dd3b8['data2']));}}else{}}catch(_0x3e5c88){console['error'](_0x3e5c88);}}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/salesforce.js b/server/services/ami/trigger/integration/salesforce.js index e151f5e..dc8feda 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 _0x80b4=['request-promise','moment','bluebird','md5','jsforce','./util','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','getString','Subjects','Descriptions','ticketType','Task','IsReminderSet','IsRecurrence','contact','lead','endUserType','WhatId','Case','ContactId','account','AccountId','info','sobject','isNil','User','then','length','find','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','display_name','identity','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','execute','Contact','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','Company','No\x20Company','upperFirst','create','includes','string','picklist','idField','content','toString','variable','variableName','Variable','name','concat','securityToken','remoteUri','https://login.salesforce.com','clientSecret','login','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','uniqueid','recordingURL','email','calleridname','calleridnum','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','catch','error','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','unmanaged','monitor_format','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash'];(function(_0x176683,_0x168eb1){var _0x41ab61=function(_0x30b18e){while(--_0x30b18e){_0x176683['push'](_0x176683['shift']());}};_0x41ab61(++_0x168eb1);}(_0x80b4,0xe9));var _0x480b=function(_0x236a13,_0x3ce012){_0x236a13=_0x236a13-0x0;var _0x14f864=_0x80b4[_0x236a13];return _0x14f864;};'use strict';var _=require(_0x480b('0x0'));var rp=require(_0x480b('0x1'));var moment=require(_0x480b('0x2'));var BPromise=require(_0x480b('0x3'));var md5=require(_0x480b('0x4'));var jsforce=require(_0x480b('0x5'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x480b('0x6'));var config=require('../../../../config/environment');var logger=require(_0x480b('0x7'))(_0x480b('0x8'));config[_0x480b('0x9')]=_[_0x480b('0xa')](config[_0x480b('0x9')],{'host':_0x480b('0xb'),'port':0x18eb});var io=require(_0x480b('0xc'))(new Redis(config[_0x480b('0x9')]));function emit(_0x33b115,_0x237c85,_0x19a73a){io['to'](_0x33b115)['emit'](_0x237c85,_0x19a73a);}function getTicket(_0x1b2f71,_0x5a9fa5,_0x4e33d8,_0x321730,_0x2bdd4f,_0x219bfd,_0x61ee94,_0x140ae3){var _0x41788b=Object['assign']({},{'OwnerId':_0x5a9fa5['id'],'Subject':intUtil[_0x480b('0xd')](_0x321730[_0x480b('0xe')],_0x2bdd4f,'\x20'),'Description':intUtil[_0x480b('0xd')](_0x321730[_0x480b('0xf')],_0x2bdd4f,'\x0a')},getCustomFields(_0x219bfd,_0x2bdd4f));if(_0x4e33d8){if(_0x321730[_0x480b('0x10')]===_0x480b('0x11')){_0x41788b['ActivityDate']=moment['utc']();_0x41788b[_0x480b('0x12')]=![];_0x41788b[_0x480b('0x13')]=![];if(_0x4e33d8['endUserType']===_0x480b('0x14')||_0x4e33d8['endUserType']===_0x480b('0x15')){_0x41788b['WhoId']=_0x4e33d8['id'];}else if(_0x4e33d8[_0x480b('0x16')]==='account'){_0x41788b[_0x480b('0x17')]=_0x4e33d8['id'];}}else if(_0x321730[_0x480b('0x10')]===_0x480b('0x18')){if(_0x4e33d8[_0x480b('0x16')]===_0x480b('0x14')){_0x41788b[_0x480b('0x19')]=_0x4e33d8['id'];}else if(_0x4e33d8[_0x480b('0x16')]===_0x480b('0x1a')){_0x41788b[_0x480b('0x1b')]=_0x4e33d8['id'];}else if(_0x4e33d8['endUserType']===_0x480b('0x15')&&_0x321730['leadId']){_0x41788b[_0x321730['leadId']]=_0x4e33d8['id'];}else{logger[_0x480b('0x1c')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x61ee94[_0x480b('0x1d')](_0x321730[_0x480b('0x10')])['create'](_0x41788b);}function getUser(_0x5bf2d9,_0x580ce1,_0x198d4f){if(!_[_0x480b('0x1e')](_0x580ce1)&&intUtil['validateEmail'](_0x580ce1)){var _0xd1710e={'Email':_0x580ce1};var _0x45954e={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x198d4f[_0x480b('0x1d')](_0x480b('0x1f'))['find'](_0xd1710e,_0x45954e)['execute']()[_0x480b('0x20')](function(_0x2aeef5){if(_0x2aeef5[_0x480b('0x21')]){var _0x40374e=_[_0x480b('0x22')](_0x2aeef5,function(_0x3f29fb){return _0x3f29fb[_0x480b('0x23')]===_0x580ce1;});if(_0x40374e){logger[_0x480b('0x1c')]('Agent\x20%s\x20found.',_0x580ce1);return BPromise[_0x480b('0x24')]({'id':_0x40374e['Id'],'name':_0x40374e[_0x480b('0x25')]});}}else{logger['info'](_0x480b('0x26'),_0x580ce1);return _0x198d4f['identity']()[_0x480b('0x20')](function(_0x1a00a1){return BPromise[_0x480b('0x24')]({'id':_0x1a00a1['user_id'],'name':_0x1a00a1[_0x480b('0x27')]});});}});}else{logger[_0x480b('0x1c')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x580ce1);return _0x198d4f[_0x480b('0x28')]()[_0x480b('0x20')](function(_0x560a9a){return BPromise['resolve']({'id':_0x560a9a['user_id'],'name':_0x560a9a[_0x480b('0x27')]});});}}function getEndUser(_0xd8fa14,_0x213eeb,_0x1a42bc,_0x5cdde0,_0x4b9dbf){var _0x24d0f8={'$or':{'Phone':_0x5cdde0}};var _0x5e6794={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x480b('0x24')]()[_0x480b('0x20')](function(){logger[_0x480b('0x1c')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x5cdde0,_0x213eeb[_0x480b('0x29')]);switch(_0x213eeb[_0x480b('0x29')]){case'contact_lead':var _0xaee5cf=_[_0x480b('0x2a')](_0x24d0f8);if(_0x213eeb['additionalSearchContact']){var _0xb89de6={};_0xb89de6[_0x213eeb[_0x480b('0x2b')]]=_0x5cdde0;_[_0x480b('0x2c')](_0xaee5cf[_0x480b('0x2d')],_0xb89de6);}return _0x4b9dbf[_0x480b('0x1d')]('Contact')[_0x480b('0x22')](_0xaee5cf,_0x5e6794)['execute']()[_0x480b('0x20')](function(_0x5d61a5){if(_0x5d61a5&&_0x5d61a5[_0x480b('0x21')]){return _0x5d61a5;}else{var _0x1cfdb7=_['cloneDeep'](_0x24d0f8);if(_0x213eeb[_0x480b('0x2e')]){var _0x5061a3={};_0x5061a3[_0x213eeb[_0x480b('0x2e')]]=_0x5cdde0;_[_0x480b('0x2c')](_0x1cfdb7[_0x480b('0x2d')],_0x5061a3);}return _0x4b9dbf['sobject'](_0x480b('0x2f'))[_0x480b('0x22')](_0x1cfdb7,_0x5e6794);}});case _0x480b('0x30'):var _0x4ec22b=_[_0x480b('0x2a')](_0x24d0f8);if(_0x213eeb[_0x480b('0x31')]){var _0xb89de6={};_0xb89de6[_0x213eeb[_0x480b('0x31')]]=_0x5cdde0;_[_0x480b('0x2c')](_0x4ec22b[_0x480b('0x2d')],_0xb89de6);}return _0x4b9dbf['sobject'](_0x480b('0x32'))[_0x480b('0x22')](_0x4ec22b,_0x5e6794)[_0x480b('0x33')]()['then'](function(_0x4ede93){if(_0x4ede93&&_0x4ede93[_0x480b('0x21')]){return _0x4ede93;}else{var _0x8daad9=_[_0x480b('0x2a')](_0x24d0f8);if(_0x213eeb['additionalSearchContact']){var _0x342e25={};_0x342e25[_0x213eeb[_0x480b('0x2b')]]=_0x5cdde0;_[_0x480b('0x2c')](_0x8daad9[_0x480b('0x2d')],_0x342e25);}return _0x4b9dbf[_0x480b('0x1d')](_0x480b('0x34'))[_0x480b('0x22')](_0x8daad9,_0x5e6794)[_0x480b('0x20')](function(_0x2eaead){if(_0x2eaead&&_0x2eaead[_0x480b('0x21')]){return _0x2eaead;}else{var _0x3b99ef=_[_0x480b('0x2a')](_0x24d0f8);if(_0x213eeb[_0x480b('0x2e')]){var _0x296f62={};_0x296f62[_0x213eeb[_0x480b('0x2e')]]=_0x5cdde0;_[_0x480b('0x2c')](_0x3b99ef[_0x480b('0x2d')],_0x296f62);}return _0x4b9dbf[_0x480b('0x1d')]('Lead')[_0x480b('0x22')](_0x3b99ef,_0x5e6794);}});}});case _0x480b('0x14'):var _0xaee5cf=_[_0x480b('0x2a')](_0x24d0f8);if(_0x213eeb[_0x480b('0x2b')]){var _0xb89de6={};_0xb89de6[_0x213eeb[_0x480b('0x2b')]]=_0x5cdde0;_[_0x480b('0x2c')](_0xaee5cf[_0x480b('0x2d')],_0xb89de6);}return _0x4b9dbf[_0x480b('0x1d')]('Contact')[_0x480b('0x22')](_0xaee5cf,_0x5e6794)[_0x480b('0x33')]();case _0x480b('0x15'):var _0x35f4db=_[_0x480b('0x2a')](_0x24d0f8);if(_0x213eeb['additionalSearchLead']){var _0xb89de6={};_0xb89de6[_0x213eeb[_0x480b('0x2e')]]=_0x5cdde0;_[_0x480b('0x2c')](_0x35f4db[_0x480b('0x2d')],_0xb89de6);}return _0x4b9dbf['sobject'](_0x480b('0x2f'))[_0x480b('0x22')](_0x35f4db,_0x5e6794);case _0x480b('0x1a'):var _0x4ec22b=_[_0x480b('0x2a')](_0x24d0f8);if(_0x213eeb[_0x480b('0x31')]){var _0xb89de6={};_0xb89de6[_0x213eeb[_0x480b('0x31')]]=_0x5cdde0;_[_0x480b('0x2c')](_0x4ec22b[_0x480b('0x2d')],_0xb89de6);}return _0x4b9dbf[_0x480b('0x1d')]('Account')[_0x480b('0x22')](_0x4ec22b,_0x5e6794);default:return null;}})[_0x480b('0x20')](function(_0x466b88){if(_0x466b88&&_0x466b88[_0x480b('0x21')]){var _0x38aa3c=_['first'](_0x466b88);if(_0x38aa3c){return BPromise[_0x480b('0x24')]({'id':_0x38aa3c['Id'],'name':_0x38aa3c['Name'],'phone':_0x38aa3c[_0x480b('0x35')],'endUserType':_0x38aa3c[_0x480b('0x36')][_0x480b('0x37')][_0x480b('0x38')]()});}}})[_0x480b('0x20')](function(_0x5ec7f0){if(_0x5ec7f0){logger['info'](_0x480b('0x39'),_0x5ec7f0[_0x480b('0x16')],_0x5cdde0);return BPromise['resolve'](_0x5ec7f0);}else{logger[_0x480b('0x1c')](_0x480b('0x3a'),_0x5cdde0);var _0x301e93={'Phone':_0x5cdde0};if(_0x213eeb[_0x480b('0x3b')]){if(_0x213eeb[_0x480b('0x3b')]==='contact'){logger[_0x480b('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5cdde0,_0x213eeb['moduleCreate']);_0x301e93[_0x480b('0x3c')]=_0x1a42bc!==_0x480b('0x3d')?_0x1a42bc:util['format'](_0x480b('0x3e'),_0x5cdde0);}else if(_0x213eeb[_0x480b('0x3b')]===_0x480b('0x15')){logger[_0x480b('0x1c')](_0x480b('0x3f'),_0x5cdde0,_0x213eeb['moduleCreate']);_0x301e93[_0x480b('0x3c')]=_0x1a42bc!==_0x480b('0x3d')?_0x1a42bc:util[_0x480b('0x40')](_0x480b('0x3e'),_0x5cdde0);_0x301e93[_0x480b('0x41')]=_0x480b('0x42');}else if(_0x213eeb[_0x480b('0x3b')]==='account'){logger[_0x480b('0x1c')](_0x480b('0x3f'),_0x5cdde0,_0x213eeb[_0x480b('0x3b')]);_0x301e93['Name']=_0x1a42bc!==_0x480b('0x3d')?_0x1a42bc:util['format']('Caller\x20-\x20%s',_0x5cdde0);}else{return null;}}return _0x4b9dbf[_0x480b('0x1d')](_[_0x480b('0x43')](_0x213eeb[_0x480b('0x3b')]))[_0x480b('0x44')](_0x301e93)[_0x480b('0x20')](function(_0xff154a){return BPromise['resolve']({'id':_0xff154a['id'],'endUserType':_0x213eeb[_0x480b('0x3b')]});});}});}function getCustomFields(_0x326bbb,_0xd1b749){var _0x434c18={};if(_0x326bbb[_0x480b('0x21')]>0x0){_['forEach'](_0x326bbb,function(_0x2cc80c){if(_[_0x480b('0x45')]([_0x480b('0x46'),_0x480b('0x47')],_0x2cc80c[_0x480b('0x37')])&&_0x2cc80c[_0x480b('0x48')]){_0x434c18[_0x2cc80c[_0x480b('0x48')]]=_0x2cc80c[_0x480b('0x49')][_0x480b('0x4a')]();}else if(_0x2cc80c[_0x480b('0x37')]===_0x480b('0x4b')&&_0x2cc80c['variableName']&&_0x2cc80c[_0x480b('0x48')]){_0xd1b749[_0x2cc80c[_0x480b('0x4c')]]&&(_0x434c18[_0x2cc80c['idField']]=_0xd1b749[_0x2cc80c['variableName']][_0x480b('0x4a')]());}else if(_0x2cc80c[_0x480b('0x37')]==='customVariable'&&_0x2cc80c[_0x480b('0x4d')]&&_0x2cc80c[_0x480b('0x4d')]['name']&&_0x2cc80c[_0x480b('0x48')]){_0xd1b749[_0x2cc80c[_0x480b('0x4d')][_0x480b('0x4e')][_0x480b('0x38')]()]&&(_0x434c18[_0x2cc80c[_0x480b('0x48')]]=_0xd1b749[_0x2cc80c[_0x480b('0x4d')]['name'][_0x480b('0x38')]()][_0x480b('0x4a')]());}});}return _0x434c18;}function getConnection(_0x1f8fe7){var _0x44a1e3=_0x1f8fe7['password'][_0x480b('0x4f')](_0x1f8fe7[_0x480b('0x50')]);var _0x21fd42=new jsforce['Connection']({'oauth2':{'loginUrl':_0x1f8fe7[_0x480b('0x51')]||_0x480b('0x52'),'clientId':_0x1f8fe7['clientId'],'clientSecret':_0x1f8fe7[_0x480b('0x53')]}});return _0x21fd42[_0x480b('0x54')](_0x1f8fe7['username'],_0x44a1e3)[_0x480b('0x20')](function(){logger['info']('Connection\x20established.');return _0x21fd42;});}exports[_0x480b('0x55')]=function(_0x6bfe0c,_0x87e62a,_0x402b34,_0x573aea,_0x1b8c64,_0x2ff31a){var _0x16a0fa,_0x62d2bd,_0x4083ef,_0x462ec0;_0x2ff31a['serverUrl']=intUtil[_0x480b('0x56')](_0x2ff31a[_0x480b('0x57')]);_0x2ff31a[_0x480b('0x51')]=intUtil['stripTrailingSlash'](_0x2ff31a[_0x480b('0x51')]);if(_0x1b8c64&&_0x1b8c64['monitor_format']){logger[_0x480b('0x1c')]('[QUEUE]',_0x480b('0x58'));_0x87e62a['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2ff31a[_0x480b('0x57')],_0x87e62a[_0x480b('0x59')],md5(_0x87e62a[_0x480b('0x59')]));}else{_0x87e62a[_0x480b('0x5a')]='';}return getConnection(_0x2ff31a)[_0x480b('0x20')](function(_0x368cc8){_0x462ec0=_0x368cc8;return getUser(_0x2ff31a,_0x573aea[_0x480b('0x5b')],_0x462ec0);})[_0x480b('0x20')](function(_0x4013c0){_0x16a0fa=_0x4013c0;return getEndUser(_0x2ff31a,_0x402b34,_0x87e62a[_0x480b('0x5c')],_0x87e62a[_0x480b('0x5d')],_0x462ec0);})[_0x480b('0x20')](function(_0x130305){_0x62d2bd=_0x130305;return getTicket(_0x2ff31a,_0x16a0fa,_0x62d2bd,_0x402b34,_0x87e62a,_0x402b34['Fields'],_0x462ec0,_0x480b('0x55'));})[_0x480b('0x20')](function(_0x335fa9){_0x4083ef=_0x335fa9;logger[_0x480b('0x1c')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x4083ef['id']);logger[_0x480b('0x1c')](_0x480b('0x5e'),_0x4083ef['id'],_0x573aea['name'],_0x2ff31a[_0x480b('0x37')]);switch(_0x2ff31a['type']){case _0x480b('0x5f'):emit(util['format'](_0x480b('0x60'),_0x573aea[_0x480b('0x4e')]),_0x480b('0x61'),{'recordId':_0x4083ef['id']});break;case _0x480b('0x62'):emit(util[_0x480b('0x40')]('user:%s',_0x573aea['name']),_0x480b('0x63'),{'uri':util['format'](_0x480b('0x64'),_0x462ec0[_0x480b('0x65')],_0x4083ef['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x480b('0x66')](function(_0x164f02){logger[_0x480b('0x67')]('[QUEUE]',_0x164f02);});};exports[_0x480b('0x68')]=function(_0x49e552,_0x378c76,_0x292040,_0x1edf35,_0x45d888,_0x9ada8,_0x30792f){var _0x35faa1,_0x5e80db,_0x3d300c,_0x5eaaa3;_0x9ada8[_0x480b('0x57')]=intUtil[_0x480b('0x56')](_0x9ada8[_0x480b('0x57')]);_0x9ada8[_0x480b('0x51')]=intUtil[_0x480b('0x56')](_0x9ada8[_0x480b('0x51')]);if(_0x30792f&&_0x30792f[_0x480b('0x69')]&&_0x30792f['recordingFormat']!=='none'){logger[_0x480b('0x1c')](_0x480b('0x6a'),_0x480b('0x58'));_0x378c76[_0x480b('0x5a')]=util['format'](_0x480b('0x6b'),_0x9ada8[_0x480b('0x57')],_0x378c76['uniqueid'],md5(_0x378c76[_0x480b('0x59')]));}return getConnection(_0x9ada8)[_0x480b('0x20')](function(_0x250d66){_0x5eaaa3=_0x250d66;return getUser(_0x9ada8,_0x1edf35[_0x480b('0x5b')],_0x5eaaa3);})['then'](function(_0x242828){_0x35faa1=_0x242828;return getEndUser(_0x9ada8,_0x292040,_0x378c76['destcalleridname'],_0x378c76['destcalleridnum'],_0x5eaaa3);})['then'](function(_0x1c8bff){_0x5e80db=_0x1c8bff;return getTicket(_0x9ada8,_0x35faa1,_0x5e80db,_0x292040,_0x378c76,_0x292040[_0x480b('0x6c')],_0x5eaaa3,_0x480b('0x68'));})[_0x480b('0x20')](function(_0x412e38){_0x3d300c=_0x412e38;logger[_0x480b('0x1c')](_0x480b('0x6d'),_0x3d300c['id']);logger[_0x480b('0x1c')](_0x480b('0x6e'),_0x3d300c['id'],_0x1edf35['name'],_0x9ada8[_0x480b('0x37')]);switch(_0x9ada8['type']){case'integrationTab':emit(util['format'](_0x480b('0x60'),_0x1edf35['name']),'trigger:salesforce:display',{'recordId':_0x3d300c['id']});break;case _0x480b('0x62'):emit(util[_0x480b('0x40')](_0x480b('0x60'),_0x1edf35[_0x480b('0x4e')]),_0x480b('0x63'),{'uri':util[_0x480b('0x40')](_0x480b('0x64'),_0x5eaaa3[_0x480b('0x65')],_0x3d300c['id'])});break;default:logger['error'](_0x480b('0x6a'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x480b('0x66')](function(_0x627b76){logger[_0x480b('0x67')](_0x480b('0x6a'),_0x627b76);});};exports[_0x480b('0x6f')]=function(_0x3a5e45,_0x4b5129,_0xe9c21d,_0x1ff16c,_0x2b594d,_0x292cbf){var _0x19060e,_0x3d01b2,_0x4167fc,_0x19e7d0;_0x292cbf[_0x480b('0x57')]=intUtil[_0x480b('0x56')](_0x292cbf[_0x480b('0x57')]);_0x292cbf['remoteUri']=intUtil[_0x480b('0x56')](_0x292cbf[_0x480b('0x51')]);if(_0x2b594d&&_0x2b594d[_0x480b('0x70')]){logger[_0x480b('0x1c')]('['+_0x4b5129[_0x480b('0x71')][_0x480b('0x72')]()+']',_0x480b('0x58'));_0x4b5129['recordingURL']=util[_0x480b('0x40')](_0x480b('0x6b'),_0x292cbf['serverUrl'],_0x4b5129['uniqueid'],md5(_0x4b5129[_0x480b('0x59')]));}else{_0x4b5129['recordingURL']='';}return getConnection(_0x292cbf)['then'](function(_0x22c80d){_0x19e7d0=_0x22c80d;if(!_[_0x480b('0x1e')](_0x1ff16c)){return getUser(_0x292cbf,_0x1ff16c[_0x480b('0x4e')],_0x19e7d0);}else{return getUser(_0x292cbf,null,_0x19e7d0);}})[_0x480b('0x20')](function(_0x7d7880){_0x19060e=_0x7d7880;return getEndUser(_0x292cbf,_0xe9c21d,_0x4b5129['calleridname'],_0x4b5129['calleridnum'],_0x19e7d0);})[_0x480b('0x20')](function(_0x27568f){_0x3d01b2=_0x27568f;return getTicket(_0x292cbf,_0x19060e,_0x3d01b2,_0xe9c21d,_0x4b5129,_0xe9c21d[_0x480b('0x6c')],_0x19e7d0);})[_0x480b('0x20')](function(_0x435c08){_0x4167fc=_0x435c08;logger[_0x480b('0x1c')]('['+_0x4b5129['lastevent'][_0x480b('0x72')]()+_0x480b('0x73'),_0x4167fc['id']);logger['info']('['+_0x4b5129[_0x480b('0x71')]['toUpperCase']()+_0x480b('0x74'),_0x292cbf[_0x480b('0x37')]);})[_0x480b('0x66')](function(_0x5a4cc2){logger['error']('['+_0x4b5129[_0x480b('0x71')][_0x480b('0x72')]()+']',_0x5a4cc2);});}; \ No newline at end of file +var _0xd918=['catch','unmanaged','monitor_format','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/logger','salesforce','redis','defaults','assign','Subjects','getString','ticketType','Task','ActivityDate','utc','IsReminderSet','endUserType','contact','lead','WhoId','account','WhatId','ContactId','AccountId','leadId','info','sobject','isNil','validateEmail','User','find','execute','then','length','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','LastName','format','No\x20Company','includes','string','idField','variableName','toString','customVariable','Variable','name','password','concat','remoteUri','https://login.salesforce.com','clientSecret','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[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','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','trigger:browser:url','[OUTBOUND]'];(function(_0x33d669,_0x561672){var _0x46186c=function(_0x3246e7){while(--_0x3246e7){_0x33d669['push'](_0x33d669['shift']());}};_0x46186c(++_0x561672);}(_0xd918,0x7f));var _0x8d91=function(_0x1569cf,_0x19aae6){_0x1569cf=_0x1569cf-0x0;var _0x16faed=_0xd918[_0x1569cf];return _0x16faed;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0x8d91('0x0'));var BPromise=require(_0x8d91('0x1'));var md5=require(_0x8d91('0x2'));var jsforce=require(_0x8d91('0x3'));var util=require(_0x8d91('0x4'));var Redis=require(_0x8d91('0x5'));var intUtil=require(_0x8d91('0x6'));var config=require('../../../../config/environment');var logger=require(_0x8d91('0x7'))(_0x8d91('0x8'));config[_0x8d91('0x9')]=_[_0x8d91('0xa')](config[_0x8d91('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8d91('0x9')]));function emit(_0xedb246,_0x262ab0,_0x32713a){io['to'](_0xedb246)['emit'](_0x262ab0,_0x32713a);}function getTicket(_0x382237,_0x168ab6,_0x42675b,_0x55df60,_0x13897c,_0xdc9c62,_0xec2e29,_0x1658d1){var _0x729fb0=Object[_0x8d91('0xb')]({},{'OwnerId':_0x168ab6['id'],'Subject':intUtil['getString'](_0x55df60[_0x8d91('0xc')],_0x13897c,'\x20'),'Description':intUtil[_0x8d91('0xd')](_0x55df60['Descriptions'],_0x13897c,'\x0a')},getCustomFields(_0xdc9c62,_0x13897c));if(_0x42675b){if(_0x55df60[_0x8d91('0xe')]===_0x8d91('0xf')){_0x729fb0[_0x8d91('0x10')]=moment[_0x8d91('0x11')]();_0x729fb0[_0x8d91('0x12')]=![];_0x729fb0['IsRecurrence']=![];if(_0x42675b[_0x8d91('0x13')]===_0x8d91('0x14')||_0x42675b[_0x8d91('0x13')]===_0x8d91('0x15')){_0x729fb0[_0x8d91('0x16')]=_0x42675b['id'];}else if(_0x42675b[_0x8d91('0x13')]===_0x8d91('0x17')){_0x729fb0[_0x8d91('0x18')]=_0x42675b['id'];}}else if(_0x55df60[_0x8d91('0xe')]==='Case'){if(_0x42675b['endUserType']==='contact'){_0x729fb0[_0x8d91('0x19')]=_0x42675b['id'];}else if(_0x42675b[_0x8d91('0x13')]==='account'){_0x729fb0[_0x8d91('0x1a')]=_0x42675b['id'];}else if(_0x42675b['endUserType']===_0x8d91('0x15')&&_0x55df60['leadId']){_0x729fb0[_0x55df60[_0x8d91('0x1b')]]=_0x42675b['id'];}else{logger[_0x8d91('0x1c')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0xec2e29[_0x8d91('0x1d')](_0x55df60[_0x8d91('0xe')])['create'](_0x729fb0);}function getUser(_0x1e1063,_0x3b39bd,_0x67dbd5){if(!_[_0x8d91('0x1e')](_0x3b39bd)&&intUtil[_0x8d91('0x1f')](_0x3b39bd)){var _0x4e9f18={'Email':_0x3b39bd};var _0x5af63c={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x67dbd5[_0x8d91('0x1d')](_0x8d91('0x20'))[_0x8d91('0x21')](_0x4e9f18,_0x5af63c)[_0x8d91('0x22')]()[_0x8d91('0x23')](function(_0x57d759){if(_0x57d759[_0x8d91('0x24')]){var _0x544520=_['find'](_0x57d759,function(_0x7f73ac){return _0x7f73ac[_0x8d91('0x25')]===_0x3b39bd;});if(_0x544520){logger[_0x8d91('0x1c')](_0x8d91('0x26'),_0x3b39bd);return BPromise['resolve']({'id':_0x544520['Id'],'name':_0x544520[_0x8d91('0x27')]});}}else{logger[_0x8d91('0x1c')](_0x8d91('0x28'),_0x3b39bd);return _0x67dbd5['identity']()[_0x8d91('0x23')](function(_0x2a17ed){return BPromise[_0x8d91('0x29')]({'id':_0x2a17ed[_0x8d91('0x2a')],'name':_0x2a17ed[_0x8d91('0x2b')]});});}});}else{logger[_0x8d91('0x1c')](_0x8d91('0x28'),_0x3b39bd);return _0x67dbd5['identity']()[_0x8d91('0x23')](function(_0x156d6e){return BPromise[_0x8d91('0x29')]({'id':_0x156d6e[_0x8d91('0x2a')],'name':_0x156d6e['display_name']});});}}function getEndUser(_0x3e62ed,_0x4d04d8,_0x5e9e43,_0x425a17,_0x4e160f){var _0x1071ce={'$or':{'Phone':_0x425a17}};var _0x48c163={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x8d91('0x29')]()[_0x8d91('0x23')](function(){logger[_0x8d91('0x1c')](_0x8d91('0x2c'),_0x425a17,_0x4d04d8[_0x8d91('0x2d')]);switch(_0x4d04d8['moduleSearch']){case'contact_lead':var _0x418187=_[_0x8d91('0x2e')](_0x1071ce);if(_0x4d04d8['additionalSearchContact']){var _0x546ae9={};_0x546ae9[_0x4d04d8[_0x8d91('0x2f')]]=_0x425a17;_[_0x8d91('0x30')](_0x418187[_0x8d91('0x31')],_0x546ae9);}return _0x4e160f[_0x8d91('0x1d')](_0x8d91('0x32'))[_0x8d91('0x21')](_0x418187,_0x48c163)[_0x8d91('0x22')]()['then'](function(_0x585080){if(_0x585080&&_0x585080[_0x8d91('0x24')]){return _0x585080;}else{var _0x621e88=_[_0x8d91('0x2e')](_0x1071ce);if(_0x4d04d8[_0x8d91('0x33')]){var _0xa3f7b8={};_0xa3f7b8[_0x4d04d8['additionalSearchLead']]=_0x425a17;_[_0x8d91('0x30')](_0x621e88[_0x8d91('0x31')],_0xa3f7b8);}return _0x4e160f[_0x8d91('0x1d')](_0x8d91('0x34'))[_0x8d91('0x21')](_0x621e88,_0x48c163);}});case _0x8d91('0x35'):var _0x28052f=_[_0x8d91('0x2e')](_0x1071ce);if(_0x4d04d8['additionalSearchAccount']){var _0x546ae9={};_0x546ae9[_0x4d04d8[_0x8d91('0x36')]]=_0x425a17;_[_0x8d91('0x30')](_0x28052f[_0x8d91('0x31')],_0x546ae9);}return _0x4e160f['sobject']('Account')[_0x8d91('0x21')](_0x28052f,_0x48c163)[_0x8d91('0x22')]()[_0x8d91('0x23')](function(_0x51fcd9){if(_0x51fcd9&&_0x51fcd9['length']){return _0x51fcd9;}else{var _0x3c650e=_['cloneDeep'](_0x1071ce);if(_0x4d04d8[_0x8d91('0x2f')]){var _0x9303d5={};_0x9303d5[_0x4d04d8[_0x8d91('0x2f')]]=_0x425a17;_['merge'](_0x3c650e[_0x8d91('0x31')],_0x9303d5);}return _0x4e160f[_0x8d91('0x1d')]('Contact')[_0x8d91('0x21')](_0x3c650e,_0x48c163)[_0x8d91('0x23')](function(_0x37d1c0){if(_0x37d1c0&&_0x37d1c0[_0x8d91('0x24')]){return _0x37d1c0;}else{var _0x4591c1=_[_0x8d91('0x2e')](_0x1071ce);if(_0x4d04d8[_0x8d91('0x33')]){var _0x59e9ed={};_0x59e9ed[_0x4d04d8[_0x8d91('0x33')]]=_0x425a17;_[_0x8d91('0x30')](_0x4591c1[_0x8d91('0x31')],_0x59e9ed);}return _0x4e160f[_0x8d91('0x1d')](_0x8d91('0x34'))[_0x8d91('0x21')](_0x4591c1,_0x48c163);}});}});case _0x8d91('0x14'):var _0x418187=_[_0x8d91('0x2e')](_0x1071ce);if(_0x4d04d8['additionalSearchContact']){var _0x546ae9={};_0x546ae9[_0x4d04d8['additionalSearchContact']]=_0x425a17;_[_0x8d91('0x30')](_0x418187[_0x8d91('0x31')],_0x546ae9);}return _0x4e160f[_0x8d91('0x1d')](_0x8d91('0x32'))[_0x8d91('0x21')](_0x418187,_0x48c163)[_0x8d91('0x22')]();case _0x8d91('0x15'):var _0xe2132a=_['cloneDeep'](_0x1071ce);if(_0x4d04d8['additionalSearchLead']){var _0x546ae9={};_0x546ae9[_0x4d04d8[_0x8d91('0x33')]]=_0x425a17;_['merge'](_0xe2132a[_0x8d91('0x31')],_0x546ae9);}return _0x4e160f[_0x8d91('0x1d')]('Lead')[_0x8d91('0x21')](_0xe2132a,_0x48c163);case _0x8d91('0x17'):var _0x28052f=_[_0x8d91('0x2e')](_0x1071ce);if(_0x4d04d8[_0x8d91('0x36')]){var _0x546ae9={};_0x546ae9[_0x4d04d8[_0x8d91('0x36')]]=_0x425a17;_[_0x8d91('0x30')](_0x28052f[_0x8d91('0x31')],_0x546ae9);}return _0x4e160f[_0x8d91('0x1d')](_0x8d91('0x37'))[_0x8d91('0x21')](_0x28052f,_0x48c163);default:return null;}})[_0x8d91('0x23')](function(_0x320b98){if(_0x320b98&&_0x320b98['length']){var _0x4facc7=_[_0x8d91('0x38')](_0x320b98);if(_0x4facc7){return BPromise[_0x8d91('0x29')]({'id':_0x4facc7['Id'],'name':_0x4facc7[_0x8d91('0x27')],'phone':_0x4facc7[_0x8d91('0x39')],'endUserType':_0x4facc7[_0x8d91('0x3a')][_0x8d91('0x3b')][_0x8d91('0x3c')]()});}}})['then'](function(_0x3ef3f5){if(_0x3ef3f5){logger[_0x8d91('0x1c')](_0x8d91('0x3d'),_0x3ef3f5[_0x8d91('0x13')],_0x425a17);return BPromise[_0x8d91('0x29')](_0x3ef3f5);}else{logger[_0x8d91('0x1c')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x425a17);var _0x556f77={'Phone':_0x425a17};if(_0x4d04d8['moduleCreate']){if(_0x4d04d8[_0x8d91('0x3e')]===_0x8d91('0x14')){logger[_0x8d91('0x1c')](_0x8d91('0x3f'),_0x425a17,_0x4d04d8[_0x8d91('0x3e')]);_0x556f77['LastName']=_0x5e9e43!==_0x8d91('0x40')?_0x5e9e43:util['format']('Caller\x20-\x20%s',_0x425a17);}else if(_0x4d04d8[_0x8d91('0x3e')]===_0x8d91('0x15')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x425a17,_0x4d04d8[_0x8d91('0x3e')]);_0x556f77[_0x8d91('0x41')]=_0x5e9e43!==_0x8d91('0x40')?_0x5e9e43:util[_0x8d91('0x42')]('Caller\x20-\x20%s',_0x425a17);_0x556f77['Company']=_0x8d91('0x43');}else if(_0x4d04d8[_0x8d91('0x3e')]===_0x8d91('0x17')){logger[_0x8d91('0x1c')](_0x8d91('0x3f'),_0x425a17,_0x4d04d8[_0x8d91('0x3e')]);_0x556f77['Name']=_0x5e9e43!==_0x8d91('0x40')?_0x5e9e43:util[_0x8d91('0x42')]('Caller\x20-\x20%s',_0x425a17);}else{return null;}}return _0x4e160f[_0x8d91('0x1d')](_['upperFirst'](_0x4d04d8[_0x8d91('0x3e')]))['create'](_0x556f77)[_0x8d91('0x23')](function(_0x584640){return BPromise[_0x8d91('0x29')]({'id':_0x584640['id'],'endUserType':_0x4d04d8[_0x8d91('0x3e')]});});}});}function getCustomFields(_0xcc001c,_0x26940f){var _0x230504={};if(_0xcc001c[_0x8d91('0x24')]>0x0){_['forEach'](_0xcc001c,function(_0x42c3ba){if(_[_0x8d91('0x44')]([_0x8d91('0x45'),'picklist'],_0x42c3ba[_0x8d91('0x3b')])&&_0x42c3ba['idField']){_0x230504[_0x42c3ba[_0x8d91('0x46')]]=_0x42c3ba['content']['toString']();}else if(_0x42c3ba[_0x8d91('0x3b')]==='variable'&&_0x42c3ba[_0x8d91('0x47')]&&_0x42c3ba[_0x8d91('0x46')]){_0x26940f[_0x42c3ba['variableName']]&&(_0x230504[_0x42c3ba[_0x8d91('0x46')]]=_0x26940f[_0x42c3ba[_0x8d91('0x47')]][_0x8d91('0x48')]());}else if(_0x42c3ba[_0x8d91('0x3b')]===_0x8d91('0x49')&&_0x42c3ba[_0x8d91('0x4a')]&&_0x42c3ba[_0x8d91('0x4a')]['name']&&_0x42c3ba['idField']){_0x26940f[_0x42c3ba[_0x8d91('0x4a')][_0x8d91('0x4b')][_0x8d91('0x3c')]()]&&(_0x230504[_0x42c3ba[_0x8d91('0x46')]]=_0x26940f[_0x42c3ba[_0x8d91('0x4a')][_0x8d91('0x4b')][_0x8d91('0x3c')]()][_0x8d91('0x48')]());}});}return _0x230504;}function getConnection(_0x136b3b){var _0x592807=_0x136b3b[_0x8d91('0x4c')][_0x8d91('0x4d')](_0x136b3b['securityToken']);var _0x1a07b5=new jsforce['Connection']({'oauth2':{'loginUrl':_0x136b3b[_0x8d91('0x4e')]||_0x8d91('0x4f'),'clientId':_0x136b3b['clientId'],'clientSecret':_0x136b3b[_0x8d91('0x50')]}});return _0x1a07b5['login'](_0x136b3b[_0x8d91('0x51')],_0x592807)['then'](function(){logger[_0x8d91('0x1c')](_0x8d91('0x52'));return _0x1a07b5;});}exports[_0x8d91('0x53')]=function(_0x1b9a16,_0x22644a,_0x3a9e9c,_0x3b9b41,_0x329f6b,_0x4566d8){var _0x47acac,_0x24ce7a,_0x24aa4c,_0x2fb624;_0x4566d8[_0x8d91('0x54')]=intUtil['stripTrailingSlash'](_0x4566d8[_0x8d91('0x54')]);_0x4566d8[_0x8d91('0x4e')]=intUtil[_0x8d91('0x55')](_0x4566d8[_0x8d91('0x4e')]);if(_0x329f6b&&_0x329f6b['monitor_format']){logger['info']('[QUEUE]',_0x8d91('0x56'));_0x22644a[_0x8d91('0x57')]=util[_0x8d91('0x42')](_0x8d91('0x58'),_0x4566d8[_0x8d91('0x54')],_0x22644a[_0x8d91('0x59')],md5(_0x22644a[_0x8d91('0x59')]));}else{_0x22644a['recordingURL']='';}return getConnection(_0x4566d8)[_0x8d91('0x23')](function(_0x316fe8){_0x2fb624=_0x316fe8;return getUser(_0x4566d8,_0x3b9b41[_0x8d91('0x5a')],_0x2fb624);})[_0x8d91('0x23')](function(_0xe37bea){_0x47acac=_0xe37bea;return getEndUser(_0x4566d8,_0x3a9e9c,_0x22644a[_0x8d91('0x5b')],_0x22644a[_0x8d91('0x5c')],_0x2fb624);})[_0x8d91('0x23')](function(_0x546104){_0x24ce7a=_0x546104;return getTicket(_0x4566d8,_0x47acac,_0x24ce7a,_0x3a9e9c,_0x22644a,_0x3a9e9c[_0x8d91('0x5d')],_0x2fb624,_0x8d91('0x53'));})['then'](function(_0x579c68){_0x24aa4c=_0x579c68;logger['info'](_0x8d91('0x5e'),_0x24aa4c['id']);logger[_0x8d91('0x1c')](_0x8d91('0x5f'),_0x24aa4c['id'],_0x3b9b41[_0x8d91('0x4b')],_0x4566d8[_0x8d91('0x3b')]);switch(_0x4566d8['type']){case _0x8d91('0x60'):emit(util['format'](_0x8d91('0x61'),_0x3b9b41[_0x8d91('0x4b')]),_0x8d91('0x62'),{'recordId':_0x24aa4c['id']});break;case'newTab':emit(util['format'](_0x8d91('0x61'),_0x3b9b41[_0x8d91('0x4b')]),'trigger:browser:url',{'uri':util[_0x8d91('0x42')](_0x8d91('0x63'),_0x2fb624[_0x8d91('0x64')],_0x24aa4c['id'])});break;default:logger[_0x8d91('0x65')](_0x8d91('0x66'));}})['catch'](function(_0x336455){logger[_0x8d91('0x65')]('[QUEUE]',_0x336455);});};exports[_0x8d91('0x67')]=function(_0xff4571,_0x4ce19b,_0x50f66f,_0x3899fe,_0x1f6e75,_0x55bf3c,_0x3f79fb){var _0x2dad7e,_0x489444,_0x5490d7,_0x407fee;_0x55bf3c[_0x8d91('0x54')]=intUtil[_0x8d91('0x55')](_0x55bf3c[_0x8d91('0x54')]);_0x55bf3c[_0x8d91('0x4e')]=intUtil[_0x8d91('0x55')](_0x55bf3c['remoteUri']);if(_0x3f79fb&&_0x3f79fb['recordingFormat']&&_0x3f79fb[_0x8d91('0x68')]!==_0x8d91('0x69')){logger[_0x8d91('0x1c')]('[OUTBOUND]',_0x8d91('0x56'));_0x4ce19b[_0x8d91('0x57')]=util[_0x8d91('0x42')](_0x8d91('0x58'),_0x55bf3c[_0x8d91('0x54')],_0x4ce19b[_0x8d91('0x59')],md5(_0x4ce19b[_0x8d91('0x59')]));}return getConnection(_0x55bf3c)[_0x8d91('0x23')](function(_0x5e56c6){_0x407fee=_0x5e56c6;return getUser(_0x55bf3c,_0x3899fe[_0x8d91('0x5a')],_0x407fee);})['then'](function(_0x14fd81){_0x2dad7e=_0x14fd81;return getEndUser(_0x55bf3c,_0x50f66f,_0x4ce19b[_0x8d91('0x6a')],_0x4ce19b[_0x8d91('0x6b')],_0x407fee);})[_0x8d91('0x23')](function(_0x3989b2){_0x489444=_0x3989b2;return getTicket(_0x55bf3c,_0x2dad7e,_0x489444,_0x50f66f,_0x4ce19b,_0x50f66f['Fields'],_0x407fee,_0x8d91('0x67'));})[_0x8d91('0x23')](function(_0x2b5985){_0x5490d7=_0x2b5985;logger[_0x8d91('0x1c')](_0x8d91('0x6c'),_0x5490d7['id']);logger[_0x8d91('0x1c')](_0x8d91('0x6d'),_0x5490d7['id'],_0x3899fe[_0x8d91('0x4b')],_0x55bf3c[_0x8d91('0x3b')]);switch(_0x55bf3c[_0x8d91('0x3b')]){case'integrationTab':emit(util[_0x8d91('0x42')]('user:%s',_0x3899fe['name']),_0x8d91('0x62'),{'recordId':_0x5490d7['id']});break;case _0x8d91('0x6e'):emit(util[_0x8d91('0x42')](_0x8d91('0x61'),_0x3899fe[_0x8d91('0x4b')]),_0x8d91('0x6f'),{'uri':util[_0x8d91('0x42')]('%s/%s/e',_0x407fee[_0x8d91('0x64')],_0x5490d7['id'])});break;default:logger['error'](_0x8d91('0x70'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x8d91('0x71')](function(_0x3efc6a){logger['error'](_0x8d91('0x70'),_0x3efc6a);});};exports[_0x8d91('0x72')]=function(_0x43e825,_0x698b4,_0x212813,_0x2d47b6,_0x1b12c3,_0x3bcb3f){var _0xbf93c0,_0x1a2a83,_0xdfd1ea,_0x175d0e;_0x3bcb3f[_0x8d91('0x54')]=intUtil['stripTrailingSlash'](_0x3bcb3f[_0x8d91('0x54')]);_0x3bcb3f['remoteUri']=intUtil[_0x8d91('0x55')](_0x3bcb3f[_0x8d91('0x4e')]);if(_0x1b12c3&&_0x1b12c3[_0x8d91('0x73')]){logger[_0x8d91('0x1c')]('['+_0x698b4[_0x8d91('0x74')][_0x8d91('0x75')]()+']',_0x8d91('0x56'));_0x698b4[_0x8d91('0x57')]=util[_0x8d91('0x42')](_0x8d91('0x58'),_0x3bcb3f[_0x8d91('0x54')],_0x698b4['uniqueid'],md5(_0x698b4['uniqueid']));}else{_0x698b4[_0x8d91('0x57')]='';}return getConnection(_0x3bcb3f)['then'](function(_0xac2e51){_0x175d0e=_0xac2e51;if(!_[_0x8d91('0x1e')](_0x2d47b6)){return getUser(_0x3bcb3f,_0x2d47b6[_0x8d91('0x4b')],_0x175d0e);}else{return getUser(_0x3bcb3f,null,_0x175d0e);}})[_0x8d91('0x23')](function(_0x3b304b){_0xbf93c0=_0x3b304b;return getEndUser(_0x3bcb3f,_0x212813,_0x698b4['calleridname'],_0x698b4['calleridnum'],_0x175d0e);})[_0x8d91('0x23')](function(_0x54619e){_0x1a2a83=_0x54619e;return getTicket(_0x3bcb3f,_0xbf93c0,_0x1a2a83,_0x212813,_0x698b4,_0x212813[_0x8d91('0x5d')],_0x175d0e);})[_0x8d91('0x23')](function(_0x5bbd98){_0xdfd1ea=_0x5bbd98;logger['info']('['+_0x698b4[_0x8d91('0x74')][_0x8d91('0x75')]()+_0x8d91('0x76'),_0xdfd1ea['id']);logger['info']('['+_0x698b4[_0x8d91('0x74')][_0x8d91('0x75')]()+_0x8d91('0x77'),_0x3bcb3f[_0x8d91('0x3b')]);})[_0x8d91('0x71')](function(_0x545697){logger[_0x8d91('0x65')]('['+_0x698b4[_0x8d91('0x74')]['toUpperCase']()+']',_0x545697);});}; \ 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 c78c339..6f3e3ed 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 _0xda2d=[']\x20getTicket\x20crm','POST','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','emit','trigger:browser:url','username','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','true','sys_id','adminId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','nameField','toLowerCase','content','toString','string','type','customField','idField','variable','variableName','customVariable','Variable','name','userId','incident','assign','Subjects','getString','Descriptions','Fields','ticketId','ticketNumber'];(function(_0x1ecac4,_0x1951a6){var _0x14990e=function(_0x26f606){while(--_0x26f606){_0x1ecac4['push'](_0x1ecac4['shift']());}};_0x14990e(++_0x1951a6);}(_0xda2d,0x102));var _0xdda2=function(_0x2a9d5a,_0x3aab11){_0x2a9d5a=_0x2a9d5a-0x0;var _0x362744=_0xda2d[_0x2a9d5a];return _0x362744;};'use strict';var _=require('lodash');var Promise=require(_0xdda2('0x0'));var rp=require(_0xdda2('0x1'));var util=require(_0xdda2('0x2'));var md5=require(_0xdda2('0x3'));var Redis=require(_0xdda2('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xdda2('0x5'));config[_0xdda2('0x6')]=_[_0xdda2('0x7')](config[_0xdda2('0x6')],{'host':_0xdda2('0x8'),'port':0x18eb});var io=require(_0xdda2('0x9'))(new Redis(config[_0xdda2('0x6')]));function getAdminUser(_0x436676,_0x2e2523,_0x341c7b,_0x4a97f3,_0x1a774e,_0x22c6e5){return new Promise(function(_0x4df6b8,_0x1c11b2){var _0x2f3454={'method':_0xdda2('0xa'),'uri':_0x4a97f3+_0xdda2('0xb')+'&'+_0x1a774e+'&'+_0x22c6e5,'auth':_0x2e2523,'json':!![]};return rp(_0x2f3454)[_0xdda2('0xc')](function(_0x30ca9a){if(_0x30ca9a[_0xdda2('0xd')][_0xdda2('0xe')]>0x0){_0x341c7b['adminId']=_0x30ca9a['result'][0x0]['sys_id'];}logger[_0xdda2('0xf')]('['+[_0x436676[_0xdda2('0x10')]()]+_0xdda2('0x11'),_0x341c7b);_0x4df6b8(_0x341c7b);})[_0xdda2('0x12')](function(_0x2e4132){logger[_0xdda2('0x13')]('['+[_0x436676[_0xdda2('0x10')]()]+']',_0x2e4132['message']);_0x1c11b2(_0x2e4132[_0xdda2('0x14')]);});});}function getUser(_0x4b0220,_0xbef148,_0xb6b01e,_0x3553d5,_0x457764){return function(_0x1922b1){logger['info']('['+[_0x4b0220['toUpperCase']()]+_0xdda2('0x15'),_0x1922b1);return new Promise(function(_0x518c6d,_0x1a5192){if(intUtil[_0xdda2('0x16')](_0x1922b1[_0xdda2('0x17')])){var _0x2b6ee8={'method':_0xdda2('0xa'),'uri':_0xb6b01e+_0xdda2('0x18')+_0x1922b1[_0xdda2('0x17')]+'&'+_0x3553d5+'&'+_0x457764,'auth':_0xbef148,'json':!![]};logger[_0xdda2('0xf')]('['+[_0x4b0220[_0xdda2('0x10')]()]+_0xdda2('0x19'),_0x2b6ee8);return rp(_0x2b6ee8)[_0xdda2('0xc')](function(_0x6fdede){logger['info']('['+[_0x4b0220[_0xdda2('0x10')]()]+'],\x20getUser\x20entity',_0x6fdede);if(_0x6fdede[_0xdda2('0xd')][_0xdda2('0xe')]>0x0&&String(_0x6fdede[_0xdda2('0xd')][0x0]['active'])===_0xdda2('0x1a')){_0x1922b1['userId']=_0x6fdede[_0xdda2('0xd')][0x0][_0xdda2('0x1b')];}else{_0x1922b1['userId']=_0x1922b1[_0xdda2('0x1c')];_0x1922b1[_0xdda2('0x17')]=_0x1922b1[_0xdda2('0x1d')];}logger[_0xdda2('0xf')]('['+[_0x4b0220[_0xdda2('0x10')]()]+'],\x20getUser\x20crm',_0x1922b1);_0x518c6d(_0x1922b1);})[_0xdda2('0x12')](function(_0x4be5ea){logger[_0xdda2('0x13')]('['+[_0x4b0220[_0xdda2('0x10')]()]+']',_0x4be5ea['message']);_0x1a5192(_0x4be5ea['message']);});}else{logger[_0xdda2('0xf')]('['+[_0x4b0220[_0xdda2('0x10')]()]+_0xdda2('0x1e'));_0x1922b1['userId']=_0x1922b1[_0xdda2('0x1c')];_0x1922b1[_0xdda2('0x17')]=_0x1922b1[_0xdda2('0x1d')];_0x518c6d(_0x1922b1);}});};}function createEndUser(_0xe53dee,_0xe16ec7,_0x91b41a,_0x4bb8a4,_0x24c37d){logger[_0xdda2('0xf')]('['+[_0xe53dee['toUpperCase']()]+_0xdda2('0x1f'),_0x91b41a);return new Promise(function(_0x2cfaca,_0x3b18b8){var _0x15e511={'method':'POST','uri':_0x4bb8a4+_0xdda2('0x20')+_0x24c37d,'body':{'user_name':_0x91b41a[_0xdda2('0x21')],'roles':'user','first_name':_0x91b41a[_0xdda2('0x21')],'active':'true','date_format':_0xdda2('0x22'),'phone':_0x91b41a['endUserNumber']},'auth':_0xe16ec7,'json':!![]};return rp(_0x15e511)['then'](function(_0x510b7b){logger[_0xdda2('0xf')]('['+[_0xe53dee['toUpperCase']()]+_0xdda2('0x23'),_0x510b7b['result']);_0x91b41a['endUserId']=_0x510b7b['result'][_0xdda2('0x1b')];_0x2cfaca(_0x91b41a);})[_0xdda2('0x12')](function(_0xca6046){logger[_0xdda2('0x13')]('['+[_0xe53dee[_0xdda2('0x10')]()]+']',_0xca6046[_0xdda2('0x14')]);_0x3b18b8(_0xca6046[_0xdda2('0x14')]);});});}function getEndUser(_0x1426fd,_0x3cddbd,_0x2bcf47,_0x4a32ea,_0x461621){return function(_0x4212da){logger[_0xdda2('0xf')]('['+[_0x1426fd[_0xdda2('0x10')]()]+_0xdda2('0x24'),_0x4212da);return new Promise(function(_0x33c4b0,_0x45d3ad){var _0x5835cd={'method':'GET','uri':_0x2bcf47+_0xdda2('0x25')+_0x4212da[_0xdda2('0x21')]+'&'+_0x4a32ea+'&'+_0x461621,'auth':_0x3cddbd,'json':!![]};return rp(_0x5835cd)[_0xdda2('0xc')](function(_0x4811d2){if(_0x4811d2['result'][_0xdda2('0xe')]>0x0){_0x4212da[_0xdda2('0x26')]=_0x4811d2[_0xdda2('0xd')][0x0][_0xdda2('0x1b')];logger[_0xdda2('0xf')]('['+[_0x1426fd['toUpperCase']()]+_0xdda2('0x27'),_0x4212da);_0x33c4b0(_0x4212da);}else{return createEndUser(_0x1426fd,_0x3cddbd,_0x4212da,_0x2bcf47,_0x4a32ea)[_0xdda2('0xc')](function(_0x497302){logger['info']('['+[_0x1426fd[_0xdda2('0x10')]()]+_0xdda2('0x28'),_0x497302);_0x33c4b0(_0x497302);});}})[_0xdda2('0x12')](function(_0x2708f4){logger[_0xdda2('0x13')]('['+[_0x1426fd['toUpperCase']()]+']',_0x2708f4[_0xdda2('0x14')]);_0x45d3ad(_0x2708f4[_0xdda2('0x14')]);});});};}function getCustomFields(_0x7dac2c,_0x1a7262){var _0x50c4ae={};if(_0x7dac2c['length']>0x0){_[_0xdda2('0x29')](_0x7dac2c,function(_0x2e0524){if(_[_0xdda2('0x2a')](['string',_0xdda2('0x2b')],_0x2e0524['type'])&&_0x2e0524[_0xdda2('0x2c')]&&!_0x2e0524['customField']){_0x50c4ae[_0x2e0524[_0xdda2('0x2c')][_0xdda2('0x2d')]()]=_0x2e0524[_0xdda2('0x2e')][_0xdda2('0x2f')]();}else if(_['includes']([_0xdda2('0x30'),'picklist'],_0x2e0524[_0xdda2('0x31')])&&_0x2e0524['idField']&&_0x2e0524[_0xdda2('0x32')]){_0x50c4ae[_0x2e0524[_0xdda2('0x33')][_0xdda2('0x2d')]()]=_0x2e0524[_0xdda2('0x2e')][_0xdda2('0x2f')]();}else if(_0x2e0524['type']===_0xdda2('0x34')&&_0x2e0524[_0xdda2('0x35')]&&_0x2e0524['idField']&&_0x2e0524[_0xdda2('0x32')]){_0x50c4ae[_0x2e0524['idField'][_0xdda2('0x2d')]()]=_0x1a7262[_0x2e0524[_0xdda2('0x35')]][_0xdda2('0x2f')]();}else if(_0x2e0524[_0xdda2('0x31')]===_0xdda2('0x36')&&_0x2e0524[_0xdda2('0x37')]&&_0x2e0524[_0xdda2('0x37')][_0xdda2('0x38')]&&_0x2e0524[_0xdda2('0x33')]&&_0x2e0524[_0xdda2('0x32')]){_0x50c4ae[_0x2e0524[_0xdda2('0x33')][_0xdda2('0x2d')]()]=_0x1a7262[_0x2e0524[_0xdda2('0x37')]['name']['toLowerCase']()]['toString']();}});}return _0x50c4ae;}function getTicket(_0x36573e,_0x383536,_0x57b7b0,_0x2c41dc,_0x18f229,_0x22a99e){return function(_0x5e56a8){logger[_0xdda2('0xf')]('['+[_0x36573e[_0xdda2('0x10')]()]+']\x20getTicket\x20input\x20crm',_0x5e56a8);return new Promise(function(_0x5f0aa8,_0x37422b){var _0x5efd20=_0x36573e[_0xdda2('0x2d')]()==='outbound'?_0x5e56a8[_0xdda2('0x39')]:_0x5e56a8[_0xdda2('0x26')];var _0x50bd88={'method':'POST','uri':_0x57b7b0+_0xdda2('0x3a')+'?'+_0x22a99e,'body':Object[_0xdda2('0x3b')]({},{'active':_0xdda2('0x1a'),'caller_id':_0x5efd20,'assigned_to':_0x5e56a8[_0xdda2('0x39')],'short_description':intUtil['getString'](_0x2c41dc[_0xdda2('0x3c')],_0x18f229,'\x20'),'description':intUtil[_0xdda2('0x3d')](_0x2c41dc[_0xdda2('0x3e')],_0x18f229,'\x0a')},getCustomFields(_0x2c41dc[_0xdda2('0x3f')],_0x18f229)),'auth':_0x383536,'json':!![]};return rp(_0x50bd88)[_0xdda2('0xc')](function(_0x55528b){logger[_0xdda2('0xf')]('['+[_0x36573e[_0xdda2('0x10')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x55528b[_0xdda2('0xd')]);_0x5e56a8[_0xdda2('0x40')]=_0x55528b[_0xdda2('0xd')][_0xdda2('0x1b')];_0x5e56a8[_0xdda2('0x41')]=_0x55528b[_0xdda2('0xd')]['number'];logger[_0xdda2('0xf')]('['+[_0x36573e['toUpperCase']()]+_0xdda2('0x42'),_0x5e56a8);_0x5f0aa8(_0x5e56a8);})['catch'](function(_0x3d6290){logger['error']('['+[_0x36573e[_0xdda2('0x10')]()]+']',_0x3d6290[_0xdda2('0x14')]);_0x37422b(_0x3d6290[_0xdda2('0x14')]);});});};}function createRemoteTag(_0x119f70,_0xfc7dd7,_0x2b45f3,_0x471b86){return new Promise(function(_0x40655d,_0x538ebb){var _0x477982={'method':_0xdda2('0x43'),'uri':_0x2b45f3+_0xdda2('0x44')+'?'+_0x471b86,'body':{'short_description':_0x119f70,'global':!![],'active':!![],'name':_0x119f70},'auth':_0xfc7dd7,'json':!![]};return rp(_0x477982)['then'](function(_0xf380b0){var _0x1c2d24=_0xf380b0['result'][_0xdda2('0x1b')];_0x40655d(_0x1c2d24);});});}function getRemoteTag(_0x5d9437,_0x13af7f,_0x10fbac,_0x378704,_0xbfab73){return new Promise(function(_0xb9c8e7,_0x4fd561){var _0x4bc1e9={'method':'GET','uri':_0x10fbac+_0xdda2('0x44')+_0xdda2('0x45')+_0x5d9437+'&'+_0x378704,'auth':_0x13af7f,'json':!![]};return rp(_0x4bc1e9)['then'](function(_0x44637d){if(_0x44637d[_0xdda2('0xd')][_0xdda2('0xe')]>0x0){var _0x4b067e=_0x44637d[_0xdda2('0xd')][0x0][_0xdda2('0x1b')];_0xb9c8e7(_0x4b067e);}else{return createRemoteTag(_0x5d9437,_0x13af7f,_0x10fbac,_0x378704)[_0xdda2('0xc')](function(_0x58ae15){_0xb9c8e7(_0x58ae15);});}});});}function assignTagToIncident(_0x2b2c1d,_0x4495e5,_0x7eb83f,_0x25c9a9,_0x5d8602){return new Promise(function(_0x4645f8,_0x4c94a3){var _0x494b81={'method':'POST','uri':_0x7eb83f+_0xdda2('0x46')+'?'+_0x5d8602,'body':{'label':_0x2b2c1d,'table':_0xdda2('0x3a'),'id_type':_0xdda2('0x47'),'table_key':_0x25c9a9[_0xdda2('0x40')],'title':_0xdda2('0x48')+_0x25c9a9[_0xdda2('0x41')],'id_display':_0x25c9a9[_0xdda2('0x41')]},'auth':_0x4495e5,'json':!![]};return rp(_0x494b81)[_0xdda2('0xc')](function(_0x269ad1){_0x4645f8();})[_0xdda2('0x12')](function(){_0x4645f8();});});}function manageTags(_0x26e7de,_0x5e6dcf,_0x215e2a,_0x173022,_0x266ec0,_0xd8c180,_0x90bb5c){return new Promise(function(_0x21a630,_0x2affc6){var _0x57fb41=[];_0x5e6dcf[_0xdda2('0x29')](function(_0x2afcae){_0x57fb41[_0xdda2('0x49')](getRemoteTag(_0x2afcae,_0x215e2a,_0x173022,_0xd8c180,_0x90bb5c));});return Promise[_0xdda2('0x4a')](_0x57fb41)[_0xdda2('0xc')](function(_0x5c9b02){if(_0x5c9b02[_0xdda2('0xe')]){logger[_0xdda2('0xf')]('['+[_0x26e7de[_0xdda2('0x10')]()]+_0xdda2('0x4b'),_0x5c9b02);var _0x21d0e4=[];_0x5c9b02['forEach'](function(_0x17aaab){_0x21d0e4[_0xdda2('0x49')](assignTagToIncident(_0x17aaab,_0x215e2a,_0x173022,_0x266ec0,_0xd8c180));});return Promise[_0xdda2('0x4a')](_0x21d0e4)[_0xdda2('0xc')](function(){_0x21a630();})[_0xdda2('0x12')](function(){_0x21a630();});}else{_0x21a630();}});});}function getTags(_0x5d34d7,_0x29dd19,_0x3d7951,_0x20e5ab,_0x54ac4b,_0x1b7b96){return function(_0x483c17){return new Promise(function(_0x3cc35c,_0x41b681){var _0x646bab=[];var _0x5c351c=_0x20e5ab[_0xdda2('0x4c')];if(_0x5c351c&&_0x5c351c[_0xdda2('0xe')]>0x0){_0x646bab=_['map'](_0x5c351c,_0xdda2('0x38'));}if(_0x646bab['length']>0x0){return manageTags(_0x5d34d7,_0x646bab,_0x29dd19,_0x3d7951,_0x483c17,_0x54ac4b,_0x1b7b96)[_0xdda2('0xc')](function(){_0x3cc35c(_0x483c17);});}else{_0x3cc35c(_0x483c17);}});};}function emit(_0xc97cb1,_0x354fb9,_0x29cf1a){var _0x10d1de='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xdda2('0x4d')+_0xdda2('0x4e');var _0x547fbd={'uri':_0xc97cb1+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x29cf1a+_0x10d1de};io['to'](util[_0xdda2('0x4f')]('user:%s',_0x354fb9))[_0xdda2('0x50')](_0xdda2('0x51'),_0x547fbd);}exports['cs']=function(_0x4910a6,_0x263f6d,_0x156c00,_0xdcd08c,_0x4739c4,_0x694386,_0x37f5cd,_0x4eebb0){var _0x7764df={};var _0x22de37={'user':_0x694386[_0xdda2('0x52')],'pass':_0x694386['password']};var _0x27780e=_0xdda2('0x53');var _0x51963f='sysparm_display_value=true';_0x694386[_0xdda2('0x54')]=intUtil[_0xdda2('0x55')](_0x694386[_0xdda2('0x54')]);_0x694386['serverUrl']=intUtil['stripTrailingSlash'](_0x694386[_0xdda2('0x56')]);var _0x5261ed=util[_0xdda2('0x4f')](_0xdda2('0x57'),_0x694386[_0xdda2('0x54')]);_0x7764df[_0xdda2('0x17')]=!_[_0xdda2('0x58')](_0xdcd08c)?_0xdcd08c[_0xdda2('0x59')]:null;_0x7764df['adminEmail']=_0x694386['email'];_0x7764df[_0xdda2('0x21')]=_0x4eebb0['toLowerCase']()===_0xdda2('0x5a')?_0x263f6d[_0xdda2('0x5b')]:_0x263f6d[_0xdda2('0x5c')];_0x7764df[_0xdda2('0x5d')]=_0x4eebb0===_0xdda2('0x5e')||_0x4eebb0===_0xdda2('0x5f')?_0xdda2('0x5e'):_0xdda2('0x5a');var _0x37c547=util['format'](_0xdda2('0x60'),_0x694386[_0xdda2('0x56')],_0x263f6d[_0xdda2('0x61')],md5(_0x263f6d[_0xdda2('0x61')]));if(_0x4739c4&&_0x4739c4['monitor_format']){logger[_0xdda2('0xf')](_0xdda2('0x62'),_0xdda2('0x63'));_0x263f6d[_0xdda2('0x64')]=_0x37c547;}else if(_0x37f5cd&&_0x37f5cd['recordingFormat']&&_0x37f5cd['recordingFormat']!==_0xdda2('0x65')){logger[_0xdda2('0xf')](_0xdda2('0x66'),_0xdda2('0x63'));_0x263f6d['recordingURL']=_0x37c547;}else{_0x263f6d[_0xdda2('0x64')]='';}return getAdminUser(_0x4eebb0,_0x22de37,_0x7764df,_0x5261ed,_0x51963f,_0x27780e)[_0xdda2('0xc')](getUser(_0x4eebb0,_0x22de37,_0x5261ed,_0x51963f,_0x27780e))[_0xdda2('0xc')](getEndUser(_0x4eebb0,_0x22de37,_0x5261ed,_0x51963f,_0x27780e))[_0xdda2('0xc')](getTicket(_0x4eebb0,_0x22de37,_0x5261ed,_0x156c00,_0x263f6d,_0x51963f))[_0xdda2('0xc')](function(_0x1f77bd){logger[_0xdda2('0xf')](util[_0xdda2('0x4f')](_0xdda2('0x67'),_0x1f77bd[_0xdda2('0x40')]));logger[_0xdda2('0xf')](util[_0xdda2('0x4f')](_0xdda2('0x68'),_0x4eebb0));if(_0x4eebb0!==_0xdda2('0x5f')){logger[_0xdda2('0xf')]('['+[_0x4eebb0['toUpperCase']()]+']',_0xdda2('0x69'));emit(_0x694386[_0xdda2('0x54')],_0xdcd08c['name'],_0x1f77bd['ticketId']);}})[_0xdda2('0x12')](function(_0x40fd4c){logger[_0xdda2('0x13')]('['+[_0x4eebb0[_0xdda2('0x10')]()]+_0xdda2('0x6a'),util[_0xdda2('0x6b')](_0x40fd4c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb016=['none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','localhost','then','result','adminId','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','userId','sys_id','adminEmail','],\x20getUser\x20crm','message',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','GET','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','variableName','Variable','name','toString',']\x20getTicket\x20input\x20crm','getString','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','incident','Incident','Incident\x20-\x20','ticketNumber','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','outbound','destcalleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingFormat'];(function(_0x6f1b1c,_0x623e1a){var _0x424ee8=function(_0x1fcd8f){while(--_0x1fcd8f){_0x6f1b1c['push'](_0x6f1b1c['shift']());}};_0x424ee8(++_0x623e1a);}(_0xb016,0x159));var _0x6b01=function(_0x20f32b,_0x333dc9){_0x20f32b=_0x20f32b-0x0;var _0x12a98d=_0xb016[_0x20f32b];return _0x12a98d;};'use strict';var _=require(_0x6b01('0x0'));var Promise=require(_0x6b01('0x1'));var rp=require('request-promise');var util=require('util');var md5=require(_0x6b01('0x2'));var Redis=require('ioredis');var intUtil=require(_0x6b01('0x3'));var config=require(_0x6b01('0x4'));var logger=require(_0x6b01('0x5'))(_0x6b01('0x6'));config['redis']=_[_0x6b01('0x7')](config[_0x6b01('0x8')],{'host':_0x6b01('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x374aab,_0x39f9fa,_0x526a7d,_0x5f4636,_0x92bf23,_0x1cb3a6){return new Promise(function(_0x2c4e48,_0x242394){var _0xab37c={'method':'GET','uri':_0x5f4636+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x92bf23+'&'+_0x1cb3a6,'auth':_0x39f9fa,'json':!![]};return rp(_0xab37c)[_0x6b01('0xa')](function(_0x24049f){if(_0x24049f[_0x6b01('0xb')]['length']>0x0){_0x526a7d[_0x6b01('0xc')]=_0x24049f['result'][0x0]['sys_id'];}logger[_0x6b01('0xd')]('['+[_0x374aab['toUpperCase']()]+_0x6b01('0xe'),_0x526a7d);_0x2c4e48(_0x526a7d);})[_0x6b01('0xf')](function(_0x47c09f){logger[_0x6b01('0x10')]('['+[_0x374aab['toUpperCase']()]+']',_0x47c09f['message']);_0x242394(_0x47c09f['message']);});});}function getUser(_0x3d4666,_0x4cbd38,_0x5b2f60,_0x3a259f,_0x327e86){return function(_0x20dd83){logger[_0x6b01('0xd')]('['+[_0x3d4666[_0x6b01('0x11')]()]+_0x6b01('0x12'),_0x20dd83);return new Promise(function(_0x122769,_0x33ffe8){if(intUtil[_0x6b01('0x13')](_0x20dd83[_0x6b01('0x14')])){var _0x18f336={'method':'GET','uri':_0x5b2f60+_0x6b01('0x15')+_0x20dd83[_0x6b01('0x14')]+'&'+_0x3a259f+'&'+_0x327e86,'auth':_0x4cbd38,'json':!![]};logger[_0x6b01('0xd')]('['+[_0x3d4666[_0x6b01('0x11')]()]+_0x6b01('0x16'),_0x18f336);return rp(_0x18f336)[_0x6b01('0xa')](function(_0x33753f){logger[_0x6b01('0xd')]('['+[_0x3d4666['toUpperCase']()]+_0x6b01('0x17'),_0x33753f);if(_0x33753f[_0x6b01('0xb')][_0x6b01('0x18')]>0x0&&String(_0x33753f[_0x6b01('0xb')][0x0][_0x6b01('0x19')])===_0x6b01('0x1a')){_0x20dd83[_0x6b01('0x1b')]=_0x33753f['result'][0x0][_0x6b01('0x1c')];}else{_0x20dd83[_0x6b01('0x1b')]=_0x20dd83[_0x6b01('0xc')];_0x20dd83['userEmail']=_0x20dd83[_0x6b01('0x1d')];}logger[_0x6b01('0xd')]('['+[_0x3d4666[_0x6b01('0x11')]()]+_0x6b01('0x1e'),_0x20dd83);_0x122769(_0x20dd83);})[_0x6b01('0xf')](function(_0x2456e9){logger[_0x6b01('0x10')]('['+[_0x3d4666[_0x6b01('0x11')]()]+']',_0x2456e9[_0x6b01('0x1f')]);_0x33ffe8(_0x2456e9[_0x6b01('0x1f')]);});}else{logger[_0x6b01('0xd')]('['+[_0x3d4666[_0x6b01('0x11')]()]+_0x6b01('0x20'));_0x20dd83['userId']=_0x20dd83[_0x6b01('0xc')];_0x20dd83[_0x6b01('0x14')]=_0x20dd83[_0x6b01('0x1d')];_0x122769(_0x20dd83);}});};}function createEndUser(_0x21f165,_0x68491,_0x528cbd,_0x54f030,_0x3fae61){logger[_0x6b01('0xd')]('['+[_0x21f165[_0x6b01('0x11')]()]+_0x6b01('0x21'),_0x528cbd);return new Promise(function(_0x2a894e,_0x25d38d){var _0x542ca0={'method':_0x6b01('0x22'),'uri':_0x54f030+'sys_user?'+_0x3fae61,'body':{'user_name':_0x528cbd[_0x6b01('0x23')],'roles':'user','first_name':_0x528cbd[_0x6b01('0x23')],'active':_0x6b01('0x1a'),'date_format':_0x6b01('0x24'),'phone':_0x528cbd[_0x6b01('0x23')]},'auth':_0x68491,'json':!![]};return rp(_0x542ca0)[_0x6b01('0xa')](function(_0x54575c){logger[_0x6b01('0xd')]('['+[_0x21f165[_0x6b01('0x11')]()]+_0x6b01('0x25'),_0x54575c['result']);_0x528cbd['endUserId']=_0x54575c[_0x6b01('0xb')]['sys_id'];_0x2a894e(_0x528cbd);})[_0x6b01('0xf')](function(_0x2f517a){logger[_0x6b01('0x10')]('['+[_0x21f165['toUpperCase']()]+']',_0x2f517a[_0x6b01('0x1f')]);_0x25d38d(_0x2f517a[_0x6b01('0x1f')]);});});}function getEndUser(_0x186a6d,_0x5c0138,_0x45c63f,_0x2ca8d9,_0x375207){return function(_0x2eb34f){logger[_0x6b01('0xd')]('['+[_0x186a6d['toUpperCase']()]+_0x6b01('0x26'),_0x2eb34f);return new Promise(function(_0x20ee6d,_0x1c9744){var _0x5269c7={'method':_0x6b01('0x27'),'uri':_0x45c63f+_0x6b01('0x28')+_0x2eb34f[_0x6b01('0x23')]+'&'+_0x2ca8d9+'&'+_0x375207,'auth':_0x5c0138,'json':!![]};return rp(_0x5269c7)[_0x6b01('0xa')](function(_0x4983ae){if(_0x4983ae[_0x6b01('0xb')]['length']>0x0){_0x2eb34f[_0x6b01('0x29')]=_0x4983ae[_0x6b01('0xb')][0x0][_0x6b01('0x1c')];logger[_0x6b01('0xd')]('['+[_0x186a6d[_0x6b01('0x11')]()]+_0x6b01('0x2a'),_0x2eb34f);_0x20ee6d(_0x2eb34f);}else{return createEndUser(_0x186a6d,_0x5c0138,_0x2eb34f,_0x45c63f,_0x2ca8d9)[_0x6b01('0xa')](function(_0x574910){logger[_0x6b01('0xd')]('['+[_0x186a6d[_0x6b01('0x11')]()]+_0x6b01('0x2b'),_0x574910);_0x20ee6d(_0x574910);});}})[_0x6b01('0xf')](function(_0x1ca3aa){logger[_0x6b01('0x10')]('['+[_0x186a6d[_0x6b01('0x11')]()]+']',_0x1ca3aa[_0x6b01('0x1f')]);_0x1c9744(_0x1ca3aa['message']);});});};}function getCustomFields(_0x2c42c3,_0x55907f){var _0x336a67={};if(_0x2c42c3[_0x6b01('0x18')]>0x0){_['forEach'](_0x2c42c3,function(_0x37ae5d){if(_[_0x6b01('0x2c')]([_0x6b01('0x2d'),_0x6b01('0x2e')],_0x37ae5d[_0x6b01('0x2f')])&&_0x37ae5d[_0x6b01('0x30')]&&!_0x37ae5d[_0x6b01('0x31')]){_0x336a67[_0x37ae5d[_0x6b01('0x30')][_0x6b01('0x32')]()]=_0x37ae5d[_0x6b01('0x33')]['toString']();}else if(_[_0x6b01('0x2c')]([_0x6b01('0x2d'),'picklist'],_0x37ae5d['type'])&&_0x37ae5d[_0x6b01('0x34')]&&_0x37ae5d[_0x6b01('0x31')]){_0x336a67[_0x37ae5d['idField'][_0x6b01('0x32')]()]=_0x37ae5d[_0x6b01('0x33')]['toString']();}else if(_0x37ae5d[_0x6b01('0x2f')]==='variable'&&_0x37ae5d[_0x6b01('0x35')]&&_0x37ae5d[_0x6b01('0x34')]&&_0x37ae5d[_0x6b01('0x31')]){_0x336a67[_0x37ae5d['idField'][_0x6b01('0x32')]()]=_0x55907f[_0x37ae5d[_0x6b01('0x35')]]['toString']();}else if(_0x37ae5d['type']==='customVariable'&&_0x37ae5d[_0x6b01('0x36')]&&_0x37ae5d[_0x6b01('0x36')][_0x6b01('0x37')]&&_0x37ae5d[_0x6b01('0x34')]&&_0x37ae5d[_0x6b01('0x31')]){_0x336a67[_0x37ae5d[_0x6b01('0x34')]['toLowerCase']()]=_0x55907f[_0x37ae5d[_0x6b01('0x36')][_0x6b01('0x37')][_0x6b01('0x32')]()][_0x6b01('0x38')]();}});}return _0x336a67;}function getTicket(_0xc882a7,_0x795429,_0x4fed93,_0x1fd975,_0x58a91a,_0x52b8dd){return function(_0xe09aca){logger[_0x6b01('0xd')]('['+[_0xc882a7['toUpperCase']()]+_0x6b01('0x39'),_0xe09aca);return new Promise(function(_0x27442e,_0x146cc4){var _0x531361=_0xc882a7['toLowerCase']()==='outbound'?_0xe09aca[_0x6b01('0x1b')]:_0xe09aca[_0x6b01('0x29')];var _0x518d94={'method':_0x6b01('0x22'),'uri':_0x4fed93+'incident'+'?'+_0x52b8dd,'body':Object['assign']({},{'active':'true','caller_id':_0x531361,'assigned_to':_0xe09aca[_0x6b01('0x1b')],'short_description':intUtil[_0x6b01('0x3a')](_0x1fd975['Subjects'],_0x58a91a,'\x20'),'description':intUtil['getString'](_0x1fd975[_0x6b01('0x3b')],_0x58a91a,'\x0a')},getCustomFields(_0x1fd975['Fields'],_0x58a91a)),'auth':_0x795429,'json':!![]};return rp(_0x518d94)[_0x6b01('0xa')](function(_0x22bfdd){logger[_0x6b01('0xd')]('['+[_0xc882a7[_0x6b01('0x11')]()]+_0x6b01('0x3c'),_0x22bfdd['result']);_0xe09aca[_0x6b01('0x3d')]=_0x22bfdd[_0x6b01('0xb')][_0x6b01('0x1c')];_0xe09aca['ticketNumber']=_0x22bfdd[_0x6b01('0xb')][_0x6b01('0x3e')];logger['info']('['+[_0xc882a7[_0x6b01('0x11')]()]+_0x6b01('0x3f'),_0xe09aca);_0x27442e(_0xe09aca);})[_0x6b01('0xf')](function(_0x107e3f){logger['error']('['+[_0xc882a7['toUpperCase']()]+']',_0x107e3f[_0x6b01('0x1f')]);_0x146cc4(_0x107e3f['message']);});});};}function createRemoteTag(_0x4f7332,_0x1161e9,_0x14cbed,_0x5b5c0c){return new Promise(function(_0x2bf4b5,_0xaad732){var _0x5c94ae={'method':_0x6b01('0x22'),'uri':_0x14cbed+_0x6b01('0x40')+'?'+_0x5b5c0c,'body':{'short_description':_0x4f7332,'global':!![],'active':!![],'name':_0x4f7332},'auth':_0x1161e9,'json':!![]};return rp(_0x5c94ae)[_0x6b01('0xa')](function(_0x20b14c){var _0x229501=_0x20b14c['result'][_0x6b01('0x1c')];_0x2bf4b5(_0x229501);});});}function getRemoteTag(_0x51ccf0,_0xf50606,_0x331815,_0x415fdd,_0x52fd21){return new Promise(function(_0x9d074c,_0x39060b){var _0x360946={'method':_0x6b01('0x27'),'uri':_0x331815+'label'+_0x6b01('0x41')+_0x51ccf0+'&'+_0x415fdd,'auth':_0xf50606,'json':!![]};return rp(_0x360946)[_0x6b01('0xa')](function(_0x1aa714){if(_0x1aa714['result']['length']>0x0){var _0x465e02=_0x1aa714[_0x6b01('0xb')][0x0][_0x6b01('0x1c')];_0x9d074c(_0x465e02);}else{return createRemoteTag(_0x51ccf0,_0xf50606,_0x331815,_0x415fdd)['then'](function(_0x21b99f){_0x9d074c(_0x21b99f);});}});});}function assignTagToIncident(_0x121546,_0x35fa78,_0x5459d5,_0x54b3ae,_0x75b16f){return new Promise(function(_0x3e4bd3,_0x4ec052){var _0x3e16e8={'method':_0x6b01('0x22'),'uri':_0x5459d5+_0x6b01('0x42')+'?'+_0x75b16f,'body':{'label':_0x121546,'table':_0x6b01('0x43'),'id_type':_0x6b01('0x44'),'table_key':_0x54b3ae[_0x6b01('0x3d')],'title':_0x6b01('0x45')+_0x54b3ae[_0x6b01('0x46')],'id_display':_0x54b3ae[_0x6b01('0x46')]},'auth':_0x35fa78,'json':!![]};return rp(_0x3e16e8)['then'](function(_0x2aa892){_0x3e4bd3();})[_0x6b01('0xf')](function(){_0x3e4bd3();});});}function manageTags(_0x25aa1f,_0x212ad4,_0x12c8ee,_0x38e373,_0x4d710a,_0x289294,_0x281e55){return new Promise(function(_0x5dd77b,_0x3f955d){var _0x25b39b=[];_0x212ad4[_0x6b01('0x47')](function(_0x2888c0){_0x25b39b[_0x6b01('0x48')](getRemoteTag(_0x2888c0,_0x12c8ee,_0x38e373,_0x289294,_0x281e55));});return Promise[_0x6b01('0x49')](_0x25b39b)['then'](function(_0x523102){if(_0x523102[_0x6b01('0x18')]){logger[_0x6b01('0xd')]('['+[_0x25aa1f[_0x6b01('0x11')]()]+_0x6b01('0x4a'),_0x523102);var _0x728ae2=[];_0x523102[_0x6b01('0x47')](function(_0x59bf90){_0x728ae2[_0x6b01('0x48')](assignTagToIncident(_0x59bf90,_0x12c8ee,_0x38e373,_0x4d710a,_0x289294));});return Promise[_0x6b01('0x49')](_0x728ae2)[_0x6b01('0xa')](function(){_0x5dd77b();})[_0x6b01('0xf')](function(){_0x5dd77b();});}else{_0x5dd77b();}});});}function getTags(_0x427843,_0xf31bfa,_0x1e0504,_0x582bff,_0x3ea965,_0x4cb00d){return function(_0x1f83a9){return new Promise(function(_0x4623d9,_0x293340){var _0x48bfcd=[];var _0x297704=_0x582bff[_0x6b01('0x4b')];if(_0x297704&&_0x297704[_0x6b01('0x18')]>0x0){_0x48bfcd=_[_0x6b01('0x4c')](_0x297704,_0x6b01('0x37'));}if(_0x48bfcd[_0x6b01('0x18')]>0x0){return manageTags(_0x427843,_0x48bfcd,_0xf31bfa,_0x1e0504,_0x1f83a9,_0x3ea965,_0x4cb00d)[_0x6b01('0xa')](function(){_0x4623d9(_0x1f83a9);});}else{_0x4623d9(_0x1f83a9);}});};}function emit(_0x17481f,_0x357f54,_0x1e0e00){var _0x350e68=_0x6b01('0x4d')+_0x6b01('0x4e')+_0x6b01('0x4f')+_0x6b01('0x50');var _0x13ceac={'uri':_0x17481f+_0x6b01('0x51')+_0x1e0e00+_0x350e68};io['to'](util[_0x6b01('0x52')](_0x6b01('0x53'),_0x357f54))['emit'](_0x6b01('0x54'),_0x13ceac);}exports['cs']=function(_0x263346,_0x40ad79,_0x246299,_0x1c419c,_0x250889,_0x40931a,_0x17468f,_0x194599){var _0xf94448={};var _0x1a9d5a={'user':_0x40931a[_0x6b01('0x55')],'pass':_0x40931a[_0x6b01('0x56')]};var _0x30171f=_0x6b01('0x57');var _0x5dd5ca=_0x6b01('0x58');_0x40931a[_0x6b01('0x59')]=intUtil[_0x6b01('0x5a')](_0x40931a[_0x6b01('0x59')]);_0x40931a[_0x6b01('0x5b')]=intUtil[_0x6b01('0x5a')](_0x40931a[_0x6b01('0x5b')]);var _0x457e5c=util[_0x6b01('0x52')](_0x6b01('0x5c'),_0x40931a[_0x6b01('0x59')]);_0xf94448[_0x6b01('0x14')]=!_[_0x6b01('0x5d')](_0x1c419c)?_0x1c419c[_0x6b01('0x5e')]:null;_0xf94448[_0x6b01('0x1d')]=_0x40931a[_0x6b01('0x5e')];_0xf94448[_0x6b01('0x23')]=_0x194599[_0x6b01('0x32')]()===_0x6b01('0x5f')?_0x40ad79[_0x6b01('0x60')]:_0x40ad79['calleridnum'];_0xf94448['callDirection']=_0x194599==='queue'||_0x194599==='unmanaged'?_0x6b01('0x61'):'outbound';var _0x566cd7=util['format'](_0x6b01('0x62'),_0x40931a['serverUrl'],_0x40ad79[_0x6b01('0x63')],md5(_0x40ad79[_0x6b01('0x63')]));if(_0x250889&&_0x250889[_0x6b01('0x64')]){logger[_0x6b01('0xd')](_0x6b01('0x65'),'Recording\x20is\x20enabled!');_0x40ad79['recordingURL']=_0x566cd7;}else if(_0x17468f&&_0x17468f[_0x6b01('0x66')]&&_0x17468f[_0x6b01('0x66')]!==_0x6b01('0x67')){logger['info'](_0x6b01('0x68'),_0x6b01('0x69'));_0x40ad79[_0x6b01('0x6a')]=_0x566cd7;}else{_0x40ad79[_0x6b01('0x6a')]='';}return getAdminUser(_0x194599,_0x1a9d5a,_0xf94448,_0x457e5c,_0x5dd5ca,_0x30171f)[_0x6b01('0xa')](getUser(_0x194599,_0x1a9d5a,_0x457e5c,_0x5dd5ca,_0x30171f))['then'](getEndUser(_0x194599,_0x1a9d5a,_0x457e5c,_0x5dd5ca,_0x30171f))[_0x6b01('0xa')](getTicket(_0x194599,_0x1a9d5a,_0x457e5c,_0x246299,_0x40ad79,_0x5dd5ca))['then'](function(_0x1a03e4){logger[_0x6b01('0xd')](util[_0x6b01('0x52')](_0x6b01('0x6b'),_0x1a03e4[_0x6b01('0x3d')]));logger['info'](util[_0x6b01('0x52')](_0x6b01('0x6c'),_0x194599));if(_0x194599!==_0x6b01('0x6d')){logger[_0x6b01('0xd')]('['+[_0x194599['toUpperCase']()]+']',_0x6b01('0x6e'));emit(_0x40931a[_0x6b01('0x59')],_0x1c419c[_0x6b01('0x37')],_0x1a03e4[_0x6b01('0x3d')]);}})[_0x6b01('0xf')](function(_0x464265){logger['error']('['+[_0x194599['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x6b01('0x6f')](_0x464265,{'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 1e601b6..20ffa59 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 _0x3823=['customField','toLowerCase','content','push','variable','custom_fields','customVariable','Variable','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','remoteUri','serverUrl','stripTrailingSlash','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error','outbound','uri','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','Outbound','Ticket\x20created!','user:%s','trigger:browser:url','catch','unmanaged','monitor_format','toUpperCase','lastevent','request-promise','bluebird','md5','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','description','Descriptions','date_start','toISOString','slice','replace','duration_minutes','parent_type','Contacts','parent_name','forEach','variableName','idField','set_entry','JSON','Calls','format','apiKey','toString','base64','stringify','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','length','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','first_name','debug','merge','map','type','string','nameField'];(function(_0x557c8d,_0x4f9f4d){var _0x1b62fa=function(_0x4cfe56){while(--_0x4cfe56){_0x557c8d['push'](_0x557c8d['shift']());}};_0x1b62fa(++_0x4f9f4d);}(_0x3823,0xb0));var _0x3382=function(_0x79cf3d,_0x362645){_0x79cf3d=_0x79cf3d-0x0;var _0x29e329=_0x3823[_0x79cf3d];return _0x29e329;};'use strict';var _=require('lodash');var rp=require(_0x3382('0x0'));var BPromise=require(_0x3382('0x1'));var md5=require(_0x3382('0x2'));var util=require('util');var Redis=require(_0x3382('0x3'));var intUtil=require('./util');var config=require(_0x3382('0x4'));var logger=require(_0x3382('0x5'))(_0x3382('0x6'));config[_0x3382('0x7')]=_['defaults'](config[_0x3382('0x7')],{'host':_0x3382('0x8'),'port':0x18eb});var io=require(_0x3382('0x9'))(new Redis(config[_0x3382('0x7')]));var def={'method':_0x3382('0xa'),'json':!![]};function emit(_0xb690b6,_0x3dd5bb,_0x1d5269){io['to'](_0xb690b6)[_0x3382('0xb')](_0x3dd5bb,_0x1d5269);}function getTicket(_0xba6fb3,_0x784ea3,_0x3da958,_0x4761dd,_0x33f519,_0x29751b,_0x3e9e9c,_0x52abd6){logger['info'](_0x3382('0xc'));var _0x379be2=new Date();var _0x283509=[{'name':_0x3382('0xd'),'value':intUtil[_0x3382('0xe')](_0x4761dd[_0x3382('0xf')],_0x33f519,'\x20')},{'name':'assigned_user_id','value':_0x784ea3['id']},{'name':'created_by','value':_0x784ea3['id']},{'name':_0x3382('0x10'),'value':intUtil[_0x3382('0xe')](_0x4761dd[_0x3382('0x11')],_0x33f519,'\x0a')},{'name':_0x3382('0x12'),'value':_0x379be2[_0x3382('0x13')]()[_0x3382('0x14')](0x0,0x13)[_0x3382('0x15')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x3382('0x16'),'value':'15'},{'name':'parent_id','value':_0x3da958['id']},{'name':_0x3382('0x17'),'value':_0x3382('0x18')},{'name':_0x3382('0x19'),'value':_0x3da958['name']},{'name':'direction','value':_0x52abd6}];if(_0x29751b['length']){_[_0x3382('0x1a')](_0x29751b,function(_0x51f6e6){if(_0x33f519[_0x51f6e6[_0x3382('0x1b')]]){_0x283509['push']({'name':_0x51f6e6[_0x3382('0x1c')],'value':_0x33f519[_0x51f6e6[_0x3382('0x1b')]]});}});}return request({'form':{'method':_0x3382('0x1d'),'input_type':_0x3382('0x1e'),'response_type':_0x3382('0x1e'),'rest_data':JSON['stringify']({'session':_0x3e9e9c['id'],'module_name':_0x3382('0x1f'),'name_value_list':_0x283509})}});}function getAuth(_0x3504dd){return util[_0x3382('0x20')]('Basic\x20%s',new Buffer(_0x3504dd[_0x3382('0x21')]+':X')[_0x3382('0x22')](_0x3382('0x23')));}function getServerInfo(_0x509062){return request({'form':{'method':'get_server_info','input_type':_0x3382('0x1e'),'response_type':_0x3382('0x1e'),'rest_data':JSON[_0x3382('0x24')]({'session':_0x509062['id']})}});}function getUser(_0x709317,_0x377db,_0x5d7f5f){if(!_[_0x3382('0x25')](_0x377db)){logger[_0x3382('0x26')](_0x3382('0x27'),_0x377db);return request({'form':{'method':_0x3382('0x28'),'input_type':_0x3382('0x1e'),'response_type':_0x3382('0x1e'),'rest_data':JSON[_0x3382('0x24')]({'session':_0x5d7f5f['id'],'module_name':'Employees','query':util[_0x3382('0x20')](_0x3382('0x29'),_0x377db),'order_by':'','offset':'0','select_fields':['id',_0x3382('0xd'),_0x3382('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x16713a){if(_0x16713a[_0x3382('0x2b')][_0x3382('0x2c')]){var _0x85dbc1=_['find'](_0x16713a[_0x3382('0x2b')],function(_0x3b233c){return _0x3b233c[_0x3382('0x2d')][_0x3382('0x2a')][_0x3382('0x2e')]===_0x377db;});if(_0x85dbc1){logger[_0x3382('0x26')](_0x3382('0x2f'));return BPromise['resolve']({'id':_0x85dbc1[_0x3382('0x2d')]['id'][_0x3382('0x2e')],'name':_0x85dbc1[_0x3382('0x2d')][_0x3382('0xd')][_0x3382('0x2e')]});}}logger['info'](_0x3382('0x30'));return BPromise[_0x3382('0x31')]({'id':_0x5d7f5f[_0x3382('0x2d')]['user_id'][_0x3382('0x2e')],'name':_0x5d7f5f[_0x3382('0x2d')][_0x3382('0x2a')][_0x3382('0x2e')]});});}else{logger[_0x3382('0x26')](_0x3382('0x32'));return BPromise[_0x3382('0x31')]({'id':_0x5d7f5f[_0x3382('0x2d')][_0x3382('0x33')][_0x3382('0x2e')],'name':_0x5d7f5f[_0x3382('0x2d')][_0x3382('0x2a')][_0x3382('0x2e')]});}}function getEndUser(_0x2d5e9e,_0x40f166,_0x55f874,_0xa5e0e7){logger[_0x3382('0x26')](_0x3382('0x34'),_0x55f874);return request({'form':{'method':_0x3382('0x28'),'input_type':_0x3382('0x1e'),'response_type':_0x3382('0x1e'),'rest_data':JSON[_0x3382('0x24')]({'session':_0xa5e0e7['id'],'module_name':_0x3382('0x18'),'query':util[_0x3382('0x20')](_0x3382('0x35'),_0x55f874),'order_by':'','offset':'0','select_fields':['id','name',_0x3382('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x3382('0x37')](function(_0x326bc7){if(_0x326bc7[_0x3382('0x2b')][_0x3382('0x2c')]){var _0x293a65=_[_0x3382('0x38')](_0x326bc7[_0x3382('0x2b')],function(_0x35cad7){return _0x35cad7[_0x3382('0x2d')][_0x3382('0x36')][_0x3382('0x2e')]===_0x55f874;});if(_0x293a65){logger['info'](_0x3382('0x39'));return BPromise['resolve']({'id':_0x293a65[_0x3382('0x2d')]['id']['value'],'name':_0x293a65[_0x3382('0x2d')]['name']['value'],'phone':_0x293a65[_0x3382('0x2d')][_0x3382('0x36')][_0x3382('0x2e')]});}}else{logger[_0x3382('0x26')](_0x3382('0x3a'));return request({'form':{'method':_0x3382('0x1d'),'input_type':'JSON','response_type':_0x3382('0x1e'),'rest_data':JSON[_0x3382('0x24')]({'session':_0xa5e0e7['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0x40f166!==_0x3382('0x3b')?_0x40f166:util[_0x3382('0x20')](_0x3382('0x3c'),_0x55f874)},{'name':_0x3382('0x36'),'value':_0x55f874}]})}})[_0x3382('0x37')](function(_0x68d81){logger['info']('Enduser\x20created.');return BPromise[_0x3382('0x31')]({'id':_0x68d81['id'],'name':_0x68d81[_0x3382('0x2b')][_0x3382('0x3d')][_0x3382('0x2e')],'phone':_0x68d81[_0x3382('0x2b')]['phone_home'][_0x3382('0x2e')]});});}});}function request(_0x4c239d){logger[_0x3382('0x3e')]('[HTTP]',JSON['stringify'](_0x4c239d));return rp(_[_0x3382('0x3f')](def,_0x4c239d));}function getTags(_0x37c450,_0x4ccdf8){var _0x5b8f4e=[];if(_0x37c450&&_0x37c450[_0x3382('0x2c')]>0x0){_0x5b8f4e=_[_0x3382('0x40')](_0x37c450,_0x4ccdf8);}return _0x5b8f4e;}function getCustomFields(_0x26c772,_0x356a5a){var _0x1f614f=[];var _0xbed0eb={'custom_fields':[]};if(_0x26c772[_0x3382('0x2c')]>0x0){_[_0x3382('0x1a')](_0x26c772,function(_0x5dbf9b){if(_0x5dbf9b[_0x3382('0x41')]===_0x3382('0x42')&&_0x5dbf9b[_0x3382('0x43')]&&!_0x5dbf9b[_0x3382('0x44')]){_0xbed0eb[_0x5dbf9b['nameField'][_0x3382('0x45')]()]=_0x5dbf9b[_0x3382('0x46')]['toString']();}else if(_0x5dbf9b[_0x3382('0x41')]==='string'&&_0x5dbf9b[_0x3382('0x1c')]&&_0x5dbf9b[_0x3382('0x44')]){_0xbed0eb['custom_fields'][_0x3382('0x47')]({'id':_0x5dbf9b[_0x3382('0x1c')],'value':_0x5dbf9b[_0x3382('0x46')][_0x3382('0x22')]()});}else if(_0x5dbf9b[_0x3382('0x41')]===_0x3382('0x48')&&_0x5dbf9b[_0x3382('0x1b')]&&_0x5dbf9b[_0x3382('0x1c')]&&_0x5dbf9b[_0x3382('0x44')]){_0x356a5a[_0x5dbf9b[_0x3382('0x1b')]]&&_0xbed0eb[_0x3382('0x49')]['push']({'id':_0x5dbf9b[_0x3382('0x1c')],'value':_0x356a5a[_0x5dbf9b[_0x3382('0x1b')]][_0x3382('0x22')]()});}else if(_0x5dbf9b[_0x3382('0x41')]===_0x3382('0x4a')&&_0x5dbf9b[_0x3382('0x4b')]&&_0x5dbf9b['Variable'][_0x3382('0xd')]&&_0x5dbf9b[_0x3382('0x1c')]&&_0x5dbf9b[_0x3382('0x44')]){_0x356a5a[_0x5dbf9b[_0x3382('0x4b')][_0x3382('0xd')][_0x3382('0x45')]()]&&_0xbed0eb['custom_fields']['push']({'id':_0x5dbf9b['idField'],'value':_0x356a5a[_0x5dbf9b[_0x3382('0x4b')]['name'][_0x3382('0x45')]()][_0x3382('0x22')]()});}});}return _0xbed0eb;}function getConnection(_0x396e98){return request({'method':'POST','form':{'method':'login','input_type':'JSON','response_type':_0x3382('0x1e'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x396e98[_0x3382('0x4c')],'password':_0x396e98[_0x3382('0x4d')],'encryption':_0x3382('0x4e')},'application':_0x3382('0x4f')})}})[_0x3382('0x37')](function(_0x3acf85){var _0x287bfe=_0x3acf85;if(_0x287bfe['id']){def[_0x3382('0x50')]=_0x287bfe['id'];return BPromise[_0x3382('0x31')](_0x287bfe);}else{throw new Error(util[_0x3382('0x20')]('Account\x20%d\x20is\x20not\x20valid',_0x396e98['id']));}});}function setRelationship(_0x44bf7c,_0x6e09a1,_0x227550,_0x4fb230){return request({'form':{'method':_0x3382('0x51'),'input_type':_0x3382('0x1e'),'response_type':_0x3382('0x1e'),'rest_data':JSON[_0x3382('0x24')]({'session':_0x44bf7c['id'],'module_name':_0x3382('0x1f'),'module_id':_0x227550['id'],'link_field_name':_0x4fb230,'related_ids':[_0x6e09a1['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x3382('0x52')]=function(_0x144dac,_0x3d661d,_0x3be1c7,_0x27e358,_0x148345,_0x381415){var _0xd5e147,_0x1fa285,_0xcde4f2,_0x374d47;_0x381415[_0x3382('0x53')]=intUtil['stripTrailingSlash'](_0x381415[_0x3382('0x53')]);_0x381415[_0x3382('0x54')]=intUtil[_0x3382('0x55')](_0x381415[_0x3382('0x54')]);def['uri']=util[_0x3382('0x20')](_0x3382('0x56'),_0x381415[_0x3382('0x53')]);if(_0x148345&&_0x148345['monitor_format']){logger[_0x3382('0x26')](_0x3382('0x57'),_0x3382('0x58'));_0x3d661d['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x381415[_0x3382('0x54')],_0x3d661d[_0x3382('0x59')],md5(_0x3d661d[_0x3382('0x59')]));}else{_0x3d661d[_0x3382('0x5a')]='';}return getConnection(_0x381415)[_0x3382('0x37')](function(_0x75c9f7){_0x374d47=_0x75c9f7;return getUser(_0x381415,_0x27e358['name'],_0x374d47);})[_0x3382('0x37')](function(_0x276e92){_0xd5e147=_0x276e92;logger[_0x3382('0x26')]('The\x20User\x20ID\x20is:',_0xd5e147['id']);return getEndUser(_0x381415,_0x3d661d[_0x3382('0x5b')],_0x3d661d[_0x3382('0x5c')],_0x374d47);})[_0x3382('0x37')](function(_0x12423f){_0x1fa285=_0x12423f;logger[_0x3382('0x26')](_0x3382('0x5d'),_0x1fa285['id']);return getTicket(_0x381415,_0xd5e147,_0x1fa285,_0x3be1c7,_0x3d661d,_0x3be1c7[_0x3382('0x5e')],_0x374d47,_0x3382('0x5f'));})['then'](function(_0x29bd2f){_0xcde4f2=_0x29bd2f;logger[_0x3382('0x26')]('Ticket\x20created!');logger[_0x3382('0x26')](_0x3382('0x60'),_0xcde4f2['id']);return setRelationship(_0x374d47,_0xd5e147,_0xcde4f2,_0x3382('0x61'));})[_0x3382('0x37')](function(){return setRelationship(_0x374d47,_0x1fa285,_0xcde4f2,_0x3382('0x62'));})['then'](function(){return getServerInfo(_0x374d47);})[_0x3382('0x37')](function(_0x2876f9){var _0x2ebdeb=parseInt(_0x2876f9[_0x3382('0x63')][_0x3382('0x64')](0x0));var _0x4dd010=util['format'](_0x3382('0x65'),_0x381415[_0x3382('0x53')],_0xcde4f2['id']);if(_0x2ebdeb>0x6){_0x4dd010=util['format'](_0x3382('0x66'),_0x381415[_0x3382('0x53')],_0xcde4f2['id']);}logger[_0x3382('0x26')](_0x3382('0x57'),_0x3382('0x67'));emit(util[_0x3382('0x20')]('user:%s',_0x27e358[_0x3382('0xd')]),'trigger:browser:url',{'uri':_0x4dd010});})['catch'](function(_0x4bc913){logger[_0x3382('0x68')](_0x3382('0x57'),JSON[_0x3382('0x24')](_0x4bc913));});};exports[_0x3382('0x69')]=function(_0x1d2ee9,_0x2f5581,_0x48bf30,_0x101fc3,_0xe8d8a8,_0x3036d9,_0x536a28){var _0x3c190b,_0x10781a,_0xdecf82,_0x2bcf2c;_0x3036d9[_0x3382('0x53')]=intUtil[_0x3382('0x55')](_0x3036d9[_0x3382('0x53')]);_0x3036d9['serverUrl']=intUtil[_0x3382('0x55')](_0x3036d9['serverUrl']);def[_0x3382('0x6a')]=util[_0x3382('0x20')](_0x3382('0x56'),_0x3036d9['remoteUri']);if(_0x536a28&&_0x536a28[_0x3382('0x6b')]&&_0x536a28[_0x3382('0x6b')]!==_0x3382('0x6c')){logger[_0x3382('0x26')](_0x3382('0x6d'),_0x3382('0x58'));_0x2f5581[_0x3382('0x5a')]=util[_0x3382('0x20')](_0x3382('0x6e'),_0x3036d9[_0x3382('0x54')],_0x2f5581[_0x3382('0x59')],md5(_0x2f5581[_0x3382('0x59')]));}return getConnection(_0x3036d9)[_0x3382('0x37')](function(_0x54a9b2){_0x2bcf2c=_0x54a9b2;return getUser(_0x3036d9,_0x101fc3[_0x3382('0xd')],_0x2bcf2c);})[_0x3382('0x37')](function(_0x4c0149){_0x3c190b=_0x4c0149;logger[_0x3382('0x26')](_0x3382('0x6f'),_0x3c190b['id']);return getEndUser(_0x3036d9,_0x2f5581[_0x3382('0x70')],_0x2f5581['destcalleridnum'],_0x2bcf2c);})[_0x3382('0x37')](function(_0x8526a4){_0x10781a=_0x8526a4;logger[_0x3382('0x26')](_0x3382('0x5d'),_0x10781a['id']);return getTicket(_0x3036d9,_0x3c190b,_0x10781a,_0x48bf30,_0x2f5581,_0x48bf30['Fields'],_0x2bcf2c,_0x3382('0x71'));})[_0x3382('0x37')](function(_0x56e044){_0xdecf82=_0x56e044;logger[_0x3382('0x26')](_0x3382('0x72'));logger[_0x3382('0x26')]('The\x20Ticket\x20ID\x20is:',_0xdecf82['id']);return setRelationship(_0x2bcf2c,_0x3c190b,_0xdecf82,_0x3382('0x61'));})[_0x3382('0x37')](function(){return setRelationship(_0x2bcf2c,_0x10781a,_0xdecf82,_0x3382('0x62'));})[_0x3382('0x37')](function(){return getServerInfo(_0x2bcf2c);})[_0x3382('0x37')](function(_0x1fcabb){var _0x258a28=parseInt(_0x1fcabb[_0x3382('0x63')][_0x3382('0x64')](0x0));var _0x12330e=util['format'](_0x3382('0x65'),_0x3036d9[_0x3382('0x53')],_0xdecf82['id']);if(_0x258a28>0x6){_0x12330e=util['format'](_0x3382('0x66'),_0x3036d9['remoteUri'],_0xdecf82['id']);}logger['info']('[OUTBOUND]',_0x3382('0x67'));emit(util[_0x3382('0x20')](_0x3382('0x73'),_0x101fc3[_0x3382('0xd')]),_0x3382('0x74'),{'uri':_0x12330e});})[_0x3382('0x75')](function(_0x94bbd7){logger[_0x3382('0x68')]('[OUTBOUND]',JSON[_0x3382('0x24')](_0x94bbd7));});};exports[_0x3382('0x76')]=function(_0x3982a2,_0x5e19fc,_0x5782b8,_0x18231e,_0x407122,_0x502939){var _0x1de895,_0x3233c8,_0x1075aa,_0x2b2a6f;_0x502939['remoteUri']=intUtil[_0x3382('0x55')](_0x502939[_0x3382('0x53')]);_0x502939['serverUrl']=intUtil[_0x3382('0x55')](_0x502939[_0x3382('0x54')]);def[_0x3382('0x6a')]=util[_0x3382('0x20')](_0x3382('0x56'),_0x502939[_0x3382('0x53')]);if(_0x407122&&_0x407122[_0x3382('0x77')]){logger['info']('['+_0x5e19fc['lastevent'][_0x3382('0x78')]()+']',_0x3382('0x58'));_0x5e19fc['recordingURL']=util[_0x3382('0x20')](_0x3382('0x6e'),_0x502939[_0x3382('0x54')],_0x5e19fc[_0x3382('0x59')],md5(_0x5e19fc[_0x3382('0x59')]));}else{_0x5e19fc[_0x3382('0x5a')]='';}return getConnection(_0x502939)[_0x3382('0x37')](function(_0x2a0c0a){_0x2b2a6f=_0x2a0c0a;if(!_[_0x3382('0x25')](_0x18231e)){return getUser(_0x502939,_0x18231e[_0x3382('0xd')],_0x2b2a6f);}else{return getUser(_0x502939,null,_0x2b2a6f);}})[_0x3382('0x37')](function(_0x27617b){_0x1de895=_0x27617b;logger[_0x3382('0x26')](_0x3382('0x6f'),_0x1de895['id']);return getEndUser(_0x502939,_0x5e19fc[_0x3382('0x5b')],_0x5e19fc[_0x3382('0x5c')],_0x2b2a6f);})[_0x3382('0x37')](function(_0x3673da){_0x3233c8=_0x3673da;logger[_0x3382('0x26')](_0x3382('0x5d'),_0x3233c8['id']);return getTicket(_0x502939,_0x1de895,_0x3233c8,_0x5782b8,_0x5e19fc,_0x5782b8[_0x3382('0x5e')],_0x2b2a6f,_0x3382('0x5f'));})['then'](function(_0x3ea089){_0x1075aa=_0x3ea089;logger[_0x3382('0x26')](_0x3382('0x72'));logger[_0x3382('0x26')]('The\x20Ticket\x20ID\x20is:',_0x1075aa['id']);return setRelationship(_0x2b2a6f,_0x1de895,_0x1075aa,'users');})[_0x3382('0x37')](function(){return setRelationship(_0x2b2a6f,_0x3233c8,_0x1075aa,'contacts');})[_0x3382('0x37')](function(){return getServerInfo(_0x2b2a6f);})[_0x3382('0x75')](function(_0x2adcc7){logger[_0x3382('0x68')]('['+_0x5e19fc[_0x3382('0x79')][_0x3382('0x78')]()+']',JSON[_0x3382('0x24')](_0x2adcc7));});}; \ No newline at end of file +var _0x6da9=['POST','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','Descriptions','slice','replace','duration_minutes','parent_type','Contacts','parent_name','direction','forEach','variableName','push','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','length','find','value','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','type','string','nameField','content','idField','customField','custom_fields','variable','customVariable','Variable','username','password','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\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','user:%s','trigger:browser:url','catch','error','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','users','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','redis','defaults','socket.io-emitter'];(function(_0x3da9c5,_0x1ea0fe){var _0x3921a2=function(_0x5b47d1){while(--_0x5b47d1){_0x3da9c5['push'](_0x3da9c5['shift']());}};_0x3921a2(++_0x1ea0fe);}(_0x6da9,0x161));var _0x96da=function(_0x52707e,_0x4f12f5){_0x52707e=_0x52707e-0x0;var _0x3f8759=_0x6da9[_0x52707e];return _0x3f8759;};'use strict';var _=require(_0x96da('0x0'));var rp=require(_0x96da('0x1'));var BPromise=require(_0x96da('0x2'));var md5=require(_0x96da('0x3'));var util=require(_0x96da('0x4'));var Redis=require(_0x96da('0x5'));var intUtil=require(_0x96da('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('sugarcrm');config[_0x96da('0x7')]=_[_0x96da('0x8')](config[_0x96da('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x96da('0x9'))(new Redis(config['redis']));var def={'method':_0x96da('0xa'),'json':!![]};function emit(_0x45ee2f,_0x3b0883,_0x5077e0){io['to'](_0x45ee2f)['emit'](_0x3b0883,_0x5077e0);}function getTicket(_0x4ed0c1,_0x252844,_0x27489d,_0x1e618c,_0x5984be,_0x7caba,_0x271d43,_0x4983aa){logger[_0x96da('0xb')](_0x96da('0xc'));var _0x200c38=new Date();var _0x443c3e=[{'name':_0x96da('0xd'),'value':intUtil[_0x96da('0xe')](_0x1e618c[_0x96da('0xf')],_0x5984be,'\x20')},{'name':_0x96da('0x10'),'value':_0x252844['id']},{'name':_0x96da('0x11'),'value':_0x252844['id']},{'name':'description','value':intUtil[_0x96da('0xe')](_0x1e618c[_0x96da('0x12')],_0x5984be,'\x0a')},{'name':'date_start','value':_0x200c38['toISOString']()[_0x96da('0x13')](0x0,0x13)[_0x96da('0x14')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x96da('0x15'),'value':'15'},{'name':'parent_id','value':_0x27489d['id']},{'name':_0x96da('0x16'),'value':_0x96da('0x17')},{'name':_0x96da('0x18'),'value':_0x27489d[_0x96da('0xd')]},{'name':_0x96da('0x19'),'value':_0x4983aa}];if(_0x7caba['length']){_[_0x96da('0x1a')](_0x7caba,function(_0xd1fef8){if(_0x5984be[_0xd1fef8[_0x96da('0x1b')]]){_0x443c3e[_0x96da('0x1c')]({'name':_0xd1fef8['idField'],'value':_0x5984be[_0xd1fef8[_0x96da('0x1b')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x96da('0x1d'),'response_type':_0x96da('0x1d'),'rest_data':JSON[_0x96da('0x1e')]({'session':_0x271d43['id'],'module_name':'Calls','name_value_list':_0x443c3e})}});}function getAuth(_0x1037e9){return util[_0x96da('0x1f')](_0x96da('0x20'),new Buffer(_0x1037e9[_0x96da('0x21')]+':X')[_0x96da('0x22')](_0x96da('0x23')));}function getServerInfo(_0x561140){return request({'form':{'method':_0x96da('0x24'),'input_type':_0x96da('0x1d'),'response_type':_0x96da('0x1d'),'rest_data':JSON['stringify']({'session':_0x561140['id']})}});}function getUser(_0x44e248,_0x137789,_0x4a9232){if(!_[_0x96da('0x25')](_0x137789)){logger['info'](_0x96da('0x26'),_0x137789);return request({'form':{'method':_0x96da('0x27'),'input_type':_0x96da('0x1d'),'response_type':_0x96da('0x1d'),'rest_data':JSON[_0x96da('0x1e')]({'session':_0x4a9232['id'],'module_name':_0x96da('0x28'),'query':util[_0x96da('0x1f')](_0x96da('0x29'),_0x137789),'order_by':'','offset':'0','select_fields':['id',_0x96da('0xd'),_0x96da('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3a0cfe){if(_0x3a0cfe[_0x96da('0x2b')][_0x96da('0x2c')]){var _0x397fe4=_[_0x96da('0x2d')](_0x3a0cfe[_0x96da('0x2b')],function(_0x315832){return _0x315832['name_value_list'][_0x96da('0x2a')][_0x96da('0x2e')]===_0x137789;});if(_0x397fe4){logger[_0x96da('0xb')]('Agent\x20found!');return BPromise['resolve']({'id':_0x397fe4['name_value_list']['id']['value'],'name':_0x397fe4[_0x96da('0x2f')]['name'][_0x96da('0x2e')]});}}logger[_0x96da('0xb')](_0x96da('0x30'));return BPromise[_0x96da('0x31')]({'id':_0x4a9232[_0x96da('0x2f')][_0x96da('0x32')][_0x96da('0x2e')],'name':_0x4a9232[_0x96da('0x2f')][_0x96da('0x2a')]['value']});});}else{logger['info'](_0x96da('0x33'));return BPromise[_0x96da('0x31')]({'id':_0x4a9232['name_value_list'][_0x96da('0x32')][_0x96da('0x2e')],'name':_0x4a9232[_0x96da('0x2f')][_0x96da('0x2a')][_0x96da('0x2e')]});}}function getEndUser(_0x4027ce,_0x3a6f6a,_0x41a11f,_0x2e4c7d){logger['info'](_0x96da('0x34'),_0x41a11f);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x96da('0x1d'),'rest_data':JSON[_0x96da('0x1e')]({'session':_0x2e4c7d['id'],'module_name':_0x96da('0x17'),'query':util[_0x96da('0x1f')](_0x96da('0x35'),_0x41a11f),'order_by':'','offset':'0','select_fields':['id',_0x96da('0xd'),_0x96da('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x96da('0x37')](function(_0x11b449){if(_0x11b449[_0x96da('0x2b')][_0x96da('0x2c')]){var _0x47c89c=_[_0x96da('0x2d')](_0x11b449[_0x96da('0x2b')],function(_0x503ed2){return _0x503ed2['name_value_list'][_0x96da('0x36')][_0x96da('0x2e')]===_0x41a11f;});if(_0x47c89c){logger[_0x96da('0xb')](_0x96da('0x38'));return BPromise[_0x96da('0x31')]({'id':_0x47c89c['name_value_list']['id'][_0x96da('0x2e')],'name':_0x47c89c['name_value_list'][_0x96da('0xd')][_0x96da('0x2e')],'phone':_0x47c89c[_0x96da('0x2f')]['phone_home']['value']});}}else{logger[_0x96da('0xb')](_0x96da('0x39'));return request({'form':{'method':_0x96da('0x3a'),'input_type':_0x96da('0x1d'),'response_type':_0x96da('0x1d'),'rest_data':JSON[_0x96da('0x1e')]({'session':_0x2e4c7d['id'],'module_name':_0x96da('0x17'),'name_value_list':[{'name':_0x96da('0x3b'),'value':_0x3a6f6a!==_0x96da('0x3c')?_0x3a6f6a:util[_0x96da('0x1f')](_0x96da('0x3d'),_0x41a11f)},{'name':'phone_home','value':_0x41a11f}]})}})[_0x96da('0x37')](function(_0x2cff3e){logger['info'](_0x96da('0x3e'));return BPromise[_0x96da('0x31')]({'id':_0x2cff3e['id'],'name':_0x2cff3e[_0x96da('0x2b')][_0x96da('0x3b')][_0x96da('0x2e')],'phone':_0x2cff3e[_0x96da('0x2b')][_0x96da('0x36')][_0x96da('0x2e')]});});}});}function request(_0xdccdd7){logger[_0x96da('0x3f')](_0x96da('0x40'),JSON[_0x96da('0x1e')](_0xdccdd7));return rp(_['merge'](def,_0xdccdd7));}function getTags(_0x38d931,_0x216a79){var _0x17a23d=[];if(_0x38d931&&_0x38d931[_0x96da('0x2c')]>0x0){_0x17a23d=_[_0x96da('0x41')](_0x38d931,_0x216a79);}return _0x17a23d;}function getCustomFields(_0x247c66,_0x2b91b7){var _0x30326b=[];var _0x409302={'custom_fields':[]};if(_0x247c66[_0x96da('0x2c')]>0x0){_['forEach'](_0x247c66,function(_0x13455b){if(_0x13455b[_0x96da('0x42')]===_0x96da('0x43')&&_0x13455b[_0x96da('0x44')]&&!_0x13455b['customField']){_0x409302[_0x13455b[_0x96da('0x44')]['toLowerCase']()]=_0x13455b[_0x96da('0x45')][_0x96da('0x22')]();}else if(_0x13455b[_0x96da('0x42')]===_0x96da('0x43')&&_0x13455b[_0x96da('0x46')]&&_0x13455b[_0x96da('0x47')]){_0x409302[_0x96da('0x48')]['push']({'id':_0x13455b[_0x96da('0x46')],'value':_0x13455b[_0x96da('0x45')][_0x96da('0x22')]()});}else if(_0x13455b[_0x96da('0x42')]===_0x96da('0x49')&&_0x13455b['variableName']&&_0x13455b[_0x96da('0x46')]&&_0x13455b['customField']){_0x2b91b7[_0x13455b[_0x96da('0x1b')]]&&_0x409302[_0x96da('0x48')]['push']({'id':_0x13455b[_0x96da('0x46')],'value':_0x2b91b7[_0x13455b[_0x96da('0x1b')]]['toString']()});}else if(_0x13455b[_0x96da('0x42')]===_0x96da('0x4a')&&_0x13455b[_0x96da('0x4b')]&&_0x13455b[_0x96da('0x4b')][_0x96da('0xd')]&&_0x13455b[_0x96da('0x46')]&&_0x13455b[_0x96da('0x47')]){_0x2b91b7[_0x13455b['Variable'][_0x96da('0xd')]['toLowerCase']()]&&_0x409302[_0x96da('0x48')][_0x96da('0x1c')]({'id':_0x13455b[_0x96da('0x46')],'value':_0x2b91b7[_0x13455b[_0x96da('0x4b')][_0x96da('0xd')]['toLowerCase']()][_0x96da('0x22')]()});}});}return _0x409302;}function getConnection(_0x1f9583){return request({'method':'POST','form':{'method':'login','input_type':_0x96da('0x1d'),'response_type':_0x96da('0x1d'),'rest_data':JSON[_0x96da('0x1e')]({'user_auth':{'user_name':_0x1f9583[_0x96da('0x4c')],'password':_0x1f9583[_0x96da('0x4d')],'encryption':'PLAIN'},'application':_0x96da('0x4e')})}})[_0x96da('0x37')](function(_0xd371f3){var _0x1e9c68=_0xd371f3;if(_0x1e9c68['id']){def['sessionID']=_0x1e9c68['id'];return BPromise[_0x96da('0x31')](_0x1e9c68);}else{throw new Error(util[_0x96da('0x1f')](_0x96da('0x4f'),_0x1f9583['id']));}});}function setRelationship(_0x5db363,_0x4337a1,_0x462fcb,_0x53d037){return request({'form':{'method':_0x96da('0x50'),'input_type':_0x96da('0x1d'),'response_type':'JSON','rest_data':JSON[_0x96da('0x1e')]({'session':_0x5db363['id'],'module_name':_0x96da('0x51'),'module_id':_0x462fcb['id'],'link_field_name':_0x53d037,'related_ids':[_0x4337a1['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x4e660c,_0xb56bc3,_0xaf2a50,_0x16d575,_0x2048a2,_0x890366){var _0x2894cd,_0x2c645a,_0x111a4a,_0x4924dc;_0x890366[_0x96da('0x52')]=intUtil['stripTrailingSlash'](_0x890366[_0x96da('0x52')]);_0x890366[_0x96da('0x53')]=intUtil['stripTrailingSlash'](_0x890366['serverUrl']);def[_0x96da('0x54')]=util['format'](_0x96da('0x55'),_0x890366[_0x96da('0x52')]);if(_0x2048a2&&_0x2048a2[_0x96da('0x56')]){logger['info'](_0x96da('0x57'),_0x96da('0x58'));_0xb56bc3[_0x96da('0x59')]=util[_0x96da('0x1f')](_0x96da('0x5a'),_0x890366[_0x96da('0x53')],_0xb56bc3[_0x96da('0x5b')],md5(_0xb56bc3[_0x96da('0x5b')]));}else{_0xb56bc3[_0x96da('0x59')]='';}return getConnection(_0x890366)[_0x96da('0x37')](function(_0x584d0c){_0x4924dc=_0x584d0c;return getUser(_0x890366,_0x16d575['name'],_0x4924dc);})['then'](function(_0x31826a){_0x2894cd=_0x31826a;logger['info'](_0x96da('0x5c'),_0x2894cd['id']);return getEndUser(_0x890366,_0xb56bc3[_0x96da('0x5d')],_0xb56bc3[_0x96da('0x5e')],_0x4924dc);})[_0x96da('0x37')](function(_0x2a8b5){_0x2c645a=_0x2a8b5;logger['info'](_0x96da('0x5f'),_0x2c645a['id']);return getTicket(_0x890366,_0x2894cd,_0x2c645a,_0xaf2a50,_0xb56bc3,_0xaf2a50[_0x96da('0x60')],_0x4924dc,_0x96da('0x61'));})[_0x96da('0x37')](function(_0x6e0d5c){_0x111a4a=_0x6e0d5c;logger[_0x96da('0xb')](_0x96da('0x62'));logger['info'](_0x96da('0x63'),_0x111a4a['id']);return setRelationship(_0x4924dc,_0x2894cd,_0x111a4a,'users');})[_0x96da('0x37')](function(){return setRelationship(_0x4924dc,_0x2c645a,_0x111a4a,_0x96da('0x64'));})['then'](function(){return getServerInfo(_0x4924dc);})['then'](function(_0x4ddb17){var _0x21af08=parseInt(_0x4ddb17[_0x96da('0x65')][_0x96da('0x66')](0x0));var _0x115a46=util[_0x96da('0x1f')](_0x96da('0x67'),_0x890366[_0x96da('0x52')],_0x111a4a['id']);if(_0x21af08>0x6){_0x115a46=util[_0x96da('0x1f')](_0x96da('0x68'),_0x890366[_0x96da('0x52')],_0x111a4a['id']);}logger[_0x96da('0xb')](_0x96da('0x57'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x96da('0x1f')](_0x96da('0x69'),_0x16d575['name']),_0x96da('0x6a'),{'uri':_0x115a46});})[_0x96da('0x6b')](function(_0x188961){logger[_0x96da('0x6c')](_0x96da('0x57'),JSON[_0x96da('0x1e')](_0x188961));});};exports[_0x96da('0x6d')]=function(_0x46d87f,_0x2f8bc6,_0x2f4cb7,_0x2ac48f,_0x4aec16,_0x5283a3,_0x5acac2){var _0x101171,_0x35b692,_0x4a6d8e,_0x43a349;_0x5283a3['remoteUri']=intUtil[_0x96da('0x6e')](_0x5283a3[_0x96da('0x52')]);_0x5283a3[_0x96da('0x53')]=intUtil[_0x96da('0x6e')](_0x5283a3[_0x96da('0x53')]);def[_0x96da('0x54')]=util['format']('%s/service/v4_1/rest.php',_0x5283a3[_0x96da('0x52')]);if(_0x5acac2&&_0x5acac2[_0x96da('0x6f')]&&_0x5acac2[_0x96da('0x6f')]!==_0x96da('0x70')){logger[_0x96da('0xb')](_0x96da('0x71'),'Recording\x20is\x20enabled!');_0x2f8bc6[_0x96da('0x59')]=util[_0x96da('0x1f')](_0x96da('0x5a'),_0x5283a3[_0x96da('0x53')],_0x2f8bc6[_0x96da('0x5b')],md5(_0x2f8bc6[_0x96da('0x5b')]));}return getConnection(_0x5283a3)['then'](function(_0x46feb3){_0x43a349=_0x46feb3;return getUser(_0x5283a3,_0x2ac48f[_0x96da('0xd')],_0x43a349);})[_0x96da('0x37')](function(_0x25a44d){_0x101171=_0x25a44d;logger[_0x96da('0xb')](_0x96da('0x5c'),_0x101171['id']);return getEndUser(_0x5283a3,_0x2f8bc6[_0x96da('0x72')],_0x2f8bc6['destcalleridnum'],_0x43a349);})[_0x96da('0x37')](function(_0x4ff594){_0x35b692=_0x4ff594;logger[_0x96da('0xb')](_0x96da('0x5f'),_0x35b692['id']);return getTicket(_0x5283a3,_0x101171,_0x35b692,_0x2f4cb7,_0x2f8bc6,_0x2f4cb7[_0x96da('0x60')],_0x43a349,_0x96da('0x73'));})[_0x96da('0x37')](function(_0x1e8f92){_0x4a6d8e=_0x1e8f92;logger[_0x96da('0xb')](_0x96da('0x62'));logger[_0x96da('0xb')](_0x96da('0x63'),_0x4a6d8e['id']);return setRelationship(_0x43a349,_0x101171,_0x4a6d8e,_0x96da('0x74'));})[_0x96da('0x37')](function(){return setRelationship(_0x43a349,_0x35b692,_0x4a6d8e,_0x96da('0x64'));})[_0x96da('0x37')](function(){return getServerInfo(_0x43a349);})[_0x96da('0x37')](function(_0x177f39){var _0x47d9fa=parseInt(_0x177f39[_0x96da('0x65')][_0x96da('0x66')](0x0));var _0x5c6027=util['format'](_0x96da('0x67'),_0x5283a3['remoteUri'],_0x4a6d8e['id']);if(_0x47d9fa>0x6){_0x5c6027=util[_0x96da('0x1f')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x5283a3[_0x96da('0x52')],_0x4a6d8e['id']);}logger['info']('[OUTBOUND]',_0x96da('0x75'));emit(util['format'](_0x96da('0x69'),_0x2ac48f['name']),_0x96da('0x6a'),{'uri':_0x5c6027});})[_0x96da('0x6b')](function(_0x3d559e){logger[_0x96da('0x6c')](_0x96da('0x71'),JSON['stringify'](_0x3d559e));});};exports[_0x96da('0x76')]=function(_0xe31b44,_0xb0405b,_0x5b82cf,_0x3e47f7,_0x2e1126,_0x644386){var _0x486c0f,_0x47a248,_0x546c59,_0x2f0aee;_0x644386['remoteUri']=intUtil[_0x96da('0x6e')](_0x644386[_0x96da('0x52')]);_0x644386['serverUrl']=intUtil[_0x96da('0x6e')](_0x644386['serverUrl']);def[_0x96da('0x54')]=util[_0x96da('0x1f')](_0x96da('0x55'),_0x644386[_0x96da('0x52')]);if(_0x2e1126&&_0x2e1126[_0x96da('0x56')]){logger['info']('['+_0xb0405b[_0x96da('0x77')][_0x96da('0x78')]()+']','Recording\x20is\x20enabled!');_0xb0405b[_0x96da('0x59')]=util[_0x96da('0x1f')](_0x96da('0x5a'),_0x644386['serverUrl'],_0xb0405b['uniqueid'],md5(_0xb0405b['uniqueid']));}else{_0xb0405b['recordingURL']='';}return getConnection(_0x644386)[_0x96da('0x37')](function(_0x164e1c){_0x2f0aee=_0x164e1c;if(!_[_0x96da('0x25')](_0x3e47f7)){return getUser(_0x644386,_0x3e47f7[_0x96da('0xd')],_0x2f0aee);}else{return getUser(_0x644386,null,_0x2f0aee);}})[_0x96da('0x37')](function(_0x169009){_0x486c0f=_0x169009;logger[_0x96da('0xb')](_0x96da('0x5c'),_0x486c0f['id']);return getEndUser(_0x644386,_0xb0405b[_0x96da('0x5d')],_0xb0405b[_0x96da('0x5e')],_0x2f0aee);})[_0x96da('0x37')](function(_0xfbc1be){_0x47a248=_0xfbc1be;logger[_0x96da('0xb')](_0x96da('0x5f'),_0x47a248['id']);return getTicket(_0x644386,_0x486c0f,_0x47a248,_0x5b82cf,_0xb0405b,_0x5b82cf[_0x96da('0x60')],_0x2f0aee,_0x96da('0x61'));})[_0x96da('0x37')](function(_0xe03c4c){_0x546c59=_0xe03c4c;logger['info'](_0x96da('0x62'));logger[_0x96da('0xb')](_0x96da('0x63'),_0x546c59['id']);return setRelationship(_0x2f0aee,_0x486c0f,_0x546c59,_0x96da('0x74'));})[_0x96da('0x37')](function(){return setRelationship(_0x2f0aee,_0x47a248,_0x546c59,'contacts');})[_0x96da('0x37')](function(){return getServerInfo(_0x2f0aee);})[_0x96da('0x6b')](function(_0x499133){logger[_0x96da('0x6c')]('['+_0xb0405b[_0x96da('0x77')]['toUpperCase']()+']',JSON[_0x96da('0x1e')](_0x499133));});}; \ 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 9d4e5f7..12649c7 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 _0xa713=['test','lodash','util','getString','length','sortBy','type','string','push','variable','variableName','customVariable','Variable','name','toLowerCase','toString','keyValue','key','format','keyContent','keyType','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil'];(function(_0x235778,_0x38eac1){var _0x56e6c7=function(_0x2e45e1){while(--_0x2e45e1){_0x235778['push'](_0x235778['shift']());}};_0x56e6c7(++_0x38eac1);}(_0xa713,0x8d));var _0x3a71=function(_0x1174ca,_0x267965){_0x1174ca=_0x1174ca-0x0;var _0x5ee054=_0xa713[_0x1174ca];return _0x5ee054;};'use strict';var _=require(_0x3a71('0x0'));var util=require(_0x3a71('0x1'));exports[_0x3a71('0x2')]=function(_0x350ee0,_0x32489f,_0x340d20){var _0x58c3ce=[];if(_0x350ee0[_0x3a71('0x3')]>0x0){var _0x2654b1=_[_0x3a71('0x4')](_0x350ee0,['id']);for(var _0x984b1c=0x0;_0x984b1c<_0x2654b1['length'];_0x984b1c++){var _0x483198=_0x2654b1[_0x984b1c];if(_0x483198[_0x3a71('0x5')]===_0x3a71('0x6')){_0x58c3ce[_0x3a71('0x7')](_0x483198['content']);}else if(_0x483198[_0x3a71('0x5')]===_0x3a71('0x8')&&_0x483198[_0x3a71('0x9')]){_0x32489f[_0x483198[_0x3a71('0x9')]]&&_0x58c3ce['push'](_0x32489f[_0x483198[_0x3a71('0x9')]]['toString']());}else if(_0x483198[_0x3a71('0x5')]===_0x3a71('0xa')&&_0x483198[_0x3a71('0xb')]&&_0x483198[_0x3a71('0xb')][_0x3a71('0xc')]){_0x32489f[_0x483198[_0x3a71('0xb')]['name'][_0x3a71('0xd')]()]&&_0x58c3ce['push'](_0x32489f[_0x483198['Variable'][_0x3a71('0xc')][_0x3a71('0xd')]()][_0x3a71('0xe')]());}else if(_0x483198[_0x3a71('0x5')]===_0x3a71('0xf')){if(_0x483198['keyType']===_0x3a71('0x6')&&_0x483198[_0x3a71('0x10')]){_0x58c3ce['push'](util[_0x3a71('0x11')]('%s:\x20%s',_0x483198[_0x3a71('0x10')],_0x483198[_0x3a71('0x12')]));}else if(_0x483198[_0x3a71('0x13')]===_0x3a71('0x8')&&_0x483198[_0x3a71('0x9')]&&_0x483198[_0x3a71('0x10')]){_0x32489f[_0x483198[_0x3a71('0x9')]]&&_0x58c3ce['push'](util[_0x3a71('0x11')]('%s:\x20%s',_0x483198[_0x3a71('0x10')],_0x32489f[_0x483198[_0x3a71('0x9')]]));}else if(_0x483198[_0x3a71('0x13')]===_0x3a71('0xa')&&_0x483198[_0x3a71('0xb')]&&_0x483198[_0x3a71('0xb')][_0x3a71('0xc')]&&_0x483198[_0x3a71('0x10')]){_0x32489f[_0x483198[_0x3a71('0xb')][_0x3a71('0xc')]['toLowerCase']()]&&_0x58c3ce[_0x3a71('0x7')](util[_0x3a71('0x11')]('%s:\x20%s',_0x483198[_0x3a71('0x10')],_0x32489f[_0x483198[_0x3a71('0xb')][_0x3a71('0xc')][_0x3a71('0xd')]()]));}}}}return _0x58c3ce[_0x3a71('0x14')](_0x340d20);};exports[_0x3a71('0x15')]=function(_0x5a9455){var _0x48dc07=_0x5a9455[_0x3a71('0x16')](-0x1);if(_0x48dc07==='/'){_0x5a9455=_0x5a9455[_0x3a71('0x17')](0x0,_0x5a9455[_0x3a71('0x18')](_0x48dc07));}return _0x5a9455;};exports[_0x3a71('0x19')]=function(_0x5a1c9f){if(!_[_0x3a71('0x1a')](_0x5a1c9f)&&_0x5a1c9f!==''){var _0x3d5038=/^(([^<>()\[\]\\.,;:\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 _0x3d5038[_0x3a71('0x1b')](String(_0x5a1c9f)[_0x3a71('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x6223=['getString','type','push','content','variable','variableName','toString','customVariable','Variable','name','keyValue','keyType','key','format','keyContent','%s:\x20%s','toLowerCase','join','lastIndexOf','validateEmail','isNil','test','lodash','util'];(function(_0x10e3b7,_0x15984b){var _0x1d348b=function(_0x312eda){while(--_0x312eda){_0x10e3b7['push'](_0x10e3b7['shift']());}};_0x1d348b(++_0x15984b);}(_0x6223,0x11e));var _0x3622=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x6223[_0x5d80de];return _0x1c7556;};'use strict';var _=require(_0x3622('0x0'));var util=require(_0x3622('0x1'));exports[_0x3622('0x2')]=function(_0x18ac4b,_0x201b85,_0x4429ee){var _0x23ad62=[];if(_0x18ac4b['length']>0x0){var _0x698297=_['sortBy'](_0x18ac4b,['id']);for(var _0x321f14=0x0;_0x321f14<_0x698297['length'];_0x321f14++){var _0x44469c=_0x698297[_0x321f14];if(_0x44469c[_0x3622('0x3')]==='string'){_0x23ad62[_0x3622('0x4')](_0x44469c[_0x3622('0x5')]);}else if(_0x44469c[_0x3622('0x3')]===_0x3622('0x6')&&_0x44469c[_0x3622('0x7')]){_0x201b85[_0x44469c['variableName']]&&_0x23ad62['push'](_0x201b85[_0x44469c[_0x3622('0x7')]][_0x3622('0x8')]());}else if(_0x44469c[_0x3622('0x3')]===_0x3622('0x9')&&_0x44469c['Variable']&&_0x44469c[_0x3622('0xa')][_0x3622('0xb')]){_0x201b85[_0x44469c[_0x3622('0xa')][_0x3622('0xb')]['toLowerCase']()]&&_0x23ad62[_0x3622('0x4')](_0x201b85[_0x44469c['Variable'][_0x3622('0xb')]['toLowerCase']()][_0x3622('0x8')]());}else if(_0x44469c['type']===_0x3622('0xc')){if(_0x44469c[_0x3622('0xd')]==='string'&&_0x44469c[_0x3622('0xe')]){_0x23ad62['push'](util[_0x3622('0xf')]('%s:\x20%s',_0x44469c[_0x3622('0xe')],_0x44469c[_0x3622('0x10')]));}else if(_0x44469c['keyType']==='variable'&&_0x44469c[_0x3622('0x7')]&&_0x44469c[_0x3622('0xe')]){_0x201b85[_0x44469c[_0x3622('0x7')]]&&_0x23ad62['push'](util[_0x3622('0xf')](_0x3622('0x11'),_0x44469c[_0x3622('0xe')],_0x201b85[_0x44469c[_0x3622('0x7')]]));}else if(_0x44469c[_0x3622('0xd')]===_0x3622('0x9')&&_0x44469c[_0x3622('0xa')]&&_0x44469c[_0x3622('0xa')][_0x3622('0xb')]&&_0x44469c[_0x3622('0xe')]){_0x201b85[_0x44469c['Variable'][_0x3622('0xb')][_0x3622('0x12')]()]&&_0x23ad62['push'](util[_0x3622('0xf')](_0x3622('0x11'),_0x44469c['key'],_0x201b85[_0x44469c[_0x3622('0xa')]['name'][_0x3622('0x12')]()]));}}}}return _0x23ad62[_0x3622('0x13')](_0x4429ee);};exports['stripTrailingSlash']=function(_0x2db90a){var _0x394f18=_0x2db90a['slice'](-0x1);if(_0x394f18==='/'){_0x2db90a=_0x2db90a['substring'](0x0,_0x2db90a[_0x3622('0x14')](_0x394f18));}return _0x2db90a;};exports[_0x3622('0x15')]=function(_0x58ce01){if(!_[_0x3622('0x16')](_0x58ce01)&&_0x58ce01!==''){var _0x39a581=/^(([^<>()\[\]\\.,;:\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 _0x39a581[_0x3622('0x17')](String(_0x58ce01)[_0x3622('0x12')]());}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 98b8d92..ac586d0 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 _0xb338=['last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','catch','getUser','[vTiger],\x20%s,\x20%s,\x20%s','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','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','lastname','phone','getEndUser','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','user:%s','unmanaged','lastevent','toUpperCase','Fields','lodash','md5','util','ioredis','vTiger','redis','socket.io-emitter','emit','length','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Open','getString','Subjects','Descriptions','POST','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','format','remoteUri','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','email1','first_name'];(function(_0x32ae44,_0x2037a0){var _0x167205=function(_0x81cca8){while(--_0x81cca8){_0x32ae44['push'](_0x32ae44['shift']());}};_0x167205(++_0x2037a0);}(_0xb338,0x16e));var _0x8b33=function(_0x1235a8,_0x2db48e){_0x1235a8=_0x1235a8-0x0;var _0x41a2cf=_0xb338[_0x1235a8];return _0x41a2cf;};'use strict';var _=require(_0x8b33('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0x8b33('0x1'));var util=require(_0x8b33('0x2'));var Redis=require(_0x8b33('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x8b33('0x4'));config[_0x8b33('0x5')]=_['defaults'](config[_0x8b33('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x8b33('0x6'))(new Redis(config[_0x8b33('0x5')]));function emit(_0x50537d,_0x58907c,_0x2ec064){io['to'](_0x50537d)[_0x8b33('0x7')](_0x58907c,_0x2ec064);}function getCustomFields(_0x18b543,_0x109216){var _0x2e3764={};if(_0x18b543[_0x8b33('0x8')]>0x0){_[_0x8b33('0x9')](_0x18b543,function(_0x5a902b){if(_[_0x8b33('0xa')]([_0x8b33('0xb'),_0x8b33('0xc')],_0x5a902b[_0x8b33('0xd')])&&_0x5a902b[_0x8b33('0xe')]){_0x2e3764[_0x5a902b[_0x8b33('0xe')]]=_0x5a902b[_0x8b33('0xf')][_0x8b33('0x10')]();}else if(_0x5a902b['type']===_0x8b33('0x11')&&_0x5a902b[_0x8b33('0x12')]&&_0x5a902b[_0x8b33('0xe')]&&_0x109216[_0x5a902b[_0x8b33('0x12')]]){_0x2e3764[_0x5a902b[_0x8b33('0xe')]]=_0x109216[_0x5a902b[_0x8b33('0x12')]][_0x8b33('0x10')]();}else if(_0x5a902b[_0x8b33('0xd')]===_0x8b33('0x13')&&_0x5a902b['Variable']&&_0x5a902b[_0x8b33('0x14')]['name']&&_0x5a902b[_0x8b33('0xe')]&&_0x109216[_0x5a902b[_0x8b33('0x14')][_0x8b33('0x15')]['toLowerCase']()]){_0x2e3764[_0x5a902b[_0x8b33('0xe')]]=_0x109216[_0x5a902b[_0x8b33('0x14')]['name'][_0x8b33('0x16')]()][_0x8b33('0x10')]();}});}return _0x2e3764;}function createTicket(_0x3d6c87,_0x463733,_0x208c9e,_0x4b8b9a,_0x1bc04e,_0x407776,_0x106255){logger[_0x8b33('0x17')](_0x8b33('0x18'));var _0x5c3040=_[_0x8b33('0x19')]({'parent_id':'','assigned_user_id':_0x463733['id'],'ticketpriorities':'Normal','ticketstatus':_0x8b33('0x1a'),'ticket_title':intUtil[_0x8b33('0x1b')](_0x4b8b9a[_0x8b33('0x1c')],_0x1bc04e,'\x20'),'description':intUtil[_0x8b33('0x1b')](_0x4b8b9a[_0x8b33('0x1d')],_0x1bc04e,'\x0a'),'contact_id':_0x208c9e['id']},getCustomFields(_0x407776,_0x1bc04e));var _0x16c7c4={'method':_0x8b33('0x1e'),'uri':util['format'](_0x8b33('0x1f'),_0x3d6c87['remoteUri']),'form':{'operation':_0x8b33('0x20'),'username':_0x3d6c87[_0x8b33('0x21')],'sessionName':_0x106255[_0x8b33('0x22')],'elementType':_0x8b33('0x23'),'element':JSON[_0x8b33('0x24')](_0x5c3040)},'json':!![]};return request(_0x16c7c4)[_0x8b33('0x25')](function(_0x29f7ce){if(_0x29f7ce['success']){return BPromise[_0x8b33('0x26')]({'id':_0x29f7ce[_0x8b33('0x27')]['id']});}else{throw new Error(util['format'](_0x8b33('0x28'),JSON[_0x8b33('0x24')](_0x29f7ce['error'])));}})['catch'](function(_0x5ed44a){var _0x13aa0c=_0x5ed44a[_0x8b33('0x29')]||0x1f4;logger[_0x8b33('0x2a')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x8b33('0x2b'),_0x13aa0c,JSON[_0x8b33('0x24')](_0x5ed44a));});}function getUser(_0x29fd87,_0x265f4c,_0x208883){if(intUtil[_0x8b33('0x2c')](_0x265f4c)){logger['info'](_0x8b33('0x2d'),_0x265f4c);return request({'method':_0x8b33('0x2e'),'uri':util[_0x8b33('0x2f')](_0x8b33('0x1f'),_0x29fd87[_0x8b33('0x30')]),'qs':{'operation':_0x8b33('0x31'),'username':_0x29fd87[_0x8b33('0x21')],'sessionName':_0x208883[_0x8b33('0x22')],'query':util['format'](_0x8b33('0x32'),_0x265f4c)},'json':!![]})[_0x8b33('0x25')](function(_0x5c5819){if(_0x5c5819[_0x8b33('0x33')]&&_0x5c5819[_0x8b33('0x27')][_0x8b33('0x8')]){logger[_0x8b33('0x17')]('Agent\x20found!');return BPromise['resolve']({'id':_0x5c5819['result'][0x0]['id'],'email':_0x5c5819[_0x8b33('0x27')][0x0][_0x8b33('0x34')],'name':_0x5c5819[_0x8b33('0x27')][0x0][_0x8b33('0x35')]+'\x20'+_0x5c5819[_0x8b33('0x27')][_0x8b33('0x36')]});}else{logger['info'](_0x8b33('0x37'));return BPromise[_0x8b33('0x26')]({'id':_0x208883[_0x8b33('0x38')],'email':_0x29fd87[_0x8b33('0x21')],'name':'admin'});}})[_0x8b33('0x39')](function(_0x33de93){var _0x307599=_0x33de93[_0x8b33('0x29')]||0x1f4;logger[_0x8b33('0x2a')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x8b33('0x3a'),_0x307599,JSON[_0x8b33('0x24')](_0x33de93));});}else{logger[_0x8b33('0x17')](_0x8b33('0x37'));return BPromise[_0x8b33('0x26')]({'id':_0x208883[_0x8b33('0x38')],'email':_0x29fd87['username'],'name':'admin'})[_0x8b33('0x39')](function(_0x29a8ea){var _0x1ce32f=_0x29a8ea[_0x8b33('0x29')]||0x1f4;logger[_0x8b33('0x2a')](_0x8b33('0x3b'),_0x8b33('0x3a'),_0x1ce32f,JSON['stringify'](_0x29a8ea));});}}function getEndUser(_0x17a21b,_0x269b96,_0x2499d8,_0xd5d3c9){logger[_0x8b33('0x17')](_0x8b33('0x3c'),_0x2499d8);return request({'method':'GET','uri':util['format'](_0x8b33('0x1f'),_0x17a21b[_0x8b33('0x30')]),'qs':{'operation':_0x8b33('0x31'),'username':_0x17a21b[_0x8b33('0x21')],'sessionName':_0xd5d3c9[_0x8b33('0x22')],'query':util[_0x8b33('0x2f')](_0x8b33('0x3d'),_0x2499d8,_0x2499d8,_0x2499d8,_0x2499d8,_0x2499d8)},'json':!![]})[_0x8b33('0x25')](function(_0x4dfc90){if(_0x4dfc90[_0x8b33('0x33')]&&_0x4dfc90[_0x8b33('0x27')][_0x8b33('0x8')]){logger[_0x8b33('0x17')](_0x8b33('0x3e'));return BPromise[_0x8b33('0x26')]({'id':_0x4dfc90['result'][0x0]['id'],'name':_0x4dfc90[_0x8b33('0x27')][0x0][_0x8b33('0x3f')]+'\x20'+_0x4dfc90[_0x8b33('0x27')][0x0]['lastname'],'phone':_0x2499d8});}else{logger[_0x8b33('0x17')](_0x8b33('0x40'));return request({'method':'POST','uri':util['format'](_0x8b33('0x1f'),_0x17a21b[_0x8b33('0x30')]),'form':{'operation':'create','sessionName':_0xd5d3c9['sessionName'],'elementType':_0x8b33('0x41'),'element':JSON[_0x8b33('0x24')]({'lastname':_0x269b96,'phone':_0x2499d8,'assigned_user_id':'\x20'})},'json':!![]})[_0x8b33('0x25')](function(_0x3e8673){logger[_0x8b33('0x17')](_0x8b33('0x42'));return BPromise[_0x8b33('0x26')]({'id':_0x3e8673[_0x8b33('0x27')]['id'],'name':_0x3e8673[_0x8b33('0x27')][_0x8b33('0x43')],'phone':_0x3e8673[_0x8b33('0x27')][_0x8b33('0x44')]});})[_0x8b33('0x39')](function(_0x30142b){var _0x4b7395=_0x30142b[_0x8b33('0x29')]||0x1f4;logger['error'](_0x8b33('0x3b'),_0x8b33('0x45'),_0x4b7395,JSON['stringify'](_0x30142b));});}});}function getConnection(_0x1a752d){var _0x43dc2d=_0x1a752d[_0x8b33('0x21')];var _0x130377=_0x1a752d['accessKey'];return request({'method':'GET','uri':util[_0x8b33('0x2f')]('%s/webservice.php',_0x1a752d['remoteUri']),'qs':{'operation':_0x8b33('0x46'),'username':_0x43dc2d},'json':!![]})[_0x8b33('0x25')](function(_0x2bf072){if(_0x2bf072[_0x8b33('0x33')]){return request({'method':_0x8b33('0x1e'),'uri':util[_0x8b33('0x2f')]('%s/webservice.php',_0x1a752d[_0x8b33('0x30')]),'form':{'operation':_0x8b33('0x47'),'username':_0x43dc2d,'accessKey':md5(_0x2bf072[_0x8b33('0x27')][_0x8b33('0x48')]+_0x130377)},'json':!![]});}})['then'](function(_0x587255){if(_0x587255[_0x8b33('0x33')]){return BPromise[_0x8b33('0x26')](_0x587255[_0x8b33('0x27')]);}else{throw new Error(util[_0x8b33('0x2f')](_0x8b33('0x49'),_0x1a752d['id']));}})[_0x8b33('0x39')](function(_0x36cf86){var _0x212f0b=_0x36cf86[_0x8b33('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getConnection',_0x212f0b,JSON[_0x8b33('0x24')](_0x36cf86));});}function request(_0x31ca0b){logger['info'](_0x8b33('0x4a'),JSON[_0x8b33('0x24')](_0x31ca0b));return rp(_0x31ca0b);}exports[_0x8b33('0x4b')]=function(_0x15ea5a,_0xa8b49c,_0x2f8a16,_0x27da3f,_0x2b7957,_0x4f0fe2){var _0x14b270,_0x592694,_0x1693d5,_0x3505ca;_0x4f0fe2['remoteUri']=intUtil[_0x8b33('0x4c')](_0x4f0fe2[_0x8b33('0x30')]);if(_0x2b7957&&_0x2b7957[_0x8b33('0x4d')]){logger[_0x8b33('0x17')]('[QUEUE]',_0x8b33('0x4e'));_0xa8b49c[_0x8b33('0x4f')]=util['format'](_0x8b33('0x50'),_0x4f0fe2[_0x8b33('0x51')],_0xa8b49c[_0x8b33('0x52')],md5(_0xa8b49c['uniqueid']));}else{_0xa8b49c[_0x8b33('0x4f')]='';}return getConnection(_0x4f0fe2)[_0x8b33('0x25')](function(_0x446560){_0x3505ca=_0x446560;return getUser(_0x4f0fe2,_0x27da3f[_0x8b33('0x53')],_0x3505ca);})[_0x8b33('0x25')](function(_0x4b5479){_0x14b270=_0x4b5479;logger[_0x8b33('0x17')](_0x8b33('0x54'),_0x14b270['id']);return getEndUser(_0x4f0fe2,_0xa8b49c[_0x8b33('0x55')],_0xa8b49c[_0x8b33('0x56')],_0x3505ca);})[_0x8b33('0x25')](function(_0x2461c5){_0x592694=_0x2461c5;logger['info'](_0x8b33('0x57'),_0x592694['id']);return createTicket(_0x4f0fe2,_0x14b270,_0x592694,_0x2f8a16,_0xa8b49c,_0x2f8a16['Fields'],_0x3505ca);})[_0x8b33('0x25')](function(_0x36d837){_0x1693d5=_0x36d837;logger[_0x8b33('0x17')](_0x8b33('0x58'));logger[_0x8b33('0x17')](_0x8b33('0x59'),_0x1693d5['id']);var _0x48fd68=util[_0x8b33('0x2f')](_0x8b33('0x5a'),_0x4f0fe2[_0x8b33('0x30')],_[_0x8b33('0x5b')](_0x1693d5['id'],'x')[0x1]);logger[_0x8b33('0x17')](_0x8b33('0x5c'),_0x8b33('0x5d'));emit(util[_0x8b33('0x2f')]('user:%s',_0x27da3f[_0x8b33('0x15')]),_0x8b33('0x5e'),{'uri':_0x48fd68});})[_0x8b33('0x39')](function(_0x33ebb7){logger[_0x8b33('0x2a')](_0x8b33('0x5c'),JSON[_0x8b33('0x24')](_0x33ebb7));});};exports[_0x8b33('0x5f')]=function(_0xf42b19,_0x1355c6,_0x39bbcf,_0x2df4e7,_0x4d8b45,_0x4ca9c0,_0x40225c){var _0xc6cb07,_0x5b581e,_0x1241a2,_0x2c01a8;_0x4ca9c0[_0x8b33('0x30')]=intUtil['stripTrailingSlash'](_0x4ca9c0[_0x8b33('0x30')]);_0x4ca9c0['serverUrl']=intUtil[_0x8b33('0x4c')](_0x4ca9c0[_0x8b33('0x51')]);if(_0x40225c&&_0x40225c[_0x8b33('0x60')]&&_0x40225c[_0x8b33('0x60')]!==_0x8b33('0x61')){logger['info'](_0x8b33('0x62'),_0x8b33('0x4e'));_0x1355c6['recordingURL']=util[_0x8b33('0x2f')](_0x8b33('0x50'),_0x4ca9c0[_0x8b33('0x51')],_0x1355c6['uniqueid'],md5(_0x1355c6['uniqueid']));}return getConnection(_0x4ca9c0)[_0x8b33('0x25')](function(_0x3806ef){_0x2c01a8=_0x3806ef;return getUser(_0x4ca9c0,_0x2df4e7[_0x8b33('0x53')],_0x2c01a8);})[_0x8b33('0x25')](function(_0x1135ed){_0xc6cb07=_0x1135ed;logger[_0x8b33('0x17')]('The\x20User\x20ID\x20is:',_0xc6cb07['id']);return getEndUser(_0x4ca9c0,_0x1355c6[_0x8b33('0x63')],_0x1355c6['destcalleridnum'],_0x2c01a8);})[_0x8b33('0x25')](function(_0x18afe7){_0x5b581e=_0x18afe7;logger[_0x8b33('0x17')](_0x8b33('0x57'),_0x5b581e['id']);return createTicket(_0x4ca9c0,_0xc6cb07,_0x5b581e,_0x39bbcf,_0x1355c6,_0x39bbcf['Fields'],_0x2c01a8);})[_0x8b33('0x25')](function(_0x55f34a){_0x1241a2=_0x55f34a;logger[_0x8b33('0x17')]('Ticket\x20created!');logger[_0x8b33('0x17')](_0x8b33('0x59'),_0x1241a2['id']);var _0x4e411b=util[_0x8b33('0x2f')](_0x8b33('0x5a'),_0x4ca9c0['remoteUri'],_[_0x8b33('0x5b')](_0x1241a2['id'],'x')[0x1]);logger['info'](_0x8b33('0x62'),_0x8b33('0x5d'));emit(util['format'](_0x8b33('0x64'),_0x2df4e7[_0x8b33('0x15')]),_0x8b33('0x5e'),{'uri':_0x4e411b});})[_0x8b33('0x39')](function(_0x21fa09){logger[_0x8b33('0x2a')](_0x8b33('0x62'),JSON['stringify'](_0x21fa09));});};exports[_0x8b33('0x65')]=function(_0x556a4d,_0x54ffb0,_0x56343b,_0x4448b5,_0x197838,_0x478380){var _0x207803,_0x25b1d3,_0x4cdb03,_0x517cc4;_0x478380[_0x8b33('0x30')]=intUtil[_0x8b33('0x4c')](_0x478380[_0x8b33('0x30')]);_0x478380[_0x8b33('0x51')]=intUtil[_0x8b33('0x4c')](_0x478380[_0x8b33('0x51')]);if(_0x197838&&_0x197838[_0x8b33('0x4d')]){logger['info']('['+_0x54ffb0[_0x8b33('0x66')][_0x8b33('0x67')]()+']',_0x8b33('0x4e'));_0x54ffb0[_0x8b33('0x4f')]=util['format'](_0x8b33('0x50'),_0x478380[_0x8b33('0x51')],_0x54ffb0['uniqueid'],md5(_0x54ffb0[_0x8b33('0x52')]));}else{_0x54ffb0[_0x8b33('0x4f')]='';}return getConnection(_0x478380)[_0x8b33('0x25')](function(_0x35f42f){_0x517cc4=_0x35f42f;return getUser(_0x478380,'',_0x517cc4);})['then'](function(_0x560ed2){_0x207803=_0x560ed2;logger[_0x8b33('0x17')](_0x8b33('0x54'),_0x207803['id']);return getEndUser(_0x478380,_0x54ffb0[_0x8b33('0x55')],_0x54ffb0[_0x8b33('0x56')],_0x517cc4);})[_0x8b33('0x25')](function(_0xca530c){_0x25b1d3=_0xca530c;logger[_0x8b33('0x17')](_0x8b33('0x57'),_0x25b1d3['id']);return createTicket(_0x478380,_0x207803,_0x25b1d3,_0x56343b,_0x54ffb0,_0x56343b[_0x8b33('0x68')],_0x517cc4);})[_0x8b33('0x25')](function(_0x440853){_0x4cdb03=_0x440853;logger['info'](_0x8b33('0x58'));logger[_0x8b33('0x17')](_0x8b33('0x59'),_0x4cdb03['id']);})['catch'](function(_0x278101){logger[_0x8b33('0x2a')]('['+_0x54ffb0[_0x8b33('0x66')][_0x8b33('0x67')]()+']',JSON['stringify'](_0x278101));});}; \ No newline at end of file +var _0x489e=['localhost','socket.io-emitter','emit','length','forEach','includes','string','picklist','type','idField','content','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','Descriptions','POST','format','%s/webservice.php','username','sessionName','HelpDesk','stringify','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','validateEmail','Getting\x20agent\x20with\x20email','GET','remoteUri','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','then','email1','first_name','last_name','userId','admin','getUser','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','[vTiger],\x20%s,\x20%s,\x20%s','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','firstname','lastname','create','Contacts','Enduser\x20created.','phone','getEndUser','login','token','Account\x20%d\x20is\x20not\x20valid','queue','monitor_format','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','defaults','redis'];(function(_0x20e612,_0x3d0909){var _0x618b3c=function(_0x4062dd){while(--_0x4062dd){_0x20e612['push'](_0x20e612['shift']());}};_0x618b3c(++_0x3d0909);}(_0x489e,0x184));var _0xe489=function(_0xcfcdb2,_0x4d9a34){_0xcfcdb2=_0xcfcdb2-0x0;var _0x1be5ef=_0x489e[_0xcfcdb2];return _0x1be5ef;};'use strict';var _=require(_0xe489('0x0'));var rp=require(_0xe489('0x1'));var BPromise=require('bluebird');var md5=require(_0xe489('0x2'));var util=require(_0xe489('0x3'));var Redis=require(_0xe489('0x4'));var intUtil=require(_0xe489('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('vTiger');config['redis']=_[_0xe489('0x6')](config[_0xe489('0x7')],{'host':_0xe489('0x8'),'port':0x18eb});var io=require(_0xe489('0x9'))(new Redis(config['redis']));function emit(_0x398439,_0x5588ac,_0x10c919){io['to'](_0x398439)[_0xe489('0xa')](_0x5588ac,_0x10c919);}function getCustomFields(_0x403df3,_0x5e0faa){var _0x1349e0={};if(_0x403df3[_0xe489('0xb')]>0x0){_[_0xe489('0xc')](_0x403df3,function(_0x232751){if(_[_0xe489('0xd')]([_0xe489('0xe'),_0xe489('0xf')],_0x232751[_0xe489('0x10')])&&_0x232751['idField']){_0x1349e0[_0x232751[_0xe489('0x11')]]=_0x232751[_0xe489('0x12')][_0xe489('0x13')]();}else if(_0x232751['type']==='variable'&&_0x232751[_0xe489('0x14')]&&_0x232751[_0xe489('0x11')]&&_0x5e0faa[_0x232751[_0xe489('0x14')]]){_0x1349e0[_0x232751['idField']]=_0x5e0faa[_0x232751[_0xe489('0x14')]]['toString']();}else if(_0x232751[_0xe489('0x10')]==='customVariable'&&_0x232751[_0xe489('0x15')]&&_0x232751[_0xe489('0x15')][_0xe489('0x16')]&&_0x232751[_0xe489('0x11')]&&_0x5e0faa[_0x232751[_0xe489('0x15')][_0xe489('0x16')][_0xe489('0x17')]()]){_0x1349e0[_0x232751[_0xe489('0x11')]]=_0x5e0faa[_0x232751[_0xe489('0x15')][_0xe489('0x16')][_0xe489('0x17')]()]['toString']();}});}return _0x1349e0;}function createTicket(_0x2f1e45,_0x239dfa,_0x1ecf70,_0x3a9248,_0x3e5e61,_0x18aaed,_0x3549c2){logger[_0xe489('0x18')](_0xe489('0x19'));var _0x2216ab=_[_0xe489('0x1a')]({'parent_id':'','assigned_user_id':_0x239dfa['id'],'ticketpriorities':_0xe489('0x1b'),'ticketstatus':_0xe489('0x1c'),'ticket_title':intUtil[_0xe489('0x1d')](_0x3a9248[_0xe489('0x1e')],_0x3e5e61,'\x20'),'description':intUtil[_0xe489('0x1d')](_0x3a9248[_0xe489('0x1f')],_0x3e5e61,'\x0a'),'contact_id':_0x1ecf70['id']},getCustomFields(_0x18aaed,_0x3e5e61));var _0x596fda={'method':_0xe489('0x20'),'uri':util[_0xe489('0x21')](_0xe489('0x22'),_0x2f1e45['remoteUri']),'form':{'operation':'create','username':_0x2f1e45[_0xe489('0x23')],'sessionName':_0x3549c2[_0xe489('0x24')],'elementType':_0xe489('0x25'),'element':JSON[_0xe489('0x26')](_0x2216ab)},'json':!![]};return request(_0x596fda)['then'](function(_0x3f562c){if(_0x3f562c[_0xe489('0x27')]){return BPromise[_0xe489('0x28')]({'id':_0x3f562c[_0xe489('0x29')]['id']});}else{throw new Error(util['format'](_0xe489('0x2a'),JSON[_0xe489('0x26')](_0x3f562c[_0xe489('0x2b')])));}})[_0xe489('0x2c')](function(_0x7fd932){var _0x4cfc70=_0x7fd932[_0xe489('0x2d')]||0x1f4;logger[_0xe489('0x2b')]('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x4cfc70,JSON['stringify'](_0x7fd932));});}function getUser(_0x3fa1ce,_0x220945,_0x9a2a84){if(intUtil[_0xe489('0x2e')](_0x220945)){logger['info'](_0xe489('0x2f'),_0x220945);return request({'method':_0xe489('0x30'),'uri':util[_0xe489('0x21')](_0xe489('0x22'),_0x3fa1ce[_0xe489('0x31')]),'qs':{'operation':_0xe489('0x32'),'username':_0x3fa1ce[_0xe489('0x23')],'sessionName':_0x9a2a84[_0xe489('0x24')],'query':util['format'](_0xe489('0x33'),_0x220945)},'json':!![]})[_0xe489('0x34')](function(_0x2ff612){if(_0x2ff612[_0xe489('0x27')]&&_0x2ff612[_0xe489('0x29')][_0xe489('0xb')]){logger[_0xe489('0x18')]('Agent\x20found!');return BPromise[_0xe489('0x28')]({'id':_0x2ff612['result'][0x0]['id'],'email':_0x2ff612[_0xe489('0x29')][0x0][_0xe489('0x35')],'name':_0x2ff612[_0xe489('0x29')][0x0][_0xe489('0x36')]+'\x20'+_0x2ff612[_0xe489('0x29')][_0xe489('0x37')]});}else{logger[_0xe489('0x18')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xe489('0x28')]({'id':_0x9a2a84[_0xe489('0x38')],'email':_0x3fa1ce[_0xe489('0x23')],'name':_0xe489('0x39')});}})['catch'](function(_0xf2bff3){var _0x3cbf68=_0xf2bff3[_0xe489('0x2d')]||0x1f4;logger[_0xe489('0x2b')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xe489('0x3a'),_0x3cbf68,JSON['stringify'](_0xf2bff3));});}else{logger[_0xe489('0x18')](_0xe489('0x3b'));return BPromise[_0xe489('0x28')]({'id':_0x9a2a84[_0xe489('0x38')],'email':_0x3fa1ce[_0xe489('0x23')],'name':'admin'})[_0xe489('0x2c')](function(_0x379223){var _0x58f228=_0x379223[_0xe489('0x2d')]||0x1f4;logger['error'](_0xe489('0x3c'),_0xe489('0x3a'),_0x58f228,JSON[_0xe489('0x26')](_0x379223));});}}function getEndUser(_0x146a83,_0x460df0,_0x554fb6,_0xcd576a){logger['info']('Searching\x20end\x20user\x20with\x20phone',_0x554fb6);return request({'method':_0xe489('0x30'),'uri':util[_0xe489('0x21')]('%s/webservice.php',_0x146a83[_0xe489('0x31')]),'qs':{'operation':_0xe489('0x32'),'username':_0x146a83[_0xe489('0x23')],'sessionName':_0xcd576a[_0xe489('0x24')],'query':util['format'](_0xe489('0x3d'),_0x554fb6,_0x554fb6,_0x554fb6,_0x554fb6,_0x554fb6)},'json':!![]})['then'](function(_0x2c38d3){if(_0x2c38d3['success']&&_0x2c38d3[_0xe489('0x29')][_0xe489('0xb')]){logger[_0xe489('0x18')]('Enduser\x20found!');return BPromise[_0xe489('0x28')]({'id':_0x2c38d3[_0xe489('0x29')][0x0]['id'],'name':_0x2c38d3[_0xe489('0x29')][0x0][_0xe489('0x3e')]+'\x20'+_0x2c38d3[_0xe489('0x29')][0x0][_0xe489('0x3f')],'phone':_0x554fb6});}else{logger[_0xe489('0x18')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0xe489('0x20'),'uri':util['format'](_0xe489('0x22'),_0x146a83[_0xe489('0x31')]),'form':{'operation':_0xe489('0x40'),'sessionName':_0xcd576a[_0xe489('0x24')],'elementType':_0xe489('0x41'),'element':JSON[_0xe489('0x26')]({'lastname':_0x460df0,'phone':_0x554fb6,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x7da1aa){logger[_0xe489('0x18')](_0xe489('0x42'));return BPromise[_0xe489('0x28')]({'id':_0x7da1aa[_0xe489('0x29')]['id'],'name':_0x7da1aa[_0xe489('0x29')][_0xe489('0x3f')],'phone':_0x7da1aa[_0xe489('0x29')][_0xe489('0x43')]});})[_0xe489('0x2c')](function(_0x393714){var _0x2a24ed=_0x393714[_0xe489('0x2d')]||0x1f4;logger[_0xe489('0x2b')](_0xe489('0x3c'),_0xe489('0x44'),_0x2a24ed,JSON[_0xe489('0x26')](_0x393714));});}});}function getConnection(_0x41f76e){var _0x904c20=_0x41f76e[_0xe489('0x23')];var _0x41d24e=_0x41f76e['accessKey'];return request({'method':_0xe489('0x30'),'uri':util['format'](_0xe489('0x22'),_0x41f76e[_0xe489('0x31')]),'qs':{'operation':'getchallenge','username':_0x904c20},'json':!![]})['then'](function(_0x246ab8){if(_0x246ab8[_0xe489('0x27')]){return request({'method':_0xe489('0x20'),'uri':util[_0xe489('0x21')](_0xe489('0x22'),_0x41f76e[_0xe489('0x31')]),'form':{'operation':_0xe489('0x45'),'username':_0x904c20,'accessKey':md5(_0x246ab8[_0xe489('0x29')][_0xe489('0x46')]+_0x41d24e)},'json':!![]});}})['then'](function(_0x3c1bbb){if(_0x3c1bbb[_0xe489('0x27')]){return BPromise['resolve'](_0x3c1bbb['result']);}else{throw new Error(util[_0xe489('0x21')](_0xe489('0x47'),_0x41f76e['id']));}})[_0xe489('0x2c')](function(_0x112aa9){var _0x1d6f7f=_0x112aa9[_0xe489('0x2d')]||0x1f4;logger[_0xe489('0x2b')](_0xe489('0x3c'),'getConnection',_0x1d6f7f,JSON['stringify'](_0x112aa9));});}function request(_0x1ce58e){logger[_0xe489('0x18')]('[HTTP]',JSON[_0xe489('0x26')](_0x1ce58e));return rp(_0x1ce58e);}exports[_0xe489('0x48')]=function(_0x1039f1,_0x1a6d4f,_0x17be1b,_0x4894a8,_0x63f5e1,_0x27eab6){var _0x302b6e,_0xcf9b24,_0x11e1ab,_0x298d7a;_0x27eab6[_0xe489('0x31')]=intUtil['stripTrailingSlash'](_0x27eab6[_0xe489('0x31')]);if(_0x63f5e1&&_0x63f5e1[_0xe489('0x49')]){logger[_0xe489('0x18')]('[QUEUE]',_0xe489('0x4a'));_0x1a6d4f[_0xe489('0x4b')]=util[_0xe489('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x27eab6[_0xe489('0x4c')],_0x1a6d4f[_0xe489('0x4d')],md5(_0x1a6d4f[_0xe489('0x4d')]));}else{_0x1a6d4f[_0xe489('0x4b')]='';}return getConnection(_0x27eab6)['then'](function(_0x267c0f){_0x298d7a=_0x267c0f;return getUser(_0x27eab6,_0x4894a8[_0xe489('0x4e')],_0x298d7a);})[_0xe489('0x34')](function(_0x550d4a){_0x302b6e=_0x550d4a;logger['info'](_0xe489('0x4f'),_0x302b6e['id']);return getEndUser(_0x27eab6,_0x1a6d4f[_0xe489('0x50')],_0x1a6d4f[_0xe489('0x51')],_0x298d7a);})[_0xe489('0x34')](function(_0x33af30){_0xcf9b24=_0x33af30;logger[_0xe489('0x18')](_0xe489('0x52'),_0xcf9b24['id']);return createTicket(_0x27eab6,_0x302b6e,_0xcf9b24,_0x17be1b,_0x1a6d4f,_0x17be1b[_0xe489('0x53')],_0x298d7a);})[_0xe489('0x34')](function(_0x6bca1b){_0x11e1ab=_0x6bca1b;logger[_0xe489('0x18')](_0xe489('0x54'));logger[_0xe489('0x18')](_0xe489('0x55'),_0x11e1ab['id']);var _0x3f6a01=util[_0xe489('0x21')](_0xe489('0x56'),_0x27eab6[_0xe489('0x31')],_[_0xe489('0x57')](_0x11e1ab['id'],'x')[0x1]);logger[_0xe489('0x18')](_0xe489('0x58'),_0xe489('0x59'));emit(util['format'](_0xe489('0x5a'),_0x4894a8[_0xe489('0x16')]),'trigger:browser:url',{'uri':_0x3f6a01});})[_0xe489('0x2c')](function(_0x395114){logger[_0xe489('0x2b')](_0xe489('0x58'),JSON[_0xe489('0x26')](_0x395114));});};exports[_0xe489('0x5b')]=function(_0x2a5a18,_0x5a5c29,_0xf5f768,_0xacaac3,_0x485976,_0x4ac4f7,_0x429cbf){var _0x54e75f,_0x5c4037,_0x4069b6,_0x2d7474;_0x4ac4f7[_0xe489('0x31')]=intUtil[_0xe489('0x5c')](_0x4ac4f7['remoteUri']);_0x4ac4f7['serverUrl']=intUtil[_0xe489('0x5c')](_0x4ac4f7['serverUrl']);if(_0x429cbf&&_0x429cbf[_0xe489('0x5d')]&&_0x429cbf['recordingFormat']!==_0xe489('0x5e')){logger[_0xe489('0x18')](_0xe489('0x5f'),_0xe489('0x4a'));_0x5a5c29[_0xe489('0x4b')]=util[_0xe489('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4ac4f7[_0xe489('0x4c')],_0x5a5c29[_0xe489('0x4d')],md5(_0x5a5c29['uniqueid']));}return getConnection(_0x4ac4f7)[_0xe489('0x34')](function(_0x264363){_0x2d7474=_0x264363;return getUser(_0x4ac4f7,_0xacaac3[_0xe489('0x4e')],_0x2d7474);})['then'](function(_0x2a0120){_0x54e75f=_0x2a0120;logger[_0xe489('0x18')](_0xe489('0x4f'),_0x54e75f['id']);return getEndUser(_0x4ac4f7,_0x5a5c29[_0xe489('0x60')],_0x5a5c29[_0xe489('0x61')],_0x2d7474);})[_0xe489('0x34')](function(_0x42d0d6){_0x5c4037=_0x42d0d6;logger[_0xe489('0x18')](_0xe489('0x52'),_0x5c4037['id']);return createTicket(_0x4ac4f7,_0x54e75f,_0x5c4037,_0xf5f768,_0x5a5c29,_0xf5f768[_0xe489('0x53')],_0x2d7474);})[_0xe489('0x34')](function(_0x14dfef){_0x4069b6=_0x14dfef;logger[_0xe489('0x18')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x4069b6['id']);var _0x2e8334=util[_0xe489('0x21')](_0xe489('0x56'),_0x4ac4f7[_0xe489('0x31')],_['split'](_0x4069b6['id'],'x')[0x1]);logger[_0xe489('0x18')]('[OUTBOUND]',_0xe489('0x59'));emit(util[_0xe489('0x21')](_0xe489('0x5a'),_0xacaac3[_0xe489('0x16')]),'trigger:browser:url',{'uri':_0x2e8334});})['catch'](function(_0x21b2c9){logger[_0xe489('0x2b')](_0xe489('0x5f'),JSON[_0xe489('0x26')](_0x21b2c9));});};exports['unmanaged']=function(_0x41733e,_0x217e65,_0x547f82,_0x271fac,_0x3953f7,_0x34a6ad){var _0x320e00,_0x206f45,_0x1a405d,_0x29f860;_0x34a6ad[_0xe489('0x31')]=intUtil[_0xe489('0x5c')](_0x34a6ad[_0xe489('0x31')]);_0x34a6ad['serverUrl']=intUtil[_0xe489('0x5c')](_0x34a6ad[_0xe489('0x4c')]);if(_0x3953f7&&_0x3953f7[_0xe489('0x49')]){logger[_0xe489('0x18')]('['+_0x217e65['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x217e65[_0xe489('0x4b')]=util[_0xe489('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x34a6ad[_0xe489('0x4c')],_0x217e65[_0xe489('0x4d')],md5(_0x217e65[_0xe489('0x4d')]));}else{_0x217e65[_0xe489('0x4b')]='';}return getConnection(_0x34a6ad)[_0xe489('0x34')](function(_0x14f77c){_0x29f860=_0x14f77c;return getUser(_0x34a6ad,'',_0x29f860);})[_0xe489('0x34')](function(_0x6c057d){_0x320e00=_0x6c057d;logger[_0xe489('0x18')]('The\x20User\x20ID\x20is:',_0x320e00['id']);return getEndUser(_0x34a6ad,_0x217e65['calleridname'],_0x217e65[_0xe489('0x51')],_0x29f860);})['then'](function(_0x45aac8){_0x206f45=_0x45aac8;logger[_0xe489('0x18')](_0xe489('0x52'),_0x206f45['id']);return createTicket(_0x34a6ad,_0x320e00,_0x206f45,_0x547f82,_0x217e65,_0x547f82[_0xe489('0x53')],_0x29f860);})['then'](function(_0x3f4438){_0x1a405d=_0x3f4438;logger[_0xe489('0x18')](_0xe489('0x54'));logger[_0xe489('0x18')]('The\x20Ticket\x20ID\x20is:',_0x1a405d['id']);})[_0xe489('0x2c')](function(_0x57f271){logger[_0xe489('0x2b')]('['+_0x217e65['lastevent'][_0xe489('0x62')]()+']',JSON['stringify'](_0x57f271));});}; \ 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 a2be1b8..20f75c3 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 _0x97f2=['%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','agent','%s/users/me.json','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/search.json','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','authType','password','%s:%s','username','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','idField','custom_fields','push','content','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','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:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','The\x20Ticket\x20ID\x20is:','unmanaged','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','format'];(function(_0x2d1030,_0x4a642e){var _0x1e2dcf=function(_0x4373db){while(--_0x4373db){_0x2d1030['push'](_0x2d1030['shift']());}};_0x1e2dcf(++_0x4a642e);}(_0x97f2,0x142));var _0x297f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x97f2[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x297f('0x0'));var rp=require('request-promise');var md5=require(_0x297f('0x1'));var util=require(_0x297f('0x2'));var Redis=require(_0x297f('0x3'));var intUtil=require('./util');var config=require(_0x297f('0x4'));var logger=require(_0x297f('0x5'))(_0x297f('0x6'));config[_0x297f('0x7')]=_[_0x297f('0x8')](config[_0x297f('0x7')],{'host':_0x297f('0x9'),'port':0x18eb});var io=require(_0x297f('0xa'))(new Redis(config[_0x297f('0x7')]));function emit(_0x402697,_0x7dd3ff,_0x14aafe){io['to'](_0x402697)['emit'](_0x7dd3ff,_0x14aafe);}var headers={'Content-Type':_0x297f('0xb'),'Accept':_0x297f('0xb')};function getTicket(_0x26cf01,_0x46fb75,_0x27d6da,_0x4f69cb,_0xfa1858){logger[_0x297f('0xc')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x297f('0xd')](_0x297f('0xe'),_0x26cf01[_0x297f('0xf')]),'method':_0x297f('0x10'),'body':{'ticket':_[_0x297f('0x11')]({'requester_id':_0x27d6da['id'],'submitter_id':_0x46fb75?_0x46fb75['id']:undefined,'assignee_id':_0x46fb75?_0x46fb75['id']:undefined,'tags':getTags(_0x4f69cb[_0x297f('0x12')],_0x297f('0x13')),'subject':intUtil[_0x297f('0x14')](_0x4f69cb['Subjects'],_0xfa1858,'\x20'),'description':intUtil[_0x297f('0x14')](_0x4f69cb[_0x297f('0x15')],_0xfa1858,'\x0a'),'comment':{'public':![],'body':intUtil[_0x297f('0x14')](_0x4f69cb[_0x297f('0x15')],_0xfa1858,'\x0a')}},getCustomFields(_0x4f69cb[_0x297f('0x16')],_0xfa1858))}})[_0x297f('0x17')](function(_0x3e04f4){logger['info'](_0x297f('0x18'));return _0x3e04f4['ticket'];});}function getUser(_0x6b9017,_0x263eb8){if(intUtil[_0x297f('0x19')](_0x263eb8)){logger[_0x297f('0xc')](_0x297f('0x1a'),_0x263eb8);return request({'uri':util['format']('%s/search.json',_0x6b9017[_0x297f('0xf')]),'qs':{'query':util[_0x297f('0xd')](_0x297f('0x1b'),_0x263eb8)}})[_0x297f('0x17')](function(_0x8fa36){if(_0x8fa36[_0x297f('0x1c')]){logger[_0x297f('0xc')](_0x297f('0x1d'));return _['find'](_0x8fa36[_0x297f('0x1e')],{'email':_0x263eb8,'role':_0x297f('0x1f')});}else{logger[_0x297f('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x297f('0xd')](_0x297f('0x20'),_0x6b9017[_0x297f('0xf')])})[_0x297f('0x17')](function(_0x11ec08){logger[_0x297f('0xc')]('Admin\x20account\x20selected.');return _0x11ec08[_0x297f('0x21')];});}});}else{logger['info'](_0x297f('0x22'));return request({'uri':util[_0x297f('0xd')](_0x297f('0x20'),_0x6b9017[_0x297f('0xf')])})[_0x297f('0x17')](function(_0x4a0fbb){logger[_0x297f('0xc')](_0x297f('0x23'));return _0x4a0fbb['user'];});}}function getEndUser(_0x38be1e,_0x523504,_0x5285da){logger[_0x297f('0xc')](_0x297f('0x24'),_0x5285da);return request({'uri':util['format'](_0x297f('0x25'),_0x38be1e[_0x297f('0xf')]),'qs':{'query':util[_0x297f('0xd')]('type:user\x20role:end-user\x20phone:%s',_0x5285da)}})[_0x297f('0x17')](function(_0x1fefda){var _0x34cce6;if(_0x1fefda[_0x297f('0x1e')][_0x297f('0x26')]){_0x1fefda[_0x297f('0x1e')]=_[_0x297f('0x27')](_0x1fefda[_0x297f('0x1e')],{'suspended':![],'role':_0x297f('0x28')});if(_0x1fefda['results']['length']){_0x34cce6=_[_0x297f('0x29')](_0x1fefda[_0x297f('0x1e')]);}}if(_0x34cce6){logger[_0x297f('0xc')](_0x297f('0x2a'));return _0x34cce6;}else{logger['info'](_0x297f('0x2b'));return request({'uri':util[_0x297f('0xd')](_0x297f('0x2c'),_0x38be1e[_0x297f('0xf')]),'method':_0x297f('0x10'),'body':{'user':{'role':'end-user','name':util[_0x297f('0xd')]('Caller\x20-\x20%s',_0x523504||_0x5285da),'phone':_0x5285da}}})[_0x297f('0x17')](function(_0x831903){logger['info']('Enduser\x20created.');return _0x831903[_0x297f('0x21')];});}});}function getAuth(_0x19c3d7){var _0x2a5870;if(_0x19c3d7[_0x297f('0x2d')]===_0x297f('0x2e')){_0x2a5870=util['format'](_0x297f('0x2f'),_0x19c3d7[_0x297f('0x30')],_0x19c3d7[_0x297f('0x2e')]);}else if(_0x19c3d7[_0x297f('0x2d')]==='token'){_0x2a5870=util[_0x297f('0xd')]('%s/token:%s',_0x19c3d7[_0x297f('0x30')],_0x19c3d7[_0x297f('0x31')]);}return util[_0x297f('0xd')](_0x297f('0x32'),new Buffer(_0x2a5870)[_0x297f('0x33')](_0x297f('0x34')));}function request(_0x5ded15){logger[_0x297f('0x35')](_0x297f('0x36'),JSON[_0x297f('0x37')](_0x5ded15));return rp(_[_0x297f('0x8')](_0x5ded15,{'method':_0x297f('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x15cd62,_0x323d64){var _0x112065=[];if(_0x15cd62&&_0x15cd62['length']>0x0){_0x112065=_[_0x297f('0x39')](_0x15cd62,_0x323d64);}return _0x112065;}function getCustomFields(_0x377d2b,_0x35b4a8){var _0x4c2723=[];var _0x39a741={'custom_fields':[]};if(_0x377d2b[_0x297f('0x26')]>0x0){_[_0x297f('0x3a')](_0x377d2b,function(_0x241d2d){if(_[_0x297f('0x3b')]([_0x297f('0x3c'),_0x297f('0x3d')],_0x241d2d[_0x297f('0x3e')])&&_0x241d2d[_0x297f('0x3f')]&&!_0x241d2d[_0x297f('0x40')]){_0x39a741[_0x241d2d[_0x297f('0x3f')][_0x297f('0x41')]()]=_0x241d2d['content']['toString']();}else if(_[_0x297f('0x3b')]([_0x297f('0x3c'),_0x297f('0x3d')],_0x241d2d[_0x297f('0x3e')])&&_0x241d2d[_0x297f('0x42')]&&_0x241d2d[_0x297f('0x40')]){_0x39a741[_0x297f('0x43')][_0x297f('0x44')]({'id':_0x241d2d['idField'],'value':_0x241d2d[_0x297f('0x45')][_0x297f('0x33')]()});}else if(_0x241d2d[_0x297f('0x3e')]===_0x297f('0x46')&&_0x241d2d['variableName']&&_0x241d2d[_0x297f('0x42')]&&_0x241d2d['customField']){_0x35b4a8[_0x241d2d[_0x297f('0x47')]]&&_0x39a741[_0x297f('0x43')]['push']({'id':_0x241d2d[_0x297f('0x42')],'value':_0x35b4a8[_0x241d2d[_0x297f('0x47')]]['toString']()});}else if(_0x241d2d[_0x297f('0x3e')]===_0x297f('0x48')&&_0x241d2d['Variable']&&_0x241d2d['Variable']['name']&&_0x241d2d[_0x297f('0x42')]&&_0x241d2d[_0x297f('0x40')]){_0x35b4a8[_0x241d2d[_0x297f('0x49')][_0x297f('0x13')][_0x297f('0x41')]()]&&_0x39a741[_0x297f('0x43')][_0x297f('0x44')]({'id':_0x241d2d[_0x297f('0x42')],'value':_0x35b4a8[_0x241d2d[_0x297f('0x49')][_0x297f('0x13')][_0x297f('0x41')]()]['toString']()});}});}return _0x39a741;}exports[_0x297f('0x4a')]=function(_0x596946,_0x24ab6b,_0x1b8402,_0x368d65,_0x27edc9,_0x21d4a5){var _0xcda8c0,_0x1631a1;_0x21d4a5[_0x297f('0xf')]=intUtil[_0x297f('0x4b')](_0x21d4a5['remoteUri']);_0x21d4a5[_0x297f('0x4c')]=intUtil[_0x297f('0x4b')](_0x21d4a5[_0x297f('0x4c')]);if(_0x27edc9&&_0x27edc9[_0x297f('0x4d')]){logger[_0x297f('0xc')]('[QUEUE]',_0x297f('0x4e'));_0x24ab6b[_0x297f('0x4f')]=util[_0x297f('0xd')](_0x297f('0x50'),_0x21d4a5[_0x297f('0x4c')],_0x24ab6b[_0x297f('0x51')],md5(_0x24ab6b[_0x297f('0x51')]));}else{_0x24ab6b[_0x297f('0x4f')]='';}headers['Authorization']=getAuth(_0x21d4a5);return getUser(_0x21d4a5,_0x368d65['email'])[_0x297f('0x17')](function(_0x2636ed){_0xcda8c0=_0x2636ed;logger['info'](_0x297f('0x52'),_0xcda8c0['id']);return getEndUser(_0x21d4a5,_0x24ab6b[_0x297f('0x53')],_0x24ab6b[_0x297f('0x54')]);})[_0x297f('0x17')](function(_0x232c21){_0x1631a1=_0x232c21;logger[_0x297f('0xc')](_0x297f('0x55'),_0x1631a1['id']);return getTicket(_0x21d4a5,_0xcda8c0,_0x1631a1,_0x1b8402,_0x24ab6b);})[_0x297f('0x17')](function(_0x26b0a7){if(_0x26b0a7){logger[_0x297f('0xc')]('The\x20Ticket\x20ID\x20is:',_0x26b0a7['id']);switch(_0x21d4a5[_0x297f('0x3e')]){case _0x297f('0x56'):logger[_0x297f('0xc')](_0x297f('0x57'),_0x297f('0x58'));return request({'uri':util[_0x297f('0xd')](_0x297f('0x59'),_0x21d4a5[_0x297f('0xf')],_0xcda8c0['id'],_0x26b0a7['id']),'method':'POST'});case _0x297f('0x5a'):logger[_0x297f('0xc')](_0x297f('0x57'),_0x297f('0x5b'));emit(util['format'](_0x297f('0x5c'),_0x368d65[_0x297f('0x13')]),_0x297f('0x5d'),{'uri':util['format'](_0x297f('0x5e'),_0x21d4a5[_0x297f('0xf')][_0x297f('0x5f')](_0x297f('0x60'),''),_0x26b0a7['id'])});break;default:logger[_0x297f('0x61')]('[QUEUE]',_0x297f('0x62'));}}})[_0x297f('0x63')](function(_0x165922){logger[_0x297f('0x61')](_0x297f('0x64'),util[_0x297f('0x65')](_0x165922,{'showHidden':!![],'depth':null}));});};exports[_0x297f('0x66')]=function(_0x2e3e73,_0xb54e63,_0x1862fe,_0x3eb06a,_0x150186,_0x1dfe50,_0x7d3c6b){var _0x2c450c,_0x178f0e;_0x1dfe50['remoteUri']=intUtil['stripTrailingSlash'](_0x1dfe50[_0x297f('0xf')]);_0x1dfe50[_0x297f('0x4c')]=intUtil[_0x297f('0x4b')](_0x1dfe50[_0x297f('0x4c')]);if(_0x7d3c6b&&_0x7d3c6b[_0x297f('0x67')]&&_0x7d3c6b[_0x297f('0x67')]!==_0x297f('0x68')){logger['info'](_0x297f('0x69'),_0x297f('0x4e'));_0xb54e63[_0x297f('0x4f')]=util[_0x297f('0xd')](_0x297f('0x50'),_0x1dfe50[_0x297f('0x4c')],_0xb54e63[_0x297f('0x51')],md5(_0xb54e63[_0x297f('0x51')]));}headers[_0x297f('0x6a')]=getAuth(_0x1dfe50);return getUser(_0x1dfe50,_0x3eb06a['email'])['then'](function(_0x2cbae8){_0x2c450c=_0x2cbae8;logger['info'](_0x297f('0x52'),_0x2c450c['id']);return getEndUser(_0x1dfe50,_0xb54e63[_0x297f('0x6b')],_0xb54e63['destcalleridnum']);})['then'](function(_0x39f961){_0x178f0e=_0x39f961;logger[_0x297f('0xc')]('The\x20Enduser\x20ID\x20is:',_0x178f0e['id']);return getTicket(_0x1dfe50,_0x2c450c,_0x178f0e,_0x1862fe,_0xb54e63);})[_0x297f('0x17')](function(_0x262f2a){if(_0x262f2a){logger[_0x297f('0xc')](_0x297f('0x6c'),_0x262f2a['id']);switch(_0x1dfe50[_0x297f('0x3e')]){case _0x297f('0x56'):logger['info'](_0x297f('0x69'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x297f('0x59'),_0x1dfe50['remoteUri'],_0x2c450c['id'],_0x262f2a['id']),'method':_0x297f('0x10')});case _0x297f('0x5a'):logger[_0x297f('0xc')](_0x297f('0x69'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x297f('0xd')](_0x297f('0x5c'),_0x3eb06a[_0x297f('0x13')]),_0x297f('0x5d'),{'uri':util[_0x297f('0xd')](_0x297f('0x5e'),_0x1dfe50[_0x297f('0xf')][_0x297f('0x5f')]('/api/v2',''),_0x262f2a['id'])});break;default:logger['error'](_0x297f('0x69'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x297f('0x63')](function(_0x3283be){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x3283be,{'showHidden':!![],'depth':null}));});};exports[_0x297f('0x6d')]=function(_0x392a49,_0x480a49,_0x4412a1,_0x535378,_0x2e0601,_0x546bc7){var _0x41a974,_0x4701cb;_0x546bc7['remoteUri']=intUtil[_0x297f('0x4b')](_0x546bc7[_0x297f('0xf')]);_0x546bc7[_0x297f('0x4c')]=intUtil[_0x297f('0x4b')](_0x546bc7[_0x297f('0x4c')]);if(_0x2e0601&&_0x2e0601['monitor_format']){logger['info']('['+_0x480a49[_0x297f('0x6e')]['toUpperCase']()+']',_0x297f('0x4e'));_0x480a49[_0x297f('0x4f')]=util[_0x297f('0xd')](_0x297f('0x50'),_0x546bc7[_0x297f('0x4c')],_0x480a49[_0x297f('0x51')],md5(_0x480a49[_0x297f('0x51')]));}else{_0x480a49[_0x297f('0x4f')]='';}headers['Authorization']=getAuth(_0x546bc7);return getUser(_0x546bc7)[_0x297f('0x17')](function(_0x6c4b3c){_0x41a974=_0x6c4b3c;logger['info']('The\x20User\x20ID\x20is:',_0x41a974['id']);return getEndUser(_0x546bc7,_0x480a49[_0x297f('0x53')],_0x480a49['calleridnum']);})[_0x297f('0x17')](function(_0x5a6bbc){_0x4701cb=_0x5a6bbc;logger[_0x297f('0xc')](_0x297f('0x55'),_0x4701cb['id']);return getTicket(_0x546bc7,_0x41a974,_0x4701cb,_0x4412a1,_0x480a49);})['then'](function(_0x3cacec){if(_0x3cacec){logger[_0x297f('0xc')](_0x297f('0x6c'),_0x3cacec['id']);}})['catch'](function(_0x2d9ff6){logger['error']('['+_0x480a49[_0x297f('0x6e')]['toUpperCase']()+']'+_0x297f('0x6f'),util[_0x297f('0x65')](_0x2d9ff6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5e75=['push','idField','variable','variableName','customVariable','Variable','custom_fields','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','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','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','user:%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','results','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','authType','password','%s:%s','token','%s/token:%s','username','Basic\x20%s','base64','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','customField','nameField','toLowerCase','content','toString'];(function(_0x3450cb,_0x52da1c){var _0x57e434=function(_0x23c185){while(--_0x23c185){_0x3450cb['push'](_0x3450cb['shift']());}};_0x57e434(++_0x52da1c);}(_0x5e75,0x18d));var _0x55e7=function(_0x51008b,_0x22823c){_0x51008b=_0x51008b-0x0;var _0xd25e5b=_0x5e75[_0x51008b];return _0xd25e5b;};'use strict';var _=require(_0x55e7('0x0'));var rp=require(_0x55e7('0x1'));var md5=require(_0x55e7('0x2'));var util=require(_0x55e7('0x3'));var Redis=require(_0x55e7('0x4'));var intUtil=require(_0x55e7('0x5'));var config=require(_0x55e7('0x6'));var logger=require('../../../../config/logger')(_0x55e7('0x7'));config[_0x55e7('0x8')]=_[_0x55e7('0x9')](config[_0x55e7('0x8')],{'host':_0x55e7('0xa'),'port':0x18eb});var io=require(_0x55e7('0xb'))(new Redis(config[_0x55e7('0x8')]));function emit(_0x538396,_0x2f6ae2,_0x524711){io['to'](_0x538396)[_0x55e7('0xc')](_0x2f6ae2,_0x524711);}var headers={'Content-Type':'application/json','Accept':_0x55e7('0xd')};function getTicket(_0x3174e2,_0x3e62a0,_0x2cf626,_0x340f8b,_0x2b0679){logger[_0x55e7('0xe')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x55e7('0xf')](_0x55e7('0x10'),_0x3174e2[_0x55e7('0x11')]),'method':'POST','body':{'ticket':_[_0x55e7('0x12')]({'requester_id':_0x2cf626['id'],'submitter_id':_0x3e62a0?_0x3e62a0['id']:undefined,'assignee_id':_0x3e62a0?_0x3e62a0['id']:undefined,'tags':getTags(_0x340f8b[_0x55e7('0x13')],_0x55e7('0x14')),'subject':intUtil[_0x55e7('0x15')](_0x340f8b[_0x55e7('0x16')],_0x2b0679,'\x20'),'description':intUtil[_0x55e7('0x15')](_0x340f8b[_0x55e7('0x17')],_0x2b0679,'\x0a'),'comment':{'public':![],'body':intUtil[_0x55e7('0x15')](_0x340f8b[_0x55e7('0x17')],_0x2b0679,'\x0a')}},getCustomFields(_0x340f8b[_0x55e7('0x18')],_0x2b0679))}})[_0x55e7('0x19')](function(_0x109927){logger[_0x55e7('0xe')](_0x55e7('0x1a'));return _0x109927[_0x55e7('0x1b')];});}function getUser(_0x12ae9d,_0x1a8619){if(intUtil[_0x55e7('0x1c')](_0x1a8619)){logger['info'](_0x55e7('0x1d'),_0x1a8619);return request({'uri':util[_0x55e7('0xf')](_0x55e7('0x1e'),_0x12ae9d[_0x55e7('0x11')]),'qs':{'query':util[_0x55e7('0xf')](_0x55e7('0x1f'),_0x1a8619)}})[_0x55e7('0x19')](function(_0x1f6b5b){if(_0x1f6b5b[_0x55e7('0x20')]){logger[_0x55e7('0xe')]('Agent\x20found!');return _['find'](_0x1f6b5b['results'],{'email':_0x1a8619,'role':_0x55e7('0x21')});}else{logger[_0x55e7('0xe')](_0x55e7('0x22'));return request({'uri':util[_0x55e7('0xf')](_0x55e7('0x23'),_0x12ae9d[_0x55e7('0x11')])})[_0x55e7('0x19')](function(_0x442b6f){logger[_0x55e7('0xe')](_0x55e7('0x24'));return _0x442b6f[_0x55e7('0x25')];});}});}else{logger[_0x55e7('0xe')](_0x55e7('0x22'));return request({'uri':util[_0x55e7('0xf')]('%s/users/me.json',_0x12ae9d[_0x55e7('0x11')])})['then'](function(_0x330222){logger[_0x55e7('0xe')](_0x55e7('0x24'));return _0x330222[_0x55e7('0x25')];});}}function getEndUser(_0x11f616,_0x68130c,_0x19ea85){logger[_0x55e7('0xe')](_0x55e7('0x26'),_0x19ea85);return request({'uri':util[_0x55e7('0xf')](_0x55e7('0x1e'),_0x11f616[_0x55e7('0x11')]),'qs':{'query':util['format'](_0x55e7('0x27'),_0x19ea85)}})[_0x55e7('0x19')](function(_0x30c1fe){var _0x437853;if(_0x30c1fe['results'][_0x55e7('0x28')]){_0x30c1fe[_0x55e7('0x29')]=_['filter'](_0x30c1fe[_0x55e7('0x29')],{'suspended':![],'role':_0x55e7('0x2a')});if(_0x30c1fe[_0x55e7('0x29')][_0x55e7('0x28')]){_0x437853=_[_0x55e7('0x2b')](_0x30c1fe['results']);}}if(_0x437853){logger[_0x55e7('0xe')](_0x55e7('0x2c'));return _0x437853;}else{logger[_0x55e7('0xe')](_0x55e7('0x2d'));return request({'uri':util[_0x55e7('0xf')](_0x55e7('0x2e'),_0x11f616[_0x55e7('0x11')]),'method':_0x55e7('0x2f'),'body':{'user':{'role':'end-user','name':util[_0x55e7('0xf')](_0x55e7('0x30'),_0x68130c||_0x19ea85),'phone':_0x19ea85}}})[_0x55e7('0x19')](function(_0x5b7e77){logger['info']('Enduser\x20created.');return _0x5b7e77['user'];});}});}function getAuth(_0xea307b){var _0x773b45;if(_0xea307b[_0x55e7('0x31')]===_0x55e7('0x32')){_0x773b45=util[_0x55e7('0xf')](_0x55e7('0x33'),_0xea307b['username'],_0xea307b[_0x55e7('0x32')]);}else if(_0xea307b[_0x55e7('0x31')]===_0x55e7('0x34')){_0x773b45=util[_0x55e7('0xf')](_0x55e7('0x35'),_0xea307b[_0x55e7('0x36')],_0xea307b[_0x55e7('0x34')]);}return util['format'](_0x55e7('0x37'),new Buffer(_0x773b45)['toString'](_0x55e7('0x38')));}function request(_0xab31a0){logger['debug'](_0x55e7('0x39'),JSON[_0x55e7('0x3a')](_0xab31a0));return rp(_['defaults'](_0xab31a0,{'method':_0x55e7('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x377ffb,_0x4b1204){var _0x360834=[];if(_0x377ffb&&_0x377ffb[_0x55e7('0x28')]>0x0){_0x360834=_[_0x55e7('0x3c')](_0x377ffb,_0x4b1204);}return _0x360834;}function getCustomFields(_0x260767,_0x2ac14d){var _0x9e0291=[];var _0x4ba6a3={'custom_fields':[]};if(_0x260767['length']>0x0){_[_0x55e7('0x3d')](_0x260767,function(_0x44c097){if(_[_0x55e7('0x3e')]([_0x55e7('0x3f'),_0x55e7('0x40')],_0x44c097[_0x55e7('0x41')])&&_0x44c097['nameField']&&!_0x44c097[_0x55e7('0x42')]){_0x4ba6a3[_0x44c097[_0x55e7('0x43')][_0x55e7('0x44')]()]=_0x44c097[_0x55e7('0x45')][_0x55e7('0x46')]();}else if(_['includes']([_0x55e7('0x3f'),'picklist'],_0x44c097[_0x55e7('0x41')])&&_0x44c097['idField']&&_0x44c097['customField']){_0x4ba6a3['custom_fields'][_0x55e7('0x47')]({'id':_0x44c097[_0x55e7('0x48')],'value':_0x44c097[_0x55e7('0x45')][_0x55e7('0x46')]()});}else if(_0x44c097['type']===_0x55e7('0x49')&&_0x44c097['variableName']&&_0x44c097[_0x55e7('0x48')]&&_0x44c097[_0x55e7('0x42')]){_0x2ac14d[_0x44c097['variableName']]&&_0x4ba6a3['custom_fields']['push']({'id':_0x44c097[_0x55e7('0x48')],'value':_0x2ac14d[_0x44c097[_0x55e7('0x4a')]][_0x55e7('0x46')]()});}else if(_0x44c097[_0x55e7('0x41')]===_0x55e7('0x4b')&&_0x44c097[_0x55e7('0x4c')]&&_0x44c097[_0x55e7('0x4c')]['name']&&_0x44c097[_0x55e7('0x48')]&&_0x44c097[_0x55e7('0x42')]){_0x2ac14d[_0x44c097[_0x55e7('0x4c')][_0x55e7('0x14')]['toLowerCase']()]&&_0x4ba6a3[_0x55e7('0x4d')][_0x55e7('0x47')]({'id':_0x44c097[_0x55e7('0x48')],'value':_0x2ac14d[_0x44c097[_0x55e7('0x4c')][_0x55e7('0x14')][_0x55e7('0x44')]()][_0x55e7('0x46')]()});}});}return _0x4ba6a3;}exports[_0x55e7('0x4e')]=function(_0x10624f,_0x4473a3,_0x1cd527,_0x41f46b,_0x141981,_0x2aad4){var _0x43d0f5,_0x2c5687;_0x2aad4['remoteUri']=intUtil[_0x55e7('0x4f')](_0x2aad4[_0x55e7('0x11')]);_0x2aad4['serverUrl']=intUtil['stripTrailingSlash'](_0x2aad4[_0x55e7('0x50')]);if(_0x141981&&_0x141981[_0x55e7('0x51')]){logger[_0x55e7('0xe')](_0x55e7('0x52'),'Recording\x20is\x20enabled!');_0x4473a3[_0x55e7('0x53')]=util[_0x55e7('0xf')](_0x55e7('0x54'),_0x2aad4['serverUrl'],_0x4473a3[_0x55e7('0x55')],md5(_0x4473a3[_0x55e7('0x55')]));}else{_0x4473a3[_0x55e7('0x53')]='';}headers[_0x55e7('0x56')]=getAuth(_0x2aad4);return getUser(_0x2aad4,_0x41f46b['email'])['then'](function(_0x24bc67){_0x43d0f5=_0x24bc67;logger[_0x55e7('0xe')](_0x55e7('0x57'),_0x43d0f5['id']);return getEndUser(_0x2aad4,_0x4473a3[_0x55e7('0x58')],_0x4473a3[_0x55e7('0x59')]);})[_0x55e7('0x19')](function(_0x25a7ae){_0x2c5687=_0x25a7ae;logger[_0x55e7('0xe')](_0x55e7('0x5a'),_0x2c5687['id']);return getTicket(_0x2aad4,_0x43d0f5,_0x2c5687,_0x1cd527,_0x4473a3);})[_0x55e7('0x19')](function(_0x589eaa){if(_0x589eaa){logger[_0x55e7('0xe')](_0x55e7('0x5b'),_0x589eaa['id']);switch(_0x2aad4[_0x55e7('0x41')]){case _0x55e7('0x5c'):logger[_0x55e7('0xe')](_0x55e7('0x52'),_0x55e7('0x5d'));return request({'uri':util[_0x55e7('0xf')](_0x55e7('0x5e'),_0x2aad4['remoteUri'],_0x43d0f5['id'],_0x589eaa['id']),'method':_0x55e7('0x2f')});case _0x55e7('0x5f'):logger[_0x55e7('0xe')](_0x55e7('0x52'),_0x55e7('0x60'));emit(util[_0x55e7('0xf')]('user:%s',_0x41f46b['name']),_0x55e7('0x61'),{'uri':util[_0x55e7('0xf')](_0x55e7('0x62'),_0x2aad4[_0x55e7('0x11')][_0x55e7('0x63')](_0x55e7('0x64'),''),_0x589eaa['id'])});break;default:logger[_0x55e7('0x65')](_0x55e7('0x52'),_0x55e7('0x66'));}}})[_0x55e7('0x67')](function(_0x3436c4){logger[_0x55e7('0x65')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x55e7('0x68')](_0x3436c4,{'showHidden':!![],'depth':null}));});};exports[_0x55e7('0x69')]=function(_0x4ddf13,_0x4f1e1f,_0xca26bc,_0x3cb83e,_0x6aa579,_0x1ae889,_0x8c5c7){var _0x5392f4,_0x1602f6;_0x1ae889['remoteUri']=intUtil[_0x55e7('0x4f')](_0x1ae889['remoteUri']);_0x1ae889[_0x55e7('0x50')]=intUtil[_0x55e7('0x4f')](_0x1ae889['serverUrl']);if(_0x8c5c7&&_0x8c5c7[_0x55e7('0x6a')]&&_0x8c5c7['recordingFormat']!==_0x55e7('0x6b')){logger[_0x55e7('0xe')](_0x55e7('0x6c'),_0x55e7('0x6d'));_0x4f1e1f['recordingURL']=util[_0x55e7('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1ae889['serverUrl'],_0x4f1e1f['uniqueid'],md5(_0x4f1e1f['uniqueid']));}headers[_0x55e7('0x56')]=getAuth(_0x1ae889);return getUser(_0x1ae889,_0x3cb83e['email'])[_0x55e7('0x19')](function(_0x49b7d8){_0x5392f4=_0x49b7d8;logger[_0x55e7('0xe')](_0x55e7('0x57'),_0x5392f4['id']);return getEndUser(_0x1ae889,_0x4f1e1f['destcalleridname'],_0x4f1e1f[_0x55e7('0x6e')]);})[_0x55e7('0x19')](function(_0x1cdd79){_0x1602f6=_0x1cdd79;logger[_0x55e7('0xe')](_0x55e7('0x5a'),_0x1602f6['id']);return getTicket(_0x1ae889,_0x5392f4,_0x1602f6,_0xca26bc,_0x4f1e1f);})['then'](function(_0x4925b8){if(_0x4925b8){logger[_0x55e7('0xe')](_0x55e7('0x5b'),_0x4925b8['id']);switch(_0x1ae889[_0x55e7('0x41')]){case _0x55e7('0x5c'):logger['info'](_0x55e7('0x6c'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x55e7('0x5e'),_0x1ae889[_0x55e7('0x11')],_0x5392f4['id'],_0x4925b8['id']),'method':'POST'});case _0x55e7('0x5f'):logger['info'](_0x55e7('0x6c'),_0x55e7('0x60'));emit(util[_0x55e7('0xf')](_0x55e7('0x6f'),_0x3cb83e[_0x55e7('0x14')]),'trigger:browser:url',{'uri':util['format'](_0x55e7('0x62'),_0x1ae889[_0x55e7('0x11')]['replace'](_0x55e7('0x64'),''),_0x4925b8['id'])});break;default:logger['error'](_0x55e7('0x6c'),_0x55e7('0x66'));}}})[_0x55e7('0x67')](function(_0x2941ca){logger[_0x55e7('0x65')](_0x55e7('0x70'),util['inspect'](_0x2941ca,{'showHidden':!![],'depth':null}));});};exports[_0x55e7('0x71')]=function(_0x2c48ad,_0x15e715,_0x39813e,_0x2ce1dd,_0x4a89c9,_0x304fc3){var _0x54b140,_0x513145;_0x304fc3[_0x55e7('0x11')]=intUtil[_0x55e7('0x4f')](_0x304fc3[_0x55e7('0x11')]);_0x304fc3[_0x55e7('0x50')]=intUtil[_0x55e7('0x4f')](_0x304fc3['serverUrl']);if(_0x4a89c9&&_0x4a89c9['monitor_format']){logger[_0x55e7('0xe')]('['+_0x15e715[_0x55e7('0x72')]['toUpperCase']()+']',_0x55e7('0x6d'));_0x15e715[_0x55e7('0x53')]=util[_0x55e7('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x304fc3[_0x55e7('0x50')],_0x15e715[_0x55e7('0x55')],md5(_0x15e715[_0x55e7('0x55')]));}else{_0x15e715[_0x55e7('0x53')]='';}headers[_0x55e7('0x56')]=getAuth(_0x304fc3);return getUser(_0x304fc3)[_0x55e7('0x19')](function(_0x202584){_0x54b140=_0x202584;logger[_0x55e7('0xe')](_0x55e7('0x57'),_0x54b140['id']);return getEndUser(_0x304fc3,_0x15e715[_0x55e7('0x58')],_0x15e715[_0x55e7('0x59')]);})['then'](function(_0x4cfa0a){_0x513145=_0x4cfa0a;logger[_0x55e7('0xe')](_0x55e7('0x5a'),_0x513145['id']);return getTicket(_0x304fc3,_0x54b140,_0x513145,_0x39813e,_0x15e715);})[_0x55e7('0x19')](function(_0x3d0ddb){if(_0x3d0ddb){logger[_0x55e7('0xe')](_0x55e7('0x5b'),_0x3d0ddb['id']);}})[_0x55e7('0x67')](function(_0x5ccbf7){logger[_0x55e7('0x65')]('['+_0x15e715[_0x55e7('0x72')][_0x55e7('0x73')]()+']'+_0x55e7('0x74'),util[_0x55e7('0x68')](_0x5ccbf7,{'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 1c1b587..20b0bac 100644 --- a/server/services/ami/trigger/integration/zoho.js +++ b/server/services/ami/trigger/integration/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f7a=['type','variableName','Variable','name','toLowerCase','indexOf','split','isNil','expires_in','access_token','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','refreshToken','clientSecret','refresh_token','then','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','Administrator','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','catch','data','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','enduserType','log','CREATE\x20ERROR','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','lead','Leads','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Description','getString','Who_Id','First_Name','Last_Name','Full_Name','$se_module','Call_Duration','talktime','mm:ss','answertime','utc','endtime','diff','YYYY-MM-DDTHH:mm:ss','lastevent','Call_Result','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','Call\x20created!','details','err','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridname','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','zoho.eu','destcalleridname','destcalleridnum','[OUTBOUND]','unmanaged','monitor_format','toUpperCase','calleridnum','lodash','request-promise','md5','util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','length','includes','string','picklist','idField','content','toString'];(function(_0x19e972,_0x36eba5){var _0x522fd9=function(_0x432a2d){while(--_0x432a2d){_0x19e972['push'](_0x19e972['shift']());}};_0x522fd9(++_0x36eba5);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x56eeaa,_0xfe7950){_0x56eeaa=_0x56eeaa-0x0;var _0x2c908e=_0x6f7a[_0x56eeaa];return _0x2c908e;};'use strict';var _=require(_0xa6f7('0x0'));var rp=require(_0xa6f7('0x1'));var md5=require(_0xa6f7('0x2'));var util=require(_0xa6f7('0x3'));var intUtil=require('./util');var moment=require(_0xa6f7('0x4'));var Redis=require(_0xa6f7('0x5'));var BPromise=require(_0xa6f7('0x6'));var config=require(_0xa6f7('0x7'));var logger=require(_0xa6f7('0x8'))(_0xa6f7('0x9'));config[_0xa6f7('0xa')]=_[_0xa6f7('0xb')](config[_0xa6f7('0xa')],{'host':_0xa6f7('0xc'),'port':0x18eb});var io=require(_0xa6f7('0xd'))(new Redis(config['redis']));function emit(_0x4b4f9e,_0x30f2a7,_0x2674c9){io['to'](_0x4b4f9e)[_0xa6f7('0xe')](_0x30f2a7,_0x2674c9);}function request(_0x362404){logger[_0xa6f7('0xf')]('[HTTP]',JSON['stringify'](_0x362404));return rp(_0x362404);}function getCustomFields(_0x2fd1d0,_0x225da4){var _0x4e30bc={};if(_0x2fd1d0[_0xa6f7('0x10')]>0x0){_['forEach'](_0x2fd1d0,function(_0x315096){if(_[_0xa6f7('0x11')]([_0xa6f7('0x12'),_0xa6f7('0x13')],_0x315096['type'])&&_0x315096[_0xa6f7('0x14')]){_0x4e30bc[_0x315096['idField']]=_0x315096[_0xa6f7('0x15')][_0xa6f7('0x16')]();}else if(_0x315096[_0xa6f7('0x17')]==='variable'&&_0x315096[_0xa6f7('0x18')]&&_0x315096['idField']&&_0x225da4[_0x315096[_0xa6f7('0x18')]]){_0x4e30bc[_0x315096['idField']]=_0x225da4[_0x315096[_0xa6f7('0x18')]][_0xa6f7('0x16')]();}else if(_0x315096[_0xa6f7('0x17')]==='customVariable'&&_0x315096[_0xa6f7('0x19')]&&_0x315096[_0xa6f7('0x19')][_0xa6f7('0x1a')]&&_0x315096[_0xa6f7('0x14')]&&_0x225da4[_0x315096['Variable']['name'][_0xa6f7('0x1b')]()]){_0x4e30bc[_0x315096['idField']]=_0x225da4[_0x315096[_0xa6f7('0x19')][_0xa6f7('0x1a')]['toLowerCase']()][_0xa6f7('0x16')]();}});}return _0x4e30bc;}function getName(_0xb2cfaa){if(_0xb2cfaa[_0xa6f7('0x1c')]('\x20')>0x0){var _0x35891a=_0xb2cfaa[_0xa6f7('0x1d')](/ (.+)/);if(_0x35891a[0x1]){return _0x35891a;}}return[_0xb2cfaa,_0xb2cfaa];}var accountsTokens={};function getAccessToken(_0x1aa8dc){return new Promise(function(_0x4887ad,_0x3c0c55){if(!_[_0xa6f7('0x1e')](accountsTokens[_0x1aa8dc['id']])&&!_['isNil'](accountsTokens[_0x1aa8dc['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x1aa8dc['id']][_0xa6f7('0x1f')])){_0x4887ad(accountsTokens[_0x1aa8dc['id']][_0xa6f7('0x20')]);}}var _0x566b63;switch(_0x1aa8dc['zone']){case'US':_0x566b63='https://accounts.zoho.com';break;case'AU':_0x566b63=_0xa6f7('0x21');break;case'EU':_0x566b63=_0xa6f7('0x22');break;case'IN':_0x566b63=_0xa6f7('0x23');break;case'CN':_0x566b63='https://accounts.zoho.com.cn';break;default:_0x566b63='https://accounts.zoho.eu';break;}var _0x2f4907={'method':'POST','uri':_0x566b63+'/oauth/v2/token','qs':{'refresh_token':_0x1aa8dc[_0xa6f7('0x24')],'client_id':_0x1aa8dc['clientId'],'client_secret':_0x1aa8dc[_0xa6f7('0x25')],'grant_type':_0xa6f7('0x26')},'json':!![]};return rp(_0x2f4907)[_0xa6f7('0x27')](function(_0x2b4c6c){accountsTokens[_0x1aa8dc['id']]={'access_token':_0x2b4c6c[_0xa6f7('0x20')],'expires_in':moment()['add'](_0x2b4c6c['expires_in'],_0xa6f7('0x28'))};_0x4887ad(_0x2b4c6c[_0xa6f7('0x20')]);})['catch'](function(_0x267917){logger[_0xa6f7('0x29')](_0xa6f7('0x2a'),_0x267917[_0xa6f7('0x2b')]);_0x3c0c55(_0x267917);});});}function getUser(_0x224f5a,_0x10bf77,_0x353de8,_0x54f72c){logger[_0xa6f7('0x2c')](_0xa6f7('0x2d'));return request({'method':_0xa6f7('0x2e'),'uri':util[_0xa6f7('0x2f')]('https://www.zohoapis.%s/crm/v2/users',_0x10bf77),'qs':{'type':_0xa6f7('0x30')},'headers':{'Authorization':_0xa6f7('0x31')+_0x224f5a},'json':!![]})['then'](function(_0xd6304f){if(_0xd6304f[_0xa6f7('0x32')]){var _0x4d79d8=-0x1;if(_['isArrayLikeObject'](_0xd6304f[_0xa6f7('0x32')])){if(!_[_0xa6f7('0x1e')](_0x54f72c)){_0x4d79d8=_[_0xa6f7('0x33')](_0xd6304f[_0xa6f7('0x32')],function(_0x1e25e0){return _0x1e25e0['email']===_0x54f72c;});}if(_0x4d79d8>=0x0){logger['info'](_0xa6f7('0x34'));}else{logger['info'](_0xa6f7('0x35'));_0x4d79d8=_[_0xa6f7('0x33')](_0xd6304f[_0xa6f7('0x32')],function(_0x237e5d){return _0x237e5d[_0xa6f7('0x36')][_0xa6f7('0x1a')]==='Administrator';});}return _0xd6304f[_0xa6f7('0x32')][_0x4d79d8];}else{if(_0xd6304f[_0xa6f7('0x37')][_0xa6f7('0x36')]['name']===_0xa6f7('0x38')){logger['info'](_0xa6f7('0x35'));user=_0xd6304f[_0xa6f7('0x37')];return user;}else{logger[_0xa6f7('0x29')]('The\x20failing\x20result\x20is',JSON[_0xa6f7('0x39')](_0xd6304f));throw new Error(_0xa6f7('0x3a')+JSON[_0xa6f7('0x39')](_0xd6304f));}}}else{logger[_0xa6f7('0x29')](_0xa6f7('0x3b'),JSON[_0xa6f7('0x39')](_0xd6304f));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xa6f7('0x39')](_0xd6304f));}})[_0xa6f7('0x3c')](function(_0xc25a1b){console[_0xa6f7('0x29')](_0xc25a1b);});}function getZohoUser(_0x18d18c,_0x56a773){return new BPromise(function(_0x45acdd,_0x12d966){request(_0x18d18c)['then'](function(_0x1b5213){var _0x33bbd9=null;if(_0x1b5213){_0x33bbd9=_0x1b5213[_0xa6f7('0x3d')][0x0];_0x33bbd9['enduserType']=_0x56a773;}_0x45acdd(_0x33bbd9);})[_0xa6f7('0x3c')](function(_0x36330b){_0x12d966(_0x36330b);});});}function createEndUser(_0x589d94,_0x39349a,_0x13c7c4,_0x3ecb88,_0x14d532,_0x40aaf5){var _0x13c7c4=getName(_0x13c7c4);return request({'method':_0xa6f7('0x3e'),'uri':_0xa6f7('0x3f')+_0x39349a+_0xa6f7('0x40')+_[_0xa6f7('0x41')](_0x40aaf5[_0xa6f7('0x42')])+'s','body':{'data':[{'Last_Name':_0x13c7c4[0x1],'First_Name':_0x13c7c4[0x0],'Phone':_0x3ecb88,'Owner':{'name':!_[_0xa6f7('0x1e')](_0x14d532[_0xa6f7('0x43')][_0xa6f7('0x1a')])?_0x14d532['role']['name']:!_[_0xa6f7('0x1e')](_0x14d532[_0xa6f7('0x44')])?_0x14d532[_0xa6f7('0x44')]+'\x20'+_0x14d532[_0xa6f7('0x45')]:_0x14d532[_0xa6f7('0x45')],'id':_0x14d532['id']}}]},'headers':{'Authorization':_0xa6f7('0x31')+_0x589d94},'json':!![]})[_0xa6f7('0x27')](function(_0x404552){if(_0x404552&&_0x404552[_0xa6f7('0x3d')][0x0][_0xa6f7('0x46')]==='SUCCESS'){var _0x41917c=_0x404552[_0xa6f7('0x3d')][0x0]['details'];_0x41917c[_0xa6f7('0x47')]=_[_0xa6f7('0x41')](_0x40aaf5[_0xa6f7('0x42')])+'s';return _0x41917c;}logger[_0xa6f7('0x29')]('The\x20failing\x20result\x20is',JSON[_0xa6f7('0x39')](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0xa6f7('0x3c')](function(_0x1ea7e1){console[_0xa6f7('0x48')](_0xa6f7('0x49'),_0x1ea7e1);});}function getEndUser(_0x386200,_0x1313dc,_0x979a33,_0x5a9e9e,_0x17d934,_0x40dbe6,_0x55cb70){var _0x2026a9={'method':_0xa6f7('0x2e'),'uri':'','headers':{'Authorization':_0xa6f7('0x31')+_0x386200},'json':!![]};switch(_0x55cb70['moduleSearch']){case _0xa6f7('0x4a'):_0x2026a9['uri']=_0xa6f7('0x3f')+_0x1313dc+_0xa6f7('0x4b')+_0x17d934+'))';return getZohoUser(_0x2026a9,_0xa6f7('0x4c'))['then'](function(_0x5df564){if(_0x5df564)return _0x5df564;_0x2026a9[_0xa6f7('0x4d')]='https://www.zohoapis.'+_0x1313dc+_0xa6f7('0x4e')+_0x17d934+'))';return getZohoUser(_0x2026a9,'Leads')['then'](function(_0x1e7089){if(_0x1e7089)return _0x1e7089;if(_0x55cb70[_0xa6f7('0x42')]!=_0xa6f7('0x4f')){return createEndUser(_0x386200,_0x1313dc,_0x5a9e9e,_0x17d934,_0x40dbe6,_0x55cb70);}else{return{};}});});break;case _0xa6f7('0x50'):_0x2026a9[_0xa6f7('0x4d')]=_0xa6f7('0x3f')+_0x1313dc+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x17d934+'))';return getZohoUser(_0x2026a9,_0xa6f7('0x4c'))[_0xa6f7('0x27')](function(_0x58080f){if(_0x58080f)return _0x58080f;if(_0x55cb70[_0xa6f7('0x42')]!='nothing'){return createEndUser(_0x386200,_0x1313dc,_0x5a9e9e,_0x17d934,_0x40dbe6,_0x55cb70);}else{return{};}});break;case _0xa6f7('0x51'):_0x2026a9['uri']='https://www.zohoapis.'+_0x1313dc+_0xa6f7('0x4e')+_0x17d934+'))';return getZohoUser(_0x2026a9,_0xa6f7('0x52'))[_0xa6f7('0x27')](function(_0x2b3de2){if(_0x2b3de2)return _0x2b3de2;if(_0x55cb70[_0xa6f7('0x42')]!='nothing'){return createEndUser(_0x386200,_0x1313dc,_0x5a9e9e,_0x17d934,_0x40dbe6,_0x55cb70);}else{return{};}});break;}}function getCall(_0x340d3f,_0x34de29,_0x5cddc9,_0x4b83f6,_0x5991f9,_0x1d7bcd,_0x1c2099,_0x134dd7){logger['info'](_0xa6f7('0x53'));var _0x5dab05={};_0x5dab05[_0xa6f7('0x54')]={'name':!_[_0xa6f7('0x1e')](_0x4b83f6[_0xa6f7('0x43')][_0xa6f7('0x1a')])&&!_[_0xa6f7('0x1e')](_0x4b83f6['profile']['name'])&&_0x4b83f6[_0xa6f7('0x36')][_0xa6f7('0x1a')]===_0xa6f7('0x55')?_0x4b83f6[_0xa6f7('0x43')]['name']:!_[_0xa6f7('0x1e')](_0x4b83f6[_0xa6f7('0x44')])?_0x4b83f6[_0xa6f7('0x44')]+'\x20'+_0x4b83f6[_0xa6f7('0x45')]:_0x4b83f6[_0xa6f7('0x45')],'id':_0x4b83f6['id']};_0x5dab05[_0xa6f7('0x56')]=intUtil['getString'](_0x1d7bcd[_0xa6f7('0x57')],_0x1c2099,'\x20');_0x5dab05[_0xa6f7('0x58')]=intUtil[_0xa6f7('0x59')](_0x1d7bcd['Descriptions'],_0x1c2099,'\x0a');if(_0x5991f9[_0xa6f7('0x47')]===_0xa6f7('0x4c')){_0x5dab05[_0xa6f7('0x5a')]={'name':!_[_0xa6f7('0x1e')](_0x5991f9['Full_Name'])?_0x5991f9['Full_Name']:!_[_0xa6f7('0x1e')](_0x5991f9[_0xa6f7('0x5b')])?_0x5991f9[_0xa6f7('0x5b')]+'\x20'+_0x5991f9[_0xa6f7('0x5c')]:_0x5991f9[_0xa6f7('0x5c')],'id':_0x5991f9['id']};}if(_0x5991f9[_0xa6f7('0x47')]===_0xa6f7('0x52')){_0x5dab05['What_Id']={'name':!_[_0xa6f7('0x1e')](_0x5991f9[_0xa6f7('0x5d')])?_0x5991f9[_0xa6f7('0x5d')]:!_[_0xa6f7('0x1e')](_0x5991f9[_0xa6f7('0x5b')])?_0x5991f9[_0xa6f7('0x5b')]+'\x20'+_0x5991f9[_0xa6f7('0x5c')]:_0x5991f9[_0xa6f7('0x5c')],'id':_0x5991f9['id']};_0x5dab05[_0xa6f7('0x5e')]=_[_0xa6f7('0x41')](_0x5991f9[_0xa6f7('0x47')]);}if(_0x1c2099['talktime']){_0x5dab05[_0xa6f7('0x5f')]=moment['utc'](parseInt(_0x1c2099[_0xa6f7('0x60')])*0x3e8)['format'](_0xa6f7('0x61'));}else if(_0x1c2099[_0xa6f7('0x62')]&&_0x1c2099['endtime']){_0x5dab05[_0xa6f7('0x5f')]=moment[_0xa6f7('0x63')](moment(_0x1c2099[_0xa6f7('0x64')],'YYYY-MM-DDTHH:mm:ss')[_0xa6f7('0x65')](moment(_0x1c2099['starttime'],_0xa6f7('0x66'))))[_0xa6f7('0x2f')]('mm:ss');}switch(_0x1c2099[_0xa6f7('0x67')]){case'called':_0x5dab05[_0xa6f7('0x68')]='Called';break;case _0xa6f7('0x69'):case _0xa6f7('0x6a'):_0x5dab05[_0xa6f7('0x68')]=_0xa6f7('0x6b');break;case _0xa6f7('0x6c'):_0x5dab05[_0xa6f7('0x68')]=_0xa6f7('0x6d');break;case _0xa6f7('0x6e'):_0x5dab05[_0xa6f7('0x68')]=_0xa6f7('0x6f');break;case _0xa6f7('0x70'):_0x5dab05[_0xa6f7('0x68')]='Timeout';default:}_0x5dab05[_0xa6f7('0x71')]=(_0x134dd7===_0xa6f7('0x72')?moment(_0x1c2099[_0xa6f7('0x73')])[_0xa6f7('0x2f')](_0xa6f7('0x66')):moment(_0x1c2099[_0xa6f7('0x74')])[_0xa6f7('0x2f')](_0xa6f7('0x66')))||moment()['format'](_0xa6f7('0x66'));_0x5dab05[_0xa6f7('0x75')]=_0x134dd7||_0xa6f7('0x76');_0x5dab05=_['merge'](_0x5dab05,getCustomFields(_0x1d7bcd[_0xa6f7('0x77')],_0x1c2099));return request({'method':_0xa6f7('0x3e'),'uri':_0xa6f7('0x3f')+_0x34de29+_0xa6f7('0x78'),'headers':{'Authorization':_0xa6f7('0x31')+_0x340d3f},'body':{'data':[_0x5dab05]},'json':!![]})[_0xa6f7('0x27')](function(_0xe97f85){if(_0xe97f85&&_0xe97f85[_0xa6f7('0x3d')][0x0]['code']==='SUCCESS'){logger[_0xa6f7('0x2c')](_0xa6f7('0x79'));return{'id':_0xe97f85['data'][0x0][_0xa6f7('0x7a')]['id']};}})[_0xa6f7('0x3c')](function(_0x1bec76){logger['info'](_0xa6f7('0x7b'),_0x1bec76['stack']);console['log']('err',_0x1bec76);});}exports['queue']=function(_0x522e5d,_0x39ba3d,_0x3502b3,_0x41dc51,_0x5f00a7,_0x849412){var _0x1d3241,_0x40a70c,_0x69c173;_0x849412[_0xa6f7('0x7c')]=intUtil[_0xa6f7('0x7d')](_0x849412[_0xa6f7('0x7c')]);_0x849412[_0xa6f7('0x7e')]=intUtil[_0xa6f7('0x7d')](_0x849412[_0xa6f7('0x7e')]);if(_0x5f00a7&&_0x5f00a7['monitor_format']){logger[_0xa6f7('0x2c')](_0xa6f7('0x7f'),_0xa6f7('0x80'));_0x39ba3d[_0xa6f7('0x81')]=_0x849412[_0xa6f7('0x7e')]+_0xa6f7('0x82')+_0x39ba3d[_0xa6f7('0x83')]+_0xa6f7('0x84')+md5(_0x39ba3d[_0xa6f7('0x83')]);}else{_0x39ba3d[_0xa6f7('0x81')]='';}var _0x5bd6a9=_0x849412['host']==='zoho.eu'?'eu':_0xa6f7('0x85');return getAccessToken(_0x849412)[_0xa6f7('0x27')](function(_0x3ba166){_0x69c173=_0x3ba166;return getUser(_0x69c173,_0x5bd6a9,_0x849412,_0x41dc51['email']);})[_0xa6f7('0x27')](function(_0x36decb){_0x1d3241=_0x36decb;logger['info'](_0xa6f7('0x86'),_0x1d3241['id']);return getEndUser(_0x69c173,_0x5bd6a9,_0x849412,_0x39ba3d[_0xa6f7('0x87')],_0x39ba3d['calleridnum'],_0x1d3241,_0x3502b3);})['then'](function(_0xadf749){_0x40a70c=_0xadf749;return getCall(_0x69c173,_0x5bd6a9,_0x849412,_0x1d3241,_0x40a70c,_0x3502b3,_0x39ba3d,'Inbound');})[_0xa6f7('0x27')](function(_0x1959cb){if(_0x1959cb){logger['info']('The\x20Call\x20ID\x20is:',_0x1959cb['id']);logger[_0xa6f7('0x2c')](_0xa6f7('0x7f'),_0xa6f7('0x88'));emit(util['format'](_0xa6f7('0x89'),_0x41dc51[_0xa6f7('0x1a')]),_0xa6f7('0x8a'),{'uri':_0xa6f7('0x8b')+_0x849412[_0xa6f7('0x7c')]+_0xa6f7('0x8c')+_0x1959cb['id']});}})[_0xa6f7('0x3c')](function(_0x3b03ab){logger[_0xa6f7('0x29')](_0xa6f7('0x7f'),JSON[_0xa6f7('0x39')](_0x3b03ab));});};exports['outbound']=function(_0x426f6e,_0x24de88,_0x2f6866,_0x1f3f99,_0x46e6c4,_0xdf6850,_0x5f0f84){var _0x446ba4,_0x1f0c90,_0x346c8f;_0xdf6850[_0xa6f7('0x7c')]=intUtil[_0xa6f7('0x7d')](_0xdf6850[_0xa6f7('0x7c')]);_0xdf6850['serverUrl']=intUtil['stripTrailingSlash'](_0xdf6850[_0xa6f7('0x7e')]);if(_0x5f0f84&&_0x5f0f84[_0xa6f7('0x8d')]&&_0x5f0f84[_0xa6f7('0x8d')]!==_0xa6f7('0x8e')){logger[_0xa6f7('0x2c')]('[OUTBOUND]',_0xa6f7('0x80'));_0x24de88['recordingURL']=_0xdf6850[_0xa6f7('0x7e')]+_0xa6f7('0x82')+_0x24de88['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x24de88[_0xa6f7('0x83')]);}var _0x4e97fd=_0xdf6850['host']===_0xa6f7('0x8f')?'eu':_0xa6f7('0x85');return getAccessToken(_0xdf6850)[_0xa6f7('0x27')](function(_0x1d43eb){_0x346c8f=_0x1d43eb;return getUser(_0x346c8f,_0x4e97fd,_0xdf6850,_0x1f3f99['email']);})[_0xa6f7('0x27')](function(_0xd2a739){_0x446ba4=_0xd2a739;logger[_0xa6f7('0x2c')](_0xa6f7('0x86'),_0x446ba4['id']);return getEndUser(_0x346c8f,_0x4e97fd,_0xdf6850,_0x24de88[_0xa6f7('0x90')],_0x24de88[_0xa6f7('0x91')],_0x446ba4,_0x2f6866);})['then'](function(_0x3e1f98){_0x1f0c90=_0x3e1f98;return getCall(_0x346c8f,_0x4e97fd,_0xdf6850,_0x446ba4,_0x1f0c90,_0x2f6866,_0x24de88,'Outbound');})['then'](function(_0x1d5e15){if(_0x1d5e15){logger[_0xa6f7('0x2c')]('The\x20Call\x20ID\x20is:',_0x1d5e15['id']);logger[_0xa6f7('0x2c')](_0xa6f7('0x92'),_0xa6f7('0x88'));emit(util['format'](_0xa6f7('0x89'),_0x1f3f99['name']),_0xa6f7('0x8a'),{'uri':_0xa6f7('0x8b')+_0xdf6850['host']+_0xa6f7('0x8c')+_0x1d5e15['id']});}})['catch'](function(_0x1dcf76){logger[_0xa6f7('0x29')]('[OUTBOUND]',JSON[_0xa6f7('0x39')](_0x1dcf76));});};exports[_0xa6f7('0x93')]=function(_0x1afd68,_0x3aa798,_0xb23da6,_0x486eee,_0x6590a0,_0x37b898){var _0x1ecef6,_0x13219e,_0x5c66e6;_0x37b898[_0xa6f7('0x7c')]=intUtil[_0xa6f7('0x7d')](_0x37b898[_0xa6f7('0x7c')]);_0x37b898[_0xa6f7('0x7e')]=intUtil[_0xa6f7('0x7d')](_0x37b898[_0xa6f7('0x7e')]);if(_0x6590a0&&_0x6590a0[_0xa6f7('0x94')]){logger[_0xa6f7('0x2c')]('['+_0x3aa798['lastevent'][_0xa6f7('0x95')]()+']',_0xa6f7('0x80'));_0x3aa798['recordingURL']=_0x37b898[_0xa6f7('0x7e')]+'/api/voice/recordings/'+_0x3aa798[_0xa6f7('0x83')]+_0xa6f7('0x84')+md5(_0x3aa798[_0xa6f7('0x83')]);}else{_0x3aa798[_0xa6f7('0x81')]='';}var _0x1c1884=_0x37b898[_0xa6f7('0x7c')]===_0xa6f7('0x8f')?'eu':_0xa6f7('0x85');return getAccessToken(_0x37b898)['then'](function(_0x5d3f32){_0x5c66e6=_0x5d3f32;return getUser(_0x5c66e6,_0x1c1884,_0x37b898);})[_0xa6f7('0x27')](function(_0x1b79a1){_0x1ecef6=_0x1b79a1;logger[_0xa6f7('0x2c')](_0xa6f7('0x86'),_0x1ecef6['id']);return getEndUser(_0x5c66e6,_0x1c1884,_0x37b898,_0x3aa798['calleridname'],_0x3aa798[_0xa6f7('0x96')],_0x1ecef6,_0xb23da6);})[_0xa6f7('0x27')](function(_0x5b87be){_0x13219e=_0x5b87be;return getCall(_0x5c66e6,_0x1c1884,_0x37b898,_0x1ecef6,_0x13219e,_0xb23da6,_0x3aa798,'Inbound');})[_0xa6f7('0x27')](function(_0x3b8deb){if(_0x3b8deb){logger['info']('The\x20Call\x20ID\x20is:',_0x3b8deb['id']);}})[_0xa6f7('0x3c')](function(_0x2309e0){logger['error']('['+_0x3aa798[_0xa6f7('0x67')]['toUpperCase']()+']',JSON[_0xa6f7('0x39')](_0x2309e0));});}; \ No newline at end of file +var _0xb58b=['[QUEUE]','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','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]','/api/voice/recordings/','destcalleridname','destcalleridnum','unmanaged','toUpperCase','Recording\x20is\x20enabled!','lastevent','request-promise','md5','util','moment','ioredis','../../../../config/environment','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','profile','Administrator','user','Using\x20the\x20admin\x20account!','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','data','code','SUCCESS','details','startCase','The\x20failing\x20result\x20is','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','answertime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','Called','connect','rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','stripTrailingSlash','host','serverUrl','monitor_format'];(function(_0x444fd7,_0x26437e){var _0x4b567c=function(_0x2617ee){while(--_0x2617ee){_0x444fd7['push'](_0x444fd7['shift']());}};_0x4b567c(++_0x26437e);}(_0xb58b,0x1f1));var _0xbb58=function(_0x8ba3c,_0x51ab1d){_0x8ba3c=_0x8ba3c-0x0;var _0x3a87e0=_0xb58b[_0x8ba3c];return _0x3a87e0;};'use strict';var _=require('lodash');var rp=require(_0xbb58('0x0'));var md5=require(_0xbb58('0x1'));var util=require(_0xbb58('0x2'));var intUtil=require('./util');var moment=require(_0xbb58('0x3'));var Redis=require(_0xbb58('0x4'));var BPromise=require('bluebird');var config=require(_0xbb58('0x5'));var logger=require('../../../../config/logger')(_0xbb58('0x6'));config[_0xbb58('0x7')]=_[_0xbb58('0x8')](config['redis'],{'host':_0xbb58('0x9'),'port':0x18eb});var io=require(_0xbb58('0xa'))(new Redis(config[_0xbb58('0x7')]));function emit(_0x5d7fe8,_0xd94f1,_0x3e3144){io['to'](_0x5d7fe8)[_0xbb58('0xb')](_0xd94f1,_0x3e3144);}function request(_0x36ca50){logger[_0xbb58('0xc')](_0xbb58('0xd'),JSON[_0xbb58('0xe')](_0x36ca50));return rp(_0x36ca50);}function getCustomFields(_0x4bb8c5,_0x80ab3a){var _0x5c3bf7={};if(_0x4bb8c5[_0xbb58('0xf')]>0x0){_[_0xbb58('0x10')](_0x4bb8c5,function(_0x26d8e6){if(_[_0xbb58('0x11')](['string',_0xbb58('0x12')],_0x26d8e6[_0xbb58('0x13')])&&_0x26d8e6['idField']){_0x5c3bf7[_0x26d8e6[_0xbb58('0x14')]]=_0x26d8e6[_0xbb58('0x15')][_0xbb58('0x16')]();}else if(_0x26d8e6[_0xbb58('0x13')]===_0xbb58('0x17')&&_0x26d8e6['variableName']&&_0x26d8e6[_0xbb58('0x14')]&&_0x80ab3a[_0x26d8e6[_0xbb58('0x18')]]){_0x5c3bf7[_0x26d8e6['idField']]=_0x80ab3a[_0x26d8e6['variableName']][_0xbb58('0x16')]();}else if(_0x26d8e6[_0xbb58('0x13')]===_0xbb58('0x19')&&_0x26d8e6['Variable']&&_0x26d8e6['Variable']['name']&&_0x26d8e6['idField']&&_0x80ab3a[_0x26d8e6[_0xbb58('0x1a')][_0xbb58('0x1b')]['toLowerCase']()]){_0x5c3bf7[_0x26d8e6[_0xbb58('0x14')]]=_0x80ab3a[_0x26d8e6['Variable'][_0xbb58('0x1b')][_0xbb58('0x1c')]()][_0xbb58('0x16')]();}});}return _0x5c3bf7;}function getName(_0xb8f982){if(_0xb8f982[_0xbb58('0x1d')]('\x20')>0x0){var _0x37a655=_0xb8f982[_0xbb58('0x1e')](/ (.+)/);if(_0x37a655[0x1]){return _0x37a655;}}return[_0xb8f982,_0xb8f982];}var accountsTokens={};function getAccessToken(_0x497fd0){return new Promise(function(_0x84f34,_0x2d8c0f){if(!_[_0xbb58('0x1f')](accountsTokens[_0x497fd0['id']])&&!_[_0xbb58('0x1f')](accountsTokens[_0x497fd0['id']][_0xbb58('0x20')])){if(moment()[_0xbb58('0x21')](accountsTokens[_0x497fd0['id']][_0xbb58('0x22')])){_0x84f34(accountsTokens[_0x497fd0['id']][_0xbb58('0x20')]);}}var _0x27bbec;switch(_0x497fd0['zone']){case'US':_0x27bbec=_0xbb58('0x23');break;case'AU':_0x27bbec='https://accounts.zoho.com.au';break;case'EU':_0x27bbec=_0xbb58('0x24');break;case'IN':_0x27bbec=_0xbb58('0x25');break;case'CN':_0x27bbec=_0xbb58('0x26');break;default:_0x27bbec=_0xbb58('0x24');break;}var _0x2d111c={'method':_0xbb58('0x27'),'uri':_0x27bbec+_0xbb58('0x28'),'qs':{'refresh_token':_0x497fd0[_0xbb58('0x29')],'client_id':_0x497fd0['clientId'],'client_secret':_0x497fd0[_0xbb58('0x2a')],'grant_type':_0xbb58('0x2b')},'json':!![]};return rp(_0x2d111c)[_0xbb58('0x2c')](function(_0x129094){accountsTokens[_0x497fd0['id']]={'access_token':_0x129094[_0xbb58('0x20')],'expires_in':moment()[_0xbb58('0x2d')](_0x129094[_0xbb58('0x22')],_0xbb58('0x2e'))};_0x84f34(_0x129094[_0xbb58('0x20')]);})[_0xbb58('0x2f')](function(_0xf6687e){logger[_0xbb58('0x30')](_0xbb58('0x31'),_0xf6687e[_0xbb58('0x32')]);_0x2d8c0f(_0xf6687e);});});}function getUser(_0x3559b6,_0x573cca,_0x2b0f73,_0xe46bc1){logger[_0xbb58('0x33')](_0xbb58('0x34'));return request({'method':_0xbb58('0x35'),'uri':util[_0xbb58('0x36')](_0xbb58('0x37'),_0x573cca),'qs':{'type':_0xbb58('0x38')},'headers':{'Authorization':_0xbb58('0x39')+_0x3559b6},'json':!![]})['then'](function(_0xc39e3f){if(_0xc39e3f[_0xbb58('0x3a')]){var _0x3edc34=-0x1;if(_[_0xbb58('0x3b')](_0xc39e3f[_0xbb58('0x3a')])){if(!_[_0xbb58('0x1f')](_0xe46bc1)){_0x3edc34=_[_0xbb58('0x3c')](_0xc39e3f[_0xbb58('0x3a')],function(_0x23816c){return _0x23816c[_0xbb58('0x3d')]===_0xe46bc1;});}if(_0x3edc34>=0x0){logger[_0xbb58('0x33')](_0xbb58('0x3e'));}else{logger[_0xbb58('0x33')]('Using\x20the\x20admin\x20account!');_0x3edc34=_['findIndex'](_0xc39e3f['users'],function(_0x1def9f){return _0x1def9f[_0xbb58('0x3f')][_0xbb58('0x1b')]===_0xbb58('0x40');});}return _0xc39e3f[_0xbb58('0x3a')][_0x3edc34];}else{if(_0xc39e3f[_0xbb58('0x41')][_0xbb58('0x3f')][_0xbb58('0x1b')]==='Administrator'){logger[_0xbb58('0x33')](_0xbb58('0x42'));user=_0xc39e3f['user'];return user;}else{logger[_0xbb58('0x30')]('The\x20failing\x20result\x20is',JSON[_0xbb58('0xe')](_0xc39e3f));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xbb58('0xe')](_0xc39e3f));}}}else{logger[_0xbb58('0x30')]('The\x20failing\x20result\x20is',JSON[_0xbb58('0xe')](_0xc39e3f));throw new Error(_0xbb58('0x43')+JSON[_0xbb58('0xe')](_0xc39e3f));}})[_0xbb58('0x2f')](function(_0x1b86a6){console[_0xbb58('0x30')](_0x1b86a6);});}function getZohoUser(_0x434959,_0x58af93){return new BPromise(function(_0x4e9c19,_0x238662){request(_0x434959)[_0xbb58('0x2c')](function(_0x2da5ff){var _0x4c0781=null;if(_0x2da5ff){_0x4c0781=_0x2da5ff['data'][0x0];_0x4c0781[_0xbb58('0x44')]=_0x58af93;}_0x4e9c19(_0x4c0781);})['catch'](function(_0x6c719a){_0x238662(_0x6c719a);});});}function createEndUser(_0x11fa59,_0x2ab2d8,_0x560911,_0x485830,_0xc29171,_0x184b84){var _0x560911=getName(_0x560911);return request({'method':_0xbb58('0x27'),'uri':_0xbb58('0x45')+_0x2ab2d8+_0xbb58('0x46')+_['startCase'](_0x184b84[_0xbb58('0x47')])+'s','body':{'data':[{'Last_Name':_0x560911[0x1],'First_Name':_0x560911[0x0],'Phone':_0x485830,'Owner':{'name':!_[_0xbb58('0x1f')](_0xc29171[_0xbb58('0x48')][_0xbb58('0x1b')])?_0xc29171[_0xbb58('0x48')][_0xbb58('0x1b')]:!_['isNil'](_0xc29171[_0xbb58('0x49')])?_0xc29171['first_name']+'\x20'+_0xc29171[_0xbb58('0x4a')]:_0xc29171[_0xbb58('0x4a')],'id':_0xc29171['id']}}]},'headers':{'Authorization':_0xbb58('0x39')+_0x11fa59},'json':!![]})[_0xbb58('0x2c')](function(_0x54099f){if(_0x54099f&&_0x54099f[_0xbb58('0x4b')][0x0][_0xbb58('0x4c')]===_0xbb58('0x4d')){var _0x3a732c=_0x54099f['data'][0x0][_0xbb58('0x4e')];_0x3a732c['enduserType']=_[_0xbb58('0x4f')](_0x184b84[_0xbb58('0x47')])+'s';return _0x3a732c;}logger[_0xbb58('0x30')](_0xbb58('0x50'),JSON[_0xbb58('0xe')](data));throw new Error(_0xbb58('0x51')+JSON[_0xbb58('0xe')](data));})[_0xbb58('0x2f')](function(_0x18799c){console[_0xbb58('0x52')](_0xbb58('0x53'),_0x18799c);});}function getEndUser(_0x109a95,_0x21c597,_0x55a1cc,_0xc690d,_0x5b5190,_0x5c1878,_0x116b26){var _0x75cc18={'method':_0xbb58('0x35'),'uri':'','headers':{'Authorization':_0xbb58('0x39')+_0x109a95},'json':!![]};switch(_0x116b26[_0xbb58('0x54')]){case _0xbb58('0x55'):_0x75cc18[_0xbb58('0x56')]=_0xbb58('0x45')+_0x21c597+_0xbb58('0x57')+_0x5b5190+'))';return getZohoUser(_0x75cc18,_0xbb58('0x58'))[_0xbb58('0x2c')](function(_0x59a8cf){if(_0x59a8cf)return _0x59a8cf;_0x75cc18[_0xbb58('0x56')]=_0xbb58('0x45')+_0x21c597+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x5b5190+'))';return getZohoUser(_0x75cc18,_0xbb58('0x59'))[_0xbb58('0x2c')](function(_0xf94897){if(_0xf94897)return _0xf94897;if(_0x116b26[_0xbb58('0x47')]!='nothing'){return createEndUser(_0x109a95,_0x21c597,_0xc690d,_0x5b5190,_0x5c1878,_0x116b26);}else{return{};}});});break;case _0xbb58('0x5a'):_0x75cc18['uri']=_0xbb58('0x45')+_0x21c597+_0xbb58('0x57')+_0x5b5190+'))';return getZohoUser(_0x75cc18,_0xbb58('0x58'))['then'](function(_0x2c0a0c){if(_0x2c0a0c)return _0x2c0a0c;if(_0x116b26[_0xbb58('0x47')]!='nothing'){return createEndUser(_0x109a95,_0x21c597,_0xc690d,_0x5b5190,_0x5c1878,_0x116b26);}else{return{};}});break;case _0xbb58('0x5b'):_0x75cc18['uri']=_0xbb58('0x45')+_0x21c597+_0xbb58('0x5c')+_0x5b5190+'))';return getZohoUser(_0x75cc18,_0xbb58('0x59'))[_0xbb58('0x2c')](function(_0x39a36e){if(_0x39a36e)return _0x39a36e;if(_0x116b26[_0xbb58('0x47')]!=_0xbb58('0x5d')){return createEndUser(_0x109a95,_0x21c597,_0xc690d,_0x5b5190,_0x5c1878,_0x116b26);}else{return{};}});break;}}function getCall(_0x4cb975,_0x449088,_0x1fd892,_0x592da8,_0x3efbc6,_0x98157,_0x5c19b7,_0x22802c){logger[_0xbb58('0x33')](_0xbb58('0x5e'));var _0x4e21e0={};_0x4e21e0[_0xbb58('0x5f')]={'name':!_[_0xbb58('0x1f')](_0x592da8[_0xbb58('0x48')]['name'])&&!_[_0xbb58('0x1f')](_0x592da8['profile'][_0xbb58('0x1b')])&&_0x592da8[_0xbb58('0x3f')][_0xbb58('0x1b')]==='administrator'?_0x592da8['role'][_0xbb58('0x1b')]:!_[_0xbb58('0x1f')](_0x592da8[_0xbb58('0x49')])?_0x592da8[_0xbb58('0x49')]+'\x20'+_0x592da8[_0xbb58('0x4a')]:_0x592da8['last_name'],'id':_0x592da8['id']};_0x4e21e0[_0xbb58('0x60')]=intUtil[_0xbb58('0x61')](_0x98157[_0xbb58('0x62')],_0x5c19b7,'\x20');_0x4e21e0['Description']=intUtil[_0xbb58('0x61')](_0x98157[_0xbb58('0x63')],_0x5c19b7,'\x0a');if(_0x3efbc6[_0xbb58('0x44')]===_0xbb58('0x58')){_0x4e21e0[_0xbb58('0x64')]={'name':!_['isNil'](_0x3efbc6[_0xbb58('0x65')])?_0x3efbc6[_0xbb58('0x65')]:!_[_0xbb58('0x1f')](_0x3efbc6[_0xbb58('0x66')])?_0x3efbc6[_0xbb58('0x66')]+'\x20'+_0x3efbc6[_0xbb58('0x67')]:_0x3efbc6[_0xbb58('0x67')],'id':_0x3efbc6['id']};}if(_0x3efbc6[_0xbb58('0x44')]==='Leads'){_0x4e21e0[_0xbb58('0x68')]={'name':!_['isNil'](_0x3efbc6[_0xbb58('0x65')])?_0x3efbc6[_0xbb58('0x65')]:!_[_0xbb58('0x1f')](_0x3efbc6[_0xbb58('0x66')])?_0x3efbc6[_0xbb58('0x66')]+'\x20'+_0x3efbc6[_0xbb58('0x67')]:_0x3efbc6[_0xbb58('0x67')],'id':_0x3efbc6['id']};_0x4e21e0[_0xbb58('0x69')]=_[_0xbb58('0x4f')](_0x3efbc6[_0xbb58('0x44')]);}if(_0x5c19b7[_0xbb58('0x6a')]){_0x4e21e0['Call_Duration']=moment[_0xbb58('0x6b')](parseInt(_0x5c19b7[_0xbb58('0x6a')])*0x3e8)[_0xbb58('0x36')]('mm:ss');}else if(_0x5c19b7[_0xbb58('0x6c')]&&_0x5c19b7['endtime']){_0x4e21e0[_0xbb58('0x6d')]=moment[_0xbb58('0x6b')](moment(_0x5c19b7['endtime'],_0xbb58('0x6e'))[_0xbb58('0x6f')](moment(_0x5c19b7[_0xbb58('0x70')],_0xbb58('0x6e'))))[_0xbb58('0x36')]('mm:ss');}switch(_0x5c19b7['lastevent']){case _0xbb58('0x71'):_0x4e21e0[_0xbb58('0x72')]=_0xbb58('0x73');break;case'complete':case _0xbb58('0x74'):_0x4e21e0[_0xbb58('0x72')]='Answered';break;case _0xbb58('0x75'):_0x4e21e0[_0xbb58('0x72')]='Rejected';break;case _0xbb58('0x76'):_0x4e21e0[_0xbb58('0x72')]=_0xbb58('0x77');break;case _0xbb58('0x78'):_0x4e21e0[_0xbb58('0x72')]='Timeout';default:}_0x4e21e0[_0xbb58('0x79')]=(_0x22802c===_0xbb58('0x7a')?moment(_0x5c19b7[_0xbb58('0x70')])[_0xbb58('0x36')](_0xbb58('0x6e')):moment(_0x5c19b7['agentcalledAt'])['format'](_0xbb58('0x6e')))||moment()['format'](_0xbb58('0x6e'));_0x4e21e0[_0xbb58('0x7b')]=_0x22802c||_0xbb58('0x7c');_0x4e21e0=_[_0xbb58('0x7d')](_0x4e21e0,getCustomFields(_0x98157[_0xbb58('0x7e')],_0x5c19b7));return request({'method':_0xbb58('0x27'),'uri':_0xbb58('0x45')+_0x449088+_0xbb58('0x7f'),'headers':{'Authorization':_0xbb58('0x39')+_0x4cb975},'body':{'data':[_0x4e21e0]},'json':!![]})[_0xbb58('0x2c')](function(_0x4c1162){if(_0x4c1162&&_0x4c1162[_0xbb58('0x4b')][0x0][_0xbb58('0x4c')]===_0xbb58('0x4d')){logger['info'](_0xbb58('0x80'));return{'id':_0x4c1162['data'][0x0]['details']['id']};}})[_0xbb58('0x2f')](function(_0x291357){logger[_0xbb58('0x33')](_0xbb58('0x81'),_0x291357['stack']);console['log'](_0xbb58('0x81'),_0x291357);});}exports[_0xbb58('0x82')]=function(_0x4d2091,_0x27c861,_0x2ba4a9,_0x3cd96a,_0x32cb70,_0x382d16){var _0x55d3c5,_0x30b8d2,_0x5b27d2;_0x382d16['host']=intUtil[_0xbb58('0x83')](_0x382d16[_0xbb58('0x84')]);_0x382d16[_0xbb58('0x85')]=intUtil['stripTrailingSlash'](_0x382d16[_0xbb58('0x85')]);if(_0x32cb70&&_0x32cb70[_0xbb58('0x86')]){logger[_0xbb58('0x33')](_0xbb58('0x87'),'Recording\x20is\x20enabled!');_0x27c861[_0xbb58('0x88')]=_0x382d16['serverUrl']+'/api/voice/recordings/'+_0x27c861[_0xbb58('0x89')]+_0xbb58('0x8a')+md5(_0x27c861[_0xbb58('0x89')]);}else{_0x27c861['recordingURL']='';}var _0x4992f7=_0x382d16[_0xbb58('0x84')]===_0xbb58('0x8b')?'eu':_0xbb58('0x8c');return getAccessToken(_0x382d16)[_0xbb58('0x2c')](function(_0x171269){_0x5b27d2=_0x171269;return getUser(_0x5b27d2,_0x4992f7,_0x382d16,_0x3cd96a[_0xbb58('0x3d')]);})[_0xbb58('0x2c')](function(_0x37ed76){_0x55d3c5=_0x37ed76;logger[_0xbb58('0x33')](_0xbb58('0x8d'),_0x55d3c5['id']);return getEndUser(_0x5b27d2,_0x4992f7,_0x382d16,_0x27c861[_0xbb58('0x8e')],_0x27c861['calleridnum'],_0x55d3c5,_0x2ba4a9);})['then'](function(_0x36e2eb){_0x30b8d2=_0x36e2eb;return getCall(_0x5b27d2,_0x4992f7,_0x382d16,_0x55d3c5,_0x30b8d2,_0x2ba4a9,_0x27c861,_0xbb58('0x7c'));})[_0xbb58('0x2c')](function(_0x54cd7d){if(_0x54cd7d){logger[_0xbb58('0x33')](_0xbb58('0x8f'),_0x54cd7d['id']);logger[_0xbb58('0x33')]('[QUEUE]',_0xbb58('0x90'));emit(util['format'](_0xbb58('0x91'),_0x3cd96a['name']),_0xbb58('0x92'),{'uri':_0xbb58('0x93')+_0x382d16[_0xbb58('0x84')]+_0xbb58('0x94')+_0x54cd7d['id']});}})[_0xbb58('0x2f')](function(_0xf5e243){logger['error']('[QUEUE]',JSON[_0xbb58('0xe')](_0xf5e243));});};exports[_0xbb58('0x7a')]=function(_0x49edfe,_0x14197f,_0x1c43dd,_0x43eb15,_0x5604d1,_0x371a9a,_0x5a7f77){var _0x2fe0b5,_0x2616ad,_0x3cc9d6;_0x371a9a[_0xbb58('0x84')]=intUtil[_0xbb58('0x83')](_0x371a9a[_0xbb58('0x84')]);_0x371a9a[_0xbb58('0x85')]=intUtil['stripTrailingSlash'](_0x371a9a[_0xbb58('0x85')]);if(_0x5a7f77&&_0x5a7f77[_0xbb58('0x95')]&&_0x5a7f77[_0xbb58('0x95')]!=='none'){logger[_0xbb58('0x33')](_0xbb58('0x96'),'Recording\x20is\x20enabled!');_0x14197f['recordingURL']=_0x371a9a[_0xbb58('0x85')]+_0xbb58('0x97')+_0x14197f[_0xbb58('0x89')]+'/downloads?type=uniqueid&token='+md5(_0x14197f['uniqueid']);}var _0x3939c6=_0x371a9a[_0xbb58('0x84')]===_0xbb58('0x8b')?'eu':_0xbb58('0x8c');return getAccessToken(_0x371a9a)[_0xbb58('0x2c')](function(_0x2a3bd3){_0x3cc9d6=_0x2a3bd3;return getUser(_0x3cc9d6,_0x3939c6,_0x371a9a,_0x43eb15[_0xbb58('0x3d')]);})[_0xbb58('0x2c')](function(_0x3b65cb){_0x2fe0b5=_0x3b65cb;logger[_0xbb58('0x33')](_0xbb58('0x8d'),_0x2fe0b5['id']);return getEndUser(_0x3cc9d6,_0x3939c6,_0x371a9a,_0x14197f[_0xbb58('0x98')],_0x14197f[_0xbb58('0x99')],_0x2fe0b5,_0x1c43dd);})[_0xbb58('0x2c')](function(_0x218e3b){_0x2616ad=_0x218e3b;return getCall(_0x3cc9d6,_0x3939c6,_0x371a9a,_0x2fe0b5,_0x2616ad,_0x1c43dd,_0x14197f,'Outbound');})[_0xbb58('0x2c')](function(_0x47a35f){if(_0x47a35f){logger[_0xbb58('0x33')](_0xbb58('0x8f'),_0x47a35f['id']);logger[_0xbb58('0x33')](_0xbb58('0x96'),_0xbb58('0x90'));emit(util[_0xbb58('0x36')](_0xbb58('0x91'),_0x43eb15[_0xbb58('0x1b')]),_0xbb58('0x92'),{'uri':_0xbb58('0x93')+_0x371a9a['host']+_0xbb58('0x94')+_0x47a35f['id']});}})[_0xbb58('0x2f')](function(_0x2c0ee1){logger[_0xbb58('0x30')](_0xbb58('0x96'),JSON['stringify'](_0x2c0ee1));});};exports[_0xbb58('0x9a')]=function(_0x4c8531,_0x562db5,_0x3b9c4c,_0x4acfcf,_0x307ce6,_0x528f81){var _0x4f5015,_0x4a794f,_0x3b320a;_0x528f81[_0xbb58('0x84')]=intUtil[_0xbb58('0x83')](_0x528f81[_0xbb58('0x84')]);_0x528f81[_0xbb58('0x85')]=intUtil[_0xbb58('0x83')](_0x528f81[_0xbb58('0x85')]);if(_0x307ce6&&_0x307ce6[_0xbb58('0x86')]){logger['info']('['+_0x562db5['lastevent'][_0xbb58('0x9b')]()+']',_0xbb58('0x9c'));_0x562db5['recordingURL']=_0x528f81['serverUrl']+'/api/voice/recordings/'+_0x562db5[_0xbb58('0x89')]+_0xbb58('0x8a')+md5(_0x562db5['uniqueid']);}else{_0x562db5[_0xbb58('0x88')]='';}var _0x4281c0=_0x528f81[_0xbb58('0x84')]===_0xbb58('0x8b')?'eu':_0xbb58('0x8c');return getAccessToken(_0x528f81)[_0xbb58('0x2c')](function(_0x38288d){_0x3b320a=_0x38288d;return getUser(_0x3b320a,_0x4281c0,_0x528f81);})[_0xbb58('0x2c')](function(_0x4a2e9c){_0x4f5015=_0x4a2e9c;logger[_0xbb58('0x33')](_0xbb58('0x8d'),_0x4f5015['id']);return getEndUser(_0x3b320a,_0x4281c0,_0x528f81,_0x562db5['calleridname'],_0x562db5['calleridnum'],_0x4f5015,_0x3b9c4c);})[_0xbb58('0x2c')](function(_0x19fdac){_0x4a794f=_0x19fdac;return getCall(_0x3b320a,_0x4281c0,_0x528f81,_0x4f5015,_0x4a794f,_0x3b9c4c,_0x562db5,_0xbb58('0x7c'));})[_0xbb58('0x2c')](function(_0x3f3973){if(_0x3f3973){logger['info'](_0xbb58('0x8f'),_0x3f3973['id']);}})[_0xbb58('0x2f')](function(_0x56c784){logger[_0xbb58('0x30')]('['+_0x562db5[_0xbb58('0x9d')][_0xbb58('0x9b')]()+']',JSON['stringify'](_0x56c784));});}; \ 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 1353e45..932b0e3 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(_0x2f23dc,_0x281724){var _0x5aeb65=function(_0x58283a){while(--_0x58283a){_0x2f23dc['push'](_0x2f23dc['shift']());}};_0x5aeb65(++_0x281724);}(_0x7a54,0x106));var _0x47a5=function(_0x57a87e,_0x4b5c72){_0x57a87e=_0x57a87e-0x0;var _0x246695=_0x7a54[_0x57a87e];return _0x246695;};'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(_0x9ffc10,_0x1c566e){var _0x19b2d0=function(_0x5f4ec8){while(--_0x5f4ec8){_0x9ffc10['push'](_0x9ffc10['shift']());}};_0x19b2d0(++_0x1c566e);}(_0x7a54,0x106));var _0x47a5=function(_0x598a17,_0x380c77){_0x598a17=_0x598a17-0x0;var _0x20d50c=_0x7a54[_0x598a17];return _0x20d50c;};'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 706b075..9db9cc4 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 _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(_0x557d04,_0x483ff3){var _0x4a84be=function(_0x53410f){while(--_0x53410f){_0x557d04['push'](_0x557d04['shift']());}};_0x4a84be(++_0x483ff3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x48245e,_0x178e51){_0x48245e=_0x48245e-0x0;var _0x4e5e30=_0x5f2f[_0x48245e];return _0x4e5e30;};'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 +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(_0xa78cbb,_0x5f1938){var _0x15a252=function(_0x22f845){while(--_0x22f845){_0xa78cbb['push'](_0xa78cbb['shift']());}};_0x15a252(++_0x5f1938);}(_0x7a54,0x106));var _0x47a5=function(_0xc1ace2,_0x51013a){_0xc1ace2=_0xc1ace2-0x0;var _0x20b3f1=_0x7a54[_0xc1ace2];return _0x20b3f1;};'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 diff --git a/server/services/email/client.js b/server/services/email/client.js index bee6f7d..4e0293e 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 _0x5178=['error','message','result','catch','exports','bluebird','../../config/logger','routing','client','http','request','debug','rpc'];(function(_0x4a4f46,_0x866a77){var _0x562b36=function(_0x471a3e){while(--_0x471a3e){_0x4a4f46['push'](_0x4a4f46['shift']());}};_0x562b36(++_0x866a77);}(_0x5178,0x171));var _0x8517=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5178[_0x5ddb1c];return _0x354adc;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x8517('0x0'));var logger=require(_0x8517('0x1'))(_0x8517('0x2'));var client=jayson[_0x8517('0x3')][_0x8517('0x4')]({'port':0x2329});client['Request']=function(_0x483381,_0x3ed6a5){return new BPromise(function(_0x221184,_0x4ccd73){return client[_0x8517('0x5')](_0x483381,_0x3ed6a5)['then'](function(_0x13ba05){logger[_0x8517('0x6')](_0x8517('0x7'),_0x8517('0x2'),_0x483381,_0x3ed6a5,_0x13ba05);if(_0x13ba05[_0x8517('0x8')]){logger['error'](_0x8517('0x7'),'routing',_0x483381,_0x13ba05['error'][_0x8517('0x9')],_0x3ed6a5);return _0x4ccd73(_0x13ba05[_0x8517('0x8')]['message']);}else{return _0x221184(_0x13ba05[_0x8517('0xa')]);}})[_0x8517('0xb')](function(_0x203154){logger[_0x8517('0x8')](_0x8517('0x7'),_0x8517('0x2'),_0x483381,_0x203154,_0x3ed6a5);return _0x4ccd73(_0x203154);});});};module[_0x8517('0xc')]=client; \ No newline at end of file +var _0x2427=['http','request','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','routing'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2427,0x165));var _0x7242=function(_0x27deb5,_0x205286){_0x27deb5=_0x27deb5-0x0;var _0x5ceaa4=_0x2427[_0x27deb5];return _0x5ceaa4;};'use strict';var jayson=require(_0x7242('0x0'));var BPromise=require(_0x7242('0x1'));var logger=require('../../config/logger')(_0x7242('0x2'));var client=jayson['client'][_0x7242('0x3')]({'port':0x2329});client['Request']=function(_0x66fd49,_0x12766a){return new BPromise(function(_0x226e44,_0x5b70ea){return client[_0x7242('0x4')](_0x66fd49,_0x12766a)['then'](function(_0x3c629c){logger[_0x7242('0x5')](_0x7242('0x6'),_0x7242('0x2'),_0x66fd49,_0x12766a,_0x3c629c);if(_0x3c629c['error']){logger[_0x7242('0x7')](_0x7242('0x6'),'routing',_0x66fd49,_0x3c629c[_0x7242('0x7')][_0x7242('0x8')],_0x12766a);return _0x5b70ea(_0x3c629c[_0x7242('0x7')]['message']);}else{return _0x226e44(_0x3c629c[_0x7242('0x9')]);}})[_0x7242('0xa')](function(_0x2e62a8){logger[_0x7242('0x7')]('rpc',_0x7242('0x2'),_0x66fd49,_0x2e62a8,_0x12766a);return _0x5b70ea(_0x2e62a8);});});};module[_0x7242('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index a5dd4a3..f44dd84 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 _0xf006=['catch','log','./realtime','./lib/email','../../mysqldb','then','initMailAccounts','refresh','listen','Setting','findOne','loginMailFrequency'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xf006,0x146));var _0x6f00=function(_0x285e6c,_0x2008ca){_0x285e6c=_0x285e6c-0x0;var _0x10ff35=_0xf006[_0x285e6c];return _0x10ff35;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0x6f00('0x0'));var EmailChannel=require(_0x6f00('0x1'));var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x6f00('0x2'))['db'];function initRealtime(){return BPromise['resolve']()[_0x6f00('0x3')](mailAccount['getMailAccounts']())['then'](realtime[_0x6f00('0x4')]())[_0x6f00('0x3')](function(){email[_0x6f00('0x5')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x6f00('0x6')](realtime,email)['then'](function(_0x3875fb){return initRealtime();})[_0x6f00('0x3')](function(_0x185728){return db[_0x6f00('0x7')][_0x6f00('0x8')]({'attributes':['id',_0x6f00('0x9')],'raw':!![]});})[_0x6f00('0x3')](function(_0x1e0720){return setInterval(initRealtime,_0x1e0720[_0x6f00('0x9')]*0x3e8);})[_0x6f00('0xa')](function(_0x3a0ef4){console[_0x6f00('0xb')](_0x3a0ef4);});}main(); \ No newline at end of file +var _0x4672=['catch','log','bluebird','./realtime','./lib/email','../../mysqldb','then','getMailAccounts','initMailAccounts','refresh','listen','Setting','findOne','loginMailFrequency'];(function(_0x294425,_0x376dda){var _0x2a12ec=function(_0x406e86){while(--_0x406e86){_0x294425['push'](_0x294425['shift']());}};_0x2a12ec(++_0x376dda);}(_0x4672,0x18a));var _0x2467=function(_0x1c6efd,_0xb2f3cd){_0x1c6efd=_0x1c6efd-0x0;var _0x53a918=_0x4672[_0x1c6efd];return _0x53a918;};'use strict';var BPromise=require(_0x2467('0x0'));var server=require('./server');var Realtime=require(_0x2467('0x1'));var EmailChannel=require(_0x2467('0x2'));var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x2467('0x3'))['db'];function initRealtime(){return BPromise['resolve']()[_0x2467('0x4')](mailAccount[_0x2467('0x5')]())[_0x2467('0x4')](realtime[_0x2467('0x6')]())['then'](function(){email[_0x2467('0x7')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x2467('0x8')](realtime,email)[_0x2467('0x4')](function(_0x1e91f3){return initRealtime();})[_0x2467('0x4')](function(_0x249e2a){return db[_0x2467('0x9')][_0x2467('0xa')]({'attributes':['id',_0x2467('0xb')],'raw':!![]});})[_0x2467('0x4')](function(_0x53b91d){return setInterval(initRealtime,_0x53b91d[_0x2467('0xb')]*0x3e8);})[_0x2467('0xc')](function(_0xb5c09d){console[_0x2467('0xd')](_0xb5c09d);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 99250c3..92b659c 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 _0xb7f9=['../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','name','active','Imap','isNil','stringify','emit','mailAccount:update','prototype','hasOwnProperty','email','box','handleImapBox','bind','handleImapEnd','error','handleImapError','status','disabled','messageStatus','connected','messages','total','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','send','verifySmtp','Smtp','lastSync','verify','exports','moment','md5','ioredis','../../../config/environment','../../../config/logger','redis','./imap','./smtp'];(function(_0x3b0e11,_0x572996){var _0x1b8572=function(_0x131a8f){while(--_0x131a8f){_0x3b0e11['push'](_0x3b0e11['shift']());}};_0x1b8572(++_0x572996);}(_0xb7f9,0x156));var _0x9b7f=function(_0x2b22a6,_0x4194c8){_0x2b22a6=_0x2b22a6-0x0;var _0x359277=_0xb7f9[_0x2b22a6];return _0x359277;};'use strict';var _=require('lodash');var moment=require(_0x9b7f('0x0'));var BPromise=require('bluebird');var md5=require(_0x9b7f('0x1'));var Redis=require(_0x9b7f('0x2'));var config=require(_0x9b7f('0x3'));var logger=require(_0x9b7f('0x4'))('email');config[_0x9b7f('0x5')]=_['defaults'](config[_0x9b7f('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9b7f('0x5')]));var EmailImap=require(_0x9b7f('0x6'));var EmailSmtp=require(_0x9b7f('0x7'));var mailAccount=require(_0x9b7f('0x8'));var md5Accounts={};function EmailChannel(_0x44d6){logger[_0x9b7f('0x9')](_0x9b7f('0xa'));this[_0x9b7f('0xb')]=_0x44d6[_0x9b7f('0xb')];this[_0x9b7f('0xc')]={};this[_0x9b7f('0xd')]=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x539c0a){var _0x299e4f=this[_0x9b7f('0xb')][_0x539c0a];var _0x305cc0={'id':_0x299e4f['id'],'name':_0x299e4f[_0x9b7f('0xe')],'key':_0x299e4f['key'],'active':_0x299e4f[_0x9b7f('0xf')],'Imap':{'status':_0x299e4f[_0x9b7f('0x10')]['status'],'messageStatus':_0x299e4f[_0x9b7f('0x10')]['messageStatus'],'total':_0x299e4f[_0x9b7f('0x10')]['total']}};if(_[_0x9b7f('0x11')](md5Accounts[_0x539c0a])){md5Accounts[_0x539c0a]={};}var _0x5ab406=md5(JSON[_0x9b7f('0x12')](_0x305cc0));if(md5Accounts[_0x539c0a][_0x9b7f('0x1')]!==_0x5ab406){md5Accounts[_0x539c0a][_0x9b7f('0x1')]=_0x5ab406;io[_0x9b7f('0x13')](_0x9b7f('0x14'),_0x305cc0);}};EmailChannel[_0x9b7f('0x15')]['refresh']=function(_0x5d8347){for(var _0x226806 in _0x5d8347){if(_0x5d8347[_0x9b7f('0x16')](_0x226806)){if(_0x5d8347[_0x226806]['Imap']&&_0x5d8347[_0x226806]['active']){var _0x5119ca=_0x5d8347[_0x226806][_0x9b7f('0x10')];if(!this[_0x9b7f('0xc')][_0x9b7f('0x16')](_0x5119ca['id'])){this[_0x9b7f('0xc')][_0x5119ca['id']]=new EmailImap(_0x5119ca,_0x5d8347[_0x226806][_0x9b7f('0x17')]);this['imapAccounts'][_0x5119ca['id']]['on'](_0x9b7f('0x18'),this[_0x9b7f('0x19')][_0x9b7f('0x1a')](this,_0x226806));this['imapAccounts'][_0x5119ca['id']]['on'](_0x9b7f('0x17'),this['handleImapEmail'][_0x9b7f('0x1a')](this,_0x226806));this[_0x9b7f('0xc')][_0x5119ca['id']]['on']('end',this[_0x9b7f('0x1b')][_0x9b7f('0x1a')](this,_0x226806));this['imapAccounts'][_0x5119ca['id']]['on'](_0x9b7f('0x1c'),this[_0x9b7f('0x1d')][_0x9b7f('0x1a')](this,_0x226806));}}else{if(_['isNil'](this[_0x9b7f('0xb')][_0x226806]['Imap'])){this[_0x9b7f('0xb')][_0x226806][_0x9b7f('0x10')]={};}this[_0x9b7f('0xb')][_0x226806][_0x9b7f('0x10')][_0x9b7f('0x1e')]=_0x9b7f('0x1f');this[_0x9b7f('0xb')][_0x226806]['Imap'][_0x9b7f('0x20')]='';this[_0x9b7f('0x13')](_0x226806);}}}};EmailChannel['prototype']['handleImapBox']=function(_0x3ef746,_0x5364f7){if(this[_0x9b7f('0xb')][_0x3ef746]){this[_0x9b7f('0xb')][_0x3ef746][_0x9b7f('0x10')][_0x9b7f('0x1e')]=_0x9b7f('0x21');this['mailAccounts'][_0x3ef746][_0x9b7f('0x10')][_0x9b7f('0x20')]=_0x5364f7[_0x9b7f('0xe')];if(_0x5364f7[_0x9b7f('0x22')]){this[_0x9b7f('0xb')][_0x3ef746]['Imap']['total']=_0x5364f7[_0x9b7f('0x22')][_0x9b7f('0x23')];}return this[_0x9b7f('0x13')](_0x3ef746);}};EmailChannel[_0x9b7f('0x15')][_0x9b7f('0x24')]=function(_0x4185f8,_0x3914a3){logger['info'](_0x9b7f('0x25'),_0x3914a3['firstName'],_0x3914a3[_0x9b7f('0x26')],_0x3914a3[_0x9b7f('0x27')],_0x4185f8);if(this['mailAccounts'][_0x4185f8]){return mailAccount[_0x9b7f('0x28')](_0x4185f8,_0x3914a3)['then'](function(_0x10c09b){if(_0x10c09b){logger[_0x9b7f('0x9')](_0x9b7f('0x29'));}})[_0x9b7f('0x2a')](function(_0x549fb6){logger[_0x9b7f('0x1c')](_0x9b7f('0x2b'),JSON[_0x9b7f('0x12')](_0x549fb6));});}};EmailChannel[_0x9b7f('0x15')][_0x9b7f('0x1b')]=function(_0x2c71cf){if(this['mailAccounts'][_0x2c71cf]&&this['mailAccounts'][_0x2c71cf][_0x9b7f('0x10')]){if(this['imapAccounts'][this['mailAccounts'][_0x2c71cf]['Imap']['id']]){delete this['imapAccounts'][this[_0x9b7f('0xb')][_0x2c71cf][_0x9b7f('0x10')]['id']];}this[_0x9b7f('0xb')][_0x2c71cf][_0x9b7f('0x10')]['lastSync']=moment();this[_0x9b7f('0x13')](_0x2c71cf);}};EmailChannel[_0x9b7f('0x15')]['handleImapError']=function(_0x45eedc,_0x5039ac){if(this[_0x9b7f('0xb')][_0x45eedc]){this['mailAccounts'][_0x45eedc][_0x9b7f('0x10')][_0x9b7f('0x1e')]='error';this['mailAccounts'][_0x45eedc][_0x9b7f('0x10')][_0x9b7f('0x20')]=_0x5039ac;return this[_0x9b7f('0x13')](_0x45eedc);}};EmailChannel['prototype']['sendMail']=function(_0x5c1949,_0x14e1b9){return this[_0x9b7f('0xd')][_0x9b7f('0x2c')](_0x5c1949,_0x14e1b9);};EmailChannel[_0x9b7f('0x15')][_0x9b7f('0x2d')]=function(_0x9d4f81){var _0x38b38f=this;if(this[_0x9b7f('0xb')][_0x9d4f81['id']]){if(_['isNil'](this['mailAccounts'][_0x9d4f81['id']][_0x9b7f('0x2e')])){this[_0x9b7f('0xb')][_0x9d4f81['id']][_0x9b7f('0x2e')]={};}this[_0x9b7f('0xb')][_0x9d4f81['id']]['Smtp'][_0x9b7f('0x2f')]=moment();return new BPromise(function(_0x17fedd,_0x59b730){return _0x38b38f['smtp']['verify'](_0x9d4f81)['then'](function(_0x5c8eea){_0x38b38f['mailAccounts'][_0x9d4f81['id']][_0x9b7f('0x2e')]['status']='verified';_0x38b38f['mailAccounts'][_0x9d4f81['id']][_0x9b7f('0x2e')][_0x9b7f('0x20')]='';_0x38b38f[_0x9b7f('0x13')](_0x9d4f81['id']);_0x17fedd(_0x5c8eea);})[_0x9b7f('0x2a')](function(_0x1c96b0){_0x38b38f[_0x9b7f('0xb')][_0x9d4f81['id']][_0x9b7f('0x2e')][_0x9b7f('0x1e')]=_0x9b7f('0x1c');_0x38b38f['mailAccounts'][_0x9d4f81['id']][_0x9b7f('0x2e')]['messageStatus']=_0x1c96b0;_0x38b38f[_0x9b7f('0x13')](_0x9d4f81['id']);_0x59b730(_0x1c96b0);});});}return this[_0x9b7f('0xd')][_0x9b7f('0x30')](_0x9d4f81);};module[_0x9b7f('0x31')]=EmailChannel; \ No newline at end of file +var _0xaa79=['../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','active','Imap','status','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','box','handleImapBox','bind','end','handleImapEnd','error','handleImapError','disabled','messageStatus','connected','total','messages','handleImapEmail','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','verifySmtp','Smtp','verified','verify','exports','lodash','moment','bluebird','md5','ioredis'];(function(_0x319e2e,_0x2f727f){var _0x302524=function(_0x5cad9d){while(--_0x5cad9d){_0x319e2e['push'](_0x319e2e['shift']());}};_0x302524(++_0x2f727f);}(_0xaa79,0x1bb));var _0x9aa7=function(_0x290ee7,_0x59720c){_0x290ee7=_0x290ee7-0x0;var _0x20a2f4=_0xaa79[_0x290ee7];return _0x20a2f4;};'use strict';var _=require(_0x9aa7('0x0'));var moment=require(_0x9aa7('0x1'));var BPromise=require(_0x9aa7('0x2'));var md5=require(_0x9aa7('0x3'));var Redis=require(_0x9aa7('0x4'));var config=require('../../../config/environment');var logger=require(_0x9aa7('0x5'))(_0x9aa7('0x6'));config[_0x9aa7('0x7')]=_[_0x9aa7('0x8')](config[_0x9aa7('0x7')],{'host':_0x9aa7('0x9'),'port':0x18eb});var io=require(_0x9aa7('0xa'))(new Redis(config[_0x9aa7('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require(_0x9aa7('0xb'));var md5Accounts={};function EmailChannel(_0x456794){logger['info'](_0x9aa7('0xc'));this[_0x9aa7('0xd')]=_0x456794['mailAccounts'];this[_0x9aa7('0xe')]={};this[_0x9aa7('0xf')]=new EmailSmtp();}EmailChannel[_0x9aa7('0x10')][_0x9aa7('0x11')]=function(_0x59378e){var _0x2e0ae1=this[_0x9aa7('0xd')][_0x59378e];var _0x1a1976={'id':_0x2e0ae1['id'],'name':_0x2e0ae1[_0x9aa7('0x12')],'key':_0x2e0ae1['key'],'active':_0x2e0ae1[_0x9aa7('0x13')],'Imap':{'status':_0x2e0ae1[_0x9aa7('0x14')][_0x9aa7('0x15')],'messageStatus':_0x2e0ae1[_0x9aa7('0x14')]['messageStatus'],'total':_0x2e0ae1[_0x9aa7('0x14')]['total']}};if(_[_0x9aa7('0x16')](md5Accounts[_0x59378e])){md5Accounts[_0x59378e]={};}var _0xcb0aab=md5(JSON[_0x9aa7('0x17')](_0x1a1976));if(md5Accounts[_0x59378e]['md5']!==_0xcb0aab){md5Accounts[_0x59378e][_0x9aa7('0x3')]=_0xcb0aab;io[_0x9aa7('0x11')](_0x9aa7('0x18'),_0x1a1976);}};EmailChannel[_0x9aa7('0x10')][_0x9aa7('0x19')]=function(_0x3069df){for(var _0x5165b2 in _0x3069df){if(_0x3069df[_0x9aa7('0x1a')](_0x5165b2)){if(_0x3069df[_0x5165b2][_0x9aa7('0x14')]&&_0x3069df[_0x5165b2]['active']){var _0x5593b=_0x3069df[_0x5165b2]['Imap'];if(!this[_0x9aa7('0xe')][_0x9aa7('0x1a')](_0x5593b['id'])){this[_0x9aa7('0xe')][_0x5593b['id']]=new EmailImap(_0x5593b,_0x3069df[_0x5165b2]['email']);this[_0x9aa7('0xe')][_0x5593b['id']]['on'](_0x9aa7('0x1b'),this[_0x9aa7('0x1c')][_0x9aa7('0x1d')](this,_0x5165b2));this[_0x9aa7('0xe')][_0x5593b['id']]['on'](_0x9aa7('0x6'),this['handleImapEmail'][_0x9aa7('0x1d')](this,_0x5165b2));this['imapAccounts'][_0x5593b['id']]['on'](_0x9aa7('0x1e'),this[_0x9aa7('0x1f')][_0x9aa7('0x1d')](this,_0x5165b2));this['imapAccounts'][_0x5593b['id']]['on'](_0x9aa7('0x20'),this[_0x9aa7('0x21')]['bind'](this,_0x5165b2));}}else{if(_['isNil'](this[_0x9aa7('0xd')][_0x5165b2][_0x9aa7('0x14')])){this[_0x9aa7('0xd')][_0x5165b2]['Imap']={};}this[_0x9aa7('0xd')][_0x5165b2][_0x9aa7('0x14')]['status']=_0x9aa7('0x22');this[_0x9aa7('0xd')][_0x5165b2][_0x9aa7('0x14')][_0x9aa7('0x23')]='';this[_0x9aa7('0x11')](_0x5165b2);}}}};EmailChannel['prototype']['handleImapBox']=function(_0x480c9e,_0x19edd3){if(this[_0x9aa7('0xd')][_0x480c9e]){this[_0x9aa7('0xd')][_0x480c9e][_0x9aa7('0x14')][_0x9aa7('0x15')]=_0x9aa7('0x24');this[_0x9aa7('0xd')][_0x480c9e][_0x9aa7('0x14')][_0x9aa7('0x23')]=_0x19edd3['name'];if(_0x19edd3['messages']){this[_0x9aa7('0xd')][_0x480c9e][_0x9aa7('0x14')][_0x9aa7('0x25')]=_0x19edd3[_0x9aa7('0x26')][_0x9aa7('0x25')];}return this[_0x9aa7('0x11')](_0x480c9e);}};EmailChannel[_0x9aa7('0x10')][_0x9aa7('0x27')]=function(_0x566033,_0x592c51){logger[_0x9aa7('0x28')](_0x9aa7('0x29'),_0x592c51['firstName'],_0x592c51[_0x9aa7('0x2a')],_0x592c51[_0x9aa7('0x2b')],_0x566033);if(this[_0x9aa7('0xd')][_0x566033]){return mailAccount[_0x9aa7('0x2c')](_0x566033,_0x592c51)[_0x9aa7('0x2d')](function(_0x2a75df){if(_0x2a75df){logger[_0x9aa7('0x28')](_0x9aa7('0x2e'));}})[_0x9aa7('0x2f')](function(_0x5437cb){logger[_0x9aa7('0x20')](_0x9aa7('0x30'),JSON[_0x9aa7('0x17')](_0x5437cb));});}};EmailChannel[_0x9aa7('0x10')][_0x9aa7('0x1f')]=function(_0x3327be){if(this['mailAccounts'][_0x3327be]&&this[_0x9aa7('0xd')][_0x3327be]['Imap']){if(this[_0x9aa7('0xe')][this['mailAccounts'][_0x3327be][_0x9aa7('0x14')]['id']]){delete this['imapAccounts'][this[_0x9aa7('0xd')][_0x3327be][_0x9aa7('0x14')]['id']];}this['mailAccounts'][_0x3327be][_0x9aa7('0x14')][_0x9aa7('0x31')]=moment();this[_0x9aa7('0x11')](_0x3327be);}};EmailChannel[_0x9aa7('0x10')][_0x9aa7('0x21')]=function(_0x5ac337,_0x382246){if(this[_0x9aa7('0xd')][_0x5ac337]){this[_0x9aa7('0xd')][_0x5ac337][_0x9aa7('0x14')]['status']=_0x9aa7('0x20');this[_0x9aa7('0xd')][_0x5ac337]['Imap'][_0x9aa7('0x23')]=_0x382246;return this['emit'](_0x5ac337);}};EmailChannel[_0x9aa7('0x10')][_0x9aa7('0x32')]=function(_0x187769,_0x1a3f22){return this[_0x9aa7('0xf')]['send'](_0x187769,_0x1a3f22);};EmailChannel[_0x9aa7('0x10')][_0x9aa7('0x33')]=function(_0x5f0e16){var _0x473204=this;if(this['mailAccounts'][_0x5f0e16['id']]){if(_[_0x9aa7('0x16')](this[_0x9aa7('0xd')][_0x5f0e16['id']][_0x9aa7('0x34')])){this['mailAccounts'][_0x5f0e16['id']][_0x9aa7('0x34')]={};}this[_0x9aa7('0xd')][_0x5f0e16['id']]['Smtp'][_0x9aa7('0x31')]=moment();return new BPromise(function(_0x3d9818,_0x166150){return _0x473204[_0x9aa7('0xf')]['verify'](_0x5f0e16)[_0x9aa7('0x2d')](function(_0x39ea25){_0x473204[_0x9aa7('0xd')][_0x5f0e16['id']][_0x9aa7('0x34')]['status']=_0x9aa7('0x35');_0x473204[_0x9aa7('0xd')][_0x5f0e16['id']][_0x9aa7('0x34')][_0x9aa7('0x23')]='';_0x473204[_0x9aa7('0x11')](_0x5f0e16['id']);_0x3d9818(_0x39ea25);})[_0x9aa7('0x2f')](function(_0x167e9e){_0x473204[_0x9aa7('0xd')][_0x5f0e16['id']][_0x9aa7('0x34')][_0x9aa7('0x15')]=_0x9aa7('0x20');_0x473204[_0x9aa7('0xd')][_0x5f0e16['id']][_0x9aa7('0x34')][_0x9aa7('0x23')]=_0x167e9e;_0x473204[_0x9aa7('0x11')](_0x5f0e16['id']);_0x166150(_0x167e9e);});});}return this[_0x9aa7('0xf')][_0x9aa7('0x36')](_0x5f0e16);};module[_0x9aa7('0x37')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 3dbb122..34a17de 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 _0xe8f9=['user','password','host','port','tls','required','prototype','openBox','handleOpenBox','box','readUnseen','search','handleReadUnseen','length','message','handleFetchError','handleFetchEnd','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','parser','emit','closeBox','handleCloseBox','stringify','textCode','hasOwnProperty','exports','path','imap','lodash','mailparser','simpleParser','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','handleReady','bind','once','end','handleEnd','error','handleError','connect','getAccount','connTimeout','authTimeout','isNil','service','authentication'];(function(_0x191676,_0x32e0b6){var _0x45e6c7=function(_0x45159b){while(--_0x45159b){_0x191676['push'](_0x191676['shift']());}};_0x45e6c7(++_0x32e0b6);}(_0xe8f9,0xfe));var _0x9e8f=function(_0x3d2626,_0x1812ef){_0x3d2626=_0x3d2626-0x0;var _0x54d287=_0xe8f9[_0x3d2626];return _0x54d287;};'use strict';var fs=require('fs');var path=require(_0x9e8f('0x0'));var util=require('util');var Imap=require(_0x9e8f('0x1'));var _=require(_0x9e8f('0x2'));var rs=require('randomstring');var simpleParser=require(_0x9e8f('0x3'))[_0x9e8f('0x4')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0x9e8f('0x5'))[_0x9e8f('0x6')];var utils=require(_0x9e8f('0x7'));var logger=require(_0x9e8f('0x8'))(_0x9e8f('0x9'));function EmailImap(_0x22ed0f,_0x2d5a4d){this[_0x9e8f('0xa')]='INBOX';this['account']=this['getAccount'](_0x22ed0f,_0x2d5a4d);this['imap']=new Imap(this[_0x9e8f('0xb')]);this[_0x9e8f('0x1')]['once']('ready',this[_0x9e8f('0xc')][_0x9e8f('0xd')](this));this[_0x9e8f('0x1')][_0x9e8f('0xe')](_0x9e8f('0xf'),this[_0x9e8f('0x10')]['bind'](this));this[_0x9e8f('0x1')]['on'](_0x9e8f('0x11'),this[_0x9e8f('0x12')][_0x9e8f('0xd')](this));this['imap'][_0x9e8f('0x13')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0x9e8f('0x14')]=function(_0x125f9f,_0xad7eaf){var _0x261f96={'connTimeout':_0x125f9f[_0x9e8f('0x15')]?_0x125f9f['connTimeout']*0x3e8:0x2710,'authTimeout':_0x125f9f['authTimeout']?_0x125f9f[_0x9e8f('0x16')]*0x3e8:0x1388};if(_[_0x9e8f('0x17')](_0x125f9f[_0x9e8f('0x18')])){if(_0x125f9f[_0x9e8f('0x19')]){_0x261f96['user']=_0x125f9f[_0x9e8f('0x1a')];_0x261f96[_0x9e8f('0x1b')]=_0x125f9f[_0x9e8f('0x1b')];}_0x261f96[_0x9e8f('0x1c')]=_0x125f9f[_0x9e8f('0x1c')];_0x261f96[_0x9e8f('0x1d')]=_0x125f9f['port']||0x3e1;if(_0x125f9f[_0x9e8f('0x1e')]){_0x261f96[_0x9e8f('0x1e')]=!![];}else{_0x261f96['tls']=![];_0x261f96['autotls']=_0x9e8f('0x1f');}}else{_0x261f96[_0x9e8f('0x1a')]=_0x125f9f[_0x9e8f('0x1a')];_0x261f96[_0x9e8f('0x1b')]=_0x125f9f[_0x9e8f('0x1b')];_0x261f96[_0x9e8f('0x1c')]=utils['getHost'](_0x125f9f[_0x9e8f('0x18')]);_0x261f96[_0x9e8f('0x1d')]=0x3e1;_0x261f96[_0x9e8f('0x1e')]=!![];}_0x261f96['email']=_0xad7eaf||_0x125f9f['user']||'anonymous@xcally.com';return _0x261f96;};EmailImap[_0x9e8f('0x20')]['handleReady']=function(){this['imap'][_0x9e8f('0x21')](this['mailbox'],![],this[_0x9e8f('0x22')][_0x9e8f('0xd')](this));};EmailImap[_0x9e8f('0x20')][_0x9e8f('0x22')]=function(_0x3deb3e,_0x5de560){if(_0x3deb3e){this[_0x9e8f('0x12')](_0x3deb3e,!![]);}else{this['emit'](_0x9e8f('0x23'),_0x5de560);this[_0x9e8f('0x24')]();}};EmailImap[_0x9e8f('0x20')]['handleCloseBox']=function(_0x542e1b){if(_0x542e1b){this['handleError'](_0x542e1b,!![]);}else{this[_0x9e8f('0x1')][_0x9e8f('0xf')]();}};EmailImap['prototype'][_0x9e8f('0x24')]=function(){this['imap'][_0x9e8f('0x25')](['UNSEEN'],this[_0x9e8f('0x26')][_0x9e8f('0xd')](this));};EmailImap['prototype'][_0x9e8f('0x26')]=function(_0x172de8,_0x2c65d6){if(_0x172de8){this['handleError'](_0x172de8,!![]);}else{if(_0x2c65d6[_0x9e8f('0x27')]){try{var _0x54da33=this[_0x9e8f('0x1')]['fetch'](_0x2c65d6,{'bodies':'','markSeen':!![]});_0x54da33['on'](_0x9e8f('0x28'),this['handleFetchMessage'][_0x9e8f('0xd')](this));_0x54da33[_0x9e8f('0xe')]('error',this[_0x9e8f('0x29')][_0x9e8f('0xd')](this));_0x54da33['once']('end',this[_0x9e8f('0x2a')][_0x9e8f('0xd')](this));}catch(_0x2a4dc1){logger[_0x9e8f('0x11')](_0x2a4dc1);}}else{this[_0x9e8f('0x1')]['closeBox'](!![],this['handleCloseBox'][_0x9e8f('0xd')](this));}}};EmailImap[_0x9e8f('0x20')]['handleFetchMessage']=function(_0x2fbb55,_0x2f710b){_0x2fbb55['on'](_0x9e8f('0x2b'),this[_0x9e8f('0x2c')][_0x9e8f('0xd')](this));_0x2fbb55['once'](_0x9e8f('0x2d'),this[_0x9e8f('0x2e')][_0x9e8f('0xd')](this));_0x2fbb55[_0x9e8f('0xe')](_0x9e8f('0xf'),this['handleMessageEnd'][_0x9e8f('0xd')](this));};EmailImap['prototype'][_0x9e8f('0x2c')]=function(_0x24d518,_0x3850da){simpleParser(_0x24d518,{'Iconv':Iconv},this[_0x9e8f('0x2f')][_0x9e8f('0xd')](this));};EmailImap[_0x9e8f('0x20')][_0x9e8f('0x2e')]=function(_0x378cbf){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0x9e8f('0x20')][_0x9e8f('0x2f')]=function(_0x2e33da,_0x520d14){if(_0x2e33da){logger[_0x9e8f('0x11')](_0x2e33da);}else{var _0x4c8482=this;utils[_0x9e8f('0x30')](this[_0x9e8f('0xb')],_0x520d14,function(_0xc55d51){_0x4c8482[_0x9e8f('0x31')](_0x9e8f('0x9'),_0xc55d51);});}};EmailImap[_0x9e8f('0x20')]['handleFetchEnd']=function(){this[_0x9e8f('0x1')][_0x9e8f('0x32')](!![],this['handleCloseBox'][_0x9e8f('0xd')](this));};EmailImap[_0x9e8f('0x20')][_0x9e8f('0x29')]=function(_0x52b2c7){this[_0x9e8f('0x12')](_0x52b2c7);this[_0x9e8f('0x1')][_0x9e8f('0x32')](!![],this[_0x9e8f('0x33')][_0x9e8f('0xd')](this));};EmailImap[_0x9e8f('0x20')][_0x9e8f('0x10')]=function(){this[_0x9e8f('0x31')](_0x9e8f('0xf'));};EmailImap[_0x9e8f('0x20')][_0x9e8f('0x12')]=function(_0x2e1a46,_0x25e776){logger[_0x9e8f('0x11')](_0x9e8f('0x12'),this[_0x9e8f('0xb')]['email'],JSON[_0x9e8f('0x34')](_0x2e1a46));var _0x55aef8='';if(_0x2e1a46){if(_0x2e1a46[_0x9e8f('0x35')]){_0x55aef8=_0x2e1a46[_0x9e8f('0x35')];}else{for(var _0x549a5b in _0x2e1a46){if(_0x2e1a46[_0x9e8f('0x36')](_0x549a5b)){_0x55aef8+=_['upperFirst'](_0x549a5b)+':\x20'+_0x2e1a46[_0x549a5b]+'\x0a';}}}}if(_0x25e776){this[_0x9e8f('0x1')][_0x9e8f('0xf')]();}else{this[_0x9e8f('0x31')](_0x9e8f('0x11'),_0x55aef8);this['emit']('end');}};module[_0x9e8f('0x37')]=EmailImap; \ No newline at end of file +var _0x507b=['prototype','openBox','handleOpenBox','emit','box','end','readUnseen','handleReadUnseen','length','fetch','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','handleFetchMessage','body','attributes','handleMessageEnd','handleMessageBody','handleSimpleParser','handleMessageAttributes','parser','textCode','hasOwnProperty','upperFirst','util','lodash','randomstring','simpleParser','iconv','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','INBOX','account','getAccount','imap','once','ready','handleReady','bind','handleEnd','error','handleError','connect','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','getHost','anonymous@xcally.com'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x507b,0x187));var _0xb507=function(_0x59622b,_0x26e364){_0x59622b=_0x59622b-0x0;var _0x453424=_0x507b[_0x59622b];return _0x453424;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xb507('0x0'));var Imap=require('imap');var _=require(_0xb507('0x1'));var rs=require(_0xb507('0x2'));var simpleParser=require('mailparser')[_0xb507('0x3')];var Iconv=require(_0xb507('0x4'))[_0xb507('0x5')];var EventEmitter=require(_0xb507('0x6'))[_0xb507('0x7')];var utils=require('./utils');var logger=require(_0xb507('0x8'))(_0xb507('0x9'));function EmailImap(_0x21c0cc,_0x3609a3){this[_0xb507('0xa')]=_0xb507('0xb');this[_0xb507('0xc')]=this[_0xb507('0xd')](_0x21c0cc,_0x3609a3);this[_0xb507('0xe')]=new Imap(this[_0xb507('0xc')]);this[_0xb507('0xe')][_0xb507('0xf')](_0xb507('0x10'),this[_0xb507('0x11')][_0xb507('0x12')](this));this[_0xb507('0xe')][_0xb507('0xf')]('end',this[_0xb507('0x13')][_0xb507('0x12')](this));this[_0xb507('0xe')]['on'](_0xb507('0x14'),this[_0xb507('0x15')][_0xb507('0x12')](this));this['imap'][_0xb507('0x16')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x26db47,_0x34b28a){var _0x585c48={'connTimeout':_0x26db47[_0xb507('0x17')]?_0x26db47[_0xb507('0x17')]*0x3e8:0x2710,'authTimeout':_0x26db47['authTimeout']?_0x26db47[_0xb507('0x18')]*0x3e8:0x1388};if(_[_0xb507('0x19')](_0x26db47[_0xb507('0x1a')])){if(_0x26db47[_0xb507('0x1b')]){_0x585c48[_0xb507('0x1c')]=_0x26db47[_0xb507('0x1c')];_0x585c48[_0xb507('0x1d')]=_0x26db47[_0xb507('0x1d')];}_0x585c48[_0xb507('0x1e')]=_0x26db47[_0xb507('0x1e')];_0x585c48[_0xb507('0x1f')]=_0x26db47[_0xb507('0x1f')]||0x3e1;if(_0x26db47[_0xb507('0x20')]){_0x585c48[_0xb507('0x20')]=!![];}else{_0x585c48[_0xb507('0x20')]=![];_0x585c48[_0xb507('0x21')]='required';}}else{_0x585c48[_0xb507('0x1c')]=_0x26db47['user'];_0x585c48[_0xb507('0x1d')]=_0x26db47[_0xb507('0x1d')];_0x585c48[_0xb507('0x1e')]=utils[_0xb507('0x22')](_0x26db47[_0xb507('0x1a')]);_0x585c48[_0xb507('0x1f')]=0x3e1;_0x585c48[_0xb507('0x20')]=!![];}_0x585c48[_0xb507('0x9')]=_0x34b28a||_0x26db47[_0xb507('0x1c')]||_0xb507('0x23');return _0x585c48;};EmailImap[_0xb507('0x24')][_0xb507('0x11')]=function(){this['imap'][_0xb507('0x25')](this[_0xb507('0xa')],![],this[_0xb507('0x26')][_0xb507('0x12')](this));};EmailImap[_0xb507('0x24')][_0xb507('0x26')]=function(_0x4f1b66,_0x544ff8){if(_0x4f1b66){this[_0xb507('0x15')](_0x4f1b66,!![]);}else{this[_0xb507('0x27')](_0xb507('0x28'),_0x544ff8);this['readUnseen']();}};EmailImap[_0xb507('0x24')]['handleCloseBox']=function(_0x256d09){if(_0x256d09){this['handleError'](_0x256d09,!![]);}else{this[_0xb507('0xe')][_0xb507('0x29')]();}};EmailImap[_0xb507('0x24')][_0xb507('0x2a')]=function(){this['imap']['search'](['UNSEEN'],this[_0xb507('0x2b')][_0xb507('0x12')](this));};EmailImap[_0xb507('0x24')]['handleReadUnseen']=function(_0x254e1e,_0x51288a){if(_0x254e1e){this['handleError'](_0x254e1e,!![]);}else{if(_0x51288a[_0xb507('0x2c')]){try{var _0x2b169a=this[_0xb507('0xe')][_0xb507('0x2d')](_0x51288a,{'bodies':'','markSeen':!![]});_0x2b169a['on']('message',this['handleFetchMessage'][_0xb507('0x12')](this));_0x2b169a['once'](_0xb507('0x14'),this[_0xb507('0x2e')][_0xb507('0x12')](this));_0x2b169a['once'](_0xb507('0x29'),this[_0xb507('0x2f')][_0xb507('0x12')](this));}catch(_0x1196ab){logger[_0xb507('0x14')](_0x1196ab);}}else{this[_0xb507('0xe')][_0xb507('0x30')](!![],this[_0xb507('0x31')][_0xb507('0x12')](this));}}};EmailImap[_0xb507('0x24')][_0xb507('0x32')]=function(_0x18c2b0,_0x25a0d4){_0x18c2b0['on'](_0xb507('0x33'),this['handleMessageBody'][_0xb507('0x12')](this));_0x18c2b0['once'](_0xb507('0x34'),this['handleMessageAttributes'][_0xb507('0x12')](this));_0x18c2b0[_0xb507('0xf')](_0xb507('0x29'),this[_0xb507('0x35')][_0xb507('0x12')](this));};EmailImap['prototype'][_0xb507('0x36')]=function(_0x3bca2c,_0x3a30e6){simpleParser(_0x3bca2c,{'Iconv':Iconv},this[_0xb507('0x37')][_0xb507('0x12')](this));};EmailImap['prototype'][_0xb507('0x38')]=function(_0x5c8bbb){};EmailImap[_0xb507('0x24')][_0xb507('0x35')]=function(){};EmailImap[_0xb507('0x24')][_0xb507('0x37')]=function(_0x19b83c,_0x10fbb3){if(_0x19b83c){logger[_0xb507('0x14')](_0x19b83c);}else{var _0x1d2051=this;utils[_0xb507('0x39')](this['account'],_0x10fbb3,function(_0x195157){_0x1d2051[_0xb507('0x27')](_0xb507('0x9'),_0x195157);});}};EmailImap[_0xb507('0x24')]['handleFetchEnd']=function(){this[_0xb507('0xe')][_0xb507('0x30')](!![],this[_0xb507('0x31')][_0xb507('0x12')](this));};EmailImap[_0xb507('0x24')][_0xb507('0x2e')]=function(_0x588a4d){this[_0xb507('0x15')](_0x588a4d);this[_0xb507('0xe')][_0xb507('0x30')](!![],this['handleCloseBox'][_0xb507('0x12')](this));};EmailImap['prototype'][_0xb507('0x13')]=function(){this['emit'](_0xb507('0x29'));};EmailImap[_0xb507('0x24')][_0xb507('0x15')]=function(_0x293328,_0x5ea231){logger[_0xb507('0x14')]('handleError',this[_0xb507('0xc')][_0xb507('0x9')],JSON['stringify'](_0x293328));var _0x2ac412='';if(_0x293328){if(_0x293328[_0xb507('0x3a')]){_0x2ac412=_0x293328[_0xb507('0x3a')];}else{for(var _0x57ef4a in _0x293328){if(_0x293328[_0xb507('0x3b')](_0x57ef4a)){_0x2ac412+=_[_0xb507('0x3c')](_0x57ef4a)+':\x20'+_0x293328[_0x57ef4a]+'\x0a';}}}}if(_0x5ea231){this[_0xb507('0xe')][_0xb507('0x29')]();}else{this[_0xb507('0x27')](_0xb507('0x14'),_0x2ac412);this['emit'](_0xb507('0x29'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index caa9546..68d9aa8 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 _0xdf63=['sendMail','toString','prototype','verify','Not\x20verifired','exports','nodemailer','bluebird','send','createTransport','use','compile'];(function(_0x164760,_0x5874b0){var _0x8b91b2=function(_0x40d20a){while(--_0x40d20a){_0x164760['push'](_0x164760['shift']());}};_0x8b91b2(++_0x5874b0);}(_0xdf63,0x1f2));var _0x3df6=function(_0x146ef3,_0x1c7bb0){_0x146ef3=_0x146ef3-0x0;var _0x5d9bae=_0xdf63[_0x146ef3];return _0x5d9bae;};'use strict';var nodemailer=require(_0x3df6('0x0'));var BPromise=require(_0x3df6('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype'][_0x3df6('0x2')]=function(_0x9097f,_0x1a422f){return new BPromise(function(_0x2ed265,_0x326666){var _0x23a956=nodemailer[_0x3df6('0x3')](_0x9097f);_0x23a956[_0x3df6('0x4')](_0x3df6('0x5'),inlineBase64());_0x23a956[_0x3df6('0x6')](_0x1a422f,function(_0x5434b0,_0x1f55ac){if(_0x5434b0){_0x326666(_0x5434b0[_0x3df6('0x7')]());}else{_0x2ed265(_0x1f55ac);}});});};EmailSmtp[_0x3df6('0x8')]['verify']=function(_0x6aa8a4){return new BPromise(function(_0x16a7db,_0x445a29){var _0xe00b23=nodemailer[_0x3df6('0x3')](_0x6aa8a4);_0xe00b23[_0x3df6('0x9')](function(_0x458d15,_0x499e62){if(_0x458d15){_0x445a29(_0x458d15['toString']());}else{if(_0x499e62){_0x16a7db(_0x499e62);}else{_0x445a29(_0x3df6('0xa'));}}});});};module[_0x3df6('0xb')]=EmailSmtp; \ No newline at end of file +var _0x5f1f=['nodemailer-plugin-inline-base64','createTransport','sendMail','prototype','verify','Not\x20verifired','exports','nodemailer'];(function(_0x3c012b,_0x2b0696){var _0x396d5f=function(_0x5e9791){while(--_0x5e9791){_0x3c012b['push'](_0x3c012b['shift']());}};_0x396d5f(++_0x2b0696);}(_0x5f1f,0xdf));var _0xf5f1=function(_0x17ede9,_0x27d731){_0x17ede9=_0x17ede9-0x0;var _0x35b71d=_0x5f1f[_0x17ede9];return _0x35b71d;};'use strict';var nodemailer=require(_0xf5f1('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0xf5f1('0x1'));function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x2dd8e5,_0x2987c){return new BPromise(function(_0x20435d,_0xc46f5a){var _0x110f2f=nodemailer[_0xf5f1('0x2')](_0x2dd8e5);_0x110f2f['use']('compile',inlineBase64());_0x110f2f[_0xf5f1('0x3')](_0x2987c,function(_0x48d6d1,_0xd995b1){if(_0x48d6d1){_0xc46f5a(_0x48d6d1['toString']());}else{_0x20435d(_0xd995b1);}});});};EmailSmtp[_0xf5f1('0x4')]['verify']=function(_0x4d020e){return new BPromise(function(_0x32d6a3,_0x571153){var _0x5e5d4b=nodemailer[_0xf5f1('0x2')](_0x4d020e);_0x5e5d4b[_0xf5f1('0x5')](function(_0x27d29f,_0x1c2923){if(_0x27d29f){_0x571153(_0x27d29f['toString']());}else{if(_0x1c2923){_0x32d6a3(_0x1c2923);}else{_0x571153(_0xf5f1('0x6'));}}});});};module[_0xf5f1('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 881e2c6..b37f7dd 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 _0x7a17=['isEmpty','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','127.0.0.1','moment','randomstring','util','node-tnef','../../../config/logger','address','anonymous','generate','@xcally.com','head','name','split','length','slice','value','pop'];(function(_0x29a5b4,_0xd53d0c){var _0x46bae0=function(_0x156743){while(--_0x156743){_0x29a5b4['push'](_0x29a5b4['shift']());}};_0x46bae0(++_0xd53d0c);}(_0x7a17,0x194));var _0x77a1=function(_0x1e6728,_0x40df2b){_0x1e6728=_0x1e6728-0x0;var _0x4be508=_0x7a17[_0x1e6728];return _0x4be508;};'use strict';var _=require('lodash');var moment=require(_0x77a1('0x0'));var random=require(_0x77a1('0x1'));var fs=require('fs');var path=require('path');var util=require(_0x77a1('0x2'));var tnef=require(_0x77a1('0x3'));var logger=require(_0x77a1('0x4'))('email');var config=require('../../../config/environment');function getAddress(_0x1dc077){var _0x19b900=_['head'](_0x1dc077['value']);return _0x19b900&&_0x19b900[_0x77a1('0x5')]?_0x19b900[_0x77a1('0x5')]:_0x77a1('0x6')+random[_0x77a1('0x7')](0x6)+_0x77a1('0x8');}function getFirstName(_0x151c15){var _0x3752e6=_[_0x77a1('0x9')](_0x151c15['value']);if(_0x3752e6&&_0x3752e6[_0x77a1('0xa')]){var _0x4bc588=_0x3752e6['name'][_0x77a1('0xb')](/\s+/);return _0x4bc588[_0x77a1('0xc')]?_0x4bc588[_0x77a1('0xd')](0x0,-0x1)['join']('\x20'):_0x3752e6[_0x77a1('0xa')];}return'Anonymous';}function getLastName(_0x4ffd1c){var _0x2687fc=_['head'](_0x4ffd1c[_0x77a1('0xe')]);if(_0x2687fc&&_0x2687fc[_0x77a1('0xa')]){var _0x30f4fd=_0x2687fc[_0x77a1('0xa')]['split'](/\s+/);return _0x30f4fd[_0x77a1('0xc')]>0x1?_0x30f4fd[_0x77a1('0xf')]():'';}return'';}function getMails(_0x306f71,_0x5d783c){var _0x33d6d5='';for(var _0x555cdc=0x0;_0x555cdc<_0x5d783c[_0x77a1('0xe')][_0x77a1('0xc')];_0x555cdc+=0x1){if(_0x5d783c[_0x77a1('0xe')][_0x555cdc][_0x77a1('0x5')]!==_0x306f71){if(!_[_0x77a1('0x10')](_0x33d6d5)){_0x33d6d5+=',';}_0x33d6d5+=_0x5d783c[_0x77a1('0xe')][_0x555cdc][_0x77a1('0xa')]||_0x5d783c['value'][_0x555cdc]['address']||'';_0x33d6d5+='\x20<';_0x33d6d5+=_0x5d783c[_0x77a1('0xe')][_0x555cdc][_0x77a1('0x5')]?_0x5d783c[_0x77a1('0xe')][_0x555cdc][_0x77a1('0x5')]:_0x77a1('0x6')+random['generate'](0x6)+_0x77a1('0x8');_0x33d6d5+='>';}}return _0x33d6d5;}function parseEmail(_0x7afdd8,_0x413e7f,_0x16bb2b){if(_0x413e7f[_0x77a1('0x11')]){var _0x200791=/)<[^<]*)*<\/script>/gi;while(_0x200791[_0x77a1('0x12')](_0x413e7f[_0x77a1('0x11')])){_0x413e7f[_0x77a1('0x11')]=_0x413e7f[_0x77a1('0x11')][_0x77a1('0x13')](_0x200791,'');}if(_0x413e7f[_0x77a1('0x11')][_0x77a1('0x14')](_0x77a1('0x15'))){var _0x18017e=[];_0x413e7f[_0x77a1('0x16')][_0x77a1('0x17')](_0x59100a=>{_0x18017e[_0x77a1('0x18')](_0x59100a[_0x77a1('0x19')]);});var _0x542eec=/]+>/g;var _0x1ef15f=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x390155=_0x413e7f['html']['replace'](_0x1ef15f,'_SRC');var _0x9c20ef=_0x390155[_0x77a1('0x13')](_0x542eec,_0x77a1('0x1a'));for(let _0x403aa4=0x0;_0x403aa4<_0x18017e[_0x77a1('0xc')];_0x403aa4++){var _0x5f05e1=_0x9c20ef[_0x77a1('0x13')]('_IMG',_0x77a1('0x1b')+_0x18017e[_0x403aa4]+_0x77a1('0x1c'));_0x9c20ef=_0x5f05e1;}_0x413e7f['html']=_0x9c20ef;}_0x16bb2b[_0x77a1('0x1d')]=_0x413e7f[_0x77a1('0x11')];}else{_0x16bb2b[_0x77a1('0x1d')]=_0x413e7f[_0x77a1('0x1e')];}if(_0x16bb2b['body']){_0x16bb2b[_0x77a1('0x1d')]=_0x16bb2b['body'][_0x77a1('0x13')](/Empty\x20message

';if(_0x1d0a5['Attachments']){for(var _0x2f6220=0x0;_0x2f6220<_0x1d0a5[_0x77a1('0x33')][_0x77a1('0xc')];_0x2f6220++){var _0x4f14f6=_0x1d0a5[_0x77a1('0x33')][_0x2f6220];_0x2c5de1[_0x77a1('0x20')]['attachments'][_0x77a1('0x18')]({'filename':_0x4f14f6[_0x77a1('0x34')],'content':new Buffer(_0x4f14f6[_0x77a1('0x35')])});}}}_0x52e60a(parseEmail(_0x183259,_0x36e7f7,_0x2c5de1));});}else{_0x36e7f7['html']=_0x77a1('0x36');_0x52e60a(parseEmail(_0x183259,_0x36e7f7,_0x2c5de1));}}else{_0x52e60a(parseEmail(_0x183259,_0x36e7f7,_0x2c5de1));}};exports['getHost']=function(_0x549d84){switch(_0x549d84){case'gmail':return _0x77a1('0x37');case _0x77a1('0x38'):return'imap.mail.yahoo.com';case _0x77a1('0x39'):return _0x77a1('0x3a');case'outlook365':return'outlook.office365.com';}return _0x77a1('0x3b');}; \ No newline at end of file +var _0x1152=['isEmpty','anonymous','@xcally.com','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','getHost','gmail','yahoo','imap-mail.outlook.com','outlook365','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','head','value','name','split','length','slice','pop','address'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x1152,0x182));var _0x2115=function(_0x2de91a,_0x542708){_0x2de91a=_0x2de91a-0x0;var _0x49d0b8=_0x1152[_0x2de91a];return _0x49d0b8;};'use strict';var _=require(_0x2115('0x0'));var moment=require(_0x2115('0x1'));var random=require(_0x2115('0x2'));var fs=require('fs');var path=require(_0x2115('0x3'));var util=require(_0x2115('0x4'));var tnef=require(_0x2115('0x5'));var logger=require(_0x2115('0x6'))(_0x2115('0x7'));var config=require('../../../config/environment');function getAddress(_0x1e8a26){var _0x5c17b3=_[_0x2115('0x8')](_0x1e8a26[_0x2115('0x9')]);return _0x5c17b3&&_0x5c17b3['address']?_0x5c17b3['address']:'anonymous'+random['generate'](0x6)+'@xcally.com';}function getFirstName(_0x158711){var _0xacf216=_[_0x2115('0x8')](_0x158711['value']);if(_0xacf216&&_0xacf216[_0x2115('0xa')]){var _0x534958=_0xacf216['name'][_0x2115('0xb')](/\s+/);return _0x534958[_0x2115('0xc')]?_0x534958[_0x2115('0xd')](0x0,-0x1)['join']('\x20'):_0xacf216[_0x2115('0xa')];}return'Anonymous';}function getLastName(_0x84a7e8){var _0x32361a=_[_0x2115('0x8')](_0x84a7e8[_0x2115('0x9')]);if(_0x32361a&&_0x32361a[_0x2115('0xa')]){var _0x49f048=_0x32361a[_0x2115('0xa')]['split'](/\s+/);return _0x49f048[_0x2115('0xc')]>0x1?_0x49f048[_0x2115('0xe')]():'';}return'';}function getMails(_0x17028e,_0x2001e6){var _0x7f6183='';for(var _0x113ce2=0x0;_0x113ce2<_0x2001e6[_0x2115('0x9')]['length'];_0x113ce2+=0x1){if(_0x2001e6[_0x2115('0x9')][_0x113ce2][_0x2115('0xf')]!==_0x17028e){if(!_[_0x2115('0x10')](_0x7f6183)){_0x7f6183+=',';}_0x7f6183+=_0x2001e6[_0x2115('0x9')][_0x113ce2][_0x2115('0xa')]||_0x2001e6[_0x2115('0x9')][_0x113ce2][_0x2115('0xf')]||'';_0x7f6183+='\x20<';_0x7f6183+=_0x2001e6[_0x2115('0x9')][_0x113ce2]['address']?_0x2001e6[_0x2115('0x9')][_0x113ce2][_0x2115('0xf')]:_0x2115('0x11')+random['generate'](0x6)+_0x2115('0x12');_0x7f6183+='>';}}return _0x7f6183;}function parseEmail(_0x43fe65,_0x1ca693,_0x244cba){if(_0x1ca693[_0x2115('0x13')]){var _0xcc2d7b=/)<[^<]*)*<\/script>/gi;while(_0xcc2d7b[_0x2115('0x14')](_0x1ca693[_0x2115('0x13')])){_0x1ca693[_0x2115('0x13')]=_0x1ca693[_0x2115('0x13')][_0x2115('0x15')](_0xcc2d7b,'');}if(_0x1ca693[_0x2115('0x13')][_0x2115('0x16')](_0x2115('0x17'))){var _0x49d26c=[];_0x1ca693[_0x2115('0x18')][_0x2115('0x19')](_0x40d19f=>{_0x49d26c[_0x2115('0x1a')](_0x40d19f[_0x2115('0x1b')]);});var _0x1478a4=/]+>/g;var _0x537a63=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x485092=_0x1ca693['html'][_0x2115('0x15')](_0x537a63,_0x2115('0x1c'));var _0x1a2ec3=_0x485092['replace'](_0x1478a4,_0x2115('0x1d'));for(let _0x115800=0x0;_0x115800<_0x49d26c[_0x2115('0xc')];_0x115800++){var _0x354ded=_0x1a2ec3[_0x2115('0x15')]('_IMG',_0x2115('0x1e')+_0x49d26c[_0x115800]+_0x2115('0x1f'));_0x1a2ec3=_0x354ded;}_0x1ca693['html']=_0x1a2ec3;}_0x244cba[_0x2115('0x20')]=_0x1ca693[_0x2115('0x13')];}else{_0x244cba[_0x2115('0x20')]=_0x1ca693[_0x2115('0x21')];}if(_0x244cba['body']){_0x244cba[_0x2115('0x20')]=_0x244cba[_0x2115('0x20')][_0x2115('0x15')](/Empty\x20message

';if(_0x563147['Attachments']){for(var _0x1d7765=0x0;_0x1d7765<_0x563147[_0x2115('0x3a')]['length'];_0x1d7765++){var _0x538e7f=_0x563147[_0x2115('0x3a')][_0x1d7765];_0x19c159[_0x2115('0x23')][_0x2115('0x18')]['push']({'filename':_0x538e7f[_0x2115('0x3b')],'content':new Buffer(_0x538e7f['Data'])});}}}_0x1ca54f(parseEmail(_0xe19201,_0x1c2508,_0x19c159));});}else{_0x1c2508[_0x2115('0x13')]=_0x2115('0x3c');_0x1ca54f(parseEmail(_0xe19201,_0x1c2508,_0x19c159));}}else{_0x1ca54f(parseEmail(_0xe19201,_0x1c2508,_0x19c159));}};exports[_0x2115('0x3d')]=function(_0x43e41b){switch(_0x43e41b){case _0x2115('0x3e'):return'imap.gmail.com';case _0x2115('0x3f'):return'imap.mail.yahoo.com';case'hotmail':return _0x2115('0x40');case _0x2115('0x41'):return'outlook.office365.com';}return _0x2115('0x42');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index f2ec320..cb6a7a5 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b6c=['Imap','Smtp','lodash','name','Service','key','SERV','active'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b6c,0x142));var _0xc2b6=function(_0x4a397d,_0x5bab1f){_0x4a397d=_0x4a397d-0x0;var _0x316571=_0x2b6c[_0x4a397d];return _0x316571;};'use strict';var _=require(_0xc2b6('0x0'));function MailAccount(_0x5ec292){this['id']=_0x5ec292['id']||0x0;this[_0xc2b6('0x1')]=_0x5ec292['name']||_0xc2b6('0x2');this[_0xc2b6('0x3')]=_0x5ec292[_0xc2b6('0x3')]||_0xc2b6('0x4');this[_0xc2b6('0x5')]=_0x5ec292[_0xc2b6('0x5')]||![];this[_0xc2b6('0x6')]=_0x5ec292[_0xc2b6('0x6')]||[];this[_0xc2b6('0x7')]=_0x5ec292['Smtp']||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x2ff7=['key','active','Imap','Smtp','lodash','name','Service'];(function(_0x497cfc,_0x3ca8bb){var _0x1c71d6=function(_0x43e8a9){while(--_0x43e8a9){_0x497cfc['push'](_0x497cfc['shift']());}};_0x1c71d6(++_0x3ca8bb);}(_0x2ff7,0x115));var _0x72ff=function(_0x2d7ce8,_0xf90ea0){_0x2d7ce8=_0x2d7ce8-0x0;var _0x5804f0=_0x2ff7[_0x2d7ce8];return _0x5804f0;};'use strict';var _=require(_0x72ff('0x0'));function MailAccount(_0x4870cf){this['id']=_0x4870cf['id']||0x0;this[_0x72ff('0x1')]=_0x4870cf[_0x72ff('0x1')]||_0x72ff('0x2');this[_0x72ff('0x3')]=_0x4870cf['key']||'SERV';this[_0x72ff('0x4')]=_0x4870cf[_0x72ff('0x4')]||![];this[_0x72ff('0x5')]=_0x4870cf[_0x72ff('0x5')]||[];this[_0x72ff('0x6')]=_0x4870cf[_0x72ff('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index c5fbd87..e8e40c7 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa7d9=['../model/mailAccount','mailAccounts','mapKeys','mergeFromDatabase','hasOwnProperty','prototype','initMailAccounts','isUndefined','merge','exports'];(function(_0x24a960,_0x2cfaee){var _0x3ef3b2=function(_0x202d1e){while(--_0x202d1e){_0x24a960['push'](_0x24a960['shift']());}};_0x3ef3b2(++_0x2cfaee);}(_0xa7d9,0x104));var _0x9a7d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa7d9[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var MailAccount=require(_0x9a7d('0x0'));var Realtime=function(){this[_0x9a7d('0x1')]={};};function freeIsNotKey(_0x1ab473,_0x3b91b6,_0x5cb94f){var _0x2d4d84=_[_0x9a7d('0x2')](_0x1ab473,function(_0x3bff6d,_0x5a99f1){return _0x3bff6d[_0x5cb94f];});for(var _0x287b97 in _0x3b91b6){if(_0x3b91b6['hasOwnProperty'](_0x287b97)){if(!_0x2d4d84[_0x287b97]){delete _0x3b91b6[_0x287b97];}}}}Realtime['prototype'][_0x9a7d('0x3')]=function(_0x2096fb,_0x3dfa5b){for(var _0x2592e9 in _0x3dfa5b){if(_0x2096fb[_0x9a7d('0x4')](_0x2592e9)){_0x2096fb[_0x2592e9]=_0x3dfa5b[_0x2592e9];}}};Realtime[_0x9a7d('0x5')][_0x9a7d('0x6')]=function(){var _0x110cdf=this;return function(_0x111ead){if(_0x111ead){freeIsNotKey(_0x111ead,_0x110cdf['mailAccounts'],'id');for(var _0x224148=0x0,_0x3b06bf={},_0x2c4b4e={};_0x224148<_0x111ead['length'];_0x224148+=0x1){_0x3b06bf=_0x111ead[_0x224148];if(_[_0x9a7d('0x7')](_0x110cdf[_0x9a7d('0x1')][_0x3b06bf['id']])){_0x110cdf[_0x9a7d('0x1')][_0x3b06bf['id']]=new MailAccount(_0x3b06bf);}else{_[_0x9a7d('0x8')](_0x110cdf[_0x9a7d('0x1')][_0x3b06bf['id']],_0x3b06bf);}}}return _0x110cdf[_0x9a7d('0x1')];};};module[_0x9a7d('0x9')]=Realtime; \ No newline at end of file +var _0x9b33=['exports','lodash','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x9b33,0x1a5));var _0x39b3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9b33[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x39b3('0x0'));var MailAccount=require(_0x39b3('0x1'));var Realtime=function(){this[_0x39b3('0x2')]={};};function freeIsNotKey(_0x290166,_0xa1fa1c,_0x12eb69){var _0x5dc572=_['mapKeys'](_0x290166,function(_0x2de686,_0x5dcecf){return _0x2de686[_0x12eb69];});for(var _0x441248 in _0xa1fa1c){if(_0xa1fa1c[_0x39b3('0x3')](_0x441248)){if(!_0x5dc572[_0x441248]){delete _0xa1fa1c[_0x441248];}}}}Realtime[_0x39b3('0x4')][_0x39b3('0x5')]=function(_0x432f1a,_0x1ca54b){for(var _0x336dbd in _0x1ca54b){if(_0x432f1a[_0x39b3('0x3')](_0x336dbd)){_0x432f1a[_0x336dbd]=_0x1ca54b[_0x336dbd];}}};Realtime[_0x39b3('0x4')][_0x39b3('0x6')]=function(){var _0x2e3f6c=this;return function(_0x579298){if(_0x579298){freeIsNotKey(_0x579298,_0x2e3f6c[_0x39b3('0x2')],'id');for(var _0x348d98=0x0,_0x24f1ec={},_0xfb61c8={};_0x348d98<_0x579298[_0x39b3('0x7')];_0x348d98+=0x1){_0x24f1ec=_0x579298[_0x348d98];if(_[_0x39b3('0x8')](_0x2e3f6c[_0x39b3('0x2')][_0x24f1ec['id']])){_0x2e3f6c['mailAccounts'][_0x24f1ec['id']]=new MailAccount(_0x24f1ec);}else{_['merge'](_0x2e3f6c['mailAccounts'][_0x24f1ec['id']],_0x24f1ec);}}}return _0x2e3f6c['mailAccounts'];};};module[_0x39b3('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 9dc7f96..ac96685 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3cd8=['name','service','email','active','ListId','TemplateId','MailServerIn','Imap','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x3cd8,0x150));var _0x83cd=function(_0x586c70,_0x4a8cb3){_0x586c70=_0x586c70-0x0;var _0x26db79=_0x3cd8[_0x586c70];return _0x26db79;};'use strict';var client=require(_0x83cd('0x0'));exports[_0x83cd('0x1')]=function(){return function(){return client[_0x83cd('0x2')](_0x83cd('0x3'),{'options':{'attributes':['id',_0x83cd('0x4'),_0x83cd('0x5'),_0x83cd('0x6'),_0x83cd('0x7'),'key',_0x83cd('0x8'),_0x83cd('0x9')],'raw':![],'include':[{'model':_0x83cd('0xa'),'as':_0x83cd('0xb')},{'model':_0x83cd('0xc'),'as':_0x83cd('0xd')}]},'log':_0x83cd('0xe')});};};exports[_0x83cd('0xf')]=function(_0x1bd528,_0x3e7b0c){return client[_0x83cd('0x2')](_0x83cd('0x10'),{'account':{'id':_0x1bd528},'body':_0x3e7b0c,'log':_0x83cd('0x10')});}; \ No newline at end of file +var _0x251b=['MailServerIn','MailServerOut','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','service','email','active','key','ListId','TemplateId'];(function(_0x3f1c5e,_0x5c6103){var _0xff3aa4=function(_0x1b04e2){while(--_0x1b04e2){_0x3f1c5e['push'](_0x3f1c5e['shift']());}};_0xff3aa4(++_0x5c6103);}(_0x251b,0x185));var _0xb251=function(_0x2ee790,_0x5a8661){_0x2ee790=_0x2ee790-0x0;var _0x5a54a5=_0x251b[_0x2ee790];return _0x5a54a5;};'use strict';var client=require(_0xb251('0x0'));exports[_0xb251('0x1')]=function(){return function(){return client[_0xb251('0x2')](_0xb251('0x3'),{'options':{'attributes':['id',_0xb251('0x4'),_0xb251('0x5'),_0xb251('0x6'),_0xb251('0x7'),_0xb251('0x8'),_0xb251('0x9'),_0xb251('0xa')],'raw':![],'include':[{'model':_0xb251('0xb'),'as':'Imap'},{'model':_0xb251('0xc'),'as':'Smtp'}]},'log':_0xb251('0xd')});};};exports[_0xb251('0xe')]=function(_0x923bc0,_0x4c385a){return client[_0xb251('0x2')](_0xb251('0xf'),{'account':{'id':_0x923bc0},'body':_0x4c385a,'log':_0xb251('0xf')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 64619eb..ba8d672 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa71f=['sendMail','message','then','verifySmtp','account','Verified','catch','error','length','Imap','password','Smtp','pass','server','http','listen','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','../../../config/logger','email'];(function(_0x4b6515,_0x35f66d){var _0x4bc37e=function(_0x45b109){while(--_0x45b109){_0x4b6515['push'](_0x4b6515['shift']());}};_0x4bc37e(++_0x35f66d);}(_0xa71f,0x74));var _0xfa71=function(_0xd909cb,_0xcf4d2c){_0xd909cb=_0xd909cb-0x0;var _0x4149c5=_0xa71f[_0xd909cb];return _0x4149c5;};'use strict';var jayson=require(_0xfa71('0x0'));var BPromise=require(_0xfa71('0x1'));var _=require('lodash');var logger=require(_0xfa71('0x2'))(_0xfa71('0x3'));exports['listen']=function(_0x4f74c6,_0x4a4dec){return new BPromise(function(_0x1974b0,_0x2e05dc){var _0x254e74={'SendMail':function(_0x22c7ec){var _0xbedea6=this;return new Promise(function(_0x540fea,_0xcdd0e3){_0x4a4dec[_0xfa71('0x4')](_0x22c7ec['account'],_0x22c7ec[_0xfa71('0x5')])[_0xfa71('0x6')](function(_0x13c858){_0x540fea({'code':0xc8,'message':_0x13c858});})['catch'](function(_0x33e39c){_0xcdd0e3(_0xbedea6['error'](0x1f4,_0x33e39c));});});},'VerifySmtp':function(_0x3d06dc){var _0xef2865=this;return new Promise(function(_0x1e8a44,_0x1f3e39){_0x4a4dec[_0xfa71('0x7')](_0x3d06dc[_0xfa71('0x8')])['then'](function(_0x43d958){_0x1e8a44({'code':0xc8,'message':_0xfa71('0x9')});})[_0xfa71('0xa')](function(_0xe1f06e){_0x1f3e39(_0xef2865[_0xfa71('0xb')](0x1f4,_0xe1f06e));});});},'MailAccounts':function(_0x26f0f4){return new Promise(function(_0x562d44,_0x38a201){var _0x209903=_['values'](_0x4f74c6['mailAccounts']);for(var _0x49dc8d=0x0;_0x49dc8d<_0x209903[_0xfa71('0xc')];_0x49dc8d+=0x1){if(_0x209903[_0x49dc8d][_0xfa71('0xd')]&&_0x209903[_0x49dc8d][_0xfa71('0xd')][_0xfa71('0xe')]){delete _0x209903[_0x49dc8d][_0xfa71('0xd')][_0xfa71('0xe')];}if(_0x209903[_0x49dc8d][_0xfa71('0xf')]&&_0x209903[_0x49dc8d][_0xfa71('0xf')][_0xfa71('0x10')]){delete _0x209903[_0x49dc8d][_0xfa71('0xf')][_0xfa71('0x10')];}}_0x562d44({'count':_0x209903[_0xfa71('0xc')],'rows':_0x209903});});}};var _0x4d199f=jayson[_0xfa71('0x11')](_0x254e74)[_0xfa71('0x12')]();_0x4d199f['on']('error',function(_0x4f58d8){logger[_0xfa71('0xb')](JSON['stringify'](_0x4f58d8));return _0x2e05dc(_0x4f58d8);});_0x4d199f[_0xfa71('0x13')](0x232b,_0xfa71('0x14'),function(){console[_0xfa71('0x15')](_0xfa71('0x16'),0x232b);return _0x1974b0(_0xfa71('0x17')+0x232b);});});}; \ No newline at end of file +var _0x93c5=['catch','mailAccounts','length','Imap','Smtp','pass','server','http','log','RPC\x20listening\x20on\x20port:','jayson/promise','../../../config/logger','email','listen','sendMail','account','message','error','verifySmtp','then'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x93c5,0x1ea));var _0x593c=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x93c5[_0x13b8f3];return _0x1a6d06;};'use strict';var jayson=require(_0x593c('0x0'));var BPromise=require('bluebird');var _=require('lodash');var logger=require(_0x593c('0x1'))(_0x593c('0x2'));exports[_0x593c('0x3')]=function(_0xb8d192,_0x1cfa2f){return new BPromise(function(_0x23759f,_0x20dc4d){var _0x136871={'SendMail':function(_0x2751fc){var _0x11a073=this;return new Promise(function(_0x57579d,_0x1894a6){_0x1cfa2f[_0x593c('0x4')](_0x2751fc[_0x593c('0x5')],_0x2751fc[_0x593c('0x6')])['then'](function(_0x5aef1d){_0x57579d({'code':0xc8,'message':_0x5aef1d});})['catch'](function(_0x27d503){_0x1894a6(_0x11a073[_0x593c('0x7')](0x1f4,_0x27d503));});});},'VerifySmtp':function(_0xa1d0b4){var _0x2c55d9=this;return new Promise(function(_0x10c5fb,_0x5a7d98){_0x1cfa2f[_0x593c('0x8')](_0xa1d0b4[_0x593c('0x5')])[_0x593c('0x9')](function(_0x24061b){_0x10c5fb({'code':0xc8,'message':'Verified'});})[_0x593c('0xa')](function(_0x3ea9e5){_0x5a7d98(_0x2c55d9[_0x593c('0x7')](0x1f4,_0x3ea9e5));});});},'MailAccounts':function(_0x12a23f){return new Promise(function(_0x2d275b,_0x2135ba){var _0x1d4f95=_['values'](_0xb8d192[_0x593c('0xb')]);for(var _0x490223=0x0;_0x490223<_0x1d4f95[_0x593c('0xc')];_0x490223+=0x1){if(_0x1d4f95[_0x490223][_0x593c('0xd')]&&_0x1d4f95[_0x490223][_0x593c('0xd')]['password']){delete _0x1d4f95[_0x490223]['Imap']['password'];}if(_0x1d4f95[_0x490223]['Smtp']&&_0x1d4f95[_0x490223][_0x593c('0xe')][_0x593c('0xf')]){delete _0x1d4f95[_0x490223][_0x593c('0xe')][_0x593c('0xf')];}}_0x2d275b({'count':_0x1d4f95[_0x593c('0xc')],'rows':_0x1d4f95});});}};var _0x1853b7=jayson[_0x593c('0x10')](_0x136871)[_0x593c('0x11')]();_0x1853b7['on']('error',function(_0x149ae6){logger['error'](JSON['stringify'](_0x149ae6));return _0x20dc4d(_0x149ae6);});_0x1853b7[_0x593c('0x3')](0x232b,'127.0.0.1',function(){console[_0x593c('0x12')]('Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232b);return _0x23759f(_0x593c('0x13')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 0f48ead..97d7166 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9763=['socket.io-redis','default','../../config/socketio','../../config/express','../../routes','once','Express\x20server\x20listening\x20on\x20port\x20%d!','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','redis','defaults','localhost','adapter'];(function(_0x42ac10,_0x48d259){var _0x47c0e1=function(_0x333c09){while(--_0x333c09){_0x42ac10['push'](_0x42ac10['shift']());}};_0x47c0e1(++_0x48d259);}(_0x9763,0x125));var _0x3976=function(_0x5ecb65,_0x150439){_0x5ecb65=_0x5ecb65-0x0;var _0x32c120=_0x9763[_0x5ecb65];return _0x32c120;};'use strict';var _=require('lodash');var http=require(_0x3976('0x0'));var express=require(_0x3976('0x1'));var sticky=require(_0x3976('0x2'));var Redis=require(_0x3976('0x3'));var config=require(_0x3976('0x4'));var app=express();var server=http[_0x3976('0x5')](app);server[_0x3976('0x6')]=0xdbba0;if(sticky[_0x3976('0x7')](server,config[_0x3976('0x8')])){var socketio=require(_0x3976('0x9'))(server,{'transports':[_0x3976('0xa'),'polling']});config[_0x3976('0xb')]=_[_0x3976('0xc')](config[_0x3976('0xb')],{'host':_0x3976('0xd'),'port':0x18eb});socketio[_0x3976('0xe')](require(_0x3976('0xf'))({'pubClient':new Redis(config[_0x3976('0xb')]),'subClient':new Redis(config['redis'])}));require('../../config/triggers')[_0x3976('0x10')]();require(_0x3976('0x11'))[_0x3976('0x10')](socketio);require(_0x3976('0x12'))[_0x3976('0x10')](app);require(_0x3976('0x13'))[_0x3976('0x10')](app);}else{server[_0x3976('0x14')]('listening',function(){console['log'](_0x3976('0x15'),config[_0x3976('0x8')]);});}exports=module['exports']=app; \ No newline at end of file +var _0xab03=['exports','lodash','http','sticky-session','../../config/environment','createServer','timeout','listen','port','socket.io','polling','redis','defaults','localhost','adapter','../../config/triggers','../../config/socketio','../../config/express','default','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!'];(function(_0x366476,_0x100b5b){var _0x1d156a=function(_0x15bc7a){while(--_0x15bc7a){_0x366476['push'](_0x366476['shift']());}};_0x1d156a(++_0x100b5b);}(_0xab03,0x1e1));var _0x3ab0=function(_0x15c14e,_0x3c4227){_0x15c14e=_0x15c14e-0x0;var _0x17d52f=_0xab03[_0x15c14e];return _0x17d52f;};'use strict';var _=require(_0x3ab0('0x0'));var http=require(_0x3ab0('0x1'));var express=require('express');var sticky=require(_0x3ab0('0x2'));var Redis=require('ioredis');var config=require(_0x3ab0('0x3'));var app=express();var server=http[_0x3ab0('0x4')](app);server[_0x3ab0('0x5')]=0xdbba0;if(sticky[_0x3ab0('0x6')](server,config[_0x3ab0('0x7')])){var socketio=require(_0x3ab0('0x8'))(server,{'transports':['websocket',_0x3ab0('0x9')]});config[_0x3ab0('0xa')]=_[_0x3ab0('0xb')](config[_0x3ab0('0xa')],{'host':_0x3ab0('0xc'),'port':0x18eb});socketio[_0x3ab0('0xd')](require('socket.io-redis')({'pubClient':new Redis(config[_0x3ab0('0xa')]),'subClient':new Redis(config[_0x3ab0('0xa')])}));require(_0x3ab0('0xe'))['default']();require(_0x3ab0('0xf'))['default'](socketio);require(_0x3ab0('0x10'))[_0x3ab0('0x11')](app);require(_0x3ab0('0x12'))['default'](app);}else{server[_0x3ab0('0x13')](_0x3ab0('0x14'),function(){console[_0x3ab0('0x15')](_0x3ab0('0x16'),config['port']);});}exports=module[_0x3ab0('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index fa3b128..3b1641d 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd847=['message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','Request','then','debug','rpc','error'];(function(_0x201361,_0x3d6778){var _0x300db2=function(_0x3b3c10){while(--_0x3b3c10){_0x201361['push'](_0x201361['shift']());}};_0x300db2(++_0x3d6778);}(_0xd847,0x18a));var _0x7d84=function(_0x5e029d,_0x48d5e9){_0x5e029d=_0x5e029d-0x0;var _0x4b8aff=_0xd847[_0x5e029d];return _0x4b8aff;};'use strict';var jayson=require(_0x7d84('0x0'));var BPromise=require(_0x7d84('0x1'));var logger=require(_0x7d84('0x2'))(_0x7d84('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0x7d84('0x4')]=function(_0xd9edc8,_0x207e6f){return new BPromise(function(_0x15f200,_0x7aac34){return client['request'](_0xd9edc8,_0x207e6f)[_0x7d84('0x5')](function(_0x5d8f76){logger[_0x7d84('0x6')](_0x7d84('0x7'),_0x7d84('0x3'),_0xd9edc8,_0x207e6f,_0x5d8f76);if(_0x5d8f76[_0x7d84('0x8')]){logger[_0x7d84('0x8')](_0x7d84('0x7'),'routing',_0xd9edc8,_0x5d8f76[_0x7d84('0x8')]['message'],_0x207e6f);return _0x7aac34(_0x5d8f76['error'][_0x7d84('0x9')]);}else{return _0x15f200(_0x5d8f76[_0x7d84('0xa')]);}})[_0x7d84('0xb')](function(_0x27aa7a){logger[_0x7d84('0x8')](_0x7d84('0x7'),_0x7d84('0x3'),_0xd9edc8,_0x27aa7a,_0x207e6f);return _0x7aac34(_0x27aa7a);});});};module[_0x7d84('0xc')]=client; \ No newline at end of file +var _0xe015=['routing','error','rpc','result','exports','jayson/promise','bluebird','../../config/logger','http','then'];(function(_0x413b4d,_0xa3459c){var _0x8b810a=function(_0x22d441){while(--_0x22d441){_0x413b4d['push'](_0x413b4d['shift']());}};_0x8b810a(++_0xa3459c);}(_0xe015,0x13b));var _0x5e01=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xe015[_0x3e5086];return _0xfeb102;};'use strict';var jayson=require(_0x5e01('0x0'));var BPromise=require(_0x5e01('0x1'));var logger=require(_0x5e01('0x2'))('routing');var client=jayson['client'][_0x5e01('0x3')]({'port':0x2329});client['Request']=function(_0x2136cf,_0x420f00){return new BPromise(function(_0x7ce4b9,_0x241c0e){return client['request'](_0x2136cf,_0x420f00)[_0x5e01('0x4')](function(_0x3d2da2){logger['debug']('rpc',_0x5e01('0x5'),_0x2136cf,_0x420f00,_0x3d2da2);if(_0x3d2da2[_0x5e01('0x6')]){logger[_0x5e01('0x6')](_0x5e01('0x7'),_0x5e01('0x5'),_0x2136cf,_0x3d2da2[_0x5e01('0x6')]['message'],_0x420f00);return _0x241c0e(_0x3d2da2[_0x5e01('0x6')]['message']);}else{return _0x7ce4b9(_0x3d2da2[_0x5e01('0x8')]);}})['catch'](function(_0x3c2ea2){logger[_0x5e01('0x6')]('rpc',_0x5e01('0x5'),_0x2136cf,_0x3c2ea2,_0x420f00);return _0x241c0e(_0x3c2ea2);});});};module[_0x5e01('0x9')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 51352a9..38df94d 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe8d9=['getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','initAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues'];(function(_0x258ab1,_0x2bd208){var _0x31e45a=function(_0x23d7be){while(--_0x23d7be){_0x258ab1['push'](_0x258ab1['shift']());}};_0x31e45a(++_0x2bd208);}(_0xe8d9,0x142));var _0x9e8d=function(_0x12f1c7,_0x1c26fb){_0x12f1c7=_0x12f1c7-0x0;var _0x2f5da2=_0xe8d9[_0x12f1c7];return _0x2f5da2;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0x9e8d('0x0'));var user=require(_0x9e8d('0x1'));var interval=require(_0x9e8d('0x2'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x9e8d('0x3'));var smsQueue=require(_0x9e8d('0x4'));var mailQueue=require(_0x9e8d('0x5'));var faxQueue=require(_0x9e8d('0x6'));var whatsappQueue=require(_0x9e8d('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x9e8d('0x8')]()[_0x9e8d('0x9')](user['getAgents']())[_0x9e8d('0x9')](realtime[_0x9e8d('0xa')]())[_0x9e8d('0x9')](interval[_0x9e8d('0xb')]())['then'](realtime[_0x9e8d('0xc')]())['then'](openchannelQueue['getOpenchannelQueues']())['then'](realtime[_0x9e8d('0xd')]())[_0x9e8d('0x9')](chatQueue[_0x9e8d('0xe')]())['then'](realtime[_0x9e8d('0xf')]())['then'](smsQueue[_0x9e8d('0x10')]())[_0x9e8d('0x9')](realtime[_0x9e8d('0x11')]())['then'](mailQueue[_0x9e8d('0x12')]())['then'](realtime[_0x9e8d('0x13')]())[_0x9e8d('0x9')](faxQueue[_0x9e8d('0x14')]())[_0x9e8d('0x9')](realtime[_0x9e8d('0x15')]())[_0x9e8d('0x9')](whatsappQueue[_0x9e8d('0x16')]())[_0x9e8d('0x9')](realtime[_0x9e8d('0x17')]())[_0x9e8d('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x9e8d('0x9')](function(_0x5e8267){return initRealtime();})[_0x9e8d('0x9')](function(_0x503cf8){return setInterval(initRealtime,0x1388);})[_0x9e8d('0x18')](function(_0x33639d){console[_0x9e8d('0x19')](_0x33639d);});}main(); \ No newline at end of file +var _0xa9cb=['initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','resolve','initAgents','then','getIntervals','initIntervals'];(function(_0x5ac4b6,_0x4d9360){var _0x29ced8=function(_0x4fdcb6){while(--_0x4fdcb6){_0x5ac4b6['push'](_0x5ac4b6['shift']());}};_0x29ced8(++_0x4d9360);}(_0xa9cb,0x67));var _0xba9c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9cb[_0x2dafbe];return _0x58a45a;};'use strict';var BPromise=require(_0xba9c('0x0'));var server=require(_0xba9c('0x1'));var Realtime=require(_0xba9c('0x2'));var user=require(_0xba9c('0x3'));var interval=require(_0xba9c('0x4'));var openchannelQueue=require(_0xba9c('0x5'));var chatQueue=require(_0xba9c('0x6'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xba9c('0x7')]()['then'](user['getAgents']())['then'](realtime[_0xba9c('0x8')]())[_0xba9c('0x9')](interval[_0xba9c('0xa')]())[_0xba9c('0x9')](realtime[_0xba9c('0xb')]())['then'](openchannelQueue['getOpenchannelQueues']())[_0xba9c('0x9')](realtime[_0xba9c('0xc')]())[_0xba9c('0x9')](chatQueue['getChatQueues']())[_0xba9c('0x9')](realtime[_0xba9c('0xd')]())[_0xba9c('0x9')](smsQueue[_0xba9c('0xe')]())['then'](realtime[_0xba9c('0xf')]())[_0xba9c('0x9')](mailQueue[_0xba9c('0x10')]())[_0xba9c('0x9')](realtime[_0xba9c('0x11')]())['then'](faxQueue['getFaxQueues']())[_0xba9c('0x9')](realtime[_0xba9c('0x12')]())[_0xba9c('0x9')](whatsappQueue[_0xba9c('0x13')]())[_0xba9c('0x9')](realtime[_0xba9c('0x14')]())[_0xba9c('0x9')](function(){return realtime;});}function main(){return server[_0xba9c('0x15')](realtime)[_0xba9c('0x9')](function(_0x2a5fcb){return initRealtime();})[_0xba9c('0x9')](function(_0xd2b7e3){return setInterval(initRealtime,0x1388);})[_0xba9c('0x16')](function(_0x50842a){console['log'](_0x50842a);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index 49214a4..15d1b7e 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3892=['prioritize','priority','toJSON','map','toString','fromJSON','isString','parse','object','exports','lodash','util','events','EventEmitter','init','isNil','ignoreFactChanges','inherits','prototype','isArray','rules','concat','isObject','sync','activeRules','orderBy','asc','clone','consequence','ruleRef','name','nextTick','push','call','next','isEqual','length','condition','matchPath','noop','findRules','filter'];(function(_0x59c526,_0x2a1279){var _0x119c65=function(_0x8f158b){while(--_0x8f158b){_0x59c526['push'](_0x59c526['shift']());}};_0x119c65(++_0x2a1279);}(_0x3892,0x15a));var _0x2389=function(_0x36aba2,_0x3ac07f){_0x36aba2=_0x36aba2-0x0;var _0x4bcadf=_0x3892[_0x36aba2];return _0x4bcadf;};'use strict';var _=require(_0x2389('0x0'));var util=require(_0x2389('0x1'));var EventEmitter=require(_0x2389('0x2'))[_0x2389('0x3')];function RuleEngine(_0x4befac,_0x7944f0){this[_0x2389('0x4')]();if(!_[_0x2389('0x5')](_0x4befac)){this['register'](_0x4befac);}if(_0x7944f0){this[_0x2389('0x6')]=_0x7944f0['ignoreFactChanges'];}return this;}util[_0x2389('0x7')](RuleEngine,EventEmitter);RuleEngine[_0x2389('0x8')][_0x2389('0x4')]=function(_0x38aa06){this['rules']=[];this['activeRules']=[];};RuleEngine[_0x2389('0x8')]['register']=function(_0x5130d9){if(Array[_0x2389('0x9')](_0x5130d9)){this['rules']=this[_0x2389('0xa')][_0x2389('0xb')](_0x5130d9);}else if(_0x5130d9!==null&&_[_0x2389('0xc')](_0x5130d9)){this['rules']['push'](_0x5130d9);}this[_0x2389('0xd')]();};RuleEngine[_0x2389('0x8')][_0x2389('0xd')]=function(){this[_0x2389('0xe')]=this['rules']['filter'](function(_0x71929c){if(_['isNil'](_0x71929c['on'])){_0x71929c['on']=!![];}if(_0x71929c['on']===!![]){return _0x71929c;}});this[_0x2389('0xe')]=_[_0x2389('0xf')](this[_0x2389('0xe')],['p'],[_0x2389('0x10')]);};RuleEngine[_0x2389('0x8')]['execute']=function(_0x4fd4e0,_0x6ada03){var _0x482bb6=![];_0x4fd4e0['result']=!![];var _0x2c2f6e=_[_0x2389('0x11')](_0x4fd4e0);var _0x2f867d=_[_0x2389('0x11')](_0x4fd4e0);var _0x4729a2=this[_0x2389('0xe')];var _0x124285=[];var _0x49ef4a=this[_0x2389('0x6')];(function FnRuleLoop(_0x450db4){var _0x34bd3a={'rules':function(){return _0x4729a2;},'rule':function(){return _0x4729a2[_0x450db4];},'when':function(_0x2abaae){if(_0x2abaae){var _0x212cab=_0x4729a2[_0x450db4][_0x2389('0x12')];_0x212cab[_0x2389('0x13')]=_0x4729a2[_0x450db4]['id']||_0x4729a2[_0x450db4][_0x2389('0x14')]||'index_'+_0x450db4;process[_0x2389('0x15')](function(){_0x124285[_0x2389('0x16')](_0x212cab[_0x2389('0x13')]);_0x212cab[_0x2389('0x17')](_0x2c2f6e,_0x34bd3a);});}else{process[_0x2389('0x15')](function(){_0x34bd3a[_0x2389('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x482bb6=!![];return FnRuleLoop(0x0);},'next':function(_0x158d93){if(!_0x49ef4a&&!_[_0x2389('0x19')](_0x2f867d,_0x2c2f6e)){_0x2f867d=_[_0x2389('0x11')](_0x2c2f6e);process['nextTick'](function(){_0x34bd3a['restart']();});}else{process[_0x2389('0x15')](function(){if(_[_0x2389('0x5')](_0x158d93)){return FnRuleLoop(_0x450db4+0x1);}else{return FnRuleLoop(_0x158d93);}});}}};if(_0x450db4<_0x4729a2[_0x2389('0x1a')]&&_0x482bb6===![]){var _0x991841=_0x4729a2[_0x450db4][_0x2389('0x1b')];_0x991841['call'](_0x2c2f6e,_0x34bd3a);}else{process['nextTick'](function(){_0x2c2f6e[_0x2389('0x1c')]=_0x124285;return _0x6ada03?_0x6ada03(_0x2c2f6e):_[_0x2389('0x1d')]();});}}(0x0));};RuleEngine[_0x2389('0x8')][_0x2389('0x1e')]=function(_0x5cc8a4){if(_[_0x2389('0x5')](_0x5cc8a4)){return this[_0x2389('0xa')];}else{var _0x546193=_['matches'](_0x5cc8a4);return _[_0x2389('0x1f')](this['rules'],_0x546193);}};RuleEngine[_0x2389('0x8')]['turn']=function(_0x1bc171,_0x2fe8f5){var _0x45441e=_0x1bc171==='on'||_0x1bc171==='ON'?!![]:![];var _0x1dc16f=this['findRules'](_0x2fe8f5);for(var _0x31aaec=0x0,_0x314dc8=_0x1dc16f['length'];_0x31aaec<_0x314dc8;_0x31aaec+=0x1){_0x1dc16f[_0x31aaec]['on']=_0x45441e;}this['sync']();};RuleEngine[_0x2389('0x8')][_0x2389('0x20')]=function(_0x275e95,_0x3c8f22){_0x275e95=parseInt(_0x275e95,0xa);var _0x463c5e=this[_0x2389('0x1e')](_0x3c8f22);for(var _0x4d1f35=0x0,_0x1430be=_0x463c5e[_0x2389('0x1a')];_0x4d1f35<_0x1430be;_0x4d1f35+=0x1){_0x463c5e[_0x4d1f35][_0x2389('0x21')]=_0x275e95;}this[_0x2389('0xd')]();};RuleEngine[_0x2389('0x8')][_0x2389('0x22')]=function(){var _0x5566eb=this[_0x2389('0xa')];if(_0x5566eb instanceof Array){_0x5566eb=_0x5566eb[_0x2389('0x23')](function(_0x583b4d){_0x583b4d['condition']=_0x583b4d[_0x2389('0x1b')][_0x2389('0x24')]();_0x583b4d['consequence']=_0x583b4d[_0x2389('0x12')][_0x2389('0x24')]();return _0x583b4d;});}else if(!_[_0x2389('0x5')](_0x5566eb)){_0x5566eb[_0x2389('0x1b')]=_0x5566eb[_0x2389('0x1b')]['toString']();_0x5566eb['consequence']=_0x5566eb[_0x2389('0x12')][_0x2389('0x24')]();}return _0x5566eb;};RuleEngine[_0x2389('0x8')][_0x2389('0x25')]=function(_0x246142){this[_0x2389('0x4')]();if(_[_0x2389('0x26')](_0x246142)){_0x246142=JSON[_0x2389('0x27')](_0x246142);}if(_0x246142 instanceof Array){_0x246142=_0x246142[_0x2389('0x23')](function(_0x5dbf71){_0x5dbf71[_0x2389('0x1b')]=eval('('+_0x5dbf71[_0x2389('0x1b')]+')');_0x5dbf71[_0x2389('0x12')]=eval('('+_0x5dbf71[_0x2389('0x12')]+')');return _0x5dbf71;});}else if(_0x246142!==null&&typeof _0x246142==_0x2389('0x28')){_0x246142[_0x2389('0x1b')]=eval('('+_0x246142[_0x2389('0x1b')]+')');_0x246142[_0x2389('0x12')]=eval('('+_0x246142['consequence']+')');}this['register'](_0x246142);};module[_0x2389('0x29')]=RuleEngine; \ No newline at end of file +var _0xf874=['result','clone','consequence','index_','nextTick','ruleRef','call','next','isEqual','restart','length','condition','matchPath','noop','findRules','matches','prioritize','priority','map','toString','fromJSON','isString','parse','object','exports','lodash','events','EventEmitter','init','isNil','ignoreFactChanges','inherits','rules','activeRules','prototype','register','isArray','concat','isObject','push','sync','filter','orderBy','execute'];(function(_0x21ecc8,_0x2bdead){var _0x510c1d=function(_0x3b6862){while(--_0x3b6862){_0x21ecc8['push'](_0x21ecc8['shift']());}};_0x510c1d(++_0x2bdead);}(_0xf874,0xf5));var _0x4f87=function(_0x4ede42,_0x3fbed8){_0x4ede42=_0x4ede42-0x0;var _0x47d2c1=_0xf874[_0x4ede42];return _0x47d2c1;};'use strict';var _=require(_0x4f87('0x0'));var util=require('util');var EventEmitter=require(_0x4f87('0x1'))[_0x4f87('0x2')];function RuleEngine(_0x4960a6,_0x2d246e){this[_0x4f87('0x3')]();if(!_[_0x4f87('0x4')](_0x4960a6)){this['register'](_0x4960a6);}if(_0x2d246e){this[_0x4f87('0x5')]=_0x2d246e['ignoreFactChanges'];}return this;}util[_0x4f87('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x4f87('0x3')]=function(_0x1a1e8b){this[_0x4f87('0x7')]=[];this[_0x4f87('0x8')]=[];};RuleEngine[_0x4f87('0x9')][_0x4f87('0xa')]=function(_0x563433){if(Array[_0x4f87('0xb')](_0x563433)){this[_0x4f87('0x7')]=this[_0x4f87('0x7')][_0x4f87('0xc')](_0x563433);}else if(_0x563433!==null&&_[_0x4f87('0xd')](_0x563433)){this[_0x4f87('0x7')][_0x4f87('0xe')](_0x563433);}this['sync']();};RuleEngine['prototype'][_0x4f87('0xf')]=function(){this[_0x4f87('0x8')]=this[_0x4f87('0x7')][_0x4f87('0x10')](function(_0xcd2c31){if(_[_0x4f87('0x4')](_0xcd2c31['on'])){_0xcd2c31['on']=!![];}if(_0xcd2c31['on']===!![]){return _0xcd2c31;}});this[_0x4f87('0x8')]=_[_0x4f87('0x11')](this[_0x4f87('0x8')],['p'],['asc']);};RuleEngine[_0x4f87('0x9')][_0x4f87('0x12')]=function(_0x1d8a0b,_0xa08518){var _0x4180a9=![];_0x1d8a0b[_0x4f87('0x13')]=!![];var _0x53fa2e=_['clone'](_0x1d8a0b);var _0x278e15=_[_0x4f87('0x14')](_0x1d8a0b);var _0x5b8847=this[_0x4f87('0x8')];var _0x3081b6=[];var _0xc094aa=this[_0x4f87('0x5')];(function FnRuleLoop(_0x20526e){var _0x5e4f43={'rules':function(){return _0x5b8847;},'rule':function(){return _0x5b8847[_0x20526e];},'when':function(_0x15a765){if(_0x15a765){var _0x597640=_0x5b8847[_0x20526e][_0x4f87('0x15')];_0x597640['ruleRef']=_0x5b8847[_0x20526e]['id']||_0x5b8847[_0x20526e]['name']||_0x4f87('0x16')+_0x20526e;process[_0x4f87('0x17')](function(){_0x3081b6[_0x4f87('0xe')](_0x597640[_0x4f87('0x18')]);_0x597640[_0x4f87('0x19')](_0x53fa2e,_0x5e4f43);});}else{process[_0x4f87('0x17')](function(){_0x5e4f43[_0x4f87('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x4180a9=!![];return FnRuleLoop(0x0);},'next':function(_0x425350){if(!_0xc094aa&&!_[_0x4f87('0x1b')](_0x278e15,_0x53fa2e)){_0x278e15=_[_0x4f87('0x14')](_0x53fa2e);process[_0x4f87('0x17')](function(){_0x5e4f43[_0x4f87('0x1c')]();});}else{process['nextTick'](function(){if(_[_0x4f87('0x4')](_0x425350)){return FnRuleLoop(_0x20526e+0x1);}else{return FnRuleLoop(_0x425350);}});}}};if(_0x20526e<_0x5b8847[_0x4f87('0x1d')]&&_0x4180a9===![]){var _0x4c3c25=_0x5b8847[_0x20526e][_0x4f87('0x1e')];_0x4c3c25[_0x4f87('0x19')](_0x53fa2e,_0x5e4f43);}else{process[_0x4f87('0x17')](function(){_0x53fa2e[_0x4f87('0x1f')]=_0x3081b6;return _0xa08518?_0xa08518(_0x53fa2e):_[_0x4f87('0x20')]();});}}(0x0));};RuleEngine[_0x4f87('0x9')][_0x4f87('0x21')]=function(_0x223217){if(_[_0x4f87('0x4')](_0x223217)){return this['rules'];}else{var _0x9df2c7=_[_0x4f87('0x22')](_0x223217);return _[_0x4f87('0x10')](this[_0x4f87('0x7')],_0x9df2c7);}};RuleEngine[_0x4f87('0x9')]['turn']=function(_0xf14f6f,_0x5667dc){var _0x1c2fa5=_0xf14f6f==='on'||_0xf14f6f==='ON'?!![]:![];var _0x1a179d=this[_0x4f87('0x21')](_0x5667dc);for(var _0x1f91f5=0x0,_0x20ee5d=_0x1a179d[_0x4f87('0x1d')];_0x1f91f5<_0x20ee5d;_0x1f91f5+=0x1){_0x1a179d[_0x1f91f5]['on']=_0x1c2fa5;}this['sync']();};RuleEngine[_0x4f87('0x9')][_0x4f87('0x23')]=function(_0x28c745,_0x45de79){_0x28c745=parseInt(_0x28c745,0xa);var _0x5cd6c8=this[_0x4f87('0x21')](_0x45de79);for(var _0x4a9b1d=0x0,_0x4884e4=_0x5cd6c8[_0x4f87('0x1d')];_0x4a9b1d<_0x4884e4;_0x4a9b1d+=0x1){_0x5cd6c8[_0x4a9b1d][_0x4f87('0x24')]=_0x28c745;}this[_0x4f87('0xf')]();};RuleEngine[_0x4f87('0x9')]['toJSON']=function(){var _0x19dde5=this['rules'];if(_0x19dde5 instanceof Array){_0x19dde5=_0x19dde5[_0x4f87('0x25')](function(_0x20f5f1){_0x20f5f1[_0x4f87('0x1e')]=_0x20f5f1[_0x4f87('0x1e')][_0x4f87('0x26')]();_0x20f5f1[_0x4f87('0x15')]=_0x20f5f1[_0x4f87('0x15')]['toString']();return _0x20f5f1;});}else if(!_[_0x4f87('0x4')](_0x19dde5)){_0x19dde5['condition']=_0x19dde5[_0x4f87('0x1e')]['toString']();_0x19dde5[_0x4f87('0x15')]=_0x19dde5['consequence'][_0x4f87('0x26')]();}return _0x19dde5;};RuleEngine[_0x4f87('0x9')][_0x4f87('0x27')]=function(_0x3fc216){this[_0x4f87('0x3')]();if(_[_0x4f87('0x28')](_0x3fc216)){_0x3fc216=JSON[_0x4f87('0x29')](_0x3fc216);}if(_0x3fc216 instanceof Array){_0x3fc216=_0x3fc216[_0x4f87('0x25')](function(_0x16cb77){_0x16cb77[_0x4f87('0x1e')]=eval('('+_0x16cb77[_0x4f87('0x1e')]+')');_0x16cb77[_0x4f87('0x15')]=eval('('+_0x16cb77[_0x4f87('0x15')]+')');return _0x16cb77;});}else if(_0x3fc216!==null&&typeof _0x3fc216==_0x4f87('0x2a')){_0x3fc216[_0x4f87('0x1e')]=eval('('+_0x3fc216[_0x4f87('0x1e')]+')');_0x3fc216[_0x4f87('0x15')]=eval('('+_0x3fc216['consequence']+')');}this['register'](_0x3fc216);};module[_0x4f87('0x2b')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index bb3e07f..3c041c5 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0xf6332c,_0x3aedab){var _0x568a7=function(_0x53820b){while(--_0x53820b){_0xf6332c['push'](_0xf6332c['shift']());}};_0x568a7(++_0x3aedab);}(_0x814b,0x1a2));var _0xb814=function(_0x23ca2f,_0x271c2b){_0x23ca2f=_0x23ca2f-0x0;var _0x4f4b51=_0x814b[_0x23ca2f];return _0x4f4b51;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file +var _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x101d19,_0x548ac4){var _0x1a2246=function(_0x4c5725){while(--_0x4c5725){_0x101d19['push'](_0x101d19['shift']());}};_0x1a2246(++_0x548ac4);}(_0x34e8,0x12c));var _0x834e=function(_0x15a843,_0x31add6){_0x15a843=_0x15a843-0x0;var _0x3b72ea=_0x34e8[_0x15a843];return _0x3b72ea;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index ff07a09..d997636 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6cb4=['whatsapp','length','StatusTime','toNumber','format','Status','mailStatusTime','whatsappStatusTime','stringify','emit','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','chat','openchannel','fax','sms'];(function(_0x3beff9,_0x536707){var _0x458844=function(_0x28a5a9){while(--_0x28a5a9){_0x3beff9['push'](_0x3beff9['shift']());}};_0x458844(++_0x536707);}(_0x6cb4,0xff));var _0x46cb=function(_0x3f89d6,_0x54bf40){_0x3f89d6=_0x3f89d6-0x0;var _0x53aff1=_0x6cb4[_0x3f89d6];return _0x53aff1;};'use strict';var _=require(_0x46cb('0x0'));var moment=require(_0x46cb('0x1'));var md5=require(_0x46cb('0x2'));var Redis=require(_0x46cb('0x3'));var config=require(_0x46cb('0x4'));config[_0x46cb('0x5')]=_[_0x46cb('0x6')](config[_0x46cb('0x5')],{'host':_0x46cb('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x46cb('0x5')]));function Agent(_0x5cb9a4){this['id']=_0x5cb9a4['id']||0x0;this[_0x46cb('0x8')]=_0x5cb9a4['name']||'';this[_0x46cb('0x9')]=_0x5cb9a4[_0x46cb('0x9')]||!![];this[_0x46cb('0xa')]=_0x5cb9a4[_0x46cb('0xa')]||![];this[_0x46cb('0xb')]=_0x5cb9a4[_0x46cb('0xb')]||![];this['mailPause']=_0x5cb9a4[_0x46cb('0xc')]||![];this[_0x46cb('0xd')]=_0x5cb9a4['faxPause']||![];this[_0x46cb('0xe')]=_0x5cb9a4[_0x46cb('0xe')]||![];this['openchannelPause']=_0x5cb9a4[_0x46cb('0xf')]||![];this[_0x46cb('0x10')]='unknown';this['chatStatusTime']=0x0;this['chatCapacity']=_0x5cb9a4[_0x46cb('0x11')]||0x0;this[_0x46cb('0x12')]=0x0;this[_0x46cb('0x13')]=_0x46cb('0x14');this['mailStatusTime']=0x0;this[_0x46cb('0x15')]=_0x5cb9a4[_0x46cb('0x15')]||0x0;this[_0x46cb('0x16')]=0x0;this[_0x46cb('0x17')]=_0x46cb('0x14');this[_0x46cb('0x18')]=0x0;this[_0x46cb('0x19')]=_0x5cb9a4[_0x46cb('0x19')]||0x0;this[_0x46cb('0x1a')]=0x0;this[_0x46cb('0x1b')]=_0x46cb('0x14');this['smsStatusTime']=0x0;this[_0x46cb('0x1c')]=_0x5cb9a4['smsCapacity']||0x0;this[_0x46cb('0x1d')]=0x0;this['whatsappStatus']='unknown';this['whatsappStatusTime']=0x0;this[_0x46cb('0x1e')]=_0x5cb9a4[_0x46cb('0x1e')]||0x0;this[_0x46cb('0x1f')]=0x0;this[_0x46cb('0x20')]=_0x46cb('0x14');this[_0x46cb('0x21')]=0x0;this[_0x46cb('0x22')]=_0x5cb9a4[_0x46cb('0x22')]||0x0;this[_0x46cb('0x23')]=0x0;this[_0x46cb('0x24')]=![];this[_0x46cb('0x25')]=undefined;this[_0x46cb('0x2')]='';this[_0x46cb('0x26')]();}Agent[_0x46cb('0x27')][_0x46cb('0x28')]=function(_0xf11f19){if(this[_0xf11f19+_0x46cb('0x29')]>0x0){if(this[_0xf11f19+_0x46cb('0x2a')]>0x0&&this[_0xf11f19+_0x46cb('0x29')]>=this[_0xf11f19+_0x46cb('0x2a')]){return _0x46cb('0x2b');}else{return _0x46cb('0x2c');}}else{return _0x46cb('0x2d');}};Agent[_0x46cb('0x27')][_0x46cb('0x26')]=function(){var _0x5a1338=['mail',_0x46cb('0x2e'),_0x46cb('0x2f'),_0x46cb('0x30'),_0x46cb('0x31'),_0x46cb('0x32')];for(var _0x589152=0x0;_0x589152<_0x5a1338[_0x46cb('0x33')];_0x589152+=0x1){var _0x578ffd=this['getChannelStatus'](_0x5a1338[_0x589152]);if(this[_0x5a1338[_0x589152]+'Status']!==_0x578ffd){this[_0x5a1338[_0x589152]+_0x46cb('0x34')]=_[_0x46cb('0x35')](moment()[_0x46cb('0x36')]('x'));}this[_0x5a1338[_0x589152]+_0x46cb('0x37')]=_0x578ffd;}var _0x7cd177={'id':this['id'],'name':this[_0x46cb('0x8')],'online':this[_0x46cb('0x9')],'voicePause':this[_0x46cb('0xa')],'chatPause':this[_0x46cb('0xb')],'mailPause':this[_0x46cb('0xc')],'smsPause':this[_0x46cb('0xe')],'faxPause':this['faxPause'],'openchannelPause':this[_0x46cb('0xf')],'chatStatus':this[_0x46cb('0x10')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x46cb('0x12')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x46cb('0x38')],'mailCapacity':this[_0x46cb('0x15')],'mailCurrentCapacity':this[_0x46cb('0x16')],'faxStatus':this[_0x46cb('0x17')],'faxStatusTime':this[_0x46cb('0x18')],'faxCapacity':this[_0x46cb('0x19')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x46cb('0x1b')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x46cb('0x1c')],'smsCurrentCapacity':this[_0x46cb('0x1d')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x46cb('0x39')],'whatsappCapacity':this[_0x46cb('0x1e')],'whatsappCurrentCapacity':this[_0x46cb('0x1f')],'openchannelStatus':this[_0x46cb('0x20')],'openchannelStatusTime':this[_0x46cb('0x21')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x46cb('0x23')],'busy':this['busy'],'busyQueue':this[_0x46cb('0x25')]};var _0x414aef=md5(JSON[_0x46cb('0x3a')](_0x7cd177));if(this['md5']!==_0x414aef){this[_0x46cb('0x2')]=_0x414aef;io[_0x46cb('0x3b')]('user:save',_0x7cd177);}};module[_0x46cb('0x3c')]=Agent; \ No newline at end of file +var _0x585e=['openchannel','fax','sms','length','getChannelStatus','Status','toNumber','format','chatStatus','chatCurrentCapacity','faxCurrentCapacity','smsStatus','whatsappStatus','stringify','emit','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','mail','chat'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x585e,0x1c2));var _0xe585=function(_0x4bd486,_0x3bce80){_0x4bd486=_0x4bd486-0x0;var _0x16acf0=_0x585e[_0x4bd486];return _0x16acf0;};'use strict';var _=require(_0xe585('0x0'));var moment=require(_0xe585('0x1'));var md5=require(_0xe585('0x2'));var Redis=require(_0xe585('0x3'));var config=require(_0xe585('0x4'));config['redis']=_['defaults'](config[_0xe585('0x5')],{'host':_0xe585('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe585('0x5')]));function Agent(_0x357371){this['id']=_0x357371['id']||0x0;this[_0xe585('0x7')]=_0x357371[_0xe585('0x7')]||'';this[_0xe585('0x8')]=_0x357371[_0xe585('0x8')]||!![];this[_0xe585('0x9')]=_0x357371[_0xe585('0x9')]||![];this[_0xe585('0xa')]=_0x357371[_0xe585('0xa')]||![];this[_0xe585('0xb')]=_0x357371[_0xe585('0xb')]||![];this[_0xe585('0xc')]=_0x357371['faxPause']||![];this[_0xe585('0xd')]=_0x357371[_0xe585('0xd')]||![];this['openchannelPause']=_0x357371[_0xe585('0xe')]||![];this['chatStatus']=_0xe585('0xf');this[_0xe585('0x10')]=0x0;this[_0xe585('0x11')]=_0x357371[_0xe585('0x11')]||0x0;this['chatCurrentCapacity']=0x0;this[_0xe585('0x12')]=_0xe585('0xf');this[_0xe585('0x13')]=0x0;this['mailCapacity']=_0x357371[_0xe585('0x14')]||0x0;this[_0xe585('0x15')]=0x0;this[_0xe585('0x16')]=_0xe585('0xf');this[_0xe585('0x17')]=0x0;this['faxCapacity']=_0x357371[_0xe585('0x18')]||0x0;this['faxCurrentCapacity']=0x0;this['smsStatus']=_0xe585('0xf');this[_0xe585('0x19')]=0x0;this['smsCapacity']=_0x357371[_0xe585('0x1a')]||0x0;this[_0xe585('0x1b')]=0x0;this['whatsappStatus']=_0xe585('0xf');this[_0xe585('0x1c')]=0x0;this[_0xe585('0x1d')]=_0x357371[_0xe585('0x1d')]||0x0;this[_0xe585('0x1e')]=0x0;this[_0xe585('0x1f')]='unknown';this[_0xe585('0x20')]=0x0;this[_0xe585('0x21')]=_0x357371['openchannelCapacity']||0x0;this[_0xe585('0x22')]=0x0;this[_0xe585('0x23')]=![];this[_0xe585('0x24')]=undefined;this['md5']='';this[_0xe585('0x25')]();}Agent['prototype']['getChannelStatus']=function(_0x50209f){if(this[_0x50209f+_0xe585('0x26')]>0x0){if(this[_0x50209f+'Capacity']>0x0&&this[_0x50209f+_0xe585('0x26')]>=this[_0x50209f+_0xe585('0x27')]){return _0xe585('0x28');}else{return _0xe585('0x29');}}else{return _0xe585('0x2a');}};Agent[_0xe585('0x2b')][_0xe585('0x25')]=function(){var _0x8ffde3=[_0xe585('0x2c'),_0xe585('0x2d'),_0xe585('0x2e'),_0xe585('0x2f'),_0xe585('0x30'),'whatsapp'];for(var _0x35b453=0x0;_0x35b453<_0x8ffde3[_0xe585('0x31')];_0x35b453+=0x1){var _0x1fb096=this[_0xe585('0x32')](_0x8ffde3[_0x35b453]);if(this[_0x8ffde3[_0x35b453]+_0xe585('0x33')]!==_0x1fb096){this[_0x8ffde3[_0x35b453]+'StatusTime']=_[_0xe585('0x34')](moment()[_0xe585('0x35')]('x'));}this[_0x8ffde3[_0x35b453]+'Status']=_0x1fb096;}var _0x5a34ce={'id':this['id'],'name':this[_0xe585('0x7')],'online':this[_0xe585('0x8')],'voicePause':this[_0xe585('0x9')],'chatPause':this[_0xe585('0xa')],'mailPause':this[_0xe585('0xb')],'smsPause':this[_0xe585('0xd')],'faxPause':this[_0xe585('0xc')],'openchannelPause':this[_0xe585('0xe')],'chatStatus':this[_0xe585('0x36')],'chatStatusTime':this[_0xe585('0x10')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xe585('0x37')],'mailStatus':this[_0xe585('0x12')],'mailStatusTime':this[_0xe585('0x13')],'mailCapacity':this[_0xe585('0x14')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xe585('0x16')],'faxStatusTime':this[_0xe585('0x17')],'faxCapacity':this[_0xe585('0x18')],'faxCurrentCapacity':this[_0xe585('0x38')],'smsStatus':this[_0xe585('0x39')],'smsStatusTime':this[_0xe585('0x19')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xe585('0x3a')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xe585('0x1d')],'whatsappCurrentCapacity':this[_0xe585('0x1e')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xe585('0x20')],'openchannelCapacity':this[_0xe585('0x21')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xe585('0x23')],'busyQueue':this[_0xe585('0x24')]};var _0x114fcc=md5(JSON[_0xe585('0x3b')](_0x5a34ce));if(this[_0xe585('0x2')]!==_0x114fcc){this[_0xe585('0x2')]=_0x114fcc;io[_0xe585('0x3c')]('user:save',_0x5a34ce);}};module[_0xe585('0x3d')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 3d0bb9b..26937a4 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 _0xd6aa=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','online','chatPause','available','stringify','chat:queue:%s','emit','chat_queue:save','lodash','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x42e308,_0x47e9dc){var _0x4ee819=function(_0x20f508){while(--_0x20f508){_0x42e308['push'](_0x42e308['shift']());}};_0x4ee819(++_0x47e9dc);}(_0xd6aa,0x1ad));var _0xad6a=function(_0x301f88,_0x3efe41){_0x301f88=_0x301f88-0x0;var _0xcf80f8=_0xd6aa[_0x301f88];return _0xcf80f8;};'use strict';var _=require(_0xad6a('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xad6a('0x1'));var config=require(_0xad6a('0x2'));config[_0xad6a('0x3')]=_[_0xad6a('0x4')](config[_0xad6a('0x3')],{'host':_0xad6a('0x5'),'port':0x18eb});var io=require(_0xad6a('0x6'))(new Redis(config[_0xad6a('0x3')]));function ChatQueue(_0x306b98){this['id']=_0x306b98['id']||0x0;this[_0xad6a('0x7')]=_0x306b98[_0xad6a('0x7')]||'';this['timeout']=_0x306b98[_0xad6a('0x8')]||0xa;this[_0xad6a('0x9')]=_0x306b98['strategy']||_0xad6a('0xa');this['Agents']=_0x306b98[_0xad6a('0xb')];this[_0xad6a('0xc')]={};this[_0xad6a('0xd')]=0x0;this[_0xad6a('0xe')]='';this[_0xad6a('0xf')]();this['updateRealtime']();}ChatQueue[_0xad6a('0x10')][_0xad6a('0xf')]=function(){var _0x57c223=this[_0xad6a('0xc')][_0xad6a('0x11')];this[_0xad6a('0xc')]=_[_0xad6a('0x12')](this[_0xad6a('0xb')],'id');this[_0xad6a('0xc')][_0xad6a('0x11')]=_0x57c223;};ChatQueue[_0xad6a('0x10')][_0xad6a('0x13')]=function(){this[_0xad6a('0x14')]=0x0;this[_0xad6a('0x15')]=0x0;for(var _0x12083a=0x0;_0x12083a=0x0?this['available']:0x0;var _0x4af4c0={'id':this['id'],'available':this['available'],'loggedIn':this[_0xad6a('0x14')],'name':this[_0xad6a('0x7')],'paused':this[_0xad6a('0x15')],'waiting':this['waiting']};var _0x303540=md5(JSON[_0xad6a('0x19')](_0x4af4c0));if(this[_0xad6a('0xe')]!==_0x303540){this[_0xad6a('0xe')]=_0x303540;io['to'](util['format'](_0xad6a('0x1a'),_0x4af4c0['name']))[_0xad6a('0x1b')](_0xad6a('0x1c'),_0x4af4c0);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x0276=['timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','length','online','chatPause','paused','available','name','format','chat:queue:%s','emit','chat_queue:save','exports','md5','util','redis','localhost','socket.io-emitter'];(function(_0x133097,_0x436f1d){var _0x22e3a8=function(_0x24835e){while(--_0x24835e){_0x133097['push'](_0x133097['shift']());}};_0x22e3a8(++_0x436f1d);}(_0x0276,0xb1));var _0x6027=function(_0x15f3a8,_0x9bcdcc){_0x15f3a8=_0x15f3a8-0x0;var _0x26f727=_0x0276[_0x15f3a8];return _0x26f727;};'use strict';var _=require('lodash');var md5=require(_0x6027('0x0'));var util=require(_0x6027('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x6027('0x2')],{'host':_0x6027('0x3'),'port':0x18eb});var io=require(_0x6027('0x4'))(new Redis(config[_0x6027('0x2')]));function ChatQueue(_0x34750b){this['id']=_0x34750b['id']||0x0;this['name']=_0x34750b['name']||'';this[_0x6027('0x5')]=_0x34750b[_0x6027('0x5')]||0xa;this[_0x6027('0x6')]=_0x34750b['strategy']||'beepall';this[_0x6027('0x7')]=_0x34750b[_0x6027('0x7')];this[_0x6027('0x8')]={};this[_0x6027('0x9')]=0x0;this[_0x6027('0x0')]='';this[_0x6027('0xa')]();this[_0x6027('0xb')]();}ChatQueue[_0x6027('0xc')][_0x6027('0xa')]=function(){var _0x4697b1=this[_0x6027('0x8')]['_rr'];this[_0x6027('0x8')]=_[_0x6027('0xd')](this['Agents'],'id');this[_0x6027('0x8')]['_rr']=_0x4697b1;};ChatQueue['prototype'][_0x6027('0xb')]=function(){this[_0x6027('0xe')]=0x0;this['paused']=0x0;for(var _0x50b889=0x0;_0x50b889=0x0?this[_0x6027('0x13')]:0x0;var _0x171d78={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6027('0xe')],'name':this[_0x6027('0x14')],'paused':this[_0x6027('0x12')],'waiting':this['waiting']};var _0x3b5e5=md5(JSON['stringify'](_0x171d78));if(this[_0x6027('0x0')]!==_0x3b5e5){this[_0x6027('0x0')]=_0x3b5e5;io['to'](util[_0x6027('0x15')](_0x6027('0x16'),_0x171d78[_0x6027('0x14')]))[_0x6027('0x17')](_0x6027('0x18'),_0x171d78);}};module[_0x6027('0x19')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 7fc2f52..4ffab52 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(_0x15eac2,_0x2218f9){var _0x59e802=function(_0x2411be){while(--_0x2411be){_0x15eac2['push'](_0x15eac2['shift']());}};_0x59e802(++_0x2218f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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(_0x4f236f,_0xef3ee4){var _0x2db16d=function(_0x5233ad){while(--_0x5233ad){_0x4f236f['push'](_0x4f236f['shift']());}};_0x2db16d(++_0xef3ee4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 721048b..5229aa6 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 _0xbdc1=['name','Intervals','exports'];(function(_0x313f61,_0x5aaad9){var _0x1dd253=function(_0x386afb){while(--_0x386afb){_0x313f61['push'](_0x313f61['shift']());}};_0x1dd253(++_0x5aaad9);}(_0xbdc1,0x147));var _0x1bdc=function(_0x28861c,_0x1761bb){_0x28861c=_0x28861c-0x0;var _0x28492b=_0xbdc1[_0x28861c];return _0x28492b;};'use strict';function Interval(_0xd631b){this['id']=_0xd631b['id']||0x0;this['name']=_0xd631b[_0x1bdc('0x0')]||'';this[_0x1bdc('0x1')]=_0xd631b[_0x1bdc('0x1')]||{};}module[_0x1bdc('0x2')]=Interval; \ No newline at end of file +var _0xb0d2=['Intervals','exports','name'];(function(_0x386394,_0x543996){var _0x4f8d51=function(_0x4b7ae4){while(--_0x4b7ae4){_0x386394['push'](_0x386394['shift']());}};_0x4f8d51(++_0x543996);}(_0xb0d2,0x1a9));var _0x2b0d=function(_0x343dab,_0x134185){_0x343dab=_0x343dab-0x0;var _0xa7e52d=_0xb0d2[_0x343dab];return _0xa7e52d;};'use strict';function Interval(_0x1aa72f){this['id']=_0x1aa72f['id']||0x0;this[_0x2b0d('0x0')]=_0x1aa72f[_0x2b0d('0x0')]||'';this[_0x2b0d('0x1')]=_0x1aa72f[_0x2b0d('0x1')]||{};}module[_0x2b0d('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 60dbbe7..4770f3e 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 _0x4549=['map','loggedIn','length','online','paused','available','format','emit','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','prototype','_rr'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x4549,0x14e));var _0x9454=function(_0x2c4780,_0x1ab9f2){_0x2c4780=_0x2c4780-0x0;var _0x4dd957=_0x4549[_0x2c4780];return _0x4dd957;};'use strict';var _=require(_0x9454('0x0'));var md5=require(_0x9454('0x1'));var util=require(_0x9454('0x2'));var Redis=require(_0x9454('0x3'));var config=require(_0x9454('0x4'));config['redis']=_[_0x9454('0x5')](config[_0x9454('0x6')],{'host':_0x9454('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9454('0x6')]));function MailQueue(_0x596481){this['id']=_0x596481['id']||0x0;this[_0x9454('0x8')]=_0x596481['name']||'';this['timeout']=_0x596481[_0x9454('0x9')]||0xa;this[_0x9454('0xa')]=_0x596481[_0x9454('0xa')]||'beepall';this[_0x9454('0xb')]=_0x596481[_0x9454('0xb')];this[_0x9454('0xc')]={};this[_0x9454('0xd')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0x9454('0xe')]['updateRouting']=function(){var _0x4d90e0=this[_0x9454('0xc')][_0x9454('0xf')];this[_0x9454('0xc')]=_[_0x9454('0x10')](this[_0x9454('0xb')],'id');this[_0x9454('0xc')]['_rr']=_0x4d90e0;};MailQueue[_0x9454('0xe')]['updateRealtime']=function(){this[_0x9454('0x11')]=0x0;this['paused']=0x0;for(var _0x338eff=0x0;_0x338eff=0x0?this[_0x9454('0x15')]:0x0;var _0x59b868={'id':this['id'],'available':this[_0x9454('0x15')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x9454('0xd')]};var _0xa975ac=md5(JSON['stringify'](_0x59b868));if(this[_0x9454('0x1')]!==_0xa975ac){this[_0x9454('0x1')]=_0xa975ac;io['to'](util[_0x9454('0x16')]('mail:queue:%s',_0x59b868[_0x9454('0x8')]))[_0x9454('0x17')]('mail_queue:save',_0x59b868);}};module[_0x9454('0x18')]=MailQueue; \ No newline at end of file +var _0x7fea=['timeout','strategy','beepall','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime','loggedIn','Agents','length','online','mailPause','paused','available','stringify','format','mail:queue:%s','emit','exports','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x197923,_0x47d2a1){var _0x331ad2=function(_0x137694){while(--_0x137694){_0x197923['push'](_0x197923['shift']());}};_0x331ad2(++_0x47d2a1);}(_0x7fea,0x149));var _0xa7fe=function(_0x443283,_0x59641a){_0x443283=_0x443283-0x0;var _0x918a8c=_0x7fea[_0x443283];return _0x918a8c;};'use strict';var _=require('lodash');var md5=require(_0xa7fe('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0xa7fe('0x1'));config[_0xa7fe('0x2')]=_[_0xa7fe('0x3')](config[_0xa7fe('0x2')],{'host':_0xa7fe('0x4'),'port':0x18eb});var io=require(_0xa7fe('0x5'))(new Redis(config['redis']));function MailQueue(_0x22c3f2){this['id']=_0x22c3f2['id']||0x0;this[_0xa7fe('0x6')]=_0x22c3f2[_0xa7fe('0x6')]||'';this[_0xa7fe('0x7')]=_0x22c3f2[_0xa7fe('0x7')]||0xa;this[_0xa7fe('0x8')]=_0x22c3f2[_0xa7fe('0x8')]||_0xa7fe('0x9');this['Agents']=_0x22c3f2['Agents'];this[_0xa7fe('0xa')]={};this[_0xa7fe('0xb')]=0x0;this[_0xa7fe('0x0')]='';this[_0xa7fe('0xc')]();this['updateRealtime']();}MailQueue[_0xa7fe('0xd')][_0xa7fe('0xc')]=function(){var _0x5690e4=this[_0xa7fe('0xa')]['_rr'];this[_0xa7fe('0xa')]=_['map'](this['Agents'],'id');this[_0xa7fe('0xa')][_0xa7fe('0xe')]=_0x5690e4;};MailQueue[_0xa7fe('0xd')][_0xa7fe('0xf')]=function(){this[_0xa7fe('0x10')]=0x0;this['paused']=0x0;for(var _0x49e7cb=0x0;_0x49e7cb=0x0?this[_0xa7fe('0x16')]:0x0;var _0x2bf8db={'id':this['id'],'available':this[_0xa7fe('0x16')],'loggedIn':this[_0xa7fe('0x10')],'name':this[_0xa7fe('0x6')],'paused':this[_0xa7fe('0x15')],'waiting':this['waiting']};var _0x5409fe=md5(JSON[_0xa7fe('0x17')](_0x2bf8db));if(this[_0xa7fe('0x0')]!==_0x5409fe){this[_0xa7fe('0x0')]=_0x5409fe;io['to'](util[_0xa7fe('0x18')](_0xa7fe('0x19'),_0x2bf8db[_0xa7fe('0x6')]))[_0xa7fe('0x1a')]('mail_queue:save',_0x2bf8db);}};module[_0xa7fe('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 3baab2e..79d9359 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 _0x63ef=['exports','lodash','md5','ioredis','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','length','online','loggedIn','paused','available','openchannel:queue:%s'];(function(_0x498930,_0x1cce0d){var _0x38f38b=function(_0x2c70d2){while(--_0x2c70d2){_0x498930['push'](_0x498930['shift']());}};_0x38f38b(++_0x1cce0d);}(_0x63ef,0x1ef));var _0xf63e=function(_0x466247,_0x5d69e3){_0x466247=_0x466247-0x0;var _0x4b352e=_0x63ef[_0x466247];return _0x4b352e;};'use strict';var _=require(_0xf63e('0x0'));var md5=require(_0xf63e('0x1'));var util=require('util');var Redis=require(_0xf63e('0x2'));var config=require('../../../config/environment');config['redis']=_[_0xf63e('0x3')](config['redis'],{'host':_0xf63e('0x4'),'port':0x18eb});var io=require(_0xf63e('0x5'))(new Redis(config[_0xf63e('0x6')]));function OpenchannelQueue(_0x1badb1){this['id']=_0x1badb1['id']||0x0;this[_0xf63e('0x7')]=_0x1badb1[_0xf63e('0x7')]||'';this[_0xf63e('0x8')]=_0x1badb1[_0xf63e('0x8')]||0xa;this[_0xf63e('0x9')]=_0x1badb1[_0xf63e('0x9')]||_0xf63e('0xa');this['Agents']=_0x1badb1[_0xf63e('0xb')];this[_0xf63e('0xc')]={};this[_0xf63e('0xd')]=0x0;this['md5']='';this[_0xf63e('0xe')]();this[_0xf63e('0xf')]();}OpenchannelQueue[_0xf63e('0x10')][_0xf63e('0xe')]=function(){var _0xf95b4a=this[_0xf63e('0xc')][_0xf63e('0x11')];this[_0xf63e('0xc')]=_[_0xf63e('0x12')](this['Agents'],'id');this[_0xf63e('0xc')]['_rr']=_0xf95b4a;};OpenchannelQueue[_0xf63e('0x10')][_0xf63e('0xf')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x5e156c=0x0;_0x5e156c=0x0?this[_0xf63e('0x17')]:0x0;var _0x198102={'id':this['id'],'available':this['available'],'loggedIn':this[_0xf63e('0x15')],'name':this[_0xf63e('0x7')],'paused':this[_0xf63e('0x16')],'waiting':this[_0xf63e('0xd')]};var _0x320b27=md5(JSON['stringify'](_0x198102));if(this[_0xf63e('0x1')]!==_0x320b27){this['md5']=_0x320b27;io['to'](util['format'](_0xf63e('0x18'),_0x198102[_0xf63e('0x7')]))['emit']('openchannel_queue:save',_0x198102);}};module[_0xf63e('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0xd08f=['waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','paused','length','online','openchannelPause','available','stringify','format','emit','exports','md5','util','ioredis','redis','defaults','name','strategy','beepall','Agents'];(function(_0x1f44e4,_0x22d9fd){var _0x591989=function(_0x3aeb88){while(--_0x3aeb88){_0x1f44e4['push'](_0x1f44e4['shift']());}};_0x591989(++_0x22d9fd);}(_0xd08f,0x1e5));var _0xfd08=function(_0xd6e343,_0x41a619){_0xd6e343=_0xd6e343-0x0;var _0x5c0e4a=_0xd08f[_0xd6e343];return _0x5c0e4a;};'use strict';var _=require('lodash');var md5=require(_0xfd08('0x0'));var util=require(_0xfd08('0x1'));var Redis=require(_0xfd08('0x2'));var config=require('../../../config/environment');config[_0xfd08('0x3')]=_[_0xfd08('0x4')](config[_0xfd08('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfd08('0x3')]));function OpenchannelQueue(_0x577067){this['id']=_0x577067['id']||0x0;this[_0xfd08('0x5')]=_0x577067[_0xfd08('0x5')]||'';this['timeout']=_0x577067['timeout']||0xa;this[_0xfd08('0x6')]=_0x577067[_0xfd08('0x6')]||_0xfd08('0x7');this[_0xfd08('0x8')]=_0x577067['Agents'];this['mapAgentsId']={};this[_0xfd08('0x9')]=0x0;this[_0xfd08('0x0')]='';this[_0xfd08('0xa')]();this[_0xfd08('0xb')]();}OpenchannelQueue[_0xfd08('0xc')]['updateRouting']=function(){var _0x2c012f=this[_0xfd08('0xd')]['_rr'];this[_0xfd08('0xd')]=_[_0xfd08('0xe')](this[_0xfd08('0x8')],'id');this['mapAgentsId'][_0xfd08('0xf')]=_0x2c012f;};OpenchannelQueue['prototype']['updateRealtime']=function(){this[_0xfd08('0x10')]=0x0;this[_0xfd08('0x11')]=0x0;for(var _0x4be685=0x0;_0x4be685=0x0?this[_0xfd08('0x15')]:0x0;var _0x28faac={'id':this['id'],'available':this[_0xfd08('0x15')],'loggedIn':this[_0xfd08('0x10')],'name':this[_0xfd08('0x5')],'paused':this[_0xfd08('0x11')],'waiting':this[_0xfd08('0x9')]};var _0x490911=md5(JSON[_0xfd08('0x16')](_0x28faac));if(this['md5']!==_0x490911){this['md5']=_0x490911;io['to'](util[_0xfd08('0x17')]('openchannel:queue:%s',_0x28faac['name']))[_0xfd08('0x18')]('openchannel_queue:save',_0x28faac);}};module[_0xfd08('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index f651d2e..80e960b 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 _0xe706=['prototype','_rr','map','online','loggedIn','smsPause','available','paused','stringify','format','sms:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x2b4448,_0x5bcc69){var _0xb4b465=function(_0x5ac741){while(--_0x5ac741){_0x2b4448['push'](_0x2b4448['shift']());}};_0xb4b465(++_0x5bcc69);}(_0xe706,0xa3));var _0x6e70=function(_0x3ec69d,_0xf8aade){_0x3ec69d=_0x3ec69d-0x0;var _0x394c7e=_0xe706[_0x3ec69d];return _0x394c7e;};'use strict';var _=require(_0x6e70('0x0'));var md5=require(_0x6e70('0x1'));var util=require(_0x6e70('0x2'));var Redis=require('ioredis');var config=require(_0x6e70('0x3'));config[_0x6e70('0x4')]=_[_0x6e70('0x5')](config[_0x6e70('0x4')],{'host':_0x6e70('0x6'),'port':0x18eb});var io=require(_0x6e70('0x7'))(new Redis(config[_0x6e70('0x4')]));function SmsQueue(_0x506db9){this['id']=_0x506db9['id']||0x0;this[_0x6e70('0x8')]=_0x506db9[_0x6e70('0x8')]||'';this[_0x6e70('0x9')]=_0x506db9[_0x6e70('0x9')]||0xa;this[_0x6e70('0xa')]=_0x506db9[_0x6e70('0xa')]||_0x6e70('0xb');this[_0x6e70('0xc')]=_0x506db9[_0x6e70('0xc')];this[_0x6e70('0xd')]={};this[_0x6e70('0xe')]=0x0;this[_0x6e70('0x1')]='';this[_0x6e70('0xf')]();this[_0x6e70('0x10')]();}SmsQueue[_0x6e70('0x11')][_0x6e70('0xf')]=function(){var _0x5b3d07=this['mapAgentsId'][_0x6e70('0x12')];this[_0x6e70('0xd')]=_[_0x6e70('0x13')](this[_0x6e70('0xc')],'id');this[_0x6e70('0xd')][_0x6e70('0x12')]=_0x5b3d07;};SmsQueue[_0x6e70('0x11')][_0x6e70('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x48bc72=0x0;_0x48bc72=0x0?this['available']:0x0;var _0x28a21f={'id':this['id'],'available':this[_0x6e70('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x6e70('0x18')],'waiting':this[_0x6e70('0xe')]};var _0x2368eb=md5(JSON[_0x6e70('0x19')](_0x28a21f));if(this[_0x6e70('0x1')]!==_0x2368eb){this[_0x6e70('0x1')]=_0x2368eb;io['to'](util[_0x6e70('0x1a')](_0x6e70('0x1b'),_0x28a21f[_0x6e70('0x8')]))[_0x6e70('0x1c')]('sms_queue:save',_0x28a21f);}};module[_0x6e70('0x1d')]=SmsQueue; \ No newline at end of file +var _0xe706=['prototype','_rr','map','online','loggedIn','smsPause','available','paused','stringify','format','sms:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x1e2eac,_0x26dddf){var _0x7a4e81=function(_0x341ed5){while(--_0x341ed5){_0x1e2eac['push'](_0x1e2eac['shift']());}};_0x7a4e81(++_0x26dddf);}(_0xe706,0xa3));var _0x6e70=function(_0xd04b50,_0x3d635d){_0xd04b50=_0xd04b50-0x0;var _0x5de236=_0xe706[_0xd04b50];return _0x5de236;};'use strict';var _=require(_0x6e70('0x0'));var md5=require(_0x6e70('0x1'));var util=require(_0x6e70('0x2'));var Redis=require('ioredis');var config=require(_0x6e70('0x3'));config[_0x6e70('0x4')]=_[_0x6e70('0x5')](config[_0x6e70('0x4')],{'host':_0x6e70('0x6'),'port':0x18eb});var io=require(_0x6e70('0x7'))(new Redis(config[_0x6e70('0x4')]));function SmsQueue(_0x506db9){this['id']=_0x506db9['id']||0x0;this[_0x6e70('0x8')]=_0x506db9[_0x6e70('0x8')]||'';this[_0x6e70('0x9')]=_0x506db9[_0x6e70('0x9')]||0xa;this[_0x6e70('0xa')]=_0x506db9[_0x6e70('0xa')]||_0x6e70('0xb');this[_0x6e70('0xc')]=_0x506db9[_0x6e70('0xc')];this[_0x6e70('0xd')]={};this[_0x6e70('0xe')]=0x0;this[_0x6e70('0x1')]='';this[_0x6e70('0xf')]();this[_0x6e70('0x10')]();}SmsQueue[_0x6e70('0x11')][_0x6e70('0xf')]=function(){var _0x5b3d07=this['mapAgentsId'][_0x6e70('0x12')];this[_0x6e70('0xd')]=_[_0x6e70('0x13')](this[_0x6e70('0xc')],'id');this[_0x6e70('0xd')][_0x6e70('0x12')]=_0x5b3d07;};SmsQueue[_0x6e70('0x11')][_0x6e70('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x48bc72=0x0;_0x48bc72=0x0?this['available']:0x0;var _0x28a21f={'id':this['id'],'available':this[_0x6e70('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x6e70('0x18')],'waiting':this[_0x6e70('0xe')]};var _0x2368eb=md5(JSON[_0x6e70('0x19')](_0x28a21f));if(this[_0x6e70('0x1')]!==_0x2368eb){this[_0x6e70('0x1')]=_0x2368eb;io['to'](util[_0x6e70('0x1a')](_0x6e70('0x1b'),_0x28a21f[_0x6e70('0x8')]))[_0x6e70('0x1c')]('sms_queue:save',_0x28a21f);}};module[_0x6e70('0x1d')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 705f4e9..0e294d4 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 _0x6416=['emit','whatsapp_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','whatsappPause','available','paused','stringify','whatsapp:queue:%s'];(function(_0x194857,_0xcbf8f4){var _0x9aad3e=function(_0x2a469c){while(--_0x2a469c){_0x194857['push'](_0x194857['shift']());}};_0x9aad3e(++_0xcbf8f4);}(_0x6416,0x139));var _0x6641=function(_0x25825b,_0xf6fd5f){_0x25825b=_0x25825b-0x0;var _0x5e9b99=_0x6416[_0x25825b];return _0x5e9b99;};'use strict';var _=require(_0x6641('0x0'));var md5=require(_0x6641('0x1'));var util=require('util');var Redis=require(_0x6641('0x2'));var config=require(_0x6641('0x3'));config[_0x6641('0x4')]=_[_0x6641('0x5')](config[_0x6641('0x4')],{'host':_0x6641('0x6'),'port':0x18eb});var io=require(_0x6641('0x7'))(new Redis(config[_0x6641('0x4')]));function WhatsappQueue(_0x1dbf8a){this['id']=_0x1dbf8a['id']||0x0;this[_0x6641('0x8')]=_0x1dbf8a[_0x6641('0x8')]||'';this[_0x6641('0x9')]=_0x1dbf8a['timeout']||0xa;this['strategy']=_0x1dbf8a[_0x6641('0xa')]||_0x6641('0xb');this['Agents']=_0x1dbf8a[_0x6641('0xc')];this[_0x6641('0xd')]={};this[_0x6641('0xe')]=0x0;this[_0x6641('0x1')]='';this[_0x6641('0xf')]();this[_0x6641('0x10')]();}WhatsappQueue[_0x6641('0x11')][_0x6641('0xf')]=function(){var _0x2a5ff2=this[_0x6641('0xd')][_0x6641('0x12')];this[_0x6641('0xd')]=_[_0x6641('0x13')](this[_0x6641('0xc')],'id');this[_0x6641('0xd')]['_rr']=_0x2a5ff2;};WhatsappQueue[_0x6641('0x11')][_0x6641('0x10')]=function(){this[_0x6641('0x14')]=0x0;this['paused']=0x0;for(var _0x900fb0=0x0;_0x900fb0=0x0?this[_0x6641('0x18')]:0x0;var _0x4f74f0={'id':this['id'],'available':this[_0x6641('0x18')],'loggedIn':this[_0x6641('0x14')],'name':this[_0x6641('0x8')],'paused':this[_0x6641('0x19')],'waiting':this[_0x6641('0xe')]};var _0x215f10=md5(JSON[_0x6641('0x1a')](_0x4f74f0));if(this[_0x6641('0x1')]!==_0x215f10){this[_0x6641('0x1')]=_0x215f10;io['to'](util['format'](_0x6641('0x1b'),_0x4f74f0[_0x6641('0x8')]))[_0x6641('0x1c')](_0x6641('0x1d'),_0x4f74f0);}};module[_0x6641('0x1e')]=WhatsappQueue; \ No newline at end of file +var _0x11cc=['prototype','_rr','map','Agents','loggedIn','paused','online','available','waiting','stringify','md5','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','updateRouting','updateRealtime'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0x11cc,0x1b4));var _0xc11c=function(_0x4d8b12,_0x29c0a7){_0x4d8b12=_0x4d8b12-0x0;var _0xb889bc=_0x11cc[_0x4d8b12];return _0xb889bc;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0xc11c('0x0'));var config=require(_0xc11c('0x1'));config['redis']=_[_0xc11c('0x2')](config[_0xc11c('0x3')],{'host':_0xc11c('0x4'),'port':0x18eb});var io=require(_0xc11c('0x5'))(new Redis(config[_0xc11c('0x3')]));function WhatsappQueue(_0x5dcef){this['id']=_0x5dcef['id']||0x0;this[_0xc11c('0x6')]=_0x5dcef[_0xc11c('0x6')]||'';this[_0xc11c('0x7')]=_0x5dcef[_0xc11c('0x7')]||0xa;this['strategy']=_0x5dcef[_0xc11c('0x8')]||'beepall';this['Agents']=_0x5dcef['Agents'];this[_0xc11c('0x9')]={};this['waiting']=0x0;this['md5']='';this[_0xc11c('0xa')]();this[_0xc11c('0xb')]();}WhatsappQueue[_0xc11c('0xc')][_0xc11c('0xa')]=function(){var _0x3e3055=this['mapAgentsId'][_0xc11c('0xd')];this[_0xc11c('0x9')]=_[_0xc11c('0xe')](this[_0xc11c('0xf')],'id');this[_0xc11c('0x9')][_0xc11c('0xd')]=_0x3e3055;};WhatsappQueue['prototype'][_0xc11c('0xb')]=function(){this[_0xc11c('0x10')]=0x0;this[_0xc11c('0x11')]=0x0;for(var _0x16dd4d=0x0;_0x16dd4d=0x0?this[_0xc11c('0x13')]:0x0;var _0x51328a={'id':this['id'],'available':this[_0xc11c('0x13')],'loggedIn':this[_0xc11c('0x10')],'name':this['name'],'paused':this[_0xc11c('0x11')],'waiting':this[_0xc11c('0x14')]};var _0x3c1577=md5(JSON[_0xc11c('0x15')](_0x51328a));if(this[_0xc11c('0x16')]!==_0x3c1577){this[_0xc11c('0x16')]=_0x3c1577;io['to'](util[_0xc11c('0x17')](_0xc11c('0x18'),_0x51328a[_0xc11c('0x6')]))[_0xc11c('0x19')](_0xc11c('0x1a'),_0x51328a);}};module[_0xc11c('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 5ff3df2..c4523ce 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 _0x9957=['../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','moment','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/faxQueue'];(function(_0x37f1a5,_0x29d439){var _0xb1f424=function(_0x3372a6){while(--_0x3372a6){_0x37f1a5['push'](_0x37f1a5['shift']());}};_0xb1f424(++_0x29d439);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var BPromise=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var _=require(_0x7995('0x2'));var moment=require(_0x7995('0x3'));var Agent=require('../model/agent');var Interval=require(_0x7995('0x4'));var OpenchannelQueue=require(_0x7995('0x5'));var ChatQueue=require(_0x7995('0x6'));var SmsQueue=require(_0x7995('0x7'));var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0x7995('0x8'));var WhatsappQueue=require(_0x7995('0x9'));var Realtime=function(){this[_0x7995('0xa')]={};this[_0x7995('0xb')]={};this[_0x7995('0xc')]={};this[_0x7995('0xd')]={};this['smsQueues']={};this[_0x7995('0xe')]={};this[_0x7995('0xf')]={};this['whatsappQueues']={};this[_0x7995('0x10')]={};this[_0x7995('0x11')]={};this[_0x7995('0x12')]={};this[_0x7995('0x13')]={};this[_0x7995('0x14')]={};this[_0x7995('0x15')]={};};function freeIsNotKey(_0x341672,_0x524f7b,_0x245143){var _0x41c652=_['mapKeys'](_0x341672,function(_0xb0c872,_0x2cb37a){return _0xb0c872[_0x245143];});for(var _0x19a27e in _0x524f7b){if(_0x524f7b[_0x7995('0x16')](_0x19a27e)){if(!_0x41c652[_0x19a27e]){delete _0x524f7b[_0x19a27e];}}}}Realtime[_0x7995('0x17')][_0x7995('0x18')]=function(_0x2bbe7a,_0x4cc004){for(var _0x58f5ad in _0x4cc004){if(_0x2bbe7a[_0x7995('0x16')](_0x58f5ad)){_0x2bbe7a[_0x58f5ad]=_0x4cc004[_0x58f5ad];}}};Realtime[_0x7995('0x17')][_0x7995('0x19')]=function(){var _0x321ae8=this;return function(_0x3f1d3e){if(_0x3f1d3e){freeIsNotKey(_0x3f1d3e,_0x321ae8[_0x7995('0xa')],'id');for(var _0x2202ce=0x0,_0x41cbf0={},_0x5377e5={};_0x2202ce<_0x3f1d3e[_0x7995('0x1a')];_0x2202ce+=0x1){_0x41cbf0=_0x3f1d3e[_0x2202ce];if(_['isUndefined'](_0x321ae8[_0x7995('0xa')][_0x41cbf0['id']])){_0x321ae8[_0x7995('0xa')][_0x41cbf0['id']]=new Agent(_0x41cbf0);}else{_0x321ae8[_0x7995('0x18')](_0x321ae8[_0x7995('0xa')][_0x41cbf0['id']],_0x41cbf0);}}}return _0x321ae8[_0x7995('0xa')];};};Realtime[_0x7995('0x17')]['initIntervals']=function(){var _0x54c9ae=this;return function(_0x2536c8){if(_0x2536c8){freeIsNotKey(_0x2536c8,_0x54c9ae['intervals'],'id');for(var _0x555f74=0x0,_0x3ec178={},_0x3d463e={};_0x555f74<_0x2536c8['length'];_0x555f74+=0x1){_0x3ec178=_0x2536c8[_0x555f74];if(_[_0x7995('0x1b')](_0x54c9ae['intervals'][_0x3ec178['id']])){_0x54c9ae['intervals'][_0x3ec178['id']]=new Interval(_0x3ec178);}else{_0x54c9ae[_0x7995('0x18')](_0x54c9ae[_0x7995('0xb')][_0x3ec178['id']],_0x3ec178);}}}return _0x54c9ae[_0x7995('0xb')];};};Realtime[_0x7995('0x17')][_0x7995('0x1c')]=function(){var _0x1c278a=this;return function(_0x5d40ae){if(_0x5d40ae){freeIsNotKey(_0x5d40ae,_0x1c278a[_0x7995('0xc')],'id');for(var _0x46ee4b=0x0,_0x204507={},_0x285437={};_0x46ee4b<_0x5d40ae[_0x7995('0x1a')];_0x46ee4b+=0x1){_0x204507=_0x5d40ae[_0x46ee4b];if(_[_0x7995('0x1b')](_0x1c278a[_0x7995('0xc')][_0x204507['id']])){_0x1c278a[_0x7995('0xc')][_0x204507['id']]=new OpenchannelQueue(_0x204507);}else{_0x1c278a['mergeFromDatabase'](_0x1c278a[_0x7995('0xc')][_0x204507['id']],_0x204507);}_0x1c278a[_0x7995('0xc')][_0x204507['id']][_0x7995('0x1d')]();_0x1c278a[_0x7995('0xc')][_0x204507['id']][_0x7995('0x1e')]();}}return _0x1c278a[_0x7995('0xc')];};};Realtime['prototype'][_0x7995('0x1f')]=function(){var _0x5911c3=this;return function(_0x229742){if(_0x229742){freeIsNotKey(_0x229742,_0x5911c3[_0x7995('0xd')],'id');for(var _0xf16cc2=0x0,_0x132a42={},_0x11c1eb={};_0xf16cc2<_0x229742['length'];_0xf16cc2+=0x1){_0x132a42=_0x229742[_0xf16cc2];if(_[_0x7995('0x1b')](_0x5911c3['chatQueues'][_0x132a42['id']])){_0x5911c3[_0x7995('0xd')][_0x132a42['id']]=new ChatQueue(_0x132a42);}else{_0x5911c3[_0x7995('0x18')](_0x5911c3[_0x7995('0xd')][_0x132a42['id']],_0x132a42);}_0x5911c3['chatQueues'][_0x132a42['id']]['updateRouting']();_0x5911c3['chatQueues'][_0x132a42['id']][_0x7995('0x1e')]();}}return _0x5911c3[_0x7995('0xd')];};};Realtime[_0x7995('0x17')][_0x7995('0x20')]=function(){var _0x2e3493=this;return function(_0x1ca460){if(_0x1ca460){freeIsNotKey(_0x1ca460,_0x2e3493['smsQueues'],'id');for(var _0x481c74=0x0,_0xfa8f15={},_0x5524af={};_0x481c74<_0x1ca460[_0x7995('0x1a')];_0x481c74+=0x1){_0xfa8f15=_0x1ca460[_0x481c74];if(_[_0x7995('0x1b')](_0x2e3493[_0x7995('0x21')][_0xfa8f15['id']])){_0x2e3493[_0x7995('0x21')][_0xfa8f15['id']]=new SmsQueue(_0xfa8f15);}else{_0x2e3493[_0x7995('0x18')](_0x2e3493['smsQueues'][_0xfa8f15['id']],_0xfa8f15);}_0x2e3493[_0x7995('0x21')][_0xfa8f15['id']][_0x7995('0x1d')]();_0x2e3493['smsQueues'][_0xfa8f15['id']]['updateRealtime']();}}return _0x2e3493['smsQueues'];};};Realtime[_0x7995('0x17')][_0x7995('0x22')]=function(){var _0x4a176f=this;return function(_0x3e7020){if(_0x3e7020){freeIsNotKey(_0x3e7020,_0x4a176f['mailQueues'],'id');for(var _0x37917b=0x0,_0x1cb058={},_0x177cb4={};_0x37917b<_0x3e7020['length'];_0x37917b+=0x1){_0x1cb058=_0x3e7020[_0x37917b];if(_['isUndefined'](_0x4a176f[_0x7995('0xe')][_0x1cb058['id']])){_0x4a176f['mailQueues'][_0x1cb058['id']]=new MailQueue(_0x1cb058);}else{_0x4a176f['mergeFromDatabase'](_0x4a176f[_0x7995('0xe')][_0x1cb058['id']],_0x1cb058);}_0x4a176f[_0x7995('0xe')][_0x1cb058['id']]['updateRouting']();_0x4a176f[_0x7995('0xe')][_0x1cb058['id']][_0x7995('0x1e')]();}}return _0x4a176f[_0x7995('0xe')];};};Realtime[_0x7995('0x17')][_0x7995('0x23')]=function(){var _0x53002a=this;return function(_0x2d4285){if(_0x2d4285){freeIsNotKey(_0x2d4285,_0x53002a[_0x7995('0xf')],'id');for(var _0xf612e6=0x0,_0x1d60b8={},_0x4b1541={};_0xf612e6<_0x2d4285[_0x7995('0x1a')];_0xf612e6+=0x1){_0x1d60b8=_0x2d4285[_0xf612e6];if(_[_0x7995('0x1b')](_0x53002a[_0x7995('0xf')][_0x1d60b8['id']])){_0x53002a[_0x7995('0xf')][_0x1d60b8['id']]=new FaxQueue(_0x1d60b8);}else{_0x53002a[_0x7995('0x18')](_0x53002a[_0x7995('0xf')][_0x1d60b8['id']],_0x1d60b8);}_0x53002a['faxQueues'][_0x1d60b8['id']][_0x7995('0x1d')]();_0x53002a[_0x7995('0xf')][_0x1d60b8['id']][_0x7995('0x1e')]();}}return _0x53002a[_0x7995('0xf')];};};Realtime[_0x7995('0x17')][_0x7995('0x24')]=function(){var _0x14d638=this;return function(_0x270c0e){if(_0x270c0e){freeIsNotKey(_0x270c0e,_0x14d638[_0x7995('0x25')],'id');for(var _0x447981=0x0,_0x6fe77b={},_0x270d52={};_0x447981<_0x270c0e[_0x7995('0x1a')];_0x447981+=0x1){_0x6fe77b=_0x270c0e[_0x447981];if(_['isUndefined'](_0x14d638['whatsappQueues'][_0x6fe77b['id']])){_0x14d638[_0x7995('0x25')][_0x6fe77b['id']]=new WhatsappQueue(_0x6fe77b);}else{_0x14d638[_0x7995('0x18')](_0x14d638['whatsappQueues'][_0x6fe77b['id']],_0x6fe77b);}_0x14d638['whatsappQueues'][_0x6fe77b['id']][_0x7995('0x1d')]();_0x14d638['whatsappQueues'][_0x6fe77b['id']]['updateRealtime']();}}return _0x14d638[_0x7995('0x25')];};};module[_0x7995('0x26')]=Realtime; \ No newline at end of file +var _0x008c=['faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','mergeFromDatabase','updateRealtime','chatQueues','updateRouting','initSmsQueues','initMailQueues','mailQueues','initFaxQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','smsQueues'];(function(_0x2e28b6,_0x1eafdd){var _0x4564e0=function(_0x5e985e){while(--_0x5e985e){_0x2e28b6['push'](_0x2e28b6['shift']());}};_0x4564e0(++_0x1eafdd);}(_0x008c,0x188));var _0xc008=function(_0x9b2bb0,_0x3965b1){_0x9b2bb0=_0x9b2bb0-0x0;var _0x2cdb3b=_0x008c[_0x9b2bb0];return _0x2cdb3b;};'use strict';var BPromise=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var _=require(_0xc008('0x2'));var moment=require(_0xc008('0x3'));var Agent=require(_0xc008('0x4'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xc008('0x5'));var ChatQueue=require(_0xc008('0x6'));var SmsQueue=require(_0xc008('0x7'));var MailQueue=require(_0xc008('0x8'));var FaxQueue=require(_0xc008('0x9'));var WhatsappQueue=require(_0xc008('0xa'));var Realtime=function(){this[_0xc008('0xb')]={};this[_0xc008('0xc')]={};this[_0xc008('0xd')]={};this['chatQueues']={};this[_0xc008('0xe')]={};this['mailQueues']={};this[_0xc008('0xf')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0xc008('0x10')]={};this[_0xc008('0x11')]={};this['smsQueuesWaitingInteractions']={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x1eacfa,_0xc881aa,_0x5b2004){var _0xae2dab=_[_0xc008('0x12')](_0x1eacfa,function(_0x2ea200,_0x2a5b4e){return _0x2ea200[_0x5b2004];});for(var _0x9ffa93 in _0xc881aa){if(_0xc881aa[_0xc008('0x13')](_0x9ffa93)){if(!_0xae2dab[_0x9ffa93]){delete _0xc881aa[_0x9ffa93];}}}}Realtime[_0xc008('0x14')]['mergeFromDatabase']=function(_0x560e28,_0x33f44c){for(var _0x50c1ab in _0x33f44c){if(_0x560e28[_0xc008('0x13')](_0x50c1ab)){_0x560e28[_0x50c1ab]=_0x33f44c[_0x50c1ab];}}};Realtime[_0xc008('0x14')][_0xc008('0x15')]=function(){var _0x339ffc=this;return function(_0x3f0ecf){if(_0x3f0ecf){freeIsNotKey(_0x3f0ecf,_0x339ffc['agents'],'id');for(var _0x5e894e=0x0,_0x4bd0f4={},_0x11ef38={};_0x5e894e<_0x3f0ecf[_0xc008('0x16')];_0x5e894e+=0x1){_0x4bd0f4=_0x3f0ecf[_0x5e894e];if(_[_0xc008('0x17')](_0x339ffc[_0xc008('0xb')][_0x4bd0f4['id']])){_0x339ffc['agents'][_0x4bd0f4['id']]=new Agent(_0x4bd0f4);}else{_0x339ffc['mergeFromDatabase'](_0x339ffc['agents'][_0x4bd0f4['id']],_0x4bd0f4);}}}return _0x339ffc['agents'];};};Realtime[_0xc008('0x14')][_0xc008('0x18')]=function(){var _0x501137=this;return function(_0x813397){if(_0x813397){freeIsNotKey(_0x813397,_0x501137['intervals'],'id');for(var _0x4bd611=0x0,_0x543e5d={},_0x50261c={};_0x4bd611<_0x813397[_0xc008('0x16')];_0x4bd611+=0x1){_0x543e5d=_0x813397[_0x4bd611];if(_['isUndefined'](_0x501137['intervals'][_0x543e5d['id']])){_0x501137['intervals'][_0x543e5d['id']]=new Interval(_0x543e5d);}else{_0x501137['mergeFromDatabase'](_0x501137['intervals'][_0x543e5d['id']],_0x543e5d);}}}return _0x501137[_0xc008('0xc')];};};Realtime[_0xc008('0x14')][_0xc008('0x19')]=function(){var _0x415af3=this;return function(_0x11cc75){if(_0x11cc75){freeIsNotKey(_0x11cc75,_0x415af3[_0xc008('0xd')],'id');for(var _0x4f43e2=0x0,_0x459fd9={},_0x5c85f2={};_0x4f43e2<_0x11cc75['length'];_0x4f43e2+=0x1){_0x459fd9=_0x11cc75[_0x4f43e2];if(_[_0xc008('0x17')](_0x415af3[_0xc008('0xd')][_0x459fd9['id']])){_0x415af3[_0xc008('0xd')][_0x459fd9['id']]=new OpenchannelQueue(_0x459fd9);}else{_0x415af3[_0xc008('0x1a')](_0x415af3['openchannelQueues'][_0x459fd9['id']],_0x459fd9);}_0x415af3['openchannelQueues'][_0x459fd9['id']]['updateRouting']();_0x415af3[_0xc008('0xd')][_0x459fd9['id']][_0xc008('0x1b')]();}}return _0x415af3[_0xc008('0xd')];};};Realtime[_0xc008('0x14')]['initChatQueues']=function(){var _0x5e2aca=this;return function(_0x4fce9c){if(_0x4fce9c){freeIsNotKey(_0x4fce9c,_0x5e2aca['chatQueues'],'id');for(var _0x4caaf4=0x0,_0x3865c0={},_0x29ba43={};_0x4caaf4<_0x4fce9c[_0xc008('0x16')];_0x4caaf4+=0x1){_0x3865c0=_0x4fce9c[_0x4caaf4];if(_['isUndefined'](_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']])){_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']]=new ChatQueue(_0x3865c0);}else{_0x5e2aca[_0xc008('0x1a')](_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']],_0x3865c0);}_0x5e2aca['chatQueues'][_0x3865c0['id']][_0xc008('0x1d')]();_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']]['updateRealtime']();}}return _0x5e2aca['chatQueues'];};};Realtime['prototype'][_0xc008('0x1e')]=function(){var _0x267abd=this;return function(_0xf831f2){if(_0xf831f2){freeIsNotKey(_0xf831f2,_0x267abd[_0xc008('0xe')],'id');for(var _0x1de04b=0x0,_0xceebc3={},_0x294f97={};_0x1de04b<_0xf831f2[_0xc008('0x16')];_0x1de04b+=0x1){_0xceebc3=_0xf831f2[_0x1de04b];if(_[_0xc008('0x17')](_0x267abd[_0xc008('0xe')][_0xceebc3['id']])){_0x267abd[_0xc008('0xe')][_0xceebc3['id']]=new SmsQueue(_0xceebc3);}else{_0x267abd[_0xc008('0x1a')](_0x267abd['smsQueues'][_0xceebc3['id']],_0xceebc3);}_0x267abd[_0xc008('0xe')][_0xceebc3['id']][_0xc008('0x1d')]();_0x267abd['smsQueues'][_0xceebc3['id']][_0xc008('0x1b')]();}}return _0x267abd[_0xc008('0xe')];};};Realtime[_0xc008('0x14')][_0xc008('0x1f')]=function(){var _0xd0e05a=this;return function(_0x3cd878){if(_0x3cd878){freeIsNotKey(_0x3cd878,_0xd0e05a[_0xc008('0x20')],'id');for(var _0x470e79=0x0,_0x29d4b3={},_0x4f14d2={};_0x470e79<_0x3cd878[_0xc008('0x16')];_0x470e79+=0x1){_0x29d4b3=_0x3cd878[_0x470e79];if(_[_0xc008('0x17')](_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']])){_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']]=new MailQueue(_0x29d4b3);}else{_0xd0e05a[_0xc008('0x1a')](_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']],_0x29d4b3);}_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']]['updateRouting']();_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']][_0xc008('0x1b')]();}}return _0xd0e05a['mailQueues'];};};Realtime[_0xc008('0x14')][_0xc008('0x21')]=function(){var _0x5e38d5=this;return function(_0x263473){if(_0x263473){freeIsNotKey(_0x263473,_0x5e38d5[_0xc008('0xf')],'id');for(var _0x280e9b=0x0,_0x55ff48={},_0x53b353={};_0x280e9b<_0x263473['length'];_0x280e9b+=0x1){_0x55ff48=_0x263473[_0x280e9b];if(_[_0xc008('0x17')](_0x5e38d5['faxQueues'][_0x55ff48['id']])){_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']]=new FaxQueue(_0x55ff48);}else{_0x5e38d5[_0xc008('0x1a')](_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']],_0x55ff48);}_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']][_0xc008('0x1d')]();_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']][_0xc008('0x1b')]();}}return _0x5e38d5[_0xc008('0xf')];};};Realtime[_0xc008('0x14')][_0xc008('0x22')]=function(){var _0x3ebb83=this;return function(_0xdfca2e){if(_0xdfca2e){freeIsNotKey(_0xdfca2e,_0x3ebb83[_0xc008('0x23')],'id');for(var _0x2bf3fd=0x0,_0x4cace5={},_0x3238b4={};_0x2bf3fd<_0xdfca2e[_0xc008('0x16')];_0x2bf3fd+=0x1){_0x4cace5=_0xdfca2e[_0x2bf3fd];if(_[_0xc008('0x17')](_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']])){_0x3ebb83['whatsappQueues'][_0x4cace5['id']]=new WhatsappQueue(_0x4cace5);}else{_0x3ebb83[_0xc008('0x1a')](_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']],_0x4cace5);}_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']][_0xc008('0x1d')]();_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']]['updateRealtime']();}}return _0x3ebb83[_0xc008('0x23')];};};module[_0xc008('0x24')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index ee8db0d..4212fca 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 _0xb38d=['UpdateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','update','Request'];(function(_0xbf2aa0,_0x34d471){var _0x516d16=function(_0x44bd6f){while(--_0x44bd6f){_0xbf2aa0['push'](_0xbf2aa0['shift']());}};_0x516d16(++_0x34d471);}(_0xb38d,0x154));var _0xdb38=function(_0xb8111f,_0x2b0a3b){_0xb8111f=_0xb8111f-0x0;var _0x233d1b=_0xb38d[_0xb8111f];return _0x233d1b;};'use strict';var client=require('../client');exports[_0xdb38('0x0')]=function(_0x5b8324,_0x4c51a7){return client[_0xdb38('0x1')](_0xdb38('0x2'),{'body':_0x4c51a7,'options':{'where':{'id':_0x5b8324}},'log':'updateChatInteraction'});};exports[_0xdb38('0x3')]=function(_0x2f3221,_0x435b81){return client[_0xdb38('0x1')](_0xdb38('0x4'),{'body':_0x435b81,'options':{'where':{'id':_0x2f3221}},'log':_0xdb38('0x5')});}; \ No newline at end of file +var _0xe7a2=['addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xe7a2,0x1ac));var _0x2e7a=function(_0x5b964b,_0xe2062a){_0x5b964b=_0x5b964b-0x0;var _0x2f187d=_0xe7a2[_0x5b964b];return _0x2f187d;};'use strict';var client=require(_0x2e7a('0x0'));exports[_0x2e7a('0x1')]=function(_0x1b1330,_0x5f1244){return client[_0x2e7a('0x2')](_0x2e7a('0x3'),{'body':_0x5f1244,'options':{'where':{'id':_0x1b1330}},'log':_0x2e7a('0x4')});};exports['addTags']=function(_0x330aad,_0x63685f){return client['Request'](_0x2e7a('0x5'),{'body':_0x63685f,'options':{'where':{'id':_0x330aad}},'log':_0x2e7a('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 3a085c8..228b12f 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 _0x465a=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0x33bb07,_0x5b1849){var _0x481c81=function(_0x1709f0){while(--_0x1709f0){_0x33bb07['push'](_0x33bb07['shift']());}};_0x481c81(++_0x5b1849);}(_0x465a,0xb3));var _0xa465=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x465a[_0x502c7d];return _0x30b7ed;};'use strict';var client=require(_0xa465('0x0'));exports[_0xa465('0x1')]=function(_0x7a753c){return client[_0xa465('0x2')](_0xa465('0x3'),{'body':_0x7a753c,'log':_0xa465('0x4')});}; \ No newline at end of file +var _0x087b=['CreateChatMessage','../client','create','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x087b,0x15d));var _0xb087=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x087b[_0x525c7b];return _0x27b33e;};'use strict';var client=require(_0xb087('0x0'));exports[_0xb087('0x1')]=function(_0x385313){return client[_0xb087('0x2')](_0xb087('0x3'),{'body':_0x385313,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 0a4bb6e..1e3ad92 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 _0x0bb8=['GetChatQueue','name','strategy','User','Agents','online','chatPause','../client','getChatQueues','Request'];(function(_0x4ef189,_0x31f630){var _0x2671e4=function(_0x2291fc){while(--_0x2291fc){_0x4ef189['push'](_0x4ef189['shift']());}};_0x2671e4(++_0x31f630);}(_0x0bb8,0xf7));var _0x80bb=function(_0x89bcad,_0x36cadc){_0x89bcad=_0x89bcad-0x0;var _0x4d2b69=_0x0bb8[_0x89bcad];return _0x4d2b69;};'use strict';var client=require(_0x80bb('0x0'));exports[_0x80bb('0x1')]=function(){return function(){return client[_0x80bb('0x2')](_0x80bb('0x3'),{'options':{'raw':![],'attributes':['id',_0x80bb('0x4'),'timeout',_0x80bb('0x5')],'include':[{'model':_0x80bb('0x6'),'as':_0x80bb('0x7'),'attributes':['id','name',_0x80bb('0x8'),_0x80bb('0x9')]}]},'log':_0x80bb('0x1')});};}; \ No newline at end of file +var _0x179f=['Request','name','timeout','strategy','User','Agents','online','chatPause','../client','getChatQueues'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x179f,0x12a));var _0xf179=function(_0x212a0f,_0x2c5f5c){_0x212a0f=_0x212a0f-0x0;var _0x3e13e5=_0x179f[_0x212a0f];return _0x3e13e5;};'use strict';var client=require(_0xf179('0x0'));exports[_0xf179('0x1')]=function(){return function(){return client[_0xf179('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xf179('0x3'),_0xf179('0x4'),_0xf179('0x5')],'include':[{'model':_0xf179('0x6'),'as':_0xf179('0x7'),'attributes':['id',_0xf179('0x3'),_0xf179('0x8'),_0xf179('0x9')]}]},'log':_0xf179('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 44859e3..a5721a9 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 _0x6ff1=['UpdateChatQueueReport','DESC','../client','create','Request','update'];(function(_0x5c5bdc,_0x4c3f09){var _0x58599b=function(_0x39d7da){while(--_0x39d7da){_0x5c5bdc['push'](_0x5c5bdc['shift']());}};_0x58599b(++_0x4c3f09);}(_0x6ff1,0x10a));var _0x16ff=function(_0x1f07ba,_0x2ecf8f){_0x1f07ba=_0x1f07ba-0x0;var _0x298a1e=_0x6ff1[_0x1f07ba];return _0x298a1e;};'use strict';var client=require(_0x16ff('0x0'));exports[_0x16ff('0x1')]=function(_0x3c9b86){return client[_0x16ff('0x2')]('CreateChatQueueReport',{'body':_0x3c9b86,'log':'CreateChatQueueReport'});};exports[_0x16ff('0x3')]=function(_0x5cca46,_0x1db386){return client[_0x16ff('0x2')](_0x16ff('0x4'),{'body':_0x1db386,'options':{'where':{'uniqueid':_0x5cca46},'order':[['id',_0x16ff('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xb18e=['CreateChatQueueReport','update','Request','UpdateChatQueueReport','DESC'];(function(_0x131701,_0x13ce8e){var _0x5219c8=function(_0x10a644){while(--_0x10a644){_0x131701['push'](_0x131701['shift']());}};_0x5219c8(++_0x13ce8e);}(_0xb18e,0x181));var _0xeb18=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xb18e[_0x13ea00];return _0x1f7347;};'use strict';var client=require('../client');exports['create']=function(_0x1c3091){return client['Request'](_0xeb18('0x0'),{'body':_0x1c3091,'log':'CreateChatQueueReport'});};exports[_0xeb18('0x1')]=function(_0x1bf23e,_0x5d5ff9){return client[_0xeb18('0x2')](_0xeb18('0x3'),{'body':_0x5d5ff9,'options':{'where':{'uniqueid':_0x1bf23e},'order':[['id',_0xeb18('0x4')]],'limit':0x1},'log':_0xeb18('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 9f0cef0..44b89f9 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 _0xc908=['updateFaxInteraction','addTags','../client','update','Request','UpdateFaxInteraction'];(function(_0x5a32cd,_0x5c72a7){var _0x5e7c72=function(_0x1aaad5){while(--_0x1aaad5){_0x5a32cd['push'](_0x5a32cd['shift']());}};_0x5e7c72(++_0x5c72a7);}(_0xc908,0x1a0));var _0x8c90=function(_0x1c06f4,_0x2feba6){_0x1c06f4=_0x1c06f4-0x0;var _0x1a727e=_0xc908[_0x1c06f4];return _0x1a727e;};'use strict';var client=require(_0x8c90('0x0'));exports[_0x8c90('0x1')]=function(_0x36c599,_0x48980b){return client[_0x8c90('0x2')](_0x8c90('0x3'),{'body':_0x48980b,'options':{'where':{'id':_0x36c599}},'log':_0x8c90('0x4')});};exports[_0x8c90('0x5')]=function(_0x7d5731,_0x4cdb84){return client['Request']('AddTagsToFaxInteraction',{'body':_0x4cdb84,'options':{'where':{'id':_0x7d5731}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0xdf27=['AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','Request','updateFaxInteraction','addTags'];(function(_0x258952,_0x5129f4){var _0x4b693a=function(_0x3404c0){while(--_0x3404c0){_0x258952['push'](_0x258952['shift']());}};_0x4b693a(++_0x5129f4);}(_0xdf27,0xe6));var _0x7df2=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xdf27[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x7df2('0x0'));exports['update']=function(_0x511792,_0x481315){return client[_0x7df2('0x1')]('UpdateFaxInteraction',{'body':_0x481315,'options':{'where':{'id':_0x511792}},'log':_0x7df2('0x2')});};exports[_0x7df2('0x3')]=function(_0x14b0ad,_0x187d19){return client[_0x7df2('0x1')](_0x7df2('0x4'),{'body':_0x187d19,'options':{'where':{'id':_0x14b0ad}},'log':_0x7df2('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 578fca8..c001722 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 _0xd050=['../client','create','CreateFaxMessage','createFaxMessage'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xd050,0xfc));var _0x0d05=function(_0x4b5940,_0x5ea620){_0x4b5940=_0x4b5940-0x0;var _0x5092b6=_0xd050[_0x4b5940];return _0x5092b6;};'use strict';var client=require(_0x0d05('0x0'));exports[_0x0d05('0x1')]=function(_0x17f0d2){return client['Request'](_0x0d05('0x2'),{'body':_0x17f0d2,'log':_0x0d05('0x3')});}; \ No newline at end of file +var _0xf454=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x2c85c0,_0x1dac4f){var _0xf4d4c9=function(_0xcd61ab){while(--_0xcd61ab){_0x2c85c0['push'](_0x2c85c0['shift']());}};_0xf4d4c9(++_0x1dac4f);}(_0xf454,0x12a));var _0x4f45=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xf454[_0x3ab51d];return _0x29a04e;};'use strict';var client=require(_0x4f45('0x0'));exports[_0x4f45('0x1')]=function(_0x4f86e5){return client[_0x4f45('0x2')](_0x4f45('0x3'),{'body':_0x4f86e5,'log':_0x4f45('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index c7b39c0..bcdedbe 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 _0xdb82=['name','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','timeout','strategy','User','Agents'];(function(_0x228d18,_0x94e5c0){var _0x4c601d=function(_0xea6fec){while(--_0xea6fec){_0x228d18['push'](_0x228d18['shift']());}};_0x4c601d(++_0x94e5c0);}(_0xdb82,0x9d));var _0x2db8=function(_0x19d1ff,_0x48b7c2){_0x19d1ff=_0x19d1ff-0x0;var _0x838faa=_0xdb82[_0x19d1ff];return _0x838faa;};'use strict';var client=require(_0x2db8('0x0'));exports[_0x2db8('0x1')]=function(){return function(){return client[_0x2db8('0x2')](_0x2db8('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x2db8('0x4'),_0x2db8('0x5')],'include':[{'model':_0x2db8('0x6'),'as':_0x2db8('0x7'),'attributes':['id',_0x2db8('0x8'),_0x2db8('0x9'),_0x2db8('0xa')]}]},'log':_0x2db8('0x1')});};}; \ No newline at end of file +var _0x3d03=['../client','GetFaxQueue','name','timeout','strategy','User','online','getFaxQueues'];(function(_0x15e0c9,_0x36f886){var _0x46744a=function(_0x31d7b6){while(--_0x31d7b6){_0x15e0c9['push'](_0x15e0c9['shift']());}};_0x46744a(++_0x36f886);}(_0x3d03,0x1b0));var _0x33d0=function(_0x4e5cc,_0x4a79cd){_0x4e5cc=_0x4e5cc-0x0;var _0x252a7d=_0x3d03[_0x4e5cc];return _0x252a7d;};'use strict';var client=require(_0x33d0('0x0'));exports['getFaxQueues']=function(){return function(){return client['Request'](_0x33d0('0x1'),{'options':{'raw':![],'attributes':['id',_0x33d0('0x2'),_0x33d0('0x3'),_0x33d0('0x4')],'include':[{'model':_0x33d0('0x5'),'as':'Agents','attributes':['id',_0x33d0('0x2'),_0x33d0('0x6'),'faxPause']}]},'log':_0x33d0('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 7c9b26d..d56697e 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 _0x7969=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','create'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x7969,0x83));var _0x9796=function(_0x26d3bc,_0x90d6e9){_0x26d3bc=_0x26d3bc-0x0;var _0x33e452=_0x7969[_0x26d3bc];return _0x33e452;};'use strict';var client=require('../client');exports[_0x9796('0x0')]=function(_0x45ff53){return client[_0x9796('0x1')](_0x9796('0x2'),{'body':_0x45ff53,'log':_0x9796('0x2')});};exports[_0x9796('0x3')]=function(_0x3e3250,_0x4c1c5f){return client[_0x9796('0x1')](_0x9796('0x4'),{'body':_0x4c1c5f,'options':{'where':{'uniqueid':_0x3e3250},'order':[['id',_0x9796('0x5')]],'limit':0x1},'log':_0x9796('0x4')});}; \ No newline at end of file +var _0x7fac=['CreateFaxQueueReport','update','Request','UpdateFaxQueueReport','DESC','../client'];(function(_0x201f57,_0x2e1986){var _0x399e7a=function(_0x39e03d){while(--_0x39e03d){_0x201f57['push'](_0x201f57['shift']());}};_0x399e7a(++_0x2e1986);}(_0x7fac,0x137));var _0xc7fa=function(_0x2786ea,_0x16c3c3){_0x2786ea=_0x2786ea-0x0;var _0x5c38e5=_0x7fac[_0x2786ea];return _0x5c38e5;};'use strict';var client=require(_0xc7fa('0x0'));exports['create']=function(_0x2abe0c){return client['Request'](_0xc7fa('0x1'),{'body':_0x2abe0c,'log':_0xc7fa('0x1')});};exports[_0xc7fa('0x2')]=function(_0x58eb47,_0x444b3){return client[_0xc7fa('0x3')](_0xc7fa('0x4'),{'body':_0x444b3,'options':{'where':{'uniqueid':_0x58eb47},'order':[['id',_0xc7fa('0x5')]],'limit':0x1},'log':_0xc7fa('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index ece21c3..7956d6c 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 _0xe493=['../client','getIntervals','Request','GetInterval','name','Intervals'];(function(_0x3c3703,_0x506166){var _0x369b84=function(_0x24b7b9){while(--_0x24b7b9){_0x3c3703['push'](_0x3c3703['shift']());}};_0x369b84(++_0x506166);}(_0xe493,0x7e));var _0x3e49=function(_0xb6f267,_0x39b2d1){_0xb6f267=_0xb6f267-0x0;var _0x25ba97=_0xe493[_0xb6f267];return _0x25ba97;};'use strict';var client=require(_0x3e49('0x0'));exports[_0x3e49('0x1')]=function(){return function(){return client[_0x3e49('0x2')](_0x3e49('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x3e49('0x4')],'include':[{'model':'Interval','as':_0x3e49('0x5'),'attributes':['id',_0x3e49('0x4'),'interval']}]},'log':_0x3e49('0x1')});};}; \ No newline at end of file +var _0x3c81=['GetInterval','name','../client','getIntervals'];(function(_0x2cb22b,_0x2c358e){var _0x96de99=function(_0x5245a8){while(--_0x5245a8){_0x2cb22b['push'](_0x2cb22b['shift']());}};_0x96de99(++_0x2c358e);}(_0x3c81,0x102));var _0x13c8=function(_0x8a5ea8,_0x12a569){_0x8a5ea8=_0x8a5ea8-0x0;var _0x2b3797=_0x3c81[_0x8a5ea8];return _0x2b3797;};'use strict';var client=require(_0x13c8('0x0'));exports[_0x13c8('0x1')]=function(){return function(){return client['Request'](_0x13c8('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x13c8('0x3')],'include':[{'model':'Interval','as':'Intervals','attributes':['id','name','interval']}]},'log':_0x13c8('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 161dec3..e87c3ef 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 _0x4cba=['update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x161d15,_0x5c495b){var _0x557970=function(_0x34394e){while(--_0x34394e){_0x161d15['push'](_0x161d15['shift']());}};_0x557970(++_0x5c495b);}(_0x4cba,0xbf));var _0xa4cb=function(_0x24e5e9,_0x4ae39a){_0x24e5e9=_0x24e5e9-0x0;var _0x321bca=_0x4cba[_0x24e5e9];return _0x321bca;};'use strict';var client=require(_0xa4cb('0x0'));exports[_0xa4cb('0x1')]=function(_0x40c90b,_0xb0c55b){return client[_0xa4cb('0x2')](_0xa4cb('0x3'),{'body':_0xb0c55b,'options':{'where':{'id':_0x40c90b}},'log':_0xa4cb('0x4')});};exports[_0xa4cb('0x5')]=function(_0x5951c2,_0x31ec5f){return client[_0xa4cb('0x2')](_0xa4cb('0x6'),{'body':_0x31ec5f,'options':{'where':{'id':_0x5951c2}},'log':_0xa4cb('0x7')});}; \ No newline at end of file +var _0xab02=['addTags','AddTagsToMailInteraction','Request','updateMailInteraction'];(function(_0x5a12ff,_0x2e18db){var _0x285f8d=function(_0x431de4){while(--_0x431de4){_0x5a12ff['push'](_0x5a12ff['shift']());}};_0x285f8d(++_0x2e18db);}(_0xab02,0x9e));var _0x2ab0=function(_0x1741ae,_0x18c80f){_0x1741ae=_0x1741ae-0x0;var _0x3402cb=_0xab02[_0x1741ae];return _0x3402cb;};'use strict';var client=require('../client');exports['update']=function(_0x2a3502,_0x35916b){return client[_0x2ab0('0x0')]('UpdateMailInteraction',{'body':_0x35916b,'options':{'where':{'id':_0x2a3502}},'log':_0x2ab0('0x1')});};exports[_0x2ab0('0x2')]=function(_0x252602,_0x19b2d9){return client['Request'](_0x2ab0('0x3'),{'body':_0x19b2d9,'options':{'where':{'id':_0x252602}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index dcceb55..f0b0ed6 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 _0xde89=['create','Request','../client'];(function(_0x4fe3bd,_0x39d568){var _0x51de54=function(_0x5c2a0c){while(--_0x5c2a0c){_0x4fe3bd['push'](_0x4fe3bd['shift']());}};_0x51de54(++_0x39d568);}(_0xde89,0x1ac));var _0x9de8=function(_0x566bdf,_0x1f4861){_0x566bdf=_0x566bdf-0x0;var _0x331215=_0xde89[_0x566bdf];return _0x331215;};'use strict';var client=require(_0x9de8('0x0'));exports[_0x9de8('0x1')]=function(_0x18142e){return client[_0x9de8('0x2')]('CreateMailMessage',{'body':_0x18142e,'log':'createMailMessage'});}; \ No newline at end of file +var _0x9bbf=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0x4b40cb,_0x272fb8){var _0x551c10=function(_0x312721){while(--_0x312721){_0x4b40cb['push'](_0x4b40cb['shift']());}};_0x551c10(++_0x272fb8);}(_0x9bbf,0xf3));var _0xf9bb=function(_0x51d488,_0x5c02e8){_0x51d488=_0x51d488-0x0;var _0x18549d=_0x9bbf[_0x51d488];return _0x18549d;};'use strict';var client=require(_0xf9bb('0x0'));exports[_0xf9bb('0x1')]=function(_0x17326a){return client[_0xf9bb('0x2')](_0xf9bb('0x3'),{'body':_0x17326a,'log':_0xf9bb('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index d523c49..a3f0e86 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 _0xe37d=['../client','getMailQueues','GetMailQueue','name','timeout','strategy','Agents','mailPause'];(function(_0x39488e,_0x4d61cf){var _0x3389cd=function(_0x2172b3){while(--_0x2172b3){_0x39488e['push'](_0x39488e['shift']());}};_0x3389cd(++_0x4d61cf);}(_0xe37d,0x178));var _0xde37=function(_0x53ad60,_0x5a26e6){_0x53ad60=_0x53ad60-0x0;var _0x1eb6fb=_0xe37d[_0x53ad60];return _0x1eb6fb;};'use strict';var client=require(_0xde37('0x0'));exports[_0xde37('0x1')]=function(){return function(){return client['Request'](_0xde37('0x2'),{'options':{'raw':![],'attributes':['id',_0xde37('0x3'),_0xde37('0x4'),_0xde37('0x5')],'include':[{'model':'User','as':_0xde37('0x6'),'attributes':['id','name','online',_0xde37('0x7')]}]},'log':_0xde37('0x1')});};}; \ No newline at end of file +var _0x7221=['Agents','name','mailPause','../client','getMailQueues','Request','GetMailQueue','timeout','strategy','User'];(function(_0x5a219c,_0x409ff1){var _0x4bfe0b=function(_0x248612){while(--_0x248612){_0x5a219c['push'](_0x5a219c['shift']());}};_0x4bfe0b(++_0x409ff1);}(_0x7221,0xf3));var _0x1722=function(_0x47ccb2,_0x1268a0){_0x47ccb2=_0x47ccb2-0x0;var _0x155b41=_0x7221[_0x47ccb2];return _0x155b41;};'use strict';var client=require(_0x1722('0x0'));exports[_0x1722('0x1')]=function(){return function(){return client[_0x1722('0x2')](_0x1722('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x1722('0x4'),_0x1722('0x5')],'include':[{'model':_0x1722('0x6'),'as':_0x1722('0x7'),'attributes':['id',_0x1722('0x8'),'online',_0x1722('0x9')]}]},'log':_0x1722('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index ce0d8de..8de96f2 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 _0x43ed=['CreateMailQueueReport','update','UpdateMailQueueReport','../client','create','Request'];(function(_0x1475e1,_0x5e8740){var _0xf165bd=function(_0x3bd1f9){while(--_0x3bd1f9){_0x1475e1['push'](_0x1475e1['shift']());}};_0xf165bd(++_0x5e8740);}(_0x43ed,0xb7));var _0xd43e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x43ed[_0x491a7f];return _0x3d8f44;};'use strict';var client=require(_0xd43e('0x0'));exports[_0xd43e('0x1')]=function(_0x7dfbd7){return client[_0xd43e('0x2')]('CreateMailQueueReport',{'body':_0x7dfbd7,'log':_0xd43e('0x3')});};exports[_0xd43e('0x4')]=function(_0x54adf3,_0x56235b){return client[_0xd43e('0x2')](_0xd43e('0x5'),{'body':_0x56235b,'options':{'where':{'uniqueid':_0x54adf3},'order':[['id','DESC']],'limit':0x1},'log':_0xd43e('0x5')});}; \ No newline at end of file +var _0x266a=['CreateMailQueueReport','UpdateMailQueueReport','DESC','create','Request'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x266a,0x193));var _0xa266=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x266a[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xa266('0x0')]=function(_0x49c5ca){return client[_0xa266('0x1')](_0xa266('0x2'),{'body':_0x49c5ca,'log':_0xa266('0x2')});};exports['update']=function(_0x623651,_0x1684c7){return client[_0xa266('0x1')](_0xa266('0x3'),{'body':_0x1684c7,'options':{'where':{'uniqueid':_0x623651},'order':[['id',_0xa266('0x4')]],'limit':0x1},'log':_0xa266('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index f4f0690..7f8037e 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 _0xee31=['update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x1fcf36,_0x3f2539){var _0x44491f=function(_0x206816){while(--_0x206816){_0x1fcf36['push'](_0x1fcf36['shift']());}};_0x44491f(++_0x3f2539);}(_0xee31,0x1b9));var _0x1ee3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xee31[_0x40a045];return _0x1a687c;};'use strict';var client=require('../client');exports[_0x1ee3('0x0')]=function(_0x58aa9d,_0x2a8981){return client[_0x1ee3('0x1')](_0x1ee3('0x2'),{'body':_0x2a8981,'options':{'where':{'id':_0x58aa9d}},'log':_0x1ee3('0x3')});};exports[_0x1ee3('0x4')]=function(_0x493a53,_0x30f3a5){return client[_0x1ee3('0x1')](_0x1ee3('0x5'),{'body':_0x30f3a5,'options':{'where':{'id':_0x493a53}},'log':_0x1ee3('0x6')});}; \ No newline at end of file +var _0xc01b=['Request','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x37e782,_0x4db3dd){var _0x2b1bfb=function(_0x404b21){while(--_0x404b21){_0x37e782['push'](_0x37e782['shift']());}};_0x2b1bfb(++_0x4db3dd);}(_0xc01b,0x1b5));var _0xbc01=function(_0x43d9df,_0x369a74){_0x43d9df=_0x43d9df-0x0;var _0x46b4e3=_0xc01b[_0x43d9df];return _0x46b4e3;};'use strict';var client=require(_0xbc01('0x0'));exports['update']=function(_0x30fc49,_0x2d8558){return client[_0xbc01('0x1')]('UpdateOpenchannelInteraction',{'body':_0x2d8558,'options':{'where':{'id':_0x30fc49}},'log':_0xbc01('0x2')});};exports[_0xbc01('0x3')]=function(_0x1e9683,_0x1ec0f1){return client[_0xbc01('0x1')](_0xbc01('0x4'),{'body':_0x1ec0f1,'options':{'where':{'id':_0x1e9683}},'log':_0xbc01('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index b4bfac9..b1034b2 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 _0xb4e6=['../client','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x1728eb,_0x13e92a){var _0x1679b0=function(_0x41ed0c){while(--_0x41ed0c){_0x1728eb['push'](_0x1728eb['shift']());}};_0x1679b0(++_0x13e92a);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x22377a,_0x3397cb){_0x22377a=_0x22377a-0x0;var _0x36f105=_0xb4e6[_0x22377a];return _0x36f105;};'use strict';var client=require(_0x6b4e('0x0'));exports['create']=function(_0x2708ca){return client[_0x6b4e('0x1')](_0x6b4e('0x2'),{'body':_0x2708ca,'log':_0x6b4e('0x3')});}; \ No newline at end of file +var _0x9c44=['createOpenchannelMessage','Request','CreateOpenchannelMessage'];(function(_0x90cbd8,_0x243dcb){var _0x56db59=function(_0x278bfd){while(--_0x278bfd){_0x90cbd8['push'](_0x90cbd8['shift']());}};_0x56db59(++_0x243dcb);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 891c573..79390f9 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 _0x397b=['../client','getOpenchannelQueues','Request','GetOpenchannelQueue','strategy','User','Agents','name','online','openchannelPause'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x397b,0x1b8));var _0xb397=function(_0x4a1fbf,_0x3917f5){_0x4a1fbf=_0x4a1fbf-0x0;var _0x481231=_0x397b[_0x4a1fbf];return _0x481231;};'use strict';var client=require(_0xb397('0x0'));exports[_0xb397('0x1')]=function(){return function(){return client[_0xb397('0x2')](_0xb397('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xb397('0x4')],'include':[{'model':_0xb397('0x5'),'as':_0xb397('0x6'),'attributes':['id',_0xb397('0x7'),_0xb397('0x8'),_0xb397('0x9')]}]},'log':_0xb397('0x1')});};}; \ No newline at end of file +var _0xb6df=['Request','GetOpenchannelQueue','timeout','strategy','User','Agents','name','online','openchannelPause','getOpenchannelQueues'];(function(_0x3ed70b,_0x3f7f2a){var _0x448fdb=function(_0x2eb34d){while(--_0x2eb34d){_0x3ed70b['push'](_0x3ed70b['shift']());}};_0x448fdb(++_0x3f7f2a);}(_0xb6df,0x1b7));var _0xfb6d=function(_0x474f56,_0x2dc750){_0x474f56=_0x474f56-0x0;var _0x5c6c63=_0xb6df[_0x474f56];return _0x5c6c63;};'use strict';var client=require('../client');exports[_0xfb6d('0x0')]=function(){return function(){return client[_0xfb6d('0x1')](_0xfb6d('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xfb6d('0x3'),_0xfb6d('0x4')],'include':[{'model':_0xfb6d('0x5'),'as':_0xfb6d('0x6'),'attributes':['id',_0xfb6d('0x7'),_0xfb6d('0x8'),_0xfb6d('0x9')]}]},'log':_0xfb6d('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index debca2b..605a3bf 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 _0xf2d4=['update','Request','UpdateOpenchannelQueueReport','../client','create','CreateOpenchannelQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2d4,0x8d));var _0x4f2d=function(_0x9fb891,_0xbd2899){_0x9fb891=_0x9fb891-0x0;var _0x265996=_0xf2d4[_0x9fb891];return _0x265996;};'use strict';var client=require(_0x4f2d('0x0'));exports[_0x4f2d('0x1')]=function(_0x3fe297){return client['Request'](_0x4f2d('0x2'),{'body':_0x3fe297,'log':_0x4f2d('0x2')});};exports[_0x4f2d('0x3')]=function(_0xbb3172,_0x519909){return client[_0x4f2d('0x4')]('UpdateOpenchannelQueueReport',{'body':_0x519909,'options':{'where':{'uniqueid':_0xbb3172},'order':[['id','DESC']],'limit':0x1},'log':_0x4f2d('0x5')});}; \ No newline at end of file +var _0xfe9d=['create','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client'];(function(_0x107ad1,_0x9a2741){var _0x3a2d69=function(_0x14eae8){while(--_0x14eae8){_0x107ad1['push'](_0x107ad1['shift']());}};_0x3a2d69(++_0x9a2741);}(_0xfe9d,0x108));var _0xdfe9=function(_0x4cf17d,_0x35e54c){_0x4cf17d=_0x4cf17d-0x0;var _0x49369b=_0xfe9d[_0x4cf17d];return _0x49369b;};'use strict';var client=require(_0xdfe9('0x0'));exports[_0xdfe9('0x1')]=function(_0x4e41bb){return client['Request'](_0xdfe9('0x2'),{'body':_0x4e41bb,'log':'CreateOpenchannelQueueReport'});};exports[_0xdfe9('0x3')]=function(_0xbd80b0,_0x140039){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x140039,'options':{'where':{'uniqueid':_0xbd80b0},'order':[['id','DESC']],'limit':0x1},'log':_0xdfe9('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 34d3956..d469a2e 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 _0xd02a=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','UpdateSmsInteraction','updateSmsInteraction','Request'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xd02a,0x1b2));var _0xad02=function(_0x2a2d4c,_0x421c0b){_0x2a2d4c=_0x2a2d4c-0x0;var _0x281be4=_0xd02a[_0x2a2d4c];return _0x281be4;};'use strict';var client=require(_0xad02('0x0'));exports['update']=function(_0x4590ad,_0xe99910){return client['Request'](_0xad02('0x1'),{'body':_0xe99910,'options':{'where':{'id':_0x4590ad}},'log':_0xad02('0x2')});};exports['addTags']=function(_0x3d711b,_0x1640c0){return client[_0xad02('0x3')](_0xad02('0x4'),{'body':_0x1640c0,'options':{'where':{'id':_0x3d711b}},'log':_0xad02('0x5')});}; \ No newline at end of file +var _0x6a39=['Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction','../client','update'];(function(_0x1f530d,_0x18a19e){var _0x22103f=function(_0x2664c5){while(--_0x2664c5){_0x1f530d['push'](_0x1f530d['shift']());}};_0x22103f(++_0x18a19e);}(_0x6a39,0x7c));var _0x96a3=function(_0x699072,_0x3aca68){_0x699072=_0x699072-0x0;var _0x44edc2=_0x6a39[_0x699072];return _0x44edc2;};'use strict';var client=require(_0x96a3('0x0'));exports[_0x96a3('0x1')]=function(_0x3dc319,_0x35d53d){return client[_0x96a3('0x2')]('UpdateSmsInteraction',{'body':_0x35d53d,'options':{'where':{'id':_0x3dc319}},'log':_0x96a3('0x3')});};exports[_0x96a3('0x4')]=function(_0x27a2d9,_0x3b62ff){return client[_0x96a3('0x2')](_0x96a3('0x5'),{'body':_0x3b62ff,'options':{'where':{'id':_0x27a2d9}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 8facb3a..1d6a082 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 _0x8463=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x2c0e06,_0x139e15){var _0x5235eb=function(_0x177021){while(--_0x177021){_0x2c0e06['push'](_0x2c0e06['shift']());}};_0x5235eb(++_0x139e15);}(_0x8463,0xda));var _0x3846=function(_0x4a11bf,_0xad2511){_0x4a11bf=_0x4a11bf-0x0;var _0x329e16=_0x8463[_0x4a11bf];return _0x329e16;};'use strict';var client=require(_0x3846('0x0'));exports[_0x3846('0x1')]=function(_0x3d020c){return client[_0x3846('0x2')](_0x3846('0x3'),{'body':_0x3d020c,'log':_0x3846('0x4')});}; \ No newline at end of file +var _0xad8b=['../client','Request','CreateSmsMessage','createSmsMessage'];(function(_0x21dc43,_0x3a3eab){var _0x3d6a69=function(_0xc985d0){while(--_0xc985d0){_0x21dc43['push'](_0x21dc43['shift']());}};_0x3d6a69(++_0x3a3eab);}(_0xad8b,0x7c));var _0xbad8=function(_0x5ce33c,_0x5c75a9){_0x5ce33c=_0x5ce33c-0x0;var _0x40c7d4=_0xad8b[_0x5ce33c];return _0x40c7d4;};'use strict';var client=require(_0xbad8('0x0'));exports['create']=function(_0x47002f){return client[_0xbad8('0x1')](_0xbad8('0x2'),{'body':_0x47002f,'log':_0xbad8('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 73f0ecb..1f0a5a9 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 _0x6afd=['name','online','smsPause','getSmsQueues','Request','timeout','strategy'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x6afd,0xe3));var _0xd6af=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x6afd[_0x6c993a];return _0x27f547;};'use strict';var client=require('../client');exports[_0xd6af('0x0')]=function(){return function(){return client[_0xd6af('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0xd6af('0x2'),_0xd6af('0x3')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xd6af('0x4'),_0xd6af('0x5'),_0xd6af('0x6')]}]},'log':_0xd6af('0x0')});};}; \ No newline at end of file +var _0xf40b=['User','Agents','online','getSmsQueues','../client','Request','name','timeout','strategy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf40b,0xf7));var _0xbf40=function(_0x2fbb45,_0x1b2c7f){_0x2fbb45=_0x2fbb45-0x0;var _0x526325=_0xf40b[_0x2fbb45];return _0x526325;};'use strict';var client=require(_0xbf40('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0xbf40('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0xbf40('0x2'),_0xbf40('0x3'),_0xbf40('0x4')],'include':[{'model':_0xbf40('0x5'),'as':_0xbf40('0x6'),'attributes':['id',_0xbf40('0x2'),_0xbf40('0x7'),'smsPause']}]},'log':_0xbf40('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 4e9e34b..ac7c1ad 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 _0x4171=['DESC','create','Request','CreateSmsQueueReport','update'];(function(_0x4a2ec7,_0x3f7440){var _0x8be0a4=function(_0x431c10){while(--_0x431c10){_0x4a2ec7['push'](_0x4a2ec7['shift']());}};_0x8be0a4(++_0x3f7440);}(_0x4171,0x6a));var _0x1417=function(_0x3a4792,_0x1f3592){_0x3a4792=_0x3a4792-0x0;var _0x12808e=_0x4171[_0x3a4792];return _0x12808e;};'use strict';var client=require('../client');exports[_0x1417('0x0')]=function(_0x23b67b){return client[_0x1417('0x1')](_0x1417('0x2'),{'body':_0x23b67b,'log':_0x1417('0x2')});};exports[_0x1417('0x3')]=function(_0x22d824,_0x4e6aba){return client[_0x1417('0x1')]('UpdateSmsQueueReport',{'body':_0x4e6aba,'options':{'where':{'uniqueid':_0x22d824},'order':[['id',_0x1417('0x4')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0xd4d0=['Request','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x574159,_0x952110){var _0x5dd226=function(_0x5a32f2){while(--_0x5a32f2){_0x574159['push'](_0x574159['shift']());}};_0x5dd226(++_0x952110);}(_0xd4d0,0x6d));var _0x0d4d=function(_0x22ddc4,_0x2d5f1e){_0x22ddc4=_0x22ddc4-0x0;var _0x2ba192=_0xd4d0[_0x22ddc4];return _0x2ba192;};'use strict';var client=require(_0x0d4d('0x0'));exports['create']=function(_0x2e9f37){return client[_0x0d4d('0x1')]('CreateSmsQueueReport',{'body':_0x2e9f37,'log':'CreateSmsQueueReport'});};exports[_0x0d4d('0x2')]=function(_0x179415,_0x1dbc32){return client['Request'](_0x0d4d('0x3'),{'body':_0x1dbc32,'options':{'where':{'uniqueid':_0x179415},'order':[['id',_0x0d4d('0x4')]],'limit':0x1},'log':_0x0d4d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 58cd980..ec3613d 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 _0x94ff=['GetUser','agent','online','pauseType','lastPauseAt','voicePause','smsPause','whatsappPause','openchannelPause','chatCapacity','faxCapacity','smsCapacity','whatsappCapacity','../client','getAgents','Request'];(function(_0x4cf342,_0xfc270e){var _0xa57bb5=function(_0x1e40ec){while(--_0x1e40ec){_0x4cf342['push'](_0x4cf342['shift']());}};_0xa57bb5(++_0xfc270e);}(_0x94ff,0x10d));var _0xf94f=function(_0x289858,_0x55879f){_0x289858=_0x289858-0x0;var _0x5152bc=_0x94ff[_0x289858];return _0x5152bc;};'use strict';var client=require(_0xf94f('0x0'));exports[_0xf94f('0x1')]=function(){return function(){return client[_0xf94f('0x2')](_0xf94f('0x3'),{'options':{'raw':!![],'where':{'role':_0xf94f('0x4')},'attributes':['id','name',_0xf94f('0x5'),_0xf94f('0x6'),_0xf94f('0x7'),_0xf94f('0x8'),'chatPause','mailPause','faxPause',_0xf94f('0x9'),_0xf94f('0xa'),_0xf94f('0xb'),_0xf94f('0xc'),'mailCapacity',_0xf94f('0xd'),_0xf94f('0xe'),_0xf94f('0xf'),'openchannelCapacity']},'log':_0xf94f('0x1')});};}; \ No newline at end of file +var _0xb2ed=['openchannelPause','faxCapacity','smsCapacity','whatsappCapacity','../client','getAgents','Request','GetUser','name','online','pauseType','lastPauseAt','voicePause','chatPause','faxPause','whatsappPause'];(function(_0x5dac44,_0x456f1e){var _0x1ee303=function(_0x3efb42){while(--_0x3efb42){_0x5dac44['push'](_0x5dac44['shift']());}};_0x1ee303(++_0x456f1e);}(_0xb2ed,0xd4));var _0xdb2e=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xb2ed[_0x257642];return _0x3d813b;};'use strict';var client=require(_0xdb2e('0x0'));exports[_0xdb2e('0x1')]=function(){return function(){return client[_0xdb2e('0x2')](_0xdb2e('0x3'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0xdb2e('0x4'),_0xdb2e('0x5'),_0xdb2e('0x6'),_0xdb2e('0x7'),_0xdb2e('0x8'),_0xdb2e('0x9'),'mailPause',_0xdb2e('0xa'),'smsPause',_0xdb2e('0xb'),_0xdb2e('0xc'),'chatCapacity','mailCapacity',_0xdb2e('0xd'),_0xdb2e('0xe'),_0xdb2e('0xf'),'openchannelCapacity']},'log':_0xdb2e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index ab30714..fad08ba 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 _0xd82a=['../client','update','UpdateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xd82a,0xbd));var _0xad82=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xd82a[_0x363ef8];return _0x148822;};'use strict';var client=require(_0xad82('0x0'));exports[_0xad82('0x1')]=function(_0x2fd97e,_0x40afa5){return client['Request'](_0xad82('0x2'),{'body':_0x40afa5,'options':{'where':{'id':_0x2fd97e}},'log':'updateWhatsappInteraction'});};exports[_0xad82('0x3')]=function(_0x3a0a37,_0x40b3d6){return client[_0xad82('0x4')](_0xad82('0x5'),{'body':_0x40b3d6,'options':{'where':{'id':_0x3a0a37}},'log':_0xad82('0x6')});}; \ No newline at end of file +var _0x8c99=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','../client','update','Request'];(function(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0x8c99,0x1a8));var _0x98c9=function(_0x4a8418,_0x39078a){_0x4a8418=_0x4a8418-0x0;var _0x390174=_0x8c99[_0x4a8418];return _0x390174;};'use strict';var client=require(_0x98c9('0x0'));exports[_0x98c9('0x1')]=function(_0x3edaed,_0xd3ac76){return client[_0x98c9('0x2')](_0x98c9('0x3'),{'body':_0xd3ac76,'options':{'where':{'id':_0x3edaed}},'log':_0x98c9('0x4')});};exports[_0x98c9('0x5')]=function(_0x459115,_0xeb82d1){return client[_0x98c9('0x2')](_0x98c9('0x6'),{'body':_0xeb82d1,'options':{'where':{'id':_0x459115}},'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 dc60fe5..1de656c 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 _0x2a21=['create'];(function(_0x201804,_0xb84e9c){var _0x26b349=function(_0x2c30d2){while(--_0x2c30d2){_0x201804['push'](_0x201804['shift']());}};_0x26b349(++_0xb84e9c);}(_0x2a21,0x129));var _0x12a2=function(_0xc41743,_0x27ab40){_0xc41743=_0xc41743-0x0;var _0x494180=_0x2a21[_0xc41743];return _0x494180;};'use strict';var client=require('../client');exports[_0x12a2('0x0')]=function(_0x3e861e){return client['Request']('CreateWhatsappMessage',{'body':_0x3e861e,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x1049=['createWhatsappMessage','../client','create','CreateWhatsappMessage'];(function(_0x50b2ea,_0x52c92d){var _0x10f77f=function(_0x4d2bdd){while(--_0x4d2bdd){_0x50b2ea['push'](_0x50b2ea['shift']());}};_0x10f77f(++_0x52c92d);}(_0x1049,0x1f1));var _0x9104=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1049[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x9104('0x0'));exports[_0x9104('0x1')]=function(_0x3869eb){return client['Request'](_0x9104('0x2'),{'body':_0x3869eb,'log':_0x9104('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 013222c..931eaab 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 _0xa5fa=['strategy','User','online','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x1a87a8,_0x127bc9){_0x1a87a8=_0x1a87a8-0x0;var _0x51b8b7=_0xa5fa[_0x1a87a8];return _0x51b8b7;};'use strict';var client=require('../client');exports[_0xaa5f('0x0')]=function(){return function(){return client[_0xaa5f('0x1')](_0xaa5f('0x2'),{'options':{'raw':![],'attributes':['id',_0xaa5f('0x3'),'timeout',_0xaa5f('0x4')],'include':[{'model':_0xaa5f('0x5'),'as':'Agents','attributes':['id',_0xaa5f('0x3'),_0xaa5f('0x6'),_0xaa5f('0x7')]}]},'log':_0xaa5f('0x0')});};}; \ No newline at end of file +var _0x4f7b=['getWhatsappQueues','Request','GetWhatsappQueue','timeout','strategy','User','Agents','name','online','whatsappPause','../client'];(function(_0x114180,_0x37ec4b){var _0x3e295a=function(_0x25f130){while(--_0x25f130){_0x114180['push'](_0x114180['shift']());}};_0x3e295a(++_0x37ec4b);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x43e1f2,_0x52e3b2){_0x43e1f2=_0x43e1f2-0x0;var _0x414e3=_0x4f7b[_0x43e1f2];return _0x414e3;};'use strict';var client=require(_0xb4f7('0x0'));exports[_0xb4f7('0x1')]=function(){return function(){return client[_0xb4f7('0x2')](_0xb4f7('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xb4f7('0x4'),_0xb4f7('0x5')],'include':[{'model':_0xb4f7('0x6'),'as':_0xb4f7('0x7'),'attributes':['id',_0xb4f7('0x8'),_0xb4f7('0x9'),_0xb4f7('0xa')]}]},'log':_0xb4f7('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 40fcfa4..9e78d8c 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 _0x7f30=['CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','../client','create','Request'];(function(_0x2b35f7,_0x33d4fd){var _0x3eb7be=function(_0x2e8c29){while(--_0x2e8c29){_0x2b35f7['push'](_0x2b35f7['shift']());}};_0x3eb7be(++_0x33d4fd);}(_0x7f30,0x18f));var _0x07f3=function(_0x56f918,_0xa2096f){_0x56f918=_0x56f918-0x0;var _0x165d3f=_0x7f30[_0x56f918];return _0x165d3f;};'use strict';var client=require(_0x07f3('0x0'));exports[_0x07f3('0x1')]=function(_0x5b966d){return client[_0x07f3('0x2')](_0x07f3('0x3'),{'body':_0x5b966d,'log':_0x07f3('0x3')});};exports['update']=function(_0x1e8f0a,_0x50e436){return client[_0x07f3('0x2')](_0x07f3('0x4'),{'body':_0x50e436,'options':{'where':{'uniqueid':_0x1e8f0a},'order':[['id',_0x07f3('0x5')]],'limit':0x1},'log':_0x07f3('0x4')});}; \ No newline at end of file +var _0x97f8=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client','create'];(function(_0x2091eb,_0x391be8){var _0x5bc169=function(_0x339ddd){while(--_0x339ddd){_0x2091eb['push'](_0x2091eb['shift']());}};_0x5bc169(++_0x391be8);}(_0x97f8,0x134));var _0x897f=function(_0x1d37c8,_0x5e0f9d){_0x1d37c8=_0x1d37c8-0x0;var _0xacaedf=_0x97f8[_0x1d37c8];return _0xacaedf;};'use strict';var client=require(_0x897f('0x0'));exports[_0x897f('0x1')]=function(_0x3f9936){return client['Request']('CreateWhatsappQueueReport',{'body':_0x3f9936,'log':_0x897f('0x2')});};exports[_0x897f('0x3')]=function(_0x2be209,_0x569d10){return client['Request'](_0x897f('0x4'),{'body':_0x569d10,'options':{'where':{'uniqueid':_0x2be209},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 0afed0d..9bae4a5 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 _0x304a=['toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','find','agents','createQueue','atimeout','channel','format','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','stop','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name'];(function(_0x11ac6d,_0x1829de){var _0x2baa55=function(_0x186289){while(--_0x186289){_0x11ac6d['push'](_0x11ac6d['shift']());}};_0x2baa55(++_0x1829de);}(_0x304a,0x17b));var _0xa304=function(_0x51ef04,_0x4a8875){_0x51ef04=_0x51ef04-0x0;var _0x4b95b3=_0x304a[_0x51ef04];return _0x4b95b3;};'use strict';var schema=require(_0xa304('0x0'));var _=require(_0xa304('0x1'));var util=require(_0xa304('0x2'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0xa304('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xa304('0x4'),'required':!![],'message':_0xa304('0x5')},'timeout':{'type':_0xa304('0x6'),'message':_0xa304('0x7')}});function writeLog(_0x1de8d2,_0x48ba46,_0x9a41b9){return logger[_0xa304('0x8')](util['format'](_0xa304('0x9'),_0x1de8d2,_0x48ba46[_0xa304('0xa')],_0x9a41b9));}function handleFindAgent(_0x566d71){return function(_0x18d104){return _0x18d104['name'][_0xa304('0xb')]()===_0x566d71[_0xa304('0xb')]();};}exports[_0xa304('0xc')]=function(_0x59f322,_0x40a4c2,_0x1b3209,_0x4a574c){return function(_0x4ef93f){try{var _0x93ec6d={'name':_0x40a4c2[0x0],'timeout':_0x40a4c2[0x1]};var _0x2233ca=queue[_0xa304('0x0')](_0x93ec6d,{'typecast':!![]});if(_0x2233ca[_0xa304('0xd')]){logger[_0xa304('0xe')](_0xa304('0xf'),_0x59f322,_[_0xa304('0x10')](_0x2233ca,_0xa304('0x11'))[_0xa304('0x12')](',\x20'));_0x4ef93f['stop']();}else{var _0x4cefdb=_[_0xa304('0x13')](_0x1b3209[_0xa304('0x14')],handleFindAgent(_0x93ec6d[_0xa304('0xa')]));if(_0x4cefdb){var _0x3eb961=(_0x93ec6d['timeout']||0xa)*0x3e8;var _0x1d459a,_0x2294c1;var _0x194dd9=seqqueue[_0xa304('0x15')](_0x3eb961);_0x194dd9['id']=_0x59f322;_0x194dd9[_0xa304('0x16')]=_0x3eb961;_0x194dd9[_0xa304('0x17')]=_0x4a574c[_0xa304('0x17')];writeLog(_0x59f322,_0x4cefdb,util[_0xa304('0x18')](_0xa304('0x19'),_0x3eb961));_0x1b3209['rules'][_0x59f322]['on'](_0xa304('0x1a'),function(){logger[_0xa304('0x8')](_0xa304('0x1b'),_0x59f322);clearTimeout(_0x2294c1);_0x2294c1=undefined;_0x194dd9[_0xa304('0x1c')]();if(_0x1b3209[_0xa304('0x1d')][_0x59f322]){delete _0x1b3209[_0xa304('0x1d')][_0x59f322];}_0x4ef93f[_0xa304('0x1e')]();});_0x1b3209[_0xa304('0x1d')][_0x59f322]['on'](_0xa304('0x1f'),function(){if(_0x1b3209[_0xa304('0x1d')][_0x59f322]){delete _0x1b3209[_0xa304('0x1d')][_0x59f322];}});_0x2294c1=setTimeout(function(){logger[_0xa304('0x8')](_0xa304('0x20'),_0x59f322);clearTimeout(_0x2294c1);_0x194dd9[_0xa304('0x1c')]();_0x4ef93f[_0xa304('0x21')]();},_0x3eb961);strategy[_0xa304('0x22')](_0x194dd9,_0x4cefdb,_0x1b3209,_0x4a574c);}else{logger[_0xa304('0xe')](_0xa304('0x23'),_0x59f322,_0x93ec6d[_0xa304('0xa')]);_0x4ef93f[_0xa304('0x1e')]();}}}catch(_0x2e1fef){console[_0xa304('0x24')](_0x2e1fef);logger['error'](_0xa304('0x25'),_0x59f322,_0x2e1fef[_0xa304('0x26')]);_0x4ef93f['stop']();}};}; \ No newline at end of file +var _0xb7eb=['format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','join','stop','find','agents','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info'];(function(_0x4f70fd,_0x58136c){var _0x516bcb=function(_0xc52174){while(--_0xc52174){_0x4f70fd['push'](_0x4f70fd['shift']());}};_0x516bcb(++_0x58136c);}(_0xb7eb,0xa0));var _0xbb7e=function(_0x34d587,_0x50197e){_0x34d587=_0x34d587-0x0;var _0x31ef34=_0xb7eb[_0x34d587];return _0x31ef34;};'use strict';var schema=require(_0xbb7e('0x0'));var _=require(_0xbb7e('0x1'));var util=require(_0xbb7e('0x2'));var seqqueue=require(_0xbb7e('0x3'));var logger=require(_0xbb7e('0x4'))(_0xbb7e('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0xbb7e('0x6')},'timeout':{'type':_0xbb7e('0x7'),'message':_0xbb7e('0x8')}});function writeLog(_0x226000,_0x2ef521,_0x1cfbb5){return logger[_0xbb7e('0x9')](util[_0xbb7e('0xa')](_0xbb7e('0xb'),_0x226000,_0x2ef521[_0xbb7e('0xc')],_0x1cfbb5));}function handleFindAgent(_0x10a729){return function(_0x4313ba){return _0x4313ba['name'][_0xbb7e('0xd')]()===_0x10a729[_0xbb7e('0xd')]();};}exports[_0xbb7e('0xe')]=function(_0x4383dc,_0x41a346,_0x5dc849,_0xa759b4){return function(_0x37d060){try{var _0x5d0575={'name':_0x41a346[0x0],'timeout':_0x41a346[0x1]};var _0x170eb5=queue[_0xbb7e('0x0')](_0x5d0575,{'typecast':!![]});if(_0x170eb5[_0xbb7e('0xf')]){logger['error']('[%s][AGENT]\x20%s',_0x4383dc,_['map'](_0x170eb5,'message')[_0xbb7e('0x10')](',\x20'));_0x37d060[_0xbb7e('0x11')]();}else{var _0x145898=_[_0xbb7e('0x12')](_0x5dc849[_0xbb7e('0x13')],handleFindAgent(_0x5d0575['name']));if(_0x145898){var _0x4bb9f5=(_0x5d0575['timeout']||0xa)*0x3e8;var _0x41cf87,_0x38c45f;var _0x489cf2=seqqueue[_0xbb7e('0x14')](_0x4bb9f5);_0x489cf2['id']=_0x4383dc;_0x489cf2[_0xbb7e('0x15')]=_0x4bb9f5;_0x489cf2['channel']=_0xa759b4[_0xbb7e('0x16')];writeLog(_0x4383dc,_0x145898,util[_0xbb7e('0xa')](_0xbb7e('0x17'),_0x4bb9f5));_0x5dc849[_0xbb7e('0x18')][_0x4383dc]['on'](_0xbb7e('0x19'),function(){logger[_0xbb7e('0x9')](_0xbb7e('0x1a'),_0x4383dc);clearTimeout(_0x38c45f);_0x38c45f=undefined;_0x489cf2[_0xbb7e('0x1b')]();if(_0x5dc849[_0xbb7e('0x18')][_0x4383dc]){delete _0x5dc849[_0xbb7e('0x18')][_0x4383dc];}_0x37d060[_0xbb7e('0x11')]();});_0x5dc849[_0xbb7e('0x18')][_0x4383dc]['on']('complete',function(){if(_0x5dc849[_0xbb7e('0x18')][_0x4383dc]){delete _0x5dc849[_0xbb7e('0x18')][_0x4383dc];}});_0x38c45f=setTimeout(function(){logger[_0xbb7e('0x9')]('[%s][AGENT]\x20ROUTING\x20END',_0x4383dc);clearTimeout(_0x38c45f);_0x489cf2['close']();_0x37d060[_0xbb7e('0x1c')]();},_0x4bb9f5);strategy[_0xbb7e('0x1d')](_0x489cf2,_0x145898,_0x5dc849,_0xa759b4);}else{logger[_0xbb7e('0x1e')](_0xbb7e('0x1f'),_0x4383dc,_0x5d0575[_0xbb7e('0xc')]);_0x37d060['stop']();}}}catch(_0x1f7815){console['log'](_0x1f7815);logger['error'](_0xbb7e('0x20'),_0x4383dc,_0x1f7815[_0xbb7e('0x21')]);_0x37d060[_0xbb7e('0x11')]();}};}; \ 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 340f7d5..7bec05c 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 _0x2bed=['[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','postText','amazonlex','providerName','providerResponse','Failed','stop','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','interaction','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','Message','create','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!'];(function(_0x1dd67f,_0x4d50bd){var _0x5287e1=function(_0x221cc0){while(--_0x221cc0){_0x1dd67f['push'](_0x1dd67f['shift']());}};_0x5287e1(++_0x4d50bd);}(_0x2bed,0x18a));var _0xd2be=function(_0xead4d4,_0x109414){_0xead4d4=_0xead4d4-0x0;var _0x46ffe8=_0x2bed[_0xead4d4];return _0x46ffe8;};'use strict';var _=require(_0xd2be('0x0'));var moment=require(_0xd2be('0x1'));var AWS=require(_0xd2be('0x2'));var utils=require(_0xd2be('0x3'));var logger=require(_0xd2be('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xd2be('0x5')),'smsMessage':require(_0xd2be('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xd2be('0x7'))};exports[_0xd2be('0x8')]=function(_0x115d4c,_0x18b6e3){return function(_0x8e4aac){try{if(!_[_0xd2be('0x9')](this['interaction'][_0xd2be('0xa')])){logger[_0xd2be('0xb')](_0xd2be('0xc'),_0x115d4c,_0xd2be('0xd'));return _0x8e4aac[_0xd2be('0xe')]();}var _0x4bfd19={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xd2be('0xf')),'direction':_0xd2be('0x10')};if(this[_0xd2be('0x11')]===_0xd2be('0x12')||this['channel']==='whatsapp'){_0x4bfd19['phone']=this[_0xd2be('0x13')][_0xd2be('0x14')];}var _0x5ba36e=this['channel'];if(_0x5ba36e===_0xd2be('0x15')){_0x4bfd19[_0xd2be('0x16')]=this[_0xd2be('0x17')]['id'];}else{_0x4bfd19[_[_0xd2be('0x18')](_0x5ba36e)+_0xd2be('0x19')]=this['account']['id'];}_0x4bfd19[_[_0xd2be('0x18')](_0x5ba36e)+_0xd2be('0x1a')]=this[_0xd2be('0x13')]['id'];if(this[_0xd2be('0x13')][_0xd2be('0x1b')]){var _0x5b8ccb=_0x18b6e3[0x4];if(!_[_0xd2be('0x1c')](_0x5b8ccb)){_0x4bfd19[_0xd2be('0x1d')]=utils['getMustacheRender'](_0x5b8ccb,this);return rpc[_0x5ba36e+_0xd2be('0x1e')][_0xd2be('0x1f')](_0x4bfd19)[_0xd2be('0x20')](function(_0x26d0e4){logger['info'](_0xd2be('0xc'),_0x115d4c,_0x4bfd19[_0xd2be('0x1d')]);})[_0xd2be('0x21')](function(_0x5157ae){logger[_0xd2be('0x22')](_0xd2be('0xc'),_0x115d4c,JSON[_0xd2be('0x23')](_0x5157ae));})[_0xd2be('0x24')](function(){logger[_0xd2be('0xb')](_0xd2be('0x25'),_0x115d4c);_0x8e4aac['stop']();});}else{logger[_0xd2be('0xb')](_0xd2be('0x26'),_0x115d4c);_0x8e4aac['stop']();}}else{var _0x563894=this;var _0x313150=new AWS[(_0xd2be('0x27'))]({'accessKeyId':_0x18b6e3[0x0],'secretAccessKey':_0x18b6e3[0x1],'region':_0x18b6e3[0x2]});var _0x533f41={'botAlias':_0xd2be('0x28'),'botName':_0x18b6e3[0x3],'inputText':this[_0xd2be('0x29')][_0xd2be('0x1d')],'userId':this['channel']+':'+this['interaction']['id']['toString']()};_0x313150[_0xd2be('0x2a')](_0x533f41,function(_0x327125,_0x36697d){if(_0x327125){logger['error'](_0xd2be('0xc'),_0x115d4c,_0x327125[_0xd2be('0x29')]);_0x8e4aac[_0xd2be('0xe')]();}else if(_0x36697d&&_0x36697d[_0xd2be('0x29')]){_0x563894[_0xd2be('0x1d')][_0xd2be('0x2b')]=_0x36697d;_0x4bfd19[_0xd2be('0x1d')]=_0x36697d[_0xd2be('0x29')];_0x4bfd19[_0xd2be('0x2c')]=_0xd2be('0x2b');_0x4bfd19[_0xd2be('0x2d')]=JSON[_0xd2be('0x23')](_0x36697d);return rpc[_0x5ba36e+_0xd2be('0x1e')][_0xd2be('0x1f')](_0x4bfd19)['then'](function(_0x3accd3){logger[_0xd2be('0xb')](_0xd2be('0xc'),_0x115d4c,_0x4bfd19[_0xd2be('0x1d')]);if(_0x36697d['dialogState']==_0xd2be('0x2e')){_0x8e4aac[_0xd2be('0xe')]();}else{_0x8e4aac[_0xd2be('0x2f')]();}})[_0xd2be('0x21')](function(_0x26758d){logger[_0xd2be('0x22')](_0xd2be('0xc'),_0x115d4c,JSON['stringify'](_0x26758d));_0x8e4aac['next']();});}else{_0x8e4aac[_0xd2be('0xe')]();}});}}catch(_0x336b84){logger[_0xd2be('0x22')](_0xd2be('0xc'),_0x115d4c,JSON[_0xd2be('0x23')](_0x336b84));_0x8e4aac[_0xd2be('0x2f')]();}};}; \ No newline at end of file +var _0xbbdd=['AccountId','InteractionId','created','isEmpty','Message','create','then','body','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','stringify','dialogState','Failed','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','info','[%s][AMAZONLEX]\x20%s','next','contact','format','out','channel','interaction','phone','chat','ChatWebsiteId','account','upperFirst'];(function(_0x51a6d6,_0x3c9c49){var _0x5ef1a8=function(_0x8ff84a){while(--_0x8ff84a){_0x51a6d6['push'](_0x51a6d6['shift']());}};_0x5ef1a8(++_0x3c9c49);}(_0xbbdd,0x103));var _0xdbbd=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0xbbdd[_0x58e469];return _0x4c01c5;};'use strict';var _=require(_0xdbbd('0x0'));var moment=require(_0xdbbd('0x1'));var AWS=require(_0xdbbd('0x2'));var utils=require('./utils');var logger=require(_0xdbbd('0x3'))(_0xdbbd('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xdbbd('0x5')),'faxMessage':require(_0xdbbd('0x6')),'whatsappMessage':require(_0xdbbd('0x7'))};exports[_0xdbbd('0x8')]=function(_0xba1bdb,_0x8d114e){return function(_0x34bfb1){try{if(!_[_0xdbbd('0x9')](this['interaction']['UserId'])){logger[_0xdbbd('0xa')](_0xdbbd('0xb'),_0xba1bdb,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x34bfb1[_0xdbbd('0xc')]();}var _0x3476b3={'ContactId':this[_0xdbbd('0xd')]['id'],'sentAt':moment()[_0xdbbd('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xdbbd('0xf')};if(this[_0xdbbd('0x10')]==='sms'||this[_0xdbbd('0x10')]==='whatsapp'){_0x3476b3['phone']=this[_0xdbbd('0x11')][_0xdbbd('0x12')];}var _0xce32ea=this[_0xdbbd('0x10')];if(_0xce32ea===_0xdbbd('0x13')){_0x3476b3[_0xdbbd('0x14')]=this[_0xdbbd('0x15')]['id'];}else{_0x3476b3[_[_0xdbbd('0x16')](_0xce32ea)+_0xdbbd('0x17')]=this[_0xdbbd('0x15')]['id'];}_0x3476b3[_['upperFirst'](_0xce32ea)+_0xdbbd('0x18')]=this[_0xdbbd('0x11')]['id'];if(this['interaction'][_0xdbbd('0x19')]){var _0x3d0d05=_0x8d114e[0x4];if(!_[_0xdbbd('0x1a')](_0x3d0d05)){_0x3476b3['body']=utils['getMustacheRender'](_0x3d0d05,this);return rpc[_0xce32ea+_0xdbbd('0x1b')][_0xdbbd('0x1c')](_0x3476b3)[_0xdbbd('0x1d')](function(_0x66158d){logger[_0xdbbd('0xa')]('[%s][AMAZONLEX]\x20%s',_0xba1bdb,_0x3476b3[_0xdbbd('0x1e')]);})[_0xdbbd('0x1f')](function(_0x2fad68){logger[_0xdbbd('0x20')](_0xdbbd('0xb'),_0xba1bdb,JSON['stringify'](_0x2fad68));})[_0xdbbd('0x21')](function(){logger[_0xdbbd('0xa')](_0xdbbd('0x22'),_0xba1bdb);_0x34bfb1[_0xdbbd('0x23')]();});}else{logger[_0xdbbd('0xa')](_0xdbbd('0x24'),_0xba1bdb);_0x34bfb1[_0xdbbd('0x23')]();}}else{var _0x5c3311=this;var _0x4c66e9=new AWS[(_0xdbbd('0x25'))]({'accessKeyId':_0x8d114e[0x0],'secretAccessKey':_0x8d114e[0x1],'region':_0x8d114e[0x2]});var _0x4cbdd1={'botAlias':_0xdbbd('0x26'),'botName':_0x8d114e[0x3],'inputText':this[_0xdbbd('0x27')]['body'],'userId':this['channel']+':'+this[_0xdbbd('0x11')]['id'][_0xdbbd('0x28')]()};_0x4c66e9[_0xdbbd('0x29')](_0x4cbdd1,function(_0x21f230,_0x1f181f){if(_0x21f230){logger[_0xdbbd('0x20')](_0xdbbd('0xb'),_0xba1bdb,_0x21f230[_0xdbbd('0x27')]);_0x34bfb1[_0xdbbd('0xc')]();}else if(_0x1f181f&&_0x1f181f['message']){_0x5c3311['body'][_0xdbbd('0x2a')]=_0x1f181f;_0x3476b3[_0xdbbd('0x1e')]=_0x1f181f['message'];_0x3476b3[_0xdbbd('0x2b')]=_0xdbbd('0x2a');_0x3476b3['providerResponse']=JSON[_0xdbbd('0x2c')](_0x1f181f);return rpc[_0xce32ea+_0xdbbd('0x1b')]['create'](_0x3476b3)['then'](function(_0xd8a2d7){logger[_0xdbbd('0xa')](_0xdbbd('0xb'),_0xba1bdb,_0x3476b3[_0xdbbd('0x1e')]);if(_0x1f181f[_0xdbbd('0x2d')]==_0xdbbd('0x2e')){_0x34bfb1['next']();}else{_0x34bfb1[_0xdbbd('0x23')]();}})[_0xdbbd('0x1f')](function(_0xc2cd1b){logger[_0xdbbd('0x20')](_0xdbbd('0xb'),_0xba1bdb,JSON[_0xdbbd('0x2c')](_0xc2cd1b));_0x34bfb1[_0xdbbd('0xc')]();});}else{_0x34bfb1[_0xdbbd('0xc')]();}});}}catch(_0x1efa3a){logger[_0xdbbd('0x20')](_0xdbbd('0xb'),_0xba1bdb,JSON[_0xdbbd('0x2c')](_0x1efa3a));_0x34bfb1['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 399aa69..85071ab 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 _0x4b20=['account','upperFirst','AccountId','InteractionId','interaction','Smtp','service','host','port','secure','authentication','auth','pass','inReplyTo','messageId','','replace','headers','auto-replied','sendMailMessage','then','info','Message','stringify','[RPC][%s][AUTOREPLY]\x20%s','create','catch','error','finally','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','created','[%s][AUTOREPLY]\x20%s','next','channel','contact','YYYY-MM-DD\x20HH:mm:ss','out','mail','getMustacheRender','body','message','from','phone','read','subject','Re:','Re:\x20','chat','ChatWebsiteId'];(function(_0x85130d,_0x51202f){var _0x3ca85b=function(_0x5cd7ff){while(--_0x5cd7ff){_0x85130d['push'](_0x85130d['shift']());}};_0x3ca85b(++_0x51202f);}(_0x4b20,0x116));var _0x04b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4b20[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x04b2('0x0'));var moment=require(_0x04b2('0x1'));var utils=require(_0x04b2('0x2'));var logger=require(_0x04b2('0x3'))(_0x04b2('0x4'));var rpc={'chatMessage':require(_0x04b2('0x5')),'openchannelMessage':require(_0x04b2('0x6')),'mailMessage':require(_0x04b2('0x7')),'smsMessage':require(_0x04b2('0x8')),'faxMessage':require(_0x04b2('0x9')),'whatsappMessage':require(_0x04b2('0xa'))};var mailRpc=require('../../mailRpc');exports[_0x04b2('0xb')]=function(_0x34e629,_0x5391d0){return function(_0x340462){try{if(_0x5391d0[0x0]==='1'&&(_[_0x04b2('0xc')](this['interaction'][_0x04b2('0xd')])||!this['interaction'][_0x04b2('0xd')])){logger['info'](_0x04b2('0xe'),_0x34e629,'Autoreply\x20already\x20sent');return _0x340462[_0x04b2('0xf')]();}var _0x28a212=this[_0x04b2('0x10')];var _0x2dbc5b={'ContactId':this[_0x04b2('0x11')]['id'],'sentAt':moment()['format'](_0x04b2('0x12')),'direction':_0x04b2('0x13')};if(this['channel']===_0x04b2('0x14')){_0x2dbc5b['body']=utils[_0x04b2('0x15')](_0x5391d0[0x2],this);}else{_0x2dbc5b[_0x04b2('0x16')]=utils[_0x04b2('0x15')](_0x5391d0[0x1],this);}if(this[_0x04b2('0x17')]){_0x2dbc5b['to']=this['message'][_0x04b2('0x18')]||'';if(this[_0x04b2('0x10')]==='mail'&&_0x5391d0[0x1]==='1'){_0x2dbc5b['cc']=this[_0x04b2('0x17')]['cc']||'';}_0x2dbc5b[_0x04b2('0x18')]=this[_0x04b2('0x17')]['to']||'';_0x2dbc5b['phone']=this[_0x04b2('0x17')][_0x04b2('0x19')]||'';_0x2dbc5b[_0x04b2('0x1a')]=!![];if(this[_0x04b2('0x17')][_0x04b2('0x1b')]){_0x2dbc5b[_0x04b2('0x1b')]='';_0x2dbc5b['subject']+=_['startsWith'](this[_0x04b2('0x17')][_0x04b2('0x1b')],_0x04b2('0x1c'))?'':_0x04b2('0x1d');_0x2dbc5b[_0x04b2('0x1b')]+=this[_0x04b2('0x17')][_0x04b2('0x1b')];}}if(this[_0x04b2('0x10')]===_0x04b2('0x1e')){_0x2dbc5b[_0x04b2('0x1f')]=this[_0x04b2('0x20')]['id'];}else{_0x2dbc5b[_[_0x04b2('0x21')](this['channel'])+_0x04b2('0x22')]=this[_0x04b2('0x20')]['id'];}_0x2dbc5b[_[_0x04b2('0x21')](this[_0x04b2('0x10')])+_0x04b2('0x23')]=this[_0x04b2('0x24')]['id'];if(rpc[this[_0x04b2('0x10')]+'Message']){if(this[_0x04b2('0x10')]==='mail'){var _0x1432b8={'tls':{'rejectUnauthorized':![]}};if(this[_0x04b2('0x20')][_0x04b2('0x25')]['service']){_0x1432b8[_0x04b2('0x26')]=this[_0x04b2('0x20')]['Smtp'][_0x04b2('0x26')];}else{_0x1432b8[_0x04b2('0x27')]=this[_0x04b2('0x20')][_0x04b2('0x25')][_0x04b2('0x27')];_0x1432b8[_0x04b2('0x28')]=this['account'][_0x04b2('0x25')][_0x04b2('0x28')];_0x1432b8[_0x04b2('0x29')]=this['account'][_0x04b2('0x25')][_0x04b2('0x29')];}if(this[_0x04b2('0x20')][_0x04b2('0x25')][_0x04b2('0x2a')]){_0x1432b8[_0x04b2('0x2b')]={'user':this['account']['Smtp']['user'],'pass':this['account'][_0x04b2('0x25')][_0x04b2('0x2c')]};}_0x2dbc5b[_0x04b2('0x2d')]=this[_0x04b2('0x17')][_0x04b2('0x2e')];_0x2dbc5b['html']=_0x04b2('0x2f')+_[_0x04b2('0x30')](_0x2dbc5b[_0x04b2('0x16')],'';_0x2dbc5b[_0x04b2('0x31')]={'Auto-Submitted':_0x04b2('0x32'),'X-Auto-Response-Suppress':'All','Precedence':'auto_reply'};return mailRpc[_0x04b2('0x33')](_0x1432b8,_0x2dbc5b)[_0x04b2('0x34')](function(_0x3d47d6){logger[_0x04b2('0x35')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x34e629);_0x2dbc5b[_0x04b2('0x2e')]=_0x3d47d6['message']['messageId'];return rpc[_0x28a212+_0x04b2('0x36')]['create'](_0x2dbc5b);})[_0x04b2('0x34')](function(_0x35fe1f){logger[_0x04b2('0x35')]('[%s][AUTOREPLY]\x20%s',_0x34e629,JSON[_0x04b2('0x37')](_0x35fe1f));})['catch'](function(_0x55241e){logger['error'](_0x04b2('0x38'),_0x34e629,JSON['stringify'](_0x55241e));})['finally'](function(){_0x340462[_0x04b2('0xf')]();});}else{return rpc[this[_0x04b2('0x10')]+'Message'][_0x04b2('0x39')](_0x2dbc5b)[_0x04b2('0x34')](function(_0x4cc740){logger[_0x04b2('0x35')](_0x04b2('0xe'),_0x34e629,_0x2dbc5b[_0x04b2('0x16')]);})[_0x04b2('0x3a')](function(_0x1f47ed){logger[_0x04b2('0x3b')]('[%s][AUTOREPLY]\x20%s',_0x34e629,JSON['stringify'](_0x1f47ed));})[_0x04b2('0x3c')](function(){_0x340462['next']();});}}}catch(_0x7110c2){logger['error']('[%s][AUTOREPLY]\x20%s',_0x34e629,JSON[_0x04b2('0x37')](_0x7110c2));_0x340462[_0x04b2('0x3d')]();}};}; \ No newline at end of file +var _0xd7a4=['error','stop','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../mailRpc','consequence','isNil','interaction','created','info','Autoreply\x20already\x20sent','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','mail','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','account','upperFirst','AccountId','InteractionId','Smtp','service','host','port','secure','authentication','user','pass','html','','','headers','auto-replied','All','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','[%s][AUTOREPLY]\x20%s','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','Message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7a4,0x7e));var _0x4d7a=function(_0x484d12,_0x2a3e53){_0x484d12=_0x484d12-0x0;var _0x13f069=_0xd7a4[_0x484d12];return _0x13f069;};'use strict';var _=require(_0x4d7a('0x0'));var moment=require(_0x4d7a('0x1'));var utils=require('./utils');var logger=require(_0x4d7a('0x2'))(_0x4d7a('0x3'));var rpc={'chatMessage':require(_0x4d7a('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x4d7a('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x4d7a('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};var mailRpc=require(_0x4d7a('0x7'));exports[_0x4d7a('0x8')]=function(_0x2b9ad5,_0xa6e0c4){return function(_0xacbfc3){try{if(_0xa6e0c4[0x0]==='1'&&(_[_0x4d7a('0x9')](this[_0x4d7a('0xa')][_0x4d7a('0xb')])||!this[_0x4d7a('0xa')]['created'])){logger[_0x4d7a('0xc')]('[%s][AUTOREPLY]\x20%s',_0x2b9ad5,_0x4d7a('0xd'));return _0xacbfc3[_0x4d7a('0xe')]();}var _0x5badc5=this['channel'];var _0x537ba7={'ContactId':this[_0x4d7a('0xf')]['id'],'sentAt':moment()[_0x4d7a('0x10')](_0x4d7a('0x11')),'direction':_0x4d7a('0x12')};if(this[_0x4d7a('0x13')]===_0x4d7a('0x14')){_0x537ba7[_0x4d7a('0x15')]=utils[_0x4d7a('0x16')](_0xa6e0c4[0x2],this);}else{_0x537ba7[_0x4d7a('0x15')]=utils[_0x4d7a('0x16')](_0xa6e0c4[0x1],this);}if(this[_0x4d7a('0x17')]){_0x537ba7['to']=this[_0x4d7a('0x17')][_0x4d7a('0x18')]||'';if(this[_0x4d7a('0x13')]===_0x4d7a('0x14')&&_0xa6e0c4[0x1]==='1'){_0x537ba7['cc']=this['message']['cc']||'';}_0x537ba7[_0x4d7a('0x18')]=this[_0x4d7a('0x17')]['to']||'';_0x537ba7[_0x4d7a('0x19')]=this['message'][_0x4d7a('0x19')]||'';_0x537ba7[_0x4d7a('0x1a')]=!![];if(this[_0x4d7a('0x17')][_0x4d7a('0x1b')]){_0x537ba7[_0x4d7a('0x1b')]='';_0x537ba7[_0x4d7a('0x1b')]+=_[_0x4d7a('0x1c')](this[_0x4d7a('0x17')][_0x4d7a('0x1b')],'Re:')?'':_0x4d7a('0x1d');_0x537ba7['subject']+=this[_0x4d7a('0x17')][_0x4d7a('0x1b')];}}if(this[_0x4d7a('0x13')]===_0x4d7a('0x1e')){_0x537ba7['ChatWebsiteId']=this[_0x4d7a('0x1f')]['id'];}else{_0x537ba7[_[_0x4d7a('0x20')](this[_0x4d7a('0x13')])+_0x4d7a('0x21')]=this[_0x4d7a('0x1f')]['id'];}_0x537ba7[_[_0x4d7a('0x20')](this[_0x4d7a('0x13')])+_0x4d7a('0x22')]=this['interaction']['id'];if(rpc[this[_0x4d7a('0x13')]+'Message']){if(this['channel']===_0x4d7a('0x14')){var _0x1a9e1d={'tls':{'rejectUnauthorized':![]}};if(this[_0x4d7a('0x1f')][_0x4d7a('0x23')][_0x4d7a('0x24')]){_0x1a9e1d[_0x4d7a('0x24')]=this[_0x4d7a('0x1f')][_0x4d7a('0x23')][_0x4d7a('0x24')];}else{_0x1a9e1d['host']=this[_0x4d7a('0x1f')][_0x4d7a('0x23')][_0x4d7a('0x25')];_0x1a9e1d[_0x4d7a('0x26')]=this[_0x4d7a('0x1f')][_0x4d7a('0x23')][_0x4d7a('0x26')];_0x1a9e1d[_0x4d7a('0x27')]=this[_0x4d7a('0x1f')][_0x4d7a('0x23')][_0x4d7a('0x27')];}if(this['account'][_0x4d7a('0x23')][_0x4d7a('0x28')]){_0x1a9e1d['auth']={'user':this[_0x4d7a('0x1f')][_0x4d7a('0x23')][_0x4d7a('0x29')],'pass':this[_0x4d7a('0x1f')]['Smtp'][_0x4d7a('0x2a')]};}_0x537ba7['inReplyTo']=this['message']['messageId'];_0x537ba7[_0x4d7a('0x2b')]=_0x4d7a('0x2c')+_['replace'](_0x537ba7[_0x4d7a('0x15')],']+(>|$)/g,''),'priorityTrue':_0x19e430[0x1],'priorityFalse':_0x19e430[0x2]};var _0x5eca0c=gotoif['validate'](_0x7f4fb4,{'typecast':!![]});if(_0x5eca0c[_0x732c('0x9')]){logger['error'](_0x732c('0xa'),_0x4229c5,_['map'](_0x5eca0c,_0x732c('0xb'))[_0x732c('0xc')](',\x20'));_0x282c8f[_0x732c('0xd')]();}else{try{var _0x29f129=eval('('+_0x7f4fb4[_0x732c('0xe')]+')');var _0x48c6f3=_0x29f129?_0x7f4fb4[_0x732c('0xf')]:_0x7f4fb4['priorityFalse'];logger[_0x732c('0x10')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x4229c5,_0x7f4fb4[_0x732c('0xe')],_0x29f129,_0x48c6f3||_0x732c('0x11'));if(_0x48c6f3){var _0x55bc76=_[_0x732c('0x12')](_0x282c8f[_0x732c('0x13')](),{'p':_0x48c6f3});if(_0x55bc76>=0x0){logger[_0x732c('0x10')](_0x732c('0x14'),_0x4229c5,_0x48c6f3||_0x732c('0x11'),_0x55bc76);_0x282c8f[_0x732c('0x11')](_0x55bc76);}else{logger[_0x732c('0x10')](_0x732c('0x15'),_0x4229c5,_0x48c6f3||_0x732c('0x11'));_0x282c8f[_0x732c('0xd')]();}}else{_0x282c8f[_0x732c('0x11')]();}}catch(_0x18df0c){logger[_0x732c('0x16')](_0x732c('0x17'),_0x4229c5,_0x18df0c['message']);_0x282c8f[_0x732c('0xd')]();}}}catch(_0x21a4a6){logger[_0x732c('0x16')](_0x732c('0xa'),_0x4229c5,JSON[_0x732c('0x18')](_0x21a4a6));_0x282c8f[_0x732c('0xd')]();}};}; \ No newline at end of file +var _0x45b5=['validate','html-to-text','./utils','../../../../config/logger','string','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','stop','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','[%s][GOTOIF]\x20eval\x20error:\x20%s'];(function(_0x132289,_0x4c5251){var _0x1f4cf9=function(_0x5c08ea){while(--_0x5c08ea){_0x132289['push'](_0x132289['shift']());}};_0x1f4cf9(++_0x4c5251);}(_0x45b5,0xbd));var _0x545b=function(_0x20cefc,_0x556d7c){_0x20cefc=_0x20cefc-0x0;var _0x113b07=_0x45b5[_0x20cefc];return _0x113b07;};'use strict';var schema=require(_0x545b('0x0'));var _=require('lodash');var htmlToText=require(_0x545b('0x1'));var utils=require(_0x545b('0x2'));var logger=require(_0x545b('0x3'))('routing');var gotoif=schema({'condition':{'type':_0x545b('0x4'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x545b('0x5'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':'number','message':_0x545b('0x6')}});exports[_0x545b('0x7')]=function(_0x57503d,_0x5d3f1f){return function(_0xfe005a){try{var _0x42d3b3={'condition':htmlToText[_0x545b('0x8')](utils[_0x545b('0x9')](_0x5d3f1f[0x0],this),{'wordwrap':![]})[_0x545b('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5d3f1f[0x1],'priorityFalse':_0x5d3f1f[0x2]};var _0x28922f=gotoif[_0x545b('0x0')](_0x42d3b3,{'typecast':!![]});if(_0x28922f[_0x545b('0xb')]){logger[_0x545b('0xc')](_0x545b('0xd'),_0x57503d,_[_0x545b('0xe')](_0x28922f,'message')['join'](',\x20'));_0xfe005a[_0x545b('0xf')]();}else{try{var _0x5874d7=eval('('+_0x42d3b3[_0x545b('0x10')]+')');var _0x46b96c=_0x5874d7?_0x42d3b3[_0x545b('0x11')]:_0x42d3b3[_0x545b('0x12')];logger[_0x545b('0x13')](_0x545b('0x14'),_0x57503d,_0x42d3b3[_0x545b('0x10')],_0x5874d7,_0x46b96c||_0x545b('0x15'));if(_0x46b96c){var _0x1a913f=_[_0x545b('0x16')](_0xfe005a[_0x545b('0x17')](),{'p':_0x46b96c});if(_0x1a913f>=0x0){logger[_0x545b('0x13')](_0x545b('0x18'),_0x57503d,_0x46b96c||_0x545b('0x15'),_0x1a913f);_0xfe005a[_0x545b('0x15')](_0x1a913f);}else{logger[_0x545b('0x13')](_0x545b('0x19'),_0x57503d,_0x46b96c||_0x545b('0x15'));_0xfe005a[_0x545b('0xf')]();}}else{_0xfe005a['next']();}}catch(_0x3adeb5){logger['error'](_0x545b('0x1a'),_0x57503d,_0x3adeb5['message']);_0xfe005a[_0x545b('0xf')]();}}}catch(_0x2ea45e){logger[_0x545b('0xc')](_0x545b('0xd'),_0x57503d,JSON['stringify'](_0x2ea45e));_0xfe005a[_0x545b('0xf')]();}};}; \ 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 639d42c..c1e1d26 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 _0xc0d5=['rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][GOTOP]\x20%s','map','join','stop','info','priority'];(function(_0x227c59,_0x3b4943){var _0xb66348=function(_0x5a5b4b){while(--_0x5a5b4b){_0x227c59['push'](_0x227c59['shift']());}};_0xb66348(++_0x3b4943);}(_0xc0d5,0x1f2));var _0x5c0d=function(_0x5f3dfb,_0x411a15){_0x5f3dfb=_0x5f3dfb-0x0;var _0x599990=_0xc0d5[_0x5f3dfb];return _0x599990;};'use strict';var schema=require('validate');var _=require(_0x5c0d('0x0'));var logger=require(_0x5c0d('0x1'))(_0x5c0d('0x2'));var gotop=schema({'priority':{'type':_0x5c0d('0x3'),'required':!![],'message':_0x5c0d('0x4')}});exports[_0x5c0d('0x5')]=function(_0x19aa90,_0x36fa3e){return function(_0x2cf1f9){try{var _0x421348={'priority':_0x36fa3e[0x0]};var _0x322ca7=gotop[_0x5c0d('0x6')](_0x421348,{'typecast':!![]});if(_0x322ca7[_0x5c0d('0x7')]){logger[_0x5c0d('0x8')](_0x5c0d('0x9'),_0x19aa90,_[_0x5c0d('0xa')](_0x322ca7,'message')[_0x5c0d('0xb')](',\x20'));_0x2cf1f9[_0x5c0d('0xc')]();}else{logger[_0x5c0d('0xd')]('[%s][GOTOP]\x20priority\x20%s',_0x19aa90,_0x421348[_0x5c0d('0xe')]);if(_0x421348['priority']){var _0x208ca8=_['findIndex'](_0x2cf1f9[_0x5c0d('0xf')](),{'p':_0x421348['priority']});if(_0x208ca8>=0x0){logger[_0x5c0d('0xd')](_0x5c0d('0x10'),_0x19aa90,_0x421348[_0x5c0d('0xe')]||_0x5c0d('0x11'),_0x208ca8);_0x2cf1f9[_0x5c0d('0x11')](_0x208ca8);}else{logger[_0x5c0d('0xd')](_0x5c0d('0x12'),_0x19aa90,_0x421348['priority']||_0x5c0d('0x11'));_0x2cf1f9['stop']();}}else{_0x2cf1f9[_0x5c0d('0x11')]();}}}catch(_0xf2beba){logger[_0x5c0d('0x8')](_0x5c0d('0x9'),_0x19aa90,JSON['stringify'](_0xf2beba));_0x2cf1f9['stop']();}};}; \ No newline at end of file +var _0x9c1c=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s','map','stop','info','[%s][GOTOP]\x20priority\x20%s','rules','priority','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','routing'];(function(_0x1d19a4,_0x530ffa){var _0x3c0870=function(_0x212a39){while(--_0x212a39){_0x1d19a4['push'](_0x1d19a4['shift']());}};_0x3c0870(++_0x530ffa);}(_0x9c1c,0x138));var _0xc9c1=function(_0x333798,_0x9f6561){_0x333798=_0x333798-0x0;var _0x389f4e=_0x9c1c[_0x333798];return _0x389f4e;};'use strict';var schema=require(_0xc9c1('0x0'));var _=require(_0xc9c1('0x1'));var logger=require('../../../../config/logger')(_0xc9c1('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xc9c1('0x3')}});exports[_0xc9c1('0x4')]=function(_0x23c685,_0x580855){return function(_0x21d97b){try{var _0x620f4a={'priority':_0x580855[0x0]};var _0x4df61b=gotop['validate'](_0x620f4a,{'typecast':!![]});if(_0x4df61b['length']){logger[_0xc9c1('0x5')](_0xc9c1('0x6'),_0x23c685,_[_0xc9c1('0x7')](_0x4df61b,'message')['join'](',\x20'));_0x21d97b[_0xc9c1('0x8')]();}else{logger[_0xc9c1('0x9')](_0xc9c1('0xa'),_0x23c685,_0x620f4a['priority']);if(_0x620f4a['priority']){var _0x32eb5c=_['findIndex'](_0x21d97b[_0xc9c1('0xb')](),{'p':_0x620f4a[_0xc9c1('0xc')]});if(_0x32eb5c>=0x0){logger[_0xc9c1('0x9')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x23c685,_0x620f4a[_0xc9c1('0xc')]||_0xc9c1('0xd'),_0x32eb5c);_0x21d97b[_0xc9c1('0xd')](_0x32eb5c);}else{logger[_0xc9c1('0x9')](_0xc9c1('0xe'),_0x23c685,_0x620f4a[_0xc9c1('0xc')]||'next');_0x21d97b[_0xc9c1('0x8')]();}}else{_0x21d97b[_0xc9c1('0xd')]();}}}catch(_0x1d1a91){logger[_0xc9c1('0x5')](_0xc9c1('0x6'),_0x23c685,JSON['stringify'](_0x1d1a91));_0x21d97b[_0xc9c1('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 19453b4..f1cbdfa 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 _0x4eb8=['error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch'];(function(_0x1cc03c,_0x1d3dfd){var _0x4175e9=function(_0x18f667){while(--_0x18f667){_0x1cc03c['push'](_0x1cc03c['shift']());}};_0x4175e9(++_0x1d3dfd);}(_0x4eb8,0x1b5));var _0x84eb=function(_0x1d8b10,_0x9603a6){_0x1d8b10=_0x1d8b10-0x0;var _0x123f31=_0x4eb8[_0x1d8b10];return _0x123f31;};'use strict';var _=require(_0x84eb('0x0'));var utils=require(_0x84eb('0x1'));var logger=require(_0x84eb('0x2'))(_0x84eb('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x84eb('0x4')),'mailMessage':require(_0x84eb('0x5')),'smsMessage':require(_0x84eb('0x6')),'faxMessage':require(_0x84eb('0x7')),'whatsappMessage':require(_0x84eb('0x8'))};exports[_0x84eb('0x9')]=function(_0x745fa,_0x23b3fc){return function(_0x3a8e37){try{var _0x594e38={'body':utils[_0x84eb('0xa')](_0x23b3fc[0x0],this),'ContactId':this[_0x84eb('0xb')]['id']};if(this[_0x84eb('0xc')]===_0x84eb('0xd')){_0x594e38[_0x84eb('0xe')]=this[_0x84eb('0xf')]['id'];}else{_0x594e38[_[_0x84eb('0x10')](this[_0x84eb('0xc')])+_0x84eb('0x11')]=this['account']['id'];}_0x594e38[_[_0x84eb('0x10')](this[_0x84eb('0xc')])+_0x84eb('0x12')]=this[_0x84eb('0x13')]['id'];if(rpc[this['channel']+_0x84eb('0x14')]){return rpc[this[_0x84eb('0xc')]+_0x84eb('0x14')][_0x84eb('0x15')](_0x594e38)[_0x84eb('0x16')](function(_0x57c8f7){logger[_0x84eb('0x17')](_0x84eb('0x18'),_0x745fa,_0x594e38[_0x84eb('0x19')]);_0x3a8e37[_0x84eb('0x1a')]();})[_0x84eb('0x1b')](function(_0x44783b){logger[_0x84eb('0x1c')](_0x84eb('0x18'),_0x745fa,JSON[_0x84eb('0x1d')](_0x44783b));_0x3a8e37[_0x84eb('0x1e')]();});}}catch(_0x264565){logger[_0x84eb('0x1c')]('[%s][MESSAGE]\x20%s',_0x745fa,JSON[_0x84eb('0x1d')](_0x264565));_0x3a8e37[_0x84eb('0x1e')]();}};}; \ No newline at end of file +var _0xe72f=['consequence','getMustacheRender','contact','chat','ChatWebsiteId','account','upperFirst','channel','AccountId','InteractionId','interaction','Message','create','then','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','routing','../../rpc/chatMessage','../../rpc/smsMessage'];(function(_0x4c8dbe,_0x3ce317){var _0x457be7=function(_0x3762ce){while(--_0x3762ce){_0x4c8dbe['push'](_0x4c8dbe['shift']());}};_0x457be7(++_0x3ce317);}(_0xe72f,0x128));var _0xfe72=function(_0x2dad58,_0x2a8160){_0x2dad58=_0x2dad58-0x0;var _0x50d459=_0xe72f[_0x2dad58];return _0x50d459;};'use strict';var _=require(_0xfe72('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xfe72('0x1'));var rpc={'chatMessage':require(_0xfe72('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xfe72('0x3')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xfe72('0x4')]=function(_0x210ddc,_0x3c78dc){return function(_0x373afb){try{var _0x1d9b8f={'body':utils[_0xfe72('0x5')](_0x3c78dc[0x0],this),'ContactId':this[_0xfe72('0x6')]['id']};if(this['channel']===_0xfe72('0x7')){_0x1d9b8f[_0xfe72('0x8')]=this[_0xfe72('0x9')]['id'];}else{_0x1d9b8f[_[_0xfe72('0xa')](this[_0xfe72('0xb')])+_0xfe72('0xc')]=this[_0xfe72('0x9')]['id'];}_0x1d9b8f[_[_0xfe72('0xa')](this[_0xfe72('0xb')])+_0xfe72('0xd')]=this[_0xfe72('0xe')]['id'];if(rpc[this['channel']+_0xfe72('0xf')]){return rpc[this[_0xfe72('0xb')]+'Message'][_0xfe72('0x10')](_0x1d9b8f)[_0xfe72('0x11')](function(_0x97fcbe){logger['info'](_0xfe72('0x12'),_0x210ddc,_0x1d9b8f[_0xfe72('0x13')]);_0x373afb[_0xfe72('0x14')]();})[_0xfe72('0x15')](function(_0x1abc73){logger[_0xfe72('0x16')](_0xfe72('0x12'),_0x210ddc,JSON[_0xfe72('0x17')](_0x1abc73));_0x373afb['stop']();});}}catch(_0x434077){logger[_0xfe72('0x16')](_0xfe72('0x12'),_0x210ddc,JSON[_0xfe72('0x17')](_0x434077));_0x373afb[_0xfe72('0x18')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 79f819a..ccec637 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 _0x24f9=['info','[%s][NOOP]\x20%s','next','error','stringify','stop','../../../../config/logger'];(function(_0x2c1dcd,_0x350452){var _0x158ce5=function(_0x5c1c57){while(--_0x5c1c57){_0x2c1dcd['push'](_0x2c1dcd['shift']());}};_0x158ce5(++_0x350452);}(_0x24f9,0x15d));var _0x924f=function(_0xa6be65,_0x48b8f7){_0xa6be65=_0xa6be65-0x0;var _0x3fe86d=_0x24f9[_0xa6be65];return _0x3fe86d;};'use strict';var utils=require('./utils');var logger=require(_0x924f('0x0'))('routing');exports['consequence']=function(_0x1d422c,_0x1ba50a){return function(_0x4611c8){try{logger[_0x924f('0x1')](_0x924f('0x2'),_0x1d422c,utils['getMustacheRender'](_0x1ba50a[0x0],this));_0x4611c8[_0x924f('0x3')]();}catch(_0x5a27a1){logger[_0x924f('0x4')](_0x924f('0x2'),_0x1d422c,JSON[_0x924f('0x5')](_0x5a27a1));_0x4611c8[_0x924f('0x6')]();}};}; \ No newline at end of file +var _0x120d=['stop','./utils','../../../../config/logger','getMustacheRender','error','[%s][NOOP]\x20%s'];(function(_0x2c27ed,_0x5c50f0){var _0x597bd1=function(_0xd6db18){while(--_0xd6db18){_0x2c27ed['push'](_0x2c27ed['shift']());}};_0x597bd1(++_0x5c50f0);}(_0x120d,0x1db));var _0xd120=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0x120d[_0xf79bae];return _0x5d2cb7;};'use strict';var utils=require(_0xd120('0x0'));var logger=require(_0xd120('0x1'))('routing');exports['consequence']=function(_0x5e49a6,_0x69a5a1){return function(_0xa225e){try{logger['info']('[%s][NOOP]\x20%s',_0x5e49a6,utils[_0xd120('0x2')](_0x69a5a1[0x0],this));_0xa225e['next']();}catch(_0x548cb8){logger[_0xd120('0x3')](_0xd120('0x4'),_0x5e49a6,JSON['stringify'](_0x548cb8));_0xa225e[_0xd120('0x5')]();}};}; \ 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 421d695..585d006 100644 --- a/server/services/routing/server/applications/queue.js +++ b/server/services/routing/server/applications/queue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','channel','MessageId','chat','AccountId','WebsiteId','name','message','QueueReport','create','catch','error','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','join','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport'];(function(_0x1d13f1,_0x573339){var _0x4d433d=function(_0x333a5b){while(--_0x333a5b){_0x1d13f1['push'](_0x1d13f1['shift']());}};_0x4d433d(++_0x573339);}(_0x34e8,0x12c));var _0x834e=function(_0x95dfe,_0x29f963){_0x95dfe=_0x95dfe-0x0;var _0x12e34d=_0x34e8[_0x95dfe];return _0x12e34d;};'use strict';var schema=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var seqqueue=require(_0x834e('0x3'));var moment=require('moment');var Redis=require(_0x834e('0x4'));var config=require(_0x834e('0x5'));var logger=require(_0x834e('0x6'))(_0x834e('0x7'));var strategy=require(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));var attributes=['id',_0x834e('0xc'),_0x834e('0xd'),_0x834e('0xe'),_0x834e('0xf'),_0x834e('0x10')];function emit(_0x363786,_0x1af45a,_0x3bdda9){io['to'](_0x363786)[_0x834e('0x11')](_0x1af45a,_0x3bdda9);}function emitChannelQueueInteraction(_0x1e41fe,_0x36e124,_0x14038b,_0x2e1a37,_0x293514,_0x1e00de,_0x2fd95c,_0x538bb3){var _0x5e5b6d=_[_0x834e('0x12')](_0x14038b);_0x5e5b6d['queue_id']=_0x538bb3;_0x5e5b6d[_0x834e('0xe')]=_0x36e124;_0x5e5b6d[_0x834e('0xd')]=_0x2e1a37;_0x5e5b6d['id']=_0x293514;if(_0x1e00de){_0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514]=_['pick'](_0x5e5b6d,attributes);}else{delete _0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514];}emit(util['format'](_0x834e('0x15'),_0x1e41fe,_0x36e124),util['format'](_0x834e('0x16'),_0x1e41fe,_0x1e00de?_0x834e('0x17'):'remove'),_[_0x834e('0x18')](_0x5e5b6d,attributes));}var rpc={'openchannelQueueReport':require(_0x834e('0x19')),'mailQueueReport':require(_0x834e('0x1a')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x834e('0x1b')),'faxQueueReport':require(_0x834e('0x1c')),'whatsappQueueReport':require(_0x834e('0x1d'))};var queue=schema({'name':{'type':_0x834e('0x1e'),'required':!![],'message':_0x834e('0x1f')},'timeout':{'type':_0x834e('0x20'),'message':_0x834e('0x21')}});function startRouting(_0x595515,_0x2545b4,_0x1fd2c6,_0x113ff4){if(_0x595515&&_0x2545b4&&_0x1fd2c6){_0x2545b4[_0x834e('0x22')]+=0x1;var _0x4ab05d={'uniqueid':_0x595515,'from':_0x1fd2c6[_0x834e('0x23')]?_0x1fd2c6[_0x834e('0x23')]['from']:'','joinAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'ContactId':_0x1fd2c6[_0x834e('0x25')]?_0x1fd2c6['contact']['id']:null,'ListId':_0x1fd2c6['list']?_0x1fd2c6[_0x834e('0x26')]['id']:null};_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x28')]=_0x2545b4['id']||null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x29')]=_0x1fd2c6[_0x834e('0x2a')]?_0x1fd2c6[_0x834e('0x2a')]['id']:null;_0x4ab05d[_['upperFirst'](_0x1fd2c6[_0x834e('0x2b')])+_0x834e('0x2c')]=_0x1fd2c6['message']?_0x1fd2c6['message']['id']:null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+(_0x1fd2c6[_0x834e('0x2b')]!==_0x834e('0x2d')?_0x834e('0x2e'):_0x834e('0x2f'))]=_0x1fd2c6[_0x834e('0xd')]?_0x1fd2c6[_0x834e('0xd')]['id']:null;logger['info'](util['format']('[%s][START:QUEUE][NAME:%s]',_0x595515,_0x2545b4['name']));emitChannelQueueInteraction(_0x1fd2c6[_0x834e('0x2b')],_0x2545b4[_0x834e('0x30')],_0x4ab05d,_0x1fd2c6[_0x834e('0xd')]['name'],_0x1fd2c6[_0x834e('0x31')]['id'],!![],_0x113ff4,_0x2545b4['id']);if(rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x33')](_0x4ab05d)[_0x834e('0x34')](function(_0xfaf716){logger[_0x834e('0x35')]('create\x20queue\x20report');});}}}function stopRouting(_0xef9ec2,_0x5cad11,_0x2c75c2,_0x3787b0){if(_0xef9ec2&&_0x5cad11){_0x5cad11[_0x834e('0x22')]-=0x1;var _0x2b3418={'leaveAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'acceptAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'reason':_0x834e('0x36')};logger[_0x834e('0x37')](util['format'](_0x834e('0x38'),_0xef9ec2,_0x5cad11[_0x834e('0x30')]));emitChannelQueueInteraction(_0x2c75c2[_0x834e('0x2b')],_0x5cad11[_0x834e('0x30')],_0x2c75c2['body'],_0x2c75c2[_0x834e('0xd')][_0x834e('0x30')],_0x2c75c2['message']['id'],![],_0x3787b0,_0x5cad11['id']);if(rpc[_0x2c75c2['channel']+'QueueReport']){return rpc[_0x2c75c2[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x39')](_0xef9ec2,_0x2b3418)[_0x834e('0x34')](function(_0x339e28){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function endRouting(_0x2c2d94,_0x513f36,_0xe103fe,_0x6a3ac){if(_0x2c2d94&&_0x513f36){_0x513f36['waiting']-=0x1;var _0x18ac3b={'leaveAt':moment()[_0x834e('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x834e('0x24')),'reason':_0x834e('0x3a')};logger[_0x834e('0x37')](util[_0x834e('0x13')](_0x834e('0x3b'),_0x2c2d94,_0x513f36['name']));emitChannelQueueInteraction(_0xe103fe[_0x834e('0x2b')],_0x513f36['name'],_0xe103fe['body'],_0xe103fe[_0x834e('0xd')]['name'],_0xe103fe[_0x834e('0x31')]['id'],![],_0x6a3ac);if(rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]['update'](_0x2c2d94,_0x18ac3b)[_0x834e('0x34')](function(_0x26b847){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x35380e){return function(_0x16ac45){return _0x16ac45['name'][_0x834e('0x3c')]()===_0x35380e['toLowerCase']();};}exports[_0x834e('0x3d')]=function(_0x585335,_0x4a18bb,_0x4a6942,_0x22ea21){return function(_0x16969b){try{var _0x3bcbf4={'name':_0x4a18bb[0x0],'timeout':_0x4a18bb[0x1]};var _0xbc1571=queue[_0x834e('0x0')](_0x3bcbf4,{'typecast':!![]});if(_0xbc1571[_0x834e('0x3e')]){logger[_0x834e('0x35')]('[%s][QUEUE]\x20%s',_0x585335,_[_0x834e('0x3f')](_0xbc1571,'message')[_0x834e('0x40')](',\x20'));_0x16969b['stop']();}else{var _0x1df5b0=_['find'](_0x4a6942[_0x22ea21[_0x834e('0x2b')]+_0x834e('0x41')],handleFindQueue(_0x3bcbf4['name']));if(_0x1df5b0){startRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);var _0x39e7b9=(_0x1df5b0[_0x834e('0x3a')]||0xa)*0x3e8;var _0xa880cb=(_0x3bcbf4[_0x834e('0x3a')]||0x14)*0x3e8;var _0x252ea0,_0x1a7149;if(_0x39e7b9>_0xa880cb){_0xa880cb=_0x39e7b9;}var _0xfa28da=seqqueue[_0x834e('0x42')](_0x39e7b9);_0xfa28da['id']=_0x585335;_0xfa28da[_0x834e('0x43')]=_0x39e7b9;_0xfa28da[_0x834e('0x44')]=_0xa880cb;_0xfa28da['channel']=_0x22ea21[_0x834e('0x2b')];_0x4a6942[_0x834e('0x45')][_0x585335]['on']('end',function(){logger[_0x834e('0x37')](_0x834e('0x46'),_0x585335);stopRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0x252ea0=undefined;_0xfa28da[_0x834e('0x47')](!![]);if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}_0x16969b[_0x834e('0x48')]();});_0x4a6942['rules'][_0x585335]['on']('complete',function(){if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}});_0x252ea0=setTimeout(function(){logger[_0x834e('0x37')](_0x834e('0x49'),_0x585335);endRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0xfa28da[_0x834e('0x47')](!![]);_0x16969b[_0x834e('0x4a')]();},_0xa880cb);switch(_0x1df5b0[_0x834e('0x4b')]){case _0x834e('0x4c'):strategy[_0x834e('0x4c')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);break;default:strategy[_0x834e('0x4d')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);}}else{logger[_0x834e('0x35')](_0x834e('0x4e'),_0x585335,_0x3bcbf4[_0x834e('0x30')]);_0x16969b[_0x834e('0x48')]();}}}catch(_0x2aa072){console[_0x834e('0x4f')](_0x2aa072);logger[_0x834e('0x35')](_0x834e('0x50'),_0x585335,_0x2aa072[_0x834e('0x51')]);_0x16969b[_0x834e('0x48')]();}};}; \ No newline at end of file +var _0x3e74=['beepall','log','stack','validate','util','seq-queue','moment','../../../../config/logger','./strategy','redis','defaults','localhost','queue_id','account','queue','from','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','MessageId','message','channel','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','next','strategy','rrmemory'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x3e74,0x175));var _0x43e7=function(_0x412054,_0x2217ca){_0x412054=_0x412054-0x0;var _0x246eaf=_0x3e74[_0x412054];return _0x246eaf;};'use strict';var schema=require(_0x43e7('0x0'));var _=require('lodash');var util=require(_0x43e7('0x1'));var seqqueue=require(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('routing');var strategy=require(_0x43e7('0x5'));config[_0x43e7('0x6')]=_[_0x43e7('0x7')](config[_0x43e7('0x6')],{'host':_0x43e7('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43e7('0x6')]));var attributes=['id',_0x43e7('0x9'),_0x43e7('0xa'),_0x43e7('0xb'),_0x43e7('0xc'),'joinAt'];function emit(_0x212c6c,_0x554d44,_0x54948c){io['to'](_0x212c6c)[_0x43e7('0xd')](_0x554d44,_0x54948c);}function emitChannelQueueInteraction(_0x4139c9,_0x5c34f4,_0x2803d9,_0x513707,_0xf7c520,_0x37302c,_0x4ebc8e,_0x3eb206){var _0xc960ea=_[_0x43e7('0xe')](_0x2803d9);_0xc960ea[_0x43e7('0x9')]=_0x3eb206;_0xc960ea['queue']=_0x5c34f4;_0xc960ea['account']=_0x513707;_0xc960ea['id']=_0xf7c520;if(_0x37302c){_0x4ebc8e[util[_0x43e7('0xf')](_0x43e7('0x10'),_0x4139c9)][_0xf7c520]=_[_0x43e7('0x11')](_0xc960ea,attributes);}else{delete _0x4ebc8e[util['format']('%sQueuesWaitingInteractions',_0x4139c9)][_0xf7c520];}emit(util[_0x43e7('0xf')](_0x43e7('0x12'),_0x4139c9,_0x5c34f4),util[_0x43e7('0xf')](_0x43e7('0x13'),_0x4139c9,_0x37302c?'save':'remove'),_[_0x43e7('0x11')](_0xc960ea,attributes));}var rpc={'openchannelQueueReport':require(_0x43e7('0x14')),'mailQueueReport':require(_0x43e7('0x15')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x43e7('0x16')),'whatsappQueueReport':require(_0x43e7('0x17'))};var queue=schema({'name':{'type':_0x43e7('0x18'),'required':!![],'message':_0x43e7('0x19')},'timeout':{'type':_0x43e7('0x1a'),'message':_0x43e7('0x1b')}});function startRouting(_0x619236,_0x1441ef,_0x2377a3,_0xab63cf){if(_0x619236&&_0x1441ef&&_0x2377a3){_0x1441ef[_0x43e7('0x1c')]+=0x1;var _0x177ee1={'uniqueid':_0x619236,'from':_0x2377a3['body']?_0x2377a3[_0x43e7('0x1d')][_0x43e7('0xc')]:'','joinAt':moment()['format'](_0x43e7('0x1e')),'ContactId':_0x2377a3[_0x43e7('0x1f')]?_0x2377a3[_0x43e7('0x1f')]['id']:null,'ListId':_0x2377a3[_0x43e7('0x20')]?_0x2377a3[_0x43e7('0x20')]['id']:null};_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x22')]=_0x1441ef['id']||null;_0x177ee1[_['upperFirst'](_0x2377a3['channel'])+_0x43e7('0x23')]=_0x2377a3[_0x43e7('0x24')]?_0x2377a3['interaction']['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x25')]=_0x2377a3['message']?_0x2377a3[_0x43e7('0x26')]['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3[_0x43e7('0x27')])+(_0x2377a3[_0x43e7('0x27')]!=='chat'?'AccountId':_0x43e7('0x28'))]=_0x2377a3['account']?_0x2377a3[_0x43e7('0xa')]['id']:null;logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x2a'),_0x619236,_0x1441ef['name']));emitChannelQueueInteraction(_0x2377a3[_0x43e7('0x27')],_0x1441ef[_0x43e7('0x2b')],_0x177ee1,_0x2377a3[_0x43e7('0xa')][_0x43e7('0x2b')],_0x2377a3[_0x43e7('0x26')]['id'],!![],_0xab63cf,_0x1441ef['id']);if(rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')]){return rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x2d')](_0x177ee1)[_0x43e7('0x2e')](function(_0x19725a){logger[_0x43e7('0x2f')](_0x43e7('0x30'));});}}}function stopRouting(_0x4bdb17,_0x238321,_0x44f6b0,_0x3b8f78){if(_0x4bdb17&&_0x238321){_0x238321[_0x43e7('0x1c')]-=0x1;var _0x4251c8={'leaveAt':moment()['format'](_0x43e7('0x1e')),'acceptAt':moment()[_0x43e7('0xf')](_0x43e7('0x1e')),'reason':_0x43e7('0x31')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x4bdb17,_0x238321[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x44f6b0[_0x43e7('0x27')],_0x238321[_0x43e7('0x2b')],_0x44f6b0[_0x43e7('0x1d')],_0x44f6b0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x44f6b0['message']['id'],![],_0x3b8f78,_0x238321['id']);if(rpc[_0x44f6b0['channel']+'QueueReport']){return rpc[_0x44f6b0['channel']+'QueueReport']['update'](_0x4bdb17,_0x4251c8)['catch'](function(_0x14d888){logger['error'](_0x43e7('0x32'));});}}}function endRouting(_0x8e9f40,_0x31bc78,_0x50a2d0,_0x40f72f){if(_0x8e9f40&&_0x31bc78){_0x31bc78[_0x43e7('0x1c')]-=0x1;var _0x101d45={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x43e7('0x1e')),'reason':_0x43e7('0x33')};logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x34'),_0x8e9f40,_0x31bc78[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x50a2d0[_0x43e7('0x27')],_0x31bc78[_0x43e7('0x2b')],_0x50a2d0['body'],_0x50a2d0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x50a2d0['message']['id'],![],_0x40f72f);if(rpc[_0x50a2d0[_0x43e7('0x27')]+'QueueReport']){return rpc[_0x50a2d0[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x35')](_0x8e9f40,_0x101d45)[_0x43e7('0x2e')](function(_0x35ac85){logger[_0x43e7('0x2f')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x574a93){return function(_0x30dfa9){return _0x30dfa9[_0x43e7('0x2b')][_0x43e7('0x36')]()===_0x574a93[_0x43e7('0x36')]();};}exports[_0x43e7('0x37')]=function(_0x4a4a85,_0x32a451,_0x4227c4,_0x575439){return function(_0x3628e0){try{var _0x51a69c={'name':_0x32a451[0x0],'timeout':_0x32a451[0x1]};var _0x2ad8ef=queue['validate'](_0x51a69c,{'typecast':!![]});if(_0x2ad8ef[_0x43e7('0x38')]){logger[_0x43e7('0x2f')](_0x43e7('0x39'),_0x4a4a85,_[_0x43e7('0x3a')](_0x2ad8ef,'message')['join'](',\x20'));_0x3628e0[_0x43e7('0x3b')]();}else{var _0x40c509=_[_0x43e7('0x3c')](_0x4227c4[_0x575439[_0x43e7('0x27')]+'Queues'],handleFindQueue(_0x51a69c['name']));if(_0x40c509){startRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);var _0x5dd988=(_0x40c509[_0x43e7('0x33')]||0xa)*0x3e8;var _0x57f5d0=(_0x51a69c[_0x43e7('0x33')]||0x14)*0x3e8;var _0x4b3a59,_0x5b28db;if(_0x5dd988>_0x57f5d0){_0x57f5d0=_0x5dd988;}var _0x46b2e6=seqqueue['createQueue'](_0x5dd988);_0x46b2e6['id']=_0x4a4a85;_0x46b2e6[_0x43e7('0x3d')]=_0x5dd988;_0x46b2e6[_0x43e7('0x3e')]=_0x57f5d0;_0x46b2e6[_0x43e7('0x27')]=_0x575439[_0x43e7('0x27')];_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x3f'),function(){logger[_0x43e7('0x29')](_0x43e7('0x40'),_0x4a4a85);stopRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x4b3a59=undefined;_0x46b2e6[_0x43e7('0x41')](!![]);if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}_0x3628e0['stop']();});_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x43'),function(){if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}});_0x4b3a59=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x4a4a85);endRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x46b2e6['close'](!![]);_0x3628e0[_0x43e7('0x44')]();},_0x57f5d0);switch(_0x40c509[_0x43e7('0x45')]){case'rrmemory':strategy[_0x43e7('0x46')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);break;default:strategy[_0x43e7('0x47')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);}}else{logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4a4a85,_0x51a69c['name']);_0x3628e0['stop']();}}}catch(_0x4de644){console[_0x43e7('0x48')](_0x4de644);logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20%s',_0x4a4a85,_0x4de644[_0x43e7('0x49')]);_0x3628e0[_0x43e7('0x3b')]();}};}; \ 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 10c5fc3..3ce0364 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 _0x9019=['squeue','agent','realtime','handleRun','bind','handleTimeout','timeout','drained','push','prototype','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','channel','busy','busyQueue','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','STOP','exports','lodash','uuid','routing','notificationId'];(function(_0x282140,_0x2e117d){var _0x5ac0d0=function(_0x4e7e71){while(--_0x4e7e71){_0x282140['push'](_0x282140['shift']());}};_0x5ac0d0(++_0x2e117d);}(_0x9019,0x9c));var _0x9901=function(_0x459423,_0x3416a8){_0x459423=_0x459423-0x0;var _0x42ed14=_0x9019[_0x459423];return _0x42ed14;};'use strict';var _=require(_0x9901('0x0'));var uuid=require(_0x9901('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')(_0x9901('0x2'));var Agent=function(_0x3b1640,_0x130291,_0x157aee,_0x1e221f){this[_0x9901('0x3')]=uuid['v4']();this[_0x9901('0x4')]=_0x3b1640;this[_0x9901('0x5')]=_0x130291;this[_0x9901('0x6')]=_0x157aee;this[_0x9901('0x2')]=_0x1e221f;this[_0x9901('0x4')]['push'](this[_0x9901('0x7')][_0x9901('0x8')](this),this[_0x9901('0x9')]['bind'](this));this['squeue']['on'](_0x9901('0xa'),this[_0x9901('0x9')][_0x9901('0x8')](this));this[_0x9901('0x4')]['on'](_0x9901('0xb'),this['handleDrained']['bind'](this));};Agent['prototype'][_0x9901('0xc')]=function(){this['squeue']['push'](this[_0x9901('0x7')][_0x9901('0x8')](this),this[_0x9901('0x9')][_0x9901('0x8')](this));};Agent[_0x9901('0xd')][_0x9901('0xe')]=function(){this[_0x9901('0x9')](!![]);};Agent[_0x9901('0xd')][_0x9901('0x7')]=function(_0x306cac){logger[_0x9901('0xf')](_0x9901('0x10'),this['squeue']['id'],this['agent']['id']);if(_[_0x9901('0x11')](this[_0x9901('0x6')]['agents'][this[_0x9901('0x5')]['id']])){logger[_0x9901('0xf')](_0x9901('0x12'),this[_0x9901('0x4')]['id'],this['agent']['id']);setTimeout(this[_0x9901('0xc')][_0x9901('0x8')](this),0x3e8);}else{if(this[_0x9901('0x2')][_0x9901('0x13')]||util[_0x9901('0x14')](this['squeue']['id'],this['realtime'][_0x9901('0x15')][this[_0x9901('0x5')]['id']],this[_0x9901('0x4')][_0x9901('0x16')],![])){this[_0x9901('0x6')][_0x9901('0x15')][this[_0x9901('0x5')]['id']][_0x9901('0x17')]=!![];this['realtime'][_0x9901('0x15')][this['agent']['id']][_0x9901('0x18')]=undefined;util[_0x9901('0x19')](this['notificationId'],this['squeue']['id'],this[_0x9901('0x6')][_0x9901('0x15')][this['agent']['id']],null,this[_0x9901('0x2')]);util[_0x9901('0x1a')](this[_0x9901('0x4')]['id'],this['realtime']['agents'][this[_0x9901('0x5')]['id']],'RINGING'+(this[_0x9901('0x2')]['forcedOwnership']?_0x9901('0x1b'):''));}else{logger[_0x9901('0xf')](_0x9901('0x1c'),this[_0x9901('0x4')]['id'],this[_0x9901('0x5')]['id']);setTimeout(this[_0x9901('0xc')][_0x9901('0x8')](this),0x3e8);}}};Agent['prototype'][_0x9901('0x9')]=function(_0x87557e){if(_[_0x9901('0x11')](this['realtime']['agents'][this['agent']['id']])){return logger[_0x9901('0xf')](_0x9901('0x12'),this['squeue']['id'],this[_0x9901('0x5')]['id']);}else{logger[_0x9901('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x9901('0x4')]['id'],this['agent']['id']);util[_0x9901('0x1d')](this['notificationId'],this[_0x9901('0x4')]['id'],this[_0x9901('0x6')]['agents'][this[_0x9901('0x5')]['id']],null,this['routing']);this['realtime'][_0x9901('0x15')][this[_0x9901('0x5')]['id']][_0x9901('0x17')]=![];this['realtime'][_0x9901('0x15')][this[_0x9901('0x5')]['id']][_0x9901('0x18')]=undefined;util[_0x9901('0x1a')](this[_0x9901('0x4')]['id'],this['realtime'][_0x9901('0x15')][this[_0x9901('0x5')]['id']],_0x87557e?_0x9901('0x1e'):'TIMEOUT');}if(!_0x87557e){setTimeout(this[_0x9901('0xc')]['bind'](this),0x3e8);}};function agent(_0x1fcc43,_0x1a6142,_0x55ea4f,_0x16a11b){return new Agent(_0x1fcc43,_0x1a6142,_0x55ea4f,_0x16a11b);}module[_0x9901('0x1f')]=agent; \ No newline at end of file +var _0xe3d2=['channel','busyQueue','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','agent','realtime','squeue','handleRun','handleTimeout','bind','timeout','drained','push','prototype','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents'];(function(_0x14d0e1,_0x2ccfd7){var _0x1bcac6=function(_0x41ccc7){while(--_0x41ccc7){_0x14d0e1['push'](_0x14d0e1['shift']());}};_0x1bcac6(++_0x2ccfd7);}(_0xe3d2,0x1b0));var _0x2e3d=function(_0x11f4b5,_0x279f0d){_0x11f4b5=_0x11f4b5-0x0;var _0x59d5e0=_0xe3d2[_0x11f4b5];return _0x59d5e0;};'use strict';var _=require(_0x2e3d('0x0'));var uuid=require('uuid');var util=require(_0x2e3d('0x1'));var logger=require(_0x2e3d('0x2'))(_0x2e3d('0x3'));var Agent=function(_0x34b693,_0x8a432e,_0x1cf085,_0x424fbf){this[_0x2e3d('0x4')]=uuid['v4']();this['squeue']=_0x34b693;this[_0x2e3d('0x5')]=_0x8a432e;this[_0x2e3d('0x6')]=_0x1cf085;this[_0x2e3d('0x3')]=_0x424fbf;this[_0x2e3d('0x7')]['push'](this[_0x2e3d('0x8')]['bind'](this),this[_0x2e3d('0x9')][_0x2e3d('0xa')](this));this[_0x2e3d('0x7')]['on'](_0x2e3d('0xb'),this['handleTimeout'][_0x2e3d('0xa')](this));this[_0x2e3d('0x7')]['on'](_0x2e3d('0xc'),this['handleDrained'][_0x2e3d('0xa')](this));};Agent['prototype']['push']=function(){this['squeue'][_0x2e3d('0xd')](this[_0x2e3d('0x8')][_0x2e3d('0xa')](this),this[_0x2e3d('0x9')][_0x2e3d('0xa')](this));};Agent[_0x2e3d('0xe')][_0x2e3d('0xf')]=function(){this[_0x2e3d('0x9')](!![]);};Agent['prototype'][_0x2e3d('0x8')]=function(_0x3de084){logger[_0x2e3d('0x10')](_0x2e3d('0x11'),this[_0x2e3d('0x7')]['id'],this['agent']['id']);if(_[_0x2e3d('0x12')](this['realtime']['agents'][this[_0x2e3d('0x5')]['id']])){logger[_0x2e3d('0x10')](_0x2e3d('0x13'),this[_0x2e3d('0x7')]['id'],this[_0x2e3d('0x5')]['id']);setTimeout(this[_0x2e3d('0xd')][_0x2e3d('0xa')](this),0x3e8);}else{if(this[_0x2e3d('0x3')][_0x2e3d('0x14')]||util[_0x2e3d('0x15')](this[_0x2e3d('0x7')]['id'],this[_0x2e3d('0x6')][_0x2e3d('0x16')][this[_0x2e3d('0x5')]['id']],this['squeue'][_0x2e3d('0x17')],![])){this['realtime'][_0x2e3d('0x16')][this[_0x2e3d('0x5')]['id']]['busy']=!![];this['realtime'][_0x2e3d('0x16')][this[_0x2e3d('0x5')]['id']][_0x2e3d('0x18')]=undefined;util['showNotification'](this[_0x2e3d('0x4')],this[_0x2e3d('0x7')]['id'],this[_0x2e3d('0x6')][_0x2e3d('0x16')][this[_0x2e3d('0x5')]['id']],null,this['routing']);util[_0x2e3d('0x19')](this[_0x2e3d('0x7')]['id'],this[_0x2e3d('0x6')]['agents'][this['agent']['id']],_0x2e3d('0x1a')+(this['routing'][_0x2e3d('0x14')]?_0x2e3d('0x1b'):''));}else{logger['info'](_0x2e3d('0x1c'),this['squeue']['id'],this[_0x2e3d('0x5')]['id']);setTimeout(this[_0x2e3d('0xd')][_0x2e3d('0xa')](this),0x3e8);}}};Agent[_0x2e3d('0xe')][_0x2e3d('0x9')]=function(_0x1456dc){if(_[_0x2e3d('0x12')](this[_0x2e3d('0x6')][_0x2e3d('0x16')][this[_0x2e3d('0x5')]['id']])){return logger['info'](_0x2e3d('0x13'),this[_0x2e3d('0x7')]['id'],this[_0x2e3d('0x5')]['id']);}else{logger[_0x2e3d('0x10')](_0x2e3d('0x1d'),this['squeue']['id'],this[_0x2e3d('0x5')]['id']);util[_0x2e3d('0x1e')](this['notificationId'],this[_0x2e3d('0x7')]['id'],this[_0x2e3d('0x6')][_0x2e3d('0x16')][this['agent']['id']],null,this['routing']);this[_0x2e3d('0x6')][_0x2e3d('0x16')][this[_0x2e3d('0x5')]['id']][_0x2e3d('0x1f')]=![];this[_0x2e3d('0x6')][_0x2e3d('0x16')][this[_0x2e3d('0x5')]['id']][_0x2e3d('0x18')]=undefined;util[_0x2e3d('0x19')](this[_0x2e3d('0x7')]['id'],this[_0x2e3d('0x6')][_0x2e3d('0x16')][this['agent']['id']],_0x1456dc?_0x2e3d('0x20'):_0x2e3d('0x21'));}if(!_0x1456dc){setTimeout(this[_0x2e3d('0xd')][_0x2e3d('0xa')](this),0x3e8);}};function agent(_0x968019,_0x56d180,_0x7b5f20,_0x13f029){return new Agent(_0x968019,_0x56d180,_0x7b5f20,_0x13f029);}module[_0x2e3d('0x22')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index e0a11e8..0135fe9 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 _0xfd04=['../../../../../config/logger','routing','notificationId','queue','realtime','squeue','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','isNil','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','RINGING','busy','busyQueue','showNotification','info','[%s][QUEUE]\x20EMPTY','writeLog','STOP','TIMEOUT','exports','uuid','./util'];(function(_0x229a6b,_0x5e4a9a){var _0x5edf49=function(_0x30985c){while(--_0x30985c){_0x229a6b['push'](_0x229a6b['shift']());}};_0x5edf49(++_0x5e4a9a);}(_0xfd04,0xbe));var _0x4fd0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfd04[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var uuid=require(_0x4fd0('0x0'));var util=require(_0x4fd0('0x1'));var logger=require(_0x4fd0('0x2'))(_0x4fd0('0x3'));var Beepall=function(_0x1a8694,_0x5a4f68,_0x486f1f,_0x283bb6){this[_0x4fd0('0x4')]=uuid['v4']();this['squeue']=_0x1a8694;this[_0x4fd0('0x5')]=_0x5a4f68;this[_0x4fd0('0x6')]=_0x486f1f;this[_0x4fd0('0x3')]=_0x283bb6;this[_0x4fd0('0x7')][_0x4fd0('0x8')](this[_0x4fd0('0x9')][_0x4fd0('0xa')](this),this[_0x4fd0('0xb')][_0x4fd0('0xa')](this));this[_0x4fd0('0x7')]['on']('timeout',this['handleTimeout'][_0x4fd0('0xa')](this));this[_0x4fd0('0x7')]['on'](_0x4fd0('0xc'),this[_0x4fd0('0xd')][_0x4fd0('0xa')](this));};Beepall[_0x4fd0('0xe')]['push']=function(){this[_0x4fd0('0x7')]['push'](this[_0x4fd0('0x9')][_0x4fd0('0xa')](this),this[_0x4fd0('0xb')][_0x4fd0('0xa')](this));};Beepall[_0x4fd0('0xe')][_0x4fd0('0xd')]=function(_0x567a6d){this[_0x4fd0('0xb')](!![]);};Beepall[_0x4fd0('0xe')][_0x4fd0('0x9')]=function(_0xb6b956){var _0x39d9b7=!![];if(!_[_0x4fd0('0xf')](this[_0x4fd0('0x5')])&&!_[_0x4fd0('0xf')](this['queue'][_0x4fd0('0x10')])&&this[_0x4fd0('0x5')][_0x4fd0('0x10')][_0x4fd0('0x11')]>0x0){for(var _0x2a83bb=0x0,_0x313161;_0x2a83bb0x0){for(var _0x24a69b=0x0,_0x116d76;_0x24a69b0x0&&_0x34910d[_0x48819d+_0xd557('0x1f')]>=_0x34910d[_0x48819d+_0xd557('0x1e')]){writeLog(_0x5b0a7d,_0x34910d,_0x48819d[_0xd557('0x20')]()+_0xd557('0x21'));return![];}}return!![];};exports['showNotification']=function(_0x176088,_0x577e46,_0x552f2c,_0x4074db,_0x2fbc3e){return sendNotification(!![],_0x176088,_0x577e46,_0x552f2c,_0x4074db,_0x2fbc3e);};exports[_0xd557('0x22')]=function(_0x1e6bc4,_0xee9dea,_0x31edbf,_0x14b17b,_0x1a896e){return sendNotification(![],_0x1e6bc4,_0xee9dea,_0x31edbf,_0x14b17b,_0x1a896e);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x6dcd=['isAgentAvailable','BUSY','online','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','showNotification','writeLog','util','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','format','name','split','account','notificationSound','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','message','user:%s','notification:%s','save','remove'];(function(_0xc15cf0,_0xff9d1b){var _0x313d7e=function(_0x3cab32){while(--_0x3cab32){_0xc15cf0['push'](_0xc15cf0['shift']());}};_0x313d7e(++_0xff9d1b);}(_0x6dcd,0xa2));var _0xd6dc=function(_0x4d83ad,_0x151de2){_0x4d83ad=_0x4d83ad-0x0;var _0x20801a=_0x6dcd[_0x4d83ad];return _0x20801a;};'use strict';var _=require('lodash');var util=require(_0xd6dc('0x0'));var utils=require('../utils');var Mustache=require(_0xd6dc('0x1'));var Redis=require(_0xd6dc('0x2'));var config=require(_0xd6dc('0x3'));var logger=require(_0xd6dc('0x4'))(_0xd6dc('0x5'));config[_0xd6dc('0x6')]=_[_0xd6dc('0x7')](config[_0xd6dc('0x6')],{'host':_0xd6dc('0x8'),'port':0x18eb});var io=require(_0xd6dc('0x9'))(new Redis(config[_0xd6dc('0x6')]));function emit(_0xe241a,_0x160480,_0x40fa8e){io['to'](_0xe241a)[_0xd6dc('0xa')](_0x160480,_0x40fa8e);}function sendNotification(_0x755f01,_0x1c1748,_0x5e3df1,_0x235f11,_0x44f6f7,_0x30854e){io['to'](util[_0xd6dc('0xb')]('user:%s',_0x235f11[_0xd6dc('0xc')]))['emit']('user:save',_0x235f11);var _0x4b8096=_0x30854e||{};var _0x432e5a=_0x5e3df1[_0xd6dc('0xd')]('.');var _0x172f90={'uniqueid':_0x1c1748,'channel':_0x432e5a[0x0],'id':_0x432e5a[0x1],'title':_0x432e5a[0x0]+'\x20interaction','interactionId':_0x432e5a[0x2],'queue':_0x44f6f7?_0x44f6f7['name']:null,'sound':_0x4b8096[_0xd6dc('0xe')][_0xd6dc('0xf')],'shake':_0x4b8096[_0xd6dc('0xe')]['notificationShake']};try{if(!_0x4b8096[_0xd6dc('0x10')]){_0x4b8096[_0xd6dc('0x10')]={};}if(_0x44f6f7){_0x4b8096['body'][_0xd6dc('0x11')]=_0x44f6f7;}else if(_0x4b8096[_0xd6dc('0x10')]['queue']){delete _0x4b8096[_0xd6dc('0x10')][_0xd6dc('0x11')];}_0x172f90[_0xd6dc('0x12')]=utils[_0xd6dc('0x13')](_0x4b8096[_0xd6dc('0xe')][_0xd6dc('0x14')],_0x4b8096);}catch(_0x2c4108){_0x172f90[_0xd6dc('0x12')]=_0xd6dc('0x15');logger['error'](util[_0xd6dc('0xb')](_0xd6dc('0x16'),_0x1c1748,_0x2c4108[_0xd6dc('0x17')]));}io['to'](util['format'](_0xd6dc('0x18'),_0x235f11[_0xd6dc('0xc')]))[_0xd6dc('0xa')](util[_0xd6dc('0xb')](_0xd6dc('0x19'),_0x755f01?_0xd6dc('0x1a'):_0xd6dc('0x1b')),_0x172f90);}function writeLog(_0x12c8ea,_0x5a12dc,_0x243780){return logger['info'](util[_0xd6dc('0xb')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x12c8ea,_0x5a12dc[_0xd6dc('0xc')],_0x243780));}exports[_0xd6dc('0x1c')]=function(_0x1072c5,_0xc37a50,_0x905295,_0x57f19c){if(_0xc37a50['busy']){writeLog(_0x1072c5,_0xc37a50,_0xd6dc('0x1d'));return![];}if(!_0xc37a50[_0xd6dc('0x1e')]){writeLog(_0x1072c5,_0xc37a50,'OFFLINE');return![];}if(_0xc37a50[_0x905295+_0xd6dc('0x1f')]){writeLog(_0x1072c5,_0xc37a50,_0xd6dc('0x20'));return![];}if(_0x57f19c&&_0xc37a50[_0xd6dc('0x21')](_0x905295+'Capacity')&&_0xc37a50[_0xd6dc('0x21')](_0x905295+_0xd6dc('0x22'))){if(_0xc37a50[_0x905295+_0xd6dc('0x23')]>0x0&&_0xc37a50[_0x905295+_0xd6dc('0x22')]>=_0xc37a50[_0x905295+'Capacity']){writeLog(_0x1072c5,_0xc37a50,_0x905295['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xd6dc('0x24')]=function(_0x3ac99e,_0x96d4ee,_0x5de7cc,_0x22f9af,_0x24d891){return sendNotification(!![],_0x3ac99e,_0x96d4ee,_0x5de7cc,_0x22f9af,_0x24d891);};exports['hideNotification']=function(_0x486449,_0x4afca8,_0xc6d7fb,_0x5d3e8a,_0x1b37da){return sendNotification(![],_0x486449,_0x4afca8,_0xc6d7fb,_0x5d3e8a,_0x1b37da);};exports[_0xd6dc('0x25')]=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 93d3be8..1428802 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 _0xb332=['../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','message','info','next','getMustacheRender','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','[%s][SYSTEM]\x20%s','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','shelljs','lodash','./utils'];(function(_0x784659,_0x4b0f9a){var _0x2d76ff=function(_0x4b9b67){while(--_0x4b9b67){_0x784659['push'](_0x784659['shift']());}};_0x2d76ff(++_0x4b0f9a);}(_0xb332,0x183));var _0x2b33=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0xb332[_0x4394b6];return _0x360244;};'use strict';var schema=require('validate');var sh=require(_0x2b33('0x0'));var _=require(_0x2b33('0x1'));var utils=require(_0x2b33('0x2'));var logger=require(_0x2b33('0x3'))(_0x2b33('0x4'));var system=schema({'command':{'type':_0x2b33('0x5'),'required':!![],'message':_0x2b33('0x6')}});exports[_0x2b33('0x7')]=function(_0x29d88b,_0x419bf4){return function(_0x3098b9){try{var _0x392e92={'command':_0x419bf4[0x0]};var _0x51332d=system['validate'](_0x392e92,{'typecast':!![]});if(_0x51332d[_0x2b33('0x8')]){logger[_0x2b33('0x9')]('[%s][SYSTEM]\x20%s',_0x29d88b,_['map'](_0x51332d,_0x2b33('0xa'))['join'](',\x20'));logger[_0x2b33('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x29d88b);_0x3098b9[_0x2b33('0xc')]();}else{var _0x4ad7d8=this;var _0x2b6820=utils[_0x2b33('0xd')](_0x419bf4[0x0],this);logger[_0x2b33('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x29d88b,_0x2b6820);sh[_0x2b33('0xe')](_['trim'](_0x2b6820),function(_0x46505b,_0x499758){logger[_0x2b33('0xb')](_0x2b33('0xf'),_0x29d88b,_0x46505b);if(_0x46505b==0x0){var _0x4e638f=_0x499758[_0x2b33('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x2b33('0x11')](_0x419bf4[0x1])||_[_0x2b33('0x12')](_0x419bf4[0x1])){logger[_0x2b33('0xb')](_0x2b33('0x13'),_0x29d88b);_0x4ad7d8['body'][_0x419bf4[0x1]]=_0x4e638f;}else{logger[_0x2b33('0xb')](_0x2b33('0x14'),_0x29d88b,_0x419bf4[0x1],_0x4e638f);_0x4ad7d8[_0x2b33('0x15')][_0x419bf4[0x1]]=_0x4e638f;}}_0x3098b9[_0x2b33('0xc')]();});}}catch(_0xcbffed){logger['error'](_0x2b33('0x16'),_0x29d88b,_[_0x2b33('0x17')](_0xcbffed)?JSON[_0x2b33('0x18')](_0xcbffed):_0xcbffed);logger['info'](_0x2b33('0x19'),_0x29d88b);_0x3098b9[_0x2b33('0xc')]();}};}; \ No newline at end of file +var _0x67ad=['exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','[%s][SYSTEM]\x20commnad:\x20%s'];(function(_0x288a51,_0x3fec66){var _0x2f1f3a=function(_0x247b2c){while(--_0x247b2c){_0x288a51['push'](_0x288a51['shift']());}};_0x2f1f3a(++_0x3fec66);}(_0x67ad,0x15b));var _0xd67a=function(_0x488329,_0x3ef732){_0x488329=_0x488329-0x0;var _0x17c7b3=_0x67ad[_0x488329];return _0x17c7b3;};'use strict';var schema=require('validate');var sh=require(_0xd67a('0x0'));var _=require(_0xd67a('0x1'));var utils=require(_0xd67a('0x2'));var logger=require(_0xd67a('0x3'))(_0xd67a('0x4'));var system=schema({'command':{'type':_0xd67a('0x5'),'required':!![],'message':_0xd67a('0x6')}});exports[_0xd67a('0x7')]=function(_0x14abaa,_0x41d75d){return function(_0x2a90d7){try{var _0x3a57e9={'command':_0x41d75d[0x0]};var _0x2d14c5=system[_0xd67a('0x8')](_0x3a57e9,{'typecast':!![]});if(_0x2d14c5['length']){logger[_0xd67a('0x9')](_0xd67a('0xa'),_0x14abaa,_[_0xd67a('0xb')](_0x2d14c5,_0xd67a('0xc'))[_0xd67a('0xd')](',\x20'));logger[_0xd67a('0xe')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x14abaa);_0x2a90d7[_0xd67a('0xf')]();}else{var _0x537edd=this;var _0x3bb91e=utils['getMustacheRender'](_0x41d75d[0x0],this);logger[_0xd67a('0xe')](_0xd67a('0x10'),_0x14abaa,_0x3bb91e);sh[_0xd67a('0x11')](_[_0xd67a('0x12')](_0x3bb91e),function(_0x41279a,_0xf6c600){logger[_0xd67a('0xe')](_0xd67a('0x13'),_0x14abaa,_0x41279a);if(_0x41279a==0x0){var _0x3231ac=_0xf6c600[_0xd67a('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0xd67a('0x15')](_0x41d75d[0x1])||_[_0xd67a('0x16')](_0x41d75d[0x1])){logger[_0xd67a('0xe')]('[%s][SYSTEM]\x20no\x20variable',_0x14abaa);_0x537edd[_0xd67a('0x17')][_0x41d75d[0x1]]=_0x3231ac;}else{logger[_0xd67a('0xe')](_0xd67a('0x18'),_0x14abaa,_0x41d75d[0x1],_0x3231ac);_0x537edd[_0xd67a('0x17')][_0x41d75d[0x1]]=_0x3231ac;}}_0x2a90d7[_0xd67a('0xf')]();});}}catch(_0x568128){logger['error']('[%s][SYSTEM]\x20%s',_0x14abaa,_[_0xd67a('0x19')](_0x568128)?JSON[_0xd67a('0x1a')](_0x568128):_0x568128);logger[_0xd67a('0xe')](_0xd67a('0x1b'),_0x14abaa);_0x2a90d7['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 792796e..d4bf042 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 _0x1c7d=['../../../../config/logger','routing','number','consequence','length','[%s][TAG]\x20%s','map','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','finally','next','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0x43377e,_0x2cc251){var _0x22feb9=function(_0x3dd435){while(--_0x3dd435){_0x43377e['push'](_0x43377e['shift']());}};_0x22feb9(++_0x2cc251);}(_0x1c7d,0x164));var _0xd1c7=function(_0x66fa2f,_0x9dfc3){_0x66fa2f=_0x66fa2f-0x0;var _0x26d594=_0x1c7d[_0x66fa2f];return _0x26d594;};'use strict';var schema=require(_0xd1c7('0x0'));var _=require(_0xd1c7('0x1'));var rpc={'chatInteraction':require(_0xd1c7('0x2')),'openchannelInteraction':require(_0xd1c7('0x3')),'smsInteraction':require(_0xd1c7('0x4')),'mailInteraction':require(_0xd1c7('0x5')),'faxInteraction':require(_0xd1c7('0x6')),'whatsappInteraction':require(_0xd1c7('0x7'))};var logger=require(_0xd1c7('0x8'))(_0xd1c7('0x9'));var tag=schema({'tag':{'type':_0xd1c7('0xa'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xd1c7('0xb')]=function(_0x2941de,_0x36f0cb,_0x409bfb,_0x5094c9){return function(_0x32bc3a){try{var _0x5e7ae0={'tag':_0x36f0cb[0x0]};var _0x248544=tag['validate'](_0x5e7ae0,{'typecast':!![]});if(_0x248544[_0xd1c7('0xc')]){logger['error'](_0xd1c7('0xd'),_0x2941de,_[_0xd1c7('0xe')](_0x248544,'message')['join'](',\x20'));logger[_0xd1c7('0xf')](_0xd1c7('0x10'),_0x2941de);_0x32bc3a['next']();}else{var _0x1c11ca={'ids':[_0x36f0cb[0x0]]};if(rpc[_0x5094c9[_0xd1c7('0x11')]+_0xd1c7('0x12')]){rpc[_0x5094c9[_0xd1c7('0x11')]+_0xd1c7('0x12')][_0xd1c7('0x13')](_0x5094c9[_0xd1c7('0x14')]['id'],_0x1c11ca)[_0xd1c7('0x15')](function(_0x27f624){logger['info'](_0xd1c7('0x16'),_0x2941de,_0x36f0cb[0x1],_0x5094c9['channel'],_0x5094c9['interaction']['id']);})[_0xd1c7('0x17')](function(_0xa8f2a5){logger[_0xd1c7('0x18')]('[%s][TAG]\x20%s',_0x2941de,JSON[_0xd1c7('0x19')](_0xa8f2a5));logger[_0xd1c7('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2941de);})[_0xd1c7('0x1a')](function(){_0x32bc3a[_0xd1c7('0x1b')]();});}}}catch(_0x35ba56){logger[_0xd1c7('0x18')](_0xd1c7('0xd'),_0x2941de,_['isObject'](_0x35ba56)?JSON[_0xd1c7('0x19')](_0x35ba56):_0x35ba56);logger[_0xd1c7('0xf')](_0xd1c7('0x10'),_0x2941de);_0x32bc3a[_0xd1c7('0x1b')]();}};}; \ No newline at end of file +var _0xd459=['message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','then','info','interaction','catch','stringify','finally','isObject','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','consequence','validate','error','[%s][TAG]\x20%s'];(function(_0x5552ef,_0x1fc688){var _0x158241=function(_0x499df4){while(--_0x499df4){_0x5552ef['push'](_0x5552ef['shift']());}};_0x158241(++_0x1fc688);}(_0xd459,0x69));var _0x9d45=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xd459[_0x24061a];return _0x82054e;};'use strict';var schema=require('validate');var _=require('lodash');var rpc={'chatInteraction':require(_0x9d45('0x0')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x9d45('0x1')),'mailInteraction':require(_0x9d45('0x2')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x9d45('0x3'))(_0x9d45('0x4'));var tag=schema({'tag':{'type':_0x9d45('0x5'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x9d45('0x6')]=function(_0x12eae7,_0x6f319c,_0x54fbb9,_0x360b25){return function(_0x5c0f8b){try{var _0x42649c={'tag':_0x6f319c[0x0]};var _0x46dd8f=tag[_0x9d45('0x7')](_0x42649c,{'typecast':!![]});if(_0x46dd8f['length']){logger[_0x9d45('0x8')](_0x9d45('0x9'),_0x12eae7,_['map'](_0x46dd8f,_0x9d45('0xa'))[_0x9d45('0xb')](',\x20'));logger['info'](_0x9d45('0xc'),_0x12eae7);_0x5c0f8b[_0x9d45('0xd')]();}else{var _0x567c5b={'ids':[_0x6f319c[0x0]]};if(rpc[_0x360b25[_0x9d45('0xe')]+_0x9d45('0xf')]){rpc[_0x360b25[_0x9d45('0xe')]+_0x9d45('0xf')]['addTags'](_0x360b25['interaction']['id'],_0x567c5b)[_0x9d45('0x10')](function(_0x33f98a){logger[_0x9d45('0x11')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x12eae7,_0x6f319c[0x1],_0x360b25[_0x9d45('0xe')],_0x360b25[_0x9d45('0x12')]['id']);})[_0x9d45('0x13')](function(_0x3834c4){logger[_0x9d45('0x8')]('[%s][TAG]\x20%s',_0x12eae7,JSON[_0x9d45('0x14')](_0x3834c4));logger[_0x9d45('0x11')](_0x9d45('0xc'),_0x12eae7);})[_0x9d45('0x15')](function(){_0x5c0f8b[_0x9d45('0xd')]();});}}}catch(_0xa1a09f){logger[_0x9d45('0x8')]('[%s][TAG]\x20%s',_0x12eae7,_[_0x9d45('0x16')](_0xa1a09f)?JSON[_0x9d45('0x14')](_0xa1a09f):_0xa1a09f);logger[_0x9d45('0x11')](_0x9d45('0xc'),_0x12eae7);_0x5c0f8b[_0x9d45('0xd')]();}};}; \ 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 c918783..8010bda 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 _0x9de3=['message','account','interaction','mustache','exports','merge','contact'];(function(_0x32cb1b,_0x164df8){var _0x3628c8=function(_0x58bb65){while(--_0x58bb65){_0x32cb1b['push'](_0x32cb1b['shift']());}};_0x3628c8(++_0x164df8);}(_0x9de3,0xea));var _0x39de=function(_0xc44b3,_0x5d3290){_0xc44b3=_0xc44b3-0x0;var _0x263561=_0x9de3[_0xc44b3];return _0x263561;};'use strict';var Mustache=require(_0x39de('0x0'));var _=require('lodash');module[_0x39de('0x1')]={'getMustacheRender':function(_0x43fb06,_0x33c312){return Mustache['render'](_0x43fb06,_[_0x39de('0x2')](_0x33c312['body'],{'contact':_0x33c312[_0x39de('0x3')],'message':_0x33c312[_0x39de('0x4')],'account':_0x33c312[_0x39de('0x5')],'interaction':_0x33c312[_0x39de('0x6')],'list':_0x33c312['list']}))||'';}}; \ No newline at end of file +var _0x1b73=['lodash','exports','merge','contact','message','interaction','list'];(function(_0xd0cb76,_0x1bbdf7){var _0x25bc35=function(_0x22fcd3){while(--_0x22fcd3){_0xd0cb76['push'](_0xd0cb76['shift']());}};_0x25bc35(++_0x1bbdf7);}(_0x1b73,0x1d5));var _0x31b7=function(_0x39ac40,_0x47641c){_0x39ac40=_0x39ac40-0x0;var _0x52001a=_0x1b73[_0x39ac40];return _0x52001a;};'use strict';var Mustache=require('mustache');var _=require(_0x31b7('0x0'));module[_0x31b7('0x1')]={'getMustacheRender':function(_0x46222e,_0x5c767e){return Mustache['render'](_0x46222e,_[_0x31b7('0x2')](_0x5c767e['body'],{'contact':_0x5c767e[_0x31b7('0x3')],'message':_0x5c767e[_0x31b7('0x4')],'account':_0x5c767e['account'],'interaction':_0x5c767e[_0x31b7('0x5')],'list':_0x5c767e[_0x31b7('0x6')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 88cd70c..40ea200 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 _0xa3e6=['../../../config/environment','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules','interaction','applications','isArray','length','existsSync','app','.js','autoreply','appdata','split','channel','mail','push','slice','join','dialogflow','dialogflowv2','amazonlex','message','TagId','format','%s:%s:%s','./interval','condition','intervals','consequence','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','stringify','emit','complete','info','No\x20applications\x20to\x20execute','stack','error','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','bluebird','uuid'];(function(_0x1ce63d,_0x18f80a){var _0x4e0034=function(_0xad2e5){while(--_0xad2e5){_0x1ce63d['push'](_0x1ce63d['shift']());}};_0x4e0034(++_0x18f80a);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x37dcd5,_0x4b456c){_0x37dcd5=_0x37dcd5-0x0;var _0x54319b=_0xa3e6[_0x37dcd5];return _0x54319b;};'use strict';var _=require(_0x6a3e('0x0'));var util=require('util');var path=require(_0x6a3e('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x6a3e('0x2'));var uuid=require(_0x6a3e('0x3'));var config=require(_0x6a3e('0x4'));var logger=require('../../../config/logger')(_0x6a3e('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x6a3e('0x6')),'chatQueueReport':require(_0x6a3e('0x7')),'smsQueueReport':require(_0x6a3e('0x8')),'faxQueueReport':require(_0x6a3e('0x9')),'whatsappQueueReport':require(_0x6a3e('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x3d7fbe,_0x3d2a86,_0x5c3b9f){return util['format'](_0x6a3e('0xb'),_0x3d7fbe,_0x3d2a86||0x0,_0x5c3b9f||0x0);}function getIntervals(_0x5707de,_0x54a40c){var _0xef2185=[];if(!_['isNil'](_0x54a40c[_0x6a3e('0xc')])&&!_['isNil'](_0x5707de[_0x54a40c[_0x6a3e('0xc')]])&&!_[_0x6a3e('0xd')](_0x5707de[_0x54a40c[_0x6a3e('0xc')]][_0x6a3e('0xe')])){_0xef2185=_[_0x6a3e('0xf')](_0x5707de[_0x54a40c[_0x6a3e('0xc')]]['Intervals'],_0x6a3e('0x10'));}else if(!_[_0x6a3e('0xd')](_0x54a40c[_0x6a3e('0x10')])){_0xef2185=[_0x54a40c[_0x6a3e('0x10')]];}return _0xef2185;}exports[_0x6a3e('0x11')]=function(_0x31aefa){_0x31aefa[_0x6a3e('0x12')]={};return new BPromise(function(_0x4bd05f,_0x2e911b){var _0x13b172={'Start':function(_0x8ed74b){var _0x2a62a8=this;return new Promise(function(_0x500ccd,_0x462b8d){if(_0x8ed74b){try{var _0x24666d=[];var _0x5de9a7=getId(_0x8ed74b['channel'],_0x8ed74b['message']?_0x8ed74b['message']['id']:0x0,_0x8ed74b['interaction']?_0x8ed74b[_0x6a3e('0x13')]['id']:0x0);if(_0x8ed74b[_0x6a3e('0x14')]&&_[_0x6a3e('0x15')](_0x8ed74b[_0x6a3e('0x14')])&&_0x8ed74b[_0x6a3e('0x14')][_0x6a3e('0x16')]){for(var _0x1d6ccc=0x0;_0x1d6ccc<_0x8ed74b[_0x6a3e('0x14')]['length'];_0x1d6ccc+=0x1){var _0x3d1e03=_0x8ed74b['applications'][_0x1d6ccc];if(fs[_0x6a3e('0x17')](path['join'](__dirname,_0x6a3e('0x14'),_0x3d1e03[_0x6a3e('0x18')]+_0x6a3e('0x19')))){var _0x350b66=[];switch(_0x3d1e03['app']['toLowerCase']()){case _0x6a3e('0x1a'):var _0x2d811f=_0x3d1e03[_0x6a3e('0x1b')][_0x6a3e('0x1c')](',');if(_0x8ed74b[_0x6a3e('0x1d')]===_0x6a3e('0x1e')){_0x350b66[_0x6a3e('0x1f')](_0x2d811f[0x0]);_0x350b66[_0x6a3e('0x1f')](_0x2d811f[0x1]);_0x350b66[_0x6a3e('0x1f')](_0x2d811f[_0x6a3e('0x20')](0x2,_0x2d811f[_0x6a3e('0x16')])[_0x6a3e('0x21')](','));}else{_0x350b66[_0x6a3e('0x1f')](_0x2d811f[0x0]);_0x350b66[_0x6a3e('0x1f')](_0x2d811f[_0x6a3e('0x20')](0x1,_0x2d811f['length'])['join'](','));}break;case _0x6a3e('0x22'):var _0x6cc7c4=_0x3d1e03[_0x6a3e('0x1b')][_0x6a3e('0x1c')](',');_0x350b66[_0x6a3e('0x1f')](_0x6cc7c4[0x0]);_0x350b66[_0x6a3e('0x1f')](_0x6cc7c4[0x1]);_0x350b66[_0x6a3e('0x1f')](_0x6cc7c4[_0x6a3e('0x20')](0x2,_0x6cc7c4[_0x6a3e('0x16')])[_0x6a3e('0x21')](','));break;case _0x6a3e('0x23'):var _0x508a55=_0x3d1e03['appdata'][_0x6a3e('0x1c')](',');_0x350b66['push'](_0x508a55[0x0]);_0x350b66[_0x6a3e('0x1f')](_0x508a55[0x1]);_0x350b66['push'](_0x508a55[0x2]);_0x350b66['push'](_0x508a55[0x3]);_0x350b66[_0x6a3e('0x1f')](_0x508a55[_0x6a3e('0x20')](0x4,_0x508a55['length'])['join'](','));break;case _0x6a3e('0x24'):var _0x431a9e=_0x3d1e03[_0x6a3e('0x1b')][_0x6a3e('0x1c')](',');_0x350b66['push'](_0x431a9e[0x0]);_0x350b66['push'](_0x431a9e[0x1]);_0x350b66[_0x6a3e('0x1f')](_0x431a9e[0x2]);_0x350b66[_0x6a3e('0x1f')](_0x431a9e[0x3]);_0x350b66[_0x6a3e('0x1f')](_0x431a9e[_0x6a3e('0x20')](0x4,_0x431a9e['length'])[_0x6a3e('0x21')](','));break;case _0x6a3e('0x25'):_0x350b66['push'](_0x3d1e03['appdata']);break;case'tag':_0x350b66[_0x6a3e('0x1f')](_0x3d1e03[_0x6a3e('0x26')]);_0x350b66[_0x6a3e('0x1f')](_0x3d1e03[_0x6a3e('0x1b')]);break;default:_0x350b66=_[_0x6a3e('0xd')](_0x3d1e03[_0x6a3e('0x1b')])?[]:_0x3d1e03[_0x6a3e('0x1b')][_0x6a3e('0x1c')](',');}var _0x4044d0={'id':util[_0x6a3e('0x27')](_0x6a3e('0x28'),_0x5de9a7,_0x3d1e03['id'],_0x3d1e03[_0x6a3e('0x18')]),'condition':require(_0x6a3e('0x29'))[_0x6a3e('0x2a')](_0x5de9a7,getIntervals(_0x31aefa[_0x6a3e('0x2b')],_0x3d1e03),_0x31aefa),'consequence':require('./applications/'+_0x3d1e03[_0x6a3e('0x18')])[_0x6a3e('0x2c')](_0x5de9a7,_0x350b66,_0x31aefa,_0x8ed74b),'p':_0x3d1e03[_0x6a3e('0x2d')]||0x0};logger['info'](_0x6a3e('0x2e'),_0x4044d0['id'],_0x6a3e('0x2f'),getIntervals(_0x31aefa['intervals'],_0x3d1e03)[_0x6a3e('0x21')](_0x6a3e('0x30')));_0x24666d[_0x6a3e('0x1f')](_0x4044d0);}else{logger['error'](_0x6a3e('0x31'),path[_0x6a3e('0x21')](__dirname,_0x6a3e('0x14'),_0x3d1e03[_0x6a3e('0x18')]+_0x6a3e('0x19')));}}_0x31aefa[_0x6a3e('0x12')][_0x5de9a7]=new RuleEngine(_0x24666d);_0x31aefa['rules'][_0x5de9a7][_0x6a3e('0x32')](_0x8ed74b,function(_0x55f1d4){logger['info']('Applications\x20executed',JSON[_0x6a3e('0x33')](_0x55f1d4['matchPath']));if(_0x31aefa[_0x6a3e('0x12')][_0x5de9a7]){_0x31aefa[_0x6a3e('0x12')][_0x5de9a7][_0x6a3e('0x34')](_0x6a3e('0x35'));}});return _0x500ccd({'code':0xc8,'message':_0x8ed74b});}else{logger[_0x6a3e('0x36')](_0x6a3e('0x37'));return _0x500ccd({'code':0xc8,'message':_0x8ed74b});}}catch(_0x480981){logger['error'](_0x480981[_0x6a3e('0x38')]);return _0x462b8d(_0x2a62a8[_0x6a3e('0x39')](0x1f4,_0x480981));}}return _0x462b8d(_0x6a3e('0x3a'));});},'AcceptMessage':function(_0x25c353){var _0x1dd524=this;return new Promise(function(_0x57f40b,_0xbba7c6){if(_0x25c353[_0x6a3e('0x3b')]&&_0x25c353['agent']['id']){if(_0x31aefa[_0x6a3e('0x3c')][_0x25c353[_0x6a3e('0x3b')]['id']]){_0x31aefa[_0x6a3e('0x3c')][_0x25c353['agent']['id']][_0x6a3e('0x3d')]=![];_0x31aefa[_0x6a3e('0x3c')][_0x25c353[_0x6a3e('0x3b')]['id']][_0x6a3e('0x3e')]=undefined;}}if(_0x25c353[_0x6a3e('0x25')]&&_0x25c353[_0x6a3e('0x25')]['id']){try{var _0x5f49d6=getId(_0x25c353[_0x6a3e('0x1d')],_0x25c353[_0x6a3e('0x25')]?_0x25c353[_0x6a3e('0x25')]['id']:0x0,_0x25c353['interaction']?_0x25c353[_0x6a3e('0x13')]['id']:0x0);if(_0x31aefa['rules'][_0x5f49d6]){_0x31aefa['rules'][_0x5f49d6][_0x6a3e('0x34')](_0x6a3e('0x3f'));if(rpc[_0x25c353[_0x6a3e('0x1d')]+'QueueReport']){rpc[_0x25c353['channel']+_0x6a3e('0x40')][_0x6a3e('0x41')](_0x5f49d6,{'UserId':_0x25c353[_0x6a3e('0x25')][_0x6a3e('0x42')]})[_0x6a3e('0x43')](function(_0xb084a0){logger['error'](_0x6a3e('0x44'));});}}return _0x57f40b({'code':0xc8,'message':_0x25c353});}catch(_0x24348c){logger[_0x6a3e('0x39')](_0x24348c[_0x6a3e('0x38')]);return _0xbba7c6(_0x1dd524[_0x6a3e('0x39')](0x1f4,_0x24348c));}}logger[_0x6a3e('0x39')](_0x6a3e('0x45'));return _0xbba7c6(_0x1dd524[_0x6a3e('0x39')](0x1f4,_0x6a3e('0x45')));});},'RejectMessage':function(_0x4d36e2){var _0x40a09d=this;return new Promise(function(_0x1d55ee,_0x4f0211){if(_0x4d36e2[_0x6a3e('0x3b')]&&_0x4d36e2['agent']['id']){try{if(_0x31aefa[_0x6a3e('0x3c')][_0x4d36e2[_0x6a3e('0x3b')]['id']]){_0x31aefa[_0x6a3e('0x3c')][_0x4d36e2['agent']['id']][_0x6a3e('0x3d')]=![];_0x31aefa[_0x6a3e('0x3c')][_0x4d36e2['agent']['id']]['busyQueue']=undefined;}return _0x1d55ee({'code':0xc8,'message':_0x4d36e2});}catch(_0x4997d7){logger[_0x6a3e('0x39')](_0x4997d7[_0x6a3e('0x38')]);return _0x4f0211(_0x40a09d[_0x6a3e('0x39')](0x1f4,_0x4997d7));}}logger[_0x6a3e('0x39')](_0x6a3e('0x45'));return _0x4f0211(_0x40a09d[_0x6a3e('0x39')](0x1f4,_0x6a3e('0x45')));});},'AbandonInteraction':function(_0x1ce964){var _0x4615fa=this;return new Promise(function(_0x196470,_0x15872d){if(_0x1ce964['channel']&&_0x1ce964[_0x6a3e('0x13')]&&_0x1ce964[_0x6a3e('0x13')]['id']){try{var _0x3fabf8=getId(_0x1ce964[_0x6a3e('0x1d')],_0x1ce964[_0x6a3e('0x25')]?_0x1ce964['message']['id']:0x0,_0x1ce964[_0x6a3e('0x13')]?_0x1ce964['interaction']['id']:0x0);if(_0x31aefa[_0x6a3e('0x12')][_0x3fabf8]){_0x31aefa[_0x6a3e('0x12')][_0x3fabf8][_0x6a3e('0x34')](_0x6a3e('0x3f'));}return _0x196470({'code':0xc8,'message':_0x1ce964});}catch(_0x1a72d1){logger['error'](_0x1a72d1['stack']);return _0x15872d(_0x4615fa['error'](0x1f4,_0x1a72d1));}}logger[_0x6a3e('0x39')](_0x6a3e('0x45'));return _0x15872d(_0x4615fa[_0x6a3e('0x39')](0x1f4,_0x6a3e('0x45')));});},'AgentCapacity':function(_0x13d520){var _0x2648a0=this;return new Promise(function(_0x504d86,_0x1d94e8){if(_0x31aefa['agents']['hasOwnProperty'](_0x13d520['id'])){for(var _0x54f666 in _0x13d520[_0x6a3e('0x46')]){if(_0x13d520[_0x6a3e('0x46')]['hasOwnProperty'](_0x54f666)){if(_0x31aefa[_0x6a3e('0x3c')][_0x13d520['id']][_0x6a3e('0x47')](_0x54f666+'CurrentCapacity')){_0x31aefa[_0x6a3e('0x3c')][_0x13d520['id']][_0x54f666+_0x6a3e('0x48')]=parseInt(_0x13d520[_0x6a3e('0x46')][_0x54f666],0xa);}}}_0x31aefa[_0x6a3e('0x3c')][_0x13d520['id']][_0x6a3e('0x49')]();return _0x504d86({'code':0xc8,'message':_0x31aefa['agents'][_0x13d520['id']]});}else{return _0x1d94e8(_0x2648a0[_0x6a3e('0x39')](0x1f4,_0x6a3e('0x4a')));}});},'Agents':function(_0x51d5fb){return new Promise(function(_0x132fd9,_0x30fe3b){var _0xbfecf4=_[_0x6a3e('0x4b')](_0x31aefa[_0x6a3e('0x3c')]);_0x132fd9({'count':_0xbfecf4[_0x6a3e('0x16')],'rows':_0xbfecf4});});},'ChatQueues':function(_0x14fd86){return new Promise(function(_0x15799b,_0x4756f6){var _0x1b07f6=[];for(var _0xd90a4d in _0x31aefa['chatQueues']){if(_0x31aefa[_0x6a3e('0x4c')][_0x6a3e('0x47')](_0xd90a4d)){var _0x437a88=_0x31aefa['chatQueues'][_0xd90a4d];var _0x32b55a={'id':_0x437a88['id'],'available':_0x437a88[_0x6a3e('0x4d')],'loggedIn':_0x437a88[_0x6a3e('0x4e')],'name':_0x437a88[_0x6a3e('0x4f')],'paused':_0x437a88['paused'],'waiting':_0x437a88[_0x6a3e('0x50')]};_0x1b07f6['push'](_0x32b55a);}}_0x15799b({'count':_0x1b07f6[_0x6a3e('0x16')],'rows':_0x1b07f6});});},'MailQueues':function(_0x4f68eb){return new Promise(function(_0x3a4181,_0x486d4a){var _0x471e73=[];for(var _0x2d5cfe in _0x31aefa[_0x6a3e('0x51')]){if(_0x31aefa[_0x6a3e('0x51')][_0x6a3e('0x47')](_0x2d5cfe)){var _0x3ebaef=_0x31aefa[_0x6a3e('0x51')][_0x2d5cfe];var _0x54ae99={'id':_0x3ebaef['id'],'available':_0x3ebaef[_0x6a3e('0x4d')],'loggedIn':_0x3ebaef[_0x6a3e('0x4e')],'name':_0x3ebaef[_0x6a3e('0x4f')],'paused':_0x3ebaef[_0x6a3e('0x52')],'waiting':_0x3ebaef[_0x6a3e('0x50')]};_0x471e73[_0x6a3e('0x1f')](_0x54ae99);}}_0x3a4181({'count':_0x471e73[_0x6a3e('0x16')],'rows':_0x471e73});});},'OpenchannelQueues':function(_0x9e04b2){return new Promise(function(_0x1c85c3,_0x40613d){var _0x3c7bd0=[];for(var _0x318fd9 in _0x31aefa['openchannelQueues']){if(_0x31aefa[_0x6a3e('0x53')][_0x6a3e('0x47')](_0x318fd9)){var _0x17ed75=_0x31aefa['openchannelQueues'][_0x318fd9];var _0x4420b9={'id':_0x17ed75['id'],'available':_0x17ed75['available'],'loggedIn':_0x17ed75[_0x6a3e('0x4e')],'name':_0x17ed75[_0x6a3e('0x4f')],'paused':_0x17ed75['paused'],'waiting':_0x17ed75[_0x6a3e('0x50')]};_0x3c7bd0[_0x6a3e('0x1f')](_0x4420b9);}}_0x1c85c3({'count':_0x3c7bd0['length'],'rows':_0x3c7bd0});});},'SmsQueues':function(_0x16376b){return new Promise(function(_0x34d9d2,_0x8608e9){var _0x177432=[];for(var _0x12fbb7 in _0x31aefa['smsQueues']){if(_0x31aefa[_0x6a3e('0x54')]['hasOwnProperty'](_0x12fbb7)){var _0xdf19f9=_0x31aefa['smsQueues'][_0x12fbb7];var _0x8b3520={'id':_0xdf19f9['id'],'available':_0xdf19f9[_0x6a3e('0x4d')],'loggedIn':_0xdf19f9[_0x6a3e('0x4e')],'name':_0xdf19f9[_0x6a3e('0x4f')],'paused':_0xdf19f9['paused'],'waiting':_0xdf19f9['waiting']};_0x177432[_0x6a3e('0x1f')](_0x8b3520);}}_0x34d9d2({'count':_0x177432[_0x6a3e('0x16')],'rows':_0x177432});});},'FaxQueues':function(_0x48edbf){return new Promise(function(_0x2704f0,_0x1e11dd){var _0x3e5f88=[];for(var _0x7b8d96 in _0x31aefa[_0x6a3e('0x55')]){if(_0x31aefa['faxQueues']['hasOwnProperty'](_0x7b8d96)){var _0x4429f1=_0x31aefa[_0x6a3e('0x55')][_0x7b8d96];var _0x1ba563={'id':_0x4429f1['id'],'available':_0x4429f1[_0x6a3e('0x4d')],'loggedIn':_0x4429f1[_0x6a3e('0x4e')],'name':_0x4429f1[_0x6a3e('0x4f')],'paused':_0x4429f1['paused'],'waiting':_0x4429f1[_0x6a3e('0x50')]};_0x3e5f88[_0x6a3e('0x1f')](_0x1ba563);}}_0x2704f0({'count':_0x3e5f88[_0x6a3e('0x16')],'rows':_0x3e5f88});});},'WhatsappQueues':function(_0x11c8be){return new Promise(function(_0x228a0a,_0x4393e9){var _0x4916a5=[];for(var _0x4ad723 in _0x31aefa[_0x6a3e('0x56')]){if(_0x31aefa[_0x6a3e('0x56')][_0x6a3e('0x47')](_0x4ad723)){var _0xb3676e=_0x31aefa[_0x6a3e('0x56')][_0x4ad723];var _0x24b3fb={'id':_0xb3676e['id'],'available':_0xb3676e[_0x6a3e('0x4d')],'loggedIn':_0xb3676e[_0x6a3e('0x4e')],'name':_0xb3676e[_0x6a3e('0x4f')],'paused':_0xb3676e['paused'],'waiting':_0xb3676e[_0x6a3e('0x50')]};_0x4916a5[_0x6a3e('0x1f')](_0x24b3fb);}}_0x228a0a({'count':_0x4916a5[_0x6a3e('0x16')],'rows':_0x4916a5});});},'ChatQueuesWaitingInteractions':function(_0x2e8af7){return new Promise(function(_0x35bbfe,_0x281fba){var _0x7e983a=_[_0x6a3e('0x4b')](_0x31aefa['chatQueuesWaitingInteractions']);_0x35bbfe({'count':_0x7e983a[_0x6a3e('0x16')],'rows':_0x7e983a});});},'MailQueuesWaitingInteractions':function(_0x506df6){return new Promise(function(_0x5f4561,_0x1ac45d){var _0x4650c1=_[_0x6a3e('0x4b')](_0x31aefa['mailQueuesWaitingInteractions']);_0x5f4561({'count':_0x4650c1[_0x6a3e('0x16')],'rows':_0x4650c1});});},'OpenchannelQueuesWaitingInteractions':function(_0x292774){return new Promise(function(_0x20fdf4,_0x672d9d){var _0x462e21=_[_0x6a3e('0x4b')](_0x31aefa[_0x6a3e('0x57')]);_0x20fdf4({'count':_0x462e21[_0x6a3e('0x16')],'rows':_0x462e21});});},'SmsQueuesWaitingInteractions':function(_0x358131){return new Promise(function(_0x4a548f,_0x1508cf){var _0x8bd18f=_[_0x6a3e('0x4b')](_0x31aefa[_0x6a3e('0x58')]);_0x4a548f({'count':_0x8bd18f[_0x6a3e('0x16')],'rows':_0x8bd18f});});},'FaxQueuesWaitingInteractions':function(_0x174ddf){return new Promise(function(_0x373e10,_0x1c5255){var _0x30a60a=_[_0x6a3e('0x4b')](_0x31aefa[_0x6a3e('0x59')]);_0x373e10({'count':_0x30a60a['length'],'rows':_0x30a60a});});},'WhatsappQueuesWaitingInteractions':function(_0x5867bb){return new Promise(function(_0x5148de,_0x34048b){var _0x523f00=_['values'](_0x31aefa[_0x6a3e('0x5a')]);_0x5148de({'count':_0x523f00['length'],'rows':_0x523f00});});}};var _0x1029f9=jayson[_0x6a3e('0x5b')](_0x13b172)[_0x6a3e('0x5c')]();_0x1029f9['on'](_0x6a3e('0x39'),function(_0x15478c){logger['error'](JSON[_0x6a3e('0x33')](_0x15478c));return _0x2e911b(_0x15478c);});_0x1029f9['listen'](0x232c,_0x6a3e('0x5d'),function(){console[_0x6a3e('0x5e')](_0x6a3e('0x5f'),0x232c);return _0x4bd05f(_0x6a3e('0x60')+0x232c);});});}; \ No newline at end of file +var _0x98a8=['error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules','message','interaction','applications','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','channel','push','slice','length','dialogflow','amazonlex','tag','TagId','%s:%s:%s','./interval','intervals','consequence','priority','error','Please\x20create\x20a\x20new\x20file\x20under','info','Applications\x20executed','stringify','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','emit','end','QueueReport','catch'];(function(_0x3971ed,_0x177ae0){var _0x21c8b1=function(_0x31e2a3){while(--_0x31e2a3){_0x3971ed['push'](_0x3971ed['shift']());}};_0x21c8b1(++_0x177ae0);}(_0x98a8,0x12c));var _0x898a=function(_0x4e82c2,_0x430d36){_0x4e82c2=_0x4e82c2-0x0;var _0x1f40aa=_0x98a8[_0x4e82c2];return _0x1f40aa;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var fs=require('fs');var jayson=require(_0x898a('0x3'));var BPromise=require(_0x898a('0x4'));var uuid=require(_0x898a('0x5'));var config=require(_0x898a('0x6'));var logger=require('../../../config/logger')(_0x898a('0x7'));var rpc={'openchannelQueueReport':require(_0x898a('0x8')),'mailQueueReport':require(_0x898a('0x9')),'chatQueueReport':require(_0x898a('0xa')),'smsQueueReport':require(_0x898a('0xb')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x898a('0xc'))};var RuleEngine=require('../lib/rule-engine');function getId(_0xfa8c50,_0x4fbce5,_0x42021d){return util[_0x898a('0xd')](_0x898a('0xe'),_0xfa8c50,_0x4fbce5||0x0,_0x42021d||0x0);}function getIntervals(_0x96b636,_0x3150df){var _0x388a47=[];if(!_[_0x898a('0xf')](_0x3150df[_0x898a('0x10')])&&!_[_0x898a('0xf')](_0x96b636[_0x3150df['IntervalId']])&&!_[_0x898a('0xf')](_0x96b636[_0x3150df['IntervalId']][_0x898a('0x11')])){_0x388a47=_['map'](_0x96b636[_0x3150df[_0x898a('0x10')]][_0x898a('0x11')],_0x898a('0x12'));}else if(!_['isNil'](_0x3150df['interval'])){_0x388a47=[_0x3150df['interval']];}return _0x388a47;}exports[_0x898a('0x13')]=function(_0x1f5be4){_0x1f5be4[_0x898a('0x14')]={};return new BPromise(function(_0x116fbe,_0x1873e9){var _0x15177d={'Start':function(_0x506023){var _0x47033c=this;return new Promise(function(_0x53a4b8,_0x3fec7a){if(_0x506023){try{var _0x5c96a6=[];var _0x303321=getId(_0x506023['channel'],_0x506023[_0x898a('0x15')]?_0x506023['message']['id']:0x0,_0x506023[_0x898a('0x16')]?_0x506023[_0x898a('0x16')]['id']:0x0);if(_0x506023[_0x898a('0x17')]&&_['isArray'](_0x506023[_0x898a('0x17')])&&_0x506023['applications']['length']){for(var _0x3f8af4=0x0;_0x3f8af4<_0x506023[_0x898a('0x17')]['length'];_0x3f8af4+=0x1){var _0x4d374b=_0x506023[_0x898a('0x17')][_0x3f8af4];if(fs[_0x898a('0x18')](path[_0x898a('0x19')](__dirname,_0x898a('0x17'),_0x4d374b[_0x898a('0x1a')]+_0x898a('0x1b')))){var _0x259541=[];switch(_0x4d374b['app'][_0x898a('0x1c')]()){case _0x898a('0x1d'):var _0x11cae2=_0x4d374b[_0x898a('0x1e')][_0x898a('0x1f')](',');if(_0x506023[_0x898a('0x20')]==='mail'){_0x259541[_0x898a('0x21')](_0x11cae2[0x0]);_0x259541[_0x898a('0x21')](_0x11cae2[0x1]);_0x259541[_0x898a('0x21')](_0x11cae2[_0x898a('0x22')](0x2,_0x11cae2[_0x898a('0x23')])[_0x898a('0x19')](','));}else{_0x259541['push'](_0x11cae2[0x0]);_0x259541[_0x898a('0x21')](_0x11cae2['slice'](0x1,_0x11cae2['length'])['join'](','));}break;case _0x898a('0x24'):var _0x1f4d86=_0x4d374b[_0x898a('0x1e')][_0x898a('0x1f')](',');_0x259541[_0x898a('0x21')](_0x1f4d86[0x0]);_0x259541[_0x898a('0x21')](_0x1f4d86[0x1]);_0x259541[_0x898a('0x21')](_0x1f4d86[_0x898a('0x22')](0x2,_0x1f4d86[_0x898a('0x23')])['join'](','));break;case'dialogflowv2':var _0x47f1ed=_0x4d374b[_0x898a('0x1e')][_0x898a('0x1f')](',');_0x259541[_0x898a('0x21')](_0x47f1ed[0x0]);_0x259541[_0x898a('0x21')](_0x47f1ed[0x1]);_0x259541[_0x898a('0x21')](_0x47f1ed[0x2]);_0x259541[_0x898a('0x21')](_0x47f1ed[0x3]);_0x259541[_0x898a('0x21')](_0x47f1ed[_0x898a('0x22')](0x4,_0x47f1ed[_0x898a('0x23')])[_0x898a('0x19')](','));break;case _0x898a('0x25'):var _0x194d74=_0x4d374b['appdata'][_0x898a('0x1f')](',');_0x259541[_0x898a('0x21')](_0x194d74[0x0]);_0x259541[_0x898a('0x21')](_0x194d74[0x1]);_0x259541[_0x898a('0x21')](_0x194d74[0x2]);_0x259541[_0x898a('0x21')](_0x194d74[0x3]);_0x259541['push'](_0x194d74['slice'](0x4,_0x194d74[_0x898a('0x23')])[_0x898a('0x19')](','));break;case _0x898a('0x15'):_0x259541['push'](_0x4d374b[_0x898a('0x1e')]);break;case _0x898a('0x26'):_0x259541[_0x898a('0x21')](_0x4d374b[_0x898a('0x27')]);_0x259541[_0x898a('0x21')](_0x4d374b[_0x898a('0x1e')]);break;default:_0x259541=_[_0x898a('0xf')](_0x4d374b[_0x898a('0x1e')])?[]:_0x4d374b['appdata'][_0x898a('0x1f')](',');}var _0x5baf5b={'id':util['format'](_0x898a('0x28'),_0x303321,_0x4d374b['id'],_0x4d374b['app']),'condition':require(_0x898a('0x29'))['condition'](_0x303321,getIntervals(_0x1f5be4[_0x898a('0x2a')],_0x4d374b),_0x1f5be4),'consequence':require('./applications/'+_0x4d374b[_0x898a('0x1a')])[_0x898a('0x2b')](_0x303321,_0x259541,_0x1f5be4,_0x506023),'p':_0x4d374b[_0x898a('0x2c')]||0x0};logger['info']('Push\x20new\x20rule',_0x5baf5b['id'],'on\x20interval',getIntervals(_0x1f5be4[_0x898a('0x2a')],_0x4d374b)[_0x898a('0x19')]('\x20|\x20'));_0x5c96a6[_0x898a('0x21')](_0x5baf5b);}else{logger[_0x898a('0x2d')](_0x898a('0x2e'),path[_0x898a('0x19')](__dirname,'applications',_0x4d374b['app']+_0x898a('0x1b')));}}_0x1f5be4[_0x898a('0x14')][_0x303321]=new RuleEngine(_0x5c96a6);_0x1f5be4['rules'][_0x303321]['execute'](_0x506023,function(_0x168f92){logger[_0x898a('0x2f')](_0x898a('0x30'),JSON[_0x898a('0x31')](_0x168f92['matchPath']));if(_0x1f5be4[_0x898a('0x14')][_0x303321]){_0x1f5be4[_0x898a('0x14')][_0x303321]['emit']('complete');}});return _0x53a4b8({'code':0xc8,'message':_0x506023});}else{logger['info'](_0x898a('0x32'));return _0x53a4b8({'code':0xc8,'message':_0x506023});}}catch(_0x477a9d){logger[_0x898a('0x2d')](_0x477a9d[_0x898a('0x33')]);return _0x3fec7a(_0x47033c[_0x898a('0x2d')](0x1f4,_0x477a9d));}}return _0x3fec7a(_0x898a('0x34'));});},'AcceptMessage':function(_0x10daf6){var _0x1432ec=this;return new Promise(function(_0x3292c2,_0x235fcf){if(_0x10daf6[_0x898a('0x35')]&&_0x10daf6[_0x898a('0x35')]['id']){if(_0x1f5be4[_0x898a('0x36')][_0x10daf6[_0x898a('0x35')]['id']]){_0x1f5be4[_0x898a('0x36')][_0x10daf6['agent']['id']][_0x898a('0x37')]=![];_0x1f5be4[_0x898a('0x36')][_0x10daf6[_0x898a('0x35')]['id']]['busyQueue']=undefined;}}if(_0x10daf6[_0x898a('0x15')]&&_0x10daf6[_0x898a('0x15')]['id']){try{var _0x3a8663=getId(_0x10daf6[_0x898a('0x20')],_0x10daf6[_0x898a('0x15')]?_0x10daf6[_0x898a('0x15')]['id']:0x0,_0x10daf6[_0x898a('0x16')]?_0x10daf6[_0x898a('0x16')]['id']:0x0);if(_0x1f5be4['rules'][_0x3a8663]){_0x1f5be4[_0x898a('0x14')][_0x3a8663][_0x898a('0x38')](_0x898a('0x39'));if(rpc[_0x10daf6[_0x898a('0x20')]+'QueueReport']){rpc[_0x10daf6[_0x898a('0x20')]+_0x898a('0x3a')]['update'](_0x3a8663,{'UserId':_0x10daf6[_0x898a('0x15')]['UserId']})[_0x898a('0x3b')](function(_0x5137c4){logger['error'](_0x898a('0x3c'));});}}return _0x3292c2({'code':0xc8,'message':_0x10daf6});}catch(_0x49e603){logger[_0x898a('0x2d')](_0x49e603[_0x898a('0x33')]);return _0x235fcf(_0x1432ec['error'](0x1f4,_0x49e603));}}logger[_0x898a('0x2d')](_0x898a('0x3d'));return _0x235fcf(_0x1432ec['error'](0x1f4,_0x898a('0x3d')));});},'RejectMessage':function(_0x199437){var _0x11a0a3=this;return new Promise(function(_0x118240,_0x5b7ff8){if(_0x199437[_0x898a('0x35')]&&_0x199437[_0x898a('0x35')]['id']){try{if(_0x1f5be4['agents'][_0x199437[_0x898a('0x35')]['id']]){_0x1f5be4[_0x898a('0x36')][_0x199437['agent']['id']][_0x898a('0x37')]=![];_0x1f5be4['agents'][_0x199437[_0x898a('0x35')]['id']][_0x898a('0x3e')]=undefined;}return _0x118240({'code':0xc8,'message':_0x199437});}catch(_0x32ccb9){logger['error'](_0x32ccb9[_0x898a('0x33')]);return _0x5b7ff8(_0x11a0a3[_0x898a('0x2d')](0x1f4,_0x32ccb9));}}logger[_0x898a('0x2d')](_0x898a('0x3d'));return _0x5b7ff8(_0x11a0a3['error'](0x1f4,_0x898a('0x3d')));});},'AbandonInteraction':function(_0x529d7c){var _0x3db796=this;return new Promise(function(_0x2feb38,_0x3159d0){if(_0x529d7c['channel']&&_0x529d7c[_0x898a('0x16')]&&_0x529d7c[_0x898a('0x16')]['id']){try{var _0x195ac2=getId(_0x529d7c['channel'],_0x529d7c['message']?_0x529d7c[_0x898a('0x15')]['id']:0x0,_0x529d7c[_0x898a('0x16')]?_0x529d7c[_0x898a('0x16')]['id']:0x0);if(_0x1f5be4[_0x898a('0x14')][_0x195ac2]){_0x1f5be4[_0x898a('0x14')][_0x195ac2][_0x898a('0x38')](_0x898a('0x39'));}return _0x2feb38({'code':0xc8,'message':_0x529d7c});}catch(_0x6c0f07){logger[_0x898a('0x2d')](_0x6c0f07[_0x898a('0x33')]);return _0x3159d0(_0x3db796[_0x898a('0x2d')](0x1f4,_0x6c0f07));}}logger['error'](_0x898a('0x3d'));return _0x3159d0(_0x3db796[_0x898a('0x2d')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x36d7aa){var _0x575a6e=this;return new Promise(function(_0x54c44b,_0x15f11e){if(_0x1f5be4[_0x898a('0x36')][_0x898a('0x3f')](_0x36d7aa['id'])){for(var _0x5bfd61 in _0x36d7aa['capacity']){if(_0x36d7aa[_0x898a('0x40')][_0x898a('0x3f')](_0x5bfd61)){if(_0x1f5be4['agents'][_0x36d7aa['id']][_0x898a('0x3f')](_0x5bfd61+_0x898a('0x41'))){_0x1f5be4['agents'][_0x36d7aa['id']][_0x5bfd61+_0x898a('0x41')]=parseInt(_0x36d7aa[_0x898a('0x40')][_0x5bfd61],0xa);}}}_0x1f5be4[_0x898a('0x36')][_0x36d7aa['id']]['updateRealtime']();return _0x54c44b({'code':0xc8,'message':_0x1f5be4[_0x898a('0x36')][_0x36d7aa['id']]});}else{return _0x15f11e(_0x575a6e[_0x898a('0x2d')](0x1f4,_0x898a('0x42')));}});},'Agents':function(_0x25970f){return new Promise(function(_0xd37f94,_0x759101){var _0x4cd6fa=_[_0x898a('0x43')](_0x1f5be4['agents']);_0xd37f94({'count':_0x4cd6fa[_0x898a('0x23')],'rows':_0x4cd6fa});});},'ChatQueues':function(_0x1dc177){return new Promise(function(_0x15b203,_0x43780e){var _0x46f0b8=[];for(var _0xb653f7 in _0x1f5be4[_0x898a('0x44')]){if(_0x1f5be4[_0x898a('0x44')][_0x898a('0x3f')](_0xb653f7)){var _0x4f2406=_0x1f5be4[_0x898a('0x44')][_0xb653f7];var _0x455ceb={'id':_0x4f2406['id'],'available':_0x4f2406[_0x898a('0x45')],'loggedIn':_0x4f2406[_0x898a('0x46')],'name':_0x4f2406[_0x898a('0x47')],'paused':_0x4f2406[_0x898a('0x48')],'waiting':_0x4f2406[_0x898a('0x49')]};_0x46f0b8[_0x898a('0x21')](_0x455ceb);}}_0x15b203({'count':_0x46f0b8[_0x898a('0x23')],'rows':_0x46f0b8});});},'MailQueues':function(_0x3c7c47){return new Promise(function(_0x280b34,_0x217dda){var _0x3331c0=[];for(var _0x3f76e1 in _0x1f5be4[_0x898a('0x4a')]){if(_0x1f5be4['mailQueues'][_0x898a('0x3f')](_0x3f76e1)){var _0x40f926=_0x1f5be4['mailQueues'][_0x3f76e1];var _0x14ea2d={'id':_0x40f926['id'],'available':_0x40f926[_0x898a('0x45')],'loggedIn':_0x40f926['loggedIn'],'name':_0x40f926[_0x898a('0x47')],'paused':_0x40f926[_0x898a('0x48')],'waiting':_0x40f926[_0x898a('0x49')]};_0x3331c0[_0x898a('0x21')](_0x14ea2d);}}_0x280b34({'count':_0x3331c0['length'],'rows':_0x3331c0});});},'OpenchannelQueues':function(_0xdc0cc4){return new Promise(function(_0x11def5,_0x137935){var _0xf86633=[];for(var _0x5b4e60 in _0x1f5be4[_0x898a('0x4b')]){if(_0x1f5be4[_0x898a('0x4b')]['hasOwnProperty'](_0x5b4e60)){var _0x21fdb2=_0x1f5be4[_0x898a('0x4b')][_0x5b4e60];var _0x5b7019={'id':_0x21fdb2['id'],'available':_0x21fdb2[_0x898a('0x45')],'loggedIn':_0x21fdb2['loggedIn'],'name':_0x21fdb2[_0x898a('0x47')],'paused':_0x21fdb2['paused'],'waiting':_0x21fdb2['waiting']};_0xf86633['push'](_0x5b7019);}}_0x11def5({'count':_0xf86633[_0x898a('0x23')],'rows':_0xf86633});});},'SmsQueues':function(_0x473f5c){return new Promise(function(_0x3909c5,_0x37c6f6){var _0x5e0535=[];for(var _0x5f2382 in _0x1f5be4[_0x898a('0x4c')]){if(_0x1f5be4[_0x898a('0x4c')][_0x898a('0x3f')](_0x5f2382)){var _0x5dc44e=_0x1f5be4[_0x898a('0x4c')][_0x5f2382];var _0x41cf94={'id':_0x5dc44e['id'],'available':_0x5dc44e[_0x898a('0x45')],'loggedIn':_0x5dc44e[_0x898a('0x46')],'name':_0x5dc44e['name'],'paused':_0x5dc44e[_0x898a('0x48')],'waiting':_0x5dc44e[_0x898a('0x49')]};_0x5e0535['push'](_0x41cf94);}}_0x3909c5({'count':_0x5e0535[_0x898a('0x23')],'rows':_0x5e0535});});},'FaxQueues':function(_0x316160){return new Promise(function(_0x253c15,_0x2e514f){var _0xd380ef=[];for(var _0x286345 in _0x1f5be4[_0x898a('0x4d')]){if(_0x1f5be4[_0x898a('0x4d')][_0x898a('0x3f')](_0x286345)){var _0x3e3c63=_0x1f5be4[_0x898a('0x4d')][_0x286345];var _0x307849={'id':_0x3e3c63['id'],'available':_0x3e3c63[_0x898a('0x45')],'loggedIn':_0x3e3c63['loggedIn'],'name':_0x3e3c63[_0x898a('0x47')],'paused':_0x3e3c63['paused'],'waiting':_0x3e3c63[_0x898a('0x49')]};_0xd380ef[_0x898a('0x21')](_0x307849);}}_0x253c15({'count':_0xd380ef[_0x898a('0x23')],'rows':_0xd380ef});});},'WhatsappQueues':function(_0x5d3b21){return new Promise(function(_0x31102d,_0x3f0d9f){var _0x362360=[];for(var _0x269ba8 in _0x1f5be4[_0x898a('0x4e')]){if(_0x1f5be4['whatsappQueues'][_0x898a('0x3f')](_0x269ba8)){var _0x352ebb=_0x1f5be4[_0x898a('0x4e')][_0x269ba8];var _0x3f3aa0={'id':_0x352ebb['id'],'available':_0x352ebb[_0x898a('0x45')],'loggedIn':_0x352ebb['loggedIn'],'name':_0x352ebb[_0x898a('0x47')],'paused':_0x352ebb[_0x898a('0x48')],'waiting':_0x352ebb[_0x898a('0x49')]};_0x362360[_0x898a('0x21')](_0x3f3aa0);}}_0x31102d({'count':_0x362360[_0x898a('0x23')],'rows':_0x362360});});},'ChatQueuesWaitingInteractions':function(_0x420347){return new Promise(function(_0x1fd617,_0x1b0c09){var _0x51836c=_[_0x898a('0x43')](_0x1f5be4[_0x898a('0x4f')]);_0x1fd617({'count':_0x51836c['length'],'rows':_0x51836c});});},'MailQueuesWaitingInteractions':function(_0x4585ec){return new Promise(function(_0x5b3003,_0xb1c576){var _0x4b2575=_[_0x898a('0x43')](_0x1f5be4[_0x898a('0x50')]);_0x5b3003({'count':_0x4b2575[_0x898a('0x23')],'rows':_0x4b2575});});},'OpenchannelQueuesWaitingInteractions':function(_0x62b49e){return new Promise(function(_0x109064,_0x2c7e30){var _0x170267=_[_0x898a('0x43')](_0x1f5be4[_0x898a('0x51')]);_0x109064({'count':_0x170267['length'],'rows':_0x170267});});},'SmsQueuesWaitingInteractions':function(_0x3fe54b){return new Promise(function(_0xd627d0,_0x1fe4cc){var _0x3f58e7=_[_0x898a('0x43')](_0x1f5be4[_0x898a('0x52')]);_0xd627d0({'count':_0x3f58e7[_0x898a('0x23')],'rows':_0x3f58e7});});},'FaxQueuesWaitingInteractions':function(_0x4bcf85){return new Promise(function(_0x380f8c,_0x1c8473){var _0x49cba8=_['values'](_0x1f5be4[_0x898a('0x53')]);_0x380f8c({'count':_0x49cba8[_0x898a('0x23')],'rows':_0x49cba8});});},'WhatsappQueuesWaitingInteractions':function(_0x48e9c2){return new Promise(function(_0x5710a0,_0x34e1f2){var _0x4a79a4=_[_0x898a('0x43')](_0x1f5be4[_0x898a('0x54')]);_0x5710a0({'count':_0x4a79a4['length'],'rows':_0x4a79a4});});}};var _0x3f6815=jayson[_0x898a('0x55')](_0x15177d)[_0x898a('0x56')]();_0x3f6815['on'](_0x898a('0x2d'),function(_0x33e3fa){logger[_0x898a('0x2d')](JSON[_0x898a('0x31')](_0x33e3fa));return _0x1873e9(_0x33e3fa);});_0x3f6815['listen'](0x232c,_0x898a('0x57'),function(){console[_0x898a('0x58')](_0x898a('0x59'),0x232c);return _0x116fbe('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 8b3e68b..229b757 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 _0x8c6d=['rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','indexOf','true','catch','error','all','some','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','http','request','then','message'];(function(_0x281ec2,_0x2836de){var _0x24dbf7=function(_0x5ae6bc){while(--_0x5ae6bc){_0x281ec2['push'](_0x281ec2['shift']());}};_0x24dbf7(++_0x2836de);}(_0x8c6d,0x16a));var _0xd8c6=function(_0x1bfbaf,_0x3ceecb){_0x1bfbaf=_0x1bfbaf-0x0;var _0x536f9c=_0x8c6d[_0x1bfbaf];return _0x536f9c;};'use strict';var util=require(_0xd8c6('0x0'));var BPromise=require(_0xd8c6('0x1'));var jayson=require(_0xd8c6('0x2'));var _=require(_0xd8c6('0x3'));var logger=require(_0xd8c6('0x4'))(_0xd8c6('0x5'));var client=jayson['client'][_0xd8c6('0x6')]({'port':0x232a});function request(_0x44ea46,_0x5506e9){return new BPromise(function(_0x13f0f8,_0x27b4ac){return client[_0xd8c6('0x7')](_0x44ea46,_0x5506e9)[_0xd8c6('0x8')](function(_0x45c15b){if(_0x45c15b['error']){return _0x27b4ac(_0x45c15b['error'][_0xd8c6('0x9')]);}else{return _0x13f0f8(_0x45c15b['result']);}})['catch'](function(_0x34e0d4){return _0x27b4ac(_0x34e0d4);});});}exports['condition']=function(_0x1b9e79,_0x29cdfb,_0x61f576){return function(_0x2e2dac){if(_0x61f576['rules']&&!_0x61f576[_0xd8c6('0xa')][_0x1b9e79]){logger[_0xd8c6('0xb')](_0xd8c6('0xc'),_0x1b9e79);return _0x2e2dac[_0xd8c6('0xd')]();}var _0x45a61f=[];for(var _0x1f8035=0x0;_0x1f8035<_0x29cdfb[_0xd8c6('0xe')];_0x1f8035+=0x1){_0x45a61f[_0xd8c6('0xf')](request(_0xd8c6('0x10'),{'command':util[_0xd8c6('0x11')](_0xd8c6('0x12'),_0x29cdfb[_0x1f8035])})[_0xd8c6('0x8')](function(_0x2b2b54){return _0x2b2b54&&_0x2b2b54[_0xd8c6('0x9')]&&_0x2b2b54[_0xd8c6('0x9')][_0xd8c6('0x13')](_0xd8c6('0x14'))>=0x0?!![]:![];})[_0xd8c6('0x15')](function(_0x54c0ae){logger[_0xd8c6('0x16')]('[%s][INTERVAL]\x20%s',_0x1b9e79,_0x29cdfb[_0x1f8035]);}));}BPromise[_0xd8c6('0x17')](_0x45a61f)[_0xd8c6('0x8')](function(_0x4ad9e7){var _0x114c1d=_[_0xd8c6('0x18')](_0x4ad9e7);logger[_0xd8c6('0xb')](_0xd8c6('0x19'),_0x1b9e79,_0x29cdfb[_0xd8c6('0x1a')]('\x20|\x20'),_0x114c1d);_0x2e2dac[_0xd8c6('0x1b')](_0x114c1d);})[_0xd8c6('0x15')](function(_0xfd7aec){console[_0xd8c6('0x1c')](_0xfd7aec);logger[_0xd8c6('0x16')]('[%s][INTERVAL]\x20%s\x20%s',_0x1b9e79,_0x29cdfb[_0xd8c6('0x1a')](_0xd8c6('0x1d')),_0xfd7aec[_0xd8c6('0x1e')]);_0x2e2dac[_0xd8c6('0xd')]();});};}; \ No newline at end of file +var _0x6dba=['jayson/promise','lodash','../../../config/logger','client','http','request','then','error','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','iftime\x20%s','message','indexOf','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stack','util','bluebird'];(function(_0x8979be,_0x579329){var _0x15cd7a=function(_0x320b41){while(--_0x320b41){_0x8979be['push'](_0x8979be['shift']());}};_0x15cd7a(++_0x579329);}(_0x6dba,0x1de));var _0xa6db=function(_0x51c39f,_0x5bfb0b){_0x51c39f=_0x51c39f-0x0;var _0x274221=_0x6dba[_0x51c39f];return _0x274221;};'use strict';var util=require(_0xa6db('0x0'));var BPromise=require(_0xa6db('0x1'));var jayson=require(_0xa6db('0x2'));var _=require(_0xa6db('0x3'));var logger=require(_0xa6db('0x4'))('routing');var client=jayson[_0xa6db('0x5')][_0xa6db('0x6')]({'port':0x232a});function request(_0x378de7,_0x27410c){return new BPromise(function(_0x499d38,_0x2c4663){return client[_0xa6db('0x7')](_0x378de7,_0x27410c)[_0xa6db('0x8')](function(_0x6768bf){if(_0x6768bf[_0xa6db('0x9')]){return _0x2c4663(_0x6768bf[_0xa6db('0x9')]['message']);}else{return _0x499d38(_0x6768bf['result']);}})[_0xa6db('0xa')](function(_0x18abcb){return _0x2c4663(_0x18abcb);});});}exports[_0xa6db('0xb')]=function(_0x4d1ec8,_0x2c4997,_0x3d53f6){return function(_0x5b73ed){if(_0x3d53f6[_0xa6db('0xc')]&&!_0x3d53f6['rules'][_0x4d1ec8]){logger[_0xa6db('0xd')](_0xa6db('0xe'),_0x4d1ec8);return _0x5b73ed[_0xa6db('0xf')]();}var _0x1728f9=[];for(var _0x923726=0x0;_0x923726<_0x2c4997[_0xa6db('0x10')];_0x923726+=0x1){_0x1728f9[_0xa6db('0x11')](request('Command',{'command':util['format'](_0xa6db('0x12'),_0x2c4997[_0x923726])})['then'](function(_0x543fe6){return _0x543fe6&&_0x543fe6['message']&&_0x543fe6[_0xa6db('0x13')][_0xa6db('0x14')]('true')>=0x0?!![]:![];})['catch'](function(_0x3c483f){logger['error'](_0xa6db('0x15'),_0x4d1ec8,_0x2c4997[_0x923726]);}));}BPromise[_0xa6db('0x16')](_0x1728f9)['then'](function(_0xb46814){var _0x136153=_[_0xa6db('0x17')](_0xb46814);logger[_0xa6db('0xd')](_0xa6db('0x18'),_0x4d1ec8,_0x2c4997[_0xa6db('0x19')]('\x20|\x20'),_0x136153);_0x5b73ed[_0xa6db('0x1a')](_0x136153);})['catch'](function(_0x5a8660){console[_0xa6db('0x1b')](_0x5a8660);logger['error'](_0xa6db('0x18'),_0x4d1ec8,_0x2c4997[_0xa6db('0x19')](_0xa6db('0x1c')),_0x5a8660[_0xa6db('0x1d')]);_0x5b73ed[_0xa6db('0xf')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index c6f7439..a9a6112 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 _0xbfc0=['origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transfer','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','lodash','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','called','connectedlinename','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','now','timeout','reason','holdtime','talktime','push','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinenum','ringtime','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xbfc0,0x68));var _0x0bfc=function(_0x1b2422,_0x1e98d4){_0x1b2422=_0x1b2422-0x0;var _0x376573=_0xbfc0[_0x1b2422];return _0x376573;};'use strict';var _=require(_0x0bfc('0x0'));var util=require('util');var utils=require(_0x0bfc('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1768d6,_0x32a30f){utils[_0x0bfc('0x2')](util[_0x0bfc('0x3')](_0x0bfc('0x4'),_0x1768d6[_0x0bfc('0x5')],_0x1768d6[_0x0bfc('0x6')],_0x1768d6[_0x0bfc('0x7')],_0x1768d6[_0x0bfc('0x8')],_0x1768d6[_0x0bfc('0x9')],_0x1768d6[_0x0bfc('0xa')],_0x1768d6['connectedlinenum'],_0x1768d6[_0x0bfc('0xb')]));if(_0x1768d6['queue']){utils[_0x0bfc('0xc')](_0x1768d6[_0x0bfc('0x7')])[_0x0bfc('0xd')](function(_0x56229f){if(_0x56229f){_0x1768d6[_0x0bfc('0xe')]=_0x56229f[_0x0bfc('0xe')];_0x1768d6[_0x0bfc('0xf')]=_0x1768d6[_0x0bfc('0x10')]?_0x56229f['acw']:![];_0x1768d6[_0x0bfc('0x11')]=_0x1768d6[_0x0bfc('0xf')]?_0x56229f[_0x0bfc('0x12')]:0x0;}utils[_0x0bfc('0x13')](_0x0bfc('0x14'),_0x1768d6);});}else{utils[_0x0bfc('0x13')](_0x0bfc('0x14'),_0x1768d6);}if(_0x32a30f){delete transfers[_0x1768d6[_0x0bfc('0x5')]];}else{delete agents[_0x1768d6[_0x0bfc('0x15')]];}}exports[_0x0bfc('0x16')]=function(_0x379b65){try{utils[_0x0bfc('0x17')](util['format'](_0x0bfc('0x18'),_0x379b65[_0x0bfc('0x5')]),_0x379b65);agents[_0x379b65[_0x0bfc('0x15')]]=_0x379b65;agents[_0x379b65['destuniqueid']][_0x0bfc('0x19')]=utils['now']();agents[_0x379b65[_0x0bfc('0x15')]]['lastevent']=_0x0bfc('0x1a');agents[_0x379b65[_0x0bfc('0x15')]]['connectedlinenum']=null;agents[_0x379b65[_0x0bfc('0x15')]][_0x0bfc('0x1b')]=null;utils[_0x0bfc('0x2')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x379b65[_0x0bfc('0x5')],agents[_0x379b65[_0x0bfc('0x15')]][_0x0bfc('0x8')],_0x379b65['destuniqueid']));}catch(_0x59949b){utils[_0x0bfc('0x1c')](util[_0x0bfc('0x3')](_0x0bfc('0x18'),_0x379b65['uniqueid']),_0x59949b);}};exports[_0x0bfc('0x1d')]=function(_0x3173b5){try{if(!_[_0x0bfc('0x1e')](agents[_0x3173b5['destuniqueid']])){utils[_0x0bfc('0x17')](util['format'](_0x0bfc('0x1f'),_0x3173b5[_0x0bfc('0x5')]),_0x3173b5);utils[_0x0bfc('0x2')](util[_0x0bfc('0x3')](_0x0bfc('0x20'),_0x3173b5[_0x0bfc('0x5')],agents[_0x3173b5[_0x0bfc('0x15')]][_0x0bfc('0x8')],_0x3173b5['destuniqueid']));agents[_0x3173b5['destuniqueid']][_0x0bfc('0x1d')]=!![];agents[_0x3173b5['destuniqueid']]['agentringnoanswerAt']=utils[_0x0bfc('0x21')]();agents[_0x3173b5[_0x0bfc('0x15')]][_0x0bfc('0xb')]=_0x0bfc('0x22');agents[_0x3173b5['destuniqueid']][_0x0bfc('0x23')]=_0x0bfc('0x22');agents[_0x3173b5[_0x0bfc('0x15')]][_0x0bfc('0x24')]=_0x3173b5['ringtime']?parseInt(_0x3173b5['ringtime'])/0x3e8:0x0;agents[_0x3173b5[_0x0bfc('0x15')]][_0x0bfc('0x25')]=0x0;unanswered[_0x0bfc('0x26')](_0x3173b5[_0x0bfc('0x15')]);}}catch(_0x431d42){utils['error'](util[_0x0bfc('0x3')](_0x0bfc('0x1f'),_0x3173b5['uniqueid']),_0x431d42);}};exports['queuecallerabandon']=function(_0x571770){try{_[_0x0bfc('0x27')](agents,function(_0x3969b6,_0x40e68d){if(_0x3969b6[_0x0bfc('0x5')]==_0x571770[_0x0bfc('0x5')]&&!_[_0x0bfc('0x28')](unanswered,_0x3969b6['destuniqueid'])){utils['debug'](util[_0x0bfc('0x3')](_0x0bfc('0x29'),_0x571770['uniqueid']),_0x571770);utils[_0x0bfc('0x2')](util[_0x0bfc('0x3')](_0x0bfc('0x2a'),_0x571770[_0x0bfc('0x5')],_0x3969b6[_0x0bfc('0x8')],_0x3969b6[_0x0bfc('0x15')]));_0x3969b6[_0x0bfc('0x1d')]=!![];_0x3969b6['agentringnoanswerAt']=utils[_0x0bfc('0x21')]();_0x3969b6[_0x0bfc('0xb')]=_0x0bfc('0x2b');_0x3969b6['reason']=_0x0bfc('0x2b');_0x3969b6['holdtime']=_0x571770[_0x0bfc('0x24')];_0x3969b6[_0x0bfc('0x25')]=0x0;writeDB(_0x3969b6);}});}catch(_0x5f55be){utils['error'](util['format'](_0x0bfc('0x29'),_0x571770[_0x0bfc('0x5')]),_0x5f55be);}};exports[_0x0bfc('0x2c')]=function(_0x890d41){try{if(agents[_0x890d41['destuniqueid']]){utils[_0x0bfc('0x17')](util[_0x0bfc('0x3')](_0x0bfc('0x2d'),_0x890d41[_0x0bfc('0x5')]),_0x890d41);utils[_0x0bfc('0x2')](util[_0x0bfc('0x3')](_0x0bfc('0x2e'),_0x890d41['uniqueid'],agents[_0x890d41['destuniqueid']][_0x0bfc('0x8')],_0x890d41['destuniqueid']));agents[_0x890d41[_0x0bfc('0x15')]][_0x0bfc('0x2f')]=utils[_0x0bfc('0x21')]();agents[_0x890d41[_0x0bfc('0x15')]]['connectedlinenum']=_0x890d41[_0x0bfc('0x30')];agents[_0x890d41[_0x0bfc('0x15')]]['connectedlinename']=_0x890d41[_0x0bfc('0x1b')];agents[_0x890d41['destuniqueid']][_0x0bfc('0x24')]=_0x890d41[_0x0bfc('0x31')];agents[_0x890d41[_0x0bfc('0x15')]][_0x0bfc('0xb')]='connect';_[_0x0bfc('0x27')](agents,function(_0x11d4c7,_0xe557ae){if(_0x11d4c7[_0x0bfc('0x15')]!=_0x890d41[_0x0bfc('0x15')]&&_0x11d4c7['uniqueid']==_0x890d41[_0x0bfc('0x5')]){_0x11d4c7[_0x0bfc('0x25')]=0x0;_0x11d4c7['holdtime']=_0x890d41[_0x0bfc('0x31')];_0x11d4c7['agentringnoanswer']=!![];_0x11d4c7['agentringnoanswerAt']=utils['now']();_0x11d4c7[_0x0bfc('0xb')]=_0x0bfc('0x32');_0x11d4c7[_0x0bfc('0x23')]=_0x0bfc('0x32');_0x11d4c7['answeredelsewheredestinationuniqueid']=_0x890d41[_0x0bfc('0x15')];_0x11d4c7[_0x0bfc('0x33')]=_0x890d41[_0x0bfc('0x8')];writeDB(_0x11d4c7);}});}}catch(_0x5e8dbd){utils[_0x0bfc('0x1c')](util[_0x0bfc('0x3')]('[%s][agents][agentconnect]',_0x890d41[_0x0bfc('0x5')]),_0x5e8dbd);}};exports[_0x0bfc('0x10')]=function(_0x160c33){try{if(!_[_0x0bfc('0x1e')](agents[_0x160c33[_0x0bfc('0x15')]])){utils[_0x0bfc('0x17')](util[_0x0bfc('0x3')]('[%s][agents][agentcomplete]',_0x160c33[_0x0bfc('0x5')]),_0x160c33);utils[_0x0bfc('0x2')](util['format'](_0x0bfc('0x34'),_0x160c33['uniqueid'],agents[_0x160c33[_0x0bfc('0x15')]][_0x0bfc('0x8')],_0x160c33['destuniqueid']));agents[_0x160c33['destuniqueid']][_0x0bfc('0x10')]=!![];agents[_0x160c33['destuniqueid']]['agentcompleteAt']=utils[_0x0bfc('0x21')]();agents[_0x160c33[_0x0bfc('0x15')]][_0x0bfc('0x25')]=utils[_0x0bfc('0x35')](agents[_0x160c33[_0x0bfc('0x15')]][_0x0bfc('0x36')],agents[_0x160c33[_0x0bfc('0x15')]][_0x0bfc('0x2f')]);agents[_0x160c33['destuniqueid']][_0x0bfc('0x23')]=_0x160c33['reason'];agents[_0x160c33[_0x0bfc('0x15')]][_0x0bfc('0xb')]=_0x0bfc('0x37');writeDB(agents[_0x160c33[_0x0bfc('0x15')]]);}}catch(_0x87b127){utils[_0x0bfc('0x1c')](util['format'](_0x0bfc('0x38'),_0x160c33[_0x0bfc('0x5')]),_0x87b127);}};exports[_0x0bfc('0x39')]=function(_0x339396){try{if(!_[_0x0bfc('0x1e')](agents[_0x339396[_0x0bfc('0x3a')]])){utils['debug'](util['format'](_0x0bfc('0x3b'),_0x339396[_0x0bfc('0x5')]),_0x339396);utils[_0x0bfc('0x2')](util[_0x0bfc('0x3')](_0x0bfc('0x3c'),_0x339396[_0x0bfc('0x5')],agents[_0x339396[_0x0bfc('0x3a')]][_0x0bfc('0x8')],agents[_0x339396['transfereruniqueid']]['uniqueid']));agents[_0x339396[_0x0bfc('0x3a')]]['transfer']=!![];agents[_0x339396[_0x0bfc('0x3a')]][_0x0bfc('0x3d')]=_0x0bfc('0x3e');agents[_0x339396[_0x0bfc('0x3a')]][_0x0bfc('0x3f')]=_0x339396[_0x0bfc('0x40')];agents[_0x339396[_0x0bfc('0x3a')]][_0x0bfc('0x41')]=agents[_0x339396[_0x0bfc('0x3a')]][_0x0bfc('0x5')];}}catch(_0x15f882){utils[_0x0bfc('0x1c')](util[_0x0bfc('0x3')]('[%s][agents][blindtransfer]',_0x339396[_0x0bfc('0x5')]),_0x15f882);}};exports[_0x0bfc('0x42')]=function(_0x40c6ad){try{utils[_0x0bfc('0x17')](util[_0x0bfc('0x3')](_0x0bfc('0x43'),_0x40c6ad[_0x0bfc('0x44')]),_0x40c6ad);if(_0x40c6ad['origtransfereruniqueid']==_0x40c6ad[_0x0bfc('0x45')]){if(!_[_0x0bfc('0x1e')](agents[_0x40c6ad['secondtransfereruniqueid']])){utils[_0x0bfc('0x2')](util['format'](_0x0bfc('0x46'),_0x40c6ad[_0x0bfc('0x44')],agents[_0x40c6ad[_0x0bfc('0x47')]][_0x0bfc('0x8')]));agents[_0x40c6ad[_0x0bfc('0x47')]][_0x0bfc('0x48')]=!![];agents[_0x40c6ad[_0x0bfc('0x47')]][_0x0bfc('0x3d')]='ATTENDED';agents[_0x40c6ad['secondtransfereruniqueid']][_0x0bfc('0x3f')]=_0x40c6ad[_0x0bfc('0x49')];agents[_0x40c6ad[_0x0bfc('0x47')]][_0x0bfc('0x41')]=_0x40c6ad['origtransfereruniqueid'];}if(_0x40c6ad[_0x0bfc('0x4a')]&&agents[_0x40c6ad[_0x0bfc('0x4a')]]){agents[_0x40c6ad[_0x0bfc('0x4a')]][_0x0bfc('0x4b')]=0x1;transfers[_0x40c6ad['transfereeuniqueid']]=_[_0x0bfc('0x4c')](agents[_0x40c6ad[_0x0bfc('0x4a')]]);transfers[_0x40c6ad['transfereeuniqueid']]['calleridnum']=agents[_0x40c6ad[_0x0bfc('0x47')]]['calleridnum'];transfers[_0x40c6ad[_0x0bfc('0x4a')]][_0x0bfc('0x4d')]=agents[_0x40c6ad[_0x0bfc('0x47')]][_0x0bfc('0x4d')];transfers[_0x40c6ad['transfereeuniqueid']]['agentcalledAt']=utils[_0x0bfc('0x21')]();transfers[_0x40c6ad[_0x0bfc('0x4a')]][_0x0bfc('0x2f')]=utils[_0x0bfc('0x21')]();transfers[_0x40c6ad[_0x0bfc('0x4a')]][_0x0bfc('0x24')]=0x0;transfers[_0x40c6ad[_0x0bfc('0x4a')]]['agententerreason']=0x2;}}else if(_0x40c6ad[_0x0bfc('0x47')]==_0x40c6ad['secondtransfererlinkedid']){if(!_[_0x0bfc('0x1e')](agents[_0x40c6ad['origtransfereruniqueid']])){utils[_0x0bfc('0x2')](util['format'](_0x0bfc('0x46'),_0x40c6ad[_0x0bfc('0x44')],agents[_0x40c6ad[_0x0bfc('0x44')]][_0x0bfc('0x8')]));agents[_0x40c6ad['origtransfereruniqueid']][_0x0bfc('0x48')]=!![];agents[_0x40c6ad[_0x0bfc('0x44')]][_0x0bfc('0x3d')]='ATTENDED';agents[_0x40c6ad[_0x0bfc('0x44')]][_0x0bfc('0x3f')]=_0x40c6ad[_0x0bfc('0x4e')];agents[_0x40c6ad[_0x0bfc('0x44')]][_0x0bfc('0x41')]=_0x40c6ad[_0x0bfc('0x47')];}if(_0x40c6ad[_0x0bfc('0x4f')]&&agents[_0x40c6ad[_0x0bfc('0x4f')]]){agents[_0x40c6ad[_0x0bfc('0x4f')]]['agententerreason']=0x1;transfers[_0x40c6ad['transfertargetuniqueid']]=_[_0x0bfc('0x4c')](agents[_0x40c6ad[_0x0bfc('0x4f')]]);transfers[_0x40c6ad['transfertargetuniqueid']][_0x0bfc('0xa')]=agents[_0x40c6ad[_0x0bfc('0x44')]][_0x0bfc('0xa')];transfers[_0x40c6ad[_0x0bfc('0x4f')]]['calleridname']=agents[_0x40c6ad[_0x0bfc('0x44')]][_0x0bfc('0x4d')];transfers[_0x40c6ad['transfertargetuniqueid']][_0x0bfc('0x19')]=utils[_0x0bfc('0x21')]();transfers[_0x40c6ad[_0x0bfc('0x4f')]][_0x0bfc('0x2f')]=utils[_0x0bfc('0x21')]();transfers[_0x40c6ad['transfertargetuniqueid']][_0x0bfc('0x24')]=0x0;transfers[_0x40c6ad['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0x5632ee){utils[_0x0bfc('0x1c')](util[_0x0bfc('0x3')](_0x0bfc('0x43'),_0x40c6ad[_0x0bfc('0x44')]),_0x5632ee);}};exports[_0x0bfc('0x50')]=function(_0x397086){try{utils['debug'](util[_0x0bfc('0x3')](_0x0bfc('0x51'),_0x397086[_0x0bfc('0x5')]),_0x397086);if(agents[_0x397086[_0x0bfc('0x5')]]&&agents[_0x397086['uniqueid']][_0x0bfc('0x23')]===_0x0bfc('0x22')){if(_0x397086[_0x0bfc('0x52')]==='21'){agents[_0x397086[_0x0bfc('0x5')]][_0x0bfc('0x23')]=_0x0bfc('0x53');agents[_0x397086[_0x0bfc('0x5')]][_0x0bfc('0xb')]=_0x0bfc('0x53');}utils[_0x0bfc('0x2')](util[_0x0bfc('0x3')](_0x0bfc('0x54'),_0x397086['uniqueid'],agents[_0x397086[_0x0bfc('0x5')]][_0x0bfc('0x8')],agents[_0x397086['uniqueid']]['reason'],agents[_0x397086[_0x0bfc('0x5')]]['lastevent']));writeDB(agents[_0x397086[_0x0bfc('0x5')]]);var _0x404f38=unanswered['indexOf'](_0x397086[_0x0bfc('0x5')]);if(_0x404f38>-0x1){unanswered['splice'](_0x404f38,0x1);}}if(transfers[_0x397086['uniqueid']]){transfers[_0x397086[_0x0bfc('0x5')]][_0x0bfc('0x10')]=!![];transfers[_0x397086[_0x0bfc('0x5')]][_0x0bfc('0x36')]=utils[_0x0bfc('0x21')]();transfers[_0x397086['uniqueid']][_0x0bfc('0x25')]=utils['diffTime'](transfers[_0x397086['uniqueid']][_0x0bfc('0x36')],transfers[_0x397086['uniqueid']][_0x0bfc('0x2f')]);transfers[_0x397086[_0x0bfc('0x5')]][_0x0bfc('0x23')]=_0x0bfc('0x55');transfers[_0x397086[_0x0bfc('0x5')]][_0x0bfc('0xb')]=_0x0bfc('0x37');utils[_0x0bfc('0x2')](util[_0x0bfc('0x3')](_0x0bfc('0x54'),_0x397086[_0x0bfc('0x5')],transfers[_0x397086[_0x0bfc('0x5')]][_0x0bfc('0x8')],transfers[_0x397086[_0x0bfc('0x5')]][_0x0bfc('0x23')],transfers[_0x397086[_0x0bfc('0x5')]]['lastevent']));writeDB(transfers[_0x397086[_0x0bfc('0x5')]],!![]);}if(agents[_0x397086['uniqueid']]&&agents[_0x397086[_0x0bfc('0x5')]][_0x0bfc('0x2f')]){agents[_0x397086[_0x0bfc('0x5')]][_0x0bfc('0x10')]=!![];agents[_0x397086[_0x0bfc('0x5')]][_0x0bfc('0x36')]=utils[_0x0bfc('0x21')]();agents[_0x397086[_0x0bfc('0x5')]]['talktime']=utils[_0x0bfc('0x35')](agents[_0x397086['uniqueid']]['agentcompleteAt'],agents[_0x397086[_0x0bfc('0x5')]][_0x0bfc('0x2f')]);agents[_0x397086['uniqueid']][_0x0bfc('0x23')]=agents[_0x397086[_0x0bfc('0x5')]][_0x0bfc('0x48')]?'transfer':_0x0bfc('0x55');agents[_0x397086[_0x0bfc('0x5')]][_0x0bfc('0xb')]=_0x0bfc('0x37');utils['info'](util['format'](_0x0bfc('0x54'),_0x397086[_0x0bfc('0x5')],agents[_0x397086[_0x0bfc('0x5')]][_0x0bfc('0x8')],agents[_0x397086[_0x0bfc('0x5')]]['reason'],agents[_0x397086['uniqueid']]['lastevent']));writeDB(agents[_0x397086[_0x0bfc('0x5')]]);}}catch(_0x4b9a27){utils['error'](util[_0x0bfc('0x3')](_0x0bfc('0x51'),_0x397086['uniqueid']),_0x4b9a27);}}; \ No newline at end of file +var _0x9fcd=['transfertargetuniqueid','calleridname','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','lodash','util','./utils','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','then','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','format','agentcalledAt','now','lastevent','called','connectedlinenum','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','holdtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','agentringnoanswerAt','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','agentconnectAt','complete','blindtransfer','isNil','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','transferuniqueid'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9fcd,0x1cb));var _0xd9fc=function(_0x5f3a7d,_0x3b998c){_0x5f3a7d=_0x5f3a7d-0x0;var _0x48cc4c=_0x9fcd[_0x5f3a7d];return _0x48cc4c;};'use strict';var _=require(_0xd9fc('0x0'));var util=require(_0xd9fc('0x1'));var utils=require(_0xd9fc('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x469ee8,_0x44d4ad){utils['info'](util['format'](_0xd9fc('0x3'),_0x469ee8['uniqueid'],_0x469ee8[_0xd9fc('0x4')],_0x469ee8[_0xd9fc('0x5')],_0x469ee8[_0xd9fc('0x6')],_0x469ee8[_0xd9fc('0x7')],_0x469ee8[_0xd9fc('0x8')],_0x469ee8['connectedlinenum'],_0x469ee8['lastevent']));if(_0x469ee8[_0xd9fc('0x5')]){utils['getVoiceQueueByName'](_0x469ee8[_0xd9fc('0x5')])[_0xd9fc('0x9')](function(_0x5279a7){if(_0x5279a7){_0x469ee8[_0xd9fc('0xa')]=_0x5279a7[_0xd9fc('0xa')];_0x469ee8[_0xd9fc('0xb')]=_0x469ee8[_0xd9fc('0xc')]?_0x5279a7[_0xd9fc('0xd')]:![];_0x469ee8[_0xd9fc('0xe')]=_0x469ee8[_0xd9fc('0xb')]?_0x5279a7['acwTimeout']:0x0;}utils[_0xd9fc('0xf')](_0xd9fc('0x10'),_0x469ee8);});}else{utils['request']('CreateVoiceAgentReport',_0x469ee8);}if(_0x44d4ad){delete transfers[_0x469ee8[_0xd9fc('0x11')]];}else{delete agents[_0x469ee8[_0xd9fc('0x12')]];}}exports[_0xd9fc('0x13')]=function(_0x22b635){try{utils['debug'](util[_0xd9fc('0x14')]('[%s][agents][agentcalled]',_0x22b635['uniqueid']),_0x22b635);agents[_0x22b635[_0xd9fc('0x12')]]=_0x22b635;agents[_0x22b635[_0xd9fc('0x12')]][_0xd9fc('0x15')]=utils[_0xd9fc('0x16')]();agents[_0x22b635[_0xd9fc('0x12')]][_0xd9fc('0x17')]=_0xd9fc('0x18');agents[_0x22b635[_0xd9fc('0x12')]][_0xd9fc('0x19')]=null;agents[_0x22b635[_0xd9fc('0x12')]][_0xd9fc('0x1a')]=null;utils[_0xd9fc('0x1b')](util['format'](_0xd9fc('0x1c'),_0x22b635['uniqueid'],agents[_0x22b635['destuniqueid']][_0xd9fc('0x6')],_0x22b635['destuniqueid']));}catch(_0x360d23){utils[_0xd9fc('0x1d')](util[_0xd9fc('0x14')](_0xd9fc('0x1e'),_0x22b635[_0xd9fc('0x11')]),_0x360d23);}};exports[_0xd9fc('0x1f')]=function(_0x4fc417){try{if(!_['isNil'](agents[_0x4fc417[_0xd9fc('0x12')]])){utils[_0xd9fc('0x20')](util[_0xd9fc('0x14')](_0xd9fc('0x21'),_0x4fc417[_0xd9fc('0x11')]),_0x4fc417);utils[_0xd9fc('0x1b')](util[_0xd9fc('0x14')](_0xd9fc('0x22'),_0x4fc417[_0xd9fc('0x11')],agents[_0x4fc417[_0xd9fc('0x12')]][_0xd9fc('0x6')],_0x4fc417['destuniqueid']));agents[_0x4fc417[_0xd9fc('0x12')]][_0xd9fc('0x1f')]=!![];agents[_0x4fc417[_0xd9fc('0x12')]]['agentringnoanswerAt']=utils[_0xd9fc('0x16')]();agents[_0x4fc417[_0xd9fc('0x12')]][_0xd9fc('0x17')]=_0xd9fc('0x23');agents[_0x4fc417[_0xd9fc('0x12')]][_0xd9fc('0x24')]=_0xd9fc('0x23');agents[_0x4fc417[_0xd9fc('0x12')]][_0xd9fc('0x25')]=_0x4fc417['ringtime']?parseInt(_0x4fc417['ringtime'])/0x3e8:0x0;agents[_0x4fc417[_0xd9fc('0x12')]][_0xd9fc('0x26')]=0x0;unanswered[_0xd9fc('0x27')](_0x4fc417[_0xd9fc('0x12')]);}}catch(_0x530836){utils[_0xd9fc('0x1d')](util[_0xd9fc('0x14')](_0xd9fc('0x21'),_0x4fc417[_0xd9fc('0x11')]),_0x530836);}};exports[_0xd9fc('0x28')]=function(_0x3a02c3){try{_[_0xd9fc('0x29')](agents,function(_0x3d365b,_0x27c2cf){if(_0x3d365b[_0xd9fc('0x11')]==_0x3a02c3[_0xd9fc('0x11')]&&!_[_0xd9fc('0x2a')](unanswered,_0x3d365b[_0xd9fc('0x12')])){utils[_0xd9fc('0x20')](util[_0xd9fc('0x14')](_0xd9fc('0x2b'),_0x3a02c3[_0xd9fc('0x11')]),_0x3a02c3);utils[_0xd9fc('0x1b')](util[_0xd9fc('0x14')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x3a02c3[_0xd9fc('0x11')],_0x3d365b[_0xd9fc('0x6')],_0x3d365b[_0xd9fc('0x12')]));_0x3d365b[_0xd9fc('0x1f')]=!![];_0x3d365b[_0xd9fc('0x2c')]=utils[_0xd9fc('0x16')]();_0x3d365b[_0xd9fc('0x17')]=_0xd9fc('0x2d');_0x3d365b[_0xd9fc('0x24')]=_0xd9fc('0x2d');_0x3d365b[_0xd9fc('0x25')]=_0x3a02c3[_0xd9fc('0x25')];_0x3d365b[_0xd9fc('0x26')]=0x0;writeDB(_0x3d365b);}});}catch(_0x47f3f1){utils[_0xd9fc('0x1d')](util['format'](_0xd9fc('0x2b'),_0x3a02c3[_0xd9fc('0x11')]),_0x47f3f1);}};exports[_0xd9fc('0x2e')]=function(_0x54eb99){try{if(agents[_0x54eb99[_0xd9fc('0x12')]]){utils['debug'](util['format']('[%s][agents][agentconnect]',_0x54eb99[_0xd9fc('0x11')]),_0x54eb99);utils[_0xd9fc('0x1b')](util['format'](_0xd9fc('0x2f'),_0x54eb99[_0xd9fc('0x11')],agents[_0x54eb99[_0xd9fc('0x12')]]['membername'],_0x54eb99[_0xd9fc('0x12')]));agents[_0x54eb99[_0xd9fc('0x12')]]['agentconnectAt']=utils['now']();agents[_0x54eb99[_0xd9fc('0x12')]][_0xd9fc('0x19')]=_0x54eb99[_0xd9fc('0x19')];agents[_0x54eb99[_0xd9fc('0x12')]][_0xd9fc('0x1a')]=_0x54eb99[_0xd9fc('0x1a')];agents[_0x54eb99[_0xd9fc('0x12')]]['holdtime']=_0x54eb99[_0xd9fc('0x30')];agents[_0x54eb99['destuniqueid']][_0xd9fc('0x17')]=_0xd9fc('0x31');_[_0xd9fc('0x29')](agents,function(_0xad1e8c,_0x43ec2f){if(_0xad1e8c['destuniqueid']!=_0x54eb99['destuniqueid']&&_0xad1e8c[_0xd9fc('0x11')]==_0x54eb99[_0xd9fc('0x11')]){_0xad1e8c[_0xd9fc('0x26')]=0x0;_0xad1e8c[_0xd9fc('0x25')]=_0x54eb99[_0xd9fc('0x30')];_0xad1e8c[_0xd9fc('0x1f')]=!![];_0xad1e8c[_0xd9fc('0x2c')]=utils['now']();_0xad1e8c[_0xd9fc('0x17')]='answered_elsewhere';_0xad1e8c['reason']=_0xd9fc('0x32');_0xad1e8c[_0xd9fc('0x33')]=_0x54eb99[_0xd9fc('0x12')];_0xad1e8c[_0xd9fc('0x34')]=_0x54eb99[_0xd9fc('0x6')];writeDB(_0xad1e8c);}});}}catch(_0x20b641){utils[_0xd9fc('0x1d')](util[_0xd9fc('0x14')](_0xd9fc('0x35'),_0x54eb99['uniqueid']),_0x20b641);}};exports[_0xd9fc('0xc')]=function(_0x171ab1){try{if(!_['isNil'](agents[_0x171ab1[_0xd9fc('0x12')]])){utils[_0xd9fc('0x20')](util[_0xd9fc('0x14')](_0xd9fc('0x36'),_0x171ab1[_0xd9fc('0x11')]),_0x171ab1);utils[_0xd9fc('0x1b')](util[_0xd9fc('0x14')](_0xd9fc('0x37'),_0x171ab1[_0xd9fc('0x11')],agents[_0x171ab1[_0xd9fc('0x12')]][_0xd9fc('0x6')],_0x171ab1['destuniqueid']));agents[_0x171ab1[_0xd9fc('0x12')]][_0xd9fc('0xc')]=!![];agents[_0x171ab1[_0xd9fc('0x12')]][_0xd9fc('0x38')]=utils[_0xd9fc('0x16')]();agents[_0x171ab1[_0xd9fc('0x12')]]['talktime']=utils['diffTime'](agents[_0x171ab1[_0xd9fc('0x12')]]['agentcompleteAt'],agents[_0x171ab1[_0xd9fc('0x12')]][_0xd9fc('0x39')]);agents[_0x171ab1[_0xd9fc('0x12')]][_0xd9fc('0x24')]=_0x171ab1[_0xd9fc('0x24')];agents[_0x171ab1['destuniqueid']][_0xd9fc('0x17')]=_0xd9fc('0x3a');writeDB(agents[_0x171ab1[_0xd9fc('0x12')]]);}}catch(_0x573cc9){utils[_0xd9fc('0x1d')](util[_0xd9fc('0x14')](_0xd9fc('0x36'),_0x171ab1[_0xd9fc('0x11')]),_0x573cc9);}};exports[_0xd9fc('0x3b')]=function(_0xd748fc){try{if(!_[_0xd9fc('0x3c')](agents[_0xd748fc[_0xd9fc('0x3d')]])){utils[_0xd9fc('0x20')](util[_0xd9fc('0x14')](_0xd9fc('0x3e'),_0xd748fc[_0xd9fc('0x11')]),_0xd748fc);utils[_0xd9fc('0x1b')](util[_0xd9fc('0x14')](_0xd9fc('0x3f'),_0xd748fc[_0xd9fc('0x11')],agents[_0xd748fc[_0xd9fc('0x3d')]][_0xd9fc('0x6')],agents[_0xd748fc['transfereruniqueid']][_0xd9fc('0x11')]));agents[_0xd748fc[_0xd9fc('0x3d')]][_0xd9fc('0x40')]=!![];agents[_0xd748fc[_0xd9fc('0x3d')]][_0xd9fc('0x41')]=_0xd9fc('0x42');agents[_0xd748fc['transfereruniqueid']][_0xd9fc('0x43')]=_0xd748fc[_0xd9fc('0x44')];agents[_0xd748fc[_0xd9fc('0x3d')]]['transferuniqueid']=agents[_0xd748fc['transfereruniqueid']]['uniqueid'];}}catch(_0x4401ef){utils['error'](util[_0xd9fc('0x14')](_0xd9fc('0x3e'),_0xd748fc[_0xd9fc('0x11')]),_0x4401ef);}};exports[_0xd9fc('0x45')]=function(_0x5a7711){try{utils[_0xd9fc('0x20')](util[_0xd9fc('0x14')](_0xd9fc('0x46'),_0x5a7711[_0xd9fc('0x47')]),_0x5a7711);if(_0x5a7711[_0xd9fc('0x47')]==_0x5a7711[_0xd9fc('0x48')]){if(!_['isNil'](agents[_0x5a7711['secondtransfereruniqueid']])){utils[_0xd9fc('0x1b')](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x5a7711[_0xd9fc('0x47')],agents[_0x5a7711[_0xd9fc('0x49')]][_0xd9fc('0x6')]));agents[_0x5a7711['secondtransfereruniqueid']][_0xd9fc('0x40')]=!![];agents[_0x5a7711['secondtransfereruniqueid']][_0xd9fc('0x41')]=_0xd9fc('0x4a');agents[_0x5a7711[_0xd9fc('0x49')]][_0xd9fc('0x43')]=_0x5a7711[_0xd9fc('0x4b')];agents[_0x5a7711[_0xd9fc('0x49')]]['transferuniqueid']=_0x5a7711[_0xd9fc('0x47')];}if(_0x5a7711[_0xd9fc('0x4c')]&&agents[_0x5a7711[_0xd9fc('0x4c')]]){agents[_0x5a7711[_0xd9fc('0x4c')]]['agententerreason']=0x1;transfers[_0x5a7711['transfereeuniqueid']]=_['clone'](agents[_0x5a7711[_0xd9fc('0x4c')]]);transfers[_0x5a7711[_0xd9fc('0x4c')]]['calleridnum']=agents[_0x5a7711[_0xd9fc('0x49')]][_0xd9fc('0x8')];transfers[_0x5a7711[_0xd9fc('0x4c')]]['calleridname']=agents[_0x5a7711['secondtransfereruniqueid']]['calleridname'];transfers[_0x5a7711[_0xd9fc('0x4c')]][_0xd9fc('0x15')]=utils[_0xd9fc('0x16')]();transfers[_0x5a7711[_0xd9fc('0x4c')]][_0xd9fc('0x39')]=utils[_0xd9fc('0x16')]();transfers[_0x5a7711['transfereeuniqueid']][_0xd9fc('0x25')]=0x0;transfers[_0x5a7711['transfereeuniqueid']][_0xd9fc('0x4d')]=0x2;}}else if(_0x5a7711[_0xd9fc('0x49')]==_0x5a7711[_0xd9fc('0x4e')]){if(!_[_0xd9fc('0x3c')](agents[_0x5a7711['origtransfereruniqueid']])){utils['info'](util[_0xd9fc('0x14')](_0xd9fc('0x4f'),_0x5a7711[_0xd9fc('0x47')],agents[_0x5a7711[_0xd9fc('0x47')]][_0xd9fc('0x6')]));agents[_0x5a7711[_0xd9fc('0x47')]][_0xd9fc('0x40')]=!![];agents[_0x5a7711[_0xd9fc('0x47')]][_0xd9fc('0x41')]=_0xd9fc('0x4a');agents[_0x5a7711[_0xd9fc('0x47')]][_0xd9fc('0x43')]=_0x5a7711['secondtransfererexten'];agents[_0x5a7711[_0xd9fc('0x47')]][_0xd9fc('0x50')]=_0x5a7711['secondtransfereruniqueid'];}if(_0x5a7711[_0xd9fc('0x51')]&&agents[_0x5a7711[_0xd9fc('0x51')]]){agents[_0x5a7711[_0xd9fc('0x51')]][_0xd9fc('0x4d')]=0x1;transfers[_0x5a7711['transfertargetuniqueid']]=_['clone'](agents[_0x5a7711['transfertargetuniqueid']]);transfers[_0x5a7711[_0xd9fc('0x51')]]['calleridnum']=agents[_0x5a7711[_0xd9fc('0x47')]][_0xd9fc('0x8')];transfers[_0x5a7711['transfertargetuniqueid']][_0xd9fc('0x52')]=agents[_0x5a7711['origtransfereruniqueid']][_0xd9fc('0x52')];transfers[_0x5a7711[_0xd9fc('0x51')]]['agentcalledAt']=utils[_0xd9fc('0x16')]();transfers[_0x5a7711[_0xd9fc('0x51')]][_0xd9fc('0x39')]=utils[_0xd9fc('0x16')]();transfers[_0x5a7711['transfertargetuniqueid']][_0xd9fc('0x25')]=0x0;transfers[_0x5a7711[_0xd9fc('0x51')]][_0xd9fc('0x4d')]=0x2;}}}catch(_0x74b886){utils[_0xd9fc('0x1d')](util[_0xd9fc('0x14')](_0xd9fc('0x46'),_0x5a7711[_0xd9fc('0x47')]),_0x74b886);}};exports[_0xd9fc('0x53')]=function(_0x4d375b){try{utils[_0xd9fc('0x20')](util[_0xd9fc('0x14')](_0xd9fc('0x54'),_0x4d375b['uniqueid']),_0x4d375b);if(agents[_0x4d375b[_0xd9fc('0x11')]]&&agents[_0x4d375b['uniqueid']][_0xd9fc('0x24')]===_0xd9fc('0x23')){if(_0x4d375b[_0xd9fc('0x55')]==='21'){agents[_0x4d375b['uniqueid']][_0xd9fc('0x24')]=_0xd9fc('0x56');agents[_0x4d375b[_0xd9fc('0x11')]]['lastevent']=_0xd9fc('0x56');}utils[_0xd9fc('0x1b')](util[_0xd9fc('0x14')](_0xd9fc('0x57'),_0x4d375b['uniqueid'],agents[_0x4d375b[_0xd9fc('0x11')]]['membername'],agents[_0x4d375b[_0xd9fc('0x11')]][_0xd9fc('0x24')],agents[_0x4d375b[_0xd9fc('0x11')]][_0xd9fc('0x17')]));writeDB(agents[_0x4d375b[_0xd9fc('0x11')]]);var _0x2648b8=unanswered['indexOf'](_0x4d375b['uniqueid']);if(_0x2648b8>-0x1){unanswered[_0xd9fc('0x58')](_0x2648b8,0x1);}}if(transfers[_0x4d375b[_0xd9fc('0x11')]]){transfers[_0x4d375b['uniqueid']][_0xd9fc('0xc')]=!![];transfers[_0x4d375b[_0xd9fc('0x11')]]['agentcompleteAt']=utils[_0xd9fc('0x16')]();transfers[_0x4d375b['uniqueid']][_0xd9fc('0x26')]=utils['diffTime'](transfers[_0x4d375b[_0xd9fc('0x11')]]['agentcompleteAt'],transfers[_0x4d375b[_0xd9fc('0x11')]][_0xd9fc('0x39')]);transfers[_0x4d375b['uniqueid']]['reason']=_0xd9fc('0x59');transfers[_0x4d375b[_0xd9fc('0x11')]][_0xd9fc('0x17')]=_0xd9fc('0x3a');utils[_0xd9fc('0x1b')](util[_0xd9fc('0x14')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4d375b[_0xd9fc('0x11')],transfers[_0x4d375b[_0xd9fc('0x11')]][_0xd9fc('0x6')],transfers[_0x4d375b[_0xd9fc('0x11')]]['reason'],transfers[_0x4d375b[_0xd9fc('0x11')]][_0xd9fc('0x17')]));writeDB(transfers[_0x4d375b[_0xd9fc('0x11')]],!![]);}if(agents[_0x4d375b[_0xd9fc('0x11')]]&&agents[_0x4d375b['uniqueid']][_0xd9fc('0x39')]){agents[_0x4d375b[_0xd9fc('0x11')]][_0xd9fc('0xc')]=!![];agents[_0x4d375b[_0xd9fc('0x11')]]['agentcompleteAt']=utils['now']();agents[_0x4d375b[_0xd9fc('0x11')]][_0xd9fc('0x26')]=utils['diffTime'](agents[_0x4d375b[_0xd9fc('0x11')]][_0xd9fc('0x38')],agents[_0x4d375b[_0xd9fc('0x11')]][_0xd9fc('0x39')]);agents[_0x4d375b[_0xd9fc('0x11')]][_0xd9fc('0x24')]=agents[_0x4d375b[_0xd9fc('0x11')]][_0xd9fc('0x40')]?_0xd9fc('0x40'):_0xd9fc('0x59');agents[_0x4d375b[_0xd9fc('0x11')]][_0xd9fc('0x17')]='complete';utils[_0xd9fc('0x1b')](util['format'](_0xd9fc('0x57'),_0x4d375b[_0xd9fc('0x11')],agents[_0x4d375b[_0xd9fc('0x11')]][_0xd9fc('0x6')],agents[_0x4d375b[_0xd9fc('0x11')]][_0xd9fc('0x24')],agents[_0x4d375b[_0xd9fc('0x11')]]['lastevent']));writeDB(agents[_0x4d375b['uniqueid']]);}}catch(_0x287733){utils['error'](util[_0xd9fc('0x14')]('[%s][agents][hangup]',_0x4d375b[_0xd9fc('0x11')]),_0x287733);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 731ae3d..f926f32 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 _0x6732=['secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','variable','xmd-callerid','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','cdr','appdata','split','lastIndexOf','includes','noop','execif','set','gotoif','util','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','blinds','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','request','newchannel','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','error','newstate','[%s][calls][newstate]','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','hangup','[%s][calls][hangup]','callerid','cause-txt','duration','diffTime','endtime','starttime','billableseconds','attendedtransfer','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x6732,0x106));var _0x2673=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6732[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2673('0x0'));var utils=require('./utils');var transfers=require(_0x2673('0x1'));var dispositions=[_0x2673('0x2'),_0x2673('0x3'),'FAILED','NO\x20ANSWER',_0x2673('0x2'),'NO\x20ANSWER',_0x2673('0x4'),_0x2673('0x5'),_0x2673('0x3'),_0x2673('0x3'),_0x2673('0x3')];var channels={};function writeDB(_0xf32b21){var _0x4f0bd3;if(transfers['blinds'][_0xf32b21[_0x2673('0x6')]]){_0x4f0bd3=_0xf32b21[_0x2673('0x6')];_0xf32b21['uniqueid']=transfers[_0x2673('0x7')][_0xf32b21[_0x2673('0x6')]]['transfereeuniqueid'];}utils[_0x2673('0x8')](util[_0x2673('0x9')](_0x2673('0xa'),_0xf32b21['uniqueid'],_0xf32b21[_0x2673('0xb')],_0xf32b21[_0x2673('0xc')],_0xf32b21[_0x2673('0xd')],_0xf32b21[_0x2673('0xe')],_0xf32b21[_0x2673('0xf')],_0xf32b21[_0x2673('0x10')],_0xf32b21[_0x2673('0x11')]));if(_0xf32b21[_0x2673('0x12')]){utils[_0x2673('0x13')](_0xf32b21[_0x2673('0x12')])['then'](function(_0x2bf658){if(_0x2bf658){_0xf32b21[_0x2673('0x14')]=_0x2bf658['id'];}utils[_0x2673('0x15')]('CreateVoiceCallReport',_0xf32b21);});}else{utils[_0x2673('0x15')]('CreateVoiceCallReport',_0xf32b21);}if(channels[_0xf32b21[_0x2673('0x6')]]){delete channels[_0xf32b21[_0x2673('0x6')]];}else if(_0x4f0bd3&&channels[_0x4f0bd3]){delete transfers[_0x2673('0x7')][_0x4f0bd3];delete channels[_0x4f0bd3];}}exports[_0x2673('0x16')]=function(_0x3a8e9a){try{utils[_0x2673('0x17')](util[_0x2673('0x9')](_0x2673('0x18'),_0x3a8e9a['uniqueid']),_0x3a8e9a);if(_0x3a8e9a[_0x2673('0x6')]==_0x3a8e9a['linkedid']&&_0x3a8e9a[_0x2673('0xb')]!=_0x2673('0x19')){utils[_0x2673('0x8')](util['format'](_0x2673('0x1a'),_0x3a8e9a[_0x2673('0x6')],_0x3a8e9a[_0x2673('0x1b')],_0x3a8e9a[_0x2673('0x1c')]));channels[_0x3a8e9a[_0x2673('0x6')]]={'uniqueid':_0x3a8e9a[_0x2673('0x6')],'accountcode':_0x3a8e9a[_0x2673('0x12')],'source':_0x3a8e9a[_0x2673('0xf')],'destination':_0x3a8e9a['exten'],'destinationcontext':_0x3a8e9a[_0x2673('0x1b')],'channel':_0x3a8e9a[_0x2673('0xb')],'starttime':utils[_0x2673('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x2673('0x2'),'amaflags':'DOCUMENTATION'};}}catch(_0x592b78){utils[_0x2673('0x1e')](util[_0x2673('0x9')](_0x2673('0x18'),_0x3a8e9a[_0x2673('0x6')]),_0x592b78);}};exports[_0x2673('0x1f')]=function(_0x175c10){try{utils[_0x2673('0x17')](util[_0x2673('0x9')](_0x2673('0x20'),_0x175c10[_0x2673('0x6')]),_0x175c10);if(!_['isNil'](channels[_0x175c10['uniqueid']])&&_0x175c10['channelstate']==0x6){utils['info'](util[_0x2673('0x9')](_0x2673('0x21'),_0x175c10[_0x2673('0x6')],_0x175c10[_0x2673('0x1b')],_0x175c10['channel']));if(_[_0x2673('0x22')](channels[_0x175c10[_0x2673('0x6')]][_0x2673('0x23')])){channels[_0x175c10[_0x2673('0x6')]]['systemanswertime']=utils[_0x2673('0x1d')]();}}else if(!_[_0x2673('0x22')](channels[_0x175c10[_0x2673('0x24')]])&&_0x175c10['channelstate']==0x6&&_0x175c10[_0x2673('0x1b')]!=_0x2673('0x25')){utils[_0x2673('0x8')](util[_0x2673('0x9')](_0x2673('0x26'),_0x175c10['uniqueid'],_0x175c10[_0x2673('0x24')],_0x175c10['context'],_0x175c10[_0x2673('0xb')]));channels[_0x175c10[_0x2673('0x24')]][_0x2673('0x12')]=_0x175c10['accountcode'];channels[_0x175c10['linkedid']][_0x2673('0x27')]=_0x175c10['channel'];if(_[_0x2673('0x22')](channels[_0x175c10['linkedid']][_0x2673('0x28')])){channels[_0x175c10['linkedid']][_0x2673('0x28')]=utils[_0x2673('0x1d')]();}channels[_0x175c10[_0x2673('0x24')]][_0x2673('0x29')]=dispositions[_['toNumber'](_0x175c10['channelstate'])]||_0x2673('0x4');}}catch(_0x210750){utils[_0x2673('0x1e')](util[_0x2673('0x9')]('[%s][calls][newstate]',_0x175c10[_0x2673('0x6')]),_0x210750);}};exports[_0x2673('0x2a')]=function(_0x125a68){try{if(!_[_0x2673('0x22')](channels[_0x125a68[_0x2673('0x6')]])){utils['debug'](util[_0x2673('0x9')](_0x2673('0x2b'),_0x125a68[_0x2673('0x6')]),_0x125a68);if(_[_0x2673('0x22')](channels[_0x125a68[_0x2673('0x6')]][_0x2673('0x2c')])){channels[_0x125a68['uniqueid']]['callerid']=_0x125a68['calleridname']+'\x20<'+_0x125a68[_0x2673('0xf')]+'>';}utils['info'](util[_0x2673('0x9')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x125a68[_0x2673('0x6')],channels[_0x125a68[_0x2673('0x6')]][_0x2673('0x2c')],_0x125a68[_0x2673('0x2d')]));channels[_0x125a68['uniqueid']]['endtime']=utils[_0x2673('0x1d')]();channels[_0x125a68[_0x2673('0x6')]][_0x2673('0x2e')]=utils[_0x2673('0x2f')](channels[_0x125a68[_0x2673('0x6')]][_0x2673('0x30')],channels[_0x125a68[_0x2673('0x6')]][_0x2673('0x31')]);channels[_0x125a68[_0x2673('0x6')]][_0x2673('0x32')]=channels[_0x125a68[_0x2673('0x6')]][_0x2673('0x28')]?utils[_0x2673('0x2f')](channels[_0x125a68[_0x2673('0x6')]][_0x2673('0x30')],channels[_0x125a68[_0x2673('0x6')]]['answertime']):0x0;writeDB(channels[_0x125a68[_0x2673('0x6')]]);}}catch(_0xbd752b){utils[_0x2673('0x1e')](util[_0x2673('0x9')](_0x2673('0x2b'),_0x125a68[_0x2673('0x6')]),_0xbd752b);}};exports[_0x2673('0x33')]=function(_0x27aa09){try{if(!_[_0x2673('0x22')](channels[_0x27aa09['localtwolinkedid']])){utils[_0x2673('0x17')](util[_0x2673('0x9')]('[%s][calls][attendedtransfer]',_0x27aa09[_0x2673('0x34')]),_0x27aa09);if(channels[_0x27aa09[_0x2673('0x35')]][_0x2673('0xb')]==_0x27aa09[_0x2673('0x36')]){utils[_0x2673('0x8')](util['format'](_0x2673('0x37'),_0x27aa09[_0x2673('0x34')],_0x27aa09[_0x2673('0x35')],_0x27aa09[_0x2673('0x38')]));channels[_0x27aa09[_0x2673('0x35')]]['destinationchannel']=_0x27aa09[_0x2673('0x38')];channels[_0x27aa09[_0x2673('0x35')]][_0x2673('0x39')]=_0x2673('0x3a');}else if(channels[_0x27aa09[_0x2673('0x35')]]['channel']=_0x27aa09[_0x2673('0x3b')]){utils[_0x2673('0x8')](util[_0x2673('0x9')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x27aa09[_0x2673('0x34')],_0x27aa09[_0x2673('0x35')],_0x27aa09[_0x2673('0x3c')]));channels[_0x27aa09[_0x2673('0x35')]][_0x2673('0x27')]=_0x27aa09['origtransfererchannel'];channels[_0x27aa09[_0x2673('0x35')]][_0x2673('0x39')]=_0x2673('0x3a');}}}catch(_0x309fd1){utils['error'](util[_0x2673('0x9')]('[%s][calls][attendedtransfer]',_0x27aa09[_0x2673('0x34')]),_0x309fd1);}};exports['musiconholdstart']=function(_0x3e825e){try{if(!_[_0x2673('0x22')](channels[_0x3e825e[_0x2673('0x6')]])){utils[_0x2673('0x17')](util[_0x2673('0x9')](_0x2673('0x3d'),_0x3e825e[_0x2673('0x6')]),_0x3e825e);channels[_0x3e825e[_0x2673('0x6')]][_0x2673('0x3e')]=utils[_0x2673('0x1d')]();utils[_0x2673('0x8')](util[_0x2673('0x9')](_0x2673('0x3f'),_0x3e825e[_0x2673('0x6')],channels[_0x3e825e[_0x2673('0x6')]][_0x2673('0x3e')]));}}catch(_0x1d2af4){utils[_0x2673('0x1e')](util[_0x2673('0x9')]('[%s][calls][musiconholdstart]',_0x3e825e[_0x2673('0x6')]),_0x1d2af4);}};exports[_0x2673('0x40')]=function(_0x5f3351){try{if(!_['isNil'](channels[_0x5f3351[_0x2673('0x6')]])){utils['debug'](util['format'](_0x2673('0x41'),_0x5f3351[_0x2673('0x6')]),_0x5f3351);if(!_[_0x2673('0x22')](channels[_0x5f3351[_0x2673('0x6')]][_0x2673('0x3e')])){channels[_0x5f3351[_0x2673('0x6')]][_0x2673('0x42')]+=utils[_0x2673('0x2f')](utils['now'](),channels[_0x5f3351['uniqueid']]['musiconholdstartAt']);utils['info'](util[_0x2673('0x9')](_0x2673('0x43'),_0x5f3351[_0x2673('0x6')],channels[_0x5f3351[_0x2673('0x6')]][_0x2673('0x42')]));delete channels[_0x5f3351[_0x2673('0x6')]][_0x2673('0x3e')];}}}catch(_0x367d4f){utils[_0x2673('0x1e')](util[_0x2673('0x9')](_0x2673('0x41'),_0x5f3351[_0x2673('0x6')]),_0x367d4f);}};exports['varset']=function(_0xc01457){try{if(!_[_0x2673('0x22')](channels[_0xc01457['uniqueid']])){utils[_0x2673('0x17')](util[_0x2673('0x9')](_0x2673('0x44'),_0xc01457[_0x2673('0x6')]),_0xc01457);if(!_[_0x2673('0x22')](_0xc01457['variable'][_0x2673('0x45')])){utils[_0x2673('0x8')](util[_0x2673('0x9')](_0x2673('0x46'),_0xc01457['uniqueid'],_0xc01457['value']));channels[_0xc01457[_0x2673('0x6')]][_0x2673('0x47')]=_0xc01457[_0x2673('0x48')];}if(!_[_0x2673('0x22')](_0xc01457['variable']['xmd-phone'])){utils[_0x2673('0x8')](util[_0x2673('0x9')](_0x2673('0x49'),_0xc01457[_0x2673('0x6')],_0xc01457[_0x2673('0x48')]));channels[_0xc01457[_0x2673('0x6')]][_0x2673('0x4a')]=_0xc01457[_0x2673('0x48')];channels[_0xc01457[_0x2673('0x6')]][_0x2673('0x2c')]='\x22'+_0xc01457[_0x2673('0x48')]+_0x2673('0x4b')+_0xc01457[_0x2673('0x48')]+'>';}if(!_[_0x2673('0x22')](_0xc01457['variable'][_0x2673('0x4c')])||!_[_0x2673('0x22')](_0xc01457[_0x2673('0x4d')][_0x2673('0x4e')])){utils[_0x2673('0x8')](util[_0x2673('0x9')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0xc01457[_0x2673('0x6')],!_[_0x2673('0x22')](_0xc01457['variable'][_0x2673('0x4c')])?_0x2673('0x4c'):_0x2673('0x4e'),_0xc01457[_0x2673('0x48')]));channels[_0xc01457[_0x2673('0x6')]][_0x2673('0x2c')]=_0xc01457[_0x2673('0x48')];}if(!_[_0x2673('0x22')](_0xc01457['variable']['xmd-queue'])||!_[_0x2673('0x22')](_0xc01457[_0x2673('0x4d')][_0x2673('0x4f')])){utils['info'](util[_0x2673('0x9')](_0x2673('0x50'),_0xc01457[_0x2673('0x6')],!_['isNil'](_0xc01457['variable']['xmd-queue'])?'xmd-queue':_0x2673('0x4f'),_0xc01457['value']));channels[_0xc01457[_0x2673('0x6')]][_0x2673('0x51')]=_0x2673('0x52');channels[_0xc01457[_0x2673('0x6')]][_0x2673('0x53')]=_0xc01457[_0x2673('0x48')];channels[_0xc01457[_0x2673('0x6')]][_0x2673('0xc')]=!![];}if(!_[_0x2673('0x22')](_0xc01457[_0x2673('0x4d')]['xmd-contactid'])){utils['info'](util[_0x2673('0x9')](_0x2673('0x54'),_0xc01457['uniqueid'],_0xc01457['value']));channels[_0xc01457[_0x2673('0x6')]]['ContactId']=_0xc01457[_0x2673('0x48')];}if(!_['isNil'](_0xc01457[_0x2673('0x4d')][_0x2673('0x55')])){utils['info'](util[_0x2673('0x9')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0xc01457[_0x2673('0x6')],_0xc01457[_0x2673('0x48')]));channels[_0xc01457['uniqueid']][_0x2673('0x56')]=_0xc01457[_0x2673('0x48')];}if(!_['isNil'](_0xc01457[_0x2673('0x4d')][_0x2673('0x57')])){utils[_0x2673('0x8')](util[_0x2673('0x9')](_0x2673('0x58'),_0xc01457[_0x2673('0x6')],_0xc01457[_0x2673('0x48')]));channels[_0xc01457[_0x2673('0x6')]][_0x2673('0x59')]=_0xc01457[_0x2673('0x48')];}if(!_[_0x2673('0x22')](_0xc01457['variable'][_0x2673('0x5a')])){utils[_0x2673('0x8')](util[_0x2673('0x9')](_0x2673('0x5b'),_0xc01457['uniqueid'],_0xc01457[_0x2673('0x48')]));channels[_0xc01457[_0x2673('0x6')]][_0x2673('0x5a')]=_0xc01457[_0x2673('0x48')];}}}catch(_0xa9c08f){utils['error'](util['format']('[%s][calls][varset]',_0xc01457[_0x2673('0x6')]),_0xa9c08f);}};exports[_0x2673('0x5c')]=function(_0x43ba0f){try{if(!_[_0x2673('0x22')](channels[_0x43ba0f[_0x2673('0x6')]])){utils[_0x2673('0x17')](util[_0x2673('0x9')]('[%s][calls][newexten]',_0x43ba0f[_0x2673('0x6')]),_0x43ba0f);utils['info'](util['format'](_0x2673('0x5d'),_0x43ba0f[_0x2673('0x6')],_0x43ba0f[_0x2673('0x5e')],_0x43ba0f['appdata']));if(_0x43ba0f[_0x2673('0x5e')][_0x2673('0x5f')]()=='set'&&_[_0x2673('0x60')](_0x43ba0f['appdata'][_0x2673('0x5f')](),_0x2673('0x61'))){var _0x239ff4=_0x43ba0f[_0x2673('0x62')][_0x2673('0x63')]('=');var _0x1ad460=_0x239ff4[0x0]['substring'](_0x239ff4[0x0][_0x2673('0x64')]('(')+0x1,_0x239ff4[0x0]['lastIndexOf'](')'));var _0x35af8f=_0x239ff4[0x1];channels[_0x43ba0f[_0x2673('0x6')]][_0x1ad460]=_0x35af8f;}if(!_[_0x2673('0x65')]([_0x2673('0x2a'),_0x2673('0x66'),_0x2673('0x67'),_0x2673('0x68'),_0x2673('0x69')],_0x43ba0f[_0x2673('0x5e')][_0x2673('0x5f')]())){channels[_0x43ba0f[_0x2673('0x6')]][_0x2673('0x51')]=_0x43ba0f[_0x2673('0x5e')];channels[_0x43ba0f[_0x2673('0x6')]][_0x2673('0x53')]=_0x43ba0f['appdata'];}}}catch(_0x4e6e72){utils[_0x2673('0x1e')](util[_0x2673('0x9')]('[%s][calls][newexten]',_0x43ba0f['uniqueid']),_0x4e6e72);}}; \ No newline at end of file +var _0x2c3f=['xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastdata','queue','xmd-contactid','xmd-cdrtype','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','appdata','application','set','startsWith','substring','lastIndexOf','execif','gotoif','lastapplication','lodash','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','format','channel','membername','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','destinationchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<'];(function(_0x2b27c5,_0x2a8184){var _0x301e53=function(_0x354f1f){while(--_0x354f1f){_0x2b27c5['push'](_0x2b27c5['shift']());}};_0x301e53(++_0x2a8184);}(_0x2c3f,0xea));var _0xf2c3=function(_0x350493,_0x721b7e){_0x350493=_0x350493-0x0;var _0x139a4b=_0x2c3f[_0x350493];return _0x139a4b;};'use strict';var _=require(_0xf2c3('0x0'));var util=require('util');var utils=require('./utils');var transfers=require('./transfers.controller');var dispositions=[_0xf2c3('0x1'),'FAILED',_0xf2c3('0x2'),_0xf2c3('0x1'),_0xf2c3('0x1'),_0xf2c3('0x1'),_0xf2c3('0x3'),_0xf2c3('0x4'),'FAILED',_0xf2c3('0x2'),_0xf2c3('0x2')];var channels={};function writeDB(_0x2e510b){var _0x3fd18b;if(transfers[_0xf2c3('0x5')][_0x2e510b[_0xf2c3('0x6')]]){_0x3fd18b=_0x2e510b[_0xf2c3('0x6')];_0x2e510b[_0xf2c3('0x6')]=transfers[_0xf2c3('0x5')][_0x2e510b['uniqueid']][_0xf2c3('0x7')];}utils['info'](util[_0xf2c3('0x8')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x2e510b[_0xf2c3('0x6')],_0x2e510b[_0xf2c3('0x9')],_0x2e510b['queue'],_0x2e510b[_0xf2c3('0xa')],_0x2e510b[_0xf2c3('0xb')],_0x2e510b[_0xf2c3('0xc')],_0x2e510b[_0xf2c3('0xd')],_0x2e510b['lastevent']));if(_0x2e510b[_0xf2c3('0xe')]){utils[_0xf2c3('0xf')](_0x2e510b['accountcode'])[_0xf2c3('0x10')](function(_0x36ab54){if(_0x36ab54){_0x2e510b[_0xf2c3('0x11')]=_0x36ab54['id'];}utils[_0xf2c3('0x12')](_0xf2c3('0x13'),_0x2e510b);});}else{utils['request'](_0xf2c3('0x13'),_0x2e510b);}if(channels[_0x2e510b[_0xf2c3('0x6')]]){delete channels[_0x2e510b[_0xf2c3('0x6')]];}else if(_0x3fd18b&&channels[_0x3fd18b]){delete transfers[_0xf2c3('0x5')][_0x3fd18b];delete channels[_0x3fd18b];}}exports[_0xf2c3('0x14')]=function(_0x329771){try{utils[_0xf2c3('0x15')](util[_0xf2c3('0x8')](_0xf2c3('0x16'),_0x329771[_0xf2c3('0x6')]),_0x329771);if(_0x329771[_0xf2c3('0x6')]==_0x329771[_0xf2c3('0x17')]&&_0x329771['channel']!=_0xf2c3('0x18')){utils[_0xf2c3('0x19')](util['format'](_0xf2c3('0x1a'),_0x329771['uniqueid'],_0x329771[_0xf2c3('0x1b')],_0x329771[_0xf2c3('0x1c')]));channels[_0x329771[_0xf2c3('0x6')]]={'uniqueid':_0x329771['uniqueid'],'accountcode':_0x329771[_0xf2c3('0xe')],'source':_0x329771['calleridnum'],'destination':_0x329771[_0xf2c3('0x1c')],'destinationcontext':_0x329771[_0xf2c3('0x1b')],'channel':_0x329771[_0xf2c3('0x9')],'starttime':utils[_0xf2c3('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xf2c3('0x1'),'amaflags':_0xf2c3('0x1e')};}}catch(_0x1be878){utils[_0xf2c3('0x1f')](util[_0xf2c3('0x8')](_0xf2c3('0x16'),_0x329771[_0xf2c3('0x6')]),_0x1be878);}};exports[_0xf2c3('0x20')]=function(_0x5e36a5){try{utils['debug'](util[_0xf2c3('0x8')]('[%s][calls][newstate]',_0x5e36a5[_0xf2c3('0x6')]),_0x5e36a5);if(!_['isNil'](channels[_0x5e36a5[_0xf2c3('0x6')]])&&_0x5e36a5[_0xf2c3('0x21')]==0x6){utils['info'](util[_0xf2c3('0x8')](_0xf2c3('0x22'),_0x5e36a5['uniqueid'],_0x5e36a5[_0xf2c3('0x1b')],_0x5e36a5['channel']));if(_[_0xf2c3('0x23')](channels[_0x5e36a5[_0xf2c3('0x6')]][_0xf2c3('0x24')])){channels[_0x5e36a5[_0xf2c3('0x6')]]['systemanswertime']=utils[_0xf2c3('0x1d')]();}}else if(!_[_0xf2c3('0x23')](channels[_0x5e36a5[_0xf2c3('0x17')]])&&_0x5e36a5[_0xf2c3('0x21')]==0x6&&_0x5e36a5['context']!=_0xf2c3('0x25')){utils['info'](util[_0xf2c3('0x8')](_0xf2c3('0x26'),_0x5e36a5['uniqueid'],_0x5e36a5['linkedid'],_0x5e36a5[_0xf2c3('0x1b')],_0x5e36a5[_0xf2c3('0x9')]));channels[_0x5e36a5[_0xf2c3('0x17')]][_0xf2c3('0xe')]=_0x5e36a5['accountcode'];channels[_0x5e36a5['linkedid']]['destinationchannel']=_0x5e36a5[_0xf2c3('0x9')];if(_[_0xf2c3('0x23')](channels[_0x5e36a5[_0xf2c3('0x17')]][_0xf2c3('0x27')])){channels[_0x5e36a5['linkedid']]['answertime']=utils[_0xf2c3('0x1d')]();}channels[_0x5e36a5[_0xf2c3('0x17')]][_0xf2c3('0x28')]=dispositions[_[_0xf2c3('0x29')](_0x5e36a5[_0xf2c3('0x21')])]||_0xf2c3('0x3');}}catch(_0x226fdc){utils[_0xf2c3('0x1f')](util[_0xf2c3('0x8')](_0xf2c3('0x2a'),_0x5e36a5[_0xf2c3('0x6')]),_0x226fdc);}};exports[_0xf2c3('0x2b')]=function(_0x383378){try{if(!_[_0xf2c3('0x23')](channels[_0x383378['uniqueid']])){utils[_0xf2c3('0x15')](util['format'](_0xf2c3('0x2c'),_0x383378[_0xf2c3('0x6')]),_0x383378);if(_[_0xf2c3('0x23')](channels[_0x383378[_0xf2c3('0x6')]][_0xf2c3('0x2d')])){channels[_0x383378['uniqueid']][_0xf2c3('0x2d')]=_0x383378[_0xf2c3('0x2e')]+'\x20<'+_0x383378[_0xf2c3('0xc')]+'>';}utils[_0xf2c3('0x19')](util['format'](_0xf2c3('0x2f'),_0x383378[_0xf2c3('0x6')],channels[_0x383378[_0xf2c3('0x6')]][_0xf2c3('0x2d')],_0x383378['cause-txt']));channels[_0x383378[_0xf2c3('0x6')]][_0xf2c3('0x30')]=utils[_0xf2c3('0x1d')]();channels[_0x383378[_0xf2c3('0x6')]]['duration']=utils[_0xf2c3('0x31')](channels[_0x383378[_0xf2c3('0x6')]]['endtime'],channels[_0x383378['uniqueid']][_0xf2c3('0x32')]);channels[_0x383378['uniqueid']][_0xf2c3('0x33')]=channels[_0x383378[_0xf2c3('0x6')]][_0xf2c3('0x27')]?utils[_0xf2c3('0x31')](channels[_0x383378[_0xf2c3('0x6')]][_0xf2c3('0x30')],channels[_0x383378[_0xf2c3('0x6')]][_0xf2c3('0x27')]):0x0;writeDB(channels[_0x383378[_0xf2c3('0x6')]]);}}catch(_0x1b3c8c){utils[_0xf2c3('0x1f')](util[_0xf2c3('0x8')]('[%s][calls][hangup]',_0x383378[_0xf2c3('0x6')]),_0x1b3c8c);}};exports[_0xf2c3('0x34')]=function(_0x387e6e){try{if(!_[_0xf2c3('0x23')](channels[_0x387e6e[_0xf2c3('0x35')]])){utils[_0xf2c3('0x15')](util['format'](_0xf2c3('0x36'),_0x387e6e[_0xf2c3('0x37')]),_0x387e6e);if(channels[_0x387e6e[_0xf2c3('0x35')]][_0xf2c3('0x9')]==_0x387e6e[_0xf2c3('0x38')]){utils[_0xf2c3('0x19')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x387e6e[_0xf2c3('0x37')],_0x387e6e['localtwolinkedid'],_0x387e6e[_0xf2c3('0x39')]));channels[_0x387e6e[_0xf2c3('0x35')]][_0xf2c3('0x3a')]=_0x387e6e[_0xf2c3('0x39')];channels[_0x387e6e['localtwolinkedid']]['userfield']=_0xf2c3('0x3b');}else if(channels[_0x387e6e[_0xf2c3('0x35')]][_0xf2c3('0x9')]=_0x387e6e[_0xf2c3('0x3c')]){utils[_0xf2c3('0x19')](util[_0xf2c3('0x8')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x387e6e[_0xf2c3('0x37')],_0x387e6e[_0xf2c3('0x35')],_0x387e6e[_0xf2c3('0x3d')]));channels[_0x387e6e[_0xf2c3('0x35')]]['destinationchannel']=_0x387e6e[_0xf2c3('0x3d')];channels[_0x387e6e[_0xf2c3('0x35')]][_0xf2c3('0x3e')]='_attended';}}}catch(_0x5b72aa){utils['error'](util[_0xf2c3('0x8')](_0xf2c3('0x36'),_0x387e6e[_0xf2c3('0x37')]),_0x5b72aa);}};exports[_0xf2c3('0x3f')]=function(_0x2ed0b9){try{if(!_[_0xf2c3('0x23')](channels[_0x2ed0b9[_0xf2c3('0x6')]])){utils['debug'](util[_0xf2c3('0x8')](_0xf2c3('0x40'),_0x2ed0b9['uniqueid']),_0x2ed0b9);channels[_0x2ed0b9[_0xf2c3('0x6')]][_0xf2c3('0x41')]=utils[_0xf2c3('0x1d')]();utils[_0xf2c3('0x19')](util[_0xf2c3('0x8')](_0xf2c3('0x42'),_0x2ed0b9[_0xf2c3('0x6')],channels[_0x2ed0b9[_0xf2c3('0x6')]][_0xf2c3('0x41')]));}}catch(_0xa2f1c3){utils[_0xf2c3('0x1f')](util['format'](_0xf2c3('0x40'),_0x2ed0b9['uniqueid']),_0xa2f1c3);}};exports[_0xf2c3('0x43')]=function(_0x4aafbd){try{if(!_[_0xf2c3('0x23')](channels[_0x4aafbd[_0xf2c3('0x6')]])){utils['debug'](util[_0xf2c3('0x8')](_0xf2c3('0x44'),_0x4aafbd[_0xf2c3('0x6')]),_0x4aafbd);if(!_[_0xf2c3('0x23')](channels[_0x4aafbd['uniqueid']][_0xf2c3('0x41')])){channels[_0x4aafbd[_0xf2c3('0x6')]]['mohtime']+=utils[_0xf2c3('0x31')](utils[_0xf2c3('0x1d')](),channels[_0x4aafbd[_0xf2c3('0x6')]][_0xf2c3('0x41')]);utils[_0xf2c3('0x19')](util[_0xf2c3('0x8')](_0xf2c3('0x45'),_0x4aafbd[_0xf2c3('0x6')],channels[_0x4aafbd[_0xf2c3('0x6')]][_0xf2c3('0x46')]));delete channels[_0x4aafbd[_0xf2c3('0x6')]][_0xf2c3('0x41')];}}}catch(_0xc7ac9){utils[_0xf2c3('0x1f')](util[_0xf2c3('0x8')](_0xf2c3('0x44'),_0x4aafbd[_0xf2c3('0x6')]),_0xc7ac9);}};exports['varset']=function(_0x50a8b5){try{if(!_[_0xf2c3('0x23')](channels[_0x50a8b5['uniqueid']])){utils[_0xf2c3('0x15')](util[_0xf2c3('0x8')]('[%s][calls][varset]',_0x50a8b5['uniqueid']),_0x50a8b5);if(!_[_0xf2c3('0x23')](_0x50a8b5[_0xf2c3('0x47')]['xmd-originatecalleridnum'])){utils[_0xf2c3('0x19')](util[_0xf2c3('0x8')](_0xf2c3('0x48'),_0x50a8b5[_0xf2c3('0x6')],_0x50a8b5[_0xf2c3('0x49')]));channels[_0x50a8b5[_0xf2c3('0x6')]]['source']=_0x50a8b5[_0xf2c3('0x49')];}if(!_['isNil'](_0x50a8b5[_0xf2c3('0x47')][_0xf2c3('0x4a')])){utils[_0xf2c3('0x19')](util[_0xf2c3('0x8')](_0xf2c3('0x4b'),_0x50a8b5[_0xf2c3('0x6')],_0x50a8b5[_0xf2c3('0x49')]));channels[_0x50a8b5[_0xf2c3('0x6')]][_0xf2c3('0x4c')]=_0x50a8b5[_0xf2c3('0x49')];channels[_0x50a8b5[_0xf2c3('0x6')]][_0xf2c3('0x2d')]='\x22'+_0x50a8b5['value']+_0xf2c3('0x4d')+_0x50a8b5[_0xf2c3('0x49')]+'>';}if(!_[_0xf2c3('0x23')](_0x50a8b5[_0xf2c3('0x47')][_0xf2c3('0x4e')])||!_[_0xf2c3('0x23')](_0x50a8b5['variable'][_0xf2c3('0x4f')])){utils['info'](util[_0xf2c3('0x8')](_0xf2c3('0x50'),_0x50a8b5[_0xf2c3('0x6')],!_['isNil'](_0x50a8b5[_0xf2c3('0x47')][_0xf2c3('0x4e')])?_0xf2c3('0x4e'):_0xf2c3('0x4f'),_0x50a8b5[_0xf2c3('0x49')]));channels[_0x50a8b5[_0xf2c3('0x6')]][_0xf2c3('0x2d')]=_0x50a8b5[_0xf2c3('0x49')];}if(!_[_0xf2c3('0x23')](_0x50a8b5[_0xf2c3('0x47')][_0xf2c3('0x51')])||!_[_0xf2c3('0x23')](_0x50a8b5['variable'][_0xf2c3('0x52')])){utils['info'](util[_0xf2c3('0x8')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x50a8b5[_0xf2c3('0x6')],!_['isNil'](_0x50a8b5['variable'][_0xf2c3('0x51')])?'xmd-queue':_0xf2c3('0x52'),_0x50a8b5[_0xf2c3('0x49')]));channels[_0x50a8b5[_0xf2c3('0x6')]]['lastapplication']='Queue';channels[_0x50a8b5[_0xf2c3('0x6')]][_0xf2c3('0x53')]=_0x50a8b5[_0xf2c3('0x49')];channels[_0x50a8b5[_0xf2c3('0x6')]][_0xf2c3('0x54')]=!![];}if(!_[_0xf2c3('0x23')](_0x50a8b5[_0xf2c3('0x47')][_0xf2c3('0x55')])){utils[_0xf2c3('0x19')](util[_0xf2c3('0x8')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x50a8b5[_0xf2c3('0x6')],_0x50a8b5[_0xf2c3('0x49')]));channels[_0x50a8b5[_0xf2c3('0x6')]]['ContactId']=_0x50a8b5[_0xf2c3('0x49')];}if(!_[_0xf2c3('0x23')](_0x50a8b5[_0xf2c3('0x47')][_0xf2c3('0x56')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x50a8b5['uniqueid'],_0x50a8b5[_0xf2c3('0x49')]));channels[_0x50a8b5[_0xf2c3('0x6')]][_0xf2c3('0x57')]=_0x50a8b5[_0xf2c3('0x49')];}if(!_['isNil'](_0x50a8b5[_0xf2c3('0x47')]['outboundrouteid'])){utils['info'](util[_0xf2c3('0x8')](_0xf2c3('0x58'),_0x50a8b5[_0xf2c3('0x6')],_0x50a8b5['value']));channels[_0x50a8b5[_0xf2c3('0x6')]][_0xf2c3('0x59')]=_0x50a8b5['value'];}if(!_[_0xf2c3('0x23')](_0x50a8b5['variable'][_0xf2c3('0x5a')])){utils[_0xf2c3('0x19')](util[_0xf2c3('0x8')](_0xf2c3('0x5b'),_0x50a8b5[_0xf2c3('0x6')],_0x50a8b5['value']));channels[_0x50a8b5[_0xf2c3('0x6')]][_0xf2c3('0x5a')]=_0x50a8b5[_0xf2c3('0x49')];}}}catch(_0xa1d084){utils[_0xf2c3('0x1f')](util['format'](_0xf2c3('0x5c'),_0x50a8b5[_0xf2c3('0x6')]),_0xa1d084);}};exports[_0xf2c3('0x5d')]=function(_0x2befb4){try{if(!_['isNil'](channels[_0x2befb4['uniqueid']])){utils[_0xf2c3('0x15')](util[_0xf2c3('0x8')](_0xf2c3('0x5e'),_0x2befb4[_0xf2c3('0x6')]),_0x2befb4);utils[_0xf2c3('0x19')](util[_0xf2c3('0x8')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x2befb4[_0xf2c3('0x6')],_0x2befb4['application'],_0x2befb4[_0xf2c3('0x5f')]));if(_0x2befb4[_0xf2c3('0x60')]['toLowerCase']()==_0xf2c3('0x61')&&_[_0xf2c3('0x62')](_0x2befb4[_0xf2c3('0x5f')]['toLowerCase'](),'cdr')){var _0x23630f=_0x2befb4[_0xf2c3('0x5f')]['split']('=');var _0x516f09=_0x23630f[0x0][_0xf2c3('0x63')](_0x23630f[0x0]['lastIndexOf']('(')+0x1,_0x23630f[0x0][_0xf2c3('0x64')](')'));var _0x3531e5=_0x23630f[0x1];channels[_0x2befb4[_0xf2c3('0x6')]][_0x516f09]=_0x3531e5;}if(!_['includes']([_0xf2c3('0x2b'),'noop',_0xf2c3('0x65'),'set',_0xf2c3('0x66')],_0x2befb4[_0xf2c3('0x60')]['toLowerCase']())){channels[_0x2befb4[_0xf2c3('0x6')]][_0xf2c3('0x67')]=_0x2befb4[_0xf2c3('0x60')];channels[_0x2befb4[_0xf2c3('0x6')]][_0xf2c3('0x53')]=_0x2befb4[_0xf2c3('0x5f')];}}}catch(_0x22205a){utils[_0xf2c3('0x1f')](util[_0xf2c3('0x8')](_0xf2c3('0x5e'),_0x2befb4[_0xf2c3('0x6')]),_0x22205a);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 70a9207..6055d7c 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 _0x0f0c=['error','[core]\x20error','close','[core]\x20close','managerevent','./utils','info','[core]\x20connected','shutdown','[core]\x20fullybooted'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x0f0c,0xaf));var _0xc0f0=function(_0x598b5d,_0x3f4d1e){_0x598b5d=_0x598b5d-0x0;var _0x54ab06=_0x0f0c[_0x598b5d];return _0x54ab06;};'use strict';var utils=require(_0xc0f0('0x0'));exports['connect']=function(){utils[_0xc0f0('0x1')](_0xc0f0('0x2'));};exports[_0xc0f0('0x3')]=function(){utils[_0xc0f0('0x1')]('[core]\x20shutdown');};exports['fullybooted']=function(){utils[_0xc0f0('0x1')](_0xc0f0('0x4'));};exports[_0xc0f0('0x5')]=function(_0x52492f){utils[_0xc0f0('0x5')](_0xc0f0('0x6'),_0x52492f);};exports[_0xc0f0('0x7')]=function(){utils[_0xc0f0('0x1')](_0xc0f0('0x8'));};exports[_0xc0f0('0x9')]=function(_0x171e98){}; \ No newline at end of file +var _0xa5a6=['close','[core]\x20close','managerevent','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0xa5a6,0x177));var _0x6a5a=function(_0x14ef3e,_0x508efb){_0x14ef3e=_0x14ef3e-0x0;var _0x3b4b08=_0xa5a6[_0x14ef3e];return _0x3b4b08;};'use strict';var utils=require('./utils');exports[_0x6a5a('0x0')]=function(){utils[_0x6a5a('0x1')](_0x6a5a('0x2'));};exports[_0x6a5a('0x3')]=function(){utils[_0x6a5a('0x1')](_0x6a5a('0x4'));};exports[_0x6a5a('0x5')]=function(){utils[_0x6a5a('0x1')](_0x6a5a('0x6'));};exports[_0x6a5a('0x7')]=function(_0x416ab3){utils[_0x6a5a('0x7')](_0x6a5a('0x8'),_0x416ab3);};exports[_0x6a5a('0x9')]=function(){utils[_0x6a5a('0x1')](_0x6a5a('0xa'));};exports[_0x6a5a('0xb')]=function(_0xefcac2){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index d9d494c..59747a0 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 _0x38e4=['error','varset','isNil','variable','outboundrouteid','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','calleridnum','calleridname','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','startsWith','appdata','toLowerCase','split'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x38e4,0xb7));var _0x438e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x38e4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x438e('0x0'));var util=require(_0x438e('0x1'));var utils=require(_0x438e('0x2'));var dials={};function writeDB(_0xa80b5){utils[_0x438e('0x3')](util[_0x438e('0x4')](_0x438e('0x5'),_0xa80b5['uniqueid'],_0xa80b5[_0x438e('0x6')],_0xa80b5[_0x438e('0x7')],_0xa80b5['calleridnum'],_0xa80b5[_0x438e('0x8')],_0xa80b5[_0x438e('0x9')]));utils[_0x438e('0xa')](_0x438e('0xb'),_0xa80b5);delete dials[_0xa80b5[_0x438e('0xc')]];}exports['newexten']=function(_0x3e07ed){try{utils[_0x438e('0xd')](util['format'](_0x438e('0xe'),_0x3e07ed[_0x438e('0xc')]),_0x3e07ed);utils[_0x438e('0x3')](util[_0x438e('0x4')](_0x438e('0xf'),_0x3e07ed[_0x438e('0xc')],_0x3e07ed[_0x438e('0x10')],_0x3e07ed['appdata']));if(_0x3e07ed[_0x438e('0x10')]['toLowerCase']()=='set'&&_[_0x438e('0x11')](_0x3e07ed[_0x438e('0x12')][_0x438e('0x13')](),'cdr(routeid)')){var _0x4ca056=_0x3e07ed[_0x438e('0x12')][_0x438e('0x14')]('=');dials[_0x3e07ed[_0x438e('0xc')]]={'routeId':_0x4ca056[0x1]};}}catch(_0xc653d6){utils[_0x438e('0x15')](util[_0x438e('0x4')](_0x438e('0xe'),_0x3e07ed[_0x438e('0xc')]),_0xc653d6);}};exports[_0x438e('0x16')]=function(_0x3dac4d){try{utils[_0x438e('0xd')](util[_0x438e('0x4')]('[%s][dials][varset]',_0x3dac4d[_0x438e('0xc')]),_0x3dac4d);if(!_[_0x438e('0x17')](_0x3dac4d[_0x438e('0x18')][_0x438e('0x19')])){utils[_0x438e('0x3')](util[_0x438e('0x4')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x3dac4d['uniqueid'],_0x3dac4d[_0x438e('0x1a')]));dials[_0x3dac4d[_0x438e('0xc')]]={'routeId':_0x3dac4d[_0x438e('0x1a')]};}}catch(_0x3e288c){utils[_0x438e('0x15')](util[_0x438e('0x4')](_0x438e('0x1b'),_0x3dac4d[_0x438e('0xc')]),_0x3e288c);}};exports[_0x438e('0x1c')]=function(_0x195c65){try{if(!_[_0x438e('0x17')](dials[_0x195c65[_0x438e('0xc')]])){utils[_0x438e('0xd')](util[_0x438e('0x4')](_0x438e('0x1d'),_0x195c65['uniqueid']),_0x195c65);dials[_0x195c65[_0x438e('0xc')]]=_[_0x438e('0x1e')](dials[_0x195c65[_0x438e('0xc')]],_0x195c65);dials[_0x195c65[_0x438e('0xc')]][_0x438e('0x1f')]=utils[_0x438e('0x20')]();dials[_0x195c65[_0x438e('0xc')]][_0x438e('0x21')]='called';utils[_0x438e('0x3')](util['format'](_0x438e('0x22'),_0x195c65[_0x438e('0xc')],dials[_0x195c65['uniqueid']]['starttime']));}}catch(_0x567337){utils[_0x438e('0x15')](util[_0x438e('0x4')]('[%s][dials][dialbegin]',_0x195c65[_0x438e('0xc')]),_0x567337);}};exports[_0x438e('0x23')]=function(_0x393088){try{if(!_[_0x438e('0x17')](dials[_0x393088[_0x438e('0xc')]])){utils[_0x438e('0xd')](util[_0x438e('0x4')](_0x438e('0x24'),_0x393088[_0x438e('0xc')]),_0x393088);dials[_0x393088['uniqueid']][_0x438e('0x9')]=_0x393088['dialstatus'];if(_0x393088['dialstatus']==_0x438e('0x25')){dials[_0x393088['uniqueid']]=_['assign'](dials[_0x393088[_0x438e('0xc')]],_0x393088);dials[_0x393088[_0x438e('0xc')]][_0x438e('0x26')]=utils[_0x438e('0x20')]();dials[_0x393088[_0x438e('0xc')]]['lastevent']=_0x438e('0x27');utils[_0x438e('0x3')](util[_0x438e('0x4')](_0x438e('0x28'),_0x393088['uniqueid'],_0x393088[_0x438e('0x9')],dials[_0x393088[_0x438e('0xc')]][_0x438e('0x26')]));}else{utils[_0x438e('0x3')](util['format'](_0x438e('0x29'),_0x393088[_0x438e('0xc')],_0x393088[_0x438e('0x9')]));}}}catch(_0x582a4a){utils[_0x438e('0x15')](util[_0x438e('0x4')](_0x438e('0x24'),_0x393088[_0x438e('0xc')]),_0x582a4a);}};exports['hangup']=function(_0x2664da){try{if(!_[_0x438e('0x17')](dials[_0x2664da[_0x438e('0xc')]])){utils['debug'](util['format'](_0x438e('0x2a'),_0x2664da[_0x438e('0xc')]),_0x2664da);utils[_0x438e('0x3')](util[_0x438e('0x4')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x2664da[_0x438e('0xc')],_0x2664da[_0x438e('0x2b')],_0x2664da[_0x438e('0x2c')],_0x2664da['cause-txt']));dials[_0x2664da[_0x438e('0xc')]]=_[_0x438e('0x1e')](dials[_0x2664da[_0x438e('0xc')]],{'endtime':utils[_0x438e('0x20')](),'lastevent':_0x438e('0x2d')});dials[_0x2664da[_0x438e('0xc')]][_0x438e('0x2e')]=utils[_0x438e('0x2f')](dials[_0x2664da[_0x438e('0xc')]][_0x438e('0x30')],dials[_0x2664da[_0x438e('0xc')]][_0x438e('0x1f')]);dials[_0x2664da['uniqueid']][_0x438e('0x31')]=utils[_0x438e('0x2f')](dials[_0x2664da[_0x438e('0xc')]][_0x438e('0x26')]||dials[_0x2664da[_0x438e('0xc')]][_0x438e('0x30')],dials[_0x2664da[_0x438e('0xc')]]['starttime']);dials[_0x2664da[_0x438e('0xc')]][_0x438e('0x32')]=dials[_0x2664da[_0x438e('0xc')]][_0x438e('0x26')]?utils['diffTime'](dials[_0x2664da['uniqueid']][_0x438e('0x30')],dials[_0x2664da[_0x438e('0xc')]][_0x438e('0x26')]):0x0;writeDB(dials[_0x2664da[_0x438e('0xc')]]);}}catch(_0x3bb36b){utils[_0x438e('0x15')](util[_0x438e('0x4')]('[%s][dials][hangup]',_0x2664da[_0x438e('0xc')]),_0x3bb36b);}}; \ No newline at end of file +var _0xe362=['ANSWER','assign','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','complete','duration','diffTime','endtime','holdtime','lodash','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','split','varset','debug','[%s][dials][varset]','outboundrouteid','value','error','dialbegin','isNil','[%s][dials][dialbegin]','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called'];(function(_0x4ad37c,_0x2e7490){var _0x288919=function(_0x3988a2){while(--_0x3988a2){_0x4ad37c['push'](_0x4ad37c['shift']());}};_0x288919(++_0x2e7490);}(_0xe362,0x1e3));var _0x2e36=function(_0x2991ea,_0x4a0231){_0x2991ea=_0x2991ea-0x0;var _0x4e1c51=_0xe362[_0x2991ea];return _0x4e1c51;};'use strict';var _=require(_0x2e36('0x0'));var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x3f7b85){utils[_0x2e36('0x1')](util[_0x2e36('0x2')](_0x2e36('0x3'),_0x3f7b85['uniqueid'],_0x3f7b85[_0x2e36('0x4')],_0x3f7b85['dialstring'],_0x3f7b85[_0x2e36('0x5')],_0x3f7b85[_0x2e36('0x6')],_0x3f7b85[_0x2e36('0x7')]));utils[_0x2e36('0x8')](_0x2e36('0x9'),_0x3f7b85);delete dials[_0x3f7b85[_0x2e36('0xa')]];}exports[_0x2e36('0xb')]=function(_0x5d9295){try{utils['debug'](util[_0x2e36('0x2')](_0x2e36('0xc'),_0x5d9295['uniqueid']),_0x5d9295);utils[_0x2e36('0x1')](util[_0x2e36('0x2')](_0x2e36('0xd'),_0x5d9295[_0x2e36('0xa')],_0x5d9295['application'],_0x5d9295['appdata']));if(_0x5d9295[_0x2e36('0xe')][_0x2e36('0xf')]()==_0x2e36('0x10')&&_[_0x2e36('0x11')](_0x5d9295['appdata'][_0x2e36('0xf')](),'cdr(routeid)')){var _0x45a424=_0x5d9295[_0x2e36('0x12')][_0x2e36('0x13')]('=');dials[_0x5d9295[_0x2e36('0xa')]]={'routeId':_0x45a424[0x1]};}}catch(_0x2ed5cf){utils['error'](util[_0x2e36('0x2')](_0x2e36('0xc'),_0x5d9295[_0x2e36('0xa')]),_0x2ed5cf);}};exports[_0x2e36('0x14')]=function(_0x34ea47){try{utils[_0x2e36('0x15')](util[_0x2e36('0x2')](_0x2e36('0x16'),_0x34ea47[_0x2e36('0xa')]),_0x34ea47);if(!_['isNil'](_0x34ea47['variable'][_0x2e36('0x17')])){utils[_0x2e36('0x1')](util[_0x2e36('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x34ea47[_0x2e36('0xa')],_0x34ea47[_0x2e36('0x18')]));dials[_0x34ea47[_0x2e36('0xa')]]={'routeId':_0x34ea47['value']};}}catch(_0x9eb257){utils[_0x2e36('0x19')](util['format'](_0x2e36('0x16'),_0x34ea47[_0x2e36('0xa')]),_0x9eb257);}};exports[_0x2e36('0x1a')]=function(_0x1e9021){try{if(!_[_0x2e36('0x1b')](dials[_0x1e9021[_0x2e36('0xa')]])){utils[_0x2e36('0x15')](util[_0x2e36('0x2')](_0x2e36('0x1c'),_0x1e9021[_0x2e36('0xa')]),_0x1e9021);dials[_0x1e9021['uniqueid']]=_['assign'](dials[_0x1e9021['uniqueid']],_0x1e9021);dials[_0x1e9021[_0x2e36('0xa')]][_0x2e36('0x1d')]=utils[_0x2e36('0x1e')]();dials[_0x1e9021[_0x2e36('0xa')]][_0x2e36('0x1f')]=_0x2e36('0x20');utils[_0x2e36('0x1')](util[_0x2e36('0x2')](_0x2e36('0x21'),_0x1e9021['uniqueid'],dials[_0x1e9021[_0x2e36('0xa')]][_0x2e36('0x1d')]));}}catch(_0x40ebd3){utils['error'](util[_0x2e36('0x2')](_0x2e36('0x1c'),_0x1e9021[_0x2e36('0xa')]),_0x40ebd3);}};exports['dialend']=function(_0x45e101){try{if(!_[_0x2e36('0x1b')](dials[_0x45e101[_0x2e36('0xa')]])){utils[_0x2e36('0x15')](util[_0x2e36('0x2')]('[%s][dials][dialend]',_0x45e101['uniqueid']),_0x45e101);dials[_0x45e101[_0x2e36('0xa')]][_0x2e36('0x7')]=_0x45e101[_0x2e36('0x7')];if(_0x45e101[_0x2e36('0x7')]==_0x2e36('0x22')){dials[_0x45e101[_0x2e36('0xa')]]=_[_0x2e36('0x23')](dials[_0x45e101[_0x2e36('0xa')]],_0x45e101);dials[_0x45e101['uniqueid']][_0x2e36('0x24')]=utils[_0x2e36('0x1e')]();dials[_0x45e101[_0x2e36('0xa')]]['lastevent']='connect';utils[_0x2e36('0x1')](util[_0x2e36('0x2')](_0x2e36('0x25'),_0x45e101[_0x2e36('0xa')],_0x45e101[_0x2e36('0x7')],dials[_0x45e101[_0x2e36('0xa')]]['answertime']));}else{utils[_0x2e36('0x1')](util[_0x2e36('0x2')](_0x2e36('0x26'),_0x45e101[_0x2e36('0xa')],_0x45e101[_0x2e36('0x7')]));}}}catch(_0x50585b){utils['error'](util['format'](_0x2e36('0x27'),_0x45e101[_0x2e36('0xa')]),_0x50585b);}};exports[_0x2e36('0x28')]=function(_0x51e690){try{if(!_[_0x2e36('0x1b')](dials[_0x51e690['uniqueid']])){utils[_0x2e36('0x15')](util['format'](_0x2e36('0x29'),_0x51e690['uniqueid']),_0x51e690);utils[_0x2e36('0x1')](util[_0x2e36('0x2')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x51e690[_0x2e36('0xa')],_0x51e690[_0x2e36('0x5')],_0x51e690['calleridname'],_0x51e690['cause-txt']));dials[_0x51e690[_0x2e36('0xa')]]=_['assign'](dials[_0x51e690['uniqueid']],{'endtime':utils[_0x2e36('0x1e')](),'lastevent':_0x2e36('0x2a')});dials[_0x51e690['uniqueid']][_0x2e36('0x2b')]=utils[_0x2e36('0x2c')](dials[_0x51e690['uniqueid']][_0x2e36('0x2d')],dials[_0x51e690[_0x2e36('0xa')]][_0x2e36('0x1d')]);dials[_0x51e690['uniqueid']][_0x2e36('0x2e')]=utils[_0x2e36('0x2c')](dials[_0x51e690[_0x2e36('0xa')]][_0x2e36('0x24')]||dials[_0x51e690['uniqueid']][_0x2e36('0x2d')],dials[_0x51e690[_0x2e36('0xa')]][_0x2e36('0x1d')]);dials[_0x51e690[_0x2e36('0xa')]]['billableseconds']=dials[_0x51e690[_0x2e36('0xa')]][_0x2e36('0x24')]?utils[_0x2e36('0x2c')](dials[_0x51e690[_0x2e36('0xa')]][_0x2e36('0x2d')],dials[_0x51e690[_0x2e36('0xa')]][_0x2e36('0x24')]):0x0;writeDB(dials[_0x51e690[_0x2e36('0xa')]]);}}catch(_0x51cf70){utils[_0x2e36('0x19')](util['format'](_0x2e36('0x29'),_0x51e690['uniqueid']),_0x51cf70);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 027a765..d1ef46a 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 _0xfd8f=['blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','./utils','asterisk','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','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]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xfd8f,0x1d5));var _0xffd8=function(_0xf47fcf,_0x2c5a1b){_0xf47fcf=_0xf47fcf-0x0;var _0x41c0e2=_0xfd8f[_0xf47fcf];return _0x41c0e2;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0xffd8('0x0'));var util=require('util');var ami=new AsteriskManager(config[_0xffd8('0x1')]['port'],config['asterisk']['ip'],config['asterisk']['username'],config[_0xffd8('0x1')][_0xffd8('0x2')],!![]);ami[_0xffd8('0x3')]();if(config[_0xffd8('0x4')]&&config['xdr'][_0xffd8('0x5')]){utils[_0xffd8('0x6')](_0xffd8('0x7'));}else{var agents=require(_0xffd8('0x8'));var calls=require(_0xffd8('0x9'));var queues=require(_0xffd8('0xa'));var recordings=require(_0xffd8('0xb'));var members=require(_0xffd8('0xc'));var dials=require(_0xffd8('0xd'));var transfers=require(_0xffd8('0xe'));var core=require(_0xffd8('0xf'));ami['on'](_0xffd8('0x10'),core[_0xffd8('0x10')]);ami['on'](_0xffd8('0x11'),core[_0xffd8('0x11')]);ami['on'](_0xffd8('0x12'),core[_0xffd8('0x12')]);ami['on']('error',core[_0xffd8('0x13')]);ami['on'](_0xffd8('0x14'),core[_0xffd8('0x14')]);ami['on'](_0xffd8('0x15'),core[_0xffd8('0x15')]);ami['on']('devicestatechange',function(_0x343947){try{utils[_0xffd8('0x16')](util[_0xffd8('0x17')](_0xffd8('0x18'),_0x343947[_0xffd8('0x19')]),_0x343947);members['devicestatechange'](_0x343947);}catch(_0x4b787f){utils[_0xffd8('0x13')](util[_0xffd8('0x17')](_0xffd8('0x18'),_0x343947['device']),_0x4b787f);}});ami['on'](_0xffd8('0x1a'),function(_0x1f5082){try{utils[_0xffd8('0x16')](util[_0xffd8('0x17')](_0xffd8('0x1b'),_0x1f5082[_0xffd8('0x1c')]),_0x1f5082);agents[_0xffd8('0x1a')](_0x1f5082);}catch(_0x84c821){utils['error'](util[_0xffd8('0x17')]('[%s][index][agentcalled]',_0x1f5082[_0xffd8('0x1c')]),_0x84c821);}});ami['on'](_0xffd8('0x1d'),function(_0xb9feba){try{utils[_0xffd8('0x16')](util[_0xffd8('0x17')](_0xffd8('0x1e'),_0xb9feba[_0xffd8('0x1c')]),_0xb9feba);agents[_0xffd8('0x1d')](_0xb9feba);}catch(_0xccffc7){utils['error'](util[_0xffd8('0x17')](_0xffd8('0x1e'),_0xb9feba[_0xffd8('0x1c')]),_0xccffc7);}});ami['on'](_0xffd8('0x1f'),function(_0x1d347a){try{utils['debug'](util[_0xffd8('0x17')](_0xffd8('0x20'),_0x1d347a[_0xffd8('0x1c')]),_0x1d347a);agents['agentconnect'](_0x1d347a);queues[_0xffd8('0x1f')](_0x1d347a);}catch(_0x1fc018){utils[_0xffd8('0x13')](util[_0xffd8('0x17')](_0xffd8('0x20'),_0x1d347a[_0xffd8('0x1c')]),_0x1fc018);}});ami['on'](_0xffd8('0x21'),function(_0x220575){try{utils[_0xffd8('0x16')](util[_0xffd8('0x17')](_0xffd8('0x22'),_0x220575['uniqueid']),_0x220575);agents[_0xffd8('0x21')](_0x220575);queues['agentcomplete'](_0x220575);members[_0xffd8('0x21')](_0x220575);}catch(_0x2a50c3){utils['error'](util[_0xffd8('0x17')](_0xffd8('0x22'),_0x220575['uniqueid']),_0x2a50c3);}});ami['on'](_0xffd8('0x23'),function(_0x3b8e62){try{utils[_0xffd8('0x16')](util[_0xffd8('0x17')]('[%s][index][queuecallerabandon]',_0x3b8e62['uniqueid']),_0x3b8e62);agents['queuecallerabandon'](_0x3b8e62);queues[_0xffd8('0x23')](_0x3b8e62);}catch(_0x3c3447){utils[_0xffd8('0x13')](util['format'](_0xffd8('0x24'),_0x3b8e62[_0xffd8('0x1c')]),_0x3c3447);}});ami['on'](_0xffd8('0x25'),function(_0x3630ff){try{utils[_0xffd8('0x16')](util[_0xffd8('0x17')](_0xffd8('0x26'),_0x3630ff[_0xffd8('0x1c')]),_0x3630ff);queues[_0xffd8('0x25')](_0x3630ff);recordings['queuecallerjoin'](_0x3630ff);}catch(_0x371682){utils[_0xffd8('0x13')](util[_0xffd8('0x17')](_0xffd8('0x26'),_0x3630ff['uniqueid']),_0x371682);}});ami['on']('queuecallerleave',function(_0x3013af){try{utils[_0xffd8('0x16')](util['format']('[%s][index][queuecallerleave]',_0x3013af['uniqueid']),_0x3013af);queues[_0xffd8('0x27')](_0x3013af);}catch(_0x32b247){utils['error'](util['format'](_0xffd8('0x28'),_0x3013af['uniqueid']),_0x32b247);}});ami['on'](_0xffd8('0x29'),function(_0x126c19){try{utils[_0xffd8('0x16')](util[_0xffd8('0x17')](_0xffd8('0x2a'),_0x126c19[_0xffd8('0x1c')]),_0x126c19);queues[_0xffd8('0x29')](_0x126c19);calls['musiconholdstart'](_0x126c19);}catch(_0x410b14){utils['error'](util['format'](_0xffd8('0x2a'),_0x126c19['uniqueid']),_0x410b14);}});ami['on'](_0xffd8('0x2b'),function(_0x26263f){try{utils[_0xffd8('0x16')](util['format']('[%s][index][musiconholdstop]',_0x26263f[_0xffd8('0x1c')]),_0x26263f);queues[_0xffd8('0x2b')](_0x26263f);calls[_0xffd8('0x2b')](_0x26263f);}catch(_0x3c0e8a){utils[_0xffd8('0x13')](util[_0xffd8('0x17')](_0xffd8('0x2c'),_0x26263f[_0xffd8('0x1c')]),_0x3c0e8a);}});ami['on'](_0xffd8('0x2d'),function(_0x148702){try{utils['debug'](util[_0xffd8('0x17')](_0xffd8('0x2e'),_0x148702[_0xffd8('0x1c')]),_0x148702);calls[_0xffd8('0x2d')](_0x148702);recordings['newstate'](_0x148702);}catch(_0x5e9ed3){utils[_0xffd8('0x13')](util[_0xffd8('0x17')]('[%s][index][newstate]',_0x148702['uniqueid']),_0x5e9ed3);}});ami['on']('hangup',function(_0x1fa801){try{utils[_0xffd8('0x16')](util['format'](_0xffd8('0x2f'),_0x1fa801[_0xffd8('0x1c')]),_0x1fa801);calls[_0xffd8('0x30')](_0x1fa801);recordings[_0xffd8('0x30')](_0x1fa801);dials[_0xffd8('0x30')](_0x1fa801);agents['hangup'](_0x1fa801);queues[_0xffd8('0x30')](_0x1fa801);}catch(_0x58a8c1){utils['error'](util[_0xffd8('0x17')](_0xffd8('0x2f'),_0x1fa801[_0xffd8('0x1c')]),_0x58a8c1);}});ami['on'](_0xffd8('0x31'),function(_0xda1776){try{utils[_0xffd8('0x16')](util[_0xffd8('0x17')](_0xffd8('0x32'),_0xda1776[_0xffd8('0x1c')]),_0xda1776);members[_0xffd8('0x31')](_0xda1776);}catch(_0x4db6dd){utils[_0xffd8('0x13')](util[_0xffd8('0x17')](_0xffd8('0x32'),_0xda1776[_0xffd8('0x1c')]),_0x4db6dd);}});ami['on'](_0xffd8('0x33'),function(_0x524b27){try{utils[_0xffd8('0x16')](util[_0xffd8('0x17')](_0xffd8('0x34'),_0x524b27[_0xffd8('0x1c')]),_0x524b27);queues['blindtransfer'](_0x524b27);agents[_0xffd8('0x33')](_0x524b27);transfers[_0xffd8('0x33')](_0x524b27);}catch(_0x14a81e){utils[_0xffd8('0x13')](util['format']('[%s][index][blindtransfer]',_0x524b27[_0xffd8('0x1c')]),_0x14a81e);}});ami['on'](_0xffd8('0x35'),function(_0x2fdc68){try{utils['debug'](util['format'](_0xffd8('0x36'),_0x2fdc68[_0xffd8('0x37')]),_0x2fdc68);queues[_0xffd8('0x35')](_0x2fdc68);transfers[_0xffd8('0x35')](_0x2fdc68);agents[_0xffd8('0x35')](_0x2fdc68);calls['attendedtransfer'](_0x2fdc68);}catch(_0x303505){utils[_0xffd8('0x13')](util[_0xffd8('0x17')](_0xffd8('0x36'),_0x2fdc68['origtransfereruniqueid']),_0x303505);}});ami['on'](_0xffd8('0x38'),function(_0xf6222f){try{utils[_0xffd8('0x16')](util[_0xffd8('0x17')](_0xffd8('0x39'),_0xf6222f[_0xffd8('0x1c')]),_0xf6222f);queues[_0xffd8('0x38')](_0xf6222f);recordings[_0xffd8('0x38')](_0xf6222f);calls[_0xffd8('0x38')](_0xf6222f);dials['varset'](_0xf6222f);}catch(_0x2d6ebc){utils[_0xffd8('0x13')](util[_0xffd8('0x17')](_0xffd8('0x39'),_0xf6222f[_0xffd8('0x1c')]),_0x2d6ebc);}});ami['on'](_0xffd8('0x3a'),function(_0x2a9e9a){try{utils[_0xffd8('0x16')](util[_0xffd8('0x17')](_0xffd8('0x3b'),_0x2a9e9a[_0xffd8('0x1c')]),_0x2a9e9a);calls['newexten'](_0x2a9e9a);recordings[_0xffd8('0x3a')](_0x2a9e9a);dials[_0xffd8('0x3a')](_0x2a9e9a);}catch(_0x3e2d02){utils[_0xffd8('0x13')](util[_0xffd8('0x17')]('[%s][index][newexten]',_0x2a9e9a[_0xffd8('0x1c')]),_0x3e2d02);}});ami['on'](_0xffd8('0x3c'),function(_0x3fe5c6){try{utils['debug'](util[_0xffd8('0x17')](_0xffd8('0x3d'),_0x3fe5c6['uniqueid']),_0x3fe5c6);calls['newchannel'](_0x3fe5c6);recordings[_0xffd8('0x3c')](_0x3fe5c6);}catch(_0x31719d){utils[_0xffd8('0x13')](util[_0xffd8('0x17')](_0xffd8('0x3d'),_0x3fe5c6['uniqueid']),_0x31719d);}});ami['on'](_0xffd8('0x3e'),function(_0x4c41f4){try{utils[_0xffd8('0x16')](util[_0xffd8('0x17')](_0xffd8('0x3f'),_0x4c41f4[_0xffd8('0x1c')]),_0x4c41f4);dials[_0xffd8('0x3e')](_0x4c41f4);}catch(_0x5cc465){utils[_0xffd8('0x13')](util[_0xffd8('0x17')]('[%s]dialbegin',_0x4c41f4[_0xffd8('0x1c')]),_0x5cc465);}});ami['on'](_0xffd8('0x40'),function(_0x3a90bc){try{utils['debug'](util[_0xffd8('0x17')]('[%s][index][dialend]',_0x3a90bc['uniqueid']),_0x3a90bc);dials[_0xffd8('0x40')](_0x3a90bc);}catch(_0x2afe5f){utils[_0xffd8('0x13')](util[_0xffd8('0x17')]('[%s][index][dialend]',_0x3a90bc[_0xffd8('0x1c')]),_0x2afe5f);}});} \ No newline at end of file +var _0x833d=['[%s][index][agentcalled]','uniqueid','agentcalled','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]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s][index][dialend]','dialend','asterisk-manager','util','asterisk','username','password','keepConnected','xdr','info','./calls.controller','./queues.controller','./recordings.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device'];(function(_0x188f0c,_0x59554f){var _0x4d9ffc=function(_0x9e1aee){while(--_0x9e1aee){_0x188f0c['push'](_0x188f0c['shift']());}};_0x4d9ffc(++_0x59554f);}(_0x833d,0xa6));var _0xd833=function(_0xb3646e,_0x3faffe){_0xb3646e=_0xb3646e-0x0;var _0x16f68e=_0x833d[_0xb3646e];return _0x16f68e;};var AsteriskManager=require(_0xd833('0x0'));var config=require('../../config/environment');var utils=require('./utils');var util=require(_0xd833('0x1'));var ami=new AsteriskManager(config[_0xd833('0x2')]['port'],config['asterisk']['ip'],config[_0xd833('0x2')][_0xd833('0x3')],config[_0xd833('0x2')][_0xd833('0x4')],!![]);ami[_0xd833('0x5')]();if(config[_0xd833('0x6')]&&config[_0xd833('0x6')]['disabled']){utils[_0xd833('0x7')]('XDR\x20DISABLED');}else{var agents=require('./agents.controller');var calls=require(_0xd833('0x8'));var queues=require(_0xd833('0x9'));var recordings=require(_0xd833('0xa'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0xd833('0xb'));var core=require('./core.controller');ami['on'](_0xd833('0xc'),core[_0xd833('0xc')]);ami['on'](_0xd833('0xd'),core[_0xd833('0xd')]);ami['on'](_0xd833('0xe'),core[_0xd833('0xe')]);ami['on']('error',core[_0xd833('0xf')]);ami['on']('close',core[_0xd833('0x10')]);ami['on'](_0xd833('0x11'),core[_0xd833('0x11')]);ami['on'](_0xd833('0x12'),function(_0x3c4268){try{utils[_0xd833('0x13')](util[_0xd833('0x14')](_0xd833('0x15'),_0x3c4268['device']),_0x3c4268);members['devicestatechange'](_0x3c4268);}catch(_0x145ae9){utils[_0xd833('0xf')](util['format'](_0xd833('0x15'),_0x3c4268[_0xd833('0x16')]),_0x145ae9);}});ami['on']('agentcalled',function(_0x30a3d2){try{utils[_0xd833('0x13')](util[_0xd833('0x14')](_0xd833('0x17'),_0x30a3d2[_0xd833('0x18')]),_0x30a3d2);agents[_0xd833('0x19')](_0x30a3d2);}catch(_0x42a6f7){utils[_0xd833('0xf')](util[_0xd833('0x14')](_0xd833('0x17'),_0x30a3d2[_0xd833('0x18')]),_0x42a6f7);}});ami['on'](_0xd833('0x1a'),function(_0x4d3cc8){try{utils['debug'](util[_0xd833('0x14')](_0xd833('0x1b'),_0x4d3cc8[_0xd833('0x18')]),_0x4d3cc8);agents[_0xd833('0x1a')](_0x4d3cc8);}catch(_0x20e8ee){utils['error'](util[_0xd833('0x14')](_0xd833('0x1b'),_0x4d3cc8['uniqueid']),_0x20e8ee);}});ami['on'](_0xd833('0x1c'),function(_0x148195){try{utils[_0xd833('0x13')](util['format'](_0xd833('0x1d'),_0x148195[_0xd833('0x18')]),_0x148195);agents[_0xd833('0x1c')](_0x148195);queues[_0xd833('0x1c')](_0x148195);}catch(_0x5c9910){utils[_0xd833('0xf')](util[_0xd833('0x14')](_0xd833('0x1d'),_0x148195[_0xd833('0x18')]),_0x5c9910);}});ami['on'](_0xd833('0x1e'),function(_0x6684ad){try{utils[_0xd833('0x13')](util[_0xd833('0x14')]('[%s][index][agentcomplete]',_0x6684ad[_0xd833('0x18')]),_0x6684ad);agents['agentcomplete'](_0x6684ad);queues['agentcomplete'](_0x6684ad);members[_0xd833('0x1e')](_0x6684ad);}catch(_0x200048){utils['error'](util['format'](_0xd833('0x1f'),_0x6684ad[_0xd833('0x18')]),_0x200048);}});ami['on'](_0xd833('0x20'),function(_0x231d96){try{utils[_0xd833('0x13')](util[_0xd833('0x14')](_0xd833('0x21'),_0x231d96[_0xd833('0x18')]),_0x231d96);agents[_0xd833('0x20')](_0x231d96);queues[_0xd833('0x20')](_0x231d96);}catch(_0x13f822){utils[_0xd833('0xf')](util[_0xd833('0x14')](_0xd833('0x21'),_0x231d96['uniqueid']),_0x13f822);}});ami['on'](_0xd833('0x22'),function(_0x523ee3){try{utils[_0xd833('0x13')](util[_0xd833('0x14')]('[%s][index][queuecallerjoin]',_0x523ee3[_0xd833('0x18')]),_0x523ee3);queues['queuecallerjoin'](_0x523ee3);recordings['queuecallerjoin'](_0x523ee3);}catch(_0x57ea98){utils['error'](util[_0xd833('0x14')](_0xd833('0x23'),_0x523ee3[_0xd833('0x18')]),_0x57ea98);}});ami['on'](_0xd833('0x24'),function(_0x346936){try{utils['debug'](util[_0xd833('0x14')](_0xd833('0x25'),_0x346936['uniqueid']),_0x346936);queues[_0xd833('0x24')](_0x346936);}catch(_0x3fb943){utils[_0xd833('0xf')](util['format']('[%s][index][queuecallerleave]',_0x346936[_0xd833('0x18')]),_0x3fb943);}});ami['on'](_0xd833('0x26'),function(_0x3ad542){try{utils['debug'](util[_0xd833('0x14')](_0xd833('0x27'),_0x3ad542[_0xd833('0x18')]),_0x3ad542);queues[_0xd833('0x26')](_0x3ad542);calls[_0xd833('0x26')](_0x3ad542);}catch(_0x522389){utils[_0xd833('0xf')](util[_0xd833('0x14')]('[%s][index][musiconholdstart]',_0x3ad542['uniqueid']),_0x522389);}});ami['on'](_0xd833('0x28'),function(_0x71e65a){try{utils[_0xd833('0x13')](util[_0xd833('0x14')](_0xd833('0x29'),_0x71e65a[_0xd833('0x18')]),_0x71e65a);queues['musiconholdstop'](_0x71e65a);calls['musiconholdstop'](_0x71e65a);}catch(_0x256333){utils['error'](util[_0xd833('0x14')](_0xd833('0x29'),_0x71e65a['uniqueid']),_0x256333);}});ami['on'](_0xd833('0x2a'),function(_0x336938){try{utils[_0xd833('0x13')](util[_0xd833('0x14')](_0xd833('0x2b'),_0x336938['uniqueid']),_0x336938);calls['newstate'](_0x336938);recordings[_0xd833('0x2a')](_0x336938);}catch(_0x364b42){utils[_0xd833('0xf')](util[_0xd833('0x14')](_0xd833('0x2b'),_0x336938['uniqueid']),_0x364b42);}});ami['on'](_0xd833('0x2c'),function(_0x337104){try{utils[_0xd833('0x13')](util[_0xd833('0x14')](_0xd833('0x2d'),_0x337104[_0xd833('0x18')]),_0x337104);calls[_0xd833('0x2c')](_0x337104);recordings[_0xd833('0x2c')](_0x337104);dials[_0xd833('0x2c')](_0x337104);agents['hangup'](_0x337104);queues[_0xd833('0x2c')](_0x337104);}catch(_0x148930){utils[_0xd833('0xf')](util[_0xd833('0x14')]('[%s][index][hangup]',_0x337104[_0xd833('0x18')]),_0x148930);}});ami['on'](_0xd833('0x2e'),function(_0x40944d){try{utils['debug'](util[_0xd833('0x14')](_0xd833('0x2f'),_0x40944d[_0xd833('0x18')]),_0x40944d);members[_0xd833('0x2e')](_0x40944d);}catch(_0x4565d9){utils[_0xd833('0xf')](util['format']('[%s][index][cdr]',_0x40944d[_0xd833('0x18')]),_0x4565d9);}});ami['on'](_0xd833('0x30'),function(_0x5a70b1){try{utils['debug'](util[_0xd833('0x14')](_0xd833('0x31'),_0x5a70b1[_0xd833('0x18')]),_0x5a70b1);queues[_0xd833('0x30')](_0x5a70b1);agents[_0xd833('0x30')](_0x5a70b1);transfers[_0xd833('0x30')](_0x5a70b1);}catch(_0x26a76c){utils['error'](util['format'](_0xd833('0x31'),_0x5a70b1[_0xd833('0x18')]),_0x26a76c);}});ami['on'](_0xd833('0x32'),function(_0x43f5b2){try{utils[_0xd833('0x13')](util[_0xd833('0x14')](_0xd833('0x33'),_0x43f5b2[_0xd833('0x34')]),_0x43f5b2);queues[_0xd833('0x32')](_0x43f5b2);transfers[_0xd833('0x32')](_0x43f5b2);agents[_0xd833('0x32')](_0x43f5b2);calls[_0xd833('0x32')](_0x43f5b2);}catch(_0x19154a){utils['error'](util[_0xd833('0x14')](_0xd833('0x33'),_0x43f5b2['origtransfereruniqueid']),_0x19154a);}});ami['on'](_0xd833('0x35'),function(_0xdc94e2){try{utils[_0xd833('0x13')](util['format'](_0xd833('0x36'),_0xdc94e2[_0xd833('0x18')]),_0xdc94e2);queues[_0xd833('0x35')](_0xdc94e2);recordings[_0xd833('0x35')](_0xdc94e2);calls[_0xd833('0x35')](_0xdc94e2);dials[_0xd833('0x35')](_0xdc94e2);}catch(_0x44ac01){utils[_0xd833('0xf')](util[_0xd833('0x14')](_0xd833('0x36'),_0xdc94e2['uniqueid']),_0x44ac01);}});ami['on'](_0xd833('0x37'),function(_0x381106){try{utils[_0xd833('0x13')](util['format'](_0xd833('0x38'),_0x381106['uniqueid']),_0x381106);calls['newexten'](_0x381106);recordings[_0xd833('0x37')](_0x381106);dials[_0xd833('0x37')](_0x381106);}catch(_0x18fe0b){utils['error'](util[_0xd833('0x14')](_0xd833('0x38'),_0x381106[_0xd833('0x18')]),_0x18fe0b);}});ami['on'](_0xd833('0x39'),function(_0x3adb62){try{utils[_0xd833('0x13')](util[_0xd833('0x14')](_0xd833('0x3a'),_0x3adb62[_0xd833('0x18')]),_0x3adb62);calls[_0xd833('0x39')](_0x3adb62);recordings['newchannel'](_0x3adb62);}catch(_0x1b65a8){utils[_0xd833('0xf')](util[_0xd833('0x14')]('[%s][index][newchannel]',_0x3adb62['uniqueid']),_0x1b65a8);}});ami['on'](_0xd833('0x3b'),function(_0x4ea9ff){try{utils[_0xd833('0x13')](util[_0xd833('0x14')](_0xd833('0x3c'),_0x4ea9ff['uniqueid']),_0x4ea9ff);dials[_0xd833('0x3b')](_0x4ea9ff);}catch(_0x307375){utils['error'](util[_0xd833('0x14')]('[%s]dialbegin',_0x4ea9ff[_0xd833('0x18')]),_0x307375);}});ami['on']('dialend',function(_0x131af8){try{utils[_0xd833('0x13')](util['format'](_0xd833('0x3d'),_0x131af8[_0xd833('0x18')]),_0x131af8);dials[_0xd833('0x3e')](_0x131af8);}catch(_0x3573d4){utils['error'](util[_0xd833('0x14')]('[%s][index][dialend]',_0x131af8[_0xd833('0x18')]),_0x3573d4);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index fdceaf6..762946d 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 _0x065d=['error','[%s][members][writeDB]','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','agent','isNil','exitAt','now','enterAt','agentcomplete','debug','queue','[%s][members][agentcomplete]','[%s][members][cdr]','assign','data1','source','data3','destination','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Local/_attended@transfer','format','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x065d,0x1b7));var _0xd065=function(_0x5f154c,_0x4d15b7){_0x5f154c=_0x5f154c-0x0;var _0x1ee236=_0x065d[_0x5f154c];return _0x1ee236;};'use strict';var _=require(_0xd065('0x0'));var util=require(_0xd065('0x1'));var utils=require(_0xd065('0x2'));var members={};var exclude=[_0xd065('0x3'),'Queue:'];function writeDB(_0x3a8a13){utils['info'](util[_0xd065('0x4')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x3a8a13[_0xd065('0x5')],_0x3a8a13[_0xd065('0x6')],_0x3a8a13[_0xd065('0x7')],_0x3a8a13[_0xd065('0x8')],_0x3a8a13[_0xd065('0x9')],_0x3a8a13[_0xd065('0xa')]));if(_0x3a8a13['interface']){utils[_0xd065('0xb')](_0x3a8a13[_0xd065('0x6')])[_0xd065('0xc')](function(_0x504a2f){if(_0x504a2f){_0x3a8a13[_0xd065('0x9')]=_0x504a2f[_0xd065('0xd')];_0x3a8a13[_0xd065('0xe')]=_0x504a2f[_0xd065('0xe')];utils[_0xd065('0xf')](_0xd065('0x10'),_0x3a8a13);}else{utils[_0xd065('0x11')](_0x3a8a13[_0xd065('0x6')][_0xd065('0x12')]('/')[0x1])[_0xd065('0xc')](function(_0x27e117){if(_0x27e117){_0x3a8a13[_0xd065('0x9')]=_0x27e117['name'];_0x3a8a13[_0xd065('0xe')]=_0x27e117['internal'];utils[_0xd065('0xf')](_0xd065('0x10'),_0x3a8a13);}});}})[_0xd065('0x13')](function(_0x19aa5f){utils[_0xd065('0x14')](util[_0xd065('0x4')](_0xd065('0x15'),_0x3a8a13[_0xd065('0x5')]),_0x19aa5f);});}delete members[_0x3a8a13[_0xd065('0x6')]];}function startsWith(_0x30b47c,_0x38793e){return _[_0xd065('0x16')](_0x30b47c,function(_0x37c4ac){return _[_0xd065('0x17')](_0x38793e,_0x37c4ac);});}exports[_0xd065('0x18')]=function(_0x27c4a8){try{utils['debug'](util[_0xd065('0x4')](_0xd065('0x19'),members[_0x27c4a8['device']]?members[_0x27c4a8[_0xd065('0x1a')]][_0xd065('0x5')]:_0x27c4a8[_0xd065('0x1a')]),_0x27c4a8);utils[_0xd065('0x1b')](util['format'](_0xd065('0x1c'),members[_0x27c4a8[_0xd065('0x1a')]]?members[_0x27c4a8[_0xd065('0x1a')]][_0xd065('0x5')]:_0x27c4a8[_0xd065('0x1a')],_0x27c4a8[_0xd065('0x1d')],_0x27c4a8[_0xd065('0x1a')]));switch(_0x27c4a8['state']){case _0xd065('0x1e'):case _0xd065('0x1f'):if(!startsWith(exclude,_0x27c4a8[_0xd065('0x1a')])){members[_0x27c4a8[_0xd065('0x1a')]]={'channel':_0xd065('0x20'),'interface':_0x27c4a8[_0xd065('0x1a')],'type':_0xd065('0x21'),'enterAt':utils['now'](),'role':_0xd065('0x22')};}break;case'NOT_INUSE':if(!_[_0xd065('0x23')](members[_0x27c4a8[_0xd065('0x1a')]])){members[_0x27c4a8[_0xd065('0x1a')]][_0xd065('0x24')]=utils[_0xd065('0x25')]();members[_0x27c4a8[_0xd065('0x1a')]]['duration']=utils['diffTime'](members[_0x27c4a8[_0xd065('0x1a')]]['exitAt'],members[_0x27c4a8['device']][_0xd065('0x26')]);if(members[_0x27c4a8[_0xd065('0x1a')]][_0xd065('0x5')]){writeDB(members[_0x27c4a8[_0xd065('0x1a')]]);}}break;default:break;}}catch(_0x5c6723){utils[_0xd065('0x14')](util[_0xd065('0x4')](_0xd065('0x19'),members[_0x27c4a8[_0xd065('0x1a')]]?members[_0x27c4a8[_0xd065('0x1a')]][_0xd065('0x5')]:_0x27c4a8[_0xd065('0x1a')]),_0x5c6723);}};exports[_0xd065('0x27')]=function(_0x447d1f){try{if(!_['isNil'](members[_0x447d1f[_0xd065('0x6')]])){utils[_0xd065('0x28')](util['format']('[%s][members][agentcomplete]',_0x447d1f[_0xd065('0x5')]),_0x447d1f);utils[_0xd065('0x1b')](util[_0xd065('0x4')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x447d1f[_0xd065('0x5')],_0x447d1f[_0xd065('0x6')],_0x447d1f[_0xd065('0x29')]));members[_0x447d1f[_0xd065('0x6')]]=_['assign'](members[_0x447d1f[_0xd065('0x6')]],{'data4':_0x447d1f[_0xd065('0x29')],'uniqueid':_0x447d1f['uniqueid']});}}catch(_0xa00ad9){utils[_0xd065('0x14')](util[_0xd065('0x4')](_0xd065('0x2a'),_0x447d1f[_0xd065('0x5')]),_0xa00ad9);}};exports['cdr']=function(_0xd4f2d4){try{utils[_0xd065('0x28')](util[_0xd065('0x4')](_0xd065('0x2b'),_0xd4f2d4[_0xd065('0x5')]),_0xd4f2d4);if(_0xd4f2d4[_0xd065('0x7')]){var _0x57db58=_0xd4f2d4[_0xd065('0x7')][_0xd065('0x12')]('-')[0x0];if(!_[_0xd065('0x23')](members[_0x57db58])){members[_0x57db58]=_[_0xd065('0x2c')](members[_0x57db58],{'data1':members[_0x57db58][_0xd065('0x2d')]||_0xd4f2d4[_0xd065('0xa')],'data2':members[_0x57db58][_0xd065('0x8')]||_0xd4f2d4[_0xd065('0x2e')],'data3':members[_0x57db58][_0xd065('0x2f')]||_0xd4f2d4[_0xd065('0x30')],'uniqueid':members[_0x57db58][_0xd065('0x5')]||_0xd4f2d4[_0xd065('0x5')]});utils[_0xd065('0x1b')](util[_0xd065('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xd4f2d4[_0xd065('0x5')],members[_0x57db58][_0xd065('0x2d')],members[_0x57db58]['data2'],members[_0x57db58]['data3']));if(members[_0x57db58][_0xd065('0x24')]){writeDB(members[_0x57db58]);}}}if(_0xd4f2d4[_0xd065('0x31')]){var _0x30cc27=_0xd4f2d4[_0xd065('0x31')][_0xd065('0x12')]('-')[0x0];if(!_[_0xd065('0x23')](members[_0x30cc27])){members[_0x30cc27]=_['assign'](members[_0x30cc27],{'data1':members[_0x30cc27][_0xd065('0x2d')]||_0xd4f2d4[_0xd065('0xa')],'data2':members[_0x30cc27][_0xd065('0x8')]||_0xd4f2d4[_0xd065('0x2e')],'data3':members[_0x30cc27][_0xd065('0x2f')]||_0xd4f2d4['destination'],'uniqueid':members[_0x30cc27][_0xd065('0x5')]||_0xd4f2d4[_0xd065('0x5')]});utils[_0xd065('0x1b')](util[_0xd065('0x4')](_0xd065('0x32'),_0xd4f2d4[_0xd065('0x5')],members[_0x30cc27][_0xd065('0x2d')],members[_0x30cc27][_0xd065('0x8')],members[_0x30cc27][_0xd065('0x2f')]));if(members[_0x30cc27][_0xd065('0x24')]){writeDB(members[_0x30cc27]);}}}}catch(_0x41b9b1){utils['error'](util[_0xd065('0x4')](_0xd065('0x2b'),_0xd4f2d4[_0xd065('0x5')]),_0x41b9b1);}}; \ No newline at end of file +var _0xc455=['isNil','duration','diffTime','exitAt','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','channel','data1','data2','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','Local/_attended@transfer','Queue:','uniqueid','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','interface','split','then','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','format','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','now','agent'];(function(_0x3d00db,_0x2d799f){var _0x4da409=function(_0x2cd37b){while(--_0x2cd37b){_0x3d00db['push'](_0x3d00db['shift']());}};_0x4da409(++_0x2d799f);}(_0xc455,0x1c1));var _0x5c45=function(_0x3e8471,_0x3b5f2e){_0x3e8471=_0x3e8471-0x0;var _0x277c9e=_0xc455[_0x3e8471];return _0x277c9e;};'use strict';var _=require(_0x5c45('0x0'));var util=require('util');var utils=require('./utils');var members={};var exclude=[_0x5c45('0x1'),_0x5c45('0x2')];function writeDB(_0x562628){utils['info'](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x562628[_0x5c45('0x3')],_0x562628['interface'],_0x562628['channel'],_0x562628['data2'],_0x562628[_0x5c45('0x4')],_0x562628[_0x5c45('0x5')]));if(_0x562628['interface']){utils[_0x5c45('0x6')](_0x562628['interface'])['then'](function(_0x1e4f19){if(_0x1e4f19){_0x562628[_0x5c45('0x4')]=_0x1e4f19[_0x5c45('0x7')];_0x562628['internal']=_0x1e4f19[_0x5c45('0x8')];utils[_0x5c45('0x9')](_0x5c45('0xa'),_0x562628);}else{utils[_0x5c45('0xb')](_0x562628[_0x5c45('0xc')][_0x5c45('0xd')]('/')[0x1])[_0x5c45('0xe')](function(_0x2d20e0){if(_0x2d20e0){_0x562628[_0x5c45('0x4')]=_0x2d20e0['name'];_0x562628[_0x5c45('0x8')]=_0x2d20e0['internal'];utils[_0x5c45('0x9')](_0x5c45('0xa'),_0x562628);}});}})[_0x5c45('0xf')](function(_0x492028){utils[_0x5c45('0x10')](util['format'](_0x5c45('0x11'),_0x562628[_0x5c45('0x3')]),_0x492028);});}delete members[_0x562628['interface']];}function startsWith(_0x1f0127,_0x14c9cc){return _[_0x5c45('0x12')](_0x1f0127,function(_0x40b694){return _[_0x5c45('0x13')](_0x14c9cc,_0x40b694);});}exports[_0x5c45('0x14')]=function(_0x683b62){try{utils[_0x5c45('0x15')](util[_0x5c45('0x16')]('[%s][members][devicestatechange]',members[_0x683b62[_0x5c45('0x17')]]?members[_0x683b62[_0x5c45('0x17')]][_0x5c45('0x3')]:_0x683b62[_0x5c45('0x17')]),_0x683b62);utils[_0x5c45('0x18')](util[_0x5c45('0x16')](_0x5c45('0x19'),members[_0x683b62[_0x5c45('0x17')]]?members[_0x683b62[_0x5c45('0x17')]]['uniqueid']:_0x683b62[_0x5c45('0x17')],_0x683b62['state'],_0x683b62['device']));switch(_0x683b62[_0x5c45('0x1a')]){case _0x5c45('0x1b'):case _0x5c45('0x1c'):if(!startsWith(exclude,_0x683b62[_0x5c45('0x17')])){members[_0x683b62['device']]={'channel':'voice','interface':_0x683b62[_0x5c45('0x17')],'type':'TALKING','enterAt':utils[_0x5c45('0x1d')](),'role':_0x5c45('0x1e')};}break;case'NOT_INUSE':if(!_[_0x5c45('0x1f')](members[_0x683b62[_0x5c45('0x17')]])){members[_0x683b62['device']]['exitAt']=utils[_0x5c45('0x1d')]();members[_0x683b62[_0x5c45('0x17')]][_0x5c45('0x20')]=utils[_0x5c45('0x21')](members[_0x683b62[_0x5c45('0x17')]][_0x5c45('0x22')],members[_0x683b62[_0x5c45('0x17')]]['enterAt']);if(members[_0x683b62[_0x5c45('0x17')]][_0x5c45('0x3')]){writeDB(members[_0x683b62[_0x5c45('0x17')]]);}}break;default:break;}}catch(_0x2c32f7){utils[_0x5c45('0x10')](util[_0x5c45('0x16')](_0x5c45('0x23'),members[_0x683b62[_0x5c45('0x17')]]?members[_0x683b62[_0x5c45('0x17')]]['uniqueid']:_0x683b62['device']),_0x2c32f7);}};exports[_0x5c45('0x24')]=function(_0x310a6e){try{if(!_[_0x5c45('0x1f')](members[_0x310a6e[_0x5c45('0xc')]])){utils[_0x5c45('0x15')](util[_0x5c45('0x16')](_0x5c45('0x25'),_0x310a6e[_0x5c45('0x3')]),_0x310a6e);utils['info'](util[_0x5c45('0x16')](_0x5c45('0x26'),_0x310a6e[_0x5c45('0x3')],_0x310a6e[_0x5c45('0xc')],_0x310a6e[_0x5c45('0x27')]));members[_0x310a6e[_0x5c45('0xc')]]=_[_0x5c45('0x28')](members[_0x310a6e[_0x5c45('0xc')]],{'data4':_0x310a6e[_0x5c45('0x27')],'uniqueid':_0x310a6e[_0x5c45('0x3')]});}}catch(_0x4ac07a){utils[_0x5c45('0x10')](util['format'](_0x5c45('0x25'),_0x310a6e[_0x5c45('0x3')]),_0x4ac07a);}};exports['cdr']=function(_0x2269bd){try{utils[_0x5c45('0x15')](util[_0x5c45('0x16')](_0x5c45('0x29'),_0x2269bd[_0x5c45('0x3')]),_0x2269bd);if(_0x2269bd[_0x5c45('0x2a')]){var _0x4dd0ff=_0x2269bd['channel'][_0x5c45('0xd')]('-')[0x0];if(!_['isNil'](members[_0x4dd0ff])){members[_0x4dd0ff]=_['assign'](members[_0x4dd0ff],{'data1':members[_0x4dd0ff][_0x5c45('0x2b')]||_0x2269bd['type'],'data2':members[_0x4dd0ff][_0x5c45('0x2c')]||_0x2269bd['source'],'data3':members[_0x4dd0ff][_0x5c45('0x2d')]||_0x2269bd[_0x5c45('0x2e')],'uniqueid':members[_0x4dd0ff][_0x5c45('0x3')]||_0x2269bd[_0x5c45('0x3')]});utils[_0x5c45('0x18')](util['format'](_0x5c45('0x2f'),_0x2269bd[_0x5c45('0x3')],members[_0x4dd0ff]['data1'],members[_0x4dd0ff][_0x5c45('0x2c')],members[_0x4dd0ff][_0x5c45('0x2d')]));if(members[_0x4dd0ff]['exitAt']){writeDB(members[_0x4dd0ff]);}}}if(_0x2269bd['destinationchannel']){var _0xceef51=_0x2269bd['destinationchannel'][_0x5c45('0xd')]('-')[0x0];if(!_[_0x5c45('0x1f')](members[_0xceef51])){members[_0xceef51]=_[_0x5c45('0x28')](members[_0xceef51],{'data1':members[_0xceef51][_0x5c45('0x2b')]||_0x2269bd[_0x5c45('0x5')],'data2':members[_0xceef51][_0x5c45('0x2c')]||_0x2269bd['source'],'data3':members[_0xceef51][_0x5c45('0x2d')]||_0x2269bd['destination'],'uniqueid':members[_0xceef51]['uniqueid']||_0x2269bd['uniqueid']});utils[_0x5c45('0x18')](util[_0x5c45('0x16')](_0x5c45('0x2f'),_0x2269bd[_0x5c45('0x3')],members[_0xceef51]['data1'],members[_0xceef51][_0x5c45('0x2c')],members[_0xceef51][_0x5c45('0x2d')]));if(members[_0xceef51][_0x5c45('0x22')]){writeDB(members[_0xceef51]);}}}}catch(_0x1b1c5a){utils['error'](util[_0x5c45('0x16')](_0x5c45('0x29'),_0x2269bd['uniqueid']),_0x1b1c5a);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 9620092..4d8ea3e 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 _0xbdc2=['ATTENDED','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','accountcode','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','[%s][queues][varset]','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','membername','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER'];(function(_0x58fdc1,_0x53ff50){var _0x5416a1=function(_0x4bca50){while(--_0x4bca50){_0x58fdc1['push'](_0x58fdc1['shift']());}};_0x5416a1(++_0x53ff50);}(_0xbdc2,0x148));var _0x2bdc=function(_0x512eb0,_0x27edfe){_0x512eb0=_0x512eb0-0x0;var _0x1378fe=_0xbdc2[_0x512eb0];return _0x1378fe;};'use strict';var _=require(_0x2bdc('0x0'));var util=require(_0x2bdc('0x1'));var utils=require(_0x2bdc('0x2'));var queues={};function writeDB(_0x39c4f1){utils['info'](util['format'](_0x2bdc('0x3'),_0x39c4f1[_0x2bdc('0x4')],_0x39c4f1['channel'],_0x39c4f1[_0x2bdc('0x5')],_0x39c4f1[_0x2bdc('0x6')],_0x39c4f1['calleridnum'],_0x39c4f1[_0x2bdc('0x7')],_0x39c4f1['queuecallerexitreason']));if(_0x39c4f1[_0x2bdc('0x5')]){utils[_0x2bdc('0x8')](_0x39c4f1[_0x2bdc('0x5')])[_0x2bdc('0x9')](function(_0x120ca1){if(_0x120ca1){_0x39c4f1[_0x2bdc('0xa')]=_0x120ca1[_0x2bdc('0xa')];}utils[_0x2bdc('0xb')](_0x2bdc('0xc'),_0x39c4f1);});}else{utils[_0x2bdc('0xb')](_0x2bdc('0xc'),_0x39c4f1);}if(_0x39c4f1[_0x2bdc('0xd')]){delete queues[_0x39c4f1[_0x2bdc('0xd')]];}else{delete queues[_0x39c4f1['uniqueid']];}}exports[_0x2bdc('0xe')]=function(_0x4a4715){try{utils[_0x2bdc('0xf')](util[_0x2bdc('0x10')](_0x2bdc('0x11'),_0x4a4715['uniqueid']),_0x4a4715);utils[_0x2bdc('0x12')](util['format'](_0x2bdc('0x13'),_0x4a4715[_0x2bdc('0x4')],_0x4a4715[_0x2bdc('0x5')],_0x4a4715[_0x2bdc('0x14')]));queues[_0x4a4715[_0x2bdc('0x4')]]=_[_0x2bdc('0x15')](_0x4a4715,{'originalposition':_0x4a4715[_0x2bdc('0x14')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x40128d){utils[_0x2bdc('0x16')](util[_0x2bdc('0x10')]('[%s][queues][queuecallerjoin]',_0x4a4715[_0x2bdc('0x4')]),_0x40128d);}};exports['hangup']=function(_0x426720){try{if(!_['isNil'](queues[_0x426720[_0x2bdc('0x4')]])){utils[_0x2bdc('0xf')](util[_0x2bdc('0x10')]('[%s][queues][hangup]',_0x426720[_0x2bdc('0x4')]),_0x426720);if(queues[_0x426720[_0x2bdc('0x4')]][_0x2bdc('0x17')]){if(!queues[_0x426720['uniqueid']][_0x2bdc('0x18')]&&!queues[_0x426720[_0x2bdc('0x4')]]['queuecallerexit']){queues[_0x426720[_0x2bdc('0x4')]][_0x2bdc('0x19')]=!![];queues[_0x426720[_0x2bdc('0x4')]][_0x2bdc('0x1a')]=utils[_0x2bdc('0x1b')]();queues[_0x426720[_0x2bdc('0x4')]]['queuecallerexitreason']=_0x2bdc('0x1c');}utils[_0x2bdc('0x12')](util[_0x2bdc('0x10')](_0x2bdc('0x1d'),_0x426720[_0x2bdc('0x4')],queues[_0x426720['uniqueid']][_0x2bdc('0x1e')],queues[_0x426720[_0x2bdc('0x4')]][_0x2bdc('0x1f')]));writeDB(queues[_0x426720[_0x2bdc('0x4')]]);}else if(queues[_0x426720[_0x2bdc('0x4')]]['transfereduniqueid']){utils[_0x2bdc('0x12')](util[_0x2bdc('0x10')](_0x2bdc('0x20'),_0x426720['uniqueid'],queues[_0x426720[_0x2bdc('0x4')]][_0x2bdc('0x1e')],queues[_0x426720[_0x2bdc('0x4')]]['transfereduniqueid']));queues[queues[_0x426720[_0x2bdc('0x4')]][_0x2bdc('0xd')]]=queues[_0x426720[_0x2bdc('0x4')]];queues[queues[_0x426720[_0x2bdc('0x4')]]['transfereduniqueid']][_0x2bdc('0x21')]=0x2;delete queues[_0x426720['uniqueid']];}}}catch(_0x2a0545){utils[_0x2bdc('0x16')](util[_0x2bdc('0x10')](_0x2bdc('0x22'),_0x426720['uniqueid']),_0x2a0545);}};exports['varset']=function(_0x518831){try{utils[_0x2bdc('0xf')](util[_0x2bdc('0x10')](_0x2bdc('0x23'),_0x518831[_0x2bdc('0x4')]),_0x518831);if(!_[_0x2bdc('0x24')](_0x518831[_0x2bdc('0x25')][_0x2bdc('0x26')])&&_0x518831[_0x2bdc('0x27')][_0x2bdc('0x28')]()!==_0x2bdc('0x29')){if(!_[_0x2bdc('0x24')](queues[_0x518831[_0x2bdc('0x4')]])){queues[_0x518831[_0x2bdc('0x4')]]['queuecallerabandon']=![];queues[_0x518831['uniqueid']][_0x2bdc('0x2a')]=null;queues[_0x518831[_0x2bdc('0x4')]][_0x2bdc('0x2b')]=!![];queues[_0x518831[_0x2bdc('0x4')]][_0x2bdc('0x2c')]=utils[_0x2bdc('0x1b')]();queues[_0x518831[_0x2bdc('0x4')]][_0x2bdc('0x1f')]=_0x518831[_0x2bdc('0x27')][_0x2bdc('0x28')]();utils['info'](util[_0x2bdc('0x10')](_0x2bdc('0x2d'),_0x518831[_0x2bdc('0x4')],queues[_0x518831[_0x2bdc('0x4')]][_0x2bdc('0x1e')],_0x518831[_0x2bdc('0x27')],queues[_0x518831[_0x2bdc('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x518831[_0x2bdc('0x4')]]);}}else if(!_['isNil'](_0x518831[_0x2bdc('0x25')]['queueposition'])){if(!_[_0x2bdc('0x24')](queues[_0x518831[_0x2bdc('0x4')]])&&!queues[_0x518831[_0x2bdc('0x4')]][_0x2bdc('0x18')]){queues[_0x518831['uniqueid']][_0x2bdc('0x18')]=![];queues[_0x518831[_0x2bdc('0x4')]]['queuecallerabandonAt']=null;queues[_0x518831[_0x2bdc('0x4')]][_0x2bdc('0x2b')]=!![];queues[_0x518831[_0x2bdc('0x4')]][_0x2bdc('0x2c')]=utils[_0x2bdc('0x1b')]();queues[_0x518831['uniqueid']]['queuecallerexitreason']='EXITWITHKEY';utils['info'](util[_0x2bdc('0x10')](_0x2bdc('0x2e'),_0x518831[_0x2bdc('0x4')],queues[_0x518831[_0x2bdc('0x4')]]['name'],_0x518831[_0x2bdc('0x27')],queues[_0x518831[_0x2bdc('0x4')]][_0x2bdc('0x1f')]));}}}catch(_0x185b26){utils['error'](util[_0x2bdc('0x10')](_0x2bdc('0x23'),_0x518831[_0x2bdc('0x4')]),_0x185b26);}};exports[_0x2bdc('0x18')]=function(_0x36a861){try{if(!_['isNil'](queues[_0x36a861[_0x2bdc('0x4')]])){utils[_0x2bdc('0xf')](util[_0x2bdc('0x10')](_0x2bdc('0x2f'),_0x36a861[_0x2bdc('0x4')]),_0x36a861);queues[_0x36a861['uniqueid']][_0x2bdc('0x2b')]=![];queues[_0x36a861[_0x2bdc('0x4')]][_0x2bdc('0x2c')]=null;queues[_0x36a861[_0x2bdc('0x4')]][_0x2bdc('0x18')]=!![];queues[_0x36a861['uniqueid']][_0x2bdc('0x2a')]=utils['now']();queues[_0x36a861['uniqueid']]['queuecallerexitreason']=_0x2bdc('0x30');utils[_0x2bdc('0x12')](util[_0x2bdc('0x10')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x36a861['uniqueid'],queues[_0x36a861[_0x2bdc('0x4')]][_0x2bdc('0x1e')],queues[_0x36a861[_0x2bdc('0x4')]]['queuecallerexitreason']));}}catch(_0x3fd930){utils[_0x2bdc('0x16')](util[_0x2bdc('0x10')](_0x2bdc('0x2f'),_0x36a861[_0x2bdc('0x4')]),_0x3fd930);}};exports[_0x2bdc('0x31')]=function(_0x19586a){try{if(!_['isNil'](queues[_0x19586a[_0x2bdc('0x4')]])){utils[_0x2bdc('0xf')](util['format']('[%s][queues][queuecallerleave]',_0x19586a[_0x2bdc('0x4')]),_0x19586a);utils[_0x2bdc('0x12')](util[_0x2bdc('0x10')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x19586a[_0x2bdc('0x4')],queues[_0x19586a[_0x2bdc('0x4')]][_0x2bdc('0x1e')],_0x19586a[_0x2bdc('0x32')],_0x19586a[_0x2bdc('0x33')]));queues[_0x19586a[_0x2bdc('0x4')]][_0x2bdc('0x31')]=!![];queues[_0x19586a[_0x2bdc('0x4')]][_0x2bdc('0x17')]=utils[_0x2bdc('0x1b')]();queues[_0x19586a[_0x2bdc('0x4')]][_0x2bdc('0x34')]=utils[_0x2bdc('0x35')](queues[_0x19586a['uniqueid']][_0x2bdc('0x17')],queues[_0x19586a[_0x2bdc('0x4')]][_0x2bdc('0x36')]);queues[_0x19586a[_0x2bdc('0x4')]][_0x2bdc('0x14')]=_0x19586a[_0x2bdc('0x14')];queues[_0x19586a['uniqueid']][_0x2bdc('0x37')]=_0x19586a[_0x2bdc('0x37')];queues[_0x19586a[_0x2bdc('0x4')]][_0x2bdc('0x32')]=_0x19586a[_0x2bdc('0x32')];queues[_0x19586a[_0x2bdc('0x4')]][_0x2bdc('0x33')]=_0x19586a[_0x2bdc('0x33')];}}catch(_0x3d1eed){utils[_0x2bdc('0x16')](util[_0x2bdc('0x10')](_0x2bdc('0x38'),_0x19586a[_0x2bdc('0x4')]),_0x3d1eed);}};exports[_0x2bdc('0x39')]=function(_0x1edd64){try{if(!_['isNil'](queues[_0x1edd64[_0x2bdc('0x4')]])){utils['debug'](util[_0x2bdc('0x10')](_0x2bdc('0x3a'),_0x1edd64['uniqueid']),_0x1edd64);utils[_0x2bdc('0x12')](util[_0x2bdc('0x10')](_0x2bdc('0x3b'),_0x1edd64[_0x2bdc('0x4')],queues[_0x1edd64['uniqueid']][_0x2bdc('0x1e')],_0x1edd64['membername'],_0x1edd64[_0x2bdc('0x3c')]));queues[_0x1edd64['uniqueid']]['queuecallerabandon']=![];queues[_0x1edd64['uniqueid']][_0x2bdc('0x18')]=![];queues[_0x1edd64[_0x2bdc('0x4')]][_0x2bdc('0x2a')]=null;queues[_0x1edd64[_0x2bdc('0x4')]][_0x2bdc('0x2b')]=![];queues[_0x1edd64[_0x2bdc('0x4')]][_0x2bdc('0x1f')]=null;queues[_0x1edd64['uniqueid']]['queuecallerexitAt']=null;queues[_0x1edd64[_0x2bdc('0x4')]][_0x2bdc('0x3d')]=!![];queues[_0x1edd64[_0x2bdc('0x4')]][_0x2bdc('0x7')]=_0x1edd64[_0x2bdc('0x3c')];queues[_0x1edd64[_0x2bdc('0x4')]][_0x2bdc('0x6')]=_0x1edd64['membername'];}}catch(_0x537823){utils[_0x2bdc('0x16')](util[_0x2bdc('0x10')]('[%s][queues][agentconnect]',_0x1edd64[_0x2bdc('0x4')]),_0x537823);}};exports[_0x2bdc('0x3e')]=function(_0xe3b0ca){try{if(!_['isNil'](queues[_0xe3b0ca[_0x2bdc('0x4')]])){if(queues[_0xe3b0ca['uniqueid']][_0x2bdc('0x17')]){utils[_0x2bdc('0xf')](util[_0x2bdc('0x10')](_0x2bdc('0x3f'),_0xe3b0ca['uniqueid']),_0xe3b0ca);queues[_0xe3b0ca[_0x2bdc('0x4')]][_0x2bdc('0x18')]=![];queues[_0xe3b0ca['uniqueid']][_0x2bdc('0x18')]=![];queues[_0xe3b0ca[_0x2bdc('0x4')]][_0x2bdc('0x2a')]=null;queues[_0xe3b0ca[_0x2bdc('0x4')]]['queuecallerexit']=![];queues[_0xe3b0ca[_0x2bdc('0x4')]][_0x2bdc('0x2c')]=null;queues[_0xe3b0ca['uniqueid']][_0x2bdc('0x3d')]=!![];queues[_0xe3b0ca[_0x2bdc('0x4')]]['lastAssignedTo']=_0xe3b0ca[_0x2bdc('0x40')];queues[_0xe3b0ca[_0x2bdc('0x4')]][_0x2bdc('0x19')]=!![];queues[_0xe3b0ca[_0x2bdc('0x4')]][_0x2bdc('0x1a')]=utils[_0x2bdc('0x1b')]();if(_0xe3b0ca[_0x2bdc('0x41')]==_0x2bdc('0x42')){if(!queues[_0xe3b0ca['uniqueid']]['transfer']){queues[_0xe3b0ca[_0x2bdc('0x4')]][_0x2bdc('0x1f')]=_0x2bdc('0x43');}}else{queues[_0xe3b0ca[_0x2bdc('0x4')]][_0x2bdc('0x1f')]=_0x2bdc('0x44')+_0xe3b0ca[_0x2bdc('0x41')][_0x2bdc('0x28')]();}utils['info'](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0xe3b0ca['uniqueid'],queues[_0xe3b0ca[_0x2bdc('0x4')]][_0x2bdc('0x1e')],_0xe3b0ca[_0x2bdc('0x40')],queues[_0xe3b0ca[_0x2bdc('0x4')]][_0x2bdc('0x1f')]));writeDB(queues[_0xe3b0ca[_0x2bdc('0x4')]]);}}}catch(_0x2823ae){utils[_0x2bdc('0x16')](util[_0x2bdc('0x10')](_0x2bdc('0x3f'),_0xe3b0ca[_0x2bdc('0x4')]),_0x2823ae);}};exports[_0x2bdc('0x45')]=function(_0x298aae){try{if(!_[_0x2bdc('0x24')](queues[_0x298aae[_0x2bdc('0x46')]])){utils['debug'](util[_0x2bdc('0x10')](_0x2bdc('0x47'),_0x298aae[_0x2bdc('0x4')]),_0x298aae);queues[_0x298aae[_0x2bdc('0x46')]][_0x2bdc('0x42')]=!![];queues[_0x298aae[_0x2bdc('0x46')]][_0x2bdc('0x48')]='BLIND';queues[_0x298aae[_0x2bdc('0x46')]][_0x2bdc('0x49')]=_0x298aae[_0x2bdc('0x4a')];queues[_0x298aae['transfereeuniqueid']][_0x2bdc('0x4b')]=_0x298aae['transfereeuniqueid'];queues[_0x298aae[_0x2bdc('0x46')]][_0x2bdc('0x1f')]=_0x2bdc('0x4c');utils[_0x2bdc('0x12')](util[_0x2bdc('0x10')](_0x2bdc('0x4d'),_0x298aae['uniqueid'],queues[_0x298aae['transfereeuniqueid']]['name'],_0x298aae['transfereeuniqueid'],_0x298aae[_0x2bdc('0x4a')]));}}catch(_0x3b6bd1){utils['error'](util[_0x2bdc('0x10')](_0x2bdc('0x47'),_0x298aae[_0x2bdc('0x4')]),_0x3b6bd1);}};exports[_0x2bdc('0x4e')]=function(_0x3d3fa3){try{utils[_0x2bdc('0xf')](util[_0x2bdc('0x10')](_0x2bdc('0x4f'),_0x3d3fa3[_0x2bdc('0x50')]),_0x3d3fa3);if(_0x3d3fa3[_0x2bdc('0x50')]==_0x3d3fa3[_0x2bdc('0x51')]){if(!_['isNil'](queues[_0x3d3fa3[_0x2bdc('0x52')]])){utils[_0x2bdc('0x12')](util['format'](_0x2bdc('0x53'),_0x3d3fa3['origtransfereruniqueid'],queues[_0x3d3fa3['secondtransfererlinkedid']][_0x2bdc('0x1e')],_0x3d3fa3[_0x2bdc('0x54')]));queues[_0x3d3fa3[_0x2bdc('0x52')]][_0x2bdc('0x42')]=!![];queues[_0x3d3fa3[_0x2bdc('0x52')]][_0x2bdc('0x48')]='ATTENDED';queues[_0x3d3fa3[_0x2bdc('0x52')]][_0x2bdc('0x49')]=_0x3d3fa3['origtransfererexten'];queues[_0x3d3fa3['secondtransfererlinkedid']][_0x2bdc('0x4b')]=_0x3d3fa3['origtransfereruniqueid'];queues[_0x3d3fa3['secondtransfererlinkedid']]['queuecallerexitreason']=_0x2bdc('0x55');}if(!_['isNil'](queues[_0x3d3fa3[_0x2bdc('0x51')]])){if(_0x3d3fa3[_0x2bdc('0x56')]&&queues[_0x3d3fa3['transfereelinkedid']]){queues[_0x3d3fa3[_0x2bdc('0x56')]]['queuecallerenterreason']=0x1;queues[_0x3d3fa3[_0x2bdc('0x46')]]=_[_0x2bdc('0x57')](queues[_0x3d3fa3[_0x2bdc('0x56')]]);queues[_0x3d3fa3[_0x2bdc('0x46')]]['transfereduniqueid']=_0x3d3fa3[_0x2bdc('0x58')];queues[_0x3d3fa3[_0x2bdc('0x46')]]['queuecallerenterreason']=0x2;queues[_0x3d3fa3[_0x2bdc('0x46')]][_0x2bdc('0x59')]=queues[_0x3d3fa3[_0x2bdc('0x52')]][_0x2bdc('0x59')];queues[_0x3d3fa3[_0x2bdc('0x46')]][_0x2bdc('0x5a')]=queues[_0x3d3fa3[_0x2bdc('0x52')]][_0x2bdc('0x5a')];queues[_0x3d3fa3[_0x2bdc('0x46')]]['queuecallerjoinAt']=utils['now']();queues[_0x3d3fa3['transfereeuniqueid']][_0x2bdc('0x17')]=utils[_0x2bdc('0x1b')]();queues[_0x3d3fa3[_0x2bdc('0x46')]][_0x2bdc('0x34')]=0x0;queues[_0x3d3fa3['transfereeuniqueid']][_0x2bdc('0x5b')]=0x0;utils[_0x2bdc('0x12')](util[_0x2bdc('0x10')](_0x2bdc('0x5c'),_0x3d3fa3[_0x2bdc('0x50')],queues[_0x3d3fa3['transfereeuniqueid']][_0x2bdc('0x1e')],queues[_0x3d3fa3[_0x2bdc('0x46')]][_0x2bdc('0x59')],queues[_0x3d3fa3['transfereeuniqueid']]['calleridname']));}else{utils['info'](util[_0x2bdc('0x10')](_0x2bdc('0x5d'),_0x3d3fa3[_0x2bdc('0x50')],queues[_0x3d3fa3[_0x2bdc('0x51')]]['name'],_0x3d3fa3['secondtransfererlinkedid']));queues[_0x3d3fa3[_0x2bdc('0x51')]][_0x2bdc('0xd')]=_0x3d3fa3[_0x2bdc('0x52')];}}}else if(_0x3d3fa3[_0x2bdc('0x5e')]==_0x3d3fa3[_0x2bdc('0x52')]){if(!_[_0x2bdc('0x24')](queues[_0x3d3fa3[_0x2bdc('0x51')]])){utils[_0x2bdc('0x12')](util[_0x2bdc('0x10')](_0x2bdc('0x5f'),_0x3d3fa3[_0x2bdc('0x50')],queues[_0x3d3fa3[_0x2bdc('0x51')]][_0x2bdc('0x1e')],_0x3d3fa3[_0x2bdc('0x5e')],_0x3d3fa3['secondtransfererexten']));queues[_0x3d3fa3[_0x2bdc('0x51')]][_0x2bdc('0x42')]=!![];queues[_0x3d3fa3[_0x2bdc('0x51')]][_0x2bdc('0x48')]=_0x2bdc('0x60');queues[_0x3d3fa3[_0x2bdc('0x51')]][_0x2bdc('0x49')]=_0x3d3fa3[_0x2bdc('0x61')];queues[_0x3d3fa3[_0x2bdc('0x51')]][_0x2bdc('0x4b')]=_0x3d3fa3['secondtransfereruniqueid'];queues[_0x3d3fa3['origtransfererlinkedid']][_0x2bdc('0x1f')]=_0x2bdc('0x55');}if(!_['isNil'](queues[_0x3d3fa3[_0x2bdc('0x52')]])){if(_0x3d3fa3[_0x2bdc('0x62')]&&queues[_0x3d3fa3[_0x2bdc('0x62')]]){queues[_0x3d3fa3[_0x2bdc('0x62')]]['queuecallerenterreason']=0x1;queues[_0x3d3fa3[_0x2bdc('0x58')]]=_[_0x2bdc('0x57')](queues[_0x3d3fa3[_0x2bdc('0x62')]]);queues[_0x3d3fa3[_0x2bdc('0x58')]][_0x2bdc('0xd')]=_0x3d3fa3[_0x2bdc('0x58')];queues[_0x3d3fa3['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x3d3fa3[_0x2bdc('0x58')]][_0x2bdc('0x59')]=queues[_0x3d3fa3[_0x2bdc('0x51')]][_0x2bdc('0x59')];queues[_0x3d3fa3[_0x2bdc('0x58')]][_0x2bdc('0x5a')]=queues[_0x3d3fa3[_0x2bdc('0x51')]][_0x2bdc('0x5a')];queues[_0x3d3fa3['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0x2bdc('0x1b')]();queues[_0x3d3fa3[_0x2bdc('0x58')]]['queuecallerleaveAt']=utils[_0x2bdc('0x1b')]();queues[_0x3d3fa3[_0x2bdc('0x58')]][_0x2bdc('0x34')]=0x0;queues[_0x3d3fa3['transfertargetuniqueid']][_0x2bdc('0x5b')]=0x0;utils['info'](util[_0x2bdc('0x10')](_0x2bdc('0x63'),_0x3d3fa3[_0x2bdc('0x50')],queues[_0x3d3fa3[_0x2bdc('0x58')]][_0x2bdc('0x1e')],queues[_0x3d3fa3[_0x2bdc('0x58')]][_0x2bdc('0xd')],queues[_0x3d3fa3[_0x2bdc('0x58')]][_0x2bdc('0x59')],queues[_0x3d3fa3[_0x2bdc('0x58')]][_0x2bdc('0x5a')]));}else{utils[_0x2bdc('0x12')](util[_0x2bdc('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x3d3fa3[_0x2bdc('0x50')],queues[_0x3d3fa3[_0x2bdc('0x52')]][_0x2bdc('0x1e')],_0x3d3fa3[_0x2bdc('0x51')]));queues[_0x3d3fa3[_0x2bdc('0x52')]]['transfereduniqueid']=_0x3d3fa3[_0x2bdc('0x51')];}}}}catch(_0x26e2f3){utils[_0x2bdc('0x16')](util[_0x2bdc('0x10')]('[%s][queues][attendedtransfer]',_0x3d3fa3['origtransfereruniqueid']),_0x26e2f3);}};exports[_0x2bdc('0x64')]=function(_0x336ca2){try{if(!_[_0x2bdc('0x24')](queues[_0x336ca2[_0x2bdc('0x4')]])){utils['debug'](util[_0x2bdc('0x10')](_0x2bdc('0x65'),_0x336ca2[_0x2bdc('0x4')]),_0x336ca2);queues[_0x336ca2[_0x2bdc('0x4')]][_0x2bdc('0x66')]=utils[_0x2bdc('0x1b')]();utils['info'](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x336ca2['uniqueid'],queues[_0x336ca2[_0x2bdc('0x4')]][_0x2bdc('0x1e')],queues[_0x336ca2[_0x2bdc('0x4')]]['musiconholdstartAt']));}}catch(_0x4e75f4){utils[_0x2bdc('0x16')](util[_0x2bdc('0x10')](_0x2bdc('0x65'),_0x336ca2['uniqueid']),_0x4e75f4);}};exports[_0x2bdc('0x67')]=function(_0x548cbf){try{if(!_[_0x2bdc('0x24')](queues[_0x548cbf[_0x2bdc('0x4')]])){if(!_['isNil'](queues[_0x548cbf['uniqueid']][_0x2bdc('0x66')])){utils[_0x2bdc('0xf')](util['format'](_0x2bdc('0x68'),_0x548cbf[_0x2bdc('0x4')]),_0x548cbf);queues[_0x548cbf[_0x2bdc('0x4')]]['mohtime']+=utils[_0x2bdc('0x35')](utils[_0x2bdc('0x1b')](),queues[_0x548cbf[_0x2bdc('0x4')]][_0x2bdc('0x66')]);utils['info'](util[_0x2bdc('0x10')](_0x2bdc('0x69'),_0x548cbf[_0x2bdc('0x4')],queues[_0x548cbf[_0x2bdc('0x4')]][_0x2bdc('0x1e')],queues[_0x548cbf[_0x2bdc('0x4')]]['mohtime']));delete queues[_0x548cbf[_0x2bdc('0x4')]][_0x2bdc('0x66')];}}}catch(_0x529f42){utils['error'](util['format'](_0x2bdc('0x68'),_0x548cbf[_0x2bdc('0x4')]),_0x529f42);}}; \ No newline at end of file +var _0x65c9=['debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queueposition','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','membername','reason','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfer','transfereeuniqueid','transfertype','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x65c9,0x182));var _0x965c=function(_0x1479ba,_0x348071){_0x1479ba=_0x1479ba-0x0;var _0x433961=_0x65c9[_0x1479ba];return _0x433961;};'use strict';var _=require(_0x965c('0x0'));var util=require(_0x965c('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x3cadfa){utils[_0x965c('0x2')](util[_0x965c('0x3')](_0x965c('0x4'),_0x3cadfa[_0x965c('0x5')],_0x3cadfa[_0x965c('0x6')],_0x3cadfa[_0x965c('0x7')],_0x3cadfa[_0x965c('0x8')],_0x3cadfa[_0x965c('0x9')],_0x3cadfa[_0x965c('0xa')],_0x3cadfa[_0x965c('0xb')]));if(_0x3cadfa[_0x965c('0x7')]){utils['getVoiceQueueByName'](_0x3cadfa[_0x965c('0x7')])[_0x965c('0xc')](function(_0x41d248){if(_0x41d248){_0x3cadfa[_0x965c('0xd')]=_0x41d248[_0x965c('0xd')];}utils[_0x965c('0xe')](_0x965c('0xf'),_0x3cadfa);});}else{utils['request'](_0x965c('0xf'),_0x3cadfa);}if(_0x3cadfa[_0x965c('0x10')]){delete queues[_0x3cadfa[_0x965c('0x10')]];}else{delete queues[_0x3cadfa[_0x965c('0x5')]];}}exports[_0x965c('0x11')]=function(_0x2cc0ae){try{utils[_0x965c('0x12')](util[_0x965c('0x3')](_0x965c('0x13'),_0x2cc0ae[_0x965c('0x5')]),_0x2cc0ae);utils[_0x965c('0x2')](util[_0x965c('0x3')](_0x965c('0x14'),_0x2cc0ae[_0x965c('0x5')],_0x2cc0ae['queue'],_0x2cc0ae[_0x965c('0x15')]));queues[_0x2cc0ae[_0x965c('0x5')]]=_[_0x965c('0x16')](_0x2cc0ae,{'originalposition':_0x2cc0ae['position'],'queuecallerjoinAt':utils[_0x965c('0x17')](),'mohtime':0x0});}catch(_0x2a9580){utils[_0x965c('0x18')](util['format'](_0x965c('0x13'),_0x2cc0ae['uniqueid']),_0x2a9580);}};exports['hangup']=function(_0x542499){try{if(!_[_0x965c('0x19')](queues[_0x542499[_0x965c('0x5')]])){utils[_0x965c('0x12')](util[_0x965c('0x3')]('[%s][queues][hangup]',_0x542499['uniqueid']),_0x542499);if(queues[_0x542499['uniqueid']][_0x965c('0x1a')]){if(!queues[_0x542499[_0x965c('0x5')]][_0x965c('0x1b')]&&!queues[_0x542499[_0x965c('0x5')]][_0x965c('0x1c')]){queues[_0x542499[_0x965c('0x5')]][_0x965c('0x1d')]=!![];queues[_0x542499[_0x965c('0x5')]][_0x965c('0x1e')]=utils[_0x965c('0x17')]();queues[_0x542499[_0x965c('0x5')]]['queuecallerexitreason']=_0x965c('0x1f');}utils[_0x965c('0x2')](util['format'](_0x965c('0x20'),_0x542499[_0x965c('0x5')],queues[_0x542499['uniqueid']][_0x965c('0x21')],queues[_0x542499[_0x965c('0x5')]][_0x965c('0xb')]));writeDB(queues[_0x542499['uniqueid']]);}else if(queues[_0x542499[_0x965c('0x5')]][_0x965c('0x10')]){utils[_0x965c('0x2')](util[_0x965c('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x542499[_0x965c('0x5')],queues[_0x542499['uniqueid']]['name'],queues[_0x542499['uniqueid']][_0x965c('0x10')]));queues[queues[_0x542499[_0x965c('0x5')]][_0x965c('0x10')]]=queues[_0x542499['uniqueid']];queues[queues[_0x542499['uniqueid']][_0x965c('0x10')]]['queuecallerenterreason']=0x2;delete queues[_0x542499[_0x965c('0x5')]];}}}catch(_0x5a2cad){utils[_0x965c('0x18')](util[_0x965c('0x3')](_0x965c('0x22'),_0x542499[_0x965c('0x5')]),_0x5a2cad);}};exports[_0x965c('0x23')]=function(_0x392a54){try{utils[_0x965c('0x12')](util[_0x965c('0x3')](_0x965c('0x24'),_0x392a54['uniqueid']),_0x392a54);if(!_[_0x965c('0x19')](_0x392a54[_0x965c('0x25')][_0x965c('0x26')])&&_0x392a54[_0x965c('0x27')][_0x965c('0x28')]()!==_0x965c('0x29')){if(!_[_0x965c('0x19')](queues[_0x392a54[_0x965c('0x5')]])){queues[_0x392a54['uniqueid']][_0x965c('0x1b')]=![];queues[_0x392a54['uniqueid']]['queuecallerabandonAt']=null;queues[_0x392a54[_0x965c('0x5')]][_0x965c('0x1c')]=!![];queues[_0x392a54[_0x965c('0x5')]]['queuecallerexitAt']=utils[_0x965c('0x17')]();queues[_0x392a54[_0x965c('0x5')]][_0x965c('0xb')]=_0x392a54['value'][_0x965c('0x28')]();utils[_0x965c('0x2')](util[_0x965c('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x392a54[_0x965c('0x5')],queues[_0x392a54[_0x965c('0x5')]][_0x965c('0x21')],_0x392a54[_0x965c('0x27')],queues[_0x392a54[_0x965c('0x5')]][_0x965c('0xb')]));writeDB(queues[_0x392a54['uniqueid']]);}}else if(!_[_0x965c('0x19')](_0x392a54[_0x965c('0x25')][_0x965c('0x2a')])){if(!_[_0x965c('0x19')](queues[_0x392a54[_0x965c('0x5')]])&&!queues[_0x392a54[_0x965c('0x5')]][_0x965c('0x1b')]){queues[_0x392a54[_0x965c('0x5')]]['queuecallerabandon']=![];queues[_0x392a54[_0x965c('0x5')]][_0x965c('0x2b')]=null;queues[_0x392a54[_0x965c('0x5')]][_0x965c('0x1c')]=!![];queues[_0x392a54['uniqueid']][_0x965c('0x2c')]=utils[_0x965c('0x17')]();queues[_0x392a54[_0x965c('0x5')]][_0x965c('0xb')]='EXITWITHKEY';utils[_0x965c('0x2')](util['format'](_0x965c('0x2d'),_0x392a54[_0x965c('0x5')],queues[_0x392a54[_0x965c('0x5')]][_0x965c('0x21')],_0x392a54[_0x965c('0x27')],queues[_0x392a54['uniqueid']][_0x965c('0xb')]));}}}catch(_0x278779){utils[_0x965c('0x18')](util[_0x965c('0x3')](_0x965c('0x24'),_0x392a54[_0x965c('0x5')]),_0x278779);}};exports[_0x965c('0x1b')]=function(_0x29e2e0){try{if(!_['isNil'](queues[_0x29e2e0[_0x965c('0x5')]])){utils[_0x965c('0x12')](util[_0x965c('0x3')](_0x965c('0x2e'),_0x29e2e0[_0x965c('0x5')]),_0x29e2e0);queues[_0x29e2e0[_0x965c('0x5')]][_0x965c('0x1c')]=![];queues[_0x29e2e0[_0x965c('0x5')]][_0x965c('0x2c')]=null;queues[_0x29e2e0[_0x965c('0x5')]]['queuecallerabandon']=!![];queues[_0x29e2e0[_0x965c('0x5')]]['queuecallerabandonAt']=utils[_0x965c('0x17')]();queues[_0x29e2e0['uniqueid']][_0x965c('0xb')]=_0x965c('0x2f');utils[_0x965c('0x2')](util[_0x965c('0x3')](_0x965c('0x30'),_0x29e2e0[_0x965c('0x5')],queues[_0x29e2e0['uniqueid']]['name'],queues[_0x29e2e0[_0x965c('0x5')]][_0x965c('0xb')]));}}catch(_0x545e5d){utils[_0x965c('0x18')](util[_0x965c('0x3')](_0x965c('0x2e'),_0x29e2e0['uniqueid']),_0x545e5d);}};exports[_0x965c('0x31')]=function(_0x34eafb){try{if(!_[_0x965c('0x19')](queues[_0x34eafb[_0x965c('0x5')]])){utils[_0x965c('0x12')](util[_0x965c('0x3')](_0x965c('0x32'),_0x34eafb[_0x965c('0x5')]),_0x34eafb);utils['info'](util['format']('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x34eafb[_0x965c('0x5')],queues[_0x34eafb[_0x965c('0x5')]][_0x965c('0x21')],_0x34eafb['connectedlinenum'],_0x34eafb['connectedlinename']));queues[_0x34eafb['uniqueid']]['queuecallerleave']=!![];queues[_0x34eafb[_0x965c('0x5')]]['queuecallerleaveAt']=utils[_0x965c('0x17')]();queues[_0x34eafb[_0x965c('0x5')]][_0x965c('0x33')]=utils[_0x965c('0x34')](queues[_0x34eafb[_0x965c('0x5')]][_0x965c('0x1a')],queues[_0x34eafb['uniqueid']][_0x965c('0x35')]);queues[_0x34eafb[_0x965c('0x5')]][_0x965c('0x15')]=_0x34eafb['position'];queues[_0x34eafb[_0x965c('0x5')]][_0x965c('0x36')]=_0x34eafb[_0x965c('0x36')];queues[_0x34eafb['uniqueid']]['connectedlinenum']=_0x34eafb[_0x965c('0x37')];queues[_0x34eafb[_0x965c('0x5')]][_0x965c('0x38')]=_0x34eafb[_0x965c('0x38')];}}catch(_0xb4c48){utils[_0x965c('0x18')](util[_0x965c('0x3')](_0x965c('0x32'),_0x34eafb[_0x965c('0x5')]),_0xb4c48);}};exports[_0x965c('0x39')]=function(_0x3e6514){try{if(!_[_0x965c('0x19')](queues[_0x3e6514[_0x965c('0x5')]])){utils['debug'](util[_0x965c('0x3')](_0x965c('0x3a'),_0x3e6514[_0x965c('0x5')]),_0x3e6514);utils[_0x965c('0x2')](util[_0x965c('0x3')](_0x965c('0x3b'),_0x3e6514[_0x965c('0x5')],queues[_0x3e6514[_0x965c('0x5')]][_0x965c('0x21')],_0x3e6514['membername'],_0x3e6514[_0x965c('0x3c')]));queues[_0x3e6514[_0x965c('0x5')]]['queuecallerabandon']=![];queues[_0x3e6514['uniqueid']][_0x965c('0x1b')]=![];queues[_0x3e6514[_0x965c('0x5')]]['queuecallerabandonAt']=null;queues[_0x3e6514['uniqueid']][_0x965c('0x1c')]=![];queues[_0x3e6514[_0x965c('0x5')]][_0x965c('0xb')]=null;queues[_0x3e6514[_0x965c('0x5')]][_0x965c('0x2c')]=null;queues[_0x3e6514[_0x965c('0x5')]][_0x965c('0x3d')]=!![];queues[_0x3e6514[_0x965c('0x5')]][_0x965c('0xa')]=_0x3e6514['destaccountcode'];queues[_0x3e6514[_0x965c('0x5')]][_0x965c('0x8')]=_0x3e6514[_0x965c('0x3e')];}}catch(_0x572f7d){utils[_0x965c('0x18')](util[_0x965c('0x3')](_0x965c('0x3a'),_0x3e6514[_0x965c('0x5')]),_0x572f7d);}};exports['agentcomplete']=function(_0xba27fc){try{if(!_[_0x965c('0x19')](queues[_0xba27fc['uniqueid']])){if(queues[_0xba27fc[_0x965c('0x5')]]['queuecallerleaveAt']){utils[_0x965c('0x12')](util[_0x965c('0x3')]('[%s][queues][agentcomplete]',_0xba27fc[_0x965c('0x5')]),_0xba27fc);queues[_0xba27fc[_0x965c('0x5')]][_0x965c('0x1b')]=![];queues[_0xba27fc[_0x965c('0x5')]]['queuecallerabandon']=![];queues[_0xba27fc[_0x965c('0x5')]][_0x965c('0x2b')]=null;queues[_0xba27fc[_0x965c('0x5')]]['queuecallerexit']=![];queues[_0xba27fc['uniqueid']][_0x965c('0x2c')]=null;queues[_0xba27fc[_0x965c('0x5')]][_0x965c('0x3d')]=!![];queues[_0xba27fc[_0x965c('0x5')]][_0x965c('0x8')]=_0xba27fc[_0x965c('0x3e')];queues[_0xba27fc[_0x965c('0x5')]][_0x965c('0x1d')]=!![];queues[_0xba27fc[_0x965c('0x5')]][_0x965c('0x1e')]=utils[_0x965c('0x17')]();if(_0xba27fc[_0x965c('0x3f')]=='transfer'){if(!queues[_0xba27fc[_0x965c('0x5')]]['transfer']){queues[_0xba27fc[_0x965c('0x5')]][_0x965c('0xb')]='TRANSFER';}}else{queues[_0xba27fc[_0x965c('0x5')]][_0x965c('0xb')]=_0x965c('0x40')+_0xba27fc['reason'][_0x965c('0x28')]();}utils['info'](util[_0x965c('0x3')](_0x965c('0x41'),_0xba27fc[_0x965c('0x5')],queues[_0xba27fc[_0x965c('0x5')]][_0x965c('0x21')],_0xba27fc[_0x965c('0x3e')],queues[_0xba27fc['uniqueid']][_0x965c('0xb')]));writeDB(queues[_0xba27fc['uniqueid']]);}}}catch(_0x110ff8){utils[_0x965c('0x18')](util[_0x965c('0x3')]('[%s][queues][agentcomplete]',_0xba27fc['uniqueid']),_0x110ff8);}};exports[_0x965c('0x42')]=function(_0x4a5862){try{if(!_['isNil'](queues[_0x4a5862['transfereeuniqueid']])){utils[_0x965c('0x12')](util['format'](_0x965c('0x43'),_0x4a5862['uniqueid']),_0x4a5862);queues[_0x4a5862['transfereeuniqueid']][_0x965c('0x44')]=!![];queues[_0x4a5862[_0x965c('0x45')]][_0x965c('0x46')]='BLIND';queues[_0x4a5862[_0x965c('0x45')]][_0x965c('0x47')]=_0x4a5862['extension'];queues[_0x4a5862[_0x965c('0x45')]][_0x965c('0x48')]=_0x4a5862[_0x965c('0x45')];queues[_0x4a5862[_0x965c('0x45')]][_0x965c('0xb')]=_0x965c('0x49');utils['info'](util[_0x965c('0x3')](_0x965c('0x4a'),_0x4a5862[_0x965c('0x5')],queues[_0x4a5862['transfereeuniqueid']][_0x965c('0x21')],_0x4a5862[_0x965c('0x45')],_0x4a5862['extension']));}}catch(_0x132ec4){utils[_0x965c('0x18')](util[_0x965c('0x3')](_0x965c('0x43'),_0x4a5862['uniqueid']),_0x132ec4);}};exports[_0x965c('0x4b')]=function(_0x1ab526){try{utils[_0x965c('0x12')](util[_0x965c('0x3')](_0x965c('0x4c'),_0x1ab526[_0x965c('0x4d')]),_0x1ab526);if(_0x1ab526['origtransfereruniqueid']==_0x1ab526[_0x965c('0x4e')]){if(!_[_0x965c('0x19')](queues[_0x1ab526[_0x965c('0x4f')]])){utils[_0x965c('0x2')](util[_0x965c('0x3')](_0x965c('0x50'),_0x1ab526[_0x965c('0x4d')],queues[_0x1ab526['secondtransfererlinkedid']][_0x965c('0x21')],_0x1ab526[_0x965c('0x51')]));queues[_0x1ab526['secondtransfererlinkedid']]['transfer']=!![];queues[_0x1ab526[_0x965c('0x4f')]][_0x965c('0x46')]=_0x965c('0x52');queues[_0x1ab526[_0x965c('0x4f')]][_0x965c('0x47')]=_0x1ab526['origtransfererexten'];queues[_0x1ab526[_0x965c('0x4f')]]['transferuniqueid']=_0x1ab526[_0x965c('0x4d')];queues[_0x1ab526[_0x965c('0x4f')]]['queuecallerexitreason']=_0x965c('0x53');}if(!_[_0x965c('0x19')](queues[_0x1ab526[_0x965c('0x4e')]])){if(_0x1ab526[_0x965c('0x54')]&&queues[_0x1ab526[_0x965c('0x54')]]){queues[_0x1ab526[_0x965c('0x54')]][_0x965c('0x55')]=0x1;queues[_0x1ab526[_0x965c('0x45')]]=_[_0x965c('0x56')](queues[_0x1ab526[_0x965c('0x54')]]);queues[_0x1ab526['transfereeuniqueid']][_0x965c('0x10')]=_0x1ab526[_0x965c('0x57')];queues[_0x1ab526[_0x965c('0x45')]]['queuecallerenterreason']=0x2;queues[_0x1ab526['transfereeuniqueid']][_0x965c('0x9')]=queues[_0x1ab526[_0x965c('0x4f')]][_0x965c('0x9')];queues[_0x1ab526[_0x965c('0x45')]]['calleridname']=queues[_0x1ab526['secondtransfererlinkedid']][_0x965c('0x58')];queues[_0x1ab526[_0x965c('0x45')]][_0x965c('0x35')]=utils[_0x965c('0x17')]();queues[_0x1ab526['transfereeuniqueid']][_0x965c('0x1a')]=utils[_0x965c('0x17')]();queues[_0x1ab526['transfereeuniqueid']][_0x965c('0x33')]=0x0;queues[_0x1ab526[_0x965c('0x45')]][_0x965c('0x59')]=0x0;utils['info'](util[_0x965c('0x3')](_0x965c('0x5a'),_0x1ab526[_0x965c('0x4d')],queues[_0x1ab526['transfereeuniqueid']][_0x965c('0x21')],queues[_0x1ab526[_0x965c('0x45')]]['calleridnum'],queues[_0x1ab526[_0x965c('0x45')]][_0x965c('0x58')]));}else{utils[_0x965c('0x2')](util['format'](_0x965c('0x5b'),_0x1ab526['origtransfereruniqueid'],queues[_0x1ab526[_0x965c('0x4e')]][_0x965c('0x21')],_0x1ab526[_0x965c('0x4f')]));queues[_0x1ab526[_0x965c('0x4e')]]['transfereduniqueid']=_0x1ab526[_0x965c('0x4f')];}}}else if(_0x1ab526[_0x965c('0x5c')]==_0x1ab526[_0x965c('0x4f')]){if(!_[_0x965c('0x19')](queues[_0x1ab526['origtransfererlinkedid']])){utils[_0x965c('0x2')](util[_0x965c('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x1ab526['origtransfereruniqueid'],queues[_0x1ab526[_0x965c('0x4e')]][_0x965c('0x21')],_0x1ab526[_0x965c('0x5c')],_0x1ab526[_0x965c('0x5d')]));queues[_0x1ab526[_0x965c('0x4e')]][_0x965c('0x44')]=!![];queues[_0x1ab526[_0x965c('0x4e')]][_0x965c('0x46')]='ATTENDED';queues[_0x1ab526[_0x965c('0x4e')]][_0x965c('0x47')]=_0x1ab526[_0x965c('0x5d')];queues[_0x1ab526[_0x965c('0x4e')]][_0x965c('0x48')]=_0x1ab526[_0x965c('0x5c')];queues[_0x1ab526[_0x965c('0x4e')]]['queuecallerexitreason']=_0x965c('0x53');}if(!_[_0x965c('0x19')](queues[_0x1ab526[_0x965c('0x4f')]])){if(_0x1ab526['transfertargetlinkedid']&&queues[_0x1ab526[_0x965c('0x5e')]]){queues[_0x1ab526[_0x965c('0x5e')]]['queuecallerenterreason']=0x1;queues[_0x1ab526[_0x965c('0x57')]]=_[_0x965c('0x56')](queues[_0x1ab526[_0x965c('0x5e')]]);queues[_0x1ab526[_0x965c('0x57')]][_0x965c('0x10')]=_0x1ab526['transfertargetuniqueid'];queues[_0x1ab526['transfertargetuniqueid']][_0x965c('0x55')]=0x2;queues[_0x1ab526['transfertargetuniqueid']]['calleridnum']=queues[_0x1ab526[_0x965c('0x4e')]]['calleridnum'];queues[_0x1ab526['transfertargetuniqueid']]['calleridname']=queues[_0x1ab526[_0x965c('0x4e')]][_0x965c('0x58')];queues[_0x1ab526[_0x965c('0x57')]][_0x965c('0x35')]=utils[_0x965c('0x17')]();queues[_0x1ab526[_0x965c('0x57')]]['queuecallerleaveAt']=utils['now']();queues[_0x1ab526['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x1ab526[_0x965c('0x57')]][_0x965c('0x59')]=0x0;utils[_0x965c('0x2')](util[_0x965c('0x3')](_0x965c('0x5f'),_0x1ab526[_0x965c('0x4d')],queues[_0x1ab526[_0x965c('0x57')]][_0x965c('0x21')],queues[_0x1ab526[_0x965c('0x57')]]['transfereduniqueid'],queues[_0x1ab526['transfertargetuniqueid']][_0x965c('0x9')],queues[_0x1ab526['transfertargetuniqueid']]['calleridname']));}else{utils[_0x965c('0x2')](util[_0x965c('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1ab526[_0x965c('0x4d')],queues[_0x1ab526[_0x965c('0x4f')]][_0x965c('0x21')],_0x1ab526[_0x965c('0x4e')]));queues[_0x1ab526[_0x965c('0x4f')]]['transfereduniqueid']=_0x1ab526[_0x965c('0x4e')];}}}}catch(_0x428f08){utils['error'](util['format'](_0x965c('0x4c'),_0x1ab526[_0x965c('0x4d')]),_0x428f08);}};exports[_0x965c('0x60')]=function(_0x284666){try{if(!_[_0x965c('0x19')](queues[_0x284666[_0x965c('0x5')]])){utils['debug'](util[_0x965c('0x3')](_0x965c('0x61'),_0x284666[_0x965c('0x5')]),_0x284666);queues[_0x284666[_0x965c('0x5')]]['musiconholdstartAt']=utils['now']();utils[_0x965c('0x2')](util[_0x965c('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x284666[_0x965c('0x5')],queues[_0x284666[_0x965c('0x5')]]['name'],queues[_0x284666[_0x965c('0x5')]][_0x965c('0x62')]));}}catch(_0x3327f6){utils[_0x965c('0x18')](util['format'](_0x965c('0x61'),_0x284666['uniqueid']),_0x3327f6);}};exports['musiconholdstop']=function(_0x2640e2){try{if(!_[_0x965c('0x19')](queues[_0x2640e2[_0x965c('0x5')]])){if(!_[_0x965c('0x19')](queues[_0x2640e2[_0x965c('0x5')]][_0x965c('0x62')])){utils[_0x965c('0x12')](util[_0x965c('0x3')]('[%s][queues][musiconholdstop]',_0x2640e2[_0x965c('0x5')]),_0x2640e2);queues[_0x2640e2[_0x965c('0x5')]][_0x965c('0x59')]+=utils[_0x965c('0x34')](utils['now'](),queues[_0x2640e2['uniqueid']]['musiconholdstartAt']);utils[_0x965c('0x2')](util[_0x965c('0x3')](_0x965c('0x63'),_0x2640e2[_0x965c('0x5')],queues[_0x2640e2[_0x965c('0x5')]][_0x965c('0x21')],queues[_0x2640e2[_0x965c('0x5')]][_0x965c('0x59')]));delete queues[_0x2640e2['uniqueid']][_0x965c('0x62')];}}}catch(_0x5ec86d){utils['error'](util['format'](_0x965c('0x64'),_0x2640e2[_0x965c('0x5')]),_0x5ec86d);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 33a6b02..3606002 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 _0xeaa7=['context','exten','accountcode','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','./utils','info','format','[%s][recordings][writeDB]','then','membername','name','UserId','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','uniqueid','linkedid'];(function(_0x5c4f6b,_0x2cdfce){var _0x104c4e=function(_0x31171b){while(--_0x31171b){_0x5c4f6b['push'](_0x5c4f6b['shift']());}};_0x104c4e(++_0x2cdfce);}(_0xeaa7,0x13a));var _0x7eaa=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xeaa7[_0x550d12];return _0x12103d;};'use strict';var _=require('lodash');var util=require(_0x7eaa('0x0'));var utils=require(_0x7eaa('0x1'));var recordings={};function writeDB(_0x438b19){utils[_0x7eaa('0x2')](util[_0x7eaa('0x3')](_0x7eaa('0x4'),_0x438b19['uniqueid']));if(_0x438b19['accountcode']){utils['getUserByInternal'](_0x438b19['accountcode'])[_0x7eaa('0x5')](function(_0x21ce95){if(_0x21ce95){_0x438b19[_0x7eaa('0x6')]=_0x21ce95[_0x7eaa('0x7')];_0x438b19[_0x7eaa('0x8')]=_0x21ce95['id'];}utils['request'](_0x7eaa('0x9'),_0x438b19);});}else{utils[_0x7eaa('0xa')](_0x7eaa('0x9'),_0x438b19);}}exports[_0x7eaa('0xb')]=function(_0x366e45){try{utils[_0x7eaa('0xc')](util[_0x7eaa('0x3')](_0x7eaa('0xd'),_0x366e45[_0x7eaa('0xe')]),_0x366e45);if(_0x366e45['uniqueid']==_0x366e45[_0x7eaa('0xf')]){utils['info'](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x366e45['uniqueid'],_0x366e45[_0x7eaa('0x10')],_0x366e45[_0x7eaa('0x11')]));recordings[_0x366e45[_0x7eaa('0xe')]]={'uniqueid':_0x366e45[_0x7eaa('0xe')],'accountcode':_0x366e45[_0x7eaa('0x12')],'exten':_0x366e45[_0x7eaa('0x11')],'context':_0x366e45[_0x7eaa('0x10')],'channel':_0x366e45['channel'],'monitors':[]};}}catch(_0x5d442e){utils[_0x7eaa('0x13')](util[_0x7eaa('0x3')](_0x7eaa('0xd'),_0x366e45[_0x7eaa('0xe')]),_0x5d442e);}};exports[_0x7eaa('0x14')]=function(_0x5b0823){try{utils[_0x7eaa('0xc')](util[_0x7eaa('0x3')](_0x7eaa('0x15'),_0x5b0823[_0x7eaa('0xe')]),_0x5b0823);if(!_[_0x7eaa('0x16')](recordings[_0x5b0823['uniqueid']])&&_0x5b0823[_0x7eaa('0x17')]==0x6){utils['info'](util[_0x7eaa('0x3')](_0x7eaa('0x18'),_0x5b0823[_0x7eaa('0xe')],_0x5b0823[_0x7eaa('0x10')],_0x5b0823[_0x7eaa('0x19')]));}else if(!_[_0x7eaa('0x16')](recordings[_0x5b0823[_0x7eaa('0xf')]])&&_0x5b0823['channelstate']==0x6&&_0x5b0823[_0x7eaa('0x10')]!=_0x7eaa('0x1a')){utils[_0x7eaa('0x2')](util[_0x7eaa('0x3')](_0x7eaa('0x1b'),_0x5b0823['uniqueid'],_0x5b0823[_0x7eaa('0xf')],_0x5b0823[_0x7eaa('0x10')],_0x5b0823[_0x7eaa('0x19')]));recordings[_0x5b0823['linkedid']][_0x7eaa('0x12')]=_0x5b0823['accountcode'];}}catch(_0x121037){utils[_0x7eaa('0x13')](util[_0x7eaa('0x3')](_0x7eaa('0x15'),_0x5b0823[_0x7eaa('0xe')]),_0x121037);}};exports[_0x7eaa('0x1c')]=function(_0x4bbe23){try{if(!_[_0x7eaa('0x16')](_0x4bbe23[_0x7eaa('0x1d')])&&!_[_0x7eaa('0x16')](_0x4bbe23[_0x7eaa('0x1d')][_0x7eaa('0x1e')])){utils['debug'](util['format']('[%s][recordings][varset]',_0x4bbe23[_0x7eaa('0xe')]),_0x4bbe23);utils[_0x7eaa('0x2')](util['format'](_0x7eaa('0x1f'),_0x4bbe23[_0x7eaa('0xe')],_0x4bbe23[_0x7eaa('0x1d')],_0x4bbe23[_0x7eaa('0x20')]));if(_[_0x7eaa('0x21')](_0x4bbe23[_0x7eaa('0x20')],'.wav49')){_0x4bbe23[_0x7eaa('0x20')]=_0x4bbe23[_0x7eaa('0x20')]['replace'](_0x7eaa('0x22'),_0x7eaa('0x23'));}if(recordings[_0x4bbe23[_0x7eaa('0xf')]]){var _0x2a6b29=_['find'](recordings[_0x4bbe23[_0x7eaa('0xf')]][_0x7eaa('0x24')],{'value':_0x4bbe23[_0x7eaa('0x20')]});if(_[_0x7eaa('0x16')](_0x2a6b29)){recordings[_0x4bbe23['linkedid']][_0x7eaa('0x24')][_0x7eaa('0x25')]({'value':_0x4bbe23[_0x7eaa('0x20')]});}}}}catch(_0x45f8c9){utils[_0x7eaa('0x13')](util[_0x7eaa('0x3')](_0x7eaa('0x26'),_0x4bbe23['uniqueid']),_0x45f8c9);}};exports[_0x7eaa('0x27')]=function(_0x21bd68){try{if(!_[_0x7eaa('0x16')](recordings[_0x21bd68[_0x7eaa('0xe')]])){utils['debug'](util[_0x7eaa('0x3')]('[%s][recordings][hangup]',_0x21bd68[_0x7eaa('0xe')]),_0x21bd68);utils[_0x7eaa('0x2')](util[_0x7eaa('0x3')](_0x7eaa('0x28'),_0x21bd68[_0x7eaa('0xe')],_0x21bd68[_0x7eaa('0x29')],_0x21bd68['calleridname'],_0x21bd68[_0x7eaa('0x2a')]));recordings[_0x21bd68[_0x7eaa('0xe')]][_0x7eaa('0x29')]=_0x21bd68[_0x7eaa('0x29')];recordings[_0x21bd68['uniqueid']]['calleridname']=_0x21bd68[_0x7eaa('0x2b')];recordings[_0x21bd68[_0x7eaa('0xe')]][_0x7eaa('0x2c')]=_0x21bd68[_0x7eaa('0x2c')];recordings[_0x21bd68['uniqueid']][_0x7eaa('0x2d')]=_0x21bd68['connectedlinename'];if(recordings[_0x21bd68['uniqueid']][_0x7eaa('0x2e')]==_0x7eaa('0x2f')&&recordings[_0x21bd68[_0x7eaa('0xe')]]['accountcode']){recordings[_0x21bd68[_0x7eaa('0xe')]][_0x7eaa('0x2c')]=recordings[_0x21bd68[_0x7eaa('0xe')]][_0x7eaa('0x12')];recordings[_0x21bd68[_0x7eaa('0xe')]][_0x7eaa('0x2d')]='';}recordings[_0x21bd68['uniqueid']][_0x7eaa('0x24')][_0x7eaa('0x30')](function(_0x1c39da){var _0x8e3c77=_[_0x7eaa('0x31')](recordings[_0x21bd68['uniqueid']]);_0x8e3c77[_0x7eaa('0x20')]=_0x1c39da['value'];writeDB(_0x8e3c77);});delete recordings[_0x21bd68[_0x7eaa('0xe')]];}}catch(_0x388312){utils[_0x7eaa('0x13')](util[_0x7eaa('0x3')](_0x7eaa('0x32'),_0x21bd68['uniqueid']),_0x388312);}};exports[_0x7eaa('0x33')]=function(_0x4014e4){try{if(!_[_0x7eaa('0x16')](recordings[_0x4014e4[_0x7eaa('0xe')]])){utils[_0x7eaa('0xc')](util[_0x7eaa('0x3')](_0x7eaa('0x34'),_0x4014e4[_0x7eaa('0xe')]),_0x4014e4);utils[_0x7eaa('0x2')](util['format'](_0x7eaa('0x35'),_0x4014e4[_0x7eaa('0xe')],_0x4014e4[_0x7eaa('0x36')],_0x4014e4[_0x7eaa('0x37')]));if(_0x4014e4[_0x7eaa('0x36')]['toLowerCase']()==_0x7eaa('0x38')&&_[_0x7eaa('0x39')](_0x4014e4[_0x7eaa('0x37')][_0x7eaa('0x3a')](),_0x7eaa('0x3b'))){var _0x3943de=_0x4014e4['appdata'][_0x7eaa('0x3c')]('=');var _0x11dacc=_0x3943de[0x0][_0x7eaa('0x3d')](_0x3943de[0x0]['lastIndexOf']('(')+0x1,_0x3943de[0x0][_0x7eaa('0x3e')](')'));var _0x660921=_0x3943de[0x1];recordings[_0x4014e4['uniqueid']][_0x11dacc]=_0x660921;}}}catch(_0x45af49){utils[_0x7eaa('0x13')](util['format'](_0x7eaa('0x34'),_0x4014e4[_0x7eaa('0xe')]),_0x45af49);}};exports['queuecallerjoin']=function(_0x2a2af5){try{if(!_[_0x7eaa('0x16')](recordings[_0x2a2af5[_0x7eaa('0xe')]])){utils[_0x7eaa('0xc')](util[_0x7eaa('0x3')](_0x7eaa('0x3f'),_0x2a2af5[_0x7eaa('0xe')]),_0x2a2af5);utils['info'](util[_0x7eaa('0x3')](_0x7eaa('0x40'),_0x2a2af5[_0x7eaa('0xe')],_0x2a2af5['queue']));recordings[_0x2a2af5[_0x7eaa('0xe')]][_0x7eaa('0x41')]=_0x2a2af5[_0x7eaa('0x41')];}}catch(_0xa13265){utils[_0x7eaa('0x13')](util[_0x7eaa('0x3')]('[%s][recordings][queuecallerjoin]',_0x2a2af5[_0x7eaa('0xe')]),_0xa13265);}}; \ No newline at end of file +var _0x4178=['request','newchannel','debug','[%s][recordings][newchannel]','uniqueid','linkedid','info','context','exten','channel','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','[%s][recordings][varset]','value','endsWith','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','error','newexten','[%s][recordings][newexten]','application','set','startsWith','appdata','cdr','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','membername','name','UserId'];(function(_0x15008d,_0x1a29b0){var _0x200973=function(_0x4f79a0){while(--_0x4f79a0){_0x15008d['push'](_0x15008d['shift']());}};_0x200973(++_0x1a29b0);}(_0x4178,0x1df));var _0x8417=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4178[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x53a496){utils['info'](util[_0x8417('0x0')](_0x8417('0x1'),_0x53a496['uniqueid']));if(_0x53a496[_0x8417('0x2')]){utils[_0x8417('0x3')](_0x53a496[_0x8417('0x2')])['then'](function(_0x1700b3){if(_0x1700b3){_0x53a496[_0x8417('0x4')]=_0x1700b3[_0x8417('0x5')];_0x53a496[_0x8417('0x6')]=_0x1700b3['id'];}utils[_0x8417('0x7')]('CreateVoiceRecording',_0x53a496);});}else{utils[_0x8417('0x7')]('CreateVoiceRecording',_0x53a496);}}exports[_0x8417('0x8')]=function(_0x5de882){try{utils[_0x8417('0x9')](util['format'](_0x8417('0xa'),_0x5de882[_0x8417('0xb')]),_0x5de882);if(_0x5de882[_0x8417('0xb')]==_0x5de882[_0x8417('0xc')]){utils[_0x8417('0xd')](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x5de882[_0x8417('0xb')],_0x5de882[_0x8417('0xe')],_0x5de882[_0x8417('0xf')]));recordings[_0x5de882[_0x8417('0xb')]]={'uniqueid':_0x5de882[_0x8417('0xb')],'accountcode':_0x5de882[_0x8417('0x2')],'exten':_0x5de882[_0x8417('0xf')],'context':_0x5de882['context'],'channel':_0x5de882[_0x8417('0x10')],'monitors':[]};}}catch(_0x47d0e1){utils['error'](util[_0x8417('0x0')](_0x8417('0xa'),_0x5de882[_0x8417('0xb')]),_0x47d0e1);}};exports[_0x8417('0x11')]=function(_0x4d43f2){try{utils[_0x8417('0x9')](util[_0x8417('0x0')]('[%s][recordings][newstate]',_0x4d43f2[_0x8417('0xb')]),_0x4d43f2);if(!_[_0x8417('0x12')](recordings[_0x4d43f2[_0x8417('0xb')]])&&_0x4d43f2[_0x8417('0x13')]==0x6){utils['info'](util[_0x8417('0x0')](_0x8417('0x14'),_0x4d43f2['uniqueid'],_0x4d43f2[_0x8417('0xe')],_0x4d43f2[_0x8417('0x10')]));}else if(!_[_0x8417('0x12')](recordings[_0x4d43f2['linkedid']])&&_0x4d43f2[_0x8417('0x13')]==0x6&&_0x4d43f2[_0x8417('0xe')]!=_0x8417('0x15')){utils[_0x8417('0xd')](util['format'](_0x8417('0x16'),_0x4d43f2['uniqueid'],_0x4d43f2[_0x8417('0xc')],_0x4d43f2[_0x8417('0xe')],_0x4d43f2['channel']));recordings[_0x4d43f2['linkedid']][_0x8417('0x2')]=_0x4d43f2[_0x8417('0x2')];}}catch(_0x4d483a){utils['error'](util[_0x8417('0x0')]('[%s][recordings][newstate]',_0x4d43f2[_0x8417('0xb')]),_0x4d483a);}};exports[_0x8417('0x17')]=function(_0x180db0){try{if(!_['isNil'](_0x180db0[_0x8417('0x18')])&&!_[_0x8417('0x12')](_0x180db0[_0x8417('0x18')]['mixmonitor_filename'])){utils[_0x8417('0x9')](util[_0x8417('0x0')](_0x8417('0x19'),_0x180db0['uniqueid']),_0x180db0);utils['info'](util[_0x8417('0x0')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x180db0[_0x8417('0xb')],_0x180db0['variable'],_0x180db0[_0x8417('0x1a')]));if(_[_0x8417('0x1b')](_0x180db0[_0x8417('0x1a')],_0x8417('0x1c'))){_0x180db0['value']=_0x180db0[_0x8417('0x1a')]['replace'](_0x8417('0x1c'),_0x8417('0x1d'));}if(recordings[_0x180db0['linkedid']]){var _0x12f883=_[_0x8417('0x1e')](recordings[_0x180db0[_0x8417('0xc')]][_0x8417('0x1f')],{'value':_0x180db0['value']});if(_[_0x8417('0x12')](_0x12f883)){recordings[_0x180db0['linkedid']][_0x8417('0x1f')][_0x8417('0x20')]({'value':_0x180db0[_0x8417('0x1a')]});}}}}catch(_0x2e04aa){utils['error'](util[_0x8417('0x0')](_0x8417('0x19'),_0x180db0[_0x8417('0xb')]),_0x2e04aa);}};exports[_0x8417('0x21')]=function(_0x1a83b7){try{if(!_[_0x8417('0x12')](recordings[_0x1a83b7[_0x8417('0xb')]])){utils[_0x8417('0x9')](util['format'](_0x8417('0x22'),_0x1a83b7[_0x8417('0xb')]),_0x1a83b7);utils[_0x8417('0xd')](util[_0x8417('0x0')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x1a83b7[_0x8417('0xb')],_0x1a83b7[_0x8417('0x23')],_0x1a83b7['calleridname'],_0x1a83b7[_0x8417('0x24')]));recordings[_0x1a83b7[_0x8417('0xb')]][_0x8417('0x23')]=_0x1a83b7[_0x8417('0x23')];recordings[_0x1a83b7[_0x8417('0xb')]][_0x8417('0x25')]=_0x1a83b7[_0x8417('0x25')];recordings[_0x1a83b7[_0x8417('0xb')]]['connectedlinenum']=_0x1a83b7[_0x8417('0x26')];recordings[_0x1a83b7['uniqueid']]['connectedlinename']=_0x1a83b7[_0x8417('0x27')];if(recordings[_0x1a83b7[_0x8417('0xb')]][_0x8417('0x28')]==_0x8417('0x29')&&recordings[_0x1a83b7[_0x8417('0xb')]]['accountcode']){recordings[_0x1a83b7[_0x8417('0xb')]]['connectedlinenum']=recordings[_0x1a83b7['uniqueid']]['accountcode'];recordings[_0x1a83b7[_0x8417('0xb')]][_0x8417('0x27')]='';}recordings[_0x1a83b7['uniqueid']]['monitors']['forEach'](function(_0x3829b0){var _0x3f14df=_['clone'](recordings[_0x1a83b7[_0x8417('0xb')]]);_0x3f14df[_0x8417('0x1a')]=_0x3829b0[_0x8417('0x1a')];writeDB(_0x3f14df);});delete recordings[_0x1a83b7['uniqueid']];}}catch(_0x2fe34f){utils[_0x8417('0x2a')](util['format'](_0x8417('0x22'),_0x1a83b7[_0x8417('0xb')]),_0x2fe34f);}};exports[_0x8417('0x2b')]=function(_0x53533d){try{if(!_[_0x8417('0x12')](recordings[_0x53533d[_0x8417('0xb')]])){utils[_0x8417('0x9')](util[_0x8417('0x0')](_0x8417('0x2c'),_0x53533d[_0x8417('0xb')]),_0x53533d);utils['info'](util[_0x8417('0x0')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x53533d['uniqueid'],_0x53533d[_0x8417('0x2d')],_0x53533d['appdata']));if(_0x53533d[_0x8417('0x2d')]['toLowerCase']()==_0x8417('0x2e')&&_[_0x8417('0x2f')](_0x53533d[_0x8417('0x30')]['toLowerCase'](),_0x8417('0x31'))){var _0x2c7950=_0x53533d[_0x8417('0x30')]['split']('=');var _0x1acd53=_0x2c7950[0x0]['substring'](_0x2c7950[0x0]['lastIndexOf']('(')+0x1,_0x2c7950[0x0]['lastIndexOf'](')'));var _0x48ec4c=_0x2c7950[0x1];recordings[_0x53533d[_0x8417('0xb')]][_0x1acd53]=_0x48ec4c;}}}catch(_0x4b1ab9){utils[_0x8417('0x2a')](util[_0x8417('0x0')](_0x8417('0x2c'),_0x53533d['uniqueid']),_0x4b1ab9);}};exports[_0x8417('0x32')]=function(_0x941e19){try{if(!_[_0x8417('0x12')](recordings[_0x941e19[_0x8417('0xb')]])){utils[_0x8417('0x9')](util[_0x8417('0x0')](_0x8417('0x33'),_0x941e19[_0x8417('0xb')]),_0x941e19);utils['info'](util[_0x8417('0x0')](_0x8417('0x34'),_0x941e19[_0x8417('0xb')],_0x941e19['queue']));recordings[_0x941e19['uniqueid']][_0x8417('0x35')]=_0x941e19['queue'];}}catch(_0x403ec0){utils[_0x8417('0x2a')](util[_0x8417('0x0')](_0x8417('0x33'),_0x941e19[_0x8417('0xb')]),_0x403ec0);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 26d9ef6..1a48dc9 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 _0x3b53=['blindtransfer','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport'];(function(_0x5da27f,_0x504b76){var _0x54a3fb=function(_0x3b65a8){while(--_0x3b65a8){_0x5da27f['push'](_0x5da27f['shift']());}};_0x54a3fb(++_0x504b76);}(_0x3b53,0x17a));var _0x33b5=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3b53[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x33b5('0x0'));function writeDB(_0x48d574){utils['info'](util[_0x33b5('0x1')](_0x33b5('0x2'),_0x48d574[_0x33b5('0x3')]===_0x33b5('0x4')?_0x48d574[_0x33b5('0x5')]:_0x48d574[_0x33b5('0x6')],_0x48d574[_0x33b5('0x3')]));utils[_0x33b5('0x7')](_0x33b5('0x8'),_0x48d574);}exports['blinds']={};exports[_0x33b5('0x9')]=function(_0x4f2c4a){try{utils['debug'](util[_0x33b5('0x1')](_0x33b5('0xa'),_0x4f2c4a[_0x33b5('0x6')]),_0x4f2c4a);utils[_0x33b5('0xb')](util[_0x33b5('0x1')](_0x33b5('0xc'),_0x4f2c4a[_0x33b5('0x6')],_0x4f2c4a[_0x33b5('0xd')],_0x4f2c4a[_0x33b5('0xe')],_0x4f2c4a['transfereecalleridnum'],_0x4f2c4a[_0x33b5('0xf')]));_0x4f2c4a[_0x33b5('0x3')]=_0x33b5('0x10');exports['blinds'][_0x4f2c4a[_0x33b5('0x11')]]=_0x4f2c4a;writeDB(_0x4f2c4a);}catch(_0x3a7295){utils[_0x33b5('0x12')](util['format']('[%s][transfers][blindtransfer]',_0x4f2c4a['uniqueid']),_0x3a7295);}};exports[_0x33b5('0x13')]=function(_0xde2b29){try{utils[_0x33b5('0x14')](util[_0x33b5('0x1')](_0x33b5('0x15'),_0xde2b29[_0x33b5('0x5')]),_0xde2b29);utils[_0x33b5('0xb')](util[_0x33b5('0x1')](_0x33b5('0x16'),_0xde2b29[_0x33b5('0x5')],_0xde2b29[_0x33b5('0x17')],_0xde2b29[_0x33b5('0x18')],_0xde2b29[_0x33b5('0x19')],_0xde2b29[_0x33b5('0x1a')]));_0xde2b29=_[_0x33b5('0x1b')](_0xde2b29,{'transfererchannel':_0xde2b29['origtransfererchannel'],'transferercalleridnum':_0xde2b29[_0x33b5('0x17')],'transferercalleridname':_0xde2b29[_0x33b5('0x18')],'transfererconnectedlinenum':_0xde2b29[_0x33b5('0x1c')],'transfererconnectedlinename':_0xde2b29[_0x33b5('0x1d')],'transfereraccountcode':_0xde2b29[_0x33b5('0x1e')],'transferercontext':_0xde2b29[_0x33b5('0x1f')],'transfererexten':_0xde2b29[_0x33b5('0x20')],'transfererlinkedid':_0xde2b29[_0x33b5('0x21')],'context':_0xde2b29[_0x33b5('0x22')],'extension':_0xde2b29[_0x33b5('0x23')],'type':_0x33b5('0x4')});if(_[_0x33b5('0x24')](_0xde2b29[_0x33b5('0x25')])){_0xde2b29=_[_0x33b5('0x1b')](_0xde2b29,{'transfereechannel':_0xde2b29[_0x33b5('0x26')],'transfereecalleridnum':_0xde2b29['transfertargetcalleridnum'],'transfereecalleridname':_0xde2b29['transfertargetcalleridname'],'transfereeconnectedlinenum':_0xde2b29['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0xde2b29[_0x33b5('0x27')],'transfereeaccountcode':_0xde2b29[_0x33b5('0x28')],'transfereecontext':_0xde2b29['transfertargetcontext'],'transfereeexten':_0xde2b29[_0x33b5('0x29')],'transfereelinkedid':_0xde2b29[_0x33b5('0x2a')]});}writeDB(_0xde2b29);}catch(_0x15c06a){utils[_0x33b5('0x12')](util['format'](_0x33b5('0x15'),_0xde2b29[_0x33b5('0x5')]),_0x15c06a);}}; \ No newline at end of file +var _0x574e=['uniqueid','type','request','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfereecalleridnum','blind','transfereruniqueid','error','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','[%s][transfers][attendedtransfer]','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','origtransfereruniqueid'];(function(_0x47f537,_0x1c8fc6){var _0x22b68b=function(_0x41b99a){while(--_0x41b99a){_0x47f537['push'](_0x47f537['shift']());}};_0x22b68b(++_0x1c8fc6);}(_0x574e,0x1c2));var _0xe574=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x574e[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require('lodash');var util=require(_0xe574('0x0'));var utils=require(_0xe574('0x1'));function writeDB(_0x3f8b31){utils[_0xe574('0x2')](util[_0xe574('0x3')](_0xe574('0x4'),_0x3f8b31['type']==='attended'?_0x3f8b31[_0xe574('0x5')]:_0x3f8b31[_0xe574('0x6')],_0x3f8b31[_0xe574('0x7')]));utils[_0xe574('0x8')](_0xe574('0x9'),_0x3f8b31);}exports['blinds']={};exports['blindtransfer']=function(_0x21b719){try{utils[_0xe574('0xa')](util[_0xe574('0x3')](_0xe574('0xb'),_0x21b719[_0xe574('0x6')]),_0x21b719);utils[_0xe574('0x2')](util[_0xe574('0x3')](_0xe574('0xc'),_0x21b719[_0xe574('0x6')],_0x21b719['transferercalleridnum'],_0x21b719['transferercalleridname'],_0x21b719[_0xe574('0xd')],_0x21b719['transfereecalleridname']));_0x21b719[_0xe574('0x7')]=_0xe574('0xe');exports['blinds'][_0x21b719[_0xe574('0xf')]]=_0x21b719;writeDB(_0x21b719);}catch(_0x206d1a){utils[_0xe574('0x10')](util[_0xe574('0x3')](_0xe574('0xb'),_0x21b719['uniqueid']),_0x206d1a);}};exports['attendedtransfer']=function(_0x46f0a2){try{utils[_0xe574('0xa')](util[_0xe574('0x3')]('[%s][transfers][attendedtransfer]',_0x46f0a2[_0xe574('0x5')]),_0x46f0a2);utils[_0xe574('0x2')](util[_0xe574('0x3')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x46f0a2[_0xe574('0x5')],_0x46f0a2[_0xe574('0x11')],_0x46f0a2[_0xe574('0x12')],_0x46f0a2[_0xe574('0x13')],_0x46f0a2[_0xe574('0x14')]));_0x46f0a2=_[_0xe574('0x15')](_0x46f0a2,{'transfererchannel':_0x46f0a2['origtransfererchannel'],'transferercalleridnum':_0x46f0a2[_0xe574('0x11')],'transferercalleridname':_0x46f0a2['origtransferercalleridname'],'transfererconnectedlinenum':_0x46f0a2['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x46f0a2[_0xe574('0x16')],'transfereraccountcode':_0x46f0a2[_0xe574('0x17')],'transferercontext':_0x46f0a2[_0xe574('0x18')],'transfererexten':_0x46f0a2[_0xe574('0x19')],'transfererlinkedid':_0x46f0a2[_0xe574('0x1a')],'context':_0x46f0a2[_0xe574('0x1b')],'extension':_0x46f0a2[_0xe574('0x1c')],'type':_0xe574('0x1d')});if(_[_0xe574('0x1e')](_0x46f0a2[_0xe574('0x1f')])){_0x46f0a2=_[_0xe574('0x15')](_0x46f0a2,{'transfereechannel':_0x46f0a2[_0xe574('0x20')],'transfereecalleridnum':_0x46f0a2[_0xe574('0x13')],'transfereecalleridname':_0x46f0a2['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x46f0a2['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x46f0a2[_0xe574('0x21')],'transfereeaccountcode':_0x46f0a2[_0xe574('0x22')],'transfereecontext':_0x46f0a2[_0xe574('0x23')],'transfereeexten':_0x46f0a2[_0xe574('0x24')],'transfereelinkedid':_0x46f0a2['transfertargetlinkedid']});}writeDB(_0x46f0a2);}catch(_0x25c071){utils[_0xe574('0x10')](util[_0xe574('0x3')](_0xe574('0x25'),_0x46f0a2[_0xe574('0x5')]),_0x25c071);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 9d7fc78..b8917a0 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 _0x7a54=['result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtract','format','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','xdr','info','debug','error','inspect','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify'];(function(_0x4b8d93,_0x3ab6f1){var _0x46b65e=function(_0x1db7d4){while(--_0x1db7d4){_0x4b8d93['push'](_0x4b8d93['shift']());}};_0x46b65e(++_0x3ab6f1);}(_0x7a54,0x106));var _0x47a5=function(_0x328a26,_0x1d1d4c){_0x328a26=_0x328a26-0x0;var _0x180399=_0x7a54[_0x328a26];return _0x180399;};'use strict';var BPromise=require(_0x47a5('0x0'));var jayson=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var util=require('util');var client=jayson[_0x47a5('0x3')][_0x47a5('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x47a5('0x5'));exports[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){logger[_0x47a5('0x6')](_0x2a1a7e,_0x3717e1?util['inspect'](_0x3717e1,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x7')]=function(_0x59199c,_0x343372){logger[_0x47a5('0x7')](_0x59199c,_0x343372?util['inspect'](_0x343372,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x8')]=function(_0x5077f3,_0x5d90b3){logger['error'](_0x5077f3,_0x5d90b3?util[_0x47a5('0x9')](_0x5d90b3,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0xa')]=function(_0x5e31dd,_0x2eb0dd){return client['request'](_0x5e31dd,{'body':_0x2eb0dd})['then'](function(_0x1f47f4){logger[_0x47a5('0x7')](_0x47a5('0xb'),_0x5e31dd,_0x1f47f4?util[_0x47a5('0x9')](_0x1f47f4,{'showHidden':![],'depth':null}):'');})[_0x47a5('0xc')](function(_0xd308b8){logger[_0x47a5('0x8')]('[utils][request]\x20name:%s',_0x5e31dd,_0xd308b8?util[_0x47a5('0x9')](_0xd308b8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x221b54){return client[_0x47a5('0xa')](_0x47a5('0xd'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xe'),_0x47a5('0xf'),_0x47a5('0x10')],'where':_0x221b54,'limit':0x1}})[_0x47a5('0x11')](function(_0x4e99a8){logger[_0x47a5('0x7')](_0x47a5('0x12'),JSON[_0x47a5('0x13')](_0x221b54),_0x4e99a8?util[_0x47a5('0x9')](_0x4e99a8,{'showHidden':![],'depth':null}):'');return _0x4e99a8[_0x47a5('0x14')]['length']?_0x4e99a8['result'][0x0]:null;});}exports[_0x47a5('0x15')]=function(_0x4b966e){return new BPromise(function(_0x5247fd,_0x423a81){if(_0x4b966e){return getUser({'internal':_0x4b966e})[_0x47a5('0x11')](function(_0x2ce454){logger[_0x47a5('0x6')](_0x47a5('0x16'),_0x4b966e,_0x2ce454?_0x47a5('0x17'):_0x47a5('0x18'));return _0x5247fd(_0x2ce454);})[_0x47a5('0xc')](function(_0x3aed38){logger['error'](_0x47a5('0x19'),_0x3aed38?util[_0x47a5('0x9')](_0x3aed38,{'showHidden':![],'depth':null}):'');return _0x5247fd(null);});}return _0x5247fd(null);});};exports['getUserByInterface']=function(_0x2b0360){return new BPromise(function(_0x1f03f7,_0x36874d){if(_0x2b0360){return getUser({'interface':_0x2b0360})['then'](function(_0xb8ae6c){logger[_0x47a5('0x6')](_0x47a5('0x1a'),_0x2b0360,_0xb8ae6c?_0x47a5('0x17'):'notfound');return _0x1f03f7(_0xb8ae6c);})[_0x47a5('0xc')](function(_0x385687){logger['error'](_0x47a5('0x1b'),_0x385687?util[_0x47a5('0x9')](_0x385687,{'showHidden':![],'depth':null}):'');return _0x1f03f7(null);});}return _0x1f03f7(null);});};exports[_0x47a5('0x1c')]=function(_0x129ce5){return new BPromise(function(_0x3abd6a,_0x50bf17){if(_0x129ce5){return getUser({'name':_0x129ce5})['then'](function(_0x136745){logger['info'](_0x47a5('0x1d'),_0x129ce5,_0x136745?'found':_0x47a5('0x18'));return _0x3abd6a(_0x136745);})[_0x47a5('0xc')](function(_0x36ad34){logger[_0x47a5('0x8')](_0x47a5('0x1e'),_0x36ad34?util[_0x47a5('0x9')](_0x36ad34,{'showHidden':![],'depth':null}):'');return _0x3abd6a(null);});}return _0x3abd6a(null);});};exports[_0x47a5('0x1f')]=function(_0x136b14){return new BPromise(function(_0x16631f,_0x361bfa){if(_0x136b14){return client[_0x47a5('0xa')](_0x47a5('0x20'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xf'),'type',_0x47a5('0x21'),'acwTimeout'],'where':{'name':_0x136b14},'limit':0x1}})[_0x47a5('0x11')](function(_0x9ac908){logger[_0x47a5('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x136b14,_0x9ac908?util[_0x47a5('0x9')](_0x9ac908,{'showHidden':![],'depth':null}):'');logger[_0x47a5('0x6')](_0x47a5('0x22'),_0x136b14,_0x9ac908?_0x47a5('0x17'):'notfound');return _0x16631f(_0x9ac908['result'][_0x47a5('0x23')]?_0x9ac908[_0x47a5('0x14')][0x0]:null);})['catch'](function(_0x4e1006){logger[_0x47a5('0x8')](_0x47a5('0x24'),_0x4e1006?util['inspect'](_0x4e1006,{'showHidden':![],'depth':null}):'');return _0x16631f(null);});}return _0x16631f(null);});};exports[_0x47a5('0x25')]=function(_0x53119b,_0x122ed6){return moment(_0x53119b)[_0x47a5('0x26')](_0x122ed6,'seconds')['format'](_0x47a5('0x27'));};exports['subtractTime']=function(_0x403028,_0x87e4c9){return moment(_0x403028)[_0x47a5('0x28')](_0x87e4c9,'seconds')[_0x47a5('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x65542e,_0x5a8a7c){return moment(_0x65542e)[_0x47a5('0x2a')](moment(_0x5a8a7c),'seconds');};exports[_0x47a5('0x2b')]=function(_0x3534cb,_0x38c8d4){return parseInt(_0x3534cb,0xa)+parseInt(_0x38c8d4,0xa);};exports[_0x47a5('0x2c')]=function(){return moment()[_0x47a5('0x29')](_0x47a5('0x27'));};exports[_0x47a5('0x2d')]=function(_0x452be5,_0x1a0d23){if(_0x1a0d23){return moment(_0x452be5)['isAfter'](_0x1a0d23);}return!![];};exports[_0x47a5('0x2e')]=function(_0x10f136,_0x511c06){if(_0x511c06){return moment(_0x10f136)[_0x47a5('0x2e')](_0x511c06);}else if(_0x10f136){return!![];}return![];}; \ No newline at end of file +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(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xb10b,0x12a));var _0xbb10=function(_0x162cbe,_0x2bd216){_0x162cbe=_0x162cbe-0x0;var _0x2847ce=_0xb10b[_0x162cbe];return _0x2847ce;};'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